From: Andrea Bianco Date: Thu, 15 Apr 2021 11:55:42 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.24 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=fa579f4be078a884a88293e4b5eb269e516f4247;p=motion2.git Built motion from commit (unavailable).|2.5.24 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b24271a..60b51cf 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-04-15T08:18:24.159Z", + "time": "2021-04-15T11:45:47.661Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9af7a65..96608ca 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-04-15T08:18:24.159Z", + "time": "2021-04-15T11:45:47.661Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index a1b2a13..bff96d6 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 _0x8e08=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','script'];(function(_0x36d04c,_0x2174d7){var _0x2f2d4c=function(_0x8f2d49){while(--_0x8f2d49){_0x36d04c['push'](_0x36d04c['shift']());}};_0x2f2d4c(++_0x2174d7);}(_0x8e08,0xd1));var _0x88e0=function(_0x70f496,_0x5d1fb1){_0x70f496=_0x70f496-0x0;var _0x3b0f71=_0x8e08[_0x70f496];return _0x3b0f71;};'use strict';var Sequelize=require('sequelize');module[_0x88e0('0x0')]={'name':{'type':Sequelize[_0x88e0('0x1')],'get':function(_0x36b8b5){return this[_0x88e0('0x2')](_0x88e0('0x3'));}},'action':{'type':Sequelize[_0x88e0('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x88e0('0x5'),_0x88e0('0x6'),_0x88e0('0x7'),_0x88e0('0x8'),'urlForward',_0x88e0('0x9'),_0x88e0('0xa'),_0x88e0('0xb')]],'msg':_0x88e0('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x88e0('0x4')](0x1000),'comment':_0x88e0('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x88e0('0xe')},'data3':{'type':Sequelize[_0x88e0('0x4')](0x1000),'comment':_0x88e0('0xf')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x88e0('0x4')](0x1000)},'data6':{'type':Sequelize[_0x88e0('0x4')]},'data7':{'type':Sequelize[_0x88e0('0x10')]}}; \ No newline at end of file +var _0x85f6=['browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x531e9b,_0x486a52){var _0x29eca7=function(_0x64fe91){while(--_0x64fe91){_0x531e9b['push'](_0x531e9b['shift']());}};_0x29eca7(++_0x486a52);}(_0x85f6,0x106));var _0x685f=function(_0x2cb034,_0x197d6a){_0x2cb034=_0x2cb034-0x0;var _0x2174cf=_0x85f6[_0x2cb034];return _0x2174cf;};'use strict';var Sequelize=require(_0x685f('0x0'));module['exports']={'name':{'type':Sequelize[_0x685f('0x1')],'get':function(_0x33730d){return this[_0x685f('0x2')]('action');}},'action':{'type':Sequelize[_0x685f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x685f('0x4'),_0x685f('0x5'),_0x685f('0x6'),_0x685f('0x7'),'urlForward',_0x685f('0x8'),_0x685f('0x9'),'script']],'msg':_0x685f('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x685f('0xb')},'data2':{'type':Sequelize[_0x685f('0x3')](0x1000),'comment':_0x685f('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x685f('0xd')},'data4':{'type':Sequelize[_0x685f('0x3')](0x1000)},'data5':{'type':Sequelize[_0x685f('0x3')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x685f('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b8e149e..531c861 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 _0x8958=['end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','body','Action','find','catch','params','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x167d20,_0x1c6e44){var _0x5428bb=function(_0x53a48a){while(--_0x53a48a){_0x167d20['push'](_0x167d20['shift']());}};_0x5428bb(++_0x1c6e44);}(_0x8958,0x93));var _0x8895=function(_0x1d39d2,_0x3c0489){_0x1d39d2=_0x1d39d2-0x0;var _0x3eec2c=_0x8958[_0x1d39d2];return _0x3eec2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var licenseUtil=require(_0x8895('0x15'));var db=require(_0x8895('0x16'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x17')](_0xaf93bc);}return _0x446e1a[_0x8895('0x18')](_0xaf93bc)[_0x8895('0x19')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1a')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=_0x3d7b59[_0x8895('0x1b')],_0x5b4c2e=_0x195789[_0x8895('0x1c')],_0x4128e2=_0x195789[_0x8895('0x1c')]+_0x195789[_0x8895('0x1d')],_0x100fc8;if(_0x4128e2>=_0x2c9d40){_0x4128e2=_0x2c9d40;_0x100fc8=0xc8;}else{_0x100fc8=0xce;}_0x337101[_0x8895('0x18')](_0x100fc8);return _0x337101[_0x8895('0x1e')](_0x8895('0x1f'),_0x5b4c2e+'-'+_0x4128e2+'/'+_0x2c9d40)[_0x8895('0x1a')](_0x3d7b59);}return null;};}function patchUpdates(_0x24fef0){return function(_0x6b8a16){try{jsonpatch[_0x8895('0x20')](_0x6b8a16,_0x24fef0,!![]);}catch(_0x54e6d4){return BPromise['reject'](_0x54e6d4);}return _0x6b8a16['save']();};}function saveUpdates(_0x3daf43,_0x456282){return function(_0x2d189c){if(_0x2d189c){return _0x2d189c[_0x8895('0x21')](_0x3daf43)[_0x8895('0x22')](function(_0x35bda5){return _0x35bda5;});}return null;};}function removeEntity(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')]()[_0x8895('0x22')](function(){_0x461346[_0x8895('0x18')](0xcc)[_0x8895('0x19')]();});}};}function handleEntityNotFound(_0x29223d,_0x4d092d){return function(_0x5d354a){if(!_0x5d354a){_0x29223d[_0x8895('0x17')](0x194);}return _0x5d354a;};}function handleError(_0x398382,_0x38f7ad){_0x38f7ad=_0x38f7ad||0x1f4;return function(_0x24a376){logger['error'](_0x24a376[_0x8895('0x24')]);if(_0x24a376[_0x8895('0x25')]){delete _0x24a376[_0x8895('0x25')];}_0x398382['status'](_0x38f7ad)['send'](_0x24a376);};}exports[_0x8895('0x21')]=function(_0x555e60,_0x3d51b0){if(_0x555e60[_0x8895('0x26')]['id']){delete _0x555e60[_0x8895('0x26')]['id'];}return db[_0x8895('0x27')][_0x8895('0x28')]({'where':{'id':_0x555e60['params']['id']}})['then'](handleEntityNotFound(_0x3d51b0,null))[_0x8895('0x22')](saveUpdates(_0x555e60[_0x8895('0x26')],null))[_0x8895('0x22')](respondWithResult(_0x3d51b0,null))[_0x8895('0x29')](handleError(_0x3d51b0,null));};exports[_0x8895('0x23')]=function(_0x560b93,_0x4ce759){return db[_0x8895('0x27')][_0x8895('0x28')]({'where':{'id':_0x560b93[_0x8895('0x2a')]['id']}})[_0x8895('0x22')](handleEntityNotFound(_0x4ce759,null))[_0x8895('0x22')](removeEntity(_0x4ce759,null))['catch'](handleError(_0x4ce759,null));}; \ No newline at end of file +var _0x7c49=['update','body','Action','find','params','catch','html-pdf','eml-format','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x7c49,0x141));var _0x97c4=function(_0x5cbaee,_0x337ef6){_0x5cbaee=_0x5cbaee-0x0;var _0x218582=_0x7c49[_0x5cbaee];return _0x218582;};'use strict';var pdf=require(_0x97c4('0x0'));var emlformat=require(_0x97c4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97c4('0x2'));var rp=require('request-promise');var moment=require(_0x97c4('0x3'));var BPromise=require(_0x97c4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x97c4('0x5'));var sox=require(_0x97c4('0x6'));var csv=require(_0x97c4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97c4('0x8'));var squel=require(_0x97c4('0x9'));var crypto=require(_0x97c4('0xa'));var jsforce=require(_0x97c4('0xb'));var deskjs=require(_0x97c4('0xc'));var toCsv=require(_0x97c4('0x7'));var querystring=require(_0x97c4('0xd'));var Papa=require(_0x97c4('0xe'));var Redis=require(_0x97c4('0xf'));var authService=require(_0x97c4('0x10'));var qs=require(_0x97c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x97c4('0x12'))(_0x97c4('0x13'));var utils=require('../../config/utils');var config=require(_0x97c4('0x14'));var licenseUtil=require(_0x97c4('0x15'));var db=require(_0x97c4('0x16'))['db'];function respondWithStatusCode(_0x5bd0a2,_0x4e5e98){_0x4e5e98=_0x4e5e98||0xcc;return function(_0x1f16cc){if(_0x1f16cc){return _0x5bd0a2[_0x97c4('0x17')](_0x4e5e98);}return _0x5bd0a2['status'](_0x4e5e98)[_0x97c4('0x18')]();};}function respondWithResult(_0x519188,_0xbd9965){_0xbd9965=_0xbd9965||0xc8;return function(_0x37b746){if(_0x37b746){return _0x519188[_0x97c4('0x19')](_0xbd9965)[_0x97c4('0x1a')](_0x37b746);}};}function respondWithFilteredResult(_0x94f8ed,_0x3434ee){return function(_0x50d8ad){if(_0x50d8ad){var _0x1fff7e=_0x50d8ad[_0x97c4('0x1b')],_0x5d6fc3=_0x3434ee[_0x97c4('0x1c')],_0x23b79f=_0x3434ee[_0x97c4('0x1c')]+_0x3434ee[_0x97c4('0x1d')],_0x465c79;if(_0x23b79f>=_0x1fff7e){_0x23b79f=_0x1fff7e;_0x465c79=0xc8;}else{_0x465c79=0xce;}_0x94f8ed[_0x97c4('0x19')](_0x465c79);return _0x94f8ed[_0x97c4('0x1e')](_0x97c4('0x1f'),_0x5d6fc3+'-'+_0x23b79f+'/'+_0x1fff7e)[_0x97c4('0x1a')](_0x50d8ad);}return null;};}function patchUpdates(_0x49f5c1){return function(_0x317916){try{jsonpatch[_0x97c4('0x20')](_0x317916,_0x49f5c1,!![]);}catch(_0x460c5b){return BPromise['reject'](_0x460c5b);}return _0x317916[_0x97c4('0x21')]();};}function saveUpdates(_0x222ba2,_0x288284){return function(_0x4cff1a){if(_0x4cff1a){return _0x4cff1a['update'](_0x222ba2)['then'](function(_0x5d6a53){return _0x5d6a53;});}return null;};}function removeEntity(_0x3373f8,_0x3447fc){return function(_0x40859){if(_0x40859){return _0x40859[_0x97c4('0x22')]()[_0x97c4('0x23')](function(){_0x3373f8[_0x97c4('0x19')](0xcc)[_0x97c4('0x18')]();});}};}function handleEntityNotFound(_0x3c00aa,_0x42abf6){return function(_0x1420b6){if(!_0x1420b6){_0x3c00aa[_0x97c4('0x17')](0x194);}return _0x1420b6;};}function handleError(_0x16ddef,_0x163a22){_0x163a22=_0x163a22||0x1f4;return function(_0x4afb57){logger[_0x97c4('0x24')](_0x4afb57[_0x97c4('0x25')]);if(_0x4afb57[_0x97c4('0x26')]){delete _0x4afb57['name'];}_0x16ddef[_0x97c4('0x19')](_0x163a22)['send'](_0x4afb57);};}exports[_0x97c4('0x27')]=function(_0xafcc3d,_0x355e48){if(_0xafcc3d[_0x97c4('0x28')]['id']){delete _0xafcc3d[_0x97c4('0x28')]['id'];}return db[_0x97c4('0x29')][_0x97c4('0x2a')]({'where':{'id':_0xafcc3d[_0x97c4('0x2b')]['id']}})[_0x97c4('0x23')](handleEntityNotFound(_0x355e48,null))[_0x97c4('0x23')](saveUpdates(_0xafcc3d[_0x97c4('0x28')],null))['then'](respondWithResult(_0x355e48,null))[_0x97c4('0x2c')](handleError(_0x355e48,null));};exports[_0x97c4('0x22')]=function(_0x4a7661,_0x57081f){return db[_0x97c4('0x29')]['find']({'where':{'id':_0x4a7661[_0x97c4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x57081f,null))[_0x97c4('0x23')](removeEntity(_0x57081f,null))[_0x97c4('0x2c')](handleError(_0x57081f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 556bce8..c9c26b6 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 _0x75a8=['Action','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./action.attributes'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x75a8,0xfd));var _0x875a=function(_0x3a4cf0,_0x5c8bc6){_0x3a4cf0=_0x3a4cf0-0x0;var _0x36929b=_0x75a8[_0x3a4cf0];return _0x36929b;};'use strict';var _=require('lodash');var util=require(_0x875a('0x0'));var logger=require(_0x875a('0x1'))(_0x875a('0x2'));var moment=require(_0x875a('0x3'));var BPromise=require(_0x875a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x875a('0x5'));var rimraf=require('rimraf');var config=require(_0x875a('0x6'));var attributes=require(_0x875a('0x7'));module['exports']=function(_0x4b0256,_0x600691){return _0x4b0256['define'](_0x875a('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x520a=['exports','Action','tools_actions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x2a7530,_0xe33b7a){var _0xd07720=function(_0x4f3353){while(--_0x4f3353){_0x2a7530['push'](_0x2a7530['shift']());}};_0xd07720(++_0xe33b7a);}(_0x520a,0x7b));var _0xa520=function(_0x4a1978,_0x3ca5ba){_0x4a1978=_0x4a1978-0x0;var _0x4d1f30=_0x520a[_0x4a1978];return _0x4d1f30;};'use strict';var _=require(_0xa520('0x0'));var util=require(_0xa520('0x1'));var logger=require(_0xa520('0x2'))('api');var moment=require(_0xa520('0x3'));var BPromise=require('bluebird');var rp=require(_0xa520('0x4'));var fs=require('fs');var path=require(_0xa520('0x5'));var rimraf=require(_0xa520('0x6'));var config=require(_0xa520('0x7'));var attributes=require(_0xa520('0x8'));module[_0xa520('0x9')]=function(_0x144239,_0x2dddad){return _0x144239['define'](_0xa520('0xa'),attributes,{'tableName':_0xa520('0xb'),'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 7ebeb89..3c6fc90 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(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x5e2068,_0x6f161b){var _0x4dcec3=function(_0x4b3baa){while(--_0x4b3baa){_0x5e2068['push'](_0x5e2068['shift']());}};_0x4dcec3(++_0x6f161b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ff3d377..3ef6042 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 _0xf1c3=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','/:id','isAuthenticated','delete'];(function(_0x2d210d,_0xe1febc){var _0x54b7b2=function(_0x6c889e){while(--_0x6c889e){_0x2d210d['push'](_0x2d210d['shift']());}};_0x54b7b2(++_0xe1febc);}(_0xf1c3,0x12b));var _0x3f1c=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xf1c3[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x3f1c('0x0'));var util=require(_0x3f1c('0x1'));var path=require(_0x3f1c('0x2'));var timeout=require(_0x3f1c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3f1c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f1c('0x5'));var controller=require('./action.controller');router['put'](_0x3f1c('0x6'),auth[_0x3f1c('0x7')](),controller['update']);router[_0x3f1c('0x8')](_0x3f1c('0x6'),auth[_0x3f1c('0x7')](),controller[_0x3f1c('0x9')]);module[_0x3f1c('0xa')]=router; \ No newline at end of file +var _0xbc4e=['isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./action.controller','put','/:id'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0xbc4e,0x115));var _0xebc4=function(_0x3584f2,_0x42c461){_0x3584f2=_0x3584f2-0x0;var _0x455630=_0xbc4e[_0x3584f2];return _0x455630;};'use strict';var multer=require(_0xebc4('0x0'));var util=require(_0xebc4('0x1'));var path=require(_0xebc4('0x2'));var timeout=require(_0xebc4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xebc4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xebc4('0x5'));var controller=require(_0xebc4('0x6'));router[_0xebc4('0x7')](_0xebc4('0x8'),auth[_0xebc4('0x9')](),controller['update']);router[_0xebc4('0xa')](_0xebc4('0x8'),auth['isAuthenticated'](),controller[_0xebc4('0xb')]);module[_0xebc4('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ab8a5d6..3cd7e74 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 _0xcf81=['sequelize','STRING','TEXT'];(function(_0x55228b,_0x405709){var _0x3a54ef=function(_0x3b479a){while(--_0x3b479a){_0x55228b['push'](_0x55228b['shift']());}};_0x3a54ef(++_0x405709);}(_0xcf81,0x11a));var _0x1cf8=function(_0x205f65,_0x58589e){_0x205f65=_0x205f65-0x0;var _0x511fa0=_0xcf81[_0x205f65];return _0x511fa0;};'use strict';var Sequelize=require(_0x1cf8('0x0'));module['exports']={'name':{'type':Sequelize[_0x1cf8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x1cf8('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x1cf8('0x2')]}}; \ No newline at end of file +var _0x0caf=['exports','STRING','TEXT','sequelize'];(function(_0x197d09,_0x20bc1f){var _0x1cb941=function(_0x504d83){while(--_0x504d83){_0x197d09['push'](_0x197d09['shift']());}};_0x1cb941(++_0x20bc1f);}(_0x0caf,0x103));var _0xf0ca=function(_0x41896d,_0x315c58){_0x41896d=_0x41896d-0x0;var _0x2c5eb=_0x0caf[_0x41896d];return _0x2c5eb;};'use strict';var Sequelize=require(_0xf0ca('0x0'));module[_0xf0ca('0x1')]={'name':{'type':Sequelize[_0xf0ca('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xf0ca('0x2')]},'table':{'type':Sequelize[_0xf0ca('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xf0ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ea3c02b..e7ca4fc 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 _0x39f8=['startDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','foreignKey','html-pdf','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/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','join','cross_join','SUM(%s)','MIN(%s)','AVG(%s)','SEC_TO_TIME(%s)','from','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x3eb0d5,_0x4cabb0){var _0x541f64=function(_0x4ed5e9){while(--_0x4ed5e9){_0x3eb0d5['push'](_0x3eb0d5['shift']());}};_0x541f64(++_0x4cabb0);}(_0x39f8,0xb3));var _0x839f=function(_0x9110c6,_0x3052c9){_0x9110c6=_0x9110c6-0x0;var _0x1562ea=_0x39f8[_0x9110c6];return _0x1562ea;};'use strict';var pdf=require(_0x839f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x839f('0x1'));var zipdir=require(_0x839f('0x2'));var jsonpatch=require(_0x839f('0x3'));var rp=require(_0x839f('0x4'));var moment=require(_0x839f('0x5'));var BPromise=require(_0x839f('0x6'));var Mustache=require(_0x839f('0x7'));var util=require('util');var path=require(_0x839f('0x8'));var sox=require('sox');var csv=require(_0x839f('0x9'));var ejs=require(_0x839f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x839f('0xb'));var crypto=require('crypto');var jsforce=require(_0x839f('0xc'));var deskjs=require(_0x839f('0xd'));var toCsv=require(_0x839f('0x9'));var querystring=require(_0x839f('0xe'));var Papa=require(_0x839f('0xf'));var Redis=require(_0x839f('0x10'));var authService=require(_0x839f('0x11'));var qs=require(_0x839f('0x12'));var as=require(_0x839f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x839f('0x14'));var utils=require(_0x839f('0x15'));var config=require(_0x839f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x839f('0x17'))['db'];var dbH=require('../../mysqldb')[_0x839f('0x18')];function respondWithStatusCode(_0x4147e4,_0xb0c719){_0xb0c719=_0xb0c719||0xcc;return function(_0x25b7dd){if(_0x25b7dd){return _0x4147e4[_0x839f('0x19')](_0xb0c719);}return _0x4147e4[_0x839f('0x1a')](_0xb0c719)[_0x839f('0x1b')]();};}function respondWithResult(_0x566883,_0x1c69d9){_0x1c69d9=_0x1c69d9||0xc8;return function(_0x3dee67){if(_0x3dee67){return _0x566883[_0x839f('0x1a')](_0x1c69d9)[_0x839f('0x1c')](_0x3dee67);}};}function respondWithFilteredResult(_0x58cf55,_0x4441ed){return function(_0x4018e6){if(_0x4018e6){var _0xaac648=_0x4018e6[_0x839f('0x1d')],_0x43e662=_0x4441ed[_0x839f('0x1e')],_0x489743=_0x4441ed[_0x839f('0x1e')]+_0x4441ed[_0x839f('0x1f')],_0x1b30f1;if(_0x489743>=_0xaac648){_0x489743=_0xaac648;_0x1b30f1=0xc8;}else{_0x1b30f1=0xce;}_0x58cf55[_0x839f('0x1a')](_0x1b30f1);return _0x58cf55[_0x839f('0x20')]('Content-Range',_0x43e662+'-'+_0x489743+'/'+_0xaac648)['json'](_0x4018e6);}return null;};}function patchUpdates(_0x4cfbb9){return function(_0x326003){try{jsonpatch['apply'](_0x326003,_0x4cfbb9,!![]);}catch(_0x1225d9){return BPromise[_0x839f('0x21')](_0x1225d9);}return _0x326003['save']();};}function saveUpdates(_0x321ad2,_0xaef648){return function(_0x388b3b){if(_0x388b3b){return _0x388b3b[_0x839f('0x22')](_0x321ad2)[_0x839f('0x23')](function(_0x217f58){return _0x217f58;});}return null;};}function removeEntity(_0x345e13,_0x56e280){return function(_0x451100){if(_0x451100){return _0x451100[_0x839f('0x24')]()[_0x839f('0x23')](function(){var _0x188336=_0x451100[_0x839f('0x25')]({'plain':!![]});var _0x42a86b=_0x839f('0x26');return db[_0x839f('0x27')][_0x839f('0x24')]({'where':{'type':_0x42a86b,'resourceId':_0x188336['id']}})[_0x839f('0x23')](function(){return _0x451100;});})['then'](function(){_0x345e13[_0x839f('0x1a')](0xcc)[_0x839f('0x1b')]();});}};}function handleEntityNotFound(_0xd16c02,_0x12f981){return function(_0x250582){if(!_0x250582){_0xd16c02['sendStatus'](0x194);}return _0x250582;};}function handleError(_0x391198,_0x68788){_0x68788=_0x68788||0x1f4;return function(_0x12b73f){logger[_0x839f('0x28')](_0x12b73f[_0x839f('0x29')]);if(_0x12b73f[_0x839f('0x2a')]){delete _0x12b73f[_0x839f('0x2a')];}_0x391198[_0x839f('0x1a')](_0x68788)[_0x839f('0x2b')](_0x12b73f);};}exports[_0x839f('0x2c')]=function(_0x5977f3,_0x2856ab){var _0x10b3cd={},_0x38ef93={},_0x18175e={'count':0x0,'rows':[]};var _0x5ec155=_[_0x839f('0x2d')](db[_0x839f('0x2e')][_0x839f('0x2f')],function(_0x3b3661){return{'name':_0x3b3661[_0x839f('0x30')],'type':_0x3b3661[_0x839f('0x31')]['key']};});_0x38ef93['model']=_[_0x839f('0x2d')](_0x5ec155,_0x839f('0x2a'));_0x38ef93[_0x839f('0x32')]=_[_0x839f('0x33')](_0x5977f3[_0x839f('0x32')]);_0x38ef93[_0x839f('0x34')]=_[_0x839f('0x35')](_0x38ef93[_0x839f('0x36')],_0x38ef93[_0x839f('0x32')]);_0x10b3cd[_0x839f('0x37')]=_[_0x839f('0x35')](_0x38ef93[_0x839f('0x36')],qs[_0x839f('0x38')](_0x5977f3['query']['fields']));_0x10b3cd[_0x839f('0x37')]=_0x10b3cd['attributes'][_0x839f('0x39')]?_0x10b3cd['attributes']:_0x38ef93['model'];if(!_0x5977f3[_0x839f('0x32')]['hasOwnProperty'](_0x839f('0x3a'))){_0x10b3cd[_0x839f('0x1f')]=qs[_0x839f('0x1f')](_0x5977f3['query'][_0x839f('0x1f')]);_0x10b3cd[_0x839f('0x1e')]=qs[_0x839f('0x1e')](_0x5977f3[_0x839f('0x32')][_0x839f('0x1e')]);}_0x10b3cd[_0x839f('0x3b')]=qs[_0x839f('0x3c')](_0x5977f3[_0x839f('0x32')][_0x839f('0x3c')]);_0x10b3cd[_0x839f('0x3d')]=qs[_0x839f('0x34')](_['pick'](_0x5977f3['query'],_0x38ef93[_0x839f('0x34')]),_0x5ec155);if(_0x5977f3[_0x839f('0x32')][_0x839f('0x3e')]){_0x10b3cd['where']=_[_0x839f('0x3f')](_0x10b3cd[_0x839f('0x3d')],{'$or':_[_0x839f('0x2d')](_0x5ec155,function(_0x418d62){if(_0x418d62[_0x839f('0x31')]!==_0x839f('0x40')){var _0x367d17={};_0x367d17[_0x418d62[_0x839f('0x2a')]]={'$like':'%'+_0x5977f3[_0x839f('0x32')]['filter']+'%'};return _0x367d17;}})});}_0x10b3cd=_[_0x839f('0x3f')]({},_0x10b3cd,_0x5977f3[_0x839f('0x41')]);var _0x1935bc={'where':_0x10b3cd[_0x839f('0x3d')]};return db[_0x839f('0x2e')][_0x839f('0x1d')](_0x1935bc)[_0x839f('0x23')](function(_0x15f95a){_0x18175e[_0x839f('0x1d')]=_0x15f95a;if(_0x5977f3[_0x839f('0x32')]['includeAll']){_0x10b3cd[_0x839f('0x42')]=[{'all':!![]}];}return db[_0x839f('0x2e')][_0x839f('0x43')](_0x10b3cd);})[_0x839f('0x23')](function(_0x2d3383){_0x18175e[_0x839f('0x44')]=_0x2d3383;return _0x18175e;})[_0x839f('0x23')](respondWithFilteredResult(_0x2856ab,_0x10b3cd))[_0x839f('0x45')](handleError(_0x2856ab,null));};exports[_0x839f('0x46')]=function(_0x311316,_0x21d80e){var _0x1ddae4={'raw':![],'where':{'id':_0x311316[_0x839f('0x47')]['id']}},_0x2674b7={};_0x2674b7[_0x839f('0x36')]=_['keys'](db[_0x839f('0x2e')][_0x839f('0x2f')]);_0x2674b7['query']=_[_0x839f('0x33')](_0x311316[_0x839f('0x32')]);_0x2674b7[_0x839f('0x34')]=_[_0x839f('0x35')](_0x2674b7[_0x839f('0x36')],_0x2674b7[_0x839f('0x32')]);_0x1ddae4['attributes']=_['intersection'](_0x2674b7['model'],qs[_0x839f('0x38')](_0x311316[_0x839f('0x32')][_0x839f('0x38')]));_0x1ddae4[_0x839f('0x37')]=_0x1ddae4[_0x839f('0x37')][_0x839f('0x39')]?_0x1ddae4['attributes']:_0x2674b7[_0x839f('0x36')];if(_0x311316[_0x839f('0x32')][_0x839f('0x48')]){_0x1ddae4[_0x839f('0x42')]=[{'all':!![]}];}_0x1ddae4=_[_0x839f('0x3f')]({},_0x1ddae4,_0x311316[_0x839f('0x41')]);return db[_0x839f('0x2e')][_0x839f('0x49')](_0x1ddae4)[_0x839f('0x23')](handleEntityNotFound(_0x21d80e,null))[_0x839f('0x23')](respondWithResult(_0x21d80e,null))[_0x839f('0x45')](handleError(_0x21d80e,null));};exports[_0x839f('0x4a')]=function(_0x856ee5,_0x2875fe){return db[_0x839f('0x2e')]['create'](_0x856ee5[_0x839f('0x4b')],{})[_0x839f('0x23')](function(_0x192ba9){var _0x3997bb=_0x856ee5[_0x839f('0x4c')][_0x839f('0x25')]({'plain':!![]});if(!_0x3997bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3997bb[_0x839f('0x4d')]===_0x839f('0x4c')){var _0x1a44a2=_0x192ba9['get']({'plain':!![]});var _0x454776=_0x839f('0x4e');return db[_0x839f('0x4f')][_0x839f('0x49')]({'where':{'name':_0x454776,'userProfileId':_0x3997bb[_0x839f('0x50')]},'raw':!![]})['then'](function(_0x3e6b82){if(_0x3e6b82&&_0x3e6b82[_0x839f('0x51')]===0x0){return db[_0x839f('0x27')]['create']({'name':_0x1a44a2[_0x839f('0x2a')],'resourceId':_0x1a44a2['id'],'type':_0x839f('0x26'),'sectionId':_0x3e6b82['id']},{})['then'](function(){return _0x192ba9;});}else{return _0x192ba9;}})['catch'](function(_0x3466b0){logger['error'](_0x839f('0x52'),_0x3466b0);throw _0x3466b0;});}return _0x192ba9;})[_0x839f('0x23')](respondWithResult(_0x2875fe,0xc9))[_0x839f('0x45')](handleError(_0x2875fe,null));};exports[_0x839f('0x22')]=function(_0x3359e0,_0x4fef5d){if(_0x3359e0[_0x839f('0x4b')]['id']){delete _0x3359e0[_0x839f('0x4b')]['id'];}return db[_0x839f('0x2e')][_0x839f('0x49')]({'where':{'id':_0x3359e0[_0x839f('0x47')]['id']}})[_0x839f('0x23')](handleEntityNotFound(_0x4fef5d,null))[_0x839f('0x23')](saveUpdates(_0x3359e0[_0x839f('0x4b')],null))[_0x839f('0x23')](respondWithResult(_0x4fef5d,null))[_0x839f('0x45')](handleError(_0x4fef5d,null));};exports[_0x839f('0x24')]=function(_0x14f0e3,_0x4056b1){return db['AnalyticCustomReport'][_0x839f('0x49')]({'where':{'id':_0x14f0e3[_0x839f('0x47')]['id']}})[_0x839f('0x23')](handleEntityNotFound(_0x4056b1,null))[_0x839f('0x23')](removeEntity(_0x4056b1,null))[_0x839f('0x45')](handleError(_0x4056b1,null));};exports[_0x839f('0x53')]=function(_0x382cd5,_0x19dc66){var _0x58ef1a=0xa;var _0x3e1cec=['join',_0x839f('0x54'),_0x839f('0x55'),'cross_join'];var _0x2304fa={'SUM':'SUM(%s)','COUNT':_0x839f('0x56'),'COUNT DISTINCT':_0x839f('0x57'),'MAX':_0x839f('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x839f('0x59'),'GROUP_CONCAT ASC':_0x839f('0x5a'),'GROUP_CONCAT DESC':_0x839f('0x5b')};var _0x56c7c2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x839f('0x5c'),'HOUR':_0x839f('0x5d'),'ROUND':_0x839f('0x5e'),'UNIX_TIMESTAMP':_0x839f('0x5f')};var _0x3001ac=function(_0x12fd9b){return!_[_0x839f('0x60')]([_0x839f('0x61'),_0x839f('0x62'),_0x839f('0x63'),_0x839f('0x64')],_0x12fd9b);};var _0x3ae248=function(_0x56f973){if(!_0x56f973||!_0x56f973[_0x839f('0x65')]['length']){return'';}for(var _0x498cdb='(',_0x494cbb=0x0;_0x494cbb<_0x56f973['rules'][_0x839f('0x39')];_0x494cbb+=0x1){_0x494cbb>0x0&&(_0x498cdb+='\x20'+_0x56f973[_0x839f('0x66')]+'\x20');_0x498cdb+=_0x56f973[_0x839f('0x65')][_0x494cbb][_0x839f('0x67')]?_0x3ae248(_0x56f973[_0x839f('0x65')][_0x494cbb]['group']):_0x56f973[_0x839f('0x65')][_0x494cbb]['field']+'\x20'+_0x56f973[_0x839f('0x65')][_0x494cbb]['condition']+(_0x3001ac(_0x56f973[_0x839f('0x65')][_0x494cbb][_0x839f('0x68')])?'\x20'+_0x56f973[_0x839f('0x65')][_0x494cbb][_0x839f('0x69')]:'');}return _0x498cdb+')';};var _0x1b3ae3={'where':{'id':_0x382cd5['params']['id']}},_0x1330ba,_0x1bce46,_0x531d21,_0x36d397,_0x1e8f9e;_0x1b3ae3=_[_0x839f('0x3f')]({},_0x1b3ae3,_0x382cd5[_0x839f('0x41')]);return db[_0x839f('0x2e')]['find'](_0x1b3ae3)['then'](function(_0x3d3fb8){if(_0x3d3fb8){_0x1330ba=_0x3d3fb8;return _0x3d3fb8[_0x839f('0x6a')]();}return null;})[_0x839f('0x23')](function(_0x271bff){if(_0x271bff){if(!_0x271bff[_0x839f('0x39')]){throw new db[(_0x839f('0x6b'))][(_0x839f('0x6c'))](_0x839f('0x6d'),0x193);}_0x1bce46=_0x271bff;return db[_0x839f('0x6e')][_0x839f('0x43')]({'raw':!![]});}return null;})[_0x839f('0x23')](function(_0x1e1718){if(_0x1e1718){_0x531d21=_[_0x839f('0x6f')](_0x1e1718,'id');var _0x524abc;var _0x2554cb=squel[_0x839f('0x70')]();_0x2554cb['from'](_0x1330ba['table']);for(var _0x5a45f4=0x0;_0x5a45f4<_0x1bce46[_0x839f('0x39')];_0x5a45f4+=0x1){_0x524abc=_0x1bce46[_0x5a45f4][_0x839f('0x71')]?_0x531d21[_0x1bce46[_0x5a45f4][_0x839f('0x71')]][_0x839f('0x72')]:_0x1bce46[_0x5a45f4][_0x839f('0x73')];_0x524abc=_0x1bce46[_0x5a45f4][_0x839f('0x74')]?_['replace'](_0x2304fa[_0x1bce46[_0x5a45f4][_0x839f('0x74')]],'%s',_0x524abc):_0x524abc;_0x524abc=_0x1bce46[_0x5a45f4][_0x839f('0x75')]?_[_0x839f('0x76')](_0x56c7c2[_0x1bce46[_0x5a45f4][_0x839f('0x75')]],'%s',_0x524abc):_0x524abc;if(_0x1bce46[_0x5a45f4][_0x839f('0x77')]){_0x2554cb[_0x839f('0x67')](_0x524abc);}_0x1bce46[_0x5a45f4]['orderBy']&&_0x2554cb[_0x839f('0x3b')](_0x524abc,_0x1bce46[_0x5a45f4][_0x839f('0x78')]===_0x839f('0x79')?![]:!![]);_0x2554cb[_0x839f('0x73')](_0x524abc,_0x1bce46[_0x5a45f4]['alias']||_0x524abc);}if(_0x1330ba[_0x839f('0x7a')]){_0x1330ba['joins']=JSON['parse'](_0x1330ba[_0x839f('0x7a')]);for(var _0x3b332c=0x0;_0x3b332c<_0x1330ba[_0x839f('0x7a')][_0x839f('0x39')];_0x3b332c+=0x1){if(_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x31')]&&_[_0x839f('0x60')](_0x3e1cec,_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x31')])&&_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x7b')]&&_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x7c')]&&_0x1330ba['joins'][_0x3b332c]['foreignKey']){_0x2554cb[_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x31')]](_0x1330ba['joins'][_0x3b332c][_0x839f('0x7c')],null,util['format'](_0x839f('0x7d'),_0x1330ba[_0x839f('0x7e')],_0x1330ba[_0x839f('0x7a')][_0x3b332c]['parentKey'],_0x1330ba[_0x839f('0x7a')][_0x3b332c][_0x839f('0x7c')],_0x1330ba[_0x839f('0x7a')][_0x3b332c]['foreignKey']));}}}if(_0x1330ba[_0x839f('0x7f')]){_0x1330ba['conditions']=JSON[_0x839f('0x80')](_0x1330ba['conditions']);_0x2554cb[_0x839f('0x3d')](_0x3ae248(_0x1330ba[_0x839f('0x7f')][_0x839f('0x67')]));}_0x1e8f9e=_0x2554cb[_0x839f('0x81')]();_0x2554cb[_0x839f('0x1f')](_0x58ef1a);_0x2554cb[_0x839f('0x1e')](0x0);logger[_0x839f('0x82')](_0x839f('0x83'),_0x2554cb['toString']());return dbH[_0x839f('0x84')][_0x839f('0x32')](_0x2554cb[_0x839f('0x85')](),{'type':dbH[_0x839f('0x84')]['QueryTypes']['SELECT']});}})[_0x839f('0x23')](respondWithResult(_0x19dc66,null))[_0x839f('0x45')](handleError(_0x19dc66,null));};function runReport(_0x2b9e4c,_0x3a6307,_0x2ff1a2){var _0x553bce=_0x3a6307[_0x839f('0x2a')];var _0x4fc08e=0xa;var _0x2e29d7=[_0x839f('0x86'),_0x839f('0x54'),_0x839f('0x55'),_0x839f('0x87')];var _0x30e1a7={'SUM':_0x839f('0x88'),'COUNT':_0x839f('0x56'),'COUNT DISTINCT':_0x839f('0x57'),'MAX':'MAX(%s)','MIN':_0x839f('0x89'),'AVG':_0x839f('0x8a'),'GROUP_CONCAT':_0x839f('0x59'),'GROUP_CONCAT ASC':_0x839f('0x5a'),'GROUP_CONCAT DESC':_0x839f('0x5b')};var _0x331f59={'SEC_TO_TIME':_0x839f('0x8b'),'DATE':_0x839f('0x5c'),'HOUR':_0x839f('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5549d7=function(_0x103d88){return!_[_0x839f('0x60')]([_0x839f('0x61'),_0x839f('0x62'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x103d88);};var _0x22a6eb=function(_0x4215d6){if(!_0x4215d6||!_0x4215d6[_0x839f('0x65')][_0x839f('0x39')]){return'';}for(var _0x2bc9e1='(',_0x5f50b1=0x0;_0x5f50b1<_0x4215d6[_0x839f('0x65')][_0x839f('0x39')];_0x5f50b1+=0x1){_0x5f50b1>0x0&&(_0x2bc9e1+='\x20'+_0x4215d6['operator']+'\x20');_0x2bc9e1+=_0x4215d6[_0x839f('0x65')][_0x5f50b1][_0x839f('0x67')]?_0x22a6eb(_0x4215d6[_0x839f('0x65')][_0x5f50b1]['group']):_0x4215d6[_0x839f('0x65')][_0x5f50b1][_0x839f('0x73')]+'\x20'+_0x4215d6[_0x839f('0x65')][_0x5f50b1][_0x839f('0x68')]+(_0x5549d7(_0x4215d6[_0x839f('0x65')][_0x5f50b1][_0x839f('0x68')])?'\x20'+_0x4215d6[_0x839f('0x65')][_0x5f50b1][_0x839f('0x69')]:'');}return _0x2bc9e1+')';};var _0x4178cf={'where':{'id':_0x2b9e4c['id']}},_0x2d8796,_0x29932b,_0x41a1f0,_0x1f575b,_0x28c876;_0x4178cf=_[_0x839f('0x3f')]({},_0x4178cf,_0x2ff1a2);return db[_0x839f('0x2e')][_0x839f('0x49')](_0x4178cf)[_0x839f('0x23')](function(_0x399e42){if(_0x399e42){_0x2d8796=_0x399e42;return _0x399e42[_0x839f('0x6a')]();}return null;})['then'](function(_0x24b006){if(_0x24b006){if(!_0x24b006[_0x839f('0x39')]){throw new db[(_0x839f('0x6b'))]['ValidationErrorItem'](_0x839f('0x6d'),0x193);}_0x29932b=_0x24b006;return db[_0x839f('0x6e')][_0x839f('0x43')]({'raw':!![]});}return null;})[_0x839f('0x23')](function(_0x57771d){if(_0x57771d){_0x41a1f0=_[_0x839f('0x6f')](_0x57771d,'id');var _0x3cbb8b;var _0x5b250e=squel[_0x839f('0x70')]();_0x5b250e[_0x839f('0x8c')](_0x2d8796['table']);for(var _0xf422f1=0x0;_0xf422f1<_0x29932b[_0x839f('0x39')];_0xf422f1+=0x1){_0x3cbb8b=_0x29932b[_0xf422f1]['MetricId']?_0x41a1f0[_0x29932b[_0xf422f1][_0x839f('0x71')]][_0x839f('0x72')]:_0x29932b[_0xf422f1][_0x839f('0x73')];_0x3cbb8b=_0x29932b[_0xf422f1]['function']?_[_0x839f('0x76')](_0x30e1a7[_0x29932b[_0xf422f1][_0x839f('0x74')]],'%s',_0x3cbb8b):_0x3cbb8b;_0x3cbb8b=_0x29932b[_0xf422f1][_0x839f('0x75')]?_[_0x839f('0x76')](_0x331f59[_0x29932b[_0xf422f1][_0x839f('0x75')]],'%s',_0x3cbb8b):_0x3cbb8b;if(_0x29932b[_0xf422f1][_0x839f('0x77')]){_0x5b250e[_0x839f('0x67')](_0x3cbb8b);}_0x29932b[_0xf422f1][_0x839f('0x78')]&&_0x5b250e[_0x839f('0x3b')](_0x3cbb8b,_0x29932b[_0xf422f1][_0x839f('0x78')]==='DESC'?![]:!![]);_0x5b250e[_0x839f('0x73')](_0x3cbb8b,_0x29932b[_0xf422f1]['alias']||_0x3cbb8b);}if(_0x2d8796[_0x839f('0x7a')]){_0x2d8796['joins']=JSON[_0x839f('0x80')](_0x2d8796[_0x839f('0x7a')]);for(var _0x5c63a3=0x0;_0x5c63a3<_0x2d8796[_0x839f('0x7a')][_0x839f('0x39')];_0x5c63a3+=0x1){if(_0x2d8796[_0x839f('0x7a')][_0x5c63a3][_0x839f('0x31')]&&_[_0x839f('0x60')](_0x2e29d7,_0x2d8796['joins'][_0x5c63a3]['type'])&&_0x2d8796[_0x839f('0x7a')][_0x5c63a3][_0x839f('0x7b')]&&_0x2d8796[_0x839f('0x7a')][_0x5c63a3][_0x839f('0x7c')]&&_0x2d8796['joins'][_0x5c63a3]['foreignKey']){_0x5b250e[_0x2d8796[_0x839f('0x7a')][_0x5c63a3][_0x839f('0x31')]](_0x2d8796[_0x839f('0x7a')][_0x5c63a3]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2d8796[_0x839f('0x7e')],_0x2d8796[_0x839f('0x7a')][_0x5c63a3][_0x839f('0x7b')],_0x2d8796['joins'][_0x5c63a3][_0x839f('0x7c')],_0x2d8796[_0x839f('0x7a')][_0x5c63a3]['foreignKey']));}}}if(_0x2d8796[_0x839f('0x7f')]){_0x2d8796[_0x839f('0x7f')]=JSON[_0x839f('0x80')](_0x2d8796[_0x839f('0x7f')]);_0x5b250e[_0x839f('0x3d')](_0x22a6eb(_0x2d8796['conditions'][_0x839f('0x67')]));}_0x28c876=_0x5b250e[_0x839f('0x81')]();_0x5b250e[_0x839f('0x1f')](_0x4fc08e);_0x5b250e['offset'](0x0);return;}})['then'](function(){if(_0x3a6307[_0x839f('0x8d')]==='web'){return null;}var _0x2d5df4=_[_0x839f('0x3f')](_0x3a6307,{'name':_0x3a6307[_0x839f('0x8e')]||_0x3a6307[_0x839f('0x2a')]||_0x2d8796[_0x839f('0x2a')],'basename':_0x553bce,'savename':util[_0x839f('0x75')](_0x839f('0x8f'),_0x3a6307[_0x839f('0x2a')]||_0x2d8796['name'],require(_0x839f('0x90'))[_0x839f('0x91')](0x4),_0x3a6307['output']||_0x839f('0x92')),'reportId':_0x2d8796['id'],'reportType':_0x839f('0x93')});return db[_0x839f('0x94')][_0x839f('0x4a')](_0x2d5df4,{'raw':!![]});})[_0x839f('0x23')](function(_0x43f477){if(_0x2d8796[_0x839f('0x7e')]===_0x839f('0x95')){_0x28c876[_0x839f('0x3d')](_0x2d8796[_0x839f('0x7e')]+_0x839f('0x96'),_0x3a6307['startDate'],_0x3a6307[_0x839f('0x97')]);}else{_0x28c876[_0x839f('0x3d')](_0x2d8796['table']+_0x839f('0x98'),_0x3a6307[_0x839f('0x99')],_0x3a6307[_0x839f('0x97')]);}if(_0x43f477){logger[_0x839f('0x9a')](_0x839f('0x9b'),_0x28c876[_0x839f('0x85')]());require('child_process')[_0x839f('0x9c')](path['join'](__dirname,_0x839f('0x9d'),_0x43f477[_0x839f('0x8d')]),[_0x43f477['id'],_0x28c876[_0x839f('0x85')](),path[_0x839f('0x86')](__dirname,_0x839f('0x9e'),_0x43f477['savename']),_0x553bce]);return _0x43f477;}else{var _0x446659=squel['select']();_0x446659[_0x839f('0x8c')]('('+_0x28c876['toString']()+')',_0x839f('0x9f'));_0x446659['field'](_0x839f('0xa0'),_0x839f('0x1d'));_0x28c876['limit'](_0x3a6307[_0x839f('0x1f')]||_0x4fc08e);_0x28c876[_0x839f('0x1e')](_0x3a6307[_0x839f('0x1e')]||0x0);return dbH[_0x839f('0x84')][_0x839f('0x32')](_0x446659[_0x839f('0x85')](),{'type':dbH[_0x839f('0x84')][_0x839f('0xa1')][_0x839f('0xa2')]})[_0x839f('0x23')](function(_0x336afa){if(!_0x336afa['length']){_0x1f575b=0x0;}else{_0x1f575b=_0x336afa[0x0]['count']||0x0;}return dbH[_0x839f('0x84')][_0x839f('0x32')](_0x28c876[_0x839f('0x85')](),{'type':dbH['sequelize'][_0x839f('0xa1')]['SELECT']});})[_0x839f('0x23')](function(_0x5e9e21){return{'rows':_0x5e9e21||[],'count':_0x1f575b};});}});}exports[_0x839f('0xa3')]=function(_0x3d9aef,_0xa91713){return runReport(_0x3d9aef[_0x839f('0x47')],_0x3d9aef[_0x839f('0x32')],_0x3d9aef[_0x839f('0x41')])[_0x839f('0x23')](respondWithResult(_0xa91713,null))['catch'](handleError(_0xa91713,null));};exports[_0x839f('0xa4')]=runReport;exports[_0x839f('0x32')]=function(_0x4b954e,_0x44cde6){var _0x3c4160=0xa;var _0x3eb9ed=[_0x839f('0x86'),_0x839f('0x54'),_0x839f('0x55'),'cross_join'];var _0x5f376c={'SUM':_0x839f('0x88'),'COUNT':_0x839f('0x56'),'COUNT DISTINCT':_0x839f('0x57'),'MAX':_0x839f('0x58'),'MIN':_0x839f('0x89'),'AVG':_0x839f('0x8a'),'GROUP_CONCAT':_0x839f('0x59'),'GROUP_CONCAT ASC':_0x839f('0x5a'),'GROUP_CONCAT DESC':_0x839f('0x5b')};var _0x1e9bc4={'SEC_TO_TIME':_0x839f('0x8b'),'DATE':'DATE(%s)','HOUR':_0x839f('0x5d'),'ROUND':_0x839f('0x5e'),'UNIX_TIMESTAMP':_0x839f('0x5f')};var _0x533179=function(_0x425080){return!_[_0x839f('0x60')](['IS\x20NULL',_0x839f('0x62'),_0x839f('0x63'),_0x839f('0x64')],_0x425080);};var _0x388f66=function(_0x52d13d){if(!_0x52d13d||!_0x52d13d[_0x839f('0x65')][_0x839f('0x39')]){return'';}for(var _0x33bebf='(',_0x77fb30=0x0;_0x77fb30<_0x52d13d['rules'][_0x839f('0x39')];_0x77fb30+=0x1){_0x77fb30>0x0&&(_0x33bebf+='\x20'+_0x52d13d[_0x839f('0x66')]+'\x20');_0x33bebf+=_0x52d13d['rules'][_0x77fb30]['group']?_0x388f66(_0x52d13d[_0x839f('0x65')][_0x77fb30][_0x839f('0x67')]):_0x52d13d[_0x839f('0x65')][_0x77fb30][_0x839f('0x73')]+'\x20'+_0x52d13d[_0x839f('0x65')][_0x77fb30][_0x839f('0x68')]+(_0x533179(_0x52d13d[_0x839f('0x65')][_0x77fb30][_0x839f('0x68')])?'\x20'+_0x52d13d['rules'][_0x77fb30][_0x839f('0x69')]:'');}return _0x33bebf+')';};var _0x1b224c={'where':{'id':_0x4b954e[_0x839f('0x47')]['id']}},_0x13eae4,_0x2b430e,_0x5ea823,_0x26f53a,_0xea2384;_0x1b224c=_[_0x839f('0x3f')]({},_0x1b224c,_0x4b954e[_0x839f('0x41')]);return db[_0x839f('0x2e')]['find'](_0x1b224c)[_0x839f('0x23')](function(_0x243241){if(_0x243241){_0x13eae4=_0x243241;return _0x243241[_0x839f('0x6a')]();}return null;})[_0x839f('0x23')](function(_0x5565e7){if(_0x5565e7){if(!_0x5565e7[_0x839f('0x39')]){throw new db[(_0x839f('0x6b'))]['ValidationErrorItem'](_0x839f('0x6d'),0x193);}_0x2b430e=_0x5565e7;return db[_0x839f('0x6e')][_0x839f('0x43')]({'raw':!![]});}return null;})[_0x839f('0x23')](function(_0x3254ed){if(_0x3254ed){_0x5ea823=_[_0x839f('0x6f')](_0x3254ed,'id');var _0x5c0173;var _0x558529=squel[_0x839f('0x70')]();_0x558529[_0x839f('0x8c')](_0x13eae4[_0x839f('0x7e')]);for(var _0x5bae29=0x0;_0x5bae29<_0x2b430e[_0x839f('0x39')];_0x5bae29+=0x1){_0x5c0173=_0x2b430e[_0x5bae29]['MetricId']?_0x5ea823[_0x2b430e[_0x5bae29][_0x839f('0x71')]][_0x839f('0x72')]:_0x2b430e[_0x5bae29][_0x839f('0x73')];_0x5c0173=_0x2b430e[_0x5bae29][_0x839f('0x74')]?_[_0x839f('0x76')](_0x5f376c[_0x2b430e[_0x5bae29]['function']],'%s',_0x5c0173):_0x5c0173;_0x5c0173=_0x2b430e[_0x5bae29][_0x839f('0x75')]?_[_0x839f('0x76')](_0x1e9bc4[_0x2b430e[_0x5bae29][_0x839f('0x75')]],'%s',_0x5c0173):_0x5c0173;if(_0x2b430e[_0x5bae29][_0x839f('0x77')]){_0x558529['group'](_0x5c0173);}_0x2b430e[_0x5bae29]['orderBy']&&_0x558529['order'](_0x5c0173,_0x2b430e[_0x5bae29]['orderBy']===_0x839f('0x79')?![]:!![]);_0x558529['field'](_0x5c0173,_0x2b430e[_0x5bae29]['alias']||_0x5c0173);}if(_0x13eae4['joins']){_0x13eae4['joins']=JSON[_0x839f('0x80')](_0x13eae4[_0x839f('0x7a')]);for(var _0x5ea8b2=0x0;_0x5ea8b2<_0x13eae4[_0x839f('0x7a')]['length'];_0x5ea8b2+=0x1){if(_0x13eae4[_0x839f('0x7a')][_0x5ea8b2][_0x839f('0x31')]&&_[_0x839f('0x60')](_0x3eb9ed,_0x13eae4[_0x839f('0x7a')][_0x5ea8b2][_0x839f('0x31')])&&_0x13eae4[_0x839f('0x7a')][_0x5ea8b2]['parentKey']&&_0x13eae4['joins'][_0x5ea8b2]['foreignTable']&&_0x13eae4[_0x839f('0x7a')][_0x5ea8b2][_0x839f('0xa5')]){_0x558529[_0x13eae4[_0x839f('0x7a')][_0x5ea8b2][_0x839f('0x31')]](_0x13eae4[_0x839f('0x7a')][_0x5ea8b2][_0x839f('0x7c')],null,util[_0x839f('0x75')](_0x839f('0x7d'),_0x13eae4['table'],_0x13eae4['joins'][_0x5ea8b2]['parentKey'],_0x13eae4['joins'][_0x5ea8b2][_0x839f('0x7c')],_0x13eae4[_0x839f('0x7a')][_0x5ea8b2]['foreignKey']));}}}if(_0x13eae4[_0x839f('0x7f')]){_0x13eae4[_0x839f('0x7f')]=JSON[_0x839f('0x80')](_0x13eae4[_0x839f('0x7f')]);_0x558529[_0x839f('0x3d')](_0x388f66(_0x13eae4[_0x839f('0x7f')][_0x839f('0x67')]));}_0xea2384=_0x558529[_0x839f('0x81')]();_0x558529[_0x839f('0x1f')](_0x3c4160);_0x558529[_0x839f('0x1e')](0x0);logger[_0x839f('0x82')]('Limited\x20Query:',_0x558529['toString']());return dbH[_0x839f('0x84')][_0x839f('0x32')](_0x558529[_0x839f('0x85')](),{'type':dbH[_0x839f('0x84')]['QueryTypes']['SELECT']});}})[_0x839f('0x23')](function(){return{'sql':_0xea2384[_0x839f('0x85')]()};})['then'](respondWithResult(_0x44cde6,null))[_0x839f('0x45')](handleError(_0x44cde6,null));}; \ No newline at end of file +var _0xc2c4=['get','end','error','stack','name','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','left_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','includes','IS\x20NOT\x20NULL','operator','AnalyticMetric','select','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','keyBy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','limit','status','Content-Range','json','save','update','then','destroy'];(function(_0x43786d,_0x3c4677){var _0x1073d5=function(_0x4d6aa5){while(--_0x4d6aa5){_0x43786d['push'](_0x43786d['shift']());}};_0x1073d5(++_0x3c4677);}(_0xc2c4,0x80));var _0x4c2c=function(_0x53f9b9,_0x31cefa){_0x53f9b9=_0x53f9b9-0x0;var _0x1701c8=_0xc2c4[_0x53f9b9];return _0x1701c8;};'use strict';var pdf=require(_0x4c2c('0x0'));var emlformat=require(_0x4c2c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c2c('0x2'));var jsonpatch=require(_0x4c2c('0x3'));var rp=require(_0x4c2c('0x4'));var moment=require(_0x4c2c('0x5'));var BPromise=require(_0x4c2c('0x6'));var Mustache=require(_0x4c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4c2c('0x8'));var csv=require(_0x4c2c('0x9'));var ejs=require(_0x4c2c('0xa'));var fs=require('fs');var _=require(_0x4c2c('0xb'));var squel=require(_0x4c2c('0xc'));var crypto=require(_0x4c2c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c2c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c2c('0xe'));var authService=require(_0x4c2c('0xf'));var qs=require(_0x4c2c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c2c('0x11'));var logger=require(_0x4c2c('0x12'))(_0x4c2c('0x13'));var utils=require(_0x4c2c('0x14'));var config=require(_0x4c2c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c2c('0x16'))['db'];var dbH=require(_0x4c2c('0x16'))['dbH'];function respondWithStatusCode(_0x17b0a5,_0x5f2b08){_0x5f2b08=_0x5f2b08||0xcc;return function(_0x5d7b97){if(_0x5d7b97){return _0x17b0a5[_0x4c2c('0x17')](_0x5f2b08);}return _0x17b0a5['status'](_0x5f2b08)['end']();};}function respondWithResult(_0x1f4113,_0x3fa88f){_0x3fa88f=_0x3fa88f||0xc8;return function(_0x4a1c19){if(_0x4a1c19){return _0x1f4113['status'](_0x3fa88f)['json'](_0x4a1c19);}};}function respondWithFilteredResult(_0x3ac390,_0x539ff4){return function(_0x12aeae){if(_0x12aeae){var _0x3ab381=_0x12aeae[_0x4c2c('0x18')],_0x2eeb4a=_0x539ff4[_0x4c2c('0x19')],_0x470591=_0x539ff4['offset']+_0x539ff4[_0x4c2c('0x1a')],_0x146efb;if(_0x470591>=_0x3ab381){_0x470591=_0x3ab381;_0x146efb=0xc8;}else{_0x146efb=0xce;}_0x3ac390[_0x4c2c('0x1b')](_0x146efb);return _0x3ac390['set'](_0x4c2c('0x1c'),_0x2eeb4a+'-'+_0x470591+'/'+_0x3ab381)[_0x4c2c('0x1d')](_0x12aeae);}return null;};}function patchUpdates(_0x232110){return function(_0x2f9fb8){try{jsonpatch['apply'](_0x2f9fb8,_0x232110,!![]);}catch(_0x125764){return BPromise['reject'](_0x125764);}return _0x2f9fb8[_0x4c2c('0x1e')]();};}function saveUpdates(_0x1e836f,_0xa6496f){return function(_0x24cd48){if(_0x24cd48){return _0x24cd48[_0x4c2c('0x1f')](_0x1e836f)[_0x4c2c('0x20')](function(_0x1ea559){return _0x1ea559;});}return null;};}function removeEntity(_0x3e8cf8,_0x41d11d){return function(_0xdf63f5){if(_0xdf63f5){return _0xdf63f5[_0x4c2c('0x21')]()['then'](function(){var _0x3d8cf0=_0xdf63f5[_0x4c2c('0x22')]({'plain':!![]});var _0x5c8b0f='CustomReports';return db['UserProfileResource'][_0x4c2c('0x21')]({'where':{'type':_0x5c8b0f,'resourceId':_0x3d8cf0['id']}})[_0x4c2c('0x20')](function(){return _0xdf63f5;});})[_0x4c2c('0x20')](function(){_0x3e8cf8[_0x4c2c('0x1b')](0xcc)[_0x4c2c('0x23')]();});}};}function handleEntityNotFound(_0xa752c0,_0x3f8ea0){return function(_0x474244){if(!_0x474244){_0xa752c0[_0x4c2c('0x17')](0x194);}return _0x474244;};}function handleError(_0x16ade9,_0x1a8e6f){_0x1a8e6f=_0x1a8e6f||0x1f4;return function(_0x30e7a3){logger[_0x4c2c('0x24')](_0x30e7a3[_0x4c2c('0x25')]);if(_0x30e7a3[_0x4c2c('0x26')]){delete _0x30e7a3[_0x4c2c('0x26')];}_0x16ade9[_0x4c2c('0x1b')](_0x1a8e6f)['send'](_0x30e7a3);};}exports['index']=function(_0x16190d,_0x4e59b0){var _0x3b1e86={},_0x326f1f={},_0xbddc59={'count':0x0,'rows':[]};var _0x302aae=_[_0x4c2c('0x27')](db[_0x4c2c('0x28')][_0x4c2c('0x29')],function(_0x3716ac){return{'name':_0x3716ac['fieldName'],'type':_0x3716ac['type'][_0x4c2c('0x2a')]};});_0x326f1f[_0x4c2c('0x2b')]=_[_0x4c2c('0x27')](_0x302aae,_0x4c2c('0x26'));_0x326f1f[_0x4c2c('0x2c')]=_[_0x4c2c('0x2d')](_0x16190d[_0x4c2c('0x2c')]);_0x326f1f[_0x4c2c('0x2e')]=_[_0x4c2c('0x2f')](_0x326f1f['model'],_0x326f1f[_0x4c2c('0x2c')]);_0x3b1e86[_0x4c2c('0x30')]=_[_0x4c2c('0x2f')](_0x326f1f[_0x4c2c('0x2b')],qs['fields'](_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x31')]));_0x3b1e86[_0x4c2c('0x30')]=_0x3b1e86[_0x4c2c('0x30')]['length']?_0x3b1e86['attributes']:_0x326f1f[_0x4c2c('0x2b')];if(!_0x16190d['query'][_0x4c2c('0x32')](_0x4c2c('0x33'))){_0x3b1e86['limit']=qs[_0x4c2c('0x1a')](_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x1a')]);_0x3b1e86[_0x4c2c('0x19')]=qs['offset'](_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x19')]);}_0x3b1e86[_0x4c2c('0x34')]=qs[_0x4c2c('0x35')](_0x16190d['query']['sort']);_0x3b1e86[_0x4c2c('0x36')]=qs[_0x4c2c('0x2e')](_[_0x4c2c('0x37')](_0x16190d[_0x4c2c('0x2c')],_0x326f1f[_0x4c2c('0x2e')]),_0x302aae);if(_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x38')]){_0x3b1e86[_0x4c2c('0x36')]=_[_0x4c2c('0x39')](_0x3b1e86['where'],{'$or':_['map'](_0x302aae,function(_0x51e105){if(_0x51e105['type']!==_0x4c2c('0x3a')){var _0x207383={};_0x207383[_0x51e105[_0x4c2c('0x26')]]={'$like':'%'+_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x38')]+'%'};return _0x207383;}})});}_0x3b1e86=_[_0x4c2c('0x39')]({},_0x3b1e86,_0x16190d['options']);var _0x12d403={'where':_0x3b1e86['where']};return db[_0x4c2c('0x28')][_0x4c2c('0x18')](_0x12d403)['then'](function(_0x1386e3){_0xbddc59[_0x4c2c('0x18')]=_0x1386e3;if(_0x16190d[_0x4c2c('0x2c')][_0x4c2c('0x3b')]){_0x3b1e86['include']=[{'all':!![]}];}return db[_0x4c2c('0x28')][_0x4c2c('0x3c')](_0x3b1e86);})['then'](function(_0x3cfb3a){_0xbddc59[_0x4c2c('0x3d')]=_0x3cfb3a;return _0xbddc59;})[_0x4c2c('0x20')](respondWithFilteredResult(_0x4e59b0,_0x3b1e86))[_0x4c2c('0x3e')](handleError(_0x4e59b0,null));};exports['show']=function(_0xa60778,_0x2142d7){var _0x5daebd={'raw':![],'where':{'id':_0xa60778[_0x4c2c('0x3f')]['id']}},_0x3ceef6={};_0x3ceef6[_0x4c2c('0x2b')]=_[_0x4c2c('0x2d')](db[_0x4c2c('0x28')][_0x4c2c('0x29')]);_0x3ceef6['query']=_['keys'](_0xa60778[_0x4c2c('0x2c')]);_0x3ceef6[_0x4c2c('0x2e')]=_[_0x4c2c('0x2f')](_0x3ceef6[_0x4c2c('0x2b')],_0x3ceef6[_0x4c2c('0x2c')]);_0x5daebd[_0x4c2c('0x30')]=_[_0x4c2c('0x2f')](_0x3ceef6[_0x4c2c('0x2b')],qs['fields'](_0xa60778['query']['fields']));_0x5daebd[_0x4c2c('0x30')]=_0x5daebd[_0x4c2c('0x30')][_0x4c2c('0x40')]?_0x5daebd[_0x4c2c('0x30')]:_0x3ceef6[_0x4c2c('0x2b')];if(_0xa60778[_0x4c2c('0x2c')][_0x4c2c('0x3b')]){_0x5daebd[_0x4c2c('0x41')]=[{'all':!![]}];}_0x5daebd=_[_0x4c2c('0x39')]({},_0x5daebd,_0xa60778[_0x4c2c('0x42')]);return db['AnalyticCustomReport'][_0x4c2c('0x43')](_0x5daebd)[_0x4c2c('0x20')](handleEntityNotFound(_0x2142d7,null))[_0x4c2c('0x20')](respondWithResult(_0x2142d7,null))[_0x4c2c('0x3e')](handleError(_0x2142d7,null));};exports[_0x4c2c('0x44')]=function(_0x5c7795,_0x30e0e3){return db[_0x4c2c('0x28')]['create'](_0x5c7795[_0x4c2c('0x45')],{})['then'](function(_0x5cea99){var _0x9e35e0=_0x5c7795[_0x4c2c('0x46')][_0x4c2c('0x22')]({'plain':!![]});if(!_0x9e35e0)throw new Error(_0x4c2c('0x47'));if(_0x9e35e0[_0x4c2c('0x48')]==='user'){var _0x4b5f86=_0x5cea99[_0x4c2c('0x22')]({'plain':!![]});var _0x2437c4=_0x4c2c('0x49');return db[_0x4c2c('0x4a')][_0x4c2c('0x43')]({'where':{'name':_0x2437c4,'userProfileId':_0x9e35e0[_0x4c2c('0x4b')]},'raw':!![]})[_0x4c2c('0x20')](function(_0x4f6546){if(_0x4f6546&&_0x4f6546[_0x4c2c('0x4c')]===0x0){return db[_0x4c2c('0x4d')][_0x4c2c('0x44')]({'name':_0x4b5f86['name'],'resourceId':_0x4b5f86['id'],'type':_0x4c2c('0x4e'),'sectionId':_0x4f6546['id']},{})['then'](function(){return _0x5cea99;});}else{return _0x5cea99;}})[_0x4c2c('0x3e')](function(_0x4f5882){logger[_0x4c2c('0x24')](_0x4c2c('0x4f'),_0x4f5882);throw _0x4f5882;});}return _0x5cea99;})['then'](respondWithResult(_0x30e0e3,0xc9))[_0x4c2c('0x3e')](handleError(_0x30e0e3,null));};exports['update']=function(_0x13c17d,_0x2ae6be){if(_0x13c17d[_0x4c2c('0x45')]['id']){delete _0x13c17d[_0x4c2c('0x45')]['id'];}return db[_0x4c2c('0x28')]['find']({'where':{'id':_0x13c17d['params']['id']}})['then'](handleEntityNotFound(_0x2ae6be,null))[_0x4c2c('0x20')](saveUpdates(_0x13c17d['body'],null))[_0x4c2c('0x20')](respondWithResult(_0x2ae6be,null))[_0x4c2c('0x3e')](handleError(_0x2ae6be,null));};exports[_0x4c2c('0x21')]=function(_0x65f270,_0x4bf7c7){return db['AnalyticCustomReport'][_0x4c2c('0x43')]({'where':{'id':_0x65f270[_0x4c2c('0x3f')]['id']}})[_0x4c2c('0x20')](handleEntityNotFound(_0x4bf7c7,null))['then'](removeEntity(_0x4bf7c7,null))[_0x4c2c('0x3e')](handleError(_0x4bf7c7,null));};exports['preview']=function(_0xaa4454,_0x10087d){var _0x51cc2b=0xa;var _0x38487e=[_0x4c2c('0x50'),'left_join',_0x4c2c('0x51'),_0x4c2c('0x52')];var _0x56733f={'SUM':_0x4c2c('0x53'),'COUNT':_0x4c2c('0x54'),'COUNT DISTINCT':_0x4c2c('0x55'),'MAX':_0x4c2c('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4c2c('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x44fabf={'SEC_TO_TIME':_0x4c2c('0x58'),'DATE':_0x4c2c('0x59'),'HOUR':_0x4c2c('0x5a'),'ROUND':_0x4c2c('0x5b'),'UNIX_TIMESTAMP':_0x4c2c('0x5c')};var _0x10ae9a=function(_0x339243){return!_['includes']([_0x4c2c('0x5d'),'IS\x20NOT\x20NULL',_0x4c2c('0x5e'),_0x4c2c('0x5f')],_0x339243);};var _0x54f8b8=function(_0x276177){if(!_0x276177||!_0x276177[_0x4c2c('0x60')][_0x4c2c('0x40')]){return'';}for(var _0x3c643a='(',_0x363bf5=0x0;_0x363bf5<_0x276177[_0x4c2c('0x60')][_0x4c2c('0x40')];_0x363bf5+=0x1){_0x363bf5>0x0&&(_0x3c643a+='\x20'+_0x276177['operator']+'\x20');_0x3c643a+=_0x276177[_0x4c2c('0x60')][_0x363bf5][_0x4c2c('0x61')]?_0x54f8b8(_0x276177['rules'][_0x363bf5][_0x4c2c('0x61')]):_0x276177[_0x4c2c('0x60')][_0x363bf5]['field']+'\x20'+_0x276177['rules'][_0x363bf5][_0x4c2c('0x62')]+(_0x10ae9a(_0x276177[_0x4c2c('0x60')][_0x363bf5][_0x4c2c('0x62')])?'\x20'+_0x276177['rules'][_0x363bf5][_0x4c2c('0x63')]:'');}return _0x3c643a+')';};var _0x1ba4e8={'where':{'id':_0xaa4454[_0x4c2c('0x3f')]['id']}},_0x4071c2,_0x5f1675,_0x56040b,_0x3b4140,_0xd65187;_0x1ba4e8=_[_0x4c2c('0x39')]({},_0x1ba4e8,_0xaa4454['options']);return db['AnalyticCustomReport']['find'](_0x1ba4e8)[_0x4c2c('0x20')](function(_0x2fcdc6){if(_0x2fcdc6){_0x4071c2=_0x2fcdc6;return _0x2fcdc6[_0x4c2c('0x64')]();}return null;})[_0x4c2c('0x20')](function(_0x70c552){if(_0x70c552){if(!_0x70c552[_0x4c2c('0x40')]){throw new db[(_0x4c2c('0x65'))][(_0x4c2c('0x66'))](_0x4c2c('0x67'),0x193);}_0x5f1675=_0x70c552;return db['AnalyticMetric'][_0x4c2c('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x23912d){if(_0x23912d){_0x56040b=_['keyBy'](_0x23912d,'id');var _0x1b54f8;var _0x4de71e=squel['select']();_0x4de71e[_0x4c2c('0x68')](_0x4071c2[_0x4c2c('0x69')]);for(var _0x3b7fcd=0x0;_0x3b7fcd<_0x5f1675[_0x4c2c('0x40')];_0x3b7fcd+=0x1){_0x1b54f8=_0x5f1675[_0x3b7fcd]['MetricId']?_0x56040b[_0x5f1675[_0x3b7fcd][_0x4c2c('0x6a')]][_0x4c2c('0x6b')]:_0x5f1675[_0x3b7fcd][_0x4c2c('0x6c')];_0x1b54f8=_0x5f1675[_0x3b7fcd][_0x4c2c('0x6d')]?_[_0x4c2c('0x6e')](_0x56733f[_0x5f1675[_0x3b7fcd][_0x4c2c('0x6d')]],'%s',_0x1b54f8):_0x1b54f8;_0x1b54f8=_0x5f1675[_0x3b7fcd][_0x4c2c('0x6f')]?_[_0x4c2c('0x6e')](_0x44fabf[_0x5f1675[_0x3b7fcd]['format']],'%s',_0x1b54f8):_0x1b54f8;if(_0x5f1675[_0x3b7fcd][_0x4c2c('0x70')]){_0x4de71e['group'](_0x1b54f8);}_0x5f1675[_0x3b7fcd]['orderBy']&&_0x4de71e[_0x4c2c('0x34')](_0x1b54f8,_0x5f1675[_0x3b7fcd][_0x4c2c('0x71')]===_0x4c2c('0x72')?![]:!![]);_0x4de71e[_0x4c2c('0x6c')](_0x1b54f8,_0x5f1675[_0x3b7fcd][_0x4c2c('0x73')]||_0x1b54f8);}if(_0x4071c2[_0x4c2c('0x74')]){_0x4071c2[_0x4c2c('0x74')]=JSON['parse'](_0x4071c2[_0x4c2c('0x74')]);for(var _0xbfbdb1=0x0;_0xbfbdb1<_0x4071c2[_0x4c2c('0x74')]['length'];_0xbfbdb1+=0x1){if(_0x4071c2['joins'][_0xbfbdb1][_0x4c2c('0x75')]&&_['includes'](_0x38487e,_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1]['type'])&&_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1][_0x4c2c('0x76')]&&_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1][_0x4c2c('0x77')]&&_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1]['foreignKey']){_0x4de71e[_0x4071c2['joins'][_0xbfbdb1][_0x4c2c('0x75')]](_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1]['foreignTable'],null,util[_0x4c2c('0x6f')](_0x4c2c('0x78'),_0x4071c2[_0x4c2c('0x69')],_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1][_0x4c2c('0x76')],_0x4071c2[_0x4c2c('0x74')][_0xbfbdb1][_0x4c2c('0x77')],_0x4071c2['joins'][_0xbfbdb1][_0x4c2c('0x79')]));}}}if(_0x4071c2[_0x4c2c('0x7a')]){_0x4071c2[_0x4c2c('0x7a')]=JSON[_0x4c2c('0x7b')](_0x4071c2[_0x4c2c('0x7a')]);_0x4de71e[_0x4c2c('0x36')](_0x54f8b8(_0x4071c2[_0x4c2c('0x7a')][_0x4c2c('0x61')]));}_0xd65187=_0x4de71e[_0x4c2c('0x7c')]();_0x4de71e['limit'](_0x51cc2b);_0x4de71e[_0x4c2c('0x19')](0x0);logger[_0x4c2c('0x7d')](_0x4c2c('0x7e'),_0x4de71e[_0x4c2c('0x7f')]());return dbH['sequelize'][_0x4c2c('0x2c')](_0x4de71e[_0x4c2c('0x7f')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x4c2c('0x20')](respondWithResult(_0x10087d,null))[_0x4c2c('0x3e')](handleError(_0x10087d,null));};function runReport(_0x5b2bb2,_0x1811cd,_0x1662a1){var _0x4ab938=_0x1811cd[_0x4c2c('0x26')];var _0x14036c=0xa;var _0x1ad9b8=[_0x4c2c('0x50'),_0x4c2c('0x80'),_0x4c2c('0x51'),_0x4c2c('0x52')];var _0x3449c1={'SUM':_0x4c2c('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4c2c('0x55'),'MAX':_0x4c2c('0x56'),'MIN':_0x4c2c('0x81'),'AVG':_0x4c2c('0x82'),'GROUP_CONCAT':_0x4c2c('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4c2c('0x83')};var _0x2abb62={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x4c2c('0x5a'),'ROUND':_0x4c2c('0x5b'),'UNIX_TIMESTAMP':_0x4c2c('0x5c')};var _0x345779=function(_0x262642){return!_[_0x4c2c('0x84')]([_0x4c2c('0x5d'),_0x4c2c('0x85'),_0x4c2c('0x5e'),_0x4c2c('0x5f')],_0x262642);};var _0x2312f7=function(_0x4bd6b3){if(!_0x4bd6b3||!_0x4bd6b3[_0x4c2c('0x60')][_0x4c2c('0x40')]){return'';}for(var _0x5f12ab='(',_0x19550d=0x0;_0x19550d<_0x4bd6b3[_0x4c2c('0x60')][_0x4c2c('0x40')];_0x19550d+=0x1){_0x19550d>0x0&&(_0x5f12ab+='\x20'+_0x4bd6b3[_0x4c2c('0x86')]+'\x20');_0x5f12ab+=_0x4bd6b3['rules'][_0x19550d][_0x4c2c('0x61')]?_0x2312f7(_0x4bd6b3[_0x4c2c('0x60')][_0x19550d][_0x4c2c('0x61')]):_0x4bd6b3[_0x4c2c('0x60')][_0x19550d]['field']+'\x20'+_0x4bd6b3[_0x4c2c('0x60')][_0x19550d][_0x4c2c('0x62')]+(_0x345779(_0x4bd6b3[_0x4c2c('0x60')][_0x19550d]['condition'])?'\x20'+_0x4bd6b3[_0x4c2c('0x60')][_0x19550d][_0x4c2c('0x63')]:'');}return _0x5f12ab+')';};var _0x39eb13={'where':{'id':_0x5b2bb2['id']}},_0xf7fa2c,_0x504603,_0x2cb7a6,_0x4fd761,_0xb66e31;_0x39eb13=_[_0x4c2c('0x39')]({},_0x39eb13,_0x1662a1);return db[_0x4c2c('0x28')]['find'](_0x39eb13)['then'](function(_0x3babfe){if(_0x3babfe){_0xf7fa2c=_0x3babfe;return _0x3babfe[_0x4c2c('0x64')]();}return null;})[_0x4c2c('0x20')](function(_0x142cd3){if(_0x142cd3){if(!_0x142cd3['length']){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x504603=_0x142cd3;return db[_0x4c2c('0x87')][_0x4c2c('0x3c')]({'raw':!![]});}return null;})[_0x4c2c('0x20')](function(_0x52a522){if(_0x52a522){_0x2cb7a6=_['keyBy'](_0x52a522,'id');var _0x2554d7;var _0x5828a2=squel[_0x4c2c('0x88')]();_0x5828a2[_0x4c2c('0x68')](_0xf7fa2c['table']);for(var _0x13ca8a=0x0;_0x13ca8a<_0x504603[_0x4c2c('0x40')];_0x13ca8a+=0x1){_0x2554d7=_0x504603[_0x13ca8a][_0x4c2c('0x6a')]?_0x2cb7a6[_0x504603[_0x13ca8a][_0x4c2c('0x6a')]][_0x4c2c('0x6b')]:_0x504603[_0x13ca8a]['field'];_0x2554d7=_0x504603[_0x13ca8a][_0x4c2c('0x6d')]?_[_0x4c2c('0x6e')](_0x3449c1[_0x504603[_0x13ca8a][_0x4c2c('0x6d')]],'%s',_0x2554d7):_0x2554d7;_0x2554d7=_0x504603[_0x13ca8a][_0x4c2c('0x6f')]?_['replace'](_0x2abb62[_0x504603[_0x13ca8a][_0x4c2c('0x6f')]],'%s',_0x2554d7):_0x2554d7;if(_0x504603[_0x13ca8a]['groupBy']){_0x5828a2['group'](_0x2554d7);}_0x504603[_0x13ca8a][_0x4c2c('0x71')]&&_0x5828a2[_0x4c2c('0x34')](_0x2554d7,_0x504603[_0x13ca8a]['orderBy']===_0x4c2c('0x72')?![]:!![]);_0x5828a2[_0x4c2c('0x6c')](_0x2554d7,_0x504603[_0x13ca8a][_0x4c2c('0x73')]||_0x2554d7);}if(_0xf7fa2c[_0x4c2c('0x74')]){_0xf7fa2c[_0x4c2c('0x74')]=JSON['parse'](_0xf7fa2c[_0x4c2c('0x74')]);for(var _0x756c4=0x0;_0x756c4<_0xf7fa2c['joins'][_0x4c2c('0x40')];_0x756c4+=0x1){if(_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x75')]&&_[_0x4c2c('0x84')](_0x1ad9b8,_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x75')])&&_0xf7fa2c['joins'][_0x756c4]['parentKey']&&_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x77')]&&_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x79')]){_0x5828a2[_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x75')]](_0xf7fa2c['joins'][_0x756c4][_0x4c2c('0x77')],null,util['format'](_0x4c2c('0x78'),_0xf7fa2c[_0x4c2c('0x69')],_0xf7fa2c['joins'][_0x756c4][_0x4c2c('0x76')],_0xf7fa2c[_0x4c2c('0x74')][_0x756c4][_0x4c2c('0x77')],_0xf7fa2c['joins'][_0x756c4][_0x4c2c('0x79')]));}}}if(_0xf7fa2c[_0x4c2c('0x7a')]){_0xf7fa2c[_0x4c2c('0x7a')]=JSON[_0x4c2c('0x7b')](_0xf7fa2c[_0x4c2c('0x7a')]);_0x5828a2['where'](_0x2312f7(_0xf7fa2c[_0x4c2c('0x7a')][_0x4c2c('0x61')]));}_0xb66e31=_0x5828a2[_0x4c2c('0x7c')]();_0x5828a2[_0x4c2c('0x1a')](_0x14036c);_0x5828a2['offset'](0x0);return;}})[_0x4c2c('0x20')](function(){if(_0x1811cd[_0x4c2c('0x89')]===_0x4c2c('0x8a')){return null;}var _0x84be80=_[_0x4c2c('0x39')](_0x1811cd,{'name':_0x1811cd['fullPath']||_0x1811cd[_0x4c2c('0x26')]||_0xf7fa2c[_0x4c2c('0x26')],'basename':_0x4ab938,'savename':util['format']('%s-%s.%s',_0x1811cd[_0x4c2c('0x26')]||_0xf7fa2c[_0x4c2c('0x26')],require(_0x4c2c('0x8b'))[_0x4c2c('0x8c')](0x4),_0x1811cd[_0x4c2c('0x89')]||_0x4c2c('0x8d')),'reportId':_0xf7fa2c['id'],'reportType':_0x4c2c('0x8e')});return db[_0x4c2c('0x8f')][_0x4c2c('0x44')](_0x84be80,{'raw':!![]});})[_0x4c2c('0x20')](function(_0x42c169){if(_0xf7fa2c[_0x4c2c('0x69')]==='cdr'){_0xb66e31[_0x4c2c('0x36')](_0xf7fa2c[_0x4c2c('0x69')]+_0x4c2c('0x90'),_0x1811cd[_0x4c2c('0x91')],_0x1811cd[_0x4c2c('0x92')]);}else{_0xb66e31[_0x4c2c('0x36')](_0xf7fa2c[_0x4c2c('0x69')]+_0x4c2c('0x93'),_0x1811cd[_0x4c2c('0x91')],_0x1811cd[_0x4c2c('0x92')]);}if(_0x42c169){logger['info']('Run\x20Query:',_0xb66e31[_0x4c2c('0x7f')]());require(_0x4c2c('0x94'))[_0x4c2c('0x95')](path[_0x4c2c('0x50')](__dirname,_0x4c2c('0x96'),_0x42c169[_0x4c2c('0x89')]),[_0x42c169['id'],_0xb66e31['toString'](),path['join'](__dirname,_0x4c2c('0x97'),_0x42c169[_0x4c2c('0x98')]),_0x4ab938]);return _0x42c169;}else{var _0x17da06=squel[_0x4c2c('0x88')]();_0x17da06[_0x4c2c('0x68')]('('+_0xb66e31[_0x4c2c('0x7f')]()+')',_0x4c2c('0x99'));_0x17da06[_0x4c2c('0x6c')](_0x4c2c('0x9a'),_0x4c2c('0x18'));_0xb66e31[_0x4c2c('0x1a')](_0x1811cd['limit']||_0x14036c);_0xb66e31[_0x4c2c('0x19')](_0x1811cd['offset']||0x0);return dbH['sequelize'][_0x4c2c('0x2c')](_0x17da06[_0x4c2c('0x7f')](),{'type':dbH[_0x4c2c('0x9b')][_0x4c2c('0x9c')][_0x4c2c('0x9d')]})[_0x4c2c('0x20')](function(_0x27698a){if(!_0x27698a[_0x4c2c('0x40')]){_0x4fd761=0x0;}else{_0x4fd761=_0x27698a[0x0]['count']||0x0;}return dbH['sequelize'][_0x4c2c('0x2c')](_0xb66e31[_0x4c2c('0x7f')](),{'type':dbH[_0x4c2c('0x9b')][_0x4c2c('0x9c')][_0x4c2c('0x9d')]});})[_0x4c2c('0x20')](function(_0x2c12d0){return{'rows':_0x2c12d0||[],'count':_0x4fd761};});}});}exports[_0x4c2c('0x9e')]=function(_0x19472b,_0x4aba46){return runReport(_0x19472b[_0x4c2c('0x3f')],_0x19472b[_0x4c2c('0x2c')],_0x19472b[_0x4c2c('0x42')])['then'](respondWithResult(_0x4aba46,null))[_0x4c2c('0x3e')](handleError(_0x4aba46,null));};exports[_0x4c2c('0x9f')]=runReport;exports[_0x4c2c('0x2c')]=function(_0x1c1c25,_0x3a193c){var _0x2e0da8=0xa;var _0x3512b1=[_0x4c2c('0x50'),'left_join',_0x4c2c('0x51'),'cross_join'];var _0x62bddc={'SUM':'SUM(%s)','COUNT':_0x4c2c('0x54'),'COUNT DISTINCT':_0x4c2c('0x55'),'MAX':_0x4c2c('0x56'),'MIN':_0x4c2c('0x81'),'AVG':_0x4c2c('0x82'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4c2c('0xa0'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1fd468={'SEC_TO_TIME':_0x4c2c('0x58'),'DATE':_0x4c2c('0x59'),'HOUR':_0x4c2c('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4c2c('0x5c')};var _0x5e548c=function(_0x1a4035){return!_[_0x4c2c('0x84')]([_0x4c2c('0x5d'),_0x4c2c('0x85'),_0x4c2c('0x5e'),_0x4c2c('0x5f')],_0x1a4035);};var _0x3bb7ec=function(_0x1d2f75){if(!_0x1d2f75||!_0x1d2f75[_0x4c2c('0x60')][_0x4c2c('0x40')]){return'';}for(var _0x125c32='(',_0x38724d=0x0;_0x38724d<_0x1d2f75[_0x4c2c('0x60')][_0x4c2c('0x40')];_0x38724d+=0x1){_0x38724d>0x0&&(_0x125c32+='\x20'+_0x1d2f75[_0x4c2c('0x86')]+'\x20');_0x125c32+=_0x1d2f75['rules'][_0x38724d]['group']?_0x3bb7ec(_0x1d2f75['rules'][_0x38724d][_0x4c2c('0x61')]):_0x1d2f75[_0x4c2c('0x60')][_0x38724d][_0x4c2c('0x6c')]+'\x20'+_0x1d2f75[_0x4c2c('0x60')][_0x38724d][_0x4c2c('0x62')]+(_0x5e548c(_0x1d2f75['rules'][_0x38724d]['condition'])?'\x20'+_0x1d2f75[_0x4c2c('0x60')][_0x38724d]['value']:'');}return _0x125c32+')';};var _0x4c41c6={'where':{'id':_0x1c1c25[_0x4c2c('0x3f')]['id']}},_0x3ceb6c,_0x501e17,_0x3a3e70,_0x42ced1,_0x42a243;_0x4c41c6=_['merge']({},_0x4c41c6,_0x1c1c25['options']);return db['AnalyticCustomReport'][_0x4c2c('0x43')](_0x4c41c6)[_0x4c2c('0x20')](function(_0x3e288c){if(_0x3e288c){_0x3ceb6c=_0x3e288c;return _0x3e288c['getFields']();}return null;})[_0x4c2c('0x20')](function(_0x1e838c){if(_0x1e838c){if(!_0x1e838c[_0x4c2c('0x40')]){throw new db[(_0x4c2c('0x65'))]['ValidationErrorItem'](_0x4c2c('0x67'),0x193);}_0x501e17=_0x1e838c;return db[_0x4c2c('0x87')]['findAll']({'raw':!![]});}return null;})[_0x4c2c('0x20')](function(_0x2cc49e){if(_0x2cc49e){_0x3a3e70=_[_0x4c2c('0xa1')](_0x2cc49e,'id');var _0x2c962b;var _0x266011=squel[_0x4c2c('0x88')]();_0x266011[_0x4c2c('0x68')](_0x3ceb6c[_0x4c2c('0x69')]);for(var _0x6af438=0x0;_0x6af438<_0x501e17[_0x4c2c('0x40')];_0x6af438+=0x1){_0x2c962b=_0x501e17[_0x6af438]['MetricId']?_0x3a3e70[_0x501e17[_0x6af438][_0x4c2c('0x6a')]][_0x4c2c('0x6b')]:_0x501e17[_0x6af438][_0x4c2c('0x6c')];_0x2c962b=_0x501e17[_0x6af438]['function']?_[_0x4c2c('0x6e')](_0x62bddc[_0x501e17[_0x6af438][_0x4c2c('0x6d')]],'%s',_0x2c962b):_0x2c962b;_0x2c962b=_0x501e17[_0x6af438][_0x4c2c('0x6f')]?_['replace'](_0x1fd468[_0x501e17[_0x6af438][_0x4c2c('0x6f')]],'%s',_0x2c962b):_0x2c962b;if(_0x501e17[_0x6af438][_0x4c2c('0x70')]){_0x266011['group'](_0x2c962b);}_0x501e17[_0x6af438]['orderBy']&&_0x266011[_0x4c2c('0x34')](_0x2c962b,_0x501e17[_0x6af438][_0x4c2c('0x71')]==='DESC'?![]:!![]);_0x266011[_0x4c2c('0x6c')](_0x2c962b,_0x501e17[_0x6af438][_0x4c2c('0x73')]||_0x2c962b);}if(_0x3ceb6c[_0x4c2c('0x74')]){_0x3ceb6c[_0x4c2c('0x74')]=JSON[_0x4c2c('0x7b')](_0x3ceb6c['joins']);for(var _0x46048d=0x0;_0x46048d<_0x3ceb6c['joins'][_0x4c2c('0x40')];_0x46048d+=0x1){if(_0x3ceb6c[_0x4c2c('0x74')][_0x46048d][_0x4c2c('0x75')]&&_[_0x4c2c('0x84')](_0x3512b1,_0x3ceb6c[_0x4c2c('0x74')][_0x46048d][_0x4c2c('0x75')])&&_0x3ceb6c[_0x4c2c('0x74')][_0x46048d][_0x4c2c('0x76')]&&_0x3ceb6c[_0x4c2c('0x74')][_0x46048d][_0x4c2c('0x77')]&&_0x3ceb6c[_0x4c2c('0x74')][_0x46048d]['foreignKey']){_0x266011[_0x3ceb6c[_0x4c2c('0x74')][_0x46048d]['type']](_0x3ceb6c[_0x4c2c('0x74')][_0x46048d]['foreignTable'],null,util[_0x4c2c('0x6f')](_0x4c2c('0x78'),_0x3ceb6c[_0x4c2c('0x69')],_0x3ceb6c['joins'][_0x46048d][_0x4c2c('0x76')],_0x3ceb6c[_0x4c2c('0x74')][_0x46048d]['foreignTable'],_0x3ceb6c[_0x4c2c('0x74')][_0x46048d][_0x4c2c('0x79')]));}}}if(_0x3ceb6c['conditions']){_0x3ceb6c['conditions']=JSON['parse'](_0x3ceb6c['conditions']);_0x266011[_0x4c2c('0x36')](_0x3bb7ec(_0x3ceb6c[_0x4c2c('0x7a')][_0x4c2c('0x61')]));}_0x42a243=_0x266011[_0x4c2c('0x7c')]();_0x266011[_0x4c2c('0x1a')](_0x2e0da8);_0x266011[_0x4c2c('0x19')](0x0);logger[_0x4c2c('0x7d')]('Limited\x20Query:',_0x266011['toString']());return dbH[_0x4c2c('0x9b')][_0x4c2c('0x2c')](_0x266011[_0x4c2c('0x7f')](),{'type':dbH[_0x4c2c('0x9b')][_0x4c2c('0x9c')][_0x4c2c('0x9d')]});}})[_0x4c2c('0x20')](function(){return{'sql':_0x42a243[_0x4c2c('0x7f')]()};})[_0x4c2c('0x20')](respondWithResult(_0x3a193c,null))[_0x4c2c('0x3e')](handleError(_0x3a193c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 633ddd2..ff4be27 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 _0xff30=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x4e019a,_0x2c900c){var _0x47a21=function(_0x44439c){while(--_0x44439c){_0x4e019a['push'](_0x4e019a['shift']());}};_0x47a21(++_0x2c900c);}(_0xff30,0x14e));var _0x0ff3=function(_0x1d8007,_0x6ad560){_0x1d8007=_0x1d8007-0x0;var _0x186757=_0xff30[_0x1d8007];return _0x186757;};'use strict';var _=require(_0x0ff3('0x0'));var util=require('util');var logger=require(_0x0ff3('0x1'))(_0x0ff3('0x2'));var moment=require(_0x0ff3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ff3('0x4'));var rimraf=require('rimraf');var config=require(_0x0ff3('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0x0ff3('0x6')]=function(_0x8bb320,_0x1bed4f){return _0x8bb320[_0x0ff3('0x7')](_0x0ff3('0x8'),attributes,{'tableName':_0x0ff3('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44a7=['analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x44a7,0xfb));var _0x744a=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x44a7[_0xcf581b];return _0x4f454d;};'use strict';var _=require(_0x744a('0x0'));var util=require('util');var logger=require(_0x744a('0x1'))(_0x744a('0x2'));var moment=require(_0x744a('0x3'));var BPromise=require(_0x744a('0x4'));var rp=require(_0x744a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x744a('0x6'));var config=require(_0x744a('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x744a('0x8')]=function(_0x189ab1,_0x590a6f){return _0x189ab1['define']('AnalyticCustomReport',attributes,{'tableName':_0x744a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 7ad59f0..4e3d507 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 _0x5741=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5741,0x135));var _0x1574=function(_0x824a49,_0x32a810){_0x824a49=_0x824a49-0x0;var _0x5384c4=_0x5741[_0x824a49];return _0x5384c4;};'use strict';var _=require(_0x1574('0x0'));var util=require('util');var moment=require(_0x1574('0x1'));var BPromise=require(_0x1574('0x2'));var rs=require(_0x1574('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1574('0x4'))['db'];var utils=require(_0x1574('0x5'));var logger=require(_0x1574('0x6'))(_0x1574('0x7'));var config=require(_0x1574('0x8'));var jayson=require(_0x1574('0x9'));var client=jayson[_0x1574('0xa')][_0x1574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c679,_0x398005,_0x5ae259){return new BPromise(function(_0x45ab17,_0x2922eb){return client['request'](_0x59c679,_0x5ae259)['then'](function(_0xa720ee){logger['info'](_0x1574('0xc'),_0x398005,_0x1574('0xd'));logger[_0x1574('0xe')](_0x1574('0xf'),_0x398005,_0x1574('0xd'),JSON['stringify'](_0xa720ee));if(_0xa720ee[_0x1574('0x10')]){if(_0xa720ee[_0x1574('0x10')][_0x1574('0x11')]===0x1f4){logger[_0x1574('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x398005,_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);return _0x2922eb(_0xa720ee['error']['message']);}logger[_0x1574('0x10')](_0x1574('0xc'),_0x398005,_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);return _0x45ab17(_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);}else{logger[_0x1574('0x13')](_0x1574('0xc'),_0x398005,_0x1574('0xd'));_0x45ab17(_0xa720ee['result'][_0x1574('0x12')]);}})[_0x1574('0x14')](function(_0x1463e1){logger[_0x1574('0x10')](_0x1574('0xc'),_0x398005,_0x1463e1);_0x2922eb(_0x1463e1);});});} \ No newline at end of file +var _0x4e83=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticCustomReport,\x20%s,\x20%s','message'];(function(_0x1f21a4,_0x221782){var _0x372a8e=function(_0x2db2bb){while(--_0x2db2bb){_0x1f21a4['push'](_0x1f21a4['shift']());}};_0x372a8e(++_0x221782);}(_0x4e83,0x179));var _0x34e8=function(_0x2b9120,_0x4cba82){_0x2b9120=_0x2b9120-0x0;var _0x459db0=_0x4e83[_0x2b9120];return _0x459db0;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34e8('0x5'));var logger=require(_0x34e8('0x6'))(_0x34e8('0x7'));var config=require(_0x34e8('0x8'));var jayson=require(_0x34e8('0x9'));var client=jayson[_0x34e8('0xa')][_0x34e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe55935,_0x20bedc,_0x411583){return new BPromise(function(_0x15add6,_0x4104f3){return client[_0x34e8('0xc')](_0xe55935,_0x411583)[_0x34e8('0xd')](function(_0x1da355){logger[_0x34e8('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x20bedc,_0x34e8('0xf'));logger[_0x34e8('0x10')](_0x34e8('0x11'),_0x20bedc,_0x34e8('0xf'),JSON[_0x34e8('0x12')](_0x1da355));if(_0x1da355['error']){if(_0x1da355['error'][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x14')](_0x34e8('0x15'),_0x20bedc,_0x1da355['error'][_0x34e8('0x16')]);return _0x4104f3(_0x1da355[_0x34e8('0x14')]['message']);}logger[_0x34e8('0x14')](_0x34e8('0x15'),_0x20bedc,_0x1da355[_0x34e8('0x14')][_0x34e8('0x16')]);return _0x15add6(_0x1da355[_0x34e8('0x14')]['message']);}else{logger[_0x34e8('0xe')](_0x34e8('0x15'),_0x20bedc,'request\x20sent');_0x15add6(_0x1da355[_0x34e8('0x17')][_0x34e8('0x16')]);}})[_0x34e8('0x18')](function(_0x4c2b4b){logger[_0x34e8('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x20bedc,_0x4c2b4b);_0x4104f3(_0x4c2b4b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b31abb0..d0e1555 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 _0x0d29=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x4421e4,_0xa18082){var _0x1873cf=function(_0x17f62e){while(--_0x17f62e){_0x4421e4['push'](_0x4421e4['shift']());}};_0x1873cf(++_0xa18082);}(_0x0d29,0xff));var _0x90d2=function(_0xe0805,_0x3a90d6){_0xe0805=_0xe0805-0x0;var _0x5b0c72=_0x0d29[_0xe0805];return _0x5b0c72;};'use strict';var multer=require('multer');var util=require(_0x90d2('0x0'));var path=require(_0x90d2('0x1'));var timeout=require(_0x90d2('0x2'));var express=require(_0x90d2('0x3'));var router=express[_0x90d2('0x4')]();var auth=require(_0x90d2('0x5'));var interaction=require(_0x90d2('0x6'));var config=require(_0x90d2('0x7'));var controller=require(_0x90d2('0x8'));router[_0x90d2('0x9')]('/',auth[_0x90d2('0xa')](),controller[_0x90d2('0xb')]);router['get'](_0x90d2('0xc'),auth['isAuthenticated'](),controller[_0x90d2('0xd')]);router[_0x90d2('0x9')](_0x90d2('0xe'),auth[_0x90d2('0xa')](),controller[_0x90d2('0xf')]);router['get'](_0x90d2('0x10'),auth[_0x90d2('0xa')](),controller[_0x90d2('0x11')]);router['get'](_0x90d2('0x12'),auth['isAuthenticated'](),controller[_0x90d2('0x13')]);router[_0x90d2('0x14')]('/',auth[_0x90d2('0xa')](),controller[_0x90d2('0x15')]);router['put'](_0x90d2('0xc'),auth[_0x90d2('0xa')](),controller[_0x90d2('0x16')]);router[_0x90d2('0x17')](_0x90d2('0xc'),auth[_0x90d2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc527=['/:id/query','query','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xc527,0x79));var _0x7c52=function(_0x1a3b16,_0x14c1a8){_0x1a3b16=_0x1a3b16-0x0;var _0xe3d02f=_0xc527[_0x1a3b16];return _0xe3d02f;};'use strict';var multer=require('multer');var util=require(_0x7c52('0x0'));var path=require(_0x7c52('0x1'));var timeout=require(_0x7c52('0x2'));var express=require(_0x7c52('0x3'));var router=express[_0x7c52('0x4')]();var auth=require(_0x7c52('0x5'));var interaction=require(_0x7c52('0x6'));var config=require(_0x7c52('0x7'));var controller=require(_0x7c52('0x8'));router['get']('/',auth[_0x7c52('0x9')](),controller[_0x7c52('0xa')]);router[_0x7c52('0xb')](_0x7c52('0xc'),auth[_0x7c52('0x9')](),controller[_0x7c52('0xd')]);router[_0x7c52('0xb')](_0x7c52('0xe'),auth['isAuthenticated'](),controller[_0x7c52('0xf')]);router[_0x7c52('0xb')](_0x7c52('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x7c52('0xb')](_0x7c52('0x11'),auth['isAuthenticated'](),controller[_0x7c52('0x12')]);router['post']('/',auth[_0x7c52('0x9')](),controller[_0x7c52('0x13')]);router[_0x7c52('0x14')](_0x7c52('0xc'),auth[_0x7c52('0x9')](),controller['update']);router[_0x7c52('0x15')](_0x7c52('0xc'),auth[_0x7c52('0x9')](),controller['destroy']);module[_0x7c52('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f48e0cb..a36ac84 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 _0xdc53=['sequelize','exports','STRING','TEXT'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xdc53,0x7c));var _0x3dc5=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xdc53[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0x3dc5('0x0'));module[_0x3dc5('0x1')]={'name':{'type':Sequelize[_0x3dc5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3dc5('0x2')]},'parent':{'type':Sequelize[_0x3dc5('0x2')]},'table':{'type':Sequelize[_0x3dc5('0x2')]},'conditions':{'type':Sequelize[_0x3dc5('0x3')]},'joins':{'type':Sequelize[_0x3dc5('0x3')]}}; \ No newline at end of file +var _0x77ad=['TEXT','sequelize','STRING'];(function(_0x2c7253,_0x5debe6){var _0x4ae6fb=function(_0x23e1ab){while(--_0x23e1ab){_0x2c7253['push'](_0x2c7253['shift']());}};_0x4ae6fb(++_0x5debe6);}(_0x77ad,0x196));var _0xd77a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x77ad[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xd77a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd77a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd77a('0x1')]},'parent':{'type':Sequelize[_0xd77a('0x1')]},'table':{'type':Sequelize[_0xd77a('0x1')]},'conditions':{'type':Sequelize[_0xd77a('0x2')]},'joins':{'type':Sequelize[_0xd77a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f7e6e90..a08e83c 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 _0xfb3f=['ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','operator','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','field','function','replace','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','debug','sequelize','toString','QueryTypes','SELECT','right_join','cross_join','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','clone','output','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','AnalyticMetric','groupBy','%s.%s\x20=\x20%s.%s','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)'];(function(_0x557a09,_0x20df0c){var _0xe39de4=function(_0x495034){while(--_0x495034){_0x557a09['push'](_0x557a09['shift']());}};_0xe39de4(++_0x20df0c);}(_0xfb3f,0xe9));var _0xffb3=function(_0x5586e8,_0x40dfc1){_0x5586e8=_0x5586e8-0x0;var _0x598ffe=_0xfb3f[_0x5586e8];return _0x598ffe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xffb3('0x0'));var rimraf=require(_0xffb3('0x1'));var zipdir=require(_0xffb3('0x2'));var jsonpatch=require(_0xffb3('0x3'));var rp=require(_0xffb3('0x4'));var moment=require(_0xffb3('0x5'));var BPromise=require(_0xffb3('0x6'));var Mustache=require(_0xffb3('0x7'));var util=require(_0xffb3('0x8'));var path=require(_0xffb3('0x9'));var sox=require(_0xffb3('0xa'));var csv=require(_0xffb3('0xb'));var ejs=require(_0xffb3('0xc'));var fs=require('fs');var _=require(_0xffb3('0xd'));var squel=require(_0xffb3('0xe'));var crypto=require('crypto');var jsforce=require(_0xffb3('0xf'));var deskjs=require(_0xffb3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xffb3('0x11'));var Papa=require('papaparse');var Redis=require(_0xffb3('0x12'));var authService=require(_0xffb3('0x13'));var qs=require(_0xffb3('0x14'));var as=require(_0xffb3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffb3('0x16'))(_0xffb3('0x17'));var utils=require('../../config/utils');var config=require(_0xffb3('0x18'));var licenseUtil=require(_0xffb3('0x19'));var db=require(_0xffb3('0x1a'))['db'];var dbH=require(_0xffb3('0x1a'))['dbH'];function respondWithStatusCode(_0x3e2cff,_0x3ce934){_0x3ce934=_0x3ce934||0xcc;return function(_0x122edb){if(_0x122edb){return _0x3e2cff['sendStatus'](_0x3ce934);}return _0x3e2cff[_0xffb3('0x1b')](_0x3ce934)[_0xffb3('0x1c')]();};}function respondWithResult(_0x22ff13,_0x48a8ad){_0x48a8ad=_0x48a8ad||0xc8;return function(_0x39ffac){if(_0x39ffac){return _0x22ff13['status'](_0x48a8ad)[_0xffb3('0x1d')](_0x39ffac);}};}function respondWithFilteredResult(_0x3c5c5b,_0x13c13b){return function(_0x279098){if(_0x279098){var _0x96a9ac=_0x279098[_0xffb3('0x1e')],_0x541290=_0x13c13b['offset'],_0x19336e=_0x13c13b[_0xffb3('0x1f')]+_0x13c13b['limit'],_0x513b34;if(_0x19336e>=_0x96a9ac){_0x19336e=_0x96a9ac;_0x513b34=0xc8;}else{_0x513b34=0xce;}_0x3c5c5b[_0xffb3('0x1b')](_0x513b34);return _0x3c5c5b[_0xffb3('0x20')]('Content-Range',_0x541290+'-'+_0x19336e+'/'+_0x96a9ac)[_0xffb3('0x1d')](_0x279098);}return null;};}function patchUpdates(_0x53298f){return function(_0x35f7ab){try{jsonpatch[_0xffb3('0x21')](_0x35f7ab,_0x53298f,!![]);}catch(_0x4a1f4e){return BPromise[_0xffb3('0x22')](_0x4a1f4e);}return _0x35f7ab[_0xffb3('0x23')]();};}function saveUpdates(_0x4891de,_0x1b993f){return function(_0x321eb7){if(_0x321eb7){return _0x321eb7[_0xffb3('0x24')](_0x4891de)[_0xffb3('0x25')](function(_0x18582e){return _0x18582e;});}return null;};}function removeEntity(_0x62b534,_0x8fca48){return function(_0x103b84){if(_0x103b84){return _0x103b84[_0xffb3('0x26')]()[_0xffb3('0x25')](function(){var _0xffcc3e=_0x103b84[_0xffb3('0x27')]({'plain':!![]});var _0x246e39=_0xffb3('0x28');return db[_0xffb3('0x29')]['destroy']({'where':{'type':_0x246e39,'resourceId':_0xffcc3e['id']}})[_0xffb3('0x25')](function(){return _0x103b84;});})[_0xffb3('0x25')](function(){_0x62b534[_0xffb3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bc2e2,_0x136837){return function(_0x27e641){if(!_0x27e641){_0x3bc2e2['sendStatus'](0x194);}return _0x27e641;};}function handleError(_0x33d073,_0x289136){_0x289136=_0x289136||0x1f4;return function(_0x4dbcf1){logger[_0xffb3('0x2a')](_0x4dbcf1[_0xffb3('0x2b')]);if(_0x4dbcf1[_0xffb3('0x2c')]){delete _0x4dbcf1['name'];}_0x33d073[_0xffb3('0x1b')](_0x289136)[_0xffb3('0x2d')](_0x4dbcf1);};}exports[_0xffb3('0x2e')]=function(_0x291319,_0x83279b){var _0x2f0986={},_0x51c82b={},_0x4576dd={'count':0x0,'rows':[]};var _0x2f1608=_[_0xffb3('0x2f')](db[_0xffb3('0x30')][_0xffb3('0x31')],function(_0x1fa240){return{'name':_0x1fa240['fieldName'],'type':_0x1fa240[_0xffb3('0x32')][_0xffb3('0x33')]};});_0x51c82b[_0xffb3('0x34')]=_['map'](_0x2f1608,'name');_0x51c82b[_0xffb3('0x35')]=_[_0xffb3('0x36')](_0x291319[_0xffb3('0x35')]);_0x51c82b[_0xffb3('0x37')]=_[_0xffb3('0x38')](_0x51c82b[_0xffb3('0x34')],_0x51c82b[_0xffb3('0x35')]);_0x2f0986[_0xffb3('0x39')]=_[_0xffb3('0x38')](_0x51c82b[_0xffb3('0x34')],qs['fields'](_0x291319['query'][_0xffb3('0x3a')]));_0x2f0986[_0xffb3('0x39')]=_0x2f0986[_0xffb3('0x39')]['length']?_0x2f0986[_0xffb3('0x39')]:_0x51c82b['model'];if(!_0x291319[_0xffb3('0x35')][_0xffb3('0x3b')](_0xffb3('0x3c'))){_0x2f0986[_0xffb3('0x3d')]=qs[_0xffb3('0x3d')](_0x291319[_0xffb3('0x35')][_0xffb3('0x3d')]);_0x2f0986[_0xffb3('0x1f')]=qs[_0xffb3('0x1f')](_0x291319[_0xffb3('0x35')]['offset']);}_0x2f0986[_0xffb3('0x3e')]=qs[_0xffb3('0x3f')](_0x291319[_0xffb3('0x35')]['sort']);_0x2f0986[_0xffb3('0x40')]=qs[_0xffb3('0x37')](_['pick'](_0x291319['query'],_0x51c82b[_0xffb3('0x37')]),_0x2f1608);if(_0x291319[_0xffb3('0x35')][_0xffb3('0x41')]){_0x2f0986[_0xffb3('0x40')]=_[_0xffb3('0x42')](_0x2f0986['where'],{'$or':_['map'](_0x2f1608,function(_0x5dddae){if(_0x5dddae[_0xffb3('0x32')]!==_0xffb3('0x43')){var _0x18c0f2={};_0x18c0f2[_0x5dddae['name']]={'$like':'%'+_0x291319['query'][_0xffb3('0x41')]+'%'};return _0x18c0f2;}})});}_0x2f0986=_[_0xffb3('0x42')]({},_0x2f0986,_0x291319[_0xffb3('0x44')]);var _0x3091fc={'where':_0x2f0986['where']};return db[_0xffb3('0x30')][_0xffb3('0x1e')](_0x3091fc)[_0xffb3('0x25')](function(_0x303774){_0x4576dd[_0xffb3('0x1e')]=_0x303774;if(_0x291319[_0xffb3('0x35')]['includeAll']){_0x2f0986['include']=[{'all':!![]}];}return db[_0xffb3('0x30')][_0xffb3('0x45')](_0x2f0986);})['then'](function(_0x5153ad){_0x4576dd['rows']=_0x5153ad;return _0x4576dd;})[_0xffb3('0x25')](respondWithFilteredResult(_0x83279b,_0x2f0986))[_0xffb3('0x46')](handleError(_0x83279b,null));};exports[_0xffb3('0x47')]=function(_0x3ac23a,_0x436c57){var _0x864355={'raw':!![],'where':{'id':_0x3ac23a[_0xffb3('0x48')]['id']}},_0x39f908={};_0x39f908[_0xffb3('0x34')]=_[_0xffb3('0x36')](db['AnalyticDefaultReport'][_0xffb3('0x31')]);_0x39f908['query']=_['keys'](_0x3ac23a['query']);_0x39f908['filters']=_[_0xffb3('0x38')](_0x39f908['model'],_0x39f908['query']);_0x864355[_0xffb3('0x39')]=_['intersection'](_0x39f908[_0xffb3('0x34')],qs['fields'](_0x3ac23a[_0xffb3('0x35')][_0xffb3('0x3a')]));_0x864355[_0xffb3('0x39')]=_0x864355[_0xffb3('0x39')][_0xffb3('0x49')]?_0x864355[_0xffb3('0x39')]:_0x39f908[_0xffb3('0x34')];if(_0x3ac23a[_0xffb3('0x35')][_0xffb3('0x4a')]){_0x864355[_0xffb3('0x4b')]=[{'all':!![]}];}_0x864355=_['merge']({},_0x864355,_0x3ac23a[_0xffb3('0x44')]);return db[_0xffb3('0x30')]['find'](_0x864355)[_0xffb3('0x25')](handleEntityNotFound(_0x436c57,null))[_0xffb3('0x25')](respondWithResult(_0x436c57,null))['catch'](handleError(_0x436c57,null));};exports[_0xffb3('0x4c')]=function(_0x2388cd,_0x58077f){return db['AnalyticDefaultReport']['create'](_0x2388cd['body'],{})[_0xffb3('0x25')](function(_0x3d0b94){var _0x5eeae3=_0x2388cd[_0xffb3('0x4d')][_0xffb3('0x27')]({'plain':!![]});if(!_0x5eeae3)throw new Error(_0xffb3('0x4e'));if(_0x5eeae3[_0xffb3('0x4f')]==='user'){var _0x52f0b1=_0x3d0b94[_0xffb3('0x27')]({'plain':!![]});var _0x52da11=_0xffb3('0x50');return db['UserProfileSection'][_0xffb3('0x51')]({'where':{'name':_0x52da11,'userProfileId':_0x5eeae3[_0xffb3('0x52')]},'raw':!![]})['then'](function(_0x1cf1a8){if(_0x1cf1a8&&_0x1cf1a8[_0xffb3('0x53')]===0x0){return db[_0xffb3('0x29')][_0xffb3('0x4c')]({'name':_0x52f0b1[_0xffb3('0x2c')],'resourceId':_0x52f0b1['id'],'type':_0xffb3('0x28'),'sectionId':_0x1cf1a8['id']},{})[_0xffb3('0x25')](function(){return _0x3d0b94;});}else{return _0x3d0b94;}})[_0xffb3('0x46')](function(_0x3037fd){logger[_0xffb3('0x2a')](_0xffb3('0x54'),_0x3037fd);throw _0x3037fd;});}return _0x3d0b94;})[_0xffb3('0x25')](respondWithResult(_0x58077f,0xc9))[_0xffb3('0x46')](handleError(_0x58077f,null));};exports['update']=function(_0x23d1c6,_0x3a8e1f){if(_0x23d1c6[_0xffb3('0x55')]['id']){delete _0x23d1c6[_0xffb3('0x55')]['id'];}return db['AnalyticDefaultReport'][_0xffb3('0x51')]({'where':{'id':_0x23d1c6['params']['id']}})[_0xffb3('0x25')](handleEntityNotFound(_0x3a8e1f,null))['then'](saveUpdates(_0x23d1c6[_0xffb3('0x55')],null))[_0xffb3('0x25')](respondWithResult(_0x3a8e1f,null))['catch'](handleError(_0x3a8e1f,null));};exports[_0xffb3('0x26')]=function(_0x5a1b2b,_0xb81ffc){return db[_0xffb3('0x30')][_0xffb3('0x51')]({'where':{'id':_0x5a1b2b['params']['id']}})[_0xffb3('0x25')](handleEntityNotFound(_0xb81ffc,null))[_0xffb3('0x25')](removeEntity(_0xb81ffc,null))[_0xffb3('0x46')](handleError(_0xb81ffc,null));};exports[_0xffb3('0x56')]=function(_0x546ea4,_0x247895){var _0x11f627=0xa;var _0x2be173=[_0xffb3('0x57'),_0xffb3('0x58'),'right_join','cross_join'];var _0x3e7739={'SUM':_0xffb3('0x59'),'COUNT':_0xffb3('0x5a'),'COUNT DISTINCT':_0xffb3('0x5b'),'MAX':_0xffb3('0x5c'),'MIN':_0xffb3('0x5d'),'AVG':_0xffb3('0x5e'),'GROUP_CONCAT':_0xffb3('0x5f'),'GROUP_CONCAT ASC':_0xffb3('0x60'),'GROUP_CONCAT DESC':_0xffb3('0x61')};var _0x225f94={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xffb3('0x62'),'ROUND':_0xffb3('0x63'),'UNIX_TIMESTAMP':_0xffb3('0x64')};var _0x41a901=function(_0x1ff296){return!_['includes']([_0xffb3('0x65'),'IS\x20NOT\x20NULL',_0xffb3('0x66'),'IS\x20NOT\x20EMPTY'],_0x1ff296);};var _0x36792f=function(_0x3654c5){if(!_0x3654c5||!_0x3654c5['rules'][_0xffb3('0x49')]){return'';}for(var _0x33ef24='(',_0x4a829c=0x0;_0x4a829c<_0x3654c5['rules'][_0xffb3('0x49')];_0x4a829c+=0x1){_0x4a829c>0x0&&(_0x33ef24+='\x20'+_0x3654c5[_0xffb3('0x67')]+'\x20');_0x33ef24+=_0x3654c5[_0xffb3('0x68')][_0x4a829c][_0xffb3('0x69')]?_0x36792f(_0x3654c5[_0xffb3('0x68')][_0x4a829c][_0xffb3('0x69')]):_0x3654c5['rules'][_0x4a829c]['field']+'\x20'+_0x3654c5['rules'][_0x4a829c][_0xffb3('0x6a')]+(_0x41a901(_0x3654c5[_0xffb3('0x68')][_0x4a829c][_0xffb3('0x6a')])?'\x20'+_0x3654c5['rules'][_0x4a829c][_0xffb3('0x6b')]:'');}return _0x33ef24+')';};var _0x40411b={'where':{'id':_0x546ea4[_0xffb3('0x48')]['id']}},_0x4e3214,_0x1b00e7,_0x52a920,_0x54e9c2,_0x4a9654;_0x40411b=_[_0xffb3('0x42')]({},_0x40411b,_0x546ea4[_0xffb3('0x44')]);return db[_0xffb3('0x30')][_0xffb3('0x51')](_0x40411b)[_0xffb3('0x25')](function(_0x19da10){if(_0x19da10){_0x4e3214=_0x19da10;return _0x19da10[_0xffb3('0x6c')]();}return null;})[_0xffb3('0x25')](function(_0x933bb){if(_0x933bb){if(!_0x933bb['length']){throw new db[(_0xffb3('0x6d'))][(_0xffb3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1b00e7=_0x933bb;return db['AnalyticMetric'][_0xffb3('0x45')]({'raw':!![]});}return null;})['then'](function(_0x437f52){if(_0x437f52){_0x52a920=_[_0xffb3('0x6f')](_0x437f52,'id');var _0x43cdfa;var _0x10397a=squel[_0xffb3('0x70')]();_0x10397a[_0xffb3('0x71')](_0x4e3214[_0xffb3('0x72')]);for(var _0x57a644=0x0;_0x57a644<_0x1b00e7['length'];_0x57a644+=0x1){_0x43cdfa=_0x1b00e7[_0x57a644][_0xffb3('0x73')]?_0x52a920[_0x1b00e7[_0x57a644]['MetricId']][_0xffb3('0x74')]:_0x1b00e7[_0x57a644][_0xffb3('0x75')];_0x43cdfa=_0x1b00e7[_0x57a644][_0xffb3('0x76')]?_[_0xffb3('0x77')](_0x3e7739[_0x1b00e7[_0x57a644][_0xffb3('0x76')]],'%s',_0x43cdfa):_0x43cdfa;_0x43cdfa=_0x1b00e7[_0x57a644][_0xffb3('0x78')]?_[_0xffb3('0x77')](_0x225f94[_0x1b00e7[_0x57a644][_0xffb3('0x78')]],'%s',_0x43cdfa):_0x43cdfa;if(_0x1b00e7[_0x57a644]['groupBy']){_0x10397a[_0xffb3('0x69')](_0x43cdfa);}_0x1b00e7[_0x57a644][_0xffb3('0x79')]&&_0x10397a[_0xffb3('0x3e')](_0x43cdfa,_0x1b00e7[_0x57a644]['orderBy']===_0xffb3('0x7a')?![]:!![]);_0x10397a[_0xffb3('0x75')](_0x43cdfa,_0x1b00e7[_0x57a644][_0xffb3('0x7b')]||_0x43cdfa);}if(_0x4e3214[_0xffb3('0x7c')]){_0x4e3214[_0xffb3('0x7c')]=JSON[_0xffb3('0x7d')](_0x4e3214[_0xffb3('0x7c')]);for(var _0xa58fb8=0x0;_0xa58fb8<_0x4e3214[_0xffb3('0x7c')][_0xffb3('0x49')];_0xa58fb8+=0x1){if(_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x32')]&&_[_0xffb3('0x7e')](_0x2be173,_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x32')])&&_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x7f')]&&_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x80')]&&_0x4e3214['joins'][_0xa58fb8]['foreignKey']){_0x10397a[_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x32')]](_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x80')],null,util[_0xffb3('0x78')]('%s.%s\x20=\x20%s.%s',_0x4e3214['table'],_0x4e3214[_0xffb3('0x7c')][_0xa58fb8]['parentKey'],_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x80')],_0x4e3214[_0xffb3('0x7c')][_0xa58fb8][_0xffb3('0x81')]));}}}if(_0x4e3214['conditions']){_0x4e3214['conditions']=JSON[_0xffb3('0x7d')](_0x4e3214[_0xffb3('0x82')]);_0x10397a['where'](_0x36792f(_0x4e3214[_0xffb3('0x82')][_0xffb3('0x69')]));}_0x4a9654=_0x10397a['clone']();_0x10397a[_0xffb3('0x3d')](_0x11f627);_0x10397a[_0xffb3('0x1f')](0x0);logger[_0xffb3('0x83')]('Limited\x20Query:',_0x10397a['toString']());return dbH[_0xffb3('0x84')][_0xffb3('0x35')](_0x10397a[_0xffb3('0x85')](),{'type':dbH['sequelize'][_0xffb3('0x86')][_0xffb3('0x87')]});}})[_0xffb3('0x25')](respondWithResult(_0x247895,null))[_0xffb3('0x46')](handleError(_0x247895,null));};function runReport(_0x5f269b,_0x5de0db,_0x5ca0b2){var _0xe9f34=_0x5de0db[_0xffb3('0x2c')];var _0x3618fd=0xa;var _0x3a7ee9=[_0xffb3('0x57'),_0xffb3('0x58'),_0xffb3('0x88'),_0xffb3('0x89')];var _0x48ec6d={'SUM':'SUM(%s)','COUNT':_0xffb3('0x5a'),'COUNT DISTINCT':_0xffb3('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xffb3('0x5f'),'GROUP_CONCAT ASC':_0xffb3('0x60'),'GROUP_CONCAT DESC':_0xffb3('0x61')};var _0x2bacc2={'SEC_TO_TIME':_0xffb3('0x8a'),'DATE':'DATE(%s)','HOUR':_0xffb3('0x62'),'ROUND':_0xffb3('0x63'),'UNIX_TIMESTAMP':_0xffb3('0x64')};var _0x2a73b1=function(_0x51c846){return!_[_0xffb3('0x7e')]([_0xffb3('0x65'),_0xffb3('0x8b'),_0xffb3('0x66'),'IS\x20NOT\x20EMPTY'],_0x51c846);};var _0x540f7d=function(_0x563ecf){if(!_0x563ecf||!_0x563ecf['rules'][_0xffb3('0x49')]){return'';}for(var _0x587d47='(',_0x58a8b6=0x0;_0x58a8b6<_0x563ecf[_0xffb3('0x68')][_0xffb3('0x49')];_0x58a8b6+=0x1){_0x58a8b6>0x0&&(_0x587d47+='\x20'+_0x563ecf[_0xffb3('0x67')]+'\x20');_0x587d47+=_0x563ecf['rules'][_0x58a8b6][_0xffb3('0x69')]?_0x540f7d(_0x563ecf[_0xffb3('0x68')][_0x58a8b6][_0xffb3('0x69')]):_0x563ecf[_0xffb3('0x68')][_0x58a8b6][_0xffb3('0x75')]+'\x20'+_0x563ecf[_0xffb3('0x68')][_0x58a8b6][_0xffb3('0x6a')]+(_0x2a73b1(_0x563ecf[_0xffb3('0x68')][_0x58a8b6][_0xffb3('0x6a')])?'\x20'+_0x563ecf['rules'][_0x58a8b6][_0xffb3('0x6b')]:'');}return _0x587d47+')';};var _0x268639={'where':{'id':_0x5f269b['id']}},_0x5d7689,_0x5dfdd3,_0x4156c6,_0x3d4d84,_0x1db0a0;_0x268639=_[_0xffb3('0x42')]({},_0x268639,_0x5ca0b2);return db['AnalyticDefaultReport'][_0xffb3('0x51')](_0x268639)[_0xffb3('0x25')](function(_0x25c65d){if(_0x25c65d){_0x5d7689=_0x25c65d;return _0x25c65d[_0xffb3('0x6c')]();}return null;})[_0xffb3('0x25')](function(_0x33fd3f){if(_0x33fd3f){if(!_0x33fd3f[_0xffb3('0x49')]){throw new db[(_0xffb3('0x6d'))][(_0xffb3('0x6e'))](_0xffb3('0x8c'),0x193);}_0x5dfdd3=_0x33fd3f;return db['AnalyticMetric'][_0xffb3('0x45')]({'raw':!![]});}return null;})[_0xffb3('0x25')](function(_0x531d76){if(_0x531d76){_0x4156c6=_['keyBy'](_0x531d76,'id');var _0x4a6118;var _0x5011b8=squel[_0xffb3('0x70')]();_0x5011b8[_0xffb3('0x71')](_0x5d7689['table']);for(var _0x4aa183=0x0;_0x4aa183<_0x5dfdd3[_0xffb3('0x49')];_0x4aa183+=0x1){_0x4a6118=_0x5dfdd3[_0x4aa183][_0xffb3('0x73')]?_0x4156c6[_0x5dfdd3[_0x4aa183]['MetricId']][_0xffb3('0x74')]:_0x5dfdd3[_0x4aa183]['field'];_0x4a6118=_0x5dfdd3[_0x4aa183][_0xffb3('0x76')]?_[_0xffb3('0x77')](_0x48ec6d[_0x5dfdd3[_0x4aa183][_0xffb3('0x76')]],'%s',_0x4a6118):_0x4a6118;_0x4a6118=_0x5dfdd3[_0x4aa183]['format']?_[_0xffb3('0x77')](_0x2bacc2[_0x5dfdd3[_0x4aa183][_0xffb3('0x78')]],'%s',_0x4a6118):_0x4a6118;if(_0x5dfdd3[_0x4aa183]['groupBy']){_0x5011b8[_0xffb3('0x69')](_0x4a6118);}_0x5dfdd3[_0x4aa183][_0xffb3('0x79')]&&_0x5011b8[_0xffb3('0x3e')](_0x4a6118,_0x5dfdd3[_0x4aa183]['orderBy']===_0xffb3('0x7a')?![]:!![]);_0x5011b8[_0xffb3('0x75')](_0x4a6118,_0x5dfdd3[_0x4aa183][_0xffb3('0x7b')]||_0x4a6118);}if(_0x5d7689[_0xffb3('0x7c')]){_0x5d7689[_0xffb3('0x7c')]=JSON['parse'](_0x5d7689[_0xffb3('0x7c')]);for(var _0xb263d=0x0;_0xb263d<_0x5d7689[_0xffb3('0x7c')][_0xffb3('0x49')];_0xb263d+=0x1){if(_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x32')]&&_[_0xffb3('0x7e')](_0x3a7ee9,_0x5d7689[_0xffb3('0x7c')][_0xb263d]['type'])&&_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x7f')]&&_0x5d7689['joins'][_0xb263d]['foreignTable']&&_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x81')]){_0x5011b8[_0x5d7689['joins'][_0xb263d][_0xffb3('0x32')]](_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x80')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5d7689[_0xffb3('0x72')],_0x5d7689['joins'][_0xb263d][_0xffb3('0x7f')],_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x80')],_0x5d7689[_0xffb3('0x7c')][_0xb263d][_0xffb3('0x81')]));}}}if(_0x5d7689['conditions']){_0x5d7689['conditions']=JSON[_0xffb3('0x7d')](_0x5d7689['conditions']);_0x5011b8[_0xffb3('0x40')](_0x540f7d(_0x5d7689['conditions'][_0xffb3('0x69')]));}_0x1db0a0=_0x5011b8[_0xffb3('0x8d')]();_0x5011b8['limit'](_0x3618fd);_0x5011b8[_0xffb3('0x1f')](0x0);return;}})[_0xffb3('0x25')](function(){if(_0x5de0db[_0xffb3('0x8e')]==='web'){return null;}var _0x2612a8=_[_0xffb3('0x42')](_0x5de0db,{'name':_0x5de0db['fullPath']||_0x5de0db[_0xffb3('0x2c')]||_0x5d7689['name'],'basename':_0xe9f34,'savename':util[_0xffb3('0x78')](_0xffb3('0x8f'),_0x5de0db[_0xffb3('0x2c')]||_0x5d7689['name'],require(_0xffb3('0x90'))[_0xffb3('0x91')](0x4),_0x5de0db[_0xffb3('0x8e')]||_0xffb3('0x92')),'reportId':_0x5d7689['id'],'reportType':_0xffb3('0x93')});return db[_0xffb3('0x94')][_0xffb3('0x4c')](_0x2612a8,{'raw':!![]});})['then'](function(_0x205bdb){if(_0x5d7689[_0xffb3('0x72')]===_0xffb3('0x95')){_0x1db0a0[_0xffb3('0x40')](_0x5d7689['table']+_0xffb3('0x96'),_0x5de0db['startDate'],_0x5de0db[_0xffb3('0x97')]);}else{_0x1db0a0[_0xffb3('0x40')](_0x5d7689[_0xffb3('0x72')]+_0xffb3('0x98'),_0x5de0db[_0xffb3('0x99')],_0x5de0db['endDate']);}if(_0x205bdb){logger['info'](_0xffb3('0x9a'),_0x1db0a0['toString']());require(_0xffb3('0x9b'))[_0xffb3('0x9c')](path[_0xffb3('0x57')](__dirname,_0xffb3('0x9d'),_0x205bdb['output']),[_0x205bdb['id'],_0x1db0a0[_0xffb3('0x85')](),path[_0xffb3('0x57')](__dirname,_0xffb3('0x9e'),_0x205bdb[_0xffb3('0x9f')]),_0xe9f34]);return _0x205bdb;}else{var _0x59b796=squel[_0xffb3('0x70')]();_0x59b796[_0xffb3('0x71')]('('+_0x1db0a0[_0xffb3('0x85')]()+')',_0xffb3('0xa0'));_0x59b796['field'](_0xffb3('0xa1'),_0xffb3('0x1e'));_0x1db0a0['limit'](_0x5de0db[_0xffb3('0x3d')]||_0x3618fd);_0x1db0a0[_0xffb3('0x1f')](_0x5de0db[_0xffb3('0x1f')]||0x0);return dbH['sequelize'][_0xffb3('0x35')](_0x59b796[_0xffb3('0x85')](),{'type':dbH['sequelize'][_0xffb3('0x86')]['SELECT']})[_0xffb3('0x25')](function(_0x2832f1){if(!_0x2832f1[_0xffb3('0x49')]){_0x3d4d84=0x0;}else{_0x3d4d84=_0x2832f1[0x0][_0xffb3('0x1e')]||0x0;}return dbH[_0xffb3('0x84')][_0xffb3('0x35')](_0x1db0a0[_0xffb3('0x85')](),{'type':dbH[_0xffb3('0x84')][_0xffb3('0x86')]['SELECT']});})[_0xffb3('0x25')](function(_0x536482){return{'rows':_0x536482||[],'count':_0x3d4d84};});}});}exports['run']=function(_0x8b400f,_0x31b0b9){return runReport(_0x8b400f[_0xffb3('0x48')],_0x8b400f[_0xffb3('0x35')],_0x8b400f['options'])[_0xffb3('0x25')](respondWithResult(_0x31b0b9,null))[_0xffb3('0x46')](handleError(_0x31b0b9,null));};exports['runReport']=runReport;exports[_0xffb3('0x35')]=function(_0xe67e7e,_0x22fea7){var _0xd90840=0xa;var _0x4aab5b=[_0xffb3('0x57'),'left_join',_0xffb3('0x88'),_0xffb3('0x89')];var _0x56c1b6={'SUM':_0xffb3('0x59'),'COUNT':_0xffb3('0x5a'),'COUNT DISTINCT':_0xffb3('0x5b'),'MAX':'MAX(%s)','MIN':_0xffb3('0x5d'),'AVG':_0xffb3('0x5e'),'GROUP_CONCAT':_0xffb3('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xffb3('0x61')};var _0x4e4b1a={'SEC_TO_TIME':_0xffb3('0x8a'),'DATE':'DATE(%s)','HOUR':_0xffb3('0x62'),'ROUND':_0xffb3('0x63'),'UNIX_TIMESTAMP':_0xffb3('0x64')};var _0x28d09b=function(_0x5bde9f){return!_[_0xffb3('0x7e')](['IS\x20NULL',_0xffb3('0x8b'),_0xffb3('0x66'),'IS\x20NOT\x20EMPTY'],_0x5bde9f);};var _0x43de3d=function(_0x30e538){if(!_0x30e538||!_0x30e538[_0xffb3('0x68')][_0xffb3('0x49')]){return'';}for(var _0x4b44e6='(',_0x2c9077=0x0;_0x2c9077<_0x30e538[_0xffb3('0x68')][_0xffb3('0x49')];_0x2c9077+=0x1){_0x2c9077>0x0&&(_0x4b44e6+='\x20'+_0x30e538[_0xffb3('0x67')]+'\x20');_0x4b44e6+=_0x30e538[_0xffb3('0x68')][_0x2c9077][_0xffb3('0x69')]?_0x43de3d(_0x30e538[_0xffb3('0x68')][_0x2c9077][_0xffb3('0x69')]):_0x30e538[_0xffb3('0x68')][_0x2c9077]['field']+'\x20'+_0x30e538[_0xffb3('0x68')][_0x2c9077]['condition']+(_0x28d09b(_0x30e538[_0xffb3('0x68')][_0x2c9077][_0xffb3('0x6a')])?'\x20'+_0x30e538['rules'][_0x2c9077][_0xffb3('0x6b')]:'');}return _0x4b44e6+')';};var _0x2ef730={'where':{'id':_0xe67e7e[_0xffb3('0x48')]['id']}},_0x553f64,_0x496f6c,_0x539eab,_0x18c735,_0x5d87da;_0x2ef730=_[_0xffb3('0x42')]({},_0x2ef730,_0xe67e7e[_0xffb3('0x44')]);return db['AnalyticDefaultReport'][_0xffb3('0x51')](_0x2ef730)[_0xffb3('0x25')](function(_0x239f4f){if(_0x239f4f){_0x553f64=_0x239f4f;return _0x239f4f[_0xffb3('0x6c')]();}return null;})[_0xffb3('0x25')](function(_0x507e21){if(_0x507e21){if(!_0x507e21[_0xffb3('0x49')]){throw new db[(_0xffb3('0x6d'))]['ValidationErrorItem'](_0xffb3('0x8c'),0x193);}_0x496f6c=_0x507e21;return db[_0xffb3('0xa2')][_0xffb3('0x45')]({'raw':!![]});}return null;})[_0xffb3('0x25')](function(_0x48e81d){if(_0x48e81d){_0x539eab=_['keyBy'](_0x48e81d,'id');var _0x32a04b;var _0x1a8d0e=squel['select']();_0x1a8d0e['from'](_0x553f64[_0xffb3('0x72')]);for(var _0x3087de=0x0;_0x3087de<_0x496f6c[_0xffb3('0x49')];_0x3087de+=0x1){_0x32a04b=_0x496f6c[_0x3087de][_0xffb3('0x73')]?_0x539eab[_0x496f6c[_0x3087de][_0xffb3('0x73')]][_0xffb3('0x74')]:_0x496f6c[_0x3087de][_0xffb3('0x75')];_0x32a04b=_0x496f6c[_0x3087de][_0xffb3('0x76')]?_[_0xffb3('0x77')](_0x56c1b6[_0x496f6c[_0x3087de]['function']],'%s',_0x32a04b):_0x32a04b;_0x32a04b=_0x496f6c[_0x3087de][_0xffb3('0x78')]?_[_0xffb3('0x77')](_0x4e4b1a[_0x496f6c[_0x3087de]['format']],'%s',_0x32a04b):_0x32a04b;if(_0x496f6c[_0x3087de][_0xffb3('0xa3')]){_0x1a8d0e[_0xffb3('0x69')](_0x32a04b);}_0x496f6c[_0x3087de]['orderBy']&&_0x1a8d0e[_0xffb3('0x3e')](_0x32a04b,_0x496f6c[_0x3087de]['orderBy']===_0xffb3('0x7a')?![]:!![]);_0x1a8d0e[_0xffb3('0x75')](_0x32a04b,_0x496f6c[_0x3087de][_0xffb3('0x7b')]||_0x32a04b);}if(_0x553f64[_0xffb3('0x7c')]){_0x553f64[_0xffb3('0x7c')]=JSON[_0xffb3('0x7d')](_0x553f64['joins']);for(var _0x1a10c5=0x0;_0x1a10c5<_0x553f64[_0xffb3('0x7c')][_0xffb3('0x49')];_0x1a10c5+=0x1){if(_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x32')]&&_['includes'](_0x4aab5b,_0x553f64[_0xffb3('0x7c')][_0x1a10c5]['type'])&&_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x7f')]&&_0x553f64[_0xffb3('0x7c')][_0x1a10c5]['foreignTable']&&_0x553f64[_0xffb3('0x7c')][_0x1a10c5]['foreignKey']){_0x1a8d0e[_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x32')]](_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x80')],null,util['format'](_0xffb3('0xa4'),_0x553f64['table'],_0x553f64['joins'][_0x1a10c5][_0xffb3('0x7f')],_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x80')],_0x553f64[_0xffb3('0x7c')][_0x1a10c5][_0xffb3('0x81')]));}}}if(_0x553f64[_0xffb3('0x82')]){_0x553f64['conditions']=JSON[_0xffb3('0x7d')](_0x553f64[_0xffb3('0x82')]);_0x1a8d0e[_0xffb3('0x40')](_0x43de3d(_0x553f64['conditions'][_0xffb3('0x69')]));}_0x5d87da=_0x1a8d0e['clone']();_0x1a8d0e[_0xffb3('0x3d')](_0xd90840);_0x1a8d0e['offset'](0x0);logger[_0xffb3('0x83')](_0xffb3('0xa5'),_0x1a8d0e['toString']());return dbH[_0xffb3('0x84')][_0xffb3('0x35')](_0x1a8d0e[_0xffb3('0x85')](),{'type':dbH[_0xffb3('0x84')][_0xffb3('0x86')][_0xffb3('0x87')]});}})[_0xffb3('0x25')](function(){return{'sql':_0x5d87da['toString']()};})[_0xffb3('0x25')](respondWithResult(_0x22fea7,null))[_0xffb3('0x46')](handleError(_0x22fea7,null));}; \ No newline at end of file +var _0x29e3=['endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','keyBy','alias','Limited\x20Query:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticDefaultReport','count','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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)','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','table','MetricId','metric','function','replace','format','groupBy','orderBy','joins','includes','foreignTable','parentKey','conditions','clone','debug','sequelize','toString','SELECT','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','value','select','from','DESC','parse','foreignKey','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate'];(function(_0x5bae51,_0x235d51){var _0x55af21=function(_0x4e96f3){while(--_0x4e96f3){_0x5bae51['push'](_0x5bae51['shift']());}};_0x55af21(++_0x235d51);}(_0x29e3,0xb8));var _0x329e=function(_0x35b8b1,_0x7a1e4b){_0x35b8b1=_0x35b8b1-0x0;var _0x33b02b=_0x29e3[_0x35b8b1];return _0x33b02b;};'use strict';var pdf=require(_0x329e('0x0'));var emlformat=require(_0x329e('0x1'));var rimraf=require(_0x329e('0x2'));var zipdir=require(_0x329e('0x3'));var jsonpatch=require(_0x329e('0x4'));var rp=require(_0x329e('0x5'));var moment=require(_0x329e('0x6'));var BPromise=require(_0x329e('0x7'));var Mustache=require('mustache');var util=require(_0x329e('0x8'));var path=require(_0x329e('0x9'));var sox=require(_0x329e('0xa'));var csv=require(_0x329e('0xb'));var ejs=require(_0x329e('0xc'));var fs=require('fs');var _=require(_0x329e('0xd'));var squel=require(_0x329e('0xe'));var crypto=require('crypto');var jsforce=require(_0x329e('0xf'));var deskjs=require(_0x329e('0x10'));var toCsv=require(_0x329e('0xb'));var querystring=require(_0x329e('0x11'));var Papa=require(_0x329e('0x12'));var Redis=require(_0x329e('0x13'));var authService=require(_0x329e('0x14'));var qs=require(_0x329e('0x15'));var as=require(_0x329e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x329e('0x17'))(_0x329e('0x18'));var utils=require(_0x329e('0x19'));var config=require(_0x329e('0x1a'));var licenseUtil=require(_0x329e('0x1b'));var db=require(_0x329e('0x1c'))['db'];var dbH=require(_0x329e('0x1c'))[_0x329e('0x1d')];function respondWithStatusCode(_0x1e8ec9,_0x482063){_0x482063=_0x482063||0xcc;return function(_0x421bc2){if(_0x421bc2){return _0x1e8ec9[_0x329e('0x1e')](_0x482063);}return _0x1e8ec9[_0x329e('0x1f')](_0x482063)['end']();};}function respondWithResult(_0x3f0487,_0x5b92fd){_0x5b92fd=_0x5b92fd||0xc8;return function(_0x36cfeb){if(_0x36cfeb){return _0x3f0487[_0x329e('0x1f')](_0x5b92fd)[_0x329e('0x20')](_0x36cfeb);}};}function respondWithFilteredResult(_0x578bae,_0x5406ff){return function(_0x49bf68){if(_0x49bf68){var _0x118e2a=_0x49bf68['count'],_0x4f2c5e=_0x5406ff[_0x329e('0x21')],_0x43d480=_0x5406ff['offset']+_0x5406ff[_0x329e('0x22')],_0x3d022f;if(_0x43d480>=_0x118e2a){_0x43d480=_0x118e2a;_0x3d022f=0xc8;}else{_0x3d022f=0xce;}_0x578bae[_0x329e('0x1f')](_0x3d022f);return _0x578bae[_0x329e('0x23')]('Content-Range',_0x4f2c5e+'-'+_0x43d480+'/'+_0x118e2a)[_0x329e('0x20')](_0x49bf68);}return null;};}function patchUpdates(_0x3b94d9){return function(_0x4281e9){try{jsonpatch[_0x329e('0x24')](_0x4281e9,_0x3b94d9,!![]);}catch(_0x52dba7){return BPromise[_0x329e('0x25')](_0x52dba7);}return _0x4281e9[_0x329e('0x26')]();};}function saveUpdates(_0x3fbf5,_0x5a8e96){return function(_0x43f433){if(_0x43f433){return _0x43f433[_0x329e('0x27')](_0x3fbf5)[_0x329e('0x28')](function(_0x441049){return _0x441049;});}return null;};}function removeEntity(_0x2c3c8d,_0x4b6da0){return function(_0x3d86aa){if(_0x3d86aa){return _0x3d86aa[_0x329e('0x29')]()['then'](function(){var _0x46e6ee=_0x3d86aa['get']({'plain':!![]});var _0x1ecca4='DefaultReports';return db[_0x329e('0x2a')][_0x329e('0x29')]({'where':{'type':_0x1ecca4,'resourceId':_0x46e6ee['id']}})[_0x329e('0x28')](function(){return _0x3d86aa;});})[_0x329e('0x28')](function(){_0x2c3c8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x531249,_0x4d3f70){return function(_0x5518b6){if(!_0x5518b6){_0x531249[_0x329e('0x1e')](0x194);}return _0x5518b6;};}function handleError(_0x2a86fc,_0x3811cc){_0x3811cc=_0x3811cc||0x1f4;return function(_0x84478c){logger[_0x329e('0x2b')](_0x84478c[_0x329e('0x2c')]);if(_0x84478c[_0x329e('0x2d')]){delete _0x84478c[_0x329e('0x2d')];}_0x2a86fc[_0x329e('0x1f')](_0x3811cc)[_0x329e('0x2e')](_0x84478c);};}exports[_0x329e('0x2f')]=function(_0xcdf55f,_0x295d24){var _0x540f4b={},_0x45ca60={},_0xe11deb={'count':0x0,'rows':[]};var _0x135a71=_[_0x329e('0x30')](db['AnalyticDefaultReport'][_0x329e('0x31')],function(_0x4555d6){return{'name':_0x4555d6[_0x329e('0x32')],'type':_0x4555d6[_0x329e('0x33')]['key']};});_0x45ca60['model']=_[_0x329e('0x30')](_0x135a71,_0x329e('0x2d'));_0x45ca60['query']=_[_0x329e('0x34')](_0xcdf55f[_0x329e('0x35')]);_0x45ca60[_0x329e('0x36')]=_['intersection'](_0x45ca60['model'],_0x45ca60[_0x329e('0x35')]);_0x540f4b[_0x329e('0x37')]=_['intersection'](_0x45ca60[_0x329e('0x38')],qs[_0x329e('0x39')](_0xcdf55f[_0x329e('0x35')][_0x329e('0x39')]));_0x540f4b[_0x329e('0x37')]=_0x540f4b[_0x329e('0x37')][_0x329e('0x3a')]?_0x540f4b['attributes']:_0x45ca60['model'];if(!_0xcdf55f['query'][_0x329e('0x3b')](_0x329e('0x3c'))){_0x540f4b[_0x329e('0x22')]=qs[_0x329e('0x22')](_0xcdf55f[_0x329e('0x35')]['limit']);_0x540f4b[_0x329e('0x21')]=qs[_0x329e('0x21')](_0xcdf55f['query'][_0x329e('0x21')]);}_0x540f4b[_0x329e('0x3d')]=qs['sort'](_0xcdf55f[_0x329e('0x35')][_0x329e('0x3e')]);_0x540f4b[_0x329e('0x3f')]=qs[_0x329e('0x36')](_[_0x329e('0x40')](_0xcdf55f[_0x329e('0x35')],_0x45ca60[_0x329e('0x36')]),_0x135a71);if(_0xcdf55f['query'][_0x329e('0x41')]){_0x540f4b[_0x329e('0x3f')]=_[_0x329e('0x42')](_0x540f4b[_0x329e('0x3f')],{'$or':_['map'](_0x135a71,function(_0x32b7ca){if(_0x32b7ca[_0x329e('0x33')]!==_0x329e('0x43')){var _0x2c0083={};_0x2c0083[_0x32b7ca[_0x329e('0x2d')]]={'$like':'%'+_0xcdf55f[_0x329e('0x35')]['filter']+'%'};return _0x2c0083;}})});}_0x540f4b=_['merge']({},_0x540f4b,_0xcdf55f['options']);var _0x3d25d6={'where':_0x540f4b['where']};return db[_0x329e('0x44')][_0x329e('0x45')](_0x3d25d6)[_0x329e('0x28')](function(_0x209eb2){_0xe11deb[_0x329e('0x45')]=_0x209eb2;if(_0xcdf55f['query'][_0x329e('0x46')]){_0x540f4b[_0x329e('0x47')]=[{'all':!![]}];}return db[_0x329e('0x44')][_0x329e('0x48')](_0x540f4b);})[_0x329e('0x28')](function(_0x2ef903){_0xe11deb[_0x329e('0x49')]=_0x2ef903;return _0xe11deb;})[_0x329e('0x28')](respondWithFilteredResult(_0x295d24,_0x540f4b))[_0x329e('0x4a')](handleError(_0x295d24,null));};exports[_0x329e('0x4b')]=function(_0x45f291,_0x23c9f7){var _0x586b5f={'raw':!![],'where':{'id':_0x45f291[_0x329e('0x4c')]['id']}},_0x1d4bb7={};_0x1d4bb7['model']=_[_0x329e('0x34')](db['AnalyticDefaultReport'][_0x329e('0x31')]);_0x1d4bb7['query']=_['keys'](_0x45f291[_0x329e('0x35')]);_0x1d4bb7[_0x329e('0x36')]=_[_0x329e('0x4d')](_0x1d4bb7[_0x329e('0x38')],_0x1d4bb7[_0x329e('0x35')]);_0x586b5f[_0x329e('0x37')]=_[_0x329e('0x4d')](_0x1d4bb7[_0x329e('0x38')],qs[_0x329e('0x39')](_0x45f291[_0x329e('0x35')][_0x329e('0x39')]));_0x586b5f['attributes']=_0x586b5f[_0x329e('0x37')][_0x329e('0x3a')]?_0x586b5f[_0x329e('0x37')]:_0x1d4bb7[_0x329e('0x38')];if(_0x45f291[_0x329e('0x35')][_0x329e('0x46')]){_0x586b5f[_0x329e('0x47')]=[{'all':!![]}];}_0x586b5f=_['merge']({},_0x586b5f,_0x45f291[_0x329e('0x4e')]);return db[_0x329e('0x44')][_0x329e('0x4f')](_0x586b5f)['then'](handleEntityNotFound(_0x23c9f7,null))[_0x329e('0x28')](respondWithResult(_0x23c9f7,null))[_0x329e('0x4a')](handleError(_0x23c9f7,null));};exports[_0x329e('0x50')]=function(_0x4d7f2b,_0x23b707){return db[_0x329e('0x44')][_0x329e('0x50')](_0x4d7f2b[_0x329e('0x51')],{})[_0x329e('0x28')](function(_0x2d9b47){var _0xea8c06=_0x4d7f2b[_0x329e('0x52')]['get']({'plain':!![]});if(!_0xea8c06)throw new Error(_0x329e('0x53'));if(_0xea8c06[_0x329e('0x54')]===_0x329e('0x52')){var _0x32e91d=_0x2d9b47['get']({'plain':!![]});var _0x1a7597=_0x329e('0x55');return db['UserProfileSection'][_0x329e('0x4f')]({'where':{'name':_0x1a7597,'userProfileId':_0xea8c06['userProfileId']},'raw':!![]})['then'](function(_0x3f6d5c){if(_0x3f6d5c&&_0x3f6d5c[_0x329e('0x56')]===0x0){return db[_0x329e('0x2a')][_0x329e('0x50')]({'name':_0x32e91d['name'],'resourceId':_0x32e91d['id'],'type':'DefaultReports','sectionId':_0x3f6d5c['id']},{})[_0x329e('0x28')](function(){return _0x2d9b47;});}else{return _0x2d9b47;}})['catch'](function(_0x4d85a0){logger[_0x329e('0x2b')](_0x329e('0x57'),_0x4d85a0);throw _0x4d85a0;});}return _0x2d9b47;})['then'](respondWithResult(_0x23b707,0xc9))[_0x329e('0x4a')](handleError(_0x23b707,null));};exports[_0x329e('0x27')]=function(_0x7307b4,_0x2c8050){if(_0x7307b4[_0x329e('0x51')]['id']){delete _0x7307b4[_0x329e('0x51')]['id'];}return db[_0x329e('0x44')][_0x329e('0x4f')]({'where':{'id':_0x7307b4[_0x329e('0x4c')]['id']}})[_0x329e('0x28')](handleEntityNotFound(_0x2c8050,null))[_0x329e('0x28')](saveUpdates(_0x7307b4[_0x329e('0x51')],null))['then'](respondWithResult(_0x2c8050,null))['catch'](handleError(_0x2c8050,null));};exports['destroy']=function(_0x5d44a5,_0xe5c031){return db[_0x329e('0x44')]['find']({'where':{'id':_0x5d44a5[_0x329e('0x4c')]['id']}})[_0x329e('0x28')](handleEntityNotFound(_0xe5c031,null))[_0x329e('0x28')](removeEntity(_0xe5c031,null))[_0x329e('0x4a')](handleError(_0xe5c031,null));};exports[_0x329e('0x58')]=function(_0x18b650,_0x5c8f2e){var _0x56889e=0xa;var _0x2a5f5f=[_0x329e('0x59'),_0x329e('0x5a'),_0x329e('0x5b'),_0x329e('0x5c')];var _0x41c581={'SUM':_0x329e('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x329e('0x5e'),'MAX':_0x329e('0x5f'),'MIN':_0x329e('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x329e('0x61'),'GROUP_CONCAT DESC':_0x329e('0x62')};var _0x1b4a78={'SEC_TO_TIME':_0x329e('0x63'),'DATE':_0x329e('0x64'),'HOUR':_0x329e('0x65'),'ROUND':_0x329e('0x66'),'UNIX_TIMESTAMP':_0x329e('0x67')};var _0x36dad8=function(_0xaf441d){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x329e('0x68')],_0xaf441d);};var _0x349dc4=function(_0x25795f){if(!_0x25795f||!_0x25795f[_0x329e('0x69')][_0x329e('0x3a')]){return'';}for(var _0x113b86='(',_0x9a8dc7=0x0;_0x9a8dc7<_0x25795f[_0x329e('0x69')][_0x329e('0x3a')];_0x9a8dc7+=0x1){_0x9a8dc7>0x0&&(_0x113b86+='\x20'+_0x25795f['operator']+'\x20');_0x113b86+=_0x25795f[_0x329e('0x69')][_0x9a8dc7][_0x329e('0x6a')]?_0x349dc4(_0x25795f['rules'][_0x9a8dc7][_0x329e('0x6a')]):_0x25795f[_0x329e('0x69')][_0x9a8dc7][_0x329e('0x6b')]+'\x20'+_0x25795f['rules'][_0x9a8dc7][_0x329e('0x6c')]+(_0x36dad8(_0x25795f[_0x329e('0x69')][_0x9a8dc7][_0x329e('0x6c')])?'\x20'+_0x25795f[_0x329e('0x69')][_0x9a8dc7]['value']:'');}return _0x113b86+')';};var _0x2f89bf={'where':{'id':_0x18b650['params']['id']}},_0x24b136,_0x2c4d42,_0x5b9213,_0x2b21f0,_0x4d554d;_0x2f89bf=_[_0x329e('0x42')]({},_0x2f89bf,_0x18b650[_0x329e('0x4e')]);return db[_0x329e('0x44')]['find'](_0x2f89bf)['then'](function(_0x45d397){if(_0x45d397){_0x24b136=_0x45d397;return _0x45d397[_0x329e('0x6d')]();}return null;})[_0x329e('0x28')](function(_0x203178){if(_0x203178){if(!_0x203178[_0x329e('0x3a')]){throw new db[(_0x329e('0x6e'))][(_0x329e('0x6f'))](_0x329e('0x70'),0x193);}_0x2c4d42=_0x203178;return db[_0x329e('0x71')][_0x329e('0x48')]({'raw':!![]});}return null;})[_0x329e('0x28')](function(_0x41f25d){if(_0x41f25d){_0x5b9213=_['keyBy'](_0x41f25d,'id');var _0x2f5de4;var _0x13be58=squel['select']();_0x13be58['from'](_0x24b136[_0x329e('0x72')]);for(var _0x33287a=0x0;_0x33287a<_0x2c4d42[_0x329e('0x3a')];_0x33287a+=0x1){_0x2f5de4=_0x2c4d42[_0x33287a][_0x329e('0x73')]?_0x5b9213[_0x2c4d42[_0x33287a][_0x329e('0x73')]][_0x329e('0x74')]:_0x2c4d42[_0x33287a][_0x329e('0x6b')];_0x2f5de4=_0x2c4d42[_0x33287a][_0x329e('0x75')]?_[_0x329e('0x76')](_0x41c581[_0x2c4d42[_0x33287a][_0x329e('0x75')]],'%s',_0x2f5de4):_0x2f5de4;_0x2f5de4=_0x2c4d42[_0x33287a][_0x329e('0x77')]?_[_0x329e('0x76')](_0x1b4a78[_0x2c4d42[_0x33287a][_0x329e('0x77')]],'%s',_0x2f5de4):_0x2f5de4;if(_0x2c4d42[_0x33287a][_0x329e('0x78')]){_0x13be58[_0x329e('0x6a')](_0x2f5de4);}_0x2c4d42[_0x33287a][_0x329e('0x79')]&&_0x13be58['order'](_0x2f5de4,_0x2c4d42[_0x33287a][_0x329e('0x79')]==='DESC'?![]:!![]);_0x13be58['field'](_0x2f5de4,_0x2c4d42[_0x33287a]['alias']||_0x2f5de4);}if(_0x24b136[_0x329e('0x7a')]){_0x24b136[_0x329e('0x7a')]=JSON['parse'](_0x24b136['joins']);for(var _0x2df869=0x0;_0x2df869<_0x24b136[_0x329e('0x7a')]['length'];_0x2df869+=0x1){if(_0x24b136[_0x329e('0x7a')][_0x2df869]['type']&&_[_0x329e('0x7b')](_0x2a5f5f,_0x24b136['joins'][_0x2df869]['type'])&&_0x24b136[_0x329e('0x7a')][_0x2df869]['parentKey']&&_0x24b136['joins'][_0x2df869][_0x329e('0x7c')]&&_0x24b136[_0x329e('0x7a')][_0x2df869]['foreignKey']){_0x13be58[_0x24b136['joins'][_0x2df869][_0x329e('0x33')]](_0x24b136['joins'][_0x2df869][_0x329e('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x24b136[_0x329e('0x72')],_0x24b136[_0x329e('0x7a')][_0x2df869][_0x329e('0x7d')],_0x24b136['joins'][_0x2df869]['foreignTable'],_0x24b136['joins'][_0x2df869]['foreignKey']));}}}if(_0x24b136['conditions']){_0x24b136[_0x329e('0x7e')]=JSON['parse'](_0x24b136[_0x329e('0x7e')]);_0x13be58[_0x329e('0x3f')](_0x349dc4(_0x24b136[_0x329e('0x7e')]['group']));}_0x4d554d=_0x13be58[_0x329e('0x7f')]();_0x13be58[_0x329e('0x22')](_0x56889e);_0x13be58[_0x329e('0x21')](0x0);logger[_0x329e('0x80')]('Limited\x20Query:',_0x13be58['toString']());return dbH[_0x329e('0x81')]['query'](_0x13be58[_0x329e('0x82')](),{'type':dbH[_0x329e('0x81')]['QueryTypes'][_0x329e('0x83')]});}})[_0x329e('0x28')](respondWithResult(_0x5c8f2e,null))['catch'](handleError(_0x5c8f2e,null));};function runReport(_0x368eeb,_0x4498f3,_0x2952a6){var _0x2f0fa6=_0x4498f3[_0x329e('0x2d')];var _0x3c950a=0xa;var _0x215cfb=[_0x329e('0x59'),_0x329e('0x5a'),'right_join',_0x329e('0x5c')];var _0x5525ce={'SUM':'SUM(%s)','COUNT':_0x329e('0x84'),'COUNT DISTINCT':_0x329e('0x5e'),'MAX':_0x329e('0x5f'),'MIN':_0x329e('0x60'),'AVG':_0x329e('0x85'),'GROUP_CONCAT':_0x329e('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x329e('0x62')};var _0xa31166={'SEC_TO_TIME':_0x329e('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x329e('0x66'),'UNIX_TIMESTAMP':_0x329e('0x67')};var _0x47a981=function(_0x537bf1){return!_[_0x329e('0x7b')]([_0x329e('0x87'),_0x329e('0x88'),_0x329e('0x89'),_0x329e('0x68')],_0x537bf1);};var _0x471f51=function(_0x17cff5){if(!_0x17cff5||!_0x17cff5[_0x329e('0x69')]['length']){return'';}for(var _0x3d488e='(',_0x15a8df=0x0;_0x15a8df<_0x17cff5[_0x329e('0x69')]['length'];_0x15a8df+=0x1){_0x15a8df>0x0&&(_0x3d488e+='\x20'+_0x17cff5[_0x329e('0x8a')]+'\x20');_0x3d488e+=_0x17cff5[_0x329e('0x69')][_0x15a8df][_0x329e('0x6a')]?_0x471f51(_0x17cff5[_0x329e('0x69')][_0x15a8df][_0x329e('0x6a')]):_0x17cff5[_0x329e('0x69')][_0x15a8df]['field']+'\x20'+_0x17cff5[_0x329e('0x69')][_0x15a8df][_0x329e('0x6c')]+(_0x47a981(_0x17cff5[_0x329e('0x69')][_0x15a8df][_0x329e('0x6c')])?'\x20'+_0x17cff5['rules'][_0x15a8df][_0x329e('0x8b')]:'');}return _0x3d488e+')';};var _0x218e05={'where':{'id':_0x368eeb['id']}},_0x2176da,_0x5608f2,_0x1e7c89,_0x4a87ab,_0x2a453f;_0x218e05=_['merge']({},_0x218e05,_0x2952a6);return db[_0x329e('0x44')][_0x329e('0x4f')](_0x218e05)[_0x329e('0x28')](function(_0x456924){if(_0x456924){_0x2176da=_0x456924;return _0x456924[_0x329e('0x6d')]();}return null;})[_0x329e('0x28')](function(_0x2858af){if(_0x2858af){if(!_0x2858af[_0x329e('0x3a')]){throw new db[(_0x329e('0x6e'))][(_0x329e('0x6f'))](_0x329e('0x70'),0x193);}_0x5608f2=_0x2858af;return db[_0x329e('0x71')][_0x329e('0x48')]({'raw':!![]});}return null;})['then'](function(_0xfba95b){if(_0xfba95b){_0x1e7c89=_['keyBy'](_0xfba95b,'id');var _0x18efe8;var _0x35e418=squel[_0x329e('0x8c')]();_0x35e418[_0x329e('0x8d')](_0x2176da[_0x329e('0x72')]);for(var _0x2db948=0x0;_0x2db948<_0x5608f2['length'];_0x2db948+=0x1){_0x18efe8=_0x5608f2[_0x2db948][_0x329e('0x73')]?_0x1e7c89[_0x5608f2[_0x2db948]['MetricId']]['metric']:_0x5608f2[_0x2db948]['field'];_0x18efe8=_0x5608f2[_0x2db948][_0x329e('0x75')]?_[_0x329e('0x76')](_0x5525ce[_0x5608f2[_0x2db948][_0x329e('0x75')]],'%s',_0x18efe8):_0x18efe8;_0x18efe8=_0x5608f2[_0x2db948]['format']?_[_0x329e('0x76')](_0xa31166[_0x5608f2[_0x2db948][_0x329e('0x77')]],'%s',_0x18efe8):_0x18efe8;if(_0x5608f2[_0x2db948][_0x329e('0x78')]){_0x35e418[_0x329e('0x6a')](_0x18efe8);}_0x5608f2[_0x2db948][_0x329e('0x79')]&&_0x35e418[_0x329e('0x3d')](_0x18efe8,_0x5608f2[_0x2db948][_0x329e('0x79')]===_0x329e('0x8e')?![]:!![]);_0x35e418[_0x329e('0x6b')](_0x18efe8,_0x5608f2[_0x2db948]['alias']||_0x18efe8);}if(_0x2176da[_0x329e('0x7a')]){_0x2176da['joins']=JSON[_0x329e('0x8f')](_0x2176da[_0x329e('0x7a')]);for(var _0x570100=0x0;_0x570100<_0x2176da[_0x329e('0x7a')][_0x329e('0x3a')];_0x570100+=0x1){if(_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x33')]&&_['includes'](_0x215cfb,_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x33')])&&_0x2176da['joins'][_0x570100][_0x329e('0x7d')]&&_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x7c')]&&_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x90')]){_0x35e418[_0x2176da[_0x329e('0x7a')][_0x570100]['type']](_0x2176da['joins'][_0x570100]['foreignTable'],null,util[_0x329e('0x77')](_0x329e('0x91'),_0x2176da[_0x329e('0x72')],_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x7d')],_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x7c')],_0x2176da[_0x329e('0x7a')][_0x570100][_0x329e('0x90')]));}}}if(_0x2176da[_0x329e('0x7e')]){_0x2176da['conditions']=JSON[_0x329e('0x8f')](_0x2176da[_0x329e('0x7e')]);_0x35e418[_0x329e('0x3f')](_0x471f51(_0x2176da['conditions']['group']));}_0x2a453f=_0x35e418[_0x329e('0x7f')]();_0x35e418['limit'](_0x3c950a);_0x35e418['offset'](0x0);return;}})[_0x329e('0x28')](function(){if(_0x4498f3[_0x329e('0x92')]===_0x329e('0x93')){return null;}var _0x44b3a6=_['merge'](_0x4498f3,{'name':_0x4498f3[_0x329e('0x94')]||_0x4498f3['name']||_0x2176da[_0x329e('0x2d')],'basename':_0x2f0fa6,'savename':util[_0x329e('0x77')](_0x329e('0x95'),_0x4498f3['name']||_0x2176da[_0x329e('0x2d')],require(_0x329e('0x96'))[_0x329e('0x97')](0x4),_0x4498f3[_0x329e('0x92')]||'csv'),'reportId':_0x2176da['id'],'reportType':_0x329e('0x98')});return db['AnalyticExtractedReport'][_0x329e('0x50')](_0x44b3a6,{'raw':!![]});})[_0x329e('0x28')](function(_0x6b5541){if(_0x2176da['table']===_0x329e('0x99')){_0x2a453f[_0x329e('0x3f')](_0x2176da['table']+_0x329e('0x9a'),_0x4498f3[_0x329e('0x9b')],_0x4498f3[_0x329e('0x9c')]);}else{_0x2a453f['where'](_0x2176da[_0x329e('0x72')]+_0x329e('0x9d'),_0x4498f3[_0x329e('0x9b')],_0x4498f3[_0x329e('0x9c')]);}if(_0x6b5541){logger[_0x329e('0x9e')]('Run\x20Query:',_0x2a453f[_0x329e('0x82')]());require('child_process')[_0x329e('0x9f')](path[_0x329e('0x59')](__dirname,_0x329e('0xa0'),_0x6b5541[_0x329e('0x92')]),[_0x6b5541['id'],_0x2a453f['toString'](),path[_0x329e('0x59')](__dirname,_0x329e('0xa1'),_0x6b5541[_0x329e('0xa2')]),_0x2f0fa6]);return _0x6b5541;}else{var _0x90786c=squel[_0x329e('0x8c')]();_0x90786c['from']('('+_0x2a453f['toString']()+')',_0x329e('0xa3'));_0x90786c[_0x329e('0x6b')](_0x329e('0xa4'),_0x329e('0x45'));_0x2a453f[_0x329e('0x22')](_0x4498f3[_0x329e('0x22')]||_0x3c950a);_0x2a453f['offset'](_0x4498f3['offset']||0x0);return dbH[_0x329e('0x81')][_0x329e('0x35')](_0x90786c[_0x329e('0x82')](),{'type':dbH[_0x329e('0x81')][_0x329e('0xa5')]['SELECT']})[_0x329e('0x28')](function(_0x120009){if(!_0x120009[_0x329e('0x3a')]){_0x4a87ab=0x0;}else{_0x4a87ab=_0x120009[0x0][_0x329e('0x45')]||0x0;}return dbH['sequelize']['query'](_0x2a453f['toString'](),{'type':dbH[_0x329e('0x81')][_0x329e('0xa5')][_0x329e('0x83')]});})[_0x329e('0x28')](function(_0x1d4199){return{'rows':_0x1d4199||[],'count':_0x4a87ab};});}});}exports[_0x329e('0xa6')]=function(_0x2cbc58,_0x1c654f){return runReport(_0x2cbc58[_0x329e('0x4c')],_0x2cbc58['query'],_0x2cbc58[_0x329e('0x4e')])['then'](respondWithResult(_0x1c654f,null))[_0x329e('0x4a')](handleError(_0x1c654f,null));};exports['runReport']=runReport;exports[_0x329e('0x35')]=function(_0xb7f618,_0x40978b){var _0x1d8ac1=0xa;var _0x440e65=['join',_0x329e('0x5a'),_0x329e('0x5b'),_0x329e('0x5c')];var _0x1a39f5={'SUM':_0x329e('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x329e('0x5e'),'MAX':'MAX(%s)','MIN':_0x329e('0x60'),'AVG':_0x329e('0x85'),'GROUP_CONCAT':_0x329e('0x86'),'GROUP_CONCAT ASC':_0x329e('0x61'),'GROUP_CONCAT DESC':_0x329e('0x62')};var _0x5bd91b={'SEC_TO_TIME':_0x329e('0x63'),'DATE':_0x329e('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x329e('0x66'),'UNIX_TIMESTAMP':_0x329e('0x67')};var _0x1d3549=function(_0x214bb1){return!_['includes']([_0x329e('0x87'),_0x329e('0x88'),_0x329e('0x89'),_0x329e('0x68')],_0x214bb1);};var _0x2e059c=function(_0x21ded5){if(!_0x21ded5||!_0x21ded5['rules'][_0x329e('0x3a')]){return'';}for(var _0x40c726='(',_0x1a2051=0x0;_0x1a2051<_0x21ded5[_0x329e('0x69')][_0x329e('0x3a')];_0x1a2051+=0x1){_0x1a2051>0x0&&(_0x40c726+='\x20'+_0x21ded5['operator']+'\x20');_0x40c726+=_0x21ded5['rules'][_0x1a2051][_0x329e('0x6a')]?_0x2e059c(_0x21ded5['rules'][_0x1a2051][_0x329e('0x6a')]):_0x21ded5[_0x329e('0x69')][_0x1a2051][_0x329e('0x6b')]+'\x20'+_0x21ded5['rules'][_0x1a2051][_0x329e('0x6c')]+(_0x1d3549(_0x21ded5[_0x329e('0x69')][_0x1a2051][_0x329e('0x6c')])?'\x20'+_0x21ded5['rules'][_0x1a2051]['value']:'');}return _0x40c726+')';};var _0x2d8290={'where':{'id':_0xb7f618[_0x329e('0x4c')]['id']}},_0x43701a,_0x1bb79a,_0x5f1cd,_0x4d50b9,_0x166b8a;_0x2d8290=_['merge']({},_0x2d8290,_0xb7f618[_0x329e('0x4e')]);return db[_0x329e('0x44')][_0x329e('0x4f')](_0x2d8290)[_0x329e('0x28')](function(_0x45fc3b){if(_0x45fc3b){_0x43701a=_0x45fc3b;return _0x45fc3b['getFields']();}return null;})[_0x329e('0x28')](function(_0x52ebf9){if(_0x52ebf9){if(!_0x52ebf9[_0x329e('0x3a')]){throw new db[(_0x329e('0x6e'))][(_0x329e('0x6f'))](_0x329e('0x70'),0x193);}_0x1bb79a=_0x52ebf9;return db[_0x329e('0x71')][_0x329e('0x48')]({'raw':!![]});}return null;})[_0x329e('0x28')](function(_0x64318){if(_0x64318){_0x5f1cd=_[_0x329e('0xa7')](_0x64318,'id');var _0x16fe48;var _0x4f26ea=squel[_0x329e('0x8c')]();_0x4f26ea[_0x329e('0x8d')](_0x43701a[_0x329e('0x72')]);for(var _0x50a7f7=0x0;_0x50a7f7<_0x1bb79a[_0x329e('0x3a')];_0x50a7f7+=0x1){_0x16fe48=_0x1bb79a[_0x50a7f7][_0x329e('0x73')]?_0x5f1cd[_0x1bb79a[_0x50a7f7][_0x329e('0x73')]][_0x329e('0x74')]:_0x1bb79a[_0x50a7f7]['field'];_0x16fe48=_0x1bb79a[_0x50a7f7]['function']?_[_0x329e('0x76')](_0x1a39f5[_0x1bb79a[_0x50a7f7][_0x329e('0x75')]],'%s',_0x16fe48):_0x16fe48;_0x16fe48=_0x1bb79a[_0x50a7f7][_0x329e('0x77')]?_[_0x329e('0x76')](_0x5bd91b[_0x1bb79a[_0x50a7f7]['format']],'%s',_0x16fe48):_0x16fe48;if(_0x1bb79a[_0x50a7f7][_0x329e('0x78')]){_0x4f26ea['group'](_0x16fe48);}_0x1bb79a[_0x50a7f7][_0x329e('0x79')]&&_0x4f26ea[_0x329e('0x3d')](_0x16fe48,_0x1bb79a[_0x50a7f7]['orderBy']===_0x329e('0x8e')?![]:!![]);_0x4f26ea['field'](_0x16fe48,_0x1bb79a[_0x50a7f7][_0x329e('0xa8')]||_0x16fe48);}if(_0x43701a[_0x329e('0x7a')]){_0x43701a[_0x329e('0x7a')]=JSON[_0x329e('0x8f')](_0x43701a[_0x329e('0x7a')]);for(var _0x42fb0b=0x0;_0x42fb0b<_0x43701a[_0x329e('0x7a')]['length'];_0x42fb0b+=0x1){if(_0x43701a['joins'][_0x42fb0b][_0x329e('0x33')]&&_[_0x329e('0x7b')](_0x440e65,_0x43701a[_0x329e('0x7a')][_0x42fb0b][_0x329e('0x33')])&&_0x43701a['joins'][_0x42fb0b]['parentKey']&&_0x43701a['joins'][_0x42fb0b][_0x329e('0x7c')]&&_0x43701a[_0x329e('0x7a')][_0x42fb0b][_0x329e('0x90')]){_0x4f26ea[_0x43701a['joins'][_0x42fb0b][_0x329e('0x33')]](_0x43701a[_0x329e('0x7a')][_0x42fb0b][_0x329e('0x7c')],null,util[_0x329e('0x77')](_0x329e('0x91'),_0x43701a[_0x329e('0x72')],_0x43701a[_0x329e('0x7a')][_0x42fb0b][_0x329e('0x7d')],_0x43701a[_0x329e('0x7a')][_0x42fb0b][_0x329e('0x7c')],_0x43701a[_0x329e('0x7a')][_0x42fb0b]['foreignKey']));}}}if(_0x43701a[_0x329e('0x7e')]){_0x43701a['conditions']=JSON[_0x329e('0x8f')](_0x43701a[_0x329e('0x7e')]);_0x4f26ea[_0x329e('0x3f')](_0x2e059c(_0x43701a[_0x329e('0x7e')][_0x329e('0x6a')]));}_0x166b8a=_0x4f26ea['clone']();_0x4f26ea['limit'](_0x1d8ac1);_0x4f26ea[_0x329e('0x21')](0x0);logger['debug'](_0x329e('0xa9'),_0x4f26ea[_0x329e('0x82')]());return dbH['sequelize'][_0x329e('0x35')](_0x4f26ea[_0x329e('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0x329e('0x83')]});}})['then'](function(){return{'sql':_0x166b8a[_0x329e('0x82')]()};})['then'](respondWithResult(_0x40978b,null))[_0x329e('0x4a')](handleError(_0x40978b,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8df7ea2..bdad92f 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 _0xa0aa=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','api','moment','bluebird'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xa0aa,0x19b));var _0xaa0a=function(_0x56b14e,_0x5d6d60){_0x56b14e=_0x56b14e-0x0;var _0x1167fe=_0xa0aa[_0x56b14e];return _0x1167fe;};'use strict';var _=require(_0xaa0a('0x0'));var util=require(_0xaa0a('0x1'));var logger=require('../../config/logger')(_0xaa0a('0x2'));var moment=require(_0xaa0a('0x3'));var BPromise=require(_0xaa0a('0x4'));var rp=require(_0xaa0a('0x5'));var fs=require('fs');var path=require(_0xaa0a('0x6'));var rimraf=require(_0xaa0a('0x7'));var config=require(_0xaa0a('0x8'));var attributes=require(_0xaa0a('0x9'));module[_0xaa0a('0xa')]=function(_0x2b6224,_0x1ff9b4){return _0x2b6224[_0xaa0a('0xb')](_0xaa0a('0xc'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccc=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','../../config/logger'];(function(_0x443fe6,_0xcc1e25){var _0x1dfbee=function(_0x4263a0){while(--_0x4263a0){_0x443fe6['push'](_0x443fe6['shift']());}};_0x1dfbee(++_0xcc1e25);}(_0x4ccc,0x137));var _0xc4cc=function(_0x494223,_0x2c1f71){_0x494223=_0x494223-0x0;var _0xdaf98=_0x4ccc[_0x494223];return _0xdaf98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc4cc('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc4cc('0x1'));var rp=require(_0xc4cc('0x2'));var fs=require('fs');var path=require(_0xc4cc('0x3'));var rimraf=require('rimraf');var config=require(_0xc4cc('0x4'));var attributes=require(_0xc4cc('0x5'));module[_0xc4cc('0x6')]=function(_0x492e3c,_0x3cd283){return _0x492e3c['define']('AnalyticDefaultReport',attributes,{'tableName':_0xc4cc('0x7'),'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 4abfffd..3137ef1 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xda3f,0xec));var _0xfda3=function(_0x1c183d,_0x4e0c25){_0x1c183d=_0x1c183d-0x0;var _0x29d602=_0xda3f[_0x1c183d];return _0x29d602;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xb458=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x208405,_0x20e6ce){var _0x14b94b=function(_0x50f5ad){while(--_0x50f5ad){_0x208405['push'](_0x208405['shift']());}};_0x14b94b(++_0x20e6ce);}(_0xb458,0xca));var _0x8b45=function(_0x3667c4,_0x4b64bd){_0x3667c4=_0x3667c4-0x0;var _0x12a5a2=_0xb458[_0x3667c4];return _0x12a5a2;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f5bda33..3d24a72 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 _0x1464=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1464,0x1a9));var _0x4146=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0x1464[_0xae9024];return _0x23e7d3;};'use strict';var multer=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var path=require(_0x4146('0x2'));var timeout=require(_0x4146('0x3'));var express=require(_0x4146('0x4'));var router=express[_0x4146('0x5')]();var auth=require(_0x4146('0x6'));var interaction=require(_0x4146('0x7'));var config=require(_0x4146('0x8'));var controller=require(_0x4146('0x9'));router[_0x4146('0xa')]('/',auth['isAuthenticated'](),controller[_0x4146('0xb')]);router[_0x4146('0xa')](_0x4146('0xc'),auth[_0x4146('0xd')](),controller[_0x4146('0xe')]);router[_0x4146('0xa')](_0x4146('0xf'),auth[_0x4146('0xd')](),controller[_0x4146('0x10')]);router[_0x4146('0xa')]('/:id/run',auth[_0x4146('0xd')](),controller[_0x4146('0x11')]);router[_0x4146('0xa')](_0x4146('0x12'),auth['isAuthenticated'](),controller[_0x4146('0x13')]);router[_0x4146('0x14')]('/',auth[_0x4146('0xd')](),controller[_0x4146('0x15')]);router[_0x4146('0x16')](_0x4146('0xc'),auth[_0x4146('0xd')](),controller[_0x4146('0x17')]);router[_0x4146('0x18')](_0x4146('0xc'),auth[_0x4146('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa787=['exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','/:id','update','delete','destroy'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0xa787,0x188));var _0x7a78=function(_0x42ae72,_0x4d37da){_0x42ae72=_0x42ae72-0x0;var _0x3c77b9=_0xa787[_0x42ae72];return _0x3c77b9;};'use strict';var multer=require(_0x7a78('0x0'));var util=require('util');var path=require(_0x7a78('0x1'));var timeout=require(_0x7a78('0x2'));var express=require(_0x7a78('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7a78('0x4'));var config=require(_0x7a78('0x5'));var controller=require(_0x7a78('0x6'));router[_0x7a78('0x7')]('/',auth[_0x7a78('0x8')](),controller[_0x7a78('0x9')]);router[_0x7a78('0x7')]('/:id',auth[_0x7a78('0x8')](),controller[_0x7a78('0xa')]);router['get'](_0x7a78('0xb'),auth[_0x7a78('0x8')](),controller[_0x7a78('0xc')]);router[_0x7a78('0x7')](_0x7a78('0xd'),auth[_0x7a78('0x8')](),controller[_0x7a78('0xe')]);router['get'](_0x7a78('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x7a78('0x10')]('/',auth[_0x7a78('0x8')](),controller[_0x7a78('0x11')]);router['put'](_0x7a78('0x12'),auth[_0x7a78('0x8')](),controller[_0x7a78('0x13')]);router[_0x7a78('0x14')](_0x7a78('0x12'),auth['isAuthenticated'](),controller[_0x7a78('0x15')]);module[_0x7a78('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 780744f..8d3c18d 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 _0x0101=['scheduled','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0xe9f19d,_0x102171){var _0x3beef9=function(_0x157f31){while(--_0x157f31){_0xe9f19d['push'](_0xe9f19d['shift']());}};_0x3beef9(++_0x102171);}(_0x0101,0xcd));var _0x1010=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0101[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1010('0x0'));var moment=require(_0x1010('0x1'));module[_0x1010('0x2')]={'name':{'type':Sequelize[_0x1010('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x1010('0x4')](_0x1010('0x5'),_0x1010('0x6'),_0x1010('0x7')),'allowNull':![],'defaultValue':_0x1010('0x5')},'savename':{'type':Sequelize[_0x1010('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1010('0x8')]},'endDate':{'type':Sequelize[_0x1010('0x8')]},'status':{'type':Sequelize[_0x1010('0x3')],'defaultValue':_0x1010('0x9')},'type':{'type':Sequelize[_0x1010('0x4')](_0x1010('0xa'),_0x1010('0xb')),'allowNull':![],'defaultValue':_0x1010('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1010('0x3')]}}; \ No newline at end of file +var _0xee0b=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','csv','STRING','DATE','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee0b,0x1d2));var _0xbee0=function(_0x508669,_0x47a1c8){_0x508669=_0x508669-0x0;var _0x155952=_0xee0b[_0x508669];return _0x155952;};'use strict';var Sequelize=require(_0xbee0('0x0'));var moment=require(_0xbee0('0x1'));module[_0xbee0('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0xbee0('0x3')},'savename':{'type':Sequelize[_0xbee0('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbee0('0x5')]},'endDate':{'type':Sequelize[_0xbee0('0x5')]},'status':{'type':Sequelize[_0xbee0('0x4')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xbee0('0x6')](_0xbee0('0x7'),_0xbee0('0x8')),'allowNull':![],'defaultValue':_0xbee0('0x7')},'reportId':{'type':Sequelize[_0xbee0('0x9')](0xb)[_0xbee0('0xa')]},'reportType':{'type':Sequelize[_0xbee0('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c77fab2..9657c67 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 _0x49c4=['options','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','output','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','end','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49c4,0x1eb));var _0x449c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x49c4[_0x279d37];return _0x530173;};'use strict';var pdf=require(_0x449c('0x0'));var emlformat=require(_0x449c('0x1'));var rimraf=require(_0x449c('0x2'));var zipdir=require(_0x449c('0x3'));var jsonpatch=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var moment=require(_0x449c('0x6'));var BPromise=require(_0x449c('0x7'));var Mustache=require('mustache');var util=require(_0x449c('0x8'));var path=require('path');var sox=require(_0x449c('0x9'));var csv=require(_0x449c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x449c('0xb'));var squel=require(_0x449c('0xc'));var crypto=require(_0x449c('0xd'));var jsforce=require(_0x449c('0xe'));var deskjs=require(_0x449c('0xf'));var toCsv=require(_0x449c('0xa'));var querystring=require(_0x449c('0x10'));var Papa=require('papaparse');var Redis=require(_0x449c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x449c('0x12'));var as=require(_0x449c('0x13'));var hardwareService=require(_0x449c('0x14'));var logger=require(_0x449c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x449c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x449c('0x17'))['db'];function respondWithStatusCode(_0x1bd5e6,_0x1e0071){_0x1e0071=_0x1e0071||0xcc;return function(_0x36c03b){if(_0x36c03b){return _0x1bd5e6[_0x449c('0x18')](_0x1e0071);}return _0x1bd5e6[_0x449c('0x19')](_0x1e0071)['end']();};}function respondWithResult(_0x2e07f1,_0x408731){_0x408731=_0x408731||0xc8;return function(_0x3c6495){if(_0x3c6495){return _0x2e07f1[_0x449c('0x19')](_0x408731)[_0x449c('0x1a')](_0x3c6495);}};}function respondWithFilteredResult(_0x166fa2,_0x5a125c){return function(_0x3558e8){if(_0x3558e8){var _0x587b9b=_0x3558e8[_0x449c('0x1b')],_0x119b3e=_0x5a125c[_0x449c('0x1c')],_0x5a6a8b=_0x5a125c['offset']+_0x5a125c['limit'],_0x1d124f;if(_0x5a6a8b>=_0x587b9b){_0x5a6a8b=_0x587b9b;_0x1d124f=0xc8;}else{_0x1d124f=0xce;}_0x166fa2[_0x449c('0x19')](_0x1d124f);return _0x166fa2[_0x449c('0x1d')](_0x449c('0x1e'),_0x119b3e+'-'+_0x5a6a8b+'/'+_0x587b9b)[_0x449c('0x1a')](_0x3558e8);}return null;};}function patchUpdates(_0x1cbd9f){return function(_0x278af7){try{jsonpatch[_0x449c('0x1f')](_0x278af7,_0x1cbd9f,!![]);}catch(_0x2226ce){return BPromise[_0x449c('0x20')](_0x2226ce);}return _0x278af7[_0x449c('0x21')]();};}function saveUpdates(_0x245de1,_0x359e94){return function(_0x56a2a5){if(_0x56a2a5){return _0x56a2a5[_0x449c('0x22')](_0x245de1)['then'](function(_0x4bf440){return _0x4bf440;});}return null;};}function removeEntity(_0x5848ee,_0x422f9e){return function(_0x48b7b6){if(_0x48b7b6){return _0x48b7b6[_0x449c('0x23')]()['then'](function(){var _0x2c5abb=_0x48b7b6[_0x449c('0x24')]({'plain':!![]});var _0x231773=_0x449c('0x25');return db[_0x449c('0x26')][_0x449c('0x23')]({'where':{'type':_0x231773,'resourceId':_0x2c5abb['id']}})[_0x449c('0x27')](function(){return _0x48b7b6;});})[_0x449c('0x27')](function(){_0x5848ee[_0x449c('0x19')](0xcc)[_0x449c('0x28')]();});}};}function handleEntityNotFound(_0x2f0f37,_0x290c77){return function(_0x16b7eb){if(!_0x16b7eb){_0x2f0f37[_0x449c('0x18')](0x194);}return _0x16b7eb;};}function handleError(_0x59f9b8,_0x54d63e){_0x54d63e=_0x54d63e||0x1f4;return function(_0x57429a){logger[_0x449c('0x29')](_0x57429a['stack']);if(_0x57429a['name']){delete _0x57429a[_0x449c('0x2a')];}_0x59f9b8['status'](_0x54d63e)[_0x449c('0x2b')](_0x57429a);};}exports[_0x449c('0x2c')]=function(_0x4eb2e1,_0x173659){var _0x42d342={},_0x443410={},_0x51063a={'count':0x0,'rows':[]};var _0x49484f=_[_0x449c('0x2d')](db[_0x449c('0x2e')][_0x449c('0x2f')],function(_0x1328ff){return{'name':_0x1328ff[_0x449c('0x30')],'type':_0x1328ff['type'][_0x449c('0x31')]};});_0x443410[_0x449c('0x32')]=_['map'](_0x49484f,_0x449c('0x2a'));_0x443410[_0x449c('0x33')]=_[_0x449c('0x34')](_0x4eb2e1['query']);_0x443410[_0x449c('0x35')]=_[_0x449c('0x36')](_0x443410['model'],_0x443410[_0x449c('0x33')]);_0x42d342[_0x449c('0x37')]=_[_0x449c('0x36')](_0x443410[_0x449c('0x32')],qs[_0x449c('0x38')](_0x4eb2e1[_0x449c('0x33')]['fields']));_0x42d342[_0x449c('0x37')]=_0x42d342[_0x449c('0x37')][_0x449c('0x39')]?_0x42d342[_0x449c('0x37')]:_0x443410['model'];if(!_0x4eb2e1[_0x449c('0x33')]['hasOwnProperty']('nolimit')){_0x42d342[_0x449c('0x3a')]=qs[_0x449c('0x3a')](_0x4eb2e1[_0x449c('0x33')][_0x449c('0x3a')]);_0x42d342[_0x449c('0x1c')]=qs[_0x449c('0x1c')](_0x4eb2e1[_0x449c('0x33')][_0x449c('0x1c')]);}_0x42d342[_0x449c('0x3b')]=qs[_0x449c('0x3c')](_0x4eb2e1[_0x449c('0x33')][_0x449c('0x3c')]);_0x42d342[_0x449c('0x3d')]=qs[_0x449c('0x35')](_[_0x449c('0x3e')](_0x4eb2e1['query'],_0x443410[_0x449c('0x35')]),_0x49484f);if(_0x4eb2e1[_0x449c('0x33')][_0x449c('0x3f')]){_0x42d342[_0x449c('0x3d')]=_[_0x449c('0x40')](_0x42d342[_0x449c('0x3d')],{'$or':_[_0x449c('0x2d')](_0x49484f,function(_0x1fa4e7){if(_0x1fa4e7[_0x449c('0x41')]!==_0x449c('0x42')){var _0x4be511={};_0x4be511[_0x1fa4e7[_0x449c('0x2a')]]={'$like':'%'+_0x4eb2e1[_0x449c('0x33')][_0x449c('0x3f')]+'%'};return _0x4be511;}})});}_0x42d342=_['merge']({},_0x42d342,_0x4eb2e1[_0x449c('0x43')]);var _0x2d0729={'where':_0x42d342[_0x449c('0x3d')]};return db[_0x449c('0x2e')]['count'](_0x2d0729)['then'](function(_0xd7bc4a){_0x51063a[_0x449c('0x1b')]=_0xd7bc4a;if(_0x4eb2e1[_0x449c('0x33')]['includeAll']){_0x42d342['include']=[{'all':!![]}];}return db[_0x449c('0x2e')]['findAll'](_0x42d342);})['then'](function(_0x3bcc5e){_0x51063a[_0x449c('0x44')]=_0x3bcc5e;return _0x51063a;})[_0x449c('0x27')](respondWithFilteredResult(_0x173659,_0x42d342))[_0x449c('0x45')](handleError(_0x173659,null));};exports['show']=function(_0x48efa3,_0x4792b8){var _0xbc089a={'raw':!![],'where':{'id':_0x48efa3[_0x449c('0x46')]['id']}},_0x55801b={};_0x55801b['model']=_[_0x449c('0x34')](db['AnalyticExtractedReport']['rawAttributes']);_0x55801b[_0x449c('0x33')]=_['keys'](_0x48efa3[_0x449c('0x33')]);_0x55801b[_0x449c('0x35')]=_[_0x449c('0x36')](_0x55801b[_0x449c('0x32')],_0x55801b[_0x449c('0x33')]);_0xbc089a['attributes']=_[_0x449c('0x36')](_0x55801b[_0x449c('0x32')],qs[_0x449c('0x38')](_0x48efa3[_0x449c('0x33')][_0x449c('0x38')]));_0xbc089a[_0x449c('0x37')]=_0xbc089a[_0x449c('0x37')][_0x449c('0x39')]?_0xbc089a[_0x449c('0x37')]:_0x55801b['model'];if(_0x48efa3[_0x449c('0x33')][_0x449c('0x47')]){_0xbc089a['include']=[{'all':!![]}];}_0xbc089a=_[_0x449c('0x40')]({},_0xbc089a,_0x48efa3['options']);return db['AnalyticExtractedReport']['find'](_0xbc089a)[_0x449c('0x27')](handleEntityNotFound(_0x4792b8,null))['then'](respondWithResult(_0x4792b8,null))[_0x449c('0x45')](handleError(_0x4792b8,null));};exports['create']=function(_0x3eae7c,_0x17fd68){return db['AnalyticExtractedReport'][_0x449c('0x48')](_0x3eae7c[_0x449c('0x49')],{})['then'](function(_0x39af39){var _0xa72ab3=_0x3eae7c[_0x449c('0x4a')]['get']({'plain':!![]});if(!_0xa72ab3)throw new Error(_0x449c('0x4b'));if(_0xa72ab3[_0x449c('0x4c')]==='user'){var _0x49790d=_0x39af39[_0x449c('0x24')]({'plain':!![]});var _0x69ba36=_0x449c('0x25');return db[_0x449c('0x4d')][_0x449c('0x4e')]({'where':{'name':_0x69ba36,'userProfileId':_0xa72ab3['userProfileId']},'raw':!![]})[_0x449c('0x27')](function(_0x1757d7){if(_0x1757d7&&_0x1757d7[_0x449c('0x4f')]===0x0){return db[_0x449c('0x26')][_0x449c('0x48')]({'name':_0x49790d[_0x449c('0x2a')],'resourceId':_0x49790d['id'],'type':_0x1757d7['name'],'sectionId':_0x1757d7['id']},{})['then'](function(){return _0x39af39;});}else{return _0x39af39;}})['catch'](function(_0x1dfd6a){logger[_0x449c('0x29')](_0x449c('0x50'),_0x1dfd6a);throw _0x1dfd6a;});}return _0x39af39;})[_0x449c('0x27')](respondWithResult(_0x17fd68,0xc9))[_0x449c('0x45')](handleError(_0x17fd68,null));};exports[_0x449c('0x22')]=function(_0x473176,_0x56df83){if(_0x473176[_0x449c('0x49')]['id']){delete _0x473176['body']['id'];}return db[_0x449c('0x2e')][_0x449c('0x4e')]({'where':{'id':_0x473176[_0x449c('0x46')]['id']}})[_0x449c('0x27')](handleEntityNotFound(_0x56df83,null))['then'](saveUpdates(_0x473176[_0x449c('0x49')],null))[_0x449c('0x27')](respondWithResult(_0x56df83,null))[_0x449c('0x45')](handleError(_0x56df83,null));};exports[_0x449c('0x23')]=function(_0x51b4bc,_0x467a24){return db[_0x449c('0x2e')][_0x449c('0x4e')]({'where':{'id':_0x51b4bc[_0x449c('0x46')]['id']}})[_0x449c('0x27')](handleEntityNotFound(_0x467a24,null))[_0x449c('0x27')](removeEntity(_0x467a24,null))[_0x449c('0x45')](handleError(_0x467a24,null));};exports[_0x449c('0x51')]=function(_0x5e99c1,_0x2c0d5a,_0x98173f){return db[_0x449c('0x2e')][_0x449c('0x4e')]({'where':{'id':_0x5e99c1[_0x449c('0x46')]['id']},'attributes':[_0x449c('0x2a'),_0x449c('0x52'),_0x449c('0x53'),'output'],'raw':!![]})[_0x449c('0x27')](handleEntityNotFound(_0x2c0d5a,null))[_0x449c('0x27')](function(_0x3eb6f9){if(_0x3eb6f9){if(!fs[_0x449c('0x54')](path[_0x449c('0x55')](config['root'],_0x449c('0x56'),_0x3eb6f9[_0x449c('0x53')]))){throw new db[(_0x449c('0x57'))]['ValidationError'](_0x449c('0x58'));}if(_0x5e99c1['query']['exists']){return _0x2c0d5a[_0x449c('0x18')](0xc8);}return _0x2c0d5a[_0x449c('0x51')](path[_0x449c('0x55')](config[_0x449c('0x59')],_0x449c('0x56'),_0x3eb6f9[_0x449c('0x53')]),util[_0x449c('0x5a')](_0x449c('0x5b'),_0x3eb6f9[_0x449c('0x52')]||_0x3eb6f9[_0x449c('0x2a')],_0x3eb6f9[_0x449c('0x5c')]['toLowerCase']()));}})[_0x449c('0x45')](handleError(_0x2c0d5a,null));}; \ No newline at end of file +var _0x627c=['ExtractedReports','UserProfileResource','end','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','params','basename','savename','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','rimraf','fast-json-patch','moment','bluebird','mustache','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','get'];(function(_0x556367,_0x1b6c3b){var _0x9ac4f0=function(_0x26e250){while(--_0x26e250){_0x556367['push'](_0x556367['shift']());}};_0x9ac4f0(++_0x1b6c3b);}(_0x627c,0x1d6));var _0xc627=function(_0x30cbf1,_0x42ff23){_0x30cbf1=_0x30cbf1-0x0;var _0x1a05aa=_0x627c[_0x30cbf1];return _0x1a05aa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc627('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc627('0x1'));var rp=require('request-promise');var moment=require(_0xc627('0x2'));var BPromise=require(_0xc627('0x3'));var Mustache=require(_0xc627('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc627('0x5'));var jsforce=require(_0xc627('0x6'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc627('0x7'));var Papa=require(_0xc627('0x8'));var Redis=require(_0xc627('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc627('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc627('0xb'))('api');var utils=require(_0xc627('0xc'));var config=require(_0xc627('0xd'));var licenseUtil=require(_0xc627('0xe'));var db=require(_0xc627('0xf'))['db'];function respondWithStatusCode(_0x1f463e,_0x3c2e39){_0x3c2e39=_0x3c2e39||0xcc;return function(_0x41a637){if(_0x41a637){return _0x1f463e[_0xc627('0x10')](_0x3c2e39);}return _0x1f463e[_0xc627('0x11')](_0x3c2e39)['end']();};}function respondWithResult(_0x4ea0d5,_0x570442){_0x570442=_0x570442||0xc8;return function(_0x5a2f83){if(_0x5a2f83){return _0x4ea0d5[_0xc627('0x11')](_0x570442)[_0xc627('0x12')](_0x5a2f83);}};}function respondWithFilteredResult(_0x14d0dc,_0x3d5fa2){return function(_0x1f6c3a){if(_0x1f6c3a){var _0x1c6683=_0x1f6c3a[_0xc627('0x13')],_0x415bc7=_0x3d5fa2[_0xc627('0x14')],_0x5a4159=_0x3d5fa2['offset']+_0x3d5fa2[_0xc627('0x15')],_0x578042;if(_0x5a4159>=_0x1c6683){_0x5a4159=_0x1c6683;_0x578042=0xc8;}else{_0x578042=0xce;}_0x14d0dc[_0xc627('0x11')](_0x578042);return _0x14d0dc['set'](_0xc627('0x16'),_0x415bc7+'-'+_0x5a4159+'/'+_0x1c6683)[_0xc627('0x12')](_0x1f6c3a);}return null;};}function patchUpdates(_0xd3ae19){return function(_0x52d860){try{jsonpatch[_0xc627('0x17')](_0x52d860,_0xd3ae19,!![]);}catch(_0x323167){return BPromise[_0xc627('0x18')](_0x323167);}return _0x52d860['save']();};}function saveUpdates(_0x33aac8,_0x2b233d){return function(_0x47d123){if(_0x47d123){return _0x47d123['update'](_0x33aac8)[_0xc627('0x19')](function(_0x12fbc6){return _0x12fbc6;});}return null;};}function removeEntity(_0x13e32a,_0x236e48){return function(_0x1ccd7e){if(_0x1ccd7e){return _0x1ccd7e[_0xc627('0x1a')]()[_0xc627('0x19')](function(){var _0x333a1=_0x1ccd7e[_0xc627('0x1b')]({'plain':!![]});var _0x766653=_0xc627('0x1c');return db[_0xc627('0x1d')]['destroy']({'where':{'type':_0x766653,'resourceId':_0x333a1['id']}})['then'](function(){return _0x1ccd7e;});})['then'](function(){_0x13e32a[_0xc627('0x11')](0xcc)[_0xc627('0x1e')]();});}};}function handleEntityNotFound(_0x22637c,_0x36a7ac){return function(_0x3fb56c){if(!_0x3fb56c){_0x22637c[_0xc627('0x10')](0x194);}return _0x3fb56c;};}function handleError(_0x296241,_0x12aef4){_0x12aef4=_0x12aef4||0x1f4;return function(_0x502983){logger[_0xc627('0x1f')](_0x502983['stack']);if(_0x502983[_0xc627('0x20')]){delete _0x502983[_0xc627('0x20')];}_0x296241[_0xc627('0x11')](_0x12aef4)[_0xc627('0x21')](_0x502983);};}exports[_0xc627('0x22')]=function(_0x21c0af,_0x124e61){var _0x39ba7e={},_0x136cc2={},_0x1f8a5c={'count':0x0,'rows':[]};var _0x4b875a=_[_0xc627('0x23')](db[_0xc627('0x24')][_0xc627('0x25')],function(_0x2755a6){return{'name':_0x2755a6[_0xc627('0x26')],'type':_0x2755a6['type'][_0xc627('0x27')]};});_0x136cc2[_0xc627('0x28')]=_[_0xc627('0x23')](_0x4b875a,_0xc627('0x20'));_0x136cc2[_0xc627('0x29')]=_[_0xc627('0x2a')](_0x21c0af[_0xc627('0x29')]);_0x136cc2['filters']=_[_0xc627('0x2b')](_0x136cc2[_0xc627('0x28')],_0x136cc2[_0xc627('0x29')]);_0x39ba7e[_0xc627('0x2c')]=_[_0xc627('0x2b')](_0x136cc2[_0xc627('0x28')],qs[_0xc627('0x2d')](_0x21c0af[_0xc627('0x29')][_0xc627('0x2d')]));_0x39ba7e[_0xc627('0x2c')]=_0x39ba7e['attributes'][_0xc627('0x2e')]?_0x39ba7e[_0xc627('0x2c')]:_0x136cc2[_0xc627('0x28')];if(!_0x21c0af[_0xc627('0x29')][_0xc627('0x2f')]('nolimit')){_0x39ba7e[_0xc627('0x15')]=qs[_0xc627('0x15')](_0x21c0af[_0xc627('0x29')][_0xc627('0x15')]);_0x39ba7e['offset']=qs[_0xc627('0x14')](_0x21c0af[_0xc627('0x29')][_0xc627('0x14')]);}_0x39ba7e[_0xc627('0x30')]=qs['sort'](_0x21c0af[_0xc627('0x29')][_0xc627('0x31')]);_0x39ba7e[_0xc627('0x32')]=qs[_0xc627('0x33')](_[_0xc627('0x34')](_0x21c0af['query'],_0x136cc2[_0xc627('0x33')]),_0x4b875a);if(_0x21c0af['query'][_0xc627('0x35')]){_0x39ba7e[_0xc627('0x32')]=_['merge'](_0x39ba7e[_0xc627('0x32')],{'$or':_[_0xc627('0x23')](_0x4b875a,function(_0x6970b4){if(_0x6970b4['type']!=='VIRTUAL'){var _0x15bcaa={};_0x15bcaa[_0x6970b4['name']]={'$like':'%'+_0x21c0af[_0xc627('0x29')][_0xc627('0x35')]+'%'};return _0x15bcaa;}})});}_0x39ba7e=_['merge']({},_0x39ba7e,_0x21c0af['options']);var _0x5e16e0={'where':_0x39ba7e[_0xc627('0x32')]};return db[_0xc627('0x24')][_0xc627('0x13')](_0x5e16e0)['then'](function(_0x1d724c){_0x1f8a5c[_0xc627('0x13')]=_0x1d724c;if(_0x21c0af['query'][_0xc627('0x36')]){_0x39ba7e[_0xc627('0x37')]=[{'all':!![]}];}return db[_0xc627('0x24')][_0xc627('0x38')](_0x39ba7e);})[_0xc627('0x19')](function(_0x3c677f){_0x1f8a5c[_0xc627('0x39')]=_0x3c677f;return _0x1f8a5c;})[_0xc627('0x19')](respondWithFilteredResult(_0x124e61,_0x39ba7e))['catch'](handleError(_0x124e61,null));};exports['show']=function(_0x529a37,_0x56c27b){var _0x5c0307={'raw':!![],'where':{'id':_0x529a37['params']['id']}},_0x479d85={};_0x479d85[_0xc627('0x28')]=_['keys'](db['AnalyticExtractedReport'][_0xc627('0x25')]);_0x479d85[_0xc627('0x29')]=_[_0xc627('0x2a')](_0x529a37[_0xc627('0x29')]);_0x479d85['filters']=_[_0xc627('0x2b')](_0x479d85['model'],_0x479d85[_0xc627('0x29')]);_0x5c0307[_0xc627('0x2c')]=_[_0xc627('0x2b')](_0x479d85[_0xc627('0x28')],qs[_0xc627('0x2d')](_0x529a37['query'][_0xc627('0x2d')]));_0x5c0307[_0xc627('0x2c')]=_0x5c0307[_0xc627('0x2c')]['length']?_0x5c0307['attributes']:_0x479d85[_0xc627('0x28')];if(_0x529a37[_0xc627('0x29')][_0xc627('0x36')]){_0x5c0307[_0xc627('0x37')]=[{'all':!![]}];}_0x5c0307=_['merge']({},_0x5c0307,_0x529a37[_0xc627('0x3a')]);return db[_0xc627('0x24')][_0xc627('0x3b')](_0x5c0307)[_0xc627('0x19')](handleEntityNotFound(_0x56c27b,null))['then'](respondWithResult(_0x56c27b,null))[_0xc627('0x3c')](handleError(_0x56c27b,null));};exports[_0xc627('0x3d')]=function(_0x3202db,_0x7c701c){return db[_0xc627('0x24')][_0xc627('0x3d')](_0x3202db[_0xc627('0x3e')],{})[_0xc627('0x19')](function(_0x40b7fd){var _0x347b8f=_0x3202db['user'][_0xc627('0x1b')]({'plain':!![]});if(!_0x347b8f)throw new Error(_0xc627('0x3f'));if(_0x347b8f[_0xc627('0x40')]===_0xc627('0x41')){var _0x441bfe=_0x40b7fd[_0xc627('0x1b')]({'plain':!![]});var _0x426b01=_0xc627('0x1c');return db[_0xc627('0x42')][_0xc627('0x3b')]({'where':{'name':_0x426b01,'userProfileId':_0x347b8f[_0xc627('0x43')]},'raw':!![]})['then'](function(_0x20fcc7){if(_0x20fcc7&&_0x20fcc7[_0xc627('0x44')]===0x0){return db[_0xc627('0x1d')][_0xc627('0x3d')]({'name':_0x441bfe[_0xc627('0x20')],'resourceId':_0x441bfe['id'],'type':_0x20fcc7[_0xc627('0x20')],'sectionId':_0x20fcc7['id']},{})[_0xc627('0x19')](function(){return _0x40b7fd;});}else{return _0x40b7fd;}})[_0xc627('0x3c')](function(_0x5c17d3){logger[_0xc627('0x1f')](_0xc627('0x45'),_0x5c17d3);throw _0x5c17d3;});}return _0x40b7fd;})[_0xc627('0x19')](respondWithResult(_0x7c701c,0xc9))[_0xc627('0x3c')](handleError(_0x7c701c,null));};exports[_0xc627('0x46')]=function(_0x5e7f2c,_0xe22d0c){if(_0x5e7f2c[_0xc627('0x3e')]['id']){delete _0x5e7f2c[_0xc627('0x3e')]['id'];}return db[_0xc627('0x24')][_0xc627('0x3b')]({'where':{'id':_0x5e7f2c['params']['id']}})[_0xc627('0x19')](handleEntityNotFound(_0xe22d0c,null))[_0xc627('0x19')](saveUpdates(_0x5e7f2c[_0xc627('0x3e')],null))[_0xc627('0x19')](respondWithResult(_0xe22d0c,null))[_0xc627('0x3c')](handleError(_0xe22d0c,null));};exports[_0xc627('0x1a')]=function(_0x512cb2,_0x196936){return db[_0xc627('0x24')]['find']({'where':{'id':_0x512cb2['params']['id']}})['then'](handleEntityNotFound(_0x196936,null))['then'](removeEntity(_0x196936,null))['catch'](handleError(_0x196936,null));};exports[_0xc627('0x47')]=function(_0x508cc0,_0x594d83,_0xf3f631){return db[_0xc627('0x24')][_0xc627('0x3b')]({'where':{'id':_0x508cc0[_0xc627('0x48')]['id']},'attributes':[_0xc627('0x20'),_0xc627('0x49'),_0xc627('0x4a'),'output'],'raw':!![]})[_0xc627('0x19')](handleEntityNotFound(_0x594d83,null))['then'](function(_0x179dfe){if(_0x179dfe){if(!fs[_0xc627('0x4b')](path[_0xc627('0x4c')](config[_0xc627('0x4d')],_0xc627('0x4e'),_0x179dfe[_0xc627('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0xc627('0x4f'));}if(_0x508cc0[_0xc627('0x29')][_0xc627('0x50')]){return _0x594d83[_0xc627('0x10')](0xc8);}return _0x594d83[_0xc627('0x47')](path[_0xc627('0x4c')](config[_0xc627('0x4d')],'server/files/reports',_0x179dfe[_0xc627('0x4a')]),util[_0xc627('0x51')](_0xc627('0x52'),_0x179dfe[_0xc627('0x49')]||_0x179dfe['name'],_0x179dfe['output']['toLowerCase']()));}})['catch'](handleError(_0x594d83,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 337f30d..ea25335 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 _0x9abe=['moment','request-promise','path','../../config/environment','exports','define','AnalyticExtractedReport','lodash','util'];(function(_0x40a2f4,_0x2833fe){var _0x33eab2=function(_0x52be22){while(--_0x52be22){_0x40a2f4['push'](_0x40a2f4['shift']());}};_0x33eab2(++_0x2833fe);}(_0x9abe,0xe8));var _0xe9ab=function(_0x594986,_0x247d41){_0x594986=_0x594986-0x0;var _0x2c6d45=_0x9abe[_0x594986];return _0x2c6d45;};'use strict';var _=require(_0xe9ab('0x0'));var util=require(_0xe9ab('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ab('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ab('0x3'));var fs=require('fs');var path=require(_0xe9ab('0x4'));var rimraf=require('rimraf');var config=require(_0xe9ab('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xe9ab('0x6')]=function(_0x7bf25b,_0x341f5c){return _0x7bf25b[_0xe9ab('0x7')](_0xe9ab('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd2=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4c7732,_0x2a199a){var _0x5968fe=function(_0x15fd41){while(--_0x15fd41){_0x4c7732['push'](_0x4c7732['shift']());}};_0x5968fe(++_0x2a199a);}(_0x9fd2,0x147));var _0x29fd=function(_0x32c16a,_0x18b628){_0x32c16a=_0x32c16a-0x0;var _0x16627f=_0x9fd2[_0x32c16a];return _0x16627f;};'use strict';var _=require(_0x29fd('0x0'));var util=require(_0x29fd('0x1'));var logger=require(_0x29fd('0x2'))(_0x29fd('0x3'));var moment=require(_0x29fd('0x4'));var BPromise=require(_0x29fd('0x5'));var rp=require(_0x29fd('0x6'));var fs=require('fs');var path=require(_0x29fd('0x7'));var rimraf=require('rimraf');var config=require(_0x29fd('0x8'));var attributes=require(_0x29fd('0x9'));module[_0x29fd('0xa')]=function(_0x1f83f8,_0x23de45){return _0x1f83f8[_0x29fd('0xb')](_0x29fd('0xc'),attributes,{'tableName':_0x29fd('0xd'),'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 13f27cc..46a325b 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 _0x682f=['client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x511598,_0x50cf30){var _0x505848=function(_0x255e0f){while(--_0x255e0f){_0x511598['push'](_0x511598['shift']());}};_0x505848(++_0x50cf30);}(_0x682f,0x91));var _0xf682=function(_0x235e42,_0x21fbdd){_0x235e42=_0x235e42-0x0;var _0x4eefc6=_0x682f[_0x235e42];return _0x4eefc6;};'use strict';var _=require(_0xf682('0x0'));var util=require('util');var moment=require(_0xf682('0x1'));var BPromise=require(_0xf682('0x2'));var rs=require(_0xf682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf682('0x4'))['db'];var utils=require(_0xf682('0x5'));var logger=require(_0xf682('0x6'))(_0xf682('0x7'));var config=require('../../config/environment');var jayson=require(_0xf682('0x8'));var client=jayson[_0xf682('0x9')][_0xf682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c2c87,_0x1629b1,_0x19dec5){return new BPromise(function(_0x1054f3,_0x538d2c){return client[_0xf682('0xb')](_0x1c2c87,_0x19dec5)[_0xf682('0xc')](function(_0x4c4be4){logger[_0xf682('0xd')](_0xf682('0xe'),_0x1629b1,_0xf682('0xf'));logger['debug'](_0xf682('0x10'),_0x1629b1,_0xf682('0xf'),JSON[_0xf682('0x11')](_0x4c4be4));if(_0x4c4be4[_0xf682('0x12')]){if(_0x4c4be4[_0xf682('0x12')][_0xf682('0x13')]===0x1f4){logger[_0xf682('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1629b1,_0x4c4be4[_0xf682('0x12')][_0xf682('0x14')]);return _0x538d2c(_0x4c4be4[_0xf682('0x12')]['message']);}logger[_0xf682('0x12')](_0xf682('0xe'),_0x1629b1,_0x4c4be4[_0xf682('0x12')][_0xf682('0x14')]);return _0x1054f3(_0x4c4be4[_0xf682('0x12')][_0xf682('0x14')]);}else{logger[_0xf682('0xd')](_0xf682('0xe'),_0x1629b1,'request\x20sent');_0x1054f3(_0x4c4be4[_0xf682('0x15')][_0xf682('0x14')]);}})['catch'](function(_0x14fbf2){logger[_0xf682('0x12')](_0xf682('0xe'),_0x1629b1,_0x14fbf2);_0x538d2c(_0x14fbf2);});});} \ No newline at end of file +var _0x0180=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent','debug'];(function(_0x59d414,_0x1176c2){var _0x3dbc45=function(_0x42d6cb){while(--_0x42d6cb){_0x59d414['push'](_0x59d414['shift']());}};_0x3dbc45(++_0x1176c2);}(_0x0180,0x16f));var _0x0018=function(_0x365eb5,_0x435ba8){_0x365eb5=_0x365eb5-0x0;var _0x5c13a4=_0x0180[_0x365eb5];return _0x5c13a4;};'use strict';var _=require(_0x0018('0x0'));var util=require(_0x0018('0x1'));var moment=require(_0x0018('0x2'));var BPromise=require(_0x0018('0x3'));var rs=require(_0x0018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0018('0x5'))['db'];var utils=require(_0x0018('0x6'));var logger=require(_0x0018('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0018('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6e7f,_0x519628,_0x113479){return new BPromise(function(_0x3499c7,_0x50395d){return client['request'](_0x3f6e7f,_0x113479)[_0x0018('0x9')](function(_0x559d7e){logger[_0x0018('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x519628,_0x0018('0xb'));logger[_0x0018('0xc')](_0x0018('0xd'),_0x519628,_0x0018('0xb'),JSON[_0x0018('0xe')](_0x559d7e));if(_0x559d7e['error']){if(_0x559d7e[_0x0018('0xf')]['code']===0x1f4){logger[_0x0018('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x519628,_0x559d7e['error'][_0x0018('0x10')]);return _0x50395d(_0x559d7e[_0x0018('0xf')][_0x0018('0x10')]);}logger[_0x0018('0xf')](_0x0018('0x11'),_0x519628,_0x559d7e[_0x0018('0xf')][_0x0018('0x10')]);return _0x3499c7(_0x559d7e[_0x0018('0xf')][_0x0018('0x10')]);}else{logger['info'](_0x0018('0x11'),_0x519628,_0x0018('0xb'));_0x3499c7(_0x559d7e[_0x0018('0x12')][_0x0018('0x10')]);}})[_0x0018('0x13')](function(_0x1c05b7){logger[_0x0018('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x519628,_0x1c05b7);_0x50395d(_0x1c05b7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 541a6ff..3f90c62 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 _0xffea=['isAuthenticated','show','/:id/download','download','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x40d2cf,_0x507326){var _0x344bf5=function(_0x2c5edb){while(--_0x2c5edb){_0x40d2cf['push'](_0x40d2cf['shift']());}};_0x344bf5(++_0x507326);}(_0xffea,0x199));var _0xaffe=function(_0x7fac86,_0xb3798b){_0x7fac86=_0x7fac86-0x0;var _0x5d588e=_0xffea[_0x7fac86];return _0x5d588e;};'use strict';var multer=require(_0xaffe('0x0'));var util=require(_0xaffe('0x1'));var path=require(_0xaffe('0x2'));var timeout=require(_0xaffe('0x3'));var express=require(_0xaffe('0x4'));var router=express[_0xaffe('0x5')]();var auth=require(_0xaffe('0x6'));var interaction=require(_0xaffe('0x7'));var config=require(_0xaffe('0x8'));var controller=require(_0xaffe('0x9'));router[_0xaffe('0xa')]('/',auth[_0xaffe('0xb')](),controller['index']);router[_0xaffe('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaffe('0xc')]);router['get'](_0xaffe('0xd'),auth[_0xaffe('0xb')](),controller[_0xaffe('0xe')]);router['post']('/',auth[_0xaffe('0xb')](),controller['create']);router[_0xaffe('0xf')]('/:id',auth[_0xaffe('0xb')](),controller[_0xaffe('0x10')]);router[_0xaffe('0x11')](_0xaffe('0x12'),auth[_0xaffe('0xb')](),controller[_0xaffe('0x13')]);module[_0xaffe('0x14')]=router; \ No newline at end of file +var _0x4be5=['/:id/download','download','post','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show'];(function(_0x39bc6c,_0x2bb88c){var _0x593e27=function(_0x419dba){while(--_0x419dba){_0x39bc6c['push'](_0x39bc6c['shift']());}};_0x593e27(++_0x2bb88c);}(_0x4be5,0xc1));var _0x54be=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x4be5[_0x532112];return _0x23e5fb;};'use strict';var multer=require(_0x54be('0x0'));var util=require(_0x54be('0x1'));var path=require('path');var timeout=require(_0x54be('0x2'));var express=require('express');var router=express[_0x54be('0x3')]();var auth=require(_0x54be('0x4'));var interaction=require(_0x54be('0x5'));var config=require(_0x54be('0x6'));var controller=require(_0x54be('0x7'));router[_0x54be('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x54be('0x8')]('/:id',auth[_0x54be('0x9')](),controller[_0x54be('0xa')]);router['get'](_0x54be('0xb'),auth[_0x54be('0x9')](),controller[_0x54be('0xc')]);router[_0x54be('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x54be('0xe')]);router[_0x54be('0xf')]('/:id',auth[_0x54be('0x9')](),controller['destroy']);module[_0x54be('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7a5fa6c..79f0bd7 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2b752e,_0x3b1e44){var _0x12505a=function(_0x5a3e40){while(--_0x5a3e40){_0x2b752e['push'](_0x2b752e['shift']());}};_0x12505a(++_0x3b1e44);}(_0x1261,0x144));var _0x1126=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1261[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5e2e6f,_0x4b4215){var _0xa3b2ff=function(_0x50acdb){while(--_0x50acdb){_0x5e2e6f['push'](_0x5e2e6f['shift']());}};_0xa3b2ff(++_0x4b4215);}(_0x7a54,0x106));var _0x47a5=function(_0x3296d4,_0x9da3f1){_0x3296d4=_0x3296d4-0x0;var _0x3ed421=_0x7a54[_0x3296d4];return _0x3ed421;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ecf4403..b01dad3 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 _0x96fd=['type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','bulkCreate','update','body','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x96fd,0xbb));var _0xd96f=function(_0x37d0f7,_0x41f91a){_0x37d0f7=_0x37d0f7-0x0;var _0x820b84=_0x96fd[_0x37d0f7];return _0x820b84;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd96f('0x0'));var rimraf=require(_0xd96f('0x1'));var zipdir=require(_0xd96f('0x2'));var jsonpatch=require(_0xd96f('0x3'));var rp=require('request-promise');var moment=require(_0xd96f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd96f('0x5'));var util=require('util');var path=require(_0xd96f('0x6'));var sox=require(_0xd96f('0x7'));var csv=require(_0xd96f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd96f('0x9'));var squel=require(_0xd96f('0xa'));var crypto=require(_0xd96f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd96f('0x8'));var querystring=require(_0xd96f('0xc'));var Papa=require(_0xd96f('0xd'));var Redis=require('ioredis');var authService=require(_0xd96f('0xe'));var qs=require(_0xd96f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd96f('0x10'));var logger=require(_0xd96f('0x11'))(_0xd96f('0x12'));var utils=require(_0xd96f('0x13'));var config=require(_0xd96f('0x14'));var licenseUtil=require(_0xd96f('0x15'));var db=require(_0xd96f('0x16'))['db'];function respondWithStatusCode(_0x84cb4,_0x1af2d0){_0x1af2d0=_0x1af2d0||0xcc;return function(_0x5cd5fc){if(_0x5cd5fc){return _0x84cb4[_0xd96f('0x17')](_0x1af2d0);}return _0x84cb4[_0xd96f('0x18')](_0x1af2d0)[_0xd96f('0x19')]();};}function respondWithResult(_0x1e2a15,_0x54930e){_0x54930e=_0x54930e||0xc8;return function(_0x4bfc65){if(_0x4bfc65){return _0x1e2a15[_0xd96f('0x18')](_0x54930e)['json'](_0x4bfc65);}};}function respondWithFilteredResult(_0x8a94c8,_0x154015){return function(_0x53d0f8){if(_0x53d0f8){var _0x1c86f9=_0x53d0f8[_0xd96f('0x1a')],_0x27400f=_0x154015[_0xd96f('0x1b')],_0x501079=_0x154015[_0xd96f('0x1b')]+_0x154015[_0xd96f('0x1c')],_0x32f0f4;if(_0x501079>=_0x1c86f9){_0x501079=_0x1c86f9;_0x32f0f4=0xc8;}else{_0x32f0f4=0xce;}_0x8a94c8['status'](_0x32f0f4);return _0x8a94c8[_0xd96f('0x1d')](_0xd96f('0x1e'),_0x27400f+'-'+_0x501079+'/'+_0x1c86f9)['json'](_0x53d0f8);}return null;};}function patchUpdates(_0xd15ede){return function(_0x38d7e2){try{jsonpatch['apply'](_0x38d7e2,_0xd15ede,!![]);}catch(_0x4b0178){return BPromise[_0xd96f('0x1f')](_0x4b0178);}return _0x38d7e2['save']();};}function saveUpdates(_0x40078e,_0x6a4c46){return function(_0x2025f6){if(_0x2025f6){return _0x2025f6['update'](_0x40078e)[_0xd96f('0x20')](function(_0xf16113){return _0xf16113;});}return null;};}function removeEntity(_0x423f04,_0x4b3c0b){return function(_0x52a070){if(_0x52a070){return _0x52a070[_0xd96f('0x21')]()[_0xd96f('0x20')](function(){_0x423f04[_0xd96f('0x18')](0xcc)[_0xd96f('0x19')]();});}};}function handleEntityNotFound(_0x254354,_0x3e7f5c){return function(_0x50e90d){if(!_0x50e90d){_0x254354[_0xd96f('0x17')](0x194);}return _0x50e90d;};}function handleError(_0xdff793,_0x55fff8){_0x55fff8=_0x55fff8||0x1f4;return function(_0x6f9965){logger[_0xd96f('0x22')](_0x6f9965[_0xd96f('0x23')]);if(_0x6f9965[_0xd96f('0x24')]){delete _0x6f9965[_0xd96f('0x24')];}_0xdff793[_0xd96f('0x18')](_0x55fff8)[_0xd96f('0x25')](_0x6f9965);};}exports[_0xd96f('0x26')]=function(_0x4f0026,_0x4529c3){var _0x4eff2a={},_0x169cbf={},_0x1d2644={'count':0x0,'rows':[]};var _0x584c9d=_['map'](db[_0xd96f('0x27')][_0xd96f('0x28')],function(_0x537e7c){return{'name':_0x537e7c['fieldName'],'type':_0x537e7c[_0xd96f('0x29')][_0xd96f('0x2a')]};});_0x169cbf[_0xd96f('0x2b')]=_['map'](_0x584c9d,'name');_0x169cbf[_0xd96f('0x2c')]=_['keys'](_0x4f0026[_0xd96f('0x2c')]);_0x169cbf['filters']=_[_0xd96f('0x2d')](_0x169cbf[_0xd96f('0x2b')],_0x169cbf[_0xd96f('0x2c')]);_0x4eff2a[_0xd96f('0x2e')]=_[_0xd96f('0x2d')](_0x169cbf[_0xd96f('0x2b')],qs[_0xd96f('0x2f')](_0x4f0026['query']['fields']));_0x4eff2a[_0xd96f('0x2e')]=_0x4eff2a[_0xd96f('0x2e')][_0xd96f('0x30')]?_0x4eff2a[_0xd96f('0x2e')]:_0x169cbf[_0xd96f('0x2b')];if(!_0x4f0026['query']['hasOwnProperty'](_0xd96f('0x31'))){_0x4eff2a[_0xd96f('0x1c')]=qs[_0xd96f('0x1c')](_0x4f0026[_0xd96f('0x2c')][_0xd96f('0x1c')]);_0x4eff2a[_0xd96f('0x1b')]=qs['offset'](_0x4f0026['query'][_0xd96f('0x1b')]);}_0x4eff2a['order']=qs['sort'](_0x4f0026[_0xd96f('0x2c')][_0xd96f('0x32')]);_0x4eff2a[_0xd96f('0x33')]=qs['filters'](_[_0xd96f('0x34')](_0x4f0026[_0xd96f('0x2c')],_0x169cbf[_0xd96f('0x35')]),_0x584c9d);if(_0x4f0026['query'][_0xd96f('0x36')]){_0x4eff2a[_0xd96f('0x33')]=_[_0xd96f('0x37')](_0x4eff2a[_0xd96f('0x33')],{'$or':_[_0xd96f('0x38')](_0x584c9d,function(_0x570228){if(_0x570228[_0xd96f('0x29')]!==_0xd96f('0x39')){var _0x33f55d={};_0x33f55d[_0x570228['name']]={'$like':'%'+_0x4f0026[_0xd96f('0x2c')]['filter']+'%'};return _0x33f55d;}})});}_0x4eff2a=_[_0xd96f('0x37')]({},_0x4eff2a,_0x4f0026[_0xd96f('0x3a')]);var _0x3c66da={'where':_0x4eff2a['where']};return db['AnalyticFieldReport'][_0xd96f('0x1a')](_0x3c66da)[_0xd96f('0x20')](function(_0x408b0a){_0x1d2644[_0xd96f('0x1a')]=_0x408b0a;if(_0x4f0026['query'][_0xd96f('0x3b')]){_0x4eff2a[_0xd96f('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xd96f('0x3d')](_0x4eff2a);})[_0xd96f('0x20')](function(_0x6370be){_0x1d2644['rows']=_0x6370be;return _0x1d2644;})['then'](respondWithFilteredResult(_0x4529c3,_0x4eff2a))[_0xd96f('0x3e')](handleError(_0x4529c3,null));};exports['show']=function(_0x2eba76,_0x3dd2b2){var _0x39c86b={'raw':![],'where':{'id':_0x2eba76[_0xd96f('0x3f')]['id']}},_0x492fba={};_0x492fba['model']=_['keys'](db[_0xd96f('0x27')][_0xd96f('0x28')]);_0x492fba[_0xd96f('0x2c')]=_[_0xd96f('0x40')](_0x2eba76[_0xd96f('0x2c')]);_0x492fba[_0xd96f('0x35')]=_[_0xd96f('0x2d')](_0x492fba[_0xd96f('0x2b')],_0x492fba[_0xd96f('0x2c')]);_0x39c86b[_0xd96f('0x2e')]=_['intersection'](_0x492fba[_0xd96f('0x2b')],qs[_0xd96f('0x2f')](_0x2eba76['query'][_0xd96f('0x2f')]));_0x39c86b[_0xd96f('0x2e')]=_0x39c86b[_0xd96f('0x2e')][_0xd96f('0x30')]?_0x39c86b['attributes']:_0x492fba[_0xd96f('0x2b')];if(_0x2eba76[_0xd96f('0x2c')][_0xd96f('0x3b')]){_0x39c86b[_0xd96f('0x3c')]=[{'all':!![]}];}_0x39c86b=_['merge']({},_0x39c86b,_0x2eba76[_0xd96f('0x3a')]);return db[_0xd96f('0x27')][_0xd96f('0x41')](_0x39c86b)[_0xd96f('0x20')](handleEntityNotFound(_0x3dd2b2,null))[_0xd96f('0x20')](respondWithResult(_0x3dd2b2,null))['catch'](handleError(_0x3dd2b2,null));};exports[_0xd96f('0x42')]=function(_0x280dc9,_0x469e31){return db[_0xd96f('0x27')][_0xd96f('0x42')](_0x280dc9['body'],{})[_0xd96f('0x20')](respondWithResult(_0x469e31,0xc9))[_0xd96f('0x3e')](handleError(_0x469e31,null));};exports[_0xd96f('0x43')]=function(_0x16d80d,_0x1accc9){return db[_0xd96f('0x27')][_0xd96f('0x43')](_0x16d80d['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1accc9,0xc9))['catch'](handleError(_0x1accc9,null));};exports[_0xd96f('0x44')]=function(_0x9ba5c4,_0x433247){if(_0x9ba5c4[_0xd96f('0x45')]['id']){delete _0x9ba5c4[_0xd96f('0x45')]['id'];}return db[_0xd96f('0x27')][_0xd96f('0x41')]({'where':{'id':_0x9ba5c4[_0xd96f('0x3f')]['id']}})[_0xd96f('0x20')](handleEntityNotFound(_0x433247,null))['then'](saveUpdates(_0x9ba5c4['body'],null))[_0xd96f('0x20')](respondWithResult(_0x433247,null))['catch'](handleError(_0x433247,null));};exports[_0xd96f('0x21')]=function(_0x34f9fe,_0x35bcc7){return db[_0xd96f('0x27')][_0xd96f('0x41')]({'where':{'id':_0x34f9fe['params']['id']}})['then'](handleEntityNotFound(_0x35bcc7,null))['then'](removeEntity(_0x35bcc7,null))[_0xd96f('0x3e')](handleError(_0x35bcc7,null));};exports['bulkDestroy']=function(_0x12c569,_0x2ffb50){return db['AnalyticFieldReport'][_0xd96f('0x21')]({'where':{'id':_0x12c569[_0xd96f('0x2c')][_0xd96f('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0xd96f('0x20')](respondWithResult(_0x2ffb50,0xcc))['catch'](handleError(_0x2ffb50,null));};exports['addFields']=function(_0x5b97c8,_0x414bb9,_0xaea8a7){return db[_0xd96f('0x47')][_0xd96f('0x48')]({'where':{'id':_0x5b97c8['params']['id']}})[_0xd96f('0x20')](handleEntityNotFound(_0x414bb9,null))[_0xd96f('0x20')](function(_0x448bf1){if(_0x448bf1){return db[_0xd96f('0x49')][_0xd96f('0x4a')](function(_0x31ceb0){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x5b97c8[_0xd96f('0x3f')]['id']},'transaction':_0x31ceb0})['then'](function(_0x5ea958){var _0x13c5af=_[_0xd96f('0x38')](_0x5b97c8[_0xd96f('0x45')],function(_0x1e4c02){delete _0x1e4c02['id'];_0x1e4c02[_0xd96f('0x4b')]=_0x5b97c8['params']['id'];return _0x1e4c02;});return db['AnalyticFieldReport'][_0xd96f('0x43')](_0x13c5af,{'transaction':_0x31ceb0});});})[_0xd96f('0x20')](function(){return db['AnalyticFieldReport'][_0xd96f('0x3d')]({'where':{'CustomReportId':_0x5b97c8[_0xd96f('0x3f')]['id']}});});}})[_0xd96f('0x20')](respondWithResult(_0x414bb9,null))[_0xd96f('0x3e')](handleError(_0x414bb9,null));}; \ No newline at end of file +var _0x3e2e=['moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','index','AnalyticFieldReport','rawAttributes','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','name','options','includeAll','include','findAll','rows','params','length','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x2f3230,_0x4c9066){var _0x7fb936=function(_0x516537){while(--_0x516537){_0x2f3230['push'](_0x2f3230['shift']());}};_0x7fb936(++_0x4c9066);}(_0x3e2e,0x1dc));var _0xe3e2=function(_0x4b3cbf,_0x5c6f66){_0x4b3cbf=_0x4b3cbf-0x0;var _0x4ec577=_0x3e2e[_0x4b3cbf];return _0x4ec577;};'use strict';var pdf=require(_0xe3e2('0x0'));var emlformat=require(_0xe3e2('0x1'));var rimraf=require(_0xe3e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3e2('0x3'));var rp=require('request-promise');var moment=require(_0xe3e2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe3e2('0x5'));var path=require(_0xe3e2('0x6'));var sox=require(_0xe3e2('0x7'));var csv=require(_0xe3e2('0x8'));var ejs=require(_0xe3e2('0x9'));var fs=require('fs');var _=require(_0xe3e2('0xa'));var squel=require('squel');var crypto=require(_0xe3e2('0xb'));var jsforce=require(_0xe3e2('0xc'));var deskjs=require(_0xe3e2('0xd'));var toCsv=require(_0xe3e2('0x8'));var querystring=require(_0xe3e2('0xe'));var Papa=require(_0xe3e2('0xf'));var Redis=require(_0xe3e2('0x10'));var authService=require(_0xe3e2('0x11'));var qs=require(_0xe3e2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3e2('0x13'))('api');var utils=require(_0xe3e2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe3e2('0x15'));var db=require(_0xe3e2('0x16'))['db'];function respondWithStatusCode(_0x17f9bf,_0x44c602){_0x44c602=_0x44c602||0xcc;return function(_0x5c2263){if(_0x5c2263){return _0x17f9bf[_0xe3e2('0x17')](_0x44c602);}return _0x17f9bf[_0xe3e2('0x18')](_0x44c602)[_0xe3e2('0x19')]();};}function respondWithResult(_0x3c1daf,_0x39bb9f){_0x39bb9f=_0x39bb9f||0xc8;return function(_0x5254b1){if(_0x5254b1){return _0x3c1daf['status'](_0x39bb9f)['json'](_0x5254b1);}};}function respondWithFilteredResult(_0xd72356,_0x5808dd){return function(_0x2f9a86){if(_0x2f9a86){var _0x3d2ba6=_0x2f9a86[_0xe3e2('0x1a')],_0x11519e=_0x5808dd[_0xe3e2('0x1b')],_0x1350be=_0x5808dd[_0xe3e2('0x1b')]+_0x5808dd['limit'],_0x28721d;if(_0x1350be>=_0x3d2ba6){_0x1350be=_0x3d2ba6;_0x28721d=0xc8;}else{_0x28721d=0xce;}_0xd72356[_0xe3e2('0x18')](_0x28721d);return _0xd72356[_0xe3e2('0x1c')](_0xe3e2('0x1d'),_0x11519e+'-'+_0x1350be+'/'+_0x3d2ba6)[_0xe3e2('0x1e')](_0x2f9a86);}return null;};}function patchUpdates(_0x1d116f){return function(_0xdf3e74){try{jsonpatch[_0xe3e2('0x1f')](_0xdf3e74,_0x1d116f,!![]);}catch(_0x5e0af3){return BPromise[_0xe3e2('0x20')](_0x5e0af3);}return _0xdf3e74[_0xe3e2('0x21')]();};}function saveUpdates(_0x11beee,_0x45a960){return function(_0x5c3c5e){if(_0x5c3c5e){return _0x5c3c5e[_0xe3e2('0x22')](_0x11beee)['then'](function(_0x433456){return _0x433456;});}return null;};}function removeEntity(_0x18ffb1,_0x42c6e6){return function(_0x379251){if(_0x379251){return _0x379251[_0xe3e2('0x23')]()[_0xe3e2('0x24')](function(){_0x18ffb1[_0xe3e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d549,_0x59bc00){return function(_0x5e2ebe){if(!_0x5e2ebe){_0x57d549[_0xe3e2('0x17')](0x194);}return _0x5e2ebe;};}function handleError(_0x3a96e4,_0x505762){_0x505762=_0x505762||0x1f4;return function(_0x41eeeb){logger[_0xe3e2('0x25')](_0x41eeeb[_0xe3e2('0x26')]);if(_0x41eeeb['name']){delete _0x41eeeb['name'];}_0x3a96e4['status'](_0x505762)['send'](_0x41eeeb);};}exports[_0xe3e2('0x27')]=function(_0x249bf1,_0x2b72de){var _0x18040a={},_0x26bf4b={},_0x4c96c6={'count':0x0,'rows':[]};var _0x44e820=_['map'](db[_0xe3e2('0x28')][_0xe3e2('0x29')],function(_0x388c27){return{'name':_0x388c27['fieldName'],'type':_0x388c27['type'][_0xe3e2('0x2a')]};});_0x26bf4b['model']=_[_0xe3e2('0x2b')](_0x44e820,'name');_0x26bf4b[_0xe3e2('0x2c')]=_[_0xe3e2('0x2d')](_0x249bf1['query']);_0x26bf4b[_0xe3e2('0x2e')]=_[_0xe3e2('0x2f')](_0x26bf4b[_0xe3e2('0x30')],_0x26bf4b[_0xe3e2('0x2c')]);_0x18040a['attributes']=_[_0xe3e2('0x2f')](_0x26bf4b[_0xe3e2('0x30')],qs[_0xe3e2('0x31')](_0x249bf1[_0xe3e2('0x2c')][_0xe3e2('0x31')]));_0x18040a['attributes']=_0x18040a[_0xe3e2('0x32')]['length']?_0x18040a[_0xe3e2('0x32')]:_0x26bf4b[_0xe3e2('0x30')];if(!_0x249bf1[_0xe3e2('0x2c')]['hasOwnProperty'](_0xe3e2('0x33'))){_0x18040a[_0xe3e2('0x34')]=qs[_0xe3e2('0x34')](_0x249bf1[_0xe3e2('0x2c')][_0xe3e2('0x34')]);_0x18040a['offset']=qs[_0xe3e2('0x1b')](_0x249bf1[_0xe3e2('0x2c')][_0xe3e2('0x1b')]);}_0x18040a[_0xe3e2('0x35')]=qs[_0xe3e2('0x36')](_0x249bf1['query'][_0xe3e2('0x36')]);_0x18040a['where']=qs[_0xe3e2('0x2e')](_[_0xe3e2('0x37')](_0x249bf1[_0xe3e2('0x2c')],_0x26bf4b[_0xe3e2('0x2e')]),_0x44e820);if(_0x249bf1[_0xe3e2('0x2c')][_0xe3e2('0x38')]){_0x18040a[_0xe3e2('0x39')]=_[_0xe3e2('0x3a')](_0x18040a[_0xe3e2('0x39')],{'$or':_[_0xe3e2('0x2b')](_0x44e820,function(_0x22124e){if(_0x22124e[_0xe3e2('0x3b')]!==_0xe3e2('0x3c')){var _0xb9e3e7={};_0xb9e3e7[_0x22124e[_0xe3e2('0x3d')]]={'$like':'%'+_0x249bf1[_0xe3e2('0x2c')][_0xe3e2('0x38')]+'%'};return _0xb9e3e7;}})});}_0x18040a=_[_0xe3e2('0x3a')]({},_0x18040a,_0x249bf1[_0xe3e2('0x3e')]);var _0x51cc34={'where':_0x18040a[_0xe3e2('0x39')]};return db['AnalyticFieldReport'][_0xe3e2('0x1a')](_0x51cc34)[_0xe3e2('0x24')](function(_0x3ca1be){_0x4c96c6['count']=_0x3ca1be;if(_0x249bf1['query'][_0xe3e2('0x3f')]){_0x18040a[_0xe3e2('0x40')]=[{'all':!![]}];}return db[_0xe3e2('0x28')][_0xe3e2('0x41')](_0x18040a);})['then'](function(_0x31d825){_0x4c96c6[_0xe3e2('0x42')]=_0x31d825;return _0x4c96c6;})[_0xe3e2('0x24')](respondWithFilteredResult(_0x2b72de,_0x18040a))['catch'](handleError(_0x2b72de,null));};exports['show']=function(_0x37e7d9,_0xca6ac2){var _0x3ae49e={'raw':![],'where':{'id':_0x37e7d9[_0xe3e2('0x43')]['id']}},_0x3aeae3={};_0x3aeae3[_0xe3e2('0x30')]=_[_0xe3e2('0x2d')](db[_0xe3e2('0x28')][_0xe3e2('0x29')]);_0x3aeae3[_0xe3e2('0x2c')]=_[_0xe3e2('0x2d')](_0x37e7d9[_0xe3e2('0x2c')]);_0x3aeae3['filters']=_[_0xe3e2('0x2f')](_0x3aeae3[_0xe3e2('0x30')],_0x3aeae3['query']);_0x3ae49e['attributes']=_[_0xe3e2('0x2f')](_0x3aeae3[_0xe3e2('0x30')],qs[_0xe3e2('0x31')](_0x37e7d9[_0xe3e2('0x2c')][_0xe3e2('0x31')]));_0x3ae49e[_0xe3e2('0x32')]=_0x3ae49e['attributes'][_0xe3e2('0x44')]?_0x3ae49e[_0xe3e2('0x32')]:_0x3aeae3['model'];if(_0x37e7d9[_0xe3e2('0x2c')][_0xe3e2('0x3f')]){_0x3ae49e[_0xe3e2('0x40')]=[{'all':!![]}];}_0x3ae49e=_[_0xe3e2('0x3a')]({},_0x3ae49e,_0x37e7d9['options']);return db['AnalyticFieldReport'][_0xe3e2('0x45')](_0x3ae49e)[_0xe3e2('0x24')](handleEntityNotFound(_0xca6ac2,null))[_0xe3e2('0x24')](respondWithResult(_0xca6ac2,null))[_0xe3e2('0x46')](handleError(_0xca6ac2,null));};exports['create']=function(_0xcf5550,_0x4e7fd9){return db['AnalyticFieldReport'][_0xe3e2('0x47')](_0xcf5550['body'],{})[_0xe3e2('0x24')](respondWithResult(_0x4e7fd9,0xc9))[_0xe3e2('0x46')](handleError(_0x4e7fd9,null));};exports[_0xe3e2('0x48')]=function(_0x26c6ab,_0x25a867){return db['AnalyticFieldReport'][_0xe3e2('0x48')](_0x26c6ab['body'],{'raw':![],'individualHooks':!![]})[_0xe3e2('0x24')](respondWithResult(_0x25a867,0xc9))[_0xe3e2('0x46')](handleError(_0x25a867,null));};exports[_0xe3e2('0x22')]=function(_0x1012c5,_0x345884){if(_0x1012c5[_0xe3e2('0x49')]['id']){delete _0x1012c5[_0xe3e2('0x49')]['id'];}return db[_0xe3e2('0x28')][_0xe3e2('0x45')]({'where':{'id':_0x1012c5[_0xe3e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x345884,null))[_0xe3e2('0x24')](saveUpdates(_0x1012c5['body'],null))[_0xe3e2('0x24')](respondWithResult(_0x345884,null))[_0xe3e2('0x46')](handleError(_0x345884,null));};exports[_0xe3e2('0x23')]=function(_0x2fb8eb,_0x208786){return db[_0xe3e2('0x28')]['find']({'where':{'id':_0x2fb8eb[_0xe3e2('0x43')]['id']}})[_0xe3e2('0x24')](handleEntityNotFound(_0x208786,null))[_0xe3e2('0x24')](removeEntity(_0x208786,null))[_0xe3e2('0x46')](handleError(_0x208786,null));};exports[_0xe3e2('0x4a')]=function(_0x4db199,_0x57306a){return db['AnalyticFieldReport'][_0xe3e2('0x23')]({'where':{'id':_0x4db199[_0xe3e2('0x2c')][_0xe3e2('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xe3e2('0x24')](respondWithResult(_0x57306a,0xcc))['catch'](handleError(_0x57306a,null));};exports[_0xe3e2('0x4c')]=function(_0x227ec7,_0x4c7b6d,_0x793d35){return db[_0xe3e2('0x4d')]['findOne']({'where':{'id':_0x227ec7[_0xe3e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c7b6d,null))['then'](function(_0x579cb0){if(_0x579cb0){return db[_0xe3e2('0x4e')][_0xe3e2('0x4f')](function(_0x246d98){return db['AnalyticFieldReport'][_0xe3e2('0x23')]({'where':{'CustomReportId':_0x227ec7[_0xe3e2('0x43')]['id']},'transaction':_0x246d98})[_0xe3e2('0x24')](function(_0x493edb){var _0x4980b7=_[_0xe3e2('0x2b')](_0x227ec7[_0xe3e2('0x49')],function(_0x333a1d){delete _0x333a1d['id'];_0x333a1d['CustomReportId']=_0x227ec7[_0xe3e2('0x43')]['id'];return _0x333a1d;});return db[_0xe3e2('0x28')]['bulkCreate'](_0x4980b7,{'transaction':_0x246d98});});})[_0xe3e2('0x24')](function(){return db[_0xe3e2('0x28')][_0xe3e2('0x41')]({'where':{'CustomReportId':_0x227ec7['params']['id']}});});}})['then'](respondWithResult(_0x4c7b6d,null))[_0xe3e2('0x46')](handleError(_0x4c7b6d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3f1efde..6cefd71 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 _0xee88=['./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13c183,_0x2d916a){var _0x55796f=function(_0x507599){while(--_0x507599){_0x13c183['push'](_0x13c183['shift']());}};_0x55796f(++_0x2d916a);}(_0xee88,0x88));var _0x8ee8=function(_0x5b3310,_0x506714){_0x5b3310=_0x5b3310-0x0;var _0x29617c=_0xee88[_0x5b3310];return _0x29617c;};'use strict';var _=require(_0x8ee8('0x0'));var util=require(_0x8ee8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8ee8('0x2'));var rp=require(_0x8ee8('0x3'));var fs=require('fs');var path=require(_0x8ee8('0x4'));var rimraf=require(_0x8ee8('0x5'));var config=require(_0x8ee8('0x6'));var attributes=require(_0x8ee8('0x7'));module[_0x8ee8('0x8')]=function(_0x4cb601,_0x501230){return _0x4cb601[_0x8ee8('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x8ee8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc432=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','util'];(function(_0x399584,_0x86b788){var _0x1d68fa=function(_0x1717ab){while(--_0x1717ab){_0x399584['push'](_0x399584['shift']());}};_0x1d68fa(++_0x86b788);}(_0xc432,0x137));var _0x2c43=function(_0x39281f,_0x2701e3){_0x39281f=_0x39281f-0x0;var _0x1e57c9=_0xc432[_0x39281f];return _0x1e57c9;};'use strict';var _=require('lodash');var util=require(_0x2c43('0x0'));var logger=require(_0x2c43('0x1'))(_0x2c43('0x2'));var moment=require(_0x2c43('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c43('0x4'));var fs=require('fs');var path=require(_0x2c43('0x5'));var rimraf=require(_0x2c43('0x6'));var config=require(_0x2c43('0x7'));var attributes=require(_0x2c43('0x8'));module[_0x2c43('0x9')]=function(_0x5f4917,_0x9d4dc2){return _0x5f4917[_0x2c43('0xa')](_0x2c43('0xb'),attributes,{'tableName':'analytics_report_fields','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 e1ecd02..af7acc9 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 _0xe79c=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1c1b91,_0xbf4d57){var _0x3e8b02=function(_0x54fe8a){while(--_0x54fe8a){_0x1c1b91['push'](_0x1c1b91['shift']());}};_0x3e8b02(++_0xbf4d57);}(_0xe79c,0xa6));var _0xce79=function(_0x1dd9ac,_0x18683e){_0x1dd9ac=_0x1dd9ac-0x0;var _0x1b0787=_0xe79c[_0x1dd9ac];return _0x1b0787;};'use strict';var _=require('lodash');var util=require(_0xce79('0x0'));var moment=require('moment');var BPromise=require(_0xce79('0x1'));var rs=require(_0xce79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce79('0x3'));var logger=require(_0xce79('0x4'))(_0xce79('0x5'));var config=require('../../config/environment');var jayson=require(_0xce79('0x6'));var client=jayson[_0xce79('0x7')][_0xce79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fffb9,_0x5aa7c3,_0x315c6e){return new BPromise(function(_0x4e0c31,_0x41b488){return client[_0xce79('0x9')](_0x3fffb9,_0x315c6e)[_0xce79('0xa')](function(_0x207f27){logger[_0xce79('0xb')](_0xce79('0xc'),_0x5aa7c3,_0xce79('0xd'));logger[_0xce79('0xe')](_0xce79('0xf'),_0x5aa7c3,_0xce79('0xd'),JSON[_0xce79('0x10')](_0x207f27));if(_0x207f27[_0xce79('0x11')]){if(_0x207f27[_0xce79('0x11')][_0xce79('0x12')]===0x1f4){logger[_0xce79('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5aa7c3,_0x207f27[_0xce79('0x11')][_0xce79('0x13')]);return _0x41b488(_0x207f27[_0xce79('0x11')][_0xce79('0x13')]);}logger[_0xce79('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5aa7c3,_0x207f27['error']['message']);return _0x4e0c31(_0x207f27['error'][_0xce79('0x13')]);}else{logger[_0xce79('0xb')](_0xce79('0xc'),_0x5aa7c3,_0xce79('0xd'));_0x4e0c31(_0x207f27['result'][_0xce79('0x13')]);}})['catch'](function(_0x413c4b){logger['error'](_0xce79('0xc'),_0x5aa7c3,_0x413c4b);_0x41b488(_0x413c4b);});});} \ No newline at end of file +var _0xc848=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','request\x20sent'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xc848,0xc6));var _0x8c84=function(_0x4d47d5,_0x4d4aa8){_0x4d47d5=_0x4d47d5-0x0;var _0x386628=_0xc848[_0x4d47d5];return _0x386628;};'use strict';var _=require(_0x8c84('0x0'));var util=require(_0x8c84('0x1'));var moment=require('moment');var BPromise=require(_0x8c84('0x2'));var rs=require(_0x8c84('0x3'));var fs=require('fs');var Redis=require(_0x8c84('0x4'));var db=require(_0x8c84('0x5'))['db'];var utils=require(_0x8c84('0x6'));var logger=require('../../config/logger')(_0x8c84('0x7'));var config=require(_0x8c84('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14028e,_0x3e17a0,_0x42d3a5){return new BPromise(function(_0x4adcf7,_0x537462){return client['request'](_0x14028e,_0x42d3a5)[_0x8c84('0x9')](function(_0x485600){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x3e17a0,_0x8c84('0xa'));logger[_0x8c84('0xb')](_0x8c84('0xc'),_0x3e17a0,_0x8c84('0xa'),JSON[_0x8c84('0xd')](_0x485600));if(_0x485600[_0x8c84('0xe')]){if(_0x485600[_0x8c84('0xe')][_0x8c84('0xf')]===0x1f4){logger[_0x8c84('0xe')](_0x8c84('0x10'),_0x3e17a0,_0x485600[_0x8c84('0xe')][_0x8c84('0x11')]);return _0x537462(_0x485600[_0x8c84('0xe')][_0x8c84('0x11')]);}logger[_0x8c84('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3e17a0,_0x485600[_0x8c84('0xe')]['message']);return _0x4adcf7(_0x485600[_0x8c84('0xe')][_0x8c84('0x11')]);}else{logger[_0x8c84('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3e17a0,_0x8c84('0xa'));_0x4adcf7(_0x485600['result'][_0x8c84('0x11')]);}})['catch'](function(_0x38a323){logger['error'](_0x8c84('0x10'),_0x3e17a0,_0x38a323);_0x537462(_0x38a323);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e3e77f0..d4a782b 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 _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x326f,0xd1));var _0xf326=function(_0x43c3f8,_0x5d25f4){_0x43c3f8=_0x43c3f8-0x0;var _0x41ed9f=_0x326f[_0x43c3f8];return _0x41ed9f;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x55ca[_0x51df00];return _0x198328;};'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')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('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 c12c526..1017caa 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 _0xa547=['exports','name','TEXT','STRING'];(function(_0x5d7cc0,_0x505643){var _0x2dafd3=function(_0x2406a6){while(--_0x2406a6){_0x5d7cc0['push'](_0x5d7cc0['shift']());}};_0x2dafd3(++_0x505643);}(_0xa547,0xb0));var _0x7a54=function(_0x141875,_0x3da49b){_0x141875=_0x141875-0x0;var _0x2bb0e8=_0xa547[_0x141875];return _0x2bb0e8;};'use strict';var Sequelize=require('sequelize');module[_0x7a54('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7a54('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7a54('0x2')]},'description':{'type':Sequelize[_0x7a54('0x3')]}}; \ No newline at end of file +var _0xe211=['STRING','TEXT'];(function(_0x2a3dc8,_0x4230bb){var _0x5531d7=function(_0x3c2f4d){while(--_0x3c2f4d){_0x2a3dc8['push'](_0x2a3dc8['shift']());}};_0x5531d7(++_0x4230bb);}(_0xe211,0x166));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1e21('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x1e21('0x0')]},'metric':{'type':Sequelize[_0x1e21('0x1')]},'description':{'type':Sequelize[_0x1e21('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1d5424f..f8836e8 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 _0x551d=['send','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','error','name'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x551d,0x1d2));var _0xd551=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x551d[_0x4c3070];return _0x536a44;};'use strict';var pdf=require(_0xd551('0x0'));var emlformat=require(_0xd551('0x1'));var rimraf=require(_0xd551('0x2'));var zipdir=require(_0xd551('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd551('0x4'));var moment=require('moment');var BPromise=require(_0xd551('0x5'));var Mustache=require(_0xd551('0x6'));var util=require(_0xd551('0x7'));var path=require(_0xd551('0x8'));var sox=require(_0xd551('0x9'));var csv=require(_0xd551('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd551('0xb'));var crypto=require('crypto');var jsforce=require(_0xd551('0xc'));var deskjs=require(_0xd551('0xd'));var toCsv=require(_0xd551('0xa'));var querystring=require(_0xd551('0xe'));var Papa=require('papaparse');var Redis=require(_0xd551('0xf'));var authService=require(_0xd551('0x10'));var qs=require(_0xd551('0x11'));var as=require(_0xd551('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd551('0x13'))(_0xd551('0x14'));var utils=require(_0xd551('0x15'));var config=require(_0xd551('0x16'));var licenseUtil=require(_0xd551('0x17'));var db=require(_0xd551('0x18'))['db'];function respondWithStatusCode(_0xee5716,_0x507e23){_0x507e23=_0x507e23||0xcc;return function(_0x477b1c){if(_0x477b1c){return _0xee5716[_0xd551('0x19')](_0x507e23);}return _0xee5716[_0xd551('0x1a')](_0x507e23)[_0xd551('0x1b')]();};}function respondWithResult(_0x1f1096,_0x44876b){_0x44876b=_0x44876b||0xc8;return function(_0x53e2e8){if(_0x53e2e8){return _0x1f1096[_0xd551('0x1a')](_0x44876b)[_0xd551('0x1c')](_0x53e2e8);}};}function respondWithFilteredResult(_0xed198e,_0x2b0513){return function(_0x1dc279){if(_0x1dc279){var _0x1fa47f=_0x1dc279[_0xd551('0x1d')],_0x1a1826=_0x2b0513[_0xd551('0x1e')],_0xbb9d24=_0x2b0513[_0xd551('0x1e')]+_0x2b0513[_0xd551('0x1f')],_0x29fc0c;if(_0xbb9d24>=_0x1fa47f){_0xbb9d24=_0x1fa47f;_0x29fc0c=0xc8;}else{_0x29fc0c=0xce;}_0xed198e[_0xd551('0x1a')](_0x29fc0c);return _0xed198e[_0xd551('0x20')](_0xd551('0x21'),_0x1a1826+'-'+_0xbb9d24+'/'+_0x1fa47f)[_0xd551('0x1c')](_0x1dc279);}return null;};}function patchUpdates(_0x4d7014){return function(_0x4fb27a){try{jsonpatch[_0xd551('0x22')](_0x4fb27a,_0x4d7014,!![]);}catch(_0x7b4368){return BPromise[_0xd551('0x23')](_0x7b4368);}return _0x4fb27a['save']();};}function saveUpdates(_0xf1b8db,_0x5d5997){return function(_0x25a324){if(_0x25a324){return _0x25a324[_0xd551('0x24')](_0xf1b8db)[_0xd551('0x25')](function(_0x24af51){return _0x24af51;});}return null;};}function removeEntity(_0x161e36,_0xf745eb){return function(_0x53e69d){if(_0x53e69d){return _0x53e69d[_0xd551('0x26')]()[_0xd551('0x25')](function(){var _0x4c7450=_0x53e69d[_0xd551('0x27')]({'plain':!![]});var _0x33c0ef=_0xd551('0x28');return db[_0xd551('0x29')][_0xd551('0x26')]({'where':{'type':_0x33c0ef,'resourceId':_0x4c7450['id']}})[_0xd551('0x25')](function(){return _0x53e69d;});})['then'](function(){_0x161e36[_0xd551('0x1a')](0xcc)[_0xd551('0x1b')]();});}};}function handleEntityNotFound(_0x323c13,_0x3c9a65){return function(_0x5614a5){if(!_0x5614a5){_0x323c13['sendStatus'](0x194);}return _0x5614a5;};}function handleError(_0x17c582,_0x116603){_0x116603=_0x116603||0x1f4;return function(_0xa31ff1){logger[_0xd551('0x2a')](_0xa31ff1['stack']);if(_0xa31ff1[_0xd551('0x2b')]){delete _0xa31ff1[_0xd551('0x2b')];}_0x17c582['status'](_0x116603)[_0xd551('0x2c')](_0xa31ff1);};}exports['index']=function(_0xc7267e,_0x467ac9){var _0x1b7a33={},_0x1d8fd7={},_0x39cc5f={'count':0x0,'rows':[]};var _0x221abf=_[_0xd551('0x2d')](db[_0xd551('0x2e')][_0xd551('0x2f')],function(_0x8cbc93){return{'name':_0x8cbc93[_0xd551('0x30')],'type':_0x8cbc93[_0xd551('0x31')][_0xd551('0x32')]};});_0x1d8fd7[_0xd551('0x33')]=_[_0xd551('0x2d')](_0x221abf,'name');_0x1d8fd7[_0xd551('0x34')]=_[_0xd551('0x35')](_0xc7267e[_0xd551('0x34')]);_0x1d8fd7[_0xd551('0x36')]=_[_0xd551('0x37')](_0x1d8fd7['model'],_0x1d8fd7[_0xd551('0x34')]);_0x1b7a33[_0xd551('0x38')]=_[_0xd551('0x37')](_0x1d8fd7[_0xd551('0x33')],qs[_0xd551('0x39')](_0xc7267e['query'][_0xd551('0x39')]));_0x1b7a33[_0xd551('0x38')]=_0x1b7a33[_0xd551('0x38')]['length']?_0x1b7a33[_0xd551('0x38')]:_0x1d8fd7['model'];if(!_0xc7267e['query'][_0xd551('0x3a')]('nolimit')){_0x1b7a33[_0xd551('0x1f')]=qs['limit'](_0xc7267e['query'][_0xd551('0x1f')]);_0x1b7a33[_0xd551('0x1e')]=qs['offset'](_0xc7267e[_0xd551('0x34')][_0xd551('0x1e')]);}_0x1b7a33[_0xd551('0x3b')]=qs[_0xd551('0x3c')](_0xc7267e[_0xd551('0x34')][_0xd551('0x3c')]);_0x1b7a33[_0xd551('0x3d')]=qs[_0xd551('0x36')](_[_0xd551('0x3e')](_0xc7267e[_0xd551('0x34')],_0x1d8fd7[_0xd551('0x36')]),_0x221abf);if(_0xc7267e[_0xd551('0x34')]['filter']){_0x1b7a33['where']=_[_0xd551('0x3f')](_0x1b7a33[_0xd551('0x3d')],{'$or':_[_0xd551('0x2d')](_0x221abf,function(_0x4cc35d){if(_0x4cc35d[_0xd551('0x31')]!==_0xd551('0x40')){var _0xeeccd={};_0xeeccd[_0x4cc35d[_0xd551('0x2b')]]={'$like':'%'+_0xc7267e[_0xd551('0x34')][_0xd551('0x41')]+'%'};return _0xeeccd;}})});}_0x1b7a33=_['merge']({},_0x1b7a33,_0xc7267e[_0xd551('0x42')]);var _0x311c40={'where':_0x1b7a33[_0xd551('0x3d')]};return db[_0xd551('0x2e')][_0xd551('0x1d')](_0x311c40)[_0xd551('0x25')](function(_0x200874){_0x39cc5f[_0xd551('0x1d')]=_0x200874;if(_0xc7267e[_0xd551('0x34')][_0xd551('0x43')]){_0x1b7a33[_0xd551('0x44')]=[{'all':!![]}];}return db[_0xd551('0x2e')][_0xd551('0x45')](_0x1b7a33);})[_0xd551('0x25')](function(_0x36e863){_0x39cc5f[_0xd551('0x46')]=_0x36e863;return _0x39cc5f;})['then'](respondWithFilteredResult(_0x467ac9,_0x1b7a33))['catch'](handleError(_0x467ac9,null));};exports[_0xd551('0x47')]=function(_0x247736,_0x202474){var _0xdb3c0d={'raw':!![],'where':{'id':_0x247736['params']['id']}},_0x5e9a33={};_0x5e9a33[_0xd551('0x33')]=_[_0xd551('0x35')](db[_0xd551('0x2e')][_0xd551('0x2f')]);_0x5e9a33['query']=_[_0xd551('0x35')](_0x247736[_0xd551('0x34')]);_0x5e9a33[_0xd551('0x36')]=_[_0xd551('0x37')](_0x5e9a33[_0xd551('0x33')],_0x5e9a33[_0xd551('0x34')]);_0xdb3c0d[_0xd551('0x38')]=_[_0xd551('0x37')](_0x5e9a33[_0xd551('0x33')],qs['fields'](_0x247736['query'][_0xd551('0x39')]));_0xdb3c0d[_0xd551('0x38')]=_0xdb3c0d['attributes'][_0xd551('0x48')]?_0xdb3c0d[_0xd551('0x38')]:_0x5e9a33[_0xd551('0x33')];if(_0x247736[_0xd551('0x34')][_0xd551('0x43')]){_0xdb3c0d['include']=[{'all':!![]}];}_0xdb3c0d=_[_0xd551('0x3f')]({},_0xdb3c0d,_0x247736[_0xd551('0x42')]);return db['AnalyticMetric'][_0xd551('0x49')](_0xdb3c0d)[_0xd551('0x25')](handleEntityNotFound(_0x202474,null))[_0xd551('0x25')](respondWithResult(_0x202474,null))[_0xd551('0x4a')](handleError(_0x202474,null));};exports['create']=function(_0x5d5087,_0x46d3bc){return db[_0xd551('0x2e')]['create'](_0x5d5087['body'],{})[_0xd551('0x25')](function(_0x231da8){var _0x3005f2=_0x5d5087[_0xd551('0x4b')][_0xd551('0x27')]({'plain':!![]});if(!_0x3005f2)throw new Error(_0xd551('0x4c'));if(_0x3005f2[_0xd551('0x4d')]===_0xd551('0x4b')){var _0x24afcd=_0x231da8['get']({'plain':!![]});var _0x5c5efd='Metrics';return db[_0xd551('0x4e')]['find']({'where':{'name':_0x5c5efd,'userProfileId':_0x3005f2[_0xd551('0x4f')]},'raw':!![]})[_0xd551('0x25')](function(_0x4935b1){if(_0x4935b1&&_0x4935b1[_0xd551('0x50')]===0x0){return db[_0xd551('0x29')][_0xd551('0x51')]({'name':_0x24afcd[_0xd551('0x2b')],'resourceId':_0x24afcd['id'],'type':_0x4935b1[_0xd551('0x2b')],'sectionId':_0x4935b1['id']},{})[_0xd551('0x25')](function(){return _0x231da8;});}else{return _0x231da8;}})[_0xd551('0x4a')](function(_0x5c22a8){logger['error'](_0xd551('0x52'),_0x5c22a8);throw _0x5c22a8;});}return _0x231da8;})[_0xd551('0x25')](respondWithResult(_0x46d3bc,0xc9))[_0xd551('0x4a')](handleError(_0x46d3bc,null));};exports[_0xd551('0x24')]=function(_0x4580f1,_0x5206f0){if(_0x4580f1['body']['id']){delete _0x4580f1[_0xd551('0x53')]['id'];}return db[_0xd551('0x2e')][_0xd551('0x49')]({'where':{'id':_0x4580f1[_0xd551('0x54')]['id']}})[_0xd551('0x25')](handleEntityNotFound(_0x5206f0,null))['then'](saveUpdates(_0x4580f1[_0xd551('0x53')],null))[_0xd551('0x25')](respondWithResult(_0x5206f0,null))[_0xd551('0x4a')](handleError(_0x5206f0,null));};exports[_0xd551('0x26')]=function(_0x197030,_0x307c0c){return db[_0xd551('0x2e')][_0xd551('0x49')]({'where':{'id':_0x197030[_0xd551('0x54')]['id']}})[_0xd551('0x25')](handleEntityNotFound(_0x307c0c,null))[_0xd551('0x25')](removeEntity(_0x307c0c,null))[_0xd551('0x4a')](handleError(_0x307c0c,null));}; \ No newline at end of file +var _0x0951=['status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','error','stack','send','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','filter','options','includeAll','include','AnalyticMetric','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x13b5ae,_0x5ec4d2){var _0x4bd2b0=function(_0x4edcf2){while(--_0x4edcf2){_0x13b5ae['push'](_0x13b5ae['shift']());}};_0x4bd2b0(++_0x5ec4d2);}(_0x0951,0x89));var _0x1095=function(_0x2375ea,_0x34cc5c){_0x2375ea=_0x2375ea-0x0;var _0x77f2bc=_0x0951[_0x2375ea];return _0x77f2bc;};'use strict';var pdf=require(_0x1095('0x0'));var emlformat=require(_0x1095('0x1'));var rimraf=require(_0x1095('0x2'));var zipdir=require(_0x1095('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1095('0x4'));var moment=require('moment');var BPromise=require(_0x1095('0x5'));var Mustache=require(_0x1095('0x6'));var util=require(_0x1095('0x7'));var path=require(_0x1095('0x8'));var sox=require(_0x1095('0x9'));var csv=require(_0x1095('0xa'));var ejs=require(_0x1095('0xb'));var fs=require('fs');var _=require(_0x1095('0xc'));var squel=require(_0x1095('0xd'));var crypto=require('crypto');var jsforce=require(_0x1095('0xe'));var deskjs=require(_0x1095('0xf'));var toCsv=require(_0x1095('0xa'));var querystring=require(_0x1095('0x10'));var Papa=require(_0x1095('0x11'));var Redis=require(_0x1095('0x12'));var authService=require(_0x1095('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1095('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1095('0x15'))('api');var utils=require(_0x1095('0x16'));var config=require(_0x1095('0x17'));var licenseUtil=require(_0x1095('0x18'));var db=require(_0x1095('0x19'))['db'];function respondWithStatusCode(_0x263f34,_0x340357){_0x340357=_0x340357||0xcc;return function(_0x69ab97){if(_0x69ab97){return _0x263f34[_0x1095('0x1a')](_0x340357);}return _0x263f34[_0x1095('0x1b')](_0x340357)[_0x1095('0x1c')]();};}function respondWithResult(_0x260b42,_0x5a1e09){_0x5a1e09=_0x5a1e09||0xc8;return function(_0x5cf5f9){if(_0x5cf5f9){return _0x260b42['status'](_0x5a1e09)[_0x1095('0x1d')](_0x5cf5f9);}};}function respondWithFilteredResult(_0x4ba13f,_0x291073){return function(_0x21c40c){if(_0x21c40c){var _0x4b033a=_0x21c40c[_0x1095('0x1e')],_0x26fed6=_0x291073[_0x1095('0x1f')],_0x4c1a8a=_0x291073[_0x1095('0x1f')]+_0x291073[_0x1095('0x20')],_0x3732bc;if(_0x4c1a8a>=_0x4b033a){_0x4c1a8a=_0x4b033a;_0x3732bc=0xc8;}else{_0x3732bc=0xce;}_0x4ba13f[_0x1095('0x1b')](_0x3732bc);return _0x4ba13f['set'](_0x1095('0x21'),_0x26fed6+'-'+_0x4c1a8a+'/'+_0x4b033a)[_0x1095('0x1d')](_0x21c40c);}return null;};}function patchUpdates(_0x4f7c98){return function(_0x5cd94e){try{jsonpatch['apply'](_0x5cd94e,_0x4f7c98,!![]);}catch(_0x21bce6){return BPromise[_0x1095('0x22')](_0x21bce6);}return _0x5cd94e[_0x1095('0x23')]();};}function saveUpdates(_0x392c7c,_0x26c1bc){return function(_0x2d8f51){if(_0x2d8f51){return _0x2d8f51['update'](_0x392c7c)[_0x1095('0x24')](function(_0x1dd3c4){return _0x1dd3c4;});}return null;};}function removeEntity(_0x3eff05,_0x7e11ee){return function(_0xd4734b){if(_0xd4734b){return _0xd4734b[_0x1095('0x25')]()[_0x1095('0x24')](function(){var _0x242c8e=_0xd4734b[_0x1095('0x26')]({'plain':!![]});var _0x5683a4='Metrics';return db['UserProfileResource'][_0x1095('0x25')]({'where':{'type':_0x5683a4,'resourceId':_0x242c8e['id']}})[_0x1095('0x24')](function(){return _0xd4734b;});})[_0x1095('0x24')](function(){_0x3eff05[_0x1095('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560dbe,_0x53fa71){return function(_0x5bec43){if(!_0x5bec43){_0x560dbe[_0x1095('0x1a')](0x194);}return _0x5bec43;};}function handleError(_0x513bfa,_0x1d8303){_0x1d8303=_0x1d8303||0x1f4;return function(_0x23c275){logger[_0x1095('0x27')](_0x23c275[_0x1095('0x28')]);if(_0x23c275['name']){delete _0x23c275['name'];}_0x513bfa['status'](_0x1d8303)[_0x1095('0x29')](_0x23c275);};}exports['index']=function(_0x588c9f,_0x32629e){var _0x4b9b85={},_0x416a2f={},_0x4d7577={'count':0x0,'rows':[]};var _0x92a214=_['map'](db['AnalyticMetric'][_0x1095('0x2a')],function(_0x4d66b3){return{'name':_0x4d66b3[_0x1095('0x2b')],'type':_0x4d66b3[_0x1095('0x2c')][_0x1095('0x2d')]};});_0x416a2f[_0x1095('0x2e')]=_[_0x1095('0x2f')](_0x92a214,_0x1095('0x30'));_0x416a2f[_0x1095('0x31')]=_[_0x1095('0x32')](_0x588c9f[_0x1095('0x31')]);_0x416a2f['filters']=_[_0x1095('0x33')](_0x416a2f[_0x1095('0x2e')],_0x416a2f[_0x1095('0x31')]);_0x4b9b85[_0x1095('0x34')]=_[_0x1095('0x33')](_0x416a2f[_0x1095('0x2e')],qs[_0x1095('0x35')](_0x588c9f[_0x1095('0x31')][_0x1095('0x35')]));_0x4b9b85['attributes']=_0x4b9b85[_0x1095('0x34')]['length']?_0x4b9b85[_0x1095('0x34')]:_0x416a2f[_0x1095('0x2e')];if(!_0x588c9f[_0x1095('0x31')][_0x1095('0x36')]('nolimit')){_0x4b9b85[_0x1095('0x20')]=qs[_0x1095('0x20')](_0x588c9f[_0x1095('0x31')]['limit']);_0x4b9b85[_0x1095('0x1f')]=qs[_0x1095('0x1f')](_0x588c9f[_0x1095('0x31')]['offset']);}_0x4b9b85[_0x1095('0x37')]=qs[_0x1095('0x38')](_0x588c9f[_0x1095('0x31')][_0x1095('0x38')]);_0x4b9b85[_0x1095('0x39')]=qs[_0x1095('0x3a')](_['pick'](_0x588c9f[_0x1095('0x31')],_0x416a2f[_0x1095('0x3a')]),_0x92a214);if(_0x588c9f[_0x1095('0x31')]['filter']){_0x4b9b85['where']=_[_0x1095('0x3b')](_0x4b9b85[_0x1095('0x39')],{'$or':_['map'](_0x92a214,function(_0x269010){if(_0x269010[_0x1095('0x2c')]!=='VIRTUAL'){var _0x11d403={};_0x11d403[_0x269010[_0x1095('0x30')]]={'$like':'%'+_0x588c9f[_0x1095('0x31')][_0x1095('0x3c')]+'%'};return _0x11d403;}})});}_0x4b9b85=_[_0x1095('0x3b')]({},_0x4b9b85,_0x588c9f[_0x1095('0x3d')]);var _0x44e652={'where':_0x4b9b85[_0x1095('0x39')]};return db['AnalyticMetric']['count'](_0x44e652)[_0x1095('0x24')](function(_0x37bd04){_0x4d7577['count']=_0x37bd04;if(_0x588c9f[_0x1095('0x31')][_0x1095('0x3e')]){_0x4b9b85[_0x1095('0x3f')]=[{'all':!![]}];}return db[_0x1095('0x40')][_0x1095('0x41')](_0x4b9b85);})[_0x1095('0x24')](function(_0x22e4e3){_0x4d7577[_0x1095('0x42')]=_0x22e4e3;return _0x4d7577;})[_0x1095('0x24')](respondWithFilteredResult(_0x32629e,_0x4b9b85))[_0x1095('0x43')](handleError(_0x32629e,null));};exports[_0x1095('0x44')]=function(_0x42499c,_0x3414da){var _0x29ad6b={'raw':!![],'where':{'id':_0x42499c[_0x1095('0x45')]['id']}},_0x4389ef={};_0x4389ef['model']=_[_0x1095('0x32')](db[_0x1095('0x40')]['rawAttributes']);_0x4389ef[_0x1095('0x31')]=_['keys'](_0x42499c['query']);_0x4389ef[_0x1095('0x3a')]=_[_0x1095('0x33')](_0x4389ef[_0x1095('0x2e')],_0x4389ef[_0x1095('0x31')]);_0x29ad6b['attributes']=_[_0x1095('0x33')](_0x4389ef[_0x1095('0x2e')],qs[_0x1095('0x35')](_0x42499c[_0x1095('0x31')][_0x1095('0x35')]));_0x29ad6b[_0x1095('0x34')]=_0x29ad6b[_0x1095('0x34')]['length']?_0x29ad6b[_0x1095('0x34')]:_0x4389ef[_0x1095('0x2e')];if(_0x42499c['query'][_0x1095('0x3e')]){_0x29ad6b[_0x1095('0x3f')]=[{'all':!![]}];}_0x29ad6b=_[_0x1095('0x3b')]({},_0x29ad6b,_0x42499c[_0x1095('0x3d')]);return db[_0x1095('0x40')][_0x1095('0x46')](_0x29ad6b)[_0x1095('0x24')](handleEntityNotFound(_0x3414da,null))[_0x1095('0x24')](respondWithResult(_0x3414da,null))[_0x1095('0x43')](handleError(_0x3414da,null));};exports[_0x1095('0x47')]=function(_0x4df22f,_0x1ed211){return db[_0x1095('0x40')][_0x1095('0x47')](_0x4df22f['body'],{})['then'](function(_0x46d446){var _0x538a0f=_0x4df22f[_0x1095('0x48')]['get']({'plain':!![]});if(!_0x538a0f)throw new Error(_0x1095('0x49'));if(_0x538a0f[_0x1095('0x4a')]==='user'){var _0x1d483a=_0x46d446['get']({'plain':!![]});var _0x2f95e2=_0x1095('0x4b');return db[_0x1095('0x4c')][_0x1095('0x46')]({'where':{'name':_0x2f95e2,'userProfileId':_0x538a0f[_0x1095('0x4d')]},'raw':!![]})[_0x1095('0x24')](function(_0x533256){if(_0x533256&&_0x533256['autoAssociation']===0x0){return db[_0x1095('0x4e')][_0x1095('0x47')]({'name':_0x1d483a['name'],'resourceId':_0x1d483a['id'],'type':_0x533256[_0x1095('0x30')],'sectionId':_0x533256['id']},{})[_0x1095('0x24')](function(){return _0x46d446;});}else{return _0x46d446;}})[_0x1095('0x43')](function(_0x47e789){logger['error'](_0x1095('0x4f'),_0x47e789);throw _0x47e789;});}return _0x46d446;})[_0x1095('0x24')](respondWithResult(_0x1ed211,0xc9))['catch'](handleError(_0x1ed211,null));};exports[_0x1095('0x50')]=function(_0x400b8f,_0x64294e){if(_0x400b8f[_0x1095('0x51')]['id']){delete _0x400b8f[_0x1095('0x51')]['id'];}return db['AnalyticMetric'][_0x1095('0x46')]({'where':{'id':_0x400b8f[_0x1095('0x45')]['id']}})['then'](handleEntityNotFound(_0x64294e,null))[_0x1095('0x24')](saveUpdates(_0x400b8f[_0x1095('0x51')],null))[_0x1095('0x24')](respondWithResult(_0x64294e,null))[_0x1095('0x43')](handleError(_0x64294e,null));};exports[_0x1095('0x25')]=function(_0xefba7a,_0x18ec31){return db['AnalyticMetric']['find']({'where':{'id':_0xefba7a['params']['id']}})[_0x1095('0x24')](handleEntityNotFound(_0x18ec31,null))['then'](removeEntity(_0x18ec31,null))[_0x1095('0x43')](handleError(_0x18ec31,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 088bf54..aeb6e10 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 _0x3322=['define','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0x3322,0x1eb));var _0x2332=function(_0x234df7,_0x1b421c){_0x234df7=_0x234df7-0x0;var _0x556ba9=_0x3322[_0x234df7];return _0x556ba9;};'use strict';var _=require('lodash');var util=require(_0x2332('0x0'));var logger=require('../../config/logger')(_0x2332('0x1'));var moment=require(_0x2332('0x2'));var BPromise=require(_0x2332('0x3'));var rp=require(_0x2332('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2332('0x5'));var config=require(_0x2332('0x6'));var attributes=require(_0x2332('0x7'));module[_0x2332('0x8')]=function(_0x2bab0d,_0x24182d){return _0x2bab0d[_0x2332('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd5d=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x47bfff,_0x20f3c3){var _0x2f7c23=function(_0x18b433){while(--_0x18b433){_0x47bfff['push'](_0x47bfff['shift']());}};_0x2f7c23(++_0x20f3c3);}(_0xcd5d,0x113));var _0xdcd5=function(_0x440529,_0x245634){_0x440529=_0x440529-0x0;var _0x52ee57=_0xcd5d[_0x440529];return _0x52ee57;};'use strict';var _=require(_0xdcd5('0x0'));var util=require(_0xdcd5('0x1'));var logger=require('../../config/logger')(_0xdcd5('0x2'));var moment=require(_0xdcd5('0x3'));var BPromise=require('bluebird');var rp=require(_0xdcd5('0x4'));var fs=require('fs');var path=require(_0xdcd5('0x5'));var rimraf=require(_0xdcd5('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xdcd5('0x7')]=function(_0x573197,_0x2c1095){return _0x573197[_0xdcd5('0x8')](_0xdcd5('0x9'),attributes,{'tableName':_0xdcd5('0xa'),'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 5f566ab..4a23877 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 _0x33fd=['rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x33fd,0xf5));var _0xd33f=function(_0x34fc96,_0x102f86){_0x34fc96=_0x34fc96-0x0;var _0x391bcb=_0x33fd[_0x34fc96];return _0x391bcb;};'use strict';var _=require(_0xd33f('0x0'));var util=require(_0xd33f('0x1'));var moment=require('moment');var BPromise=require(_0xd33f('0x2'));var rs=require(_0xd33f('0x3'));var fs=require('fs');var Redis=require(_0xd33f('0x4'));var db=require(_0xd33f('0x5'))['db'];var utils=require(_0xd33f('0x6'));var logger=require(_0xd33f('0x7'))(_0xd33f('0x8'));var config=require(_0xd33f('0x9'));var jayson=require(_0xd33f('0xa'));var client=jayson[_0xd33f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8ece3,_0x321c95,_0xcbbb75){return new BPromise(function(_0x4a350d,_0x5da767){return client[_0xd33f('0xc')](_0x8ece3,_0xcbbb75)[_0xd33f('0xd')](function(_0x23c1d3){logger[_0xd33f('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x321c95,'request\x20sent');logger['debug'](_0xd33f('0xf'),_0x321c95,_0xd33f('0x10'),JSON['stringify'](_0x23c1d3));if(_0x23c1d3['error']){if(_0x23c1d3[_0xd33f('0x11')][_0xd33f('0x12')]===0x1f4){logger[_0xd33f('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x321c95,_0x23c1d3[_0xd33f('0x11')][_0xd33f('0x13')]);return _0x5da767(_0x23c1d3[_0xd33f('0x11')][_0xd33f('0x13')]);}logger[_0xd33f('0x11')](_0xd33f('0x14'),_0x321c95,_0x23c1d3[_0xd33f('0x11')][_0xd33f('0x13')]);return _0x4a350d(_0x23c1d3[_0xd33f('0x11')][_0xd33f('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x321c95,_0xd33f('0x10'));_0x4a350d(_0x23c1d3[_0xd33f('0x15')]['message']);}})[_0xd33f('0x16')](function(_0x279be7){logger[_0xd33f('0x11')](_0xd33f('0x14'),_0x321c95,_0x279be7);_0x5da767(_0x279be7);});});} \ No newline at end of file +var _0xefc6=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0xefc6,0x1bb));var _0x6efc=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xefc6[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var moment=require(_0x6efc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6efc('0x3'))['db'];var utils=require(_0x6efc('0x4'));var logger=require(_0x6efc('0x5'))(_0x6efc('0x6'));var config=require(_0x6efc('0x7'));var jayson=require(_0x6efc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7db,_0x3bf287,_0xd9e01e){return new BPromise(function(_0x574eb2,_0x2fa871){return client[_0x6efc('0x9')](_0x1e7db,_0xd9e01e)[_0x6efc('0xa')](function(_0x5e1061){logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x3bf287,'request\x20sent');logger['debug'](_0x6efc('0xd'),_0x3bf287,_0x6efc('0xe'),JSON[_0x6efc('0xf')](_0x5e1061));if(_0x5e1061[_0x6efc('0x10')]){if(_0x5e1061['error'][_0x6efc('0x11')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3bf287,_0x5e1061['error']['message']);return _0x2fa871(_0x5e1061['error'][_0x6efc('0x12')]);}logger['error'](_0x6efc('0xc'),_0x3bf287,_0x5e1061[_0x6efc('0x10')][_0x6efc('0x12')]);return _0x574eb2(_0x5e1061[_0x6efc('0x10')][_0x6efc('0x12')]);}else{logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x3bf287,_0x6efc('0xe'));_0x574eb2(_0x5e1061[_0x6efc('0x13')][_0x6efc('0x12')]);}})[_0x6efc('0x14')](function(_0x1130fa){logger['error'](_0x6efc('0xc'),_0x3bf287,_0x1130fa);_0x2fa871(_0x1130fa);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 55e9f83..43f503e 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x24a972,_0x5079b5){var _0x2d4871=function(_0xa273b2){while(--_0xa273b2){_0x24a972['push'](_0x24a972['shift']());}};_0x2d4871(++_0x5079b5);}(_0x524e,0x15e));var _0xe524=function(_0x763f2b,_0x5d6920){_0x763f2b=_0x763f2b-0x0;var _0x9ebc18=_0x524e[_0x763f2b];return _0x9ebc18;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0x28405c,_0x37dc13){var _0x53b44d=function(_0x1dfbb7){while(--_0x1dfbb7){_0x28405c['push'](_0x28405c['shift']());}};_0x53b44d(++_0x37dc13);}(_0x7a54,0x106));var _0x47a5=function(_0x2098a9,_0x59d6e7){_0x2098a9=_0x2098a9-0x0;var _0x58fcf3=_0x7a54[_0x2098a9];return _0x58fcf3;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 660e955..4b5ebb1 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 _0xe842=['exports','TEXT'];(function(_0x221764,_0x6ad5d){var _0xb8a1b2=function(_0x5ab1a6){while(--_0x5ab1a6){_0x221764['push'](_0x221764['shift']());}};_0xb8a1b2(++_0x6ad5d);}(_0xe842,0x13a));var _0x2e84=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xe842[_0x22eb96];return _0x5e1adf;};'use strict';var Sequelize=require('sequelize');module[_0x2e84('0x0')]={'tree':{'type':Sequelize[_0x2e84('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x07e3=['sequelize','exports','TEXT'];(function(_0x419918,_0x344fdb){var _0x165cf9=function(_0x5f2c1d){while(--_0x5f2c1d){_0x419918['push'](_0x419918['shift']());}};_0x165cf9(++_0x344fdb);}(_0x07e3,0xe7));var _0x307e=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x07e3[_0x14a0a0];return _0x56b651;};'use strict';var Sequelize=require(_0x307e('0x0'));module[_0x307e('0x1')]={'tree':{'type':Sequelize[_0x307e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 9dcb764..b40d313 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 _0x7f6b=['sendStatus','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','includeAll','catch','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then'];(function(_0x51caa0,_0x2f2f46){var _0xe7cc5c=function(_0x277a28){while(--_0x277a28){_0x51caa0['push'](_0x51caa0['shift']());}};_0xe7cc5c(++_0x2f2f46);}(_0x7f6b,0x19a));var _0xb7f6=function(_0x30f235,_0xf9bc88){_0x30f235=_0x30f235-0x0;var _0x4d4ccd=_0x7f6b[_0x30f235];return _0x4d4ccd;};'use strict';var pdf=require(_0xb7f6('0x0'));var emlformat=require(_0xb7f6('0x1'));var rimraf=require(_0xb7f6('0x2'));var zipdir=require(_0xb7f6('0x3'));var jsonpatch=require(_0xb7f6('0x4'));var rp=require(_0xb7f6('0x5'));var moment=require(_0xb7f6('0x6'));var BPromise=require(_0xb7f6('0x7'));var Mustache=require(_0xb7f6('0x8'));var util=require(_0xb7f6('0x9'));var path=require(_0xb7f6('0xa'));var sox=require(_0xb7f6('0xb'));var csv=require(_0xb7f6('0xc'));var ejs=require(_0xb7f6('0xd'));var fs=require('fs');var _=require(_0xb7f6('0xe'));var squel=require(_0xb7f6('0xf'));var crypto=require(_0xb7f6('0x10'));var jsforce=require(_0xb7f6('0x11'));var deskjs=require(_0xb7f6('0x12'));var toCsv=require('to-csv');var querystring=require(_0xb7f6('0x13'));var Papa=require(_0xb7f6('0x14'));var Redis=require(_0xb7f6('0x15'));var authService=require(_0xb7f6('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7f6('0x17'))(_0xb7f6('0x18'));var utils=require(_0xb7f6('0x19'));var config=require(_0xb7f6('0x1a'));var licenseUtil=require(_0xb7f6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29da82,_0x28e69d){_0x28e69d=_0x28e69d||0xcc;return function(_0x42d795){if(_0x42d795){return _0x29da82['sendStatus'](_0x28e69d);}return _0x29da82[_0xb7f6('0x1c')](_0x28e69d)[_0xb7f6('0x1d')]();};}function respondWithResult(_0x3ebae3,_0x52f4af){_0x52f4af=_0x52f4af||0xc8;return function(_0x5cbaea){if(_0x5cbaea){return _0x3ebae3[_0xb7f6('0x1c')](_0x52f4af)['json'](_0x5cbaea);}};}function respondWithFilteredResult(_0x1f1830,_0x26b94d){return function(_0xf706c7){if(_0xf706c7){var _0x28b34e=_0xf706c7[_0xb7f6('0x1e')],_0xd7475f=_0x26b94d[_0xb7f6('0x1f')],_0x298c85=_0x26b94d[_0xb7f6('0x1f')]+_0x26b94d[_0xb7f6('0x20')],_0x488544;if(_0x298c85>=_0x28b34e){_0x298c85=_0x28b34e;_0x488544=0xc8;}else{_0x488544=0xce;}_0x1f1830[_0xb7f6('0x1c')](_0x488544);return _0x1f1830['set'](_0xb7f6('0x21'),_0xd7475f+'-'+_0x298c85+'/'+_0x28b34e)[_0xb7f6('0x22')](_0xf706c7);}return null;};}function patchUpdates(_0x2b2766){return function(_0x455d13){try{jsonpatch[_0xb7f6('0x23')](_0x455d13,_0x2b2766,!![]);}catch(_0x384f57){return BPromise[_0xb7f6('0x24')](_0x384f57);}return _0x455d13[_0xb7f6('0x25')]();};}function saveUpdates(_0x425298,_0x45de97){return function(_0x95647b){if(_0x95647b){return _0x95647b[_0xb7f6('0x26')](_0x425298)['then'](function(_0x4adf93){return _0x4adf93;});}return null;};}function removeEntity(_0x5345d6,_0x39f21f){return function(_0xb2a305){if(_0xb2a305){return _0xb2a305['destroy']()[_0xb7f6('0x27')](function(){_0x5345d6['status'](0xcc)[_0xb7f6('0x1d')]();});}};}function handleEntityNotFound(_0x334b79,_0x2e8608){return function(_0x1b140a){if(!_0x1b140a){_0x334b79[_0xb7f6('0x28')](0x194);}return _0x1b140a;};}function handleError(_0x27711f,_0xc57487){_0xc57487=_0xc57487||0x1f4;return function(_0x3ab405){logger[_0xb7f6('0x29')](_0x3ab405[_0xb7f6('0x2a')]);if(_0x3ab405[_0xb7f6('0x2b')]){delete _0x3ab405['name'];}_0x27711f[_0xb7f6('0x1c')](_0xc57487)[_0xb7f6('0x2c')](_0x3ab405);};}exports['index']=function(_0x2f9ea8,_0x1a24d3){var _0x5f06e7={},_0x182321={},_0x512ea4={'count':0x0,'rows':[]};var _0x1b0067=_['map'](db[_0xb7f6('0x2d')][_0xb7f6('0x2e')],function(_0x1abcd1){return{'name':_0x1abcd1[_0xb7f6('0x2f')],'type':_0x1abcd1[_0xb7f6('0x30')][_0xb7f6('0x31')]};});_0x182321[_0xb7f6('0x32')]=_[_0xb7f6('0x33')](_0x1b0067,_0xb7f6('0x2b'));_0x182321['query']=_[_0xb7f6('0x34')](_0x2f9ea8['query']);_0x182321['filters']=_['intersection'](_0x182321[_0xb7f6('0x32')],_0x182321[_0xb7f6('0x35')]);_0x5f06e7[_0xb7f6('0x36')]=_[_0xb7f6('0x37')](_0x182321['model'],qs[_0xb7f6('0x38')](_0x2f9ea8[_0xb7f6('0x35')][_0xb7f6('0x38')]));_0x5f06e7['attributes']=_0x5f06e7[_0xb7f6('0x36')][_0xb7f6('0x39')]?_0x5f06e7[_0xb7f6('0x36')]:_0x182321[_0xb7f6('0x32')];if(!_0x2f9ea8['query']['hasOwnProperty']('nolimit')){_0x5f06e7[_0xb7f6('0x20')]=qs['limit'](_0x2f9ea8[_0xb7f6('0x35')][_0xb7f6('0x20')]);_0x5f06e7['offset']=qs[_0xb7f6('0x1f')](_0x2f9ea8[_0xb7f6('0x35')][_0xb7f6('0x1f')]);}_0x5f06e7[_0xb7f6('0x3a')]=qs[_0xb7f6('0x3b')](_0x2f9ea8[_0xb7f6('0x35')]['sort']);_0x5f06e7[_0xb7f6('0x3c')]=qs['filters'](_[_0xb7f6('0x3d')](_0x2f9ea8[_0xb7f6('0x35')],_0x182321['filters']),_0x1b0067);if(_0x2f9ea8[_0xb7f6('0x35')]['filter']){_0x5f06e7['where']=_[_0xb7f6('0x3e')](_0x5f06e7[_0xb7f6('0x3c')],{'$or':_[_0xb7f6('0x33')](_0x1b0067,function(_0x5b06a9){if(_0x5b06a9[_0xb7f6('0x30')]!==_0xb7f6('0x3f')){var _0x8bbfca={};_0x8bbfca[_0x5b06a9['name']]={'$like':'%'+_0x2f9ea8['query'][_0xb7f6('0x40')]+'%'};return _0x8bbfca;}})});}_0x5f06e7=_[_0xb7f6('0x3e')]({},_0x5f06e7,_0x2f9ea8[_0xb7f6('0x41')]);var _0xdfd268={'where':_0x5f06e7['where']};return db[_0xb7f6('0x2d')][_0xb7f6('0x1e')](_0xdfd268)['then'](function(_0x5aca39){_0x512ea4['count']=_0x5aca39;if(_0x2f9ea8['query']['includeAll']){_0x5f06e7[_0xb7f6('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb7f6('0x43')](_0x5f06e7);})[_0xb7f6('0x27')](function(_0xfeb375){_0x512ea4[_0xb7f6('0x44')]=_0xfeb375;return _0x512ea4;})[_0xb7f6('0x27')](respondWithFilteredResult(_0x1a24d3,_0x5f06e7))['catch'](handleError(_0x1a24d3,null));};exports['show']=function(_0x1b5b7b,_0x221044){var _0x552607={'raw':!![],'where':{'id':_0x1b5b7b[_0xb7f6('0x45')]['id']}},_0x5d488a={};_0x5d488a[_0xb7f6('0x32')]=_[_0xb7f6('0x34')](db[_0xb7f6('0x2d')][_0xb7f6('0x2e')]);_0x5d488a[_0xb7f6('0x35')]=_['keys'](_0x1b5b7b[_0xb7f6('0x35')]);_0x5d488a['filters']=_[_0xb7f6('0x37')](_0x5d488a[_0xb7f6('0x32')],_0x5d488a[_0xb7f6('0x35')]);_0x552607[_0xb7f6('0x36')]=_[_0xb7f6('0x37')](_0x5d488a[_0xb7f6('0x32')],qs[_0xb7f6('0x38')](_0x1b5b7b['query'][_0xb7f6('0x38')]));_0x552607[_0xb7f6('0x36')]=_0x552607['attributes'][_0xb7f6('0x39')]?_0x552607[_0xb7f6('0x36')]:_0x5d488a[_0xb7f6('0x32')];if(_0x1b5b7b['query'][_0xb7f6('0x46')]){_0x552607[_0xb7f6('0x42')]=[{'all':!![]}];}_0x552607=_[_0xb7f6('0x3e')]({},_0x552607,_0x1b5b7b[_0xb7f6('0x41')]);return db['AnalyticTreeReport']['find'](_0x552607)[_0xb7f6('0x27')](handleEntityNotFound(_0x221044,null))[_0xb7f6('0x27')](respondWithResult(_0x221044,null))[_0xb7f6('0x47')](handleError(_0x221044,null));};exports['create']=function(_0x1f99ac,_0x3bc20b){return db[_0xb7f6('0x2d')]['create'](_0x1f99ac[_0xb7f6('0x48')],{})[_0xb7f6('0x27')](respondWithResult(_0x3bc20b,0xc9))[_0xb7f6('0x47')](handleError(_0x3bc20b,null));};exports[_0xb7f6('0x26')]=function(_0x422f22,_0x446f92){if(_0x422f22[_0xb7f6('0x48')]['id']){delete _0x422f22['body']['id'];}return db[_0xb7f6('0x2d')][_0xb7f6('0x49')]({'where':{'id':_0x422f22[_0xb7f6('0x45')]['id']}})[_0xb7f6('0x27')](handleEntityNotFound(_0x446f92,null))[_0xb7f6('0x27')](saveUpdates(_0x422f22[_0xb7f6('0x48')],null))[_0xb7f6('0x27')](respondWithResult(_0x446f92,null))['catch'](handleError(_0x446f92,null));};exports[_0xb7f6('0x4a')]=function(_0x521014,_0x2a1f30){return db[_0xb7f6('0x2d')][_0xb7f6('0x49')]({'where':{'id':_0x521014[_0xb7f6('0x45')]['id']}})[_0xb7f6('0x27')](handleEntityNotFound(_0x2a1f30,null))[_0xb7f6('0x27')](removeEntity(_0x2a1f30,null))[_0xb7f6('0x47')](handleError(_0x2a1f30,null));}; \ No newline at end of file +var _0xdc5b=['fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','find','create','body','update','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','set','apply','reject','save','then','error','stack','name','index','map','AnalyticTreeReport','rawAttributes'];(function(_0x268ad0,_0x3cdfcd){var _0xc8139a=function(_0x248abd){while(--_0x248abd){_0x268ad0['push'](_0x268ad0['shift']());}};_0xc8139a(++_0x3cdfcd);}(_0xdc5b,0x132));var _0xbdc5=function(_0x388084,_0x50b9c4){_0x388084=_0x388084-0x0;var _0x5e1c74=_0xdc5b[_0x388084];return _0x5e1c74;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdc5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbdc5('0x1'));var moment=require('moment');var BPromise=require(_0xbdc5('0x2'));var Mustache=require(_0xbdc5('0x3'));var util=require(_0xbdc5('0x4'));var path=require(_0xbdc5('0x5'));var sox=require(_0xbdc5('0x6'));var csv=require(_0xbdc5('0x7'));var ejs=require(_0xbdc5('0x8'));var fs=require('fs');var _=require(_0xbdc5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbdc5('0xa'));var toCsv=require(_0xbdc5('0x7'));var querystring=require(_0xbdc5('0xb'));var Papa=require('papaparse');var Redis=require(_0xbdc5('0xc'));var authService=require(_0xbdc5('0xd'));var qs=require(_0xbdc5('0xe'));var as=require(_0xbdc5('0xf'));var hardwareService=require(_0xbdc5('0x10'));var logger=require(_0xbdc5('0x11'))(_0xbdc5('0x12'));var utils=require('../../config/utils');var config=require(_0xbdc5('0x13'));var licenseUtil=require(_0xbdc5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44cb1f,_0xfa292){_0xfa292=_0xfa292||0xcc;return function(_0x268000){if(_0x268000){return _0x44cb1f[_0xbdc5('0x15')](_0xfa292);}return _0x44cb1f['status'](_0xfa292)[_0xbdc5('0x16')]();};}function respondWithResult(_0xe74271,_0x4bf0d5){_0x4bf0d5=_0x4bf0d5||0xc8;return function(_0x3ed37a){if(_0x3ed37a){return _0xe74271[_0xbdc5('0x17')](_0x4bf0d5)[_0xbdc5('0x18')](_0x3ed37a);}};}function respondWithFilteredResult(_0x467f67,_0x440052){return function(_0x592738){if(_0x592738){var _0x200902=_0x592738[_0xbdc5('0x19')],_0x1cd36c=_0x440052['offset'],_0x4ff8b9=_0x440052[_0xbdc5('0x1a')]+_0x440052['limit'],_0x2dd993;if(_0x4ff8b9>=_0x200902){_0x4ff8b9=_0x200902;_0x2dd993=0xc8;}else{_0x2dd993=0xce;}_0x467f67[_0xbdc5('0x17')](_0x2dd993);return _0x467f67[_0xbdc5('0x1b')]('Content-Range',_0x1cd36c+'-'+_0x4ff8b9+'/'+_0x200902)['json'](_0x592738);}return null;};}function patchUpdates(_0x253214){return function(_0x5aaf1c){try{jsonpatch[_0xbdc5('0x1c')](_0x5aaf1c,_0x253214,!![]);}catch(_0x5461bf){return BPromise[_0xbdc5('0x1d')](_0x5461bf);}return _0x5aaf1c[_0xbdc5('0x1e')]();};}function saveUpdates(_0x541d74,_0x2e62db){return function(_0x59c22d){if(_0x59c22d){return _0x59c22d['update'](_0x541d74)['then'](function(_0x3f863f){return _0x3f863f;});}return null;};}function removeEntity(_0x136b24,_0x17ee72){return function(_0x20f544){if(_0x20f544){return _0x20f544['destroy']()[_0xbdc5('0x1f')](function(){_0x136b24[_0xbdc5('0x17')](0xcc)[_0xbdc5('0x16')]();});}};}function handleEntityNotFound(_0x8779aa,_0x4c6d76){return function(_0x15e0d1){if(!_0x15e0d1){_0x8779aa['sendStatus'](0x194);}return _0x15e0d1;};}function handleError(_0x45e9ff,_0xb0154){_0xb0154=_0xb0154||0x1f4;return function(_0x50840a){logger[_0xbdc5('0x20')](_0x50840a[_0xbdc5('0x21')]);if(_0x50840a[_0xbdc5('0x22')]){delete _0x50840a[_0xbdc5('0x22')];}_0x45e9ff[_0xbdc5('0x17')](_0xb0154)['send'](_0x50840a);};}exports[_0xbdc5('0x23')]=function(_0x49215a,_0x392c52){var _0x3b5e89={},_0x365a3b={},_0x2b9fe4={'count':0x0,'rows':[]};var _0x295eb9=_[_0xbdc5('0x24')](db[_0xbdc5('0x25')][_0xbdc5('0x26')],function(_0xbd888f){return{'name':_0xbd888f[_0xbdc5('0x27')],'type':_0xbd888f['type']['key']};});_0x365a3b[_0xbdc5('0x28')]=_[_0xbdc5('0x24')](_0x295eb9,_0xbdc5('0x22'));_0x365a3b['query']=_[_0xbdc5('0x29')](_0x49215a[_0xbdc5('0x2a')]);_0x365a3b[_0xbdc5('0x2b')]=_['intersection'](_0x365a3b['model'],_0x365a3b[_0xbdc5('0x2a')]);_0x3b5e89['attributes']=_[_0xbdc5('0x2c')](_0x365a3b[_0xbdc5('0x28')],qs['fields'](_0x49215a[_0xbdc5('0x2a')]['fields']));_0x3b5e89[_0xbdc5('0x2d')]=_0x3b5e89[_0xbdc5('0x2d')][_0xbdc5('0x2e')]?_0x3b5e89[_0xbdc5('0x2d')]:_0x365a3b[_0xbdc5('0x28')];if(!_0x49215a['query'][_0xbdc5('0x2f')](_0xbdc5('0x30'))){_0x3b5e89[_0xbdc5('0x31')]=qs[_0xbdc5('0x31')](_0x49215a[_0xbdc5('0x2a')]['limit']);_0x3b5e89[_0xbdc5('0x1a')]=qs[_0xbdc5('0x1a')](_0x49215a[_0xbdc5('0x2a')]['offset']);}_0x3b5e89[_0xbdc5('0x32')]=qs['sort'](_0x49215a['query'][_0xbdc5('0x33')]);_0x3b5e89[_0xbdc5('0x34')]=qs[_0xbdc5('0x2b')](_['pick'](_0x49215a[_0xbdc5('0x2a')],_0x365a3b[_0xbdc5('0x2b')]),_0x295eb9);if(_0x49215a[_0xbdc5('0x2a')][_0xbdc5('0x35')]){_0x3b5e89[_0xbdc5('0x34')]=_[_0xbdc5('0x36')](_0x3b5e89[_0xbdc5('0x34')],{'$or':_[_0xbdc5('0x24')](_0x295eb9,function(_0x1ba19b){if(_0x1ba19b[_0xbdc5('0x37')]!==_0xbdc5('0x38')){var _0x43c8a5={};_0x43c8a5[_0x1ba19b['name']]={'$like':'%'+_0x49215a['query']['filter']+'%'};return _0x43c8a5;}})});}_0x3b5e89=_['merge']({},_0x3b5e89,_0x49215a[_0xbdc5('0x39')]);var _0x56dfb5={'where':_0x3b5e89[_0xbdc5('0x34')]};return db[_0xbdc5('0x25')]['count'](_0x56dfb5)[_0xbdc5('0x1f')](function(_0x38106c){_0x2b9fe4[_0xbdc5('0x19')]=_0x38106c;if(_0x49215a[_0xbdc5('0x2a')][_0xbdc5('0x3a')]){_0x3b5e89['include']=[{'all':!![]}];}return db[_0xbdc5('0x25')][_0xbdc5('0x3b')](_0x3b5e89);})[_0xbdc5('0x1f')](function(_0xa8ab41){_0x2b9fe4[_0xbdc5('0x3c')]=_0xa8ab41;return _0x2b9fe4;})[_0xbdc5('0x1f')](respondWithFilteredResult(_0x392c52,_0x3b5e89))[_0xbdc5('0x3d')](handleError(_0x392c52,null));};exports[_0xbdc5('0x3e')]=function(_0x1b7003,_0x4eff26){var _0x4f5d4={'raw':!![],'where':{'id':_0x1b7003[_0xbdc5('0x3f')]['id']}},_0x139458={};_0x139458[_0xbdc5('0x28')]=_[_0xbdc5('0x29')](db[_0xbdc5('0x25')][_0xbdc5('0x26')]);_0x139458['query']=_[_0xbdc5('0x29')](_0x1b7003[_0xbdc5('0x2a')]);_0x139458[_0xbdc5('0x2b')]=_[_0xbdc5('0x2c')](_0x139458[_0xbdc5('0x28')],_0x139458['query']);_0x4f5d4[_0xbdc5('0x2d')]=_[_0xbdc5('0x2c')](_0x139458['model'],qs['fields'](_0x1b7003[_0xbdc5('0x2a')][_0xbdc5('0x40')]));_0x4f5d4[_0xbdc5('0x2d')]=_0x4f5d4['attributes'][_0xbdc5('0x2e')]?_0x4f5d4['attributes']:_0x139458['model'];if(_0x1b7003[_0xbdc5('0x2a')]['includeAll']){_0x4f5d4['include']=[{'all':!![]}];}_0x4f5d4=_['merge']({},_0x4f5d4,_0x1b7003[_0xbdc5('0x39')]);return db[_0xbdc5('0x25')][_0xbdc5('0x41')](_0x4f5d4)['then'](handleEntityNotFound(_0x4eff26,null))[_0xbdc5('0x1f')](respondWithResult(_0x4eff26,null))[_0xbdc5('0x3d')](handleError(_0x4eff26,null));};exports[_0xbdc5('0x42')]=function(_0x45743e,_0x24b031){return db['AnalyticTreeReport']['create'](_0x45743e[_0xbdc5('0x43')],{})[_0xbdc5('0x1f')](respondWithResult(_0x24b031,0xc9))['catch'](handleError(_0x24b031,null));};exports[_0xbdc5('0x44')]=function(_0x50367a,_0x2128f4){if(_0x50367a[_0xbdc5('0x43')]['id']){delete _0x50367a[_0xbdc5('0x43')]['id'];}return db['AnalyticTreeReport'][_0xbdc5('0x41')]({'where':{'id':_0x50367a[_0xbdc5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2128f4,null))[_0xbdc5('0x1f')](saveUpdates(_0x50367a[_0xbdc5('0x43')],null))[_0xbdc5('0x1f')](respondWithResult(_0x2128f4,null))['catch'](handleError(_0x2128f4,null));};exports['destroy']=function(_0x4e275b,_0xaab0c1){return db[_0xbdc5('0x25')][_0xbdc5('0x41')]({'where':{'id':_0x4e275b['params']['id']}})['then'](handleEntityNotFound(_0xaab0c1,null))[_0xbdc5('0x1f')](removeEntity(_0xaab0c1,null))[_0xbdc5('0x3d')](handleError(_0xaab0c1,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 60017da..9a9f3eb 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 _0xfd50=['bluebird','path','rimraf','exports','define','analytics_report_trees','util','../../config/logger','api','moment'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xfd50,0x178));var _0x0fd5=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xfd50[_0x5d7227];return _0x15ac55;};'use strict';var _=require('lodash');var util=require(_0x0fd5('0x0'));var logger=require(_0x0fd5('0x1'))(_0x0fd5('0x2'));var moment=require(_0x0fd5('0x3'));var BPromise=require(_0x0fd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd5('0x5'));var rimraf=require(_0x0fd5('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x0fd5('0x7')]=function(_0x25c401,_0x3f390f){return _0x25c401[_0x0fd5('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x0fd5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1c5=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','bluebird'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xa1c5,0x96));var _0x5a1c=function(_0x5430d7,_0x31a4d2){_0x5430d7=_0x5430d7-0x0;var _0x3a757f=_0xa1c5[_0x5430d7];return _0x3a757f;};'use strict';var _=require(_0x5a1c('0x0'));var util=require(_0x5a1c('0x1'));var logger=require(_0x5a1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5a1c('0x3'));var rp=require(_0x5a1c('0x4'));var fs=require('fs');var path=require(_0x5a1c('0x5'));var rimraf=require('rimraf');var config=require(_0x5a1c('0x6'));var attributes=require(_0x5a1c('0x7'));module[_0x5a1c('0x8')]=function(_0x5a16d2,_0x2607fc){return _0x5a16d2[_0x5a1c('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x5a1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index d6437b2..28b91bd 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 _0x29cb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','moment'];(function(_0x5541ab,_0x43f496){var _0x499ac8=function(_0x5aaf17){while(--_0x5aaf17){_0x5541ab['push'](_0x5541ab['shift']());}};_0x499ac8(++_0x43f496);}(_0x29cb,0x186));var _0xb29c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x29cb[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb29c('0x0'));var BPromise=require(_0xb29c('0x1'));var rs=require(_0xb29c('0x2'));var fs=require('fs');var Redis=require(_0xb29c('0x3'));var db=require(_0xb29c('0x4'))['db'];var utils=require(_0xb29c('0x5'));var logger=require(_0xb29c('0x6'))(_0xb29c('0x7'));var config=require(_0xb29c('0x8'));var jayson=require(_0xb29c('0x9'));var client=jayson['client'][_0xb29c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1da669,_0xca9bbc,_0x535eba){return new BPromise(function(_0x32a855,_0x3ec9b5){return client['request'](_0x1da669,_0x535eba)[_0xb29c('0xb')](function(_0x40930f){logger['info'](_0xb29c('0xc'),_0xca9bbc,'request\x20sent');logger[_0xb29c('0xd')](_0xb29c('0xe'),_0xca9bbc,_0xb29c('0xf'),JSON[_0xb29c('0x10')](_0x40930f));if(_0x40930f['error']){if(_0x40930f['error'][_0xb29c('0x11')]===0x1f4){logger['error'](_0xb29c('0xc'),_0xca9bbc,_0x40930f[_0xb29c('0x12')][_0xb29c('0x13')]);return _0x3ec9b5(_0x40930f['error'][_0xb29c('0x13')]);}logger[_0xb29c('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0xca9bbc,_0x40930f[_0xb29c('0x12')][_0xb29c('0x13')]);return _0x32a855(_0x40930f[_0xb29c('0x12')][_0xb29c('0x13')]);}else{logger[_0xb29c('0x14')](_0xb29c('0xc'),_0xca9bbc,_0xb29c('0xf'));_0x32a855(_0x40930f[_0xb29c('0x15')][_0xb29c('0x13')]);}})[_0xb29c('0x16')](function(_0x1239b8){logger[_0xb29c('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0xca9bbc,_0x1239b8);_0x3ec9b5(_0x1239b8);});});} \ No newline at end of file +var _0x5567=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','http','request'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x5567,0x7d));var _0x7556=function(_0x3f7861,_0x472e83){_0x3f7861=_0x3f7861-0x0;var _0x4258f5=_0x5567[_0x3f7861];return _0x4258f5;};'use strict';var _=require('lodash');var util=require(_0x7556('0x0'));var moment=require(_0x7556('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7556('0x2'));var db=require(_0x7556('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7556('0x4'));var config=require(_0x7556('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7556('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x205eb2,_0x1cd1ee,_0x11d454){return new BPromise(function(_0x580114,_0x1260df){return client[_0x7556('0x7')](_0x205eb2,_0x11d454)[_0x7556('0x8')](function(_0x5d574c){logger[_0x7556('0x9')](_0x7556('0xa'),_0x1cd1ee,_0x7556('0xb'));logger[_0x7556('0xc')](_0x7556('0xd'),_0x1cd1ee,_0x7556('0xb'),JSON[_0x7556('0xe')](_0x5d574c));if(_0x5d574c[_0x7556('0xf')]){if(_0x5d574c[_0x7556('0xf')][_0x7556('0x10')]===0x1f4){logger[_0x7556('0xf')](_0x7556('0xa'),_0x1cd1ee,_0x5d574c[_0x7556('0xf')][_0x7556('0x11')]);return _0x1260df(_0x5d574c[_0x7556('0xf')][_0x7556('0x11')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x1cd1ee,_0x5d574c[_0x7556('0xf')][_0x7556('0x11')]);return _0x580114(_0x5d574c['error'][_0x7556('0x11')]);}else{logger[_0x7556('0x9')](_0x7556('0xa'),_0x1cd1ee,_0x7556('0xb'));_0x580114(_0x5d574c['result'][_0x7556('0x11')]);}})[_0x7556('0x12')](function(_0x16f2f7){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x1cd1ee,_0x16f2f7);_0x1260df(_0x16f2f7);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d3f5cdd..0f82d25 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 _0xf38e=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path'];(function(_0x500079,_0x16b837){var _0x230c59=function(_0x2b1daf){while(--_0x2b1daf){_0x500079['push'](_0x500079['shift']());}};_0x230c59(++_0x16b837);}(_0xf38e,0x162));var _0xef38=function(_0xd80a26,_0x5adbb4){_0xd80a26=_0xd80a26-0x0;var _0x575b14=_0xf38e[_0xd80a26];return _0x575b14;};'use strict';var multer=require(_0xef38('0x0'));var util=require(_0xef38('0x1'));var path=require(_0xef38('0x2'));var timeout=require('connect-timeout');var express=require(_0xef38('0x3'));var router=express[_0xef38('0x4')]();var auth=require(_0xef38('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef38('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xef38('0x7')]('/',auth[_0xef38('0x8')](),controller[_0xef38('0x9')]);router[_0xef38('0x7')](_0xef38('0xa'),auth[_0xef38('0x8')](),controller[_0xef38('0xb')]);router[_0xef38('0xc')]('/',auth[_0xef38('0x8')](),controller[_0xef38('0xd')]);router['put']('/:id',auth[_0xef38('0x8')](),controller[_0xef38('0xe')]);router['delete']('/:id',auth[_0xef38('0x8')](),controller[_0xef38('0xf')]);module[_0xef38('0x10')]=router; \ No newline at end of file +var _0x3c53=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x28106a,_0x5df2b0){var _0xa3d771=function(_0xa70ccd){while(--_0xa70ccd){_0x28106a['push'](_0x28106a['shift']());}};_0xa3d771(++_0x5df2b0);}(_0x3c53,0xaf));var _0x33c5=function(_0x14f009,_0x4d3a3c){_0x14f009=_0x14f009-0x0;var _0x3c9312=_0x3c53[_0x14f009];return _0x3c9312;};'use strict';var multer=require('multer');var util=require(_0x33c5('0x0'));var path=require(_0x33c5('0x1'));var timeout=require(_0x33c5('0x2'));var express=require('express');var router=express[_0x33c5('0x3')]();var auth=require(_0x33c5('0x4'));var interaction=require(_0x33c5('0x5'));var config=require('../../config/environment');var controller=require(_0x33c5('0x6'));router[_0x33c5('0x7')]('/',auth[_0x33c5('0x8')](),controller[_0x33c5('0x9')]);router['get'](_0x33c5('0xa'),auth[_0x33c5('0x8')](),controller['show']);router['post']('/',auth[_0x33c5('0x8')](),controller[_0x33c5('0xb')]);router['put']('/:id',auth[_0x33c5('0x8')](),controller[_0x33c5('0xc')]);router[_0x33c5('0xd')](_0x33c5('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x33c5('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 70897a4..ec9e2ec 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 _0x9e56=['sequelize','exports','STRING'];(function(_0x2dafad,_0x4a0ca7){var _0x8d1cc7=function(_0x4de812){while(--_0x4de812){_0x2dafad['push'](_0x2dafad['shift']());}};_0x8d1cc7(++_0x4a0ca7);}(_0x9e56,0x13e));var _0x69e5=function(_0x5b7711,_0x4bd810){_0x5b7711=_0x5b7711-0x0;var _0x16e558=_0x9e56[_0x5b7711];return _0x16e558;};'use strict';var Sequelize=require(_0x69e5('0x0'));module[_0x69e5('0x1')]={'name':{'type':Sequelize[_0x69e5('0x2')]},'basename':{'type':Sequelize[_0x69e5('0x2')]},'type':{'type':Sequelize[_0x69e5('0x2')]}}; \ No newline at end of file +var _0x25e1=['STRING'];(function(_0x3a8a34,_0x33825c){var _0x13791b=function(_0x5cb038){while(--_0x5cb038){_0x3a8a34['push'](_0x3a8a34['shift']());}};_0x13791b(++_0x33825c);}(_0x25e1,0xaa));var _0x125e=function(_0x5dae9d,_0xf65c85){_0x5dae9d=_0x5dae9d-0x0;var _0x1b6cc1=_0x25e1[_0x5dae9d];return _0x1b6cc1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x125e('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 82f7c6a..d1f554d 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 _0x119b=['params','find','catch','get','omit','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','server/files/attachments/','eml-format','rimraf','request-promise','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','Attachment','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','limit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x159f14,_0x8fd86){var _0x7a1cff=function(_0x449b2b){while(--_0x449b2b){_0x159f14['push'](_0x159f14['shift']());}};_0x7a1cff(++_0x8fd86);}(_0x119b,0x196));var _0xb119=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x119b[_0xb1cf84];return _0x4bad2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb119('0x0'));var rimraf=require(_0xb119('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb119('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb119('0x3'));var util=require('util');var path=require(_0xb119('0x4'));var sox=require('sox');var csv=require(_0xb119('0x5'));var ejs=require(_0xb119('0x6'));var fs=require('fs');var _=require(_0xb119('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb119('0x8'));var deskjs=require(_0xb119('0x9'));var toCsv=require(_0xb119('0x5'));var querystring=require(_0xb119('0xa'));var Papa=require('papaparse');var Redis=require(_0xb119('0xb'));var authService=require(_0xb119('0xc'));var qs=require(_0xb119('0xd'));var as=require(_0xb119('0xe'));var hardwareService=require(_0xb119('0xf'));var logger=require('../../config/logger')(_0xb119('0x10'));var utils=require('../../config/utils');var config=require(_0xb119('0x11'));var licenseUtil=require(_0xb119('0x12'));var db=require(_0xb119('0x13'))['db'];function respondWithStatusCode(_0x5af224,_0x4b9a7b){_0x4b9a7b=_0x4b9a7b||0xcc;return function(_0x1ac370){if(_0x1ac370){return _0x5af224[_0xb119('0x14')](_0x4b9a7b);}return _0x5af224[_0xb119('0x15')](_0x4b9a7b)[_0xb119('0x16')]();};}function respondWithResult(_0x1be8b2,_0x3bff48){_0x3bff48=_0x3bff48||0xc8;return function(_0x50d386){if(_0x50d386){return _0x1be8b2['status'](_0x3bff48)['json'](_0x50d386);}};}function respondWithFilteredResult(_0x478026,_0x313f0c){return function(_0x56962d){if(_0x56962d){var _0x5911ba=_0x56962d[_0xb119('0x17')],_0x40b319=_0x313f0c[_0xb119('0x18')],_0x21d173=_0x313f0c[_0xb119('0x18')]+_0x313f0c['limit'],_0x25d5ef;if(_0x21d173>=_0x5911ba){_0x21d173=_0x5911ba;_0x25d5ef=0xc8;}else{_0x25d5ef=0xce;}_0x478026[_0xb119('0x15')](_0x25d5ef);return _0x478026['set'](_0xb119('0x19'),_0x40b319+'-'+_0x21d173+'/'+_0x5911ba)[_0xb119('0x1a')](_0x56962d);}return null;};}function patchUpdates(_0x3042a7){return function(_0x24c18f){try{jsonpatch[_0xb119('0x1b')](_0x24c18f,_0x3042a7,!![]);}catch(_0xd9a957){return BPromise[_0xb119('0x1c')](_0xd9a957);}return _0x24c18f[_0xb119('0x1d')]();};}function saveUpdates(_0x5f2e94,_0x5b5e8e){return function(_0x91c480){if(_0x91c480){return _0x91c480[_0xb119('0x1e')](_0x5f2e94)[_0xb119('0x1f')](function(_0x15e3e1){return _0x15e3e1;});}return null;};}function removeEntity(_0x35f6a9,_0x460414){return function(_0x3475bd){if(_0x3475bd){return _0x3475bd[_0xb119('0x20')]()['then'](function(){_0x35f6a9['status'](0xcc)[_0xb119('0x16')]();});}};}function handleEntityNotFound(_0x3a2f3e,_0xa2999){return function(_0x17687f){if(!_0x17687f){_0x3a2f3e[_0xb119('0x14')](0x194);}return _0x17687f;};}function handleError(_0xe58e00,_0x45b5f7){_0x45b5f7=_0x45b5f7||0x1f4;return function(_0x5148c9){logger['error'](_0x5148c9[_0xb119('0x21')]);if(_0x5148c9[_0xb119('0x22')]){delete _0x5148c9['name'];}_0xe58e00[_0xb119('0x15')](_0x45b5f7)[_0xb119('0x23')](_0x5148c9);};}exports['index']=function(_0x484395,_0x452449){var _0x421cc8={},_0x1b9352={},_0x1c0d1a={'count':0x0,'rows':[]};var _0xf83831=_[_0xb119('0x24')](db[_0xb119('0x25')][_0xb119('0x26')],function(_0x2af0ac){return{'name':_0x2af0ac[_0xb119('0x27')],'type':_0x2af0ac[_0xb119('0x28')]['key']};});_0x1b9352['model']=_[_0xb119('0x24')](_0xf83831,_0xb119('0x22'));_0x1b9352[_0xb119('0x29')]=_[_0xb119('0x2a')](_0x484395['query']);_0x1b9352[_0xb119('0x2b')]=_[_0xb119('0x2c')](_0x1b9352['model'],_0x1b9352[_0xb119('0x29')]);_0x421cc8[_0xb119('0x2d')]=_[_0xb119('0x2c')](_0x1b9352[_0xb119('0x2e')],qs[_0xb119('0x2f')](_0x484395[_0xb119('0x29')][_0xb119('0x2f')]));_0x421cc8[_0xb119('0x2d')]=_0x421cc8[_0xb119('0x2d')][_0xb119('0x30')]?_0x421cc8['attributes']:_0x1b9352[_0xb119('0x2e')];if(!_0x484395[_0xb119('0x29')]['hasOwnProperty']('nolimit')){_0x421cc8[_0xb119('0x31')]=qs['limit'](_0x484395[_0xb119('0x29')][_0xb119('0x31')]);_0x421cc8[_0xb119('0x18')]=qs['offset'](_0x484395[_0xb119('0x29')][_0xb119('0x18')]);}_0x421cc8[_0xb119('0x32')]=qs['sort'](_0x484395['query']['sort']);_0x421cc8[_0xb119('0x33')]=qs[_0xb119('0x2b')](_[_0xb119('0x34')](_0x484395[_0xb119('0x29')],_0x1b9352[_0xb119('0x2b')]),_0xf83831);if(_0x484395[_0xb119('0x29')]['filter']){_0x421cc8['where']=_['merge'](_0x421cc8[_0xb119('0x33')],{'$or':_[_0xb119('0x24')](_0xf83831,function(_0x571ee6){if(_0x571ee6[_0xb119('0x28')]!==_0xb119('0x35')){var _0x4b7270={};_0x4b7270[_0x571ee6[_0xb119('0x22')]]={'$like':'%'+_0x484395[_0xb119('0x29')][_0xb119('0x36')]+'%'};return _0x4b7270;}})});}_0x421cc8=_[_0xb119('0x37')]({},_0x421cc8,_0x484395[_0xb119('0x38')]);var _0x166ce5={'where':_0x421cc8[_0xb119('0x33')]};return db[_0xb119('0x25')][_0xb119('0x17')](_0x166ce5)[_0xb119('0x1f')](function(_0x234d01){_0x1c0d1a['count']=_0x234d01;if(_0x484395['query'][_0xb119('0x39')]){_0x421cc8[_0xb119('0x3a')]=[{'all':!![]}];}return db[_0xb119('0x25')][_0xb119('0x3b')](_0x421cc8);})[_0xb119('0x1f')](function(_0x4d0321){_0x1c0d1a[_0xb119('0x3c')]=_0x4d0321;return _0x1c0d1a;})[_0xb119('0x1f')](respondWithFilteredResult(_0x452449,_0x421cc8))['catch'](handleError(_0x452449,null));};exports[_0xb119('0x3d')]=function(_0x34ab3c,_0x2078d7){var _0x400e9e={'raw':!![],'where':{'id':_0x34ab3c[_0xb119('0x3e')]['id']}},_0x265f1d={};_0x265f1d[_0xb119('0x2e')]=_[_0xb119('0x2a')](db[_0xb119('0x25')][_0xb119('0x26')]);_0x265f1d[_0xb119('0x29')]=_['keys'](_0x34ab3c[_0xb119('0x29')]);_0x265f1d['filters']=_['intersection'](_0x265f1d[_0xb119('0x2e')],_0x265f1d[_0xb119('0x29')]);_0x400e9e[_0xb119('0x2d')]=_[_0xb119('0x2c')](_0x265f1d[_0xb119('0x2e')],qs[_0xb119('0x2f')](_0x34ab3c[_0xb119('0x29')]['fields']));_0x400e9e[_0xb119('0x2d')]=_0x400e9e[_0xb119('0x2d')]['length']?_0x400e9e['attributes']:_0x265f1d[_0xb119('0x2e')];if(_0x34ab3c['query'][_0xb119('0x39')]){_0x400e9e[_0xb119('0x3a')]=[{'all':!![]}];}_0x400e9e=_[_0xb119('0x37')]({},_0x400e9e,_0x34ab3c[_0xb119('0x38')]);return db[_0xb119('0x25')][_0xb119('0x3f')](_0x400e9e)[_0xb119('0x1f')](handleEntityNotFound(_0x2078d7,null))[_0xb119('0x1f')](respondWithResult(_0x2078d7,null))[_0xb119('0x40')](handleError(_0x2078d7,null));};exports['clone']=function(_0x112178,_0x39591b){var _0x2da71a={'where':{'id':_0x112178[_0xb119('0x3e')]['id']}},_0x343035={};_0x343035[_0xb119('0x2e')]=_[_0xb119('0x2a')](db[_0xb119('0x25')][_0xb119('0x26')]);_0x2da71a[_0xb119('0x2d')]=_['intersection'](_0x343035[_0xb119('0x2e')],qs[_0xb119('0x2f')](_0x112178['query']['fields']));_0x2da71a['attributes']=_0x2da71a[_0xb119('0x2d')][_0xb119('0x30')]?_0x2da71a[_0xb119('0x2d')]:_0x343035['model'];if(_0x112178['query'][_0xb119('0x39')]){_0x2da71a['include']=[{'all':!![]}];}_0x2da71a=_[_0xb119('0x37')]({},_0x2da71a,_0x112178[_0xb119('0x38')]);return db[_0xb119('0x25')]['find'](_0x2da71a)[_0xb119('0x1f')](handleEntityNotFound(_0x39591b,null))[_0xb119('0x1f')](function(_0x5e1b88){if(_0x5e1b88){var _0x21fdf4=_0x5e1b88[_0xb119('0x41')]({'plain':!![]});_0x21fdf4=qs[_0xb119('0x42')](_0x21fdf4,['id','createdAt',_0xb119('0x43')]);_0x112178['body']=_[_0xb119('0x42')](_0x112178[_0xb119('0x44')],['id','createdAt','updatedAt']);return db[_0xb119('0x25')][_0xb119('0x45')](_[_0xb119('0x37')](_0x21fdf4,_0x112178['body']),{'include':_0x112178['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xb119('0x1f')](respondWithResult(_0x39591b,0xc9))[_0xb119('0x40')](handleError(_0x39591b,null));};exports['update']=function(_0x3a6932,_0x498abd){if(_0x3a6932[_0xb119('0x44')]['id']){delete _0x3a6932[_0xb119('0x44')]['id'];}return db['Attachment'][_0xb119('0x3f')]({'where':{'id':_0x3a6932[_0xb119('0x3e')]['id']}})[_0xb119('0x1f')](handleEntityNotFound(_0x498abd,null))[_0xb119('0x1f')](saveUpdates(_0x3a6932[_0xb119('0x44')],null))[_0xb119('0x1f')](respondWithResult(_0x498abd,null))['catch'](handleError(_0x498abd,null));};exports[_0xb119('0x20')]=function(_0x59e369,_0x1138e3){return db['Attachment'][_0xb119('0x3f')]({'where':{'id':_0x59e369['params']['id']}})['then'](handleEntityNotFound(_0x1138e3,null))[_0xb119('0x1f')](removeEntity(_0x1138e3,null))[_0xb119('0x40')](handleError(_0x1138e3,null));};exports['create']=function(_0x101aab,_0x5f4a50,_0xf58e86){_0x101aab['body']['name']=_0x101aab[_0xb119('0x46')][_0xb119('0x47')];_0x101aab[_0xb119('0x44')][_0xb119('0x48')]=_0x101aab[_0xb119('0x46')][_0xb119('0x49')];_0x101aab[_0xb119('0x44')][_0xb119('0x28')]=_0x101aab[_0xb119('0x46')][_0xb119('0x4a')];return db[_0xb119('0x25')][_0xb119('0x45')](_0x101aab['body'])[_0xb119('0x1f')](respondWithResult(_0x5f4a50,0xc9))[_0xb119('0x40')](handleError(_0x5f4a50,null));};exports[_0xb119('0x4b')]=function(_0x51a07b,_0x412959,_0x477728){return db[_0xb119('0x25')][_0xb119('0x4c')]({'where':{'id':_0x51a07b[_0xb119('0x3e')]['id']},'raw':!![]})[_0xb119('0x1f')](handleEntityNotFound(_0x412959,null))['then'](function(_0x7112e7){if(_0x7112e7){return _0x412959[_0xb119('0x4b')](path['join'](config['root'],_0xb119('0x4d'),_0x7112e7[_0xb119('0x48')]));}})[_0xb119('0x40')](handleError(_0x412959,null));}; \ No newline at end of file +var _0xc278=['attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','find','clone','length','get','createdAt','updatedAt','body','omit','create','file','basename','mimetype','download','findOne','join','eml-format','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','set','Content-Range','reject','update','then','destroy','end','stack','name','send','map','Attachment','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc278,0x1f4));var _0x8c27=function(_0x17a65d,_0x391b0d){_0x17a65d=_0x17a65d-0x0;var _0x4470f6=_0xc278[_0x17a65d];return _0x4470f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c27('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c27('0x1'));var rp=require(_0x8c27('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c27('0x3'));var util=require(_0x8c27('0x4'));var path=require(_0x8c27('0x5'));var sox=require('sox');var csv=require(_0x8c27('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c27('0x7'));var squel=require(_0x8c27('0x8'));var crypto=require(_0x8c27('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8c27('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8c27('0xb'));var Papa=require(_0x8c27('0xc'));var Redis=require(_0x8c27('0xd'));var authService=require(_0x8c27('0xe'));var qs=require(_0x8c27('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c27('0x10'));var logger=require(_0x8c27('0x11'))(_0x8c27('0x12'));var utils=require('../../config/utils');var config=require(_0x8c27('0x13'));var licenseUtil=require(_0x8c27('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30690a,_0x18c414){_0x18c414=_0x18c414||0xcc;return function(_0x2448fd){if(_0x2448fd){return _0x30690a[_0x8c27('0x15')](_0x18c414);}return _0x30690a[_0x8c27('0x16')](_0x18c414)['end']();};}function respondWithResult(_0x2c18db,_0x44f80b){_0x44f80b=_0x44f80b||0xc8;return function(_0x4e10b6){if(_0x4e10b6){return _0x2c18db['status'](_0x44f80b)[_0x8c27('0x17')](_0x4e10b6);}};}function respondWithFilteredResult(_0x52326b,_0x243050){return function(_0x5864fe){if(_0x5864fe){var _0xe96ce=_0x5864fe['count'],_0x2426f8=_0x243050[_0x8c27('0x18')],_0x33418b=_0x243050['offset']+_0x243050['limit'],_0x24bca4;if(_0x33418b>=_0xe96ce){_0x33418b=_0xe96ce;_0x24bca4=0xc8;}else{_0x24bca4=0xce;}_0x52326b[_0x8c27('0x16')](_0x24bca4);return _0x52326b[_0x8c27('0x19')](_0x8c27('0x1a'),_0x2426f8+'-'+_0x33418b+'/'+_0xe96ce)[_0x8c27('0x17')](_0x5864fe);}return null;};}function patchUpdates(_0x3942ec){return function(_0x30ecb6){try{jsonpatch['apply'](_0x30ecb6,_0x3942ec,!![]);}catch(_0x226c05){return BPromise[_0x8c27('0x1b')](_0x226c05);}return _0x30ecb6['save']();};}function saveUpdates(_0x593e35,_0x11f8a6){return function(_0x5daebb){if(_0x5daebb){return _0x5daebb[_0x8c27('0x1c')](_0x593e35)[_0x8c27('0x1d')](function(_0x1fba58){return _0x1fba58;});}return null;};}function removeEntity(_0x33e08c,_0x1e5087){return function(_0x5d55b4){if(_0x5d55b4){return _0x5d55b4[_0x8c27('0x1e')]()[_0x8c27('0x1d')](function(){_0x33e08c[_0x8c27('0x16')](0xcc)[_0x8c27('0x1f')]();});}};}function handleEntityNotFound(_0x49cce0,_0x4bc572){return function(_0x38e0e2){if(!_0x38e0e2){_0x49cce0['sendStatus'](0x194);}return _0x38e0e2;};}function handleError(_0x34a0bc,_0x4363f7){_0x4363f7=_0x4363f7||0x1f4;return function(_0x3e8ffa){logger['error'](_0x3e8ffa[_0x8c27('0x20')]);if(_0x3e8ffa[_0x8c27('0x21')]){delete _0x3e8ffa[_0x8c27('0x21')];}_0x34a0bc['status'](_0x4363f7)[_0x8c27('0x22')](_0x3e8ffa);};}exports['index']=function(_0x494abe,_0xe7a246){var _0x41e154={},_0x20bc16={},_0x4232b8={'count':0x0,'rows':[]};var _0x4b252a=_[_0x8c27('0x23')](db[_0x8c27('0x24')][_0x8c27('0x25')],function(_0x3aa08f){return{'name':_0x3aa08f[_0x8c27('0x26')],'type':_0x3aa08f[_0x8c27('0x27')]['key']};});_0x20bc16['model']=_[_0x8c27('0x23')](_0x4b252a,_0x8c27('0x21'));_0x20bc16[_0x8c27('0x28')]=_[_0x8c27('0x29')](_0x494abe['query']);_0x20bc16[_0x8c27('0x2a')]=_[_0x8c27('0x2b')](_0x20bc16[_0x8c27('0x2c')],_0x20bc16[_0x8c27('0x28')]);_0x41e154['attributes']=_[_0x8c27('0x2b')](_0x20bc16[_0x8c27('0x2c')],qs[_0x8c27('0x2d')](_0x494abe[_0x8c27('0x28')]['fields']));_0x41e154[_0x8c27('0x2e')]=_0x41e154[_0x8c27('0x2e')]['length']?_0x41e154[_0x8c27('0x2e')]:_0x20bc16[_0x8c27('0x2c')];if(!_0x494abe[_0x8c27('0x28')][_0x8c27('0x2f')]('nolimit')){_0x41e154['limit']=qs[_0x8c27('0x30')](_0x494abe[_0x8c27('0x28')][_0x8c27('0x30')]);_0x41e154[_0x8c27('0x18')]=qs[_0x8c27('0x18')](_0x494abe['query'][_0x8c27('0x18')]);}_0x41e154[_0x8c27('0x31')]=qs[_0x8c27('0x32')](_0x494abe[_0x8c27('0x28')][_0x8c27('0x32')]);_0x41e154[_0x8c27('0x33')]=qs[_0x8c27('0x2a')](_[_0x8c27('0x34')](_0x494abe[_0x8c27('0x28')],_0x20bc16[_0x8c27('0x2a')]),_0x4b252a);if(_0x494abe['query'][_0x8c27('0x35')]){_0x41e154[_0x8c27('0x33')]=_[_0x8c27('0x36')](_0x41e154[_0x8c27('0x33')],{'$or':_['map'](_0x4b252a,function(_0x31034b){if(_0x31034b[_0x8c27('0x27')]!=='VIRTUAL'){var _0x14fe74={};_0x14fe74[_0x31034b[_0x8c27('0x21')]]={'$like':'%'+_0x494abe['query']['filter']+'%'};return _0x14fe74;}})});}_0x41e154=_[_0x8c27('0x36')]({},_0x41e154,_0x494abe[_0x8c27('0x37')]);var _0x349201={'where':_0x41e154[_0x8c27('0x33')]};return db[_0x8c27('0x24')][_0x8c27('0x38')](_0x349201)[_0x8c27('0x1d')](function(_0xda5113){_0x4232b8['count']=_0xda5113;if(_0x494abe[_0x8c27('0x28')][_0x8c27('0x39')]){_0x41e154[_0x8c27('0x3a')]=[{'all':!![]}];}return db[_0x8c27('0x24')]['findAll'](_0x41e154);})['then'](function(_0x169878){_0x4232b8[_0x8c27('0x3b')]=_0x169878;return _0x4232b8;})[_0x8c27('0x1d')](respondWithFilteredResult(_0xe7a246,_0x41e154))[_0x8c27('0x3c')](handleError(_0xe7a246,null));};exports[_0x8c27('0x3d')]=function(_0x39592a,_0x435a8c){var _0x842df1={'raw':!![],'where':{'id':_0x39592a[_0x8c27('0x3e')]['id']}},_0xaf224b={};_0xaf224b[_0x8c27('0x2c')]=_['keys'](db[_0x8c27('0x24')][_0x8c27('0x25')]);_0xaf224b['query']=_['keys'](_0x39592a[_0x8c27('0x28')]);_0xaf224b[_0x8c27('0x2a')]=_[_0x8c27('0x2b')](_0xaf224b[_0x8c27('0x2c')],_0xaf224b[_0x8c27('0x28')]);_0x842df1[_0x8c27('0x2e')]=_[_0x8c27('0x2b')](_0xaf224b[_0x8c27('0x2c')],qs[_0x8c27('0x2d')](_0x39592a['query'][_0x8c27('0x2d')]));_0x842df1['attributes']=_0x842df1[_0x8c27('0x2e')]['length']?_0x842df1[_0x8c27('0x2e')]:_0xaf224b[_0x8c27('0x2c')];if(_0x39592a[_0x8c27('0x28')][_0x8c27('0x39')]){_0x842df1['include']=[{'all':!![]}];}_0x842df1=_[_0x8c27('0x36')]({},_0x842df1,_0x39592a[_0x8c27('0x37')]);return db[_0x8c27('0x24')][_0x8c27('0x3f')](_0x842df1)['then'](handleEntityNotFound(_0x435a8c,null))['then'](respondWithResult(_0x435a8c,null))[_0x8c27('0x3c')](handleError(_0x435a8c,null));};exports[_0x8c27('0x40')]=function(_0x14ecd1,_0xa77714){var _0x4eb821={'where':{'id':_0x14ecd1[_0x8c27('0x3e')]['id']}},_0x5d525b={};_0x5d525b[_0x8c27('0x2c')]=_[_0x8c27('0x29')](db['Attachment']['rawAttributes']);_0x4eb821[_0x8c27('0x2e')]=_[_0x8c27('0x2b')](_0x5d525b[_0x8c27('0x2c')],qs['fields'](_0x14ecd1[_0x8c27('0x28')][_0x8c27('0x2d')]));_0x4eb821[_0x8c27('0x2e')]=_0x4eb821[_0x8c27('0x2e')][_0x8c27('0x41')]?_0x4eb821[_0x8c27('0x2e')]:_0x5d525b[_0x8c27('0x2c')];if(_0x14ecd1['query'][_0x8c27('0x39')]){_0x4eb821[_0x8c27('0x3a')]=[{'all':!![]}];}_0x4eb821=_[_0x8c27('0x36')]({},_0x4eb821,_0x14ecd1['options']);return db[_0x8c27('0x24')][_0x8c27('0x3f')](_0x4eb821)[_0x8c27('0x1d')](handleEntityNotFound(_0xa77714,null))[_0x8c27('0x1d')](function(_0x1cf38b){if(_0x1cf38b){var _0x191315=_0x1cf38b[_0x8c27('0x42')]({'plain':!![]});_0x191315=qs['omit'](_0x191315,['id',_0x8c27('0x43'),_0x8c27('0x44')]);_0x14ecd1[_0x8c27('0x45')]=_[_0x8c27('0x46')](_0x14ecd1[_0x8c27('0x45')],['id',_0x8c27('0x43'),_0x8c27('0x44')]);return db[_0x8c27('0x24')][_0x8c27('0x47')](_[_0x8c27('0x36')](_0x191315,_0x14ecd1['body']),{'include':_0x14ecd1[_0x8c27('0x28')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x8c27('0x1d')](respondWithResult(_0xa77714,0xc9))[_0x8c27('0x3c')](handleError(_0xa77714,null));};exports[_0x8c27('0x1c')]=function(_0x264c1a,_0x43a999){if(_0x264c1a[_0x8c27('0x45')]['id']){delete _0x264c1a[_0x8c27('0x45')]['id'];}return db[_0x8c27('0x24')][_0x8c27('0x3f')]({'where':{'id':_0x264c1a[_0x8c27('0x3e')]['id']}})['then'](handleEntityNotFound(_0x43a999,null))[_0x8c27('0x1d')](saveUpdates(_0x264c1a['body'],null))['then'](respondWithResult(_0x43a999,null))[_0x8c27('0x3c')](handleError(_0x43a999,null));};exports['destroy']=function(_0x54c3eb,_0x4c3f63){return db[_0x8c27('0x24')][_0x8c27('0x3f')]({'where':{'id':_0x54c3eb[_0x8c27('0x3e')]['id']}})[_0x8c27('0x1d')](handleEntityNotFound(_0x4c3f63,null))[_0x8c27('0x1d')](removeEntity(_0x4c3f63,null))[_0x8c27('0x3c')](handleError(_0x4c3f63,null));};exports['create']=function(_0x336d33,_0x54a331,_0x47fcbe){_0x336d33[_0x8c27('0x45')][_0x8c27('0x21')]=_0x336d33[_0x8c27('0x48')]['originalname'];_0x336d33[_0x8c27('0x45')][_0x8c27('0x49')]=_0x336d33[_0x8c27('0x48')]['filename'];_0x336d33[_0x8c27('0x45')][_0x8c27('0x27')]=_0x336d33[_0x8c27('0x48')][_0x8c27('0x4a')];return db[_0x8c27('0x24')][_0x8c27('0x47')](_0x336d33[_0x8c27('0x45')])['then'](respondWithResult(_0x54a331,0xc9))[_0x8c27('0x3c')](handleError(_0x54a331,null));};exports[_0x8c27('0x4b')]=function(_0x1408e0,_0xba31a0,_0x1eca89){return db['Attachment'][_0x8c27('0x4c')]({'where':{'id':_0x1408e0[_0x8c27('0x3e')]['id']},'raw':!![]})[_0x8c27('0x1d')](handleEntityNotFound(_0xba31a0,null))['then'](function(_0xf47403){if(_0xf47403){return _0xba31a0[_0x8c27('0x4b')](path[_0x8c27('0x4d')](config['root'],'server/files/attachments/',_0xf47403[_0x8c27('0x49')]));}})[_0x8c27('0x3c')](handleError(_0xba31a0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d4a9ce6..f6aa74f 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 _0xbc7a=['request-promise','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util','../../config/logger','moment','bluebird'];(function(_0x39b71c,_0x25540e){var _0x22cb2e=function(_0xb21bc1){while(--_0xb21bc1){_0x39b71c['push'](_0x39b71c['shift']());}};_0x22cb2e(++_0x25540e);}(_0xbc7a,0xa4));var _0xabc7=function(_0x37461e,_0x27a44c){_0x37461e=_0x37461e-0x0;var _0xe1b236=_0xbc7a[_0x37461e];return _0xe1b236;};'use strict';var _=require(_0xabc7('0x0'));var util=require(_0xabc7('0x1'));var logger=require(_0xabc7('0x2'))('api');var moment=require(_0xabc7('0x3'));var BPromise=require(_0xabc7('0x4'));var rp=require(_0xabc7('0x5'));var fs=require('fs');var path=require(_0xabc7('0x6'));var rimraf=require(_0xabc7('0x7'));var config=require(_0xabc7('0x8'));var attributes=require('./attachment.attributes');module[_0xabc7('0x9')]=function(_0xc4f32a,_0x3a5248){return _0xc4f32a[_0xabc7('0xa')](_0xabc7('0xb'),attributes,{'tableName':_0xabc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e74=['moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','../../config/logger','api'];(function(_0x276c8d,_0x437fa6){var _0x51c99f=function(_0x474eb5){while(--_0x474eb5){_0x276c8d['push'](_0x276c8d['shift']());}};_0x51c99f(++_0x437fa6);}(_0x7e74,0xbd));var _0x47e7=function(_0x83d11d,_0x58f752){_0x83d11d=_0x83d11d-0x0;var _0x3a006f=_0x7e74[_0x83d11d];return _0x3a006f;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var logger=require(_0x47e7('0x1'))(_0x47e7('0x2'));var moment=require(_0x47e7('0x3'));var BPromise=require(_0x47e7('0x4'));var rp=require(_0x47e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47e7('0x6'));var config=require(_0x47e7('0x7'));var attributes=require(_0x47e7('0x8'));module[_0x47e7('0x9')]=function(_0xe300cf,_0x14c1b9){return _0xe300cf[_0x47e7('0xa')]('Attachment',attributes,{'tableName':_0x47e7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 67511f0..47537e4 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 _0xb797=['result','catch','CreateAttachment','Attachment','create','options','raw','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35d6bd,_0x475f2a){var _0x5f0607=function(_0x4b1606){while(--_0x4b1606){_0x35d6bd['push'](_0x35d6bd['shift']());}};_0x5f0607(++_0x475f2a);}(_0xb797,0x1a7));var _0x7b79=function(_0x5f7211,_0x335714){_0x5f7211=_0x5f7211-0x0;var _0x3714fc=_0xb797[_0x5f7211];return _0x3714fc;};'use strict';var _=require('lodash');var util=require(_0x7b79('0x0'));var moment=require(_0x7b79('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b79('0x2'));var db=require(_0x7b79('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b79('0x4'));var config=require(_0x7b79('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7b79('0x6')][_0x7b79('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5af709,_0x27d7f5,_0xca384c){return new BPromise(function(_0x29cd93,_0x133626){return client[_0x7b79('0x8')](_0x5af709,_0xca384c)[_0x7b79('0x9')](function(_0x558260){logger[_0x7b79('0xa')](_0x7b79('0xb'),_0x27d7f5,_0x7b79('0xc'));logger[_0x7b79('0xd')](_0x7b79('0xe'),_0x27d7f5,'request\x20sent',JSON[_0x7b79('0xf')](_0x558260));if(_0x558260['error']){if(_0x558260[_0x7b79('0x10')][_0x7b79('0x11')]===0x1f4){logger[_0x7b79('0x10')](_0x7b79('0xb'),_0x27d7f5,_0x558260[_0x7b79('0x10')][_0x7b79('0x12')]);return _0x133626(_0x558260[_0x7b79('0x10')][_0x7b79('0x12')]);}logger[_0x7b79('0x10')](_0x7b79('0xb'),_0x27d7f5,_0x558260[_0x7b79('0x10')][_0x7b79('0x12')]);return _0x29cd93(_0x558260[_0x7b79('0x10')][_0x7b79('0x12')]);}else{logger['info'](_0x7b79('0xb'),_0x27d7f5,'request\x20sent');_0x29cd93(_0x558260[_0x7b79('0x13')][_0x7b79('0x12')]);}})[_0x7b79('0x14')](function(_0x3f58a8){logger[_0x7b79('0x10')](_0x7b79('0xb'),_0x27d7f5,_0x3f58a8);_0x133626(_0x3f58a8);});});}exports[_0x7b79('0x15')]=function(_0x2a1ef3){var _0x47e45d=this;return new Promise(function(_0x66cffd,_0x2e4c4b){return db[_0x7b79('0x16')][_0x7b79('0x17')](_0x2a1ef3['body'],{'raw':_0x2a1ef3[_0x7b79('0x18')]?_0x2a1ef3[_0x7b79('0x18')][_0x7b79('0x19')]===undefined?!![]:![]:!![]})[_0x7b79('0x9')](function(_0x189d60){logger['info'](_0x7b79('0x15'),_0x2a1ef3);logger[_0x7b79('0xd')](_0x7b79('0x15'),_0x2a1ef3,JSON[_0x7b79('0xf')](_0x189d60));_0x66cffd(_0x189d60);})[_0x7b79('0x14')](function(_0x4c2d61){logger[_0x7b79('0x10')](_0x7b79('0x15'),_0x4c2d61[_0x7b79('0x12')],_0x2a1ef3);_0x2e4c4b(_0x47e45d[_0x7b79('0x10')](0x1f4,_0x4c2d61[_0x7b79('0x12')]));});});}; \ No newline at end of file +var _0x0be6=['raw','CreateAttachment','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','message','Attachment,\x20%s,\x20%s','result','catch','Attachment','create','body','options'];(function(_0x1024e9,_0x5a4900){var _0x45c4b2=function(_0x2bebb0){while(--_0x2bebb0){_0x1024e9['push'](_0x1024e9['shift']());}};_0x45c4b2(++_0x5a4900);}(_0x0be6,0xc7));var _0x60be=function(_0x1907b5,_0x2cbe41){_0x1907b5=_0x1907b5-0x0;var _0x4f0571=_0x0be6[_0x1907b5];return _0x4f0571;};'use strict';var _=require(_0x60be('0x0'));var util=require('util');var moment=require(_0x60be('0x1'));var BPromise=require(_0x60be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60be('0x3'));var db=require(_0x60be('0x4'))['db'];var utils=require(_0x60be('0x5'));var logger=require(_0x60be('0x6'))(_0x60be('0x7'));var config=require(_0x60be('0x8'));var jayson=require(_0x60be('0x9'));var client=jayson[_0x60be('0xa')][_0x60be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x457535,_0x1bc4f6,_0x15e8d9){return new BPromise(function(_0x4d8e62,_0x3fea75){return client['request'](_0x457535,_0x15e8d9)[_0x60be('0xc')](function(_0xa4ff60){logger[_0x60be('0xd')]('Attachment,\x20%s,\x20%s',_0x1bc4f6,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x1bc4f6,_0x60be('0xe'),JSON['stringify'](_0xa4ff60));if(_0xa4ff60[_0x60be('0xf')]){if(_0xa4ff60[_0x60be('0xf')][_0x60be('0x10')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x1bc4f6,_0xa4ff60['error']['message']);return _0x3fea75(_0xa4ff60[_0x60be('0xf')][_0x60be('0x11')]);}logger[_0x60be('0xf')](_0x60be('0x12'),_0x1bc4f6,_0xa4ff60[_0x60be('0xf')][_0x60be('0x11')]);return _0x4d8e62(_0xa4ff60['error'][_0x60be('0x11')]);}else{logger['info'](_0x60be('0x12'),_0x1bc4f6,_0x60be('0xe'));_0x4d8e62(_0xa4ff60[_0x60be('0x13')][_0x60be('0x11')]);}})[_0x60be('0x14')](function(_0x214070){logger[_0x60be('0xf')](_0x60be('0x12'),_0x1bc4f6,_0x214070);_0x3fea75(_0x214070);});});}exports['CreateAttachment']=function(_0x2af4d8){var _0x4e879f=this;return new Promise(function(_0x3a842d,_0x577e85){return db[_0x60be('0x15')][_0x60be('0x16')](_0x2af4d8[_0x60be('0x17')],{'raw':_0x2af4d8[_0x60be('0x18')]?_0x2af4d8[_0x60be('0x18')][_0x60be('0x19')]===undefined?!![]:![]:!![]})[_0x60be('0xc')](function(_0x3b1546){logger['info'](_0x60be('0x1a'),_0x2af4d8);logger[_0x60be('0x1b')](_0x60be('0x1a'),_0x2af4d8,JSON['stringify'](_0x3b1546));_0x3a842d(_0x3b1546);})[_0x60be('0x14')](function(_0x33211a){logger['error'](_0x60be('0x1a'),_0x33211a['message'],_0x2af4d8);_0x577e85(_0x4e879f[_0x60be('0xf')](0x1f4,_0x33211a[_0x60be('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b634404..c1cf585 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 _0x6db6=['../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','%s-%s','originalname','replace','single','file','put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x58339a,_0x243ba0){var _0x55d5df=function(_0x4dcf5d){while(--_0x4dcf5d){_0x58339a['push'](_0x58339a['shift']());}};_0x55d5df(++_0x243ba0);}(_0x6db6,0x1ca));var _0x66db=function(_0x3ed3a8,_0x529168){_0x3ed3a8=_0x3ed3a8-0x0;var _0x1f30ee=_0x6db6[_0x3ed3a8];return _0x1f30ee;};'use strict';var multer=require(_0x66db('0x0'));var util=require(_0x66db('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x66db('0x2'));var router=express[_0x66db('0x3')]();var auth=require(_0x66db('0x4'));var interaction=require(_0x66db('0x5'));var config=require(_0x66db('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0x66db('0x7')](),controller[_0x66db('0x8')]);router[_0x66db('0x9')](_0x66db('0xa'),auth[_0x66db('0x7')](),controller[_0x66db('0xb')]);router['get'](_0x66db('0xc'),auth[_0x66db('0x7')](),controller[_0x66db('0xd')]);router[_0x66db('0xe')](_0x66db('0xf'),auth[_0x66db('0x7')](),controller[_0x66db('0x10')]);var upload=multer({'storage':multer[_0x66db('0x11')]({'destination':function(_0x322359,_0x3c9b5e,_0xf2d659){_0xf2d659(null,path[_0x66db('0x12')](config[_0x66db('0x13')],_0x66db('0x14')));},'filename':function(_0x497f39,_0x16afbf,_0x5c2293){_0x5c2293(null,util['format'](_0x66db('0x15'),Date['now'](),_0x16afbf[_0x66db('0x16')][_0x66db('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x66db('0x18')](_0x66db('0x19')),controller['create']);router[_0x66db('0x1a')](_0x66db('0xa'),auth['isAuthenticated'](),controller[_0x66db('0x1b')]);router[_0x66db('0x1c')](_0x66db('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3af5=['util','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/attachments/','format','now','originalname','replace','post','single','file','create','put','/:id','delete','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3af5,0x1d3));var _0x53af=function(_0x5502a7,_0x325618){_0x5502a7=_0x5502a7-0x0;var _0x3946fa=_0x3af5[_0x5502a7];return _0x3946fa;};'use strict';var multer=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var path=require('path');var timeout=require(_0x53af('0x2'));var express=require(_0x53af('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x53af('0x4'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x53af('0x5')]('/',auth[_0x53af('0x6')](),controller['index']);router[_0x53af('0x5')]('/:id',auth[_0x53af('0x6')](),controller[_0x53af('0x7')]);router[_0x53af('0x5')](_0x53af('0x8'),auth[_0x53af('0x6')](),controller[_0x53af('0x9')]);router['post']('/:id/clone',auth[_0x53af('0x6')](),controller['clone']);var upload=multer({'storage':multer[_0x53af('0xa')]({'destination':function(_0x4673a9,_0x56c2ed,_0x3f6ad8){_0x3f6ad8(null,path[_0x53af('0xb')](config['root'],_0x53af('0xc')));},'filename':function(_0x294b72,_0x3366ea,_0x59285f){_0x59285f(null,util[_0x53af('0xd')]('%s-%s',Date[_0x53af('0xe')](),_0x3366ea[_0x53af('0xf')][_0x53af('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x53af('0x11')]('/',upload[_0x53af('0x12')](_0x53af('0x13')),controller[_0x53af('0x14')]);router[_0x53af('0x15')](_0x53af('0x16'),auth[_0x53af('0x6')](),controller['update']);router[_0x53af('0x17')](_0x53af('0x16'),auth[_0x53af('0x6')](),controller[_0x53af('0x18')]);module[_0x53af('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9361768..c7f8bc5 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 _0xcb09=['then','User','find','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','blockDuration','minutes','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','authenticate','google','profile','email','callback','/login','use','clientID','secret','callbackURL','findOne','allowedLoginAttempts'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcb09,0xda));var _0x9cb0=function(_0x5d87e7,_0x2af2a8){_0x5d87e7=_0x5d87e7-0x0;var _0x130e23=_0xcb09[_0x5d87e7];return _0x130e23;};'use strict';var _=require(_0x9cb0('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x9cb0('0x1'))[_0x9cb0('0x2')];var moment=require(_0x9cb0('0x3'));var db=require(_0x9cb0('0x4'))['db'];var config=require(_0x9cb0('0x5'));var signToken=require(_0x9cb0('0x6'))['signToken'];var utils=require(_0x9cb0('0x7'));exports['login']=passport[_0x9cb0('0x8')](_0x9cb0('0x9'),{'failureRedirect':'/login','scope':[_0x9cb0('0xa'),_0x9cb0('0xb')],'session':![]});exports[_0x9cb0('0xc')]=passport['authenticate'](_0x9cb0('0x9'),{'failureRedirect':_0x9cb0('0xd'),'session':![]});passport[_0x9cb0('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x9cb0('0x9')][_0x9cb0('0xf')]:'id','clientSecret':config[_0x9cb0('0x9')]?config['google']['clientSecret']:_0x9cb0('0x10'),'callbackURL':config[_0x9cb0('0x9')]?config[_0x9cb0('0x9')][_0x9cb0('0x11')]:''},function(_0x5a8ffe,_0x50507c,_0x5034dd,_0x3376d6){var _0x2737c3,_0x599970;return db['Setting'][_0x9cb0('0x12')]({'where':{'id':0x1},'attributes':[_0x9cb0('0x13'),'blockDuration'],'raw':!![]})[_0x9cb0('0x14')](function(_0x28b97f){_0x2737c3=_0x28b97f;return db[_0x9cb0('0x15')][_0x9cb0('0x16')]({'where':{'email':_['map'](_0x5034dd['emails'],_0x9cb0('0x17')),'role':{'$or':[_0x9cb0('0x18'),'user',_0x9cb0('0x19')]}}});})['then'](function(_0x339e0c){_0x599970=_0x339e0c;if(_0x599970){if(_0x599970[_0x9cb0('0x1a')]){return _0x3376d6(_0x9cb0('0x1b'));}else if(_0x2737c3['blockDuration']>0x0){if(_0x599970['blocked']){if(moment(_0x599970[_0x9cb0('0x1c')])[_0x9cb0('0x1d')](_0x2737c3[_0x9cb0('0x1e')],_0x9cb0('0x1f'))>moment()){return _0x3376d6(_0x9cb0('0x1b'));}else{return utils['clearBlockUser'](_0x599970,0x0,![],null)[_0x9cb0('0x14')](function(){return utils[_0x9cb0('0x20')](_0x599970);})[_0x9cb0('0x14')](function(){return _0x3376d6(null,_0x599970);});}}else{return utils[_0x9cb0('0x20')](_0x599970)[_0x9cb0('0x14')](function(){return _0x3376d6(null,_0x599970);});}}else{return utils[_0x9cb0('0x20')](_0x599970)['then'](function(){return _0x3376d6(null,_0x599970);});}}return _0x3376d6(_0x9cb0('0x1b'));})[_0x9cb0('0x21')](function(_0x4846e3){_0x3376d6(_0x4846e3);});})); \ No newline at end of file +var _0x05f9=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','Setting','blockDuration','then','User','find','map','emails','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked'];(function(_0x3dcd73,_0x8dda38){var _0x45711a=function(_0x94bbeb){while(--_0x94bbeb){_0x3dcd73['push'](_0x3dcd73['shift']());}};_0x45711a(++_0x8dda38);}(_0x05f9,0x1e6));var _0x905f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x05f9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x905f('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x905f('0x1'))[_0x905f('0x2')];var moment=require(_0x905f('0x3'));var db=require(_0x905f('0x4'))['db'];var config=require(_0x905f('0x5'));var signToken=require(_0x905f('0x6'))[_0x905f('0x7')];var utils=require(_0x905f('0x8'));exports[_0x905f('0x9')]=passport[_0x905f('0xa')](_0x905f('0xb'),{'failureRedirect':_0x905f('0xc'),'scope':[_0x905f('0xd'),_0x905f('0xe')],'session':![]});exports[_0x905f('0xf')]=passport[_0x905f('0xa')]('google',{'failureRedirect':_0x905f('0xc'),'session':![]});passport[_0x905f('0x10')](new GoogleStrategy({'clientID':config[_0x905f('0xb')]?config['google'][_0x905f('0x11')]:'id','clientSecret':config[_0x905f('0xb')]?config[_0x905f('0xb')][_0x905f('0x12')]:_0x905f('0x13'),'callbackURL':config['google']?config[_0x905f('0xb')][_0x905f('0x14')]:''},function(_0x6ec77e,_0x2564bb,_0x57896c,_0x480a0d){var _0x5aaab7,_0x1bd270;return db[_0x905f('0x15')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x905f('0x16')],'raw':!![]})[_0x905f('0x17')](function(_0x36f3ee){_0x5aaab7=_0x36f3ee;return db[_0x905f('0x18')][_0x905f('0x19')]({'where':{'email':_[_0x905f('0x1a')](_0x57896c[_0x905f('0x1b')],_0x905f('0x1c')),'role':{'$or':[_0x905f('0x1d'),'user',_0x905f('0x1e')]}}});})[_0x905f('0x17')](function(_0xbd933d){_0x1bd270=_0xbd933d;if(_0x1bd270){if(_0x1bd270[_0x905f('0x1f')]){return _0x480a0d(_0x905f('0x20'));}else if(_0x5aaab7[_0x905f('0x16')]>0x0){if(_0x1bd270[_0x905f('0x21')]){if(moment(_0x1bd270[_0x905f('0x22')])[_0x905f('0x23')](_0x5aaab7[_0x905f('0x16')],_0x905f('0x24'))>moment()){return _0x480a0d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x905f('0x25')](_0x1bd270,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1bd270);})[_0x905f('0x17')](function(){return _0x480a0d(null,_0x1bd270);});}}else{return utils['getLicense'](_0x1bd270)[_0x905f('0x17')](function(){return _0x480a0d(null,_0x1bd270);});}}else{return utils[_0x905f('0x26')](_0x1bd270)[_0x905f('0x17')](function(){return _0x480a0d(null,_0x1bd270);});}}return _0x480a0d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x905f('0x27')](function(_0x3dd563){_0x480a0d(_0x3dd563);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 3d37730..b487136 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 _0xa101=['passport','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa101,0x15f));var _0x1a10=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xa101[_0x1757f2];return _0x5e7212;};'use strict';var express=require(_0x1a10('0x0'));var passport=require(_0x1a10('0x1'));var router=express['Router']();var controller=require(_0x1a10('0x2'));var userController=require(_0x1a10('0x3'));var authService=require('../../components/auth/service');router[_0x1a10('0x4')]('/',controller[_0x1a10('0x5')]);router['get'](_0x1a10('0x6'),controller[_0x1a10('0x7')],authService[_0x1a10('0x8')],userController[_0x1a10('0x5')],authService[_0x1a10('0x9')]);module[_0x1a10('0xa')]=router; \ No newline at end of file +var _0xbb95=['exports','express','passport','../user/user.controller.js','../../components/auth/service','login','isMiddleware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb95,0x7f));var _0x5bb9=function(_0x133ebd,_0x5471e0){_0x133ebd=_0x133ebd-0x0;var _0xc485d4=_0xbb95[_0x133ebd];return _0xc485d4;};'use strict';var express=require(_0x5bb9('0x0'));var passport=require(_0x5bb9('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x5bb9('0x2'));var authService=require(_0x5bb9('0x3'));router['get']('/',controller[_0x5bb9('0x4')]);router['get']('/callback',controller['callback'],authService[_0x5bb9('0x5')],userController[_0x5bb9('0x4')],authService['setTokenCookie']);module[_0x5bb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 99ba9d7..a2a9fd2 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 _0xcaf2=['port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','Email\x20parameter\x20is\x20missing','body','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/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.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5a12ff,_0x2e18db){_0x5a12ff=_0x5a12ff-0x0;var _0x285f8d=_0xcaf2[_0x5a12ff];return _0x285f8d;};'use strict';var util=require(_0x2caf('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2caf('0x1'))[_0x2caf('0x2')];var jayson=require('jayson/promise');var _=require(_0x2caf('0x3'));var rs=require(_0x2caf('0x4'));var moment=require('moment');var db=require(_0x2caf('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2caf('0x6'));var client=jayson[_0x2caf('0x7')][_0x2caf('0x8')]({'port':0x232b});function localAuthenticate(_0x599ce7,_0xc44e4e,_0x314486,_0x4667c6){var _0x34e792,_0x5611aa;return db[_0x2caf('0x9')][_0x2caf('0xa')]({'where':{'id':0x1},'attributes':[_0x2caf('0xb'),_0x2caf('0xc')],'raw':!![]})[_0x2caf('0xd')](function(_0x438434){_0x34e792=_0x438434;return _0x599ce7[_0x2caf('0xa')]({'attributes':['id',_0x2caf('0xe'),_0x2caf('0xf'),'salt',_0x2caf('0x10'),_0x2caf('0x11'),_0x2caf('0x12'),_0x2caf('0x13'),_0x2caf('0x14')],'where':{'name':_0xc44e4e,'role':{'$or':[_0x2caf('0x15'),_0x2caf('0x16'),_0x2caf('0x17')]}}});})['then'](function(_0x7258b1){if(!_0x7258b1||_0x7258b1&&_0x7258b1[_0x2caf('0xe')]!==_0xc44e4e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5611aa=_0x7258b1;return _0x5611aa;}})['then'](function(){_0x5611aa['authenticate'](_0x314486,function(_0x27bca8,_0x4da5ba){var _0x388e05=_0x5611aa[_0x2caf('0x14')]+0x1;if(_0x27bca8){return _0x4667c6(_0x27bca8);}else if(!_0x4da5ba){if(_0x5611aa[_0x2caf('0x11')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else if(_0x34e792['allowedLoginAttempts']>0x0){if(_0x5611aa[_0x2caf('0x12')]){if(_0x34e792['blockDuration']>0x0){if(moment(_0x5611aa[_0x2caf('0x13')])['add'](_0x34e792['blockDuration'],_0x2caf('0x19'))>moment()){return _0x4667c6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2caf('0x1a')](_0x5611aa,_0x388e05,![],null)[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{if(_0x388e05>=_0x34e792[_0x2caf('0xb')]){return utils[_0x2caf('0x1a')](_0x5611aa,0x0,!![],moment())[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});});}else{return utils['clearBlockUser'](_0x5611aa,_0x388e05,![],null)[_0x2caf('0xd')](function(){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});});}}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{if(_0x5611aa[_0x2caf('0x11')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else if(_0x34e792[_0x2caf('0xb')]>0x0){if(_0x5611aa[_0x2caf('0x12')]){if(_0x34e792[_0x2caf('0xc')]>0x0){if(moment(_0x5611aa[_0x2caf('0x13')])[_0x2caf('0x1b')](_0x34e792[_0x2caf('0xc')],'minutes')>moment()){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else{return utils[_0x2caf('0x1a')](_0x5611aa,0x0,![],null)[_0x2caf('0xd')](function(){return utils[_0x2caf('0x1c')](_0x5611aa);})[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);});}}else{return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}}else{return utils[_0x2caf('0x1a')](_0x5611aa,0x0,![],null)[_0x2caf('0xd')](function(){return utils[_0x2caf('0x1c')](_0x5611aa);})[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);})['catch'](function(_0x6a32ac){return _0x4667c6(null,![],_0x6a32ac);});}}else{if(_0x5611aa[_0x2caf('0x12')]){return _0x4667c6(null,![],{'message':_0x2caf('0x18')});}else{return utils[_0x2caf('0x1c')](_0x5611aa)[_0x2caf('0xd')](function(){return _0x4667c6(null,_0x5611aa);});}}}});})[_0x2caf('0x1d')](function(_0x13e8d9){return _0x4667c6(null,![],_0x13e8d9);});}function sendServiceMail(_0x135977){return db[_0x2caf('0x1e')][_0x2caf('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x2caf('0xe'),_0x2caf('0x20')],'include':[{'model':db[_0x2caf('0x21')],'as':'Smtp'}]})[_0x2caf('0xd')](function(_0xda0ec5){if(!_0xda0ec5){throw new Error(_0x2caf('0x22'));}var _0x25bbfc={'tls':{'rejectUnauthorized':![]}};if(_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x24')]){_0x25bbfc[_0x2caf('0x24')]=_0xda0ec5['Smtp'][_0x2caf('0x24')];}else{_0x25bbfc[_0x2caf('0x25')]=_0xda0ec5['Smtp'][_0x2caf('0x25')];_0x25bbfc[_0x2caf('0x26')]=_0xda0ec5[_0x2caf('0x23')]['port'];_0x25bbfc[_0x2caf('0x27')]=_0xda0ec5['Smtp']['secure'];}if(_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x28')]){_0x25bbfc[_0x2caf('0x29')]={'user':_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x16')],'pass':_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x2a')]};}var _0x34d8fe={'account':_0x25bbfc,'message':_[_0x2caf('0x2b')]({'from':util['format'](_0x2caf('0x2c'),_0xda0ec5[_0x2caf('0xe')],_0xda0ec5[_0x2caf('0x20')]||_0xda0ec5[_0x2caf('0x23')][_0x2caf('0x16')])},_0x135977)};return client[_0x2caf('0x2d')](_0x2caf('0x2e'),_0x34d8fe);})[_0x2caf('0xd')](function(_0x398de1){if(_0x398de1[_0x2caf('0x2f')]){throw new Error(util[_0x2caf('0x30')](_0x2caf('0x31'),_0x398de1['error']['message']||JSON[_0x2caf('0x32')](_0x398de1[_0x2caf('0x2f')])));}return!![];});}function handleError(_0x3b5a32,_0x2f1369,_0x4e32d6){return _0x3b5a32[_0x2caf('0x33')](_0x2f1369||0x1f4)[_0x2caf('0x34')]({'message':_0x4e32d6?_0x4e32d6[_0x2caf('0x35')]||_0x4e32d6:''});}exports[_0x2caf('0x36')]=function(_0x373009,_0x3177f9,_0x2ac0b2){passport[_0x2caf('0x37')]('local',function(_0x5d8e20,_0x72d80e,_0x863fca){var _0x177254=_0x5d8e20||_0x863fca;if(_0x177254){return handleError(_0x3177f9,0x191,_0x177254);}if(!_0x72d80e){return handleError(_0x3177f9,0x194,{'message':_0x2caf('0x38')});}else{var _0x43c40f={'payload':{'id':_0x72d80e['id'],'role':_0x72d80e[_0x2caf('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x2caf('0x39')](_0x43c40f)[_0x2caf('0xd')](function(_0x2e84fd){_0x3177f9[_0x2caf('0x3a')]({'id':_0x72d80e['id'],'token':_0x2e84fd,'statusCall':'','isAlreadyLogged':_0x72d80e[_0x2caf('0x3b')]});});}})(_0x373009,_0x3177f9,_0x2ac0b2);};exports['forgot']=function(_0x35ad7f,_0x3cfd28,_0x3dc8f2){if(!_0x35ad7f['body'][_0x2caf('0x20')]){return handleError(_0x3cfd28,0x1f4,{'message':_0x2caf('0x3c')});}var _0x179597=rs['generate']();_0x35ad7f[_0x2caf('0x3d')][_0x2caf('0x20')]=_0x35ad7f['body'][_0x2caf('0x20')][_0x2caf('0x3e')]()['toLowerCase']();var _0xe5fcbf;return db[_0x2caf('0x9')][_0x2caf('0xa')]({'where':{'id':0x1},'attributes':[_0x2caf('0xb'),_0x2caf('0xc')],'raw':!![]})[_0x2caf('0xd')](function(_0x1ea1a4){_0xe5fcbf=_0x1ea1a4;return db[_0x2caf('0x3f')]['find']({'where':{'email':_0x35ad7f[_0x2caf('0x3d')]['email']}});})[_0x2caf('0xd')](function(_0x41dd0a){if(!_0x41dd0a){throw new Error(_0x2caf('0x40'));}if(_0x41dd0a['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x41dd0a[_0x2caf('0x12')]){if(moment(_0x41dd0a['blockedAt'])[_0x2caf('0x1b')](_0xe5fcbf[_0x2caf('0xc')],_0x2caf('0x19'))>moment()){throw new Error(_0x2caf('0x41'));}else{_0x41dd0a[_0x2caf('0x12')]=![];_0x41dd0a[_0x2caf('0x13')]=null;}}_0x41dd0a[_0x2caf('0x42')]=_0x179597;_0x41dd0a[_0x2caf('0x43')]=Date[_0x2caf('0x44')]()+0x36ee80;return _0x41dd0a[_0x2caf('0x45')]();})[_0x2caf('0xd')](function(){return sendServiceMail({'to':_0x35ad7f[_0x2caf('0x3d')][_0x2caf('0x20')],'subject':_0x2caf('0x46'),'text':_0x2caf('0x47')+_0x2caf('0x48')+_0x2caf('0x49')+_0x35ad7f[_0x2caf('0x4a')][_0x2caf('0x25')]+_0x2caf('0x4b')+_0x179597+'\x0a\x0a'+_0x2caf('0x4c')});})['then'](function(){_0x3cfd28[_0x2caf('0x33')](0xc8)[_0x2caf('0x34')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x44bca0){return handleError(_0x3cfd28,0x1f4,_0x44bca0);});};exports[_0x2caf('0x4d')]=function(_0x5a822d,_0x35f96b,_0x3222b3){return db[_0x2caf('0x3f')][_0x2caf('0x1f')]({'where':{'resetPasswordToken':_0x5a822d[_0x2caf('0x4e')][_0x2caf('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x2caf('0x44')]()}}})[_0x2caf('0xd')](function(_0x901625){if(!_0x901625){throw new Error(_0x2caf('0x50'));}return db[_0x2caf('0x9')][_0x2caf('0xa')]({'attributes':['id',_0x2caf('0x51'),'enforcePasswordHistory',_0x2caf('0x52')]})[_0x2caf('0xd')](function(_0x21c298){if(_0x21c298['securePassword'])authService[_0x2caf('0x53')](_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')]);if(!_0x21c298[_0x2caf('0x54')]||!_0x901625[_0x2caf('0x55')])return _0x901625;authService[_0x2caf('0x56')](_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')],_0x901625[_0x2caf('0x55')],_0x21c298[_0x2caf('0x52')]);return _0x901625;})['then'](function(){_0x901625[_0x2caf('0xf')]=_0x5a822d[_0x2caf('0x3d')][_0x2caf('0xf')];_0x901625['resetPasswordToken']=null;_0x901625[_0x2caf('0x43')]=null;return _0x901625[_0x2caf('0x45')]();});})[_0x2caf('0xd')](function(){_0x35f96b['status'](0xc8)[_0x2caf('0x34')]({'message':_0x2caf('0x57')});})[_0x2caf('0x1d')](function(_0x22668a){return handleError(_0x35f96b,0x1f4,_0x22668a);});};passport['use'](new LocalStrategy({'usernameField':_0x2caf('0xe'),'passwordField':_0x2caf('0xf')},function(_0x3822a6,_0x52f76b,_0x377111){return localAuthenticate(db[_0x2caf('0x3f')],_0x3822a6,_0x52f76b,_0x377111);})); \ No newline at end of file +var _0x741c=['SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','blockedAt','add','clearBlockUser','blockDuration','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error'];(function(_0x277a5d,_0x1fe07c){var _0x1a0e3d=function(_0x2f9387){while(--_0x2f9387){_0x277a5d['push'](_0x277a5d['shift']());}};_0x1a0e3d(++_0x1fe07c);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xc741('0x0'));var passport=require(_0xc741('0x1'));var LocalStrategy=require(_0xc741('0x2'))[_0xc741('0x3')];var jayson=require(_0xc741('0x4'));var _=require(_0xc741('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require(_0xc741('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc741('0x7'));var client=jayson[_0xc741('0x8')][_0xc741('0x9')]({'port':0x232b});function localAuthenticate(_0x133bc4,_0x3f3d82,_0x216e60,_0x46b743){var _0x598ead,_0x1ad6d9;return db[_0xc741('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xc741('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x286e7d){_0x598ead=_0x286e7d;return _0x133bc4[_0xc741('0xc')]({'attributes':['id',_0xc741('0xd'),_0xc741('0xe'),_0xc741('0xf'),_0xc741('0x10'),_0xc741('0x11'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0x3f3d82,'role':{'$or':[_0xc741('0x12'),_0xc741('0x13'),_0xc741('0x14')]}}});})[_0xc741('0x15')](function(_0x1b4442){if(!_0x1b4442||_0x1b4442&&_0x1b4442['name']!==_0x3f3d82){throw new Error(_0xc741('0x16'));}else{_0x1ad6d9=_0x1b4442;return _0x1ad6d9;}})[_0xc741('0x15')](function(){_0x1ad6d9['authenticate'](_0x216e60,function(_0xc0383,_0x3c7569){var _0xd92df7=_0x1ad6d9[_0xc741('0x17')]+0x1;if(_0xc0383){return _0x46b743(_0xc0383);}else if(!_0x3c7569){if(_0x1ad6d9[_0xc741('0x11')]){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x598ead['allowedLoginAttempts']>0x0){if(_0x1ad6d9[_0xc741('0x18')]){if(_0x598ead['blockDuration']>0x0){if(moment(_0x1ad6d9[_0xc741('0x19')])[_0xc741('0x1a')](_0x598ead['blockDuration'],'minutes')>moment()){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else{return utils[_0xc741('0x1b')](_0x1ad6d9,_0xd92df7,![],null)[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x46b743(null,![],{'message':_0xc741('0x16')});}}else{if(_0xd92df7>=_0x598ead[_0xc741('0xb')]){return utils[_0xc741('0x1b')](_0x1ad6d9,0x0,!![],moment())[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':_0xc741('0x16')});});}else{return utils[_0xc741('0x1b')](_0x1ad6d9,_0xd92df7,![],null)[_0xc741('0x15')](function(){return _0x46b743(null,![],{'message':_0xc741('0x16')});});}}}else{return _0x46b743(null,![],{'message':_0xc741('0x16')});}}else{if(_0x1ad6d9['disabled']){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else if(_0x598ead['allowedLoginAttempts']>0x0){if(_0x1ad6d9[_0xc741('0x18')]){if(_0x598ead['blockDuration']>0x0){if(moment(_0x1ad6d9[_0xc741('0x19')])[_0xc741('0x1a')](_0x598ead[_0xc741('0x1c')],'minutes')>moment()){return _0x46b743(null,![],{'message':_0xc741('0x16')});}else{return utils['clearBlockUser'](_0x1ad6d9,0x0,![],null)[_0xc741('0x15')](function(){return utils[_0xc741('0x1d')](_0x1ad6d9);})[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);});}}else{return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x1ad6d9,0x0,![],null)['then'](function(){return utils[_0xc741('0x1d')](_0x1ad6d9);})[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);})[_0xc741('0x1e')](function(_0x3f6940){return _0x46b743(null,![],_0x3f6940);});}}else{if(_0x1ad6d9[_0xc741('0x18')]){return _0x46b743(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1ad6d9)[_0xc741('0x15')](function(){return _0x46b743(null,_0x1ad6d9);});}}}});})[_0xc741('0x1e')](function(_0x102408){return _0x46b743(null,![],_0x102408);});}function sendServiceMail(_0x328793){return db[_0xc741('0x1f')][_0xc741('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xc741('0x21')],'include':[{'model':db[_0xc741('0x22')],'as':'Smtp'}]})[_0xc741('0x15')](function(_0x314fc2){if(!_0x314fc2){throw new Error(_0xc741('0x23'));}var _0x1ce361={'tls':{'rejectUnauthorized':![]}};if(_0x314fc2[_0xc741('0x24')][_0xc741('0x25')]){_0x1ce361[_0xc741('0x25')]=_0x314fc2[_0xc741('0x24')][_0xc741('0x25')];}else{_0x1ce361['host']=_0x314fc2[_0xc741('0x24')]['host'];_0x1ce361[_0xc741('0x26')]=_0x314fc2['Smtp']['port'];_0x1ce361[_0xc741('0x27')]=_0x314fc2[_0xc741('0x24')][_0xc741('0x27')];}if(_0x314fc2['Smtp'][_0xc741('0x28')]){_0x1ce361[_0xc741('0x29')]={'user':_0x314fc2[_0xc741('0x24')]['user'],'pass':_0x314fc2[_0xc741('0x24')][_0xc741('0x2a')]};}var _0x308f01={'account':_0x1ce361,'message':_[_0xc741('0x2b')]({'from':util[_0xc741('0x2c')](_0xc741('0x2d'),_0x314fc2[_0xc741('0xd')],_0x314fc2['email']||_0x314fc2['Smtp'][_0xc741('0x13')])},_0x328793)};return client[_0xc741('0x2e')](_0xc741('0x2f'),_0x308f01);})[_0xc741('0x15')](function(_0xf7953e){if(_0xf7953e[_0xc741('0x30')]){throw new Error(util['format'](_0xc741('0x31'),_0xf7953e[_0xc741('0x30')]['message']||JSON[_0xc741('0x32')](_0xf7953e[_0xc741('0x30')])));}return!![];});}function handleError(_0x7321b9,_0x560e85,_0xff5e23){return _0x7321b9[_0xc741('0x33')](_0x560e85||0x1f4)[_0xc741('0x34')]({'message':_0xff5e23?_0xff5e23[_0xc741('0x35')]||_0xff5e23:''});}exports[_0xc741('0x36')]=function(_0x823009,_0x177db8,_0x5e390d){passport[_0xc741('0x37')](_0xc741('0x38'),function(_0x2e9b96,_0x1ae74d,_0x1e4433){var _0x76288a=_0x2e9b96||_0x1e4433;if(_0x76288a){return handleError(_0x177db8,0x191,_0x76288a);}if(!_0x1ae74d){return handleError(_0x177db8,0x194,{'message':_0xc741('0x39')});}else{var _0x207fcc={'payload':{'id':_0x1ae74d['id'],'role':_0x1ae74d['role']},'options':{'expiresIn':0x15180}};return authService[_0xc741('0x3a')](_0x207fcc)[_0xc741('0x15')](function(_0x29bc62){_0x177db8[_0xc741('0x3b')]({'id':_0x1ae74d['id'],'token':_0x29bc62,'statusCall':'','isAlreadyLogged':_0x1ae74d['online']});});}})(_0x823009,_0x177db8,_0x5e390d);};exports[_0xc741('0x3c')]=function(_0x51ba7a,_0x904dd4,_0x2fe60a){if(!_0x51ba7a[_0xc741('0x3d')]['email']){return handleError(_0x904dd4,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3686b2=rs[_0xc741('0x3e')]();_0x51ba7a[_0xc741('0x3d')][_0xc741('0x21')]=_0x51ba7a[_0xc741('0x3d')][_0xc741('0x21')][_0xc741('0x3f')]()[_0xc741('0x40')]();var _0x149a5e;return db[_0xc741('0xa')][_0xc741('0xc')]({'where':{'id':0x1},'attributes':[_0xc741('0xb'),_0xc741('0x1c')],'raw':!![]})[_0xc741('0x15')](function(_0x339b5f){_0x149a5e=_0x339b5f;return db[_0xc741('0x41')][_0xc741('0x20')]({'where':{'email':_0x51ba7a['body'][_0xc741('0x21')]}});})['then'](function(_0xb425c){if(!_0xb425c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xb425c[_0xc741('0x11')]){throw new Error(_0xc741('0x42'));}if(_0xb425c['blocked']){if(moment(_0xb425c[_0xc741('0x19')])[_0xc741('0x1a')](_0x149a5e['blockDuration'],_0xc741('0x43'))>moment()){throw new Error(_0xc741('0x44'));}else{_0xb425c[_0xc741('0x18')]=![];_0xb425c[_0xc741('0x19')]=null;}}_0xb425c[_0xc741('0x45')]=_0x3686b2;_0xb425c[_0xc741('0x46')]=Date[_0xc741('0x47')]()+0x36ee80;return _0xb425c['save']();})[_0xc741('0x15')](function(){return sendServiceMail({'to':_0x51ba7a['body']['email'],'subject':_0xc741('0x48'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc741('0x49')+_0xc741('0x4a')+_0x51ba7a[_0xc741('0x4b')][_0xc741('0x4c')]+_0xc741('0x4d')+_0x3686b2+'\x0a\x0a'+_0xc741('0x4e')});})[_0xc741('0x15')](function(){_0x904dd4[_0xc741('0x33')](0xc8)[_0xc741('0x34')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x12dde4){return handleError(_0x904dd4,0x1f4,_0x12dde4);});};exports[_0xc741('0x4f')]=function(_0x319198,_0x4414db,_0x4cec0b){return db[_0xc741('0x41')]['find']({'where':{'resetPasswordToken':_0x319198[_0xc741('0x50')][_0xc741('0x51')],'resetPasswordExpires':{'$gt':Date[_0xc741('0x47')]()}}})[_0xc741('0x15')](function(_0x2a390b){if(!_0x2a390b){throw new Error(_0xc741('0x52'));}return db[_0xc741('0xa')][_0xc741('0xc')]({'attributes':['id',_0xc741('0x53'),_0xc741('0x54'),_0xc741('0x55')]})[_0xc741('0x15')](function(_0x510db2){if(_0x510db2[_0xc741('0x53')])authService[_0xc741('0x56')](_0x319198[_0xc741('0x3d')]['password']);if(!_0x510db2[_0xc741('0x54')]||!_0x2a390b[_0xc741('0x57')])return _0x2a390b;authService[_0xc741('0x58')](_0x319198[_0xc741('0x3d')]['password'],_0x2a390b[_0xc741('0x57')],_0x510db2[_0xc741('0x55')]);return _0x2a390b;})[_0xc741('0x15')](function(){_0x2a390b[_0xc741('0xe')]=_0x319198['body'][_0xc741('0xe')];_0x2a390b['resetPasswordToken']=null;_0x2a390b[_0xc741('0x46')]=null;return _0x2a390b[_0xc741('0x59')]();});})[_0xc741('0x15')](function(){_0x4414db[_0xc741('0x33')](0xc8)[_0xc741('0x34')]({'message':_0xc741('0x5a')});})['catch'](function(_0x30a4f6){return handleError(_0x4414db,0x1f4,_0x30a4f6);});};passport['use'](new LocalStrategy({'usernameField':_0xc741('0xd'),'passwordField':_0xc741('0xe')},function(_0x70eaca,_0x1d15f9,_0x168076){return localAuthenticate(db['User'],_0x70eaca,_0x1d15f9,_0x168076);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b0776bc..7add984 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 _0x5c11=['reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x328ef2,_0x3abf43){var _0x1b9348=function(_0x4673ca){while(--_0x4673ca){_0x328ef2['push'](_0x328ef2['shift']());}};_0x1b9348(++_0x3abf43);}(_0x5c11,0xa4));var _0x15c1=function(_0x5480e7,_0x2a6133){_0x5480e7=_0x5480e7-0x0;var _0x30eabf=_0x5c11[_0x5480e7];return _0x30eabf;};'use strict';var express=require(_0x15c1('0x0'));var router=express[_0x15c1('0x1')]();var controller=require(_0x15c1('0x2'));router[_0x15c1('0x3')]('/',controller['login']);router[_0x15c1('0x3')](_0x15c1('0x4'),controller[_0x15c1('0x5')]);router[_0x15c1('0x3')](_0x15c1('0x6'),controller[_0x15c1('0x7')]);module[_0x15c1('0x8')]=router; \ No newline at end of file +var _0x0c46=['post','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x5b4c7c,_0x16ec69){var _0x3293e6=function(_0x1a0e77){while(--_0x1a0e77){_0x5b4c7c['push'](_0x5b4c7c['shift']());}};_0x3293e6(++_0x16ec69);}(_0x0c46,0x1d5));var _0x60c4=function(_0x3bea85,_0x4526aa){_0x3bea85=_0x3bea85-0x0;var _0x1b1dc3=_0x0c46[_0x3bea85];return _0x1b1dc3;};'use strict';var express=require(_0x60c4('0x0'));var router=express[_0x60c4('0x1')]();var controller=require(_0x60c4('0x2'));router['post']('/',controller['login']);router[_0x60c4('0x3')](_0x60c4('0x4'),controller[_0x60c4('0x5')]);router['post'](_0x60c4('0x6'),controller[_0x60c4('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9ef1182..2c10231 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 _0x83a8=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x466b13,_0x7f20ce){var _0x5cb98c=function(_0x5c369f){while(--_0x5c369f){_0x466b13['push'](_0x466b13['shift']());}};_0x5cb98c(++_0x7f20ce);}(_0x83a8,0xcd));var _0x883a=function(_0x500700,_0x1020f2){_0x500700=_0x500700-0x0;var _0x44251d=_0x83a8[_0x500700];return _0x44251d;};'use strict';var Sequelize=require(_0x883a('0x0'));module[_0x883a('0x1')]={'name':{'type':Sequelize[_0x883a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x883a('0x2')]},'description':{'type':Sequelize[_0x883a('0x2')]},'status':{'type':Sequelize[_0x883a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x883a('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x554e=['STRING','BOOLEAN','INTEGER'];(function(_0x194d97,_0xcc8f87){var _0x218437=function(_0x7680c7){while(--_0x7680c7){_0x194d97['push'](_0x194d97['shift']());}};_0x218437(++_0xcc8f87);}(_0x554e,0x81));var _0xe554=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0x554e[_0x1de641];return _0xccacbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe554('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xe554('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe554('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe554('0x2')],'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 962e05b..d933d6c 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x939f44,_0x1e5547){var _0x43dc71=function(_0x3cecf0){while(--_0x3cecf0){_0x939f44['push'](_0x939f44['shift']());}};_0x43dc71(++_0x1e5547);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x4d4b07,_0x1c76c8){var _0x1a608f=function(_0x575c8f){while(--_0x575c8f){_0x4d4b07['push'](_0x4d4b07['shift']());}};_0x1a608f(++_0x1c76c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d1e2279..a9dfcc4 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 _0x92e7=['moment','bluebird','rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x92e7,0x1ab));var _0x792e=function(_0x3fd0d0,_0xc9a56a){_0x3fd0d0=_0x3fd0d0-0x0;var _0x35267b=_0x92e7[_0x3fd0d0];return _0x35267b;};'use strict';var _=require(_0x792e('0x0'));var util=require('util');var logger=require(_0x792e('0x1'))(_0x792e('0x2'));var moment=require(_0x792e('0x3'));var BPromise=require(_0x792e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x792e('0x5'));var config=require('../../config/environment');var attributes=require(_0x792e('0x6'));module[_0x792e('0x7')]=function(_0x517276,_0x1d9407){return _0x517276['define'](_0x792e('0x8'),attributes,{'tableName':_0x792e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea0=['define','Automation','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x28c489,_0x36a60d){var _0x1dd0a0=function(_0x3760f6){while(--_0x3760f6){_0x28c489['push'](_0x28c489['shift']());}};_0x1dd0a0(++_0x36a60d);}(_0x4ea0,0x8e));var _0x04ea=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x4ea0[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0x04ea('0x0'));var util=require('util');var logger=require(_0x04ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0x04ea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04ea('0x3'));var rimraf=require(_0x04ea('0x4'));var config=require(_0x04ea('0x5'));var attributes=require(_0x04ea('0x6'));module[_0x04ea('0x7')]=function(_0x155701,_0x6b99b){return _0x155701[_0x04ea('0x8')](_0x04ea('0x9'),attributes,{'tableName':'tools_automations','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 bcb6911..ec48ebf 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 _0x8425=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x21f1c0,_0x1d4723){var _0x1622f9=function(_0x4a6662){while(--_0x4a6662){_0x21f1c0['push'](_0x21f1c0['shift']());}};_0x1622f9(++_0x1d4723);}(_0x8425,0xf9));var _0x5842=function(_0x2be8f5,_0x4d1c48){_0x2be8f5=_0x2be8f5-0x0;var _0x36d9ad=_0x8425[_0x2be8f5];return _0x36d9ad;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var moment=require(_0x5842('0x2'));var BPromise=require(_0x5842('0x3'));var rs=require(_0x5842('0x4'));var fs=require('fs');var Redis=require(_0x5842('0x5'));var db=require(_0x5842('0x6'))['db'];var utils=require(_0x5842('0x7'));var logger=require(_0x5842('0x8'))(_0x5842('0x9'));var config=require(_0x5842('0xa'));var jayson=require(_0x5842('0xb'));var client=jayson[_0x5842('0xc')][_0x5842('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e8d83,_0x1ac88f,_0x314fd6){return new BPromise(function(_0x53ed2b,_0x4d2a59){return client['request'](_0x3e8d83,_0x314fd6)[_0x5842('0xe')](function(_0x9e2b86){logger['info']('Automation,\x20%s,\x20%s',_0x1ac88f,_0x5842('0xf'));logger[_0x5842('0x10')](_0x5842('0x11'),_0x1ac88f,_0x5842('0xf'),JSON[_0x5842('0x12')](_0x9e2b86));if(_0x9e2b86[_0x5842('0x13')]){if(_0x9e2b86[_0x5842('0x13')]['code']===0x1f4){logger[_0x5842('0x13')](_0x5842('0x14'),_0x1ac88f,_0x9e2b86['error'][_0x5842('0x15')]);return _0x4d2a59(_0x9e2b86[_0x5842('0x13')][_0x5842('0x15')]);}logger[_0x5842('0x13')]('Automation,\x20%s,\x20%s',_0x1ac88f,_0x9e2b86[_0x5842('0x13')][_0x5842('0x15')]);return _0x53ed2b(_0x9e2b86[_0x5842('0x13')][_0x5842('0x15')]);}else{logger[_0x5842('0x16')](_0x5842('0x14'),_0x1ac88f,_0x5842('0xf'));_0x53ed2b(_0x9e2b86[_0x5842('0x17')][_0x5842('0x15')]);}})[_0x5842('0x18')](function(_0x2f3943){logger[_0x5842('0x13')]('Automation,\x20%s,\x20%s',_0x1ac88f,_0x2f3943);_0x4d2a59(_0x2f3943);});});} \ No newline at end of file +var _0xb7c2=['../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa62745,_0x56d4e4){var _0x554834=function(_0x250045){while(--_0x250045){_0xa62745['push'](_0xa62745['shift']());}};_0x554834(++_0x56d4e4);}(_0xb7c2,0x114));var _0x2b7c=function(_0x133a33,_0x5df045){_0x133a33=_0x133a33-0x0;var _0x14ab55=_0xb7c2[_0x133a33];return _0x14ab55;};'use strict';var _=require(_0x2b7c('0x0'));var util=require(_0x2b7c('0x1'));var moment=require(_0x2b7c('0x2'));var BPromise=require(_0x2b7c('0x3'));var rs=require(_0x2b7c('0x4'));var fs=require('fs');var Redis=require(_0x2b7c('0x5'));var db=require(_0x2b7c('0x6'))['db'];var utils=require(_0x2b7c('0x7'));var logger=require(_0x2b7c('0x8'))(_0x2b7c('0x9'));var config=require(_0x2b7c('0xa'));var jayson=require(_0x2b7c('0xb'));var client=jayson[_0x2b7c('0xc')][_0x2b7c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2f825a,_0x173362,_0x144fe8){return new BPromise(function(_0x1b6e5c,_0x260516){return client[_0x2b7c('0xe')](_0x2f825a,_0x144fe8)[_0x2b7c('0xf')](function(_0x56ff7b){logger[_0x2b7c('0x10')](_0x2b7c('0x11'),_0x173362,_0x2b7c('0x12'));logger[_0x2b7c('0x13')](_0x2b7c('0x14'),_0x173362,_0x2b7c('0x12'),JSON[_0x2b7c('0x15')](_0x56ff7b));if(_0x56ff7b['error']){if(_0x56ff7b['error']['code']===0x1f4){logger[_0x2b7c('0x16')](_0x2b7c('0x11'),_0x173362,_0x56ff7b['error'][_0x2b7c('0x17')]);return _0x260516(_0x56ff7b[_0x2b7c('0x16')][_0x2b7c('0x17')]);}logger[_0x2b7c('0x16')](_0x2b7c('0x11'),_0x173362,_0x56ff7b['error']['message']);return _0x1b6e5c(_0x56ff7b[_0x2b7c('0x16')][_0x2b7c('0x17')]);}else{logger[_0x2b7c('0x10')](_0x2b7c('0x11'),_0x173362,_0x2b7c('0x12'));_0x1b6e5c(_0x56ff7b[_0x2b7c('0x18')]['message']);}})[_0x2b7c('0x19')](function(_0x49f007){logger[_0x2b7c('0x16')](_0x2b7c('0x11'),_0x173362,_0x49f007);_0x260516(_0x49f007);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 76793b4..27bdf09 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 _0x1dd1=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id','/:id/conditions','getConditions','get','/:id/actions','getActions','post','create','addActions','put','delete','exports','multer','util'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x1dd1,0x1e2));var _0x11dd=function(_0x2d138a,_0x38524c){_0x2d138a=_0x2d138a-0x0;var _0x1c13e9=_0x1dd1[_0x2d138a];return _0x1c13e9;};'use strict';var multer=require(_0x11dd('0x0'));var util=require(_0x11dd('0x1'));var path=require(_0x11dd('0x2'));var timeout=require(_0x11dd('0x3'));var express=require(_0x11dd('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x11dd('0x5'));var config=require(_0x11dd('0x6'));var controller=require(_0x11dd('0x7'));router['get']('/',auth[_0x11dd('0x8')](),controller[_0x11dd('0x9')]);router['get'](_0x11dd('0xa'),auth[_0x11dd('0x8')](),controller['show']);router['get'](_0x11dd('0xb'),auth[_0x11dd('0x8')](),controller[_0x11dd('0xc')]);router[_0x11dd('0xd')](_0x11dd('0xe'),auth[_0x11dd('0x8')](),controller[_0x11dd('0xf')]);router[_0x11dd('0x10')]('/',auth[_0x11dd('0x8')](),controller[_0x11dd('0x11')]);router[_0x11dd('0x10')](_0x11dd('0xb'),auth[_0x11dd('0x8')](),controller['addConditions']);router[_0x11dd('0x10')](_0x11dd('0xe'),auth[_0x11dd('0x8')](),controller[_0x11dd('0x12')]);router[_0x11dd('0x13')](_0x11dd('0xa'),auth[_0x11dd('0x8')](),controller['update']);router[_0x11dd('0x14')](_0x11dd('0xa'),auth[_0x11dd('0x8')](),controller['destroy']);module[_0x11dd('0x15')]=router; \ No newline at end of file +var _0x75a6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','post','create','addConditions','/:id/actions','addActions','put','update','delete','exports','multer','util','path'];(function(_0xe7f940,_0x5dd106){var _0x51536e=function(_0x10fe26){while(--_0x10fe26){_0xe7f940['push'](_0xe7f940['shift']());}};_0x51536e(++_0x5dd106);}(_0x75a6,0x11d));var _0x675a=function(_0x5e0219,_0x333f2d){_0x5e0219=_0x5e0219-0x0;var _0x39af73=_0x75a6[_0x5e0219];return _0x39af73;};'use strict';var multer=require(_0x675a('0x0'));var util=require(_0x675a('0x1'));var path=require(_0x675a('0x2'));var timeout=require('connect-timeout');var express=require(_0x675a('0x3'));var router=express[_0x675a('0x4')]();var auth=require(_0x675a('0x5'));var interaction=require(_0x675a('0x6'));var config=require(_0x675a('0x7'));var controller=require(_0x675a('0x8'));router[_0x675a('0x9')]('/',auth[_0x675a('0xa')](),controller['index']);router[_0x675a('0x9')](_0x675a('0xb'),auth[_0x675a('0xa')](),controller[_0x675a('0xc')]);router[_0x675a('0x9')](_0x675a('0xd'),auth['isAuthenticated'](),controller[_0x675a('0xe')]);router['get']('/:id/actions',auth[_0x675a('0xa')](),controller['getActions']);router[_0x675a('0xf')]('/',auth[_0x675a('0xa')](),controller[_0x675a('0x10')]);router[_0x675a('0xf')](_0x675a('0xd'),auth[_0x675a('0xa')](),controller[_0x675a('0x11')]);router[_0x675a('0xf')](_0x675a('0x12'),auth['isAuthenticated'](),controller[_0x675a('0x13')]);router[_0x675a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x675a('0x15')]);router[_0x675a('0x16')](_0x675a('0xb'),auth[_0x675a('0xa')](),controller['destroy']);module[_0x675a('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 19d9a0e..76a4763 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 _0xc673=['07:00-22:00,*,*,*','ENUM','always','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)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2b6d46,_0x11867e){var _0x555bdb=function(_0x11122d){while(--_0x11122d){_0x2b6d46['push'](_0x2b6d46['shift']());}};_0x555bdb(++_0x11867e);}(_0xc673,0x12c));var _0x3c67=function(_0x1d314e,_0x2e51a1){_0x1d314e=_0x1d314e-0x0;var _0x140486=_0xc673[_0x1d314e];return _0x140486;};'use strict';var Sequelize=require(_0x3c67('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c67('0x1')],'unique':_0x3c67('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3c67('0x3')),'allowNull':![],'defaultValue':_0x3c67('0x3')},'description':{'type':Sequelize[_0x3c67('0x1')]},'active':{'type':Sequelize[_0x3c67('0x4')],'defaultValue':0x0,'comment':_0x3c67('0x5')},'limitCalls':{'type':Sequelize[_0x3c67('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3c67('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3c67('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3c67('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3c67('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c67('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)[_0x3c67('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c67('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)[_0x3c67('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c67('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3c67('0x9')],'defaultValue':0x3,'comment':_0x3c67('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c67('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3c67('0xe')},'dialTimezone':{'type':Sequelize[_0x3c67('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3c67('0x1')],'defaultValue':_0x3c67('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x3c67('0x10')](_0x3c67('0x11'),'never','onlyIfOpen'),'defaultValue':_0x3c67('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3c67('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x3c67('0x6')](0x9)[_0x3c67('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3c67('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3c67('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3c67('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3c67('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3c67('0x6')](0x9)[_0x3c67('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3c67('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x3c67('0x6')](0x9)[_0x3c67('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3c67('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3c67('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3c67('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3c67('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3c67('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3c67('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3c67('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3c67('0x6')](0x9)[_0x3c67('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x3c67('0x1a'),_0x3c67('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3c67('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3c67('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3c67('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)[_0x3c67('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c67('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c67('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c67('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c67('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)[_0x3c67('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c67('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c67('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3c67('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3c67('0x6')](0x5)[_0x3c67('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x01b2=['#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x5b40bc,_0x58fafb){var _0x81e921=function(_0xdd3d45){while(--_0xdd3d45){_0x5b40bc['push'](_0x5b40bc['shift']());}};_0x81e921(++_0x58fafb);}(_0x01b2,0x112));var _0x201b=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x01b2[_0x2e3545];return _0xcf18f;};'use strict';var Sequelize=require(_0x201b('0x0'));module[_0x201b('0x1')]={'name':{'type':Sequelize[_0x201b('0x2')],'unique':_0x201b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x201b('0x4')](_0x201b('0x5')),'allowNull':![],'defaultValue':_0x201b('0x5')},'description':{'type':Sequelize[_0x201b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x201b('0x6')},'limitCalls':{'type':Sequelize[_0x201b('0x7')](0x4)[_0x201b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x201b('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x201b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x201b('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x201b('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x201b('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x201b('0x7')](0x5)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x201b('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x201b('0x7')](0x5)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x201b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x201b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x201b('0x4')]('always',_0x201b('0x11'),_0x201b('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x201b('0x13')],'defaultValue':0x0,'comment':_0x201b('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x201b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x201b('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x201b('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x201b('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x201b('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x201b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x201b('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x201b('0x7')](0x9)[_0x201b('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x201b('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x201b('0x7')](0x9)[_0x201b('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x201b('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x201b('0x7')](0x9)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x201b('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x201b('0x7')](0x5)[_0x201b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x201b('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x201b('0x7')](0x9)[_0x201b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x201b('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x201b('0x1d'),_0x201b('0x1e')),'defaultValue':_0x201b('0x1d')},'dialPrefix':{'type':Sequelize[_0x201b('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x201b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x201b('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x201b('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x201b('0x7')](0x5)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x201b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x201b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x201b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x201b('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x201b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x201b('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x201b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e99b137..5c2ea13 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 _0xa29a=['query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','IvrCampaigns','userProfileId','getHoppers','CmHopper','CampaignId','CmHopperHistory','options','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model'];(function(_0x24da0a,_0x54f20b){var _0x14a89e=function(_0x4cdbdf){while(--_0x4cdbdf){_0x24da0a['push'](_0x24da0a['shift']());}};_0x14a89e(++_0x54f20b);}(_0xa29a,0x1ee));var _0xaa29=function(_0x4b41e9,_0x547a83){_0x4b41e9=_0x4b41e9-0x0;var _0x36694e=_0xa29a[_0x4b41e9];return _0x36694e;};'use strict';var pdf=require(_0xaa29('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa29('0x1'));var jsonpatch=require(_0xaa29('0x2'));var rp=require(_0xaa29('0x3'));var moment=require(_0xaa29('0x4'));var BPromise=require(_0xaa29('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaa29('0x6'));var sox=require(_0xaa29('0x7'));var csv=require('to-csv');var ejs=require(_0xaa29('0x8'));var fs=require('fs');var _=require(_0xaa29('0x9'));var squel=require(_0xaa29('0xa'));var crypto=require(_0xaa29('0xb'));var jsforce=require(_0xaa29('0xc'));var deskjs=require(_0xaa29('0xd'));var toCsv=require(_0xaa29('0xe'));var querystring=require(_0xaa29('0xf'));var Papa=require(_0xaa29('0x10'));var Redis=require('ioredis');var authService=require(_0xaa29('0x11'));var qs=require(_0xaa29('0x12'));var as=require(_0xaa29('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa29('0x14'))(_0xaa29('0x15'));var utils=require(_0xaa29('0x16'));var config=require(_0xaa29('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa29('0x18'))['db'];function respondWithStatusCode(_0x5184fb,_0x5424bb){_0x5424bb=_0x5424bb||0xcc;return function(_0x108220){if(_0x108220){return _0x5184fb['sendStatus'](_0x5424bb);}return _0x5184fb[_0xaa29('0x19')](_0x5424bb)[_0xaa29('0x1a')]();};}function respondWithResult(_0x3371e6,_0x3a0e26){_0x3a0e26=_0x3a0e26||0xc8;return function(_0xc7422){if(_0xc7422){return _0x3371e6['status'](_0x3a0e26)['json'](_0xc7422);}};}function respondWithFilteredResult(_0x568d3e,_0x1343c8){return function(_0x29c8f6){if(_0x29c8f6){var _0x49a9f5=_0x29c8f6[_0xaa29('0x1b')],_0x3103a6=_0x1343c8['offset'],_0x285a43=_0x1343c8['offset']+_0x1343c8[_0xaa29('0x1c')],_0x522849;if(_0x285a43>=_0x49a9f5){_0x285a43=_0x49a9f5;_0x522849=0xc8;}else{_0x522849=0xce;}_0x568d3e['status'](_0x522849);return _0x568d3e[_0xaa29('0x1d')](_0xaa29('0x1e'),_0x3103a6+'-'+_0x285a43+'/'+_0x49a9f5)['json'](_0x29c8f6);}return null;};}function patchUpdates(_0x578cf9){return function(_0xdac843){try{jsonpatch[_0xaa29('0x1f')](_0xdac843,_0x578cf9,!![]);}catch(_0x267a90){return BPromise[_0xaa29('0x20')](_0x267a90);}return _0xdac843[_0xaa29('0x21')]();};}function saveUpdates(_0x24ea53,_0x40f2b7){return function(_0x28ed00){if(_0x28ed00){return _0x28ed00[_0xaa29('0x22')](_0x24ea53)[_0xaa29('0x23')](function(_0x25065f){return _0x25065f;});}return null;};}function removeEntity(_0x58034a,_0x5e8c8e){return function(_0x1b6fa8){if(_0x1b6fa8){return _0x1b6fa8[_0xaa29('0x24')]()['then'](function(){var _0x340a7a=_0x1b6fa8[_0xaa29('0x25')]({'plain':!![]});var _0x3a4a05='IvrCampaigns';return db[_0xaa29('0x26')][_0xaa29('0x24')]({'where':{'type':_0x3a4a05,'resourceId':_0x340a7a['id']}})['then'](function(){return _0x1b6fa8;});})[_0xaa29('0x23')](function(){_0x58034a[_0xaa29('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef426,_0x2e92a8){return function(_0x264be9){if(!_0x264be9){_0x2ef426['sendStatus'](0x194);}return _0x264be9;};}function handleError(_0x28f1bc,_0x58772a){_0x58772a=_0x58772a||0x1f4;return function(_0x267c93){logger[_0xaa29('0x27')](_0x267c93['stack']);if(_0x267c93[_0xaa29('0x28')]){delete _0x267c93[_0xaa29('0x28')];}_0x28f1bc['status'](_0x58772a)[_0xaa29('0x29')](_0x267c93);};}exports[_0xaa29('0x2a')]=function(_0x44351a,_0x2e8d94){var _0x11f46b={},_0x44e046={},_0x4ef57a={'count':0x0,'rows':[]};var _0x46bd26=_[_0xaa29('0x2b')](db[_0xaa29('0x2c')][_0xaa29('0x2d')],function(_0x6d2939){return{'name':_0x6d2939[_0xaa29('0x2e')],'type':_0x6d2939[_0xaa29('0x2f')][_0xaa29('0x30')]};});_0x44e046[_0xaa29('0x31')]=_[_0xaa29('0x2b')](_0x46bd26,_0xaa29('0x28'));_0x44e046[_0xaa29('0x32')]=_[_0xaa29('0x33')](_0x44351a['query']);_0x44e046['filters']=_['intersection'](_0x44e046[_0xaa29('0x31')],_0x44e046[_0xaa29('0x32')]);_0x11f46b[_0xaa29('0x34')]=_[_0xaa29('0x35')](_0x44e046[_0xaa29('0x31')],qs['fields'](_0x44351a[_0xaa29('0x32')][_0xaa29('0x36')]));_0x11f46b[_0xaa29('0x34')]=_0x11f46b['attributes']['length']?_0x11f46b[_0xaa29('0x34')]:_0x44e046[_0xaa29('0x31')];if(!_0x44351a[_0xaa29('0x32')][_0xaa29('0x37')](_0xaa29('0x38'))){_0x11f46b['limit']=qs[_0xaa29('0x1c')](_0x44351a[_0xaa29('0x32')][_0xaa29('0x1c')]);_0x11f46b[_0xaa29('0x39')]=qs[_0xaa29('0x39')](_0x44351a[_0xaa29('0x32')][_0xaa29('0x39')]);}_0x11f46b[_0xaa29('0x3a')]=qs[_0xaa29('0x3b')](_0x44351a[_0xaa29('0x32')]['sort']);_0x11f46b[_0xaa29('0x3c')]=qs[_0xaa29('0x3d')](_[_0xaa29('0x3e')](_0x44351a[_0xaa29('0x32')],_0x44e046[_0xaa29('0x3d')]),_0x46bd26);if(_0x44351a[_0xaa29('0x32')][_0xaa29('0x3f')]){_0x11f46b[_0xaa29('0x3c')]=_['merge'](_0x11f46b['where'],{'$or':_[_0xaa29('0x2b')](_0x46bd26,function(_0x592210){if(_0x592210[_0xaa29('0x2f')]!==_0xaa29('0x40')){var _0x5dfeaf={};_0x5dfeaf[_0x592210[_0xaa29('0x28')]]={'$like':'%'+_0x44351a[_0xaa29('0x32')][_0xaa29('0x3f')]+'%'};return _0x5dfeaf;}})});}_0x11f46b=_[_0xaa29('0x41')]({},_0x11f46b,_0x44351a['options']);var _0x1b2cdb={'where':_0x11f46b['where']};return db['Campaign'][_0xaa29('0x1b')](_0x1b2cdb)[_0xaa29('0x23')](function(_0x4396cd){_0x4ef57a[_0xaa29('0x1b')]=_0x4396cd;if(_0x44351a[_0xaa29('0x32')]['includeAll']){_0x11f46b[_0xaa29('0x42')]=[{'all':!![]}];}return db[_0xaa29('0x2c')][_0xaa29('0x43')](_0x11f46b);})[_0xaa29('0x23')](function(_0x3db025){_0x4ef57a[_0xaa29('0x44')]=_0x3db025;return _0x4ef57a;})['then'](respondWithFilteredResult(_0x2e8d94,_0x11f46b))['catch'](handleError(_0x2e8d94,null));};exports[_0xaa29('0x45')]=function(_0x4b6a41,_0x2bad1a){var _0x1c716b={'raw':![],'where':{'id':_0x4b6a41[_0xaa29('0x46')]['id']}},_0x44812f={};_0x44812f[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x2c')][_0xaa29('0x2d')]);_0x44812f[_0xaa29('0x32')]=_['keys'](_0x4b6a41[_0xaa29('0x32')]);_0x44812f['filters']=_[_0xaa29('0x35')](_0x44812f[_0xaa29('0x31')],_0x44812f[_0xaa29('0x32')]);_0x1c716b[_0xaa29('0x34')]=_[_0xaa29('0x35')](_0x44812f[_0xaa29('0x31')],qs[_0xaa29('0x36')](_0x4b6a41[_0xaa29('0x32')][_0xaa29('0x36')]));_0x1c716b[_0xaa29('0x34')]=_0x1c716b[_0xaa29('0x34')][_0xaa29('0x47')]?_0x1c716b[_0xaa29('0x34')]:_0x44812f[_0xaa29('0x31')];if(_0x4b6a41[_0xaa29('0x32')][_0xaa29('0x48')]){_0x1c716b[_0xaa29('0x42')]=[{'all':!![]}];}_0x1c716b=_[_0xaa29('0x41')]({},_0x1c716b,_0x4b6a41['options']);return db['Campaign'][_0xaa29('0x49')](_0x1c716b)[_0xaa29('0x23')](handleEntityNotFound(_0x2bad1a,null))[_0xaa29('0x23')](respondWithResult(_0x2bad1a,null))[_0xaa29('0x4a')](handleError(_0x2bad1a,null));};exports[_0xaa29('0x4b')]=function(_0x45f3cb,_0x525c42){return db[_0xaa29('0x2c')]['create'](_0x45f3cb[_0xaa29('0x4c')],{})[_0xaa29('0x23')](function(_0x393f9f){var _0x2b2c99=_0x45f3cb['user'][_0xaa29('0x25')]({'plain':!![]});if(!_0x2b2c99)throw new Error(_0xaa29('0x4d'));if(_0x2b2c99[_0xaa29('0x4e')]===_0xaa29('0x4f')){var _0x1d3ab9=_0x393f9f[_0xaa29('0x25')]({'plain':!![]});var _0x5d6c53='IvrCampaigns';return db[_0xaa29('0x50')][_0xaa29('0x49')]({'where':{'name':_0x5d6c53,'userProfileId':_0x2b2c99['userProfileId']},'raw':!![]})[_0xaa29('0x23')](function(_0x5c212a){if(_0x5c212a&&_0x5c212a[_0xaa29('0x51')]===0x0){return db['UserProfileResource'][_0xaa29('0x4b')]({'name':_0x1d3ab9[_0xaa29('0x28')],'resourceId':_0x1d3ab9['id'],'type':_0x5c212a[_0xaa29('0x28')],'sectionId':_0x5c212a['id']},{})[_0xaa29('0x23')](function(){return _0x393f9f;});}else{return _0x393f9f;}})[_0xaa29('0x4a')](function(_0x5bfcaa){logger['error'](_0xaa29('0x52'),_0x5bfcaa);throw _0x5bfcaa;});}return _0x393f9f;})['then'](respondWithResult(_0x525c42,0xc9))[_0xaa29('0x4a')](handleError(_0x525c42,null));};exports[_0xaa29('0x53')]=function(_0x5adba9,_0x3fefcf){var _0x2ea543={'where':{'id':_0x5adba9['params']['id']}},_0x308381={};_0x308381[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x2c')][_0xaa29('0x2d')]);_0x2ea543[_0xaa29('0x34')]=_[_0xaa29('0x35')](_0x308381[_0xaa29('0x31')],qs['fields'](_0x5adba9[_0xaa29('0x32')]['fields']));_0x2ea543[_0xaa29('0x34')]=_0x2ea543[_0xaa29('0x34')][_0xaa29('0x47')]?_0x2ea543['attributes']:_0x308381['model'];if(_0x5adba9[_0xaa29('0x32')][_0xaa29('0x48')]){_0x2ea543['include']=[{'all':!![]}];}_0x2ea543=_[_0xaa29('0x41')]({},_0x2ea543,_0x5adba9['options']);return db['Campaign'][_0xaa29('0x49')](_0x2ea543)[_0xaa29('0x23')](handleEntityNotFound(_0x3fefcf,null))[_0xaa29('0x23')](function(_0x5ed9ff){if(_0x5ed9ff){var _0x21fead=_0x5ed9ff[_0xaa29('0x25')]({'plain':!![]});_0x21fead=qs[_0xaa29('0x54')](_0x21fead,['id',_0xaa29('0x55'),_0xaa29('0x56')]);_0x5adba9[_0xaa29('0x4c')]=_[_0xaa29('0x54')](_0x5adba9[_0xaa29('0x4c')],['id',_0xaa29('0x55'),_0xaa29('0x56')]);return db['Campaign'][_0xaa29('0x4b')](_['merge'](_0x21fead,_0x5adba9[_0xaa29('0x4c')]),{'include':_0x5adba9[_0xaa29('0x32')][_0xaa29('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x2d7bcb){var _0x16ea53=_0x5adba9[_0xaa29('0x4f')][_0xaa29('0x25')]({'plain':!![]});if(!_0x16ea53)throw new Error(_0xaa29('0x4d'));if(_0x16ea53[_0xaa29('0x4e')]===_0xaa29('0x4f')){var _0x43e270=_0x2d7bcb[_0xaa29('0x25')]({'plain':!![]});var _0x45cc30=_0xaa29('0x57');return db[_0xaa29('0x50')][_0xaa29('0x49')]({'where':{'name':_0x45cc30,'userProfileId':_0x16ea53[_0xaa29('0x58')]},'raw':!![]})['then'](function(_0x5c20d3){if(_0x5c20d3&&_0x5c20d3['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa29('0x4b')]({'name':_0x43e270[_0xaa29('0x28')],'resourceId':_0x43e270['id'],'type':_0x5c20d3[_0xaa29('0x28')],'sectionId':_0x5c20d3['id']},{})[_0xaa29('0x23')](function(){return _0x2d7bcb;});}else{return _0x2d7bcb;}})[_0xaa29('0x4a')](function(_0x3d594c){logger[_0xaa29('0x27')](_0xaa29('0x52'),_0x3d594c);throw _0x3d594c;});}return _0x2d7bcb;});}})[_0xaa29('0x23')](respondWithResult(_0x3fefcf,0xc9))['catch'](handleError(_0x3fefcf,null));};exports[_0xaa29('0x22')]=function(_0x4aa255,_0x32a922){if(_0x4aa255[_0xaa29('0x4c')]['id']){delete _0x4aa255[_0xaa29('0x4c')]['id'];}return db[_0xaa29('0x2c')][_0xaa29('0x49')]({'where':{'id':_0x4aa255['params']['id']}})['then'](handleEntityNotFound(_0x32a922,null))[_0xaa29('0x23')](saveUpdates(_0x4aa255[_0xaa29('0x4c')],null))[_0xaa29('0x23')](respondWithResult(_0x32a922,null))[_0xaa29('0x4a')](handleError(_0x32a922,null));};exports[_0xaa29('0x24')]=function(_0x41ae5d,_0x2b608c){return db[_0xaa29('0x2c')]['find']({'where':{'id':_0x41ae5d[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x2b608c,null))[_0xaa29('0x23')](removeEntity(_0x2b608c,null))[_0xaa29('0x4a')](handleError(_0x2b608c,null));};exports[_0xaa29('0x59')]=function(_0x39d7fe,_0x35874f,_0xe2534b){var _0x1542e1={'raw':!![],'where':{}};var _0x2c4626={};var _0x5040ed={'count':0x0,'rows':[]};return db[_0xaa29('0x2c')]['findOne']({'where':{'id':_0x39d7fe[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x35874f,null))[_0xaa29('0x23')](function(_0x42b3f5){if(_0x42b3f5){_0x2c4626[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x5a')][_0xaa29('0x2d')]);_0x2c4626['query']=_[_0xaa29('0x33')](_0x39d7fe[_0xaa29('0x32')]);_0x2c4626[_0xaa29('0x3d')]=_['intersection'](_0x2c4626[_0xaa29('0x31')],_0x2c4626[_0xaa29('0x32')]);_0x1542e1[_0xaa29('0x34')]=_['intersection'](_0x2c4626[_0xaa29('0x31')],qs[_0xaa29('0x36')](_0x39d7fe[_0xaa29('0x32')][_0xaa29('0x36')]));_0x1542e1[_0xaa29('0x34')]=_0x1542e1[_0xaa29('0x34')]['length']?_0x1542e1[_0xaa29('0x34')]:_0x2c4626[_0xaa29('0x31')];if(!_0x39d7fe[_0xaa29('0x32')]['hasOwnProperty'](_0xaa29('0x38'))){_0x1542e1['limit']=qs[_0xaa29('0x1c')](_0x39d7fe[_0xaa29('0x32')][_0xaa29('0x1c')]);_0x1542e1[_0xaa29('0x39')]=qs[_0xaa29('0x39')](_0x39d7fe['query'][_0xaa29('0x39')]);}_0x1542e1[_0xaa29('0x3a')]=qs['sort'](_0x39d7fe['query'][_0xaa29('0x3b')]);_0x1542e1[_0xaa29('0x3c')]=qs[_0xaa29('0x3d')](_['pick'](_0x39d7fe[_0xaa29('0x32')],_0x2c4626[_0xaa29('0x3d')]));_0x1542e1[_0xaa29('0x3c')][_0xaa29('0x5b')]=_0x42b3f5['id'];if(_0x39d7fe['query'][_0xaa29('0x3f')]){_0x1542e1[_0xaa29('0x3c')]=_['merge'](_0x1542e1['where'],{'$or':_[_0xaa29('0x2b')](_0x1542e1[_0xaa29('0x34')],function(_0x265067){var _0x1f0c58={};_0x1f0c58[_0x265067]={'$like':'%'+_0x39d7fe[_0xaa29('0x32')]['filter']+'%'};return _0x1f0c58;})});}_0x1542e1=_[_0xaa29('0x41')]({},_0x1542e1,_0x39d7fe['options']);return db['CmHopper']['count']({'where':_0x1542e1['where']})['then'](function(_0x23066e){_0x5040ed[_0xaa29('0x1b')]=_0x23066e;if(_0x39d7fe['query'][_0xaa29('0x48')]){_0x1542e1[_0xaa29('0x42')]=[{'all':!![]}];}return db[_0xaa29('0x5a')][_0xaa29('0x43')](_0x1542e1);})[_0xaa29('0x23')](function(_0x228696){_0x5040ed[_0xaa29('0x44')]=_0x228696;return _0x5040ed;});}})[_0xaa29('0x23')](respondWithFilteredResult(_0x35874f,_0x1542e1))[_0xaa29('0x4a')](handleError(_0x35874f,null));};exports['getHopperHistories']=function(_0x169126,_0x176f46,_0x2a2c6f){var _0x400e1e={'raw':!![],'where':{}};var _0x4120ce={};var _0x20b60a={'count':0x0,'rows':[]};return db[_0xaa29('0x2c')]['findOne']({'where':{'id':_0x169126[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x176f46,null))[_0xaa29('0x23')](function(_0x4b1ca5){if(_0x4b1ca5){_0x4120ce[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x5c')][_0xaa29('0x2d')]);_0x4120ce[_0xaa29('0x32')]=_[_0xaa29('0x33')](_0x169126['query']);_0x4120ce[_0xaa29('0x3d')]=_[_0xaa29('0x35')](_0x4120ce[_0xaa29('0x31')],_0x4120ce['query']);_0x400e1e[_0xaa29('0x34')]=_[_0xaa29('0x35')](_0x4120ce[_0xaa29('0x31')],qs['fields'](_0x169126[_0xaa29('0x32')][_0xaa29('0x36')]));_0x400e1e[_0xaa29('0x34')]=_0x400e1e[_0xaa29('0x34')]['length']?_0x400e1e[_0xaa29('0x34')]:_0x4120ce[_0xaa29('0x31')];if(!_0x169126['query'][_0xaa29('0x37')]('nolimit')){_0x400e1e[_0xaa29('0x1c')]=qs['limit'](_0x169126[_0xaa29('0x32')]['limit']);_0x400e1e[_0xaa29('0x39')]=qs['offset'](_0x169126['query']['offset']);}_0x400e1e[_0xaa29('0x3a')]=qs[_0xaa29('0x3b')](_0x169126['query'][_0xaa29('0x3b')]);_0x400e1e['where']=qs[_0xaa29('0x3d')](_[_0xaa29('0x3e')](_0x169126['query'],_0x4120ce[_0xaa29('0x3d')]));_0x400e1e[_0xaa29('0x3c')][_0xaa29('0x5b')]=_0x4b1ca5['id'];if(_0x169126[_0xaa29('0x32')][_0xaa29('0x3f')]){_0x400e1e[_0xaa29('0x3c')]=_[_0xaa29('0x41')](_0x400e1e[_0xaa29('0x3c')],{'$or':_['map'](_0x400e1e[_0xaa29('0x34')],function(_0x404d5a){var _0x2d79ca={};_0x2d79ca[_0x404d5a]={'$like':'%'+_0x169126[_0xaa29('0x32')]['filter']+'%'};return _0x2d79ca;})});}_0x400e1e=_[_0xaa29('0x41')]({},_0x400e1e,_0x169126[_0xaa29('0x5d')]);return db['CmHopperHistory'][_0xaa29('0x1b')]({'where':_0x400e1e[_0xaa29('0x3c')]})['then'](function(_0x453bfd){_0x20b60a['count']=_0x453bfd;if(_0x169126[_0xaa29('0x32')][_0xaa29('0x48')]){_0x400e1e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x400e1e);})[_0xaa29('0x23')](function(_0x154a07){_0x20b60a[_0xaa29('0x44')]=_0x154a07;return _0x20b60a;});}})[_0xaa29('0x23')](respondWithFilteredResult(_0x176f46,_0x400e1e))[_0xaa29('0x4a')](handleError(_0x176f46,null));};exports[_0xaa29('0x5e')]=function(_0x31b4c1,_0x252102,_0x8acf67){var _0x4c0bc6={'raw':!![],'where':{}};var _0x10be39={};var _0x435abf={'count':0x0,'rows':[]};return db['Campaign'][_0xaa29('0x5f')]({'where':{'id':_0x31b4c1[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x252102,null))['then'](function(_0x234e2f){if(_0x234e2f){_0x10be39[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x60')][_0xaa29('0x2d')]);_0x10be39['query']=_['keys'](_0x31b4c1['query']);_0x10be39[_0xaa29('0x3d')]=_['intersection'](_0x10be39[_0xaa29('0x31')],_0x10be39[_0xaa29('0x32')]);_0x4c0bc6[_0xaa29('0x34')]=_[_0xaa29('0x35')](_0x10be39[_0xaa29('0x31')],qs['fields'](_0x31b4c1[_0xaa29('0x32')]['fields']));_0x4c0bc6[_0xaa29('0x34')]=_0x4c0bc6[_0xaa29('0x34')][_0xaa29('0x47')]?_0x4c0bc6[_0xaa29('0x34')]:_0x10be39['model'];if(!_0x31b4c1['query'][_0xaa29('0x37')](_0xaa29('0x38'))){_0x4c0bc6[_0xaa29('0x1c')]=qs[_0xaa29('0x1c')](_0x31b4c1[_0xaa29('0x32')][_0xaa29('0x1c')]);_0x4c0bc6[_0xaa29('0x39')]=qs[_0xaa29('0x39')](_0x31b4c1[_0xaa29('0x32')]['offset']);}_0x4c0bc6['order']=qs[_0xaa29('0x3b')](_0x31b4c1[_0xaa29('0x32')]['sort']);_0x4c0bc6[_0xaa29('0x3c')]=qs[_0xaa29('0x3d')](_[_0xaa29('0x3e')](_0x31b4c1['query'],_0x10be39[_0xaa29('0x3d')]));_0x4c0bc6[_0xaa29('0x3c')][_0xaa29('0x5b')]=_0x234e2f['id'];if(_0x31b4c1['query'][_0xaa29('0x3f')]){_0x4c0bc6[_0xaa29('0x3c')]=_[_0xaa29('0x41')](_0x4c0bc6[_0xaa29('0x3c')],{'$or':_[_0xaa29('0x2b')](_0x4c0bc6[_0xaa29('0x34')],function(_0x47652c){var _0x1425e2={};_0x1425e2[_0x47652c]={'$like':'%'+_0x31b4c1[_0xaa29('0x32')][_0xaa29('0x3f')]+'%'};return _0x1425e2;})});}_0x4c0bc6=_[_0xaa29('0x41')]({},_0x4c0bc6,_0x31b4c1[_0xaa29('0x5d')]);return db[_0xaa29('0x60')][_0xaa29('0x1b')]({'where':_0x4c0bc6['where']})[_0xaa29('0x23')](function(_0x2bf053){_0x435abf[_0xaa29('0x1b')]=_0x2bf053;if(_0x31b4c1[_0xaa29('0x32')][_0xaa29('0x48')]){_0x4c0bc6['include']=[{'all':!![]}];}return db[_0xaa29('0x60')][_0xaa29('0x43')](_0x4c0bc6);})['then'](function(_0x2164c4){_0x435abf[_0xaa29('0x44')]=_0x2164c4;return _0x435abf;});}})[_0xaa29('0x23')](respondWithFilteredResult(_0x252102,_0x4c0bc6))[_0xaa29('0x4a')](handleError(_0x252102,null));};exports[_0xaa29('0x61')]=function(_0x192eb6,_0x4b4c6b,_0x944796){var _0x1d5a14={'raw':!![],'where':{}};var _0x2125ae={};var _0x42e559={'count':0x0,'rows':[]};return db['Campaign'][_0xaa29('0x5f')]({'where':{'id':_0x192eb6[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x4b4c6b,null))[_0xaa29('0x23')](function(_0xcca37f){if(_0xcca37f){_0x2125ae[_0xaa29('0x31')]=_['keys'](db['CmHopperBlack'][_0xaa29('0x2d')]);_0x2125ae['query']=_[_0xaa29('0x33')](_0x192eb6[_0xaa29('0x32')]);_0x2125ae[_0xaa29('0x3d')]=_[_0xaa29('0x35')](_0x2125ae[_0xaa29('0x31')],_0x2125ae['query']);_0x1d5a14['attributes']=_['intersection'](_0x2125ae[_0xaa29('0x31')],qs[_0xaa29('0x36')](_0x192eb6[_0xaa29('0x32')][_0xaa29('0x36')]));_0x1d5a14[_0xaa29('0x34')]=_0x1d5a14[_0xaa29('0x34')][_0xaa29('0x47')]?_0x1d5a14['attributes']:_0x2125ae['model'];if(!_0x192eb6[_0xaa29('0x32')][_0xaa29('0x37')](_0xaa29('0x38'))){_0x1d5a14['limit']=qs['limit'](_0x192eb6[_0xaa29('0x32')]['limit']);_0x1d5a14[_0xaa29('0x39')]=qs[_0xaa29('0x39')](_0x192eb6[_0xaa29('0x32')][_0xaa29('0x39')]);}_0x1d5a14[_0xaa29('0x3a')]=qs['sort'](_0x192eb6[_0xaa29('0x32')][_0xaa29('0x3b')]);_0x1d5a14[_0xaa29('0x3c')]=qs[_0xaa29('0x3d')](_[_0xaa29('0x3e')](_0x192eb6['query'],_0x2125ae[_0xaa29('0x3d')]));_0x1d5a14[_0xaa29('0x3c')][_0xaa29('0x5b')]=_0xcca37f['id'];if(_0x192eb6[_0xaa29('0x32')][_0xaa29('0x3f')]){_0x1d5a14[_0xaa29('0x3c')]=_['merge'](_0x1d5a14['where'],{'$or':_[_0xaa29('0x2b')](_0x1d5a14[_0xaa29('0x34')],function(_0x393b1e){var _0x1fb644={};_0x1fb644[_0x393b1e]={'$like':'%'+_0x192eb6['query'][_0xaa29('0x3f')]+'%'};return _0x1fb644;})});}_0x1d5a14=_[_0xaa29('0x41')]({},_0x1d5a14,_0x192eb6[_0xaa29('0x5d')]);return db[_0xaa29('0x62')][_0xaa29('0x1b')]({'where':_0x1d5a14[_0xaa29('0x3c')]})[_0xaa29('0x23')](function(_0x2ed8d6){_0x42e559[_0xaa29('0x1b')]=_0x2ed8d6;if(_0x192eb6[_0xaa29('0x32')][_0xaa29('0x48')]){_0x1d5a14[_0xaa29('0x42')]=[{'all':!![]}];}return db[_0xaa29('0x62')][_0xaa29('0x43')](_0x1d5a14);})[_0xaa29('0x23')](function(_0x56c40c){_0x42e559[_0xaa29('0x44')]=_0x56c40c;return _0x42e559;});}})[_0xaa29('0x23')](respondWithFilteredResult(_0x4b4c6b,_0x1d5a14))[_0xaa29('0x4a')](handleError(_0x4b4c6b,null));};exports[_0xaa29('0x63')]=function(_0x3284bb,_0xdacf03,_0x592fa9){var _0x988d51={};var _0x39b8b1={};var _0x14b04b;var _0x5f1518;return db['Campaign'][_0xaa29('0x5f')]({'where':{'id':_0x3284bb[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0xdacf03,null))[_0xaa29('0x23')](function(_0x5281ca){if(_0x5281ca){_0x14b04b=_0x5281ca;_0x39b8b1[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x64')][_0xaa29('0x2d')]);_0x39b8b1[_0xaa29('0x32')]=_['keys'](_0x3284bb[_0xaa29('0x32')]);_0x39b8b1['filters']=_[_0xaa29('0x35')](_0x39b8b1[_0xaa29('0x31')],_0x39b8b1[_0xaa29('0x32')]);_0x988d51['attributes']=_['intersection'](_0x39b8b1[_0xaa29('0x31')],qs[_0xaa29('0x36')](_0x3284bb['query']['fields']));_0x988d51[_0xaa29('0x34')]=_0x988d51[_0xaa29('0x34')]['length']?_0x988d51['attributes']:_0x39b8b1[_0xaa29('0x31')];_0x988d51[_0xaa29('0x3a')]=qs[_0xaa29('0x3b')](_0x3284bb['query'][_0xaa29('0x3b')]);_0x988d51[_0xaa29('0x3c')]=qs['filters'](_[_0xaa29('0x3e')](_0x3284bb[_0xaa29('0x32')],_0x39b8b1['filters']));if(_0x3284bb[_0xaa29('0x32')][_0xaa29('0x3f')]){_0x988d51['where']=_[_0xaa29('0x41')](_0x988d51['where'],{'$or':_[_0xaa29('0x2b')](_0x988d51[_0xaa29('0x34')],function(_0x4c7727){var _0x4ef9e2={};_0x4ef9e2[_0x4c7727]={'$like':'%'+_0x3284bb['query']['filter']+'%'};return _0x4ef9e2;})});}_0x988d51=_[_0xaa29('0x41')]({},_0x988d51,_0x3284bb['options']);return _0x14b04b[_0xaa29('0x63')](_0x988d51);}})[_0xaa29('0x23')](function(_0x557210){if(_0x557210){_0x5f1518=_0x557210[_0xaa29('0x47')];if(!_0x3284bb[_0xaa29('0x32')]['hasOwnProperty'](_0xaa29('0x38'))){_0x988d51[_0xaa29('0x1c')]=qs['limit'](_0x3284bb[_0xaa29('0x32')][_0xaa29('0x1c')]);_0x988d51[_0xaa29('0x39')]=qs['offset'](_0x3284bb['query']['offset']);}return _0x14b04b[_0xaa29('0x63')](_0x988d51);}})[_0xaa29('0x23')](function(_0x241f6f){if(_0x241f6f){return _0x241f6f?{'count':_0x5f1518,'rows':_0x241f6f}:null;}})[_0xaa29('0x23')](respondWithResult(_0xdacf03,null))[_0xaa29('0x4a')](handleError(_0xdacf03,null));};exports[_0xaa29('0x65')]=function(_0x30cf7a,_0x59adbf,_0x322039){var _0x20b10b,_0x111d51;return db[_0xaa29('0x2c')][_0xaa29('0x49')]({'where':{'id':_0x30cf7a[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x59adbf,null))[_0xaa29('0x23')](function(_0x50f6b1){if(_0x50f6b1){_0x111d51=_0x50f6b1;return _0x50f6b1[_0xaa29('0x65')](_0x30cf7a[_0xaa29('0x4c')][_0xaa29('0x66')],_['omit'](_0x30cf7a[_0xaa29('0x4c')],[_0xaa29('0x66'),'id'])||{});}return null;})[_0xaa29('0x67')](function(_0x255fe0){var _0x53fd53;_0x20b10b=_0x255fe0||[];var _0xce814f=[];if(_0x255fe0){for(var _0x27f81e=0x0;_0x27f81e<_0x255fe0['length'];_0x27f81e+=0x1){var _0x14fd34=_0x255fe0[_0x27f81e][_0xaa29('0x25')]({'plain':!![]});_0x111d51[_0xaa29('0x68')]=_0x30cf7a[_0xaa29('0x4c')]['dialCheckDuplicateType']?_0x30cf7a[_0xaa29('0x4c')][_0xaa29('0x68')]:_0x111d51['dialCheckDuplicateType'];switch(_0x111d51[_0xaa29('0x68')]){case _0xaa29('0x69'):_0x53fd53=squel[_0xaa29('0x6a')]()[_0xaa29('0x6b')]('cm_hopper')['fromQuery']([_0xaa29('0x6c'),_0xaa29('0x6d'),_0xaa29('0x6e'),_0xaa29('0x6f'),_0xaa29('0x5b'),_0xaa29('0x55'),'updatedAt'],squel['select']()['field']('phone',_0xaa29('0x6c'))[_0xaa29('0x70')](_0xaa29('0x71'),_0xaa29('0x6d'))['field']('id','ContactId')[_0xaa29('0x70')](_0x14fd34['CmListId'][_0xaa29('0x72')](),_0xaa29('0x6f'))[_0xaa29('0x70')](_0x30cf7a[_0xaa29('0x46')]['id'][_0xaa29('0x72')](),_0xaa29('0x5b'))[_0xaa29('0x70')]('NOW()',_0xaa29('0x55'))[_0xaa29('0x70')](_0xaa29('0x71'),_0xaa29('0x56'))[_0xaa29('0x73')](_0xaa29('0x74'))[_0xaa29('0x3c')](_0xaa29('0x75'))[_0xaa29('0x3c')](_0xaa29('0x76'),_0x14fd34[_0xaa29('0x77')][_0xaa29('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa29('0x78')]()['field'](_0xaa29('0x79'))['from']('cm_hopper_final')[_0xaa29('0x3c')](_0xaa29('0x7a'),_0x30cf7a[_0xaa29('0x46')]['id'][_0xaa29('0x72')]()))[_0xaa29('0x3c')](_0xaa29('0x7b'),squel[_0xaa29('0x78')]()['field'](_0xaa29('0x7c'))[_0xaa29('0x73')](_0xaa29('0x7d'))['where'](_0xaa29('0x7a'),_0x30cf7a[_0xaa29('0x46')]['id'][_0xaa29('0x72')]())))[_0xaa29('0x72')]();break;case _0xaa29('0x7e'):_0x53fd53=squel[_0xaa29('0x6a')]()[_0xaa29('0x6b')]('cm_hopper')[_0xaa29('0x7f')]([_0xaa29('0x6c'),_0xaa29('0x6d'),_0xaa29('0x6e'),_0xaa29('0x6f'),_0xaa29('0x5b'),_0xaa29('0x55'),_0xaa29('0x56')],squel[_0xaa29('0x78')]()[_0xaa29('0x70')]('phone',_0xaa29('0x6c'))['field'](_0xaa29('0x71'),_0xaa29('0x6d'))[_0xaa29('0x70')]('id',_0xaa29('0x6e'))[_0xaa29('0x70')](_0x14fd34[_0xaa29('0x77')]['toString'](),_0xaa29('0x6f'))[_0xaa29('0x70')](_0x30cf7a[_0xaa29('0x46')]['id'][_0xaa29('0x72')](),_0xaa29('0x5b'))[_0xaa29('0x70')](_0xaa29('0x71'),_0xaa29('0x55'))[_0xaa29('0x70')]('NOW()',_0xaa29('0x56'))[_0xaa29('0x73')]('cm_contacts')[_0xaa29('0x3c')](_0xaa29('0x75'))['where'](_0xaa29('0x76'),_0x14fd34['CmListId'][_0xaa29('0x72')]())[_0xaa29('0x3c')](_0xaa29('0x80'))['where'](_0xaa29('0x7b'),squel[_0xaa29('0x78')]()[_0xaa29('0x70')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xaa29('0x3c')](_0xaa29('0x7a'),_0x30cf7a['params']['id'][_0xaa29('0x72')]())))[_0xaa29('0x72')]();break;default:_0x53fd53=squel['insert']()[_0xaa29('0x6b')](_0xaa29('0x7d'))[_0xaa29('0x7f')]([_0xaa29('0x6c'),_0xaa29('0x6d'),_0xaa29('0x6e'),'ListId','CampaignId',_0xaa29('0x55'),_0xaa29('0x56')],squel[_0xaa29('0x78')]()['field'](_0xaa29('0x6c'),'phone')[_0xaa29('0x70')]('NOW()',_0xaa29('0x6d'))[_0xaa29('0x70')]('id',_0xaa29('0x6e'))[_0xaa29('0x70')](_0x14fd34[_0xaa29('0x77')][_0xaa29('0x72')](),'ListId')[_0xaa29('0x70')](_0x30cf7a['params']['id'][_0xaa29('0x72')](),'CampaignId')[_0xaa29('0x70')](_0xaa29('0x71'),_0xaa29('0x55'))[_0xaa29('0x70')](_0xaa29('0x71'),'updatedAt')[_0xaa29('0x73')](_0xaa29('0x74'))['where'](_0xaa29('0x75'))[_0xaa29('0x3c')]('ListId\x20=\x20?',_0x14fd34['CmListId']['toString']())[_0xaa29('0x3c')](_0xaa29('0x80')))['toString']();}_0xce814f[_0xaa29('0x81')](db[_0xaa29('0x82')][_0xaa29('0x32')](_0x53fd53));}return BPromise[_0xaa29('0x83')](_0xce814f);}})[_0xaa29('0x23')](function(){return _0x20b10b;})[_0xaa29('0x23')](respondWithResult(_0x59adbf,null))[_0xaa29('0x4a')](handleError(_0x59adbf,null));};exports['removeLists']=function(_0x246e69,_0x163b3a,_0x2b46c1){return db['Campaign']['find']({'where':{'id':_0x246e69['params']['id']}})['then'](handleEntityNotFound(_0x163b3a,null))['then'](function(_0x12e6d9){if(_0x12e6d9){return _0x12e6d9['removeLists'](_0x246e69[_0xaa29('0x32')][_0xaa29('0x66')]);}})[_0xaa29('0x23')](function(_0x338765){if(_0x338765){return db[_0xaa29('0x5a')]['destroy']({'where':{'ListId':_0x246e69['query'][_0xaa29('0x66')],'CampaignId':_0x246e69[_0xaa29('0x46')]['id']}})['then'](function(){return _0x338765;});}})['then'](respondWithStatusCode(_0x163b3a,null))[_0xaa29('0x4a')](handleError(_0x163b3a,null));};exports[_0xaa29('0x84')]=function(_0x5ab3fb,_0x2360be,_0x9bd77e){var _0x32d79c={};var _0x365ce7={};var _0x24c05d;var _0x3f400c;return db[_0xaa29('0x2c')]['findOne']({'where':{'id':_0x5ab3fb[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x2360be,null))[_0xaa29('0x23')](function(_0x4945c1){if(_0x4945c1){_0x24c05d=_0x4945c1;_0x365ce7[_0xaa29('0x31')]=_[_0xaa29('0x33')](db[_0xaa29('0x64')][_0xaa29('0x2d')]);_0x365ce7[_0xaa29('0x32')]=_[_0xaa29('0x33')](_0x5ab3fb['query']);_0x365ce7[_0xaa29('0x3d')]=_[_0xaa29('0x35')](_0x365ce7[_0xaa29('0x31')],_0x365ce7[_0xaa29('0x32')]);_0x32d79c['attributes']=_[_0xaa29('0x35')](_0x365ce7[_0xaa29('0x31')],qs['fields'](_0x5ab3fb[_0xaa29('0x32')][_0xaa29('0x36')]));_0x32d79c[_0xaa29('0x34')]=_0x32d79c[_0xaa29('0x34')]['length']?_0x32d79c[_0xaa29('0x34')]:_0x365ce7[_0xaa29('0x31')];_0x32d79c[_0xaa29('0x3a')]=qs[_0xaa29('0x3b')](_0x5ab3fb['query'][_0xaa29('0x3b')]);_0x32d79c[_0xaa29('0x3c')]=qs['filters'](_[_0xaa29('0x3e')](_0x5ab3fb[_0xaa29('0x32')],_0x365ce7[_0xaa29('0x3d')]));if(_0x5ab3fb['query'][_0xaa29('0x3f')]){_0x32d79c[_0xaa29('0x3c')]=_[_0xaa29('0x41')](_0x32d79c[_0xaa29('0x3c')],{'$or':_['map'](_0x32d79c[_0xaa29('0x34')],function(_0x5ad88b){var _0x1b9a28={};_0x1b9a28[_0x5ad88b]={'$like':'%'+_0x5ab3fb[_0xaa29('0x32')][_0xaa29('0x3f')]+'%'};return _0x1b9a28;})});}_0x32d79c=_[_0xaa29('0x41')]({},_0x32d79c,_0x5ab3fb[_0xaa29('0x5d')]);return _0x24c05d[_0xaa29('0x84')](_0x32d79c);}})[_0xaa29('0x23')](function(_0x299055){if(_0x299055){_0x3f400c=_0x299055[_0xaa29('0x47')];if(!_0x5ab3fb['query'][_0xaa29('0x37')](_0xaa29('0x38'))){_0x32d79c[_0xaa29('0x1c')]=qs[_0xaa29('0x1c')](_0x5ab3fb[_0xaa29('0x32')]['limit']);_0x32d79c[_0xaa29('0x39')]=qs[_0xaa29('0x39')](_0x5ab3fb[_0xaa29('0x32')][_0xaa29('0x39')]);}return _0x24c05d[_0xaa29('0x84')](_0x32d79c);}})[_0xaa29('0x23')](function(_0x2479cc){if(_0x2479cc){return _0x2479cc?{'count':_0x3f400c,'rows':_0x2479cc}:null;}})[_0xaa29('0x23')](respondWithResult(_0x2360be,null))[_0xaa29('0x4a')](handleError(_0x2360be,null));};exports['addBlackLists']=function(_0x4486e3,_0x7ad695,_0x506d62){var _0x448842,_0x3d559a;return db[_0xaa29('0x2c')][_0xaa29('0x49')]({'where':{'id':_0x4486e3[_0xaa29('0x46')]['id']}})['then'](handleEntityNotFound(_0x7ad695,null))[_0xaa29('0x23')](function(_0x18f2e9){if(_0x18f2e9){_0x3d559a=_0x18f2e9;return _0x18f2e9[_0xaa29('0x85')](_0x4486e3['body'][_0xaa29('0x66')],_[_0xaa29('0x54')](_0x4486e3[_0xaa29('0x4c')],[_0xaa29('0x66'),'id'])||{});}return null;})[_0xaa29('0x67')](function(_0x2ef0e3){var _0x3604fe;_0x448842=_0x2ef0e3||[];var _0x5061ad=[];if(_0x2ef0e3){for(var _0x323395=0x0;_0x323395<_0x2ef0e3['length'];_0x323395+=0x1){var _0x286655=_0x2ef0e3[_0x323395]['get']({'plain':!![]});_0x3604fe=squel[_0xaa29('0x6a')]()['into'](_0xaa29('0x86'))[_0xaa29('0x7f')](['phone',_0xaa29('0x6e'),_0xaa29('0x6f'),_0xaa29('0x5b'),_0xaa29('0x55'),'updatedAt'],squel[_0xaa29('0x78')]()[_0xaa29('0x70')](_0xaa29('0x6c'),_0xaa29('0x6c'))[_0xaa29('0x70')]('id',_0xaa29('0x6e'))[_0xaa29('0x70')](_0x286655[_0xaa29('0x77')][_0xaa29('0x72')](),'ListId')[_0xaa29('0x70')](_0x4486e3[_0xaa29('0x46')]['id']['toString'](),_0xaa29('0x5b'))['field'](_0xaa29('0x71'),'createdAt')[_0xaa29('0x70')](_0xaa29('0x71'),_0xaa29('0x56'))[_0xaa29('0x73')]('cm_contacts')[_0xaa29('0x3c')](_0xaa29('0x75'))[_0xaa29('0x3c')](_0xaa29('0x76'),_0x286655[_0xaa29('0x77')][_0xaa29('0x72')]())[_0xaa29('0x3c')](_0xaa29('0x80')))[_0xaa29('0x72')]();_0x5061ad[_0xaa29('0x81')](db[_0xaa29('0x82')][_0xaa29('0x32')](_0x3604fe));}return BPromise[_0xaa29('0x83')](_0x5061ad);}})[_0xaa29('0x23')](function(){return _0x448842;})[_0xaa29('0x23')](respondWithResult(_0x7ad695,null))['catch'](handleError(_0x7ad695,null));};exports[_0xaa29('0x87')]=function(_0x1c92b0,_0x17598d,_0x51acfa){return db[_0xaa29('0x2c')][_0xaa29('0x49')]({'where':{'id':_0x1c92b0[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](handleEntityNotFound(_0x17598d,null))[_0xaa29('0x23')](function(_0x52f39c){if(_0x52f39c){return _0x52f39c[_0xaa29('0x87')](_0x1c92b0[_0xaa29('0x32')][_0xaa29('0x66')]);}})[_0xaa29('0x23')](function(_0x6d11bc){if(_0x6d11bc){return db[_0xaa29('0x62')][_0xaa29('0x24')]({'where':{'ListId':_0x1c92b0[_0xaa29('0x32')]['ids'],'CampaignId':_0x1c92b0[_0xaa29('0x46')]['id']}})[_0xaa29('0x23')](function(){return _0x6d11bc;});}})[_0xaa29('0x23')](respondWithStatusCode(_0x17598d,null))[_0xaa29('0x4a')](handleError(_0x17598d,null));}; \ No newline at end of file +var _0xd906=['getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','end','sendStatus','error','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','Campaign','includeAll','include','rows','catch','show','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','role','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','ContactId','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','push','all','removeLists'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd906,0x197));var _0x6d90=function(_0xf02243,_0x3c02d1){_0xf02243=_0xf02243-0x0;var _0x47dbf3=_0xd906[_0xf02243];return _0x47dbf3;};'use strict';var pdf=require(_0x6d90('0x0'));var emlformat=require(_0x6d90('0x1'));var rimraf=require(_0x6d90('0x2'));var zipdir=require(_0x6d90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d90('0x4'));var moment=require(_0x6d90('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6d90('0x6'));var path=require(_0x6d90('0x7'));var sox=require(_0x6d90('0x8'));var csv=require(_0x6d90('0x9'));var ejs=require(_0x6d90('0xa'));var fs=require('fs');var _=require(_0x6d90('0xb'));var squel=require(_0x6d90('0xc'));var crypto=require('crypto');var jsforce=require(_0x6d90('0xd'));var deskjs=require(_0x6d90('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6d90('0xf'));var Papa=require(_0x6d90('0x10'));var Redis=require(_0x6d90('0x11'));var authService=require(_0x6d90('0x12'));var qs=require(_0x6d90('0x13'));var as=require(_0x6d90('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d90('0x15'));var utils=require(_0x6d90('0x16'));var config=require(_0x6d90('0x17'));var licenseUtil=require(_0x6d90('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca976,_0xa867b7){_0xa867b7=_0xa867b7||0xcc;return function(_0x376cf2){if(_0x376cf2){return _0x2ca976['sendStatus'](_0xa867b7);}return _0x2ca976[_0x6d90('0x19')](_0xa867b7)['end']();};}function respondWithResult(_0x291518,_0x1a2ffc){_0x1a2ffc=_0x1a2ffc||0xc8;return function(_0x345098){if(_0x345098){return _0x291518[_0x6d90('0x19')](_0x1a2ffc)[_0x6d90('0x1a')](_0x345098);}};}function respondWithFilteredResult(_0x337777,_0x4aa2eb){return function(_0x2ddb4d){if(_0x2ddb4d){var _0x3cca7d=_0x2ddb4d[_0x6d90('0x1b')],_0xeb48fc=_0x4aa2eb[_0x6d90('0x1c')],_0x5dc379=_0x4aa2eb[_0x6d90('0x1c')]+_0x4aa2eb[_0x6d90('0x1d')],_0x431d5d;if(_0x5dc379>=_0x3cca7d){_0x5dc379=_0x3cca7d;_0x431d5d=0xc8;}else{_0x431d5d=0xce;}_0x337777['status'](_0x431d5d);return _0x337777[_0x6d90('0x1e')]('Content-Range',_0xeb48fc+'-'+_0x5dc379+'/'+_0x3cca7d)[_0x6d90('0x1a')](_0x2ddb4d);}return null;};}function patchUpdates(_0x5e857e){return function(_0xa056d0){try{jsonpatch[_0x6d90('0x1f')](_0xa056d0,_0x5e857e,!![]);}catch(_0x3a61f8){return BPromise[_0x6d90('0x20')](_0x3a61f8);}return _0xa056d0[_0x6d90('0x21')]();};}function saveUpdates(_0x1f8e24,_0x5ce83e){return function(_0x38ba48){if(_0x38ba48){return _0x38ba48[_0x6d90('0x22')](_0x1f8e24)[_0x6d90('0x23')](function(_0x59bcc8){return _0x59bcc8;});}return null;};}function removeEntity(_0x340cb1,_0x186b4d){return function(_0x32100f){if(_0x32100f){return _0x32100f['destroy']()[_0x6d90('0x23')](function(){var _0x1be396=_0x32100f[_0x6d90('0x24')]({'plain':!![]});var _0x35ae5a=_0x6d90('0x25');return db[_0x6d90('0x26')][_0x6d90('0x27')]({'where':{'type':_0x35ae5a,'resourceId':_0x1be396['id']}})[_0x6d90('0x23')](function(){return _0x32100f;});})[_0x6d90('0x23')](function(){_0x340cb1[_0x6d90('0x19')](0xcc)[_0x6d90('0x28')]();});}};}function handleEntityNotFound(_0x47004b,_0xe71793){return function(_0x2a6f34){if(!_0x2a6f34){_0x47004b[_0x6d90('0x29')](0x194);}return _0x2a6f34;};}function handleError(_0x53e76c,_0x1561b4){_0x1561b4=_0x1561b4||0x1f4;return function(_0x48d5c1){logger[_0x6d90('0x2a')](_0x48d5c1['stack']);if(_0x48d5c1[_0x6d90('0x2b')]){delete _0x48d5c1['name'];}_0x53e76c[_0x6d90('0x19')](_0x1561b4)['send'](_0x48d5c1);};}exports[_0x6d90('0x2c')]=function(_0x295fa1,_0x2d9da6){var _0x25f856={},_0x1b834c={},_0x19d04f={'count':0x0,'rows':[]};var _0x5cd219=_[_0x6d90('0x2d')](db['Campaign'][_0x6d90('0x2e')],function(_0x287a69){return{'name':_0x287a69['fieldName'],'type':_0x287a69[_0x6d90('0x2f')][_0x6d90('0x30')]};});_0x1b834c[_0x6d90('0x31')]=_['map'](_0x5cd219,_0x6d90('0x2b'));_0x1b834c[_0x6d90('0x32')]=_[_0x6d90('0x33')](_0x295fa1['query']);_0x1b834c['filters']=_[_0x6d90('0x34')](_0x1b834c['model'],_0x1b834c['query']);_0x25f856[_0x6d90('0x35')]=_[_0x6d90('0x34')](_0x1b834c[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x295fa1[_0x6d90('0x32')][_0x6d90('0x36')]));_0x25f856[_0x6d90('0x35')]=_0x25f856[_0x6d90('0x35')][_0x6d90('0x37')]?_0x25f856['attributes']:_0x1b834c[_0x6d90('0x31')];if(!_0x295fa1[_0x6d90('0x32')][_0x6d90('0x38')](_0x6d90('0x39'))){_0x25f856[_0x6d90('0x1d')]=qs[_0x6d90('0x1d')](_0x295fa1[_0x6d90('0x32')][_0x6d90('0x1d')]);_0x25f856['offset']=qs[_0x6d90('0x1c')](_0x295fa1[_0x6d90('0x32')]['offset']);}_0x25f856[_0x6d90('0x3a')]=qs[_0x6d90('0x3b')](_0x295fa1[_0x6d90('0x32')][_0x6d90('0x3b')]);_0x25f856[_0x6d90('0x3c')]=qs[_0x6d90('0x3d')](_['pick'](_0x295fa1['query'],_0x1b834c['filters']),_0x5cd219);if(_0x295fa1[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x25f856['where']=_['merge'](_0x25f856[_0x6d90('0x3c')],{'$or':_['map'](_0x5cd219,function(_0x84a2f3){if(_0x84a2f3[_0x6d90('0x2f')]!=='VIRTUAL'){var _0x231862={};_0x231862[_0x84a2f3[_0x6d90('0x2b')]]={'$like':'%'+_0x295fa1[_0x6d90('0x32')][_0x6d90('0x3e')]+'%'};return _0x231862;}})});}_0x25f856=_['merge']({},_0x25f856,_0x295fa1[_0x6d90('0x3f')]);var _0x3749da={'where':_0x25f856[_0x6d90('0x3c')]};return db[_0x6d90('0x40')][_0x6d90('0x1b')](_0x3749da)['then'](function(_0x217ccc){_0x19d04f[_0x6d90('0x1b')]=_0x217ccc;if(_0x295fa1[_0x6d90('0x32')][_0x6d90('0x41')]){_0x25f856[_0x6d90('0x42')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x25f856);})['then'](function(_0x225bc6){_0x19d04f[_0x6d90('0x43')]=_0x225bc6;return _0x19d04f;})[_0x6d90('0x23')](respondWithFilteredResult(_0x2d9da6,_0x25f856))[_0x6d90('0x44')](handleError(_0x2d9da6,null));};exports[_0x6d90('0x45')]=function(_0x1bf789,_0x5ec3b2){var _0x3a8be0={'raw':![],'where':{'id':_0x1bf789['params']['id']}},_0x4a12c2={};_0x4a12c2['model']=_[_0x6d90('0x33')](db[_0x6d90('0x40')]['rawAttributes']);_0x4a12c2['query']=_[_0x6d90('0x33')](_0x1bf789['query']);_0x4a12c2[_0x6d90('0x3d')]=_[_0x6d90('0x34')](_0x4a12c2[_0x6d90('0x31')],_0x4a12c2['query']);_0x3a8be0[_0x6d90('0x35')]=_['intersection'](_0x4a12c2[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x1bf789[_0x6d90('0x32')]['fields']));_0x3a8be0[_0x6d90('0x35')]=_0x3a8be0['attributes'][_0x6d90('0x37')]?_0x3a8be0['attributes']:_0x4a12c2[_0x6d90('0x31')];if(_0x1bf789[_0x6d90('0x32')][_0x6d90('0x41')]){_0x3a8be0[_0x6d90('0x42')]=[{'all':!![]}];}_0x3a8be0=_[_0x6d90('0x46')]({},_0x3a8be0,_0x1bf789['options']);return db[_0x6d90('0x40')]['find'](_0x3a8be0)[_0x6d90('0x23')](handleEntityNotFound(_0x5ec3b2,null))['then'](respondWithResult(_0x5ec3b2,null))[_0x6d90('0x44')](handleError(_0x5ec3b2,null));};exports[_0x6d90('0x47')]=function(_0x15f517,_0x2919b6){return db[_0x6d90('0x40')][_0x6d90('0x47')](_0x15f517['body'],{})['then'](function(_0x1b8439){var _0x4bf629=_0x15f517[_0x6d90('0x48')][_0x6d90('0x24')]({'plain':!![]});if(!_0x4bf629)throw new Error(_0x6d90('0x49'));if(_0x4bf629['role']==='user'){var _0x324366=_0x1b8439['get']({'plain':!![]});var _0xcd188e=_0x6d90('0x25');return db[_0x6d90('0x4a')][_0x6d90('0x4b')]({'where':{'name':_0xcd188e,'userProfileId':_0x4bf629[_0x6d90('0x4c')]},'raw':!![]})[_0x6d90('0x23')](function(_0x26c541){if(_0x26c541&&_0x26c541[_0x6d90('0x4d')]===0x0){return db[_0x6d90('0x26')][_0x6d90('0x47')]({'name':_0x324366[_0x6d90('0x2b')],'resourceId':_0x324366['id'],'type':_0x26c541['name'],'sectionId':_0x26c541['id']},{})[_0x6d90('0x23')](function(){return _0x1b8439;});}else{return _0x1b8439;}})['catch'](function(_0x38f9f5){logger[_0x6d90('0x2a')](_0x6d90('0x4e'),_0x38f9f5);throw _0x38f9f5;});}return _0x1b8439;})[_0x6d90('0x23')](respondWithResult(_0x2919b6,0xc9))[_0x6d90('0x44')](handleError(_0x2919b6,null));};exports[_0x6d90('0x4f')]=function(_0x24e304,_0x3878cd){var _0x1e9748={'where':{'id':_0x24e304[_0x6d90('0x50')]['id']}},_0x385956={};_0x385956[_0x6d90('0x31')]=_[_0x6d90('0x33')](db['Campaign']['rawAttributes']);_0x1e9748[_0x6d90('0x35')]=_['intersection'](_0x385956[_0x6d90('0x31')],qs['fields'](_0x24e304[_0x6d90('0x32')][_0x6d90('0x36')]));_0x1e9748[_0x6d90('0x35')]=_0x1e9748[_0x6d90('0x35')][_0x6d90('0x37')]?_0x1e9748[_0x6d90('0x35')]:_0x385956['model'];if(_0x24e304[_0x6d90('0x32')]['includeAll']){_0x1e9748['include']=[{'all':!![]}];}_0x1e9748=_[_0x6d90('0x46')]({},_0x1e9748,_0x24e304[_0x6d90('0x3f')]);return db[_0x6d90('0x40')][_0x6d90('0x4b')](_0x1e9748)[_0x6d90('0x23')](handleEntityNotFound(_0x3878cd,null))[_0x6d90('0x23')](function(_0x246b06){if(_0x246b06){var _0x295a6b=_0x246b06[_0x6d90('0x24')]({'plain':!![]});_0x295a6b=qs[_0x6d90('0x51')](_0x295a6b,['id',_0x6d90('0x52'),_0x6d90('0x53')]);_0x24e304[_0x6d90('0x54')]=_[_0x6d90('0x51')](_0x24e304[_0x6d90('0x54')],['id','createdAt','updatedAt']);return db[_0x6d90('0x40')][_0x6d90('0x47')](_[_0x6d90('0x46')](_0x295a6b,_0x24e304[_0x6d90('0x54')]),{'include':_0x24e304['query'][_0x6d90('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x2f2019){var _0x54353a=_0x24e304[_0x6d90('0x48')][_0x6d90('0x24')]({'plain':!![]});if(!_0x54353a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54353a[_0x6d90('0x55')]===_0x6d90('0x48')){var _0x5e1fdd=_0x2f2019[_0x6d90('0x24')]({'plain':!![]});var _0x1b2af8=_0x6d90('0x25');return db[_0x6d90('0x4a')][_0x6d90('0x4b')]({'where':{'name':_0x1b2af8,'userProfileId':_0x54353a['userProfileId']},'raw':!![]})[_0x6d90('0x23')](function(_0x2aa864){if(_0x2aa864&&_0x2aa864[_0x6d90('0x4d')]===0x0){return db[_0x6d90('0x26')][_0x6d90('0x47')]({'name':_0x5e1fdd['name'],'resourceId':_0x5e1fdd['id'],'type':_0x2aa864['name'],'sectionId':_0x2aa864['id']},{})[_0x6d90('0x23')](function(){return _0x2f2019;});}else{return _0x2f2019;}})[_0x6d90('0x44')](function(_0x5e2f86){logger['error'](_0x6d90('0x4e'),_0x5e2f86);throw _0x5e2f86;});}return _0x2f2019;});}})[_0x6d90('0x23')](respondWithResult(_0x3878cd,0xc9))[_0x6d90('0x44')](handleError(_0x3878cd,null));};exports[_0x6d90('0x22')]=function(_0x2f9c19,_0x1c96f1){if(_0x2f9c19[_0x6d90('0x54')]['id']){delete _0x2f9c19[_0x6d90('0x54')]['id'];}return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x2f9c19[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x1c96f1,null))[_0x6d90('0x23')](saveUpdates(_0x2f9c19[_0x6d90('0x54')],null))[_0x6d90('0x23')](respondWithResult(_0x1c96f1,null))[_0x6d90('0x44')](handleError(_0x1c96f1,null));};exports[_0x6d90('0x27')]=function(_0x260d96,_0x2f5e0a){return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x260d96['params']['id']}})['then'](handleEntityNotFound(_0x2f5e0a,null))['then'](removeEntity(_0x2f5e0a,null))[_0x6d90('0x44')](handleError(_0x2f5e0a,null));};exports[_0x6d90('0x56')]=function(_0x30224c,_0x5993c3,_0x471600){var _0x530eef={'raw':!![],'where':{}};var _0x25f95b={};var _0xc3d3ff={'count':0x0,'rows':[]};return db['Campaign'][_0x6d90('0x57')]({'where':{'id':_0x30224c['params']['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x5993c3,null))[_0x6d90('0x23')](function(_0x3956bf){if(_0x3956bf){_0x25f95b[_0x6d90('0x31')]=_['keys'](db[_0x6d90('0x58')]['rawAttributes']);_0x25f95b[_0x6d90('0x32')]=_[_0x6d90('0x33')](_0x30224c[_0x6d90('0x32')]);_0x25f95b[_0x6d90('0x3d')]=_[_0x6d90('0x34')](_0x25f95b[_0x6d90('0x31')],_0x25f95b[_0x6d90('0x32')]);_0x530eef['attributes']=_[_0x6d90('0x34')](_0x25f95b[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x30224c[_0x6d90('0x32')][_0x6d90('0x36')]));_0x530eef[_0x6d90('0x35')]=_0x530eef[_0x6d90('0x35')][_0x6d90('0x37')]?_0x530eef['attributes']:_0x25f95b['model'];if(!_0x30224c[_0x6d90('0x32')][_0x6d90('0x38')]('nolimit')){_0x530eef[_0x6d90('0x1d')]=qs['limit'](_0x30224c[_0x6d90('0x32')][_0x6d90('0x1d')]);_0x530eef[_0x6d90('0x1c')]=qs[_0x6d90('0x1c')](_0x30224c[_0x6d90('0x32')][_0x6d90('0x1c')]);}_0x530eef[_0x6d90('0x3a')]=qs[_0x6d90('0x3b')](_0x30224c[_0x6d90('0x32')][_0x6d90('0x3b')]);_0x530eef[_0x6d90('0x3c')]=qs[_0x6d90('0x3d')](_['pick'](_0x30224c[_0x6d90('0x32')],_0x25f95b['filters']));_0x530eef['where'][_0x6d90('0x59')]=_0x3956bf['id'];if(_0x30224c[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x530eef[_0x6d90('0x3c')]=_[_0x6d90('0x46')](_0x530eef[_0x6d90('0x3c')],{'$or':_[_0x6d90('0x2d')](_0x530eef[_0x6d90('0x35')],function(_0x3e071c){var _0xaddb43={};_0xaddb43[_0x3e071c]={'$like':'%'+_0x30224c[_0x6d90('0x32')][_0x6d90('0x3e')]+'%'};return _0xaddb43;})});}_0x530eef=_[_0x6d90('0x46')]({},_0x530eef,_0x30224c[_0x6d90('0x3f')]);return db[_0x6d90('0x58')][_0x6d90('0x1b')]({'where':_0x530eef[_0x6d90('0x3c')]})[_0x6d90('0x23')](function(_0x325396){_0xc3d3ff[_0x6d90('0x1b')]=_0x325396;if(_0x30224c[_0x6d90('0x32')]['includeAll']){_0x530eef[_0x6d90('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x6d90('0x5a')](_0x530eef);})[_0x6d90('0x23')](function(_0x43f02a){_0xc3d3ff[_0x6d90('0x43')]=_0x43f02a;return _0xc3d3ff;});}})[_0x6d90('0x23')](respondWithFilteredResult(_0x5993c3,_0x530eef))[_0x6d90('0x44')](handleError(_0x5993c3,null));};exports[_0x6d90('0x5b')]=function(_0x2dd05c,_0x21286e,_0x4edb1b){var _0x31fa9d={'raw':!![],'where':{}};var _0x279d93={};var _0x1c9049={'count':0x0,'rows':[]};return db[_0x6d90('0x40')][_0x6d90('0x57')]({'where':{'id':_0x2dd05c['params']['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x21286e,null))['then'](function(_0x5ae40b){if(_0x5ae40b){_0x279d93[_0x6d90('0x31')]=_['keys'](db[_0x6d90('0x5c')]['rawAttributes']);_0x279d93[_0x6d90('0x32')]=_[_0x6d90('0x33')](_0x2dd05c[_0x6d90('0x32')]);_0x279d93[_0x6d90('0x3d')]=_[_0x6d90('0x34')](_0x279d93[_0x6d90('0x31')],_0x279d93['query']);_0x31fa9d[_0x6d90('0x35')]=_[_0x6d90('0x34')](_0x279d93['model'],qs[_0x6d90('0x36')](_0x2dd05c[_0x6d90('0x32')][_0x6d90('0x36')]));_0x31fa9d[_0x6d90('0x35')]=_0x31fa9d['attributes'][_0x6d90('0x37')]?_0x31fa9d['attributes']:_0x279d93['model'];if(!_0x2dd05c['query'][_0x6d90('0x38')](_0x6d90('0x39'))){_0x31fa9d[_0x6d90('0x1d')]=qs['limit'](_0x2dd05c[_0x6d90('0x32')][_0x6d90('0x1d')]);_0x31fa9d[_0x6d90('0x1c')]=qs['offset'](_0x2dd05c['query'][_0x6d90('0x1c')]);}_0x31fa9d[_0x6d90('0x3a')]=qs['sort'](_0x2dd05c[_0x6d90('0x32')][_0x6d90('0x3b')]);_0x31fa9d[_0x6d90('0x3c')]=qs['filters'](_['pick'](_0x2dd05c[_0x6d90('0x32')],_0x279d93[_0x6d90('0x3d')]));_0x31fa9d[_0x6d90('0x3c')][_0x6d90('0x59')]=_0x5ae40b['id'];if(_0x2dd05c[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x31fa9d[_0x6d90('0x3c')]=_['merge'](_0x31fa9d['where'],{'$or':_[_0x6d90('0x2d')](_0x31fa9d[_0x6d90('0x35')],function(_0x27907b){var _0xd7d2b9={};_0xd7d2b9[_0x27907b]={'$like':'%'+_0x2dd05c['query'][_0x6d90('0x3e')]+'%'};return _0xd7d2b9;})});}_0x31fa9d=_[_0x6d90('0x46')]({},_0x31fa9d,_0x2dd05c[_0x6d90('0x3f')]);return db[_0x6d90('0x5c')][_0x6d90('0x1b')]({'where':_0x31fa9d[_0x6d90('0x3c')]})[_0x6d90('0x23')](function(_0x4b0411){_0x1c9049['count']=_0x4b0411;if(_0x2dd05c[_0x6d90('0x32')][_0x6d90('0x41')]){_0x31fa9d[_0x6d90('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6d90('0x5a')](_0x31fa9d);})[_0x6d90('0x23')](function(_0x3c9e14){_0x1c9049[_0x6d90('0x43')]=_0x3c9e14;return _0x1c9049;});}})[_0x6d90('0x23')](respondWithFilteredResult(_0x21286e,_0x31fa9d))['catch'](handleError(_0x21286e,null));};exports[_0x6d90('0x5d')]=function(_0x3a9fe4,_0x4b1780,_0x8fe9c){var _0x5962dc={'raw':!![],'where':{}};var _0xb93bb8={};var _0x4c5ec4={'count':0x0,'rows':[]};return db[_0x6d90('0x40')][_0x6d90('0x57')]({'where':{'id':_0x3a9fe4[_0x6d90('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b1780,null))[_0x6d90('0x23')](function(_0x2e6ac1){if(_0x2e6ac1){_0xb93bb8['model']=_[_0x6d90('0x33')](db[_0x6d90('0x5e')][_0x6d90('0x2e')]);_0xb93bb8[_0x6d90('0x32')]=_[_0x6d90('0x33')](_0x3a9fe4[_0x6d90('0x32')]);_0xb93bb8['filters']=_[_0x6d90('0x34')](_0xb93bb8[_0x6d90('0x31')],_0xb93bb8['query']);_0x5962dc[_0x6d90('0x35')]=_[_0x6d90('0x34')](_0xb93bb8[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x3a9fe4[_0x6d90('0x32')][_0x6d90('0x36')]));_0x5962dc[_0x6d90('0x35')]=_0x5962dc[_0x6d90('0x35')][_0x6d90('0x37')]?_0x5962dc[_0x6d90('0x35')]:_0xb93bb8[_0x6d90('0x31')];if(!_0x3a9fe4['query'][_0x6d90('0x38')](_0x6d90('0x39'))){_0x5962dc['limit']=qs[_0x6d90('0x1d')](_0x3a9fe4[_0x6d90('0x32')][_0x6d90('0x1d')]);_0x5962dc['offset']=qs[_0x6d90('0x1c')](_0x3a9fe4[_0x6d90('0x32')]['offset']);}_0x5962dc[_0x6d90('0x3a')]=qs['sort'](_0x3a9fe4['query'][_0x6d90('0x3b')]);_0x5962dc[_0x6d90('0x3c')]=qs[_0x6d90('0x3d')](_[_0x6d90('0x5f')](_0x3a9fe4[_0x6d90('0x32')],_0xb93bb8[_0x6d90('0x3d')]));_0x5962dc[_0x6d90('0x3c')][_0x6d90('0x59')]=_0x2e6ac1['id'];if(_0x3a9fe4[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x5962dc[_0x6d90('0x3c')]=_[_0x6d90('0x46')](_0x5962dc[_0x6d90('0x3c')],{'$or':_[_0x6d90('0x2d')](_0x5962dc[_0x6d90('0x35')],function(_0x265c53){var _0x529805={};_0x529805[_0x265c53]={'$like':'%'+_0x3a9fe4[_0x6d90('0x32')][_0x6d90('0x3e')]+'%'};return _0x529805;})});}_0x5962dc=_[_0x6d90('0x46')]({},_0x5962dc,_0x3a9fe4[_0x6d90('0x3f')]);return db[_0x6d90('0x5e')]['count']({'where':_0x5962dc[_0x6d90('0x3c')]})['then'](function(_0x431b7a){_0x4c5ec4[_0x6d90('0x1b')]=_0x431b7a;if(_0x3a9fe4[_0x6d90('0x32')][_0x6d90('0x41')]){_0x5962dc[_0x6d90('0x42')]=[{'all':!![]}];}return db[_0x6d90('0x5e')]['findAll'](_0x5962dc);})['then'](function(_0x1d6626){_0x4c5ec4['rows']=_0x1d6626;return _0x4c5ec4;});}})[_0x6d90('0x23')](respondWithFilteredResult(_0x4b1780,_0x5962dc))['catch'](handleError(_0x4b1780,null));};exports[_0x6d90('0x60')]=function(_0x108ff6,_0x5798d1,_0x5e6fb9){var _0x5a8a91={'raw':!![],'where':{}};var _0x1986d0={};var _0x1d5a15={'count':0x0,'rows':[]};return db[_0x6d90('0x40')][_0x6d90('0x57')]({'where':{'id':_0x108ff6[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x5798d1,null))['then'](function(_0xfd4a52){if(_0xfd4a52){_0x1986d0[_0x6d90('0x31')]=_[_0x6d90('0x33')](db[_0x6d90('0x61')]['rawAttributes']);_0x1986d0[_0x6d90('0x32')]=_['keys'](_0x108ff6[_0x6d90('0x32')]);_0x1986d0[_0x6d90('0x3d')]=_[_0x6d90('0x34')](_0x1986d0[_0x6d90('0x31')],_0x1986d0[_0x6d90('0x32')]);_0x5a8a91[_0x6d90('0x35')]=_[_0x6d90('0x34')](_0x1986d0[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x108ff6[_0x6d90('0x32')][_0x6d90('0x36')]));_0x5a8a91[_0x6d90('0x35')]=_0x5a8a91[_0x6d90('0x35')][_0x6d90('0x37')]?_0x5a8a91[_0x6d90('0x35')]:_0x1986d0[_0x6d90('0x31')];if(!_0x108ff6[_0x6d90('0x32')]['hasOwnProperty'](_0x6d90('0x39'))){_0x5a8a91[_0x6d90('0x1d')]=qs['limit'](_0x108ff6['query'][_0x6d90('0x1d')]);_0x5a8a91['offset']=qs[_0x6d90('0x1c')](_0x108ff6[_0x6d90('0x32')]['offset']);}_0x5a8a91[_0x6d90('0x3a')]=qs[_0x6d90('0x3b')](_0x108ff6['query']['sort']);_0x5a8a91[_0x6d90('0x3c')]=qs['filters'](_[_0x6d90('0x5f')](_0x108ff6[_0x6d90('0x32')],_0x1986d0[_0x6d90('0x3d')]));_0x5a8a91[_0x6d90('0x3c')][_0x6d90('0x59')]=_0xfd4a52['id'];if(_0x108ff6[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x5a8a91['where']=_[_0x6d90('0x46')](_0x5a8a91[_0x6d90('0x3c')],{'$or':_[_0x6d90('0x2d')](_0x5a8a91['attributes'],function(_0x242702){var _0x480271={};_0x480271[_0x242702]={'$like':'%'+_0x108ff6[_0x6d90('0x32')][_0x6d90('0x3e')]+'%'};return _0x480271;})});}_0x5a8a91=_[_0x6d90('0x46')]({},_0x5a8a91,_0x108ff6[_0x6d90('0x3f')]);return db[_0x6d90('0x61')][_0x6d90('0x1b')]({'where':_0x5a8a91['where']})['then'](function(_0x300e41){_0x1d5a15[_0x6d90('0x1b')]=_0x300e41;if(_0x108ff6['query'][_0x6d90('0x41')]){_0x5a8a91['include']=[{'all':!![]}];}return db[_0x6d90('0x61')]['findAll'](_0x5a8a91);})[_0x6d90('0x23')](function(_0x14d821){_0x1d5a15[_0x6d90('0x43')]=_0x14d821;return _0x1d5a15;});}})[_0x6d90('0x23')](respondWithFilteredResult(_0x5798d1,_0x5a8a91))[_0x6d90('0x44')](handleError(_0x5798d1,null));};exports[_0x6d90('0x62')]=function(_0x1ff66a,_0x28eaf5,_0x2c2f80){var _0x30ffd3={};var _0x2ef17f={};var _0x4fd744;var _0x3361ea;return db['Campaign'][_0x6d90('0x57')]({'where':{'id':_0x1ff66a[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x28eaf5,null))[_0x6d90('0x23')](function(_0x2de14b){if(_0x2de14b){_0x4fd744=_0x2de14b;_0x2ef17f['model']=_['keys'](db[_0x6d90('0x63')][_0x6d90('0x2e')]);_0x2ef17f[_0x6d90('0x32')]=_[_0x6d90('0x33')](_0x1ff66a[_0x6d90('0x32')]);_0x2ef17f[_0x6d90('0x3d')]=_[_0x6d90('0x34')](_0x2ef17f[_0x6d90('0x31')],_0x2ef17f[_0x6d90('0x32')]);_0x30ffd3['attributes']=_[_0x6d90('0x34')](_0x2ef17f['model'],qs[_0x6d90('0x36')](_0x1ff66a[_0x6d90('0x32')][_0x6d90('0x36')]));_0x30ffd3['attributes']=_0x30ffd3[_0x6d90('0x35')]['length']?_0x30ffd3[_0x6d90('0x35')]:_0x2ef17f['model'];_0x30ffd3[_0x6d90('0x3a')]=qs[_0x6d90('0x3b')](_0x1ff66a[_0x6d90('0x32')][_0x6d90('0x3b')]);_0x30ffd3[_0x6d90('0x3c')]=qs[_0x6d90('0x3d')](_[_0x6d90('0x5f')](_0x1ff66a[_0x6d90('0x32')],_0x2ef17f[_0x6d90('0x3d')]));if(_0x1ff66a[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x30ffd3[_0x6d90('0x3c')]=_['merge'](_0x30ffd3[_0x6d90('0x3c')],{'$or':_[_0x6d90('0x2d')](_0x30ffd3[_0x6d90('0x35')],function(_0x9ad05a){var _0xe936b={};_0xe936b[_0x9ad05a]={'$like':'%'+_0x1ff66a['query'][_0x6d90('0x3e')]+'%'};return _0xe936b;})});}_0x30ffd3=_[_0x6d90('0x46')]({},_0x30ffd3,_0x1ff66a['options']);return _0x4fd744[_0x6d90('0x62')](_0x30ffd3);}})[_0x6d90('0x23')](function(_0xd1c2b6){if(_0xd1c2b6){_0x3361ea=_0xd1c2b6[_0x6d90('0x37')];if(!_0x1ff66a[_0x6d90('0x32')][_0x6d90('0x38')]('nolimit')){_0x30ffd3[_0x6d90('0x1d')]=qs[_0x6d90('0x1d')](_0x1ff66a[_0x6d90('0x32')][_0x6d90('0x1d')]);_0x30ffd3[_0x6d90('0x1c')]=qs[_0x6d90('0x1c')](_0x1ff66a[_0x6d90('0x32')]['offset']);}return _0x4fd744[_0x6d90('0x62')](_0x30ffd3);}})[_0x6d90('0x23')](function(_0x3ddf30){if(_0x3ddf30){return _0x3ddf30?{'count':_0x3361ea,'rows':_0x3ddf30}:null;}})[_0x6d90('0x23')](respondWithResult(_0x28eaf5,null))[_0x6d90('0x44')](handleError(_0x28eaf5,null));};exports[_0x6d90('0x64')]=function(_0x1920c8,_0x542a9e,_0xdc8c97){var _0x24cab4,_0x32d549;return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x1920c8[_0x6d90('0x50')]['id']}})['then'](handleEntityNotFound(_0x542a9e,null))[_0x6d90('0x23')](function(_0x10438f){if(_0x10438f){_0x32d549=_0x10438f;return _0x10438f[_0x6d90('0x64')](_0x1920c8[_0x6d90('0x54')][_0x6d90('0x65')],_[_0x6d90('0x51')](_0x1920c8['body'],[_0x6d90('0x65'),'id'])||{});}return null;})[_0x6d90('0x66')](function(_0x2a7aad){var _0x42e445;_0x24cab4=_0x2a7aad||[];var _0x29bbd1=[];if(_0x2a7aad){for(var _0x4e39a8=0x0;_0x4e39a8<_0x2a7aad[_0x6d90('0x37')];_0x4e39a8+=0x1){var _0x525c18=_0x2a7aad[_0x4e39a8][_0x6d90('0x24')]({'plain':!![]});_0x32d549[_0x6d90('0x67')]=_0x1920c8[_0x6d90('0x54')][_0x6d90('0x67')]?_0x1920c8['body'][_0x6d90('0x67')]:_0x32d549[_0x6d90('0x67')];switch(_0x32d549['dialCheckDuplicateType']){case'always':_0x42e445=squel[_0x6d90('0x68')]()[_0x6d90('0x69')](_0x6d90('0x6a'))[_0x6d90('0x6b')]([_0x6d90('0x6c'),_0x6d90('0x6d'),'ContactId',_0x6d90('0x6e'),_0x6d90('0x59'),_0x6d90('0x52'),'updatedAt'],squel[_0x6d90('0x6f')]()['field'](_0x6d90('0x6c'),'phone')['field']('NOW()',_0x6d90('0x6d'))[_0x6d90('0x70')]('id',_0x6d90('0x71'))[_0x6d90('0x70')](_0x525c18[_0x6d90('0x72')][_0x6d90('0x73')](),_0x6d90('0x6e'))[_0x6d90('0x70')](_0x1920c8[_0x6d90('0x50')]['id'][_0x6d90('0x73')](),_0x6d90('0x59'))[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x52'))['field'](_0x6d90('0x74'),_0x6d90('0x53'))[_0x6d90('0x75')]('cm_contacts')[_0x6d90('0x3c')](_0x6d90('0x76'))['where'](_0x6d90('0x77'),_0x525c18[_0x6d90('0x72')][_0x6d90('0x73')]())[_0x6d90('0x3c')](_0x6d90('0x78'))[_0x6d90('0x3c')](_0x6d90('0x79'),squel[_0x6d90('0x6f')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x6d90('0x75')]('cm_hopper_final')[_0x6d90('0x3c')]('CampaignId\x20=\x20?',_0x1920c8[_0x6d90('0x50')]['id'][_0x6d90('0x73')]()))[_0x6d90('0x3c')](_0x6d90('0x79'),squel['select']()[_0x6d90('0x70')](_0x6d90('0x7a'))[_0x6d90('0x75')](_0x6d90('0x6a'))[_0x6d90('0x3c')](_0x6d90('0x7b'),_0x1920c8[_0x6d90('0x50')]['id'][_0x6d90('0x73')]())))['toString']();break;case _0x6d90('0x7c'):_0x42e445=squel[_0x6d90('0x68')]()[_0x6d90('0x69')](_0x6d90('0x6a'))[_0x6d90('0x6b')]([_0x6d90('0x6c'),_0x6d90('0x6d'),_0x6d90('0x71'),_0x6d90('0x6e'),_0x6d90('0x59'),_0x6d90('0x52'),_0x6d90('0x53')],squel['select']()[_0x6d90('0x70')](_0x6d90('0x6c'),_0x6d90('0x6c'))[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x6d'))[_0x6d90('0x70')]('id',_0x6d90('0x71'))[_0x6d90('0x70')](_0x525c18[_0x6d90('0x72')][_0x6d90('0x73')](),'ListId')['field'](_0x1920c8[_0x6d90('0x50')]['id']['toString'](),_0x6d90('0x59'))[_0x6d90('0x70')]('NOW()',_0x6d90('0x52'))[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x53'))[_0x6d90('0x75')](_0x6d90('0x7d'))[_0x6d90('0x3c')]('deletedAt\x20IS\x20NULL')[_0x6d90('0x3c')](_0x6d90('0x77'),_0x525c18['CmListId'][_0x6d90('0x73')]())[_0x6d90('0x3c')](_0x6d90('0x78'))[_0x6d90('0x3c')](_0x6d90('0x79'),squel[_0x6d90('0x6f')]()[_0x6d90('0x70')](_0x6d90('0x7a'))[_0x6d90('0x75')]('cm_hopper')[_0x6d90('0x3c')](_0x6d90('0x7b'),_0x1920c8['params']['id'][_0x6d90('0x73')]())))[_0x6d90('0x73')]();break;default:_0x42e445=squel[_0x6d90('0x68')]()[_0x6d90('0x69')]('cm_hopper')[_0x6d90('0x6b')]([_0x6d90('0x6c'),_0x6d90('0x6d'),_0x6d90('0x71'),'ListId',_0x6d90('0x59'),_0x6d90('0x52'),'updatedAt'],squel[_0x6d90('0x6f')]()['field']('phone',_0x6d90('0x6c'))[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x6d'))[_0x6d90('0x70')]('id','ContactId')['field'](_0x525c18[_0x6d90('0x72')][_0x6d90('0x73')](),_0x6d90('0x6e'))['field'](_0x1920c8[_0x6d90('0x50')]['id'][_0x6d90('0x73')](),_0x6d90('0x59'))[_0x6d90('0x70')]('NOW()',_0x6d90('0x52'))[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x53'))[_0x6d90('0x75')](_0x6d90('0x7d'))[_0x6d90('0x3c')]('deletedAt\x20IS\x20NULL')[_0x6d90('0x3c')](_0x6d90('0x77'),_0x525c18['CmListId']['toString']())[_0x6d90('0x3c')](_0x6d90('0x78')))[_0x6d90('0x73')]();}_0x29bbd1[_0x6d90('0x7e')](db['sequelize'][_0x6d90('0x32')](_0x42e445));}return BPromise[_0x6d90('0x7f')](_0x29bbd1);}})[_0x6d90('0x23')](function(){return _0x24cab4;})['then'](respondWithResult(_0x542a9e,null))[_0x6d90('0x44')](handleError(_0x542a9e,null));};exports[_0x6d90('0x80')]=function(_0x1c053f,_0x2900eb,_0x2c7fcc){return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x1c053f[_0x6d90('0x50')]['id']}})['then'](handleEntityNotFound(_0x2900eb,null))[_0x6d90('0x23')](function(_0x1f2c4a){if(_0x1f2c4a){return _0x1f2c4a[_0x6d90('0x80')](_0x1c053f[_0x6d90('0x32')][_0x6d90('0x65')]);}})[_0x6d90('0x23')](function(_0x25b3d6){if(_0x25b3d6){return db['CmHopper'][_0x6d90('0x27')]({'where':{'ListId':_0x1c053f['query']['ids'],'CampaignId':_0x1c053f[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](function(){return _0x25b3d6;});}})[_0x6d90('0x23')](respondWithStatusCode(_0x2900eb,null))['catch'](handleError(_0x2900eb,null));};exports[_0x6d90('0x81')]=function(_0x8f5554,_0x505ca9,_0x3b46a7){var _0x2ffbc6={};var _0x4e7418={};var _0x3103d0;var _0x3076e6;return db[_0x6d90('0x40')][_0x6d90('0x57')]({'where':{'id':_0x8f5554['params']['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x505ca9,null))[_0x6d90('0x23')](function(_0x4353e9){if(_0x4353e9){_0x3103d0=_0x4353e9;_0x4e7418[_0x6d90('0x31')]=_[_0x6d90('0x33')](db[_0x6d90('0x63')][_0x6d90('0x2e')]);_0x4e7418[_0x6d90('0x32')]=_['keys'](_0x8f5554[_0x6d90('0x32')]);_0x4e7418[_0x6d90('0x3d')]=_['intersection'](_0x4e7418[_0x6d90('0x31')],_0x4e7418[_0x6d90('0x32')]);_0x2ffbc6[_0x6d90('0x35')]=_[_0x6d90('0x34')](_0x4e7418[_0x6d90('0x31')],qs[_0x6d90('0x36')](_0x8f5554['query'][_0x6d90('0x36')]));_0x2ffbc6[_0x6d90('0x35')]=_0x2ffbc6[_0x6d90('0x35')][_0x6d90('0x37')]?_0x2ffbc6['attributes']:_0x4e7418['model'];_0x2ffbc6['order']=qs[_0x6d90('0x3b')](_0x8f5554[_0x6d90('0x32')]['sort']);_0x2ffbc6[_0x6d90('0x3c')]=qs['filters'](_[_0x6d90('0x5f')](_0x8f5554[_0x6d90('0x32')],_0x4e7418[_0x6d90('0x3d')]));if(_0x8f5554[_0x6d90('0x32')][_0x6d90('0x3e')]){_0x2ffbc6[_0x6d90('0x3c')]=_['merge'](_0x2ffbc6[_0x6d90('0x3c')],{'$or':_['map'](_0x2ffbc6[_0x6d90('0x35')],function(_0x16d5ae){var _0x1f235e={};_0x1f235e[_0x16d5ae]={'$like':'%'+_0x8f5554[_0x6d90('0x32')][_0x6d90('0x3e')]+'%'};return _0x1f235e;})});}_0x2ffbc6=_[_0x6d90('0x46')]({},_0x2ffbc6,_0x8f5554[_0x6d90('0x3f')]);return _0x3103d0[_0x6d90('0x81')](_0x2ffbc6);}})[_0x6d90('0x23')](function(_0x13a1d2){if(_0x13a1d2){_0x3076e6=_0x13a1d2[_0x6d90('0x37')];if(!_0x8f5554[_0x6d90('0x32')][_0x6d90('0x38')](_0x6d90('0x39'))){_0x2ffbc6[_0x6d90('0x1d')]=qs[_0x6d90('0x1d')](_0x8f5554[_0x6d90('0x32')]['limit']);_0x2ffbc6[_0x6d90('0x1c')]=qs[_0x6d90('0x1c')](_0x8f5554[_0x6d90('0x32')][_0x6d90('0x1c')]);}return _0x3103d0[_0x6d90('0x81')](_0x2ffbc6);}})[_0x6d90('0x23')](function(_0x397aac){if(_0x397aac){return _0x397aac?{'count':_0x3076e6,'rows':_0x397aac}:null;}})['then'](respondWithResult(_0x505ca9,null))[_0x6d90('0x44')](handleError(_0x505ca9,null));};exports[_0x6d90('0x82')]=function(_0x47b82b,_0x4feca8,_0x5ccdbe){var _0x2c5ad4,_0xe7c526;return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x47b82b['params']['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x4feca8,null))[_0x6d90('0x23')](function(_0x5dd67a){if(_0x5dd67a){_0xe7c526=_0x5dd67a;return _0x5dd67a['addBlackLists'](_0x47b82b[_0x6d90('0x54')]['ids'],_[_0x6d90('0x51')](_0x47b82b[_0x6d90('0x54')],['ids','id'])||{});}return null;})[_0x6d90('0x66')](function(_0x4c7d09){var _0x5e1bfb;_0x2c5ad4=_0x4c7d09||[];var _0x2e357d=[];if(_0x4c7d09){for(var _0x2653cc=0x0;_0x2653cc<_0x4c7d09[_0x6d90('0x37')];_0x2653cc+=0x1){var _0x2e553e=_0x4c7d09[_0x2653cc][_0x6d90('0x24')]({'plain':!![]});_0x5e1bfb=squel['insert']()['into'](_0x6d90('0x83'))[_0x6d90('0x6b')]([_0x6d90('0x6c'),'ContactId','ListId',_0x6d90('0x59'),_0x6d90('0x52'),_0x6d90('0x53')],squel['select']()[_0x6d90('0x70')](_0x6d90('0x6c'),_0x6d90('0x6c'))[_0x6d90('0x70')]('id',_0x6d90('0x71'))[_0x6d90('0x70')](_0x2e553e[_0x6d90('0x72')][_0x6d90('0x73')](),_0x6d90('0x6e'))[_0x6d90('0x70')](_0x47b82b[_0x6d90('0x50')]['id'][_0x6d90('0x73')](),'CampaignId')[_0x6d90('0x70')](_0x6d90('0x74'),_0x6d90('0x52'))[_0x6d90('0x70')](_0x6d90('0x74'),'updatedAt')[_0x6d90('0x75')](_0x6d90('0x7d'))[_0x6d90('0x3c')](_0x6d90('0x76'))[_0x6d90('0x3c')](_0x6d90('0x77'),_0x2e553e['CmListId']['toString']())[_0x6d90('0x3c')](_0x6d90('0x78')))['toString']();_0x2e357d[_0x6d90('0x7e')](db[_0x6d90('0x84')]['query'](_0x5e1bfb));}return BPromise[_0x6d90('0x7f')](_0x2e357d);}})[_0x6d90('0x23')](function(){return _0x2c5ad4;})[_0x6d90('0x23')](respondWithResult(_0x4feca8,null))[_0x6d90('0x44')](handleError(_0x4feca8,null));};exports[_0x6d90('0x85')]=function(_0x3ca168,_0x443e03,_0x22f1f2){return db[_0x6d90('0x40')][_0x6d90('0x4b')]({'where':{'id':_0x3ca168[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](handleEntityNotFound(_0x443e03,null))[_0x6d90('0x23')](function(_0x43d9cb){if(_0x43d9cb){return _0x43d9cb['removeBlackLists'](_0x3ca168[_0x6d90('0x32')][_0x6d90('0x65')]);}})[_0x6d90('0x23')](function(_0x2547ca){if(_0x2547ca){return db[_0x6d90('0x61')][_0x6d90('0x27')]({'where':{'ListId':_0x3ca168['query'][_0x6d90('0x65')],'CampaignId':_0x3ca168[_0x6d90('0x50')]['id']}})[_0x6d90('0x23')](function(){return _0x2547ca;});}})[_0x6d90('0x23')](respondWithStatusCode(_0x443e03,null))[_0x6d90('0x44')](handleError(_0x443e03,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7c6dbf5..9102b27 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 _0xb24d=['rimraf','../../config/environment','./campaign.attributes','Campaign','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb24d,0x13c));var _0xdb24=function(_0x290bfa,_0x11324e){_0x290bfa=_0x290bfa-0x0;var _0x4b170d=_0xb24d[_0x290bfa];return _0x4b170d;};'use strict';var _=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var logger=require(_0xdb24('0x2'))(_0xdb24('0x3'));var moment=require(_0xdb24('0x4'));var BPromise=require(_0xdb24('0x5'));var rp=require(_0xdb24('0x6'));var fs=require('fs');var path=require(_0xdb24('0x7'));var rimraf=require(_0xdb24('0x8'));var config=require(_0xdb24('0x9'));var attributes=require(_0xdb24('0xa'));module['exports']=function(_0x243eb8,_0x286405){return _0x243eb8['define'](_0xdb24('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5097=['moment','request-promise','rimraf','../../config/environment','./campaign.attributes','define','Campaign','lodash','util','../../config/logger','api'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5097,0xb7));var _0x7509=function(_0x19e38b,_0x20cc0c){_0x19e38b=_0x19e38b-0x0;var _0x37ede5=_0x5097[_0x19e38b];return _0x37ede5;};'use strict';var _=require(_0x7509('0x0'));var util=require(_0x7509('0x1'));var logger=require(_0x7509('0x2'))(_0x7509('0x3'));var moment=require(_0x7509('0x4'));var BPromise=require('bluebird');var rp=require(_0x7509('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7509('0x6'));var config=require(_0x7509('0x7'));var attributes=require(_0x7509('0x8'));module['exports']=function(_0x5008fd,_0x595079){return _0x5008fd[_0x7509('0x9')](_0x7509('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 0639fa7..0445f3b 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0xbac7c9,_0x27e9ae){var _0x390e78=function(_0x18ca61){while(--_0x18ca61){_0xbac7c9['push'](_0xbac7c9['shift']());}};_0x390e78(++_0x27e9ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x3bd004,_0x2ef2ce){var _0x865270=function(_0x3d68e4){while(--_0x3d68e4){_0x3bd004['push'](_0x3bd004['shift']());}};_0x865270(++_0x2ef2ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fe0c05f..23db3c4 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 _0x70e3=['clone','addLists','/:id/blacklists','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone'];(function(_0x1231d3,_0x2ea4f8){var _0x92313c=function(_0xbf128e){while(--_0xbf128e){_0x1231d3['push'](_0x1231d3['shift']());}};_0x92313c(++_0x2ea4f8);}(_0x70e3,0x117));var _0x370e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x70e3[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var timeout=require(_0x370e('0x3'));var express=require('express');var router=express[_0x370e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x370e('0x5'));var controller=require('./campaign.controller');router[_0x370e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x370e('0x7')](),controller['show']);router[_0x370e('0x6')](_0x370e('0x8'),auth[_0x370e('0x7')](),controller[_0x370e('0x9')]);router['get'](_0x370e('0xa'),auth[_0x370e('0x7')](),controller[_0x370e('0xb')]);router['get'](_0x370e('0xc'),auth[_0x370e('0x7')](),controller[_0x370e('0xd')]);router[_0x370e('0x6')](_0x370e('0xe'),auth[_0x370e('0x7')](),controller[_0x370e('0xf')]);router['get'](_0x370e('0x10'),auth[_0x370e('0x7')](),controller[_0x370e('0x11')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x370e('0x12')]);router[_0x370e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x370e('0x14'),auth[_0x370e('0x7')](),controller[_0x370e('0x15')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x370e('0x16')]);router[_0x370e('0x13')](_0x370e('0x17'),auth[_0x370e('0x7')](),controller['addBlackLists']);router[_0x370e('0x18')](_0x370e('0x19'),auth[_0x370e('0x7')](),controller[_0x370e('0x1a')]);router[_0x370e('0x1b')](_0x370e('0x19'),auth['isAuthenticated'](),controller[_0x370e('0x1c')]);router[_0x370e('0x1b')](_0x370e('0x10'),auth[_0x370e('0x7')](),controller['removeLists']);router[_0x370e('0x1b')](_0x370e('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x370e('0x1d')]=router; \ No newline at end of file +var _0x7381=['index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','clone','post','addLists','addBlackLists','update','delete','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated'];(function(_0x34a024,_0xa6ff71){var _0x384e5c=function(_0x5e7f78){while(--_0x5e7f78){_0x34a024['push'](_0x34a024['shift']());}};_0x384e5c(++_0xa6ff71);}(_0x7381,0x18c));var _0x1738=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x7381[_0x5b3950];return _0x41e436;};'use strict';var multer=require(_0x1738('0x0'));var util=require(_0x1738('0x1'));var path=require(_0x1738('0x2'));var timeout=require(_0x1738('0x3'));var express=require(_0x1738('0x4'));var router=express[_0x1738('0x5')]();var auth=require(_0x1738('0x6'));var interaction=require(_0x1738('0x7'));var config=require(_0x1738('0x8'));var controller=require(_0x1738('0x9'));router[_0x1738('0xa')]('/',auth[_0x1738('0xb')](),controller[_0x1738('0xc')]);router[_0x1738('0xa')](_0x1738('0xd'),auth['isAuthenticated'](),controller[_0x1738('0xe')]);router['get'](_0x1738('0xf'),auth[_0x1738('0xb')](),controller[_0x1738('0x10')]);router['get'](_0x1738('0x11'),auth[_0x1738('0xb')](),controller['getHopperHistories']);router[_0x1738('0xa')](_0x1738('0x12'),auth['isAuthenticated'](),controller[_0x1738('0x13')]);router[_0x1738('0xa')](_0x1738('0x14'),auth['isAuthenticated'](),controller[_0x1738('0x15')]);router[_0x1738('0xa')](_0x1738('0x16'),auth[_0x1738('0xb')](),controller[_0x1738('0x17')]);router[_0x1738('0xa')](_0x1738('0x18'),auth[_0x1738('0xb')](),controller[_0x1738('0x19')]);router['post']('/',auth[_0x1738('0xb')](),controller[_0x1738('0x1a')]);router['post']('/:id/clone',auth[_0x1738('0xb')](),controller[_0x1738('0x1b')]);router[_0x1738('0x1c')](_0x1738('0x16'),auth[_0x1738('0xb')](),controller[_0x1738('0x1d')]);router['post'](_0x1738('0x18'),auth[_0x1738('0xb')](),controller[_0x1738('0x1e')]);router['put'](_0x1738('0xd'),auth[_0x1738('0xb')](),controller[_0x1738('0x1f')]);router[_0x1738('0x20')](_0x1738('0xd'),auth[_0x1738('0xb')](),controller['destroy']);router[_0x1738('0x20')]('/:id/lists',auth[_0x1738('0xb')](),controller['removeLists']);router['delete'](_0x1738('0x18'),auth[_0x1738('0xb')](),controller[_0x1738('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1737230..f6f13c7 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 _0x85c5=['key','sequelize','STRING','TEXT','VIRTUAL'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x85c5,0x12d));var _0x585c=function(_0x440115,_0x1a44c3){_0x440115=_0x440115-0x0;var _0x50e58d=_0x85c5[_0x440115];return _0x50e58d;};'use strict';var Sequelize=require(_0x585c('0x0'));module['exports']={'key':{'type':Sequelize[_0x585c('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x585c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x585c('0x1')]},'name':{'type':Sequelize[_0x585c('0x3')],'get':function(){return this['getDataValue'](_0x585c('0x4'));}}}; \ No newline at end of file +var _0x00f6=['sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x269048,_0x2fc737){var _0x23bf5d=function(_0x230d93){while(--_0x230d93){_0x269048['push'](_0x269048['shift']());}};_0x23bf5d(++_0x2fc737);}(_0x00f6,0x131));var _0x600f=function(_0xe406b,_0x2b369d){_0xe406b=_0xe406b-0x0;var _0xe7e1f=_0x00f6[_0xe406b];return _0xe7e1f;};'use strict';var Sequelize=require(_0x600f('0x0'));module[_0x600f('0x1')]={'key':{'type':Sequelize[_0x600f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x600f('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x600f('0x2')]},'name':{'type':Sequelize[_0x600f('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d13181d..db51f95 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x512068,_0x33618d){var _0x4c7df6=function(_0xa0718f){while(--_0xa0718f){_0x512068['push'](_0x512068['shift']());}};_0x4c7df6(++_0x33618d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d5aef63..5636ce2 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 _0xc6eb=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3862cd,_0x299e88){var _0x2864a1=function(_0x3aa417){while(--_0x3aa417){_0x3862cd['push'](_0x3862cd['shift']());}};_0x2864a1(++_0x299e88);}(_0xc6eb,0x118));var _0xbc6e=function(_0xf25c17,_0x288f2c){_0xf25c17=_0xf25c17-0x0;var _0x429736=_0xc6eb[_0xf25c17];return _0x429736;};'use strict';var _=require(_0xbc6e('0x0'));var util=require('util');var logger=require(_0xbc6e('0x1'))(_0xbc6e('0x2'));var moment=require('moment');var BPromise=require(_0xbc6e('0x3'));var rp=require(_0xbc6e('0x4'));var fs=require('fs');var path=require(_0xbc6e('0x5'));var rimraf=require(_0xbc6e('0x6'));var config=require(_0xbc6e('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xbc6e('0x8')]=function(_0x23fe5e,_0x38a5ca){return _0x23fe5e[_0xbc6e('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x45a6=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb43cd8,_0x167146){var _0x33eda9=function(_0x367470){while(--_0x367470){_0xb43cd8['push'](_0xb43cd8['shift']());}};_0x33eda9(++_0x167146);}(_0x45a6,0x116));var _0x645a=function(_0x32850b,_0x1752d5){_0x32850b=_0x32850b-0x0;var _0x4c555d=_0x45a6[_0x32850b];return _0x4c555d;};'use strict';var _=require(_0x645a('0x0'));var util=require(_0x645a('0x1'));var logger=require(_0x645a('0x2'))(_0x645a('0x3'));var moment=require(_0x645a('0x4'));var BPromise=require(_0x645a('0x5'));var rp=require(_0x645a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x645a('0x7'));var config=require(_0x645a('0x8'));var attributes=require(_0x645a('0x9'));module[_0x645a('0xa')]=function(_0x1deaf5,_0x3768c8){return _0x1deaf5[_0x645a('0xb')](_0x645a('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x645a('0xd'),'collate':_0x645a('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4e1e061..29b90d0 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 _0xbcbf=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','CannedAnswer,\x20%s,\x20%s','message','util','moment'];(function(_0x23f3fe,_0x37a19c){var _0x1b1cb1=function(_0x1a96a7){while(--_0x1a96a7){_0x23f3fe['push'](_0x23f3fe['shift']());}};_0x1b1cb1(++_0x37a19c);}(_0xbcbf,0x1cc));var _0xfbcb=function(_0x374ed0,_0x1123b8){_0x374ed0=_0x374ed0-0x0;var _0x124a8e=_0xbcbf[_0x374ed0];return _0x124a8e;};'use strict';var _=require('lodash');var util=require(_0xfbcb('0x0'));var moment=require(_0xfbcb('0x1'));var BPromise=require(_0xfbcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbcb('0x3'));var db=require(_0xfbcb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbcb('0x5'))(_0xfbcb('0x6'));var config=require(_0xfbcb('0x7'));var jayson=require(_0xfbcb('0x8'));var client=jayson[_0xfbcb('0x9')][_0xfbcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4696b5,_0x487c8a,_0x23fab2){return new BPromise(function(_0x15af39,_0x47bda7){return client[_0xfbcb('0xb')](_0x4696b5,_0x23fab2)[_0xfbcb('0xc')](function(_0x26a170){logger[_0xfbcb('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x487c8a,_0xfbcb('0xe'));logger[_0xfbcb('0xf')](_0xfbcb('0x10'),_0x487c8a,_0xfbcb('0xe'),JSON['stringify'](_0x26a170));if(_0x26a170[_0xfbcb('0x11')]){if(_0x26a170['error'][_0xfbcb('0x12')]===0x1f4){logger[_0xfbcb('0x11')](_0xfbcb('0x13'),_0x487c8a,_0x26a170[_0xfbcb('0x11')][_0xfbcb('0x14')]);return _0x47bda7(_0x26a170[_0xfbcb('0x11')][_0xfbcb('0x14')]);}logger[_0xfbcb('0x11')](_0xfbcb('0x13'),_0x487c8a,_0x26a170[_0xfbcb('0x11')][_0xfbcb('0x14')]);return _0x15af39(_0x26a170['error'][_0xfbcb('0x14')]);}else{logger[_0xfbcb('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x487c8a,'request\x20sent');_0x15af39(_0x26a170['result'][_0xfbcb('0x14')]);}})['catch'](function(_0x550bba){logger[_0xfbcb('0x11')](_0xfbcb('0x13'),_0x487c8a,_0x550bba);_0x47bda7(_0x550bba);});});} \ No newline at end of file +var _0x0351=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c9d00,_0x5092d5){var _0x4a73f5=function(_0xc0bfc7){while(--_0xc0bfc7){_0x4c9d00['push'](_0x4c9d00['shift']());}};_0x4a73f5(++_0x5092d5);}(_0x0351,0x136));var _0x1035=function(_0x20993f,_0x514a9c){_0x20993f=_0x20993f-0x0;var _0x1958e5=_0x0351[_0x20993f];return _0x1958e5;};'use strict';var _=require(_0x1035('0x0'));var util=require(_0x1035('0x1'));var moment=require(_0x1035('0x2'));var BPromise=require(_0x1035('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1035('0x4'));var db=require(_0x1035('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1035('0x6'))(_0x1035('0x7'));var config=require(_0x1035('0x8'));var jayson=require(_0x1035('0x9'));var client=jayson[_0x1035('0xa')][_0x1035('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b195a,_0x6af56e,_0x3b70b7){return new BPromise(function(_0x1f838f,_0xcb9235){return client[_0x1035('0xc')](_0x3b195a,_0x3b70b7)['then'](function(_0x15b5d3){logger[_0x1035('0xd')](_0x1035('0xe'),_0x6af56e,_0x1035('0xf'));logger[_0x1035('0x10')](_0x1035('0x11'),_0x6af56e,_0x1035('0xf'),JSON[_0x1035('0x12')](_0x15b5d3));if(_0x15b5d3['error']){if(_0x15b5d3[_0x1035('0x13')]['code']===0x1f4){logger[_0x1035('0x13')](_0x1035('0xe'),_0x6af56e,_0x15b5d3[_0x1035('0x13')]['message']);return _0xcb9235(_0x15b5d3[_0x1035('0x13')][_0x1035('0x14')]);}logger[_0x1035('0x13')](_0x1035('0xe'),_0x6af56e,_0x15b5d3['error'][_0x1035('0x14')]);return _0x1f838f(_0x15b5d3[_0x1035('0x13')][_0x1035('0x14')]);}else{logger[_0x1035('0xd')](_0x1035('0xe'),_0x6af56e,_0x1035('0xf'));_0x1f838f(_0x15b5d3[_0x1035('0x15')]['message']);}})['catch'](function(_0x3c54f7){logger[_0x1035('0x13')](_0x1035('0xe'),_0x6af56e,_0x3c54f7);_0xcb9235(_0x3c54f7);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 549e5ed..467a64d 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 _0xd78e=['isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post','put'];(function(_0x8f53b,_0x1f5ebc){var _0x37bcce=function(_0x420962){while(--_0x420962){_0x8f53b['push'](_0x8f53b['shift']());}};_0x37bcce(++_0x1f5ebc);}(_0xd78e,0x19b));var _0xed78=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xd78e[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require('multer');var util=require(_0xed78('0x0'));var path=require(_0xed78('0x1'));var timeout=require(_0xed78('0x2'));var express=require(_0xed78('0x3'));var router=express[_0xed78('0x4')]();var auth=require(_0xed78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed78('0x6'));var controller=require(_0xed78('0x7'));router[_0xed78('0x8')]('/',auth['isAuthenticated'](),controller[_0xed78('0x9')]);router[_0xed78('0x8')](_0xed78('0xa'),auth['isAuthenticated'](),controller[_0xed78('0xb')]);router[_0xed78('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xed78('0xd')](_0xed78('0xa'),auth[_0xed78('0xe')](),controller['update']);router['delete'](_0xed78('0xa'),auth[_0xed78('0xe')](),controller[_0xed78('0xf')]);module[_0xed78('0x10')]=router; \ No newline at end of file +var _0x7bd6=['../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x1b7ad0,_0x25c5c3){var _0x424a5a=function(_0x5ece94){while(--_0x5ece94){_0x1b7ad0['push'](_0x1b7ad0['shift']());}};_0x424a5a(++_0x25c5c3);}(_0x7bd6,0x1e7));var _0x67bd=function(_0x5c4139,_0x12479e){_0x5c4139=_0x5c4139-0x0;var _0x5df4b6=_0x7bd6[_0x5c4139];return _0x5df4b6;};'use strict';var multer=require(_0x67bd('0x0'));var util=require(_0x67bd('0x1'));var path=require(_0x67bd('0x2'));var timeout=require(_0x67bd('0x3'));var express=require(_0x67bd('0x4'));var router=express['Router']();var auth=require(_0x67bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67bd('0x6'));var controller=require(_0x67bd('0x7'));router[_0x67bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x67bd('0x9')]);router[_0x67bd('0x8')](_0x67bd('0xa'),auth[_0x67bd('0xb')](),controller[_0x67bd('0xc')]);router[_0x67bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x67bd('0xe')]);router['put'](_0x67bd('0xa'),auth[_0x67bd('0xb')](),controller[_0x67bd('0xf')]);router[_0x67bd('0x10')](_0x67bd('0xa'),auth[_0x67bd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 47c25d5..fc80cab 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 _0x0490=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x41ddbd,_0x122cd8){var _0x462dfd=function(_0x58b990){while(--_0x58b990){_0x41ddbd['push'](_0x41ddbd['shift']());}};_0x462dfd(++_0x122cd8);}(_0x0490,0xe7));var _0x0049=function(_0x4fa67c,_0x35075d){_0x4fa67c=_0x4fa67c-0x0;var _0x42c7c3=_0x0490[_0x4fa67c];return _0x42c7c3;};'use strict';var Sequelize=require(_0x0049('0x0'));module[_0x0049('0x1')]={'calldate':{'type':Sequelize[_0x0049('0x2')],'allowNull':![],'defaultValue':_0x0049('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0049('0x4')]},'dst':{'type':Sequelize[_0x0049('0x4')]},'dcontext':{'type':Sequelize[_0x0049('0x4')]},'channel':{'type':Sequelize[_0x0049('0x4')]},'dstchannel':{'type':Sequelize[_0x0049('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0049('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0049('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0049('0x4')]},'amaflags':{'type':Sequelize[_0x0049('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0049('0x4')]},'userfield':{'type':Sequelize[_0x0049('0x4')]},'uniqueid':{'type':Sequelize[_0x0049('0x4')]},'linkedid':{'type':Sequelize[_0x0049('0x4')]},'sequence':{'type':Sequelize[_0x0049('0x4')]},'peeraccount':{'type':Sequelize[_0x0049('0x4')]},'type':{'type':Sequelize[_0x0049('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4df8=['sequelize','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4df8,0x1a4));var _0x84df=function(_0x2fa436,_0x1aa6f6){_0x2fa436=_0x2fa436-0x0;var _0x8b4a17=_0x4df8[_0x2fa436];return _0x8b4a17;};'use strict';var Sequelize=require(_0x84df('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x84df('0x1')},'clid':{'type':Sequelize[_0x84df('0x2')]},'src':{'type':Sequelize[_0x84df('0x2')]},'dst':{'type':Sequelize[_0x84df('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x84df('0x2')]},'dstchannel':{'type':Sequelize[_0x84df('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x84df('0x2')]},'duration':{'type':Sequelize[_0x84df('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x84df('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x84df('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x84df('0x2')]},'userfield':{'type':Sequelize[_0x84df('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x84df('0x2')]},'peeraccount':{'type':Sequelize[_0x84df('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x84df('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index fdf977e..6e2d3b8 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 _0x824e=['../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Cdr','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x824e,0xfa));var _0xe824=function(_0x105b20,_0x388d13){_0x105b20=_0x105b20-0x0;var _0x357455=_0x824e[_0x105b20];return _0x357455;};'use strict';var pdf=require(_0xe824('0x0'));var emlformat=require(_0xe824('0x1'));var rimraf=require(_0xe824('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe824('0x3'));var rp=require(_0xe824('0x4'));var moment=require(_0xe824('0x5'));var BPromise=require(_0xe824('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe824('0x7'));var ejs=require(_0xe824('0x8'));var fs=require('fs');var _=require(_0xe824('0x9'));var squel=require(_0xe824('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe824('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe824('0xc'));var Redis=require(_0xe824('0xd'));var authService=require(_0xe824('0xe'));var qs=require(_0xe824('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe824('0x10'));var logger=require(_0xe824('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe824('0x12'));var licenseUtil=require(_0xe824('0x13'));var db=require(_0xe824('0x14'))['db'];function respondWithStatusCode(_0x589874,_0x1eb8c2){_0x1eb8c2=_0x1eb8c2||0xcc;return function(_0x685706){if(_0x685706){return _0x589874['sendStatus'](_0x1eb8c2);}return _0x589874[_0xe824('0x15')](_0x1eb8c2)[_0xe824('0x16')]();};}function respondWithResult(_0x3aa6c8,_0xfbd369){_0xfbd369=_0xfbd369||0xc8;return function(_0x4ac705){if(_0x4ac705){return _0x3aa6c8[_0xe824('0x15')](_0xfbd369)['json'](_0x4ac705);}};}function respondWithFilteredResult(_0x3122ac,_0x2f96c3){return function(_0x512960){if(_0x512960){var _0x1867d9=_0x512960[_0xe824('0x17')],_0x4b5bc1=_0x2f96c3['offset'],_0x4b5342=_0x2f96c3[_0xe824('0x18')]+_0x2f96c3['limit'],_0x17e6dd;if(_0x4b5342>=_0x1867d9){_0x4b5342=_0x1867d9;_0x17e6dd=0xc8;}else{_0x17e6dd=0xce;}_0x3122ac[_0xe824('0x15')](_0x17e6dd);return _0x3122ac[_0xe824('0x19')](_0xe824('0x1a'),_0x4b5bc1+'-'+_0x4b5342+'/'+_0x1867d9)['json'](_0x512960);}return null;};}function patchUpdates(_0x1354b4){return function(_0x5c5ea2){try{jsonpatch['apply'](_0x5c5ea2,_0x1354b4,!![]);}catch(_0x2112dd){return BPromise[_0xe824('0x1b')](_0x2112dd);}return _0x5c5ea2[_0xe824('0x1c')]();};}function saveUpdates(_0x108d5a,_0x28b2a4){return function(_0x5abd50){if(_0x5abd50){return _0x5abd50[_0xe824('0x1d')](_0x108d5a)[_0xe824('0x1e')](function(_0x2324c9){return _0x2324c9;});}return null;};}function removeEntity(_0x257e89,_0x13f63b){return function(_0x145f62){if(_0x145f62){return _0x145f62[_0xe824('0x1f')]()[_0xe824('0x1e')](function(){_0x257e89[_0xe824('0x15')](0xcc)[_0xe824('0x16')]();});}};}function handleEntityNotFound(_0xd18775,_0x1a68e6){return function(_0x593797){if(!_0x593797){_0xd18775['sendStatus'](0x194);}return _0x593797;};}function handleError(_0x4d7818,_0x179140){_0x179140=_0x179140||0x1f4;return function(_0x5b04a0){logger[_0xe824('0x20')](_0x5b04a0[_0xe824('0x21')]);if(_0x5b04a0[_0xe824('0x22')]){delete _0x5b04a0[_0xe824('0x22')];}_0x4d7818['status'](_0x179140)[_0xe824('0x23')](_0x5b04a0);};}exports['index']=function(_0x331dd3,_0x4a5cfe){var _0x2ffbb8={},_0x4a5f45={},_0x5a3b87={'count':0x0,'rows':[]};var _0x405b22=_['map'](db[_0xe824('0x24')][_0xe824('0x25')],function(_0x5a38db){return{'name':_0x5a38db['fieldName'],'type':_0x5a38db['type'][_0xe824('0x26')]};});_0x4a5f45[_0xe824('0x27')]=_['map'](_0x405b22,_0xe824('0x22'));_0x4a5f45[_0xe824('0x28')]=_['keys'](_0x331dd3[_0xe824('0x28')]);_0x4a5f45[_0xe824('0x29')]=_['intersection'](_0x4a5f45[_0xe824('0x27')],_0x4a5f45[_0xe824('0x28')]);_0x2ffbb8[_0xe824('0x2a')]=_[_0xe824('0x2b')](_0x4a5f45[_0xe824('0x27')],qs[_0xe824('0x2c')](_0x331dd3['query']['fields']));_0x2ffbb8[_0xe824('0x2a')]=_0x2ffbb8['attributes']['length']?_0x2ffbb8[_0xe824('0x2a')]:_0x4a5f45[_0xe824('0x27')];if(!_0x331dd3[_0xe824('0x28')][_0xe824('0x2d')](_0xe824('0x2e'))){_0x2ffbb8[_0xe824('0x2f')]=qs[_0xe824('0x2f')](_0x331dd3[_0xe824('0x28')][_0xe824('0x2f')]);_0x2ffbb8[_0xe824('0x18')]=qs[_0xe824('0x18')](_0x331dd3[_0xe824('0x28')][_0xe824('0x18')]);}_0x2ffbb8['order']=qs[_0xe824('0x30')](_0x331dd3[_0xe824('0x28')][_0xe824('0x30')]);_0x2ffbb8[_0xe824('0x31')]=qs['filters'](_[_0xe824('0x32')](_0x331dd3[_0xe824('0x28')],_0x4a5f45['filters']),_0x405b22);if(_0x331dd3['query'][_0xe824('0x33')]){_0x2ffbb8[_0xe824('0x31')]=_[_0xe824('0x34')](_0x2ffbb8[_0xe824('0x31')],{'$or':_['map'](_0x405b22,function(_0x5d6c08){if(_0x5d6c08[_0xe824('0x35')]!==_0xe824('0x36')){var _0x5cdb15={};_0x5cdb15[_0x5d6c08[_0xe824('0x22')]]={'$like':'%'+_0x331dd3[_0xe824('0x28')][_0xe824('0x33')]+'%'};return _0x5cdb15;}})});}_0x2ffbb8=_[_0xe824('0x34')]({},_0x2ffbb8,_0x331dd3['options']);var _0x2ca849={'where':_0x2ffbb8[_0xe824('0x31')]};return db['Cdr'][_0xe824('0x17')](_0x2ca849)[_0xe824('0x1e')](function(_0x58cb4d){_0x5a3b87['count']=_0x58cb4d;if(_0x331dd3[_0xe824('0x28')][_0xe824('0x37')]){_0x2ffbb8['include']=[{'all':!![]}];}return db[_0xe824('0x24')][_0xe824('0x38')](_0x2ffbb8);})[_0xe824('0x1e')](function(_0x32a85a){_0x5a3b87[_0xe824('0x39')]=_0x32a85a;return _0x5a3b87;})[_0xe824('0x1e')](respondWithFilteredResult(_0x4a5cfe,_0x2ffbb8))[_0xe824('0x3a')](handleError(_0x4a5cfe,null));};exports[_0xe824('0x3b')]=function(_0x187015,_0x4908bc){var _0x5125a5={'raw':!![],'where':{'id':_0x187015[_0xe824('0x3c')]['id']}},_0x28956c={};_0x28956c[_0xe824('0x27')]=_[_0xe824('0x3d')](db['Cdr'][_0xe824('0x25')]);_0x28956c[_0xe824('0x28')]=_['keys'](_0x187015[_0xe824('0x28')]);_0x28956c['filters']=_[_0xe824('0x2b')](_0x28956c[_0xe824('0x27')],_0x28956c[_0xe824('0x28')]);_0x5125a5[_0xe824('0x2a')]=_[_0xe824('0x2b')](_0x28956c['model'],qs[_0xe824('0x2c')](_0x187015['query'][_0xe824('0x2c')]));_0x5125a5[_0xe824('0x2a')]=_0x5125a5[_0xe824('0x2a')]['length']?_0x5125a5['attributes']:_0x28956c[_0xe824('0x27')];if(_0x187015[_0xe824('0x28')][_0xe824('0x37')]){_0x5125a5[_0xe824('0x3e')]=[{'all':!![]}];}_0x5125a5=_['merge']({},_0x5125a5,_0x187015['options']);return db[_0xe824('0x24')]['find'](_0x5125a5)['then'](handleEntityNotFound(_0x4908bc,null))['then'](respondWithResult(_0x4908bc,null))[_0xe824('0x3a')](handleError(_0x4908bc,null));};exports[_0xe824('0x3f')]=function(_0x292559,_0x2937ed){return db[_0xe824('0x24')][_0xe824('0x3f')](_0x292559['body'],{})['then'](respondWithResult(_0x2937ed,0xc9))[_0xe824('0x3a')](handleError(_0x2937ed,null));};exports['update']=function(_0xfc3b5a,_0x134478){if(_0xfc3b5a[_0xe824('0x40')]['id']){delete _0xfc3b5a[_0xe824('0x40')]['id'];}return db[_0xe824('0x24')][_0xe824('0x41')]({'where':{'id':_0xfc3b5a['params']['id']}})['then'](handleEntityNotFound(_0x134478,null))['then'](saveUpdates(_0xfc3b5a['body'],null))[_0xe824('0x1e')](respondWithResult(_0x134478,null))[_0xe824('0x3a')](handleError(_0x134478,null));};exports[_0xe824('0x1f')]=function(_0x39f8e5,_0x28ab8f){return db[_0xe824('0x24')]['find']({'where':{'id':_0x39f8e5['params']['id']}})[_0xe824('0x1e')](handleEntityNotFound(_0x28ab8f,null))[_0xe824('0x1e')](removeEntity(_0x28ab8f,null))[_0xe824('0x3a')](handleError(_0x28ab8f,null));};exports[_0xe824('0x42')]=function(_0x45e5c6,_0x3415a0){return db[_0xe824('0x24')][_0xe824('0x42')]()[_0xe824('0x1e')](respondWithResult(_0x3415a0,null))['catch'](handleError(_0x3415a0,null));}; \ No newline at end of file +var _0xb512=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','Cdr','findAll','rows','show','keys','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x44ca60,_0x786e6b){var _0x2fd4d6=function(_0x3acd14){while(--_0x3acd14){_0x44ca60['push'](_0x44ca60['shift']());}};_0x2fd4d6(++_0x786e6b);}(_0xb512,0x7e));var _0x2b51=function(_0x16e7f4,_0x5c1ac3){_0x16e7f4=_0x16e7f4-0x0;var _0x5c69b5=_0xb512[_0x16e7f4];return _0x5c69b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2b51('0x0'));var rimraf=require(_0x2b51('0x1'));var zipdir=require(_0x2b51('0x2'));var jsonpatch=require(_0x2b51('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b51('0x4'));var Mustache=require(_0x2b51('0x5'));var util=require(_0x2b51('0x6'));var path=require(_0x2b51('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b51('0x8'));var jsforce=require(_0x2b51('0x9'));var deskjs=require(_0x2b51('0xa'));var toCsv=require(_0x2b51('0xb'));var querystring=require(_0x2b51('0xc'));var Papa=require(_0x2b51('0xd'));var Redis=require('ioredis');var authService=require(_0x2b51('0xe'));var qs=require(_0x2b51('0xf'));var as=require(_0x2b51('0x10'));var hardwareService=require(_0x2b51('0x11'));var logger=require(_0x2b51('0x12'))(_0x2b51('0x13'));var utils=require(_0x2b51('0x14'));var config=require(_0x2b51('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b51('0x16'))['db'];function respondWithStatusCode(_0x51a026,_0x3ad931){_0x3ad931=_0x3ad931||0xcc;return function(_0x1369d2){if(_0x1369d2){return _0x51a026[_0x2b51('0x17')](_0x3ad931);}return _0x51a026[_0x2b51('0x18')](_0x3ad931)['end']();};}function respondWithResult(_0x18ba89,_0x131c27){_0x131c27=_0x131c27||0xc8;return function(_0x7da71b){if(_0x7da71b){return _0x18ba89['status'](_0x131c27)[_0x2b51('0x19')](_0x7da71b);}};}function respondWithFilteredResult(_0x38de14,_0x2b6d69){return function(_0x27e1b5){if(_0x27e1b5){var _0x8ebbcf=_0x27e1b5[_0x2b51('0x1a')],_0x48bb59=_0x2b6d69[_0x2b51('0x1b')],_0xeed5ee=_0x2b6d69[_0x2b51('0x1b')]+_0x2b6d69[_0x2b51('0x1c')],_0x2e9372;if(_0xeed5ee>=_0x8ebbcf){_0xeed5ee=_0x8ebbcf;_0x2e9372=0xc8;}else{_0x2e9372=0xce;}_0x38de14[_0x2b51('0x18')](_0x2e9372);return _0x38de14[_0x2b51('0x1d')]('Content-Range',_0x48bb59+'-'+_0xeed5ee+'/'+_0x8ebbcf)[_0x2b51('0x19')](_0x27e1b5);}return null;};}function patchUpdates(_0x354f99){return function(_0x2dc6ad){try{jsonpatch[_0x2b51('0x1e')](_0x2dc6ad,_0x354f99,!![]);}catch(_0x2ff1ee){return BPromise[_0x2b51('0x1f')](_0x2ff1ee);}return _0x2dc6ad[_0x2b51('0x20')]();};}function saveUpdates(_0x1aee12,_0x1b2429){return function(_0x2ab5bc){if(_0x2ab5bc){return _0x2ab5bc['update'](_0x1aee12)[_0x2b51('0x21')](function(_0x25df7d){return _0x25df7d;});}return null;};}function removeEntity(_0x86b652,_0x754a2f){return function(_0xb3d6b9){if(_0xb3d6b9){return _0xb3d6b9[_0x2b51('0x22')]()['then'](function(){_0x86b652['status'](0xcc)[_0x2b51('0x23')]();});}};}function handleEntityNotFound(_0x4888c7,_0x54a00b){return function(_0x434f46){if(!_0x434f46){_0x4888c7[_0x2b51('0x17')](0x194);}return _0x434f46;};}function handleError(_0xd0d2eb,_0x189d60){_0x189d60=_0x189d60||0x1f4;return function(_0x198772){logger[_0x2b51('0x24')](_0x198772['stack']);if(_0x198772[_0x2b51('0x25')]){delete _0x198772[_0x2b51('0x25')];}_0xd0d2eb[_0x2b51('0x18')](_0x189d60)[_0x2b51('0x26')](_0x198772);};}exports[_0x2b51('0x27')]=function(_0x3e98cb,_0x269e34){var _0x89c9da={},_0x2d0dc3={},_0x55190c={'count':0x0,'rows':[]};var _0x35e5f1=_[_0x2b51('0x28')](db['Cdr'][_0x2b51('0x29')],function(_0x1e2b75){return{'name':_0x1e2b75[_0x2b51('0x2a')],'type':_0x1e2b75['type'][_0x2b51('0x2b')]};});_0x2d0dc3[_0x2b51('0x2c')]=_[_0x2b51('0x28')](_0x35e5f1,_0x2b51('0x25'));_0x2d0dc3[_0x2b51('0x2d')]=_['keys'](_0x3e98cb['query']);_0x2d0dc3[_0x2b51('0x2e')]=_[_0x2b51('0x2f')](_0x2d0dc3[_0x2b51('0x2c')],_0x2d0dc3['query']);_0x89c9da[_0x2b51('0x30')]=_['intersection'](_0x2d0dc3[_0x2b51('0x2c')],qs[_0x2b51('0x31')](_0x3e98cb[_0x2b51('0x2d')][_0x2b51('0x31')]));_0x89c9da[_0x2b51('0x30')]=_0x89c9da[_0x2b51('0x30')][_0x2b51('0x32')]?_0x89c9da[_0x2b51('0x30')]:_0x2d0dc3['model'];if(!_0x3e98cb[_0x2b51('0x2d')]['hasOwnProperty'](_0x2b51('0x33'))){_0x89c9da[_0x2b51('0x1c')]=qs[_0x2b51('0x1c')](_0x3e98cb[_0x2b51('0x2d')][_0x2b51('0x1c')]);_0x89c9da[_0x2b51('0x1b')]=qs[_0x2b51('0x1b')](_0x3e98cb['query'][_0x2b51('0x1b')]);}_0x89c9da[_0x2b51('0x34')]=qs[_0x2b51('0x35')](_0x3e98cb[_0x2b51('0x2d')]['sort']);_0x89c9da[_0x2b51('0x36')]=qs[_0x2b51('0x2e')](_['pick'](_0x3e98cb['query'],_0x2d0dc3[_0x2b51('0x2e')]),_0x35e5f1);if(_0x3e98cb['query'][_0x2b51('0x37')]){_0x89c9da[_0x2b51('0x36')]=_['merge'](_0x89c9da['where'],{'$or':_[_0x2b51('0x28')](_0x35e5f1,function(_0x5d98d5){if(_0x5d98d5['type']!==_0x2b51('0x38')){var _0x258721={};_0x258721[_0x5d98d5['name']]={'$like':'%'+_0x3e98cb[_0x2b51('0x2d')][_0x2b51('0x37')]+'%'};return _0x258721;}})});}_0x89c9da=_[_0x2b51('0x39')]({},_0x89c9da,_0x3e98cb[_0x2b51('0x3a')]);var _0x422cdd={'where':_0x89c9da['where']};return db['Cdr'][_0x2b51('0x1a')](_0x422cdd)[_0x2b51('0x21')](function(_0x26edfc){_0x55190c['count']=_0x26edfc;if(_0x3e98cb['query']['includeAll']){_0x89c9da[_0x2b51('0x3b')]=[{'all':!![]}];}return db[_0x2b51('0x3c')][_0x2b51('0x3d')](_0x89c9da);})[_0x2b51('0x21')](function(_0x8f25d1){_0x55190c[_0x2b51('0x3e')]=_0x8f25d1;return _0x55190c;})[_0x2b51('0x21')](respondWithFilteredResult(_0x269e34,_0x89c9da))['catch'](handleError(_0x269e34,null));};exports[_0x2b51('0x3f')]=function(_0x2dc7f2,_0x599a35){var _0xac8f63={'raw':!![],'where':{'id':_0x2dc7f2['params']['id']}},_0x2a2863={};_0x2a2863[_0x2b51('0x2c')]=_[_0x2b51('0x40')](db['Cdr'][_0x2b51('0x29')]);_0x2a2863[_0x2b51('0x2d')]=_[_0x2b51('0x40')](_0x2dc7f2[_0x2b51('0x2d')]);_0x2a2863[_0x2b51('0x2e')]=_['intersection'](_0x2a2863['model'],_0x2a2863[_0x2b51('0x2d')]);_0xac8f63[_0x2b51('0x30')]=_[_0x2b51('0x2f')](_0x2a2863[_0x2b51('0x2c')],qs[_0x2b51('0x31')](_0x2dc7f2['query'][_0x2b51('0x31')]));_0xac8f63[_0x2b51('0x30')]=_0xac8f63[_0x2b51('0x30')][_0x2b51('0x32')]?_0xac8f63[_0x2b51('0x30')]:_0x2a2863[_0x2b51('0x2c')];if(_0x2dc7f2[_0x2b51('0x2d')]['includeAll']){_0xac8f63['include']=[{'all':!![]}];}_0xac8f63=_[_0x2b51('0x39')]({},_0xac8f63,_0x2dc7f2[_0x2b51('0x3a')]);return db[_0x2b51('0x3c')][_0x2b51('0x41')](_0xac8f63)[_0x2b51('0x21')](handleEntityNotFound(_0x599a35,null))[_0x2b51('0x21')](respondWithResult(_0x599a35,null))['catch'](handleError(_0x599a35,null));};exports[_0x2b51('0x42')]=function(_0x5d90e0,_0x337b9c){return db[_0x2b51('0x3c')][_0x2b51('0x42')](_0x5d90e0[_0x2b51('0x43')],{})[_0x2b51('0x21')](respondWithResult(_0x337b9c,0xc9))[_0x2b51('0x44')](handleError(_0x337b9c,null));};exports[_0x2b51('0x45')]=function(_0xee4910,_0x59fd89){if(_0xee4910[_0x2b51('0x43')]['id']){delete _0xee4910[_0x2b51('0x43')]['id'];}return db[_0x2b51('0x3c')][_0x2b51('0x41')]({'where':{'id':_0xee4910['params']['id']}})['then'](handleEntityNotFound(_0x59fd89,null))['then'](saveUpdates(_0xee4910['body'],null))[_0x2b51('0x21')](respondWithResult(_0x59fd89,null))[_0x2b51('0x44')](handleError(_0x59fd89,null));};exports[_0x2b51('0x22')]=function(_0x1f31b1,_0x2e3b2d){return db['Cdr'][_0x2b51('0x41')]({'where':{'id':_0x1f31b1[_0x2b51('0x46')]['id']}})[_0x2b51('0x21')](handleEntityNotFound(_0x2e3b2d,null))[_0x2b51('0x21')](removeEntity(_0x2e3b2d,null))[_0x2b51('0x44')](handleError(_0x2e3b2d,null));};exports[_0x2b51('0x47')]=function(_0x238867,_0x519638){return db['Cdr'][_0x2b51('0x47')]()[_0x2b51('0x21')](respondWithResult(_0x519638,null))[_0x2b51('0x44')](handleError(_0x519638,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 23fa703..32b76a8 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 _0x4975=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src'];(function(_0x3439fc,_0x47b917){var _0x4f90c1=function(_0x1a8b0f){while(--_0x1a8b0f){_0x3439fc['push'](_0x3439fc['shift']());}};_0x4f90c1(++_0x47b917);}(_0x4975,0x86));var _0x5497=function(_0x229d20,_0x3ccad6){_0x229d20=_0x229d20-0x0;var _0x555b34=_0x4975[_0x229d20];return _0x555b34;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['accountcode']},{'name':_0x5497('0xe'),'fields':['calldate']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]},{'name':_0x5497('0x10'),'fields':[_0x5497('0x10')]},{'name':_0x5497('0x11'),'fields':[_0x5497('0x11')]},{'name':_0x5497('0x12'),'fields':[_0x5497('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb016=['rimraf','../../config/environment','exports','cdr','accountcode','calldate','disposition','dst','uniqueid','lodash','util','moment','request-promise','path'];(function(_0x30e0f5,_0x5e4826){var _0x3b5800=function(_0x3d9155){while(--_0x3d9155){_0x30e0f5['push'](_0x30e0f5['shift']());}};_0x3b5800(++_0x5e4826);}(_0xb016,0x159));var _0x6b01=function(_0x472ae3,_0x53f49d){_0x472ae3=_0x472ae3-0x0;var _0x2298c7=_0xb016[_0x472ae3];return _0x2298c7;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./cdr.attributes');module[_0x6b01('0x7')]=function(_0x65407a,_0x192b2d){return _0x65407a['define']('Cdr',attributes,{'tableName':_0x6b01('0x8'),'paranoid':![],'indexes':[{'name':_0x6b01('0x9'),'fields':['accountcode']},{'name':'calldate','fields':[_0x6b01('0xa')]},{'name':_0x6b01('0xb'),'fields':[_0x6b01('0xb')]},{'name':_0x6b01('0xc'),'fields':[_0x6b01('0xc')]},{'name':'src','fields':['src']},{'name':_0x6b01('0xd'),'fields':[_0x6b01('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2ed93a2..4fb8775 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 _0x73ad=['jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5d255d,_0x43cf8){var _0x13bdfa=function(_0x34456b){while(--_0x34456b){_0x5d255d['push'](_0x5d255d['shift']());}};_0x13bdfa(++_0x43cf8);}(_0x73ad,0x199));var _0xd73a=function(_0x588ae8,_0x3df777){_0x588ae8=_0x588ae8-0x0;var _0x469300=_0x73ad[_0x588ae8];return _0x469300;};'use strict';var _=require(_0xd73a('0x0'));var util=require(_0xd73a('0x1'));var moment=require('moment');var BPromise=require(_0xd73a('0x2'));var rs=require(_0xd73a('0x3'));var fs=require('fs');var Redis=require(_0xd73a('0x4'));var db=require(_0xd73a('0x5'))['db'];var utils=require(_0xd73a('0x6'));var logger=require(_0xd73a('0x7'))('rpc');var config=require(_0xd73a('0x8'));var jayson=require(_0xd73a('0x9'));var client=jayson['client'][_0xd73a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x482733,_0x1fb260,_0x280e2f){return new BPromise(function(_0x1c31cc,_0x406390){return client[_0xd73a('0xb')](_0x482733,_0x280e2f)[_0xd73a('0xc')](function(_0x346b45){logger[_0xd73a('0xd')](_0xd73a('0xe'),_0x1fb260,_0xd73a('0xf'));logger[_0xd73a('0x10')](_0xd73a('0x11'),_0x1fb260,'request\x20sent',JSON[_0xd73a('0x12')](_0x346b45));if(_0x346b45[_0xd73a('0x13')]){if(_0x346b45[_0xd73a('0x13')]['code']===0x1f4){logger[_0xd73a('0x13')](_0xd73a('0xe'),_0x1fb260,_0x346b45[_0xd73a('0x13')][_0xd73a('0x14')]);return _0x406390(_0x346b45['error'][_0xd73a('0x14')]);}logger[_0xd73a('0x13')](_0xd73a('0xe'),_0x1fb260,_0x346b45['error'][_0xd73a('0x14')]);return _0x1c31cc(_0x346b45[_0xd73a('0x13')][_0xd73a('0x14')]);}else{logger['info'](_0xd73a('0xe'),_0x1fb260,_0xd73a('0xf'));_0x1c31cc(_0x346b45['result'][_0xd73a('0x14')]);}})[_0xd73a('0x15')](function(_0x4ef997){logger[_0xd73a('0x13')]('Cdr,\x20%s,\x20%s',_0x1fb260,_0x4ef997);_0x406390(_0x4ef997);});});} \ No newline at end of file +var _0x564f=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x403caf,_0x5b31e4){var _0x4d6784=function(_0x21db98){while(--_0x21db98){_0x403caf['push'](_0x403caf['shift']());}};_0x4d6784(++_0x5b31e4);}(_0x564f,0x16e));var _0xf564=function(_0x30cb59,_0x12b061){_0x30cb59=_0x30cb59-0x0;var _0x562fd6=_0x564f[_0x30cb59];return _0x562fd6;};'use strict';var _=require(_0xf564('0x0'));var util=require(_0xf564('0x1'));var moment=require(_0xf564('0x2'));var BPromise=require('bluebird');var rs=require(_0xf564('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf564('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf564('0x5'));var config=require('../../config/environment');var jayson=require(_0xf564('0x6'));var client=jayson[_0xf564('0x7')][_0xf564('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fb2e4,_0x4dba9e,_0x49cbbc){return new BPromise(function(_0x227bfd,_0x2ae070){return client['request'](_0x3fb2e4,_0x49cbbc)[_0xf564('0x9')](function(_0x1b7758){logger[_0xf564('0xa')]('Cdr,\x20%s,\x20%s',_0x4dba9e,_0xf564('0xb'));logger[_0xf564('0xc')](_0xf564('0xd'),_0x4dba9e,_0xf564('0xb'),JSON[_0xf564('0xe')](_0x1b7758));if(_0x1b7758['error']){if(_0x1b7758[_0xf564('0xf')][_0xf564('0x10')]===0x1f4){logger[_0xf564('0xf')](_0xf564('0x11'),_0x4dba9e,_0x1b7758[_0xf564('0xf')]['message']);return _0x2ae070(_0x1b7758['error']['message']);}logger[_0xf564('0xf')]('Cdr,\x20%s,\x20%s',_0x4dba9e,_0x1b7758[_0xf564('0xf')][_0xf564('0x12')]);return _0x227bfd(_0x1b7758['error'][_0xf564('0x12')]);}else{logger['info'](_0xf564('0x11'),_0x4dba9e,_0xf564('0xb'));_0x227bfd(_0x1b7758[_0xf564('0x13')]['message']);}})[_0xf564('0x14')](function(_0x5304b4){logger[_0xf564('0xf')](_0xf564('0x11'),_0x4dba9e,_0x5304b4);_0x2ae070(_0x5304b4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f165605..83b2131 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 _0xbdbc=['./cdr.controller','index','get','describe','/:id','show','isAuthenticated','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdbc,0x187));var _0xcbdb=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xbdbc[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0xcbdb('0x0'));var util=require(_0xcbdb('0x1'));var path=require('path');var timeout=require(_0xcbdb('0x2'));var express=require(_0xcbdb('0x3'));var router=express[_0xcbdb('0x4')]();var auth=require(_0xcbdb('0x5'));var interaction=require(_0xcbdb('0x6'));var config=require(_0xcbdb('0x7'));var controller=require(_0xcbdb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcbdb('0x9')]);router[_0xcbdb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcbdb('0xb')]);router[_0xcbdb('0xa')](_0xcbdb('0xc'),auth['isAuthenticated'](),controller[_0xcbdb('0xd')]);router['post']('/',auth[_0xcbdb('0xe')](),controller['create']);router[_0xcbdb('0xf')]('/:id',auth[_0xcbdb('0xe')](),controller[_0xcbdb('0x10')]);router[_0xcbdb('0x11')](_0xcbdb('0xc'),auth['isAuthenticated'](),controller[_0xcbdb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2bc3=['Router','../../components/auth/service','./cdr.controller','isAuthenticated','index','get','/describe','/:id','show','post','update','destroy','exports','util','path','express'];(function(_0x191d8c,_0x4ff58a){var _0x2f0d7f=function(_0xb3236f){while(--_0xb3236f){_0x191d8c['push'](_0x191d8c['shift']());}};_0x2f0d7f(++_0x4ff58a);}(_0x2bc3,0xcd));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x32bc('0x0'));var path=require(_0x32bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x32bc('0x2'));var router=express[_0x32bc('0x3')]();var auth=require(_0x32bc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32bc('0x5'));router['get']('/',auth[_0x32bc('0x6')](),controller[_0x32bc('0x7')]);router[_0x32bc('0x8')](_0x32bc('0x9'),auth[_0x32bc('0x6')](),controller['describe']);router[_0x32bc('0x8')](_0x32bc('0xa'),auth[_0x32bc('0x6')](),controller[_0x32bc('0xb')]);router[_0x32bc('0xc')]('/',auth[_0x32bc('0x6')](),controller['create']);router['put'](_0x32bc('0xa'),auth[_0x32bc('0x6')](),controller[_0x32bc('0xd')]);router['delete']('/:id',auth[_0x32bc('0x6')](),controller[_0x32bc('0xe')]);module[_0x32bc('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c41fa03..3a77bc7 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 _0xa28a=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x35227a,_0x320a09){var _0x487a83=function(_0x20afaf){while(--_0x20afaf){_0x35227a['push'](_0x35227a['shift']());}};_0x487a83(++_0x320a09);}(_0xa28a,0xcf));var _0xaa28=function(_0x1e64f3,_0x1404a7){_0x1e64f3=_0x1e64f3-0x0;var _0x3e0b54=_0xa28a[_0x1e64f3];return _0x3e0b54;};'use strict';var Sequelize=require('sequelize');module[_0xaa28('0x0')]={'priority':{'type':Sequelize[_0xaa28('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaa28('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaa28('0x3')]()},'description':{'type':Sequelize[_0xaa28('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xaa28('0x4')}}; \ No newline at end of file +var _0x5568=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x529c35,_0x35860f){var _0x50154d=function(_0x2182d9){while(--_0x2182d9){_0x529c35['push'](_0x529c35['shift']());}};_0x50154d(++_0x35860f);}(_0x5568,0x137));var _0x8556=function(_0x15f4af,_0x2ee361){_0x15f4af=_0x15f4af-0x0;var _0x5290f1=_0x5568[_0x15f4af];return _0x5290f1;};'use strict';var Sequelize=require(_0x8556('0x0'));module[_0x8556('0x1')]={'priority':{'type':Sequelize[_0x8556('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8556('0x3')],'allowNull':![],'defaultValue':_0x8556('0x4')},'appdata':{'type':Sequelize[_0x8556('0x5')]()},'description':{'type':Sequelize[_0x8556('0x3')]},'interval':{'type':Sequelize[_0x8556('0x3')],'defaultValue':_0x8556('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ad47541..914f2b2 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 _0x3535=['intersection','fields','includeAll','merge','options','catch','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','destroy','then','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x3535,0xa7));var _0x5353=function(_0x2bd462,_0x307cda){_0x2bd462=_0x2bd462-0x0;var _0x3811e1=_0x3535[_0x2bd462];return _0x3811e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5353('0x0'));var rimraf=require(_0x5353('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5353('0x2'));var rp=require(_0x5353('0x3'));var moment=require(_0x5353('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5353('0x5'));var sox=require(_0x5353('0x6'));var csv=require(_0x5353('0x7'));var ejs=require(_0x5353('0x8'));var fs=require('fs');var _=require(_0x5353('0x9'));var squel=require('squel');var crypto=require(_0x5353('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5353('0x7'));var querystring=require(_0x5353('0xb'));var Papa=require(_0x5353('0xc'));var Redis=require('ioredis');var authService=require(_0x5353('0xd'));var qs=require(_0x5353('0xe'));var as=require(_0x5353('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5353('0x10'))(_0x5353('0x11'));var utils=require(_0x5353('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5353('0x13'));var db=require(_0x5353('0x14'))['db'];function respondWithStatusCode(_0x41198a,_0x5eb081){_0x5eb081=_0x5eb081||0xcc;return function(_0x34e10b){if(_0x34e10b){return _0x41198a[_0x5353('0x15')](_0x5eb081);}return _0x41198a[_0x5353('0x16')](_0x5eb081)[_0x5353('0x17')]();};}function respondWithResult(_0x1ab126,_0x101537){_0x101537=_0x101537||0xc8;return function(_0x1f0c39){if(_0x1f0c39){return _0x1ab126[_0x5353('0x16')](_0x101537)[_0x5353('0x18')](_0x1f0c39);}};}function respondWithFilteredResult(_0x1fb51,_0x4ead35){return function(_0x57e963){if(_0x57e963){var _0x4b5894=_0x57e963[_0x5353('0x19')],_0x25b7cc=_0x4ead35[_0x5353('0x1a')],_0x1e7efb=_0x4ead35['offset']+_0x4ead35[_0x5353('0x1b')],_0x2bcad7;if(_0x1e7efb>=_0x4b5894){_0x1e7efb=_0x4b5894;_0x2bcad7=0xc8;}else{_0x2bcad7=0xce;}_0x1fb51[_0x5353('0x16')](_0x2bcad7);return _0x1fb51[_0x5353('0x1c')]('Content-Range',_0x25b7cc+'-'+_0x1e7efb+'/'+_0x4b5894)[_0x5353('0x18')](_0x57e963);}return null;};}function patchUpdates(_0x14ee7b){return function(_0x2b605b){try{jsonpatch['apply'](_0x2b605b,_0x14ee7b,!![]);}catch(_0x1da107){return BPromise[_0x5353('0x1d')](_0x1da107);}return _0x2b605b['save']();};}function saveUpdates(_0x521a72,_0x51569a){return function(_0x5bd6e7){if(_0x5bd6e7){return _0x5bd6e7[_0x5353('0x1e')](_0x521a72)['then'](function(_0x2e5705){return _0x2e5705;});}return null;};}function removeEntity(_0x3ab6f8,_0x52c624){return function(_0x253882){if(_0x253882){return _0x253882[_0x5353('0x1f')]()[_0x5353('0x20')](function(){_0x3ab6f8[_0x5353('0x16')](0xcc)[_0x5353('0x17')]();});}};}function handleEntityNotFound(_0x8c2aaa,_0x2ef087){return function(_0x26c0b9){if(!_0x26c0b9){_0x8c2aaa[_0x5353('0x15')](0x194);}return _0x26c0b9;};}function handleError(_0x4a9d4c,_0x13cb90){_0x13cb90=_0x13cb90||0x1f4;return function(_0x3cd113){logger[_0x5353('0x21')](_0x3cd113[_0x5353('0x22')]);if(_0x3cd113[_0x5353('0x23')]){delete _0x3cd113[_0x5353('0x23')];}_0x4a9d4c[_0x5353('0x16')](_0x13cb90)[_0x5353('0x24')](_0x3cd113);};}exports['show']=function(_0xb154ba,_0x936fee){var _0x26edac={'raw':!![],'where':{'id':_0xb154ba[_0x5353('0x25')]['id']}},_0x4684b8={};_0x4684b8[_0x5353('0x26')]=_[_0x5353('0x27')](db[_0x5353('0x28')][_0x5353('0x29')]);_0x4684b8[_0x5353('0x2a')]=_['keys'](_0xb154ba[_0x5353('0x2a')]);_0x4684b8[_0x5353('0x2b')]=_['intersection'](_0x4684b8['model'],_0x4684b8[_0x5353('0x2a')]);_0x26edac[_0x5353('0x2c')]=_[_0x5353('0x2d')](_0x4684b8[_0x5353('0x26')],qs['fields'](_0xb154ba[_0x5353('0x2a')][_0x5353('0x2e')]));_0x26edac[_0x5353('0x2c')]=_0x26edac[_0x5353('0x2c')]['length']?_0x26edac[_0x5353('0x2c')]:_0x4684b8['model'];if(_0xb154ba[_0x5353('0x2a')][_0x5353('0x2f')]){_0x26edac['include']=[{'all':!![]}];}_0x26edac=_[_0x5353('0x30')]({},_0x26edac,_0xb154ba[_0x5353('0x31')]);return db[_0x5353('0x28')]['find'](_0x26edac)[_0x5353('0x20')](handleEntityNotFound(_0x936fee,null))[_0x5353('0x20')](respondWithResult(_0x936fee,null))[_0x5353('0x32')](handleError(_0x936fee,null));};exports[_0x5353('0x1e')]=function(_0x141539,_0x1b6cdc){if(_0x141539['body']['id']){delete _0x141539[_0x5353('0x33')]['id'];}return db[_0x5353('0x28')][_0x5353('0x34')]({'where':{'id':_0x141539['params']['id']}})[_0x5353('0x20')](handleEntityNotFound(_0x1b6cdc,null))[_0x5353('0x20')](saveUpdates(_0x141539['body'],null))['then'](respondWithResult(_0x1b6cdc,null))[_0x5353('0x32')](handleError(_0x1b6cdc,null));};exports[_0x5353('0x1f')]=function(_0x5558d1,_0x193ee6){return db[_0x5353('0x28')][_0x5353('0x34')]({'where':{'id':_0x5558d1[_0x5353('0x25')]['id']}})['then'](handleEntityNotFound(_0x193ee6,null))[_0x5353('0x20')](removeEntity(_0x193ee6,null))[_0x5353('0x32')](handleError(_0x193ee6,null));}; \ No newline at end of file +var _0x9e47=['name','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','options','ChatApplication','find','body','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9e47,0xe7));var _0x79e4=function(_0x537b8d,_0x487646){_0x537b8d=_0x537b8d-0x0;var _0x1c005e=_0x9e47[_0x537b8d];return _0x1c005e;};'use strict';var pdf=require(_0x79e4('0x0'));var emlformat=require(_0x79e4('0x1'));var rimraf=require(_0x79e4('0x2'));var zipdir=require(_0x79e4('0x3'));var jsonpatch=require(_0x79e4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79e4('0x5'));var Mustache=require(_0x79e4('0x6'));var util=require('util');var path=require(_0x79e4('0x7'));var sox=require(_0x79e4('0x8'));var csv=require(_0x79e4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x79e4('0xa'));var squel=require(_0x79e4('0xb'));var crypto=require(_0x79e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x79e4('0xd'));var toCsv=require(_0x79e4('0x9'));var querystring=require(_0x79e4('0xe'));var Papa=require('papaparse');var Redis=require(_0x79e4('0xf'));var authService=require(_0x79e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x79e4('0x11'))(_0x79e4('0x12'));var utils=require(_0x79e4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x79e4('0x14'))['db'];function respondWithStatusCode(_0x375e81,_0x256bdf){_0x256bdf=_0x256bdf||0xcc;return function(_0xef75de){if(_0xef75de){return _0x375e81[_0x79e4('0x15')](_0x256bdf);}return _0x375e81[_0x79e4('0x16')](_0x256bdf)['end']();};}function respondWithResult(_0x43c4d2,_0x49acd5){_0x49acd5=_0x49acd5||0xc8;return function(_0x2530e8){if(_0x2530e8){return _0x43c4d2[_0x79e4('0x16')](_0x49acd5)[_0x79e4('0x17')](_0x2530e8);}};}function respondWithFilteredResult(_0x4d22bd,_0x56924a){return function(_0x4b3300){if(_0x4b3300){var _0x50f92d=_0x4b3300['count'],_0x426cf4=_0x56924a[_0x79e4('0x18')],_0x26bc06=_0x56924a[_0x79e4('0x18')]+_0x56924a[_0x79e4('0x19')],_0x588c7b;if(_0x26bc06>=_0x50f92d){_0x26bc06=_0x50f92d;_0x588c7b=0xc8;}else{_0x588c7b=0xce;}_0x4d22bd[_0x79e4('0x16')](_0x588c7b);return _0x4d22bd['set'](_0x79e4('0x1a'),_0x426cf4+'-'+_0x26bc06+'/'+_0x50f92d)['json'](_0x4b3300);}return null;};}function patchUpdates(_0x5a0bb6){return function(_0x44c247){try{jsonpatch[_0x79e4('0x1b')](_0x44c247,_0x5a0bb6,!![]);}catch(_0x3075d3){return BPromise[_0x79e4('0x1c')](_0x3075d3);}return _0x44c247[_0x79e4('0x1d')]();};}function saveUpdates(_0x232030,_0x109513){return function(_0x2cdb74){if(_0x2cdb74){return _0x2cdb74[_0x79e4('0x1e')](_0x232030)[_0x79e4('0x1f')](function(_0x3b4fe4){return _0x3b4fe4;});}return null;};}function removeEntity(_0x2d6ee7,_0xd06cd4){return function(_0x2968c4){if(_0x2968c4){return _0x2968c4['destroy']()['then'](function(){_0x2d6ee7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1e7c,_0x1268ef){return function(_0x3ecd4f){if(!_0x3ecd4f){_0x4e1e7c[_0x79e4('0x15')](0x194);}return _0x3ecd4f;};}function handleError(_0x20df9d,_0x28962d){_0x28962d=_0x28962d||0x1f4;return function(_0x166a81){logger[_0x79e4('0x20')](_0x166a81[_0x79e4('0x21')]);if(_0x166a81[_0x79e4('0x22')]){delete _0x166a81[_0x79e4('0x22')];}_0x20df9d[_0x79e4('0x16')](_0x28962d)['send'](_0x166a81);};}exports[_0x79e4('0x23')]=function(_0x12fe66,_0x4a1adb){var _0x6a8716={'raw':!![],'where':{'id':_0x12fe66[_0x79e4('0x24')]['id']}},_0x5ef24e={};_0x5ef24e[_0x79e4('0x25')]=_[_0x79e4('0x26')](db['ChatApplication'][_0x79e4('0x27')]);_0x5ef24e[_0x79e4('0x28')]=_['keys'](_0x12fe66[_0x79e4('0x28')]);_0x5ef24e['filters']=_['intersection'](_0x5ef24e['model'],_0x5ef24e[_0x79e4('0x28')]);_0x6a8716[_0x79e4('0x29')]=_[_0x79e4('0x2a')](_0x5ef24e[_0x79e4('0x25')],qs[_0x79e4('0x2b')](_0x12fe66['query'][_0x79e4('0x2b')]));_0x6a8716[_0x79e4('0x29')]=_0x6a8716[_0x79e4('0x29')][_0x79e4('0x2c')]?_0x6a8716[_0x79e4('0x29')]:_0x5ef24e['model'];if(_0x12fe66[_0x79e4('0x28')][_0x79e4('0x2d')]){_0x6a8716[_0x79e4('0x2e')]=[{'all':!![]}];}_0x6a8716=_['merge']({},_0x6a8716,_0x12fe66[_0x79e4('0x2f')]);return db[_0x79e4('0x30')][_0x79e4('0x31')](_0x6a8716)[_0x79e4('0x1f')](handleEntityNotFound(_0x4a1adb,null))[_0x79e4('0x1f')](respondWithResult(_0x4a1adb,null))['catch'](handleError(_0x4a1adb,null));};exports[_0x79e4('0x1e')]=function(_0x35dcd0,_0x2d819c){if(_0x35dcd0[_0x79e4('0x32')]['id']){delete _0x35dcd0[_0x79e4('0x32')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x35dcd0[_0x79e4('0x24')]['id']}})[_0x79e4('0x1f')](handleEntityNotFound(_0x2d819c,null))['then'](saveUpdates(_0x35dcd0[_0x79e4('0x32')],null))['then'](respondWithResult(_0x2d819c,null))[_0x79e4('0x33')](handleError(_0x2d819c,null));};exports[_0x79e4('0x34')]=function(_0x17f94c,_0x4974ce){return db[_0x79e4('0x30')][_0x79e4('0x31')]({'where':{'id':_0x17f94c[_0x79e4('0x24')]['id']}})[_0x79e4('0x1f')](handleEntityNotFound(_0x4974ce,null))[_0x79e4('0x1f')](removeEntity(_0x4974ce,null))[_0x79e4('0x33')](handleError(_0x4974ce,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 690cdb5..6f16682 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 36f7d1c..5ddacfd 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 _0x83f9=['request','info','stringify','error','code','message','request\x20sent','ChatApplication,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x55de53,_0x5da3e7){var _0x362fbe=function(_0x3ed4fd){while(--_0x3ed4fd){_0x55de53['push'](_0x55de53['shift']());}};_0x362fbe(++_0x5da3e7);}(_0x83f9,0x197));var _0x983f=function(_0x2d76c8,_0x526667){_0x2d76c8=_0x2d76c8-0x0;var _0x5eeba6=_0x83f9[_0x2d76c8];return _0x5eeba6;};'use strict';var _=require(_0x983f('0x0'));var util=require('util');var moment=require(_0x983f('0x1'));var BPromise=require(_0x983f('0x2'));var rs=require(_0x983f('0x3'));var fs=require('fs');var Redis=require(_0x983f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x983f('0x5'));var logger=require('../../config/logger')(_0x983f('0x6'));var config=require(_0x983f('0x7'));var jayson=require(_0x983f('0x8'));var client=jayson[_0x983f('0x9')][_0x983f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce24a,_0x1d414b,_0x47846e){return new BPromise(function(_0x34f21f,_0x295c4e){return client[_0x983f('0xb')](_0xce24a,_0x47846e)['then'](function(_0x86702d){logger[_0x983f('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1d414b,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1d414b,'request\x20sent',JSON[_0x983f('0xd')](_0x86702d));if(_0x86702d[_0x983f('0xe')]){if(_0x86702d['error'][_0x983f('0xf')]===0x1f4){logger[_0x983f('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1d414b,_0x86702d[_0x983f('0xe')][_0x983f('0x10')]);return _0x295c4e(_0x86702d['error'][_0x983f('0x10')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x1d414b,_0x86702d['error'][_0x983f('0x10')]);return _0x34f21f(_0x86702d[_0x983f('0xe')][_0x983f('0x10')]);}else{logger[_0x983f('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1d414b,_0x983f('0x11'));_0x34f21f(_0x86702d['result']['message']);}})['catch'](function(_0x54d393){logger['error'](_0x983f('0x12'),_0x1d414b,_0x54d393);_0x295c4e(_0x54d393);});});} \ No newline at end of file +var _0xb379=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x333151,_0x347994){var _0x52ead1=function(_0x1d018e){while(--_0x1d018e){_0x333151['push'](_0x333151['shift']());}};_0x52ead1(++_0x347994);}(_0xb379,0x175));var _0x9b37=function(_0x4fe24d,_0x5e7f75){_0x4fe24d=_0x4fe24d-0x0;var _0x93bda=_0xb379[_0x4fe24d];return _0x93bda;};'use strict';var _=require(_0x9b37('0x0'));var util=require(_0x9b37('0x1'));var moment=require(_0x9b37('0x2'));var BPromise=require(_0x9b37('0x3'));var rs=require(_0x9b37('0x4'));var fs=require('fs');var Redis=require(_0x9b37('0x5'));var db=require(_0x9b37('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b37('0x7'))(_0x9b37('0x8'));var config=require(_0x9b37('0x9'));var jayson=require(_0x9b37('0xa'));var client=jayson[_0x9b37('0xb')][_0x9b37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5280d0,_0x10c7f1,_0x474c5c){return new BPromise(function(_0x669805,_0x41eb59){return client[_0x9b37('0xd')](_0x5280d0,_0x474c5c)[_0x9b37('0xe')](function(_0x41783f){logger[_0x9b37('0xf')]('ChatApplication,\x20%s,\x20%s',_0x10c7f1,_0x9b37('0x10'));logger[_0x9b37('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x10c7f1,_0x9b37('0x10'),JSON[_0x9b37('0x12')](_0x41783f));if(_0x41783f['error']){if(_0x41783f[_0x9b37('0x13')][_0x9b37('0x14')]===0x1f4){logger[_0x9b37('0x13')](_0x9b37('0x15'),_0x10c7f1,_0x41783f['error'][_0x9b37('0x16')]);return _0x41eb59(_0x41783f['error'][_0x9b37('0x16')]);}logger[_0x9b37('0x13')]('ChatApplication,\x20%s,\x20%s',_0x10c7f1,_0x41783f[_0x9b37('0x13')][_0x9b37('0x16')]);return _0x669805(_0x41783f[_0x9b37('0x13')][_0x9b37('0x16')]);}else{logger[_0x9b37('0xf')](_0x9b37('0x15'),_0x10c7f1,_0x9b37('0x10'));_0x669805(_0x41783f[_0x9b37('0x17')][_0x9b37('0x16')]);}})[_0x9b37('0x18')](function(_0x5a2737){logger[_0x9b37('0x13')]('ChatApplication,\x20%s,\x20%s',_0x10c7f1,_0x5a2737);_0x41eb59(_0x5a2737);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8f61c50..289959e 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 _0xf0e7=['/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatApplication.controller','isAuthenticated','show','put'];(function(_0x1dbee9,_0x5ce2dc){var _0x296487=function(_0x2c4e0a){while(--_0x2c4e0a){_0x1dbee9['push'](_0x1dbee9['shift']());}};_0x296487(++_0x5ce2dc);}(_0xf0e7,0x129));var _0x7f0e=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xf0e7[_0x55c3d9];return _0x19fd97;};'use strict';var multer=require(_0x7f0e('0x0'));var util=require(_0x7f0e('0x1'));var path=require(_0x7f0e('0x2'));var timeout=require(_0x7f0e('0x3'));var express=require(_0x7f0e('0x4'));var router=express[_0x7f0e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f0e('0x6'));var config=require('../../config/environment');var controller=require(_0x7f0e('0x7'));router['get']('/:id',auth[_0x7f0e('0x8')](),controller[_0x7f0e('0x9')]);router[_0x7f0e('0xa')](_0x7f0e('0xb'),auth[_0x7f0e('0x8')](),controller[_0x7f0e('0xc')]);router[_0x7f0e('0xd')]('/:id',auth[_0x7f0e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7d0=['/:id','show','put','isAuthenticated','delete','destroy','exports','util','path','express','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x2cc248,_0x524e3b){var _0x13be39=function(_0x4bc4c5){while(--_0x4bc4c5){_0x2cc248['push'](_0x2cc248['shift']());}};_0x13be39(++_0x524e3b);}(_0xf7d0,0x69));var _0x0f7d=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0xf7d0[_0xdf3db6];return _0x4b7a65;};'use strict';var multer=require('multer');var util=require(_0x0f7d('0x0'));var path=require(_0x0f7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f7d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0f7d('0x3'));var config=require(_0x0f7d('0x4'));var controller=require(_0x0f7d('0x5'));router[_0x0f7d('0x6')](_0x0f7d('0x7'),auth['isAuthenticated'](),controller[_0x0f7d('0x8')]);router[_0x0f7d('0x9')](_0x0f7d('0x7'),auth[_0x0f7d('0xa')](),controller['update']);router[_0x0f7d('0xb')](_0x0f7d('0x7'),auth[_0x0f7d('0xa')](),controller[_0x0f7d('0xc')]);module[_0x0f7d('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d8c0782..2c11a37 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 _0xdc6d=['BOOLEAN','STRING'];(function(_0x642817,_0x34262f){var _0x283e6f=function(_0x4a50f1){while(--_0x4a50f1){_0x642817['push'](_0x642817['shift']());}};_0x283e6f(++_0x34262f);}(_0xdc6d,0x69));var _0xddc6=function(_0x2f1a7e,_0x127c1f){_0x2f1a7e=_0x2f1a7e-0x0;var _0x443908=_0xdc6d[_0x2f1a7e];return _0x443908;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xddc6('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xddc6('0x0')]},'write':{'type':Sequelize[_0xddc6('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcd1c=['exports','STRING','BOOLEAN'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xcd1c,0x123));var _0xccd1=function(_0x390259,_0x338589){_0x390259=_0x390259-0x0;var _0x17bec9=_0xcd1c[_0x390259];return _0x17bec9;};'use strict';var Sequelize=require('sequelize');module[_0xccd1('0x0')]={'name':{'type':Sequelize[_0xccd1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xccd1('0x1')]},'write':{'type':Sequelize[_0xccd1('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 cbb5136..c8f49c2 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 _0xeae8=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','count','includeAll','include','findAll','rows','show','find','create','body','params','describe','getUnread','user','toInteger','ids','getMembers','findOne','length','sort','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xeae8,0x66));var _0x8eae=function(_0x599dff,_0x32f4df){_0x599dff=_0x599dff-0x0;var _0x26cfc4=_0xeae8[_0x599dff];return _0x26cfc4;};'use strict';var pdf=require(_0x8eae('0x0'));var emlformat=require(_0x8eae('0x1'));var rimraf=require(_0x8eae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eae('0x3'));var rp=require('request-promise');var moment=require(_0x8eae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eae('0x5'));var util=require(_0x8eae('0x6'));var path=require(_0x8eae('0x7'));var sox=require(_0x8eae('0x8'));var csv=require(_0x8eae('0x9'));var ejs=require(_0x8eae('0xa'));var fs=require('fs');var _=require(_0x8eae('0xb'));var squel=require(_0x8eae('0xc'));var crypto=require(_0x8eae('0xd'));var jsforce=require(_0x8eae('0xe'));var deskjs=require(_0x8eae('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8eae('0x10'));var Redis=require(_0x8eae('0x11'));var authService=require(_0x8eae('0x12'));var qs=require(_0x8eae('0x13'));var as=require(_0x8eae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8eae('0x15'));var config=require(_0x8eae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8eae('0x17'))['db'];config['redis']=_[_0x8eae('0x18')](config[_0x8eae('0x19')],{'host':_0x8eae('0x1a'),'port':0x18eb});var socket=require(_0x8eae('0x1b'))(new Redis(config[_0x8eae('0x19')]));require('./chatGroup.socket')[_0x8eae('0x1c')](socket);var jayson=require(_0x8eae('0x1d'));var client=jayson[_0x8eae('0x1e')][_0x8eae('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1bf2f7,_0x1cec9f,_0x28eae2,_0x367dfe){return new BPromise(function(_0x2afcc1,_0x5324e3){var _0x5e214e=_0x367dfe||client;return _0x5e214e['request'](_0x1bf2f7,_0x28eae2)[_0x8eae('0x20')](function(_0x47c1db){logger[_0x8eae('0x21')](_0x8eae('0x22'),_0x1cec9f,_0x8eae('0x23'));logger[_0x8eae('0x24')](_0x8eae('0x25'),_0x1cec9f,_0x8eae('0x23'),JSON[_0x8eae('0x26')](_0x47c1db));if(_0x47c1db[_0x8eae('0x27')]){if(_0x47c1db[_0x8eae('0x27')][_0x8eae('0x28')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1cec9f,_0x47c1db[_0x8eae('0x27')][_0x8eae('0x29')]);return _0x5324e3(_0x47c1db[_0x8eae('0x27')]['message']);}logger[_0x8eae('0x27')](_0x8eae('0x22'),_0x1cec9f,_0x47c1db['error'][_0x8eae('0x29')]);return _0x2afcc1(_0x47c1db[_0x8eae('0x27')]['message']);}else{logger[_0x8eae('0x21')](_0x8eae('0x22'),_0x1cec9f,_0x8eae('0x23'));_0x2afcc1(_0x47c1db[_0x8eae('0x2a')][_0x8eae('0x29')]);}})[_0x8eae('0x2b')](function(_0x3761a6){logger[_0x8eae('0x27')](_0x8eae('0x22'),_0x1cec9f,_0x3761a6);_0x5324e3(_0x3761a6);});});}function respondWithStatusCode(_0x2fc7ec,_0x386bec){_0x386bec=_0x386bec||0xcc;return function(_0x53733c){if(_0x53733c){return _0x2fc7ec[_0x8eae('0x2c')](_0x386bec);}return _0x2fc7ec[_0x8eae('0x2d')](_0x386bec)[_0x8eae('0x2e')]();};}function respondWithResult(_0x34dff7,_0x149b83){_0x149b83=_0x149b83||0xc8;return function(_0x13a80a){if(_0x13a80a){return _0x34dff7[_0x8eae('0x2d')](_0x149b83)['json'](_0x13a80a);}};}function respondWithFilteredResult(_0x8370c6,_0x5222f8){return function(_0x342caf){if(_0x342caf){var _0xf4f03c=_0x342caf['count'],_0x34f0c4=_0x5222f8['offset'],_0x3f5d30=_0x5222f8[_0x8eae('0x2f')]+_0x5222f8[_0x8eae('0x30')],_0x1aa3a0;if(_0x3f5d30>=_0xf4f03c){_0x3f5d30=_0xf4f03c;_0x1aa3a0=0xc8;}else{_0x1aa3a0=0xce;}_0x8370c6[_0x8eae('0x2d')](_0x1aa3a0);return _0x8370c6[_0x8eae('0x31')]('Content-Range',_0x34f0c4+'-'+_0x3f5d30+'/'+_0xf4f03c)[_0x8eae('0x32')](_0x342caf);}return null;};}function patchUpdates(_0x22ffeb){return function(_0x3426d3){try{jsonpatch[_0x8eae('0x33')](_0x3426d3,_0x22ffeb,!![]);}catch(_0x2f92d0){return BPromise[_0x8eae('0x34')](_0x2f92d0);}return _0x3426d3[_0x8eae('0x35')]();};}function saveUpdates(_0x453b45,_0x116024){return function(_0x1bcd2d){if(_0x1bcd2d){return _0x1bcd2d[_0x8eae('0x36')](_0x453b45)[_0x8eae('0x20')](function(_0x2d6109){return _0x2d6109;});}return null;};}function removeEntity(_0x2a0b6a,_0x1f247e){return function(_0x3d19f7){if(_0x3d19f7){return _0x3d19f7[_0x8eae('0x37')]()[_0x8eae('0x20')](function(){_0x2a0b6a[_0x8eae('0x2d')](0xcc)[_0x8eae('0x2e')]();});}};}function handleEntityNotFound(_0x143075,_0x54b216){return function(_0x85ecc6){if(!_0x85ecc6){_0x143075[_0x8eae('0x2c')](0x194);}return _0x85ecc6;};}function handleError(_0x1c0cce,_0x4bf905){_0x4bf905=_0x4bf905||0x1f4;return function(_0x42eaef){logger[_0x8eae('0x27')](_0x42eaef[_0x8eae('0x38')]);if(_0x42eaef[_0x8eae('0x39')]){delete _0x42eaef['name'];}_0x1c0cce[_0x8eae('0x2d')](_0x4bf905)['send'](_0x42eaef);};}exports['index']=function(_0x2f55fb,_0x38713d){var _0x468e6d={},_0x3ae748={},_0xe8787d={'count':0x0,'rows':[]};var _0x23f213=_[_0x8eae('0x3a')](db['ChatGroup'][_0x8eae('0x3b')],function(_0x477b13){return{'name':_0x477b13['fieldName'],'type':_0x477b13['type']['key']};});_0x3ae748[_0x8eae('0x3c')]=_[_0x8eae('0x3a')](_0x23f213,'name');_0x3ae748[_0x8eae('0x3d')]=_[_0x8eae('0x3e')](_0x2f55fb['query']);_0x3ae748[_0x8eae('0x3f')]=_[_0x8eae('0x40')](_0x3ae748[_0x8eae('0x3c')],_0x3ae748[_0x8eae('0x3d')]);_0x468e6d[_0x8eae('0x41')]=_['intersection'](_0x3ae748[_0x8eae('0x3c')],qs[_0x8eae('0x42')](_0x2f55fb[_0x8eae('0x3d')]['fields']));_0x468e6d[_0x8eae('0x41')]=_0x468e6d[_0x8eae('0x41')]['length']?_0x468e6d[_0x8eae('0x41')]:_0x3ae748[_0x8eae('0x3c')];if(!_0x2f55fb[_0x8eae('0x3d')][_0x8eae('0x43')]('nolimit')){_0x468e6d[_0x8eae('0x30')]=qs[_0x8eae('0x30')](_0x2f55fb[_0x8eae('0x3d')][_0x8eae('0x30')]);_0x468e6d['offset']=qs[_0x8eae('0x2f')](_0x2f55fb[_0x8eae('0x3d')][_0x8eae('0x2f')]);}_0x468e6d[_0x8eae('0x44')]=qs['sort'](_0x2f55fb[_0x8eae('0x3d')]['sort']);_0x468e6d[_0x8eae('0x45')]=qs['filters'](_[_0x8eae('0x46')](_0x2f55fb[_0x8eae('0x3d')],_0x3ae748['filters']),_0x23f213);if(_0x2f55fb[_0x8eae('0x3d')][_0x8eae('0x47')]){_0x468e6d[_0x8eae('0x45')]=_[_0x8eae('0x48')](_0x468e6d[_0x8eae('0x45')],{'$or':_[_0x8eae('0x3a')](_0x23f213,function(_0x81a199){if(_0x81a199[_0x8eae('0x49')]!==_0x8eae('0x4a')){var _0x55396f={};_0x55396f[_0x81a199[_0x8eae('0x39')]]={'$like':'%'+_0x2f55fb['query'][_0x8eae('0x47')]+'%'};return _0x55396f;}})});}_0x468e6d=_[_0x8eae('0x48')]({},_0x468e6d,_0x2f55fb[_0x8eae('0x4b')]);var _0x17264c={'where':_0x468e6d['where']};return db[_0x8eae('0x4c')][_0x8eae('0x4d')](_0x17264c)[_0x8eae('0x20')](function(_0x448004){_0xe8787d[_0x8eae('0x4d')]=_0x448004;if(_0x2f55fb[_0x8eae('0x3d')][_0x8eae('0x4e')]){_0x468e6d[_0x8eae('0x4f')]=[{'all':!![]}];}return db[_0x8eae('0x4c')][_0x8eae('0x50')](_0x468e6d);})[_0x8eae('0x20')](function(_0x5c53d6){_0xe8787d[_0x8eae('0x51')]=_0x5c53d6;return _0xe8787d;})[_0x8eae('0x20')](respondWithFilteredResult(_0x38713d,_0x468e6d))['catch'](handleError(_0x38713d,null));};exports[_0x8eae('0x52')]=function(_0x490416,_0xb34032){var _0x5056d4={'raw':!![],'where':{'id':_0x490416['params']['id']}},_0x1ff5f9={};_0x1ff5f9[_0x8eae('0x3c')]=_[_0x8eae('0x3e')](db[_0x8eae('0x4c')][_0x8eae('0x3b')]);_0x1ff5f9[_0x8eae('0x3d')]=_[_0x8eae('0x3e')](_0x490416[_0x8eae('0x3d')]);_0x1ff5f9[_0x8eae('0x3f')]=_[_0x8eae('0x40')](_0x1ff5f9[_0x8eae('0x3c')],_0x1ff5f9[_0x8eae('0x3d')]);_0x5056d4['attributes']=_['intersection'](_0x1ff5f9[_0x8eae('0x3c')],qs[_0x8eae('0x42')](_0x490416[_0x8eae('0x3d')][_0x8eae('0x42')]));_0x5056d4[_0x8eae('0x41')]=_0x5056d4[_0x8eae('0x41')]['length']?_0x5056d4[_0x8eae('0x41')]:_0x1ff5f9[_0x8eae('0x3c')];if(_0x490416[_0x8eae('0x3d')][_0x8eae('0x4e')]){_0x5056d4[_0x8eae('0x4f')]=[{'all':!![]}];}_0x5056d4=_[_0x8eae('0x48')]({},_0x5056d4,_0x490416['options']);return db[_0x8eae('0x4c')][_0x8eae('0x53')](_0x5056d4)['then'](handleEntityNotFound(_0xb34032,null))[_0x8eae('0x20')](respondWithResult(_0xb34032,null))[_0x8eae('0x2b')](handleError(_0xb34032,null));};exports[_0x8eae('0x54')]=function(_0x2520b5,_0x1965a2){return db[_0x8eae('0x4c')]['create'](_0x2520b5[_0x8eae('0x55')],{})['then'](respondWithResult(_0x1965a2,0xc9))[_0x8eae('0x2b')](handleError(_0x1965a2,null));};exports[_0x8eae('0x36')]=function(_0xf4a3f,_0x537e25){if(_0xf4a3f[_0x8eae('0x55')]['id']){delete _0xf4a3f[_0x8eae('0x55')]['id'];}return db[_0x8eae('0x4c')][_0x8eae('0x53')]({'where':{'id':_0xf4a3f[_0x8eae('0x56')]['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x537e25,null))[_0x8eae('0x20')](saveUpdates(_0xf4a3f[_0x8eae('0x55')],null))[_0x8eae('0x20')](respondWithResult(_0x537e25,null))[_0x8eae('0x2b')](handleError(_0x537e25,null));};exports[_0x8eae('0x37')]=function(_0x5ad764,_0x67fc35){return db[_0x8eae('0x4c')][_0x8eae('0x53')]({'where':{'id':_0x5ad764[_0x8eae('0x56')]['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x67fc35,null))[_0x8eae('0x20')](removeEntity(_0x67fc35,null))[_0x8eae('0x2b')](handleError(_0x67fc35,null));};exports[_0x8eae('0x57')]=function(_0x60b3ea,_0x2c0174){return db[_0x8eae('0x4c')]['describe']()[_0x8eae('0x20')](respondWithResult(_0x2c0174,null))[_0x8eae('0x2b')](handleError(_0x2c0174,null));};exports[_0x8eae('0x58')]=function(_0x39c221,_0x2ff80d,_0xfce6f4){return db['ChatInternalMessage'][_0x8eae('0x4d')]({'where':{'ChatGroupId':_0x39c221['params']['id'],'ToId':_0x39c221[_0x8eae('0x59')]['id'],'read':![]}})['then'](function(_0x2cf675){return{'id':_[_0x8eae('0x5a')](_0x39c221['params']['id']),'count':_0x2cf675};})[_0x8eae('0x20')](respondWithResult(_0x2ff80d,null))['catch'](handleError(_0x2ff80d,null));};exports['addMembers']=function(_0x422436,_0x518a51,_0x3199eb){return db['ChatGroup'][_0x8eae('0x53')]({'where':{'id':_0x422436['params']['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x518a51,null))['then'](function(_0x4e7337){if(_0x4e7337){return _0x4e7337['addMembers'](_0x422436[_0x8eae('0x55')][_0x8eae('0x5b')],_['omit'](_0x422436[_0x8eae('0x55')],[_0x8eae('0x5b'),'id'])||{});}})[_0x8eae('0x20')](respondWithResult(_0x518a51,null))['catch'](handleError(_0x518a51,null));};exports[_0x8eae('0x5c')]=function(_0x503ebe,_0x46fa49,_0x59c0a2){var _0x490897={};var _0x1a0473={};var _0x7269d7;var _0x47b1a6;return db[_0x8eae('0x4c')][_0x8eae('0x5d')]({'where':{'id':_0x503ebe['params']['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x46fa49,null))[_0x8eae('0x20')](function(_0x33cbf8){if(_0x33cbf8){_0x7269d7=_0x33cbf8;_0x1a0473[_0x8eae('0x3c')]=_[_0x8eae('0x3e')](db['User'][_0x8eae('0x3b')]);_0x1a0473[_0x8eae('0x3d')]=_['keys'](_0x503ebe[_0x8eae('0x3d')]);_0x1a0473[_0x8eae('0x3f')]=_[_0x8eae('0x40')](_0x1a0473[_0x8eae('0x3c')],_0x1a0473['query']);_0x490897[_0x8eae('0x41')]=_[_0x8eae('0x40')](_0x1a0473[_0x8eae('0x3c')],qs[_0x8eae('0x42')](_0x503ebe[_0x8eae('0x3d')][_0x8eae('0x42')]));_0x490897[_0x8eae('0x41')]=_0x490897[_0x8eae('0x41')][_0x8eae('0x5e')]?_0x490897[_0x8eae('0x41')]:_0x1a0473[_0x8eae('0x3c')];_0x490897[_0x8eae('0x44')]=qs['sort'](_0x503ebe[_0x8eae('0x3d')][_0x8eae('0x5f')]);_0x490897[_0x8eae('0x45')]=qs[_0x8eae('0x3f')](_[_0x8eae('0x46')](_0x503ebe['query'],_0x1a0473[_0x8eae('0x3f')]));if(_0x503ebe['query']['filter']){_0x490897[_0x8eae('0x45')]=_[_0x8eae('0x48')](_0x490897[_0x8eae('0x45')],{'$or':_[_0x8eae('0x3a')](_0x490897[_0x8eae('0x41')],function(_0x35ead5){var _0x28e19a={};_0x28e19a[_0x35ead5]={'$like':'%'+_0x503ebe[_0x8eae('0x3d')][_0x8eae('0x47')]+'%'};return _0x28e19a;})});}_0x490897=_[_0x8eae('0x48')]({},_0x490897,_0x503ebe[_0x8eae('0x4b')]);return _0x7269d7[_0x8eae('0x5c')](_0x490897);}})['then'](function(_0x1025f8){if(_0x1025f8){_0x47b1a6=_0x1025f8['length'];if(!_0x503ebe['query']['hasOwnProperty'](_0x8eae('0x60'))){_0x490897[_0x8eae('0x30')]=qs['limit'](_0x503ebe[_0x8eae('0x3d')]['limit']);_0x490897['offset']=qs[_0x8eae('0x2f')](_0x503ebe[_0x8eae('0x3d')][_0x8eae('0x2f')]);}return _0x7269d7[_0x8eae('0x5c')](_0x490897);}})[_0x8eae('0x20')](function(_0x332a2b){if(_0x332a2b){return _0x332a2b?{'count':_0x47b1a6,'rows':_0x332a2b}:null;}})[_0x8eae('0x20')](respondWithResult(_0x46fa49,null))[_0x8eae('0x2b')](handleError(_0x46fa49,null));};exports['removeMembers']=function(_0x4a457a,_0x2eb092,_0x38a612){return db['ChatGroup'][_0x8eae('0x53')]({'where':{'id':_0x4a457a['params']['id']}})['then'](handleEntityNotFound(_0x2eb092,null))['then'](function(_0x1a8f28){if(_0x1a8f28){return _0x1a8f28[_0x8eae('0x61')](_0x4a457a[_0x8eae('0x3d')][_0x8eae('0x5b')]);}})[_0x8eae('0x20')](respondWithStatusCode(_0x2eb092,null))['catch'](handleError(_0x2eb092,null));};exports[_0x8eae('0x62')]=function(_0x5092fe,_0x577349,_0x263004){if(_0x5092fe[_0x8eae('0x55')]['id']){delete _0x5092fe[_0x8eae('0x55')]['id'];}return db[_0x8eae('0x4c')][_0x8eae('0x53')]({'where':{'id':_0x5092fe['params']['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x577349,null))[_0x8eae('0x20')](function(_0x1de41a){if(_0x1de41a){_0x5092fe[_0x8eae('0x55')][_0x8eae('0x63')]=_0x1de41a['id'];return db[_0x8eae('0x64')]['create'](_0x5092fe[_0x8eae('0x55')]);}})['then'](respondWithResult(_0x577349,null))[_0x8eae('0x2b')](handleError(_0x577349,null));};exports[_0x8eae('0x65')]=function(_0x366fa1,_0x57da24,_0x9afb05){var _0x25d296={};var _0x1f4a61={};var _0x552b35;var _0x29fb33;return db[_0x8eae('0x4c')]['findOne']({'where':{'id':_0x366fa1[_0x8eae('0x56')]['id']}})[_0x8eae('0x20')](handleEntityNotFound(_0x57da24,null))[_0x8eae('0x20')](function(_0x419490){if(_0x419490){_0x552b35=_0x419490;_0x1f4a61[_0x8eae('0x3c')]=_[_0x8eae('0x3e')](db['ChatInternalMessage']['rawAttributes']);_0x1f4a61[_0x8eae('0x3d')]=_[_0x8eae('0x3e')](_0x366fa1[_0x8eae('0x3d')]);_0x1f4a61[_0x8eae('0x3f')]=_[_0x8eae('0x40')](_0x1f4a61[_0x8eae('0x3c')],_0x1f4a61[_0x8eae('0x3d')]);_0x25d296[_0x8eae('0x41')]=_[_0x8eae('0x40')](_0x1f4a61[_0x8eae('0x3c')],qs['fields'](_0x366fa1[_0x8eae('0x3d')][_0x8eae('0x42')]));_0x25d296['attributes']=_0x25d296['attributes'][_0x8eae('0x5e')]?_0x25d296[_0x8eae('0x41')]:_0x1f4a61[_0x8eae('0x3c')];_0x25d296['order']=qs[_0x8eae('0x5f')](_0x366fa1[_0x8eae('0x3d')][_0x8eae('0x5f')]);_0x25d296['where']=qs[_0x8eae('0x3f')](_[_0x8eae('0x46')](_0x366fa1[_0x8eae('0x3d')],_0x1f4a61['filters']));if(_0x366fa1['query'][_0x8eae('0x47')]){_0x25d296[_0x8eae('0x45')]=_[_0x8eae('0x48')](_0x25d296[_0x8eae('0x45')],{'$or':_[_0x8eae('0x3a')](_0x25d296[_0x8eae('0x41')],function(_0x378ee4){var _0x2c66e4={};_0x2c66e4[_0x378ee4]={'$like':'%'+_0x366fa1['query'][_0x8eae('0x47')]+'%'};return _0x2c66e4;})});}if(_0x366fa1['query'][_0x8eae('0x66')]){var _0x16db71=_0x366fa1['query'][_0x8eae('0x66')][_0x8eae('0x67')](',');var _0x2640b5={};_0x2640b5[_0x16db71[0x0]]={'$gte':moment(_0x16db71[0x1])[_0x8eae('0x68')](_0x8eae('0x69'))};_0x25d296['where']=_[_0x8eae('0x48')](_0x25d296[_0x8eae('0x45')],_0x2640b5);}_0x25d296=_[_0x8eae('0x48')]({},_0x25d296,_0x366fa1['options']);return _0x552b35[_0x8eae('0x65')](_0x25d296);}})[_0x8eae('0x20')](function(_0x4adea8){if(_0x4adea8){_0x29fb33=_0x4adea8[_0x8eae('0x5e')];if(!_0x366fa1[_0x8eae('0x3d')][_0x8eae('0x43')]('nolimit')){_0x25d296[_0x8eae('0x30')]=qs[_0x8eae('0x30')](_0x366fa1[_0x8eae('0x3d')][_0x8eae('0x30')]);_0x25d296[_0x8eae('0x2f')]=qs[_0x8eae('0x2f')](_0x366fa1['query']['offset']);}return _0x552b35[_0x8eae('0x65')](_0x25d296);}})[_0x8eae('0x20')](function(_0x4b4f4b){if(_0x4b4f4b){return _0x4b4f4b?{'count':_0x29fb33,'rows':_0x4b4f4b}:null;}})[_0x8eae('0x20')](respondWithResult(_0x57da24,null))[_0x8eae('0x2b')](handleError(_0x57da24,null));}; \ No newline at end of file +var _0xda81=['pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','catch','show','params','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','$gte','format','getMessages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','set','Content-Range','apply','reject','update','destroy','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where'];(function(_0x335248,_0x1fb018){var _0x2c9bae=function(_0x5d9052){while(--_0x5d9052){_0x335248['push'](_0x335248['shift']());}};_0x2c9bae(++_0x1fb018);}(_0xda81,0x1c3));var _0x1da8=function(_0xdb314a,_0x170d1b){_0xdb314a=_0xdb314a-0x0;var _0x3e2630=_0xda81[_0xdb314a];return _0x3e2630;};'use strict';var pdf=require(_0x1da8('0x0'));var emlformat=require(_0x1da8('0x1'));var rimraf=require(_0x1da8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1da8('0x3'));var rp=require(_0x1da8('0x4'));var moment=require(_0x1da8('0x5'));var BPromise=require(_0x1da8('0x6'));var Mustache=require('mustache');var util=require(_0x1da8('0x7'));var path=require(_0x1da8('0x8'));var sox=require('sox');var csv=require(_0x1da8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1da8('0xa'));var squel=require(_0x1da8('0xb'));var crypto=require(_0x1da8('0xc'));var jsforce=require(_0x1da8('0xd'));var deskjs=require(_0x1da8('0xe'));var toCsv=require(_0x1da8('0x9'));var querystring=require(_0x1da8('0xf'));var Papa=require(_0x1da8('0x10'));var Redis=require(_0x1da8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1da8('0x12'));var as=require(_0x1da8('0x13'));var hardwareService=require(_0x1da8('0x14'));var logger=require(_0x1da8('0x15'))(_0x1da8('0x16'));var utils=require('../../config/utils');var config=require(_0x1da8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1da8('0x18'))['db'];config[_0x1da8('0x19')]=_[_0x1da8('0x1a')](config[_0x1da8('0x19')],{'host':_0x1da8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1da8('0x19')]));require('./chatGroup.socket')[_0x1da8('0x1c')](socket);var jayson=require(_0x1da8('0x1d'));var client=jayson[_0x1da8('0x1e')][_0x1da8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x23b7e7,_0x1e25ff,_0x5f40c0,_0x155829){return new BPromise(function(_0x1bd1e9,_0x3bea6f){var _0x197b09=_0x155829||client;return _0x197b09[_0x1da8('0x20')](_0x23b7e7,_0x5f40c0)[_0x1da8('0x21')](function(_0x45fd11){logger[_0x1da8('0x22')](_0x1da8('0x23'),_0x1e25ff,'request\x20sent');logger[_0x1da8('0x24')](_0x1da8('0x25'),_0x1e25ff,_0x1da8('0x26'),JSON[_0x1da8('0x27')](_0x45fd11));if(_0x45fd11[_0x1da8('0x28')]){if(_0x45fd11[_0x1da8('0x28')]['code']===0x1f4){logger[_0x1da8('0x28')](_0x1da8('0x23'),_0x1e25ff,_0x45fd11[_0x1da8('0x28')][_0x1da8('0x29')]);return _0x3bea6f(_0x45fd11[_0x1da8('0x28')][_0x1da8('0x29')]);}logger['error'](_0x1da8('0x23'),_0x1e25ff,_0x45fd11['error'][_0x1da8('0x29')]);return _0x1bd1e9(_0x45fd11[_0x1da8('0x28')][_0x1da8('0x29')]);}else{logger[_0x1da8('0x22')](_0x1da8('0x23'),_0x1e25ff,_0x1da8('0x26'));_0x1bd1e9(_0x45fd11[_0x1da8('0x2a')]['message']);}})['catch'](function(_0xac4b2a){logger[_0x1da8('0x28')]('ChatGroup,\x20%s,\x20%s',_0x1e25ff,_0xac4b2a);_0x3bea6f(_0xac4b2a);});});}function respondWithStatusCode(_0x242e69,_0x1509a9){_0x1509a9=_0x1509a9||0xcc;return function(_0xa6da1b){if(_0xa6da1b){return _0x242e69[_0x1da8('0x2b')](_0x1509a9);}return _0x242e69[_0x1da8('0x2c')](_0x1509a9)[_0x1da8('0x2d')]();};}function respondWithResult(_0x5c3960,_0x1da598){_0x1da598=_0x1da598||0xc8;return function(_0x40730d){if(_0x40730d){return _0x5c3960[_0x1da8('0x2c')](_0x1da598)[_0x1da8('0x2e')](_0x40730d);}};}function respondWithFilteredResult(_0x21d5cf,_0x3ca0d5){return function(_0x272a98){if(_0x272a98){var _0x31d32d=_0x272a98[_0x1da8('0x2f')],_0x442043=_0x3ca0d5['offset'],_0x21f3fe=_0x3ca0d5['offset']+_0x3ca0d5['limit'],_0x58e3c6;if(_0x21f3fe>=_0x31d32d){_0x21f3fe=_0x31d32d;_0x58e3c6=0xc8;}else{_0x58e3c6=0xce;}_0x21d5cf['status'](_0x58e3c6);return _0x21d5cf[_0x1da8('0x30')](_0x1da8('0x31'),_0x442043+'-'+_0x21f3fe+'/'+_0x31d32d)['json'](_0x272a98);}return null;};}function patchUpdates(_0x198b31){return function(_0x59d3c5){try{jsonpatch[_0x1da8('0x32')](_0x59d3c5,_0x198b31,!![]);}catch(_0x202017){return BPromise[_0x1da8('0x33')](_0x202017);}return _0x59d3c5['save']();};}function saveUpdates(_0x3cc82,_0x8b91c7){return function(_0x354513){if(_0x354513){return _0x354513[_0x1da8('0x34')](_0x3cc82)['then'](function(_0x311cb7){return _0x311cb7;});}return null;};}function removeEntity(_0x3e622f,_0x32b72){return function(_0x21cc4b){if(_0x21cc4b){return _0x21cc4b[_0x1da8('0x35')]()[_0x1da8('0x21')](function(){_0x3e622f['status'](0xcc)[_0x1da8('0x2d')]();});}};}function handleEntityNotFound(_0x3bffcc,_0x3999b8){return function(_0x52e3a5){if(!_0x52e3a5){_0x3bffcc[_0x1da8('0x2b')](0x194);}return _0x52e3a5;};}function handleError(_0x12ce12,_0x31995e){_0x31995e=_0x31995e||0x1f4;return function(_0x16424c){logger[_0x1da8('0x28')](_0x16424c['stack']);if(_0x16424c[_0x1da8('0x36')]){delete _0x16424c[_0x1da8('0x36')];}_0x12ce12[_0x1da8('0x2c')](_0x31995e)['send'](_0x16424c);};}exports['index']=function(_0x24e549,_0x5ad077){var _0x555345={},_0x56c306={},_0x172710={'count':0x0,'rows':[]};var _0xa3154=_[_0x1da8('0x37')](db['ChatGroup'][_0x1da8('0x38')],function(_0x49c760){return{'name':_0x49c760[_0x1da8('0x39')],'type':_0x49c760[_0x1da8('0x3a')][_0x1da8('0x3b')]};});_0x56c306[_0x1da8('0x3c')]=_[_0x1da8('0x37')](_0xa3154,_0x1da8('0x36'));_0x56c306[_0x1da8('0x3d')]=_[_0x1da8('0x3e')](_0x24e549[_0x1da8('0x3d')]);_0x56c306[_0x1da8('0x3f')]=_[_0x1da8('0x40')](_0x56c306[_0x1da8('0x3c')],_0x56c306['query']);_0x555345[_0x1da8('0x41')]=_[_0x1da8('0x40')](_0x56c306['model'],qs[_0x1da8('0x42')](_0x24e549[_0x1da8('0x3d')][_0x1da8('0x42')]));_0x555345['attributes']=_0x555345[_0x1da8('0x41')][_0x1da8('0x43')]?_0x555345[_0x1da8('0x41')]:_0x56c306[_0x1da8('0x3c')];if(!_0x24e549[_0x1da8('0x3d')]['hasOwnProperty'](_0x1da8('0x44'))){_0x555345[_0x1da8('0x45')]=qs[_0x1da8('0x45')](_0x24e549['query'][_0x1da8('0x45')]);_0x555345['offset']=qs[_0x1da8('0x46')](_0x24e549[_0x1da8('0x3d')][_0x1da8('0x46')]);}_0x555345[_0x1da8('0x47')]=qs[_0x1da8('0x48')](_0x24e549[_0x1da8('0x3d')][_0x1da8('0x48')]);_0x555345[_0x1da8('0x49')]=qs[_0x1da8('0x3f')](_[_0x1da8('0x4a')](_0x24e549['query'],_0x56c306[_0x1da8('0x3f')]),_0xa3154);if(_0x24e549[_0x1da8('0x3d')][_0x1da8('0x4b')]){_0x555345[_0x1da8('0x49')]=_[_0x1da8('0x4c')](_0x555345['where'],{'$or':_[_0x1da8('0x37')](_0xa3154,function(_0x65b326){if(_0x65b326[_0x1da8('0x3a')]!==_0x1da8('0x4d')){var _0x2cc954={};_0x2cc954[_0x65b326[_0x1da8('0x36')]]={'$like':'%'+_0x24e549[_0x1da8('0x3d')][_0x1da8('0x4b')]+'%'};return _0x2cc954;}})});}_0x555345=_[_0x1da8('0x4c')]({},_0x555345,_0x24e549[_0x1da8('0x4e')]);var _0x450c85={'where':_0x555345[_0x1da8('0x49')]};return db[_0x1da8('0x4f')][_0x1da8('0x2f')](_0x450c85)['then'](function(_0x5250fc){_0x172710[_0x1da8('0x2f')]=_0x5250fc;if(_0x24e549[_0x1da8('0x3d')][_0x1da8('0x50')]){_0x555345[_0x1da8('0x51')]=[{'all':!![]}];}return db[_0x1da8('0x4f')][_0x1da8('0x52')](_0x555345);})['then'](function(_0x4271a4){_0x172710['rows']=_0x4271a4;return _0x172710;})[_0x1da8('0x21')](respondWithFilteredResult(_0x5ad077,_0x555345))[_0x1da8('0x53')](handleError(_0x5ad077,null));};exports[_0x1da8('0x54')]=function(_0x5d16cb,_0x319531){var _0x3f5dac={'raw':!![],'where':{'id':_0x5d16cb[_0x1da8('0x55')]['id']}},_0x26df80={};_0x26df80[_0x1da8('0x3c')]=_[_0x1da8('0x3e')](db['ChatGroup'][_0x1da8('0x38')]);_0x26df80['query']=_[_0x1da8('0x3e')](_0x5d16cb['query']);_0x26df80[_0x1da8('0x3f')]=_['intersection'](_0x26df80[_0x1da8('0x3c')],_0x26df80[_0x1da8('0x3d')]);_0x3f5dac[_0x1da8('0x41')]=_['intersection'](_0x26df80[_0x1da8('0x3c')],qs[_0x1da8('0x42')](_0x5d16cb[_0x1da8('0x3d')]['fields']));_0x3f5dac['attributes']=_0x3f5dac[_0x1da8('0x41')][_0x1da8('0x43')]?_0x3f5dac[_0x1da8('0x41')]:_0x26df80[_0x1da8('0x3c')];if(_0x5d16cb[_0x1da8('0x3d')][_0x1da8('0x50')]){_0x3f5dac[_0x1da8('0x51')]=[{'all':!![]}];}_0x3f5dac=_[_0x1da8('0x4c')]({},_0x3f5dac,_0x5d16cb['options']);return db[_0x1da8('0x4f')][_0x1da8('0x56')](_0x3f5dac)[_0x1da8('0x21')](handleEntityNotFound(_0x319531,null))['then'](respondWithResult(_0x319531,null))[_0x1da8('0x53')](handleError(_0x319531,null));};exports[_0x1da8('0x57')]=function(_0x2f3d17,_0x52dcef){return db[_0x1da8('0x4f')]['create'](_0x2f3d17['body'],{})[_0x1da8('0x21')](respondWithResult(_0x52dcef,0xc9))['catch'](handleError(_0x52dcef,null));};exports['update']=function(_0x116214,_0x303efc){if(_0x116214[_0x1da8('0x58')]['id']){delete _0x116214['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x116214[_0x1da8('0x55')]['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x303efc,null))['then'](saveUpdates(_0x116214['body'],null))[_0x1da8('0x21')](respondWithResult(_0x303efc,null))[_0x1da8('0x53')](handleError(_0x303efc,null));};exports['destroy']=function(_0x27b600,_0x1965cf){return db[_0x1da8('0x4f')][_0x1da8('0x56')]({'where':{'id':_0x27b600['params']['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x1965cf,null))['then'](removeEntity(_0x1965cf,null))[_0x1da8('0x53')](handleError(_0x1965cf,null));};exports[_0x1da8('0x59')]=function(_0x4a05ed,_0x1aa53c){return db[_0x1da8('0x4f')]['describe']()[_0x1da8('0x21')](respondWithResult(_0x1aa53c,null))[_0x1da8('0x53')](handleError(_0x1aa53c,null));};exports['getUnread']=function(_0x7a4c6e,_0x42980e,_0x36c1dd){return db[_0x1da8('0x5a')][_0x1da8('0x2f')]({'where':{'ChatGroupId':_0x7a4c6e['params']['id'],'ToId':_0x7a4c6e[_0x1da8('0x5b')]['id'],'read':![]}})[_0x1da8('0x21')](function(_0x1ca51c){return{'id':_[_0x1da8('0x5c')](_0x7a4c6e[_0x1da8('0x55')]['id']),'count':_0x1ca51c};})[_0x1da8('0x21')](respondWithResult(_0x42980e,null))['catch'](handleError(_0x42980e,null));};exports[_0x1da8('0x5d')]=function(_0x432ad0,_0x4e9ce7,_0x35887d){return db[_0x1da8('0x4f')][_0x1da8('0x56')]({'where':{'id':_0x432ad0['params']['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x4e9ce7,null))['then'](function(_0x8e71c5){if(_0x8e71c5){return _0x8e71c5[_0x1da8('0x5d')](_0x432ad0[_0x1da8('0x58')][_0x1da8('0x5e')],_[_0x1da8('0x5f')](_0x432ad0[_0x1da8('0x58')],[_0x1da8('0x5e'),'id'])||{});}})[_0x1da8('0x21')](respondWithResult(_0x4e9ce7,null))[_0x1da8('0x53')](handleError(_0x4e9ce7,null));};exports['getMembers']=function(_0x11eb4c,_0x2ef656,_0x1b0c2d){var _0x11d79d={};var _0x14156e={};var _0x5dd305;var _0x536d0f;return db['ChatGroup'][_0x1da8('0x60')]({'where':{'id':_0x11eb4c[_0x1da8('0x55')]['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x2ef656,null))['then'](function(_0x300fd1){if(_0x300fd1){_0x5dd305=_0x300fd1;_0x14156e[_0x1da8('0x3c')]=_['keys'](db[_0x1da8('0x61')][_0x1da8('0x38')]);_0x14156e[_0x1da8('0x3d')]=_[_0x1da8('0x3e')](_0x11eb4c['query']);_0x14156e[_0x1da8('0x3f')]=_[_0x1da8('0x40')](_0x14156e['model'],_0x14156e[_0x1da8('0x3d')]);_0x11d79d[_0x1da8('0x41')]=_[_0x1da8('0x40')](_0x14156e[_0x1da8('0x3c')],qs[_0x1da8('0x42')](_0x11eb4c['query'][_0x1da8('0x42')]));_0x11d79d[_0x1da8('0x41')]=_0x11d79d[_0x1da8('0x41')][_0x1da8('0x43')]?_0x11d79d[_0x1da8('0x41')]:_0x14156e[_0x1da8('0x3c')];_0x11d79d[_0x1da8('0x47')]=qs['sort'](_0x11eb4c[_0x1da8('0x3d')][_0x1da8('0x48')]);_0x11d79d[_0x1da8('0x49')]=qs[_0x1da8('0x3f')](_[_0x1da8('0x4a')](_0x11eb4c['query'],_0x14156e[_0x1da8('0x3f')]));if(_0x11eb4c[_0x1da8('0x3d')][_0x1da8('0x4b')]){_0x11d79d[_0x1da8('0x49')]=_['merge'](_0x11d79d[_0x1da8('0x49')],{'$or':_['map'](_0x11d79d['attributes'],function(_0x3edb75){var _0xc5a0dd={};_0xc5a0dd[_0x3edb75]={'$like':'%'+_0x11eb4c[_0x1da8('0x3d')]['filter']+'%'};return _0xc5a0dd;})});}_0x11d79d=_[_0x1da8('0x4c')]({},_0x11d79d,_0x11eb4c[_0x1da8('0x4e')]);return _0x5dd305[_0x1da8('0x62')](_0x11d79d);}})[_0x1da8('0x21')](function(_0x8f250b){if(_0x8f250b){_0x536d0f=_0x8f250b[_0x1da8('0x43')];if(!_0x11eb4c[_0x1da8('0x3d')][_0x1da8('0x63')]('nolimit')){_0x11d79d[_0x1da8('0x45')]=qs[_0x1da8('0x45')](_0x11eb4c['query'][_0x1da8('0x45')]);_0x11d79d['offset']=qs[_0x1da8('0x46')](_0x11eb4c[_0x1da8('0x3d')][_0x1da8('0x46')]);}return _0x5dd305[_0x1da8('0x62')](_0x11d79d);}})['then'](function(_0x11dd92){if(_0x11dd92){return _0x11dd92?{'count':_0x536d0f,'rows':_0x11dd92}:null;}})[_0x1da8('0x21')](respondWithResult(_0x2ef656,null))[_0x1da8('0x53')](handleError(_0x2ef656,null));};exports[_0x1da8('0x64')]=function(_0x1ed5b6,_0x26fb72,_0xd6a19d){return db[_0x1da8('0x4f')][_0x1da8('0x56')]({'where':{'id':_0x1ed5b6['params']['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x26fb72,null))['then'](function(_0x3b7418){if(_0x3b7418){return _0x3b7418[_0x1da8('0x64')](_0x1ed5b6[_0x1da8('0x3d')][_0x1da8('0x5e')]);}})[_0x1da8('0x21')](respondWithStatusCode(_0x26fb72,null))[_0x1da8('0x53')](handleError(_0x26fb72,null));};exports[_0x1da8('0x65')]=function(_0x83927b,_0x202072,_0x249fb4){if(_0x83927b['body']['id']){delete _0x83927b['body']['id'];}return db['ChatGroup'][_0x1da8('0x56')]({'where':{'id':_0x83927b['params']['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x202072,null))[_0x1da8('0x21')](function(_0x4aa2b4){if(_0x4aa2b4){_0x83927b[_0x1da8('0x58')]['ChatGroupId']=_0x4aa2b4['id'];return db[_0x1da8('0x5a')][_0x1da8('0x57')](_0x83927b[_0x1da8('0x58')]);}})[_0x1da8('0x21')](respondWithResult(_0x202072,null))[_0x1da8('0x53')](handleError(_0x202072,null));};exports['getMessages']=function(_0x53d921,_0x38a0d2,_0x1277ff){var _0x2072cf={};var _0x506a2c={};var _0x150ce8;var _0x3e2948;return db['ChatGroup'][_0x1da8('0x60')]({'where':{'id':_0x53d921['params']['id']}})[_0x1da8('0x21')](handleEntityNotFound(_0x38a0d2,null))[_0x1da8('0x21')](function(_0x5e95d1){if(_0x5e95d1){_0x150ce8=_0x5e95d1;_0x506a2c[_0x1da8('0x3c')]=_[_0x1da8('0x3e')](db[_0x1da8('0x5a')][_0x1da8('0x38')]);_0x506a2c[_0x1da8('0x3d')]=_[_0x1da8('0x3e')](_0x53d921[_0x1da8('0x3d')]);_0x506a2c[_0x1da8('0x3f')]=_[_0x1da8('0x40')](_0x506a2c[_0x1da8('0x3c')],_0x506a2c['query']);_0x2072cf['attributes']=_[_0x1da8('0x40')](_0x506a2c[_0x1da8('0x3c')],qs[_0x1da8('0x42')](_0x53d921[_0x1da8('0x3d')]['fields']));_0x2072cf[_0x1da8('0x41')]=_0x2072cf['attributes'][_0x1da8('0x43')]?_0x2072cf[_0x1da8('0x41')]:_0x506a2c['model'];_0x2072cf[_0x1da8('0x47')]=qs[_0x1da8('0x48')](_0x53d921[_0x1da8('0x3d')][_0x1da8('0x48')]);_0x2072cf['where']=qs[_0x1da8('0x3f')](_[_0x1da8('0x4a')](_0x53d921[_0x1da8('0x3d')],_0x506a2c['filters']));if(_0x53d921['query'][_0x1da8('0x4b')]){_0x2072cf[_0x1da8('0x49')]=_[_0x1da8('0x4c')](_0x2072cf[_0x1da8('0x49')],{'$or':_[_0x1da8('0x37')](_0x2072cf[_0x1da8('0x41')],function(_0x1eaebe){var _0x7fc2d7={};_0x7fc2d7[_0x1eaebe]={'$like':'%'+_0x53d921[_0x1da8('0x3d')][_0x1da8('0x4b')]+'%'};return _0x7fc2d7;})});}if(_0x53d921['query'][_0x1da8('0x66')]){var _0x7253bd=_0x53d921[_0x1da8('0x3d')][_0x1da8('0x66')]['split'](',');var _0x43c6ed={};_0x43c6ed[_0x7253bd[0x0]]={'$gte':moment(_0x7253bd[0x1])[_0x1da8('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2072cf[_0x1da8('0x49')]=_[_0x1da8('0x4c')](_0x2072cf[_0x1da8('0x49')],_0x43c6ed);}_0x2072cf=_[_0x1da8('0x4c')]({},_0x2072cf,_0x53d921[_0x1da8('0x4e')]);return _0x150ce8[_0x1da8('0x68')](_0x2072cf);}})[_0x1da8('0x21')](function(_0x326a11){if(_0x326a11){_0x3e2948=_0x326a11[_0x1da8('0x43')];if(!_0x53d921[_0x1da8('0x3d')]['hasOwnProperty'](_0x1da8('0x44'))){_0x2072cf[_0x1da8('0x45')]=qs[_0x1da8('0x45')](_0x53d921[_0x1da8('0x3d')]['limit']);_0x2072cf[_0x1da8('0x46')]=qs['offset'](_0x53d921[_0x1da8('0x3d')][_0x1da8('0x46')]);}return _0x150ce8[_0x1da8('0x68')](_0x2072cf);}})[_0x1da8('0x21')](function(_0x4aa1db){if(_0x4aa1db){return _0x4aa1db?{'count':_0x3e2948,'rows':_0x4aa1db}:null;}})[_0x1da8('0x21')](respondWithResult(_0x38a0d2,null))[_0x1da8('0x53')](handleError(_0x38a0d2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7a1288f..3cae75a 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xadb5,0xad));var _0x5adb=function(_0x39490f,_0x32beaf){_0x39490f=_0x39490f-0x0;var _0x270b72=_0xadb5[_0x39490f];return _0x270b72;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0xa59345,_0x86f01c){var _0x22fc32=function(_0x1c5423){while(--_0x1c5423){_0xa59345['push'](_0xa59345['shift']());}};_0x22fc32(++_0x86f01c);}(_0x2ef3,0xba));var _0x32ef=function(_0x384a77,_0xd78911){_0x384a77=_0x384a77-0x0;var _0x577089=_0x2ef3[_0x384a77];return _0x577089;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 05df091..9c347ce 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 _0x303a=['bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','../../config/logger','api','moment'];(function(_0x43d9d6,_0x392bd4){var _0xd83594=function(_0x53b4d4){while(--_0x53b4d4){_0x43d9d6['push'](_0x43d9d6['shift']());}};_0xd83594(++_0x392bd4);}(_0x303a,0x1a0));var _0xa303=function(_0x27b49f,_0x5609d2){_0x27b49f=_0x27b49f-0x0;var _0x1b75c2=_0x303a[_0x27b49f];return _0x1b75c2;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b6d=['request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird'];(function(_0x20fc20,_0x388f07){var _0x331f92=function(_0x569857){while(--_0x569857){_0x20fc20['push'](_0x20fc20['shift']());}};_0x331f92(++_0x388f07);}(_0x9b6d,0x105));var _0xd9b6=function(_0x1dc219,_0x2d4347){_0x1dc219=_0x1dc219-0x0;var _0x567bc0=_0x9b6d[_0x1dc219];return _0x567bc0;};'use strict';var _=require('lodash');var util=require(_0xd9b6('0x0'));var logger=require(_0xd9b6('0x1'))(_0xd9b6('0x2'));var moment=require(_0xd9b6('0x3'));var BPromise=require(_0xd9b6('0x4'));var rp=require(_0xd9b6('0x5'));var fs=require('fs');var path=require(_0xd9b6('0x6'));var rimraf=require(_0xd9b6('0x7'));var config=require(_0xd9b6('0x8'));var attributes=require(_0xd9b6('0x9'));module[_0xd9b6('0xa')]=function(_0x5724e3,_0x2d38ce){return _0x5724e3[_0xd9b6('0xb')](_0xd9b6('0xc'),attributes,{'tableName':_0xd9b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 8649ae6..607da7f 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 _0xdc0d=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s'];(function(_0x4bd397,_0x1b7888){var _0x1501c6=function(_0x121c60){while(--_0x121c60){_0x4bd397['push'](_0x4bd397['shift']());}};_0x1501c6(++_0x1b7888);}(_0xdc0d,0x182));var _0xddc0=function(_0x348ce8,_0xbd7ea){_0x348ce8=_0x348ce8-0x0;var _0x21baf8=_0xdc0d[_0x348ce8];return _0x21baf8;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var moment=require(_0xddc0('0x2'));var BPromise=require(_0xddc0('0x3'));var rs=require(_0xddc0('0x4'));var fs=require('fs');var Redis=require(_0xddc0('0x5'));var db=require(_0xddc0('0x6'))['db'];var utils=require(_0xddc0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xddc0('0x8'));var jayson=require(_0xddc0('0x9'));var client=jayson['client'][_0xddc0('0xa')]({'port':0x232a});config[_0xddc0('0xb')]=_[_0xddc0('0xc')](config[_0xddc0('0xb')],{'host':_0xddc0('0xd'),'port':0x18eb});var socket=require(_0xddc0('0xe'))(new Redis(config['redis']));require(_0xddc0('0xf'))[_0xddc0('0x10')](socket);function respondWithRpcPromise(_0x106c9a,_0x243a82,_0x51cd83){return new BPromise(function(_0x18c106,_0x4d2bd3){return client[_0xddc0('0x11')](_0x106c9a,_0x51cd83)['then'](function(_0x15938a){logger[_0xddc0('0x12')](_0xddc0('0x13'),_0x243a82,_0xddc0('0x14'));logger[_0xddc0('0x15')](_0xddc0('0x16'),_0x243a82,'request\x20sent',JSON[_0xddc0('0x17')](_0x15938a));if(_0x15938a['error']){if(_0x15938a[_0xddc0('0x18')][_0xddc0('0x19')]===0x1f4){logger['error'](_0xddc0('0x13'),_0x243a82,_0x15938a[_0xddc0('0x18')][_0xddc0('0x1a')]);return _0x4d2bd3(_0x15938a[_0xddc0('0x18')][_0xddc0('0x1a')]);}logger[_0xddc0('0x18')](_0xddc0('0x13'),_0x243a82,_0x15938a[_0xddc0('0x18')][_0xddc0('0x1a')]);return _0x18c106(_0x15938a[_0xddc0('0x18')][_0xddc0('0x1a')]);}else{logger[_0xddc0('0x12')](_0xddc0('0x13'),_0x243a82,_0xddc0('0x14'));_0x18c106(_0x15938a[_0xddc0('0x1b')][_0xddc0('0x1a')]);}})[_0xddc0('0x1c')](function(_0x35f792){logger[_0xddc0('0x18')]('ChatGroup,\x20%s,\x20%s',_0x243a82,_0x35f792);_0x4d2bd3(_0x35f792);});});} \ No newline at end of file +var _0xce46=['message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e009d,_0x109407){var _0x115163=function(_0x1b77fe){while(--_0x1b77fe){_0x5e009d['push'](_0x5e009d['shift']());}};_0x115163(++_0x109407);}(_0xce46,0x137));var _0x6ce4=function(_0x285014,_0x2c5b10){_0x285014=_0x285014-0x0;var _0x406e1e=_0xce46[_0x285014];return _0x406e1e;};'use strict';var _=require('lodash');var util=require(_0x6ce4('0x0'));var moment=require(_0x6ce4('0x1'));var BPromise=require(_0x6ce4('0x2'));var rs=require(_0x6ce4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ce4('0x4'));var logger=require(_0x6ce4('0x5'))(_0x6ce4('0x6'));var config=require(_0x6ce4('0x7'));var jayson=require(_0x6ce4('0x8'));var client=jayson[_0x6ce4('0x9')][_0x6ce4('0xa')]({'port':0x232a});config[_0x6ce4('0xb')]=_[_0x6ce4('0xc')](config[_0x6ce4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ce4('0xd'))(new Redis(config[_0x6ce4('0xb')]));require('./chatGroup.socket')[_0x6ce4('0xe')](socket);function respondWithRpcPromise(_0x3816f3,_0x2deb1b,_0x33a8a0){return new BPromise(function(_0x9c0a70,_0x54e833){return client[_0x6ce4('0xf')](_0x3816f3,_0x33a8a0)[_0x6ce4('0x10')](function(_0x237b7b){logger[_0x6ce4('0x11')](_0x6ce4('0x12'),_0x2deb1b,_0x6ce4('0x13'));logger[_0x6ce4('0x14')](_0x6ce4('0x15'),_0x2deb1b,_0x6ce4('0x13'),JSON[_0x6ce4('0x16')](_0x237b7b));if(_0x237b7b[_0x6ce4('0x17')]){if(_0x237b7b['error'][_0x6ce4('0x18')]===0x1f4){logger[_0x6ce4('0x17')](_0x6ce4('0x12'),_0x2deb1b,_0x237b7b[_0x6ce4('0x17')][_0x6ce4('0x19')]);return _0x54e833(_0x237b7b[_0x6ce4('0x17')]['message']);}logger[_0x6ce4('0x17')]('ChatGroup,\x20%s,\x20%s',_0x2deb1b,_0x237b7b[_0x6ce4('0x17')]['message']);return _0x9c0a70(_0x237b7b[_0x6ce4('0x17')]['message']);}else{logger[_0x6ce4('0x11')]('ChatGroup,\x20%s,\x20%s',_0x2deb1b,_0x6ce4('0x13'));_0x9c0a70(_0x237b7b[_0x6ce4('0x1a')][_0x6ce4('0x19')]);}})[_0x6ce4('0x1b')](function(_0x23f977){logger[_0x6ce4('0x17')](_0x6ce4('0x12'),_0x2deb1b,_0x23f977);_0x54e833(_0x23f977);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8688db0..5d08ec9 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 _0x7a66=['update','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x3fe9e8,_0x27f3bf){var _0x23eeb9=function(_0x3116f6){while(--_0x3116f6){_0x3fe9e8['push'](_0x3fe9e8['shift']());}};_0x23eeb9(++_0x27f3bf);}(_0x7a66,0x81));var _0x67a6=function(_0x452ff6,_0x902f4e){_0x452ff6=_0x452ff6-0x0;var _0x3af338=_0x7a66[_0x452ff6];return _0x3af338;};'use strict';var ChatGroupEvents=require(_0x67a6('0x0'));var events=['save','remove',_0x67a6('0x1')];function createListener(_0x26c554,_0x4aef4a){return function(_0x3ec0fe){_0x4aef4a['emit'](_0x26c554,_0x3ec0fe);};}function removeListener(_0x2cb8e8,_0x233d72){return function(){ChatGroupEvents[_0x67a6('0x2')](_0x2cb8e8,_0x233d72);};}exports['register']=function(_0x3e9355){for(var _0x1479f3=0x0,_0x1da168=events[_0x67a6('0x3')];_0x1479f3<_0x1da168;_0x1479f3++){var _0x2da992=events[_0x1479f3];var _0x27ca62=createListener(_0x67a6('0x4')+_0x2da992,_0x3e9355);ChatGroupEvents['on'](_0x2da992,_0x27ca62);}}; \ No newline at end of file +var _0x7e82=['save','remove','update','emit','length','chatGroup:','./chatGroup.events'];(function(_0x63ac21,_0x2edb1b){var _0x87cd70=function(_0x546a72){while(--_0x546a72){_0x63ac21['push'](_0x63ac21['shift']());}};_0x87cd70(++_0x2edb1b);}(_0x7e82,0x1c6));var _0x27e8=function(_0x4670cd,_0xf0eb7){_0x4670cd=_0x4670cd-0x0;var _0x13ed58=_0x7e82[_0x4670cd];return _0x13ed58;};'use strict';var ChatGroupEvents=require(_0x27e8('0x0'));var events=[_0x27e8('0x1'),_0x27e8('0x2'),_0x27e8('0x3')];function createListener(_0x29faa9,_0x1b7c4f){return function(_0x3cfd3a){_0x1b7c4f[_0x27e8('0x4')](_0x29faa9,_0x3cfd3a);};}function removeListener(_0x101d35,_0x332fd6){return function(){ChatGroupEvents['removeListener'](_0x101d35,_0x332fd6);};}exports['register']=function(_0x27f369){for(var _0x701aae=0x0,_0x365710=events[_0x27e8('0x5')];_0x701aae<_0x365710;_0x701aae++){var _0x22d610=events[_0x701aae];var _0x386b38=createListener(_0x27e8('0x6')+_0x22d610,_0x27f369);ChatGroupEvents['on'](_0x22d610,_0x386b38);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fe580ae..c4a6ac9 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 _0x12dc=['create','post','addMembers','/:id/messages','addMessage','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages'];(function(_0x4a9809,_0xa0121c){var _0x19f789=function(_0x396c81){while(--_0x396c81){_0x4a9809['push'](_0x4a9809['shift']());}};_0x19f789(++_0xa0121c);}(_0x12dc,0x1af));var _0xc12d=function(_0x170d7e,_0x32cca3){_0x170d7e=_0x170d7e-0x0;var _0x4c75aa=_0x12dc[_0x170d7e];return _0x4c75aa;};'use strict';var multer=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var path=require(_0xc12d('0x2'));var timeout=require(_0xc12d('0x3'));var express=require(_0xc12d('0x4'));var router=express[_0xc12d('0x5')]();var auth=require(_0xc12d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc12d('0x7'));router[_0xc12d('0x8')]('/',auth[_0xc12d('0x9')](),controller[_0xc12d('0xa')]);router[_0xc12d('0x8')](_0xc12d('0xb'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xc')]);router[_0xc12d('0x8')]('/:id',auth[_0xc12d('0x9')](),controller[_0xc12d('0xd')]);router['get'](_0xc12d('0xe'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xf')]);router[_0xc12d('0x8')](_0xc12d('0x10'),auth[_0xc12d('0x9')](),controller[_0xc12d('0x11')]);router['get']('/:id/messages',auth[_0xc12d('0x9')](),controller[_0xc12d('0x12')]);router['post']('/',auth[_0xc12d('0x9')](),controller[_0xc12d('0x13')]);router[_0xc12d('0x14')](_0xc12d('0x10'),auth['isAuthenticated'](),controller[_0xc12d('0x15')]);router[_0xc12d('0x14')](_0xc12d('0x16'),auth[_0xc12d('0x9')](),controller[_0xc12d('0x17')]);router[_0xc12d('0x18')]('/:id',auth[_0xc12d('0x9')](),controller[_0xc12d('0x19')]);router[_0xc12d('0x1a')](_0xc12d('0x1b'),auth['isAuthenticated'](),controller[_0xc12d('0x1c')]);router['delete'](_0xc12d('0x10'),auth[_0xc12d('0x9')](),controller['removeMembers']);module[_0xc12d('0x1d')]=router; \ No newline at end of file +var _0xbf23=['/:id/unread','getUnread','/:id/members','getMembers','create','post','addMembers','/:id/messages','addMessage','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','/:id'];(function(_0x36ec63,_0x4a6d7d){var _0x57b9be=function(_0x33c6c7){while(--_0x33c6c7){_0x36ec63['push'](_0x36ec63['shift']());}};_0x57b9be(++_0x4a6d7d);}(_0xbf23,0x1a6));var _0x3bf2=function(_0x5533b1,_0x7f4a9a){_0x5533b1=_0x5533b1-0x0;var _0x1009f3=_0xbf23[_0x5533b1];return _0x1009f3;};'use strict';var multer=require(_0x3bf2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3bf2('0x1'));var express=require(_0x3bf2('0x2'));var router=express[_0x3bf2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bf2('0x4'));var config=require('../../config/environment');var controller=require(_0x3bf2('0x5'));router[_0x3bf2('0x6')]('/',auth[_0x3bf2('0x7')](),controller['index']);router[_0x3bf2('0x6')](_0x3bf2('0x8'),auth[_0x3bf2('0x7')](),controller['describe']);router[_0x3bf2('0x6')](_0x3bf2('0x9'),auth[_0x3bf2('0x7')](),controller['show']);router[_0x3bf2('0x6')](_0x3bf2('0xa'),auth[_0x3bf2('0x7')](),controller[_0x3bf2('0xb')]);router[_0x3bf2('0x6')](_0x3bf2('0xc'),auth['isAuthenticated'](),controller[_0x3bf2('0xd')]);router['get']('/:id/messages',auth[_0x3bf2('0x7')](),controller['getMessages']);router['post']('/',auth[_0x3bf2('0x7')](),controller[_0x3bf2('0xe')]);router[_0x3bf2('0xf')](_0x3bf2('0xc'),auth[_0x3bf2('0x7')](),controller[_0x3bf2('0x10')]);router['post'](_0x3bf2('0x11'),auth[_0x3bf2('0x7')](),controller[_0x3bf2('0x12')]);router[_0x3bf2('0x13')](_0x3bf2('0x9'),auth['isAuthenticated'](),controller[_0x3bf2('0x14')]);router[_0x3bf2('0x15')](_0x3bf2('0x9'),auth['isAuthenticated'](),controller[_0x3bf2('0x16')]);router[_0x3bf2('0x15')](_0x3bf2('0xc'),auth[_0x3bf2('0x7')](),controller['removeMembers']);module[_0x3bf2('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 347b149..fa60ea6 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 _0x8f35=['star','thumb','TEXT','STRING','long','DATE','out','sequelize','BOOLEAN','ENUM'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x8f35,0x101));var _0x58f3=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x8f35[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require(_0x58f3('0x0'));module['exports']={'closed':{'type':Sequelize[_0x58f3('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x58f3('0x2')](_0x58f3('0x3'),_0x58f3('0x4')),'defaultValue':_0x58f3('0x3')},'ratingMessage':{'type':Sequelize[_0x58f3('0x5')]},'pathTranscript':{'type':Sequelize[_0x58f3('0x5')]},'mailTranscript':{'type':Sequelize[_0x58f3('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x58f3('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x58f3('0x6')]},'browserName':{'type':Sequelize[_0x58f3('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x58f3('0x6')]},'osVersion':{'type':Sequelize[_0x58f3('0x6')]},'deviceModel':{'type':Sequelize[_0x58f3('0x6')]},'deviceVendor':{'type':Sequelize[_0x58f3('0x6')]},'deviceType':{'type':Sequelize[_0x58f3('0x6')]},'referer':{'type':Sequelize[_0x58f3('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x58f3('0x5')](_0x58f3('0x7'))},'read1stAt':{'type':Sequelize[_0x58f3('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x58f3('0x2')]('in',_0x58f3('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x58f3('0x6')]},'customerPort':{'type':Sequelize[_0x58f3('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x58f3('0x5')]}}; \ No newline at end of file +var _0xc918=['thumb','star','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x533cd7,_0x85e0c1){var _0xb30ffc=function(_0x39c2ff){while(--_0x39c2ff){_0x533cd7['push'](_0x533cd7['shift']());}};_0xb30ffc(++_0x85e0c1);}(_0xc918,0xf7));var _0x8c91=function(_0x7d20a1,_0x1eb4b0){_0x7d20a1=_0x7d20a1-0x0;var _0x4abebe=_0xc918[_0x7d20a1];return _0x4abebe;};'use strict';var Sequelize=require(_0x8c91('0x0'));module[_0x8c91('0x1')]={'closed':{'type':Sequelize[_0x8c91('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8c91('0x3')]},'ratingType':{'type':Sequelize[_0x8c91('0x4')]('star',_0x8c91('0x5')),'defaultValue':_0x8c91('0x6')},'ratingMessage':{'type':Sequelize[_0x8c91('0x7')]},'pathTranscript':{'type':Sequelize[_0x8c91('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8c91('0x8')]},'disposition':{'type':Sequelize[_0x8c91('0x9')]},'secondDisposition':{'type':Sequelize[_0x8c91('0x9')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8c91('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8c91('0x9')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x8c91('0x9')]},'deviceModel':{'type':Sequelize[_0x8c91('0x9')]},'deviceVendor':{'type':Sequelize[_0x8c91('0x9')]},'deviceType':{'type':Sequelize[_0x8c91('0x9')]},'referer':{'type':Sequelize[_0x8c91('0x7')]},'customerIp':{'type':Sequelize[_0x8c91('0x9')]},'formData':{'type':Sequelize[_0x8c91('0x7')](_0x8c91('0xa'))},'read1stAt':{'type':Sequelize[_0x8c91('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8c91('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x8c91('0x4')]('in',_0x8c91('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8c91('0x9')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b3f6838..bc7082a 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 _0x7cc8=['sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','params','rawAttributes','includeAll','include','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','download','join','root','server/files/attachments/','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','System','customer','agentAlias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','ids','omit','getMessages','hasOwnProperty','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','setTags','color','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Account','Owner','get','mkdirSync','10px','40px','30px','%s\x20#%d','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','views','toFile','transcript-','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','code','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','destroy','name','send','Users','map','fullname','Tags','split','push','TagIds','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','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','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','ChatWebsiteId','concat','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','agent','toString','count'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0x7cc8,0x92));var _0x87cc=function(_0x58a86e,_0x1e1f69){_0x58a86e=_0x58a86e-0x0;var _0x50528a=_0x7cc8[_0x58a86e];return _0x50528a;};'use strict';var pdf=require(_0x87cc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x87cc('0x1'));var jsonpatch=require(_0x87cc('0x2'));var rp=require('request-promise');var moment=require(_0x87cc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x87cc('0x4'));var util=require(_0x87cc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x87cc('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87cc('0x7'));var squel=require(_0x87cc('0x8'));var crypto=require(_0x87cc('0x9'));var jsforce=require(_0x87cc('0xa'));var deskjs=require(_0x87cc('0xb'));var toCsv=require(_0x87cc('0x6'));var querystring=require('querystring');var Papa=require(_0x87cc('0xc'));var Redis=require(_0x87cc('0xd'));var authService=require(_0x87cc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x87cc('0xf'));var hardwareService=require(_0x87cc('0x10'));var logger=require(_0x87cc('0x11'))(_0x87cc('0x12'));var utils=require(_0x87cc('0x13'));var config=require(_0x87cc('0x14'));var licenseUtil=require(_0x87cc('0x15'));var db=require(_0x87cc('0x16'))['db'];config[_0x87cc('0x17')]=_['defaults'](config[_0x87cc('0x17')],{'host':_0x87cc('0x18'),'port':0x18eb});var socket=require(_0x87cc('0x19'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x87cc('0x1a')](socket);var jayson=require(_0x87cc('0x1b'));var client=jayson[_0x87cc('0x1c')][_0x87cc('0x1d')]({'port':0x232b});var client9004=jayson[_0x87cc('0x1c')][_0x87cc('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x44de74,_0x17626c,_0x204e35,_0x3f9d94){return new BPromise(function(_0x22190c,_0x3dde51){var _0x124c6f=_0x3f9d94||client;return _0x124c6f['request'](_0x44de74,_0x204e35)[_0x87cc('0x1e')](function(_0x1a2017){logger['info'](_0x87cc('0x1f'),_0x17626c,'request\x20sent');logger[_0x87cc('0x20')](_0x87cc('0x21'),_0x17626c,'request\x20sent',JSON['stringify'](_0x1a2017));if(_0x1a2017['error']){if(_0x1a2017['error'][_0x87cc('0x22')]===0x1f4){logger['error'](_0x87cc('0x1f'),_0x17626c,_0x1a2017[_0x87cc('0x23')][_0x87cc('0x24')]);return _0x3dde51(_0x1a2017[_0x87cc('0x23')][_0x87cc('0x24')]);}logger[_0x87cc('0x23')](_0x87cc('0x1f'),_0x17626c,_0x1a2017[_0x87cc('0x23')][_0x87cc('0x24')]);return _0x22190c(_0x1a2017[_0x87cc('0x23')]['message']);}else{logger[_0x87cc('0x25')](_0x87cc('0x1f'),_0x17626c,_0x87cc('0x26'));_0x22190c(_0x1a2017[_0x87cc('0x27')]['message']);}})[_0x87cc('0x28')](function(_0x4dd2cb){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x17626c,_0x4dd2cb);_0x3dde51(_0x4dd2cb);});});}function respondWithStatusCode(_0x2c5d82,_0x3e180c){_0x3e180c=_0x3e180c||0xcc;return function(_0x1a8a4c){if(_0x1a8a4c){return _0x2c5d82[_0x87cc('0x29')](_0x3e180c);}return _0x2c5d82[_0x87cc('0x2a')](_0x3e180c)[_0x87cc('0x2b')]();};}function respondWithResult(_0xaab7ad,_0x30959e){_0x30959e=_0x30959e||0xc8;return function(_0x2a52ad){if(_0x2a52ad){return _0xaab7ad[_0x87cc('0x2a')](_0x30959e)[_0x87cc('0x2c')](_0x2a52ad);}};}function respondWithFilteredResult(_0x296791,_0x5e3099){return function(_0x4d5572){if(_0x4d5572){var _0x45ec02=_0x4d5572['count'],_0x376e34=_0x5e3099['offset'],_0x5581d5=_0x5e3099[_0x87cc('0x2d')]+_0x5e3099['limit'],_0x5cd629;if(_0x5581d5>=_0x45ec02){_0x5581d5=_0x45ec02;_0x5cd629=0xc8;}else{_0x5cd629=0xce;}_0x296791[_0x87cc('0x2a')](_0x5cd629);return _0x296791[_0x87cc('0x2e')](_0x87cc('0x2f'),_0x376e34+'-'+_0x5581d5+'/'+_0x45ec02)[_0x87cc('0x2c')](_0x4d5572);}return null;};}function patchUpdates(_0x32a5a5){return function(_0x2c1789){try{jsonpatch[_0x87cc('0x30')](_0x2c1789,_0x32a5a5,!![]);}catch(_0x1eb201){return BPromise['reject'](_0x1eb201);}return _0x2c1789['save']();};}function saveUpdates(_0x3de52d,_0x5f329f){return function(_0xbd31e5){if(_0xbd31e5){return _0xbd31e5['update'](_0x3de52d)[_0x87cc('0x1e')](function(_0x4d97e2){return _0x4d97e2;});}return null;};}function removeEntity(_0x5b34f6,_0x25e2df){return function(_0x3926d1){if(_0x3926d1){return _0x3926d1[_0x87cc('0x31')]()[_0x87cc('0x1e')](function(){_0x5b34f6[_0x87cc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1441b8,_0x5b3909){return function(_0x580477){if(!_0x580477){_0x1441b8['sendStatus'](0x194);}return _0x580477;};}function handleError(_0x219ec4,_0x38e3c5){_0x38e3c5=_0x38e3c5||0x1f4;return function(_0x4b81e1){logger['error'](_0x4b81e1['stack']);if(_0x4b81e1[_0x87cc('0x32')]){delete _0x4b81e1[_0x87cc('0x32')];}_0x219ec4[_0x87cc('0x2a')](_0x38e3c5)[_0x87cc('0x33')](_0x4b81e1);};}function getInteractionUsers(_0x136bfb,_0xbb1477){return new BPromise(function(_0x37cabb,_0x14528c){try{if(_0xbb1477[_0x136bfb['id']]){_0x136bfb[_0x87cc('0x34')]=_[_0x87cc('0x35')](_0xbb1477[_0x136bfb['id']],function(_0x4e64ed){return{'id':_0x4e64ed['id'],'fullname':_0x4e64ed[_0x87cc('0x36')]};});}}catch(_0x7264cb){_0x14528c(_0x7264cb);}_0x37cabb(_0x136bfb);});}function getInteractionTags(_0x37127d,_0x5ef158){return new BPromise(function(_0x33bee4,_0x1e9aec){try{if(_0x37127d['TagIds']){_0x37127d[_0x87cc('0x37')]=[];_0x37127d['TagIds'][_0x87cc('0x38')](',')['forEach'](function(_0x13ceae){_0x37127d[_0x87cc('0x37')][_0x87cc('0x39')](_0x5ef158[_0x13ceae]);});}delete _0x37127d[_0x87cc('0x3a')];}catch(_0xe873c8){_0x1e9aec(_0xe873c8);}_0x33bee4(_0x37127d);});}function updateChatInteraction(_0x1b9a74,_0x4adbbc,_0x35b56d){return new BPromise(function(_0x10a79d,_0x23a136){return getInteractionUsers(_0x1b9a74,_0x35b56d)['then'](function(_0x501289){return getInteractionTags(_0x501289,_0x4adbbc);})[_0x87cc('0x1e')](function(_0x25ee47){_0x10a79d(_0x25ee47);})['catch'](function(_0x17ffa0){_0x23a136(_0x17ffa0);});});}exports['index']=function(_0x1cfbe9,_0x461460){var _0x495cba={},_0x3f49f7={},_0x196de1={'count':0x0,'rows':[]};var _0x65ecf5=_['map'](db[_0x87cc('0x3b')]['rawAttributes'],function(_0x557428){return{'name':_0x557428[_0x87cc('0x3c')],'type':_0x557428[_0x87cc('0x3d')][_0x87cc('0x3e')]};});_0x3f49f7[_0x87cc('0x3f')]=_[_0x87cc('0x35')](_0x65ecf5,_0x87cc('0x32'));_0x3f49f7[_0x87cc('0x40')]=_[_0x87cc('0x41')](_0x1cfbe9[_0x87cc('0x40')]);_0x3f49f7[_0x87cc('0x42')]=_[_0x87cc('0x43')](_0x3f49f7[_0x87cc('0x3f')],_0x3f49f7[_0x87cc('0x40')]);_0x495cba['attributes']=_[_0x87cc('0x43')](_0x3f49f7[_0x87cc('0x3f')],qs[_0x87cc('0x44')](_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x44')]));_0x495cba[_0x87cc('0x45')]=_0x495cba[_0x87cc('0x45')][_0x87cc('0x46')]?_0x495cba[_0x87cc('0x45')]:_0x3f49f7[_0x87cc('0x3f')];if(!_0x1cfbe9[_0x87cc('0x40')]['hasOwnProperty'](_0x87cc('0x47'))){_0x495cba[_0x87cc('0x48')]=qs[_0x87cc('0x48')](_0x1cfbe9[_0x87cc('0x40')]['limit']);_0x495cba[_0x87cc('0x2d')]=qs['offset'](_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x2d')]);}_0x495cba[_0x87cc('0x49')]=qs[_0x87cc('0x4a')](_0x1cfbe9[_0x87cc('0x40')]['sort']);_0x495cba[_0x87cc('0x4b')]=qs['filters'](_['pick'](_0x1cfbe9[_0x87cc('0x40')],_0x3f49f7['filters']),_0x65ecf5);var _0x571f26=[];var _0x5a0f1d=squel['select']()[_0x87cc('0x4c')]('id')[_0x87cc('0x4c')](_0x87cc('0x32'))['field']('color')[_0x87cc('0x4d')](_0x87cc('0x4e'));var _0x55203b=squel[_0x87cc('0x4f')]()['field'](_0x87cc('0x50'))[_0x87cc('0x4c')](_0x87cc('0x51'))[_0x87cc('0x4c')](_0x87cc('0x52'))[_0x87cc('0x4d')]('user_has_chat_interactions','ui')[_0x87cc('0x53')]('users','u',_0x87cc('0x54'));var _0x1b74c1=squel[_0x87cc('0x4f')]()['from'](_0x87cc('0x55'),'i')['left_join'](_0x87cc('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x87cc('0x53')](_0x87cc('0x57'),'o',_0x87cc('0x58'))['left_join'](_0x87cc('0x59'),'a',_0x87cc('0x5a'))['left_join'](_0x87cc('0x5b'),'me',_0x87cc('0x5c'))[_0x87cc('0x53')](_0x87cc('0x5d'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x87cc('0x53')]('tools_tags','t',_0x87cc('0x5e'));var _0xcd4d1=squel[_0x87cc('0x5f')]();var _0x1c4e54=[];var _0x2116d9=squel[_0x87cc('0x5f')]();var _0x39e208;if(_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x60')]){_0x39e208=as[_0x87cc('0x61')](_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x60')]);var _0x270540=_0x39e208[_0x87cc('0x62')];for(var _0x16cc2e=0x0;_0x16cc2e<_0x39e208[_0x87cc('0x63')]['length'];_0x16cc2e++){var _0x554113=_0x39e208[_0x87cc('0x63')][_0x16cc2e];var _0x3e19a0='i';var _0x2a28d0=_[_0x87cc('0x64')](_0x65ecf5,['name',_0x554113[_0x87cc('0x4c')]]);if(!_0x2a28d0){switch(_0x554113[_0x87cc('0x4c')]){case'unreadMessages':if(_0x554113[_0x87cc('0x65')]==0x1){_0x1b74c1[_0x87cc('0x66')]('`'+_0x554113[_0x87cc('0x4c')]+_0x87cc('0x67'));}else{_0x1b74c1['having']('`'+_0x554113[_0x87cc('0x4c')]+_0x87cc('0x68'));}break;case'Contact':if(_0x554113['operator']==='$substring'){if(_0x554113['value']['split']('\x20')[_0x87cc('0x46')]>0x1){_0xcd4d1[_0x270540](_0x87cc('0x69'),qs[_0x87cc('0x6a')](_0x554113[_0x87cc('0x65')]),null);}else{var _0x434e7a='%'+_0x554113[_0x87cc('0x65')]+'%';_0xcd4d1[_0x270540](_0x87cc('0x6b'),_0x434e7a,_0x434e7a,_0x434e7a);}}else{_0x2a28d0=_['find'](_0x65ecf5,[_0x87cc('0x32'),_0x87cc('0x6c')]);_0x554113['field']='ContactId';_0x1588b7=as[_0x87cc('0x6d')](_0x3e19a0,_0x2a28d0['type'],_0x554113);_0xcd4d1[_0x270540](_0x1588b7[_0x87cc('0x6e')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x6f')],_0x1588b7[_0x87cc('0x65')]['end']);}break;case _0x87cc('0x70'):var _0x18e364=_0x554113[_0x87cc('0x65')][_0x87cc('0x38')](',')[_0x87cc('0x35')](function(_0x5ef0ee){return Number(_0x5ef0ee);});_0x18e364[_0x87cc('0x71')](function(_0x2794b9){_0x2116d9['or'](_0x87cc('0x72'),'%,'+_0x2794b9+',%');});_0x1c4e54=_[_0x87cc('0x73')](_0x1c4e54,_0x18e364);break;case'User':if(_0x554113[_0x87cc('0x74')]===_0x87cc('0x75')){_0xcd4d1[_0x270540](_0x87cc('0x76'),'%'+_0x554113[_0x87cc('0x65')]+'%',null);}else{_0x2a28d0=_[_0x87cc('0x64')](_0x65ecf5,['name','UserId']);_0x554113[_0x87cc('0x4c')]=_0x87cc('0x77');_0x1588b7=as[_0x87cc('0x6d')](_0x3e19a0,_0x2a28d0[_0x87cc('0x3d')],_0x554113);_0xcd4d1[_0x270540](_0x1588b7[_0x87cc('0x6e')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x6f')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x2b')]);}break;case _0x87cc('0x78'):_0x1588b7=as[_0x87cc('0x6d')]('me',null,_0x554113);_0xcd4d1[_0x270540](_0x1588b7[_0x87cc('0x6e')],_0x1588b7['value'][_0x87cc('0x6f')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x2b')]);break;}}else{var _0x1588b7=as['buildExpression'](_0x3e19a0,_0x2a28d0[_0x87cc('0x3d')],_0x554113);_0xcd4d1[_0x270540](_0x1588b7[_0x87cc('0x6e')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x6f')],_0x1588b7[_0x87cc('0x65')][_0x87cc('0x2b')]);}}}else{var _0x41ee67=_(_0x1cfbe9[_0x87cc('0x40')])[_0x87cc('0x41')]()['map'](function(_0x31355d){return _[_0x87cc('0x79')](_0x65ecf5,['name',_0x31355d])?_0x31355d:undefined;})[_0x87cc('0x7a')]()[_0x87cc('0x65')]();if(!_[_0x87cc('0x7b')](_0x41ee67)){_0x41ee67[_0x87cc('0x71')](function(_0x5626b1){if(_0x5626b1===_0x87cc('0x7c')){_0x1b74c1[_0x87cc('0x4b')]('i.ChatWebsiteId\x20IN\x20?',[][_0x87cc('0x7d')](_0x1cfbe9[_0x87cc('0x40')][_0x5626b1]));}else if(_0x5626b1==='createdAt'){var _0x22ab51=JSON['parse'](_0x1cfbe9[_0x87cc('0x40')][_0x5626b1])[_0x87cc('0x7e')];var _0x37e94d=JSON[_0x87cc('0x7f')](_0x1cfbe9['query'][_0x5626b1])[_0x87cc('0x80')];_0x1b74c1['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x22ab51,_0x37e94d);}else{if(_0x1cfbe9['query'][_0x5626b1]==='null'){_0x1b74c1[_0x87cc('0x4b')]('i.'+_0x5626b1+_0x87cc('0x81'));}else{_0x1b74c1[_0x87cc('0x4b')]('i.'+_0x5626b1+_0x87cc('0x82'),_0x1cfbe9[_0x87cc('0x40')][_0x5626b1]);}}});}if(_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x83')]){if(_0x1cfbe9[_0x87cc('0x40')]['read']==0x1){_0x1b74c1[_0x87cc('0x66')]('`unreadMessages`\x20=\x200');}else{_0x1b74c1[_0x87cc('0x66')](_0x87cc('0x84'));}}if(_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x85')]){_0x1c4e54=_['isArray'](_0x1cfbe9[_0x87cc('0x40')]['tag'])?_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x85')]:new Array(_0x1cfbe9[_0x87cc('0x40')][_0x87cc('0x85')]);_0x1c4e54[_0x87cc('0x71')](function(_0x4acdb5){_0x2116d9['or'](_0x87cc('0x72'),'%,'+_0x4acdb5+',%');});}if(_0x1cfbe9[_0x87cc('0x40')]['filter']){var _0x490e2e=_0x1cfbe9['query'][_0x87cc('0x86')][_0x87cc('0x87')]('\x5c','\x5c\x5c')[_0x87cc('0x87')](/'/g,'\x27\x27');if(qs[_0x87cc('0x88')](_0x490e2e)){_0xcd4d1['or'](_0x87cc('0x89'),_0x490e2e+'%');}else{_0xcd4d1['or'](_0x87cc('0x8a'),qs['getFullTextValue'](_0x490e2e))['or'](_0x87cc('0x8b'),_0x490e2e+'%');}}}_0x1b74c1[_0x87cc('0x4b')](_0xcd4d1);_0x1b74c1[_0x87cc('0x8c')](_0x87cc('0x8d'));var _0xaaebf4={'type':db['Sequelize'][_0x87cc('0x8e')][_0x87cc('0x8f')],'raw':!![]};var _0x4b6013=_0x1b74c1[_0x87cc('0x90')]();_0x4b6013[_0x87cc('0x4c')](_0x87cc('0x8d'));_0x4b6013[_0x87cc('0x4c')](_0x87cc('0x91'),_0x87cc('0x92'));if(_0x495cba[_0x87cc('0x49')]){_0x495cba[_0x87cc('0x49')][_0x87cc('0x71')](function(_0x4bd0f2){var _0x397f0d=_0x4bd0f2[0x0]===_0x87cc('0x93')?_0x4bd0f2[0x0]:'i.'+_0x4bd0f2[0x0];_0x1b74c1[_0x87cc('0x49')](_0x397f0d,_0x4bd0f2[0x1]===_0x87cc('0x94')?![]:!![]);});}if(!_[_0x87cc('0x7b')](_0x1c4e54)){_0x1b74c1[_0x87cc('0x66')](_0x2116d9);_0x4b6013['where'](_0x87cc('0x95'),_0x1c4e54);}BPromise[_0x87cc('0x96')]()[_0x87cc('0x1e')](function(){if(!_0x39e208){if(_0x1cfbe9[_0x87cc('0x40')]['ChatWebsiteId'])return;_0x4b6013[_0x87cc('0x4b')](_0x87cc('0x97'));_0x1b74c1[_0x87cc('0x4b')](_0x87cc('0x97'));return;}if(_0x1cfbe9[_0x87cc('0x98')][_0x87cc('0x99')]!=='agent')return;return _0x1cfbe9[_0x87cc('0x98')][_0x87cc('0x9a')]({'attributes':['id'],'raw':!![]})[_0x87cc('0x1e')](function(_0x3e2706){if(_['isEmpty'](_0x3e2706)){_0x4b6013[_0x87cc('0x4b')](_0x87cc('0x9b'));_0x1b74c1[_0x87cc('0x4b')](_0x87cc('0x9b'));}else{_0x4b6013['where'](_0x87cc('0x9c'),_[_0x87cc('0x35')](_0x3e2706,'id'));_0x1b74c1[_0x87cc('0x4b')](_0x87cc('0x9c'),_['map'](_0x3e2706,'id'));}});})[_0x87cc('0x1e')](function(){if(_0x1cfbe9[_0x87cc('0x98')]['role']===_0x87cc('0x9d')&&!_0x39e208&&!_0x1cfbe9[_0x87cc('0x40')]['ChatWebsiteId'])return[];return db['sequelize'][_0x87cc('0x40')](_0x4b6013[_0x87cc('0x9e')](),_0xaaebf4);})[_0x87cc('0x1e')](function(_0x45cab6){_0x196de1['count']=_0x45cab6[_0x87cc('0x46')];if(_0x196de1[_0x87cc('0x9f')]===0x0)return[];return db[_0x87cc('0xa0')][_0x87cc('0x40')](_0x5a0f1d[_0x87cc('0x9e')](),_0xaaebf4)[_0x87cc('0x1e')](function(_0x68eb78){_0x571f26=_[_0x87cc('0xa1')](_0x68eb78,'id');_0xaaebf4=_[_0x87cc('0xa2')](_0xaaebf4,{'model':db[_0x87cc('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cfbe9[_0x87cc('0x40')]['fields']){_0x495cba[_0x87cc('0x45')][_0x87cc('0x71')](function(_0x2ba8d4){_0x1b74c1[_0x87cc('0x4c')]('i.'+_0x2ba8d4);});}else{_0x1b74c1['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x87cc('0x92'));_0x1b74c1['field'](_0x87cc('0xa3'),_0x87cc('0xa4'));_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xa5'),_0x87cc('0xa6'));_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xa7'),_0x87cc('0x93'));_0x1b74c1['field']('i.*');_0x1b74c1['field'](_0x87cc('0xa8'),_0x87cc('0xa9'));_0x1b74c1[_0x87cc('0x4c')]('c.lastName','Contact.lastName');_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xaa'),_0x87cc('0xab'));_0x1b74c1['field'](_0x87cc('0xac'),_0x87cc('0xad'));_0x1b74c1['field']('c.mobile',_0x87cc('0xae'));_0x1b74c1[_0x87cc('0x4c')]('c.fax',_0x87cc('0xaf'));_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xb0'),_0x87cc('0xb1'));_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xb2'),'Owner.internal');_0x1b74c1[_0x87cc('0x4c')](_0x87cc('0xb3'),'TagIds');}if(_0x495cba[_0x87cc('0x48')])_0x1b74c1[_0x87cc('0x48')](_0x495cba['limit']);if(_0x495cba['offset'])_0x1b74c1['offset'](_0x495cba[_0x87cc('0x2d')]);return db[_0x87cc('0xa0')][_0x87cc('0x40')](_0x1b74c1[_0x87cc('0x9e')](),_0xaaebf4);})['then'](function(_0x39738b){_0x55203b[_0x87cc('0x4b')](_0x87cc('0xb4'),_['map'](_0x39738b,'id'));return db[_0x87cc('0xa0')][_0x87cc('0x40')](_0x55203b[_0x87cc('0x9e')](),_0xaaebf4)[_0x87cc('0x1e')](function(_0x25b07f){var _0x5eb704=_[_0x87cc('0xb5')](_0x25b07f,'ChatInteractionId');var _0x182f58=[];_0x39738b[_0x87cc('0x71')](function(_0x283395){_0x182f58['push'](updateChatInteraction(_0x283395,_0x571f26,_0x5eb704));});return BPromise['all'](_0x182f58);});});})[_0x87cc('0x1e')](function(_0x5285eb){_0x196de1['rows']=_0x5285eb;return _0x196de1;})['then'](respondWithFilteredResult(_0x461460,_0x495cba))[_0x87cc('0x28')](handleError(_0x461460,null));};exports['show']=function(_0x452e75,_0x10986f){var _0x54bdcb={'raw':![],'where':{'id':_0x452e75[_0x87cc('0xb6')]['id']}},_0xeb73a9={};_0xeb73a9[_0x87cc('0x3f')]=_[_0x87cc('0x41')](db[_0x87cc('0x3b')][_0x87cc('0xb7')]);_0xeb73a9['query']=_[_0x87cc('0x41')](_0x452e75['query']);_0xeb73a9[_0x87cc('0x42')]=_[_0x87cc('0x43')](_0xeb73a9[_0x87cc('0x3f')],_0xeb73a9[_0x87cc('0x40')]);_0x54bdcb[_0x87cc('0x45')]=_[_0x87cc('0x43')](_0xeb73a9[_0x87cc('0x3f')],qs[_0x87cc('0x44')](_0x452e75[_0x87cc('0x40')][_0x87cc('0x44')]));_0x54bdcb[_0x87cc('0x45')]=_0x54bdcb[_0x87cc('0x45')][_0x87cc('0x46')]?_0x54bdcb['attributes']:_0xeb73a9[_0x87cc('0x3f')];if(_0x452e75[_0x87cc('0x40')][_0x87cc('0xb8')]){_0x54bdcb[_0x87cc('0xb9')]=[{'all':!![]}];}_0x54bdcb=_[_0x87cc('0xa2')]({},_0x54bdcb,_0x452e75[_0x87cc('0xba')]);return db[_0x87cc('0x3b')]['find'](_0x54bdcb)[_0x87cc('0x1e')](handleEntityNotFound(_0x10986f,null))[_0x87cc('0x1e')](respondWithResult(_0x10986f,null))[_0x87cc('0x28')](handleError(_0x10986f,null));};exports[_0x87cc('0xbb')]=function(_0x37994e,_0x2a704c){return db[_0x87cc('0x3b')][_0x87cc('0xbb')](_0x37994e[_0x87cc('0x78')],{})['then'](respondWithResult(_0x2a704c,0xc9))['catch'](handleError(_0x2a704c,null));};exports[_0x87cc('0xbc')]=function(_0x5878fc,_0x5ba9c4){if(_0x5878fc[_0x87cc('0x78')]['id']){delete _0x5878fc[_0x87cc('0x78')]['id'];}return db[_0x87cc('0x3b')][_0x87cc('0x64')]({'where':{'id':_0x5878fc[_0x87cc('0xb6')]['id']}})[_0x87cc('0x1e')](handleEntityNotFound(_0x5ba9c4,null))[_0x87cc('0x1e')](saveUpdates(_0x5878fc['body'],null))[_0x87cc('0x1e')](respondWithResult(_0x5ba9c4,null))['catch'](handleError(_0x5ba9c4,null));};exports[_0x87cc('0x31')]=function(_0x5615c2,_0x7f4f73){return db[_0x87cc('0x3b')]['find']({'where':{'id':_0x5615c2[_0x87cc('0xb6')]['id']}})[_0x87cc('0x1e')](handleEntityNotFound(_0x7f4f73,null))['then'](removeEntity(_0x7f4f73,null))[_0x87cc('0x28')](handleError(_0x7f4f73,null));};exports['describe']=function(_0x5580b5,_0x42ede4){return db[_0x87cc('0x3b')][_0x87cc('0xbd')]()[_0x87cc('0x1e')](respondWithResult(_0x42ede4,null))[_0x87cc('0x28')](handleError(_0x42ede4,null));};exports[_0x87cc('0xbe')]=function(_0x14b220,_0x395af8){var _0x2ed990=_0x14b220['params']['id'];var _0x2f0301;var _0x308035;var _0x3ad617;return db[_0x87cc('0x3b')][_0x87cc('0xbf')]({'where':{'id':_0x2ed990}})['then'](function(_0x18c5d4){_0x2f0301=_0x18c5d4;return db[_0x87cc('0xc0')][_0x87cc('0xbf')]({'where':{'id':_0x18c5d4[_0x87cc('0x7c')]},'attributes':['id',_0x87cc('0xc1'),'vidaooEscalation'],'raw':!![]});})[_0x87cc('0x1e')](function(_0x477017){if(_0x477017&&_0x477017[_0x87cc('0xc1')]&&_0x477017[_0x87cc('0xc2')]){_0x308035=_0x477017;var _0x7bfaa7={'rejectUnauthorized':![],'method':'POST','uri':_0x87cc('0xc3'),'headers':{'X-APIKEY':_0x477017['vidaooApiKey']},'body':{'name':'MotionCWB:'+_0x2ed990},'redirect':'follow','json':!![]};return rp(_0x7bfaa7);}else{throw new db[(_0x87cc('0xc4'))][(_0x87cc('0xc5'))](_0x87cc('0xc6'));}})[_0x87cc('0x1e')](function(_0x3254ab){_0x3ad617=_0x3254ab;if(_0x3ad617['id']){var _0x35dc34={'body':_0x3ad617[_0x87cc('0xc7')],'ChatWebsiteId':_0x308035['id'],'ChatInteractionId':_0x2f0301['id'],'direction':_0x87cc('0xc8'),'UserId':_0x14b220[_0x87cc('0x98')]['id']};return db[_0x87cc('0xc9')][_0x87cc('0xbb')](_0x35dc34,{});}else{throw new db[(_0x87cc('0xc4'))][(_0x87cc('0xc5'))](_0x87cc('0xca'));}})[_0x87cc('0x1e')](function(){return _0x2f0301[_0x87cc('0xcb')]({'vidaooSessionId':_0x3ad617['id']});})[_0x87cc('0x1e')](respondWithResult(_0x395af8,null))[_0x87cc('0x28')](handleError(_0x395af8,null));};exports[_0x87cc('0xcc')]=function(_0xfd622a,_0x3791bd){if(_0xfd622a[_0x87cc('0x78')]['id']){delete _0xfd622a[_0x87cc('0x78')]['id'];}return db[_0x87cc('0x3b')][_0x87cc('0x64')]({'where':{'id':_0xfd622a[_0x87cc('0xb6')]['id']},'include':[{'model':db[_0x87cc('0xcd')],'as':_0x87cc('0xce')}]})[_0x87cc('0x1e')](handleEntityNotFound(_0x3791bd,null))['then'](saveUpdates(_0xfd622a[_0x87cc('0x78')],null))['then'](respondWithResult(_0x3791bd,null))[_0x87cc('0x28')](handleError(_0x3791bd,null));};exports[_0x87cc('0xcf')]=function(_0x1c8938,_0x3d42be,_0x1e9af){if(_0x1c8938['body']['id']){delete _0x1c8938[_0x87cc('0x78')]['id'];}return db[_0x87cc('0x3b')][_0x87cc('0x64')]({'where':{'id':_0x1c8938['params']['id']}})[_0x87cc('0x1e')](function(_0xd52143){if(!_0xd52143){logger['error'](_0x87cc('0xd0'),_0x87cc('0xcf'),0x194,_0x87cc('0xd1'));_0x3d42be[_0x87cc('0x29')](0x194);}else{if(_0xd52143['UserId']){throw new db[(_0x87cc('0xc4'))][(_0x87cc('0xc5'))](_0x87cc('0xd2'));}}return _0xd52143;})[_0x87cc('0x1e')](function(_0x39a0a6){if(_0x39a0a6){return _0x39a0a6[_0x87cc('0xbc')]({'closed':_0x1c8938[_0x87cc('0x78')][_0x87cc('0xd3')],'disposition':_0x1c8938[_0x87cc('0x78')][_0x87cc('0xd4')]})[_0x87cc('0x1e')](function(_0x4bbbf1){return _0x4bbbf1;});}})['then'](function(_0x952803){return respondWithRpcPromise('AbandonInteraction','abandon',_0x1c8938['body'],client9004);})[_0x87cc('0x1e')](respondWithResult(_0x3d42be,null))[_0x87cc('0x28')](handleError(_0x3d42be,null));};exports[_0x87cc('0xd5')]=function(_0x3d0aa8,_0x167f7b,_0x51ae6c){_0x3d0aa8[_0x87cc('0x78')][_0x87cc('0x32')]=_0x3d0aa8[_0x87cc('0xd6')][_0x87cc('0xd7')];_0x3d0aa8[_0x87cc('0x78')][_0x87cc('0xd8')]=_0x3d0aa8[_0x87cc('0xd6')][_0x87cc('0xd9')];_0x3d0aa8[_0x87cc('0x78')][_0x87cc('0x3d')]=_0x3d0aa8[_0x87cc('0xd6')]['mimetype'];return db['Attachment'][_0x87cc('0xbb')](_0x3d0aa8[_0x87cc('0x78')])[_0x87cc('0x1e')](respondWithResult(_0x167f7b,0xc9))['catch'](handleError(_0x167f7b,null));};exports[_0x87cc('0xda')]=function(_0x35a943,_0x240a44,_0x4ace87){return db[_0x87cc('0x3b')][_0x87cc('0xbf')]({'where':{'id':_0x35a943[_0x87cc('0xb6')]['id']},'raw':!![]})[_0x87cc('0x1e')](handleEntityNotFound(_0x240a44,null))[_0x87cc('0x1e')](function(_0x215633){if(_0x215633){if(_0x215633[_0x87cc('0xd3')]){return _0x240a44[_0x87cc('0x2a')](0x193)[_0x87cc('0x2c')]({'status':0x193,'message':_0x87cc('0xdb')});}return db[_0x87cc('0xdc')]['findOne']({'where':{'id':_0x35a943[_0x87cc('0x40')]['attachId']},'raw':!![]})[_0x87cc('0x1e')](handleEntityNotFound(_0x240a44,null));}})[_0x87cc('0x1e')](function(_0x41060f){if(_0x41060f){return _0x240a44[_0x87cc('0xdd')](path[_0x87cc('0xde')](config[_0x87cc('0xdf')],_0x87cc('0xe0'),_0x41060f[_0x87cc('0xd8')]));}})[_0x87cc('0x28')](handleError(_0x240a44,null));};exports['close']=function(_0x32edd1,_0x2fb3b6){var _0x5f408d=null;var _0x434e1c=null;var _0x4a3809=null;var _0x564496=null;if(_0x32edd1['body']['id']){delete _0x32edd1[_0x87cc('0x78')]['id'];}if(_0x32edd1[_0x87cc('0x78')]['mailTranscript']){_0x564496=path[_0x87cc('0xde')](config['root'],_0x87cc('0xe1'),util[_0x87cc('0xe2')](_0x87cc('0xe3'),Date[_0x87cc('0xe4')]()));_0x32edd1[_0x87cc('0x78')][_0x87cc('0xe5')]=_0x564496;}return db[_0x87cc('0x3b')]['find']({'where':{'id':_0x32edd1[_0x87cc('0xb6')]['id']},'include':[{'model':db[_0x87cc('0xc9')],'as':_0x87cc('0xe6'),'include':[{'model':db[_0x87cc('0xe7')],'as':_0x87cc('0xe7')}]}]})[_0x87cc('0x1e')](handleEntityNotFound(_0x2fb3b6,null))[_0x87cc('0x1e')](saveUpdates(_0x32edd1['body'],null))[_0x87cc('0x1e')](function(_0x2200cc){if(_0x2200cc){_0x5f408d=_0x2200cc;return db[_0x87cc('0xc0')][_0x87cc('0x64')]({'where':{'id':_0x5f408d['ChatWebsiteId']}});}})['then'](function(_0x52132a){if(_0x52132a){_0x4a3809=_0x52132a;return db[_0x87cc('0xcd')][_0x87cc('0x64')]({'where':{'id':_0x5f408d[_0x87cc('0x6c')]}});}})['then'](function(_0x2bf1c5){if(_0x2bf1c5){_0x434e1c=_0x2bf1c5;if(_0x564496){var _0x123188=null;for(var _0x5120e9=0x1;_0x5120e9<_0x5f408d[_0x87cc('0xe6')][_0x87cc('0x46')];++_0x5120e9){_0x123188=_0x5f408d[_0x87cc('0xe6')][_0x5120e9];var _0x2f6345=_0x123188['UserId']?util[_0x87cc('0xe2')](_0x87cc('0xe8'),_0x4a3809['agentAlias'],_0x123188[_0x87cc('0x77')]):_0x87cc('0xe9');var _0x585a09=_0x32edd1[_0x87cc('0x78')][_0x87cc('0xea')]||util[_0x87cc('0xe2')](_0x87cc('0xe8'),'Visitor',_0x123188[_0x87cc('0x6c')]);switch(_0x4a3809['agentIdentifier']){case'website_alias':_0x2f6345=_0x123188[_0x87cc('0x77')]?util[_0x87cc('0xe2')](_0x87cc('0xe8'),_0x4a3809[_0x87cc('0xeb')],_0x123188[_0x87cc('0x77')]):'System';break;case'agent_alias':_0x2f6345=_0x123188['UserId']?_0x123188[_0x87cc('0xe7')][_0x87cc('0xec')]||_0x123188[_0x87cc('0xe7')][_0x87cc('0x36')]:_0x87cc('0xe9');break;case _0x87cc('0xed'):_0x2f6345=_0x123188[_0x87cc('0x77')]?_0x123188[_0x87cc('0xe7')]['fullname']:_0x87cc('0xe9');break;default:_0x2f6345=_0x123188['UserId']?util[_0x87cc('0xe2')]('%s%d',_0x4a3809[_0x87cc('0xeb')],_0x123188['UserId']):'System';}var _0x37f820=util[_0x87cc('0xe2')](_0x87cc('0xee'),moment(_0x123188[_0x87cc('0xef')])[_0x87cc('0xe2')](_0x87cc('0xf0')),_0x123188[_0x87cc('0xf1')]==='in'?_0x585a09:_0x2f6345,_0x123188[_0x87cc('0x78')]);if(!_0x123188[_0x87cc('0xf2')]){fs['appendFileSync'](_0x564496,_0x37f820);}}return db['MailAccount'][_0x87cc('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0x87cc('0xf3')],'as':_0x87cc('0xf4'),'raw':!![]}]});}}})['then'](function(_0x440cc0){if(_0x440cc0&&_0x440cc0[_0x87cc('0xf4')]&&_0x32edd1[_0x87cc('0x78')]){var _0x4680aa={'tls':{'rejectUnauthorized':![]}};if(_0x440cc0[_0x87cc('0xf4')][_0x87cc('0xf5')]){_0x4680aa['service']=_0x440cc0[_0x87cc('0xf4')]['service'];}else{_0x4680aa['host']=_0x440cc0[_0x87cc('0xf4')][_0x87cc('0xf6')];_0x4680aa[_0x87cc('0xf7')]=_0x440cc0[_0x87cc('0xf4')]['port'];_0x4680aa['secure']=_0x440cc0[_0x87cc('0xf4')][_0x87cc('0xf8')];}if(_0x440cc0[_0x87cc('0xf4')][_0x87cc('0xf9')]){_0x4680aa[_0x87cc('0xfa')]={'user':_0x440cc0[_0x87cc('0xf4')][_0x87cc('0x98')],'pass':_0x440cc0[_0x87cc('0xf4')][_0x87cc('0xfb')]};}return respondWithRpcPromise(_0x87cc('0xfc'),'sendMail',{'account':_0x4680aa,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x440cc0[_0x87cc('0x32')],_0x440cc0[_0x87cc('0xfd')]||_0x440cc0[_0x87cc('0xf4')][_0x87cc('0x98')]),'to':_0x32edd1[_0x87cc('0x78')]['mailTranscript'],'subject':_0x87cc('0xfe'),'text':util[_0x87cc('0xe2')](_0x87cc('0xff'),_0x32edd1[_0x87cc('0x78')][_0x87cc('0x100')]),'attachments':[{'path':_0x564496}]}})[_0x87cc('0x1e')](function(){return _0x5f408d;})[_0x87cc('0x28')](function(_0x4b1003){console['error'](_0x4b1003);});}else{return _0x5f408d;}})['then'](respondWithStatusCode(_0x2fb3b6,0xc8))[_0x87cc('0x28')](handleError(_0x2fb3b6,null));};exports['addMessage']=function(_0x4f28c4,_0xb6cbb3,_0x18baff){return db[_0x87cc('0xc9')]['find']({'where':{'id':_0x4f28c4['params']['id']}})['then'](handleEntityNotFound(_0xb6cbb3,null))['then'](function(_0x57494f){if(_0x57494f){return _0x57494f['addMessage'](_0x4f28c4[_0x87cc('0x78')][_0x87cc('0x101')],_[_0x87cc('0x102')](_0x4f28c4['body'],[_0x87cc('0x101'),'id'])||{});}})[_0x87cc('0x1e')](respondWithResult(_0xb6cbb3,null))[_0x87cc('0x28')](handleError(_0xb6cbb3,null));};exports[_0x87cc('0x103')]=function(_0x3be2d1,_0x5c6245,_0xf97f40){var _0x8e7e6f={'raw':![],'where':{}};var _0x4c2354={};var _0x11a536={'count':0x0,'rows':[]};return db[_0x87cc('0x3b')][_0x87cc('0xbf')]({'where':{'id':_0x3be2d1[_0x87cc('0xb6')]['id']}})[_0x87cc('0x1e')](handleEntityNotFound(_0x5c6245,null))[_0x87cc('0x1e')](function(_0x5ef5a4){if(_0x5ef5a4){_0x4c2354[_0x87cc('0x3f')]=_[_0x87cc('0x41')](db[_0x87cc('0xc9')][_0x87cc('0xb7')]);_0x4c2354[_0x87cc('0x40')]=_['keys'](_0x3be2d1['query']);_0x4c2354['filters']=_['intersection'](_0x4c2354[_0x87cc('0x3f')],_0x4c2354['query']);_0x8e7e6f[_0x87cc('0x45')]=_[_0x87cc('0x43')](_0x4c2354[_0x87cc('0x3f')],qs[_0x87cc('0x44')](_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x44')]));_0x8e7e6f['attributes']=_0x8e7e6f[_0x87cc('0x45')]['length']?_0x8e7e6f['attributes']:_0x4c2354[_0x87cc('0x3f')];if(!_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x104')](_0x87cc('0x47'))){_0x8e7e6f[_0x87cc('0x48')]=qs[_0x87cc('0x48')](_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x48')]);_0x8e7e6f['offset']=qs[_0x87cc('0x2d')](_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x2d')]);}_0x8e7e6f[_0x87cc('0x49')]=qs['sort'](_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x4a')]);_0x8e7e6f[_0x87cc('0x4b')]=qs[_0x87cc('0x42')](_[_0x87cc('0x105')](_0x3be2d1[_0x87cc('0x40')],_0x4c2354[_0x87cc('0x42')]));_0x8e7e6f[_0x87cc('0x4b')][_0x87cc('0x106')]=_0x5ef5a4['id'];if(_0x3be2d1['query'][_0x87cc('0x86')]){_0x8e7e6f[_0x87cc('0x4b')]=_[_0x87cc('0xa2')](_0x8e7e6f[_0x87cc('0x4b')],{'$or':_[_0x87cc('0x35')](_0x8e7e6f['attributes'],function(_0x1c6743){var _0x3eeb07={};_0x3eeb07[_0x1c6743]={'$like':'%'+_0x3be2d1[_0x87cc('0x40')]['filter']+'%'};return _0x3eeb07;})});}if(_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x7e')]){var _0x230c2a=_0x3be2d1[_0x87cc('0x40')][_0x87cc('0x7e')]['split'](',');var _0x5a52f2={};_0x5a52f2[_0x230c2a[0x0]]={'$gte':moment(_0x230c2a[0x1])[_0x87cc('0xe2')](_0x87cc('0x107'))};_0x8e7e6f[_0x87cc('0x4b')]=_[_0x87cc('0xa2')](_0x8e7e6f['where'],_0x5a52f2);}_0x8e7e6f=_['merge']({},_0x8e7e6f,_0x3be2d1[_0x87cc('0xba')]);return db[_0x87cc('0xc9')][_0x87cc('0x9f')]({'where':_0x8e7e6f['where']})['then'](function(_0x93f2e){_0x11a536[_0x87cc('0x9f')]=_0x93f2e;if(_0x3be2d1[_0x87cc('0x40')][_0x87cc('0xb8')]){_0x8e7e6f['include']=[{'all':!![]}];}return db[_0x87cc('0xc9')][_0x87cc('0x108')](_0x8e7e6f);})[_0x87cc('0x1e')](function(_0x3d5700){_0x11a536[_0x87cc('0x109')]=_0x3d5700;return _0x11a536;});}})[_0x87cc('0x1e')](respondWithFilteredResult(_0x5c6245,_0x8e7e6f))['catch'](handleError(_0x5c6245,null));};exports[_0x87cc('0x10a')]=function(_0x29bf61,_0xec9969,_0xceac0c){var _0x795e91={'where':{}},_0x4d2747={},_0x477787={'count':0x0,'rows':[]};return db[_0x87cc('0x3b')]['findOne']({'where':{'id':_0x29bf61['params']['id']}})['then'](handleEntityNotFound(_0xec9969,null))[_0x87cc('0x1e')](function(_0x1cf24b){if(_0x1cf24b){_0x4d2747[_0x87cc('0x3f')]=_[_0x87cc('0x41')](db[_0x87cc('0xc9')][_0x87cc('0xb7')]);_0x4d2747[_0x87cc('0x40')]=_[_0x87cc('0x41')](_0x29bf61['query']);_0x4d2747[_0x87cc('0x42')]=_[_0x87cc('0x43')](_0x4d2747[_0x87cc('0x3f')],_0x4d2747['query']);_0x795e91[_0x87cc('0x45')]=_[_0x87cc('0x43')](_0x4d2747[_0x87cc('0x3f')],qs[_0x87cc('0x44')](_0x29bf61[_0x87cc('0x40')][_0x87cc('0x44')]));_0x795e91['attributes']=_0x795e91[_0x87cc('0x45')]['length']?_0x795e91[_0x87cc('0x45')]:_0x4d2747[_0x87cc('0x3f')];if(!_0x29bf61[_0x87cc('0x40')][_0x87cc('0x104')](_0x87cc('0x47'))){_0x795e91[_0x87cc('0x48')]=qs[_0x87cc('0x48')](_0x29bf61[_0x87cc('0x40')][_0x87cc('0x48')]);_0x795e91['offset']=qs['offset'](_0x29bf61[_0x87cc('0x40')][_0x87cc('0x2d')]);}_0x795e91[_0x87cc('0x49')]=qs[_0x87cc('0x4a')](_0x29bf61[_0x87cc('0x40')]['sort']);_0x795e91['where']=qs[_0x87cc('0x42')](_[_0x87cc('0x105')](_0x29bf61[_0x87cc('0x40')],_0x4d2747['filters']));_0x795e91[_0x87cc('0x4b')][_0x87cc('0x106')]=_0x1cf24b['id'];if(_0x29bf61[_0x87cc('0x40')][_0x87cc('0x86')]){_0x795e91[_0x87cc('0x4b')]=_[_0x87cc('0xa2')](_0x795e91['where'],{'$or':_['map'](_0x795e91[_0x87cc('0x45')],function(_0x1d764d){var _0x1b2192={};_0x1b2192[_0x1d764d]={'$like':'%'+_0x29bf61[_0x87cc('0x40')][_0x87cc('0x86')]+'%'};return _0x1b2192;})});}_0x795e91[_0x87cc('0x4b')][_0x87cc('0xf2')]=![];if(_0x29bf61['query']['id']){_0x795e91['where']['id']={'$gt':_0x29bf61[_0x87cc('0x40')]['id']};}_0x795e91=_[_0x87cc('0xa2')]({},_0x795e91,_0x29bf61[_0x87cc('0xba')]);return db[_0x87cc('0xc9')][_0x87cc('0x9f')]({'where':_0x795e91['where']})[_0x87cc('0x1e')](function(_0x5ac51f){_0x477787[_0x87cc('0x9f')]=_0x5ac51f;_0x795e91['include']=[];if(_0x29bf61[_0x87cc('0x40')][_0x87cc('0x10b')]){_0x795e91[_0x87cc('0xb9')]['push']({'model':db[_0x87cc('0xe7')],'as':_0x87cc('0xe7'),'attributes':['id',_0x87cc('0x36'),_0x87cc('0xec')]});}if(_0x29bf61[_0x87cc('0x40')][_0x87cc('0xb8')]){_0x795e91['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x795e91);})[_0x87cc('0x1e')](function(_0x29edd2){_0x477787['rows']=_0x29edd2;return _0x477787;});}})[_0x87cc('0x1e')](respondWithFilteredResult(_0xec9969,_0x795e91))[_0x87cc('0x28')](handleError(_0xec9969,null));};exports['addTags']=function(_0x47fa4c,_0x52bff1,_0x5e605a){return db[_0x87cc('0x3b')]['find']({'where':{'id':_0x47fa4c[_0x87cc('0xb6')]['id']}})['then'](handleEntityNotFound(_0x52bff1,null))[_0x87cc('0x1e')](function(_0xdd5e11){if(_0xdd5e11){return _0xdd5e11[_0x87cc('0x10c')](_0x47fa4c[_0x87cc('0x78')][_0x87cc('0x101')],_[_0x87cc('0x102')](_0x47fa4c[_0x87cc('0x78')],[_0x87cc('0x101'),'id'])||{})['spread'](function(){return db[_0x87cc('0x70')][_0x87cc('0x108')]({'attributes':['id','name',_0x87cc('0x10d')],'where':{'id':_0x47fa4c['body'][_0x87cc('0x101')]}});})[_0x87cc('0x1e')](function(_0x57435a){socket['emit'](_0x87cc('0x10e'),{'id':Number(_0x47fa4c[_0x87cc('0xb6')]['id']),'tags':_0x57435a||[]});return{'id':Number(_0x47fa4c['params']['id']),'tags':_0x57435a||[]};});}})[_0x87cc('0x1e')](respondWithResult(_0x52bff1,null))[_0x87cc('0x28')](handleError(_0x52bff1,null));};exports['removeTags']=function(_0x12606,_0x229eb2,_0x22ad4d){return db['ChatInteraction'][_0x87cc('0x64')]({'where':{'id':_0x12606[_0x87cc('0xb6')]['id']}})['then'](handleEntityNotFound(_0x229eb2,null))['then'](function(_0xa89c21){if(_0xa89c21){return _0xa89c21[_0x87cc('0x10f')](_0x12606[_0x87cc('0x40')][_0x87cc('0x101')]);}})[_0x87cc('0x1e')](respondWithStatusCode(_0x229eb2,null))[_0x87cc('0x28')](handleError(_0x229eb2,null));};exports['download']=function(_0x4765b4,_0x4b563a){var _0x515bef=moment()[_0x87cc('0x110')]()[_0x87cc('0x9e')]();var _0x4fc6a5=path[_0x87cc('0xde')](config[_0x87cc('0xdf')],_0x87cc('0x111'),_0x87cc('0x112'),_0x87cc('0x113'));var _0x52e394=path['join'](config['root'],'server','files',_0x87cc('0x114'));var _0x791eee=path[_0x87cc('0xde')](_0x4fc6a5,_0x515bef);var _0x4120fb=util[_0x87cc('0xe2')]('transcript-%d-%s.zip',_0x4765b4[_0x87cc('0xb6')]['id'],_0x515bef);var _0x2b9d40=path[_0x87cc('0xde')](_0x4fc6a5,_0x4120fb);var _0x32690e=[];_0x32690e[_0x87cc('0x39')]({'model':db['User'],'as':_0x87cc('0xe7'),'attributes':['id',_0x87cc('0x36')],'raw':!![]});_0x32690e[_0x87cc('0x39')]({'model':db[_0x87cc('0xcd')],'as':_0x87cc('0xce'),'attributes':['id',_0x87cc('0x115'),_0x87cc('0x116')],'raw':!![]});if(_0x4765b4[_0x87cc('0x40')][_0x87cc('0x114')]){_0x32690e[_0x87cc('0x39')]({'model':db['Attachment'],'as':_0x87cc('0xdc'),'raw':!![]});}var _0x4e26f5=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id','body',_0x87cc('0xef'),_0x87cc('0xf1'),_0x87cc('0xf2'),_0x87cc('0x83')],'include':_0x32690e}];_0x4e26f5[_0x87cc('0x39')]({'model':db[_0x87cc('0xc0')],'as':_0x87cc('0x117'),'attributes':['id','name']});_0x4e26f5[_0x87cc('0x39')]({'model':db['User'],'as':_0x87cc('0x118'),'attributes':['id','fullname']});return db[_0x87cc('0x3b')]['find']({'where':{'id':_0x4765b4[_0x87cc('0xb6')]['id']},'include':_0x4e26f5})['then'](handleEntityNotFound(_0x4b563a,null))[_0x87cc('0x1e')](function(_0x57ab45){if(_0x57ab45){var _0x2d1da9=_0x57ab45[_0x87cc('0x119')]({'plain':!![]});fs[_0x87cc('0x11a')](_0x791eee);var _0x34ffee={'format':'A4','border':_0x87cc('0x11b'),'header':{'height':_0x87cc('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':_0x87cc('0x11d'),'contents':{'default':util[_0x87cc('0xe2')]('\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[_0x87cc('0xe2')](_0x87cc('0x11e'),'Chat',_0x2d1da9['id']),moment()[_0x87cc('0xe2')]('YYYY-MM-DD')[_0x87cc('0x9e')]())}}};var _0x1c1d26={'channel':_0x87cc('0x11f'),'account':_0x2d1da9[_0x87cc('0x117')][_0x87cc('0x32')],'agent':_0x2d1da9[_0x87cc('0x118')]?_0x2d1da9[_0x87cc('0x118')]['fullname']:_0x87cc('0x120'),'createdAt':moment(_0x2d1da9[_0x87cc('0xef')])[_0x87cc('0xe2')](_0x87cc('0x107'))['toString'](),'closedAt':_0x2d1da9[_0x87cc('0xd3')]?moment(_0x2d1da9[_0x87cc('0x121')])[_0x87cc('0xe2')](_0x87cc('0x107'))[_0x87cc('0x9e')]():'','disposition':_0x2d1da9['disposition'],'chatInfo':{'browser':_0x2d1da9[_0x87cc('0x122')],'os':_0x2d1da9[_0x87cc('0x123')],'referer':_0x2d1da9[_0x87cc('0x124')],'customerIp':_0x2d1da9[_0x87cc('0x125')],'customerPort':_0x2d1da9['customerPort']?_0x2d1da9[_0x87cc('0x126')]:_0x87cc('0x120')},'messages':_(_0x2d1da9[_0x87cc('0xe6')])[_0x87cc('0x127')]()[_0x87cc('0x86')]({'secret':![]})[_0x87cc('0x35')](function(_0x51c72f){if(_0x51c72f[_0x87cc('0xdc')]){var _0x4766b3=path[_0x87cc('0xde')](_0x52e394,_0x51c72f[_0x87cc('0xdc')]['basename']);if(fs[_0x87cc('0x128')](_0x4766b3)){fs[_0x87cc('0x129')](_0x4766b3)['pipe'](fs[_0x87cc('0x12a')](path[_0x87cc('0xde')](_0x791eee,_0x51c72f[_0x87cc('0xdc')][_0x87cc('0xd8')])));}}return{'date':moment(_0x51c72f['createdAt'])[_0x87cc('0xe2')](_0x87cc('0x107'))['toString'](),'sender':_0x51c72f[_0x87cc('0xf1')]===_0x87cc('0xc8')?_0x51c72f['User']?_0x51c72f[_0x87cc('0xe7')][_0x87cc('0x36')]:_0x87cc('0xe9'):_0x51c72f[_0x87cc('0xce')]['firstName']+(_0x51c72f[_0x87cc('0xce')][_0x87cc('0x116')]?'\x20'+_0x51c72f[_0x87cc('0xce')]['lastName']:''),'body':_0x51c72f[_0x87cc('0xdc')]?_0x51c72f['Attachment']['basename']:_0x51c72f[_0x87cc('0x78')],'direction':_0x51c72f[_0x87cc('0xf1')]==='out'?'A':'C','secret':_0x51c72f[_0x87cc('0xf2')],'read':_0x51c72f['read'],'attachment':_0x51c72f[_0x87cc('0xdc')]};})[_0x87cc('0x65')]()};return ejs[_0x87cc('0x12b')](path[_0x87cc('0xde')](config[_0x87cc('0xdf')],_0x87cc('0x111'),_0x87cc('0x12c'),'downloadInteraction.html'),{'interaction':_0x1c1d26})['then'](function(_0x58dab2){return new BPromise(function(_0x1081ca,_0x5e1fe1){pdf['create'](_0x58dab2,_0x34ffee)[_0x87cc('0x12d')](path[_0x87cc('0xde')](_0x791eee,_0x87cc('0x12e')+_0x2d1da9['id']+'-'+_0x515bef+'.pdf'),function(_0x3b04bd,_0x2ab7b6){if(_0x3b04bd)return _0x5e1fe1(_0x3b04bd);_0x1081ca(_0x2ab7b6);});});})[_0x87cc('0x1e')](function(){return new BPromise(function(_0x4b8e42,_0x191cf8){zipdir(_0x791eee,{'saveTo':_0x2b9d40},function(_0x3022a3,_0x13b246){if(_0x3022a3)return _0x191cf8(_0x3022a3);return _0x4b8e42(_0x13b246);});})[_0x87cc('0x1e')](function(){return new BPromise(function(_0x53e1cb,_0x27c4fb){rimraf(_0x791eee,function(_0x330784){if(_0x330784)_0x27c4fb(_0x330784);return _0x53e1cb();});});})['then'](function(){return _0x4b563a[_0x87cc('0xdd')](_0x2b9d40,_0x4120fb,function(_0x38f3f2){if(_0x38f3f2){console[_0x87cc('0x12f')](_0x87cc('0x130'),_0x38f3f2);}else{fs[_0x87cc('0x131')](_0x2b9d40);}});});});}else{return _0x4b563a['sendStatus'](0xc8);}})[_0x87cc('0x28')](handleError(_0x4b563a,null));}; \ No newline at end of file +var _0x6038=['moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','set','apply','reject','update','end','name','send','Users','map','Tags','TagIds','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','select','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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','text','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','agent','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','Sequelize','ValidationError','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','disposition','AbandonInteraction','attachmentUpload','originalname','file','filename','mimetype','Unauthorized','Attachment','attachId','download','join','server/files/attachments/','basename','close','root','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','ChatWebsite','CmContact','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','hasOwnProperty','alias','addTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','out','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x6038,0x13f));var _0x8603=function(_0x5f5727,_0x381b0b){_0x5f5727=_0x5f5727-0x0;var _0x3cd7a5=_0x6038[_0x5f5727];return _0x3cd7a5;};'use strict';var pdf=require(_0x8603('0x0'));var emlformat=require(_0x8603('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8603('0x2'));var jsonpatch=require(_0x8603('0x3'));var rp=require(_0x8603('0x4'));var moment=require(_0x8603('0x5'));var BPromise=require(_0x8603('0x6'));var Mustache=require(_0x8603('0x7'));var util=require(_0x8603('0x8'));var path=require('path');var sox=require(_0x8603('0x9'));var csv=require(_0x8603('0xa'));var ejs=require(_0x8603('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8603('0xc'));var crypto=require(_0x8603('0xd'));var jsforce=require(_0x8603('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8603('0xa'));var querystring=require(_0x8603('0xf'));var Papa=require(_0x8603('0x10'));var Redis=require(_0x8603('0x11'));var authService=require(_0x8603('0x12'));var qs=require(_0x8603('0x13'));var as=require(_0x8603('0x14'));var hardwareService=require(_0x8603('0x15'));var logger=require(_0x8603('0x16'))(_0x8603('0x17'));var utils=require(_0x8603('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8603('0x19'));var db=require('../../mysqldb')['db'];config[_0x8603('0x1a')]=_[_0x8603('0x1b')](config[_0x8603('0x1a')],{'host':_0x8603('0x1c'),'port':0x18eb});var socket=require(_0x8603('0x1d'))(new Redis(config['redis']));require(_0x8603('0x1e'))['register'](socket);var jayson=require(_0x8603('0x1f'));var client=jayson[_0x8603('0x20')][_0x8603('0x21')]({'port':0x232b});var client9004=jayson['client'][_0x8603('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x2231a6,_0x5b7757,_0x135401,_0x68b685){return new BPromise(function(_0x7354fc,_0xecfdae){var _0x525d8e=_0x68b685||client;return _0x525d8e[_0x8603('0x22')](_0x2231a6,_0x135401)[_0x8603('0x23')](function(_0x3dfc15){logger[_0x8603('0x24')](_0x8603('0x25'),_0x5b7757,_0x8603('0x26'));logger[_0x8603('0x27')](_0x8603('0x28'),_0x5b7757,_0x8603('0x26'),JSON['stringify'](_0x3dfc15));if(_0x3dfc15[_0x8603('0x29')]){if(_0x3dfc15[_0x8603('0x29')][_0x8603('0x2a')]===0x1f4){logger[_0x8603('0x29')](_0x8603('0x25'),_0x5b7757,_0x3dfc15[_0x8603('0x29')][_0x8603('0x2b')]);return _0xecfdae(_0x3dfc15[_0x8603('0x29')][_0x8603('0x2b')]);}logger[_0x8603('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x5b7757,_0x3dfc15[_0x8603('0x29')][_0x8603('0x2b')]);return _0x7354fc(_0x3dfc15[_0x8603('0x29')][_0x8603('0x2b')]);}else{logger[_0x8603('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x5b7757,_0x8603('0x26'));_0x7354fc(_0x3dfc15[_0x8603('0x2c')]['message']);}})[_0x8603('0x2d')](function(_0x6d0dae){logger[_0x8603('0x29')](_0x8603('0x25'),_0x5b7757,_0x6d0dae);_0xecfdae(_0x6d0dae);});});}function respondWithStatusCode(_0x17c70d,_0x3d3111){_0x3d3111=_0x3d3111||0xcc;return function(_0x2d64af){if(_0x2d64af){return _0x17c70d[_0x8603('0x2e')](_0x3d3111);}return _0x17c70d['status'](_0x3d3111)['end']();};}function respondWithResult(_0x36ccbc,_0x203c68){_0x203c68=_0x203c68||0xc8;return function(_0xbe5f72){if(_0xbe5f72){return _0x36ccbc[_0x8603('0x2f')](_0x203c68)[_0x8603('0x30')](_0xbe5f72);}};}function respondWithFilteredResult(_0x1354dc,_0x3ada1d){return function(_0x45aa2b){if(_0x45aa2b){var _0x55de48=_0x45aa2b[_0x8603('0x31')],_0x1649c0=_0x3ada1d[_0x8603('0x32')],_0x4082f8=_0x3ada1d[_0x8603('0x32')]+_0x3ada1d['limit'],_0x2ca456;if(_0x4082f8>=_0x55de48){_0x4082f8=_0x55de48;_0x2ca456=0xc8;}else{_0x2ca456=0xce;}_0x1354dc[_0x8603('0x2f')](_0x2ca456);return _0x1354dc[_0x8603('0x33')]('Content-Range',_0x1649c0+'-'+_0x4082f8+'/'+_0x55de48)[_0x8603('0x30')](_0x45aa2b);}return null;};}function patchUpdates(_0x2c0bc9){return function(_0x24ce2a){try{jsonpatch[_0x8603('0x34')](_0x24ce2a,_0x2c0bc9,!![]);}catch(_0x488842){return BPromise[_0x8603('0x35')](_0x488842);}return _0x24ce2a['save']();};}function saveUpdates(_0x5f20e4,_0xbc7d9e){return function(_0x50a3bd){if(_0x50a3bd){return _0x50a3bd[_0x8603('0x36')](_0x5f20e4)['then'](function(_0x3ee14f){return _0x3ee14f;});}return null;};}function removeEntity(_0x380cdb,_0x3f787c){return function(_0x47c1f0){if(_0x47c1f0){return _0x47c1f0['destroy']()[_0x8603('0x23')](function(){_0x380cdb['status'](0xcc)[_0x8603('0x37')]();});}};}function handleEntityNotFound(_0x20382a,_0x2452a3){return function(_0x5395e6){if(!_0x5395e6){_0x20382a[_0x8603('0x2e')](0x194);}return _0x5395e6;};}function handleError(_0xcfc5fe,_0x32db61){_0x32db61=_0x32db61||0x1f4;return function(_0x1320d9){logger[_0x8603('0x29')](_0x1320d9['stack']);if(_0x1320d9[_0x8603('0x38')]){delete _0x1320d9[_0x8603('0x38')];}_0xcfc5fe[_0x8603('0x2f')](_0x32db61)[_0x8603('0x39')](_0x1320d9);};}function getInteractionUsers(_0x780d45,_0xbbe0af){return new BPromise(function(_0x4d64d2,_0x11955b){try{if(_0xbbe0af[_0x780d45['id']]){_0x780d45[_0x8603('0x3a')]=_[_0x8603('0x3b')](_0xbbe0af[_0x780d45['id']],function(_0x1f2892){return{'id':_0x1f2892['id'],'fullname':_0x1f2892['fullname']};});}}catch(_0x592005){_0x11955b(_0x592005);}_0x4d64d2(_0x780d45);});}function getInteractionTags(_0x39512a,_0x4e39db){return new BPromise(function(_0x4d25e0,_0xafd000){try{if(_0x39512a['TagIds']){_0x39512a[_0x8603('0x3c')]=[];_0x39512a[_0x8603('0x3d')][_0x8603('0x3e')](',')[_0x8603('0x3f')](function(_0x85da3){_0x39512a['Tags'][_0x8603('0x40')](_0x4e39db[_0x85da3]);});}delete _0x39512a[_0x8603('0x3d')];}catch(_0x24de92){_0xafd000(_0x24de92);}_0x4d25e0(_0x39512a);});}function updateChatInteraction(_0x1c20c1,_0x2a5e04,_0xe7e39){return new BPromise(function(_0x5c7813,_0xecb749){return getInteractionUsers(_0x1c20c1,_0xe7e39)[_0x8603('0x23')](function(_0x5f2563){return getInteractionTags(_0x5f2563,_0x2a5e04);})[_0x8603('0x23')](function(_0x49301c){_0x5c7813(_0x49301c);})[_0x8603('0x2d')](function(_0x1ddccd){_0xecb749(_0x1ddccd);});});}exports[_0x8603('0x41')]=function(_0x4b3bdc,_0x52b6a5){var _0x23ca7d={},_0x1a97aa={},_0x302b8a={'count':0x0,'rows':[]};var _0x42de98=_[_0x8603('0x3b')](db[_0x8603('0x42')][_0x8603('0x43')],function(_0xef559d){return{'name':_0xef559d[_0x8603('0x44')],'type':_0xef559d[_0x8603('0x45')][_0x8603('0x46')]};});_0x1a97aa[_0x8603('0x47')]=_[_0x8603('0x3b')](_0x42de98,_0x8603('0x38'));_0x1a97aa[_0x8603('0x48')]=_[_0x8603('0x49')](_0x4b3bdc[_0x8603('0x48')]);_0x1a97aa[_0x8603('0x4a')]=_[_0x8603('0x4b')](_0x1a97aa[_0x8603('0x47')],_0x1a97aa[_0x8603('0x48')]);_0x23ca7d[_0x8603('0x4c')]=_['intersection'](_0x1a97aa[_0x8603('0x47')],qs[_0x8603('0x4d')](_0x4b3bdc[_0x8603('0x48')]['fields']));_0x23ca7d[_0x8603('0x4c')]=_0x23ca7d[_0x8603('0x4c')][_0x8603('0x4e')]?_0x23ca7d[_0x8603('0x4c')]:_0x1a97aa[_0x8603('0x47')];if(!_0x4b3bdc[_0x8603('0x48')]['hasOwnProperty']('nolimit')){_0x23ca7d[_0x8603('0x4f')]=qs[_0x8603('0x4f')](_0x4b3bdc[_0x8603('0x48')][_0x8603('0x4f')]);_0x23ca7d[_0x8603('0x32')]=qs[_0x8603('0x32')](_0x4b3bdc[_0x8603('0x48')][_0x8603('0x32')]);}_0x23ca7d[_0x8603('0x50')]=qs[_0x8603('0x51')](_0x4b3bdc[_0x8603('0x48')]['sort']);_0x23ca7d[_0x8603('0x52')]=qs[_0x8603('0x4a')](_['pick'](_0x4b3bdc[_0x8603('0x48')],_0x1a97aa['filters']),_0x42de98);var _0x4ca0ad=[];var _0x59c19f=squel['select']()[_0x8603('0x53')]('id')['field'](_0x8603('0x38'))[_0x8603('0x53')](_0x8603('0x54'))[_0x8603('0x55')](_0x8603('0x56'));var _0x3709a3=squel['select']()[_0x8603('0x53')](_0x8603('0x57'))['field'](_0x8603('0x58'))[_0x8603('0x53')](_0x8603('0x59'))[_0x8603('0x55')](_0x8603('0x5a'),'ui')[_0x8603('0x5b')]('users','u',_0x8603('0x5c'));var _0x443791=squel[_0x8603('0x5d')]()['from'](_0x8603('0x5e'),'i')[_0x8603('0x5b')](_0x8603('0x5f'),'c',_0x8603('0x60'))['left_join'](_0x8603('0x61'),'o','o.id\x20=\x20i.UserId')[_0x8603('0x5b')](_0x8603('0x62'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x8603('0x5b')](_0x8603('0x63'),'me',_0x8603('0x64'))[_0x8603('0x5b')](_0x8603('0x65'),'it',_0x8603('0x66'))['left_join'](_0x8603('0x56'),'t',_0x8603('0x67'));var _0x3fe780=squel[_0x8603('0x68')]();var _0x592425=[];var _0x370ceb=squel['expr']();var _0xf0cead;if(_0x4b3bdc['query']['search']){_0xf0cead=as[_0x8603('0x69')](_0x4b3bdc['query'][_0x8603('0x6a')]);var _0x45b0c5=_0xf0cead[_0x8603('0x6b')];for(var _0x4fe042=0x0;_0x4fe042<_0xf0cead[_0x8603('0x6c')][_0x8603('0x4e')];_0x4fe042++){var _0x48e77e=_0xf0cead['conditions'][_0x4fe042];var _0x42d071='i';var _0x8f6735=_[_0x8603('0x6d')](_0x42de98,[_0x8603('0x38'),_0x48e77e[_0x8603('0x53')]]);if(!_0x8f6735){switch(_0x48e77e[_0x8603('0x53')]){case _0x8603('0x6e'):if(_0x48e77e[_0x8603('0x6f')]==0x1){_0x443791[_0x8603('0x70')]('`'+_0x48e77e[_0x8603('0x53')]+_0x8603('0x71'));}else{_0x443791['having']('`'+_0x48e77e['field']+_0x8603('0x72'));}break;case _0x8603('0x73'):if(_0x48e77e[_0x8603('0x74')]===_0x8603('0x75')){if(_0x48e77e[_0x8603('0x6f')][_0x8603('0x3e')]('\x20')[_0x8603('0x4e')]>0x1){_0x3fe780[_0x45b0c5](_0x8603('0x76'),qs['getFullTextValue'](_0x48e77e[_0x8603('0x6f')]),null);}else{var _0x2a325b='%'+_0x48e77e[_0x8603('0x6f')]+'%';_0x3fe780[_0x45b0c5](_0x8603('0x77'),_0x2a325b,_0x2a325b,_0x2a325b);}}else{_0x8f6735=_[_0x8603('0x6d')](_0x42de98,[_0x8603('0x38'),_0x8603('0x78')]);_0x48e77e['field']=_0x8603('0x78');_0x5c27f0=as[_0x8603('0x79')](_0x42d071,_0x8f6735['type'],_0x48e77e);_0x3fe780[_0x45b0c5](_0x5c27f0['text'],_0x5c27f0[_0x8603('0x6f')][_0x8603('0x7a')],_0x5c27f0[_0x8603('0x6f')][_0x8603('0x37')]);}break;case _0x8603('0x7b'):var _0x2bb011=_0x48e77e[_0x8603('0x6f')][_0x8603('0x3e')](',')['map'](function(_0x5b7f5d){return Number(_0x5b7f5d);});_0x2bb011['forEach'](function(_0x16cc7f){_0x370ceb['or'](_0x8603('0x7c'),'%,'+_0x16cc7f+',%');});_0x592425=_[_0x8603('0x7d')](_0x592425,_0x2bb011);break;case _0x8603('0x7e'):if(_0x48e77e['operator']===_0x8603('0x75')){_0x3fe780[_0x45b0c5](_0x8603('0x7f'),'%'+_0x48e77e['value']+'%',null);}else{_0x8f6735=_[_0x8603('0x6d')](_0x42de98,[_0x8603('0x38'),_0x8603('0x80')]);_0x48e77e[_0x8603('0x53')]='UserId';_0x5c27f0=as['buildExpression'](_0x42d071,_0x8f6735[_0x8603('0x45')],_0x48e77e);_0x3fe780[_0x45b0c5](_0x5c27f0[_0x8603('0x81')],_0x5c27f0['value']['start'],_0x5c27f0['value'][_0x8603('0x37')]);}break;case _0x8603('0x82'):_0x5c27f0=as['buildExpression']('me',null,_0x48e77e);_0x3fe780[_0x45b0c5](_0x5c27f0['text'],_0x5c27f0[_0x8603('0x6f')][_0x8603('0x7a')],_0x5c27f0[_0x8603('0x6f')][_0x8603('0x37')]);break;}}else{var _0x5c27f0=as[_0x8603('0x79')](_0x42d071,_0x8f6735[_0x8603('0x45')],_0x48e77e);_0x3fe780[_0x45b0c5](_0x5c27f0[_0x8603('0x81')],_0x5c27f0[_0x8603('0x6f')][_0x8603('0x7a')],_0x5c27f0[_0x8603('0x6f')]['end']);}}}else{var _0x2d0e64=_(_0x4b3bdc[_0x8603('0x48')])[_0x8603('0x49')]()[_0x8603('0x3b')](function(_0x10620b){return _['some'](_0x42de98,[_0x8603('0x38'),_0x10620b])?_0x10620b:undefined;})[_0x8603('0x83')]()[_0x8603('0x6f')]();if(!_[_0x8603('0x84')](_0x2d0e64)){_0x2d0e64[_0x8603('0x3f')](function(_0x26098f){if(_0x26098f===_0x8603('0x85')){_0x443791[_0x8603('0x52')](_0x8603('0x86'),[][_0x8603('0x87')](_0x4b3bdc[_0x8603('0x48')][_0x26098f]));}else if(_0x26098f===_0x8603('0x88')){var _0x4d9a7f=JSON['parse'](_0x4b3bdc[_0x8603('0x48')][_0x26098f])[_0x8603('0x89')];var _0xea4fec=JSON['parse'](_0x4b3bdc[_0x8603('0x48')][_0x26098f])['$lte'];_0x443791[_0x8603('0x52')](_0x8603('0x8a'),_0x4d9a7f,_0xea4fec);}else{if(_0x4b3bdc[_0x8603('0x48')][_0x26098f]===_0x8603('0x8b')){_0x443791[_0x8603('0x52')]('i.'+_0x26098f+_0x8603('0x8c'));}else{_0x443791[_0x8603('0x52')]('i.'+_0x26098f+_0x8603('0x8d'),_0x4b3bdc[_0x8603('0x48')][_0x26098f]);}}});}if(_0x4b3bdc[_0x8603('0x48')]['read']){if(_0x4b3bdc[_0x8603('0x48')][_0x8603('0x8e')]==0x1){_0x443791[_0x8603('0x70')](_0x8603('0x8f'));}else{_0x443791[_0x8603('0x70')](_0x8603('0x90'));}}if(_0x4b3bdc['query'][_0x8603('0x91')]){_0x592425=_[_0x8603('0x92')](_0x4b3bdc[_0x8603('0x48')]['tag'])?_0x4b3bdc[_0x8603('0x48')][_0x8603('0x91')]:new Array(_0x4b3bdc['query'][_0x8603('0x91')]);_0x592425[_0x8603('0x3f')](function(_0x394107){_0x370ceb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x394107+',%');});}if(_0x4b3bdc[_0x8603('0x48')][_0x8603('0x93')]){var _0x465bc3=_0x4b3bdc[_0x8603('0x48')]['filter']['replace']('\x5c','\x5c\x5c')[_0x8603('0x94')](/'/g,'\x27\x27');if(qs[_0x8603('0x95')](_0x465bc3)){_0x3fe780['or'](_0x8603('0x96'),_0x465bc3+'%');}else{_0x3fe780['or'](_0x8603('0x97'),qs[_0x8603('0x98')](_0x465bc3))['or'](_0x8603('0x99'),_0x465bc3+'%');}}}_0x443791['where'](_0x3fe780);_0x443791[_0x8603('0x9a')]('i.id');var _0x405fb8={'type':db['Sequelize'][_0x8603('0x9b')][_0x8603('0x9c')],'raw':!![]};var _0x2fcfb8=_0x443791[_0x8603('0x9d')]();_0x2fcfb8[_0x8603('0x53')]('i.id');_0x2fcfb8[_0x8603('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x23ca7d['order']){_0x23ca7d[_0x8603('0x50')][_0x8603('0x3f')](function(_0x138de7){var _0x334a13=_0x138de7[0x0]===_0x8603('0x9e')?_0x138de7[0x0]:'i.'+_0x138de7[0x0];_0x443791['order'](_0x334a13,_0x138de7[0x1]===_0x8603('0x9f')?![]:!![]);});}if(!_['isEmpty'](_0x592425)){_0x443791[_0x8603('0x70')](_0x370ceb);_0x2fcfb8['where']('t.id\x20IN\x20?',_0x592425);}BPromise[_0x8603('0xa0')]()[_0x8603('0x23')](function(){if(!_0xf0cead){if(_0x4b3bdc[_0x8603('0x48')][_0x8603('0x85')])return;_0x2fcfb8[_0x8603('0x52')](_0x8603('0xa1'));_0x443791[_0x8603('0x52')](_0x8603('0xa1'));return;}if(_0x4b3bdc[_0x8603('0xa2')][_0x8603('0xa3')]!=='agent')return;return _0x4b3bdc['user'][_0x8603('0xa4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x543295){if(_[_0x8603('0x84')](_0x543295)){_0x2fcfb8[_0x8603('0x52')](_0x8603('0xa5'));_0x443791[_0x8603('0x52')](_0x8603('0xa5'));}else{_0x2fcfb8[_0x8603('0x52')](_0x8603('0x86'),_['map'](_0x543295,'id'));_0x443791[_0x8603('0x52')](_0x8603('0x86'),_[_0x8603('0x3b')](_0x543295,'id'));}});})[_0x8603('0x23')](function(){if(_0x4b3bdc['user']['role']===_0x8603('0xa6')&&!_0xf0cead&&!_0x4b3bdc[_0x8603('0x48')][_0x8603('0x85')])return[];return db[_0x8603('0xa7')][_0x8603('0x48')](_0x2fcfb8[_0x8603('0xa8')](),_0x405fb8);})['then'](function(_0x477a2c){_0x302b8a[_0x8603('0x31')]=_0x477a2c[_0x8603('0x4e')];if(_0x302b8a[_0x8603('0x31')]===0x0)return[];return db['sequelize'][_0x8603('0x48')](_0x59c19f['toString'](),_0x405fb8)[_0x8603('0x23')](function(_0x4f5736){_0x4ca0ad=_['keyBy'](_0x4f5736,'id');_0x405fb8=_[_0x8603('0xa9')](_0x405fb8,{'model':db[_0x8603('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b3bdc[_0x8603('0x48')][_0x8603('0x4d')]){_0x23ca7d['attributes'][_0x8603('0x3f')](function(_0x3f9d03){_0x443791[_0x8603('0x53')]('i.'+_0x3f9d03);});}else{_0x443791[_0x8603('0x53')](_0x8603('0xaa'),_0x8603('0x6e'));_0x443791[_0x8603('0x53')](_0x8603('0xab'),_0x8603('0xac'));_0x443791['field'](_0x8603('0xad'),_0x8603('0xae'));_0x443791[_0x8603('0x53')](_0x8603('0xaf'),_0x8603('0x9e'));_0x443791['field'](_0x8603('0xb0'));_0x443791[_0x8603('0x53')](_0x8603('0xb1'),_0x8603('0xb2'));_0x443791['field']('c.lastName',_0x8603('0xb3'));_0x443791[_0x8603('0x53')](_0x8603('0xb4'),_0x8603('0xb5'));_0x443791[_0x8603('0x53')](_0x8603('0xb6'),_0x8603('0xb7'));_0x443791['field'](_0x8603('0xb8'),_0x8603('0xb9'));_0x443791[_0x8603('0x53')]('c.fax',_0x8603('0xba'));_0x443791[_0x8603('0x53')](_0x8603('0xbb'),_0x8603('0xbc'));_0x443791['field'](_0x8603('0xbd'),_0x8603('0xbe'));_0x443791['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8603('0x3d'));}if(_0x23ca7d['limit'])_0x443791[_0x8603('0x4f')](_0x23ca7d[_0x8603('0x4f')]);if(_0x23ca7d[_0x8603('0x32')])_0x443791[_0x8603('0x32')](_0x23ca7d[_0x8603('0x32')]);return db[_0x8603('0xa7')]['query'](_0x443791[_0x8603('0xa8')](),_0x405fb8);})[_0x8603('0x23')](function(_0x4a9dea){_0x3709a3[_0x8603('0x52')](_0x8603('0xbf'),_['map'](_0x4a9dea,'id'));return db[_0x8603('0xa7')][_0x8603('0x48')](_0x3709a3[_0x8603('0xa8')](),_0x405fb8)['then'](function(_0x2d0331){var _0x276e7d=_[_0x8603('0xc0')](_0x2d0331,_0x8603('0xc1'));var _0x215b5d=[];_0x4a9dea[_0x8603('0x3f')](function(_0x39f3e0){_0x215b5d[_0x8603('0x40')](updateChatInteraction(_0x39f3e0,_0x4ca0ad,_0x276e7d));});return BPromise['all'](_0x215b5d);});});})[_0x8603('0x23')](function(_0x141d61){_0x302b8a[_0x8603('0xc2')]=_0x141d61;return _0x302b8a;})[_0x8603('0x23')](respondWithFilteredResult(_0x52b6a5,_0x23ca7d))['catch'](handleError(_0x52b6a5,null));};exports['show']=function(_0x3b24ce,_0x548845){var _0x155eaf={'raw':![],'where':{'id':_0x3b24ce[_0x8603('0xc3')]['id']}},_0x11a78d={};_0x11a78d[_0x8603('0x47')]=_[_0x8603('0x49')](db['ChatInteraction'][_0x8603('0x43')]);_0x11a78d['query']=_['keys'](_0x3b24ce[_0x8603('0x48')]);_0x11a78d[_0x8603('0x4a')]=_[_0x8603('0x4b')](_0x11a78d[_0x8603('0x47')],_0x11a78d[_0x8603('0x48')]);_0x155eaf[_0x8603('0x4c')]=_['intersection'](_0x11a78d[_0x8603('0x47')],qs[_0x8603('0x4d')](_0x3b24ce['query']['fields']));_0x155eaf[_0x8603('0x4c')]=_0x155eaf[_0x8603('0x4c')][_0x8603('0x4e')]?_0x155eaf['attributes']:_0x11a78d[_0x8603('0x47')];if(_0x3b24ce[_0x8603('0x48')][_0x8603('0xc4')]){_0x155eaf[_0x8603('0xc5')]=[{'all':!![]}];}_0x155eaf=_[_0x8603('0xa9')]({},_0x155eaf,_0x3b24ce[_0x8603('0xc6')]);return db['ChatInteraction'][_0x8603('0x6d')](_0x155eaf)[_0x8603('0x23')](handleEntityNotFound(_0x548845,null))[_0x8603('0x23')](respondWithResult(_0x548845,null))[_0x8603('0x2d')](handleError(_0x548845,null));};exports[_0x8603('0xc7')]=function(_0x5c5960,_0x3288a4){return db['ChatInteraction']['create'](_0x5c5960[_0x8603('0x82')],{})['then'](respondWithResult(_0x3288a4,0xc9))[_0x8603('0x2d')](handleError(_0x3288a4,null));};exports[_0x8603('0x36')]=function(_0x2361eb,_0x200951){if(_0x2361eb['body']['id']){delete _0x2361eb['body']['id'];}return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0x2361eb[_0x8603('0xc3')]['id']}})['then'](handleEntityNotFound(_0x200951,null))[_0x8603('0x23')](saveUpdates(_0x2361eb['body'],null))[_0x8603('0x23')](respondWithResult(_0x200951,null))['catch'](handleError(_0x200951,null));};exports[_0x8603('0xc8')]=function(_0x4259f3,_0x5ade1b){return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0x4259f3[_0x8603('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5ade1b,null))[_0x8603('0x23')](removeEntity(_0x5ade1b,null))[_0x8603('0x2d')](handleError(_0x5ade1b,null));};exports[_0x8603('0xc9')]=function(_0x34ce5d,_0x5ba9c2){return db['ChatInteraction'][_0x8603('0xc9')]()[_0x8603('0x23')](respondWithResult(_0x5ba9c2,null))[_0x8603('0x2d')](handleError(_0x5ba9c2,null));};exports[_0x8603('0xca')]=function(_0x14ce38,_0x5e45f0){var _0x1926b4=_0x14ce38[_0x8603('0xc3')]['id'];var _0x42cdcf;var _0x568dbd;var _0x5af001;return db['ChatInteraction'][_0x8603('0xcb')]({'where':{'id':_0x1926b4}})[_0x8603('0x23')](function(_0xf7d295){_0x42cdcf=_0xf7d295;return db['ChatWebsite'][_0x8603('0xcb')]({'where':{'id':_0xf7d295[_0x8603('0x85')]},'attributes':['id',_0x8603('0xcc'),'vidaooEscalation'],'raw':!![]});})[_0x8603('0x23')](function(_0x3f37d0){if(_0x3f37d0&&_0x3f37d0[_0x8603('0xcc')]&&_0x3f37d0[_0x8603('0xcd')]){_0x568dbd=_0x3f37d0;var _0x3f50c9={'rejectUnauthorized':![],'method':_0x8603('0xce'),'uri':_0x8603('0xcf'),'headers':{'X-APIKEY':_0x3f37d0[_0x8603('0xcc')]},'body':{'name':'MotionCWB:'+_0x1926b4},'redirect':'follow','json':!![]};return rp(_0x3f50c9);}else{throw new db[(_0x8603('0xd0'))][(_0x8603('0xd1'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8603('0x23')](function(_0x17ecef){_0x5af001=_0x17ecef;if(_0x5af001['id']){var _0x5256cb={'body':_0x5af001[_0x8603('0xd2')],'ChatWebsiteId':_0x568dbd['id'],'ChatInteractionId':_0x42cdcf['id'],'direction':'out','UserId':_0x14ce38[_0x8603('0xa2')]['id']};return db['ChatMessage'][_0x8603('0xc7')](_0x5256cb,{});}else{throw new db[(_0x8603('0xd0'))][(_0x8603('0xd1'))](_0x8603('0xd3'));}})['then'](function(){return _0x42cdcf[_0x8603('0xd4')]({'vidaooSessionId':_0x5af001['id']});})[_0x8603('0x23')](respondWithResult(_0x5e45f0,null))[_0x8603('0x2d')](handleError(_0x5e45f0,null));};exports[_0x8603('0xd5')]=function(_0x41829e,_0x5f4eaa){if(_0x41829e['body']['id']){delete _0x41829e['body']['id'];}return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0x41829e[_0x8603('0xc3')]['id']},'include':[{'model':db['CmContact'],'as':_0x8603('0x73')}]})['then'](handleEntityNotFound(_0x5f4eaa,null))[_0x8603('0x23')](saveUpdates(_0x41829e[_0x8603('0x82')],null))[_0x8603('0x23')](respondWithResult(_0x5f4eaa,null))['catch'](handleError(_0x5f4eaa,null));};exports[_0x8603('0xd6')]=function(_0x218b42,_0x9f1381,_0x333757){if(_0x218b42[_0x8603('0x82')]['id']){delete _0x218b42[_0x8603('0x82')]['id'];}return db[_0x8603('0x42')]['find']({'where':{'id':_0x218b42['params']['id']}})['then'](function(_0x1480b1){if(!_0x1480b1){logger[_0x8603('0x29')](_0x8603('0xd7'),_0x8603('0xd6'),0x194,'entity\x20not\x20found');_0x9f1381[_0x8603('0x2e')](0x194);}else{if(_0x1480b1[_0x8603('0x80')]){throw new db[(_0x8603('0xd0'))][(_0x8603('0xd1'))]('Interaction\x20already\x20assigned');}}return _0x1480b1;})['then'](function(_0x43cc37){if(_0x43cc37){return _0x43cc37['update']({'closed':_0x218b42['body'][_0x8603('0xd8')],'disposition':_0x218b42['body'][_0x8603('0xd9')]})[_0x8603('0x23')](function(_0x24273e){return _0x24273e;});}})['then'](function(_0x21deb7){return respondWithRpcPromise(_0x8603('0xda'),'abandon',_0x218b42[_0x8603('0x82')],client9004);})['then'](respondWithResult(_0x9f1381,null))[_0x8603('0x2d')](handleError(_0x9f1381,null));};exports[_0x8603('0xdb')]=function(_0x1e6b03,_0x2f22a1,_0x4ba089){_0x1e6b03[_0x8603('0x82')][_0x8603('0x38')]=_0x1e6b03['file'][_0x8603('0xdc')];_0x1e6b03['body']['basename']=_0x1e6b03[_0x8603('0xdd')][_0x8603('0xde')];_0x1e6b03[_0x8603('0x82')][_0x8603('0x45')]=_0x1e6b03['file'][_0x8603('0xdf')];return db['Attachment']['create'](_0x1e6b03['body'])[_0x8603('0x23')](respondWithResult(_0x2f22a1,0xc9))['catch'](handleError(_0x2f22a1,null));};exports['attachmentDownload']=function(_0x30f350,_0x16e397,_0x5602f0){return db[_0x8603('0x42')][_0x8603('0xcb')]({'where':{'id':_0x30f350['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x16e397,null))[_0x8603('0x23')](function(_0x5b19c1){if(_0x5b19c1){if(_0x5b19c1[_0x8603('0xd8')]){return _0x16e397[_0x8603('0x2f')](0x193)[_0x8603('0x30')]({'status':0x193,'message':_0x8603('0xe0')});}return db[_0x8603('0xe1')][_0x8603('0xcb')]({'where':{'id':_0x30f350[_0x8603('0x48')][_0x8603('0xe2')]},'raw':!![]})[_0x8603('0x23')](handleEntityNotFound(_0x16e397,null));}})['then'](function(_0x517b7d){if(_0x517b7d){return _0x16e397[_0x8603('0xe3')](path[_0x8603('0xe4')](config['root'],_0x8603('0xe5'),_0x517b7d[_0x8603('0xe6')]));}})['catch'](handleError(_0x16e397,null));};exports[_0x8603('0xe7')]=function(_0xf8804a,_0x105f83){var _0x3ba8d9=null;var _0x5d00be=null;var _0x41947b=null;var _0x5dcb59=null;if(_0xf8804a[_0x8603('0x82')]['id']){delete _0xf8804a['body']['id'];}if(_0xf8804a[_0x8603('0x82')]['mailTranscript']){_0x5dcb59=path[_0x8603('0xe4')](config[_0x8603('0xe8')],_0x8603('0xe9'),util[_0x8603('0xea')](_0x8603('0xeb'),Date[_0x8603('0xec')]()));_0xf8804a[_0x8603('0x82')]['pathTranscript']=_0x5dcb59;}return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0xf8804a[_0x8603('0xc3')]['id']},'include':[{'model':db[_0x8603('0xed')],'as':_0x8603('0xee'),'include':[{'model':db[_0x8603('0x7e')],'as':_0x8603('0x7e')}]}]})[_0x8603('0x23')](handleEntityNotFound(_0x105f83,null))[_0x8603('0x23')](saveUpdates(_0xf8804a[_0x8603('0x82')],null))[_0x8603('0x23')](function(_0xf7b2f5){if(_0xf7b2f5){_0x3ba8d9=_0xf7b2f5;return db[_0x8603('0xef')]['find']({'where':{'id':_0x3ba8d9[_0x8603('0x85')]}});}})[_0x8603('0x23')](function(_0x1f39a7){if(_0x1f39a7){_0x41947b=_0x1f39a7;return db[_0x8603('0xf0')]['find']({'where':{'id':_0x3ba8d9['ContactId']}});}})['then'](function(_0x34608c){if(_0x34608c){_0x5d00be=_0x34608c;if(_0x5dcb59){var _0x38d15a=null;for(var _0x3bda66=0x1;_0x3bda66<_0x3ba8d9['Messages'][_0x8603('0x4e')];++_0x3bda66){_0x38d15a=_0x3ba8d9[_0x8603('0xee')][_0x3bda66];var _0x4f7927=_0x38d15a[_0x8603('0x80')]?util['format']('%s%d',_0x41947b[_0x8603('0xf1')],_0x38d15a[_0x8603('0x80')]):_0x8603('0xf2');var _0x2f3a5c=_0xf8804a['body'][_0x8603('0xf3')]||util[_0x8603('0xea')](_0x8603('0xf4'),_0x8603('0xf5'),_0x38d15a[_0x8603('0x78')]);switch(_0x41947b[_0x8603('0xf6')]){case _0x8603('0xf7'):_0x4f7927=_0x38d15a[_0x8603('0x80')]?util[_0x8603('0xea')]('%s%d',_0x41947b[_0x8603('0xf1')],_0x38d15a['UserId']):_0x8603('0xf2');break;case _0x8603('0xf8'):_0x4f7927=_0x38d15a[_0x8603('0x80')]?_0x38d15a['User']['alias']||_0x38d15a['User'][_0x8603('0xf9')]:_0x8603('0xf2');break;case _0x8603('0xfa'):_0x4f7927=_0x38d15a[_0x8603('0x80')]?_0x38d15a[_0x8603('0x7e')][_0x8603('0xf9')]:_0x8603('0xf2');break;default:_0x4f7927=_0x38d15a[_0x8603('0x80')]?util['format'](_0x8603('0xf4'),_0x41947b[_0x8603('0xf1')],_0x38d15a['UserId']):_0x8603('0xf2');}var _0x4228f1=util[_0x8603('0xea')](_0x8603('0xfb'),moment(_0x38d15a['createdAt'])[_0x8603('0xea')](_0x8603('0xfc')),_0x38d15a[_0x8603('0xfd')]==='in'?_0x2f3a5c:_0x4f7927,_0x38d15a['body']);if(!_0x38d15a[_0x8603('0xfe')]){fs[_0x8603('0xff')](_0x5dcb59,_0x4228f1);}}return db[_0x8603('0x100')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8603('0x101')],'as':_0x8603('0x102'),'raw':!![]}]});}}})[_0x8603('0x23')](function(_0x1d3e53){if(_0x1d3e53&&_0x1d3e53[_0x8603('0x102')]&&_0xf8804a[_0x8603('0x82')]){var _0x1fa7d3={'tls':{'rejectUnauthorized':![]}};if(_0x1d3e53[_0x8603('0x102')][_0x8603('0x103')]){_0x1fa7d3[_0x8603('0x103')]=_0x1d3e53[_0x8603('0x102')][_0x8603('0x103')];}else{_0x1fa7d3[_0x8603('0x104')]=_0x1d3e53['Smtp'][_0x8603('0x104')];_0x1fa7d3[_0x8603('0x105')]=_0x1d3e53['Smtp'][_0x8603('0x105')];_0x1fa7d3[_0x8603('0x106')]=_0x1d3e53['Smtp'][_0x8603('0x106')];}if(_0x1d3e53[_0x8603('0x102')][_0x8603('0x107')]){_0x1fa7d3[_0x8603('0x108')]={'user':_0x1d3e53[_0x8603('0x102')][_0x8603('0xa2')],'pass':_0x1d3e53[_0x8603('0x102')][_0x8603('0x109')]};}return respondWithRpcPromise('SendMail',_0x8603('0x10a'),{'account':_0x1fa7d3,'message':{'from':util[_0x8603('0xea')](_0x8603('0x10b'),_0x1d3e53[_0x8603('0x38')],_0x1d3e53[_0x8603('0x10c')]||_0x1d3e53['Smtp'][_0x8603('0xa2')]),'to':_0xf8804a['body']['mailTranscript'],'subject':_0x8603('0x10d'),'text':util[_0x8603('0xea')](_0x8603('0x10e'),_0xf8804a[_0x8603('0x82')][_0x8603('0x10f')]),'attachments':[{'path':_0x5dcb59}]}})[_0x8603('0x23')](function(){return _0x3ba8d9;})[_0x8603('0x2d')](function(_0x11a152){console['error'](_0x11a152);});}else{return _0x3ba8d9;}})['then'](respondWithStatusCode(_0x105f83,0xc8))[_0x8603('0x2d')](handleError(_0x105f83,null));};exports[_0x8603('0x110')]=function(_0x4e9884,_0x5bd393,_0x5543d8){return db[_0x8603('0xed')][_0x8603('0x6d')]({'where':{'id':_0x4e9884[_0x8603('0xc3')]['id']}})[_0x8603('0x23')](handleEntityNotFound(_0x5bd393,null))['then'](function(_0x337058){if(_0x337058){return _0x337058['addMessage'](_0x4e9884['body'][_0x8603('0x111')],_[_0x8603('0x112')](_0x4e9884[_0x8603('0x82')],[_0x8603('0x111'),'id'])||{});}})['then'](respondWithResult(_0x5bd393,null))[_0x8603('0x2d')](handleError(_0x5bd393,null));};exports[_0x8603('0x113')]=function(_0x59e14b,_0x5e9a14,_0x5014a2){var _0x2c9595={'raw':![],'where':{}};var _0x4d6893={};var _0x26019f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8603('0xcb')]({'where':{'id':_0x59e14b[_0x8603('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5e9a14,null))['then'](function(_0x74584a){if(_0x74584a){_0x4d6893[_0x8603('0x47')]=_['keys'](db[_0x8603('0xed')][_0x8603('0x43')]);_0x4d6893[_0x8603('0x48')]=_[_0x8603('0x49')](_0x59e14b[_0x8603('0x48')]);_0x4d6893[_0x8603('0x4a')]=_[_0x8603('0x4b')](_0x4d6893[_0x8603('0x47')],_0x4d6893['query']);_0x2c9595[_0x8603('0x4c')]=_['intersection'](_0x4d6893[_0x8603('0x47')],qs[_0x8603('0x4d')](_0x59e14b[_0x8603('0x48')]['fields']));_0x2c9595[_0x8603('0x4c')]=_0x2c9595[_0x8603('0x4c')]['length']?_0x2c9595[_0x8603('0x4c')]:_0x4d6893[_0x8603('0x47')];if(!_0x59e14b[_0x8603('0x48')]['hasOwnProperty'](_0x8603('0x114'))){_0x2c9595['limit']=qs['limit'](_0x59e14b['query'][_0x8603('0x4f')]);_0x2c9595[_0x8603('0x32')]=qs['offset'](_0x59e14b[_0x8603('0x48')]['offset']);}_0x2c9595['order']=qs['sort'](_0x59e14b['query']['sort']);_0x2c9595['where']=qs[_0x8603('0x4a')](_[_0x8603('0x115')](_0x59e14b[_0x8603('0x48')],_0x4d6893['filters']));_0x2c9595['where'][_0x8603('0xc1')]=_0x74584a['id'];if(_0x59e14b[_0x8603('0x48')][_0x8603('0x93')]){_0x2c9595[_0x8603('0x52')]=_[_0x8603('0xa9')](_0x2c9595[_0x8603('0x52')],{'$or':_['map'](_0x2c9595[_0x8603('0x4c')],function(_0x3cb900){var _0x32f986={};_0x32f986[_0x3cb900]={'$like':'%'+_0x59e14b[_0x8603('0x48')][_0x8603('0x93')]+'%'};return _0x32f986;})});}if(_0x59e14b['query'][_0x8603('0x89')]){var _0x295d31=_0x59e14b[_0x8603('0x48')][_0x8603('0x89')][_0x8603('0x3e')](',');var _0x53bda2={};_0x53bda2[_0x295d31[0x0]]={'$gte':moment(_0x295d31[0x1])[_0x8603('0xea')](_0x8603('0x116'))};_0x2c9595[_0x8603('0x52')]=_['merge'](_0x2c9595[_0x8603('0x52')],_0x53bda2);}_0x2c9595=_[_0x8603('0xa9')]({},_0x2c9595,_0x59e14b[_0x8603('0xc6')]);return db[_0x8603('0xed')][_0x8603('0x31')]({'where':_0x2c9595[_0x8603('0x52')]})['then'](function(_0x158b39){_0x26019f[_0x8603('0x31')]=_0x158b39;if(_0x59e14b[_0x8603('0x48')][_0x8603('0xc4')]){_0x2c9595[_0x8603('0xc5')]=[{'all':!![]}];}return db['ChatMessage'][_0x8603('0x117')](_0x2c9595);})['then'](function(_0x8b8045){_0x26019f[_0x8603('0xc2')]=_0x8b8045;return _0x26019f;});}})[_0x8603('0x23')](respondWithFilteredResult(_0x5e9a14,_0x2c9595))['catch'](handleError(_0x5e9a14,null));};exports[_0x8603('0x118')]=function(_0x31c468,_0x32f335,_0xa1f3d){var _0x45b452={'where':{}},_0x26ca71={},_0x40eff5={'count':0x0,'rows':[]};return db[_0x8603('0x42')][_0x8603('0xcb')]({'where':{'id':_0x31c468[_0x8603('0xc3')]['id']}})['then'](handleEntityNotFound(_0x32f335,null))[_0x8603('0x23')](function(_0xf54ddf){if(_0xf54ddf){_0x26ca71['model']=_[_0x8603('0x49')](db[_0x8603('0xed')][_0x8603('0x43')]);_0x26ca71[_0x8603('0x48')]=_[_0x8603('0x49')](_0x31c468[_0x8603('0x48')]);_0x26ca71[_0x8603('0x4a')]=_[_0x8603('0x4b')](_0x26ca71['model'],_0x26ca71[_0x8603('0x48')]);_0x45b452[_0x8603('0x4c')]=_[_0x8603('0x4b')](_0x26ca71['model'],qs[_0x8603('0x4d')](_0x31c468[_0x8603('0x48')][_0x8603('0x4d')]));_0x45b452['attributes']=_0x45b452[_0x8603('0x4c')][_0x8603('0x4e')]?_0x45b452[_0x8603('0x4c')]:_0x26ca71[_0x8603('0x47')];if(!_0x31c468[_0x8603('0x48')][_0x8603('0x119')](_0x8603('0x114'))){_0x45b452[_0x8603('0x4f')]=qs[_0x8603('0x4f')](_0x31c468['query'][_0x8603('0x4f')]);_0x45b452['offset']=qs['offset'](_0x31c468[_0x8603('0x48')][_0x8603('0x32')]);}_0x45b452[_0x8603('0x50')]=qs['sort'](_0x31c468[_0x8603('0x48')][_0x8603('0x51')]);_0x45b452[_0x8603('0x52')]=qs[_0x8603('0x4a')](_[_0x8603('0x115')](_0x31c468[_0x8603('0x48')],_0x26ca71[_0x8603('0x4a')]));_0x45b452[_0x8603('0x52')][_0x8603('0xc1')]=_0xf54ddf['id'];if(_0x31c468[_0x8603('0x48')][_0x8603('0x93')]){_0x45b452[_0x8603('0x52')]=_[_0x8603('0xa9')](_0x45b452[_0x8603('0x52')],{'$or':_[_0x8603('0x3b')](_0x45b452[_0x8603('0x4c')],function(_0x11b976){var _0x16d7f5={};_0x16d7f5[_0x11b976]={'$like':'%'+_0x31c468[_0x8603('0x48')][_0x8603('0x93')]+'%'};return _0x16d7f5;})});}_0x45b452[_0x8603('0x52')][_0x8603('0xfe')]=![];if(_0x31c468[_0x8603('0x48')]['id']){_0x45b452[_0x8603('0x52')]['id']={'$gt':_0x31c468['query']['id']};}_0x45b452=_[_0x8603('0xa9')]({},_0x45b452,_0x31c468[_0x8603('0xc6')]);return db[_0x8603('0xed')][_0x8603('0x31')]({'where':_0x45b452['where']})[_0x8603('0x23')](function(_0x10d397){_0x40eff5[_0x8603('0x31')]=_0x10d397;_0x45b452[_0x8603('0xc5')]=[];if(_0x31c468[_0x8603('0x48')]['includeAgent']){_0x45b452[_0x8603('0xc5')][_0x8603('0x40')]({'model':db['User'],'as':_0x8603('0x7e'),'attributes':['id',_0x8603('0xf9'),_0x8603('0x11a')]});}if(_0x31c468[_0x8603('0x48')][_0x8603('0xc4')]){_0x45b452[_0x8603('0xc5')]=[{'all':!![]}];}return db[_0x8603('0xed')]['findAll'](_0x45b452);})[_0x8603('0x23')](function(_0xf6c3c4){_0x40eff5[_0x8603('0xc2')]=_0xf6c3c4;return _0x40eff5;});}})[_0x8603('0x23')](respondWithFilteredResult(_0x32f335,_0x45b452))[_0x8603('0x2d')](handleError(_0x32f335,null));};exports[_0x8603('0x11b')]=function(_0x5653f6,_0x122b6b,_0x271237){return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0x5653f6[_0x8603('0xc3')]['id']}})[_0x8603('0x23')](handleEntityNotFound(_0x122b6b,null))[_0x8603('0x23')](function(_0x5f4cb2){if(_0x5f4cb2){return _0x5f4cb2['setTags'](_0x5653f6[_0x8603('0x82')][_0x8603('0x111')],_[_0x8603('0x112')](_0x5653f6[_0x8603('0x82')],[_0x8603('0x111'),'id'])||{})[_0x8603('0x11c')](function(){return db[_0x8603('0x7b')][_0x8603('0x117')]({'attributes':['id','name','color'],'where':{'id':_0x5653f6['body'][_0x8603('0x111')]}});})['then'](function(_0x3dd029){socket[_0x8603('0x11d')](_0x8603('0x11e'),{'id':Number(_0x5653f6[_0x8603('0xc3')]['id']),'tags':_0x3dd029||[]});return{'id':Number(_0x5653f6[_0x8603('0xc3')]['id']),'tags':_0x3dd029||[]};});}})[_0x8603('0x23')](respondWithResult(_0x122b6b,null))[_0x8603('0x2d')](handleError(_0x122b6b,null));};exports[_0x8603('0x11f')]=function(_0x43bc3f,_0xdbd28c,_0x1526e7){return db[_0x8603('0x42')][_0x8603('0x6d')]({'where':{'id':_0x43bc3f[_0x8603('0xc3')]['id']}})['then'](handleEntityNotFound(_0xdbd28c,null))[_0x8603('0x23')](function(_0x5eb452){if(_0x5eb452){return _0x5eb452[_0x8603('0x11f')](_0x43bc3f[_0x8603('0x48')][_0x8603('0x111')]);}})[_0x8603('0x23')](respondWithStatusCode(_0xdbd28c,null))[_0x8603('0x2d')](handleError(_0xdbd28c,null));};exports['download']=function(_0x3e61fa,_0x4b4b64){var _0x158158=moment()[_0x8603('0x120')]()[_0x8603('0xa8')]();var _0x4c311e=path[_0x8603('0xe4')](config[_0x8603('0xe8')],_0x8603('0x121'),_0x8603('0x122'),_0x8603('0x123'));var _0x2cbe0a=path[_0x8603('0xe4')](config[_0x8603('0xe8')],'server',_0x8603('0x122'),_0x8603('0x124'));var _0x753538=path[_0x8603('0xe4')](_0x4c311e,_0x158158);var _0xfe0a88=util[_0x8603('0xea')]('transcript-%d-%s.zip',_0x3e61fa[_0x8603('0xc3')]['id'],_0x158158);var _0xa682f4=path[_0x8603('0xe4')](_0x4c311e,_0xfe0a88);var _0x110305=[];_0x110305[_0x8603('0x40')]({'model':db[_0x8603('0x7e')],'as':_0x8603('0x7e'),'attributes':['id',_0x8603('0xf9')],'raw':!![]});_0x110305[_0x8603('0x40')]({'model':db[_0x8603('0xf0')],'as':'Contact','attributes':['id',_0x8603('0x125'),_0x8603('0x126')],'raw':!![]});if(_0x3e61fa[_0x8603('0x48')][_0x8603('0x124')]){_0x110305['push']({'model':db[_0x8603('0xe1')],'as':_0x8603('0xe1'),'raw':!![]});}var _0x4cc651=[{'model':db[_0x8603('0xed')],'as':'Messages','attributes':['id','body','createdAt',_0x8603('0xfd'),_0x8603('0xfe'),_0x8603('0x8e')],'include':_0x110305}];_0x4cc651['push']({'model':db[_0x8603('0xef')],'as':_0x8603('0x127'),'attributes':['id',_0x8603('0x38')]});_0x4cc651['push']({'model':db['User'],'as':_0x8603('0x128'),'attributes':['id',_0x8603('0xf9')]});return db['ChatInteraction'][_0x8603('0x6d')]({'where':{'id':_0x3e61fa[_0x8603('0xc3')]['id']},'include':_0x4cc651})[_0x8603('0x23')](handleEntityNotFound(_0x4b4b64,null))[_0x8603('0x23')](function(_0x3ced3d){if(_0x3ced3d){var _0x483363=_0x3ced3d[_0x8603('0x129')]({'plain':!![]});fs[_0x8603('0x12a')](_0x753538);var _0x443700={'format':'A4','border':'10px','header':{'height':_0x8603('0x12b'),'contents':{'first':_0x8603('0x12c')}},'footer':{'height':_0x8603('0x12d'),'contents':{'default':util[_0x8603('0xea')](_0x8603('0x12e'),util[_0x8603('0xea')](_0x8603('0x12f'),_0x8603('0x130'),_0x483363['id']),moment()[_0x8603('0xea')](_0x8603('0x131'))['toString']())}}};var _0xf96ee3={'channel':_0x8603('0x130'),'account':_0x483363[_0x8603('0x127')][_0x8603('0x38')],'agent':_0x483363['Owner']?_0x483363['Owner'][_0x8603('0xf9')]:_0x8603('0x132'),'createdAt':moment(_0x483363[_0x8603('0x88')])['format'](_0x8603('0x116'))['toString'](),'closedAt':_0x483363[_0x8603('0xd8')]?moment(_0x483363[_0x8603('0x133')])[_0x8603('0xea')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8603('0xa8')]():'','disposition':_0x483363[_0x8603('0xd9')],'chatInfo':{'browser':_0x483363[_0x8603('0x134')],'os':_0x483363[_0x8603('0x135')],'referer':_0x483363[_0x8603('0x136')],'customerIp':_0x483363[_0x8603('0x137')],'customerPort':_0x483363[_0x8603('0x138')]?_0x483363[_0x8603('0x138')]:_0x8603('0x132')},'messages':_(_0x483363[_0x8603('0xee')])['tail']()[_0x8603('0x93')]({'secret':![]})[_0x8603('0x3b')](function(_0x43ce1d){if(_0x43ce1d[_0x8603('0xe1')]){var _0x5695b9=path['join'](_0x2cbe0a,_0x43ce1d[_0x8603('0xe1')][_0x8603('0xe6')]);if(fs[_0x8603('0x139')](_0x5695b9)){fs['createReadStream'](_0x5695b9)[_0x8603('0x13a')](fs[_0x8603('0x13b')](path['join'](_0x753538,_0x43ce1d[_0x8603('0xe1')][_0x8603('0xe6')])));}}return{'date':moment(_0x43ce1d['createdAt'])[_0x8603('0xea')](_0x8603('0x116'))['toString'](),'sender':_0x43ce1d['direction']===_0x8603('0x13c')?_0x43ce1d[_0x8603('0x7e')]?_0x43ce1d['User'][_0x8603('0xf9')]:_0x8603('0xf2'):_0x43ce1d[_0x8603('0x73')]['firstName']+(_0x43ce1d[_0x8603('0x73')][_0x8603('0x126')]?'\x20'+_0x43ce1d[_0x8603('0x73')][_0x8603('0x126')]:''),'body':_0x43ce1d[_0x8603('0xe1')]?_0x43ce1d['Attachment'][_0x8603('0xe6')]:_0x43ce1d['body'],'direction':_0x43ce1d[_0x8603('0xfd')]==='out'?'A':'C','secret':_0x43ce1d['secret'],'read':_0x43ce1d['read'],'attachment':_0x43ce1d['Attachment']};})['value']()};return ejs[_0x8603('0x13d')](path['join'](config[_0x8603('0xe8')],_0x8603('0x121'),'views',_0x8603('0x13e')),{'interaction':_0xf96ee3})[_0x8603('0x23')](function(_0x1c24ed){return new BPromise(function(_0x598c3b,_0x18baac){pdf['create'](_0x1c24ed,_0x443700)[_0x8603('0x13f')](path[_0x8603('0xe4')](_0x753538,_0x8603('0x140')+_0x483363['id']+'-'+_0x158158+_0x8603('0x141')),function(_0x1bc8d0,_0x3f09e9){if(_0x1bc8d0)return _0x18baac(_0x1bc8d0);_0x598c3b(_0x3f09e9);});});})[_0x8603('0x23')](function(){return new BPromise(function(_0x405c0b,_0x235047){zipdir(_0x753538,{'saveTo':_0xa682f4},function(_0x2dc39c,_0x4ef750){if(_0x2dc39c)return _0x235047(_0x2dc39c);return _0x405c0b(_0x4ef750);});})[_0x8603('0x23')](function(){return new BPromise(function(_0x180584,_0x4a471c){rimraf(_0x753538,function(_0x28cc3f){if(_0x28cc3f)_0x4a471c(_0x28cc3f);return _0x180584();});});})[_0x8603('0x23')](function(){return _0x4b4b64[_0x8603('0xe3')](_0xa682f4,_0xfe0a88,function(_0x23a46b){if(_0x23a46b){console[_0x8603('0x142')](_0x8603('0x143'),_0x23a46b);}else{fs['unlinkSync'](_0xa682f4);}});});});}else{return _0x4b4b64['sendStatus'](0xc8);}})['catch'](handleError(_0x4b4b64,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c792043..060e6b2 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 _0xfcd2=['update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xfcd2,0x13f));var _0x2fcd=function(_0x3dfbb9,_0x470622){_0x3dfbb9=_0x3dfbb9-0x0;var _0x461f90=_0xfcd2[_0x3dfbb9];return _0x461f90;};'use strict';var EventEmitter=require(_0x2fcd('0x0'));var ChatInteraction=require(_0x2fcd('0x1'))['db'][_0x2fcd('0x2')];var ChatMessage=require(_0x2fcd('0x1'))['db'][_0x2fcd('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2fcd('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2fcd('0x5'),'afterDestroy':_0x2fcd('0x6')};function emitEvent(_0x302501){return function(_0x4b2b18,_0x127d7d,_0x565777){_0x4b2b18[_0x2fcd('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x305f35){_0x4b2b18[_0x2fcd('0x8')](_0x2fcd('0x9'),_0x305f35['map'](function(_0x457a32){return{'id':_0x457a32['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4b2b18['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2fcd('0xa')](function(_0x5ee137){_0x4b2b18[_0x2fcd('0x8')](_0x2fcd('0xb'),_0x5ee137[_0x2fcd('0xc')]);ChatInteractionEvents['emit'](_0x302501+':'+_0x4b2b18['id'],_0x4b2b18);ChatInteractionEvents[_0x2fcd('0xd')](_0x302501,_0x4b2b18);_0x565777(null);})[_0x2fcd('0xe')](_0x565777(null));};}for(var e in events){if(events[_0x2fcd('0xf')](e)){var event=events[e];ChatInteraction[_0x2fcd('0x10')](e,emitEvent(event));}}module[_0x2fcd('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x7c93=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x2ffc84,_0x5e3f8a){var _0x670f10=function(_0x1a10f9){while(--_0x1a10f9){_0x2ffc84['push'](_0x2ffc84['shift']());}};_0x670f10(++_0x5e3f8a);}(_0x7c93,0xc4));var _0x37c9=function(_0x2df289,_0x39be70){_0x2df289=_0x2df289-0x0;var _0x310bef=_0x7c93[_0x2df289];return _0x310bef;};'use strict';var EventEmitter=require(_0x37c9('0x0'));var ChatInteraction=require(_0x37c9('0x1'))['db'][_0x37c9('0x2')];var ChatMessage=require(_0x37c9('0x1'))['db'][_0x37c9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x37c9('0x4')](0x0);var events={'afterCreate':_0x37c9('0x5'),'afterUpdate':_0x37c9('0x6'),'afterDestroy':_0x37c9('0x7')};function emitEvent(_0x442f4b){return function(_0x325e8e,_0x31c4bc,_0x15026c){_0x325e8e[_0x37c9('0x8')]({'attributes':['id'],'raw':!![]})[_0x37c9('0x9')](function(_0x4cca1a){_0x325e8e['setDataValue'](_0x37c9('0xa'),_0x4cca1a[_0x37c9('0xb')](function(_0x3a9256){return{'id':_0x3a9256['id']};}));return ChatMessage[_0x37c9('0xc')]({'where':{'ChatInteractionId':_0x325e8e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x37c9('0x9')](function(_0x46aab4){_0x325e8e[_0x37c9('0xd')](_0x37c9('0xe'),_0x46aab4[_0x37c9('0xf')]);ChatInteractionEvents[_0x37c9('0x10')](_0x442f4b+':'+_0x325e8e['id'],_0x325e8e);ChatInteractionEvents[_0x37c9('0x10')](_0x442f4b,_0x325e8e);_0x15026c(null);})[_0x37c9('0x11')](_0x15026c(null));};}for(var e in events){if(events[_0x37c9('0x12')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x37c9('0x13')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8b36386..fb23c6e 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 _0x1317=['exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1317,0xf3));var _0x7131=function(_0x27c54a,_0x34cb98){_0x27c54a=_0x27c54a-0x0;var _0x56d7bc=_0x1317[_0x27c54a];return _0x56d7bc;};'use strict';var _=require('lodash');var util=require(_0x7131('0x0'));var logger=require(_0x7131('0x1'))(_0x7131('0x2'));var moment=require('moment');var BPromise=require(_0x7131('0x3'));var rp=require(_0x7131('0x4'));var fs=require('fs');var path=require(_0x7131('0x5'));var rimraf=require(_0x7131('0x6'));var config=require(_0x7131('0x7'));var attributes=require(_0x7131('0x8'));module[_0x7131('0x9')]=function(_0x1145db,_0x5ec556){return _0x1145db[_0x7131('0xa')](_0x7131('0xb'),attributes,{'tableName':_0x7131('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4428b8,_0x4f8442,_0x39b367){if(_0x4428b8[_0x7131('0xd')](_0x7131('0xe'))){_0x4428b8['closedAt']=moment()[_0x7131('0xf')](_0x7131('0x10'));}_0x39b367(null,_0x4428b8);}},'charset':_0x7131('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6e29=['utf8mb4_unicode_ci','util','bluebird','request-promise','path','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x175dc5,_0x123cdc){var _0x1e7590=function(_0x2281ea){while(--_0x2281ea){_0x175dc5['push'](_0x175dc5['shift']());}};_0x1e7590(++_0x123cdc);}(_0x6e29,0x115));var _0x96e2=function(_0x5c43a6,_0x47fc09){_0x5c43a6=_0x5c43a6-0x0;var _0x39f32d=_0x6e29[_0x5c43a6];return _0x39f32d;};'use strict';var _=require('lodash');var util=require(_0x96e2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x96e2('0x1'));var rp=require(_0x96e2('0x2'));var fs=require('fs');var path=require(_0x96e2('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x96e2('0x4')]=function(_0x2f3005,_0x389dce){return _0x2f3005[_0x96e2('0x5')](_0x96e2('0x6'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5145d5,_0x2a6793,_0x19b555){if(_0x5145d5[_0x96e2('0x7')](_0x96e2('0x8'))){_0x5145d5[_0x96e2('0x9')]=moment()['format'](_0x96e2('0xa'));}_0x19b555(null,_0x5145d5);}},'charset':'utf8mb4','collate':_0x96e2('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2eae0b7..27254ec 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 _0xc658=['then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request'];(function(_0x4c8dfa,_0xd9c68b){var _0x2ec23b=function(_0x3e151b){while(--_0x3e151b){_0x4c8dfa['push'](_0x4c8dfa['shift']());}};_0x2ec23b(++_0xd9c68b);}(_0xc658,0x1d2));var _0x8c65=function(_0x435746,_0x19de1c){_0x435746=_0x435746-0x0;var _0x97ccef=_0xc658[_0x435746];return _0x97ccef;};'use strict';var _=require(_0x8c65('0x0'));var util=require(_0x8c65('0x1'));var moment=require(_0x8c65('0x2'));var BPromise=require(_0x8c65('0x3'));var rs=require(_0x8c65('0x4'));var fs=require('fs');var Redis=require(_0x8c65('0x5'));var db=require(_0x8c65('0x6'))['db'];var utils=require(_0x8c65('0x7'));var logger=require('../../config/logger')(_0x8c65('0x8'));var config=require(_0x8c65('0x9'));var jayson=require(_0x8c65('0xa'));var client=jayson[_0x8c65('0xb')][_0x8c65('0xc')]({'port':0x232a});config[_0x8c65('0xd')]=_[_0x8c65('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c65('0xf'))(new Redis(config['redis']));require(_0x8c65('0x10'))['register'](socket);function respondWithRpcPromise(_0xf919b3,_0x470066,_0x361bba){return new BPromise(function(_0x487464,_0x12b755){return client[_0x8c65('0x11')](_0xf919b3,_0x361bba)[_0x8c65('0x12')](function(_0x1a5054){logger['info'](_0x8c65('0x13'),_0x470066,_0x8c65('0x14'));logger[_0x8c65('0x15')](_0x8c65('0x16'),_0x470066,'request\x20sent',JSON['stringify'](_0x1a5054));if(_0x1a5054['error']){if(_0x1a5054[_0x8c65('0x17')][_0x8c65('0x18')]===0x1f4){logger[_0x8c65('0x17')](_0x8c65('0x13'),_0x470066,_0x1a5054[_0x8c65('0x17')]['message']);return _0x12b755(_0x1a5054[_0x8c65('0x17')][_0x8c65('0x19')]);}logger[_0x8c65('0x17')](_0x8c65('0x13'),_0x470066,_0x1a5054[_0x8c65('0x17')][_0x8c65('0x19')]);return _0x487464(_0x1a5054[_0x8c65('0x17')][_0x8c65('0x19')]);}else{logger[_0x8c65('0x1a')](_0x8c65('0x13'),_0x470066,_0x8c65('0x14'));_0x487464(_0x1a5054['result']['message']);}})[_0x8c65('0x1b')](function(_0x5d2b22){logger[_0x8c65('0x17')](_0x8c65('0x13'),_0x470066,_0x5d2b22);_0x12b755(_0x5d2b22);});});}exports['UpdateChatInteraction']=function(_0xd16de9){var _0x414bea=this;return new Promise(function(_0x18bd2e,_0x2d9be1){return db[_0x8c65('0x1c')][_0x8c65('0x1d')](_0xd16de9[_0x8c65('0x1e')],{'raw':_0xd16de9[_0x8c65('0x1f')]?_0xd16de9[_0x8c65('0x1f')][_0x8c65('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd16de9[_0x8c65('0x1f')]?_0xd16de9[_0x8c65('0x1f')][_0x8c65('0x21')]||null:null,'attributes':_0xd16de9['options']?_0xd16de9[_0x8c65('0x1f')][_0x8c65('0x22')]||null:null,'limit':_0xd16de9[_0x8c65('0x1f')]?_0xd16de9[_0x8c65('0x1f')][_0x8c65('0x23')]||null:null})[_0x8c65('0x12')](function(_0x52d5cb){logger[_0x8c65('0x1a')](_0x8c65('0x24'),_0xd16de9);logger[_0x8c65('0x15')](_0x8c65('0x24'),_0xd16de9,JSON[_0x8c65('0x25')](_0x52d5cb));_0x18bd2e(_0x52d5cb);})[_0x8c65('0x1b')](function(_0xee15ce){logger['error'](_0x8c65('0x24'),_0xee15ce['message'],_0xd16de9);_0x2d9be1(_0x414bea['error'](0x1f4,_0xee15ce[_0x8c65('0x19')]));});});};exports[_0x8c65('0x26')]=function(_0x465fd8){return new Promise(function(_0x4130dd,_0x5298a2){return db[_0x8c65('0x1c')][_0x8c65('0x27')]({'where':_0x465fd8[_0x8c65('0x1f')]?_0x465fd8[_0x8c65('0x1f')][_0x8c65('0x21')]||null:null})[_0x8c65('0x12')](function(_0xfefb83){if(_0xfefb83){return _0xfefb83[_0x8c65('0x28')](_0x465fd8[_0x8c65('0x1e')]['ids'],_[_0x8c65('0x29')](_0x465fd8['body'],['ids','id'])||{});}})[_0x8c65('0x2a')](function(_0x2a3679){logger[_0x8c65('0x1a')](_0x8c65('0x2b'),_0x465fd8);logger[_0x8c65('0x15')](_0x8c65('0x2b'),_0x465fd8,JSON[_0x8c65('0x25')](_0x2a3679));_0x4130dd(_0x2a3679);})[_0x8c65('0x1b')](function(_0x50b0b1){logger[_0x8c65('0x17')]('AddTags',_0x50b0b1['message'],_0x465fd8);_0x5298a2(_this[_0x8c65('0x17')](0x1f4,_0x50b0b1[_0x8c65('0x19')]));});});}; \ No newline at end of file +var _0xfaa8=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','then','info','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','debug','catch','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x166ed1,_0x1a5d98){var _0x4bba33=function(_0x778793){while(--_0x778793){_0x166ed1['push'](_0x166ed1['shift']());}};_0x4bba33(++_0x1a5d98);}(_0xfaa8,0x15b));var _0x8faa=function(_0xd80662,_0x496c05){_0xd80662=_0xd80662-0x0;var _0x3e1aa8=_0xfaa8[_0xd80662];return _0x3e1aa8;};'use strict';var _=require(_0x8faa('0x0'));var util=require(_0x8faa('0x1'));var moment=require(_0x8faa('0x2'));var BPromise=require(_0x8faa('0x3'));var rs=require(_0x8faa('0x4'));var fs=require('fs');var Redis=require(_0x8faa('0x5'));var db=require(_0x8faa('0x6'))['db'];var utils=require(_0x8faa('0x7'));var logger=require(_0x8faa('0x8'))(_0x8faa('0x9'));var config=require(_0x8faa('0xa'));var jayson=require(_0x8faa('0xb'));var client=jayson[_0x8faa('0xc')][_0x8faa('0xd')]({'port':0x232a});config[_0x8faa('0xe')]=_['defaults'](config[_0x8faa('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x8faa('0xf'))(new Redis(config[_0x8faa('0xe')]));require(_0x8faa('0x10'))['register'](socket);function respondWithRpcPromise(_0x6363f,_0x35d7db,_0x1fcf4e){return new BPromise(function(_0x54277e,_0x123292){return client['request'](_0x6363f,_0x1fcf4e)[_0x8faa('0x11')](function(_0x11f4f9){logger[_0x8faa('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x35d7db,_0x8faa('0x13'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x35d7db,_0x8faa('0x13'),JSON[_0x8faa('0x14')](_0x11f4f9));if(_0x11f4f9[_0x8faa('0x15')]){if(_0x11f4f9['error'][_0x8faa('0x16')]===0x1f4){logger[_0x8faa('0x15')](_0x8faa('0x17'),_0x35d7db,_0x11f4f9[_0x8faa('0x15')][_0x8faa('0x18')]);return _0x123292(_0x11f4f9[_0x8faa('0x15')]['message']);}logger[_0x8faa('0x15')](_0x8faa('0x17'),_0x35d7db,_0x11f4f9[_0x8faa('0x15')][_0x8faa('0x18')]);return _0x54277e(_0x11f4f9[_0x8faa('0x15')]['message']);}else{logger[_0x8faa('0x12')](_0x8faa('0x17'),_0x35d7db,_0x8faa('0x13'));_0x54277e(_0x11f4f9[_0x8faa('0x19')][_0x8faa('0x18')]);}})['catch'](function(_0x59da24){logger[_0x8faa('0x15')](_0x8faa('0x17'),_0x35d7db,_0x59da24);_0x123292(_0x59da24);});});}exports[_0x8faa('0x1a')]=function(_0x407d65){var _0x50d807=this;return new Promise(function(_0x55e637,_0x2d31b0){return db[_0x8faa('0x1b')][_0x8faa('0x1c')](_0x407d65[_0x8faa('0x1d')],{'raw':_0x407d65[_0x8faa('0x1e')]?_0x407d65[_0x8faa('0x1e')][_0x8faa('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407d65[_0x8faa('0x1e')]?_0x407d65[_0x8faa('0x1e')][_0x8faa('0x20')]||null:null,'attributes':_0x407d65[_0x8faa('0x1e')]?_0x407d65[_0x8faa('0x1e')][_0x8faa('0x21')]||null:null,'limit':_0x407d65[_0x8faa('0x1e')]?_0x407d65[_0x8faa('0x1e')]['limit']||null:null})[_0x8faa('0x11')](function(_0x41fe21){logger[_0x8faa('0x12')]('UpdateChatInteraction',_0x407d65);logger[_0x8faa('0x22')]('UpdateChatInteraction',_0x407d65,JSON[_0x8faa('0x14')](_0x41fe21));_0x55e637(_0x41fe21);})[_0x8faa('0x23')](function(_0x152daf){logger['error'](_0x8faa('0x1a'),_0x152daf['message'],_0x407d65);_0x2d31b0(_0x50d807[_0x8faa('0x15')](0x1f4,_0x152daf['message']));});});};exports[_0x8faa('0x24')]=function(_0x35764d){return new Promise(function(_0x334b07,_0x1f619f){return db[_0x8faa('0x1b')][_0x8faa('0x25')]({'where':_0x35764d[_0x8faa('0x1e')]?_0x35764d[_0x8faa('0x1e')][_0x8faa('0x20')]||null:null})[_0x8faa('0x11')](function(_0x1ee9de){if(_0x1ee9de){return _0x1ee9de[_0x8faa('0x26')](_0x35764d[_0x8faa('0x1d')][_0x8faa('0x27')],_[_0x8faa('0x28')](_0x35764d[_0x8faa('0x1d')],[_0x8faa('0x27'),'id'])||{});}})[_0x8faa('0x29')](function(_0x6b114){logger[_0x8faa('0x12')]('AddTags',_0x35764d);logger[_0x8faa('0x22')]('AddTags',_0x35764d,JSON[_0x8faa('0x14')](_0x6b114));_0x334b07(_0x6b114);})[_0x8faa('0x23')](function(_0x1ac3db){logger['error'](_0x8faa('0x2a'),_0x1ac3db[_0x8faa('0x18')],_0x35764d);_0x1f619f(_this[_0x8faa('0x15')](0x1f4,_0x1ac3db[_0x8faa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4e9b374..2dd776c 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 _0xce29=['chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0xdedfa2,_0x318f45){var _0x49c029=function(_0x168ede){while(--_0x168ede){_0xdedfa2['push'](_0xdedfa2['shift']());}};_0x49c029(++_0x318f45);}(_0xce29,0x149));var _0x9ce2=function(_0x5f3475,_0x47b7fd){_0x5f3475=_0x5f3475-0x0;var _0x109552=_0xce29[_0x5f3475];return _0x109552;};'use strict';var ChatInteractionEvents=require(_0x9ce2('0x0'));var events=['save',_0x9ce2('0x1'),_0x9ce2('0x2')];function createListener(_0x334f63,_0x67cb94){return function(_0x44b8a4){_0x67cb94[_0x9ce2('0x3')](_0x334f63,_0x44b8a4);};}function removeListener(_0x527179,_0xe8fa2a){return function(){ChatInteractionEvents[_0x9ce2('0x4')](_0x527179,_0xe8fa2a);};}exports[_0x9ce2('0x5')]=function(_0x63263c){for(var _0x969769=0x0,_0x2eb9b8=events[_0x9ce2('0x6')];_0x969769<_0x2eb9b8;_0x969769++){var _0x4c4b47=events[_0x969769];var _0x4acd76=createListener(_0x9ce2('0x7')+_0x4c4b47,_0x63263c);ChatInteractionEvents['on'](_0x4c4b47,_0x4acd76);}}; \ No newline at end of file +var _0xb1bc=['update','emit','removeListener','register','length','chatInteraction:','save','remove'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0xb1bc,0x19e));var _0xcb1b=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xb1bc[_0xfedc72];return _0x2c7c78;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xcb1b('0x0'),_0xcb1b('0x1'),_0xcb1b('0x2')];function createListener(_0x88be46,_0x256b24){return function(_0x541bbf){_0x256b24[_0xcb1b('0x3')](_0x88be46,_0x541bbf);};}function removeListener(_0x1435a9,_0x5a433d){return function(){ChatInteractionEvents[_0xcb1b('0x4')](_0x1435a9,_0x5a433d);};}exports[_0xcb1b('0x5')]=function(_0x117a44){for(var _0x213542=0x0,_0x505948=events[_0xcb1b('0x6')];_0x213542<_0x505948;_0x213542++){var _0x166ae0=events[_0x213542];var _0x567e94=createListener(_0xcb1b('0x7')+_0x166ae0,_0x117a44);ChatInteractionEvents['on'](_0x166ae0,_0x567e94);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 41b35dd..6cb7e71 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 _0xa6bf=['download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','close','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download'];(function(_0x4f086d,_0x20b8ca){var _0x42fa32=function(_0x33c404){while(--_0x33c404){_0x4f086d['push'](_0x4f086d['shift']());}};_0x42fa32(++_0x20b8ca);}(_0xa6bf,0xa9));var _0xfa6b=function(_0x176b77,_0x2e2f21){_0x176b77=_0x176b77-0x0;var _0x32f688=_0xa6bf[_0x176b77];return _0x32f688;};'use strict';var multer=require(_0xfa6b('0x0'));var util=require(_0xfa6b('0x1'));var path=require(_0xfa6b('0x2'));var timeout=require(_0xfa6b('0x3'));var express=require(_0xfa6b('0x4'));var router=express['Router']();var auth=require(_0xfa6b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfa6b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfa6b('0x7')]('/describe',auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x9')]);router[_0xfa6b('0x7')](_0xfa6b('0xa'),auth[_0xfa6b('0xb')](),controller[_0xfa6b('0xc')]);router['get'](_0xfa6b('0xd'),auth[_0xfa6b('0xb')](),controller[_0xfa6b('0xe')]);router[_0xfa6b('0x7')](_0xfa6b('0xf'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x10')]);router['get'](_0xfa6b('0x11'),auth[_0xfa6b('0xb')](),controller['getMyMessages']);router[_0xfa6b('0x7')](_0xfa6b('0x12'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x13')]);router[_0xfa6b('0x14')]('/',auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x15')]);router['post'](_0xfa6b('0x16'),auth[_0xfa6b('0x8')](),controller[_0xfa6b('0x17')]);var upload=multer({'storage':multer[_0xfa6b('0x18')]({'destination':function(_0x229f55,_0x28a470,_0x1349ce){_0x1349ce(null,path['join'](config[_0xfa6b('0x19')],_0xfa6b('0x1a')));},'filename':function(_0x1180f8,_0x581b3e,_0x52d079){_0x52d079(null,util[_0xfa6b('0x1b')](_0xfa6b('0x1c'),Date[_0xfa6b('0x1d')](),_0x581b3e[_0xfa6b('0x1e')][_0xfa6b('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfa6b('0x14')]('/:id/attachment_upload',upload[_0xfa6b('0x20')]('file'),controller[_0xfa6b('0x21')]);router['post']('/:id/messages',auth[_0xfa6b('0xb')](),controller['addMessage']);router[_0xfa6b('0x14')](_0xfa6b('0x22'),auth[_0xfa6b('0x8')](),interaction[_0xfa6b('0x23')](_0xfa6b('0x24'),_0xfa6b('0x25')),controller[_0xfa6b('0x26')]);router[_0xfa6b('0x27')](_0xfa6b('0xa'),auth['isAuthenticated'](),interaction[_0xfa6b('0x23')](_0xfa6b('0x24'),_0xfa6b('0x28')),controller[_0xfa6b('0x29')]);router['put'](_0xfa6b('0x2a'),controller['customUpdate']);router[_0xfa6b('0x27')]('/:id/abandon',auth[_0xfa6b('0xb')](),controller['abandon']);router[_0xfa6b('0x27')]('/:id/close',controller[_0xfa6b('0x2b')]);router[_0xfa6b('0x2c')](_0xfa6b('0xa'),auth[_0xfa6b('0x8')](),interaction[_0xfa6b('0x23')](_0xfa6b('0x24'),'chatinteraction:destroy'),controller[_0xfa6b('0x2d')]);router['delete'](_0xfa6b('0x22'),auth['isAuthenticated'](),controller['removeTags']);module[_0xfa6b('0x2e')]=router; \ No newline at end of file +var _0x5243=['delete','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5243,0x135));var _0x3524=function(_0x194a06,_0xbede20){_0x194a06=_0x194a06-0x0;var _0x1feb90=_0x5243[_0x194a06];return _0x1feb90;};'use strict';var multer=require(_0x3524('0x0'));var util=require(_0x3524('0x1'));var path=require('path');var timeout=require(_0x3524('0x2'));var express=require(_0x3524('0x3'));var router=express['Router']();var auth=require(_0x3524('0x4'));var interaction=require(_0x3524('0x5'));var config=require('../../config/environment');var controller=require(_0x3524('0x6'));router[_0x3524('0x7')]('/',auth[_0x3524('0x8')](),controller[_0x3524('0x9')]);router[_0x3524('0x7')]('/describe',auth[_0x3524('0x8')](),controller['describe']);router['get'](_0x3524('0xa'),auth[_0x3524('0xb')](),controller['show']);router[_0x3524('0x7')](_0x3524('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x3524('0xd')]);router['get'](_0x3524('0xe'),auth['isAuthenticated'](),controller[_0x3524('0xf')]);router[_0x3524('0x7')](_0x3524('0x10'),auth[_0x3524('0xb')](),controller['getMyMessages']);router[_0x3524('0x7')](_0x3524('0x11'),auth[_0x3524('0x8')](),controller[_0x3524('0x12')]);router['post']('/',auth[_0x3524('0x8')](),controller[_0x3524('0x13')]);router[_0x3524('0x14')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x3524('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf25214,_0x23fd2c,_0x37784e){_0x37784e(null,path[_0x3524('0x16')](config[_0x3524('0x17')],_0x3524('0x18')));},'filename':function(_0x5c1ddb,_0x55a3e8,_0x17adc3){_0x17adc3(null,util[_0x3524('0x19')](_0x3524('0x1a'),Date['now'](),_0x55a3e8[_0x3524('0x1b')][_0x3524('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x3524('0x1d'),upload[_0x3524('0x1e')](_0x3524('0x1f')),controller[_0x3524('0x20')]);router[_0x3524('0x14')](_0x3524('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x3524('0x21')]);router[_0x3524('0x14')](_0x3524('0x22'),auth[_0x3524('0x8')](),interaction[_0x3524('0x23')](_0x3524('0x24'),_0x3524('0x25')),controller[_0x3524('0x26')]);router[_0x3524('0x27')]('/:id',auth[_0x3524('0x8')](),interaction['tracked'](_0x3524('0x24'),'chatinteraction:update'),controller['update']);router[_0x3524('0x27')](_0x3524('0x28'),controller[_0x3524('0x29')]);router[_0x3524('0x27')](_0x3524('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0x3524('0x2b')]);router['put'](_0x3524('0x2c'),controller[_0x3524('0x2d')]);router['delete'](_0x3524('0xa'),auth[_0x3524('0x8')](),interaction[_0x3524('0x23')](_0x3524('0x24'),_0x3524('0x2e')),controller[_0x3524('0x2f')]);router[_0x3524('0x30')](_0x3524('0x22'),auth['isAuthenticated'](),controller[_0x3524('0x31')]);module[_0x3524('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4af150d..dfb036a 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 _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x20e625,_0x42306c){var _0x2a6e2e=function(_0x1e6208){while(--_0x1e6208){_0x20e625['push'](_0x20e625['shift']());}};_0x2a6e2e(++_0x42306c);}(_0xdb28,0x106));var _0x8db2=function(_0x35dfdd,_0x548e6f){_0x35dfdd=_0x35dfdd-0x0;var _0x176459=_0xdb28[_0x35dfdd];return _0x176459;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file +var _0x0295=['sequelize','medium'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0295,0x1f0));var _0x5029=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0x0295[_0x4583d0];return _0x7b3c5a;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f99dcd3..6df82a3 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 _0x13a7=['send','map','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','options','count','includeAll','include','ChatInternalMessage','findAll','show','params','rawAttributes','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','role','userpic','internal','online','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','sort','all','html-pdf','eml-format','request-promise','moment','mustache','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','Content-Range','update','then','destroy','error','stack','name'];(function(_0x4d9a81,_0x76b53f){var _0x4c4431=function(_0x5daa59){while(--_0x5daa59){_0x4d9a81['push'](_0x4d9a81['shift']());}};_0x4c4431(++_0x76b53f);}(_0x13a7,0x16b));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x713a('0x0'));var emlformat=require(_0x713a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x713a('0x2'));var moment=require(_0x713a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x713a('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x713a('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x713a('0x6'));var crypto=require(_0x713a('0x7'));var jsforce=require(_0x713a('0x8'));var deskjs=require(_0x713a('0x9'));var toCsv=require(_0x713a('0x5'));var querystring=require(_0x713a('0xa'));var Papa=require('papaparse');var Redis=require(_0x713a('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x713a('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x713a('0xd'))(_0x713a('0xe'));var utils=require(_0x713a('0xf'));var config=require(_0x713a('0x10'));var licenseUtil=require(_0x713a('0x11'));var db=require(_0x713a('0x12'))['db'];config['redis']=_[_0x713a('0x13')](config[_0x713a('0x14')],{'host':_0x713a('0x15'),'port':0x18eb});var socket=require(_0x713a('0x16'))(new Redis(config[_0x713a('0x14')]));require(_0x713a('0x17'))[_0x713a('0x18')](socket);function respondWithStatusCode(_0x38e0fc,_0x49e82d){_0x49e82d=_0x49e82d||0xcc;return function(_0x449f45){if(_0x449f45){return _0x38e0fc[_0x713a('0x19')](_0x49e82d);}return _0x38e0fc[_0x713a('0x1a')](_0x49e82d)[_0x713a('0x1b')]();};}function respondWithResult(_0x40586c,_0xcc8ecb){_0xcc8ecb=_0xcc8ecb||0xc8;return function(_0x20ab54){if(_0x20ab54){return _0x40586c[_0x713a('0x1a')](_0xcc8ecb)[_0x713a('0x1c')](_0x20ab54);}};}function respondWithFilteredResult(_0x219fac,_0x445996){return function(_0x54fd1a){if(_0x54fd1a){var _0x5a6f88=_0x54fd1a['count'],_0x495903=_0x445996[_0x713a('0x1d')],_0x4c2a31=_0x445996['offset']+_0x445996['limit'],_0x575972;if(_0x4c2a31>=_0x5a6f88){_0x4c2a31=_0x5a6f88;_0x575972=0xc8;}else{_0x575972=0xce;}_0x219fac[_0x713a('0x1a')](_0x575972);return _0x219fac['set'](_0x713a('0x1e'),_0x495903+'-'+_0x4c2a31+'/'+_0x5a6f88)[_0x713a('0x1c')](_0x54fd1a);}return null;};}function patchUpdates(_0x43cfd6){return function(_0x5be5a6){try{jsonpatch['apply'](_0x5be5a6,_0x43cfd6,!![]);}catch(_0x4ae817){return BPromise['reject'](_0x4ae817);}return _0x5be5a6['save']();};}function saveUpdates(_0x46d3ec,_0x301997){return function(_0x2caa08){if(_0x2caa08){return _0x2caa08[_0x713a('0x1f')](_0x46d3ec)[_0x713a('0x20')](function(_0x1e6ae6){return _0x1e6ae6;});}return null;};}function removeEntity(_0x3fe18f,_0x8f7e2b){return function(_0x1a6bf1){if(_0x1a6bf1){return _0x1a6bf1[_0x713a('0x21')]()[_0x713a('0x20')](function(){_0x3fe18f[_0x713a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582785,_0x12cbe2){return function(_0x498a5d){if(!_0x498a5d){_0x582785[_0x713a('0x19')](0x194);}return _0x498a5d;};}function handleError(_0x28b433,_0x598506){_0x598506=_0x598506||0x1f4;return function(_0x19e254){logger[_0x713a('0x22')](_0x19e254[_0x713a('0x23')]);if(_0x19e254[_0x713a('0x24')]){delete _0x19e254[_0x713a('0x24')];}_0x28b433[_0x713a('0x1a')](_0x598506)[_0x713a('0x25')](_0x19e254);};}exports['index']=function(_0x530161,_0x250432){var _0x2a12ab={},_0x2123c0={},_0x21c66d={'count':0x0,'rows':[]};var _0x89b6cc=_[_0x713a('0x26')](db['ChatInternalMessage']['rawAttributes'],function(_0x4482f2){return{'name':_0x4482f2[_0x713a('0x27')],'type':_0x4482f2[_0x713a('0x28')][_0x713a('0x29')]};});_0x2123c0[_0x713a('0x2a')]=_[_0x713a('0x26')](_0x89b6cc,_0x713a('0x24'));_0x2123c0['query']=_[_0x713a('0x2b')](_0x530161[_0x713a('0x2c')]);_0x2123c0['filters']=_['intersection'](_0x2123c0[_0x713a('0x2a')],_0x2123c0[_0x713a('0x2c')]);_0x2a12ab[_0x713a('0x2d')]=_[_0x713a('0x2e')](_0x2123c0['model'],qs[_0x713a('0x2f')](_0x530161['query'][_0x713a('0x2f')]));_0x2a12ab[_0x713a('0x2d')]=_0x2a12ab[_0x713a('0x2d')][_0x713a('0x30')]?_0x2a12ab[_0x713a('0x2d')]:_0x2123c0[_0x713a('0x2a')];if(!_0x530161[_0x713a('0x2c')][_0x713a('0x31')](_0x713a('0x32'))){_0x2a12ab[_0x713a('0x33')]=qs[_0x713a('0x33')](_0x530161[_0x713a('0x2c')][_0x713a('0x33')]);_0x2a12ab[_0x713a('0x1d')]=qs['offset'](_0x530161[_0x713a('0x2c')][_0x713a('0x1d')]);}_0x2a12ab[_0x713a('0x34')]=qs['sort'](_0x530161['query']['sort']);_0x2a12ab[_0x713a('0x35')]=qs[_0x713a('0x36')](_[_0x713a('0x37')](_0x530161['query'],_0x2123c0['filters']),_0x89b6cc);if(_0x530161[_0x713a('0x2c')][_0x713a('0x38')]){_0x2a12ab[_0x713a('0x35')]=_[_0x713a('0x39')](_0x2a12ab[_0x713a('0x35')],{'$or':_['map'](_0x89b6cc,function(_0x9c97c3){if(_0x9c97c3[_0x713a('0x28')]!=='VIRTUAL'){var _0x4f4be5={};_0x4f4be5[_0x9c97c3[_0x713a('0x24')]]={'$like':'%'+_0x530161['query'][_0x713a('0x38')]+'%'};return _0x4f4be5;}})});}_0x2a12ab=_['merge']({},_0x2a12ab,_0x530161[_0x713a('0x3a')]);var _0x33f9b4={'where':_0x2a12ab[_0x713a('0x35')]};return db['ChatInternalMessage'][_0x713a('0x3b')](_0x33f9b4)[_0x713a('0x20')](function(_0x1a9e3a){_0x21c66d[_0x713a('0x3b')]=_0x1a9e3a;if(_0x530161['query'][_0x713a('0x3c')]){_0x2a12ab[_0x713a('0x3d')]=[{'all':!![]}];}return db[_0x713a('0x3e')][_0x713a('0x3f')](_0x2a12ab);})[_0x713a('0x20')](function(_0x447261){_0x21c66d['rows']=_0x447261;return _0x21c66d;})[_0x713a('0x20')](respondWithFilteredResult(_0x250432,_0x2a12ab))['catch'](handleError(_0x250432,null));};exports[_0x713a('0x40')]=function(_0x4b1a04,_0x3a1f46){var _0x26b1ab={'raw':!![],'where':{'id':_0x4b1a04[_0x713a('0x41')]['id']}},_0x4ae1d9={};_0x4ae1d9[_0x713a('0x2a')]=_['keys'](db[_0x713a('0x3e')][_0x713a('0x42')]);_0x4ae1d9[_0x713a('0x2c')]=_['keys'](_0x4b1a04[_0x713a('0x2c')]);_0x4ae1d9['filters']=_[_0x713a('0x2e')](_0x4ae1d9[_0x713a('0x2a')],_0x4ae1d9['query']);_0x26b1ab[_0x713a('0x2d')]=_['intersection'](_0x4ae1d9['model'],qs[_0x713a('0x2f')](_0x4b1a04[_0x713a('0x2c')][_0x713a('0x2f')]));_0x26b1ab['attributes']=_0x26b1ab[_0x713a('0x2d')]['length']?_0x26b1ab['attributes']:_0x4ae1d9['model'];if(_0x4b1a04[_0x713a('0x2c')][_0x713a('0x3c')]){_0x26b1ab[_0x713a('0x3d')]=[{'all':!![]}];}_0x26b1ab=_[_0x713a('0x39')]({},_0x26b1ab,_0x4b1a04[_0x713a('0x3a')]);return db[_0x713a('0x3e')][_0x713a('0x43')](_0x26b1ab)[_0x713a('0x20')](handleEntityNotFound(_0x3a1f46,null))[_0x713a('0x20')](respondWithResult(_0x3a1f46,null))[_0x713a('0x44')](handleError(_0x3a1f46,null));};exports[_0x713a('0x45')]=function(_0x5ed1f8,_0x22d5a7){return db[_0x713a('0x3e')][_0x713a('0x45')](_0x5ed1f8[_0x713a('0x46')],{})['then'](respondWithResult(_0x22d5a7,0xc9))[_0x713a('0x44')](handleError(_0x22d5a7,null));};exports['update']=function(_0x288561,_0x314970){if(_0x288561[_0x713a('0x46')]['id']){delete _0x288561[_0x713a('0x46')]['id'];}return db['ChatInternalMessage'][_0x713a('0x43')]({'where':{'id':_0x288561[_0x713a('0x41')]['id']}})['then'](handleEntityNotFound(_0x314970,null))[_0x713a('0x20')](saveUpdates(_0x288561['body'],null))[_0x713a('0x20')](respondWithResult(_0x314970,null))[_0x713a('0x44')](handleError(_0x314970,null));};exports[_0x713a('0x21')]=function(_0x335eae,_0x1dd134){return db[_0x713a('0x3e')][_0x713a('0x43')]({'where':{'id':_0x335eae['params']['id']}})[_0x713a('0x20')](handleEntityNotFound(_0x1dd134,null))['then'](removeEntity(_0x1dd134,null))[_0x713a('0x44')](handleError(_0x1dd134,null));};exports[_0x713a('0x47')]=function(_0x2e562d,_0x310b5e){return db['ChatInternalMessage'][_0x713a('0x47')]()[_0x713a('0x20')](respondWithResult(_0x310b5e,null))['catch'](handleError(_0x310b5e,null));};function wrapUser(_0x1cdb25){return function(_0x2f2850){var _0x319ce4=_0x1cdb25[_0x713a('0x48')]({'plain':!![]});_0x319ce4[_0x713a('0x49')]=[];if(_0x2f2850){_0x319ce4[_0x713a('0x4a')]=_0x2f2850[_0x713a('0x4b')];_0x319ce4['lastMessage']=_0x2f2850;}else{_0x319ce4[_0x713a('0x4a')]=moment(0x0)[_0x713a('0x4c')](_0x713a('0x4d'));_0x319ce4['lastMessage']={};}return _0x319ce4;};}exports[_0x713a('0x4e')]=function(_0x933577,_0x81eac4,_0x5323ae){var _0x49faa3=[];return db['User']['findAll']({'where':{'role':[_0x713a('0x4f'),_0x713a('0x50'),_0x713a('0x51')]},'attributes':['id','fullname','name',_0x713a('0x52'),_0x713a('0x53'),_0x713a('0x54'),_0x713a('0x55'),'lastLoginAt',_0x713a('0x56'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0x713a('0x57')],'as':_0x713a('0x58'),'attributes':['id','name',_0x713a('0x28')],'through':{'attributes':[]}}]})[_0x713a('0x20')](function(_0x2795f5){if(_0x2795f5){var _0x3ab420=_0x933577[_0x713a('0x51')]['get']({'plain':!![]});if(!_0x3ab420)throw new Error(_0x713a('0x59'));if(_0x3ab420[_0x713a('0x52')]===_0x713a('0x51')){return db[_0x713a('0x5a')][_0x713a('0x43')]({'where':{'name':'Agents','userProfileId':_0x3ab420[_0x713a('0x5b')]},'raw':!![]})[_0x713a('0x20')](function(_0x29dff1){if(_0x29dff1){if(_0x29dff1[_0x713a('0x5c')]===0x0){return db[_0x713a('0x5d')]['findAll']({'where':{'sectionId':_0x29dff1['id']},'raw':!![]})[_0x713a('0x20')](function(_0x1145ea){var _0x18bf6b=[];if(_[_0x713a('0x5e')](_0x1145ea)){_0x18bf6b=_['filter'](_0x2795f5,function(_0x2e7e02){if(_0x2e7e02[_0x713a('0x52')]!==_0x713a('0x4f')){return _0x2e7e02;}});return _0x18bf6b;}else{for(var _0x32bc3c=0x0;_0x32bc3c<_0x2795f5[_0x713a('0x30')];_0x32bc3c++){var _0x2bdc51=_0x2795f5[_0x32bc3c];if(_0x2bdc51[_0x713a('0x52')]===_0x713a('0x4f')){var _0x57ae0f=_[_0x713a('0x43')](_0x1145ea,function(_0x5b274c){return _0x5b274c['resourceId']===_0x2bdc51['id'];});if(_0x57ae0f)_0x18bf6b['push'](_0x2bdc51);}else{_0x18bf6b[_0x713a('0x5f')](_0x2bdc51);}}return _0x18bf6b;}});}else{return _0x2795f5;}}else{var _0x5c1fa6=_[_0x713a('0x38')](_0x2795f5,function(_0x4544a5){if(_0x4544a5['role']!==_0x713a('0x4f')){return _0x4544a5;}});return _0x5c1fa6;}});}else{return _0x2795f5;}}})[_0x713a('0x20')](function(_0x5a221e){var _0x30e8c0=[];if(_0x5a221e){_0x49faa3=_0x5a221e;for(var _0x5e113e=0x0;_0x5e113e<_0x5a221e[_0x713a('0x30')];_0x5e113e+=0x1){_0x49faa3[_0x5e113e][_0x713a('0x49')]=[];_0x30e8c0[_0x713a('0x5f')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x933577[_0x713a('0x51')]['id'],_0x5a221e[_0x5e113e]['id']],'ToId':[_0x933577[_0x713a('0x51')]['id'],_0x5a221e[_0x5e113e]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x713a('0x60'),'ToId',_0x713a('0x61'),_0x713a('0x46')],'order':qs[_0x713a('0x62')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x713a('0x20')](wrapUser(_0x5a221e[_0x5e113e])));}return BPromise[_0x713a('0x63')](_0x30e8c0);}return[];})[_0x713a('0x20')](function(_0x5d9061){return{'rows':_0x5d9061,'count':_0x5d9061[_0x713a('0x30')]};})[_0x713a('0x20')](respondWithResult(_0x81eac4,null))[_0x713a('0x44')](handleError(_0x81eac4,null));}; \ No newline at end of file +var _0x7775=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','status','end','json','offset','limit','Content-Range','apply','save','then','error','stack','name','send','index','ChatInternalMessage','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find','catch','create','body','update','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf'];(function(_0x1d66ae,_0x1a45c7){var _0x33f473=function(_0x197cf9){while(--_0x197cf9){_0x1d66ae['push'](_0x1d66ae['shift']());}};_0x33f473(++_0x1a45c7);}(_0x7775,0xd0));var _0x5777=function(_0x49ee49,_0x102fb1){_0x49ee49=_0x49ee49-0x0;var _0x5e901c=_0x7775[_0x49ee49];return _0x5e901c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5777('0x0'));var rimraf=require(_0x5777('0x1'));var zipdir=require(_0x5777('0x2'));var jsonpatch=require(_0x5777('0x3'));var rp=require(_0x5777('0x4'));var moment=require(_0x5777('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5777('0x6'));var util=require('util');var path=require(_0x5777('0x7'));var sox=require(_0x5777('0x8'));var csv=require(_0x5777('0x9'));var ejs=require(_0x5777('0xa'));var fs=require('fs');var _=require(_0x5777('0xb'));var squel=require(_0x5777('0xc'));var crypto=require('crypto');var jsforce=require(_0x5777('0xd'));var deskjs=require(_0x5777('0xe'));var toCsv=require(_0x5777('0x9'));var querystring=require(_0x5777('0xf'));var Papa=require(_0x5777('0x10'));var Redis=require(_0x5777('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5777('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5777('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5777('0x14'))['db'];config[_0x5777('0x15')]=_[_0x5777('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5777('0x15')]));require(_0x5777('0x17'))[_0x5777('0x18')](socket);function respondWithStatusCode(_0xfbd8c6,_0x2faaad){_0x2faaad=_0x2faaad||0xcc;return function(_0xeb2006){if(_0xeb2006){return _0xfbd8c6['sendStatus'](_0x2faaad);}return _0xfbd8c6[_0x5777('0x19')](_0x2faaad)[_0x5777('0x1a')]();};}function respondWithResult(_0x30588e,_0x4f4238){_0x4f4238=_0x4f4238||0xc8;return function(_0x4c5896){if(_0x4c5896){return _0x30588e[_0x5777('0x19')](_0x4f4238)[_0x5777('0x1b')](_0x4c5896);}};}function respondWithFilteredResult(_0xd6e2e2,_0x3dd8a7){return function(_0x5d9215){if(_0x5d9215){var _0x59ed41=_0x5d9215['count'],_0x5b6807=_0x3dd8a7[_0x5777('0x1c')],_0x52886f=_0x3dd8a7[_0x5777('0x1c')]+_0x3dd8a7[_0x5777('0x1d')],_0x44f085;if(_0x52886f>=_0x59ed41){_0x52886f=_0x59ed41;_0x44f085=0xc8;}else{_0x44f085=0xce;}_0xd6e2e2['status'](_0x44f085);return _0xd6e2e2['set'](_0x5777('0x1e'),_0x5b6807+'-'+_0x52886f+'/'+_0x59ed41)['json'](_0x5d9215);}return null;};}function patchUpdates(_0xc924c8){return function(_0x1af96a){try{jsonpatch[_0x5777('0x1f')](_0x1af96a,_0xc924c8,!![]);}catch(_0x445664){return BPromise['reject'](_0x445664);}return _0x1af96a[_0x5777('0x20')]();};}function saveUpdates(_0x7c694f,_0x47e0ae){return function(_0x6262cb){if(_0x6262cb){return _0x6262cb['update'](_0x7c694f)['then'](function(_0x1b4d78){return _0x1b4d78;});}return null;};}function removeEntity(_0x4f5f13,_0x469d4){return function(_0x8c94b){if(_0x8c94b){return _0x8c94b['destroy']()[_0x5777('0x21')](function(){_0x4f5f13['status'](0xcc)[_0x5777('0x1a')]();});}};}function handleEntityNotFound(_0x4b5c2a,_0x5e77a3){return function(_0x5d0b18){if(!_0x5d0b18){_0x4b5c2a['sendStatus'](0x194);}return _0x5d0b18;};}function handleError(_0x59b86a,_0x4b622c){_0x4b622c=_0x4b622c||0x1f4;return function(_0x5961c7){logger[_0x5777('0x22')](_0x5961c7[_0x5777('0x23')]);if(_0x5961c7['name']){delete _0x5961c7[_0x5777('0x24')];}_0x59b86a[_0x5777('0x19')](_0x4b622c)[_0x5777('0x25')](_0x5961c7);};}exports[_0x5777('0x26')]=function(_0x49bdcf,_0x4aa183){var _0x4cc0b3={},_0x44cac8={},_0x42151d={'count':0x0,'rows':[]};var _0x2b8f30=_['map'](db[_0x5777('0x27')]['rawAttributes'],function(_0xbdfb79){return{'name':_0xbdfb79['fieldName'],'type':_0xbdfb79['type']['key']};});_0x44cac8['model']=_[_0x5777('0x28')](_0x2b8f30,_0x5777('0x24'));_0x44cac8['query']=_['keys'](_0x49bdcf[_0x5777('0x29')]);_0x44cac8['filters']=_[_0x5777('0x2a')](_0x44cac8[_0x5777('0x2b')],_0x44cac8[_0x5777('0x29')]);_0x4cc0b3[_0x5777('0x2c')]=_[_0x5777('0x2a')](_0x44cac8[_0x5777('0x2b')],qs['fields'](_0x49bdcf[_0x5777('0x29')][_0x5777('0x2d')]));_0x4cc0b3[_0x5777('0x2c')]=_0x4cc0b3[_0x5777('0x2c')]['length']?_0x4cc0b3['attributes']:_0x44cac8['model'];if(!_0x49bdcf[_0x5777('0x29')][_0x5777('0x2e')](_0x5777('0x2f'))){_0x4cc0b3[_0x5777('0x1d')]=qs['limit'](_0x49bdcf[_0x5777('0x29')]['limit']);_0x4cc0b3['offset']=qs[_0x5777('0x1c')](_0x49bdcf[_0x5777('0x29')][_0x5777('0x1c')]);}_0x4cc0b3['order']=qs[_0x5777('0x30')](_0x49bdcf[_0x5777('0x29')]['sort']);_0x4cc0b3[_0x5777('0x31')]=qs[_0x5777('0x32')](_['pick'](_0x49bdcf['query'],_0x44cac8[_0x5777('0x32')]),_0x2b8f30);if(_0x49bdcf[_0x5777('0x29')][_0x5777('0x33')]){_0x4cc0b3['where']=_[_0x5777('0x34')](_0x4cc0b3['where'],{'$or':_[_0x5777('0x28')](_0x2b8f30,function(_0x5ba619){if(_0x5ba619['type']!==_0x5777('0x35')){var _0x4db28f={};_0x4db28f[_0x5ba619[_0x5777('0x24')]]={'$like':'%'+_0x49bdcf[_0x5777('0x29')]['filter']+'%'};return _0x4db28f;}})});}_0x4cc0b3=_[_0x5777('0x34')]({},_0x4cc0b3,_0x49bdcf[_0x5777('0x36')]);var _0x3be134={'where':_0x4cc0b3[_0x5777('0x31')]};return db['ChatInternalMessage'][_0x5777('0x37')](_0x3be134)[_0x5777('0x21')](function(_0x5045a7){_0x42151d[_0x5777('0x37')]=_0x5045a7;if(_0x49bdcf['query'][_0x5777('0x38')]){_0x4cc0b3[_0x5777('0x39')]=[{'all':!![]}];}return db[_0x5777('0x27')][_0x5777('0x3a')](_0x4cc0b3);})[_0x5777('0x21')](function(_0x52d11e){_0x42151d[_0x5777('0x3b')]=_0x52d11e;return _0x42151d;})['then'](respondWithFilteredResult(_0x4aa183,_0x4cc0b3))['catch'](handleError(_0x4aa183,null));};exports[_0x5777('0x3c')]=function(_0xe75b6a,_0x55cc10){var _0x2a4bec={'raw':!![],'where':{'id':_0xe75b6a[_0x5777('0x3d')]['id']}},_0x173b8a={};_0x173b8a[_0x5777('0x2b')]=_[_0x5777('0x3e')](db[_0x5777('0x27')][_0x5777('0x3f')]);_0x173b8a['query']=_[_0x5777('0x3e')](_0xe75b6a['query']);_0x173b8a['filters']=_[_0x5777('0x2a')](_0x173b8a[_0x5777('0x2b')],_0x173b8a[_0x5777('0x29')]);_0x2a4bec[_0x5777('0x2c')]=_[_0x5777('0x2a')](_0x173b8a[_0x5777('0x2b')],qs[_0x5777('0x2d')](_0xe75b6a[_0x5777('0x29')][_0x5777('0x2d')]));_0x2a4bec[_0x5777('0x2c')]=_0x2a4bec[_0x5777('0x2c')][_0x5777('0x40')]?_0x2a4bec[_0x5777('0x2c')]:_0x173b8a[_0x5777('0x2b')];if(_0xe75b6a[_0x5777('0x29')][_0x5777('0x38')]){_0x2a4bec['include']=[{'all':!![]}];}_0x2a4bec=_[_0x5777('0x34')]({},_0x2a4bec,_0xe75b6a[_0x5777('0x36')]);return db[_0x5777('0x27')][_0x5777('0x41')](_0x2a4bec)[_0x5777('0x21')](handleEntityNotFound(_0x55cc10,null))[_0x5777('0x21')](respondWithResult(_0x55cc10,null))[_0x5777('0x42')](handleError(_0x55cc10,null));};exports['create']=function(_0xa436db,_0x22a03a){return db[_0x5777('0x27')][_0x5777('0x43')](_0xa436db[_0x5777('0x44')],{})[_0x5777('0x21')](respondWithResult(_0x22a03a,0xc9))[_0x5777('0x42')](handleError(_0x22a03a,null));};exports[_0x5777('0x45')]=function(_0x371494,_0x3527d5){if(_0x371494[_0x5777('0x44')]['id']){delete _0x371494[_0x5777('0x44')]['id'];}return db['ChatInternalMessage'][_0x5777('0x41')]({'where':{'id':_0x371494[_0x5777('0x3d')]['id']}})[_0x5777('0x21')](handleEntityNotFound(_0x3527d5,null))[_0x5777('0x21')](saveUpdates(_0x371494[_0x5777('0x44')],null))[_0x5777('0x21')](respondWithResult(_0x3527d5,null))['catch'](handleError(_0x3527d5,null));};exports[_0x5777('0x46')]=function(_0x44bb8d,_0x28191b){return db[_0x5777('0x27')][_0x5777('0x41')]({'where':{'id':_0x44bb8d[_0x5777('0x3d')]['id']}})[_0x5777('0x21')](handleEntityNotFound(_0x28191b,null))[_0x5777('0x21')](removeEntity(_0x28191b,null))[_0x5777('0x42')](handleError(_0x28191b,null));};exports[_0x5777('0x47')]=function(_0x2c8c49,_0x572ecd){return db[_0x5777('0x27')]['describe']()[_0x5777('0x21')](respondWithResult(_0x572ecd,null))[_0x5777('0x42')](handleError(_0x572ecd,null));};function wrapUser(_0x3d0c43){return function(_0x5b97e6){var _0x5a96a7=_0x3d0c43[_0x5777('0x48')]({'plain':!![]});_0x5a96a7[_0x5777('0x49')]=[];if(_0x5b97e6){_0x5a96a7[_0x5777('0x4a')]=_0x5b97e6[_0x5777('0x4b')];_0x5a96a7[_0x5777('0x4c')]=_0x5b97e6;}else{_0x5a96a7[_0x5777('0x4a')]=moment(0x0)[_0x5777('0x4d')](_0x5777('0x4e'));_0x5a96a7[_0x5777('0x4c')]={};}return _0x5a96a7;};}exports[_0x5777('0x4f')]=function(_0x362297,_0x1f65d8,_0x128ecf){var _0x268e40=[];return db['User']['findAll']({'where':{'role':[_0x5777('0x50'),_0x5777('0x51'),_0x5777('0x52')]},'attributes':['id',_0x5777('0x53'),_0x5777('0x24'),_0x5777('0x54'),_0x5777('0x55'),_0x5777('0x56'),_0x5777('0x57'),_0x5777('0x58'),_0x5777('0x59'),_0x5777('0x5a')],'order':qs[_0x5777('0x30')](_0x5777('0x5b')),'include':[{'model':db[_0x5777('0x5c')],'as':_0x5777('0x5d'),'attributes':['id',_0x5777('0x24'),_0x5777('0x5e')],'through':{'attributes':[]}}]})[_0x5777('0x21')](function(_0x4780cf){if(_0x4780cf){var _0x422305=_0x362297[_0x5777('0x52')][_0x5777('0x48')]({'plain':!![]});if(!_0x422305)throw new Error(_0x5777('0x5f'));if(_0x422305[_0x5777('0x54')]===_0x5777('0x52')){return db[_0x5777('0x60')]['find']({'where':{'name':_0x5777('0x61'),'userProfileId':_0x422305[_0x5777('0x62')]},'raw':!![]})['then'](function(_0x3c3930){if(_0x3c3930){if(_0x3c3930['autoAssociation']===0x0){return db['UserProfileResource'][_0x5777('0x3a')]({'where':{'sectionId':_0x3c3930['id']},'raw':!![]})['then'](function(_0xde259f){var _0x3d65fd=[];if(_['isEmpty'](_0xde259f)){_0x3d65fd=_[_0x5777('0x33')](_0x4780cf,function(_0x44f408){if(_0x44f408[_0x5777('0x54')]!==_0x5777('0x50')){return _0x44f408;}});return _0x3d65fd;}else{for(var _0x8bc86=0x0;_0x8bc86<_0x4780cf[_0x5777('0x40')];_0x8bc86++){var _0x1dd70c=_0x4780cf[_0x8bc86];if(_0x1dd70c[_0x5777('0x54')]==='agent'){var _0x4a0962=_[_0x5777('0x41')](_0xde259f,function(_0x422677){return _0x422677[_0x5777('0x63')]===_0x1dd70c['id'];});if(_0x4a0962)_0x3d65fd[_0x5777('0x64')](_0x1dd70c);}else{_0x3d65fd['push'](_0x1dd70c);}}return _0x3d65fd;}});}else{return _0x4780cf;}}else{var _0x2b1506=_[_0x5777('0x33')](_0x4780cf,function(_0x3cf49a){if(_0x3cf49a[_0x5777('0x54')]!=='agent'){return _0x3cf49a;}});return _0x2b1506;}});}else{return _0x4780cf;}}})[_0x5777('0x21')](function(_0x155cd8){var _0x1e01b0=[];if(_0x155cd8){_0x268e40=_0x155cd8;for(var _0x5b938a=0x0;_0x5b938a<_0x155cd8[_0x5777('0x40')];_0x5b938a+=0x1){_0x268e40[_0x5b938a][_0x5777('0x49')]=[];_0x1e01b0[_0x5777('0x64')](db[_0x5777('0x27')][_0x5777('0x41')]({'where':{'FromId':[_0x362297[_0x5777('0x52')]['id'],_0x155cd8[_0x5b938a]['id']],'ToId':[_0x362297[_0x5777('0x52')]['id'],_0x155cd8[_0x5b938a]['id']],'ChatGroupId':null},'attributes':['id',_0x5777('0x4b'),'FromId',_0x5777('0x65'),_0x5777('0x66'),'body'],'order':qs[_0x5777('0x30')](_0x5777('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5777('0x21')](wrapUser(_0x155cd8[_0x5b938a])));}return BPromise[_0x5777('0x68')](_0x1e01b0);}return[];})[_0x5777('0x21')](function(_0x4a2be3){return{'rows':_0x4a2be3,'count':_0x4a2be3[_0x5777('0x40')]};})['then'](respondWithResult(_0x1f65d8,null))[_0x5777('0x42')](handleError(_0x1f65d8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3da2d80..82335fe 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 _0xa61f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa61f,0x14d));var _0xfa61=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa61f[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0xfa61('0x0'));var ChatInternalMessage=require(_0xfa61('0x1'))['db'][_0xfa61('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfa61('0x3')](0x0);var events={'afterCreate':_0xfa61('0x4'),'afterUpdate':_0xfa61('0x5'),'afterDestroy':_0xfa61('0x6')};function emitEvent(_0x3b94fb){return function(_0x4a10e1,_0x3ef2cf,_0x50153f){ChatInternalMessageEvents['emit'](_0x3b94fb+':'+_0x4a10e1['id'],_0x4a10e1);ChatInternalMessageEvents[_0xfa61('0x7')](_0x3b94fb,_0x4a10e1);_0x50153f(null);};}for(var e in events){if(events[_0xfa61('0x8')](e)){var event=events[e];ChatInternalMessage[_0xfa61('0x9')](e,emitEvent(event));}}module[_0xfa61('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb079=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage'];(function(_0x3666a0,_0x4c78d3){var _0x156bac=function(_0x1427c3){while(--_0x1427c3){_0x3666a0['push'](_0x3666a0['shift']());}};_0x156bac(++_0x4c78d3);}(_0xb079,0x1c9));var _0x9b07=function(_0xab6522,_0x1f16ec){_0xab6522=_0xab6522-0x0;var _0x3e5e21=_0xb079[_0xab6522];return _0x3e5e21;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x9b07('0x0'))['db'][_0x9b07('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9b07('0x2')](0x0);var events={'afterCreate':_0x9b07('0x3'),'afterUpdate':_0x9b07('0x4'),'afterDestroy':_0x9b07('0x5')};function emitEvent(_0x5dc42a){return function(_0x14a884,_0x3bf703,_0x171808){ChatInternalMessageEvents[_0x9b07('0x6')](_0x5dc42a+':'+_0x14a884['id'],_0x14a884);ChatInternalMessageEvents['emit'](_0x5dc42a,_0x14a884);_0x171808(null);};}for(var e in events){if(events[_0x9b07('0x7')](e)){var event=events[e];ChatInternalMessage[_0x9b07('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7a698d0..b4a1d1d 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 _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x10f9e0,_0x1362b3){var _0x2ee2d=function(_0x2a4074){while(--_0x2a4074){_0x10f9e0['push'](_0x10f9e0['shift']());}};_0x2ee2d(++_0x1362b3);}(_0x4fc2,0x111));var _0x24fc=function(_0x447a04,_0xf69663){_0x447a04=_0x447a04-0x0;var _0x42483b=_0x4fc2[_0x447a04];return _0x42483b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4d42fe,_0xdaccf){var _0xdb0ed1=function(_0x173ac3){while(--_0x173ac3){_0x4d42fe['push'](_0x4d42fe['shift']());}};_0xdb0ed1(++_0xdaccf);}(_0x4fc2,0x111));var _0x24fc=function(_0x4b281d,_0x17ec63){_0x4b281d=_0x4b281d-0x0;var _0x103c12=_0x4fc2[_0x4b281d];return _0x103c12;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 063da28..4fc5e9b 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 _0xc712=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41b179,_0x36c0fc){var _0x224254=function(_0x1efb00){while(--_0x1efb00){_0x41b179['push'](_0x41b179['shift']());}};_0x224254(++_0x36c0fc);}(_0xc712,0x1e7));var _0x2c71=function(_0x14d1d5,_0x1a2445){_0x14d1d5=_0x14d1d5-0x0;var _0x1a7717=_0xc712[_0x14d1d5];return _0x1a7717;};'use strict';var _=require(_0x2c71('0x0'));var util=require(_0x2c71('0x1'));var moment=require(_0x2c71('0x2'));var BPromise=require(_0x2c71('0x3'));var rs=require(_0x2c71('0x4'));var fs=require('fs');var Redis=require(_0x2c71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c71('0x6'));var logger=require(_0x2c71('0x7'))('rpc');var config=require(_0x2c71('0x8'));var jayson=require(_0x2c71('0x9'));var client=jayson[_0x2c71('0xa')][_0x2c71('0xb')]({'port':0x232a});config['redis']=_[_0x2c71('0xc')](config[_0x2c71('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c71('0xe'))(new Redis(config[_0x2c71('0xd')]));require(_0x2c71('0xf'))[_0x2c71('0x10')](socket);function respondWithRpcPromise(_0x3dbf2b,_0x107aa9,_0x1e8493){return new BPromise(function(_0x15e515,_0x2ce95f){return client[_0x2c71('0x11')](_0x3dbf2b,_0x1e8493)[_0x2c71('0x12')](function(_0x437ddf){logger[_0x2c71('0x13')](_0x2c71('0x14'),_0x107aa9,_0x2c71('0x15'));logger[_0x2c71('0x16')](_0x2c71('0x17'),_0x107aa9,'request\x20sent',JSON[_0x2c71('0x18')](_0x437ddf));if(_0x437ddf[_0x2c71('0x19')]){if(_0x437ddf[_0x2c71('0x19')][_0x2c71('0x1a')]===0x1f4){logger[_0x2c71('0x19')](_0x2c71('0x14'),_0x107aa9,_0x437ddf[_0x2c71('0x19')][_0x2c71('0x1b')]);return _0x2ce95f(_0x437ddf[_0x2c71('0x19')][_0x2c71('0x1b')]);}logger[_0x2c71('0x19')](_0x2c71('0x14'),_0x107aa9,_0x437ddf[_0x2c71('0x19')][_0x2c71('0x1b')]);return _0x15e515(_0x437ddf['error'][_0x2c71('0x1b')]);}else{logger[_0x2c71('0x13')](_0x2c71('0x14'),_0x107aa9,_0x2c71('0x15'));_0x15e515(_0x437ddf[_0x2c71('0x1c')][_0x2c71('0x1b')]);}})[_0x2c71('0x1d')](function(_0x378ca){logger[_0x2c71('0x19')](_0x2c71('0x14'),_0x107aa9,_0x378ca);_0x2ce95f(_0x378ca);});});} \ No newline at end of file +var _0x9028=['register','request','then','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9028,0x1e5));var _0x8902=function(_0x4bfd0d,_0x22a14d){_0x4bfd0d=_0x4bfd0d-0x0;var _0x1b7592=_0x9028[_0x4bfd0d];return _0x1b7592;};'use strict';var _=require(_0x8902('0x0'));var util=require('util');var moment=require(_0x8902('0x1'));var BPromise=require(_0x8902('0x2'));var rs=require(_0x8902('0x3'));var fs=require('fs');var Redis=require(_0x8902('0x4'));var db=require(_0x8902('0x5'))['db'];var utils=require(_0x8902('0x6'));var logger=require('../../config/logger')(_0x8902('0x7'));var config=require(_0x8902('0x8'));var jayson=require(_0x8902('0x9'));var client=jayson[_0x8902('0xa')][_0x8902('0xb')]({'port':0x232a});config['redis']=_[_0x8902('0xc')](config[_0x8902('0xd')],{'host':_0x8902('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8902('0xd')]));require('./chatInternalMessage.socket')[_0x8902('0xf')](socket);function respondWithRpcPromise(_0x1d74c2,_0x583776,_0x1525dd){return new BPromise(function(_0x4ca5b9,_0x2acba2){return client[_0x8902('0x10')](_0x1d74c2,_0x1525dd)[_0x8902('0x11')](function(_0x4adbed){logger['info'](_0x8902('0x12'),_0x583776,'request\x20sent');logger['debug'](_0x8902('0x13'),_0x583776,_0x8902('0x14'),JSON['stringify'](_0x4adbed));if(_0x4adbed[_0x8902('0x15')]){if(_0x4adbed[_0x8902('0x15')]['code']===0x1f4){logger[_0x8902('0x15')](_0x8902('0x12'),_0x583776,_0x4adbed[_0x8902('0x15')][_0x8902('0x16')]);return _0x2acba2(_0x4adbed[_0x8902('0x15')][_0x8902('0x16')]);}logger[_0x8902('0x15')](_0x8902('0x12'),_0x583776,_0x4adbed[_0x8902('0x15')]['message']);return _0x4ca5b9(_0x4adbed[_0x8902('0x15')][_0x8902('0x16')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x583776,_0x8902('0x14'));_0x4ca5b9(_0x4adbed[_0x8902('0x17')]['message']);}})[_0x8902('0x18')](function(_0x50c6fb){logger['error'](_0x8902('0x12'),_0x583776,_0x50c6fb);_0x2acba2(_0x50c6fb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 166303a..e14fc46 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 _0x79d8=['remove','update','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x79d8,0x67));var _0x879d=function(_0x22c02f,_0xce7b2b){_0x22c02f=_0x22c02f-0x0;var _0x184aa8=_0x79d8[_0x22c02f];return _0x184aa8;};'use strict';var ChatInternalMessageEvents=require(_0x879d('0x0'));var events=[_0x879d('0x1'),_0x879d('0x2'),_0x879d('0x3')];function createListener(_0x5d4308,_0x20dbdc){return function(_0x858c6){_0x20dbdc['emit'](_0x5d4308,_0x858c6);};}function removeListener(_0x2b38f9,_0x3d8c64){return function(){ChatInternalMessageEvents[_0x879d('0x4')](_0x2b38f9,_0x3d8c64);};}exports['register']=function(_0x2d578e){for(var _0x46ed21=0x0,_0x142181=events[_0x879d('0x5')];_0x46ed21<_0x142181;_0x46ed21++){var _0x49c05d=events[_0x46ed21];var _0x257050=createListener(_0x879d('0x6')+_0x49c05d,_0x2d578e);ChatInternalMessageEvents['on'](_0x49c05d,_0x257050);}}; \ No newline at end of file +var _0x534d=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0x534d,0x79));var _0xd534=function(_0x111819,_0x1f2e85){_0x111819=_0x111819-0x0;var _0x1afbdc=_0x534d[_0x111819];return _0x1afbdc;};'use strict';var ChatInternalMessageEvents=require(_0xd534('0x0'));var events=[_0xd534('0x1'),_0xd534('0x2'),_0xd534('0x3')];function createListener(_0x35088f,_0xedc863){return function(_0x110ae2){_0xedc863[_0xd534('0x4')](_0x35088f,_0x110ae2);};}function removeListener(_0x1479ec,_0x278f6b){return function(){ChatInternalMessageEvents[_0xd534('0x5')](_0x1479ec,_0x278f6b);};}exports[_0xd534('0x6')]=function(_0x2e9c44){for(var _0x2ebe36=0x0,_0x1db778=events[_0xd534('0x7')];_0x2ebe36<_0x1db778;_0x2ebe36++){var _0x4419ee=events[_0x2ebe36];var _0x1a00af=createListener(_0xd534('0x8')+_0x4419ee,_0x2e9c44);ChatInternalMessageEvents['on'](_0x4419ee,_0x1a00af);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c2a2b26..bd92d49 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3e4091,_0x2f5f74){var _0x511ec7=function(_0x4734be){while(--_0x4734be){_0x3e4091['push'](_0x3e4091['shift']());}};_0x511ec7(++_0x2f5f74);}(_0xe706,0xa3));var _0x6e70=function(_0x3300ee,_0xed60a9){_0x3300ee=_0x3300ee-0x0;var _0x714154=_0xe706[_0x3300ee];return _0x714154;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x360a9e,_0x438649){var _0x2d1e6d=function(_0x27596f){while(--_0x27596f){_0x360a9e['push'](_0x360a9e['shift']());}};_0x2d1e6d(++_0x438649);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f632586..ba4f971 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 _0xa82e=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x535596,_0x15c174){var _0x5751dd=function(_0x2b3a50){while(--_0x2b3a50){_0x535596['push'](_0x535596['shift']());}};_0x5751dd(++_0x15c174);}(_0xa82e,0xb1));var _0xea82=function(_0xab5e8c,_0x1cc565){_0xab5e8c=_0xab5e8c-0x0;var _0xc6db22=_0xa82e[_0xab5e8c];return _0xc6db22;};'use strict';var Sequelize=require(_0xea82('0x0'));module[_0xea82('0x1')]={'body':{'type':Sequelize[_0xea82('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xea82('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xea82('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea82('0x4')]('in',_0xea82('0x5')),'defaultValue':_0xea82('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xea82('0x6')]},'providerName':{'type':Sequelize[_0xea82('0x7')]},'providerResponse':{'type':Sequelize[_0xea82('0x2')]}}; \ No newline at end of file +var _0x892e=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x892e,0xe3));var _0xe892=function(_0x2a9bd0,_0x17755c){_0x2a9bd0=_0x2a9bd0-0x0;var _0x3d3017=_0x892e[_0x2a9bd0];return _0x3d3017;};'use strict';var Sequelize=require('sequelize');module[_0xe892('0x0')]={'body':{'type':Sequelize[_0xe892('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe892('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe892('0x3')]('in',_0xe892('0x4')),'defaultValue':_0xe892('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe892('0x5')]},'providerName':{'type':Sequelize[_0xe892('0x6')]},'providerResponse':{'type':Sequelize[_0xe892('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8a2a0f7..2a9d020 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 _0x8a23=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','./chatMessage.socket','register','client','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','ChatMessage','findAll','catch','params','includeAll','find','create','body','describe','../../config/logger','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','ChatInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2776b9,_0x3ac69f){var _0x1ef5e9=function(_0xe2645b){while(--_0xe2645b){_0x2776b9['push'](_0x2776b9['shift']());}};_0x1ef5e9(++_0x3ac69f);}(_0x8a23,0x1eb));var _0x38a2=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x8a23[_0x3cb30b];return _0x2ca717;};'use strict';var pdf=require(_0x38a2('0x0'));var emlformat=require(_0x38a2('0x1'));var rimraf=require(_0x38a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38a2('0x3'));var rp=require(_0x38a2('0x4'));var moment=require(_0x38a2('0x5'));var BPromise=require(_0x38a2('0x6'));var Mustache=require(_0x38a2('0x7'));var util=require(_0x38a2('0x8'));var path=require(_0x38a2('0x9'));var sox=require(_0x38a2('0xa'));var csv=require(_0x38a2('0xb'));var ejs=require(_0x38a2('0xc'));var fs=require('fs');var _=require(_0x38a2('0xd'));var squel=require(_0x38a2('0xe'));var crypto=require(_0x38a2('0xf'));var jsforce=require(_0x38a2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x38a2('0xb'));var querystring=require(_0x38a2('0x11'));var Papa=require('papaparse');var Redis=require(_0x38a2('0x12'));var authService=require(_0x38a2('0x13'));var qs=require(_0x38a2('0x14'));var as=require(_0x38a2('0x15'));var hardwareService=require(_0x38a2('0x16'));var logger=require('../../config/logger')(_0x38a2('0x17'));var utils=require(_0x38a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x38a2('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x38a2('0x1a')](config[_0x38a2('0x1b')],{'host':_0x38a2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38a2('0x1b')]));require(_0x38a2('0x1d'))[_0x38a2('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x38a2('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x38a2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbd82be,_0x28f2cf,_0x3ac948,_0x46f891){return new BPromise(function(_0x520672,_0x3bf00b){var _0x24beb6=_0x46f891||client;return _0x24beb6[_0x38a2('0x20')](_0xbd82be,_0x3ac948)[_0x38a2('0x21')](function(_0x8148ee){logger['info'](_0x38a2('0x22'),_0x28f2cf,_0x38a2('0x23'));logger[_0x38a2('0x24')](_0x38a2('0x25'),_0x28f2cf,_0x38a2('0x23'),JSON[_0x38a2('0x26')](_0x8148ee));if(_0x8148ee[_0x38a2('0x27')]){if(_0x8148ee['error'][_0x38a2('0x28')]===0x1f4){logger[_0x38a2('0x27')](_0x38a2('0x22'),_0x28f2cf,_0x8148ee[_0x38a2('0x27')][_0x38a2('0x29')]);return _0x3bf00b(_0x8148ee[_0x38a2('0x27')][_0x38a2('0x29')]);}logger[_0x38a2('0x27')](_0x38a2('0x22'),_0x28f2cf,_0x8148ee[_0x38a2('0x27')][_0x38a2('0x29')]);return _0x520672(_0x8148ee[_0x38a2('0x27')][_0x38a2('0x29')]);}else{logger[_0x38a2('0x2a')](_0x38a2('0x22'),_0x28f2cf,'request\x20sent');_0x520672(_0x8148ee[_0x38a2('0x2b')][_0x38a2('0x29')]);}})['catch'](function(_0x5e6092){logger['error'](_0x38a2('0x22'),_0x28f2cf,_0x5e6092);_0x3bf00b(_0x5e6092);});});}function respondWithStatusCode(_0x342ff7,_0x187973){_0x187973=_0x187973||0xcc;return function(_0xe8c082){if(_0xe8c082){return _0x342ff7[_0x38a2('0x2c')](_0x187973);}return _0x342ff7[_0x38a2('0x2d')](_0x187973)[_0x38a2('0x2e')]();};}function respondWithResult(_0x4fef10,_0x510a20){_0x510a20=_0x510a20||0xc8;return function(_0x438fdd){if(_0x438fdd){return _0x4fef10['status'](_0x510a20)[_0x38a2('0x2f')](_0x438fdd);}};}function respondWithFilteredResult(_0x33a72c,_0x56e8a1){return function(_0x58b80c){if(_0x58b80c){var _0x30b108=_0x58b80c[_0x38a2('0x30')],_0x31d147=_0x56e8a1[_0x38a2('0x31')],_0x405b1d=_0x56e8a1['offset']+_0x56e8a1[_0x38a2('0x32')],_0xd1c5dd;if(_0x405b1d>=_0x30b108){_0x405b1d=_0x30b108;_0xd1c5dd=0xc8;}else{_0xd1c5dd=0xce;}_0x33a72c['status'](_0xd1c5dd);return _0x33a72c[_0x38a2('0x33')](_0x38a2('0x34'),_0x31d147+'-'+_0x405b1d+'/'+_0x30b108)['json'](_0x58b80c);}return null;};}function patchUpdates(_0x3dd26c){return function(_0x5d6db4){try{jsonpatch[_0x38a2('0x35')](_0x5d6db4,_0x3dd26c,!![]);}catch(_0x8d9cb6){return BPromise[_0x38a2('0x36')](_0x8d9cb6);}return _0x5d6db4[_0x38a2('0x37')]();};}function saveUpdates(_0x44ca94,_0x37b42d){return function(_0x1f220b){if(_0x1f220b){return _0x1f220b[_0x38a2('0x38')](_0x44ca94)[_0x38a2('0x21')](function(_0x1f397f){return _0x1f397f;});}return null;};}function removeEntity(_0x508918,_0x47fd0c){return function(_0x546b85){if(_0x546b85){return _0x546b85[_0x38a2('0x39')]()[_0x38a2('0x21')](function(){_0x508918[_0x38a2('0x2d')](0xcc)[_0x38a2('0x2e')]();});}};}function handleEntityNotFound(_0x59909d,_0x355053){return function(_0x468b4c){if(!_0x468b4c){_0x59909d[_0x38a2('0x2c')](0x194);}return _0x468b4c;};}function handleError(_0x2c684d,_0x526d15){_0x526d15=_0x526d15||0x1f4;return function(_0x508a63){logger['error'](_0x508a63['stack']);if(_0x508a63[_0x38a2('0x3a')]){delete _0x508a63[_0x38a2('0x3a')];}_0x2c684d['status'](_0x526d15)[_0x38a2('0x3b')](_0x508a63);};}exports['index']=function(_0x13f3ec,_0x45abaf){var _0x3a6dea={},_0x176486={},_0x54deaa={'count':0x0,'rows':[]};var _0x3d5694=_['map'](db['ChatMessage'][_0x38a2('0x3c')],function(_0x46192d){return{'name':_0x46192d['fieldName'],'type':_0x46192d[_0x38a2('0x3d')][_0x38a2('0x3e')]};});_0x176486[_0x38a2('0x3f')]=_[_0x38a2('0x40')](_0x3d5694,_0x38a2('0x3a'));_0x176486['query']=_[_0x38a2('0x41')](_0x13f3ec[_0x38a2('0x42')]);_0x176486[_0x38a2('0x43')]=_[_0x38a2('0x44')](_0x176486[_0x38a2('0x3f')],_0x176486[_0x38a2('0x42')]);_0x3a6dea[_0x38a2('0x45')]=_[_0x38a2('0x44')](_0x176486[_0x38a2('0x3f')],qs[_0x38a2('0x46')](_0x13f3ec[_0x38a2('0x42')][_0x38a2('0x46')]));_0x3a6dea[_0x38a2('0x45')]=_0x3a6dea[_0x38a2('0x45')][_0x38a2('0x47')]?_0x3a6dea[_0x38a2('0x45')]:_0x176486[_0x38a2('0x3f')];if(!_0x13f3ec[_0x38a2('0x42')][_0x38a2('0x48')](_0x38a2('0x49'))){_0x3a6dea[_0x38a2('0x32')]=qs[_0x38a2('0x32')](_0x13f3ec[_0x38a2('0x42')]['limit']);_0x3a6dea[_0x38a2('0x31')]=qs[_0x38a2('0x31')](_0x13f3ec['query'][_0x38a2('0x31')]);}_0x3a6dea[_0x38a2('0x4a')]=qs['sort'](_0x13f3ec[_0x38a2('0x42')][_0x38a2('0x4b')]);_0x3a6dea[_0x38a2('0x4c')]=qs[_0x38a2('0x43')](_['pick'](_0x13f3ec['query'],_0x176486['filters']),_0x3d5694);if(_0x13f3ec['query']['filter']){_0x3a6dea[_0x38a2('0x4c')]=_[_0x38a2('0x4d')](_0x3a6dea[_0x38a2('0x4c')],{'$or':_[_0x38a2('0x40')](_0x3d5694,function(_0x2e1f74){if(_0x2e1f74[_0x38a2('0x3d')]!==_0x38a2('0x4e')){var _0x3e414b={};_0x3e414b[_0x2e1f74['name']]={'$like':'%'+_0x13f3ec[_0x38a2('0x42')][_0x38a2('0x4f')]+'%'};return _0x3e414b;}})});}_0x3a6dea=_[_0x38a2('0x4d')]({},_0x3a6dea,_0x13f3ec[_0x38a2('0x50')]);var _0x1e5c6f={'where':_0x3a6dea[_0x38a2('0x4c')]};return db['ChatMessage'][_0x38a2('0x30')](_0x1e5c6f)['then'](function(_0x4feea5){_0x54deaa[_0x38a2('0x30')]=_0x4feea5;if(_0x13f3ec[_0x38a2('0x42')]['includeAll']){_0x3a6dea[_0x38a2('0x51')]=[{'all':!![]}];}return db[_0x38a2('0x52')][_0x38a2('0x53')](_0x3a6dea);})[_0x38a2('0x21')](function(_0x2cb5a){_0x54deaa['rows']=_0x2cb5a;return _0x54deaa;})[_0x38a2('0x21')](respondWithFilteredResult(_0x45abaf,_0x3a6dea))[_0x38a2('0x54')](handleError(_0x45abaf,null));};exports['show']=function(_0x4d04a6,_0x2fbcd7){var _0x41327c={'raw':!![],'where':{'id':_0x4d04a6[_0x38a2('0x55')]['id']}},_0x1b9d00={};_0x1b9d00[_0x38a2('0x3f')]=_[_0x38a2('0x41')](db[_0x38a2('0x52')][_0x38a2('0x3c')]);_0x1b9d00['query']=_[_0x38a2('0x41')](_0x4d04a6[_0x38a2('0x42')]);_0x1b9d00['filters']=_[_0x38a2('0x44')](_0x1b9d00[_0x38a2('0x3f')],_0x1b9d00[_0x38a2('0x42')]);_0x41327c[_0x38a2('0x45')]=_['intersection'](_0x1b9d00[_0x38a2('0x3f')],qs[_0x38a2('0x46')](_0x4d04a6['query']['fields']));_0x41327c['attributes']=_0x41327c[_0x38a2('0x45')]['length']?_0x41327c['attributes']:_0x1b9d00['model'];if(_0x4d04a6['query'][_0x38a2('0x56')]){_0x41327c[_0x38a2('0x51')]=[{'all':!![]}];}_0x41327c=_[_0x38a2('0x4d')]({},_0x41327c,_0x4d04a6['options']);return db[_0x38a2('0x52')][_0x38a2('0x57')](_0x41327c)['then'](handleEntityNotFound(_0x2fbcd7,null))[_0x38a2('0x21')](respondWithResult(_0x2fbcd7,null))[_0x38a2('0x54')](handleError(_0x2fbcd7,null));};exports['create']=function(_0xaf4c1,_0x306df3){return db[_0x38a2('0x52')][_0x38a2('0x58')](_0xaf4c1[_0x38a2('0x59')],{})[_0x38a2('0x21')](respondWithResult(_0x306df3,0xc9))[_0x38a2('0x54')](handleError(_0x306df3,null));};exports['update']=function(_0x37fd7d,_0x921440){if(_0x37fd7d[_0x38a2('0x59')]['id']){delete _0x37fd7d[_0x38a2('0x59')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x37fd7d[_0x38a2('0x55')]['id']}})[_0x38a2('0x21')](handleEntityNotFound(_0x921440,null))['then'](saveUpdates(_0x37fd7d[_0x38a2('0x59')],null))[_0x38a2('0x21')](respondWithResult(_0x921440,null))[_0x38a2('0x54')](handleError(_0x921440,null));};exports[_0x38a2('0x39')]=function(_0x473f7a,_0xa1dbef){return db[_0x38a2('0x52')][_0x38a2('0x57')]({'where':{'id':_0x473f7a[_0x38a2('0x55')]['id']}})['then'](handleEntityNotFound(_0xa1dbef,null))[_0x38a2('0x21')](removeEntity(_0xa1dbef,null))[_0x38a2('0x54')](handleError(_0xa1dbef,null));};exports[_0x38a2('0x5a')]=function(_0x11325,_0x3dd9bd){return db[_0x38a2('0x52')][_0x38a2('0x5a')]()[_0x38a2('0x21')](respondWithResult(_0x3dd9bd,null))['catch'](handleError(_0x3dd9bd,null));};var interaction_log=require(_0x38a2('0x5b'))('chat-interactions');exports[_0x38a2('0x5c')]=function(_0x44cd50,_0x5efffe,_0x4d2e05){var _0x18a5fd={'agent':{},'channel':_0x38a2('0x5d')};if(_0x44cd50[_0x38a2('0x59')]['id']){delete _0x44cd50[_0x38a2('0x59')]['id'];}_0x44cd50[_0x38a2('0x59')][_0x38a2('0x5e')]=!![];_0x44cd50[_0x38a2('0x59')][_0x38a2('0x5f')]=moment()[_0x38a2('0x60')](_0x38a2('0x61'));_0x44cd50['body']['UserId']=_0x44cd50[_0x38a2('0x59')][_0x38a2('0x62')]||_0x44cd50[_0x38a2('0x63')]['id'];_0x18a5fd[_0x38a2('0x64')]['id']=_0x44cd50[_0x38a2('0x59')]['UserId'];return db[_0x38a2('0x52')][_0x38a2('0x57')]({'where':{'id':_0x44cd50['params']['id'],'UserId':null},'include':[{'model':db[_0x38a2('0x65')],'as':_0x38a2('0x66')}]})[_0x38a2('0x21')](handleEntityNotFound(_0x5efffe,null))['then'](saveUpdates(_0x44cd50[_0x38a2('0x59')],null))[_0x38a2('0x21')](function(_0x38383){if(_0x38383){_0x18a5fd[_0x38a2('0x29')]=_0x38383[_0x38a2('0x67')]({'plain':!![]});return db['ChatInteraction'][_0x38a2('0x57')]({'where':{'id':_0x38383[_0x38a2('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x5efffe,null))[_0x38a2('0x21')](function(_0x3d55a2){if(_0x3d55a2){return _0x3d55a2[_0x38a2('0x38')]({'UserId':_0x44cd50[_0x38a2('0x59')][_0x38a2('0x62')],'read1stAt':_[_0x38a2('0x69')](_0x3d55a2[_0x38a2('0x6a')])?moment()[_0x38a2('0x60')](_0x38a2('0x61')):undefined});}return null;})[_0x38a2('0x21')](function(_0x2c0261){if(_0x2c0261){_0x18a5fd[_0x38a2('0x6b')]=_0x2c0261[_0x38a2('0x67')]({'plain':!![]});interaction_log[_0x38a2('0x2a')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44cd50[_0x38a2('0x63')]['id'],_0x44cd50[_0x38a2('0x63')][_0x38a2('0x3a')],_0x44cd50[_0x38a2('0x63')][_0x38a2('0x6c')],_0x18a5fd[_0x38a2('0x6b')]['id'],_0x44cd50['body']?JSON[_0x38a2('0x26')](_0x44cd50['body']):'null');return respondWithRpcPromise(_0x38a2('0x6d'),_0x38a2('0x6e'),_0x18a5fd);}return null;})[_0x38a2('0x21')](function(_0x4bd482){if(_0x4bd482){if(_0x44cd50[_0x38a2('0x59')][_0x38a2('0x6f')]){_0x18a5fd[_0x38a2('0x29')]['interface']=util[_0x38a2('0x60')](_0x38a2('0x70'),_0x44cd50[_0x38a2('0x63')]['name']);_0x18a5fd[_0x38a2('0x29')]['channel']=_0x18a5fd[_0x38a2('0x71')];_0x18a5fd[_0x38a2('0x29')][_0x38a2('0x72')]=_0x38a2('0x5c');return respondWithRpcPromise(_0x38a2('0x73'),'EventManager',{'event':_0x38a2('0x74'),'message':_[_0x38a2('0x4d')](_0x18a5fd[_0x38a2('0x29')],JSON[_0x38a2('0x75')](_0x18a5fd[_0x38a2('0x6b')][_0x38a2('0x76')]))},client9002)[_0x38a2('0x21')](function(){return _0x18a5fd;});}return _0x18a5fd;}return null;})[_0x38a2('0x21')](respondWithResult(_0x5efffe,null))['catch'](handleError(_0x5efffe,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x38a2('0x36')]=function(_0x19a58a,_0x538a54,_0x4c9975){var _0x5e8548={'agent':{},'channel':'chat'};if(_0x19a58a[_0x38a2('0x59')]['id']){delete _0x19a58a[_0x38a2('0x59')]['id'];}_0x19a58a[_0x38a2('0x59')][_0x38a2('0x62')]=_0x19a58a[_0x38a2('0x59')][_0x38a2('0x62')]||_0x19a58a[_0x38a2('0x63')]['id'];_0x5e8548['agent']['id']=_0x19a58a[_0x38a2('0x59')][_0x38a2('0x62')];return db['ChatMessage'][_0x38a2('0x57')]({'where':{'id':_0x19a58a[_0x38a2('0x55')]['id'],'UserId':null}})[_0x38a2('0x21')](handleEntityNotFound(_0x538a54,null))[_0x38a2('0x21')](function(_0x200013){if(_0x200013){_0x5e8548[_0x38a2('0x29')]=_0x200013[_0x38a2('0x67')]({'plain':!![]});return db[_0x38a2('0x77')]['find']({'where':{'id':_0x200013[_0x38a2('0x68')]}});}return null;})[_0x38a2('0x21')](handleEntityNotFound(_0x538a54,null))[_0x38a2('0x21')](function(_0x5a6bd2){if(_0x5a6bd2){_0x5e8548[_0x38a2('0x6b')]=_0x5a6bd2['get']({'plain':!![]});interaction_log[_0x38a2('0x2a')](_0x38a2('0x78'),_0x19a58a[_0x38a2('0x63')]['id'],_0x19a58a[_0x38a2('0x63')][_0x38a2('0x3a')],_0x19a58a[_0x38a2('0x63')][_0x38a2('0x6c')],_0x5e8548[_0x38a2('0x6b')]['id'],_0x19a58a['body']?JSON[_0x38a2('0x26')](_0x19a58a[_0x38a2('0x59')]):_0x38a2('0x79'));return respondWithRpcPromise(_0x38a2('0x7a'),'rejectMessage',_0x5e8548);}return null;})[_0x38a2('0x21')](function(_0x38686e){if(_0x38686e){_0x38686e[_0x38a2('0x29')][_0x38a2('0x7b')]=util[_0x38a2('0x60')](_0x38a2('0x70'),_0x19a58a[_0x38a2('0x63')][_0x38a2('0x3a')]);_0x38686e[_0x38a2('0x29')][_0x38a2('0x71')]=_0x5e8548[_0x38a2('0x71')];_0x38686e['message']['event']=_0x38a2('0x36');respondWithRpcPromise(_0x38a2('0x73'),_0x38a2('0x73'),{'event':_0x38a2('0x7c'),'message':_0x38686e[_0x38a2('0x29')]},client9002);return _0x5e8548;}return null;})['then'](respondWithResult(_0x538a54,null))[_0x38a2('0x54')](handleError(_0x538a54,null));}; \ No newline at end of file +var _0xde4e=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','show','params','create','update','body','find','describe','../../config/logger','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','format','interaction','user','role','acceptMessage','manual','channel','event','EventManager','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage'];(function(_0x2ca431,_0x255d31){var _0x171ef3=function(_0x4a9c84){while(--_0x4a9c84){_0x2ca431['push'](_0x2ca431['shift']());}};_0x171ef3(++_0x255d31);}(_0xde4e,0xea));var _0xede4=function(_0x1bb091,_0x597936){_0x1bb091=_0x1bb091-0x0;var _0x205cb9=_0xde4e[_0x1bb091];return _0x205cb9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xede4('0x0'));var rimraf=require(_0xede4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xede4('0x2'));var rp=require(_0xede4('0x3'));var moment=require(_0xede4('0x4'));var BPromise=require(_0xede4('0x5'));var Mustache=require(_0xede4('0x6'));var util=require('util');var path=require(_0xede4('0x7'));var sox=require('sox');var csv=require(_0xede4('0x8'));var ejs=require(_0xede4('0x9'));var fs=require('fs');var _=require(_0xede4('0xa'));var squel=require(_0xede4('0xb'));var crypto=require('crypto');var jsforce=require(_0xede4('0xc'));var deskjs=require(_0xede4('0xd'));var toCsv=require(_0xede4('0x8'));var querystring=require(_0xede4('0xe'));var Papa=require(_0xede4('0xf'));var Redis=require(_0xede4('0x10'));var authService=require(_0xede4('0x11'));var qs=require(_0xede4('0x12'));var as=require(_0xede4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xede4('0x14'));var utils=require(_0xede4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xede4('0x16'))['db'];config['redis']=_[_0xede4('0x17')](config[_0xede4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xede4('0x19'))(new Redis(config['redis']));require(_0xede4('0x1a'))['register'](socket);var jayson=require(_0xede4('0x1b'));var client=jayson['client'][_0xede4('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xede4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x569a7c,_0x36847c,_0x2e69d1,_0x25834){return new BPromise(function(_0x5e997b,_0xe955ef){var _0x3ad9cf=_0x25834||client;return _0x3ad9cf[_0xede4('0x1d')](_0x569a7c,_0x2e69d1)['then'](function(_0x267385){logger[_0xede4('0x1e')](_0xede4('0x1f'),_0x36847c,_0xede4('0x20'));logger[_0xede4('0x21')](_0xede4('0x22'),_0x36847c,_0xede4('0x20'),JSON[_0xede4('0x23')](_0x267385));if(_0x267385['error']){if(_0x267385[_0xede4('0x24')][_0xede4('0x25')]===0x1f4){logger['error'](_0xede4('0x1f'),_0x36847c,_0x267385[_0xede4('0x24')]['message']);return _0xe955ef(_0x267385[_0xede4('0x24')][_0xede4('0x26')]);}logger['error'](_0xede4('0x1f'),_0x36847c,_0x267385[_0xede4('0x24')][_0xede4('0x26')]);return _0x5e997b(_0x267385[_0xede4('0x24')][_0xede4('0x26')]);}else{logger[_0xede4('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x36847c,_0xede4('0x20'));_0x5e997b(_0x267385[_0xede4('0x27')]['message']);}})[_0xede4('0x28')](function(_0x664ae4){logger[_0xede4('0x24')](_0xede4('0x1f'),_0x36847c,_0x664ae4);_0xe955ef(_0x664ae4);});});}function respondWithStatusCode(_0x3b3fc0,_0x117f31){_0x117f31=_0x117f31||0xcc;return function(_0x3985e0){if(_0x3985e0){return _0x3b3fc0[_0xede4('0x29')](_0x117f31);}return _0x3b3fc0[_0xede4('0x2a')](_0x117f31)[_0xede4('0x2b')]();};}function respondWithResult(_0x5471c0,_0x25c59e){_0x25c59e=_0x25c59e||0xc8;return function(_0x39a454){if(_0x39a454){return _0x5471c0['status'](_0x25c59e)[_0xede4('0x2c')](_0x39a454);}};}function respondWithFilteredResult(_0x2d9cc0,_0x3115a4){return function(_0x58627d){if(_0x58627d){var _0x3058db=_0x58627d[_0xede4('0x2d')],_0x178592=_0x3115a4[_0xede4('0x2e')],_0xcd10a6=_0x3115a4[_0xede4('0x2e')]+_0x3115a4[_0xede4('0x2f')],_0x434d1c;if(_0xcd10a6>=_0x3058db){_0xcd10a6=_0x3058db;_0x434d1c=0xc8;}else{_0x434d1c=0xce;}_0x2d9cc0[_0xede4('0x2a')](_0x434d1c);return _0x2d9cc0['set'](_0xede4('0x30'),_0x178592+'-'+_0xcd10a6+'/'+_0x3058db)[_0xede4('0x2c')](_0x58627d);}return null;};}function patchUpdates(_0x1588dd){return function(_0x54e1ee){try{jsonpatch[_0xede4('0x31')](_0x54e1ee,_0x1588dd,!![]);}catch(_0xe4b742){return BPromise[_0xede4('0x32')](_0xe4b742);}return _0x54e1ee[_0xede4('0x33')]();};}function saveUpdates(_0x4ee4fa,_0x36fa5f){return function(_0x4b5f2e){if(_0x4b5f2e){return _0x4b5f2e['update'](_0x4ee4fa)[_0xede4('0x34')](function(_0x57f4cc){return _0x57f4cc;});}return null;};}function removeEntity(_0x40a4b8,_0x6af2cc){return function(_0x2662d4){if(_0x2662d4){return _0x2662d4[_0xede4('0x35')]()[_0xede4('0x34')](function(){_0x40a4b8[_0xede4('0x2a')](0xcc)[_0xede4('0x2b')]();});}};}function handleEntityNotFound(_0x1e171e,_0x2aef00){return function(_0x33a60f){if(!_0x33a60f){_0x1e171e['sendStatus'](0x194);}return _0x33a60f;};}function handleError(_0x1cfca0,_0x11f6f0){_0x11f6f0=_0x11f6f0||0x1f4;return function(_0x21085e){logger[_0xede4('0x24')](_0x21085e[_0xede4('0x36')]);if(_0x21085e[_0xede4('0x37')]){delete _0x21085e[_0xede4('0x37')];}_0x1cfca0['status'](_0x11f6f0)[_0xede4('0x38')](_0x21085e);};}exports[_0xede4('0x39')]=function(_0x1f9bce,_0x432436){var _0x209494={},_0x527e1d={},_0x450c04={'count':0x0,'rows':[]};var _0x57d544=_[_0xede4('0x3a')](db['ChatMessage'][_0xede4('0x3b')],function(_0x5bab02){return{'name':_0x5bab02[_0xede4('0x3c')],'type':_0x5bab02[_0xede4('0x3d')][_0xede4('0x3e')]};});_0x527e1d[_0xede4('0x3f')]=_['map'](_0x57d544,'name');_0x527e1d['query']=_[_0xede4('0x40')](_0x1f9bce['query']);_0x527e1d[_0xede4('0x41')]=_[_0xede4('0x42')](_0x527e1d['model'],_0x527e1d[_0xede4('0x43')]);_0x209494[_0xede4('0x44')]=_[_0xede4('0x42')](_0x527e1d['model'],qs[_0xede4('0x45')](_0x1f9bce[_0xede4('0x43')][_0xede4('0x45')]));_0x209494[_0xede4('0x44')]=_0x209494[_0xede4('0x44')][_0xede4('0x46')]?_0x209494[_0xede4('0x44')]:_0x527e1d[_0xede4('0x3f')];if(!_0x1f9bce['query'][_0xede4('0x47')]('nolimit')){_0x209494[_0xede4('0x2f')]=qs[_0xede4('0x2f')](_0x1f9bce[_0xede4('0x43')][_0xede4('0x2f')]);_0x209494[_0xede4('0x2e')]=qs[_0xede4('0x2e')](_0x1f9bce[_0xede4('0x43')][_0xede4('0x2e')]);}_0x209494['order']=qs[_0xede4('0x48')](_0x1f9bce[_0xede4('0x43')][_0xede4('0x48')]);_0x209494[_0xede4('0x49')]=qs[_0xede4('0x41')](_[_0xede4('0x4a')](_0x1f9bce[_0xede4('0x43')],_0x527e1d['filters']),_0x57d544);if(_0x1f9bce[_0xede4('0x43')][_0xede4('0x4b')]){_0x209494[_0xede4('0x49')]=_[_0xede4('0x4c')](_0x209494[_0xede4('0x49')],{'$or':_[_0xede4('0x3a')](_0x57d544,function(_0x3ecaed){if(_0x3ecaed['type']!==_0xede4('0x4d')){var _0x41cb23={};_0x41cb23[_0x3ecaed['name']]={'$like':'%'+_0x1f9bce[_0xede4('0x43')][_0xede4('0x4b')]+'%'};return _0x41cb23;}})});}_0x209494=_[_0xede4('0x4c')]({},_0x209494,_0x1f9bce[_0xede4('0x4e')]);var _0x1d354e={'where':_0x209494[_0xede4('0x49')]};return db[_0xede4('0x4f')][_0xede4('0x2d')](_0x1d354e)[_0xede4('0x34')](function(_0x46a10d){_0x450c04[_0xede4('0x2d')]=_0x46a10d;if(_0x1f9bce[_0xede4('0x43')][_0xede4('0x50')]){_0x209494[_0xede4('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0xede4('0x52')](_0x209494);})[_0xede4('0x34')](function(_0x236741){_0x450c04['rows']=_0x236741;return _0x450c04;})['then'](respondWithFilteredResult(_0x432436,_0x209494))[_0xede4('0x28')](handleError(_0x432436,null));};exports[_0xede4('0x53')]=function(_0x3152c8,_0x5b4404){var _0x3c5d8c={'raw':!![],'where':{'id':_0x3152c8[_0xede4('0x54')]['id']}},_0x5e9fe0={};_0x5e9fe0[_0xede4('0x3f')]=_[_0xede4('0x40')](db[_0xede4('0x4f')][_0xede4('0x3b')]);_0x5e9fe0[_0xede4('0x43')]=_[_0xede4('0x40')](_0x3152c8['query']);_0x5e9fe0[_0xede4('0x41')]=_[_0xede4('0x42')](_0x5e9fe0[_0xede4('0x3f')],_0x5e9fe0[_0xede4('0x43')]);_0x3c5d8c[_0xede4('0x44')]=_[_0xede4('0x42')](_0x5e9fe0[_0xede4('0x3f')],qs[_0xede4('0x45')](_0x3152c8[_0xede4('0x43')]['fields']));_0x3c5d8c['attributes']=_0x3c5d8c[_0xede4('0x44')][_0xede4('0x46')]?_0x3c5d8c['attributes']:_0x5e9fe0[_0xede4('0x3f')];if(_0x3152c8[_0xede4('0x43')][_0xede4('0x50')]){_0x3c5d8c[_0xede4('0x51')]=[{'all':!![]}];}_0x3c5d8c=_[_0xede4('0x4c')]({},_0x3c5d8c,_0x3152c8[_0xede4('0x4e')]);return db[_0xede4('0x4f')]['find'](_0x3c5d8c)['then'](handleEntityNotFound(_0x5b4404,null))[_0xede4('0x34')](respondWithResult(_0x5b4404,null))[_0xede4('0x28')](handleError(_0x5b4404,null));};exports[_0xede4('0x55')]=function(_0x43767d,_0x5a735a){return db[_0xede4('0x4f')]['create'](_0x43767d['body'],{})['then'](respondWithResult(_0x5a735a,0xc9))[_0xede4('0x28')](handleError(_0x5a735a,null));};exports[_0xede4('0x56')]=function(_0xeb5bf1,_0x5b31f5){if(_0xeb5bf1[_0xede4('0x57')]['id']){delete _0xeb5bf1[_0xede4('0x57')]['id'];}return db[_0xede4('0x4f')][_0xede4('0x58')]({'where':{'id':_0xeb5bf1['params']['id']}})['then'](handleEntityNotFound(_0x5b31f5,null))['then'](saveUpdates(_0xeb5bf1[_0xede4('0x57')],null))[_0xede4('0x34')](respondWithResult(_0x5b31f5,null))[_0xede4('0x28')](handleError(_0x5b31f5,null));};exports[_0xede4('0x35')]=function(_0x20977b,_0x29159d){return db[_0xede4('0x4f')][_0xede4('0x58')]({'where':{'id':_0x20977b['params']['id']}})[_0xede4('0x34')](handleEntityNotFound(_0x29159d,null))[_0xede4('0x34')](removeEntity(_0x29159d,null))['catch'](handleError(_0x29159d,null));};exports[_0xede4('0x59')]=function(_0x2a363f,_0x498db3){return db[_0xede4('0x4f')][_0xede4('0x59')]()[_0xede4('0x34')](respondWithResult(_0x498db3,null))['catch'](handleError(_0x498db3,null));};var interaction_log=require(_0xede4('0x5a'))('chat-interactions');exports[_0xede4('0x5b')]=function(_0x5ebf1e,_0x31ca67,_0x34559a){var _0x53385b={'agent':{},'channel':_0xede4('0x5c')};if(_0x5ebf1e[_0xede4('0x57')]['id']){delete _0x5ebf1e[_0xede4('0x57')]['id'];}_0x5ebf1e[_0xede4('0x57')][_0xede4('0x5d')]=!![];_0x5ebf1e[_0xede4('0x57')]['readAt']=moment()['format'](_0xede4('0x5e'));_0x5ebf1e[_0xede4('0x57')][_0xede4('0x5f')]=_0x5ebf1e['body'][_0xede4('0x5f')]||_0x5ebf1e['user']['id'];_0x53385b[_0xede4('0x60')]['id']=_0x5ebf1e['body'][_0xede4('0x5f')];return db[_0xede4('0x4f')][_0xede4('0x58')]({'where':{'id':_0x5ebf1e[_0xede4('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xede4('0x61')}]})[_0xede4('0x34')](handleEntityNotFound(_0x31ca67,null))['then'](saveUpdates(_0x5ebf1e[_0xede4('0x57')],null))[_0xede4('0x34')](function(_0x295c9a){if(_0x295c9a){_0x53385b[_0xede4('0x26')]=_0x295c9a[_0xede4('0x62')]({'plain':!![]});return db[_0xede4('0x63')][_0xede4('0x58')]({'where':{'id':_0x295c9a[_0xede4('0x64')]}});}return null;})[_0xede4('0x34')](handleEntityNotFound(_0x31ca67,null))['then'](function(_0xb2055c){if(_0xb2055c){return _0xb2055c[_0xede4('0x56')]({'UserId':_0x5ebf1e[_0xede4('0x57')][_0xede4('0x5f')],'read1stAt':_['isNil'](_0xb2055c[_0xede4('0x65')])?moment()[_0xede4('0x66')](_0xede4('0x5e')):undefined});}return null;})['then'](function(_0x4edea5){if(_0x4edea5){_0x53385b[_0xede4('0x67')]=_0x4edea5[_0xede4('0x62')]({'plain':!![]});interaction_log[_0xede4('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5ebf1e[_0xede4('0x68')]['id'],_0x5ebf1e['user'][_0xede4('0x37')],_0x5ebf1e[_0xede4('0x68')][_0xede4('0x69')],_0x53385b[_0xede4('0x67')]['id'],_0x5ebf1e[_0xede4('0x57')]?JSON[_0xede4('0x23')](_0x5ebf1e[_0xede4('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0xede4('0x6a'),_0x53385b);}return null;})[_0xede4('0x34')](function(_0x2f6b9c){if(_0x2f6b9c){if(_0x5ebf1e[_0xede4('0x57')][_0xede4('0x6b')]){_0x53385b[_0xede4('0x26')]['interface']=util[_0xede4('0x66')]('SIP/%s',_0x5ebf1e['user'][_0xede4('0x37')]);_0x53385b['message'][_0xede4('0x6c')]=_0x53385b[_0xede4('0x6c')];_0x53385b[_0xede4('0x26')][_0xede4('0x6d')]=_0xede4('0x5b');return respondWithRpcPromise(_0xede4('0x6e'),_0xede4('0x6e'),{'event':'acceptmessage','message':_[_0xede4('0x4c')](_0x53385b['message'],JSON[_0xede4('0x6f')](_0x53385b[_0xede4('0x67')]['formData']))},client9002)['then'](function(){return _0x53385b;});}return _0x53385b;}return null;})[_0xede4('0x34')](respondWithResult(_0x31ca67,null))[_0xede4('0x28')](handleError(_0x31ca67,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xede4('0x32')]=function(_0xa6fbaf,_0x414235,_0x28691b){var _0x1d880e={'agent':{},'channel':'chat'};if(_0xa6fbaf[_0xede4('0x57')]['id']){delete _0xa6fbaf['body']['id'];}_0xa6fbaf[_0xede4('0x57')]['UserId']=_0xa6fbaf[_0xede4('0x57')][_0xede4('0x5f')]||_0xa6fbaf[_0xede4('0x68')]['id'];_0x1d880e[_0xede4('0x60')]['id']=_0xa6fbaf['body'][_0xede4('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0xa6fbaf[_0xede4('0x54')]['id'],'UserId':null}})[_0xede4('0x34')](handleEntityNotFound(_0x414235,null))[_0xede4('0x34')](function(_0x4eb991){if(_0x4eb991){_0x1d880e[_0xede4('0x26')]=_0x4eb991[_0xede4('0x62')]({'plain':!![]});return db[_0xede4('0x63')]['find']({'where':{'id':_0x4eb991[_0xede4('0x64')]}});}return null;})[_0xede4('0x34')](handleEntityNotFound(_0x414235,null))[_0xede4('0x34')](function(_0x5f0a09){if(_0x5f0a09){_0x1d880e['interaction']=_0x5f0a09[_0xede4('0x62')]({'plain':!![]});interaction_log['info'](_0xede4('0x70'),_0xa6fbaf['user']['id'],_0xa6fbaf[_0xede4('0x68')][_0xede4('0x37')],_0xa6fbaf[_0xede4('0x68')][_0xede4('0x69')],_0x1d880e[_0xede4('0x67')]['id'],_0xa6fbaf[_0xede4('0x57')]?JSON[_0xede4('0x23')](_0xa6fbaf[_0xede4('0x57')]):'null');return respondWithRpcPromise(_0xede4('0x71'),_0xede4('0x72'),_0x1d880e);}return null;})[_0xede4('0x34')](function(_0x5cdbe1){if(_0x5cdbe1){_0x5cdbe1['message'][_0xede4('0x73')]=util['format']('SIP/%s',_0xa6fbaf['user'][_0xede4('0x37')]);_0x5cdbe1[_0xede4('0x26')]['channel']=_0x1d880e['channel'];_0x5cdbe1['message'][_0xede4('0x6d')]=_0xede4('0x32');respondWithRpcPromise('EventManager',_0xede4('0x6e'),{'event':_0xede4('0x74'),'message':_0x5cdbe1[_0xede4('0x26')]},client9002);return _0x1d880e;}return null;})[_0xede4('0x34')](respondWithResult(_0x414235,null))[_0xede4('0x28')](handleError(_0x414235,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3425420..4a07510 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 _0xe188=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x336caf,_0x3bb5ab){var _0x50f8ac=function(_0x401f92){while(--_0x401f92){_0x336caf['push'](_0x336caf['shift']());}};_0x50f8ac(++_0x3bb5ab);}(_0xe188,0x98));var _0x8e18=function(_0x1e65f8,_0x16bea1){_0x1e65f8=_0x1e65f8-0x0;var _0x252c63=_0xe188[_0x1e65f8];return _0x252c63;};'use strict';var EventEmitter=require(_0x8e18('0x0'));var ChatMessage=require(_0x8e18('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e18('0x2'),'afterDestroy':_0x8e18('0x3')};function emitEvent(_0x87100e){return function(_0x3717e9,_0x42e756,_0x33f8d9){ChatMessageEvents[_0x8e18('0x4')](_0x87100e+':'+_0x3717e9['id'],_0x3717e9);ChatMessageEvents[_0x8e18('0x4')](_0x87100e,_0x3717e9);_0x33f8d9(null);};}for(var e in events){if(events[_0x8e18('0x5')](e)){var event=events[e];ChatMessage[_0x8e18('0x6')](e,emitEvent(event));}}module[_0x8e18('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x576c=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x576c,0x1bb));var _0xc576=function(_0x311e77,_0x49a459){_0x311e77=_0x311e77-0x0;var _0x559c54=_0x576c[_0x311e77];return _0x559c54;};'use strict';var EventEmitter=require(_0xc576('0x0'));var ChatMessage=require(_0xc576('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc576('0x2')](0x0);var events={'afterCreate':_0xc576('0x3'),'afterUpdate':_0xc576('0x4'),'afterDestroy':_0xc576('0x5')};function emitEvent(_0x44ff51){return function(_0x453131,_0x3721e3,_0xc88a65){ChatMessageEvents[_0xc576('0x6')](_0x44ff51+':'+_0x453131['id'],_0x453131);ChatMessageEvents[_0xc576('0x6')](_0x44ff51,_0x453131);_0xc88a65(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc576('0x7')](e,emitEvent(event));}}module[_0xc576('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 15c6fff..63056e5 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 _0x4f5d=['body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x36b8dd,_0xbe7fa5){var _0x4b243f=function(_0x5dc97b){while(--_0x5dc97b){_0x36b8dd['push'](_0x36b8dd['shift']());}};_0x4b243f(++_0xbe7fa5);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4f5d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'paranoid':![],'indexes':[{'name':_0xd4f5('0xe'),'fields':[_0xd4f5('0xf')],'type':_0xd4f5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5355e8,_0x4424cb,_0x35907b){var _0x524634=_0x2c44bb[_0xd4f5('0x11')];var _0x90fe4=_0x5355e8[_0xd4f5('0x12')]({'plain':!![]});if(_0x90fe4[_0xd4f5('0x13')][_0xd4f5('0x14')]()==='in'||_0x90fe4[_0xd4f5('0x13')][_0xd4f5('0x14')]()===_0xd4f5('0x15')&&!_0x90fe4[_0xd4f5('0x16')]&&!_['isNil'](_0x90fe4[_0xd4f5('0x17')])){_0x524634[_0xd4f5('0x18')]['findOne']({'where':{'id':_0x90fe4[_0xd4f5('0x19')]}})[_0xd4f5('0x1a')](function(_0x28e1cf){if(_0x28e1cf){_0x28e1cf['update']({'lastMsgAt':_0x90fe4[_0xd4f5('0x1b')],'lastMsgDirection':_0x90fe4[_0xd4f5('0x13')][_0xd4f5('0x14')]()});}})[_0xd4f5('0x1c')](function(_0x33f6dc){console[_0xd4f5('0x1d')](_0x33f6dc);});}_0x35907b();}},'charset':_0xd4f5('0x1e'),'collate':_0xd4f5('0x1f')});}; \ No newline at end of file +var _0xfb82=['exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes'];(function(_0xfb47fe,_0x551f03){var _0x158e0f=function(_0x2cc02e){while(--_0x2cc02e){_0xfb47fe['push'](_0xfb47fe['shift']());}};_0x158e0f(++_0x551f03);}(_0xfb82,0x17f));var _0x2fb8=function(_0x4d577f,_0x15cdfb){_0x4d577f=_0x4d577f-0x0;var _0x1912e0=_0xfb82[_0x4d577f];return _0x1912e0;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var logger=require(_0x2fb8('0x2'))('api');var moment=require(_0x2fb8('0x3'));var BPromise=require(_0x2fb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fb8('0x5'));var rimraf=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var attributes=require(_0x2fb8('0x8'));module[_0x2fb8('0x9')]=function(_0xe9a5b5,_0x3e6900){return _0xe9a5b5[_0x2fb8('0xa')](_0x2fb8('0xb'),attributes,{'tableName':_0x2fb8('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x2fb8('0xd')],'type':_0x2fb8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x428626,_0x29be44,_0x3f1637){var _0x22824a=_0xe9a5b5[_0x2fb8('0xf')];var _0x2928ef=_0x428626[_0x2fb8('0x10')]({'plain':!![]});if(_0x2928ef[_0x2fb8('0x11')][_0x2fb8('0x12')]()==='in'||_0x2928ef['direction'][_0x2fb8('0x12')]()===_0x2fb8('0x13')&&!_0x2928ef[_0x2fb8('0x14')]&&!_[_0x2fb8('0x15')](_0x2928ef['UserId'])){_0x22824a['ChatInteraction'][_0x2fb8('0x16')]({'where':{'id':_0x2928ef['ChatInteractionId']}})[_0x2fb8('0x17')](function(_0x4e70f9){if(_0x4e70f9){_0x4e70f9['update']({'lastMsgAt':_0x2928ef[_0x2fb8('0x18')],'lastMsgDirection':_0x2928ef[_0x2fb8('0x11')]['toLowerCase']()});}})['catch'](function(_0x205dd8){console[_0x2fb8('0x19')](_0x205dd8);});}_0x3f1637();}},'charset':_0x2fb8('0x1a'),'collate':_0x2fb8('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c772acf..19dfe60 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 _0x5d8d=['then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request'];(function(_0x924464,_0x536db6){var _0x5453cb=function(_0x1ac333){while(--_0x1ac333){_0x924464['push'](_0x924464['shift']());}};_0x5453cb(++_0x536db6);}(_0x5d8d,0x94));var _0xd5d8=function(_0x2e45f6,_0x419a96){_0x2e45f6=_0x2e45f6-0x0;var _0x4fea7e=_0x5d8d[_0x2e45f6];return _0x4fea7e;};'use strict';var _=require(_0xd5d8('0x0'));var util=require(_0xd5d8('0x1'));var moment=require(_0xd5d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5d8('0x3'));var fs=require('fs');var Redis=require(_0xd5d8('0x4'));var db=require(_0xd5d8('0x5'))['db'];var utils=require(_0xd5d8('0x6'));var logger=require(_0xd5d8('0x7'))(_0xd5d8('0x8'));var config=require(_0xd5d8('0x9'));var jayson=require(_0xd5d8('0xa'));var client=jayson[_0xd5d8('0xb')][_0xd5d8('0xc')]({'port':0x232a});config[_0xd5d8('0xd')]=_[_0xd5d8('0xe')](config[_0xd5d8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5d8('0xf'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x45b602,_0x2d337d,_0x1e7ece){return new BPromise(function(_0x574691,_0x4fc245){return client[_0xd5d8('0x10')](_0x45b602,_0x1e7ece)[_0xd5d8('0x11')](function(_0xd88af){logger[_0xd5d8('0x12')](_0xd5d8('0x13'),_0x2d337d,_0xd5d8('0x14'));logger[_0xd5d8('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2d337d,_0xd5d8('0x14'),JSON[_0xd5d8('0x16')](_0xd88af));if(_0xd88af[_0xd5d8('0x17')]){if(_0xd88af[_0xd5d8('0x17')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2d337d,_0xd88af[_0xd5d8('0x17')][_0xd5d8('0x18')]);return _0x4fc245(_0xd88af[_0xd5d8('0x17')][_0xd5d8('0x18')]);}logger[_0xd5d8('0x17')](_0xd5d8('0x13'),_0x2d337d,_0xd88af[_0xd5d8('0x17')][_0xd5d8('0x18')]);return _0x574691(_0xd88af[_0xd5d8('0x17')][_0xd5d8('0x18')]);}else{logger[_0xd5d8('0x12')](_0xd5d8('0x13'),_0x2d337d,_0xd5d8('0x14'));_0x574691(_0xd88af[_0xd5d8('0x19')][_0xd5d8('0x18')]);}})[_0xd5d8('0x1a')](function(_0x2979de){logger[_0xd5d8('0x17')](_0xd5d8('0x13'),_0x2d337d,_0x2979de);_0x4fc245(_0x2979de);});});}exports[_0xd5d8('0x1b')]=function(_0x337c59){var _0x355306=this;return new Promise(function(_0x49d612,_0x2984d6){return db[_0xd5d8('0x1c')][_0xd5d8('0x1d')](_0x337c59[_0xd5d8('0x1e')],{'raw':_0x337c59[_0xd5d8('0x1f')]?_0x337c59[_0xd5d8('0x1f')][_0xd5d8('0x20')]===undefined?!![]:![]:!![]})[_0xd5d8('0x11')](function(_0x3056b0){logger[_0xd5d8('0x12')](_0xd5d8('0x1b'),_0x337c59);logger[_0xd5d8('0x15')](_0xd5d8('0x1b'),_0x337c59,JSON[_0xd5d8('0x16')](_0x3056b0));_0x49d612(_0x3056b0);})[_0xd5d8('0x1a')](function(_0x31d20b){logger[_0xd5d8('0x17')]('CreateChatMessage',_0x31d20b[_0xd5d8('0x18')],_0x337c59);_0x2984d6(_0x355306[_0xd5d8('0x17')](0x1f4,_0x31d20b[_0xd5d8('0x18')]));});});}; \ No newline at end of file +var _0x951b=['create','body','options','CreateChatMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ChatMessage'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0x951b,0x144));var _0xb951=function(_0x5542ce,_0x9ec4f){_0x5542ce=_0x5542ce-0x0;var _0x80ce95=_0x951b[_0x5542ce];return _0x80ce95;};'use strict';var _=require(_0xb951('0x0'));var util=require('util');var moment=require(_0xb951('0x1'));var BPromise=require(_0xb951('0x2'));var rs=require(_0xb951('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb951('0x4'))['db'];var utils=require(_0xb951('0x5'));var logger=require(_0xb951('0x6'))(_0xb951('0x7'));var config=require(_0xb951('0x8'));var jayson=require(_0xb951('0x9'));var client=jayson['client'][_0xb951('0xa')]({'port':0x232a});config[_0xb951('0xb')]=_[_0xb951('0xc')](config[_0xb951('0xb')],{'host':_0xb951('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb951('0xb')]));require(_0xb951('0xe'))[_0xb951('0xf')](socket);function respondWithRpcPromise(_0x855407,_0x41938e,_0x126478){return new BPromise(function(_0x41165c,_0x3b1ea9){return client['request'](_0x855407,_0x126478)[_0xb951('0x10')](function(_0x4898ec){logger['info'](_0xb951('0x11'),_0x41938e,'request\x20sent');logger[_0xb951('0x12')](_0xb951('0x13'),_0x41938e,_0xb951('0x14'),JSON[_0xb951('0x15')](_0x4898ec));if(_0x4898ec[_0xb951('0x16')]){if(_0x4898ec[_0xb951('0x16')][_0xb951('0x17')]===0x1f4){logger[_0xb951('0x16')]('ChatMessage,\x20%s,\x20%s',_0x41938e,_0x4898ec['error'][_0xb951('0x18')]);return _0x3b1ea9(_0x4898ec['error']['message']);}logger[_0xb951('0x16')](_0xb951('0x11'),_0x41938e,_0x4898ec[_0xb951('0x16')][_0xb951('0x18')]);return _0x41165c(_0x4898ec[_0xb951('0x16')]['message']);}else{logger[_0xb951('0x19')](_0xb951('0x11'),_0x41938e,_0xb951('0x14'));_0x41165c(_0x4898ec['result'][_0xb951('0x18')]);}})[_0xb951('0x1a')](function(_0x3503a1){logger[_0xb951('0x16')](_0xb951('0x11'),_0x41938e,_0x3503a1);_0x3b1ea9(_0x3503a1);});});}exports['CreateChatMessage']=function(_0x158565){var _0x5297f4=this;return new Promise(function(_0x238558,_0xc77d19){return db[_0xb951('0x1b')][_0xb951('0x1c')](_0x158565[_0xb951('0x1d')],{'raw':_0x158565[_0xb951('0x1e')]?_0x158565[_0xb951('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c049f){logger[_0xb951('0x19')]('CreateChatMessage',_0x158565);logger[_0xb951('0x12')](_0xb951('0x1f'),_0x158565,JSON[_0xb951('0x15')](_0x2c049f));_0x238558(_0x2c049f);})['catch'](function(_0x3eb98f){logger[_0xb951('0x16')](_0xb951('0x1f'),_0x3eb98f[_0xb951('0x18')],_0x158565);_0xc77d19(_0x5297f4[_0xb951('0x16')](0x1f4,_0x3eb98f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e205511..bf68ffa 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 _0xe3da=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x18888a,_0x2c512b){var _0x31c254=function(_0x1d7eef){while(--_0x1d7eef){_0x18888a['push'](_0x18888a['shift']());}};_0x31c254(++_0x2c512b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var ChatMessageEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){ChatMessageEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);ChatMessageEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file +var _0x9536=['length','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x9536,0x179));var _0x6953=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x9536[_0x5d0609];return _0xaa3fd1;};'use strict';var ChatMessageEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){ChatMessageEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('chatMessage:'+_0x3e1aff,_0x494ac2);ChatMessageEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b9bdf73..cd97e0c 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 _0x0f3f=['/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','create','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f3f,0xc8));var _0xf0f3=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x0f3f[_0x3826ad];return _0x17b900;};'use strict';var multer=require('multer');var util=require(_0xf0f3('0x0'));var path=require(_0xf0f3('0x1'));var timeout=require(_0xf0f3('0x2'));var express=require(_0xf0f3('0x3'));var router=express[_0xf0f3('0x4')]();var auth=require(_0xf0f3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf0f3('0x6'));router[_0xf0f3('0x7')]('/',auth[_0xf0f3('0x8')](),controller[_0xf0f3('0x9')]);router[_0xf0f3('0x7')](_0xf0f3('0xa'),auth[_0xf0f3('0x8')](),controller['describe']);router[_0xf0f3('0x7')]('/:id',auth[_0xf0f3('0x8')](),controller[_0xf0f3('0xb')]);router[_0xf0f3('0xc')]('/',auth[_0xf0f3('0x8')](),interaction[_0xf0f3('0xd')]('chat','chatmessage:create'),controller[_0xf0f3('0xe')]);router['put'](_0xf0f3('0xf'),controller['update']);router['put'](_0xf0f3('0x10'),auth[_0xf0f3('0x8')](),controller[_0xf0f3('0x11')]);router[_0xf0f3('0x12')](_0xf0f3('0x13'),auth['isAuthenticated'](),controller[_0xf0f3('0x14')]);router[_0xf0f3('0x15')]('/:id',auth[_0xf0f3('0x8')](),controller[_0xf0f3('0x16')]);module[_0xf0f3('0x17')]=router; \ No newline at end of file +var _0x04ee=['describe','/:id','show','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x04ee,0x188));var _0xe04e=function(_0x56fc77,_0x16daa8){_0x56fc77=_0x56fc77-0x0;var _0x196f7d=_0x04ee[_0x56fc77];return _0x196f7d;};'use strict';var multer=require(_0xe04e('0x0'));var util=require(_0xe04e('0x1'));var path=require(_0xe04e('0x2'));var timeout=require(_0xe04e('0x3'));var express=require(_0xe04e('0x4'));var router=express[_0xe04e('0x5')]();var auth=require(_0xe04e('0x6'));var interaction=require(_0xe04e('0x7'));var config=require('../../config/environment');var controller=require(_0xe04e('0x8'));router[_0xe04e('0x9')]('/',auth[_0xe04e('0xa')](),controller[_0xe04e('0xb')]);router['get'](_0xe04e('0xc'),auth[_0xe04e('0xa')](),controller[_0xe04e('0xd')]);router[_0xe04e('0x9')](_0xe04e('0xe'),auth[_0xe04e('0xa')](),controller[_0xe04e('0xf')]);router['post']('/',auth[_0xe04e('0xa')](),interaction[_0xe04e('0x10')](_0xe04e('0x11'),_0xe04e('0x12')),controller[_0xe04e('0x13')]);router[_0xe04e('0x14')](_0xe04e('0xe'),controller['update']);router['put'](_0xe04e('0x15'),auth[_0xe04e('0xa')](),controller[_0xe04e('0x16')]);router[_0xe04e('0x14')](_0xe04e('0x17'),auth[_0xe04e('0xa')](),controller[_0xe04e('0x18')]);router['delete'](_0xe04e('0xe'),auth[_0xe04e('0xa')](),controller[_0xe04e('0x19')]);module[_0xe04e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2caff2e..53a4a83 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 _0x5a7a=['TEXT','medium','sequelize'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x5a7a,0x83));var _0xa5a7=function(_0x342285,_0x30fefc){_0x342285=_0x342285-0x0;var _0x175086=_0x5a7a[_0x342285];return _0x175086;};'use strict';var Sequelize=require(_0xa5a7('0x0'));module['exports']={'body':{'type':Sequelize[_0xa5a7('0x1')](_0xa5a7('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xc4d5=['medium','sequelize','exports'];(function(_0x3caaf7,_0x2aa494){var _0x198918=function(_0x5409f6){while(--_0x5409f6){_0x3caaf7['push'](_0x3caaf7['shift']());}};_0x198918(++_0x2aa494);}(_0xc4d5,0x1a5));var _0x5c4d=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xc4d5[_0x1f1e31];return _0x229b56;};'use strict';var Sequelize=require(_0x5c4d('0x0'));module[_0x5c4d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5c4d('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 21a22f0..57fe7d7 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 _0x573c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filters','merge','where','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5441f5,_0x208a03){var _0x1e8513=function(_0x5abc93){while(--_0x5abc93){_0x5441f5['push'](_0x5441f5['shift']());}};_0x1e8513(++_0x208a03);}(_0x573c,0x125));var _0xc573=function(_0x3a0019,_0x1011fc){_0x3a0019=_0x3a0019-0x0;var _0x2ee6e6=_0x573c[_0x3a0019];return _0x2ee6e6;};'use strict';var pdf=require(_0xc573('0x0'));var emlformat=require(_0xc573('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc573('0x2'));var jsonpatch=require(_0xc573('0x3'));var rp=require(_0xc573('0x4'));var moment=require(_0xc573('0x5'));var BPromise=require(_0xc573('0x6'));var Mustache=require(_0xc573('0x7'));var util=require('util');var path=require(_0xc573('0x8'));var sox=require(_0xc573('0x9'));var csv=require(_0xc573('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc573('0xb'));var squel=require('squel');var crypto=require(_0xc573('0xc'));var jsforce=require(_0xc573('0xd'));var deskjs=require(_0xc573('0xe'));var toCsv=require(_0xc573('0xa'));var querystring=require('querystring');var Papa=require(_0xc573('0xf'));var Redis=require(_0xc573('0x10'));var authService=require(_0xc573('0x11'));var qs=require(_0xc573('0x12'));var as=require(_0xc573('0x13'));var hardwareService=require(_0xc573('0x14'));var logger=require(_0xc573('0x15'))(_0xc573('0x16'));var utils=require(_0xc573('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc573('0x18'))['db'];function respondWithStatusCode(_0x1a626e,_0x1949d0){_0x1949d0=_0x1949d0||0xcc;return function(_0x2c4239){if(_0x2c4239){return _0x1a626e[_0xc573('0x19')](_0x1949d0);}return _0x1a626e[_0xc573('0x1a')](_0x1949d0)[_0xc573('0x1b')]();};}function respondWithResult(_0x377a5d,_0x2e0c02){_0x2e0c02=_0x2e0c02||0xc8;return function(_0x258231){if(_0x258231){return _0x377a5d[_0xc573('0x1a')](_0x2e0c02)[_0xc573('0x1c')](_0x258231);}};}function respondWithFilteredResult(_0x4199b6,_0x2b25f9){return function(_0x2f8a3e){if(_0x2f8a3e){var _0x5b6e=_0x2f8a3e['count'],_0x5c0c70=_0x2b25f9[_0xc573('0x1d')],_0x32ba83=_0x2b25f9['offset']+_0x2b25f9['limit'],_0x22064a;if(_0x32ba83>=_0x5b6e){_0x32ba83=_0x5b6e;_0x22064a=0xc8;}else{_0x22064a=0xce;}_0x4199b6['status'](_0x22064a);return _0x4199b6[_0xc573('0x1e')](_0xc573('0x1f'),_0x5c0c70+'-'+_0x32ba83+'/'+_0x5b6e)['json'](_0x2f8a3e);}return null;};}function patchUpdates(_0x26e8c7){return function(_0x5e01cc){try{jsonpatch[_0xc573('0x20')](_0x5e01cc,_0x26e8c7,!![]);}catch(_0x390b19){return BPromise[_0xc573('0x21')](_0x390b19);}return _0x5e01cc[_0xc573('0x22')]();};}function saveUpdates(_0x4b9fed,_0xe40809){return function(_0x524baf){if(_0x524baf){return _0x524baf[_0xc573('0x23')](_0x4b9fed)[_0xc573('0x24')](function(_0x2dbd4f){return _0x2dbd4f;});}return null;};}function removeEntity(_0xaf4def,_0x49a6a6){return function(_0x494954){if(_0x494954){return _0x494954[_0xc573('0x25')]()[_0xc573('0x24')](function(){_0xaf4def[_0xc573('0x1a')](0xcc)[_0xc573('0x1b')]();});}};}function handleEntityNotFound(_0x296e60,_0x27f5af){return function(_0x22da91){if(!_0x22da91){_0x296e60[_0xc573('0x19')](0x194);}return _0x22da91;};}function handleError(_0x20d5f6,_0x1624b8){_0x1624b8=_0x1624b8||0x1f4;return function(_0x13833a){logger[_0xc573('0x26')](_0x13833a[_0xc573('0x27')]);if(_0x13833a[_0xc573('0x28')]){delete _0x13833a[_0xc573('0x28')];}_0x20d5f6[_0xc573('0x1a')](_0x1624b8)[_0xc573('0x29')](_0x13833a);};}exports[_0xc573('0x2a')]=function(_0x295925,_0x296350){var _0x401c69={},_0x3e4bf9={},_0x5c3e2f={'count':0x0,'rows':[]};var _0x4f571b=_[_0xc573('0x2b')](db[_0xc573('0x2c')][_0xc573('0x2d')],function(_0x276e39){return{'name':_0x276e39[_0xc573('0x2e')],'type':_0x276e39['type'][_0xc573('0x2f')]};});_0x3e4bf9[_0xc573('0x30')]=_[_0xc573('0x2b')](_0x4f571b,'name');_0x3e4bf9['query']=_[_0xc573('0x31')](_0x295925[_0xc573('0x32')]);_0x3e4bf9['filters']=_['intersection'](_0x3e4bf9[_0xc573('0x30')],_0x3e4bf9[_0xc573('0x32')]);_0x401c69[_0xc573('0x33')]=_['intersection'](_0x3e4bf9[_0xc573('0x30')],qs['fields'](_0x295925[_0xc573('0x32')][_0xc573('0x34')]));_0x401c69[_0xc573('0x33')]=_0x401c69[_0xc573('0x33')][_0xc573('0x35')]?_0x401c69['attributes']:_0x3e4bf9[_0xc573('0x30')];if(!_0x295925['query'][_0xc573('0x36')](_0xc573('0x37'))){_0x401c69['limit']=qs[_0xc573('0x38')](_0x295925[_0xc573('0x32')][_0xc573('0x38')]);_0x401c69['offset']=qs[_0xc573('0x1d')](_0x295925['query'][_0xc573('0x1d')]);}_0x401c69[_0xc573('0x39')]=qs['sort'](_0x295925['query']['sort']);_0x401c69['where']=qs['filters'](_[_0xc573('0x3a')](_0x295925[_0xc573('0x32')],_0x3e4bf9[_0xc573('0x3b')]),_0x4f571b);if(_0x295925[_0xc573('0x32')]['filter']){_0x401c69['where']=_[_0xc573('0x3c')](_0x401c69[_0xc573('0x3d')],{'$or':_[_0xc573('0x2b')](_0x4f571b,function(_0x2cbd14){if(_0x2cbd14[_0xc573('0x3e')]!==_0xc573('0x3f')){var _0x862e0c={};_0x862e0c[_0x2cbd14[_0xc573('0x28')]]={'$like':'%'+_0x295925[_0xc573('0x32')][_0xc573('0x40')]+'%'};return _0x862e0c;}})});}_0x401c69=_['merge']({},_0x401c69,_0x295925['options']);var _0x33ee5d={'where':_0x401c69['where']};return db[_0xc573('0x2c')][_0xc573('0x41')](_0x33ee5d)[_0xc573('0x24')](function(_0x2a2b97){_0x5c3e2f[_0xc573('0x41')]=_0x2a2b97;if(_0x295925['query'][_0xc573('0x42')]){_0x401c69[_0xc573('0x43')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xc573('0x44')](_0x401c69);})[_0xc573('0x24')](function(_0x43a078){_0x5c3e2f[_0xc573('0x45')]=_0x43a078;return _0x5c3e2f;})['then'](respondWithFilteredResult(_0x296350,_0x401c69))[_0xc573('0x46')](handleError(_0x296350,null));};exports[_0xc573('0x47')]=function(_0x241192,_0x30ea46){var _0x130cfc={'raw':!![],'where':{'id':_0x241192[_0xc573('0x48')]['id']}},_0x1da89c={};_0x1da89c[_0xc573('0x30')]=_[_0xc573('0x31')](db[_0xc573('0x2c')]['rawAttributes']);_0x1da89c[_0xc573('0x32')]=_[_0xc573('0x31')](_0x241192[_0xc573('0x32')]);_0x1da89c[_0xc573('0x3b')]=_[_0xc573('0x49')](_0x1da89c[_0xc573('0x30')],_0x1da89c[_0xc573('0x32')]);_0x130cfc[_0xc573('0x33')]=_['intersection'](_0x1da89c['model'],qs[_0xc573('0x34')](_0x241192[_0xc573('0x32')]['fields']));_0x130cfc[_0xc573('0x33')]=_0x130cfc[_0xc573('0x33')][_0xc573('0x35')]?_0x130cfc[_0xc573('0x33')]:_0x1da89c[_0xc573('0x30')];if(_0x241192[_0xc573('0x32')][_0xc573('0x42')]){_0x130cfc[_0xc573('0x43')]=[{'all':!![]}];}_0x130cfc=_[_0xc573('0x3c')]({},_0x130cfc,_0x241192['options']);return db[_0xc573('0x2c')]['find'](_0x130cfc)[_0xc573('0x24')](handleEntityNotFound(_0x30ea46,null))['then'](respondWithResult(_0x30ea46,null))['catch'](handleError(_0x30ea46,null));};exports[_0xc573('0x4a')]=function(_0x3109c9,_0x200888){return db['ChatOfflineMessage'][_0xc573('0x4a')](_0x3109c9[_0xc573('0x4b')],{})[_0xc573('0x24')](respondWithResult(_0x200888,0xc9))[_0xc573('0x46')](handleError(_0x200888,null));};exports[_0xc573('0x23')]=function(_0x589518,_0x3e3b0c){if(_0x589518[_0xc573('0x4b')]['id']){delete _0x589518[_0xc573('0x4b')]['id'];}return db[_0xc573('0x2c')][_0xc573('0x4c')]({'where':{'id':_0x589518[_0xc573('0x48')]['id']}})[_0xc573('0x24')](handleEntityNotFound(_0x3e3b0c,null))['then'](saveUpdates(_0x589518[_0xc573('0x4b')],null))[_0xc573('0x24')](respondWithResult(_0x3e3b0c,null))[_0xc573('0x46')](handleError(_0x3e3b0c,null));};exports[_0xc573('0x25')]=function(_0x4065c7,_0x54eae2){return db['ChatOfflineMessage'][_0xc573('0x4c')]({'where':{'id':_0x4065c7[_0xc573('0x48')]['id']}})[_0xc573('0x24')](handleEntityNotFound(_0x54eae2,null))[_0xc573('0x24')](removeEntity(_0x54eae2,null))[_0xc573('0x46')](handleError(_0x54eae2,null));};exports[_0xc573('0x4d')]=function(_0x2d8d0b,_0x5dc3c1){return db['ChatOfflineMessage']['describe']()[_0xc573('0x24')](respondWithResult(_0x5dc3c1,null))[_0xc573('0x46')](handleError(_0x5dc3c1,null));}; \ No newline at end of file +var _0xdf9f=['offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','create','body','catch','find','destroy','describe','html-pdf','eml-format','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xdf9f,0x10f));var _0xfdf9=function(_0x3d8f76,_0xcd53b6){_0x3d8f76=_0x3d8f76-0x0;var _0x5922fb=_0xdf9f[_0x3d8f76];return _0x5922fb;};'use strict';var pdf=require(_0xfdf9('0x0'));var emlformat=require(_0xfdf9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfdf9('0x2'));var BPromise=require(_0xfdf9('0x3'));var Mustache=require('mustache');var util=require(_0xfdf9('0x4'));var path=require('path');var sox=require(_0xfdf9('0x5'));var csv=require(_0xfdf9('0x6'));var ejs=require(_0xfdf9('0x7'));var fs=require('fs');var _=require(_0xfdf9('0x8'));var squel=require(_0xfdf9('0x9'));var crypto=require(_0xfdf9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfdf9('0xb'));var toCsv=require(_0xfdf9('0x6'));var querystring=require(_0xfdf9('0xc'));var Papa=require(_0xfdf9('0xd'));var Redis=require(_0xfdf9('0xe'));var authService=require(_0xfdf9('0xf'));var qs=require(_0xfdf9('0x10'));var as=require(_0xfdf9('0x11'));var hardwareService=require(_0xfdf9('0x12'));var logger=require(_0xfdf9('0x13'))(_0xfdf9('0x14'));var utils=require(_0xfdf9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfdf9('0x16'));var db=require(_0xfdf9('0x17'))['db'];function respondWithStatusCode(_0x285e84,_0x5a2536){_0x5a2536=_0x5a2536||0xcc;return function(_0x64c676){if(_0x64c676){return _0x285e84[_0xfdf9('0x18')](_0x5a2536);}return _0x285e84[_0xfdf9('0x19')](_0x5a2536)[_0xfdf9('0x1a')]();};}function respondWithResult(_0x130fd2,_0x342366){_0x342366=_0x342366||0xc8;return function(_0x4b2136){if(_0x4b2136){return _0x130fd2[_0xfdf9('0x19')](_0x342366)[_0xfdf9('0x1b')](_0x4b2136);}};}function respondWithFilteredResult(_0x4daa9d,_0x58be0a){return function(_0x358e9c){if(_0x358e9c){var _0xd303b6=_0x358e9c[_0xfdf9('0x1c')],_0x531981=_0x58be0a[_0xfdf9('0x1d')],_0x140e18=_0x58be0a['offset']+_0x58be0a[_0xfdf9('0x1e')],_0x3adccd;if(_0x140e18>=_0xd303b6){_0x140e18=_0xd303b6;_0x3adccd=0xc8;}else{_0x3adccd=0xce;}_0x4daa9d[_0xfdf9('0x19')](_0x3adccd);return _0x4daa9d[_0xfdf9('0x1f')](_0xfdf9('0x20'),_0x531981+'-'+_0x140e18+'/'+_0xd303b6)['json'](_0x358e9c);}return null;};}function patchUpdates(_0x54b16e){return function(_0x3fa0b2){try{jsonpatch[_0xfdf9('0x21')](_0x3fa0b2,_0x54b16e,!![]);}catch(_0x274d4b){return BPromise[_0xfdf9('0x22')](_0x274d4b);}return _0x3fa0b2[_0xfdf9('0x23')]();};}function saveUpdates(_0x4024f1,_0x4d9bd3){return function(_0x144deb){if(_0x144deb){return _0x144deb[_0xfdf9('0x24')](_0x4024f1)[_0xfdf9('0x25')](function(_0x2bba9e){return _0x2bba9e;});}return null;};}function removeEntity(_0xb55313,_0x20fab1){return function(_0x554761){if(_0x554761){return _0x554761['destroy']()['then'](function(){_0xb55313['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x471f28,_0x5d24b6){return function(_0x5bc57d){if(!_0x5bc57d){_0x471f28[_0xfdf9('0x18')](0x194);}return _0x5bc57d;};}function handleError(_0x331c3e,_0x1aab4a){_0x1aab4a=_0x1aab4a||0x1f4;return function(_0x2ee834){logger['error'](_0x2ee834[_0xfdf9('0x26')]);if(_0x2ee834[_0xfdf9('0x27')]){delete _0x2ee834[_0xfdf9('0x27')];}_0x331c3e[_0xfdf9('0x19')](_0x1aab4a)[_0xfdf9('0x28')](_0x2ee834);};}exports[_0xfdf9('0x29')]=function(_0x150412,_0x1054e0){var _0x57f020={},_0x499d46={},_0x7d6152={'count':0x0,'rows':[]};var _0x4b1412=_[_0xfdf9('0x2a')](db[_0xfdf9('0x2b')][_0xfdf9('0x2c')],function(_0x2de88){return{'name':_0x2de88[_0xfdf9('0x2d')],'type':_0x2de88[_0xfdf9('0x2e')][_0xfdf9('0x2f')]};});_0x499d46[_0xfdf9('0x30')]=_[_0xfdf9('0x2a')](_0x4b1412,'name');_0x499d46['query']=_[_0xfdf9('0x31')](_0x150412['query']);_0x499d46['filters']=_[_0xfdf9('0x32')](_0x499d46[_0xfdf9('0x30')],_0x499d46[_0xfdf9('0x33')]);_0x57f020[_0xfdf9('0x34')]=_[_0xfdf9('0x32')](_0x499d46[_0xfdf9('0x30')],qs[_0xfdf9('0x35')](_0x150412['query'][_0xfdf9('0x35')]));_0x57f020['attributes']=_0x57f020[_0xfdf9('0x34')]['length']?_0x57f020[_0xfdf9('0x34')]:_0x499d46['model'];if(!_0x150412['query'][_0xfdf9('0x36')](_0xfdf9('0x37'))){_0x57f020[_0xfdf9('0x1e')]=qs['limit'](_0x150412[_0xfdf9('0x33')][_0xfdf9('0x1e')]);_0x57f020[_0xfdf9('0x1d')]=qs[_0xfdf9('0x1d')](_0x150412[_0xfdf9('0x33')][_0xfdf9('0x1d')]);}_0x57f020[_0xfdf9('0x38')]=qs[_0xfdf9('0x39')](_0x150412['query'][_0xfdf9('0x39')]);_0x57f020[_0xfdf9('0x3a')]=qs[_0xfdf9('0x3b')](_[_0xfdf9('0x3c')](_0x150412[_0xfdf9('0x33')],_0x499d46[_0xfdf9('0x3b')]),_0x4b1412);if(_0x150412['query'][_0xfdf9('0x3d')]){_0x57f020[_0xfdf9('0x3a')]=_[_0xfdf9('0x3e')](_0x57f020[_0xfdf9('0x3a')],{'$or':_[_0xfdf9('0x2a')](_0x4b1412,function(_0x3c2c4e){if(_0x3c2c4e[_0xfdf9('0x2e')]!==_0xfdf9('0x3f')){var _0x512565={};_0x512565[_0x3c2c4e[_0xfdf9('0x27')]]={'$like':'%'+_0x150412[_0xfdf9('0x33')][_0xfdf9('0x3d')]+'%'};return _0x512565;}})});}_0x57f020=_[_0xfdf9('0x3e')]({},_0x57f020,_0x150412[_0xfdf9('0x40')]);var _0x390e91={'where':_0x57f020[_0xfdf9('0x3a')]};return db[_0xfdf9('0x2b')][_0xfdf9('0x1c')](_0x390e91)[_0xfdf9('0x25')](function(_0x229b96){_0x7d6152['count']=_0x229b96;if(_0x150412[_0xfdf9('0x33')][_0xfdf9('0x41')]){_0x57f020[_0xfdf9('0x42')]=[{'all':!![]}];}return db[_0xfdf9('0x2b')]['findAll'](_0x57f020);})['then'](function(_0x1e5d57){_0x7d6152['rows']=_0x1e5d57;return _0x7d6152;})[_0xfdf9('0x25')](respondWithFilteredResult(_0x1054e0,_0x57f020))['catch'](handleError(_0x1054e0,null));};exports[_0xfdf9('0x43')]=function(_0x2853b9,_0x1318f7){var _0x1381d6={'raw':!![],'where':{'id':_0x2853b9[_0xfdf9('0x44')]['id']}},_0x3f085b={};_0x3f085b[_0xfdf9('0x30')]=_[_0xfdf9('0x31')](db['ChatOfflineMessage'][_0xfdf9('0x2c')]);_0x3f085b[_0xfdf9('0x33')]=_[_0xfdf9('0x31')](_0x2853b9[_0xfdf9('0x33')]);_0x3f085b[_0xfdf9('0x3b')]=_[_0xfdf9('0x32')](_0x3f085b[_0xfdf9('0x30')],_0x3f085b[_0xfdf9('0x33')]);_0x1381d6[_0xfdf9('0x34')]=_[_0xfdf9('0x32')](_0x3f085b[_0xfdf9('0x30')],qs[_0xfdf9('0x35')](_0x2853b9[_0xfdf9('0x33')][_0xfdf9('0x35')]));_0x1381d6[_0xfdf9('0x34')]=_0x1381d6[_0xfdf9('0x34')]['length']?_0x1381d6[_0xfdf9('0x34')]:_0x3f085b[_0xfdf9('0x30')];if(_0x2853b9[_0xfdf9('0x33')][_0xfdf9('0x41')]){_0x1381d6[_0xfdf9('0x42')]=[{'all':!![]}];}_0x1381d6=_[_0xfdf9('0x3e')]({},_0x1381d6,_0x2853b9['options']);return db[_0xfdf9('0x2b')]['find'](_0x1381d6)['then'](handleEntityNotFound(_0x1318f7,null))[_0xfdf9('0x25')](respondWithResult(_0x1318f7,null))['catch'](handleError(_0x1318f7,null));};exports['create']=function(_0xcc1b36,_0x401859){return db[_0xfdf9('0x2b')][_0xfdf9('0x45')](_0xcc1b36[_0xfdf9('0x46')],{})[_0xfdf9('0x25')](respondWithResult(_0x401859,0xc9))[_0xfdf9('0x47')](handleError(_0x401859,null));};exports[_0xfdf9('0x24')]=function(_0x530491,_0x3edd58){if(_0x530491[_0xfdf9('0x46')]['id']){delete _0x530491[_0xfdf9('0x46')]['id'];}return db['ChatOfflineMessage'][_0xfdf9('0x48')]({'where':{'id':_0x530491[_0xfdf9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3edd58,null))[_0xfdf9('0x25')](saveUpdates(_0x530491[_0xfdf9('0x46')],null))[_0xfdf9('0x25')](respondWithResult(_0x3edd58,null))[_0xfdf9('0x47')](handleError(_0x3edd58,null));};exports[_0xfdf9('0x49')]=function(_0x3a7bfe,_0x263713){return db['ChatOfflineMessage'][_0xfdf9('0x48')]({'where':{'id':_0x3a7bfe[_0xfdf9('0x44')]['id']}})[_0xfdf9('0x25')](handleEntityNotFound(_0x263713,null))[_0xfdf9('0x25')](removeEntity(_0x263713,null))[_0xfdf9('0x47')](handleError(_0x263713,null));};exports[_0xfdf9('0x4a')]=function(_0x38335f,_0x4c39d6){return db['ChatOfflineMessage'][_0xfdf9('0x4a')]()[_0xfdf9('0x25')](respondWithResult(_0x4c39d6,null))[_0xfdf9('0x47')](handleError(_0x4c39d6,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2bdf8ae..835940e 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 _0xedd9=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x506f82,_0xf2c437){var _0xbb7744=function(_0x9e063d){while(--_0x9e063d){_0x506f82['push'](_0x506f82['shift']());}};_0xbb7744(++_0xf2c437);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b43f1,_0x42f22b){_0x3b43f1=_0x3b43f1-0x0;var _0x4c4401=_0xedd9[_0x3b43f1];return _0x4c4401;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9edd('0xb'),'collate':_0x9edd('0xc')});}; \ No newline at end of file +var _0x2d17=['api','moment','request-promise','path','../../config/environment','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x59cdde,_0x3a263a){var _0x2df13b=function(_0x235319){while(--_0x235319){_0x59cdde['push'](_0x59cdde['shift']());}};_0x2df13b(++_0x3a263a);}(_0x2d17,0x17e));var _0x72d1=function(_0x41e2a5,_0x47f5e9){_0x41e2a5=_0x41e2a5-0x0;var _0x2227e2=_0x2d17[_0x41e2a5];return _0x2227e2;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72d1('0xa'),'collate':_0x72d1('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f531101..4bc0538 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 _0xc51d=['ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x47519d,_0x10f09c){var _0x40551c=function(_0x44753a){while(--_0x44753a){_0x47519d['push'](_0x47519d['shift']());}};_0x40551c(++_0x10f09c);}(_0xc51d,0x1d0));var _0xdc51=function(_0xdcfb04,_0x3ca45a){_0xdcfb04=_0xdcfb04-0x0;var _0x1a03d6=_0xc51d[_0xdcfb04];return _0x1a03d6;};'use strict';var _=require(_0xdc51('0x0'));var util=require(_0xdc51('0x1'));var moment=require(_0xdc51('0x2'));var BPromise=require(_0xdc51('0x3'));var rs=require(_0xdc51('0x4'));var fs=require('fs');var Redis=require(_0xdc51('0x5'));var db=require(_0xdc51('0x6'))['db'];var utils=require(_0xdc51('0x7'));var logger=require('../../config/logger')(_0xdc51('0x8'));var config=require(_0xdc51('0x9'));var jayson=require(_0xdc51('0xa'));var client=jayson[_0xdc51('0xb')][_0xdc51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2563d2,_0x2ded37,_0x1dc9da){return new BPromise(function(_0xa7ed45,_0x7c6e87){return client[_0xdc51('0xd')](_0x2563d2,_0x1dc9da)[_0xdc51('0xe')](function(_0x2a5fcb){logger[_0xdc51('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ded37,_0xdc51('0x10'));logger['debug'](_0xdc51('0x11'),_0x2ded37,_0xdc51('0x10'),JSON['stringify'](_0x2a5fcb));if(_0x2a5fcb[_0xdc51('0x12')]){if(_0x2a5fcb['error']['code']===0x1f4){logger[_0xdc51('0x12')](_0xdc51('0x13'),_0x2ded37,_0x2a5fcb[_0xdc51('0x12')]['message']);return _0x7c6e87(_0x2a5fcb[_0xdc51('0x12')]['message']);}logger[_0xdc51('0x12')](_0xdc51('0x13'),_0x2ded37,_0x2a5fcb[_0xdc51('0x12')][_0xdc51('0x14')]);return _0xa7ed45(_0x2a5fcb[_0xdc51('0x12')][_0xdc51('0x14')]);}else{logger[_0xdc51('0xf')](_0xdc51('0x13'),_0x2ded37,_0xdc51('0x10'));_0xa7ed45(_0x2a5fcb[_0xdc51('0x15')][_0xdc51('0x14')]);}})[_0xdc51('0x16')](function(_0x3466de){logger[_0xdc51('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ded37,_0x3466de);_0x7c6e87(_0x3466de);});});} \ No newline at end of file +var _0xceec=['error','message','ChatOfflineMessage,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xceec,0x1ea));var _0xccee=function(_0xad3c87,_0xbc283e){_0xad3c87=_0xad3c87-0x0;var _0x2ce676=_0xceec[_0xad3c87];return _0x2ce676;};'use strict';var _=require('lodash');var util=require(_0xccee('0x0'));var moment=require(_0xccee('0x1'));var BPromise=require(_0xccee('0x2'));var rs=require(_0xccee('0x3'));var fs=require('fs');var Redis=require(_0xccee('0x4'));var db=require(_0xccee('0x5'))['db'];var utils=require(_0xccee('0x6'));var logger=require('../../config/logger')(_0xccee('0x7'));var config=require(_0xccee('0x8'));var jayson=require(_0xccee('0x9'));var client=jayson[_0xccee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x275d99,_0x36b4ad,_0x3d01ea){return new BPromise(function(_0x39ffb6,_0x3f5207){return client[_0xccee('0xb')](_0x275d99,_0x3d01ea)[_0xccee('0xc')](function(_0xcb9ad2){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x36b4ad,_0xccee('0xd'));logger[_0xccee('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x36b4ad,_0xccee('0xd'),JSON[_0xccee('0xf')](_0xcb9ad2));if(_0xcb9ad2[_0xccee('0x10')]){if(_0xcb9ad2[_0xccee('0x10')]['code']===0x1f4){logger[_0xccee('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x36b4ad,_0xcb9ad2[_0xccee('0x10')][_0xccee('0x11')]);return _0x3f5207(_0xcb9ad2[_0xccee('0x10')][_0xccee('0x11')]);}logger[_0xccee('0x10')](_0xccee('0x12'),_0x36b4ad,_0xcb9ad2[_0xccee('0x10')][_0xccee('0x11')]);return _0x39ffb6(_0xcb9ad2[_0xccee('0x10')][_0xccee('0x11')]);}else{logger[_0xccee('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x36b4ad,_0xccee('0xd'));_0x39ffb6(_0xcb9ad2[_0xccee('0x14')][_0xccee('0x11')]);}})[_0xccee('0x15')](function(_0x37015d){logger[_0xccee('0x10')](_0xccee('0x12'),_0x36b4ad,_0x37015d);_0x3f5207(_0x37015d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ad93d99..8838b4b 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 _0x5936=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4ccd33,_0x482476){var _0x10bb76=function(_0x3d18b8){while(--_0x3d18b8){_0x4ccd33['push'](_0x4ccd33['shift']());}};_0x10bb76(++_0x482476);}(_0x5936,0x1ce));var _0x6593=function(_0x28a5c6,_0x44e7b1){_0x28a5c6=_0x28a5c6-0x0;var _0x5e0fb6=_0x5936[_0x28a5c6];return _0x5e0fb6;};'use strict';var multer=require(_0x6593('0x0'));var util=require(_0x6593('0x1'));var path=require(_0x6593('0x2'));var timeout=require('connect-timeout');var express=require(_0x6593('0x3'));var router=express[_0x6593('0x4')]();var auth=require(_0x6593('0x5'));var interaction=require(_0x6593('0x6'));var config=require(_0x6593('0x7'));var controller=require(_0x6593('0x8'));router[_0x6593('0x9')]('/',auth[_0x6593('0xa')](),controller[_0x6593('0xb')]);router[_0x6593('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6593('0xc')]);router[_0x6593('0x9')](_0x6593('0xd'),auth['isAuthenticated'](),controller[_0x6593('0xe')]);router[_0x6593('0xf')]('/',auth[_0x6593('0xa')](),controller[_0x6593('0x10')]);router['put']('/:id',auth[_0x6593('0xa')](),controller[_0x6593('0x11')]);router[_0x6593('0x12')](_0x6593('0xd'),auth[_0x6593('0xa')](),controller[_0x6593('0x13')]);module[_0x6593('0x14')]=router; \ No newline at end of file +var _0x3c30=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0x3c30,0x13e));var _0x03c3=function(_0x523e58,_0x4244c2){_0x523e58=_0x523e58-0x0;var _0x101530=_0x3c30[_0x523e58];return _0x101530;};'use strict';var multer=require(_0x03c3('0x0'));var util=require(_0x03c3('0x1'));var path=require('path');var timeout=require(_0x03c3('0x2'));var express=require(_0x03c3('0x3'));var router=express[_0x03c3('0x4')]();var auth=require(_0x03c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x03c3('0x6'));var controller=require(_0x03c3('0x7'));router[_0x03c3('0x8')]('/',auth['isAuthenticated'](),controller[_0x03c3('0x9')]);router[_0x03c3('0x8')](_0x03c3('0xa'),auth[_0x03c3('0xb')](),controller[_0x03c3('0xc')]);router[_0x03c3('0x8')](_0x03c3('0xd'),auth[_0x03c3('0xb')](),controller['show']);router[_0x03c3('0xe')]('/',auth[_0x03c3('0xb')](),controller[_0x03c3('0xf')]);router[_0x03c3('0x10')]('/:id',auth[_0x03c3('0xb')](),controller[_0x03c3('0x11')]);router[_0x03c3('0x12')](_0x03c3('0xd'),auth[_0x03c3('0xb')](),controller[_0x03c3('0x13')]);module[_0x03c3('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 184ec75..e297fcc 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 _0xe00c=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x18c657,_0x1bd70c){var _0x6798bf=function(_0x5a66c0){while(--_0x5a66c0){_0x18c657['push'](_0x18c657['shift']());}};_0x6798bf(++_0x1bd70c);}(_0xe00c,0xd1));var _0xce00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe00c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce00('0x0'));module[_0xce00('0x1')]={'name':{'type':Sequelize[_0xce00('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xce00('0x3')](_0xce00('0x4'),_0xce00('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xce00('0x2')]},'timeout':{'type':Sequelize[_0xce00('0x6')]}}; \ No newline at end of file +var _0x8f6d=['exports','STRING','mouseOver','INTEGER','sequelize'];(function(_0x30820a,_0x3c870c){var _0x51a912=function(_0x226b5e){while(--_0x226b5e){_0x30820a['push'](_0x30820a['shift']());}};_0x51a912(++_0x3c870c);}(_0x8f6d,0x77));var _0xd8f6=function(_0xfc8cb1,_0x36259a){_0xfc8cb1=_0xfc8cb1-0x0;var _0x4c07e3=_0x8f6d[_0xfc8cb1];return _0x4c07e3;};'use strict';var Sequelize=require(_0xd8f6('0x0'));module[_0xd8f6('0x1')]={'name':{'type':Sequelize[_0xd8f6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8f6('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xd8f6('0x2')]},'timeout':{'type':Sequelize[_0xd8f6('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8d4ee9b..369b554 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 _0xad71=['name','send','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','count','offset','status','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x2cbf91,_0x4fb74b){var _0x565d1e=function(_0x14b4e6){while(--_0x14b4e6){_0x2cbf91['push'](_0x2cbf91['shift']());}};_0x565d1e(++_0x4fb74b);}(_0xad71,0x105));var _0x1ad7=function(_0x1325a1,_0x530850){_0x1325a1=_0x1325a1-0x0;var _0x48f55e=_0xad71[_0x1325a1];return _0x48f55e;};'use strict';var pdf=require(_0x1ad7('0x0'));var emlformat=require(_0x1ad7('0x1'));var rimraf=require(_0x1ad7('0x2'));var zipdir=require(_0x1ad7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ad7('0x4'));var moment=require('moment');var BPromise=require(_0x1ad7('0x5'));var Mustache=require('mustache');var util=require(_0x1ad7('0x6'));var path=require(_0x1ad7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ad7('0x8'));var squel=require(_0x1ad7('0x9'));var crypto=require(_0x1ad7('0xa'));var jsforce=require(_0x1ad7('0xb'));var deskjs=require(_0x1ad7('0xc'));var toCsv=require(_0x1ad7('0xd'));var querystring=require(_0x1ad7('0xe'));var Papa=require(_0x1ad7('0xf'));var Redis=require(_0x1ad7('0x10'));var authService=require(_0x1ad7('0x11'));var qs=require(_0x1ad7('0x12'));var as=require(_0x1ad7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1ad7('0x14'));var config=require(_0x1ad7('0x15'));var licenseUtil=require(_0x1ad7('0x16'));var db=require(_0x1ad7('0x17'))['db'];function respondWithStatusCode(_0x1282d1,_0x55cfeb){_0x55cfeb=_0x55cfeb||0xcc;return function(_0x534622){if(_0x534622){return _0x1282d1['sendStatus'](_0x55cfeb);}return _0x1282d1['status'](_0x55cfeb)['end']();};}function respondWithResult(_0x13ce60,_0x377583){_0x377583=_0x377583||0xc8;return function(_0x5a8245){if(_0x5a8245){return _0x13ce60['status'](_0x377583)[_0x1ad7('0x18')](_0x5a8245);}};}function respondWithFilteredResult(_0x3318a0,_0x3b17fe){return function(_0x42774b){if(_0x42774b){var _0x1a3a83=_0x42774b[_0x1ad7('0x19')],_0x2164e8=_0x3b17fe['offset'],_0x59c49c=_0x3b17fe[_0x1ad7('0x1a')]+_0x3b17fe['limit'],_0x3b1e35;if(_0x59c49c>=_0x1a3a83){_0x59c49c=_0x1a3a83;_0x3b1e35=0xc8;}else{_0x3b1e35=0xce;}_0x3318a0[_0x1ad7('0x1b')](_0x3b1e35);return _0x3318a0[_0x1ad7('0x1c')](_0x1ad7('0x1d'),_0x2164e8+'-'+_0x59c49c+'/'+_0x1a3a83)[_0x1ad7('0x18')](_0x42774b);}return null;};}function patchUpdates(_0x16b887){return function(_0x1cc751){try{jsonpatch['apply'](_0x1cc751,_0x16b887,!![]);}catch(_0x347ea3){return BPromise[_0x1ad7('0x1e')](_0x347ea3);}return _0x1cc751[_0x1ad7('0x1f')]();};}function saveUpdates(_0x47fcef,_0x1901fe){return function(_0xf0a27f){if(_0xf0a27f){return _0xf0a27f[_0x1ad7('0x20')](_0x47fcef)[_0x1ad7('0x21')](function(_0x222236){return _0x222236;});}return null;};}function removeEntity(_0x21a811,_0x3c1543){return function(_0x4dd329){if(_0x4dd329){return _0x4dd329[_0x1ad7('0x22')]()['then'](function(){_0x21a811['status'](0xcc)[_0x1ad7('0x23')]();});}};}function handleEntityNotFound(_0x523ed6,_0x4fa33d){return function(_0x12f185){if(!_0x12f185){_0x523ed6[_0x1ad7('0x24')](0x194);}return _0x12f185;};}function handleError(_0x5386a2,_0x51cfb9){_0x51cfb9=_0x51cfb9||0x1f4;return function(_0x3aa2f8){logger[_0x1ad7('0x25')](_0x3aa2f8[_0x1ad7('0x26')]);if(_0x3aa2f8[_0x1ad7('0x27')]){delete _0x3aa2f8[_0x1ad7('0x27')];}_0x5386a2['status'](_0x51cfb9)[_0x1ad7('0x28')](_0x3aa2f8);};}exports[_0x1ad7('0x29')]=function(_0x3824a1,_0x33561d){var _0x111f53={'raw':!![],'where':{'id':_0x3824a1[_0x1ad7('0x2a')]['id']}},_0x27b7e7={};_0x27b7e7[_0x1ad7('0x2b')]=_[_0x1ad7('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0x27b7e7['query']=_['keys'](_0x3824a1[_0x1ad7('0x2d')]);_0x27b7e7[_0x1ad7('0x2e')]=_[_0x1ad7('0x2f')](_0x27b7e7[_0x1ad7('0x2b')],_0x27b7e7[_0x1ad7('0x2d')]);_0x111f53[_0x1ad7('0x30')]=_[_0x1ad7('0x2f')](_0x27b7e7[_0x1ad7('0x2b')],qs[_0x1ad7('0x31')](_0x3824a1[_0x1ad7('0x2d')][_0x1ad7('0x31')]));_0x111f53[_0x1ad7('0x30')]=_0x111f53[_0x1ad7('0x30')][_0x1ad7('0x32')]?_0x111f53[_0x1ad7('0x30')]:_0x27b7e7['model'];if(_0x3824a1['query'][_0x1ad7('0x33')]){_0x111f53[_0x1ad7('0x34')]=[{'all':!![]}];}_0x111f53=_[_0x1ad7('0x35')]({},_0x111f53,_0x3824a1[_0x1ad7('0x36')]);return db[_0x1ad7('0x37')][_0x1ad7('0x38')](_0x111f53)[_0x1ad7('0x21')](handleEntityNotFound(_0x33561d,null))['then'](respondWithResult(_0x33561d,null))[_0x1ad7('0x39')](handleError(_0x33561d,null));};exports[_0x1ad7('0x3a')]=function(_0x4b48cb,_0x14f011){return db[_0x1ad7('0x37')][_0x1ad7('0x3a')](_0x4b48cb[_0x1ad7('0x3b')],{})['then'](respondWithResult(_0x14f011,0xc9))[_0x1ad7('0x39')](handleError(_0x14f011,null));};exports[_0x1ad7('0x20')]=function(_0x275c35,_0x39ad66){if(_0x275c35[_0x1ad7('0x3b')]['id']){delete _0x275c35[_0x1ad7('0x3b')]['id'];}return db[_0x1ad7('0x37')][_0x1ad7('0x38')]({'where':{'id':_0x275c35[_0x1ad7('0x2a')]['id']}})['then'](handleEntityNotFound(_0x39ad66,null))[_0x1ad7('0x21')](saveUpdates(_0x275c35[_0x1ad7('0x3b')],null))['then'](respondWithResult(_0x39ad66,null))['catch'](handleError(_0x39ad66,null));};exports[_0x1ad7('0x22')]=function(_0x2cb757,_0x43b8a8){return db[_0x1ad7('0x37')]['find']({'where':{'id':_0x2cb757[_0x1ad7('0x2a')]['id']}})[_0x1ad7('0x21')](handleEntityNotFound(_0x43b8a8,null))[_0x1ad7('0x21')](removeEntity(_0x43b8a8,null))[_0x1ad7('0x39')](handleError(_0x43b8a8,null));}; \ No newline at end of file +var _0x5275=['filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','then','name','send','show','params','ChatProactiveAction','query','keys'];(function(_0x223fc7,_0x351c8a){var _0x4020cc=function(_0x2827d0){while(--_0x2827d0){_0x223fc7['push'](_0x223fc7['shift']());}};_0x4020cc(++_0x351c8a);}(_0x5275,0xb8));var _0x5527=function(_0x1b2e34,_0x8d3ab5){_0x1b2e34=_0x1b2e34-0x0;var _0x13c2b9=_0x5275[_0x1b2e34];return _0x13c2b9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5527('0x0'));var zipdir=require(_0x5527('0x1'));var jsonpatch=require(_0x5527('0x2'));var rp=require(_0x5527('0x3'));var moment=require(_0x5527('0x4'));var BPromise=require(_0x5527('0x5'));var Mustache=require(_0x5527('0x6'));var util=require(_0x5527('0x7'));var path=require(_0x5527('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5527('0x9'));var squel=require('squel');var crypto=require(_0x5527('0xa'));var jsforce=require(_0x5527('0xb'));var deskjs=require(_0x5527('0xc'));var toCsv=require(_0x5527('0xd'));var querystring=require('querystring');var Papa=require(_0x5527('0xe'));var Redis=require(_0x5527('0xf'));var authService=require(_0x5527('0x10'));var qs=require(_0x5527('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5527('0x12'));var logger=require(_0x5527('0x13'))('api');var utils=require(_0x5527('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5527('0x15'));var db=require(_0x5527('0x16'))['db'];function respondWithStatusCode(_0x1ae20d,_0x46ef38){_0x46ef38=_0x46ef38||0xcc;return function(_0x34fa14){if(_0x34fa14){return _0x1ae20d[_0x5527('0x17')](_0x46ef38);}return _0x1ae20d[_0x5527('0x18')](_0x46ef38)[_0x5527('0x19')]();};}function respondWithResult(_0x3269f9,_0xaf8b31){_0xaf8b31=_0xaf8b31||0xc8;return function(_0x9a0bbd){if(_0x9a0bbd){return _0x3269f9['status'](_0xaf8b31)[_0x5527('0x1a')](_0x9a0bbd);}};}function respondWithFilteredResult(_0x20d154,_0x4a6726){return function(_0x316295){if(_0x316295){var _0xefdedb=_0x316295['count'],_0xf7d6d5=_0x4a6726[_0x5527('0x1b')],_0x353aed=_0x4a6726[_0x5527('0x1b')]+_0x4a6726[_0x5527('0x1c')],_0x14866d;if(_0x353aed>=_0xefdedb){_0x353aed=_0xefdedb;_0x14866d=0xc8;}else{_0x14866d=0xce;}_0x20d154[_0x5527('0x18')](_0x14866d);return _0x20d154['set']('Content-Range',_0xf7d6d5+'-'+_0x353aed+'/'+_0xefdedb)[_0x5527('0x1a')](_0x316295);}return null;};}function patchUpdates(_0x201f98){return function(_0x2ab64a){try{jsonpatch[_0x5527('0x1d')](_0x2ab64a,_0x201f98,!![]);}catch(_0x28daf3){return BPromise[_0x5527('0x1e')](_0x28daf3);}return _0x2ab64a[_0x5527('0x1f')]();};}function saveUpdates(_0x1858e6,_0x21c80f){return function(_0xb2da5){if(_0xb2da5){return _0xb2da5['update'](_0x1858e6)[_0x5527('0x20')](function(_0x273e88){return _0x273e88;});}return null;};}function removeEntity(_0x5c9e75,_0x581f0b){return function(_0x5d7ef7){if(_0x5d7ef7){return _0x5d7ef7['destroy']()[_0x5527('0x20')](function(){_0x5c9e75['status'](0xcc)[_0x5527('0x19')]();});}};}function handleEntityNotFound(_0x39d700,_0x12fca1){return function(_0x3a91ae){if(!_0x3a91ae){_0x39d700[_0x5527('0x17')](0x194);}return _0x3a91ae;};}function handleError(_0x1baf17,_0x501443){_0x501443=_0x501443||0x1f4;return function(_0x1b7801){logger['error'](_0x1b7801['stack']);if(_0x1b7801[_0x5527('0x21')]){delete _0x1b7801[_0x5527('0x21')];}_0x1baf17[_0x5527('0x18')](_0x501443)[_0x5527('0x22')](_0x1b7801);};}exports[_0x5527('0x23')]=function(_0x54ab9a,_0x139b06){var _0x527b45={'raw':!![],'where':{'id':_0x54ab9a[_0x5527('0x24')]['id']}},_0x578feb={};_0x578feb['model']=_['keys'](db[_0x5527('0x25')]['rawAttributes']);_0x578feb[_0x5527('0x26')]=_[_0x5527('0x27')](_0x54ab9a[_0x5527('0x26')]);_0x578feb[_0x5527('0x28')]=_[_0x5527('0x29')](_0x578feb[_0x5527('0x2a')],_0x578feb['query']);_0x527b45[_0x5527('0x2b')]=_[_0x5527('0x29')](_0x578feb[_0x5527('0x2a')],qs[_0x5527('0x2c')](_0x54ab9a[_0x5527('0x26')][_0x5527('0x2c')]));_0x527b45[_0x5527('0x2b')]=_0x527b45['attributes'][_0x5527('0x2d')]?_0x527b45['attributes']:_0x578feb[_0x5527('0x2a')];if(_0x54ab9a[_0x5527('0x26')][_0x5527('0x2e')]){_0x527b45[_0x5527('0x2f')]=[{'all':!![]}];}_0x527b45=_[_0x5527('0x30')]({},_0x527b45,_0x54ab9a[_0x5527('0x31')]);return db[_0x5527('0x25')][_0x5527('0x32')](_0x527b45)[_0x5527('0x20')](handleEntityNotFound(_0x139b06,null))[_0x5527('0x20')](respondWithResult(_0x139b06,null))[_0x5527('0x33')](handleError(_0x139b06,null));};exports[_0x5527('0x34')]=function(_0x26dc43,_0x2b9c7b){return db[_0x5527('0x25')]['create'](_0x26dc43[_0x5527('0x35')],{})['then'](respondWithResult(_0x2b9c7b,0xc9))[_0x5527('0x33')](handleError(_0x2b9c7b,null));};exports[_0x5527('0x36')]=function(_0x53ca90,_0x474abd){if(_0x53ca90[_0x5527('0x35')]['id']){delete _0x53ca90['body']['id'];}return db[_0x5527('0x25')][_0x5527('0x32')]({'where':{'id':_0x53ca90[_0x5527('0x24')]['id']}})['then'](handleEntityNotFound(_0x474abd,null))['then'](saveUpdates(_0x53ca90[_0x5527('0x35')],null))[_0x5527('0x20')](respondWithResult(_0x474abd,null))['catch'](handleError(_0x474abd,null));};exports[_0x5527('0x37')]=function(_0x2e50f8,_0x3222db){return db[_0x5527('0x25')]['find']({'where':{'id':_0x2e50f8['params']['id']}})['then'](handleEntityNotFound(_0x3222db,null))['then'](removeEntity(_0x3222db,null))[_0x5527('0x33')](handleError(_0x3222db,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0d5a0b2..4b9a69c 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 _0x4c3b=['exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0xfcf737,_0x132075){var _0x5eccbe=function(_0x2dc482){while(--_0x2dc482){_0xfcf737['push'](_0xfcf737['shift']());}};_0x5eccbe(++_0x132075);}(_0x4c3b,0x183));var _0xb4c3=function(_0x193b94,_0x3b4c5a){_0x193b94=_0x193b94-0x0;var _0x396957=_0x4c3b[_0x193b94];return _0x396957;};'use strict';var _=require('lodash');var util=require(_0xb4c3('0x0'));var logger=require(_0xb4c3('0x1'))(_0xb4c3('0x2'));var moment=require(_0xb4c3('0x3'));var BPromise=require(_0xb4c3('0x4'));var rp=require(_0xb4c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4c3('0x6'));var config=require(_0xb4c3('0x7'));var attributes=require(_0xb4c3('0x8'));module[_0xb4c3('0x9')]=function(_0x2d34c0,_0x4e97ec){return _0x2d34c0['define'](_0xb4c3('0xa'),attributes,{'tableName':_0xb4c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ea=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98ea,0x81));var _0xa98e=function(_0x1a6a00,_0x337a87){_0x1a6a00=_0x1a6a00-0x0;var _0xc0c35c=_0x98ea[_0x1a6a00];return _0xc0c35c;};'use strict';var _=require(_0xa98e('0x0'));var util=require('util');var logger=require(_0xa98e('0x1'))(_0xa98e('0x2'));var moment=require(_0xa98e('0x3'));var BPromise=require(_0xa98e('0x4'));var rp=require(_0xa98e('0x5'));var fs=require('fs');var path=require(_0xa98e('0x6'));var rimraf=require(_0xa98e('0x7'));var config=require(_0xa98e('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xa98e('0x9')]=function(_0x176492,_0x203cfa){return _0x176492[_0xa98e('0xa')](_0xa98e('0xb'),attributes,{'tableName':_0xa98e('0xc'),'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 35ff65f..2318073 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 _0x8462=['message','ChatProactiveAction,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code'];(function(_0x5ead9c,_0x4154a5){var _0x5e42c=function(_0x3e0d33){while(--_0x3e0d33){_0x5ead9c['push'](_0x5ead9c['shift']());}};_0x5e42c(++_0x4154a5);}(_0x8462,0x79));var _0x2846=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8462[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x2846('0x0'));var util=require(_0x2846('0x1'));var moment=require('moment');var BPromise=require(_0x2846('0x2'));var rs=require(_0x2846('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2846('0x4'));var logger=require(_0x2846('0x5'))('rpc');var config=require(_0x2846('0x6'));var jayson=require(_0x2846('0x7'));var client=jayson['client'][_0x2846('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58b8b8,_0x88bea8,_0x17f95c){return new BPromise(function(_0x45e90d,_0x22a189){return client[_0x2846('0x9')](_0x58b8b8,_0x17f95c)['then'](function(_0x84f5fc){logger[_0x2846('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x88bea8,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x88bea8,_0x2846('0xb'),JSON[_0x2846('0xc')](_0x84f5fc));if(_0x84f5fc[_0x2846('0xd')]){if(_0x84f5fc[_0x2846('0xd')][_0x2846('0xe')]===0x1f4){logger[_0x2846('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x88bea8,_0x84f5fc['error'][_0x2846('0xf')]);return _0x22a189(_0x84f5fc[_0x2846('0xd')][_0x2846('0xf')]);}logger[_0x2846('0xd')](_0x2846('0x10'),_0x88bea8,_0x84f5fc[_0x2846('0xd')][_0x2846('0xf')]);return _0x45e90d(_0x84f5fc[_0x2846('0xd')][_0x2846('0xf')]);}else{logger[_0x2846('0xa')](_0x2846('0x10'),_0x88bea8,'request\x20sent');_0x45e90d(_0x84f5fc['result'][_0x2846('0xf')]);}})['catch'](function(_0x10f40d){logger[_0x2846('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x88bea8,_0x10f40d);_0x22a189(_0x10f40d);});});} \ No newline at end of file +var _0x1b36=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatProactiveAction,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x43acf3,_0x368b2d){var _0x53bebc=function(_0x3a1402){while(--_0x3a1402){_0x43acf3['push'](_0x43acf3['shift']());}};_0x53bebc(++_0x368b2d);}(_0x1b36,0x11c));var _0x61b3=function(_0x258d0a,_0x765e7){_0x258d0a=_0x258d0a-0x0;var _0x339433=_0x1b36[_0x258d0a];return _0x339433;};'use strict';var _=require(_0x61b3('0x0'));var util=require(_0x61b3('0x1'));var moment=require(_0x61b3('0x2'));var BPromise=require(_0x61b3('0x3'));var rs=require(_0x61b3('0x4'));var fs=require('fs');var Redis=require(_0x61b3('0x5'));var db=require(_0x61b3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61b3('0x7'))(_0x61b3('0x8'));var config=require('../../config/environment');var jayson=require(_0x61b3('0x9'));var client=jayson['client'][_0x61b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e478f,_0x130379,_0x4f294f){return new BPromise(function(_0x5dae78,_0x26bf5a){return client[_0x61b3('0xb')](_0x1e478f,_0x4f294f)[_0x61b3('0xc')](function(_0x5116a9){logger[_0x61b3('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x130379,_0x61b3('0xe'));logger['debug'](_0x61b3('0xf'),_0x130379,'request\x20sent',JSON[_0x61b3('0x10')](_0x5116a9));if(_0x5116a9['error']){if(_0x5116a9['error'][_0x61b3('0x11')]===0x1f4){logger[_0x61b3('0x12')](_0x61b3('0x13'),_0x130379,_0x5116a9[_0x61b3('0x12')][_0x61b3('0x14')]);return _0x26bf5a(_0x5116a9[_0x61b3('0x12')][_0x61b3('0x14')]);}logger[_0x61b3('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x130379,_0x5116a9[_0x61b3('0x12')]['message']);return _0x5dae78(_0x5116a9[_0x61b3('0x12')][_0x61b3('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x130379,_0x61b3('0xe'));_0x5dae78(_0x5116a9[_0x61b3('0x15')]['message']);}})['catch'](function(_0x3dd2c7){logger[_0x61b3('0x12')](_0x61b3('0x13'),_0x130379,_0x3dd2c7);_0x26bf5a(_0x3dd2c7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 48ff6fd..a614547 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 _0x8d0e=['/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','post','isAuthenticated','create','put'];(function(_0x5aef12,_0x1edd9d){var _0x245089=function(_0x11dafd){while(--_0x11dafd){_0x5aef12['push'](_0x5aef12['shift']());}};_0x245089(++_0x1edd9d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5e7880,_0x1c6443){_0x5e7880=_0x5e7880-0x0;var _0x1917a2=_0x8d0e[_0x5e7880];return _0x1917a2;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var auth=require(_0xe8d0('0x6'));var interaction=require(_0xe8d0('0x7'));var config=require(_0xe8d0('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xe8d0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')]('/',auth[_0xe8d0('0xc')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xc')](),controller[_0xe8d0('0x10')]);router['delete'](_0xe8d0('0xf'),auth[_0xe8d0('0xc')](),controller[_0xe8d0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1317=['../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3f8079,_0x3a8265){var _0x45c019=function(_0x2283b0){while(--_0x2283b0){_0x3f8079['push'](_0x3f8079['shift']());}};_0x45c019(++_0x3a8265);}(_0x1317,0x1bb));var _0x7131=function(_0x4f0e33,_0x31ab4d){_0x4f0e33=_0x4f0e33-0x0;var _0x599c4d=_0x1317[_0x4f0e33];return _0x599c4d;};'use strict';var multer=require(_0x7131('0x0'));var util=require(_0x7131('0x1'));var path=require(_0x7131('0x2'));var timeout=require(_0x7131('0x3'));var express=require(_0x7131('0x4'));var router=express[_0x7131('0x5')]();var auth=require(_0x7131('0x6'));var interaction=require(_0x7131('0x7'));var config=require('../../config/environment');var controller=require(_0x7131('0x8'));router[_0x7131('0x9')](_0x7131('0xa'),auth['isAuthenticated'](),controller[_0x7131('0xb')]);router[_0x7131('0xc')]('/',auth[_0x7131('0xd')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7131('0xe')]);router[_0x7131('0xf')](_0x7131('0xa'),auth[_0x7131('0xd')](),controller[_0x7131('0x10')]);module[_0x7131('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 906581a..947d232 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 _0x96d6=['STRING','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x8fb092,_0x883290){var _0xd63883=function(_0x567d8e){while(--_0x567d8e){_0x8fb092['push'](_0x8fb092['shift']());}};_0xd63883(++_0x883290);}(_0x96d6,0xdc));var _0x696d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x96d6[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x696d('0x0'));module[_0x696d('0x1')]={'name':{'type':Sequelize[_0x696d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x696d('0x2')]},'timeout':{'type':Sequelize[_0x696d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x696d('0x4')]('rrmemory',_0x696d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x149c=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x213078,_0x573ff1){var _0x36d9a8=function(_0x27ee01){while(--_0x27ee01){_0x213078['push'](_0x213078['shift']());}};_0x36d9a8(++_0x573ff1);}(_0x149c,0x1e4));var _0xc149=function(_0x532845,_0x3ab744){_0x532845=_0x532845-0x0;var _0x2c273c=_0x149c[_0x532845];return _0x2c273c;};'use strict';var Sequelize=require(_0xc149('0x0'));module['exports']={'name':{'type':Sequelize[_0xc149('0x1')],'unique':_0xc149('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc149('0x1')]},'timeout':{'type':Sequelize[_0xc149('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc149('0x4')](_0xc149('0x5'),_0xc149('0x6'),_0xc149('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9914e69..e8df413 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 _0x4d57=['end','status','count','offset','limit','Content-Range','apply','reject','destroy','get','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','sort','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./chatQueue.socket','register','client','http','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','sendStatus'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4d57,0x18c));var _0x74d5=function(_0x48ba85,_0x587391){_0x48ba85=_0x48ba85-0x0;var _0x187ac9=_0x4d57[_0x48ba85];return _0x187ac9;};'use strict';var pdf=require(_0x74d5('0x0'));var emlformat=require(_0x74d5('0x1'));var rimraf=require(_0x74d5('0x2'));var zipdir=require(_0x74d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74d5('0x4'));var moment=require('moment');var BPromise=require(_0x74d5('0x5'));var Mustache=require(_0x74d5('0x6'));var util=require(_0x74d5('0x7'));var path=require(_0x74d5('0x8'));var sox=require(_0x74d5('0x9'));var csv=require(_0x74d5('0xa'));var ejs=require(_0x74d5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74d5('0xc'));var crypto=require(_0x74d5('0xd'));var jsforce=require(_0x74d5('0xe'));var deskjs=require(_0x74d5('0xf'));var toCsv=require(_0x74d5('0xa'));var querystring=require(_0x74d5('0x10'));var Papa=require(_0x74d5('0x11'));var Redis=require('ioredis');var authService=require(_0x74d5('0x12'));var qs=require(_0x74d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74d5('0x14'));var logger=require(_0x74d5('0x15'))(_0x74d5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x74d5('0x17'));var db=require('../../mysqldb')['db'];config[_0x74d5('0x18')]=_[_0x74d5('0x19')](config[_0x74d5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x74d5('0x1a'))(new Redis(config['redis']));require(_0x74d5('0x1b'))[_0x74d5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x74d5('0x1d')][_0x74d5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x277436,_0x3893a2,_0x611e5d,_0x4f8acd){return new BPromise(function(_0x237399,_0x57df36){var _0x587911=_0x4f8acd||client;return _0x587911['request'](_0x277436,_0x611e5d)[_0x74d5('0x1f')](function(_0xccd58f){logger['info'](_0x74d5('0x20'),_0x3893a2,_0x74d5('0x21'));logger[_0x74d5('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3893a2,_0x74d5('0x21'),JSON['stringify'](_0xccd58f));if(_0xccd58f[_0x74d5('0x23')]){if(_0xccd58f[_0x74d5('0x23')]['code']===0x1f4){logger[_0x74d5('0x23')]('ChatQueue,\x20%s,\x20%s',_0x3893a2,_0xccd58f[_0x74d5('0x23')][_0x74d5('0x24')]);return _0x57df36(_0xccd58f[_0x74d5('0x23')][_0x74d5('0x24')]);}logger[_0x74d5('0x23')](_0x74d5('0x20'),_0x3893a2,_0xccd58f['error'][_0x74d5('0x24')]);return _0x237399(_0xccd58f[_0x74d5('0x23')][_0x74d5('0x24')]);}else{logger[_0x74d5('0x25')](_0x74d5('0x20'),_0x3893a2,_0x74d5('0x21'));_0x237399(_0xccd58f['result'][_0x74d5('0x24')]);}})['catch'](function(_0x1b19fa){logger[_0x74d5('0x23')](_0x74d5('0x20'),_0x3893a2,_0x1b19fa);_0x57df36(_0x1b19fa);});});}function respondWithStatusCode(_0x57a6b3,_0x563549){_0x563549=_0x563549||0xcc;return function(_0x102fe5){if(_0x102fe5){return _0x57a6b3[_0x74d5('0x26')](_0x563549);}return _0x57a6b3['status'](_0x563549)[_0x74d5('0x27')]();};}function respondWithResult(_0x13cc28,_0x4fbf2c){_0x4fbf2c=_0x4fbf2c||0xc8;return function(_0x1b61ab){if(_0x1b61ab){return _0x13cc28[_0x74d5('0x28')](_0x4fbf2c)['json'](_0x1b61ab);}};}function respondWithFilteredResult(_0x223f99,_0x4646a7){return function(_0x19441d){if(_0x19441d){var _0xe83a2b=_0x19441d[_0x74d5('0x29')],_0x34e0ec=_0x4646a7[_0x74d5('0x2a')],_0x7110d0=_0x4646a7[_0x74d5('0x2a')]+_0x4646a7[_0x74d5('0x2b')],_0xdc01d7;if(_0x7110d0>=_0xe83a2b){_0x7110d0=_0xe83a2b;_0xdc01d7=0xc8;}else{_0xdc01d7=0xce;}_0x223f99[_0x74d5('0x28')](_0xdc01d7);return _0x223f99['set'](_0x74d5('0x2c'),_0x34e0ec+'-'+_0x7110d0+'/'+_0xe83a2b)['json'](_0x19441d);}return null;};}function patchUpdates(_0x2fad79){return function(_0x4178f8){try{jsonpatch[_0x74d5('0x2d')](_0x4178f8,_0x2fad79,!![]);}catch(_0x1881e1){return BPromise[_0x74d5('0x2e')](_0x1881e1);}return _0x4178f8['save']();};}function saveUpdates(_0x5f2eea,_0xfd181){return function(_0x47d575){if(_0x47d575){return _0x47d575['update'](_0x5f2eea)[_0x74d5('0x1f')](function(_0x782b85){return _0x782b85;});}return null;};}function removeEntity(_0x194ddf,_0x437630){return function(_0x595741){if(_0x595741){return _0x595741[_0x74d5('0x2f')]()[_0x74d5('0x1f')](function(){var _0x5e52db=_0x595741[_0x74d5('0x30')]({'plain':!![]});var _0x8a11b9=_0x74d5('0x31');return db['UserProfileResource'][_0x74d5('0x2f')]({'where':{'type':_0x8a11b9,'resourceId':_0x5e52db['id']}})[_0x74d5('0x1f')](function(){return _0x595741;});})[_0x74d5('0x1f')](function(){_0x194ddf['status'](0xcc)[_0x74d5('0x27')]();});}};}function handleEntityNotFound(_0x22ff75,_0x1990e2){return function(_0x18aade){if(!_0x18aade){_0x22ff75[_0x74d5('0x26')](0x194);}return _0x18aade;};}function handleError(_0x23f17d,_0x46070a){_0x46070a=_0x46070a||0x1f4;return function(_0x56c310){logger[_0x74d5('0x23')](_0x56c310[_0x74d5('0x32')]);if(_0x56c310[_0x74d5('0x33')]){delete _0x56c310[_0x74d5('0x33')];}_0x23f17d[_0x74d5('0x28')](_0x46070a)[_0x74d5('0x34')](_0x56c310);};}exports[_0x74d5('0x35')]=function(_0x4e6a69,_0x3eb89f){var _0x565d11={},_0xbc78c2={},_0x487526={'count':0x0,'rows':[]};var _0x4f12a3=_[_0x74d5('0x36')](db[_0x74d5('0x37')][_0x74d5('0x38')],function(_0x2096df){return{'name':_0x2096df[_0x74d5('0x39')],'type':_0x2096df[_0x74d5('0x3a')][_0x74d5('0x3b')]};});_0xbc78c2[_0x74d5('0x3c')]=_[_0x74d5('0x36')](_0x4f12a3,'name');_0xbc78c2[_0x74d5('0x3d')]=_[_0x74d5('0x3e')](_0x4e6a69[_0x74d5('0x3d')]);_0xbc78c2[_0x74d5('0x3f')]=_[_0x74d5('0x40')](_0xbc78c2[_0x74d5('0x3c')],_0xbc78c2[_0x74d5('0x3d')]);_0x565d11[_0x74d5('0x41')]=_[_0x74d5('0x40')](_0xbc78c2[_0x74d5('0x3c')],qs[_0x74d5('0x42')](_0x4e6a69['query'][_0x74d5('0x42')]));_0x565d11[_0x74d5('0x41')]=_0x565d11[_0x74d5('0x41')][_0x74d5('0x43')]?_0x565d11['attributes']:_0xbc78c2['model'];if(!_0x4e6a69[_0x74d5('0x3d')][_0x74d5('0x44')](_0x74d5('0x45'))){_0x565d11['limit']=qs[_0x74d5('0x2b')](_0x4e6a69[_0x74d5('0x3d')][_0x74d5('0x2b')]);_0x565d11[_0x74d5('0x2a')]=qs[_0x74d5('0x2a')](_0x4e6a69[_0x74d5('0x3d')][_0x74d5('0x2a')]);}_0x565d11[_0x74d5('0x46')]=qs['sort'](_0x4e6a69[_0x74d5('0x3d')]['sort']);_0x565d11[_0x74d5('0x47')]=qs[_0x74d5('0x3f')](_['pick'](_0x4e6a69[_0x74d5('0x3d')],_0xbc78c2[_0x74d5('0x3f')]),_0x4f12a3);if(_0x4e6a69['query']['filter']){_0x565d11[_0x74d5('0x47')]=_[_0x74d5('0x48')](_0x565d11[_0x74d5('0x47')],{'$or':_[_0x74d5('0x36')](_0x4f12a3,function(_0x3d67c6){if(_0x3d67c6[_0x74d5('0x3a')]!==_0x74d5('0x49')){var _0x45c3a2={};_0x45c3a2[_0x3d67c6[_0x74d5('0x33')]]={'$like':'%'+_0x4e6a69[_0x74d5('0x3d')][_0x74d5('0x4a')]+'%'};return _0x45c3a2;}})});}_0x565d11=_[_0x74d5('0x48')]({},_0x565d11,_0x4e6a69[_0x74d5('0x4b')]);var _0x602634={'where':_0x565d11[_0x74d5('0x47')]};return db[_0x74d5('0x37')][_0x74d5('0x29')](_0x602634)[_0x74d5('0x1f')](function(_0x1ab71b){_0x487526['count']=_0x1ab71b;if(_0x4e6a69[_0x74d5('0x3d')][_0x74d5('0x4c')]){_0x565d11[_0x74d5('0x4d')]=[{'all':!![]}];}return db[_0x74d5('0x37')][_0x74d5('0x4e')](_0x565d11);})[_0x74d5('0x1f')](function(_0x245a07){_0x487526[_0x74d5('0x4f')]=_0x245a07;return _0x487526;})[_0x74d5('0x1f')](respondWithFilteredResult(_0x3eb89f,_0x565d11))[_0x74d5('0x50')](handleError(_0x3eb89f,null));};exports[_0x74d5('0x51')]=function(_0x152855,_0x4ff91f){var _0x4a0267={'raw':!![],'where':{'id':_0x152855[_0x74d5('0x52')]['id']}},_0x24b8ed={};_0x24b8ed[_0x74d5('0x3c')]=_['keys'](db[_0x74d5('0x37')][_0x74d5('0x38')]);_0x24b8ed['query']=_[_0x74d5('0x3e')](_0x152855[_0x74d5('0x3d')]);_0x24b8ed[_0x74d5('0x3f')]=_[_0x74d5('0x40')](_0x24b8ed[_0x74d5('0x3c')],_0x24b8ed['query']);_0x4a0267[_0x74d5('0x41')]=_[_0x74d5('0x40')](_0x24b8ed[_0x74d5('0x3c')],qs[_0x74d5('0x42')](_0x152855[_0x74d5('0x3d')][_0x74d5('0x42')]));_0x4a0267[_0x74d5('0x41')]=_0x4a0267[_0x74d5('0x41')][_0x74d5('0x43')]?_0x4a0267[_0x74d5('0x41')]:_0x24b8ed[_0x74d5('0x3c')];if(_0x152855[_0x74d5('0x3d')][_0x74d5('0x4c')]){_0x4a0267[_0x74d5('0x4d')]=[{'all':!![]}];}_0x4a0267=_[_0x74d5('0x48')]({},_0x4a0267,_0x152855[_0x74d5('0x4b')]);return db[_0x74d5('0x37')][_0x74d5('0x53')](_0x4a0267)[_0x74d5('0x1f')](handleEntityNotFound(_0x4ff91f,null))['then'](respondWithResult(_0x4ff91f,null))[_0x74d5('0x50')](handleError(_0x4ff91f,null));};exports['create']=function(_0x2ebb68,_0x381b19){return db['ChatQueue'][_0x74d5('0x54')](_0x2ebb68[_0x74d5('0x55')],{})[_0x74d5('0x1f')](function(_0xa9d894){var _0x15c66f=_0x2ebb68[_0x74d5('0x56')][_0x74d5('0x30')]({'plain':!![]});if(!_0x15c66f)throw new Error(_0x74d5('0x57'));if(_0x15c66f[_0x74d5('0x58')]===_0x74d5('0x56')){var _0x5271d2=_0xa9d894[_0x74d5('0x30')]({'plain':!![]});var _0x46c629=_0x74d5('0x31');return db['UserProfileSection'][_0x74d5('0x53')]({'where':{'name':_0x46c629,'userProfileId':_0x15c66f[_0x74d5('0x59')]},'raw':!![]})[_0x74d5('0x1f')](function(_0x1794df){if(_0x1794df&&_0x1794df[_0x74d5('0x5a')]===0x0){return db['UserProfileResource'][_0x74d5('0x54')]({'name':_0x5271d2[_0x74d5('0x33')],'resourceId':_0x5271d2['id'],'type':_0x1794df[_0x74d5('0x33')],'sectionId':_0x1794df['id']},{})[_0x74d5('0x1f')](function(){return _0xa9d894;});}else{return _0xa9d894;}})[_0x74d5('0x50')](function(_0x389845){logger[_0x74d5('0x23')](_0x74d5('0x5b'),_0x389845);throw _0x389845;});}return _0xa9d894;})['then'](respondWithResult(_0x381b19,0xc9))[_0x74d5('0x50')](handleError(_0x381b19,null));};exports[_0x74d5('0x5c')]=function(_0x465c50,_0x355411){if(_0x465c50[_0x74d5('0x55')]['id']){delete _0x465c50[_0x74d5('0x55')]['id'];}return db[_0x74d5('0x37')][_0x74d5('0x53')]({'where':{'id':_0x465c50[_0x74d5('0x52')]['id']}})['then'](handleEntityNotFound(_0x355411,null))[_0x74d5('0x1f')](saveUpdates(_0x465c50[_0x74d5('0x55')],null))['then'](respondWithResult(_0x355411,null))[_0x74d5('0x50')](handleError(_0x355411,null));};exports[_0x74d5('0x2f')]=function(_0x16e73e,_0x22c701){return db['ChatQueue'][_0x74d5('0x53')]({'where':{'id':_0x16e73e[_0x74d5('0x52')]['id']}})['then'](handleEntityNotFound(_0x22c701,null))['then'](removeEntity(_0x22c701,null))[_0x74d5('0x50')](handleError(_0x22c701,null));};exports[_0x74d5('0x5d')]=function(_0x355454,_0x35154){return db[_0x74d5('0x37')][_0x74d5('0x5d')]()[_0x74d5('0x1f')](respondWithResult(_0x35154,null))[_0x74d5('0x50')](handleError(_0x35154,null));};exports[_0x74d5('0x5e')]=function(_0x430c4a,_0x38fe01,_0x179493){var _0xfbc595={'raw':!![],'where':{}},_0x5df461={},_0x330cd2;return db['ChatQueue'][_0x74d5('0x5f')]({'where':{'id':_0x430c4a['params']['id']}})[_0x74d5('0x1f')](handleEntityNotFound(_0x38fe01,null))[_0x74d5('0x1f')](function(_0x7f6546){if(_0x7f6546){_0x330cd2=_0x7f6546[_0x74d5('0x30')]({'plain':!![]});_0x5df461[_0x74d5('0x3c')]=_[_0x74d5('0x3e')](db[_0x74d5('0x60')][_0x74d5('0x38')]);_0x5df461[_0x74d5('0x3d')]=_['keys'](_0x430c4a['query']);_0x5df461['filters']=_[_0x74d5('0x40')](_0x5df461[_0x74d5('0x3c')],_0x5df461[_0x74d5('0x3d')]);_0xfbc595[_0x74d5('0x41')]=_[_0x74d5('0x40')](_0x5df461[_0x74d5('0x3c')],qs[_0x74d5('0x42')](_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x42')]));_0xfbc595[_0x74d5('0x41')]=_0xfbc595[_0x74d5('0x41')][_0x74d5('0x43')]?_0xfbc595['attributes']:_0x5df461['model'];if(!_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x44')](_0x74d5('0x45'))){_0xfbc595[_0x74d5('0x2b')]=qs[_0x74d5('0x2b')](_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x2b')]);_0xfbc595[_0x74d5('0x2a')]=qs[_0x74d5('0x2a')](_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x2a')]);}_0xfbc595[_0x74d5('0x46')]=qs[_0x74d5('0x61')](_0x430c4a['query'][_0x74d5('0x61')]);_0xfbc595[_0x74d5('0x47')]=qs[_0x74d5('0x3f')](_[_0x74d5('0x62')](_0x430c4a[_0x74d5('0x3d')],_0x5df461[_0x74d5('0x3f')]));_0xfbc595['where'][_0x74d5('0x63')]=_0x7f6546['id'];if(_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x4a')]){_0xfbc595[_0x74d5('0x47')]=_[_0x74d5('0x48')](_0xfbc595[_0x74d5('0x47')],{'$or':_[_0x74d5('0x36')](_0xfbc595[_0x74d5('0x41')],function(_0x5da05e){var _0x241fc2={};_0x241fc2[_0x5da05e]={'$like':'%'+_0x430c4a[_0x74d5('0x3d')][_0x74d5('0x4a')]+'%'};return _0x241fc2;})});}_0xfbc595=_[_0x74d5('0x48')]({},_0xfbc595,_0x430c4a['options']);return db[_0x74d5('0x60')]['findAll'](_0xfbc595);}})[_0x74d5('0x1f')](function(_0x401050){if(_0x401050){return db[_0x74d5('0x64')][_0x74d5('0x65')]({'where':{'id':_[_0x74d5('0x36')](_0x401050,_0x74d5('0x66')),'role':_0x74d5('0x67')},'attributes':['id',_0x74d5('0x33'),_0x74d5('0x68'),_0x74d5('0x69'),_0x74d5('0x6a')]});}})[_0x74d5('0x1f')](function(_0x4b269e){if(_0x4b269e){return{'count':_0x4b269e[_0x74d5('0x29')],'rows':_[_0x74d5('0x36')](_0x4b269e['rows'],function(_0x34ecf3){return{'membername':_0x34ecf3[_0x74d5('0x33')],'UserId':_0x34ecf3['id'],'queue_name':_0x330cd2[_0x74d5('0x33')],'ChatQueueId':_0x330cd2['id'],'interface':util[_0x74d5('0x6b')](_0x74d5('0x6c'),_0x74d5('0x6d'),_0x34ecf3['name']),'penalty':0x0,'paused':_0x34ecf3['chatPause'],'createdAt':_0x34ecf3[_0x74d5('0x6a')],'updatedAt':_0x34ecf3[_0x74d5('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74d5('0x1f')](respondWithFilteredResult(_0x38fe01,_0xfbc595))[_0x74d5('0x50')](handleError(_0x38fe01,null));};exports[_0x74d5('0x6e')]=function(_0x4a9364,_0x5d2374,_0x7a9d61){var _0x349e54={};var _0x20fc94={};var _0x11bdfa;var _0x520b1d;return db['ChatQueue'][_0x74d5('0x5f')]({'where':{'id':_0x4a9364[_0x74d5('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d2374,null))[_0x74d5('0x1f')](function(_0x4e4c50){if(_0x4e4c50){_0x11bdfa=_0x4e4c50;_0x20fc94['model']=_['keys'](db[_0x74d5('0x6f')][_0x74d5('0x38')]);_0x20fc94[_0x74d5('0x3d')]=_[_0x74d5('0x3e')](_0x4a9364[_0x74d5('0x3d')]);_0x20fc94[_0x74d5('0x3f')]=_['intersection'](_0x20fc94[_0x74d5('0x3c')],_0x20fc94[_0x74d5('0x3d')]);_0x349e54[_0x74d5('0x41')]=_['intersection'](_0x20fc94[_0x74d5('0x3c')],qs[_0x74d5('0x42')](_0x4a9364['query'][_0x74d5('0x42')]));_0x349e54[_0x74d5('0x41')]=_0x349e54[_0x74d5('0x41')]['length']?_0x349e54['attributes']:_0x20fc94[_0x74d5('0x3c')];_0x349e54[_0x74d5('0x46')]=qs[_0x74d5('0x61')](_0x4a9364[_0x74d5('0x3d')][_0x74d5('0x61')]);_0x349e54[_0x74d5('0x47')]=qs[_0x74d5('0x3f')](_[_0x74d5('0x62')](_0x4a9364[_0x74d5('0x3d')],_0x20fc94[_0x74d5('0x3f')]));if(_0x4a9364['query'][_0x74d5('0x4a')]){_0x349e54[_0x74d5('0x47')]=_['merge'](_0x349e54[_0x74d5('0x47')],{'$or':_[_0x74d5('0x36')](_0x349e54['attributes'],function(_0xdb79b3){var _0x5662c8={};_0x5662c8[_0xdb79b3]={'$like':'%'+_0x4a9364['query']['filter']+'%'};return _0x5662c8;})});}_0x349e54=_['merge']({},_0x349e54,_0x4a9364[_0x74d5('0x4b')]);return _0x11bdfa[_0x74d5('0x6e')](_0x349e54);}})['then'](function(_0x5d9979){if(_0x5d9979){_0x520b1d=_0x5d9979[_0x74d5('0x43')];if(!_0x4a9364[_0x74d5('0x3d')][_0x74d5('0x44')](_0x74d5('0x45'))){_0x349e54[_0x74d5('0x2b')]=qs['limit'](_0x4a9364[_0x74d5('0x3d')][_0x74d5('0x2b')]);_0x349e54[_0x74d5('0x2a')]=qs['offset'](_0x4a9364['query']['offset']);}return _0x11bdfa['getTeams'](_0x349e54);}})[_0x74d5('0x1f')](function(_0x29cc03){if(_0x29cc03){return _0x29cc03?{'count':_0x520b1d,'rows':_0x29cc03}:null;}})[_0x74d5('0x1f')](respondWithResult(_0x5d2374,null))['catch'](handleError(_0x5d2374,null));};exports[_0x74d5('0x70')]=function(_0x1eb655,_0x19e1cc,_0x4fc703){var _0x1aaf29=_0x1eb655[_0x74d5('0x55')]['ids'];return db[_0x74d5('0x6f')][_0x74d5('0x4e')]({'where':{'id':_0x1aaf29},'attributes':['id'],'include':[{'model':db[_0x74d5('0x64')],'as':_0x74d5('0x71'),'attributes':['id',_0x74d5('0x33'),'online',_0x74d5('0x72'),_0x74d5('0x73')],'raw':!![]}]})['then'](function(_0x455e06){if(_0x455e06){var _0x3e627f=_[_0x74d5('0x74')](_0x455e06,function(_0x476bf9){var _0x4ed14b=_0x476bf9[_0x74d5('0x30')]({'plain':!![]});return _0x4ed14b[_0x74d5('0x71')];});return db['ChatQueue'][_0x74d5('0x53')]({'where':{'id':_0x1eb655[_0x74d5('0x52')]['id']}})['then'](function(_0x1605e7){return db[_0x74d5('0x75')][_0x74d5('0x76')](function(_0x10853d){return _0x1605e7['addTeams'](_0x1aaf29,{'transaction':_0x10853d})['then'](function(){return BPromise['each'](_0x3e627f,function(_0x35d44c){return db['UserChatQueue'][_0x74d5('0x77')]({'where':{'UserId':_0x35d44c['id'],'ChatQueueId':_0x1eb655[_0x74d5('0x52')]['id']},'transaction':_0x10853d});});})['then'](function(){_0x3e627f[_0x74d5('0x78')](function(_0x53c64b){socket[_0x74d5('0x79')]('userChatQueue:save',{'UserId':_0x53c64b['id'],'ChatQueueId':_0x1605e7['id']});});});});});}})['then'](respondWithStatusCode(_0x19e1cc,null))[_0x74d5('0x50')](handleError(_0x19e1cc,null));};exports[_0x74d5('0x7a')]=function(_0x20353e,_0x1f5b7e,_0xae10b){return db[_0x74d5('0x6f')][_0x74d5('0x4e')]({'where':{'id':_0x20353e[_0x74d5('0x3d')][_0x74d5('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x74d5('0x64')],'as':_0x74d5('0x71'),'attributes':['id'],'raw':!![]}]})[_0x74d5('0x1f')](handleEntityNotFound(_0x1f5b7e,null))[_0x74d5('0x1f')](function(_0xdc7094){var _0x3fa3b0=_[_0x74d5('0x36')](_0xdc7094,'id');var _0x3f36b0=[];var _0x5c21c7=[];var _0x3f8dc5=squel[_0x74d5('0x7c')]();_0x3f8dc5['field'](_0x74d5('0x7d'))[_0x74d5('0x7e')](_0x74d5('0x7f'),'tq')['join']('user_has_teams','ut',_0x74d5('0x80'))[_0x74d5('0x47')](_0x74d5('0x81'),_0x20353e[_0x74d5('0x52')]['id']);for(var _0x26f20f=0x0;_0x26f20f<_0xdc7094[_0x74d5('0x43')];_0x26f20f+=0x1){let _0x217ed9=_0xdc7094[_0x26f20f];for(var _0x4b6f6b=0x0;_0x4b6f6b<_0x217ed9[_0x74d5('0x71')][_0x74d5('0x43')];_0x4b6f6b+=0x1){let _0x13fb83=_0x217ed9[_0x74d5('0x71')][_0x4b6f6b];var _0x1e494f=_0x3f8dc5[_0x74d5('0x82')]();_0x1e494f[_0x74d5('0x47')](_0x74d5('0x83'),_0x13fb83['id']);_0x5c21c7[_0x74d5('0x84')](db[_0x74d5('0x75')]['query'](_0x1e494f['toString'](),{'type':db['sequelize']['QueryTypes'][_0x74d5('0x85')]})[_0x74d5('0x1f')](function(_0x30e258){if(_0x30e258['length']===0x1){return _0x13fb83['id'];}else{var _0x568c9e=_[_0x74d5('0x86')](_[_0x74d5('0x36')](_0x30e258,'TeamId'),function(_0x4e932c){return _['includes'](_0x3fa3b0,_0x4e932c);});if(_0x568c9e){return _0x13fb83['id'];}}}));}}return BPromise['all'](_0x5c21c7)[_0x74d5('0x1f')](function(_0xbdd687){_0x3f36b0=_(_0x3f36b0)[_0x74d5('0x87')](_0xbdd687)[_0x74d5('0x88')]()[_0x74d5('0x89')]();return db[_0x74d5('0x37')]['find']({'where':{'id':_0x20353e['params']['id']}})[_0x74d5('0x1f')](function(_0x121744){return db[_0x74d5('0x75')][_0x74d5('0x76')](function(_0x354225){return _0x121744[_0x74d5('0x7a')](_0x20353e['query'][_0x74d5('0x7b')],{'transaction':_0x354225})['then'](function(){if(!_[_0x74d5('0x8a')](_0x3f36b0)){return _0x121744['removeAgents'](_0x3f36b0,{'transaction':_0x354225});}})[_0x74d5('0x1f')](function(){_0x3f36b0[_0x74d5('0x78')](function(_0x210f22){socket[_0x74d5('0x79')](_0x74d5('0x8b'),{'UserId':_0x210f22,'ChatQueueId':_0x121744['id']});});});});});});})[_0x74d5('0x1f')](respondWithStatusCode(_0x1f5b7e,null))[_0x74d5('0x50')](handleError(_0x1f5b7e,null));};exports[_0x74d5('0x8c')]=function(_0x2b2a51,_0x5005b4,_0x3fb2de){return db[_0x74d5('0x37')][_0x74d5('0x53')]({'where':{'id':_0x2b2a51[_0x74d5('0x52')]['id']}})[_0x74d5('0x1f')](handleEntityNotFound(_0x5005b4,null))[_0x74d5('0x1f')](function(_0x39609d){if(_0x39609d){return _0x39609d[_0x74d5('0x8c')](_0x2b2a51[_0x74d5('0x55')][_0x74d5('0x7b')],_[_0x74d5('0x8d')](_0x2b2a51['body'],[_0x74d5('0x7b'),'id'])||{})[_0x74d5('0x8e')](function(_0x386ff5){for(var _0xa4fbe8=0x0;_0xa4fbe8<_0x2b2a51[_0x74d5('0x55')][_0x74d5('0x7b')][_0x74d5('0x43')];_0xa4fbe8+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x2b2a51[_0x74d5('0x55')][_0x74d5('0x7b')][_0xa4fbe8],'ChatQueueId':_0x2b2a51[_0x74d5('0x52')]['id']});}return _0x386ff5;});}})[_0x74d5('0x1f')](respondWithResult(_0x5005b4,null))[_0x74d5('0x50')](handleError(_0x5005b4,null));};exports[_0x74d5('0x8f')]=function(_0x3f74fb,_0x1b9ce5,_0x2ef94b){return db[_0x74d5('0x37')]['find']({'where':{'id':_0x3f74fb[_0x74d5('0x52')]['id']}})[_0x74d5('0x1f')](handleEntityNotFound(_0x1b9ce5,null))[_0x74d5('0x1f')](function(_0x4ce840){if(_0x4ce840){return _0x4ce840[_0x74d5('0x8f')](_0x3f74fb[_0x74d5('0x3d')][_0x74d5('0x7b')])[_0x74d5('0x1f')](function(){if(_['isArray'](_0x3f74fb[_0x74d5('0x3d')][_0x74d5('0x7b')])){for(var _0x160bde=0x0;_0x160bde<_0x3f74fb[_0x74d5('0x3d')]['ids'][_0x74d5('0x43')];_0x160bde+=0x1){socket[_0x74d5('0x79')](_0x74d5('0x8b'),{'UserId':Number(_0x3f74fb[_0x74d5('0x3d')][_0x74d5('0x7b')][_0x160bde]),'ChatQueueId':Number(_0x3f74fb[_0x74d5('0x52')]['id'])});}}else{socket[_0x74d5('0x79')](_0x74d5('0x8b'),{'UserId':Number(_0x3f74fb[_0x74d5('0x3d')][_0x74d5('0x7b')]),'ChatQueueId':Number(_0x3f74fb['params']['id'])});}});}})[_0x74d5('0x1f')](respondWithStatusCode(_0x1b9ce5,null))[_0x74d5('0x50')](handleError(_0x1b9ce5,null));};exports[_0x74d5('0x90')]=function(_0x2732cf,_0x35f6b4,_0x27769c){var _0x1c8ae4={};var _0x19b106={};var _0xff56a4;var _0xa1ff0a;return db[_0x74d5('0x37')][_0x74d5('0x5f')]({'where':{'id':_0x2732cf['params']['id']}})[_0x74d5('0x1f')](handleEntityNotFound(_0x35f6b4,null))['then'](function(_0x11f4ae){if(_0x11f4ae){_0xff56a4=_0x11f4ae;_0x19b106[_0x74d5('0x3c')]=_['keys'](db[_0x74d5('0x64')][_0x74d5('0x38')]);_0x19b106[_0x74d5('0x3d')]=_['keys'](_0x2732cf[_0x74d5('0x3d')]);_0x19b106[_0x74d5('0x3f')]=_[_0x74d5('0x40')](_0x19b106[_0x74d5('0x3c')],_0x19b106[_0x74d5('0x3d')]);_0x1c8ae4['attributes']=_[_0x74d5('0x40')](_0x19b106[_0x74d5('0x3c')],qs['fields'](_0x2732cf['query'][_0x74d5('0x42')]));_0x1c8ae4[_0x74d5('0x41')]=_0x1c8ae4[_0x74d5('0x41')]['length']?_0x1c8ae4[_0x74d5('0x41')]:_0x19b106['model'];_0x1c8ae4[_0x74d5('0x46')]=qs[_0x74d5('0x61')](_0x2732cf[_0x74d5('0x3d')][_0x74d5('0x61')]);_0x1c8ae4[_0x74d5('0x47')]=qs[_0x74d5('0x3f')](_[_0x74d5('0x62')](_0x2732cf[_0x74d5('0x3d')],_0x19b106[_0x74d5('0x3f')]));if(_0x2732cf['query'][_0x74d5('0x4a')]){_0x1c8ae4[_0x74d5('0x47')]=_['merge'](_0x1c8ae4[_0x74d5('0x47')],{'$or':_['map'](_0x1c8ae4['attributes'],function(_0xff88aa){var _0x4482c7={};_0x4482c7[_0xff88aa]={'$like':'%'+_0x2732cf[_0x74d5('0x3d')][_0x74d5('0x4a')]+'%'};return _0x4482c7;})});}_0x1c8ae4=_[_0x74d5('0x48')]({},_0x1c8ae4,_0x2732cf[_0x74d5('0x4b')]);return _0xff56a4[_0x74d5('0x90')](_0x1c8ae4);}})['then'](function(_0x147579){if(_0x147579){_0xa1ff0a=_0x147579[_0x74d5('0x43')];if(!_0x2732cf['query']['hasOwnProperty'](_0x74d5('0x45'))){_0x1c8ae4['limit']=qs[_0x74d5('0x2b')](_0x2732cf[_0x74d5('0x3d')]['limit']);_0x1c8ae4[_0x74d5('0x2a')]=qs['offset'](_0x2732cf[_0x74d5('0x3d')][_0x74d5('0x2a')]);}return _0xff56a4[_0x74d5('0x90')](_0x1c8ae4);}})['then'](function(_0x180948){if(_0x180948){return _0x180948?{'count':_0xa1ff0a,'rows':_0x180948}:null;}})['then'](respondWithResult(_0x35f6b4,null))[_0x74d5('0x50')](handleError(_0x35f6b4,null));}; \ No newline at end of file +var _0x6ae5=['key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','request\x20sent','debug','error','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','ChatQueues','stack','name','rawAttributes','fieldName','type'];(function(_0x5384ec,_0x569d9b){var _0x178c29=function(_0x59b00b){while(--_0x59b00b){_0x5384ec['push'](_0x5384ec['shift']());}};_0x178c29(++_0x569d9b);}(_0x6ae5,0x18d));var _0x56ae=function(_0x4f84b7,_0x5988ce){_0x4f84b7=_0x4f84b7-0x0;var _0x3d7240=_0x6ae5[_0x4f84b7];return _0x3d7240;};'use strict';var pdf=require(_0x56ae('0x0'));var emlformat=require(_0x56ae('0x1'));var rimraf=require(_0x56ae('0x2'));var zipdir=require(_0x56ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56ae('0x4'));var BPromise=require(_0x56ae('0x5'));var Mustache=require('mustache');var util=require(_0x56ae('0x6'));var path=require(_0x56ae('0x7'));var sox=require(_0x56ae('0x8'));var csv=require('to-csv');var ejs=require(_0x56ae('0x9'));var fs=require('fs');var _=require(_0x56ae('0xa'));var squel=require(_0x56ae('0xb'));var crypto=require(_0x56ae('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x56ae('0xd'));var toCsv=require(_0x56ae('0xe'));var querystring=require(_0x56ae('0xf'));var Papa=require(_0x56ae('0x10'));var Redis=require('ioredis');var authService=require(_0x56ae('0x11'));var qs=require(_0x56ae('0x12'));var as=require(_0x56ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x56ae('0x14'));var utils=require(_0x56ae('0x15'));var config=require(_0x56ae('0x16'));var licenseUtil=require(_0x56ae('0x17'));var db=require('../../mysqldb')['db'];config[_0x56ae('0x18')]=_[_0x56ae('0x19')](config['redis'],{'host':_0x56ae('0x1a'),'port':0x18eb});var socket=require(_0x56ae('0x1b'))(new Redis(config['redis']));require(_0x56ae('0x1c'))[_0x56ae('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa0aa,_0x3d5673,_0x5bd0d3,_0x2f6289){return new BPromise(function(_0x56ce40,_0x16b46f){var _0x5394b5=_0x2f6289||client;return _0x5394b5[_0x56ae('0x1e')](_0x5aa0aa,_0x5bd0d3)['then'](function(_0x5a33b9){logger['info']('ChatQueue,\x20%s,\x20%s',_0x3d5673,_0x56ae('0x1f'));logger[_0x56ae('0x20')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3d5673,'request\x20sent',JSON['stringify'](_0x5a33b9));if(_0x5a33b9[_0x56ae('0x21')]){if(_0x5a33b9[_0x56ae('0x21')]['code']===0x1f4){logger[_0x56ae('0x21')](_0x56ae('0x22'),_0x3d5673,_0x5a33b9[_0x56ae('0x21')][_0x56ae('0x23')]);return _0x16b46f(_0x5a33b9[_0x56ae('0x21')][_0x56ae('0x23')]);}logger[_0x56ae('0x21')]('ChatQueue,\x20%s,\x20%s',_0x3d5673,_0x5a33b9[_0x56ae('0x21')][_0x56ae('0x23')]);return _0x56ce40(_0x5a33b9['error'][_0x56ae('0x23')]);}else{logger[_0x56ae('0x24')](_0x56ae('0x22'),_0x3d5673,_0x56ae('0x1f'));_0x56ce40(_0x5a33b9[_0x56ae('0x25')][_0x56ae('0x23')]);}})[_0x56ae('0x26')](function(_0x5348b1){logger[_0x56ae('0x21')](_0x56ae('0x22'),_0x3d5673,_0x5348b1);_0x16b46f(_0x5348b1);});});}function respondWithStatusCode(_0x407f8c,_0x2df60a){_0x2df60a=_0x2df60a||0xcc;return function(_0x1c11fe){if(_0x1c11fe){return _0x407f8c[_0x56ae('0x27')](_0x2df60a);}return _0x407f8c[_0x56ae('0x28')](_0x2df60a)[_0x56ae('0x29')]();};}function respondWithResult(_0x74b259,_0x2de120){_0x2de120=_0x2de120||0xc8;return function(_0x473810){if(_0x473810){return _0x74b259[_0x56ae('0x28')](_0x2de120)[_0x56ae('0x2a')](_0x473810);}};}function respondWithFilteredResult(_0x54ca2d,_0x2865ef){return function(_0x338f04){if(_0x338f04){var _0x4aef1f=_0x338f04[_0x56ae('0x2b')],_0x4f692b=_0x2865ef[_0x56ae('0x2c')],_0x3826f0=_0x2865ef[_0x56ae('0x2c')]+_0x2865ef[_0x56ae('0x2d')],_0x122638;if(_0x3826f0>=_0x4aef1f){_0x3826f0=_0x4aef1f;_0x122638=0xc8;}else{_0x122638=0xce;}_0x54ca2d[_0x56ae('0x28')](_0x122638);return _0x54ca2d[_0x56ae('0x2e')](_0x56ae('0x2f'),_0x4f692b+'-'+_0x3826f0+'/'+_0x4aef1f)[_0x56ae('0x2a')](_0x338f04);}return null;};}function patchUpdates(_0xb5e2c){return function(_0x4bd77a){try{jsonpatch['apply'](_0x4bd77a,_0xb5e2c,!![]);}catch(_0x5b37a9){return BPromise[_0x56ae('0x30')](_0x5b37a9);}return _0x4bd77a['save']();};}function saveUpdates(_0x431228,_0xbce985){return function(_0x213a49){if(_0x213a49){return _0x213a49[_0x56ae('0x31')](_0x431228)[_0x56ae('0x32')](function(_0x1964ad){return _0x1964ad;});}return null;};}function removeEntity(_0x579655,_0x1ee948){return function(_0x1863ed){if(_0x1863ed){return _0x1863ed[_0x56ae('0x33')]()[_0x56ae('0x32')](function(){var _0x1d3018=_0x1863ed[_0x56ae('0x34')]({'plain':!![]});var _0x1d68a5=_0x56ae('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d68a5,'resourceId':_0x1d3018['id']}})[_0x56ae('0x32')](function(){return _0x1863ed;});})['then'](function(){_0x579655['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1c8f,_0x110b5c){return function(_0x5e6ce5){if(!_0x5e6ce5){_0x2e1c8f[_0x56ae('0x27')](0x194);}return _0x5e6ce5;};}function handleError(_0x30b865,_0x239d0c){_0x239d0c=_0x239d0c||0x1f4;return function(_0x425d90){logger[_0x56ae('0x21')](_0x425d90[_0x56ae('0x36')]);if(_0x425d90[_0x56ae('0x37')]){delete _0x425d90[_0x56ae('0x37')];}_0x30b865['status'](_0x239d0c)['send'](_0x425d90);};}exports['index']=function(_0x45459c,_0x35bf35){var _0x5129df={},_0xc99be={},_0x39d496={'count':0x0,'rows':[]};var _0x27f119=_['map'](db['ChatQueue'][_0x56ae('0x38')],function(_0x550615){return{'name':_0x550615[_0x56ae('0x39')],'type':_0x550615[_0x56ae('0x3a')][_0x56ae('0x3b')]};});_0xc99be[_0x56ae('0x3c')]=_[_0x56ae('0x3d')](_0x27f119,_0x56ae('0x37'));_0xc99be['query']=_['keys'](_0x45459c[_0x56ae('0x3e')]);_0xc99be[_0x56ae('0x3f')]=_[_0x56ae('0x40')](_0xc99be[_0x56ae('0x3c')],_0xc99be[_0x56ae('0x3e')]);_0x5129df['attributes']=_[_0x56ae('0x40')](_0xc99be['model'],qs[_0x56ae('0x41')](_0x45459c['query'][_0x56ae('0x41')]));_0x5129df['attributes']=_0x5129df[_0x56ae('0x42')][_0x56ae('0x43')]?_0x5129df[_0x56ae('0x42')]:_0xc99be[_0x56ae('0x3c')];if(!_0x45459c[_0x56ae('0x3e')][_0x56ae('0x44')](_0x56ae('0x45'))){_0x5129df[_0x56ae('0x2d')]=qs[_0x56ae('0x2d')](_0x45459c[_0x56ae('0x3e')][_0x56ae('0x2d')]);_0x5129df[_0x56ae('0x2c')]=qs['offset'](_0x45459c[_0x56ae('0x3e')][_0x56ae('0x2c')]);}_0x5129df[_0x56ae('0x46')]=qs['sort'](_0x45459c[_0x56ae('0x3e')][_0x56ae('0x47')]);_0x5129df[_0x56ae('0x48')]=qs[_0x56ae('0x3f')](_[_0x56ae('0x49')](_0x45459c[_0x56ae('0x3e')],_0xc99be[_0x56ae('0x3f')]),_0x27f119);if(_0x45459c['query'][_0x56ae('0x4a')]){_0x5129df['where']=_[_0x56ae('0x4b')](_0x5129df[_0x56ae('0x48')],{'$or':_[_0x56ae('0x3d')](_0x27f119,function(_0x15d79e){if(_0x15d79e[_0x56ae('0x3a')]!==_0x56ae('0x4c')){var _0x38d1bc={};_0x38d1bc[_0x15d79e['name']]={'$like':'%'+_0x45459c[_0x56ae('0x3e')][_0x56ae('0x4a')]+'%'};return _0x38d1bc;}})});}_0x5129df=_[_0x56ae('0x4b')]({},_0x5129df,_0x45459c[_0x56ae('0x4d')]);var _0x5c3022={'where':_0x5129df['where']};return db[_0x56ae('0x4e')]['count'](_0x5c3022)[_0x56ae('0x32')](function(_0x2c3f1b){_0x39d496[_0x56ae('0x2b')]=_0x2c3f1b;if(_0x45459c['query'][_0x56ae('0x4f')]){_0x5129df[_0x56ae('0x50')]=[{'all':!![]}];}return db[_0x56ae('0x4e')][_0x56ae('0x51')](_0x5129df);})[_0x56ae('0x32')](function(_0x19bdd4){_0x39d496[_0x56ae('0x52')]=_0x19bdd4;return _0x39d496;})[_0x56ae('0x32')](respondWithFilteredResult(_0x35bf35,_0x5129df))[_0x56ae('0x26')](handleError(_0x35bf35,null));};exports[_0x56ae('0x53')]=function(_0x593afe,_0x1d1dc4){var _0x1b8ebf={'raw':!![],'where':{'id':_0x593afe[_0x56ae('0x54')]['id']}},_0x3f55b3={};_0x3f55b3['model']=_[_0x56ae('0x55')](db['ChatQueue']['rawAttributes']);_0x3f55b3['query']=_[_0x56ae('0x55')](_0x593afe['query']);_0x3f55b3[_0x56ae('0x3f')]=_[_0x56ae('0x40')](_0x3f55b3[_0x56ae('0x3c')],_0x3f55b3['query']);_0x1b8ebf[_0x56ae('0x42')]=_[_0x56ae('0x40')](_0x3f55b3[_0x56ae('0x3c')],qs[_0x56ae('0x41')](_0x593afe[_0x56ae('0x3e')][_0x56ae('0x41')]));_0x1b8ebf[_0x56ae('0x42')]=_0x1b8ebf[_0x56ae('0x42')][_0x56ae('0x43')]?_0x1b8ebf[_0x56ae('0x42')]:_0x3f55b3['model'];if(_0x593afe[_0x56ae('0x3e')]['includeAll']){_0x1b8ebf[_0x56ae('0x50')]=[{'all':!![]}];}_0x1b8ebf=_[_0x56ae('0x4b')]({},_0x1b8ebf,_0x593afe[_0x56ae('0x4d')]);return db[_0x56ae('0x4e')][_0x56ae('0x56')](_0x1b8ebf)['then'](handleEntityNotFound(_0x1d1dc4,null))[_0x56ae('0x32')](respondWithResult(_0x1d1dc4,null))[_0x56ae('0x26')](handleError(_0x1d1dc4,null));};exports['create']=function(_0x52b22a,_0x1979ee){return db[_0x56ae('0x4e')][_0x56ae('0x57')](_0x52b22a['body'],{})[_0x56ae('0x32')](function(_0x5d52ac){var _0x43fe10=_0x52b22a[_0x56ae('0x58')]['get']({'plain':!![]});if(!_0x43fe10)throw new Error(_0x56ae('0x59'));if(_0x43fe10[_0x56ae('0x5a')]===_0x56ae('0x58')){var _0xed40f5=_0x5d52ac['get']({'plain':!![]});var _0x5d160b=_0x56ae('0x35');return db[_0x56ae('0x5b')]['find']({'where':{'name':_0x5d160b,'userProfileId':_0x43fe10[_0x56ae('0x5c')]},'raw':!![]})[_0x56ae('0x32')](function(_0x566bda){if(_0x566bda&&_0x566bda[_0x56ae('0x5d')]===0x0){return db[_0x56ae('0x5e')]['create']({'name':_0xed40f5[_0x56ae('0x37')],'resourceId':_0xed40f5['id'],'type':_0x566bda['name'],'sectionId':_0x566bda['id']},{})[_0x56ae('0x32')](function(){return _0x5d52ac;});}else{return _0x5d52ac;}})[_0x56ae('0x26')](function(_0x239709){logger[_0x56ae('0x21')](_0x56ae('0x5f'),_0x239709);throw _0x239709;});}return _0x5d52ac;})[_0x56ae('0x32')](respondWithResult(_0x1979ee,0xc9))[_0x56ae('0x26')](handleError(_0x1979ee,null));};exports['update']=function(_0x4fe9c6,_0x4336c6){if(_0x4fe9c6[_0x56ae('0x60')]['id']){delete _0x4fe9c6[_0x56ae('0x60')]['id'];}return db['ChatQueue'][_0x56ae('0x56')]({'where':{'id':_0x4fe9c6[_0x56ae('0x54')]['id']}})['then'](handleEntityNotFound(_0x4336c6,null))[_0x56ae('0x32')](saveUpdates(_0x4fe9c6[_0x56ae('0x60')],null))[_0x56ae('0x32')](respondWithResult(_0x4336c6,null))[_0x56ae('0x26')](handleError(_0x4336c6,null));};exports['destroy']=function(_0x309dbd,_0x35fb80){return db[_0x56ae('0x4e')][_0x56ae('0x56')]({'where':{'id':_0x309dbd[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](handleEntityNotFound(_0x35fb80,null))['then'](removeEntity(_0x35fb80,null))[_0x56ae('0x26')](handleError(_0x35fb80,null));};exports[_0x56ae('0x61')]=function(_0x3bdbd4,_0x51923d){return db['ChatQueue'][_0x56ae('0x61')]()['then'](respondWithResult(_0x51923d,null))[_0x56ae('0x26')](handleError(_0x51923d,null));};exports[_0x56ae('0x62')]=function(_0x21a3c1,_0x42166a,_0x4b0e1d){var _0x1c1be8={'raw':!![],'where':{}},_0xca8de2={},_0x243cf4;return db[_0x56ae('0x4e')][_0x56ae('0x63')]({'where':{'id':_0x21a3c1[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](handleEntityNotFound(_0x42166a,null))[_0x56ae('0x32')](function(_0x11c4ad){if(_0x11c4ad){_0x243cf4=_0x11c4ad[_0x56ae('0x34')]({'plain':!![]});_0xca8de2[_0x56ae('0x3c')]=_[_0x56ae('0x55')](db[_0x56ae('0x64')][_0x56ae('0x38')]);_0xca8de2[_0x56ae('0x3e')]=_['keys'](_0x21a3c1[_0x56ae('0x3e')]);_0xca8de2['filters']=_['intersection'](_0xca8de2[_0x56ae('0x3c')],_0xca8de2['query']);_0x1c1be8[_0x56ae('0x42')]=_[_0x56ae('0x40')](_0xca8de2[_0x56ae('0x3c')],qs[_0x56ae('0x41')](_0x21a3c1[_0x56ae('0x3e')][_0x56ae('0x41')]));_0x1c1be8['attributes']=_0x1c1be8[_0x56ae('0x42')][_0x56ae('0x43')]?_0x1c1be8['attributes']:_0xca8de2['model'];if(!_0x21a3c1[_0x56ae('0x3e')][_0x56ae('0x44')](_0x56ae('0x45'))){_0x1c1be8[_0x56ae('0x2d')]=qs[_0x56ae('0x2d')](_0x21a3c1[_0x56ae('0x3e')][_0x56ae('0x2d')]);_0x1c1be8['offset']=qs[_0x56ae('0x2c')](_0x21a3c1[_0x56ae('0x3e')]['offset']);}_0x1c1be8['order']=qs[_0x56ae('0x47')](_0x21a3c1[_0x56ae('0x3e')][_0x56ae('0x47')]);_0x1c1be8[_0x56ae('0x48')]=qs['filters'](_[_0x56ae('0x49')](_0x21a3c1[_0x56ae('0x3e')],_0xca8de2['filters']));_0x1c1be8[_0x56ae('0x48')][_0x56ae('0x65')]=_0x11c4ad['id'];if(_0x21a3c1['query']['filter']){_0x1c1be8[_0x56ae('0x48')]=_[_0x56ae('0x4b')](_0x1c1be8['where'],{'$or':_[_0x56ae('0x3d')](_0x1c1be8['attributes'],function(_0x4241e4){var _0x1ddbdf={};_0x1ddbdf[_0x4241e4]={'$like':'%'+_0x21a3c1[_0x56ae('0x3e')][_0x56ae('0x4a')]+'%'};return _0x1ddbdf;})});}_0x1c1be8=_[_0x56ae('0x4b')]({},_0x1c1be8,_0x21a3c1[_0x56ae('0x4d')]);return db[_0x56ae('0x64')][_0x56ae('0x51')](_0x1c1be8);}})['then'](function(_0x52230f){if(_0x52230f){return db['User'][_0x56ae('0x66')]({'where':{'id':_[_0x56ae('0x3d')](_0x52230f,_0x56ae('0x67')),'role':_0x56ae('0x68')},'attributes':['id',_0x56ae('0x37'),'chatPause',_0x56ae('0x69'),_0x56ae('0x6a')]});}})[_0x56ae('0x32')](function(_0x525c84){if(_0x525c84){return{'count':_0x525c84[_0x56ae('0x2b')],'rows':_[_0x56ae('0x3d')](_0x525c84[_0x56ae('0x52')],function(_0x1adad3){return{'membername':_0x1adad3[_0x56ae('0x37')],'UserId':_0x1adad3['id'],'queue_name':_0x243cf4[_0x56ae('0x37')],'ChatQueueId':_0x243cf4['id'],'interface':util[_0x56ae('0x6b')]('%s/%s',_0x56ae('0x6c'),_0x1adad3[_0x56ae('0x37')]),'penalty':0x0,'paused':_0x1adad3['chatPause'],'createdAt':_0x1adad3[_0x56ae('0x6a')],'updatedAt':_0x1adad3[_0x56ae('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x56ae('0x32')](respondWithFilteredResult(_0x42166a,_0x1c1be8))[_0x56ae('0x26')](handleError(_0x42166a,null));};exports[_0x56ae('0x6d')]=function(_0x2c28a4,_0x1d15bf,_0x4009e4){var _0x49f96d={};var _0x200d89={};var _0x22c2b8;var _0x224ffc;return db[_0x56ae('0x4e')][_0x56ae('0x63')]({'where':{'id':_0x2c28a4[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](handleEntityNotFound(_0x1d15bf,null))[_0x56ae('0x32')](function(_0x5cdd77){if(_0x5cdd77){_0x22c2b8=_0x5cdd77;_0x200d89[_0x56ae('0x3c')]=_[_0x56ae('0x55')](db[_0x56ae('0x6e')]['rawAttributes']);_0x200d89[_0x56ae('0x3e')]=_['keys'](_0x2c28a4[_0x56ae('0x3e')]);_0x200d89['filters']=_[_0x56ae('0x40')](_0x200d89['model'],_0x200d89[_0x56ae('0x3e')]);_0x49f96d[_0x56ae('0x42')]=_['intersection'](_0x200d89[_0x56ae('0x3c')],qs[_0x56ae('0x41')](_0x2c28a4[_0x56ae('0x3e')][_0x56ae('0x41')]));_0x49f96d[_0x56ae('0x42')]=_0x49f96d[_0x56ae('0x42')][_0x56ae('0x43')]?_0x49f96d[_0x56ae('0x42')]:_0x200d89[_0x56ae('0x3c')];_0x49f96d[_0x56ae('0x46')]=qs['sort'](_0x2c28a4[_0x56ae('0x3e')][_0x56ae('0x47')]);_0x49f96d[_0x56ae('0x48')]=qs[_0x56ae('0x3f')](_[_0x56ae('0x49')](_0x2c28a4[_0x56ae('0x3e')],_0x200d89[_0x56ae('0x3f')]));if(_0x2c28a4[_0x56ae('0x3e')][_0x56ae('0x4a')]){_0x49f96d[_0x56ae('0x48')]=_[_0x56ae('0x4b')](_0x49f96d[_0x56ae('0x48')],{'$or':_['map'](_0x49f96d[_0x56ae('0x42')],function(_0x55a2e0){var _0x3a7f66={};_0x3a7f66[_0x55a2e0]={'$like':'%'+_0x2c28a4['query'][_0x56ae('0x4a')]+'%'};return _0x3a7f66;})});}_0x49f96d=_[_0x56ae('0x4b')]({},_0x49f96d,_0x2c28a4[_0x56ae('0x4d')]);return _0x22c2b8[_0x56ae('0x6d')](_0x49f96d);}})[_0x56ae('0x32')](function(_0x3e1c66){if(_0x3e1c66){_0x224ffc=_0x3e1c66[_0x56ae('0x43')];if(!_0x2c28a4['query'][_0x56ae('0x44')](_0x56ae('0x45'))){_0x49f96d[_0x56ae('0x2d')]=qs['limit'](_0x2c28a4[_0x56ae('0x3e')]['limit']);_0x49f96d[_0x56ae('0x2c')]=qs[_0x56ae('0x2c')](_0x2c28a4['query'][_0x56ae('0x2c')]);}return _0x22c2b8['getTeams'](_0x49f96d);}})[_0x56ae('0x32')](function(_0x2bbd39){if(_0x2bbd39){return _0x2bbd39?{'count':_0x224ffc,'rows':_0x2bbd39}:null;}})[_0x56ae('0x32')](respondWithResult(_0x1d15bf,null))[_0x56ae('0x26')](handleError(_0x1d15bf,null));};exports[_0x56ae('0x6f')]=function(_0x2fc275,_0x5283d3,_0x9eaca5){var _0x555e09=_0x2fc275[_0x56ae('0x60')][_0x56ae('0x70')];return db[_0x56ae('0x6e')][_0x56ae('0x51')]({'where':{'id':_0x555e09},'attributes':['id'],'include':[{'model':db[_0x56ae('0x71')],'as':_0x56ae('0x72'),'attributes':['id',_0x56ae('0x37'),_0x56ae('0x73'),_0x56ae('0x74'),_0x56ae('0x75')],'raw':!![]}]})[_0x56ae('0x32')](function(_0x1c8be0){if(_0x1c8be0){var _0x1ce01f=_[_0x56ae('0x76')](_0x1c8be0,function(_0x43e208){var _0x2f9dca=_0x43e208[_0x56ae('0x34')]({'plain':!![]});return _0x2f9dca[_0x56ae('0x72')];});return db[_0x56ae('0x4e')]['find']({'where':{'id':_0x2fc275[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](function(_0x3d7e73){return db[_0x56ae('0x77')]['transaction'](function(_0x8ba4c8){return _0x3d7e73[_0x56ae('0x6f')](_0x555e09,{'transaction':_0x8ba4c8})[_0x56ae('0x32')](function(){return BPromise[_0x56ae('0x78')](_0x1ce01f,function(_0x305580){return db[_0x56ae('0x64')][_0x56ae('0x79')]({'where':{'UserId':_0x305580['id'],'ChatQueueId':_0x2fc275[_0x56ae('0x54')]['id']},'transaction':_0x8ba4c8});});})[_0x56ae('0x32')](function(){_0x1ce01f[_0x56ae('0x7a')](function(_0x303682){socket[_0x56ae('0x7b')](_0x56ae('0x7c'),{'UserId':_0x303682['id'],'ChatQueueId':_0x3d7e73['id']});});});});});}})[_0x56ae('0x32')](respondWithStatusCode(_0x5283d3,null))[_0x56ae('0x26')](handleError(_0x5283d3,null));};exports[_0x56ae('0x7d')]=function(_0x336f44,_0x25cbdb,_0x17f6b9){return db[_0x56ae('0x6e')][_0x56ae('0x51')]({'where':{'id':_0x336f44[_0x56ae('0x3e')][_0x56ae('0x70')]},'attributes':['id'],'include':[{'model':db[_0x56ae('0x71')],'as':_0x56ae('0x72'),'attributes':['id'],'raw':!![]}]})[_0x56ae('0x32')](handleEntityNotFound(_0x25cbdb,null))[_0x56ae('0x32')](function(_0x287c0d){var _0x15dbc6=_['map'](_0x287c0d,'id');var _0x46ccc0=[];var _0x1afea9=[];var _0x2f6595=squel[_0x56ae('0x7e')]();_0x2f6595[_0x56ae('0x7f')](_0x56ae('0x80'))[_0x56ae('0x81')](_0x56ae('0x82'),'tq')[_0x56ae('0x83')](_0x56ae('0x84'),'ut',_0x56ae('0x85'))[_0x56ae('0x48')](_0x56ae('0x86'),_0x336f44[_0x56ae('0x54')]['id']);for(var _0x1d935c=0x0;_0x1d935c<_0x287c0d[_0x56ae('0x43')];_0x1d935c+=0x1){let _0x4126f1=_0x287c0d[_0x1d935c];for(var _0x164095=0x0;_0x164095<_0x4126f1[_0x56ae('0x72')][_0x56ae('0x43')];_0x164095+=0x1){let _0xabc7ae=_0x4126f1[_0x56ae('0x72')][_0x164095];var _0x50cd8b=_0x2f6595[_0x56ae('0x87')]();_0x50cd8b['where'](_0x56ae('0x88'),_0xabc7ae['id']);_0x1afea9[_0x56ae('0x89')](db['sequelize']['query'](_0x50cd8b[_0x56ae('0x8a')](),{'type':db[_0x56ae('0x77')]['QueryTypes'][_0x56ae('0x8b')]})['then'](function(_0x545371){if(_0x545371[_0x56ae('0x43')]===0x1){return _0xabc7ae['id'];}else{var _0x219665=_[_0x56ae('0x8c')](_[_0x56ae('0x3d')](_0x545371,_0x56ae('0x8d')),function(_0x3039d1){return _['includes'](_0x15dbc6,_0x3039d1);});if(_0x219665){return _0xabc7ae['id'];}}}));}}return BPromise[_0x56ae('0x8e')](_0x1afea9)[_0x56ae('0x32')](function(_0x800df1){_0x46ccc0=_(_0x46ccc0)[_0x56ae('0x8f')](_0x800df1)[_0x56ae('0x90')]()[_0x56ae('0x91')]();return db[_0x56ae('0x4e')]['find']({'where':{'id':_0x336f44[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](function(_0x4dd040){return db[_0x56ae('0x77')]['transaction'](function(_0x4fcf09){return _0x4dd040[_0x56ae('0x7d')](_0x336f44[_0x56ae('0x3e')][_0x56ae('0x70')],{'transaction':_0x4fcf09})[_0x56ae('0x32')](function(){if(!_[_0x56ae('0x92')](_0x46ccc0)){return _0x4dd040[_0x56ae('0x93')](_0x46ccc0,{'transaction':_0x4fcf09});}})[_0x56ae('0x32')](function(){_0x46ccc0[_0x56ae('0x7a')](function(_0x254f15){socket[_0x56ae('0x7b')](_0x56ae('0x94'),{'UserId':_0x254f15,'ChatQueueId':_0x4dd040['id']});});});});});});})[_0x56ae('0x32')](respondWithStatusCode(_0x25cbdb,null))[_0x56ae('0x26')](handleError(_0x25cbdb,null));};exports[_0x56ae('0x95')]=function(_0x8d2fe7,_0x4b0392,_0x2372d1){return db[_0x56ae('0x4e')][_0x56ae('0x56')]({'where':{'id':_0x8d2fe7['params']['id']}})['then'](handleEntityNotFound(_0x4b0392,null))['then'](function(_0x1964f5){if(_0x1964f5){return _0x1964f5[_0x56ae('0x95')](_0x8d2fe7[_0x56ae('0x60')][_0x56ae('0x70')],_[_0x56ae('0x96')](_0x8d2fe7[_0x56ae('0x60')],['ids','id'])||{})[_0x56ae('0x97')](function(_0xe4b110){for(var _0x473d92=0x0;_0x473d92<_0x8d2fe7['body'][_0x56ae('0x70')][_0x56ae('0x43')];_0x473d92+=0x1){socket[_0x56ae('0x7b')](_0x56ae('0x7c'),{'UserId':_0x8d2fe7['body'][_0x56ae('0x70')][_0x473d92],'ChatQueueId':_0x8d2fe7[_0x56ae('0x54')]['id']});}return _0xe4b110;});}})[_0x56ae('0x32')](respondWithResult(_0x4b0392,null))[_0x56ae('0x26')](handleError(_0x4b0392,null));};exports['removeAgents']=function(_0x546810,_0x1b93ba,_0x3b0951){return db['ChatQueue'][_0x56ae('0x56')]({'where':{'id':_0x546810[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](handleEntityNotFound(_0x1b93ba,null))[_0x56ae('0x32')](function(_0x13d752){if(_0x13d752){return _0x13d752[_0x56ae('0x93')](_0x546810['query'][_0x56ae('0x70')])[_0x56ae('0x32')](function(){if(_['isArray'](_0x546810[_0x56ae('0x3e')][_0x56ae('0x70')])){for(var _0x12edb5=0x0;_0x12edb5<_0x546810[_0x56ae('0x3e')][_0x56ae('0x70')][_0x56ae('0x43')];_0x12edb5+=0x1){socket[_0x56ae('0x7b')](_0x56ae('0x94'),{'UserId':Number(_0x546810[_0x56ae('0x3e')][_0x56ae('0x70')][_0x12edb5]),'ChatQueueId':Number(_0x546810['params']['id'])});}}else{socket[_0x56ae('0x7b')](_0x56ae('0x94'),{'UserId':Number(_0x546810[_0x56ae('0x3e')]['ids']),'ChatQueueId':Number(_0x546810[_0x56ae('0x54')]['id'])});}});}})[_0x56ae('0x32')](respondWithStatusCode(_0x1b93ba,null))['catch'](handleError(_0x1b93ba,null));};exports['getAgents']=function(_0x16b943,_0x571934,_0x320678){var _0x54ecc3={};var _0x333e43={};var _0x5840ff;var _0x334e00;return db[_0x56ae('0x4e')]['findOne']({'where':{'id':_0x16b943[_0x56ae('0x54')]['id']}})[_0x56ae('0x32')](handleEntityNotFound(_0x571934,null))[_0x56ae('0x32')](function(_0x462dd5){if(_0x462dd5){_0x5840ff=_0x462dd5;_0x333e43[_0x56ae('0x3c')]=_['keys'](db['User']['rawAttributes']);_0x333e43[_0x56ae('0x3e')]=_['keys'](_0x16b943[_0x56ae('0x3e')]);_0x333e43['filters']=_['intersection'](_0x333e43[_0x56ae('0x3c')],_0x333e43[_0x56ae('0x3e')]);_0x54ecc3[_0x56ae('0x42')]=_[_0x56ae('0x40')](_0x333e43['model'],qs[_0x56ae('0x41')](_0x16b943[_0x56ae('0x3e')][_0x56ae('0x41')]));_0x54ecc3[_0x56ae('0x42')]=_0x54ecc3[_0x56ae('0x42')][_0x56ae('0x43')]?_0x54ecc3[_0x56ae('0x42')]:_0x333e43['model'];_0x54ecc3['order']=qs[_0x56ae('0x47')](_0x16b943[_0x56ae('0x3e')][_0x56ae('0x47')]);_0x54ecc3[_0x56ae('0x48')]=qs['filters'](_[_0x56ae('0x49')](_0x16b943['query'],_0x333e43[_0x56ae('0x3f')]));if(_0x16b943['query'][_0x56ae('0x4a')]){_0x54ecc3['where']=_[_0x56ae('0x4b')](_0x54ecc3['where'],{'$or':_[_0x56ae('0x3d')](_0x54ecc3['attributes'],function(_0x181130){var _0x401ef3={};_0x401ef3[_0x181130]={'$like':'%'+_0x16b943['query'][_0x56ae('0x4a')]+'%'};return _0x401ef3;})});}_0x54ecc3=_[_0x56ae('0x4b')]({},_0x54ecc3,_0x16b943[_0x56ae('0x4d')]);return _0x5840ff['getAgents'](_0x54ecc3);}})[_0x56ae('0x32')](function(_0x49101d){if(_0x49101d){_0x334e00=_0x49101d[_0x56ae('0x43')];if(!_0x16b943[_0x56ae('0x3e')][_0x56ae('0x44')](_0x56ae('0x45'))){_0x54ecc3[_0x56ae('0x2d')]=qs['limit'](_0x16b943[_0x56ae('0x3e')][_0x56ae('0x2d')]);_0x54ecc3['offset']=qs[_0x56ae('0x2c')](_0x16b943['query'][_0x56ae('0x2c')]);}return _0x5840ff['getAgents'](_0x54ecc3);}})[_0x56ae('0x32')](function(_0xdadc51){if(_0xdadc51){return _0xdadc51?{'count':_0x334e00,'rows':_0xdadc51}:null;}})['then'](respondWithResult(_0x571934,null))[_0x56ae('0x26')](handleError(_0x571934,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d66a700..ae46213 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(_0x7cc04f,_0x323aad){var _0x57f985=function(_0x4f406a){while(--_0x4f406a){_0x7cc04f['push'](_0x7cc04f['shift']());}};_0x57f985(++_0x323aad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27bccb,_0x3a2c3f){_0x27bccb=_0x27bccb-0x0;var _0x5c9b55=_0x5f2f[_0x27bccb];return _0x5c9b55;};'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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x552804,_0x3c3d1e){var _0x32be66=function(_0x14c213){while(--_0x14c213){_0x552804['push'](_0x552804['shift']());}};_0x32be66(++_0x3c3d1e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ccf7434..364caad 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 _0xae91=['util','../../config/logger','api','moment','path','rimraf','./chatQueue.attributes','define','lodash'];(function(_0x736751,_0x4c3f21){var _0x441348=function(_0xb86222){while(--_0xb86222){_0x736751['push'](_0x736751['shift']());}};_0x441348(++_0x4c3f21);}(_0xae91,0x6b));var _0x1ae9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae91[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1ae9('0x0'));var util=require(_0x1ae9('0x1'));var logger=require(_0x1ae9('0x2'))(_0x1ae9('0x3'));var moment=require(_0x1ae9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ae9('0x5'));var rimraf=require(_0x1ae9('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ae9('0x7'));module['exports']=function(_0x390fa0,_0x37396e){return _0x390fa0[_0x1ae9('0x8')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01fe=['moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x294ff8,_0xb60106){var _0x3554e8=function(_0x42ff5a){while(--_0x42ff5a){_0x294ff8['push'](_0x294ff8['shift']());}};_0x3554e8(++_0xb60106);}(_0x01fe,0x1c3));var _0xe01f=function(_0x52b6b5,_0x1ebdf3){_0x52b6b5=_0x52b6b5-0x0;var _0x53fdfe=_0x01fe[_0x52b6b5];return _0x53fdfe;};'use strict';var _=require(_0xe01f('0x0'));var util=require(_0xe01f('0x1'));var logger=require(_0xe01f('0x2'))(_0xe01f('0x3'));var moment=require(_0xe01f('0x4'));var BPromise=require(_0xe01f('0x5'));var rp=require(_0xe01f('0x6'));var fs=require('fs');var path=require(_0xe01f('0x7'));var rimraf=require(_0xe01f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe01f('0x9'));module[_0xe01f('0xa')]=function(_0x383631,_0x14389c){return _0x383631['define'](_0xe01f('0xb'),attributes,{'tableName':_0xe01f('0xc'),'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 bf05b17..222cb51 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 _0x4547=['raw','where','limit','include','model','attributes','map','debug','ShowChatQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4547,0x11b));var _0x7454=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x4547[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x7454('0x0'));var util=require(_0x7454('0x1'));var moment=require('moment');var BPromise=require(_0x7454('0x2'));var rs=require(_0x7454('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7454('0x4'))['db'];var utils=require(_0x7454('0x5'));var logger=require(_0x7454('0x6'))(_0x7454('0x7'));var config=require(_0x7454('0x8'));var jayson=require(_0x7454('0x9'));var client=jayson[_0x7454('0xa')]['http']({'port':0x232a});config[_0x7454('0xb')]=_['defaults'](config[_0x7454('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7454('0xc'))(new Redis(config['redis']));require(_0x7454('0xd'))[_0x7454('0xe')](socket);function respondWithRpcPromise(_0x4d4e72,_0x308050,_0x19ac21){return new BPromise(function(_0x81e1e1,_0x465e3c){return client[_0x7454('0xf')](_0x4d4e72,_0x19ac21)[_0x7454('0x10')](function(_0x53ebb6){logger[_0x7454('0x11')](_0x7454('0x12'),_0x308050,_0x7454('0x13'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x308050,_0x7454('0x13'),JSON[_0x7454('0x14')](_0x53ebb6));if(_0x53ebb6[_0x7454('0x15')]){if(_0x53ebb6['error']['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x308050,_0x53ebb6['error'][_0x7454('0x16')]);return _0x465e3c(_0x53ebb6[_0x7454('0x15')]['message']);}logger['error'](_0x7454('0x12'),_0x308050,_0x53ebb6[_0x7454('0x15')][_0x7454('0x16')]);return _0x81e1e1(_0x53ebb6['error']['message']);}else{logger[_0x7454('0x11')](_0x7454('0x12'),_0x308050,_0x7454('0x13'));_0x81e1e1(_0x53ebb6[_0x7454('0x17')][_0x7454('0x16')]);}})[_0x7454('0x18')](function(_0x5a7351){logger[_0x7454('0x15')]('ChatQueue,\x20%s,\x20%s',_0x308050,_0x5a7351);_0x465e3c(_0x5a7351);});});}exports[_0x7454('0x19')]=function(_0x2ddb7f){var _0x5b7605=this;return new Promise(function(_0x2df7b5,_0x1d4597){return db[_0x7454('0x1a')][_0x7454('0x1b')]({'raw':_0x2ddb7f[_0x7454('0x1c')]?_0x2ddb7f[_0x7454('0x1c')][_0x7454('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ddb7f[_0x7454('0x1c')]?_0x2ddb7f[_0x7454('0x1c')][_0x7454('0x1e')]||null:null,'attributes':_0x2ddb7f[_0x7454('0x1c')]?_0x2ddb7f['options']['attributes']||null:null,'limit':_0x2ddb7f['options']?_0x2ddb7f['options'][_0x7454('0x1f')]||null:null,'include':_0x2ddb7f[_0x7454('0x1c')]?_0x2ddb7f[_0x7454('0x1c')][_0x7454('0x20')]?_['map'](_0x2ddb7f[_0x7454('0x1c')][_0x7454('0x20')],function(_0x13563f){return{'model':db[_0x13563f[_0x7454('0x21')]],'as':_0x13563f['as'],'attributes':_0x13563f[_0x7454('0x22')],'include':_0x13563f[_0x7454('0x20')]?_[_0x7454('0x23')](_0x13563f[_0x7454('0x20')],function(_0x2d9f59){return{'model':db[_0x2d9f59[_0x7454('0x21')]],'as':_0x2d9f59['as'],'attributes':_0x2d9f59['attributes'],'include':_0x2d9f59[_0x7454('0x20')]?_[_0x7454('0x23')](_0x2d9f59[_0x7454('0x20')],function(_0x298296){return{'model':db[_0x298296[_0x7454('0x21')]],'as':_0x298296['as'],'attributes':_0x298296[_0x7454('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7454('0x10')](function(_0x107dd8){logger['info']('GetChatQueue',_0x2ddb7f);logger[_0x7454('0x24')]('GetChatQueue',_0x2ddb7f,JSON['stringify'](_0x107dd8));_0x2df7b5(_0x107dd8);})[_0x7454('0x18')](function(_0x3050f7){logger[_0x7454('0x15')](_0x7454('0x19'),_0x3050f7[_0x7454('0x16')],_0x2ddb7f);_0x1d4597(_0x5b7605[_0x7454('0x15')](0x1f4,_0x3050f7[_0x7454('0x16')]));});});};exports[_0x7454('0x25')]=function(_0x234a30){var _0x1031d8=this;return new Promise(function(_0x644efd,_0x4cfd57){return db['ChatQueue'][_0x7454('0x26')]({'raw':_0x234a30['options']?_0x234a30[_0x7454('0x1c')][_0x7454('0x1d')]===undefined?!![]:![]:!![],'where':_0x234a30['options']?_0x234a30[_0x7454('0x1c')]['where']||null:null,'attributes':_0x234a30[_0x7454('0x1c')]?_0x234a30[_0x7454('0x1c')]['attributes']||null:null,'include':_0x234a30[_0x7454('0x1c')]?_0x234a30[_0x7454('0x1c')][_0x7454('0x20')]?_[_0x7454('0x23')](_0x234a30[_0x7454('0x1c')][_0x7454('0x20')],function(_0x2c2726){return{'model':db[_0x2c2726[_0x7454('0x21')]],'as':_0x2c2726['as'],'attributes':_0x2c2726[_0x7454('0x22')],'include':_0x2c2726[_0x7454('0x20')]?_[_0x7454('0x23')](_0x2c2726[_0x7454('0x20')],function(_0x5ef4fb){return{'model':db[_0x5ef4fb[_0x7454('0x21')]],'as':_0x5ef4fb['as'],'attributes':_0x5ef4fb[_0x7454('0x22')],'include':_0x5ef4fb[_0x7454('0x20')]?_[_0x7454('0x23')](_0x5ef4fb[_0x7454('0x20')],function(_0xb13d7d){return{'model':db[_0xb13d7d[_0x7454('0x21')]],'as':_0xb13d7d['as'],'attributes':_0xb13d7d[_0x7454('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7454('0x10')](function(_0x10cb2e){logger[_0x7454('0x11')](_0x7454('0x25'),_0x234a30);logger['debug']('ShowChatQueue',_0x234a30,JSON[_0x7454('0x14')](_0x10cb2e));_0x644efd(_0x10cb2e);})['catch'](function(_0x30aee1){logger['error'](_0x7454('0x25'),_0x30aee1['message'],_0x234a30);_0x4cfd57(_0x1031d8[_0x7454('0x15')](0x1f4,_0x30aee1['message']));});});}; \ No newline at end of file +var _0xcef7=['options','attributes','limit','include','map','model','GetChatQueue','debug','ShowChatQueue','raw','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','./chatQueue.socket','register','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','ChatQueue,\x20%s,\x20%s','error','message','catch','ChatQueue','findAll'];(function(_0x26521a,_0x24940f){var _0x17cea1=function(_0x43ea73){while(--_0x43ea73){_0x26521a['push'](_0x26521a['shift']());}};_0x17cea1(++_0x24940f);}(_0xcef7,0xe3));var _0x7cef=function(_0x1208f0,_0x1b0076){_0x1208f0=_0x1208f0-0x0;var _0x1d9d53=_0xcef7[_0x1208f0];return _0x1d9d53;};'use strict';var _=require('lodash');var util=require(_0x7cef('0x0'));var moment=require(_0x7cef('0x1'));var BPromise=require(_0x7cef('0x2'));var rs=require(_0x7cef('0x3'));var fs=require('fs');var Redis=require(_0x7cef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cef('0x5'));var logger=require(_0x7cef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7cef('0x7'));var client=jayson[_0x7cef('0x8')]['http']({'port':0x232a});config[_0x7cef('0x9')]=_['defaults'](config[_0x7cef('0x9')],{'host':_0x7cef('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7cef('0xb'))[_0x7cef('0xc')](socket);function respondWithRpcPromise(_0x159081,_0x13c07d,_0x2b8684){return new BPromise(function(_0x3d59f7,_0x2a14ae){return client['request'](_0x159081,_0x2b8684)[_0x7cef('0xd')](function(_0x4eb680){logger[_0x7cef('0xe')]('ChatQueue,\x20%s,\x20%s',_0x13c07d,_0x7cef('0xf'));logger['debug'](_0x7cef('0x10'),_0x13c07d,_0x7cef('0xf'),JSON[_0x7cef('0x11')](_0x4eb680));if(_0x4eb680['error']){if(_0x4eb680['error'][_0x7cef('0x12')]===0x1f4){logger['error'](_0x7cef('0x13'),_0x13c07d,_0x4eb680[_0x7cef('0x14')][_0x7cef('0x15')]);return _0x2a14ae(_0x4eb680[_0x7cef('0x14')]['message']);}logger[_0x7cef('0x14')]('ChatQueue,\x20%s,\x20%s',_0x13c07d,_0x4eb680['error'][_0x7cef('0x15')]);return _0x3d59f7(_0x4eb680[_0x7cef('0x14')][_0x7cef('0x15')]);}else{logger[_0x7cef('0xe')](_0x7cef('0x13'),_0x13c07d,_0x7cef('0xf'));_0x3d59f7(_0x4eb680['result'][_0x7cef('0x15')]);}})[_0x7cef('0x16')](function(_0x272786){logger['error'](_0x7cef('0x13'),_0x13c07d,_0x272786);_0x2a14ae(_0x272786);});});}exports['GetChatQueue']=function(_0x1dd354){var _0x45bc5d=this;return new Promise(function(_0x407800,_0x2ace22){return db[_0x7cef('0x17')][_0x7cef('0x18')]({'raw':_0x1dd354[_0x7cef('0x19')]?_0x1dd354['options']['raw']===undefined?!![]:![]:!![],'where':_0x1dd354[_0x7cef('0x19')]?_0x1dd354[_0x7cef('0x19')]['where']||null:null,'attributes':_0x1dd354['options']?_0x1dd354[_0x7cef('0x19')][_0x7cef('0x1a')]||null:null,'limit':_0x1dd354[_0x7cef('0x19')]?_0x1dd354[_0x7cef('0x19')][_0x7cef('0x1b')]||null:null,'include':_0x1dd354[_0x7cef('0x19')]?_0x1dd354[_0x7cef('0x19')][_0x7cef('0x1c')]?_[_0x7cef('0x1d')](_0x1dd354['options'][_0x7cef('0x1c')],function(_0x583f41){return{'model':db[_0x583f41['model']],'as':_0x583f41['as'],'attributes':_0x583f41[_0x7cef('0x1a')],'include':_0x583f41['include']?_[_0x7cef('0x1d')](_0x583f41['include'],function(_0x55c2b0){return{'model':db[_0x55c2b0[_0x7cef('0x1e')]],'as':_0x55c2b0['as'],'attributes':_0x55c2b0[_0x7cef('0x1a')],'include':_0x55c2b0['include']?_[_0x7cef('0x1d')](_0x55c2b0[_0x7cef('0x1c')],function(_0x2d0e4e){return{'model':db[_0x2d0e4e['model']],'as':_0x2d0e4e['as'],'attributes':_0x2d0e4e[_0x7cef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7cef('0xd')](function(_0x395f84){logger[_0x7cef('0xe')](_0x7cef('0x1f'),_0x1dd354);logger[_0x7cef('0x20')](_0x7cef('0x1f'),_0x1dd354,JSON[_0x7cef('0x11')](_0x395f84));_0x407800(_0x395f84);})[_0x7cef('0x16')](function(_0xa676fd){logger['error'](_0x7cef('0x1f'),_0xa676fd[_0x7cef('0x15')],_0x1dd354);_0x2ace22(_0x45bc5d[_0x7cef('0x14')](0x1f4,_0xa676fd[_0x7cef('0x15')]));});});};exports[_0x7cef('0x21')]=function(_0x49d4f9){var _0x4de20b=this;return new Promise(function(_0x4ad994,_0x2312ba){return db[_0x7cef('0x17')]['find']({'raw':_0x49d4f9[_0x7cef('0x19')]?_0x49d4f9[_0x7cef('0x19')][_0x7cef('0x22')]===undefined?!![]:![]:!![],'where':_0x49d4f9[_0x7cef('0x19')]?_0x49d4f9[_0x7cef('0x19')][_0x7cef('0x23')]||null:null,'attributes':_0x49d4f9['options']?_0x49d4f9[_0x7cef('0x19')]['attributes']||null:null,'include':_0x49d4f9[_0x7cef('0x19')]?_0x49d4f9['options'][_0x7cef('0x1c')]?_[_0x7cef('0x1d')](_0x49d4f9[_0x7cef('0x19')]['include'],function(_0x3a7893){return{'model':db[_0x3a7893['model']],'as':_0x3a7893['as'],'attributes':_0x3a7893[_0x7cef('0x1a')],'include':_0x3a7893['include']?_[_0x7cef('0x1d')](_0x3a7893[_0x7cef('0x1c')],function(_0x56811c){return{'model':db[_0x56811c[_0x7cef('0x1e')]],'as':_0x56811c['as'],'attributes':_0x56811c[_0x7cef('0x1a')],'include':_0x56811c[_0x7cef('0x1c')]?_[_0x7cef('0x1d')](_0x56811c[_0x7cef('0x1c')],function(_0x2e2596){return{'model':db[_0x2e2596['model']],'as':_0x2e2596['as'],'attributes':_0x2e2596['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf951ff){logger[_0x7cef('0xe')](_0x7cef('0x21'),_0x49d4f9);logger[_0x7cef('0x20')](_0x7cef('0x21'),_0x49d4f9,JSON['stringify'](_0xf951ff));_0x4ad994(_0xf951ff);})[_0x7cef('0x16')](function(_0x32217b){logger[_0x7cef('0x14')](_0x7cef('0x21'),_0x32217b[_0x7cef('0x15')],_0x49d4f9);_0x2312ba(_0x4de20b[_0x7cef('0x14')](0x1f4,_0x32217b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b11c590..f9fc9d8 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dbd6d,_0x3ee9d7){var _0x1216f1=function(_0x27b7ad){while(--_0x27b7ad){_0x3dbd6d['push'](_0x3dbd6d['shift']());}};_0x1216f1(++_0x3ee9d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x472da2,_0x5dd350){_0x472da2=_0x472da2-0x0;var _0x5bd564=_0x5f2f[_0x472da2];return _0x5bd564;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x59ea8b,_0x264cbb){var _0x58c49f=function(_0x34cd10){while(--_0x34cd10){_0x59ea8b['push'](_0x59ea8b['shift']());}};_0x58c49f(++_0x264cbb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 134d0ca..0291b7b 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 _0x201f=['../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','Router'];(function(_0x25d936,_0x4c6bfd){var _0x116348=function(_0x3fe97a){while(--_0x3fe97a){_0x25d936['push'](_0x25d936['shift']());}};_0x116348(++_0x4c6bfd);}(_0x201f,0x83));var _0xf201=function(_0x3499fa,_0x4121d7){_0x3499fa=_0x3499fa-0x0;var _0x6b6ff0=_0x201f[_0x3499fa];return _0x6b6ff0;};'use strict';var multer=require(_0xf201('0x0'));var util=require(_0xf201('0x1'));var path=require('path');var timeout=require(_0xf201('0x2'));var express=require('express');var router=express[_0xf201('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf201('0x4'));var config=require(_0xf201('0x5'));var controller=require(_0xf201('0x6'));router[_0xf201('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf201('0x7')]('/describe',auth[_0xf201('0x8')](),controller['describe']);router[_0xf201('0x7')](_0xf201('0x9'),auth[_0xf201('0x8')](),controller[_0xf201('0xa')]);router[_0xf201('0x7')]('/:id/members',auth[_0xf201('0x8')](),controller[_0xf201('0xb')]);router[_0xf201('0x7')](_0xf201('0xc'),auth['isAuthenticated'](),controller[_0xf201('0xd')]);router[_0xf201('0x7')]('/:id/users',auth[_0xf201('0x8')](),controller[_0xf201('0xe')]);router[_0xf201('0xf')]('/',auth[_0xf201('0x8')](),controller[_0xf201('0x10')]);router[_0xf201('0xf')](_0xf201('0xc'),auth[_0xf201('0x8')](),controller[_0xf201('0x11')]);router[_0xf201('0xf')]('/:id/users',auth[_0xf201('0x8')](),controller[_0xf201('0x12')]);router[_0xf201('0x13')]('/:id',auth[_0xf201('0x8')](),controller[_0xf201('0x14')]);router[_0xf201('0x15')](_0xf201('0x9'),auth['isAuthenticated'](),controller[_0xf201('0x16')]);router[_0xf201('0x15')]('/:id/teams',auth[_0xf201('0x8')](),controller[_0xf201('0x17')]);router[_0xf201('0x15')](_0xf201('0x18'),auth[_0xf201('0x8')](),controller[_0xf201('0x19')]);module[_0xf201('0x1a')]=router; \ No newline at end of file +var _0x57fe=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x57fe,0x1ce));var _0xe57f=function(_0x4d24d6,_0x185a28){_0x4d24d6=_0x4d24d6-0x0;var _0x4b9333=_0x57fe[_0x4d24d6];return _0x4b9333;};'use strict';var multer=require(_0xe57f('0x0'));var util=require(_0xe57f('0x1'));var path=require(_0xe57f('0x2'));var timeout=require(_0xe57f('0x3'));var express=require('express');var router=express[_0xe57f('0x4')]();var auth=require(_0xe57f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe57f('0x6'));var controller=require(_0xe57f('0x7'));router[_0xe57f('0x8')]('/',auth[_0xe57f('0x9')](),controller[_0xe57f('0xa')]);router[_0xe57f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe57f('0xb')]);router[_0xe57f('0x8')](_0xe57f('0xc'),auth[_0xe57f('0x9')](),controller[_0xe57f('0xd')]);router[_0xe57f('0x8')](_0xe57f('0xe'),auth[_0xe57f('0x9')](),controller[_0xe57f('0xf')]);router[_0xe57f('0x8')]('/:id/teams',auth[_0xe57f('0x9')](),controller[_0xe57f('0x10')]);router[_0xe57f('0x8')](_0xe57f('0x11'),auth[_0xe57f('0x9')](),controller[_0xe57f('0x12')]);router[_0xe57f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe57f('0x13')](_0xe57f('0x14'),auth[_0xe57f('0x9')](),controller[_0xe57f('0x15')]);router[_0xe57f('0x13')](_0xe57f('0x11'),auth[_0xe57f('0x9')](),controller[_0xe57f('0x16')]);router[_0xe57f('0x17')]('/:id',auth[_0xe57f('0x9')](),controller['update']);router[_0xe57f('0x18')](_0xe57f('0xc'),auth['isAuthenticated'](),controller[_0xe57f('0x19')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xe57f('0x1a')]);router[_0xe57f('0x18')]('/:id/users',auth[_0xe57f('0x9')](),controller[_0xe57f('0x1b')]);module[_0xe57f('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 e052792..cc16c2e 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 _0x206e=['STRING','DATE','moment','sequelize','exports'];(function(_0x59ab54,_0x45dab4){var _0x9a6a6e=function(_0x573750){while(--_0x573750){_0x59ab54['push'](_0x59ab54['shift']());}};_0x9a6a6e(++_0x45dab4);}(_0x206e,0x165));var _0xe206=function(_0x3f737b,_0x1d1f8b){_0x3f737b=_0x3f737b-0x0;var _0x404f7c=_0x206e[_0x3f737b];return _0x404f7c;};'use strict';var moment=require(_0xe206('0x0'));var Sequelize=require(_0xe206('0x1'));module[_0xe206('0x2')]={'uniqueid':{'type':Sequelize[_0xe206('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe206('0x3')]},'joinAt':{'type':Sequelize[_0xe206('0x4')]},'leaveAt':{'type':Sequelize[_0xe206('0x4')]},'acceptAt':{'type':Sequelize[_0xe206('0x4')]},'exitAt':{'type':Sequelize[_0xe206('0x4')]},'reason':{'type':Sequelize[_0xe206('0x3')]}}; \ No newline at end of file +var _0x5584=['STRING','DATE','sequelize','exports'];(function(_0x50e2b2,_0x151d7d){var _0x3410cd=function(_0x153d05){while(--_0x153d05){_0x50e2b2['push'](_0x50e2b2['shift']());}};_0x3410cd(++_0x151d7d);}(_0x5584,0x18e));var _0x4558=function(_0x5d611a,_0x28a9be){_0x5d611a=_0x5d611a-0x0;var _0x43c06f=_0x5584[_0x5d611a];return _0x43c06f;};'use strict';var moment=require('moment');var Sequelize=require(_0x4558('0x0'));module[_0x4558('0x1')]={'uniqueid':{'type':Sequelize[_0x4558('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4558('0x2')]},'joinAt':{'type':Sequelize[_0x4558('0x3')]},'leaveAt':{'type':Sequelize[_0x4558('0x3')]},'acceptAt':{'type':Sequelize[_0x4558('0x3')]},'exitAt':{'type':Sequelize[_0x4558('0x3')]},'reason':{'type':Sequelize[_0x4558('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 78a4100..aae2a76 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 _0xd7a1=['rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','ChatQueueReport','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x1b8df0,_0x55c8a1){var _0x3f7351=function(_0x155db9){while(--_0x155db9){_0x1b8df0['push'](_0x1b8df0['shift']());}};_0x3f7351(++_0x55c8a1);}(_0xd7a1,0x1ca));var _0x1d7a=function(_0x127c7a,_0x511c7d){_0x127c7a=_0x127c7a-0x0;var _0x52b0cd=_0xd7a1[_0x127c7a];return _0x52b0cd;};'use strict';var pdf=require(_0x1d7a('0x0'));var emlformat=require(_0x1d7a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d7a('0x2'));var rp=require(_0x1d7a('0x3'));var moment=require('moment');var BPromise=require(_0x1d7a('0x4'));var Mustache=require(_0x1d7a('0x5'));var util=require(_0x1d7a('0x6'));var path=require('path');var sox=require(_0x1d7a('0x7'));var csv=require(_0x1d7a('0x8'));var ejs=require(_0x1d7a('0x9'));var fs=require('fs');var _=require(_0x1d7a('0xa'));var squel=require(_0x1d7a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1d7a('0xc'));var toCsv=require(_0x1d7a('0x8'));var querystring=require('querystring');var Papa=require(_0x1d7a('0xd'));var Redis=require('ioredis');var authService=require(_0x1d7a('0xe'));var qs=require(_0x1d7a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7a('0x10'));var logger=require(_0x1d7a('0x11'))(_0x1d7a('0x12'));var utils=require(_0x1d7a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1d7a('0x14'))['db'];function respondWithStatusCode(_0x2bed40,_0x2a797d){_0x2a797d=_0x2a797d||0xcc;return function(_0x39fc56){if(_0x39fc56){return _0x2bed40['sendStatus'](_0x2a797d);}return _0x2bed40[_0x1d7a('0x15')](_0x2a797d)['end']();};}function respondWithResult(_0x3491b8,_0x26e58a){_0x26e58a=_0x26e58a||0xc8;return function(_0x21907c){if(_0x21907c){return _0x3491b8[_0x1d7a('0x15')](_0x26e58a)[_0x1d7a('0x16')](_0x21907c);}};}function respondWithFilteredResult(_0x598111,_0x31dcea){return function(_0x1f28a2){if(_0x1f28a2){var _0x6c42a7=_0x1f28a2[_0x1d7a('0x17')],_0x4fd3bf=_0x31dcea[_0x1d7a('0x18')],_0x45c020=_0x31dcea[_0x1d7a('0x18')]+_0x31dcea['limit'],_0x4b339f;if(_0x45c020>=_0x6c42a7){_0x45c020=_0x6c42a7;_0x4b339f=0xc8;}else{_0x4b339f=0xce;}_0x598111['status'](_0x4b339f);return _0x598111[_0x1d7a('0x19')](_0x1d7a('0x1a'),_0x4fd3bf+'-'+_0x45c020+'/'+_0x6c42a7)[_0x1d7a('0x16')](_0x1f28a2);}return null;};}function patchUpdates(_0x385d24){return function(_0x4d5ad7){try{jsonpatch[_0x1d7a('0x1b')](_0x4d5ad7,_0x385d24,!![]);}catch(_0x5af369){return BPromise[_0x1d7a('0x1c')](_0x5af369);}return _0x4d5ad7[_0x1d7a('0x1d')]();};}function saveUpdates(_0x357cc1,_0x47f39e){return function(_0x5af993){if(_0x5af993){return _0x5af993['update'](_0x357cc1)[_0x1d7a('0x1e')](function(_0x38b47a){return _0x38b47a;});}return null;};}function removeEntity(_0x2552a2,_0x56c2d6){return function(_0x460618){if(_0x460618){return _0x460618[_0x1d7a('0x1f')]()[_0x1d7a('0x1e')](function(){_0x2552a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x160b2b,_0x1fb9b9){return function(_0x39ee30){if(!_0x39ee30){_0x160b2b[_0x1d7a('0x20')](0x194);}return _0x39ee30;};}function handleError(_0x3f66f7,_0x9eb9ae){_0x9eb9ae=_0x9eb9ae||0x1f4;return function(_0x35cc8d){logger[_0x1d7a('0x21')](_0x35cc8d[_0x1d7a('0x22')]);if(_0x35cc8d[_0x1d7a('0x23')]){delete _0x35cc8d[_0x1d7a('0x23')];}_0x3f66f7[_0x1d7a('0x15')](_0x9eb9ae)[_0x1d7a('0x24')](_0x35cc8d);};}exports[_0x1d7a('0x25')]=function(_0x595e20,_0x5e4533){var _0x1d2eb4={},_0x3dfff5={},_0xd11647={'count':0x0,'rows':[]};var _0x49ea6b=_[_0x1d7a('0x26')](db['ChatQueueReport'][_0x1d7a('0x27')],function(_0x4debba){return{'name':_0x4debba[_0x1d7a('0x28')],'type':_0x4debba['type']['key']};});_0x3dfff5[_0x1d7a('0x29')]=_[_0x1d7a('0x26')](_0x49ea6b,_0x1d7a('0x23'));_0x3dfff5[_0x1d7a('0x2a')]=_[_0x1d7a('0x2b')](_0x595e20[_0x1d7a('0x2a')]);_0x3dfff5[_0x1d7a('0x2c')]=_[_0x1d7a('0x2d')](_0x3dfff5[_0x1d7a('0x29')],_0x3dfff5['query']);_0x1d2eb4[_0x1d7a('0x2e')]=_['intersection'](_0x3dfff5[_0x1d7a('0x29')],qs[_0x1d7a('0x2f')](_0x595e20['query'][_0x1d7a('0x2f')]));_0x1d2eb4[_0x1d7a('0x2e')]=_0x1d2eb4[_0x1d7a('0x2e')]['length']?_0x1d2eb4[_0x1d7a('0x2e')]:_0x3dfff5[_0x1d7a('0x29')];if(!_0x595e20['query'][_0x1d7a('0x30')](_0x1d7a('0x31'))){_0x1d2eb4['limit']=qs['limit'](_0x595e20[_0x1d7a('0x2a')][_0x1d7a('0x32')]);_0x1d2eb4[_0x1d7a('0x18')]=qs[_0x1d7a('0x18')](_0x595e20[_0x1d7a('0x2a')]['offset']);}_0x1d2eb4[_0x1d7a('0x33')]=qs[_0x1d7a('0x34')](_0x595e20['query'][_0x1d7a('0x34')]);_0x1d2eb4[_0x1d7a('0x35')]=qs['filters'](_[_0x1d7a('0x36')](_0x595e20['query'],_0x3dfff5[_0x1d7a('0x2c')]),_0x49ea6b);if(_0x595e20[_0x1d7a('0x2a')][_0x1d7a('0x37')]){_0x1d2eb4[_0x1d7a('0x35')]=_[_0x1d7a('0x38')](_0x1d2eb4['where'],{'$or':_[_0x1d7a('0x26')](_0x49ea6b,function(_0x5a7502){if(_0x5a7502[_0x1d7a('0x39')]!=='VIRTUAL'){var _0x20da2d={};_0x20da2d[_0x5a7502[_0x1d7a('0x23')]]={'$like':'%'+_0x595e20[_0x1d7a('0x2a')][_0x1d7a('0x37')]+'%'};return _0x20da2d;}})});}_0x1d2eb4=_[_0x1d7a('0x38')]({},_0x1d2eb4,_0x595e20[_0x1d7a('0x3a')]);var _0x13f14c={'where':_0x1d2eb4[_0x1d7a('0x35')]};return db[_0x1d7a('0x3b')][_0x1d7a('0x17')](_0x13f14c)[_0x1d7a('0x1e')](function(_0x4a21b8){_0xd11647[_0x1d7a('0x17')]=_0x4a21b8;if(_0x595e20[_0x1d7a('0x2a')][_0x1d7a('0x3c')]){_0x1d2eb4[_0x1d7a('0x3d')]=[{'all':!![]}];}return db[_0x1d7a('0x3b')][_0x1d7a('0x3e')](_0x1d2eb4);})[_0x1d7a('0x1e')](function(_0x19a91c){_0xd11647['rows']=_0x19a91c;return _0xd11647;})[_0x1d7a('0x1e')](respondWithFilteredResult(_0x5e4533,_0x1d2eb4))[_0x1d7a('0x3f')](handleError(_0x5e4533,null));};exports[_0x1d7a('0x40')]=function(_0x1db82e,_0x5da97f){var _0x5f25a6={'raw':!![],'where':{'id':_0x1db82e[_0x1d7a('0x41')]['id']}},_0x56782d={};_0x56782d[_0x1d7a('0x29')]=_[_0x1d7a('0x2b')](db[_0x1d7a('0x3b')][_0x1d7a('0x27')]);_0x56782d[_0x1d7a('0x2a')]=_[_0x1d7a('0x2b')](_0x1db82e[_0x1d7a('0x2a')]);_0x56782d[_0x1d7a('0x2c')]=_[_0x1d7a('0x2d')](_0x56782d[_0x1d7a('0x29')],_0x56782d[_0x1d7a('0x2a')]);_0x5f25a6[_0x1d7a('0x2e')]=_['intersection'](_0x56782d[_0x1d7a('0x29')],qs['fields'](_0x1db82e['query'][_0x1d7a('0x2f')]));_0x5f25a6[_0x1d7a('0x2e')]=_0x5f25a6[_0x1d7a('0x2e')][_0x1d7a('0x42')]?_0x5f25a6[_0x1d7a('0x2e')]:_0x56782d[_0x1d7a('0x29')];if(_0x1db82e['query']['includeAll']){_0x5f25a6[_0x1d7a('0x3d')]=[{'all':!![]}];}_0x5f25a6=_[_0x1d7a('0x38')]({},_0x5f25a6,_0x1db82e[_0x1d7a('0x3a')]);return db[_0x1d7a('0x3b')][_0x1d7a('0x43')](_0x5f25a6)[_0x1d7a('0x1e')](handleEntityNotFound(_0x5da97f,null))[_0x1d7a('0x1e')](respondWithResult(_0x5da97f,null))['catch'](handleError(_0x5da97f,null));};exports[_0x1d7a('0x44')]=function(_0x1609b2,_0x1622ac){return db['ChatQueueReport'][_0x1d7a('0x44')](_0x1609b2[_0x1d7a('0x45')],{})[_0x1d7a('0x1e')](respondWithResult(_0x1622ac,0xc9))['catch'](handleError(_0x1622ac,null));};exports['update']=function(_0x464b2d,_0x422555){if(_0x464b2d['body']['id']){delete _0x464b2d[_0x1d7a('0x45')]['id'];}return db['ChatQueueReport'][_0x1d7a('0x43')]({'where':{'id':_0x464b2d[_0x1d7a('0x41')]['id']}})[_0x1d7a('0x1e')](handleEntityNotFound(_0x422555,null))[_0x1d7a('0x1e')](saveUpdates(_0x464b2d[_0x1d7a('0x45')],null))[_0x1d7a('0x1e')](respondWithResult(_0x422555,null))[_0x1d7a('0x3f')](handleError(_0x422555,null));};exports[_0x1d7a('0x1f')]=function(_0x5e2e17,_0xe2e2e){return db[_0x1d7a('0x3b')][_0x1d7a('0x43')]({'where':{'id':_0x5e2e17[_0x1d7a('0x41')]['id']}})[_0x1d7a('0x1e')](handleEntityNotFound(_0xe2e2e,null))['then'](removeEntity(_0xe2e2e,null))['catch'](handleError(_0xe2e2e,null));};exports[_0x1d7a('0x46')]=function(_0x5dae32,_0x4ba720){return db['ChatQueueReport'][_0x1d7a('0x46')]()['then'](respondWithResult(_0x4ba720,null))[_0x1d7a('0x3f')](handleError(_0x4ba720,null));}; \ No newline at end of file +var _0x534d=['rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','html-pdf','rimraf','zip-dir','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','ChatQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','findAll'];(function(_0x40dadc,_0x5c117d){var _0x3bf755=function(_0x4ff2eb){while(--_0x4ff2eb){_0x40dadc['push'](_0x40dadc['shift']());}};_0x3bf755(++_0x5c117d);}(_0x534d,0x1cc));var _0xd534=function(_0x535d43,_0x45ff60){_0x535d43=_0x535d43-0x0;var _0x7c20f0=_0x534d[_0x535d43];return _0x7c20f0;};'use strict';var pdf=require(_0xd534('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd534('0x1'));var zipdir=require(_0xd534('0x2'));var jsonpatch=require(_0xd534('0x3'));var rp=require(_0xd534('0x4'));var moment=require('moment');var BPromise=require(_0xd534('0x5'));var Mustache=require(_0xd534('0x6'));var util=require(_0xd534('0x7'));var path=require(_0xd534('0x8'));var sox=require(_0xd534('0x9'));var csv=require(_0xd534('0xa'));var ejs=require(_0xd534('0xb'));var fs=require('fs');var _=require(_0xd534('0xc'));var squel=require(_0xd534('0xd'));var crypto=require(_0xd534('0xe'));var jsforce=require(_0xd534('0xf'));var deskjs=require(_0xd534('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd534('0x11'));var Papa=require('papaparse');var Redis=require(_0xd534('0x12'));var authService=require(_0xd534('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd534('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd534('0x15'))('api');var utils=require(_0xd534('0x16'));var config=require(_0xd534('0x17'));var licenseUtil=require(_0xd534('0x18'));var db=require(_0xd534('0x19'))['db'];function respondWithStatusCode(_0x323400,_0x43f54e){_0x43f54e=_0x43f54e||0xcc;return function(_0x3b4778){if(_0x3b4778){return _0x323400[_0xd534('0x1a')](_0x43f54e);}return _0x323400[_0xd534('0x1b')](_0x43f54e)[_0xd534('0x1c')]();};}function respondWithResult(_0x534cca,_0x56a9c9){_0x56a9c9=_0x56a9c9||0xc8;return function(_0x534935){if(_0x534935){return _0x534cca[_0xd534('0x1b')](_0x56a9c9)[_0xd534('0x1d')](_0x534935);}};}function respondWithFilteredResult(_0x2a5196,_0x457a32){return function(_0x466726){if(_0x466726){var _0x4167d9=_0x466726[_0xd534('0x1e')],_0x1c0b2a=_0x457a32['offset'],_0x121013=_0x457a32[_0xd534('0x1f')]+_0x457a32[_0xd534('0x20')],_0x75a6be;if(_0x121013>=_0x4167d9){_0x121013=_0x4167d9;_0x75a6be=0xc8;}else{_0x75a6be=0xce;}_0x2a5196[_0xd534('0x1b')](_0x75a6be);return _0x2a5196[_0xd534('0x21')](_0xd534('0x22'),_0x1c0b2a+'-'+_0x121013+'/'+_0x4167d9)[_0xd534('0x1d')](_0x466726);}return null;};}function patchUpdates(_0x5ca591){return function(_0x5c2e62){try{jsonpatch[_0xd534('0x23')](_0x5c2e62,_0x5ca591,!![]);}catch(_0x3a010c){return BPromise[_0xd534('0x24')](_0x3a010c);}return _0x5c2e62[_0xd534('0x25')]();};}function saveUpdates(_0x2c7e44,_0x35d960){return function(_0x3492e8){if(_0x3492e8){return _0x3492e8[_0xd534('0x26')](_0x2c7e44)[_0xd534('0x27')](function(_0x121d16){return _0x121d16;});}return null;};}function removeEntity(_0x2fa645,_0x914906){return function(_0x5f0bcc){if(_0x5f0bcc){return _0x5f0bcc['destroy']()[_0xd534('0x27')](function(){_0x2fa645['status'](0xcc)[_0xd534('0x1c')]();});}};}function handleEntityNotFound(_0xc624d9,_0x4fe550){return function(_0x4932b6){if(!_0x4932b6){_0xc624d9[_0xd534('0x1a')](0x194);}return _0x4932b6;};}function handleError(_0x12e8c4,_0x39069f){_0x39069f=_0x39069f||0x1f4;return function(_0x1ce564){logger['error'](_0x1ce564[_0xd534('0x28')]);if(_0x1ce564[_0xd534('0x29')]){delete _0x1ce564[_0xd534('0x29')];}_0x12e8c4['status'](_0x39069f)['send'](_0x1ce564);};}exports[_0xd534('0x2a')]=function(_0x479545,_0x9804c1){var _0xd500e3={},_0x300f51={},_0x466897={'count':0x0,'rows':[]};var _0x522a1c=_['map'](db[_0xd534('0x2b')]['rawAttributes'],function(_0x42ab39){return{'name':_0x42ab39[_0xd534('0x2c')],'type':_0x42ab39['type'][_0xd534('0x2d')]};});_0x300f51[_0xd534('0x2e')]=_['map'](_0x522a1c,'name');_0x300f51[_0xd534('0x2f')]=_[_0xd534('0x30')](_0x479545[_0xd534('0x2f')]);_0x300f51[_0xd534('0x31')]=_[_0xd534('0x32')](_0x300f51[_0xd534('0x2e')],_0x300f51['query']);_0xd500e3[_0xd534('0x33')]=_[_0xd534('0x32')](_0x300f51[_0xd534('0x2e')],qs['fields'](_0x479545[_0xd534('0x2f')][_0xd534('0x34')]));_0xd500e3[_0xd534('0x33')]=_0xd500e3[_0xd534('0x33')][_0xd534('0x35')]?_0xd500e3[_0xd534('0x33')]:_0x300f51[_0xd534('0x2e')];if(!_0x479545[_0xd534('0x2f')]['hasOwnProperty'](_0xd534('0x36'))){_0xd500e3[_0xd534('0x20')]=qs[_0xd534('0x20')](_0x479545[_0xd534('0x2f')][_0xd534('0x20')]);_0xd500e3['offset']=qs['offset'](_0x479545[_0xd534('0x2f')][_0xd534('0x1f')]);}_0xd500e3[_0xd534('0x37')]=qs[_0xd534('0x38')](_0x479545[_0xd534('0x2f')][_0xd534('0x38')]);_0xd500e3[_0xd534('0x39')]=qs[_0xd534('0x31')](_['pick'](_0x479545[_0xd534('0x2f')],_0x300f51['filters']),_0x522a1c);if(_0x479545[_0xd534('0x2f')][_0xd534('0x3a')]){_0xd500e3[_0xd534('0x39')]=_[_0xd534('0x3b')](_0xd500e3[_0xd534('0x39')],{'$or':_[_0xd534('0x3c')](_0x522a1c,function(_0x55cba5){if(_0x55cba5[_0xd534('0x3d')]!==_0xd534('0x3e')){var _0x406e8c={};_0x406e8c[_0x55cba5[_0xd534('0x29')]]={'$like':'%'+_0x479545[_0xd534('0x2f')][_0xd534('0x3a')]+'%'};return _0x406e8c;}})});}_0xd500e3=_[_0xd534('0x3b')]({},_0xd500e3,_0x479545[_0xd534('0x3f')]);var _0x2ad716={'where':_0xd500e3[_0xd534('0x39')]};return db[_0xd534('0x2b')]['count'](_0x2ad716)[_0xd534('0x27')](function(_0x4177bc){_0x466897[_0xd534('0x1e')]=_0x4177bc;if(_0x479545[_0xd534('0x2f')]['includeAll']){_0xd500e3['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xd534('0x40')](_0xd500e3);})[_0xd534('0x27')](function(_0x37310a){_0x466897[_0xd534('0x41')]=_0x37310a;return _0x466897;})[_0xd534('0x27')](respondWithFilteredResult(_0x9804c1,_0xd500e3))[_0xd534('0x42')](handleError(_0x9804c1,null));};exports[_0xd534('0x43')]=function(_0xf22db,_0x805c1e){var _0x3571ea={'raw':!![],'where':{'id':_0xf22db[_0xd534('0x44')]['id']}},_0x32045a={};_0x32045a['model']=_[_0xd534('0x30')](db[_0xd534('0x2b')][_0xd534('0x45')]);_0x32045a[_0xd534('0x2f')]=_['keys'](_0xf22db['query']);_0x32045a['filters']=_[_0xd534('0x32')](_0x32045a['model'],_0x32045a[_0xd534('0x2f')]);_0x3571ea[_0xd534('0x33')]=_[_0xd534('0x32')](_0x32045a[_0xd534('0x2e')],qs[_0xd534('0x34')](_0xf22db[_0xd534('0x2f')][_0xd534('0x34')]));_0x3571ea[_0xd534('0x33')]=_0x3571ea[_0xd534('0x33')][_0xd534('0x35')]?_0x3571ea[_0xd534('0x33')]:_0x32045a[_0xd534('0x2e')];if(_0xf22db[_0xd534('0x2f')][_0xd534('0x46')]){_0x3571ea['include']=[{'all':!![]}];}_0x3571ea=_[_0xd534('0x3b')]({},_0x3571ea,_0xf22db[_0xd534('0x3f')]);return db['ChatQueueReport'][_0xd534('0x47')](_0x3571ea)[_0xd534('0x27')](handleEntityNotFound(_0x805c1e,null))[_0xd534('0x27')](respondWithResult(_0x805c1e,null))[_0xd534('0x42')](handleError(_0x805c1e,null));};exports[_0xd534('0x48')]=function(_0x5b3f78,_0x36b8ff){return db[_0xd534('0x2b')][_0xd534('0x48')](_0x5b3f78[_0xd534('0x49')],{})['then'](respondWithResult(_0x36b8ff,0xc9))['catch'](handleError(_0x36b8ff,null));};exports[_0xd534('0x26')]=function(_0x35de19,_0x26ae8f){if(_0x35de19[_0xd534('0x49')]['id']){delete _0x35de19[_0xd534('0x49')]['id'];}return db[_0xd534('0x2b')][_0xd534('0x47')]({'where':{'id':_0x35de19[_0xd534('0x44')]['id']}})[_0xd534('0x27')](handleEntityNotFound(_0x26ae8f,null))['then'](saveUpdates(_0x35de19['body'],null))[_0xd534('0x27')](respondWithResult(_0x26ae8f,null))[_0xd534('0x42')](handleError(_0x26ae8f,null));};exports['destroy']=function(_0x40a936,_0x58292b){return db[_0xd534('0x2b')][_0xd534('0x47')]({'where':{'id':_0x40a936[_0xd534('0x44')]['id']}})[_0xd534('0x27')](handleEntityNotFound(_0x58292b,null))[_0xd534('0x27')](removeEntity(_0x58292b,null))['catch'](handleError(_0x58292b,null));};exports[_0xd534('0x4a')]=function(_0xe9c1a2,_0x2e8099){return db['ChatQueueReport'][_0xd534('0x4a')]()[_0xd534('0x27')](respondWithResult(_0x2e8099,null))[_0xd534('0x42')](handleError(_0x2e8099,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 4474af0..4d1fc3e 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 _0x7068=['lodash','../../config/logger','api','moment','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue'];(function(_0x223b22,_0x421271){var _0xb647e6=function(_0x587a64){while(--_0x587a64){_0x223b22['push'](_0x223b22['shift']());}};_0xb647e6(++_0x421271);}(_0x7068,0xd8));var _0x8706=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x7068[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require(_0x8706('0x0'));var util=require('util');var logger=require(_0x8706('0x1'))(_0x8706('0x2'));var moment=require(_0x8706('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8706('0x4'));var attributes=require(_0x8706('0x5'));module['exports']=function(_0x25796a,_0x41be2){return _0x25796a[_0x8706('0x6')](_0x8706('0x7'),attributes,{'tableName':_0x8706('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x47d5=['report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport'];(function(_0xe70446,_0x566bfe){var _0x293a16=function(_0x4c0cdf){while(--_0x4c0cdf){_0xe70446['push'](_0xe70446['shift']());}};_0x293a16(++_0x566bfe);}(_0x47d5,0x80));var _0x547d=function(_0x29b3f6,_0x1bd904){_0x29b3f6=_0x29b3f6-0x0;var _0x321943=_0x47d5[_0x29b3f6];return _0x321943;};'use strict';var _=require('lodash');var util=require(_0x547d('0x0'));var logger=require(_0x547d('0x1'))(_0x547d('0x2'));var moment=require(_0x547d('0x3'));var BPromise=require(_0x547d('0x4'));var rp=require(_0x547d('0x5'));var fs=require('fs');var path=require(_0x547d('0x6'));var rimraf=require('rimraf');var config=require(_0x547d('0x7'));var attributes=require(_0x547d('0x8'));module[_0x547d('0x9')]=function(_0x587a29,_0x4d784d){return _0x587a29[_0x547d('0xa')](_0x547d('0xb'),attributes,{'tableName':_0x547d('0xc'),'paranoid':![],'indexes':[{'name':_0x547d('0xd'),'fields':[_0x547d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4e3996f..4a08fa6 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 _0xa060=['CreateChatQueueReport','ChatQueueReport','create','body','options','then','debug','stringify','update','raw','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3fd069,_0x9d8869){var _0x51c2b3=function(_0x230acb){while(--_0x230acb){_0x3fd069['push'](_0x3fd069['shift']());}};_0x51c2b3(++_0x9d8869);}(_0xa060,0x156));var _0x0a06=function(_0x1a597b,_0x4cfae5){_0x1a597b=_0x1a597b-0x0;var _0x4ff884=_0xa060[_0x1a597b];return _0x4ff884;};'use strict';var _=require(_0x0a06('0x0'));var util=require(_0x0a06('0x1'));var moment=require(_0x0a06('0x2'));var BPromise=require(_0x0a06('0x3'));var rs=require(_0x0a06('0x4'));var fs=require('fs');var Redis=require(_0x0a06('0x5'));var db=require(_0x0a06('0x6'))['db'];var utils=require(_0x0a06('0x7'));var logger=require(_0x0a06('0x8'))(_0x0a06('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a06('0xa')][_0x0a06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b209e,_0x11ed9c,_0x4575cc){return new BPromise(function(_0x11bbcc,_0x2c8eec){return client['request'](_0x2b209e,_0x4575cc)['then'](function(_0x5cb742){logger[_0x0a06('0xc')](_0x0a06('0xd'),_0x11ed9c,_0x0a06('0xe'));logger['debug'](_0x0a06('0xf'),_0x11ed9c,'request\x20sent',JSON['stringify'](_0x5cb742));if(_0x5cb742[_0x0a06('0x10')]){if(_0x5cb742[_0x0a06('0x10')][_0x0a06('0x11')]===0x1f4){logger[_0x0a06('0x10')](_0x0a06('0xd'),_0x11ed9c,_0x5cb742[_0x0a06('0x10')]['message']);return _0x2c8eec(_0x5cb742[_0x0a06('0x10')][_0x0a06('0x12')]);}logger[_0x0a06('0x10')](_0x0a06('0xd'),_0x11ed9c,_0x5cb742[_0x0a06('0x10')]['message']);return _0x11bbcc(_0x5cb742['error'][_0x0a06('0x12')]);}else{logger[_0x0a06('0xc')](_0x0a06('0xd'),_0x11ed9c,_0x0a06('0xe'));_0x11bbcc(_0x5cb742[_0x0a06('0x13')]['message']);}})[_0x0a06('0x14')](function(_0x563ee5){logger[_0x0a06('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x11ed9c,_0x563ee5);_0x2c8eec(_0x563ee5);});});}exports[_0x0a06('0x15')]=function(_0x3876c0){var _0x13bdb7=this;return new Promise(function(_0xd431e2,_0x7c0192){return db[_0x0a06('0x16')][_0x0a06('0x17')](_0x3876c0[_0x0a06('0x18')],{'raw':_0x3876c0[_0x0a06('0x19')]?_0x3876c0[_0x0a06('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0a06('0x1a')](function(_0x7f4c9){logger[_0x0a06('0xc')](_0x0a06('0x15'),_0x3876c0);logger[_0x0a06('0x1b')](_0x0a06('0x15'),_0x3876c0,JSON[_0x0a06('0x1c')](_0x7f4c9));_0xd431e2(_0x7f4c9);})[_0x0a06('0x14')](function(_0x48d95e){logger['error'](_0x0a06('0x15'),_0x48d95e[_0x0a06('0x12')],_0x3876c0);_0x7c0192(_0x13bdb7[_0x0a06('0x10')](0x1f4,_0x48d95e[_0x0a06('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x4642a0){var _0x3fbd3b=this;return new Promise(function(_0x2c4a0b,_0x4bf3a8){return db[_0x0a06('0x16')][_0x0a06('0x1d')](_0x4642a0[_0x0a06('0x18')],{'raw':_0x4642a0[_0x0a06('0x19')]?_0x4642a0['options'][_0x0a06('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4642a0['options']?_0x4642a0[_0x0a06('0x19')]['where']||null:null,'attributes':_0x4642a0[_0x0a06('0x19')]?_0x4642a0[_0x0a06('0x19')]['attributes']||null:null,'limit':_0x4642a0[_0x0a06('0x19')]?_0x4642a0[_0x0a06('0x19')][_0x0a06('0x1f')]||null:null})['then'](function(_0xac8a72){logger[_0x0a06('0xc')](_0x0a06('0x20'),_0x4642a0);logger[_0x0a06('0x1b')](_0x0a06('0x20'),_0x4642a0,JSON[_0x0a06('0x1c')](_0xac8a72));_0x2c4a0b(_0xac8a72);})[_0x0a06('0x14')](function(_0x324f14){logger['error'](_0x0a06('0x20'),_0x324f14[_0x0a06('0x12')],_0x4642a0);_0x4bf3a8(_0x3fbd3b[_0x0a06('0x10')](0x1f4,_0x324f14[_0x0a06('0x12')]));});});}; \ No newline at end of file +var _0xd7a7=['UpdateChatQueueReport','ChatQueueReport','update','raw','where','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','body','options','debug'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd7a7,0x1b9));var _0x7d7a=function(_0x1d8f75,_0x1f4aad){_0x1d8f75=_0x1d8f75-0x0;var _0x358af2=_0xd7a7[_0x1d8f75];return _0x358af2;};'use strict';var _=require('lodash');var util=require(_0x7d7a('0x0'));var moment=require(_0x7d7a('0x1'));var BPromise=require(_0x7d7a('0x2'));var rs=require(_0x7d7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d7a('0x4'))['db'];var utils=require(_0x7d7a('0x5'));var logger=require('../../config/logger')(_0x7d7a('0x6'));var config=require(_0x7d7a('0x7'));var jayson=require(_0x7d7a('0x8'));var client=jayson[_0x7d7a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b1df,_0x169a73,_0x1e0bdd){return new BPromise(function(_0x1cebbe,_0x4bf3ea){return client['request'](_0x32b1df,_0x1e0bdd)[_0x7d7a('0xa')](function(_0x4ec69b){logger[_0x7d7a('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x169a73,_0x7d7a('0xc'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x169a73,_0x7d7a('0xc'),JSON[_0x7d7a('0xd')](_0x4ec69b));if(_0x4ec69b[_0x7d7a('0xe')]){if(_0x4ec69b[_0x7d7a('0xe')][_0x7d7a('0xf')]===0x1f4){logger[_0x7d7a('0xe')](_0x7d7a('0x10'),_0x169a73,_0x4ec69b[_0x7d7a('0xe')][_0x7d7a('0x11')]);return _0x4bf3ea(_0x4ec69b['error'][_0x7d7a('0x11')]);}logger[_0x7d7a('0xe')](_0x7d7a('0x10'),_0x169a73,_0x4ec69b[_0x7d7a('0xe')]['message']);return _0x1cebbe(_0x4ec69b[_0x7d7a('0xe')][_0x7d7a('0x11')]);}else{logger[_0x7d7a('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x169a73,_0x7d7a('0xc'));_0x1cebbe(_0x4ec69b['result'][_0x7d7a('0x11')]);}})[_0x7d7a('0x12')](function(_0x25dd6f){logger[_0x7d7a('0xe')](_0x7d7a('0x10'),_0x169a73,_0x25dd6f);_0x4bf3ea(_0x25dd6f);});});}exports[_0x7d7a('0x13')]=function(_0x4befb4){var _0x1f996f=this;return new Promise(function(_0x109c74,_0x3edd15){return db['ChatQueueReport']['create'](_0x4befb4[_0x7d7a('0x14')],{'raw':_0x4befb4['options']?_0x4befb4[_0x7d7a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7d7a('0xa')](function(_0xd66de2){logger[_0x7d7a('0xb')](_0x7d7a('0x13'),_0x4befb4);logger[_0x7d7a('0x16')](_0x7d7a('0x13'),_0x4befb4,JSON[_0x7d7a('0xd')](_0xd66de2));_0x109c74(_0xd66de2);})[_0x7d7a('0x12')](function(_0x1b7bc9){logger[_0x7d7a('0xe')](_0x7d7a('0x13'),_0x1b7bc9[_0x7d7a('0x11')],_0x4befb4);_0x3edd15(_0x1f996f[_0x7d7a('0xe')](0x1f4,_0x1b7bc9['message']));});});};exports[_0x7d7a('0x17')]=function(_0x355a21){var _0x25b304=this;return new Promise(function(_0x11f303,_0x87d3d3){return db[_0x7d7a('0x18')][_0x7d7a('0x19')](_0x355a21[_0x7d7a('0x14')],{'raw':_0x355a21[_0x7d7a('0x15')]?_0x355a21['options'][_0x7d7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355a21[_0x7d7a('0x15')]?_0x355a21[_0x7d7a('0x15')][_0x7d7a('0x1b')]||null:null,'attributes':_0x355a21[_0x7d7a('0x15')]?_0x355a21['options'][_0x7d7a('0x1c')]||null:null,'limit':_0x355a21[_0x7d7a('0x15')]?_0x355a21[_0x7d7a('0x15')]['limit']||null:null})[_0x7d7a('0xa')](function(_0x46527a){logger[_0x7d7a('0xb')](_0x7d7a('0x17'),_0x355a21);logger[_0x7d7a('0x16')](_0x7d7a('0x17'),_0x355a21,JSON[_0x7d7a('0xd')](_0x46527a));_0x11f303(_0x46527a);})[_0x7d7a('0x12')](function(_0x50cfc3){logger[_0x7d7a('0xe')](_0x7d7a('0x17'),_0x50cfc3[_0x7d7a('0x11')],_0x355a21);_0x87d3d3(_0x25b304[_0x7d7a('0xe')](0x1f4,_0x50cfc3[_0x7d7a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b5f5202..e4e2a53 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 _0x1f8e=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1f8e,0x18d));var _0xe1f8=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x1f8e[_0x359bbe];return _0x1b3353;};'use strict';var multer=require(_0xe1f8('0x0'));var util=require(_0xe1f8('0x1'));var path=require(_0xe1f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe1f8('0x3')]();var auth=require(_0xe1f8('0x4'));var interaction=require(_0xe1f8('0x5'));var config=require(_0xe1f8('0x6'));var controller=require(_0xe1f8('0x7'));router[_0xe1f8('0x8')]('/',auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xa')]);router['get']('/describe',auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xb')]);router[_0xe1f8('0x8')](_0xe1f8('0xc'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xd')]);router[_0xe1f8('0xe')]('/',auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xf')]);router['put'](_0xe1f8('0xc'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0x10')]);router[_0xe1f8('0x11')](_0xe1f8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe1f8('0x12')]=router; \ No newline at end of file +var _0xc00a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2a9436,_0x42d66e){var _0x2955f9=function(_0x244a7c){while(--_0x244a7c){_0x2a9436['push'](_0x2a9436['shift']());}};_0x2955f9(++_0x42d66e);}(_0xc00a,0x19f));var _0xac00=function(_0x15f972,_0x4a1fc7){_0x15f972=_0x15f972-0x0;var _0x3d916e=_0xc00a[_0x15f972];return _0x3d916e;};'use strict';var multer=require(_0xac00('0x0'));var util=require(_0xac00('0x1'));var path=require(_0xac00('0x2'));var timeout=require(_0xac00('0x3'));var express=require('express');var router=express[_0xac00('0x4')]();var auth=require(_0xac00('0x5'));var interaction=require(_0xac00('0x6'));var config=require(_0xac00('0x7'));var controller=require(_0xac00('0x8'));router[_0xac00('0x9')]('/',auth[_0xac00('0xa')](),controller[_0xac00('0xb')]);router[_0xac00('0x9')](_0xac00('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xac00('0x9')](_0xac00('0xd'),auth[_0xac00('0xa')](),controller[_0xac00('0xe')]);router[_0xac00('0xf')]('/',auth['isAuthenticated'](),controller[_0xac00('0x10')]);router['put']('/:id',auth[_0xac00('0xa')](),controller[_0xac00('0x11')]);router[_0xac00('0x12')]('/:id',auth[_0xac00('0xa')](),controller[_0xac00('0x13')]);module[_0xac00('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index db1e11b..80afa1c 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 _0x52e4=['queue','DATE','moment','ENUM','account'];(function(_0x3794c6,_0x379aa5){var _0x22875a=function(_0x495127){while(--_0x495127){_0x3794c6['push'](_0x3794c6['shift']());}};_0x22875a(++_0x379aa5);}(_0x52e4,0x197));var _0x452e=function(_0x1041c3,_0x39042d){_0x1041c3=_0x1041c3-0x0;var _0x47dd02=_0x52e4[_0x1041c3];return _0x47dd02;};'use strict';var moment=require(_0x452e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x452e('0x1')](_0x452e('0x2'),'agent',_0x452e('0x3')),'allowNull':![],'defaultValue':_0x452e('0x3')},'transferredAt':{'type':Sequelize[_0x452e('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x23db=['queue','NOW','moment','sequelize','exports','STRING','ENUM','agent'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x23db,0x1e2));var _0xb23d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x23db[_0xefd519];return _0x4bb882;};'use strict';var moment=require(_0xb23d('0x0'));var Sequelize=require(_0xb23d('0x1'));module[_0xb23d('0x2')]={'uniqueid':{'type':Sequelize[_0xb23d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb23d('0x4')]('account',_0xb23d('0x5'),_0xb23d('0x6')),'allowNull':![],'defaultValue':_0xb23d('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb23d('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9ce2a42..bccbf45 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 _0xdb70=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','error','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','model','query'];(function(_0x43d952,_0x453ec9){var _0x1c53b5=function(_0x46a1f0){while(--_0x46a1f0){_0x43d952['push'](_0x43d952['shift']());}};_0x1c53b5(++_0x453ec9);}(_0xdb70,0x138));var _0x0db7=function(_0x1dd581,_0x4c3820){_0x1dd581=_0x1dd581-0x0;var _0x1f5e30=_0xdb70[_0x1dd581];return _0x1f5e30;};'use strict';var pdf=require(_0x0db7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0db7('0x1'));var zipdir=require(_0x0db7('0x2'));var jsonpatch=require(_0x0db7('0x3'));var rp=require(_0x0db7('0x4'));var moment=require('moment');var BPromise=require(_0x0db7('0x5'));var Mustache=require(_0x0db7('0x6'));var util=require(_0x0db7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0db7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0db7('0x9'));var squel=require(_0x0db7('0xa'));var crypto=require(_0x0db7('0xb'));var jsforce=require(_0x0db7('0xc'));var deskjs=require(_0x0db7('0xd'));var toCsv=require(_0x0db7('0x8'));var querystring=require(_0x0db7('0xe'));var Papa=require(_0x0db7('0xf'));var Redis=require('ioredis');var authService=require(_0x0db7('0x10'));var qs=require(_0x0db7('0x11'));var as=require(_0x0db7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0db7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0db7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0db7('0x15'))['db'];function respondWithStatusCode(_0x421036,_0x34cf10){_0x34cf10=_0x34cf10||0xcc;return function(_0x5079b1){if(_0x5079b1){return _0x421036[_0x0db7('0x16')](_0x34cf10);}return _0x421036[_0x0db7('0x17')](_0x34cf10)[_0x0db7('0x18')]();};}function respondWithResult(_0x8d0598,_0x3f7b42){_0x3f7b42=_0x3f7b42||0xc8;return function(_0x3a1fa2){if(_0x3a1fa2){return _0x8d0598[_0x0db7('0x17')](_0x3f7b42)[_0x0db7('0x19')](_0x3a1fa2);}};}function respondWithFilteredResult(_0x472b15,_0x37f917){return function(_0x40c229){if(_0x40c229){var _0x27911f=_0x40c229[_0x0db7('0x1a')],_0x29f16a=_0x37f917[_0x0db7('0x1b')],_0x4b9b51=_0x37f917[_0x0db7('0x1b')]+_0x37f917[_0x0db7('0x1c')],_0x8eb376;if(_0x4b9b51>=_0x27911f){_0x4b9b51=_0x27911f;_0x8eb376=0xc8;}else{_0x8eb376=0xce;}_0x472b15['status'](_0x8eb376);return _0x472b15[_0x0db7('0x1d')](_0x0db7('0x1e'),_0x29f16a+'-'+_0x4b9b51+'/'+_0x27911f)[_0x0db7('0x19')](_0x40c229);}return null;};}function patchUpdates(_0x464395){return function(_0x3d85dc){try{jsonpatch['apply'](_0x3d85dc,_0x464395,!![]);}catch(_0x21d10a){return BPromise['reject'](_0x21d10a);}return _0x3d85dc[_0x0db7('0x1f')]();};}function saveUpdates(_0x15068a,_0x4276f3){return function(_0x3faae8){if(_0x3faae8){return _0x3faae8['update'](_0x15068a)[_0x0db7('0x20')](function(_0x27ea4a){return _0x27ea4a;});}return null;};}function removeEntity(_0x12c878,_0x48ef7c){return function(_0x1346ea){if(_0x1346ea){return _0x1346ea['destroy']()[_0x0db7('0x20')](function(){_0x12c878[_0x0db7('0x17')](0xcc)[_0x0db7('0x18')]();});}};}function handleEntityNotFound(_0x24eac5,_0x55ccec){return function(_0x4f9d13){if(!_0x4f9d13){_0x24eac5[_0x0db7('0x16')](0x194);}return _0x4f9d13;};}function handleError(_0x45f2a,_0x3210da){_0x3210da=_0x3210da||0x1f4;return function(_0x4693e4){logger[_0x0db7('0x21')](_0x4693e4['stack']);if(_0x4693e4[_0x0db7('0x22')]){delete _0x4693e4[_0x0db7('0x22')];}_0x45f2a[_0x0db7('0x17')](_0x3210da)[_0x0db7('0x23')](_0x4693e4);};}exports['index']=function(_0x21d3c2,_0x123618){var _0x2e7649={},_0x4c99e5={},_0x3f7ce8={'count':0x0,'rows':[]};var _0x4512d9=_[_0x0db7('0x24')](db[_0x0db7('0x25')][_0x0db7('0x26')],function(_0x25a61d){return{'name':_0x25a61d[_0x0db7('0x27')],'type':_0x25a61d[_0x0db7('0x28')]['key']};});_0x4c99e5[_0x0db7('0x29')]=_[_0x0db7('0x24')](_0x4512d9,_0x0db7('0x22'));_0x4c99e5[_0x0db7('0x2a')]=_[_0x0db7('0x2b')](_0x21d3c2[_0x0db7('0x2a')]);_0x4c99e5[_0x0db7('0x2c')]=_[_0x0db7('0x2d')](_0x4c99e5[_0x0db7('0x29')],_0x4c99e5[_0x0db7('0x2a')]);_0x2e7649[_0x0db7('0x2e')]=_['intersection'](_0x4c99e5['model'],qs[_0x0db7('0x2f')](_0x21d3c2[_0x0db7('0x2a')]['fields']));_0x2e7649[_0x0db7('0x2e')]=_0x2e7649[_0x0db7('0x2e')]['length']?_0x2e7649[_0x0db7('0x2e')]:_0x4c99e5['model'];if(!_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x30')](_0x0db7('0x31'))){_0x2e7649[_0x0db7('0x1c')]=qs[_0x0db7('0x1c')](_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x1c')]);_0x2e7649['offset']=qs[_0x0db7('0x1b')](_0x21d3c2['query'][_0x0db7('0x1b')]);}_0x2e7649[_0x0db7('0x32')]=qs['sort'](_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x33')]);_0x2e7649[_0x0db7('0x34')]=qs[_0x0db7('0x2c')](_[_0x0db7('0x35')](_0x21d3c2['query'],_0x4c99e5[_0x0db7('0x2c')]),_0x4512d9);if(_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x36')]){_0x2e7649[_0x0db7('0x34')]=_[_0x0db7('0x37')](_0x2e7649[_0x0db7('0x34')],{'$or':_['map'](_0x4512d9,function(_0x469b7d){if(_0x469b7d[_0x0db7('0x28')]!==_0x0db7('0x38')){var _0x4d9533={};_0x4d9533[_0x469b7d[_0x0db7('0x22')]]={'$like':'%'+_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x36')]+'%'};return _0x4d9533;}})});}_0x2e7649=_[_0x0db7('0x37')]({},_0x2e7649,_0x21d3c2[_0x0db7('0x39')]);var _0x1e4c75={'where':_0x2e7649[_0x0db7('0x34')]};return db[_0x0db7('0x25')][_0x0db7('0x1a')](_0x1e4c75)['then'](function(_0x197a9b){_0x3f7ce8[_0x0db7('0x1a')]=_0x197a9b;if(_0x21d3c2[_0x0db7('0x2a')][_0x0db7('0x3a')]){_0x2e7649[_0x0db7('0x3b')]=[{'all':!![]}];}return db[_0x0db7('0x25')][_0x0db7('0x3c')](_0x2e7649);})[_0x0db7('0x20')](function(_0x5bf699){_0x3f7ce8['rows']=_0x5bf699;return _0x3f7ce8;})[_0x0db7('0x20')](respondWithFilteredResult(_0x123618,_0x2e7649))['catch'](handleError(_0x123618,null));};exports[_0x0db7('0x3d')]=function(_0x4682ca,_0x2e5796){var _0x36954f={'raw':!![],'where':{'id':_0x4682ca[_0x0db7('0x3e')]['id']}},_0x4b3726={};_0x4b3726['model']=_[_0x0db7('0x2b')](db['ChatTransferReport'][_0x0db7('0x26')]);_0x4b3726[_0x0db7('0x2a')]=_[_0x0db7('0x2b')](_0x4682ca['query']);_0x4b3726[_0x0db7('0x2c')]=_[_0x0db7('0x2d')](_0x4b3726[_0x0db7('0x29')],_0x4b3726[_0x0db7('0x2a')]);_0x36954f['attributes']=_['intersection'](_0x4b3726[_0x0db7('0x29')],qs[_0x0db7('0x2f')](_0x4682ca[_0x0db7('0x2a')][_0x0db7('0x2f')]));_0x36954f[_0x0db7('0x2e')]=_0x36954f[_0x0db7('0x2e')][_0x0db7('0x3f')]?_0x36954f[_0x0db7('0x2e')]:_0x4b3726[_0x0db7('0x29')];if(_0x4682ca['query'][_0x0db7('0x3a')]){_0x36954f[_0x0db7('0x3b')]=[{'all':!![]}];}_0x36954f=_[_0x0db7('0x37')]({},_0x36954f,_0x4682ca['options']);return db[_0x0db7('0x25')][_0x0db7('0x40')](_0x36954f)[_0x0db7('0x20')](handleEntityNotFound(_0x2e5796,null))[_0x0db7('0x20')](respondWithResult(_0x2e5796,null))[_0x0db7('0x41')](handleError(_0x2e5796,null));};exports[_0x0db7('0x42')]=function(_0x32d52f,_0xc8c40c){return db['ChatTransferReport'][_0x0db7('0x42')](_0x32d52f[_0x0db7('0x43')],{})[_0x0db7('0x20')](respondWithResult(_0xc8c40c,0xc9))['catch'](handleError(_0xc8c40c,null));};exports[_0x0db7('0x44')]=function(_0xe567e8,_0x2ac3e7){if(_0xe567e8[_0x0db7('0x43')]['id']){delete _0xe567e8[_0x0db7('0x43')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0xe567e8[_0x0db7('0x3e')]['id']}})[_0x0db7('0x20')](handleEntityNotFound(_0x2ac3e7,null))[_0x0db7('0x20')](saveUpdates(_0xe567e8[_0x0db7('0x43')],null))['then'](respondWithResult(_0x2ac3e7,null))['catch'](handleError(_0x2ac3e7,null));};exports[_0x0db7('0x45')]=function(_0x2768f8,_0x5b6e6c){return db[_0x0db7('0x25')][_0x0db7('0x40')]({'where':{'id':_0x2768f8[_0x0db7('0x3e')]['id']}})[_0x0db7('0x20')](handleEntityNotFound(_0x5b6e6c,null))['then'](removeEntity(_0x5b6e6c,null))[_0x0db7('0x41')](handleError(_0x5b6e6c,null));};exports[_0x0db7('0x46')]=function(_0x54861e,_0x24160d){return db['ChatTransferReport'][_0x0db7('0x46')]()[_0x0db7('0x20')](respondWithResult(_0x24160d,null))[_0x0db7('0x41')](handleError(_0x24160d,null));}; \ No newline at end of file +var _0xf5d8=['stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','reject','update','then','destroy','sendStatus'];(function(_0x32778e,_0x3c255d){var _0x381b07=function(_0x1622e5){while(--_0x1622e5){_0x32778e['push'](_0x32778e['shift']());}};_0x381b07(++_0x3c255d);}(_0xf5d8,0x137));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f5d('0x1'));var jsonpatch=require(_0x8f5d('0x2'));var rp=require(_0x8f5d('0x3'));var moment=require(_0x8f5d('0x4'));var BPromise=require(_0x8f5d('0x5'));var Mustache=require(_0x8f5d('0x6'));var util=require(_0x8f5d('0x7'));var path=require(_0x8f5d('0x8'));var sox=require(_0x8f5d('0x9'));var csv=require(_0x8f5d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f5d('0xb'));var jsforce=require(_0x8f5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f5d('0xa'));var querystring=require(_0x8f5d('0xd'));var Papa=require(_0x8f5d('0xe'));var Redis=require(_0x8f5d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8f5d('0x10'));var as=require(_0x8f5d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f5d('0x12'));var utils=require('../../config/utils');var config=require(_0x8f5d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f5d('0x14'))['db'];function respondWithStatusCode(_0x6fbdff,_0xde7bc0){_0xde7bc0=_0xde7bc0||0xcc;return function(_0x8b9475){if(_0x8b9475){return _0x6fbdff['sendStatus'](_0xde7bc0);}return _0x6fbdff['status'](_0xde7bc0)[_0x8f5d('0x15')]();};}function respondWithResult(_0x48facb,_0x5519e1){_0x5519e1=_0x5519e1||0xc8;return function(_0x406a19){if(_0x406a19){return _0x48facb['status'](_0x5519e1)[_0x8f5d('0x16')](_0x406a19);}};}function respondWithFilteredResult(_0x11c06e,_0x30a365){return function(_0x4738e6){if(_0x4738e6){var _0x1686ff=_0x4738e6[_0x8f5d('0x17')],_0x1adb01=_0x30a365[_0x8f5d('0x18')],_0x358066=_0x30a365['offset']+_0x30a365[_0x8f5d('0x19')],_0x135ca4;if(_0x358066>=_0x1686ff){_0x358066=_0x1686ff;_0x135ca4=0xc8;}else{_0x135ca4=0xce;}_0x11c06e[_0x8f5d('0x1a')](_0x135ca4);return _0x11c06e[_0x8f5d('0x1b')](_0x8f5d('0x1c'),_0x1adb01+'-'+_0x358066+'/'+_0x1686ff)[_0x8f5d('0x16')](_0x4738e6);}return null;};}function patchUpdates(_0x5ef189){return function(_0xd502d5){try{jsonpatch['apply'](_0xd502d5,_0x5ef189,!![]);}catch(_0x56fbe5){return BPromise[_0x8f5d('0x1d')](_0x56fbe5);}return _0xd502d5['save']();};}function saveUpdates(_0x59042f,_0x2a0375){return function(_0x9e8036){if(_0x9e8036){return _0x9e8036[_0x8f5d('0x1e')](_0x59042f)[_0x8f5d('0x1f')](function(_0x157a4e){return _0x157a4e;});}return null;};}function removeEntity(_0x1ac1ca,_0x42ba25){return function(_0x3e2d77){if(_0x3e2d77){return _0x3e2d77[_0x8f5d('0x20')]()[_0x8f5d('0x1f')](function(){_0x1ac1ca[_0x8f5d('0x1a')](0xcc)[_0x8f5d('0x15')]();});}};}function handleEntityNotFound(_0x5d86c8,_0x34d3b1){return function(_0x1e1da2){if(!_0x1e1da2){_0x5d86c8[_0x8f5d('0x21')](0x194);}return _0x1e1da2;};}function handleError(_0x22fe7e,_0x16edad){_0x16edad=_0x16edad||0x1f4;return function(_0x5747a3){logger['error'](_0x5747a3[_0x8f5d('0x22')]);if(_0x5747a3[_0x8f5d('0x23')]){delete _0x5747a3[_0x8f5d('0x23')];}_0x22fe7e['status'](_0x16edad)[_0x8f5d('0x24')](_0x5747a3);};}exports[_0x8f5d('0x25')]=function(_0x223d5f,_0x53db19){var _0x7ef5b3={},_0x4e7043={},_0x1b30b1={'count':0x0,'rows':[]};var _0x2a517a=_[_0x8f5d('0x26')](db[_0x8f5d('0x27')][_0x8f5d('0x28')],function(_0x4014da){return{'name':_0x4014da[_0x8f5d('0x29')],'type':_0x4014da['type'][_0x8f5d('0x2a')]};});_0x4e7043[_0x8f5d('0x2b')]=_[_0x8f5d('0x26')](_0x2a517a,'name');_0x4e7043['query']=_[_0x8f5d('0x2c')](_0x223d5f[_0x8f5d('0x2d')]);_0x4e7043[_0x8f5d('0x2e')]=_[_0x8f5d('0x2f')](_0x4e7043[_0x8f5d('0x2b')],_0x4e7043[_0x8f5d('0x2d')]);_0x7ef5b3[_0x8f5d('0x30')]=_['intersection'](_0x4e7043[_0x8f5d('0x2b')],qs[_0x8f5d('0x31')](_0x223d5f[_0x8f5d('0x2d')][_0x8f5d('0x31')]));_0x7ef5b3['attributes']=_0x7ef5b3[_0x8f5d('0x30')][_0x8f5d('0x32')]?_0x7ef5b3[_0x8f5d('0x30')]:_0x4e7043['model'];if(!_0x223d5f[_0x8f5d('0x2d')]['hasOwnProperty']('nolimit')){_0x7ef5b3[_0x8f5d('0x19')]=qs[_0x8f5d('0x19')](_0x223d5f[_0x8f5d('0x2d')]['limit']);_0x7ef5b3[_0x8f5d('0x18')]=qs[_0x8f5d('0x18')](_0x223d5f[_0x8f5d('0x2d')]['offset']);}_0x7ef5b3[_0x8f5d('0x33')]=qs[_0x8f5d('0x34')](_0x223d5f[_0x8f5d('0x2d')][_0x8f5d('0x34')]);_0x7ef5b3[_0x8f5d('0x35')]=qs[_0x8f5d('0x2e')](_['pick'](_0x223d5f[_0x8f5d('0x2d')],_0x4e7043['filters']),_0x2a517a);if(_0x223d5f[_0x8f5d('0x2d')][_0x8f5d('0x36')]){_0x7ef5b3[_0x8f5d('0x35')]=_[_0x8f5d('0x37')](_0x7ef5b3[_0x8f5d('0x35')],{'$or':_[_0x8f5d('0x26')](_0x2a517a,function(_0x36b859){if(_0x36b859[_0x8f5d('0x38')]!==_0x8f5d('0x39')){var _0x47f8dd={};_0x47f8dd[_0x36b859['name']]={'$like':'%'+_0x223d5f[_0x8f5d('0x2d')][_0x8f5d('0x36')]+'%'};return _0x47f8dd;}})});}_0x7ef5b3=_[_0x8f5d('0x37')]({},_0x7ef5b3,_0x223d5f['options']);var _0x1051ae={'where':_0x7ef5b3['where']};return db[_0x8f5d('0x27')][_0x8f5d('0x17')](_0x1051ae)[_0x8f5d('0x1f')](function(_0x2685de){_0x1b30b1[_0x8f5d('0x17')]=_0x2685de;if(_0x223d5f['query'][_0x8f5d('0x3a')]){_0x7ef5b3[_0x8f5d('0x3b')]=[{'all':!![]}];}return db[_0x8f5d('0x27')]['findAll'](_0x7ef5b3);})['then'](function(_0x2f7b44){_0x1b30b1[_0x8f5d('0x3c')]=_0x2f7b44;return _0x1b30b1;})[_0x8f5d('0x1f')](respondWithFilteredResult(_0x53db19,_0x7ef5b3))[_0x8f5d('0x3d')](handleError(_0x53db19,null));};exports[_0x8f5d('0x3e')]=function(_0x5dfd56,_0x15ab50){var _0x273647={'raw':!![],'where':{'id':_0x5dfd56[_0x8f5d('0x3f')]['id']}},_0x25d4af={};_0x25d4af['model']=_[_0x8f5d('0x2c')](db[_0x8f5d('0x27')][_0x8f5d('0x28')]);_0x25d4af[_0x8f5d('0x2d')]=_['keys'](_0x5dfd56[_0x8f5d('0x2d')]);_0x25d4af['filters']=_[_0x8f5d('0x2f')](_0x25d4af[_0x8f5d('0x2b')],_0x25d4af[_0x8f5d('0x2d')]);_0x273647[_0x8f5d('0x30')]=_[_0x8f5d('0x2f')](_0x25d4af[_0x8f5d('0x2b')],qs[_0x8f5d('0x31')](_0x5dfd56[_0x8f5d('0x2d')][_0x8f5d('0x31')]));_0x273647[_0x8f5d('0x30')]=_0x273647['attributes'][_0x8f5d('0x32')]?_0x273647['attributes']:_0x25d4af[_0x8f5d('0x2b')];if(_0x5dfd56[_0x8f5d('0x2d')][_0x8f5d('0x3a')]){_0x273647[_0x8f5d('0x3b')]=[{'all':!![]}];}_0x273647=_[_0x8f5d('0x37')]({},_0x273647,_0x5dfd56[_0x8f5d('0x40')]);return db[_0x8f5d('0x27')][_0x8f5d('0x41')](_0x273647)[_0x8f5d('0x1f')](handleEntityNotFound(_0x15ab50,null))['then'](respondWithResult(_0x15ab50,null))['catch'](handleError(_0x15ab50,null));};exports[_0x8f5d('0x42')]=function(_0x5b9fb9,_0x176469){return db[_0x8f5d('0x27')][_0x8f5d('0x42')](_0x5b9fb9[_0x8f5d('0x43')],{})[_0x8f5d('0x1f')](respondWithResult(_0x176469,0xc9))[_0x8f5d('0x3d')](handleError(_0x176469,null));};exports[_0x8f5d('0x1e')]=function(_0x27b6dc,_0x23728c){if(_0x27b6dc[_0x8f5d('0x43')]['id']){delete _0x27b6dc['body']['id'];}return db[_0x8f5d('0x27')][_0x8f5d('0x41')]({'where':{'id':_0x27b6dc[_0x8f5d('0x3f')]['id']}})[_0x8f5d('0x1f')](handleEntityNotFound(_0x23728c,null))['then'](saveUpdates(_0x27b6dc[_0x8f5d('0x43')],null))[_0x8f5d('0x1f')](respondWithResult(_0x23728c,null))[_0x8f5d('0x3d')](handleError(_0x23728c,null));};exports['destroy']=function(_0x517bf,_0x451c64){return db[_0x8f5d('0x27')]['find']({'where':{'id':_0x517bf[_0x8f5d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x451c64,null))[_0x8f5d('0x1f')](removeEntity(_0x451c64,null))[_0x8f5d('0x3d')](handleError(_0x451c64,null));};exports[_0x8f5d('0x44')]=function(_0x5e36f3,_0x58bb55){return db[_0x8f5d('0x27')][_0x8f5d('0x44')]()[_0x8f5d('0x1f')](respondWithResult(_0x58bb55,null))['catch'](handleError(_0x58bb55,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e02a4f0..e37dd01 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 _0x46c8=['define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0x46c8,0x15f));var _0x846c=function(_0x2cc1dc,_0x3ea2a9){_0x2cc1dc=_0x2cc1dc-0x0;var _0x19832c=_0x46c8[_0x2cc1dc];return _0x19832c;};'use strict';var _=require(_0x846c('0x0'));var util=require(_0x846c('0x1'));var logger=require(_0x846c('0x2'))('api');var moment=require(_0x846c('0x3'));var BPromise=require('bluebird');var rp=require(_0x846c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x846c('0x5'));var config=require(_0x846c('0x6'));var attributes=require(_0x846c('0x7'));module[_0x846c('0x8')]=function(_0x3660bd,_0x588df0){return _0x3660bd[_0x846c('0x9')]('ChatTransferReport',attributes,{'tableName':_0x846c('0xa'),'paranoid':![],'indexes':[{'name':_0x846c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb81=['rimraf','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1def93,_0x1adede){var _0x35199a=function(_0x44051a){while(--_0x44051a){_0x1def93['push'](_0x1def93['shift']());}};_0x35199a(++_0x1adede);}(_0xdb81,0x191));var _0x1db8=function(_0x4bbf88,_0x56ff7f){_0x4bbf88=_0x4bbf88-0x0;var _0x2cf54c=_0xdb81[_0x4bbf88];return _0x2cf54c;};'use strict';var _=require(_0x1db8('0x0'));var util=require(_0x1db8('0x1'));var logger=require(_0x1db8('0x2'))('api');var moment=require(_0x1db8('0x3'));var BPromise=require(_0x1db8('0x4'));var rp=require(_0x1db8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1db8('0x6'));var config=require(_0x1db8('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x1db8('0x8')]=function(_0x33b48c,_0x35c4b9){return _0x33b48c[_0x1db8('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x1db8('0xa'),'fields':[_0x1db8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9fd8076..32945bb 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 _0xd6e3=['../../mysqldb','../../config/utils','rpc','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x3faedb,_0x5e79b4){var _0x285ca0=function(_0x1e7bbf){while(--_0x1e7bbf){_0x3faedb['push'](_0x3faedb['shift']());}};_0x285ca0(++_0x5e79b4);}(_0xd6e3,0xa6));var _0x3d6e=function(_0x4e693a,_0x4e5999){_0x4e693a=_0x4e693a-0x0;var _0x3742f8=_0xd6e3[_0x4e693a];return _0x3742f8;};'use strict';var _=require(_0x3d6e('0x0'));var util=require(_0x3d6e('0x1'));var moment=require(_0x3d6e('0x2'));var BPromise=require(_0x3d6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d6e('0x4'))['db'];var utils=require(_0x3d6e('0x5'));var logger=require('../../config/logger')(_0x3d6e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3d6e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f1e70,_0x1ccb4c,_0x51795b){return new BPromise(function(_0x55775b,_0x27df15){return client[_0x3d6e('0x8')](_0x4f1e70,_0x51795b)[_0x3d6e('0x9')](function(_0x3ead76){logger[_0x3d6e('0xa')](_0x3d6e('0xb'),_0x1ccb4c,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1ccb4c,_0x3d6e('0xc'),JSON['stringify'](_0x3ead76));if(_0x3ead76[_0x3d6e('0xd')]){if(_0x3ead76['error'][_0x3d6e('0xe')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1ccb4c,_0x3ead76[_0x3d6e('0xd')][_0x3d6e('0xf')]);return _0x27df15(_0x3ead76[_0x3d6e('0xd')]['message']);}logger[_0x3d6e('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x1ccb4c,_0x3ead76[_0x3d6e('0xd')][_0x3d6e('0xf')]);return _0x55775b(_0x3ead76['error']['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1ccb4c,'request\x20sent');_0x55775b(_0x3ead76[_0x3d6e('0x10')]['message']);}})['catch'](function(_0x18a9b){logger['error'](_0x3d6e('0xb'),_0x1ccb4c,_0x18a9b);_0x27df15(_0x18a9b);});});} \ No newline at end of file +var _0xcae2=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x55b735,_0xaee0a7){var _0x33931d=function(_0x4fdf47){while(--_0x4fdf47){_0x55b735['push'](_0x55b735['shift']());}};_0x33931d(++_0xaee0a7);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rs=require(_0x2cae('0x4'));var fs=require('fs');var Redis=require(_0x2cae('0x5'));var db=require(_0x2cae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));var config=require(_0x2cae('0x9'));var jayson=require(_0x2cae('0xa'));var client=jayson['client'][_0x2cae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feff6,_0x1e1a3d,_0x25b6a2){return new BPromise(function(_0x2e7498,_0x49e1d1){return client['request'](_0x1feff6,_0x25b6a2)['then'](function(_0x49f0d3){logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));logger[_0x2cae('0xf')](_0x2cae('0x10'),_0x1e1a3d,_0x2cae('0xe'),JSON['stringify'](_0x49f0d3));if(_0x49f0d3[_0x2cae('0x11')]){if(_0x49f0d3['error'][_0x2cae('0x12')]===0x1f4){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x49e1d1(_0x49f0d3[_0x2cae('0x11')]['message']);}logger[_0x2cae('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x2e7498(_0x49f0d3['error'][_0x2cae('0x13')]);}else{logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));_0x2e7498(_0x49f0d3['result'][_0x2cae('0x13')]);}})[_0x2cae('0x14')](function(_0x4a89e1){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x4a89e1);_0x49e1d1(_0x4a89e1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6914cda..cffa912 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 _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(_0x26f919,_0x481a9c){var _0x2442bb=function(_0x55a719){while(--_0x55a719){_0x26f919['push'](_0x26f919['shift']());}};_0x2442bb(++_0x481a9c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f5b52,_0x45ab7e){_0x2f5b52=_0x2f5b52-0x0;var _0x17776c=_0x5f2f[_0x2f5b52];return _0x17776c;};'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('./chatTransferReport.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 +var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x4a0624,_0x2cc77d){var _0x1849fa=function(_0x14cc35){while(--_0x14cc35){_0x4a0624['push'](_0x4a0624['shift']());}};_0x1849fa(++_0x2cc77d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x0b0e[_0x5c4d27];return _0x1dda1a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 745d575..9253cca 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 _0x1530=['Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','thumb','star','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x58a275,_0x1acd9d){var _0x3d9471=function(_0x20e5f9){while(--_0x20e5f9){_0x58a275['push'](_0x58a275['shift']());}};_0x3d9471(++_0x1acd9d);}(_0x1530,0x19c));var _0x0153=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1530[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x0153('0x0'));var rs=require('randomstring');module[_0x0153('0x1')]={'name':{'type':Sequelize[_0x0153('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0153('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x0153('0x2')]},'mapKey':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x3')},'key':{'type':Sequelize[_0x0153('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0153('0x2')],'allowNull':![],'defaultValue':_0x0153('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0153('0x2')],'allowNull':![],'defaultValue':_0x0153('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0153('0x2')],'allowNull':![],'defaultValue':_0x0153('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0153('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0153('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0153('0x8')](_0x0153('0x9'),_0x0153('0xa')),'defaultValue':_0x0153('0x9')},'header_online':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0xb')},'download_transcript':{'type':Sequelize[_0x0153('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0153('0xc')]},'closingQuestion':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0xd')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0153('0xe')},'noteTitle':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0xf')},'placeholderMessage':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x10')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0153('0x11')},'skipMessageButton':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x13')},'ratingType':{'type':Sequelize['ENUM']('star',_0x0153('0x14')),'defaultValue':_0x0153('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x0153('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0153('0xc')],'defaultValue':function(){return JSON[_0x0153('0x16')]({'items':[{'type':_0x0153('0x17'),'variable':null,'config':{'placeholder':_0x0153('0x18'),'type':_0x0153('0x19'),'required':!![]},'props':{'title':_0x0153('0x18'),'helpText':''}},{'type':_0x0153('0x17'),'props':{'title':_0x0153('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0153('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0153('0x1a')](_0x0153('0x1b'))?JSON['parse'](this[_0x0153('0x1a')](_0x0153('0x1b'))):{};},'set':function(_0x5cb631){return this[_0x0153('0x1c')](_0x0153('0x1b'),JSON[_0x0153('0x16')](_0x5cb631));}},'offlineForm':{'type':Sequelize[_0x0153('0xc')],'defaultValue':function(){return JSON[_0x0153('0x16')]({'items':[{'type':_0x0153('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0153('0x3'),'type':'email'},'variable':null},{'type':_0x0153('0x1d'),'config':{'placeholder':'Comments'},'props':{'title':_0x0153('0x1e'),'helpText':_0x0153('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x0153('0x1a')]('offlineForm')?JSON[_0x0153('0x20')](this[_0x0153('0x1a')](_0x0153('0x21'))):{};},'set':function(_0x3d2ccd){return this[_0x0153('0x1c')]('offlineForm',JSON['stringify'](_0x3d2ccd));}},'token':{'type':Sequelize[_0x0153('0x2')],'defaultValue':function(){return rs[_0x0153('0x22')]();}},'autoclose':{'type':Sequelize[_0x0153('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0153('0x2')]},'forwardOffline':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0153('0x2')]},'waitingTitle':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x23')},'waitingMessage':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0153('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x26')},'skipUnmanaged':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x12')},'sendUnmanaged':{'type':Sequelize[_0x0153('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0153('0xc')]},'showAgentAvatar':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0153('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0153('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x0153('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0153('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x28')},'verticalAlignment':{'type':Sequelize[_0x0153('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0153('0x2')]},'customerAvatar':{'type':Sequelize[_0x0153('0xc')]},'showCustomerAvatar':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0153('0x2')],'defaultValue':_0x0153('0x29')},'systemAvatar':{'type':Sequelize[_0x0153('0xc')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0153('0x6')],'comment':_0x0153('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0153('0x2b'),'set':function(_0x18720a){if(!_0x18720a)this[_0x0153('0x1c')](_0x0153('0x2c'),null);this[_0x0153('0x1c')]('mandatoryDisposition',_0x18720a);}},'vidaooEscalation':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0153('0x2')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x0153('0x7')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0xd5fe=['star','stringify','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd5fe,0x1dc));var _0xed5f=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0xd5fe[_0x3f940e];return _0x424b2e;};'use strict';var Sequelize=require(_0xed5f('0x0'));var rs=require(_0xed5f('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xed5f('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x3')},'mapKeyOffline':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xed5f('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed5f('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed5f('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xed5f('0x2')],'allowNull':![],'defaultValue':_0xed5f('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xed5f('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xed5f('0x2')]},'animation':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xed5f('0x8')](_0xed5f('0x9'),_0xed5f('0xa')),'defaultValue':_0xed5f('0x9')},'header_online':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0xb')},'start_chat_button':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0xc')},'offline_chat_button':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xed5f('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xed5f('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x12')},'noteTitle':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x13')},'closingMessage':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0xd')},'skipMessageButton':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x15')},'conditionAgreement':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x16')},'ratingType':{'type':Sequelize[_0xed5f('0x8')]('star',_0xed5f('0x17')),'defaultValue':_0xed5f('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xed5f('0xf')],'defaultValue':function(){return JSON[_0xed5f('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xed5f('0x1a'),'type':'text','required':!![]},'props':{'title':_0xed5f('0x1a'),'helpText':''}},{'type':_0xed5f('0x1b'),'props':{'title':_0xed5f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xed5f('0x3'),'type':_0xed5f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xed5f('0x1c')](_0xed5f('0x1d'))?JSON[_0xed5f('0x1e')](this[_0xed5f('0x1c')](_0xed5f('0x1d'))):{};},'set':function(_0x5630da){return this[_0xed5f('0x1f')](_0xed5f('0x1d'),JSON[_0xed5f('0x19')](_0x5630da));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xed5f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xed5f('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xed5f('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xed5f('0x22'))?JSON[_0xed5f('0x1e')](this[_0xed5f('0x1c')](_0xed5f('0x22'))):{};},'set':function(_0x4c4ae8){return this[_0xed5f('0x1f')]('offlineForm',JSON[_0xed5f('0x19')](_0x4c4ae8));}},'token':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':function(){return rs[_0xed5f('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x24')},'waitingMessage':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x26')},'offlineMessageBody':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x15')},'sendUnmanaged':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xed5f('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xed5f('0x2')]},'notificationTemplate':{'type':Sequelize[_0xed5f('0xf')],'defaultValue':function(){return _0xed5f('0x29');}},'notificationSound':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x2b')},'verticalAlignment':{'type':Sequelize[_0xed5f('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':_0xed5f('0x2c')},'defaultTitle':{'type':Sequelize[_0xed5f('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xed5f('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xed5f('0x2')],'allowNull':![],'defaultValue':_0xed5f('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed5f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xed5f('0x2e')},'systemAvatar':{'type':Sequelize[_0xed5f('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed5f('0x6')],'comment':_0xed5f('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5d09e7){if(!_0x5d09e7)this[_0xed5f('0x1f')](_0xed5f('0x30'),null);this['setDataValue'](_0xed5f('0x31'),_0x5d09e7);}},'vidaooEscalation':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xed5f('0x2')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0xed5f('0x7')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index be8ecd4..e45e385 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 _0x214b=['CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','ChatApplication','Applications','List','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','forcedOwnership','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','MailAccountId','MailAccount','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','Owner','Tag','color','tag','Command','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','increment','all','some','server/files/chat/iframe.js','remote','x-real-ip','alignment','textColor','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','get','ChatWebsites','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','ChatWebsite','includeAll','rows','fields','include','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','destroy','describe','addDisposition','Disposition','findOne','sort','findAll','ids','addAnswer','ChatWebsiteId','CannedAnswer','removeAnswers','addLogo','file','filename','addCustomerAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','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','headers','user-agent','getResult','chat'];(function(_0x335ac8,_0x5dccc7){var _0x1dbe8f=function(_0x467009){while(--_0x467009){_0x335ac8['push'](_0x335ac8['shift']());}};_0x1dbe8f(++_0x5dccc7);}(_0x214b,0x92));var _0xb214=function(_0x112ea9,_0x4e1032){_0x112ea9=_0x112ea9-0x0;var _0x1857c7=_0x214b[_0x112ea9];return _0x1857c7;};'use strict';var pdf=require(_0xb214('0x0'));var emlformat=require(_0xb214('0x1'));var rimraf=require(_0xb214('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb214('0x3'));var rp=require(_0xb214('0x4'));var moment=require(_0xb214('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb214('0x6'));var path=require(_0xb214('0x7'));var sox=require(_0xb214('0x8'));var csv=require(_0xb214('0x9'));var ejs=require(_0xb214('0xa'));var fs=require('fs');var _=require(_0xb214('0xb'));var squel=require('squel');var crypto=require(_0xb214('0xc'));var jsforce=require(_0xb214('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb214('0x9'));var querystring=require(_0xb214('0xe'));var Papa=require(_0xb214('0xf'));var Redis=require(_0xb214('0x10'));var authService=require(_0xb214('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb214('0x12'));var logger=require(_0xb214('0x13'))('api');var utils=require(_0xb214('0x14'));var config=require(_0xb214('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb214('0x16')]=_[_0xb214('0x17')](config[_0xb214('0x16')],{'host':_0xb214('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb214('0x16')]));require('./chatWebsite.socket')[_0xb214('0x19')](socket);var jayson=require(_0xb214('0x1a'));var client=jayson[_0xb214('0x1b')][_0xb214('0x1c')]({'port':0x232c});var client9002=jayson[_0xb214('0x1b')][_0xb214('0x1c')]({'port':0x232a});var client9003=jayson[_0xb214('0x1b')][_0xb214('0x1c')]({'port':0x232b});var client9001=jayson[_0xb214('0x1b')][_0xb214('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x25d131,_0x40b969,_0xc877e0,_0x1a6493){return new BPromise(function(_0x404cb9,_0x3e88cd){var _0x3443a1=_0x1a6493||client;return _0x3443a1[_0xb214('0x1d')](_0x25d131,_0xc877e0)[_0xb214('0x1e')](function(_0x2340ff){logger[_0xb214('0x1f')](_0xb214('0x20'),_0x40b969,_0xb214('0x21'));logger[_0xb214('0x22')](_0xb214('0x23'),_0x40b969,_0xb214('0x21'),JSON[_0xb214('0x24')](_0x2340ff));if(_0x2340ff[_0xb214('0x25')]){if(_0x2340ff[_0xb214('0x25')]['code']===0x1f4){logger[_0xb214('0x25')](_0xb214('0x20'),_0x40b969,_0x2340ff[_0xb214('0x25')]['message']);return _0x3e88cd(_0x2340ff['error'][_0xb214('0x26')]);}logger[_0xb214('0x25')](_0xb214('0x20'),_0x40b969,_0x2340ff[_0xb214('0x25')][_0xb214('0x26')]);return _0x404cb9(_0x2340ff[_0xb214('0x25')][_0xb214('0x26')]);}else{logger['info'](_0xb214('0x20'),_0x40b969,_0xb214('0x21'));_0x404cb9(_0x2340ff['result'][_0xb214('0x26')]);}})[_0xb214('0x27')](function(_0x34a40c){logger[_0xb214('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x40b969,_0x34a40c);_0x3e88cd(_0x34a40c);});});}function respondWithStatusCode(_0x33523d,_0x49ca57){_0x49ca57=_0x49ca57||0xcc;return function(_0x55f7a2){if(_0x55f7a2){return _0x33523d[_0xb214('0x28')](_0x49ca57);}return _0x33523d[_0xb214('0x29')](_0x49ca57)['end']();};}function respondWithResult(_0x800d30,_0x118a86){_0x118a86=_0x118a86||0xc8;return function(_0x11f720){if(_0x11f720){return _0x800d30['status'](_0x118a86)['json'](_0x11f720);}};}function respondWithFilteredResult(_0x4b6127,_0x8456f5){return function(_0x26aa60){if(_0x26aa60){var _0x5e583a=_0x26aa60[_0xb214('0x2a')],_0x525334=_0x8456f5[_0xb214('0x2b')],_0x2b218c=_0x8456f5[_0xb214('0x2b')]+_0x8456f5[_0xb214('0x2c')],_0x46fa85;if(_0x2b218c>=_0x5e583a){_0x2b218c=_0x5e583a;_0x46fa85=0xc8;}else{_0x46fa85=0xce;}_0x4b6127[_0xb214('0x29')](_0x46fa85);return _0x4b6127[_0xb214('0x2d')](_0xb214('0x2e'),_0x525334+'-'+_0x2b218c+'/'+_0x5e583a)[_0xb214('0x2f')](_0x26aa60);}return null;};}function patchUpdates(_0x24b28a){return function(_0x479939){try{jsonpatch[_0xb214('0x30')](_0x479939,_0x24b28a,!![]);}catch(_0x38f7fa){return BPromise[_0xb214('0x31')](_0x38f7fa);}return _0x479939[_0xb214('0x32')]();};}function saveUpdates(_0x446f80,_0x175342){return function(_0x9bb11d){if(_0x9bb11d){return _0x9bb11d[_0xb214('0x33')](_0x446f80)[_0xb214('0x1e')](function(_0x3f1902){return _0x3f1902;});}return null;};}function removeEntity(_0x219473,_0x475d87){return function(_0x5a936e){if(_0x5a936e){return _0x5a936e['destroy']()[_0xb214('0x1e')](function(){var _0x5cba16=_0x5a936e[_0xb214('0x34')]({'plain':!![]});var _0x170ce7=_0xb214('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x170ce7,'resourceId':_0x5cba16['id']}})[_0xb214('0x1e')](function(){return _0x5a936e;});})[_0xb214('0x1e')](function(){_0x219473['status'](0xcc)[_0xb214('0x36')]();});}};}function handleEntityNotFound(_0x2aa946,_0x33aa27){return function(_0x2ba9bc){if(!_0x2ba9bc){_0x2aa946[_0xb214('0x28')](0x194);}return _0x2ba9bc;};}function handleError(_0x43df39,_0x568f90){_0x568f90=_0x568f90||0x1f4;return function(_0x770607){logger['error'](_0x770607[_0xb214('0x37')]);if(_0x770607[_0xb214('0x38')]){delete _0x770607[_0xb214('0x38')];}_0x43df39[_0xb214('0x29')](_0x568f90)[_0xb214('0x39')](_0x770607);};}exports[_0xb214('0x3a')]=function(_0x2f2e19,_0x4d48d4){var _0x52e334={'include':[{'model':db[_0xb214('0x3b')],'as':_0xb214('0x3c')}]},_0x52ca28={},_0x8b48df={'count':0x0,'rows':[]};var _0x5caeb2=_[_0xb214('0x3d')](db['ChatWebsite'][_0xb214('0x3e')],function(_0x41a139){return{'name':_0x41a139[_0xb214('0x3f')],'type':_0x41a139[_0xb214('0x40')]['key']};});_0x52ca28[_0xb214('0x41')]=_[_0xb214('0x3d')](_0x5caeb2,'name');_0x52ca28[_0xb214('0x42')]=_[_0xb214('0x43')](_0x2f2e19[_0xb214('0x42')]);_0x52ca28['filters']=_[_0xb214('0x44')](_0x52ca28[_0xb214('0x41')],_0x52ca28[_0xb214('0x42')]);_0x52e334[_0xb214('0x45')]=_[_0xb214('0x44')](_0x52ca28[_0xb214('0x41')],qs['fields'](_0x2f2e19['query']['fields']));_0x52e334[_0xb214('0x45')]=_0x52e334['attributes'][_0xb214('0x46')]?_0x52e334[_0xb214('0x45')]:_0x52ca28[_0xb214('0x41')];if(!_0x2f2e19[_0xb214('0x42')][_0xb214('0x47')](_0xb214('0x48'))){_0x52e334[_0xb214('0x2c')]=qs['limit'](_0x2f2e19[_0xb214('0x42')][_0xb214('0x2c')]);_0x52e334['offset']=qs['offset'](_0x2f2e19[_0xb214('0x42')][_0xb214('0x2b')]);}_0x52e334[_0xb214('0x49')]=qs['sort'](_0x2f2e19[_0xb214('0x42')]['sort']);_0x52e334[_0xb214('0x4a')]=qs[_0xb214('0x4b')](_[_0xb214('0x4c')](_0x2f2e19[_0xb214('0x42')],_0x52ca28[_0xb214('0x4b')]),_0x5caeb2);if(_0x2f2e19[_0xb214('0x42')][_0xb214('0x4d')]){_0x52e334[_0xb214('0x4a')]=_[_0xb214('0x4e')](_0x52e334[_0xb214('0x4a')],{'$or':_['map'](_0x5caeb2,function(_0xbde99c){if(_0xbde99c['type']!==_0xb214('0x4f')){var _0x541a46={};_0x541a46[_0xbde99c[_0xb214('0x38')]]={'$like':'%'+_0x2f2e19[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x541a46;}})});}_0x52e334=_[_0xb214('0x4e')]({},_0x52e334,_0x2f2e19['options']);var _0x3ee6c9={'where':_0x52e334[_0xb214('0x4a')]};return db[_0xb214('0x50')]['count'](_0x3ee6c9)[_0xb214('0x1e')](function(_0x30fd8c){_0x8b48df[_0xb214('0x2a')]=_0x30fd8c;if(_0x2f2e19[_0xb214('0x42')][_0xb214('0x51')]){_0x52e334['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x52e334);})[_0xb214('0x1e')](function(_0x111c7f){_0x8b48df[_0xb214('0x52')]=_0x111c7f;return _0x8b48df;})['then'](respondWithFilteredResult(_0x4d48d4,_0x52e334))[_0xb214('0x27')](handleError(_0x4d48d4,null));};exports['show']=function(_0x52f476,_0x38304f){var _0x2d541b={'raw':![],'where':{'id':_0x52f476['params']['id']},'include':[{'model':db[_0xb214('0x3b')],'as':_0xb214('0x3c')}]},_0x23b925={};_0x23b925['model']=_['keys'](db[_0xb214('0x50')][_0xb214('0x3e')]);_0x23b925[_0xb214('0x42')]=_[_0xb214('0x43')](_0x52f476[_0xb214('0x42')]);_0x23b925['filters']=_[_0xb214('0x44')](_0x23b925[_0xb214('0x41')],_0x23b925[_0xb214('0x42')]);_0x2d541b['attributes']=_[_0xb214('0x44')](_0x23b925[_0xb214('0x41')],qs['fields'](_0x52f476[_0xb214('0x42')][_0xb214('0x53')]));_0x2d541b['attributes']=_0x2d541b['attributes'][_0xb214('0x46')]?_0x2d541b['attributes']:_0x23b925[_0xb214('0x41')];if(_0x52f476[_0xb214('0x42')][_0xb214('0x51')]){_0x2d541b[_0xb214('0x54')]=[{'all':!![]}];}_0x2d541b=_['merge']({},_0x2d541b,_0x52f476[_0xb214('0x55')]);return db[_0xb214('0x50')][_0xb214('0x56')](_0x2d541b)[_0xb214('0x1e')](handleEntityNotFound(_0x38304f,null))[_0xb214('0x1e')](respondWithResult(_0x38304f,null))[_0xb214('0x27')](handleError(_0x38304f,null));};exports['create']=function(_0x353a22,_0x13cae8){return db['ChatWebsite'][_0xb214('0x57')](_0x353a22[_0xb214('0x58')],{})[_0xb214('0x1e')](function(_0x35f92f){var _0x3deb1f=_0x353a22[_0xb214('0x59')]['get']({'plain':!![]});if(!_0x3deb1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3deb1f['role']===_0xb214('0x59')){var _0x30c789=_0x35f92f[_0xb214('0x34')]({'plain':!![]});var _0x241c5d='ChatWebsites';return db[_0xb214('0x5a')]['find']({'where':{'name':_0x241c5d,'userProfileId':_0x3deb1f[_0xb214('0x5b')]},'raw':!![]})['then'](function(_0x305fbb){if(_0x305fbb&&_0x305fbb[_0xb214('0x5c')]===0x0){return db[_0xb214('0x5d')][_0xb214('0x57')]({'name':_0x30c789[_0xb214('0x38')],'resourceId':_0x30c789['id'],'type':_0x305fbb[_0xb214('0x38')],'sectionId':_0x305fbb['id']},{})[_0xb214('0x1e')](function(){return _0x35f92f;});}else{return _0x35f92f;}})[_0xb214('0x27')](function(_0x32d22e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d22e);throw _0x32d22e;});}return _0x35f92f;})[_0xb214('0x1e')](respondWithResult(_0x13cae8,0xc9))[_0xb214('0x27')](handleError(_0x13cae8,null));};exports[_0xb214('0x33')]=function(_0x2c7910,_0x3661df){if(_0x2c7910['body']['id']){delete _0x2c7910[_0xb214('0x58')]['id'];}return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x2c7910[_0xb214('0x5e')]['id']},'include':[{'model':db[_0xb214('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xb214('0x1e')](handleEntityNotFound(_0x3661df,null))[_0xb214('0x1e')](saveUpdates(_0x2c7910[_0xb214('0x58')],null))[_0xb214('0x1e')](respondWithResult(_0x3661df,null))['catch'](handleError(_0x3661df,null));};exports[_0xb214('0x5f')]=function(_0x2ce877,_0x15c8c4){return db[_0xb214('0x50')]['find']({'where':{'id':_0x2ce877[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x15c8c4,null))[_0xb214('0x1e')](removeEntity(_0x15c8c4,null))[_0xb214('0x27')](handleError(_0x15c8c4,null));};exports['describe']=function(_0x2dc906,_0x35c89a){return db[_0xb214('0x50')][_0xb214('0x60')]()['then'](respondWithResult(_0x35c89a,null))[_0xb214('0x27')](handleError(_0x35c89a,null));};exports[_0xb214('0x61')]=function(_0x199890,_0x46d878,_0x35dc81){if(_0x199890['body']['id']){delete _0x199890['body']['id'];}return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x199890[_0xb214('0x5e')]['id']}})['then'](handleEntityNotFound(_0x46d878,null))['then'](function(_0x1016bc){if(_0x1016bc){_0x199890[_0xb214('0x58')]['ChatWebsiteId']=_0x1016bc['id'];return db[_0xb214('0x62')]['create'](_0x199890[_0xb214('0x58')]);}})[_0xb214('0x1e')](respondWithResult(_0x46d878,null))[_0xb214('0x27')](handleError(_0x46d878,null));};exports['getDispositions']=function(_0x1001ea,_0x5d3a36,_0x456841){var _0x1f233e={'raw':![],'where':{}};var _0x1e74fe={};var _0x3edb72={'count':0x0,'rows':[]};return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0x1001ea['params']['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x5d3a36,null))['then'](function(_0x3ec32f){if(_0x3ec32f){_0x1e74fe[_0xb214('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x1e74fe[_0xb214('0x42')]=_['keys'](_0x1001ea['query']);_0x1e74fe[_0xb214('0x4b')]=_[_0xb214('0x44')](_0x1e74fe[_0xb214('0x41')],_0x1e74fe[_0xb214('0x42')]);_0x1f233e['attributes']=_[_0xb214('0x44')](_0x1e74fe[_0xb214('0x41')],qs['fields'](_0x1001ea[_0xb214('0x42')][_0xb214('0x53')]));_0x1f233e[_0xb214('0x45')]=_0x1f233e[_0xb214('0x45')]['length']?_0x1f233e[_0xb214('0x45')]:_0x1e74fe['model'];if(!_0x1001ea[_0xb214('0x42')][_0xb214('0x47')](_0xb214('0x48'))){_0x1f233e[_0xb214('0x2c')]=qs['limit'](_0x1001ea[_0xb214('0x42')][_0xb214('0x2c')]);_0x1f233e[_0xb214('0x2b')]=qs['offset'](_0x1001ea['query']['offset']);}_0x1f233e['order']=qs[_0xb214('0x64')](_0x1001ea[_0xb214('0x42')]['sort']);_0x1f233e['where']=qs[_0xb214('0x4b')](_[_0xb214('0x4c')](_0x1001ea[_0xb214('0x42')],_0x1e74fe[_0xb214('0x4b')]));_0x1f233e[_0xb214('0x4a')]['ChatWebsiteId']=_0x3ec32f['id'];if(_0x1001ea[_0xb214('0x42')][_0xb214('0x4d')]){_0x1f233e[_0xb214('0x4a')]=_['merge'](_0x1f233e[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0x1f233e[_0xb214('0x45')],function(_0x34f97f){var _0x490e8f={};_0x490e8f[_0x34f97f]={'$like':'%'+_0x1001ea[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x490e8f;})});}_0x1f233e=_[_0xb214('0x4e')]({},_0x1f233e,_0x1001ea[_0xb214('0x55')]);return db['Disposition']['count']({'where':_0x1f233e[_0xb214('0x4a')]})[_0xb214('0x1e')](function(_0x2e182b){_0x3edb72[_0xb214('0x2a')]=_0x2e182b;if(_0x1001ea[_0xb214('0x42')][_0xb214('0x51')]){_0x1f233e['include']=[{'all':!![]}];}return db[_0xb214('0x62')][_0xb214('0x65')](_0x1f233e);})[_0xb214('0x1e')](function(_0x237ec0){_0x3edb72[_0xb214('0x52')]=_0x237ec0;return _0x3edb72;});}})[_0xb214('0x1e')](respondWithFilteredResult(_0x5d3a36,_0x1f233e))[_0xb214('0x27')](handleError(_0x5d3a36,null));};exports['removeDispositions']=function(_0x45ee01,_0x5b19db,_0x58ce3f){return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x45ee01[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x5b19db,null))[_0xb214('0x1e')](function(_0x1f2c35){if(_0x1f2c35){return _0x1f2c35['removeDispositions'](_0x45ee01[_0xb214('0x42')][_0xb214('0x66')]);}})[_0xb214('0x1e')](respondWithStatusCode(_0x5b19db,null))[_0xb214('0x27')](handleError(_0x5b19db,null));};exports[_0xb214('0x67')]=function(_0x2d9c5d,_0x299225,_0x2f4338){if(_0x2d9c5d['body']['id']){delete _0x2d9c5d[_0xb214('0x58')]['id'];}return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x2d9c5d[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x299225,null))[_0xb214('0x1e')](function(_0x2f248b){if(_0x2f248b){_0x2d9c5d[_0xb214('0x58')][_0xb214('0x68')]=_0x2f248b['id'];return db['CannedAnswer'][_0xb214('0x57')](_0x2d9c5d['body']);}})[_0xb214('0x1e')](respondWithResult(_0x299225,null))[_0xb214('0x27')](handleError(_0x299225,null));};exports['getAnswers']=function(_0x34c823,_0x4ec825,_0x3b00c3){var _0x4c3fd3={'raw':![],'where':{}};var _0x438a01={};var _0x4082b8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb214('0x63')]({'where':{'id':_0x34c823[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x4ec825,null))[_0xb214('0x1e')](function(_0x5e722a){if(_0x5e722a){_0x438a01[_0xb214('0x41')]=_[_0xb214('0x43')](db[_0xb214('0x69')][_0xb214('0x3e')]);_0x438a01[_0xb214('0x42')]=_[_0xb214('0x43')](_0x34c823['query']);_0x438a01[_0xb214('0x4b')]=_['intersection'](_0x438a01[_0xb214('0x41')],_0x438a01['query']);_0x4c3fd3['attributes']=_[_0xb214('0x44')](_0x438a01[_0xb214('0x41')],qs[_0xb214('0x53')](_0x34c823[_0xb214('0x42')]['fields']));_0x4c3fd3['attributes']=_0x4c3fd3['attributes'][_0xb214('0x46')]?_0x4c3fd3[_0xb214('0x45')]:_0x438a01[_0xb214('0x41')];if(!_0x34c823['query'][_0xb214('0x47')](_0xb214('0x48'))){_0x4c3fd3[_0xb214('0x2c')]=qs['limit'](_0x34c823[_0xb214('0x42')]['limit']);_0x4c3fd3[_0xb214('0x2b')]=qs[_0xb214('0x2b')](_0x34c823[_0xb214('0x42')][_0xb214('0x2b')]);}_0x4c3fd3[_0xb214('0x49')]=qs['sort'](_0x34c823['query'][_0xb214('0x64')]);_0x4c3fd3[_0xb214('0x4a')]=qs[_0xb214('0x4b')](_[_0xb214('0x4c')](_0x34c823['query'],_0x438a01[_0xb214('0x4b')]));_0x4c3fd3[_0xb214('0x4a')][_0xb214('0x68')]=_0x5e722a['id'];if(_0x34c823[_0xb214('0x42')]['filter']){_0x4c3fd3[_0xb214('0x4a')]=_[_0xb214('0x4e')](_0x4c3fd3['where'],{'$or':_[_0xb214('0x3d')](_0x4c3fd3[_0xb214('0x45')],function(_0x18707c){var _0x583312={};_0x583312[_0x18707c]={'$like':'%'+_0x34c823[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x583312;})});}_0x4c3fd3=_['merge']({},_0x4c3fd3,_0x34c823['options']);return db['CannedAnswer'][_0xb214('0x2a')]({'where':_0x4c3fd3[_0xb214('0x4a')]})[_0xb214('0x1e')](function(_0x34324d){_0x4082b8[_0xb214('0x2a')]=_0x34324d;if(_0x34c823['query'][_0xb214('0x51')]){_0x4c3fd3['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb214('0x65')](_0x4c3fd3);})[_0xb214('0x1e')](function(_0x1553d6){_0x4082b8[_0xb214('0x52')]=_0x1553d6;return _0x4082b8;});}})[_0xb214('0x1e')](respondWithFilteredResult(_0x4ec825,_0x4c3fd3))['catch'](handleError(_0x4ec825,null));};exports[_0xb214('0x6a')]=function(_0x3bb2d9,_0x571d18,_0x4c4770){return db['ChatWebsite'][_0xb214('0x56')]({'where':{'id':_0x3bb2d9['params']['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x571d18,null))['then'](function(_0x50b78b){if(_0x50b78b){return _0x50b78b['removeAnswers'](_0x3bb2d9[_0xb214('0x42')][_0xb214('0x66')]);}})[_0xb214('0x1e')](respondWithStatusCode(_0x571d18,null))['catch'](handleError(_0x571d18,null));};exports[_0xb214('0x6b')]=function(_0x393464,_0x41223b,_0x491bab){_0x393464[_0xb214('0x58')]['sitepic']=_0x393464[_0xb214('0x6c')][_0xb214('0x6d')];return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x393464['params']['id']}})['then'](handleEntityNotFound(_0x41223b,null))['then'](saveUpdates(_0x393464[_0xb214('0x58')],null))[_0xb214('0x1e')](respondWithResult(_0x41223b,null))[_0xb214('0x27')](handleError(_0x41223b,null));};exports['addAvatar']=function(_0x26be38,_0x20cea0,_0x461ca5){_0x26be38[_0xb214('0x58')]['agentAvatar']=_0x26be38[_0xb214('0x6c')]['filename'];return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x26be38['params']['id']}})['then'](handleEntityNotFound(_0x20cea0,null))['then'](saveUpdates(_0x26be38['body'],null))[_0xb214('0x1e')](respondWithResult(_0x20cea0,null))['catch'](handleError(_0x20cea0,null));};exports[_0xb214('0x6e')]=function(_0x3cea4e,_0x71b756,_0x3b05fa){_0x3cea4e[_0xb214('0x58')][_0xb214('0x6f')]=_0x3cea4e[_0xb214('0x6c')][_0xb214('0x6d')];return db['ChatWebsite']['find']({'where':{'id':_0x3cea4e[_0xb214('0x5e')]['id']}})['then'](handleEntityNotFound(_0x71b756,null))[_0xb214('0x1e')](saveUpdates(_0x3cea4e['body'],null))[_0xb214('0x1e')](respondWithResult(_0x71b756,null))[_0xb214('0x27')](handleError(_0x71b756,null));};exports['addSystemAvatar']=function(_0x4d9291,_0x18925c,_0x2aaadd){_0x4d9291[_0xb214('0x58')][_0xb214('0x70')]=_0x4d9291['file'][_0xb214('0x6d')];return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x4d9291[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x18925c,null))[_0xb214('0x1e')](saveUpdates(_0x4d9291[_0xb214('0x58')],null))[_0xb214('0x1e')](respondWithResult(_0x18925c,null))[_0xb214('0x27')](handleError(_0x18925c,null));};exports['getLogo']=function(_0x59226c,_0x447480,_0x49fccf){var _0x3f0b47=path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x73'));var _0x43c3a0={'where':{'id':_0x59226c[_0xb214('0x5e')]['id']},'attributes':['id',_0xb214('0x74')],'raw':!![]};var _0x17fbae=![];return require(_0xb214('0x75'))[_0xb214('0x76')]()['then'](function(_0x32e9d9){if(_0x32e9d9){_0x17fbae=_0x32e9d9['custom'];}})[_0xb214('0x1e')](function(){return db[_0xb214('0x50')][_0xb214('0x56')](_0x43c3a0);})[_0xb214('0x1e')](handleEntityNotFound(_0x447480,null))[_0xb214('0x1e')](function(_0x7c7c45){if(_0x7c7c45){if(!_[_0xb214('0x77')](_0x7c7c45[_0xb214('0x74')])){if(fs[_0xb214('0x78')](path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x79'),_0x7c7c45[_0xb214('0x74')]))&&_0x17fbae){_0x3f0b47=path[_0xb214('0x71')](config[_0xb214('0x72')],'server/files/images/logos/',_0x7c7c45['sitepic']);}}return _0x447480[_0xb214('0x7a')](_0x3f0b47);}})[_0xb214('0x27')](handleError(_0x447480,null));};exports[_0xb214('0x7b')]=function(_0x2ba91e,_0x3e054d,_0x3e3606){var _0x159bcb=path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x7c'));var _0x15b32c={'where':{'id':_0x2ba91e['params']['id']},'attributes':['id',_0xb214('0x7d')],'raw':!![]};return db[_0xb214('0x50')][_0xb214('0x56')](_0x15b32c)['then'](handleEntityNotFound(_0x3e054d,null))[_0xb214('0x1e')](function(_0x4c9886){if(_0x4c9886){if(!_['isNil'](_0x4c9886[_0xb214('0x7d')])){if(fs[_0xb214('0x78')](path['join'](config[_0xb214('0x72')],_0xb214('0x7e'),_0x4c9886[_0xb214('0x7d')]))){_0x159bcb=path['join'](config['root'],_0xb214('0x7e'),_0x4c9886['agentAvatar']);}}return _0x3e054d[_0xb214('0x7a')](_0x159bcb);}})[_0xb214('0x27')](handleError(_0x3e054d,null));};exports[_0xb214('0x7f')]=function(_0x1141a8,_0x4fdf98,_0x29d1c7){var _0x7f86a8=path[_0xb214('0x71')](config['root'],_0xb214('0x80'));var _0x16df6e={'where':{'id':_0x1141a8['params']['id']},'attributes':['id',_0xb214('0x6f'),_0xb214('0x81')],'raw':!![]};return db[_0xb214('0x50')][_0xb214('0x56')](_0x16df6e)[_0xb214('0x1e')](handleEntityNotFound(_0x4fdf98,null))[_0xb214('0x1e')](function(_0x28412e){if(_0x28412e){if(!_[_0xb214('0x77')](_0x28412e[_0xb214('0x6f')])){if(fs[_0xb214('0x78')](path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x7e'),_0x28412e[_0xb214('0x6f')]))&&_0x28412e['showCustomerAvatar']){_0x7f86a8=path['join'](config['root'],'server/files/images/avatars/',_0x28412e[_0xb214('0x6f')]);}}return _0x4fdf98['download'](_0x7f86a8);}})[_0xb214('0x27')](handleError(_0x4fdf98,null));};exports[_0xb214('0x82')]=function(_0x1fcd1c,_0x1de592,_0xca8b3b){var _0x192651=path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x83'));var _0x3b7af5={'where':{'id':_0x1fcd1c[_0xb214('0x5e')]['id']},'attributes':['id',_0xb214('0x70')],'raw':!![]};return db[_0xb214('0x50')][_0xb214('0x56')](_0x3b7af5)[_0xb214('0x1e')](handleEntityNotFound(_0x1de592,null))[_0xb214('0x1e')](function(_0x918c60){if(_0x918c60){if(!_[_0xb214('0x77')](_0x918c60['systemAvatar'])){if(fs[_0xb214('0x78')](path['join'](config[_0xb214('0x72')],_0xb214('0x7e'),_0x918c60[_0xb214('0x70')]))){_0x192651=path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x7e'),_0x918c60['systemAvatar']);}}return _0x1de592[_0xb214('0x7a')](_0x192651);}})['catch'](handleError(_0x1de592,null));};exports[_0xb214('0x84')]=function(_0x177131,_0x1b953a,_0x24fa77){var _0x1cb359=require(_0xb214('0x85'));var _0x5bb832=new _0x1cb359();var _0x4750e6=_0x5bb832[_0xb214('0x86')](_0x177131[_0xb214('0x87')][_0xb214('0x88')])[_0xb214('0x89')]();var _0x1561b2={'body':_0x177131[_0xb214('0x58')],'channel':_0xb214('0x8a')};var _0xc12cd3=[];var _0x4585eb=[];var _0x21289b={};var _0x18b7a6=![];return db[_0xb214('0x8b')][_0xb214('0x60')]()[_0xb214('0x1e')](function(_0x179616){if(!_0x179616){throw new db['Sequelize'][(_0xb214('0x8c'))](_0xb214('0x8d'));}_0xc12cd3=_['difference'](_[_0xb214('0x43')](_0x179616),['createdAt',_0xb214('0x8e')]);_0x4585eb=_[_0xb214('0x8f')](_['keys'](_0x179616),[_0xb214('0x90'),_0xb214('0x8e'),_0xb214('0x91'),_0xb214('0x92')]);if(_0x177131[_0xb214('0x58')]['id']){delete _0x177131[_0xb214('0x58')]['id'];}if(_['isNil'](_0x177131['body']['from'])){throw new db[(_0xb214('0x93'))][(_0xb214('0x8c'))]('from\x20is\x20mandatory');}if(_[_0xb214('0x77')](_0x177131[_0xb214('0x58')][_0xb214('0x58')])||_0x177131['body'][_0xb214('0x58')]===''){throw new db['Sequelize'][(_0xb214('0x8c'))](_0xb214('0x94'));}if(_[_0xb214('0x77')](_0x177131[_0xb214('0x58')]['mapKey'])){throw new db['Sequelize'][(_0xb214('0x8c'))](_0xb214('0x95')+_0x4585eb);}if(!_[_0xb214('0x96')](_0x4585eb,_0x177131[_0xb214('0x58')][_0xb214('0x97')])){throw new db[(_0xb214('0x93'))][(_0xb214('0x8c'))](_0xb214('0x98')+_0x4585eb);}_0x21289b[_0x177131[_0xb214('0x58')]['mapKey']]=_0x177131[_0xb214('0x58')][_0xb214('0x99')];})[_0xb214('0x1e')](function(){return db[_0xb214('0x50')]['find']({'where':{'id':_0x177131[_0xb214('0x5e')]['id']},'include':[{'model':db[_0xb214('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb214('0x9b'),'where':_0x21289b,'limit':0x1,'order':[[_0xb214('0x8e'),'DESC']]}]},{'model':db[_0xb214('0x9c')],'as':_0xb214('0x9d')}]});})['then'](handleEntityNotFound(_0x1b953a,null))[_0xb214('0x1e')](function(_0x5794be){if(_0x5794be&&_0x5794be[_0xb214('0x9e')]){_0x1561b2[_0xb214('0x9f')]=_0x5794be;_0x1561b2[_0xb214('0xa0')]=_0x5794be['Applications'];_0x1561b2[_0xb214('0xa1')]=_0x5794be['List'];_0x1561b2[_0xb214('0xa0')]=_['orderBy'](_0x1561b2[_0xb214('0xa0')],[_0xb214('0xa2')],[_0xb214('0xa3')]);if(_0x1561b2['account']['Applications']){delete _0x1561b2[_0xb214('0x9f')][_0xb214('0x9d')];}if(_0x1561b2['account'][_0xb214('0x9e')]&&_0x1561b2[_0xb214('0x9f')]['List'][_0xb214('0x9b')][_0xb214('0x46')]){return _0x1561b2[_0xb214('0x9f')][_0xb214('0x9e')]['Contacts'][0x0];}var _0x2f87d5=_[_0xb214('0x17')](_0x177131[_0xb214('0x58')],{'firstName':_0x177131[_0xb214('0x58')][_0xb214('0x99')],'ListId':_0x5794be[_0xb214('0x92')]});_0x2f87d5[_0x177131['body']['mapKey']]=_0x177131[_0xb214('0x58')][_0xb214('0x99')];return db['CmContact']['create'](_0x2f87d5,{'fields':_0xc12cd3,'raw':!![]});}})[_0xb214('0x1e')](handleEntityNotFound(_0x1b953a,null))['then'](function(_0x3fcec8){_0x1561b2[_0xb214('0xa4')]=_0x3fcec8;var _0x135bdc=_0x177131[_0xb214('0x58')][_0xb214('0xa5')];if(_0x177131['headers'][_0xb214('0xa6')]){_0x135bdc=_0x177131[_0xb214('0x87')][_0xb214('0xa6')];}else if(_0x177131[_0xb214('0x87')]['x-forwarded-for']){_0x135bdc=_[_0xb214('0xa7')](_0x177131['headers'][_0xb214('0xa8')][_0xb214('0xa9')](','));}if(_0x3fcec8){var _0x56d1e1={'ContactId':_0x3fcec8['id'],'ChatWebsiteId':_0x177131[_0xb214('0x5e')]['id'],'from':(_0x3fcec8[_0xb214('0xaa')]||'')+'\x20'+(_0x3fcec8[_0xb214('0xab')]||''),'customerIp':_0x135bdc,'customerPort':_0x177131[_0xb214('0x87')]['x-real-port']?_0x177131[_0xb214('0x87')][_0xb214('0xac')]:null,'referer':_0x177131[_0xb214('0x58')][_0xb214('0xad')],'browserName':_0x4750e6[_0xb214('0xae')][_0xb214('0x38')]&&_0x4750e6[_0xb214('0xae')][_0xb214('0xaf')]?util[_0xb214('0xb0')](_0xb214('0xb1'),_0x4750e6[_0xb214('0xae')][_0xb214('0x38')],_0x4750e6[_0xb214('0xae')][_0xb214('0xaf')]):_0xb214('0xb2'),'browserVersion':_0x4750e6[_0xb214('0xae')][_0xb214('0xaf')]||_0xb214('0xb2'),'osName':util[_0xb214('0xb0')](_0xb214('0xb1'),_0x4750e6['os'][_0xb214('0x38')],_0x4750e6['os'][_0xb214('0xaf')]),'osVersion':_0x4750e6['os'][_0xb214('0xaf')],'deviceModel':_0x4750e6[_0xb214('0xb3')][_0xb214('0x41')]&&_0x4750e6[_0xb214('0xb3')][_0xb214('0xb4')]?util[_0xb214('0xb0')](_0xb214('0xb5'),_0x4750e6[_0xb214('0xb3')]['model'],_0x4750e6[_0xb214('0xb3')][_0xb214('0xb4')],_0x4750e6['device']['type']):null,'deviceVendor':_0x4750e6['device']['vendor'],'deviceType':_0x4750e6[_0xb214('0xb3')]['type'],'formData':JSON[_0xb214('0x24')](_0x177131[_0xb214('0x58')])};var _0x4e6f4f={'ChatWebsiteId':_0x177131[_0xb214('0x5e')]['id'],'closed':![]};if(_0x177131[_0xb214('0x58')][_0xb214('0xb6')]){_0x4e6f4f[_0xb214('0xb6')]=_0x177131['body'][_0xb214('0xb6')];return db['ChatInteraction'][_0xb214('0x56')]({'where':_0x4e6f4f})[_0xb214('0x1e')](function(_0x3f0f78){if(_0x3f0f78){return[_0x3f0f78,![]];}_0x56d1e1[_0xb214('0xb6')]=_0x177131[_0xb214('0x58')][_0xb214('0xb6')];_0x56d1e1['externalUrl']=_0x177131[_0xb214('0x58')][_0xb214('0xb7')];return db[_0xb214('0xb8')][_0xb214('0x57')](_0x56d1e1)[_0xb214('0x1e')](function(_0x384da1){return[_0x384da1,!![]];});});}_0x4e6f4f[_0xb214('0xb9')]=_0x3fcec8['id'];if(_0x177131[_0xb214('0x58')][_0xb214('0xba')]&&_0x177131[_0xb214('0x58')]['interaction']['id']){_0x4e6f4f['id']=_0x177131[_0xb214('0x58')]['interaction']['id'];return db[_0xb214('0xb8')][_0xb214('0x56')]({'where':_0x4e6f4f})[_0xb214('0x1e')](function(_0x3c3ecf){if(_0x3c3ecf){return[_0x3c3ecf,![]];}return db[_0xb214('0xb8')]['create'](_0x56d1e1)[_0xb214('0x1e')](function(_0x3ff41e){return[_0x3ff41e,!![]];});});}return db[_0xb214('0xb8')]['create'](_0x56d1e1)[_0xb214('0x1e')](function(_0x1c2dfe){return[_0x1c2dfe,!![]];});}})[_0xb214('0xbb')](function(_0x22a991,_0x9737a9){if(_0x22a991){_0x18b7a6=_0x9737a9;if(!_0x9737a9){var _0x15a5fa={'from':(_0x1561b2['contact'][_0xb214('0xaa')]||'')+'\x20'+(_0x1561b2[_0xb214('0xa4')][_0xb214('0xab')]||'')};if(_0x177131[_0xb214('0x58')]['threadId']&&_0x177131[_0xb214('0x58')][_0xb214('0xbc')]&&_0x177131[_0xb214('0x58')][_0xb214('0xb6')]!=_0x177131[_0xb214('0x58')][_0xb214('0xbc')]){_0x15a5fa[_0xb214('0xb6')]=_0x177131[_0xb214('0x58')][_0xb214('0xbc')];}return _0x22a991[_0xb214('0x33')](_0x15a5fa);}else{return _0x22a991;}}})['then'](function(_0x119dc0){_0x1561b2[_0xb214('0xba')]=_0x119dc0[_0xb214('0x34')]({'plain':!![]});_0x1561b2[_0xb214('0xba')][_0xb214('0xbd')]=_0x18b7a6;if(_0x1561b2[_0xb214('0xba')]['created']){if(_0x1561b2[_0xb214('0x9f')][_0xb214('0xbe')]){_0x1561b2[_0xb214('0xa0')][_0xb214('0xbf')]({'id':0x0,'priority':_0x1561b2[_0xb214('0xa0')][_0xb214('0x46')]+0x1,'app':_0xb214('0xc0'),'appdata':_0xb214('0xc1'),'interval':_0xb214('0xc2')});}}return db['ChatMessage'][_0xb214('0x57')]({'body':_0x177131[_0xb214('0x58')][_0xb214('0x58')],'ChatWebsiteId':_0x177131[_0xb214('0x5e')]['id'],'ChatInteractionId':_0x119dc0['id'],'direction':'in','ContactId':_0x1561b2[_0xb214('0xa4')]['id'],'AttachmentId':_0x177131['body'][_0xb214('0xc3')]});})[_0xb214('0x1e')](function(_0x166f27){_0x1561b2[_0xb214('0x26')]=_0x166f27;if(_0x1561b2[_0xb214('0xba')][_0xb214('0xc4')]){return db[_0xb214('0xc5')][_0xb214('0x56')]({'attributes':['id',_0xb214('0x38')],'where':{'id':_0x1561b2['interaction']['UserId']}})[_0xb214('0x1e')](function(_0x5c37ea){if(_0x5c37ea){_0x1561b2[_0xb214('0xa0')][_0xb214('0xc6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5c37ea[_0xb214('0x38')]+','+(_0x1561b2[_0xb214('0x9f')]['waitForTheAssignedAgent']||0xa),'interval':_0xb214('0xc2')});_0x1561b2[_0xb214('0xc7')]=!![];}return respondWithRpcPromise('Start',_0xb214('0xc8'),_0x1561b2);});}return respondWithRpcPromise(_0xb214('0xc9'),_0xb214('0xc8'),_0x1561b2);})['then'](function(_0x525a98){respondWithRpcPromise(_0xb214('0xca'),_0xb214('0xca'),{'event':_0xb214('0x84'),'message':_0x525a98},client9002);return _0x525a98;})[_0xb214('0x1e')](respondWithResult(_0x1b953a,null))[_0xb214('0x27')](handleError(_0x1b953a,null));};exports[_0xb214('0xcb')]=function(_0x1ca1d0,_0x4327d0,_0x51408d){var _0x32f117,_0x3ab575,_0x224426;var _0x9cefb7=[];var _0x3e1dea=[];var _0x58562e={};return db['CmContact'][_0xb214('0x60')]()[_0xb214('0x1e')](function(_0x424474){if(!_0x424474){throw new db[(_0xb214('0x93'))][(_0xb214('0x8c'))](_0xb214('0x8d'));}_0x3e1dea=_[_0xb214('0x8f')](_[_0xb214('0x43')](_0x424474),[_0xb214('0x90'),_0xb214('0x8e')]);_0x9cefb7=_[_0xb214('0x8f')](_[_0xb214('0x43')](_0x424474),[_0xb214('0x90'),_0xb214('0x8e'),_0xb214('0x91'),_0xb214('0x92')]);if(_0x1ca1d0[_0xb214('0x58')]['id']){delete _0x1ca1d0[_0xb214('0x58')]['id'];}if(_['isNil'](_0x1ca1d0[_0xb214('0x58')][_0xb214('0x99')])){throw _0x4327d0['status'](0x1f4)[_0xb214('0x39')](new db[(_0xb214('0x93'))][(_0xb214('0x8c'))]('from\x20is\x20mandatory'));}if(_[_0xb214('0x77')](_0x1ca1d0[_0xb214('0x58')]['body'])||_0x1ca1d0[_0xb214('0x58')][_0xb214('0x58')]===''){throw _0x4327d0[_0xb214('0x29')](0x1f4)[_0xb214('0x39')](new db[(_0xb214('0x93'))][(_0xb214('0x8c'))](_0xb214('0x94')));}if(_[_0xb214('0x77')](_0x1ca1d0[_0xb214('0x58')][_0xb214('0xcc')])){throw _0x4327d0[_0xb214('0x29')](0x1f4)['send'](new db[(_0xb214('0x93'))][(_0xb214('0x8c'))](_0xb214('0xcd')+_0x9cefb7));}if(!_['includes'](_0x9cefb7,_0x1ca1d0[_0xb214('0x58')][_0xb214('0xcc')])){throw _0x4327d0[_0xb214('0x29')](0x1f4)[_0xb214('0x39')](new db[(_0xb214('0x93'))]['ValidationError'](_0xb214('0xce')+_0x9cefb7));}_0x58562e[_0x1ca1d0['body'][_0xb214('0xcc')]]=_0x1ca1d0[_0xb214('0x58')][_0xb214('0x99')];})[_0xb214('0x1e')](function(){return db['ChatWebsite'][_0xb214('0x56')]({'where':{'id':_0x1ca1d0[_0xb214('0x5e')]['id']},'include':[{'model':db[_0xb214('0x9a')],'as':_0xb214('0x9e')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x4327d0,null))[_0xb214('0x1e')](function(_0x2cd1c2){if(_0x2cd1c2&&_0x2cd1c2[_0xb214('0x9e')]){_0x3ab575=_0x2cd1c2;var _0xcd72a6=_[_0xb214('0x17')](_0x1ca1d0[_0xb214('0x58')],{'firstName':_0x1ca1d0[_0xb214('0x58')]['from'],'phone':_0x1ca1d0[_0xb214('0x58')]['from'],'ListId':_0x2cd1c2[_0xb214('0x92')]});_0xcd72a6[_0x1ca1d0['body'][_0xb214('0xcc')]]=_0x1ca1d0[_0xb214('0x58')][_0xb214('0x99')];return db[_0xb214('0x8b')]['findOrCreate']({'where':_0x58562e,'defaults':_0xcd72a6});}})[_0xb214('0xbb')](function(_0x105d77){if(_0x105d77){_0x224426=_0x105d77;var _0x44b038=fs[_0xb214('0xcf')](path[_0xb214('0x71')](config[_0xb214('0x72')],'server/files/templates/chatOfflineMessage.ejs'),_0xb214('0xd0'));var _0x39addf=ejs[_0xb214('0xd1')](_0x44b038,{'body':_[_0xb214('0xd2')](_0x1ca1d0[_0xb214('0x58')][_0xb214('0x58')]),'bodyTitle':_0x3ab575[_0xb214('0xd3')]});return db[_0xb214('0xd4')]['create']({'body':_0x39addf,'ContactId':_0x105d77['id'],'ChatWebsiteId':_0x3ab575['id']});}})['then'](function(_0xadd99c){if(_0xadd99c){_0x32f117=_0xadd99c;return db['MailAccount'][_0xb214('0x63')]({'where':{'service':!![]},'include':[{'model':db[_0xb214('0xd5')],'as':_0xb214('0xd6'),'raw':!![]}]});}})[_0xb214('0x1e')](function(_0x25e185){if(_0x25e185&&_0x25e185[_0xb214('0xd6')]&&_0x3ab575[_0xb214('0xd7')]&&_0x3ab575['forwardOfflineAddress']){var _0x26ce2c={'tls':{'rejectUnauthorized':![]}};if(_0x25e185['Smtp'][_0xb214('0xd8')]){_0x26ce2c[_0xb214('0xd8')]=_0x25e185[_0xb214('0xd6')][_0xb214('0xd8')];}else{_0x26ce2c[_0xb214('0xd9')]=_0x25e185[_0xb214('0xd6')][_0xb214('0xd9')];_0x26ce2c[_0xb214('0xda')]=_0x25e185[_0xb214('0xd6')]['port'];_0x26ce2c[_0xb214('0xdb')]=_0x25e185['Smtp'][_0xb214('0xdb')];}if(_0x25e185[_0xb214('0xd6')][_0xb214('0xdc')]){_0x26ce2c[_0xb214('0xdd')]={'user':_0x25e185['Smtp'][_0xb214('0x59')],'pass':_0x25e185[_0xb214('0xd6')][_0xb214('0xde')]};}return respondWithRpcPromise(_0xb214('0xdf'),_0xb214('0xe0'),{'account':_0x26ce2c,'message':{'from':util[_0xb214('0xb0')](_0xb214('0xe1'),_0x25e185['name'],_0x25e185[_0xb214('0xe2')]||_0x25e185['Smtp'][_0xb214('0x59')]),'to':_0x3ab575[_0xb214('0xe3')],'subject':_0x3ab575[_0xb214('0xe4')],'text':_0x32f117[_0xb214('0x58')]}},client9003)[_0xb214('0x1e')](function(){return _0x32f117;})[_0xb214('0x27')](function(_0x1d88c9){console['error'](_0x1d88c9);});}})[_0xb214('0x1e')](function(){if(_0x3ab575&&_0x3ab575[_0xb214('0xe5')]&&_0x3ab575[_0xb214('0xe6')]){var _0x96adb8={'from':_0x224426[_0xb214('0xe2')],'firstName':_0x224426[_0xb214('0xaa')],'lastName':_0x224426[_0xb214('0xab')],'mapKey':_0xb214('0xe2'),'message':{'from':_0x224426['email'],'to':_0x3ab575[_0xb214('0xe7')][_0xb214('0xe2')],'cc':'','subject':_0x3ab575[_0xb214('0xe4')],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0xb214('0xe8'),'ChatWebsiteId':_0x3ab575['id'],'ChatOfflineMessageId':_0x32f117['id'],'originTo':_0x3ab575[_0xb214('0xe7')][_0xb214('0xe2')]},'body':_0x32f117[_0xb214('0x58')]};var _0x2d435a={'account':{'id':_0x3ab575[_0xb214('0xe6')]},'body':_0x96adb8,'log':_0xb214('0xe9')};return respondWithRpcPromise(_0xb214('0xe9'),'notifyMail',_0x2d435a,client9001)[_0xb214('0x1e')](function(){return _0x32f117;})[_0xb214('0x27')](function(_0x1492bb){console[_0xb214('0x25')](_0x1492bb);});}return;})[_0xb214('0x1e')](function(){if(_0x32f117){return _0x32f117;}})[_0xb214('0x1e')](respondWithResult(_0x4327d0,null))[_0xb214('0x27')](handleError(_0x4327d0,null));};exports[_0xb214('0xea')]=function(_0x1dfd6a,_0x366a85,_0x2a7f8d){return db[_0xb214('0xb8')][_0xb214('0x56')]({'where':{'id':_0x1dfd6a[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x366a85,null))['then'](function(_0x2bbab6){if(_0x2bbab6){return _0x2bbab6[_0xb214('0xea')](_0x1dfd6a[_0xb214('0x58')][_0xb214('0x66')],_[_0xb214('0xeb')](_0x1dfd6a['body'],[_0xb214('0x66'),'id'])||{});}})[_0xb214('0x1e')](respondWithResult(_0x366a85,null))[_0xb214('0x27')](handleError(_0x366a85,null));};exports[_0xb214('0xec')]=function(_0xd127b0,_0x444656,_0x5d6994){var _0x3ad98a={'raw':![],'where':{}};var _0x8ddf7e={};var _0x2eb1f7={'count':0x0,'rows':[]};return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0xd127b0[_0xb214('0x5e')]['id']}})['then'](handleEntityNotFound(_0x444656,null))['then'](function(_0x35b747){if(_0x35b747){_0x8ddf7e[_0xb214('0x41')]=_[_0xb214('0x43')](db['ChatInteraction'][_0xb214('0x3e')]);_0x8ddf7e[_0xb214('0x42')]=_[_0xb214('0x43')](_0xd127b0[_0xb214('0x42')]);_0x8ddf7e[_0xb214('0x4b')]=_[_0xb214('0x44')](_0x8ddf7e[_0xb214('0x41')],_0x8ddf7e[_0xb214('0x42')]);_0x3ad98a['attributes']=_[_0xb214('0x44')](_0x8ddf7e[_0xb214('0x41')],qs[_0xb214('0x53')](_0xd127b0['query'][_0xb214('0x53')]));_0x3ad98a[_0xb214('0x45')]=_0x3ad98a[_0xb214('0x45')]['length']?_0x3ad98a[_0xb214('0x45')]:_0x8ddf7e[_0xb214('0x41')];if(!_0xd127b0[_0xb214('0x42')][_0xb214('0x47')]('nolimit')){_0x3ad98a[_0xb214('0x2c')]=qs[_0xb214('0x2c')](_0xd127b0[_0xb214('0x42')][_0xb214('0x2c')]);_0x3ad98a[_0xb214('0x2b')]=qs[_0xb214('0x2b')](_0xd127b0[_0xb214('0x42')][_0xb214('0x2b')]);}_0x3ad98a['order']=qs[_0xb214('0x64')](_0xd127b0[_0xb214('0x42')]['sort']);_0x3ad98a[_0xb214('0x4a')]=qs[_0xb214('0x4b')](_[_0xb214('0x4c')](_0xd127b0[_0xb214('0x42')],_0x8ddf7e[_0xb214('0x4b')]));_0x3ad98a[_0xb214('0x4a')][_0xb214('0x68')]=_0x35b747['id'];if(_0xd127b0[_0xb214('0x42')][_0xb214('0x4d')]){_0x3ad98a['where']=_[_0xb214('0x4e')](_0x3ad98a[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0x3ad98a['attributes'],function(_0x53bf17){var _0xa8da4f={};_0xa8da4f[_0x53bf17]={'$like':'%'+_0xd127b0[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0xa8da4f;})});}_0x3ad98a=_['merge']({},_0x3ad98a,_0xd127b0[_0xb214('0x55')]);return db[_0xb214('0xb8')][_0xb214('0x2a')]({'where':_0x3ad98a[_0xb214('0x4a')]})['then'](function(_0x19e3da){_0x2eb1f7['count']=_0x19e3da;if(_0xd127b0[_0xb214('0x42')]['includeAll']){_0x3ad98a[_0xb214('0x54')]=[{'model':db[_0xb214('0x8b')],'as':_0xb214('0xed'),'required':![]},{'model':db[_0xb214('0xc5')],'as':_0xb214('0xee'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xb214('0xef')],'as':'Tags','attributes':['id','name',_0xb214('0xf0')],'where':_0xd127b0[_0xb214('0x42')][_0xb214('0xf1')]?{'id':_0xd127b0[_0xb214('0x42')]['tag']}:undefined,'required':_0xd127b0[_0xb214('0x42')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xb214('0x65')](_0x3ad98a);})[_0xb214('0x1e')](function(_0x6445c2){_0x2eb1f7[_0xb214('0x52')]=_0x6445c2;return _0x2eb1f7;});}})[_0xb214('0x1e')](respondWithFilteredResult(_0x444656,_0x3ad98a))[_0xb214('0x27')](handleError(_0x444656,null));};function iftimePromise(_0x58c07f,_0x3cae76){return respondWithRpcPromise(_0xb214('0xf2'),'getSnippet',{'command':_0x3cae76[_0xb214('0xf3')]?util[_0xb214('0xb0')]('iftime\x20%s,%s',_0x58c07f[_0xb214('0xf4')],_0x3cae76['timezone']):util['format'](_0xb214('0xf5'),_0x58c07f['interval'])},client9002)[_0xb214('0x1e')](function(_0x260569){var _0x2ea16b=_0x260569&&_0x260569['indexOf'](_0xb214('0xf6'))>=0x0?!![]:![];logger[_0xb214('0x1f')](_0xb214('0xf7'),_0x3cae76['id'],_0x58c07f['id'],_0x58c07f[_0xb214('0xf4')],_0x2ea16b?_0xb214('0xf8'):_0xb214('0xf9'),_0x3cae76['timezone']?_0x3cae76['timezone']:_0xb214('0xfa'));return _0x2ea16b;})['catch'](function(_0xaded29){logger[_0xb214('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3cae76['id'],_0x58c07f['id'],_0x58c07f[_0xb214('0xf4')],util[_0xb214('0xfb')](_0xaded29,{'showHidden':![],'depth':null}),_0x3cae76[_0xb214('0xf3')]?_0x3cae76[_0xb214('0xf3')]:'No\x20timezone');return![];});}exports[_0xb214('0xfc')]=function(_0x39a865,_0x5edc81,_0x5466cf){var _0x6eba01=0x0;var _0xe36182=0x0;var _0x5e4548=![];var _0x174ab9;var _0x2cf844;return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x39a865['params']['id']},'include':[{'model':db[_0xb214('0xfd')],'as':_0xb214('0xfd'),'include':[{'model':db[_0xb214('0xfd')],'as':_0xb214('0xfe'),'attributes':['id',_0xb214('0xf4')],'raw':!![]}]}]})[_0xb214('0x1e')](handleEntityNotFound(_0x5edc81,null))['then'](function(_0x4e513f){if(_0x4e513f){_0x174ab9=_0x4e513f;return _0x4e513f[_0xb214('0xff')]({'raw':!![]});}})[_0xb214('0x1e')](function(_0x1297d4){if(_0x174ab9){if(_0x1297d4){_0x2cf844=_0x1297d4;}}return require(_0xb214('0x75'))[_0xb214('0x76')]();})[_0xb214('0x1e')](function(_0x22de90){if(_0x22de90){_0xe36182=_0x22de90[_0xb214('0x100')];_0x5e4548=_0x22de90['custom'];}})['then'](function(){return db[_0xb214('0xb8')]['count']({'where':{'closed':![]}});})[_0xb214('0x1e')](function(_0x240b04){_0x6eba01=_0x240b04;if(_0xe36182&&_0x240b04>_0xe36182){return db['License'][_0xb214('0x63')]({'where':{'id':0x1}})[_0xb214('0x1e')](function(_0xaa3135){if(_0xaa3135){_0xaa3135[_0xb214('0x101')]('chatLicenseExceeded');}});}})[_0xb214('0x1e')](function(){if(_0x174ab9['Interval']&&_0x174ab9[_0xb214('0xfd')][_0xb214('0xfe')]){var _0x16afe2=[];for(var _0x5674e3=0x0;_0x5674e3<_0x174ab9[_0xb214('0xfd')]['Intervals'][_0xb214('0x46')];_0x5674e3++){var _0xd6b1a3=_0x174ab9[_0xb214('0xfd')][_0xb214('0xfe')][_0x5674e3][_0xb214('0x34')]({'plain':!![]});_0x16afe2['push'](iftimePromise(_0xd6b1a3,_0x174ab9));}return BPromise[_0xb214('0x102')](_0x16afe2)['then'](function(_0x5cf2d0){return _[_0xb214('0x103')](_0x5cf2d0);});}else{return!![];}})[_0xb214('0x1e')](function(_0x4d1a99){var _0x951f0=fs['readFileSync'](path[_0xb214('0x71')](config[_0xb214('0x72')],_0xb214('0x104')),'utf8');var _0xd70a66={'remote':_0x174ab9[_0xb214('0x105')],'query':querystring[_0xb214('0x24')](_[_0xb214('0x4e')](_0x174ab9[_0xb214('0x34')]({'plain':!![]}),{'customerIp':_0x39a865[_0xb214('0x87')]['x-forwarded-for']||_0x39a865['headers'][_0xb214('0x106')]||_0x39a865['connection']['remoteAddress']||_0x39a865['ip'],'referer':_0x39a865['headers']['referer'],'openedInteractions':_0x6eba01,'maxInteractions':_0xe36182,'virtual':_0x5e4548[_0xb214('0x100')],'online':_0x4d1a99,'custom':_0x5e4548}))['replace'](/'/g,'\x5c\x27')};_0x5edc81[_0xb214('0x39')](ejs['render'](Mustache[_0xb214('0xd1')](_0x951f0,_0xd70a66),{'proactiveActions':_0x2cf844,'alignment':_0x174ab9[_0xb214('0x107')],'verticalAlignment':_0x174ab9['verticalAlignment'],'div_color':_0x174ab9[_0xb214('0xf0')],'text_color':_0x174ab9[_0xb214('0x108')]}));})[_0xb214('0x27')](handleError(_0x5edc81,null));};exports[_0xb214('0x109')]=function(_0x40769d,_0x5a72b1,_0x2cc6c4){return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0x40769d[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x5a72b1,null))[_0xb214('0x1e')](function(_0x3eac12){if(_0x3eac12){return db[_0xb214('0x10a')]['transaction'](function(_0x1d5815){return db[_0xb214('0x9c')][_0xb214('0x5f')]({'where':{'ChatWebsiteId':_0x40769d[_0xb214('0x5e')]['id']},'transaction':_0x1d5815})[_0xb214('0x1e')](function(_0x96cf55){var _0x54330a=_[_0xb214('0x3d')](_0x40769d['body'],function(_0x2347ba){_0x2347ba[_0xb214('0x68')]=_0x40769d[_0xb214('0x5e')]['id'];return _0x2347ba;});return db[_0xb214('0x9c')][_0xb214('0x10b')](_0x54330a,{'transaction':_0x1d5815});});})['then'](function(){return db[_0xb214('0x9c')][_0xb214('0x10c')]({'where':{'ChatWebsiteId':_0x40769d[_0xb214('0x5e')]['id']},'order':'priority'});});}})[_0xb214('0x1e')](respondWithResult(_0x5a72b1,null))['catch'](handleError(_0x5a72b1,null));};exports['getApplications']=function(_0x26c407,_0xf0c140,_0x5ceeac){var _0x455055={};var _0x3c1b66={};var _0x1df57d;var _0x17ee19;return db[_0xb214('0x50')]['findOne']({'where':{'id':_0x26c407[_0xb214('0x5e')]['id']}})['then'](handleEntityNotFound(_0xf0c140,null))[_0xb214('0x1e')](function(_0x3acaf5){if(_0x3acaf5){_0x1df57d=_0x3acaf5;_0x3c1b66[_0xb214('0x41')]=_[_0xb214('0x43')](db['ChatApplication'][_0xb214('0x3e')]);_0x3c1b66[_0xb214('0x42')]=_['keys'](_0x26c407[_0xb214('0x42')]);_0x3c1b66[_0xb214('0x4b')]=_['intersection'](_0x3c1b66['model'],_0x3c1b66[_0xb214('0x42')]);_0x455055[_0xb214('0x45')]=_[_0xb214('0x44')](_0x3c1b66[_0xb214('0x41')],qs[_0xb214('0x53')](_0x26c407['query']['fields']));_0x455055[_0xb214('0x45')]=_0x455055[_0xb214('0x45')][_0xb214('0x46')]?_0x455055[_0xb214('0x45')]:_0x3c1b66['model'];_0x455055[_0xb214('0x49')]=qs['sort'](_0x26c407[_0xb214('0x42')]['sort']);_0x455055[_0xb214('0x4a')]=qs['filters'](_[_0xb214('0x4c')](_0x26c407[_0xb214('0x42')],_0x3c1b66[_0xb214('0x4b')]));if(_0x26c407['query'][_0xb214('0x4d')]){_0x455055[_0xb214('0x4a')]=_[_0xb214('0x4e')](_0x455055[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0x455055['attributes'],function(_0xf811d5){var _0x34b14b={};_0x34b14b[_0xf811d5]={'$like':'%'+_0x26c407[_0xb214('0x42')]['filter']+'%'};return _0x34b14b;})});}_0x455055=_[_0xb214('0x4e')]({},_0x455055,_0x26c407[_0xb214('0x55')]);return _0x1df57d[_0xb214('0x10d')](_0x455055);}})[_0xb214('0x1e')](function(_0x1b0614){if(_0x1b0614){_0x17ee19=_0x1b0614['length'];if(!_0x26c407[_0xb214('0x42')][_0xb214('0x47')](_0xb214('0x48'))){_0x455055['limit']=qs['limit'](_0x26c407[_0xb214('0x42')]['limit']);_0x455055['offset']=qs[_0xb214('0x2b')](_0x26c407['query'][_0xb214('0x2b')]);}return _0x1df57d[_0xb214('0x10d')](_0x455055);}})['then'](function(_0x52c73d){if(_0x52c73d){return _0x52c73d?{'count':_0x17ee19,'rows':_0x52c73d}:null;}})['then'](respondWithResult(_0xf0c140,null))[_0xb214('0x27')](handleError(_0xf0c140,null));};exports[_0xb214('0x10e')]=function(_0x1dff9e,_0xa63df3,_0x5053bd){return db[_0xb214('0x10f')]['find']({'where':{'id':_0x1dff9e[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0xa63df3,null))['then'](function(_0x518971){if(_0x518971){return _0x518971['addProactiveActions'](_0x1dff9e[_0xb214('0x58')]['ids'],_[_0xb214('0xeb')](_0x1dff9e[_0xb214('0x58')],['ids','id'])||{});}})[_0xb214('0x1e')](respondWithResult(_0xa63df3,null))[_0xb214('0x27')](handleError(_0xa63df3,null));};exports[_0xb214('0xff')]=function(_0x520f88,_0x11406c,_0x38498e){var _0x319865={};var _0x6e7e48={};var _0x58396d;var _0x13e4cb;return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0x520f88[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x11406c,null))[_0xb214('0x1e')](function(_0x343922){if(_0x343922){_0x58396d=_0x343922;_0x6e7e48['model']=_[_0xb214('0x43')](db['ChatProactiveAction'][_0xb214('0x3e')]);_0x6e7e48[_0xb214('0x42')]=_[_0xb214('0x43')](_0x520f88[_0xb214('0x42')]);_0x6e7e48[_0xb214('0x4b')]=_[_0xb214('0x44')](_0x6e7e48[_0xb214('0x41')],_0x6e7e48['query']);_0x319865['attributes']=_[_0xb214('0x44')](_0x6e7e48[_0xb214('0x41')],qs['fields'](_0x520f88['query'][_0xb214('0x53')]));_0x319865[_0xb214('0x45')]=_0x319865[_0xb214('0x45')][_0xb214('0x46')]?_0x319865[_0xb214('0x45')]:_0x6e7e48['model'];_0x319865[_0xb214('0x49')]=qs[_0xb214('0x64')](_0x520f88['query'][_0xb214('0x64')]);_0x319865['where']=qs[_0xb214('0x4b')](_['pick'](_0x520f88[_0xb214('0x42')],_0x6e7e48[_0xb214('0x4b')]));if(_0x520f88[_0xb214('0x42')][_0xb214('0x4d')]){_0x319865['where']=_[_0xb214('0x4e')](_0x319865[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0x319865['attributes'],function(_0x5793c4){var _0x2978b2={};_0x2978b2[_0x5793c4]={'$like':'%'+_0x520f88[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x2978b2;})});}_0x319865=_[_0xb214('0x4e')]({},_0x319865,_0x520f88['options']);return _0x58396d['getProactiveActions'](_0x319865);}})['then'](function(_0x22547c){if(_0x22547c){_0x13e4cb=_0x22547c[_0xb214('0x46')];if(!_0x520f88[_0xb214('0x42')][_0xb214('0x47')]('nolimit')){_0x319865[_0xb214('0x2c')]=qs[_0xb214('0x2c')](_0x520f88[_0xb214('0x42')][_0xb214('0x2c')]);_0x319865[_0xb214('0x2b')]=qs['offset'](_0x520f88[_0xb214('0x42')][_0xb214('0x2b')]);}return _0x58396d[_0xb214('0xff')](_0x319865);}})[_0xb214('0x1e')](function(_0x5e611){if(_0x5e611){return _0x5e611?{'count':_0x13e4cb,'rows':_0x5e611}:null;}})[_0xb214('0x1e')](respondWithResult(_0x11406c,null))[_0xb214('0x27')](handleError(_0x11406c,null));};exports['getFields']=function(_0x16343b,_0xc06cf8,_0x511bc8){var _0x181970=_0x16343b['query']['online']===_0xb214('0x110')?_0xb214('0x111'):_0xb214('0x112');return db[_0xb214('0x50')][_0xb214('0x56')]({'attributes':['id',_0x181970],'where':{'id':_0x16343b[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0xc06cf8,null))[_0xb214('0x1e')](function(_0x574bf7){if(_0x574bf7){var _0x224756=_0x574bf7[_0x181970];var _0x4572ef=_0x224756&&_0x224756[_0xb214('0x113')]?_0x224756[_0xb214('0x113')]:[];_0xc06cf8[_0xb214('0x39')]({'fromKey':_[_0xb214('0x77')](_0x224756[_0xb214('0x114')])?undefined:_0x224756[_0xb214('0x114')],'count':_0x4572ef['length'],'rows':_0x4572ef});}})['catch'](handleError(_0xc06cf8,null));};exports[_0xb214('0x115')]=function(_0x5a7584,_0x206048,_0x1fabdd){var _0xd268ef={'raw':![],'where':{}};var _0x5bdecc={};var _0x2b0bf3={'count':0x0,'rows':[]};return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0x5a7584['params']['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x206048,null))['then'](function(_0x4a42d3){if(_0x4a42d3){_0x5bdecc['model']=_[_0xb214('0x43')](db[_0xb214('0xd4')][_0xb214('0x3e')]);_0x5bdecc[_0xb214('0x42')]=_[_0xb214('0x43')](_0x5a7584[_0xb214('0x42')]);_0x5bdecc[_0xb214('0x4b')]=_[_0xb214('0x44')](_0x5bdecc[_0xb214('0x41')],_0x5bdecc[_0xb214('0x42')]);_0xd268ef[_0xb214('0x45')]=_['intersection'](_0x5bdecc[_0xb214('0x41')],qs[_0xb214('0x53')](_0x5a7584[_0xb214('0x42')]['fields']));_0xd268ef[_0xb214('0x45')]=_0xd268ef[_0xb214('0x45')][_0xb214('0x46')]?_0xd268ef[_0xb214('0x45')]:_0x5bdecc[_0xb214('0x41')];if(!_0x5a7584[_0xb214('0x42')][_0xb214('0x47')](_0xb214('0x48'))){_0xd268ef[_0xb214('0x2c')]=qs[_0xb214('0x2c')](_0x5a7584[_0xb214('0x42')][_0xb214('0x2c')]);_0xd268ef[_0xb214('0x2b')]=qs[_0xb214('0x2b')](_0x5a7584[_0xb214('0x42')][_0xb214('0x2b')]);}_0xd268ef[_0xb214('0x49')]=qs[_0xb214('0x64')](_0x5a7584[_0xb214('0x42')][_0xb214('0x64')]);_0xd268ef[_0xb214('0x4a')]=qs[_0xb214('0x4b')](_['pick'](_0x5a7584[_0xb214('0x42')],_0x5bdecc[_0xb214('0x4b')]));_0xd268ef[_0xb214('0x4a')][_0xb214('0x68')]=_0x4a42d3['id'];if(_0x5a7584[_0xb214('0x42')]['filter']){_0xd268ef[_0xb214('0x4a')]=_[_0xb214('0x4e')](_0xd268ef[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0xd268ef['attributes'],function(_0xd48fef){var _0x168978={};_0x168978[_0xd48fef]={'$like':'%'+_0x5a7584[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x168978;})});}_0xd268ef=_[_0xb214('0x4e')]({},_0xd268ef,_0x5a7584[_0xb214('0x55')]);return db[_0xb214('0xd4')]['count']({'where':_0xd268ef[_0xb214('0x4a')]})[_0xb214('0x1e')](function(_0x543466){_0x2b0bf3[_0xb214('0x2a')]=_0x543466;if(_0x5a7584['query'][_0xb214('0x51')]){_0xd268ef[_0xb214('0x54')]=[{'all':!![]}];}else{_0xd268ef[_0xb214('0x54')]=[{'model':db[_0xb214('0x8b')],'as':'Contact','required':![]}];}return db[_0xb214('0xd4')][_0xb214('0x65')](_0xd268ef);})[_0xb214('0x1e')](function(_0x372a51){_0x2b0bf3[_0xb214('0x52')]=_0x372a51;return _0x2b0bf3;});}})[_0xb214('0x1e')](respondWithFilteredResult(_0x206048,_0xd268ef))[_0xb214('0x27')](handleError(_0x206048,null));};exports[_0xb214('0x116')]=function(_0x9dc96e,_0xe9b009,_0x2237d7){return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x9dc96e[_0xb214('0x5e')]['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0xe9b009,null))[_0xb214('0x1e')](function(_0x5625ba){if(_0x5625ba){return _0x5625ba[_0xb214('0x116')](_0x9dc96e['body'][_0xb214('0x66')],_[_0xb214('0xeb')](_0x9dc96e['body'],['ids','id'])||{})['spread'](function(_0x37c5f3){for(var _0x5d81e1=0x0;_0x5d81e1<_0x9dc96e[_0xb214('0x58')][_0xb214('0x66')][_0xb214('0x46')];_0x5d81e1+=0x1){socket[_0xb214('0x117')](_0xb214('0x118'),{'UserId':_0x9dc96e[_0xb214('0x58')][_0xb214('0x66')][_0x5d81e1],'ChatWebsiteId':_0x9dc96e[_0xb214('0x5e')]['id']});}return _0x37c5f3;});}})[_0xb214('0x1e')](respondWithResult(_0xe9b009,null))[_0xb214('0x27')](handleError(_0xe9b009,null));};exports[_0xb214('0x119')]=function(_0x46aca1,_0x53b69b,_0xfe026c){return db[_0xb214('0x50')][_0xb214('0x56')]({'where':{'id':_0x46aca1[_0xb214('0x5e')]['id']}})['then'](handleEntityNotFound(_0x53b69b,null))[_0xb214('0x1e')](function(_0x16c5c2){if(_0x16c5c2){return _0x16c5c2[_0xb214('0x119')](_0x46aca1['query'][_0xb214('0x66')])['then'](function(){if(_[_0xb214('0x11a')](_0x46aca1[_0xb214('0x42')][_0xb214('0x66')])){for(var _0x16b780=0x0;_0x16b780<_0x46aca1['query']['ids']['length'];_0x16b780+=0x1){socket['emit'](_0xb214('0x11b'),{'UserId':Number(_0x46aca1[_0xb214('0x42')][_0xb214('0x66')][_0x16b780]),'ChatWebsiteId':Number(_0x46aca1[_0xb214('0x5e')]['id'])});}}else{socket[_0xb214('0x117')](_0xb214('0x11b'),{'UserId':Number(_0x46aca1['query'][_0xb214('0x66')]),'ChatWebsiteId':Number(_0x46aca1[_0xb214('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x53b69b,null))[_0xb214('0x27')](handleError(_0x53b69b,null));};exports['getAgents']=function(_0xbc0f14,_0x19eb92,_0x26a7d6){var _0x4b8691={};var _0x10d955={};var _0xfb82a6;var _0x492cdb;return db[_0xb214('0x50')][_0xb214('0x63')]({'where':{'id':_0xbc0f14['params']['id']}})[_0xb214('0x1e')](handleEntityNotFound(_0x19eb92,null))[_0xb214('0x1e')](function(_0x4830ed){if(_0x4830ed){_0xfb82a6=_0x4830ed;_0x10d955[_0xb214('0x41')]=_['keys'](db[_0xb214('0xc5')][_0xb214('0x3e')]);_0x10d955['query']=_[_0xb214('0x43')](_0xbc0f14[_0xb214('0x42')]);_0x10d955[_0xb214('0x4b')]=_[_0xb214('0x44')](_0x10d955[_0xb214('0x41')],_0x10d955['query']);_0x4b8691[_0xb214('0x45')]=_[_0xb214('0x44')](_0x10d955[_0xb214('0x41')],qs[_0xb214('0x53')](_0xbc0f14['query'][_0xb214('0x53')]));_0x4b8691[_0xb214('0x45')]=_0x4b8691[_0xb214('0x45')][_0xb214('0x46')]?_0x4b8691[_0xb214('0x45')]:_0x10d955[_0xb214('0x41')];_0x4b8691[_0xb214('0x49')]=qs[_0xb214('0x64')](_0xbc0f14[_0xb214('0x42')]['sort']);_0x4b8691[_0xb214('0x4a')]=qs['filters'](_['pick'](_0xbc0f14[_0xb214('0x42')],_0x10d955[_0xb214('0x4b')]));if(_0xbc0f14[_0xb214('0x42')]['filter']){_0x4b8691[_0xb214('0x4a')]=_[_0xb214('0x4e')](_0x4b8691[_0xb214('0x4a')],{'$or':_[_0xb214('0x3d')](_0x4b8691[_0xb214('0x45')],function(_0x1b679a){var _0x6b6925={};_0x6b6925[_0x1b679a]={'$like':'%'+_0xbc0f14[_0xb214('0x42')][_0xb214('0x4d')]+'%'};return _0x6b6925;})});}_0x4b8691=_[_0xb214('0x4e')]({},_0x4b8691,_0xbc0f14[_0xb214('0x55')]);return _0xfb82a6['getAgents'](_0x4b8691);}})[_0xb214('0x1e')](function(_0x1327e8){if(_0x1327e8){_0x492cdb=_0x1327e8[_0xb214('0x46')];if(!_0xbc0f14[_0xb214('0x42')]['hasOwnProperty']('nolimit')){_0x4b8691[_0xb214('0x2c')]=qs[_0xb214('0x2c')](_0xbc0f14['query'][_0xb214('0x2c')]);_0x4b8691[_0xb214('0x2b')]=qs['offset'](_0xbc0f14['query'][_0xb214('0x2b')]);}return _0xfb82a6[_0xb214('0x11c')](_0x4b8691);}})[_0xb214('0x1e')](function(_0x5b5459){if(_0x5b5459){return _0x5b5459?{'count':_0x492cdb,'rows':_0x5b5459}:null;}})['then'](respondWithResult(_0x19eb92,null))[_0xb214('0x27')](handleError(_0x19eb92,null));}; \ No newline at end of file +var _0x2d78=['error','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','length','ChatWebsiteId','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','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','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','account','Applications','applications','priority','asc','Contacts','ListId','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','unknown','version','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','message','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','secure','authentication','auth','SendMail','sendMail','email','openNewInteraction','MailAccountId','offlineMessageSubject','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','tag','getSnippet','timezone','iftime\x20%s,%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','stringify','x-real-ip','connection','replace','alignment','verticalAlignment','color','addApplications','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4fea6b,_0x4d3a85){var _0x49e697=function(_0xc84870){while(--_0xc84870){_0x4fea6b['push'](_0x4fea6b['shift']());}};_0x49e697(++_0x4d3a85);}(_0x2d78,0xff));var _0x82d7=function(_0x9ae685,_0x2c6652){_0x9ae685=_0x9ae685-0x0;var _0x4c492e=_0x2d78[_0x9ae685];return _0x4c492e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x82d7('0x0'));var jsonpatch=require(_0x82d7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82d7('0x2'));var Mustache=require(_0x82d7('0x3'));var util=require(_0x82d7('0x4'));var path=require(_0x82d7('0x5'));var sox=require(_0x82d7('0x6'));var csv=require(_0x82d7('0x7'));var ejs=require(_0x82d7('0x8'));var fs=require('fs');var _=require(_0x82d7('0x9'));var squel=require(_0x82d7('0xa'));var crypto=require('crypto');var jsforce=require(_0x82d7('0xb'));var deskjs=require(_0x82d7('0xc'));var toCsv=require(_0x82d7('0x7'));var querystring=require(_0x82d7('0xd'));var Papa=require('papaparse');var Redis=require(_0x82d7('0xe'));var authService=require(_0x82d7('0xf'));var qs=require(_0x82d7('0x10'));var as=require(_0x82d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82d7('0x12'))(_0x82d7('0x13'));var utils=require('../../config/utils');var config=require(_0x82d7('0x14'));var licenseUtil=require(_0x82d7('0x15'));var db=require(_0x82d7('0x16'))['db'];config[_0x82d7('0x17')]=_[_0x82d7('0x18')](config[_0x82d7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x82d7('0x19'))(new Redis(config[_0x82d7('0x17')]));require('./chatWebsite.socket')[_0x82d7('0x1a')](socket);var jayson=require(_0x82d7('0x1b'));var client=jayson[_0x82d7('0x1c')][_0x82d7('0x1d')]({'port':0x232c});var client9002=jayson[_0x82d7('0x1c')][_0x82d7('0x1d')]({'port':0x232a});var client9003=jayson[_0x82d7('0x1c')]['http']({'port':0x232b});var client9001=jayson[_0x82d7('0x1c')][_0x82d7('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x3378de,_0x34117a,_0x34e1ed,_0x31f033){return new BPromise(function(_0x1819b0,_0x204dc1){var _0x38cec9=_0x31f033||client;return _0x38cec9[_0x82d7('0x1e')](_0x3378de,_0x34e1ed)[_0x82d7('0x1f')](function(_0x52d123){logger[_0x82d7('0x20')](_0x82d7('0x21'),_0x34117a,'request\x20sent');logger[_0x82d7('0x22')](_0x82d7('0x23'),_0x34117a,_0x82d7('0x24'),JSON['stringify'](_0x52d123));if(_0x52d123[_0x82d7('0x25')]){if(_0x52d123[_0x82d7('0x25')]['code']===0x1f4){logger[_0x82d7('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x34117a,_0x52d123['error']['message']);return _0x204dc1(_0x52d123[_0x82d7('0x25')]['message']);}logger[_0x82d7('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x34117a,_0x52d123[_0x82d7('0x25')]['message']);return _0x1819b0(_0x52d123[_0x82d7('0x25')]['message']);}else{logger['info'](_0x82d7('0x21'),_0x34117a,_0x82d7('0x24'));_0x1819b0(_0x52d123[_0x82d7('0x26')]['message']);}})[_0x82d7('0x27')](function(_0x5b2d69){logger['error'](_0x82d7('0x21'),_0x34117a,_0x5b2d69);_0x204dc1(_0x5b2d69);});});}function respondWithStatusCode(_0x43c201,_0x22a27f){_0x22a27f=_0x22a27f||0xcc;return function(_0x522ff3){if(_0x522ff3){return _0x43c201[_0x82d7('0x28')](_0x22a27f);}return _0x43c201[_0x82d7('0x29')](_0x22a27f)[_0x82d7('0x2a')]();};}function respondWithResult(_0x2617ea,_0x5d596b){_0x5d596b=_0x5d596b||0xc8;return function(_0x3b8ad8){if(_0x3b8ad8){return _0x2617ea[_0x82d7('0x29')](_0x5d596b)[_0x82d7('0x2b')](_0x3b8ad8);}};}function respondWithFilteredResult(_0x5a7442,_0x361b4d){return function(_0x425efc){if(_0x425efc){var _0x2b1b87=_0x425efc['count'],_0x36036=_0x361b4d[_0x82d7('0x2c')],_0x1ecc9a=_0x361b4d['offset']+_0x361b4d[_0x82d7('0x2d')],_0x4f7a6c;if(_0x1ecc9a>=_0x2b1b87){_0x1ecc9a=_0x2b1b87;_0x4f7a6c=0xc8;}else{_0x4f7a6c=0xce;}_0x5a7442['status'](_0x4f7a6c);return _0x5a7442[_0x82d7('0x2e')](_0x82d7('0x2f'),_0x36036+'-'+_0x1ecc9a+'/'+_0x2b1b87)[_0x82d7('0x2b')](_0x425efc);}return null;};}function patchUpdates(_0x2a5251){return function(_0xbef0b0){try{jsonpatch[_0x82d7('0x30')](_0xbef0b0,_0x2a5251,!![]);}catch(_0x3afa04){return BPromise['reject'](_0x3afa04);}return _0xbef0b0[_0x82d7('0x31')]();};}function saveUpdates(_0x2df5f2,_0x200a50){return function(_0x203032){if(_0x203032){return _0x203032[_0x82d7('0x32')](_0x2df5f2)['then'](function(_0x3b8131){return _0x3b8131;});}return null;};}function removeEntity(_0x2420c9,_0x1a7718){return function(_0x1fe7a5){if(_0x1fe7a5){return _0x1fe7a5[_0x82d7('0x33')]()[_0x82d7('0x1f')](function(){var _0x1e233e=_0x1fe7a5[_0x82d7('0x34')]({'plain':!![]});var _0x522f14=_0x82d7('0x35');return db[_0x82d7('0x36')][_0x82d7('0x33')]({'where':{'type':_0x522f14,'resourceId':_0x1e233e['id']}})[_0x82d7('0x1f')](function(){return _0x1fe7a5;});})['then'](function(){_0x2420c9[_0x82d7('0x29')](0xcc)[_0x82d7('0x2a')]();});}};}function handleEntityNotFound(_0x8d89ca,_0x59ce45){return function(_0x109227){if(!_0x109227){_0x8d89ca[_0x82d7('0x28')](0x194);}return _0x109227;};}function handleError(_0x117ab2,_0x5f165d){_0x5f165d=_0x5f165d||0x1f4;return function(_0xd9dc89){logger[_0x82d7('0x25')](_0xd9dc89[_0x82d7('0x37')]);if(_0xd9dc89[_0x82d7('0x38')]){delete _0xd9dc89[_0x82d7('0x38')];}_0x117ab2[_0x82d7('0x29')](_0x5f165d)[_0x82d7('0x39')](_0xd9dc89);};}exports['index']=function(_0x35e76d,_0x110ea0){var _0x43be76={'include':[{'model':db[_0x82d7('0x3a')],'as':_0x82d7('0x3b')}]},_0x3a96ae={},_0x2e1d94={'count':0x0,'rows':[]};var _0x1546fa=_[_0x82d7('0x3c')](db[_0x82d7('0x3d')][_0x82d7('0x3e')],function(_0x29ca3a){return{'name':_0x29ca3a['fieldName'],'type':_0x29ca3a['type']['key']};});_0x3a96ae[_0x82d7('0x3f')]=_['map'](_0x1546fa,_0x82d7('0x38'));_0x3a96ae[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x35e76d[_0x82d7('0x40')]);_0x3a96ae[_0x82d7('0x42')]=_[_0x82d7('0x43')](_0x3a96ae[_0x82d7('0x3f')],_0x3a96ae[_0x82d7('0x40')]);_0x43be76['attributes']=_[_0x82d7('0x43')](_0x3a96ae[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x35e76d[_0x82d7('0x40')]['fields']));_0x43be76[_0x82d7('0x45')]=_0x43be76[_0x82d7('0x45')]['length']?_0x43be76[_0x82d7('0x45')]:_0x3a96ae[_0x82d7('0x3f')];if(!_0x35e76d[_0x82d7('0x40')][_0x82d7('0x46')](_0x82d7('0x47'))){_0x43be76['limit']=qs['limit'](_0x35e76d[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x43be76[_0x82d7('0x2c')]=qs[_0x82d7('0x2c')](_0x35e76d['query'][_0x82d7('0x2c')]);}_0x43be76[_0x82d7('0x48')]=qs['sort'](_0x35e76d['query'][_0x82d7('0x49')]);_0x43be76[_0x82d7('0x4a')]=qs['filters'](_[_0x82d7('0x4b')](_0x35e76d[_0x82d7('0x40')],_0x3a96ae[_0x82d7('0x42')]),_0x1546fa);if(_0x35e76d['query']['filter']){_0x43be76[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x43be76[_0x82d7('0x4a')],{'$or':_['map'](_0x1546fa,function(_0x53a75d){if(_0x53a75d['type']!==_0x82d7('0x4d')){var _0x2c0305={};_0x2c0305[_0x53a75d['name']]={'$like':'%'+_0x35e76d[_0x82d7('0x40')]['filter']+'%'};return _0x2c0305;}})});}_0x43be76=_[_0x82d7('0x4c')]({},_0x43be76,_0x35e76d[_0x82d7('0x4e')]);var _0x326a9f={'where':_0x43be76[_0x82d7('0x4a')]};return db['ChatWebsite']['count'](_0x326a9f)[_0x82d7('0x1f')](function(_0x45d3af){_0x2e1d94[_0x82d7('0x4f')]=_0x45d3af;if(_0x35e76d['query'][_0x82d7('0x50')]){_0x43be76[_0x82d7('0x51')]=[{'all':!![]}];}return db[_0x82d7('0x3d')]['findAll'](_0x43be76);})[_0x82d7('0x1f')](function(_0x51efac){_0x2e1d94[_0x82d7('0x52')]=_0x51efac;return _0x2e1d94;})['then'](respondWithFilteredResult(_0x110ea0,_0x43be76))[_0x82d7('0x27')](handleError(_0x110ea0,null));};exports['show']=function(_0x49f046,_0x5069f1){var _0x3ccf5c={'raw':![],'where':{'id':_0x49f046[_0x82d7('0x53')]['id']},'include':[{'model':db[_0x82d7('0x3a')],'as':_0x82d7('0x3b')}]},_0xace48d={};_0xace48d[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0x3d')][_0x82d7('0x3e')]);_0xace48d['query']=_['keys'](_0x49f046['query']);_0xace48d[_0x82d7('0x42')]=_[_0x82d7('0x43')](_0xace48d[_0x82d7('0x3f')],_0xace48d[_0x82d7('0x40')]);_0x3ccf5c['attributes']=_['intersection'](_0xace48d[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x49f046['query'][_0x82d7('0x44')]));_0x3ccf5c[_0x82d7('0x45')]=_0x3ccf5c[_0x82d7('0x45')]['length']?_0x3ccf5c['attributes']:_0xace48d[_0x82d7('0x3f')];if(_0x49f046[_0x82d7('0x40')][_0x82d7('0x50')]){_0x3ccf5c[_0x82d7('0x51')]=[{'all':!![]}];}_0x3ccf5c=_[_0x82d7('0x4c')]({},_0x3ccf5c,_0x49f046[_0x82d7('0x4e')]);return db[_0x82d7('0x3d')][_0x82d7('0x54')](_0x3ccf5c)[_0x82d7('0x1f')](handleEntityNotFound(_0x5069f1,null))[_0x82d7('0x1f')](respondWithResult(_0x5069f1,null))[_0x82d7('0x27')](handleError(_0x5069f1,null));};exports[_0x82d7('0x55')]=function(_0x47fe0f,_0x39e8b9){return db['ChatWebsite'][_0x82d7('0x55')](_0x47fe0f[_0x82d7('0x56')],{})['then'](function(_0x1968a3){var _0x559839=_0x47fe0f[_0x82d7('0x57')][_0x82d7('0x34')]({'plain':!![]});if(!_0x559839)throw new Error(_0x82d7('0x58'));if(_0x559839[_0x82d7('0x59')]==='user'){var _0x34767c=_0x1968a3['get']({'plain':!![]});var _0x4227f7=_0x82d7('0x35');return db[_0x82d7('0x5a')][_0x82d7('0x54')]({'where':{'name':_0x4227f7,'userProfileId':_0x559839['userProfileId']},'raw':!![]})[_0x82d7('0x1f')](function(_0x5e61f5){if(_0x5e61f5&&_0x5e61f5[_0x82d7('0x5b')]===0x0){return db['UserProfileResource'][_0x82d7('0x55')]({'name':_0x34767c[_0x82d7('0x38')],'resourceId':_0x34767c['id'],'type':_0x5e61f5[_0x82d7('0x38')],'sectionId':_0x5e61f5['id']},{})[_0x82d7('0x1f')](function(){return _0x1968a3;});}else{return _0x1968a3;}})[_0x82d7('0x27')](function(_0x519aa5){logger['error'](_0x82d7('0x5c'),_0x519aa5);throw _0x519aa5;});}return _0x1968a3;})['then'](respondWithResult(_0x39e8b9,0xc9))['catch'](handleError(_0x39e8b9,null));};exports[_0x82d7('0x32')]=function(_0x4899ad,_0x1d67c5){if(_0x4899ad[_0x82d7('0x56')]['id']){delete _0x4899ad[_0x82d7('0x56')]['id'];}return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x4899ad[_0x82d7('0x53')]['id']},'include':[{'model':db[_0x82d7('0x3a')],'as':_0x82d7('0x3b')}]})[_0x82d7('0x1f')](handleEntityNotFound(_0x1d67c5,null))[_0x82d7('0x1f')](saveUpdates(_0x4899ad[_0x82d7('0x56')],null))['then'](respondWithResult(_0x1d67c5,null))[_0x82d7('0x27')](handleError(_0x1d67c5,null));};exports['destroy']=function(_0x5a726c,_0x2a0055){return db[_0x82d7('0x3d')][_0x82d7('0x54')]({'where':{'id':_0x5a726c['params']['id']}})['then'](handleEntityNotFound(_0x2a0055,null))[_0x82d7('0x1f')](removeEntity(_0x2a0055,null))['catch'](handleError(_0x2a0055,null));};exports['describe']=function(_0x378762,_0x1b723a){return db[_0x82d7('0x3d')][_0x82d7('0x5d')]()[_0x82d7('0x1f')](respondWithResult(_0x1b723a,null))[_0x82d7('0x27')](handleError(_0x1b723a,null));};exports[_0x82d7('0x5e')]=function(_0x5670c7,_0x52f894,_0x305e74){if(_0x5670c7['body']['id']){delete _0x5670c7[_0x82d7('0x56')]['id'];}return db[_0x82d7('0x3d')][_0x82d7('0x54')]({'where':{'id':_0x5670c7[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x52f894,null))[_0x82d7('0x1f')](function(_0x390def){if(_0x390def){_0x5670c7[_0x82d7('0x56')]['ChatWebsiteId']=_0x390def['id'];return db['Disposition']['create'](_0x5670c7[_0x82d7('0x56')]);}})['then'](respondWithResult(_0x52f894,null))[_0x82d7('0x27')](handleError(_0x52f894,null));};exports[_0x82d7('0x5f')]=function(_0x88d138,_0x37b23d,_0x19359c){var _0x3a7d08={'raw':![],'where':{}};var _0x5969f1={};var _0x11dbb7={'count':0x0,'rows':[]};return db[_0x82d7('0x3d')][_0x82d7('0x60')]({'where':{'id':_0x88d138[_0x82d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x37b23d,null))[_0x82d7('0x1f')](function(_0x6f87ca){if(_0x6f87ca){_0x5969f1[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0x61')]['rawAttributes']);_0x5969f1[_0x82d7('0x40')]=_['keys'](_0x88d138[_0x82d7('0x40')]);_0x5969f1[_0x82d7('0x42')]=_[_0x82d7('0x43')](_0x5969f1[_0x82d7('0x3f')],_0x5969f1[_0x82d7('0x40')]);_0x3a7d08[_0x82d7('0x45')]=_[_0x82d7('0x43')](_0x5969f1[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x88d138[_0x82d7('0x40')][_0x82d7('0x44')]));_0x3a7d08['attributes']=_0x3a7d08[_0x82d7('0x45')][_0x82d7('0x62')]?_0x3a7d08[_0x82d7('0x45')]:_0x5969f1['model'];if(!_0x88d138['query']['hasOwnProperty'](_0x82d7('0x47'))){_0x3a7d08[_0x82d7('0x2d')]=qs[_0x82d7('0x2d')](_0x88d138[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x3a7d08[_0x82d7('0x2c')]=qs[_0x82d7('0x2c')](_0x88d138[_0x82d7('0x40')][_0x82d7('0x2c')]);}_0x3a7d08['order']=qs['sort'](_0x88d138[_0x82d7('0x40')]['sort']);_0x3a7d08[_0x82d7('0x4a')]=qs[_0x82d7('0x42')](_[_0x82d7('0x4b')](_0x88d138['query'],_0x5969f1[_0x82d7('0x42')]));_0x3a7d08[_0x82d7('0x4a')][_0x82d7('0x63')]=_0x6f87ca['id'];if(_0x88d138['query'][_0x82d7('0x64')]){_0x3a7d08['where']=_[_0x82d7('0x4c')](_0x3a7d08['where'],{'$or':_[_0x82d7('0x3c')](_0x3a7d08[_0x82d7('0x45')],function(_0x113611){var _0x33403c={};_0x33403c[_0x113611]={'$like':'%'+_0x88d138[_0x82d7('0x40')][_0x82d7('0x64')]+'%'};return _0x33403c;})});}_0x3a7d08=_[_0x82d7('0x4c')]({},_0x3a7d08,_0x88d138['options']);return db['Disposition']['count']({'where':_0x3a7d08[_0x82d7('0x4a')]})[_0x82d7('0x1f')](function(_0x29cc0b){_0x11dbb7[_0x82d7('0x4f')]=_0x29cc0b;if(_0x88d138[_0x82d7('0x40')][_0x82d7('0x50')]){_0x3a7d08[_0x82d7('0x51')]=[{'all':!![]}];}return db[_0x82d7('0x61')]['findAll'](_0x3a7d08);})['then'](function(_0x3fe304){_0x11dbb7[_0x82d7('0x52')]=_0x3fe304;return _0x11dbb7;});}})[_0x82d7('0x1f')](respondWithFilteredResult(_0x37b23d,_0x3a7d08))['catch'](handleError(_0x37b23d,null));};exports[_0x82d7('0x65')]=function(_0x2be1fb,_0x46784d,_0x23cd3b){return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x2be1fb['params']['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x46784d,null))[_0x82d7('0x1f')](function(_0x3b9de6){if(_0x3b9de6){return _0x3b9de6[_0x82d7('0x65')](_0x2be1fb['query'][_0x82d7('0x66')]);}})[_0x82d7('0x1f')](respondWithStatusCode(_0x46784d,null))[_0x82d7('0x27')](handleError(_0x46784d,null));};exports[_0x82d7('0x67')]=function(_0x2b6d14,_0x16a6ed,_0x259238){if(_0x2b6d14[_0x82d7('0x56')]['id']){delete _0x2b6d14[_0x82d7('0x56')]['id'];}return db[_0x82d7('0x3d')]['find']({'where':{'id':_0x2b6d14[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x16a6ed,null))[_0x82d7('0x1f')](function(_0x46e1e6){if(_0x46e1e6){_0x2b6d14[_0x82d7('0x56')]['ChatWebsiteId']=_0x46e1e6['id'];return db[_0x82d7('0x68')][_0x82d7('0x55')](_0x2b6d14['body']);}})['then'](respondWithResult(_0x16a6ed,null))[_0x82d7('0x27')](handleError(_0x16a6ed,null));};exports[_0x82d7('0x69')]=function(_0x5a58b8,_0x53ecb2,_0x38d222){var _0x3bdae6={'raw':![],'where':{}};var _0x40bbff={};var _0x43fcdd={'count':0x0,'rows':[]};return db[_0x82d7('0x3d')][_0x82d7('0x60')]({'where':{'id':_0x5a58b8[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x53ecb2,null))[_0x82d7('0x1f')](function(_0x5d6425){if(_0x5d6425){_0x40bbff[_0x82d7('0x3f')]=_['keys'](db[_0x82d7('0x68')][_0x82d7('0x3e')]);_0x40bbff[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x5a58b8[_0x82d7('0x40')]);_0x40bbff['filters']=_[_0x82d7('0x43')](_0x40bbff[_0x82d7('0x3f')],_0x40bbff[_0x82d7('0x40')]);_0x3bdae6['attributes']=_[_0x82d7('0x43')](_0x40bbff[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x5a58b8[_0x82d7('0x40')]['fields']));_0x3bdae6['attributes']=_0x3bdae6[_0x82d7('0x45')][_0x82d7('0x62')]?_0x3bdae6[_0x82d7('0x45')]:_0x40bbff[_0x82d7('0x3f')];if(!_0x5a58b8[_0x82d7('0x40')][_0x82d7('0x46')](_0x82d7('0x47'))){_0x3bdae6[_0x82d7('0x2d')]=qs[_0x82d7('0x2d')](_0x5a58b8['query'][_0x82d7('0x2d')]);_0x3bdae6[_0x82d7('0x2c')]=qs['offset'](_0x5a58b8[_0x82d7('0x40')][_0x82d7('0x2c')]);}_0x3bdae6[_0x82d7('0x48')]=qs[_0x82d7('0x49')](_0x5a58b8[_0x82d7('0x40')][_0x82d7('0x49')]);_0x3bdae6[_0x82d7('0x4a')]=qs['filters'](_['pick'](_0x5a58b8['query'],_0x40bbff[_0x82d7('0x42')]));_0x3bdae6[_0x82d7('0x4a')][_0x82d7('0x63')]=_0x5d6425['id'];if(_0x5a58b8[_0x82d7('0x40')]['filter']){_0x3bdae6[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x3bdae6[_0x82d7('0x4a')],{'$or':_[_0x82d7('0x3c')](_0x3bdae6[_0x82d7('0x45')],function(_0x4f9fa4){var _0x595ed0={};_0x595ed0[_0x4f9fa4]={'$like':'%'+_0x5a58b8['query'][_0x82d7('0x64')]+'%'};return _0x595ed0;})});}_0x3bdae6=_[_0x82d7('0x4c')]({},_0x3bdae6,_0x5a58b8['options']);return db[_0x82d7('0x68')][_0x82d7('0x4f')]({'where':_0x3bdae6[_0x82d7('0x4a')]})[_0x82d7('0x1f')](function(_0x4d5a34){_0x43fcdd[_0x82d7('0x4f')]=_0x4d5a34;if(_0x5a58b8['query'][_0x82d7('0x50')]){_0x3bdae6[_0x82d7('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x82d7('0x6a')](_0x3bdae6);})['then'](function(_0x1053a8){_0x43fcdd['rows']=_0x1053a8;return _0x43fcdd;});}})[_0x82d7('0x1f')](respondWithFilteredResult(_0x53ecb2,_0x3bdae6))[_0x82d7('0x27')](handleError(_0x53ecb2,null));};exports['removeAnswers']=function(_0xc1bdcd,_0x2fa8d8,_0x352c0e){return db[_0x82d7('0x3d')]['find']({'where':{'id':_0xc1bdcd[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x2fa8d8,null))['then'](function(_0x5c8e3b){if(_0x5c8e3b){return _0x5c8e3b[_0x82d7('0x6b')](_0xc1bdcd['query'][_0x82d7('0x66')]);}})[_0x82d7('0x1f')](respondWithStatusCode(_0x2fa8d8,null))['catch'](handleError(_0x2fa8d8,null));};exports[_0x82d7('0x6c')]=function(_0x338c1a,_0x41d5ac,_0x55e538){_0x338c1a['body'][_0x82d7('0x6d')]=_0x338c1a['file'][_0x82d7('0x6e')];return db[_0x82d7('0x3d')]['find']({'where':{'id':_0x338c1a[_0x82d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x41d5ac,null))['then'](saveUpdates(_0x338c1a[_0x82d7('0x56')],null))[_0x82d7('0x1f')](respondWithResult(_0x41d5ac,null))[_0x82d7('0x27')](handleError(_0x41d5ac,null));};exports['addAvatar']=function(_0x512ddf,_0x3697dc,_0xabf760){_0x512ddf[_0x82d7('0x56')][_0x82d7('0x6f')]=_0x512ddf[_0x82d7('0x70')]['filename'];return db[_0x82d7('0x3d')][_0x82d7('0x54')]({'where':{'id':_0x512ddf['params']['id']}})['then'](handleEntityNotFound(_0x3697dc,null))[_0x82d7('0x1f')](saveUpdates(_0x512ddf[_0x82d7('0x56')],null))[_0x82d7('0x1f')](respondWithResult(_0x3697dc,null))[_0x82d7('0x27')](handleError(_0x3697dc,null));};exports[_0x82d7('0x71')]=function(_0x1c199f,_0x40d1b9,_0x3087fd){_0x1c199f[_0x82d7('0x56')][_0x82d7('0x72')]=_0x1c199f[_0x82d7('0x70')][_0x82d7('0x6e')];return db[_0x82d7('0x3d')][_0x82d7('0x54')]({'where':{'id':_0x1c199f['params']['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x40d1b9,null))[_0x82d7('0x1f')](saveUpdates(_0x1c199f[_0x82d7('0x56')],null))['then'](respondWithResult(_0x40d1b9,null))[_0x82d7('0x27')](handleError(_0x40d1b9,null));};exports[_0x82d7('0x73')]=function(_0x4800a5,_0x2427dc,_0x474e5e){_0x4800a5[_0x82d7('0x56')][_0x82d7('0x74')]=_0x4800a5[_0x82d7('0x70')][_0x82d7('0x6e')];return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x4800a5['params']['id']}})['then'](handleEntityNotFound(_0x2427dc,null))[_0x82d7('0x1f')](saveUpdates(_0x4800a5[_0x82d7('0x56')],null))[_0x82d7('0x1f')](respondWithResult(_0x2427dc,null))['catch'](handleError(_0x2427dc,null));};exports['getLogo']=function(_0x2667f0,_0x1170ca,_0x24eaae){var _0x4da4f2=path['join'](config[_0x82d7('0x75')],_0x82d7('0x76'));var _0x5dd5b5={'where':{'id':_0x2667f0[_0x82d7('0x53')]['id']},'attributes':['id',_0x82d7('0x6d')],'raw':!![]};var _0x1ceb8e=![];return require(_0x82d7('0x15'))[_0x82d7('0x77')]()['then'](function(_0x1ecb04){if(_0x1ecb04){_0x1ceb8e=_0x1ecb04[_0x82d7('0x78')];}})[_0x82d7('0x1f')](function(){return db[_0x82d7('0x3d')][_0x82d7('0x54')](_0x5dd5b5);})[_0x82d7('0x1f')](handleEntityNotFound(_0x1170ca,null))['then'](function(_0x36dc65){if(_0x36dc65){if(!_[_0x82d7('0x79')](_0x36dc65[_0x82d7('0x6d')])){if(fs[_0x82d7('0x7a')](path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7c'),_0x36dc65['sitepic']))&&_0x1ceb8e){_0x4da4f2=path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7c'),_0x36dc65[_0x82d7('0x6d')]);}}return _0x1170ca[_0x82d7('0x7d')](_0x4da4f2);}})[_0x82d7('0x27')](handleError(_0x1170ca,null));};exports[_0x82d7('0x7e')]=function(_0x549306,_0x89271d,_0x1c8955){var _0x177b10=path[_0x82d7('0x7b')](config[_0x82d7('0x75')],'server/files/images/avatars/default_avatar.png');var _0x51b428={'where':{'id':_0x549306[_0x82d7('0x53')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x82d7('0x3d')]['find'](_0x51b428)[_0x82d7('0x1f')](handleEntityNotFound(_0x89271d,null))['then'](function(_0x369101){if(_0x369101){if(!_[_0x82d7('0x79')](_0x369101[_0x82d7('0x6f')])){if(fs[_0x82d7('0x7a')](path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7f'),_0x369101[_0x82d7('0x6f')]))){_0x177b10=path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7f'),_0x369101[_0x82d7('0x6f')]);}}return _0x89271d['download'](_0x177b10);}})['catch'](handleError(_0x89271d,null));};exports[_0x82d7('0x80')]=function(_0x5a0758,_0x5a6ac9,_0x4da037){var _0x1335c0=path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x81'));var _0x4a6515={'where':{'id':_0x5a0758['params']['id']},'attributes':['id',_0x82d7('0x72'),_0x82d7('0x82')],'raw':!![]};return db[_0x82d7('0x3d')][_0x82d7('0x54')](_0x4a6515)[_0x82d7('0x1f')](handleEntityNotFound(_0x5a6ac9,null))[_0x82d7('0x1f')](function(_0x4ca72b){if(_0x4ca72b){if(!_['isNil'](_0x4ca72b[_0x82d7('0x72')])){if(fs[_0x82d7('0x7a')](path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7f'),_0x4ca72b[_0x82d7('0x72')]))&&_0x4ca72b['showCustomerAvatar']){_0x1335c0=path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x7f'),_0x4ca72b['customerAvatar']);}}return _0x5a6ac9[_0x82d7('0x7d')](_0x1335c0);}})['catch'](handleError(_0x5a6ac9,null));};exports[_0x82d7('0x83')]=function(_0x29da33,_0x34db57,_0xa10039){var _0x4ab753=path['join'](config[_0x82d7('0x75')],_0x82d7('0x84'));var _0x401054={'where':{'id':_0x29da33[_0x82d7('0x53')]['id']},'attributes':['id',_0x82d7('0x74')],'raw':!![]};return db[_0x82d7('0x3d')][_0x82d7('0x54')](_0x401054)['then'](handleEntityNotFound(_0x34db57,null))[_0x82d7('0x1f')](function(_0x423e4e){if(_0x423e4e){if(!_[_0x82d7('0x79')](_0x423e4e[_0x82d7('0x74')])){if(fs[_0x82d7('0x7a')](path['join'](config[_0x82d7('0x75')],_0x82d7('0x7f'),_0x423e4e[_0x82d7('0x74')]))){_0x4ab753=path['join'](config[_0x82d7('0x75')],'server/files/images/avatars/',_0x423e4e[_0x82d7('0x74')]);}}return _0x34db57[_0x82d7('0x7d')](_0x4ab753);}})['catch'](handleError(_0x34db57,null));};exports[_0x82d7('0x85')]=function(_0x2d3bd,_0x402e30,_0x586395){var _0x5d0b86=require(_0x82d7('0x86'));var _0x28cf11=new _0x5d0b86();var _0x2b4d29=_0x28cf11[_0x82d7('0x87')](_0x2d3bd['headers'][_0x82d7('0x88')])['getResult']();var _0x1f82f8={'body':_0x2d3bd[_0x82d7('0x56')],'channel':_0x82d7('0x89')};var _0x5e0336=[];var _0x3be0d6=[];var _0x5647d3={};var _0x1df65e=![];return db[_0x82d7('0x8a')][_0x82d7('0x5d')]()['then'](function(_0x20161b){if(!_0x20161b){throw new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0x8d'));}_0x5e0336=_[_0x82d7('0x8e')](_[_0x82d7('0x41')](_0x20161b),[_0x82d7('0x8f'),_0x82d7('0x90')]);_0x3be0d6=_[_0x82d7('0x8e')](_['keys'](_0x20161b),[_0x82d7('0x8f'),'updatedAt','CompanyId','ListId']);if(_0x2d3bd[_0x82d7('0x56')]['id']){delete _0x2d3bd[_0x82d7('0x56')]['id'];}if(_[_0x82d7('0x79')](_0x2d3bd['body'][_0x82d7('0x91')])){throw new db[(_0x82d7('0x8b'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x82d7('0x79')](_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x56')])||_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x56')]===''){throw new db[(_0x82d7('0x8b'))]['ValidationError'](_0x82d7('0x92'));}if(_[_0x82d7('0x79')](_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x93')])){throw new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0x94')+_0x3be0d6);}if(!_[_0x82d7('0x95')](_0x3be0d6,_0x2d3bd[_0x82d7('0x56')]['mapKey'])){throw new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0x96')+_0x3be0d6);}_0x5647d3[_0x2d3bd[_0x82d7('0x56')]['mapKey']]=_0x2d3bd['body']['from'];})[_0x82d7('0x1f')](function(){return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x2d3bd[_0x82d7('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x82d7('0x97'),'include':[{'model':db[_0x82d7('0x8a')],'as':'Contacts','where':_0x5647d3,'limit':0x1,'order':[['updatedAt',_0x82d7('0x98')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x402e30,null))[_0x82d7('0x1f')](function(_0x527a1d){if(_0x527a1d&&_0x527a1d['List']){_0x1f82f8[_0x82d7('0x99')]=_0x527a1d;_0x1f82f8['applications']=_0x527a1d[_0x82d7('0x9a')];_0x1f82f8['list']=_0x527a1d[_0x82d7('0x97')];_0x1f82f8['applications']=_['orderBy'](_0x1f82f8[_0x82d7('0x9b')],[_0x82d7('0x9c')],[_0x82d7('0x9d')]);if(_0x1f82f8[_0x82d7('0x99')]['Applications']){delete _0x1f82f8[_0x82d7('0x99')][_0x82d7('0x9a')];}if(_0x1f82f8[_0x82d7('0x99')][_0x82d7('0x97')]&&_0x1f82f8[_0x82d7('0x99')]['List'][_0x82d7('0x9e')]['length']){return _0x1f82f8[_0x82d7('0x99')][_0x82d7('0x97')]['Contacts'][0x0];}var _0x5e7a5c=_[_0x82d7('0x18')](_0x2d3bd[_0x82d7('0x56')],{'firstName':_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x91')],'ListId':_0x527a1d[_0x82d7('0x9f')]});_0x5e7a5c[_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x93')]]=_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x91')];return db['CmContact']['create'](_0x5e7a5c,{'fields':_0x5e0336,'raw':!![]});}})[_0x82d7('0x1f')](handleEntityNotFound(_0x402e30,null))['then'](function(_0x3a4f2a){_0x1f82f8[_0x82d7('0xa0')]=_0x3a4f2a;var _0x1332f7=_0x2d3bd[_0x82d7('0x56')]['customerIp'];if(_0x2d3bd[_0x82d7('0xa1')][_0x82d7('0xa2')]){_0x1332f7=_0x2d3bd['headers'][_0x82d7('0xa2')];}else if(_0x2d3bd[_0x82d7('0xa1')][_0x82d7('0xa3')]){_0x1332f7=_[_0x82d7('0xa4')](_0x2d3bd['headers'][_0x82d7('0xa3')][_0x82d7('0xa5')](','));}if(_0x3a4f2a){var _0x34c5f5={'ContactId':_0x3a4f2a['id'],'ChatWebsiteId':_0x2d3bd[_0x82d7('0x53')]['id'],'from':(_0x3a4f2a[_0x82d7('0xa6')]||'')+'\x20'+(_0x3a4f2a[_0x82d7('0xa7')]||''),'customerIp':_0x1332f7,'customerPort':_0x2d3bd[_0x82d7('0xa1')][_0x82d7('0xa8')]?_0x2d3bd['headers'][_0x82d7('0xa8')]:null,'referer':_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xa9')],'browserName':_0x2b4d29[_0x82d7('0xaa')][_0x82d7('0x38')]&&_0x2b4d29[_0x82d7('0xaa')]['version']?util[_0x82d7('0xab')](_0x82d7('0xac'),_0x2b4d29[_0x82d7('0xaa')][_0x82d7('0x38')],_0x2b4d29[_0x82d7('0xaa')]['version']):_0x82d7('0xad'),'browserVersion':_0x2b4d29[_0x82d7('0xaa')][_0x82d7('0xae')]||'unknown','osName':util[_0x82d7('0xab')]('%s\x20%s',_0x2b4d29['os']['name'],_0x2b4d29['os'][_0x82d7('0xae')]),'osVersion':_0x2b4d29['os'][_0x82d7('0xae')],'deviceModel':_0x2b4d29[_0x82d7('0xaf')]['model']&&_0x2b4d29['device'][_0x82d7('0xb0')]?util[_0x82d7('0xab')](_0x82d7('0xb1'),_0x2b4d29[_0x82d7('0xaf')][_0x82d7('0x3f')],_0x2b4d29[_0x82d7('0xaf')][_0x82d7('0xb0')],_0x2b4d29['device']['type']):null,'deviceVendor':_0x2b4d29[_0x82d7('0xaf')]['vendor'],'deviceType':_0x2b4d29[_0x82d7('0xaf')][_0x82d7('0xb2')],'formData':JSON['stringify'](_0x2d3bd[_0x82d7('0x56')])};var _0x3fca98={'ChatWebsiteId':_0x2d3bd[_0x82d7('0x53')]['id'],'closed':![]};if(_0x2d3bd['body']['threadId']){_0x3fca98[_0x82d7('0xb3')]=_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xb3')];return db[_0x82d7('0xb4')][_0x82d7('0x54')]({'where':_0x3fca98})['then'](function(_0xbb6c63){if(_0xbb6c63){return[_0xbb6c63,![]];}_0x34c5f5['threadId']=_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xb3')];_0x34c5f5[_0x82d7('0xb5')]=_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xb5')];return db['ChatInteraction'][_0x82d7('0x55')](_0x34c5f5)[_0x82d7('0x1f')](function(_0x501c7b){return[_0x501c7b,!![]];});});}_0x3fca98['ContactId']=_0x3a4f2a['id'];if(_0x2d3bd['body'][_0x82d7('0xb6')]&&_0x2d3bd['body']['interaction']['id']){_0x3fca98['id']=_0x2d3bd['body'][_0x82d7('0xb6')]['id'];return db['ChatInteraction'][_0x82d7('0x54')]({'where':_0x3fca98})[_0x82d7('0x1f')](function(_0xab7997){if(_0xab7997){return[_0xab7997,![]];}return db[_0x82d7('0xb4')]['create'](_0x34c5f5)[_0x82d7('0x1f')](function(_0x6bb79f){return[_0x6bb79f,!![]];});});}return db[_0x82d7('0xb4')][_0x82d7('0x55')](_0x34c5f5)['then'](function(_0x2c48cd){return[_0x2c48cd,!![]];});}})[_0x82d7('0xb7')](function(_0x58642d,_0x3d2ace){if(_0x58642d){_0x1df65e=_0x3d2ace;if(!_0x3d2ace){var _0x37b123={'from':(_0x1f82f8['contact'][_0x82d7('0xa6')]||'')+'\x20'+(_0x1f82f8[_0x82d7('0xa0')][_0x82d7('0xa7')]||'')};if(_0x2d3bd['body'][_0x82d7('0xb3')]&&_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xb8')]&&_0x2d3bd['body'][_0x82d7('0xb3')]!=_0x2d3bd['body'][_0x82d7('0xb8')]){_0x37b123[_0x82d7('0xb3')]=_0x2d3bd['body'][_0x82d7('0xb8')];}return _0x58642d[_0x82d7('0x32')](_0x37b123);}else{return _0x58642d;}}})['then'](function(_0x2a4664){_0x1f82f8[_0x82d7('0xb6')]=_0x2a4664['get']({'plain':!![]});_0x1f82f8[_0x82d7('0xb6')][_0x82d7('0xb9')]=_0x1df65e;if(_0x1f82f8[_0x82d7('0xb6')]['created']){if(_0x1f82f8[_0x82d7('0x99')]['autoclose']){_0x1f82f8[_0x82d7('0x9b')][_0x82d7('0xba')]({'id':0x0,'priority':_0x1f82f8[_0x82d7('0x9b')][_0x82d7('0x62')]+0x1,'app':_0x82d7('0xbb'),'appdata':_0x82d7('0xbc'),'interval':'*,*,*,*'});}}return db[_0x82d7('0xbd')][_0x82d7('0x55')]({'body':_0x2d3bd[_0x82d7('0x56')][_0x82d7('0x56')],'ChatWebsiteId':_0x2d3bd[_0x82d7('0x53')]['id'],'ChatInteractionId':_0x2a4664['id'],'direction':'in','ContactId':_0x1f82f8['contact']['id'],'AttachmentId':_0x2d3bd[_0x82d7('0x56')][_0x82d7('0xbe')]});})[_0x82d7('0x1f')](function(_0x3ec435){_0x1f82f8[_0x82d7('0xbf')]=_0x3ec435;if(_0x1f82f8[_0x82d7('0xb6')]['UserId']){return db['User'][_0x82d7('0x54')]({'attributes':['id','name'],'where':{'id':_0x1f82f8[_0x82d7('0xb6')][_0x82d7('0xc0')]}})[_0x82d7('0x1f')](function(_0x459bb7){if(_0x459bb7){_0x1f82f8[_0x82d7('0x9b')][_0x82d7('0xc1')]({'id':0x0,'priority':0x0,'app':_0x82d7('0xc2'),'appdata':_0x459bb7[_0x82d7('0x38')]+','+(_0x1f82f8[_0x82d7('0x99')][_0x82d7('0xc3')]||0xa),'interval':_0x82d7('0xc4')});_0x1f82f8[_0x82d7('0xc5')]=!![];}return respondWithRpcPromise(_0x82d7('0xc6'),_0x82d7('0xc7'),_0x1f82f8);});}return respondWithRpcPromise(_0x82d7('0xc6'),_0x82d7('0xc7'),_0x1f82f8);})[_0x82d7('0x1f')](function(_0x265b26){respondWithRpcPromise(_0x82d7('0xc8'),_0x82d7('0xc8'),{'event':_0x82d7('0x85'),'message':_0x265b26},client9002);return _0x265b26;})[_0x82d7('0x1f')](respondWithResult(_0x402e30,null))[_0x82d7('0x27')](handleError(_0x402e30,null));};exports[_0x82d7('0xc9')]=function(_0x4778d8,_0x335f31,_0x3e15da){var _0x5c0dfa,_0x150816,_0x1df4d5;var _0x5e7fbd=[];var _0x56ec99=[];var _0x4579bb={};return db[_0x82d7('0x8a')][_0x82d7('0x5d')]()[_0x82d7('0x1f')](function(_0x2a1116){if(!_0x2a1116){throw new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0x8d'));}_0x56ec99=_['difference'](_[_0x82d7('0x41')](_0x2a1116),[_0x82d7('0x8f'),_0x82d7('0x90')]);_0x5e7fbd=_[_0x82d7('0x8e')](_[_0x82d7('0x41')](_0x2a1116),[_0x82d7('0x8f'),_0x82d7('0x90'),_0x82d7('0xca'),'ListId']);if(_0x4778d8['body']['id']){delete _0x4778d8[_0x82d7('0x56')]['id'];}if(_['isNil'](_0x4778d8[_0x82d7('0x56')][_0x82d7('0x91')])){throw _0x335f31[_0x82d7('0x29')](0x1f4)[_0x82d7('0x39')](new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0xcb')));}if(_[_0x82d7('0x79')](_0x4778d8[_0x82d7('0x56')][_0x82d7('0x56')])||_0x4778d8[_0x82d7('0x56')][_0x82d7('0x56')]===''){throw _0x335f31[_0x82d7('0x29')](0x1f4)[_0x82d7('0x39')](new db['Sequelize'][(_0x82d7('0x8c'))](_0x82d7('0x92')));}if(_[_0x82d7('0x79')](_0x4778d8['body'][_0x82d7('0xcc')])){throw _0x335f31[_0x82d7('0x29')](0x1f4)[_0x82d7('0x39')](new db[(_0x82d7('0x8b'))][(_0x82d7('0x8c'))](_0x82d7('0xcd')+_0x5e7fbd));}if(!_[_0x82d7('0x95')](_0x5e7fbd,_0x4778d8['body'][_0x82d7('0xcc')])){throw _0x335f31[_0x82d7('0x29')](0x1f4)[_0x82d7('0x39')](new db['Sequelize'][(_0x82d7('0x8c'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e7fbd));}_0x4579bb[_0x4778d8[_0x82d7('0x56')][_0x82d7('0xcc')]]=_0x4778d8[_0x82d7('0x56')]['from'];})[_0x82d7('0x1f')](function(){return db[_0x82d7('0x3d')][_0x82d7('0x54')]({'where':{'id':_0x4778d8[_0x82d7('0x53')]['id']},'include':[{'model':db[_0x82d7('0xce')],'as':_0x82d7('0x97')},{'model':db['MailAccount'],'as':_0x82d7('0xcf')}]});})[_0x82d7('0x1f')](handleEntityNotFound(_0x335f31,null))[_0x82d7('0x1f')](function(_0x3006f6){if(_0x3006f6&&_0x3006f6[_0x82d7('0x97')]){_0x150816=_0x3006f6;var _0x26ec61=_[_0x82d7('0x18')](_0x4778d8['body'],{'firstName':_0x4778d8[_0x82d7('0x56')][_0x82d7('0x91')],'phone':_0x4778d8[_0x82d7('0x56')]['from'],'ListId':_0x3006f6[_0x82d7('0x9f')]});_0x26ec61[_0x4778d8[_0x82d7('0x56')]['mapKeyOffline']]=_0x4778d8[_0x82d7('0x56')]['from'];return db[_0x82d7('0x8a')][_0x82d7('0xd0')]({'where':_0x4579bb,'defaults':_0x26ec61});}})[_0x82d7('0xb7')](function(_0x245f37){if(_0x245f37){_0x1df4d5=_0x245f37;var _0x46c43d=fs[_0x82d7('0xd1')](path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0xd2')),_0x82d7('0xd3'));var _0x16772b=ejs[_0x82d7('0xd4')](_0x46c43d,{'body':_[_0x82d7('0xd5')](_0x4778d8[_0x82d7('0x56')][_0x82d7('0x56')]),'bodyTitle':_0x150816[_0x82d7('0xd6')]});return db[_0x82d7('0xd7')][_0x82d7('0x55')]({'body':_0x16772b,'ContactId':_0x245f37['id'],'ChatWebsiteId':_0x150816['id']});}})[_0x82d7('0x1f')](function(_0x28e90b){if(_0x28e90b){_0x5c0dfa=_0x28e90b;return db['MailAccount'][_0x82d7('0x60')]({'where':{'service':!![]},'include':[{'model':db[_0x82d7('0xd8')],'as':_0x82d7('0xd9'),'raw':!![]}]});}})[_0x82d7('0x1f')](function(_0x4cb964){if(_0x4cb964&&_0x4cb964[_0x82d7('0xd9')]&&_0x150816['forwardOffline']&&_0x150816[_0x82d7('0xda')]){var _0x655b6c={'tls':{'rejectUnauthorized':![]}};if(_0x4cb964[_0x82d7('0xd9')][_0x82d7('0xdb')]){_0x655b6c['service']=_0x4cb964[_0x82d7('0xd9')][_0x82d7('0xdb')];}else{_0x655b6c[_0x82d7('0xdc')]=_0x4cb964[_0x82d7('0xd9')]['host'];_0x655b6c['port']=_0x4cb964[_0x82d7('0xd9')]['port'];_0x655b6c[_0x82d7('0xdd')]=_0x4cb964['Smtp'][_0x82d7('0xdd')];}if(_0x4cb964[_0x82d7('0xd9')][_0x82d7('0xde')]){_0x655b6c[_0x82d7('0xdf')]={'user':_0x4cb964['Smtp'][_0x82d7('0x57')],'pass':_0x4cb964[_0x82d7('0xd9')]['pass']};}return respondWithRpcPromise(_0x82d7('0xe0'),_0x82d7('0xe1'),{'account':_0x655b6c,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4cb964['name'],_0x4cb964[_0x82d7('0xe2')]||_0x4cb964[_0x82d7('0xd9')][_0x82d7('0x57')]),'to':_0x150816['forwardOfflineAddress'],'subject':_0x150816['offlineMessageSubject'],'text':_0x5c0dfa[_0x82d7('0x56')]}},client9003)[_0x82d7('0x1f')](function(){return _0x5c0dfa;})[_0x82d7('0x27')](function(_0x43a097){console[_0x82d7('0x25')](_0x43a097);});}})[_0x82d7('0x1f')](function(){if(_0x150816&&_0x150816[_0x82d7('0xe3')]&&_0x150816[_0x82d7('0xe4')]){var _0x2ce5b2={'from':_0x1df4d5[_0x82d7('0xe2')],'firstName':_0x1df4d5[_0x82d7('0xa6')],'lastName':_0x1df4d5[_0x82d7('0xa7')],'mapKey':'email','message':{'from':_0x1df4d5['email'],'to':_0x150816['MailAccount'][_0x82d7('0xe2')],'cc':'','subject':_0x150816[_0x82d7('0xe5')],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0x82d7('0xe6'),'ChatWebsiteId':_0x150816['id'],'ChatOfflineMessageId':_0x5c0dfa['id'],'originTo':_0x150816['MailAccount'][_0x82d7('0xe2')]},'body':_0x5c0dfa[_0x82d7('0x56')]};var _0x100e8b={'account':{'id':_0x150816[_0x82d7('0xe4')]},'body':_0x2ce5b2,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x82d7('0xe7'),'notifyMail',_0x100e8b,client9001)[_0x82d7('0x1f')](function(){return _0x5c0dfa;})[_0x82d7('0x27')](function(_0x3f9da3){console['error'](_0x3f9da3);});}return;})[_0x82d7('0x1f')](function(){if(_0x5c0dfa){return _0x5c0dfa;}})['then'](respondWithResult(_0x335f31,null))[_0x82d7('0x27')](handleError(_0x335f31,null));};exports[_0x82d7('0xe8')]=function(_0x479656,_0x3fbd36,_0x2adc62){return db[_0x82d7('0xb4')][_0x82d7('0x54')]({'where':{'id':_0x479656['params']['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x3fbd36,null))[_0x82d7('0x1f')](function(_0x5a8f0d){if(_0x5a8f0d){return _0x5a8f0d['addInteraction'](_0x479656['body'][_0x82d7('0x66')],_[_0x82d7('0xe9')](_0x479656[_0x82d7('0x56')],[_0x82d7('0x66'),'id'])||{});}})[_0x82d7('0x1f')](respondWithResult(_0x3fbd36,null))[_0x82d7('0x27')](handleError(_0x3fbd36,null));};exports[_0x82d7('0xea')]=function(_0x1993dd,_0x5bf18a,_0x561d4f){var _0x27e476={'raw':![],'where':{}};var _0x16a69b={};var _0x42ee98={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x82d7('0x60')]({'where':{'id':_0x1993dd[_0x82d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x5bf18a,null))[_0x82d7('0x1f')](function(_0x3a2c54){if(_0x3a2c54){_0x16a69b[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0xb4')][_0x82d7('0x3e')]);_0x16a69b[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x1993dd['query']);_0x16a69b[_0x82d7('0x42')]=_[_0x82d7('0x43')](_0x16a69b[_0x82d7('0x3f')],_0x16a69b[_0x82d7('0x40')]);_0x27e476[_0x82d7('0x45')]=_['intersection'](_0x16a69b[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x1993dd['query'][_0x82d7('0x44')]));_0x27e476[_0x82d7('0x45')]=_0x27e476[_0x82d7('0x45')][_0x82d7('0x62')]?_0x27e476[_0x82d7('0x45')]:_0x16a69b[_0x82d7('0x3f')];if(!_0x1993dd[_0x82d7('0x40')][_0x82d7('0x46')](_0x82d7('0x47'))){_0x27e476[_0x82d7('0x2d')]=qs[_0x82d7('0x2d')](_0x1993dd[_0x82d7('0x40')]['limit']);_0x27e476[_0x82d7('0x2c')]=qs[_0x82d7('0x2c')](_0x1993dd[_0x82d7('0x40')][_0x82d7('0x2c')]);}_0x27e476[_0x82d7('0x48')]=qs[_0x82d7('0x49')](_0x1993dd['query'][_0x82d7('0x49')]);_0x27e476[_0x82d7('0x4a')]=qs[_0x82d7('0x42')](_['pick'](_0x1993dd[_0x82d7('0x40')],_0x16a69b[_0x82d7('0x42')]));_0x27e476[_0x82d7('0x4a')][_0x82d7('0x63')]=_0x3a2c54['id'];if(_0x1993dd[_0x82d7('0x40')][_0x82d7('0x64')]){_0x27e476[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x27e476[_0x82d7('0x4a')],{'$or':_[_0x82d7('0x3c')](_0x27e476[_0x82d7('0x45')],function(_0x130073){var _0x410fcb={};_0x410fcb[_0x130073]={'$like':'%'+_0x1993dd[_0x82d7('0x40')][_0x82d7('0x64')]+'%'};return _0x410fcb;})});}_0x27e476=_[_0x82d7('0x4c')]({},_0x27e476,_0x1993dd[_0x82d7('0x4e')]);return db[_0x82d7('0xb4')]['count']({'where':_0x27e476[_0x82d7('0x4a')]})[_0x82d7('0x1f')](function(_0x256548){_0x42ee98[_0x82d7('0x4f')]=_0x256548;if(_0x1993dd['query'][_0x82d7('0x50')]){_0x27e476['include']=[{'model':db[_0x82d7('0x8a')],'as':_0x82d7('0xeb'),'required':![]},{'model':db['User'],'as':_0x82d7('0xec'),'attributes':[_0x82d7('0x38'),_0x82d7('0xed'),'internal'],'required':![]},{'model':db[_0x82d7('0xee')],'as':'Tags','attributes':['id','name','color'],'where':_0x1993dd[_0x82d7('0x40')][_0x82d7('0xef')]?{'id':_0x1993dd[_0x82d7('0x40')]['tag']}:undefined,'required':_0x1993dd['query'][_0x82d7('0xef')]?!![]:![]}];}return db[_0x82d7('0xb4')]['findAll'](_0x27e476);})[_0x82d7('0x1f')](function(_0x458963){_0x42ee98[_0x82d7('0x52')]=_0x458963;return _0x42ee98;});}})['then'](respondWithFilteredResult(_0x5bf18a,_0x27e476))[_0x82d7('0x27')](handleError(_0x5bf18a,null));};function iftimePromise(_0x5c0af5,_0x3b6e22){return respondWithRpcPromise('Command',_0x82d7('0xf0'),{'command':_0x3b6e22[_0x82d7('0xf1')]?util['format'](_0x82d7('0xf2'),_0x5c0af5['interval'],_0x3b6e22['timezone']):util[_0x82d7('0xab')]('iftime\x20%s',_0x5c0af5['interval'])},client9002)['then'](function(_0x4b2001){var _0x48c56e=_0x4b2001&&_0x4b2001['indexOf'](_0x82d7('0xf3'))>=0x0?!![]:![];logger[_0x82d7('0x20')](_0x82d7('0xf4'),_0x3b6e22['id'],_0x5c0af5['id'],_0x5c0af5[_0x82d7('0xf5')],_0x48c56e?'ONLINE':_0x82d7('0xf6'),_0x3b6e22[_0x82d7('0xf1')]?_0x3b6e22[_0x82d7('0xf1')]:_0x82d7('0xf7'));return _0x48c56e;})[_0x82d7('0x27')](function(_0x5e594d){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3b6e22['id'],_0x5c0af5['id'],_0x5c0af5[_0x82d7('0xf5')],util[_0x82d7('0xf8')](_0x5e594d,{'showHidden':![],'depth':null}),_0x3b6e22['timezone']?_0x3b6e22[_0x82d7('0xf1')]:'No\x20timezone');return![];});}exports[_0x82d7('0xf0')]=function(_0x9cb929,_0x4efa09,_0x563081){var _0x2040a8=0x0;var _0x114e89=0x0;var _0xd0785e=![];var _0x26aaa5;var _0x482853;return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x9cb929[_0x82d7('0x53')]['id']},'include':[{'model':db[_0x82d7('0xf9')],'as':_0x82d7('0xf9'),'include':[{'model':db[_0x82d7('0xf9')],'as':_0x82d7('0xfa'),'attributes':['id',_0x82d7('0xf5')],'raw':!![]}]}]})[_0x82d7('0x1f')](handleEntityNotFound(_0x4efa09,null))[_0x82d7('0x1f')](function(_0x23221d){if(_0x23221d){_0x26aaa5=_0x23221d;return _0x23221d[_0x82d7('0xfb')]({'raw':!![]});}})[_0x82d7('0x1f')](function(_0xa3c1de){if(_0x26aaa5){if(_0xa3c1de){_0x482853=_0xa3c1de;}}return require(_0x82d7('0x15'))[_0x82d7('0x77')]();})[_0x82d7('0x1f')](function(_0x2bde9f){if(_0x2bde9f){_0x114e89=_0x2bde9f[_0x82d7('0xfc')];_0xd0785e=_0x2bde9f[_0x82d7('0x78')];}})[_0x82d7('0x1f')](function(){return db[_0x82d7('0xb4')][_0x82d7('0x4f')]({'where':{'closed':![]}});})[_0x82d7('0x1f')](function(_0x2fd616){_0x2040a8=_0x2fd616;if(_0x114e89&&_0x2fd616>_0x114e89){return db[_0x82d7('0xfd')][_0x82d7('0x60')]({'where':{'id':0x1}})[_0x82d7('0x1f')](function(_0x2f84cb){if(_0x2f84cb){_0x2f84cb[_0x82d7('0xfe')](_0x82d7('0xff'));}});}})[_0x82d7('0x1f')](function(){if(_0x26aaa5[_0x82d7('0xf9')]&&_0x26aaa5[_0x82d7('0xf9')][_0x82d7('0xfa')]){var _0x138cc3=[];for(var _0x5297eb=0x0;_0x5297eb<_0x26aaa5[_0x82d7('0xf9')]['Intervals'][_0x82d7('0x62')];_0x5297eb++){var _0x4dac5a=_0x26aaa5[_0x82d7('0xf9')][_0x82d7('0xfa')][_0x5297eb]['get']({'plain':!![]});_0x138cc3[_0x82d7('0xba')](iftimePromise(_0x4dac5a,_0x26aaa5));}return BPromise[_0x82d7('0x100')](_0x138cc3)[_0x82d7('0x1f')](function(_0x3ecb12){return _[_0x82d7('0x101')](_0x3ecb12);});}else{return!![];}})[_0x82d7('0x1f')](function(_0x2648fa){var _0x50bce2=fs[_0x82d7('0xd1')](path[_0x82d7('0x7b')](config[_0x82d7('0x75')],_0x82d7('0x102')),'utf8');var _0x2d9059={'remote':_0x26aaa5[_0x82d7('0x103')],'query':querystring[_0x82d7('0x104')](_[_0x82d7('0x4c')](_0x26aaa5[_0x82d7('0x34')]({'plain':!![]}),{'customerIp':_0x9cb929[_0x82d7('0xa1')][_0x82d7('0xa3')]||_0x9cb929[_0x82d7('0xa1')][_0x82d7('0x105')]||_0x9cb929[_0x82d7('0x106')]['remoteAddress']||_0x9cb929['ip'],'referer':_0x9cb929[_0x82d7('0xa1')]['referer'],'openedInteractions':_0x2040a8,'maxInteractions':_0x114e89,'virtual':_0xd0785e[_0x82d7('0xfc')],'online':_0x2648fa,'custom':_0xd0785e}))[_0x82d7('0x107')](/'/g,'\x5c\x27')};_0x4efa09['send'](ejs[_0x82d7('0xd4')](Mustache[_0x82d7('0xd4')](_0x50bce2,_0x2d9059),{'proactiveActions':_0x482853,'alignment':_0x26aaa5[_0x82d7('0x108')],'verticalAlignment':_0x26aaa5[_0x82d7('0x109')],'div_color':_0x26aaa5[_0x82d7('0x10a')],'text_color':_0x26aaa5['textColor']}));})[_0x82d7('0x27')](handleError(_0x4efa09,null));};exports[_0x82d7('0x10b')]=function(_0xa29f93,_0xab7062,_0x4d91fa){return db['ChatWebsite'][_0x82d7('0x60')]({'where':{'id':_0xa29f93[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0xab7062,null))[_0x82d7('0x1f')](function(_0x56e0b6){if(_0x56e0b6){return db[_0x82d7('0x10c')][_0x82d7('0x10d')](function(_0x2a48b9){return db['ChatApplication'][_0x82d7('0x33')]({'where':{'ChatWebsiteId':_0xa29f93['params']['id']},'transaction':_0x2a48b9})['then'](function(_0x13a244){var _0x4d5c5b=_[_0x82d7('0x3c')](_0xa29f93[_0x82d7('0x56')],function(_0x4463bc){_0x4463bc[_0x82d7('0x63')]=_0xa29f93[_0x82d7('0x53')]['id'];return _0x4463bc;});return db[_0x82d7('0x10e')][_0x82d7('0x10f')](_0x4d5c5b,{'transaction':_0x2a48b9});});})[_0x82d7('0x1f')](function(){return db[_0x82d7('0x10e')][_0x82d7('0x110')]({'where':{'ChatWebsiteId':_0xa29f93[_0x82d7('0x53')]['id']},'order':_0x82d7('0x9c')});});}})[_0x82d7('0x1f')](respondWithResult(_0xab7062,null))[_0x82d7('0x27')](handleError(_0xab7062,null));};exports[_0x82d7('0x111')]=function(_0x59b5f2,_0x152332,_0x41740c){var _0x2a13c5={};var _0x4936fb={};var _0x1f939b;var _0xddf851;return db['ChatWebsite']['findOne']({'where':{'id':_0x59b5f2[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x152332,null))['then'](function(_0x546525){if(_0x546525){_0x1f939b=_0x546525;_0x4936fb[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db['ChatApplication']['rawAttributes']);_0x4936fb['query']=_['keys'](_0x59b5f2[_0x82d7('0x40')]);_0x4936fb['filters']=_[_0x82d7('0x43')](_0x4936fb['model'],_0x4936fb[_0x82d7('0x40')]);_0x2a13c5[_0x82d7('0x45')]=_['intersection'](_0x4936fb[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x59b5f2[_0x82d7('0x40')]['fields']));_0x2a13c5[_0x82d7('0x45')]=_0x2a13c5[_0x82d7('0x45')][_0x82d7('0x62')]?_0x2a13c5[_0x82d7('0x45')]:_0x4936fb[_0x82d7('0x3f')];_0x2a13c5['order']=qs[_0x82d7('0x49')](_0x59b5f2['query']['sort']);_0x2a13c5[_0x82d7('0x4a')]=qs['filters'](_[_0x82d7('0x4b')](_0x59b5f2['query'],_0x4936fb[_0x82d7('0x42')]));if(_0x59b5f2['query'][_0x82d7('0x64')]){_0x2a13c5[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x2a13c5[_0x82d7('0x4a')],{'$or':_[_0x82d7('0x3c')](_0x2a13c5[_0x82d7('0x45')],function(_0x1e75cd){var _0x148c77={};_0x148c77[_0x1e75cd]={'$like':'%'+_0x59b5f2[_0x82d7('0x40')][_0x82d7('0x64')]+'%'};return _0x148c77;})});}_0x2a13c5=_[_0x82d7('0x4c')]({},_0x2a13c5,_0x59b5f2[_0x82d7('0x4e')]);return _0x1f939b[_0x82d7('0x111')](_0x2a13c5);}})[_0x82d7('0x1f')](function(_0x34f9fa){if(_0x34f9fa){_0xddf851=_0x34f9fa[_0x82d7('0x62')];if(!_0x59b5f2[_0x82d7('0x40')][_0x82d7('0x46')]('nolimit')){_0x2a13c5[_0x82d7('0x2d')]=qs['limit'](_0x59b5f2[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x2a13c5['offset']=qs['offset'](_0x59b5f2[_0x82d7('0x40')][_0x82d7('0x2c')]);}return _0x1f939b[_0x82d7('0x111')](_0x2a13c5);}})[_0x82d7('0x1f')](function(_0x2e8af8){if(_0x2e8af8){return _0x2e8af8?{'count':_0xddf851,'rows':_0x2e8af8}:null;}})[_0x82d7('0x1f')](respondWithResult(_0x152332,null))[_0x82d7('0x27')](handleError(_0x152332,null));};exports[_0x82d7('0x112')]=function(_0x357a1b,_0x48681a,_0xf5e4fb){return db['chatProactiveAction'][_0x82d7('0x54')]({'where':{'id':_0x357a1b['params']['id']}})['then'](handleEntityNotFound(_0x48681a,null))['then'](function(_0x5da7a3){if(_0x5da7a3){return _0x5da7a3[_0x82d7('0x112')](_0x357a1b['body'][_0x82d7('0x66')],_[_0x82d7('0xe9')](_0x357a1b[_0x82d7('0x56')],[_0x82d7('0x66'),'id'])||{});}})[_0x82d7('0x1f')](respondWithResult(_0x48681a,null))['catch'](handleError(_0x48681a,null));};exports[_0x82d7('0xfb')]=function(_0x154350,_0x531676,_0x49a9dd){var _0x486dc4={};var _0x32739d={};var _0x5a463a;var _0x3dc00f;return db[_0x82d7('0x3d')][_0x82d7('0x60')]({'where':{'id':_0x154350['params']['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x531676,null))[_0x82d7('0x1f')](function(_0x70a17d){if(_0x70a17d){_0x5a463a=_0x70a17d;_0x32739d[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0x113')][_0x82d7('0x3e')]);_0x32739d[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x154350[_0x82d7('0x40')]);_0x32739d['filters']=_['intersection'](_0x32739d[_0x82d7('0x3f')],_0x32739d['query']);_0x486dc4['attributes']=_['intersection'](_0x32739d[_0x82d7('0x3f')],qs[_0x82d7('0x44')](_0x154350[_0x82d7('0x40')]['fields']));_0x486dc4['attributes']=_0x486dc4[_0x82d7('0x45')][_0x82d7('0x62')]?_0x486dc4[_0x82d7('0x45')]:_0x32739d[_0x82d7('0x3f')];_0x486dc4['order']=qs[_0x82d7('0x49')](_0x154350['query'][_0x82d7('0x49')]);_0x486dc4['where']=qs[_0x82d7('0x42')](_[_0x82d7('0x4b')](_0x154350[_0x82d7('0x40')],_0x32739d['filters']));if(_0x154350[_0x82d7('0x40')][_0x82d7('0x64')]){_0x486dc4['where']=_[_0x82d7('0x4c')](_0x486dc4[_0x82d7('0x4a')],{'$or':_[_0x82d7('0x3c')](_0x486dc4[_0x82d7('0x45')],function(_0x130ec8){var _0x2c2abf={};_0x2c2abf[_0x130ec8]={'$like':'%'+_0x154350[_0x82d7('0x40')]['filter']+'%'};return _0x2c2abf;})});}_0x486dc4=_[_0x82d7('0x4c')]({},_0x486dc4,_0x154350[_0x82d7('0x4e')]);return _0x5a463a[_0x82d7('0xfb')](_0x486dc4);}})[_0x82d7('0x1f')](function(_0x58240c){if(_0x58240c){_0x3dc00f=_0x58240c[_0x82d7('0x62')];if(!_0x154350[_0x82d7('0x40')][_0x82d7('0x46')](_0x82d7('0x47'))){_0x486dc4[_0x82d7('0x2d')]=qs['limit'](_0x154350[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x486dc4[_0x82d7('0x2c')]=qs[_0x82d7('0x2c')](_0x154350[_0x82d7('0x40')][_0x82d7('0x2c')]);}return _0x5a463a[_0x82d7('0xfb')](_0x486dc4);}})['then'](function(_0x4f066f){if(_0x4f066f){return _0x4f066f?{'count':_0x3dc00f,'rows':_0x4f066f}:null;}})[_0x82d7('0x1f')](respondWithResult(_0x531676,null))[_0x82d7('0x27')](handleError(_0x531676,null));};exports[_0x82d7('0x114')]=function(_0x406168,_0x180fb7,_0x286f74){var _0x2ee8dd=_0x406168[_0x82d7('0x40')][_0x82d7('0x115')]===_0x82d7('0x116')?_0x82d7('0x117'):_0x82d7('0x118');return db['ChatWebsite']['find']({'attributes':['id',_0x2ee8dd],'where':{'id':_0x406168['params']['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x180fb7,null))[_0x82d7('0x1f')](function(_0xf242e8){if(_0xf242e8){var _0x5247e7=_0xf242e8[_0x2ee8dd];var _0x5edf99=_0x5247e7&&_0x5247e7[_0x82d7('0x119')]?_0x5247e7[_0x82d7('0x119')]:[];_0x180fb7[_0x82d7('0x39')]({'fromKey':_[_0x82d7('0x79')](_0x5247e7[_0x82d7('0x11a')])?undefined:_0x5247e7[_0x82d7('0x11a')],'count':_0x5edf99[_0x82d7('0x62')],'rows':_0x5edf99});}})[_0x82d7('0x27')](handleError(_0x180fb7,null));};exports[_0x82d7('0x11b')]=function(_0x5d8f66,_0x46401c,_0x4e5119){var _0x2f16db={'raw':![],'where':{}};var _0x2e61f5={};var _0x2ccfe8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x82d7('0x60')]({'where':{'id':_0x5d8f66[_0x82d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x46401c,null))[_0x82d7('0x1f')](function(_0x3b94f6){if(_0x3b94f6){_0x2e61f5[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0xd7')][_0x82d7('0x3e')]);_0x2e61f5[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x5d8f66['query']);_0x2e61f5[_0x82d7('0x42')]=_['intersection'](_0x2e61f5['model'],_0x2e61f5[_0x82d7('0x40')]);_0x2f16db[_0x82d7('0x45')]=_[_0x82d7('0x43')](_0x2e61f5[_0x82d7('0x3f')],qs['fields'](_0x5d8f66[_0x82d7('0x40')][_0x82d7('0x44')]));_0x2f16db[_0x82d7('0x45')]=_0x2f16db[_0x82d7('0x45')][_0x82d7('0x62')]?_0x2f16db[_0x82d7('0x45')]:_0x2e61f5[_0x82d7('0x3f')];if(!_0x5d8f66[_0x82d7('0x40')]['hasOwnProperty'](_0x82d7('0x47'))){_0x2f16db[_0x82d7('0x2d')]=qs[_0x82d7('0x2d')](_0x5d8f66[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x2f16db[_0x82d7('0x2c')]=qs[_0x82d7('0x2c')](_0x5d8f66[_0x82d7('0x40')][_0x82d7('0x2c')]);}_0x2f16db[_0x82d7('0x48')]=qs[_0x82d7('0x49')](_0x5d8f66[_0x82d7('0x40')]['sort']);_0x2f16db['where']=qs[_0x82d7('0x42')](_[_0x82d7('0x4b')](_0x5d8f66[_0x82d7('0x40')],_0x2e61f5['filters']));_0x2f16db['where'][_0x82d7('0x63')]=_0x3b94f6['id'];if(_0x5d8f66['query']['filter']){_0x2f16db[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x2f16db[_0x82d7('0x4a')],{'$or':_['map'](_0x2f16db[_0x82d7('0x45')],function(_0x45b190){var _0xbc2c0c={};_0xbc2c0c[_0x45b190]={'$like':'%'+_0x5d8f66[_0x82d7('0x40')][_0x82d7('0x64')]+'%'};return _0xbc2c0c;})});}_0x2f16db=_[_0x82d7('0x4c')]({},_0x2f16db,_0x5d8f66['options']);return db[_0x82d7('0xd7')]['count']({'where':_0x2f16db['where']})[_0x82d7('0x1f')](function(_0x579d67){_0x2ccfe8['count']=_0x579d67;if(_0x5d8f66[_0x82d7('0x40')]['includeAll']){_0x2f16db['include']=[{'all':!![]}];}else{_0x2f16db[_0x82d7('0x51')]=[{'model':db[_0x82d7('0x8a')],'as':_0x82d7('0xeb'),'required':![]}];}return db['ChatOfflineMessage'][_0x82d7('0x6a')](_0x2f16db);})[_0x82d7('0x1f')](function(_0x5671e1){_0x2ccfe8[_0x82d7('0x52')]=_0x5671e1;return _0x2ccfe8;});}})[_0x82d7('0x1f')](respondWithFilteredResult(_0x46401c,_0x2f16db))[_0x82d7('0x27')](handleError(_0x46401c,null));};exports[_0x82d7('0x11c')]=function(_0xf1c866,_0x207f71,_0x25a1d8){return db['ChatWebsite']['find']({'where':{'id':_0xf1c866[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x207f71,null))[_0x82d7('0x1f')](function(_0x5b2d78){if(_0x5b2d78){return _0x5b2d78['addAgents'](_0xf1c866[_0x82d7('0x56')][_0x82d7('0x66')],_[_0x82d7('0xe9')](_0xf1c866['body'],[_0x82d7('0x66'),'id'])||{})[_0x82d7('0xb7')](function(_0x2f45d2){for(var _0x30dd60=0x0;_0x30dd60<_0xf1c866['body'][_0x82d7('0x66')][_0x82d7('0x62')];_0x30dd60+=0x1){socket[_0x82d7('0x11d')](_0x82d7('0x11e'),{'UserId':_0xf1c866[_0x82d7('0x56')][_0x82d7('0x66')][_0x30dd60],'ChatWebsiteId':_0xf1c866[_0x82d7('0x53')]['id']});}return _0x2f45d2;});}})['then'](respondWithResult(_0x207f71,null))[_0x82d7('0x27')](handleError(_0x207f71,null));};exports[_0x82d7('0x11f')]=function(_0x3bf55b,_0x16543e,_0x1817f0){return db['ChatWebsite'][_0x82d7('0x54')]({'where':{'id':_0x3bf55b[_0x82d7('0x53')]['id']}})[_0x82d7('0x1f')](handleEntityNotFound(_0x16543e,null))[_0x82d7('0x1f')](function(_0x13364a){if(_0x13364a){return _0x13364a[_0x82d7('0x11f')](_0x3bf55b[_0x82d7('0x40')][_0x82d7('0x66')])[_0x82d7('0x1f')](function(){if(_[_0x82d7('0x120')](_0x3bf55b[_0x82d7('0x40')]['ids'])){for(var _0x479eb4=0x0;_0x479eb4<_0x3bf55b['query'][_0x82d7('0x66')][_0x82d7('0x62')];_0x479eb4+=0x1){socket[_0x82d7('0x11d')](_0x82d7('0x121'),{'UserId':Number(_0x3bf55b[_0x82d7('0x40')][_0x82d7('0x66')][_0x479eb4]),'ChatWebsiteId':Number(_0x3bf55b[_0x82d7('0x53')]['id'])});}}else{socket[_0x82d7('0x11d')](_0x82d7('0x121'),{'UserId':Number(_0x3bf55b[_0x82d7('0x40')][_0x82d7('0x66')]),'ChatWebsiteId':Number(_0x3bf55b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x16543e,null))[_0x82d7('0x27')](handleError(_0x16543e,null));};exports[_0x82d7('0x122')]=function(_0x367a57,_0x161860,_0x335d19){var _0x375b46={};var _0x119468={};var _0x300550;var _0x321d4b;return db[_0x82d7('0x3d')][_0x82d7('0x60')]({'where':{'id':_0x367a57[_0x82d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x161860,null))['then'](function(_0x54e87b){if(_0x54e87b){_0x300550=_0x54e87b;_0x119468[_0x82d7('0x3f')]=_[_0x82d7('0x41')](db[_0x82d7('0x123')]['rawAttributes']);_0x119468[_0x82d7('0x40')]=_[_0x82d7('0x41')](_0x367a57[_0x82d7('0x40')]);_0x119468[_0x82d7('0x42')]=_['intersection'](_0x119468[_0x82d7('0x3f')],_0x119468[_0x82d7('0x40')]);_0x375b46[_0x82d7('0x45')]=_['intersection'](_0x119468['model'],qs['fields'](_0x367a57['query'][_0x82d7('0x44')]));_0x375b46[_0x82d7('0x45')]=_0x375b46[_0x82d7('0x45')][_0x82d7('0x62')]?_0x375b46[_0x82d7('0x45')]:_0x119468['model'];_0x375b46[_0x82d7('0x48')]=qs[_0x82d7('0x49')](_0x367a57['query'][_0x82d7('0x49')]);_0x375b46['where']=qs[_0x82d7('0x42')](_['pick'](_0x367a57[_0x82d7('0x40')],_0x119468['filters']));if(_0x367a57['query']['filter']){_0x375b46[_0x82d7('0x4a')]=_[_0x82d7('0x4c')](_0x375b46[_0x82d7('0x4a')],{'$or':_[_0x82d7('0x3c')](_0x375b46['attributes'],function(_0x196894){var _0x48710e={};_0x48710e[_0x196894]={'$like':'%'+_0x367a57[_0x82d7('0x40')]['filter']+'%'};return _0x48710e;})});}_0x375b46=_['merge']({},_0x375b46,_0x367a57['options']);return _0x300550[_0x82d7('0x122')](_0x375b46);}})[_0x82d7('0x1f')](function(_0x1bb167){if(_0x1bb167){_0x321d4b=_0x1bb167[_0x82d7('0x62')];if(!_0x367a57[_0x82d7('0x40')]['hasOwnProperty']('nolimit')){_0x375b46[_0x82d7('0x2d')]=qs[_0x82d7('0x2d')](_0x367a57[_0x82d7('0x40')][_0x82d7('0x2d')]);_0x375b46['offset']=qs[_0x82d7('0x2c')](_0x367a57[_0x82d7('0x40')][_0x82d7('0x2c')]);}return _0x300550['getAgents'](_0x375b46);}})['then'](function(_0x367bfc){if(_0x367bfc){return _0x367bfc?{'count':_0x321d4b,'rows':_0x367bfc}:null;}})[_0x82d7('0x1f')](respondWithResult(_0x161860,null))['catch'](handleError(_0x161860,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ba74110..7904f2b 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 _0x5447=['exports','events','ChatWebsite','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x4de63a,_0x4fe658){var _0x203eb2=function(_0xa986e1){while(--_0xa986e1){_0x4de63a['push'](_0x4de63a['shift']());}};_0x203eb2(++_0x4fe658);}(_0x5447,0xf1));var _0x7544=function(_0x5e602c,_0x348a24){_0x5e602c=_0x5e602c-0x0;var _0x20e021=_0x5447[_0x5e602c];return _0x20e021;};'use strict';var EventEmitter=require(_0x7544('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x7544('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7544('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7544('0x3'),'afterDestroy':'remove'};function emitEvent(_0x6e3582){return function(_0x2b18eb,_0xe47f97,_0x340bda){ChatWebsiteEvents[_0x7544('0x4')](_0x6e3582+':'+_0x2b18eb['id'],_0x2b18eb);ChatWebsiteEvents[_0x7544('0x4')](_0x6e3582,_0x2b18eb);_0x340bda(null);};}for(var e in events){if(events[_0x7544('0x5')](e)){var event=events[e];ChatWebsite[_0x7544('0x6')](e,emitEvent(event));}}module[_0x7544('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xeac6=['hook','exports','events','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x5d42e8,_0x5364da){var _0x38705f=function(_0x384f87){while(--_0x384f87){_0x5d42e8['push'](_0x5d42e8['shift']());}};_0x38705f(++_0x5364da);}(_0xeac6,0xc0));var _0x6eac=function(_0x9ed883,_0x33fcbe){_0x9ed883=_0x9ed883-0x0;var _0x1ff7ee=_0xeac6[_0x9ed883];return _0x1ff7ee;};'use strict';var EventEmitter=require(_0x6eac('0x0'));var ChatWebsite=require(_0x6eac('0x1'))['db'][_0x6eac('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6eac('0x3'),'afterUpdate':_0x6eac('0x4'),'afterDestroy':_0x6eac('0x5')};function emitEvent(_0x42c90a){return function(_0xb084c9,_0x709357,_0x46a51b){ChatWebsiteEvents[_0x6eac('0x6')](_0x42c90a+':'+_0xb084c9['id'],_0xb084c9);ChatWebsiteEvents[_0x6eac('0x6')](_0x42c90a,_0xb084c9);_0x46a51b(null);};}for(var e in events){if(events[_0x6eac('0x7')](e)){var event=events[e];ChatWebsite[_0x6eac('0x8')](e,emitEvent(event));}}module[_0x6eac('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d43f642..e528695 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 _0x6f7a=['ChatWebsite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x106886,_0x21f84d){_0x106886=_0x106886-0x0;var _0x2b71c8=_0x6f7a[_0x106886];return _0x2b71c8;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d1=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x84bbdc,_0x4f8cb6){var _0x2e0d29=function(_0x3daff0){while(--_0x3daff0){_0x84bbdc['push'](_0x84bbdc['shift']());}};_0x2e0d29(++_0x4f8cb6);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd3d1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'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 7755b50..3865ca2 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 _0x781d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});config['redis']=_[_0xd781('0xc')](config[_0xd781('0xd')],{'host':_0xd781('0xe'),'port':0x18eb});var socket=require(_0xd781('0xf'))(new Redis(config['redis']));require(_0xd781('0x10'))['register'](socket);function respondWithRpcPromise(_0x43d863,_0x16360f,_0x509ca7){return new BPromise(function(_0x346756,_0x29c2a7){return client['request'](_0x43d863,_0x509ca7)['then'](function(_0x40a900){logger[_0xd781('0x11')](_0xd781('0x12'),_0x16360f,_0xd781('0x13'));logger[_0xd781('0x14')](_0xd781('0x15'),_0x16360f,_0xd781('0x13'),JSON[_0xd781('0x16')](_0x40a900));if(_0x40a900[_0xd781('0x17')]){if(_0x40a900[_0xd781('0x17')][_0xd781('0x18')]===0x1f4){logger['error'](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')]['message']);return _0x29c2a7(_0x40a900[_0xd781('0x17')]['message']);}logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);return _0x346756(_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);}else{logger[_0xd781('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x16360f,_0xd781('0x13'));_0x346756(_0x40a900[_0xd781('0x1a')][_0xd781('0x19')]);}})[_0xd781('0x1b')](function(_0x3bf805){logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x3bf805);_0x29c2a7(_0x3bf805);});});} \ No newline at end of file +var _0x896e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x318dfd,_0xed6487){var _0x450384=function(_0x2cc4d9){while(--_0x2cc4d9){_0x318dfd['push'](_0x318dfd['shift']());}};_0x450384(++_0xed6487);}(_0x896e,0x1e9));var _0xe896=function(_0x3109b8,_0x344c00){_0x3109b8=_0x3109b8-0x0;var _0x5968d0=_0x896e[_0x3109b8];return _0x5968d0;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d61e7ee..61af023 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x416928,_0x1078dc){var _0x21f8d6=function(_0x5125eb){while(--_0x5125eb){_0x416928['push'](_0x416928['shift']());}};_0x21f8d6(++_0x1078dc);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ef911,_0x32a38b){_0x1ef911=_0x1ef911-0x0;var _0x5297f4=_0xb10b[_0x1ef911];return _0x5297f4;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x8f1099,_0x575d3d){var _0x472bb2=function(_0x1d0706){while(--_0x1d0706){_0x8f1099['push'](_0x8f1099['shift']());}};_0x472bb2(++_0x575d3d);}(_0x7a54,0x106));var _0x47a5=function(_0x4856a9,_0x1efbf3){_0x4856a9=_0x4856a9-0x0;var _0x53a28d=_0x7a54[_0x4856a9];return _0x53a28d;};'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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4326ec8..00bede5 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 _0x3423=['removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','create','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','diskStorage','join','format','now','single','file','addLogo','server/files/images/avatars/','%s-%s','root','originalname','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','/:id/users'];(function(_0x4b9447,_0x43b76c){var _0x5636d9=function(_0x5a9c1a){while(--_0x5a9c1a){_0x4b9447['push'](_0x4b9447['shift']());}};_0x5636d9(++_0x43b76c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['get']('/:id/dispositions',auth[_0x3342('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router[_0x3342('0x8')]('/:id/logo',controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),controller[_0x3342('0x12')]);router['get'](_0x3342('0x13'),controller[_0x3342('0x14')]);router[_0x3342('0x8')](_0x3342('0x15'),controller[_0x3342('0x16')]);router[_0x3342('0x8')](_0x3342('0x17'),auth['isAuthenticated'](),controller[_0x3342('0x18')]);router[_0x3342('0x8')]('/:id/snippet',controller[_0x3342('0x19')]);router[_0x3342('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3342('0x1a')]);router[_0x3342('0x8')](_0x3342('0x1b'),auth[_0x3342('0x9')](),controller[_0x3342('0x1c')]);router[_0x3342('0x8')](_0x3342('0x1d'),controller[_0x3342('0x1e')]);router[_0x3342('0x8')]('/:id/offline_messages',auth[_0x3342('0x9')](),controller[_0x3342('0x1f')]);router[_0x3342('0x8')]('/:id/users',auth[_0x3342('0x9')](),controller[_0x3342('0x20')]);router['post']('/',auth[_0x3342('0x9')](),controller[_0x3342('0x21')]);router['post'](_0x3342('0x22'),auth['isAuthenticated'](),controller[_0x3342('0x23')]);router[_0x3342('0x24')](_0x3342('0x25'),auth[_0x3342('0x9')](),controller[_0x3342('0x26')]);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x26eb87,_0x2d8622,_0x5d4f14){_0x5d4f14(null,path[_0x3342('0x28')](config['root'],'server/files/images/logos/'));},'filename':function(_0x986ab0,_0x52ba65,_0x5d2f0b){_0x5d2f0b(null,util[_0x3342('0x29')]('%s-%s',Date[_0x3342('0x2a')](),_0x52ba65['originalname']));}})});router['post']('/:id/logo',upload[_0x3342('0x2b')](_0x3342('0x2c')),controller[_0x3342('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc275a1,_0x1275e2,_0x1cc542){_0x1cc542(null,path[_0x3342('0x28')](config['root'],_0x3342('0x2e')));},'filename':function(_0x3d6810,_0x387ba2,_0x301114){_0x301114(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x387ba2['originalname']));}})});router[_0x3342('0x24')]('/:id/avatar',upload[_0x3342('0x2b')](_0x3342('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x1cc42d,_0x347d52,_0x4e7410){_0x4e7410(null,path['join'](config[_0x3342('0x30')],_0x3342('0x2e')));},'filename':function(_0x311cfe,_0x948535,_0x3156b5){_0x3156b5(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x948535[_0x3342('0x31')]));}})});router[_0x3342('0x24')](_0x3342('0x13'),upload[_0x3342('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x58157e,_0x400019,_0x464650){_0x464650(null,path[_0x3342('0x28')](config[_0x3342('0x30')],_0x3342('0x2e')));},'filename':function(_0xd0256d,_0x956cde,_0x5d460c){_0x5d460c(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x956cde[_0x3342('0x31')]));}})});router[_0x3342('0x24')]('/:id/system_avatar',upload[_0x3342('0x2b')]('file'),controller[_0x3342('0x32')]);router[_0x3342('0x24')](_0x3342('0x33'),controller[_0x3342('0x34')]);router['post'](_0x3342('0x35'),controller['offline']);router[_0x3342('0x24')](_0x3342('0x17'),auth[_0x3342('0x9')](),controller[_0x3342('0x36')]);router[_0x3342('0x24')](_0x3342('0x37'),auth[_0x3342('0x9')](),controller['addApplications']);router[_0x3342('0x24')](_0x3342('0x1b'),auth['isAuthenticated'](),controller[_0x3342('0x38')]);router[_0x3342('0x24')]('/:id/users',auth[_0x3342('0x9')](),controller[_0x3342('0x39')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x3a')]);router[_0x3342('0x3b')]('/:id',auth[_0x3342('0x9')](),controller[_0x3342('0x3c')]);router[_0x3342('0x3b')](_0x3342('0x22'),auth[_0x3342('0x9')](),controller[_0x3342('0x3d')]);router[_0x3342('0x3b')](_0x3342('0x25'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3342('0x3b')](_0x3342('0x3e'),auth[_0x3342('0x9')](),controller[_0x3342('0x3f')]);module[_0x3342('0x40')]=router; \ No newline at end of file +var _0xf4f4=['create','addDisposition','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','format','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x477328,_0x132b3f){_0x477328=_0x477328-0x0;var _0x91ccd0=_0xf4f4[_0x477328];return _0x91ccd0;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xa')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0xa')](_0x4f4f('0x11'),auth[_0x4f4f('0x8')](),controller['getAnswers']);router['get'](_0x4f4f('0x12'),controller[_0x4f4f('0x13')]);router[_0x4f4f('0xa')](_0x4f4f('0x14'),controller[_0x4f4f('0x15')]);router[_0x4f4f('0xa')]('/:id/customer_avatar',controller[_0x4f4f('0x16')]);router['get'](_0x4f4f('0x17'),controller[_0x4f4f('0x18')]);router[_0x4f4f('0xa')](_0x4f4f('0x19'),auth['isAuthenticated'](),controller[_0x4f4f('0x1a')]);router['get']('/:id/snippet',controller['getSnippet']);router[_0x4f4f('0xa')](_0x4f4f('0x1b'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0xa')](_0x4f4f('0x1d'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1e')]);router[_0x4f4f('0xa')](_0x4f4f('0x1f'),controller[_0x4f4f('0x20')]);router[_0x4f4f('0xa')]('/:id/offline_messages',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0xa')](_0x4f4f('0x22'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x23')]);router[_0x4f4f('0x24')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x25')]);router[_0x4f4f('0x24')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x26')]);router[_0x4f4f('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4f4f('0x27')]({'destination':function(_0x43e661,_0x5186ac,_0x3960ae){_0x3960ae(null,path[_0x4f4f('0x28')](config[_0x4f4f('0x29')],_0x4f4f('0x2a')));},'filename':function(_0x113ff7,_0x31b30e,_0xa6371b){_0xa6371b(null,util['format'](_0x4f4f('0x2b'),Date[_0x4f4f('0x2c')](),_0x31b30e[_0x4f4f('0x2d')]));}})});router[_0x4f4f('0x24')](_0x4f4f('0x12'),upload['single'](_0x4f4f('0x2e')),controller[_0x4f4f('0x2f')]);var upload=multer({'storage':multer[_0x4f4f('0x27')]({'destination':function(_0x5deda9,_0x534075,_0x4c2490){_0x4c2490(null,path[_0x4f4f('0x28')](config['root'],_0x4f4f('0x30')));},'filename':function(_0x39c1a8,_0x2e688a,_0x5eb7c9){_0x5eb7c9(null,util[_0x4f4f('0x31')](_0x4f4f('0x2b'),Date['now'](),_0x2e688a[_0x4f4f('0x2d')]));}})});router[_0x4f4f('0x24')](_0x4f4f('0x14'),upload['single'](_0x4f4f('0x2e')),controller[_0x4f4f('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5517d7,_0x465a36,_0x305bf7){_0x305bf7(null,path[_0x4f4f('0x28')](config[_0x4f4f('0x29')],_0x4f4f('0x30')));},'filename':function(_0x8d0f53,_0x14ef6c,_0x373626){_0x373626(null,util[_0x4f4f('0x31')](_0x4f4f('0x2b'),Date['now'](),_0x14ef6c['originalname']));}})});router[_0x4f4f('0x24')]('/:id/customer_avatar',upload[_0x4f4f('0x33')](_0x4f4f('0x2e')),controller[_0x4f4f('0x34')]);var upload=multer({'storage':multer[_0x4f4f('0x27')]({'destination':function(_0x2c0c14,_0xb0b0bc,_0x76c93){_0x76c93(null,path[_0x4f4f('0x28')](config[_0x4f4f('0x29')],_0x4f4f('0x30')));},'filename':function(_0x45fd8d,_0x2207f3,_0x492fac){_0x492fac(null,util[_0x4f4f('0x31')](_0x4f4f('0x2b'),Date[_0x4f4f('0x2c')](),_0x2207f3[_0x4f4f('0x2d')]));}})});router[_0x4f4f('0x24')](_0x4f4f('0x17'),upload[_0x4f4f('0x33')](_0x4f4f('0x2e')),controller[_0x4f4f('0x35')]);router['post'](_0x4f4f('0x36'),controller[_0x4f4f('0x37')]);router[_0x4f4f('0x24')]('/:id/offline',controller['offline']);router[_0x4f4f('0x24')](_0x4f4f('0x19'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x38')]);router[_0x4f4f('0x24')](_0x4f4f('0x1b'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x39')]);router[_0x4f4f('0x24')](_0x4f4f('0x1d'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x3a')]);router['post'](_0x4f4f('0x22'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x3b')]);router[_0x4f4f('0x3c')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x4f4f('0x3d')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x3e')]);router['delete'](_0x4f4f('0xf'),auth['isAuthenticated'](),controller[_0x4f4f('0x3f')]);router['delete']('/:id/canned_answers',auth[_0x4f4f('0x8')](),controller['removeAnswers']);router[_0x4f4f('0x3d')](_0x4f4f('0x22'),auth['isAuthenticated'](),controller[_0x4f4f('0x40')]);module[_0x4f4f('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1194b48..5900eed 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 _0x9261=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9261,0x1de));var _0x1926=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x9261[_0x557f5f];return _0x196eba;};'use strict';var Sequelize=require(_0x1926('0x0'));module[_0x1926('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1926('0x2')](_0x1926('0x3'),_0x1926('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x1926('0x5')]}}; \ No newline at end of file +var _0xf8af=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xf8af,0x8b));var _0xff8a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf8af[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xff8a('0x2')](_0xff8a('0x3'),_0xff8a('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xff8a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b9cb68e..bb0d8bd 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 _0x31f5=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','end','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','create','body','find','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2759b8,_0x3805a9){var _0x2cd2c0=function(_0x22976c){while(--_0x22976c){_0x2759b8['push'](_0x2759b8['shift']());}};_0x2cd2c0(++_0x3805a9);}(_0x31f5,0x175));var _0x531f=function(_0x1d54bc,_0x2dee31){_0x1d54bc=_0x1d54bc-0x0;var _0x4ef2ce=_0x31f5[_0x1d54bc];return _0x4ef2ce;};'use strict';var pdf=require(_0x531f('0x0'));var emlformat=require(_0x531f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x531f('0x2'));var jsonpatch=require(_0x531f('0x3'));var rp=require(_0x531f('0x4'));var moment=require(_0x531f('0x5'));var BPromise=require(_0x531f('0x6'));var Mustache=require('mustache');var util=require(_0x531f('0x7'));var path=require(_0x531f('0x8'));var sox=require(_0x531f('0x9'));var csv=require('to-csv');var ejs=require(_0x531f('0xa'));var fs=require('fs');var _=require(_0x531f('0xb'));var squel=require(_0x531f('0xc'));var crypto=require(_0x531f('0xd'));var jsforce=require(_0x531f('0xe'));var deskjs=require(_0x531f('0xf'));var toCsv=require(_0x531f('0x10'));var querystring=require(_0x531f('0x11'));var Papa=require(_0x531f('0x12'));var Redis=require(_0x531f('0x13'));var authService=require(_0x531f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x531f('0x15'));var logger=require(_0x531f('0x16'))('api');var utils=require(_0x531f('0x17'));var config=require(_0x531f('0x18'));var licenseUtil=require(_0x531f('0x19'));var db=require(_0x531f('0x1a'))['db'];function respondWithStatusCode(_0x221fb2,_0x3ba451){_0x3ba451=_0x3ba451||0xcc;return function(_0xf17d5e){if(_0xf17d5e){return _0x221fb2[_0x531f('0x1b')](_0x3ba451);}return _0x221fb2[_0x531f('0x1c')](_0x3ba451)['end']();};}function respondWithResult(_0x48bc2e,_0x24c8a8){_0x24c8a8=_0x24c8a8||0xc8;return function(_0xc42127){if(_0xc42127){return _0x48bc2e[_0x531f('0x1c')](_0x24c8a8)[_0x531f('0x1d')](_0xc42127);}};}function respondWithFilteredResult(_0x53665c,_0xcf121c){return function(_0x5bff77){if(_0x5bff77){var _0x5ef1cf=_0x5bff77['count'],_0x50c755=_0xcf121c[_0x531f('0x1e')],_0x41bb76=_0xcf121c['offset']+_0xcf121c[_0x531f('0x1f')],_0x2ef177;if(_0x41bb76>=_0x5ef1cf){_0x41bb76=_0x5ef1cf;_0x2ef177=0xc8;}else{_0x2ef177=0xce;}_0x53665c[_0x531f('0x1c')](_0x2ef177);return _0x53665c[_0x531f('0x20')]('Content-Range',_0x50c755+'-'+_0x41bb76+'/'+_0x5ef1cf)[_0x531f('0x1d')](_0x5bff77);}return null;};}function patchUpdates(_0x52c948){return function(_0x5618a3){try{jsonpatch[_0x531f('0x21')](_0x5618a3,_0x52c948,!![]);}catch(_0x34079f){return BPromise[_0x531f('0x22')](_0x34079f);}return _0x5618a3[_0x531f('0x23')]();};}function saveUpdates(_0x3160b8,_0x40fe70){return function(_0x2096ed){if(_0x2096ed){return _0x2096ed[_0x531f('0x24')](_0x3160b8)['then'](function(_0x197c57){return _0x197c57;});}return null;};}function removeEntity(_0x4aedf6,_0x6407aa){return function(_0x59d329){if(_0x59d329){return _0x59d329['destroy']()[_0x531f('0x25')](function(){_0x4aedf6['status'](0xcc)[_0x531f('0x26')]();});}};}function handleEntityNotFound(_0x16add3,_0x562d22){return function(_0xb59fb3){if(!_0xb59fb3){_0x16add3['sendStatus'](0x194);}return _0xb59fb3;};}function handleError(_0x294c0a,_0x59a868){_0x59a868=_0x59a868||0x1f4;return function(_0x598bca){logger['error'](_0x598bca['stack']);if(_0x598bca[_0x531f('0x27')]){delete _0x598bca[_0x531f('0x27')];}_0x294c0a[_0x531f('0x1c')](_0x59a868)[_0x531f('0x28')](_0x598bca);};}exports[_0x531f('0x29')]=function(_0x5a7e26,_0x383726){var _0x5b9f7d={},_0x5c46de={},_0xbb358c={'count':0x0,'rows':[]};var _0x24dabd=_[_0x531f('0x2a')](db[_0x531f('0x2b')][_0x531f('0x2c')],function(_0x4dad0a){return{'name':_0x4dad0a[_0x531f('0x2d')],'type':_0x4dad0a[_0x531f('0x2e')]['key']};});_0x5c46de['model']=_[_0x531f('0x2a')](_0x24dabd,_0x531f('0x27'));_0x5c46de[_0x531f('0x2f')]=_['keys'](_0x5a7e26['query']);_0x5c46de[_0x531f('0x30')]=_[_0x531f('0x31')](_0x5c46de[_0x531f('0x32')],_0x5c46de['query']);_0x5b9f7d[_0x531f('0x33')]=_[_0x531f('0x31')](_0x5c46de[_0x531f('0x32')],qs[_0x531f('0x34')](_0x5a7e26['query'][_0x531f('0x34')]));_0x5b9f7d[_0x531f('0x33')]=_0x5b9f7d[_0x531f('0x33')][_0x531f('0x35')]?_0x5b9f7d[_0x531f('0x33')]:_0x5c46de[_0x531f('0x32')];if(!_0x5a7e26[_0x531f('0x2f')][_0x531f('0x36')](_0x531f('0x37'))){_0x5b9f7d['limit']=qs[_0x531f('0x1f')](_0x5a7e26[_0x531f('0x2f')][_0x531f('0x1f')]);_0x5b9f7d[_0x531f('0x1e')]=qs['offset'](_0x5a7e26[_0x531f('0x2f')]['offset']);}_0x5b9f7d[_0x531f('0x38')]=qs[_0x531f('0x39')](_0x5a7e26[_0x531f('0x2f')][_0x531f('0x39')]);_0x5b9f7d[_0x531f('0x3a')]=qs[_0x531f('0x30')](_['pick'](_0x5a7e26[_0x531f('0x2f')],_0x5c46de[_0x531f('0x30')]),_0x24dabd);if(_0x5a7e26[_0x531f('0x2f')][_0x531f('0x3b')]){_0x5b9f7d[_0x531f('0x3a')]=_[_0x531f('0x3c')](_0x5b9f7d['where'],{'$or':_[_0x531f('0x2a')](_0x24dabd,function(_0x137eb4){if(_0x137eb4[_0x531f('0x2e')]!==_0x531f('0x3d')){var _0x3266ee={};_0x3266ee[_0x137eb4[_0x531f('0x27')]]={'$like':'%'+_0x5a7e26['query'][_0x531f('0x3b')]+'%'};return _0x3266ee;}})});}_0x5b9f7d=_['merge']({},_0x5b9f7d,_0x5a7e26['options']);var _0x38be6c={'where':_0x5b9f7d[_0x531f('0x3a')]};return db[_0x531f('0x2b')][_0x531f('0x3e')](_0x38be6c)[_0x531f('0x25')](function(_0x5a3673){_0xbb358c['count']=_0x5a3673;if(_0x5a7e26[_0x531f('0x2f')][_0x531f('0x3f')]){_0x5b9f7d['include']=[{'all':!![]}];}return db[_0x531f('0x2b')][_0x531f('0x40')](_0x5b9f7d);})[_0x531f('0x25')](function(_0x5e1a4c){_0xbb358c[_0x531f('0x41')]=_0x5e1a4c;return _0xbb358c;})[_0x531f('0x25')](respondWithFilteredResult(_0x383726,_0x5b9f7d))[_0x531f('0x42')](handleError(_0x383726,null));};exports[_0x531f('0x43')]=function(_0x1ce639,_0x39bcc0){var _0x4ee3fe={'raw':!![],'where':{'id':_0x1ce639[_0x531f('0x44')]['id']}},_0x18240b={};_0x18240b['model']=_['keys'](db[_0x531f('0x2b')][_0x531f('0x2c')]);_0x18240b[_0x531f('0x2f')]=_[_0x531f('0x45')](_0x1ce639[_0x531f('0x2f')]);_0x18240b[_0x531f('0x30')]=_[_0x531f('0x31')](_0x18240b[_0x531f('0x32')],_0x18240b['query']);_0x4ee3fe['attributes']=_[_0x531f('0x31')](_0x18240b[_0x531f('0x32')],qs[_0x531f('0x34')](_0x1ce639[_0x531f('0x2f')]['fields']));_0x4ee3fe['attributes']=_0x4ee3fe[_0x531f('0x33')][_0x531f('0x35')]?_0x4ee3fe[_0x531f('0x33')]:_0x18240b[_0x531f('0x32')];if(_0x1ce639['query'][_0x531f('0x3f')]){_0x4ee3fe[_0x531f('0x46')]=[{'all':!![]}];}_0x4ee3fe=_[_0x531f('0x3c')]({},_0x4ee3fe,_0x1ce639[_0x531f('0x47')]);return db[_0x531f('0x2b')]['find'](_0x4ee3fe)['then'](handleEntityNotFound(_0x39bcc0,null))[_0x531f('0x25')](respondWithResult(_0x39bcc0,null))[_0x531f('0x42')](handleError(_0x39bcc0,null));};exports['create']=function(_0x50089a,_0x490215){return db[_0x531f('0x2b')][_0x531f('0x48')](_0x50089a['body'],{})[_0x531f('0x25')](respondWithResult(_0x490215,0xc9))['catch'](handleError(_0x490215,null));};exports[_0x531f('0x24')]=function(_0x172d20,_0x28263f){if(_0x172d20[_0x531f('0x49')]['id']){delete _0x172d20[_0x531f('0x49')]['id'];}return db[_0x531f('0x2b')][_0x531f('0x4a')]({'where':{'id':_0x172d20[_0x531f('0x44')]['id']}})[_0x531f('0x25')](handleEntityNotFound(_0x28263f,null))[_0x531f('0x25')](saveUpdates(_0x172d20[_0x531f('0x49')],null))[_0x531f('0x25')](respondWithResult(_0x28263f,null))[_0x531f('0x42')](handleError(_0x28263f,null));};exports[_0x531f('0x4b')]=function(_0x1a2c30,_0x501eff){return db[_0x531f('0x2b')][_0x531f('0x4a')]({'where':{'id':_0x1a2c30[_0x531f('0x44')]['id']}})[_0x531f('0x25')](handleEntityNotFound(_0x501eff,null))[_0x531f('0x25')](removeEntity(_0x501eff,null))[_0x531f('0x42')](handleError(_0x501eff,null));}; \ No newline at end of file +var _0x8a05=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x367b08,_0x403c86){var _0x1b8f2c=function(_0x56c457){while(--_0x56c457){_0x367b08['push'](_0x367b08['shift']());}};_0x1b8f2c(++_0x403c86);}(_0x8a05,0x1b0));var _0x58a0=function(_0x5d973d,_0x324866){_0x5d973d=_0x5d973d-0x0;var _0xfb7f41=_0x8a05[_0x5d973d];return _0xfb7f41;};'use strict';var pdf=require(_0x58a0('0x0'));var emlformat=require(_0x58a0('0x1'));var rimraf=require(_0x58a0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x58a0('0x3'));var moment=require(_0x58a0('0x4'));var BPromise=require(_0x58a0('0x5'));var Mustache=require(_0x58a0('0x6'));var util=require(_0x58a0('0x7'));var path=require(_0x58a0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x58a0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x58a0('0xa'));var crypto=require(_0x58a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x58a0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x58a0('0xd'));var Papa=require(_0x58a0('0xe'));var Redis=require(_0x58a0('0xf'));var authService=require(_0x58a0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x58a0('0x11'));var hardwareService=require(_0x58a0('0x12'));var logger=require(_0x58a0('0x13'))(_0x58a0('0x14'));var utils=require(_0x58a0('0x15'));var config=require(_0x58a0('0x16'));var licenseUtil=require(_0x58a0('0x17'));var db=require(_0x58a0('0x18'))['db'];function respondWithStatusCode(_0x2117b0,_0x322f07){_0x322f07=_0x322f07||0xcc;return function(_0x3c860a){if(_0x3c860a){return _0x2117b0[_0x58a0('0x19')](_0x322f07);}return _0x2117b0[_0x58a0('0x1a')](_0x322f07)[_0x58a0('0x1b')]();};}function respondWithResult(_0x4362ea,_0x4b5f53){_0x4b5f53=_0x4b5f53||0xc8;return function(_0x29202e){if(_0x29202e){return _0x4362ea[_0x58a0('0x1a')](_0x4b5f53)['json'](_0x29202e);}};}function respondWithFilteredResult(_0x96cd9e,_0x2c8665){return function(_0x16900b){if(_0x16900b){var _0x20ca20=_0x16900b[_0x58a0('0x1c')],_0x2e1144=_0x2c8665[_0x58a0('0x1d')],_0x20628f=_0x2c8665['offset']+_0x2c8665[_0x58a0('0x1e')],_0xa74d08;if(_0x20628f>=_0x20ca20){_0x20628f=_0x20ca20;_0xa74d08=0xc8;}else{_0xa74d08=0xce;}_0x96cd9e['status'](_0xa74d08);return _0x96cd9e[_0x58a0('0x1f')](_0x58a0('0x20'),_0x2e1144+'-'+_0x20628f+'/'+_0x20ca20)[_0x58a0('0x21')](_0x16900b);}return null;};}function patchUpdates(_0x1a5455){return function(_0x2a93d7){try{jsonpatch['apply'](_0x2a93d7,_0x1a5455,!![]);}catch(_0x2bdaf1){return BPromise[_0x58a0('0x22')](_0x2bdaf1);}return _0x2a93d7[_0x58a0('0x23')]();};}function saveUpdates(_0x95c52,_0x5d0820){return function(_0x46e0a0){if(_0x46e0a0){return _0x46e0a0[_0x58a0('0x24')](_0x95c52)['then'](function(_0x3175d6){return _0x3175d6;});}return null;};}function removeEntity(_0x566e8c,_0x2b4d94){return function(_0x1683ba){if(_0x1683ba){return _0x1683ba[_0x58a0('0x25')]()[_0x58a0('0x26')](function(){_0x566e8c[_0x58a0('0x1a')](0xcc)[_0x58a0('0x1b')]();});}};}function handleEntityNotFound(_0x3707cd,_0x355fbe){return function(_0x2acd71){if(!_0x2acd71){_0x3707cd[_0x58a0('0x19')](0x194);}return _0x2acd71;};}function handleError(_0x3fb606,_0x446dcb){_0x446dcb=_0x446dcb||0x1f4;return function(_0x595d69){logger[_0x58a0('0x27')](_0x595d69[_0x58a0('0x28')]);if(_0x595d69[_0x58a0('0x29')]){delete _0x595d69['name'];}_0x3fb606[_0x58a0('0x1a')](_0x446dcb)[_0x58a0('0x2a')](_0x595d69);};}exports['index']=function(_0x1f8cf6,_0x1fcaf1){var _0x2f231c={},_0x2b249c={},_0x1e4e24={'count':0x0,'rows':[]};var _0xbe78a=_[_0x58a0('0x2b')](db[_0x58a0('0x2c')][_0x58a0('0x2d')],function(_0xe6b2d5){return{'name':_0xe6b2d5[_0x58a0('0x2e')],'type':_0xe6b2d5[_0x58a0('0x2f')][_0x58a0('0x30')]};});_0x2b249c[_0x58a0('0x31')]=_[_0x58a0('0x2b')](_0xbe78a,_0x58a0('0x29'));_0x2b249c[_0x58a0('0x32')]=_['keys'](_0x1f8cf6['query']);_0x2b249c['filters']=_[_0x58a0('0x33')](_0x2b249c[_0x58a0('0x31')],_0x2b249c[_0x58a0('0x32')]);_0x2f231c[_0x58a0('0x34')]=_[_0x58a0('0x33')](_0x2b249c[_0x58a0('0x31')],qs['fields'](_0x1f8cf6['query'][_0x58a0('0x35')]));_0x2f231c[_0x58a0('0x34')]=_0x2f231c[_0x58a0('0x34')][_0x58a0('0x36')]?_0x2f231c[_0x58a0('0x34')]:_0x2b249c[_0x58a0('0x31')];if(!_0x1f8cf6['query']['hasOwnProperty'](_0x58a0('0x37'))){_0x2f231c['limit']=qs[_0x58a0('0x1e')](_0x1f8cf6['query']['limit']);_0x2f231c[_0x58a0('0x1d')]=qs['offset'](_0x1f8cf6[_0x58a0('0x32')][_0x58a0('0x1d')]);}_0x2f231c['order']=qs[_0x58a0('0x38')](_0x1f8cf6['query']['sort']);_0x2f231c[_0x58a0('0x39')]=qs['filters'](_[_0x58a0('0x3a')](_0x1f8cf6[_0x58a0('0x32')],_0x2b249c[_0x58a0('0x3b')]),_0xbe78a);if(_0x1f8cf6['query'][_0x58a0('0x3c')]){_0x2f231c[_0x58a0('0x39')]=_['merge'](_0x2f231c['where'],{'$or':_[_0x58a0('0x2b')](_0xbe78a,function(_0x3e7231){if(_0x3e7231['type']!==_0x58a0('0x3d')){var _0x58cb4d={};_0x58cb4d[_0x3e7231[_0x58a0('0x29')]]={'$like':'%'+_0x1f8cf6[_0x58a0('0x32')][_0x58a0('0x3c')]+'%'};return _0x58cb4d;}})});}_0x2f231c=_[_0x58a0('0x3e')]({},_0x2f231c,_0x1f8cf6[_0x58a0('0x3f')]);var _0x34ac5e={'where':_0x2f231c[_0x58a0('0x39')]};return db[_0x58a0('0x2c')][_0x58a0('0x1c')](_0x34ac5e)[_0x58a0('0x26')](function(_0x51279a){_0x1e4e24[_0x58a0('0x1c')]=_0x51279a;if(_0x1f8cf6[_0x58a0('0x32')][_0x58a0('0x40')]){_0x2f231c['include']=[{'all':!![]}];}return db[_0x58a0('0x2c')][_0x58a0('0x41')](_0x2f231c);})[_0x58a0('0x26')](function(_0x4ec6e1){_0x1e4e24[_0x58a0('0x42')]=_0x4ec6e1;return _0x1e4e24;})[_0x58a0('0x26')](respondWithFilteredResult(_0x1fcaf1,_0x2f231c))[_0x58a0('0x43')](handleError(_0x1fcaf1,null));};exports[_0x58a0('0x44')]=function(_0x9289db,_0x228e37){var _0x5d2238={'raw':!![],'where':{'id':_0x9289db[_0x58a0('0x45')]['id']}},_0x5d7232={};_0x5d7232['model']=_[_0x58a0('0x46')](db['CloudProvider'][_0x58a0('0x2d')]);_0x5d7232[_0x58a0('0x32')]=_[_0x58a0('0x46')](_0x9289db[_0x58a0('0x32')]);_0x5d7232[_0x58a0('0x3b')]=_[_0x58a0('0x33')](_0x5d7232[_0x58a0('0x31')],_0x5d7232[_0x58a0('0x32')]);_0x5d2238[_0x58a0('0x34')]=_[_0x58a0('0x33')](_0x5d7232[_0x58a0('0x31')],qs['fields'](_0x9289db[_0x58a0('0x32')][_0x58a0('0x35')]));_0x5d2238[_0x58a0('0x34')]=_0x5d2238['attributes'][_0x58a0('0x36')]?_0x5d2238[_0x58a0('0x34')]:_0x5d7232[_0x58a0('0x31')];if(_0x9289db['query'][_0x58a0('0x40')]){_0x5d2238[_0x58a0('0x47')]=[{'all':!![]}];}_0x5d2238=_[_0x58a0('0x3e')]({},_0x5d2238,_0x9289db[_0x58a0('0x3f')]);return db[_0x58a0('0x2c')][_0x58a0('0x48')](_0x5d2238)[_0x58a0('0x26')](handleEntityNotFound(_0x228e37,null))[_0x58a0('0x26')](respondWithResult(_0x228e37,null))[_0x58a0('0x43')](handleError(_0x228e37,null));};exports[_0x58a0('0x49')]=function(_0x5ae3e7,_0x5a85f7){return db[_0x58a0('0x2c')][_0x58a0('0x49')](_0x5ae3e7[_0x58a0('0x4a')],{})[_0x58a0('0x26')](respondWithResult(_0x5a85f7,0xc9))['catch'](handleError(_0x5a85f7,null));};exports[_0x58a0('0x24')]=function(_0x142a4d,_0x30a025){if(_0x142a4d[_0x58a0('0x4a')]['id']){delete _0x142a4d[_0x58a0('0x4a')]['id'];}return db[_0x58a0('0x2c')]['find']({'where':{'id':_0x142a4d[_0x58a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x30a025,null))['then'](saveUpdates(_0x142a4d[_0x58a0('0x4a')],null))['then'](respondWithResult(_0x30a025,null))[_0x58a0('0x43')](handleError(_0x30a025,null));};exports[_0x58a0('0x25')]=function(_0x21c86e,_0x5d1d97){return db[_0x58a0('0x2c')][_0x58a0('0x48')]({'where':{'id':_0x21c86e[_0x58a0('0x45')]['id']}})[_0x58a0('0x26')](handleEntityNotFound(_0x5d1d97,null))[_0x58a0('0x26')](removeEntity(_0x5d1d97,null))[_0x58a0('0x43')](handleError(_0x5d1d97,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4259436..e334a92 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 _0x7a59=['exports','define','cloud_providers','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a59,0x1e9));var _0x97a5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7a59[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x97a5('0x0'));var util=require(_0x97a5('0x1'));var logger=require('../../config/logger')(_0x97a5('0x2'));var moment=require('moment');var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97a5('0x5'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x97a5('0x6')]=function(_0x1e80db,_0x18ed88){return _0x1e80db[_0x97a5('0x7')]('CloudProvider',attributes,{'tableName':_0x97a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab05=['../../config/environment','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x63951e,_0x48685d){var _0x3bf46a=function(_0x21635e){while(--_0x21635e){_0x63951e['push'](_0x63951e['shift']());}};_0x3bf46a(++_0x48685d);}(_0xab05,0x1e4));var _0x5ab0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xab05[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5ab0('0x0'));var util=require(_0x5ab0('0x1'));var logger=require(_0x5ab0('0x2'))(_0x5ab0('0x3'));var moment=require(_0x5ab0('0x4'));var BPromise=require(_0x5ab0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ab0('0x6'));var rimraf=require(_0x5ab0('0x7'));var config=require(_0x5ab0('0x8'));var attributes=require('./cloudProvider.attributes');module[_0x5ab0('0x9')]=function(_0x50d58d,_0x24a8e1){return _0x50d58d['define'](_0x5ab0('0xa'),attributes,{'tableName':_0x5ab0('0xb'),'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 db9009e..f83faa9 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 _0x8c07=['request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x41d7c1,_0x5d60e0){var _0x394173=function(_0x11ae87){while(--_0x11ae87){_0x41d7c1['push'](_0x41d7c1['shift']());}};_0x394173(++_0x5d60e0);}(_0x8c07,0x167));var _0x78c0=function(_0x4ee320,_0x2df17a){_0x4ee320=_0x4ee320-0x0;var _0xe9262a=_0x8c07[_0x4ee320];return _0xe9262a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78c0('0x0'));var BPromise=require(_0x78c0('0x1'));var rs=require(_0x78c0('0x2'));var fs=require('fs');var Redis=require(_0x78c0('0x3'));var db=require(_0x78c0('0x4'))['db'];var utils=require(_0x78c0('0x5'));var logger=require(_0x78c0('0x6'))(_0x78c0('0x7'));var config=require(_0x78c0('0x8'));var jayson=require(_0x78c0('0x9'));var client=jayson[_0x78c0('0xa')][_0x78c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d46bf,_0x102e78,_0x5cea91){return new BPromise(function(_0x2f2fe3,_0x5e2fb6){return client['request'](_0x1d46bf,_0x5cea91)[_0x78c0('0xc')](function(_0x59fbf2){logger[_0x78c0('0xd')](_0x78c0('0xe'),_0x102e78,_0x78c0('0xf'));logger['debug'](_0x78c0('0x10'),_0x102e78,'request\x20sent',JSON[_0x78c0('0x11')](_0x59fbf2));if(_0x59fbf2[_0x78c0('0x12')]){if(_0x59fbf2[_0x78c0('0x12')][_0x78c0('0x13')]===0x1f4){logger[_0x78c0('0x12')](_0x78c0('0xe'),_0x102e78,_0x59fbf2['error']['message']);return _0x5e2fb6(_0x59fbf2[_0x78c0('0x12')][_0x78c0('0x14')]);}logger[_0x78c0('0x12')](_0x78c0('0xe'),_0x102e78,_0x59fbf2[_0x78c0('0x12')][_0x78c0('0x14')]);return _0x2f2fe3(_0x59fbf2[_0x78c0('0x12')][_0x78c0('0x14')]);}else{logger[_0x78c0('0xd')]('CloudProvider,\x20%s,\x20%s',_0x102e78,_0x78c0('0xf'));_0x2f2fe3(_0x59fbf2[_0x78c0('0x15')][_0x78c0('0x14')]);}})['catch'](function(_0x21e93d){logger[_0x78c0('0x12')]('CloudProvider,\x20%s,\x20%s',_0x102e78,_0x21e93d);_0x5e2fb6(_0x21e93d);});});} \ No newline at end of file +var _0xc747=['randomstring','ioredis','../../mysqldb','../../config/logger','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc747,0xe4));var _0x7c74=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xc747[_0x137d1d];return _0x485108;};'use strict';var _=require('lodash');var util=require(_0x7c74('0x0'));var moment=require(_0x7c74('0x1'));var BPromise=require(_0x7c74('0x2'));var rs=require(_0x7c74('0x3'));var fs=require('fs');var Redis=require(_0x7c74('0x4'));var db=require(_0x7c74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c74('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c74('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc33e,_0x2ae5fc,_0x32f639){return new BPromise(function(_0x20cd62,_0x2e36ed){return client[_0x7c74('0x8')](_0x4bc33e,_0x32f639)[_0x7c74('0x9')](function(_0x135e32){logger['info'](_0x7c74('0xa'),_0x2ae5fc,_0x7c74('0xb'));logger[_0x7c74('0xc')](_0x7c74('0xd'),_0x2ae5fc,_0x7c74('0xb'),JSON[_0x7c74('0xe')](_0x135e32));if(_0x135e32[_0x7c74('0xf')]){if(_0x135e32['error'][_0x7c74('0x10')]===0x1f4){logger[_0x7c74('0xf')](_0x7c74('0xa'),_0x2ae5fc,_0x135e32[_0x7c74('0xf')][_0x7c74('0x11')]);return _0x2e36ed(_0x135e32[_0x7c74('0xf')][_0x7c74('0x11')]);}logger[_0x7c74('0xf')](_0x7c74('0xa'),_0x2ae5fc,_0x135e32['error'][_0x7c74('0x11')]);return _0x20cd62(_0x135e32[_0x7c74('0xf')][_0x7c74('0x11')]);}else{logger[_0x7c74('0x12')](_0x7c74('0xa'),_0x2ae5fc,_0x7c74('0xb'));_0x20cd62(_0x135e32[_0x7c74('0x13')][_0x7c74('0x11')]);}})[_0x7c74('0x14')](function(_0x889071){logger[_0x7c74('0xf')](_0x7c74('0xa'),_0x2ae5fc,_0x889071);_0x2e36ed(_0x889071);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2829221..90777e9 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 _0xa6b6=['util','Router','../../config/environment','./cloudProvider.controller','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x710a08,_0x45af49){var _0x9a165e=function(_0x7e0c15){while(--_0x7e0c15){_0x710a08['push'](_0x710a08['shift']());}};_0x9a165e(++_0x45af49);}(_0xa6b6,0x7d));var _0x6a6b=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0xa6b6[_0xc8a02c];return _0x3d89da;};'use strict';var multer=require(_0x6a6b('0x0'));var util=require(_0x6a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a6b('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6a6b('0x3'));var controller=require(_0x6a6b('0x4'));router['get']('/',auth[_0x6a6b('0x5')](),controller[_0x6a6b('0x6')]);router['get'](_0x6a6b('0x7'),auth[_0x6a6b('0x5')](),controller[_0x6a6b('0x8')]);router['post']('/',auth[_0x6a6b('0x5')](),controller[_0x6a6b('0x9')]);router[_0x6a6b('0xa')](_0x6a6b('0x7'),auth[_0x6a6b('0x5')](),controller[_0x6a6b('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6a6b('0xc')]);module[_0x6a6b('0xd')]=router; \ No newline at end of file +var _0x46f3=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create','/:id','delete','destroy','multer'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x46f3,0x1df));var _0x346f=function(_0x400277,_0x4c7360){_0x400277=_0x400277-0x0;var _0xb083fc=_0x46f3[_0x400277];return _0xb083fc;};'use strict';var multer=require(_0x346f('0x0'));var util=require(_0x346f('0x1'));var path=require(_0x346f('0x2'));var timeout=require(_0x346f('0x3'));var express=require(_0x346f('0x4'));var router=express['Router']();var auth=require(_0x346f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x346f('0x6'));var controller=require('./cloudProvider.controller');router[_0x346f('0x7')]('/',auth[_0x346f('0x8')](),controller[_0x346f('0x9')]);router['get']('/:id',auth[_0x346f('0x8')](),controller['show']);router[_0x346f('0xa')]('/',auth[_0x346f('0x8')](),controller[_0x346f('0xb')]);router['put'](_0x346f('0xc'),auth[_0x346f('0x8')](),controller['update']);router[_0x346f('0xd')]('/:id',auth[_0x346f('0x8')](),controller[_0x346f('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 adb7386..e39e1b9 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 _0x27cf=['STRING','exports'];(function(_0xeb8615,_0x764e95){var _0x519cee=function(_0x136d4d){while(--_0x136d4d){_0xeb8615['push'](_0xeb8615['shift']());}};_0x519cee(++_0x764e95);}(_0x27cf,0x111));var _0xf27c=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x27cf[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require('sequelize');module[_0xf27c('0x0')]={'name':{'type':Sequelize[_0xf27c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf27c('0x1')]},'companyId':{'type':Sequelize[_0xf27c('0x1')]},'website':{'type':Sequelize[_0xf27c('0x1')]},'phone':{'type':Sequelize[_0xf27c('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf27c('0x1')]},'street':{'type':Sequelize[_0xf27c('0x1')]},'postalCode':{'type':Sequelize[_0xf27c('0x1')]},'city':{'type':Sequelize[_0xf27c('0x1')]},'country':{'type':Sequelize[_0xf27c('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xf27c('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xf27c('0x1')]},'sCountry':{'type':Sequelize[_0xf27c('0x1')]},'description':{'type':Sequelize[_0xf27c('0x1')]}}; \ No newline at end of file +var _0x9eda=['sequelize','STRING'];(function(_0x45d4a9,_0x2ab2b6){var _0xeeb0ca=function(_0x3b96cf){while(--_0x3b96cf){_0x45d4a9['push'](_0x45d4a9['shift']());}};_0xeeb0ca(++_0x2ab2b6);}(_0x9eda,0x156));var _0xa9ed=function(_0x51d7fd,_0x1f61a2){_0x51d7fd=_0x51d7fd-0x0;var _0x13143e=_0x9eda[_0x51d7fd];return _0x13143e;};'use strict';var Sequelize=require(_0xa9ed('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9ed('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa9ed('0x1')]},'companyId':{'type':Sequelize[_0xa9ed('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa9ed('0x1')]},'fax':{'type':Sequelize[_0xa9ed('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa9ed('0x1')]},'postalCode':{'type':Sequelize[_0xa9ed('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa9ed('0x1')]},'email':{'type':Sequelize[_0xa9ed('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa9ed('0x1')]},'sStreet':{'type':Sequelize[_0xa9ed('0x1')]},'sPostalCode':{'type':Sequelize[_0xa9ed('0x1')]},'sCity':{'type':Sequelize[_0xa9ed('0x1')]},'sCountry':{'type':Sequelize['STRING']},'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 064d71d..b4998b7 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 _0x4fcd=['role','UserProfileSection','userProfileId','body','params','CmContact','ids','omit','getContacts','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','options','catch','show','rawAttributes','includeAll','include','find','create','user','get'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x4fcd,0x103));var _0xd4fc=function(_0x37c901,_0x43bb2c){_0x37c901=_0x37c901-0x0;var _0x423420=_0x4fcd[_0x37c901];return _0x423420;};'use strict';var pdf=require(_0xd4fc('0x0'));var emlformat=require(_0xd4fc('0x1'));var rimraf=require(_0xd4fc('0x2'));var zipdir=require(_0xd4fc('0x3'));var jsonpatch=require(_0xd4fc('0x4'));var rp=require('request-promise');var moment=require(_0xd4fc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4fc('0x6'));var util=require(_0xd4fc('0x7'));var path=require(_0xd4fc('0x8'));var sox=require(_0xd4fc('0x9'));var csv=require(_0xd4fc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd4fc('0xb'));var squel=require(_0xd4fc('0xc'));var crypto=require(_0xd4fc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4fc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4fc('0xf'));var Papa=require(_0xd4fc('0x10'));var Redis=require(_0xd4fc('0x11'));var authService=require(_0xd4fc('0x12'));var qs=require(_0xd4fc('0x13'));var as=require(_0xd4fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4fc('0x15'))(_0xd4fc('0x16'));var utils=require('../../config/utils');var config=require(_0xd4fc('0x17'));var licenseUtil=require(_0xd4fc('0x18'));var db=require(_0xd4fc('0x19'))['db'];function respondWithStatusCode(_0x4c47c7,_0x429215){_0x429215=_0x429215||0xcc;return function(_0xbd7ee2){if(_0xbd7ee2){return _0x4c47c7['sendStatus'](_0x429215);}return _0x4c47c7[_0xd4fc('0x1a')](_0x429215)['end']();};}function respondWithResult(_0x4b48dc,_0x5a4f9b){_0x5a4f9b=_0x5a4f9b||0xc8;return function(_0x4fa155){if(_0x4fa155){return _0x4b48dc[_0xd4fc('0x1a')](_0x5a4f9b)[_0xd4fc('0x1b')](_0x4fa155);}};}function respondWithFilteredResult(_0x33b98b,_0xeceec3){return function(_0x36010d){if(_0x36010d){var _0x3515eb=_0x36010d[_0xd4fc('0x1c')],_0x5ae10b=_0xeceec3[_0xd4fc('0x1d')],_0x41bba1=_0xeceec3[_0xd4fc('0x1d')]+_0xeceec3[_0xd4fc('0x1e')],_0x370a97;if(_0x41bba1>=_0x3515eb){_0x41bba1=_0x3515eb;_0x370a97=0xc8;}else{_0x370a97=0xce;}_0x33b98b[_0xd4fc('0x1a')](_0x370a97);return _0x33b98b[_0xd4fc('0x1f')](_0xd4fc('0x20'),_0x5ae10b+'-'+_0x41bba1+'/'+_0x3515eb)[_0xd4fc('0x1b')](_0x36010d);}return null;};}function patchUpdates(_0x49904e){return function(_0x1ba90f){try{jsonpatch[_0xd4fc('0x21')](_0x1ba90f,_0x49904e,!![]);}catch(_0x575a4e){return BPromise['reject'](_0x575a4e);}return _0x1ba90f[_0xd4fc('0x22')]();};}function saveUpdates(_0x14676d,_0x3429a){return function(_0x5000aa){if(_0x5000aa){return _0x5000aa[_0xd4fc('0x23')](_0x14676d)[_0xd4fc('0x24')](function(_0x421692){return _0x421692;});}return null;};}function removeEntity(_0x1d3f1c,_0x2a5427){return function(_0x376248){if(_0x376248){return _0x376248[_0xd4fc('0x25')]()[_0xd4fc('0x24')](function(){var _0x104f67=_0x376248['get']({'plain':!![]});var _0x52a7f2=_0xd4fc('0x26');return db[_0xd4fc('0x27')][_0xd4fc('0x25')]({'where':{'type':_0x52a7f2,'resourceId':_0x104f67['id']}})[_0xd4fc('0x24')](function(){return _0x376248;});})['then'](function(){_0x1d3f1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa399,_0x4d0bbe){return function(_0x11eabb){if(!_0x11eabb){_0x2aa399[_0xd4fc('0x28')](0x194);}return _0x11eabb;};}function handleError(_0x3f7710,_0x5b8d42){_0x5b8d42=_0x5b8d42||0x1f4;return function(_0x5e6b18){logger[_0xd4fc('0x29')](_0x5e6b18[_0xd4fc('0x2a')]);if(_0x5e6b18[_0xd4fc('0x2b')]){delete _0x5e6b18[_0xd4fc('0x2b')];}_0x3f7710[_0xd4fc('0x1a')](_0x5b8d42)['send'](_0x5e6b18);};}exports[_0xd4fc('0x2c')]=function(_0x2baa99,_0x2ee01e){var _0x37e4d5={},_0x28c84a={},_0x12f847={'count':0x0,'rows':[]};return db[_0xd4fc('0x2d')][_0xd4fc('0x2e')]()[_0xd4fc('0x24')](function(_0x45c4a1){_0x28c84a[_0xd4fc('0x2f')]=_[_0xd4fc('0x30')](_0x45c4a1);_0x28c84a['query']=_[_0xd4fc('0x30')](_0x2baa99[_0xd4fc('0x31')]);_0x28c84a[_0xd4fc('0x32')]=_[_0xd4fc('0x33')](_0x28c84a[_0xd4fc('0x2f')],_0x28c84a[_0xd4fc('0x31')]);_0x37e4d5[_0xd4fc('0x34')]=_[_0xd4fc('0x33')](_0x28c84a[_0xd4fc('0x2f')],qs[_0xd4fc('0x35')](_0x2baa99[_0xd4fc('0x31')][_0xd4fc('0x35')]));_0x37e4d5[_0xd4fc('0x34')]=_0x37e4d5[_0xd4fc('0x34')][_0xd4fc('0x36')]?_0x37e4d5['attributes']:_0x28c84a[_0xd4fc('0x2f')];if(!_0x2baa99[_0xd4fc('0x31')]['hasOwnProperty'](_0xd4fc('0x37'))){_0x37e4d5['limit']=qs[_0xd4fc('0x1e')](_0x2baa99[_0xd4fc('0x31')][_0xd4fc('0x1e')]);_0x37e4d5['offset']=qs[_0xd4fc('0x1d')](_0x2baa99[_0xd4fc('0x31')][_0xd4fc('0x1d')]);}_0x37e4d5[_0xd4fc('0x38')]=qs['sort'](_0x2baa99[_0xd4fc('0x31')][_0xd4fc('0x39')]);_0x37e4d5['where']=qs[_0xd4fc('0x32')](_[_0xd4fc('0x3a')](_0x2baa99[_0xd4fc('0x31')],_0x28c84a[_0xd4fc('0x32')]),_0x45c4a1);if(_0x2baa99[_0xd4fc('0x31')][_0xd4fc('0x3b')]){_0x37e4d5[_0xd4fc('0x3c')]=_[_0xd4fc('0x3d')](_0x37e4d5[_0xd4fc('0x3c')],{'$or':_[_0xd4fc('0x3e')](_0x37e4d5[_0xd4fc('0x34')],function(_0xfeef82){var _0x4365b7={};_0x4365b7[_0xfeef82]={'$like':'%'+_0x2baa99[_0xd4fc('0x31')]['filter']+'%'};return _0x4365b7;})});}_0x37e4d5=_[_0xd4fc('0x3d')]({},_0x37e4d5,_0x2baa99[_0xd4fc('0x3f')]);var _0x39b462={'where':_0x37e4d5[_0xd4fc('0x3c')]};return db[_0xd4fc('0x2d')][_0xd4fc('0x1c')](_0x39b462)[_0xd4fc('0x24')](function(_0x2779e1){_0x12f847[_0xd4fc('0x1c')]=_0x2779e1;if(_0x2baa99[_0xd4fc('0x31')]['includeAll']){_0x37e4d5['include']=[{'all':!![]}];}return db[_0xd4fc('0x2d')]['findAll'](_0x37e4d5);})[_0xd4fc('0x24')](function(_0x4b6c69){_0x12f847['rows']=_0x4b6c69;return _0x12f847;})['then'](respondWithFilteredResult(_0x2ee01e,_0x37e4d5))[_0xd4fc('0x40')](handleError(_0x2ee01e,null));})['catch'](handleError(_0x2ee01e,null));};exports[_0xd4fc('0x41')]=function(_0x2bac43,_0x33c772){var _0x173f6c={'raw':![],'where':{'id':_0x2bac43['params']['id']}},_0xc62fc3={};_0xc62fc3[_0xd4fc('0x2f')]=_[_0xd4fc('0x30')](db[_0xd4fc('0x2d')][_0xd4fc('0x42')]);_0xc62fc3[_0xd4fc('0x31')]=_['keys'](_0x2bac43[_0xd4fc('0x31')]);_0xc62fc3[_0xd4fc('0x32')]=_[_0xd4fc('0x33')](_0xc62fc3[_0xd4fc('0x2f')],_0xc62fc3[_0xd4fc('0x31')]);_0x173f6c[_0xd4fc('0x34')]=_[_0xd4fc('0x33')](_0xc62fc3[_0xd4fc('0x2f')],qs[_0xd4fc('0x35')](_0x2bac43[_0xd4fc('0x31')][_0xd4fc('0x35')]));_0x173f6c['attributes']=_0x173f6c['attributes'][_0xd4fc('0x36')]?_0x173f6c[_0xd4fc('0x34')]:_0xc62fc3[_0xd4fc('0x2f')];if(_0x2bac43[_0xd4fc('0x31')][_0xd4fc('0x43')]){_0x173f6c[_0xd4fc('0x44')]=[{'all':!![]}];}_0x173f6c=_['merge']({},_0x173f6c,_0x2bac43['options']);return db[_0xd4fc('0x2d')][_0xd4fc('0x45')](_0x173f6c)[_0xd4fc('0x24')](handleEntityNotFound(_0x33c772,null))[_0xd4fc('0x24')](respondWithResult(_0x33c772,null))[_0xd4fc('0x40')](handleError(_0x33c772,null));};exports[_0xd4fc('0x46')]=function(_0x429b9a,_0x2b2d47){return db[_0xd4fc('0x2d')][_0xd4fc('0x46')](_0x429b9a['body'],{})['then'](function(_0x3e2276){var _0x4dde09=_0x429b9a[_0xd4fc('0x47')][_0xd4fc('0x48')]({'plain':!![]});if(!_0x4dde09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dde09[_0xd4fc('0x49')]==='user'){var _0x47eaff=_0x3e2276[_0xd4fc('0x48')]({'plain':!![]});var _0x255ff1=_0xd4fc('0x26');return db[_0xd4fc('0x4a')][_0xd4fc('0x45')]({'where':{'name':_0x255ff1,'userProfileId':_0x4dde09[_0xd4fc('0x4b')]},'raw':!![]})[_0xd4fc('0x24')](function(_0x5186c9){if(_0x5186c9&&_0x5186c9['autoAssociation']===0x0){return db[_0xd4fc('0x27')][_0xd4fc('0x46')]({'name':_0x47eaff[_0xd4fc('0x2b')],'resourceId':_0x47eaff['id'],'type':_0x5186c9[_0xd4fc('0x2b')],'sectionId':_0x5186c9['id']},{})['then'](function(){return _0x3e2276;});}else{return _0x3e2276;}})[_0xd4fc('0x40')](function(_0x39acb5){logger[_0xd4fc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39acb5);throw _0x39acb5;});}return _0x3e2276;})[_0xd4fc('0x24')](respondWithResult(_0x2b2d47,0xc9))[_0xd4fc('0x40')](handleError(_0x2b2d47,null));};exports['update']=function(_0x38034a,_0x592173){if(_0x38034a[_0xd4fc('0x4c')]['id']){delete _0x38034a[_0xd4fc('0x4c')]['id'];}return db[_0xd4fc('0x2d')]['find']({'where':{'id':_0x38034a[_0xd4fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x592173,null))[_0xd4fc('0x24')](saveUpdates(_0x38034a['body'],null))[_0xd4fc('0x24')](respondWithResult(_0x592173,null))['catch'](handleError(_0x592173,null));};exports[_0xd4fc('0x25')]=function(_0x564c96,_0x50f8c4){return db['CmCompany'][_0xd4fc('0x45')]({'where':{'id':_0x564c96[_0xd4fc('0x4d')]['id']}})[_0xd4fc('0x24')](handleEntityNotFound(_0x50f8c4,null))[_0xd4fc('0x24')](removeEntity(_0x50f8c4,null))['catch'](handleError(_0x50f8c4,null));};exports[_0xd4fc('0x2e')]=function(_0x3ef144,_0x34e950){return db['CmCompany'][_0xd4fc('0x2e')]()[_0xd4fc('0x24')](respondWithResult(_0x34e950,null))['catch'](handleError(_0x34e950,null));};exports['addContacts']=function(_0x32fbbd,_0x5f2dd3,_0x260996){return db[_0xd4fc('0x4e')][_0xd4fc('0x45')]({'where':{'id':_0x32fbbd['params']['id']}})[_0xd4fc('0x24')](handleEntityNotFound(_0x5f2dd3,null))[_0xd4fc('0x24')](function(_0x5e1e2c){if(_0x5e1e2c){return _0x5e1e2c['addContacts'](_0x32fbbd[_0xd4fc('0x4c')][_0xd4fc('0x4f')],_[_0xd4fc('0x50')](_0x32fbbd['body'],['ids','id'])||{});}})[_0xd4fc('0x24')](respondWithResult(_0x5f2dd3,null))['catch'](handleError(_0x5f2dd3,null));};exports[_0xd4fc('0x51')]=function(_0x2ec2e7,_0x175280,_0x4d3945){var _0x1c23bf={};var _0x41b815={};var _0x179811;var _0x4a01ee;return db[_0xd4fc('0x2d')][_0xd4fc('0x52')]({'where':{'id':_0x2ec2e7['params']['id']}})[_0xd4fc('0x24')](handleEntityNotFound(_0x175280,null))[_0xd4fc('0x24')](function(_0x376f07){if(_0x376f07){_0x179811=_0x376f07;_0x41b815[_0xd4fc('0x2f')]=_[_0xd4fc('0x30')](db[_0xd4fc('0x4e')][_0xd4fc('0x42')]);_0x41b815[_0xd4fc('0x31')]=_['keys'](_0x2ec2e7[_0xd4fc('0x31')]);_0x41b815[_0xd4fc('0x32')]=_[_0xd4fc('0x33')](_0x41b815['model'],_0x41b815[_0xd4fc('0x31')]);_0x1c23bf[_0xd4fc('0x34')]=_[_0xd4fc('0x33')](_0x41b815[_0xd4fc('0x2f')],qs[_0xd4fc('0x35')](_0x2ec2e7['query'][_0xd4fc('0x35')]));_0x1c23bf[_0xd4fc('0x34')]=_0x1c23bf[_0xd4fc('0x34')]['length']?_0x1c23bf['attributes']:_0x41b815[_0xd4fc('0x2f')];_0x1c23bf[_0xd4fc('0x38')]=qs[_0xd4fc('0x39')](_0x2ec2e7[_0xd4fc('0x31')][_0xd4fc('0x39')]);_0x1c23bf[_0xd4fc('0x3c')]=qs[_0xd4fc('0x32')](_['pick'](_0x2ec2e7[_0xd4fc('0x31')],_0x41b815[_0xd4fc('0x32')]));if(_0x2ec2e7[_0xd4fc('0x31')][_0xd4fc('0x3b')]){_0x1c23bf[_0xd4fc('0x3c')]=_['merge'](_0x1c23bf[_0xd4fc('0x3c')],{'$or':_[_0xd4fc('0x3e')](_0x1c23bf[_0xd4fc('0x34')],function(_0x2f9e4b){var _0x49bf67={};_0x49bf67[_0x2f9e4b]={'$like':'%'+_0x2ec2e7[_0xd4fc('0x31')][_0xd4fc('0x3b')]+'%'};return _0x49bf67;})});}_0x1c23bf=_[_0xd4fc('0x3d')]({},_0x1c23bf,_0x2ec2e7[_0xd4fc('0x3f')]);return _0x179811[_0xd4fc('0x51')](_0x1c23bf);}})[_0xd4fc('0x24')](function(_0xd30259){if(_0xd30259){_0x4a01ee=_0xd30259[_0xd4fc('0x36')];if(!_0x2ec2e7[_0xd4fc('0x31')]['hasOwnProperty']('nolimit')){_0x1c23bf[_0xd4fc('0x1e')]=qs[_0xd4fc('0x1e')](_0x2ec2e7[_0xd4fc('0x31')]['limit']);_0x1c23bf['offset']=qs[_0xd4fc('0x1d')](_0x2ec2e7['query'][_0xd4fc('0x1d')]);}return _0x179811['getContacts'](_0x1c23bf);}})[_0xd4fc('0x24')](function(_0x4d8e8a){if(_0x4d8e8a){return _0x4d8e8a?{'count':_0x4a01ee,'rows':_0x4d8e8a}:null;}})[_0xd4fc('0x24')](respondWithResult(_0x175280,null))['catch'](handleError(_0x175280,null));}; \ No newline at end of file +var _0x9d41=['UserProfileResource','destroy','stack','name','send','CmCompany','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','options','include','findAll','catch','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','params','describe','addContacts','CmContact','ids','omit','findOne','length','pick','nolimit','getContacts','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x1ef497,_0xa1f692){var _0x29a62c=function(_0x6b21c){while(--_0x6b21c){_0x1ef497['push'](_0x1ef497['shift']());}};_0x29a62c(++_0xa1f692);}(_0x9d41,0x130));var _0x19d4=function(_0x39a2a5,_0x362bf4){_0x39a2a5=_0x39a2a5-0x0;var _0x45786f=_0x9d41[_0x39a2a5];return _0x45786f;};'use strict';var pdf=require(_0x19d4('0x0'));var emlformat=require(_0x19d4('0x1'));var rimraf=require(_0x19d4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x19d4('0x3'));var BPromise=require(_0x19d4('0x4'));var Mustache=require(_0x19d4('0x5'));var util=require('util');var path=require(_0x19d4('0x6'));var sox=require(_0x19d4('0x7'));var csv=require(_0x19d4('0x8'));var ejs=require(_0x19d4('0x9'));var fs=require('fs');var _=require(_0x19d4('0xa'));var squel=require(_0x19d4('0xb'));var crypto=require(_0x19d4('0xc'));var jsforce=require(_0x19d4('0xd'));var deskjs=require(_0x19d4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x19d4('0xf'));var Papa=require(_0x19d4('0x10'));var Redis=require(_0x19d4('0x11'));var authService=require(_0x19d4('0x12'));var qs=require(_0x19d4('0x13'));var as=require(_0x19d4('0x14'));var hardwareService=require(_0x19d4('0x15'));var logger=require(_0x19d4('0x16'))(_0x19d4('0x17'));var utils=require(_0x19d4('0x18'));var config=require(_0x19d4('0x19'));var licenseUtil=require(_0x19d4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5203df,_0x160a87){_0x160a87=_0x160a87||0xcc;return function(_0x4805f7){if(_0x4805f7){return _0x5203df[_0x19d4('0x1b')](_0x160a87);}return _0x5203df[_0x19d4('0x1c')](_0x160a87)[_0x19d4('0x1d')]();};}function respondWithResult(_0x15770e,_0x14f04b){_0x14f04b=_0x14f04b||0xc8;return function(_0x2a2f88){if(_0x2a2f88){return _0x15770e[_0x19d4('0x1c')](_0x14f04b)[_0x19d4('0x1e')](_0x2a2f88);}};}function respondWithFilteredResult(_0x24bdf2,_0x44d884){return function(_0x37f509){if(_0x37f509){var _0x49b128=_0x37f509[_0x19d4('0x1f')],_0x13d103=_0x44d884[_0x19d4('0x20')],_0x33ed7f=_0x44d884[_0x19d4('0x20')]+_0x44d884[_0x19d4('0x21')],_0x2dc59e;if(_0x33ed7f>=_0x49b128){_0x33ed7f=_0x49b128;_0x2dc59e=0xc8;}else{_0x2dc59e=0xce;}_0x24bdf2[_0x19d4('0x1c')](_0x2dc59e);return _0x24bdf2[_0x19d4('0x22')](_0x19d4('0x23'),_0x13d103+'-'+_0x33ed7f+'/'+_0x49b128)[_0x19d4('0x1e')](_0x37f509);}return null;};}function patchUpdates(_0x58607f){return function(_0x54b96c){try{jsonpatch[_0x19d4('0x24')](_0x54b96c,_0x58607f,!![]);}catch(_0x3e4a8b){return BPromise['reject'](_0x3e4a8b);}return _0x54b96c[_0x19d4('0x25')]();};}function saveUpdates(_0x298799,_0xb64d81){return function(_0x22d5e8){if(_0x22d5e8){return _0x22d5e8[_0x19d4('0x26')](_0x298799)[_0x19d4('0x27')](function(_0x5b3cdd){return _0x5b3cdd;});}return null;};}function removeEntity(_0x410988,_0x5c23f0){return function(_0x165d47){if(_0x165d47){return _0x165d47['destroy']()['then'](function(){var _0x4b9409=_0x165d47['get']({'plain':!![]});var _0xef826b='Companies';return db[_0x19d4('0x28')][_0x19d4('0x29')]({'where':{'type':_0xef826b,'resourceId':_0x4b9409['id']}})['then'](function(){return _0x165d47;});})['then'](function(){_0x410988[_0x19d4('0x1c')](0xcc)[_0x19d4('0x1d')]();});}};}function handleEntityNotFound(_0x2d9628,_0x51163c){return function(_0x41c1b8){if(!_0x41c1b8){_0x2d9628['sendStatus'](0x194);}return _0x41c1b8;};}function handleError(_0xdcc53f,_0x34b642){_0x34b642=_0x34b642||0x1f4;return function(_0x4f3988){logger['error'](_0x4f3988[_0x19d4('0x2a')]);if(_0x4f3988[_0x19d4('0x2b')]){delete _0x4f3988[_0x19d4('0x2b')];}_0xdcc53f[_0x19d4('0x1c')](_0x34b642)[_0x19d4('0x2c')](_0x4f3988);};}exports['index']=function(_0x417f11,_0x174dfe){var _0x4e511a={},_0x32d1f9={},_0x5b2270={'count':0x0,'rows':[]};return db[_0x19d4('0x2d')]['describe']()[_0x19d4('0x27')](function(_0x1a631c){_0x32d1f9[_0x19d4('0x2e')]=_['keys'](_0x1a631c);_0x32d1f9[_0x19d4('0x2f')]=_[_0x19d4('0x30')](_0x417f11['query']);_0x32d1f9[_0x19d4('0x31')]=_[_0x19d4('0x32')](_0x32d1f9['model'],_0x32d1f9[_0x19d4('0x2f')]);_0x4e511a[_0x19d4('0x33')]=_['intersection'](_0x32d1f9['model'],qs[_0x19d4('0x34')](_0x417f11[_0x19d4('0x2f')][_0x19d4('0x34')]));_0x4e511a['attributes']=_0x4e511a[_0x19d4('0x33')]['length']?_0x4e511a['attributes']:_0x32d1f9['model'];if(!_0x417f11[_0x19d4('0x2f')][_0x19d4('0x35')]('nolimit')){_0x4e511a['limit']=qs['limit'](_0x417f11[_0x19d4('0x2f')][_0x19d4('0x21')]);_0x4e511a[_0x19d4('0x20')]=qs[_0x19d4('0x20')](_0x417f11[_0x19d4('0x2f')][_0x19d4('0x20')]);}_0x4e511a[_0x19d4('0x36')]=qs[_0x19d4('0x37')](_0x417f11[_0x19d4('0x2f')][_0x19d4('0x37')]);_0x4e511a[_0x19d4('0x38')]=qs[_0x19d4('0x31')](_['pick'](_0x417f11[_0x19d4('0x2f')],_0x32d1f9[_0x19d4('0x31')]),_0x1a631c);if(_0x417f11[_0x19d4('0x2f')][_0x19d4('0x39')]){_0x4e511a[_0x19d4('0x38')]=_[_0x19d4('0x3a')](_0x4e511a[_0x19d4('0x38')],{'$or':_[_0x19d4('0x3b')](_0x4e511a['attributes'],function(_0x534041){var _0x4905ed={};_0x4905ed[_0x534041]={'$like':'%'+_0x417f11[_0x19d4('0x2f')]['filter']+'%'};return _0x4905ed;})});}_0x4e511a=_[_0x19d4('0x3a')]({},_0x4e511a,_0x417f11[_0x19d4('0x3c')]);var _0x41c7ca={'where':_0x4e511a['where']};return db['CmCompany'][_0x19d4('0x1f')](_0x41c7ca)['then'](function(_0x3175ac){_0x5b2270[_0x19d4('0x1f')]=_0x3175ac;if(_0x417f11[_0x19d4('0x2f')]['includeAll']){_0x4e511a[_0x19d4('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0x19d4('0x3e')](_0x4e511a);})[_0x19d4('0x27')](function(_0x1f0335){_0x5b2270['rows']=_0x1f0335;return _0x5b2270;})[_0x19d4('0x27')](respondWithFilteredResult(_0x174dfe,_0x4e511a))[_0x19d4('0x3f')](handleError(_0x174dfe,null));})[_0x19d4('0x3f')](handleError(_0x174dfe,null));};exports['show']=function(_0x29f3f5,_0x2a8d98){var _0x1dd414={'raw':![],'where':{'id':_0x29f3f5['params']['id']}},_0x43eaf4={};_0x43eaf4[_0x19d4('0x2e')]=_['keys'](db[_0x19d4('0x2d')]['rawAttributes']);_0x43eaf4['query']=_['keys'](_0x29f3f5[_0x19d4('0x2f')]);_0x43eaf4[_0x19d4('0x31')]=_[_0x19d4('0x32')](_0x43eaf4[_0x19d4('0x2e')],_0x43eaf4[_0x19d4('0x2f')]);_0x1dd414['attributes']=_[_0x19d4('0x32')](_0x43eaf4[_0x19d4('0x2e')],qs['fields'](_0x29f3f5['query'][_0x19d4('0x34')]));_0x1dd414[_0x19d4('0x33')]=_0x1dd414[_0x19d4('0x33')]['length']?_0x1dd414[_0x19d4('0x33')]:_0x43eaf4['model'];if(_0x29f3f5[_0x19d4('0x2f')][_0x19d4('0x40')]){_0x1dd414[_0x19d4('0x3d')]=[{'all':!![]}];}_0x1dd414=_['merge']({},_0x1dd414,_0x29f3f5[_0x19d4('0x3c')]);return db[_0x19d4('0x2d')][_0x19d4('0x41')](_0x1dd414)[_0x19d4('0x27')](handleEntityNotFound(_0x2a8d98,null))[_0x19d4('0x27')](respondWithResult(_0x2a8d98,null))[_0x19d4('0x3f')](handleError(_0x2a8d98,null));};exports[_0x19d4('0x42')]=function(_0xf6de81,_0x481520){return db['CmCompany'][_0x19d4('0x42')](_0xf6de81[_0x19d4('0x43')],{})[_0x19d4('0x27')](function(_0x49bc41){var _0x3bb4e8=_0xf6de81['user'][_0x19d4('0x44')]({'plain':!![]});if(!_0x3bb4e8)throw new Error(_0x19d4('0x45'));if(_0x3bb4e8['role']===_0x19d4('0x46')){var _0x275140=_0x49bc41[_0x19d4('0x44')]({'plain':!![]});var _0x191eca='Companies';return db[_0x19d4('0x47')]['find']({'where':{'name':_0x191eca,'userProfileId':_0x3bb4e8[_0x19d4('0x48')]},'raw':!![]})[_0x19d4('0x27')](function(_0x27ca5a){if(_0x27ca5a&&_0x27ca5a[_0x19d4('0x49')]===0x0){return db[_0x19d4('0x28')][_0x19d4('0x42')]({'name':_0x275140[_0x19d4('0x2b')],'resourceId':_0x275140['id'],'type':_0x27ca5a[_0x19d4('0x2b')],'sectionId':_0x27ca5a['id']},{})[_0x19d4('0x27')](function(){return _0x49bc41;});}else{return _0x49bc41;}})[_0x19d4('0x3f')](function(_0x344abb){logger[_0x19d4('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x344abb);throw _0x344abb;});}return _0x49bc41;})[_0x19d4('0x27')](respondWithResult(_0x481520,0xc9))[_0x19d4('0x3f')](handleError(_0x481520,null));};exports[_0x19d4('0x26')]=function(_0x11847b,_0x176315){if(_0x11847b[_0x19d4('0x43')]['id']){delete _0x11847b[_0x19d4('0x43')]['id'];}return db[_0x19d4('0x2d')][_0x19d4('0x41')]({'where':{'id':_0x11847b[_0x19d4('0x4b')]['id']}})[_0x19d4('0x27')](handleEntityNotFound(_0x176315,null))[_0x19d4('0x27')](saveUpdates(_0x11847b['body'],null))[_0x19d4('0x27')](respondWithResult(_0x176315,null))[_0x19d4('0x3f')](handleError(_0x176315,null));};exports[_0x19d4('0x29')]=function(_0x3f4ea7,_0x563039){return db[_0x19d4('0x2d')]['find']({'where':{'id':_0x3f4ea7['params']['id']}})['then'](handleEntityNotFound(_0x563039,null))[_0x19d4('0x27')](removeEntity(_0x563039,null))[_0x19d4('0x3f')](handleError(_0x563039,null));};exports[_0x19d4('0x4c')]=function(_0x1ea8be,_0x20070d){return db['CmCompany'][_0x19d4('0x4c')]()[_0x19d4('0x27')](respondWithResult(_0x20070d,null))[_0x19d4('0x3f')](handleError(_0x20070d,null));};exports[_0x19d4('0x4d')]=function(_0x1a0194,_0x731862,_0x3ff12a){return db[_0x19d4('0x4e')][_0x19d4('0x41')]({'where':{'id':_0x1a0194[_0x19d4('0x4b')]['id']}})[_0x19d4('0x27')](handleEntityNotFound(_0x731862,null))[_0x19d4('0x27')](function(_0x15d2e4){if(_0x15d2e4){return _0x15d2e4['addContacts'](_0x1a0194[_0x19d4('0x43')][_0x19d4('0x4f')],_[_0x19d4('0x50')](_0x1a0194[_0x19d4('0x43')],['ids','id'])||{});}})[_0x19d4('0x27')](respondWithResult(_0x731862,null))[_0x19d4('0x3f')](handleError(_0x731862,null));};exports['getContacts']=function(_0x289910,_0xa1b3d4,_0x284881){var _0x29fc6c={};var _0x4b7f61={};var _0x57d2bb;var _0x1bba3d;return db[_0x19d4('0x2d')][_0x19d4('0x51')]({'where':{'id':_0x289910[_0x19d4('0x4b')]['id']}})[_0x19d4('0x27')](handleEntityNotFound(_0xa1b3d4,null))['then'](function(_0xa8bab5){if(_0xa8bab5){_0x57d2bb=_0xa8bab5;_0x4b7f61[_0x19d4('0x2e')]=_[_0x19d4('0x30')](db[_0x19d4('0x4e')]['rawAttributes']);_0x4b7f61[_0x19d4('0x2f')]=_['keys'](_0x289910[_0x19d4('0x2f')]);_0x4b7f61[_0x19d4('0x31')]=_[_0x19d4('0x32')](_0x4b7f61[_0x19d4('0x2e')],_0x4b7f61[_0x19d4('0x2f')]);_0x29fc6c[_0x19d4('0x33')]=_[_0x19d4('0x32')](_0x4b7f61['model'],qs[_0x19d4('0x34')](_0x289910[_0x19d4('0x2f')][_0x19d4('0x34')]));_0x29fc6c[_0x19d4('0x33')]=_0x29fc6c[_0x19d4('0x33')][_0x19d4('0x52')]?_0x29fc6c[_0x19d4('0x33')]:_0x4b7f61[_0x19d4('0x2e')];_0x29fc6c['order']=qs[_0x19d4('0x37')](_0x289910[_0x19d4('0x2f')][_0x19d4('0x37')]);_0x29fc6c[_0x19d4('0x38')]=qs[_0x19d4('0x31')](_[_0x19d4('0x53')](_0x289910[_0x19d4('0x2f')],_0x4b7f61['filters']));if(_0x289910[_0x19d4('0x2f')][_0x19d4('0x39')]){_0x29fc6c[_0x19d4('0x38')]=_[_0x19d4('0x3a')](_0x29fc6c['where'],{'$or':_[_0x19d4('0x3b')](_0x29fc6c[_0x19d4('0x33')],function(_0x334652){var _0xd77bc={};_0xd77bc[_0x334652]={'$like':'%'+_0x289910[_0x19d4('0x2f')][_0x19d4('0x39')]+'%'};return _0xd77bc;})});}_0x29fc6c=_['merge']({},_0x29fc6c,_0x289910['options']);return _0x57d2bb['getContacts'](_0x29fc6c);}})[_0x19d4('0x27')](function(_0x375818){if(_0x375818){_0x1bba3d=_0x375818[_0x19d4('0x52')];if(!_0x289910['query'][_0x19d4('0x35')](_0x19d4('0x54'))){_0x29fc6c['limit']=qs[_0x19d4('0x21')](_0x289910[_0x19d4('0x2f')][_0x19d4('0x21')]);_0x29fc6c['offset']=qs['offset'](_0x289910[_0x19d4('0x2f')][_0x19d4('0x20')]);}return _0x57d2bb[_0x19d4('0x55')](_0x29fc6c);}})['then'](function(_0x31b4e3){if(_0x31b4e3){return _0x31b4e3?{'count':_0x1bba3d,'rows':_0x31b4e3}:null;}})[_0x19d4('0x27')](respondWithResult(_0xa1b3d4,null))[_0x19d4('0x3f')](handleError(_0xa1b3d4,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 99c7531..e198bed 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 _0x826a=['request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','api','bluebird'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x826a,0x1aa));var _0xa826=function(_0x42a7bf,_0x1061cc){_0x42a7bf=_0x42a7bf-0x0;var _0x18c956=_0x826a[_0x42a7bf];return _0x18c956;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var logger=require('../../config/logger')(_0xa826('0x1'));var moment=require('moment');var BPromise=require(_0xa826('0x2'));var rp=require(_0xa826('0x3'));var fs=require('fs');var path=require(_0xa826('0x4'));var rimraf=require(_0xa826('0x5'));var config=require('../../config/environment');var attributes=require(_0xa826('0x6'));module[_0xa826('0x7')]=function(_0x3929d4,_0x34327b){return _0x3929d4[_0xa826('0x8')](_0xa826('0x9'),attributes,{'tableName':_0xa826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x11fc2c,_0x8dfa82){var _0x3df667=function(_0x1b46a3){while(--_0x1b46a3){_0x11fc2c['push'](_0x11fc2c['shift']());}};_0x3df667(++_0x8dfa82);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4aa85d,_0x5dc7e4){_0x4aa85d=_0x4aa85d-0x0;var _0x3e1977=_0xdbf5[_0x4aa85d];return _0x3e1977;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('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 2eb4a27..e341dcd 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 _0x4ae6=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error'];(function(_0x1fddb4,_0x110b6a){var _0x2a5c50=function(_0x2127e6){while(--_0x2127e6){_0x1fddb4['push'](_0x1fddb4['shift']());}};_0x2a5c50(++_0x110b6a);}(_0x4ae6,0x15d));var _0x64ae=function(_0x524832,_0x2813d7){_0x524832=_0x524832-0x0;var _0x4ae711=_0x4ae6[_0x524832];return _0x4ae711;};'use strict';var _=require(_0x64ae('0x0'));var util=require(_0x64ae('0x1'));var moment=require('moment');var BPromise=require(_0x64ae('0x2'));var rs=require(_0x64ae('0x3'));var fs=require('fs');var Redis=require(_0x64ae('0x4'));var db=require(_0x64ae('0x5'))['db'];var utils=require(_0x64ae('0x6'));var logger=require(_0x64ae('0x7'))(_0x64ae('0x8'));var config=require(_0x64ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x64ae('0xa')][_0x64ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf098df,_0x10ab96,_0x379b2f){return new BPromise(function(_0x29ad58,_0x58e2e2){return client['request'](_0xf098df,_0x379b2f)[_0x64ae('0xc')](function(_0x4a3708){logger[_0x64ae('0xd')](_0x64ae('0xe'),_0x10ab96,_0x64ae('0xf'));logger[_0x64ae('0x10')](_0x64ae('0x11'),_0x10ab96,'request\x20sent',JSON['stringify'](_0x4a3708));if(_0x4a3708[_0x64ae('0x12')]){if(_0x4a3708['error'][_0x64ae('0x13')]===0x1f4){logger['error'](_0x64ae('0xe'),_0x10ab96,_0x4a3708[_0x64ae('0x12')][_0x64ae('0x14')]);return _0x58e2e2(_0x4a3708[_0x64ae('0x12')][_0x64ae('0x14')]);}logger[_0x64ae('0x12')](_0x64ae('0xe'),_0x10ab96,_0x4a3708['error'][_0x64ae('0x14')]);return _0x29ad58(_0x4a3708[_0x64ae('0x12')][_0x64ae('0x14')]);}else{logger['info'](_0x64ae('0xe'),_0x10ab96,'request\x20sent');_0x29ad58(_0x4a3708[_0x64ae('0x15')][_0x64ae('0x14')]);}})[_0x64ae('0x16')](function(_0x9ed440){logger[_0x64ae('0x12')](_0x64ae('0xe'),_0x10ab96,_0x9ed440);_0x58e2e2(_0x9ed440);});});} \ No newline at end of file +var _0x5390=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x45fe9c,_0x390055){var _0xd3b252=function(_0x450d53){while(--_0x450d53){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0xd3b252(++_0x390055);}(_0x5390,0x12a));var _0x0539=function(_0x33486d,_0x376127){_0x33486d=_0x33486d-0x0;var _0x340d5d=_0x5390[_0x33486d];return _0x340d5d;};'use strict';var _=require(_0x0539('0x0'));var util=require(_0x0539('0x1'));var moment=require('moment');var BPromise=require(_0x0539('0x2'));var rs=require(_0x0539('0x3'));var fs=require('fs');var Redis=require(_0x0539('0x4'));var db=require(_0x0539('0x5'))['db'];var utils=require(_0x0539('0x6'));var logger=require(_0x0539('0x7'))(_0x0539('0x8'));var config=require(_0x0539('0x9'));var jayson=require(_0x0539('0xa'));var client=jayson[_0x0539('0xb')][_0x0539('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x80ff9a,_0x13edae,_0x37fc2d){return new BPromise(function(_0x255ec1,_0x3bc46e){return client['request'](_0x80ff9a,_0x37fc2d)['then'](function(_0xbd992b){logger[_0x0539('0xd')](_0x0539('0xe'),_0x13edae,_0x0539('0xf'));logger[_0x0539('0x10')](_0x0539('0x11'),_0x13edae,_0x0539('0xf'),JSON['stringify'](_0xbd992b));if(_0xbd992b[_0x0539('0x12')]){if(_0xbd992b[_0x0539('0x12')][_0x0539('0x13')]===0x1f4){logger['error'](_0x0539('0xe'),_0x13edae,_0xbd992b[_0x0539('0x12')][_0x0539('0x14')]);return _0x3bc46e(_0xbd992b[_0x0539('0x12')][_0x0539('0x14')]);}logger[_0x0539('0x12')](_0x0539('0xe'),_0x13edae,_0xbd992b['error'][_0x0539('0x14')]);return _0x255ec1(_0xbd992b[_0x0539('0x12')][_0x0539('0x14')]);}else{logger[_0x0539('0xd')](_0x0539('0xe'),_0x13edae,'request\x20sent');_0x255ec1(_0xbd992b[_0x0539('0x15')][_0x0539('0x14')]);}})[_0x0539('0x16')](function(_0x468f28){logger[_0x0539('0x12')](_0x0539('0xe'),_0x13edae,_0x468f28);_0x3bc46e(_0x468f28);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 10e783e..5d2b4bb 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 _0x57ca=['index','/describe','describe','/:id/contacts','getContacts','create','addContacts','put','/:id','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b9aef,_0x222c6c){var _0x7d21d8=function(_0x4f3acc){while(--_0x4f3acc){_0x4b9aef['push'](_0x4b9aef['shift']());}};_0x7d21d8(++_0x222c6c);}(_0x57ca,0x108));var _0xa57c=function(_0x53ff3b,_0x58f396){_0x53ff3b=_0x53ff3b-0x0;var _0x4d7ac2=_0x57ca[_0x53ff3b];return _0x4d7ac2;};'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('./cmCompany.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x7')]('/:id',auth[_0xa57c('0x8')](),controller['show']);router[_0xa57c('0x7')](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['post']('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router['post'](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xf')]);router[_0xa57c('0x10')](_0xa57c('0x11'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x12')]);router['delete'](_0xa57c('0x11'),auth['isAuthenticated'](),controller[_0xa57c('0x13')]);module[_0xa57c('0x14')]=router; \ No newline at end of file +var _0x2272=['show','/:id/contacts','getContacts','post','create','addContacts','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x1786e0,_0x19dc8c){var _0x4a6229=function(_0x151bdd){while(--_0x151bdd){_0x1786e0['push'](_0x1786e0['shift']());}};_0x4a6229(++_0x19dc8c);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var auth=require(_0x2227('0x5'));var interaction=require(_0x2227('0x6'));var config=require(_0x2227('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x2227('0x8')](),controller[_0x2227('0x9')]);router[_0x2227('0xa')](_0x2227('0xb'),auth[_0x2227('0x8')](),controller[_0x2227('0xc')]);router[_0x2227('0xa')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0xe')]);router['get'](_0x2227('0xf'),auth['isAuthenticated'](),controller[_0x2227('0x10')]);router[_0x2227('0x11')]('/',auth[_0x2227('0x8')](),controller[_0x2227('0x12')]);router[_0x2227('0x11')]('/:id/contacts',auth[_0x2227('0x8')](),controller[_0x2227('0x13')]);router[_0x2227('0x14')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2227('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bf257bd..8134738 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 _0xf410=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x3bfd2c,_0x31a6ae){var _0x434ea6=function(_0x530b21){while(--_0x530b21){_0x3bfd2c['push'](_0x3bfd2c['shift']());}};_0x434ea6(++_0x31a6ae);}(_0xf410,0xdd));var _0x0f41=function(_0x4ab3e5,_0x2c1dd4){_0x4ab3e5=_0x4ab3e5-0x0;var _0x27bee2=_0xf410[_0x4ab3e5];return _0x27bee2;};'use strict';var _=require(_0x0f41('0x0'));var Sequelize=require(_0x0f41('0x1'));module[_0x0f41('0x2')]={'firstName':{'type':Sequelize[_0x0f41('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0f41('0x3')]},'street':{'type':Sequelize[_0x0f41('0x3')]},'postalCode':{'type':Sequelize[_0x0f41('0x3')]},'city':{'type':Sequelize[_0x0f41('0x3')]},'country':{'type':Sequelize[_0x0f41('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x0f41('0x3')]},'mobile':{'type':Sequelize[_0x0f41('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0f41('0x3')]},'url':{'type':Sequelize[_0x0f41('0x3')]},'facebook':{'type':Sequelize[_0x0f41('0x3')]},'fb_data':{'type':Sequelize[_0x0f41('0x3')]},'twitter':{'type':Sequelize[_0x0f41('0x3')]},'skype':{'type':Sequelize[_0x0f41('0x3')]},'teams':{'type':Sequelize[_0x0f41('0x3')]},'viber':{'type':Sequelize[_0x0f41('0x3')]},'line':{'type':Sequelize[_0x0f41('0x3')]},'wechat':{'type':Sequelize[_0x0f41('0x3')]},'telegram':{'type':Sequelize[_0x0f41('0x3')]},'UserId':{'type':Sequelize[_0x0f41('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0f41('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0f41('0x6')],'defaultValue':Sequelize[_0x0f41('0x7')]}}; \ No newline at end of file +var _0x60ca=['sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x149808,_0x1e4ec1){var _0x353654=function(_0xdc8d3d){while(--_0xdc8d3d){_0x149808['push'](_0x149808['shift']());}};_0x353654(++_0x1e4ec1);}(_0x60ca,0x127));var _0xa60c=function(_0x1facbb,_0x6e73e3){_0x1facbb=_0x1facbb-0x0;var _0x57bf9f=_0x60ca[_0x1facbb];return _0x57bf9f;};'use strict';var _=require(_0xa60c('0x0'));var Sequelize=require(_0xa60c('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xa60c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa60c('0x2')]},'street':{'type':Sequelize[_0xa60c('0x2')]},'postalCode':{'type':Sequelize[_0xa60c('0x2')]},'city':{'type':Sequelize[_0xa60c('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xa60c('0x2')]},'description':{'type':Sequelize[_0xa60c('0x3')]},'phone':{'type':Sequelize[_0xa60c('0x2')]},'mobile':{'type':Sequelize[_0xa60c('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa60c('0x2')]},'url':{'type':Sequelize[_0xa60c('0x2')]},'facebook':{'type':Sequelize[_0xa60c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa60c('0x2')]},'skype':{'type':Sequelize[_0xa60c('0x2')]},'teams':{'type':Sequelize[_0xa60c('0x2')]},'viber':{'type':Sequelize[_0xa60c('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xa60c('0x2')]},'telegram':{'type':Sequelize[_0xa60c('0x2')]},'UserId':{'type':Sequelize[_0xa60c('0x4')]},'priority':{'type':Sequelize[_0xa60c('0x4')](0x2)[_0xa60c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa60c('0x6')],'defaultValue':Sequelize[_0xa60c('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 350132c..ab3b0bb 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 _0x073e=['rawAttributes','setTags','findOne','ids','options','includeAll','include','CmHopperHistory','nolimit','ContactId','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','path','parse','meta','import','binding','firstName','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','getJourney','chat','sms','openchannel','voice','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','uniqueid','source','callerid','starttime','note','userDisposition','userThirdDisposition','fullname','createdAt','alias','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','deviceModel','osName','ratingValue','referer','mail','threadId','Interaction','all','sortBy','reverse','slice','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','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','defaults','localhost','redis','./cmContact.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','name','CmContact','describe','startsWith','cf_','push','trimStart','fieldType','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','find','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','conditions','User','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','destroy','params','tags','columnName','displayName','findAll','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','catch','bulkCreate','each','duplicates','findOrCreate','spread','error','Tag','omit','format','cf_%d','$and','CmCustomField','pickBy','table','setFields','id\x20=\x20?','phone','getTags'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x073e,0x181));var _0xe073=function(_0x2920dd,_0x19d049){_0x2920dd=_0x2920dd-0x0;var _0x5d4e52=_0x073e[_0x2920dd];return _0x5d4e52;};'use strict';var pdf=require(_0xe073('0x0'));var emlformat=require(_0xe073('0x1'));var rimraf=require(_0xe073('0x2'));var zipdir=require(_0xe073('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe073('0x4'));var Mustache=require(_0xe073('0x5'));var util=require(_0xe073('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe073('0x7'));var fs=require('fs');var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];config['redis']=_[_0xe073('0x18')](config['redis'],{'host':_0xe073('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe073('0x1a')]));require(_0xe073('0x1b'))[_0xe073('0x1c')](socket);function respondWithStatusCode(_0x2ce92d,_0x3fb05a){_0x3fb05a=_0x3fb05a||0xcc;return function(_0x2ff692){if(_0x2ff692){return _0x2ce92d[_0xe073('0x1d')](_0x3fb05a);}return _0x2ce92d[_0xe073('0x1e')](_0x3fb05a)[_0xe073('0x1f')]();};}function respondWithResult(_0x26f3d3,_0x38f9e5){_0x38f9e5=_0x38f9e5||0xc8;return function(_0x512fe8){if(_0x512fe8){return _0x26f3d3['status'](_0x38f9e5)['json'](_0x512fe8);}};}function respondWithFilteredResult(_0x4c578c,_0x15488e){return function(_0x10486c){if(_0x10486c){var _0x16eaa6=_0x10486c[_0xe073('0x20')],_0x4f9c8e=_0x15488e['offset'],_0x4fdd2c=_0x15488e[_0xe073('0x21')]+_0x15488e[_0xe073('0x22')],_0x103a51;if(_0x4fdd2c>=_0x16eaa6){_0x4fdd2c=_0x16eaa6;_0x103a51=0xc8;}else{_0x103a51=0xce;}_0x4c578c[_0xe073('0x1e')](_0x103a51);return _0x4c578c[_0xe073('0x23')](_0xe073('0x24'),_0x4f9c8e+'-'+_0x4fdd2c+'/'+_0x16eaa6)[_0xe073('0x25')](_0x10486c);}return null;};}function patchUpdates(_0x41639a){return function(_0x1d7a13){try{jsonpatch[_0xe073('0x26')](_0x1d7a13,_0x41639a,!![]);}catch(_0x40b28c){return BPromise['reject'](_0x40b28c);}return _0x1d7a13[_0xe073('0x27')]();};}function saveUpdates(_0x21f9c2,_0x419703){return function(_0x1760e3){if(_0x1760e3){return _0x1760e3[_0xe073('0x28')](_0x21f9c2)[_0xe073('0x29')](function(_0x504c26){return _0x504c26;});}return null;};}function removeEntity(_0x4c76ef,_0x42d112){return function(_0x5d72a9){if(_0x5d72a9){return _0x5d72a9['destroy']()['then'](function(){_0x4c76ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50795f,_0x23537f){return function(_0xff003){if(!_0xff003){_0x50795f['sendStatus'](0x194);}return _0xff003;};}function handleError(_0x1fca27,_0x4548d8){_0x4548d8=_0x4548d8||0x1f4;return function(_0x436c34){logger['error'](_0x436c34[_0xe073('0x2a')]);if(_0x436c34['name']){delete _0x436c34[_0xe073('0x2b')];}_0x1fca27[_0xe073('0x1e')](_0x4548d8)['send'](_0x436c34);};}exports['index']=function(_0x15adbb,_0x859ed8){var _0x278fbb={},_0x2f1cd2={},_0x20fabe={'count':0x0,'rows':[]};return db[_0xe073('0x2c')][_0xe073('0x2d')]()[_0xe073('0x29')](function(_0x5c04fe){var _0x1baa0a=[];for(var _0x1cdcb0=0x0;_0x1cdcb00x1){_0x113617['or'](_0xe073('0x6c'),qs[_0xe073('0x6d')](_0x20957f),null);}else{if(qs[_0xe073('0x6e')](_0x20957f)){_0x113617['or'](_0xe073('0x6f'),_0x20957f+'%');_0x113617['or'](_0xe073('0x70'),_0x20957f+'%');_0x113617['or'](_0xe073('0x71'),_0x20957f+'%');_0x113617['or'](_0xe073('0x72'),_0x20957f+'%');}else if(qs[_0xe073('0x73')](_0x20957f)){_0x113617['or'](_0xe073('0x74'),_0x20957f+'%');}else{_0x113617['or'](_0xe073('0x75'),'%'+_0x20957f+'%');_0x113617['or'](_0xe073('0x76'),'%'+_0x20957f+'%');_0x113617['or'](_0xe073('0x74'),'%'+_0x20957f+'%');}}}}_0x21bd41['where'](_0x113617);_0x21bd41[_0xe073('0x77')](_0xe073('0x78'));var _0x2a4bca={'type':db[_0xe073('0x79')][_0xe073('0x7a')]['SELECT'],'raw':!![]};var _0x7ea739=_0x21bd41['clone']()[_0xe073('0x42')](_0xe073('0x78'));if(_0x278fbb[_0xe073('0x3d')]){_0x278fbb[_0xe073('0x3d')][_0xe073('0x63')](function(_0x31afa2){_0x21bd41['order']('c.'+_0x31afa2[0x0],_0x31afa2[0x1]===_0xe073('0x7b')?![]:!![]);});}if(!_['isEmpty'](_0x230fde)){_0x21bd41[_0xe073('0x7c')](_0x1f2bfa);_0x7ea739['where'](_0xe073('0x7d'),_0x230fde);}BPromise[_0xe073('0x7e')]()[_0xe073('0x29')](function(){if(!_0x51ab70)return;if(_0x15adbb[_0xe073('0x7f')][_0xe073('0x80')]!==_0xe073('0x81'))return;if(!_[_0xe073('0x82')](_0x51ab70[_0xe073('0x83')],[_0xe073('0x42'),_0xe073('0x84')])){return _0x15adbb[_0xe073('0x7f')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x3b7cae){if(_[_0xe073('0x62')](_0x3b7cae)){_0x7ea739['where']('c.ListId\x20IS\x20NULL');_0x21bd41[_0xe073('0x3f')](_0xe073('0x85'));}else{_0x7ea739[_0xe073('0x3f')](_0xe073('0x65'),_[_0xe073('0x53')](_0x3b7cae,'id'));_0x21bd41['where'](_0xe073('0x65'),_[_0xe073('0x53')](_0x3b7cae,'id'));}});}})[_0xe073('0x29')](function(){if(_0x15adbb[_0xe073('0x7f')][_0xe073('0x80')]===_0xe073('0x81')&&!_0x51ab70&&!_0x15adbb[_0xe073('0x36')][_0xe073('0x64')])return[];return db[_0xe073('0x86')][_0xe073('0x36')](_0x7ea739['toString'](),_0x2a4bca);})[_0xe073('0x29')](function(_0x509fd5){_0x20fabe['count']=_0x509fd5[_0xe073('0x3b')];if(_0x20fabe[_0xe073('0x20')]===0x0)return[];return db[_0xe073('0x86')][_0xe073('0x36')](_0x5a4e19[_0xe073('0x87')](),_0x2a4bca)[_0xe073('0x29')](function(_0x31a0e2){_0x3ecabe=_[_0xe073('0x88')](_0x31a0e2,'id');_0x2a4bca=_[_0xe073('0x89')](_0x2a4bca,{'model':db[_0xe073('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15adbb['query'][_0xe073('0x3a')]){_0x278fbb[_0xe073('0x39')][_0xe073('0x63')](function(_0x654c64){_0x21bd41[_0xe073('0x42')]('c.'+_0x654c64);});}else{_0x21bd41['field']('c.id');_0x21bd41[_0xe073('0x42')](_0xe073('0x8a'));_0x21bd41[_0xe073('0x42')](_0xe073('0x8b'));_0x21bd41['field']('c.phone');_0x21bd41[_0xe073('0x42')](_0xe073('0x8c'));_0x21bd41[_0xe073('0x42')](_0xe073('0x8d'));_0x21bd41['field']('c.email');_0x21bd41['field'](_0xe073('0x8e'));_0x21bd41[_0xe073('0x42')](_0xe073('0x8f'));_0x21bd41[_0xe073('0x42')](_0xe073('0x90'));_0x21bd41[_0xe073('0x42')](_0xe073('0x91'));_0x21bd41['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe073('0x92'));}if(_0x278fbb[_0xe073('0x22')])_0x21bd41[_0xe073('0x22')](_0x278fbb[_0xe073('0x22')]);if(_0x278fbb[_0xe073('0x21')])_0x21bd41['offset'](_0x278fbb[_0xe073('0x21')]);return db['sequelize']['query'](_0x21bd41[_0xe073('0x87')](),_0x2a4bca);});})[_0xe073('0x29')](function(_0x196fb2){_0x196fb2[_0xe073('0x63')](function(_0x4d50dc){if(_0x4d50dc['TagIds']){_0x4d50dc[_0xe073('0x93')]=[];_0x4d50dc[_0xe073('0x92')]['split'](',')[_0xe073('0x63')](function(_0x278717){_0x4d50dc[_0xe073('0x93')][_0xe073('0x30')](_0x3ecabe[_0x278717]);});}delete _0x4d50dc['TagIds'];});_0x20fabe[_0xe073('0x94')]=_0x196fb2;return _0x20fabe;})[_0xe073('0x29')](respondWithFilteredResult(_0x859ed8,_0x278fbb));})['catch'](handleError(_0x859ed8,null));};exports[_0xe073('0x95')]=function(_0x46a3fb,_0x499a4c){return db[_0xe073('0x2c')][_0xe073('0x51')]({'where':{'id':_0x46a3fb[_0xe073('0x96')]['id']}})[_0xe073('0x29')](handleEntityNotFound(_0x499a4c,null))[_0xe073('0x29')](removeEntity(_0x499a4c,null))['catch'](handleError(_0x499a4c,null));};exports[_0xe073('0x2d')]=function(_0xff2a4c,_0x5102ac){return db[_0xe073('0x2c')][_0xe073('0x2d')]()[_0xe073('0x29')](function(_0x4102c1){delete _0x4102c1[_0xe073('0x97')];for(var _0x1ace13=0x0;_0x1ace13=_0x1be963){_0x9a3022=_0x1be963;_0x2be488=0xc8;}else{_0x2be488=0xce;}_0x166e23['status'](_0x2be488);return _0x166e23[_0x7fe5('0x1f')](_0x7fe5('0x20'),_0x2533db+'-'+_0x9a3022+'/'+_0x1be963)[_0x7fe5('0x21')](_0x340d5e);}return null;};}function patchUpdates(_0x327301){return function(_0x39c560){try{jsonpatch[_0x7fe5('0x22')](_0x39c560,_0x327301,!![]);}catch(_0x24efbb){return BPromise[_0x7fe5('0x23')](_0x24efbb);}return _0x39c560[_0x7fe5('0x24')]();};}function saveUpdates(_0x28a7fd,_0xb8dfe){return function(_0x204f09){if(_0x204f09){return _0x204f09['update'](_0x28a7fd)[_0x7fe5('0x25')](function(_0x2f39e0){return _0x2f39e0;});}return null;};}function removeEntity(_0x43e547,_0x508826){return function(_0x1a8e28){if(_0x1a8e28){return _0x1a8e28['destroy']()[_0x7fe5('0x25')](function(){_0x43e547['status'](0xcc)[_0x7fe5('0x1c')]();});}};}function handleEntityNotFound(_0x190355,_0x134876){return function(_0x2a96f4){if(!_0x2a96f4){_0x190355[_0x7fe5('0x26')](0x194);}return _0x2a96f4;};}function handleError(_0x4393c3,_0x5bfe23){_0x5bfe23=_0x5bfe23||0x1f4;return function(_0x5f2d25){logger[_0x7fe5('0x27')](_0x5f2d25[_0x7fe5('0x28')]);if(_0x5f2d25[_0x7fe5('0x29')]){delete _0x5f2d25[_0x7fe5('0x29')];}_0x4393c3['status'](_0x5bfe23)[_0x7fe5('0x2a')](_0x5f2d25);};}exports['index']=function(_0x150ab9,_0x1420de){var _0x204bc8={},_0x28a689={},_0x1f8572={'count':0x0,'rows':[]};return db[_0x7fe5('0x2b')]['describe']()[_0x7fe5('0x25')](function(_0x423da8){var _0x5ec0b4=[];for(var _0xfc1189=0x0;_0xfc11890x1){_0x108f66['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7fe5('0x6d')](_0x356d8e),null);}else{if(qs['isNumeric'](_0x356d8e)){_0x108f66['or'](_0x7fe5('0x6e'),_0x356d8e+'%');_0x108f66['or'](_0x7fe5('0x6f'),_0x356d8e+'%');_0x108f66['or'](_0x7fe5('0x70'),_0x356d8e+'%');_0x108f66['or'](_0x7fe5('0x71'),_0x356d8e+'%');}else if(qs[_0x7fe5('0x72')](_0x356d8e)){_0x108f66['or'](_0x7fe5('0x73'),_0x356d8e+'%');}else{_0x108f66['or']('c.firstName\x20LIKE\x20?','%'+_0x356d8e+'%');_0x108f66['or']('c.lastName\x20LIKE\x20?','%'+_0x356d8e+'%');_0x108f66['or'](_0x7fe5('0x73'),'%'+_0x356d8e+'%');}}}}_0x5ca301[_0x7fe5('0x67')](_0x108f66);_0x5ca301[_0x7fe5('0x74')](_0x7fe5('0x75'));var _0x31aa1b={'type':db['Sequelize'][_0x7fe5('0x76')][_0x7fe5('0x77')],'raw':!![]};var _0x2bd79b=_0x5ca301[_0x7fe5('0x78')]()[_0x7fe5('0x42')]('c.id');if(_0x204bc8[_0x7fe5('0x3e')]){_0x204bc8[_0x7fe5('0x3e')][_0x7fe5('0x56')](function(_0x1f2cb6){_0x5ca301[_0x7fe5('0x3e')]('c.'+_0x1f2cb6[0x0],_0x1f2cb6[0x1]===_0x7fe5('0x79')?![]:!![]);});}if(!_[_0x7fe5('0x63')](_0x32d3c6)){_0x5ca301['having'](_0x2880c4);_0x2bd79b[_0x7fe5('0x67')](_0x7fe5('0x7a'),_0x32d3c6);}BPromise[_0x7fe5('0x7b')]()[_0x7fe5('0x25')](function(){if(!_0x148d76)return;if(_0x150ab9[_0x7fe5('0x7c')][_0x7fe5('0x7d')]!==_0x7fe5('0x7e'))return;if(!_['some'](_0x148d76['conditions'],[_0x7fe5('0x42'),'User'])){return _0x150ab9[_0x7fe5('0x7c')]['getLists']({'attributes':['id'],'raw':!![]})[_0x7fe5('0x25')](function(_0x42a144){if(_[_0x7fe5('0x63')](_0x42a144)){_0x2bd79b[_0x7fe5('0x67')](_0x7fe5('0x7f'));_0x5ca301[_0x7fe5('0x67')](_0x7fe5('0x7f'));}else{_0x2bd79b[_0x7fe5('0x67')]('c.ListId\x20IN\x20?',_[_0x7fe5('0x55')](_0x42a144,'id'));_0x5ca301['where'](_0x7fe5('0x65'),_[_0x7fe5('0x55')](_0x42a144,'id'));}});}})[_0x7fe5('0x25')](function(){if(_0x150ab9['user'][_0x7fe5('0x7d')]===_0x7fe5('0x7e')&&!_0x148d76&&!_0x150ab9[_0x7fe5('0x38')][_0x7fe5('0x64')])return[];return db[_0x7fe5('0x80')][_0x7fe5('0x38')](_0x2bd79b['toString'](),_0x31aa1b);})[_0x7fe5('0x25')](function(_0x46d509){_0x1f8572['count']=_0x46d509[_0x7fe5('0x2d')];if(_0x1f8572[_0x7fe5('0x1d')]===0x0)return[];return db['sequelize'][_0x7fe5('0x38')](_0x5df71d['toString'](),_0x31aa1b)[_0x7fe5('0x25')](function(_0x3577be){_0x26be07=_[_0x7fe5('0x81')](_0x3577be,'id');_0x31aa1b=_[_0x7fe5('0x82')](_0x31aa1b,{'model':db[_0x7fe5('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x150ab9['query'][_0x7fe5('0x39')]){_0x204bc8['attributes'][_0x7fe5('0x56')](function(_0x3e1c8f){_0x5ca301[_0x7fe5('0x42')]('c.'+_0x3e1c8f);});}else{_0x5ca301[_0x7fe5('0x42')]('c.id');_0x5ca301[_0x7fe5('0x42')]('c.firstName');_0x5ca301[_0x7fe5('0x42')](_0x7fe5('0x83'));_0x5ca301['field'](_0x7fe5('0x84'));_0x5ca301[_0x7fe5('0x42')]('c.mobile');_0x5ca301[_0x7fe5('0x42')](_0x7fe5('0x85'));_0x5ca301[_0x7fe5('0x42')]('c.email');_0x5ca301[_0x7fe5('0x42')](_0x7fe5('0x86'));_0x5ca301['field'](_0x7fe5('0x87'));_0x5ca301[_0x7fe5('0x42')]('c.deletedAt');_0x5ca301[_0x7fe5('0x42')]('c.CompanyId');_0x5ca301['field'](_0x7fe5('0x88'),_0x7fe5('0x89'));}if(_0x204bc8['limit'])_0x5ca301['limit'](_0x204bc8[_0x7fe5('0x3d')]);if(_0x204bc8['offset'])_0x5ca301[_0x7fe5('0x1e')](_0x204bc8['offset']);return db[_0x7fe5('0x80')][_0x7fe5('0x38')](_0x5ca301[_0x7fe5('0x8a')](),_0x31aa1b);});})[_0x7fe5('0x25')](function(_0xfea96){_0xfea96['forEach'](function(_0x4fecc){if(_0x4fecc[_0x7fe5('0x89')]){_0x4fecc[_0x7fe5('0x8b')]=[];_0x4fecc[_0x7fe5('0x89')][_0x7fe5('0x54')](',')[_0x7fe5('0x56')](function(_0x6d543b){_0x4fecc[_0x7fe5('0x8b')][_0x7fe5('0x2e')](_0x26be07[_0x6d543b]);});}delete _0x4fecc[_0x7fe5('0x89')];});_0x1f8572['rows']=_0xfea96;return _0x1f8572;})[_0x7fe5('0x25')](respondWithFilteredResult(_0x1420de,_0x204bc8));})[_0x7fe5('0x8c')](handleError(_0x1420de,null));};exports[_0x7fe5('0x8d')]=function(_0x21d716,_0x2fc9d8){return db['CmContact'][_0x7fe5('0x51')]({'where':{'id':_0x21d716[_0x7fe5('0x8e')]['id']}})[_0x7fe5('0x25')](handleEntityNotFound(_0x2fc9d8,null))[_0x7fe5('0x25')](removeEntity(_0x2fc9d8,null))[_0x7fe5('0x8c')](handleError(_0x2fc9d8,null));};exports[_0x7fe5('0x8f')]=function(_0x346a87,_0x2da574){return db[_0x7fe5('0x2b')][_0x7fe5('0x8f')]()[_0x7fe5('0x25')](function(_0x51d8ca){delete _0x51d8ca[_0x7fe5('0x90')];for(var _0x5412eb=0x0;_0x5412eb{}\s\\|]/g,'-');_0x4b5724(null,util[_0xf705('0x1f')](_0xf705('0x20'),path[_0xf705('0x21')](_0x4d34cd[_0xf705('0x1d')],path[_0xf705('0x22')](_0x4d34cd[_0xf705('0x1d')])),Date[_0xf705('0x23')](),path[_0xf705('0x22')](_0x4d34cd['originalname'])));}})});router[_0xf705('0x16')]('/csv',upload[_0xf705('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0xf705('0x1a')]({'destination':function(_0x33da21,_0x593180,_0x4f5435){_0x4f5435(null,path[_0xf705('0x1b')](config[_0xf705('0x1c')],_0xf705('0x25')));},'filename':function(_0xabee0,_0x2cd45c,_0x5e2798){_0x2cd45c[_0xf705('0x1d')]=_0x2cd45c[_0xf705('0x1d')][_0xf705('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e2798(null,util['format']('%s-%s%s',path['basename'](_0x2cd45c['originalname'],path[_0xf705('0x22')](_0x2cd45c['originalname'])),Date['now'](),path[_0xf705('0x22')](_0x2cd45c[_0xf705('0x1d')])));}})});router[_0xf705('0x16')](_0xf705('0x26'),upload[_0xf705('0x24')]('file'),controller['upload']);router[_0xf705('0x16')](_0xf705('0x27'),auth[_0xf705('0x8')](),controller[_0xf705('0x28')]);router[_0xf705('0x29')](_0xf705('0x2a'),auth[_0xf705('0x8')](),controller[_0xf705('0x2b')]);router['delete'](_0xf705('0x2a'),auth['isAuthenticated'](),controller[_0xf705('0x2c')]);module['exports']=router; \ No newline at end of file +var _0xf894=['/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','/upload','upload','/upload/:id','import','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','/:id/tags','getTags','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0xf894,0xfd));var _0x4f89=function(_0x4205ec,_0x3a816f){_0x4205ec=_0x4205ec-0x0;var _0x4b5143=_0xf894[_0x4205ec];return _0x4b5143;};'use strict';var multer=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var path=require(_0x4f89('0x2'));var timeout=require(_0x4f89('0x3'));var express=require(_0x4f89('0x4'));var router=express[_0x4f89('0x5')]();var auth=require(_0x4f89('0x6'));var interaction=require(_0x4f89('0x7'));var config=require(_0x4f89('0x8'));var controller=require(_0x4f89('0x9'));router[_0x4f89('0xa')]('/',auth[_0x4f89('0xb')](),controller[_0x4f89('0xc')]);router[_0x4f89('0xa')](_0x4f89('0xd'),auth[_0x4f89('0xb')](),controller[_0x4f89('0xe')]);router[_0x4f89('0xa')]('/:id',auth[_0x4f89('0xb')](),controller[_0x4f89('0xf')]);router[_0x4f89('0xa')](_0x4f89('0x10'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x11')]);router[_0x4f89('0xa')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x4f89('0xa')](_0x4f89('0x12'),auth['isAuthenticated'](),controller[_0x4f89('0x13')]);router[_0x4f89('0xa')](_0x4f89('0x14'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x15')]);router[_0x4f89('0xa')](_0x4f89('0x16'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x17')]);router['get'](_0x4f89('0x18'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x19')]);router[_0x4f89('0x1a')](_0x4f89('0x1b'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x1c')]);router['post']('/',auth[_0x4f89('0xb')](),controller['create']);router['post'](_0x4f89('0x1d'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x1e')]);router[_0x4f89('0x1a')]('/:id/tags',auth[_0x4f89('0xb')](),controller[_0x4f89('0x1f')]);var upload=multer({'storage':multer[_0x4f89('0x20')]({'destination':function(_0x30cc14,_0x2712f3,_0x18eea9){_0x18eea9(null,path[_0x4f89('0x21')](config[_0x4f89('0x22')],_0x4f89('0x23')));},'filename':function(_0x536066,_0x5e99ea,_0x34d9c7){_0x5e99ea[_0x4f89('0x24')]=_0x5e99ea['originalname'][_0x4f89('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x34d9c7(null,util['format'](_0x4f89('0x26'),path[_0x4f89('0x27')](_0x5e99ea[_0x4f89('0x24')],path[_0x4f89('0x28')](_0x5e99ea[_0x4f89('0x24')])),Date[_0x4f89('0x29')](),path[_0x4f89('0x28')](_0x5e99ea['originalname'])));}})});router[_0x4f89('0x1a')](_0x4f89('0x2a'),upload[_0x4f89('0x2b')](_0x4f89('0x2c')),controller[_0x4f89('0x2d')]);var upload=multer({'storage':multer[_0x4f89('0x20')]({'destination':function(_0xe96e6,_0x283e3a,_0x891e2b){_0x891e2b(null,path[_0x4f89('0x21')](config[_0x4f89('0x22')],_0x4f89('0x23')));},'filename':function(_0x50af0f,_0x224a54,_0x4eb967){_0x224a54[_0x4f89('0x24')]=_0x224a54[_0x4f89('0x24')][_0x4f89('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4eb967(null,util['format'](_0x4f89('0x26'),path[_0x4f89('0x27')](_0x224a54[_0x4f89('0x24')],path[_0x4f89('0x28')](_0x224a54['originalname'])),Date[_0x4f89('0x29')](),path[_0x4f89('0x28')](_0x224a54[_0x4f89('0x24')])));}})});router['post'](_0x4f89('0x2e'),upload[_0x4f89('0x2b')](_0x4f89('0x2c')),controller[_0x4f89('0x2f')]);router[_0x4f89('0x1a')](_0x4f89('0x30'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x31')]);router[_0x4f89('0x32')]('/:id',auth[_0x4f89('0xb')](),controller[_0x4f89('0x33')]);router[_0x4f89('0x34')](_0x4f89('0x35'),auth[_0x4f89('0xb')](),controller[_0x4f89('0x36')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 420397a..70aefbb 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 _0x093a=['voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x838516,_0x3fe93f){var _0x566ac2=function(_0x5dc51d){while(--_0x5dc51d){_0x838516['push'](_0x838516['shift']());}};_0x566ac2(++_0x3fe93f);}(_0x093a,0x16a));var _0xa093=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x093a[_0x211632];return _0x5a1da1;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa093('0x0'));module[_0xa093('0x1')]={'name':{'type':Sequelize[_0xa093('0x2')],'get':function(_0x5bc87c){return this['getDataValue'](_0xa093('0x3'));}},'alias':{'type':Sequelize[_0xa093('0x4')],'allowNull':![],'set':function(_0x28d105){this[_0xa093('0x5')](_0xa093('0x3'),_0x28d105?_0x28d105:this[_0xa093('0x6')](_0xa093('0x7')));}},'type':{'type':Sequelize[_0xa093('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa093('0x8')](_0xa093('0x9')),'get':function(){if(this[_0xa093('0x6')](_0xa093('0xa'))===_0xa093('0xb')){return JSON[_0xa093('0xc')](this[_0xa093('0x6')](_0xa093('0xd')));}else{return this[_0xa093('0x6')](_0xa093('0xd'));}},'set':function(_0x86da1a){if(Array[_0xa093('0xe')](_0x86da1a)){this[_0xa093('0x5')]('values',JSON[_0xa093('0xf')](_0x86da1a));}else{this[_0xa093('0x5')](_0xa093('0xd'),_0x86da1a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa093('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa093('0x11')](_0xa093('0x12'))}}; \ No newline at end of file +var _0x98a8=['setDataValue','name','TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias'];(function(_0x5d9423,_0x55f0b4){var _0x30cfb3=function(_0x31075a){while(--_0x31075a){_0x5d9423['push'](_0x5d9423['shift']());}};_0x30cfb3(++_0x55f0b4);}(_0x98a8,0x12c));var _0x898a=function(_0x34d13a,_0x705afb){_0x34d13a=_0x34d13a-0x0;var _0x19378a=_0x98a8[_0x34d13a];return _0x19378a;};'use strict';var Sequelize=require(_0x898a('0x0'));var _=require(_0x898a('0x1'));module[_0x898a('0x2')]={'name':{'type':Sequelize[_0x898a('0x3')],'get':function(_0x213c5d){return this[_0x898a('0x4')](_0x898a('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2bb3e2){this[_0x898a('0x6')](_0x898a('0x5'),_0x2bb3e2?_0x2bb3e2:this[_0x898a('0x4')](_0x898a('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x898a('0x8')]('long'),'get':function(){if(this[_0x898a('0x4')]('type')===_0x898a('0x9')){return JSON[_0x898a('0xa')](this[_0x898a('0x4')](_0x898a('0xb')));}else{return this[_0x898a('0x4')](_0x898a('0xb'));}},'set':function(_0x42faa4){if(Array[_0x898a('0xc')](_0x42faa4)){this[_0x898a('0x6')]('values',JSON[_0x898a('0xd')](_0x42faa4));}else{this['setDataValue'](_0x898a('0xb'),_0x42faa4);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x898a('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x898a('0xf')](_0x898a('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c20b012..aa04e69 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 _0xcae6=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','CmCustomField','findAll','rows','catch','show','params','length','includeAll','find','body','create','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x26efa5,_0xea7fd1){var _0x407266=function(_0x5267bb){while(--_0x5267bb){_0x26efa5['push'](_0x26efa5['shift']());}};_0x407266(++_0xea7fd1);}(_0xcae6,0x1ae));var _0x6cae=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xcae6[_0x126f47];return _0x49508a;};'use strict';var pdf=require(_0x6cae('0x0'));var emlformat=require(_0x6cae('0x1'));var rimraf=require(_0x6cae('0x2'));var zipdir=require(_0x6cae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cae('0x4'));var moment=require(_0x6cae('0x5'));var BPromise=require(_0x6cae('0x6'));var Mustache=require('mustache');var util=require(_0x6cae('0x7'));var path=require(_0x6cae('0x8'));var sox=require(_0x6cae('0x9'));var csv=require(_0x6cae('0xa'));var ejs=require(_0x6cae('0xb'));var fs=require('fs');var _=require(_0x6cae('0xc'));var squel=require('squel');var crypto=require(_0x6cae('0xd'));var jsforce=require(_0x6cae('0xe'));var deskjs=require(_0x6cae('0xf'));var toCsv=require(_0x6cae('0xa'));var querystring=require(_0x6cae('0x10'));var Papa=require(_0x6cae('0x11'));var Redis=require(_0x6cae('0x12'));var authService=require(_0x6cae('0x13'));var qs=require(_0x6cae('0x14'));var as=require(_0x6cae('0x15'));var hardwareService=require(_0x6cae('0x16'));var logger=require(_0x6cae('0x17'))('api');var utils=require(_0x6cae('0x18'));var config=require(_0x6cae('0x19'));var licenseUtil=require(_0x6cae('0x1a'));var db=require(_0x6cae('0x1b'))['db'];function respondWithStatusCode(_0x22ace9,_0x214744){_0x214744=_0x214744||0xcc;return function(_0x71201f){if(_0x71201f){return _0x22ace9[_0x6cae('0x1c')](_0x214744);}return _0x22ace9[_0x6cae('0x1d')](_0x214744)[_0x6cae('0x1e')]();};}function respondWithResult(_0xe2da53,_0x161a15){_0x161a15=_0x161a15||0xc8;return function(_0x33843f){if(_0x33843f){return _0xe2da53['status'](_0x161a15)['json'](_0x33843f);}};}function respondWithFilteredResult(_0x4eba2c,_0x5656d6){return function(_0x2c3587){if(_0x2c3587){var _0x46dcd6=_0x2c3587[_0x6cae('0x1f')],_0x461af2=_0x5656d6[_0x6cae('0x20')],_0x3c4846=_0x5656d6['offset']+_0x5656d6[_0x6cae('0x21')],_0x52f36c;if(_0x3c4846>=_0x46dcd6){_0x3c4846=_0x46dcd6;_0x52f36c=0xc8;}else{_0x52f36c=0xce;}_0x4eba2c[_0x6cae('0x1d')](_0x52f36c);return _0x4eba2c[_0x6cae('0x22')](_0x6cae('0x23'),_0x461af2+'-'+_0x3c4846+'/'+_0x46dcd6)[_0x6cae('0x24')](_0x2c3587);}return null;};}function patchUpdates(_0x2945ce){return function(_0x1acb3b){try{jsonpatch[_0x6cae('0x25')](_0x1acb3b,_0x2945ce,!![]);}catch(_0x5dee13){return BPromise[_0x6cae('0x26')](_0x5dee13);}return _0x1acb3b[_0x6cae('0x27')]();};}function saveUpdates(_0x2a33cb,_0x1e4572){return function(_0x214f8e){if(_0x214f8e){return _0x214f8e[_0x6cae('0x28')](_0x2a33cb)[_0x6cae('0x29')](function(_0x545c1d){return _0x545c1d;});}return null;};}function removeEntity(_0xb13967,_0x4b6759){return function(_0x16b710){if(_0x16b710){return _0x16b710[_0x6cae('0x2a')]()['then'](function(){_0xb13967[_0x6cae('0x1d')](0xcc)[_0x6cae('0x1e')]();});}};}function handleEntityNotFound(_0x2f8b47,_0x248a02){return function(_0x2cfa0d){if(!_0x2cfa0d){_0x2f8b47[_0x6cae('0x1c')](0x194);}return _0x2cfa0d;};}function handleError(_0x2550be,_0x351c14){_0x351c14=_0x351c14||0x1f4;return function(_0x55f644){logger['error'](_0x55f644[_0x6cae('0x2b')]);if(_0x55f644['name']){delete _0x55f644[_0x6cae('0x2c')];}_0x2550be['status'](_0x351c14)[_0x6cae('0x2d')](_0x55f644);};}exports[_0x6cae('0x2e')]=function(_0x4194ff,_0x242b25){var _0x46de5e={},_0x409b6c={},_0x43fd3a={'count':0x0,'rows':[]};var _0x412abb=_[_0x6cae('0x2f')](db['CmCustomField'][_0x6cae('0x30')],function(_0x4dc3cb){return{'name':_0x4dc3cb['fieldName'],'type':_0x4dc3cb[_0x6cae('0x31')][_0x6cae('0x32')]};});_0x409b6c[_0x6cae('0x33')]=_[_0x6cae('0x34')](_['map'](_0x412abb,'name'),[_0x6cae('0x2c')]);_0x409b6c[_0x6cae('0x35')]=_[_0x6cae('0x36')](_0x4194ff[_0x6cae('0x35')]);_0x409b6c[_0x6cae('0x37')]=_[_0x6cae('0x38')](_0x409b6c[_0x6cae('0x33')],_0x409b6c[_0x6cae('0x35')]);_0x46de5e['attributes']=_['intersection'](_0x409b6c[_0x6cae('0x33')],qs[_0x6cae('0x39')](_0x4194ff[_0x6cae('0x35')][_0x6cae('0x39')]));_0x46de5e[_0x6cae('0x3a')]=_0x46de5e[_0x6cae('0x3a')]['length']?_0x46de5e[_0x6cae('0x3a')]:_0x409b6c[_0x6cae('0x33')];if(!_0x4194ff[_0x6cae('0x35')][_0x6cae('0x3b')](_0x6cae('0x3c'))){_0x46de5e[_0x6cae('0x21')]=qs[_0x6cae('0x21')](_0x4194ff[_0x6cae('0x35')]['limit']);_0x46de5e[_0x6cae('0x20')]=qs[_0x6cae('0x20')](_0x4194ff[_0x6cae('0x35')][_0x6cae('0x20')]);}_0x46de5e[_0x6cae('0x3d')]=qs['sort'](_0x4194ff[_0x6cae('0x35')][_0x6cae('0x3e')]);_0x46de5e[_0x6cae('0x3f')]=qs[_0x6cae('0x37')](_[_0x6cae('0x40')](_0x4194ff[_0x6cae('0x35')],_0x409b6c[_0x6cae('0x37')]),_0x412abb);if(_0x4194ff[_0x6cae('0x35')][_0x6cae('0x41')]){_0x46de5e[_0x6cae('0x3f')]=_[_0x6cae('0x42')](_0x46de5e[_0x6cae('0x3f')],{'$or':_[_0x6cae('0x2f')](_0x412abb,function(_0x5a3e16){if(_0x5a3e16[_0x6cae('0x31')]!=='VIRTUAL'){var _0xcbd94a={};_0xcbd94a[_0x5a3e16['name']]={'$like':'%'+_0x4194ff[_0x6cae('0x35')]['filter']+'%'};return _0xcbd94a;}})});}_0x46de5e=_[_0x6cae('0x42')]({},_0x46de5e,_0x4194ff[_0x6cae('0x43')]);var _0x9f08bc={'where':_0x46de5e['where']};return db['CmCustomField'][_0x6cae('0x1f')](_0x9f08bc)['then'](function(_0x5f33e1){_0x43fd3a[_0x6cae('0x1f')]=_0x5f33e1;if(_0x4194ff[_0x6cae('0x35')]['includeAll']){_0x46de5e[_0x6cae('0x44')]=[{'all':!![]}];}return db[_0x6cae('0x45')][_0x6cae('0x46')](_0x46de5e);})[_0x6cae('0x29')](function(_0x130c76){_0x43fd3a[_0x6cae('0x47')]=_0x130c76;return _0x43fd3a;})[_0x6cae('0x29')](respondWithFilteredResult(_0x242b25,_0x46de5e))[_0x6cae('0x48')](handleError(_0x242b25,null));};exports[_0x6cae('0x49')]=function(_0x97ead8,_0x23ddcb){var _0x2c1519={'raw':!![],'where':{'id':_0x97ead8[_0x6cae('0x4a')]['id']}},_0x3eb9a3={};_0x3eb9a3[_0x6cae('0x33')]=_['keys'](db[_0x6cae('0x45')][_0x6cae('0x30')]);_0x3eb9a3[_0x6cae('0x35')]=_[_0x6cae('0x36')](_0x97ead8[_0x6cae('0x35')]);_0x3eb9a3[_0x6cae('0x37')]=_[_0x6cae('0x38')](_0x3eb9a3['model'],_0x3eb9a3[_0x6cae('0x35')]);_0x2c1519[_0x6cae('0x3a')]=_['intersection'](_0x3eb9a3['model'],qs[_0x6cae('0x39')](_0x97ead8[_0x6cae('0x35')][_0x6cae('0x39')]));_0x2c1519['attributes']=_0x2c1519['attributes'][_0x6cae('0x4b')]?_0x2c1519[_0x6cae('0x3a')]:_0x3eb9a3[_0x6cae('0x33')];if(_0x97ead8['query'][_0x6cae('0x4c')]){_0x2c1519[_0x6cae('0x44')]=[{'all':!![]}];}_0x2c1519=_[_0x6cae('0x42')]({},_0x2c1519,_0x97ead8[_0x6cae('0x43')]);return db['CmCustomField'][_0x6cae('0x4d')](_0x2c1519)['then'](handleEntityNotFound(_0x23ddcb,null))[_0x6cae('0x29')](respondWithResult(_0x23ddcb,null))[_0x6cae('0x48')](handleError(_0x23ddcb,null));};exports[_0x6cae('0x28')]=function(_0x468030,_0x19d28d){if(_0x468030[_0x6cae('0x4e')]['id']){delete _0x468030[_0x6cae('0x4e')]['id'];}return db[_0x6cae('0x45')][_0x6cae('0x4d')]({'where':{'id':_0x468030['params']['id']}})[_0x6cae('0x29')](handleEntityNotFound(_0x19d28d,null))[_0x6cae('0x29')](saveUpdates(_0x468030['body'],null))['then'](respondWithResult(_0x19d28d,null))[_0x6cae('0x48')](handleError(_0x19d28d,null));};exports['destroy']=function(_0x521ef1,_0x1a9b14){return db[_0x6cae('0x45')]['find']({'where':{'id':_0x521ef1[_0x6cae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a9b14,null))[_0x6cae('0x29')](removeEntity(_0x1a9b14,null))[_0x6cae('0x48')](handleError(_0x1a9b14,null));};exports[_0x6cae('0x4f')]=function(_0xc36dc,_0x21656a){var _0x3eacbe;return db[_0x6cae('0x50')][_0x6cae('0x51')](function(_0x6dd906){return db['CmCustomField'][_0x6cae('0x4f')](_0xc36dc[_0x6cae('0x4e')],{'transaction':_0x6dd906})[_0x6cae('0x29')](function(_0x583ab6){_0x3eacbe=_0x583ab6;var _0x2a07cf={'type':db['Sequelize'][_0x6cae('0x52')],'transaction':_0x6dd906};switch(_0xc36dc['body'][_0x6cae('0x31')]){case _0x6cae('0x53'):_0x2a07cf[_0x6cae('0x31')]=db[_0x6cae('0x54')][_0x6cae('0x52')];break;case'number':_0x2a07cf[_0x6cae('0x31')]=db[_0x6cae('0x54')][_0x6cae('0x55')];break;case _0x6cae('0x56'):_0x2a07cf[_0x6cae('0x31')]=db[_0x6cae('0x54')]['BOOLEAN'];_0x2a07cf['defaultValue']=![];break;default:}return db[_0x6cae('0x50')]['queryInterface'][_0x6cae('0x57')](_0x6cae('0x58'),util[_0x6cae('0x59')](_0x6cae('0x5a'),_0x3eacbe['id']),_0x2a07cf);})[_0x6cae('0x29')](function(){return _0x3eacbe;});})[_0x6cae('0x29')](respondWithResult(_0x21656a,0xc9))[_0x6cae('0x48')](handleError(_0x21656a,null));}; \ No newline at end of file +var _0xdff8=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','send','index','map','CmCustomField','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xdff8,0x159));var _0x8dff=function(_0x5608df,_0xff2326){_0x5608df=_0x5608df-0x0;var _0x4c2e63=_0xdff8[_0x5608df];return _0x4c2e63;};'use strict';var pdf=require(_0x8dff('0x0'));var emlformat=require(_0x8dff('0x1'));var rimraf=require(_0x8dff('0x2'));var zipdir=require(_0x8dff('0x3'));var jsonpatch=require(_0x8dff('0x4'));var rp=require('request-promise');var moment=require(_0x8dff('0x5'));var BPromise=require(_0x8dff('0x6'));var Mustache=require(_0x8dff('0x7'));var util=require(_0x8dff('0x8'));var path=require(_0x8dff('0x9'));var sox=require(_0x8dff('0xa'));var csv=require(_0x8dff('0xb'));var ejs=require(_0x8dff('0xc'));var fs=require('fs');var _=require(_0x8dff('0xd'));var squel=require(_0x8dff('0xe'));var crypto=require(_0x8dff('0xf'));var jsforce=require(_0x8dff('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8dff('0x11'));var Redis=require(_0x8dff('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8dff('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dff('0x14'));var logger=require(_0x8dff('0x15'))(_0x8dff('0x16'));var utils=require(_0x8dff('0x17'));var config=require(_0x8dff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475f1c,_0x530e1e){_0x530e1e=_0x530e1e||0xcc;return function(_0x2bd0bc){if(_0x2bd0bc){return _0x475f1c['sendStatus'](_0x530e1e);}return _0x475f1c[_0x8dff('0x19')](_0x530e1e)[_0x8dff('0x1a')]();};}function respondWithResult(_0x3cff7d,_0x24d002){_0x24d002=_0x24d002||0xc8;return function(_0x5e0007){if(_0x5e0007){return _0x3cff7d[_0x8dff('0x19')](_0x24d002)[_0x8dff('0x1b')](_0x5e0007);}};}function respondWithFilteredResult(_0x1425bb,_0x4cfb00){return function(_0x4df69d){if(_0x4df69d){var _0x1ee261=_0x4df69d[_0x8dff('0x1c')],_0x18d7c8=_0x4cfb00['offset'],_0x2ddb3b=_0x4cfb00['offset']+_0x4cfb00[_0x8dff('0x1d')],_0x3a21d7;if(_0x2ddb3b>=_0x1ee261){_0x2ddb3b=_0x1ee261;_0x3a21d7=0xc8;}else{_0x3a21d7=0xce;}_0x1425bb[_0x8dff('0x19')](_0x3a21d7);return _0x1425bb[_0x8dff('0x1e')](_0x8dff('0x1f'),_0x18d7c8+'-'+_0x2ddb3b+'/'+_0x1ee261)[_0x8dff('0x1b')](_0x4df69d);}return null;};}function patchUpdates(_0x224dcd){return function(_0x52aee0){try{jsonpatch[_0x8dff('0x20')](_0x52aee0,_0x224dcd,!![]);}catch(_0x44fe55){return BPromise['reject'](_0x44fe55);}return _0x52aee0[_0x8dff('0x21')]();};}function saveUpdates(_0x20d1b2,_0x5c7d92){return function(_0x33831c){if(_0x33831c){return _0x33831c[_0x8dff('0x22')](_0x20d1b2)['then'](function(_0x4a9723){return _0x4a9723;});}return null;};}function removeEntity(_0x302655,_0x35b994){return function(_0x3eb5b7){if(_0x3eb5b7){return _0x3eb5b7[_0x8dff('0x23')]()[_0x8dff('0x24')](function(){_0x302655[_0x8dff('0x19')](0xcc)[_0x8dff('0x1a')]();});}};}function handleEntityNotFound(_0x2c2c6d,_0x105798){return function(_0x5b6fe5){if(!_0x5b6fe5){_0x2c2c6d[_0x8dff('0x25')](0x194);}return _0x5b6fe5;};}function handleError(_0x21bef9,_0x482eb0){_0x482eb0=_0x482eb0||0x1f4;return function(_0x4ace7c){logger[_0x8dff('0x26')](_0x4ace7c[_0x8dff('0x27')]);if(_0x4ace7c['name']){delete _0x4ace7c['name'];}_0x21bef9[_0x8dff('0x19')](_0x482eb0)[_0x8dff('0x28')](_0x4ace7c);};}exports[_0x8dff('0x29')]=function(_0x355295,_0x59e050){var _0x2de53f={},_0x177d14={},_0x46cbcd={'count':0x0,'rows':[]};var _0x5b5e8e=_[_0x8dff('0x2a')](db[_0x8dff('0x2b')][_0x8dff('0x2c')],function(_0x13e14a){return{'name':_0x13e14a['fieldName'],'type':_0x13e14a[_0x8dff('0x2d')]['key']};});_0x177d14[_0x8dff('0x2e')]=_['differenceBy'](_[_0x8dff('0x2a')](_0x5b5e8e,'name'),[_0x8dff('0x2f')]);_0x177d14[_0x8dff('0x30')]=_[_0x8dff('0x31')](_0x355295['query']);_0x177d14[_0x8dff('0x32')]=_[_0x8dff('0x33')](_0x177d14['model'],_0x177d14[_0x8dff('0x30')]);_0x2de53f['attributes']=_[_0x8dff('0x33')](_0x177d14[_0x8dff('0x2e')],qs[_0x8dff('0x34')](_0x355295[_0x8dff('0x30')]['fields']));_0x2de53f[_0x8dff('0x35')]=_0x2de53f[_0x8dff('0x35')][_0x8dff('0x36')]?_0x2de53f[_0x8dff('0x35')]:_0x177d14[_0x8dff('0x2e')];if(!_0x355295[_0x8dff('0x30')][_0x8dff('0x37')](_0x8dff('0x38'))){_0x2de53f[_0x8dff('0x1d')]=qs[_0x8dff('0x1d')](_0x355295['query'][_0x8dff('0x1d')]);_0x2de53f[_0x8dff('0x39')]=qs['offset'](_0x355295['query'][_0x8dff('0x39')]);}_0x2de53f[_0x8dff('0x3a')]=qs[_0x8dff('0x3b')](_0x355295['query'][_0x8dff('0x3b')]);_0x2de53f['where']=qs['filters'](_['pick'](_0x355295['query'],_0x177d14[_0x8dff('0x32')]),_0x5b5e8e);if(_0x355295['query'][_0x8dff('0x3c')]){_0x2de53f['where']=_[_0x8dff('0x3d')](_0x2de53f[_0x8dff('0x3e')],{'$or':_[_0x8dff('0x2a')](_0x5b5e8e,function(_0x559683){if(_0x559683['type']!==_0x8dff('0x3f')){var _0x55f4a7={};_0x55f4a7[_0x559683[_0x8dff('0x2f')]]={'$like':'%'+_0x355295[_0x8dff('0x30')][_0x8dff('0x3c')]+'%'};return _0x55f4a7;}})});}_0x2de53f=_[_0x8dff('0x3d')]({},_0x2de53f,_0x355295[_0x8dff('0x40')]);var _0x2170f4={'where':_0x2de53f['where']};return db[_0x8dff('0x2b')][_0x8dff('0x1c')](_0x2170f4)[_0x8dff('0x24')](function(_0x7cc8cb){_0x46cbcd[_0x8dff('0x1c')]=_0x7cc8cb;if(_0x355295[_0x8dff('0x30')][_0x8dff('0x41')]){_0x2de53f[_0x8dff('0x42')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x2de53f);})['then'](function(_0x4b53e0){_0x46cbcd[_0x8dff('0x43')]=_0x4b53e0;return _0x46cbcd;})[_0x8dff('0x24')](respondWithFilteredResult(_0x59e050,_0x2de53f))[_0x8dff('0x44')](handleError(_0x59e050,null));};exports[_0x8dff('0x45')]=function(_0x444691,_0x9c5e27){var _0x6e355c={'raw':!![],'where':{'id':_0x444691['params']['id']}},_0x4c484b={};_0x4c484b[_0x8dff('0x2e')]=_[_0x8dff('0x31')](db['CmCustomField'][_0x8dff('0x2c')]);_0x4c484b[_0x8dff('0x30')]=_['keys'](_0x444691[_0x8dff('0x30')]);_0x4c484b[_0x8dff('0x32')]=_['intersection'](_0x4c484b[_0x8dff('0x2e')],_0x4c484b['query']);_0x6e355c[_0x8dff('0x35')]=_[_0x8dff('0x33')](_0x4c484b[_0x8dff('0x2e')],qs[_0x8dff('0x34')](_0x444691[_0x8dff('0x30')][_0x8dff('0x34')]));_0x6e355c[_0x8dff('0x35')]=_0x6e355c['attributes'][_0x8dff('0x36')]?_0x6e355c['attributes']:_0x4c484b[_0x8dff('0x2e')];if(_0x444691[_0x8dff('0x30')][_0x8dff('0x41')]){_0x6e355c['include']=[{'all':!![]}];}_0x6e355c=_[_0x8dff('0x3d')]({},_0x6e355c,_0x444691[_0x8dff('0x40')]);return db[_0x8dff('0x2b')][_0x8dff('0x46')](_0x6e355c)[_0x8dff('0x24')](handleEntityNotFound(_0x9c5e27,null))[_0x8dff('0x24')](respondWithResult(_0x9c5e27,null))[_0x8dff('0x44')](handleError(_0x9c5e27,null));};exports['update']=function(_0x9560f,_0x212056){if(_0x9560f[_0x8dff('0x47')]['id']){delete _0x9560f[_0x8dff('0x47')]['id'];}return db['CmCustomField'][_0x8dff('0x46')]({'where':{'id':_0x9560f[_0x8dff('0x48')]['id']}})[_0x8dff('0x24')](handleEntityNotFound(_0x212056,null))['then'](saveUpdates(_0x9560f[_0x8dff('0x47')],null))[_0x8dff('0x24')](respondWithResult(_0x212056,null))['catch'](handleError(_0x212056,null));};exports['destroy']=function(_0x4d3e25,_0x3a9b69){return db[_0x8dff('0x2b')][_0x8dff('0x46')]({'where':{'id':_0x4d3e25[_0x8dff('0x48')]['id']}})[_0x8dff('0x24')](handleEntityNotFound(_0x3a9b69,null))[_0x8dff('0x24')](removeEntity(_0x3a9b69,null))[_0x8dff('0x44')](handleError(_0x3a9b69,null));};exports[_0x8dff('0x49')]=function(_0x2eb508,_0x45f3b6){var _0x292392;return db[_0x8dff('0x4a')][_0x8dff('0x4b')](function(_0x2236cf){return db[_0x8dff('0x2b')][_0x8dff('0x49')](_0x2eb508[_0x8dff('0x47')],{'transaction':_0x2236cf})[_0x8dff('0x24')](function(_0x135bdc){_0x292392=_0x135bdc;var _0x1c634e={'type':db['Sequelize']['TEXT'],'transaction':_0x2236cf};switch(_0x2eb508[_0x8dff('0x47')][_0x8dff('0x2d')]){case'text':_0x1c634e[_0x8dff('0x2d')]=db[_0x8dff('0x4c')][_0x8dff('0x4d')];break;case'number':_0x1c634e[_0x8dff('0x2d')]=db[_0x8dff('0x4c')][_0x8dff('0x4e')];break;case _0x8dff('0x4f'):_0x1c634e[_0x8dff('0x2d')]=db[_0x8dff('0x4c')][_0x8dff('0x50')];_0x1c634e[_0x8dff('0x51')]=![];break;default:}return db['sequelize'][_0x8dff('0x52')][_0x8dff('0x53')](_0x8dff('0x54'),util[_0x8dff('0x55')](_0x8dff('0x56'),_0x292392['id']),_0x1c634e);})['then'](function(){return _0x292392;});})[_0x8dff('0x24')](respondWithResult(_0x45f3b6,0xc9))[_0x8dff('0x44')](handleError(_0x45f3b6,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 820d936..d4945c9 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 _0xa2d9=['cm_custom_fields','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x34aa1b,_0x477610){var _0x4cff5f=function(_0x5bdd0b){while(--_0x5bdd0b){_0x34aa1b['push'](_0x34aa1b['shift']());}};_0x4cff5f(++_0x477610);}(_0xa2d9,0x1cc));var _0x9a2d=function(_0xbd322c,_0x9fdee2){_0xbd322c=_0xbd322c-0x0;var _0x42787=_0xa2d9[_0xbd322c];return _0x42787;};'use strict';var _=require('lodash');var util=require(_0x9a2d('0x0'));var logger=require(_0x9a2d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9a2d('0x2'));var rp=require(_0x9a2d('0x3'));var fs=require('fs');var path=require(_0x9a2d('0x4'));var rimraf=require(_0x9a2d('0x5'));var config=require(_0x9a2d('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x9a2d('0x7')]=function(_0x105739,_0x35e6ca){return _0x105739['define']('CmCustomField',attributes,{'tableName':_0x9a2d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x406f=['path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x406f,0x6f));var _0xf406=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x406f[_0x369151];return _0x4292d5;};'use strict';var _=require(_0xf406('0x0'));var util=require(_0xf406('0x1'));var logger=require('../../config/logger')(_0xf406('0x2'));var moment=require(_0xf406('0x3'));var BPromise=require(_0xf406('0x4'));var rp=require(_0xf406('0x5'));var fs=require('fs');var path=require(_0xf406('0x6'));var rimraf=require(_0xf406('0x7'));var config=require('../../config/environment');var attributes=require(_0xf406('0x8'));module[_0xf406('0x9')]=function(_0x4e90b9,_0x432bed){return _0x4e90b9[_0xf406('0xa')](_0xf406('0xb'),attributes,{'tableName':_0xf406('0xc'),'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 6f65e6b..7d1bc86 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 _0x68fc=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe7bac4,_0x399013){var _0x4a37c3=function(_0x3bc03e){while(--_0x3bc03e){_0xe7bac4['push'](_0xe7bac4['shift']());}};_0x4a37c3(++_0x399013);}(_0x68fc,0xa5));var _0xc68f=function(_0x2afad6,_0xef5538){_0x2afad6=_0x2afad6-0x0;var _0x5a0acd=_0x68fc[_0x2afad6];return _0x5a0acd;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc68f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc68f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc68f('0x5'));var jayson=require(_0xc68f('0x6'));var client=jayson[_0xc68f('0x7')][_0xc68f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcce4,_0x4a6f7d,_0x9f2705){return new BPromise(function(_0x2bf3fd,_0x370977){return client[_0xc68f('0x9')](_0x4fcce4,_0x9f2705)[_0xc68f('0xa')](function(_0x1ee022){logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));logger[_0xc68f('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4a6f7d,_0xc68f('0xd'),JSON[_0xc68f('0xf')](_0x1ee022));if(_0x1ee022[_0xc68f('0x10')]){if(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x11')]===0x1f4){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x370977(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}logger['error'](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x2bf3fd(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}else{logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));_0x2bf3fd(_0x1ee022[_0xc68f('0x13')]['message']);}})['catch'](function(_0x3a6c06){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x3a6c06);_0x370977(_0x3a6c06);});});} \ No newline at end of file +var _0xbb53=['http','then','info','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbb53,0x121));var _0x3bb5=function(_0x4528fa,_0x1dec7e){_0x4528fa=_0x4528fa-0x0;var _0xc3a18c=_0xbb53[_0x4528fa];return _0xc3a18c;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 074b15f..8472822 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 _0xb8e0=['/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xb8e0,0xfe));var _0x0b8e=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xb8e0[_0x2459fd];return _0x364cd2;};'use strict';var multer=require(_0x0b8e('0x0'));var util=require(_0x0b8e('0x1'));var path=require(_0x0b8e('0x2'));var timeout=require(_0x0b8e('0x3'));var express=require(_0x0b8e('0x4'));var router=express[_0x0b8e('0x5')]();var auth=require(_0x0b8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b8e('0x7'));var controller=require(_0x0b8e('0x8'));router['get']('/',auth[_0x0b8e('0x9')](),controller[_0x0b8e('0xa')]);router[_0x0b8e('0xb')](_0x0b8e('0xc'),auth[_0x0b8e('0x9')](),controller[_0x0b8e('0xd')]);router[_0x0b8e('0xe')]('/',auth[_0x0b8e('0x9')](),controller[_0x0b8e('0xf')]);router['put'](_0x0b8e('0xc'),auth['isAuthenticated'](),controller[_0x0b8e('0x10')]);router[_0x0b8e('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0b8e('0x12')]=router; \ No newline at end of file +var _0x3cb6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','get','show','create','/:id','update','delete','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3cb6,0x7e));var _0x63cb=function(_0x1d5d2f,_0x16487a){_0x1d5d2f=_0x1d5d2f-0x0;var _0x23ac0a=_0x3cb6[_0x1d5d2f];return _0x23ac0a;};'use strict';var multer=require(_0x63cb('0x0'));var util=require(_0x63cb('0x1'));var path=require(_0x63cb('0x2'));var timeout=require(_0x63cb('0x3'));var express=require(_0x63cb('0x4'));var router=express[_0x63cb('0x5')]();var auth=require(_0x63cb('0x6'));var interaction=require(_0x63cb('0x7'));var config=require('../../config/environment');var controller=require(_0x63cb('0x8'));router['get']('/',auth[_0x63cb('0x9')](),controller['index']);router[_0x63cb('0xa')]('/:id',auth[_0x63cb('0x9')](),controller[_0x63cb('0xb')]);router['post']('/',auth[_0x63cb('0x9')](),controller[_0x63cb('0xc')]);router['put'](_0x63cb('0xd'),auth['isAuthenticated'](),controller[_0x63cb('0xe')]);router[_0x63cb('0xf')](_0x63cb('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ec3028f..cfae092 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 _0x5334=['STRING','BOOLEAN','format','INTEGER','DATE','contactListQueue','moment','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5334,0x84));var _0x4533=function(_0x4d0e7b,_0x621f88){_0x4d0e7b=_0x4d0e7b-0x0;var _0x4d9359=_0x5334[_0x4d0e7b];return _0x4d9359;};'use strict';var moment=require(_0x4533('0x0'));var Sequelize=require(_0x4533('0x1'));module[_0x4533('0x2')]={'phone':{'type':Sequelize[_0x4533('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4533('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4533('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4533('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4533('0x6')],'unique':_0x4533('0x8')},'ListId':{'type':Sequelize[_0x4533('0x6')],'unique':_0x4533('0x8')},'UserId':{'type':Sequelize[_0x4533('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x4533('0x6')],'unique':_0x4533('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4533('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd59=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x1e0fd7,_0x43a6cd){var _0x3255a0=function(_0xd8fed4){while(--_0xd8fed4){_0x1e0fd7['push'](_0x1e0fd7['shift']());}};_0x3255a0(++_0x43a6cd);}(_0xcd59,0x14b));var _0x9cd5=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0xcd59[_0x67b075];return _0x39d030;};'use strict';var moment=require(_0x9cd5('0x0'));var Sequelize=require(_0x9cd5('0x1'));module[_0x9cd5('0x2')]={'phone':{'type':Sequelize[_0x9cd5('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':moment()['format'](_0x9cd5('0x6'))},'countbusyretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9cd5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9cd5('0x5')]},'priority':{'type':Sequelize[_0x9cd5('0x7')](0x2)[_0x9cd5('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9cd5('0x9')},'ListId':{'type':Sequelize[_0x9cd5('0x7')],'unique':_0x9cd5('0x9')},'UserId':{'type':Sequelize[_0x9cd5('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9cd5('0x7')],'unique':_0x9cd5('0x9')},'CampaignId':{'type':Sequelize[_0x9cd5('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b83584b..2f8c8f2 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 _0x4959=['VoiceQueue','Queue','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$or','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','describe','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','phone','campaigntype','queue','CmContact','find','firstName','lastName','calleridname','isNil','finally','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmList','List'];(function(_0x4e7844,_0x30ce77){var _0x336119=function(_0x508b1c){while(--_0x508b1c){_0x4e7844['push'](_0x4e7844['shift']());}};_0x336119(++_0x30ce77);}(_0x4959,0x9b));var _0x9495=function(_0x216fd3,_0x162625){_0x216fd3=_0x216fd3-0x0;var _0x48d300=_0x4959[_0x216fd3];return _0x48d300;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9495('0x0'));var zipdir=require(_0x9495('0x1'));var jsonpatch=require(_0x9495('0x2'));var rp=require('request-promise');var moment=require(_0x9495('0x3'));var BPromise=require(_0x9495('0x4'));var Mustache=require(_0x9495('0x5'));var util=require(_0x9495('0x6'));var path=require('path');var sox=require(_0x9495('0x7'));var csv=require(_0x9495('0x8'));var ejs=require(_0x9495('0x9'));var fs=require('fs');var _=require(_0x9495('0xa'));var squel=require(_0x9495('0xb'));var crypto=require(_0x9495('0xc'));var jsforce=require(_0x9495('0xd'));var deskjs=require(_0x9495('0xe'));var toCsv=require(_0x9495('0x8'));var querystring=require(_0x9495('0xf'));var Papa=require(_0x9495('0x10'));var Redis=require('ioredis');var authService=require(_0x9495('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9495('0x12'));var utils=require(_0x9495('0x13'));var config=require(_0x9495('0x14'));var licenseUtil=require(_0x9495('0x15'));var db=require(_0x9495('0x16'))['db'];function respondWithStatusCode(_0x26ba0e,_0x170d6c){_0x170d6c=_0x170d6c||0xcc;return function(_0xcb593d){if(_0xcb593d){return _0x26ba0e[_0x9495('0x17')](_0x170d6c);}return _0x26ba0e[_0x9495('0x18')](_0x170d6c)[_0x9495('0x19')]();};}function respondWithResult(_0xa2a8e5,_0x3ab519){_0x3ab519=_0x3ab519||0xc8;return function(_0xf7e975){if(_0xf7e975){return _0xa2a8e5[_0x9495('0x18')](_0x3ab519)[_0x9495('0x1a')](_0xf7e975);}};}function respondWithFilteredResult(_0x583db3,_0x436769){return function(_0x17d951){if(_0x17d951){var _0x3cf201=_0x17d951[_0x9495('0x1b')],_0xcfc1e8=_0x436769[_0x9495('0x1c')],_0x1e2c6c=_0x436769[_0x9495('0x1c')]+_0x436769[_0x9495('0x1d')],_0x4c1d9d;if(_0x1e2c6c>=_0x3cf201){_0x1e2c6c=_0x3cf201;_0x4c1d9d=0xc8;}else{_0x4c1d9d=0xce;}_0x583db3[_0x9495('0x18')](_0x4c1d9d);return _0x583db3['set'](_0x9495('0x1e'),_0xcfc1e8+'-'+_0x1e2c6c+'/'+_0x3cf201)[_0x9495('0x1a')](_0x17d951);}return null;};}function patchUpdates(_0x56274d){return function(_0x4c80ef){try{jsonpatch['apply'](_0x4c80ef,_0x56274d,!![]);}catch(_0x4c0369){return BPromise[_0x9495('0x1f')](_0x4c0369);}return _0x4c80ef[_0x9495('0x20')]();};}function saveUpdates(_0x95e617,_0x1ca75b){return function(_0x38207a){if(_0x38207a){return _0x38207a[_0x9495('0x21')](_0x95e617)[_0x9495('0x22')](function(_0x8a990e){return _0x8a990e;});}return null;};}function removeEntity(_0xe9d143,_0x4053bb){return function(_0x4acbaa){if(_0x4acbaa){return _0x4acbaa[_0x9495('0x23')]()[_0x9495('0x22')](function(){_0xe9d143[_0x9495('0x18')](0xcc)[_0x9495('0x19')]();});}};}function handleEntityNotFound(_0x40d9d1,_0x8fa430){return function(_0xf3bf59){if(!_0xf3bf59){_0x40d9d1[_0x9495('0x17')](0x194);}return _0xf3bf59;};}function handleError(_0x4087d9,_0x5751c4){_0x5751c4=_0x5751c4||0x1f4;return function(_0x224e5e){logger[_0x9495('0x24')](_0x224e5e[_0x9495('0x25')]);if(_0x224e5e[_0x9495('0x26')]){delete _0x224e5e[_0x9495('0x26')];}_0x4087d9[_0x9495('0x18')](_0x5751c4)[_0x9495('0x27')](_0x224e5e);};}exports[_0x9495('0x28')]=function(_0x535e24,_0xea3162){var _0x13b1b6={},_0x2438db={},_0x23b5e7={'count':0x0,'rows':[]};var _0x5ee329=_[_0x9495('0x29')](db[_0x9495('0x2a')][_0x9495('0x2b')],function(_0x5f3d6e){return{'name':_0x5f3d6e[_0x9495('0x2c')],'type':_0x5f3d6e[_0x9495('0x2d')][_0x9495('0x2e')]};});_0x2438db[_0x9495('0x2f')]=_[_0x9495('0x29')](_0x5ee329,_0x9495('0x26'));_0x2438db[_0x9495('0x30')]=_['keys'](_0x535e24[_0x9495('0x30')]);_0x2438db[_0x9495('0x31')]=_[_0x9495('0x32')](_0x2438db[_0x9495('0x2f')],_0x2438db[_0x9495('0x30')]);_0x2438db[_0x9495('0x31')]=_[_0x9495('0x33')](_0x2438db[_0x9495('0x31')],['$and',_0x9495('0x34'),'$gt','$gte','$lt',_0x9495('0x35'),_0x9495('0x36'),_0x9495('0x37'),_0x9495('0x38'),_0x9495('0x39'),_0x9495('0x3a'),_0x9495('0x3b'),_0x9495('0x3c'),_0x9495('0x3d'),_0x9495('0x3e'),_0x9495('0x3f'),_0x9495('0x40'),_0x9495('0x3d'),'$overlap',_0x9495('0x41'),_0x9495('0x42'),_0x9495('0x43')]);_0x13b1b6[_0x9495('0x44')]=_[_0x9495('0x32')](_0x2438db[_0x9495('0x2f')],qs[_0x9495('0x45')](_0x535e24['query']['fields']));_0x13b1b6[_0x9495('0x44')]=_0x13b1b6[_0x9495('0x44')]['length']?_0x13b1b6[_0x9495('0x44')]:_0x2438db[_0x9495('0x2f')];if(!_0x535e24['query'][_0x9495('0x46')](_0x9495('0x47'))){_0x13b1b6['limit']=qs[_0x9495('0x1d')](_0x535e24[_0x9495('0x30')][_0x9495('0x1d')]);_0x13b1b6['offset']=qs[_0x9495('0x1c')](_0x535e24[_0x9495('0x30')][_0x9495('0x1c')]);}_0x13b1b6[_0x9495('0x48')]=qs[_0x9495('0x49')](_0x535e24[_0x9495('0x30')]['sort']);_0x13b1b6[_0x9495('0x4a')]=qs[_0x9495('0x31')](_[_0x9495('0x4b')](_0x535e24['query'],_0x2438db[_0x9495('0x31')]),_0x5ee329);if(_0x535e24[_0x9495('0x30')][_0x9495('0x4c')]){_0x13b1b6[_0x9495('0x4a')]=_[_0x9495('0x4d')](_0x13b1b6[_0x9495('0x4a')],{'$or':_[_0x9495('0x29')](_0x5ee329,function(_0x39d787){if(_0x39d787['type']!==_0x9495('0x4e')){var _0x2e525b={};_0x2e525b[_0x39d787[_0x9495('0x26')]]={'$like':'%'+_0x535e24['query'][_0x9495('0x4c')]+'%'};return _0x2e525b;}})});}_0x13b1b6=_[_0x9495('0x4d')]({},_0x13b1b6,_0x535e24[_0x9495('0x4f')]);var _0x3e2312={'where':_0x13b1b6['where']};return db[_0x9495('0x2a')][_0x9495('0x1b')](_0x3e2312)[_0x9495('0x22')](function(_0x31e0fd){_0x23b5e7[_0x9495('0x1b')]=_0x31e0fd;if(_0x535e24[_0x9495('0x30')][_0x9495('0x50')]){_0x13b1b6[_0x9495('0x51')]=[{'all':!![]}];}return db[_0x9495('0x2a')][_0x9495('0x52')](_0x13b1b6);})['then'](function(_0x1ca1b3){_0x23b5e7[_0x9495('0x53')]=_0x1ca1b3;return _0x23b5e7;})[_0x9495('0x22')](respondWithFilteredResult(_0xea3162,_0x13b1b6))[_0x9495('0x54')](handleError(_0xea3162,null));};exports[_0x9495('0x55')]=function(_0x5255c2,_0x14487e){var _0x3abc39={'raw':!![],'where':{'id':_0x5255c2[_0x9495('0x56')]['id']}},_0x7523e5={};_0x7523e5[_0x9495('0x2f')]=_['keys'](db[_0x9495('0x2a')][_0x9495('0x2b')]);_0x7523e5['query']=_[_0x9495('0x57')](_0x5255c2[_0x9495('0x30')]);_0x7523e5['filters']=_['intersection'](_0x7523e5['model'],_0x7523e5['query']);_0x3abc39[_0x9495('0x44')]=_[_0x9495('0x32')](_0x7523e5[_0x9495('0x2f')],qs[_0x9495('0x45')](_0x5255c2[_0x9495('0x30')][_0x9495('0x45')]));_0x3abc39[_0x9495('0x44')]=_0x3abc39['attributes'][_0x9495('0x58')]?_0x3abc39[_0x9495('0x44')]:_0x7523e5[_0x9495('0x2f')];if(_0x5255c2[_0x9495('0x30')]['includeAll']){_0x3abc39[_0x9495('0x51')]=[{'all':!![]}];}_0x3abc39=_['merge']({},_0x3abc39,_0x5255c2[_0x9495('0x4f')]);return db[_0x9495('0x2a')]['find'](_0x3abc39)['then'](handleEntityNotFound(_0x14487e,null))[_0x9495('0x22')](respondWithResult(_0x14487e,null))[_0x9495('0x54')](handleError(_0x14487e,null));};exports['create']=function(_0x14a53c,_0x1bcc78){return db[_0x9495('0x2a')][_0x9495('0x59')](_0x14a53c['body'],{})['then'](respondWithResult(_0x1bcc78,0xc9))['catch'](handleError(_0x1bcc78,null));};exports[_0x9495('0x21')]=function(_0x4495aa,_0x3cd68e){if(_0x4495aa[_0x9495('0x5a')]['id']){delete _0x4495aa[_0x9495('0x5a')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x4495aa[_0x9495('0x56')]['id']}})['then'](handleEntityNotFound(_0x3cd68e,null))[_0x9495('0x22')](saveUpdates(_0x4495aa[_0x9495('0x5a')],null))[_0x9495('0x22')](respondWithResult(_0x3cd68e,null))[_0x9495('0x54')](handleError(_0x3cd68e,null));};exports['describe']=function(_0x2e519f,_0x148b29){return db[_0x9495('0x2a')][_0x9495('0x5b')]()[_0x9495('0x22')](respondWithResult(_0x148b29,null))['catch'](handleError(_0x148b29,null));};exports['destroy']=function(_0x580a8d,_0x3f5dc0){var _0x28aff7;return db['CmHopper']['find']({'where':{'id':_0x580a8d[_0x9495('0x56')]['id']}})[_0x9495('0x22')](handleEntityNotFound(_0x3f5dc0,null))['then'](function(_0x575a06){if(_0x575a06){return _0x575a06['destroy']()[_0x9495('0x22')](function(_0x16ae15){return _0x16ae15;});}})[_0x9495('0x22')](function(_0x4fe0e5){_0x28aff7=_0x4fe0e5;if(_0x4fe0e5){if(_0x4fe0e5[_0x9495('0x5c')]||_0x4fe0e5[_0x9495('0x5d')]){return db[_0x4fe0e5[_0x9495('0x5c')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x4fe0e5[_0x9495('0x5c')]?_0x4fe0e5[_0x9495('0x5c')]:_0x4fe0e5['CampaignId']},'attributes':['id',_0x9495('0x26')],'raw':!![]});}}})[_0x9495('0x22')](function(_0x1b17cf){var _0x4e9173={};if(_0x1b17cf){_[_0x9495('0x4d')](_0x4e9173,_[_0x9495('0x5e')](_0x28aff7[_0x9495('0x5f')],[_0x9495('0x60'),_0x9495('0x61'),'id']));_0x4e9173[_0x9495('0x62')]=0x15;_0x4e9173[_0x9495('0x63')]=_0x9495('0x64');_0x4e9173[_0x9495('0x65')]=_0x1b17cf[_0x9495('0x26')];_0x4e9173[_0x9495('0x66')]=_0x580a8d[_0x9495('0x67')][_0x9495('0x26')];_0x4e9173[_0x9495('0x68')]=_0x580a8d[_0x9495('0x67')]['id'];_0x4e9173[_0x9495('0x64')]=!![];_0x4e9173[_0x9495('0x69')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4e9173[_0x9495('0x6a')]=_0x28aff7[_0x9495('0x6b')];_0x4e9173[_0x9495('0x6c')]=_0x28aff7[_0x9495('0x5c')]?_0x9495('0x6d'):'ivr';return db[_0x9495('0x6e')][_0x9495('0x6f')]({'where':{'id':_0x4e9173['ContactId']},'attributes':[_0x9495('0x70'),_0x9495('0x71')]})['then'](function(_0x5d8a9b){if(!_['isNil'](_0x3f5dc0)&&!_['isNil'](_0x5d8a9b[_0x9495('0x70')])){_0x4e9173[_0x9495('0x72')]=_0x5d8a9b[_0x9495('0x70')];if(!_[_0x9495('0x73')](_0x5d8a9b[_0x9495('0x71')])){_0x4e9173['calleridname']+='\x20'+_0x5d8a9b[_0x9495('0x71')];}}})[_0x9495('0x74')](function(){return db['CmHopperFinal'][_0x9495('0x59')](_0x4e9173);});}})[_0x9495('0x22')](function(){return _0x3f5dc0[_0x9495('0x18')](0xcc)[_0x9495('0x19')]();})[_0x9495('0x54')](handleError(_0x3f5dc0,null));};exports[_0x9495('0x75')]=function(_0x35b925,_0x561592,_0xe948c9){var _0x30a886=[];return db['CmContact'][_0x9495('0x5b')]()[_0x9495('0x22')](function(_0x272eb5){_0x30a886=_[_0x9495('0x57')](_0x272eb5);return _0x35b925[_0x9495('0x67')]['getVoiceQueues']({'where':{'type':_0x9495('0x76'),'dialActive':!![],'dialMethod':_0x9495('0x77')},'attributes':['id',_0x9495('0x78')],'raw':!![]});})[_0x9495('0x22')](function(_0x1d3157){if(_0x1d3157&&_0x1d3157[_0x9495('0x58')]){return db[_0x9495('0x79')][_0x9495('0x7a')](function(_0x505794){var _0x35d547={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9495('0x7b')](_0x9495('0x7c'))},'VoiceQueueId':{'$in':_['map'](_0x1d3157,'id')},'$or':[{'UserId':null},{'UserId':_0x35b925[_0x9495('0x67')]['id']}]};var _0x52a5f2=[];if(_0x35b925[_0x9495('0x5a')][_0x9495('0x7d')]&&_0x35b925['body'][_0x9495('0x7d')]===_0x9495('0x7e')){if(!_[_0x9495('0x7f')](_0x35b925[_0x9495('0x5a')][_0x9495('0x80')])){_0x35d547['id']={'$in':_0x35b925[_0x9495('0x5a')][_0x9495('0x80')]};}_0x52a5f2=[[_0x9495('0x81'),_0x9495('0x82')],[_0x9495('0x83'),_0x1d3157[0x0][_0x9495('0x78')]==='ASC'?_0x9495('0x84'):'ASC'],db[_0x9495('0x79')][_0x9495('0x85')](_0x9495('0x86')),['id',_0x9495('0x84')]];}else{if(!_['isEmpty'](_0x35b925[_0x9495('0x5a')][_0x9495('0x80')])){_0x35d547['id']={'$notIn':_0x35b925[_0x9495('0x5a')][_0x9495('0x80')]};}_0x52a5f2=[[_0x9495('0x81'),_0x9495('0x84')],[_0x9495('0x83'),_0x1d3157[0x0]['dialOrderByScheduledAt']],db[_0x9495('0x79')][_0x9495('0x85')](_0x9495('0x87')),['id',_0x9495('0x82')]];}return db[_0x9495('0x2a')][_0x9495('0x88')]({'attributes':['id',_0x9495('0x89')],'where':_0x35d547,'order':_0x52a5f2,'transaction':_0x505794,'lock':_0x505794[_0x9495('0x8a')][_0x9495('0x8b')],'include':[{'model':db[_0x9495('0x6e')],'as':_0x9495('0x8c'),'attributes':_0x30a886,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x9495('0x26')]}]},{'model':db[_0x9495('0x8d')],'as':_0x9495('0x8e'),'attributes':['id',_0x9495('0x26')]},{'model':db[_0x9495('0x8f')],'as':_0x9495('0x90'),'attributes':['id',_0x9495('0x26'),'dialActive']}]})[_0x9495('0x22')](function(_0x5cdcd2){if(_0x5cdcd2){return _0x5cdcd2['update']({'UserId':_0x35b925[_0x9495('0x67')]['id']},{'transaction':_0x505794});}});});}})['then'](handleEntityNotFound(_0x561592,null))[_0x9495('0x22')](respondWithResult(_0x561592,null))['catch'](handleError(_0x561592,null));};exports[_0x9495('0x91')]=function(_0x32e5f3,_0x3a39af,_0x4ed0da){return _0x32e5f3[_0x9495('0x67')][_0x9495('0x92')]({'where':{'type':_0x9495('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x9495('0x22')](function(_0x455feb){if(_0x455feb&&_0x455feb[_0x9495('0x58')]){return db[_0x9495('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9495('0x7b')](_0x9495('0x7c'))},'VoiceQueueId':{'$in':_[_0x9495('0x29')](_0x455feb,'id')},'$or':[{'UserId':null},{'UserId':_0x32e5f3[_0x9495('0x67')]['id']}]}});}return 0x0;})[_0x9495('0x22')](function(_0x240042){if(!_[_0x9495('0x73')](_0x240042)&&_['isNumber'](_0x240042)){return _0x3a39af[_0x9495('0x18')](0xc8)[_0x9495('0x1a')]({'contacts':_0x240042});}else{logger[_0x9495('0x24')](_0x9495('0x93'),'getOpenContacts',0x194,_0x9495('0x94'));_0x3a39af[_0x9495('0x17')](0x194);}})['catch'](handleError(_0x3a39af,null));}; \ No newline at end of file +var _0xce3a=['keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','count','findAll','catch','show','params','includeAll','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','length','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','CmCompany','Company','CmList','List','Queue','dialActive','update','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','destroy','then','error','name','send','index','map','fieldName','type','key','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce3a,0x194));var _0xace3=function(_0x27d252,_0x5d146b){_0x27d252=_0x27d252-0x0;var _0x50c113=_0xce3a[_0x27d252];return _0x50c113;};'use strict';var pdf=require(_0xace3('0x0'));var emlformat=require(_0xace3('0x1'));var rimraf=require(_0xace3('0x2'));var zipdir=require(_0xace3('0x3'));var jsonpatch=require(_0xace3('0x4'));var rp=require(_0xace3('0x5'));var moment=require(_0xace3('0x6'));var BPromise=require(_0xace3('0x7'));var Mustache=require(_0xace3('0x8'));var util=require(_0xace3('0x9'));var path=require(_0xace3('0xa'));var sox=require(_0xace3('0xb'));var csv=require('to-csv');var ejs=require(_0xace3('0xc'));var fs=require('fs');var _=require(_0xace3('0xd'));var squel=require(_0xace3('0xe'));var crypto=require(_0xace3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xace3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xace3('0x11'));var Papa=require(_0xace3('0x12'));var Redis=require(_0xace3('0x13'));var authService=require(_0xace3('0x14'));var qs=require(_0xace3('0x15'));var as=require(_0xace3('0x16'));var hardwareService=require(_0xace3('0x17'));var logger=require(_0xace3('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xace3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be1f1,_0x3566ad){_0x3566ad=_0x3566ad||0xcc;return function(_0x5ac505){if(_0x5ac505){return _0x4be1f1[_0xace3('0x1a')](_0x3566ad);}return _0x4be1f1['status'](_0x3566ad)[_0xace3('0x1b')]();};}function respondWithResult(_0x19dc11,_0x16ef3e){_0x16ef3e=_0x16ef3e||0xc8;return function(_0x5983b9){if(_0x5983b9){return _0x19dc11[_0xace3('0x1c')](_0x16ef3e)[_0xace3('0x1d')](_0x5983b9);}};}function respondWithFilteredResult(_0x1cfa39,_0x54ec35){return function(_0x51ed6c){if(_0x51ed6c){var _0x1ad5c0=_0x51ed6c['count'],_0x2e48eb=_0x54ec35[_0xace3('0x1e')],_0x3e426b=_0x54ec35[_0xace3('0x1e')]+_0x54ec35[_0xace3('0x1f')],_0x142bb6;if(_0x3e426b>=_0x1ad5c0){_0x3e426b=_0x1ad5c0;_0x142bb6=0xc8;}else{_0x142bb6=0xce;}_0x1cfa39[_0xace3('0x1c')](_0x142bb6);return _0x1cfa39[_0xace3('0x20')](_0xace3('0x21'),_0x2e48eb+'-'+_0x3e426b+'/'+_0x1ad5c0)['json'](_0x51ed6c);}return null;};}function patchUpdates(_0x57d08e){return function(_0x2ee18d){try{jsonpatch['apply'](_0x2ee18d,_0x57d08e,!![]);}catch(_0x1f0c42){return BPromise[_0xace3('0x22')](_0x1f0c42);}return _0x2ee18d['save']();};}function saveUpdates(_0xab91f7,_0x16f406){return function(_0x542c37){if(_0x542c37){return _0x542c37['update'](_0xab91f7)['then'](function(_0x1df41f){return _0x1df41f;});}return null;};}function removeEntity(_0x1ed5fe,_0x3bbe41){return function(_0x34a7a5){if(_0x34a7a5){return _0x34a7a5[_0xace3('0x23')]()[_0xace3('0x24')](function(){_0x1ed5fe[_0xace3('0x1c')](0xcc)[_0xace3('0x1b')]();});}};}function handleEntityNotFound(_0x5a4c02,_0x5980fe){return function(_0x5e9d6a){if(!_0x5e9d6a){_0x5a4c02['sendStatus'](0x194);}return _0x5e9d6a;};}function handleError(_0x46a155,_0x3fadd4){_0x3fadd4=_0x3fadd4||0x1f4;return function(_0x2c137d){logger[_0xace3('0x25')](_0x2c137d['stack']);if(_0x2c137d[_0xace3('0x26')]){delete _0x2c137d[_0xace3('0x26')];}_0x46a155[_0xace3('0x1c')](_0x3fadd4)[_0xace3('0x27')](_0x2c137d);};}exports[_0xace3('0x28')]=function(_0x3d1231,_0x3aabeb){var _0x56c992={},_0x1a1d73={},_0x2f672a={'count':0x0,'rows':[]};var _0x4443b8=_[_0xace3('0x29')](db['CmHopper']['rawAttributes'],function(_0x3b1ad1){return{'name':_0x3b1ad1[_0xace3('0x2a')],'type':_0x3b1ad1[_0xace3('0x2b')][_0xace3('0x2c')]};});_0x1a1d73['model']=_[_0xace3('0x29')](_0x4443b8,_0xace3('0x26'));_0x1a1d73[_0xace3('0x2d')]=_[_0xace3('0x2e')](_0x3d1231[_0xace3('0x2d')]);_0x1a1d73[_0xace3('0x2f')]=_[_0xace3('0x30')](_0x1a1d73['model'],_0x1a1d73['query']);_0x1a1d73[_0xace3('0x2f')]=_[_0xace3('0x31')](_0x1a1d73[_0xace3('0x2f')],[_0xace3('0x32'),_0xace3('0x33'),_0xace3('0x34'),_0xace3('0x35'),_0xace3('0x36'),_0xace3('0x37'),_0xace3('0x38'),_0xace3('0x39'),_0xace3('0x3a'),_0xace3('0x3b'),_0xace3('0x3c'),_0xace3('0x3d'),_0xace3('0x3e'),'$like',_0xace3('0x3f'),_0xace3('0x40'),_0xace3('0x41'),_0xace3('0x42'),_0xace3('0x43'),_0xace3('0x44'),_0xace3('0x45'),_0xace3('0x46')]);_0x56c992[_0xace3('0x47')]=_['intersection'](_0x1a1d73[_0xace3('0x48')],qs[_0xace3('0x49')](_0x3d1231[_0xace3('0x2d')][_0xace3('0x49')]));_0x56c992['attributes']=_0x56c992['attributes']['length']?_0x56c992['attributes']:_0x1a1d73[_0xace3('0x48')];if(!_0x3d1231[_0xace3('0x2d')]['hasOwnProperty'](_0xace3('0x4a'))){_0x56c992['limit']=qs['limit'](_0x3d1231[_0xace3('0x2d')][_0xace3('0x1f')]);_0x56c992[_0xace3('0x1e')]=qs[_0xace3('0x1e')](_0x3d1231['query'][_0xace3('0x1e')]);}_0x56c992[_0xace3('0x4b')]=qs[_0xace3('0x4c')](_0x3d1231['query'][_0xace3('0x4c')]);_0x56c992[_0xace3('0x4d')]=qs[_0xace3('0x2f')](_[_0xace3('0x4e')](_0x3d1231[_0xace3('0x2d')],_0x1a1d73[_0xace3('0x2f')]),_0x4443b8);if(_0x3d1231[_0xace3('0x2d')][_0xace3('0x4f')]){_0x56c992['where']=_[_0xace3('0x50')](_0x56c992[_0xace3('0x4d')],{'$or':_[_0xace3('0x29')](_0x4443b8,function(_0x5be0df){if(_0x5be0df[_0xace3('0x2b')]!==_0xace3('0x51')){var _0x19ef40={};_0x19ef40[_0x5be0df[_0xace3('0x26')]]={'$like':'%'+_0x3d1231[_0xace3('0x2d')]['filter']+'%'};return _0x19ef40;}})});}_0x56c992=_['merge']({},_0x56c992,_0x3d1231['options']);var _0xad4d5e={'where':_0x56c992[_0xace3('0x4d')]};return db[_0xace3('0x52')][_0xace3('0x53')](_0xad4d5e)[_0xace3('0x24')](function(_0x3b8a7d){_0x2f672a[_0xace3('0x53')]=_0x3b8a7d;if(_0x3d1231[_0xace3('0x2d')]['includeAll']){_0x56c992['include']=[{'all':!![]}];}return db[_0xace3('0x52')][_0xace3('0x54')](_0x56c992);})[_0xace3('0x24')](function(_0x567c1c){_0x2f672a['rows']=_0x567c1c;return _0x2f672a;})[_0xace3('0x24')](respondWithFilteredResult(_0x3aabeb,_0x56c992))[_0xace3('0x55')](handleError(_0x3aabeb,null));};exports[_0xace3('0x56')]=function(_0x56ac3e,_0x57808f){var _0x60968f={'raw':!![],'where':{'id':_0x56ac3e[_0xace3('0x57')]['id']}},_0x2a6a0b={};_0x2a6a0b['model']=_[_0xace3('0x2e')](db[_0xace3('0x52')]['rawAttributes']);_0x2a6a0b[_0xace3('0x2d')]=_[_0xace3('0x2e')](_0x56ac3e[_0xace3('0x2d')]);_0x2a6a0b[_0xace3('0x2f')]=_[_0xace3('0x30')](_0x2a6a0b[_0xace3('0x48')],_0x2a6a0b[_0xace3('0x2d')]);_0x60968f[_0xace3('0x47')]=_[_0xace3('0x30')](_0x2a6a0b[_0xace3('0x48')],qs[_0xace3('0x49')](_0x56ac3e['query'][_0xace3('0x49')]));_0x60968f['attributes']=_0x60968f[_0xace3('0x47')]['length']?_0x60968f[_0xace3('0x47')]:_0x2a6a0b['model'];if(_0x56ac3e['query'][_0xace3('0x58')]){_0x60968f['include']=[{'all':!![]}];}_0x60968f=_['merge']({},_0x60968f,_0x56ac3e[_0xace3('0x59')]);return db[_0xace3('0x52')][_0xace3('0x5a')](_0x60968f)[_0xace3('0x24')](handleEntityNotFound(_0x57808f,null))['then'](respondWithResult(_0x57808f,null))[_0xace3('0x55')](handleError(_0x57808f,null));};exports[_0xace3('0x5b')]=function(_0x4b9fb5,_0x558123){return db[_0xace3('0x52')][_0xace3('0x5b')](_0x4b9fb5[_0xace3('0x5c')],{})[_0xace3('0x24')](respondWithResult(_0x558123,0xc9))[_0xace3('0x55')](handleError(_0x558123,null));};exports['update']=function(_0x11d5f5,_0x4f36e4){if(_0x11d5f5[_0xace3('0x5c')]['id']){delete _0x11d5f5[_0xace3('0x5c')]['id'];}return db[_0xace3('0x52')]['find']({'where':{'id':_0x11d5f5['params']['id']}})[_0xace3('0x24')](handleEntityNotFound(_0x4f36e4,null))[_0xace3('0x24')](saveUpdates(_0x11d5f5['body'],null))['then'](respondWithResult(_0x4f36e4,null))[_0xace3('0x55')](handleError(_0x4f36e4,null));};exports[_0xace3('0x5d')]=function(_0x54f10b,_0xc9d9fa){return db[_0xace3('0x52')][_0xace3('0x5d')]()['then'](respondWithResult(_0xc9d9fa,null))['catch'](handleError(_0xc9d9fa,null));};exports[_0xace3('0x23')]=function(_0xf5a4ab,_0x560277){var _0xf63b9b;return db[_0xace3('0x52')][_0xace3('0x5a')]({'where':{'id':_0xf5a4ab[_0xace3('0x57')]['id']}})[_0xace3('0x24')](handleEntityNotFound(_0x560277,null))['then'](function(_0x12271a){if(_0x12271a){return _0x12271a['destroy']()[_0xace3('0x24')](function(_0x3c1408){return _0x3c1408;});}})['then'](function(_0x1b149e){_0xf63b9b=_0x1b149e;if(_0x1b149e){if(_0x1b149e[_0xace3('0x5e')]||_0x1b149e[_0xace3('0x5f')]){return db[_0x1b149e[_0xace3('0x5e')]?_0xace3('0x60'):_0xace3('0x61')]['find']({'where':{'id':_0x1b149e[_0xace3('0x5e')]?_0x1b149e[_0xace3('0x5e')]:_0x1b149e[_0xace3('0x5f')]},'attributes':['id',_0xace3('0x26')],'raw':!![]});}}})['then'](function(_0x5237b0){var _0xda22f0={};if(_0x5237b0){_['merge'](_0xda22f0,_[_0xace3('0x62')](_0xf63b9b[_0xace3('0x63')],[_0xace3('0x64'),_0xace3('0x65'),'id']));_0xda22f0['state']=0x15;_0xda22f0[_0xace3('0x66')]=_0xace3('0x67');_0xda22f0[_0xace3('0x68')]=_0x5237b0[_0xace3('0x26')];_0xda22f0['membername']=_0xf5a4ab['user'][_0xace3('0x26')];_0xda22f0['UserId']=_0xf5a4ab[_0xace3('0x69')]['id'];_0xda22f0[_0xace3('0x67')]=!![];_0xda22f0[_0xace3('0x6a')]=moment()['format'](_0xace3('0x6b'));_0xda22f0[_0xace3('0x6c')]=_0xf63b9b[_0xace3('0x6d')];_0xda22f0['campaigntype']=_0xf63b9b[_0xace3('0x5e')]?'queue':_0xace3('0x6e');return db['CmContact'][_0xace3('0x5a')]({'where':{'id':_0xda22f0[_0xace3('0x6f')]},'attributes':[_0xace3('0x70'),_0xace3('0x71')]})[_0xace3('0x24')](function(_0x445df8){if(!_[_0xace3('0x72')](_0x560277)&&!_[_0xace3('0x72')](_0x445df8[_0xace3('0x70')])){_0xda22f0[_0xace3('0x73')]=_0x445df8[_0xace3('0x70')];if(!_[_0xace3('0x72')](_0x445df8[_0xace3('0x71')])){_0xda22f0[_0xace3('0x73')]+='\x20'+_0x445df8[_0xace3('0x71')];}}})['finally'](function(){return db[_0xace3('0x74')][_0xace3('0x5b')](_0xda22f0);});}})[_0xace3('0x24')](function(){return _0x560277[_0xace3('0x1c')](0xcc)[_0xace3('0x1b')]();})[_0xace3('0x55')](handleError(_0x560277,null));};exports['getPreview']=function(_0x34631e,_0x4e1ddd,_0x30ea0f){var _0x46b99b=[];return db[_0xace3('0x75')]['describe']()[_0xace3('0x24')](function(_0x1ceff7){_0x46b99b=_[_0xace3('0x2e')](_0x1ceff7);return _0x34631e[_0xace3('0x69')][_0xace3('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xace3('0x77')},'attributes':['id',_0xace3('0x78')],'raw':!![]});})[_0xace3('0x24')](function(_0x275ec7){if(_0x275ec7&&_0x275ec7[_0xace3('0x79')]){return db[_0xace3('0x7a')][_0xace3('0x7b')](function(_0x179d15){var _0x277a20={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xace3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x275ec7,'id')},'$or':[{'UserId':null},{'UserId':_0x34631e[_0xace3('0x69')]['id']}]};var _0x4df164=[];if(_0x34631e[_0xace3('0x5c')][_0xace3('0x7d')]&&_0x34631e[_0xace3('0x5c')][_0xace3('0x7d')]===_0xace3('0x7e')){if(!_[_0xace3('0x7f')](_0x34631e[_0xace3('0x5c')][_0xace3('0x80')])){_0x277a20['id']={'$in':_0x34631e[_0xace3('0x5c')][_0xace3('0x80')]};}_0x4df164=[['priority','ASC'],[_0xace3('0x81'),_0x275ec7[0x0][_0xace3('0x78')]===_0xace3('0x82')?_0xace3('0x83'):_0xace3('0x82')],db[_0xace3('0x7a')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xace3('0x83')]];}else{if(!_[_0xace3('0x7f')](_0x34631e[_0xace3('0x5c')]['hopperIds'])){_0x277a20['id']={'$notIn':_0x34631e[_0xace3('0x5c')]['hopperIds']};}_0x4df164=[[_0xace3('0x84'),_0xace3('0x83')],[_0xace3('0x81'),_0x275ec7[0x0][_0xace3('0x78')]],db[_0xace3('0x7a')][_0xace3('0x85')](_0xace3('0x86')),['id',_0xace3('0x82')]];}return db['CmHopper'][_0xace3('0x87')]({'attributes':['id',_0xace3('0x88')],'where':_0x277a20,'order':_0x4df164,'transaction':_0x179d15,'lock':_0x179d15[_0xace3('0x89')]['UPDATE'],'include':[{'model':db[_0xace3('0x75')],'as':'Contact','attributes':_0x46b99b,'include':[{'model':db[_0xace3('0x8a')],'as':_0xace3('0x8b'),'attributes':['id',_0xace3('0x26')]}]},{'model':db[_0xace3('0x8c')],'as':_0xace3('0x8d'),'attributes':['id',_0xace3('0x26')]},{'model':db[_0xace3('0x60')],'as':_0xace3('0x8e'),'attributes':['id',_0xace3('0x26'),_0xace3('0x8f')]}]})[_0xace3('0x24')](function(_0x2a6b20){if(_0x2a6b20){return _0x2a6b20[_0xace3('0x90')]({'UserId':_0x34631e[_0xace3('0x69')]['id']},{'transaction':_0x179d15});}});});}})[_0xace3('0x24')](handleEntityNotFound(_0x4e1ddd,null))[_0xace3('0x24')](respondWithResult(_0x4e1ddd,null))[_0xace3('0x55')](handleError(_0x4e1ddd,null));};exports[_0xace3('0x91')]=function(_0x2fe364,_0x42a7e5,_0x167179){return _0x2fe364[_0xace3('0x69')][_0xace3('0x76')]({'where':{'type':_0xace3('0x92'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x7090fe){if(_0x7090fe&&_0x7090fe['length']){return db['CmHopper'][_0xace3('0x53')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xace3('0x7c')](_0xace3('0x6b'))},'VoiceQueueId':{'$in':_[_0xace3('0x29')](_0x7090fe,'id')},'$or':[{'UserId':null},{'UserId':_0x2fe364[_0xace3('0x69')]['id']}]}});}return 0x0;})[_0xace3('0x24')](function(_0x139a4e){if(!_['isNil'](_0x139a4e)&&_[_0xace3('0x93')](_0x139a4e)){return _0x42a7e5[_0xace3('0x1c')](0xc8)['json']({'contacts':_0x139a4e});}else{logger[_0xace3('0x25')](_0xace3('0x94'),_0xace3('0x91'),0x194,_0xace3('0x95'));_0x42a7e5['sendStatus'](0x194);}})[_0xace3('0x55')](handleError(_0x42a7e5,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 16061fb..eba1e4b 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 _0x21d9=['scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0x21d9,0x13e));var _0x921d=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x21d9[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x921d('0x0'));var util=require(_0x921d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x921d('0x2'));var BPromise=require(_0x921d('0x3'));var rp=require(_0x921d('0x4'));var fs=require('fs');var path=require(_0x921d('0x5'));var rimraf=require(_0x921d('0x6'));var config=require(_0x921d('0x7'));var attributes=require(_0x921d('0x8'));module[_0x921d('0x9')]=function(_0x554d86,_0xeff06b){return _0x554d86['define'](_0x921d('0xa'),attributes,{'tableName':_0x921d('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x921d('0xc')]},{'name':'phone','fields':[_0x921d('0xd')]},{'name':_0x921d('0xe'),'fields':[_0x921d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55e7=['./cmHopper.attributes','exports','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2db315,_0x58d720){var _0x12f9a2=function(_0x1f146e){while(--_0x1f146e){_0x2db315['push'](_0x2db315['shift']());}};_0x12f9a2(++_0x58d720);}(_0x55e7,0x6f));var _0x755e=function(_0x561b82,_0x58bd4c){_0x561b82=_0x561b82-0x0;var _0x3625a3=_0x55e7[_0x561b82];return _0x3625a3;};'use strict';var _=require(_0x755e('0x0'));var util=require(_0x755e('0x1'));var logger=require(_0x755e('0x2'))(_0x755e('0x3'));var moment=require(_0x755e('0x4'));var BPromise=require(_0x755e('0x5'));var rp=require(_0x755e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x755e('0x7'));var config=require(_0x755e('0x8'));var attributes=require(_0x755e('0x9'));module[_0x755e('0xa')]=function(_0x4bf84a,_0xd7dad6){return _0x4bf84a['define'](_0x755e('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x755e('0xc'),'fields':['scheduledat']},{'name':_0x755e('0xd'),'fields':['phone']},{'name':_0x755e('0xe'),'fields':[_0x755e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index bdbaf25..972abaa 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 _0x36fa=['sequelize','destroy','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','CmHopper','findAll','options','where','attributes','limit','include','map','model','GetCmHopper','debug','stringify','catch','ShowCmHopper','raw','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','LOCK','UPDATE','keys','User','Agent','name','length','includes','UserId','push','update','all'];(function(_0x5d3475,_0x52fc3f){var _0x47ac40=function(_0x408c09){while(--_0x408c09){_0x5d3475['push'](_0x5d3475['shift']());}};_0x47ac40(++_0x52fc3f);}(_0x36fa,0xdb));var _0xa36f=function(_0x1f936d,_0x97d93d){_0x1f936d=_0x1f936d-0x0;var _0x35ecba=_0x36fa[_0x1f936d];return _0x35ecba;};'use strict';var _=require(_0xa36f('0x0'));var util=require('util');var moment=require(_0xa36f('0x1'));var BPromise=require(_0xa36f('0x2'));var rs=require(_0xa36f('0x3'));var fs=require('fs');var Redis=require(_0xa36f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa36f('0x5'));var logger=require(_0xa36f('0x6'))(_0xa36f('0x7'));var config=require(_0xa36f('0x8'));var jayson=require(_0xa36f('0x9'));var client=jayson[_0xa36f('0xa')][_0xa36f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x292e0e,_0x39bd9a,_0x19549b){return new BPromise(function(_0x36a25c,_0xefbab9){return client[_0xa36f('0xc')](_0x292e0e,_0x19549b)[_0xa36f('0xd')](function(_0xf7e777){logger[_0xa36f('0xe')](_0xa36f('0xf'),_0x39bd9a,_0xa36f('0x10'));logger['debug'](_0xa36f('0x11'),_0x39bd9a,'request\x20sent',JSON['stringify'](_0xf7e777));if(_0xf7e777[_0xa36f('0x12')]){if(_0xf7e777[_0xa36f('0x12')][_0xa36f('0x13')]===0x1f4){logger[_0xa36f('0x12')](_0xa36f('0xf'),_0x39bd9a,_0xf7e777[_0xa36f('0x12')][_0xa36f('0x14')]);return _0xefbab9(_0xf7e777[_0xa36f('0x12')][_0xa36f('0x14')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x39bd9a,_0xf7e777[_0xa36f('0x12')][_0xa36f('0x14')]);return _0x36a25c(_0xf7e777[_0xa36f('0x12')][_0xa36f('0x14')]);}else{logger[_0xa36f('0xe')](_0xa36f('0xf'),_0x39bd9a,_0xa36f('0x10'));_0x36a25c(_0xf7e777['result'][_0xa36f('0x14')]);}})['catch'](function(_0x5ed0cf){logger[_0xa36f('0x12')]('CmHopper,\x20%s,\x20%s',_0x39bd9a,_0x5ed0cf);_0xefbab9(_0x5ed0cf);});});}exports['GetCmHopper']=function(_0x8364b4){var _0x1fa215=this;return new Promise(function(_0x5f591b,_0x230f5e){return db[_0xa36f('0x15')][_0xa36f('0x16')]({'raw':_0x8364b4[_0xa36f('0x17')]?_0x8364b4[_0xa36f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x8364b4['options']?_0x8364b4[_0xa36f('0x17')][_0xa36f('0x18')]||null:null,'attributes':_0x8364b4[_0xa36f('0x17')]?_0x8364b4[_0xa36f('0x17')][_0xa36f('0x19')]||null:null,'limit':_0x8364b4[_0xa36f('0x17')]?_0x8364b4[_0xa36f('0x17')][_0xa36f('0x1a')]||null:null,'include':_0x8364b4[_0xa36f('0x17')]?_0x8364b4[_0xa36f('0x17')][_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x8364b4['options'][_0xa36f('0x1b')],function(_0x599412){return{'model':db[_0x599412[_0xa36f('0x1d')]],'as':_0x599412['as'],'attributes':_0x599412['attributes'],'include':_0x599412['include']?_[_0xa36f('0x1c')](_0x599412[_0xa36f('0x1b')],function(_0x4d64ce){return{'model':db[_0x4d64ce[_0xa36f('0x1d')]],'as':_0x4d64ce['as'],'attributes':_0x4d64ce['attributes'],'include':_0x4d64ce[_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x4d64ce[_0xa36f('0x1b')],function(_0x37aa3b){return{'model':db[_0x37aa3b['model']],'as':_0x37aa3b['as'],'attributes':_0x37aa3b['attributes']};}):[]};}):[]};}):[]:[]})[_0xa36f('0xd')](function(_0x46e7fa){logger[_0xa36f('0xe')](_0xa36f('0x1e'),_0x8364b4);logger[_0xa36f('0x1f')](_0xa36f('0x1e'),_0x8364b4,JSON[_0xa36f('0x20')](_0x46e7fa));_0x5f591b(_0x46e7fa);})[_0xa36f('0x21')](function(_0x319aee){logger[_0xa36f('0x12')]('GetCmHopper',_0x319aee[_0xa36f('0x14')],_0x8364b4);_0x230f5e(_0x1fa215[_0xa36f('0x12')](0x1f4,_0x319aee['message']));});});};exports[_0xa36f('0x22')]=function(_0x4ef1ee){var _0x423e6f=this;return new Promise(function(_0x3ce528,_0x7ae96d){return db['CmHopper']['find']({'raw':_0x4ef1ee[_0xa36f('0x17')]?_0x4ef1ee[_0xa36f('0x17')][_0xa36f('0x23')]===undefined?!![]:![]:!![],'where':_0x4ef1ee[_0xa36f('0x17')]?_0x4ef1ee[_0xa36f('0x17')]['where']||null:null,'attributes':_0x4ef1ee[_0xa36f('0x17')]?_0x4ef1ee[_0xa36f('0x17')][_0xa36f('0x19')]||null:null,'include':_0x4ef1ee['options']?_0x4ef1ee[_0xa36f('0x17')]['include']?_['map'](_0x4ef1ee[_0xa36f('0x17')][_0xa36f('0x1b')],function(_0x36649c){return{'model':db[_0x36649c[_0xa36f('0x1d')]],'as':_0x36649c['as'],'attributes':_0x36649c[_0xa36f('0x19')],'include':_0x36649c[_0xa36f('0x1b')]?_['map'](_0x36649c[_0xa36f('0x1b')],function(_0x53ba21){return{'model':db[_0x53ba21[_0xa36f('0x1d')]],'as':_0x53ba21['as'],'attributes':_0x53ba21[_0xa36f('0x19')],'include':_0x53ba21[_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x53ba21[_0xa36f('0x1b')],function(_0x2d6a5e){return{'model':db[_0x2d6a5e['model']],'as':_0x2d6a5e['as'],'attributes':_0x2d6a5e[_0xa36f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa36f('0xd')](function(_0x311623){logger[_0xa36f('0xe')](_0xa36f('0x22'),_0x4ef1ee);logger[_0xa36f('0x1f')]('ShowCmHopper',_0x4ef1ee,JSON[_0xa36f('0x20')](_0x311623));_0x3ce528(_0x311623);})[_0xa36f('0x21')](function(_0x23720e){logger[_0xa36f('0x12')](_0xa36f('0x22'),_0x23720e['message'],_0x4ef1ee);_0x7ae96d(_0x423e6f[_0xa36f('0x12')](0x1f4,_0x23720e[_0xa36f('0x14')]));});});};exports[_0xa36f('0x24')]=function(_0x3190e3){var _0x2ff120=this;return new Promise(function(_0x563b72,_0x2f9fb1){return db[_0xa36f('0x15')][_0xa36f('0x25')](_0x3190e3[_0xa36f('0x26')],{'raw':_0x3190e3[_0xa36f('0x17')]?_0x3190e3[_0xa36f('0x17')][_0xa36f('0x23')]===undefined?!![]:![]:!![]})[_0xa36f('0xd')](function(_0x4ea025){logger[_0xa36f('0xe')](_0xa36f('0x24'),_0x3190e3);logger['debug'](_0xa36f('0x24'),_0x3190e3,JSON['stringify'](_0x4ea025));_0x563b72(_0x4ea025);})[_0xa36f('0x21')](function(_0x6ed27b){logger['error'](_0xa36f('0x24'),_0x6ed27b[_0xa36f('0x14')],_0x3190e3);_0x2f9fb1(_0x2ff120['error'](0x1f4,_0x6ed27b[_0xa36f('0x14')]));});});};exports[_0xa36f('0x27')]=function(_0x3b7bef){var _0x532b7e=this;return new Promise(function(_0x12f8c1,_0x376691){return db[_0xa36f('0x15')]['update'](_0x3b7bef[_0xa36f('0x26')],{'raw':_0x3b7bef['options']?_0x3b7bef['options'][_0xa36f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7bef['options']?_0x3b7bef['options'][_0xa36f('0x18')]||null:null,'attributes':_0x3b7bef[_0xa36f('0x17')]?_0x3b7bef[_0xa36f('0x17')][_0xa36f('0x19')]||null:null,'limit':_0x3b7bef[_0xa36f('0x17')]?_0x3b7bef[_0xa36f('0x17')][_0xa36f('0x1a')]||null:null})[_0xa36f('0xd')](function(_0xba0002){logger[_0xa36f('0xe')](_0xa36f('0x27'),_0x3b7bef);logger['debug'](_0xa36f('0x27'),_0x3b7bef,JSON[_0xa36f('0x20')](_0xba0002));_0x12f8c1(_0xba0002);})[_0xa36f('0x21')](function(_0xac260d){logger[_0xa36f('0x12')](_0xa36f('0x27'),_0xac260d[_0xa36f('0x14')],_0x3b7bef);_0x376691(_0x532b7e[_0xa36f('0x12')](0x1f4,_0xac260d['message']));});});};exports[_0xa36f('0x28')]=function(_0xc3a6ab){var _0x446a6b=this;return new Promise(function(_0x5d8532,_0x4a99b1){return db[_0xa36f('0x15')]['destroy']({'where':_0xc3a6ab[_0xa36f('0x17')]?_0xc3a6ab[_0xa36f('0x17')][_0xa36f('0x18')]||null:null})[_0xa36f('0xd')](function(_0x32060f){logger['info'](_0xa36f('0x28'),_0xc3a6ab);logger[_0xa36f('0x1f')](_0xa36f('0x28'),_0xc3a6ab,JSON[_0xa36f('0x20')](_0x32060f));_0x5d8532(_0x32060f);})[_0xa36f('0x21')](function(_0x142589){logger[_0xa36f('0x12')](_0xa36f('0x28'),_0x142589['message'],_0xc3a6ab);_0x4a99b1(_0x446a6b[_0xa36f('0x12')](0x1f4,_0x142589['message']));});});};exports[_0xa36f('0x29')]=function(_0x47295f){var _0x743078=this;return new Promise(function(_0xe08b7b,_0x3cf343){return db[_0xa36f('0x2a')][_0xa36f('0x2b')]()['then'](function(_0x1af15f){return db['sequelize'][_0xa36f('0x2c')](function(_0xb9b97f){return db[_0xa36f('0x15')]['findAll']({'where':_0x47295f['options']?_0x47295f[_0xa36f('0x17')][_0xa36f('0x18')]||null:null,'attributes':_0x47295f['options']?_0x47295f[_0xa36f('0x17')]['attributes']||null:null,'limit':_0x47295f[_0xa36f('0x17')]?_0x47295f['options']['limit']||null:null,'order':_0x47295f[_0xa36f('0x17')]?_0x47295f[_0xa36f('0x17')]['order']||null:null,'transaction':_0xb9b97f,'lock':_0xb9b97f[_0xa36f('0x2d')][_0xa36f('0x2e')],'include':[{'model':db[_0xa36f('0x2a')],'as':'Contact','attributes':_[_0xa36f('0x2f')](_0x1af15f)},{'model':db[_0xa36f('0x30')],'as':_0xa36f('0x31'),'attributes':['id',_0xa36f('0x32'),'voicePause']}]})['then'](function(_0x150d1d){var _0x11cfb8=[];var _0xda138=[];for(var _0x151244=0x0;_0x151244<_0x150d1d[_0xa36f('0x33')];_0x151244+=0x1){if(!_0xda138[_0xa36f('0x34')](_0x150d1d[_0x151244][_0xa36f('0x35')])){_0xda138['push'](_0x150d1d[_0x151244][_0xa36f('0x35')]);_0x11cfb8[_0xa36f('0x36')](_0x150d1d[_0x151244][_0xa36f('0x37')](_0x47295f[_0xa36f('0x26')],{'transaction':_0xb9b97f}));}}return BPromise[_0xa36f('0x38')](_0x11cfb8);});})[_0xa36f('0xd')](function(_0x11327e){logger['info']('GetContactDialer',_0x47295f);logger[_0xa36f('0x1f')](_0xa36f('0x29'),_0x47295f,JSON[_0xa36f('0x20')](_0x11327e));_0xe08b7b(_0x11327e);})[_0xa36f('0x21')](function(_0x5b49e1){logger[_0xa36f('0x12')](_0xa36f('0x29'),_0x5b49e1[_0xa36f('0x14')],_0x47295f);_0x3cf343(_0x743078[_0xa36f('0x12')](0x1f4,_0x5b49e1[_0xa36f('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x1853ca){var _0x472a32=this;return new Promise(function(_0x4a73e0,_0x2aa360){return db[_0xa36f('0x39')][_0xa36f('0x2c')](function(_0x267961){return db['CmHopperFinal']['create'](_0x1853ca[_0xa36f('0x26')],{'raw':_0x1853ca[_0xa36f('0x17')]?_0x1853ca[_0xa36f('0x17')][_0xa36f('0x23')]===undefined?!![]:![]:!![],'transaction':_0x267961})[_0xa36f('0xd')](function(){return db[_0xa36f('0x15')][_0xa36f('0x3a')]({'where':_0x1853ca['options']?_0x1853ca[_0xa36f('0x17')][_0xa36f('0x18')]||null:null,'transaction':_0x267961});});})[_0xa36f('0xd')](function(_0x379555){logger[_0xa36f('0xe')]('MoveContactManagedDialer',_0x1853ca);logger['debug'](_0xa36f('0x3b'),_0x1853ca,JSON[_0xa36f('0x20')](_0x379555));_0x4a73e0(_0x379555);})[_0xa36f('0x21')](function(_0x400a6b){logger[_0xa36f('0x12')](_0xa36f('0x3b'),_0x400a6b[_0xa36f('0x14')],_0x1853ca);_0x2aa360(_0x472a32[_0xa36f('0x12')](0x1f4,_0x400a6b[_0xa36f('0x14')]));});});};exports[_0xa36f('0x3c')]=function(_0x2d7609){var _0x19a87f=this;return new Promise(function(_0x4ca735,_0x22d26f){return db['CmHopper'][_0xa36f('0x16')]({'raw':_0x2d7609[_0xa36f('0x17')]?_0x2d7609[_0xa36f('0x17')][_0xa36f('0x23')]===undefined?!![]:![]:!![],'where':_0x2d7609['options']?_0x2d7609['options'][_0xa36f('0x18')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xa36f('0x39')]['fn']('IF',db[_0xa36f('0x39')]['literal'](_0xa36f('0x3d')+util['format']('\x22%s\x22',moment()[_0xa36f('0x3e')](_0xa36f('0x3f')))+_0xa36f('0x40')))),_0xa36f('0x41')]]})[_0xa36f('0xd')](function(_0x41cc2e){logger[_0xa36f('0xe')](_0xa36f('0x3c'),_0x2d7609);logger[_0xa36f('0x1f')]('CountReScheduled',_0x2d7609,JSON[_0xa36f('0x20')](_0x41cc2e));_0x4ca735(_0x41cc2e);})[_0xa36f('0x21')](function(_0x161339){logger['error']('CountReScheduled',_0x161339[_0xa36f('0x14')],_0x2d7609);_0x22d26f(_0x19a87f[_0xa36f('0x12')](0x1f4,_0x161339[_0xa36f('0x14')]));});});};exports[_0xa36f('0x42')]=function(_0x576aef){var _0xe3f001=this;return new Promise(function(_0x3403b3,_0x4de3be){return db[_0xa36f('0x2a')][_0xa36f('0x2b')]()[_0xa36f('0xd')](function(_0x35df6e){return db[_0xa36f('0x39')][_0xa36f('0x2c')](function(_0x26d3aa){return db[_0xa36f('0x15')]['findAll']({'where':_0x576aef[_0xa36f('0x17')]?_0x576aef[_0xa36f('0x17')]['where']||null:null,'attributes':_0x576aef['options']?_0x576aef[_0xa36f('0x17')][_0xa36f('0x19')]||null:null,'limit':0x1,'order':_0x576aef[_0xa36f('0x17')]?_0x576aef[_0xa36f('0x17')][_0xa36f('0x43')]||null:null,'group':db[_0xa36f('0x15')][_0xa36f('0x35')],'transaction':_0x26d3aa,'lock':_0x26d3aa[_0xa36f('0x2d')]['UPDATE'],'include':_0x576aef['options']?_0x576aef[_0xa36f('0x17')][_0xa36f('0x1b')]?_['map'](_0x576aef[_0xa36f('0x17')][_0xa36f('0x1b')],function(_0x33c230){return{'model':db[_0x33c230[_0xa36f('0x1d')]],'as':_0x33c230['as'],'attributes':_0x33c230[_0xa36f('0x19')],'include':_0x33c230[_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x33c230[_0xa36f('0x1b')],function(_0x2daf18){return{'model':db[_0x2daf18['model']],'as':_0x2daf18['as'],'attributes':_0x2daf18[_0xa36f('0x19')],'include':_0x2daf18['include']?_[_0xa36f('0x1c')](_0x2daf18[_0xa36f('0x1b')],function(_0x384ceb){return{'model':db[_0x384ceb[_0xa36f('0x1d')]],'as':_0x384ceb['as'],'attributes':_0x384ceb[_0xa36f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa36f('0xd')](function(_0x24d211){var _0xf92462=[];for(var _0x3bea77=0x0;_0x3bea77<_0x24d211[_0xa36f('0x33')];_0x3bea77+=0x1){_0xf92462[_0xa36f('0x36')](_0x24d211[_0x3bea77][_0xa36f('0x37')](_0x576aef['body'],{'transaction':_0x26d3aa}));}return BPromise[_0xa36f('0x38')](_0xf92462);});})[_0xa36f('0xd')](function(_0x35f449){logger[_0xa36f('0xe')](_0xa36f('0x42'),_0x576aef);logger[_0xa36f('0x1f')](_0xa36f('0x42'),_0x576aef,JSON[_0xa36f('0x20')](_0x35f449));_0x3403b3(_0x35f449);})['catch'](function(_0x5b12a2){logger[_0xa36f('0x12')](_0xa36f('0x42'),_0x5b12a2[_0xa36f('0x14')],_0x576aef);_0x4de3be(_0xe3f001[_0xa36f('0x12')](0x1f4,_0x5b12a2['message']));});});});};exports[_0xa36f('0x44')]=function(_0x59c551){var _0x2074bd=this;return new Promise(function(_0x3d94b7,_0x588b43){db['CmContact']['describe']()['then'](function(_0x1c821f){return db[_0xa36f('0x15')][_0xa36f('0x16')]({'raw':_0x59c551[_0xa36f('0x17')]?_0x59c551['options'][_0xa36f('0x23')]===undefined?!![]:![]:!![],'where':_0x59c551[_0xa36f('0x17')]?_0x59c551[_0xa36f('0x17')][_0xa36f('0x18')]||null:null,'attributes':_0x59c551[_0xa36f('0x17')]?_0x59c551[_0xa36f('0x17')][_0xa36f('0x19')]||null:null,'limit':_0x59c551['options']?_0x59c551[_0xa36f('0x17')][_0xa36f('0x1a')]||null:null,'include':_0x59c551[_0xa36f('0x17')]?_0x59c551[_0xa36f('0x17')][_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x59c551[_0xa36f('0x17')][_0xa36f('0x1b')],function(_0x515719){return{'model':db[_0x515719[_0xa36f('0x1d')]],'as':_0x515719['as'],'attributes':_0x515719['as']==='Contact'?_[_0xa36f('0x2f')](_0x1c821f):_0x515719[_0xa36f('0x19')],'include':_0x515719[_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x515719['include'],function(_0x49d74a){return{'model':db[_0x49d74a[_0xa36f('0x1d')]],'as':_0x49d74a['as'],'attributes':_0x49d74a[_0xa36f('0x19')],'include':_0x49d74a[_0xa36f('0x1b')]?_[_0xa36f('0x1c')](_0x49d74a[_0xa36f('0x1b')],function(_0x4b1243){return{'model':db[_0x4b1243[_0xa36f('0x1d')]],'as':_0x4b1243['as'],'attributes':_0x4b1243[_0xa36f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2a0ae){logger[_0xa36f('0xe')](_0xa36f('0x1e'),_0x59c551);logger[_0xa36f('0x1f')](_0xa36f('0x1e'),_0x59c551,JSON[_0xa36f('0x20')](_0xf2a0ae));_0x3d94b7(_0xf2a0ae);})[_0xa36f('0x21')](function(_0x5e1cdf){logger[_0xa36f('0x12')](_0xa36f('0x1e'),_0x5e1cdf[_0xa36f('0x14')],_0x59c551);_0x588b43(_0x2074bd[_0xa36f('0x12')](0x1f4,_0x5e1cdf[_0xa36f('0x14')]));});});});}; \ No newline at end of file +var _0xc510=['info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetCmHopper','options','raw','where','attributes','include','map','model','catch','find','then','ShowCmHopper','CmHopper','create','CreateCmHopper','UpdateCmHopper','update','body','limit','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','keys','User','name','voicePause','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','destroy','findAll','literal','`scheduledat`\x20>=\x20','CountReScheduled','GetContactRecallMe','all','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x56139e,_0x714ec2){var _0x113526=function(_0x529c28){while(--_0x529c28){_0x56139e['push'](_0x56139e['shift']());}};_0x113526(++_0x714ec2);}(_0xc510,0x1d6));var _0x0c51=function(_0x1ba7fb,_0x3aa77e){_0x1ba7fb=_0x1ba7fb-0x0;var _0x5b12bf=_0xc510[_0x1ba7fb];return _0x5b12bf;};'use strict';var _=require(_0x0c51('0x0'));var util=require(_0x0c51('0x1'));var moment=require(_0x0c51('0x2'));var BPromise=require(_0x0c51('0x3'));var rs=require(_0x0c51('0x4'));var fs=require('fs');var Redis=require(_0x0c51('0x5'));var db=require(_0x0c51('0x6'))['db'];var utils=require(_0x0c51('0x7'));var logger=require(_0x0c51('0x8'))(_0x0c51('0x9'));var config=require(_0x0c51('0xa'));var jayson=require(_0x0c51('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4992ac,_0x2cbfe2,_0x73125b){return new BPromise(function(_0x1fbb2d,_0x3b96f7){return client[_0x0c51('0xc')](_0x4992ac,_0x73125b)['then'](function(_0x47b1dc){logger[_0x0c51('0xd')](_0x0c51('0xe'),_0x2cbfe2,_0x0c51('0xf'));logger[_0x0c51('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2cbfe2,_0x0c51('0xf'),JSON[_0x0c51('0x11')](_0x47b1dc));if(_0x47b1dc['error']){if(_0x47b1dc['error'][_0x0c51('0x12')]===0x1f4){logger[_0x0c51('0x13')]('CmHopper,\x20%s,\x20%s',_0x2cbfe2,_0x47b1dc[_0x0c51('0x13')][_0x0c51('0x14')]);return _0x3b96f7(_0x47b1dc[_0x0c51('0x13')]['message']);}logger[_0x0c51('0x13')](_0x0c51('0xe'),_0x2cbfe2,_0x47b1dc[_0x0c51('0x13')][_0x0c51('0x14')]);return _0x1fbb2d(_0x47b1dc['error'][_0x0c51('0x14')]);}else{logger[_0x0c51('0xd')](_0x0c51('0xe'),_0x2cbfe2,_0x0c51('0xf'));_0x1fbb2d(_0x47b1dc[_0x0c51('0x15')][_0x0c51('0x14')]);}})['catch'](function(_0x5d9d27){logger['error'](_0x0c51('0xe'),_0x2cbfe2,_0x5d9d27);_0x3b96f7(_0x5d9d27);});});}exports[_0x0c51('0x16')]=function(_0x5cd3b9){var _0x49d01d=this;return new Promise(function(_0x33a3cb,_0x48583f){return db['CmHopper']['findAll']({'raw':_0x5cd3b9[_0x0c51('0x17')]?_0x5cd3b9['options'][_0x0c51('0x18')]===undefined?!![]:![]:!![],'where':_0x5cd3b9[_0x0c51('0x17')]?_0x5cd3b9['options'][_0x0c51('0x19')]||null:null,'attributes':_0x5cd3b9[_0x0c51('0x17')]?_0x5cd3b9[_0x0c51('0x17')][_0x0c51('0x1a')]||null:null,'limit':_0x5cd3b9[_0x0c51('0x17')]?_0x5cd3b9[_0x0c51('0x17')]['limit']||null:null,'include':_0x5cd3b9[_0x0c51('0x17')]?_0x5cd3b9['options'][_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x5cd3b9[_0x0c51('0x17')][_0x0c51('0x1b')],function(_0x2912a4){return{'model':db[_0x2912a4[_0x0c51('0x1d')]],'as':_0x2912a4['as'],'attributes':_0x2912a4[_0x0c51('0x1a')],'include':_0x2912a4[_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x2912a4[_0x0c51('0x1b')],function(_0x486d86){return{'model':db[_0x486d86['model']],'as':_0x486d86['as'],'attributes':_0x486d86[_0x0c51('0x1a')],'include':_0x486d86[_0x0c51('0x1b')]?_['map'](_0x486d86[_0x0c51('0x1b')],function(_0x350a89){return{'model':db[_0x350a89[_0x0c51('0x1d')]],'as':_0x350a89['as'],'attributes':_0x350a89[_0x0c51('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12c835){logger[_0x0c51('0xd')](_0x0c51('0x16'),_0x5cd3b9);logger[_0x0c51('0x10')](_0x0c51('0x16'),_0x5cd3b9,JSON[_0x0c51('0x11')](_0x12c835));_0x33a3cb(_0x12c835);})[_0x0c51('0x1e')](function(_0x26e2d9){logger['error'](_0x0c51('0x16'),_0x26e2d9[_0x0c51('0x14')],_0x5cd3b9);_0x48583f(_0x49d01d[_0x0c51('0x13')](0x1f4,_0x26e2d9[_0x0c51('0x14')]));});});};exports['ShowCmHopper']=function(_0x1ea646){var _0x835a06=this;return new Promise(function(_0x363311,_0x27a04d){return db['CmHopper'][_0x0c51('0x1f')]({'raw':_0x1ea646['options']?_0x1ea646['options'][_0x0c51('0x18')]===undefined?!![]:![]:!![],'where':_0x1ea646['options']?_0x1ea646[_0x0c51('0x17')][_0x0c51('0x19')]||null:null,'attributes':_0x1ea646[_0x0c51('0x17')]?_0x1ea646[_0x0c51('0x17')][_0x0c51('0x1a')]||null:null,'include':_0x1ea646['options']?_0x1ea646[_0x0c51('0x17')][_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x1ea646[_0x0c51('0x17')][_0x0c51('0x1b')],function(_0x1f4e16){return{'model':db[_0x1f4e16[_0x0c51('0x1d')]],'as':_0x1f4e16['as'],'attributes':_0x1f4e16[_0x0c51('0x1a')],'include':_0x1f4e16[_0x0c51('0x1b')]?_['map'](_0x1f4e16[_0x0c51('0x1b')],function(_0x43e276){return{'model':db[_0x43e276[_0x0c51('0x1d')]],'as':_0x43e276['as'],'attributes':_0x43e276[_0x0c51('0x1a')],'include':_0x43e276[_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x43e276[_0x0c51('0x1b')],function(_0x144b41){return{'model':db[_0x144b41[_0x0c51('0x1d')]],'as':_0x144b41['as'],'attributes':_0x144b41['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c51('0x20')](function(_0x42dec5){logger[_0x0c51('0xd')](_0x0c51('0x21'),_0x1ea646);logger[_0x0c51('0x10')](_0x0c51('0x21'),_0x1ea646,JSON[_0x0c51('0x11')](_0x42dec5));_0x363311(_0x42dec5);})[_0x0c51('0x1e')](function(_0x168822){logger[_0x0c51('0x13')](_0x0c51('0x21'),_0x168822['message'],_0x1ea646);_0x27a04d(_0x835a06[_0x0c51('0x13')](0x1f4,_0x168822[_0x0c51('0x14')]));});});};exports['CreateCmHopper']=function(_0x3f07a2){var _0xd97d84=this;return new Promise(function(_0x1b9837,_0x9bc3f1){return db[_0x0c51('0x22')][_0x0c51('0x23')](_0x3f07a2['body'],{'raw':_0x3f07a2['options']?_0x3f07a2['options'][_0x0c51('0x18')]===undefined?!![]:![]:!![]})[_0x0c51('0x20')](function(_0x4360cb){logger[_0x0c51('0xd')]('CreateCmHopper',_0x3f07a2);logger[_0x0c51('0x10')](_0x0c51('0x24'),_0x3f07a2,JSON[_0x0c51('0x11')](_0x4360cb));_0x1b9837(_0x4360cb);})[_0x0c51('0x1e')](function(_0x21b0e1){logger[_0x0c51('0x13')](_0x0c51('0x24'),_0x21b0e1['message'],_0x3f07a2);_0x9bc3f1(_0xd97d84[_0x0c51('0x13')](0x1f4,_0x21b0e1['message']));});});};exports[_0x0c51('0x25')]=function(_0x81e465){var _0x28786b=this;return new Promise(function(_0xb366a3,_0xc8fb31){return db[_0x0c51('0x22')][_0x0c51('0x26')](_0x81e465[_0x0c51('0x27')],{'raw':_0x81e465['options']?_0x81e465[_0x0c51('0x17')][_0x0c51('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81e465[_0x0c51('0x17')]?_0x81e465[_0x0c51('0x17')][_0x0c51('0x19')]||null:null,'attributes':_0x81e465[_0x0c51('0x17')]?_0x81e465[_0x0c51('0x17')][_0x0c51('0x1a')]||null:null,'limit':_0x81e465['options']?_0x81e465[_0x0c51('0x17')][_0x0c51('0x28')]||null:null})['then'](function(_0xba041b){logger[_0x0c51('0xd')](_0x0c51('0x25'),_0x81e465);logger[_0x0c51('0x10')](_0x0c51('0x25'),_0x81e465,JSON[_0x0c51('0x11')](_0xba041b));_0xb366a3(_0xba041b);})[_0x0c51('0x1e')](function(_0x2ab524){logger[_0x0c51('0x13')](_0x0c51('0x25'),_0x2ab524[_0x0c51('0x14')],_0x81e465);_0xc8fb31(_0x28786b[_0x0c51('0x13')](0x1f4,_0x2ab524[_0x0c51('0x14')]));});});};exports[_0x0c51('0x29')]=function(_0x533551){var _0x515d59=this;return new Promise(function(_0x77c22a,_0x5229d5){return db['CmHopper']['destroy']({'where':_0x533551[_0x0c51('0x17')]?_0x533551[_0x0c51('0x17')][_0x0c51('0x19')]||null:null})[_0x0c51('0x20')](function(_0x5e2610){logger[_0x0c51('0xd')]('DestroyCmHopper',_0x533551);logger[_0x0c51('0x10')]('DestroyCmHopper',_0x533551,JSON[_0x0c51('0x11')](_0x5e2610));_0x77c22a(_0x5e2610);})[_0x0c51('0x1e')](function(_0x30bd11){logger[_0x0c51('0x13')](_0x0c51('0x29'),_0x30bd11['message'],_0x533551);_0x5229d5(_0x515d59[_0x0c51('0x13')](0x1f4,_0x30bd11[_0x0c51('0x14')]));});});};exports[_0x0c51('0x2a')]=function(_0x43f146){var _0x253934=this;return new Promise(function(_0x65483,_0x5de5d0){return db[_0x0c51('0x2b')][_0x0c51('0x2c')]()[_0x0c51('0x20')](function(_0x17dded){return db[_0x0c51('0x2d')][_0x0c51('0x2e')](function(_0x34250c){return db[_0x0c51('0x22')]['findAll']({'where':_0x43f146[_0x0c51('0x17')]?_0x43f146['options']['where']||null:null,'attributes':_0x43f146[_0x0c51('0x17')]?_0x43f146[_0x0c51('0x17')][_0x0c51('0x1a')]||null:null,'limit':_0x43f146[_0x0c51('0x17')]?_0x43f146[_0x0c51('0x17')][_0x0c51('0x28')]||null:null,'order':_0x43f146[_0x0c51('0x17')]?_0x43f146['options'][_0x0c51('0x2f')]||null:null,'transaction':_0x34250c,'lock':_0x34250c[_0x0c51('0x30')][_0x0c51('0x31')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x0c51('0x32')](_0x17dded)},{'model':db[_0x0c51('0x33')],'as':'Agent','attributes':['id',_0x0c51('0x34'),_0x0c51('0x35')]}]})[_0x0c51('0x20')](function(_0x1513aa){var _0x40c91a=[];var _0x18423c=[];for(var _0x50d80f=0x0;_0x50d80f<_0x1513aa[_0x0c51('0x36')];_0x50d80f+=0x1){if(!_0x18423c[_0x0c51('0x37')](_0x1513aa[_0x50d80f][_0x0c51('0x38')])){_0x18423c['push'](_0x1513aa[_0x50d80f][_0x0c51('0x38')]);_0x40c91a[_0x0c51('0x39')](_0x1513aa[_0x50d80f][_0x0c51('0x26')](_0x43f146['body'],{'transaction':_0x34250c}));}}return BPromise['all'](_0x40c91a);});})['then'](function(_0x13e0f4){logger[_0x0c51('0xd')]('GetContactDialer',_0x43f146);logger[_0x0c51('0x10')](_0x0c51('0x2a'),_0x43f146,JSON[_0x0c51('0x11')](_0x13e0f4));_0x65483(_0x13e0f4);})['catch'](function(_0x52e309){logger[_0x0c51('0x13')]('GetContactDialer',_0x52e309[_0x0c51('0x14')],_0x43f146);_0x5de5d0(_0x253934[_0x0c51('0x13')](0x1f4,_0x52e309[_0x0c51('0x14')]));});});});};exports[_0x0c51('0x3a')]=function(_0x19d49e){var _0x483117=this;return new Promise(function(_0x5c0718,_0x16cebd){return db[_0x0c51('0x2d')]['transaction'](function(_0x548973){return db[_0x0c51('0x3b')][_0x0c51('0x23')](_0x19d49e[_0x0c51('0x27')],{'raw':_0x19d49e['options']?_0x19d49e['options'][_0x0c51('0x18')]===undefined?!![]:![]:!![],'transaction':_0x548973})[_0x0c51('0x20')](function(){return db[_0x0c51('0x22')][_0x0c51('0x3c')]({'where':_0x19d49e[_0x0c51('0x17')]?_0x19d49e[_0x0c51('0x17')]['where']||null:null,'transaction':_0x548973});});})[_0x0c51('0x20')](function(_0x7f052b){logger[_0x0c51('0xd')](_0x0c51('0x3a'),_0x19d49e);logger[_0x0c51('0x10')](_0x0c51('0x3a'),_0x19d49e,JSON[_0x0c51('0x11')](_0x7f052b));_0x5c0718(_0x7f052b);})[_0x0c51('0x1e')](function(_0x5d0632){logger[_0x0c51('0x13')](_0x0c51('0x3a'),_0x5d0632[_0x0c51('0x14')],_0x19d49e);_0x16cebd(_0x483117['error'](0x1f4,_0x5d0632[_0x0c51('0x14')]));});});};exports['CountReScheduled']=function(_0x4a1e20){var _0x9c09a7=this;return new Promise(function(_0x30d3c6,_0x5869e4){return db[_0x0c51('0x22')][_0x0c51('0x3d')]({'raw':_0x4a1e20['options']?_0x4a1e20[_0x0c51('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4a1e20[_0x0c51('0x17')]?_0x4a1e20[_0x0c51('0x17')]['where']||null:null,'attributes':[[db[_0x0c51('0x2d')]['fn']('COUNT',db[_0x0c51('0x2d')]['fn']('IF',db['sequelize'][_0x0c51('0x3e')](_0x0c51('0x3f')+util['format']('\x22%s\x22',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x0c51('0x20')](function(_0x36e129){logger[_0x0c51('0xd')](_0x0c51('0x40'),_0x4a1e20);logger[_0x0c51('0x10')]('CountReScheduled',_0x4a1e20,JSON[_0x0c51('0x11')](_0x36e129));_0x30d3c6(_0x36e129);})[_0x0c51('0x1e')](function(_0x43dce0){logger['error'](_0x0c51('0x40'),_0x43dce0[_0x0c51('0x14')],_0x4a1e20);_0x5869e4(_0x9c09a7['error'](0x1f4,_0x43dce0[_0x0c51('0x14')]));});});};exports[_0x0c51('0x41')]=function(_0x303918){var _0x33af3a=this;return new Promise(function(_0x4a7d5e,_0x129c4e){return db[_0x0c51('0x2b')][_0x0c51('0x2c')]()[_0x0c51('0x20')](function(_0x5f4259){return db[_0x0c51('0x2d')][_0x0c51('0x2e')](function(_0x5dffcf){return db[_0x0c51('0x22')]['findAll']({'where':_0x303918['options']?_0x303918[_0x0c51('0x17')][_0x0c51('0x19')]||null:null,'attributes':_0x303918[_0x0c51('0x17')]?_0x303918['options'][_0x0c51('0x1a')]||null:null,'limit':0x1,'order':_0x303918[_0x0c51('0x17')]?_0x303918[_0x0c51('0x17')]['order']||null:null,'group':db[_0x0c51('0x22')]['UserId'],'transaction':_0x5dffcf,'lock':_0x5dffcf[_0x0c51('0x30')]['UPDATE'],'include':_0x303918[_0x0c51('0x17')]?_0x303918[_0x0c51('0x17')][_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x303918[_0x0c51('0x17')][_0x0c51('0x1b')],function(_0x2515bf){return{'model':db[_0x2515bf[_0x0c51('0x1d')]],'as':_0x2515bf['as'],'attributes':_0x2515bf[_0x0c51('0x1a')],'include':_0x2515bf[_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x2515bf['include'],function(_0x23e9be){return{'model':db[_0x23e9be[_0x0c51('0x1d')]],'as':_0x23e9be['as'],'attributes':_0x23e9be[_0x0c51('0x1a')],'include':_0x23e9be['include']?_[_0x0c51('0x1c')](_0x23e9be[_0x0c51('0x1b')],function(_0x333dc7){return{'model':db[_0x333dc7[_0x0c51('0x1d')]],'as':_0x333dc7['as'],'attributes':_0x333dc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c51('0x20')](function(_0x6ccd70){var _0x3cb30e=[];for(var _0x32474f=0x0;_0x32474f<_0x6ccd70[_0x0c51('0x36')];_0x32474f+=0x1){_0x3cb30e[_0x0c51('0x39')](_0x6ccd70[_0x32474f][_0x0c51('0x26')](_0x303918['body'],{'transaction':_0x5dffcf}));}return BPromise[_0x0c51('0x42')](_0x3cb30e);});})[_0x0c51('0x20')](function(_0x2a9787){logger['info']('GetContactRecallMe',_0x303918);logger[_0x0c51('0x10')]('GetContactRecallMe',_0x303918,JSON[_0x0c51('0x11')](_0x2a9787));_0x4a7d5e(_0x2a9787);})[_0x0c51('0x1e')](function(_0x415a63){logger['error'](_0x0c51('0x41'),_0x415a63[_0x0c51('0x14')],_0x303918);_0x129c4e(_0x33af3a['error'](0x1f4,_0x415a63[_0x0c51('0x14')]));});});});};exports[_0x0c51('0x43')]=function(_0xfcff71){var _0x139a05=this;return new Promise(function(_0x330d0f,_0x424287){db[_0x0c51('0x2b')][_0x0c51('0x2c')]()[_0x0c51('0x20')](function(_0x5ab580){return db['CmHopper']['findAll']({'raw':_0xfcff71[_0x0c51('0x17')]?_0xfcff71[_0x0c51('0x17')][_0x0c51('0x18')]===undefined?!![]:![]:!![],'where':_0xfcff71[_0x0c51('0x17')]?_0xfcff71[_0x0c51('0x17')]['where']||null:null,'attributes':_0xfcff71[_0x0c51('0x17')]?_0xfcff71[_0x0c51('0x17')]['attributes']||null:null,'limit':_0xfcff71[_0x0c51('0x17')]?_0xfcff71['options'][_0x0c51('0x28')]||null:null,'include':_0xfcff71['options']?_0xfcff71[_0x0c51('0x17')][_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0xfcff71['options']['include'],function(_0x1a8382){return{'model':db[_0x1a8382[_0x0c51('0x1d')]],'as':_0x1a8382['as'],'attributes':_0x1a8382['as']===_0x0c51('0x44')?_[_0x0c51('0x32')](_0x5ab580):_0x1a8382['attributes'],'include':_0x1a8382[_0x0c51('0x1b')]?_['map'](_0x1a8382[_0x0c51('0x1b')],function(_0x2deca4){return{'model':db[_0x2deca4['model']],'as':_0x2deca4['as'],'attributes':_0x2deca4[_0x0c51('0x1a')],'include':_0x2deca4[_0x0c51('0x1b')]?_[_0x0c51('0x1c')](_0x2deca4[_0x0c51('0x1b')],function(_0x2db57a){return{'model':db[_0x2db57a[_0x0c51('0x1d')]],'as':_0x2db57a['as'],'attributes':_0x2db57a[_0x0c51('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c51('0x20')](function(_0x4a5337){logger[_0x0c51('0xd')]('GetCmHopper',_0xfcff71);logger[_0x0c51('0x10')](_0x0c51('0x16'),_0xfcff71,JSON[_0x0c51('0x11')](_0x4a5337));_0x330d0f(_0x4a5337);})[_0x0c51('0x1e')](function(_0x22ae06){logger[_0x0c51('0x13')]('GetCmHopper',_0x22ae06['message'],_0xfcff71);_0x424287(_0x139a05['error'](0x1f4,_0x22ae06[_0x0c51('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index e2497ed..3529b25 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 _0xfe9d=['/preview','getPreview','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','/:id','post','create'];(function(_0x5240fc,_0x32084d){var _0x31b201=function(_0x2be9c6){while(--_0x2be9c6){_0x5240fc['push'](_0x5240fc['shift']());}};_0x31b201(++_0x32084d);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x150a58,_0x8774be){_0x150a58=_0x150a58-0x0;var _0x29c1f4=_0xfe9d[_0x150a58];return _0x29c1f4;};'use strict';var multer=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var path=require(_0xdfe9('0x2'));var timeout=require(_0xdfe9('0x3'));var express=require(_0xdfe9('0x4'));var router=express['Router']();var auth=require(_0xdfe9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdfe9('0x6'));var controller=require(_0xdfe9('0x7'));router[_0xdfe9('0x8')]('/',auth[_0xdfe9('0x9')](),controller[_0xdfe9('0xa')]);router['get']('/describe',auth[_0xdfe9('0x9')](),controller['describe']);router[_0xdfe9('0x8')](_0xdfe9('0xb'),auth['isAuthenticated'](),controller[_0xdfe9('0xc')]);router[_0xdfe9('0x8')](_0xdfe9('0xd'),auth[_0xdfe9('0x9')](),controller['show']);router[_0xdfe9('0xe')]('/',auth[_0xdfe9('0x9')](),controller[_0xdfe9('0xf')]);router[_0xdfe9('0xe')](_0xdfe9('0x10'),auth[_0xdfe9('0x9')](),controller[_0xdfe9('0x11')]);router[_0xdfe9('0x12')](_0xdfe9('0xd'),auth[_0xdfe9('0x9')](),controller['update']);router[_0xdfe9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xdfe9('0x14')]);module[_0xdfe9('0x15')]=router; \ No newline at end of file +var _0xe34f=['/:id','show','/preview','put','update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','getOpenContacts'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe34f,0xbc));var _0xfe34=function(_0xbd056e,_0x4c8f90){_0xbd056e=_0xbd056e-0x0;var _0x49eaa6=_0xe34f[_0xbd056e];return _0x49eaa6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfe34('0x0'));var router=express[_0xfe34('0x1')]();var auth=require(_0xfe34('0x2'));var interaction=require(_0xfe34('0x3'));var config=require(_0xfe34('0x4'));var controller=require(_0xfe34('0x5'));router[_0xfe34('0x6')]('/',auth['isAuthenticated'](),controller[_0xfe34('0x7')]);router[_0xfe34('0x6')](_0xfe34('0x8'),auth[_0xfe34('0x9')](),controller[_0xfe34('0xa')]);router['get']('/opencontacts',auth[_0xfe34('0x9')](),controller[_0xfe34('0xb')]);router[_0xfe34('0x6')](_0xfe34('0xc'),auth[_0xfe34('0x9')](),controller[_0xfe34('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xfe34('0xe'),auth[_0xfe34('0x9')](),controller['getPreview']);router[_0xfe34('0xf')](_0xfe34('0xc'),auth[_0xfe34('0x9')](),controller[_0xfe34('0x10')]);router[_0xfe34('0x11')](_0xfe34('0xc'),auth['isAuthenticated'](),controller[_0xfe34('0x12')]);module[_0xfe34('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d89a4c8..603a790 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 _0xea11=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x3a65a3,_0x26471){var _0x5c5b9c=function(_0x58ddbf){while(--_0x58ddbf){_0x3a65a3['push'](_0x3a65a3['shift']());}};_0x5c5b9c(++_0x26471);}(_0xea11,0x11b));var _0x1ea1=function(_0x1f3e52,_0x5c08b9){_0x1f3e52=_0x1f3e52-0x0;var _0x595163=_0xea11[_0x1f3e52];return _0x595163;};'use strict';var moment=require(_0x1ea1('0x0'));var Sequelize=require('sequelize');module[_0x1ea1('0x1')]={'phone':{'type':Sequelize[_0x1ea1('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1ea1('0x3')],'unique':_0x1ea1('0x4')},'ListId':{'type':Sequelize[_0x1ea1('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1ea1('0x4')}}; \ No newline at end of file +var _0x2bc7=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x2bc7,0xf4));var _0x72bc=function(_0x4a4e7a,_0x52230){_0x4a4e7a=_0x4a4e7a-0x0;var _0x3000f4=_0x2bc7[_0x4a4e7a];return _0x3000f4;};'use strict';var moment=require(_0x72bc('0x0'));var Sequelize=require(_0x72bc('0x1'));module[_0x72bc('0x2')]={'phone':{'type':Sequelize[_0x72bc('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x72bc('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x72bc('0x5')],'unique':_0x72bc('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index bcefa01..22b671f 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 _0x98e4=['where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','options','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x98e4,0x187));var _0x498e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x98e4[_0x1f9f37];return _0x21c080;};'use strict';var pdf=require(_0x498e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x498e('0x1'));var zipdir=require(_0x498e('0x2'));var jsonpatch=require(_0x498e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x498e('0x4'));var Mustache=require(_0x498e('0x5'));var util=require(_0x498e('0x6'));var path=require(_0x498e('0x7'));var sox=require(_0x498e('0x8'));var csv=require(_0x498e('0x9'));var ejs=require(_0x498e('0xa'));var fs=require('fs');var _=require(_0x498e('0xb'));var squel=require(_0x498e('0xc'));var crypto=require(_0x498e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x498e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x498e('0xf'));var Papa=require('papaparse');var Redis=require(_0x498e('0x10'));var authService=require(_0x498e('0x11'));var qs=require(_0x498e('0x12'));var as=require(_0x498e('0x13'));var hardwareService=require(_0x498e('0x14'));var logger=require(_0x498e('0x15'))(_0x498e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x498e('0x17'))['db'];function respondWithStatusCode(_0x184223,_0xfea99c){_0xfea99c=_0xfea99c||0xcc;return function(_0x1275b8){if(_0x1275b8){return _0x184223[_0x498e('0x18')](_0xfea99c);}return _0x184223['status'](_0xfea99c)[_0x498e('0x19')]();};}function respondWithResult(_0x426687,_0x48d77a){_0x48d77a=_0x48d77a||0xc8;return function(_0x13759b){if(_0x13759b){return _0x426687[_0x498e('0x1a')](_0x48d77a)[_0x498e('0x1b')](_0x13759b);}};}function respondWithFilteredResult(_0xcb919f,_0x218f8f){return function(_0x2e7828){if(_0x2e7828){var _0x5296e9=_0x2e7828[_0x498e('0x1c')],_0x278cce=_0x218f8f[_0x498e('0x1d')],_0x47b3c4=_0x218f8f['offset']+_0x218f8f[_0x498e('0x1e')],_0xc6d0ee;if(_0x47b3c4>=_0x5296e9){_0x47b3c4=_0x5296e9;_0xc6d0ee=0xc8;}else{_0xc6d0ee=0xce;}_0xcb919f['status'](_0xc6d0ee);return _0xcb919f[_0x498e('0x1f')](_0x498e('0x20'),_0x278cce+'-'+_0x47b3c4+'/'+_0x5296e9)['json'](_0x2e7828);}return null;};}function patchUpdates(_0x396b47){return function(_0x2c04b8){try{jsonpatch[_0x498e('0x21')](_0x2c04b8,_0x396b47,!![]);}catch(_0x1f7f12){return BPromise[_0x498e('0x22')](_0x1f7f12);}return _0x2c04b8[_0x498e('0x23')]();};}function saveUpdates(_0x5a9f3f,_0x10ba90){return function(_0x18f440){if(_0x18f440){return _0x18f440['update'](_0x5a9f3f)[_0x498e('0x24')](function(_0x467bdc){return _0x467bdc;});}return null;};}function removeEntity(_0x19229e,_0xa72426){return function(_0x443476){if(_0x443476){return _0x443476[_0x498e('0x25')]()[_0x498e('0x24')](function(){_0x19229e[_0x498e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x68b0de,_0x376670){return function(_0x2fbec6){if(!_0x2fbec6){_0x68b0de[_0x498e('0x18')](0x194);}return _0x2fbec6;};}function handleError(_0x5eb30b,_0x33ddde){_0x33ddde=_0x33ddde||0x1f4;return function(_0x3a349f){logger[_0x498e('0x26')](_0x3a349f['stack']);if(_0x3a349f[_0x498e('0x27')]){delete _0x3a349f[_0x498e('0x27')];}_0x5eb30b[_0x498e('0x1a')](_0x33ddde)[_0x498e('0x28')](_0x3a349f);};}exports[_0x498e('0x29')]=function(_0x2f6be6,_0x2c345e){var _0x17005a={},_0xf9b3a4={},_0x10afef={'count':0x0,'rows':[]};var _0x289690=_[_0x498e('0x2a')](db[_0x498e('0x2b')][_0x498e('0x2c')],function(_0x462612){return{'name':_0x462612[_0x498e('0x2d')],'type':_0x462612[_0x498e('0x2e')][_0x498e('0x2f')]};});_0xf9b3a4[_0x498e('0x30')]=_['map'](_0x289690,_0x498e('0x27'));_0xf9b3a4[_0x498e('0x31')]=_[_0x498e('0x32')](_0x2f6be6[_0x498e('0x31')]);_0xf9b3a4['filters']=_[_0x498e('0x33')](_0xf9b3a4[_0x498e('0x30')],_0xf9b3a4['query']);_0x17005a[_0x498e('0x34')]=_[_0x498e('0x33')](_0xf9b3a4[_0x498e('0x30')],qs['fields'](_0x2f6be6[_0x498e('0x31')][_0x498e('0x35')]));_0x17005a[_0x498e('0x34')]=_0x17005a[_0x498e('0x34')][_0x498e('0x36')]?_0x17005a[_0x498e('0x34')]:_0xf9b3a4[_0x498e('0x30')];if(!_0x2f6be6[_0x498e('0x31')][_0x498e('0x37')](_0x498e('0x38'))){_0x17005a[_0x498e('0x1e')]=qs[_0x498e('0x1e')](_0x2f6be6['query'][_0x498e('0x1e')]);_0x17005a[_0x498e('0x1d')]=qs[_0x498e('0x1d')](_0x2f6be6['query']['offset']);}_0x17005a[_0x498e('0x39')]=qs[_0x498e('0x3a')](_0x2f6be6[_0x498e('0x31')][_0x498e('0x3a')]);_0x17005a[_0x498e('0x3b')]=qs[_0x498e('0x3c')](_[_0x498e('0x3d')](_0x2f6be6[_0x498e('0x31')],_0xf9b3a4[_0x498e('0x3c')]),_0x289690);if(_0x2f6be6[_0x498e('0x31')]['filter']){_0x17005a[_0x498e('0x3b')]=_[_0x498e('0x3e')](_0x17005a[_0x498e('0x3b')],{'$or':_['map'](_0x289690,function(_0x58d1a1){if(_0x58d1a1[_0x498e('0x2e')]!==_0x498e('0x3f')){var _0x4d7e0d={};_0x4d7e0d[_0x58d1a1['name']]={'$like':'%'+_0x2f6be6['query'][_0x498e('0x40')]+'%'};return _0x4d7e0d;}})});}_0x17005a=_[_0x498e('0x3e')]({},_0x17005a,_0x2f6be6['options']);var _0xc10c4c={'where':_0x17005a[_0x498e('0x3b')]};return db[_0x498e('0x2b')][_0x498e('0x1c')](_0xc10c4c)[_0x498e('0x24')](function(_0x55542a){_0x10afef[_0x498e('0x1c')]=_0x55542a;if(_0x2f6be6[_0x498e('0x31')]['includeAll']){_0x17005a[_0x498e('0x41')]=[{'all':!![]}];}return db[_0x498e('0x2b')][_0x498e('0x42')](_0x17005a);})[_0x498e('0x24')](function(_0x5832c3){_0x10afef[_0x498e('0x43')]=_0x5832c3;return _0x10afef;})[_0x498e('0x24')](respondWithFilteredResult(_0x2c345e,_0x17005a))[_0x498e('0x44')](handleError(_0x2c345e,null));};exports['show']=function(_0x516d65,_0x53f7ad){var _0x4877cc={'raw':!![],'where':{'id':_0x516d65[_0x498e('0x45')]['id']}},_0xc75a03={};_0xc75a03[_0x498e('0x30')]=_['keys'](db[_0x498e('0x2b')][_0x498e('0x2c')]);_0xc75a03[_0x498e('0x31')]=_['keys'](_0x516d65[_0x498e('0x31')]);_0xc75a03['filters']=_[_0x498e('0x33')](_0xc75a03['model'],_0xc75a03[_0x498e('0x31')]);_0x4877cc[_0x498e('0x34')]=_[_0x498e('0x33')](_0xc75a03[_0x498e('0x30')],qs[_0x498e('0x35')](_0x516d65[_0x498e('0x31')][_0x498e('0x35')]));_0x4877cc[_0x498e('0x34')]=_0x4877cc[_0x498e('0x34')][_0x498e('0x36')]?_0x4877cc['attributes']:_0xc75a03[_0x498e('0x30')];if(_0x516d65[_0x498e('0x31')][_0x498e('0x46')]){_0x4877cc[_0x498e('0x41')]=[{'all':!![]}];}_0x4877cc=_['merge']({},_0x4877cc,_0x516d65[_0x498e('0x47')]);return db[_0x498e('0x2b')][_0x498e('0x48')](_0x4877cc)[_0x498e('0x24')](handleEntityNotFound(_0x53f7ad,null))['then'](respondWithResult(_0x53f7ad,null))[_0x498e('0x44')](handleError(_0x53f7ad,null));};exports['update']=function(_0x46ee98,_0x4526c4){if(_0x46ee98[_0x498e('0x49')]['id']){delete _0x46ee98[_0x498e('0x49')]['id'];}return db[_0x498e('0x2b')]['find']({'where':{'id':_0x46ee98['params']['id']}})[_0x498e('0x24')](handleEntityNotFound(_0x4526c4,null))[_0x498e('0x24')](saveUpdates(_0x46ee98[_0x498e('0x49')],null))[_0x498e('0x24')](respondWithResult(_0x4526c4,null))[_0x498e('0x44')](handleError(_0x4526c4,null));};exports['destroy']=function(_0x529ef7,_0x35a056){return db['CmHopperBlack']['find']({'where':{'id':_0x529ef7['params']['id']}})[_0x498e('0x24')](handleEntityNotFound(_0x35a056,null))[_0x498e('0x24')](removeEntity(_0x35a056,null))[_0x498e('0x44')](handleError(_0x35a056,null));};exports[_0x498e('0x4a')]=function(_0x56a9a9,_0x2d9d10){return db[_0x498e('0x2b')][_0x498e('0x4a')]()[_0x498e('0x24')](respondWithResult(_0x2d9d10,null))[_0x498e('0x44')](handleError(_0x2d9d10,null));}; \ No newline at end of file +var _0x2217=['findAll','rows','catch','show','params','merge','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll'];(function(_0x175f1b,_0x1a7de0){var _0x2da79a=function(_0x9a0ed7){while(--_0x9a0ed7){_0x175f1b['push'](_0x175f1b['shift']());}};_0x2da79a(++_0x1a7de0);}(_0x2217,0x135));var _0x7221=function(_0xd69b80,_0x32a1cf){_0xd69b80=_0xd69b80-0x0;var _0x413583=_0x2217[_0xd69b80];return _0x413583;};'use strict';var pdf=require(_0x7221('0x0'));var emlformat=require(_0x7221('0x1'));var rimraf=require(_0x7221('0x2'));var zipdir=require(_0x7221('0x3'));var jsonpatch=require(_0x7221('0x4'));var rp=require('request-promise');var moment=require(_0x7221('0x5'));var BPromise=require(_0x7221('0x6'));var Mustache=require('mustache');var util=require(_0x7221('0x7'));var path=require(_0x7221('0x8'));var sox=require(_0x7221('0x9'));var csv=require(_0x7221('0xa'));var ejs=require(_0x7221('0xb'));var fs=require('fs');var _=require(_0x7221('0xc'));var squel=require(_0x7221('0xd'));var crypto=require('crypto');var jsforce=require(_0x7221('0xe'));var deskjs=require(_0x7221('0xf'));var toCsv=require(_0x7221('0xa'));var querystring=require(_0x7221('0x10'));var Papa=require(_0x7221('0x11'));var Redis=require(_0x7221('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7221('0x13'));var as=require(_0x7221('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7221('0x15'))(_0x7221('0x16'));var utils=require(_0x7221('0x17'));var config=require(_0x7221('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7221('0x19'))['db'];function respondWithStatusCode(_0x14a7b1,_0x5a08d3){_0x5a08d3=_0x5a08d3||0xcc;return function(_0x2dac18){if(_0x2dac18){return _0x14a7b1[_0x7221('0x1a')](_0x5a08d3);}return _0x14a7b1['status'](_0x5a08d3)['end']();};}function respondWithResult(_0x14f9f9,_0xb805b7){_0xb805b7=_0xb805b7||0xc8;return function(_0xe5e22c){if(_0xe5e22c){return _0x14f9f9['status'](_0xb805b7)[_0x7221('0x1b')](_0xe5e22c);}};}function respondWithFilteredResult(_0xe8ccfb,_0x51225f){return function(_0x4343f2){if(_0x4343f2){var _0x1f1880=_0x4343f2[_0x7221('0x1c')],_0x4a686a=_0x51225f[_0x7221('0x1d')],_0x2f226c=_0x51225f[_0x7221('0x1d')]+_0x51225f[_0x7221('0x1e')],_0x3f9ac3;if(_0x2f226c>=_0x1f1880){_0x2f226c=_0x1f1880;_0x3f9ac3=0xc8;}else{_0x3f9ac3=0xce;}_0xe8ccfb[_0x7221('0x1f')](_0x3f9ac3);return _0xe8ccfb[_0x7221('0x20')](_0x7221('0x21'),_0x4a686a+'-'+_0x2f226c+'/'+_0x1f1880)['json'](_0x4343f2);}return null;};}function patchUpdates(_0x4e8a5a){return function(_0x4887e8){try{jsonpatch[_0x7221('0x22')](_0x4887e8,_0x4e8a5a,!![]);}catch(_0x43d033){return BPromise[_0x7221('0x23')](_0x43d033);}return _0x4887e8['save']();};}function saveUpdates(_0xd7dba5,_0x131d7d){return function(_0x379dab){if(_0x379dab){return _0x379dab[_0x7221('0x24')](_0xd7dba5)[_0x7221('0x25')](function(_0x5b46dc){return _0x5b46dc;});}return null;};}function removeEntity(_0x4d55e2,_0x3a53b0){return function(_0x3dccdb){if(_0x3dccdb){return _0x3dccdb[_0x7221('0x26')]()[_0x7221('0x25')](function(){_0x4d55e2['status'](0xcc)[_0x7221('0x27')]();});}};}function handleEntityNotFound(_0x19281c,_0x26ca64){return function(_0x533df){if(!_0x533df){_0x19281c[_0x7221('0x1a')](0x194);}return _0x533df;};}function handleError(_0x59c742,_0x16e964){_0x16e964=_0x16e964||0x1f4;return function(_0xa19a47){logger['error'](_0xa19a47[_0x7221('0x28')]);if(_0xa19a47['name']){delete _0xa19a47['name'];}_0x59c742[_0x7221('0x1f')](_0x16e964)[_0x7221('0x29')](_0xa19a47);};}exports['index']=function(_0x2b6489,_0x2a8503){var _0x2177a4={},_0x591190={},_0x55ecfb={'count':0x0,'rows':[]};var _0x525f38=_[_0x7221('0x2a')](db[_0x7221('0x2b')][_0x7221('0x2c')],function(_0x2a47da){return{'name':_0x2a47da[_0x7221('0x2d')],'type':_0x2a47da[_0x7221('0x2e')][_0x7221('0x2f')]};});_0x591190[_0x7221('0x30')]=_[_0x7221('0x2a')](_0x525f38,_0x7221('0x31'));_0x591190['query']=_[_0x7221('0x32')](_0x2b6489[_0x7221('0x33')]);_0x591190[_0x7221('0x34')]=_[_0x7221('0x35')](_0x591190[_0x7221('0x30')],_0x591190[_0x7221('0x33')]);_0x2177a4['attributes']=_[_0x7221('0x35')](_0x591190[_0x7221('0x30')],qs['fields'](_0x2b6489[_0x7221('0x33')][_0x7221('0x36')]));_0x2177a4[_0x7221('0x37')]=_0x2177a4[_0x7221('0x37')][_0x7221('0x38')]?_0x2177a4['attributes']:_0x591190[_0x7221('0x30')];if(!_0x2b6489['query']['hasOwnProperty'](_0x7221('0x39'))){_0x2177a4[_0x7221('0x1e')]=qs['limit'](_0x2b6489[_0x7221('0x33')]['limit']);_0x2177a4['offset']=qs[_0x7221('0x1d')](_0x2b6489['query']['offset']);}_0x2177a4[_0x7221('0x3a')]=qs['sort'](_0x2b6489[_0x7221('0x33')][_0x7221('0x3b')]);_0x2177a4['where']=qs[_0x7221('0x34')](_[_0x7221('0x3c')](_0x2b6489[_0x7221('0x33')],_0x591190['filters']),_0x525f38);if(_0x2b6489[_0x7221('0x33')][_0x7221('0x3d')]){_0x2177a4[_0x7221('0x3e')]=_['merge'](_0x2177a4[_0x7221('0x3e')],{'$or':_[_0x7221('0x2a')](_0x525f38,function(_0x5da7f5){if(_0x5da7f5[_0x7221('0x2e')]!==_0x7221('0x3f')){var _0x4ca880={};_0x4ca880[_0x5da7f5[_0x7221('0x31')]]={'$like':'%'+_0x2b6489[_0x7221('0x33')]['filter']+'%'};return _0x4ca880;}})});}_0x2177a4=_['merge']({},_0x2177a4,_0x2b6489[_0x7221('0x40')]);var _0x545a4e={'where':_0x2177a4[_0x7221('0x3e')]};return db[_0x7221('0x2b')]['count'](_0x545a4e)[_0x7221('0x25')](function(_0x281ebb){_0x55ecfb[_0x7221('0x1c')]=_0x281ebb;if(_0x2b6489['query'][_0x7221('0x41')]){_0x2177a4['include']=[{'all':!![]}];}return db[_0x7221('0x2b')][_0x7221('0x42')](_0x2177a4);})[_0x7221('0x25')](function(_0x35197e){_0x55ecfb[_0x7221('0x43')]=_0x35197e;return _0x55ecfb;})[_0x7221('0x25')](respondWithFilteredResult(_0x2a8503,_0x2177a4))[_0x7221('0x44')](handleError(_0x2a8503,null));};exports[_0x7221('0x45')]=function(_0x42a829,_0x352e56){var _0x267141={'raw':!![],'where':{'id':_0x42a829[_0x7221('0x46')]['id']}},_0xa0b7a8={};_0xa0b7a8[_0x7221('0x30')]=_[_0x7221('0x32')](db['CmHopperBlack']['rawAttributes']);_0xa0b7a8[_0x7221('0x33')]=_[_0x7221('0x32')](_0x42a829['query']);_0xa0b7a8[_0x7221('0x34')]=_['intersection'](_0xa0b7a8[_0x7221('0x30')],_0xa0b7a8[_0x7221('0x33')]);_0x267141[_0x7221('0x37')]=_['intersection'](_0xa0b7a8[_0x7221('0x30')],qs[_0x7221('0x36')](_0x42a829[_0x7221('0x33')]['fields']));_0x267141['attributes']=_0x267141[_0x7221('0x37')][_0x7221('0x38')]?_0x267141[_0x7221('0x37')]:_0xa0b7a8[_0x7221('0x30')];if(_0x42a829[_0x7221('0x33')][_0x7221('0x41')]){_0x267141['include']=[{'all':!![]}];}_0x267141=_[_0x7221('0x47')]({},_0x267141,_0x42a829['options']);return db[_0x7221('0x2b')]['find'](_0x267141)['then'](handleEntityNotFound(_0x352e56,null))[_0x7221('0x25')](respondWithResult(_0x352e56,null))[_0x7221('0x44')](handleError(_0x352e56,null));};exports[_0x7221('0x24')]=function(_0x15c461,_0x382264){if(_0x15c461[_0x7221('0x48')]['id']){delete _0x15c461['body']['id'];}return db[_0x7221('0x2b')]['find']({'where':{'id':_0x15c461[_0x7221('0x46')]['id']}})['then'](handleEntityNotFound(_0x382264,null))[_0x7221('0x25')](saveUpdates(_0x15c461[_0x7221('0x48')],null))[_0x7221('0x25')](respondWithResult(_0x382264,null))[_0x7221('0x44')](handleError(_0x382264,null));};exports['destroy']=function(_0xec5b85,_0x114a13){return db['CmHopperBlack'][_0x7221('0x49')]({'where':{'id':_0xec5b85[_0x7221('0x46')]['id']}})[_0x7221('0x25')](handleEntityNotFound(_0x114a13,null))[_0x7221('0x25')](removeEntity(_0x114a13,null))[_0x7221('0x44')](handleError(_0x114a13,null));};exports['describe']=function(_0x512c40,_0x2c34d6){return db[_0x7221('0x2b')][_0x7221('0x4a')]()[_0x7221('0x25')](respondWithResult(_0x2c34d6,null))[_0x7221('0x44')](handleError(_0x2c34d6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ae2f762..480fd85 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 _0x41f5=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41f5,0x6b));var _0x541f=function(_0x5f0888,_0x339dae){_0x5f0888=_0x5f0888-0x0;var _0x2cbad2=_0x41f5[_0x5f0888];return _0x2cbad2;};'use strict';var _=require(_0x541f('0x0'));var util=require(_0x541f('0x1'));var logger=require(_0x541f('0x2'))(_0x541f('0x3'));var moment=require('moment');var BPromise=require(_0x541f('0x4'));var rp=require(_0x541f('0x5'));var fs=require('fs');var path=require(_0x541f('0x6'));var rimraf=require(_0x541f('0x7'));var config=require(_0x541f('0x8'));var attributes=require(_0x541f('0x9'));module[_0x541f('0xa')]=function(_0x6aae0d,_0x500d4e){return _0x6aae0d[_0x541f('0xb')](_0x541f('0xc'),attributes,{'tableName':_0x541f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e6d=['api','moment','request-promise','rimraf','../../config/environment','exports','define','CmHopperBlack','lodash','util','../../config/logger'];(function(_0x5d52a6,_0x1e89dc){var _0x246da2=function(_0x4268f6){while(--_0x4268f6){_0x5d52a6['push'](_0x5d52a6['shift']());}};_0x246da2(++_0x1e89dc);}(_0x1e6d,0x1b5));var _0xd1e6=function(_0x3b07d7,_0x374e44){_0x3b07d7=_0x3b07d7-0x0;var _0x2a9b53=_0x1e6d[_0x3b07d7];return _0x2a9b53;};'use strict';var _=require(_0xd1e6('0x0'));var util=require(_0xd1e6('0x1'));var logger=require(_0xd1e6('0x2'))(_0xd1e6('0x3'));var moment=require(_0xd1e6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1e6('0x6'));var config=require(_0xd1e6('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xd1e6('0x8')]=function(_0x5bbd2d,_0x33dd0d){return _0x5bbd2d[_0xd1e6('0x9')](_0xd1e6('0xa'),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 bb8599b..40ac65b 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 _0xb3b8=['message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xeaf22b,_0x4ef7ce){var _0x229395=function(_0x18d107){while(--_0x18d107){_0xeaf22b['push'](_0xeaf22b['shift']());}};_0x229395(++_0x4ef7ce);}(_0xb3b8,0x1c2));var _0x8b3b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xb3b8[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0x8b3b('0x0'));var util=require('util');var moment=require(_0x8b3b('0x1'));var BPromise=require(_0x8b3b('0x2'));var rs=require(_0x8b3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b3b('0x4'))['db'];var utils=require(_0x8b3b('0x5'));var logger=require(_0x8b3b('0x6'))(_0x8b3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b3b('0x8'));var client=jayson['client'][_0x8b3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e8fe3,_0x15d995,_0x3f4050){return new BPromise(function(_0x5676ec,_0x599c9c){return client[_0x8b3b('0xa')](_0x2e8fe3,_0x3f4050)['then'](function(_0x337b5d){logger[_0x8b3b('0xb')](_0x8b3b('0xc'),_0x15d995,_0x8b3b('0xd'));logger[_0x8b3b('0xe')](_0x8b3b('0xf'),_0x15d995,'request\x20sent',JSON['stringify'](_0x337b5d));if(_0x337b5d[_0x8b3b('0x10')]){if(_0x337b5d[_0x8b3b('0x10')][_0x8b3b('0x11')]===0x1f4){logger[_0x8b3b('0x10')](_0x8b3b('0xc'),_0x15d995,_0x337b5d['error'][_0x8b3b('0x12')]);return _0x599c9c(_0x337b5d[_0x8b3b('0x10')]['message']);}logger[_0x8b3b('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x15d995,_0x337b5d[_0x8b3b('0x10')][_0x8b3b('0x12')]);return _0x5676ec(_0x337b5d[_0x8b3b('0x10')][_0x8b3b('0x12')]);}else{logger[_0x8b3b('0xb')](_0x8b3b('0xc'),_0x15d995,'request\x20sent');_0x5676ec(_0x337b5d[_0x8b3b('0x13')]['message']);}})[_0x8b3b('0x14')](function(_0x253603){logger[_0x8b3b('0x10')](_0x8b3b('0xc'),_0x15d995,_0x253603);_0x599c9c(_0x253603);});});}exports[_0x8b3b('0x15')]=function(_0x3aa5ab){var _0x761b39=this;return new Promise(function(_0x5d6e38,_0x2ded14){return db[_0x8b3b('0x16')][_0x8b3b('0x17')]({'raw':_0x3aa5ab[_0x8b3b('0x18')]?_0x3aa5ab['options'][_0x8b3b('0x19')]===undefined?!![]:![]:!![],'where':_0x3aa5ab[_0x8b3b('0x18')]?_0x3aa5ab[_0x8b3b('0x18')][_0x8b3b('0x1a')]||null:null,'attributes':_0x3aa5ab[_0x8b3b('0x18')]?_0x3aa5ab[_0x8b3b('0x18')][_0x8b3b('0x1b')]||null:null,'limit':_0x3aa5ab[_0x8b3b('0x18')]?_0x3aa5ab[_0x8b3b('0x18')][_0x8b3b('0x1c')]||null:null,'include':_0x3aa5ab['options']?_0x3aa5ab[_0x8b3b('0x18')][_0x8b3b('0x1d')]?_[_0x8b3b('0x1e')](_0x3aa5ab['options'][_0x8b3b('0x1d')],function(_0xc93ca2){return{'model':db[_0xc93ca2[_0x8b3b('0x1f')]],'as':_0xc93ca2['as'],'attributes':_0xc93ca2['attributes'],'include':_0xc93ca2[_0x8b3b('0x1d')]?_[_0x8b3b('0x1e')](_0xc93ca2['include'],function(_0x38bb35){return{'model':db[_0x38bb35[_0x8b3b('0x1f')]],'as':_0x38bb35['as'],'attributes':_0x38bb35[_0x8b3b('0x1b')],'include':_0x38bb35[_0x8b3b('0x1d')]?_[_0x8b3b('0x1e')](_0x38bb35['include'],function(_0xbe1b3c){return{'model':db[_0xbe1b3c[_0x8b3b('0x1f')]],'as':_0xbe1b3c['as'],'attributes':_0xbe1b3c[_0x8b3b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b3b('0x20')](function(_0x2bb7ea){logger[_0x8b3b('0xb')](_0x8b3b('0x15'),_0x3aa5ab);logger['debug'](_0x8b3b('0x15'),_0x3aa5ab,JSON[_0x8b3b('0x21')](_0x2bb7ea));_0x5d6e38(_0x2bb7ea);})['catch'](function(_0x221ed4){logger[_0x8b3b('0x10')](_0x8b3b('0x15'),_0x221ed4[_0x8b3b('0x12')],_0x3aa5ab);_0x2ded14(_0x761b39[_0x8b3b('0x10')](0x1f4,_0x221ed4[_0x8b3b('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x3ea678){var _0x396060=this;return new Promise(function(_0x570e95,_0x1284db){return db[_0x8b3b('0x16')][_0x8b3b('0x22')](_0x3ea678[_0x8b3b('0x23')],{'raw':_0x3ea678[_0x8b3b('0x18')]?_0x3ea678[_0x8b3b('0x18')][_0x8b3b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea678['options']?_0x3ea678[_0x8b3b('0x18')]['where']||null:null,'attributes':_0x3ea678[_0x8b3b('0x18')]?_0x3ea678[_0x8b3b('0x18')][_0x8b3b('0x1b')]||null:null,'limit':_0x3ea678[_0x8b3b('0x18')]?_0x3ea678[_0x8b3b('0x18')]['limit']||null:null})['then'](function(_0x37b6da){logger[_0x8b3b('0xb')]('UpdateCmHopperBlack',_0x3ea678);logger[_0x8b3b('0xe')](_0x8b3b('0x24'),_0x3ea678,JSON[_0x8b3b('0x21')](_0x37b6da));_0x570e95(_0x37b6da);})[_0x8b3b('0x14')](function(_0x4d9587){logger[_0x8b3b('0x10')](_0x8b3b('0x24'),_0x4d9587[_0x8b3b('0x12')],_0x3ea678);_0x1284db(_0x396060[_0x8b3b('0x10')](0x1f4,_0x4d9587['message']));});});};exports['DestroyCmHopperBlack']=function(_0x318adb){var _0x3b3036=this;return new Promise(function(_0x1bd997,_0x43a461){return db['CmHopperBlack'][_0x8b3b('0x25')]({'where':_0x318adb['options']?_0x318adb[_0x8b3b('0x18')][_0x8b3b('0x1a')]||null:null})[_0x8b3b('0x20')](function(_0x3111e2){logger[_0x8b3b('0xb')](_0x8b3b('0x26'),_0x318adb);logger['debug'](_0x8b3b('0x26'),_0x318adb,JSON[_0x8b3b('0x21')](_0x3111e2));_0x1bd997(_0x3111e2);})['catch'](function(_0x143ec9){logger[_0x8b3b('0x10')](_0x8b3b('0x26'),_0x143ec9[_0x8b3b('0x12')],_0x318adb);_0x43a461(_0x3b3036[_0x8b3b('0x10')](0x1f4,_0x143ec9[_0x8b3b('0x12')]));});});}; \ No newline at end of file +var _0xd947=['message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','stringify','UpdateCmHopperBlack','body','limit','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error'];(function(_0x4de487,_0x51f104){var _0x1f698b=function(_0x58245b){while(--_0x58245b){_0x4de487['push'](_0x4de487['shift']());}};_0x1f698b(++_0x51f104);}(_0xd947,0xfd));var _0x7d94=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd947[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7d94('0x0'));var util=require(_0x7d94('0x1'));var moment=require(_0x7d94('0x2'));var BPromise=require(_0x7d94('0x3'));var rs=require(_0x7d94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d94('0x5'));var logger=require(_0x7d94('0x6'))(_0x7d94('0x7'));var config=require(_0x7d94('0x8'));var jayson=require(_0x7d94('0x9'));var client=jayson[_0x7d94('0xa')][_0x7d94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19de65,_0x93abf,_0x259564){return new BPromise(function(_0x2ccc9f,_0x5ed9d9){return client[_0x7d94('0xc')](_0x19de65,_0x259564)[_0x7d94('0xd')](function(_0x37f5de){logger[_0x7d94('0xe')](_0x7d94('0xf'),_0x93abf,_0x7d94('0x10'));logger[_0x7d94('0x11')](_0x7d94('0x12'),_0x93abf,_0x7d94('0x10'),JSON['stringify'](_0x37f5de));if(_0x37f5de[_0x7d94('0x13')]){if(_0x37f5de[_0x7d94('0x13')]['code']===0x1f4){logger[_0x7d94('0x13')](_0x7d94('0xf'),_0x93abf,_0x37f5de[_0x7d94('0x13')]['message']);return _0x5ed9d9(_0x37f5de['error'][_0x7d94('0x14')]);}logger[_0x7d94('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x93abf,_0x37f5de[_0x7d94('0x13')][_0x7d94('0x14')]);return _0x2ccc9f(_0x37f5de['error'][_0x7d94('0x14')]);}else{logger['info'](_0x7d94('0xf'),_0x93abf,_0x7d94('0x10'));_0x2ccc9f(_0x37f5de[_0x7d94('0x15')][_0x7d94('0x14')]);}})['catch'](function(_0x44c7c6){logger[_0x7d94('0x13')](_0x7d94('0xf'),_0x93abf,_0x44c7c6);_0x5ed9d9(_0x44c7c6);});});}exports[_0x7d94('0x16')]=function(_0x21587c){var _0x178bc1=this;return new Promise(function(_0x15ff78,_0x26a0b5){return db[_0x7d94('0x17')][_0x7d94('0x18')]({'raw':_0x21587c[_0x7d94('0x19')]?_0x21587c[_0x7d94('0x19')][_0x7d94('0x1a')]===undefined?!![]:![]:!![],'where':_0x21587c['options']?_0x21587c['options'][_0x7d94('0x1b')]||null:null,'attributes':_0x21587c[_0x7d94('0x19')]?_0x21587c[_0x7d94('0x19')][_0x7d94('0x1c')]||null:null,'limit':_0x21587c['options']?_0x21587c[_0x7d94('0x19')]['limit']||null:null,'include':_0x21587c['options']?_0x21587c['options'][_0x7d94('0x1d')]?_[_0x7d94('0x1e')](_0x21587c[_0x7d94('0x19')][_0x7d94('0x1d')],function(_0x1f05c9){return{'model':db[_0x1f05c9[_0x7d94('0x1f')]],'as':_0x1f05c9['as'],'attributes':_0x1f05c9[_0x7d94('0x1c')],'include':_0x1f05c9[_0x7d94('0x1d')]?_[_0x7d94('0x1e')](_0x1f05c9[_0x7d94('0x1d')],function(_0x3522ca){return{'model':db[_0x3522ca[_0x7d94('0x1f')]],'as':_0x3522ca['as'],'attributes':_0x3522ca[_0x7d94('0x1c')],'include':_0x3522ca[_0x7d94('0x1d')]?_[_0x7d94('0x1e')](_0x3522ca['include'],function(_0x423408){return{'model':db[_0x423408['model']],'as':_0x423408['as'],'attributes':_0x423408[_0x7d94('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d94('0xd')](function(_0x22026e){logger['info'](_0x7d94('0x16'),_0x21587c);logger[_0x7d94('0x11')]('GetCmHopperBlack',_0x21587c,JSON[_0x7d94('0x20')](_0x22026e));_0x15ff78(_0x22026e);})['catch'](function(_0x266ba4){logger[_0x7d94('0x13')](_0x7d94('0x16'),_0x266ba4[_0x7d94('0x14')],_0x21587c);_0x26a0b5(_0x178bc1[_0x7d94('0x13')](0x1f4,_0x266ba4[_0x7d94('0x14')]));});});};exports[_0x7d94('0x21')]=function(_0xab8cf7){var _0x2ec02e=this;return new Promise(function(_0x4782eb,_0x3b6d21){return db['CmHopperBlack']['update'](_0xab8cf7[_0x7d94('0x22')],{'raw':_0xab8cf7[_0x7d94('0x19')]?_0xab8cf7[_0x7d94('0x19')][_0x7d94('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xab8cf7[_0x7d94('0x19')]?_0xab8cf7[_0x7d94('0x19')][_0x7d94('0x1b')]||null:null,'attributes':_0xab8cf7[_0x7d94('0x19')]?_0xab8cf7[_0x7d94('0x19')][_0x7d94('0x1c')]||null:null,'limit':_0xab8cf7['options']?_0xab8cf7[_0x7d94('0x19')][_0x7d94('0x23')]||null:null})[_0x7d94('0xd')](function(_0x482607){logger[_0x7d94('0xe')](_0x7d94('0x21'),_0xab8cf7);logger[_0x7d94('0x11')](_0x7d94('0x21'),_0xab8cf7,JSON[_0x7d94('0x20')](_0x482607));_0x4782eb(_0x482607);})[_0x7d94('0x24')](function(_0x57e3cb){logger[_0x7d94('0x13')](_0x7d94('0x21'),_0x57e3cb[_0x7d94('0x14')],_0xab8cf7);_0x3b6d21(_0x2ec02e['error'](0x1f4,_0x57e3cb[_0x7d94('0x14')]));});});};exports[_0x7d94('0x25')]=function(_0x1527c0){var _0x50623f=this;return new Promise(function(_0x2cc0e2,_0x21b978){return db[_0x7d94('0x17')][_0x7d94('0x26')]({'where':_0x1527c0[_0x7d94('0x19')]?_0x1527c0['options']['where']||null:null})[_0x7d94('0xd')](function(_0x17136c){logger[_0x7d94('0xe')](_0x7d94('0x25'),_0x1527c0);logger[_0x7d94('0x11')]('DestroyCmHopperBlack',_0x1527c0,JSON[_0x7d94('0x20')](_0x17136c));_0x2cc0e2(_0x17136c);})[_0x7d94('0x24')](function(_0x13f6cb){logger[_0x7d94('0x13')]('DestroyCmHopperBlack',_0x13f6cb[_0x7d94('0x14')],_0x1527c0);_0x21b978(_0x50623f[_0x7d94('0x13')](0x1f4,_0x13f6cb['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f97620b..b488ba4 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 _0xee14=['/describe','isAuthenticated','describe','/:id','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index'];(function(_0x35a9fd,_0x540c82){var _0x26242e=function(_0x581b0f){while(--_0x581b0f){_0x35a9fd['push'](_0x35a9fd['shift']());}};_0x26242e(++_0x540c82);}(_0xee14,0x13a));var _0x4ee1=function(_0x36a1ff,_0x2ffdae){_0x36a1ff=_0x36a1ff-0x0;var _0x3dd962=_0xee14[_0x36a1ff];return _0x3dd962;};'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('0x8')](_0x4ee1('0xd'),auth[_0x4ee1('0xb')](),controller['show']);router[_0x4ee1('0xe')](_0x4ee1('0xd'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')](_0x4ee1('0xd'),auth[_0x4ee1('0xb')](),controller['destroy']);module[_0x4ee1('0x11')]=router; \ No newline at end of file +var _0xfd28=['index','/describe','/:id','put','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3faa45,_0x6637c3){var _0x2c8441=function(_0x13b6ad){while(--_0x13b6ad){_0x3faa45['push'](_0x3faa45['shift']());}};_0x2c8441(++_0x6637c3);}(_0xfd28,0x148));var _0x8fd2=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xfd28[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8fd2('0x6')](_0x8fd2('0xa'),auth[_0x8fd2('0x7')](),controller['show']);router[_0x8fd2('0xb')]('/:id',auth[_0x8fd2('0x7')](),controller['update']);router[_0x8fd2('0xc')]('/:id',auth[_0x8fd2('0x7')](),controller['destroy']);module[_0x8fd2('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f59392e..0792bcd 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 _0xb4b1=['INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xb4b1,0x18a));var _0x1b4b=function(_0xef40c4,_0x1551f8){_0xef40c4=_0xef40c4-0x0;var _0x11d743=_0xb4b1[_0xef40c4];return _0x11d743;};'use strict';var Sequelize=require(_0x1b4b('0x0'));var moment=require(_0x1b4b('0x1'));module['exports']={'state':{'type':Sequelize[_0x1b4b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1b4b('0x3')]},'scheduledat':{'type':Sequelize[_0x1b4b('0x4')]},'countbusyretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1b4b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1b4b('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1b4b('0x3')]},'calleridnum':{'type':Sequelize[_0x1b4b('0x3')]},'calleridname':{'type':Sequelize[_0x1b4b('0x3')]},'starttime':{'type':Sequelize[_0x1b4b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1b4b('0x4')]},'droptime':{'type':Sequelize[_0x1b4b('0x4')]},'endtime':{'type':Sequelize[_0x1b4b('0x4')]},'ringtime':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1b4b('0x3')]},'campaigntype':{'type':Sequelize[_0x1b4b('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1b4b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1b4b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1b4b('0x3')]},'dispositionat':{'type':Sequelize[_0x1b4b('0x4')],'set':function(_0x1071fe){var _0x441ec8=this['getDataValue'](_0x1b4b('0x5'));if(_0x441ec8&&_0x1071fe){this[_0x1b4b('0x6')](_0x1b4b('0x7'),moment(_0x1071fe)[_0x1b4b('0x8')](moment(_0x441ec8),_0x1b4b('0x9')));}return this[_0x1b4b('0x6')]('dispositionat',_0x1071fe);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1b4b('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1b4b('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1b4b('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1b4b('0x4')]},'callback':{'type':Sequelize[_0x1b4b('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1b4b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x1b4b('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1b4b('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1b4b('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf864=['setDataValue','diff','seconds','dispositionat','BOOLEAN','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf864,0x1de));var _0x4f86=function(_0x55f7a8,_0x37b78b){_0x55f7a8=_0x55f7a8-0x0;var _0x56157f=_0xf864[_0x55f7a8];return _0x56157f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4f86('0x0'));module['exports']={'state':{'type':Sequelize[_0x4f86('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4f86('0x2')]},'scheduledat':{'type':Sequelize[_0x4f86('0x3')]},'countbusyretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4f86('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4f86('0x2')]},'calleridnum':{'type':Sequelize[_0x4f86('0x2')]},'calleridname':{'type':Sequelize[_0x4f86('0x2')]},'starttime':{'type':Sequelize[_0x4f86('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4f86('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4f86('0x2')]},'campaign':{'type':Sequelize[_0x4f86('0x2')]},'campaigntype':{'type':Sequelize[_0x4f86('0x2')]},'membername':{'type':Sequelize[_0x4f86('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x4f86('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4f86('0x2')]},'dispositionat':{'type':Sequelize[_0x4f86('0x3')],'set':function(_0x479013){var _0x19d407=this[_0x4f86('0x4')](_0x4f86('0x5'));if(_0x19d407&&_0x479013){this[_0x4f86('0x6')]('followuptime',moment(_0x479013)[_0x4f86('0x7')](moment(_0x19d407),_0x4f86('0x8')));}return this[_0x4f86('0x6')](_0x4f86('0x9'),_0x479013);}},'amd':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4f86('0x3')]},'callback':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f86('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f86('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4f86('0x3')]},'recallme':{'type':Sequelize[_0x4f86('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4f86('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f86('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 89765f9..c2868a8 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 _0x5089=['where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','from','state\x20=\x204','group','Campaign','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','stack','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0xa04daf,_0x25e602){var _0x3f7fa6=function(_0x41b149){while(--_0x41b149){_0xa04daf['push'](_0xa04daf['shift']());}};_0x3f7fa6(++_0x25e602);}(_0x5089,0x1bb));var _0x9508=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0x5089[_0x5e2489];return _0xa87596;};'use strict';var pdf=require(_0x9508('0x0'));var emlformat=require(_0x9508('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9508('0x2'));var jsonpatch=require(_0x9508('0x3'));var rp=require(_0x9508('0x4'));var moment=require(_0x9508('0x5'));var BPromise=require(_0x9508('0x6'));var Mustache=require('mustache');var util=require(_0x9508('0x7'));var path=require('path');var sox=require(_0x9508('0x8'));var csv=require(_0x9508('0x9'));var ejs=require(_0x9508('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9508('0xb'));var crypto=require(_0x9508('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9508('0xd'));var toCsv=require(_0x9508('0x9'));var querystring=require('querystring');var Papa=require(_0x9508('0xe'));var Redis=require('ioredis');var authService=require(_0x9508('0xf'));var qs=require(_0x9508('0x10'));var as=require(_0x9508('0x11'));var hardwareService=require(_0x9508('0x12'));var logger=require(_0x9508('0x13'))(_0x9508('0x14'));var utils=require('../../config/utils');var config=require(_0x9508('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9508('0x16'))['db'];function respondWithStatusCode(_0x396896,_0x554c90){_0x554c90=_0x554c90||0xcc;return function(_0x11dc7f){if(_0x11dc7f){return _0x396896[_0x9508('0x17')](_0x554c90);}return _0x396896[_0x9508('0x18')](_0x554c90)[_0x9508('0x19')]();};}function respondWithResult(_0x51ef92,_0x440709){_0x440709=_0x440709||0xc8;return function(_0x21b2d1){if(_0x21b2d1){return _0x51ef92['status'](_0x440709)[_0x9508('0x1a')](_0x21b2d1);}};}function respondWithFilteredResult(_0x539746,_0x25d4d6){return function(_0x418889){if(_0x418889){var _0x374c03=_0x418889[_0x9508('0x1b')],_0x255a03=_0x25d4d6[_0x9508('0x1c')],_0x127340=_0x25d4d6['offset']+_0x25d4d6[_0x9508('0x1d')],_0x343802;if(_0x127340>=_0x374c03){_0x127340=_0x374c03;_0x343802=0xc8;}else{_0x343802=0xce;}_0x539746[_0x9508('0x18')](_0x343802);return _0x539746[_0x9508('0x1e')](_0x9508('0x1f'),_0x255a03+'-'+_0x127340+'/'+_0x374c03)[_0x9508('0x1a')](_0x418889);}return null;};}function patchUpdates(_0x22a9fe){return function(_0x52e3c4){try{jsonpatch['apply'](_0x52e3c4,_0x22a9fe,!![]);}catch(_0x17e43c){return BPromise['reject'](_0x17e43c);}return _0x52e3c4[_0x9508('0x20')]();};}function saveUpdates(_0x4e9e9f,_0x3ba927){return function(_0x22ff69){if(_0x22ff69){return _0x22ff69[_0x9508('0x21')](_0x4e9e9f)[_0x9508('0x22')](function(_0x1edf1b){return _0x1edf1b;});}return null;};}function removeEntity(_0x2f8106,_0x20eb53){return function(_0x5f4f0c){if(_0x5f4f0c){return _0x5f4f0c['destroy']()[_0x9508('0x22')](function(){_0x2f8106[_0x9508('0x18')](0xcc)[_0x9508('0x19')]();});}};}function handleEntityNotFound(_0xf70830,_0x16c54f){return function(_0x20d2ce){if(!_0x20d2ce){_0xf70830['sendStatus'](0x194);}return _0x20d2ce;};}function handleError(_0x5e9a80,_0x46d23f){_0x46d23f=_0x46d23f||0x1f4;return function(_0x55cc4d){logger['error'](_0x55cc4d[_0x9508('0x23')]);if(_0x55cc4d['name']){delete _0x55cc4d['name'];}_0x5e9a80[_0x9508('0x18')](_0x46d23f)[_0x9508('0x24')](_0x55cc4d);};}exports['index']=function(_0x49246b,_0x32b0dd){var _0x22b2e2={},_0x4529a8={},_0x1f7755={'count':0x0,'rows':[]};var _0x175088=_[_0x9508('0x25')](db[_0x9508('0x26')][_0x9508('0x27')],function(_0x24df6){return{'name':_0x24df6[_0x9508('0x28')],'type':_0x24df6['type'][_0x9508('0x29')]};});_0x4529a8[_0x9508('0x2a')]=_[_0x9508('0x25')](_0x175088,'name');_0x4529a8[_0x9508('0x2b')]=_[_0x9508('0x2c')](_0x49246b['query']);_0x4529a8[_0x9508('0x2d')]=_[_0x9508('0x2e')](_0x4529a8['model'],_0x4529a8[_0x9508('0x2b')]);_0x22b2e2[_0x9508('0x2f')]=_[_0x9508('0x2e')](_0x4529a8[_0x9508('0x2a')],qs['fields'](_0x49246b['query'][_0x9508('0x30')]));_0x22b2e2[_0x9508('0x2f')]=_0x22b2e2[_0x9508('0x2f')]['length']?_0x22b2e2['attributes']:_0x4529a8[_0x9508('0x2a')];if(!_0x49246b[_0x9508('0x2b')][_0x9508('0x31')](_0x9508('0x32'))){_0x22b2e2[_0x9508('0x1d')]=qs[_0x9508('0x1d')](_0x49246b[_0x9508('0x2b')][_0x9508('0x1d')]);_0x22b2e2[_0x9508('0x1c')]=qs[_0x9508('0x1c')](_0x49246b['query'][_0x9508('0x1c')]);}_0x22b2e2[_0x9508('0x33')]=qs['sort'](_0x49246b[_0x9508('0x2b')][_0x9508('0x34')]);_0x22b2e2[_0x9508('0x35')]=qs[_0x9508('0x2d')](_[_0x9508('0x36')](_0x49246b[_0x9508('0x2b')],_0x4529a8[_0x9508('0x2d')]),_0x175088);if(_0x49246b[_0x9508('0x2b')][_0x9508('0x37')]){_0x22b2e2[_0x9508('0x35')]=_[_0x9508('0x38')](_0x22b2e2['where'],{'$or':_[_0x9508('0x25')](_0x175088,function(_0x5b690e){if(_0x5b690e[_0x9508('0x39')]!==_0x9508('0x3a')){var _0x23a8b6={};_0x23a8b6[_0x5b690e['name']]={'$like':'%'+_0x49246b['query'][_0x9508('0x37')]+'%'};return _0x23a8b6;}})});}_0x22b2e2=_[_0x9508('0x38')]({},_0x22b2e2,_0x49246b[_0x9508('0x3b')]);var _0x41ebd9={'where':_0x22b2e2['where']};return db[_0x9508('0x26')]['count'](_0x41ebd9)[_0x9508('0x22')](function(_0x174e83){_0x1f7755['count']=_0x174e83;if(_0x49246b[_0x9508('0x2b')][_0x9508('0x3c')]){_0x22b2e2['include']=[{'all':!![]}];}return db[_0x9508('0x26')][_0x9508('0x3d')](_0x22b2e2);})[_0x9508('0x22')](function(_0x12fdc6){_0x1f7755['rows']=_0x12fdc6;return _0x1f7755;})['then'](respondWithFilteredResult(_0x32b0dd,_0x22b2e2))[_0x9508('0x3e')](handleError(_0x32b0dd,null));};exports['show']=function(_0x254e7f,_0x22c135){var _0x10e8f5={'raw':!![],'where':{'id':_0x254e7f['params']['id']}},_0x4215e9={};_0x4215e9['model']=_['keys'](db[_0x9508('0x26')]['rawAttributes']);_0x4215e9[_0x9508('0x2b')]=_['keys'](_0x254e7f[_0x9508('0x2b')]);_0x4215e9[_0x9508('0x2d')]=_[_0x9508('0x2e')](_0x4215e9[_0x9508('0x2a')],_0x4215e9['query']);_0x10e8f5[_0x9508('0x2f')]=_[_0x9508('0x2e')](_0x4215e9[_0x9508('0x2a')],qs['fields'](_0x254e7f[_0x9508('0x2b')][_0x9508('0x30')]));_0x10e8f5['attributes']=_0x10e8f5[_0x9508('0x2f')]['length']?_0x10e8f5[_0x9508('0x2f')]:_0x4215e9['model'];if(_0x254e7f['query'][_0x9508('0x3c')]){_0x10e8f5[_0x9508('0x3f')]=[{'all':!![]}];}_0x10e8f5=_[_0x9508('0x38')]({},_0x10e8f5,_0x254e7f[_0x9508('0x3b')]);return db[_0x9508('0x26')][_0x9508('0x40')](_0x10e8f5)['then'](handleEntityNotFound(_0x22c135,null))[_0x9508('0x22')](respondWithResult(_0x22c135,null))[_0x9508('0x3e')](handleError(_0x22c135,null));};exports[_0x9508('0x41')]=function(_0x4c860a,_0x2ee9e){return db[_0x9508('0x26')][_0x9508('0x41')]()[_0x9508('0x22')](respondWithResult(_0x2ee9e,null))['catch'](handleError(_0x2ee9e,null));};exports[_0x9508('0x21')]=function(_0x552d10,_0x155928){if(_0x552d10[_0x9508('0x42')]['uniqueid']){delete _0x552d10[_0x9508('0x42')][_0x9508('0x43')];}return db['CmHopperFinal'][_0x9508('0x40')]({'where':{'uniqueid':_0x552d10[_0x9508('0x44')]['id']}})['then'](handleEntityNotFound(_0x155928,null))[_0x9508('0x22')](saveUpdates(_0x552d10['body'],null))[_0x9508('0x22')](respondWithResult(_0x155928,null))['catch'](handleError(_0x155928,null));};exports[_0x9508('0x45')]=function(_0x55a023,_0x49ac4f,_0x55a158){return db['CmHopperFinal'][_0x9508('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x55a023[_0x9508('0x44')]['id']},'attributes':[[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')](_0x9508('0x49')))),_0x9508('0x4a')],[db['sequelize']['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')](_0x9508('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9508('0x47'),db['sequelize']['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0x9508('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')]['literal'](_0x9508('0x4d')))),_0x9508('0x4e')],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')](_0x9508('0x4f')))),_0x9508('0x50')],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9508('0x51')],[db[_0x9508('0x46')]['fn']('COUNT',db[_0x9508('0x46')]['fn']('IF',db['sequelize']['literal'](_0x9508('0x52')))),_0x9508('0x53')],[db['sequelize']['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db['sequelize'][_0x9508('0x48')](_0x9508('0x54')))),_0x9508('0x55')]]})['then'](handleEntityNotFound(_0x49ac4f,null))[_0x9508('0x22')](respondWithResult(_0x49ac4f,null))[_0x9508('0x3e')](handleError(_0x49ac4f,null));};exports[_0x9508('0x56')]=function(_0x692368,_0xbf76e0,_0x34a4c5){return db['CmHopperFinal'][_0x9508('0x3d')]({'raw':![],'where':{'CampaignId':_0x692368[_0x9508('0x44')]['id']},'attributes':[[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db['sequelize']['fn']('IF',db[_0x9508('0x46')]['literal'](_0x9508('0x49')))),_0x9508('0x4a')],[db['sequelize']['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db['sequelize'][_0x9508('0x48')](_0x9508('0x4b')))),_0x9508('0x57')],[db[_0x9508('0x46')]['fn']('COUNT',db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')](_0x9508('0x58')))),_0x9508('0x4c')],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db['sequelize'][_0x9508('0x48')](_0x9508('0x4d')))),_0x9508('0x4e')],[db['sequelize']['fn'](_0x9508('0x47'),db['sequelize']['fn']('IF',db[_0x9508('0x46')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db['sequelize'][_0x9508('0x48')](_0x9508('0x59')))),_0x9508('0x51')],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x9508('0x48')](_0x9508('0x52')))),_0x9508('0x53')],[db[_0x9508('0x46')]['fn'](_0x9508('0x47'),db[_0x9508('0x46')]['fn']('IF',db[_0x9508('0x46')][_0x9508('0x48')](_0x9508('0x54')))),_0x9508('0x55')]]})[_0x9508('0x22')](handleEntityNotFound(_0xbf76e0,null))[_0x9508('0x22')](respondWithResult(_0xbf76e0,null))['catch'](handleError(_0xbf76e0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2618e2,_0x599ce3,_0x3847ad){return db['VoiceQueue']['find']({'where':{'id':_0x2618e2[_0x9508('0x44')]['id']}})['then'](handleEntityNotFound(_0x599ce3,null))['then'](function(_0x32da5f){var _0x5f67d7;if(_0x32da5f){_0x5f67d7=squel[_0x9508('0x5a')]()[_0x9508('0x5b')](_0x9508('0x5c'))[_0x9508('0x5d')]([_0x9508('0x5e'),_0x9508('0x5f'),_0x9508('0x60'),_0x9508('0x61'),_0x9508('0x62'),_0x9508('0x63'),_0x9508('0x64')],squel[_0x9508('0x65')]()[_0x9508('0x66')]('ANY_VALUE(calleridnum)',_0x9508('0x5e'))['field'](_0x9508('0x67'),_0x9508('0x5f'))[_0x9508('0x66')](_0x9508('0x68'),_0x9508('0x60'))[_0x9508('0x66')](_0x9508('0x69'),_0x9508('0x61'))[_0x9508('0x66')](_0x9508('0x6a'),_0x9508('0x62'))[_0x9508('0x66')]('NOW()',_0x9508('0x63'))[_0x9508('0x66')](_0x9508('0x67'),'updatedAt')['from'](_0x9508('0x6b'))[_0x9508('0x35')](_0x9508('0x6c'),_0x2618e2[_0x9508('0x44')]['id'][_0x9508('0x6d')]())[_0x9508('0x35')](_0x9508('0x6e'),_0x2618e2['body'][_0x9508('0x6f')]['toString']())['where'](_0x9508('0x70'))['where'](_0x9508('0x71'),squel[_0x9508('0x65')]()['field'](_0x9508('0x5e'))['from'](_0x9508('0x5c'))['where'](_0x9508('0x6c'),_0x2618e2[_0x9508('0x44')]['id'][_0x9508('0x6d')]()))[_0x9508('0x35')](_0x9508('0x71'),squel[_0x9508('0x65')]()[_0x9508('0x66')](_0x9508('0x72'))[_0x9508('0x73')](_0x9508('0x6b'))['where'](_0x9508('0x6c'),_0x2618e2[_0x9508('0x44')]['id'][_0x9508('0x6d')]())[_0x9508('0x35')](_0x9508('0x74')))[_0x9508('0x75')]('ContactId'))['toString']();return db[_0x9508('0x46')][_0x9508('0x2b')](_0x5f67d7);}return[];})[_0x9508('0x22')](respondWithResult(_0x599ce3,null))['catch'](handleError(_0x599ce3,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x362512,_0x525ce2,_0x287a1b){return db[_0x9508('0x76')][_0x9508('0x40')]({'where':{'id':_0x362512['params']['id']}})[_0x9508('0x22')](handleEntityNotFound(_0x525ce2,null))[_0x9508('0x22')](function(_0x212d04){var _0x3ea6e0;if(_0x212d04){_0x3ea6e0=squel[_0x9508('0x5a')]()[_0x9508('0x5b')]('cm_hopper')['fromQuery']([_0x9508('0x5e'),_0x9508('0x5f'),'ContactId',_0x9508('0x61'),_0x9508('0x77'),_0x9508('0x63'),'updatedAt'],squel['select']()[_0x9508('0x66')]('ANY_VALUE(calleridnum)',_0x9508('0x5e'))[_0x9508('0x66')](_0x9508('0x67'),_0x9508('0x5f'))['field'](_0x9508('0x68'),_0x9508('0x60'))['field'](_0x9508('0x69'),_0x9508('0x61'))[_0x9508('0x66')]('ANY_VALUE(CampaignId)',_0x9508('0x77'))['field'](_0x9508('0x67'),_0x9508('0x63'))[_0x9508('0x66')](_0x9508('0x67'),_0x9508('0x64'))[_0x9508('0x73')](_0x9508('0x6b'))[_0x9508('0x35')](_0x9508('0x78'),_0x362512[_0x9508('0x44')]['id'][_0x9508('0x6d')]())[_0x9508('0x35')](_0x9508('0x6e'),_0x362512[_0x9508('0x42')][_0x9508('0x6f')][_0x9508('0x6d')]())['where'](_0x9508('0x70'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9508('0x65')]()[_0x9508('0x66')](_0x9508('0x5e'))['from'](_0x9508('0x5c'))[_0x9508('0x35')](_0x9508('0x78'),_0x362512[_0x9508('0x44')]['id'][_0x9508('0x6d')]()))[_0x9508('0x35')](_0x9508('0x71'),squel['select']()[_0x9508('0x66')]('calleridnum')[_0x9508('0x73')](_0x9508('0x6b'))[_0x9508('0x35')](_0x9508('0x78'),_0x362512[_0x9508('0x44')]['id'][_0x9508('0x6d')]())[_0x9508('0x35')](_0x9508('0x74')))[_0x9508('0x75')]('ContactId'))[_0x9508('0x6d')]();return db['sequelize']['query'](_0x3ea6e0);}return[];})[_0x9508('0x22')](respondWithResult(_0x525ce2,null))[_0x9508('0x3e')](handleError(_0x525ce2,null));};exports[_0x9508('0x79')]=function(_0x25e908,_0x5e3e7a,_0x54e7e8){return db[_0x9508('0x7a')][_0x9508('0x7b')]({'where':{'VoiceQueueId':_0x25e908[_0x9508('0x42')]['VoiceQueueId'],'CampaignId':_0x25e908[_0x9508('0x42')]['CampaignId'],'ContactId':_0x25e908['body'][_0x9508('0x60')]}})['then'](handleEntityNotFound(_0x5e3e7a,null))[_0x9508('0x22')](function(_0x1d6547){if(_0x1d6547){return _0x1d6547;}return null;})[_0x9508('0x22')](respondWithResult(_0x5e3e7a,null))[_0x9508('0x3e')](handleError(_0x5e3e7a,null));}; \ No newline at end of file +var _0x70e0=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','set','apply','update','destroy','then','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','params','includeAll','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','into','fromQuery','scheduledAt','ContactId','VoiceQueueId','updatedAt','select','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','Campaign','insert','cm_hopper','CampaignId','ANY_VALUE(calleridnum)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x41b961,_0x301ddb){_0x41b961=_0x41b961-0x0;var _0x1839a9=_0x70e0[_0x41b961];return _0x1839a9;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var licenseUtil=require(_0x070e('0x15'));var db=require(_0x070e('0x16'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x17')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x18')](_0x4a33d2)[_0x070e('0x19')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=_0x373d86['count'],_0x180897=_0x5d3a38[_0x070e('0x1a')],_0x19d9da=_0x5d3a38[_0x070e('0x1a')]+_0x5d3a38[_0x070e('0x1b')],_0x5bc71e;if(_0x19d9da>=_0xeae1a5){_0x19d9da=_0xeae1a5;_0x5bc71e=0xc8;}else{_0x5bc71e=0xce;}_0x51d14d[_0x070e('0x18')](_0x5bc71e);return _0x51d14d[_0x070e('0x1c')]('Content-Range',_0x180897+'-'+_0x19d9da+'/'+_0xeae1a5)[_0x070e('0x19')](_0x373d86);}return null;};}function patchUpdates(_0x168dc6){return function(_0x1ad3de){try{jsonpatch[_0x070e('0x1d')](_0x1ad3de,_0x168dc6,!![]);}catch(_0x259893){return BPromise['reject'](_0x259893);}return _0x1ad3de['save']();};}function saveUpdates(_0x4e958f,_0x9907cf){return function(_0x3004f0){if(_0x3004f0){return _0x3004f0[_0x070e('0x1e')](_0x4e958f)['then'](function(_0x5b184){return _0x5b184;});}return null;};}function removeEntity(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x1f')]()[_0x070e('0x20')](function(){_0x5dc5d2[_0x070e('0x18')](0xcc)[_0x070e('0x17')]();});}};}function handleEntityNotFound(_0xe405e,_0x164cdf){return function(_0x595c7e){if(!_0x595c7e){_0xe405e[_0x070e('0x21')](0x194);}return _0x595c7e;};}function handleError(_0x270061,_0x4790eb){_0x4790eb=_0x4790eb||0x1f4;return function(_0x503f4d){logger[_0x070e('0x22')](_0x503f4d['stack']);if(_0x503f4d['name']){delete _0x503f4d[_0x070e('0x23')];}_0x270061[_0x070e('0x18')](_0x4790eb)[_0x070e('0x24')](_0x503f4d);};}exports[_0x070e('0x25')]=function(_0x4763c6,_0x497f58){var _0x374c54={},_0x219e48={},_0x1d72d6={'count':0x0,'rows':[]};var _0x1d2a34=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x26373b){return{'name':_0x26373b['fieldName'],'type':_0x26373b[_0x070e('0x29')][_0x070e('0x2a')]};});_0x219e48[_0x070e('0x2b')]=_['map'](_0x1d2a34,'name');_0x219e48[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x4763c6[_0x070e('0x2c')]);_0x219e48['filters']=_[_0x070e('0x2e')](_0x219e48[_0x070e('0x2b')],_0x219e48[_0x070e('0x2c')]);_0x374c54[_0x070e('0x2f')]=_['intersection'](_0x219e48['model'],qs['fields'](_0x4763c6['query'][_0x070e('0x30')]));_0x374c54['attributes']=_0x374c54[_0x070e('0x2f')][_0x070e('0x31')]?_0x374c54['attributes']:_0x219e48['model'];if(!_0x4763c6[_0x070e('0x2c')][_0x070e('0x32')]('nolimit')){_0x374c54['limit']=qs[_0x070e('0x1b')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x1b')]);_0x374c54[_0x070e('0x1a')]=qs[_0x070e('0x1a')](_0x4763c6['query']['offset']);}_0x374c54[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x34')]);_0x374c54[_0x070e('0x35')]=qs['filters'](_[_0x070e('0x36')](_0x4763c6[_0x070e('0x2c')],_0x219e48['filters']),_0x1d2a34);if(_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]){_0x374c54['where']=_['merge'](_0x374c54['where'],{'$or':_[_0x070e('0x26')](_0x1d2a34,function(_0x3dfbf7){if(_0x3dfbf7[_0x070e('0x29')]!==_0x070e('0x38')){var _0x33c5f8={};_0x33c5f8[_0x3dfbf7['name']]={'$like':'%'+_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]+'%'};return _0x33c5f8;}})});}_0x374c54=_[_0x070e('0x39')]({},_0x374c54,_0x4763c6['options']);var _0x268c5d={'where':_0x374c54[_0x070e('0x35')]};return db[_0x070e('0x27')]['count'](_0x268c5d)[_0x070e('0x20')](function(_0x348092){_0x1d72d6['count']=_0x348092;if(_0x4763c6[_0x070e('0x2c')]['includeAll']){_0x374c54[_0x070e('0x3a')]=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3b')](_0x374c54);})[_0x070e('0x20')](function(_0xd03404){_0x1d72d6['rows']=_0xd03404;return _0x1d72d6;})[_0x070e('0x20')](respondWithFilteredResult(_0x497f58,_0x374c54))['catch'](handleError(_0x497f58,null));};exports['show']=function(_0x398168,_0x42c448){var _0x38879f={'raw':!![],'where':{'id':_0x398168[_0x070e('0x3c')]['id']}},_0x4d52ff={};_0x4d52ff[_0x070e('0x2b')]=_[_0x070e('0x2d')](db[_0x070e('0x27')]['rawAttributes']);_0x4d52ff[_0x070e('0x2c')]=_['keys'](_0x398168['query']);_0x4d52ff['filters']=_[_0x070e('0x2e')](_0x4d52ff[_0x070e('0x2b')],_0x4d52ff[_0x070e('0x2c')]);_0x38879f[_0x070e('0x2f')]=_[_0x070e('0x2e')](_0x4d52ff['model'],qs[_0x070e('0x30')](_0x398168['query'][_0x070e('0x30')]));_0x38879f[_0x070e('0x2f')]=_0x38879f[_0x070e('0x2f')]['length']?_0x38879f['attributes']:_0x4d52ff[_0x070e('0x2b')];if(_0x398168['query'][_0x070e('0x3d')]){_0x38879f[_0x070e('0x3a')]=[{'all':!![]}];}_0x38879f=_[_0x070e('0x39')]({},_0x38879f,_0x398168['options']);return db[_0x070e('0x27')][_0x070e('0x3e')](_0x38879f)['then'](handleEntityNotFound(_0x42c448,null))['then'](respondWithResult(_0x42c448,null))[_0x070e('0x3f')](handleError(_0x42c448,null));};exports[_0x070e('0x40')]=function(_0x2d43ce,_0x1fc7c4){return db[_0x070e('0x27')]['describe']()[_0x070e('0x20')](respondWithResult(_0x1fc7c4,null))[_0x070e('0x3f')](handleError(_0x1fc7c4,null));};exports[_0x070e('0x1e')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x41')][_0x070e('0x42')]){delete _0x391dee[_0x070e('0x41')][_0x070e('0x42')];}return db[_0x070e('0x27')][_0x070e('0x3e')]({'where':{'uniqueid':_0x391dee[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x41')],null))['then'](respondWithResult(_0x79eaa0,null))[_0x070e('0x3f')](handleError(_0x79eaa0,null));};exports[_0x070e('0x43')]=function(_0x40298a,_0x249e3f,_0x2760fc){return db[_0x070e('0x27')][_0x070e('0x3b')]({'raw':![],'where':{'VoiceQueueId':_0x40298a[_0x070e('0x3c')]['id']},'attributes':[[db[_0x070e('0x44')]['fn']('COUNT',db[_0x070e('0x44')]['fn']('IF',db['sequelize'][_0x070e('0x45')](_0x070e('0x46')))),'noSuchContacts'],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')](_0x070e('0x48')))),_0x070e('0x49')],[db['sequelize']['fn'](_0x070e('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x070e('0x45')](_0x070e('0x4a')))),_0x070e('0x4b')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')]('`state`\x20=\x208,\x201,\x20null'))),_0x070e('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')]['literal'](_0x070e('0x4d')))),_0x070e('0x4e')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0x070e('0x4f')],[db['sequelize']['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')](_0x070e('0x50')))),_0x070e('0x51')]]})['then'](handleEntityNotFound(_0x249e3f,null))[_0x070e('0x20')](respondWithResult(_0x249e3f,null))[_0x070e('0x3f')](handleError(_0x249e3f,null));};exports[_0x070e('0x52')]=function(_0x533431,_0x1d7873,_0x1da803){return db['CmHopperFinal'][_0x070e('0x3b')]({'raw':![],'where':{'CampaignId':_0x533431['params']['id']},'attributes':[[db[_0x070e('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x070e('0x45')](_0x070e('0x46')))),_0x070e('0x53')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db['sequelize'][_0x070e('0x45')]('`state`\x20=\x203,\x201,\x20null'))),_0x070e('0x49')],[db['sequelize']['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db['sequelize'][_0x070e('0x45')]('`state`\x20=\x205,\x201,\x20null'))),_0x070e('0x4b')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')](_0x070e('0x54')))),_0x070e('0x4c')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')][_0x070e('0x45')](_0x070e('0x4d')))),'dropContacts'],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')]['literal'](_0x070e('0x55')))),_0x070e('0x56')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db[_0x070e('0x44')]['fn']('IF',db[_0x070e('0x44')]['literal'](_0x070e('0x57')))),_0x070e('0x4f')],[db[_0x070e('0x44')]['fn'](_0x070e('0x47'),db['sequelize']['fn']('IF',db[_0x070e('0x44')]['literal'](_0x070e('0x50')))),_0x070e('0x51')]]})[_0x070e('0x20')](handleEntityNotFound(_0x1d7873,null))[_0x070e('0x20')](respondWithResult(_0x1d7873,null))[_0x070e('0x3f')](handleError(_0x1d7873,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2e48f9,_0x2e38c6,_0x8cc913){return db[_0x070e('0x58')]['find']({'where':{'id':_0x2e48f9[_0x070e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2e38c6,null))[_0x070e('0x20')](function(_0x44e465){var _0x1214d2;if(_0x44e465){_0x1214d2=squel['insert']()[_0x070e('0x59')]('cm_hopper')[_0x070e('0x5a')](['phone',_0x070e('0x5b'),_0x070e('0x5c'),'ListId',_0x070e('0x5d'),'createdAt',_0x070e('0x5e')],squel[_0x070e('0x5f')]()['field']('ANY_VALUE(calleridnum)',_0x070e('0x60'))[_0x070e('0x61')](_0x070e('0x62'),_0x070e('0x5b'))[_0x070e('0x61')](_0x070e('0x63'),_0x070e('0x5c'))[_0x070e('0x61')](_0x070e('0x64'),_0x070e('0x65'))[_0x070e('0x61')](_0x070e('0x66'),_0x070e('0x5d'))['field'](_0x070e('0x62'),_0x070e('0x67'))['field']('NOW()',_0x070e('0x5e'))[_0x070e('0x68')](_0x070e('0x69'))[_0x070e('0x35')](_0x070e('0x6a'),_0x2e48f9[_0x070e('0x3c')]['id'][_0x070e('0x6b')]())[_0x070e('0x35')](_0x070e('0x6c'),_0x2e48f9[_0x070e('0x41')][_0x070e('0x6d')][_0x070e('0x6b')]())[_0x070e('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x070e('0x5f')]()[_0x070e('0x61')](_0x070e('0x60'))[_0x070e('0x68')]('cm_hopper')[_0x070e('0x35')](_0x070e('0x6a'),_0x2e48f9[_0x070e('0x3c')]['id'][_0x070e('0x6b')]()))[_0x070e('0x35')](_0x070e('0x6e'),squel['select']()[_0x070e('0x61')]('calleridnum')[_0x070e('0x68')](_0x070e('0x69'))[_0x070e('0x35')](_0x070e('0x6a'),_0x2e48f9[_0x070e('0x3c')]['id']['toString']())[_0x070e('0x35')](_0x070e('0x6f')))['group'](_0x070e('0x5c')))[_0x070e('0x6b')]();return db['sequelize'][_0x070e('0x2c')](_0x1214d2);}return[];})[_0x070e('0x20')](respondWithResult(_0x2e38c6,null))[_0x070e('0x3f')](handleError(_0x2e38c6,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x40d7e6,_0xe8c476,_0x134b72){return db[_0x070e('0x70')][_0x070e('0x3e')]({'where':{'id':_0x40d7e6[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xe8c476,null))[_0x070e('0x20')](function(_0x206b97){var _0x31ab81;if(_0x206b97){_0x31ab81=squel[_0x070e('0x71')]()[_0x070e('0x59')](_0x070e('0x72'))['fromQuery']([_0x070e('0x60'),_0x070e('0x5b'),_0x070e('0x5c'),_0x070e('0x65'),_0x070e('0x73'),_0x070e('0x67'),'updatedAt'],squel['select']()['field'](_0x070e('0x74'),_0x070e('0x60'))[_0x070e('0x61')](_0x070e('0x62'),'scheduledAt')[_0x070e('0x61')](_0x070e('0x63'),_0x070e('0x5c'))['field'](_0x070e('0x64'),'ListId')[_0x070e('0x61')](_0x070e('0x75'),'CampaignId')['field'](_0x070e('0x62'),_0x070e('0x67'))['field'](_0x070e('0x62'),'updatedAt')['from']('cm_hopper_final')[_0x070e('0x35')](_0x070e('0x76'),_0x40d7e6[_0x070e('0x3c')]['id'][_0x070e('0x6b')]())[_0x070e('0x35')](_0x070e('0x6c'),_0x40d7e6[_0x070e('0x41')][_0x070e('0x6d')][_0x070e('0x6b')]())[_0x070e('0x35')](_0x070e('0x77'))[_0x070e('0x35')](_0x070e('0x6e'),squel[_0x070e('0x5f')]()[_0x070e('0x61')](_0x070e('0x60'))[_0x070e('0x68')](_0x070e('0x72'))[_0x070e('0x35')](_0x070e('0x76'),_0x40d7e6[_0x070e('0x3c')]['id'][_0x070e('0x6b')]()))['where'](_0x070e('0x6e'),squel[_0x070e('0x5f')]()[_0x070e('0x61')](_0x070e('0x78'))['from'](_0x070e('0x69'))[_0x070e('0x35')](_0x070e('0x76'),_0x40d7e6[_0x070e('0x3c')]['id'][_0x070e('0x6b')]())[_0x070e('0x35')]('state\x20=\x204'))['group']('ContactId'))[_0x070e('0x6b')]();return db['sequelize'][_0x070e('0x2c')](_0x31ab81);}return[];})[_0x070e('0x20')](respondWithResult(_0xe8c476,null))['catch'](handleError(_0xe8c476,null));};exports[_0x070e('0x79')]=function(_0x462c64,_0x4f9a95,_0x56f389){return db[_0x070e('0x7a')][_0x070e('0x7b')]({'where':{'VoiceQueueId':_0x462c64[_0x070e('0x41')][_0x070e('0x5d')],'CampaignId':_0x462c64[_0x070e('0x41')]['CampaignId'],'ContactId':_0x462c64[_0x070e('0x41')]['ContactId']}})[_0x070e('0x20')](handleEntityNotFound(_0x4f9a95,null))[_0x070e('0x20')](function(_0x490641){if(_0x490641){return _0x490641;}return null;})[_0x070e('0x20')](respondWithResult(_0x4f9a95,null))[_0x070e('0x3f')](handleError(_0x4f9a95,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 081d7e1..ed16a1e 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 _0xee81=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31fab3,_0x1fe297){var _0x145ba0=function(_0x44ae81){while(--_0x44ae81){_0x31fab3['push'](_0x31fab3['shift']());}};_0x145ba0(++_0x1fe297);}(_0xee81,0x144));var _0x1ee8=function(_0x1b8880,_0x382d59){_0x1b8880=_0x1b8880-0x0;var _0x144525=_0xee81[_0x1b8880];return _0x144525;};'use strict';var _=require(_0x1ee8('0x0'));var util=require(_0x1ee8('0x1'));var logger=require(_0x1ee8('0x2'))(_0x1ee8('0x3'));var moment=require(_0x1ee8('0x4'));var BPromise=require(_0x1ee8('0x5'));var rp=require(_0x1ee8('0x6'));var fs=require('fs');var path=require(_0x1ee8('0x7'));var rimraf=require(_0x1ee8('0x8'));var config=require(_0x1ee8('0x9'));var attributes=require(_0x1ee8('0xa'));module[_0x1ee8('0xb')]=function(_0x11016d,_0x59b042){return _0x11016d[_0x1ee8('0xc')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x1ee8('0xd'),'fields':[_0x1ee8('0xd')]},{'name':'uniqueid','fields':[_0x1ee8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x835c=['calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final'];(function(_0x4029b1,_0x4a2674){var _0x27ac22=function(_0x500e25){while(--_0x500e25){_0x4029b1['push'](_0x4029b1['shift']());}};_0x27ac22(++_0x4a2674);}(_0x835c,0xa7));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc835('0x0'));var util=require('util');var logger=require(_0xc835('0x1'))(_0xc835('0x2'));var moment=require(_0xc835('0x3'));var BPromise=require(_0xc835('0x4'));var rp=require(_0xc835('0x5'));var fs=require('fs');var path=require(_0xc835('0x6'));var rimraf=require(_0xc835('0x7'));var config=require(_0xc835('0x8'));var attributes=require(_0xc835('0x9'));module['exports']=function(_0x357a8c,_0x114307){return _0x357a8c[_0xc835('0xa')](_0xc835('0xb'),attributes,{'tableName':_0xc835('0xc'),'paranoid':![],'indexes':[{'name':_0xc835('0xd'),'fields':[_0xc835('0xd')]},{'name':_0xc835('0xe'),'fields':[_0xc835('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 53ea2a2..e5eaac2 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 _0x4934=['catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4934,0xcb));var _0x4493=function(_0x4721a1,_0x1bdc35){_0x4721a1=_0x4721a1-0x0;var _0x1c4d89=_0x4934[_0x4721a1];return _0x1c4d89;};'use strict';var _=require(_0x4493('0x0'));var util=require(_0x4493('0x1'));var moment=require(_0x4493('0x2'));var BPromise=require(_0x4493('0x3'));var rs=require(_0x4493('0x4'));var fs=require('fs');var Redis=require(_0x4493('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4493('0x6'));var logger=require(_0x4493('0x7'))(_0x4493('0x8'));var config=require(_0x4493('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4493('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db2b6,_0x291746,_0x4c0e14){return new BPromise(function(_0x247b52,_0x4e4302){return client[_0x4493('0xb')](_0x1db2b6,_0x4c0e14)[_0x4493('0xc')](function(_0x383871){logger[_0x4493('0xd')](_0x4493('0xe'),_0x291746,_0x4493('0xf'));logger[_0x4493('0x10')](_0x4493('0x11'),_0x291746,_0x4493('0xf'),JSON[_0x4493('0x12')](_0x383871));if(_0x383871[_0x4493('0x13')]){if(_0x383871[_0x4493('0x13')]['code']===0x1f4){logger[_0x4493('0x13')](_0x4493('0xe'),_0x291746,_0x383871[_0x4493('0x13')][_0x4493('0x14')]);return _0x4e4302(_0x383871[_0x4493('0x13')][_0x4493('0x14')]);}logger[_0x4493('0x13')](_0x4493('0xe'),_0x291746,_0x383871[_0x4493('0x13')][_0x4493('0x14')]);return _0x247b52(_0x383871[_0x4493('0x13')][_0x4493('0x14')]);}else{logger[_0x4493('0xd')](_0x4493('0xe'),_0x291746,_0x4493('0xf'));_0x247b52(_0x383871['result'][_0x4493('0x14')]);}})[_0x4493('0x15')](function(_0x3abefb){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x291746,_0x3abefb);_0x4e4302(_0x3abefb);});});}exports[_0x4493('0x16')]=function(_0x59255e){var _0x28761d=this;return new Promise(function(_0x597cb7,_0x4a6056){return db[_0x4493('0x17')][_0x4493('0x18')](_0x59255e[_0x4493('0x19')],{'raw':_0x59255e[_0x4493('0x1a')]?_0x59255e[_0x4493('0x1a')][_0x4493('0x1b')]===undefined?!![]:![]:!![]})[_0x4493('0xc')](function(_0x68e222){logger['info']('CreateCmHopperFinal',_0x59255e);logger[_0x4493('0x10')](_0x4493('0x16'),_0x59255e,JSON[_0x4493('0x12')](_0x68e222));_0x597cb7(_0x68e222);})['catch'](function(_0x5c3f75){logger['error'](_0x4493('0x16'),_0x5c3f75[_0x4493('0x14')],_0x59255e);_0x4a6056(_0x28761d[_0x4493('0x13')](0x1f4,_0x5c3f75[_0x4493('0x14')]));});});}; \ No newline at end of file +var _0x9194=['body','options','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateCmHopperFinal','CmHopperFinal'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9194,0x6b));var _0x4919=function(_0x5da082,_0x42d657){_0x5da082=_0x5da082-0x0;var _0x1808eb=_0x9194[_0x5da082];return _0x1808eb;};'use strict';var _=require(_0x4919('0x0'));var util=require(_0x4919('0x1'));var moment=require('moment');var BPromise=require(_0x4919('0x2'));var rs=require(_0x4919('0x3'));var fs=require('fs');var Redis=require(_0x4919('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4919('0x5'));var logger=require(_0x4919('0x6'))(_0x4919('0x7'));var config=require(_0x4919('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cd0b6,_0x4f8467,_0x15e9fd){return new BPromise(function(_0x9c1503,_0x37291b){return client[_0x4919('0x9')](_0x3cd0b6,_0x15e9fd)[_0x4919('0xa')](function(_0x354b03){logger['info'](_0x4919('0xb'),_0x4f8467,_0x4919('0xc'));logger[_0x4919('0xd')](_0x4919('0xe'),_0x4f8467,_0x4919('0xc'),JSON[_0x4919('0xf')](_0x354b03));if(_0x354b03[_0x4919('0x10')]){if(_0x354b03[_0x4919('0x10')][_0x4919('0x11')]===0x1f4){logger[_0x4919('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x4f8467,_0x354b03['error'][_0x4919('0x12')]);return _0x37291b(_0x354b03[_0x4919('0x10')][_0x4919('0x12')]);}logger['error'](_0x4919('0xb'),_0x4f8467,_0x354b03['error'][_0x4919('0x12')]);return _0x9c1503(_0x354b03[_0x4919('0x10')][_0x4919('0x12')]);}else{logger[_0x4919('0x13')](_0x4919('0xb'),_0x4f8467,_0x4919('0xc'));_0x9c1503(_0x354b03[_0x4919('0x14')][_0x4919('0x12')]);}})['catch'](function(_0x21d882){logger[_0x4919('0x10')](_0x4919('0xb'),_0x4f8467,_0x21d882);_0x37291b(_0x21d882);});});}exports[_0x4919('0x15')]=function(_0x3689c4){var _0x30c2e0=this;return new Promise(function(_0x5bf2e9,_0x57162b){return db[_0x4919('0x16')]['create'](_0x3689c4[_0x4919('0x17')],{'raw':_0x3689c4[_0x4919('0x18')]?_0x3689c4[_0x4919('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4919('0xa')](function(_0x390a42){logger[_0x4919('0x13')](_0x4919('0x15'),_0x3689c4);logger[_0x4919('0xd')]('CreateCmHopperFinal',_0x3689c4,JSON['stringify'](_0x390a42));_0x5bf2e9(_0x390a42);})[_0x4919('0x19')](function(_0x39106e){logger[_0x4919('0x10')](_0x4919('0x15'),_0x39106e[_0x4919('0x12')],_0x3689c4);_0x57162b(_0x30c2e0[_0x4919('0x10')](0x1f4,_0x39106e[_0x4919('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ea8f8cd..515ed38 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 _0x6072=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6072,0xfe));var _0x2607=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6072[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2607('0x0'));var util=require(_0x2607('0x1'));var path=require(_0x2607('0x2'));var timeout=require(_0x2607('0x3'));var express=require(_0x2607('0x4'));var router=express[_0x2607('0x5')]();var auth=require(_0x2607('0x6'));var interaction=require(_0x2607('0x7'));var config=require(_0x2607('0x8'));var controller=require(_0x2607('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2607('0xa')]);router[_0x2607('0xb')](_0x2607('0xc'),auth[_0x2607('0xd')](),controller[_0x2607('0xe')]);router[_0x2607('0xb')](_0x2607('0xf'),auth[_0x2607('0xd')](),controller['show']);router[_0x2607('0xb')]('/voice/queue/countAttributes/:id',auth[_0x2607('0xd')](),controller[_0x2607('0x10')]);router[_0x2607('0xb')](_0x2607('0x11'),auth[_0x2607('0xd')](),controller[_0x2607('0x12')]);router[_0x2607('0x13')]('/voice/queue/moveContacts/:id',auth[_0x2607('0xd')](),controller[_0x2607('0x14')]);router['post'](_0x2607('0x15'),auth['isAuthenticated'](),controller[_0x2607('0x16')]);router[_0x2607('0x13')](_0x2607('0x17'),auth[_0x2607('0xd')](),controller['checkContactHopper']);router[_0x2607('0x18')]('/:id',auth[_0x2607('0xd')](),controller['update']);module[_0x2607('0x19')]=router; \ No newline at end of file +var _0x7b98=['/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/checkContactHopper','put','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x23e3f3,_0x385d73){var _0x4a9181=function(_0xda3a6c){while(--_0xda3a6c){_0x23e3f3['push'](_0x23e3f3['shift']());}};_0x4a9181(++_0x385d73);}(_0x7b98,0x154));var _0x87b9=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x7b98[_0x28edda];return _0x21f4a4;};'use strict';var multer=require(_0x87b9('0x0'));var util=require(_0x87b9('0x1'));var path=require('path');var timeout=require(_0x87b9('0x2'));var express=require('express');var router=express[_0x87b9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x87b9('0x4'));var config=require(_0x87b9('0x5'));var controller=require(_0x87b9('0x6'));router[_0x87b9('0x7')]('/',auth['isAuthenticated'](),controller[_0x87b9('0x8')]);router[_0x87b9('0x7')](_0x87b9('0x9'),auth[_0x87b9('0xa')](),controller[_0x87b9('0xb')]);router[_0x87b9('0x7')](_0x87b9('0xc'),auth['isAuthenticated'](),controller[_0x87b9('0xd')]);router[_0x87b9('0x7')](_0x87b9('0xe'),auth[_0x87b9('0xa')](),controller[_0x87b9('0xf')]);router[_0x87b9('0x7')](_0x87b9('0x10'),auth[_0x87b9('0xa')](),controller[_0x87b9('0x11')]);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x87b9('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x87b9('0x12')](_0x87b9('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x87b9('0x14')](_0x87b9('0xc'),auth[_0x87b9('0xa')](),controller['update']);module[_0x87b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1b5c4e5..6c47c93 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 _0x997a=['sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2ca9de,_0x310aa3){var _0x2f7938=function(_0x4e87f5){while(--_0x4e87f5){_0x2ca9de['push'](_0x2ca9de['shift']());}};_0x2f7938(++_0x310aa3);}(_0x997a,0xd2));var _0xa997=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x997a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xa997('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa997('0x1')]},'scheduledat':{'type':Sequelize[_0xa997('0x2')]},'countbusyretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa997('0x1')]},'originatecalleridname':{'type':Sequelize[_0xa997('0x1')]},'calleridnum':{'type':Sequelize[_0xa997('0x1')]},'calleridname':{'type':Sequelize[_0xa997('0x1')]},'starttime':{'type':Sequelize[_0xa997('0x2')]},'responsetime':{'type':Sequelize[_0xa997('0x2')]},'answertime':{'type':Sequelize[_0xa997('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa997('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa997('0x1')]},'membername':{'type':Sequelize[_0xa997('0x1')]},'reason':{'type':Sequelize[_0xa997('0x1')]},'amd':{'type':Sequelize[_0xa997('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa997('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa997('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa997('0x2')]},'recallme':{'type':Sequelize[_0xa997('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa997('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa997('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6476=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x6476,0x16b));var _0x6647=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x6476[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0x6647('0x0'));module[_0x6647('0x1')]={'state':{'type':Sequelize[_0x6647('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6647('0x3')]},'scheduledat':{'type':Sequelize[_0x6647('0x4')]},'countbusyretry':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6647('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6647('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6647('0x3')]},'calleridname':{'type':Sequelize[_0x6647('0x3')]},'starttime':{'type':Sequelize[_0x6647('0x4')]},'responsetime':{'type':Sequelize[_0x6647('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6647('0x4')]},'endtime':{'type':Sequelize[_0x6647('0x4')]},'ringtime':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6647('0x3')]},'campaign':{'type':Sequelize[_0x6647('0x3')]},'campaigntype':{'type':Sequelize[_0x6647('0x3')]},'membername':{'type':Sequelize[_0x6647('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x6647('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6647('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6647('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6647('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6647('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6647('0x4')]},'edited':{'type':Sequelize[_0x6647('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6647('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2a30bf9..7707a6f 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 _0xd599=['sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','map','CmHopperHistory','rawAttributes','fieldName','key','model','name','query','intersection','fields','attributes','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','params','keys','length','includeAll','find','create','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3ba9b6,_0x52fb64){var _0x4dddef=function(_0x34f1b9){while(--_0x34f1b9){_0x3ba9b6['push'](_0x3ba9b6['shift']());}};_0x4dddef(++_0x52fb64);}(_0xd599,0xbf));var _0x9d59=function(_0x1f1500,_0x4d61e7){_0x1f1500=_0x1f1500-0x0;var _0x1ebce8=_0xd599[_0x1f1500];return _0x1ebce8;};'use strict';var pdf=require(_0x9d59('0x0'));var emlformat=require(_0x9d59('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d59('0x2'));var rp=require(_0x9d59('0x3'));var moment=require(_0x9d59('0x4'));var BPromise=require(_0x9d59('0x5'));var Mustache=require(_0x9d59('0x6'));var util=require('util');var path=require(_0x9d59('0x7'));var sox=require(_0x9d59('0x8'));var csv=require(_0x9d59('0x9'));var ejs=require(_0x9d59('0xa'));var fs=require('fs');var _=require(_0x9d59('0xb'));var squel=require('squel');var crypto=require(_0x9d59('0xc'));var jsforce=require(_0x9d59('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9d59('0x9'));var querystring=require(_0x9d59('0xe'));var Papa=require('papaparse');var Redis=require(_0x9d59('0xf'));var authService=require(_0x9d59('0x10'));var qs=require(_0x9d59('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d59('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9d59('0x13'));var licenseUtil=require(_0x9d59('0x14'));var db=require(_0x9d59('0x15'))['db'];function respondWithStatusCode(_0x4fc0b8,_0x226ea6){_0x226ea6=_0x226ea6||0xcc;return function(_0x150766){if(_0x150766){return _0x4fc0b8[_0x9d59('0x16')](_0x226ea6);}return _0x4fc0b8['status'](_0x226ea6)[_0x9d59('0x17')]();};}function respondWithResult(_0x3e8aad,_0x163074){_0x163074=_0x163074||0xc8;return function(_0x3d41f4){if(_0x3d41f4){return _0x3e8aad[_0x9d59('0x18')](_0x163074)[_0x9d59('0x19')](_0x3d41f4);}};}function respondWithFilteredResult(_0x26a080,_0x686207){return function(_0x2509c1){if(_0x2509c1){var _0x22ef62=_0x2509c1['count'],_0x8a54e4=_0x686207[_0x9d59('0x1a')],_0x50fffa=_0x686207[_0x9d59('0x1a')]+_0x686207[_0x9d59('0x1b')],_0x208b5f;if(_0x50fffa>=_0x22ef62){_0x50fffa=_0x22ef62;_0x208b5f=0xc8;}else{_0x208b5f=0xce;}_0x26a080[_0x9d59('0x18')](_0x208b5f);return _0x26a080[_0x9d59('0x1c')](_0x9d59('0x1d'),_0x8a54e4+'-'+_0x50fffa+'/'+_0x22ef62)[_0x9d59('0x19')](_0x2509c1);}return null;};}function patchUpdates(_0x21b0a8){return function(_0x344d3a){try{jsonpatch[_0x9d59('0x1e')](_0x344d3a,_0x21b0a8,!![]);}catch(_0x3df384){return BPromise[_0x9d59('0x1f')](_0x3df384);}return _0x344d3a[_0x9d59('0x20')]();};}function saveUpdates(_0x36fb00,_0x116d6b){return function(_0xc46d7c){if(_0xc46d7c){return _0xc46d7c[_0x9d59('0x21')](_0x36fb00)[_0x9d59('0x22')](function(_0x573aa2){return _0x573aa2;});}return null;};}function removeEntity(_0x3d7986,_0x934ab4){return function(_0x380a08){if(_0x380a08){return _0x380a08[_0x9d59('0x23')]()[_0x9d59('0x22')](function(){_0x3d7986[_0x9d59('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3fa3,_0x3a5fdf){return function(_0x13895b){if(!_0x13895b){_0x1b3fa3[_0x9d59('0x16')](0x194);}return _0x13895b;};}function handleError(_0x1ab3f1,_0x1a489e){_0x1a489e=_0x1a489e||0x1f4;return function(_0x1a827a){logger['error'](_0x1a827a[_0x9d59('0x24')]);if(_0x1a827a['name']){delete _0x1a827a['name'];}_0x1ab3f1[_0x9d59('0x18')](_0x1a489e)['send'](_0x1a827a);};}exports['index']=function(_0x16dcff,_0x3ad32d){var _0x1a343b={},_0x4e123c={},_0x27a114={'count':0x0,'rows':[]};var _0x4bd2b4=_[_0x9d59('0x25')](db[_0x9d59('0x26')][_0x9d59('0x27')],function(_0x330ed7){return{'name':_0x330ed7[_0x9d59('0x28')],'type':_0x330ed7['type'][_0x9d59('0x29')]};});_0x4e123c[_0x9d59('0x2a')]=_[_0x9d59('0x25')](_0x4bd2b4,_0x9d59('0x2b'));_0x4e123c['query']=_['keys'](_0x16dcff[_0x9d59('0x2c')]);_0x4e123c['filters']=_[_0x9d59('0x2d')](_0x4e123c[_0x9d59('0x2a')],_0x4e123c['query']);_0x1a343b['attributes']=_[_0x9d59('0x2d')](_0x4e123c[_0x9d59('0x2a')],qs[_0x9d59('0x2e')](_0x16dcff[_0x9d59('0x2c')][_0x9d59('0x2e')]));_0x1a343b[_0x9d59('0x2f')]=_0x1a343b['attributes']['length']?_0x1a343b[_0x9d59('0x2f')]:_0x4e123c[_0x9d59('0x2a')];if(!_0x16dcff[_0x9d59('0x2c')]['hasOwnProperty']('nolimit')){_0x1a343b[_0x9d59('0x1b')]=qs['limit'](_0x16dcff[_0x9d59('0x2c')][_0x9d59('0x1b')]);_0x1a343b['offset']=qs[_0x9d59('0x1a')](_0x16dcff[_0x9d59('0x2c')][_0x9d59('0x1a')]);}_0x1a343b[_0x9d59('0x30')]=qs[_0x9d59('0x31')](_0x16dcff[_0x9d59('0x2c')][_0x9d59('0x31')]);_0x1a343b[_0x9d59('0x32')]=qs[_0x9d59('0x33')](_[_0x9d59('0x34')](_0x16dcff[_0x9d59('0x2c')],_0x4e123c[_0x9d59('0x33')]),_0x4bd2b4);if(_0x16dcff['query'][_0x9d59('0x35')]){_0x1a343b['where']=_[_0x9d59('0x36')](_0x1a343b['where'],{'$or':_[_0x9d59('0x25')](_0x4bd2b4,function(_0x4854fe){if(_0x4854fe[_0x9d59('0x37')]!==_0x9d59('0x38')){var _0x54e058={};_0x54e058[_0x4854fe['name']]={'$like':'%'+_0x16dcff['query'][_0x9d59('0x35')]+'%'};return _0x54e058;}})});}_0x1a343b=_['merge']({},_0x1a343b,_0x16dcff[_0x9d59('0x39')]);var _0x55bdf8={'where':_0x1a343b['where']};return db[_0x9d59('0x26')]['count'](_0x55bdf8)[_0x9d59('0x22')](function(_0x31d4c8){_0x27a114[_0x9d59('0x3a')]=_0x31d4c8;if(_0x16dcff[_0x9d59('0x2c')]['includeAll']){_0x1a343b[_0x9d59('0x3b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9d59('0x3c')](_0x1a343b);})[_0x9d59('0x22')](function(_0x197d8f){_0x27a114['rows']=_0x197d8f;return _0x27a114;})[_0x9d59('0x22')](respondWithFilteredResult(_0x3ad32d,_0x1a343b))[_0x9d59('0x3d')](handleError(_0x3ad32d,null));};exports['show']=function(_0x44b60a,_0x2107df){var _0x50873a={'raw':!![],'where':{'id':_0x44b60a[_0x9d59('0x3e')]['id']}},_0x53cc8f={};_0x53cc8f['model']=_[_0x9d59('0x3f')](db['CmHopperHistory']['rawAttributes']);_0x53cc8f[_0x9d59('0x2c')]=_[_0x9d59('0x3f')](_0x44b60a[_0x9d59('0x2c')]);_0x53cc8f[_0x9d59('0x33')]=_[_0x9d59('0x2d')](_0x53cc8f[_0x9d59('0x2a')],_0x53cc8f[_0x9d59('0x2c')]);_0x50873a[_0x9d59('0x2f')]=_[_0x9d59('0x2d')](_0x53cc8f[_0x9d59('0x2a')],qs[_0x9d59('0x2e')](_0x44b60a['query'][_0x9d59('0x2e')]));_0x50873a[_0x9d59('0x2f')]=_0x50873a[_0x9d59('0x2f')][_0x9d59('0x40')]?_0x50873a[_0x9d59('0x2f')]:_0x53cc8f[_0x9d59('0x2a')];if(_0x44b60a[_0x9d59('0x2c')][_0x9d59('0x41')]){_0x50873a[_0x9d59('0x3b')]=[{'all':!![]}];}_0x50873a=_[_0x9d59('0x36')]({},_0x50873a,_0x44b60a[_0x9d59('0x39')]);return db[_0x9d59('0x26')][_0x9d59('0x42')](_0x50873a)[_0x9d59('0x22')](handleEntityNotFound(_0x2107df,null))[_0x9d59('0x22')](respondWithResult(_0x2107df,null))[_0x9d59('0x3d')](handleError(_0x2107df,null));};exports[_0x9d59('0x43')]=function(_0xb7e351,_0x4cb33b){return db[_0x9d59('0x26')]['create'](_0xb7e351[_0x9d59('0x44')],{})[_0x9d59('0x22')](respondWithResult(_0x4cb33b,0xc9))[_0x9d59('0x3d')](handleError(_0x4cb33b,null));};exports['describe']=function(_0x3bf333,_0x3e6af4){return db[_0x9d59('0x26')][_0x9d59('0x45')]()[_0x9d59('0x22')](respondWithResult(_0x3e6af4,null))[_0x9d59('0x3d')](handleError(_0x3e6af4,null));};exports['update']=function(_0x58b01b,_0x1a606a){if(_0x58b01b[_0x9d59('0x44')][_0x9d59('0x46')]){delete _0x58b01b[_0x9d59('0x44')][_0x9d59('0x46')];}return db[_0x9d59('0x26')]['find']({'where':{'uniqueid':_0x58b01b[_0x9d59('0x3e')]['id']}})[_0x9d59('0x22')](handleEntityNotFound(_0x1a606a,null))[_0x9d59('0x22')](saveUpdates(_0x58b01b[_0x9d59('0x44')],null))['then'](respondWithResult(_0x1a606a,null))[_0x9d59('0x3d')](handleError(_0x1a606a,null));}; \ No newline at end of file +var _0xbb88=['request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','catch','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb88,0x18b));var _0x8bb8=function(_0x1604fc,_0x50b748){_0x1604fc=_0x1604fc-0x0;var _0x2244cb=_0xbb88[_0x1604fc];return _0x2244cb;};'use strict';var pdf=require(_0x8bb8('0x0'));var emlformat=require(_0x8bb8('0x1'));var rimraf=require(_0x8bb8('0x2'));var zipdir=require(_0x8bb8('0x3'));var jsonpatch=require(_0x8bb8('0x4'));var rp=require(_0x8bb8('0x5'));var moment=require(_0x8bb8('0x6'));var BPromise=require(_0x8bb8('0x7'));var Mustache=require(_0x8bb8('0x8'));var util=require(_0x8bb8('0x9'));var path=require('path');var sox=require(_0x8bb8('0xa'));var csv=require(_0x8bb8('0xb'));var ejs=require(_0x8bb8('0xc'));var fs=require('fs');var _=require(_0x8bb8('0xd'));var squel=require(_0x8bb8('0xe'));var crypto=require(_0x8bb8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8bb8('0x10'));var toCsv=require(_0x8bb8('0xb'));var querystring=require(_0x8bb8('0x11'));var Papa=require(_0x8bb8('0x12'));var Redis=require(_0x8bb8('0x13'));var authService=require(_0x8bb8('0x14'));var qs=require(_0x8bb8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bb8('0x16'))(_0x8bb8('0x17'));var utils=require(_0x8bb8('0x18'));var config=require(_0x8bb8('0x19'));var licenseUtil=require(_0x8bb8('0x1a'));var db=require(_0x8bb8('0x1b'))['db'];function respondWithStatusCode(_0x25380c,_0x12e582){_0x12e582=_0x12e582||0xcc;return function(_0xe988e1){if(_0xe988e1){return _0x25380c[_0x8bb8('0x1c')](_0x12e582);}return _0x25380c[_0x8bb8('0x1d')](_0x12e582)['end']();};}function respondWithResult(_0x22e725,_0xa8a092){_0xa8a092=_0xa8a092||0xc8;return function(_0x4b57c3){if(_0x4b57c3){return _0x22e725[_0x8bb8('0x1d')](_0xa8a092)[_0x8bb8('0x1e')](_0x4b57c3);}};}function respondWithFilteredResult(_0x3e36de,_0x5afd16){return function(_0x2e0415){if(_0x2e0415){var _0x3119e6=_0x2e0415[_0x8bb8('0x1f')],_0x1af96f=_0x5afd16[_0x8bb8('0x20')],_0x150863=_0x5afd16['offset']+_0x5afd16[_0x8bb8('0x21')],_0x23fd6a;if(_0x150863>=_0x3119e6){_0x150863=_0x3119e6;_0x23fd6a=0xc8;}else{_0x23fd6a=0xce;}_0x3e36de[_0x8bb8('0x1d')](_0x23fd6a);return _0x3e36de[_0x8bb8('0x22')](_0x8bb8('0x23'),_0x1af96f+'-'+_0x150863+'/'+_0x3119e6)[_0x8bb8('0x1e')](_0x2e0415);}return null;};}function patchUpdates(_0x5d0e9f){return function(_0xa70e1a){try{jsonpatch[_0x8bb8('0x24')](_0xa70e1a,_0x5d0e9f,!![]);}catch(_0x35dfa3){return BPromise['reject'](_0x35dfa3);}return _0xa70e1a[_0x8bb8('0x25')]();};}function saveUpdates(_0x3acb5f,_0x5cd3b6){return function(_0x5c9378){if(_0x5c9378){return _0x5c9378[_0x8bb8('0x26')](_0x3acb5f)[_0x8bb8('0x27')](function(_0x3582c5){return _0x3582c5;});}return null;};}function removeEntity(_0x58eb89,_0x2501fc){return function(_0x4dee81){if(_0x4dee81){return _0x4dee81['destroy']()['then'](function(){_0x58eb89['status'](0xcc)[_0x8bb8('0x28')]();});}};}function handleEntityNotFound(_0x59e965,_0x11964f){return function(_0x476287){if(!_0x476287){_0x59e965[_0x8bb8('0x1c')](0x194);}return _0x476287;};}function handleError(_0x519273,_0x218c05){_0x218c05=_0x218c05||0x1f4;return function(_0x2f06e0){logger[_0x8bb8('0x29')](_0x2f06e0[_0x8bb8('0x2a')]);if(_0x2f06e0[_0x8bb8('0x2b')]){delete _0x2f06e0[_0x8bb8('0x2b')];}_0x519273['status'](_0x218c05)[_0x8bb8('0x2c')](_0x2f06e0);};}exports[_0x8bb8('0x2d')]=function(_0x5c8364,_0x8c96e8){var _0x4f4557={},_0x4d3572={},_0x5e8927={'count':0x0,'rows':[]};var _0x3194ea=_[_0x8bb8('0x2e')](db[_0x8bb8('0x2f')][_0x8bb8('0x30')],function(_0x4cd234){return{'name':_0x4cd234[_0x8bb8('0x31')],'type':_0x4cd234[_0x8bb8('0x32')][_0x8bb8('0x33')]};});_0x4d3572[_0x8bb8('0x34')]=_[_0x8bb8('0x2e')](_0x3194ea,'name');_0x4d3572[_0x8bb8('0x35')]=_['keys'](_0x5c8364[_0x8bb8('0x35')]);_0x4d3572[_0x8bb8('0x36')]=_[_0x8bb8('0x37')](_0x4d3572[_0x8bb8('0x34')],_0x4d3572[_0x8bb8('0x35')]);_0x4f4557['attributes']=_['intersection'](_0x4d3572[_0x8bb8('0x34')],qs[_0x8bb8('0x38')](_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x38')]));_0x4f4557[_0x8bb8('0x39')]=_0x4f4557[_0x8bb8('0x39')]['length']?_0x4f4557[_0x8bb8('0x39')]:_0x4d3572[_0x8bb8('0x34')];if(!_0x5c8364['query']['hasOwnProperty'](_0x8bb8('0x3a'))){_0x4f4557[_0x8bb8('0x21')]=qs[_0x8bb8('0x21')](_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x21')]);_0x4f4557[_0x8bb8('0x20')]=qs[_0x8bb8('0x20')](_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x20')]);}_0x4f4557['order']=qs[_0x8bb8('0x3b')](_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x3b')]);_0x4f4557[_0x8bb8('0x3c')]=qs[_0x8bb8('0x36')](_[_0x8bb8('0x3d')](_0x5c8364['query'],_0x4d3572[_0x8bb8('0x36')]),_0x3194ea);if(_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x3e')]){_0x4f4557[_0x8bb8('0x3c')]=_[_0x8bb8('0x3f')](_0x4f4557[_0x8bb8('0x3c')],{'$or':_[_0x8bb8('0x2e')](_0x3194ea,function(_0x4b10a2){if(_0x4b10a2[_0x8bb8('0x32')]!==_0x8bb8('0x40')){var _0x4c1fe6={};_0x4c1fe6[_0x4b10a2[_0x8bb8('0x2b')]]={'$like':'%'+_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x3e')]+'%'};return _0x4c1fe6;}})});}_0x4f4557=_[_0x8bb8('0x3f')]({},_0x4f4557,_0x5c8364[_0x8bb8('0x41')]);var _0x40c8b5={'where':_0x4f4557[_0x8bb8('0x3c')]};return db['CmHopperHistory'][_0x8bb8('0x1f')](_0x40c8b5)[_0x8bb8('0x27')](function(_0x5cddbe){_0x5e8927['count']=_0x5cddbe;if(_0x5c8364[_0x8bb8('0x35')][_0x8bb8('0x42')]){_0x4f4557['include']=[{'all':!![]}];}return db[_0x8bb8('0x2f')][_0x8bb8('0x43')](_0x4f4557);})['then'](function(_0x10f3f5){_0x5e8927[_0x8bb8('0x44')]=_0x10f3f5;return _0x5e8927;})[_0x8bb8('0x27')](respondWithFilteredResult(_0x8c96e8,_0x4f4557))['catch'](handleError(_0x8c96e8,null));};exports[_0x8bb8('0x45')]=function(_0x2a2c51,_0x3ec7e5){var _0x399bc9={'raw':!![],'where':{'id':_0x2a2c51[_0x8bb8('0x46')]['id']}},_0x4842c2={};_0x4842c2[_0x8bb8('0x34')]=_['keys'](db[_0x8bb8('0x2f')][_0x8bb8('0x30')]);_0x4842c2[_0x8bb8('0x35')]=_[_0x8bb8('0x47')](_0x2a2c51[_0x8bb8('0x35')]);_0x4842c2[_0x8bb8('0x36')]=_['intersection'](_0x4842c2[_0x8bb8('0x34')],_0x4842c2[_0x8bb8('0x35')]);_0x399bc9['attributes']=_[_0x8bb8('0x37')](_0x4842c2['model'],qs['fields'](_0x2a2c51[_0x8bb8('0x35')]['fields']));_0x399bc9[_0x8bb8('0x39')]=_0x399bc9['attributes'][_0x8bb8('0x48')]?_0x399bc9[_0x8bb8('0x39')]:_0x4842c2[_0x8bb8('0x34')];if(_0x2a2c51['query']['includeAll']){_0x399bc9[_0x8bb8('0x49')]=[{'all':!![]}];}_0x399bc9=_[_0x8bb8('0x3f')]({},_0x399bc9,_0x2a2c51[_0x8bb8('0x41')]);return db[_0x8bb8('0x2f')][_0x8bb8('0x4a')](_0x399bc9)[_0x8bb8('0x27')](handleEntityNotFound(_0x3ec7e5,null))[_0x8bb8('0x27')](respondWithResult(_0x3ec7e5,null))[_0x8bb8('0x4b')](handleError(_0x3ec7e5,null));};exports[_0x8bb8('0x4c')]=function(_0x101afd,_0x24bc57){return db[_0x8bb8('0x2f')]['create'](_0x101afd['body'],{})[_0x8bb8('0x27')](respondWithResult(_0x24bc57,0xc9))[_0x8bb8('0x4b')](handleError(_0x24bc57,null));};exports[_0x8bb8('0x4d')]=function(_0xb8652d,_0x940319){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x940319,null))['catch'](handleError(_0x940319,null));};exports[_0x8bb8('0x26')]=function(_0x4138bb,_0x20faed){if(_0x4138bb[_0x8bb8('0x4e')][_0x8bb8('0x4f')]){delete _0x4138bb[_0x8bb8('0x4e')][_0x8bb8('0x4f')];}return db[_0x8bb8('0x2f')]['find']({'where':{'uniqueid':_0x4138bb['params']['id']}})[_0x8bb8('0x27')](handleEntityNotFound(_0x20faed,null))[_0x8bb8('0x27')](saveUpdates(_0x4138bb[_0x8bb8('0x4e')],null))[_0x8bb8('0x27')](respondWithResult(_0x20faed,null))[_0x8bb8('0x4b')](handleError(_0x20faed,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d10bfb6..fa3ce6e 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 _0x223b=['request-promise','path','rimraf','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1c348f,_0x519492){var _0x5d8579=function(_0xc36a6e){while(--_0xc36a6e){_0x1c348f['push'](_0x1c348f['shift']());}};_0x5d8579(++_0x519492);}(_0x223b,0x168));var _0xb223=function(_0x178bce,_0x4616cb){_0x178bce=_0x178bce-0x0;var _0x34ef2f=_0x223b[_0x178bce];return _0x34ef2f;};'use strict';var _=require(_0xb223('0x0'));var util=require('util');var logger=require(_0xb223('0x1'))(_0xb223('0x2'));var moment=require(_0xb223('0x3'));var BPromise=require('bluebird');var rp=require(_0xb223('0x4'));var fs=require('fs');var path=require(_0xb223('0x5'));var rimraf=require(_0xb223('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xb223('0x7')]=function(_0x5efdac,_0x3452cc){return _0x5efdac[_0xb223('0x8')](_0xb223('0x9'),attributes,{'tableName':_0xb223('0xa'),'paranoid':![],'indexes':[{'name':_0xb223('0xb'),'fields':[_0xb223('0xb')]},{'name':_0xb223('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9268=['endtime','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history'];(function(_0xb6ea89,_0x345c99){var _0x27d19d=function(_0x3743ab){while(--_0x3743ab){_0xb6ea89['push'](_0xb6ea89['shift']());}};_0x27d19d(++_0x345c99);}(_0x9268,0x161));var _0x8926=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x9268[_0x5401ae];return _0x286068;};'use strict';var _=require(_0x8926('0x0'));var util=require(_0x8926('0x1'));var logger=require('../../config/logger')(_0x8926('0x2'));var moment=require(_0x8926('0x3'));var BPromise=require(_0x8926('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8926('0x5'));var rimraf=require(_0x8926('0x6'));var config=require('../../config/environment');var attributes=require(_0x8926('0x7'));module[_0x8926('0x8')]=function(_0x1a4b69,_0x2eb9aa){return _0x1a4b69['define'](_0x8926('0x9'),attributes,{'tableName':_0x8926('0xa'),'paranoid':![],'indexes':[{'name':_0x8926('0xb'),'fields':[_0x8926('0xb')]},{'name':_0x8926('0xc'),'fields':[_0x8926('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 80d8586..218b429 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 _0x07f7=['outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','col','predictiveIntervalTotalCalls','sequelize','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','COUNT','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x509d3c,_0x4a150e){var _0xd8b8b8=function(_0x29d005){while(--_0x29d005){_0x509d3c['push'](_0x509d3c['shift']());}};_0xd8b8b8(++_0x4a150e);}(_0x07f7,0x1f2));var _0x707f=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x07f7[_0x153e7d];return _0x3c22dd;};'use strict';var _=require('lodash');var util=require(_0x707f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x707f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x707f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x707f('0x3'))(_0x707f('0x4'));var config=require(_0x707f('0x5'));var jayson=require(_0x707f('0x6'));var client=jayson[_0x707f('0x7')][_0x707f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122f97,_0x20fba6,_0x747954){return new BPromise(function(_0x565fb6,_0x8b69e6){return client[_0x707f('0x9')](_0x122f97,_0x747954)[_0x707f('0xa')](function(_0x50a8e1){logger[_0x707f('0xb')](_0x707f('0xc'),_0x20fba6,_0x707f('0xd'));logger[_0x707f('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x20fba6,_0x707f('0xd'),JSON[_0x707f('0xf')](_0x50a8e1));if(_0x50a8e1[_0x707f('0x10')]){if(_0x50a8e1[_0x707f('0x10')][_0x707f('0x11')]===0x1f4){logger[_0x707f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x20fba6,_0x50a8e1[_0x707f('0x10')]['message']);return _0x8b69e6(_0x50a8e1[_0x707f('0x10')][_0x707f('0x12')]);}logger[_0x707f('0x10')](_0x707f('0xc'),_0x20fba6,_0x50a8e1['error'][_0x707f('0x12')]);return _0x565fb6(_0x50a8e1['error'][_0x707f('0x12')]);}else{logger['info'](_0x707f('0xc'),_0x20fba6,_0x707f('0xd'));_0x565fb6(_0x50a8e1[_0x707f('0x13')][_0x707f('0x12')]);}})[_0x707f('0x14')](function(_0x165ea9){logger['error'](_0x707f('0xc'),_0x20fba6,_0x165ea9);_0x8b69e6(_0x165ea9);});});}exports[_0x707f('0x15')]=function(_0x3b9e58){var _0x3f4b5a=this;return new Promise(function(_0x433a4b,_0x3b34aa){return db[_0x707f('0x16')][_0x707f('0x17')](_0x3b9e58[_0x707f('0x18')],{'raw':_0x3b9e58[_0x707f('0x19')]?_0x3b9e58[_0x707f('0x19')][_0x707f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5bab74){logger[_0x707f('0xb')]('CreateCmHopperHistory',_0x3b9e58);logger[_0x707f('0xe')](_0x707f('0x15'),_0x3b9e58,JSON[_0x707f('0xf')](_0x5bab74));_0x433a4b(_0x5bab74);})['catch'](function(_0x3fa77a){logger[_0x707f('0x10')](_0x707f('0x15'),_0x3fa77a[_0x707f('0x12')],_0x3b9e58);_0x3b34aa(_0x3f4b5a['error'](0x1f4,_0x3fa77a[_0x707f('0x12')]));});});};exports[_0x707f('0x1b')]=function(_0x58877b){var _0x1c67b0=this;return new Promise(function(_0x281719,_0x83371b){return db['CmHopperHistory'][_0x707f('0x1c')]({'raw':_0x58877b[_0x707f('0x19')]?_0x58877b[_0x707f('0x19')][_0x707f('0x1a')]===undefined?!![]:![]:!![],'where':_0x58877b[_0x707f('0x19')]?_0x58877b[_0x707f('0x19')][_0x707f('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x707f('0x1e')]('id')),_0x707f('0x1f')],[db[_0x707f('0x20')]['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x707f('0x22')],[db[_0x707f('0x20')]['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x23')))),_0x707f('0x24')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x707f('0x25')],[db[_0x707f('0x20')]['fn'](_0x707f('0x26'),db['sequelize']['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x27')))),_0x707f('0x28')],[db['sequelize']['fn'](_0x707f('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x707f('0x21')](_0x707f('0x29')))),_0x707f('0x2a')]]})[_0x707f('0xa')](function(_0x3bef53){logger[_0x707f('0xb')](_0x707f('0x1b'),_0x58877b);logger[_0x707f('0xe')](_0x707f('0x1b'),_0x58877b,JSON[_0x707f('0xf')](_0x3bef53));_0x281719(_0x3bef53);})[_0x707f('0x14')](function(_0x341f53){logger['error']('AvgHandleTime',_0x341f53[_0x707f('0x12')],_0x58877b);_0x83371b(_0x1c67b0[_0x707f('0x10')](0x1f4,_0x341f53['message']));});});};exports[_0x707f('0x2b')]=function(_0x3f71d5){var _0x47a081=this;return new Promise(function(_0x21b18f,_0x2f56a4){return db[_0x707f('0x16')][_0x707f('0x1c')]({'raw':_0x3f71d5[_0x707f('0x19')]?_0x3f71d5[_0x707f('0x19')][_0x707f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f71d5[_0x707f('0x19')]?_0x3f71d5[_0x707f('0x19')]['where']||null:null,'attributes':[[_0x707f('0x2c'),'name'],[db[_0x707f('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x707f('0x20')]['literal'](_0x707f('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db['sequelize'][_0x707f('0x21')](_0x707f('0x30')))),_0x707f('0x31')],[db[_0x707f('0x20')]['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x32')))),_0x707f('0x33')],[db['sequelize']['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x34')))),_0x707f('0x35')],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x707f('0x2f'),db['sequelize']['fn']('IF',db['sequelize'][_0x707f('0x21')](_0x707f('0x36')))),_0x707f('0x37')],[db['sequelize']['fn'](_0x707f('0x2f'),db['sequelize']['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x38')))),_0x707f('0x39')],[db[_0x707f('0x20')]['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x3b')))),_0x707f('0x3c')],[db['sequelize']['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db['sequelize']['literal'](_0x707f('0x3d')))),_0x707f('0x3e')],[db[_0x707f('0x20')]['fn']('COUNT',db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')]['literal'](_0x707f('0x3f')))),'outboundAnswerAgiCallsDay'],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x40')))),_0x707f('0x3e')],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db['sequelize']['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')](_0x707f('0x41')))),_0x707f('0x42')]],'group':['campaign']})[_0x707f('0xa')](function(_0xee145c){logger[_0x707f('0xb')](_0x707f('0x2b'),_0x3f71d5);logger[_0x707f('0xe')](_0x707f('0x2b'),_0x3f71d5,JSON[_0x707f('0xf')](_0xee145c));_0x21b18f(_0xee145c);})[_0x707f('0x14')](function(_0x1d3749){logger[_0x707f('0x10')](_0x707f('0x2b'),_0x1d3749[_0x707f('0x12')],_0x3f71d5);_0x2f56a4(_0x47a081['error'](0x1f4,_0x1d3749[_0x707f('0x12')]));});});};exports[_0x707f('0x43')]=function(_0x29aaf1){var _0x13dcf4=this;return new Promise(function(_0xeb5efe,_0x261317){return db['CmHopperHistory'][_0x707f('0x1c')]({'raw':_0x29aaf1[_0x707f('0x19')]?_0x29aaf1[_0x707f('0x19')][_0x707f('0x1a')]===undefined?!![]:![]:!![],'where':_0x29aaf1['options']?_0x29aaf1[_0x707f('0x19')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x707f('0x20')]['fn'](_0x707f('0x2f'),db[_0x707f('0x20')][_0x707f('0x1e')]('id')),_0x707f('0x44')],[db['sequelize']['fn'](_0x707f('0x2f'),db[_0x707f('0x20')]['fn']('IF',db[_0x707f('0x20')][_0x707f('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x707f('0x45')]],'group':[_0x707f('0x2c')]})[_0x707f('0xa')](function(_0x4c7341){logger[_0x707f('0xb')](_0x707f('0x43'),_0x29aaf1);logger[_0x707f('0xe')]('GetCampaignHopperHistory',_0x29aaf1,JSON[_0x707f('0xf')](_0x4c7341));_0xeb5efe(_0x4c7341);})['catch'](function(_0x350ba8){logger[_0x707f('0x10')](_0x707f('0x43'),_0x350ba8[_0x707f('0x12')],_0x29aaf1);_0x261317(_0x13dcf4['error'](0x1f4,_0x350ba8[_0x707f('0x12')]));});});}; \ No newline at end of file +var _0x40d2=['`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','stringify','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x40d2,0x1f3));var _0x240d=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x40d2[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0x240d('0x0'));var util=require('util');var moment=require(_0x240d('0x1'));var BPromise=require('bluebird');var rs=require(_0x240d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x240d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x240d('0x4'))(_0x240d('0x5'));var config=require('../../config/environment');var jayson=require(_0x240d('0x6'));var client=jayson['client'][_0x240d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x95fc8c,_0x4b00dc,_0xd704e3){return new BPromise(function(_0x1b26b6,_0x5351e3){return client['request'](_0x95fc8c,_0xd704e3)[_0x240d('0x8')](function(_0x3dcc1a){logger['info'](_0x240d('0x9'),_0x4b00dc,_0x240d('0xa'));logger['debug'](_0x240d('0xb'),_0x4b00dc,_0x240d('0xa'),JSON['stringify'](_0x3dcc1a));if(_0x3dcc1a[_0x240d('0xc')]){if(_0x3dcc1a[_0x240d('0xc')][_0x240d('0xd')]===0x1f4){logger[_0x240d('0xc')](_0x240d('0x9'),_0x4b00dc,_0x3dcc1a[_0x240d('0xc')]['message']);return _0x5351e3(_0x3dcc1a[_0x240d('0xc')][_0x240d('0xe')]);}logger[_0x240d('0xc')](_0x240d('0x9'),_0x4b00dc,_0x3dcc1a['error'][_0x240d('0xe')]);return _0x1b26b6(_0x3dcc1a[_0x240d('0xc')][_0x240d('0xe')]);}else{logger[_0x240d('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x4b00dc,_0x240d('0xa'));_0x1b26b6(_0x3dcc1a[_0x240d('0x10')][_0x240d('0xe')]);}})['catch'](function(_0x334359){logger['error'](_0x240d('0x9'),_0x4b00dc,_0x334359);_0x5351e3(_0x334359);});});}exports[_0x240d('0x11')]=function(_0x13c1a6){var _0x257605=this;return new Promise(function(_0x3beea5,_0x3cff1b){return db[_0x240d('0x12')]['create'](_0x13c1a6[_0x240d('0x13')],{'raw':_0x13c1a6[_0x240d('0x14')]?_0x13c1a6[_0x240d('0x14')][_0x240d('0x15')]===undefined?!![]:![]:!![]})[_0x240d('0x8')](function(_0x3a4047){logger[_0x240d('0xf')](_0x240d('0x11'),_0x13c1a6);logger[_0x240d('0x16')](_0x240d('0x11'),_0x13c1a6,JSON[_0x240d('0x17')](_0x3a4047));_0x3beea5(_0x3a4047);})[_0x240d('0x18')](function(_0x42017d){logger[_0x240d('0xc')](_0x240d('0x11'),_0x42017d['message'],_0x13c1a6);_0x3cff1b(_0x257605[_0x240d('0xc')](0x1f4,_0x42017d[_0x240d('0xe')]));});});};exports[_0x240d('0x19')]=function(_0x5482b2){var _0x2febff=this;return new Promise(function(_0x586639,_0x31e379){return db[_0x240d('0x12')][_0x240d('0x1a')]({'raw':_0x5482b2[_0x240d('0x14')]?_0x5482b2[_0x240d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5482b2[_0x240d('0x14')]?_0x5482b2['options']['where']||null:null,'attributes':[[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')][_0x240d('0x1d')]('id')),_0x240d('0x1e')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db['sequelize'][_0x240d('0x1f')](_0x240d('0x20')))),_0x240d('0x21')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x23')))),_0x240d('0x24')],[db[_0x240d('0x1b')]['fn']('AVG',db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0x240d('0x1b')]['fn'](_0x240d('0x26'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')]['literal'](_0x240d('0x27')))),_0x240d('0x28')]]})[_0x240d('0x8')](function(_0x484d59){logger['info'](_0x240d('0x19'),_0x5482b2);logger[_0x240d('0x16')](_0x240d('0x19'),_0x5482b2,JSON[_0x240d('0x17')](_0x484d59));_0x586639(_0x484d59);})[_0x240d('0x18')](function(_0xc1e002){logger[_0x240d('0xc')](_0x240d('0x19'),_0xc1e002[_0x240d('0xe')],_0x5482b2);_0x31e379(_0x2febff[_0x240d('0xc')](0x1f4,_0xc1e002[_0x240d('0xe')]));});});};exports[_0x240d('0x29')]=function(_0x2d2077){var _0x2db711=this;return new Promise(function(_0x36c2e2,_0x2ab1d3){return db[_0x240d('0x12')][_0x240d('0x1a')]({'raw':_0x2d2077[_0x240d('0x14')]?_0x2d2077['options'][_0x240d('0x15')]===undefined?!![]:![]:!![],'where':_0x2d2077[_0x240d('0x14')]?_0x2d2077[_0x240d('0x14')][_0x240d('0x2a')]||null:null,'attributes':[[_0x240d('0x2b'),_0x240d('0x2c')],[db[_0x240d('0x1b')]['fn']('COUNT',db[_0x240d('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x240d('0x2d')))),_0x240d('0x2e')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x240d('0x1f')](_0x240d('0x2f')))),_0x240d('0x30')],[db['sequelize']['fn']('COUNT',db[_0x240d('0x1b')]['fn']('IF',db['sequelize'][_0x240d('0x1f')](_0x240d('0x20')))),_0x240d('0x31')],[db['sequelize']['fn']('COUNT',db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x32')))),_0x240d('0x33')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x34')))),_0x240d('0x35')],[db['sequelize']['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db['sequelize'][_0x240d('0x1f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x240d('0x36')],[db[_0x240d('0x1b')]['fn']('COUNT',db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0x240d('0x37')],[db['sequelize']['fn'](_0x240d('0x1c'),db['sequelize']['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x38')))),_0x240d('0x39')],[db[_0x240d('0x1b')]['fn']('COUNT',db[_0x240d('0x1b')]['fn']('IF',db['sequelize'][_0x240d('0x1f')](_0x240d('0x3a')))),_0x240d('0x3b')],[db[_0x240d('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x240d('0x1b')][_0x240d('0x1f')](_0x240d('0x3c')))),_0x240d('0x3d')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')]['literal'](_0x240d('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db[_0x240d('0x1b')]['literal'](_0x240d('0x3f')))),_0x240d('0x3d')],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db['sequelize'][_0x240d('0x1f')](_0x240d('0x40')))),_0x240d('0x41')]],'group':[_0x240d('0x2b')]})[_0x240d('0x8')](function(_0x31fe7c){logger[_0x240d('0xf')]('GetVoiceQueueHopperHistory',_0x2d2077);logger[_0x240d('0x16')](_0x240d('0x29'),_0x2d2077,JSON[_0x240d('0x17')](_0x31fe7c));_0x36c2e2(_0x31fe7c);})[_0x240d('0x18')](function(_0x5159af){logger['error'](_0x240d('0x29'),_0x5159af[_0x240d('0xe')],_0x2d2077);_0x2ab1d3(_0x2db711[_0x240d('0xc')](0x1f4,_0x5159af[_0x240d('0xe')]));});});};exports['GetCampaignHopperHistory']=function(_0x47a157){var _0x299bf7=this;return new Promise(function(_0x4e2808,_0x472aeb){return db[_0x240d('0x12')][_0x240d('0x1a')]({'raw':_0x47a157[_0x240d('0x14')]?_0x47a157['options'][_0x240d('0x15')]===undefined?!![]:![]:!![],'where':_0x47a157[_0x240d('0x14')]?_0x47a157[_0x240d('0x14')][_0x240d('0x2a')]||null:null,'attributes':[[_0x240d('0x2b'),'name'],[db['sequelize']['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')][_0x240d('0x1d')]('id')),'ivrTotalCallsDays'],[db[_0x240d('0x1b')]['fn'](_0x240d('0x1c'),db[_0x240d('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x240d('0x2b')]})[_0x240d('0x8')](function(_0x286cb5){logger[_0x240d('0xf')]('GetCampaignHopperHistory',_0x47a157);logger[_0x240d('0x16')](_0x240d('0x42'),_0x47a157,JSON[_0x240d('0x17')](_0x286cb5));_0x4e2808(_0x286cb5);})['catch'](function(_0xf7fd44){logger[_0x240d('0xc')](_0x240d('0x42'),_0xf7fd44[_0x240d('0xe')],_0x47a157);_0x472aeb(_0x299bf7[_0x240d('0xc')](0x1f4,_0xf7fd44[_0x240d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a227e7f..3c04571 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 _0x53f5=['/:id','put','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x53f5,0x198));var _0x553f=function(_0x2be887,_0xf3261a){_0x2be887=_0x2be887-0x0;var _0x48f5fb=_0x53f5[_0x2be887];return _0x48f5fb;};'use strict';var multer=require(_0x553f('0x0'));var util=require(_0x553f('0x1'));var path=require('path');var timeout=require(_0x553f('0x2'));var express=require(_0x553f('0x3'));var router=express['Router']();var auth=require(_0x553f('0x4'));var interaction=require(_0x553f('0x5'));var config=require(_0x553f('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x553f('0x7')]('/',auth[_0x553f('0x8')](),controller[_0x553f('0x9')]);router[_0x553f('0x7')](_0x553f('0xa'),auth[_0x553f('0x8')](),controller[_0x553f('0xb')]);router['get'](_0x553f('0xc'),auth[_0x553f('0x8')](),controller['show']);router['post']('/',auth[_0x553f('0x8')](),controller['create']);router[_0x553f('0xd')](_0x553f('0xc'),auth[_0x553f('0x8')](),controller['update']);module[_0x553f('0xe')]=router; \ No newline at end of file +var _0xba34=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','../../config/environment','./cmHopperHistory.controller'];(function(_0x2c30a4,_0x2e6404){var _0x391cb7=function(_0x33729c){while(--_0x33729c){_0x2c30a4['push'](_0x2c30a4['shift']());}};_0x391cb7(++_0x2e6404);}(_0xba34,0x119));var _0x4ba3=function(_0x34884a,_0x4652df){_0x34884a=_0x34884a-0x0;var _0x14bf0c=_0xba34[_0x34884a];return _0x14bf0c;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x7')](_0x4ba3('0xc'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth[_0x4ba3('0x8')](),controller['update']);module[_0x4ba3('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index fabab5f..78ea98b 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 _0x685f=['exports','STRING','name','sequelize'];(function(_0x1b600b,_0x3bfa91){var _0x3c65c2=function(_0x1b59a1){while(--_0x1b59a1){_0x1b600b['push'](_0x1b600b['shift']());}};_0x3c65c2(++_0x3bfa91);}(_0x685f,0xeb));var _0xf685=function(_0x26a6a8,_0xb10911){_0x26a6a8=_0x26a6a8-0x0;var _0x3ac434=_0x685f[_0x26a6a8];return _0x3ac434;};'use strict';var Sequelize=require(_0xf685('0x0'));module[_0xf685('0x1')]={'name':{'type':Sequelize[_0xf685('0x2')],'unique':_0xf685('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf685('0x2')]},'dialPrefix':{'type':Sequelize[_0xf685('0x2')]}}; \ No newline at end of file +var _0xe0ba=['STRING','name','sequelize'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0xe0ba,0x113));var _0xae0b=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xe0ba[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xae0b('0x0'));module['exports']={'name':{'type':Sequelize[_0xae0b('0x1')],'unique':_0xae0b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae0b('0x1')]},'dialPrefix':{'type':Sequelize[_0xae0b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ad66f63..de308a8 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x1d4ee6,_0x57b25b){var _0x1bd9c0=function(_0xc6bf47){while(--_0xc6bf47){_0x1d4ee6['push'](_0x1d4ee6['shift']());}};_0x1bd9c0(++_0x57b25b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x22c25c,_0x72d021){var _0x3e9c19=function(_0x57482c){while(--_0x57482c){_0x22c25c['push'](_0x22c25c['shift']());}};_0x3e9c19(++_0x72d021);}(_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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 410a0a7..c2183ed 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 _0x2e6d=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4f3c99,_0x51e40c){var _0x344cf=function(_0x6e5cac){while(--_0x6e5cac){_0x4f3c99['push'](_0x4f3c99['shift']());}};_0x344cf(++_0x51e40c);}(_0x2e6d,0x152));var _0xd2e6=function(_0x58f246,_0x43a83c){_0x58f246=_0x58f246-0x0;var _0x14323a=_0x2e6d[_0x58f246];return _0x14323a;};'use strict';var EventEmitter=require(_0xd2e6('0x0'));var CmList=require(_0xd2e6('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xd2e6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2e6('0x3'),'afterDestroy':_0xd2e6('0x4')};function emitEvent(_0x256338){return function(_0x6cfc6e,_0x538edd,_0x5b6136){CmListEvents[_0xd2e6('0x5')](_0x256338+':'+_0x6cfc6e['id'],_0x6cfc6e);CmListEvents['emit'](_0x256338,_0x6cfc6e);_0x5b6136(null);};}for(var e in events){if(events[_0xd2e6('0x6')](e)){var event=events[e];CmList[_0xd2e6('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x3668=['exports','events','../../mysqldb','CmList','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x431821,_0x22f416){var _0x209005=function(_0x3cd4b2){while(--_0x3cd4b2){_0x431821['push'](_0x431821['shift']());}};_0x209005(++_0x22f416);}(_0x3668,0x173));var _0x8366=function(_0x21428a,_0x5842ba){_0x21428a=_0x21428a-0x0;var _0x243fe6=_0x3668[_0x21428a];return _0x243fe6;};'use strict';var EventEmitter=require(_0x8366('0x0'));var CmList=require(_0x8366('0x1'))['db'][_0x8366('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8366('0x3'),'afterUpdate':_0x8366('0x4'),'afterDestroy':_0x8366('0x5')};function emitEvent(_0x40f5f2){return function(_0x34f6ce,_0x972d4a,_0x531dcb){CmListEvents[_0x8366('0x6')](_0x40f5f2+':'+_0x34f6ce['id'],_0x34f6ce);CmListEvents[_0x8366('0x6')](_0x40f5f2,_0x34f6ce);_0x531dcb(null);};}for(var e in events){if(events[_0x8366('0x7')](e)){var event=events[e];CmList[_0x8366('0x8')](e,emitEvent(event));}}module[_0x8366('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 79af2d2..e83004c 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 _0x9070=['cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmList'];(function(_0x101fc,_0x40fa26){var _0x40a4bd=function(_0x114568){while(--_0x114568){_0x101fc['push'](_0x101fc['shift']());}};_0x40a4bd(++_0x40fa26);}(_0x9070,0xb7));var _0x0907=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x9070[_0x350182];return _0x4a0892;};'use strict';var _=require(_0x0907('0x0'));var util=require(_0x0907('0x1'));var logger=require(_0x0907('0x2'))(_0x0907('0x3'));var moment=require(_0x0907('0x4'));var BPromise=require(_0x0907('0x5'));var rp=require(_0x0907('0x6'));var fs=require('fs');var path=require(_0x0907('0x7'));var rimraf=require('rimraf');var config=require(_0x0907('0x8'));var attributes=require('./cmList.attributes');module[_0x0907('0x9')]=function(_0x1a811d,_0x2a64aa){return _0x1a811d[_0x0907('0xa')](_0x0907('0xb'),attributes,{'tableName':_0x0907('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7d1=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0xb7d1,0x172));var _0x1b7d=function(_0x422223,_0x2c03ff){_0x422223=_0x422223-0x0;var _0x40d67d=_0xb7d1[_0x422223];return _0x40d67d;};'use strict';var _=require(_0x1b7d('0x0'));var util=require(_0x1b7d('0x1'));var logger=require(_0x1b7d('0x2'))('api');var moment=require(_0x1b7d('0x3'));var BPromise=require(_0x1b7d('0x4'));var rp=require(_0x1b7d('0x5'));var fs=require('fs');var path=require(_0x1b7d('0x6'));var rimraf=require(_0x1b7d('0x7'));var config=require(_0x1b7d('0x8'));var attributes=require(_0x1b7d('0x9'));module[_0x1b7d('0xa')]=function(_0x183a0a,_0x3be474){return _0x183a0a['define']('CmList',attributes,{'tableName':_0x1b7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 6055592..d69efff 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 _0x7a88=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x7a88,0x132));var _0x87a8=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x7a88[_0x228641];return _0x5d5d78;};'use strict';var _=require('lodash');var util=require(_0x87a8('0x0'));var moment=require(_0x87a8('0x1'));var BPromise=require(_0x87a8('0x2'));var rs=require(_0x87a8('0x3'));var fs=require('fs');var Redis=require(_0x87a8('0x4'));var db=require(_0x87a8('0x5'))['db'];var utils=require(_0x87a8('0x6'));var logger=require('../../config/logger')(_0x87a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x87a8('0x8'));var client=jayson[_0x87a8('0x9')][_0x87a8('0xa')]({'port':0x232a});config[_0x87a8('0xb')]=_[_0x87a8('0xc')](config[_0x87a8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x87a8('0xd'))(new Redis(config['redis']));require(_0x87a8('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a0413,_0xb90b1a,_0x44cd41){return new BPromise(function(_0x16aba3,_0x56f517){return client[_0x87a8('0xf')](_0x4a0413,_0x44cd41)[_0x87a8('0x10')](function(_0x1624ef){logger[_0x87a8('0x11')](_0x87a8('0x12'),_0xb90b1a,'request\x20sent');logger['debug'](_0x87a8('0x13'),_0xb90b1a,_0x87a8('0x14'),JSON['stringify'](_0x1624ef));if(_0x1624ef[_0x87a8('0x15')]){if(_0x1624ef[_0x87a8('0x15')][_0x87a8('0x16')]===0x1f4){logger['error'](_0x87a8('0x12'),_0xb90b1a,_0x1624ef[_0x87a8('0x15')][_0x87a8('0x17')]);return _0x56f517(_0x1624ef[_0x87a8('0x15')][_0x87a8('0x17')]);}logger[_0x87a8('0x15')]('CmList,\x20%s,\x20%s',_0xb90b1a,_0x1624ef[_0x87a8('0x15')]['message']);return _0x16aba3(_0x1624ef['error']['message']);}else{logger['info'](_0x87a8('0x12'),_0xb90b1a,_0x87a8('0x14'));_0x16aba3(_0x1624ef['result']['message']);}})[_0x87a8('0x18')](function(_0x1cda9f){logger[_0x87a8('0x15')](_0x87a8('0x12'),_0xb90b1a,_0x1cda9f);_0x56f517(_0x1cda9f);});});} \ No newline at end of file +var _0x4aaf=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5c13d5,_0x38a129){var _0x361eb9=function(_0x33e1aa){while(--_0x33e1aa){_0x5c13d5['push'](_0x5c13d5['shift']());}};_0x361eb9(++_0x38a129);}(_0x4aaf,0x15f));var _0xf4aa=function(_0x3e4e4b,_0x1ebd40){_0x3e4e4b=_0x3e4e4b-0x0;var _0x3dcb90=_0x4aaf[_0x3e4e4b];return _0x3dcb90;};'use strict';var _=require(_0xf4aa('0x0'));var util=require(_0xf4aa('0x1'));var moment=require(_0xf4aa('0x2'));var BPromise=require(_0xf4aa('0x3'));var rs=require(_0xf4aa('0x4'));var fs=require('fs');var Redis=require(_0xf4aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4aa('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf4aa('0x7'));var jayson=require(_0xf4aa('0x8'));var client=jayson['client'][_0xf4aa('0x9')]({'port':0x232a});config[_0xf4aa('0xa')]=_[_0xf4aa('0xb')](config['redis'],{'host':_0xf4aa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4aa('0xa')]));require(_0xf4aa('0xd'))[_0xf4aa('0xe')](socket);function respondWithRpcPromise(_0x4b5d02,_0x1204d4,_0xf4f3b){return new BPromise(function(_0x39ced5,_0x24d4a4){return client[_0xf4aa('0xf')](_0x4b5d02,_0xf4f3b)['then'](function(_0x1d97e2){logger[_0xf4aa('0x10')](_0xf4aa('0x11'),_0x1204d4,_0xf4aa('0x12'));logger[_0xf4aa('0x13')](_0xf4aa('0x14'),_0x1204d4,_0xf4aa('0x12'),JSON[_0xf4aa('0x15')](_0x1d97e2));if(_0x1d97e2['error']){if(_0x1d97e2[_0xf4aa('0x16')][_0xf4aa('0x17')]===0x1f4){logger[_0xf4aa('0x16')](_0xf4aa('0x11'),_0x1204d4,_0x1d97e2['error']['message']);return _0x24d4a4(_0x1d97e2[_0xf4aa('0x16')]['message']);}logger['error'](_0xf4aa('0x11'),_0x1204d4,_0x1d97e2['error'][_0xf4aa('0x18')]);return _0x39ced5(_0x1d97e2[_0xf4aa('0x16')][_0xf4aa('0x18')]);}else{logger[_0xf4aa('0x10')]('CmList,\x20%s,\x20%s',_0x1204d4,'request\x20sent');_0x39ced5(_0x1d97e2[_0xf4aa('0x19')]['message']);}})[_0xf4aa('0x1a')](function(_0x12bf78){logger[_0xf4aa('0x16')]('CmList,\x20%s,\x20%s',_0x1204d4,_0x12bf78);_0x24d4a4(_0x12bf78);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 94de3c0..3b5c368 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 _0x2159=['save','remove','update','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x11d915,_0x70a125){var _0x247469=function(_0x51215d){while(--_0x51215d){_0x11d915['push'](_0x11d915['shift']());}};_0x247469(++_0x70a125);}(_0x2159,0x17f));var _0x9215=function(_0x19b3a1,_0x23ae25){_0x19b3a1=_0x19b3a1-0x0;var _0x567afb=_0x2159[_0x19b3a1];return _0x567afb;};'use strict';var CmListEvents=require(_0x9215('0x0'));var events=[_0x9215('0x1'),_0x9215('0x2'),_0x9215('0x3')];function createListener(_0x4b113a,_0x1474c7){return function(_0x4ca557){_0x1474c7[_0x9215('0x4')](_0x4b113a,_0x4ca557);};}function removeListener(_0x3128f9,_0x202c8d){return function(){CmListEvents[_0x9215('0x5')](_0x3128f9,_0x202c8d);};}exports[_0x9215('0x6')]=function(_0x1fd854){for(var _0x3be70d=0x0,_0x383bb1=events['length'];_0x3be70d<_0x383bb1;_0x3be70d++){var _0x419fb3=events[_0x3be70d];var _0x245ee1=createListener(_0x9215('0x7')+_0x419fb3,_0x1fd854);CmListEvents['on'](_0x419fb3,_0x245ee1);}}; \ No newline at end of file +var _0x04f1=['length','cmList:','./cmList.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04f1,0x92));var _0x104f=function(_0x2bd991,_0x3d57b9){_0x2bd991=_0x2bd991-0x0;var _0x2c7084=_0x04f1[_0x2bd991];return _0x2c7084;};'use strict';var CmListEvents=require(_0x104f('0x0'));var events=[_0x104f('0x1'),_0x104f('0x2'),'update'];function createListener(_0x49868f,_0x1c9941){return function(_0x442b5d){_0x1c9941[_0x104f('0x3')](_0x49868f,_0x442b5d);};}function removeListener(_0x55c56e,_0x4b4197){return function(){CmListEvents['removeListener'](_0x55c56e,_0x4b4197);};}exports['register']=function(_0x4e767b){for(var _0x20a746=0x0,_0x289bb8=events[_0x104f('0x4')];_0x20a746<_0x289bb8;_0x20a746++){var _0x1d5651=events[_0x20a746];var _0x57acf5=createListener(_0x104f('0x5')+_0x1d5651,_0x4e767b);CmListEvents['on'](_0x1d5651,_0x57acf5);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 65264f5..ea41896 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 629c795..27e2a1f 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(_0x31e0e1,_0x15edf2){var _0x44e676=function(_0x3cd10b){while(--_0x3cd10b){_0x31e0e1['push'](_0x31e0e1['shift']());}};_0x44e676(++_0x15edf2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5c8cc1,_0x559a2e){var _0x56236a=function(_0x39457e){while(--_0x39457e){_0x5c8cc1['push'](_0x5c8cc1['shift']());}};_0x56236a(++_0x559a2e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f32eadb..fadca56 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 _0x1c3f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','end','error','stack','name','send','Condition','find','body','catch','destroy','eml-format'];(function(_0x248a9b,_0xab9752){var _0x542168=function(_0x2c234c){while(--_0x2c234c){_0x248a9b['push'](_0x248a9b['shift']());}};_0x542168(++_0xab9752);}(_0x1c3f,0xf9));var _0xf1c3=function(_0x3ea2d8,_0x505018){_0x3ea2d8=_0x3ea2d8-0x0;var _0xb20457=_0x1c3f[_0x3ea2d8];return _0xb20457;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf1c3('0x0'));var rimraf=require(_0xf1c3('0x1'));var zipdir=require(_0xf1c3('0x2'));var jsonpatch=require(_0xf1c3('0x3'));var rp=require(_0xf1c3('0x4'));var moment=require(_0xf1c3('0x5'));var BPromise=require(_0xf1c3('0x6'));var Mustache=require(_0xf1c3('0x7'));var util=require(_0xf1c3('0x8'));var path=require('path');var sox=require(_0xf1c3('0x9'));var csv=require(_0xf1c3('0xa'));var ejs=require(_0xf1c3('0xb'));var fs=require('fs');var _=require(_0xf1c3('0xc'));var squel=require(_0xf1c3('0xd'));var crypto=require(_0xf1c3('0xe'));var jsforce=require(_0xf1c3('0xf'));var deskjs=require(_0xf1c3('0x10'));var toCsv=require(_0xf1c3('0xa'));var querystring=require(_0xf1c3('0x11'));var Papa=require(_0xf1c3('0x12'));var Redis=require(_0xf1c3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf1c3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1c3('0x15'));var logger=require(_0xf1c3('0x16'))(_0xf1c3('0x17'));var utils=require(_0xf1c3('0x18'));var config=require(_0xf1c3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1c3('0x1a'))['db'];function respondWithStatusCode(_0x25e6d1,_0x3bfd55){_0x3bfd55=_0x3bfd55||0xcc;return function(_0x41f718){if(_0x41f718){return _0x25e6d1[_0xf1c3('0x1b')](_0x3bfd55);}return _0x25e6d1[_0xf1c3('0x1c')](_0x3bfd55)['end']();};}function respondWithResult(_0x3f3e09,_0x3f5081){_0x3f5081=_0x3f5081||0xc8;return function(_0x23e430){if(_0x23e430){return _0x3f3e09['status'](_0x3f5081)[_0xf1c3('0x1d')](_0x23e430);}};}function respondWithFilteredResult(_0x162820,_0x48a6f9){return function(_0x4bbd3e){if(_0x4bbd3e){var _0x47ed58=_0x4bbd3e[_0xf1c3('0x1e')],_0x54d7d8=_0x48a6f9['offset'],_0x5b4b39=_0x48a6f9[_0xf1c3('0x1f')]+_0x48a6f9[_0xf1c3('0x20')],_0x533724;if(_0x5b4b39>=_0x47ed58){_0x5b4b39=_0x47ed58;_0x533724=0xc8;}else{_0x533724=0xce;}_0x162820[_0xf1c3('0x1c')](_0x533724);return _0x162820[_0xf1c3('0x21')](_0xf1c3('0x22'),_0x54d7d8+'-'+_0x5b4b39+'/'+_0x47ed58)[_0xf1c3('0x1d')](_0x4bbd3e);}return null;};}function patchUpdates(_0x4d6d04){return function(_0x5295da){try{jsonpatch[_0xf1c3('0x23')](_0x5295da,_0x4d6d04,!![]);}catch(_0x3c6b38){return BPromise[_0xf1c3('0x24')](_0x3c6b38);}return _0x5295da[_0xf1c3('0x25')]();};}function saveUpdates(_0x8c280d,_0x48df9f){return function(_0x52e1ec){if(_0x52e1ec){return _0x52e1ec[_0xf1c3('0x26')](_0x8c280d)[_0xf1c3('0x27')](function(_0x36f5b1){return _0x36f5b1;});}return null;};}function removeEntity(_0x6fb373,_0x518d20){return function(_0xda8105){if(_0xda8105){return _0xda8105['destroy']()[_0xf1c3('0x27')](function(){_0x6fb373['status'](0xcc)[_0xf1c3('0x28')]();});}};}function handleEntityNotFound(_0x5440d2,_0x530215){return function(_0x422cf1){if(!_0x422cf1){_0x5440d2['sendStatus'](0x194);}return _0x422cf1;};}function handleError(_0x40c8ed,_0x5a7025){_0x5a7025=_0x5a7025||0x1f4;return function(_0x3d7d8a){logger[_0xf1c3('0x29')](_0x3d7d8a[_0xf1c3('0x2a')]);if(_0x3d7d8a[_0xf1c3('0x2b')]){delete _0x3d7d8a[_0xf1c3('0x2b')];}_0x40c8ed[_0xf1c3('0x1c')](_0x5a7025)[_0xf1c3('0x2c')](_0x3d7d8a);};}exports[_0xf1c3('0x26')]=function(_0x3e7294,_0xc592ef){if(_0x3e7294['body']['id']){delete _0x3e7294['body']['id'];}return db[_0xf1c3('0x2d')][_0xf1c3('0x2e')]({'where':{'id':_0x3e7294['params']['id']}})[_0xf1c3('0x27')](handleEntityNotFound(_0xc592ef,null))['then'](saveUpdates(_0x3e7294[_0xf1c3('0x2f')],null))[_0xf1c3('0x27')](respondWithResult(_0xc592ef,null))[_0xf1c3('0x30')](handleError(_0xc592ef,null));};exports[_0xf1c3('0x31')]=function(_0x3bb717,_0x5cc974){return db['Condition'][_0xf1c3('0x2e')]({'where':{'id':_0x3bb717['params']['id']}})['then'](handleEntityNotFound(_0x5cc974,null))[_0xf1c3('0x27')](removeEntity(_0x5cc974,null))[_0xf1c3('0x30')](handleError(_0x5cc974,null));}; \ No newline at end of file +var _0x5abe=['jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','body','find','Condition','params','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5abe,0x105));var _0xe5ab=function(_0x48f76d,_0x1ff02e){_0x48f76d=_0x48f76d-0x0;var _0x491097=_0x5abe[_0x48f76d];return _0x491097;};'use strict';var pdf=require(_0xe5ab('0x0'));var emlformat=require(_0xe5ab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe5ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5ab('0x3'));var moment=require(_0xe5ab('0x4'));var BPromise=require(_0xe5ab('0x5'));var Mustache=require(_0xe5ab('0x6'));var util=require(_0xe5ab('0x7'));var path=require(_0xe5ab('0x8'));var sox=require(_0xe5ab('0x9'));var csv=require(_0xe5ab('0xa'));var ejs=require(_0xe5ab('0xb'));var fs=require('fs');var _=require(_0xe5ab('0xc'));var squel=require(_0xe5ab('0xd'));var crypto=require(_0xe5ab('0xe'));var jsforce=require(_0xe5ab('0xf'));var deskjs=require(_0xe5ab('0x10'));var toCsv=require(_0xe5ab('0xa'));var querystring=require(_0xe5ab('0x11'));var Papa=require(_0xe5ab('0x12'));var Redis=require(_0xe5ab('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5ab('0x14'));var logger=require(_0xe5ab('0x15'))(_0xe5ab('0x16'));var utils=require(_0xe5ab('0x17'));var config=require(_0xe5ab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5480d4,_0x4f0219){_0x4f0219=_0x4f0219||0xcc;return function(_0x4ad870){if(_0x4ad870){return _0x5480d4[_0xe5ab('0x19')](_0x4f0219);}return _0x5480d4['status'](_0x4f0219)['end']();};}function respondWithResult(_0x516b39,_0x34c572){_0x34c572=_0x34c572||0xc8;return function(_0x4d5d73){if(_0x4d5d73){return _0x516b39[_0xe5ab('0x1a')](_0x34c572)[_0xe5ab('0x1b')](_0x4d5d73);}};}function respondWithFilteredResult(_0x4c4ffa,_0x3fca43){return function(_0x5c42ed){if(_0x5c42ed){var _0x286120=_0x5c42ed[_0xe5ab('0x1c')],_0x2cbdaa=_0x3fca43[_0xe5ab('0x1d')],_0x40e043=_0x3fca43['offset']+_0x3fca43[_0xe5ab('0x1e')],_0x4fd18d;if(_0x40e043>=_0x286120){_0x40e043=_0x286120;_0x4fd18d=0xc8;}else{_0x4fd18d=0xce;}_0x4c4ffa[_0xe5ab('0x1a')](_0x4fd18d);return _0x4c4ffa[_0xe5ab('0x1f')](_0xe5ab('0x20'),_0x2cbdaa+'-'+_0x40e043+'/'+_0x286120)[_0xe5ab('0x1b')](_0x5c42ed);}return null;};}function patchUpdates(_0x58e7e9){return function(_0x52c1b9){try{jsonpatch['apply'](_0x52c1b9,_0x58e7e9,!![]);}catch(_0x47d331){return BPromise[_0xe5ab('0x21')](_0x47d331);}return _0x52c1b9[_0xe5ab('0x22')]();};}function saveUpdates(_0x357da6,_0x10d228){return function(_0x11ede1){if(_0x11ede1){return _0x11ede1[_0xe5ab('0x23')](_0x357da6)[_0xe5ab('0x24')](function(_0x555d6a){return _0x555d6a;});}return null;};}function removeEntity(_0x663711,_0x2e3528){return function(_0x3c5ae2){if(_0x3c5ae2){return _0x3c5ae2['destroy']()[_0xe5ab('0x24')](function(){_0x663711[_0xe5ab('0x1a')](0xcc)[_0xe5ab('0x25')]();});}};}function handleEntityNotFound(_0x1c39a6,_0x421f41){return function(_0x2f0766){if(!_0x2f0766){_0x1c39a6[_0xe5ab('0x19')](0x194);}return _0x2f0766;};}function handleError(_0xf77c5,_0x2d1fb4){_0x2d1fb4=_0x2d1fb4||0x1f4;return function(_0xcbe019){logger[_0xe5ab('0x26')](_0xcbe019[_0xe5ab('0x27')]);if(_0xcbe019[_0xe5ab('0x28')]){delete _0xcbe019[_0xe5ab('0x28')];}_0xf77c5[_0xe5ab('0x1a')](_0x2d1fb4)['send'](_0xcbe019);};}exports['update']=function(_0x2946d7,_0x1be504){if(_0x2946d7[_0xe5ab('0x29')]['id']){delete _0x2946d7[_0xe5ab('0x29')]['id'];}return db['Condition'][_0xe5ab('0x2a')]({'where':{'id':_0x2946d7['params']['id']}})['then'](handleEntityNotFound(_0x1be504,null))[_0xe5ab('0x24')](saveUpdates(_0x2946d7[_0xe5ab('0x29')],null))[_0xe5ab('0x24')](respondWithResult(_0x1be504,null))['catch'](handleError(_0x1be504,null));};exports['destroy']=function(_0x485d35,_0x2e2221){return db[_0xe5ab('0x2b')][_0xe5ab('0x2a')]({'where':{'id':_0x485d35[_0xe5ab('0x2c')]['id']}})[_0xe5ab('0x24')](handleEntityNotFound(_0x2e2221,null))[_0xe5ab('0x24')](removeEntity(_0x2e2221,null))[_0xe5ab('0x2d')](handleError(_0x2e2221,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1821d1d..22bcaeb 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 _0x39a3=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./condition.attributes','define','Condition'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x39a3,0x11e));var _0x339a=function(_0x39998f,_0x4b1a9e){_0x39998f=_0x39998f-0x0;var _0x296d5a=_0x39a3[_0x39998f];return _0x296d5a;};'use strict';var _=require(_0x339a('0x0'));var util=require(_0x339a('0x1'));var logger=require(_0x339a('0x2'))(_0x339a('0x3'));var moment=require(_0x339a('0x4'));var BPromise=require(_0x339a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x339a('0x6'));var config=require(_0x339a('0x7'));var attributes=require(_0x339a('0x8'));module['exports']=function(_0x2e5911,_0x445cc4){return _0x2e5911[_0x339a('0x9')](_0x339a('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc443=['path','rimraf','../../config/environment','define','Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc443,0x145));var _0x3c44=function(_0x3ad739,_0x17cecd){_0x3ad739=_0x3ad739-0x0;var _0x44f8ee=_0xc443[_0x3ad739];return _0x44f8ee;};'use strict';var _=require(_0x3c44('0x0'));var util=require(_0x3c44('0x1'));var logger=require(_0x3c44('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c44('0x3'));var rp=require(_0x3c44('0x4'));var fs=require('fs');var path=require(_0x3c44('0x5'));var rimraf=require(_0x3c44('0x6'));var config=require(_0x3c44('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x4b3ada,_0x2aeb7e){return _0x4b3ada[_0x3c44('0x8')](_0x3c44('0x9'),attributes,{'tableName':_0x3c44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 3606aab..cae7c9d 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 _0xd6cf=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','info','result','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x29cde2,_0x51e9bb){var _0x1ea31b=function(_0x314127){while(--_0x314127){_0x29cde2['push'](_0x29cde2['shift']());}};_0x1ea31b(++_0x51e9bb);}(_0xd6cf,0x16b));var _0xfd6c=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xd6cf[_0x41582d];return _0x59c504;};'use strict';var _=require(_0xfd6c('0x0'));var util=require(_0xfd6c('0x1'));var moment=require(_0xfd6c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd6c('0x3'));var db=require(_0xfd6c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd6c('0x5'))('rpc');var config=require(_0xfd6c('0x6'));var jayson=require(_0xfd6c('0x7'));var client=jayson[_0xfd6c('0x8')][_0xfd6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x558a33,_0x373e46,_0x339ad7){return new BPromise(function(_0x103b9b,_0x4a2486){return client['request'](_0x558a33,_0x339ad7)[_0xfd6c('0xa')](function(_0x5619d1){logger['info'](_0xfd6c('0xb'),_0x373e46,_0xfd6c('0xc'));logger[_0xfd6c('0xd')](_0xfd6c('0xe'),_0x373e46,'request\x20sent',JSON[_0xfd6c('0xf')](_0x5619d1));if(_0x5619d1[_0xfd6c('0x10')]){if(_0x5619d1['error'][_0xfd6c('0x11')]===0x1f4){logger[_0xfd6c('0x10')]('Condition,\x20%s,\x20%s',_0x373e46,_0x5619d1[_0xfd6c('0x10')]['message']);return _0x4a2486(_0x5619d1['error']['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x373e46,_0x5619d1[_0xfd6c('0x10')]['message']);return _0x103b9b(_0x5619d1['error']['message']);}else{logger[_0xfd6c('0x12')](_0xfd6c('0xb'),_0x373e46,'request\x20sent');_0x103b9b(_0x5619d1[_0xfd6c('0x13')][_0xfd6c('0x14')]);}})[_0xfd6c('0x15')](function(_0x17c987){logger[_0xfd6c('0x10')]('Condition,\x20%s,\x20%s',_0x373e46,_0x17c987);_0x4a2486(_0x17c987);});});} \ No newline at end of file +var _0xf8cd=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message'];(function(_0x2feb6d,_0x11676b){var _0x1c2514=function(_0x54e43a){while(--_0x54e43a){_0x2feb6d['push'](_0x2feb6d['shift']());}};_0x1c2514(++_0x11676b);}(_0xf8cd,0x67));var _0xdf8c=function(_0x227610,_0x3dc63c){_0x227610=_0x227610-0x0;var _0x38ff15=_0xf8cd[_0x227610];return _0x38ff15;};'use strict';var _=require(_0xdf8c('0x0'));var util=require(_0xdf8c('0x1'));var moment=require(_0xdf8c('0x2'));var BPromise=require(_0xdf8c('0x3'));var rs=require(_0xdf8c('0x4'));var fs=require('fs');var Redis=require(_0xdf8c('0x5'));var db=require(_0xdf8c('0x6'))['db'];var utils=require(_0xdf8c('0x7'));var logger=require(_0xdf8c('0x8'))(_0xdf8c('0x9'));var config=require(_0xdf8c('0xa'));var jayson=require(_0xdf8c('0xb'));var client=jayson[_0xdf8c('0xc')][_0xdf8c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a2209,_0x4cf0d1,_0x4951c6){return new BPromise(function(_0x39fec7,_0x342c4d){return client['request'](_0x3a2209,_0x4951c6)[_0xdf8c('0xe')](function(_0x583a4f){logger['info']('Condition,\x20%s,\x20%s',_0x4cf0d1,_0xdf8c('0xf'));logger[_0xdf8c('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x4cf0d1,_0xdf8c('0xf'),JSON[_0xdf8c('0x11')](_0x583a4f));if(_0x583a4f[_0xdf8c('0x12')]){if(_0x583a4f[_0xdf8c('0x12')][_0xdf8c('0x13')]===0x1f4){logger['error'](_0xdf8c('0x14'),_0x4cf0d1,_0x583a4f[_0xdf8c('0x12')][_0xdf8c('0x15')]);return _0x342c4d(_0x583a4f[_0xdf8c('0x12')]['message']);}logger[_0xdf8c('0x12')]('Condition,\x20%s,\x20%s',_0x4cf0d1,_0x583a4f[_0xdf8c('0x12')][_0xdf8c('0x15')]);return _0x39fec7(_0x583a4f[_0xdf8c('0x12')][_0xdf8c('0x15')]);}else{logger[_0xdf8c('0x16')](_0xdf8c('0x14'),_0x4cf0d1,_0xdf8c('0xf'));_0x39fec7(_0x583a4f[_0xdf8c('0x17')]['message']);}})[_0xdf8c('0x18')](function(_0x19d1aa){logger[_0xdf8c('0x12')]('Condition,\x20%s,\x20%s',_0x4cf0d1,_0x19d1aa);_0x342c4d(_0x19d1aa);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6e25933..298e647 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 _0x737a=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x4a6d5e,_0x14e563){var _0x3a86a7=function(_0x215055){while(--_0x215055){_0x4a6d5e['push'](_0x4a6d5e['shift']());}};_0x3a86a7(++_0x14e563);}(_0x737a,0x12b));var _0xa737=function(_0x385a24,_0x51e244){_0x385a24=_0x385a24-0x0;var _0x2425de=_0x737a[_0x385a24];return _0x2425de;};'use strict';var multer=require(_0xa737('0x0'));var util=require(_0xa737('0x1'));var path=require(_0xa737('0x2'));var timeout=require(_0xa737('0x3'));var express=require(_0xa737('0x4'));var router=express['Router']();var auth=require(_0xa737('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa737('0x6'));var controller=require(_0xa737('0x7'));router[_0xa737('0x8')](_0xa737('0x9'),auth[_0xa737('0xa')](),controller[_0xa737('0xb')]);router[_0xa737('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xa737('0xd')]);module[_0xa737('0xe')]=router; \ No newline at end of file +var _0x9a4a=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated'];(function(_0x23ec3f,_0x4f2ab4){var _0x51e70c=function(_0x344a52){while(--_0x344a52){_0x23ec3f['push'](_0x23ec3f['shift']());}};_0x51e70c(++_0x4f2ab4);}(_0x9a4a,0x12a));var _0xa9a4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9a4a[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xa9a4('0x0'));var util=require(_0xa9a4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa9a4('0x2'));var router=express['Router']();var auth=require(_0xa9a4('0x3'));var interaction=require(_0xa9a4('0x4'));var config=require(_0xa9a4('0x5'));var controller=require(_0xa9a4('0x6'));router[_0xa9a4('0x7')](_0xa9a4('0x8'),auth[_0xa9a4('0x9')](),controller[_0xa9a4('0xa')]);router[_0xa9a4('0xb')](_0xa9a4('0x8'),auth['isAuthenticated'](),controller[_0xa9a4('0xc')]);module[_0xa9a4('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 33712bb..e42ceb5 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 _0x374c=['exports','STRING','name'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x374c,0x1e3));var _0xc374=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x374c[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require('sequelize');module[_0xc374('0x0')]={'name':{'type':Sequelize[_0xc374('0x1')],'allowNull':![],'unique':_0xc374('0x2')},'description':{'type':Sequelize[_0xc374('0x1')]}}; \ No newline at end of file +var _0x4553=['STRING','name','exports'];(function(_0x241698,_0x59301e){var _0x5f259a=function(_0x2b3e42){while(--_0x2b3e42){_0x241698['push'](_0x241698['shift']());}};_0x5f259a(++_0x59301e);}(_0x4553,0x1be));var _0x3455=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4553[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');module[_0x3455('0x0')]={'name':{'type':Sequelize[_0x3455('0x1')],'allowNull':![],'unique':_0x3455('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 52352cf..a9904ce 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 _0x88b4=['fieldName','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','Dashboard','includeAll','include','findAll','rows','params','intersection','options','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','role','UserProfileSection','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','error','stack','send','index','map','rawAttributes'];(function(_0x1d0d10,_0x65b57a){var _0xa4d7ff=function(_0x31bc85){while(--_0x31bc85){_0x1d0d10['push'](_0x1d0d10['shift']());}};_0xa4d7ff(++_0x65b57a);}(_0x88b4,0xc1));var _0x488b=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x88b4[_0x216d45];return _0xbaac0b;};'use strict';var pdf=require(_0x488b('0x0'));var emlformat=require(_0x488b('0x1'));var rimraf=require(_0x488b('0x2'));var zipdir=require(_0x488b('0x3'));var jsonpatch=require(_0x488b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x488b('0x5'));var Mustache=require(_0x488b('0x6'));var util=require(_0x488b('0x7'));var path=require(_0x488b('0x8'));var sox=require(_0x488b('0x9'));var csv=require('to-csv');var ejs=require(_0x488b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x488b('0xb'));var crypto=require('crypto');var jsforce=require(_0x488b('0xc'));var deskjs=require(_0x488b('0xd'));var toCsv=require(_0x488b('0xe'));var querystring=require(_0x488b('0xf'));var Papa=require(_0x488b('0x10'));var Redis=require(_0x488b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x488b('0x12'));var hardwareService=require(_0x488b('0x13'));var logger=require(_0x488b('0x14'))(_0x488b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x488b('0x16'));var db=require(_0x488b('0x17'))['db'];config[_0x488b('0x18')]=_[_0x488b('0x19')](config[_0x488b('0x18')],{'host':_0x488b('0x1a'),'port':0x18eb});var socket=require(_0x488b('0x1b'))(new Redis(config[_0x488b('0x18')]));require(_0x488b('0x1c'))[_0x488b('0x1d')](socket);function respondWithStatusCode(_0x5291d5,_0x79d8c2){_0x79d8c2=_0x79d8c2||0xcc;return function(_0x2613be){if(_0x2613be){return _0x5291d5[_0x488b('0x1e')](_0x79d8c2);}return _0x5291d5[_0x488b('0x1f')](_0x79d8c2)[_0x488b('0x20')]();};}function respondWithResult(_0x31e720,_0x11e8ff){_0x11e8ff=_0x11e8ff||0xc8;return function(_0xd70999){if(_0xd70999){return _0x31e720[_0x488b('0x1f')](_0x11e8ff)[_0x488b('0x21')](_0xd70999);}};}function respondWithFilteredResult(_0x471cbf,_0x528d51){return function(_0x3fe856){if(_0x3fe856){var _0x434d13=_0x3fe856[_0x488b('0x22')],_0x39e370=_0x528d51[_0x488b('0x23')],_0x4ebaf2=_0x528d51[_0x488b('0x23')]+_0x528d51[_0x488b('0x24')],_0x3eda45;if(_0x4ebaf2>=_0x434d13){_0x4ebaf2=_0x434d13;_0x3eda45=0xc8;}else{_0x3eda45=0xce;}_0x471cbf[_0x488b('0x1f')](_0x3eda45);return _0x471cbf[_0x488b('0x25')](_0x488b('0x26'),_0x39e370+'-'+_0x4ebaf2+'/'+_0x434d13)['json'](_0x3fe856);}return null;};}function patchUpdates(_0x13bb18){return function(_0x2fd6e7){try{jsonpatch[_0x488b('0x27')](_0x2fd6e7,_0x13bb18,!![]);}catch(_0x391fd3){return BPromise[_0x488b('0x28')](_0x391fd3);}return _0x2fd6e7[_0x488b('0x29')]();};}function saveUpdates(_0xafac72,_0x2919f7){return function(_0x268a20){if(_0x268a20){return _0x268a20[_0x488b('0x2a')](_0xafac72)[_0x488b('0x2b')](function(_0x42d09e){return _0x42d09e;});}return null;};}function removeEntity(_0x1807dc,_0x4b3e83){return function(_0x5d6791){if(_0x5d6791){return _0x5d6791[_0x488b('0x2c')]()[_0x488b('0x2b')](function(){var _0x58e975=_0x5d6791['get']({'plain':!![]});var _0x17da4a=_0x488b('0x2d');return db[_0x488b('0x2e')][_0x488b('0x2c')]({'where':{'type':_0x17da4a,'resourceId':_0x58e975['id']}})[_0x488b('0x2b')](function(){return _0x5d6791;});})['then'](function(){_0x1807dc[_0x488b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54fbae,_0x5938c4){return function(_0x5edf4c){if(!_0x5edf4c){_0x54fbae['sendStatus'](0x194);}return _0x5edf4c;};}function handleError(_0x307084,_0x1436bb){_0x1436bb=_0x1436bb||0x1f4;return function(_0x4e4105){logger[_0x488b('0x2f')](_0x4e4105[_0x488b('0x30')]);if(_0x4e4105['name']){delete _0x4e4105['name'];}_0x307084[_0x488b('0x1f')](_0x1436bb)[_0x488b('0x31')](_0x4e4105);};}exports[_0x488b('0x32')]=function(_0x569ebc,_0x346d98){var _0x5b4a42={},_0x12e11e={},_0x1d0773={'count':0x0,'rows':[]};var _0x20c671=_[_0x488b('0x33')](db['Dashboard'][_0x488b('0x34')],function(_0x42817a){return{'name':_0x42817a[_0x488b('0x35')],'type':_0x42817a['type'][_0x488b('0x36')]};});_0x12e11e[_0x488b('0x37')]=_['map'](_0x20c671,_0x488b('0x38'));_0x12e11e[_0x488b('0x39')]=_[_0x488b('0x3a')](_0x569ebc[_0x488b('0x39')]);_0x12e11e['filters']=_['intersection'](_0x12e11e[_0x488b('0x37')],_0x12e11e[_0x488b('0x39')]);_0x5b4a42[_0x488b('0x3b')]=_['intersection'](_0x12e11e[_0x488b('0x37')],qs[_0x488b('0x3c')](_0x569ebc[_0x488b('0x39')][_0x488b('0x3c')]));_0x5b4a42[_0x488b('0x3b')]=_0x5b4a42[_0x488b('0x3b')][_0x488b('0x3d')]?_0x5b4a42['attributes']:_0x12e11e[_0x488b('0x37')];if(!_0x569ebc[_0x488b('0x39')][_0x488b('0x3e')]('nolimit')){_0x5b4a42[_0x488b('0x24')]=qs[_0x488b('0x24')](_0x569ebc[_0x488b('0x39')][_0x488b('0x24')]);_0x5b4a42['offset']=qs['offset'](_0x569ebc[_0x488b('0x39')][_0x488b('0x23')]);}_0x5b4a42['order']=qs[_0x488b('0x3f')](_0x569ebc['query'][_0x488b('0x3f')]);_0x5b4a42[_0x488b('0x40')]=qs[_0x488b('0x41')](_['pick'](_0x569ebc[_0x488b('0x39')],_0x12e11e[_0x488b('0x41')]),_0x20c671);if(_0x569ebc[_0x488b('0x39')][_0x488b('0x42')]){_0x5b4a42['where']=_[_0x488b('0x43')](_0x5b4a42[_0x488b('0x40')],{'$or':_[_0x488b('0x33')](_0x20c671,function(_0x18151c){if(_0x18151c['type']!==_0x488b('0x44')){var _0x18c755={};_0x18c755[_0x18151c[_0x488b('0x38')]]={'$like':'%'+_0x569ebc[_0x488b('0x39')]['filter']+'%'};return _0x18c755;}})});}_0x5b4a42=_['merge']({},_0x5b4a42,_0x569ebc['options']);var _0x4355ad={'where':_0x5b4a42['where']};return db[_0x488b('0x45')][_0x488b('0x22')](_0x4355ad)[_0x488b('0x2b')](function(_0x327cfa){_0x1d0773['count']=_0x327cfa;if(_0x569ebc[_0x488b('0x39')][_0x488b('0x46')]){_0x5b4a42[_0x488b('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0x488b('0x48')](_0x5b4a42);})[_0x488b('0x2b')](function(_0x51a892){_0x1d0773[_0x488b('0x49')]=_0x51a892;return _0x1d0773;})[_0x488b('0x2b')](respondWithFilteredResult(_0x346d98,_0x5b4a42))['catch'](handleError(_0x346d98,null));};exports['show']=function(_0x208774,_0x322319){var _0x5381fc={'raw':![],'where':{'id':_0x208774[_0x488b('0x4a')]['id']}},_0x484708={};_0x484708[_0x488b('0x37')]=_[_0x488b('0x3a')](db['Dashboard'][_0x488b('0x34')]);_0x484708[_0x488b('0x39')]=_[_0x488b('0x3a')](_0x208774[_0x488b('0x39')]);_0x484708[_0x488b('0x41')]=_[_0x488b('0x4b')](_0x484708[_0x488b('0x37')],_0x484708['query']);_0x5381fc['attributes']=_[_0x488b('0x4b')](_0x484708[_0x488b('0x37')],qs[_0x488b('0x3c')](_0x208774[_0x488b('0x39')][_0x488b('0x3c')]));_0x5381fc[_0x488b('0x3b')]=_0x5381fc[_0x488b('0x3b')][_0x488b('0x3d')]?_0x5381fc[_0x488b('0x3b')]:_0x484708['model'];if(_0x208774[_0x488b('0x39')][_0x488b('0x46')]){_0x5381fc[_0x488b('0x47')]=[{'all':!![]}];}_0x5381fc=_[_0x488b('0x43')]({},_0x5381fc,_0x208774[_0x488b('0x4c')]);return db[_0x488b('0x45')]['find'](_0x5381fc)[_0x488b('0x2b')](handleEntityNotFound(_0x322319,null))[_0x488b('0x2b')](respondWithResult(_0x322319,null))[_0x488b('0x4d')](handleError(_0x322319,null));};exports[_0x488b('0x4e')]=function(_0x54c3dc,_0x506f41){return db['Dashboard'][_0x488b('0x4e')](_0x54c3dc['body'],{})['then'](function(_0x874ebf){var _0x52719d=_0x54c3dc[_0x488b('0x4f')][_0x488b('0x50')]({'plain':!![]});if(!_0x52719d)throw new Error(_0x488b('0x51'));if(_0x52719d['role']===_0x488b('0x4f')){var _0x514c19=_0x874ebf[_0x488b('0x50')]({'plain':!![]});var _0xcfce2c=_0x488b('0x2d');return db['UserProfileSection'][_0x488b('0x52')]({'where':{'name':_0xcfce2c,'userProfileId':_0x52719d[_0x488b('0x53')]},'raw':!![]})[_0x488b('0x2b')](function(_0x2bb41a){if(_0x2bb41a&&_0x2bb41a[_0x488b('0x54')]===0x0){return db[_0x488b('0x2e')][_0x488b('0x4e')]({'name':_0x514c19['name'],'resourceId':_0x514c19['id'],'type':_0x2bb41a[_0x488b('0x38')],'sectionId':_0x2bb41a['id']},{})[_0x488b('0x2b')](function(){return _0x874ebf;});}else{return _0x874ebf;}})[_0x488b('0x4d')](function(_0x26acb5){logger[_0x488b('0x2f')](_0x488b('0x55'),_0x26acb5);throw _0x26acb5;});}return _0x874ebf;})['then'](respondWithResult(_0x506f41,0xc9))[_0x488b('0x4d')](handleError(_0x506f41,null));};exports['clone']=function(_0xd7ed2f,_0x14de3a){var _0x4f822b={'where':{'id':_0xd7ed2f[_0x488b('0x4a')]['id']}},_0x535b7c={};_0x535b7c[_0x488b('0x37')]=_[_0x488b('0x3a')](db[_0x488b('0x45')][_0x488b('0x34')]);_0x4f822b[_0x488b('0x3b')]=_[_0x488b('0x4b')](_0x535b7c[_0x488b('0x37')],qs[_0x488b('0x3c')](_0xd7ed2f[_0x488b('0x39')][_0x488b('0x3c')]));_0x4f822b[_0x488b('0x3b')]=_0x4f822b[_0x488b('0x3b')][_0x488b('0x3d')]?_0x4f822b['attributes']:_0x535b7c[_0x488b('0x37')];if(_0xd7ed2f[_0x488b('0x39')][_0x488b('0x46')]){_0x4f822b['include']=[{'all':!![]}];}_0x4f822b=_['merge']({},_0x4f822b,_0xd7ed2f[_0x488b('0x4c')]);return db['Dashboard'][_0x488b('0x52')](_0x4f822b)['then'](handleEntityNotFound(_0x14de3a,null))['then'](function(_0x138701){if(_0x138701){var _0x12bea6=_0x138701[_0x488b('0x50')]({'plain':!![]});_0x12bea6=qs[_0x488b('0x56')](_0x12bea6,['id',_0x488b('0x57'),_0x488b('0x58')]);_0xd7ed2f[_0x488b('0x59')]=_[_0x488b('0x56')](_0xd7ed2f['body'],['id',_0x488b('0x57'),_0x488b('0x58')]);return db[_0x488b('0x45')]['create'](_[_0x488b('0x43')](_0x12bea6,_0xd7ed2f[_0x488b('0x59')]),{'include':_0xd7ed2f[_0x488b('0x39')][_0x488b('0x46')]?[{'all':!![]}]:undefined})[_0x488b('0x2b')](function(_0x3f87ab){var _0x11140e=_0xd7ed2f[_0x488b('0x4f')][_0x488b('0x50')]({'plain':!![]});if(!_0x11140e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11140e[_0x488b('0x5a')]==='user'){var _0x1b0234=_0x3f87ab[_0x488b('0x50')]({'plain':!![]});var _0x2114f1='CustomDashboards';return db[_0x488b('0x5b')][_0x488b('0x52')]({'where':{'name':_0x2114f1,'userProfileId':_0x11140e['userProfileId']},'raw':!![]})[_0x488b('0x2b')](function(_0x5956e3){if(_0x5956e3&&_0x5956e3['autoAssociation']===0x0){return db[_0x488b('0x2e')]['create']({'name':_0x1b0234[_0x488b('0x38')],'resourceId':_0x1b0234['id'],'type':_0x5956e3[_0x488b('0x38')],'sectionId':_0x5956e3['id']},{})['then'](function(){return _0x3f87ab;});}else{return _0x3f87ab;}})[_0x488b('0x4d')](function(_0x2b6d6e){logger[_0x488b('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6d6e);throw _0x2b6d6e;});}return _0x3f87ab;});}})['then'](respondWithResult(_0x14de3a,0xc9))[_0x488b('0x4d')](handleError(_0x14de3a,null));};exports['update']=function(_0x339eb0,_0x83b598){if(_0x339eb0[_0x488b('0x59')]['id']){delete _0x339eb0[_0x488b('0x59')]['id'];}return db[_0x488b('0x45')][_0x488b('0x52')]({'where':{'id':_0x339eb0[_0x488b('0x4a')]['id']}})[_0x488b('0x2b')](handleEntityNotFound(_0x83b598,null))[_0x488b('0x2b')](saveUpdates(_0x339eb0[_0x488b('0x59')],null))[_0x488b('0x2b')](respondWithResult(_0x83b598,null))[_0x488b('0x4d')](handleError(_0x83b598,null));};exports[_0x488b('0x2c')]=function(_0x2d15f7,_0x58a751){return db[_0x488b('0x45')]['find']({'where':{'id':_0x2d15f7[_0x488b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58a751,null))[_0x488b('0x2b')](removeEntity(_0x58a751,null))[_0x488b('0x4d')](handleError(_0x58a751,null));};function widgetAttributes(_0x252193){try{switch(_0x252193[_0x488b('0x5c')]){case _0x488b('0x5d'):return[{'name':_0x488b('0x5e'),'value':_0x252193['attrUrl']||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0][_0x488b('0x60')]:undefined)||_0x488b('0x61')}];case'custom':return[{'name':_0x488b('0x62'),'value':_0x252193[_0x488b('0x62')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0][_0x488b('0x60')]:undefined)||''}];case _0x488b('0x63'):return[{'name':_0x488b('0x64'),'value':_0x252193[_0x488b('0x64')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0]['value']:undefined)||_0x488b('0x65')},{'name':'attrTimezone','value':_0x252193[_0x488b('0x66')]||(_0x252193['attrs']&&_0x252193[_0x488b('0x5f')][0x1]?_0x252193[_0x488b('0x5f')][0x1][_0x488b('0x60')]:undefined)||'0.00'},{'name':_0x488b('0x67'),'value':_0x252193[_0x488b('0x67')]||(_0x252193[_0x488b('0x5f')]&&_0x252193['attrs'][0x2]?_0x252193[_0x488b('0x5f')][0x2][_0x488b('0x60')]:undefined)||0xc}];case _0x488b('0x68'):return[{'name':'attrMetric','value':_0x252193[_0x488b('0x69')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x488b('0x6a'),'value':_0x252193[_0x488b('0x6a')]||(_0x252193[_0x488b('0x5f')]&&_0x252193['attrs'][0x1]?_0x252193[_0x488b('0x5f')][0x1][_0x488b('0x60')]:undefined)||[]},{'name':_0x488b('0x67'),'value':_0x252193[_0x488b('0x67')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x2]?_0x252193[_0x488b('0x5f')][0x2][_0x488b('0x60')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x488b('0x6b'),'value':_0x252193[_0x488b('0x6b')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0][_0x488b('0x60')]:undefined)||'total'},{'name':_0x488b('0x6c'),'value':_0x252193['attrSerie2']||(_0x252193['attrs']&&_0x252193[_0x488b('0x5f')][0x1]?_0x252193['attrs'][0x1][_0x488b('0x60')]:undefined)||null},{'name':_0x488b('0x6d'),'value':_0x252193['attrSerie3']||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x2]?_0x252193[_0x488b('0x5f')][0x2]['value']:undefined)||null},{'name':_0x488b('0x6a'),'value':_0x252193['attrVoiceQueues']||(_0x252193['attrs']&&_0x252193['attrs'][0x3]?_0x252193[_0x488b('0x5f')][0x3][_0x488b('0x60')]:undefined)||[]}];case _0x488b('0x6e'):return[{'name':'attrReport','type':_0x252193[_0x488b('0x6f')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0]['type']:undefined)||null,'value':_0x252193[_0x488b('0x70')]||(_0x252193[_0x488b('0x5f')]&&_0x252193[_0x488b('0x5f')][0x0]?_0x252193[_0x488b('0x5f')][0x0][_0x488b('0x60')]:undefined)||null},{'name':_0x488b('0x71'),'value':_0x252193[_0x488b('0x71')]||(_0x252193['attrs']&&_0x252193['attrs'][0x1]?_0x252193['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1c3cbd){logger['error'](_0x488b('0x72'),JSON[_0x488b('0x73')](_0x1c3cbd));return[];}}exports[_0x488b('0x74')]=function(_0x1aca3c,_0x2efacd,_0x3b8b4c){if(_0x1aca3c[_0x488b('0x59')]['id']){delete _0x1aca3c[_0x488b('0x59')]['id'];}return db['Dashboard'][_0x488b('0x52')]({'where':{'id':_0x1aca3c[_0x488b('0x4a')]['id']}})[_0x488b('0x2b')](handleEntityNotFound(_0x2efacd,null))[_0x488b('0x2b')](function(_0xcfe4c1){if(_0xcfe4c1){_0x1aca3c[_0x488b('0x59')][_0x488b('0x75')]=_0xcfe4c1['id'];_0x1aca3c[_0x488b('0x59')][_0x488b('0x5f')]=widgetAttributes(_0x1aca3c['body']);return db[_0x488b('0x76')][_0x488b('0x4e')](_0x1aca3c[_0x488b('0x59')]);}})[_0x488b('0x2b')](respondWithResult(_0x2efacd,null))[_0x488b('0x4d')](handleError(_0x2efacd,null));};exports[_0x488b('0x77')]=function(_0x2cc764,_0x4a20be,_0x4b1830){var _0x3468fd={};var _0x14a151={};var _0x1a89e3;var _0x23cc99;return db[_0x488b('0x45')][_0x488b('0x78')]({'where':{'id':_0x2cc764[_0x488b('0x4a')]['id']}})[_0x488b('0x2b')](handleEntityNotFound(_0x4a20be,null))['then'](function(_0x3b8f09){if(_0x3b8f09){_0x1a89e3=_0x3b8f09;_0x14a151[_0x488b('0x37')]=_[_0x488b('0x3a')](db[_0x488b('0x76')][_0x488b('0x34')]);_0x14a151[_0x488b('0x39')]=_['keys'](_0x2cc764[_0x488b('0x39')]);_0x14a151[_0x488b('0x41')]=_[_0x488b('0x4b')](_0x14a151[_0x488b('0x37')],_0x14a151['query']);_0x3468fd[_0x488b('0x3b')]=_[_0x488b('0x4b')](_0x14a151['model'],qs['fields'](_0x2cc764[_0x488b('0x39')][_0x488b('0x3c')]));_0x3468fd[_0x488b('0x3b')]=_0x3468fd['attributes']['length']?_0x3468fd[_0x488b('0x3b')]:_0x14a151[_0x488b('0x37')];_0x3468fd['order']=qs['sort'](_0x2cc764[_0x488b('0x39')][_0x488b('0x3f')]);_0x3468fd[_0x488b('0x40')]=qs['filters'](_[_0x488b('0x79')](_0x2cc764[_0x488b('0x39')],_0x14a151[_0x488b('0x41')]));if(_0x2cc764['query'][_0x488b('0x42')]){_0x3468fd[_0x488b('0x40')]=_[_0x488b('0x43')](_0x3468fd[_0x488b('0x40')],{'$or':_[_0x488b('0x33')](_0x3468fd[_0x488b('0x3b')],function(_0x36bf0d){var _0x2e45dd={};_0x2e45dd[_0x36bf0d]={'$like':'%'+_0x2cc764['query'][_0x488b('0x42')]+'%'};return _0x2e45dd;})});}_0x3468fd=_[_0x488b('0x43')]({},_0x3468fd,_0x2cc764[_0x488b('0x4c')]);return _0x1a89e3[_0x488b('0x77')](_0x3468fd);}})['then'](function(_0x450cea){if(_0x450cea){_0x23cc99=_0x450cea[_0x488b('0x3d')];if(!_0x2cc764['query'][_0x488b('0x3e')](_0x488b('0x7a'))){_0x3468fd['limit']=qs[_0x488b('0x24')](_0x2cc764[_0x488b('0x39')][_0x488b('0x24')]);_0x3468fd['offset']=qs[_0x488b('0x23')](_0x2cc764[_0x488b('0x39')][_0x488b('0x23')]);}return _0x1a89e3[_0x488b('0x77')](_0x3468fd);}})['then'](function(_0x4e80db){if(_0x4e80db){return _0x4e80db?{'count':_0x23cc99,'rows':_0x4e80db}:null;}})[_0x488b('0x2b')](respondWithResult(_0x4a20be,null))['catch'](handleError(_0x4a20be,null));}; \ No newline at end of file +var _0xea60=['stack','name','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error'];(function(_0x380198,_0x24c368){var _0x119a5d=function(_0xbee9d0){while(--_0xbee9d0){_0x380198['push'](_0x380198['shift']());}};_0x119a5d(++_0x24c368);}(_0xea60,0x1b0));var _0x0ea6=function(_0x8fbbe,_0x566ad1){_0x8fbbe=_0x8fbbe-0x0;var _0x2cda18=_0xea60[_0x8fbbe];return _0x2cda18;};'use strict';var pdf=require(_0x0ea6('0x0'));var emlformat=require(_0x0ea6('0x1'));var rimraf=require(_0x0ea6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ea6('0x3'));var rp=require(_0x0ea6('0x4'));var moment=require(_0x0ea6('0x5'));var BPromise=require(_0x0ea6('0x6'));var Mustache=require(_0x0ea6('0x7'));var util=require(_0x0ea6('0x8'));var path=require(_0x0ea6('0x9'));var sox=require('sox');var csv=require(_0x0ea6('0xa'));var ejs=require(_0x0ea6('0xb'));var fs=require('fs');var _=require(_0x0ea6('0xc'));var squel=require(_0x0ea6('0xd'));var crypto=require(_0x0ea6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0ea6('0xf'));var toCsv=require(_0x0ea6('0xa'));var querystring=require(_0x0ea6('0x10'));var Papa=require(_0x0ea6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ea6('0x12'));var as=require(_0x0ea6('0x13'));var hardwareService=require(_0x0ea6('0x14'));var logger=require(_0x0ea6('0x15'))(_0x0ea6('0x16'));var utils=require(_0x0ea6('0x17'));var config=require(_0x0ea6('0x18'));var licenseUtil=require(_0x0ea6('0x19'));var db=require('../../mysqldb')['db'];config[_0x0ea6('0x1a')]=_[_0x0ea6('0x1b')](config[_0x0ea6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ea6('0x1a')]));require(_0x0ea6('0x1c'))[_0x0ea6('0x1d')](socket);function respondWithStatusCode(_0x1d1440,_0x2c5944){_0x2c5944=_0x2c5944||0xcc;return function(_0x1fff46){if(_0x1fff46){return _0x1d1440[_0x0ea6('0x1e')](_0x2c5944);}return _0x1d1440[_0x0ea6('0x1f')](_0x2c5944)[_0x0ea6('0x20')]();};}function respondWithResult(_0x3dd7ba,_0xdb2b7f){_0xdb2b7f=_0xdb2b7f||0xc8;return function(_0x2b875f){if(_0x2b875f){return _0x3dd7ba[_0x0ea6('0x1f')](_0xdb2b7f)[_0x0ea6('0x21')](_0x2b875f);}};}function respondWithFilteredResult(_0x6b7fef,_0x52123b){return function(_0x1f4b89){if(_0x1f4b89){var _0x453a95=_0x1f4b89[_0x0ea6('0x22')],_0x236c0c=_0x52123b['offset'],_0x483453=_0x52123b[_0x0ea6('0x23')]+_0x52123b[_0x0ea6('0x24')],_0x1fb0fd;if(_0x483453>=_0x453a95){_0x483453=_0x453a95;_0x1fb0fd=0xc8;}else{_0x1fb0fd=0xce;}_0x6b7fef['status'](_0x1fb0fd);return _0x6b7fef['set'](_0x0ea6('0x25'),_0x236c0c+'-'+_0x483453+'/'+_0x453a95)[_0x0ea6('0x21')](_0x1f4b89);}return null;};}function patchUpdates(_0x16ab63){return function(_0x2bbd80){try{jsonpatch[_0x0ea6('0x26')](_0x2bbd80,_0x16ab63,!![]);}catch(_0x4980a3){return BPromise[_0x0ea6('0x27')](_0x4980a3);}return _0x2bbd80[_0x0ea6('0x28')]();};}function saveUpdates(_0x35dd5b,_0xd8b433){return function(_0x526581){if(_0x526581){return _0x526581[_0x0ea6('0x29')](_0x35dd5b)[_0x0ea6('0x2a')](function(_0x4d483d){return _0x4d483d;});}return null;};}function removeEntity(_0x5f04c7,_0x6c8bd7){return function(_0x6e76cb){if(_0x6e76cb){return _0x6e76cb[_0x0ea6('0x2b')]()[_0x0ea6('0x2a')](function(){var _0x47ca35=_0x6e76cb[_0x0ea6('0x2c')]({'plain':!![]});var _0x6730c3=_0x0ea6('0x2d');return db[_0x0ea6('0x2e')][_0x0ea6('0x2b')]({'where':{'type':_0x6730c3,'resourceId':_0x47ca35['id']}})[_0x0ea6('0x2a')](function(){return _0x6e76cb;});})[_0x0ea6('0x2a')](function(){_0x5f04c7['status'](0xcc)[_0x0ea6('0x20')]();});}};}function handleEntityNotFound(_0x594d29,_0x176389){return function(_0xb10dd1){if(!_0xb10dd1){_0x594d29[_0x0ea6('0x1e')](0x194);}return _0xb10dd1;};}function handleError(_0x464df0,_0x4b8503){_0x4b8503=_0x4b8503||0x1f4;return function(_0x126287){logger[_0x0ea6('0x2f')](_0x126287[_0x0ea6('0x30')]);if(_0x126287[_0x0ea6('0x31')]){delete _0x126287[_0x0ea6('0x31')];}_0x464df0[_0x0ea6('0x1f')](_0x4b8503)['send'](_0x126287);};}exports[_0x0ea6('0x32')]=function(_0x7146d9,_0x25d716){var _0x387f5d={},_0x49eeb7={},_0x4d9780={'count':0x0,'rows':[]};var _0x26bf1f=_['map'](db[_0x0ea6('0x33')][_0x0ea6('0x34')],function(_0x3b31a1){return{'name':_0x3b31a1[_0x0ea6('0x35')],'type':_0x3b31a1[_0x0ea6('0x36')][_0x0ea6('0x37')]};});_0x49eeb7[_0x0ea6('0x38')]=_[_0x0ea6('0x39')](_0x26bf1f,_0x0ea6('0x31'));_0x49eeb7[_0x0ea6('0x3a')]=_[_0x0ea6('0x3b')](_0x7146d9[_0x0ea6('0x3a')]);_0x49eeb7[_0x0ea6('0x3c')]=_[_0x0ea6('0x3d')](_0x49eeb7[_0x0ea6('0x38')],_0x49eeb7[_0x0ea6('0x3a')]);_0x387f5d[_0x0ea6('0x3e')]=_[_0x0ea6('0x3d')](_0x49eeb7[_0x0ea6('0x38')],qs[_0x0ea6('0x3f')](_0x7146d9[_0x0ea6('0x3a')]['fields']));_0x387f5d['attributes']=_0x387f5d[_0x0ea6('0x3e')][_0x0ea6('0x40')]?_0x387f5d[_0x0ea6('0x3e')]:_0x49eeb7[_0x0ea6('0x38')];if(!_0x7146d9['query']['hasOwnProperty']('nolimit')){_0x387f5d['limit']=qs[_0x0ea6('0x24')](_0x7146d9[_0x0ea6('0x3a')][_0x0ea6('0x24')]);_0x387f5d[_0x0ea6('0x23')]=qs[_0x0ea6('0x23')](_0x7146d9['query'][_0x0ea6('0x23')]);}_0x387f5d[_0x0ea6('0x41')]=qs[_0x0ea6('0x42')](_0x7146d9['query'][_0x0ea6('0x42')]);_0x387f5d[_0x0ea6('0x43')]=qs[_0x0ea6('0x3c')](_[_0x0ea6('0x44')](_0x7146d9[_0x0ea6('0x3a')],_0x49eeb7[_0x0ea6('0x3c')]),_0x26bf1f);if(_0x7146d9[_0x0ea6('0x3a')][_0x0ea6('0x45')]){_0x387f5d['where']=_[_0x0ea6('0x46')](_0x387f5d[_0x0ea6('0x43')],{'$or':_[_0x0ea6('0x39')](_0x26bf1f,function(_0x2e72d5){if(_0x2e72d5[_0x0ea6('0x36')]!==_0x0ea6('0x47')){var _0x3a2366={};_0x3a2366[_0x2e72d5[_0x0ea6('0x31')]]={'$like':'%'+_0x7146d9[_0x0ea6('0x3a')][_0x0ea6('0x45')]+'%'};return _0x3a2366;}})});}_0x387f5d=_[_0x0ea6('0x46')]({},_0x387f5d,_0x7146d9[_0x0ea6('0x48')]);var _0x124d5c={'where':_0x387f5d[_0x0ea6('0x43')]};return db[_0x0ea6('0x33')][_0x0ea6('0x22')](_0x124d5c)['then'](function(_0x43f08d){_0x4d9780[_0x0ea6('0x22')]=_0x43f08d;if(_0x7146d9[_0x0ea6('0x3a')][_0x0ea6('0x49')]){_0x387f5d['include']=[{'all':!![]}];}return db[_0x0ea6('0x33')]['findAll'](_0x387f5d);})[_0x0ea6('0x2a')](function(_0x157195){_0x4d9780[_0x0ea6('0x4a')]=_0x157195;return _0x4d9780;})[_0x0ea6('0x2a')](respondWithFilteredResult(_0x25d716,_0x387f5d))[_0x0ea6('0x4b')](handleError(_0x25d716,null));};exports[_0x0ea6('0x4c')]=function(_0x997bd8,_0x5e4d32){var _0x58497f={'raw':![],'where':{'id':_0x997bd8[_0x0ea6('0x4d')]['id']}},_0x39bee8={};_0x39bee8[_0x0ea6('0x38')]=_['keys'](db[_0x0ea6('0x33')][_0x0ea6('0x34')]);_0x39bee8[_0x0ea6('0x3a')]=_[_0x0ea6('0x3b')](_0x997bd8[_0x0ea6('0x3a')]);_0x39bee8[_0x0ea6('0x3c')]=_[_0x0ea6('0x3d')](_0x39bee8['model'],_0x39bee8[_0x0ea6('0x3a')]);_0x58497f[_0x0ea6('0x3e')]=_[_0x0ea6('0x3d')](_0x39bee8[_0x0ea6('0x38')],qs[_0x0ea6('0x3f')](_0x997bd8[_0x0ea6('0x3a')][_0x0ea6('0x3f')]));_0x58497f[_0x0ea6('0x3e')]=_0x58497f[_0x0ea6('0x3e')][_0x0ea6('0x40')]?_0x58497f[_0x0ea6('0x3e')]:_0x39bee8['model'];if(_0x997bd8[_0x0ea6('0x3a')][_0x0ea6('0x49')]){_0x58497f[_0x0ea6('0x4e')]=[{'all':!![]}];}_0x58497f=_[_0x0ea6('0x46')]({},_0x58497f,_0x997bd8['options']);return db[_0x0ea6('0x33')][_0x0ea6('0x4f')](_0x58497f)[_0x0ea6('0x2a')](handleEntityNotFound(_0x5e4d32,null))[_0x0ea6('0x2a')](respondWithResult(_0x5e4d32,null))[_0x0ea6('0x4b')](handleError(_0x5e4d32,null));};exports[_0x0ea6('0x50')]=function(_0x2a3e6b,_0x466e4f){return db['Dashboard']['create'](_0x2a3e6b['body'],{})[_0x0ea6('0x2a')](function(_0x1c9b2a){var _0x3d98d4=_0x2a3e6b['user'][_0x0ea6('0x2c')]({'plain':!![]});if(!_0x3d98d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d98d4[_0x0ea6('0x51')]==='user'){var _0x3e7e08=_0x1c9b2a[_0x0ea6('0x2c')]({'plain':!![]});var _0x4eb6ac=_0x0ea6('0x2d');return db[_0x0ea6('0x52')][_0x0ea6('0x4f')]({'where':{'name':_0x4eb6ac,'userProfileId':_0x3d98d4['userProfileId']},'raw':!![]})[_0x0ea6('0x2a')](function(_0x4cd4ab){if(_0x4cd4ab&&_0x4cd4ab[_0x0ea6('0x53')]===0x0){return db['UserProfileResource'][_0x0ea6('0x50')]({'name':_0x3e7e08[_0x0ea6('0x31')],'resourceId':_0x3e7e08['id'],'type':_0x4cd4ab[_0x0ea6('0x31')],'sectionId':_0x4cd4ab['id']},{})['then'](function(){return _0x1c9b2a;});}else{return _0x1c9b2a;}})['catch'](function(_0x1cfb91){logger[_0x0ea6('0x2f')](_0x0ea6('0x54'),_0x1cfb91);throw _0x1cfb91;});}return _0x1c9b2a;})[_0x0ea6('0x2a')](respondWithResult(_0x466e4f,0xc9))['catch'](handleError(_0x466e4f,null));};exports[_0x0ea6('0x55')]=function(_0x5658fc,_0x3f81e6){var _0x11583c={'where':{'id':_0x5658fc['params']['id']}},_0x1aa7bc={};_0x1aa7bc['model']=_[_0x0ea6('0x3b')](db[_0x0ea6('0x33')][_0x0ea6('0x34')]);_0x11583c[_0x0ea6('0x3e')]=_[_0x0ea6('0x3d')](_0x1aa7bc[_0x0ea6('0x38')],qs[_0x0ea6('0x3f')](_0x5658fc[_0x0ea6('0x3a')][_0x0ea6('0x3f')]));_0x11583c[_0x0ea6('0x3e')]=_0x11583c[_0x0ea6('0x3e')][_0x0ea6('0x40')]?_0x11583c[_0x0ea6('0x3e')]:_0x1aa7bc['model'];if(_0x5658fc[_0x0ea6('0x3a')][_0x0ea6('0x49')]){_0x11583c[_0x0ea6('0x4e')]=[{'all':!![]}];}_0x11583c=_[_0x0ea6('0x46')]({},_0x11583c,_0x5658fc[_0x0ea6('0x48')]);return db[_0x0ea6('0x33')][_0x0ea6('0x4f')](_0x11583c)[_0x0ea6('0x2a')](handleEntityNotFound(_0x3f81e6,null))[_0x0ea6('0x2a')](function(_0x14285d){if(_0x14285d){var _0x1ccad9=_0x14285d[_0x0ea6('0x2c')]({'plain':!![]});_0x1ccad9=qs['omit'](_0x1ccad9,['id','createdAt',_0x0ea6('0x56')]);_0x5658fc[_0x0ea6('0x57')]=_['omit'](_0x5658fc['body'],['id','createdAt',_0x0ea6('0x56')]);return db[_0x0ea6('0x33')]['create'](_['merge'](_0x1ccad9,_0x5658fc[_0x0ea6('0x57')]),{'include':_0x5658fc[_0x0ea6('0x3a')][_0x0ea6('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x3fceaa){var _0x4e8552=_0x5658fc[_0x0ea6('0x58')][_0x0ea6('0x2c')]({'plain':!![]});if(!_0x4e8552)throw new Error(_0x0ea6('0x59'));if(_0x4e8552[_0x0ea6('0x51')]===_0x0ea6('0x58')){var _0x49e3d9=_0x3fceaa['get']({'plain':!![]});var _0xeb315d=_0x0ea6('0x2d');return db['UserProfileSection'][_0x0ea6('0x4f')]({'where':{'name':_0xeb315d,'userProfileId':_0x4e8552[_0x0ea6('0x5a')]},'raw':!![]})[_0x0ea6('0x2a')](function(_0x51c50b){if(_0x51c50b&&_0x51c50b['autoAssociation']===0x0){return db['UserProfileResource'][_0x0ea6('0x50')]({'name':_0x49e3d9['name'],'resourceId':_0x49e3d9['id'],'type':_0x51c50b[_0x0ea6('0x31')],'sectionId':_0x51c50b['id']},{})['then'](function(){return _0x3fceaa;});}else{return _0x3fceaa;}})['catch'](function(_0x1d60b2){logger['error'](_0x0ea6('0x54'),_0x1d60b2);throw _0x1d60b2;});}return _0x3fceaa;});}})[_0x0ea6('0x2a')](respondWithResult(_0x3f81e6,0xc9))[_0x0ea6('0x4b')](handleError(_0x3f81e6,null));};exports[_0x0ea6('0x29')]=function(_0xd2ee15,_0xa3c677){if(_0xd2ee15['body']['id']){delete _0xd2ee15[_0x0ea6('0x57')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xd2ee15[_0x0ea6('0x4d')]['id']}})[_0x0ea6('0x2a')](handleEntityNotFound(_0xa3c677,null))[_0x0ea6('0x2a')](saveUpdates(_0xd2ee15[_0x0ea6('0x57')],null))['then'](respondWithResult(_0xa3c677,null))['catch'](handleError(_0xa3c677,null));};exports[_0x0ea6('0x2b')]=function(_0x4811c4,_0x467e1b){return db[_0x0ea6('0x33')][_0x0ea6('0x4f')]({'where':{'id':_0x4811c4[_0x0ea6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x467e1b,null))[_0x0ea6('0x2a')](removeEntity(_0x467e1b,null))[_0x0ea6('0x4b')](handleError(_0x467e1b,null));};function widgetAttributes(_0x461e54){try{switch(_0x461e54[_0x0ea6('0x36')]){case _0x0ea6('0x5b'):return[{'name':'attrUrl','value':_0x461e54[_0x0ea6('0x5c')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54['attrs'][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0]['value']:undefined)||_0x0ea6('0x5e')}];case _0x0ea6('0x5f'):return[{'name':_0x0ea6('0x60'),'value':_0x461e54['attrPath']||(_0x461e54['attrs']&&_0x461e54['attrs'][0x0]?_0x461e54['attrs'][0x0][_0x0ea6('0x61')]:undefined)||''}];case _0x0ea6('0x62'):return[{'name':_0x0ea6('0x63'),'value':_0x461e54['attrHourFormat']||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0][_0x0ea6('0x61')]:undefined)||_0x0ea6('0x64')},{'name':_0x0ea6('0x65'),'value':_0x461e54[_0x0ea6('0x65')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x1]?_0x461e54[_0x0ea6('0x5d')][0x1][_0x0ea6('0x61')]:undefined)||_0x0ea6('0x66')},{'name':_0x0ea6('0x67'),'value':_0x461e54['attrFontSize']||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x2]?_0x461e54['attrs'][0x2]['value']:undefined)||0xc}];case _0x0ea6('0x68'):return[{'name':_0x0ea6('0x69'),'value':_0x461e54[_0x0ea6('0x69')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54['attrs'][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x461e54[_0x0ea6('0x6a')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54['attrs'][0x1]?_0x461e54[_0x0ea6('0x5d')][0x1][_0x0ea6('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x461e54['attrFontSize']||(_0x461e54['attrs']&&_0x461e54[_0x0ea6('0x5d')][0x2]?_0x461e54[_0x0ea6('0x5d')][0x2][_0x0ea6('0x61')]:undefined)||0x14}];case _0x0ea6('0x6b'):case'pie-chart':return[{'name':_0x0ea6('0x6c'),'value':_0x461e54[_0x0ea6('0x6c')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0][_0x0ea6('0x61')]:undefined)||'total'},{'name':_0x0ea6('0x6d'),'value':_0x461e54[_0x0ea6('0x6d')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x1]?_0x461e54['attrs'][0x1][_0x0ea6('0x61')]:undefined)||null},{'name':_0x0ea6('0x6e'),'value':_0x461e54['attrSerie3']||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x2]?_0x461e54[_0x0ea6('0x5d')][0x2][_0x0ea6('0x61')]:undefined)||null},{'name':_0x0ea6('0x6a'),'value':_0x461e54[_0x0ea6('0x6a')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x3]?_0x461e54['attrs'][0x3][_0x0ea6('0x61')]:undefined)||[]}];case _0x0ea6('0x6f'):return[{'name':_0x0ea6('0x70'),'type':_0x461e54['reportType']||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0]['type']:undefined)||null,'value':_0x461e54[_0x0ea6('0x70')]||(_0x461e54[_0x0ea6('0x5d')]&&_0x461e54[_0x0ea6('0x5d')][0x0]?_0x461e54[_0x0ea6('0x5d')][0x0][_0x0ea6('0x61')]:undefined)||null},{'name':_0x0ea6('0x71'),'value':_0x461e54[_0x0ea6('0x71')]||(_0x461e54['attrs']&&_0x461e54[_0x0ea6('0x5d')][0x1]?_0x461e54[_0x0ea6('0x5d')][0x1][_0x0ea6('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xb3a7){logger[_0x0ea6('0x2f')]('widgetAttributes:\x20%s',JSON['stringify'](_0xb3a7));return[];}}exports[_0x0ea6('0x72')]=function(_0x5cf6af,_0x27acc8,_0xf57b89){if(_0x5cf6af['body']['id']){delete _0x5cf6af[_0x0ea6('0x57')]['id'];}return db[_0x0ea6('0x33')][_0x0ea6('0x4f')]({'where':{'id':_0x5cf6af[_0x0ea6('0x4d')]['id']}})[_0x0ea6('0x2a')](handleEntityNotFound(_0x27acc8,null))['then'](function(_0xb5d1d2){if(_0xb5d1d2){_0x5cf6af[_0x0ea6('0x57')][_0x0ea6('0x73')]=_0xb5d1d2['id'];_0x5cf6af[_0x0ea6('0x57')][_0x0ea6('0x5d')]=widgetAttributes(_0x5cf6af['body']);return db[_0x0ea6('0x74')][_0x0ea6('0x50')](_0x5cf6af[_0x0ea6('0x57')]);}})['then'](respondWithResult(_0x27acc8,null))[_0x0ea6('0x4b')](handleError(_0x27acc8,null));};exports[_0x0ea6('0x75')]=function(_0xfe0083,_0x48e3b0,_0x2abd93){var _0x1e4908={};var _0x4053dc={};var _0x20eb73;var _0x4a2898;return db[_0x0ea6('0x33')][_0x0ea6('0x76')]({'where':{'id':_0xfe0083[_0x0ea6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48e3b0,null))[_0x0ea6('0x2a')](function(_0x4ab0b9){if(_0x4ab0b9){_0x20eb73=_0x4ab0b9;_0x4053dc['model']=_[_0x0ea6('0x3b')](db[_0x0ea6('0x74')]['rawAttributes']);_0x4053dc[_0x0ea6('0x3a')]=_[_0x0ea6('0x3b')](_0xfe0083[_0x0ea6('0x3a')]);_0x4053dc['filters']=_['intersection'](_0x4053dc[_0x0ea6('0x38')],_0x4053dc['query']);_0x1e4908[_0x0ea6('0x3e')]=_['intersection'](_0x4053dc[_0x0ea6('0x38')],qs['fields'](_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x3f')]));_0x1e4908[_0x0ea6('0x3e')]=_0x1e4908[_0x0ea6('0x3e')][_0x0ea6('0x40')]?_0x1e4908[_0x0ea6('0x3e')]:_0x4053dc[_0x0ea6('0x38')];_0x1e4908[_0x0ea6('0x41')]=qs[_0x0ea6('0x42')](_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x42')]);_0x1e4908['where']=qs[_0x0ea6('0x3c')](_[_0x0ea6('0x44')](_0xfe0083[_0x0ea6('0x3a')],_0x4053dc[_0x0ea6('0x3c')]));if(_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x45')]){_0x1e4908[_0x0ea6('0x43')]=_[_0x0ea6('0x46')](_0x1e4908[_0x0ea6('0x43')],{'$or':_[_0x0ea6('0x39')](_0x1e4908[_0x0ea6('0x3e')],function(_0x23ab48){var _0x25b9da={};_0x25b9da[_0x23ab48]={'$like':'%'+_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x45')]+'%'};return _0x25b9da;})});}_0x1e4908=_[_0x0ea6('0x46')]({},_0x1e4908,_0xfe0083[_0x0ea6('0x48')]);return _0x20eb73[_0x0ea6('0x75')](_0x1e4908);}})[_0x0ea6('0x2a')](function(_0x5049b0){if(_0x5049b0){_0x4a2898=_0x5049b0[_0x0ea6('0x40')];if(!_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x77')]('nolimit')){_0x1e4908[_0x0ea6('0x24')]=qs['limit'](_0xfe0083['query'][_0x0ea6('0x24')]);_0x1e4908[_0x0ea6('0x23')]=qs['offset'](_0xfe0083[_0x0ea6('0x3a')][_0x0ea6('0x23')]);}return _0x20eb73[_0x0ea6('0x75')](_0x1e4908);}})['then'](function(_0x42643c){if(_0x42643c){return _0x42643c?{'count':_0x4a2898,'rows':_0x42643c}:null;}})[_0x0ea6('0x2a')](respondWithResult(_0x48e3b0,null))['catch'](handleError(_0x48e3b0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 54dcdcf..001230b 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 _0x9f34=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','Dashboard'];(function(_0x205a6e,_0x571a14){var _0x43adb6=function(_0xb71d8b){while(--_0xb71d8b){_0x205a6e['push'](_0x205a6e['shift']());}};_0x43adb6(++_0x571a14);}(_0x9f34,0xbb));var _0x49f3=function(_0xb0e367,_0x33e127){_0xb0e367=_0xb0e367-0x0;var _0x472015=_0x9f34[_0xb0e367];return _0x472015;};'use strict';var EventEmitter=require(_0x49f3('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x49f3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x49f3('0x2')](0x0);var events={'afterCreate':_0x49f3('0x3'),'afterUpdate':_0x49f3('0x4'),'afterDestroy':_0x49f3('0x5')};function emitEvent(_0x18c5cf){return function(_0x54c774,_0x46394b,_0x191b32){DashboardEvents[_0x49f3('0x6')](_0x18c5cf+':'+_0x54c774['id'],_0x54c774);DashboardEvents[_0x49f3('0x6')](_0x18c5cf,_0x54c774);_0x191b32(null);};}for(var e in events){if(events[_0x49f3('0x7')](e)){var event=events[e];Dashboard[_0x49f3('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x302d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard'];(function(_0x562b11,_0x46a33b){var _0x481c74=function(_0x1e9941){while(--_0x1e9941){_0x562b11['push'](_0x562b11['shift']());}};_0x481c74(++_0x46a33b);}(_0x302d,0x6b));var _0xd302=function(_0x5d061e,_0x5b0dfb){_0x5d061e=_0x5d061e-0x0;var _0x7756aa=_0x302d[_0x5d061e];return _0x7756aa;};'use strict';var EventEmitter=require(_0xd302('0x0'));var Dashboard=require(_0xd302('0x1'))['db'][_0xd302('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd302('0x3')](0x0);var events={'afterCreate':_0xd302('0x4'),'afterUpdate':_0xd302('0x5'),'afterDestroy':_0xd302('0x6')};function emitEvent(_0x3993b1){return function(_0x132246,_0x395e23,_0x52a0c1){DashboardEvents[_0xd302('0x7')](_0x3993b1+':'+_0x132246['id'],_0x132246);DashboardEvents[_0xd302('0x7')](_0x3993b1,_0x132246);_0x52a0c1(null);};}for(var e in events){if(events[_0xd302('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd302('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 fe517f2..342f4df 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 _0xf1ed=['dashboards','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x41c037,_0x467fe1){var _0xe796eb=function(_0x355871){while(--_0x355871){_0x41c037['push'](_0x41c037['shift']());}};_0xe796eb(++_0x467fe1);}(_0xf1ed,0xc1));var _0xdf1e=function(_0x3ddcc8,_0x1bdcbf){_0x3ddcc8=_0x3ddcc8-0x0;var _0x19f7d8=_0xf1ed[_0x3ddcc8];return _0x19f7d8;};'use strict';var _=require('lodash');var util=require(_0xdf1e('0x0'));var logger=require(_0xdf1e('0x1'))('api');var moment=require(_0xdf1e('0x2'));var BPromise=require(_0xdf1e('0x3'));var rp=require(_0xdf1e('0x4'));var fs=require('fs');var path=require(_0xdf1e('0x5'));var rimraf=require(_0xdf1e('0x6'));var config=require(_0xdf1e('0x7'));var attributes=require(_0xdf1e('0x8'));module['exports']=function(_0x116894,_0x39e2e9){return _0x116894[_0xdf1e('0x9')](_0xdf1e('0xa'),attributes,{'tableName':_0xdf1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd924=['exports','define','Dashboard','dashboards','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x3b6bc3,_0x133961){var _0x30f472=function(_0x3ee1d6){while(--_0x3ee1d6){_0x3b6bc3['push'](_0x3b6bc3['shift']());}};_0x30f472(++_0x133961);}(_0xd924,0xb4));var _0x4d92=function(_0x559ba1,_0x559c23){_0x559ba1=_0x559ba1-0x0;var _0x231b83=_0xd924[_0x559ba1];return _0x231b83;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4d92('0x0'));var moment=require(_0x4d92('0x1'));var BPromise=require('bluebird');var rp=require(_0x4d92('0x2'));var fs=require('fs');var path=require(_0x4d92('0x3'));var rimraf=require(_0x4d92('0x4'));var config=require(_0x4d92('0x5'));var attributes=require(_0x4d92('0x6'));module[_0x4d92('0x7')]=function(_0x5f22f5,_0x29073c){return _0x5f22f5[_0x4d92('0x8')](_0x4d92('0x9'),attributes,{'tableName':_0x4d92('0xa'),'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 ac43333..f909a28 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 _0xa3eb=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x45c9f4,_0x2eec90){var _0x1f9be9=function(_0x1a5cbe){while(--_0x1a5cbe){_0x45c9f4['push'](_0x45c9f4['shift']());}};_0x1f9be9(++_0x2eec90);}(_0xa3eb,0x1aa));var _0xba3e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa3eb[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba3e('0x0'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x1'));var fs=require('fs');var Redis=require(_0xba3e('0x2'));var db=require(_0xba3e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba3e('0x4'))(_0xba3e('0x5'));var config=require(_0xba3e('0x6'));var jayson=require(_0xba3e('0x7'));var client=jayson['client'][_0xba3e('0x8')]({'port':0x232a});config[_0xba3e('0x9')]=_[_0xba3e('0xa')](config[_0xba3e('0x9')],{'host':_0xba3e('0xb'),'port':0x18eb});var socket=require(_0xba3e('0xc'))(new Redis(config[_0xba3e('0x9')]));require(_0xba3e('0xd'))[_0xba3e('0xe')](socket);function respondWithRpcPromise(_0x4b01b7,_0x4bb2df,_0xb1f4ea){return new BPromise(function(_0x35c4b5,_0x370a7b){return client[_0xba3e('0xf')](_0x4b01b7,_0xb1f4ea)[_0xba3e('0x10')](function(_0x3fd6b5){logger[_0xba3e('0x11')](_0xba3e('0x12'),_0x4bb2df,_0xba3e('0x13'));logger[_0xba3e('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4bb2df,_0xba3e('0x13'),JSON[_0xba3e('0x15')](_0x3fd6b5));if(_0x3fd6b5[_0xba3e('0x16')]){if(_0x3fd6b5[_0xba3e('0x16')][_0xba3e('0x17')]===0x1f4){logger[_0xba3e('0x16')]('Dashboard,\x20%s,\x20%s',_0x4bb2df,_0x3fd6b5[_0xba3e('0x16')]['message']);return _0x370a7b(_0x3fd6b5[_0xba3e('0x16')][_0xba3e('0x18')]);}logger[_0xba3e('0x16')]('Dashboard,\x20%s,\x20%s',_0x4bb2df,_0x3fd6b5[_0xba3e('0x16')][_0xba3e('0x18')]);return _0x35c4b5(_0x3fd6b5['error'][_0xba3e('0x18')]);}else{logger[_0xba3e('0x11')](_0xba3e('0x12'),_0x4bb2df,'request\x20sent');_0x35c4b5(_0x3fd6b5[_0xba3e('0x19')]['message']);}})[_0xba3e('0x1a')](function(_0x1323d5){logger[_0xba3e('0x16')](_0xba3e('0x12'),_0x4bb2df,_0x1323d5);_0x370a7b(_0x1323d5);});});} \ No newline at end of file +var _0x9a50=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x39a014,_0x1b9388){var _0x5a4b84=function(_0x5ca493){while(--_0x5ca493){_0x39a014['push'](_0x39a014['shift']());}};_0x5a4b84(++_0x1b9388);}(_0x9a50,0xe4));var _0x09a5=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0x9a50[_0x75267d];return _0x21ccec;};'use strict';var _=require(_0x09a5('0x0'));var util=require(_0x09a5('0x1'));var moment=require(_0x09a5('0x2'));var BPromise=require(_0x09a5('0x3'));var rs=require(_0x09a5('0x4'));var fs=require('fs');var Redis=require(_0x09a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x09a5('0x6'));var logger=require(_0x09a5('0x7'))(_0x09a5('0x8'));var config=require(_0x09a5('0x9'));var jayson=require(_0x09a5('0xa'));var client=jayson[_0x09a5('0xb')][_0x09a5('0xc')]({'port':0x232a});config[_0x09a5('0xd')]=_[_0x09a5('0xe')](config[_0x09a5('0xd')],{'host':_0x09a5('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x09a5('0x10'))[_0x09a5('0x11')](socket);function respondWithRpcPromise(_0x296cf3,_0x1c5e29,_0x13252e){return new BPromise(function(_0x4e3681,_0xe448d6){return client[_0x09a5('0x12')](_0x296cf3,_0x13252e)[_0x09a5('0x13')](function(_0x58f2a1){logger[_0x09a5('0x14')](_0x09a5('0x15'),_0x1c5e29,_0x09a5('0x16'));logger[_0x09a5('0x17')](_0x09a5('0x18'),_0x1c5e29,_0x09a5('0x16'),JSON['stringify'](_0x58f2a1));if(_0x58f2a1[_0x09a5('0x19')]){if(_0x58f2a1[_0x09a5('0x19')][_0x09a5('0x1a')]===0x1f4){logger[_0x09a5('0x19')](_0x09a5('0x15'),_0x1c5e29,_0x58f2a1[_0x09a5('0x19')]['message']);return _0xe448d6(_0x58f2a1[_0x09a5('0x19')][_0x09a5('0x1b')]);}logger['error'](_0x09a5('0x15'),_0x1c5e29,_0x58f2a1[_0x09a5('0x19')][_0x09a5('0x1b')]);return _0x4e3681(_0x58f2a1[_0x09a5('0x19')][_0x09a5('0x1b')]);}else{logger['info'](_0x09a5('0x15'),_0x1c5e29,_0x09a5('0x16'));_0x4e3681(_0x58f2a1['result'][_0x09a5('0x1b')]);}})[_0x09a5('0x1c')](function(_0x3dc13b){logger['error'](_0x09a5('0x15'),_0x1c5e29,_0x3dc13b);_0xe448d6(_0x3dc13b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c66db99..2c661dc 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 _0xb75c=['update','register','length','dashboard:','save','remove'];(function(_0x447f88,_0x446023){var _0x163c24=function(_0x1fbbe4){while(--_0x1fbbe4){_0x447f88['push'](_0x447f88['shift']());}};_0x163c24(++_0x446023);}(_0xb75c,0x16c));var _0xcb75=function(_0x15bd64,_0xebf6d4){_0x15bd64=_0x15bd64-0x0;var _0x204598=_0xb75c[_0x15bd64];return _0x204598;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xcb75('0x0'),_0xcb75('0x1'),_0xcb75('0x2')];function createListener(_0xd2fbea,_0x2649a1){return function(_0x40a9e7){_0x2649a1['emit'](_0xd2fbea,_0x40a9e7);};}function removeListener(_0x35bcd0,_0x4605d9){return function(){DashboardEvents['removeListener'](_0x35bcd0,_0x4605d9);};}exports[_0xcb75('0x3')]=function(_0x166b53){for(var _0xe6ff9e=0x0,_0x7681de=events[_0xcb75('0x4')];_0xe6ff9e<_0x7681de;_0xe6ff9e++){var _0x1aed1b=events[_0xe6ff9e];var _0x4ef9fe=createListener(_0xcb75('0x5')+_0x1aed1b,_0x166b53);DashboardEvents['on'](_0x1aed1b,_0x4ef9fe);}}; \ No newline at end of file +var _0x905d=['length','dashboard:','./dashboard.events','save','remove','update','removeListener','register'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x905d,0x1c2));var _0xd905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x905d[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xd905('0x0'));var events=[_0xd905('0x1'),_0xd905('0x2'),_0xd905('0x3')];function createListener(_0x55efb1,_0x266de9){return function(_0x2b8954){_0x266de9['emit'](_0x55efb1,_0x2b8954);};}function removeListener(_0x504f4c,_0x4e7a0c){return function(){DashboardEvents[_0xd905('0x4')](_0x504f4c,_0x4e7a0c);};}exports[_0xd905('0x5')]=function(_0x42bf2d){for(var _0x4a6133=0x0,_0x17e606=events[_0xd905('0x6')];_0x4a6133<_0x17e606;_0x4a6133++){var _0x51b163=events[_0x4a6133];var _0x33097e=createListener(_0xd905('0x7')+_0x51b163,_0x42bf2d);DashboardEvents['on'](_0x51b163,_0x33097e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e391ee0..c2f5147 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 _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(_0x524074,_0x17b3e1){var _0x3f6cd7=function(_0x318cfe){while(--_0x318cfe){_0x524074['push'](_0x524074['shift']());}};_0x3f6cd7(++_0x17b3e1);}(_0x70e0,0x17b));var _0x070e=function(_0x215a47,_0x590659){_0x215a47=_0x215a47-0x0;var _0x29a47f=_0x70e0[_0x215a47];return _0x29a47f;};'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 +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(_0x1f8edc,_0x2657b7){var _0x122cfa=function(_0x4320b6){while(--_0x4320b6){_0x1f8edc['push'](_0x1f8edc['shift']());}};_0x122cfa(++_0x2657b7);}(_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 diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a279271..6218ef0 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 _0x2de4=['TEXT','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x560348,_0xa21f17){var _0x5ef83a=function(_0xfc7538){while(--_0xfc7538){_0x560348['push'](_0x560348['shift']());}};_0x5ef83a(++_0xa21f17);}(_0x2de4,0xa5));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x42de('0x0'));var _=require(_0x42de('0x1'));module['exports']={'title':{'type':Sequelize[_0x42de('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x42de('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x42de('0x3')]('long'),'get':function(){try{return JSON[_0x42de('0x4')](this[_0x42de('0x5')]('attrs'));}catch(_0x153fe4){return[];}},'set':function(_0x5ba47d){try{this[_0x42de('0x6')](_0x42de('0x7'),JSON[_0x42de('0x8')](_0x5ba47d));}catch(_0x2a5027){this[_0x42de('0x6')](_0x42de('0x7'),JSON[_0x42de('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x42de('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x42de('0x2')],'allowNull':![],'defaultValue':_0x42de('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x42de('0x2')],'allowNull':![],'defaultValue':_0x42de('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x42de('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x64b5=['sequelize','squel','STRING','TEXT','long','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x43e3ef,_0x174a25){var _0xc0fec2=function(_0x8be268){while(--_0x8be268){_0x43e3ef['push'](_0x43e3ef['shift']());}};_0xc0fec2(++_0x174a25);}(_0x64b5,0x1d4));var _0x564b=function(_0xa92cae,_0x22169f){_0xa92cae=_0xa92cae-0x0;var _0x396d0c=_0x64b5[_0xa92cae];return _0x396d0c;};'use strict';var Sequelize=require(_0x564b('0x0'));var squel=require(_0x564b('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x564b('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x564b('0x3')](_0x564b('0x4')),'get':function(){try{return JSON['parse'](this[_0x564b('0x5')]('attrs'));}catch(_0x3356b9){return[];}},'set':function(_0x8a9957){try{this[_0x564b('0x6')](_0x564b('0x7'),JSON[_0x564b('0x8')](_0x8a9957));}catch(_0x119072){this[_0x564b('0x6')]('attrs',JSON[_0x564b('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x564b('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x564b('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x564b('0x9')]},'col':{'type':Sequelize[_0x564b('0x9')]},'background':{'type':Sequelize[_0x564b('0x2')],'allowNull':![],'defaultValue':_0x564b('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x564b('0x2')],'allowNull':![],'defaultValue':_0x564b('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x564b('0x2')]},'titleFontSize':{'type':Sequelize[_0x564b('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 1840ff1..997a69c 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 _0xbcc5=['reject','save','then','destroy','sendStatus','error','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','catch','find','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','end','status','json','count','offset','limit','set','apply'];(function(_0x2a0f59,_0x1d5d7c){var _0x19ea18=function(_0x2d459c){while(--_0x2d459c){_0x2a0f59['push'](_0x2a0f59['shift']());}};_0x19ea18(++_0x1d5d7c);}(_0xbcc5,0x14a));var _0x5bcc=function(_0x12691e,_0x1fa539){_0x12691e=_0x12691e-0x0;var _0x1c99f1=_0xbcc5[_0x12691e];return _0x1c99f1;};'use strict';var pdf=require(_0x5bcc('0x0'));var emlformat=require(_0x5bcc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bcc('0x2'));var jsonpatch=require(_0x5bcc('0x3'));var rp=require(_0x5bcc('0x4'));var moment=require('moment');var BPromise=require(_0x5bcc('0x5'));var Mustache=require(_0x5bcc('0x6'));var util=require('util');var path=require(_0x5bcc('0x7'));var sox=require(_0x5bcc('0x8'));var csv=require('to-csv');var ejs=require(_0x5bcc('0x9'));var fs=require('fs');var _=require(_0x5bcc('0xa'));var squel=require(_0x5bcc('0xb'));var crypto=require(_0x5bcc('0xc'));var jsforce=require(_0x5bcc('0xd'));var deskjs=require(_0x5bcc('0xe'));var toCsv=require(_0x5bcc('0xf'));var querystring=require(_0x5bcc('0x10'));var Papa=require(_0x5bcc('0x11'));var Redis=require(_0x5bcc('0x12'));var authService=require(_0x5bcc('0x13'));var qs=require(_0x5bcc('0x14'));var as=require(_0x5bcc('0x15'));var hardwareService=require(_0x5bcc('0x16'));var logger=require(_0x5bcc('0x17'))(_0x5bcc('0x18'));var utils=require(_0x5bcc('0x19'));var config=require(_0x5bcc('0x1a'));var licenseUtil=require(_0x5bcc('0x1b'));var db=require(_0x5bcc('0x1c'))['db'];config['redis']=_[_0x5bcc('0x1d')](config[_0x5bcc('0x1e')],{'host':_0x5bcc('0x1f'),'port':0x18eb});var socket=require(_0x5bcc('0x20'))(new Redis(config[_0x5bcc('0x1e')]));require('./dashboardItem.socket')[_0x5bcc('0x21')](socket);function respondWithStatusCode(_0x51a3e4,_0x194350){_0x194350=_0x194350||0xcc;return function(_0x13e163){if(_0x13e163){return _0x51a3e4['sendStatus'](_0x194350);}return _0x51a3e4['status'](_0x194350)[_0x5bcc('0x22')]();};}function respondWithResult(_0x32ee47,_0x99f933){_0x99f933=_0x99f933||0xc8;return function(_0x320c3b){if(_0x320c3b){return _0x32ee47[_0x5bcc('0x23')](_0x99f933)[_0x5bcc('0x24')](_0x320c3b);}};}function respondWithFilteredResult(_0xb667a2,_0x594520){return function(_0x1c5b16){if(_0x1c5b16){var _0x57ff41=_0x1c5b16[_0x5bcc('0x25')],_0x5c0c49=_0x594520[_0x5bcc('0x26')],_0x4f2656=_0x594520[_0x5bcc('0x26')]+_0x594520[_0x5bcc('0x27')],_0xeba462;if(_0x4f2656>=_0x57ff41){_0x4f2656=_0x57ff41;_0xeba462=0xc8;}else{_0xeba462=0xce;}_0xb667a2['status'](_0xeba462);return _0xb667a2[_0x5bcc('0x28')]('Content-Range',_0x5c0c49+'-'+_0x4f2656+'/'+_0x57ff41)[_0x5bcc('0x24')](_0x1c5b16);}return null;};}function patchUpdates(_0x3d11d8){return function(_0x17b145){try{jsonpatch[_0x5bcc('0x29')](_0x17b145,_0x3d11d8,!![]);}catch(_0x25e8fd){return BPromise[_0x5bcc('0x2a')](_0x25e8fd);}return _0x17b145[_0x5bcc('0x2b')]();};}function saveUpdates(_0x4db103,_0x44e21b){return function(_0x5a3d36){if(_0x5a3d36){return _0x5a3d36['update'](_0x4db103)[_0x5bcc('0x2c')](function(_0x31fe61){return _0x31fe61;});}return null;};}function removeEntity(_0x5c527d,_0x699cc9){return function(_0x30001e){if(_0x30001e){return _0x30001e[_0x5bcc('0x2d')]()[_0x5bcc('0x2c')](function(){_0x5c527d[_0x5bcc('0x23')](0xcc)[_0x5bcc('0x22')]();});}};}function handleEntityNotFound(_0x4f366f,_0x249f4d){return function(_0x4d3a73){if(!_0x4d3a73){_0x4f366f[_0x5bcc('0x2e')](0x194);}return _0x4d3a73;};}function handleError(_0x1cc8fb,_0x5591c2){_0x5591c2=_0x5591c2||0x1f4;return function(_0x45b1ae){logger[_0x5bcc('0x2f')](_0x45b1ae['stack']);if(_0x45b1ae['name']){delete _0x45b1ae[_0x5bcc('0x30')];}_0x1cc8fb['status'](_0x5591c2)[_0x5bcc('0x31')](_0x45b1ae);};}exports[_0x5bcc('0x32')]=function(_0x4fb06e,_0x459c8c){var _0x1e7f72={'raw':![],'where':{'id':_0x4fb06e[_0x5bcc('0x33')]['id']}},_0x1f7362={};_0x1f7362['model']=_[_0x5bcc('0x34')](db[_0x5bcc('0x35')][_0x5bcc('0x36')]);_0x1f7362['query']=_[_0x5bcc('0x34')](_0x4fb06e[_0x5bcc('0x37')]);_0x1f7362[_0x5bcc('0x38')]=_[_0x5bcc('0x39')](_0x1f7362[_0x5bcc('0x3a')],_0x1f7362[_0x5bcc('0x37')]);_0x1e7f72[_0x5bcc('0x3b')]=_[_0x5bcc('0x39')](_0x1f7362[_0x5bcc('0x3a')],qs['fields'](_0x4fb06e['query'][_0x5bcc('0x3c')]));_0x1e7f72['attributes']=_0x1e7f72[_0x5bcc('0x3b')][_0x5bcc('0x3d')]?_0x1e7f72[_0x5bcc('0x3b')]:_0x1f7362[_0x5bcc('0x3a')];if(_0x4fb06e['query'][_0x5bcc('0x3e')]){_0x1e7f72[_0x5bcc('0x3f')]=[{'all':!![]}];}_0x1e7f72=_[_0x5bcc('0x40')]({},_0x1e7f72,_0x4fb06e['options']);return db['DashboardItem']['find'](_0x1e7f72)[_0x5bcc('0x2c')](handleEntityNotFound(_0x459c8c,null))[_0x5bcc('0x2c')](respondWithResult(_0x459c8c,null))[_0x5bcc('0x41')](handleError(_0x459c8c,null));};exports[_0x5bcc('0x2d')]=function(_0x2a40f4,_0x5b5246){return db['DashboardItem'][_0x5bcc('0x42')]({'where':{'id':_0x2a40f4['params']['id']}})['then'](handleEntityNotFound(_0x5b5246,null))[_0x5bcc('0x2c')](removeEntity(_0x5b5246,null))[_0x5bcc('0x41')](handleError(_0x5b5246,null));};function widgetAttributes(_0x44d6f0){try{switch(_0x44d6f0[_0x5bcc('0x43')]){case _0x5bcc('0x44'):return[{'name':_0x5bcc('0x45'),'value':_0x44d6f0[_0x5bcc('0x45')]||(_0x44d6f0['attrs']&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x47')]:undefined)||'https://'}];case _0x5bcc('0x48'):return[{'name':_0x5bcc('0x49'),'value':_0x44d6f0[_0x5bcc('0x49')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x47')]:undefined)||''}];case _0x5bcc('0x4a'):return[{'name':_0x5bcc('0x4b'),'value':_0x44d6f0[_0x5bcc('0x4b')]||(_0x44d6f0['attrs']&&_0x44d6f0['attrs'][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x47')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x44d6f0['attrTimezone']||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x1]?_0x44d6f0['attrs'][0x1]['value']:undefined)||_0x5bcc('0x4c')},{'name':'attrFontSize','value':_0x44d6f0[_0x5bcc('0x4d')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x2]?_0x44d6f0[_0x5bcc('0x46')][0x2]['value']:undefined)||0xc}];case _0x5bcc('0x4e'):return[{'name':_0x5bcc('0x4f'),'value':_0x44d6f0[_0x5bcc('0x4f')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0]['value']:undefined)||'total'},{'name':_0x5bcc('0x50'),'value':_0x44d6f0[_0x5bcc('0x50')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x1]?_0x44d6f0['attrs'][0x1][_0x5bcc('0x47')]:undefined)||[]},{'name':_0x5bcc('0x4d'),'value':_0x44d6f0[_0x5bcc('0x4d')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x2]?_0x44d6f0['attrs'][0x2][_0x5bcc('0x47')]:undefined)||0x14}];case _0x5bcc('0x51'):case _0x5bcc('0x52'):return[{'name':_0x5bcc('0x53'),'value':_0x44d6f0[_0x5bcc('0x53')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x47')]:undefined)||'total'},{'name':_0x5bcc('0x54'),'value':_0x44d6f0[_0x5bcc('0x54')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0['attrs'][0x1]?_0x44d6f0[_0x5bcc('0x46')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x44d6f0[_0x5bcc('0x55')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x2]?_0x44d6f0[_0x5bcc('0x46')][0x2][_0x5bcc('0x47')]:undefined)||null},{'name':_0x5bcc('0x50'),'value':_0x44d6f0[_0x5bcc('0x50')]||(_0x44d6f0['attrs']&&_0x44d6f0[_0x5bcc('0x46')][0x3]?_0x44d6f0['attrs'][0x3][_0x5bcc('0x47')]:undefined)||[]}];case'web-report':return[{'name':_0x5bcc('0x56'),'type':_0x44d6f0[_0x5bcc('0x57')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x43')]:undefined)||null,'value':_0x44d6f0[_0x5bcc('0x56')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x0]?_0x44d6f0[_0x5bcc('0x46')][0x0][_0x5bcc('0x47')]:undefined)||null},{'name':_0x5bcc('0x58'),'value':_0x44d6f0[_0x5bcc('0x58')]||(_0x44d6f0[_0x5bcc('0x46')]&&_0x44d6f0[_0x5bcc('0x46')][0x1]?_0x44d6f0['attrs'][0x1][_0x5bcc('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x520c22){logger[_0x5bcc('0x2f')](_0x5bcc('0x59'),JSON['stringify'](_0x520c22));return[];}}exports[_0x5bcc('0x5a')]=function(_0x3e88ed,_0x3747ac){if(_0x3e88ed[_0x5bcc('0x5b')]){_0x3e88ed['body'][_0x5bcc('0x46')]=widgetAttributes(_0x3e88ed[_0x5bcc('0x5b')]);}return db[_0x5bcc('0x35')][_0x5bcc('0x5a')](_0x3e88ed[_0x5bcc('0x5b')],{})[_0x5bcc('0x2c')](respondWithResult(_0x3747ac,0xc9))[_0x5bcc('0x41')](handleError(_0x3747ac,null));};exports[_0x5bcc('0x5c')]=function(_0x427eff,_0x28218c){if(_0x427eff[_0x5bcc('0x5b')]['id']){delete _0x427eff[_0x5bcc('0x5b')]['id'];}_0x427eff[_0x5bcc('0x5b')][_0x5bcc('0x46')]=widgetAttributes(_0x427eff[_0x5bcc('0x5b')]);return db['DashboardItem'][_0x5bcc('0x42')]({'where':{'id':_0x427eff[_0x5bcc('0x33')]['id']}})[_0x5bcc('0x2c')](handleEntityNotFound(_0x28218c,null))[_0x5bcc('0x2c')](saveUpdates(_0x427eff[_0x5bcc('0x5b')],null))['then'](respondWithResult(_0x28218c,null))['catch'](handleError(_0x28218c,null));}; \ No newline at end of file +var _0xcc5d=['update','then','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','eml-format','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x25ab2b,_0x4809c9){var _0x4d6342=function(_0x2e360c){while(--_0x2e360c){_0x25ab2b['push'](_0x25ab2b['shift']());}};_0x4d6342(++_0x4809c9);}(_0xcc5d,0x19b));var _0xdcc5=function(_0x12e795,_0x83c81b){_0x12e795=_0x12e795-0x0;var _0x5b748f=_0xcc5d[_0x12e795];return _0x5b748f;};'use strict';var pdf=require(_0xdcc5('0x0'));var emlformat=require(_0xdcc5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdcc5('0x2'));var rp=require('request-promise');var moment=require(_0xdcc5('0x3'));var BPromise=require(_0xdcc5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcc5('0x5'));var sox=require(_0xdcc5('0x6'));var csv=require(_0xdcc5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdcc5('0x8'));var squel=require(_0xdcc5('0x9'));var crypto=require(_0xdcc5('0xa'));var jsforce=require(_0xdcc5('0xb'));var deskjs=require(_0xdcc5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdcc5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdcc5('0xe'));var as=require(_0xdcc5('0xf'));var hardwareService=require(_0xdcc5('0x10'));var logger=require(_0xdcc5('0x11'))('api');var utils=require(_0xdcc5('0x12'));var config=require(_0xdcc5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcc5('0x14'))['db'];config[_0xdcc5('0x15')]=_[_0xdcc5('0x16')](config['redis'],{'host':_0xdcc5('0x17'),'port':0x18eb});var socket=require(_0xdcc5('0x18'))(new Redis(config[_0xdcc5('0x15')]));require(_0xdcc5('0x19'))[_0xdcc5('0x1a')](socket);function respondWithStatusCode(_0x269739,_0x4a21fb){_0x4a21fb=_0x4a21fb||0xcc;return function(_0x213cce){if(_0x213cce){return _0x269739[_0xdcc5('0x1b')](_0x4a21fb);}return _0x269739['status'](_0x4a21fb)[_0xdcc5('0x1c')]();};}function respondWithResult(_0x2ee9de,_0x3c21ba){_0x3c21ba=_0x3c21ba||0xc8;return function(_0xfac65c){if(_0xfac65c){return _0x2ee9de[_0xdcc5('0x1d')](_0x3c21ba)['json'](_0xfac65c);}};}function respondWithFilteredResult(_0x10720f,_0x2f1bfc){return function(_0x4dddb9){if(_0x4dddb9){var _0x1fd8a0=_0x4dddb9[_0xdcc5('0x1e')],_0x518210=_0x2f1bfc[_0xdcc5('0x1f')],_0x5b518f=_0x2f1bfc[_0xdcc5('0x1f')]+_0x2f1bfc[_0xdcc5('0x20')],_0x2a6283;if(_0x5b518f>=_0x1fd8a0){_0x5b518f=_0x1fd8a0;_0x2a6283=0xc8;}else{_0x2a6283=0xce;}_0x10720f[_0xdcc5('0x1d')](_0x2a6283);return _0x10720f[_0xdcc5('0x21')](_0xdcc5('0x22'),_0x518210+'-'+_0x5b518f+'/'+_0x1fd8a0)[_0xdcc5('0x23')](_0x4dddb9);}return null;};}function patchUpdates(_0x814e22){return function(_0x3a594d){try{jsonpatch[_0xdcc5('0x24')](_0x3a594d,_0x814e22,!![]);}catch(_0x17f444){return BPromise[_0xdcc5('0x25')](_0x17f444);}return _0x3a594d[_0xdcc5('0x26')]();};}function saveUpdates(_0x1a7017,_0x118497){return function(_0x1dfac5){if(_0x1dfac5){return _0x1dfac5[_0xdcc5('0x27')](_0x1a7017)[_0xdcc5('0x28')](function(_0x251abb){return _0x251abb;});}return null;};}function removeEntity(_0x2fc347,_0x2ce912){return function(_0x4c29c0){if(_0x4c29c0){return _0x4c29c0['destroy']()[_0xdcc5('0x28')](function(){_0x2fc347['status'](0xcc)[_0xdcc5('0x1c')]();});}};}function handleEntityNotFound(_0x87e065,_0x29f59e){return function(_0x4f68a6){if(!_0x4f68a6){_0x87e065[_0xdcc5('0x1b')](0x194);}return _0x4f68a6;};}function handleError(_0x40102c,_0x1f88f2){_0x1f88f2=_0x1f88f2||0x1f4;return function(_0x1332c4){logger[_0xdcc5('0x29')](_0x1332c4[_0xdcc5('0x2a')]);if(_0x1332c4[_0xdcc5('0x2b')]){delete _0x1332c4[_0xdcc5('0x2b')];}_0x40102c[_0xdcc5('0x1d')](_0x1f88f2)['send'](_0x1332c4);};}exports[_0xdcc5('0x2c')]=function(_0x166a83,_0x52289e){var _0x16773d={'raw':![],'where':{'id':_0x166a83[_0xdcc5('0x2d')]['id']}},_0xef4299={};_0xef4299[_0xdcc5('0x2e')]=_[_0xdcc5('0x2f')](db[_0xdcc5('0x30')][_0xdcc5('0x31')]);_0xef4299[_0xdcc5('0x32')]=_['keys'](_0x166a83[_0xdcc5('0x32')]);_0xef4299[_0xdcc5('0x33')]=_['intersection'](_0xef4299[_0xdcc5('0x2e')],_0xef4299['query']);_0x16773d[_0xdcc5('0x34')]=_['intersection'](_0xef4299[_0xdcc5('0x2e')],qs[_0xdcc5('0x35')](_0x166a83[_0xdcc5('0x32')][_0xdcc5('0x35')]));_0x16773d[_0xdcc5('0x34')]=_0x16773d[_0xdcc5('0x34')][_0xdcc5('0x36')]?_0x16773d[_0xdcc5('0x34')]:_0xef4299[_0xdcc5('0x2e')];if(_0x166a83[_0xdcc5('0x32')][_0xdcc5('0x37')]){_0x16773d[_0xdcc5('0x38')]=[{'all':!![]}];}_0x16773d=_[_0xdcc5('0x39')]({},_0x16773d,_0x166a83['options']);return db[_0xdcc5('0x30')][_0xdcc5('0x3a')](_0x16773d)['then'](handleEntityNotFound(_0x52289e,null))[_0xdcc5('0x28')](respondWithResult(_0x52289e,null))['catch'](handleError(_0x52289e,null));};exports['destroy']=function(_0x1482f6,_0x1473db){return db[_0xdcc5('0x30')][_0xdcc5('0x3a')]({'where':{'id':_0x1482f6[_0xdcc5('0x2d')]['id']}})[_0xdcc5('0x28')](handleEntityNotFound(_0x1473db,null))[_0xdcc5('0x28')](removeEntity(_0x1473db,null))[_0xdcc5('0x3b')](handleError(_0x1473db,null));};function widgetAttributes(_0x4d410d){try{switch(_0x4d410d['type']){case _0xdcc5('0x3c'):return[{'name':_0xdcc5('0x3d'),'value':_0x4d410d[_0xdcc5('0x3d')]||(_0x4d410d['attrs']&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d[_0xdcc5('0x3e')][0x0][_0xdcc5('0x3f')]:undefined)||_0xdcc5('0x40')}];case _0xdcc5('0x41'):return[{'name':'attrPath','value':_0x4d410d[_0xdcc5('0x42')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d['attrs'][0x0][_0xdcc5('0x3f')]:undefined)||''}];case _0xdcc5('0x43'):return[{'name':_0xdcc5('0x44'),'value':_0x4d410d[_0xdcc5('0x44')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d['attrs'][0x0][_0xdcc5('0x3f')]:undefined)||_0xdcc5('0x45')},{'name':_0xdcc5('0x46'),'value':_0x4d410d[_0xdcc5('0x46')]||(_0x4d410d['attrs']&&_0x4d410d[_0xdcc5('0x3e')][0x1]?_0x4d410d['attrs'][0x1][_0xdcc5('0x3f')]:undefined)||_0xdcc5('0x47')},{'name':_0xdcc5('0x48'),'value':_0x4d410d[_0xdcc5('0x48')]||(_0x4d410d['attrs']&&_0x4d410d[_0xdcc5('0x3e')][0x2]?_0x4d410d['attrs'][0x2]['value']:undefined)||0xc}];case _0xdcc5('0x49'):return[{'name':'attrMetric','value':_0x4d410d[_0xdcc5('0x4a')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d[_0xdcc5('0x3e')][0x0][_0xdcc5('0x3f')]:undefined)||_0xdcc5('0x4b')},{'name':'attrVoiceQueues','value':_0x4d410d[_0xdcc5('0x4c')]||(_0x4d410d['attrs']&&_0x4d410d[_0xdcc5('0x3e')][0x1]?_0x4d410d[_0xdcc5('0x3e')][0x1][_0xdcc5('0x3f')]:undefined)||[]},{'name':_0xdcc5('0x48'),'value':_0x4d410d['attrFontSize']||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x2]?_0x4d410d[_0xdcc5('0x3e')][0x2][_0xdcc5('0x3f')]:undefined)||0x14}];case _0xdcc5('0x4d'):case'pie-chart':return[{'name':_0xdcc5('0x4e'),'value':_0x4d410d[_0xdcc5('0x4e')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d[_0xdcc5('0x3e')][0x0]['value']:undefined)||_0xdcc5('0x4b')},{'name':_0xdcc5('0x4f'),'value':_0x4d410d[_0xdcc5('0x4f')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d['attrs'][0x1]?_0x4d410d['attrs'][0x1][_0xdcc5('0x3f')]:undefined)||null},{'name':_0xdcc5('0x50'),'value':_0x4d410d[_0xdcc5('0x50')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d['attrs'][0x2]?_0x4d410d[_0xdcc5('0x3e')][0x2][_0xdcc5('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d410d[_0xdcc5('0x4c')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x3]?_0x4d410d[_0xdcc5('0x3e')][0x3]['value']:undefined)||[]}];case _0xdcc5('0x51'):return[{'name':_0xdcc5('0x52'),'type':_0x4d410d[_0xdcc5('0x53')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d[_0xdcc5('0x3e')][0x0][_0xdcc5('0x54')]:undefined)||null,'value':_0x4d410d[_0xdcc5('0x52')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d[_0xdcc5('0x3e')][0x0]?_0x4d410d[_0xdcc5('0x3e')][0x0][_0xdcc5('0x3f')]:undefined)||null},{'name':_0xdcc5('0x55'),'value':_0x4d410d[_0xdcc5('0x55')]||(_0x4d410d[_0xdcc5('0x3e')]&&_0x4d410d['attrs'][0x1]?_0x4d410d[_0xdcc5('0x3e')][0x1][_0xdcc5('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x3eebc9){logger[_0xdcc5('0x29')](_0xdcc5('0x56'),JSON[_0xdcc5('0x57')](_0x3eebc9));return[];}}exports['create']=function(_0x4af08d,_0x464054){if(_0x4af08d['body']){_0x4af08d[_0xdcc5('0x58')][_0xdcc5('0x3e')]=widgetAttributes(_0x4af08d['body']);}return db[_0xdcc5('0x30')][_0xdcc5('0x59')](_0x4af08d[_0xdcc5('0x58')],{})[_0xdcc5('0x28')](respondWithResult(_0x464054,0xc9))['catch'](handleError(_0x464054,null));};exports[_0xdcc5('0x27')]=function(_0x3034d0,_0x660475){if(_0x3034d0[_0xdcc5('0x58')]['id']){delete _0x3034d0[_0xdcc5('0x58')]['id'];}_0x3034d0[_0xdcc5('0x58')]['attrs']=widgetAttributes(_0x3034d0[_0xdcc5('0x58')]);return db[_0xdcc5('0x30')][_0xdcc5('0x3a')]({'where':{'id':_0x3034d0[_0xdcc5('0x2d')]['id']}})[_0xdcc5('0x28')](handleEntityNotFound(_0x660475,null))[_0xdcc5('0x28')](saveUpdates(_0x3034d0[_0xdcc5('0x58')],null))[_0xdcc5('0x28')](respondWithResult(_0x660475,null))[_0xdcc5('0x3b')](handleError(_0x660475,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 75dd7f7..4a1de6f 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 _0x4f34=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x4f34,0xc8));var _0x44f3=function(_0x5b8b64,_0x45e432){_0x5b8b64=_0x5b8b64-0x0;var _0xe68a6d=_0x4f34[_0x5b8b64];return _0xe68a6d;};'use strict';var EventEmitter=require(_0x44f3('0x0'));var DashboardItem=require(_0x44f3('0x1'))['db'][_0x44f3('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x44f3('0x3')](0x0);var events={'afterCreate':_0x44f3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21e8ec){return function(_0x6c824a,_0x5d2124,_0x41cf11){DashboardItemEvents[_0x44f3('0x5')](_0x21e8ec+':'+_0x6c824a['id'],_0x6c824a);DashboardItemEvents[_0x44f3('0x5')](_0x21e8ec,_0x6c824a);_0x41cf11(null);};}for(var e in events){if(events[_0x44f3('0x6')](e)){var event=events[e];DashboardItem[_0x44f3('0x7')](e,emitEvent(event));}}module[_0x44f3('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x32d6=['save','update','remove','emit','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x30b288,_0x1e0a34){var _0x15814a=function(_0x3a1560){while(--_0x3a1560){_0x30b288['push'](_0x30b288['shift']());}};_0x15814a(++_0x1e0a34);}(_0x32d6,0xef));var _0x632d=function(_0xea3d4b,_0x2e1fa9){_0xea3d4b=_0xea3d4b-0x0;var _0x675b01=_0x32d6[_0xea3d4b];return _0x675b01;};'use strict';var EventEmitter=require(_0x632d('0x0'));var DashboardItem=require(_0x632d('0x1'))['db'][_0x632d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x632d('0x3')](0x0);var events={'afterCreate':_0x632d('0x4'),'afterUpdate':_0x632d('0x5'),'afterDestroy':_0x632d('0x6')};function emitEvent(_0x31c5b9){return function(_0x50af78,_0x5b014d,_0x415d2c){DashboardItemEvents[_0x632d('0x7')](_0x31c5b9+':'+_0x50af78['id'],_0x50af78);DashboardItemEvents['emit'](_0x31c5b9,_0x50af78);_0x415d2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x632d('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6192560..6e622f9 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 _0x405c=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x3a8a52,_0x329578){var _0x4a41af=function(_0x4e5090){while(--_0x4e5090){_0x3a8a52['push'](_0x3a8a52['shift']());}};_0x4a41af(++_0x329578);}(_0x405c,0x1c2));var _0xc405=function(_0x49ec8e,_0xce5ac6){_0x49ec8e=_0x49ec8e-0x0;var _0x4e1f2c=_0x405c[_0x49ec8e];return _0x4e1f2c;};'use strict';var _=require(_0xc405('0x0'));var util=require(_0xc405('0x1'));var logger=require(_0xc405('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc405('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc405('0x4'));var rimraf=require(_0xc405('0x5'));var config=require(_0xc405('0x6'));var attributes=require(_0xc405('0x7'));module[_0xc405('0x8')]=function(_0x49f15a,_0x49c78f){return _0x49f15a['define']('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2744=['../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1db099,_0x5d297a){var _0xe039be=function(_0x4fd6cb){while(--_0x4fd6cb){_0x1db099['push'](_0x1db099['shift']());}};_0xe039be(++_0x5d297a);}(_0x2744,0x101));var _0x4274=function(_0x47bd65,_0x50decf){_0x47bd65=_0x47bd65-0x0;var _0x360132=_0x2744[_0x47bd65];return _0x360132;};'use strict';var _=require(_0x4274('0x0'));var util=require(_0x4274('0x1'));var logger=require(_0x4274('0x2'))(_0x4274('0x3'));var moment=require(_0x4274('0x4'));var BPromise=require(_0x4274('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4274('0x6'));var config=require(_0x4274('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x4274('0x8')]=function(_0x28bb4d,_0x58a583){return _0x28bb4d[_0x4274('0x9')](_0x4274('0xa'),attributes,{'tableName':_0x4274('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 53a3592..9c2d144 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 _0x49dc=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x4a90b8,_0x13d54b){var _0x9eccc8=function(_0x2ee015){while(--_0x2ee015){_0x4a90b8['push'](_0x4a90b8['shift']());}};_0x9eccc8(++_0x13d54b);}(_0x49dc,0x198));var _0xc49d=function(_0x9250ea,_0x44f108){_0x9250ea=_0x9250ea-0x0;var _0x4da8e3=_0x49dc[_0x9250ea];return _0x4da8e3;};'use strict';var _=require(_0xc49d('0x0'));var util=require(_0xc49d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc49d('0x2'));var fs=require('fs');var Redis=require(_0xc49d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc49d('0x4'));var config=require(_0xc49d('0x5'));var jayson=require(_0xc49d('0x6'));var client=jayson['client'][_0xc49d('0x7')]({'port':0x232a});config[_0xc49d('0x8')]=_['defaults'](config[_0xc49d('0x8')],{'host':_0xc49d('0x9'),'port':0x18eb});var socket=require(_0xc49d('0xa'))(new Redis(config[_0xc49d('0x8')]));require(_0xc49d('0xb'))[_0xc49d('0xc')](socket);function respondWithRpcPromise(_0x220182,_0x476ac2,_0x8cf27a){return new BPromise(function(_0x2f40dc,_0x3cdd22){return client[_0xc49d('0xd')](_0x220182,_0x8cf27a)[_0xc49d('0xe')](function(_0x128a72){logger[_0xc49d('0xf')](_0xc49d('0x10'),_0x476ac2,_0xc49d('0x11'));logger[_0xc49d('0x12')](_0xc49d('0x13'),_0x476ac2,_0xc49d('0x11'),JSON[_0xc49d('0x14')](_0x128a72));if(_0x128a72[_0xc49d('0x15')]){if(_0x128a72[_0xc49d('0x15')]['code']===0x1f4){logger[_0xc49d('0x15')]('DashboardItem,\x20%s,\x20%s',_0x476ac2,_0x128a72[_0xc49d('0x15')]['message']);return _0x3cdd22(_0x128a72[_0xc49d('0x15')][_0xc49d('0x16')]);}logger['error'](_0xc49d('0x10'),_0x476ac2,_0x128a72[_0xc49d('0x15')][_0xc49d('0x16')]);return _0x2f40dc(_0x128a72[_0xc49d('0x15')]['message']);}else{logger[_0xc49d('0xf')](_0xc49d('0x10'),_0x476ac2,_0xc49d('0x11'));_0x2f40dc(_0x128a72[_0xc49d('0x17')][_0xc49d('0x16')]);}})[_0xc49d('0x18')](function(_0x48dbeb){logger[_0xc49d('0x15')](_0xc49d('0x10'),_0x476ac2,_0x48dbeb);_0x3cdd22(_0x48dbeb);});});} \ No newline at end of file +var _0x2d5d=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x2d5d,0x1a8));var _0xd2d5=function(_0x255fd7,_0x2bc90c){_0x255fd7=_0x255fd7-0x0;var _0x3e86bb=_0x2d5d[_0x255fd7];return _0x3e86bb;};'use strict';var _=require(_0xd2d5('0x0'));var util=require(_0xd2d5('0x1'));var moment=require(_0xd2d5('0x2'));var BPromise=require(_0xd2d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2d5('0x4'));var db=require(_0xd2d5('0x5'))['db'];var utils=require(_0xd2d5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd2d5('0x7'));var client=jayson[_0xd2d5('0x8')][_0xd2d5('0x9')]({'port':0x232a});config[_0xd2d5('0xa')]=_['defaults'](config[_0xd2d5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2d5('0xb'))(new Redis(config[_0xd2d5('0xa')]));require(_0xd2d5('0xc'))[_0xd2d5('0xd')](socket);function respondWithRpcPromise(_0x1b66e6,_0x2ab8b5,_0x3848c4){return new BPromise(function(_0x533301,_0xc217a2){return client['request'](_0x1b66e6,_0x3848c4)[_0xd2d5('0xe')](function(_0x4cca68){logger[_0xd2d5('0xf')]('DashboardItem,\x20%s,\x20%s',_0x2ab8b5,_0xd2d5('0x10'));logger[_0xd2d5('0x11')](_0xd2d5('0x12'),_0x2ab8b5,'request\x20sent',JSON[_0xd2d5('0x13')](_0x4cca68));if(_0x4cca68[_0xd2d5('0x14')]){if(_0x4cca68[_0xd2d5('0x14')][_0xd2d5('0x15')]===0x1f4){logger[_0xd2d5('0x14')](_0xd2d5('0x16'),_0x2ab8b5,_0x4cca68[_0xd2d5('0x14')]['message']);return _0xc217a2(_0x4cca68['error']['message']);}logger[_0xd2d5('0x14')](_0xd2d5('0x16'),_0x2ab8b5,_0x4cca68[_0xd2d5('0x14')][_0xd2d5('0x17')]);return _0x533301(_0x4cca68[_0xd2d5('0x14')][_0xd2d5('0x17')]);}else{logger[_0xd2d5('0xf')]('DashboardItem,\x20%s,\x20%s',_0x2ab8b5,_0xd2d5('0x10'));_0x533301(_0x4cca68['result'][_0xd2d5('0x17')]);}})[_0xd2d5('0x18')](function(_0x382847){logger['error'](_0xd2d5('0x16'),_0x2ab8b5,_0x382847);_0xc217a2(_0x382847);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c0836d6..6136496 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 _0x8e70=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x483f56,_0x4b6339){var _0x31a5b8=function(_0x57a50b){while(--_0x57a50b){_0x483f56['push'](_0x483f56['shift']());}};_0x31a5b8(++_0x4b6339);}(_0x8e70,0xa0));var _0x08e7=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x8e70[_0x17406a];return _0x1501ff;};'use strict';var DashboardItemEvents=require(_0x08e7('0x0'));var events=[_0x08e7('0x1'),_0x08e7('0x2'),_0x08e7('0x3')];function createListener(_0x36031a,_0x5be33b){return function(_0x1a4674){_0x5be33b[_0x08e7('0x4')](_0x36031a,_0x1a4674);};}function removeListener(_0x1f4614,_0x541be7){return function(){DashboardItemEvents['removeListener'](_0x1f4614,_0x541be7);};}exports[_0x08e7('0x5')]=function(_0x1add2d){for(var _0x29a030=0x0,_0xd74f0e=events[_0x08e7('0x6')];_0x29a030<_0xd74f0e;_0x29a030++){var _0x5c765d=events[_0x29a030];var _0x52e8fe=createListener(_0x08e7('0x7')+_0x5c765d,_0x1add2d);DashboardItemEvents['on'](_0x5c765d,_0x52e8fe);}}; \ No newline at end of file +var _0x6c57=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6c57,0x157));var _0x76c5=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x6c57[_0x96f74c];return _0x379222;};'use strict';var DashboardItemEvents=require(_0x76c5('0x0'));var events=[_0x76c5('0x1'),_0x76c5('0x2'),_0x76c5('0x3')];function createListener(_0x2a5e17,_0x19900d){return function(_0x5ee339){_0x19900d[_0x76c5('0x4')](_0x2a5e17,_0x5ee339);};}function removeListener(_0x4e4161,_0x2d310a){return function(){DashboardItemEvents[_0x76c5('0x5')](_0x4e4161,_0x2d310a);};}exports[_0x76c5('0x6')]=function(_0x2d38c0){for(var _0x43654c=0x0,_0x3f9b14=events[_0x76c5('0x7')];_0x43654c<_0x3f9b14;_0x43654c++){var _0x2ba068=events[_0x43654c];var _0x3ad020=createListener(_0x76c5('0x8')+_0x2ba068,_0x2d38c0);DashboardItemEvents['on'](_0x2ba068,_0x3ad020);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index dd5498a..3fcc115 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x222c33,_0x53d29a){var _0x75b81b=function(_0x5206b3){while(--_0x5206b3){_0x222c33['push'](_0x222c33['shift']());}};_0x75b81b(++_0x53d29a);}(_0x687b,0x14a));var _0xb687=function(_0x16fa02,_0x3eaff5){_0x16fa02=_0x16fa02-0x0;var _0x58fa70=_0x687b[_0x16fa02];return _0x58fa70;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x7da7=['put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create'];(function(_0x1fe322,_0x268975){var _0x95481a=function(_0x28da87){while(--_0x28da87){_0x1fe322['push'](_0x1fe322['shift']());}};_0x95481a(++_0x268975);}(_0x7da7,0x10d));var _0x77da=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x7da7[_0x2ade6c];return _0x2cb372;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x9')]('/',auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['delete'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);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 4a01769..c53ba0d 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 _0x17d9=['sequelize','exports','STRING','ENUM','first','third'];(function(_0x508afb,_0x4c8486){var _0x48f05d=function(_0x23d65b){while(--_0x23d65b){_0x508afb['push'](_0x508afb['shift']());}};_0x48f05d(++_0x4c8486);}(_0x17d9,0x1ce));var _0x917d=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x17d9[_0x737a1f];return _0x16eba1;};'use strict';var Sequelize=require(_0x917d('0x0'));module[_0x917d('0x1')]={'name':{'type':Sequelize[_0x917d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x917d('0x3')](_0x917d('0x4'),'second',_0x917d('0x5')),'allowNull':![],'defaultValue':_0x917d('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf06c=['sequelize','ENUM','first','second','third','STRING'];(function(_0x311970,_0x5d9073){var _0x158613=function(_0x905b73){while(--_0x905b73){_0x311970['push'](_0x311970['shift']());}};_0x158613(++_0x5d9073);}(_0xf06c,0x13e));var _0xcf06=function(_0x273f72,_0x2d51ac){_0x273f72=_0x273f72-0x0;var _0x5002ad=_0xf06c[_0x273f72];return _0x5002ad;};'use strict';var Sequelize=require(_0xcf06('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xcf06('0x1')](_0xcf06('0x2'),_0xcf06('0x3'),_0xcf06('0x4')),'allowNull':![],'defaultValue':_0xcf06('0x2')},'description':{'type':Sequelize[_0xcf06('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0f94675..7f147e2 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 _0x5f92=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','Disposition','rows','catch','show','params','fields','find','create','body'];(function(_0x514e73,_0x2e8f95){var _0x125dae=function(_0x532726){while(--_0x532726){_0x514e73['push'](_0x514e73['shift']());}};_0x125dae(++_0x2e8f95);}(_0x5f92,0x1f1));var _0x25f9=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x5f92[_0x562ec5];return _0x279c8c;};'use strict';var pdf=require(_0x25f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x25f9('0x3'));var util=require(_0x25f9('0x4'));var path=require(_0x25f9('0x5'));var sox=require(_0x25f9('0x6'));var csv=require(_0x25f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25f9('0x8'));var squel=require('squel');var crypto=require(_0x25f9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x25f9('0xa'));var toCsv=require(_0x25f9('0x7'));var querystring=require(_0x25f9('0xb'));var Papa=require(_0x25f9('0xc'));var Redis=require('ioredis');var authService=require(_0x25f9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x25f9('0xe'));var hardwareService=require(_0x25f9('0xf'));var logger=require(_0x25f9('0x10'))(_0x25f9('0x11'));var utils=require(_0x25f9('0x12'));var config=require(_0x25f9('0x13'));var licenseUtil=require(_0x25f9('0x14'));var db=require(_0x25f9('0x15'))['db'];function respondWithStatusCode(_0x50b5c7,_0x474927){_0x474927=_0x474927||0xcc;return function(_0x3aecda){if(_0x3aecda){return _0x50b5c7[_0x25f9('0x16')](_0x474927);}return _0x50b5c7['status'](_0x474927)[_0x25f9('0x17')]();};}function respondWithResult(_0x504c0e,_0x2a4d34){_0x2a4d34=_0x2a4d34||0xc8;return function(_0x40f201){if(_0x40f201){return _0x504c0e['status'](_0x2a4d34)[_0x25f9('0x18')](_0x40f201);}};}function respondWithFilteredResult(_0x388f47,_0x18c813){return function(_0x545685){if(_0x545685){var _0xd4e129=_0x545685['count'],_0x467204=_0x18c813[_0x25f9('0x19')],_0x369d0b=_0x18c813['offset']+_0x18c813[_0x25f9('0x1a')],_0x17252d;if(_0x369d0b>=_0xd4e129){_0x369d0b=_0xd4e129;_0x17252d=0xc8;}else{_0x17252d=0xce;}_0x388f47[_0x25f9('0x1b')](_0x17252d);return _0x388f47[_0x25f9('0x1c')](_0x25f9('0x1d'),_0x467204+'-'+_0x369d0b+'/'+_0xd4e129)[_0x25f9('0x18')](_0x545685);}return null;};}function patchUpdates(_0x51a276){return function(_0x2f308f){try{jsonpatch[_0x25f9('0x1e')](_0x2f308f,_0x51a276,!![]);}catch(_0x3819f5){return BPromise[_0x25f9('0x1f')](_0x3819f5);}return _0x2f308f[_0x25f9('0x20')]();};}function saveUpdates(_0x4276ea,_0xf3fa4b){return function(_0x48c6d1){if(_0x48c6d1){return _0x48c6d1[_0x25f9('0x21')](_0x4276ea)[_0x25f9('0x22')](function(_0x4aff76){return _0x4aff76;});}return null;};}function removeEntity(_0x275437,_0x5ccbf9){return function(_0x49ac7e){if(_0x49ac7e){return _0x49ac7e[_0x25f9('0x23')]()[_0x25f9('0x22')](function(){var _0x1557d6=_0x49ac7e[_0x25f9('0x24')]({'plain':!![]});var _0x4fa3f5=_0x25f9('0x25');return db[_0x25f9('0x26')][_0x25f9('0x23')]({'where':{'type':_0x4fa3f5,'resourceId':_0x1557d6['id']}})['then'](function(){return _0x49ac7e;});})[_0x25f9('0x22')](function(){_0x275437['status'](0xcc)[_0x25f9('0x17')]();});}};}function handleEntityNotFound(_0x1e1b3e,_0x89ca7d){return function(_0x48507c){if(!_0x48507c){_0x1e1b3e['sendStatus'](0x194);}return _0x48507c;};}function handleError(_0x8379fc,_0x5037ed){_0x5037ed=_0x5037ed||0x1f4;return function(_0x4bb23d){logger[_0x25f9('0x27')](_0x4bb23d[_0x25f9('0x28')]);if(_0x4bb23d[_0x25f9('0x29')]){delete _0x4bb23d[_0x25f9('0x29')];}_0x8379fc[_0x25f9('0x1b')](_0x5037ed)[_0x25f9('0x2a')](_0x4bb23d);};}exports[_0x25f9('0x2b')]=function(_0x9f857e,_0x3e7807){var _0x98f7df={},_0x346918={},_0x15c998={'count':0x0,'rows':[]};var _0x4a7539=_[_0x25f9('0x2c')](db['Disposition'][_0x25f9('0x2d')],function(_0x202914){return{'name':_0x202914[_0x25f9('0x2e')],'type':_0x202914[_0x25f9('0x2f')][_0x25f9('0x30')]};});_0x346918[_0x25f9('0x31')]=_['map'](_0x4a7539,_0x25f9('0x29'));_0x346918[_0x25f9('0x32')]=_[_0x25f9('0x33')](_0x9f857e[_0x25f9('0x32')]);_0x346918[_0x25f9('0x34')]=_['intersection'](_0x346918[_0x25f9('0x31')],_0x346918[_0x25f9('0x32')]);_0x98f7df[_0x25f9('0x35')]=_[_0x25f9('0x36')](_0x346918[_0x25f9('0x31')],qs['fields'](_0x9f857e[_0x25f9('0x32')]['fields']));_0x98f7df[_0x25f9('0x35')]=_0x98f7df[_0x25f9('0x35')][_0x25f9('0x37')]?_0x98f7df['attributes']:_0x346918[_0x25f9('0x31')];if(!_0x9f857e[_0x25f9('0x32')][_0x25f9('0x38')](_0x25f9('0x39'))){_0x98f7df[_0x25f9('0x1a')]=qs[_0x25f9('0x1a')](_0x9f857e[_0x25f9('0x32')][_0x25f9('0x1a')]);_0x98f7df[_0x25f9('0x19')]=qs[_0x25f9('0x19')](_0x9f857e[_0x25f9('0x32')][_0x25f9('0x19')]);}_0x98f7df['order']=qs[_0x25f9('0x3a')](_0x9f857e[_0x25f9('0x32')][_0x25f9('0x3a')]);_0x98f7df[_0x25f9('0x3b')]=qs[_0x25f9('0x34')](_[_0x25f9('0x3c')](_0x9f857e[_0x25f9('0x32')],_0x346918['filters']),_0x4a7539);if(_0x9f857e[_0x25f9('0x32')]['filter']){_0x98f7df[_0x25f9('0x3b')]=_[_0x25f9('0x3d')](_0x98f7df[_0x25f9('0x3b')],{'$or':_[_0x25f9('0x2c')](_0x4a7539,function(_0x47a9b7){if(_0x47a9b7[_0x25f9('0x2f')]!==_0x25f9('0x3e')){var _0x421da4={};_0x421da4[_0x47a9b7[_0x25f9('0x29')]]={'$like':'%'+_0x9f857e['query'][_0x25f9('0x3f')]+'%'};return _0x421da4;}})});}_0x98f7df=_[_0x25f9('0x3d')]({},_0x98f7df,_0x9f857e[_0x25f9('0x40')]);var _0x4c424a={'where':_0x98f7df['where']};return db['Disposition'][_0x25f9('0x41')](_0x4c424a)[_0x25f9('0x22')](function(_0x408663){_0x15c998[_0x25f9('0x41')]=_0x408663;if(_0x9f857e[_0x25f9('0x32')][_0x25f9('0x42')]){_0x98f7df[_0x25f9('0x43')]=[{'all':!![]}];}return db[_0x25f9('0x44')]['findAll'](_0x98f7df);})[_0x25f9('0x22')](function(_0x21501c){_0x15c998[_0x25f9('0x45')]=_0x21501c;return _0x15c998;})[_0x25f9('0x22')](respondWithFilteredResult(_0x3e7807,_0x98f7df))[_0x25f9('0x46')](handleError(_0x3e7807,null));};exports[_0x25f9('0x47')]=function(_0x34f29b,_0x4d1575){var _0x5d5919={'raw':!![],'where':{'id':_0x34f29b[_0x25f9('0x48')]['id']}},_0x3b540f={};_0x3b540f[_0x25f9('0x31')]=_['keys'](db[_0x25f9('0x44')][_0x25f9('0x2d')]);_0x3b540f[_0x25f9('0x32')]=_[_0x25f9('0x33')](_0x34f29b[_0x25f9('0x32')]);_0x3b540f['filters']=_[_0x25f9('0x36')](_0x3b540f['model'],_0x3b540f['query']);_0x5d5919[_0x25f9('0x35')]=_['intersection'](_0x3b540f['model'],qs[_0x25f9('0x49')](_0x34f29b[_0x25f9('0x32')][_0x25f9('0x49')]));_0x5d5919[_0x25f9('0x35')]=_0x5d5919[_0x25f9('0x35')][_0x25f9('0x37')]?_0x5d5919[_0x25f9('0x35')]:_0x3b540f[_0x25f9('0x31')];if(_0x34f29b[_0x25f9('0x32')][_0x25f9('0x42')]){_0x5d5919[_0x25f9('0x43')]=[{'all':!![]}];}_0x5d5919=_[_0x25f9('0x3d')]({},_0x5d5919,_0x34f29b['options']);return db['Disposition'][_0x25f9('0x4a')](_0x5d5919)[_0x25f9('0x22')](handleEntityNotFound(_0x4d1575,null))[_0x25f9('0x22')](respondWithResult(_0x4d1575,null))['catch'](handleError(_0x4d1575,null));};exports[_0x25f9('0x4b')]=function(_0x4c2b7a,_0x20892d){return db['Disposition'][_0x25f9('0x4b')](_0x4c2b7a[_0x25f9('0x4c')],{})[_0x25f9('0x22')](function(_0x1d469e){var _0x597530=_0x4c2b7a[_0x25f9('0x4d')][_0x25f9('0x24')]({'plain':!![]});if(!_0x597530)throw new Error(_0x25f9('0x4e'));if(_0x597530[_0x25f9('0x4f')]===_0x25f9('0x4d')){var _0x4de0e9=_0x1d469e[_0x25f9('0x24')]({'plain':!![]});var _0x4b9bb4=_0x25f9('0x25');return db['UserProfileSection'][_0x25f9('0x4a')]({'where':{'name':_0x4b9bb4,'userProfileId':_0x597530[_0x25f9('0x50')]},'raw':!![]})[_0x25f9('0x22')](function(_0x32fec1){if(_0x32fec1&&_0x32fec1['autoAssociation']===0x0){return db['UserProfileResource'][_0x25f9('0x4b')]({'name':_0x4de0e9[_0x25f9('0x29')],'resourceId':_0x4de0e9['id'],'type':_0x32fec1[_0x25f9('0x29')],'sectionId':_0x32fec1['id']},{})['then'](function(){return _0x1d469e;});}else{return _0x1d469e;}})[_0x25f9('0x46')](function(_0x350143){logger[_0x25f9('0x27')](_0x25f9('0x51'),_0x350143);throw _0x350143;});}return _0x1d469e;})[_0x25f9('0x22')](respondWithResult(_0x20892d,0xc9))[_0x25f9('0x46')](handleError(_0x20892d,null));};exports[_0x25f9('0x21')]=function(_0x43cb54,_0x1e0bb2){if(_0x43cb54[_0x25f9('0x4c')]['id']){delete _0x43cb54['body']['id'];}return db[_0x25f9('0x44')][_0x25f9('0x4a')]({'where':{'id':_0x43cb54[_0x25f9('0x48')]['id']}})[_0x25f9('0x22')](handleEntityNotFound(_0x1e0bb2,null))[_0x25f9('0x22')](saveUpdates(_0x43cb54['body'],null))['then'](respondWithResult(_0x1e0bb2,null))['catch'](handleError(_0x1e0bb2,null));};exports['destroy']=function(_0x56f269,_0x3869f8){return db[_0x25f9('0x44')]['find']({'where':{'id':_0x56f269[_0x25f9('0x48')]['id']}})['then'](handleEntityNotFound(_0x3869f8,null))[_0x25f9('0x22')](removeEntity(_0x3869f8,null))[_0x25f9('0x46')](handleError(_0x3869f8,null));}; \ No newline at end of file +var _0x23b0=['../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','name','send','map','Disposition','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','autoAssociation','UserProfileResource','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','path','sox','to-csv','ejs','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x23b0,0x8b));var _0x023b=function(_0x1efaf3,_0x268eae){_0x1efaf3=_0x1efaf3-0x0;var _0x43f02c=_0x23b0[_0x1efaf3];return _0x43f02c;};'use strict';var pdf=require(_0x023b('0x0'));var emlformat=require(_0x023b('0x1'));var rimraf=require(_0x023b('0x2'));var zipdir=require(_0x023b('0x3'));var jsonpatch=require(_0x023b('0x4'));var rp=require(_0x023b('0x5'));var moment=require(_0x023b('0x6'));var BPromise=require(_0x023b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x023b('0x8'));var sox=require(_0x023b('0x9'));var csv=require(_0x023b('0xa'));var ejs=require(_0x023b('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(_0x023b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x023b('0xc'));var authService=require(_0x023b('0xd'));var qs=require(_0x023b('0xe'));var as=require(_0x023b('0xf'));var hardwareService=require(_0x023b('0x10'));var logger=require(_0x023b('0x11'))(_0x023b('0x12'));var utils=require(_0x023b('0x13'));var config=require(_0x023b('0x14'));var licenseUtil=require(_0x023b('0x15'));var db=require(_0x023b('0x16'))['db'];function respondWithStatusCode(_0x5527e0,_0x1d0bcb){_0x1d0bcb=_0x1d0bcb||0xcc;return function(_0x51b497){if(_0x51b497){return _0x5527e0['sendStatus'](_0x1d0bcb);}return _0x5527e0[_0x023b('0x17')](_0x1d0bcb)[_0x023b('0x18')]();};}function respondWithResult(_0x229bdf,_0x247514){_0x247514=_0x247514||0xc8;return function(_0x3fb39e){if(_0x3fb39e){return _0x229bdf[_0x023b('0x17')](_0x247514)[_0x023b('0x19')](_0x3fb39e);}};}function respondWithFilteredResult(_0x4a6cd9,_0x3b2cb8){return function(_0x48e72b){if(_0x48e72b){var _0x2864fa=_0x48e72b[_0x023b('0x1a')],_0xf96d8c=_0x3b2cb8[_0x023b('0x1b')],_0x471738=_0x3b2cb8[_0x023b('0x1b')]+_0x3b2cb8[_0x023b('0x1c')],_0x9becf2;if(_0x471738>=_0x2864fa){_0x471738=_0x2864fa;_0x9becf2=0xc8;}else{_0x9becf2=0xce;}_0x4a6cd9[_0x023b('0x17')](_0x9becf2);return _0x4a6cd9[_0x023b('0x1d')](_0x023b('0x1e'),_0xf96d8c+'-'+_0x471738+'/'+_0x2864fa)[_0x023b('0x19')](_0x48e72b);}return null;};}function patchUpdates(_0x97bc5e){return function(_0x21130c){try{jsonpatch[_0x023b('0x1f')](_0x21130c,_0x97bc5e,!![]);}catch(_0x49c619){return BPromise[_0x023b('0x20')](_0x49c619);}return _0x21130c[_0x023b('0x21')]();};}function saveUpdates(_0x2c650e,_0x5b65c4){return function(_0x2e1b99){if(_0x2e1b99){return _0x2e1b99[_0x023b('0x22')](_0x2c650e)[_0x023b('0x23')](function(_0x25f8b3){return _0x25f8b3;});}return null;};}function removeEntity(_0x46053b,_0x308932){return function(_0x13a0af){if(_0x13a0af){return _0x13a0af[_0x023b('0x24')]()[_0x023b('0x23')](function(){var _0x2217d5=_0x13a0af[_0x023b('0x25')]({'plain':!![]});var _0x5f417b='Dispositions';return db['UserProfileResource'][_0x023b('0x24')]({'where':{'type':_0x5f417b,'resourceId':_0x2217d5['id']}})[_0x023b('0x23')](function(){return _0x13a0af;});})[_0x023b('0x23')](function(){_0x46053b[_0x023b('0x17')](0xcc)[_0x023b('0x18')]();});}};}function handleEntityNotFound(_0x14ea13,_0x4d2b00){return function(_0x45d37b){if(!_0x45d37b){_0x14ea13[_0x023b('0x26')](0x194);}return _0x45d37b;};}function handleError(_0x144de9,_0x1dcfb6){_0x1dcfb6=_0x1dcfb6||0x1f4;return function(_0x5410c1){logger[_0x023b('0x27')](_0x5410c1['stack']);if(_0x5410c1[_0x023b('0x28')]){delete _0x5410c1[_0x023b('0x28')];}_0x144de9[_0x023b('0x17')](_0x1dcfb6)[_0x023b('0x29')](_0x5410c1);};}exports['index']=function(_0x8a626a,_0x2d61fc){var _0x4dd8c0={},_0x256309={},_0x37b7a5={'count':0x0,'rows':[]};var _0x3106b7=_[_0x023b('0x2a')](db[_0x023b('0x2b')][_0x023b('0x2c')],function(_0x564d2f){return{'name':_0x564d2f['fieldName'],'type':_0x564d2f['type'][_0x023b('0x2d')]};});_0x256309[_0x023b('0x2e')]=_['map'](_0x3106b7,_0x023b('0x28'));_0x256309[_0x023b('0x2f')]=_[_0x023b('0x30')](_0x8a626a[_0x023b('0x2f')]);_0x256309[_0x023b('0x31')]=_[_0x023b('0x32')](_0x256309[_0x023b('0x2e')],_0x256309[_0x023b('0x2f')]);_0x4dd8c0[_0x023b('0x33')]=_[_0x023b('0x32')](_0x256309[_0x023b('0x2e')],qs['fields'](_0x8a626a['query'][_0x023b('0x34')]));_0x4dd8c0[_0x023b('0x33')]=_0x4dd8c0[_0x023b('0x33')]['length']?_0x4dd8c0[_0x023b('0x33')]:_0x256309[_0x023b('0x2e')];if(!_0x8a626a['query'][_0x023b('0x35')](_0x023b('0x36'))){_0x4dd8c0['limit']=qs[_0x023b('0x1c')](_0x8a626a['query'][_0x023b('0x1c')]);_0x4dd8c0[_0x023b('0x1b')]=qs[_0x023b('0x1b')](_0x8a626a[_0x023b('0x2f')][_0x023b('0x1b')]);}_0x4dd8c0[_0x023b('0x37')]=qs[_0x023b('0x38')](_0x8a626a[_0x023b('0x2f')][_0x023b('0x38')]);_0x4dd8c0[_0x023b('0x39')]=qs['filters'](_[_0x023b('0x3a')](_0x8a626a[_0x023b('0x2f')],_0x256309['filters']),_0x3106b7);if(_0x8a626a['query']['filter']){_0x4dd8c0[_0x023b('0x39')]=_[_0x023b('0x3b')](_0x4dd8c0[_0x023b('0x39')],{'$or':_[_0x023b('0x2a')](_0x3106b7,function(_0xc0793a){if(_0xc0793a[_0x023b('0x3c')]!==_0x023b('0x3d')){var _0x96f101={};_0x96f101[_0xc0793a[_0x023b('0x28')]]={'$like':'%'+_0x8a626a[_0x023b('0x2f')][_0x023b('0x3e')]+'%'};return _0x96f101;}})});}_0x4dd8c0=_['merge']({},_0x4dd8c0,_0x8a626a[_0x023b('0x3f')]);var _0x1998a1={'where':_0x4dd8c0['where']};return db['Disposition'][_0x023b('0x1a')](_0x1998a1)[_0x023b('0x23')](function(_0x3b0c4c){_0x37b7a5[_0x023b('0x1a')]=_0x3b0c4c;if(_0x8a626a['query'][_0x023b('0x40')]){_0x4dd8c0[_0x023b('0x41')]=[{'all':!![]}];}return db[_0x023b('0x2b')][_0x023b('0x42')](_0x4dd8c0);})[_0x023b('0x23')](function(_0x1b343d){_0x37b7a5['rows']=_0x1b343d;return _0x37b7a5;})[_0x023b('0x23')](respondWithFilteredResult(_0x2d61fc,_0x4dd8c0))['catch'](handleError(_0x2d61fc,null));};exports['show']=function(_0x473398,_0x5d4dfa){var _0x176fcf={'raw':!![],'where':{'id':_0x473398[_0x023b('0x43')]['id']}},_0x96d25d={};_0x96d25d[_0x023b('0x2e')]=_['keys'](db[_0x023b('0x2b')][_0x023b('0x2c')]);_0x96d25d['query']=_[_0x023b('0x30')](_0x473398['query']);_0x96d25d[_0x023b('0x31')]=_['intersection'](_0x96d25d[_0x023b('0x2e')],_0x96d25d['query']);_0x176fcf[_0x023b('0x33')]=_[_0x023b('0x32')](_0x96d25d['model'],qs[_0x023b('0x34')](_0x473398[_0x023b('0x2f')][_0x023b('0x34')]));_0x176fcf[_0x023b('0x33')]=_0x176fcf[_0x023b('0x33')][_0x023b('0x44')]?_0x176fcf[_0x023b('0x33')]:_0x96d25d[_0x023b('0x2e')];if(_0x473398[_0x023b('0x2f')][_0x023b('0x40')]){_0x176fcf[_0x023b('0x41')]=[{'all':!![]}];}_0x176fcf=_[_0x023b('0x3b')]({},_0x176fcf,_0x473398[_0x023b('0x3f')]);return db[_0x023b('0x2b')][_0x023b('0x45')](_0x176fcf)[_0x023b('0x23')](handleEntityNotFound(_0x5d4dfa,null))['then'](respondWithResult(_0x5d4dfa,null))[_0x023b('0x46')](handleError(_0x5d4dfa,null));};exports[_0x023b('0x47')]=function(_0x40ca45,_0x42a7cf){return db[_0x023b('0x2b')][_0x023b('0x47')](_0x40ca45[_0x023b('0x48')],{})[_0x023b('0x23')](function(_0x56da96){var _0x3f9071=_0x40ca45[_0x023b('0x49')][_0x023b('0x25')]({'plain':!![]});if(!_0x3f9071)throw new Error(_0x023b('0x4a'));if(_0x3f9071['role']===_0x023b('0x49')){var _0x22a1ad=_0x56da96[_0x023b('0x25')]({'plain':!![]});var _0x18fe87=_0x023b('0x4b');return db[_0x023b('0x4c')]['find']({'where':{'name':_0x18fe87,'userProfileId':_0x3f9071['userProfileId']},'raw':!![]})['then'](function(_0x34f3ef){if(_0x34f3ef&&_0x34f3ef[_0x023b('0x4d')]===0x0){return db[_0x023b('0x4e')][_0x023b('0x47')]({'name':_0x22a1ad[_0x023b('0x28')],'resourceId':_0x22a1ad['id'],'type':_0x34f3ef['name'],'sectionId':_0x34f3ef['id']},{})['then'](function(){return _0x56da96;});}else{return _0x56da96;}})[_0x023b('0x46')](function(_0x1ed823){logger[_0x023b('0x27')](_0x023b('0x4f'),_0x1ed823);throw _0x1ed823;});}return _0x56da96;})[_0x023b('0x23')](respondWithResult(_0x42a7cf,0xc9))[_0x023b('0x46')](handleError(_0x42a7cf,null));};exports[_0x023b('0x22')]=function(_0x5c06d9,_0x3ad1eb){if(_0x5c06d9[_0x023b('0x48')]['id']){delete _0x5c06d9[_0x023b('0x48')]['id'];}return db['Disposition'][_0x023b('0x45')]({'where':{'id':_0x5c06d9['params']['id']}})['then'](handleEntityNotFound(_0x3ad1eb,null))[_0x023b('0x23')](saveUpdates(_0x5c06d9[_0x023b('0x48')],null))[_0x023b('0x23')](respondWithResult(_0x3ad1eb,null))[_0x023b('0x46')](handleError(_0x3ad1eb,null));};exports['destroy']=function(_0x411035,_0xd30dd){return db[_0x023b('0x2b')][_0x023b('0x45')]({'where':{'id':_0x411035[_0x023b('0x43')]['id']}})[_0x023b('0x23')](handleEntityNotFound(_0xd30dd,null))[_0x023b('0x23')](removeEntity(_0xd30dd,null))[_0x023b('0x46')](handleError(_0xd30dd,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 89a07da..237ec09 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 _0x31c2=['../../config/logger','api','moment','bluebird','request-promise','path','./disposition.attributes','exports','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x31c2,0x1e1));var _0x231c=function(_0x4077c1,_0x457769){_0x4077c1=_0x4077c1-0x0;var _0x1ed6a7=_0x31c2[_0x4077c1];return _0x1ed6a7;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var logger=require(_0x231c('0x2'))(_0x231c('0x3'));var moment=require(_0x231c('0x4'));var BPromise=require(_0x231c('0x5'));var rp=require(_0x231c('0x6'));var fs=require('fs');var path=require(_0x231c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x231c('0x8'));module[_0x231c('0x9')]=function(_0x1f3f7d,_0x219c3f){return _0x1f3f7d['define'](_0x231c('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x231c('0xb'),'fields':[_0x231c('0xc'),_0x231c('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x231c('0xc'),_0x231c('0xe')]},{'unique':!![],'name':_0x231c('0xf'),'fields':[_0x231c('0xc'),_0x231c('0x10')]},{'unique':!![],'name':_0x231c('0x11'),'fields':[_0x231c('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x231c('0x12'),'fields':[_0x231c('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x231c('0x13'),'fields':[_0x231c('0xc'),_0x231c('0x14')]},{'unique':!![],'name':_0x231c('0x15'),'fields':[_0x231c('0xc'),_0x231c('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1a3=['../../config/logger','moment','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util'];(function(_0x22db63,_0x4c7ff9){var _0x3aa8a0=function(_0x4ec1ff){while(--_0x4ec1ff){_0x22db63['push'](_0x22db63['shift']());}};_0x3aa8a0(++_0x4c7ff9);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xb1a3[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var logger=require(_0x3b1a('0x2'))('api');var moment=require(_0x3b1a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b1a('0x4'));var rimraf=require(_0x3b1a('0x5'));var config=require(_0x3b1a('0x6'));var attributes=require(_0x3b1a('0x7'));module[_0x3b1a('0x8')]=function(_0xe6490d,_0x208d05){return _0xe6490d['define'](_0x3b1a('0x9'),attributes,{'tableName':_0x3b1a('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3b1a('0xb'),'fields':[_0x3b1a('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x3b1a('0xc'),_0x3b1a('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x3b1a('0xc'),'MailAccountId']},{'unique':!![],'name':_0x3b1a('0xe'),'fields':['name',_0x3b1a('0xf')]},{'unique':!![],'name':_0x3b1a('0x10'),'fields':[_0x3b1a('0xc'),_0x3b1a('0x11')]},{'unique':!![],'name':_0x3b1a('0x12'),'fields':[_0x3b1a('0xc'),_0x3b1a('0x13')]},{'unique':!![],'name':_0x3b1a('0x14'),'fields':[_0x3b1a('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 71db990..d397577 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 _0x216a=['message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x216a,0xe3));var _0xa216=function(_0x4a5294,_0x5c82e4){_0x4a5294=_0x4a5294-0x0;var _0x53d0a0=_0x216a[_0x4a5294];return _0x53d0a0;};'use strict';var _=require(_0xa216('0x0'));var util=require('util');var moment=require(_0xa216('0x1'));var BPromise=require('bluebird');var rs=require(_0xa216('0x2'));var fs=require('fs');var Redis=require(_0xa216('0x3'));var db=require(_0xa216('0x4'))['db'];var utils=require(_0xa216('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa216('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x131a65,_0x3a5023,_0x43b1bb){return new BPromise(function(_0x4450ff,_0x5c1860){return client[_0xa216('0x7')](_0x131a65,_0x43b1bb)['then'](function(_0x325a95){logger['info'](_0xa216('0x8'),_0x3a5023,_0xa216('0x9'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x3a5023,'request\x20sent',JSON[_0xa216('0xa')](_0x325a95));if(_0x325a95['error']){if(_0x325a95[_0xa216('0xb')][_0xa216('0xc')]===0x1f4){logger[_0xa216('0xb')](_0xa216('0x8'),_0x3a5023,_0x325a95['error'][_0xa216('0xd')]);return _0x5c1860(_0x325a95[_0xa216('0xb')]['message']);}logger[_0xa216('0xb')](_0xa216('0x8'),_0x3a5023,_0x325a95[_0xa216('0xb')][_0xa216('0xd')]);return _0x4450ff(_0x325a95[_0xa216('0xb')]['message']);}else{logger[_0xa216('0xe')](_0xa216('0x8'),_0x3a5023,'request\x20sent');_0x4450ff(_0x325a95['result'][_0xa216('0xd')]);}})[_0xa216('0xf')](function(_0x57b173){logger[_0xa216('0xb')](_0xa216('0x8'),_0x3a5023,_0x57b173);_0x5c1860(_0x57b173);});});} \ No newline at end of file +var _0xceac=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0xabba42,_0x33f725){var _0x56dae5=function(_0x3ded3a){while(--_0x3ded3a){_0xabba42['push'](_0xabba42['shift']());}};_0x56dae5(++_0x33f725);}(_0xceac,0x157));var _0xccea=function(_0x2c06c1,_0x25c6f1){_0x2c06c1=_0x2c06c1-0x0;var _0x41cfda=_0xceac[_0x2c06c1];return _0x41cfda;};'use strict';var _=require(_0xccea('0x0'));var util=require(_0xccea('0x1'));var moment=require(_0xccea('0x2'));var BPromise=require('bluebird');var rs=require(_0xccea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccea('0x4'))['db'];var utils=require(_0xccea('0x5'));var logger=require(_0xccea('0x6'))(_0xccea('0x7'));var config=require('../../config/environment');var jayson=require(_0xccea('0x8'));var client=jayson[_0xccea('0x9')][_0xccea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57001b,_0x1c1e95,_0x20e4ce){return new BPromise(function(_0x22c26e,_0x4f7c24){return client[_0xccea('0xb')](_0x57001b,_0x20e4ce)[_0xccea('0xc')](function(_0x4acf7c){logger[_0xccea('0xd')](_0xccea('0xe'),_0x1c1e95,'request\x20sent');logger[_0xccea('0xf')](_0xccea('0x10'),_0x1c1e95,_0xccea('0x11'),JSON[_0xccea('0x12')](_0x4acf7c));if(_0x4acf7c['error']){if(_0x4acf7c[_0xccea('0x13')][_0xccea('0x14')]===0x1f4){logger['error'](_0xccea('0xe'),_0x1c1e95,_0x4acf7c['error'][_0xccea('0x15')]);return _0x4f7c24(_0x4acf7c[_0xccea('0x13')][_0xccea('0x15')]);}logger[_0xccea('0x13')](_0xccea('0xe'),_0x1c1e95,_0x4acf7c[_0xccea('0x13')][_0xccea('0x15')]);return _0x22c26e(_0x4acf7c[_0xccea('0x13')][_0xccea('0x15')]);}else{logger[_0xccea('0xd')](_0xccea('0xe'),_0x1c1e95,_0xccea('0x11'));_0x22c26e(_0x4acf7c[_0xccea('0x16')][_0xccea('0x15')]);}})['catch'](function(_0x178c0a){logger[_0xccea('0x13')](_0xccea('0xe'),_0x1c1e95,_0x178c0a);_0x4f7c24(_0x178c0a);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 12965af..efd8c2d 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 _0x2ddf=['post','create','update','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x2bcac8,_0x2d46c0){var _0x134cd9=function(_0x51a501){while(--_0x51a501){_0x2bcac8['push'](_0x2bcac8['shift']());}};_0x134cd9(++_0x2d46c0);}(_0x2ddf,0x65));var _0xf2dd=function(_0x49d0e3,_0x359aed){_0x49d0e3=_0x49d0e3-0x0;var _0x26d388=_0x2ddf[_0x49d0e3];return _0x26d388;};'use strict';var multer=require(_0xf2dd('0x0'));var util=require('util');var path=require(_0xf2dd('0x1'));var timeout=require('connect-timeout');var express=require(_0xf2dd('0x2'));var router=express[_0xf2dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf2dd('0x4'));var config=require(_0xf2dd('0x5'));var controller=require(_0xf2dd('0x6'));router[_0xf2dd('0x7')]('/',auth[_0xf2dd('0x8')](),controller[_0xf2dd('0x9')]);router[_0xf2dd('0x7')](_0xf2dd('0xa'),auth[_0xf2dd('0x8')](),controller['show']);router[_0xf2dd('0xb')]('/',auth[_0xf2dd('0x8')](),controller[_0xf2dd('0xc')]);router['put'](_0xf2dd('0xa'),auth['isAuthenticated'](),controller[_0xf2dd('0xd')]);router[_0xf2dd('0xe')](_0xf2dd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2dd('0xf')]=router; \ No newline at end of file +var _0xd03e=['get','/:id','post','create','put','update','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated'];(function(_0x143c71,_0x3e3ffb){var _0x5bb538=function(_0x3b6b73){while(--_0x3b6b73){_0x143c71['push'](_0x143c71['shift']());}};_0x5bb538(++_0x3e3ffb);}(_0xd03e,0xf7));var _0xed03=function(_0x2aedc0,_0xa1093e){_0x2aedc0=_0x2aedc0-0x0;var _0x2f9ae2=_0xd03e[_0x2aedc0];return _0x2f9ae2;};'use strict';var multer=require(_0xed03('0x0'));var util=require(_0xed03('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed03('0x2'));var router=express[_0xed03('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xed03('0x4'));var config=require(_0xed03('0x5'));var controller=require(_0xed03('0x6'));router['get']('/',auth[_0xed03('0x7')](),controller['index']);router[_0xed03('0x8')](_0xed03('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xed03('0xa')]('/',auth[_0xed03('0x7')](),controller[_0xed03('0xb')]);router[_0xed03('0xc')](_0xed03('0x9'),auth['isAuthenticated'](),controller[_0xed03('0xd')]);router['delete']('/:id',auth[_0xed03('0x7')](),controller['destroy']);module[_0xed03('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ab0fe49..bcd4fcc 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 _0x30e4=['ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','SIP','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','sequelize','exports','STRING'];(function(_0x385bc9,_0x204859){var _0x452f8e=function(_0x5d3fd6){while(--_0x5d3fd6){_0x385bc9['push'](_0x385bc9['shift']());}};_0x452f8e(++_0x204859);}(_0x30e4,0xd5));var _0x430e=function(_0x311080,_0x52599f){_0x311080=_0x311080-0x0;var _0x3fdf12=_0x30e4[_0x311080];return _0x3fdf12;};'use strict';var Sequelize=require(_0x430e('0x0'));module[_0x430e('0x1')]={'name':{'type':Sequelize[_0x430e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x430e('0x3')](_0x430e('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x430e('0x2')],'defaultValue':_0x430e('0x5')},'localstationid':{'type':Sequelize[_0x430e('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x430e('0x6'),_0x430e('0x7'),_0x430e('0x8'),_0x430e('0x9'),_0x430e('0xa'),_0x430e('0xb')),'defaultValue':_0x430e('0x7')},'maxrate':{'type':Sequelize[_0x430e('0x3')](_0x430e('0x6'),'4800',_0x430e('0x8'),_0x430e('0x9'),'12000',_0x430e('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x430e('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x430e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x430e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x430e('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x430e('0x3')](_0x430e('0xd'),'IAX',_0x430e('0xe'),_0x430e('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x430e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x430e('0x10')],'defaultValue':function(){return _0x430e('0x11');}},'notificationSound':{'type':Sequelize[_0x430e('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x430e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x430e('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x430e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x430e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x430e('0x12')],'defaultValue':![],'comment':_0x430e('0x14'),'set':function(_0x576d9e){if(!_0x576d9e)this[_0x430e('0x15')](_0x430e('0x16'),null);this[_0x430e('0x15')](_0x430e('0x17'),_0x576d9e);}}}; \ No newline at end of file +var _0x9254=['7200','12000','14400','9600','v17,v27,v29','INTEGER','SIP','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','mandatoryDispositionPauseId','setDataValue','exports','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','2400','4800'];(function(_0x3746df,_0x36a1f7){var _0x51aeb9=function(_0x3d7e6b){while(--_0x3d7e6b){_0x3746df['push'](_0x3746df['shift']());}};_0x51aeb9(++_0x36a1f7);}(_0x9254,0x1dd));var _0x4925=function(_0x26c364,_0x4226c3){_0x26c364=_0x26c364-0x0;var _0x565bf4=_0x9254[_0x26c364];return _0x565bf4;};'use strict';var Sequelize=require('sequelize');module[_0x4925('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x4925('0x1')](_0x4925('0x2'),'no'),'defaultValue':_0x4925('0x2')},'headerinfo':{'type':Sequelize[_0x4925('0x3')],'defaultValue':_0x4925('0x4')},'localstationid':{'type':Sequelize[_0x4925('0x3')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x4925('0x5'),_0x4925('0x6'),_0x4925('0x7'),'9600',_0x4925('0x8'),_0x4925('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x4925('0x1')](_0x4925('0x5'),'4800','7200',_0x4925('0xa'),_0x4925('0x8'),_0x4925('0x9')),'defaultValue':_0x4925('0x9')},'modem':{'type':Sequelize[_0x4925('0x3')],'defaultValue':_0x4925('0xb')},'gateway':{'type':Sequelize[_0x4925('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4925('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4925('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4925('0x1')](_0x4925('0xd'),'IAX','DADHI',_0x4925('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x4925('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4925('0xf')],'defaultValue':function(){return _0x4925('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4925('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4925('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4925('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4925('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4925('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4925('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4925('0x11')],'defaultValue':![],'comment':_0x4925('0x13'),'set':function(_0x4da9b6){if(!_0x4da9b6)this['setDataValue'](_0x4925('0x14'),null);this[_0x4925('0x15')]('mandatoryDisposition',_0x4da9b6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 6e70b37..983ded4 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 _0x29d4=['gateway','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','omit','tech','createdAt','ListId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','join','root','server/files/attachments','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','FaxAccount','findAll','rows','show','params','rawAttributes','filters','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','Contact','User','fullname','Tag','Tags','color','tag','addApplications','FaxApplication','bulkCreate','priority','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','appdata','push'];(function(_0x4e5c84,_0x28a67b){var _0x25a76f=function(_0x1edda7){while(--_0x1edda7){_0x4e5c84['push'](_0x4e5c84['shift']());}};_0x25a76f(++_0x28a67b);}(_0x29d4,0x1a1));var _0x429d=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x29d4[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0x429d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x429d('0x1'));var zipdir=require(_0x429d('0x2'));var jsonpatch=require(_0x429d('0x3'));var rp=require(_0x429d('0x4'));var moment=require(_0x429d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x429d('0x6'));var util=require(_0x429d('0x7'));var path=require(_0x429d('0x8'));var sox=require(_0x429d('0x9'));var csv=require(_0x429d('0xa'));var ejs=require(_0x429d('0xb'));var fs=require('fs');var _=require(_0x429d('0xc'));var squel=require(_0x429d('0xd'));var crypto=require('crypto');var jsforce=require(_0x429d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x429d('0xa'));var querystring=require(_0x429d('0xf'));var Papa=require(_0x429d('0x10'));var Redis=require('ioredis');var authService=require(_0x429d('0x11'));var qs=require(_0x429d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429d('0x13'));var logger=require(_0x429d('0x14'))(_0x429d('0x15'));var utils=require('../../config/utils');var config=require(_0x429d('0x16'));var licenseUtil=require(_0x429d('0x17'));var db=require(_0x429d('0x18'))['db'];config[_0x429d('0x19')]=_['defaults'](config[_0x429d('0x19')],{'host':_0x429d('0x1a'),'port':0x18eb});var socket=require(_0x429d('0x1b'))(new Redis(config['redis']));require(_0x429d('0x1c'))[_0x429d('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x429d('0x1e')][_0x429d('0x1f')]({'port':0x232c});var client9002=jayson[_0x429d('0x1e')][_0x429d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x8c8a15,_0x2363a0,_0x4ddb35,_0xbfe8a0){return new BPromise(function(_0x53d19d,_0x2dfc66){var _0x35830e=_0xbfe8a0||client;return _0x35830e[_0x429d('0x20')](_0x8c8a15,_0x4ddb35)[_0x429d('0x21')](function(_0x51ef88){logger[_0x429d('0x22')](_0x429d('0x23'),_0x2363a0,_0x429d('0x24'));logger['debug'](_0x429d('0x25'),_0x2363a0,_0x429d('0x24'),JSON[_0x429d('0x26')](_0x51ef88));if(_0x51ef88[_0x429d('0x27')]){if(_0x51ef88[_0x429d('0x27')][_0x429d('0x28')]===0x1f4){logger['error'](_0x429d('0x23'),_0x2363a0,_0x51ef88[_0x429d('0x27')][_0x429d('0x29')]);return _0x2dfc66(_0x51ef88['error'][_0x429d('0x29')]);}logger[_0x429d('0x27')](_0x429d('0x23'),_0x2363a0,_0x51ef88[_0x429d('0x27')][_0x429d('0x29')]);return _0x53d19d(_0x51ef88[_0x429d('0x27')]['message']);}else{logger[_0x429d('0x22')](_0x429d('0x23'),_0x2363a0,'request\x20sent');_0x53d19d(_0x51ef88[_0x429d('0x2a')][_0x429d('0x29')]);}})[_0x429d('0x2b')](function(_0x11c423){logger['error'](_0x429d('0x23'),_0x2363a0,_0x11c423);_0x2dfc66(_0x11c423);});});}function respondWithStatusCode(_0x415b92,_0x387639){_0x387639=_0x387639||0xcc;return function(_0x3896ee){if(_0x3896ee){return _0x415b92[_0x429d('0x2c')](_0x387639);}return _0x415b92['status'](_0x387639)[_0x429d('0x2d')]();};}function respondWithResult(_0x2209aa,_0x258557){_0x258557=_0x258557||0xc8;return function(_0x1cba36){if(_0x1cba36){return _0x2209aa[_0x429d('0x2e')](_0x258557)[_0x429d('0x2f')](_0x1cba36);}};}function respondWithFilteredResult(_0x2351c9,_0xdc7bf9){return function(_0x2ceb54){if(_0x2ceb54){var _0x50ef02=_0x2ceb54[_0x429d('0x30')],_0x31cae6=_0xdc7bf9[_0x429d('0x31')],_0x3ca640=_0xdc7bf9[_0x429d('0x31')]+_0xdc7bf9[_0x429d('0x32')],_0x5bdb2d;if(_0x3ca640>=_0x50ef02){_0x3ca640=_0x50ef02;_0x5bdb2d=0xc8;}else{_0x5bdb2d=0xce;}_0x2351c9[_0x429d('0x2e')](_0x5bdb2d);return _0x2351c9['set'](_0x429d('0x33'),_0x31cae6+'-'+_0x3ca640+'/'+_0x50ef02)[_0x429d('0x2f')](_0x2ceb54);}return null;};}function patchUpdates(_0x36d86a){return function(_0x1dae60){try{jsonpatch[_0x429d('0x34')](_0x1dae60,_0x36d86a,!![]);}catch(_0x1b98ad){return BPromise['reject'](_0x1b98ad);}return _0x1dae60['save']();};}function saveUpdates(_0x6d33c7,_0x3da9d9){return function(_0x4d83fb){if(_0x4d83fb){return _0x4d83fb['update'](_0x6d33c7)[_0x429d('0x21')](function(_0x5ea670){return _0x5ea670;});}return null;};}function removeEntity(_0x1992ca,_0x3ba3aa){return function(_0x20e11a){if(_0x20e11a){return _0x20e11a[_0x429d('0x35')]()['then'](function(){var _0x10c023=_0x20e11a[_0x429d('0x36')]({'plain':!![]});var _0x5871cc='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x5871cc,'resourceId':_0x10c023['id']}})['then'](function(){return _0x20e11a;});})[_0x429d('0x21')](function(){_0x1992ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2acc3c,_0x3e70bf){return function(_0x46cb39){if(!_0x46cb39){_0x2acc3c[_0x429d('0x2c')](0x194);}return _0x46cb39;};}function handleError(_0xea0212,_0x1a5d80){_0x1a5d80=_0x1a5d80||0x1f4;return function(_0x4b23ab){logger[_0x429d('0x27')](_0x4b23ab[_0x429d('0x37')]);if(_0x4b23ab[_0x429d('0x38')]){delete _0x4b23ab[_0x429d('0x38')];}_0xea0212[_0x429d('0x2e')](_0x1a5d80)[_0x429d('0x39')](_0x4b23ab);};}exports[_0x429d('0x3a')]=function(_0x1733a8,_0x429a5e){var _0x439a6d={'include':[{'model':db[_0x429d('0x3b')],'as':_0x429d('0x3c')}]},_0x3d1c5d={},_0x1e3924={'count':0x0,'rows':[]};var _0x1a80bc=_[_0x429d('0x3d')](db['FaxAccount']['rawAttributes'],function(_0x44a137){return{'name':_0x44a137[_0x429d('0x3e')],'type':_0x44a137['type'][_0x429d('0x3f')]};});_0x3d1c5d[_0x429d('0x40')]=_[_0x429d('0x3d')](_0x1a80bc,'name');_0x3d1c5d['query']=_[_0x429d('0x41')](_0x1733a8[_0x429d('0x42')]);_0x3d1c5d['filters']=_[_0x429d('0x43')](_0x3d1c5d[_0x429d('0x40')],_0x3d1c5d['query']);_0x439a6d[_0x429d('0x44')]=_['intersection'](_0x3d1c5d[_0x429d('0x40')],qs[_0x429d('0x45')](_0x1733a8[_0x429d('0x42')][_0x429d('0x45')]));_0x439a6d['attributes']=_0x439a6d[_0x429d('0x44')][_0x429d('0x46')]?_0x439a6d[_0x429d('0x44')]:_0x3d1c5d['model'];if(!_0x1733a8['query'][_0x429d('0x47')](_0x429d('0x48'))){_0x439a6d[_0x429d('0x32')]=qs[_0x429d('0x32')](_0x1733a8['query'][_0x429d('0x32')]);_0x439a6d[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x1733a8[_0x429d('0x42')][_0x429d('0x31')]);}_0x439a6d[_0x429d('0x49')]=qs[_0x429d('0x4a')](_0x1733a8[_0x429d('0x42')][_0x429d('0x4a')]);_0x439a6d[_0x429d('0x4b')]=qs['filters'](_[_0x429d('0x4c')](_0x1733a8['query'],_0x3d1c5d['filters']),_0x1a80bc);if(_0x1733a8['query'][_0x429d('0x4d')]){_0x439a6d[_0x429d('0x4b')]=_['merge'](_0x439a6d[_0x429d('0x4b')],{'$or':_[_0x429d('0x3d')](_0x1a80bc,function(_0x554255){if(_0x554255[_0x429d('0x4e')]!==_0x429d('0x4f')){var _0xfd1ff7={};_0xfd1ff7[_0x554255[_0x429d('0x38')]]={'$like':'%'+_0x1733a8[_0x429d('0x42')]['filter']+'%'};return _0xfd1ff7;}})});}_0x439a6d=_[_0x429d('0x50')]({},_0x439a6d,_0x1733a8[_0x429d('0x51')]);var _0x21bf06={'where':_0x439a6d[_0x429d('0x4b')]};return db['FaxAccount'][_0x429d('0x30')](_0x21bf06)[_0x429d('0x21')](function(_0x4322a6){_0x1e3924['count']=_0x4322a6;if(_0x1733a8[_0x429d('0x42')]['includeAll']){_0x439a6d[_0x429d('0x52')]=[{'all':!![]}];}return db[_0x429d('0x53')][_0x429d('0x54')](_0x439a6d);})['then'](function(_0x4aa914){_0x1e3924[_0x429d('0x55')]=_0x4aa914;return _0x1e3924;})['then'](respondWithFilteredResult(_0x429a5e,_0x439a6d))[_0x429d('0x2b')](handleError(_0x429a5e,null));};exports[_0x429d('0x56')]=function(_0x141129,_0x25121e){var _0x31d1e7={'raw':![],'where':{'id':_0x141129[_0x429d('0x57')]['id']},'include':[{'model':db[_0x429d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x10dec8={};_0x10dec8['model']=_[_0x429d('0x41')](db[_0x429d('0x53')][_0x429d('0x58')]);_0x10dec8[_0x429d('0x42')]=_['keys'](_0x141129[_0x429d('0x42')]);_0x10dec8[_0x429d('0x59')]=_[_0x429d('0x43')](_0x10dec8[_0x429d('0x40')],_0x10dec8[_0x429d('0x42')]);_0x31d1e7[_0x429d('0x44')]=_[_0x429d('0x43')](_0x10dec8[_0x429d('0x40')],qs[_0x429d('0x45')](_0x141129[_0x429d('0x42')]['fields']));_0x31d1e7[_0x429d('0x44')]=_0x31d1e7[_0x429d('0x44')][_0x429d('0x46')]?_0x31d1e7[_0x429d('0x44')]:_0x10dec8[_0x429d('0x40')];if(_0x141129[_0x429d('0x42')][_0x429d('0x5a')]){_0x31d1e7['include']=[{'all':!![]}];}_0x31d1e7=_[_0x429d('0x50')]({},_0x31d1e7,_0x141129[_0x429d('0x51')]);return db[_0x429d('0x53')][_0x429d('0x5b')](_0x31d1e7)['then'](handleEntityNotFound(_0x25121e,null))[_0x429d('0x21')](respondWithResult(_0x25121e,null))['catch'](handleError(_0x25121e,null));};exports[_0x429d('0x5c')]=function(_0x5b6daf,_0x5f2e19){return db[_0x429d('0x53')][_0x429d('0x5c')](_0x5b6daf['body'],{})[_0x429d('0x21')](function(_0x1af295){var _0x4a27fc=_0x5b6daf[_0x429d('0x5d')][_0x429d('0x36')]({'plain':!![]});if(!_0x4a27fc)throw new Error(_0x429d('0x5e'));if(_0x4a27fc[_0x429d('0x5f')]==='user'){var _0x2994ee=_0x1af295[_0x429d('0x36')]({'plain':!![]});var _0x738c59=_0x429d('0x60');return db[_0x429d('0x61')][_0x429d('0x5b')]({'where':{'name':_0x738c59,'userProfileId':_0x4a27fc[_0x429d('0x62')]},'raw':!![]})[_0x429d('0x21')](function(_0x168e0d){if(_0x168e0d&&_0x168e0d[_0x429d('0x63')]===0x0){return db[_0x429d('0x64')][_0x429d('0x5c')]({'name':_0x2994ee[_0x429d('0x38')],'resourceId':_0x2994ee['id'],'type':_0x168e0d[_0x429d('0x38')],'sectionId':_0x168e0d['id']},{})[_0x429d('0x21')](function(){return _0x1af295;});}else{return _0x1af295;}})[_0x429d('0x2b')](function(_0x533b43){logger[_0x429d('0x27')](_0x429d('0x65'),_0x533b43);throw _0x533b43;});}return _0x1af295;})['then'](respondWithResult(_0x5f2e19,0xc9))[_0x429d('0x2b')](handleError(_0x5f2e19,null));};exports[_0x429d('0x66')]=function(_0x59ae0d,_0x1a9119){if(_0x59ae0d[_0x429d('0x67')]['id']){delete _0x59ae0d[_0x429d('0x67')]['id'];}return db['FaxAccount'][_0x429d('0x5b')]({'where':{'id':_0x59ae0d[_0x429d('0x57')]['id']},'include':[{'model':db[_0x429d('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x429d('0x21')](handleEntityNotFound(_0x1a9119,null))[_0x429d('0x21')](saveUpdates(_0x59ae0d[_0x429d('0x67')],null))[_0x429d('0x21')](respondWithResult(_0x1a9119,null))[_0x429d('0x2b')](handleError(_0x1a9119,null));};exports[_0x429d('0x35')]=function(_0x389d22,_0x4abc5b){return db[_0x429d('0x53')][_0x429d('0x5b')]({'where':{'id':_0x389d22[_0x429d('0x57')]['id']}})['then'](handleEntityNotFound(_0x4abc5b,null))[_0x429d('0x21')](removeEntity(_0x4abc5b,null))[_0x429d('0x2b')](handleError(_0x4abc5b,null));};exports[_0x429d('0x68')]=function(_0x1d9f57,_0xfecc2a){return db['FaxAccount'][_0x429d('0x68')]()[_0x429d('0x21')](respondWithResult(_0xfecc2a,null))[_0x429d('0x2b')](handleError(_0xfecc2a,null));};exports['addDisposition']=function(_0x275672,_0x23d3a7,_0x29c4be){if(_0x275672[_0x429d('0x67')]['id']){delete _0x275672['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x275672['params']['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x23d3a7,null))[_0x429d('0x21')](function(_0x2917d7){if(_0x2917d7){_0x275672[_0x429d('0x67')][_0x429d('0x69')]=_0x2917d7['id'];return db['Disposition'][_0x429d('0x5c')](_0x275672[_0x429d('0x67')]);}})['then'](respondWithResult(_0x23d3a7,null))[_0x429d('0x2b')](handleError(_0x23d3a7,null));};exports['getDispositions']=function(_0x5f4f3f,_0x5c3d12,_0xc6fa23){var _0x586e49={'raw':![],'where':{}};var _0x52da13={};var _0x2b5576={'count':0x0,'rows':[]};return db[_0x429d('0x53')][_0x429d('0x6a')]({'where':{'id':_0x5f4f3f[_0x429d('0x57')]['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x5c3d12,null))[_0x429d('0x21')](function(_0x533a52){if(_0x533a52){_0x52da13[_0x429d('0x40')]=_['keys'](db[_0x429d('0x6b')][_0x429d('0x58')]);_0x52da13[_0x429d('0x42')]=_[_0x429d('0x41')](_0x5f4f3f[_0x429d('0x42')]);_0x52da13[_0x429d('0x59')]=_['intersection'](_0x52da13['model'],_0x52da13['query']);_0x586e49[_0x429d('0x44')]=_[_0x429d('0x43')](_0x52da13['model'],qs[_0x429d('0x45')](_0x5f4f3f[_0x429d('0x42')]['fields']));_0x586e49['attributes']=_0x586e49[_0x429d('0x44')]['length']?_0x586e49[_0x429d('0x44')]:_0x52da13[_0x429d('0x40')];if(!_0x5f4f3f['query'][_0x429d('0x47')](_0x429d('0x48'))){_0x586e49['limit']=qs[_0x429d('0x32')](_0x5f4f3f[_0x429d('0x42')][_0x429d('0x32')]);_0x586e49[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x5f4f3f[_0x429d('0x42')][_0x429d('0x31')]);}_0x586e49[_0x429d('0x49')]=qs['sort'](_0x5f4f3f[_0x429d('0x42')][_0x429d('0x4a')]);_0x586e49['where']=qs[_0x429d('0x59')](_[_0x429d('0x4c')](_0x5f4f3f[_0x429d('0x42')],_0x52da13[_0x429d('0x59')]));_0x586e49[_0x429d('0x4b')][_0x429d('0x69')]=_0x533a52['id'];if(_0x5f4f3f['query'][_0x429d('0x4d')]){_0x586e49[_0x429d('0x4b')]=_['merge'](_0x586e49[_0x429d('0x4b')],{'$or':_['map'](_0x586e49['attributes'],function(_0x5c55c1){var _0x5b6ca0={};_0x5b6ca0[_0x5c55c1]={'$like':'%'+_0x5f4f3f[_0x429d('0x42')][_0x429d('0x4d')]+'%'};return _0x5b6ca0;})});}_0x586e49=_[_0x429d('0x50')]({},_0x586e49,_0x5f4f3f[_0x429d('0x51')]);return db[_0x429d('0x6b')]['count']({'where':_0x586e49[_0x429d('0x4b')]})[_0x429d('0x21')](function(_0x1599de){_0x2b5576[_0x429d('0x30')]=_0x1599de;if(_0x5f4f3f[_0x429d('0x42')]['includeAll']){_0x586e49[_0x429d('0x52')]=[{'all':!![]}];}return db[_0x429d('0x6b')][_0x429d('0x54')](_0x586e49);})['then'](function(_0x1d464a){_0x2b5576[_0x429d('0x55')]=_0x1d464a;return _0x2b5576;});}})[_0x429d('0x21')](respondWithFilteredResult(_0x5c3d12,_0x586e49))[_0x429d('0x2b')](handleError(_0x5c3d12,null));};exports[_0x429d('0x6c')]=function(_0x4376f1,_0x55c3d8,_0x5397f0){return db['FaxAccount'][_0x429d('0x5b')]({'where':{'id':_0x4376f1['params']['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x55c3d8,null))[_0x429d('0x21')](function(_0x563580){if(_0x563580){return _0x563580['removeDispositions'](_0x4376f1[_0x429d('0x42')][_0x429d('0x6d')]);}})[_0x429d('0x21')](respondWithStatusCode(_0x55c3d8,null))[_0x429d('0x2b')](handleError(_0x55c3d8,null));};exports[_0x429d('0x6e')]=function(_0x52e106,_0x3930fa,_0x4fea4b){if(_0x52e106['body']['id']){delete _0x52e106[_0x429d('0x67')]['id'];}return db[_0x429d('0x53')][_0x429d('0x5b')]({'where':{'id':_0x52e106['params']['id']}})['then'](handleEntityNotFound(_0x3930fa,null))[_0x429d('0x21')](function(_0x181663){if(_0x181663){_0x52e106[_0x429d('0x67')][_0x429d('0x69')]=_0x181663['id'];return db[_0x429d('0x6f')][_0x429d('0x5c')](_0x52e106[_0x429d('0x67')]);}})[_0x429d('0x21')](respondWithResult(_0x3930fa,null))['catch'](handleError(_0x3930fa,null));};exports['getAnswers']=function(_0x465087,_0xee10a1,_0x51f5fa){var _0x1a767a={'raw':![],'where':{}};var _0x4758ba={};var _0x1b76e3={'count':0x0,'rows':[]};return db[_0x429d('0x53')][_0x429d('0x6a')]({'where':{'id':_0x465087[_0x429d('0x57')]['id']}})['then'](handleEntityNotFound(_0xee10a1,null))['then'](function(_0x4e1b82){if(_0x4e1b82){_0x4758ba['model']=_[_0x429d('0x41')](db[_0x429d('0x6f')][_0x429d('0x58')]);_0x4758ba[_0x429d('0x42')]=_[_0x429d('0x41')](_0x465087['query']);_0x4758ba[_0x429d('0x59')]=_[_0x429d('0x43')](_0x4758ba['model'],_0x4758ba[_0x429d('0x42')]);_0x1a767a[_0x429d('0x44')]=_[_0x429d('0x43')](_0x4758ba[_0x429d('0x40')],qs[_0x429d('0x45')](_0x465087[_0x429d('0x42')]['fields']));_0x1a767a[_0x429d('0x44')]=_0x1a767a[_0x429d('0x44')][_0x429d('0x46')]?_0x1a767a['attributes']:_0x4758ba[_0x429d('0x40')];if(!_0x465087[_0x429d('0x42')][_0x429d('0x47')](_0x429d('0x48'))){_0x1a767a[_0x429d('0x32')]=qs[_0x429d('0x32')](_0x465087[_0x429d('0x42')][_0x429d('0x32')]);_0x1a767a[_0x429d('0x31')]=qs['offset'](_0x465087[_0x429d('0x42')]['offset']);}_0x1a767a[_0x429d('0x49')]=qs[_0x429d('0x4a')](_0x465087[_0x429d('0x42')][_0x429d('0x4a')]);_0x1a767a[_0x429d('0x4b')]=qs[_0x429d('0x59')](_[_0x429d('0x4c')](_0x465087[_0x429d('0x42')],_0x4758ba[_0x429d('0x59')]));_0x1a767a[_0x429d('0x4b')][_0x429d('0x69')]=_0x4e1b82['id'];if(_0x465087['query']['filter']){_0x1a767a[_0x429d('0x4b')]=_[_0x429d('0x50')](_0x1a767a['where'],{'$or':_[_0x429d('0x3d')](_0x1a767a[_0x429d('0x44')],function(_0x580c3c){var _0x397f2e={};_0x397f2e[_0x580c3c]={'$like':'%'+_0x465087[_0x429d('0x42')][_0x429d('0x4d')]+'%'};return _0x397f2e;})});}_0x1a767a=_[_0x429d('0x50')]({},_0x1a767a,_0x465087['options']);return db[_0x429d('0x6f')][_0x429d('0x30')]({'where':_0x1a767a[_0x429d('0x4b')]})[_0x429d('0x21')](function(_0x24536f){_0x1b76e3[_0x429d('0x30')]=_0x24536f;if(_0x465087['query'][_0x429d('0x5a')]){_0x1a767a['include']=[{'all':!![]}];}return db[_0x429d('0x6f')][_0x429d('0x54')](_0x1a767a);})['then'](function(_0x26c3c0){_0x1b76e3[_0x429d('0x55')]=_0x26c3c0;return _0x1b76e3;});}})[_0x429d('0x21')](respondWithFilteredResult(_0xee10a1,_0x1a767a))[_0x429d('0x2b')](handleError(_0xee10a1,null));};exports[_0x429d('0x70')]=function(_0x2a4293,_0x924a43,_0x3722ff){return db[_0x429d('0x53')][_0x429d('0x5b')]({'where':{'id':_0x2a4293[_0x429d('0x57')]['id']}})['then'](handleEntityNotFound(_0x924a43,null))[_0x429d('0x21')](function(_0x1d1a38){if(_0x1d1a38){return _0x1d1a38['removeAnswers'](_0x2a4293[_0x429d('0x42')][_0x429d('0x6d')]);}})[_0x429d('0x21')](respondWithStatusCode(_0x924a43,null))[_0x429d('0x2b')](handleError(_0x924a43,null));};exports[_0x429d('0x71')]=function(_0x4e8e27,_0x460124,_0x270ba1){return db[_0x429d('0x72')][_0x429d('0x5b')]({'where':{'id':_0x4e8e27[_0x429d('0x57')]['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x460124,null))['then'](function(_0x39b671){if(_0x39b671){return _0x39b671['addInteraction'](_0x4e8e27[_0x429d('0x67')][_0x429d('0x6d')],_['omit'](_0x4e8e27[_0x429d('0x67')],[_0x429d('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x460124,null))['catch'](handleError(_0x460124,null));};exports['getInteractions']=function(_0x507be4,_0x4798dc,_0x1c62bc){var _0x334a8a={'raw':![],'where':{}};var _0x359cf5={};var _0x2fd3ff={'count':0x0,'rows':[]};return db['FaxAccount'][_0x429d('0x6a')]({'where':{'id':_0x507be4['params']['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x4798dc,null))[_0x429d('0x21')](function(_0x1e115f){if(_0x1e115f){_0x359cf5['model']=_['keys'](db[_0x429d('0x72')]['rawAttributes']);_0x359cf5['query']=_[_0x429d('0x41')](_0x507be4['query']);_0x359cf5['filters']=_['intersection'](_0x359cf5[_0x429d('0x40')],_0x359cf5[_0x429d('0x42')]);_0x334a8a[_0x429d('0x44')]=_['intersection'](_0x359cf5['model'],qs[_0x429d('0x45')](_0x507be4[_0x429d('0x42')][_0x429d('0x45')]));_0x334a8a[_0x429d('0x44')]=_0x334a8a['attributes']['length']?_0x334a8a[_0x429d('0x44')]:_0x359cf5[_0x429d('0x40')];if(!_0x507be4['query'][_0x429d('0x47')]('nolimit')){_0x334a8a[_0x429d('0x32')]=qs['limit'](_0x507be4['query'][_0x429d('0x32')]);_0x334a8a[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x507be4[_0x429d('0x42')][_0x429d('0x31')]);}_0x334a8a[_0x429d('0x49')]=qs['sort'](_0x507be4[_0x429d('0x42')]['sort']);_0x334a8a[_0x429d('0x4b')]=qs[_0x429d('0x59')](_[_0x429d('0x4c')](_0x507be4[_0x429d('0x42')],_0x359cf5['filters']));_0x334a8a[_0x429d('0x4b')]['FaxAccountId']=_0x1e115f['id'];if(_0x507be4[_0x429d('0x42')][_0x429d('0x4d')]){_0x334a8a[_0x429d('0x4b')]=_[_0x429d('0x50')](_0x334a8a[_0x429d('0x4b')],{'$or':_[_0x429d('0x3d')](_0x334a8a[_0x429d('0x44')],function(_0x56ff6d){var _0x3c3ac1={};_0x3c3ac1[_0x56ff6d]={'$like':'%'+_0x507be4[_0x429d('0x42')][_0x429d('0x4d')]+'%'};return _0x3c3ac1;})});}_0x334a8a=_[_0x429d('0x50')]({},_0x334a8a,_0x507be4[_0x429d('0x51')]);return db[_0x429d('0x72')][_0x429d('0x30')]({'where':_0x334a8a[_0x429d('0x4b')]})[_0x429d('0x21')](function(_0x15de92){_0x2fd3ff[_0x429d('0x30')]=_0x15de92;if(_0x507be4[_0x429d('0x42')][_0x429d('0x5a')]){_0x334a8a['include']=[{'model':db['CmContact'],'as':_0x429d('0x73'),'required':![]},{'model':db[_0x429d('0x74')],'as':'Owner','attributes':[_0x429d('0x38'),_0x429d('0x75'),'internal'],'required':![]},{'model':db[_0x429d('0x76')],'as':_0x429d('0x77'),'attributes':['id',_0x429d('0x38'),_0x429d('0x78')],'where':_0x507be4[_0x429d('0x42')]['tag']?{'id':_0x507be4[_0x429d('0x42')][_0x429d('0x79')]}:undefined,'required':_0x507be4[_0x429d('0x42')]['tag']?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x334a8a);})[_0x429d('0x21')](function(_0xa180a5){_0x2fd3ff[_0x429d('0x55')]=_0xa180a5;return _0x2fd3ff;});}})[_0x429d('0x21')](respondWithFilteredResult(_0x4798dc,_0x334a8a))['catch'](handleError(_0x4798dc,null));};exports[_0x429d('0x7a')]=function(_0x5171c7,_0x2055e6,_0x4ac901){return db[_0x429d('0x53')][_0x429d('0x6a')]({'where':{'id':_0x5171c7[_0x429d('0x57')]['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x2055e6,null))[_0x429d('0x21')](function(_0xca9502){if(_0xca9502){return db['sequelize']['transaction'](function(_0x31e264){return db[_0x429d('0x7b')][_0x429d('0x35')]({'where':{'FaxAccountId':_0x5171c7[_0x429d('0x57')]['id']},'transaction':_0x31e264})[_0x429d('0x21')](function(_0x58898c){var _0x4c867c=_[_0x429d('0x3d')](_0x5171c7[_0x429d('0x67')],function(_0x24031e){_0x24031e['FaxAccountId']=_0x5171c7[_0x429d('0x57')]['id'];return _0x24031e;});return db[_0x429d('0x7b')][_0x429d('0x7c')](_0x4c867c,{'transaction':_0x31e264});});})['then'](function(){return db[_0x429d('0x7b')]['findAndCountAll']({'where':{'FaxAccountId':_0x5171c7[_0x429d('0x57')]['id']},'order':_0x429d('0x7d')});});}})[_0x429d('0x21')](respondWithResult(_0x2055e6,null))[_0x429d('0x2b')](handleError(_0x2055e6,null));};exports[_0x429d('0x7e')]=function(_0x392d51,_0x1ba8bc,_0x37fef3){var _0x6742a7={};var _0x234a10={};var _0x457253;var _0x58b675;return db[_0x429d('0x53')]['findOne']({'where':{'id':_0x392d51[_0x429d('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ba8bc,null))[_0x429d('0x21')](function(_0x1faa53){if(_0x1faa53){_0x457253=_0x1faa53;_0x234a10[_0x429d('0x40')]=_[_0x429d('0x41')](db[_0x429d('0x7b')]['rawAttributes']);_0x234a10[_0x429d('0x42')]=_[_0x429d('0x41')](_0x392d51[_0x429d('0x42')]);_0x234a10[_0x429d('0x59')]=_[_0x429d('0x43')](_0x234a10[_0x429d('0x40')],_0x234a10['query']);_0x6742a7[_0x429d('0x44')]=_[_0x429d('0x43')](_0x234a10[_0x429d('0x40')],qs[_0x429d('0x45')](_0x392d51[_0x429d('0x42')]['fields']));_0x6742a7[_0x429d('0x44')]=_0x6742a7[_0x429d('0x44')][_0x429d('0x46')]?_0x6742a7[_0x429d('0x44')]:_0x234a10[_0x429d('0x40')];_0x6742a7[_0x429d('0x49')]=qs['sort'](_0x392d51[_0x429d('0x42')][_0x429d('0x4a')]);_0x6742a7['where']=qs[_0x429d('0x59')](_['pick'](_0x392d51[_0x429d('0x42')],_0x234a10[_0x429d('0x59')]));if(_0x392d51['query'][_0x429d('0x4d')]){_0x6742a7[_0x429d('0x4b')]=_[_0x429d('0x50')](_0x6742a7[_0x429d('0x4b')],{'$or':_[_0x429d('0x3d')](_0x6742a7[_0x429d('0x44')],function(_0x1c5c07){var _0x25b788={};_0x25b788[_0x1c5c07]={'$like':'%'+_0x392d51[_0x429d('0x42')][_0x429d('0x4d')]+'%'};return _0x25b788;})});}_0x6742a7=_[_0x429d('0x50')]({},_0x6742a7,_0x392d51[_0x429d('0x51')]);return _0x457253['getApplications'](_0x6742a7);}})[_0x429d('0x21')](function(_0x552790){if(_0x552790){_0x58b675=_0x552790[_0x429d('0x46')];if(!_0x392d51[_0x429d('0x42')][_0x429d('0x47')](_0x429d('0x48'))){_0x6742a7[_0x429d('0x32')]=qs[_0x429d('0x32')](_0x392d51[_0x429d('0x42')]['limit']);_0x6742a7[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x392d51[_0x429d('0x42')][_0x429d('0x31')]);}return _0x457253[_0x429d('0x7e')](_0x6742a7);}})[_0x429d('0x21')](function(_0x1beffd){if(_0x1beffd){return _0x1beffd?{'count':_0x58b675,'rows':_0x1beffd}:null;}})[_0x429d('0x21')](respondWithResult(_0x1ba8bc,null))[_0x429d('0x2b')](handleError(_0x1ba8bc,null));};function Extension(_0x43daa3,_0xc70fff,_0x2c317a,_0x453fca){this[_0x429d('0x7f')]='from-voip-provider';this[_0x429d('0x80')]=_0x43daa3[_0x429d('0x81')];this[_0x429d('0x82')]=_0x453fca;this['type']=_0x429d('0x83');this['description']=_0x429d('0x84');this['FaxAccountId']=_0x43daa3['id'];this[_0x429d('0x7d')]=_0xc70fff;this[_0x429d('0x85')]=_0x2c317a;}function createExtensionsReciveFax(_0x49820d){var _0xd050ee=0x1;var _0x1381dc=[];_0x1381dc[_0x429d('0x86')](new Extension(_0x49820d,_0xd050ee,'','Answer'));_0xd050ee+=0x1;_0x1381dc[_0x429d('0x86')](new Extension(_0x49820d,_0xd050ee,'CDR(type)=inbound-fax','Set'));_0xd050ee+=0x1;for(var _0x6502d0 in _0x49820d){if(_0x49820d['hasOwnProperty'](_0x6502d0)&&(_0x6502d0==='ecm'||_0x6502d0==='localstationid'||_0x6502d0===_0x429d('0x87')||_0x6502d0===_0x429d('0x88')||_0x6502d0===_0x429d('0x89')||_0x6502d0===_0x429d('0x8a')||_0x6502d0==='minrate'||_0x6502d0==='modem'||_0x6502d0===_0x429d('0x8b'))){_0x1381dc['push'](new Extension(_0x49820d,_0xd050ee,_0x429d('0x8c')+_0x6502d0+')='+_0x49820d[_0x6502d0],_0x429d('0x8d')));_0xd050ee+=0x1;}}_0x1381dc[_0x429d('0x86')](new Extension(_0x49820d,_0xd050ee,'6',_0x429d('0x8e')));_0xd050ee+=0x1;_0x1381dc[_0x429d('0x86')](new Extension(_0x49820d,_0xd050ee,_0x429d('0x8f'),_0x429d('0x90')));_0xd050ee=0x0;return _0x1381dc;}exports['addAccountApplications']=function(_0x4024e9,_0x4a1d57,_0x42d995){var _0x2f294e;return db['sequelize']['transaction'](function(_0x112dea){return db['FaxAccount'][_0x429d('0x5c')](_0x4024e9[_0x429d('0x67')],{'transaction':_0x112dea})[_0x429d('0x21')](function(_0x379a47){_0x2f294e=_0x379a47[_0x429d('0x36')]({'plain':!![]});return db[_0x429d('0x91')][_0x429d('0x7c')](createExtensionsReciveFax(_0x2f294e),{'transaction':_0x112dea});});})[_0x429d('0x21')](function(){return _0x2f294e;})[_0x429d('0x21')](respondWithResult(_0x4a1d57,null))[_0x429d('0x2b')](handleError(_0x4a1d57,null));};exports[_0x429d('0x92')]=function(_0xcf593f,_0x43e6cf,_0x84e47f){var _0x3ada85;return db['sequelize']['transaction'](function(_0x15f44e){return db['FaxAccount']['update'](_0xcf593f['body'],{'where':{'id':_0xcf593f['body']['id']},'transaction':_0x15f44e})[_0x429d('0x21')](function(_0x6c2e1e){return db[_0x429d('0x91')]['destroy']({'where':{'FaxAccountId':_0xcf593f['body']['id']},'transaction':_0x15f44e})[_0x429d('0x21')](function(_0x1c00f6){return db['VoiceExtension'][_0x429d('0x7c')](createExtensionsReciveFax(_[_0x429d('0x93')](_0xcf593f[_0x429d('0x67')],[_0x429d('0x94'),_0x429d('0x3f'),_0x429d('0x95'),'updatedAt','TrunkId',_0x429d('0x96')])),{'transaction':_0x15f44e});});});})[_0x429d('0x21')](function(){return db['FaxAccount'][_0x429d('0x97')](_0xcf593f[_0x429d('0x67')]['id']);})[_0x429d('0x21')](respondWithResult(_0x43e6cf,null))[_0x429d('0x2b')](handleError(_0x43e6cf,null));};exports['getMessages']=function(_0x2ef702,_0x7307ca,_0x1c748a){var _0x53e699={'raw':!![],'where':{}};var _0x4d81a2={};var _0x226eb3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x429d('0x6a')]({'where':{'id':_0x2ef702['params']['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x7307ca,null))[_0x429d('0x21')](function(_0x14376a){if(_0x14376a){_0x4d81a2[_0x429d('0x40')]=_[_0x429d('0x41')](db[_0x429d('0x98')][_0x429d('0x58')]);_0x4d81a2[_0x429d('0x42')]=_[_0x429d('0x41')](_0x2ef702['query']);_0x4d81a2[_0x429d('0x59')]=_[_0x429d('0x43')](_0x4d81a2[_0x429d('0x40')],_0x4d81a2['query']);_0x53e699[_0x429d('0x44')]=_[_0x429d('0x43')](_0x4d81a2[_0x429d('0x40')],qs[_0x429d('0x45')](_0x2ef702['query'][_0x429d('0x45')]));_0x53e699['attributes']=_0x53e699[_0x429d('0x44')][_0x429d('0x46')]?_0x53e699[_0x429d('0x44')]:_0x4d81a2[_0x429d('0x40')];if(!_0x2ef702[_0x429d('0x42')][_0x429d('0x47')](_0x429d('0x48'))){_0x53e699[_0x429d('0x32')]=qs[_0x429d('0x32')](_0x2ef702[_0x429d('0x42')][_0x429d('0x32')]);_0x53e699[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x2ef702[_0x429d('0x42')][_0x429d('0x31')]);}_0x53e699[_0x429d('0x49')]=qs[_0x429d('0x4a')](_0x2ef702[_0x429d('0x42')]['sort']);_0x53e699[_0x429d('0x4b')]=qs[_0x429d('0x59')](_[_0x429d('0x4c')](_0x2ef702[_0x429d('0x42')],_0x4d81a2['filters']));_0x53e699[_0x429d('0x4b')]['FaxAccountId']=_0x14376a['id'];if(_0x2ef702[_0x429d('0x42')][_0x429d('0x4d')]){_0x53e699[_0x429d('0x4b')]=_[_0x429d('0x50')](_0x53e699['where'],{'$or':_[_0x429d('0x3d')](_0x53e699[_0x429d('0x44')],function(_0x417a18){var _0x265579={};_0x265579[_0x417a18]={'$like':'%'+_0x2ef702[_0x429d('0x42')][_0x429d('0x4d')]+'%'};return _0x265579;})});}if(_0x2ef702[_0x429d('0x42')][_0x429d('0x99')]){var _0x196be0=_0x2ef702[_0x429d('0x42')][_0x429d('0x99')][_0x429d('0x9a')](',');var _0x50df78={};_0x50df78[_0x196be0[0x0]]={'$gte':moment(_0x196be0[0x1])['format'](_0x429d('0x9b'))};_0x53e699['where']=_[_0x429d('0x50')](_0x53e699[_0x429d('0x4b')],_0x50df78);}_0x53e699=_[_0x429d('0x50')]({},_0x53e699,_0x2ef702[_0x429d('0x51')]);return db[_0x429d('0x98')][_0x429d('0x30')]({'where':_0x53e699['where']})[_0x429d('0x21')](function(_0x12f764){_0x226eb3[_0x429d('0x30')]=_0x12f764;if(_0x2ef702['query'][_0x429d('0x5a')]){_0x53e699[_0x429d('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x429d('0x54')](_0x53e699);})[_0x429d('0x21')](function(_0x2d4731){_0x226eb3['rows']=_0x2d4731;return _0x226eb3;});}})['then'](respondWithFilteredResult(_0x7307ca,_0x53e699))[_0x429d('0x2b')](handleError(_0x7307ca,null));};exports[_0x429d('0x39')]=function(_0x259d22,_0x263c18,_0x31b624){var _0x50c9fc,_0x41f2a0={},_0x4a5ca5;if(_0x259d22['body']['to']){_0x4a5ca5=_0x259d22[_0x429d('0x67')]['to'][0x0];}return db[_0x429d('0x53')]['find']({'where':{'id':_0x259d22[_0x429d('0x57')]['id']},'include':[{'model':db[_0x429d('0x9c')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x4a5ca5},'limit':0x1,'order':[['updatedAt',_0x429d('0x9d')]]}]}]})[_0x429d('0x21')](handleEntityNotFound(_0x263c18,null))[_0x429d('0x21')](function(_0x2cd61f){_0x50c9fc=_0x2cd61f;if(_0x259d22['body'][_0x429d('0x9e')]&&_0x259d22[_0x429d('0x67')]['attachments'][_0x429d('0x46')]){for(var _0x53a7cd=0x0;_0x53a7cd<_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][_0x429d('0x46')];_0x53a7cd+=0x1){_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][_0x53a7cd]={'filename':_0x259d22[_0x429d('0x67')]['attachments'][_0x53a7cd][_0x429d('0x38')],'id':_0x259d22['body'][_0x429d('0x9e')][_0x53a7cd]['id'],'path':path[_0x429d('0x9f')](config[_0x429d('0xa0')],_0x429d('0xa1'),_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][_0x53a7cd]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x429d('0xa2')](_0x259d22[_0x429d('0x57')]['id'])?undefined:_0x259d22[_0x429d('0x57')]['id'],'path':_[_0x429d('0xa2')](_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][0x0]['path'])?undefined:_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][0x0][_0x429d('0x8')],'fax':_['isNil'](_0x259d22['body']['to'][0x0])?undefined:_0x259d22[_0x429d('0x67')]['to'][0x0]},client9002);})['then'](function(){if(_0x50c9fc){if(_[_0x429d('0xa2')](_0x259d22[_0x429d('0x67')][_0x429d('0xa3')])){_0x259d22[_0x429d('0x67')][_0x429d('0xa3')]=util[_0x429d('0xa4')](_0x429d('0xa5'),_0x50c9fc['name'],_0x50c9fc[_0x429d('0xa6')]);}if(_0x50c9fc[_0x429d('0xa7')]){if(_0x50c9fc['List']['Contacts']['length']){return _0x50c9fc[_0x429d('0xa7')][_0x429d('0xa8')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x259d22[_0x429d('0x67')],{'firstName':_0x259d22['body']['to'][0x0],'phone':_0x259d22[_0x429d('0x67')]['to'][0x0],'fax':_0x259d22['body']['to'][0x0],'ListId':_0x50c9fc['ListId']}));}}else{throw new Error(_0x429d('0xa9'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x429d('0x21')](function(_0x390eec){if(_0x390eec){return db[_0x429d('0x72')][_0x429d('0x5b')]({'where':{'ContactId':_0x390eec['id'],'closed':![],'FaxAccountId':_0x50c9fc['id']}})[_0x429d('0x21')](function(_0x5d1f91){if(_0x5d1f91){return[_0x5d1f91,![]];}return db['FaxInteraction']['create']({'UserId':_0x259d22[_0x429d('0x5d')]['id'],'ContactId':_0x390eec['id'],'FaxAccountId':_0x50c9fc['id'],'fax':_0x259d22[_0x429d('0x67')]['to'][0x0],'firstMsgDirection':_0x429d('0xaa'),'Messages':[_[_0x429d('0x50')](_0x259d22[_0x429d('0x67')],{'read':![],'body':_0x259d22[_0x429d('0x67')]['attachments'][0x0][_0x429d('0xab')],'FaxAccountId':_0x50c9fc['id'],'UserId':_0x259d22[_0x429d('0x5d')]['id'],'ContactId':_0x390eec['id'],'AttachmentId':_0x259d22['body'][_0x429d('0x9e')][0x0]['id']})]},{'include':[{'model':db[_0x429d('0x98')],'as':_0x429d('0xac')}]})[_0x429d('0x21')](function(_0x2a95e3){return[_0x2a95e3,!![]];});});}else{throw new Error(_0x429d('0xad'));}})[_0x429d('0xae')](function(_0x57c5f4,_0x145806){if(_0x145806){return _0x57c5f4;}return db[_0x429d('0x98')][_0x429d('0x5c')]({'direction':_0x429d('0xaa'),'read':![],'body':_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][0x0][_0x429d('0xab')],'FaxAccountId':_0x50c9fc['id'],'FaxInteractionId':_0x57c5f4['id'],'UserId':_0x259d22[_0x429d('0x5d')]['id'],'ContactId':_0x57c5f4['ContactId'],'AttachmentId':_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][0x0]['id']})[_0x429d('0x21')](function(_0x405ad8){_0x57c5f4[_0x429d('0xaf')][_0x429d('0xac')]=[];_0x57c5f4[_0x429d('0xaf')][_0x429d('0xac')][_0x429d('0x86')](_0x405ad8[_0x429d('0xaf')]);return _0x57c5f4;});})[_0x429d('0x21')](function(_0x8c96fe){respondWithRpcPromise(_0x429d('0xb0'),_0x429d('0xb0'),{'FaxAccountId':_[_0x429d('0xa2')](_0x259d22[_0x429d('0x57')]['id'])?undefined:_0x259d22['params']['id'],'path':_['isNil'](_0x259d22[_0x429d('0x67')][_0x429d('0x9e')][0x0]['path'])?undefined:_0x259d22[_0x429d('0x67')]['attachments'][0x0]['path'],'fax':_[_0x429d('0xa2')](_0x259d22[_0x429d('0x67')]['to'][0x0])?undefined:_0x259d22[_0x429d('0x67')]['to'][0x0],'AttachmentId':_0x259d22[_0x429d('0x67')]['attachments'][0x0]['id']},client9002)[_0x429d('0x21')](function(_0x53f01e){logger[_0x429d('0x22')](_0x429d('0xb1'),_0x53f01e);})['catch'](function(_0x4c8c92){logger[_0x429d('0x22')](_0x429d('0xb1'),_0x4c8c92);});return _0x8c96fe;})['then'](respondWithResult(_0x263c18,null))[_0x429d('0x2b')](handleError(_0x263c18,null));};exports[_0x429d('0xb2')]=function(_0x351a33,_0x177ff8,_0x5824b9){return db[_0x429d('0x53')][_0x429d('0x5b')]({'where':{'id':_0x351a33[_0x429d('0x57')]['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x177ff8,null))[_0x429d('0x21')](function(_0x3ce8a2){if(_0x3ce8a2){return _0x3ce8a2[_0x429d('0xb2')](_0x351a33['body'][_0x429d('0x6d')],_[_0x429d('0x93')](_0x351a33[_0x429d('0x67')],['ids','id'])||{})[_0x429d('0xae')](function(_0x14e930){for(var _0x9b73f=0x0;_0x9b73f<_0x351a33['body']['ids'][_0x429d('0x46')];_0x9b73f+=0x1){socket[_0x429d('0xb3')](_0x429d('0xb4'),{'UserId':_0x351a33[_0x429d('0x67')]['ids'][_0x9b73f],'FaxAccountId':_0x351a33[_0x429d('0x57')]['id']});}return _0x14e930;});}})['then'](respondWithResult(_0x177ff8,null))[_0x429d('0x2b')](handleError(_0x177ff8,null));};exports[_0x429d('0xb5')]=function(_0x5ce686,_0x31de69,_0x2fe75f){return db[_0x429d('0x53')]['find']({'where':{'id':_0x5ce686['params']['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x31de69,null))['then'](function(_0x1251c9){if(_0x1251c9){return _0x1251c9[_0x429d('0xb5')](_0x5ce686[_0x429d('0x42')][_0x429d('0x6d')])['then'](function(){if(_['isArray'](_0x5ce686[_0x429d('0x42')][_0x429d('0x6d')])){for(var _0x50e8f5=0x0;_0x50e8f5<_0x5ce686[_0x429d('0x42')]['ids'][_0x429d('0x46')];_0x50e8f5+=0x1){socket[_0x429d('0xb3')](_0x429d('0xb6'),{'UserId':Number(_0x5ce686[_0x429d('0x42')]['ids'][_0x50e8f5]),'FaxAccountId':Number(_0x5ce686[_0x429d('0x57')]['id'])});}}else{socket['emit'](_0x429d('0xb6'),{'UserId':Number(_0x5ce686['query'][_0x429d('0x6d')]),'FaxAccountId':Number(_0x5ce686['params']['id'])});}});}})[_0x429d('0x21')](respondWithStatusCode(_0x31de69,null))[_0x429d('0x2b')](handleError(_0x31de69,null));};exports[_0x429d('0xb7')]=function(_0x3b4223,_0x50c09c,_0x2d3176){var _0x4ae780={};var _0x3c108d={};var _0x3c27b1;var _0x4cddbd;return db['FaxAccount'][_0x429d('0x6a')]({'where':{'id':_0x3b4223[_0x429d('0x57')]['id']}})[_0x429d('0x21')](handleEntityNotFound(_0x50c09c,null))[_0x429d('0x21')](function(_0x3c5a9f){if(_0x3c5a9f){_0x3c27b1=_0x3c5a9f;_0x3c108d[_0x429d('0x40')]=_['keys'](db[_0x429d('0x74')][_0x429d('0x58')]);_0x3c108d[_0x429d('0x42')]=_['keys'](_0x3b4223[_0x429d('0x42')]);_0x3c108d['filters']=_[_0x429d('0x43')](_0x3c108d[_0x429d('0x40')],_0x3c108d[_0x429d('0x42')]);_0x4ae780[_0x429d('0x44')]=_['intersection'](_0x3c108d[_0x429d('0x40')],qs[_0x429d('0x45')](_0x3b4223[_0x429d('0x42')][_0x429d('0x45')]));_0x4ae780['attributes']=_0x4ae780[_0x429d('0x44')][_0x429d('0x46')]?_0x4ae780[_0x429d('0x44')]:_0x3c108d[_0x429d('0x40')];_0x4ae780[_0x429d('0x49')]=qs[_0x429d('0x4a')](_0x3b4223[_0x429d('0x42')][_0x429d('0x4a')]);_0x4ae780[_0x429d('0x4b')]=qs['filters'](_[_0x429d('0x4c')](_0x3b4223['query'],_0x3c108d[_0x429d('0x59')]));if(_0x3b4223['query'][_0x429d('0x4d')]){_0x4ae780[_0x429d('0x4b')]=_[_0x429d('0x50')](_0x4ae780[_0x429d('0x4b')],{'$or':_['map'](_0x4ae780[_0x429d('0x44')],function(_0x751bef){var _0x23d509={};_0x23d509[_0x751bef]={'$like':'%'+_0x3b4223[_0x429d('0x42')]['filter']+'%'};return _0x23d509;})});}_0x4ae780=_[_0x429d('0x50')]({},_0x4ae780,_0x3b4223['options']);return _0x3c27b1[_0x429d('0xb7')](_0x4ae780);}})[_0x429d('0x21')](function(_0x2cdfec){if(_0x2cdfec){_0x4cddbd=_0x2cdfec[_0x429d('0x46')];if(!_0x3b4223['query'][_0x429d('0x47')](_0x429d('0x48'))){_0x4ae780[_0x429d('0x32')]=qs[_0x429d('0x32')](_0x3b4223[_0x429d('0x42')]['limit']);_0x4ae780[_0x429d('0x31')]=qs[_0x429d('0x31')](_0x3b4223[_0x429d('0x42')][_0x429d('0x31')]);}return _0x3c27b1['getAgents'](_0x4ae780);}})['then'](function(_0x339819){if(_0x339819){return _0x339819?{'count':_0x4cddbd,'rows':_0x339819}:null;}})[_0x429d('0x21')](respondWithResult(_0x50c09c,null))[_0x429d('0x2b')](handleError(_0x50c09c,null));}; \ No newline at end of file +var _0x0a12=['crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','filter','options','FaxAccount','include','findAll','catch','show','mandatoryDispositionPause','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','update','body','params','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','FaxAccountId','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','key','updatedAt','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','List','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','ListId','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x244f85,_0x413a3d){var _0x5ca430=function(_0x2b0255){while(--_0x2b0255){_0x244f85['push'](_0x244f85['shift']());}};_0x5ca430(++_0x413a3d);}(_0x0a12,0xb8));var _0x20a1=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0a12[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x20a1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x20a1('0x1'));var moment=require('moment');var BPromise=require(_0x20a1('0x2'));var Mustache=require(_0x20a1('0x3'));var util=require(_0x20a1('0x4'));var path=require(_0x20a1('0x5'));var sox=require(_0x20a1('0x6'));var csv=require(_0x20a1('0x7'));var ejs=require(_0x20a1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x20a1('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20a1('0x7'));var querystring=require(_0x20a1('0xa'));var Papa=require(_0x20a1('0xb'));var Redis=require(_0x20a1('0xc'));var authService=require(_0x20a1('0xd'));var qs=require(_0x20a1('0xe'));var as=require(_0x20a1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20a1('0x10'))(_0x20a1('0x11'));var utils=require(_0x20a1('0x12'));var config=require(_0x20a1('0x13'));var licenseUtil=require(_0x20a1('0x14'));var db=require(_0x20a1('0x15'))['db'];config['redis']=_[_0x20a1('0x16')](config[_0x20a1('0x17')],{'host':_0x20a1('0x18'),'port':0x18eb});var socket=require(_0x20a1('0x19'))(new Redis(config[_0x20a1('0x17')]));require(_0x20a1('0x1a'))[_0x20a1('0x1b')](socket);var jayson=require(_0x20a1('0x1c'));var client=jayson[_0x20a1('0x1d')][_0x20a1('0x1e')]({'port':0x232c});var client9002=jayson[_0x20a1('0x1d')][_0x20a1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1e6ae6,_0xec799b,_0x559a97,_0x50d618){return new BPromise(function(_0x5b26af,_0x4be097){var _0x5925d4=_0x50d618||client;return _0x5925d4['request'](_0x1e6ae6,_0x559a97)['then'](function(_0x55fe14){logger['info'](_0x20a1('0x1f'),_0xec799b,_0x20a1('0x20'));logger[_0x20a1('0x21')](_0x20a1('0x22'),_0xec799b,_0x20a1('0x20'),JSON[_0x20a1('0x23')](_0x55fe14));if(_0x55fe14['error']){if(_0x55fe14['error'][_0x20a1('0x24')]===0x1f4){logger[_0x20a1('0x25')](_0x20a1('0x1f'),_0xec799b,_0x55fe14['error']['message']);return _0x4be097(_0x55fe14[_0x20a1('0x25')][_0x20a1('0x26')]);}logger[_0x20a1('0x25')](_0x20a1('0x1f'),_0xec799b,_0x55fe14['error']['message']);return _0x5b26af(_0x55fe14['error']['message']);}else{logger[_0x20a1('0x27')](_0x20a1('0x1f'),_0xec799b,_0x20a1('0x20'));_0x5b26af(_0x55fe14['result'][_0x20a1('0x26')]);}})['catch'](function(_0x11b83c){logger['error']('FaxAccount,\x20%s,\x20%s',_0xec799b,_0x11b83c);_0x4be097(_0x11b83c);});});}function respondWithStatusCode(_0x47dcab,_0x52a35c){_0x52a35c=_0x52a35c||0xcc;return function(_0x566a9f){if(_0x566a9f){return _0x47dcab[_0x20a1('0x28')](_0x52a35c);}return _0x47dcab[_0x20a1('0x29')](_0x52a35c)[_0x20a1('0x2a')]();};}function respondWithResult(_0xee9dd8,_0x3927b2){_0x3927b2=_0x3927b2||0xc8;return function(_0x26bd09){if(_0x26bd09){return _0xee9dd8['status'](_0x3927b2)[_0x20a1('0x2b')](_0x26bd09);}};}function respondWithFilteredResult(_0x47877f,_0x2f8c8e){return function(_0x229710){if(_0x229710){var _0x522a7b=_0x229710[_0x20a1('0x2c')],_0x1c48cf=_0x2f8c8e[_0x20a1('0x2d')],_0x5a7c8b=_0x2f8c8e[_0x20a1('0x2d')]+_0x2f8c8e[_0x20a1('0x2e')],_0x4148a0;if(_0x5a7c8b>=_0x522a7b){_0x5a7c8b=_0x522a7b;_0x4148a0=0xc8;}else{_0x4148a0=0xce;}_0x47877f[_0x20a1('0x29')](_0x4148a0);return _0x47877f[_0x20a1('0x2f')](_0x20a1('0x30'),_0x1c48cf+'-'+_0x5a7c8b+'/'+_0x522a7b)[_0x20a1('0x2b')](_0x229710);}return null;};}function patchUpdates(_0x172701){return function(_0x49e141){try{jsonpatch[_0x20a1('0x31')](_0x49e141,_0x172701,!![]);}catch(_0x50194b){return BPromise['reject'](_0x50194b);}return _0x49e141[_0x20a1('0x32')]();};}function saveUpdates(_0x38503f,_0x23c32c){return function(_0x22dd21){if(_0x22dd21){return _0x22dd21['update'](_0x38503f)[_0x20a1('0x33')](function(_0x1c9f6e){return _0x1c9f6e;});}return null;};}function removeEntity(_0x308e15,_0x828a75){return function(_0x57276b){if(_0x57276b){return _0x57276b[_0x20a1('0x34')]()['then'](function(){var _0x5a7ade=_0x57276b[_0x20a1('0x35')]({'plain':!![]});var _0x7e9cd7=_0x20a1('0x36');return db[_0x20a1('0x37')]['destroy']({'where':{'type':_0x7e9cd7,'resourceId':_0x5a7ade['id']}})[_0x20a1('0x33')](function(){return _0x57276b;});})[_0x20a1('0x33')](function(){_0x308e15['status'](0xcc)[_0x20a1('0x2a')]();});}};}function handleEntityNotFound(_0x6356d8,_0x15ce87){return function(_0x4d04be){if(!_0x4d04be){_0x6356d8['sendStatus'](0x194);}return _0x4d04be;};}function handleError(_0x267f8b,_0x15881e){_0x15881e=_0x15881e||0x1f4;return function(_0x68bd2f){logger[_0x20a1('0x25')](_0x68bd2f[_0x20a1('0x38')]);if(_0x68bd2f[_0x20a1('0x39')]){delete _0x68bd2f[_0x20a1('0x39')];}_0x267f8b[_0x20a1('0x29')](_0x15881e)['send'](_0x68bd2f);};}exports[_0x20a1('0x3a')]=function(_0x3bd461,_0x19e48c){var _0x2cbdc6={'include':[{'model':db[_0x20a1('0x3b')],'as':'mandatoryDispositionPause'}]},_0x14ed32={},_0x5b5ec9={'count':0x0,'rows':[]};var _0x44854f=_[_0x20a1('0x3c')](db['FaxAccount'][_0x20a1('0x3d')],function(_0x55120d){return{'name':_0x55120d[_0x20a1('0x3e')],'type':_0x55120d['type']['key']};});_0x14ed32[_0x20a1('0x3f')]=_[_0x20a1('0x3c')](_0x44854f,_0x20a1('0x39'));_0x14ed32[_0x20a1('0x40')]=_['keys'](_0x3bd461[_0x20a1('0x40')]);_0x14ed32[_0x20a1('0x41')]=_['intersection'](_0x14ed32[_0x20a1('0x3f')],_0x14ed32[_0x20a1('0x40')]);_0x2cbdc6[_0x20a1('0x42')]=_[_0x20a1('0x43')](_0x14ed32[_0x20a1('0x3f')],qs['fields'](_0x3bd461[_0x20a1('0x40')][_0x20a1('0x44')]));_0x2cbdc6[_0x20a1('0x42')]=_0x2cbdc6['attributes'][_0x20a1('0x45')]?_0x2cbdc6[_0x20a1('0x42')]:_0x14ed32['model'];if(!_0x3bd461[_0x20a1('0x40')]['hasOwnProperty']('nolimit')){_0x2cbdc6['limit']=qs['limit'](_0x3bd461[_0x20a1('0x40')][_0x20a1('0x2e')]);_0x2cbdc6['offset']=qs['offset'](_0x3bd461['query'][_0x20a1('0x2d')]);}_0x2cbdc6[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0x3bd461['query'][_0x20a1('0x47')]);_0x2cbdc6[_0x20a1('0x48')]=qs[_0x20a1('0x41')](_[_0x20a1('0x49')](_0x3bd461[_0x20a1('0x40')],_0x14ed32['filters']),_0x44854f);if(_0x3bd461['query']['filter']){_0x2cbdc6[_0x20a1('0x48')]=_[_0x20a1('0x4a')](_0x2cbdc6['where'],{'$or':_[_0x20a1('0x3c')](_0x44854f,function(_0x10c805){if(_0x10c805[_0x20a1('0x4b')]!=='VIRTUAL'){var _0x2534ba={};_0x2534ba[_0x10c805['name']]={'$like':'%'+_0x3bd461[_0x20a1('0x40')][_0x20a1('0x4c')]+'%'};return _0x2534ba;}})});}_0x2cbdc6=_['merge']({},_0x2cbdc6,_0x3bd461[_0x20a1('0x4d')]);var _0x1c5c66={'where':_0x2cbdc6['where']};return db[_0x20a1('0x4e')][_0x20a1('0x2c')](_0x1c5c66)['then'](function(_0x1bfd89){_0x5b5ec9[_0x20a1('0x2c')]=_0x1bfd89;if(_0x3bd461[_0x20a1('0x40')]['includeAll']){_0x2cbdc6[_0x20a1('0x4f')]=[{'all':!![]}];}return db[_0x20a1('0x4e')][_0x20a1('0x50')](_0x2cbdc6);})['then'](function(_0x1d605c){_0x5b5ec9['rows']=_0x1d605c;return _0x5b5ec9;})[_0x20a1('0x33')](respondWithFilteredResult(_0x19e48c,_0x2cbdc6))[_0x20a1('0x51')](handleError(_0x19e48c,null));};exports[_0x20a1('0x52')]=function(_0x1e3e54,_0x19bb8d){var _0x2c2363={'raw':![],'where':{'id':_0x1e3e54['params']['id']},'include':[{'model':db[_0x20a1('0x3b')],'as':_0x20a1('0x53')}]},_0x3008ff={};_0x3008ff['model']=_[_0x20a1('0x54')](db['FaxAccount'][_0x20a1('0x3d')]);_0x3008ff[_0x20a1('0x40')]=_['keys'](_0x1e3e54[_0x20a1('0x40')]);_0x3008ff[_0x20a1('0x41')]=_[_0x20a1('0x43')](_0x3008ff[_0x20a1('0x3f')],_0x3008ff[_0x20a1('0x40')]);_0x2c2363[_0x20a1('0x42')]=_[_0x20a1('0x43')](_0x3008ff[_0x20a1('0x3f')],qs[_0x20a1('0x44')](_0x1e3e54['query'][_0x20a1('0x44')]));_0x2c2363[_0x20a1('0x42')]=_0x2c2363[_0x20a1('0x42')][_0x20a1('0x45')]?_0x2c2363['attributes']:_0x3008ff[_0x20a1('0x3f')];if(_0x1e3e54[_0x20a1('0x40')]['includeAll']){_0x2c2363[_0x20a1('0x4f')]=[{'all':!![]}];}_0x2c2363=_['merge']({},_0x2c2363,_0x1e3e54[_0x20a1('0x4d')]);return db[_0x20a1('0x4e')][_0x20a1('0x55')](_0x2c2363)[_0x20a1('0x33')](handleEntityNotFound(_0x19bb8d,null))[_0x20a1('0x33')](respondWithResult(_0x19bb8d,null))[_0x20a1('0x51')](handleError(_0x19bb8d,null));};exports[_0x20a1('0x56')]=function(_0x94b8f8,_0x39192f){return db[_0x20a1('0x4e')][_0x20a1('0x56')](_0x94b8f8['body'],{})[_0x20a1('0x33')](function(_0x4a12ac){var _0x1f4d9d=_0x94b8f8['user'][_0x20a1('0x35')]({'plain':!![]});if(!_0x1f4d9d)throw new Error(_0x20a1('0x57'));if(_0x1f4d9d[_0x20a1('0x58')]===_0x20a1('0x59')){var _0x2fb198=_0x4a12ac[_0x20a1('0x35')]({'plain':!![]});var _0x2ec8e9='FaxAccounts';return db[_0x20a1('0x5a')][_0x20a1('0x55')]({'where':{'name':_0x2ec8e9,'userProfileId':_0x1f4d9d['userProfileId']},'raw':!![]})[_0x20a1('0x33')](function(_0x1acbb7){if(_0x1acbb7&&_0x1acbb7[_0x20a1('0x5b')]===0x0){return db[_0x20a1('0x37')][_0x20a1('0x56')]({'name':_0x2fb198[_0x20a1('0x39')],'resourceId':_0x2fb198['id'],'type':_0x1acbb7[_0x20a1('0x39')],'sectionId':_0x1acbb7['id']},{})[_0x20a1('0x33')](function(){return _0x4a12ac;});}else{return _0x4a12ac;}})[_0x20a1('0x51')](function(_0x4eae72){logger[_0x20a1('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4eae72);throw _0x4eae72;});}return _0x4a12ac;})[_0x20a1('0x33')](respondWithResult(_0x39192f,0xc9))[_0x20a1('0x51')](handleError(_0x39192f,null));};exports[_0x20a1('0x5c')]=function(_0x1c3d8a,_0x5cfd42){if(_0x1c3d8a[_0x20a1('0x5d')]['id']){delete _0x1c3d8a[_0x20a1('0x5d')]['id'];}return db[_0x20a1('0x4e')][_0x20a1('0x55')]({'where':{'id':_0x1c3d8a[_0x20a1('0x5e')]['id']},'include':[{'model':db[_0x20a1('0x3b')],'as':_0x20a1('0x53')}]})[_0x20a1('0x33')](handleEntityNotFound(_0x5cfd42,null))[_0x20a1('0x33')](saveUpdates(_0x1c3d8a['body'],null))[_0x20a1('0x33')](respondWithResult(_0x5cfd42,null))[_0x20a1('0x51')](handleError(_0x5cfd42,null));};exports[_0x20a1('0x34')]=function(_0x1519a9,_0x56cc97){return db['FaxAccount'][_0x20a1('0x55')]({'where':{'id':_0x1519a9[_0x20a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x56cc97,null))[_0x20a1('0x33')](removeEntity(_0x56cc97,null))[_0x20a1('0x51')](handleError(_0x56cc97,null));};exports[_0x20a1('0x5f')]=function(_0x19650e,_0x19e57d){return db['FaxAccount']['describe']()[_0x20a1('0x33')](respondWithResult(_0x19e57d,null))[_0x20a1('0x51')](handleError(_0x19e57d,null));};exports[_0x20a1('0x60')]=function(_0x4cc007,_0x38b9a4,_0x35a87d){if(_0x4cc007[_0x20a1('0x5d')]['id']){delete _0x4cc007[_0x20a1('0x5d')]['id'];}return db[_0x20a1('0x4e')]['find']({'where':{'id':_0x4cc007[_0x20a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x38b9a4,null))['then'](function(_0x343dbc){if(_0x343dbc){_0x4cc007[_0x20a1('0x5d')]['FaxAccountId']=_0x343dbc['id'];return db[_0x20a1('0x61')][_0x20a1('0x56')](_0x4cc007[_0x20a1('0x5d')]);}})['then'](respondWithResult(_0x38b9a4,null))['catch'](handleError(_0x38b9a4,null));};exports[_0x20a1('0x62')]=function(_0x55e3f3,_0x4373fc,_0x775bb){var _0x260ef8={'raw':![],'where':{}};var _0x1deb8c={};var _0x2e19aa={'count':0x0,'rows':[]};return db['FaxAccount'][_0x20a1('0x63')]({'where':{'id':_0x55e3f3['params']['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x4373fc,null))[_0x20a1('0x33')](function(_0x4808d9){if(_0x4808d9){_0x1deb8c[_0x20a1('0x3f')]=_[_0x20a1('0x54')](db['Disposition'][_0x20a1('0x3d')]);_0x1deb8c[_0x20a1('0x40')]=_[_0x20a1('0x54')](_0x55e3f3['query']);_0x1deb8c[_0x20a1('0x41')]=_[_0x20a1('0x43')](_0x1deb8c['model'],_0x1deb8c[_0x20a1('0x40')]);_0x260ef8[_0x20a1('0x42')]=_[_0x20a1('0x43')](_0x1deb8c['model'],qs[_0x20a1('0x44')](_0x55e3f3['query'][_0x20a1('0x44')]));_0x260ef8[_0x20a1('0x42')]=_0x260ef8[_0x20a1('0x42')][_0x20a1('0x45')]?_0x260ef8[_0x20a1('0x42')]:_0x1deb8c[_0x20a1('0x3f')];if(!_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x64')](_0x20a1('0x65'))){_0x260ef8[_0x20a1('0x2e')]=qs[_0x20a1('0x2e')](_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x2e')]);_0x260ef8[_0x20a1('0x2d')]=qs[_0x20a1('0x2d')](_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x2d')]);}_0x260ef8[_0x20a1('0x46')]=qs['sort'](_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x47')]);_0x260ef8['where']=qs[_0x20a1('0x41')](_[_0x20a1('0x49')](_0x55e3f3['query'],_0x1deb8c[_0x20a1('0x41')]));_0x260ef8['where'][_0x20a1('0x66')]=_0x4808d9['id'];if(_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x4c')]){_0x260ef8[_0x20a1('0x48')]=_[_0x20a1('0x4a')](_0x260ef8[_0x20a1('0x48')],{'$or':_[_0x20a1('0x3c')](_0x260ef8[_0x20a1('0x42')],function(_0x22be58){var _0x2a7a73={};_0x2a7a73[_0x22be58]={'$like':'%'+_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x4c')]+'%'};return _0x2a7a73;})});}_0x260ef8=_[_0x20a1('0x4a')]({},_0x260ef8,_0x55e3f3[_0x20a1('0x4d')]);return db[_0x20a1('0x61')][_0x20a1('0x2c')]({'where':_0x260ef8[_0x20a1('0x48')]})[_0x20a1('0x33')](function(_0x4ee685){_0x2e19aa['count']=_0x4ee685;if(_0x55e3f3[_0x20a1('0x40')][_0x20a1('0x67')]){_0x260ef8['include']=[{'all':!![]}];}return db[_0x20a1('0x61')]['findAll'](_0x260ef8);})[_0x20a1('0x33')](function(_0x8cbe04){_0x2e19aa[_0x20a1('0x68')]=_0x8cbe04;return _0x2e19aa;});}})['then'](respondWithFilteredResult(_0x4373fc,_0x260ef8))['catch'](handleError(_0x4373fc,null));};exports[_0x20a1('0x69')]=function(_0x1fc28e,_0x180908,_0x3f4f79){return db[_0x20a1('0x4e')]['find']({'where':{'id':_0x1fc28e['params']['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x180908,null))[_0x20a1('0x33')](function(_0x3ec142){if(_0x3ec142){return _0x3ec142[_0x20a1('0x69')](_0x1fc28e[_0x20a1('0x40')][_0x20a1('0x6a')]);}})[_0x20a1('0x33')](respondWithStatusCode(_0x180908,null))[_0x20a1('0x51')](handleError(_0x180908,null));};exports[_0x20a1('0x6b')]=function(_0x5e1a15,_0x5a681d,_0x1d28b4){if(_0x5e1a15[_0x20a1('0x5d')]['id']){delete _0x5e1a15['body']['id'];}return db[_0x20a1('0x4e')][_0x20a1('0x55')]({'where':{'id':_0x5e1a15[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x5a681d,null))[_0x20a1('0x33')](function(_0x54e219){if(_0x54e219){_0x5e1a15[_0x20a1('0x5d')][_0x20a1('0x66')]=_0x54e219['id'];return db[_0x20a1('0x6c')][_0x20a1('0x56')](_0x5e1a15['body']);}})[_0x20a1('0x33')](respondWithResult(_0x5a681d,null))[_0x20a1('0x51')](handleError(_0x5a681d,null));};exports[_0x20a1('0x6d')]=function(_0xaec8fc,_0x3e72ae,_0x12f37a){var _0x33ba47={'raw':![],'where':{}};var _0x18d82a={};var _0x18d385={'count':0x0,'rows':[]};return db[_0x20a1('0x4e')][_0x20a1('0x63')]({'where':{'id':_0xaec8fc[_0x20a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3e72ae,null))['then'](function(_0x1e4627){if(_0x1e4627){_0x18d82a['model']=_[_0x20a1('0x54')](db['CannedAnswer']['rawAttributes']);_0x18d82a[_0x20a1('0x40')]=_['keys'](_0xaec8fc[_0x20a1('0x40')]);_0x18d82a[_0x20a1('0x41')]=_[_0x20a1('0x43')](_0x18d82a[_0x20a1('0x3f')],_0x18d82a[_0x20a1('0x40')]);_0x33ba47['attributes']=_[_0x20a1('0x43')](_0x18d82a[_0x20a1('0x3f')],qs[_0x20a1('0x44')](_0xaec8fc[_0x20a1('0x40')][_0x20a1('0x44')]));_0x33ba47[_0x20a1('0x42')]=_0x33ba47['attributes'][_0x20a1('0x45')]?_0x33ba47[_0x20a1('0x42')]:_0x18d82a['model'];if(!_0xaec8fc[_0x20a1('0x40')]['hasOwnProperty'](_0x20a1('0x65'))){_0x33ba47[_0x20a1('0x2e')]=qs['limit'](_0xaec8fc['query'][_0x20a1('0x2e')]);_0x33ba47[_0x20a1('0x2d')]=qs['offset'](_0xaec8fc[_0x20a1('0x40')][_0x20a1('0x2d')]);}_0x33ba47[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0xaec8fc[_0x20a1('0x40')][_0x20a1('0x47')]);_0x33ba47['where']=qs['filters'](_[_0x20a1('0x49')](_0xaec8fc[_0x20a1('0x40')],_0x18d82a[_0x20a1('0x41')]));_0x33ba47['where'][_0x20a1('0x66')]=_0x1e4627['id'];if(_0xaec8fc['query'][_0x20a1('0x4c')]){_0x33ba47['where']=_[_0x20a1('0x4a')](_0x33ba47[_0x20a1('0x48')],{'$or':_['map'](_0x33ba47[_0x20a1('0x42')],function(_0x5a9226){var _0x1f1239={};_0x1f1239[_0x5a9226]={'$like':'%'+_0xaec8fc['query'][_0x20a1('0x4c')]+'%'};return _0x1f1239;})});}_0x33ba47=_[_0x20a1('0x4a')]({},_0x33ba47,_0xaec8fc['options']);return db[_0x20a1('0x6c')]['count']({'where':_0x33ba47[_0x20a1('0x48')]})['then'](function(_0x4651c9){_0x18d385[_0x20a1('0x2c')]=_0x4651c9;if(_0xaec8fc[_0x20a1('0x40')][_0x20a1('0x67')]){_0x33ba47[_0x20a1('0x4f')]=[{'all':!![]}];}return db[_0x20a1('0x6c')]['findAll'](_0x33ba47);})['then'](function(_0x1e30a5){_0x18d385[_0x20a1('0x68')]=_0x1e30a5;return _0x18d385;});}})[_0x20a1('0x33')](respondWithFilteredResult(_0x3e72ae,_0x33ba47))[_0x20a1('0x51')](handleError(_0x3e72ae,null));};exports[_0x20a1('0x6e')]=function(_0x6a359,_0x11ae1f,_0x3a6d46){return db[_0x20a1('0x4e')][_0x20a1('0x55')]({'where':{'id':_0x6a359[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x11ae1f,null))[_0x20a1('0x33')](function(_0x2cc3c8){if(_0x2cc3c8){return _0x2cc3c8[_0x20a1('0x6e')](_0x6a359['query']['ids']);}})['then'](respondWithStatusCode(_0x11ae1f,null))['catch'](handleError(_0x11ae1f,null));};exports['addInteraction']=function(_0x111005,_0x26395a,_0x108edc){return db[_0x20a1('0x6f')]['find']({'where':{'id':_0x111005[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x26395a,null))[_0x20a1('0x33')](function(_0x2857fd){if(_0x2857fd){return _0x2857fd[_0x20a1('0x70')](_0x111005[_0x20a1('0x5d')][_0x20a1('0x6a')],_[_0x20a1('0x71')](_0x111005['body'],[_0x20a1('0x6a'),'id'])||{});}})[_0x20a1('0x33')](respondWithResult(_0x26395a,null))[_0x20a1('0x51')](handleError(_0x26395a,null));};exports[_0x20a1('0x72')]=function(_0xcea91c,_0x171078,_0x16512e){var _0x3b1a3f={'raw':![],'where':{}};var _0x10ce0d={};var _0x3981f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x20a1('0x63')]({'where':{'id':_0xcea91c[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x171078,null))[_0x20a1('0x33')](function(_0x4fed8f){if(_0x4fed8f){_0x10ce0d[_0x20a1('0x3f')]=_[_0x20a1('0x54')](db['FaxInteraction'][_0x20a1('0x3d')]);_0x10ce0d[_0x20a1('0x40')]=_[_0x20a1('0x54')](_0xcea91c['query']);_0x10ce0d[_0x20a1('0x41')]=_['intersection'](_0x10ce0d[_0x20a1('0x3f')],_0x10ce0d[_0x20a1('0x40')]);_0x3b1a3f[_0x20a1('0x42')]=_[_0x20a1('0x43')](_0x10ce0d['model'],qs[_0x20a1('0x44')](_0xcea91c[_0x20a1('0x40')][_0x20a1('0x44')]));_0x3b1a3f['attributes']=_0x3b1a3f[_0x20a1('0x42')]['length']?_0x3b1a3f[_0x20a1('0x42')]:_0x10ce0d[_0x20a1('0x3f')];if(!_0xcea91c[_0x20a1('0x40')][_0x20a1('0x64')]('nolimit')){_0x3b1a3f[_0x20a1('0x2e')]=qs[_0x20a1('0x2e')](_0xcea91c[_0x20a1('0x40')]['limit']);_0x3b1a3f['offset']=qs[_0x20a1('0x2d')](_0xcea91c[_0x20a1('0x40')][_0x20a1('0x2d')]);}_0x3b1a3f[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0xcea91c[_0x20a1('0x40')][_0x20a1('0x47')]);_0x3b1a3f[_0x20a1('0x48')]=qs[_0x20a1('0x41')](_[_0x20a1('0x49')](_0xcea91c[_0x20a1('0x40')],_0x10ce0d[_0x20a1('0x41')]));_0x3b1a3f[_0x20a1('0x48')]['FaxAccountId']=_0x4fed8f['id'];if(_0xcea91c['query'][_0x20a1('0x4c')]){_0x3b1a3f[_0x20a1('0x48')]=_['merge'](_0x3b1a3f['where'],{'$or':_['map'](_0x3b1a3f[_0x20a1('0x42')],function(_0x5ee552){var _0x3332f9={};_0x3332f9[_0x5ee552]={'$like':'%'+_0xcea91c[_0x20a1('0x40')][_0x20a1('0x4c')]+'%'};return _0x3332f9;})});}_0x3b1a3f=_[_0x20a1('0x4a')]({},_0x3b1a3f,_0xcea91c[_0x20a1('0x4d')]);return db[_0x20a1('0x6f')][_0x20a1('0x2c')]({'where':_0x3b1a3f[_0x20a1('0x48')]})[_0x20a1('0x33')](function(_0x4b5087){_0x3981f[_0x20a1('0x2c')]=_0x4b5087;if(_0xcea91c[_0x20a1('0x40')]['includeAll']){_0x3b1a3f[_0x20a1('0x4f')]=[{'model':db[_0x20a1('0x73')],'as':_0x20a1('0x74'),'required':![]},{'model':db[_0x20a1('0x75')],'as':'Owner','attributes':[_0x20a1('0x39'),_0x20a1('0x76'),_0x20a1('0x77')],'required':![]},{'model':db[_0x20a1('0x78')],'as':_0x20a1('0x79'),'attributes':['id','name',_0x20a1('0x7a')],'where':_0xcea91c[_0x20a1('0x40')][_0x20a1('0x7b')]?{'id':_0xcea91c[_0x20a1('0x40')]['tag']}:undefined,'required':_0xcea91c['query'][_0x20a1('0x7b')]?!![]:![]}];}return db[_0x20a1('0x6f')][_0x20a1('0x50')](_0x3b1a3f);})[_0x20a1('0x33')](function(_0x2fbf4a){_0x3981f['rows']=_0x2fbf4a;return _0x3981f;});}})[_0x20a1('0x33')](respondWithFilteredResult(_0x171078,_0x3b1a3f))[_0x20a1('0x51')](handleError(_0x171078,null));};exports[_0x20a1('0x7c')]=function(_0x45ec7c,_0x5eb264,_0x42006e){return db[_0x20a1('0x4e')]['findOne']({'where':{'id':_0x45ec7c[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x5eb264,null))[_0x20a1('0x33')](function(_0x45ccdd){if(_0x45ccdd){return db[_0x20a1('0x7d')]['transaction'](function(_0x14267c){return db[_0x20a1('0x7e')][_0x20a1('0x34')]({'where':{'FaxAccountId':_0x45ec7c[_0x20a1('0x5e')]['id']},'transaction':_0x14267c})[_0x20a1('0x33')](function(_0x19b868){var _0x1d15a1=_[_0x20a1('0x3c')](_0x45ec7c[_0x20a1('0x5d')],function(_0x3e025f){_0x3e025f['FaxAccountId']=_0x45ec7c[_0x20a1('0x5e')]['id'];return _0x3e025f;});return db[_0x20a1('0x7e')][_0x20a1('0x7f')](_0x1d15a1,{'transaction':_0x14267c});});})[_0x20a1('0x33')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x45ec7c[_0x20a1('0x5e')]['id']},'order':_0x20a1('0x80')});});}})[_0x20a1('0x33')](respondWithResult(_0x5eb264,null))[_0x20a1('0x51')](handleError(_0x5eb264,null));};exports[_0x20a1('0x81')]=function(_0x455b78,_0x35cc82,_0x1decf0){var _0x2314b7={};var _0x511671={};var _0x1a3bec;var _0x419439;return db[_0x20a1('0x4e')][_0x20a1('0x63')]({'where':{'id':_0x455b78[_0x20a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x35cc82,null))[_0x20a1('0x33')](function(_0x345ded){if(_0x345ded){_0x1a3bec=_0x345ded;_0x511671[_0x20a1('0x3f')]=_[_0x20a1('0x54')](db[_0x20a1('0x7e')]['rawAttributes']);_0x511671[_0x20a1('0x40')]=_[_0x20a1('0x54')](_0x455b78[_0x20a1('0x40')]);_0x511671[_0x20a1('0x41')]=_['intersection'](_0x511671['model'],_0x511671['query']);_0x2314b7['attributes']=_['intersection'](_0x511671[_0x20a1('0x3f')],qs[_0x20a1('0x44')](_0x455b78['query']['fields']));_0x2314b7[_0x20a1('0x42')]=_0x2314b7[_0x20a1('0x42')][_0x20a1('0x45')]?_0x2314b7[_0x20a1('0x42')]:_0x511671[_0x20a1('0x3f')];_0x2314b7[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0x455b78[_0x20a1('0x40')][_0x20a1('0x47')]);_0x2314b7[_0x20a1('0x48')]=qs[_0x20a1('0x41')](_[_0x20a1('0x49')](_0x455b78['query'],_0x511671[_0x20a1('0x41')]));if(_0x455b78[_0x20a1('0x40')]['filter']){_0x2314b7[_0x20a1('0x48')]=_['merge'](_0x2314b7[_0x20a1('0x48')],{'$or':_[_0x20a1('0x3c')](_0x2314b7[_0x20a1('0x42')],function(_0x1da856){var _0x1c62d3={};_0x1c62d3[_0x1da856]={'$like':'%'+_0x455b78['query'][_0x20a1('0x4c')]+'%'};return _0x1c62d3;})});}_0x2314b7=_['merge']({},_0x2314b7,_0x455b78[_0x20a1('0x4d')]);return _0x1a3bec['getApplications'](_0x2314b7);}})[_0x20a1('0x33')](function(_0x35f7da){if(_0x35f7da){_0x419439=_0x35f7da[_0x20a1('0x45')];if(!_0x455b78[_0x20a1('0x40')][_0x20a1('0x64')](_0x20a1('0x65'))){_0x2314b7[_0x20a1('0x2e')]=qs[_0x20a1('0x2e')](_0x455b78[_0x20a1('0x40')][_0x20a1('0x2e')]);_0x2314b7[_0x20a1('0x2d')]=qs[_0x20a1('0x2d')](_0x455b78[_0x20a1('0x40')]['offset']);}return _0x1a3bec[_0x20a1('0x81')](_0x2314b7);}})[_0x20a1('0x33')](function(_0xda7c94){if(_0xda7c94){return _0xda7c94?{'count':_0x419439,'rows':_0xda7c94}:null;}})[_0x20a1('0x33')](respondWithResult(_0x35cc82,null))[_0x20a1('0x51')](handleError(_0x35cc82,null));};function Extension(_0x49c169,_0x12c42a,_0x4b2c34,_0x2597be){this[_0x20a1('0x82')]=_0x20a1('0x83');this['exten']=_0x49c169[_0x20a1('0x84')];this[_0x20a1('0x85')]=_0x2597be;this[_0x20a1('0x4b')]=_0x20a1('0x86');this[_0x20a1('0x87')]=_0x20a1('0x88');this[_0x20a1('0x66')]=_0x49c169['id'];this[_0x20a1('0x80')]=_0x12c42a;this[_0x20a1('0x89')]=_0x4b2c34;}function createExtensionsReciveFax(_0x488268){var _0x448ea3=0x1;var _0x4fdc56=[];_0x4fdc56[_0x20a1('0x8a')](new Extension(_0x488268,_0x448ea3,'',_0x20a1('0x8b')));_0x448ea3+=0x1;_0x4fdc56[_0x20a1('0x8a')](new Extension(_0x488268,_0x448ea3,_0x20a1('0x8c'),'Set'));_0x448ea3+=0x1;for(var _0x3a720e in _0x488268){if(_0x488268[_0x20a1('0x64')](_0x3a720e)&&(_0x3a720e===_0x20a1('0x8d')||_0x3a720e===_0x20a1('0x84')||_0x3a720e==='gateway'||_0x3a720e===_0x20a1('0x8e')||_0x3a720e===_0x20a1('0x8f')||_0x3a720e===_0x20a1('0x90')||_0x3a720e===_0x20a1('0x91')||_0x3a720e===_0x20a1('0x92')||_0x3a720e===_0x20a1('0x93'))){_0x4fdc56[_0x20a1('0x8a')](new Extension(_0x488268,_0x448ea3,'FAXOPT('+_0x3a720e+')='+_0x488268[_0x3a720e],_0x20a1('0x94')));_0x448ea3+=0x1;}}_0x4fdc56[_0x20a1('0x8a')](new Extension(_0x488268,_0x448ea3,'6',_0x20a1('0x95')));_0x448ea3+=0x1;_0x4fdc56[_0x20a1('0x8a')](new Extension(_0x488268,_0x448ea3,_0x20a1('0x96'),_0x20a1('0x97')));_0x448ea3=0x0;return _0x4fdc56;}exports[_0x20a1('0x98')]=function(_0x31d551,_0x256479,_0x338cb5){var _0x48b013;return db[_0x20a1('0x7d')][_0x20a1('0x99')](function(_0x296eb4){return db['FaxAccount'][_0x20a1('0x56')](_0x31d551[_0x20a1('0x5d')],{'transaction':_0x296eb4})[_0x20a1('0x33')](function(_0x1bd164){_0x48b013=_0x1bd164[_0x20a1('0x35')]({'plain':!![]});return db[_0x20a1('0x9a')][_0x20a1('0x7f')](createExtensionsReciveFax(_0x48b013),{'transaction':_0x296eb4});});})[_0x20a1('0x33')](function(){return _0x48b013;})['then'](respondWithResult(_0x256479,null))['catch'](handleError(_0x256479,null));};exports[_0x20a1('0x9b')]=function(_0x11838d,_0x17e412,_0x38f270){var _0x40c4f6;return db[_0x20a1('0x7d')][_0x20a1('0x99')](function(_0x15935b){return db[_0x20a1('0x4e')][_0x20a1('0x5c')](_0x11838d['body'],{'where':{'id':_0x11838d['body']['id']},'transaction':_0x15935b})[_0x20a1('0x33')](function(_0xcdbf00){return db[_0x20a1('0x9a')][_0x20a1('0x34')]({'where':{'FaxAccountId':_0x11838d[_0x20a1('0x5d')]['id']},'transaction':_0x15935b})[_0x20a1('0x33')](function(_0x4cd0d0){return db[_0x20a1('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x20a1('0x71')](_0x11838d[_0x20a1('0x5d')],[_0x20a1('0x9c'),_0x20a1('0x9d'),'createdAt',_0x20a1('0x9e'),'TrunkId','ListId'])),{'transaction':_0x15935b});});});})[_0x20a1('0x33')](function(){return db[_0x20a1('0x4e')]['findById'](_0x11838d[_0x20a1('0x5d')]['id']);})[_0x20a1('0x33')](respondWithResult(_0x17e412,null))[_0x20a1('0x51')](handleError(_0x17e412,null));};exports[_0x20a1('0x9f')]=function(_0x2a92c2,_0x5deaba,_0xf5680c){var _0x7a4e8={'raw':!![],'where':{}};var _0x2fce9a={};var _0xf1eedf={'count':0x0,'rows':[]};return db[_0x20a1('0x4e')][_0x20a1('0x63')]({'where':{'id':_0x2a92c2[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x5deaba,null))[_0x20a1('0x33')](function(_0xb8abd2){if(_0xb8abd2){_0x2fce9a['model']=_[_0x20a1('0x54')](db[_0x20a1('0xa0')][_0x20a1('0x3d')]);_0x2fce9a['query']=_[_0x20a1('0x54')](_0x2a92c2['query']);_0x2fce9a[_0x20a1('0x41')]=_[_0x20a1('0x43')](_0x2fce9a['model'],_0x2fce9a[_0x20a1('0x40')]);_0x7a4e8[_0x20a1('0x42')]=_['intersection'](_0x2fce9a['model'],qs[_0x20a1('0x44')](_0x2a92c2['query'][_0x20a1('0x44')]));_0x7a4e8[_0x20a1('0x42')]=_0x7a4e8['attributes'][_0x20a1('0x45')]?_0x7a4e8[_0x20a1('0x42')]:_0x2fce9a[_0x20a1('0x3f')];if(!_0x2a92c2[_0x20a1('0x40')][_0x20a1('0x64')](_0x20a1('0x65'))){_0x7a4e8[_0x20a1('0x2e')]=qs[_0x20a1('0x2e')](_0x2a92c2['query'][_0x20a1('0x2e')]);_0x7a4e8['offset']=qs['offset'](_0x2a92c2['query'][_0x20a1('0x2d')]);}_0x7a4e8[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0x2a92c2[_0x20a1('0x40')][_0x20a1('0x47')]);_0x7a4e8[_0x20a1('0x48')]=qs['filters'](_['pick'](_0x2a92c2['query'],_0x2fce9a[_0x20a1('0x41')]));_0x7a4e8[_0x20a1('0x48')][_0x20a1('0x66')]=_0xb8abd2['id'];if(_0x2a92c2[_0x20a1('0x40')][_0x20a1('0x4c')]){_0x7a4e8['where']=_[_0x20a1('0x4a')](_0x7a4e8[_0x20a1('0x48')],{'$or':_[_0x20a1('0x3c')](_0x7a4e8[_0x20a1('0x42')],function(_0x5d3b33){var _0x47acf7={};_0x47acf7[_0x5d3b33]={'$like':'%'+_0x2a92c2[_0x20a1('0x40')]['filter']+'%'};return _0x47acf7;})});}if(_0x2a92c2[_0x20a1('0x40')]['$gte']){var _0xf92875=_0x2a92c2[_0x20a1('0x40')][_0x20a1('0xa1')]['split'](',');var _0x1c3b47={};_0x1c3b47[_0xf92875[0x0]]={'$gte':moment(_0xf92875[0x1])[_0x20a1('0xa2')](_0x20a1('0xa3'))};_0x7a4e8[_0x20a1('0x48')]=_[_0x20a1('0x4a')](_0x7a4e8[_0x20a1('0x48')],_0x1c3b47);}_0x7a4e8=_['merge']({},_0x7a4e8,_0x2a92c2[_0x20a1('0x4d')]);return db[_0x20a1('0xa0')][_0x20a1('0x2c')]({'where':_0x7a4e8['where']})['then'](function(_0x3d9d69){_0xf1eedf[_0x20a1('0x2c')]=_0x3d9d69;if(_0x2a92c2['query'][_0x20a1('0x67')]){_0x7a4e8['include']=[{'all':!![]}];}return db['FaxMessage'][_0x20a1('0x50')](_0x7a4e8);})[_0x20a1('0x33')](function(_0x5d6faa){_0xf1eedf[_0x20a1('0x68')]=_0x5d6faa;return _0xf1eedf;});}})[_0x20a1('0x33')](respondWithFilteredResult(_0x5deaba,_0x7a4e8))[_0x20a1('0x51')](handleError(_0x5deaba,null));};exports[_0x20a1('0xa4')]=function(_0x36465f,_0x4d674e,_0x4f397b){var _0x535d01,_0x488b7e={},_0x3f7083;if(_0x36465f[_0x20a1('0x5d')]['to']){_0x3f7083=_0x36465f[_0x20a1('0x5d')]['to'][0x0];}return db[_0x20a1('0x4e')][_0x20a1('0x55')]({'where':{'id':_0x36465f[_0x20a1('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x20a1('0xa5'),'include':[{'model':db[_0x20a1('0x73')],'as':'Contacts','where':{'fax':_0x3f7083},'limit':0x1,'order':[[_0x20a1('0x9e'),_0x20a1('0xa6')]]}]}]})[_0x20a1('0x33')](handleEntityNotFound(_0x4d674e,null))[_0x20a1('0x33')](function(_0x5c9c56){_0x535d01=_0x5c9c56;if(_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')]&&_0x36465f[_0x20a1('0x5d')]['attachments']['length']){for(var _0x17c842=0x0;_0x17c842<_0x36465f['body'][_0x20a1('0xa7')]['length'];_0x17c842+=0x1){_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][_0x17c842]={'filename':_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][_0x17c842][_0x20a1('0x39')],'id':_0x36465f[_0x20a1('0x5d')]['attachments'][_0x17c842]['id'],'path':path['join'](config[_0x20a1('0xa8')],_0x20a1('0xa9'),_0x36465f[_0x20a1('0x5d')]['attachments'][_0x17c842][_0x20a1('0xaa')])};}}return respondWithRpcPromise(_0x20a1('0xab'),_0x20a1('0xab'),{'FaxAccountId':_[_0x20a1('0xac')](_0x36465f[_0x20a1('0x5e')]['id'])?undefined:_0x36465f['params']['id'],'path':_[_0x20a1('0xac')](_0x36465f[_0x20a1('0x5d')]['attachments'][0x0]['path'])?undefined:_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][0x0][_0x20a1('0x5')],'fax':_[_0x20a1('0xac')](_0x36465f['body']['to'][0x0])?undefined:_0x36465f['body']['to'][0x0]},client9002);})[_0x20a1('0x33')](function(){if(_0x535d01){if(_['isNil'](_0x36465f[_0x20a1('0x5d')]['from'])){_0x36465f[_0x20a1('0x5d')][_0x20a1('0xad')]=util[_0x20a1('0xa2')](_0x20a1('0xae'),_0x535d01[_0x20a1('0x39')],_0x535d01['fax']);}if(_0x535d01[_0x20a1('0xa5')]){if(_0x535d01[_0x20a1('0xa5')][_0x20a1('0xaf')]['length']){return _0x535d01[_0x20a1('0xa5')]['Contacts'][0x0];}else{return db[_0x20a1('0x73')][_0x20a1('0x56')](_['defaults'](_0x36465f['body'],{'firstName':_0x36465f[_0x20a1('0x5d')]['to'][0x0],'phone':_0x36465f[_0x20a1('0x5d')]['to'][0x0],'fax':_0x36465f[_0x20a1('0x5d')]['to'][0x0],'ListId':_0x535d01[_0x20a1('0xb0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x5c32aa){if(_0x5c32aa){return db['FaxInteraction'][_0x20a1('0x55')]({'where':{'ContactId':_0x5c32aa['id'],'closed':![],'FaxAccountId':_0x535d01['id']}})['then'](function(_0x378ba3){if(_0x378ba3){return[_0x378ba3,![]];}return db['FaxInteraction'][_0x20a1('0x56')]({'UserId':_0x36465f[_0x20a1('0x59')]['id'],'ContactId':_0x5c32aa['id'],'FaxAccountId':_0x535d01['id'],'fax':_0x36465f['body']['to'][0x0],'firstMsgDirection':_0x20a1('0xb1'),'Messages':[_[_0x20a1('0x4a')](_0x36465f[_0x20a1('0x5d')],{'read':![],'body':_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][0x0]['filename'],'FaxAccountId':_0x535d01['id'],'UserId':_0x36465f['user']['id'],'ContactId':_0x5c32aa['id'],'AttachmentId':_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x20a1('0xa0')],'as':_0x20a1('0xb2')}]})['then'](function(_0x2e10a8){return[_0x2e10a8,!![]];});});}else{throw new Error(_0x20a1('0xb3'));}})['spread'](function(_0x4b9ef6,_0x2db115){if(_0x2db115){return _0x4b9ef6;}return db[_0x20a1('0xa0')][_0x20a1('0x56')]({'direction':_0x20a1('0xb1'),'read':![],'body':_0x36465f[_0x20a1('0x5d')]['attachments'][0x0][_0x20a1('0xb4')],'FaxAccountId':_0x535d01['id'],'FaxInteractionId':_0x4b9ef6['id'],'UserId':_0x36465f['user']['id'],'ContactId':_0x4b9ef6[_0x20a1('0xb5')],'AttachmentId':_0x36465f['body']['attachments'][0x0]['id']})[_0x20a1('0x33')](function(_0x419f2d){_0x4b9ef6[_0x20a1('0xb6')]['Messages']=[];_0x4b9ef6[_0x20a1('0xb6')]['Messages'][_0x20a1('0x8a')](_0x419f2d[_0x20a1('0xb6')]);return _0x4b9ef6;});})[_0x20a1('0x33')](function(_0x39080f){respondWithRpcPromise(_0x20a1('0xb7'),_0x20a1('0xb7'),{'FaxAccountId':_[_0x20a1('0xac')](_0x36465f['params']['id'])?undefined:_0x36465f['params']['id'],'path':_[_0x20a1('0xac')](_0x36465f[_0x20a1('0x5d')][_0x20a1('0xa7')][0x0]['path'])?undefined:_0x36465f[_0x20a1('0x5d')]['attachments'][0x0][_0x20a1('0x5')],'fax':_[_0x20a1('0xac')](_0x36465f[_0x20a1('0x5d')]['to'][0x0])?undefined:_0x36465f[_0x20a1('0x5d')]['to'][0x0],'AttachmentId':_0x36465f[_0x20a1('0x5d')]['attachments'][0x0]['id']},client9002)[_0x20a1('0x33')](function(_0x21bc9e){logger[_0x20a1('0x27')](_0x20a1('0xb8'),_0x21bc9e);})[_0x20a1('0x51')](function(_0xed2d1a){logger[_0x20a1('0x27')](_0x20a1('0xb8'),_0xed2d1a);});return _0x39080f;})[_0x20a1('0x33')](respondWithResult(_0x4d674e,null))[_0x20a1('0x51')](handleError(_0x4d674e,null));};exports['addAgents']=function(_0x510ffe,_0x1f9ebf,_0x5b0de2){return db['FaxAccount'][_0x20a1('0x55')]({'where':{'id':_0x510ffe[_0x20a1('0x5e')]['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x1f9ebf,null))['then'](function(_0x43de4d){if(_0x43de4d){return _0x43de4d[_0x20a1('0xb9')](_0x510ffe[_0x20a1('0x5d')][_0x20a1('0x6a')],_['omit'](_0x510ffe[_0x20a1('0x5d')],[_0x20a1('0x6a'),'id'])||{})[_0x20a1('0xba')](function(_0x3f0299){for(var _0x109117=0x0;_0x109117<_0x510ffe['body'][_0x20a1('0x6a')]['length'];_0x109117+=0x1){socket[_0x20a1('0xbb')](_0x20a1('0xbc'),{'UserId':_0x510ffe['body'][_0x20a1('0x6a')][_0x109117],'FaxAccountId':_0x510ffe['params']['id']});}return _0x3f0299;});}})[_0x20a1('0x33')](respondWithResult(_0x1f9ebf,null))[_0x20a1('0x51')](handleError(_0x1f9ebf,null));};exports[_0x20a1('0xbd')]=function(_0x35df74,_0x40a6e,_0x279245){return db[_0x20a1('0x4e')]['find']({'where':{'id':_0x35df74['params']['id']}})[_0x20a1('0x33')](handleEntityNotFound(_0x40a6e,null))[_0x20a1('0x33')](function(_0x126288){if(_0x126288){return _0x126288[_0x20a1('0xbd')](_0x35df74[_0x20a1('0x40')][_0x20a1('0x6a')])[_0x20a1('0x33')](function(){if(_[_0x20a1('0xbe')](_0x35df74[_0x20a1('0x40')][_0x20a1('0x6a')])){for(var _0x43b666=0x0;_0x43b666<_0x35df74['query']['ids'][_0x20a1('0x45')];_0x43b666+=0x1){socket[_0x20a1('0xbb')](_0x20a1('0xbf'),{'UserId':Number(_0x35df74[_0x20a1('0x40')]['ids'][_0x43b666]),'FaxAccountId':Number(_0x35df74['params']['id'])});}}else{socket[_0x20a1('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x35df74[_0x20a1('0x40')]['ids']),'FaxAccountId':Number(_0x35df74[_0x20a1('0x5e')]['id'])});}});}})[_0x20a1('0x33')](respondWithStatusCode(_0x40a6e,null))[_0x20a1('0x51')](handleError(_0x40a6e,null));};exports['getAgents']=function(_0xf583d1,_0x3d7ece,_0x4eea08){var _0x2c4342={};var _0x4a8a89={};var _0x1c7625;var _0x1b2c28;return db[_0x20a1('0x4e')][_0x20a1('0x63')]({'where':{'id':_0xf583d1[_0x20a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3d7ece,null))[_0x20a1('0x33')](function(_0x995913){if(_0x995913){_0x1c7625=_0x995913;_0x4a8a89[_0x20a1('0x3f')]=_['keys'](db['User'][_0x20a1('0x3d')]);_0x4a8a89['query']=_[_0x20a1('0x54')](_0xf583d1[_0x20a1('0x40')]);_0x4a8a89[_0x20a1('0x41')]=_[_0x20a1('0x43')](_0x4a8a89['model'],_0x4a8a89['query']);_0x2c4342[_0x20a1('0x42')]=_['intersection'](_0x4a8a89[_0x20a1('0x3f')],qs[_0x20a1('0x44')](_0xf583d1[_0x20a1('0x40')][_0x20a1('0x44')]));_0x2c4342['attributes']=_0x2c4342[_0x20a1('0x42')]['length']?_0x2c4342[_0x20a1('0x42')]:_0x4a8a89[_0x20a1('0x3f')];_0x2c4342[_0x20a1('0x46')]=qs[_0x20a1('0x47')](_0xf583d1['query'][_0x20a1('0x47')]);_0x2c4342['where']=qs[_0x20a1('0x41')](_[_0x20a1('0x49')](_0xf583d1[_0x20a1('0x40')],_0x4a8a89[_0x20a1('0x41')]));if(_0xf583d1[_0x20a1('0x40')][_0x20a1('0x4c')]){_0x2c4342[_0x20a1('0x48')]=_[_0x20a1('0x4a')](_0x2c4342[_0x20a1('0x48')],{'$or':_[_0x20a1('0x3c')](_0x2c4342['attributes'],function(_0xd3207c){var _0x4961a5={};_0x4961a5[_0xd3207c]={'$like':'%'+_0xf583d1['query'][_0x20a1('0x4c')]+'%'};return _0x4961a5;})});}_0x2c4342=_[_0x20a1('0x4a')]({},_0x2c4342,_0xf583d1[_0x20a1('0x4d')]);return _0x1c7625[_0x20a1('0xc0')](_0x2c4342);}})[_0x20a1('0x33')](function(_0x393362){if(_0x393362){_0x1b2c28=_0x393362[_0x20a1('0x45')];if(!_0xf583d1['query'][_0x20a1('0x64')](_0x20a1('0x65'))){_0x2c4342[_0x20a1('0x2e')]=qs[_0x20a1('0x2e')](_0xf583d1[_0x20a1('0x40')]['limit']);_0x2c4342['offset']=qs[_0x20a1('0x2d')](_0xf583d1[_0x20a1('0x40')][_0x20a1('0x2d')]);}return _0x1c7625['getAgents'](_0x2c4342);}})['then'](function(_0x85f3e8){if(_0x85f3e8){return _0x85f3e8?{'count':_0x1b2c28,'rows':_0x85f3e8}:null;}})[_0x20a1('0x33')](respondWithResult(_0x3d7ece,null))['catch'](handleError(_0x3d7ece,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7287623..d34bb59 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 _0xc3a3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xc3a3,0x73));var _0x3c3a=function(_0x222bff,_0x4d0130){_0x222bff=_0x222bff-0x0;var _0x36d631=_0xc3a3[_0x222bff];return _0x36d631;};'use strict';var EventEmitter=require(_0x3c3a('0x0'));var FaxAccount=require(_0x3c3a('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3c3a('0x2')](0x0);var events={'afterCreate':_0x3c3a('0x3'),'afterUpdate':_0x3c3a('0x4'),'afterDestroy':_0x3c3a('0x5')};function emitEvent(_0x156059){return function(_0x3850d8,_0x59435d,_0x40e5e6){FaxAccountEvents[_0x3c3a('0x6')](_0x156059+':'+_0x3850d8['id'],_0x3850d8);FaxAccountEvents[_0x3c3a('0x6')](_0x156059,_0x3850d8);_0x40e5e6(null);};}for(var e in events){if(events[_0x3c3a('0x7')](e)){var event=events[e];FaxAccount[_0x3c3a('0x8')](e,emitEvent(event));}}module[_0x3c3a('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xd564=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xd564,0x19b));var _0x4d56=function(_0xc2fc1e,_0x58da70){_0xc2fc1e=_0xc2fc1e-0x0;var _0x3f45e4=_0xd564[_0xc2fc1e];return _0x3f45e4;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x4d56('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4d56('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d56('0x2'),'afterDestroy':_0x4d56('0x3')};function emitEvent(_0x5312a5){return function(_0x557923,_0x250917,_0x3783dd){FaxAccountEvents['emit'](_0x5312a5+':'+_0x557923['id'],_0x557923);FaxAccountEvents[_0x4d56('0x4')](_0x5312a5,_0x557923);_0x3783dd(null);};}for(var e in events){if(events[_0x4d56('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x4d56('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2a7abf8..fe2a51c 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 _0xdb24=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0x25e42c,_0x548d5a){var _0x2aa0c7=function(_0x2b5ec0){while(--_0x2b5ec0){_0x25e42c['push'](_0x25e42c['shift']());}};_0x2aa0c7(++_0x548d5a);}(_0xdb24,0x1ec));var _0x4db2=function(_0x5e897e,_0x2a6acb){_0x5e897e=_0x5e897e-0x0;var _0x5078b8=_0xdb24[_0x5e897e];return _0x5078b8;};'use strict';var _=require(_0x4db2('0x0'));var util=require(_0x4db2('0x1'));var logger=require(_0x4db2('0x2'))('api');var moment=require(_0x4db2('0x3'));var BPromise=require(_0x4db2('0x4'));var rp=require(_0x4db2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4db2('0x6'));var config=require(_0x4db2('0x7'));var attributes=require(_0x4db2('0x8'));module[_0x4db2('0x9')]=function(_0x2ae701,_0x169493){return _0x2ae701['define'](_0x4db2('0xa'),attributes,{'tableName':_0x4db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdcf=['api','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','fax_accounts','util'];(function(_0x2b2dd1,_0x2c6ac7){var _0x5d2ef5=function(_0xacc039){while(--_0xacc039){_0x2b2dd1['push'](_0x2b2dd1['shift']());}};_0x5d2ef5(++_0x2c6ac7);}(_0xbdcf,0x170));var _0xfbdc=function(_0x6f47be,_0x20ae0b){_0x6f47be=_0x6f47be-0x0;var _0x2f4585=_0xbdcf[_0x6f47be];return _0x2f4585;};'use strict';var _=require('lodash');var util=require(_0xfbdc('0x0'));var logger=require('../../config/logger')(_0xfbdc('0x1'));var moment=require('moment');var BPromise=require(_0xfbdc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbdc('0x3'));var rimraf=require(_0xfbdc('0x4'));var config=require(_0xfbdc('0x5'));var attributes=require(_0xfbdc('0x6'));module[_0xfbdc('0x7')]=function(_0xfb26d2,_0x1a7731){return _0xfb26d2['define']('FaxAccount',attributes,{'tableName':_0xfbdc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 169fbfa..e4677ed 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 _0x0a97=['describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','orderBy','priority','asc','length','from','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','FaxAccount','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','fax','CmContact'];(function(_0x46cd02,_0x1acf7b){var _0x332301=function(_0x2fb74e){while(--_0x2fb74e){_0x46cd02['push'](_0x46cd02['shift']());}};_0x332301(++_0x1acf7b);}(_0x0a97,0x88));var _0x70a9=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0a97[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x70a9('0x0'));var moment=require(_0x70a9('0x1'));var BPromise=require(_0x70a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x70a9('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x70a9('0x5'));var client=jayson[_0x70a9('0x6')]['http']({'port':0x232c});config[_0x70a9('0x7')]=_[_0x70a9('0x8')](config[_0x70a9('0x7')],{'host':_0x70a9('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70a9('0x7')]));require(_0x70a9('0xa'))[_0x70a9('0xb')](socket);function respondWithRpcPromise(_0x2c04dd,_0x1c2fec,_0x454a8a){return new BPromise(function(_0x358196,_0x395bc0){return client['request'](_0x2c04dd,_0x454a8a)[_0x70a9('0xc')](function(_0x218f11){logger['info'](_0x70a9('0xd'),_0x1c2fec,_0x70a9('0xe'));logger[_0x70a9('0xf')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1c2fec,_0x70a9('0xe'),JSON[_0x70a9('0x10')](_0x218f11));if(_0x218f11['error']){if(_0x218f11[_0x70a9('0x11')][_0x70a9('0x12')]===0x1f4){logger[_0x70a9('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1c2fec,_0x218f11[_0x70a9('0x11')]['message']);return _0x395bc0(_0x218f11[_0x70a9('0x11')][_0x70a9('0x13')]);}logger[_0x70a9('0x11')](_0x70a9('0xd'),_0x1c2fec,_0x218f11[_0x70a9('0x11')][_0x70a9('0x13')]);return _0x358196(_0x218f11[_0x70a9('0x11')][_0x70a9('0x13')]);}else{logger[_0x70a9('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1c2fec,'request\x20sent');_0x358196(_0x218f11[_0x70a9('0x15')][_0x70a9('0x13')]);}})['catch'](function(_0x321bd0){logger[_0x70a9('0x11')](_0x70a9('0xd'),_0x1c2fec,_0x321bd0);_0x395bc0(_0x321bd0);});});}exports['GetFaxAccount']=function(_0x191a71){var _0x4cce5a=this;return new Promise(function(_0x1d1038,_0x28961b){return db[_0x70a9('0x16')]['findAll']({'raw':_0x191a71[_0x70a9('0x17')]?_0x191a71[_0x70a9('0x17')][_0x70a9('0x18')]===undefined?!![]:![]:!![],'where':_0x191a71['options']?_0x191a71[_0x70a9('0x17')][_0x70a9('0x19')]||null:null,'attributes':_0x191a71[_0x70a9('0x17')]?_0x191a71[_0x70a9('0x17')][_0x70a9('0x1a')]||null:null,'limit':_0x191a71[_0x70a9('0x17')]?_0x191a71[_0x70a9('0x17')][_0x70a9('0x1b')]||null:null,'include':_0x191a71[_0x70a9('0x17')]?_0x191a71[_0x70a9('0x17')][_0x70a9('0x1c')]?_[_0x70a9('0x1d')](_0x191a71[_0x70a9('0x17')][_0x70a9('0x1c')],function(_0x410dc9){return{'model':db[_0x410dc9['model']],'as':_0x410dc9['as'],'attributes':_0x410dc9['attributes'],'include':_0x410dc9[_0x70a9('0x1c')]?_[_0x70a9('0x1d')](_0x410dc9['include'],function(_0xcea6e7){return{'model':db[_0xcea6e7[_0x70a9('0x1e')]],'as':_0xcea6e7['as'],'attributes':_0xcea6e7[_0x70a9('0x1a')],'include':_0xcea6e7['include']?_[_0x70a9('0x1d')](_0xcea6e7['include'],function(_0x13cc33){return{'model':db[_0x13cc33[_0x70a9('0x1e')]],'as':_0x13cc33['as'],'attributes':_0x13cc33[_0x70a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x70a9('0xc')](function(_0x4652c9){logger[_0x70a9('0x14')](_0x70a9('0x1f'),_0x191a71);logger[_0x70a9('0xf')]('GetFaxAccount',_0x191a71,JSON[_0x70a9('0x10')](_0x4652c9));_0x1d1038(_0x4652c9);})[_0x70a9('0x20')](function(_0x33c712){logger[_0x70a9('0x11')](_0x70a9('0x1f'),_0x33c712['message'],_0x191a71);_0x28961b(_0x4cce5a[_0x70a9('0x11')](0x1f4,_0x33c712[_0x70a9('0x13')]));});});};exports[_0x70a9('0x21')]=function(_0xda0c7b,_0x5f399c,_0x5604bf){var _0x455998=this;return new Promise(function(_0x421751,_0x1440d2){var _0x540e85={'body':_0xda0c7b['body'],'channel':_0x70a9('0x22')};var _0x13e7dd=[];var _0x419f42=[];var _0x618b42={};return db[_0x70a9('0x23')][_0x70a9('0x24')]()[_0x70a9('0xc')](function(_0x221027){if(!_0x221027){throw new db[(_0x70a9('0x25'))][(_0x70a9('0x26'))](_0x70a9('0x27'));}_0x13e7dd=_[_0x70a9('0x28')](_[_0x70a9('0x29')](_0x221027),[_0x70a9('0x2a'),'updatedAt']);_0x419f42=_['difference'](_[_0x70a9('0x29')](_0x221027),[_0x70a9('0x2a'),_0x70a9('0x2b'),'CompanyId',_0x70a9('0x2c')]);if(_0xda0c7b[_0x70a9('0x2d')]['id']){delete _0xda0c7b['body']['id'];}if(_[_0x70a9('0x2e')](_0xda0c7b[_0x70a9('0x2d')]['from'])){throw new db[(_0x70a9('0x25'))]['ValidationError'](_0x70a9('0x2f'));}if(_[_0x70a9('0x2e')](_0xda0c7b[_0x70a9('0x2d')][_0x70a9('0x2d')])||_0xda0c7b[_0x70a9('0x2d')]['body']===''){throw new db[(_0x70a9('0x25'))]['ValidationError'](_0x70a9('0x30'));}if(_[_0x70a9('0x2e')](_0xda0c7b[_0x70a9('0x2d')][_0x70a9('0x31')])){throw new db['Sequelize'][(_0x70a9('0x26'))](_0x70a9('0x32')+_0x419f42);}if(!_[_0x70a9('0x33')](_0x419f42,_0xda0c7b[_0x70a9('0x2d')][_0x70a9('0x31')])){throw new db['Sequelize']['ValidationError'](_0x70a9('0x34')+_0x419f42);}_0x618b42[_0xda0c7b[_0x70a9('0x2d')]['mapKey']]=_0xda0c7b[_0x70a9('0x2d')]['from'];})[_0x70a9('0xc')](function(){return db['FaxAccount'][_0x70a9('0x35')]({'where':{'id':_0xda0c7b[_0x70a9('0x36')]['id']},'include':[{'model':db[_0x70a9('0x37')],'as':_0x70a9('0x38'),'include':[{'model':db[_0x70a9('0x23')],'as':_0x70a9('0x39'),'where':_0x618b42,'limit':0x1,'order':[[_0x70a9('0x2b'),_0x70a9('0x3a')]]}]},{'model':db[_0x70a9('0x3b')],'as':_0x70a9('0x3c')}]});})['then'](function(_0x44bcd2){if(_0x44bcd2&&_0x44bcd2[_0x70a9('0x38')]){var _0x1d9f5f=_0x44bcd2['get']({'plain':!![]});_0x540e85[_0x70a9('0x36')]=_0x1d9f5f;_0x540e85['applications']=_0x1d9f5f[_0x70a9('0x3c')];_0x540e85['list']=_0x1d9f5f['List'];_0x540e85[_0x70a9('0x3d')]=_[_0x70a9('0x3e')](_0x540e85[_0x70a9('0x3d')],[_0x70a9('0x3f')],[_0x70a9('0x40')]);if(_0x540e85[_0x70a9('0x36')][_0x70a9('0x3c')]){delete _0x540e85['account'][_0x70a9('0x3c')];}if(_0x540e85[_0x70a9('0x36')]['List']&&_0x540e85['account'][_0x70a9('0x38')]['Contacts'][_0x70a9('0x41')]){return _0x540e85[_0x70a9('0x36')][_0x70a9('0x38')][_0x70a9('0x39')][0x0];}var _0x4f0185=_['defaults'](_0xda0c7b[_0x70a9('0x2d')],{'firstName':_0xda0c7b[_0x70a9('0x2d')][_0x70a9('0x42')],'ListId':_0x1d9f5f['ListId']});_0x4f0185[_0xda0c7b[_0x70a9('0x2d')][_0x70a9('0x31')]]=_0xda0c7b['body'][_0x70a9('0x42')];return db[_0x70a9('0x23')][_0x70a9('0x43')](_0x4f0185,{'fields':_0x13e7dd,'raw':!![]});}})[_0x70a9('0xc')](function(_0x107422){_0x540e85[_0x70a9('0x44')]=_0x107422;if(_0x107422){var _0x117521={'ContactId':_0x107422['id'],'FaxAccountId':_0xda0c7b[_0x70a9('0x36')]['id'],'fax':_0x107422[_0x70a9('0x22')]};return db[_0x70a9('0x45')]['find']({'where':{'ContactId':_0x107422['id'],'closed':![],'FaxAccountId':_0xda0c7b[_0x70a9('0x36')]['id']}})['then'](function(_0x2109cd){if(_0x2109cd){return[_0x2109cd,![]];}return db[_0x70a9('0x45')]['create'](_0x117521)['then'](function(_0xb0357f){return[_0xb0357f,!![]];});});}else{throw new Error(_0x70a9('0x46'));}})[_0x70a9('0x47')](function(_0x4ecad5,_0x3a9d1d){var _0x415143=_0x4ecad5['get']({'plain':!![]});if(_0x3a9d1d){if(_0x540e85[_0x70a9('0x36')]['autoclose']){_0x540e85['applications'][_0x70a9('0x48')]({'id':0x0,'priority':_0x540e85[_0x70a9('0x3d')][_0x70a9('0x41')]+0x1,'app':'close','appdata':_0x70a9('0x49'),'interval':_0x70a9('0x4a')});}_0x415143[_0x70a9('0x4b')]=!![];}else{_0x415143[_0x70a9('0x4b')]=![];}_0x540e85[_0x70a9('0x4c')]=_0x415143;return db[_0x70a9('0x4d')][_0x70a9('0x43')]({'body':_0xda0c7b[_0x70a9('0x2d')]['body'],'FaxAccountId':_0xda0c7b['account']['id'],'FaxInteractionId':_0x4ecad5['id'],'direction':'in','ContactId':_0x4ecad5['ContactId'],'AttachmentId':_0xda0c7b['body'][_0x70a9('0x4e')]});})['then'](function(_0xd310df){_0x540e85[_0x70a9('0x13')]=_0xd310df;if(_0x540e85[_0x70a9('0x4c')][_0x70a9('0x4f')]){return db[_0x70a9('0x50')][_0x70a9('0x35')]({'attributes':['id',_0x70a9('0x51')],'where':{'id':_0x540e85['interaction']['UserId']}})[_0x70a9('0xc')](function(_0x289154){if(_0x289154){_0x540e85[_0x70a9('0x3d')][_0x70a9('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x289154['name']+','+(_0x540e85[_0x70a9('0x36')][_0x70a9('0x53')]||0xa),'interval':_0x70a9('0x4a')});}return respondWithRpcPromise(_0x70a9('0x54'),_0x70a9('0x55'),_0x540e85);});}return respondWithRpcPromise('Start',_0x70a9('0x55'),_0x540e85);})[_0x70a9('0xc')](function(_0x431943){_0x421751(_0x431943);})[_0x70a9('0x20')](function(_0x1cdde2){_0x1440d2(_0x455998[_0x70a9('0x11')](0x1f4,_0x1cdde2[_0x70a9('0x13')]));});});}; \ No newline at end of file +var _0xcecd=['then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','Applications','List','account','list','applications','orderBy','priority','asc','length','ListId','create','FaxInteraction','find','get','autoclose','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request'];(function(_0x37daf1,_0x1bdf1e){var _0x3884ec=function(_0x2cafcd){while(--_0x2cafcd){_0x37daf1['push'](_0x37daf1['shift']());}};_0x3884ec(++_0x1bdf1e);}(_0xcecd,0x1ae));var _0xdcec=function(_0x2619b6,_0x3b0ded){_0x2619b6=_0x2619b6-0x0;var _0x26d3b0=_0xcecd[_0x2619b6];return _0x26d3b0;};'use strict';var _=require(_0xdcec('0x0'));var util=require(_0xdcec('0x1'));var moment=require(_0xdcec('0x2'));var BPromise=require(_0xdcec('0x3'));var rs=require(_0xdcec('0x4'));var fs=require('fs');var Redis=require(_0xdcec('0x5'));var db=require(_0xdcec('0x6'))['db'];var utils=require(_0xdcec('0x7'));var logger=require(_0xdcec('0x8'))(_0xdcec('0x9'));var config=require(_0xdcec('0xa'));var jayson=require(_0xdcec('0xb'));var client=jayson[_0xdcec('0xc')][_0xdcec('0xd')]({'port':0x232c});config['redis']=_[_0xdcec('0xe')](config[_0xdcec('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xdcec('0x10'))(new Redis(config[_0xdcec('0xf')]));require(_0xdcec('0x11'))[_0xdcec('0x12')](socket);function respondWithRpcPromise(_0x4f1aad,_0xe23cdf,_0x4b3641){return new BPromise(function(_0x15d745,_0x339d69){return client[_0xdcec('0x13')](_0x4f1aad,_0x4b3641)[_0xdcec('0x14')](function(_0x203c2f){logger[_0xdcec('0x15')]('FaxAccount,\x20%s,\x20%s',_0xe23cdf,'request\x20sent');logger['debug'](_0xdcec('0x16'),_0xe23cdf,_0xdcec('0x17'),JSON[_0xdcec('0x18')](_0x203c2f));if(_0x203c2f[_0xdcec('0x19')]){if(_0x203c2f[_0xdcec('0x19')][_0xdcec('0x1a')]===0x1f4){logger[_0xdcec('0x19')]('FaxAccount,\x20%s,\x20%s',_0xe23cdf,_0x203c2f[_0xdcec('0x19')][_0xdcec('0x1b')]);return _0x339d69(_0x203c2f[_0xdcec('0x19')][_0xdcec('0x1b')]);}logger[_0xdcec('0x19')](_0xdcec('0x1c'),_0xe23cdf,_0x203c2f[_0xdcec('0x19')][_0xdcec('0x1b')]);return _0x15d745(_0x203c2f[_0xdcec('0x19')][_0xdcec('0x1b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0xe23cdf,_0xdcec('0x17'));_0x15d745(_0x203c2f['result'][_0xdcec('0x1b')]);}})[_0xdcec('0x1d')](function(_0x419c1c){logger[_0xdcec('0x19')](_0xdcec('0x1c'),_0xe23cdf,_0x419c1c);_0x339d69(_0x419c1c);});});}exports[_0xdcec('0x1e')]=function(_0x2893b8){var _0x337bae=this;return new Promise(function(_0x40f6b8,_0xc5411a){return db[_0xdcec('0x1f')][_0xdcec('0x20')]({'raw':_0x2893b8[_0xdcec('0x21')]?_0x2893b8[_0xdcec('0x21')][_0xdcec('0x22')]===undefined?!![]:![]:!![],'where':_0x2893b8[_0xdcec('0x21')]?_0x2893b8[_0xdcec('0x21')][_0xdcec('0x23')]||null:null,'attributes':_0x2893b8['options']?_0x2893b8[_0xdcec('0x21')][_0xdcec('0x24')]||null:null,'limit':_0x2893b8['options']?_0x2893b8[_0xdcec('0x21')][_0xdcec('0x25')]||null:null,'include':_0x2893b8['options']?_0x2893b8[_0xdcec('0x21')][_0xdcec('0x26')]?_[_0xdcec('0x27')](_0x2893b8[_0xdcec('0x21')][_0xdcec('0x26')],function(_0x3d9ef8){return{'model':db[_0x3d9ef8[_0xdcec('0x28')]],'as':_0x3d9ef8['as'],'attributes':_0x3d9ef8[_0xdcec('0x24')],'include':_0x3d9ef8['include']?_[_0xdcec('0x27')](_0x3d9ef8[_0xdcec('0x26')],function(_0x2e2266){return{'model':db[_0x2e2266[_0xdcec('0x28')]],'as':_0x2e2266['as'],'attributes':_0x2e2266[_0xdcec('0x24')],'include':_0x2e2266[_0xdcec('0x26')]?_[_0xdcec('0x27')](_0x2e2266['include'],function(_0x514abb){return{'model':db[_0x514abb[_0xdcec('0x28')]],'as':_0x514abb['as'],'attributes':_0x514abb[_0xdcec('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x421443){logger['info'](_0xdcec('0x1e'),_0x2893b8);logger[_0xdcec('0x29')](_0xdcec('0x1e'),_0x2893b8,JSON['stringify'](_0x421443));_0x40f6b8(_0x421443);})[_0xdcec('0x1d')](function(_0x2ec713){logger[_0xdcec('0x19')](_0xdcec('0x1e'),_0x2ec713[_0xdcec('0x1b')],_0x2893b8);_0xc5411a(_0x337bae[_0xdcec('0x19')](0x1f4,_0x2ec713['message']));});});};exports[_0xdcec('0x2a')]=function(_0x5eda58,_0x4cd821,_0x2a1e63){var _0xd0d631=this;return new Promise(function(_0x773309,_0x2db4af){var _0x4a1a5f={'body':_0x5eda58[_0xdcec('0x2b')],'channel':_0xdcec('0x2c')};var _0x5cebc4=[];var _0xe67a01=[];var _0xccab91={};return db[_0xdcec('0x2d')][_0xdcec('0x2e')]()[_0xdcec('0x14')](function(_0xc93c55){if(!_0xc93c55){throw new db[(_0xdcec('0x2f'))][(_0xdcec('0x30'))](_0xdcec('0x31'));}_0x5cebc4=_[_0xdcec('0x32')](_[_0xdcec('0x33')](_0xc93c55),[_0xdcec('0x34'),_0xdcec('0x35')]);_0xe67a01=_[_0xdcec('0x32')](_['keys'](_0xc93c55),[_0xdcec('0x34'),_0xdcec('0x35'),_0xdcec('0x36'),'ListId']);if(_0x5eda58[_0xdcec('0x2b')]['id']){delete _0x5eda58[_0xdcec('0x2b')]['id'];}if(_[_0xdcec('0x37')](_0x5eda58[_0xdcec('0x2b')]['from'])){throw new db[(_0xdcec('0x2f'))][(_0xdcec('0x30'))](_0xdcec('0x38'));}if(_[_0xdcec('0x37')](_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x2b')])||_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x2b')]===''){throw new db[(_0xdcec('0x2f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5eda58['body'][_0xdcec('0x39')])){throw new db['Sequelize'][(_0xdcec('0x30'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe67a01);}if(!_[_0xdcec('0x3a')](_0xe67a01,_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x39')])){throw new db[(_0xdcec('0x2f'))][(_0xdcec('0x30'))](_0xdcec('0x3b')+_0xe67a01);}_0xccab91[_0x5eda58['body'][_0xdcec('0x39')]]=_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x3c')];})[_0xdcec('0x14')](function(){return db[_0xdcec('0x1f')]['find']({'where':{'id':_0x5eda58['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xdcec('0x2d')],'as':_0xdcec('0x3d'),'where':_0xccab91,'limit':0x1,'order':[[_0xdcec('0x35'),_0xdcec('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0xdcec('0x3f')}]});})[_0xdcec('0x14')](function(_0x1174d8){if(_0x1174d8&&_0x1174d8[_0xdcec('0x40')]){var _0x442d59=_0x1174d8['get']({'plain':!![]});_0x4a1a5f[_0xdcec('0x41')]=_0x442d59;_0x4a1a5f['applications']=_0x442d59[_0xdcec('0x3f')];_0x4a1a5f[_0xdcec('0x42')]=_0x442d59['List'];_0x4a1a5f[_0xdcec('0x43')]=_[_0xdcec('0x44')](_0x4a1a5f[_0xdcec('0x43')],[_0xdcec('0x45')],[_0xdcec('0x46')]);if(_0x4a1a5f['account'][_0xdcec('0x3f')]){delete _0x4a1a5f[_0xdcec('0x41')]['Applications'];}if(_0x4a1a5f[_0xdcec('0x41')]['List']&&_0x4a1a5f[_0xdcec('0x41')]['List']['Contacts'][_0xdcec('0x47')]){return _0x4a1a5f[_0xdcec('0x41')]['List'][_0xdcec('0x3d')][0x0];}var _0x3abdce=_[_0xdcec('0xe')](_0x5eda58['body'],{'firstName':_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x3c')],'ListId':_0x442d59[_0xdcec('0x48')]});_0x3abdce[_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x39')]]=_0x5eda58[_0xdcec('0x2b')][_0xdcec('0x3c')];return db[_0xdcec('0x2d')][_0xdcec('0x49')](_0x3abdce,{'fields':_0x5cebc4,'raw':!![]});}})[_0xdcec('0x14')](function(_0x477bfb){_0x4a1a5f['contact']=_0x477bfb;if(_0x477bfb){var _0x183f84={'ContactId':_0x477bfb['id'],'FaxAccountId':_0x5eda58[_0xdcec('0x41')]['id'],'fax':_0x477bfb[_0xdcec('0x2c')]};return db[_0xdcec('0x4a')][_0xdcec('0x4b')]({'where':{'ContactId':_0x477bfb['id'],'closed':![],'FaxAccountId':_0x5eda58[_0xdcec('0x41')]['id']}})[_0xdcec('0x14')](function(_0x4c50e8){if(_0x4c50e8){return[_0x4c50e8,![]];}return db['FaxInteraction'][_0xdcec('0x49')](_0x183f84)[_0xdcec('0x14')](function(_0x23a6e0){return[_0x23a6e0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4703ee,_0x25735a){var _0x595f66=_0x4703ee[_0xdcec('0x4c')]({'plain':!![]});if(_0x25735a){if(_0x4a1a5f['account'][_0xdcec('0x4d')]){_0x4a1a5f[_0xdcec('0x43')]['push']({'id':0x0,'priority':_0x4a1a5f[_0xdcec('0x43')][_0xdcec('0x47')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xdcec('0x4e')});}_0x595f66[_0xdcec('0x4f')]=!![];}else{_0x595f66[_0xdcec('0x4f')]=![];}_0x4a1a5f['interaction']=_0x595f66;return db[_0xdcec('0x50')][_0xdcec('0x49')]({'body':_0x5eda58[_0xdcec('0x2b')]['body'],'FaxAccountId':_0x5eda58[_0xdcec('0x41')]['id'],'FaxInteractionId':_0x4703ee['id'],'direction':'in','ContactId':_0x4703ee[_0xdcec('0x51')],'AttachmentId':_0x5eda58[_0xdcec('0x2b')]['AttachmentId']});})[_0xdcec('0x14')](function(_0x7abafe){_0x4a1a5f['message']=_0x7abafe;if(_0x4a1a5f[_0xdcec('0x52')][_0xdcec('0x53')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x4a1a5f[_0xdcec('0x52')][_0xdcec('0x53')]}})[_0xdcec('0x14')](function(_0x41634b){if(_0x41634b){_0x4a1a5f[_0xdcec('0x43')][_0xdcec('0x54')]({'id':0x0,'priority':0x0,'app':_0xdcec('0x55'),'appdata':_0x41634b[_0xdcec('0x56')]+','+(_0x4a1a5f[_0xdcec('0x41')][_0xdcec('0x57')]||0xa),'interval':_0xdcec('0x4e')});}return respondWithRpcPromise(_0xdcec('0x58'),_0xdcec('0x59'),_0x4a1a5f);});}return respondWithRpcPromise(_0xdcec('0x58'),_0xdcec('0x59'),_0x4a1a5f);})[_0xdcec('0x14')](function(_0x108912){_0x773309(_0x108912);})[_0xdcec('0x1d')](function(_0x1d42cd){_0x2db4af(_0xd0d631[_0xdcec('0x19')](0x1f4,_0x1d42cd[_0xdcec('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index edc2abe..014e824 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 _0x7278=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7278,0x161));var _0x8727=function(_0x5dee53,_0x12fd12){_0x5dee53=_0x5dee53-0x0;var _0x432dff=_0x7278[_0x5dee53];return _0x432dff;};'use strict';var FaxAccountEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){FaxAccountEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);FaxAccountEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file +var _0xb016=['register','./faxAccount.events','save','emit'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0xb016,0x159));var _0x6b01=function(_0x196489,_0x59e73e){_0x196489=_0x196489-0x0;var _0x4dedeb=_0xb016[_0x196489];return _0x4dedeb;};'use strict';var FaxAccountEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){FaxAccountEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('faxAccount:'+_0x374aab,_0x65407a);FaxAccountEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d4a2bf7..eabed71 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 _0x2ca9=['put','update','delete','/:id','removeDispositions','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','isAuthenticated','describe','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','/:id/interactions','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users'];(function(_0x320d2d,_0x4a4121){var _0xc1af89=function(_0x210f19){while(--_0x210f19){_0x320d2d['push'](_0x320d2d['shift']());}};_0xc1af89(++_0x4a4121);}(_0x2ca9,0x10a));var _0x92ca=function(_0x330a0,_0xef878a){_0x330a0=_0x330a0-0x0;var _0x1ee3a0=_0x2ca9[_0x330a0];return _0x1ee3a0;};'use strict';var multer=require(_0x92ca('0x0'));var util=require(_0x92ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x92ca('0x2')]();var auth=require(_0x92ca('0x3'));var interaction=require(_0x92ca('0x4'));var config=require(_0x92ca('0x5'));var controller=require(_0x92ca('0x6'));router[_0x92ca('0x7')]('/',auth['isAuthenticated'](),controller[_0x92ca('0x8')]);router[_0x92ca('0x7')]('/describe',auth[_0x92ca('0x9')](),controller[_0x92ca('0xa')]);router[_0x92ca('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x92ca('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x92ca('0xb'),auth[_0x92ca('0x9')](),controller[_0x92ca('0xc')]);router['get']('/:id/interactions',auth[_0x92ca('0x9')](),controller['getInteractions']);router[_0x92ca('0x7')](_0x92ca('0xd'),auth[_0x92ca('0x9')](),controller[_0x92ca('0xe')]);router['get'](_0x92ca('0xf'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x10')]);router[_0x92ca('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x92ca('0x11')]);router[_0x92ca('0x12')]('/',auth[_0x92ca('0x9')](),controller[_0x92ca('0x13')]);router[_0x92ca('0x12')](_0x92ca('0x14'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x15')]);router[_0x92ca('0x12')](_0x92ca('0xb'),auth[_0x92ca('0x9')](),controller['addAnswer']);router['post'](_0x92ca('0x16'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x17')]);router[_0x92ca('0x12')](_0x92ca('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x92ca('0x12')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x92ca('0x18')]);router[_0x92ca('0x12')](_0x92ca('0x19'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x1a')]);router['post'](_0x92ca('0x1b'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x1c')]);router[_0x92ca('0x12')](_0x92ca('0x1d'),auth['isAuthenticated'](),controller['addAgents']);router[_0x92ca('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x92ca('0x1f')]);router[_0x92ca('0x20')](_0x92ca('0x21'),auth[_0x92ca('0x9')](),controller['destroy']);router[_0x92ca('0x20')](_0x92ca('0x14'),auth[_0x92ca('0x9')](),controller[_0x92ca('0x22')]);router['delete'](_0x92ca('0xb'),auth[_0x92ca('0x9')](),controller['removeAnswers']);router[_0x92ca('0x20')](_0x92ca('0x1d'),auth['isAuthenticated'](),controller[_0x92ca('0x23')]);module[_0x92ca('0x24')]=router; \ No newline at end of file +var _0x6ba5=['../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','/:id/applications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','update','/:id','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b5a48,_0x511c36){var _0x54390b=function(_0x2b275b){while(--_0x2b275b){_0x2b5a48['push'](_0x2b5a48['shift']());}};_0x54390b(++_0x511c36);}(_0x6ba5,0x139));var _0x56ba=function(_0x3a1a1d,_0x39767f){_0x3a1a1d=_0x3a1a1d-0x0;var _0x188668=_0x6ba5[_0x3a1a1d];return _0x188668;};'use strict';var multer=require(_0x56ba('0x0'));var util=require(_0x56ba('0x1'));var path=require(_0x56ba('0x2'));var timeout=require(_0x56ba('0x3'));var express=require('express');var router=express[_0x56ba('0x4')]();var auth=require(_0x56ba('0x5'));var interaction=require(_0x56ba('0x6'));var config=require(_0x56ba('0x7'));var controller=require(_0x56ba('0x8'));router[_0x56ba('0x9')]('/',auth[_0x56ba('0xa')](),controller[_0x56ba('0xb')]);router['get'](_0x56ba('0xc'),auth[_0x56ba('0xa')](),controller['describe']);router[_0x56ba('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x56ba('0xd')]);router[_0x56ba('0x9')](_0x56ba('0xe'),auth[_0x56ba('0xa')](),controller[_0x56ba('0xf')]);router[_0x56ba('0x9')](_0x56ba('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x56ba('0x9')](_0x56ba('0x11'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x12')]);router[_0x56ba('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x56ba('0x9')](_0x56ba('0x13'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x14')]);router[_0x56ba('0x9')](_0x56ba('0x15'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x16')]);router[_0x56ba('0x17')]('/',auth[_0x56ba('0xa')](),controller['create']);router['post'](_0x56ba('0xe'),auth['isAuthenticated'](),controller[_0x56ba('0x18')]);router[_0x56ba('0x17')](_0x56ba('0x10'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x19')]);router['post']('/:id/interactions',auth[_0x56ba('0xa')](),controller[_0x56ba('0x1a')]);router[_0x56ba('0x17')](_0x56ba('0x1b'),auth['isAuthenticated'](),controller['addApplications']);router[_0x56ba('0x17')](_0x56ba('0x1c'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x1d')]);router[_0x56ba('0x17')](_0x56ba('0x1e'),auth['isAuthenticated'](),controller[_0x56ba('0x1f')]);router['post'](_0x56ba('0x20'),auth[_0x56ba('0xa')](),controller['send']);router[_0x56ba('0x17')](_0x56ba('0x15'),auth[_0x56ba('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x56ba('0xa')](),controller[_0x56ba('0x21')]);router['delete'](_0x56ba('0x22'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x23')]);router[_0x56ba('0x24')](_0x56ba('0xe'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x25')]);router[_0x56ba('0x24')](_0x56ba('0x10'),auth[_0x56ba('0xa')](),controller['removeAnswers']);router[_0x56ba('0x24')](_0x56ba('0x15'),auth[_0x56ba('0xa')](),controller[_0x56ba('0x26')]);module[_0x56ba('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5752e0d..c1f4721 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 _0x9ab8=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1e5a59,_0x22d345){var _0x4ca834=function(_0x2b2968){while(--_0x2b2968){_0x1e5a59['push'](_0x1e5a59['shift']());}};_0x4ca834(++_0x22d345);}(_0x9ab8,0x81));var _0x89ab=function(_0x34264c,_0x26ea6e){_0x34264c=_0x34264c-0x0;var _0x1508b3=_0x9ab8[_0x34264c];return _0x1508b3;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'priority':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x89ab('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x89ab('0x4')],'defaultValue':_0x89ab('0x5')}}; \ No newline at end of file +var _0x1cdb=['noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x4782d8,_0x5aa9c8){var _0x1f4d70=function(_0x4398c3){while(--_0x4398c3){_0x4782d8['push'](_0x4782d8['shift']());}};_0x1f4d70(++_0x5aa9c8);}(_0x1cdb,0x117));var _0xb1cd=function(_0x354e83,_0x3893cb){_0x354e83=_0x354e83-0x0;var _0x6f22e8=_0x1cdb[_0x354e83];return _0x6f22e8;};'use strict';var Sequelize=require('sequelize');module[_0xb1cd('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb1cd('0x1')},'appdata':{'type':Sequelize[_0xb1cd('0x2')]()},'description':{'type':Sequelize[_0xb1cd('0x3')]},'interval':{'type':Sequelize[_0xb1cd('0x3')],'defaultValue':_0xb1cd('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index b0367b7..3c6a306 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 _0xdab4=['apply','save','then','destroy','end','error','stack','name','status','send','index','FaxApplication','rawAttributes','fieldName','type','model','map','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','intersection','length','include','find','create','body','update','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','count','offset','limit','set'];(function(_0x232cbf,_0x3e2f33){var _0x1cd460=function(_0x29b4f3){while(--_0x29b4f3){_0x232cbf['push'](_0x232cbf['shift']());}};_0x1cd460(++_0x3e2f33);}(_0xdab4,0x104));var _0x4dab=function(_0x124e27,_0x12ba6c){_0x124e27=_0x124e27-0x0;var _0x4d48fa=_0xdab4[_0x124e27];return _0x4d48fa;};'use strict';var pdf=require(_0x4dab('0x0'));var emlformat=require(_0x4dab('0x1'));var rimraf=require(_0x4dab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4dab('0x3'));var moment=require(_0x4dab('0x4'));var BPromise=require(_0x4dab('0x5'));var Mustache=require('mustache');var util=require(_0x4dab('0x6'));var path=require('path');var sox=require(_0x4dab('0x7'));var csv=require(_0x4dab('0x8'));var ejs=require(_0x4dab('0x9'));var fs=require('fs');var _=require(_0x4dab('0xa'));var squel=require(_0x4dab('0xb'));var crypto=require('crypto');var jsforce=require(_0x4dab('0xc'));var deskjs=require(_0x4dab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4dab('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4dab('0xf'));var as=require(_0x4dab('0x10'));var hardwareService=require(_0x4dab('0x11'));var logger=require(_0x4dab('0x12'))(_0x4dab('0x13'));var utils=require(_0x4dab('0x14'));var config=require(_0x4dab('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5228ac,_0x2f2caa){_0x2f2caa=_0x2f2caa||0xcc;return function(_0xb7e50c){if(_0xb7e50c){return _0x5228ac[_0x4dab('0x16')](_0x2f2caa);}return _0x5228ac['status'](_0x2f2caa)['end']();};}function respondWithResult(_0x3b43cc,_0x2fb77a){_0x2fb77a=_0x2fb77a||0xc8;return function(_0x530c50){if(_0x530c50){return _0x3b43cc['status'](_0x2fb77a)[_0x4dab('0x17')](_0x530c50);}};}function respondWithFilteredResult(_0x463443,_0x2604d4){return function(_0x183ec3){if(_0x183ec3){var _0x60edc2=_0x183ec3[_0x4dab('0x18')],_0x3a9040=_0x2604d4[_0x4dab('0x19')],_0x40b79d=_0x2604d4[_0x4dab('0x19')]+_0x2604d4[_0x4dab('0x1a')],_0x430a28;if(_0x40b79d>=_0x60edc2){_0x40b79d=_0x60edc2;_0x430a28=0xc8;}else{_0x430a28=0xce;}_0x463443['status'](_0x430a28);return _0x463443[_0x4dab('0x1b')]('Content-Range',_0x3a9040+'-'+_0x40b79d+'/'+_0x60edc2)[_0x4dab('0x17')](_0x183ec3);}return null;};}function patchUpdates(_0x45ded3){return function(_0x484a38){try{jsonpatch[_0x4dab('0x1c')](_0x484a38,_0x45ded3,!![]);}catch(_0x3dbdd6){return BPromise['reject'](_0x3dbdd6);}return _0x484a38[_0x4dab('0x1d')]();};}function saveUpdates(_0x2a4d63,_0x386e01){return function(_0x2d6a98){if(_0x2d6a98){return _0x2d6a98['update'](_0x2a4d63)[_0x4dab('0x1e')](function(_0x348815){return _0x348815;});}return null;};}function removeEntity(_0x416dba,_0x123cdc){return function(_0x42a513){if(_0x42a513){return _0x42a513[_0x4dab('0x1f')]()[_0x4dab('0x1e')](function(){_0x416dba['status'](0xcc)[_0x4dab('0x20')]();});}};}function handleEntityNotFound(_0x55c1ea,_0x4c6fe2){return function(_0x128f06){if(!_0x128f06){_0x55c1ea[_0x4dab('0x16')](0x194);}return _0x128f06;};}function handleError(_0xecef4e,_0xfcea73){_0xfcea73=_0xfcea73||0x1f4;return function(_0x1d864d){logger[_0x4dab('0x21')](_0x1d864d[_0x4dab('0x22')]);if(_0x1d864d[_0x4dab('0x23')]){delete _0x1d864d[_0x4dab('0x23')];}_0xecef4e[_0x4dab('0x24')](_0xfcea73)[_0x4dab('0x25')](_0x1d864d);};}exports[_0x4dab('0x26')]=function(_0x5611dc,_0x1e0a62){var _0x107ed8={},_0x73d9dc={},_0x29a3d6={'count':0x0,'rows':[]};var _0x2d7c5e=_['map'](db[_0x4dab('0x27')][_0x4dab('0x28')],function(_0xa2cfa2){return{'name':_0xa2cfa2[_0x4dab('0x29')],'type':_0xa2cfa2[_0x4dab('0x2a')]['key']};});_0x73d9dc[_0x4dab('0x2b')]=_[_0x4dab('0x2c')](_0x2d7c5e,'name');_0x73d9dc['query']=_[_0x4dab('0x2d')](_0x5611dc['query']);_0x73d9dc['filters']=_['intersection'](_0x73d9dc[_0x4dab('0x2b')],_0x73d9dc[_0x4dab('0x2e')]);_0x107ed8[_0x4dab('0x2f')]=_['intersection'](_0x73d9dc[_0x4dab('0x2b')],qs[_0x4dab('0x30')](_0x5611dc['query'][_0x4dab('0x30')]));_0x107ed8[_0x4dab('0x2f')]=_0x107ed8[_0x4dab('0x2f')]['length']?_0x107ed8[_0x4dab('0x2f')]:_0x73d9dc['model'];if(!_0x5611dc['query'][_0x4dab('0x31')](_0x4dab('0x32'))){_0x107ed8[_0x4dab('0x1a')]=qs[_0x4dab('0x1a')](_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x1a')]);_0x107ed8[_0x4dab('0x19')]=qs[_0x4dab('0x19')](_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x19')]);}_0x107ed8[_0x4dab('0x33')]=qs[_0x4dab('0x34')](_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x34')]);_0x107ed8[_0x4dab('0x35')]=qs[_0x4dab('0x36')](_[_0x4dab('0x37')](_0x5611dc[_0x4dab('0x2e')],_0x73d9dc[_0x4dab('0x36')]),_0x2d7c5e);if(_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x38')]){_0x107ed8[_0x4dab('0x35')]=_[_0x4dab('0x39')](_0x107ed8[_0x4dab('0x35')],{'$or':_['map'](_0x2d7c5e,function(_0x2a835b){if(_0x2a835b[_0x4dab('0x2a')]!==_0x4dab('0x3a')){var _0xe0a2f8={};_0xe0a2f8[_0x2a835b[_0x4dab('0x23')]]={'$like':'%'+_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x38')]+'%'};return _0xe0a2f8;}})});}_0x107ed8=_['merge']({},_0x107ed8,_0x5611dc[_0x4dab('0x3b')]);var _0x4eb8cc={'where':_0x107ed8[_0x4dab('0x35')]};return db[_0x4dab('0x27')]['count'](_0x4eb8cc)[_0x4dab('0x1e')](function(_0x155dc0){_0x29a3d6[_0x4dab('0x18')]=_0x155dc0;if(_0x5611dc[_0x4dab('0x2e')][_0x4dab('0x3c')]){_0x107ed8['include']=[{'all':!![]}];}return db[_0x4dab('0x27')]['findAll'](_0x107ed8);})['then'](function(_0x27f329){_0x29a3d6[_0x4dab('0x3d')]=_0x27f329;return _0x29a3d6;})[_0x4dab('0x1e')](respondWithFilteredResult(_0x1e0a62,_0x107ed8))['catch'](handleError(_0x1e0a62,null));};exports[_0x4dab('0x3e')]=function(_0x2ffb63,_0x564e5a){var _0x392f8d={'raw':!![],'where':{'id':_0x2ffb63[_0x4dab('0x3f')]['id']}},_0x1450eb={};_0x1450eb[_0x4dab('0x2b')]=_[_0x4dab('0x2d')](db[_0x4dab('0x27')]['rawAttributes']);_0x1450eb['query']=_[_0x4dab('0x2d')](_0x2ffb63[_0x4dab('0x2e')]);_0x1450eb['filters']=_[_0x4dab('0x40')](_0x1450eb[_0x4dab('0x2b')],_0x1450eb[_0x4dab('0x2e')]);_0x392f8d[_0x4dab('0x2f')]=_['intersection'](_0x1450eb[_0x4dab('0x2b')],qs[_0x4dab('0x30')](_0x2ffb63['query'][_0x4dab('0x30')]));_0x392f8d[_0x4dab('0x2f')]=_0x392f8d[_0x4dab('0x2f')][_0x4dab('0x41')]?_0x392f8d[_0x4dab('0x2f')]:_0x1450eb[_0x4dab('0x2b')];if(_0x2ffb63[_0x4dab('0x2e')][_0x4dab('0x3c')]){_0x392f8d[_0x4dab('0x42')]=[{'all':!![]}];}_0x392f8d=_[_0x4dab('0x39')]({},_0x392f8d,_0x2ffb63['options']);return db[_0x4dab('0x27')][_0x4dab('0x43')](_0x392f8d)[_0x4dab('0x1e')](handleEntityNotFound(_0x564e5a,null))[_0x4dab('0x1e')](respondWithResult(_0x564e5a,null))['catch'](handleError(_0x564e5a,null));};exports[_0x4dab('0x44')]=function(_0x15ba17,_0xa5dab3){return db[_0x4dab('0x27')][_0x4dab('0x44')](_0x15ba17[_0x4dab('0x45')],{})['then'](respondWithResult(_0xa5dab3,0xc9))['catch'](handleError(_0xa5dab3,null));};exports[_0x4dab('0x46')]=function(_0x28ffb7,_0x1f3d59){if(_0x28ffb7[_0x4dab('0x45')]['id']){delete _0x28ffb7['body']['id'];}return db[_0x4dab('0x27')][_0x4dab('0x43')]({'where':{'id':_0x28ffb7[_0x4dab('0x3f')]['id']}})[_0x4dab('0x1e')](handleEntityNotFound(_0x1f3d59,null))['then'](saveUpdates(_0x28ffb7[_0x4dab('0x45')],null))[_0x4dab('0x1e')](respondWithResult(_0x1f3d59,null))[_0x4dab('0x47')](handleError(_0x1f3d59,null));};exports['destroy']=function(_0x3dc205,_0x11dbce){return db[_0x4dab('0x27')][_0x4dab('0x43')]({'where':{'id':_0x3dc205[_0x4dab('0x3f')]['id']}})[_0x4dab('0x1e')](handleEntityNotFound(_0x11dbce,null))[_0x4dab('0x1e')](removeEntity(_0x11dbce,null))['catch'](handleError(_0x11dbce,null));}; \ No newline at end of file +var _0x0365=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','FaxApplication','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','set','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','fieldName'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x0365,0x19d));var _0x5036=function(_0x203a81,_0x37aefa){_0x203a81=_0x203a81-0x0;var _0x5b45f8=_0x0365[_0x203a81];return _0x5b45f8;};'use strict';var pdf=require(_0x5036('0x0'));var emlformat=require(_0x5036('0x1'));var rimraf=require(_0x5036('0x2'));var zipdir=require(_0x5036('0x3'));var jsonpatch=require(_0x5036('0x4'));var rp=require('request-promise');var moment=require(_0x5036('0x5'));var BPromise=require(_0x5036('0x6'));var Mustache=require(_0x5036('0x7'));var util=require(_0x5036('0x8'));var path=require(_0x5036('0x9'));var sox=require(_0x5036('0xa'));var csv=require(_0x5036('0xb'));var ejs=require(_0x5036('0xc'));var fs=require('fs');var _=require(_0x5036('0xd'));var squel=require(_0x5036('0xe'));var crypto=require(_0x5036('0xf'));var jsforce=require(_0x5036('0x10'));var deskjs=require(_0x5036('0x11'));var toCsv=require(_0x5036('0xb'));var querystring=require('querystring');var Papa=require(_0x5036('0x12'));var Redis=require('ioredis');var authService=require(_0x5036('0x13'));var qs=require(_0x5036('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5036('0x15'))('api');var utils=require(_0x5036('0x16'));var config=require(_0x5036('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5036('0x18'))['db'];function respondWithStatusCode(_0x7e1433,_0x147180){_0x147180=_0x147180||0xcc;return function(_0x474bce){if(_0x474bce){return _0x7e1433['sendStatus'](_0x147180);}return _0x7e1433['status'](_0x147180)[_0x5036('0x19')]();};}function respondWithResult(_0x13de9d,_0x290749){_0x290749=_0x290749||0xc8;return function(_0x4ae95d){if(_0x4ae95d){return _0x13de9d[_0x5036('0x1a')](_0x290749)['json'](_0x4ae95d);}};}function respondWithFilteredResult(_0x2f6883,_0x177238){return function(_0x1b40b7){if(_0x1b40b7){var _0x1e1d70=_0x1b40b7['count'],_0x5c33f3=_0x177238['offset'],_0x1f6300=_0x177238[_0x5036('0x1b')]+_0x177238[_0x5036('0x1c')],_0x412a5d;if(_0x1f6300>=_0x1e1d70){_0x1f6300=_0x1e1d70;_0x412a5d=0xc8;}else{_0x412a5d=0xce;}_0x2f6883[_0x5036('0x1a')](_0x412a5d);return _0x2f6883[_0x5036('0x1d')]('Content-Range',_0x5c33f3+'-'+_0x1f6300+'/'+_0x1e1d70)[_0x5036('0x1e')](_0x1b40b7);}return null;};}function patchUpdates(_0x548a47){return function(_0x41e881){try{jsonpatch[_0x5036('0x1f')](_0x41e881,_0x548a47,!![]);}catch(_0x43f8f7){return BPromise[_0x5036('0x20')](_0x43f8f7);}return _0x41e881[_0x5036('0x21')]();};}function saveUpdates(_0x54041c,_0xfdb718){return function(_0x4a40fb){if(_0x4a40fb){return _0x4a40fb[_0x5036('0x22')](_0x54041c)[_0x5036('0x23')](function(_0x33555b){return _0x33555b;});}return null;};}function removeEntity(_0x461cc4,_0x4233b0){return function(_0x36d49e){if(_0x36d49e){return _0x36d49e['destroy']()['then'](function(){_0x461cc4[_0x5036('0x1a')](0xcc)[_0x5036('0x19')]();});}};}function handleEntityNotFound(_0x321769,_0x267bc9){return function(_0x2759e8){if(!_0x2759e8){_0x321769[_0x5036('0x24')](0x194);}return _0x2759e8;};}function handleError(_0x32d3e8,_0x28aab3){_0x28aab3=_0x28aab3||0x1f4;return function(_0x584898){logger['error'](_0x584898[_0x5036('0x25')]);if(_0x584898['name']){delete _0x584898[_0x5036('0x26')];}_0x32d3e8[_0x5036('0x1a')](_0x28aab3)[_0x5036('0x27')](_0x584898);};}exports[_0x5036('0x28')]=function(_0x10937a,_0x2e21bd){var _0x1231b5={},_0x2f5ed8={},_0x3bd414={'count':0x0,'rows':[]};var _0x430f53=_[_0x5036('0x29')](db['FaxApplication']['rawAttributes'],function(_0x1bac1e){return{'name':_0x1bac1e[_0x5036('0x2a')],'type':_0x1bac1e[_0x5036('0x2b')][_0x5036('0x2c')]};});_0x2f5ed8[_0x5036('0x2d')]=_[_0x5036('0x29')](_0x430f53,_0x5036('0x26'));_0x2f5ed8[_0x5036('0x2e')]=_[_0x5036('0x2f')](_0x10937a[_0x5036('0x2e')]);_0x2f5ed8[_0x5036('0x30')]=_[_0x5036('0x31')](_0x2f5ed8['model'],_0x2f5ed8['query']);_0x1231b5[_0x5036('0x32')]=_[_0x5036('0x31')](_0x2f5ed8[_0x5036('0x2d')],qs[_0x5036('0x33')](_0x10937a[_0x5036('0x2e')][_0x5036('0x33')]));_0x1231b5[_0x5036('0x32')]=_0x1231b5[_0x5036('0x32')][_0x5036('0x34')]?_0x1231b5[_0x5036('0x32')]:_0x2f5ed8[_0x5036('0x2d')];if(!_0x10937a[_0x5036('0x2e')][_0x5036('0x35')]('nolimit')){_0x1231b5[_0x5036('0x1c')]=qs['limit'](_0x10937a[_0x5036('0x2e')][_0x5036('0x1c')]);_0x1231b5[_0x5036('0x1b')]=qs[_0x5036('0x1b')](_0x10937a[_0x5036('0x2e')][_0x5036('0x1b')]);}_0x1231b5[_0x5036('0x36')]=qs[_0x5036('0x37')](_0x10937a[_0x5036('0x2e')][_0x5036('0x37')]);_0x1231b5[_0x5036('0x38')]=qs[_0x5036('0x30')](_[_0x5036('0x39')](_0x10937a[_0x5036('0x2e')],_0x2f5ed8[_0x5036('0x30')]),_0x430f53);if(_0x10937a['query'][_0x5036('0x3a')]){_0x1231b5[_0x5036('0x38')]=_[_0x5036('0x3b')](_0x1231b5['where'],{'$or':_[_0x5036('0x29')](_0x430f53,function(_0x40282e){if(_0x40282e[_0x5036('0x2b')]!==_0x5036('0x3c')){var _0x1c74cb={};_0x1c74cb[_0x40282e[_0x5036('0x26')]]={'$like':'%'+_0x10937a[_0x5036('0x2e')][_0x5036('0x3a')]+'%'};return _0x1c74cb;}})});}_0x1231b5=_[_0x5036('0x3b')]({},_0x1231b5,_0x10937a[_0x5036('0x3d')]);var _0x16f3c4={'where':_0x1231b5[_0x5036('0x38')]};return db['FaxApplication'][_0x5036('0x3e')](_0x16f3c4)[_0x5036('0x23')](function(_0x101f86){_0x3bd414[_0x5036('0x3e')]=_0x101f86;if(_0x10937a[_0x5036('0x2e')]['includeAll']){_0x1231b5[_0x5036('0x3f')]=[{'all':!![]}];}return db[_0x5036('0x40')][_0x5036('0x41')](_0x1231b5);})[_0x5036('0x23')](function(_0x128e52){_0x3bd414[_0x5036('0x42')]=_0x128e52;return _0x3bd414;})[_0x5036('0x23')](respondWithFilteredResult(_0x2e21bd,_0x1231b5))['catch'](handleError(_0x2e21bd,null));};exports[_0x5036('0x43')]=function(_0x1d1323,_0x4906a2){var _0x401bb2={'raw':!![],'where':{'id':_0x1d1323['params']['id']}},_0x452849={};_0x452849[_0x5036('0x2d')]=_[_0x5036('0x2f')](db['FaxApplication'][_0x5036('0x44')]);_0x452849[_0x5036('0x2e')]=_['keys'](_0x1d1323['query']);_0x452849[_0x5036('0x30')]=_['intersection'](_0x452849[_0x5036('0x2d')],_0x452849[_0x5036('0x2e')]);_0x401bb2['attributes']=_[_0x5036('0x31')](_0x452849[_0x5036('0x2d')],qs['fields'](_0x1d1323[_0x5036('0x2e')]['fields']));_0x401bb2['attributes']=_0x401bb2[_0x5036('0x32')][_0x5036('0x34')]?_0x401bb2[_0x5036('0x32')]:_0x452849[_0x5036('0x2d')];if(_0x1d1323[_0x5036('0x2e')][_0x5036('0x45')]){_0x401bb2[_0x5036('0x3f')]=[{'all':!![]}];}_0x401bb2=_[_0x5036('0x3b')]({},_0x401bb2,_0x1d1323[_0x5036('0x3d')]);return db[_0x5036('0x40')][_0x5036('0x46')](_0x401bb2)['then'](handleEntityNotFound(_0x4906a2,null))['then'](respondWithResult(_0x4906a2,null))[_0x5036('0x47')](handleError(_0x4906a2,null));};exports['create']=function(_0x4553a5,_0x3b3c4a){return db[_0x5036('0x40')][_0x5036('0x48')](_0x4553a5[_0x5036('0x49')],{})['then'](respondWithResult(_0x3b3c4a,0xc9))[_0x5036('0x47')](handleError(_0x3b3c4a,null));};exports[_0x5036('0x22')]=function(_0x12daeb,_0x28ef28){if(_0x12daeb['body']['id']){delete _0x12daeb[_0x5036('0x49')]['id'];}return db[_0x5036('0x40')][_0x5036('0x46')]({'where':{'id':_0x12daeb[_0x5036('0x4a')]['id']}})[_0x5036('0x23')](handleEntityNotFound(_0x28ef28,null))['then'](saveUpdates(_0x12daeb[_0x5036('0x49')],null))[_0x5036('0x23')](respondWithResult(_0x28ef28,null))[_0x5036('0x47')](handleError(_0x28ef28,null));};exports[_0x5036('0x4b')]=function(_0x187f3b,_0x3485ac){return db[_0x5036('0x40')][_0x5036('0x46')]({'where':{'id':_0x187f3b[_0x5036('0x4a')]['id']}})[_0x5036('0x23')](handleEntityNotFound(_0x3485ac,null))[_0x5036('0x23')](removeEntity(_0x3485ac,null))[_0x5036('0x47')](handleError(_0x3485ac,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0c1ea6e..9f7357d 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 _0xac9a=['../../config/logger','api','moment','bluebird','request-promise','path','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x54928a,_0x56b315){var _0x4388db=function(_0x1605a0){while(--_0x1605a0){_0x54928a['push'](_0x54928a['shift']());}};_0x4388db(++_0x56b315);}(_0xac9a,0x19e));var _0xaac9=function(_0xcd001b,_0x350354){_0xcd001b=_0xcd001b-0x0;var _0x37e09f=_0xac9a[_0xcd001b];return _0x37e09f;};'use strict';var _=require(_0xaac9('0x0'));var util=require(_0xaac9('0x1'));var logger=require(_0xaac9('0x2'))(_0xaac9('0x3'));var moment=require(_0xaac9('0x4'));var BPromise=require(_0xaac9('0x5'));var rp=require(_0xaac9('0x6'));var fs=require('fs');var path=require(_0xaac9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaac9('0x8'));module[_0xaac9('0x9')]=function(_0x15b74c,_0x168907){return _0x15b74c[_0xaac9('0xa')]('FaxApplication',attributes,{'tableName':_0xaac9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaac9('0xc')});}; \ No newline at end of file +var _0x9de9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x405400,_0x373d37){var _0x3bfffe=function(_0x447427){while(--_0x447427){_0x405400['push'](_0x405400['shift']());}};_0x3bfffe(++_0x373d37);}(_0x9de9,0x1cd));var _0x99de=function(_0x6a73c5,_0x533a66){_0x6a73c5=_0x6a73c5-0x0;var _0x970d8c=_0x9de9[_0x6a73c5];return _0x970d8c;};'use strict';var _=require(_0x99de('0x0'));var util=require(_0x99de('0x1'));var logger=require(_0x99de('0x2'))(_0x99de('0x3'));var moment=require(_0x99de('0x4'));var BPromise=require(_0x99de('0x5'));var rp=require(_0x99de('0x6'));var fs=require('fs');var path=require(_0x99de('0x7'));var rimraf=require(_0x99de('0x8'));var config=require(_0x99de('0x9'));var attributes=require(_0x99de('0xa'));module[_0x99de('0xb')]=function(_0x115f93,_0x442df2){return _0x115f93[_0x99de('0xc')]('FaxApplication',attributes,{'tableName':_0x99de('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x99de('0xe'),'collate':_0x99de('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8b685d3..7f6e16a 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 _0xff92=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x20255d,_0x3f4302){var _0x28a734=function(_0x49ed59){while(--_0x49ed59){_0x20255d['push'](_0x20255d['shift']());}};_0x28a734(++_0x3f4302);}(_0xff92,0x16d));var _0x2ff9=function(_0x544bfc,_0x5b2f79){_0x544bfc=_0x544bfc-0x0;var _0x2428d1=_0xff92[_0x544bfc];return _0x2428d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ff9('0x0'));var BPromise=require(_0x2ff9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ff9('0x2'));var db=require(_0x2ff9('0x3'))['db'];var utils=require(_0x2ff9('0x4'));var logger=require(_0x2ff9('0x5'))('rpc');var config=require(_0x2ff9('0x6'));var jayson=require(_0x2ff9('0x7'));var client=jayson[_0x2ff9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9216c2,_0x56e6c0,_0x33c3be){return new BPromise(function(_0x528ff0,_0x205c40){return client[_0x2ff9('0x9')](_0x9216c2,_0x33c3be)[_0x2ff9('0xa')](function(_0x42c7e6){logger[_0x2ff9('0xb')](_0x2ff9('0xc'),_0x56e6c0,_0x2ff9('0xd'));logger[_0x2ff9('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x56e6c0,_0x2ff9('0xd'),JSON[_0x2ff9('0xf')](_0x42c7e6));if(_0x42c7e6['error']){if(_0x42c7e6[_0x2ff9('0x10')][_0x2ff9('0x11')]===0x1f4){logger[_0x2ff9('0x10')]('FaxApplication,\x20%s,\x20%s',_0x56e6c0,_0x42c7e6[_0x2ff9('0x10')][_0x2ff9('0x12')]);return _0x205c40(_0x42c7e6[_0x2ff9('0x10')][_0x2ff9('0x12')]);}logger[_0x2ff9('0x10')](_0x2ff9('0xc'),_0x56e6c0,_0x42c7e6[_0x2ff9('0x10')][_0x2ff9('0x12')]);return _0x528ff0(_0x42c7e6[_0x2ff9('0x10')][_0x2ff9('0x12')]);}else{logger[_0x2ff9('0xb')](_0x2ff9('0xc'),_0x56e6c0,_0x2ff9('0xd'));_0x528ff0(_0x42c7e6[_0x2ff9('0x13')][_0x2ff9('0x12')]);}})[_0x2ff9('0x14')](function(_0x179656){logger[_0x2ff9('0x10')](_0x2ff9('0xc'),_0x56e6c0,_0x179656);_0x205c40(_0x179656);});});}exports['UpdateFaxApplication']=function(_0x5c17a3){var _0x17e4f8=this;return new Promise(function(_0x2a7bfa,_0x300fd0){return db[_0x2ff9('0x15')][_0x2ff9('0x16')](_0x5c17a3[_0x2ff9('0x17')],{'raw':_0x5c17a3[_0x2ff9('0x18')]?_0x5c17a3['options'][_0x2ff9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c17a3[_0x2ff9('0x18')]?_0x5c17a3['options'][_0x2ff9('0x1a')]||null:null,'attributes':_0x5c17a3[_0x2ff9('0x18')]?_0x5c17a3['options']['attributes']||null:null,'limit':_0x5c17a3[_0x2ff9('0x18')]?_0x5c17a3[_0x2ff9('0x18')][_0x2ff9('0x1b')]||null:null})[_0x2ff9('0xa')](function(_0x1444f2){logger[_0x2ff9('0xb')]('UpdateFaxApplication',_0x5c17a3);logger[_0x2ff9('0xe')](_0x2ff9('0x1c'),_0x5c17a3,JSON[_0x2ff9('0xf')](_0x1444f2));_0x2a7bfa(_0x1444f2);})[_0x2ff9('0x14')](function(_0x5d37ee){logger[_0x2ff9('0x10')]('UpdateFaxApplication',_0x5d37ee[_0x2ff9('0x12')],_0x5c17a3);_0x300fd0(_0x17e4f8[_0x2ff9('0x10')](0x1f4,_0x5d37ee[_0x2ff9('0x12')]));});});}; \ No newline at end of file +var _0x162a=['result','catch','UpdateFaxApplication','body','options','where','attributes','limit','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x162a,0x19f));var _0xa162=function(_0x56c012,_0x4bbd5b){_0x56c012=_0x56c012-0x0;var _0x2803cd=_0x162a[_0x56c012];return _0x2803cd;};'use strict';var _=require(_0xa162('0x0'));var util=require(_0xa162('0x1'));var moment=require(_0xa162('0x2'));var BPromise=require(_0xa162('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa162('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa162('0x6'));var jayson=require(_0xa162('0x7'));var client=jayson[_0xa162('0x8')][_0xa162('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6961dd,_0x129d90,_0x3d6177){return new BPromise(function(_0x41ec15,_0x1d7a50){return client[_0xa162('0xa')](_0x6961dd,_0x3d6177)['then'](function(_0x19f6ff){logger[_0xa162('0xb')](_0xa162('0xc'),_0x129d90,_0xa162('0xd'));logger[_0xa162('0xe')](_0xa162('0xf'),_0x129d90,_0xa162('0xd'),JSON[_0xa162('0x10')](_0x19f6ff));if(_0x19f6ff[_0xa162('0x11')]){if(_0x19f6ff[_0xa162('0x11')][_0xa162('0x12')]===0x1f4){logger[_0xa162('0x11')]('FaxApplication,\x20%s,\x20%s',_0x129d90,_0x19f6ff[_0xa162('0x11')][_0xa162('0x13')]);return _0x1d7a50(_0x19f6ff[_0xa162('0x11')]['message']);}logger[_0xa162('0x11')](_0xa162('0xc'),_0x129d90,_0x19f6ff[_0xa162('0x11')][_0xa162('0x13')]);return _0x41ec15(_0x19f6ff[_0xa162('0x11')][_0xa162('0x13')]);}else{logger[_0xa162('0xb')](_0xa162('0xc'),_0x129d90,'request\x20sent');_0x41ec15(_0x19f6ff[_0xa162('0x14')][_0xa162('0x13')]);}})[_0xa162('0x15')](function(_0x421c8b){logger[_0xa162('0x11')](_0xa162('0xc'),_0x129d90,_0x421c8b);_0x1d7a50(_0x421c8b);});});}exports[_0xa162('0x16')]=function(_0x14ccfc){var _0x379a28=this;return new Promise(function(_0x979540,_0x32d760){return db['FaxApplication']['update'](_0x14ccfc[_0xa162('0x17')],{'raw':_0x14ccfc[_0xa162('0x18')]?_0x14ccfc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ccfc[_0xa162('0x18')]?_0x14ccfc[_0xa162('0x18')][_0xa162('0x19')]||null:null,'attributes':_0x14ccfc[_0xa162('0x18')]?_0x14ccfc[_0xa162('0x18')][_0xa162('0x1a')]||null:null,'limit':_0x14ccfc[_0xa162('0x18')]?_0x14ccfc[_0xa162('0x18')][_0xa162('0x1b')]||null:null})[_0xa162('0x1c')](function(_0x1250c7){logger[_0xa162('0xb')](_0xa162('0x16'),_0x14ccfc);logger[_0xa162('0xe')](_0xa162('0x16'),_0x14ccfc,JSON[_0xa162('0x10')](_0x1250c7));_0x979540(_0x1250c7);})['catch'](function(_0xf9e4c7){logger[_0xa162('0x11')](_0xa162('0x16'),_0xf9e4c7[_0xa162('0x13')],_0x14ccfc);_0x32d760(_0x379a28[_0xa162('0x11')](0x1f4,_0xf9e4c7[_0xa162('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7b7161b..45f5ca1 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x687b,0x14a));var _0xb687=function(_0x3909ae,_0x3183c7){_0x3909ae=_0x3909ae-0x0;var _0x15000b=_0x687b[_0x3909ae];return _0x15000b;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x5075=['express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','/:id','show','post','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x27c578,_0x42d5e1){var _0x3b9e64=function(_0x24620e){while(--_0x24620e){_0x27c578['push'](_0x27c578['shift']());}};_0x3b9e64(++_0x42d5e1);}(_0x5075,0x73));var _0x5507=function(_0x41648f,_0x4a8936){_0x41648f=_0x41648f-0x0;var _0x20340a=_0x5075[_0x41648f];return _0x20340a;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var auth=require(_0x5507('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5507('0x7'));var controller=require(_0x5507('0x8'));router[_0x5507('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5507('0x9')](_0x5507('0xa'),auth['isAuthenticated'](),controller[_0x5507('0xb')]);router[_0x5507('0xc')]('/',auth[_0x5507('0xd')](),controller['create']);router['put'](_0x5507('0xa'),auth[_0x5507('0xd')](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/:id',auth[_0x5507('0xd')](),controller[_0x5507('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b56fb43..e2582cd 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 _0x3f27=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x3b2c59,_0x5a128c){var _0x458199=function(_0x340dcf){while(--_0x340dcf){_0x3b2c59['push'](_0x3b2c59['shift']());}};_0x458199(++_0x5a128c);}(_0x3f27,0x1f4));var _0x73f2=function(_0x5cda4c,_0x119f37){_0x5cda4c=_0x5cda4c-0x0;var _0x132da4=_0x3f27[_0x5cda4c];return _0x132da4;};'use strict';var Sequelize=require(_0x73f2('0x0'));module[_0x73f2('0x1')]={'closed':{'type':Sequelize[_0x73f2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x73f2('0x3')]},'disposition':{'type':Sequelize[_0x73f2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x73f2('0x4')]},'note':{'type':Sequelize[_0x73f2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x73f2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x73f2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x73f2('0x6')]('in',_0x73f2('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe548=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3d8eaf,_0x4f26d1){var _0x25fc3f=function(_0x555243){while(--_0x555243){_0x3d8eaf['push'](_0x3d8eaf['shift']());}};_0x25fc3f(++_0x4f26d1);}(_0xe548,0x184));var _0x8e54=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0xe548[_0x1876b2];return _0x9fb1e0;};'use strict';var Sequelize=require(_0x8e54('0x0'));module[_0x8e54('0x1')]={'closed':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8e54('0x3')]},'disposition':{'type':Sequelize[_0x8e54('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x8e54('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8e54('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8e54('0x6')),'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 bcca292..8a926d1 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 _0xea14=['me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','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?','find','ContactId','buildExpression','type','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','compact','isEmpty','FaxAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','role','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','count','keyBy','merge','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','update','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','pick','format','setTags','spread','Tag','findAll','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','limit','json','apply','reject','save','then','destroy','end','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId'];(function(_0x1bf9e5,_0x84e361){var _0x28a7b3=function(_0x444c18){while(--_0x444c18){_0x1bf9e5['push'](_0x1bf9e5['shift']());}};_0x28a7b3(++_0x84e361);}(_0xea14,0x153));var _0x4ea1=function(_0x2225d8,_0xda10fe){_0x2225d8=_0x2225d8-0x0;var _0x2d0a78=_0xea14[_0x2225d8];return _0x2d0a78;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ea1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea1('0x1'));var jsonpatch=require(_0x4ea1('0x2'));var rp=require(_0x4ea1('0x3'));var moment=require(_0x4ea1('0x4'));var BPromise=require(_0x4ea1('0x5'));var Mustache=require(_0x4ea1('0x6'));var util=require(_0x4ea1('0x7'));var path=require(_0x4ea1('0x8'));var sox=require(_0x4ea1('0x9'));var csv=require(_0x4ea1('0xa'));var ejs=require(_0x4ea1('0xb'));var fs=require('fs');var _=require(_0x4ea1('0xc'));var squel=require(_0x4ea1('0xd'));var crypto=require(_0x4ea1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4ea1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4ea1('0x10'));var Papa=require(_0x4ea1('0x11'));var Redis=require(_0x4ea1('0x12'));var authService=require(_0x4ea1('0x13'));var qs=require(_0x4ea1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ea1('0x15'));var logger=require(_0x4ea1('0x16'))(_0x4ea1('0x17'));var utils=require(_0x4ea1('0x18'));var config=require(_0x4ea1('0x19'));var licenseUtil=require(_0x4ea1('0x1a'));var db=require(_0x4ea1('0x1b'))['db'];config['redis']=_[_0x4ea1('0x1c')](config[_0x4ea1('0x1d')],{'host':_0x4ea1('0x1e'),'port':0x18eb});var socket=require(_0x4ea1('0x1f'))(new Redis(config[_0x4ea1('0x1d')]));require(_0x4ea1('0x20'))[_0x4ea1('0x21')](socket);function respondWithStatusCode(_0x3f2107,_0x485509){_0x485509=_0x485509||0xcc;return function(_0x45bc94){if(_0x45bc94){return _0x3f2107[_0x4ea1('0x22')](_0x485509);}return _0x3f2107[_0x4ea1('0x23')](_0x485509)['end']();};}function respondWithResult(_0x3d8b4b,_0x5e3466){_0x5e3466=_0x5e3466||0xc8;return function(_0xcc64f3){if(_0xcc64f3){return _0x3d8b4b[_0x4ea1('0x23')](_0x5e3466)['json'](_0xcc64f3);}};}function respondWithFilteredResult(_0x4933c0,_0x33be90){return function(_0x3bd6e6){if(_0x3bd6e6){var _0x3bff77=_0x3bd6e6['count'],_0x45ba56=_0x33be90[_0x4ea1('0x24')],_0x2d062b=_0x33be90[_0x4ea1('0x24')]+_0x33be90[_0x4ea1('0x25')],_0x2a7887;if(_0x2d062b>=_0x3bff77){_0x2d062b=_0x3bff77;_0x2a7887=0xc8;}else{_0x2a7887=0xce;}_0x4933c0['status'](_0x2a7887);return _0x4933c0['set']('Content-Range',_0x45ba56+'-'+_0x2d062b+'/'+_0x3bff77)[_0x4ea1('0x26')](_0x3bd6e6);}return null;};}function patchUpdates(_0x5310aa){return function(_0x323269){try{jsonpatch[_0x4ea1('0x27')](_0x323269,_0x5310aa,!![]);}catch(_0x235fb8){return BPromise[_0x4ea1('0x28')](_0x235fb8);}return _0x323269[_0x4ea1('0x29')]();};}function saveUpdates(_0x327eae,_0x4f1e68){return function(_0x1945c4){if(_0x1945c4){return _0x1945c4['update'](_0x327eae)[_0x4ea1('0x2a')](function(_0x5b80d9){return _0x5b80d9;});}return null;};}function removeEntity(_0x44caf3,_0x1aab59){return function(_0x47b7c8){if(_0x47b7c8){return _0x47b7c8[_0x4ea1('0x2b')]()[_0x4ea1('0x2a')](function(){_0x44caf3[_0x4ea1('0x23')](0xcc)[_0x4ea1('0x2c')]();});}};}function handleEntityNotFound(_0x2fd2c2,_0x4ede75){return function(_0x126772){if(!_0x126772){_0x2fd2c2[_0x4ea1('0x22')](0x194);}return _0x126772;};}function handleError(_0x559370,_0x1c3c22){_0x1c3c22=_0x1c3c22||0x1f4;return function(_0x178cc5){logger['error'](_0x178cc5['stack']);if(_0x178cc5['name']){delete _0x178cc5[_0x4ea1('0x2d')];}_0x559370[_0x4ea1('0x23')](_0x1c3c22)[_0x4ea1('0x2e')](_0x178cc5);};}function getInteractionUsers(_0x2fd5a8,_0x5ded03){return new BPromise(function(_0x4dfb1f,_0x154c39){try{if(_0x5ded03[_0x2fd5a8['id']]){_0x2fd5a8[_0x4ea1('0x2f')]=_[_0x4ea1('0x30')](_0x5ded03[_0x2fd5a8['id']],function(_0x1706a1){return{'id':_0x1706a1['id'],'fullname':_0x1706a1[_0x4ea1('0x31')]};});}}catch(_0x9b0e51){_0x154c39(_0x9b0e51);}_0x4dfb1f(_0x2fd5a8);});}function getInteractionTags(_0x133f63,_0x102de5){return new BPromise(function(_0x5e1df3,_0x382315){try{if(_0x133f63[_0x4ea1('0x32')]){_0x133f63[_0x4ea1('0x33')]=[];_0x133f63[_0x4ea1('0x32')][_0x4ea1('0x34')](',')[_0x4ea1('0x35')](function(_0xb4f92a){_0x133f63[_0x4ea1('0x33')][_0x4ea1('0x36')](_0x102de5[_0xb4f92a]);});}delete _0x133f63[_0x4ea1('0x32')];}catch(_0x5ad5e8){_0x382315(_0x5ad5e8);}_0x5e1df3(_0x133f63);});}function updateFaxInteraction(_0x23c83f,_0x5850a7,_0x480cd6){return new BPromise(function(_0x5a47f4,_0xce060){return getInteractionUsers(_0x23c83f,_0x480cd6)['then'](function(_0x4cafa2){return getInteractionTags(_0x4cafa2,_0x5850a7);})[_0x4ea1('0x2a')](function(_0x4df174){_0x5a47f4(_0x4df174);})[_0x4ea1('0x37')](function(_0x5f1f8f){_0xce060(_0x5f1f8f);});});}exports[_0x4ea1('0x38')]=function(_0x192901,_0x256e4a){var _0x5f2be3={},_0x11011b={},_0x386b13={'count':0x0,'rows':[]};var _0x1194f9=_[_0x4ea1('0x30')](db[_0x4ea1('0x39')][_0x4ea1('0x3a')],function(_0x4eb1f2){return{'name':_0x4eb1f2[_0x4ea1('0x3b')],'type':_0x4eb1f2['type']['key']};});_0x11011b[_0x4ea1('0x3c')]=_[_0x4ea1('0x30')](_0x1194f9,_0x4ea1('0x2d'));_0x11011b[_0x4ea1('0x3d')]=_['keys'](_0x192901['query']);_0x11011b[_0x4ea1('0x3e')]=_[_0x4ea1('0x3f')](_0x11011b[_0x4ea1('0x3c')],_0x11011b[_0x4ea1('0x3d')]);_0x5f2be3['attributes']=_['intersection'](_0x11011b[_0x4ea1('0x3c')],qs[_0x4ea1('0x40')](_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x40')]));_0x5f2be3[_0x4ea1('0x41')]=_0x5f2be3['attributes'][_0x4ea1('0x42')]?_0x5f2be3[_0x4ea1('0x41')]:_0x11011b[_0x4ea1('0x3c')];if(!_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x43')]('nolimit')){_0x5f2be3[_0x4ea1('0x25')]=qs[_0x4ea1('0x25')](_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x25')]);_0x5f2be3[_0x4ea1('0x24')]=qs['offset'](_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x24')]);}_0x5f2be3[_0x4ea1('0x44')]=qs[_0x4ea1('0x45')](_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x45')]);_0x5f2be3[_0x4ea1('0x46')]=qs[_0x4ea1('0x3e')](_['pick'](_0x192901[_0x4ea1('0x3d')],_0x11011b['filters']),_0x1194f9);var _0x54c062=[];var _0x57fda4=squel[_0x4ea1('0x47')]()['field']('id')[_0x4ea1('0x48')](_0x4ea1('0x2d'))['field'](_0x4ea1('0x49'))[_0x4ea1('0x4a')](_0x4ea1('0x4b'));var _0x2c8638=squel[_0x4ea1('0x47')]()[_0x4ea1('0x48')]('u.id')['field'](_0x4ea1('0x4c'))[_0x4ea1('0x48')]('ui.FaxInteractionId')['from'](_0x4ea1('0x4d'),'ui')[_0x4ea1('0x4e')](_0x4ea1('0x4f'),'u',_0x4ea1('0x50'));var _0x3942b4=squel[_0x4ea1('0x47')]()[_0x4ea1('0x4a')]('fax_interactions','i')[_0x4ea1('0x4e')](_0x4ea1('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4ea1('0x4e')](_0x4ea1('0x4f'),'o',_0x4ea1('0x52'))[_0x4ea1('0x4e')](_0x4ea1('0x53'),'a',_0x4ea1('0x54'))['left_join']('fax_messages','me',_0x4ea1('0x55'))['left_join'](_0x4ea1('0x56'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x4ea1('0x4e')](_0x4ea1('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x326231=squel[_0x4ea1('0x57')]();var _0xb096cb=[];var _0x1699c2=squel[_0x4ea1('0x57')]();var _0x22b0c2;if(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x58')]){_0x22b0c2=as['parseSearch'](_0x192901[_0x4ea1('0x3d')]['search']);var _0x2417e4=_0x22b0c2['sqlOperator'];for(var _0x40a093=0x0;_0x40a093<_0x22b0c2[_0x4ea1('0x59')]['length'];_0x40a093++){var _0x592dfb=_0x22b0c2[_0x4ea1('0x59')][_0x40a093];var _0x158af9='i';var _0x2d6b6c=_['find'](_0x1194f9,[_0x4ea1('0x2d'),_0x592dfb[_0x4ea1('0x48')]]);if(!_0x2d6b6c){switch(_0x592dfb['field']){case _0x4ea1('0x5a'):if(_0x592dfb[_0x4ea1('0x5b')]==0x1){_0x3942b4[_0x4ea1('0x5c')]('`'+_0x592dfb[_0x4ea1('0x48')]+_0x4ea1('0x5d'));}else{_0x3942b4[_0x4ea1('0x5c')]('`'+_0x592dfb['field']+_0x4ea1('0x5e'));}break;case'Contact':if(_0x592dfb[_0x4ea1('0x5f')]==='$substring'){if(_0x592dfb[_0x4ea1('0x5b')][_0x4ea1('0x34')]('\x20')['length']>0x1){_0x326231[_0x2417e4](_0x4ea1('0x60'),qs['getFullTextValue'](_0x592dfb[_0x4ea1('0x5b')]),null);}else{var _0x553789='%'+_0x592dfb[_0x4ea1('0x5b')]+'%';_0x326231[_0x2417e4](_0x4ea1('0x61'),_0x553789,_0x553789,_0x553789);}}else{_0x2d6b6c=_[_0x4ea1('0x62')](_0x1194f9,[_0x4ea1('0x2d'),_0x4ea1('0x63')]);_0x592dfb[_0x4ea1('0x48')]=_0x4ea1('0x63');_0x29bf8c=as[_0x4ea1('0x64')](_0x158af9,_0x2d6b6c[_0x4ea1('0x65')],_0x592dfb);_0x326231[_0x2417e4](_0x29bf8c['text'],_0x29bf8c['value'][_0x4ea1('0x66')],_0x29bf8c[_0x4ea1('0x5b')][_0x4ea1('0x2c')]);}break;case'Tag':var _0x384480=_0x592dfb[_0x4ea1('0x5b')][_0x4ea1('0x34')](',')[_0x4ea1('0x30')](function(_0x389f86){return Number(_0x389f86);});_0x384480['forEach'](function(_0x497f52){_0x1699c2['or'](_0x4ea1('0x67'),'%,'+_0x497f52+',%');});_0xb096cb=_['union'](_0xb096cb,_0x384480);break;case _0x4ea1('0x68'):if(_0x592dfb[_0x4ea1('0x5f')]==='$substring'){_0x326231[_0x2417e4](_0x4ea1('0x69'),'%'+_0x592dfb[_0x4ea1('0x5b')]+'%',null);}else{_0x2d6b6c=_[_0x4ea1('0x62')](_0x1194f9,[_0x4ea1('0x2d'),_0x4ea1('0x6a')]);_0x592dfb[_0x4ea1('0x48')]=_0x4ea1('0x6a');_0x29bf8c=as[_0x4ea1('0x64')](_0x158af9,_0x2d6b6c['type'],_0x592dfb);_0x326231[_0x2417e4](_0x29bf8c[_0x4ea1('0x6b')],_0x29bf8c[_0x4ea1('0x5b')][_0x4ea1('0x66')],_0x29bf8c[_0x4ea1('0x5b')]['end']);}break;case _0x4ea1('0x6c'):_0x29bf8c=as[_0x4ea1('0x64')]('me',null,_0x592dfb);_0x326231[_0x2417e4](_0x29bf8c[_0x4ea1('0x6b')],_0x29bf8c[_0x4ea1('0x5b')][_0x4ea1('0x66')],_0x29bf8c[_0x4ea1('0x5b')]['end']);break;}}else{var _0x29bf8c=as[_0x4ea1('0x64')](_0x158af9,_0x2d6b6c[_0x4ea1('0x65')],_0x592dfb);_0x326231[_0x2417e4](_0x29bf8c[_0x4ea1('0x6b')],_0x29bf8c[_0x4ea1('0x5b')][_0x4ea1('0x66')],_0x29bf8c['value']['end']);}}}else{var _0x18cf30=_(_0x192901[_0x4ea1('0x3d')])[_0x4ea1('0x6d')]()['map'](function(_0x34f8f7){return _[_0x4ea1('0x6e')](_0x1194f9,[_0x4ea1('0x2d'),_0x34f8f7])?_0x34f8f7:undefined;})[_0x4ea1('0x6f')]()[_0x4ea1('0x5b')]();if(!_[_0x4ea1('0x70')](_0x18cf30)){_0x18cf30[_0x4ea1('0x35')](function(_0x565f10){if(_0x565f10===_0x4ea1('0x71')){_0x3942b4[_0x4ea1('0x46')]('i.FaxAccountId\x20IN\x20?',[][_0x4ea1('0x72')](_0x192901[_0x4ea1('0x3d')][_0x565f10]));}else if(_0x565f10==='createdAt'){var _0x466232=JSON[_0x4ea1('0x73')](_0x192901[_0x4ea1('0x3d')][_0x565f10])[_0x4ea1('0x74')];var _0x50a8b8=JSON[_0x4ea1('0x73')](_0x192901['query'][_0x565f10])[_0x4ea1('0x75')];_0x3942b4['where'](_0x4ea1('0x76'),_0x466232,_0x50a8b8);}else{if(_0x192901[_0x4ea1('0x3d')][_0x565f10]===_0x4ea1('0x77')){_0x3942b4[_0x4ea1('0x46')]('i.'+_0x565f10+'\x20IS\x20NULL');}else{_0x3942b4[_0x4ea1('0x46')]('i.'+_0x565f10+_0x4ea1('0x78'),_0x192901[_0x4ea1('0x3d')][_0x565f10]);}}});}if(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x79')]){if(_0x192901[_0x4ea1('0x3d')]['read']==0x1){_0x3942b4['having'](_0x4ea1('0x7a'));}else{_0x3942b4[_0x4ea1('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x7b')]){_0xb096cb=_[_0x4ea1('0x7c')](_0x192901[_0x4ea1('0x3d')]['tag'])?_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x7b')]:new Array(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x7b')]);_0xb096cb[_0x4ea1('0x35')](function(_0x1a7cd2){_0x1699c2['or'](_0x4ea1('0x67'),'%,'+_0x1a7cd2+',%');});}if(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x7d')]){var _0x4621e2=_0x192901['query']['filter'][_0x4ea1('0x7e')]('\x5c','\x5c\x5c')[_0x4ea1('0x7e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4621e2)){_0x326231['or'](_0x4ea1('0x7f'),_0x4621e2+'%')['or'](_0x4ea1('0x80'),_0x4621e2+'%');}_0x326231['or'](_0x4ea1('0x81'),_0x4621e2+'%');}}_0x3942b4[_0x4ea1('0x46')](_0x326231);_0x3942b4[_0x4ea1('0x82')](_0x4ea1('0x83'));var _0x544151={'type':db[_0x4ea1('0x84')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1d4100=_0x3942b4[_0x4ea1('0x85')]();_0x1d4100['field'](_0x4ea1('0x83'));_0x1d4100[_0x4ea1('0x48')](_0x4ea1('0x86'),_0x4ea1('0x5a'));if(_0x5f2be3[_0x4ea1('0x44')]){_0x5f2be3[_0x4ea1('0x44')][_0x4ea1('0x35')](function(_0x588384){var _0x4654a2=_0x588384[0x0]===_0x4ea1('0x87')?_0x588384[0x0]:'i.'+_0x588384[0x0];_0x3942b4[_0x4ea1('0x44')](_0x4654a2,_0x588384[0x1]===_0x4ea1('0x88')?![]:!![]);});}if(!_['isEmpty'](_0xb096cb)){_0x3942b4[_0x4ea1('0x5c')](_0x1699c2);_0x1d4100[_0x4ea1('0x46')](_0x4ea1('0x89'),_0xb096cb);}BPromise[_0x4ea1('0x8a')]()[_0x4ea1('0x2a')](function(){if(!_0x22b0c2){if(_0x192901['query'][_0x4ea1('0x71')])return;_0x1d4100['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3942b4[_0x4ea1('0x46')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x192901['user'][_0x4ea1('0x8b')]!=='agent')return;return _0x192901[_0x4ea1('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x194b98){if(_['isEmpty'](_0x194b98)){_0x1d4100['where']('i.FaxAccountId\x20IS\x20NULL');_0x3942b4['where'](_0x4ea1('0x8d'));}else{_0x1d4100[_0x4ea1('0x46')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x194b98,'id'));_0x3942b4[_0x4ea1('0x46')](_0x4ea1('0x8e'),_[_0x4ea1('0x30')](_0x194b98,'id'));}});})[_0x4ea1('0x2a')](function(){if(_0x192901['user'][_0x4ea1('0x8b')]===_0x4ea1('0x8f')&&!_0x22b0c2&&!_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x71')])return[];return db[_0x4ea1('0x90')][_0x4ea1('0x3d')](_0x1d4100[_0x4ea1('0x91')](),_0x544151);})[_0x4ea1('0x2a')](function(_0x531897){_0x386b13[_0x4ea1('0x92')]=_0x531897[_0x4ea1('0x42')];if(_0x386b13[_0x4ea1('0x92')]===0x0)return[];return db[_0x4ea1('0x90')][_0x4ea1('0x3d')](_0x57fda4[_0x4ea1('0x91')](),_0x544151)[_0x4ea1('0x2a')](function(_0x474215){_0x54c062=_[_0x4ea1('0x93')](_0x474215,'id');_0x544151=_[_0x4ea1('0x94')](_0x544151,{'model':db[_0x4ea1('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x192901[_0x4ea1('0x3d')][_0x4ea1('0x40')]){_0x5f2be3[_0x4ea1('0x41')]['forEach'](function(_0x443fd1){_0x3942b4['field']('i.'+_0x443fd1);});}else{_0x3942b4['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4ea1('0x5a'));_0x3942b4[_0x4ea1('0x48')]('a.key',_0x4ea1('0x95'));_0x3942b4['field'](_0x4ea1('0x96'),'Account.mandatoryDisposition');_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0x97'),_0x4ea1('0x87'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0x98'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0x99'),_0x4ea1('0x9a'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0x9b'),_0x4ea1('0x9c'));_0x3942b4[_0x4ea1('0x48')]('c.email',_0x4ea1('0x9d'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0x9e'),_0x4ea1('0x9f'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0xa0'),_0x4ea1('0xa1'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0xa2'),'Contact.fax');_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0xa3'),_0x4ea1('0xa4'));_0x3942b4[_0x4ea1('0x48')](_0x4ea1('0xa5'),'Owner.internal');_0x3942b4['field'](_0x4ea1('0xa6'),_0x4ea1('0x32'));}if(_0x5f2be3[_0x4ea1('0x25')])_0x3942b4[_0x4ea1('0x25')](_0x5f2be3[_0x4ea1('0x25')]);if(_0x5f2be3[_0x4ea1('0x24')])_0x3942b4[_0x4ea1('0x24')](_0x5f2be3[_0x4ea1('0x24')]);return db[_0x4ea1('0x90')]['query'](_0x3942b4[_0x4ea1('0x91')](),_0x544151);})[_0x4ea1('0x2a')](function(_0xd95821){_0x2c8638[_0x4ea1('0x46')](_0x4ea1('0xa7'),_[_0x4ea1('0x30')](_0xd95821,'id'));return db[_0x4ea1('0x90')][_0x4ea1('0x3d')](_0x2c8638['toString'](),_0x544151)['then'](function(_0x27d4cc){var _0xacf8a8=_[_0x4ea1('0xa8')](_0x27d4cc,_0x4ea1('0xa9'));var _0x6c4f18=[];_0xd95821['forEach'](function(_0x40aafb){_0x6c4f18[_0x4ea1('0x36')](updateFaxInteraction(_0x40aafb,_0x54c062,_0xacf8a8));});return BPromise[_0x4ea1('0xaa')](_0x6c4f18);});});})[_0x4ea1('0x2a')](function(_0x5358a2){_0x386b13[_0x4ea1('0xab')]=_0x5358a2;return _0x386b13;})[_0x4ea1('0x2a')](respondWithFilteredResult(_0x256e4a,_0x5f2be3))[_0x4ea1('0x37')](handleError(_0x256e4a,null));};exports[_0x4ea1('0xac')]=function(_0x4144ae,_0x417fc9){var _0x5554a6={'raw':![],'where':{'id':_0x4144ae[_0x4ea1('0xad')]['id']}},_0x147fd2={};_0x147fd2[_0x4ea1('0x3c')]=_[_0x4ea1('0x6d')](db[_0x4ea1('0x39')]['rawAttributes']);_0x147fd2[_0x4ea1('0x3d')]=_['keys'](_0x4144ae[_0x4ea1('0x3d')]);_0x147fd2[_0x4ea1('0x3e')]=_[_0x4ea1('0x3f')](_0x147fd2[_0x4ea1('0x3c')],_0x147fd2[_0x4ea1('0x3d')]);_0x5554a6[_0x4ea1('0x41')]=_[_0x4ea1('0x3f')](_0x147fd2[_0x4ea1('0x3c')],qs['fields'](_0x4144ae[_0x4ea1('0x3d')][_0x4ea1('0x40')]));_0x5554a6['attributes']=_0x5554a6[_0x4ea1('0x41')][_0x4ea1('0x42')]?_0x5554a6[_0x4ea1('0x41')]:_0x147fd2[_0x4ea1('0x3c')];if(_0x4144ae['query'][_0x4ea1('0xae')]){_0x5554a6[_0x4ea1('0xaf')]=[{'all':!![]}];}_0x5554a6=_[_0x4ea1('0x94')]({},_0x5554a6,_0x4144ae[_0x4ea1('0xb0')]);return db[_0x4ea1('0x39')][_0x4ea1('0x62')](_0x5554a6)['then'](handleEntityNotFound(_0x417fc9,null))['then'](respondWithResult(_0x417fc9,null))['catch'](handleError(_0x417fc9,null));};exports[_0x4ea1('0xb1')]=function(_0x22e137,_0x1fe0fa){return db['FaxInteraction']['create'](_0x22e137['body'],{})[_0x4ea1('0x2a')](respondWithResult(_0x1fe0fa,0xc9))[_0x4ea1('0x37')](handleError(_0x1fe0fa,null));};exports[_0x4ea1('0xb2')]=function(_0x3a25eb,_0x59237b){if(_0x3a25eb[_0x4ea1('0x6c')]['id']){delete _0x3a25eb[_0x4ea1('0x6c')]['id'];}return db['FaxInteraction'][_0x4ea1('0x62')]({'where':{'id':_0x3a25eb[_0x4ea1('0xad')]['id']}})[_0x4ea1('0x2a')](handleEntityNotFound(_0x59237b,null))[_0x4ea1('0x2a')](saveUpdates(_0x3a25eb[_0x4ea1('0x6c')],null))[_0x4ea1('0x2a')](respondWithResult(_0x59237b,null))[_0x4ea1('0x37')](handleError(_0x59237b,null));};exports['destroy']=function(_0x37c397,_0x159e12){return db[_0x4ea1('0x39')][_0x4ea1('0x62')]({'where':{'id':_0x37c397[_0x4ea1('0xad')]['id']}})[_0x4ea1('0x2a')](handleEntityNotFound(_0x159e12,null))[_0x4ea1('0x2a')](removeEntity(_0x159e12,null))['catch'](handleError(_0x159e12,null));};exports[_0x4ea1('0xb3')]=function(_0x3f0745,_0xf4d3c6){return db[_0x4ea1('0x39')][_0x4ea1('0xb3')]()[_0x4ea1('0x2a')](respondWithResult(_0xf4d3c6,null))[_0x4ea1('0x37')](handleError(_0xf4d3c6,null));};exports[_0x4ea1('0xb4')]=function(_0x4a9f57,_0x5b5abc,_0x26c800){return db[_0x4ea1('0xb5')]['find']({'where':{'id':_0x4a9f57[_0x4ea1('0xad')]['id']}})['then'](handleEntityNotFound(_0x5b5abc,null))['then'](function(_0x29df70){if(_0x29df70){return _0x29df70[_0x4ea1('0xb4')](_0x4a9f57['body'][_0x4ea1('0xb6')],_[_0x4ea1('0xb7')](_0x4a9f57['body'],[_0x4ea1('0xb6'),'id'])||{});}})[_0x4ea1('0x2a')](respondWithResult(_0x5b5abc,null))['catch'](handleError(_0x5b5abc,null));};exports[_0x4ea1('0xb8')]=function(_0x10e06b,_0x22b684,_0x51766b){var _0x4268f3={'raw':![],'where':{}};var _0x551660={};var _0x13713e={'count':0x0,'rows':[]};return db[_0x4ea1('0x39')][_0x4ea1('0xb9')]({'where':{'id':_0x10e06b['params']['id']}})[_0x4ea1('0x2a')](handleEntityNotFound(_0x22b684,null))[_0x4ea1('0x2a')](function(_0x334547){if(_0x334547){_0x551660[_0x4ea1('0x3c')]=_[_0x4ea1('0x6d')](db[_0x4ea1('0xb5')][_0x4ea1('0x3a')]);_0x551660[_0x4ea1('0x3d')]=_['keys'](_0x10e06b[_0x4ea1('0x3d')]);_0x551660[_0x4ea1('0x3e')]=_['intersection'](_0x551660[_0x4ea1('0x3c')],_0x551660[_0x4ea1('0x3d')]);_0x4268f3[_0x4ea1('0x41')]=_[_0x4ea1('0x3f')](_0x551660[_0x4ea1('0x3c')],qs[_0x4ea1('0x40')](_0x10e06b['query'][_0x4ea1('0x40')]));_0x4268f3[_0x4ea1('0x41')]=_0x4268f3['attributes'][_0x4ea1('0x42')]?_0x4268f3['attributes']:_0x551660[_0x4ea1('0x3c')];if(!_0x10e06b[_0x4ea1('0x3d')][_0x4ea1('0x43')](_0x4ea1('0xba'))){_0x4268f3['limit']=qs[_0x4ea1('0x25')](_0x10e06b['query'][_0x4ea1('0x25')]);_0x4268f3[_0x4ea1('0x24')]=qs[_0x4ea1('0x24')](_0x10e06b[_0x4ea1('0x3d')]['offset']);}_0x4268f3[_0x4ea1('0x44')]=qs[_0x4ea1('0x45')](_0x10e06b[_0x4ea1('0x3d')]['sort']);_0x4268f3['where']=qs[_0x4ea1('0x3e')](_[_0x4ea1('0xbb')](_0x10e06b[_0x4ea1('0x3d')],_0x551660[_0x4ea1('0x3e')]));_0x4268f3[_0x4ea1('0x46')][_0x4ea1('0xa9')]=_0x334547['id'];if(_0x10e06b[_0x4ea1('0x3d')][_0x4ea1('0x7d')]){_0x4268f3[_0x4ea1('0x46')]=_[_0x4ea1('0x94')](_0x4268f3[_0x4ea1('0x46')],{'$or':_['map'](_0x4268f3[_0x4ea1('0x41')],function(_0x3fb94c){var _0x4e56d9={};_0x4e56d9[_0x3fb94c]={'$like':'%'+_0x10e06b[_0x4ea1('0x3d')][_0x4ea1('0x7d')]+'%'};return _0x4e56d9;})});}if(_0x10e06b[_0x4ea1('0x3d')][_0x4ea1('0x74')]){var _0x4d1cb0=_0x10e06b['query'][_0x4ea1('0x74')][_0x4ea1('0x34')](',');var _0x3fd5f0={};_0x3fd5f0[_0x4d1cb0[0x0]]={'$gte':moment(_0x4d1cb0[0x1])[_0x4ea1('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4268f3[_0x4ea1('0x46')]=_[_0x4ea1('0x94')](_0x4268f3[_0x4ea1('0x46')],_0x3fd5f0);}_0x4268f3=_[_0x4ea1('0x94')]({},_0x4268f3,_0x10e06b[_0x4ea1('0xb0')]);return db[_0x4ea1('0xb5')]['count']({'where':_0x4268f3['where']})[_0x4ea1('0x2a')](function(_0x105111){_0x13713e['count']=_0x105111;if(_0x10e06b['query'][_0x4ea1('0xae')]){_0x4268f3['include']=[{'all':!![]}];}return db[_0x4ea1('0xb5')]['findAll'](_0x4268f3);})[_0x4ea1('0x2a')](function(_0x3ce897){_0x13713e[_0x4ea1('0xab')]=_0x3ce897;return _0x13713e;});}})[_0x4ea1('0x2a')](respondWithFilteredResult(_0x22b684,_0x4268f3))[_0x4ea1('0x37')](handleError(_0x22b684,null));};exports['addTags']=function(_0x5b6c48,_0x568016,_0x58eb51){return db[_0x4ea1('0x39')][_0x4ea1('0x62')]({'where':{'id':_0x5b6c48[_0x4ea1('0xad')]['id']}})[_0x4ea1('0x2a')](handleEntityNotFound(_0x568016,null))['then'](function(_0x4bcfd3){if(_0x4bcfd3){return _0x4bcfd3[_0x4ea1('0xbd')](_0x5b6c48[_0x4ea1('0x6c')][_0x4ea1('0xb6')],_['omit'](_0x5b6c48[_0x4ea1('0x6c')],['ids','id'])||{})[_0x4ea1('0xbe')](function(){return db[_0x4ea1('0xbf')][_0x4ea1('0xc0')]({'attributes':['id',_0x4ea1('0x2d'),_0x4ea1('0x49')],'where':{'id':_0x5b6c48[_0x4ea1('0x6c')][_0x4ea1('0xb6')]}});})[_0x4ea1('0x2a')](function(_0x2c1659){socket['emit'](_0x4ea1('0xc1'),{'id':Number(_0x5b6c48['params']['id']),'tags':_0x2c1659||[]});return{'id':Number(_0x5b6c48[_0x4ea1('0xad')]['id']),'tags':_0x2c1659||[]};});}})[_0x4ea1('0x2a')](respondWithResult(_0x568016,null))['catch'](handleError(_0x568016,null));};exports[_0x4ea1('0xc2')]=function(_0x23da26,_0x5530a7,_0x1b7faf){return db[_0x4ea1('0x39')][_0x4ea1('0x62')]({'where':{'id':_0x23da26[_0x4ea1('0xad')]['id']}})['then'](handleEntityNotFound(_0x5530a7,null))[_0x4ea1('0x2a')](function(_0xa36695){if(_0xa36695){return _0xa36695[_0x4ea1('0xc2')](_0x23da26[_0x4ea1('0x3d')][_0x4ea1('0xb6')]);}})[_0x4ea1('0x2a')](respondWithStatusCode(_0x5530a7,null))[_0x4ea1('0x37')](handleError(_0x5530a7,null));};exports[_0x4ea1('0xc3')]=function(_0x15eb5d,_0x346c2d){var _0x424a0b=moment()[_0x4ea1('0xc4')]()['toString']();var _0x5e0954=path[_0x4ea1('0xc5')](config[_0x4ea1('0xc6')],_0x4ea1('0xc7'),_0x4ea1('0xc8'),'tmp');var _0x53d7e6=path[_0x4ea1('0xc5')](config[_0x4ea1('0xc6')],_0x4ea1('0xc7'),_0x4ea1('0xc8'),_0x4ea1('0xc9'));var _0x22a3e8=path[_0x4ea1('0xc5')](_0x5e0954,_0x424a0b);var _0x38d764=util[_0x4ea1('0xbc')]('transcript-%d-%s.zip',_0x15eb5d[_0x4ea1('0xad')]['id'],_0x424a0b);var _0x1dcc95=path[_0x4ea1('0xc5')](_0x5e0954,_0x38d764);var _0x4e3e5a=[];_0x4e3e5a['push']({'model':db[_0x4ea1('0xca')],'as':_0x4ea1('0xca'),'raw':!![]});var _0x5183ae=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x4ea1('0x6c'),'createdAt'],'include':_0x4e3e5a}];return db[_0x4ea1('0x39')][_0x4ea1('0x62')]({'where':{'id':_0x15eb5d[_0x4ea1('0xad')]['id']},'include':_0x5183ae})[_0x4ea1('0x2a')](handleEntityNotFound(_0x346c2d,null))['then'](function(_0x198864){if(_0x198864&&_0x198864[_0x4ea1('0xcb')]){var _0x4ca208=_0x198864['get']({'plain':!![]});fs[_0x4ea1('0xcc')](_0x22a3e8);for(var _0x58aba6=0x0;_0x58aba6<_0x4ca208[_0x4ea1('0xcb')][_0x4ea1('0x42')];_0x58aba6++){var _0x1b344d=_0x4ca208[_0x4ea1('0xcb')][_0x58aba6][_0x4ea1('0xca')];if(_0x1b344d){var _0x1e5555=path[_0x4ea1('0xc5')](_0x53d7e6,_0x1b344d[_0x4ea1('0xcd')]);if(fs[_0x4ea1('0xce')](_0x1e5555)){fs[_0x4ea1('0xcf')](_0x1e5555)[_0x4ea1('0xd0')](fs['createWriteStream'](path[_0x4ea1('0xc5')](_0x22a3e8,_0x1b344d['basename'])));}}}return BPromise[_0x4ea1('0x8a')]()[_0x4ea1('0x2a')](function(){return new BPromise(function(_0x1f1ceb,_0x5aaa5f){zipdir(_0x22a3e8,{'saveTo':_0x1dcc95},function(_0x1139dd,_0x4de203){if(_0x1139dd)return _0x5aaa5f(_0x1139dd);return _0x1f1ceb(_0x4de203);});})[_0x4ea1('0x2a')](function(){return new BPromise(function(_0x435ab0,_0x3bbfa8){rimraf(_0x22a3e8,function(_0x20be5c){if(_0x20be5c)_0x3bbfa8(_0x20be5c);return _0x435ab0();});});})[_0x4ea1('0x2a')](function(){return _0x346c2d[_0x4ea1('0xc3')](_0x1dcc95,_0x38d764,function(_0x46685b){if(_0x46685b){console[_0x4ea1('0xd1')](_0x4ea1('0xd2'),_0x46685b);}else{fs[_0x4ea1('0xd3')](_0x1dcc95);}});});});}else{return _0x346c2d[_0x4ea1('0x22')](0xc8);}})[_0x4ea1('0x37')](handleError(_0x346c2d,null));}; \ No newline at end of file +var _0x608f=['unix','join','root','server','files','tmp','attachments','Attachment','Messages','basename','resolve','download','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','having','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','contactName','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','update','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','$gte','format','findAll','addTags','faxInteractionTags:save','removeTags'];(function(_0x11d02a,_0x2a4402){var _0x419231=function(_0x5c29be){while(--_0x5c29be){_0x11d02a['push'](_0x11d02a['shift']());}};_0x419231(++_0x2a4402);}(_0x608f,0x18a));var _0xf608=function(_0x2df32a,_0x591126){_0x2df32a=_0x2df32a-0x0;var _0x586f38=_0x608f[_0x2df32a];return _0x586f38;};'use strict';var pdf=require(_0xf608('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf608('0x1'));var zipdir=require(_0xf608('0x2'));var jsonpatch=require(_0xf608('0x3'));var rp=require(_0xf608('0x4'));var moment=require(_0xf608('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf608('0x6'));var path=require('path');var sox=require(_0xf608('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf608('0x8'));var crypto=require('crypto');var jsforce=require(_0xf608('0x9'));var deskjs=require(_0xf608('0xa'));var toCsv=require(_0xf608('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf608('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xf608('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf608('0xe'))(_0xf608('0xf'));var utils=require(_0xf608('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf608('0x11'))['db'];config[_0xf608('0x12')]=_[_0xf608('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf608('0x12')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b4645,_0x2469bc){_0x2469bc=_0x2469bc||0xcc;return function(_0x2333ad){if(_0x2333ad){return _0x1b4645[_0xf608('0x14')](_0x2469bc);}return _0x1b4645[_0xf608('0x15')](_0x2469bc)[_0xf608('0x16')]();};}function respondWithResult(_0xca6aaa,_0x166709){_0x166709=_0x166709||0xc8;return function(_0x5e6c89){if(_0x5e6c89){return _0xca6aaa[_0xf608('0x15')](_0x166709)[_0xf608('0x17')](_0x5e6c89);}};}function respondWithFilteredResult(_0x4c36e0,_0x112d63){return function(_0x10343a){if(_0x10343a){var _0x24795f=_0x10343a[_0xf608('0x18')],_0x28e345=_0x112d63[_0xf608('0x19')],_0x42e774=_0x112d63['offset']+_0x112d63[_0xf608('0x1a')],_0x12ffd7;if(_0x42e774>=_0x24795f){_0x42e774=_0x24795f;_0x12ffd7=0xc8;}else{_0x12ffd7=0xce;}_0x4c36e0[_0xf608('0x15')](_0x12ffd7);return _0x4c36e0['set'](_0xf608('0x1b'),_0x28e345+'-'+_0x42e774+'/'+_0x24795f)['json'](_0x10343a);}return null;};}function patchUpdates(_0x189323){return function(_0x519937){try{jsonpatch['apply'](_0x519937,_0x189323,!![]);}catch(_0x55c2e0){return BPromise[_0xf608('0x1c')](_0x55c2e0);}return _0x519937[_0xf608('0x1d')]();};}function saveUpdates(_0x1c2c2a,_0x3d5840){return function(_0x5f461e){if(_0x5f461e){return _0x5f461e['update'](_0x1c2c2a)['then'](function(_0x473d39){return _0x473d39;});}return null;};}function removeEntity(_0x52f9f2,_0x5019b9){return function(_0x533039){if(_0x533039){return _0x533039['destroy']()[_0xf608('0x1e')](function(){_0x52f9f2[_0xf608('0x15')](0xcc)[_0xf608('0x16')]();});}};}function handleEntityNotFound(_0x20bd31,_0x36e83f){return function(_0x296d40){if(!_0x296d40){_0x20bd31[_0xf608('0x14')](0x194);}return _0x296d40;};}function handleError(_0xa7441b,_0x5ac1c8){_0x5ac1c8=_0x5ac1c8||0x1f4;return function(_0xd8f098){logger[_0xf608('0x1f')](_0xd8f098[_0xf608('0x20')]);if(_0xd8f098[_0xf608('0x21')]){delete _0xd8f098[_0xf608('0x21')];}_0xa7441b[_0xf608('0x15')](_0x5ac1c8)[_0xf608('0x22')](_0xd8f098);};}function getInteractionUsers(_0x3e785f,_0x2ed82a){return new BPromise(function(_0xed4ae0,_0x38aa6a){try{if(_0x2ed82a[_0x3e785f['id']]){_0x3e785f[_0xf608('0x23')]=_[_0xf608('0x24')](_0x2ed82a[_0x3e785f['id']],function(_0x5eebf3){return{'id':_0x5eebf3['id'],'fullname':_0x5eebf3['fullname']};});}}catch(_0x3063f3){_0x38aa6a(_0x3063f3);}_0xed4ae0(_0x3e785f);});}function getInteractionTags(_0x3bcc3a,_0x17e283){return new BPromise(function(_0x222ffa,_0x2afe8a){try{if(_0x3bcc3a[_0xf608('0x25')]){_0x3bcc3a[_0xf608('0x26')]=[];_0x3bcc3a['TagIds'][_0xf608('0x27')](',')[_0xf608('0x28')](function(_0x2f5cd2){_0x3bcc3a[_0xf608('0x26')][_0xf608('0x29')](_0x17e283[_0x2f5cd2]);});}delete _0x3bcc3a['TagIds'];}catch(_0x3f6332){_0x2afe8a(_0x3f6332);}_0x222ffa(_0x3bcc3a);});}function updateFaxInteraction(_0x4744c5,_0x4ec9b1,_0x2a6ca8){return new BPromise(function(_0x166c33,_0x3c3d16){return getInteractionUsers(_0x4744c5,_0x2a6ca8)[_0xf608('0x1e')](function(_0x4c9f58){return getInteractionTags(_0x4c9f58,_0x4ec9b1);})[_0xf608('0x1e')](function(_0x8a9ebe){_0x166c33(_0x8a9ebe);})[_0xf608('0x2a')](function(_0x112ee7){_0x3c3d16(_0x112ee7);});});}exports[_0xf608('0x2b')]=function(_0x9e157c,_0x136e63){var _0x177438={},_0x1416d7={},_0x35e096={'count':0x0,'rows':[]};var _0x39dd84=_[_0xf608('0x24')](db[_0xf608('0x2c')][_0xf608('0x2d')],function(_0x42316a){return{'name':_0x42316a[_0xf608('0x2e')],'type':_0x42316a['type']['key']};});_0x1416d7[_0xf608('0x2f')]=_[_0xf608('0x24')](_0x39dd84,_0xf608('0x21'));_0x1416d7[_0xf608('0x30')]=_[_0xf608('0x31')](_0x9e157c[_0xf608('0x30')]);_0x1416d7[_0xf608('0x32')]=_[_0xf608('0x33')](_0x1416d7['model'],_0x1416d7[_0xf608('0x30')]);_0x177438['attributes']=_[_0xf608('0x33')](_0x1416d7[_0xf608('0x2f')],qs[_0xf608('0x34')](_0x9e157c[_0xf608('0x30')][_0xf608('0x34')]));_0x177438[_0xf608('0x35')]=_0x177438['attributes']['length']?_0x177438[_0xf608('0x35')]:_0x1416d7['model'];if(!_0x9e157c[_0xf608('0x30')][_0xf608('0x36')](_0xf608('0x37'))){_0x177438[_0xf608('0x1a')]=qs['limit'](_0x9e157c[_0xf608('0x30')][_0xf608('0x1a')]);_0x177438[_0xf608('0x19')]=qs[_0xf608('0x19')](_0x9e157c[_0xf608('0x30')][_0xf608('0x19')]);}_0x177438[_0xf608('0x38')]=qs[_0xf608('0x39')](_0x9e157c[_0xf608('0x30')][_0xf608('0x39')]);_0x177438[_0xf608('0x3a')]=qs['filters'](_[_0xf608('0x3b')](_0x9e157c[_0xf608('0x30')],_0x1416d7[_0xf608('0x32')]),_0x39dd84);var _0x607fe8=[];var _0x21971d=squel[_0xf608('0x3c')]()[_0xf608('0x3d')]('id')[_0xf608('0x3d')](_0xf608('0x21'))[_0xf608('0x3d')](_0xf608('0x3e'))[_0xf608('0x3f')](_0xf608('0x40'));var _0x52bc2f=squel[_0xf608('0x3c')]()['field'](_0xf608('0x41'))[_0xf608('0x3d')](_0xf608('0x42'))[_0xf608('0x3d')](_0xf608('0x43'))[_0xf608('0x3f')](_0xf608('0x44'),'ui')[_0xf608('0x45')]('users','u',_0xf608('0x46'));var _0x4e5cd7=squel[_0xf608('0x3c')]()[_0xf608('0x3f')](_0xf608('0x47'),'i')[_0xf608('0x45')](_0xf608('0x48'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf608('0x45')](_0xf608('0x49'),'o',_0xf608('0x4a'))[_0xf608('0x45')](_0xf608('0x4b'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xf608('0x4c'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xf608('0x45')]('fax_interaction_has_tags','it',_0xf608('0x4d'))[_0xf608('0x45')](_0xf608('0x40'),'t',_0xf608('0x4e'));var _0x3dfb8c=squel[_0xf608('0x4f')]();var _0xfdc6c8=[];var _0x1f2dd7=squel[_0xf608('0x4f')]();var _0x46ba3d;if(_0x9e157c[_0xf608('0x30')][_0xf608('0x50')]){_0x46ba3d=as['parseSearch'](_0x9e157c[_0xf608('0x30')][_0xf608('0x50')]);var _0x1bb9fa=_0x46ba3d[_0xf608('0x51')];for(var _0x52b131=0x0;_0x52b131<_0x46ba3d[_0xf608('0x52')][_0xf608('0x53')];_0x52b131++){var _0x33c3d2=_0x46ba3d[_0xf608('0x52')][_0x52b131];var _0x2aba51='i';var _0x3f380a=_[_0xf608('0x54')](_0x39dd84,[_0xf608('0x21'),_0x33c3d2[_0xf608('0x3d')]]);if(!_0x3f380a){switch(_0x33c3d2[_0xf608('0x3d')]){case _0xf608('0x55'):if(_0x33c3d2['value']==0x1){_0x4e5cd7[_0xf608('0x56')]('`'+_0x33c3d2[_0xf608('0x3d')]+'`\x20=\x200');}else{_0x4e5cd7[_0xf608('0x56')]('`'+_0x33c3d2['field']+'`\x20>\x200');}break;case'Contact':if(_0x33c3d2[_0xf608('0x57')]==='$substring'){if(_0x33c3d2[_0xf608('0x58')][_0xf608('0x27')]('\x20')[_0xf608('0x53')]>0x1){_0x3dfb8c[_0x1bb9fa](_0xf608('0x59'),qs[_0xf608('0x5a')](_0x33c3d2['value']),null);}else{var _0x2b4091='%'+_0x33c3d2[_0xf608('0x58')]+'%';_0x3dfb8c[_0x1bb9fa](_0xf608('0x5b'),_0x2b4091,_0x2b4091,_0x2b4091);}}else{_0x3f380a=_[_0xf608('0x54')](_0x39dd84,[_0xf608('0x21'),_0xf608('0x5c')]);_0x33c3d2[_0xf608('0x3d')]=_0xf608('0x5c');_0x685e55=as[_0xf608('0x5d')](_0x2aba51,_0x3f380a[_0xf608('0x5e')],_0x33c3d2);_0x3dfb8c[_0x1bb9fa](_0x685e55['text'],_0x685e55[_0xf608('0x58')][_0xf608('0x5f')],_0x685e55['value'][_0xf608('0x16')]);}break;case'Tag':var _0x2412f1=_0x33c3d2[_0xf608('0x58')]['split'](',')['map'](function(_0x321782){return Number(_0x321782);});_0x2412f1['forEach'](function(_0x271167){_0x1f2dd7['or'](_0xf608('0x60'),'%,'+_0x271167+',%');});_0xfdc6c8=_[_0xf608('0x61')](_0xfdc6c8,_0x2412f1);break;case _0xf608('0x62'):if(_0x33c3d2[_0xf608('0x57')]===_0xf608('0x63')){_0x3dfb8c[_0x1bb9fa](_0xf608('0x64'),'%'+_0x33c3d2[_0xf608('0x58')]+'%',null);}else{_0x3f380a=_[_0xf608('0x54')](_0x39dd84,[_0xf608('0x21'),_0xf608('0x65')]);_0x33c3d2[_0xf608('0x3d')]=_0xf608('0x65');_0x685e55=as[_0xf608('0x5d')](_0x2aba51,_0x3f380a['type'],_0x33c3d2);_0x3dfb8c[_0x1bb9fa](_0x685e55[_0xf608('0x66')],_0x685e55['value'][_0xf608('0x5f')],_0x685e55['value'][_0xf608('0x16')]);}break;case _0xf608('0x67'):_0x685e55=as['buildExpression']('me',null,_0x33c3d2);_0x3dfb8c[_0x1bb9fa](_0x685e55[_0xf608('0x66')],_0x685e55[_0xf608('0x58')]['start'],_0x685e55[_0xf608('0x58')]['end']);break;}}else{var _0x685e55=as[_0xf608('0x5d')](_0x2aba51,_0x3f380a[_0xf608('0x5e')],_0x33c3d2);_0x3dfb8c[_0x1bb9fa](_0x685e55[_0xf608('0x66')],_0x685e55['value'][_0xf608('0x5f')],_0x685e55[_0xf608('0x58')][_0xf608('0x16')]);}}}else{var _0x5e2b25=_(_0x9e157c[_0xf608('0x30')])['keys']()['map'](function(_0x22097d){return _['some'](_0x39dd84,[_0xf608('0x21'),_0x22097d])?_0x22097d:undefined;})['compact']()[_0xf608('0x58')]();if(!_[_0xf608('0x68')](_0x5e2b25)){_0x5e2b25[_0xf608('0x28')](function(_0x765886){if(_0x765886==='FaxAccountId'){_0x4e5cd7['where'](_0xf608('0x69'),[]['concat'](_0x9e157c['query'][_0x765886]));}else if(_0x765886===_0xf608('0x6a')){var _0x41a327=JSON[_0xf608('0x6b')](_0x9e157c[_0xf608('0x30')][_0x765886])['$gte'];var _0x36fdba=JSON[_0xf608('0x6b')](_0x9e157c[_0xf608('0x30')][_0x765886])[_0xf608('0x6c')];_0x4e5cd7[_0xf608('0x3a')](_0xf608('0x6d'),_0x41a327,_0x36fdba);}else{if(_0x9e157c[_0xf608('0x30')][_0x765886]===_0xf608('0x6e')){_0x4e5cd7[_0xf608('0x3a')]('i.'+_0x765886+'\x20IS\x20NULL');}else{_0x4e5cd7[_0xf608('0x3a')]('i.'+_0x765886+'\x20=\x20?',_0x9e157c[_0xf608('0x30')][_0x765886]);}}});}if(_0x9e157c['query'][_0xf608('0x6f')]){if(_0x9e157c[_0xf608('0x30')]['read']==0x1){_0x4e5cd7[_0xf608('0x56')](_0xf608('0x70'));}else{_0x4e5cd7['having'](_0xf608('0x71'));}}if(_0x9e157c[_0xf608('0x30')][_0xf608('0x72')]){_0xfdc6c8=_['isArray'](_0x9e157c[_0xf608('0x30')][_0xf608('0x72')])?_0x9e157c['query']['tag']:new Array(_0x9e157c[_0xf608('0x30')][_0xf608('0x72')]);_0xfdc6c8[_0xf608('0x28')](function(_0xd70b31){_0x1f2dd7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd70b31+',%');});}if(_0x9e157c[_0xf608('0x30')][_0xf608('0x73')]){var _0x55e2e0=_0x9e157c['query'][_0xf608('0x73')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf608('0x74')](_0x55e2e0)){_0x3dfb8c['or'](_0xf608('0x75'),_0x55e2e0+'%')['or'](_0xf608('0x76'),_0x55e2e0+'%');}_0x3dfb8c['or'](_0xf608('0x77'),_0x55e2e0+'%');}}_0x4e5cd7[_0xf608('0x3a')](_0x3dfb8c);_0x4e5cd7['group'](_0xf608('0x78'));var _0x45de5f={'type':db[_0xf608('0x79')]['QueryTypes']['SELECT'],'raw':!![]};var _0x5ceea7=_0x4e5cd7['clone']();_0x5ceea7[_0xf608('0x3d')](_0xf608('0x78'));_0x5ceea7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf608('0x55'));if(_0x177438[_0xf608('0x38')]){_0x177438['order'][_0xf608('0x28')](function(_0x29d68d){var _0x18c636=_0x29d68d[0x0]===_0xf608('0x7a')?_0x29d68d[0x0]:'i.'+_0x29d68d[0x0];_0x4e5cd7[_0xf608('0x38')](_0x18c636,_0x29d68d[0x1]===_0xf608('0x7b')?![]:!![]);});}if(!_[_0xf608('0x68')](_0xfdc6c8)){_0x4e5cd7[_0xf608('0x56')](_0x1f2dd7);_0x5ceea7[_0xf608('0x3a')](_0xf608('0x7c'),_0xfdc6c8);}BPromise['resolve']()[_0xf608('0x1e')](function(){if(!_0x46ba3d){if(_0x9e157c[_0xf608('0x30')][_0xf608('0x7d')])return;_0x5ceea7[_0xf608('0x3a')](_0xf608('0x7e'));_0x4e5cd7[_0xf608('0x3a')](_0xf608('0x7e'));return;}if(_0x9e157c[_0xf608('0x7f')][_0xf608('0x80')]!==_0xf608('0x81'))return;return _0x9e157c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xf608('0x1e')](function(_0x58509f){if(_[_0xf608('0x68')](_0x58509f)){_0x5ceea7[_0xf608('0x3a')](_0xf608('0x82'));_0x4e5cd7[_0xf608('0x3a')](_0xf608('0x82'));}else{_0x5ceea7[_0xf608('0x3a')]('i.FaxAccountId\x20IN\x20?',_[_0xf608('0x24')](_0x58509f,'id'));_0x4e5cd7[_0xf608('0x3a')](_0xf608('0x69'),_[_0xf608('0x24')](_0x58509f,'id'));}});})[_0xf608('0x1e')](function(){if(_0x9e157c['user']['role']===_0xf608('0x81')&&!_0x46ba3d&&!_0x9e157c[_0xf608('0x30')][_0xf608('0x7d')])return[];return db[_0xf608('0x83')][_0xf608('0x30')](_0x5ceea7[_0xf608('0x84')](),_0x45de5f);})[_0xf608('0x1e')](function(_0x476361){_0x35e096[_0xf608('0x18')]=_0x476361['length'];if(_0x35e096[_0xf608('0x18')]===0x0)return[];return db[_0xf608('0x83')]['query'](_0x21971d['toString'](),_0x45de5f)[_0xf608('0x1e')](function(_0x1710b7){_0x607fe8=_[_0xf608('0x85')](_0x1710b7,'id');_0x45de5f=_[_0xf608('0x86')](_0x45de5f,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9e157c[_0xf608('0x30')][_0xf608('0x34')]){_0x177438[_0xf608('0x35')][_0xf608('0x28')](function(_0x5cf9f3){_0x4e5cd7[_0xf608('0x3d')]('i.'+_0x5cf9f3);});}else{_0x4e5cd7[_0xf608('0x3d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf608('0x55'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x87'),_0xf608('0x88'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x89'),_0xf608('0x8a'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x8b'),_0xf608('0x7a'));_0x4e5cd7['field']('i.*');_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x8c'),_0xf608('0x8d'));_0x4e5cd7[_0xf608('0x3d')]('c.lastName',_0xf608('0x8e'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x8f'),_0xf608('0x90'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x91'),'Contact.phone');_0x4e5cd7['field'](_0xf608('0x92'),_0xf608('0x93'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x94'),'Contact.fax');_0x4e5cd7[_0xf608('0x3d')]('o.fullname',_0xf608('0x95'));_0x4e5cd7[_0xf608('0x3d')](_0xf608('0x96'),'Owner.internal');_0x4e5cd7[_0xf608('0x3d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x177438[_0xf608('0x1a')])_0x4e5cd7[_0xf608('0x1a')](_0x177438[_0xf608('0x1a')]);if(_0x177438[_0xf608('0x19')])_0x4e5cd7[_0xf608('0x19')](_0x177438[_0xf608('0x19')]);return db[_0xf608('0x83')][_0xf608('0x30')](_0x4e5cd7[_0xf608('0x84')](),_0x45de5f);})[_0xf608('0x1e')](function(_0x5b4003){_0x52bc2f['where']('ui.FaxInteractionId\x20IN\x20?',_[_0xf608('0x24')](_0x5b4003,'id'));return db['sequelize'][_0xf608('0x30')](_0x52bc2f[_0xf608('0x84')](),_0x45de5f)[_0xf608('0x1e')](function(_0x61f772){var _0x2b4d0f=_[_0xf608('0x97')](_0x61f772,_0xf608('0x98'));var _0x199599=[];_0x5b4003[_0xf608('0x28')](function(_0xcff1b5){_0x199599[_0xf608('0x29')](updateFaxInteraction(_0xcff1b5,_0x607fe8,_0x2b4d0f));});return BPromise[_0xf608('0x99')](_0x199599);});});})[_0xf608('0x1e')](function(_0x19565b){_0x35e096[_0xf608('0x9a')]=_0x19565b;return _0x35e096;})[_0xf608('0x1e')](respondWithFilteredResult(_0x136e63,_0x177438))[_0xf608('0x2a')](handleError(_0x136e63,null));};exports[_0xf608('0x9b')]=function(_0x17c6c8,_0x154a87){var _0x1403bd={'raw':![],'where':{'id':_0x17c6c8[_0xf608('0x9c')]['id']}},_0xabded6={};_0xabded6[_0xf608('0x2f')]=_[_0xf608('0x31')](db['FaxInteraction'][_0xf608('0x2d')]);_0xabded6[_0xf608('0x30')]=_[_0xf608('0x31')](_0x17c6c8[_0xf608('0x30')]);_0xabded6[_0xf608('0x32')]=_[_0xf608('0x33')](_0xabded6[_0xf608('0x2f')],_0xabded6[_0xf608('0x30')]);_0x1403bd['attributes']=_[_0xf608('0x33')](_0xabded6['model'],qs[_0xf608('0x34')](_0x17c6c8[_0xf608('0x30')][_0xf608('0x34')]));_0x1403bd[_0xf608('0x35')]=_0x1403bd['attributes'][_0xf608('0x53')]?_0x1403bd[_0xf608('0x35')]:_0xabded6[_0xf608('0x2f')];if(_0x17c6c8[_0xf608('0x30')][_0xf608('0x9d')]){_0x1403bd[_0xf608('0x9e')]=[{'all':!![]}];}_0x1403bd=_['merge']({},_0x1403bd,_0x17c6c8[_0xf608('0x9f')]);return db[_0xf608('0x2c')][_0xf608('0x54')](_0x1403bd)['then'](handleEntityNotFound(_0x154a87,null))['then'](respondWithResult(_0x154a87,null))[_0xf608('0x2a')](handleError(_0x154a87,null));};exports[_0xf608('0xa0')]=function(_0x4576e5,_0x472bf0){return db[_0xf608('0x2c')][_0xf608('0xa0')](_0x4576e5['body'],{})[_0xf608('0x1e')](respondWithResult(_0x472bf0,0xc9))['catch'](handleError(_0x472bf0,null));};exports[_0xf608('0xa1')]=function(_0x2ba7f2,_0x2e46ae){if(_0x2ba7f2[_0xf608('0x67')]['id']){delete _0x2ba7f2['body']['id'];}return db[_0xf608('0x2c')][_0xf608('0x54')]({'where':{'id':_0x2ba7f2[_0xf608('0x9c')]['id']}})[_0xf608('0x1e')](handleEntityNotFound(_0x2e46ae,null))['then'](saveUpdates(_0x2ba7f2[_0xf608('0x67')],null))[_0xf608('0x1e')](respondWithResult(_0x2e46ae,null))[_0xf608('0x2a')](handleError(_0x2e46ae,null));};exports[_0xf608('0xa2')]=function(_0x3b13c1,_0xb1cf4c){return db[_0xf608('0x2c')][_0xf608('0x54')]({'where':{'id':_0x3b13c1[_0xf608('0x9c')]['id']}})[_0xf608('0x1e')](handleEntityNotFound(_0xb1cf4c,null))[_0xf608('0x1e')](removeEntity(_0xb1cf4c,null))[_0xf608('0x2a')](handleError(_0xb1cf4c,null));};exports[_0xf608('0xa3')]=function(_0x555ee5,_0x476ccc){return db[_0xf608('0x2c')][_0xf608('0xa3')]()[_0xf608('0x1e')](respondWithResult(_0x476ccc,null))[_0xf608('0x2a')](handleError(_0x476ccc,null));};exports['addMessage']=function(_0x1ae302,_0x33a979,_0x3a748d){return db[_0xf608('0xa4')][_0xf608('0x54')]({'where':{'id':_0x1ae302[_0xf608('0x9c')]['id']}})['then'](handleEntityNotFound(_0x33a979,null))[_0xf608('0x1e')](function(_0x184764){if(_0x184764){return _0x184764[_0xf608('0xa5')](_0x1ae302['body'][_0xf608('0xa6')],_[_0xf608('0xa7')](_0x1ae302['body'],[_0xf608('0xa6'),'id'])||{});}})['then'](respondWithResult(_0x33a979,null))[_0xf608('0x2a')](handleError(_0x33a979,null));};exports[_0xf608('0xa8')]=function(_0x472994,_0x2ce8ec,_0x11be4c){var _0x56059a={'raw':![],'where':{}};var _0x1b4bf1={};var _0x688eab={'count':0x0,'rows':[]};return db[_0xf608('0x2c')][_0xf608('0xa9')]({'where':{'id':_0x472994[_0xf608('0x9c')]['id']}})[_0xf608('0x1e')](handleEntityNotFound(_0x2ce8ec,null))[_0xf608('0x1e')](function(_0x46826d){if(_0x46826d){_0x1b4bf1[_0xf608('0x2f')]=_[_0xf608('0x31')](db[_0xf608('0xa4')][_0xf608('0x2d')]);_0x1b4bf1[_0xf608('0x30')]=_[_0xf608('0x31')](_0x472994[_0xf608('0x30')]);_0x1b4bf1[_0xf608('0x32')]=_[_0xf608('0x33')](_0x1b4bf1[_0xf608('0x2f')],_0x1b4bf1[_0xf608('0x30')]);_0x56059a[_0xf608('0x35')]=_[_0xf608('0x33')](_0x1b4bf1[_0xf608('0x2f')],qs[_0xf608('0x34')](_0x472994['query'][_0xf608('0x34')]));_0x56059a[_0xf608('0x35')]=_0x56059a['attributes'][_0xf608('0x53')]?_0x56059a['attributes']:_0x1b4bf1[_0xf608('0x2f')];if(!_0x472994['query'][_0xf608('0x36')]('nolimit')){_0x56059a['limit']=qs[_0xf608('0x1a')](_0x472994[_0xf608('0x30')][_0xf608('0x1a')]);_0x56059a[_0xf608('0x19')]=qs[_0xf608('0x19')](_0x472994[_0xf608('0x30')][_0xf608('0x19')]);}_0x56059a[_0xf608('0x38')]=qs['sort'](_0x472994[_0xf608('0x30')][_0xf608('0x39')]);_0x56059a[_0xf608('0x3a')]=qs[_0xf608('0x32')](_[_0xf608('0x3b')](_0x472994[_0xf608('0x30')],_0x1b4bf1[_0xf608('0x32')]));_0x56059a[_0xf608('0x3a')][_0xf608('0x98')]=_0x46826d['id'];if(_0x472994[_0xf608('0x30')]['filter']){_0x56059a[_0xf608('0x3a')]=_[_0xf608('0x86')](_0x56059a[_0xf608('0x3a')],{'$or':_[_0xf608('0x24')](_0x56059a[_0xf608('0x35')],function(_0x4fce0f){var _0x78407a={};_0x78407a[_0x4fce0f]={'$like':'%'+_0x472994['query']['filter']+'%'};return _0x78407a;})});}if(_0x472994[_0xf608('0x30')][_0xf608('0xaa')]){var _0x238077=_0x472994[_0xf608('0x30')]['$gte'][_0xf608('0x27')](',');var _0x4c4041={};_0x4c4041[_0x238077[0x0]]={'$gte':moment(_0x238077[0x1])[_0xf608('0xab')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56059a[_0xf608('0x3a')]=_[_0xf608('0x86')](_0x56059a[_0xf608('0x3a')],_0x4c4041);}_0x56059a=_[_0xf608('0x86')]({},_0x56059a,_0x472994[_0xf608('0x9f')]);return db[_0xf608('0xa4')][_0xf608('0x18')]({'where':_0x56059a[_0xf608('0x3a')]})['then'](function(_0x195805){_0x688eab[_0xf608('0x18')]=_0x195805;if(_0x472994[_0xf608('0x30')][_0xf608('0x9d')]){_0x56059a[_0xf608('0x9e')]=[{'all':!![]}];}return db['FaxMessage'][_0xf608('0xac')](_0x56059a);})[_0xf608('0x1e')](function(_0x3ca9db){_0x688eab[_0xf608('0x9a')]=_0x3ca9db;return _0x688eab;});}})[_0xf608('0x1e')](respondWithFilteredResult(_0x2ce8ec,_0x56059a))[_0xf608('0x2a')](handleError(_0x2ce8ec,null));};exports[_0xf608('0xad')]=function(_0x5a175b,_0x31b3bd,_0x372db0){return db[_0xf608('0x2c')]['find']({'where':{'id':_0x5a175b[_0xf608('0x9c')]['id']}})[_0xf608('0x1e')](handleEntityNotFound(_0x31b3bd,null))[_0xf608('0x1e')](function(_0x5b4f24){if(_0x5b4f24){return _0x5b4f24['setTags'](_0x5a175b[_0xf608('0x67')][_0xf608('0xa6')],_[_0xf608('0xa7')](_0x5a175b['body'],[_0xf608('0xa6'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xf608('0x21'),_0xf608('0x3e')],'where':{'id':_0x5a175b['body'][_0xf608('0xa6')]}});})[_0xf608('0x1e')](function(_0x68af0b){socket['emit'](_0xf608('0xae'),{'id':Number(_0x5a175b[_0xf608('0x9c')]['id']),'tags':_0x68af0b||[]});return{'id':Number(_0x5a175b[_0xf608('0x9c')]['id']),'tags':_0x68af0b||[]};});}})[_0xf608('0x1e')](respondWithResult(_0x31b3bd,null))[_0xf608('0x2a')](handleError(_0x31b3bd,null));};exports[_0xf608('0xaf')]=function(_0x59104d,_0x1409db,_0x3aa63a){return db[_0xf608('0x2c')][_0xf608('0x54')]({'where':{'id':_0x59104d[_0xf608('0x9c')]['id']}})['then'](handleEntityNotFound(_0x1409db,null))[_0xf608('0x1e')](function(_0x25e2b1){if(_0x25e2b1){return _0x25e2b1[_0xf608('0xaf')](_0x59104d['query'][_0xf608('0xa6')]);}})[_0xf608('0x1e')](respondWithStatusCode(_0x1409db,null))[_0xf608('0x2a')](handleError(_0x1409db,null));};exports['download']=function(_0x3b2855,_0x29224d){var _0x3d8281=moment()[_0xf608('0xb0')]()[_0xf608('0x84')]();var _0x19eb8e=path[_0xf608('0xb1')](config[_0xf608('0xb2')],_0xf608('0xb3'),_0xf608('0xb4'),_0xf608('0xb5'));var _0x56ac5a=path[_0xf608('0xb1')](config[_0xf608('0xb2')],_0xf608('0xb3'),_0xf608('0xb4'),_0xf608('0xb6'));var _0x23ff4b=path['join'](_0x19eb8e,_0x3d8281);var _0x3da8a4=util[_0xf608('0xab')]('transcript-%d-%s.zip',_0x3b2855['params']['id'],_0x3d8281);var _0x1988e4=path['join'](_0x19eb8e,_0x3da8a4);var _0x573364=[];_0x573364[_0xf608('0x29')]({'model':db[_0xf608('0xb7')],'as':_0xf608('0xb7'),'raw':!![]});var _0x14880a=[{'model':db['FaxMessage'],'as':_0xf608('0xb8'),'attributes':['id',_0xf608('0x67'),_0xf608('0x6a')],'include':_0x573364}];return db[_0xf608('0x2c')]['find']({'where':{'id':_0x3b2855[_0xf608('0x9c')]['id']},'include':_0x14880a})[_0xf608('0x1e')](handleEntityNotFound(_0x29224d,null))[_0xf608('0x1e')](function(_0x5b316f){if(_0x5b316f&&_0x5b316f[_0xf608('0xb8')]){var _0x17c9d9=_0x5b316f['get']({'plain':!![]});fs['mkdirSync'](_0x23ff4b);for(var _0xbf07d2=0x0;_0xbf07d2<_0x17c9d9['Messages'][_0xf608('0x53')];_0xbf07d2++){var _0x6b7435=_0x17c9d9[_0xf608('0xb8')][_0xbf07d2][_0xf608('0xb7')];if(_0x6b7435){var _0x59f28e=path['join'](_0x56ac5a,_0x6b7435[_0xf608('0xb9')]);if(fs['existsSync'](_0x59f28e)){fs['createReadStream'](_0x59f28e)['pipe'](fs['createWriteStream'](path[_0xf608('0xb1')](_0x23ff4b,_0x6b7435[_0xf608('0xb9')])));}}}return BPromise[_0xf608('0xba')]()['then'](function(){return new BPromise(function(_0x1cd5b1,_0x38ba80){zipdir(_0x23ff4b,{'saveTo':_0x1988e4},function(_0x4dc8c4,_0x2d6881){if(_0x4dc8c4)return _0x38ba80(_0x4dc8c4);return _0x1cd5b1(_0x2d6881);});})[_0xf608('0x1e')](function(){return new BPromise(function(_0x44caa4,_0x543ae9){rimraf(_0x23ff4b,function(_0xeee1b){if(_0xeee1b)_0x543ae9(_0xeee1b);return _0x44caa4();});});})[_0xf608('0x1e')](function(){return _0x29224d[_0xf608('0xbb')](_0x1988e4,_0x3da8a4,function(_0x4d8579){if(_0x4d8579){console[_0xf608('0xbc')](_0xf608('0xbd'),_0x4d8579);}else{fs['unlinkSync'](_0x1988e4);}});});});}else{return _0x29224d[_0xf608('0x14')](0xc8);}})['catch'](handleError(_0x29224d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 82e7efa..7b1781a 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +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(_0x3f9431,_0x15e647){_0x3f9431=_0x3f9431-0x0;var _0x3abb22=_0x2ef3[_0x3f9431];return _0x3abb22;};'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 3896a50..e013fc1 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 _0x286c=['moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x5bfad5,_0x582492){var _0x367170=function(_0x1f134e){while(--_0x1f134e){_0x5bfad5['push'](_0x5bfad5['shift']());}};_0x367170(++_0x582492);}(_0x286c,0x182));var _0xc286=function(_0x2eecb2,_0x4fd7b9){_0x2eecb2=_0x2eecb2-0x0;var _0x367dab=_0x286c[_0x2eecb2];return _0x367dab;};'use strict';var _=require(_0xc286('0x0'));var util=require(_0xc286('0x1'));var logger=require(_0xc286('0x2'))(_0xc286('0x3'));var moment=require(_0xc286('0x4'));var BPromise=require(_0xc286('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc286('0x6'));var config=require(_0xc286('0x7'));var attributes=require(_0xc286('0x8'));module[_0xc286('0x9')]=function(_0x5d73d0,_0x482d31){return _0x5d73d0['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b4af0,_0x32113c,_0x4c0c49){if(_0x1b4af0[_0xc286('0xa')](_0xc286('0xb'))){_0x1b4af0[_0xc286('0xc')]=moment()[_0xc286('0xd')](_0xc286('0xe'));}_0x4c0c49(null,_0x1b4af0);}}});}; \ No newline at end of file +var _0x20fe=['fax_interactions','closed','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x20fe,0xb8));var _0xe20f=function(_0x57c2c8,_0xa3c461){_0x57c2c8=_0x57c2c8-0x0;var _0x909e36=_0x20fe[_0x57c2c8];return _0x909e36;};'use strict';var _=require('lodash');var util=require(_0xe20f('0x0'));var logger=require(_0xe20f('0x1'))(_0xe20f('0x2'));var moment=require(_0xe20f('0x3'));var BPromise=require(_0xe20f('0x4'));var rp=require(_0xe20f('0x5'));var fs=require('fs');var path=require(_0xe20f('0x6'));var rimraf=require(_0xe20f('0x7'));var config=require(_0xe20f('0x8'));var attributes=require(_0xe20f('0x9'));module[_0xe20f('0xa')]=function(_0x2b5179,_0x5b2449){return _0x2b5179['define'](_0xe20f('0xb'),attributes,{'tableName':_0xe20f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c077c,_0x1a92cb,_0x113502){if(_0x5c077c['changed'](_0xe20f('0xd'))){_0x5c077c['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x113502(null,_0x5c077c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 74b9c52..53656af 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 _0x1b6d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','debug','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x4caa1d,_0x10257b){var _0x52a125=function(_0x246cb7){while(--_0x246cb7){_0x4caa1d['push'](_0x4caa1d['shift']());}};_0x52a125(++_0x10257b);}(_0x1b6d,0x1ea));var _0xd1b6=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1b6d[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd1b6('0x0'));var util=require(_0xd1b6('0x1'));var moment=require('moment');var BPromise=require(_0xd1b6('0x2'));var rs=require(_0xd1b6('0x3'));var fs=require('fs');var Redis=require(_0xd1b6('0x4'));var db=require(_0xd1b6('0x5'))['db'];var utils=require(_0xd1b6('0x6'));var logger=require(_0xd1b6('0x7'))('rpc');var config=require(_0xd1b6('0x8'));var jayson=require(_0xd1b6('0x9'));var client=jayson[_0xd1b6('0xa')]['http']({'port':0x232a});config[_0xd1b6('0xb')]=_[_0xd1b6('0xc')](config[_0xd1b6('0xb')],{'host':_0xd1b6('0xd'),'port':0x18eb});var socket=require(_0xd1b6('0xe'))(new Redis(config[_0xd1b6('0xb')]));require(_0xd1b6('0xf'))[_0xd1b6('0x10')](socket);function respondWithRpcPromise(_0x16c8dd,_0x1fb4f2,_0x357271){return new BPromise(function(_0x19198a,_0x567298){return client['request'](_0x16c8dd,_0x357271)[_0xd1b6('0x11')](function(_0x278e91){logger[_0xd1b6('0x12')](_0xd1b6('0x13'),_0x1fb4f2,_0xd1b6('0x14'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1fb4f2,_0xd1b6('0x14'),JSON['stringify'](_0x278e91));if(_0x278e91[_0xd1b6('0x15')]){if(_0x278e91[_0xd1b6('0x15')][_0xd1b6('0x16')]===0x1f4){logger[_0xd1b6('0x15')](_0xd1b6('0x13'),_0x1fb4f2,_0x278e91[_0xd1b6('0x15')][_0xd1b6('0x17')]);return _0x567298(_0x278e91['error']['message']);}logger[_0xd1b6('0x15')](_0xd1b6('0x13'),_0x1fb4f2,_0x278e91[_0xd1b6('0x15')][_0xd1b6('0x17')]);return _0x19198a(_0x278e91['error'][_0xd1b6('0x17')]);}else{logger[_0xd1b6('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x1fb4f2,_0xd1b6('0x14'));_0x19198a(_0x278e91[_0xd1b6('0x18')][_0xd1b6('0x17')]);}})[_0xd1b6('0x19')](function(_0x13c021){logger['error'](_0xd1b6('0x13'),_0x1fb4f2,_0x13c021);_0x567298(_0x13c021);});});}exports[_0xd1b6('0x1a')]=function(_0x5eb5ce){var _0x32e3a6=this;return new Promise(function(_0x4425c9,_0xd2247c){return db[_0xd1b6('0x1b')][_0xd1b6('0x1c')](_0x5eb5ce[_0xd1b6('0x1d')],{'raw':_0x5eb5ce['options']?_0x5eb5ce[_0xd1b6('0x1e')][_0xd1b6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eb5ce[_0xd1b6('0x1e')]?_0x5eb5ce['options'][_0xd1b6('0x20')]||null:null,'attributes':_0x5eb5ce[_0xd1b6('0x1e')]?_0x5eb5ce['options'][_0xd1b6('0x21')]||null:null,'limit':_0x5eb5ce['options']?_0x5eb5ce['options']['limit']||null:null})[_0xd1b6('0x11')](function(_0x23fb97){logger['info'](_0xd1b6('0x1a'),_0x5eb5ce);logger[_0xd1b6('0x22')]('UpdateFaxInteraction',_0x5eb5ce,JSON['stringify'](_0x23fb97));_0x4425c9(_0x23fb97);})[_0xd1b6('0x19')](function(_0x7ea2fe){logger[_0xd1b6('0x15')](_0xd1b6('0x1a'),_0x7ea2fe[_0xd1b6('0x17')],_0x5eb5ce);_0xd2247c(_0x32e3a6['error'](0x1f4,_0x7ea2fe[_0xd1b6('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x219b7e){return new Promise(function(_0x599546,_0x37448f){return db[_0xd1b6('0x1b')][_0xd1b6('0x23')]({'where':_0x219b7e[_0xd1b6('0x1e')]?_0x219b7e[_0xd1b6('0x1e')][_0xd1b6('0x20')]||null:null})['then'](function(_0x5c5aad){if(_0x5c5aad){return _0x5c5aad[_0xd1b6('0x24')](_0x219b7e[_0xd1b6('0x1d')][_0xd1b6('0x25')],_[_0xd1b6('0x26')](_0x219b7e['body'],[_0xd1b6('0x25'),'id'])||{});}})[_0xd1b6('0x27')](function(_0x1998c9){logger['info']('AddTags',_0x219b7e);logger[_0xd1b6('0x22')](_0xd1b6('0x28'),_0x219b7e,JSON['stringify'](_0x1998c9));_0x599546(_0x1998c9);})[_0xd1b6('0x19')](function(_0x28bc26){logger[_0xd1b6('0x15')](_0xd1b6('0x28'),_0x28bc26[_0xd1b6('0x17')],_0x219b7e);_0x37448f(_this[_0xd1b6('0x15')](0x1f4,_0x28bc26[_0xd1b6('0x17')]));});});}; \ No newline at end of file +var _0x5257=['find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','then','info','request\x20sent','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','limit','debug','AddTagsToFaxInteraction'];(function(_0x2054a7,_0x45b63c){var _0x2f4d52=function(_0x2ccba2){while(--_0x2ccba2){_0x2054a7['push'](_0x2054a7['shift']());}};_0x2f4d52(++_0x45b63c);}(_0x5257,0x1f2));var _0x7525=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x5257[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x7525('0x0'));var util=require(_0x7525('0x1'));var moment=require(_0x7525('0x2'));var BPromise=require(_0x7525('0x3'));var rs=require(_0x7525('0x4'));var fs=require('fs');var Redis=require(_0x7525('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7525('0x6'))(_0x7525('0x7'));var config=require(_0x7525('0x8'));var jayson=require(_0x7525('0x9'));var client=jayson[_0x7525('0xa')][_0x7525('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7525('0xc')],{'host':_0x7525('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7525('0xe'))[_0x7525('0xf')](socket);function respondWithRpcPromise(_0x2bd41d,_0x4b36df,_0x39519e){return new BPromise(function(_0x52c8db,_0xabfe5b){return client['request'](_0x2bd41d,_0x39519e)[_0x7525('0x10')](function(_0xd0e9dc){logger[_0x7525('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x4b36df,_0x7525('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4b36df,'request\x20sent',JSON[_0x7525('0x13')](_0xd0e9dc));if(_0xd0e9dc[_0x7525('0x14')]){if(_0xd0e9dc['error'][_0x7525('0x15')]===0x1f4){logger[_0x7525('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4b36df,_0xd0e9dc[_0x7525('0x14')][_0x7525('0x16')]);return _0xabfe5b(_0xd0e9dc[_0x7525('0x14')][_0x7525('0x16')]);}logger['error'](_0x7525('0x17'),_0x4b36df,_0xd0e9dc[_0x7525('0x14')][_0x7525('0x16')]);return _0x52c8db(_0xd0e9dc[_0x7525('0x14')][_0x7525('0x16')]);}else{logger['info'](_0x7525('0x17'),_0x4b36df,_0x7525('0x12'));_0x52c8db(_0xd0e9dc[_0x7525('0x18')][_0x7525('0x16')]);}})[_0x7525('0x19')](function(_0x1b773d){logger[_0x7525('0x14')](_0x7525('0x17'),_0x4b36df,_0x1b773d);_0xabfe5b(_0x1b773d);});});}exports[_0x7525('0x1a')]=function(_0x125783){var _0x2d03f3=this;return new Promise(function(_0x5719da,_0x5bd9fa){return db[_0x7525('0x1b')][_0x7525('0x1c')](_0x125783['body'],{'raw':_0x125783['options']?_0x125783[_0x7525('0x1d')][_0x7525('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x125783[_0x7525('0x1d')]?_0x125783[_0x7525('0x1d')][_0x7525('0x1f')]||null:null,'attributes':_0x125783[_0x7525('0x1d')]?_0x125783[_0x7525('0x1d')]['attributes']||null:null,'limit':_0x125783[_0x7525('0x1d')]?_0x125783[_0x7525('0x1d')][_0x7525('0x20')]||null:null})[_0x7525('0x10')](function(_0x4fdac6){logger[_0x7525('0x11')]('UpdateFaxInteraction',_0x125783);logger[_0x7525('0x21')](_0x7525('0x1a'),_0x125783,JSON[_0x7525('0x13')](_0x4fdac6));_0x5719da(_0x4fdac6);})[_0x7525('0x19')](function(_0x1a115b){logger[_0x7525('0x14')](_0x7525('0x1a'),_0x1a115b[_0x7525('0x16')],_0x125783);_0x5bd9fa(_0x2d03f3[_0x7525('0x14')](0x1f4,_0x1a115b[_0x7525('0x16')]));});});};exports[_0x7525('0x22')]=function(_0x50baf7){return new Promise(function(_0x29585c,_0x119215){return db[_0x7525('0x1b')][_0x7525('0x23')]({'where':_0x50baf7[_0x7525('0x1d')]?_0x50baf7[_0x7525('0x1d')][_0x7525('0x1f')]||null:null})[_0x7525('0x10')](function(_0x556ae9){if(_0x556ae9){return _0x556ae9[_0x7525('0x24')](_0x50baf7[_0x7525('0x25')][_0x7525('0x26')],_[_0x7525('0x27')](_0x50baf7['body'],[_0x7525('0x26'),'id'])||{});}})['spread'](function(_0x403cb2){logger['info'](_0x7525('0x28'),_0x50baf7);logger[_0x7525('0x21')](_0x7525('0x28'),_0x50baf7,JSON[_0x7525('0x13')](_0x403cb2));_0x29585c(_0x403cb2);})[_0x7525('0x19')](function(_0x2c192a){logger[_0x7525('0x14')](_0x7525('0x28'),_0x2c192a[_0x7525('0x16')],_0x50baf7);_0x119215(_this[_0x7525('0x14')](0x1f4,_0x2c192a[_0x7525('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c55ce01..c611fae 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 _0x4929=['update','emit','removeListener','length','./faxInteraction.events','remove'];(function(_0x37dd26,_0x54088a){var _0x29bf51=function(_0x7881b8){while(--_0x7881b8){_0x37dd26['push'](_0x37dd26['shift']());}};_0x29bf51(++_0x54088a);}(_0x4929,0x8e));var _0x9492=function(_0x5b46ac,_0x394c2e){_0x5b46ac=_0x5b46ac-0x0;var _0x430729=_0x4929[_0x5b46ac];return _0x430729;};'use strict';var FaxInteractionEvents=require(_0x9492('0x0'));var events=['save',_0x9492('0x1'),_0x9492('0x2')];function createListener(_0x35bc1d,_0x24623e){return function(_0x120dbd){_0x24623e[_0x9492('0x3')](_0x35bc1d,_0x120dbd);};}function removeListener(_0x3a1a92,_0x331801){return function(){FaxInteractionEvents[_0x9492('0x4')](_0x3a1a92,_0x331801);};}exports['register']=function(_0x927130){for(var _0x3bb459=0x0,_0x4b82e8=events[_0x9492('0x5')];_0x3bb459<_0x4b82e8;_0x3bb459++){var _0x164cc9=events[_0x3bb459];var _0x38022a=createListener('faxInteraction:'+_0x164cc9,_0x927130);FaxInteractionEvents['on'](_0x164cc9,_0x38022a);}}; \ No newline at end of file +var _0x69c7=['save','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x4a3b28,_0x41fc7c){var _0x394c74=function(_0x3a30e5){while(--_0x3a30e5){_0x4a3b28['push'](_0x4a3b28['shift']());}};_0x394c74(++_0x41fc7c);}(_0x69c7,0x1a4));var _0x769c=function(_0x2ec893,_0x47c0e1){_0x2ec893=_0x2ec893-0x0;var _0x4db38a=_0x69c7[_0x2ec893];return _0x4db38a;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x769c('0x0'),'remove',_0x769c('0x1')];function createListener(_0x191751,_0x3207fa){return function(_0x571b54){_0x3207fa[_0x769c('0x2')](_0x191751,_0x571b54);};}function removeListener(_0x5b1039,_0x3ac370){return function(){FaxInteractionEvents[_0x769c('0x3')](_0x5b1039,_0x3ac370);};}exports[_0x769c('0x4')]=function(_0x460f91){for(var _0x3f60e8=0x0,_0xdafcb=events[_0x769c('0x5')];_0x3f60e8<_0xdafcb;_0x3f60e8++){var _0x42ffa9=events[_0x3f60e8];var _0x2c6967=createListener(_0x769c('0x6')+_0x42ffa9,_0x460f91);FaxInteractionEvents['on'](_0x42ffa9,_0x2c6967);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1ca65b8..24493cc 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 _0x878f=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x65f7d6,_0x37b82e){var _0x381dad=function(_0x50cf48){while(--_0x50cf48){_0x65f7d6['push'](_0x65f7d6['shift']());}};_0x381dad(++_0x37b82e);}(_0x878f,0x173));var _0xf878=function(_0x24f2c9,_0x231c94){_0x24f2c9=_0x24f2c9-0x0;var _0x191357=_0x878f[_0x24f2c9];return _0x191357;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['get'](_0xf878('0xc'),auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router['get'](_0xf878('0xe'),auth[_0xf878('0xa')](),controller['download']);router[_0xf878('0xf')]('/',auth['isAuthenticated'](),controller[_0xf878('0x10')]);router[_0xf878('0xf')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0xf')](_0xf878('0x12'),auth['isAuthenticated'](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x15')),controller['addTags']);router['put'](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x17')),controller[_0xf878('0x18')]);router[_0xf878('0x19')](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),'faxinteraction:destroy'),controller[_0xf878('0x1a')]);router[_0xf878('0x19')](_0xf878('0x12'),auth[_0xf878('0xa')](),controller[_0xf878('0x1b')]);module[_0xf878('0x1c')]=router; \ No newline at end of file +var _0x153f=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x2d2d62,_0x10b23f){var _0xb7d7d6=function(_0x2fb215){while(--_0x2fb215){_0x2d2d62['push'](_0x2d2d62['shift']());}};_0xb7d7d6(++_0x10b23f);}(_0x153f,0x15b));var _0xf153=function(_0x567f1e,_0x412f5a){_0x567f1e=_0x567f1e-0x0;var _0x5517a5=_0x153f[_0x567f1e];return _0x5517a5;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var auth=require(_0xf153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf153('0x7'));var controller=require('./faxInteraction.controller');router[_0xf153('0x8')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x8')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0xc')]);router[_0xf153('0x8')](_0xf153('0xd'),auth[_0xf153('0x9')](),controller[_0xf153('0xe')]);router[_0xf153('0x8')](_0xf153('0xf'),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x8')]('/:id/download',auth[_0xf153('0x9')](),controller[_0xf153('0x11')]);router[_0xf153('0x12')]('/',auth['isAuthenticated'](),controller[_0xf153('0x13')]);router[_0xf153('0x12')](_0xf153('0xf'),auth[_0xf153('0x9')](),controller[_0xf153('0x14')]);router[_0xf153('0x12')](_0xf153('0x15'),auth[_0xf153('0x9')](),interaction[_0xf153('0x16')]('fax',_0xf153('0x17')),controller[_0xf153('0x18')]);router[_0xf153('0x19')](_0xf153('0xd'),auth[_0xf153('0x9')](),interaction[_0xf153('0x16')](_0xf153('0x1a'),_0xf153('0x1b')),controller['update']);router[_0xf153('0x1c')]('/:id',auth[_0xf153('0x9')](),interaction[_0xf153('0x16')](_0xf153('0x1a'),_0xf153('0x1d')),controller['destroy']);router[_0xf153('0x1c')](_0xf153('0x15'),auth[_0xf153('0x9')](),controller[_0xf153('0x1e')]);module[_0xf153('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b879f44..f80dc39 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 _0x8c80=['sequelize','TEXT','BOOLEAN','ENUM'];(function(_0x29172d,_0x214b33){var _0x504151=function(_0x371d3a){while(--_0x371d3a){_0x29172d['push'](_0x29172d['shift']());}};_0x504151(++_0x214b33);}(_0x8c80,0x19c));var _0x08c8=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x8c80[_0x13c70c];return _0x50f0f2;};'use strict';var Sequelize=require(_0x08c8('0x0'));module['exports']={'body':{'type':Sequelize[_0x08c8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x08c8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x08c8('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x08c8('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x83a5=['BOOLEAN','ENUM','out','sequelize','TEXT','medium'];(function(_0x369de6,_0x9836f){var _0x4cf7af=function(_0x168cb0){while(--_0x168cb0){_0x369de6['push'](_0x369de6['shift']());}};_0x4cf7af(++_0x9836f);}(_0x83a5,0x1a7));var _0x583a=function(_0x260518,_0x479142){_0x260518=_0x260518-0x0;var _0x195f9e=_0x83a5[_0x260518];return _0x195f9e;};'use strict';var Sequelize=require(_0x583a('0x0'));module['exports']={'body':{'type':Sequelize[_0x583a('0x1')](_0x583a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x583a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x583a('0x4')]('in',_0x583a('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x583a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7c1bc22..cf6e0b4 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 _0x97c1=['request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','count','includeAll','include','FaxMessage','rows','show','params','find','update','body','fax-interactions','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','read1stAt','interaction','get','role','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','channel','event','EventManager','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s'];(function(_0x501099,_0x223250){var _0x555ebf=function(_0x4139ab){while(--_0x4139ab){_0x501099['push'](_0x501099['shift']());}};_0x555ebf(++_0x223250);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x197c('0x0'));var emlformat=require(_0x197c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x197c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x197c('0x3'));var BPromise=require(_0x197c('0x4'));var Mustache=require(_0x197c('0x5'));var util=require(_0x197c('0x6'));var path=require(_0x197c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x197c('0x8'));var fs=require('fs');var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];config[_0x197c('0x17')]=_[_0x197c('0x18')](config[_0x197c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x197c('0x19'))(new Redis(config[_0x197c('0x17')]));require(_0x197c('0x1a'))[_0x197c('0x1b')](socket);var jayson=require(_0x197c('0x1c'));var client=jayson[_0x197c('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x197c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bc612,_0x2083d4,_0x24901f,_0x33f8d3){return new BPromise(function(_0x7e302f,_0x437050){var _0x75beba=_0x33f8d3||client;return _0x75beba['request'](_0x2bc612,_0x24901f)[_0x197c('0x1f')](function(_0x47aaa9){logger['info'](_0x197c('0x20'),_0x2083d4,_0x197c('0x21'));logger[_0x197c('0x22')](_0x197c('0x23'),_0x2083d4,'request\x20sent',JSON[_0x197c('0x24')](_0x47aaa9));if(_0x47aaa9[_0x197c('0x25')]){if(_0x47aaa9[_0x197c('0x25')]['code']===0x1f4){logger[_0x197c('0x25')](_0x197c('0x20'),_0x2083d4,_0x47aaa9[_0x197c('0x25')][_0x197c('0x26')]);return _0x437050(_0x47aaa9[_0x197c('0x25')][_0x197c('0x26')]);}logger[_0x197c('0x25')](_0x197c('0x20'),_0x2083d4,_0x47aaa9[_0x197c('0x25')][_0x197c('0x26')]);return _0x7e302f(_0x47aaa9[_0x197c('0x25')][_0x197c('0x26')]);}else{logger[_0x197c('0x27')](_0x197c('0x20'),_0x2083d4,_0x197c('0x21'));_0x7e302f(_0x47aaa9[_0x197c('0x28')]['message']);}})[_0x197c('0x29')](function(_0x2911dd){logger[_0x197c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x2083d4,_0x2911dd);_0x437050(_0x2911dd);});});}function respondWithStatusCode(_0x2c2952,_0x3331ac){_0x3331ac=_0x3331ac||0xcc;return function(_0x4c3337){if(_0x4c3337){return _0x2c2952['sendStatus'](_0x3331ac);}return _0x2c2952[_0x197c('0x2a')](_0x3331ac)['end']();};}function respondWithResult(_0xfbca7a,_0x14b0aa){_0x14b0aa=_0x14b0aa||0xc8;return function(_0x4e9a06){if(_0x4e9a06){return _0xfbca7a[_0x197c('0x2a')](_0x14b0aa)[_0x197c('0x2b')](_0x4e9a06);}};}function respondWithFilteredResult(_0x3cdcd8,_0x2b6154){return function(_0x215df1){if(_0x215df1){var _0x4422d1=_0x215df1['count'],_0x5df39e=_0x2b6154[_0x197c('0x2c')],_0x50dea3=_0x2b6154['offset']+_0x2b6154[_0x197c('0x2d')],_0x574274;if(_0x50dea3>=_0x4422d1){_0x50dea3=_0x4422d1;_0x574274=0xc8;}else{_0x574274=0xce;}_0x3cdcd8[_0x197c('0x2a')](_0x574274);return _0x3cdcd8['set'](_0x197c('0x2e'),_0x5df39e+'-'+_0x50dea3+'/'+_0x4422d1)['json'](_0x215df1);}return null;};}function patchUpdates(_0x419202){return function(_0x1155e1){try{jsonpatch[_0x197c('0x2f')](_0x1155e1,_0x419202,!![]);}catch(_0x365f9f){return BPromise[_0x197c('0x30')](_0x365f9f);}return _0x1155e1[_0x197c('0x31')]();};}function saveUpdates(_0x176d83,_0x41d792){return function(_0x1e974e){if(_0x1e974e){return _0x1e974e['update'](_0x176d83)['then'](function(_0x2a58f6){return _0x2a58f6;});}return null;};}function removeEntity(_0x3af036,_0x3c56e3){return function(_0x147257){if(_0x147257){return _0x147257[_0x197c('0x32')]()[_0x197c('0x1f')](function(){_0x3af036[_0x197c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54e6be,_0x146f59){return function(_0x70a54){if(!_0x70a54){_0x54e6be['sendStatus'](0x194);}return _0x70a54;};}function handleError(_0x5bebe7,_0x3cdaa1){_0x3cdaa1=_0x3cdaa1||0x1f4;return function(_0x2a884b){logger[_0x197c('0x25')](_0x2a884b[_0x197c('0x33')]);if(_0x2a884b[_0x197c('0x34')]){delete _0x2a884b[_0x197c('0x34')];}_0x5bebe7[_0x197c('0x2a')](_0x3cdaa1)[_0x197c('0x35')](_0x2a884b);};}exports[_0x197c('0x36')]=function(_0x4dbbfb,_0x330f51){var _0x221788={},_0x358900={},_0x41269e={'count':0x0,'rows':[]};var _0x14d169=_[_0x197c('0x37')](db['FaxMessage'][_0x197c('0x38')],function(_0xfb5f3e){return{'name':_0xfb5f3e[_0x197c('0x39')],'type':_0xfb5f3e['type'][_0x197c('0x3a')]};});_0x358900[_0x197c('0x3b')]=_[_0x197c('0x37')](_0x14d169,_0x197c('0x34'));_0x358900[_0x197c('0x3c')]=_[_0x197c('0x3d')](_0x4dbbfb[_0x197c('0x3c')]);_0x358900[_0x197c('0x3e')]=_[_0x197c('0x3f')](_0x358900[_0x197c('0x3b')],_0x358900['query']);_0x221788[_0x197c('0x40')]=_[_0x197c('0x3f')](_0x358900['model'],qs['fields'](_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x41')]));_0x221788[_0x197c('0x40')]=_0x221788[_0x197c('0x40')][_0x197c('0x42')]?_0x221788['attributes']:_0x358900[_0x197c('0x3b')];if(!_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x43')](_0x197c('0x44'))){_0x221788[_0x197c('0x2d')]=qs['limit'](_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x2d')]);_0x221788[_0x197c('0x2c')]=qs[_0x197c('0x2c')](_0x4dbbfb[_0x197c('0x3c')]['offset']);}_0x221788[_0x197c('0x45')]=qs[_0x197c('0x46')](_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x46')]);_0x221788[_0x197c('0x47')]=qs[_0x197c('0x3e')](_[_0x197c('0x48')](_0x4dbbfb[_0x197c('0x3c')],_0x358900[_0x197c('0x3e')]),_0x14d169);if(_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x49')]){_0x221788['where']=_['merge'](_0x221788['where'],{'$or':_['map'](_0x14d169,function(_0x256501){if(_0x256501[_0x197c('0x4a')]!=='VIRTUAL'){var _0x1da40c={};_0x1da40c[_0x256501[_0x197c('0x34')]]={'$like':'%'+_0x4dbbfb['query'][_0x197c('0x49')]+'%'};return _0x1da40c;}})});}_0x221788=_[_0x197c('0x4b')]({},_0x221788,_0x4dbbfb['options']);var _0x327155={'where':_0x221788[_0x197c('0x47')]};return db['FaxMessage'][_0x197c('0x4c')](_0x327155)[_0x197c('0x1f')](function(_0x3805d4){_0x41269e['count']=_0x3805d4;if(_0x4dbbfb[_0x197c('0x3c')][_0x197c('0x4d')]){_0x221788[_0x197c('0x4e')]=[{'all':!![]}];}return db[_0x197c('0x4f')]['findAll'](_0x221788);})[_0x197c('0x1f')](function(_0x42491b){_0x41269e[_0x197c('0x50')]=_0x42491b;return _0x41269e;})['then'](respondWithFilteredResult(_0x330f51,_0x221788))['catch'](handleError(_0x330f51,null));};exports[_0x197c('0x51')]=function(_0x332c75,_0x364bc5){var _0x108f6d={'raw':!![],'where':{'id':_0x332c75[_0x197c('0x52')]['id']}},_0x11025f={};_0x11025f['model']=_[_0x197c('0x3d')](db['FaxMessage'][_0x197c('0x38')]);_0x11025f[_0x197c('0x3c')]=_[_0x197c('0x3d')](_0x332c75[_0x197c('0x3c')]);_0x11025f[_0x197c('0x3e')]=_[_0x197c('0x3f')](_0x11025f[_0x197c('0x3b')],_0x11025f[_0x197c('0x3c')]);_0x108f6d['attributes']=_[_0x197c('0x3f')](_0x11025f[_0x197c('0x3b')],qs[_0x197c('0x41')](_0x332c75['query'][_0x197c('0x41')]));_0x108f6d['attributes']=_0x108f6d[_0x197c('0x40')][_0x197c('0x42')]?_0x108f6d[_0x197c('0x40')]:_0x11025f[_0x197c('0x3b')];if(_0x332c75[_0x197c('0x3c')][_0x197c('0x4d')]){_0x108f6d[_0x197c('0x4e')]=[{'all':!![]}];}_0x108f6d=_[_0x197c('0x4b')]({},_0x108f6d,_0x332c75['options']);return db[_0x197c('0x4f')][_0x197c('0x53')](_0x108f6d)[_0x197c('0x1f')](handleEntityNotFound(_0x364bc5,null))['then'](respondWithResult(_0x364bc5,null))[_0x197c('0x29')](handleError(_0x364bc5,null));};exports[_0x197c('0x54')]=function(_0x1be579,_0x1043a5){if(_0x1be579[_0x197c('0x55')]['id']){delete _0x1be579['body']['id'];}return db['FaxMessage'][_0x197c('0x53')]({'where':{'id':_0x1be579[_0x197c('0x52')]['id']}})[_0x197c('0x1f')](handleEntityNotFound(_0x1043a5,null))[_0x197c('0x1f')](saveUpdates(_0x1be579[_0x197c('0x55')],null))['then'](respondWithResult(_0x1043a5,null))['catch'](handleError(_0x1043a5,null));};exports[_0x197c('0x32')]=function(_0x2974a5,_0x5855bd){return db[_0x197c('0x4f')][_0x197c('0x53')]({'where':{'id':_0x2974a5[_0x197c('0x52')]['id']}})[_0x197c('0x1f')](handleEntityNotFound(_0x5855bd,null))[_0x197c('0x1f')](removeEntity(_0x5855bd,null))[_0x197c('0x29')](handleError(_0x5855bd,null));};exports['describe']=function(_0x431100,_0x145939){return db['FaxMessage']['describe']()[_0x197c('0x1f')](respondWithResult(_0x145939,null))['catch'](handleError(_0x145939,null));};var interaction_log=require(_0x197c('0x12'))(_0x197c('0x56'));exports[_0x197c('0x57')]=function(_0x487c37,_0x104034,_0x3da366){var _0x5585de={'agent':{},'channel':_0x197c('0x58')};if(_0x487c37[_0x197c('0x55')]['id']){delete _0x487c37[_0x197c('0x55')]['id'];}_0x487c37['body'][_0x197c('0x59')]=!![];_0x487c37[_0x197c('0x55')]['readAt']=moment()['format'](_0x197c('0x5a'));_0x487c37[_0x197c('0x55')][_0x197c('0x5b')]=_0x487c37['body'][_0x197c('0x5b')]||_0x487c37[_0x197c('0x5c')]['id'];_0x5585de[_0x197c('0x5d')]['id']=_0x487c37['body'][_0x197c('0x5b')];return db[_0x197c('0x4f')][_0x197c('0x53')]({'where':{'id':_0x487c37[_0x197c('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x197c('0x5e')],'as':_0x197c('0x5f')}]})[_0x197c('0x1f')](handleEntityNotFound(_0x104034,null))[_0x197c('0x1f')](saveUpdates(_0x487c37[_0x197c('0x55')],null))[_0x197c('0x1f')](function(_0x5ef485){if(_0x5ef485){_0x5585de[_0x197c('0x26')]=_0x5ef485['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x5ef485['FaxInteractionId']}});}return null;})[_0x197c('0x1f')](handleEntityNotFound(_0x104034,null))[_0x197c('0x1f')](function(_0xbf0481){if(_0xbf0481){return _0xbf0481[_0x197c('0x54')]({'UserId':_0x487c37['body'][_0x197c('0x5b')],'read1stAt':_['isNil'](_0xbf0481[_0x197c('0x60')])?moment()['format'](_0x197c('0x5a')):undefined});}return null;})['then'](function(_0x12d31a){if(_0x12d31a){_0x5585de[_0x197c('0x61')]=_0x12d31a[_0x197c('0x62')]({'plain':!![]});interaction_log[_0x197c('0x27')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x487c37[_0x197c('0x5c')]['id'],_0x487c37[_0x197c('0x5c')][_0x197c('0x34')],_0x487c37['user'][_0x197c('0x63')],_0x5585de[_0x197c('0x61')]['id'],_0x487c37[_0x197c('0x55')]?JSON[_0x197c('0x24')](_0x487c37[_0x197c('0x55')]):_0x197c('0x64'));return respondWithRpcPromise(_0x197c('0x65'),_0x197c('0x66'),_0x5585de);}return null;})[_0x197c('0x1f')](function(_0x1947bd){if(_0x1947bd){if(_0x487c37[_0x197c('0x55')][_0x197c('0x67')]){_0x5585de[_0x197c('0x26')][_0x197c('0x68')]=util[_0x197c('0x69')](_0x197c('0x6a'),_0x487c37[_0x197c('0x5c')][_0x197c('0x34')]);_0x5585de['message']['channel']=_0x5585de['channel'];_0x5585de[_0x197c('0x26')]['event']=_0x197c('0x57');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x197c('0x6b'),'message':_0x5585de[_0x197c('0x26')]},client9002)[_0x197c('0x1f')](function(){return _0x5585de;});}return _0x5585de;}return null;})['then'](respondWithResult(_0x104034,null))[_0x197c('0x29')](handleError(_0x104034,null));};var interaction_log=require(_0x197c('0x12'))('fax-interactions');exports[_0x197c('0x30')]=function(_0xf0ca80,_0xfb27c2,_0x1ac651){var _0x54206a={'agent':{},'channel':_0x197c('0x58')};if(_0xf0ca80['body']['id']){delete _0xf0ca80[_0x197c('0x55')]['id'];}_0xf0ca80['body'][_0x197c('0x5b')]=_0xf0ca80[_0x197c('0x55')][_0x197c('0x5b')]||_0xf0ca80['user']['id'];_0x54206a[_0x197c('0x5d')]['id']=_0xf0ca80[_0x197c('0x55')][_0x197c('0x5b')];return db['FaxMessage'][_0x197c('0x53')]({'where':{'id':_0xf0ca80[_0x197c('0x52')]['id'],'UserId':null}})[_0x197c('0x1f')](handleEntityNotFound(_0xfb27c2,null))[_0x197c('0x1f')](function(_0xae273e){if(_0xae273e){_0x54206a[_0x197c('0x26')]=_0xae273e['get']({'plain':!![]});return db[_0x197c('0x6c')]['find']({'where':{'id':_0xae273e['FaxInteractionId']}});}return null;})[_0x197c('0x1f')](handleEntityNotFound(_0xfb27c2,null))[_0x197c('0x1f')](function(_0x58e708){if(_0x58e708){_0x54206a[_0x197c('0x61')]=_0x58e708[_0x197c('0x62')]({'plain':!![]});interaction_log[_0x197c('0x27')](_0x197c('0x6d'),_0xf0ca80[_0x197c('0x5c')]['id'],_0xf0ca80['user']['name'],_0xf0ca80['user']['role'],_0x54206a[_0x197c('0x61')]['id'],_0xf0ca80[_0x197c('0x55')]?JSON['stringify'](_0xf0ca80['body']):_0x197c('0x64'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x54206a);}return null;})[_0x197c('0x1f')](function(_0x182338){if(_0x182338){_0x182338[_0x197c('0x26')][_0x197c('0x68')]=util[_0x197c('0x69')](_0x197c('0x6a'),_0xf0ca80['user'][_0x197c('0x34')]);_0x182338[_0x197c('0x26')][_0x197c('0x6e')]=_0x54206a[_0x197c('0x6e')];_0x182338[_0x197c('0x26')][_0x197c('0x6f')]=_0x197c('0x30');respondWithRpcPromise('EventManager',_0x197c('0x70'),{'event':_0x197c('0x71'),'message':_0x182338[_0x197c('0x26')]},client9002);return _0x54206a;}return null;})[_0x197c('0x1f')](respondWithResult(_0xfb27c2,null))[_0x197c('0x29')](handleError(_0xfb27c2,null));};exports[_0x197c('0x72')]=function(_0x51811d,_0x704f3){var _0x2b09cd;return db['FaxMessage'][_0x197c('0x72')](_0x51811d[_0x197c('0x55')],{})[_0x197c('0x1f')](function(_0x13a742){_0x2b09cd=_0x13a742;return db[_0x197c('0x5e')]['findOne']({'where':{'id':_0x2b09cd['ContactId']}});})['then'](function(_0x4ceae9){if(_['isNil'](_0x4ceae9)){return;}else{_0x2b09cd['fax']=_0x4ceae9[_0x197c('0x58')];return db[_0x197c('0x73')][_0x197c('0x74')]({'where':{'id':_0x2b09cd[_0x197c('0x75')]}});}})[_0x197c('0x1f')](function(_0x542db6){return respondWithRpcPromise('SendFax',_0x197c('0x76'),{'FaxAccountId':_[_0x197c('0x77')](_0x51811d['body'])?undefined:_0x51811d[_0x197c('0x55')][_0x197c('0x78')],'path':_[_0x197c('0x77')](_0x542db6)?undefined:util[_0x197c('0x69')](_0x197c('0x79'),_0x542db6[_0x197c('0x7a')]),'fax':_['isNil'](_0x2b09cd[_0x197c('0x58')])?undefined:_0x2b09cd[_0x197c('0x58')],'AttachmentId':_0x2b09cd[_0x197c('0x75')]},client9002);})[_0x197c('0x1f')](respondWithResult(_0x704f3,0xc9))[_0x197c('0x29')](handleError(_0x704f3,null));};exports['download']=function(_0x525254,_0xe515a1){var _0x590996=path[_0x197c('0x7b')](config[_0x197c('0x7c')],_0x197c('0x7d'),_0x197c('0x7e'),_0x197c('0x7f'));return db['FaxMessage'][_0x197c('0x53')]({'where':{'id':_0x525254[_0x197c('0x52')]['id']},'include':[{'model':db[_0x197c('0x73')],'as':_0x197c('0x73')}]})['then'](handleEntityNotFound(_0xe515a1,null))['then'](function(_0x126399){if(_0x126399){return _0xe515a1['download'](path['join'](_0x590996,_0x126399[_0x197c('0x73')][_0x197c('0x7a')]));}})[_0x197c('0x29')](handleError(_0xe515a1,null));}; \ No newline at end of file +var _0x1399=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','register','client','then','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','merge','body','find','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','reject','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','create','CmContact','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','download','join','server','files','attachments','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xbcb777,_0xb0960){var _0x5aafed=function(_0x5db3d7){while(--_0x5db3d7){_0xbcb777['push'](_0xbcb777['shift']());}};_0x5aafed(++_0xb0960);}(_0x1399,0x16c));var _0x9139=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0x1399[_0x2bb82d];return _0x5e0b92;};'use strict';var pdf=require(_0x9139('0x0'));var emlformat=require(_0x9139('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9139('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9139('0x3'));var moment=require(_0x9139('0x4'));var BPromise=require(_0x9139('0x5'));var Mustache=require(_0x9139('0x6'));var util=require(_0x9139('0x7'));var path=require(_0x9139('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9139('0x9'));var fs=require('fs');var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9139('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9139('0x17'))(new Redis(config[_0x9139('0x16')]));require(_0x9139('0x18'))[_0x9139('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9139('0x1a')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x159e50,_0x3e2bad,_0x1cd24e,_0x3fadf7){return new BPromise(function(_0x18801b,_0x425be4){var _0x4bd957=_0x3fadf7||client;return _0x4bd957['request'](_0x159e50,_0x1cd24e)[_0x9139('0x1b')](function(_0xe39cbc){logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e2bad,_0x9139('0x1c'));logger[_0x9139('0x1d')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3e2bad,_0x9139('0x1c'),JSON[_0x9139('0x1e')](_0xe39cbc));if(_0xe39cbc[_0x9139('0x1f')]){if(_0xe39cbc[_0x9139('0x1f')][_0x9139('0x20')]===0x1f4){logger[_0x9139('0x1f')](_0x9139('0x21'),_0x3e2bad,_0xe39cbc[_0x9139('0x1f')][_0x9139('0x22')]);return _0x425be4(_0xe39cbc[_0x9139('0x1f')][_0x9139('0x22')]);}logger[_0x9139('0x1f')](_0x9139('0x21'),_0x3e2bad,_0xe39cbc[_0x9139('0x1f')][_0x9139('0x22')]);return _0x18801b(_0xe39cbc[_0x9139('0x1f')][_0x9139('0x22')]);}else{logger[_0x9139('0x23')](_0x9139('0x21'),_0x3e2bad,'request\x20sent');_0x18801b(_0xe39cbc[_0x9139('0x24')][_0x9139('0x22')]);}})['catch'](function(_0x3ed4da){logger[_0x9139('0x1f')](_0x9139('0x21'),_0x3e2bad,_0x3ed4da);_0x425be4(_0x3ed4da);});});}function respondWithStatusCode(_0x4a3ed2,_0x4118dc){_0x4118dc=_0x4118dc||0xcc;return function(_0xffd487){if(_0xffd487){return _0x4a3ed2['sendStatus'](_0x4118dc);}return _0x4a3ed2[_0x9139('0x25')](_0x4118dc)[_0x9139('0x26')]();};}function respondWithResult(_0x452d9a,_0x55e95f){_0x55e95f=_0x55e95f||0xc8;return function(_0x1c4cda){if(_0x1c4cda){return _0x452d9a[_0x9139('0x25')](_0x55e95f)[_0x9139('0x27')](_0x1c4cda);}};}function respondWithFilteredResult(_0x22994c,_0x215194){return function(_0x16dfb4){if(_0x16dfb4){var _0xfe6854=_0x16dfb4[_0x9139('0x28')],_0x573a05=_0x215194[_0x9139('0x29')],_0x55cc6a=_0x215194['offset']+_0x215194['limit'],_0x1b3fd9;if(_0x55cc6a>=_0xfe6854){_0x55cc6a=_0xfe6854;_0x1b3fd9=0xc8;}else{_0x1b3fd9=0xce;}_0x22994c[_0x9139('0x25')](_0x1b3fd9);return _0x22994c[_0x9139('0x2a')](_0x9139('0x2b'),_0x573a05+'-'+_0x55cc6a+'/'+_0xfe6854)[_0x9139('0x27')](_0x16dfb4);}return null;};}function patchUpdates(_0x1daf02){return function(_0x541644){try{jsonpatch['apply'](_0x541644,_0x1daf02,!![]);}catch(_0x2f26de){return BPromise['reject'](_0x2f26de);}return _0x541644['save']();};}function saveUpdates(_0x222429,_0x40821f){return function(_0x59e511){if(_0x59e511){return _0x59e511[_0x9139('0x2c')](_0x222429)[_0x9139('0x1b')](function(_0x5b609d){return _0x5b609d;});}return null;};}function removeEntity(_0x7e120f,_0x304789){return function(_0x278a92){if(_0x278a92){return _0x278a92[_0x9139('0x2d')]()[_0x9139('0x1b')](function(){_0x7e120f[_0x9139('0x25')](0xcc)[_0x9139('0x26')]();});}};}function handleEntityNotFound(_0x9c2926,_0x1e46a1){return function(_0xe53efc){if(!_0xe53efc){_0x9c2926[_0x9139('0x2e')](0x194);}return _0xe53efc;};}function handleError(_0x4a539f,_0x2f554a){_0x2f554a=_0x2f554a||0x1f4;return function(_0x2080fb){logger['error'](_0x2080fb[_0x9139('0x2f')]);if(_0x2080fb[_0x9139('0x30')]){delete _0x2080fb[_0x9139('0x30')];}_0x4a539f['status'](_0x2f554a)[_0x9139('0x31')](_0x2080fb);};}exports[_0x9139('0x32')]=function(_0x2f0889,_0x365192){var _0x3ff7c9={},_0x3ee061={},_0x15d880={'count':0x0,'rows':[]};var _0xf9a23d=_[_0x9139('0x33')](db[_0x9139('0x34')]['rawAttributes'],function(_0x2398d7){return{'name':_0x2398d7[_0x9139('0x35')],'type':_0x2398d7[_0x9139('0x36')][_0x9139('0x37')]};});_0x3ee061[_0x9139('0x38')]=_[_0x9139('0x33')](_0xf9a23d,_0x9139('0x30'));_0x3ee061['query']=_[_0x9139('0x39')](_0x2f0889['query']);_0x3ee061[_0x9139('0x3a')]=_[_0x9139('0x3b')](_0x3ee061[_0x9139('0x38')],_0x3ee061['query']);_0x3ff7c9[_0x9139('0x3c')]=_[_0x9139('0x3b')](_0x3ee061[_0x9139('0x38')],qs[_0x9139('0x3d')](_0x2f0889[_0x9139('0x3e')][_0x9139('0x3d')]));_0x3ff7c9[_0x9139('0x3c')]=_0x3ff7c9[_0x9139('0x3c')][_0x9139('0x3f')]?_0x3ff7c9[_0x9139('0x3c')]:_0x3ee061['model'];if(!_0x2f0889[_0x9139('0x3e')][_0x9139('0x40')](_0x9139('0x41'))){_0x3ff7c9['limit']=qs['limit'](_0x2f0889['query'][_0x9139('0x42')]);_0x3ff7c9[_0x9139('0x29')]=qs[_0x9139('0x29')](_0x2f0889[_0x9139('0x3e')][_0x9139('0x29')]);}_0x3ff7c9['order']=qs[_0x9139('0x43')](_0x2f0889[_0x9139('0x3e')][_0x9139('0x43')]);_0x3ff7c9[_0x9139('0x44')]=qs[_0x9139('0x3a')](_['pick'](_0x2f0889[_0x9139('0x3e')],_0x3ee061[_0x9139('0x3a')]),_0xf9a23d);if(_0x2f0889[_0x9139('0x3e')][_0x9139('0x45')]){_0x3ff7c9['where']=_['merge'](_0x3ff7c9[_0x9139('0x44')],{'$or':_[_0x9139('0x33')](_0xf9a23d,function(_0x5571bf){if(_0x5571bf['type']!==_0x9139('0x46')){var _0x259e78={};_0x259e78[_0x5571bf['name']]={'$like':'%'+_0x2f0889[_0x9139('0x3e')][_0x9139('0x45')]+'%'};return _0x259e78;}})});}_0x3ff7c9=_['merge']({},_0x3ff7c9,_0x2f0889[_0x9139('0x47')]);var _0x5a44ae={'where':_0x3ff7c9['where']};return db[_0x9139('0x34')][_0x9139('0x28')](_0x5a44ae)[_0x9139('0x1b')](function(_0x2b77b8){_0x15d880[_0x9139('0x28')]=_0x2b77b8;if(_0x2f0889['query'][_0x9139('0x48')]){_0x3ff7c9[_0x9139('0x49')]=[{'all':!![]}];}return db[_0x9139('0x34')]['findAll'](_0x3ff7c9);})[_0x9139('0x1b')](function(_0xb80038){_0x15d880[_0x9139('0x4a')]=_0xb80038;return _0x15d880;})[_0x9139('0x1b')](respondWithFilteredResult(_0x365192,_0x3ff7c9))[_0x9139('0x4b')](handleError(_0x365192,null));};exports[_0x9139('0x4c')]=function(_0x2e2b85,_0x2775fd){var _0x198f4d={'raw':!![],'where':{'id':_0x2e2b85[_0x9139('0x4d')]['id']}},_0x1c57c9={};_0x1c57c9['model']=_[_0x9139('0x39')](db[_0x9139('0x34')][_0x9139('0x4e')]);_0x1c57c9['query']=_[_0x9139('0x39')](_0x2e2b85[_0x9139('0x3e')]);_0x1c57c9['filters']=_[_0x9139('0x3b')](_0x1c57c9[_0x9139('0x38')],_0x1c57c9[_0x9139('0x3e')]);_0x198f4d['attributes']=_[_0x9139('0x3b')](_0x1c57c9[_0x9139('0x38')],qs[_0x9139('0x3d')](_0x2e2b85[_0x9139('0x3e')]['fields']));_0x198f4d[_0x9139('0x3c')]=_0x198f4d[_0x9139('0x3c')][_0x9139('0x3f')]?_0x198f4d['attributes']:_0x1c57c9[_0x9139('0x38')];if(_0x2e2b85[_0x9139('0x3e')][_0x9139('0x48')]){_0x198f4d[_0x9139('0x49')]=[{'all':!![]}];}_0x198f4d=_[_0x9139('0x4f')]({},_0x198f4d,_0x2e2b85[_0x9139('0x47')]);return db[_0x9139('0x34')]['find'](_0x198f4d)[_0x9139('0x1b')](handleEntityNotFound(_0x2775fd,null))[_0x9139('0x1b')](respondWithResult(_0x2775fd,null))['catch'](handleError(_0x2775fd,null));};exports[_0x9139('0x2c')]=function(_0x1e1290,_0x3d6627){if(_0x1e1290[_0x9139('0x50')]['id']){delete _0x1e1290[_0x9139('0x50')]['id'];}return db['FaxMessage'][_0x9139('0x51')]({'where':{'id':_0x1e1290[_0x9139('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3d6627,null))['then'](saveUpdates(_0x1e1290[_0x9139('0x50')],null))[_0x9139('0x1b')](respondWithResult(_0x3d6627,null))[_0x9139('0x4b')](handleError(_0x3d6627,null));};exports['destroy']=function(_0x2e8d06,_0x576b5a){return db['FaxMessage'][_0x9139('0x51')]({'where':{'id':_0x2e8d06[_0x9139('0x4d')]['id']}})[_0x9139('0x1b')](handleEntityNotFound(_0x576b5a,null))[_0x9139('0x1b')](removeEntity(_0x576b5a,null))['catch'](handleError(_0x576b5a,null));};exports[_0x9139('0x52')]=function(_0x91a5a8,_0x1de283){return db['FaxMessage'][_0x9139('0x52')]()[_0x9139('0x1b')](respondWithResult(_0x1de283,null))[_0x9139('0x4b')](handleError(_0x1de283,null));};var interaction_log=require(_0x9139('0x11'))(_0x9139('0x53'));exports[_0x9139('0x54')]=function(_0x3c55fc,_0x33261b,_0x1578bd){var _0x2080e0={'agent':{},'channel':_0x9139('0x55')};if(_0x3c55fc[_0x9139('0x50')]['id']){delete _0x3c55fc[_0x9139('0x50')]['id'];}_0x3c55fc[_0x9139('0x50')]['read']=!![];_0x3c55fc[_0x9139('0x50')][_0x9139('0x56')]=moment()[_0x9139('0x57')](_0x9139('0x58'));_0x3c55fc[_0x9139('0x50')]['UserId']=_0x3c55fc[_0x9139('0x50')][_0x9139('0x59')]||_0x3c55fc[_0x9139('0x5a')]['id'];_0x2080e0[_0x9139('0x5b')]['id']=_0x3c55fc[_0x9139('0x50')]['UserId'];return db['FaxMessage'][_0x9139('0x51')]({'where':{'id':_0x3c55fc[_0x9139('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9139('0x5c')}]})[_0x9139('0x1b')](handleEntityNotFound(_0x33261b,null))[_0x9139('0x1b')](saveUpdates(_0x3c55fc[_0x9139('0x50')],null))[_0x9139('0x1b')](function(_0x302658){if(_0x302658){_0x2080e0[_0x9139('0x22')]=_0x302658[_0x9139('0x5d')]({'plain':!![]});return db[_0x9139('0x5e')]['find']({'where':{'id':_0x302658[_0x9139('0x5f')]}});}return null;})[_0x9139('0x1b')](handleEntityNotFound(_0x33261b,null))[_0x9139('0x1b')](function(_0x26fe55){if(_0x26fe55){return _0x26fe55['update']({'UserId':_0x3c55fc['body'][_0x9139('0x59')],'read1stAt':_[_0x9139('0x60')](_0x26fe55[_0x9139('0x61')])?moment()[_0x9139('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9139('0x1b')](function(_0x32bf47){if(_0x32bf47){_0x2080e0['interaction']=_0x32bf47[_0x9139('0x5d')]({'plain':!![]});interaction_log[_0x9139('0x23')](_0x9139('0x62'),_0x3c55fc[_0x9139('0x5a')]['id'],_0x3c55fc[_0x9139('0x5a')][_0x9139('0x30')],_0x3c55fc[_0x9139('0x5a')][_0x9139('0x63')],_0x2080e0['interaction']['id'],_0x3c55fc['body']?JSON['stringify'](_0x3c55fc[_0x9139('0x50')]):_0x9139('0x64'));return respondWithRpcPromise(_0x9139('0x65'),'acceptMessage',_0x2080e0);}return null;})[_0x9139('0x1b')](function(_0x3f3d58){if(_0x3f3d58){if(_0x3c55fc[_0x9139('0x50')][_0x9139('0x66')]){_0x2080e0[_0x9139('0x22')][_0x9139('0x67')]=util['format'](_0x9139('0x68'),_0x3c55fc['user'][_0x9139('0x30')]);_0x2080e0['message'][_0x9139('0x69')]=_0x2080e0[_0x9139('0x69')];_0x2080e0['message']['event']=_0x9139('0x54');return respondWithRpcPromise(_0x9139('0x6a'),_0x9139('0x6a'),{'event':'acceptmessage','message':_0x2080e0[_0x9139('0x22')]},client9002)[_0x9139('0x1b')](function(){return _0x2080e0;});}return _0x2080e0;}return null;})[_0x9139('0x1b')](respondWithResult(_0x33261b,null))[_0x9139('0x4b')](handleError(_0x33261b,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x9139('0x6b')]=function(_0x2462fc,_0x53eaa1,_0x7ee50c){var _0x41d9dc={'agent':{},'channel':_0x9139('0x55')};if(_0x2462fc[_0x9139('0x50')]['id']){delete _0x2462fc[_0x9139('0x50')]['id'];}_0x2462fc[_0x9139('0x50')][_0x9139('0x59')]=_0x2462fc[_0x9139('0x50')][_0x9139('0x59')]||_0x2462fc[_0x9139('0x5a')]['id'];_0x41d9dc[_0x9139('0x5b')]['id']=_0x2462fc[_0x9139('0x50')][_0x9139('0x59')];return db['FaxMessage'][_0x9139('0x51')]({'where':{'id':_0x2462fc[_0x9139('0x4d')]['id'],'UserId':null}})[_0x9139('0x1b')](handleEntityNotFound(_0x53eaa1,null))[_0x9139('0x1b')](function(_0x144a02){if(_0x144a02){_0x41d9dc['message']=_0x144a02[_0x9139('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x9139('0x51')]({'where':{'id':_0x144a02[_0x9139('0x5f')]}});}return null;})[_0x9139('0x1b')](handleEntityNotFound(_0x53eaa1,null))['then'](function(_0x15a530){if(_0x15a530){_0x41d9dc[_0x9139('0x6c')]=_0x15a530['get']({'plain':!![]});interaction_log[_0x9139('0x23')](_0x9139('0x6d'),_0x2462fc[_0x9139('0x5a')]['id'],_0x2462fc[_0x9139('0x5a')][_0x9139('0x30')],_0x2462fc[_0x9139('0x5a')][_0x9139('0x63')],_0x41d9dc[_0x9139('0x6c')]['id'],_0x2462fc[_0x9139('0x50')]?JSON['stringify'](_0x2462fc[_0x9139('0x50')]):_0x9139('0x64'));return respondWithRpcPromise(_0x9139('0x6e'),_0x9139('0x6f'),_0x41d9dc);}return null;})[_0x9139('0x1b')](function(_0x5941d4){if(_0x5941d4){_0x5941d4[_0x9139('0x22')][_0x9139('0x67')]=util['format']('SIP/%s',_0x2462fc[_0x9139('0x5a')][_0x9139('0x30')]);_0x5941d4[_0x9139('0x22')][_0x9139('0x69')]=_0x41d9dc['channel'];_0x5941d4[_0x9139('0x22')][_0x9139('0x70')]=_0x9139('0x6b');respondWithRpcPromise(_0x9139('0x6a'),_0x9139('0x6a'),{'event':_0x9139('0x71'),'message':_0x5941d4[_0x9139('0x22')]},client9002);return _0x41d9dc;}return null;})[_0x9139('0x1b')](respondWithResult(_0x53eaa1,null))[_0x9139('0x4b')](handleError(_0x53eaa1,null));};exports[_0x9139('0x72')]=function(_0x2d8db8,_0x2dfa1c){var _0x1bb3ee;return db[_0x9139('0x34')][_0x9139('0x72')](_0x2d8db8[_0x9139('0x50')],{})[_0x9139('0x1b')](function(_0x43a3d4){_0x1bb3ee=_0x43a3d4;return db[_0x9139('0x73')]['findOne']({'where':{'id':_0x1bb3ee[_0x9139('0x74')]}});})[_0x9139('0x1b')](function(_0xbf9e1d){if(_[_0x9139('0x60')](_0xbf9e1d)){return;}else{_0x1bb3ee[_0x9139('0x55')]=_0xbf9e1d['fax'];return db[_0x9139('0x75')][_0x9139('0x76')]({'where':{'id':_0x1bb3ee[_0x9139('0x77')]}});}})[_0x9139('0x1b')](function(_0x458972){return respondWithRpcPromise(_0x9139('0x78'),_0x9139('0x78'),{'FaxAccountId':_['isNil'](_0x2d8db8['body'])?undefined:_0x2d8db8[_0x9139('0x50')][_0x9139('0x79')],'path':_[_0x9139('0x60')](_0x458972)?undefined:util[_0x9139('0x57')]('/var/opt/motion2/server/files/attachments/%s',_0x458972['basename']),'fax':_[_0x9139('0x60')](_0x1bb3ee[_0x9139('0x55')])?undefined:_0x1bb3ee[_0x9139('0x55')],'AttachmentId':_0x1bb3ee[_0x9139('0x77')]},client9002);})[_0x9139('0x1b')](respondWithResult(_0x2dfa1c,0xc9))[_0x9139('0x4b')](handleError(_0x2dfa1c,null));};exports[_0x9139('0x7a')]=function(_0x2f25f0,_0x16e27c){var _0x4910f8=path[_0x9139('0x7b')](config['root'],_0x9139('0x7c'),_0x9139('0x7d'),_0x9139('0x7e'));return db[_0x9139('0x34')]['find']({'where':{'id':_0x2f25f0['params']['id']},'include':[{'model':db[_0x9139('0x75')],'as':_0x9139('0x75')}]})[_0x9139('0x1b')](handleEntityNotFound(_0x16e27c,null))[_0x9139('0x1b')](function(_0x3303c7){if(_0x3303c7){return _0x16e27c['download'](path['join'](_0x4910f8,_0x3303c7[_0x9139('0x75')]['basename']));}})[_0x9139('0x4b')](handleError(_0x16e27c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 366f7ca..61f778c 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x3b267d,_0x1c6f48){_0x3b267d=_0x3b267d-0x0;var _0x164d67=_0xe14b[_0x3b267d];return _0x164d67;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0x1bd4e9,_0x2f011e){_0x1bd4e9=_0x1bd4e9-0x0;var _0x4c40e9=_0xe14b[_0x1bd4e9];return _0x4c40e9;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 40a4e58..c065602 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 _0x48a3=['api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x48a3,0xed));var _0x348a=function(_0x51cabf,_0x2828db){_0x51cabf=_0x51cabf-0x0;var _0x517538=_0x48a3[_0x51cabf];return _0x517538;};'use strict';var _=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var logger=require(_0x348a('0x2'))(_0x348a('0x3'));var moment=require('moment');var BPromise=require(_0x348a('0x4'));var rp=require(_0x348a('0x5'));var fs=require('fs');var path=require(_0x348a('0x6'));var rimraf=require('rimraf');var config=require(_0x348a('0x7'));var attributes=require(_0x348a('0x8'));module[_0x348a('0x9')]=function(_0x5b7a50,_0x32a6b){return _0x5b7a50['define']('FaxMessage',attributes,{'tableName':_0x348a('0xa'),'paranoid':![],'indexes':[{'name':_0x348a('0xb'),'fields':[_0x348a('0xc')],'type':_0x348a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a9986,_0x4c4d93,_0x25a19c){var _0x2e6734=_0x5b7a50[_0x348a('0xe')];var _0x314e42=_0x5a9986[_0x348a('0xf')]({'plain':!![]});if(_0x314e42[_0x348a('0x10')]['toLowerCase']()==='in'||_0x314e42['direction']['toLowerCase']()===_0x348a('0x11')&&!_0x314e42[_0x348a('0x12')]&&!_[_0x348a('0x13')](_0x314e42[_0x348a('0x14')])){_0x2e6734[_0x348a('0x15')][_0x348a('0x16')]({'where':{'id':_0x314e42[_0x348a('0x17')]}})[_0x348a('0x18')](function(_0x2866b8){if(_0x2866b8){_0x2866b8[_0x348a('0x19')]({'lastMsgAt':_0x314e42['createdAt'],'lastMsgDirection':_0x314e42[_0x348a('0x10')][_0x348a('0x1a')]()});}})[_0x348a('0x1b')](function(_0x1b2571){console['error'](_0x1b2571);});}_0x25a19c();}},'charset':_0x348a('0x1c'),'collate':_0x348a('0x1d')});}; \ No newline at end of file +var _0xd6d8=['FULLTEXT','models','get','direction','toLowerCase','out','FaxInteraction','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x7caee1,_0x40dc30){var _0x4d26af=function(_0x479a34){while(--_0x479a34){_0x7caee1['push'](_0x7caee1['shift']());}};_0x4d26af(++_0x40dc30);}(_0xd6d8,0x6f));var _0x8d6d=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xd6d8[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0x8d6d('0x0'));var util=require(_0x8d6d('0x1'));var logger=require(_0x8d6d('0x2'))(_0x8d6d('0x3'));var moment=require(_0x8d6d('0x4'));var BPromise=require(_0x8d6d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d6d('0x6'));var config=require(_0x8d6d('0x7'));var attributes=require(_0x8d6d('0x8'));module[_0x8d6d('0x9')]=function(_0x7cbef3,_0x2dca53){return _0x7cbef3[_0x8d6d('0xa')](_0x8d6d('0xb'),attributes,{'tableName':_0x8d6d('0xc'),'paranoid':![],'indexes':[{'name':_0x8d6d('0xd'),'fields':['body'],'type':_0x8d6d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57f34f,_0x5d58d4,_0x253d50){var _0x3fe715=_0x7cbef3[_0x8d6d('0xf')];var _0x5c252c=_0x57f34f[_0x8d6d('0x10')]({'plain':!![]});if(_0x5c252c[_0x8d6d('0x11')][_0x8d6d('0x12')]()==='in'||_0x5c252c[_0x8d6d('0x11')][_0x8d6d('0x12')]()===_0x8d6d('0x13')&&!_0x5c252c['secret']&&!_['isNil'](_0x5c252c['UserId'])){_0x3fe715[_0x8d6d('0x14')]['findOne']({'where':{'id':_0x5c252c['FaxInteractionId']}})[_0x8d6d('0x15')](function(_0x4921dd){if(_0x4921dd){_0x4921dd['update']({'lastMsgAt':_0x5c252c['createdAt'],'lastMsgDirection':_0x5c252c[_0x8d6d('0x11')]['toLowerCase']()});}})['catch'](function(_0x465619){console[_0x8d6d('0x16')](_0x465619);});}_0x253d50();}},'charset':_0x8d6d('0x17'),'collate':_0x8d6d('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index acff38e..26937ed 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 _0x93dc=['../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment'];(function(_0x327c0f,_0x188c04){var _0x1a936d=function(_0xab8e0b){while(--_0xab8e0b){_0x327c0f['push'](_0x327c0f['shift']());}};_0x1a936d(++_0x188c04);}(_0x93dc,0xfd));var _0xc93d=function(_0x3762fa,_0x17a8be){_0x3762fa=_0x3762fa-0x0;var _0x427954=_0x93dc[_0x3762fa];return _0x427954;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var moment=require(_0xc93d('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(_0xc93d('0x3'));var logger=require('../../config/logger')(_0xc93d('0x4'));var config=require(_0xc93d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc93d('0x6')]({'port':0x232a});config['redis']=_[_0xc93d('0x7')](config[_0xc93d('0x8')],{'host':_0xc93d('0x9'),'port':0x18eb});var socket=require(_0xc93d('0xa'))(new Redis(config[_0xc93d('0x8')]));require(_0xc93d('0xb'))[_0xc93d('0xc')](socket);function respondWithRpcPromise(_0x5a5049,_0xd9ff33,_0xf24d71){return new BPromise(function(_0x1e304e,_0x165ed0){return client[_0xc93d('0xd')](_0x5a5049,_0xf24d71)['then'](function(_0x1bf0f0){logger[_0xc93d('0xe')](_0xc93d('0xf'),_0xd9ff33,_0xc93d('0x10'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xd9ff33,'request\x20sent',JSON[_0xc93d('0x11')](_0x1bf0f0));if(_0x1bf0f0['error']){if(_0x1bf0f0[_0xc93d('0x12')]['code']===0x1f4){logger[_0xc93d('0x12')]('FaxMessage,\x20%s,\x20%s',_0xd9ff33,_0x1bf0f0[_0xc93d('0x12')][_0xc93d('0x13')]);return _0x165ed0(_0x1bf0f0['error'][_0xc93d('0x13')]);}logger[_0xc93d('0x12')](_0xc93d('0xf'),_0xd9ff33,_0x1bf0f0[_0xc93d('0x12')][_0xc93d('0x13')]);return _0x1e304e(_0x1bf0f0[_0xc93d('0x12')][_0xc93d('0x13')]);}else{logger[_0xc93d('0xe')](_0xc93d('0xf'),_0xd9ff33,_0xc93d('0x10'));_0x1e304e(_0x1bf0f0['result'][_0xc93d('0x13')]);}})[_0xc93d('0x14')](function(_0x1264bc){logger['error'](_0xc93d('0xf'),_0xd9ff33,_0x1264bc);_0x165ed0(_0x1264bc);});});}exports[_0xc93d('0x15')]=function(_0x21bdb8){var _0x154838=this;return new Promise(function(_0x25be0a,_0x454057){return db[_0xc93d('0x16')][_0xc93d('0x17')](_0x21bdb8[_0xc93d('0x18')],{'raw':_0x21bdb8[_0xc93d('0x19')]?_0x21bdb8[_0xc93d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc93d('0x1a')](function(_0x14038c){logger['info'](_0xc93d('0x15'),_0x21bdb8);logger['debug'](_0xc93d('0x15'),_0x21bdb8,JSON[_0xc93d('0x11')](_0x14038c));_0x25be0a(_0x14038c);})['catch'](function(_0x8abd54){logger['error']('CreateFaxMessage',_0x8abd54[_0xc93d('0x13')],_0x21bdb8);_0x454057(_0x154838[_0xc93d('0x12')](0x1f4,_0x8abd54[_0xc93d('0x13')]));});});};exports['UpdateFaxMessage']=function(_0x4d7876){var _0x58499c=this;return new Promise(function(_0x149dcd,_0x31dbfc){return db[_0xc93d('0x16')][_0xc93d('0x1b')](_0x4d7876[_0xc93d('0x18')],{'raw':_0x4d7876[_0xc93d('0x19')]?_0x4d7876['options'][_0xc93d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7876['options']?_0x4d7876[_0xc93d('0x19')][_0xc93d('0x1d')]||null:null,'attributes':_0x4d7876[_0xc93d('0x19')]?_0x4d7876['options']['attributes']||null:null,'limit':_0x4d7876['options']?_0x4d7876[_0xc93d('0x19')][_0xc93d('0x1e')]||null:null})[_0xc93d('0x1a')](function(_0x32c763){logger[_0xc93d('0xe')](_0xc93d('0x1f'),_0x4d7876);logger['debug']('UpdateFaxMessage',_0x4d7876,JSON['stringify'](_0x32c763));_0x149dcd(_0x32c763);})[_0xc93d('0x14')](function(_0x5d249e){logger[_0xc93d('0x12')](_0xc93d('0x1f'),_0x5d249e['message'],_0x4d7876);_0x31dbfc(_0x58499c[_0xc93d('0x12')](0x1f4,_0x5d249e[_0xc93d('0x13')]));});});}; \ No newline at end of file +var _0xd9b8=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','options','stringify','UpdateFaxMessage','raw','where'];(function(_0x4d6239,_0x2b45c4){var _0x21a37d=function(_0xf627ee){while(--_0xf627ee){_0x4d6239['push'](_0x4d6239['shift']());}};_0x21a37d(++_0x2b45c4);}(_0xd9b8,0x16a));var _0x8d9b=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0xd9b8[_0x409fb8];return _0x278270;};'use strict';var _=require(_0x8d9b('0x0'));var util=require(_0x8d9b('0x1'));var moment=require(_0x8d9b('0x2'));var BPromise=require(_0x8d9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d9b('0x4'));var db=require(_0x8d9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d9b('0x6'));var config=require(_0x8d9b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d9b('0x8')]['http']({'port':0x232a});config[_0x8d9b('0x9')]=_[_0x8d9b('0xa')](config[_0x8d9b('0x9')],{'host':_0x8d9b('0xb'),'port':0x18eb});var socket=require(_0x8d9b('0xc'))(new Redis(config[_0x8d9b('0x9')]));require(_0x8d9b('0xd'))['register'](socket);function respondWithRpcPromise(_0x1aa52c,_0x250e4f,_0x45f9ec){return new BPromise(function(_0x189845,_0x2f434e){return client[_0x8d9b('0xe')](_0x1aa52c,_0x45f9ec)[_0x8d9b('0xf')](function(_0x4444ee){logger[_0x8d9b('0x10')](_0x8d9b('0x11'),_0x250e4f,_0x8d9b('0x12'));logger[_0x8d9b('0x13')](_0x8d9b('0x14'),_0x250e4f,_0x8d9b('0x12'),JSON['stringify'](_0x4444ee));if(_0x4444ee[_0x8d9b('0x15')]){if(_0x4444ee[_0x8d9b('0x15')][_0x8d9b('0x16')]===0x1f4){logger[_0x8d9b('0x15')](_0x8d9b('0x11'),_0x250e4f,_0x4444ee[_0x8d9b('0x15')][_0x8d9b('0x17')]);return _0x2f434e(_0x4444ee['error'][_0x8d9b('0x17')]);}logger['error'](_0x8d9b('0x11'),_0x250e4f,_0x4444ee[_0x8d9b('0x15')][_0x8d9b('0x17')]);return _0x189845(_0x4444ee[_0x8d9b('0x15')][_0x8d9b('0x17')]);}else{logger[_0x8d9b('0x10')](_0x8d9b('0x11'),_0x250e4f,_0x8d9b('0x12'));_0x189845(_0x4444ee['result'][_0x8d9b('0x17')]);}})[_0x8d9b('0x18')](function(_0x42a1ae){logger[_0x8d9b('0x15')](_0x8d9b('0x11'),_0x250e4f,_0x42a1ae);_0x2f434e(_0x42a1ae);});});}exports[_0x8d9b('0x19')]=function(_0x362c3e){var _0x52b83a=this;return new Promise(function(_0x4f25ed,_0x15365e){return db[_0x8d9b('0x1a')][_0x8d9b('0x1b')](_0x362c3e[_0x8d9b('0x1c')],{'raw':_0x362c3e[_0x8d9b('0x1d')]?_0x362c3e['options']['raw']===undefined?!![]:![]:!![]})[_0x8d9b('0xf')](function(_0x2e2f50){logger[_0x8d9b('0x10')](_0x8d9b('0x19'),_0x362c3e);logger[_0x8d9b('0x13')](_0x8d9b('0x19'),_0x362c3e,JSON[_0x8d9b('0x1e')](_0x2e2f50));_0x4f25ed(_0x2e2f50);})[_0x8d9b('0x18')](function(_0x270887){logger[_0x8d9b('0x15')](_0x8d9b('0x19'),_0x270887[_0x8d9b('0x17')],_0x362c3e);_0x15365e(_0x52b83a[_0x8d9b('0x15')](0x1f4,_0x270887['message']));});});};exports[_0x8d9b('0x1f')]=function(_0x91ff73){var _0x181746=this;return new Promise(function(_0x33ce01,_0x4e6bab){return db[_0x8d9b('0x1a')]['update'](_0x91ff73[_0x8d9b('0x1c')],{'raw':_0x91ff73[_0x8d9b('0x1d')]?_0x91ff73[_0x8d9b('0x1d')][_0x8d9b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91ff73[_0x8d9b('0x1d')]?_0x91ff73[_0x8d9b('0x1d')][_0x8d9b('0x21')]||null:null,'attributes':_0x91ff73[_0x8d9b('0x1d')]?_0x91ff73[_0x8d9b('0x1d')][_0x8d9b('0x22')]||null:null,'limit':_0x91ff73[_0x8d9b('0x1d')]?_0x91ff73['options'][_0x8d9b('0x23')]||null:null})[_0x8d9b('0xf')](function(_0x374250){logger['info']('UpdateFaxMessage',_0x91ff73);logger[_0x8d9b('0x13')]('UpdateFaxMessage',_0x91ff73,JSON['stringify'](_0x374250));_0x33ce01(_0x374250);})['catch'](function(_0x412ab7){logger[_0x8d9b('0x15')](_0x8d9b('0x1f'),_0x412ab7[_0x8d9b('0x17')],_0x91ff73);_0x4e6bab(_0x181746[_0x8d9b('0x15')](0x1f4,_0x412ab7[_0x8d9b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 522baba..9a3ee1d 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(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 bb00c2f..6c48976 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 _0xd1f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','tracked','fax','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','path','connect-timeout','Router'];(function(_0x2da223,_0x4ecf9a){var _0x1fd244=function(_0x3deb7a){while(--_0x3deb7a){_0x2da223['push'](_0x2da223['shift']());}};_0x1fd244(++_0x4ecf9a);}(_0xd1f2,0xed));var _0x2d1f=function(_0x1c8a0a,_0x1f0eb5){_0x1c8a0a=_0x1c8a0a-0x0;var _0x16f46e=_0xd1f2[_0x1c8a0a];return _0x16f46e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d1f('0x0'));var timeout=require(_0x2d1f('0x1'));var express=require('express');var router=express[_0x2d1f('0x2')]();var auth=require(_0x2d1f('0x3'));var interaction=require(_0x2d1f('0x4'));var config=require(_0x2d1f('0x5'));var controller=require(_0x2d1f('0x6'));router[_0x2d1f('0x7')]('/',auth[_0x2d1f('0x8')](),controller[_0x2d1f('0x9')]);router[_0x2d1f('0x7')](_0x2d1f('0xa'),auth[_0x2d1f('0x8')](),controller[_0x2d1f('0xb')]);router[_0x2d1f('0x7')]('/:id',auth[_0x2d1f('0x8')](),controller[_0x2d1f('0xc')]);router['get'](_0x2d1f('0xd'),auth[_0x2d1f('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction[_0x2d1f('0xe')](_0x2d1f('0xf'),'faxmessage:create'),controller['create']);router[_0x2d1f('0x10')](_0x2d1f('0x11'),auth['isAuthenticated'](),controller[_0x2d1f('0x12')]);router[_0x2d1f('0x10')](_0x2d1f('0x13'),auth[_0x2d1f('0x8')](),controller['accept']);router[_0x2d1f('0x10')](_0x2d1f('0x14'),auth['isAuthenticated'](),controller[_0x2d1f('0x15')]);router[_0x2d1f('0x16')]('/:id',auth[_0x2d1f('0x8')](),controller[_0x2d1f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd408=['./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','put','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x51f3f9,_0x19ec5b){var _0x30acc9=function(_0x43212d){while(--_0x43212d){_0x51f3f9['push'](_0x51f3f9['shift']());}};_0x30acc9(++_0x19ec5b);}(_0xd408,0x1e7));var _0x8d40=function(_0x18392b,_0x432937){_0x18392b=_0x18392b-0x0;var _0x269280=_0xd408[_0x18392b];return _0x269280;};'use strict';var multer=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var path=require(_0x8d40('0x2'));var timeout=require(_0x8d40('0x3'));var express=require(_0x8d40('0x4'));var router=express['Router']();var auth=require(_0x8d40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d40('0x6'));var controller=require(_0x8d40('0x7'));router[_0x8d40('0x8')]('/',auth[_0x8d40('0x9')](),controller[_0x8d40('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8d40('0xb')]);router[_0x8d40('0x8')](_0x8d40('0xc'),auth[_0x8d40('0x9')](),controller[_0x8d40('0xd')]);router[_0x8d40('0x8')](_0x8d40('0xe'),auth['isAuthenticated'](),controller[_0x8d40('0xf')]);router[_0x8d40('0x10')]('/',auth[_0x8d40('0x9')](),interaction[_0x8d40('0x11')](_0x8d40('0x12'),_0x8d40('0x13')),controller['create']);router[_0x8d40('0x14')]('/:id',auth[_0x8d40('0x9')](),controller['update']);router[_0x8d40('0x14')](_0x8d40('0x15'),auth[_0x8d40('0x9')](),controller[_0x8d40('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x8d40('0x17')](_0x8d40('0xc'),auth[_0x8d40('0x9')](),controller[_0x8d40('0x18')]);module[_0x8d40('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f7c3719..dbc26f0 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 _0xdd51=['name','INTEGER','ENUM','beepall','STRING'];(function(_0xb590f4,_0x1aa35f){var _0x93566f=function(_0x122ab1){while(--_0x122ab1){_0xb590f4['push'](_0xb590f4['shift']());}};_0x93566f(++_0x1aa35f);}(_0xdd51,0x8b));var _0x1dd5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xdd51[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1dd5('0x0')],'unique':_0x1dd5('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1dd5('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1dd5('0x3')]('rrmemory',_0x1dd5('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1dd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb74d=['sequelize','STRING','ENUM','rrmemory','beepall','INTEGER'];(function(_0x4f9f4a,_0x1ea762){var _0x3e800f=function(_0x4f10cf){while(--_0x4f10cf){_0x4f9f4a['push'](_0x4f9f4a['shift']());}};_0x3e800f(++_0x1ea762);}(_0xb74d,0x16e));var _0xdb74=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb74d[_0x52e68e];return _0x3211a4;};'use strict';var Sequelize=require(_0xdb74('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb74('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb74('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb74('0x2')](_0xdb74('0x3'),_0xdb74('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdb74('0x5')],'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 062ecd2..6fb093b 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 _0x3ed9=['error','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','pick','FaxQueueId','UserFaxQueue','findAll','User','createdAt','%s/%s','faxPause','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','get','FaxQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ed9,0xe0));var _0x93ed=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x3ed9[_0x53f402];return _0x45a76d;};'use strict';var pdf=require(_0x93ed('0x0'));var emlformat=require(_0x93ed('0x1'));var rimraf=require(_0x93ed('0x2'));var zipdir=require(_0x93ed('0x3'));var jsonpatch=require(_0x93ed('0x4'));var rp=require(_0x93ed('0x5'));var moment=require('moment');var BPromise=require(_0x93ed('0x6'));var Mustache=require('mustache');var util=require(_0x93ed('0x7'));var path=require(_0x93ed('0x8'));var sox=require(_0x93ed('0x9'));var csv=require(_0x93ed('0xa'));var ejs=require(_0x93ed('0xb'));var fs=require('fs');var _=require(_0x93ed('0xc'));var squel=require(_0x93ed('0xd'));var crypto=require('crypto');var jsforce=require(_0x93ed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x93ed('0xa'));var querystring=require(_0x93ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x93ed('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x93ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93ed('0x12'));var utils=require(_0x93ed('0x13'));var config=require(_0x93ed('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x93ed('0x15')]=_[_0x93ed('0x16')](config[_0x93ed('0x15')],{'host':_0x93ed('0x17'),'port':0x18eb});var socket=require(_0x93ed('0x18'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x93ed('0x19')](socket);function respondWithStatusCode(_0x3b0166,_0x46f543){_0x46f543=_0x46f543||0xcc;return function(_0x620f1a){if(_0x620f1a){return _0x3b0166[_0x93ed('0x1a')](_0x46f543);}return _0x3b0166[_0x93ed('0x1b')](_0x46f543)[_0x93ed('0x1c')]();};}function respondWithResult(_0x2229a6,_0x2fc7c6){_0x2fc7c6=_0x2fc7c6||0xc8;return function(_0x1309fd){if(_0x1309fd){return _0x2229a6[_0x93ed('0x1b')](_0x2fc7c6)[_0x93ed('0x1d')](_0x1309fd);}};}function respondWithFilteredResult(_0x1c744e,_0x2ed16f){return function(_0x540996){if(_0x540996){var _0x57e8a8=_0x540996[_0x93ed('0x1e')],_0x304a1f=_0x2ed16f[_0x93ed('0x1f')],_0x51364b=_0x2ed16f[_0x93ed('0x1f')]+_0x2ed16f['limit'],_0x295fc6;if(_0x51364b>=_0x57e8a8){_0x51364b=_0x57e8a8;_0x295fc6=0xc8;}else{_0x295fc6=0xce;}_0x1c744e[_0x93ed('0x1b')](_0x295fc6);return _0x1c744e[_0x93ed('0x20')](_0x93ed('0x21'),_0x304a1f+'-'+_0x51364b+'/'+_0x57e8a8)[_0x93ed('0x1d')](_0x540996);}return null;};}function patchUpdates(_0x48f5db){return function(_0x3fc2fe){try{jsonpatch[_0x93ed('0x22')](_0x3fc2fe,_0x48f5db,!![]);}catch(_0x20863a){return BPromise['reject'](_0x20863a);}return _0x3fc2fe[_0x93ed('0x23')]();};}function saveUpdates(_0x2d9f46,_0x275104){return function(_0x182321){if(_0x182321){return _0x182321[_0x93ed('0x24')](_0x2d9f46)['then'](function(_0x41d0c0){return _0x41d0c0;});}return null;};}function removeEntity(_0x1707b5,_0x17bfbc){return function(_0x303a85){if(_0x303a85){return _0x303a85['destroy']()[_0x93ed('0x25')](function(){var _0x273077=_0x303a85[_0x93ed('0x26')]({'plain':!![]});var _0x3cbb3e=_0x93ed('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cbb3e,'resourceId':_0x273077['id']}})[_0x93ed('0x25')](function(){return _0x303a85;});})[_0x93ed('0x25')](function(){_0x1707b5['status'](0xcc)[_0x93ed('0x1c')]();});}};}function handleEntityNotFound(_0x54548c,_0x101cbf){return function(_0x452921){if(!_0x452921){_0x54548c[_0x93ed('0x1a')](0x194);}return _0x452921;};}function handleError(_0x402119,_0x446c93){_0x446c93=_0x446c93||0x1f4;return function(_0x17ae93){logger[_0x93ed('0x28')](_0x17ae93[_0x93ed('0x29')]);if(_0x17ae93[_0x93ed('0x2a')]){delete _0x17ae93['name'];}_0x402119[_0x93ed('0x1b')](_0x446c93)['send'](_0x17ae93);};}exports[_0x93ed('0x2b')]=function(_0x2011d5,_0x2338a0){var _0x1b4b07={},_0x4d9554={},_0x43f18c={'count':0x0,'rows':[]};var _0x15052a=_['map'](db[_0x93ed('0x2c')][_0x93ed('0x2d')],function(_0x13a7b7){return{'name':_0x13a7b7[_0x93ed('0x2e')],'type':_0x13a7b7[_0x93ed('0x2f')][_0x93ed('0x30')]};});_0x4d9554['model']=_['map'](_0x15052a,_0x93ed('0x2a'));_0x4d9554[_0x93ed('0x31')]=_['keys'](_0x2011d5[_0x93ed('0x31')]);_0x4d9554[_0x93ed('0x32')]=_[_0x93ed('0x33')](_0x4d9554[_0x93ed('0x34')],_0x4d9554[_0x93ed('0x31')]);_0x1b4b07[_0x93ed('0x35')]=_['intersection'](_0x4d9554[_0x93ed('0x34')],qs[_0x93ed('0x36')](_0x2011d5[_0x93ed('0x31')][_0x93ed('0x36')]));_0x1b4b07[_0x93ed('0x35')]=_0x1b4b07['attributes'][_0x93ed('0x37')]?_0x1b4b07[_0x93ed('0x35')]:_0x4d9554['model'];if(!_0x2011d5['query'][_0x93ed('0x38')](_0x93ed('0x39'))){_0x1b4b07[_0x93ed('0x3a')]=qs[_0x93ed('0x3a')](_0x2011d5[_0x93ed('0x31')][_0x93ed('0x3a')]);_0x1b4b07[_0x93ed('0x1f')]=qs['offset'](_0x2011d5['query'][_0x93ed('0x1f')]);}_0x1b4b07[_0x93ed('0x3b')]=qs['sort'](_0x2011d5[_0x93ed('0x31')][_0x93ed('0x3c')]);_0x1b4b07[_0x93ed('0x3d')]=qs[_0x93ed('0x32')](_['pick'](_0x2011d5['query'],_0x4d9554[_0x93ed('0x32')]),_0x15052a);if(_0x2011d5[_0x93ed('0x31')][_0x93ed('0x3e')]){_0x1b4b07['where']=_[_0x93ed('0x3f')](_0x1b4b07[_0x93ed('0x3d')],{'$or':_[_0x93ed('0x40')](_0x15052a,function(_0x5f01b5){if(_0x5f01b5[_0x93ed('0x2f')]!==_0x93ed('0x41')){var _0x1d5547={};_0x1d5547[_0x5f01b5[_0x93ed('0x2a')]]={'$like':'%'+_0x2011d5[_0x93ed('0x31')][_0x93ed('0x3e')]+'%'};return _0x1d5547;}})});}_0x1b4b07=_[_0x93ed('0x3f')]({},_0x1b4b07,_0x2011d5[_0x93ed('0x42')]);var _0x4dc75b={'where':_0x1b4b07['where']};return db[_0x93ed('0x2c')][_0x93ed('0x1e')](_0x4dc75b)['then'](function(_0x549edd){_0x43f18c[_0x93ed('0x1e')]=_0x549edd;if(_0x2011d5[_0x93ed('0x31')][_0x93ed('0x43')]){_0x1b4b07[_0x93ed('0x44')]=[{'all':!![]}];}return db[_0x93ed('0x2c')]['findAll'](_0x1b4b07);})[_0x93ed('0x25')](function(_0x502f71){_0x43f18c[_0x93ed('0x45')]=_0x502f71;return _0x43f18c;})[_0x93ed('0x25')](respondWithFilteredResult(_0x2338a0,_0x1b4b07))[_0x93ed('0x46')](handleError(_0x2338a0,null));};exports['show']=function(_0x2dd4e6,_0x4b0303){var _0x37394f={'raw':!![],'where':{'id':_0x2dd4e6[_0x93ed('0x47')]['id']}},_0x526e70={};_0x526e70[_0x93ed('0x34')]=_[_0x93ed('0x48')](db['FaxQueue']['rawAttributes']);_0x526e70[_0x93ed('0x31')]=_[_0x93ed('0x48')](_0x2dd4e6['query']);_0x526e70[_0x93ed('0x32')]=_['intersection'](_0x526e70['model'],_0x526e70[_0x93ed('0x31')]);_0x37394f[_0x93ed('0x35')]=_[_0x93ed('0x33')](_0x526e70['model'],qs[_0x93ed('0x36')](_0x2dd4e6[_0x93ed('0x31')][_0x93ed('0x36')]));_0x37394f[_0x93ed('0x35')]=_0x37394f[_0x93ed('0x35')][_0x93ed('0x37')]?_0x37394f[_0x93ed('0x35')]:_0x526e70[_0x93ed('0x34')];if(_0x2dd4e6['query'][_0x93ed('0x43')]){_0x37394f[_0x93ed('0x44')]=[{'all':!![]}];}_0x37394f=_[_0x93ed('0x3f')]({},_0x37394f,_0x2dd4e6['options']);return db['FaxQueue'][_0x93ed('0x49')](_0x37394f)[_0x93ed('0x25')](handleEntityNotFound(_0x4b0303,null))[_0x93ed('0x25')](respondWithResult(_0x4b0303,null))[_0x93ed('0x46')](handleError(_0x4b0303,null));};exports[_0x93ed('0x4a')]=function(_0x522a02,_0x5b6573){return db[_0x93ed('0x2c')][_0x93ed('0x4a')](_0x522a02[_0x93ed('0x4b')],{})[_0x93ed('0x25')](function(_0x4156e2){var _0x2ba795=_0x522a02['user'][_0x93ed('0x26')]({'plain':!![]});if(!_0x2ba795)throw new Error(_0x93ed('0x4c'));if(_0x2ba795[_0x93ed('0x4d')]==='user'){var _0x53bcf3=_0x4156e2[_0x93ed('0x26')]({'plain':!![]});var _0x3aafc7='FaxQueues';return db[_0x93ed('0x4e')][_0x93ed('0x49')]({'where':{'name':_0x3aafc7,'userProfileId':_0x2ba795[_0x93ed('0x4f')]},'raw':!![]})[_0x93ed('0x25')](function(_0x132a18){if(_0x132a18&&_0x132a18[_0x93ed('0x50')]===0x0){return db[_0x93ed('0x51')]['create']({'name':_0x53bcf3[_0x93ed('0x2a')],'resourceId':_0x53bcf3['id'],'type':_0x132a18['name'],'sectionId':_0x132a18['id']},{})[_0x93ed('0x25')](function(){return _0x4156e2;});}else{return _0x4156e2;}})['catch'](function(_0x2e397c){logger[_0x93ed('0x28')](_0x93ed('0x52'),_0x2e397c);throw _0x2e397c;});}return _0x4156e2;})[_0x93ed('0x25')](respondWithResult(_0x5b6573,0xc9))['catch'](handleError(_0x5b6573,null));};exports[_0x93ed('0x24')]=function(_0x3a337a,_0x2be67f){if(_0x3a337a[_0x93ed('0x4b')]['id']){delete _0x3a337a[_0x93ed('0x4b')]['id'];}return db[_0x93ed('0x2c')][_0x93ed('0x49')]({'where':{'id':_0x3a337a['params']['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0x2be67f,null))['then'](saveUpdates(_0x3a337a[_0x93ed('0x4b')],null))[_0x93ed('0x25')](respondWithResult(_0x2be67f,null))[_0x93ed('0x46')](handleError(_0x2be67f,null));};exports[_0x93ed('0x53')]=function(_0x48af3e,_0x2970bf){return db[_0x93ed('0x2c')][_0x93ed('0x49')]({'where':{'id':_0x48af3e['params']['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0x2970bf,null))['then'](removeEntity(_0x2970bf,null))[_0x93ed('0x46')](handleError(_0x2970bf,null));};exports['describe']=function(_0x412c21,_0x375231){return db[_0x93ed('0x2c')][_0x93ed('0x54')]()['then'](respondWithResult(_0x375231,null))[_0x93ed('0x46')](handleError(_0x375231,null));};exports['getMembers']=function(_0xbebf71,_0x130bed,_0x5c23fc){var _0x28bed2={'raw':!![],'where':{}},_0x3bd9ce={},_0x10d249;return db[_0x93ed('0x2c')]['findOne']({'where':{'id':_0xbebf71[_0x93ed('0x47')]['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0x130bed,null))[_0x93ed('0x25')](function(_0x57325f){if(_0x57325f){_0x10d249=_0x57325f[_0x93ed('0x26')]({'plain':!![]});_0x3bd9ce[_0x93ed('0x34')]=_[_0x93ed('0x48')](db['UserFaxQueue'][_0x93ed('0x2d')]);_0x3bd9ce[_0x93ed('0x31')]=_[_0x93ed('0x48')](_0xbebf71['query']);_0x3bd9ce[_0x93ed('0x32')]=_[_0x93ed('0x33')](_0x3bd9ce[_0x93ed('0x34')],_0x3bd9ce[_0x93ed('0x31')]);_0x28bed2['attributes']=_[_0x93ed('0x33')](_0x3bd9ce[_0x93ed('0x34')],qs[_0x93ed('0x36')](_0xbebf71['query'][_0x93ed('0x36')]));_0x28bed2[_0x93ed('0x35')]=_0x28bed2[_0x93ed('0x35')][_0x93ed('0x37')]?_0x28bed2[_0x93ed('0x35')]:_0x3bd9ce[_0x93ed('0x34')];if(!_0xbebf71[_0x93ed('0x31')][_0x93ed('0x38')](_0x93ed('0x39'))){_0x28bed2['limit']=qs[_0x93ed('0x3a')](_0xbebf71[_0x93ed('0x31')]['limit']);_0x28bed2[_0x93ed('0x1f')]=qs['offset'](_0xbebf71[_0x93ed('0x31')][_0x93ed('0x1f')]);}_0x28bed2[_0x93ed('0x3b')]=qs[_0x93ed('0x3c')](_0xbebf71[_0x93ed('0x31')]['sort']);_0x28bed2[_0x93ed('0x3d')]=qs[_0x93ed('0x32')](_[_0x93ed('0x55')](_0xbebf71[_0x93ed('0x31')],_0x3bd9ce['filters']));_0x28bed2[_0x93ed('0x3d')][_0x93ed('0x56')]=_0x57325f['id'];if(_0xbebf71['query']['filter']){_0x28bed2[_0x93ed('0x3d')]=_[_0x93ed('0x3f')](_0x28bed2[_0x93ed('0x3d')],{'$or':_['map'](_0x28bed2[_0x93ed('0x35')],function(_0x25efc2){var _0x234456={};_0x234456[_0x25efc2]={'$like':'%'+_0xbebf71[_0x93ed('0x31')][_0x93ed('0x3e')]+'%'};return _0x234456;})});}_0x28bed2=_[_0x93ed('0x3f')]({},_0x28bed2,_0xbebf71[_0x93ed('0x42')]);return db[_0x93ed('0x57')][_0x93ed('0x58')](_0x28bed2);}})[_0x93ed('0x25')](function(_0x59c7f3){if(_0x59c7f3){return db[_0x93ed('0x59')]['findAndCountAll']({'where':{'id':_[_0x93ed('0x40')](_0x59c7f3,'UserId'),'role':'agent'},'attributes':['id',_0x93ed('0x2a'),'faxPause','updatedAt',_0x93ed('0x5a')]});}})[_0x93ed('0x25')](function(_0x4a82d2){if(_0x4a82d2){return{'count':_0x4a82d2[_0x93ed('0x1e')],'rows':_['map'](_0x4a82d2['rows'],function(_0x27279e){return{'membername':_0x27279e['name'],'UserId':_0x27279e['id'],'queue_name':_0x10d249[_0x93ed('0x2a')],'FaxQueueId':_0x10d249['id'],'interface':util['format'](_0x93ed('0x5b'),'SIP',_0x27279e[_0x93ed('0x2a')]),'penalty':0x0,'paused':_0x27279e[_0x93ed('0x5c')],'createdAt':_0x27279e['createdAt'],'updatedAt':_0x27279e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x93ed('0x25')](respondWithFilteredResult(_0x130bed,_0x28bed2))['catch'](handleError(_0x130bed,null));};exports[_0x93ed('0x5d')]=function(_0x314bd9,_0x429a3c,_0x36be07){var _0xc2fbda={};var _0x330dfa={};var _0x579af9;var _0x1f569d;return db[_0x93ed('0x2c')][_0x93ed('0x5e')]({'where':{'id':_0x314bd9[_0x93ed('0x47')]['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0x429a3c,null))[_0x93ed('0x25')](function(_0x356618){if(_0x356618){_0x579af9=_0x356618;_0x330dfa[_0x93ed('0x34')]=_['keys'](db[_0x93ed('0x5f')][_0x93ed('0x2d')]);_0x330dfa[_0x93ed('0x31')]=_[_0x93ed('0x48')](_0x314bd9[_0x93ed('0x31')]);_0x330dfa['filters']=_[_0x93ed('0x33')](_0x330dfa[_0x93ed('0x34')],_0x330dfa[_0x93ed('0x31')]);_0xc2fbda[_0x93ed('0x35')]=_[_0x93ed('0x33')](_0x330dfa[_0x93ed('0x34')],qs[_0x93ed('0x36')](_0x314bd9[_0x93ed('0x31')][_0x93ed('0x36')]));_0xc2fbda[_0x93ed('0x35')]=_0xc2fbda[_0x93ed('0x35')][_0x93ed('0x37')]?_0xc2fbda[_0x93ed('0x35')]:_0x330dfa[_0x93ed('0x34')];_0xc2fbda['order']=qs[_0x93ed('0x3c')](_0x314bd9['query'][_0x93ed('0x3c')]);_0xc2fbda[_0x93ed('0x3d')]=qs[_0x93ed('0x32')](_[_0x93ed('0x55')](_0x314bd9[_0x93ed('0x31')],_0x330dfa[_0x93ed('0x32')]));if(_0x314bd9[_0x93ed('0x31')][_0x93ed('0x3e')]){_0xc2fbda[_0x93ed('0x3d')]=_[_0x93ed('0x3f')](_0xc2fbda[_0x93ed('0x3d')],{'$or':_[_0x93ed('0x40')](_0xc2fbda[_0x93ed('0x35')],function(_0xf46ea6){var _0x4b555c={};_0x4b555c[_0xf46ea6]={'$like':'%'+_0x314bd9[_0x93ed('0x31')][_0x93ed('0x3e')]+'%'};return _0x4b555c;})});}_0xc2fbda=_[_0x93ed('0x3f')]({},_0xc2fbda,_0x314bd9[_0x93ed('0x42')]);return _0x579af9['getTeams'](_0xc2fbda);}})[_0x93ed('0x25')](function(_0x220f26){if(_0x220f26){_0x1f569d=_0x220f26[_0x93ed('0x37')];if(!_0x314bd9[_0x93ed('0x31')][_0x93ed('0x38')](_0x93ed('0x39'))){_0xc2fbda[_0x93ed('0x3a')]=qs[_0x93ed('0x3a')](_0x314bd9[_0x93ed('0x31')][_0x93ed('0x3a')]);_0xc2fbda[_0x93ed('0x1f')]=qs[_0x93ed('0x1f')](_0x314bd9[_0x93ed('0x31')][_0x93ed('0x1f')]);}return _0x579af9['getTeams'](_0xc2fbda);}})[_0x93ed('0x25')](function(_0xe2634b){if(_0xe2634b){return _0xe2634b?{'count':_0x1f569d,'rows':_0xe2634b}:null;}})[_0x93ed('0x25')](respondWithResult(_0x429a3c,null))[_0x93ed('0x46')](handleError(_0x429a3c,null));};exports[_0x93ed('0x60')]=function(_0x5060c1,_0xace51c,_0x10dc8a){var _0x2cd5ef=_0x5060c1[_0x93ed('0x4b')][_0x93ed('0x61')];return db[_0x93ed('0x5f')][_0x93ed('0x58')]({'where':{'id':_0x2cd5ef},'attributes':['id'],'include':[{'model':db[_0x93ed('0x59')],'as':_0x93ed('0x62'),'attributes':['id','name','online',_0x93ed('0x63'),_0x93ed('0x64')],'raw':!![]}]})[_0x93ed('0x25')](function(_0x4fccff){if(_0x4fccff){var _0x5145a0=_[_0x93ed('0x65')](_0x4fccff,function(_0x2ed854){var _0x1cf8d0=_0x2ed854[_0x93ed('0x26')]({'plain':!![]});return _0x1cf8d0[_0x93ed('0x62')];});return db[_0x93ed('0x2c')][_0x93ed('0x49')]({'where':{'id':_0x5060c1[_0x93ed('0x47')]['id']}})[_0x93ed('0x25')](function(_0x28147f){return db[_0x93ed('0x66')][_0x93ed('0x67')](function(_0x3f8b81){return _0x28147f['addTeams'](_0x2cd5ef,{'transaction':_0x3f8b81})[_0x93ed('0x25')](function(){return BPromise[_0x93ed('0x68')](_0x5145a0,function(_0x1b6d7c){return db['UserFaxQueue'][_0x93ed('0x69')]({'where':{'UserId':_0x1b6d7c['id'],'FaxQueueId':_0x5060c1[_0x93ed('0x47')]['id']},'transaction':_0x3f8b81});});})[_0x93ed('0x25')](function(){_0x5145a0[_0x93ed('0x6a')](function(_0x3ed1a3){socket[_0x93ed('0x6b')]('userFaxQueue:save',{'UserId':_0x3ed1a3['id'],'FaxQueueId':_0x28147f['id']});});});});});}})[_0x93ed('0x25')](respondWithStatusCode(_0xace51c,null))[_0x93ed('0x46')](handleError(_0xace51c,null));};exports[_0x93ed('0x6c')]=function(_0xb8611a,_0x433ce4,_0x1d288c){return db['Team'][_0x93ed('0x58')]({'where':{'id':_0xb8611a[_0x93ed('0x31')][_0x93ed('0x61')]},'attributes':['id'],'include':[{'model':db[_0x93ed('0x59')],'as':_0x93ed('0x62'),'attributes':['id'],'raw':!![]}]})[_0x93ed('0x25')](handleEntityNotFound(_0x433ce4,null))[_0x93ed('0x25')](function(_0x44bb2c){var _0x2f673e=_[_0x93ed('0x40')](_0x44bb2c,'id');var _0x13bac9=[];var _0x447ed1=[];var _0x5b4174=squel[_0x93ed('0x6d')]();_0x5b4174['field'](_0x93ed('0x6e'))[_0x93ed('0x6f')](_0x93ed('0x70'),'tq')[_0x93ed('0x71')](_0x93ed('0x72'),'ut',_0x93ed('0x73'))[_0x93ed('0x3d')](_0x93ed('0x74'),_0xb8611a[_0x93ed('0x47')]['id']);for(var _0xfd0e00=0x0;_0xfd0e00<_0x44bb2c[_0x93ed('0x37')];_0xfd0e00+=0x1){let _0x2cc646=_0x44bb2c[_0xfd0e00];for(var _0x370e5f=0x0;_0x370e5f<_0x2cc646[_0x93ed('0x62')][_0x93ed('0x37')];_0x370e5f+=0x1){let _0x2cfa68=_0x2cc646[_0x93ed('0x62')][_0x370e5f];var _0x59199e=_0x5b4174['clone']();_0x59199e[_0x93ed('0x3d')](_0x93ed('0x75'),_0x2cfa68['id']);_0x447ed1[_0x93ed('0x76')](db[_0x93ed('0x66')]['query'](_0x59199e[_0x93ed('0x77')](),{'type':db['sequelize'][_0x93ed('0x78')][_0x93ed('0x79')]})['then'](function(_0x3a1e3f){if(_0x3a1e3f[_0x93ed('0x37')]===0x1){return _0x2cfa68['id'];}else{var _0x111b4a=_['every'](_[_0x93ed('0x40')](_0x3a1e3f,'TeamId'),function(_0x336d26){return _['includes'](_0x2f673e,_0x336d26);});if(_0x111b4a){return _0x2cfa68['id'];}}}));}}return BPromise[_0x93ed('0x7a')](_0x447ed1)[_0x93ed('0x25')](function(_0x1b20d8){_0x13bac9=_(_0x13bac9)[_0x93ed('0x7b')](_0x1b20d8)[_0x93ed('0x7c')]()['value']();return db[_0x93ed('0x2c')][_0x93ed('0x49')]({'where':{'id':_0xb8611a['params']['id']}})['then'](function(_0x3f3544){return db[_0x93ed('0x66')][_0x93ed('0x67')](function(_0x3cdb78){return _0x3f3544[_0x93ed('0x6c')](_0xb8611a[_0x93ed('0x31')][_0x93ed('0x61')],{'transaction':_0x3cdb78})[_0x93ed('0x25')](function(){if(!_[_0x93ed('0x7d')](_0x13bac9)){return _0x3f3544[_0x93ed('0x7e')](_0x13bac9,{'transaction':_0x3cdb78});}})['then'](function(){_0x13bac9[_0x93ed('0x6a')](function(_0x5f2f83){socket[_0x93ed('0x6b')](_0x93ed('0x7f'),{'UserId':_0x5f2f83,'FaxQueueId':_0x3f3544['id']});});});});});});})[_0x93ed('0x25')](respondWithStatusCode(_0x433ce4,null))['catch'](handleError(_0x433ce4,null));};exports[_0x93ed('0x80')]=function(_0x149cfb,_0x4d0531,_0x57b347){return db[_0x93ed('0x2c')]['find']({'where':{'id':_0x149cfb['params']['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0x4d0531,null))[_0x93ed('0x25')](function(_0x1654c4){if(_0x1654c4){return _0x1654c4[_0x93ed('0x80')](_0x149cfb[_0x93ed('0x4b')][_0x93ed('0x61')],_[_0x93ed('0x81')](_0x149cfb[_0x93ed('0x4b')],[_0x93ed('0x61'),'id'])||{})[_0x93ed('0x82')](function(_0x51d39c){for(var _0x56e84d=0x0;_0x56e84d<_0x149cfb[_0x93ed('0x4b')][_0x93ed('0x61')][_0x93ed('0x37')];_0x56e84d+=0x1){socket[_0x93ed('0x6b')]('userFaxQueue:save',{'UserId':_0x149cfb['body']['ids'][_0x56e84d],'FaxQueueId':_0x149cfb[_0x93ed('0x47')]['id']});}return _0x51d39c;});}})[_0x93ed('0x25')](respondWithResult(_0x4d0531,null))[_0x93ed('0x46')](handleError(_0x4d0531,null));};exports[_0x93ed('0x7e')]=function(_0x134f7b,_0xdda670,_0x52e309){return db[_0x93ed('0x2c')][_0x93ed('0x49')]({'where':{'id':_0x134f7b[_0x93ed('0x47')]['id']}})[_0x93ed('0x25')](handleEntityNotFound(_0xdda670,null))[_0x93ed('0x25')](function(_0x2b7fbe){if(_0x2b7fbe){return _0x2b7fbe[_0x93ed('0x7e')](_0x134f7b[_0x93ed('0x31')][_0x93ed('0x61')])['then'](function(){if(_['isArray'](_0x134f7b[_0x93ed('0x31')][_0x93ed('0x61')])){for(var _0xe9aa5b=0x0;_0xe9aa5b<_0x134f7b[_0x93ed('0x31')]['ids'][_0x93ed('0x37')];_0xe9aa5b+=0x1){socket['emit'](_0x93ed('0x7f'),{'UserId':Number(_0x134f7b['query']['ids'][_0xe9aa5b]),'FaxQueueId':Number(_0x134f7b[_0x93ed('0x47')]['id'])});}}else{socket[_0x93ed('0x6b')](_0x93ed('0x7f'),{'UserId':Number(_0x134f7b['query'][_0x93ed('0x61')]),'FaxQueueId':Number(_0x134f7b[_0x93ed('0x47')]['id'])});}});}})[_0x93ed('0x25')](respondWithStatusCode(_0xdda670,null))['catch'](handleError(_0xdda670,null));};exports[_0x93ed('0x83')]=function(_0x52ec83,_0x3f5e59,_0x5d6352){var _0x4bc54f={};var _0x5808e2={};var _0xbe3464;var _0xb95230;return db[_0x93ed('0x2c')][_0x93ed('0x5e')]({'where':{'id':_0x52ec83[_0x93ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f5e59,null))[_0x93ed('0x25')](function(_0x2c57a7){if(_0x2c57a7){_0xbe3464=_0x2c57a7;_0x5808e2[_0x93ed('0x34')]=_[_0x93ed('0x48')](db[_0x93ed('0x59')]['rawAttributes']);_0x5808e2[_0x93ed('0x31')]=_['keys'](_0x52ec83['query']);_0x5808e2[_0x93ed('0x32')]=_[_0x93ed('0x33')](_0x5808e2[_0x93ed('0x34')],_0x5808e2[_0x93ed('0x31')]);_0x4bc54f['attributes']=_[_0x93ed('0x33')](_0x5808e2['model'],qs[_0x93ed('0x36')](_0x52ec83[_0x93ed('0x31')][_0x93ed('0x36')]));_0x4bc54f[_0x93ed('0x35')]=_0x4bc54f['attributes'][_0x93ed('0x37')]?_0x4bc54f[_0x93ed('0x35')]:_0x5808e2[_0x93ed('0x34')];_0x4bc54f[_0x93ed('0x3b')]=qs[_0x93ed('0x3c')](_0x52ec83[_0x93ed('0x31')][_0x93ed('0x3c')]);_0x4bc54f[_0x93ed('0x3d')]=qs[_0x93ed('0x32')](_[_0x93ed('0x55')](_0x52ec83[_0x93ed('0x31')],_0x5808e2[_0x93ed('0x32')]));if(_0x52ec83['query'][_0x93ed('0x3e')]){_0x4bc54f[_0x93ed('0x3d')]=_[_0x93ed('0x3f')](_0x4bc54f[_0x93ed('0x3d')],{'$or':_[_0x93ed('0x40')](_0x4bc54f[_0x93ed('0x35')],function(_0x31625a){var _0x3c9e5c={};_0x3c9e5c[_0x31625a]={'$like':'%'+_0x52ec83[_0x93ed('0x31')]['filter']+'%'};return _0x3c9e5c;})});}_0x4bc54f=_[_0x93ed('0x3f')]({},_0x4bc54f,_0x52ec83[_0x93ed('0x42')]);return _0xbe3464[_0x93ed('0x83')](_0x4bc54f);}})['then'](function(_0xed7dc3){if(_0xed7dc3){_0xb95230=_0xed7dc3['length'];if(!_0x52ec83['query'][_0x93ed('0x38')]('nolimit')){_0x4bc54f['limit']=qs[_0x93ed('0x3a')](_0x52ec83['query']['limit']);_0x4bc54f[_0x93ed('0x1f')]=qs[_0x93ed('0x1f')](_0x52ec83[_0x93ed('0x31')][_0x93ed('0x1f')]);}return _0xbe3464[_0x93ed('0x83')](_0x4bc54f);}})[_0x93ed('0x25')](function(_0x43f3f9){if(_0x43f3f9){return _0x43f3f9?{'count':_0xb95230,'rows':_0x43f3f9}:null;}})[_0x93ed('0x25')](respondWithResult(_0x3f5e59,null))[_0x93ed('0x46')](handleError(_0x3f5e59,null));}; \ No newline at end of file +var _0x0bba=['addTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','end','status','count','offset','limit','set','json','reject','save','then','destroy','get','UserProfileResource','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','FaxQueue','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserFaxQueue','sort','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','findOne','Team','getTeams'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0bba,0x143));var _0xa0bb=function(_0x135bc3,_0x3f7761){_0x135bc3=_0x135bc3-0x0;var _0x3ce56b=_0x0bba[_0x135bc3];return _0x3ce56b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0bb('0x0'));var rimraf=require(_0xa0bb('0x1'));var zipdir=require(_0xa0bb('0x2'));var jsonpatch=require(_0xa0bb('0x3'));var rp=require('request-promise');var moment=require(_0xa0bb('0x4'));var BPromise=require(_0xa0bb('0x5'));var Mustache=require(_0xa0bb('0x6'));var util=require(_0xa0bb('0x7'));var path=require(_0xa0bb('0x8'));var sox=require(_0xa0bb('0x9'));var csv=require('to-csv');var ejs=require(_0xa0bb('0xa'));var fs=require('fs');var _=require(_0xa0bb('0xb'));var squel=require(_0xa0bb('0xc'));var crypto=require(_0xa0bb('0xd'));var jsforce=require(_0xa0bb('0xe'));var deskjs=require(_0xa0bb('0xf'));var toCsv=require(_0xa0bb('0x10'));var querystring=require(_0xa0bb('0x11'));var Papa=require(_0xa0bb('0x12'));var Redis=require(_0xa0bb('0x13'));var authService=require(_0xa0bb('0x14'));var qs=require(_0xa0bb('0x15'));var as=require(_0xa0bb('0x16'));var hardwareService=require(_0xa0bb('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xa0bb('0x18'));var config=require(_0xa0bb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0bb('0x1a'))['db'];config[_0xa0bb('0x1b')]=_[_0xa0bb('0x1c')](config[_0xa0bb('0x1b')],{'host':_0xa0bb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0bb('0x1b')]));require(_0xa0bb('0x1e'))['register'](socket);function respondWithStatusCode(_0xad774a,_0x2e865a){_0x2e865a=_0x2e865a||0xcc;return function(_0x336861){if(_0x336861){return _0xad774a[_0xa0bb('0x1f')](_0x2e865a);}return _0xad774a['status'](_0x2e865a)[_0xa0bb('0x20')]();};}function respondWithResult(_0x20d328,_0x533944){_0x533944=_0x533944||0xc8;return function(_0x4d6de3){if(_0x4d6de3){return _0x20d328[_0xa0bb('0x21')](_0x533944)['json'](_0x4d6de3);}};}function respondWithFilteredResult(_0x49ae37,_0x1e01e2){return function(_0x2d9f9d){if(_0x2d9f9d){var _0x11f234=_0x2d9f9d[_0xa0bb('0x22')],_0x1c1c4b=_0x1e01e2[_0xa0bb('0x23')],_0x2c98e1=_0x1e01e2[_0xa0bb('0x23')]+_0x1e01e2[_0xa0bb('0x24')],_0x1bce2a;if(_0x2c98e1>=_0x11f234){_0x2c98e1=_0x11f234;_0x1bce2a=0xc8;}else{_0x1bce2a=0xce;}_0x49ae37[_0xa0bb('0x21')](_0x1bce2a);return _0x49ae37[_0xa0bb('0x25')]('Content-Range',_0x1c1c4b+'-'+_0x2c98e1+'/'+_0x11f234)[_0xa0bb('0x26')](_0x2d9f9d);}return null;};}function patchUpdates(_0xfa801b){return function(_0x3de247){try{jsonpatch['apply'](_0x3de247,_0xfa801b,!![]);}catch(_0x5e5e32){return BPromise[_0xa0bb('0x27')](_0x5e5e32);}return _0x3de247[_0xa0bb('0x28')]();};}function saveUpdates(_0x4a205b,_0x2add76){return function(_0x43c3af){if(_0x43c3af){return _0x43c3af['update'](_0x4a205b)[_0xa0bb('0x29')](function(_0x50e8b3){return _0x50e8b3;});}return null;};}function removeEntity(_0x2472eb,_0x1bf630){return function(_0x5457f1){if(_0x5457f1){return _0x5457f1[_0xa0bb('0x2a')]()['then'](function(){var _0x318e5f=_0x5457f1[_0xa0bb('0x2b')]({'plain':!![]});var _0x3678d3='FaxQueues';return db[_0xa0bb('0x2c')][_0xa0bb('0x2a')]({'where':{'type':_0x3678d3,'resourceId':_0x318e5f['id']}})[_0xa0bb('0x29')](function(){return _0x5457f1;});})[_0xa0bb('0x29')](function(){_0x2472eb[_0xa0bb('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe699f4,_0x566ca1){return function(_0x4f57ae){if(!_0x4f57ae){_0xe699f4[_0xa0bb('0x1f')](0x194);}return _0x4f57ae;};}function handleError(_0x230330,_0x2d1b6b){_0x2d1b6b=_0x2d1b6b||0x1f4;return function(_0x3876db){logger['error'](_0x3876db['stack']);if(_0x3876db[_0xa0bb('0x2d')]){delete _0x3876db[_0xa0bb('0x2d')];}_0x230330['status'](_0x2d1b6b)[_0xa0bb('0x2e')](_0x3876db);};}exports[_0xa0bb('0x2f')]=function(_0x1bb646,_0x59effa){var _0xd7ddad={},_0x188045={},_0x497980={'count':0x0,'rows':[]};var _0x94993f=_[_0xa0bb('0x30')](db['FaxQueue'][_0xa0bb('0x31')],function(_0x59abad){return{'name':_0x59abad[_0xa0bb('0x32')],'type':_0x59abad['type'][_0xa0bb('0x33')]};});_0x188045['model']=_[_0xa0bb('0x30')](_0x94993f,'name');_0x188045[_0xa0bb('0x34')]=_[_0xa0bb('0x35')](_0x1bb646[_0xa0bb('0x34')]);_0x188045[_0xa0bb('0x36')]=_[_0xa0bb('0x37')](_0x188045[_0xa0bb('0x38')],_0x188045[_0xa0bb('0x34')]);_0xd7ddad[_0xa0bb('0x39')]=_['intersection'](_0x188045['model'],qs['fields'](_0x1bb646[_0xa0bb('0x34')][_0xa0bb('0x3a')]));_0xd7ddad['attributes']=_0xd7ddad[_0xa0bb('0x39')]['length']?_0xd7ddad[_0xa0bb('0x39')]:_0x188045[_0xa0bb('0x38')];if(!_0x1bb646[_0xa0bb('0x34')][_0xa0bb('0x3b')](_0xa0bb('0x3c'))){_0xd7ddad[_0xa0bb('0x24')]=qs[_0xa0bb('0x24')](_0x1bb646[_0xa0bb('0x34')]['limit']);_0xd7ddad[_0xa0bb('0x23')]=qs['offset'](_0x1bb646[_0xa0bb('0x34')][_0xa0bb('0x23')]);}_0xd7ddad[_0xa0bb('0x3d')]=qs['sort'](_0x1bb646['query']['sort']);_0xd7ddad[_0xa0bb('0x3e')]=qs[_0xa0bb('0x36')](_[_0xa0bb('0x3f')](_0x1bb646[_0xa0bb('0x34')],_0x188045[_0xa0bb('0x36')]),_0x94993f);if(_0x1bb646['query'][_0xa0bb('0x40')]){_0xd7ddad['where']=_[_0xa0bb('0x41')](_0xd7ddad[_0xa0bb('0x3e')],{'$or':_[_0xa0bb('0x30')](_0x94993f,function(_0x4f5d07){if(_0x4f5d07[_0xa0bb('0x42')]!==_0xa0bb('0x43')){var _0x1376c9={};_0x1376c9[_0x4f5d07['name']]={'$like':'%'+_0x1bb646['query'][_0xa0bb('0x40')]+'%'};return _0x1376c9;}})});}_0xd7ddad=_[_0xa0bb('0x41')]({},_0xd7ddad,_0x1bb646[_0xa0bb('0x44')]);var _0x2bb8f6={'where':_0xd7ddad[_0xa0bb('0x3e')]};return db['FaxQueue'][_0xa0bb('0x22')](_0x2bb8f6)[_0xa0bb('0x29')](function(_0x11b69e){_0x497980[_0xa0bb('0x22')]=_0x11b69e;if(_0x1bb646[_0xa0bb('0x34')]['includeAll']){_0xd7ddad[_0xa0bb('0x45')]=[{'all':!![]}];}return db[_0xa0bb('0x46')][_0xa0bb('0x47')](_0xd7ddad);})[_0xa0bb('0x29')](function(_0x276934){_0x497980[_0xa0bb('0x48')]=_0x276934;return _0x497980;})[_0xa0bb('0x29')](respondWithFilteredResult(_0x59effa,_0xd7ddad))[_0xa0bb('0x49')](handleError(_0x59effa,null));};exports[_0xa0bb('0x4a')]=function(_0x453e8d,_0x4dcaea){var _0x45ee20={'raw':!![],'where':{'id':_0x453e8d[_0xa0bb('0x4b')]['id']}},_0x390ab1={};_0x390ab1[_0xa0bb('0x38')]=_[_0xa0bb('0x35')](db[_0xa0bb('0x46')]['rawAttributes']);_0x390ab1['query']=_[_0xa0bb('0x35')](_0x453e8d[_0xa0bb('0x34')]);_0x390ab1[_0xa0bb('0x36')]=_[_0xa0bb('0x37')](_0x390ab1['model'],_0x390ab1[_0xa0bb('0x34')]);_0x45ee20[_0xa0bb('0x39')]=_[_0xa0bb('0x37')](_0x390ab1['model'],qs[_0xa0bb('0x3a')](_0x453e8d['query']['fields']));_0x45ee20[_0xa0bb('0x39')]=_0x45ee20[_0xa0bb('0x39')][_0xa0bb('0x4c')]?_0x45ee20[_0xa0bb('0x39')]:_0x390ab1[_0xa0bb('0x38')];if(_0x453e8d[_0xa0bb('0x34')]['includeAll']){_0x45ee20['include']=[{'all':!![]}];}_0x45ee20=_[_0xa0bb('0x41')]({},_0x45ee20,_0x453e8d['options']);return db['FaxQueue']['find'](_0x45ee20)[_0xa0bb('0x29')](handleEntityNotFound(_0x4dcaea,null))[_0xa0bb('0x29')](respondWithResult(_0x4dcaea,null))[_0xa0bb('0x49')](handleError(_0x4dcaea,null));};exports['create']=function(_0x152365,_0x17396b){return db[_0xa0bb('0x46')][_0xa0bb('0x4d')](_0x152365[_0xa0bb('0x4e')],{})[_0xa0bb('0x29')](function(_0x5d362a){var _0xc2dcd3=_0x152365[_0xa0bb('0x4f')][_0xa0bb('0x2b')]({'plain':!![]});if(!_0xc2dcd3)throw new Error(_0xa0bb('0x50'));if(_0xc2dcd3[_0xa0bb('0x51')]===_0xa0bb('0x4f')){var _0x2f9e90=_0x5d362a[_0xa0bb('0x2b')]({'plain':!![]});var _0x355609='FaxQueues';return db[_0xa0bb('0x52')][_0xa0bb('0x53')]({'where':{'name':_0x355609,'userProfileId':_0xc2dcd3[_0xa0bb('0x54')]},'raw':!![]})['then'](function(_0x2015fb){if(_0x2015fb&&_0x2015fb[_0xa0bb('0x55')]===0x0){return db[_0xa0bb('0x2c')][_0xa0bb('0x4d')]({'name':_0x2f9e90['name'],'resourceId':_0x2f9e90['id'],'type':_0x2015fb[_0xa0bb('0x2d')],'sectionId':_0x2015fb['id']},{})['then'](function(){return _0x5d362a;});}else{return _0x5d362a;}})[_0xa0bb('0x49')](function(_0x11547a){logger[_0xa0bb('0x56')](_0xa0bb('0x57'),_0x11547a);throw _0x11547a;});}return _0x5d362a;})[_0xa0bb('0x29')](respondWithResult(_0x17396b,0xc9))[_0xa0bb('0x49')](handleError(_0x17396b,null));};exports[_0xa0bb('0x58')]=function(_0x365f11,_0x5897cf){if(_0x365f11[_0xa0bb('0x4e')]['id']){delete _0x365f11[_0xa0bb('0x4e')]['id'];}return db[_0xa0bb('0x46')]['find']({'where':{'id':_0x365f11[_0xa0bb('0x4b')]['id']}})[_0xa0bb('0x29')](handleEntityNotFound(_0x5897cf,null))[_0xa0bb('0x29')](saveUpdates(_0x365f11[_0xa0bb('0x4e')],null))[_0xa0bb('0x29')](respondWithResult(_0x5897cf,null))[_0xa0bb('0x49')](handleError(_0x5897cf,null));};exports[_0xa0bb('0x2a')]=function(_0x5d9885,_0x143f1d){return db['FaxQueue']['find']({'where':{'id':_0x5d9885['params']['id']}})['then'](handleEntityNotFound(_0x143f1d,null))[_0xa0bb('0x29')](removeEntity(_0x143f1d,null))[_0xa0bb('0x49')](handleError(_0x143f1d,null));};exports[_0xa0bb('0x59')]=function(_0x3b7ec1,_0x22c45b){return db[_0xa0bb('0x46')]['describe']()[_0xa0bb('0x29')](respondWithResult(_0x22c45b,null))[_0xa0bb('0x49')](handleError(_0x22c45b,null));};exports[_0xa0bb('0x5a')]=function(_0x38236a,_0x54cbf7,_0x232b4e){var _0x117a7e={'raw':!![],'where':{}},_0xcc6ce={},_0x39e1ca;return db[_0xa0bb('0x46')]['findOne']({'where':{'id':_0x38236a[_0xa0bb('0x4b')]['id']}})[_0xa0bb('0x29')](handleEntityNotFound(_0x54cbf7,null))[_0xa0bb('0x29')](function(_0x5b8000){if(_0x5b8000){_0x39e1ca=_0x5b8000[_0xa0bb('0x2b')]({'plain':!![]});_0xcc6ce[_0xa0bb('0x38')]=_['keys'](db[_0xa0bb('0x5b')][_0xa0bb('0x31')]);_0xcc6ce['query']=_[_0xa0bb('0x35')](_0x38236a[_0xa0bb('0x34')]);_0xcc6ce[_0xa0bb('0x36')]=_['intersection'](_0xcc6ce[_0xa0bb('0x38')],_0xcc6ce[_0xa0bb('0x34')]);_0x117a7e[_0xa0bb('0x39')]=_['intersection'](_0xcc6ce[_0xa0bb('0x38')],qs[_0xa0bb('0x3a')](_0x38236a['query']['fields']));_0x117a7e[_0xa0bb('0x39')]=_0x117a7e[_0xa0bb('0x39')][_0xa0bb('0x4c')]?_0x117a7e[_0xa0bb('0x39')]:_0xcc6ce[_0xa0bb('0x38')];if(!_0x38236a[_0xa0bb('0x34')][_0xa0bb('0x3b')](_0xa0bb('0x3c'))){_0x117a7e['limit']=qs[_0xa0bb('0x24')](_0x38236a[_0xa0bb('0x34')][_0xa0bb('0x24')]);_0x117a7e[_0xa0bb('0x23')]=qs[_0xa0bb('0x23')](_0x38236a[_0xa0bb('0x34')]['offset']);}_0x117a7e[_0xa0bb('0x3d')]=qs[_0xa0bb('0x5c')](_0x38236a[_0xa0bb('0x34')][_0xa0bb('0x5c')]);_0x117a7e[_0xa0bb('0x3e')]=qs[_0xa0bb('0x36')](_[_0xa0bb('0x3f')](_0x38236a[_0xa0bb('0x34')],_0xcc6ce[_0xa0bb('0x36')]));_0x117a7e[_0xa0bb('0x3e')]['FaxQueueId']=_0x5b8000['id'];if(_0x38236a['query'][_0xa0bb('0x40')]){_0x117a7e[_0xa0bb('0x3e')]=_[_0xa0bb('0x41')](_0x117a7e[_0xa0bb('0x3e')],{'$or':_[_0xa0bb('0x30')](_0x117a7e[_0xa0bb('0x39')],function(_0x54099b){var _0x442374={};_0x442374[_0x54099b]={'$like':'%'+_0x38236a[_0xa0bb('0x34')]['filter']+'%'};return _0x442374;})});}_0x117a7e=_['merge']({},_0x117a7e,_0x38236a['options']);return db[_0xa0bb('0x5b')][_0xa0bb('0x47')](_0x117a7e);}})[_0xa0bb('0x29')](function(_0x4c9485){if(_0x4c9485){return db[_0xa0bb('0x5d')][_0xa0bb('0x5e')]({'where':{'id':_['map'](_0x4c9485,_0xa0bb('0x5f')),'role':'agent'},'attributes':['id',_0xa0bb('0x2d'),_0xa0bb('0x60'),_0xa0bb('0x61'),_0xa0bb('0x62')]});}})['then'](function(_0x427bb1){if(_0x427bb1){return{'count':_0x427bb1[_0xa0bb('0x22')],'rows':_[_0xa0bb('0x30')](_0x427bb1[_0xa0bb('0x48')],function(_0x3cc3ff){return{'membername':_0x3cc3ff[_0xa0bb('0x2d')],'UserId':_0x3cc3ff['id'],'queue_name':_0x39e1ca['name'],'FaxQueueId':_0x39e1ca['id'],'interface':util[_0xa0bb('0x63')]('%s/%s','SIP',_0x3cc3ff[_0xa0bb('0x2d')]),'penalty':0x0,'paused':_0x3cc3ff[_0xa0bb('0x60')],'createdAt':_0x3cc3ff[_0xa0bb('0x62')],'updatedAt':_0x3cc3ff[_0xa0bb('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x54cbf7,_0x117a7e))[_0xa0bb('0x49')](handleError(_0x54cbf7,null));};exports['getTeams']=function(_0x1deeaa,_0x1437ce,_0x508356){var _0x540e43={};var _0x143400={};var _0x3f3899;var _0x41f48d;return db[_0xa0bb('0x46')][_0xa0bb('0x64')]({'where':{'id':_0x1deeaa[_0xa0bb('0x4b')]['id']}})[_0xa0bb('0x29')](handleEntityNotFound(_0x1437ce,null))['then'](function(_0x59d5dd){if(_0x59d5dd){_0x3f3899=_0x59d5dd;_0x143400[_0xa0bb('0x38')]=_[_0xa0bb('0x35')](db[_0xa0bb('0x65')][_0xa0bb('0x31')]);_0x143400[_0xa0bb('0x34')]=_['keys'](_0x1deeaa[_0xa0bb('0x34')]);_0x143400['filters']=_[_0xa0bb('0x37')](_0x143400['model'],_0x143400[_0xa0bb('0x34')]);_0x540e43[_0xa0bb('0x39')]=_[_0xa0bb('0x37')](_0x143400[_0xa0bb('0x38')],qs[_0xa0bb('0x3a')](_0x1deeaa[_0xa0bb('0x34')][_0xa0bb('0x3a')]));_0x540e43[_0xa0bb('0x39')]=_0x540e43[_0xa0bb('0x39')][_0xa0bb('0x4c')]?_0x540e43[_0xa0bb('0x39')]:_0x143400['model'];_0x540e43[_0xa0bb('0x3d')]=qs[_0xa0bb('0x5c')](_0x1deeaa[_0xa0bb('0x34')][_0xa0bb('0x5c')]);_0x540e43['where']=qs[_0xa0bb('0x36')](_[_0xa0bb('0x3f')](_0x1deeaa[_0xa0bb('0x34')],_0x143400['filters']));if(_0x1deeaa[_0xa0bb('0x34')]['filter']){_0x540e43[_0xa0bb('0x3e')]=_[_0xa0bb('0x41')](_0x540e43[_0xa0bb('0x3e')],{'$or':_[_0xa0bb('0x30')](_0x540e43[_0xa0bb('0x39')],function(_0x8b04dd){var _0x27ec1a={};_0x27ec1a[_0x8b04dd]={'$like':'%'+_0x1deeaa[_0xa0bb('0x34')][_0xa0bb('0x40')]+'%'};return _0x27ec1a;})});}_0x540e43=_[_0xa0bb('0x41')]({},_0x540e43,_0x1deeaa[_0xa0bb('0x44')]);return _0x3f3899['getTeams'](_0x540e43);}})[_0xa0bb('0x29')](function(_0x4ea2ac){if(_0x4ea2ac){_0x41f48d=_0x4ea2ac[_0xa0bb('0x4c')];if(!_0x1deeaa[_0xa0bb('0x34')][_0xa0bb('0x3b')](_0xa0bb('0x3c'))){_0x540e43['limit']=qs[_0xa0bb('0x24')](_0x1deeaa['query'][_0xa0bb('0x24')]);_0x540e43['offset']=qs[_0xa0bb('0x23')](_0x1deeaa['query']['offset']);}return _0x3f3899[_0xa0bb('0x66')](_0x540e43);}})[_0xa0bb('0x29')](function(_0xe7fc0b){if(_0xe7fc0b){return _0xe7fc0b?{'count':_0x41f48d,'rows':_0xe7fc0b}:null;}})[_0xa0bb('0x29')](respondWithResult(_0x1437ce,null))['catch'](handleError(_0x1437ce,null));};exports[_0xa0bb('0x67')]=function(_0x200110,_0x1ed7e8,_0x22f16f){var _0x158a2c=_0x200110[_0xa0bb('0x4e')][_0xa0bb('0x68')];return db['Team'][_0xa0bb('0x47')]({'where':{'id':_0x158a2c},'attributes':['id'],'include':[{'model':db[_0xa0bb('0x5d')],'as':_0xa0bb('0x69'),'attributes':['id','name',_0xa0bb('0x6a'),'voicePause',_0xa0bb('0x6b')],'raw':!![]}]})['then'](function(_0x1dc5dd){if(_0x1dc5dd){var _0x2292de=_[_0xa0bb('0x6c')](_0x1dc5dd,function(_0x5caf33){var _0x4144e1=_0x5caf33['get']({'plain':!![]});return _0x4144e1[_0xa0bb('0x69')];});return db[_0xa0bb('0x46')][_0xa0bb('0x53')]({'where':{'id':_0x200110[_0xa0bb('0x4b')]['id']}})[_0xa0bb('0x29')](function(_0x41d5fe){return db[_0xa0bb('0x6d')]['transaction'](function(_0x1b92ab){return _0x41d5fe[_0xa0bb('0x67')](_0x158a2c,{'transaction':_0x1b92ab})[_0xa0bb('0x29')](function(){return BPromise[_0xa0bb('0x6e')](_0x2292de,function(_0x531b80){return db[_0xa0bb('0x5b')][_0xa0bb('0x6f')]({'where':{'UserId':_0x531b80['id'],'FaxQueueId':_0x200110['params']['id']},'transaction':_0x1b92ab});});})[_0xa0bb('0x29')](function(){_0x2292de[_0xa0bb('0x70')](function(_0x2ca462){socket[_0xa0bb('0x71')](_0xa0bb('0x72'),{'UserId':_0x2ca462['id'],'FaxQueueId':_0x41d5fe['id']});});});});});}})[_0xa0bb('0x29')](respondWithStatusCode(_0x1ed7e8,null))[_0xa0bb('0x49')](handleError(_0x1ed7e8,null));};exports[_0xa0bb('0x73')]=function(_0x2f55e2,_0x300197,_0xd8437d){return db['Team']['findAll']({'where':{'id':_0x2f55e2[_0xa0bb('0x34')][_0xa0bb('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa0bb('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x300197,null))[_0xa0bb('0x29')](function(_0x5e3e66){var _0x592f3c=_[_0xa0bb('0x30')](_0x5e3e66,'id');var _0x3e413a=[];var _0x20ffaf=[];var _0x5421d6=squel[_0xa0bb('0x74')]();_0x5421d6[_0xa0bb('0x75')]('tq.TeamId')[_0xa0bb('0x76')](_0xa0bb('0x77'),'tq')[_0xa0bb('0x78')](_0xa0bb('0x79'),'ut',_0xa0bb('0x7a'))['where'](_0xa0bb('0x7b'),_0x2f55e2[_0xa0bb('0x4b')]['id']);for(var _0x42e14d=0x0;_0x42e14d<_0x5e3e66[_0xa0bb('0x4c')];_0x42e14d+=0x1){let _0xbac1d6=_0x5e3e66[_0x42e14d];for(var _0x811141=0x0;_0x811141<_0xbac1d6[_0xa0bb('0x69')]['length'];_0x811141+=0x1){let _0x1aae06=_0xbac1d6['Agents'][_0x811141];var _0x51e4c7=_0x5421d6[_0xa0bb('0x7c')]();_0x51e4c7[_0xa0bb('0x3e')](_0xa0bb('0x7d'),_0x1aae06['id']);_0x20ffaf[_0xa0bb('0x7e')](db[_0xa0bb('0x6d')][_0xa0bb('0x34')](_0x51e4c7[_0xa0bb('0x7f')](),{'type':db[_0xa0bb('0x6d')]['QueryTypes']['SELECT']})[_0xa0bb('0x29')](function(_0x1e9d2d){if(_0x1e9d2d[_0xa0bb('0x4c')]===0x1){return _0x1aae06['id'];}else{var _0x2b90fd=_[_0xa0bb('0x80')](_[_0xa0bb('0x30')](_0x1e9d2d,_0xa0bb('0x81')),function(_0x210319){return _[_0xa0bb('0x82')](_0x592f3c,_0x210319);});if(_0x2b90fd){return _0x1aae06['id'];}}}));}}return BPromise['all'](_0x20ffaf)[_0xa0bb('0x29')](function(_0x297f66){_0x3e413a=_(_0x3e413a)[_0xa0bb('0x83')](_0x297f66)[_0xa0bb('0x84')]()[_0xa0bb('0x85')]();return db[_0xa0bb('0x46')][_0xa0bb('0x53')]({'where':{'id':_0x2f55e2[_0xa0bb('0x4b')]['id']}})[_0xa0bb('0x29')](function(_0xd9dbcf){return db[_0xa0bb('0x6d')][_0xa0bb('0x86')](function(_0x3068b1){return _0xd9dbcf[_0xa0bb('0x73')](_0x2f55e2[_0xa0bb('0x34')][_0xa0bb('0x68')],{'transaction':_0x3068b1})[_0xa0bb('0x29')](function(){if(!_[_0xa0bb('0x87')](_0x3e413a)){return _0xd9dbcf[_0xa0bb('0x88')](_0x3e413a,{'transaction':_0x3068b1});}})['then'](function(){_0x3e413a['forEach'](function(_0xdd7fb1){socket[_0xa0bb('0x71')](_0xa0bb('0x89'),{'UserId':_0xdd7fb1,'FaxQueueId':_0xd9dbcf['id']});});});});});});})[_0xa0bb('0x29')](respondWithStatusCode(_0x300197,null))[_0xa0bb('0x49')](handleError(_0x300197,null));};exports[_0xa0bb('0x8a')]=function(_0x1bdc44,_0x4be1ef,_0x10358e){return db['FaxQueue'][_0xa0bb('0x53')]({'where':{'id':_0x1bdc44['params']['id']}})[_0xa0bb('0x29')](handleEntityNotFound(_0x4be1ef,null))['then'](function(_0x182603){if(_0x182603){return _0x182603[_0xa0bb('0x8a')](_0x1bdc44[_0xa0bb('0x4e')][_0xa0bb('0x68')],_[_0xa0bb('0x8b')](_0x1bdc44[_0xa0bb('0x4e')],['ids','id'])||{})['spread'](function(_0x31f7d3){for(var _0x12389c=0x0;_0x12389c<_0x1bdc44['body'][_0xa0bb('0x68')][_0xa0bb('0x4c')];_0x12389c+=0x1){socket['emit'](_0xa0bb('0x72'),{'UserId':_0x1bdc44['body'][_0xa0bb('0x68')][_0x12389c],'FaxQueueId':_0x1bdc44[_0xa0bb('0x4b')]['id']});}return _0x31f7d3;});}})[_0xa0bb('0x29')](respondWithResult(_0x4be1ef,null))[_0xa0bb('0x49')](handleError(_0x4be1ef,null));};exports[_0xa0bb('0x88')]=function(_0x5213f2,_0xf22084,_0x4b7c67){return db['FaxQueue'][_0xa0bb('0x53')]({'where':{'id':_0x5213f2[_0xa0bb('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf22084,null))[_0xa0bb('0x29')](function(_0x155a13){if(_0x155a13){return _0x155a13[_0xa0bb('0x88')](_0x5213f2[_0xa0bb('0x34')][_0xa0bb('0x68')])[_0xa0bb('0x29')](function(){if(_[_0xa0bb('0x8c')](_0x5213f2[_0xa0bb('0x34')][_0xa0bb('0x68')])){for(var _0x551ef1=0x0;_0x551ef1<_0x5213f2[_0xa0bb('0x34')]['ids'][_0xa0bb('0x4c')];_0x551ef1+=0x1){socket[_0xa0bb('0x71')](_0xa0bb('0x89'),{'UserId':Number(_0x5213f2[_0xa0bb('0x34')][_0xa0bb('0x68')][_0x551ef1]),'FaxQueueId':Number(_0x5213f2[_0xa0bb('0x4b')]['id'])});}}else{socket[_0xa0bb('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x5213f2[_0xa0bb('0x34')][_0xa0bb('0x68')]),'FaxQueueId':Number(_0x5213f2[_0xa0bb('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0xf22084,null))['catch'](handleError(_0xf22084,null));};exports[_0xa0bb('0x8d')]=function(_0x538f24,_0x436f8f,_0x169a14){var _0x3fbf84={};var _0x30a0a7={};var _0x41821e;var _0x345b97;return db[_0xa0bb('0x46')][_0xa0bb('0x64')]({'where':{'id':_0x538f24['params']['id']}})[_0xa0bb('0x29')](handleEntityNotFound(_0x436f8f,null))[_0xa0bb('0x29')](function(_0xe378dc){if(_0xe378dc){_0x41821e=_0xe378dc;_0x30a0a7[_0xa0bb('0x38')]=_['keys'](db[_0xa0bb('0x5d')][_0xa0bb('0x31')]);_0x30a0a7[_0xa0bb('0x34')]=_['keys'](_0x538f24[_0xa0bb('0x34')]);_0x30a0a7[_0xa0bb('0x36')]=_['intersection'](_0x30a0a7[_0xa0bb('0x38')],_0x30a0a7[_0xa0bb('0x34')]);_0x3fbf84[_0xa0bb('0x39')]=_[_0xa0bb('0x37')](_0x30a0a7[_0xa0bb('0x38')],qs[_0xa0bb('0x3a')](_0x538f24[_0xa0bb('0x34')][_0xa0bb('0x3a')]));_0x3fbf84[_0xa0bb('0x39')]=_0x3fbf84[_0xa0bb('0x39')][_0xa0bb('0x4c')]?_0x3fbf84[_0xa0bb('0x39')]:_0x30a0a7['model'];_0x3fbf84[_0xa0bb('0x3d')]=qs['sort'](_0x538f24[_0xa0bb('0x34')][_0xa0bb('0x5c')]);_0x3fbf84[_0xa0bb('0x3e')]=qs[_0xa0bb('0x36')](_[_0xa0bb('0x3f')](_0x538f24[_0xa0bb('0x34')],_0x30a0a7[_0xa0bb('0x36')]));if(_0x538f24[_0xa0bb('0x34')][_0xa0bb('0x40')]){_0x3fbf84[_0xa0bb('0x3e')]=_[_0xa0bb('0x41')](_0x3fbf84[_0xa0bb('0x3e')],{'$or':_[_0xa0bb('0x30')](_0x3fbf84[_0xa0bb('0x39')],function(_0xae8652){var _0x4bdf0b={};_0x4bdf0b[_0xae8652]={'$like':'%'+_0x538f24[_0xa0bb('0x34')]['filter']+'%'};return _0x4bdf0b;})});}_0x3fbf84=_[_0xa0bb('0x41')]({},_0x3fbf84,_0x538f24[_0xa0bb('0x44')]);return _0x41821e[_0xa0bb('0x8d')](_0x3fbf84);}})['then'](function(_0x1287de){if(_0x1287de){_0x345b97=_0x1287de['length'];if(!_0x538f24[_0xa0bb('0x34')][_0xa0bb('0x3b')](_0xa0bb('0x3c'))){_0x3fbf84[_0xa0bb('0x24')]=qs['limit'](_0x538f24[_0xa0bb('0x34')]['limit']);_0x3fbf84[_0xa0bb('0x23')]=qs['offset'](_0x538f24[_0xa0bb('0x34')]['offset']);}return _0x41821e[_0xa0bb('0x8d')](_0x3fbf84);}})['then'](function(_0x4091a7){if(_0x4091a7){return _0x4091a7?{'count':_0x345b97,'rows':_0x4091a7}:null;}})[_0xa0bb('0x29')](respondWithResult(_0x436f8f,null))['catch'](handleError(_0x436f8f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index edc9a71..38e1683 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 _0x9c76=['update','remove','emit','hasOwnProperty','hook','FaxQueue','setMaxListeners','save'];(function(_0x32780e,_0x35ddf3){var _0x11f78d=function(_0x503e06){while(--_0x503e06){_0x32780e['push'](_0x32780e['shift']());}};_0x11f78d(++_0x35ddf3);}(_0x9c76,0x135));var _0x69c7=function(_0x574e68,_0x34e011){_0x574e68=_0x574e68-0x0;var _0x4dd26d=_0x9c76[_0x574e68];return _0x4dd26d;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x69c7('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x69c7('0x1')](0x0);var events={'afterCreate':_0x69c7('0x2'),'afterUpdate':_0x69c7('0x3'),'afterDestroy':_0x69c7('0x4')};function emitEvent(_0x2b6186){return function(_0x21bf01,_0x839719,_0x147c71){FaxQueueEvents[_0x69c7('0x5')](_0x2b6186+':'+_0x21bf01['id'],_0x21bf01);FaxQueueEvents[_0x69c7('0x5')](_0x2b6186,_0x21bf01);_0x147c71(null);};}for(var e in events){if(events[_0x69c7('0x6')](e)){var event=events[e];FaxQueue[_0x69c7('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x7026=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x843bf,_0x4438a1){var _0x5942e2=function(_0x2cb1bd){while(--_0x2cb1bd){_0x843bf['push'](_0x843bf['shift']());}};_0x5942e2(++_0x4438a1);}(_0x7026,0x113));var _0x6702=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7026[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x6702('0x0'));var FaxQueue=require(_0x6702('0x1'))['db'][_0x6702('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6702('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6702('0x4'),'afterDestroy':_0x6702('0x5')};function emitEvent(_0x11df1e){return function(_0x56d1a4,_0x18b90a,_0x352bb7){FaxQueueEvents[_0x6702('0x6')](_0x11df1e+':'+_0x56d1a4['id'],_0x56d1a4);FaxQueueEvents[_0x6702('0x6')](_0x11df1e,_0x56d1a4);_0x352bb7(null);};}for(var e in events){if(events[_0x6702('0x7')](e)){var event=events[e];FaxQueue[_0x6702('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a0a5bd1..82b0c78 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 _0x9e7c=['./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x26e8d2,_0x11b4c8){var _0x2d66da=function(_0x37c2d1){while(--_0x37c2d1){_0x26e8d2['push'](_0x26e8d2['shift']());}};_0x2d66da(++_0x11b4c8);}(_0x9e7c,0x1e4));var _0xc9e7=function(_0x483721,_0x59f6b4){_0x483721=_0x483721-0x0;var _0x218bef=_0x9e7c[_0x483721];return _0x218bef;};'use strict';var _=require(_0xc9e7('0x0'));var util=require(_0xc9e7('0x1'));var logger=require(_0xc9e7('0x2'))(_0xc9e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9e7('0x4'));var rimraf=require(_0xc9e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xc9e7('0x6'));module[_0xc9e7('0x7')]=function(_0x5ca0c8,_0x29b6f5){return _0x5ca0c8[_0xc9e7('0x8')]('FaxQueue',attributes,{'tableName':_0xc9e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6707=['../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x333599,_0x53da70){var _0x464042=function(_0x46b473){while(--_0x46b473){_0x333599['push'](_0x333599['shift']());}};_0x464042(++_0x53da70);}(_0x6707,0x1cd));var _0x7670=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6707[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x7670('0x0'));var util=require(_0x7670('0x1'));var logger=require(_0x7670('0x2'))(_0x7670('0x3'));var moment=require('moment');var BPromise=require(_0x7670('0x4'));var rp=require(_0x7670('0x5'));var fs=require('fs');var path=require(_0x7670('0x6'));var rimraf=require('rimraf');var config=require(_0x7670('0x7'));var attributes=require(_0x7670('0x8'));module[_0x7670('0x9')]=function(_0x466822,_0x2db9c7){return _0x466822[_0x7670('0xa')](_0x7670('0xb'),attributes,{'tableName':_0x7670('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 93106b1..5739ab9 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 _0x2624=['include','map','model','ShowFaxQueue','find','raw','lodash','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit'];(function(_0x28419f,_0x4c48a7){var _0xafa7f=function(_0x3e0deb){while(--_0x3e0deb){_0x28419f['push'](_0x28419f['shift']());}};_0xafa7f(++_0x4c48a7);}(_0x2624,0x1aa));var _0x4262=function(_0x13628e,_0x12ec80){_0x13628e=_0x13628e-0x0;var _0x5469b4=_0x2624[_0x13628e];return _0x5469b4;};'use strict';var _=require(_0x4262('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4262('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4262('0x2'));var logger=require(_0x4262('0x3'))(_0x4262('0x4'));var config=require('../../config/environment');var jayson=require(_0x4262('0x5'));var client=jayson['client'][_0x4262('0x6')]({'port':0x232a});config[_0x4262('0x7')]=_[_0x4262('0x8')](config[_0x4262('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4262('0x9'))(new Redis(config[_0x4262('0x7')]));require(_0x4262('0xa'))[_0x4262('0xb')](socket);function respondWithRpcPromise(_0x233190,_0x29de98,_0xd660a6){return new BPromise(function(_0x2abec9,_0x50a5ba){return client['request'](_0x233190,_0xd660a6)[_0x4262('0xc')](function(_0x237d13){logger[_0x4262('0xd')](_0x4262('0xe'),_0x29de98,_0x4262('0xf'));logger[_0x4262('0x10')](_0x4262('0x11'),_0x29de98,_0x4262('0xf'),JSON[_0x4262('0x12')](_0x237d13));if(_0x237d13['error']){if(_0x237d13[_0x4262('0x13')]['code']===0x1f4){logger[_0x4262('0x13')](_0x4262('0xe'),_0x29de98,_0x237d13[_0x4262('0x13')][_0x4262('0x14')]);return _0x50a5ba(_0x237d13[_0x4262('0x13')]['message']);}logger[_0x4262('0x13')](_0x4262('0xe'),_0x29de98,_0x237d13[_0x4262('0x13')]['message']);return _0x2abec9(_0x237d13['error'][_0x4262('0x14')]);}else{logger[_0x4262('0xd')](_0x4262('0xe'),_0x29de98,_0x4262('0xf'));_0x2abec9(_0x237d13['result'][_0x4262('0x14')]);}})[_0x4262('0x15')](function(_0x5cbcbf){logger[_0x4262('0x13')](_0x4262('0xe'),_0x29de98,_0x5cbcbf);_0x50a5ba(_0x5cbcbf);});});}exports[_0x4262('0x16')]=function(_0x4ed75f){var _0x3759a1=this;return new Promise(function(_0xf4c9ce,_0x5ec582){return db[_0x4262('0x17')][_0x4262('0x18')]({'raw':_0x4ed75f[_0x4262('0x19')]?_0x4ed75f[_0x4262('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4ed75f[_0x4262('0x19')]?_0x4ed75f[_0x4262('0x19')][_0x4262('0x1a')]||null:null,'attributes':_0x4ed75f['options']?_0x4ed75f[_0x4262('0x19')][_0x4262('0x1b')]||null:null,'limit':_0x4ed75f['options']?_0x4ed75f[_0x4262('0x19')][_0x4262('0x1c')]||null:null,'include':_0x4ed75f[_0x4262('0x19')]?_0x4ed75f['options'][_0x4262('0x1d')]?_['map'](_0x4ed75f['options'][_0x4262('0x1d')],function(_0x153ba5){return{'model':db[_0x153ba5['model']],'as':_0x153ba5['as'],'attributes':_0x153ba5['attributes'],'include':_0x153ba5[_0x4262('0x1d')]?_[_0x4262('0x1e')](_0x153ba5[_0x4262('0x1d')],function(_0x1d65b6){return{'model':db[_0x1d65b6[_0x4262('0x1f')]],'as':_0x1d65b6['as'],'attributes':_0x1d65b6[_0x4262('0x1b')],'include':_0x1d65b6[_0x4262('0x1d')]?_['map'](_0x1d65b6[_0x4262('0x1d')],function(_0x2d9a1e){return{'model':db[_0x2d9a1e[_0x4262('0x1f')]],'as':_0x2d9a1e['as'],'attributes':_0x2d9a1e[_0x4262('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52679f){logger[_0x4262('0xd')](_0x4262('0x16'),_0x4ed75f);logger['debug'](_0x4262('0x16'),_0x4ed75f,JSON[_0x4262('0x12')](_0x52679f));_0xf4c9ce(_0x52679f);})[_0x4262('0x15')](function(_0x6eeb45){logger[_0x4262('0x13')](_0x4262('0x16'),_0x6eeb45[_0x4262('0x14')],_0x4ed75f);_0x5ec582(_0x3759a1[_0x4262('0x13')](0x1f4,_0x6eeb45[_0x4262('0x14')]));});});};exports[_0x4262('0x20')]=function(_0x45a8de){var _0x268df9=this;return new Promise(function(_0x319b75,_0x7823ab){return db[_0x4262('0x17')][_0x4262('0x21')]({'raw':_0x45a8de[_0x4262('0x19')]?_0x45a8de[_0x4262('0x19')][_0x4262('0x22')]===undefined?!![]:![]:!![],'where':_0x45a8de['options']?_0x45a8de[_0x4262('0x19')][_0x4262('0x1a')]||null:null,'attributes':_0x45a8de[_0x4262('0x19')]?_0x45a8de[_0x4262('0x19')][_0x4262('0x1b')]||null:null,'include':_0x45a8de[_0x4262('0x19')]?_0x45a8de[_0x4262('0x19')]['include']?_['map'](_0x45a8de[_0x4262('0x19')]['include'],function(_0x327d1b){return{'model':db[_0x327d1b[_0x4262('0x1f')]],'as':_0x327d1b['as'],'attributes':_0x327d1b[_0x4262('0x1b')],'include':_0x327d1b[_0x4262('0x1d')]?_[_0x4262('0x1e')](_0x327d1b[_0x4262('0x1d')],function(_0x38000e){return{'model':db[_0x38000e['model']],'as':_0x38000e['as'],'attributes':_0x38000e[_0x4262('0x1b')],'include':_0x38000e[_0x4262('0x1d')]?_[_0x4262('0x1e')](_0x38000e[_0x4262('0x1d')],function(_0x4bd812){return{'model':db[_0x4bd812[_0x4262('0x1f')]],'as':_0x4bd812['as'],'attributes':_0x4bd812['attributes']};}):[]};}):[]};}):[]:[]})[_0x4262('0xc')](function(_0x246bfc){logger[_0x4262('0xd')](_0x4262('0x20'),_0x45a8de);logger['debug'](_0x4262('0x20'),_0x45a8de,JSON['stringify'](_0x246bfc));_0x319b75(_0x246bfc);})['catch'](function(_0x459438){logger['error'](_0x4262('0x20'),_0x459438['message'],_0x45a8de);_0x7823ab(_0x268df9[_0x4262('0x13')](0x1f4,_0x459438[_0x4262('0x14')]));});});}; \ No newline at end of file +var _0x03d2=['FaxQueue','options','where','attributes','limit','include','model','map','catch','ShowFaxQueue','find','raw','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','GetFaxQueue'];(function(_0x3e2a31,_0x4cae4d){var _0x393503=function(_0x3be7c6){while(--_0x3be7c6){_0x3e2a31['push'](_0x3e2a31['shift']());}};_0x393503(++_0x4cae4d);}(_0x03d2,0xad));var _0x203d=function(_0x2ea604,_0x6653b9){_0x2ea604=_0x2ea604-0x0;var _0x426a65=_0x03d2[_0x2ea604];return _0x426a65;};'use strict';var _=require('lodash');var util=require(_0x203d('0x0'));var moment=require(_0x203d('0x1'));var BPromise=require(_0x203d('0x2'));var rs=require(_0x203d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x203d('0x4'))['db'];var utils=require(_0x203d('0x5'));var logger=require(_0x203d('0x6'))(_0x203d('0x7'));var config=require(_0x203d('0x8'));var jayson=require(_0x203d('0x9'));var client=jayson[_0x203d('0xa')][_0x203d('0xb')]({'port':0x232a});config[_0x203d('0xc')]=_[_0x203d('0xd')](config[_0x203d('0xc')],{'host':_0x203d('0xe'),'port':0x18eb});var socket=require(_0x203d('0xf'))(new Redis(config[_0x203d('0xc')]));require('./faxQueue.socket')[_0x203d('0x10')](socket);function respondWithRpcPromise(_0x245562,_0x13dc50,_0x41bb28){return new BPromise(function(_0x1605ec,_0x20995a){return client[_0x203d('0x11')](_0x245562,_0x41bb28)[_0x203d('0x12')](function(_0x13d93f){logger['info'](_0x203d('0x13'),_0x13dc50,_0x203d('0x14'));logger[_0x203d('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x13dc50,_0x203d('0x14'),JSON['stringify'](_0x13d93f));if(_0x13d93f[_0x203d('0x16')]){if(_0x13d93f[_0x203d('0x16')]['code']===0x1f4){logger[_0x203d('0x16')](_0x203d('0x13'),_0x13dc50,_0x13d93f[_0x203d('0x16')][_0x203d('0x17')]);return _0x20995a(_0x13d93f[_0x203d('0x16')][_0x203d('0x17')]);}logger[_0x203d('0x16')](_0x203d('0x13'),_0x13dc50,_0x13d93f[_0x203d('0x16')][_0x203d('0x17')]);return _0x1605ec(_0x13d93f[_0x203d('0x16')]['message']);}else{logger[_0x203d('0x18')](_0x203d('0x13'),_0x13dc50,_0x203d('0x14'));_0x1605ec(_0x13d93f[_0x203d('0x19')][_0x203d('0x17')]);}})['catch'](function(_0x449b97){logger['error'](_0x203d('0x13'),_0x13dc50,_0x449b97);_0x20995a(_0x449b97);});});}exports[_0x203d('0x1a')]=function(_0x27adb0){var _0x924db=this;return new Promise(function(_0x7a3895,_0x32e4af){return db[_0x203d('0x1b')]['findAll']({'raw':_0x27adb0['options']?_0x27adb0[_0x203d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27adb0[_0x203d('0x1c')]?_0x27adb0[_0x203d('0x1c')][_0x203d('0x1d')]||null:null,'attributes':_0x27adb0['options']?_0x27adb0['options'][_0x203d('0x1e')]||null:null,'limit':_0x27adb0[_0x203d('0x1c')]?_0x27adb0[_0x203d('0x1c')][_0x203d('0x1f')]||null:null,'include':_0x27adb0[_0x203d('0x1c')]?_0x27adb0[_0x203d('0x1c')]['include']?_['map'](_0x27adb0[_0x203d('0x1c')][_0x203d('0x20')],function(_0x3c2f4e){return{'model':db[_0x3c2f4e[_0x203d('0x21')]],'as':_0x3c2f4e['as'],'attributes':_0x3c2f4e['attributes'],'include':_0x3c2f4e[_0x203d('0x20')]?_[_0x203d('0x22')](_0x3c2f4e['include'],function(_0x36132e){return{'model':db[_0x36132e[_0x203d('0x21')]],'as':_0x36132e['as'],'attributes':_0x36132e[_0x203d('0x1e')],'include':_0x36132e[_0x203d('0x20')]?_[_0x203d('0x22')](_0x36132e['include'],function(_0x1b651e){return{'model':db[_0x1b651e[_0x203d('0x21')]],'as':_0x1b651e['as'],'attributes':_0x1b651e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c2e8f){logger[_0x203d('0x18')]('GetFaxQueue',_0x27adb0);logger[_0x203d('0x15')](_0x203d('0x1a'),_0x27adb0,JSON['stringify'](_0x2c2e8f));_0x7a3895(_0x2c2e8f);})[_0x203d('0x23')](function(_0x1dea70){logger[_0x203d('0x16')](_0x203d('0x1a'),_0x1dea70['message'],_0x27adb0);_0x32e4af(_0x924db['error'](0x1f4,_0x1dea70['message']));});});};exports[_0x203d('0x24')]=function(_0x4df743){var _0x1e7f0f=this;return new Promise(function(_0x44e161,_0x2c7581){return db[_0x203d('0x1b')][_0x203d('0x25')]({'raw':_0x4df743['options']?_0x4df743[_0x203d('0x1c')][_0x203d('0x26')]===undefined?!![]:![]:!![],'where':_0x4df743['options']?_0x4df743[_0x203d('0x1c')][_0x203d('0x1d')]||null:null,'attributes':_0x4df743['options']?_0x4df743[_0x203d('0x1c')][_0x203d('0x1e')]||null:null,'include':_0x4df743[_0x203d('0x1c')]?_0x4df743[_0x203d('0x1c')][_0x203d('0x20')]?_[_0x203d('0x22')](_0x4df743[_0x203d('0x1c')]['include'],function(_0x49d419){return{'model':db[_0x49d419[_0x203d('0x21')]],'as':_0x49d419['as'],'attributes':_0x49d419[_0x203d('0x1e')],'include':_0x49d419[_0x203d('0x20')]?_[_0x203d('0x22')](_0x49d419[_0x203d('0x20')],function(_0x1885fa){return{'model':db[_0x1885fa[_0x203d('0x21')]],'as':_0x1885fa['as'],'attributes':_0x1885fa[_0x203d('0x1e')],'include':_0x1885fa[_0x203d('0x20')]?_[_0x203d('0x22')](_0x1885fa[_0x203d('0x20')],function(_0x5c8a99){return{'model':db[_0x5c8a99[_0x203d('0x21')]],'as':_0x5c8a99['as'],'attributes':_0x5c8a99['attributes']};}):[]};}):[]};}):[]:[]})[_0x203d('0x12')](function(_0x3549a6){logger[_0x203d('0x18')](_0x203d('0x24'),_0x4df743);logger[_0x203d('0x15')]('ShowFaxQueue',_0x4df743,JSON[_0x203d('0x27')](_0x3549a6));_0x44e161(_0x3549a6);})['catch'](function(_0x1a0530){logger[_0x203d('0x16')](_0x203d('0x24'),_0x1a0530[_0x203d('0x17')],_0x4df743);_0x2c7581(_0x1e7f0f[_0x203d('0x16')](0x1f4,_0x1a0530[_0x203d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index df1da9a..f62e82c 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 _0x44fb=['remove','update','emit','removeListener','register','length','./faxQueue.events'];(function(_0x477232,_0x5511b6){var _0x3238a5=function(_0x5f40a9){while(--_0x5f40a9){_0x477232['push'](_0x477232['shift']());}};_0x3238a5(++_0x5511b6);}(_0x44fb,0xe6));var _0xb44f=function(_0x297bff,_0x482958){_0x297bff=_0x297bff-0x0;var _0xfb6d42=_0x44fb[_0x297bff];return _0xfb6d42;};'use strict';var FaxQueueEvents=require(_0xb44f('0x0'));var events=['save',_0xb44f('0x1'),_0xb44f('0x2')];function createListener(_0x5133b6,_0x20f4f1){return function(_0x32673c){_0x20f4f1[_0xb44f('0x3')](_0x5133b6,_0x32673c);};}function removeListener(_0x4966a0,_0x45a082){return function(){FaxQueueEvents[_0xb44f('0x4')](_0x4966a0,_0x45a082);};}exports[_0xb44f('0x5')]=function(_0x2cce3e){for(var _0x40b65f=0x0,_0x4b7b91=events[_0xb44f('0x6')];_0x40b65f<_0x4b7b91;_0x40b65f++){var _0x1b0c9a=events[_0x40b65f];var _0x2f610c=createListener('faxQueue:'+_0x1b0c9a,_0x2cce3e);FaxQueueEvents['on'](_0x1b0c9a,_0x2f610c);}}; \ No newline at end of file +var _0x2a3f=['length','faxQueue:','save','update','emit','removeListener'];(function(_0x8ae747,_0x135483){var _0x16d68b=function(_0x219354){while(--_0x219354){_0x8ae747['push'](_0x8ae747['shift']());}};_0x16d68b(++_0x135483);}(_0x2a3f,0x170));var _0xf2a3=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x2a3f[_0x489b87];return _0x1823b6;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf2a3('0x0'),'remove',_0xf2a3('0x1')];function createListener(_0xb7f2a6,_0x55a710){return function(_0x58c7d5){_0x55a710[_0xf2a3('0x2')](_0xb7f2a6,_0x58c7d5);};}function removeListener(_0x562b08,_0x4cb00e){return function(){FaxQueueEvents[_0xf2a3('0x3')](_0x562b08,_0x4cb00e);};}exports['register']=function(_0xaed6f8){for(var _0x3f31e1=0x0,_0x4d340e=events[_0xf2a3('0x4')];_0x3f31e1<_0x4d340e;_0x3f31e1++){var _0x1dea70=events[_0x3f31e1];var _0x4a587c=createListener(_0xf2a3('0x5')+_0x1dea70,_0xaed6f8);FaxQueueEvents['on'](_0x1dea70,_0x4a587c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8108693..a819a33 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 _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x0b0e[_0x71e493];return _0x3d40ab;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);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(_0x47a756,_0xc38065){var _0x4db04c=function(_0x5c1a72){while(--_0x5c1a72){_0x47a756['push'](_0x47a756['shift']());}};_0x4db04c(++_0xc38065);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 9c23a2d..806ef54 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 _0x1e43=['sequelize','exports','STRING','DATE','moment'];(function(_0x5b82d2,_0x47eb89){var _0x1cff7e=function(_0xb08b0f){while(--_0xb08b0f){_0x5b82d2['push'](_0x5b82d2['shift']());}};_0x1cff7e(++_0x47eb89);}(_0x1e43,0x9f));var _0x31e4=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x1e43[_0x27beea];return _0x122645;};'use strict';var moment=require(_0x31e4('0x0'));var Sequelize=require(_0x31e4('0x1'));module[_0x31e4('0x2')]={'uniqueid':{'type':Sequelize[_0x31e4('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x31e4('0x4')]},'leaveAt':{'type':Sequelize[_0x31e4('0x4')]},'acceptAt':{'type':Sequelize[_0x31e4('0x4')]},'exitAt':{'type':Sequelize[_0x31e4('0x4')]},'reason':{'type':Sequelize[_0x31e4('0x3')]}}; \ No newline at end of file +var _0x8294=['moment','sequelize','exports','STRING','DATE'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x8294,0x16d));var _0x4829=function(_0x1878ee,_0x49b3e6){_0x1878ee=_0x1878ee-0x0;var _0x3557a8=_0x8294[_0x1878ee];return _0x3557a8;};'use strict';var moment=require(_0x4829('0x0'));var Sequelize=require(_0x4829('0x1'));module[_0x4829('0x2')]={'uniqueid':{'type':Sequelize[_0x4829('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4829('0x4')]},'leaveAt':{'type':Sequelize[_0x4829('0x4')]},'acceptAt':{'type':Sequelize[_0x4829('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4829('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b3da3c6..112cf81 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 _0x5df0=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','keys','length','includeAll','options','find','create','body','html-pdf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x409fd3,_0x42c7bc){var _0xaf1d80=function(_0x40d7b6){while(--_0x40d7b6){_0x409fd3['push'](_0x409fd3['shift']());}};_0xaf1d80(++_0x42c7bc);}(_0x5df0,0x108));var _0x05df=function(_0x49f652,_0x48aa8){_0x49f652=_0x49f652-0x0;var _0x198310=_0x5df0[_0x49f652];return _0x198310;};'use strict';var pdf=require(_0x05df('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05df('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x05df('0x2'));var Mustache=require(_0x05df('0x3'));var util=require(_0x05df('0x4'));var path=require(_0x05df('0x5'));var sox=require('sox');var csv=require(_0x05df('0x6'));var ejs=require(_0x05df('0x7'));var fs=require('fs');var _=require(_0x05df('0x8'));var squel=require(_0x05df('0x9'));var crypto=require(_0x05df('0xa'));var jsforce=require(_0x05df('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x05df('0x6'));var querystring=require(_0x05df('0xc'));var Papa=require(_0x05df('0xd'));var Redis=require(_0x05df('0xe'));var authService=require(_0x05df('0xf'));var qs=require(_0x05df('0x10'));var as=require(_0x05df('0x11'));var hardwareService=require(_0x05df('0x12'));var logger=require('../../config/logger')(_0x05df('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05df('0x14'));var db=require(_0x05df('0x15'))['db'];function respondWithStatusCode(_0x26a69c,_0x558262){_0x558262=_0x558262||0xcc;return function(_0x3a6825){if(_0x3a6825){return _0x26a69c[_0x05df('0x16')](_0x558262);}return _0x26a69c['status'](_0x558262)[_0x05df('0x17')]();};}function respondWithResult(_0x4781d0,_0x24ef2f){_0x24ef2f=_0x24ef2f||0xc8;return function(_0x136cb3){if(_0x136cb3){return _0x4781d0[_0x05df('0x18')](_0x24ef2f)[_0x05df('0x19')](_0x136cb3);}};}function respondWithFilteredResult(_0x2caded,_0x93614c){return function(_0x564ab6){if(_0x564ab6){var _0x1952c0=_0x564ab6[_0x05df('0x1a')],_0x6eb563=_0x93614c['offset'],_0xb0e70a=_0x93614c[_0x05df('0x1b')]+_0x93614c['limit'],_0x373c5f;if(_0xb0e70a>=_0x1952c0){_0xb0e70a=_0x1952c0;_0x373c5f=0xc8;}else{_0x373c5f=0xce;}_0x2caded[_0x05df('0x18')](_0x373c5f);return _0x2caded[_0x05df('0x1c')](_0x05df('0x1d'),_0x6eb563+'-'+_0xb0e70a+'/'+_0x1952c0)[_0x05df('0x19')](_0x564ab6);}return null;};}function patchUpdates(_0xcc8187){return function(_0x45b08c){try{jsonpatch[_0x05df('0x1e')](_0x45b08c,_0xcc8187,!![]);}catch(_0xa011a6){return BPromise[_0x05df('0x1f')](_0xa011a6);}return _0x45b08c[_0x05df('0x20')]();};}function saveUpdates(_0x2ea753,_0x27efdd){return function(_0x928761){if(_0x928761){return _0x928761[_0x05df('0x21')](_0x2ea753)[_0x05df('0x22')](function(_0x50b3cf){return _0x50b3cf;});}return null;};}function removeEntity(_0x3b59f9,_0x17db99){return function(_0x57c7da){if(_0x57c7da){return _0x57c7da[_0x05df('0x23')]()[_0x05df('0x22')](function(){_0x3b59f9[_0x05df('0x18')](0xcc)[_0x05df('0x17')]();});}};}function handleEntityNotFound(_0x2d1fc4,_0x14dd5d){return function(_0x31314e){if(!_0x31314e){_0x2d1fc4[_0x05df('0x16')](0x194);}return _0x31314e;};}function handleError(_0x103333,_0x3b3824){_0x3b3824=_0x3b3824||0x1f4;return function(_0x2f17e5){logger[_0x05df('0x24')](_0x2f17e5[_0x05df('0x25')]);if(_0x2f17e5[_0x05df('0x26')]){delete _0x2f17e5['name'];}_0x103333[_0x05df('0x18')](_0x3b3824)['send'](_0x2f17e5);};}exports[_0x05df('0x27')]=function(_0x39ac9f,_0x50edf5){var _0x1b45eb={},_0x82a3ce={},_0x4132be={'count':0x0,'rows':[]};var _0x51a0d1=_[_0x05df('0x28')](db[_0x05df('0x29')][_0x05df('0x2a')],function(_0x26df39){return{'name':_0x26df39[_0x05df('0x2b')],'type':_0x26df39['type'][_0x05df('0x2c')]};});_0x82a3ce[_0x05df('0x2d')]=_[_0x05df('0x28')](_0x51a0d1,_0x05df('0x26'));_0x82a3ce['query']=_['keys'](_0x39ac9f[_0x05df('0x2e')]);_0x82a3ce[_0x05df('0x2f')]=_[_0x05df('0x30')](_0x82a3ce[_0x05df('0x2d')],_0x82a3ce['query']);_0x1b45eb[_0x05df('0x31')]=_[_0x05df('0x30')](_0x82a3ce[_0x05df('0x2d')],qs['fields'](_0x39ac9f['query'][_0x05df('0x32')]));_0x1b45eb[_0x05df('0x31')]=_0x1b45eb[_0x05df('0x31')]['length']?_0x1b45eb[_0x05df('0x31')]:_0x82a3ce['model'];if(!_0x39ac9f[_0x05df('0x2e')]['hasOwnProperty'](_0x05df('0x33'))){_0x1b45eb[_0x05df('0x34')]=qs[_0x05df('0x34')](_0x39ac9f[_0x05df('0x2e')][_0x05df('0x34')]);_0x1b45eb['offset']=qs[_0x05df('0x1b')](_0x39ac9f[_0x05df('0x2e')][_0x05df('0x1b')]);}_0x1b45eb['order']=qs['sort'](_0x39ac9f[_0x05df('0x2e')][_0x05df('0x35')]);_0x1b45eb[_0x05df('0x36')]=qs[_0x05df('0x2f')](_['pick'](_0x39ac9f['query'],_0x82a3ce[_0x05df('0x2f')]),_0x51a0d1);if(_0x39ac9f[_0x05df('0x2e')][_0x05df('0x37')]){_0x1b45eb[_0x05df('0x36')]=_[_0x05df('0x38')](_0x1b45eb['where'],{'$or':_[_0x05df('0x28')](_0x51a0d1,function(_0x705c16){if(_0x705c16[_0x05df('0x39')]!==_0x05df('0x3a')){var _0x321dfb={};_0x321dfb[_0x705c16[_0x05df('0x26')]]={'$like':'%'+_0x39ac9f[_0x05df('0x2e')][_0x05df('0x37')]+'%'};return _0x321dfb;}})});}_0x1b45eb=_['merge']({},_0x1b45eb,_0x39ac9f['options']);var _0x4a60d0={'where':_0x1b45eb[_0x05df('0x36')]};return db[_0x05df('0x29')][_0x05df('0x1a')](_0x4a60d0)['then'](function(_0x5bb56e){_0x4132be[_0x05df('0x1a')]=_0x5bb56e;if(_0x39ac9f[_0x05df('0x2e')]['includeAll']){_0x1b45eb[_0x05df('0x3b')]=[{'all':!![]}];}return db[_0x05df('0x29')][_0x05df('0x3c')](_0x1b45eb);})[_0x05df('0x22')](function(_0x2ea23e){_0x4132be[_0x05df('0x3d')]=_0x2ea23e;return _0x4132be;})[_0x05df('0x22')](respondWithFilteredResult(_0x50edf5,_0x1b45eb))[_0x05df('0x3e')](handleError(_0x50edf5,null));};exports['show']=function(_0x5cb0bf,_0x4f6a97){var _0x22d9c1={'raw':!![],'where':{'id':_0x5cb0bf[_0x05df('0x3f')]['id']}},_0x88498b={};_0x88498b['model']=_[_0x05df('0x40')](db[_0x05df('0x29')][_0x05df('0x2a')]);_0x88498b[_0x05df('0x2e')]=_[_0x05df('0x40')](_0x5cb0bf[_0x05df('0x2e')]);_0x88498b[_0x05df('0x2f')]=_[_0x05df('0x30')](_0x88498b[_0x05df('0x2d')],_0x88498b['query']);_0x22d9c1[_0x05df('0x31')]=_['intersection'](_0x88498b[_0x05df('0x2d')],qs[_0x05df('0x32')](_0x5cb0bf[_0x05df('0x2e')][_0x05df('0x32')]));_0x22d9c1['attributes']=_0x22d9c1[_0x05df('0x31')][_0x05df('0x41')]?_0x22d9c1[_0x05df('0x31')]:_0x88498b['model'];if(_0x5cb0bf[_0x05df('0x2e')][_0x05df('0x42')]){_0x22d9c1['include']=[{'all':!![]}];}_0x22d9c1=_[_0x05df('0x38')]({},_0x22d9c1,_0x5cb0bf[_0x05df('0x43')]);return db[_0x05df('0x29')][_0x05df('0x44')](_0x22d9c1)['then'](handleEntityNotFound(_0x4f6a97,null))[_0x05df('0x22')](respondWithResult(_0x4f6a97,null))[_0x05df('0x3e')](handleError(_0x4f6a97,null));};exports[_0x05df('0x45')]=function(_0x564071,_0x390c5e){return db[_0x05df('0x29')][_0x05df('0x45')](_0x564071[_0x05df('0x46')],{})['then'](respondWithResult(_0x390c5e,0xc9))[_0x05df('0x3e')](handleError(_0x390c5e,null));};exports['update']=function(_0xd47794,_0x486714){if(_0xd47794[_0x05df('0x46')]['id']){delete _0xd47794['body']['id'];}return db[_0x05df('0x29')]['find']({'where':{'id':_0xd47794[_0x05df('0x3f')]['id']}})[_0x05df('0x22')](handleEntityNotFound(_0x486714,null))[_0x05df('0x22')](saveUpdates(_0xd47794[_0x05df('0x46')],null))['then'](respondWithResult(_0x486714,null))['catch'](handleError(_0x486714,null));};exports[_0x05df('0x23')]=function(_0x4be720,_0x279c2f){return db[_0x05df('0x29')][_0x05df('0x44')]({'where':{'id':_0x4be720['params']['id']}})['then'](handleEntityNotFound(_0x279c2f,null))['then'](removeEntity(_0x279c2f,null))[_0x05df('0x3e')](handleError(_0x279c2f,null));};exports['describe']=function(_0x2fe3f0,_0x3ffb5c){return db[_0x05df('0x29')]['describe']()['then'](respondWithResult(_0x3ffb5c,null))[_0x05df('0x3e')](handleError(_0x3ffb5c,null));}; \ No newline at end of file +var _0xb9a0=['sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','intersection','length','include','find','create','body','params','describe','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x212052,_0xf743f9){var _0x5eea2b=function(_0xcb4e59){while(--_0xcb4e59){_0x212052['push'](_0x212052['shift']());}};_0x5eea2b(++_0xf743f9);}(_0xb9a0,0x199));var _0x0b9a=function(_0x26c744,_0x1705ac){_0x26c744=_0x26c744-0x0;var _0x47e4c2=_0xb9a0[_0x26c744];return _0x47e4c2;};'use strict';var pdf=require(_0x0b9a('0x0'));var emlformat=require(_0x0b9a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0b9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b9a('0x3'));var BPromise=require(_0x0b9a('0x4'));var Mustache=require('mustache');var util=require(_0x0b9a('0x5'));var path=require(_0x0b9a('0x6'));var sox=require(_0x0b9a('0x7'));var csv=require(_0x0b9a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0b9a('0x9'));var squel=require(_0x0b9a('0xa'));var crypto=require(_0x0b9a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b9a('0x8'));var querystring=require(_0x0b9a('0xc'));var Papa=require(_0x0b9a('0xd'));var Redis=require(_0x0b9a('0xe'));var authService=require(_0x0b9a('0xf'));var qs=require(_0x0b9a('0x10'));var as=require(_0x0b9a('0x11'));var hardwareService=require(_0x0b9a('0x12'));var logger=require('../../config/logger')(_0x0b9a('0x13'));var utils=require(_0x0b9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0b9a('0x15'));var db=require(_0x0b9a('0x16'))['db'];function respondWithStatusCode(_0x598f7b,_0x4b303e){_0x4b303e=_0x4b303e||0xcc;return function(_0x8a6166){if(_0x8a6166){return _0x598f7b['sendStatus'](_0x4b303e);}return _0x598f7b['status'](_0x4b303e)[_0x0b9a('0x17')]();};}function respondWithResult(_0x24f09b,_0x30e408){_0x30e408=_0x30e408||0xc8;return function(_0x25451e){if(_0x25451e){return _0x24f09b[_0x0b9a('0x18')](_0x30e408)[_0x0b9a('0x19')](_0x25451e);}};}function respondWithFilteredResult(_0x57f48b,_0x5e9610){return function(_0x335759){if(_0x335759){var _0x13a475=_0x335759['count'],_0x590ede=_0x5e9610[_0x0b9a('0x1a')],_0x3d91b4=_0x5e9610[_0x0b9a('0x1a')]+_0x5e9610[_0x0b9a('0x1b')],_0x38753a;if(_0x3d91b4>=_0x13a475){_0x3d91b4=_0x13a475;_0x38753a=0xc8;}else{_0x38753a=0xce;}_0x57f48b['status'](_0x38753a);return _0x57f48b['set'](_0x0b9a('0x1c'),_0x590ede+'-'+_0x3d91b4+'/'+_0x13a475)[_0x0b9a('0x19')](_0x335759);}return null;};}function patchUpdates(_0x1345e8){return function(_0x13e1c3){try{jsonpatch[_0x0b9a('0x1d')](_0x13e1c3,_0x1345e8,!![]);}catch(_0x19a6a8){return BPromise[_0x0b9a('0x1e')](_0x19a6a8);}return _0x13e1c3[_0x0b9a('0x1f')]();};}function saveUpdates(_0x3f9bad,_0x515218){return function(_0x2cbbf6){if(_0x2cbbf6){return _0x2cbbf6[_0x0b9a('0x20')](_0x3f9bad)[_0x0b9a('0x21')](function(_0x205a1b){return _0x205a1b;});}return null;};}function removeEntity(_0x285fb3,_0x46949b){return function(_0x3db35d){if(_0x3db35d){return _0x3db35d[_0x0b9a('0x22')]()['then'](function(){_0x285fb3[_0x0b9a('0x18')](0xcc)[_0x0b9a('0x17')]();});}};}function handleEntityNotFound(_0x547b7f,_0x5106a1){return function(_0x35f3c7){if(!_0x35f3c7){_0x547b7f[_0x0b9a('0x23')](0x194);}return _0x35f3c7;};}function handleError(_0x213079,_0x226e8d){_0x226e8d=_0x226e8d||0x1f4;return function(_0x32672e){logger['error'](_0x32672e[_0x0b9a('0x24')]);if(_0x32672e['name']){delete _0x32672e[_0x0b9a('0x25')];}_0x213079['status'](_0x226e8d)[_0x0b9a('0x26')](_0x32672e);};}exports[_0x0b9a('0x27')]=function(_0x3ff712,_0x32108d){var _0xf75a2f={},_0x295637={},_0x2d2eb1={'count':0x0,'rows':[]};var _0x24876c=_[_0x0b9a('0x28')](db[_0x0b9a('0x29')][_0x0b9a('0x2a')],function(_0x9dffc0){return{'name':_0x9dffc0[_0x0b9a('0x2b')],'type':_0x9dffc0['type'][_0x0b9a('0x2c')]};});_0x295637[_0x0b9a('0x2d')]=_[_0x0b9a('0x28')](_0x24876c,_0x0b9a('0x25'));_0x295637[_0x0b9a('0x2e')]=_[_0x0b9a('0x2f')](_0x3ff712[_0x0b9a('0x2e')]);_0x295637[_0x0b9a('0x30')]=_['intersection'](_0x295637['model'],_0x295637['query']);_0xf75a2f['attributes']=_['intersection'](_0x295637['model'],qs[_0x0b9a('0x31')](_0x3ff712[_0x0b9a('0x2e')]['fields']));_0xf75a2f[_0x0b9a('0x32')]=_0xf75a2f[_0x0b9a('0x32')]['length']?_0xf75a2f['attributes']:_0x295637[_0x0b9a('0x2d')];if(!_0x3ff712[_0x0b9a('0x2e')][_0x0b9a('0x33')](_0x0b9a('0x34'))){_0xf75a2f[_0x0b9a('0x1b')]=qs['limit'](_0x3ff712[_0x0b9a('0x2e')]['limit']);_0xf75a2f[_0x0b9a('0x1a')]=qs[_0x0b9a('0x1a')](_0x3ff712['query']['offset']);}_0xf75a2f[_0x0b9a('0x35')]=qs[_0x0b9a('0x36')](_0x3ff712[_0x0b9a('0x2e')][_0x0b9a('0x36')]);_0xf75a2f['where']=qs[_0x0b9a('0x30')](_[_0x0b9a('0x37')](_0x3ff712[_0x0b9a('0x2e')],_0x295637[_0x0b9a('0x30')]),_0x24876c);if(_0x3ff712[_0x0b9a('0x2e')][_0x0b9a('0x38')]){_0xf75a2f['where']=_[_0x0b9a('0x39')](_0xf75a2f['where'],{'$or':_['map'](_0x24876c,function(_0x2395d4){if(_0x2395d4[_0x0b9a('0x3a')]!==_0x0b9a('0x3b')){var _0x4a6d5a={};_0x4a6d5a[_0x2395d4[_0x0b9a('0x25')]]={'$like':'%'+_0x3ff712['query'][_0x0b9a('0x38')]+'%'};return _0x4a6d5a;}})});}_0xf75a2f=_[_0x0b9a('0x39')]({},_0xf75a2f,_0x3ff712[_0x0b9a('0x3c')]);var _0x4d2ceb={'where':_0xf75a2f['where']};return db[_0x0b9a('0x29')][_0x0b9a('0x3d')](_0x4d2ceb)[_0x0b9a('0x21')](function(_0x327484){_0x2d2eb1['count']=_0x327484;if(_0x3ff712['query'][_0x0b9a('0x3e')]){_0xf75a2f['include']=[{'all':!![]}];}return db[_0x0b9a('0x29')][_0x0b9a('0x3f')](_0xf75a2f);})[_0x0b9a('0x21')](function(_0x5d858e){_0x2d2eb1[_0x0b9a('0x40')]=_0x5d858e;return _0x2d2eb1;})[_0x0b9a('0x21')](respondWithFilteredResult(_0x32108d,_0xf75a2f))[_0x0b9a('0x41')](handleError(_0x32108d,null));};exports['show']=function(_0xf9ebf3,_0x15071e){var _0x213948={'raw':!![],'where':{'id':_0xf9ebf3['params']['id']}},_0x2b4ba7={};_0x2b4ba7[_0x0b9a('0x2d')]=_[_0x0b9a('0x2f')](db[_0x0b9a('0x29')]['rawAttributes']);_0x2b4ba7[_0x0b9a('0x2e')]=_['keys'](_0xf9ebf3[_0x0b9a('0x2e')]);_0x2b4ba7['filters']=_[_0x0b9a('0x42')](_0x2b4ba7['model'],_0x2b4ba7[_0x0b9a('0x2e')]);_0x213948[_0x0b9a('0x32')]=_[_0x0b9a('0x42')](_0x2b4ba7[_0x0b9a('0x2d')],qs['fields'](_0xf9ebf3[_0x0b9a('0x2e')]['fields']));_0x213948['attributes']=_0x213948[_0x0b9a('0x32')][_0x0b9a('0x43')]?_0x213948['attributes']:_0x2b4ba7[_0x0b9a('0x2d')];if(_0xf9ebf3[_0x0b9a('0x2e')][_0x0b9a('0x3e')]){_0x213948[_0x0b9a('0x44')]=[{'all':!![]}];}_0x213948=_['merge']({},_0x213948,_0xf9ebf3['options']);return db[_0x0b9a('0x29')][_0x0b9a('0x45')](_0x213948)[_0x0b9a('0x21')](handleEntityNotFound(_0x15071e,null))[_0x0b9a('0x21')](respondWithResult(_0x15071e,null))[_0x0b9a('0x41')](handleError(_0x15071e,null));};exports[_0x0b9a('0x46')]=function(_0x379464,_0x46c50e){return db[_0x0b9a('0x29')][_0x0b9a('0x46')](_0x379464[_0x0b9a('0x47')],{})[_0x0b9a('0x21')](respondWithResult(_0x46c50e,0xc9))['catch'](handleError(_0x46c50e,null));};exports[_0x0b9a('0x20')]=function(_0x13b85b,_0x26c6d9){if(_0x13b85b['body']['id']){delete _0x13b85b[_0x0b9a('0x47')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x13b85b[_0x0b9a('0x48')]['id']}})[_0x0b9a('0x21')](handleEntityNotFound(_0x26c6d9,null))[_0x0b9a('0x21')](saveUpdates(_0x13b85b[_0x0b9a('0x47')],null))[_0x0b9a('0x21')](respondWithResult(_0x26c6d9,null))['catch'](handleError(_0x26c6d9,null));};exports[_0x0b9a('0x22')]=function(_0x4065e8,_0x2c5838){return db[_0x0b9a('0x29')][_0x0b9a('0x45')]({'where':{'id':_0x4065e8['params']['id']}})['then'](handleEntityNotFound(_0x2c5838,null))['then'](removeEntity(_0x2c5838,null))[_0x0b9a('0x41')](handleError(_0x2c5838,null));};exports[_0x0b9a('0x49')]=function(_0x496221,_0x5bf7ec){return db[_0x0b9a('0x29')][_0x0b9a('0x49')]()[_0x0b9a('0x21')](respondWithResult(_0x5bf7ec,null))[_0x0b9a('0x41')](handleError(_0x5bf7ec,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3b65841..865c955 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 _0x0ce3=['define','FaxQueueReport','uniqueid','util','api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports'];(function(_0x20b718,_0x5c114a){var _0x30abf2=function(_0x14ae63){while(--_0x14ae63){_0x20b718['push'](_0x20b718['shift']());}};_0x30abf2(++_0x5c114a);}(_0x0ce3,0xbe));var _0x30ce=function(_0xec2a0b,_0x4df968){_0xec2a0b=_0xec2a0b-0x0;var _0x5d2111=_0x0ce3[_0xec2a0b];return _0x5d2111;};'use strict';var _=require('lodash');var util=require(_0x30ce('0x0'));var logger=require('../../config/logger')(_0x30ce('0x1'));var moment=require(_0x30ce('0x2'));var BPromise=require(_0x30ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30ce('0x4'));var rimraf=require(_0x30ce('0x5'));var config=require('../../config/environment');var attributes=require(_0x30ce('0x6'));module[_0x30ce('0x7')]=function(_0x1ba812,_0x547ebd){return _0x1ba812[_0x30ce('0x8')](_0x30ce('0x9'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x30ce('0xa'),'fields':[_0x30ce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62de=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0x62de,0xf1));var _0xe62d=function(_0x176a39,_0x30df6b){_0x176a39=_0x176a39-0x0;var _0x224dc0=_0x62de[_0x176a39];return _0x224dc0;};'use strict';var _=require(_0xe62d('0x0'));var util=require(_0xe62d('0x1'));var logger=require(_0xe62d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe62d('0x3'));var rp=require(_0xe62d('0x4'));var fs=require('fs');var path=require(_0xe62d('0x5'));var rimraf=require(_0xe62d('0x6'));var config=require(_0xe62d('0x7'));var attributes=require(_0xe62d('0x8'));module[_0xe62d('0x9')]=function(_0x5ccfa8,_0x17cb6c){return _0x5ccfa8['define'](_0xe62d('0xa'),attributes,{'tableName':_0xe62d('0xb'),'paranoid':![],'indexes':[{'name':_0xe62d('0xc'),'fields':[_0xe62d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c4d0abf..fd2e16a 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 _0x908b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','info','UpdateFaxQueueReport','update','body','raw','where','limit','catch'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x908b,0x1a0));var _0xb908=function(_0x2740f2,_0x25fbb9){_0x2740f2=_0x2740f2-0x0;var _0x8541d7=_0x908b[_0x2740f2];return _0x8541d7;};'use strict';var _=require(_0xb908('0x0'));var util=require(_0xb908('0x1'));var moment=require(_0xb908('0x2'));var BPromise=require('bluebird');var rs=require(_0xb908('0x3'));var fs=require('fs');var Redis=require(_0xb908('0x4'));var db=require(_0xb908('0x5'))['db'];var utils=require(_0xb908('0x6'));var logger=require(_0xb908('0x7'))(_0xb908('0x8'));var config=require('../../config/environment');var jayson=require(_0xb908('0x9'));var client=jayson['client'][_0xb908('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4816,_0x534437,_0x1a264b){return new BPromise(function(_0x4a0022,_0x11c339){return client[_0xb908('0xb')](_0x2e4816,_0x1a264b)[_0xb908('0xc')](function(_0xe0f72b){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x534437,'request\x20sent');logger[_0xb908('0xd')](_0xb908('0xe'),_0x534437,'request\x20sent',JSON[_0xb908('0xf')](_0xe0f72b));if(_0xe0f72b[_0xb908('0x10')]){if(_0xe0f72b[_0xb908('0x10')]['code']===0x1f4){logger[_0xb908('0x10')](_0xb908('0x11'),_0x534437,_0xe0f72b[_0xb908('0x10')]['message']);return _0x11c339(_0xe0f72b[_0xb908('0x10')]['message']);}logger['error'](_0xb908('0x11'),_0x534437,_0xe0f72b[_0xb908('0x10')][_0xb908('0x12')]);return _0x4a0022(_0xe0f72b[_0xb908('0x10')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x534437,'request\x20sent');_0x4a0022(_0xe0f72b[_0xb908('0x13')]['message']);}})['catch'](function(_0x81435e){logger[_0xb908('0x10')](_0xb908('0x11'),_0x534437,_0x81435e);_0x11c339(_0x81435e);});});}exports[_0xb908('0x14')]=function(_0x4f16b3){var _0x56a669=this;return new Promise(function(_0x5281f1,_0x190c7e){return db[_0xb908('0x15')][_0xb908('0x16')](_0x4f16b3['body'],{'raw':_0x4f16b3[_0xb908('0x17')]?_0x4f16b3[_0xb908('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb908('0xc')](function(_0x32a74d){logger[_0xb908('0x18')](_0xb908('0x14'),_0x4f16b3);logger[_0xb908('0xd')](_0xb908('0x14'),_0x4f16b3,JSON[_0xb908('0xf')](_0x32a74d));_0x5281f1(_0x32a74d);})['catch'](function(_0x179a8c){logger[_0xb908('0x10')]('CreateFaxQueueReport',_0x179a8c['message'],_0x4f16b3);_0x190c7e(_0x56a669['error'](0x1f4,_0x179a8c[_0xb908('0x12')]));});});};exports[_0xb908('0x19')]=function(_0x52790c){var _0x51bf83=this;return new Promise(function(_0x528dca,_0x3595cf){return db[_0xb908('0x15')][_0xb908('0x1a')](_0x52790c[_0xb908('0x1b')],{'raw':_0x52790c['options']?_0x52790c[_0xb908('0x17')][_0xb908('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52790c[_0xb908('0x17')]?_0x52790c[_0xb908('0x17')][_0xb908('0x1d')]||null:null,'attributes':_0x52790c[_0xb908('0x17')]?_0x52790c['options']['attributes']||null:null,'limit':_0x52790c[_0xb908('0x17')]?_0x52790c[_0xb908('0x17')][_0xb908('0x1e')]||null:null})[_0xb908('0xc')](function(_0x2c4136){logger[_0xb908('0x18')]('UpdateFaxQueueReport',_0x52790c);logger[_0xb908('0xd')](_0xb908('0x19'),_0x52790c,JSON[_0xb908('0xf')](_0x2c4136));_0x528dca(_0x2c4136);})[_0xb908('0x1f')](function(_0x3fb2bf){logger[_0xb908('0x10')](_0xb908('0x19'),_0x3fb2bf['message'],_0x52790c);_0x3595cf(_0x51bf83[_0xb908('0x10')](0x1f4,_0x3fb2bf[_0xb908('0x12')]));});});}; \ No newline at end of file +var _0x2d48=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x506faa,_0x294a73){var _0x493cbd=function(_0x1cf47c){while(--_0x1cf47c){_0x506faa['push'](_0x506faa['shift']());}};_0x493cbd(++_0x294a73);}(_0x2d48,0xc6));var _0x82d4=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0x2d48[_0x15af0f];return _0x2bd1cb;};'use strict';var _=require(_0x82d4('0x0'));var util=require(_0x82d4('0x1'));var moment=require(_0x82d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x82d4('0x3'));var fs=require('fs');var Redis=require(_0x82d4('0x4'));var db=require(_0x82d4('0x5'))['db'];var utils=require(_0x82d4('0x6'));var logger=require(_0x82d4('0x7'))(_0x82d4('0x8'));var config=require(_0x82d4('0x9'));var jayson=require(_0x82d4('0xa'));var client=jayson[_0x82d4('0xb')][_0x82d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37fabe,_0x5e7097,_0x15b585){return new BPromise(function(_0x241686,_0x3f9ad5){return client[_0x82d4('0xd')](_0x37fabe,_0x15b585)[_0x82d4('0xe')](function(_0x4f2ec8){logger[_0x82d4('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5e7097,_0x82d4('0x10'));logger[_0x82d4('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5e7097,_0x82d4('0x10'),JSON['stringify'](_0x4f2ec8));if(_0x4f2ec8[_0x82d4('0x12')]){if(_0x4f2ec8['error']['code']===0x1f4){logger[_0x82d4('0x12')](_0x82d4('0x13'),_0x5e7097,_0x4f2ec8['error'][_0x82d4('0x14')]);return _0x3f9ad5(_0x4f2ec8['error'][_0x82d4('0x14')]);}logger[_0x82d4('0x12')](_0x82d4('0x13'),_0x5e7097,_0x4f2ec8['error'][_0x82d4('0x14')]);return _0x241686(_0x4f2ec8[_0x82d4('0x12')][_0x82d4('0x14')]);}else{logger['info'](_0x82d4('0x13'),_0x5e7097,_0x82d4('0x10'));_0x241686(_0x4f2ec8[_0x82d4('0x15')][_0x82d4('0x14')]);}})[_0x82d4('0x16')](function(_0x15e18d){logger[_0x82d4('0x12')](_0x82d4('0x13'),_0x5e7097,_0x15e18d);_0x3f9ad5(_0x15e18d);});});}exports[_0x82d4('0x17')]=function(_0x40ee36){var _0x262923=this;return new Promise(function(_0x38a9ee,_0x57d296){return db[_0x82d4('0x18')][_0x82d4('0x19')](_0x40ee36[_0x82d4('0x1a')],{'raw':_0x40ee36[_0x82d4('0x1b')]?_0x40ee36[_0x82d4('0x1b')][_0x82d4('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4f303e){logger[_0x82d4('0xf')](_0x82d4('0x17'),_0x40ee36);logger[_0x82d4('0x11')](_0x82d4('0x17'),_0x40ee36,JSON['stringify'](_0x4f303e));_0x38a9ee(_0x4f303e);})['catch'](function(_0x38c21f){logger[_0x82d4('0x12')](_0x82d4('0x17'),_0x38c21f[_0x82d4('0x14')],_0x40ee36);_0x57d296(_0x262923[_0x82d4('0x12')](0x1f4,_0x38c21f['message']));});});};exports[_0x82d4('0x1d')]=function(_0x337ba3){var _0x39d752=this;return new Promise(function(_0x653137,_0x1dfae5){return db[_0x82d4('0x18')][_0x82d4('0x1e')](_0x337ba3[_0x82d4('0x1a')],{'raw':_0x337ba3[_0x82d4('0x1b')]?_0x337ba3[_0x82d4('0x1b')][_0x82d4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337ba3[_0x82d4('0x1b')]?_0x337ba3[_0x82d4('0x1b')][_0x82d4('0x1f')]||null:null,'attributes':_0x337ba3[_0x82d4('0x1b')]?_0x337ba3['options'][_0x82d4('0x20')]||null:null,'limit':_0x337ba3[_0x82d4('0x1b')]?_0x337ba3[_0x82d4('0x1b')][_0x82d4('0x21')]||null:null})[_0x82d4('0xe')](function(_0x4eac5f){logger[_0x82d4('0xf')](_0x82d4('0x1d'),_0x337ba3);logger[_0x82d4('0x11')](_0x82d4('0x1d'),_0x337ba3,JSON['stringify'](_0x4eac5f));_0x653137(_0x4eac5f);})[_0x82d4('0x16')](function(_0x42f0ab){logger[_0x82d4('0x12')]('UpdateFaxQueueReport',_0x42f0ab[_0x82d4('0x14')],_0x337ba3);_0x1dfae5(_0x39d752[_0x82d4('0x12')](0x1f4,_0x42f0ab[_0x82d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ab14fb0..90222f1 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 _0x3169=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3169,0x113));var _0x9316=function(_0x115683,_0x4a1c36){_0x115683=_0x115683-0x0;var _0x5715b0=_0x3169[_0x115683];return _0x5715b0;};'use strict';var multer=require(_0x9316('0x0'));var util=require(_0x9316('0x1'));var path=require(_0x9316('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9316('0x3')]();var auth=require(_0x9316('0x4'));var interaction=require(_0x9316('0x5'));var config=require(_0x9316('0x6'));var controller=require(_0x9316('0x7'));router['get']('/',auth[_0x9316('0x8')](),controller[_0x9316('0x9')]);router[_0x9316('0xa')](_0x9316('0xb'),auth[_0x9316('0x8')](),controller[_0x9316('0xc')]);router[_0x9316('0xa')](_0x9316('0xd'),auth[_0x9316('0x8')](),controller[_0x9316('0xe')]);router[_0x9316('0xf')]('/',auth[_0x9316('0x8')](),controller[_0x9316('0x10')]);router[_0x9316('0x11')]('/:id',auth[_0x9316('0x8')](),controller[_0x9316('0x12')]);router[_0x9316('0x13')](_0x9316('0xd'),auth[_0x9316('0x8')](),controller[_0x9316('0x14')]);module[_0x9316('0x15')]=router; \ No newline at end of file +var _0x92e3=['show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4b78ec,_0x53fc17){var _0xb2db8=function(_0x122602){while(--_0x122602){_0x4b78ec['push'](_0x4b78ec['shift']());}};_0xb2db8(++_0x53fc17);}(_0x92e3,0x7c));var _0x392e=function(_0x19bfe9,_0x3c089c){_0x19bfe9=_0x19bfe9-0x0;var _0x43a2b0=_0x92e3[_0x19bfe9];return _0x43a2b0;};'use strict';var multer=require(_0x392e('0x0'));var util=require(_0x392e('0x1'));var path=require(_0x392e('0x2'));var timeout=require(_0x392e('0x3'));var express=require(_0x392e('0x4'));var router=express[_0x392e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x392e('0x6'));var config=require(_0x392e('0x7'));var controller=require(_0x392e('0x8'));router[_0x392e('0x9')]('/',auth[_0x392e('0xa')](),controller[_0x392e('0xb')]);router[_0x392e('0x9')](_0x392e('0xc'),auth['isAuthenticated'](),controller[_0x392e('0xd')]);router[_0x392e('0x9')]('/:id',auth[_0x392e('0xa')](),controller[_0x392e('0xe')]);router[_0x392e('0xf')]('/',auth[_0x392e('0xa')](),controller[_0x392e('0x10')]);router[_0x392e('0x11')]('/:id',auth[_0x392e('0xa')](),controller[_0x392e('0x12')]);router[_0x392e('0x13')](_0x392e('0x14'),auth[_0x392e('0xa')](),controller[_0x392e('0x15')]);module[_0x392e('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 293c7bb..0aa36d9 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 _0xbd20=['account','agent','queue','DATE','NOW','moment','sequelize','STRING','ENUM'];(function(_0x2e7876,_0x463a45){var _0x6e66ee=function(_0x26d88e){while(--_0x26d88e){_0x2e7876['push'](_0x2e7876['shift']());}};_0x6e66ee(++_0x463a45);}(_0xbd20,0xcb));var _0x0bd2=function(_0x4bfa30,_0x5aa996){_0x4bfa30=_0x4bfa30-0x0;var _0x23e8d0=_0xbd20[_0x4bfa30];return _0x23e8d0;};'use strict';var moment=require(_0x0bd2('0x0'));var Sequelize=require(_0x0bd2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0bd2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0bd2('0x3')](_0x0bd2('0x4'),_0x0bd2('0x5'),'queue'),'allowNull':![],'defaultValue':_0x0bd2('0x6')},'transferredAt':{'type':Sequelize[_0x0bd2('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x0bd2('0x8')]}}; \ No newline at end of file +var _0x2f31=['sequelize','exports','STRING','ENUM','account','agent','queue','moment'];(function(_0x18e7be,_0xf9071f){var _0x2d3e20=function(_0x273819){while(--_0x273819){_0x18e7be['push'](_0x18e7be['shift']());}};_0x2d3e20(++_0xf9071f);}(_0x2f31,0xe7));var _0x12f3=function(_0x5b61b5,_0x20c4f5){_0x5b61b5=_0x5b61b5-0x0;var _0x2da055=_0x2f31[_0x5b61b5];return _0x2da055;};'use strict';var moment=require(_0x12f3('0x0'));var Sequelize=require(_0x12f3('0x1'));module[_0x12f3('0x2')]={'uniqueid':{'type':Sequelize[_0x12f3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x12f3('0x4')](_0x12f3('0x5'),_0x12f3('0x6'),_0x12f3('0x7')),'allowNull':![],'defaultValue':_0x12f3('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 58b79d1..6962f69 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 _0x5292=['rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0x5292,0xf7));var _0x2529=function(_0x14f456,_0x3b6bb7){_0x14f456=_0x14f456-0x0;var _0x444e80=_0x5292[_0x14f456];return _0x444e80;};'use strict';var pdf=require(_0x2529('0x0'));var emlformat=require(_0x2529('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2529('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2529('0x3'));var moment=require(_0x2529('0x4'));var BPromise=require(_0x2529('0x5'));var Mustache=require(_0x2529('0x6'));var util=require('util');var path=require(_0x2529('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=_0x2598a1['count'],_0xf10dfb=_0x1cc716[_0x2529('0x1a')],_0x574975=_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')],_0x163bf4;if(_0x574975>=_0x1a1ccc){_0x574975=_0x1a1ccc;_0x163bf4=0xc8;}else{_0x163bf4=0xce;}_0x19e4bf['status'](_0x163bf4);return _0x19e4bf['set'](_0x2529('0x1c'),_0xf10dfb+'-'+_0x574975+'/'+_0x1a1ccc)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x41e530){return function(_0x37204a){try{jsonpatch[_0x2529('0x1d')](_0x37204a,_0x41e530,!![]);}catch(_0x556ec1){return BPromise[_0x2529('0x1e')](_0x556ec1);}return _0x37204a[_0x2529('0x1f')]();};}function saveUpdates(_0x1ca15f,_0xeff5a6){return function(_0x51a021){if(_0x51a021){return _0x51a021[_0x2529('0x20')](_0x1ca15f)[_0x2529('0x21')](function(_0x87a9da){return _0x87a9da;});}return null;};}function removeEntity(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x5b4760['status'](0xcc)[_0x2529('0x18')]();});}};}function handleEntityNotFound(_0x2d0c6d,_0x400a01){return function(_0x175960){if(!_0x175960){_0x2d0c6d[_0x2529('0x16')](0x194);}return _0x175960;};}function handleError(_0xbb3c1b,_0x53464a){_0x53464a=_0x53464a||0x1f4;return function(_0x5539ef){logger[_0x2529('0x23')](_0x5539ef[_0x2529('0x24')]);if(_0x5539ef[_0x2529('0x25')]){delete _0x5539ef[_0x2529('0x25')];}_0xbb3c1b[_0x2529('0x17')](_0x53464a)[_0x2529('0x26')](_0x5539ef);};}exports[_0x2529('0x27')]=function(_0x2f512c,_0x20c135){var _0x113df6={},_0x5852aa={},_0x1c5209={'count':0x0,'rows':[]};var _0x6d26cb=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x5bea2d){return{'name':_0x5bea2d[_0x2529('0x2a')],'type':_0x5bea2d[_0x2529('0x2b')]['key']};});_0x5852aa[_0x2529('0x2c')]=_[_0x2529('0x2d')](_0x6d26cb,'name');_0x5852aa[_0x2529('0x2e')]=_[_0x2529('0x2f')](_0x2f512c[_0x2529('0x2e')]);_0x5852aa[_0x2529('0x30')]=_[_0x2529('0x31')](_0x5852aa['model'],_0x5852aa[_0x2529('0x2e')]);_0x113df6[_0x2529('0x32')]=_[_0x2529('0x31')](_0x5852aa[_0x2529('0x2c')],qs[_0x2529('0x33')](_0x2f512c[_0x2529('0x2e')][_0x2529('0x33')]));_0x113df6['attributes']=_0x113df6['attributes'][_0x2529('0x34')]?_0x113df6['attributes']:_0x5852aa[_0x2529('0x2c')];if(!_0x2f512c['query']['hasOwnProperty']('nolimit')){_0x113df6[_0x2529('0x1b')]=qs[_0x2529('0x1b')](_0x2f512c[_0x2529('0x2e')]['limit']);_0x113df6[_0x2529('0x1a')]=qs['offset'](_0x2f512c['query']['offset']);}_0x113df6[_0x2529('0x35')]=qs[_0x2529('0x36')](_0x2f512c[_0x2529('0x2e')][_0x2529('0x36')]);_0x113df6[_0x2529('0x37')]=qs[_0x2529('0x30')](_[_0x2529('0x38')](_0x2f512c[_0x2529('0x2e')],_0x5852aa[_0x2529('0x30')]),_0x6d26cb);if(_0x2f512c[_0x2529('0x2e')][_0x2529('0x39')]){_0x113df6[_0x2529('0x37')]=_[_0x2529('0x3a')](_0x113df6['where'],{'$or':_['map'](_0x6d26cb,function(_0xadb4a2){if(_0xadb4a2[_0x2529('0x2b')]!=='VIRTUAL'){var _0x1ea013={};_0x1ea013[_0xadb4a2[_0x2529('0x25')]]={'$like':'%'+_0x2f512c[_0x2529('0x2e')][_0x2529('0x39')]+'%'};return _0x1ea013;}})});}_0x113df6=_[_0x2529('0x3a')]({},_0x113df6,_0x2f512c[_0x2529('0x3b')]);var _0x1b8226={'where':_0x113df6['where']};return db[_0x2529('0x28')][_0x2529('0x3c')](_0x1b8226)[_0x2529('0x21')](function(_0x4d4243){_0x1c5209[_0x2529('0x3c')]=_0x4d4243;if(_0x2f512c[_0x2529('0x2e')][_0x2529('0x3d')]){_0x113df6[_0x2529('0x3e')]=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3f')](_0x113df6);})[_0x2529('0x21')](function(_0xdd5eba){_0x1c5209[_0x2529('0x40')]=_0xdd5eba;return _0x1c5209;})['then'](respondWithFilteredResult(_0x20c135,_0x113df6))[_0x2529('0x41')](handleError(_0x20c135,null));};exports[_0x2529('0x42')]=function(_0x23382e,_0x3b4e47){var _0x99ffb={'raw':!![],'where':{'id':_0x23382e[_0x2529('0x43')]['id']}},_0x3905d2={};_0x3905d2['model']=_[_0x2529('0x2f')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x3905d2[_0x2529('0x2e')]=_[_0x2529('0x2f')](_0x23382e['query']);_0x3905d2[_0x2529('0x30')]=_[_0x2529('0x31')](_0x3905d2[_0x2529('0x2c')],_0x3905d2[_0x2529('0x2e')]);_0x99ffb[_0x2529('0x32')]=_[_0x2529('0x31')](_0x3905d2['model'],qs['fields'](_0x23382e['query']['fields']));_0x99ffb[_0x2529('0x32')]=_0x99ffb['attributes'][_0x2529('0x34')]?_0x99ffb[_0x2529('0x32')]:_0x3905d2[_0x2529('0x2c')];if(_0x23382e[_0x2529('0x2e')][_0x2529('0x3d')]){_0x99ffb['include']=[{'all':!![]}];}_0x99ffb=_[_0x2529('0x3a')]({},_0x99ffb,_0x23382e['options']);return db[_0x2529('0x28')]['find'](_0x99ffb)[_0x2529('0x21')](handleEntityNotFound(_0x3b4e47,null))['then'](respondWithResult(_0x3b4e47,null))[_0x2529('0x41')](handleError(_0x3b4e47,null));};exports[_0x2529('0x44')]=function(_0x482706,_0x100ad2){return db['FaxTransferReport'][_0x2529('0x44')](_0x482706[_0x2529('0x45')],{})[_0x2529('0x21')](respondWithResult(_0x100ad2,0xc9))[_0x2529('0x41')](handleError(_0x100ad2,null));};exports[_0x2529('0x20')]=function(_0x15ca15,_0x41728f){if(_0x15ca15[_0x2529('0x45')]['id']){delete _0x15ca15[_0x2529('0x45')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x15ca15[_0x2529('0x43')]['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x41728f,null))[_0x2529('0x21')](saveUpdates(_0x15ca15[_0x2529('0x45')],null))['then'](respondWithResult(_0x41728f,null))['catch'](handleError(_0x41728f,null));};exports[_0x2529('0x22')]=function(_0x4a9fb5,_0x2e5bfc){return db[_0x2529('0x28')][_0x2529('0x46')]({'where':{'id':_0x4a9fb5[_0x2529('0x43')]['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x2e5bfc,null))[_0x2529('0x21')](removeEntity(_0x2e5bfc,null))[_0x2529('0x41')](handleError(_0x2e5bfc,null));};exports[_0x2529('0x47')]=function(_0x5aa75d,_0x5ad307){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x5ad307,null))[_0x2529('0x41')](handleError(_0x5ad307,null));}; \ No newline at end of file +var _0x5502=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x261997,_0x3b3653){var _0x4a5707=function(_0x5decd7){while(--_0x5decd7){_0x261997['push'](_0x261997['shift']());}};_0x4a5707(++_0x3b3653);}(_0x5502,0x69));var _0x2550=function(_0x1808f9,_0x322e07){_0x1808f9=_0x1808f9-0x0;var _0x2ffc89=_0x5502[_0x1808f9];return _0x2ffc89;};'use strict';var pdf=require(_0x2550('0x0'));var emlformat=require(_0x2550('0x1'));var rimraf=require(_0x2550('0x2'));var zipdir=require(_0x2550('0x3'));var jsonpatch=require(_0x2550('0x4'));var rp=require(_0x2550('0x5'));var moment=require(_0x2550('0x6'));var BPromise=require(_0x2550('0x7'));var Mustache=require(_0x2550('0x8'));var util=require(_0x2550('0x9'));var path=require(_0x2550('0xa'));var sox=require(_0x2550('0xb'));var csv=require(_0x2550('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2550('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2550('0xe'));var deskjs=require(_0x2550('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2550('0x10'));var Papa=require('papaparse');var Redis=require(_0x2550('0x11'));var authService=require(_0x2550('0x12'));var qs=require(_0x2550('0x13'));var as=require(_0x2550('0x14'));var hardwareService=require(_0x2550('0x15'));var logger=require(_0x2550('0x16'))('api');var utils=require(_0x2550('0x17'));var config=require(_0x2550('0x18'));var licenseUtil=require(_0x2550('0x19'));var db=require(_0x2550('0x1a'))['db'];function respondWithStatusCode(_0x4ee238,_0x3bc4f0){_0x3bc4f0=_0x3bc4f0||0xcc;return function(_0xcd1bbb){if(_0xcd1bbb){return _0x4ee238['sendStatus'](_0x3bc4f0);}return _0x4ee238[_0x2550('0x1b')](_0x3bc4f0)[_0x2550('0x1c')]();};}function respondWithResult(_0x154c18,_0x19a17f){_0x19a17f=_0x19a17f||0xc8;return function(_0x3fef28){if(_0x3fef28){return _0x154c18[_0x2550('0x1b')](_0x19a17f)['json'](_0x3fef28);}};}function respondWithFilteredResult(_0x2aa2ed,_0x2f7587){return function(_0x366848){if(_0x366848){var _0x179866=_0x366848[_0x2550('0x1d')],_0x3f480b=_0x2f7587[_0x2550('0x1e')],_0x21de36=_0x2f7587[_0x2550('0x1e')]+_0x2f7587['limit'],_0x4fcabb;if(_0x21de36>=_0x179866){_0x21de36=_0x179866;_0x4fcabb=0xc8;}else{_0x4fcabb=0xce;}_0x2aa2ed[_0x2550('0x1b')](_0x4fcabb);return _0x2aa2ed['set']('Content-Range',_0x3f480b+'-'+_0x21de36+'/'+_0x179866)[_0x2550('0x1f')](_0x366848);}return null;};}function patchUpdates(_0x50b372){return function(_0x2324ce){try{jsonpatch[_0x2550('0x20')](_0x2324ce,_0x50b372,!![]);}catch(_0xb666cd){return BPromise[_0x2550('0x21')](_0xb666cd);}return _0x2324ce[_0x2550('0x22')]();};}function saveUpdates(_0x4d3e1e,_0x5177e2){return function(_0x4d3142){if(_0x4d3142){return _0x4d3142[_0x2550('0x23')](_0x4d3e1e)[_0x2550('0x24')](function(_0x364568){return _0x364568;});}return null;};}function removeEntity(_0x295f3b,_0x20c942){return function(_0x28359b){if(_0x28359b){return _0x28359b[_0x2550('0x25')]()[_0x2550('0x24')](function(){_0x295f3b[_0x2550('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dadc8,_0x4715f6){return function(_0x5c024e){if(!_0x5c024e){_0x3dadc8[_0x2550('0x26')](0x194);}return _0x5c024e;};}function handleError(_0x2c8e53,_0x547d37){_0x547d37=_0x547d37||0x1f4;return function(_0x418828){logger[_0x2550('0x27')](_0x418828[_0x2550('0x28')]);if(_0x418828[_0x2550('0x29')]){delete _0x418828[_0x2550('0x29')];}_0x2c8e53[_0x2550('0x1b')](_0x547d37)[_0x2550('0x2a')](_0x418828);};}exports[_0x2550('0x2b')]=function(_0x2839f2,_0x125452){var _0xe2744b={},_0x39cdc9={},_0x12ea94={'count':0x0,'rows':[]};var _0x511b4a=_[_0x2550('0x2c')](db[_0x2550('0x2d')][_0x2550('0x2e')],function(_0x38f07a){return{'name':_0x38f07a[_0x2550('0x2f')],'type':_0x38f07a[_0x2550('0x30')][_0x2550('0x31')]};});_0x39cdc9[_0x2550('0x32')]=_[_0x2550('0x2c')](_0x511b4a,_0x2550('0x29'));_0x39cdc9[_0x2550('0x33')]=_[_0x2550('0x34')](_0x2839f2['query']);_0x39cdc9[_0x2550('0x35')]=_[_0x2550('0x36')](_0x39cdc9[_0x2550('0x32')],_0x39cdc9[_0x2550('0x33')]);_0xe2744b[_0x2550('0x37')]=_['intersection'](_0x39cdc9['model'],qs[_0x2550('0x38')](_0x2839f2[_0x2550('0x33')][_0x2550('0x38')]));_0xe2744b['attributes']=_0xe2744b[_0x2550('0x37')][_0x2550('0x39')]?_0xe2744b[_0x2550('0x37')]:_0x39cdc9['model'];if(!_0x2839f2[_0x2550('0x33')][_0x2550('0x3a')](_0x2550('0x3b'))){_0xe2744b['limit']=qs[_0x2550('0x3c')](_0x2839f2['query'][_0x2550('0x3c')]);_0xe2744b[_0x2550('0x1e')]=qs[_0x2550('0x1e')](_0x2839f2['query'][_0x2550('0x1e')]);}_0xe2744b[_0x2550('0x3d')]=qs['sort'](_0x2839f2['query'][_0x2550('0x3e')]);_0xe2744b[_0x2550('0x3f')]=qs[_0x2550('0x35')](_[_0x2550('0x40')](_0x2839f2[_0x2550('0x33')],_0x39cdc9[_0x2550('0x35')]),_0x511b4a);if(_0x2839f2[_0x2550('0x33')][_0x2550('0x41')]){_0xe2744b[_0x2550('0x3f')]=_[_0x2550('0x42')](_0xe2744b[_0x2550('0x3f')],{'$or':_[_0x2550('0x2c')](_0x511b4a,function(_0x1f7e04){if(_0x1f7e04[_0x2550('0x30')]!==_0x2550('0x43')){var _0x5bb864={};_0x5bb864[_0x1f7e04['name']]={'$like':'%'+_0x2839f2[_0x2550('0x33')]['filter']+'%'};return _0x5bb864;}})});}_0xe2744b=_[_0x2550('0x42')]({},_0xe2744b,_0x2839f2['options']);var _0x1d4b15={'where':_0xe2744b[_0x2550('0x3f')]};return db[_0x2550('0x2d')]['count'](_0x1d4b15)['then'](function(_0x57dbbd){_0x12ea94['count']=_0x57dbbd;if(_0x2839f2[_0x2550('0x33')]['includeAll']){_0xe2744b[_0x2550('0x44')]=[{'all':!![]}];}return db[_0x2550('0x2d')][_0x2550('0x45')](_0xe2744b);})[_0x2550('0x24')](function(_0x87b5c0){_0x12ea94[_0x2550('0x46')]=_0x87b5c0;return _0x12ea94;})['then'](respondWithFilteredResult(_0x125452,_0xe2744b))[_0x2550('0x47')](handleError(_0x125452,null));};exports[_0x2550('0x48')]=function(_0x782ef6,_0x49a6a1){var _0xad3092={'raw':!![],'where':{'id':_0x782ef6[_0x2550('0x49')]['id']}},_0x4d52af={};_0x4d52af[_0x2550('0x32')]=_[_0x2550('0x34')](db[_0x2550('0x2d')][_0x2550('0x2e')]);_0x4d52af[_0x2550('0x33')]=_[_0x2550('0x34')](_0x782ef6[_0x2550('0x33')]);_0x4d52af['filters']=_['intersection'](_0x4d52af[_0x2550('0x32')],_0x4d52af[_0x2550('0x33')]);_0xad3092[_0x2550('0x37')]=_[_0x2550('0x36')](_0x4d52af['model'],qs['fields'](_0x782ef6[_0x2550('0x33')][_0x2550('0x38')]));_0xad3092[_0x2550('0x37')]=_0xad3092[_0x2550('0x37')][_0x2550('0x39')]?_0xad3092[_0x2550('0x37')]:_0x4d52af[_0x2550('0x32')];if(_0x782ef6[_0x2550('0x33')][_0x2550('0x4a')]){_0xad3092[_0x2550('0x44')]=[{'all':!![]}];}_0xad3092=_[_0x2550('0x42')]({},_0xad3092,_0x782ef6['options']);return db['FaxTransferReport']['find'](_0xad3092)['then'](handleEntityNotFound(_0x49a6a1,null))[_0x2550('0x24')](respondWithResult(_0x49a6a1,null))[_0x2550('0x47')](handleError(_0x49a6a1,null));};exports[_0x2550('0x4b')]=function(_0x89e527,_0x17e3d9){return db[_0x2550('0x2d')][_0x2550('0x4b')](_0x89e527[_0x2550('0x4c')],{})['then'](respondWithResult(_0x17e3d9,0xc9))[_0x2550('0x47')](handleError(_0x17e3d9,null));};exports[_0x2550('0x23')]=function(_0x138a47,_0x25e6a8){if(_0x138a47[_0x2550('0x4c')]['id']){delete _0x138a47[_0x2550('0x4c')]['id'];}return db[_0x2550('0x2d')][_0x2550('0x4d')]({'where':{'id':_0x138a47[_0x2550('0x49')]['id']}})['then'](handleEntityNotFound(_0x25e6a8,null))['then'](saveUpdates(_0x138a47[_0x2550('0x4c')],null))[_0x2550('0x24')](respondWithResult(_0x25e6a8,null))[_0x2550('0x47')](handleError(_0x25e6a8,null));};exports[_0x2550('0x25')]=function(_0x15cf8f,_0x44c6b5){return db[_0x2550('0x2d')][_0x2550('0x4d')]({'where':{'id':_0x15cf8f[_0x2550('0x49')]['id']}})['then'](handleEntityNotFound(_0x44c6b5,null))[_0x2550('0x24')](removeEntity(_0x44c6b5,null))[_0x2550('0x47')](handleError(_0x44c6b5,null));};exports[_0x2550('0x4e')]=function(_0xaeb2fb,_0x2274b4){return db[_0x2550('0x2d')][_0x2550('0x4e')]()[_0x2550('0x24')](respondWithResult(_0x2274b4,null))['catch'](handleError(_0x2274b4,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a5e94bd..3d9ddc6 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 _0x9005=['moment','bluebird','request-promise','../../config/environment','exports','FaxTransferReport','uniqueid','lodash','../../config/logger','api'];(function(_0x3d9f77,_0x2d4cc0){var _0x23086c=function(_0x288e8c){while(--_0x288e8c){_0x3d9f77['push'](_0x3d9f77['shift']());}};_0x23086c(++_0x2d4cc0);}(_0x9005,0x1c9));var _0x5900=function(_0x41e570,_0x4145f2){_0x41e570=_0x41e570-0x0;var _0x4720ce=_0x9005[_0x41e570];return _0x4720ce;};'use strict';var _=require(_0x5900('0x0'));var util=require('util');var logger=require(_0x5900('0x1'))(_0x5900('0x2'));var moment=require(_0x5900('0x3'));var BPromise=require(_0x5900('0x4'));var rp=require(_0x5900('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5900('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x5900('0x7')]=function(_0x235569,_0x1cac16){return _0x235569['define'](_0x5900('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5900('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff9f=['define','report_fax_transfer','uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x57ecd1,_0x4b593f){var _0x193c75=function(_0x3e1ed7){while(--_0x3e1ed7){_0x57ecd1['push'](_0x57ecd1['shift']());}};_0x193c75(++_0x4b593f);}(_0xff9f,0x19a));var _0xfff9=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0xff9f[_0x1c0f41];return _0x369a9f;};'use strict';var _=require(_0xfff9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfff9('0x1'));var moment=require(_0xfff9('0x2'));var BPromise=require('bluebird');var rp=require(_0xfff9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfff9('0x4'));var config=require(_0xfff9('0x5'));var attributes=require(_0xfff9('0x6'));module[_0xfff9('0x7')]=function(_0x1f7cfc,_0x15d51a){return _0x1f7cfc[_0xfff9('0x8')]('FaxTransferReport',attributes,{'tableName':_0xfff9('0x9'),'paranoid':![],'indexes':[{'name':_0xfff9('0xa'),'fields':[_0xfff9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 39fa44e..e27f92f 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 _0x31a2=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3ea65d,_0x1b6cb2){var _0x4ee23c=function(_0x1ce0de){while(--_0x1ce0de){_0x3ea65d['push'](_0x3ea65d['shift']());}};_0x4ee23c(++_0x1b6cb2);}(_0x31a2,0x1c0));var _0x231a=function(_0x4d50f6,_0x522260){_0x4d50f6=_0x4d50f6-0x0;var _0x4a81b1=_0x31a2[_0x4d50f6];return _0x4a81b1;};'use strict';var _=require('lodash');var util=require(_0x231a('0x0'));var moment=require('moment');var BPromise=require(_0x231a('0x1'));var rs=require(_0x231a('0x2'));var fs=require('fs');var Redis=require(_0x231a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x231a('0x4'));var logger=require('../../config/logger')(_0x231a('0x5'));var config=require('../../config/environment');var jayson=require(_0x231a('0x6'));var client=jayson[_0x231a('0x7')][_0x231a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35a4ec,_0x5caf49,_0x5682ca){return new BPromise(function(_0x43de1a,_0x48c91c){return client['request'](_0x35a4ec,_0x5682ca)['then'](function(_0x2da290){logger[_0x231a('0x9')](_0x231a('0xa'),_0x5caf49,_0x231a('0xb'));logger[_0x231a('0xc')](_0x231a('0xd'),_0x5caf49,_0x231a('0xb'),JSON[_0x231a('0xe')](_0x2da290));if(_0x2da290[_0x231a('0xf')]){if(_0x2da290[_0x231a('0xf')][_0x231a('0x10')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5caf49,_0x2da290['error'][_0x231a('0x11')]);return _0x48c91c(_0x2da290[_0x231a('0xf')][_0x231a('0x11')]);}logger[_0x231a('0xf')](_0x231a('0xa'),_0x5caf49,_0x2da290['error'][_0x231a('0x11')]);return _0x43de1a(_0x2da290['error'][_0x231a('0x11')]);}else{logger[_0x231a('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x5caf49,'request\x20sent');_0x43de1a(_0x2da290[_0x231a('0x12')][_0x231a('0x11')]);}})[_0x231a('0x13')](function(_0x4843c2){logger[_0x231a('0xf')](_0x231a('0xa'),_0x5caf49,_0x4843c2);_0x48c91c(_0x4843c2);});});} \ No newline at end of file +var _0x6971=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x222a81,_0x34a8fd){var _0xefdc4e=function(_0x285865){while(--_0x285865){_0x222a81['push'](_0x222a81['shift']());}};_0xefdc4e(++_0x34a8fd);}(_0x6971,0x18c));var _0x1697=function(_0x1792f3,_0x40ff26){_0x1792f3=_0x1792f3-0x0;var _0x3cb347=_0x6971[_0x1792f3];return _0x3cb347;};'use strict';var _=require(_0x1697('0x0'));var util=require(_0x1697('0x1'));var moment=require(_0x1697('0x2'));var BPromise=require('bluebird');var rs=require(_0x1697('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1697('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1697('0x5'))(_0x1697('0x6'));var config=require('../../config/environment');var jayson=require(_0x1697('0x7'));var client=jayson[_0x1697('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4951a6,_0x55549d,_0x1aa394){return new BPromise(function(_0x118e29,_0x1a13a4){return client['request'](_0x4951a6,_0x1aa394)[_0x1697('0x9')](function(_0x429697){logger[_0x1697('0xa')](_0x1697('0xb'),_0x55549d,_0x1697('0xc'));logger['debug'](_0x1697('0xd'),_0x55549d,_0x1697('0xc'),JSON[_0x1697('0xe')](_0x429697));if(_0x429697[_0x1697('0xf')]){if(_0x429697['error'][_0x1697('0x10')]===0x1f4){logger[_0x1697('0xf')](_0x1697('0xb'),_0x55549d,_0x429697[_0x1697('0xf')]['message']);return _0x1a13a4(_0x429697['error'][_0x1697('0x11')]);}logger['error'](_0x1697('0xb'),_0x55549d,_0x429697['error']['message']);return _0x118e29(_0x429697['error'][_0x1697('0x11')]);}else{logger['info'](_0x1697('0xb'),_0x55549d,_0x1697('0xc'));_0x118e29(_0x429697[_0x1697('0x12')]['message']);}})['catch'](function(_0x3b0ce7){logger[_0x1697('0xf')](_0x1697('0xb'),_0x55549d,_0x3b0ce7);_0x1a13a4(_0x3b0ce7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8d19a0a..fb97fc1 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 _0xc040=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc040,0x6d));var _0x0c04=function(_0x5d4d85,_0x3b493e){_0x5d4d85=_0x5d4d85-0x0;var _0x424ad0=_0xc040[_0x5d4d85];return _0x424ad0;};'use strict';var multer=require(_0x0c04('0x0'));var util=require(_0x0c04('0x1'));var path=require(_0x0c04('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c04('0x3'));var router=express[_0x0c04('0x4')]();var auth=require(_0x0c04('0x5'));var interaction=require(_0x0c04('0x6'));var config=require(_0x0c04('0x7'));var controller=require(_0x0c04('0x8'));router[_0x0c04('0x9')]('/',auth[_0x0c04('0xa')](),controller[_0x0c04('0xb')]);router[_0x0c04('0x9')]('/describe',auth[_0x0c04('0xa')](),controller[_0x0c04('0xc')]);router['get'](_0x0c04('0xd'),auth[_0x0c04('0xa')](),controller[_0x0c04('0xe')]);router[_0x0c04('0xf')]('/',auth[_0x0c04('0xa')](),controller['create']);router[_0x0c04('0x10')](_0x0c04('0xd'),auth[_0x0c04('0xa')](),controller['update']);router['delete'](_0x0c04('0xd'),auth[_0x0c04('0xa')](),controller[_0x0c04('0x11')]);module[_0x0c04('0x12')]=router; \ No newline at end of file +var _0x0207=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','describe','isAuthenticated','show','post','create','update','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1945d4,_0x1ad1b3){var _0x5ecd85=function(_0xdc5b7b){while(--_0xdc5b7b){_0x1945d4['push'](_0x1945d4['shift']());}};_0x5ecd85(++_0x1ad1b3);}(_0x0207,0x7f));var _0x7020=function(_0x220649,_0x1c6ad6){_0x220649=_0x220649-0x0;var _0x18ceab=_0x0207[_0x220649];return _0x18ceab;};'use strict';var multer=require(_0x7020('0x0'));var util=require(_0x7020('0x1'));var path=require(_0x7020('0x2'));var timeout=require(_0x7020('0x3'));var express=require(_0x7020('0x4'));var router=express[_0x7020('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7020('0x6'));var config=require(_0x7020('0x7'));var controller=require(_0x7020('0x8'));router[_0x7020('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7020('0x9')](_0x7020('0xa'),auth['isAuthenticated'](),controller[_0x7020('0xb')]);router[_0x7020('0x9')]('/:id',auth[_0x7020('0xc')](),controller[_0x7020('0xd')]);router[_0x7020('0xe')]('/',auth[_0x7020('0xc')](),controller[_0x7020('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7020('0x10')]);router['delete'](_0x7020('0x11'),auth[_0x7020('0xc')](),controller[_0x7020('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5393541..6443f26 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 _0x1176=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','exports'];(function(_0x41a421,_0x14121f){var _0x46c361=function(_0x42e77c){while(--_0x42e77c){_0x41a421['push'](_0x41a421['shift']());}};_0x46c361(++_0x14121f);}(_0x1176,0x69));var _0x6117=function(_0x4c0851,_0x473aba){_0x4c0851=_0x4c0851-0x0;var _0x99116d=_0x1176[_0x4c0851];return _0x99116d;};'use strict';var multer=require('multer');var util=require(_0x6117('0x0'));var path=require(_0x6117('0x1'));var timeout=require('connect-timeout');var express=require(_0x6117('0x2'));var router=express[_0x6117('0x3')]();var auth=require(_0x6117('0x4'));var interaction=require(_0x6117('0x5'));var config=require(_0x6117('0x6'));var controller=require(_0x6117('0x7'));router['get']('/',auth[_0x6117('0x8')](),controller[_0x6117('0x9')]);router[_0x6117('0xa')](_0x6117('0xb'),auth[_0x6117('0x8')](),controller[_0x6117('0xc')]);router[_0x6117('0xa')](_0x6117('0xd'),auth[_0x6117('0x8')](),controller[_0x6117('0xe')]);router[_0x6117('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x6117('0x8')](),controller[_0x6117('0xf')]);router[_0x6117('0x10')](_0x6117('0xd'),auth[_0x6117('0x8')](),controller[_0x6117('0x11')]);router[_0x6117('0x12')](_0x6117('0xb'),auth[_0x6117('0x8')](),controller[_0x6117('0x13')]);router['delete'](_0x6117('0xb'),auth[_0x6117('0x8')](),controller['destroy']);module[_0x6117('0x14')]=router; \ No newline at end of file +var _0x2a35=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','create','update','delete','exports','multer','util','path','express','Router'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x2a35,0x18b));var _0x52a3=function(_0x33bdd9,_0x3ea0ee){_0x33bdd9=_0x33bdd9-0x0;var _0x53134e=_0x2a35[_0x33bdd9];return _0x53134e;};'use strict';var multer=require(_0x52a3('0x0'));var util=require(_0x52a3('0x1'));var path=require(_0x52a3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52a3('0x3'));var router=express[_0x52a3('0x4')]();var auth=require(_0x52a3('0x5'));var interaction=require(_0x52a3('0x6'));var config=require(_0x52a3('0x7'));var controller=require(_0x52a3('0x8'));router[_0x52a3('0x9')]('/',auth[_0x52a3('0xa')](),controller[_0x52a3('0xb')]);router[_0x52a3('0x9')](_0x52a3('0xc'),auth['isAuthenticated'](),controller[_0x52a3('0xd')]);router['get']('/:id/configurations',auth[_0x52a3('0xa')](),controller[_0x52a3('0xe')]);router[_0x52a3('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x52a3('0xf')]);router['post']('/',auth[_0x52a3('0xa')](),controller[_0x52a3('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x52a3('0xc'),auth[_0x52a3('0xa')](),controller[_0x52a3('0x11')]);router[_0x52a3('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x52a3('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 47a5198..674c7bf 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 _0xfff0=['ENUM','basic','integrationTab','exports','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfff0,0x139));var _0x0fff=function(_0x20526e,_0x4f43dd){_0x20526e=_0x20526e-0x0;var _0x1804c3=_0xfff0[_0x20526e];return _0x1804c3;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0fff('0x1')]},'authType':{'type':Sequelize[_0x0fff('0x2')](_0x0fff('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x0fff('0x1')]},'consumerKey':{'type':Sequelize[_0x0fff('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0fff('0x1')]},'tokenSecret':{'type':Sequelize[_0x0fff('0x1')]},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0fff('0x4'),'newTab'),'defaultValue':_0x0fff('0x4')}}; \ No newline at end of file +var _0x881e=['newTab','STRING','basic','ENUM','integrationTab'];(function(_0x50ee83,_0x106751){var _0x3099ea=function(_0x1d38a4){while(--_0x1d38a4){_0x50ee83['push'](_0x50ee83['shift']());}};_0x3099ea(++_0x106751);}(_0x881e,0x146));var _0xe881=function(_0x2e4d66,_0x26b463){_0x2e4d66=_0x2e4d66-0x0;var _0x28f737=_0x881e[_0x2e4d66];return _0x28f737;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe881('0x0')]},'description':{'type':Sequelize[_0xe881('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe881('0x0')]},'authType':{'type':Sequelize['ENUM'](_0xe881('0x1')),'defaultValue':_0xe881('0x1')},'password':{'type':Sequelize[_0xe881('0x0')]},'consumerKey':{'type':Sequelize[_0xe881('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe881('0x0')]},'tokenSecret':{'type':Sequelize[_0xe881('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe881('0x2')](_0xe881('0x3'),_0xe881('0x4')),'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 0e99e34..66e911b 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 _0xf23e=['priority','remoteUri','authType','username','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','count','offset','limit','set','json','apply','destroy','sendStatus','stack','name','map','DeskAccount','rawAttributes','fieldName','key','keys','filters','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','rows','show','params','intersection','includeAll','find','create','body','getConfigurations','DeskConfiguration','hasOwnProperty','addConfiguration','findOne','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields'];(function(_0x235c6d,_0x16f5d3){var _0x4633eb=function(_0x582c90){while(--_0x582c90){_0x235c6d['push'](_0x235c6d['shift']());}};_0x4633eb(++_0x16f5d3);}(_0xf23e,0x17f));var _0xef23=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xf23e[_0x28aea5];return _0x6a55f9;};'use strict';var pdf=require(_0xef23('0x0'));var emlformat=require(_0xef23('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xef23('0x2'));var jsonpatch=require(_0xef23('0x3'));var rp=require(_0xef23('0x4'));var moment=require(_0xef23('0x5'));var BPromise=require(_0xef23('0x6'));var Mustache=require(_0xef23('0x7'));var util=require(_0xef23('0x8'));var path=require(_0xef23('0x9'));var sox=require(_0xef23('0xa'));var csv=require(_0xef23('0xb'));var ejs=require(_0xef23('0xc'));var fs=require('fs');var _=require(_0xef23('0xd'));var squel=require('squel');var crypto=require(_0xef23('0xe'));var jsforce=require(_0xef23('0xf'));var deskjs=require(_0xef23('0x10'));var toCsv=require(_0xef23('0xb'));var querystring=require('querystring');var Papa=require(_0xef23('0x11'));var Redis=require(_0xef23('0x12'));var authService=require(_0xef23('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xef23('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef23('0x15'));var utils=require(_0xef23('0x16'));var config=require(_0xef23('0x17'));var licenseUtil=require(_0xef23('0x18'));var db=require(_0xef23('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xef23('0x1a'));var client=jayson['client'][_0xef23('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x152ac2,_0x2d24f4,_0x527c22,_0x3f7210){return new BPromise(function(_0x534106,_0x1356d4){var _0x53afbb=_0x3f7210||client;return _0x53afbb[_0xef23('0x1c')](_0x152ac2,_0x527c22)[_0xef23('0x1d')](function(_0x598dd0){logger[_0xef23('0x1e')](_0xef23('0x1f'),_0x2d24f4,_0xef23('0x20'));logger[_0xef23('0x21')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2d24f4,'request\x20sent',JSON[_0xef23('0x22')](_0x598dd0));if(_0x598dd0[_0xef23('0x23')]){if(_0x598dd0[_0xef23('0x23')][_0xef23('0x24')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2d24f4,_0x598dd0[_0xef23('0x23')]['message']);return _0x1356d4(_0x598dd0[_0xef23('0x23')][_0xef23('0x25')]);}logger[_0xef23('0x23')](_0xef23('0x1f'),_0x2d24f4,_0x598dd0[_0xef23('0x23')][_0xef23('0x25')]);return _0x534106(_0x598dd0['error'][_0xef23('0x25')]);}else{logger[_0xef23('0x1e')](_0xef23('0x1f'),_0x2d24f4,_0xef23('0x20'));_0x534106(_0x598dd0[_0xef23('0x26')]['message']);}})[_0xef23('0x27')](function(_0x39d46a){logger['error'](_0xef23('0x1f'),_0x2d24f4,_0x39d46a);_0x1356d4(_0x39d46a);});});}function respondWithStatusCode(_0x2dfe28,_0x385055){_0x385055=_0x385055||0xcc;return function(_0x401946){if(_0x401946){return _0x2dfe28['sendStatus'](_0x385055);}return _0x2dfe28[_0xef23('0x28')](_0x385055)['end']();};}function respondWithResult(_0x2f916b,_0x37cd95){_0x37cd95=_0x37cd95||0xc8;return function(_0x3b92bf){if(_0x3b92bf){return _0x2f916b[_0xef23('0x28')](_0x37cd95)['json'](_0x3b92bf);}};}function respondWithFilteredResult(_0x4d32f6,_0x2202f0){return function(_0x44faea){if(_0x44faea){var _0x3da9be=_0x44faea[_0xef23('0x29')],_0x3debba=_0x2202f0['offset'],_0x60e891=_0x2202f0[_0xef23('0x2a')]+_0x2202f0[_0xef23('0x2b')],_0x17b656;if(_0x60e891>=_0x3da9be){_0x60e891=_0x3da9be;_0x17b656=0xc8;}else{_0x17b656=0xce;}_0x4d32f6[_0xef23('0x28')](_0x17b656);return _0x4d32f6[_0xef23('0x2c')]('Content-Range',_0x3debba+'-'+_0x60e891+'/'+_0x3da9be)[_0xef23('0x2d')](_0x44faea);}return null;};}function patchUpdates(_0x3edb02){return function(_0x406345){try{jsonpatch[_0xef23('0x2e')](_0x406345,_0x3edb02,!![]);}catch(_0xd603bf){return BPromise['reject'](_0xd603bf);}return _0x406345['save']();};}function saveUpdates(_0x496a2c,_0x4f1759){return function(_0x5c5916){if(_0x5c5916){return _0x5c5916['update'](_0x496a2c)[_0xef23('0x1d')](function(_0x11ded9){return _0x11ded9;});}return null;};}function removeEntity(_0x262f1b,_0x3b5a21){return function(_0x2a2d6b){if(_0x2a2d6b){return _0x2a2d6b[_0xef23('0x2f')]()[_0xef23('0x1d')](function(){_0x262f1b[_0xef23('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348fe8,_0x1f936a){return function(_0xd1b58a){if(!_0xd1b58a){_0x348fe8[_0xef23('0x30')](0x194);}return _0xd1b58a;};}function handleError(_0x47d383,_0x49b506){_0x49b506=_0x49b506||0x1f4;return function(_0x1903cb){logger[_0xef23('0x23')](_0x1903cb[_0xef23('0x31')]);if(_0x1903cb[_0xef23('0x32')]){delete _0x1903cb[_0xef23('0x32')];}_0x47d383[_0xef23('0x28')](_0x49b506)['send'](_0x1903cb);};}exports['index']=function(_0xc0d2bb,_0x4de42c){var _0x18e421={},_0x1611fa={},_0x3ed0d7={'count':0x0,'rows':[]};var _0x489d33=_[_0xef23('0x33')](db[_0xef23('0x34')][_0xef23('0x35')],function(_0x2ed3ba){return{'name':_0x2ed3ba[_0xef23('0x36')],'type':_0x2ed3ba['type'][_0xef23('0x37')]};});_0x1611fa['model']=_[_0xef23('0x33')](_0x489d33,_0xef23('0x32'));_0x1611fa['query']=_[_0xef23('0x38')](_0xc0d2bb['query']);_0x1611fa[_0xef23('0x39')]=_['intersection'](_0x1611fa[_0xef23('0x3a')],_0x1611fa[_0xef23('0x3b')]);_0x18e421[_0xef23('0x3c')]=_['intersection'](_0x1611fa[_0xef23('0x3a')],qs[_0xef23('0x3d')](_0xc0d2bb[_0xef23('0x3b')][_0xef23('0x3d')]));_0x18e421['attributes']=_0x18e421['attributes'][_0xef23('0x3e')]?_0x18e421[_0xef23('0x3c')]:_0x1611fa[_0xef23('0x3a')];if(!_0xc0d2bb[_0xef23('0x3b')]['hasOwnProperty'](_0xef23('0x3f'))){_0x18e421[_0xef23('0x2b')]=qs[_0xef23('0x2b')](_0xc0d2bb[_0xef23('0x3b')]['limit']);_0x18e421[_0xef23('0x2a')]=qs['offset'](_0xc0d2bb[_0xef23('0x3b')][_0xef23('0x2a')]);}_0x18e421[_0xef23('0x40')]=qs['sort'](_0xc0d2bb['query'][_0xef23('0x41')]);_0x18e421['where']=qs[_0xef23('0x39')](_[_0xef23('0x42')](_0xc0d2bb[_0xef23('0x3b')],_0x1611fa[_0xef23('0x39')]),_0x489d33);if(_0xc0d2bb[_0xef23('0x3b')][_0xef23('0x43')]){_0x18e421[_0xef23('0x44')]=_[_0xef23('0x45')](_0x18e421[_0xef23('0x44')],{'$or':_[_0xef23('0x33')](_0x489d33,function(_0x542d77){if(_0x542d77[_0xef23('0x46')]!==_0xef23('0x47')){var _0x19c6e2={};_0x19c6e2[_0x542d77[_0xef23('0x32')]]={'$like':'%'+_0xc0d2bb[_0xef23('0x3b')][_0xef23('0x43')]+'%'};return _0x19c6e2;}})});}_0x18e421=_['merge']({},_0x18e421,_0xc0d2bb[_0xef23('0x48')]);var _0x38262c={'where':_0x18e421[_0xef23('0x44')]};return db[_0xef23('0x34')][_0xef23('0x29')](_0x38262c)[_0xef23('0x1d')](function(_0x38b921){_0x3ed0d7[_0xef23('0x29')]=_0x38b921;if(_0xc0d2bb['query']['includeAll']){_0x18e421[_0xef23('0x49')]=[{'all':!![]}];}return db[_0xef23('0x34')]['findAll'](_0x18e421);})[_0xef23('0x1d')](function(_0x3d70dc){_0x3ed0d7[_0xef23('0x4a')]=_0x3d70dc;return _0x3ed0d7;})[_0xef23('0x1d')](respondWithFilteredResult(_0x4de42c,_0x18e421))[_0xef23('0x27')](handleError(_0x4de42c,null));};exports[_0xef23('0x4b')]=function(_0x302df8,_0x5853fb){var _0x2a0519={'raw':![],'where':{'id':_0x302df8[_0xef23('0x4c')]['id']}},_0x47e920={};_0x47e920[_0xef23('0x3a')]=_[_0xef23('0x38')](db[_0xef23('0x34')][_0xef23('0x35')]);_0x47e920['query']=_['keys'](_0x302df8[_0xef23('0x3b')]);_0x47e920[_0xef23('0x39')]=_[_0xef23('0x4d')](_0x47e920[_0xef23('0x3a')],_0x47e920[_0xef23('0x3b')]);_0x2a0519[_0xef23('0x3c')]=_[_0xef23('0x4d')](_0x47e920[_0xef23('0x3a')],qs[_0xef23('0x3d')](_0x302df8[_0xef23('0x3b')]['fields']));_0x2a0519[_0xef23('0x3c')]=_0x2a0519[_0xef23('0x3c')][_0xef23('0x3e')]?_0x2a0519[_0xef23('0x3c')]:_0x47e920[_0xef23('0x3a')];if(_0x302df8[_0xef23('0x3b')][_0xef23('0x4e')]){_0x2a0519[_0xef23('0x49')]=[{'all':!![]}];}_0x2a0519=_[_0xef23('0x45')]({},_0x2a0519,_0x302df8[_0xef23('0x48')]);return db[_0xef23('0x34')][_0xef23('0x4f')](_0x2a0519)[_0xef23('0x1d')](handleEntityNotFound(_0x5853fb,null))[_0xef23('0x1d')](respondWithResult(_0x5853fb,null))[_0xef23('0x27')](handleError(_0x5853fb,null));};exports['create']=function(_0x5ad82b,_0x409606){return db['DeskAccount'][_0xef23('0x50')](_0x5ad82b[_0xef23('0x51')],{})[_0xef23('0x1d')](respondWithResult(_0x409606,0xc9))[_0xef23('0x27')](handleError(_0x409606,null));};exports['update']=function(_0x3ed632,_0x2bcc25){if(_0x3ed632[_0xef23('0x51')]['id']){delete _0x3ed632['body']['id'];}return db['DeskAccount'][_0xef23('0x4f')]({'where':{'id':_0x3ed632[_0xef23('0x4c')]['id']}})[_0xef23('0x1d')](handleEntityNotFound(_0x2bcc25,null))[_0xef23('0x1d')](saveUpdates(_0x3ed632[_0xef23('0x51')],null))[_0xef23('0x1d')](respondWithResult(_0x2bcc25,null))[_0xef23('0x27')](handleError(_0x2bcc25,null));};exports[_0xef23('0x2f')]=function(_0x28d22d,_0x38c29e){return db['DeskAccount'][_0xef23('0x4f')]({'where':{'id':_0x28d22d['params']['id']}})[_0xef23('0x1d')](handleEntityNotFound(_0x38c29e,null))[_0xef23('0x1d')](removeEntity(_0x38c29e,null))[_0xef23('0x27')](handleError(_0x38c29e,null));};exports[_0xef23('0x52')]=function(_0x2ca5af,_0x3f5fd9,_0x3ab2ea){var _0x5b42cf={};var _0x70b6a8={};var _0xdb0af4;var _0x338eee;return db['DeskAccount']['findOne']({'where':{'id':_0x2ca5af[_0xef23('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f5fd9,null))[_0xef23('0x1d')](function(_0x5b9529){if(_0x5b9529){_0xdb0af4=_0x5b9529;_0x70b6a8[_0xef23('0x3a')]=_['keys'](db[_0xef23('0x53')][_0xef23('0x35')]);_0x70b6a8['query']=_['keys'](_0x2ca5af[_0xef23('0x3b')]);_0x70b6a8[_0xef23('0x39')]=_[_0xef23('0x4d')](_0x70b6a8[_0xef23('0x3a')],_0x70b6a8['query']);_0x5b42cf[_0xef23('0x3c')]=_['intersection'](_0x70b6a8['model'],qs[_0xef23('0x3d')](_0x2ca5af['query']['fields']));_0x5b42cf[_0xef23('0x3c')]=_0x5b42cf[_0xef23('0x3c')]['length']?_0x5b42cf[_0xef23('0x3c')]:_0x70b6a8[_0xef23('0x3a')];_0x5b42cf['order']=qs[_0xef23('0x41')](_0x2ca5af[_0xef23('0x3b')][_0xef23('0x41')]);_0x5b42cf[_0xef23('0x44')]=qs[_0xef23('0x39')](_[_0xef23('0x42')](_0x2ca5af['query'],_0x70b6a8[_0xef23('0x39')]));if(_0x2ca5af[_0xef23('0x3b')][_0xef23('0x43')]){_0x5b42cf['where']=_[_0xef23('0x45')](_0x5b42cf['where'],{'$or':_[_0xef23('0x33')](_0x5b42cf['attributes'],function(_0x4db768){var _0xf31201={};_0xf31201[_0x4db768]={'$like':'%'+_0x2ca5af[_0xef23('0x3b')][_0xef23('0x43')]+'%'};return _0xf31201;})});}_0x5b42cf=_[_0xef23('0x45')]({},_0x5b42cf,_0x2ca5af['options']);return _0xdb0af4[_0xef23('0x52')](_0x5b42cf);}})[_0xef23('0x1d')](function(_0x3707d0){if(_0x3707d0){_0x338eee=_0x3707d0['length'];if(!_0x2ca5af[_0xef23('0x3b')][_0xef23('0x54')](_0xef23('0x3f'))){_0x5b42cf[_0xef23('0x2b')]=qs[_0xef23('0x2b')](_0x2ca5af[_0xef23('0x3b')]['limit']);_0x5b42cf[_0xef23('0x2a')]=qs[_0xef23('0x2a')](_0x2ca5af[_0xef23('0x3b')][_0xef23('0x2a')]);}return _0xdb0af4[_0xef23('0x52')](_0x5b42cf);}})['then'](function(_0xc2fcdf){if(_0xc2fcdf){return _0xc2fcdf?{'count':_0x338eee,'rows':_0xc2fcdf}:null;}})['then'](respondWithResult(_0x3f5fd9,null))[_0xef23('0x27')](handleError(_0x3f5fd9,null));};exports[_0xef23('0x55')]=function(_0x343697,_0x2340ef,_0x5aa9f6){if(_0x343697['body']['id']){delete _0x343697['body']['id'];}return db[_0xef23('0x34')][_0xef23('0x56')]({'where':{'id':_0x343697[_0xef23('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2340ef,null))[_0xef23('0x1d')](function(_0x351a87){if(_0x351a87){_0x343697[_0xef23('0x51')]['AccountId']=_0x351a87['id'];_0x343697[_0xef23('0x51')][_0xef23('0x57')]=integrations['getSubjects'](_0x343697[_0xef23('0x51')][_0xef23('0x58')],_0x343697[_0xef23('0x51')][_0xef23('0x46')]);_0x343697[_0xef23('0x51')]['Descriptions']=integrations[_0xef23('0x59')](_0x343697['body'][_0xef23('0x58')],_0x343697[_0xef23('0x51')]['type']);return db[_0xef23('0x53')][_0xef23('0x50')](_0x343697[_0xef23('0x51')],{'include':[{'model':db[_0xef23('0x5a')],'as':_0xef23('0x57')},{'model':db[_0xef23('0x5a')],'as':_0xef23('0x5b')}]});}return null;})['then'](respondWithResult(_0x2340ef,null))['catch'](handleError(_0x2340ef,null));};exports[_0xef23('0x5c')]=function(_0x1b7856,_0xc47f5d,_0x50a1ac){var _0x240ead=[{'name':_0xef23('0x5d'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4f2125='';return db[_0xef23('0x34')][_0xef23('0x56')]({'where':{'id':_0x1b7856[_0xef23('0x4c')]['id']},'attributes':['id',_0xef23('0x5e'),_0xef23('0x5f'),_0xef23('0x60'),'password',_0xef23('0x61'),_0xef23('0x62'),'token',_0xef23('0x63')]})['then'](handleEntityNotFound(_0xc47f5d,null))[_0xef23('0x1d')](function(_0x3278e7){if(_0x3278e7){_0x4f2125=_0x3278e7[_0xef23('0x5e')];var _0x570187=_0x4f2125['slice'](-0x1);if(_0x570187==='/'){_0x4f2125=_0x4f2125[_0xef23('0x64')](0x0,_0x4f2125[_0xef23('0x65')](_0x570187));}var _0x3eda03={'method':_0xef23('0x66'),'uri':util[_0xef23('0x67')](_0xef23('0x68'),_0x4f2125),'headers':{'Content-Type':_0xef23('0x69'),'Accept':'application/json'},'json':!![]};if(_0x3278e7[_0xef23('0x5f')]==='basic'){_0x3eda03['headers'][_0xef23('0x6a')]=util[_0xef23('0x67')](_0xef23('0x6b'),new Buffer(util[_0xef23('0x67')](_0xef23('0x6c'),_0x3278e7[_0xef23('0x60')],_0x3278e7[_0xef23('0x6d')]))[_0xef23('0x6e')]('base64'));}return rp(_0x3eda03)[_0xef23('0x1d')](function(_0x29b4ae){return _0x240ead[_0xef23('0x6f')](_[_0xef23('0x33')](_0x29b4ae[_0xef23('0x70')]['entries'],function(_0x4aa25c){return{'id':_0x4aa25c[_0xef23('0x32')],'name':_0x4aa25c[_0xef23('0x32')],'type':_0x4aa25c[_0xef23('0x46')],'active':_0x4aa25c[_0xef23('0x71')],'label':_0x4aa25c[_0xef23('0x72')],'custom':!![]};}));});}})['then'](function(_0x317365){return{'count':_0x317365[_0xef23('0x3e')],'rows':_0x317365};})[_0xef23('0x1d')](respondWithResult(_0xc47f5d,null))[_0xef23('0x27')](function(_0x3769f0){var _0x88f10c=_0x1b7856[_0xef23('0x3b')][_0xef23('0x73')]?0x1f4:_0x3769f0['statusCode']||0x1f4;logger[_0xef23('0x23')](_0xef23('0x74'),_0xef23('0x5c'),_0x88f10c,JSON['stringify'](_0x3769f0));delete _0x3769f0['name'];if(_0x88f10c===0x191){_0x88f10c=0x190;}_0xc47f5d[_0xef23('0x28')](_0x88f10c)[_0xef23('0x75')](_0x1b7856[_0xef23('0x3b')][_0xef23('0x73')]?{'message':_0xef23('0x76'),'statusCode':_0x3769f0['statusCode']}:_0x3769f0);});}; \ No newline at end of file +var _0xc8f2=['../../config/logger','api','../../mysqldb','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','send','index','DeskAccount','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xf9e9bb,_0x205697){var _0x54eb74=function(_0x276926){while(--_0x276926){_0xf9e9bb['push'](_0xf9e9bb['shift']());}};_0x54eb74(++_0x205697);}(_0xc8f2,0x68));var _0x2c8f=function(_0x3e0603,_0x2db231){_0x3e0603=_0x3e0603-0x0;var _0x7bbaae=_0xc8f2[_0x3e0603];return _0x7bbaae;};'use strict';var pdf=require(_0x2c8f('0x0'));var emlformat=require(_0x2c8f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2c8f('0x2'));var jsonpatch=require(_0x2c8f('0x3'));var rp=require(_0x2c8f('0x4'));var moment=require(_0x2c8f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c8f('0x6'));var path=require(_0x2c8f('0x7'));var sox=require(_0x2c8f('0x8'));var csv=require(_0x2c8f('0x9'));var ejs=require(_0x2c8f('0xa'));var fs=require('fs');var _=require(_0x2c8f('0xb'));var squel=require(_0x2c8f('0xc'));var crypto=require(_0x2c8f('0xd'));var jsforce=require(_0x2c8f('0xe'));var deskjs=require(_0x2c8f('0xf'));var toCsv=require(_0x2c8f('0x9'));var querystring=require(_0x2c8f('0x10'));var Papa=require(_0x2c8f('0x11'));var Redis=require('ioredis');var authService=require(_0x2c8f('0x12'));var qs=require(_0x2c8f('0x13'));var as=require(_0x2c8f('0x14'));var hardwareService=require(_0x2c8f('0x15'));var logger=require(_0x2c8f('0x16'))(_0x2c8f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c8f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2c8f('0x19'));var client=jayson[_0x2c8f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1ed7,_0x16a2ab,_0x30ca17,_0x17bab3){return new BPromise(function(_0x26dedb,_0x55ff26){var _0x41ea77=_0x17bab3||client;return _0x41ea77[_0x2c8f('0x1b')](_0x4a1ed7,_0x30ca17)[_0x2c8f('0x1c')](function(_0x2fd857){logger['info'](_0x2c8f('0x1d'),_0x16a2ab,'request\x20sent');logger[_0x2c8f('0x1e')](_0x2c8f('0x1f'),_0x16a2ab,'request\x20sent',JSON[_0x2c8f('0x20')](_0x2fd857));if(_0x2fd857[_0x2c8f('0x21')]){if(_0x2fd857['error'][_0x2c8f('0x22')]===0x1f4){logger['error'](_0x2c8f('0x1d'),_0x16a2ab,_0x2fd857['error'][_0x2c8f('0x23')]);return _0x55ff26(_0x2fd857[_0x2c8f('0x21')][_0x2c8f('0x23')]);}logger[_0x2c8f('0x21')](_0x2c8f('0x1d'),_0x16a2ab,_0x2fd857[_0x2c8f('0x21')]['message']);return _0x26dedb(_0x2fd857['error'][_0x2c8f('0x23')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x16a2ab,_0x2c8f('0x24'));_0x26dedb(_0x2fd857['result'][_0x2c8f('0x23')]);}})['catch'](function(_0x340f66){logger[_0x2c8f('0x21')](_0x2c8f('0x1d'),_0x16a2ab,_0x340f66);_0x55ff26(_0x340f66);});});}function respondWithStatusCode(_0x15c489,_0x1c114d){_0x1c114d=_0x1c114d||0xcc;return function(_0x17a8e1){if(_0x17a8e1){return _0x15c489[_0x2c8f('0x25')](_0x1c114d);}return _0x15c489[_0x2c8f('0x26')](_0x1c114d)['end']();};}function respondWithResult(_0x1588d0,_0x5503e2){_0x5503e2=_0x5503e2||0xc8;return function(_0x1651ac){if(_0x1651ac){return _0x1588d0[_0x2c8f('0x26')](_0x5503e2)[_0x2c8f('0x27')](_0x1651ac);}};}function respondWithFilteredResult(_0x1f36d0,_0x502f08){return function(_0x47b2cd){if(_0x47b2cd){var _0x1c8920=_0x47b2cd[_0x2c8f('0x28')],_0xb6d8d3=_0x502f08[_0x2c8f('0x29')],_0x5034e6=_0x502f08['offset']+_0x502f08[_0x2c8f('0x2a')],_0x219170;if(_0x5034e6>=_0x1c8920){_0x5034e6=_0x1c8920;_0x219170=0xc8;}else{_0x219170=0xce;}_0x1f36d0[_0x2c8f('0x26')](_0x219170);return _0x1f36d0[_0x2c8f('0x2b')](_0x2c8f('0x2c'),_0xb6d8d3+'-'+_0x5034e6+'/'+_0x1c8920)[_0x2c8f('0x27')](_0x47b2cd);}return null;};}function patchUpdates(_0x10b679){return function(_0x402431){try{jsonpatch['apply'](_0x402431,_0x10b679,!![]);}catch(_0x511615){return BPromise['reject'](_0x511615);}return _0x402431[_0x2c8f('0x2d')]();};}function saveUpdates(_0x1b1ede,_0x49bad9){return function(_0x117c22){if(_0x117c22){return _0x117c22[_0x2c8f('0x2e')](_0x1b1ede)[_0x2c8f('0x1c')](function(_0x266c37){return _0x266c37;});}return null;};}function removeEntity(_0x13e125,_0x3ee3d1){return function(_0x319ac5){if(_0x319ac5){return _0x319ac5[_0x2c8f('0x2f')]()[_0x2c8f('0x1c')](function(){_0x13e125[_0x2c8f('0x26')](0xcc)[_0x2c8f('0x30')]();});}};}function handleEntityNotFound(_0x85ffa3,_0x5c6535){return function(_0x238661){if(!_0x238661){_0x85ffa3[_0x2c8f('0x25')](0x194);}return _0x238661;};}function handleError(_0x40a664,_0x379d5c){_0x379d5c=_0x379d5c||0x1f4;return function(_0x354599){logger['error'](_0x354599[_0x2c8f('0x31')]);if(_0x354599[_0x2c8f('0x32')]){delete _0x354599[_0x2c8f('0x32')];}_0x40a664[_0x2c8f('0x26')](_0x379d5c)[_0x2c8f('0x33')](_0x354599);};}exports[_0x2c8f('0x34')]=function(_0x17091b,_0x450f13){var _0x498740={},_0x3ccedc={},_0xe4d357={'count':0x0,'rows':[]};var _0x5f55a3=_['map'](db[_0x2c8f('0x35')]['rawAttributes'],function(_0x290e74){return{'name':_0x290e74['fieldName'],'type':_0x290e74[_0x2c8f('0x36')][_0x2c8f('0x37')]};});_0x3ccedc[_0x2c8f('0x38')]=_[_0x2c8f('0x39')](_0x5f55a3,_0x2c8f('0x32'));_0x3ccedc[_0x2c8f('0x3a')]=_[_0x2c8f('0x3b')](_0x17091b[_0x2c8f('0x3a')]);_0x3ccedc[_0x2c8f('0x3c')]=_['intersection'](_0x3ccedc[_0x2c8f('0x38')],_0x3ccedc[_0x2c8f('0x3a')]);_0x498740[_0x2c8f('0x3d')]=_[_0x2c8f('0x3e')](_0x3ccedc[_0x2c8f('0x38')],qs[_0x2c8f('0x3f')](_0x17091b[_0x2c8f('0x3a')][_0x2c8f('0x3f')]));_0x498740[_0x2c8f('0x3d')]=_0x498740[_0x2c8f('0x3d')][_0x2c8f('0x40')]?_0x498740[_0x2c8f('0x3d')]:_0x3ccedc[_0x2c8f('0x38')];if(!_0x17091b[_0x2c8f('0x3a')][_0x2c8f('0x41')](_0x2c8f('0x42'))){_0x498740[_0x2c8f('0x2a')]=qs[_0x2c8f('0x2a')](_0x17091b[_0x2c8f('0x3a')]['limit']);_0x498740[_0x2c8f('0x29')]=qs[_0x2c8f('0x29')](_0x17091b['query'][_0x2c8f('0x29')]);}_0x498740[_0x2c8f('0x43')]=qs['sort'](_0x17091b[_0x2c8f('0x3a')][_0x2c8f('0x44')]);_0x498740['where']=qs[_0x2c8f('0x3c')](_[_0x2c8f('0x45')](_0x17091b[_0x2c8f('0x3a')],_0x3ccedc[_0x2c8f('0x3c')]),_0x5f55a3);if(_0x17091b[_0x2c8f('0x3a')][_0x2c8f('0x46')]){_0x498740['where']=_['merge'](_0x498740[_0x2c8f('0x47')],{'$or':_[_0x2c8f('0x39')](_0x5f55a3,function(_0x304a33){if(_0x304a33[_0x2c8f('0x36')]!==_0x2c8f('0x48')){var _0x3873cf={};_0x3873cf[_0x304a33[_0x2c8f('0x32')]]={'$like':'%'+_0x17091b['query'][_0x2c8f('0x46')]+'%'};return _0x3873cf;}})});}_0x498740=_['merge']({},_0x498740,_0x17091b[_0x2c8f('0x49')]);var _0x105358={'where':_0x498740['where']};return db[_0x2c8f('0x35')][_0x2c8f('0x28')](_0x105358)['then'](function(_0x180c43){_0xe4d357[_0x2c8f('0x28')]=_0x180c43;if(_0x17091b[_0x2c8f('0x3a')][_0x2c8f('0x4a')]){_0x498740[_0x2c8f('0x4b')]=[{'all':!![]}];}return db[_0x2c8f('0x35')][_0x2c8f('0x4c')](_0x498740);})[_0x2c8f('0x1c')](function(_0x2379f8){_0xe4d357[_0x2c8f('0x4d')]=_0x2379f8;return _0xe4d357;})['then'](respondWithFilteredResult(_0x450f13,_0x498740))[_0x2c8f('0x4e')](handleError(_0x450f13,null));};exports['show']=function(_0x3da7ae,_0x3444ef){var _0x97f918={'raw':![],'where':{'id':_0x3da7ae[_0x2c8f('0x4f')]['id']}},_0x3e1252={};_0x3e1252['model']=_[_0x2c8f('0x3b')](db[_0x2c8f('0x35')][_0x2c8f('0x50')]);_0x3e1252['query']=_[_0x2c8f('0x3b')](_0x3da7ae[_0x2c8f('0x3a')]);_0x3e1252['filters']=_[_0x2c8f('0x3e')](_0x3e1252[_0x2c8f('0x38')],_0x3e1252['query']);_0x97f918[_0x2c8f('0x3d')]=_[_0x2c8f('0x3e')](_0x3e1252['model'],qs[_0x2c8f('0x3f')](_0x3da7ae['query']['fields']));_0x97f918['attributes']=_0x97f918[_0x2c8f('0x3d')][_0x2c8f('0x40')]?_0x97f918['attributes']:_0x3e1252[_0x2c8f('0x38')];if(_0x3da7ae['query']['includeAll']){_0x97f918[_0x2c8f('0x4b')]=[{'all':!![]}];}_0x97f918=_[_0x2c8f('0x51')]({},_0x97f918,_0x3da7ae[_0x2c8f('0x49')]);return db['DeskAccount'][_0x2c8f('0x52')](_0x97f918)['then'](handleEntityNotFound(_0x3444ef,null))[_0x2c8f('0x1c')](respondWithResult(_0x3444ef,null))[_0x2c8f('0x4e')](handleError(_0x3444ef,null));};exports['create']=function(_0x1ca51b,_0x53e646){return db[_0x2c8f('0x35')][_0x2c8f('0x53')](_0x1ca51b[_0x2c8f('0x54')],{})[_0x2c8f('0x1c')](respondWithResult(_0x53e646,0xc9))[_0x2c8f('0x4e')](handleError(_0x53e646,null));};exports[_0x2c8f('0x2e')]=function(_0x416eb1,_0x40ce9e){if(_0x416eb1['body']['id']){delete _0x416eb1[_0x2c8f('0x54')]['id'];}return db[_0x2c8f('0x35')][_0x2c8f('0x52')]({'where':{'id':_0x416eb1[_0x2c8f('0x4f')]['id']}})[_0x2c8f('0x1c')](handleEntityNotFound(_0x40ce9e,null))['then'](saveUpdates(_0x416eb1['body'],null))[_0x2c8f('0x1c')](respondWithResult(_0x40ce9e,null))[_0x2c8f('0x4e')](handleError(_0x40ce9e,null));};exports['destroy']=function(_0x33431a,_0x51789f){return db[_0x2c8f('0x35')][_0x2c8f('0x52')]({'where':{'id':_0x33431a['params']['id']}})['then'](handleEntityNotFound(_0x51789f,null))[_0x2c8f('0x1c')](removeEntity(_0x51789f,null))[_0x2c8f('0x4e')](handleError(_0x51789f,null));};exports[_0x2c8f('0x55')]=function(_0x8cc7ef,_0x503677,_0x5a6cba){var _0x3d168d={};var _0x454747={};var _0xffdd68;var _0x2754e4;return db['DeskAccount'][_0x2c8f('0x56')]({'where':{'id':_0x8cc7ef['params']['id']}})[_0x2c8f('0x1c')](handleEntityNotFound(_0x503677,null))[_0x2c8f('0x1c')](function(_0x110564){if(_0x110564){_0xffdd68=_0x110564;_0x454747[_0x2c8f('0x38')]=_['keys'](db['DeskConfiguration'][_0x2c8f('0x50')]);_0x454747[_0x2c8f('0x3a')]=_['keys'](_0x8cc7ef[_0x2c8f('0x3a')]);_0x454747[_0x2c8f('0x3c')]=_[_0x2c8f('0x3e')](_0x454747[_0x2c8f('0x38')],_0x454747[_0x2c8f('0x3a')]);_0x3d168d['attributes']=_[_0x2c8f('0x3e')](_0x454747[_0x2c8f('0x38')],qs[_0x2c8f('0x3f')](_0x8cc7ef[_0x2c8f('0x3a')][_0x2c8f('0x3f')]));_0x3d168d['attributes']=_0x3d168d[_0x2c8f('0x3d')]['length']?_0x3d168d[_0x2c8f('0x3d')]:_0x454747['model'];_0x3d168d['order']=qs['sort'](_0x8cc7ef[_0x2c8f('0x3a')]['sort']);_0x3d168d['where']=qs['filters'](_[_0x2c8f('0x45')](_0x8cc7ef[_0x2c8f('0x3a')],_0x454747[_0x2c8f('0x3c')]));if(_0x8cc7ef['query'][_0x2c8f('0x46')]){_0x3d168d[_0x2c8f('0x47')]=_['merge'](_0x3d168d[_0x2c8f('0x47')],{'$or':_[_0x2c8f('0x39')](_0x3d168d['attributes'],function(_0x474548){var _0xfad625={};_0xfad625[_0x474548]={'$like':'%'+_0x8cc7ef['query']['filter']+'%'};return _0xfad625;})});}_0x3d168d=_[_0x2c8f('0x51')]({},_0x3d168d,_0x8cc7ef['options']);return _0xffdd68['getConfigurations'](_0x3d168d);}})['then'](function(_0x382c79){if(_0x382c79){_0x2754e4=_0x382c79[_0x2c8f('0x40')];if(!_0x8cc7ef[_0x2c8f('0x3a')][_0x2c8f('0x41')](_0x2c8f('0x42'))){_0x3d168d[_0x2c8f('0x2a')]=qs[_0x2c8f('0x2a')](_0x8cc7ef[_0x2c8f('0x3a')][_0x2c8f('0x2a')]);_0x3d168d['offset']=qs[_0x2c8f('0x29')](_0x8cc7ef[_0x2c8f('0x3a')][_0x2c8f('0x29')]);}return _0xffdd68[_0x2c8f('0x55')](_0x3d168d);}})[_0x2c8f('0x1c')](function(_0xf47823){if(_0xf47823){return _0xf47823?{'count':_0x2754e4,'rows':_0xf47823}:null;}})[_0x2c8f('0x1c')](respondWithResult(_0x503677,null))['catch'](handleError(_0x503677,null));};exports[_0x2c8f('0x57')]=function(_0x40117b,_0x25a26e,_0x27d7d2){if(_0x40117b[_0x2c8f('0x54')]['id']){delete _0x40117b[_0x2c8f('0x54')]['id'];}return db['DeskAccount'][_0x2c8f('0x56')]({'where':{'id':_0x40117b[_0x2c8f('0x4f')]['id']}})[_0x2c8f('0x1c')](handleEntityNotFound(_0x25a26e,null))[_0x2c8f('0x1c')](function(_0x1a1308){if(_0x1a1308){_0x40117b[_0x2c8f('0x54')]['AccountId']=_0x1a1308['id'];_0x40117b[_0x2c8f('0x54')][_0x2c8f('0x58')]=integrations[_0x2c8f('0x59')](_0x40117b[_0x2c8f('0x54')]['channel'],_0x40117b[_0x2c8f('0x54')][_0x2c8f('0x36')]);_0x40117b[_0x2c8f('0x54')][_0x2c8f('0x5a')]=integrations[_0x2c8f('0x5b')](_0x40117b[_0x2c8f('0x54')][_0x2c8f('0x5c')],_0x40117b[_0x2c8f('0x54')][_0x2c8f('0x36')]);return db[_0x2c8f('0x5d')][_0x2c8f('0x53')](_0x40117b[_0x2c8f('0x54')],{'include':[{'model':db[_0x2c8f('0x5e')],'as':_0x2c8f('0x58')},{'model':db[_0x2c8f('0x5e')],'as':'Descriptions'}]});}return null;})[_0x2c8f('0x1c')](respondWithResult(_0x25a26e,null))['catch'](handleError(_0x25a26e,null));};exports['getFields']=function(_0x160a3e,_0x56069c,_0x52368c){var _0x1d69bf=[{'name':_0x2c8f('0x5f'),'label':_0x2c8f('0x5f'),'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 _0xce3c4b='';return db[_0x2c8f('0x35')][_0x2c8f('0x56')]({'where':{'id':_0x160a3e[_0x2c8f('0x4f')]['id']},'attributes':['id',_0x2c8f('0x60'),_0x2c8f('0x61'),_0x2c8f('0x62'),_0x2c8f('0x63'),_0x2c8f('0x64'),_0x2c8f('0x65'),_0x2c8f('0x66'),_0x2c8f('0x67')]})[_0x2c8f('0x1c')](handleEntityNotFound(_0x56069c,null))['then'](function(_0x2e5d8d){if(_0x2e5d8d){_0xce3c4b=_0x2e5d8d[_0x2c8f('0x60')];var _0x3f613b=_0xce3c4b[_0x2c8f('0x68')](-0x1);if(_0x3f613b==='/'){_0xce3c4b=_0xce3c4b[_0x2c8f('0x69')](0x0,_0xce3c4b[_0x2c8f('0x6a')](_0x3f613b));}var _0x37bd78={'method':_0x2c8f('0x6b'),'uri':util['format'](_0x2c8f('0x6c'),_0xce3c4b),'headers':{'Content-Type':_0x2c8f('0x6d'),'Accept':_0x2c8f('0x6d')},'json':!![]};if(_0x2e5d8d[_0x2c8f('0x61')]===_0x2c8f('0x6e')){_0x37bd78[_0x2c8f('0x6f')][_0x2c8f('0x70')]=util[_0x2c8f('0x71')](_0x2c8f('0x72'),new Buffer(util['format'](_0x2c8f('0x73'),_0x2e5d8d[_0x2c8f('0x62')],_0x2e5d8d[_0x2c8f('0x63')]))['toString'](_0x2c8f('0x74')));}return rp(_0x37bd78)[_0x2c8f('0x1c')](function(_0x486cc1){return _0x1d69bf[_0x2c8f('0x75')](_['map'](_0x486cc1[_0x2c8f('0x76')][_0x2c8f('0x77')],function(_0x5e42f5){return{'id':_0x5e42f5[_0x2c8f('0x32')],'name':_0x5e42f5[_0x2c8f('0x32')],'type':_0x5e42f5['type'],'active':_0x5e42f5[_0x2c8f('0x78')],'label':_0x5e42f5[_0x2c8f('0x79')],'custom':!![]};}));});}})['then'](function(_0x4f04a2){return{'count':_0x4f04a2['length'],'rows':_0x4f04a2};})[_0x2c8f('0x1c')](respondWithResult(_0x56069c,null))[_0x2c8f('0x4e')](function(_0x2e59a9){var _0xa4af75=_0x160a3e['query'][_0x2c8f('0x7a')]?0x1f4:_0x2e59a9[_0x2c8f('0x7b')]||0x1f4;logger[_0x2c8f('0x21')](_0x2c8f('0x7c'),_0x2c8f('0x7d'),_0xa4af75,JSON['stringify'](_0x2e59a9));delete _0x2e59a9['name'];if(_0xa4af75===0x191){_0xa4af75=0x190;}_0x56069c['status'](_0xa4af75)[_0x2c8f('0x33')](_0x160a3e[_0x2c8f('0x3a')][_0x2c8f('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x2e59a9[_0x2c8f('0x7b')]}:_0x2e59a9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 29a0a42..671e4f6 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 _0xa9f7=['./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','api','moment','request-promise','path','../../config/environment'];(function(_0x39216f,_0x4ff199){var _0x5c1b35=function(_0xeb6287){while(--_0xeb6287){_0x39216f['push'](_0x39216f['shift']());}};_0x5c1b35(++_0x4ff199);}(_0xa9f7,0x1d3));var _0x7a9f=function(_0x4dc9ef,_0x2ed804){_0x4dc9ef=_0x4dc9ef-0x0;var _0x24ee17=_0xa9f7[_0x4dc9ef];return _0x24ee17;};'use strict';var _=require(_0x7a9f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7a9f('0x1'));var moment=require(_0x7a9f('0x2'));var BPromise=require('bluebird');var rp=require(_0x7a9f('0x3'));var fs=require('fs');var path=require(_0x7a9f('0x4'));var rimraf=require('rimraf');var config=require(_0x7a9f('0x5'));var attributes=require(_0x7a9f('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7a9f('0x7')]=function(_0x53e910,_0x2164b0){return _0x53e910[_0x7a9f('0x8')](_0x7a9f('0x9'),attributes,{'tableName':_0x7a9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb59e=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','api','path','rimraf','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb59e,0xec));var _0xeb59=function(_0x1b5a7e,_0x4d5df6){_0x1b5a7e=_0x1b5a7e-0x0;var _0x7cd5d2=_0xb59e[_0x1b5a7e];return _0x7cd5d2;};'use strict';var _=require(_0xeb59('0x0'));var util=require(_0xeb59('0x1'));var logger=require('../../config/logger')(_0xeb59('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb59('0x3'));var rimraf=require(_0xeb59('0x4'));var config=require(_0xeb59('0x5'));var attributes=require(_0xeb59('0x6'));var integrations=require(_0xeb59('0x7'));module[_0xeb59('0x8')]=function(_0x5228d4,_0x298c79){return _0x5228d4[_0xeb59('0x9')](_0xeb59('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 78bb688..5a2493b 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 _0x23cd=['../../config/logger','../../config/environment','client','http','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowDeskAccount','find','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b7695,_0x139b46){var _0xae72fb=function(_0x97edf8){while(--_0x97edf8){_0x5b7695['push'](_0x5b7695['shift']());}};_0xae72fb(++_0x139b46);}(_0x23cd,0x165));var _0xd23c=function(_0x302bfc,_0x12c54c){_0x302bfc=_0x302bfc-0x0;var _0x4e127b=_0x23cd[_0x302bfc];return _0x4e127b;};'use strict';var _=require(_0xd23c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd23c('0x1'));var rs=require(_0xd23c('0x2'));var fs=require('fs');var Redis=require(_0xd23c('0x3'));var db=require(_0xd23c('0x4'))['db'];var utils=require(_0xd23c('0x5'));var logger=require(_0xd23c('0x6'))('rpc');var config=require(_0xd23c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd23c('0x8')][_0xd23c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5314b1,_0x2bd5fa,_0xe16efd){return new BPromise(function(_0x30fc95,_0x338279){return client['request'](_0x5314b1,_0xe16efd)['then'](function(_0x254248){logger['info'](_0xd23c('0xa'),_0x2bd5fa,_0xd23c('0xb'));logger[_0xd23c('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2bd5fa,'request\x20sent',JSON[_0xd23c('0xd')](_0x254248));if(_0x254248[_0xd23c('0xe')]){if(_0x254248[_0xd23c('0xe')][_0xd23c('0xf')]===0x1f4){logger[_0xd23c('0xe')](_0xd23c('0xa'),_0x2bd5fa,_0x254248[_0xd23c('0xe')][_0xd23c('0x10')]);return _0x338279(_0x254248[_0xd23c('0xe')][_0xd23c('0x10')]);}logger[_0xd23c('0xe')](_0xd23c('0xa'),_0x2bd5fa,_0x254248['error'][_0xd23c('0x10')]);return _0x30fc95(_0x254248['error'][_0xd23c('0x10')]);}else{logger[_0xd23c('0x11')](_0xd23c('0xa'),_0x2bd5fa,_0xd23c('0xb'));_0x30fc95(_0x254248[_0xd23c('0x12')]['message']);}})['catch'](function(_0x4a9d3f){logger[_0xd23c('0xe')](_0xd23c('0xa'),_0x2bd5fa,_0x4a9d3f);_0x338279(_0x4a9d3f);});});}exports[_0xd23c('0x13')]=function(_0x246bce){var _0x44922b=this;return new Promise(function(_0x412bbf,_0xd30cc9){return db[_0xd23c('0x14')][_0xd23c('0x15')]({'raw':_0x246bce[_0xd23c('0x16')]?_0x246bce[_0xd23c('0x16')][_0xd23c('0x17')]===undefined?!![]:![]:!![],'where':_0x246bce['options']?_0x246bce[_0xd23c('0x16')][_0xd23c('0x18')]||null:null,'attributes':_0x246bce[_0xd23c('0x16')]?_0x246bce['options'][_0xd23c('0x19')]||null:null,'limit':_0x246bce['options']?_0x246bce['options']['limit']||null:null,'include':_0x246bce[_0xd23c('0x16')]?_0x246bce[_0xd23c('0x16')][_0xd23c('0x1a')]?_[_0xd23c('0x1b')](_0x246bce['options'][_0xd23c('0x1a')],function(_0x4dd93b){return{'model':db[_0x4dd93b['model']],'as':_0x4dd93b['as'],'attributes':_0x4dd93b[_0xd23c('0x19')],'include':_0x4dd93b[_0xd23c('0x1a')]?_[_0xd23c('0x1b')](_0x4dd93b['include'],function(_0x3b1994){return{'model':db[_0x3b1994[_0xd23c('0x1c')]],'as':_0x3b1994['as'],'attributes':_0x3b1994['attributes'],'include':_0x3b1994['include']?_['map'](_0x3b1994[_0xd23c('0x1a')],function(_0x84256f){return{'model':db[_0x84256f[_0xd23c('0x1c')]],'as':_0x84256f['as'],'attributes':_0x84256f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36ca51){logger['info'](_0xd23c('0x13'),_0x246bce);logger[_0xd23c('0xc')](_0xd23c('0x13'),_0x246bce,JSON[_0xd23c('0xd')](_0x36ca51));_0x412bbf(_0x36ca51);})[_0xd23c('0x1d')](function(_0x3a4a13){logger[_0xd23c('0xe')](_0xd23c('0x13'),_0x3a4a13[_0xd23c('0x10')],_0x246bce);_0xd30cc9(_0x44922b[_0xd23c('0xe')](0x1f4,_0x3a4a13[_0xd23c('0x10')]));});});};exports[_0xd23c('0x1e')]=function(_0xa817b8){var _0x4d3cda=this;return new Promise(function(_0x2f78e6,_0x3cb090){return db['DeskAccount'][_0xd23c('0x1f')]({'raw':_0xa817b8[_0xd23c('0x16')]?_0xa817b8[_0xd23c('0x16')][_0xd23c('0x17')]===undefined?!![]:![]:!![],'where':_0xa817b8[_0xd23c('0x16')]?_0xa817b8['options'][_0xd23c('0x18')]||null:null,'attributes':_0xa817b8['options']?_0xa817b8[_0xd23c('0x16')][_0xd23c('0x19')]||null:null,'include':_0xa817b8[_0xd23c('0x16')]?_0xa817b8[_0xd23c('0x16')]['include']?_[_0xd23c('0x1b')](_0xa817b8[_0xd23c('0x16')]['include'],function(_0x28a96d){return{'model':db[_0x28a96d[_0xd23c('0x1c')]],'as':_0x28a96d['as'],'attributes':_0x28a96d[_0xd23c('0x19')],'include':_0x28a96d[_0xd23c('0x1a')]?_[_0xd23c('0x1b')](_0x28a96d['include'],function(_0x499247){return{'model':db[_0x499247['model']],'as':_0x499247['as'],'attributes':_0x499247['attributes'],'include':_0x499247[_0xd23c('0x1a')]?_[_0xd23c('0x1b')](_0x499247['include'],function(_0x1b047b){return{'model':db[_0x1b047b[_0xd23c('0x1c')]],'as':_0x1b047b['as'],'attributes':_0x1b047b[_0xd23c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd23c('0x20')](function(_0x545ba1){logger[_0xd23c('0x11')](_0xd23c('0x1e'),_0xa817b8);logger[_0xd23c('0xc')](_0xd23c('0x1e'),_0xa817b8,JSON[_0xd23c('0xd')](_0x545ba1));_0x2f78e6(_0x545ba1);})['catch'](function(_0x59f854){logger['error'](_0xd23c('0x1e'),_0x59f854[_0xd23c('0x10')],_0xa817b8);_0x3cb090(_0x4d3cda[_0xd23c('0xe')](0x1f4,_0x59f854[_0xd23c('0x10')]));});});}; \ No newline at end of file +var _0x57d7=['options','where','attributes','map','include','model','GetDeskAccount','catch','ShowDeskAccount','find','raw','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','DeskAccount','findAll'];(function(_0x43984c,_0x503c86){var _0x1a8df6=function(_0x208fea){while(--_0x208fea){_0x43984c['push'](_0x43984c['shift']());}};_0x1a8df6(++_0x503c86);}(_0x57d7,0xab));var _0x757d=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x57d7[_0x246148];return _0x453d94;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x757d('0x0'));var fs=require('fs');var Redis=require(_0x757d('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x757d('0x2'));var logger=require(_0x757d('0x3'))(_0x757d('0x4'));var config=require(_0x757d('0x5'));var jayson=require(_0x757d('0x6'));var client=jayson[_0x757d('0x7')][_0x757d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d330,_0x34a75a,_0x54c1ff){return new BPromise(function(_0x36ed69,_0xa07afb){return client['request'](_0x42d330,_0x54c1ff)[_0x757d('0x9')](function(_0x52a848){logger[_0x757d('0xa')](_0x757d('0xb'),_0x34a75a,_0x757d('0xc'));logger[_0x757d('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x34a75a,'request\x20sent',JSON[_0x757d('0xe')](_0x52a848));if(_0x52a848['error']){if(_0x52a848[_0x757d('0xf')][_0x757d('0x10')]===0x1f4){logger[_0x757d('0xf')](_0x757d('0xb'),_0x34a75a,_0x52a848[_0x757d('0xf')][_0x757d('0x11')]);return _0xa07afb(_0x52a848[_0x757d('0xf')][_0x757d('0x11')]);}logger[_0x757d('0xf')]('DeskAccount,\x20%s,\x20%s',_0x34a75a,_0x52a848[_0x757d('0xf')][_0x757d('0x11')]);return _0x36ed69(_0x52a848['error']['message']);}else{logger[_0x757d('0xa')](_0x757d('0xb'),_0x34a75a,_0x757d('0xc'));_0x36ed69(_0x52a848[_0x757d('0x12')][_0x757d('0x11')]);}})['catch'](function(_0x1ce727){logger[_0x757d('0xf')](_0x757d('0xb'),_0x34a75a,_0x1ce727);_0xa07afb(_0x1ce727);});});}exports['GetDeskAccount']=function(_0x16a043){var _0xc4ebf5=this;return new Promise(function(_0x456bb0,_0x5d187a){return db[_0x757d('0x13')][_0x757d('0x14')]({'raw':_0x16a043[_0x757d('0x15')]?_0x16a043[_0x757d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x16a043[_0x757d('0x15')]?_0x16a043['options'][_0x757d('0x16')]||null:null,'attributes':_0x16a043[_0x757d('0x15')]?_0x16a043[_0x757d('0x15')][_0x757d('0x17')]||null:null,'limit':_0x16a043['options']?_0x16a043[_0x757d('0x15')]['limit']||null:null,'include':_0x16a043['options']?_0x16a043['options']['include']?_['map'](_0x16a043[_0x757d('0x15')]['include'],function(_0x56db0e){return{'model':db[_0x56db0e['model']],'as':_0x56db0e['as'],'attributes':_0x56db0e[_0x757d('0x17')],'include':_0x56db0e['include']?_[_0x757d('0x18')](_0x56db0e[_0x757d('0x19')],function(_0x101f4e){return{'model':db[_0x101f4e[_0x757d('0x1a')]],'as':_0x101f4e['as'],'attributes':_0x101f4e[_0x757d('0x17')],'include':_0x101f4e['include']?_[_0x757d('0x18')](_0x101f4e['include'],function(_0x1f8930){return{'model':db[_0x1f8930[_0x757d('0x1a')]],'as':_0x1f8930['as'],'attributes':_0x1f8930[_0x757d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x757d('0x9')](function(_0x1ad626){logger[_0x757d('0xa')]('GetDeskAccount',_0x16a043);logger['debug'](_0x757d('0x1b'),_0x16a043,JSON[_0x757d('0xe')](_0x1ad626));_0x456bb0(_0x1ad626);})[_0x757d('0x1c')](function(_0x2e93f8){logger['error']('GetDeskAccount',_0x2e93f8['message'],_0x16a043);_0x5d187a(_0xc4ebf5['error'](0x1f4,_0x2e93f8[_0x757d('0x11')]));});});};exports[_0x757d('0x1d')]=function(_0x39a07c){var _0xbfdf63=this;return new Promise(function(_0x41dd9a,_0x40e836){return db[_0x757d('0x13')][_0x757d('0x1e')]({'raw':_0x39a07c['options']?_0x39a07c[_0x757d('0x15')][_0x757d('0x1f')]===undefined?!![]:![]:!![],'where':_0x39a07c[_0x757d('0x15')]?_0x39a07c[_0x757d('0x15')][_0x757d('0x16')]||null:null,'attributes':_0x39a07c[_0x757d('0x15')]?_0x39a07c[_0x757d('0x15')][_0x757d('0x17')]||null:null,'include':_0x39a07c[_0x757d('0x15')]?_0x39a07c[_0x757d('0x15')]['include']?_[_0x757d('0x18')](_0x39a07c['options'][_0x757d('0x19')],function(_0x15c404){return{'model':db[_0x15c404[_0x757d('0x1a')]],'as':_0x15c404['as'],'attributes':_0x15c404['attributes'],'include':_0x15c404['include']?_['map'](_0x15c404[_0x757d('0x19')],function(_0x4be465){return{'model':db[_0x4be465[_0x757d('0x1a')]],'as':_0x4be465['as'],'attributes':_0x4be465[_0x757d('0x17')],'include':_0x4be465[_0x757d('0x19')]?_['map'](_0x4be465[_0x757d('0x19')],function(_0x557856){return{'model':db[_0x557856[_0x757d('0x1a')]],'as':_0x557856['as'],'attributes':_0x557856['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aca07){logger[_0x757d('0xa')](_0x757d('0x1d'),_0x39a07c);logger[_0x757d('0xd')](_0x757d('0x1d'),_0x39a07c,JSON[_0x757d('0xe')](_0x4aca07));_0x41dd9a(_0x4aca07);})['catch'](function(_0x295d3e){logger['error'](_0x757d('0x1d'),_0x295d3e[_0x757d('0x11')],_0x39a07c);_0x40e836(_0xbfdf63[_0x757d('0xf')](0x1f4,_0x295d3e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index da0d7e9..847dd20 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 _0xc43c=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','multer','util','path','../../components/auth/service','get','isAuthenticated','index','/:id'];(function(_0x29e06b,_0x176600){var _0x584b01=function(_0x2cd72d){while(--_0x2cd72d){_0x29e06b['push'](_0x29e06b['shift']());}};_0x584b01(++_0x176600);}(_0xc43c,0xd4));var _0xcc43=function(_0x19e91a,_0x52ced9){_0x19e91a=_0x19e91a-0x0;var _0x563b4a=_0xc43c[_0x19e91a];return _0x563b4a;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xcc43('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0xcc43('0x4')]('/',auth[_0xcc43('0x5')](),controller[_0xcc43('0x6')]);router['get'](_0xcc43('0x7'),auth[_0xcc43('0x5')](),controller[_0xcc43('0x8')]);router[_0xcc43('0x4')](_0xcc43('0x9'),auth[_0xcc43('0x5')](),controller[_0xcc43('0xa')]);router[_0xcc43('0x4')]('/:id/subjects',auth[_0xcc43('0x5')](),controller[_0xcc43('0xb')]);router[_0xcc43('0x4')](_0xcc43('0xc'),auth[_0xcc43('0x5')](),controller[_0xcc43('0xd')]);router[_0xcc43('0x4')](_0xcc43('0xe'),auth[_0xcc43('0x5')](),controller[_0xcc43('0xf')]);router[_0xcc43('0x10')]('/',auth['isAuthenticated'](),controller[_0xcc43('0x11')]);router[_0xcc43('0x10')](_0xcc43('0xe'),auth[_0xcc43('0x5')](),controller['setTags']);router[_0xcc43('0x12')](_0xcc43('0x7'),auth[_0xcc43('0x5')](),controller[_0xcc43('0x13')]);router[_0xcc43('0x14')]('/:id',auth[_0xcc43('0x5')](),controller[_0xcc43('0x15')]);module['exports']=router; \ No newline at end of file +var _0x22b4=['/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x22b4,0x8b));var _0x422b=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x22b4[_0x220f3f];return _0x1f170e;};'use strict';var multer=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var path=require(_0x422b('0x2'));var timeout=require(_0x422b('0x3'));var express=require(_0x422b('0x4'));var router=express[_0x422b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x422b('0x6'));var config=require(_0x422b('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x422b('0x8')]('/',auth[_0x422b('0x9')](),controller[_0x422b('0xa')]);router[_0x422b('0x8')](_0x422b('0xb'),auth[_0x422b('0x9')](),controller['show']);router[_0x422b('0x8')]('/:id/fields',auth[_0x422b('0x9')](),controller[_0x422b('0xc')]);router[_0x422b('0x8')](_0x422b('0xd'),auth[_0x422b('0x9')](),controller[_0x422b('0xe')]);router['get'](_0x422b('0xf'),auth[_0x422b('0x9')](),controller[_0x422b('0x10')]);router[_0x422b('0x8')](_0x422b('0x11'),auth[_0x422b('0x9')](),controller[_0x422b('0x12')]);router[_0x422b('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x422b('0x13')](_0x422b('0x11'),auth[_0x422b('0x9')](),controller[_0x422b('0x14')]);router[_0x422b('0x15')](_0x422b('0xb'),auth[_0x422b('0x9')](),controller[_0x422b('0x16')]);router['delete'](_0x422b('0xb'),auth['isAuthenticated'](),controller[_0x422b('0x17')]);module[_0x422b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7f94faa..f7716e6 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 _0x5839=['STRING','sequelize'];(function(_0xc01396,_0x371258){var _0xdc047e=function(_0x2bf936){while(--_0x2bf936){_0xc01396['push'](_0xc01396['shift']());}};_0xdc047e(++_0x371258);}(_0x5839,0xef));var _0x9583=function(_0x48eaa7,_0x11e271){_0x48eaa7=_0x48eaa7-0x0;var _0x25bf3e=_0x5839[_0x48eaa7];return _0x25bf3e;};'use strict';var Sequelize=require(_0x9583('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9583('0x1')]}}; \ No newline at end of file +var _0xc7c8=['STRING','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc7c8,0x1bd));var _0x8c7c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc7c8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x8c7c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c7c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7b83e26..00b795d 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 _0xaaa7=['include','rows','show','params','attributes','includeAll','options','create','body','update','find','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','order','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','DeskConfiguration'];(function(_0x139790,_0x466283){var _0x23d99d=function(_0x1463c2){while(--_0x1463c2){_0x139790['push'](_0x139790['shift']());}};_0x23d99d(++_0x466283);}(_0xaaa7,0x192));var _0x7aaa=function(_0x331193,_0x4646aa){_0x331193=_0x331193-0x0;var _0x4ba8bb=_0xaaa7[_0x331193];return _0x4ba8bb;};'use strict';var pdf=require(_0x7aaa('0x0'));var emlformat=require(_0x7aaa('0x1'));var rimraf=require(_0x7aaa('0x2'));var zipdir=require(_0x7aaa('0x3'));var jsonpatch=require(_0x7aaa('0x4'));var rp=require(_0x7aaa('0x5'));var moment=require(_0x7aaa('0x6'));var BPromise=require(_0x7aaa('0x7'));var Mustache=require(_0x7aaa('0x8'));var util=require(_0x7aaa('0x9'));var path=require(_0x7aaa('0xa'));var sox=require(_0x7aaa('0xb'));var csv=require('to-csv');var ejs=require(_0x7aaa('0xc'));var fs=require('fs');var _=require(_0x7aaa('0xd'));var squel=require(_0x7aaa('0xe'));var crypto=require(_0x7aaa('0xf'));var jsforce=require(_0x7aaa('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7aaa('0x11'));var querystring=require(_0x7aaa('0x12'));var Papa=require('papaparse');var Redis=require(_0x7aaa('0x13'));var authService=require(_0x7aaa('0x14'));var qs=require(_0x7aaa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7aaa('0x16'))(_0x7aaa('0x17'));var utils=require(_0x7aaa('0x18'));var config=require(_0x7aaa('0x19'));var licenseUtil=require(_0x7aaa('0x1a'));var db=require(_0x7aaa('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x483e84,_0x492f27,_0x1b029a,_0x3a3e8e){return new BPromise(function(_0x3ca3c0,_0x3c228d){var _0x45498d=_0x3a3e8e||client;return _0x45498d[_0x7aaa('0x1c')](_0x483e84,_0x1b029a)[_0x7aaa('0x1d')](function(_0x1083b3){logger[_0x7aaa('0x1e')](_0x7aaa('0x1f'),_0x492f27,_0x7aaa('0x20'));logger['debug'](_0x7aaa('0x21'),_0x492f27,_0x7aaa('0x20'),JSON['stringify'](_0x1083b3));if(_0x1083b3[_0x7aaa('0x22')]){if(_0x1083b3[_0x7aaa('0x22')]['code']===0x1f4){logger[_0x7aaa('0x22')](_0x7aaa('0x1f'),_0x492f27,_0x1083b3[_0x7aaa('0x22')][_0x7aaa('0x23')]);return _0x3c228d(_0x1083b3[_0x7aaa('0x22')][_0x7aaa('0x23')]);}logger[_0x7aaa('0x22')](_0x7aaa('0x1f'),_0x492f27,_0x1083b3['error'][_0x7aaa('0x23')]);return _0x3ca3c0(_0x1083b3[_0x7aaa('0x22')][_0x7aaa('0x23')]);}else{logger[_0x7aaa('0x1e')](_0x7aaa('0x1f'),_0x492f27,_0x7aaa('0x20'));_0x3ca3c0(_0x1083b3[_0x7aaa('0x24')][_0x7aaa('0x23')]);}})[_0x7aaa('0x25')](function(_0x201481){logger[_0x7aaa('0x22')](_0x7aaa('0x1f'),_0x492f27,_0x201481);_0x3c228d(_0x201481);});});}function respondWithStatusCode(_0x2cf011,_0xec1afe){_0xec1afe=_0xec1afe||0xcc;return function(_0x36a839){if(_0x36a839){return _0x2cf011[_0x7aaa('0x26')](_0xec1afe);}return _0x2cf011[_0x7aaa('0x27')](_0xec1afe)[_0x7aaa('0x28')]();};}function respondWithResult(_0x585382,_0x3329c7){_0x3329c7=_0x3329c7||0xc8;return function(_0x290870){if(_0x290870){return _0x585382['status'](_0x3329c7)[_0x7aaa('0x29')](_0x290870);}};}function respondWithFilteredResult(_0x573acb,_0x4b4190){return function(_0x379f7c){if(_0x379f7c){var _0x148596=_0x379f7c[_0x7aaa('0x2a')],_0x5657d8=_0x4b4190[_0x7aaa('0x2b')],_0x97c7a6=_0x4b4190['offset']+_0x4b4190[_0x7aaa('0x2c')],_0x2acff5;if(_0x97c7a6>=_0x148596){_0x97c7a6=_0x148596;_0x2acff5=0xc8;}else{_0x2acff5=0xce;}_0x573acb['status'](_0x2acff5);return _0x573acb[_0x7aaa('0x2d')]('Content-Range',_0x5657d8+'-'+_0x97c7a6+'/'+_0x148596)[_0x7aaa('0x29')](_0x379f7c);}return null;};}function patchUpdates(_0x26e0fe){return function(_0x9442b0){try{jsonpatch['apply'](_0x9442b0,_0x26e0fe,!![]);}catch(_0x2dadd1){return BPromise[_0x7aaa('0x2e')](_0x2dadd1);}return _0x9442b0[_0x7aaa('0x2f')]();};}function saveUpdates(_0x42e2c4,_0x314469){return function(_0x48b87d){if(_0x48b87d){return _0x48b87d['update'](_0x42e2c4)[_0x7aaa('0x1d')](function(_0xcac06e){return _0xcac06e;});}return null;};}function removeEntity(_0x5b239c,_0x12051e){return function(_0xc19d8b){if(_0xc19d8b){return _0xc19d8b['destroy']()['then'](function(){_0x5b239c[_0x7aaa('0x27')](0xcc)[_0x7aaa('0x28')]();});}};}function handleEntityNotFound(_0x51f0b1,_0x47d913){return function(_0x3f79bc){if(!_0x3f79bc){_0x51f0b1['sendStatus'](0x194);}return _0x3f79bc;};}function handleError(_0x853c06,_0x550cdd){_0x550cdd=_0x550cdd||0x1f4;return function(_0x2e006b){logger[_0x7aaa('0x22')](_0x2e006b[_0x7aaa('0x30')]);if(_0x2e006b[_0x7aaa('0x31')]){delete _0x2e006b['name'];}_0x853c06[_0x7aaa('0x27')](_0x550cdd)[_0x7aaa('0x32')](_0x2e006b);};}exports[_0x7aaa('0x33')]=function(_0x4bfae5,_0x12e4c2){var _0xe86564={},_0x2d8611={},_0x2f5dba={'count':0x0,'rows':[]};var _0xcec735=_['map'](db['DeskConfiguration'][_0x7aaa('0x34')],function(_0x2113b8){return{'name':_0x2113b8[_0x7aaa('0x35')],'type':_0x2113b8[_0x7aaa('0x36')][_0x7aaa('0x37')]};});_0x2d8611[_0x7aaa('0x38')]=_[_0x7aaa('0x39')](_0xcec735,_0x7aaa('0x31'));_0x2d8611[_0x7aaa('0x3a')]=_[_0x7aaa('0x3b')](_0x4bfae5[_0x7aaa('0x3a')]);_0x2d8611[_0x7aaa('0x3c')]=_[_0x7aaa('0x3d')](_0x2d8611[_0x7aaa('0x38')],_0x2d8611[_0x7aaa('0x3a')]);_0xe86564['attributes']=_[_0x7aaa('0x3d')](_0x2d8611[_0x7aaa('0x38')],qs['fields'](_0x4bfae5[_0x7aaa('0x3a')][_0x7aaa('0x3e')]));_0xe86564['attributes']=_0xe86564['attributes'][_0x7aaa('0x3f')]?_0xe86564['attributes']:_0x2d8611[_0x7aaa('0x38')];if(!_0x4bfae5[_0x7aaa('0x3a')][_0x7aaa('0x40')](_0x7aaa('0x41'))){_0xe86564[_0x7aaa('0x2c')]=qs[_0x7aaa('0x2c')](_0x4bfae5[_0x7aaa('0x3a')]['limit']);_0xe86564['offset']=qs['offset'](_0x4bfae5[_0x7aaa('0x3a')][_0x7aaa('0x2b')]);}_0xe86564['order']=qs[_0x7aaa('0x42')](_0x4bfae5[_0x7aaa('0x3a')][_0x7aaa('0x42')]);_0xe86564[_0x7aaa('0x43')]=qs[_0x7aaa('0x3c')](_[_0x7aaa('0x44')](_0x4bfae5[_0x7aaa('0x3a')],_0x2d8611['filters']),_0xcec735);if(_0x4bfae5['query'][_0x7aaa('0x45')]){_0xe86564[_0x7aaa('0x43')]=_[_0x7aaa('0x46')](_0xe86564[_0x7aaa('0x43')],{'$or':_[_0x7aaa('0x39')](_0xcec735,function(_0x19d3bf){if(_0x19d3bf[_0x7aaa('0x36')]!==_0x7aaa('0x47')){var _0x1edf96={};_0x1edf96[_0x19d3bf['name']]={'$like':'%'+_0x4bfae5[_0x7aaa('0x3a')]['filter']+'%'};return _0x1edf96;}})});}_0xe86564=_[_0x7aaa('0x46')]({},_0xe86564,_0x4bfae5['options']);var _0x17b96e={'where':_0xe86564[_0x7aaa('0x43')]};return db[_0x7aaa('0x48')][_0x7aaa('0x2a')](_0x17b96e)[_0x7aaa('0x1d')](function(_0x301444){_0x2f5dba['count']=_0x301444;if(_0x4bfae5['query']['includeAll']){_0xe86564[_0x7aaa('0x49')]=[{'all':!![]}];}return db[_0x7aaa('0x48')]['findAll'](_0xe86564);})['then'](function(_0x5966fa){_0x2f5dba[_0x7aaa('0x4a')]=_0x5966fa;return _0x2f5dba;})[_0x7aaa('0x1d')](respondWithFilteredResult(_0x12e4c2,_0xe86564))['catch'](handleError(_0x12e4c2,null));};exports[_0x7aaa('0x4b')]=function(_0x516954,_0x100809){var _0x325308={'raw':![],'where':{'id':_0x516954[_0x7aaa('0x4c')]['id']}},_0x5286db={};_0x5286db[_0x7aaa('0x38')]=_[_0x7aaa('0x3b')](db[_0x7aaa('0x48')][_0x7aaa('0x34')]);_0x5286db[_0x7aaa('0x3a')]=_[_0x7aaa('0x3b')](_0x516954[_0x7aaa('0x3a')]);_0x5286db['filters']=_['intersection'](_0x5286db['model'],_0x5286db['query']);_0x325308[_0x7aaa('0x4d')]=_[_0x7aaa('0x3d')](_0x5286db[_0x7aaa('0x38')],qs[_0x7aaa('0x3e')](_0x516954[_0x7aaa('0x3a')][_0x7aaa('0x3e')]));_0x325308[_0x7aaa('0x4d')]=_0x325308[_0x7aaa('0x4d')][_0x7aaa('0x3f')]?_0x325308[_0x7aaa('0x4d')]:_0x5286db[_0x7aaa('0x38')];if(_0x516954[_0x7aaa('0x3a')][_0x7aaa('0x4e')]){_0x325308['include']=[{'all':!![]}];}_0x325308=_[_0x7aaa('0x46')]({},_0x325308,_0x516954[_0x7aaa('0x4f')]);return db['DeskConfiguration']['find'](_0x325308)['then'](handleEntityNotFound(_0x100809,null))[_0x7aaa('0x1d')](respondWithResult(_0x100809,null))['catch'](handleError(_0x100809,null));};exports[_0x7aaa('0x50')]=function(_0x24402c,_0x4ea5ab){return db[_0x7aaa('0x48')][_0x7aaa('0x50')](_0x24402c[_0x7aaa('0x51')],{})[_0x7aaa('0x1d')](respondWithResult(_0x4ea5ab,0xc9))[_0x7aaa('0x25')](handleError(_0x4ea5ab,null));};exports[_0x7aaa('0x52')]=function(_0x147c93,_0x2939ec){if(_0x147c93[_0x7aaa('0x51')]['id']){delete _0x147c93[_0x7aaa('0x51')]['id'];}return db[_0x7aaa('0x48')][_0x7aaa('0x53')]({'where':{'id':_0x147c93[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x2939ec,null))[_0x7aaa('0x1d')](saveUpdates(_0x147c93[_0x7aaa('0x51')],null))['then'](respondWithResult(_0x2939ec,null))[_0x7aaa('0x25')](handleError(_0x2939ec,null));};exports[_0x7aaa('0x54')]=function(_0x1ad3f5,_0x360d8c){return db['DeskConfiguration'][_0x7aaa('0x53')]({'where':{'id':_0x1ad3f5[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x360d8c,null))[_0x7aaa('0x1d')](removeEntity(_0x360d8c,null))[_0x7aaa('0x25')](handleError(_0x360d8c,null));};exports[_0x7aaa('0x55')]=function(_0x358b96,_0x196d5f,_0xbe7ed5){var _0x58e542={};var _0x3a7b1a={};var _0x381069;var _0x3a0df5;return db['DeskConfiguration'][_0x7aaa('0x56')]({'where':{'id':_0x358b96[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x196d5f,null))['then'](function(_0x5d9098){if(_0x5d9098){_0x381069=_0x5d9098;_0x3a7b1a[_0x7aaa('0x38')]=_[_0x7aaa('0x3b')](db[_0x7aaa('0x57')]['rawAttributes']);_0x3a7b1a[_0x7aaa('0x3a')]=_['keys'](_0x358b96[_0x7aaa('0x3a')]);_0x3a7b1a[_0x7aaa('0x3c')]=_[_0x7aaa('0x3d')](_0x3a7b1a[_0x7aaa('0x38')],_0x3a7b1a[_0x7aaa('0x3a')]);_0x58e542[_0x7aaa('0x4d')]=_[_0x7aaa('0x3d')](_0x3a7b1a[_0x7aaa('0x38')],qs['fields'](_0x358b96[_0x7aaa('0x3a')][_0x7aaa('0x3e')]));_0x58e542[_0x7aaa('0x4d')]=_0x58e542[_0x7aaa('0x4d')]['length']?_0x58e542['attributes']:_0x3a7b1a[_0x7aaa('0x38')];_0x58e542['order']=qs[_0x7aaa('0x42')](_0x358b96[_0x7aaa('0x3a')][_0x7aaa('0x42')]);_0x58e542[_0x7aaa('0x43')]=qs[_0x7aaa('0x3c')](_[_0x7aaa('0x44')](_0x358b96[_0x7aaa('0x3a')],_0x3a7b1a[_0x7aaa('0x3c')]));if(_0x358b96['query'][_0x7aaa('0x45')]){_0x58e542[_0x7aaa('0x43')]=_[_0x7aaa('0x46')](_0x58e542['where'],{'$or':_['map'](_0x58e542[_0x7aaa('0x4d')],function(_0x2052f3){var _0x343148={};_0x343148[_0x2052f3]={'$like':'%'+_0x358b96[_0x7aaa('0x3a')][_0x7aaa('0x45')]+'%'};return _0x343148;})});}_0x58e542=_[_0x7aaa('0x46')]({},_0x58e542,_0x358b96[_0x7aaa('0x4f')]);return _0x381069[_0x7aaa('0x55')](_0x58e542);}})[_0x7aaa('0x1d')](function(_0x2bb73d){if(_0x2bb73d){_0x3a0df5=_0x2bb73d[_0x7aaa('0x3f')];if(!_0x358b96[_0x7aaa('0x3a')][_0x7aaa('0x40')](_0x7aaa('0x41'))){_0x58e542[_0x7aaa('0x2c')]=qs['limit'](_0x358b96['query'][_0x7aaa('0x2c')]);_0x58e542[_0x7aaa('0x2b')]=qs[_0x7aaa('0x2b')](_0x358b96[_0x7aaa('0x3a')][_0x7aaa('0x2b')]);}return _0x381069[_0x7aaa('0x55')](_0x58e542);}})[_0x7aaa('0x1d')](function(_0x521ee1){if(_0x521ee1){return _0x521ee1?{'count':_0x3a0df5,'rows':_0x521ee1}:null;}})[_0x7aaa('0x1d')](respondWithResult(_0x196d5f,null))['catch'](handleError(_0x196d5f,null));};exports[_0x7aaa('0x58')]=function(_0x3d6285,_0x219183,_0x41958c){var _0x54663e={};var _0x280edb={};var _0xd887ce;var _0xb4467;return db[_0x7aaa('0x48')][_0x7aaa('0x56')]({'where':{'id':_0x3d6285[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x219183,null))[_0x7aaa('0x1d')](function(_0x526e12){if(_0x526e12){_0xd887ce=_0x526e12;_0x280edb['model']=_[_0x7aaa('0x3b')](db['DeskField'][_0x7aaa('0x34')]);_0x280edb[_0x7aaa('0x3a')]=_[_0x7aaa('0x3b')](_0x3d6285[_0x7aaa('0x3a')]);_0x280edb[_0x7aaa('0x3c')]=_['intersection'](_0x280edb['model'],_0x280edb['query']);_0x54663e[_0x7aaa('0x4d')]=_[_0x7aaa('0x3d')](_0x280edb[_0x7aaa('0x38')],qs[_0x7aaa('0x3e')](_0x3d6285[_0x7aaa('0x3a')]['fields']));_0x54663e['attributes']=_0x54663e['attributes'][_0x7aaa('0x3f')]?_0x54663e[_0x7aaa('0x4d')]:_0x280edb[_0x7aaa('0x38')];_0x54663e['order']=qs[_0x7aaa('0x42')](_0x3d6285['query'][_0x7aaa('0x42')]);_0x54663e[_0x7aaa('0x43')]=qs[_0x7aaa('0x3c')](_[_0x7aaa('0x44')](_0x3d6285['query'],_0x280edb[_0x7aaa('0x3c')]));if(_0x3d6285['query'][_0x7aaa('0x45')]){_0x54663e[_0x7aaa('0x43')]=_[_0x7aaa('0x46')](_0x54663e['where'],{'$or':_[_0x7aaa('0x39')](_0x54663e[_0x7aaa('0x4d')],function(_0x13ed37){var _0x49e3b0={};_0x49e3b0[_0x13ed37]={'$like':'%'+_0x3d6285['query'][_0x7aaa('0x45')]+'%'};return _0x49e3b0;})});}_0x54663e=_['merge']({},_0x54663e,_0x3d6285[_0x7aaa('0x4f')]);return _0xd887ce[_0x7aaa('0x58')](_0x54663e);}})['then'](function(_0x58b11f){if(_0x58b11f){_0xb4467=_0x58b11f[_0x7aaa('0x3f')];if(!_0x3d6285['query'][_0x7aaa('0x40')]('nolimit')){_0x54663e[_0x7aaa('0x2c')]=qs[_0x7aaa('0x2c')](_0x3d6285[_0x7aaa('0x3a')][_0x7aaa('0x2c')]);_0x54663e[_0x7aaa('0x2b')]=qs[_0x7aaa('0x2b')](_0x3d6285[_0x7aaa('0x3a')][_0x7aaa('0x2b')]);}return _0xd887ce[_0x7aaa('0x58')](_0x54663e);}})[_0x7aaa('0x1d')](function(_0x5c44d0){if(_0x5c44d0){return _0x5c44d0?{'count':_0xb4467,'rows':_0x5c44d0}:null;}})['then'](respondWithResult(_0x219183,null))[_0x7aaa('0x25')](handleError(_0x219183,null));};exports['getDescriptions']=function(_0x4eb05d,_0x1dc700,_0x3b3ebf){var _0x70c485={};var _0x7a2754={};var _0x4aed08;var _0x1941cd;return db[_0x7aaa('0x48')]['findOne']({'where':{'id':_0x4eb05d[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x1dc700,null))['then'](function(_0x5378d6){if(_0x5378d6){_0x4aed08=_0x5378d6;_0x7a2754[_0x7aaa('0x38')]=_[_0x7aaa('0x3b')](db['DeskField'][_0x7aaa('0x34')]);_0x7a2754[_0x7aaa('0x3a')]=_[_0x7aaa('0x3b')](_0x4eb05d['query']);_0x7a2754[_0x7aaa('0x3c')]=_[_0x7aaa('0x3d')](_0x7a2754[_0x7aaa('0x38')],_0x7a2754[_0x7aaa('0x3a')]);_0x70c485[_0x7aaa('0x4d')]=_['intersection'](_0x7a2754['model'],qs[_0x7aaa('0x3e')](_0x4eb05d[_0x7aaa('0x3a')][_0x7aaa('0x3e')]));_0x70c485[_0x7aaa('0x4d')]=_0x70c485[_0x7aaa('0x4d')][_0x7aaa('0x3f')]?_0x70c485[_0x7aaa('0x4d')]:_0x7a2754[_0x7aaa('0x38')];_0x70c485['order']=qs[_0x7aaa('0x42')](_0x4eb05d[_0x7aaa('0x3a')][_0x7aaa('0x42')]);_0x70c485[_0x7aaa('0x43')]=qs[_0x7aaa('0x3c')](_[_0x7aaa('0x44')](_0x4eb05d[_0x7aaa('0x3a')],_0x7a2754[_0x7aaa('0x3c')]));if(_0x4eb05d[_0x7aaa('0x3a')][_0x7aaa('0x45')]){_0x70c485[_0x7aaa('0x43')]=_[_0x7aaa('0x46')](_0x70c485['where'],{'$or':_[_0x7aaa('0x39')](_0x70c485['attributes'],function(_0x6a8504){var _0x56db02={};_0x56db02[_0x6a8504]={'$like':'%'+_0x4eb05d[_0x7aaa('0x3a')][_0x7aaa('0x45')]+'%'};return _0x56db02;})});}_0x70c485=_['merge']({},_0x70c485,_0x4eb05d[_0x7aaa('0x4f')]);return _0x4aed08[_0x7aaa('0x59')](_0x70c485);}})[_0x7aaa('0x1d')](function(_0x5da0dd){if(_0x5da0dd){_0x1941cd=_0x5da0dd[_0x7aaa('0x3f')];if(!_0x4eb05d['query'][_0x7aaa('0x40')]('nolimit')){_0x70c485[_0x7aaa('0x2c')]=qs['limit'](_0x4eb05d['query']['limit']);_0x70c485['offset']=qs[_0x7aaa('0x2b')](_0x4eb05d['query'][_0x7aaa('0x2b')]);}return _0x4aed08['getDescriptions'](_0x70c485);}})[_0x7aaa('0x1d')](function(_0x5d0e0d){if(_0x5d0e0d){return _0x5d0e0d?{'count':_0x1941cd,'rows':_0x5d0e0d}:null;}})['then'](respondWithResult(_0x1dc700,null))['catch'](handleError(_0x1dc700,null));};exports[_0x7aaa('0x5a')]=function(_0x157e7c,_0x4c125a,_0x5492f8){var _0x5708c5={};var _0xac39f8={};var _0x5114d1;var _0x1e74a2;return db[_0x7aaa('0x48')]['findOne']({'where':{'id':_0x157e7c[_0x7aaa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c125a,null))[_0x7aaa('0x1d')](function(_0x1a3b2e){if(_0x1a3b2e){_0x5114d1=_0x1a3b2e;_0xac39f8[_0x7aaa('0x38')]=_[_0x7aaa('0x3b')](db[_0x7aaa('0x5b')][_0x7aaa('0x34')]);_0xac39f8['query']=_[_0x7aaa('0x3b')](_0x157e7c[_0x7aaa('0x3a')]);_0xac39f8[_0x7aaa('0x3c')]=_['intersection'](_0xac39f8[_0x7aaa('0x38')],_0xac39f8[_0x7aaa('0x3a')]);_0x5708c5['attributes']=_[_0x7aaa('0x3d')](_0xac39f8['model'],qs['fields'](_0x157e7c[_0x7aaa('0x3a')]['fields']));_0x5708c5[_0x7aaa('0x4d')]=_0x5708c5[_0x7aaa('0x4d')][_0x7aaa('0x3f')]?_0x5708c5[_0x7aaa('0x4d')]:_0xac39f8[_0x7aaa('0x38')];_0x5708c5[_0x7aaa('0x5c')]=qs[_0x7aaa('0x42')](_0x157e7c[_0x7aaa('0x3a')][_0x7aaa('0x42')]);_0x5708c5[_0x7aaa('0x43')]=qs[_0x7aaa('0x3c')](_[_0x7aaa('0x44')](_0x157e7c[_0x7aaa('0x3a')],_0xac39f8[_0x7aaa('0x3c')]));if(_0x157e7c[_0x7aaa('0x3a')][_0x7aaa('0x45')]){_0x5708c5[_0x7aaa('0x43')]=_['merge'](_0x5708c5['where'],{'$or':_[_0x7aaa('0x39')](_0x5708c5[_0x7aaa('0x4d')],function(_0x23296f){var _0x47bac6={};_0x47bac6[_0x23296f]={'$like':'%'+_0x157e7c['query']['filter']+'%'};return _0x47bac6;})});}_0x5708c5=_['merge']({},_0x5708c5,_0x157e7c[_0x7aaa('0x4f')]);return _0x5114d1[_0x7aaa('0x5a')](_0x5708c5);}})[_0x7aaa('0x1d')](function(_0x23521c){if(_0x23521c){_0x1e74a2=_0x23521c[_0x7aaa('0x3f')];if(!_0x157e7c['query'][_0x7aaa('0x40')](_0x7aaa('0x41'))){_0x5708c5[_0x7aaa('0x2c')]=qs[_0x7aaa('0x2c')](_0x157e7c[_0x7aaa('0x3a')][_0x7aaa('0x2c')]);_0x5708c5[_0x7aaa('0x2b')]=qs[_0x7aaa('0x2b')](_0x157e7c[_0x7aaa('0x3a')][_0x7aaa('0x2b')]);}return _0x5114d1[_0x7aaa('0x5a')](_0x5708c5);}})[_0x7aaa('0x1d')](function(_0x49f01f){if(_0x49f01f){return _0x49f01f?{'count':_0x1e74a2,'rows':_0x49f01f}:null;}})[_0x7aaa('0x1d')](respondWithResult(_0x4c125a,null))[_0x7aaa('0x25')](handleError(_0x4c125a,null));};exports[_0x7aaa('0x5d')]=function(_0x589d64,_0x4a08ce,_0x459c8e){if(_0x589d64[_0x7aaa('0x51')]['id']){delete _0x589d64[_0x7aaa('0x51')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x589d64[_0x7aaa('0x4c')]['id']}})[_0x7aaa('0x1d')](handleEntityNotFound(_0x4a08ce,null))['then'](function(_0x3130b1){if(_0x3130b1){return _0x3130b1[_0x7aaa('0x5d')](_0x589d64['body'][_0x7aaa('0x5e')]||[]);}return null;})[_0x7aaa('0x1d')](respondWithResult(_0x4a08ce,null))[_0x7aaa('0x25')](handleError(_0x4a08ce,null));}; \ No newline at end of file +var _0x1181=['DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','client','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','show','options','find','create','body','params','getFields','findOne'];(function(_0x266e28,_0x3cf1e7){var _0x5b90cd=function(_0x46d8e0){while(--_0x46d8e0){_0x266e28['push'](_0x266e28['shift']());}};_0x5b90cd(++_0x3cf1e7);}(_0x1181,0xbb));var _0x1118=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x1181[_0x45b1ba];return _0x145ddb;};'use strict';var pdf=require(_0x1118('0x0'));var emlformat=require(_0x1118('0x1'));var rimraf=require(_0x1118('0x2'));var zipdir=require(_0x1118('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1118('0x4'));var moment=require(_0x1118('0x5'));var BPromise=require(_0x1118('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1118('0x7'));var sox=require(_0x1118('0x8'));var csv=require(_0x1118('0x9'));var ejs=require(_0x1118('0xa'));var fs=require('fs');var _=require(_0x1118('0xb'));var squel=require(_0x1118('0xc'));var crypto=require('crypto');var jsforce=require(_0x1118('0xd'));var deskjs=require(_0x1118('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1118('0xf'));var Papa=require('papaparse');var Redis=require(_0x1118('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1118('0x11'));var hardwareService=require(_0x1118('0x12'));var logger=require(_0x1118('0x13'))('api');var utils=require(_0x1118('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1118('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1118('0x16')][_0x1118('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x40db60,_0xa2dc68,_0x24bf56,_0x1e5a01){return new BPromise(function(_0x4b777d,_0x28de5e){var _0x425974=_0x1e5a01||client;return _0x425974['request'](_0x40db60,_0x24bf56)['then'](function(_0x45290f){logger[_0x1118('0x18')](_0x1118('0x19'),_0xa2dc68,_0x1118('0x1a'));logger[_0x1118('0x1b')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xa2dc68,_0x1118('0x1a'),JSON['stringify'](_0x45290f));if(_0x45290f[_0x1118('0x1c')]){if(_0x45290f[_0x1118('0x1c')][_0x1118('0x1d')]===0x1f4){logger[_0x1118('0x1c')](_0x1118('0x19'),_0xa2dc68,_0x45290f[_0x1118('0x1c')][_0x1118('0x1e')]);return _0x28de5e(_0x45290f[_0x1118('0x1c')][_0x1118('0x1e')]);}logger['error'](_0x1118('0x19'),_0xa2dc68,_0x45290f[_0x1118('0x1c')][_0x1118('0x1e')]);return _0x4b777d(_0x45290f['error']['message']);}else{logger['info'](_0x1118('0x19'),_0xa2dc68,_0x1118('0x1a'));_0x4b777d(_0x45290f[_0x1118('0x1f')][_0x1118('0x1e')]);}})[_0x1118('0x20')](function(_0x1234dc){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xa2dc68,_0x1234dc);_0x28de5e(_0x1234dc);});});}function respondWithStatusCode(_0x3cb59e,_0x1d5217){_0x1d5217=_0x1d5217||0xcc;return function(_0x4af930){if(_0x4af930){return _0x3cb59e[_0x1118('0x21')](_0x1d5217);}return _0x3cb59e[_0x1118('0x22')](_0x1d5217)[_0x1118('0x23')]();};}function respondWithResult(_0x1cf1db,_0x1d483c){_0x1d483c=_0x1d483c||0xc8;return function(_0x103dfe){if(_0x103dfe){return _0x1cf1db['status'](_0x1d483c)[_0x1118('0x24')](_0x103dfe);}};}function respondWithFilteredResult(_0x4d8ce4,_0x160183){return function(_0x7b2bf1){if(_0x7b2bf1){var _0x2325dd=_0x7b2bf1[_0x1118('0x25')],_0x3e048d=_0x160183[_0x1118('0x26')],_0x8c543b=_0x160183[_0x1118('0x26')]+_0x160183[_0x1118('0x27')],_0x4a5898;if(_0x8c543b>=_0x2325dd){_0x8c543b=_0x2325dd;_0x4a5898=0xc8;}else{_0x4a5898=0xce;}_0x4d8ce4[_0x1118('0x22')](_0x4a5898);return _0x4d8ce4['set'](_0x1118('0x28'),_0x3e048d+'-'+_0x8c543b+'/'+_0x2325dd)[_0x1118('0x24')](_0x7b2bf1);}return null;};}function patchUpdates(_0x3370ee){return function(_0x2edcbf){try{jsonpatch['apply'](_0x2edcbf,_0x3370ee,!![]);}catch(_0x19612a){return BPromise[_0x1118('0x29')](_0x19612a);}return _0x2edcbf[_0x1118('0x2a')]();};}function saveUpdates(_0x3cbe92,_0x10b464){return function(_0x7f0d62){if(_0x7f0d62){return _0x7f0d62[_0x1118('0x2b')](_0x3cbe92)[_0x1118('0x2c')](function(_0x4eec98){return _0x4eec98;});}return null;};}function removeEntity(_0xeb9b59,_0x44449e){return function(_0x1dc784){if(_0x1dc784){return _0x1dc784[_0x1118('0x2d')]()['then'](function(){_0xeb9b59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da281,_0x32ca35){return function(_0x19806f){if(!_0x19806f){_0x4da281[_0x1118('0x21')](0x194);}return _0x19806f;};}function handleError(_0x2cda6a,_0x49e55c){_0x49e55c=_0x49e55c||0x1f4;return function(_0x2e9ce8){logger[_0x1118('0x1c')](_0x2e9ce8[_0x1118('0x2e')]);if(_0x2e9ce8[_0x1118('0x2f')]){delete _0x2e9ce8[_0x1118('0x2f')];}_0x2cda6a[_0x1118('0x22')](_0x49e55c)[_0x1118('0x30')](_0x2e9ce8);};}exports[_0x1118('0x31')]=function(_0x44c514,_0x25f032){var _0x11dbda={},_0xbd8566={},_0x392d80={'count':0x0,'rows':[]};var _0x46d6ed=_[_0x1118('0x32')](db[_0x1118('0x33')][_0x1118('0x34')],function(_0x191b06){return{'name':_0x191b06[_0x1118('0x35')],'type':_0x191b06['type'][_0x1118('0x36')]};});_0xbd8566[_0x1118('0x37')]=_['map'](_0x46d6ed,_0x1118('0x2f'));_0xbd8566[_0x1118('0x38')]=_[_0x1118('0x39')](_0x44c514[_0x1118('0x38')]);_0xbd8566['filters']=_[_0x1118('0x3a')](_0xbd8566[_0x1118('0x37')],_0xbd8566[_0x1118('0x38')]);_0x11dbda[_0x1118('0x3b')]=_[_0x1118('0x3a')](_0xbd8566['model'],qs['fields'](_0x44c514['query'][_0x1118('0x3c')]));_0x11dbda[_0x1118('0x3b')]=_0x11dbda['attributes'][_0x1118('0x3d')]?_0x11dbda['attributes']:_0xbd8566[_0x1118('0x37')];if(!_0x44c514[_0x1118('0x38')][_0x1118('0x3e')](_0x1118('0x3f'))){_0x11dbda[_0x1118('0x27')]=qs[_0x1118('0x27')](_0x44c514['query'][_0x1118('0x27')]);_0x11dbda[_0x1118('0x26')]=qs[_0x1118('0x26')](_0x44c514['query'][_0x1118('0x26')]);}_0x11dbda[_0x1118('0x40')]=qs[_0x1118('0x41')](_0x44c514[_0x1118('0x38')][_0x1118('0x41')]);_0x11dbda[_0x1118('0x42')]=qs[_0x1118('0x43')](_[_0x1118('0x44')](_0x44c514[_0x1118('0x38')],_0xbd8566['filters']),_0x46d6ed);if(_0x44c514[_0x1118('0x38')][_0x1118('0x45')]){_0x11dbda[_0x1118('0x42')]=_[_0x1118('0x46')](_0x11dbda[_0x1118('0x42')],{'$or':_[_0x1118('0x32')](_0x46d6ed,function(_0x3ab24f){if(_0x3ab24f[_0x1118('0x47')]!==_0x1118('0x48')){var _0x135268={};_0x135268[_0x3ab24f[_0x1118('0x2f')]]={'$like':'%'+_0x44c514[_0x1118('0x38')]['filter']+'%'};return _0x135268;}})});}_0x11dbda=_[_0x1118('0x46')]({},_0x11dbda,_0x44c514['options']);var _0x4e9c6e={'where':_0x11dbda['where']};return db[_0x1118('0x33')][_0x1118('0x25')](_0x4e9c6e)[_0x1118('0x2c')](function(_0x3df1b6){_0x392d80['count']=_0x3df1b6;if(_0x44c514[_0x1118('0x38')][_0x1118('0x49')]){_0x11dbda['include']=[{'all':!![]}];}return db[_0x1118('0x33')][_0x1118('0x4a')](_0x11dbda);})['then'](function(_0x596889){_0x392d80['rows']=_0x596889;return _0x392d80;})['then'](respondWithFilteredResult(_0x25f032,_0x11dbda))[_0x1118('0x20')](handleError(_0x25f032,null));};exports[_0x1118('0x4b')]=function(_0x36a460,_0x217852){var _0x542681={'raw':![],'where':{'id':_0x36a460['params']['id']}},_0x199cba={};_0x199cba[_0x1118('0x37')]=_[_0x1118('0x39')](db[_0x1118('0x33')][_0x1118('0x34')]);_0x199cba[_0x1118('0x38')]=_[_0x1118('0x39')](_0x36a460[_0x1118('0x38')]);_0x199cba[_0x1118('0x43')]=_['intersection'](_0x199cba[_0x1118('0x37')],_0x199cba['query']);_0x542681[_0x1118('0x3b')]=_[_0x1118('0x3a')](_0x199cba['model'],qs[_0x1118('0x3c')](_0x36a460[_0x1118('0x38')][_0x1118('0x3c')]));_0x542681['attributes']=_0x542681['attributes']['length']?_0x542681[_0x1118('0x3b')]:_0x199cba[_0x1118('0x37')];if(_0x36a460['query'][_0x1118('0x49')]){_0x542681['include']=[{'all':!![]}];}_0x542681=_[_0x1118('0x46')]({},_0x542681,_0x36a460[_0x1118('0x4c')]);return db[_0x1118('0x33')][_0x1118('0x4d')](_0x542681)[_0x1118('0x2c')](handleEntityNotFound(_0x217852,null))[_0x1118('0x2c')](respondWithResult(_0x217852,null))[_0x1118('0x20')](handleError(_0x217852,null));};exports[_0x1118('0x4e')]=function(_0x1e73fc,_0x277a37){return db[_0x1118('0x33')][_0x1118('0x4e')](_0x1e73fc[_0x1118('0x4f')],{})[_0x1118('0x2c')](respondWithResult(_0x277a37,0xc9))['catch'](handleError(_0x277a37,null));};exports[_0x1118('0x2b')]=function(_0x250273,_0x1cf0b8){if(_0x250273[_0x1118('0x4f')]['id']){delete _0x250273['body']['id'];}return db[_0x1118('0x33')][_0x1118('0x4d')]({'where':{'id':_0x250273[_0x1118('0x50')]['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0x1cf0b8,null))['then'](saveUpdates(_0x250273[_0x1118('0x4f')],null))[_0x1118('0x2c')](respondWithResult(_0x1cf0b8,null))[_0x1118('0x20')](handleError(_0x1cf0b8,null));};exports[_0x1118('0x2d')]=function(_0x57462c,_0x46734c){return db[_0x1118('0x33')][_0x1118('0x4d')]({'where':{'id':_0x57462c['params']['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0x46734c,null))['then'](removeEntity(_0x46734c,null))[_0x1118('0x20')](handleError(_0x46734c,null));};exports[_0x1118('0x51')]=function(_0xe9b634,_0x45a6bd,_0x3c0006){var _0x5774fb={};var _0x40775b={};var _0x144507;var _0x338bab;return db[_0x1118('0x33')][_0x1118('0x52')]({'where':{'id':_0xe9b634[_0x1118('0x50')]['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0x45a6bd,null))['then'](function(_0x8cc077){if(_0x8cc077){_0x144507=_0x8cc077;_0x40775b[_0x1118('0x37')]=_[_0x1118('0x39')](db[_0x1118('0x53')][_0x1118('0x34')]);_0x40775b[_0x1118('0x38')]=_[_0x1118('0x39')](_0xe9b634[_0x1118('0x38')]);_0x40775b[_0x1118('0x43')]=_['intersection'](_0x40775b[_0x1118('0x37')],_0x40775b['query']);_0x5774fb[_0x1118('0x3b')]=_['intersection'](_0x40775b['model'],qs[_0x1118('0x3c')](_0xe9b634[_0x1118('0x38')][_0x1118('0x3c')]));_0x5774fb['attributes']=_0x5774fb[_0x1118('0x3b')]['length']?_0x5774fb[_0x1118('0x3b')]:_0x40775b[_0x1118('0x37')];_0x5774fb[_0x1118('0x40')]=qs[_0x1118('0x41')](_0xe9b634[_0x1118('0x38')]['sort']);_0x5774fb[_0x1118('0x42')]=qs['filters'](_['pick'](_0xe9b634[_0x1118('0x38')],_0x40775b[_0x1118('0x43')]));if(_0xe9b634[_0x1118('0x38')][_0x1118('0x45')]){_0x5774fb['where']=_[_0x1118('0x46')](_0x5774fb[_0x1118('0x42')],{'$or':_['map'](_0x5774fb[_0x1118('0x3b')],function(_0x4109cc){var _0x3f7852={};_0x3f7852[_0x4109cc]={'$like':'%'+_0xe9b634[_0x1118('0x38')]['filter']+'%'};return _0x3f7852;})});}_0x5774fb=_[_0x1118('0x46')]({},_0x5774fb,_0xe9b634[_0x1118('0x4c')]);return _0x144507[_0x1118('0x51')](_0x5774fb);}})[_0x1118('0x2c')](function(_0x350706){if(_0x350706){_0x338bab=_0x350706[_0x1118('0x3d')];if(!_0xe9b634['query']['hasOwnProperty'](_0x1118('0x3f'))){_0x5774fb[_0x1118('0x27')]=qs[_0x1118('0x27')](_0xe9b634[_0x1118('0x38')][_0x1118('0x27')]);_0x5774fb['offset']=qs[_0x1118('0x26')](_0xe9b634[_0x1118('0x38')][_0x1118('0x26')]);}return _0x144507[_0x1118('0x51')](_0x5774fb);}})[_0x1118('0x2c')](function(_0x44e972){if(_0x44e972){return _0x44e972?{'count':_0x338bab,'rows':_0x44e972}:null;}})['then'](respondWithResult(_0x45a6bd,null))['catch'](handleError(_0x45a6bd,null));};exports[_0x1118('0x54')]=function(_0x5d5ee5,_0x56bb98,_0xa32863){var _0x3c1e26={};var _0x14bcc1={};var _0x4caaf6;var _0x4f94ee;return db[_0x1118('0x33')][_0x1118('0x52')]({'where':{'id':_0x5d5ee5[_0x1118('0x50')]['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0x56bb98,null))[_0x1118('0x2c')](function(_0x4a44c4){if(_0x4a44c4){_0x4caaf6=_0x4a44c4;_0x14bcc1[_0x1118('0x37')]=_['keys'](db['DeskField']['rawAttributes']);_0x14bcc1[_0x1118('0x38')]=_[_0x1118('0x39')](_0x5d5ee5[_0x1118('0x38')]);_0x14bcc1[_0x1118('0x43')]=_[_0x1118('0x3a')](_0x14bcc1['model'],_0x14bcc1[_0x1118('0x38')]);_0x3c1e26['attributes']=_[_0x1118('0x3a')](_0x14bcc1['model'],qs[_0x1118('0x3c')](_0x5d5ee5['query'][_0x1118('0x3c')]));_0x3c1e26[_0x1118('0x3b')]=_0x3c1e26[_0x1118('0x3b')][_0x1118('0x3d')]?_0x3c1e26[_0x1118('0x3b')]:_0x14bcc1[_0x1118('0x37')];_0x3c1e26[_0x1118('0x40')]=qs['sort'](_0x5d5ee5[_0x1118('0x38')][_0x1118('0x41')]);_0x3c1e26[_0x1118('0x42')]=qs['filters'](_[_0x1118('0x44')](_0x5d5ee5[_0x1118('0x38')],_0x14bcc1['filters']));if(_0x5d5ee5[_0x1118('0x38')]['filter']){_0x3c1e26[_0x1118('0x42')]=_['merge'](_0x3c1e26[_0x1118('0x42')],{'$or':_[_0x1118('0x32')](_0x3c1e26[_0x1118('0x3b')],function(_0x3bd6a2){var _0x5cc39e={};_0x5cc39e[_0x3bd6a2]={'$like':'%'+_0x5d5ee5[_0x1118('0x38')]['filter']+'%'};return _0x5cc39e;})});}_0x3c1e26=_['merge']({},_0x3c1e26,_0x5d5ee5[_0x1118('0x4c')]);return _0x4caaf6['getSubjects'](_0x3c1e26);}})['then'](function(_0xe4767f){if(_0xe4767f){_0x4f94ee=_0xe4767f[_0x1118('0x3d')];if(!_0x5d5ee5['query'][_0x1118('0x3e')](_0x1118('0x3f'))){_0x3c1e26['limit']=qs[_0x1118('0x27')](_0x5d5ee5[_0x1118('0x38')][_0x1118('0x27')]);_0x3c1e26['offset']=qs[_0x1118('0x26')](_0x5d5ee5[_0x1118('0x38')][_0x1118('0x26')]);}return _0x4caaf6['getSubjects'](_0x3c1e26);}})[_0x1118('0x2c')](function(_0x2cb46f){if(_0x2cb46f){return _0x2cb46f?{'count':_0x4f94ee,'rows':_0x2cb46f}:null;}})['then'](respondWithResult(_0x56bb98,null))[_0x1118('0x20')](handleError(_0x56bb98,null));};exports[_0x1118('0x55')]=function(_0x35cf74,_0xe0fe9f,_0x42d6ce){var _0x47f777={};var _0xacabb9={};var _0x5d8f6c;var _0x2d0a1a;return db[_0x1118('0x33')][_0x1118('0x52')]({'where':{'id':_0x35cf74[_0x1118('0x50')]['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0xe0fe9f,null))[_0x1118('0x2c')](function(_0x54c3fe){if(_0x54c3fe){_0x5d8f6c=_0x54c3fe;_0xacabb9[_0x1118('0x37')]=_[_0x1118('0x39')](db[_0x1118('0x53')]['rawAttributes']);_0xacabb9[_0x1118('0x38')]=_[_0x1118('0x39')](_0x35cf74[_0x1118('0x38')]);_0xacabb9['filters']=_[_0x1118('0x3a')](_0xacabb9[_0x1118('0x37')],_0xacabb9[_0x1118('0x38')]);_0x47f777[_0x1118('0x3b')]=_[_0x1118('0x3a')](_0xacabb9[_0x1118('0x37')],qs[_0x1118('0x3c')](_0x35cf74['query'][_0x1118('0x3c')]));_0x47f777[_0x1118('0x3b')]=_0x47f777['attributes'][_0x1118('0x3d')]?_0x47f777['attributes']:_0xacabb9[_0x1118('0x37')];_0x47f777[_0x1118('0x40')]=qs[_0x1118('0x41')](_0x35cf74['query'][_0x1118('0x41')]);_0x47f777[_0x1118('0x42')]=qs[_0x1118('0x43')](_['pick'](_0x35cf74[_0x1118('0x38')],_0xacabb9[_0x1118('0x43')]));if(_0x35cf74['query'][_0x1118('0x45')]){_0x47f777[_0x1118('0x42')]=_['merge'](_0x47f777[_0x1118('0x42')],{'$or':_['map'](_0x47f777[_0x1118('0x3b')],function(_0x5d326d){var _0x2b6252={};_0x2b6252[_0x5d326d]={'$like':'%'+_0x35cf74[_0x1118('0x38')]['filter']+'%'};return _0x2b6252;})});}_0x47f777=_[_0x1118('0x46')]({},_0x47f777,_0x35cf74[_0x1118('0x4c')]);return _0x5d8f6c[_0x1118('0x55')](_0x47f777);}})[_0x1118('0x2c')](function(_0x4f073e){if(_0x4f073e){_0x2d0a1a=_0x4f073e['length'];if(!_0x35cf74[_0x1118('0x38')][_0x1118('0x3e')](_0x1118('0x3f'))){_0x47f777[_0x1118('0x27')]=qs[_0x1118('0x27')](_0x35cf74[_0x1118('0x38')][_0x1118('0x27')]);_0x47f777[_0x1118('0x26')]=qs['offset'](_0x35cf74[_0x1118('0x38')]['offset']);}return _0x5d8f6c[_0x1118('0x55')](_0x47f777);}})[_0x1118('0x2c')](function(_0x25c545){if(_0x25c545){return _0x25c545?{'count':_0x2d0a1a,'rows':_0x25c545}:null;}})['then'](respondWithResult(_0xe0fe9f,null))[_0x1118('0x20')](handleError(_0xe0fe9f,null));};exports['getTags']=function(_0x37da56,_0x305d45,_0xfb6061){var _0x324ba1={};var _0x25eb0c={};var _0x500a69;var _0xa5ae41;return db[_0x1118('0x33')]['findOne']({'where':{'id':_0x37da56[_0x1118('0x50')]['id']}})[_0x1118('0x2c')](handleEntityNotFound(_0x305d45,null))[_0x1118('0x2c')](function(_0x2daf00){if(_0x2daf00){_0x500a69=_0x2daf00;_0x25eb0c[_0x1118('0x37')]=_['keys'](db[_0x1118('0x56')][_0x1118('0x34')]);_0x25eb0c[_0x1118('0x38')]=_[_0x1118('0x39')](_0x37da56[_0x1118('0x38')]);_0x25eb0c['filters']=_['intersection'](_0x25eb0c[_0x1118('0x37')],_0x25eb0c[_0x1118('0x38')]);_0x324ba1['attributes']=_[_0x1118('0x3a')](_0x25eb0c[_0x1118('0x37')],qs[_0x1118('0x3c')](_0x37da56[_0x1118('0x38')][_0x1118('0x3c')]));_0x324ba1[_0x1118('0x3b')]=_0x324ba1[_0x1118('0x3b')][_0x1118('0x3d')]?_0x324ba1['attributes']:_0x25eb0c[_0x1118('0x37')];_0x324ba1['order']=qs[_0x1118('0x41')](_0x37da56[_0x1118('0x38')][_0x1118('0x41')]);_0x324ba1[_0x1118('0x42')]=qs[_0x1118('0x43')](_[_0x1118('0x44')](_0x37da56[_0x1118('0x38')],_0x25eb0c[_0x1118('0x43')]));if(_0x37da56[_0x1118('0x38')]['filter']){_0x324ba1[_0x1118('0x42')]=_['merge'](_0x324ba1[_0x1118('0x42')],{'$or':_[_0x1118('0x32')](_0x324ba1[_0x1118('0x3b')],function(_0x52f16f){var _0x534709={};_0x534709[_0x52f16f]={'$like':'%'+_0x37da56[_0x1118('0x38')][_0x1118('0x45')]+'%'};return _0x534709;})});}_0x324ba1=_[_0x1118('0x46')]({},_0x324ba1,_0x37da56['options']);return _0x500a69[_0x1118('0x57')](_0x324ba1);}})[_0x1118('0x2c')](function(_0x1bdcd0){if(_0x1bdcd0){_0xa5ae41=_0x1bdcd0[_0x1118('0x3d')];if(!_0x37da56[_0x1118('0x38')][_0x1118('0x3e')]('nolimit')){_0x324ba1[_0x1118('0x27')]=qs[_0x1118('0x27')](_0x37da56[_0x1118('0x38')]['limit']);_0x324ba1[_0x1118('0x26')]=qs[_0x1118('0x26')](_0x37da56[_0x1118('0x38')][_0x1118('0x26')]);}return _0x500a69[_0x1118('0x57')](_0x324ba1);}})['then'](function(_0x7520a0){if(_0x7520a0){return _0x7520a0?{'count':_0xa5ae41,'rows':_0x7520a0}:null;}})[_0x1118('0x2c')](respondWithResult(_0x305d45,null))[_0x1118('0x20')](handleError(_0x305d45,null));};exports['setTags']=function(_0x4f1668,_0x490787,_0x243437){if(_0x4f1668[_0x1118('0x4f')]['id']){delete _0x4f1668[_0x1118('0x4f')]['id'];}return db['DeskConfiguration'][_0x1118('0x52')]({'where':{'id':_0x4f1668[_0x1118('0x50')]['id']}})['then'](handleEntityNotFound(_0x490787,null))[_0x1118('0x2c')](function(_0x5555e0){if(_0x5555e0){return _0x5555e0[_0x1118('0x58')](_0x4f1668[_0x1118('0x4f')][_0x1118('0x59')]||[]);}return null;})[_0x1118('0x2c')](respondWithResult(_0x490787,null))[_0x1118('0x20')](handleError(_0x490787,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2337e54..e5618b1 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 _0xea84=['./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0xea84,0xd6));var _0x4ea8=function(_0x56390e,_0x3807c4){_0x56390e=_0x56390e-0x0;var _0x1c8428=_0xea84[_0x56390e];return _0x1c8428;};'use strict';var _=require('lodash');var util=require(_0x4ea8('0x0'));var logger=require(_0x4ea8('0x1'))(_0x4ea8('0x2'));var moment=require(_0x4ea8('0x3'));var BPromise=require(_0x4ea8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ea8('0x5'));var attributes=require(_0x4ea8('0x6'));module[_0x4ea8('0x7')]=function(_0x1274de,_0x646693){return _0x1274de[_0x4ea8('0x8')]('DeskConfiguration',attributes,{'tableName':_0x4ea8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c57=['../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7c57,0xee));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77c5('0x0'));var util=require(_0x77c5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x77c5('0x2'));var rp=require(_0x77c5('0x3'));var fs=require('fs');var path=require(_0x77c5('0x4'));var rimraf=require('rimraf');var config=require(_0x77c5('0x5'));var attributes=require(_0x77c5('0x6'));module['exports']=function(_0xf1e03,_0x22eaeb){return _0xf1e03[_0x77c5('0x7')]('DeskConfiguration',attributes,{'tableName':_0x77c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 286a890..5e43fd7 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 _0xfe57=['error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfe57,0x195));var _0x7fe5=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xfe57[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7fe5('0x2'));var fs=require('fs');var Redis=require(_0x7fe5('0x3'));var db=require(_0x7fe5('0x4'))['db'];var utils=require(_0x7fe5('0x5'));var logger=require(_0x7fe5('0x6'))(_0x7fe5('0x7'));var config=require(_0x7fe5('0x8'));var jayson=require(_0x7fe5('0x9'));var client=jayson[_0x7fe5('0xa')][_0x7fe5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd6146b,_0x2632de,_0x36ff81){return new BPromise(function(_0x4ab081,_0x13b391){return client['request'](_0xd6146b,_0x36ff81)[_0x7fe5('0xc')](function(_0x2ae7f3){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'));logger[_0x7fe5('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'),JSON['stringify'](_0x2ae7f3));if(_0x2ae7f3['error']){if(_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x10')]===0x1f4){logger[_0x7fe5('0xf')](_0x7fe5('0x11'),_0x2632de,_0x2ae7f3['error'][_0x7fe5('0x12')]);return _0x13b391(_0x2ae7f3[_0x7fe5('0xf')]['message']);}logger[_0x7fe5('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x2632de,_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x12')]);return _0x4ab081(_0x2ae7f3['error'][_0x7fe5('0x12')]);}else{logger['info'](_0x7fe5('0x11'),_0x2632de,_0x7fe5('0xd'));_0x4ab081(_0x2ae7f3[_0x7fe5('0x13')][_0x7fe5('0x12')]);}})[_0x7fe5('0x14')](function(_0x104bc8){logger['error'](_0x7fe5('0x11'),_0x2632de,_0x104bc8);_0x13b391(_0x104bc8);});});} \ No newline at end of file +var _0x3360=['code','message','result','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x32f8ea,_0x1dec1e){var _0x168e7d=function(_0x3cfe76){while(--_0x3cfe76){_0x32f8ea['push'](_0x32f8ea['shift']());}};_0x168e7d(++_0x1dec1e);}(_0x3360,0x1d7));var _0x0336=function(_0x1e43e1,_0x54c26d){_0x1e43e1=_0x1e43e1-0x0;var _0x30c7da=_0x3360[_0x1e43e1];return _0x30c7da;};'use strict';var _=require(_0x0336('0x0'));var util=require(_0x0336('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0336('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0336('0x3'))(_0x0336('0x4'));var config=require(_0x0336('0x5'));var jayson=require(_0x0336('0x6'));var client=jayson[_0x0336('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4890e5,_0x33fb80,_0x36a973){return new BPromise(function(_0x310327,_0x351429){return client[_0x0336('0x8')](_0x4890e5,_0x36a973)['then'](function(_0x1d05e6){logger[_0x0336('0x9')](_0x0336('0xa'),_0x33fb80,'request\x20sent');logger[_0x0336('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x33fb80,_0x0336('0xc'),JSON[_0x0336('0xd')](_0x1d05e6));if(_0x1d05e6[_0x0336('0xe')]){if(_0x1d05e6[_0x0336('0xe')][_0x0336('0xf')]===0x1f4){logger['error'](_0x0336('0xa'),_0x33fb80,_0x1d05e6[_0x0336('0xe')][_0x0336('0x10')]);return _0x351429(_0x1d05e6[_0x0336('0xe')][_0x0336('0x10')]);}logger['error'](_0x0336('0xa'),_0x33fb80,_0x1d05e6[_0x0336('0xe')][_0x0336('0x10')]);return _0x310327(_0x1d05e6[_0x0336('0xe')]['message']);}else{logger[_0x0336('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x33fb80,_0x0336('0xc'));_0x310327(_0x1d05e6[_0x0336('0x11')]['message']);}})['catch'](function(_0x528d99){logger[_0x0336('0xe')](_0x0336('0xa'),_0x33fb80,_0x528d99);_0x351429(_0x528d99);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a058414..182ea45 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 _0x9e14=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9e14,0x105));var _0x49e1=function(_0x2bbe3e,_0x9bcd3c){_0x2bbe3e=_0x2bbe3e-0x0;var _0x49402c=_0x9e14[_0x2bbe3e];return _0x49402c;};'use strict';var multer=require(_0x49e1('0x0'));var util=require(_0x49e1('0x1'));var path=require(_0x49e1('0x2'));var timeout=require('connect-timeout');var express=require(_0x49e1('0x3'));var router=express[_0x49e1('0x4')]();var auth=require(_0x49e1('0x5'));var interaction=require(_0x49e1('0x6'));var config=require(_0x49e1('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x49e1('0x8')](),controller[_0x49e1('0x9')]);router[_0x49e1('0xa')](_0x49e1('0xb'),auth[_0x49e1('0x8')](),controller[_0x49e1('0xc')]);router[_0x49e1('0xd')]('/',auth['isAuthenticated'](),controller[_0x49e1('0xe')]);router[_0x49e1('0xf')](_0x49e1('0xb'),auth[_0x49e1('0x8')](),controller[_0x49e1('0x10')]);router[_0x49e1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x49e1('0x12')]);module[_0x49e1('0x13')]=router; \ No newline at end of file +var _0x5046=['put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5046,0x1b4));var _0x6504=function(_0x2f0ae3,_0x45347e){_0x2f0ae3=_0x2f0ae3-0x0;var _0x6588c3=_0x5046[_0x2f0ae3];return _0x6588c3;};'use strict';var multer=require(_0x6504('0x0'));var util=require('util');var path=require(_0x6504('0x1'));var timeout=require(_0x6504('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6504('0x3'));var interaction=require(_0x6504('0x4'));var config=require(_0x6504('0x5'));var controller=require(_0x6504('0x6'));router[_0x6504('0x7')]('/',auth['isAuthenticated'](),controller[_0x6504('0x8')]);router[_0x6504('0x7')](_0x6504('0x9'),auth['isAuthenticated'](),controller[_0x6504('0xa')]);router[_0x6504('0xb')]('/',auth[_0x6504('0xc')](),controller[_0x6504('0xd')]);router[_0x6504('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6504('0xf')]);router[_0x6504('0x10')](_0x6504('0x9'),auth[_0x6504('0xc')](),controller['destroy']);module[_0x6504('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 161c0c6..e2daa55 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 _0x1230=['keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','ENUM','customVariable'];(function(_0xde2959,_0x536221){var _0x3364b0=function(_0x4b83d5){while(--_0x4b83d5){_0xde2959['push'](_0xde2959['shift']());}};_0x3364b0(++_0x536221);}(_0x1230,0xc3));var _0x0123=function(_0x4f6ac9,_0xa95f53){_0x4f6ac9=_0x4f6ac9-0x0;var _0x338af6=_0x1230[_0x4f6ac9];return _0x338af6;};'use strict';var Sequelize=require(_0x0123('0x0'));module['exports']={'type':{'type':Sequelize[_0x0123('0x1')]('string','variable',_0x0123('0x2'),_0x0123('0x3'),_0x0123('0x4')),'defaultValue':_0x0123('0x5')},'content':{'type':Sequelize[_0x0123('0x6')]},'key':{'type':Sequelize[_0x0123('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0123('0x5'),_0x0123('0x7'),_0x0123('0x2'))},'keyContent':{'type':Sequelize[_0x0123('0x6')]},'idField':{'type':Sequelize[_0x0123('0x6')]},'nameField':{'type':Sequelize[_0x0123('0x6')]},'customField':{'type':Sequelize[_0x0123('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0123('0x6')]}}; \ No newline at end of file +var _0x0fb5=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0fb5,0x80));var _0x50fb=function(_0x484c15,_0x53dff1){_0x484c15=_0x484c15-0x0;var _0x32e755=_0x0fb5[_0x484c15];return _0x32e755;};'use strict';var Sequelize=require(_0x50fb('0x0'));module[_0x50fb('0x1')]={'type':{'type':Sequelize[_0x50fb('0x2')](_0x50fb('0x3'),_0x50fb('0x4'),_0x50fb('0x5'),_0x50fb('0x6'),_0x50fb('0x7')),'defaultValue':_0x50fb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x50fb('0x8')]},'keyType':{'type':Sequelize[_0x50fb('0x2')]('string',_0x50fb('0x4'),_0x50fb('0x5'))},'keyContent':{'type':Sequelize[_0x50fb('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x50fb('0x8')]},'customField':{'type':Sequelize[_0x50fb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 29149a4..98f8d1e 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 _0x50ea=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x50ea,0x172));var _0xa50e=function(_0x5ab27f,_0x21a462){_0x5ab27f=_0x5ab27f-0x0;var _0x23826c=_0x50ea[_0x5ab27f];return _0x23826c;};'use strict';var pdf=require(_0xa50e('0x0'));var emlformat=require(_0xa50e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa50e('0x2'));var jsonpatch=require(_0xa50e('0x3'));var rp=require(_0xa50e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa50e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa50e('0x6'));var ejs=require(_0xa50e('0x7'));var fs=require('fs');var _=require(_0xa50e('0x8'));var squel=require(_0xa50e('0x9'));var crypto=require(_0xa50e('0xa'));var jsforce=require(_0xa50e('0xb'));var deskjs=require(_0xa50e('0xc'));var toCsv=require(_0xa50e('0x6'));var querystring=require('querystring');var Papa=require(_0xa50e('0xd'));var Redis=require(_0xa50e('0xe'));var authService=require(_0xa50e('0xf'));var qs=require(_0xa50e('0x10'));var as=require(_0xa50e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa50e('0x12'));var utils=require('../../config/utils');var config=require(_0xa50e('0x13'));var licenseUtil=require(_0xa50e('0x14'));var db=require(_0xa50e('0x15'))['db'];function respondWithStatusCode(_0x28d0ca,_0x9fa5ce){_0x9fa5ce=_0x9fa5ce||0xcc;return function(_0x24a1fe){if(_0x24a1fe){return _0x28d0ca[_0xa50e('0x16')](_0x9fa5ce);}return _0x28d0ca[_0xa50e('0x17')](_0x9fa5ce)[_0xa50e('0x18')]();};}function respondWithResult(_0x3fc552,_0x11c1e9){_0x11c1e9=_0x11c1e9||0xc8;return function(_0x30efad){if(_0x30efad){return _0x3fc552['status'](_0x11c1e9)[_0xa50e('0x19')](_0x30efad);}};}function respondWithFilteredResult(_0x243ae7,_0x55eecf){return function(_0x458f9c){if(_0x458f9c){var _0x1084cd=_0x458f9c[_0xa50e('0x1a')],_0xe85805=_0x55eecf[_0xa50e('0x1b')],_0x154929=_0x55eecf[_0xa50e('0x1b')]+_0x55eecf[_0xa50e('0x1c')],_0x24cd8a;if(_0x154929>=_0x1084cd){_0x154929=_0x1084cd;_0x24cd8a=0xc8;}else{_0x24cd8a=0xce;}_0x243ae7[_0xa50e('0x17')](_0x24cd8a);return _0x243ae7['set'](_0xa50e('0x1d'),_0xe85805+'-'+_0x154929+'/'+_0x1084cd)[_0xa50e('0x19')](_0x458f9c);}return null;};}function patchUpdates(_0x3b9879){return function(_0x8558f2){try{jsonpatch[_0xa50e('0x1e')](_0x8558f2,_0x3b9879,!![]);}catch(_0x51bed2){return BPromise['reject'](_0x51bed2);}return _0x8558f2[_0xa50e('0x1f')]();};}function saveUpdates(_0x2e0f8c,_0x7cb442){return function(_0x4c1ef9){if(_0x4c1ef9){return _0x4c1ef9[_0xa50e('0x20')](_0x2e0f8c)['then'](function(_0xf91184){return _0xf91184;});}return null;};}function removeEntity(_0xe320fa,_0x226939){return function(_0x421eba){if(_0x421eba){return _0x421eba[_0xa50e('0x21')]()[_0xa50e('0x22')](function(){_0xe320fa[_0xa50e('0x17')](0xcc)[_0xa50e('0x18')]();});}};}function handleEntityNotFound(_0x5e901b,_0x30afdd){return function(_0x373b79){if(!_0x373b79){_0x5e901b[_0xa50e('0x16')](0x194);}return _0x373b79;};}function handleError(_0x2ab323,_0x1ba196){_0x1ba196=_0x1ba196||0x1f4;return function(_0x1ce17e){logger['error'](_0x1ce17e['stack']);if(_0x1ce17e[_0xa50e('0x23')]){delete _0x1ce17e[_0xa50e('0x23')];}_0x2ab323[_0xa50e('0x17')](_0x1ba196)['send'](_0x1ce17e);};}exports['index']=function(_0x241211,_0x3cad35){var _0x2b04a1={},_0x7f2325={},_0xb144fb={'count':0x0,'rows':[]};var _0x22d952=_[_0xa50e('0x24')](db[_0xa50e('0x25')][_0xa50e('0x26')],function(_0x488a0b){return{'name':_0x488a0b[_0xa50e('0x27')],'type':_0x488a0b[_0xa50e('0x28')][_0xa50e('0x29')]};});_0x7f2325[_0xa50e('0x2a')]=_['map'](_0x22d952,_0xa50e('0x23'));_0x7f2325[_0xa50e('0x2b')]=_[_0xa50e('0x2c')](_0x241211[_0xa50e('0x2b')]);_0x7f2325[_0xa50e('0x2d')]=_[_0xa50e('0x2e')](_0x7f2325[_0xa50e('0x2a')],_0x7f2325[_0xa50e('0x2b')]);_0x2b04a1['attributes']=_[_0xa50e('0x2e')](_0x7f2325[_0xa50e('0x2a')],qs['fields'](_0x241211[_0xa50e('0x2b')][_0xa50e('0x2f')]));_0x2b04a1[_0xa50e('0x30')]=_0x2b04a1[_0xa50e('0x30')][_0xa50e('0x31')]?_0x2b04a1[_0xa50e('0x30')]:_0x7f2325[_0xa50e('0x2a')];if(!_0x241211[_0xa50e('0x2b')][_0xa50e('0x32')](_0xa50e('0x33'))){_0x2b04a1[_0xa50e('0x1c')]=qs[_0xa50e('0x1c')](_0x241211[_0xa50e('0x2b')][_0xa50e('0x1c')]);_0x2b04a1[_0xa50e('0x1b')]=qs[_0xa50e('0x1b')](_0x241211['query'][_0xa50e('0x1b')]);}_0x2b04a1['order']=qs[_0xa50e('0x34')](_0x241211[_0xa50e('0x2b')]['sort']);_0x2b04a1['where']=qs[_0xa50e('0x2d')](_['pick'](_0x241211[_0xa50e('0x2b')],_0x7f2325[_0xa50e('0x2d')]),_0x22d952);if(_0x241211[_0xa50e('0x2b')]['filter']){_0x2b04a1['where']=_[_0xa50e('0x35')](_0x2b04a1['where'],{'$or':_[_0xa50e('0x24')](_0x22d952,function(_0x9d75){if(_0x9d75[_0xa50e('0x28')]!==_0xa50e('0x36')){var _0x432fe8={};_0x432fe8[_0x9d75[_0xa50e('0x23')]]={'$like':'%'+_0x241211[_0xa50e('0x2b')][_0xa50e('0x37')]+'%'};return _0x432fe8;}})});}_0x2b04a1=_['merge']({},_0x2b04a1,_0x241211[_0xa50e('0x38')]);var _0xd51c03={'where':_0x2b04a1['where']};return db[_0xa50e('0x25')]['count'](_0xd51c03)[_0xa50e('0x22')](function(_0x10f240){_0xb144fb[_0xa50e('0x1a')]=_0x10f240;if(_0x241211[_0xa50e('0x2b')][_0xa50e('0x39')]){_0x2b04a1['include']=[{'all':!![]}];}return db[_0xa50e('0x25')][_0xa50e('0x3a')](_0x2b04a1);})['then'](function(_0x33251b){_0xb144fb['rows']=_0x33251b;return _0xb144fb;})[_0xa50e('0x22')](respondWithFilteredResult(_0x3cad35,_0x2b04a1))[_0xa50e('0x3b')](handleError(_0x3cad35,null));};exports[_0xa50e('0x3c')]=function(_0x2fbfed,_0x5bcb48){var _0x390125={'raw':!![],'where':{'id':_0x2fbfed[_0xa50e('0x3d')]['id']}},_0x604b32={};_0x604b32[_0xa50e('0x2a')]=_[_0xa50e('0x2c')](db[_0xa50e('0x25')]['rawAttributes']);_0x604b32['query']=_[_0xa50e('0x2c')](_0x2fbfed['query']);_0x604b32[_0xa50e('0x2d')]=_[_0xa50e('0x2e')](_0x604b32[_0xa50e('0x2a')],_0x604b32['query']);_0x390125[_0xa50e('0x30')]=_[_0xa50e('0x2e')](_0x604b32[_0xa50e('0x2a')],qs[_0xa50e('0x2f')](_0x2fbfed[_0xa50e('0x2b')][_0xa50e('0x2f')]));_0x390125[_0xa50e('0x30')]=_0x390125[_0xa50e('0x30')][_0xa50e('0x31')]?_0x390125['attributes']:_0x604b32[_0xa50e('0x2a')];if(_0x2fbfed['query']['includeAll']){_0x390125['include']=[{'all':!![]}];}_0x390125=_[_0xa50e('0x35')]({},_0x390125,_0x2fbfed[_0xa50e('0x38')]);return db['DeskField']['find'](_0x390125)['then'](handleEntityNotFound(_0x5bcb48,null))['then'](respondWithResult(_0x5bcb48,null))['catch'](handleError(_0x5bcb48,null));};exports[_0xa50e('0x3e')]=function(_0x1080d3,_0x2401f7){return db[_0xa50e('0x25')][_0xa50e('0x3e')](_0x1080d3[_0xa50e('0x3f')],{})[_0xa50e('0x22')](respondWithResult(_0x2401f7,0xc9))[_0xa50e('0x3b')](handleError(_0x2401f7,null));};exports[_0xa50e('0x20')]=function(_0x5c851e,_0x337b69){if(_0x5c851e[_0xa50e('0x3f')]['id']){delete _0x5c851e[_0xa50e('0x3f')]['id'];}return db[_0xa50e('0x25')][_0xa50e('0x40')]({'where':{'id':_0x5c851e[_0xa50e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x337b69,null))[_0xa50e('0x22')](saveUpdates(_0x5c851e[_0xa50e('0x3f')],null))[_0xa50e('0x22')](respondWithResult(_0x337b69,null))[_0xa50e('0x3b')](handleError(_0x337b69,null));};exports[_0xa50e('0x21')]=function(_0x3d8126,_0x1a508c){return db['DeskField'][_0xa50e('0x40')]({'where':{'id':_0x3d8126[_0xa50e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1a508c,null))[_0xa50e('0x22')](removeEntity(_0x1a508c,null))[_0xa50e('0x3b')](handleError(_0x1a508c,null));}; \ No newline at end of file +var _0xdc7c=['destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','json','reject','save','update','then'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdc7c,0xbd));var _0xcdc7=function(_0x1d2c38,_0x2880f3){_0x1d2c38=_0x1d2c38-0x0;var _0x11ac10=_0xdc7c[_0x1d2c38];return _0x11ac10;};'use strict';var pdf=require(_0xcdc7('0x0'));var emlformat=require(_0xcdc7('0x1'));var rimraf=require(_0xcdc7('0x2'));var zipdir=require(_0xcdc7('0x3'));var jsonpatch=require(_0xcdc7('0x4'));var rp=require('request-promise');var moment=require(_0xcdc7('0x5'));var BPromise=require(_0xcdc7('0x6'));var Mustache=require(_0xcdc7('0x7'));var util=require(_0xcdc7('0x8'));var path=require(_0xcdc7('0x9'));var sox=require(_0xcdc7('0xa'));var csv=require(_0xcdc7('0xb'));var ejs=require(_0xcdc7('0xc'));var fs=require('fs');var _=require(_0xcdc7('0xd'));var squel=require(_0xcdc7('0xe'));var crypto=require(_0xcdc7('0xf'));var jsforce=require(_0xcdc7('0x10'));var deskjs=require(_0xcdc7('0x11'));var toCsv=require('to-csv');var querystring=require(_0xcdc7('0x12'));var Papa=require(_0xcdc7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcdc7('0x14'));var hardwareService=require(_0xcdc7('0x15'));var logger=require(_0xcdc7('0x16'))(_0xcdc7('0x17'));var utils=require(_0xcdc7('0x18'));var config=require(_0xcdc7('0x19'));var licenseUtil=require(_0xcdc7('0x1a'));var db=require(_0xcdc7('0x1b'))['db'];function respondWithStatusCode(_0x842440,_0x5e4f2b){_0x5e4f2b=_0x5e4f2b||0xcc;return function(_0x53d4db){if(_0x53d4db){return _0x842440[_0xcdc7('0x1c')](_0x5e4f2b);}return _0x842440[_0xcdc7('0x1d')](_0x5e4f2b)[_0xcdc7('0x1e')]();};}function respondWithResult(_0xca4693,_0x557a5b){_0x557a5b=_0x557a5b||0xc8;return function(_0x2560f8){if(_0x2560f8){return _0xca4693[_0xcdc7('0x1d')](_0x557a5b)['json'](_0x2560f8);}};}function respondWithFilteredResult(_0x17a9dd,_0x1b12df){return function(_0x48a8d6){if(_0x48a8d6){var _0x5aaa41=_0x48a8d6[_0xcdc7('0x1f')],_0xb0adaa=_0x1b12df[_0xcdc7('0x20')],_0x570c61=_0x1b12df[_0xcdc7('0x20')]+_0x1b12df[_0xcdc7('0x21')],_0x11f097;if(_0x570c61>=_0x5aaa41){_0x570c61=_0x5aaa41;_0x11f097=0xc8;}else{_0x11f097=0xce;}_0x17a9dd[_0xcdc7('0x1d')](_0x11f097);return _0x17a9dd['set']('Content-Range',_0xb0adaa+'-'+_0x570c61+'/'+_0x5aaa41)[_0xcdc7('0x22')](_0x48a8d6);}return null;};}function patchUpdates(_0x4143e7){return function(_0x4aa7a8){try{jsonpatch['apply'](_0x4aa7a8,_0x4143e7,!![]);}catch(_0x27261e){return BPromise[_0xcdc7('0x23')](_0x27261e);}return _0x4aa7a8[_0xcdc7('0x24')]();};}function saveUpdates(_0x16feb1,_0xa7b592){return function(_0x6434b7){if(_0x6434b7){return _0x6434b7[_0xcdc7('0x25')](_0x16feb1)[_0xcdc7('0x26')](function(_0x33423f){return _0x33423f;});}return null;};}function removeEntity(_0x4600e7,_0x37122e){return function(_0x1a1d93){if(_0x1a1d93){return _0x1a1d93[_0xcdc7('0x27')]()[_0xcdc7('0x26')](function(){_0x4600e7[_0xcdc7('0x1d')](0xcc)[_0xcdc7('0x1e')]();});}};}function handleEntityNotFound(_0x32cd63,_0x40a134){return function(_0x131d00){if(!_0x131d00){_0x32cd63['sendStatus'](0x194);}return _0x131d00;};}function handleError(_0x3b51ac,_0x507d1a){_0x507d1a=_0x507d1a||0x1f4;return function(_0x214ba3){logger[_0xcdc7('0x28')](_0x214ba3[_0xcdc7('0x29')]);if(_0x214ba3['name']){delete _0x214ba3[_0xcdc7('0x2a')];}_0x3b51ac['status'](_0x507d1a)[_0xcdc7('0x2b')](_0x214ba3);};}exports[_0xcdc7('0x2c')]=function(_0x4a9437,_0x1c5602){var _0x41ed72={},_0x3a1db1={},_0x1c206c={'count':0x0,'rows':[]};var _0x52ea39=_['map'](db[_0xcdc7('0x2d')][_0xcdc7('0x2e')],function(_0x2b2093){return{'name':_0x2b2093[_0xcdc7('0x2f')],'type':_0x2b2093[_0xcdc7('0x30')][_0xcdc7('0x31')]};});_0x3a1db1[_0xcdc7('0x32')]=_[_0xcdc7('0x33')](_0x52ea39,_0xcdc7('0x2a'));_0x3a1db1[_0xcdc7('0x34')]=_[_0xcdc7('0x35')](_0x4a9437[_0xcdc7('0x34')]);_0x3a1db1['filters']=_[_0xcdc7('0x36')](_0x3a1db1['model'],_0x3a1db1[_0xcdc7('0x34')]);_0x41ed72[_0xcdc7('0x37')]=_[_0xcdc7('0x36')](_0x3a1db1[_0xcdc7('0x32')],qs[_0xcdc7('0x38')](_0x4a9437['query']['fields']));_0x41ed72[_0xcdc7('0x37')]=_0x41ed72[_0xcdc7('0x37')][_0xcdc7('0x39')]?_0x41ed72['attributes']:_0x3a1db1[_0xcdc7('0x32')];if(!_0x4a9437[_0xcdc7('0x34')]['hasOwnProperty'](_0xcdc7('0x3a'))){_0x41ed72[_0xcdc7('0x21')]=qs['limit'](_0x4a9437[_0xcdc7('0x34')][_0xcdc7('0x21')]);_0x41ed72[_0xcdc7('0x20')]=qs['offset'](_0x4a9437['query'][_0xcdc7('0x20')]);}_0x41ed72['order']=qs[_0xcdc7('0x3b')](_0x4a9437[_0xcdc7('0x34')][_0xcdc7('0x3b')]);_0x41ed72[_0xcdc7('0x3c')]=qs['filters'](_[_0xcdc7('0x3d')](_0x4a9437['query'],_0x3a1db1[_0xcdc7('0x3e')]),_0x52ea39);if(_0x4a9437[_0xcdc7('0x34')][_0xcdc7('0x3f')]){_0x41ed72['where']=_[_0xcdc7('0x40')](_0x41ed72[_0xcdc7('0x3c')],{'$or':_[_0xcdc7('0x33')](_0x52ea39,function(_0x203e40){if(_0x203e40['type']!=='VIRTUAL'){var _0x4eb738={};_0x4eb738[_0x203e40[_0xcdc7('0x2a')]]={'$like':'%'+_0x4a9437[_0xcdc7('0x34')]['filter']+'%'};return _0x4eb738;}})});}_0x41ed72=_[_0xcdc7('0x40')]({},_0x41ed72,_0x4a9437['options']);var _0x140cb4={'where':_0x41ed72['where']};return db[_0xcdc7('0x2d')][_0xcdc7('0x1f')](_0x140cb4)['then'](function(_0x262475){_0x1c206c[_0xcdc7('0x1f')]=_0x262475;if(_0x4a9437['query'][_0xcdc7('0x41')]){_0x41ed72['include']=[{'all':!![]}];}return db[_0xcdc7('0x2d')][_0xcdc7('0x42')](_0x41ed72);})['then'](function(_0x1ddd16){_0x1c206c[_0xcdc7('0x43')]=_0x1ddd16;return _0x1c206c;})['then'](respondWithFilteredResult(_0x1c5602,_0x41ed72))[_0xcdc7('0x44')](handleError(_0x1c5602,null));};exports[_0xcdc7('0x45')]=function(_0x290797,_0x2f6e57){var _0x6333f7={'raw':!![],'where':{'id':_0x290797['params']['id']}},_0x5ad3a4={};_0x5ad3a4[_0xcdc7('0x32')]=_[_0xcdc7('0x35')](db['DeskField'][_0xcdc7('0x2e')]);_0x5ad3a4[_0xcdc7('0x34')]=_[_0xcdc7('0x35')](_0x290797[_0xcdc7('0x34')]);_0x5ad3a4['filters']=_[_0xcdc7('0x36')](_0x5ad3a4[_0xcdc7('0x32')],_0x5ad3a4[_0xcdc7('0x34')]);_0x6333f7['attributes']=_['intersection'](_0x5ad3a4[_0xcdc7('0x32')],qs['fields'](_0x290797[_0xcdc7('0x34')][_0xcdc7('0x38')]));_0x6333f7['attributes']=_0x6333f7['attributes'][_0xcdc7('0x39')]?_0x6333f7[_0xcdc7('0x37')]:_0x5ad3a4[_0xcdc7('0x32')];if(_0x290797[_0xcdc7('0x34')][_0xcdc7('0x41')]){_0x6333f7[_0xcdc7('0x46')]=[{'all':!![]}];}_0x6333f7=_['merge']({},_0x6333f7,_0x290797[_0xcdc7('0x47')]);return db[_0xcdc7('0x2d')][_0xcdc7('0x48')](_0x6333f7)['then'](handleEntityNotFound(_0x2f6e57,null))[_0xcdc7('0x26')](respondWithResult(_0x2f6e57,null))[_0xcdc7('0x44')](handleError(_0x2f6e57,null));};exports[_0xcdc7('0x49')]=function(_0x3ed5d7,_0x1e1a6a){return db[_0xcdc7('0x2d')][_0xcdc7('0x49')](_0x3ed5d7[_0xcdc7('0x4a')],{})[_0xcdc7('0x26')](respondWithResult(_0x1e1a6a,0xc9))[_0xcdc7('0x44')](handleError(_0x1e1a6a,null));};exports[_0xcdc7('0x25')]=function(_0x298794,_0x2699ca){if(_0x298794['body']['id']){delete _0x298794[_0xcdc7('0x4a')]['id'];}return db['DeskField'][_0xcdc7('0x48')]({'where':{'id':_0x298794[_0xcdc7('0x4b')]['id']}})[_0xcdc7('0x26')](handleEntityNotFound(_0x2699ca,null))[_0xcdc7('0x26')](saveUpdates(_0x298794[_0xcdc7('0x4a')],null))[_0xcdc7('0x26')](respondWithResult(_0x2699ca,null))[_0xcdc7('0x44')](handleError(_0x2699ca,null));};exports[_0xcdc7('0x27')]=function(_0x5436df,_0x20e853){return db['DeskField']['find']({'where':{'id':_0x5436df['params']['id']}})['then'](handleEntityNotFound(_0x20e853,null))[_0xcdc7('0x26')](removeEntity(_0x20e853,null))[_0xcdc7('0x44')](handleError(_0x20e853,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d203a0d..8037756 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 _0xa347=['path','./intDeskField.attributes','desk_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0xa347,0x12d));var _0x7a34=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0xa347[_0x1c289a];return _0x28d68e;};'use strict';var _=require(_0x7a34('0x0'));var util=require(_0x7a34('0x1'));var logger=require('../../config/logger')(_0x7a34('0x2'));var moment=require(_0x7a34('0x3'));var BPromise=require(_0x7a34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a34('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a34('0x6'));module['exports']=function(_0x108a6a,_0x11df06){return _0x108a6a['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7a34('0x7'),'fields':[_0x7a34('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0da3=['lodash','moment','bluebird','request-promise','rimraf','define','int_desk_fields','desk_unique_index','idField'];(function(_0x578c7a,_0x277bd1){var _0x4c9d66=function(_0xf09cd1){while(--_0xf09cd1){_0x578c7a['push'](_0x578c7a['shift']());}};_0x4c9d66(++_0x277bd1);}(_0x0da3,0x6c));var _0x30da=function(_0x5c058c,_0x392858){_0x5c058c=_0x5c058c-0x0;var _0x50fb79=_0x0da3[_0x5c058c];return _0x50fb79;};'use strict';var _=require(_0x30da('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x30da('0x1'));var BPromise=require(_0x30da('0x2'));var rp=require(_0x30da('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30da('0x4'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x1db68a,_0x434e76){return _0x1db68a[_0x30da('0x5')]('DeskField',attributes,{'tableName':_0x30da('0x6'),'paranoid':![],'indexes':[{'name':_0x30da('0x7'),'fields':[_0x30da('0x8'),'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 25dae8b..4c34a79 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 _0x3e48=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x59d1e1,_0x3bc8c1){var _0x2e0a0a=function(_0x2baf90){while(--_0x2baf90){_0x59d1e1['push'](_0x59d1e1['shift']());}};_0x2e0a0a(++_0x3bc8c1);}(_0x3e48,0x10b));var _0x83e4=function(_0x1d798a,_0x45fb7e){_0x1d798a=_0x1d798a-0x0;var _0x5cd71f=_0x3e48[_0x1d798a];return _0x5cd71f;};'use strict';var _=require(_0x83e4('0x0'));var util=require('util');var moment=require(_0x83e4('0x1'));var BPromise=require(_0x83e4('0x2'));var rs=require(_0x83e4('0x3'));var fs=require('fs');var Redis=require(_0x83e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e4('0x5'))(_0x83e4('0x6'));var config=require('../../config/environment');var jayson=require(_0x83e4('0x7'));var client=jayson[_0x83e4('0x8')][_0x83e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e99e,_0x1eab2b,_0x1af94d){return new BPromise(function(_0x747514,_0x18b4ad){return client[_0x83e4('0xa')](_0x23e99e,_0x1af94d)[_0x83e4('0xb')](function(_0x1500f7){logger['info']('DeskField,\x20%s,\x20%s',_0x1eab2b,_0x83e4('0xc'));logger[_0x83e4('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1eab2b,_0x83e4('0xc'),JSON[_0x83e4('0xe')](_0x1500f7));if(_0x1500f7[_0x83e4('0xf')]){if(_0x1500f7[_0x83e4('0xf')][_0x83e4('0x10')]===0x1f4){logger['error'](_0x83e4('0x11'),_0x1eab2b,_0x1500f7[_0x83e4('0xf')][_0x83e4('0x12')]);return _0x18b4ad(_0x1500f7[_0x83e4('0xf')]['message']);}logger[_0x83e4('0xf')](_0x83e4('0x11'),_0x1eab2b,_0x1500f7[_0x83e4('0xf')]['message']);return _0x747514(_0x1500f7['error']['message']);}else{logger[_0x83e4('0x13')](_0x83e4('0x11'),_0x1eab2b,_0x83e4('0xc'));_0x747514(_0x1500f7['result']['message']);}})[_0x83e4('0x14')](function(_0x210e7b){logger[_0x83e4('0xf')](_0x83e4('0x11'),_0x1eab2b,_0x210e7b);_0x18b4ad(_0x210e7b);});});} \ No newline at end of file +var _0xf065=['http','request','then','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xf065,0x70));var _0x5f06=function(_0x2d1f2e,_0x3e03cd){_0x2d1f2e=_0x2d1f2e-0x0;var _0x2cae46=_0xf065[_0x2d1f2e];return _0x2cae46;};'use strict';var _=require('lodash');var util=require(_0x5f06('0x0'));var moment=require(_0x5f06('0x1'));var BPromise=require(_0x5f06('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f06('0x3'));var db=require(_0x5f06('0x4'))['db'];var utils=require(_0x5f06('0x5'));var logger=require('../../config/logger')(_0x5f06('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5f06('0x7')][_0x5f06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ed57,_0x141e03,_0x35ae32){return new BPromise(function(_0x1422a0,_0x2ee18e){return client[_0x5f06('0x9')](_0x11ed57,_0x35ae32)[_0x5f06('0xa')](function(_0x46e71b){logger['info'](_0x5f06('0xb'),_0x141e03,'request\x20sent');logger['debug'](_0x5f06('0xc'),_0x141e03,_0x5f06('0xd'),JSON[_0x5f06('0xe')](_0x46e71b));if(_0x46e71b['error']){if(_0x46e71b[_0x5f06('0xf')][_0x5f06('0x10')]===0x1f4){logger[_0x5f06('0xf')](_0x5f06('0xb'),_0x141e03,_0x46e71b['error'][_0x5f06('0x11')]);return _0x2ee18e(_0x46e71b['error']['message']);}logger[_0x5f06('0xf')]('DeskField,\x20%s,\x20%s',_0x141e03,_0x46e71b[_0x5f06('0xf')]['message']);return _0x1422a0(_0x46e71b['error'][_0x5f06('0x11')]);}else{logger[_0x5f06('0x12')](_0x5f06('0xb'),_0x141e03,'request\x20sent');_0x1422a0(_0x46e71b['result'][_0x5f06('0x11')]);}})[_0x5f06('0x13')](function(_0x12e058){logger['error']('DeskField,\x20%s,\x20%s',_0x141e03,_0x12e058);_0x2ee18e(_0x12e058);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 2991586..a441869 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 _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x122415,_0xb08425){var _0x3ac79d=function(_0x622fe0){while(--_0x622fe0){_0x122415['push'](_0x122415['shift']());}};_0x3ac79d(++_0xb08425);}(_0x4fc2,0x111));var _0x24fc=function(_0x51489,_0x3e95a4){_0x51489=_0x51489-0x0;var _0x3ead23=_0x4fc2[_0x51489];return _0x3ead23;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18ae6d,_0x255d00){_0x18ae6d=_0x18ae6d-0x0;var _0x3deb94=_0x0b0e[_0x18ae6d];return _0x3deb94;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getFields']);router[_0xe0b0('0xf')]('/',auth[_0xe0b0('0x9')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['addConfiguration']);router[_0xe0b0('0x10')](_0xe0b0('0xb'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x12')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x13')]);module[_0xe0b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8156fe4..b2b1321 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 _0x2252=['STRING','sequelize','exports'];(function(_0x10fbde,_0xbbdf02){var _0x351bc3=function(_0x4dcbb0){while(--_0x4dcbb0){_0x10fbde['push'](_0x10fbde['shift']());}};_0x351bc3(++_0xbbdf02);}(_0x2252,0x1c3));var _0x2225=function(_0x44c885,_0x46534e){_0x44c885=_0x44c885-0x0;var _0x3c6113=_0x2252[_0x44c885];return _0x3c6113;};'use strict';var Sequelize=require(_0x2225('0x0'));module[_0x2225('0x1')]={'name':{'type':Sequelize[_0x2225('0x2')]},'username':{'type':Sequelize[_0x2225('0x2')]},'password':{'type':Sequelize[_0x2225('0x2')]},'remoteUri':{'type':Sequelize[_0x2225('0x2')]},'tenantId':{'type':Sequelize[_0x2225('0x2')]},'clientId':{'type':Sequelize[_0x2225('0x2')]},'clientSecret':{'type':Sequelize[_0x2225('0x2')]},'serverUrl':{'type':Sequelize[_0x2225('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2225('0x2')]}}; \ No newline at end of file +var _0xb962=['STRING','sequelize'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xb962,0xf3));var _0x2b96=function(_0xa7e9af,_0x24399d){_0xa7e9af=_0xa7e9af-0x0;var _0xf7ab00=_0xb962[_0xa7e9af];return _0xf7ab00;};'use strict';var Sequelize=require(_0x2b96('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b96('0x1')]},'username':{'type':Sequelize[_0x2b96('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2b96('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2b96('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2b96('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1bc0d2a..71cbd9d 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 _0x5075=['accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','remoteUri','tenantId','clientId','slice','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\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','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','Dynamics365Account','count','includeAll','rows','show','params','include','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','subject','directioncode','phonecall_activity_parties'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x5075,0x73));var _0x5507=function(_0x29d5ce,_0x1503e9){_0x29d5ce=_0x29d5ce-0x0;var _0x266f7b=_0x5075[_0x29d5ce];return _0x266f7b;};'use strict';var pdf=require(_0x5507('0x0'));var emlformat=require(_0x5507('0x1'));var rimraf=require(_0x5507('0x2'));var zipdir=require(_0x5507('0x3'));var jsonpatch=require(_0x5507('0x4'));var rp=require(_0x5507('0x5'));var moment=require(_0x5507('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5507('0xa'));var fs=require('fs');var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];var integrations=require(_0x5507('0x18'));var jayson=require(_0x5507('0x19'));var client=jayson[_0x5507('0x1a')][_0x5507('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1f3886,_0x59889b,_0x9cc3f9,_0x2b7c43){return new BPromise(function(_0xc828e5,_0x46545d){var _0x4df473=_0x2b7c43||client;return _0x4df473[_0x5507('0x1c')](_0x1f3886,_0x9cc3f9)[_0x5507('0x1d')](function(_0x2dfd06){logger[_0x5507('0x1e')](_0x5507('0x1f'),_0x59889b,_0x5507('0x20'));logger[_0x5507('0x21')](_0x5507('0x22'),_0x59889b,_0x5507('0x20'),JSON[_0x5507('0x23')](_0x2dfd06));if(_0x2dfd06[_0x5507('0x24')]){if(_0x2dfd06[_0x5507('0x24')][_0x5507('0x25')]===0x1f4){logger['error'](_0x5507('0x1f'),_0x59889b,_0x2dfd06[_0x5507('0x24')][_0x5507('0x26')]);return _0x46545d(_0x2dfd06[_0x5507('0x24')]['message']);}logger[_0x5507('0x24')](_0x5507('0x1f'),_0x59889b,_0x2dfd06[_0x5507('0x24')][_0x5507('0x26')]);return _0xc828e5(_0x2dfd06[_0x5507('0x24')][_0x5507('0x26')]);}else{logger['info'](_0x5507('0x1f'),_0x59889b,_0x5507('0x20'));_0xc828e5(_0x2dfd06[_0x5507('0x27')][_0x5507('0x26')]);}})[_0x5507('0x28')](function(_0x2de482){logger[_0x5507('0x24')](_0x5507('0x1f'),_0x59889b,_0x2de482);_0x46545d(_0x2de482);});});}function respondWithStatusCode(_0x398911,_0xa47641){_0xa47641=_0xa47641||0xcc;return function(_0xc9a266){if(_0xc9a266){return _0x398911[_0x5507('0x29')](_0xa47641);}return _0x398911[_0x5507('0x2a')](_0xa47641)[_0x5507('0x2b')]();};}function respondWithResult(_0x1a2203,_0x4915ed){_0x4915ed=_0x4915ed||0xc8;return function(_0x4e8906){if(_0x4e8906){return _0x1a2203['status'](_0x4915ed)[_0x5507('0x2c')](_0x4e8906);}};}function respondWithFilteredResult(_0x4ea271,_0xa66a01){return function(_0x24668b){if(_0x24668b){var _0x4beb0a=_0x24668b['count'],_0x5cbb09=_0xa66a01[_0x5507('0x2d')],_0xbe8d32=_0xa66a01[_0x5507('0x2d')]+_0xa66a01[_0x5507('0x2e')],_0x1a18d0;if(_0xbe8d32>=_0x4beb0a){_0xbe8d32=_0x4beb0a;_0x1a18d0=0xc8;}else{_0x1a18d0=0xce;}_0x4ea271[_0x5507('0x2a')](_0x1a18d0);return _0x4ea271[_0x5507('0x2f')](_0x5507('0x30'),_0x5cbb09+'-'+_0xbe8d32+'/'+_0x4beb0a)['json'](_0x24668b);}return null;};}function patchUpdates(_0x4422ef){return function(_0x9c1468){try{jsonpatch[_0x5507('0x31')](_0x9c1468,_0x4422ef,!![]);}catch(_0x38f0f5){return BPromise[_0x5507('0x32')](_0x38f0f5);}return _0x9c1468['save']();};}function saveUpdates(_0x51e692,_0x3b09be){return function(_0x37c364){if(_0x37c364){return _0x37c364[_0x5507('0x33')](_0x51e692)[_0x5507('0x1d')](function(_0x5e6f25){return _0x5e6f25;});}return null;};}function removeEntity(_0x777eb7,_0x13b6e5){return function(_0xab91bc){if(_0xab91bc){return _0xab91bc[_0x5507('0x34')]()[_0x5507('0x1d')](function(){_0x777eb7[_0x5507('0x2a')](0xcc)[_0x5507('0x2b')]();});}};}function handleEntityNotFound(_0x27c8c8,_0x5ede36){return function(_0xf61ba7){if(!_0xf61ba7){_0x27c8c8[_0x5507('0x29')](0x194);}return _0xf61ba7;};}function handleError(_0x1b69f3,_0x51ca35){_0x51ca35=_0x51ca35||0x1f4;return function(_0x49485b){logger[_0x5507('0x24')](_0x49485b[_0x5507('0x35')]);if(_0x49485b[_0x5507('0x36')]){delete _0x49485b[_0x5507('0x36')];}_0x1b69f3[_0x5507('0x2a')](_0x51ca35)['send'](_0x49485b);};}exports['index']=function(_0x10bfb2,_0x1f1974){var _0x3a452d={},_0x1b9115={},_0x5dcd57={'count':0x0,'rows':[]};var _0x54e4bd=_[_0x5507('0x37')](db['Dynamics365Account'][_0x5507('0x38')],function(_0x1b32a7){return{'name':_0x1b32a7[_0x5507('0x39')],'type':_0x1b32a7[_0x5507('0x3a')][_0x5507('0x3b')]};});_0x1b9115[_0x5507('0x3c')]=_[_0x5507('0x37')](_0x54e4bd,_0x5507('0x36'));_0x1b9115[_0x5507('0x3d')]=_[_0x5507('0x3e')](_0x10bfb2['query']);_0x1b9115['filters']=_['intersection'](_0x1b9115['model'],_0x1b9115[_0x5507('0x3d')]);_0x3a452d[_0x5507('0x3f')]=_[_0x5507('0x40')](_0x1b9115[_0x5507('0x3c')],qs[_0x5507('0x41')](_0x10bfb2[_0x5507('0x3d')][_0x5507('0x41')]));_0x3a452d[_0x5507('0x3f')]=_0x3a452d[_0x5507('0x3f')][_0x5507('0x42')]?_0x3a452d[_0x5507('0x3f')]:_0x1b9115[_0x5507('0x3c')];if(!_0x10bfb2[_0x5507('0x3d')][_0x5507('0x43')]('nolimit')){_0x3a452d['limit']=qs['limit'](_0x10bfb2[_0x5507('0x3d')][_0x5507('0x2e')]);_0x3a452d[_0x5507('0x2d')]=qs[_0x5507('0x2d')](_0x10bfb2[_0x5507('0x3d')][_0x5507('0x2d')]);}_0x3a452d[_0x5507('0x44')]=qs[_0x5507('0x45')](_0x10bfb2[_0x5507('0x3d')][_0x5507('0x45')]);_0x3a452d[_0x5507('0x46')]=qs[_0x5507('0x47')](_[_0x5507('0x48')](_0x10bfb2[_0x5507('0x3d')],_0x1b9115[_0x5507('0x47')]),_0x54e4bd);if(_0x10bfb2[_0x5507('0x3d')][_0x5507('0x49')]){_0x3a452d[_0x5507('0x46')]=_[_0x5507('0x4a')](_0x3a452d['where'],{'$or':_[_0x5507('0x37')](_0x54e4bd,function(_0x113f74){if(_0x113f74['type']!=='VIRTUAL'){var _0x111aa4={};_0x111aa4[_0x113f74[_0x5507('0x36')]]={'$like':'%'+_0x10bfb2[_0x5507('0x3d')][_0x5507('0x49')]+'%'};return _0x111aa4;}})});}_0x3a452d=_[_0x5507('0x4a')]({},_0x3a452d,_0x10bfb2['options']);var _0x4dccbc={'where':_0x3a452d[_0x5507('0x46')]};return db[_0x5507('0x4b')]['count'](_0x4dccbc)[_0x5507('0x1d')](function(_0x33022e){_0x5dcd57[_0x5507('0x4c')]=_0x33022e;if(_0x10bfb2[_0x5507('0x3d')][_0x5507('0x4d')]){_0x3a452d['include']=[{'all':!![]}];}return db[_0x5507('0x4b')]['findAll'](_0x3a452d);})[_0x5507('0x1d')](function(_0x3504bd){_0x5dcd57[_0x5507('0x4e')]=_0x3504bd;return _0x5dcd57;})[_0x5507('0x1d')](respondWithFilteredResult(_0x1f1974,_0x3a452d))[_0x5507('0x28')](handleError(_0x1f1974,null));};exports[_0x5507('0x4f')]=function(_0x418c2e,_0x3452e4){var _0x549cf0={'raw':![],'where':{'id':_0x418c2e[_0x5507('0x50')]['id']}},_0x36aee1={};_0x36aee1['model']=_['keys'](db['Dynamics365Account'][_0x5507('0x38')]);_0x36aee1['query']=_[_0x5507('0x3e')](_0x418c2e['query']);_0x36aee1[_0x5507('0x47')]=_['intersection'](_0x36aee1['model'],_0x36aee1[_0x5507('0x3d')]);_0x549cf0[_0x5507('0x3f')]=_[_0x5507('0x40')](_0x36aee1[_0x5507('0x3c')],qs[_0x5507('0x41')](_0x418c2e[_0x5507('0x3d')]['fields']));_0x549cf0[_0x5507('0x3f')]=_0x549cf0[_0x5507('0x3f')][_0x5507('0x42')]?_0x549cf0['attributes']:_0x36aee1[_0x5507('0x3c')];if(_0x418c2e[_0x5507('0x3d')][_0x5507('0x4d')]){_0x549cf0[_0x5507('0x51')]=[{'all':!![]}];}_0x549cf0=_[_0x5507('0x4a')]({},_0x549cf0,_0x418c2e[_0x5507('0x52')]);return db[_0x5507('0x4b')][_0x5507('0x53')](_0x549cf0)[_0x5507('0x1d')](handleEntityNotFound(_0x3452e4,null))[_0x5507('0x1d')](respondWithResult(_0x3452e4,null))[_0x5507('0x28')](handleError(_0x3452e4,null));};exports['create']=function(_0x570928,_0x1992fa){return db[_0x5507('0x4b')][_0x5507('0x54')](_0x570928[_0x5507('0x55')],{})[_0x5507('0x1d')](respondWithResult(_0x1992fa,0xc9))[_0x5507('0x28')](handleError(_0x1992fa,null));};exports[_0x5507('0x33')]=function(_0x2686ce,_0x3c22f7){if(_0x2686ce[_0x5507('0x55')]['id']){delete _0x2686ce[_0x5507('0x55')]['id'];}return db[_0x5507('0x4b')][_0x5507('0x53')]({'where':{'id':_0x2686ce[_0x5507('0x50')]['id']}})[_0x5507('0x1d')](handleEntityNotFound(_0x3c22f7,null))[_0x5507('0x1d')](saveUpdates(_0x2686ce['body'],null))[_0x5507('0x1d')](respondWithResult(_0x3c22f7,null))['catch'](handleError(_0x3c22f7,null));};exports['destroy']=function(_0x42be15,_0xf15d25){return db[_0x5507('0x4b')][_0x5507('0x53')]({'where':{'id':_0x42be15['params']['id']}})[_0x5507('0x1d')](handleEntityNotFound(_0xf15d25,null))[_0x5507('0x1d')](removeEntity(_0xf15d25,null))[_0x5507('0x28')](handleError(_0xf15d25,null));};exports[_0x5507('0x56')]=function(_0x2a8d18,_0x3a272f,_0x5d2881){var _0x36b485={};var _0x46e589={};var _0x3a2f9f;var _0x4e9801;return db['Dynamics365Account'][_0x5507('0x57')]({'where':{'id':_0x2a8d18['params']['id']}})[_0x5507('0x1d')](handleEntityNotFound(_0x3a272f,null))[_0x5507('0x1d')](function(_0x5cd12e){if(_0x5cd12e){_0x3a2f9f=_0x5cd12e;_0x46e589[_0x5507('0x3c')]=_[_0x5507('0x3e')](db[_0x5507('0x58')][_0x5507('0x38')]);_0x46e589[_0x5507('0x3d')]=_[_0x5507('0x3e')](_0x2a8d18[_0x5507('0x3d')]);_0x46e589[_0x5507('0x47')]=_[_0x5507('0x40')](_0x46e589[_0x5507('0x3c')],_0x46e589[_0x5507('0x3d')]);_0x36b485[_0x5507('0x3f')]=_['intersection'](_0x46e589[_0x5507('0x3c')],qs[_0x5507('0x41')](_0x2a8d18[_0x5507('0x3d')][_0x5507('0x41')]));_0x36b485[_0x5507('0x3f')]=_0x36b485['attributes'][_0x5507('0x42')]?_0x36b485['attributes']:_0x46e589[_0x5507('0x3c')];_0x36b485[_0x5507('0x44')]=qs[_0x5507('0x45')](_0x2a8d18['query'][_0x5507('0x45')]);_0x36b485[_0x5507('0x46')]=qs[_0x5507('0x47')](_['pick'](_0x2a8d18[_0x5507('0x3d')],_0x46e589['filters']));if(_0x2a8d18[_0x5507('0x3d')]['filter']){_0x36b485['where']=_[_0x5507('0x4a')](_0x36b485[_0x5507('0x46')],{'$or':_[_0x5507('0x37')](_0x36b485[_0x5507('0x3f')],function(_0x2d7729){var _0x31cc0d={};_0x31cc0d[_0x2d7729]={'$like':'%'+_0x2a8d18['query']['filter']+'%'};return _0x31cc0d;})});}_0x36b485=_[_0x5507('0x4a')]({},_0x36b485,_0x2a8d18[_0x5507('0x52')]);return _0x3a2f9f[_0x5507('0x56')](_0x36b485);}})[_0x5507('0x1d')](function(_0x5e3e73){if(_0x5e3e73){_0x4e9801=_0x5e3e73[_0x5507('0x42')];if(!_0x2a8d18[_0x5507('0x3d')][_0x5507('0x43')](_0x5507('0x59'))){_0x36b485[_0x5507('0x2e')]=qs[_0x5507('0x2e')](_0x2a8d18[_0x5507('0x3d')]['limit']);_0x36b485[_0x5507('0x2d')]=qs[_0x5507('0x2d')](_0x2a8d18[_0x5507('0x3d')]['offset']);}return _0x3a2f9f[_0x5507('0x56')](_0x36b485);}})['then'](function(_0x4f031b){if(_0x4f031b){return _0x4f031b?{'count':_0x4e9801,'rows':_0x4f031b}:null;}})['then'](respondWithResult(_0x3a272f,null))[_0x5507('0x28')](handleError(_0x3a272f,null));};exports[_0x5507('0x5a')]=function(_0xb622bd,_0x10e409,_0x399370){if(_0xb622bd[_0x5507('0x55')]['id']){delete _0xb622bd[_0x5507('0x55')]['id'];}return db['Dynamics365Account'][_0x5507('0x57')]({'where':{'id':_0xb622bd['params']['id']}})[_0x5507('0x1d')](handleEntityNotFound(_0x10e409,null))[_0x5507('0x1d')](function(_0x40f2d9){if(_0x40f2d9){_0xb622bd[_0x5507('0x55')][_0x5507('0x5b')]=_0x40f2d9['id'];_0xb622bd[_0x5507('0x55')][_0x5507('0x5c')]=integrations[_0x5507('0x5d')](_0xb622bd[_0x5507('0x55')][_0x5507('0x5e')],_0xb622bd[_0x5507('0x55')]['type']);_0xb622bd[_0x5507('0x55')][_0x5507('0x5f')]=integrations[_0x5507('0x60')](_0xb622bd['body'][_0x5507('0x5e')],_0xb622bd[_0x5507('0x55')]['type']);return db[_0x5507('0x58')]['create'](_0xb622bd['body'],{'include':[{'model':db[_0x5507('0x61')],'as':'Subjects'},{'model':db[_0x5507('0x61')],'as':_0x5507('0x5f')}]});}return null;})[_0x5507('0x1d')](respondWithResult(_0x10e409,null))[_0x5507('0x28')](handleError(_0x10e409,null));};exports[_0x5507('0x62')]=function(_0x36c56b,_0x483cde,_0x43fccf){var _0x323dbf=_0x36c56b[_0x5507('0x3d')][_0x5507('0x63')];var _0x10427f=_0x323dbf===_0x5507('0x64')?_0x5507('0x65'):_0x5507('0x66');var _0x4141ac='';var _0x1674ce='';var _0x130039='';var _0x430a03='';var _0x4985e9='';var _0x255b14='';var _0x3e8804='';var _0x10f066='';var _0x2afdac=[_0x5507('0x67'),_0x5507('0x68'),'customerid',_0x5507('0x69'),'caseorigincode',_0x5507('0x6a'),'phonenumber','regardingobjectid',_0x5507('0x6b'),_0x5507('0x6c')];var _0x2979b1=[_0x5507('0x6d'),_0x5507('0x6e'),'actualserviceunits',_0x5507('0x6f'),'contactidname',_0x5507('0x70'),_0x5507('0x71'),_0x5507('0x72'),_0x5507('0x73'),'createdbyexternalpartyyominame',_0x5507('0x74'),_0x5507('0x75'),_0x5507('0x76'),'createdonbehalfbyname','createdonbehalfbyyominame',_0x5507('0x77'),_0x5507('0x78'),_0x5507('0x79'),_0x5507('0x7a'),_0x5507('0x7b'),_0x5507('0x7c'),_0x5507('0x7d'),_0x5507('0x7e'),_0x5507('0x7f'),_0x5507('0x80'),_0x5507('0x81'),_0x5507('0x82'),'influencescore',_0x5507('0x83'),_0x5507('0x84'),_0x5507('0x85'),_0x5507('0x86'),_0x5507('0x87'),_0x5507('0x88'),_0x5507('0x89'),'modifiedon',_0x5507('0x8a'),_0x5507('0x8b'),_0x5507('0x8c'),_0x5507('0x8d'),'numberofchildincidents',_0x5507('0x8e'),_0x5507('0x8f'),_0x5507('0x90'),_0x5507('0x91'),_0x5507('0x92'),_0x5507('0x93'),_0x5507('0x94'),'primarycontactidyominame',_0x5507('0x95'),_0x5507('0x96'),_0x5507('0x97'),_0x5507('0x98'),_0x5507('0x99'),'responseby',_0x5507('0x9a'),_0x5507('0x9b'),_0x5507('0x9c'),_0x5507('0x9d'),_0x5507('0x9e'),_0x5507('0x9f'),_0x5507('0xa0'),_0x5507('0xa1'),_0x5507('0xa2'),_0x5507('0xa3'),_0x5507('0xa4'),_0x5507('0xa5'),_0x5507('0xa6'),'utcconversiontimezonecode','versionnumber'];var _0x4d34e3=_0x2afdac[_0x5507('0xa7')](_0x2979b1);return db[_0x5507('0x4b')][_0x5507('0x57')]({'where':{'id':_0x36c56b[_0x5507('0x50')]['id']},'attributes':['id',_0x5507('0xa8'),'password',_0x5507('0xa9'),_0x5507('0xaa'),_0x5507('0xab'),'clientSecret']})[_0x5507('0x1d')](handleEntityNotFound(_0x483cde,null))['then'](function(_0x4d5f26){if(_0x4d5f26){_0x10f066=_0x4d5f26[_0x5507('0xa9')];var _0x58b56c=_0x10f066[_0x5507('0xac')](-0x1);if(_0x58b56c==='/'){_0x10f066=_0x10f066['substring'](0x0,_0x10f066[_0x5507('0xad')](_0x58b56c));}_0x3e8804=util[_0x5507('0xae')](_0x5507('0xaf'),_0x10f066);var _0x51317e={'method':'POST','uri':_0x5507('0xb0')+_0x4d5f26[_0x5507('0xaa')]+_0x5507('0xb1'),'form':{'client_id':_0x4d5f26['clientId'],'resource':_0x10f066,'username':_0x4d5f26[_0x5507('0xa8')],'password':_0x4d5f26[_0x5507('0xb2')],'grant_type':_0x5507('0xb2'),'client_secret':_0x4d5f26[_0x5507('0xb3')]},'json':!![]};return rp(_0x51317e);}})['then'](function(_0x4fe16e){_0x255b14=_0x4fe16e[_0x5507('0xb4')];var _0x159361={'method':'GET','uri':encodeURI(_0x3e8804+_0x5507('0xb5')+_0x10427f+'\x27'),'headers':{'Authorization':_0x5507('0xb6')+_0x255b14,'If-None-Match':null,'OData-Version':_0x5507('0xb7')},'json':!![]};return rp(_0x159361);})[_0x5507('0x1d')](function(_0x5ce1df){var _0x2eb477=_0x5ce1df[_0x5507('0xb8')][0x0];var _0x5ad4b1=_0x2eb477[_0x5507('0xb9')];var _0x1ff88e={'method':_0x5507('0xba'),'uri':_0x3e8804+'EntityDefinitions('+_0x5ad4b1+_0x5507('0xbb'),'headers':{'Authorization':_0x5507('0xb6')+_0x255b14,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ff88e);})[_0x5507('0x1d')](function(_0x3f13c6){_0x4141ac=_0x3f13c6;_0x1674ce=_0x4141ac['Attributes'];_0x1674ce=_[_0x5507('0xbc')](_0x1674ce,function(_0xf5f975){return!_0x4d34e3[_0x5507('0xbd')](_0xf5f975['LogicalName']);});var _0xc7baee=[];var _0x4debb9=[];_0x1674ce[_0x5507('0xbe')](function(_0x214dd8){if(_0x214dd8[_0x5507('0xbf')]){var _0x462af2=_0x214dd8[_0x5507('0xbf')]['substring'](_0x214dd8[_0x5507('0xbf')][_0x5507('0xad')]('.')+0x1);if(_0x462af2===_0x5507('0xc0')){_0xc7baee[_0x5507('0xc1')](getSelectList(_0x3e8804,_0x323dbf,_0x4debb9,_0x4141ac['MetadataId'],_0x214dd8['MetadataId'],_0x255b14));}}});return Promise[_0x5507('0xc2')](_0xc7baee);})['then'](function(_0x395a4a){_0x130039=_0x395a4a[0x0];var _0x204058=[];var _0x2c56ee=[];_0x1674ce['forEach'](function(_0x30ad0b){if(!_[_0x5507('0xc3')](_0x30ad0b['@odata.type'])){var _0x2fbcf9=_0x30ad0b[_0x5507('0xbf')][_0x5507('0xc4')](_0x30ad0b[_0x5507('0xbf')][_0x5507('0xad')]('.')+0x1);if(_0x2fbcf9===_0x5507('0xc5')){_0x204058['push'](getBooleanList(_0x3e8804,_0x323dbf,_0x2c56ee,_0x4141ac[_0x5507('0xb9')],_0x30ad0b[_0x5507('0xb9')],_0x255b14));}}});return Promise['all'](_0x204058);})[_0x5507('0x1d')](function(_0x399fd1){_0x430a03=_0x399fd1[0x0];var _0x46ebb0=[];var _0x199909=[];_0x1674ce[_0x5507('0xbe')](function(_0x3a49f6){if(_0x3a49f6[_0x5507('0xbf')]){var _0x1c6e3=_0x3a49f6[_0x5507('0xbf')][_0x5507('0xc4')](_0x3a49f6[_0x5507('0xbf')]['lastIndexOf']('.')+0x1);if(_0x1c6e3===_0x5507('0xc6')||_0x1c6e3==='DoubleAttributeMetadata'||_0x1c6e3===_0x5507('0xc7')||_0x1c6e3===_0x5507('0xc8')||_0x1c6e3===_0x5507('0xc9')||_0x1c6e3===_0x5507('0xca')||_0x1c6e3===_0x5507('0xcb')||_0x1c6e3===_0x5507('0xcc')||_0x1c6e3===_0x5507('0xcd')||_0x1c6e3===_0x5507('0xce')){_0x46ebb0[_0x5507('0xc1')](getInputList(_0x3e8804,_0x323dbf,_0x1c6e3,_0x199909,_0x4141ac[_0x5507('0xb9')],_0x3a49f6[_0x5507('0xb9')],_0x255b14));}}});return Promise[_0x5507('0xc2')](_0x46ebb0);})[_0x5507('0x1d')](function(_0x13f089){_0x4985e9=_0x13f089[0x0];var _0x497d35=_0x130039[_0x5507('0xa7')](_0x430a03)[_0x5507('0xa7')](_0x4985e9);var _0x11d6c3={'count':_0x497d35[_0x5507('0x42')],'rows':_0x497d35};return _0x11d6c3;})[_0x5507('0x1d')](respondWithResult(_0x483cde,null))[_0x5507('0x28')](function(_0x31beb0){var _0x3fface=_0x36c56b[_0x5507('0x3d')][_0x5507('0xcf')]?0x1f4:_0x31beb0[_0x5507('0xd0')]||0x1f4;logger[_0x5507('0x24')](_0x31beb0[_0x5507('0x35')]);delete _0x31beb0[_0x5507('0x36')];if(_0x3fface===0x191){_0x3fface=0x190;}_0x483cde[_0x5507('0x2a')](_0x3fface)[_0x5507('0xd1')](_0x36c56b[_0x5507('0x3d')][_0x5507('0xcf')]?{'message':_0x5507('0xd2'),'statusCode':_0x31beb0[_0x5507('0xd0')]}:_0x31beb0);});};function getSelectList(_0x55f651,_0x4db0ee,_0x10f98e,_0x599a13,_0x56662c,_0x110efb){var _0x234f51={'method':_0x5507('0xba'),'uri':_0x55f651+_0x5507('0xd3')+_0x599a13+_0x5507('0xd4')+_0x56662c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x5507('0xb6')+_0x110efb,'If-None-Match':null,'OData-Version':_0x5507('0xb7')},'json':!![]};return rp(_0x234f51)['then'](function(_0xc329ec){var _0x26f8f3=[];var _0x3e8989=_0xc329ec[_0x5507('0xd5')][_0x5507('0xd6')];_0x3e8989[_0x5507('0xbe')](function(_0x44f613){_0x26f8f3[_0x5507('0xc1')]({'name':_0x44f613[_0x5507('0xd7')][_0x5507('0xd8')][_0x5507('0xd7')],'value':String(_0x44f613[_0x5507('0xd9')])});});var _0x54de28={'id':_0x4db0ee+'_'+_0xc329ec[_0x5507('0xda')],'name':_0xc329ec['DisplayName'][_0x5507('0xd8')][_0x5507('0xd7')],'custom':![],'options':_0x26f8f3};_0x10f98e[_0x5507('0xc1')](_0x54de28);return _0x10f98e;});}function getBooleanList(_0x18b127,_0x2cfdef,_0x59bd7e,_0x209612,_0x2a1917,_0x37ca9f){var _0x16bd95={'method':_0x5507('0xba'),'uri':_0x18b127+_0x5507('0xd3')+_0x209612+')/Attributes('+_0x2a1917+_0x5507('0xdb'),'headers':{'Authorization':_0x5507('0xb6')+_0x37ca9f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16bd95)[_0x5507('0x1d')](function(_0x4c0614){var _0x64661=[];_0x64661[_0x5507('0xc1')]({'name':_0x4c0614[_0x5507('0xd5')]['TrueOption'][_0x5507('0xd7')][_0x5507('0xd8')][_0x5507('0xd7')],'value':_0x5507('0xdc')},{'name':_0x4c0614[_0x5507('0xd5')][_0x5507('0xdd')][_0x5507('0xd7')]['UserLocalizedLabel'][_0x5507('0xd7')],'value':_0x5507('0xde')});var _0xf80e99={'id':_0x2cfdef+'_'+_0x4c0614[_0x5507('0xda')],'name':_0x4c0614[_0x5507('0xdf')][_0x5507('0xd8')][_0x5507('0xd7')],'custom':![],'options':_0x64661};_0x59bd7e['push'](_0xf80e99);return _0x59bd7e;});}function getInputList(_0x1f01fc,_0x101691,_0x33a0cd,_0x418626,_0x1f2841,_0x18111d,_0x46930b){var _0x360a6e={'method':'GET','uri':_0x1f01fc+_0x5507('0xd3')+_0x1f2841+_0x5507('0xd4')+_0x18111d+')/Microsoft.Dynamics.CRM.'+_0x33a0cd+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x5507('0xb6')+_0x46930b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x360a6e)[_0x5507('0x1d')](function(_0x42648a){var _0x3224fa={'id':_0x101691+'_'+_0x42648a[_0x5507('0xda')],'name':_0x42648a[_0x5507('0xdf')][_0x5507('0xd8')]?_0x42648a['DisplayName']['UserLocalizedLabel'][_0x5507('0xd7')]:_0x42648a[_0x5507('0xda')],'custom':![],'options':[]};_0x418626[_0x5507('0xc1')](_0x3224fa);return _0x418626;});} \ No newline at end of file +var _0x2eb2=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','keys','options','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','PhoneCall','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','all','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','4.0','OptionSet','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv'];(function(_0x51c2ae,_0x501471){var _0x75f314=function(_0x501695){while(--_0x501695){_0x51c2ae['push'](_0x51c2ae['shift']());}};_0x75f314(++_0x501471);}(_0x2eb2,0x19f));var _0x22eb=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2eb2[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22eb('0x0'));var rimraf=require(_0x22eb('0x1'));var zipdir=require(_0x22eb('0x2'));var jsonpatch=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var moment=require(_0x22eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x22eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x22eb('0x7'));var csv=require(_0x22eb('0x8'));var ejs=require(_0x22eb('0x9'));var fs=require('fs');var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x8'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x22eb('0x16'));var jayson=require(_0x22eb('0x17'));var client=jayson[_0x22eb('0x18')][_0x22eb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x427439,_0x49e37e,_0x350ade,_0x53f14e){return new BPromise(function(_0x1f5089,_0x55ede8){var _0x40c8cb=_0x53f14e||client;return _0x40c8cb[_0x22eb('0x1a')](_0x427439,_0x350ade)['then'](function(_0x48b63c){logger['info'](_0x22eb('0x1b'),_0x49e37e,'request\x20sent');logger['debug'](_0x22eb('0x1c'),_0x49e37e,'request\x20sent',JSON['stringify'](_0x48b63c));if(_0x48b63c[_0x22eb('0x1d')]){if(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1e')]===0x1f4){logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x48b63c['error'][_0x22eb('0x1f')]);return _0x55ede8(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1f')]);}logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x48b63c['error'][_0x22eb('0x1f')]);return _0x1f5089(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1f')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x49e37e,_0x22eb('0x20'));_0x1f5089(_0x48b63c[_0x22eb('0x21')][_0x22eb('0x1f')]);}})[_0x22eb('0x22')](function(_0x2d95f0){logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x2d95f0);_0x55ede8(_0x2d95f0);});});}function respondWithStatusCode(_0x4e7e69,_0x2e8f7c){_0x2e8f7c=_0x2e8f7c||0xcc;return function(_0x11edbd){if(_0x11edbd){return _0x4e7e69[_0x22eb('0x23')](_0x2e8f7c);}return _0x4e7e69[_0x22eb('0x24')](_0x2e8f7c)[_0x22eb('0x25')]();};}function respondWithResult(_0x4da252,_0x12c133){_0x12c133=_0x12c133||0xc8;return function(_0x6f8ff3){if(_0x6f8ff3){return _0x4da252[_0x22eb('0x24')](_0x12c133)['json'](_0x6f8ff3);}};}function respondWithFilteredResult(_0xe0783c,_0x259847){return function(_0x4b409a){if(_0x4b409a){var _0x32a4b6=_0x4b409a[_0x22eb('0x26')],_0x222ef3=_0x259847['offset'],_0x1e3015=_0x259847['offset']+_0x259847[_0x22eb('0x27')],_0x2924f6;if(_0x1e3015>=_0x32a4b6){_0x1e3015=_0x32a4b6;_0x2924f6=0xc8;}else{_0x2924f6=0xce;}_0xe0783c[_0x22eb('0x24')](_0x2924f6);return _0xe0783c[_0x22eb('0x28')](_0x22eb('0x29'),_0x222ef3+'-'+_0x1e3015+'/'+_0x32a4b6)[_0x22eb('0x2a')](_0x4b409a);}return null;};}function patchUpdates(_0x14724e){return function(_0x2375e7){try{jsonpatch[_0x22eb('0x2b')](_0x2375e7,_0x14724e,!![]);}catch(_0x382784){return BPromise[_0x22eb('0x2c')](_0x382784);}return _0x2375e7[_0x22eb('0x2d')]();};}function saveUpdates(_0x5a37f8,_0x54f401){return function(_0x2f5a25){if(_0x2f5a25){return _0x2f5a25['update'](_0x5a37f8)[_0x22eb('0x2e')](function(_0x1e035a){return _0x1e035a;});}return null;};}function removeEntity(_0xd564a9,_0x11199f){return function(_0x351ed8){if(_0x351ed8){return _0x351ed8[_0x22eb('0x2f')]()[_0x22eb('0x2e')](function(){_0xd564a9[_0x22eb('0x24')](0xcc)[_0x22eb('0x25')]();});}};}function handleEntityNotFound(_0x232af4,_0x509bb7){return function(_0x49259f){if(!_0x49259f){_0x232af4[_0x22eb('0x23')](0x194);}return _0x49259f;};}function handleError(_0x5ceec1,_0x55ee20){_0x55ee20=_0x55ee20||0x1f4;return function(_0x2caba3){logger[_0x22eb('0x1d')](_0x2caba3[_0x22eb('0x30')]);if(_0x2caba3[_0x22eb('0x31')]){delete _0x2caba3[_0x22eb('0x31')];}_0x5ceec1[_0x22eb('0x24')](_0x55ee20)[_0x22eb('0x32')](_0x2caba3);};}exports[_0x22eb('0x33')]=function(_0x7f169,_0x21e66b){var _0x5e8167={},_0x9c8193={},_0x47be01={'count':0x0,'rows':[]};var _0x5c43e7=_[_0x22eb('0x34')](db[_0x22eb('0x35')]['rawAttributes'],function(_0x42e9bd){return{'name':_0x42e9bd[_0x22eb('0x36')],'type':_0x42e9bd[_0x22eb('0x37')][_0x22eb('0x38')]};});_0x9c8193[_0x22eb('0x39')]=_['map'](_0x5c43e7,_0x22eb('0x31'));_0x9c8193[_0x22eb('0x3a')]=_['keys'](_0x7f169[_0x22eb('0x3a')]);_0x9c8193[_0x22eb('0x3b')]=_[_0x22eb('0x3c')](_0x9c8193[_0x22eb('0x39')],_0x9c8193[_0x22eb('0x3a')]);_0x5e8167['attributes']=_['intersection'](_0x9c8193[_0x22eb('0x39')],qs[_0x22eb('0x3d')](_0x7f169['query'][_0x22eb('0x3d')]));_0x5e8167[_0x22eb('0x3e')]=_0x5e8167[_0x22eb('0x3e')]['length']?_0x5e8167[_0x22eb('0x3e')]:_0x9c8193[_0x22eb('0x39')];if(!_0x7f169[_0x22eb('0x3a')][_0x22eb('0x3f')](_0x22eb('0x40'))){_0x5e8167[_0x22eb('0x27')]=qs['limit'](_0x7f169[_0x22eb('0x3a')][_0x22eb('0x27')]);_0x5e8167['offset']=qs[_0x22eb('0x41')](_0x7f169[_0x22eb('0x3a')][_0x22eb('0x41')]);}_0x5e8167[_0x22eb('0x42')]=qs[_0x22eb('0x43')](_0x7f169[_0x22eb('0x3a')][_0x22eb('0x43')]);_0x5e8167[_0x22eb('0x44')]=qs[_0x22eb('0x3b')](_[_0x22eb('0x45')](_0x7f169[_0x22eb('0x3a')],_0x9c8193[_0x22eb('0x3b')]),_0x5c43e7);if(_0x7f169[_0x22eb('0x3a')][_0x22eb('0x46')]){_0x5e8167[_0x22eb('0x44')]=_[_0x22eb('0x47')](_0x5e8167[_0x22eb('0x44')],{'$or':_[_0x22eb('0x34')](_0x5c43e7,function(_0x507f21){if(_0x507f21[_0x22eb('0x37')]!==_0x22eb('0x48')){var _0x5d074b={};_0x5d074b[_0x507f21[_0x22eb('0x31')]]={'$like':'%'+_0x7f169[_0x22eb('0x3a')]['filter']+'%'};return _0x5d074b;}})});}_0x5e8167=_['merge']({},_0x5e8167,_0x7f169['options']);var _0xada312={'where':_0x5e8167[_0x22eb('0x44')]};return db['Dynamics365Account']['count'](_0xada312)[_0x22eb('0x2e')](function(_0x43f771){_0x47be01[_0x22eb('0x26')]=_0x43f771;if(_0x7f169[_0x22eb('0x3a')][_0x22eb('0x49')]){_0x5e8167[_0x22eb('0x4a')]=[{'all':!![]}];}return db[_0x22eb('0x35')][_0x22eb('0x4b')](_0x5e8167);})['then'](function(_0x58ded8){_0x47be01[_0x22eb('0x4c')]=_0x58ded8;return _0x47be01;})['then'](respondWithFilteredResult(_0x21e66b,_0x5e8167))[_0x22eb('0x22')](handleError(_0x21e66b,null));};exports['show']=function(_0x8a2b2c,_0x5c41c0){var _0x4b2f86={'raw':![],'where':{'id':_0x8a2b2c['params']['id']}},_0x4e48a8={};_0x4e48a8[_0x22eb('0x39')]=_['keys'](db[_0x22eb('0x35')][_0x22eb('0x4d')]);_0x4e48a8['query']=_[_0x22eb('0x4e')](_0x8a2b2c['query']);_0x4e48a8[_0x22eb('0x3b')]=_[_0x22eb('0x3c')](_0x4e48a8[_0x22eb('0x39')],_0x4e48a8[_0x22eb('0x3a')]);_0x4b2f86[_0x22eb('0x3e')]=_[_0x22eb('0x3c')](_0x4e48a8[_0x22eb('0x39')],qs[_0x22eb('0x3d')](_0x8a2b2c[_0x22eb('0x3a')]['fields']));_0x4b2f86[_0x22eb('0x3e')]=_0x4b2f86[_0x22eb('0x3e')]['length']?_0x4b2f86[_0x22eb('0x3e')]:_0x4e48a8[_0x22eb('0x39')];if(_0x8a2b2c[_0x22eb('0x3a')][_0x22eb('0x49')]){_0x4b2f86['include']=[{'all':!![]}];}_0x4b2f86=_[_0x22eb('0x47')]({},_0x4b2f86,_0x8a2b2c[_0x22eb('0x4f')]);return db[_0x22eb('0x35')][_0x22eb('0x50')](_0x4b2f86)[_0x22eb('0x2e')](handleEntityNotFound(_0x5c41c0,null))[_0x22eb('0x2e')](respondWithResult(_0x5c41c0,null))['catch'](handleError(_0x5c41c0,null));};exports[_0x22eb('0x51')]=function(_0x4e5b9f,_0x3ff406){return db['Dynamics365Account'][_0x22eb('0x51')](_0x4e5b9f[_0x22eb('0x52')],{})[_0x22eb('0x2e')](respondWithResult(_0x3ff406,0xc9))[_0x22eb('0x22')](handleError(_0x3ff406,null));};exports[_0x22eb('0x53')]=function(_0x4aa0c5,_0x4896ed){if(_0x4aa0c5[_0x22eb('0x52')]['id']){delete _0x4aa0c5[_0x22eb('0x52')]['id'];}return db['Dynamics365Account'][_0x22eb('0x50')]({'where':{'id':_0x4aa0c5[_0x22eb('0x54')]['id']}})[_0x22eb('0x2e')](handleEntityNotFound(_0x4896ed,null))[_0x22eb('0x2e')](saveUpdates(_0x4aa0c5[_0x22eb('0x52')],null))[_0x22eb('0x2e')](respondWithResult(_0x4896ed,null))[_0x22eb('0x22')](handleError(_0x4896ed,null));};exports[_0x22eb('0x2f')]=function(_0x19f496,_0x133068){return db[_0x22eb('0x35')]['find']({'where':{'id':_0x19f496[_0x22eb('0x54')]['id']}})[_0x22eb('0x2e')](handleEntityNotFound(_0x133068,null))[_0x22eb('0x2e')](removeEntity(_0x133068,null))[_0x22eb('0x22')](handleError(_0x133068,null));};exports[_0x22eb('0x55')]=function(_0x24465a,_0x15d191,_0x3871ef){var _0x26fc89={};var _0x9f8465={};var _0x3e9ab5;var _0x108607;return db[_0x22eb('0x35')][_0x22eb('0x56')]({'where':{'id':_0x24465a['params']['id']}})['then'](handleEntityNotFound(_0x15d191,null))[_0x22eb('0x2e')](function(_0x91c8a3){if(_0x91c8a3){_0x3e9ab5=_0x91c8a3;_0x9f8465[_0x22eb('0x39')]=_[_0x22eb('0x4e')](db[_0x22eb('0x57')]['rawAttributes']);_0x9f8465[_0x22eb('0x3a')]=_[_0x22eb('0x4e')](_0x24465a['query']);_0x9f8465['filters']=_[_0x22eb('0x3c')](_0x9f8465[_0x22eb('0x39')],_0x9f8465[_0x22eb('0x3a')]);_0x26fc89[_0x22eb('0x3e')]=_[_0x22eb('0x3c')](_0x9f8465[_0x22eb('0x39')],qs[_0x22eb('0x3d')](_0x24465a[_0x22eb('0x3a')][_0x22eb('0x3d')]));_0x26fc89[_0x22eb('0x3e')]=_0x26fc89[_0x22eb('0x3e')][_0x22eb('0x58')]?_0x26fc89[_0x22eb('0x3e')]:_0x9f8465[_0x22eb('0x39')];_0x26fc89['order']=qs[_0x22eb('0x43')](_0x24465a[_0x22eb('0x3a')][_0x22eb('0x43')]);_0x26fc89['where']=qs[_0x22eb('0x3b')](_['pick'](_0x24465a[_0x22eb('0x3a')],_0x9f8465['filters']));if(_0x24465a[_0x22eb('0x3a')][_0x22eb('0x46')]){_0x26fc89['where']=_[_0x22eb('0x47')](_0x26fc89[_0x22eb('0x44')],{'$or':_['map'](_0x26fc89['attributes'],function(_0x32819b){var _0x3073b1={};_0x3073b1[_0x32819b]={'$like':'%'+_0x24465a[_0x22eb('0x3a')][_0x22eb('0x46')]+'%'};return _0x3073b1;})});}_0x26fc89=_[_0x22eb('0x47')]({},_0x26fc89,_0x24465a[_0x22eb('0x4f')]);return _0x3e9ab5['getConfigurations'](_0x26fc89);}})[_0x22eb('0x2e')](function(_0x5d035b){if(_0x5d035b){_0x108607=_0x5d035b['length'];if(!_0x24465a[_0x22eb('0x3a')][_0x22eb('0x3f')](_0x22eb('0x40'))){_0x26fc89[_0x22eb('0x27')]=qs[_0x22eb('0x27')](_0x24465a[_0x22eb('0x3a')][_0x22eb('0x27')]);_0x26fc89[_0x22eb('0x41')]=qs['offset'](_0x24465a['query'][_0x22eb('0x41')]);}return _0x3e9ab5[_0x22eb('0x55')](_0x26fc89);}})['then'](function(_0x2274f3){if(_0x2274f3){return _0x2274f3?{'count':_0x108607,'rows':_0x2274f3}:null;}})[_0x22eb('0x2e')](respondWithResult(_0x15d191,null))[_0x22eb('0x22')](handleError(_0x15d191,null));};exports[_0x22eb('0x59')]=function(_0x40faf6,_0x3ff700,_0x5ce4ea){if(_0x40faf6[_0x22eb('0x52')]['id']){delete _0x40faf6[_0x22eb('0x52')]['id'];}return db[_0x22eb('0x35')]['findOne']({'where':{'id':_0x40faf6['params']['id']}})[_0x22eb('0x2e')](handleEntityNotFound(_0x3ff700,null))[_0x22eb('0x2e')](function(_0xa4178f){if(_0xa4178f){_0x40faf6['body'][_0x22eb('0x5a')]=_0xa4178f['id'];_0x40faf6['body'][_0x22eb('0x5b')]=integrations[_0x22eb('0x5c')](_0x40faf6[_0x22eb('0x52')][_0x22eb('0x5d')],_0x40faf6['body'][_0x22eb('0x37')]);_0x40faf6[_0x22eb('0x52')][_0x22eb('0x5e')]=integrations[_0x22eb('0x5f')](_0x40faf6[_0x22eb('0x52')][_0x22eb('0x5d')],_0x40faf6[_0x22eb('0x52')][_0x22eb('0x37')]);return db[_0x22eb('0x57')][_0x22eb('0x51')](_0x40faf6[_0x22eb('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':_0x22eb('0x5b')},{'model':db[_0x22eb('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3ff700,null))['catch'](handleError(_0x3ff700,null));};exports[_0x22eb('0x61')]=function(_0x60a37b,_0x50c3ba,_0x10726f){var _0x15e08a=_0x60a37b[_0x22eb('0x3a')][_0x22eb('0x62')];var _0x8cbc83=_0x15e08a==='incident'?'Incident':_0x22eb('0x63');var _0x2c61ca='';var _0xaa8950='';var _0x4fffb3='';var _0x5a5a51='';var _0xc6af66='';var _0x4be2d4='';var _0x4d893a='';var _0x3568bc='';var _0xe524a1=['title','description',_0x22eb('0x64'),_0x22eb('0x65'),'caseorigincode',_0x22eb('0x66'),_0x22eb('0x67'),_0x22eb('0x68'),'directioncode',_0x22eb('0x69')];var _0x26fb52=[_0x22eb('0x6a'),_0x22eb('0x6b'),_0x22eb('0x6c'),'billedserviceunits',_0x22eb('0x6d'),_0x22eb('0x6e'),_0x22eb('0x6f'),'contractidname','createdbyexternalpartyname',_0x22eb('0x70'),_0x22eb('0x71'),_0x22eb('0x72'),'createdon',_0x22eb('0x73'),_0x22eb('0x74'),_0x22eb('0x75'),'customeridtype',_0x22eb('0x76'),'emailaddress','entitlementidname',_0x22eb('0x77'),_0x22eb('0x78'),_0x22eb('0x79'),'exchangerate',_0x22eb('0x7a'),_0x22eb('0x7b'),_0x22eb('0x7c'),_0x22eb('0x7d'),_0x22eb('0x7e'),'lastonholdtime',_0x22eb('0x7f'),'modifiedbyexternalpartyname',_0x22eb('0x80'),_0x22eb('0x81'),_0x22eb('0x82'),'modifiedon',_0x22eb('0x83'),_0x22eb('0x84'),_0x22eb('0x85'),_0x22eb('0x86'),_0x22eb('0x87'),_0x22eb('0x88'),_0x22eb('0x89'),_0x22eb('0x8a'),_0x22eb('0x8b'),_0x22eb('0x8c'),_0x22eb('0x8d'),'primarycontactidname',_0x22eb('0x8e'),_0x22eb('0x8f'),_0x22eb('0x90'),_0x22eb('0x91'),'resolveby',_0x22eb('0x92'),_0x22eb('0x93'),'responsiblecontactidname',_0x22eb('0x94'),_0x22eb('0x95'),_0x22eb('0x96'),_0x22eb('0x97'),_0x22eb('0x98'),_0x22eb('0x99'),_0x22eb('0x9a'),'subjectidname',_0x22eb('0x9b'),_0x22eb('0x9c'),'transactioncurrencyidname','traversedpath',_0x22eb('0x9d'),_0x22eb('0x9e')];var _0x3424a6=_0xe524a1[_0x22eb('0x9f')](_0x26fb52);return db[_0x22eb('0x35')]['findOne']({'where':{'id':_0x60a37b['params']['id']},'attributes':['id',_0x22eb('0xa0'),_0x22eb('0xa1'),'remoteUri',_0x22eb('0xa2'),_0x22eb('0xa3'),_0x22eb('0xa4')]})['then'](handleEntityNotFound(_0x50c3ba,null))[_0x22eb('0x2e')](function(_0x345a23){if(_0x345a23){_0x3568bc=_0x345a23[_0x22eb('0xa5')];var _0x402c2c=_0x3568bc[_0x22eb('0xa6')](-0x1);if(_0x402c2c==='/'){_0x3568bc=_0x3568bc[_0x22eb('0xa7')](0x0,_0x3568bc[_0x22eb('0xa8')](_0x402c2c));}_0x4d893a=util[_0x22eb('0xa9')]('%s/api/data/v9.0/',_0x3568bc);var _0x4f63a3={'method':'POST','uri':_0x22eb('0xaa')+_0x345a23['tenantId']+'/oauth2/token','form':{'client_id':_0x345a23[_0x22eb('0xa3')],'resource':_0x3568bc,'username':_0x345a23[_0x22eb('0xa0')],'password':_0x345a23['password'],'grant_type':_0x22eb('0xa1'),'client_secret':_0x345a23[_0x22eb('0xa4')]},'json':!![]};return rp(_0x4f63a3);}})[_0x22eb('0x2e')](function(_0x1d81d7){_0x4be2d4=_0x1d81d7['access_token'];var _0x3220c8={'method':_0x22eb('0xab'),'uri':encodeURI(_0x4d893a+_0x22eb('0xac')+_0x8cbc83+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4be2d4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3220c8);})['then'](function(_0x12566f){var _0x12039a=_0x12566f[_0x22eb('0xad')][0x0];var _0x50c62b=_0x12039a[_0x22eb('0xae')];var _0x4b3d1d={'method':'GET','uri':_0x4d893a+_0x22eb('0xaf')+_0x50c62b+_0x22eb('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x4be2d4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b3d1d);})[_0x22eb('0x2e')](function(_0x1f9cd5){_0x2c61ca=_0x1f9cd5;_0xaa8950=_0x2c61ca[_0x22eb('0xb1')];_0xaa8950=_[_0x22eb('0xb2')](_0xaa8950,function(_0x165c7d){return!_0x3424a6['includes'](_0x165c7d['LogicalName']);});var _0x860db=[];var _0x31f41f=[];_0xaa8950[_0x22eb('0xb3')](function(_0x5614eb){if(_0x5614eb[_0x22eb('0xb4')]){var _0x5524dc=_0x5614eb['@odata.type'][_0x22eb('0xa7')](_0x5614eb[_0x22eb('0xb4')]['lastIndexOf']('.')+0x1);if(_0x5524dc===_0x22eb('0xb5')){_0x860db['push'](getSelectList(_0x4d893a,_0x15e08a,_0x31f41f,_0x2c61ca[_0x22eb('0xae')],_0x5614eb['MetadataId'],_0x4be2d4));}}});return Promise[_0x22eb('0xb6')](_0x860db);})['then'](function(_0x64cd9e){_0x4fffb3=_0x64cd9e[0x0];var _0x3b8f42=[];var _0x451710=[];_0xaa8950[_0x22eb('0xb3')](function(_0x43ace3){if(!_['isNil'](_0x43ace3[_0x22eb('0xb4')])){var _0x5eaacd=_0x43ace3[_0x22eb('0xb4')][_0x22eb('0xa7')](_0x43ace3[_0x22eb('0xb4')][_0x22eb('0xa8')]('.')+0x1);if(_0x5eaacd===_0x22eb('0xb7')){_0x3b8f42[_0x22eb('0xb8')](getBooleanList(_0x4d893a,_0x15e08a,_0x451710,_0x2c61ca['MetadataId'],_0x43ace3[_0x22eb('0xae')],_0x4be2d4));}}});return Promise['all'](_0x3b8f42);})['then'](function(_0x9a44eb){_0x5a5a51=_0x9a44eb[0x0];var _0x277b27=[];var _0x701fd0=[];_0xaa8950['forEach'](function(_0x5deb48){if(_0x5deb48[_0x22eb('0xb4')]){var _0x5a7009=_0x5deb48[_0x22eb('0xb4')][_0x22eb('0xa7')](_0x5deb48[_0x22eb('0xb4')][_0x22eb('0xa8')]('.')+0x1);if(_0x5a7009===_0x22eb('0xb9')||_0x5a7009===_0x22eb('0xba')||_0x5a7009===_0x22eb('0xbb')||_0x5a7009===_0x22eb('0xbc')||_0x5a7009===_0x22eb('0xbd')||_0x5a7009==='DateTimeAttributeMetadata'||_0x5a7009===_0x22eb('0xbe')||_0x5a7009===_0x22eb('0xbf')||_0x5a7009===_0x22eb('0xc0')||_0x5a7009===_0x22eb('0xc1')){_0x277b27[_0x22eb('0xb8')](getInputList(_0x4d893a,_0x15e08a,_0x5a7009,_0x701fd0,_0x2c61ca[_0x22eb('0xae')],_0x5deb48[_0x22eb('0xae')],_0x4be2d4));}}});return Promise[_0x22eb('0xb6')](_0x277b27);})[_0x22eb('0x2e')](function(_0x435930){_0xc6af66=_0x435930[0x0];var _0x4b6834=_0x4fffb3[_0x22eb('0x9f')](_0x5a5a51)['concat'](_0xc6af66);var _0x1a9a7c={'count':_0x4b6834[_0x22eb('0x58')],'rows':_0x4b6834};return _0x1a9a7c;})[_0x22eb('0x2e')](respondWithResult(_0x50c3ba,null))[_0x22eb('0x22')](function(_0x219ca3){var _0x55d881=_0x60a37b[_0x22eb('0x3a')][_0x22eb('0xc2')]?0x1f4:_0x219ca3[_0x22eb('0xc3')]||0x1f4;logger[_0x22eb('0x1d')](_0x219ca3[_0x22eb('0x30')]);delete _0x219ca3[_0x22eb('0x31')];if(_0x55d881===0x191){_0x55d881=0x190;}_0x50c3ba[_0x22eb('0x24')](_0x55d881)['send'](_0x60a37b[_0x22eb('0x3a')][_0x22eb('0xc2')]?{'message':_0x22eb('0xc4'),'statusCode':_0x219ca3[_0x22eb('0xc3')]}:_0x219ca3);});};function getSelectList(_0x4b0abc,_0x270a45,_0x36aaec,_0x246521,_0xa4685d,_0xba0348){var _0x2e4de7={'method':_0x22eb('0xab'),'uri':_0x4b0abc+'EntityDefinitions('+_0x246521+_0x22eb('0xc5')+_0xa4685d+_0x22eb('0xc6')+_0x22eb('0xc7'),'headers':{'Authorization':_0x22eb('0xc8')+_0xba0348,'If-None-Match':null,'OData-Version':_0x22eb('0xc9')},'json':!![]};return rp(_0x2e4de7)[_0x22eb('0x2e')](function(_0x26cd7b){var _0x4bf4e6=[];var _0x4f17e5=_0x26cd7b[_0x22eb('0xca')]['Options'];_0x4f17e5[_0x22eb('0xb3')](function(_0x4c38a2){_0x4bf4e6['push']({'name':_0x4c38a2[_0x22eb('0xcb')][_0x22eb('0xcc')][_0x22eb('0xcb')],'value':String(_0x4c38a2[_0x22eb('0xcd')])});});var _0x588016={'id':_0x270a45+'_'+_0x26cd7b[_0x22eb('0xce')],'name':_0x26cd7b[_0x22eb('0xcf')][_0x22eb('0xcc')]['Label'],'custom':![],'options':_0x4bf4e6};_0x36aaec[_0x22eb('0xb8')](_0x588016);return _0x36aaec;});}function getBooleanList(_0x44ecf7,_0x2030c1,_0x315a73,_0xc80612,_0x4f14cf,_0x2b6f41){var _0x3ce852={'method':_0x22eb('0xab'),'uri':_0x44ecf7+_0x22eb('0xaf')+_0xc80612+')/Attributes('+_0x4f14cf+_0x22eb('0xd0'),'headers':{'Authorization':_0x22eb('0xc8')+_0x2b6f41,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ce852)[_0x22eb('0x2e')](function(_0x9c17c7){var _0x294b91=[];_0x294b91[_0x22eb('0xb8')]({'name':_0x9c17c7[_0x22eb('0xca')][_0x22eb('0xd1')][_0x22eb('0xcb')][_0x22eb('0xcc')][_0x22eb('0xcb')],'value':'true'},{'name':_0x9c17c7[_0x22eb('0xca')][_0x22eb('0xd2')][_0x22eb('0xcb')][_0x22eb('0xcc')]['Label'],'value':'false'});var _0xa93e02={'id':_0x2030c1+'_'+_0x9c17c7['LogicalName'],'name':_0x9c17c7['DisplayName'][_0x22eb('0xcc')][_0x22eb('0xcb')],'custom':![],'options':_0x294b91};_0x315a73[_0x22eb('0xb8')](_0xa93e02);return _0x315a73;});}function getInputList(_0x39277b,_0x3b84ec,_0x44d9d5,_0x5cf6ee,_0x152919,_0x30a9a8,_0x378dbc){var _0x4c7c8e={'method':_0x22eb('0xab'),'uri':_0x39277b+'EntityDefinitions('+_0x152919+_0x22eb('0xc5')+_0x30a9a8+')/Microsoft.Dynamics.CRM.'+_0x44d9d5+_0x22eb('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x378dbc,'If-None-Match':null,'OData-Version':_0x22eb('0xc9')},'json':!![]};return rp(_0x4c7c8e)[_0x22eb('0x2e')](function(_0x292871){var _0x3113f6={'id':_0x3b84ec+'_'+_0x292871[_0x22eb('0xce')],'name':_0x292871[_0x22eb('0xcf')][_0x22eb('0xcc')]?_0x292871[_0x22eb('0xcf')][_0x22eb('0xcc')][_0x22eb('0xcb')]:_0x292871['LogicalName'],'custom':![],'options':[]};_0x5cf6ee[_0x22eb('0xb8')](_0x3113f6);return _0x5cf6ee;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e3d3839..69b6ac7 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 _0x794e=['api','moment','bluebird','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','../../config/logger'];(function(_0x749469,_0x1e6355){var _0x43b573=function(_0x4f602e){while(--_0x4f602e){_0x749469['push'](_0x749469['shift']());}};_0x43b573(++_0x1e6355);}(_0x794e,0x105));var _0xe794=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x794e[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xe794('0x0'));var util=require(_0xe794('0x1'));var logger=require(_0xe794('0x2'))(_0xe794('0x3'));var moment=require(_0xe794('0x4'));var BPromise=require(_0xe794('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe794('0x6'));var attributes=require(_0xe794('0x7'));var integrations=require(_0xe794('0x8'));module[_0xe794('0x9')]=function(_0x17452d,_0x1e9fa5){return _0x17452d[_0xe794('0xa')](_0xe794('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd0d=['path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','../../config/logger','moment','request-promise'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xfd0d,0x93));var _0xdfd0=function(_0xcfd04b,_0x36413c){_0xcfd04b=_0xcfd04b-0x0;var _0x4ad5a7=_0xfd0d[_0xcfd04b];return _0x4ad5a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdfd0('0x0'))('api');var moment=require(_0xdfd0('0x1'));var BPromise=require('bluebird');var rp=require(_0xdfd0('0x2'));var fs=require('fs');var path=require(_0xdfd0('0x3'));var rimraf=require('rimraf');var config=require(_0xdfd0('0x4'));var attributes=require(_0xdfd0('0x5'));var integrations=require(_0xdfd0('0x6'));module[_0xdfd0('0x7')]=function(_0x3568a6,_0x3f7e60){return _0x3568a6[_0xdfd0('0x8')]('Dynamics365Account',attributes,{'tableName':_0xdfd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f70aedb..57cb138 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 _0x398a=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','attributes','include','model','map','ShowDynamics365Account','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x41163b,_0x5b5b4c){var _0x46b29f=function(_0x7c83a7){while(--_0x7c83a7){_0x41163b['push'](_0x41163b['shift']());}};_0x46b29f(++_0x5b5b4c);}(_0x398a,0x11a));var _0xa398=function(_0x165180,_0x109d89){_0x165180=_0x165180-0x0;var _0x5559d3=_0x398a[_0x165180];return _0x5559d3;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var moment=require(_0xa398('0x2'));var BPromise=require(_0xa398('0x3'));var rs=require(_0xa398('0x4'));var fs=require('fs');var Redis=require(_0xa398('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa398('0x6'));var config=require(_0xa398('0x7'));var jayson=require(_0xa398('0x8'));var client=jayson[_0xa398('0x9')][_0xa398('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ac561,_0x1fa6cb,_0x24e456){return new BPromise(function(_0x468a9d,_0x2e26f0){return client['request'](_0x2ac561,_0x24e456)[_0xa398('0xb')](function(_0x3c7f25){logger[_0xa398('0xc')](_0xa398('0xd'),_0x1fa6cb,_0xa398('0xe'));logger[_0xa398('0xf')](_0xa398('0x10'),_0x1fa6cb,'request\x20sent',JSON[_0xa398('0x11')](_0x3c7f25));if(_0x3c7f25[_0xa398('0x12')]){if(_0x3c7f25[_0xa398('0x12')][_0xa398('0x13')]===0x1f4){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x2e26f0(_0x3c7f25['error'][_0xa398('0x14')]);}logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x468a9d(_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);}else{logger[_0xa398('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1fa6cb,_0xa398('0xe'));_0x468a9d(_0x3c7f25[_0xa398('0x15')]['message']);}})[_0xa398('0x16')](function(_0x42a001){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x42a001);_0x2e26f0(_0x42a001);});});}exports[_0xa398('0x17')]=function(_0x144c1f){var _0x2d7a48=this;return new Promise(function(_0x10fa7f,_0x42d112){return db[_0xa398('0x18')]['findAll']({'raw':_0x144c1f[_0xa398('0x19')]?_0x144c1f[_0xa398('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x144c1f['options']?_0x144c1f[_0xa398('0x19')]['where']||null:null,'attributes':_0x144c1f[_0xa398('0x19')]?_0x144c1f[_0xa398('0x19')][_0xa398('0x1a')]||null:null,'limit':_0x144c1f[_0xa398('0x19')]?_0x144c1f[_0xa398('0x19')]['limit']||null:null,'include':_0x144c1f[_0xa398('0x19')]?_0x144c1f[_0xa398('0x19')]['include']?_['map'](_0x144c1f['options'][_0xa398('0x1b')],function(_0x11ebc7){return{'model':db[_0x11ebc7[_0xa398('0x1c')]],'as':_0x11ebc7['as'],'attributes':_0x11ebc7['attributes'],'include':_0x11ebc7[_0xa398('0x1b')]?_[_0xa398('0x1d')](_0x11ebc7[_0xa398('0x1b')],function(_0x44692d){return{'model':db[_0x44692d['model']],'as':_0x44692d['as'],'attributes':_0x44692d[_0xa398('0x1a')],'include':_0x44692d[_0xa398('0x1b')]?_[_0xa398('0x1d')](_0x44692d[_0xa398('0x1b')],function(_0x7d1e04){return{'model':db[_0x7d1e04[_0xa398('0x1c')]],'as':_0x7d1e04['as'],'attributes':_0x7d1e04[_0xa398('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa398('0xb')](function(_0x498fb4){logger['info'](_0xa398('0x17'),_0x144c1f);logger[_0xa398('0xf')](_0xa398('0x17'),_0x144c1f,JSON[_0xa398('0x11')](_0x498fb4));_0x10fa7f(_0x498fb4);})[_0xa398('0x16')](function(_0x4641e8){logger['error'](_0xa398('0x17'),_0x4641e8['message'],_0x144c1f);_0x42d112(_0x2d7a48[_0xa398('0x12')](0x1f4,_0x4641e8['message']));});});};exports[_0xa398('0x1e')]=function(_0xbb3509){var _0x4674d9=this;return new Promise(function(_0x36516b,_0x253039){return db[_0xa398('0x18')]['find']({'raw':_0xbb3509[_0xa398('0x19')]?_0xbb3509[_0xa398('0x19')][_0xa398('0x1f')]===undefined?!![]:![]:!![],'where':_0xbb3509[_0xa398('0x19')]?_0xbb3509[_0xa398('0x19')][_0xa398('0x20')]||null:null,'attributes':_0xbb3509[_0xa398('0x19')]?_0xbb3509['options'][_0xa398('0x1a')]||null:null,'include':_0xbb3509[_0xa398('0x19')]?_0xbb3509[_0xa398('0x19')][_0xa398('0x1b')]?_['map'](_0xbb3509[_0xa398('0x19')][_0xa398('0x1b')],function(_0x2e5c6b){return{'model':db[_0x2e5c6b['model']],'as':_0x2e5c6b['as'],'attributes':_0x2e5c6b[_0xa398('0x1a')],'include':_0x2e5c6b[_0xa398('0x1b')]?_[_0xa398('0x1d')](_0x2e5c6b[_0xa398('0x1b')],function(_0x1bd48b){return{'model':db[_0x1bd48b[_0xa398('0x1c')]],'as':_0x1bd48b['as'],'attributes':_0x1bd48b[_0xa398('0x1a')],'include':_0x1bd48b['include']?_[_0xa398('0x1d')](_0x1bd48b['include'],function(_0x16d92b){return{'model':db[_0x16d92b['model']],'as':_0x16d92b['as'],'attributes':_0x16d92b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55f8c8){logger[_0xa398('0xc')](_0xa398('0x1e'),_0xbb3509);logger[_0xa398('0xf')](_0xa398('0x1e'),_0xbb3509,JSON[_0xa398('0x11')](_0x55f8c8));_0x36516b(_0x55f8c8);})[_0xa398('0x16')](function(_0xef4e9e){logger[_0xa398('0x12')]('ShowDynamics365Account',_0xef4e9e[_0xa398('0x14')],_0xbb3509);_0x253039(_0x4674d9[_0xa398('0x12')](0x1f4,_0xef4e9e[_0xa398('0x14')]));});});}; \ No newline at end of file +var _0x6209=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','limit','include','map','model','attributes','where','ShowDynamics365Account','catch','lodash','util'];(function(_0x51a182,_0x5639a7){var _0x46aa3e=function(_0x287abb){while(--_0x287abb){_0x51a182['push'](_0x51a182['shift']());}};_0x46aa3e(++_0x5639a7);}(_0x6209,0x1e8));var _0x9620=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x6209[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});}exports[_0x9620('0x17')]=function(_0x4b81ea){var _0x10a166=this;return new Promise(function(_0x16514e,_0x2c8975){return db[_0x9620('0x18')][_0x9620('0x19')]({'raw':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b81ea['options']?_0x4b81ea['options']['where']||null:null,'attributes':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['attributes']||null:null,'limit':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1b')]||null:null,'include':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x4b81ea['options']['include'],function(_0x1d8665){return{'model':db[_0x1d8665[_0x9620('0x1e')]],'as':_0x1d8665['as'],'attributes':_0x1d8665['attributes'],'include':_0x1d8665[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x1d8665[_0x9620('0x1c')],function(_0x156298){return{'model':db[_0x156298[_0x9620('0x1e')]],'as':_0x156298['as'],'attributes':_0x156298[_0x9620('0x1f')],'include':_0x156298[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x156298[_0x9620('0x1c')],function(_0x30c0cf){return{'model':db[_0x30c0cf[_0x9620('0x1e')]],'as':_0x30c0cf['as'],'attributes':_0x30c0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9620('0xc')](function(_0x3e40aa){logger[_0x9620('0xd')](_0x9620('0x17'),_0x4b81ea);logger['debug']('GetDynamics365Account',_0x4b81ea,JSON[_0x9620('0x12')](_0x3e40aa));_0x16514e(_0x3e40aa);})['catch'](function(_0xf2cb11){logger['error']('GetDynamics365Account',_0xf2cb11[_0x9620('0x15')],_0x4b81ea);_0x2c8975(_0x10a166[_0x9620('0x13')](0x1f4,_0xf2cb11[_0x9620('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x19ddaf){var _0x186b4f=this;return new Promise(function(_0x42bfe6,_0x4cc78e){return db[_0x9620('0x18')]['find']({'raw':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')][_0x9620('0x20')]||null:null,'attributes':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf['options']['attributes']||null:null,'include':_0x19ddaf['options']?_0x19ddaf['options'][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x19ddaf['options'][_0x9620('0x1c')],function(_0x3d80f9){return{'model':db[_0x3d80f9['model']],'as':_0x3d80f9['as'],'attributes':_0x3d80f9[_0x9620('0x1f')],'include':_0x3d80f9[_0x9620('0x1c')]?_['map'](_0x3d80f9[_0x9620('0x1c')],function(_0x360c64){return{'model':db[_0x360c64[_0x9620('0x1e')]],'as':_0x360c64['as'],'attributes':_0x360c64[_0x9620('0x1f')],'include':_0x360c64['include']?_[_0x9620('0x1d')](_0x360c64['include'],function(_0x908b02){return{'model':db[_0x908b02[_0x9620('0x1e')]],'as':_0x908b02['as'],'attributes':_0x908b02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b213f){logger[_0x9620('0xd')](_0x9620('0x21'),_0x19ddaf);logger[_0x9620('0x10')](_0x9620('0x21'),_0x19ddaf,JSON['stringify'](_0x2b213f));_0x42bfe6(_0x2b213f);})[_0x9620('0x22')](function(_0x2d87fa){logger[_0x9620('0x13')](_0x9620('0x21'),_0x2d87fa[_0x9620('0x15')],_0x19ddaf);_0x4cc78e(_0x186b4f['error'](0x1f4,_0x2d87fa[_0x9620('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2429f2f..2ab43da 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 _0x4b2e=['getDescriptions','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5aa50d,_0x3044bd){var _0x4d17d6=function(_0x40016d){while(--_0x40016d){_0x5aa50d['push'](_0x5aa50d['shift']());}};_0x4d17d6(++_0x3044bd);}(_0x4b2e,0x1e7));var _0xe4b2=function(_0x3dc3a6,_0xb358ac){_0x3dc3a6=_0x3dc3a6-0x0;var _0x14bdeb=_0x4b2e[_0x3dc3a6];return _0x14bdeb;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require('path');var timeout=require(_0xe4b2('0x2'));var express=require(_0xe4b2('0x3'));var router=express[_0xe4b2('0x4')]();var auth=require(_0xe4b2('0x5'));var interaction=require(_0xe4b2('0x6'));var config=require(_0xe4b2('0x7'));var controller=require(_0xe4b2('0x8'));router[_0xe4b2('0x9')]('/',auth[_0xe4b2('0xa')](),controller[_0xe4b2('0xb')]);router[_0xe4b2('0x9')]('/:id',auth[_0xe4b2('0xa')](),controller[_0xe4b2('0xc')]);router[_0xe4b2('0x9')]('/:id/fields',auth[_0xe4b2('0xa')](),controller[_0xe4b2('0xd')]);router[_0xe4b2('0x9')](_0xe4b2('0xe'),auth[_0xe4b2('0xa')](),controller[_0xe4b2('0xf')]);router[_0xe4b2('0x9')](_0xe4b2('0x10'),auth[_0xe4b2('0xa')](),controller[_0xe4b2('0x11')]);router[_0xe4b2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe4b2('0x13')](_0xe4b2('0x14'),auth[_0xe4b2('0xa')](),controller[_0xe4b2('0x15')]);router[_0xe4b2('0x16')](_0xe4b2('0x14'),auth[_0xe4b2('0xa')](),controller['destroy']);module[_0xe4b2('0x17')]=router; \ No newline at end of file +var _0x0dfd=['../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5690f7,_0x1fd211){var _0x28a13c=function(_0x471dc1){while(--_0x471dc1){_0x5690f7['push'](_0x5690f7['shift']());}};_0x28a13c(++_0x1fd211);}(_0x0dfd,0x13c));var _0xd0df=function(_0x5d74c7,_0x3b2d10){_0x5d74c7=_0x5d74c7-0x0;var _0x37c923=_0x0dfd[_0x5d74c7];return _0x37c923;};'use strict';var multer=require(_0xd0df('0x0'));var util=require(_0xd0df('0x1'));var path=require(_0xd0df('0x2'));var timeout=require(_0xd0df('0x3'));var express=require(_0xd0df('0x4'));var router=express[_0xd0df('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd0df('0x6'));var config=require(_0xd0df('0x7'));var controller=require(_0xd0df('0x8'));router[_0xd0df('0x9')]('/',auth[_0xd0df('0xa')](),controller[_0xd0df('0xb')]);router[_0xd0df('0x9')](_0xd0df('0xc'),auth[_0xd0df('0xa')](),controller[_0xd0df('0xd')]);router[_0xd0df('0x9')]('/:id/fields',auth[_0xd0df('0xa')](),controller[_0xd0df('0xe')]);router[_0xd0df('0x9')](_0xd0df('0xf'),auth[_0xd0df('0xa')](),controller[_0xd0df('0x10')]);router[_0xd0df('0x9')](_0xd0df('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xd0df('0x12')]('/',auth[_0xd0df('0xa')](),controller[_0xd0df('0x13')]);router['put'](_0xd0df('0xc'),auth[_0xd0df('0xa')](),controller[_0xd0df('0x14')]);router['delete'](_0xd0df('0xc'),auth['isAuthenticated'](),controller[_0xd0df('0x15')]);module[_0xd0df('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 40e4ac8..c452a4c 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 _0x0480=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x0480,0x158));var _0x0048=function(_0x3b7ee5,_0x5e2bd7){_0x3b7ee5=_0x3b7ee5-0x0;var _0x2df6d2=_0x0480[_0x3b7ee5];return _0x2df6d2;};'use strict';var Sequelize=require(_0x0048('0x0'));module[_0x0048('0x1')]={'name':{'type':Sequelize[_0x0048('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x0048('0x3')](_0x0048('0x4'),_0x0048('0x5')),'defaultValue':_0x0048('0x4')}}; \ No newline at end of file +var _0x3d2f=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d2f,0x1b7));var _0xf3d2=function(_0x4d6298,_0x502f6b){_0x4d6298=_0x4d6298-0x0;var _0x57ccf0=_0x3d2f[_0x4d6298];return _0x57ccf0;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'name':{'type':Sequelize[_0xf3d2('0x2')]},'description':{'type':Sequelize[_0xf3d2('0x2')]},'ticketType':{'type':Sequelize[_0xf3d2('0x3')](_0xf3d2('0x4'),_0xf3d2('0x5')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7e45ff1..ea2a5fc 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 _0x3988=['merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','getFields','findOne','Dynamics365Field','order','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter'];(function(_0x432b0e,_0xe9b10c){var _0x43e9d2=function(_0x17f955){while(--_0x17f955){_0x432b0e['push'](_0x432b0e['shift']());}};_0x43e9d2(++_0xe9b10c);}(_0x3988,0x1e5));var _0x8398=function(_0x4168cf,_0x51f644){_0x4168cf=_0x4168cf-0x0;var _0x59341c=_0x3988[_0x4168cf];return _0x59341c;};'use strict';var pdf=require(_0x8398('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8398('0x1'));var zipdir=require(_0x8398('0x2'));var jsonpatch=require(_0x8398('0x3'));var rp=require('request-promise');var moment=require(_0x8398('0x4'));var BPromise=require(_0x8398('0x5'));var Mustache=require(_0x8398('0x6'));var util=require(_0x8398('0x7'));var path=require(_0x8398('0x8'));var sox=require(_0x8398('0x9'));var csv=require(_0x8398('0xa'));var ejs=require(_0x8398('0xb'));var fs=require('fs');var _=require(_0x8398('0xc'));var squel=require(_0x8398('0xd'));var crypto=require(_0x8398('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8398('0xf'));var toCsv=require(_0x8398('0xa'));var querystring=require(_0x8398('0x10'));var Papa=require(_0x8398('0x11'));var Redis=require('ioredis');var authService=require(_0x8398('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8398('0x13'));var logger=require(_0x8398('0x14'))(_0x8398('0x15'));var utils=require(_0x8398('0x16'));var config=require(_0x8398('0x17'));var licenseUtil=require(_0x8398('0x18'));var db=require(_0x8398('0x19'))['db'];var jayson=require(_0x8398('0x1a'));var client=jayson[_0x8398('0x1b')][_0x8398('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1f3d57,_0x3a30ae,_0x37b117,_0x30ca9d){return new BPromise(function(_0x485ba6,_0x5dd586){var _0x1089c5=_0x30ca9d||client;return _0x1089c5[_0x8398('0x1d')](_0x1f3d57,_0x37b117)['then'](function(_0x8387e5){logger['info'](_0x8398('0x1e'),_0x3a30ae,'request\x20sent');logger[_0x8398('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3a30ae,_0x8398('0x20'),JSON[_0x8398('0x21')](_0x8387e5));if(_0x8387e5[_0x8398('0x22')]){if(_0x8387e5[_0x8398('0x22')][_0x8398('0x23')]===0x1f4){logger[_0x8398('0x22')](_0x8398('0x1e'),_0x3a30ae,_0x8387e5[_0x8398('0x22')]['message']);return _0x5dd586(_0x8387e5[_0x8398('0x22')][_0x8398('0x24')]);}logger[_0x8398('0x22')](_0x8398('0x1e'),_0x3a30ae,_0x8387e5[_0x8398('0x22')]['message']);return _0x485ba6(_0x8387e5[_0x8398('0x22')][_0x8398('0x24')]);}else{logger['info'](_0x8398('0x1e'),_0x3a30ae,_0x8398('0x20'));_0x485ba6(_0x8387e5[_0x8398('0x25')]['message']);}})[_0x8398('0x26')](function(_0x28efd5){logger['error'](_0x8398('0x1e'),_0x3a30ae,_0x28efd5);_0x5dd586(_0x28efd5);});});}function respondWithStatusCode(_0x441a72,_0x4b6b7d){_0x4b6b7d=_0x4b6b7d||0xcc;return function(_0x14e6ab){if(_0x14e6ab){return _0x441a72[_0x8398('0x27')](_0x4b6b7d);}return _0x441a72[_0x8398('0x28')](_0x4b6b7d)[_0x8398('0x29')]();};}function respondWithResult(_0x512050,_0x4fc616){_0x4fc616=_0x4fc616||0xc8;return function(_0x14c46c){if(_0x14c46c){return _0x512050[_0x8398('0x28')](_0x4fc616)[_0x8398('0x2a')](_0x14c46c);}};}function respondWithFilteredResult(_0x4a1b21,_0x551422){return function(_0x27aa2b){if(_0x27aa2b){var _0x2daefd=_0x27aa2b[_0x8398('0x2b')],_0x5273a9=_0x551422['offset'],_0x837e79=_0x551422[_0x8398('0x2c')]+_0x551422[_0x8398('0x2d')],_0x34a545;if(_0x837e79>=_0x2daefd){_0x837e79=_0x2daefd;_0x34a545=0xc8;}else{_0x34a545=0xce;}_0x4a1b21['status'](_0x34a545);return _0x4a1b21[_0x8398('0x2e')](_0x8398('0x2f'),_0x5273a9+'-'+_0x837e79+'/'+_0x2daefd)[_0x8398('0x2a')](_0x27aa2b);}return null;};}function patchUpdates(_0x5b03f3){return function(_0x1112ba){try{jsonpatch[_0x8398('0x30')](_0x1112ba,_0x5b03f3,!![]);}catch(_0x525808){return BPromise['reject'](_0x525808);}return _0x1112ba[_0x8398('0x31')]();};}function saveUpdates(_0x28c7b9,_0x31247d){return function(_0xbe90b){if(_0xbe90b){return _0xbe90b[_0x8398('0x32')](_0x28c7b9)['then'](function(_0x3c7cff){return _0x3c7cff;});}return null;};}function removeEntity(_0x267b7f,_0x408ca0){return function(_0xbda5b3){if(_0xbda5b3){return _0xbda5b3[_0x8398('0x33')]()[_0x8398('0x34')](function(){_0x267b7f[_0x8398('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xabb299,_0x4f75f4){return function(_0x3d7661){if(!_0x3d7661){_0xabb299[_0x8398('0x27')](0x194);}return _0x3d7661;};}function handleError(_0x5b4a43,_0x185591){_0x185591=_0x185591||0x1f4;return function(_0x5b114c){logger['error'](_0x5b114c[_0x8398('0x35')]);if(_0x5b114c[_0x8398('0x36')]){delete _0x5b114c[_0x8398('0x36')];}_0x5b4a43[_0x8398('0x28')](_0x185591)[_0x8398('0x37')](_0x5b114c);};}exports['index']=function(_0x2cef27,_0x103f11){var _0x12a157={},_0x567f92={},_0x2700b3={'count':0x0,'rows':[]};var _0x4c321c=_['map'](db[_0x8398('0x38')][_0x8398('0x39')],function(_0x2de2b0){return{'name':_0x2de2b0[_0x8398('0x3a')],'type':_0x2de2b0[_0x8398('0x3b')]['key']};});_0x567f92[_0x8398('0x3c')]=_[_0x8398('0x3d')](_0x4c321c,'name');_0x567f92['query']=_[_0x8398('0x3e')](_0x2cef27[_0x8398('0x3f')]);_0x567f92[_0x8398('0x40')]=_[_0x8398('0x41')](_0x567f92['model'],_0x567f92[_0x8398('0x3f')]);_0x12a157['attributes']=_[_0x8398('0x41')](_0x567f92['model'],qs[_0x8398('0x42')](_0x2cef27[_0x8398('0x3f')][_0x8398('0x42')]));_0x12a157[_0x8398('0x43')]=_0x12a157[_0x8398('0x43')]['length']?_0x12a157['attributes']:_0x567f92['model'];if(!_0x2cef27[_0x8398('0x3f')]['hasOwnProperty'](_0x8398('0x44'))){_0x12a157[_0x8398('0x2d')]=qs['limit'](_0x2cef27[_0x8398('0x3f')][_0x8398('0x2d')]);_0x12a157[_0x8398('0x2c')]=qs[_0x8398('0x2c')](_0x2cef27[_0x8398('0x3f')]['offset']);}_0x12a157['order']=qs[_0x8398('0x45')](_0x2cef27[_0x8398('0x3f')]['sort']);_0x12a157[_0x8398('0x46')]=qs[_0x8398('0x40')](_[_0x8398('0x47')](_0x2cef27[_0x8398('0x3f')],_0x567f92['filters']),_0x4c321c);if(_0x2cef27[_0x8398('0x3f')][_0x8398('0x48')]){_0x12a157[_0x8398('0x46')]=_[_0x8398('0x49')](_0x12a157['where'],{'$or':_['map'](_0x4c321c,function(_0x3f4758){if(_0x3f4758[_0x8398('0x3b')]!==_0x8398('0x4a')){var _0x5c7843={};_0x5c7843[_0x3f4758[_0x8398('0x36')]]={'$like':'%'+_0x2cef27[_0x8398('0x3f')][_0x8398('0x48')]+'%'};return _0x5c7843;}})});}_0x12a157=_[_0x8398('0x49')]({},_0x12a157,_0x2cef27[_0x8398('0x4b')]);var _0x465e66={'where':_0x12a157['where']};return db[_0x8398('0x38')][_0x8398('0x2b')](_0x465e66)[_0x8398('0x34')](function(_0x3efb88){_0x2700b3[_0x8398('0x2b')]=_0x3efb88;if(_0x2cef27[_0x8398('0x3f')]['includeAll']){_0x12a157[_0x8398('0x4c')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x8398('0x4d')](_0x12a157);})[_0x8398('0x34')](function(_0x29451c){_0x2700b3[_0x8398('0x4e')]=_0x29451c;return _0x2700b3;})[_0x8398('0x34')](respondWithFilteredResult(_0x103f11,_0x12a157))[_0x8398('0x26')](handleError(_0x103f11,null));};exports[_0x8398('0x4f')]=function(_0x52eb38,_0x459d75){var _0x44765a={'raw':![],'where':{'id':_0x52eb38[_0x8398('0x50')]['id']}},_0x119512={};_0x119512[_0x8398('0x3c')]=_[_0x8398('0x3e')](db[_0x8398('0x38')][_0x8398('0x39')]);_0x119512[_0x8398('0x3f')]=_[_0x8398('0x3e')](_0x52eb38['query']);_0x119512[_0x8398('0x40')]=_[_0x8398('0x41')](_0x119512['model'],_0x119512[_0x8398('0x3f')]);_0x44765a['attributes']=_[_0x8398('0x41')](_0x119512[_0x8398('0x3c')],qs[_0x8398('0x42')](_0x52eb38[_0x8398('0x3f')][_0x8398('0x42')]));_0x44765a[_0x8398('0x43')]=_0x44765a[_0x8398('0x43')][_0x8398('0x51')]?_0x44765a[_0x8398('0x43')]:_0x119512['model'];if(_0x52eb38[_0x8398('0x3f')][_0x8398('0x52')]){_0x44765a[_0x8398('0x4c')]=[{'all':!![]}];}_0x44765a=_[_0x8398('0x49')]({},_0x44765a,_0x52eb38[_0x8398('0x4b')]);return db[_0x8398('0x38')][_0x8398('0x53')](_0x44765a)['then'](handleEntityNotFound(_0x459d75,null))[_0x8398('0x34')](respondWithResult(_0x459d75,null))[_0x8398('0x26')](handleError(_0x459d75,null));};exports[_0x8398('0x54')]=function(_0xa7aa86,_0x3a59a8){return db['Dynamics365Configuration'][_0x8398('0x54')](_0xa7aa86[_0x8398('0x55')],{})[_0x8398('0x34')](respondWithResult(_0x3a59a8,0xc9))['catch'](handleError(_0x3a59a8,null));};exports[_0x8398('0x32')]=function(_0x252c93,_0x3e448e){if(_0x252c93[_0x8398('0x55')]['id']){delete _0x252c93[_0x8398('0x55')]['id'];}return db['Dynamics365Configuration'][_0x8398('0x53')]({'where':{'id':_0x252c93[_0x8398('0x50')]['id']}})[_0x8398('0x34')](handleEntityNotFound(_0x3e448e,null))[_0x8398('0x34')](saveUpdates(_0x252c93[_0x8398('0x55')],null))['then'](respondWithResult(_0x3e448e,null))[_0x8398('0x26')](handleError(_0x3e448e,null));};exports[_0x8398('0x33')]=function(_0x2e8e35,_0x2c727b){return db['Dynamics365Configuration'][_0x8398('0x53')]({'where':{'id':_0x2e8e35[_0x8398('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c727b,null))[_0x8398('0x34')](removeEntity(_0x2c727b,null))[_0x8398('0x26')](handleError(_0x2c727b,null));};exports[_0x8398('0x56')]=function(_0x171ae2,_0x3bbb67,_0x579ba8){var _0x3e54f7={};var _0xce2d61={};var _0x1d2063;var _0x29e415;return db[_0x8398('0x38')][_0x8398('0x57')]({'where':{'id':_0x171ae2['params']['id']}})[_0x8398('0x34')](handleEntityNotFound(_0x3bbb67,null))[_0x8398('0x34')](function(_0x2a9029){if(_0x2a9029){_0x1d2063=_0x2a9029;_0xce2d61[_0x8398('0x3c')]=_[_0x8398('0x3e')](db[_0x8398('0x58')]['rawAttributes']);_0xce2d61[_0x8398('0x3f')]=_[_0x8398('0x3e')](_0x171ae2[_0x8398('0x3f')]);_0xce2d61[_0x8398('0x40')]=_[_0x8398('0x41')](_0xce2d61[_0x8398('0x3c')],_0xce2d61['query']);_0x3e54f7[_0x8398('0x43')]=_['intersection'](_0xce2d61[_0x8398('0x3c')],qs[_0x8398('0x42')](_0x171ae2[_0x8398('0x3f')][_0x8398('0x42')]));_0x3e54f7[_0x8398('0x43')]=_0x3e54f7['attributes'][_0x8398('0x51')]?_0x3e54f7[_0x8398('0x43')]:_0xce2d61[_0x8398('0x3c')];_0x3e54f7[_0x8398('0x59')]=qs['sort'](_0x171ae2['query'][_0x8398('0x45')]);_0x3e54f7[_0x8398('0x46')]=qs[_0x8398('0x40')](_['pick'](_0x171ae2[_0x8398('0x3f')],_0xce2d61[_0x8398('0x40')]));if(_0x171ae2['query'][_0x8398('0x48')]){_0x3e54f7[_0x8398('0x46')]=_[_0x8398('0x49')](_0x3e54f7[_0x8398('0x46')],{'$or':_[_0x8398('0x3d')](_0x3e54f7[_0x8398('0x43')],function(_0x50e263){var _0x457d1f={};_0x457d1f[_0x50e263]={'$like':'%'+_0x171ae2['query'][_0x8398('0x48')]+'%'};return _0x457d1f;})});}_0x3e54f7=_['merge']({},_0x3e54f7,_0x171ae2[_0x8398('0x4b')]);return _0x1d2063[_0x8398('0x56')](_0x3e54f7);}})['then'](function(_0x3b6101){if(_0x3b6101){_0x29e415=_0x3b6101['length'];if(!_0x171ae2[_0x8398('0x3f')][_0x8398('0x5a')](_0x8398('0x44'))){_0x3e54f7['limit']=qs['limit'](_0x171ae2[_0x8398('0x3f')]['limit']);_0x3e54f7[_0x8398('0x2c')]=qs['offset'](_0x171ae2[_0x8398('0x3f')][_0x8398('0x2c')]);}return _0x1d2063[_0x8398('0x56')](_0x3e54f7);}})[_0x8398('0x34')](function(_0x28b533){if(_0x28b533){return _0x28b533?{'count':_0x29e415,'rows':_0x28b533}:null;}})['then'](respondWithResult(_0x3bbb67,null))[_0x8398('0x26')](handleError(_0x3bbb67,null));};exports[_0x8398('0x5b')]=function(_0x33d103,_0x513105,_0x9bec29){var _0x2dd493={};var _0x208579={};var _0x5d09bc;var _0x35b0e9;return db['Dynamics365Configuration'][_0x8398('0x57')]({'where':{'id':_0x33d103['params']['id']}})[_0x8398('0x34')](handleEntityNotFound(_0x513105,null))[_0x8398('0x34')](function(_0x3934ff){if(_0x3934ff){_0x5d09bc=_0x3934ff;_0x208579[_0x8398('0x3c')]=_['keys'](db[_0x8398('0x58')]['rawAttributes']);_0x208579['query']=_['keys'](_0x33d103['query']);_0x208579[_0x8398('0x40')]=_[_0x8398('0x41')](_0x208579[_0x8398('0x3c')],_0x208579[_0x8398('0x3f')]);_0x2dd493[_0x8398('0x43')]=_[_0x8398('0x41')](_0x208579['model'],qs[_0x8398('0x42')](_0x33d103[_0x8398('0x3f')][_0x8398('0x42')]));_0x2dd493[_0x8398('0x43')]=_0x2dd493[_0x8398('0x43')][_0x8398('0x51')]?_0x2dd493[_0x8398('0x43')]:_0x208579[_0x8398('0x3c')];_0x2dd493['order']=qs[_0x8398('0x45')](_0x33d103['query'][_0x8398('0x45')]);_0x2dd493[_0x8398('0x46')]=qs['filters'](_[_0x8398('0x47')](_0x33d103[_0x8398('0x3f')],_0x208579[_0x8398('0x40')]));if(_0x33d103[_0x8398('0x3f')][_0x8398('0x48')]){_0x2dd493['where']=_[_0x8398('0x49')](_0x2dd493['where'],{'$or':_['map'](_0x2dd493[_0x8398('0x43')],function(_0x3a05bb){var _0x2c60e1={};_0x2c60e1[_0x3a05bb]={'$like':'%'+_0x33d103[_0x8398('0x3f')][_0x8398('0x48')]+'%'};return _0x2c60e1;})});}_0x2dd493=_['merge']({},_0x2dd493,_0x33d103['options']);return _0x5d09bc['getSubjects'](_0x2dd493);}})[_0x8398('0x34')](function(_0x465861){if(_0x465861){_0x35b0e9=_0x465861['length'];if(!_0x33d103[_0x8398('0x3f')][_0x8398('0x5a')](_0x8398('0x44'))){_0x2dd493[_0x8398('0x2d')]=qs[_0x8398('0x2d')](_0x33d103['query'][_0x8398('0x2d')]);_0x2dd493[_0x8398('0x2c')]=qs[_0x8398('0x2c')](_0x33d103['query']['offset']);}return _0x5d09bc[_0x8398('0x5b')](_0x2dd493);}})[_0x8398('0x34')](function(_0x38d45a){if(_0x38d45a){return _0x38d45a?{'count':_0x35b0e9,'rows':_0x38d45a}:null;}})[_0x8398('0x34')](respondWithResult(_0x513105,null))['catch'](handleError(_0x513105,null));};exports[_0x8398('0x5c')]=function(_0x389df2,_0x1145ba,_0x10b63b){var _0x30609a={};var _0x1c9a10={};var _0x380a44;var _0x5bb25f;return db[_0x8398('0x38')][_0x8398('0x57')]({'where':{'id':_0x389df2[_0x8398('0x50')]['id']}})[_0x8398('0x34')](handleEntityNotFound(_0x1145ba,null))[_0x8398('0x34')](function(_0x2d30dd){if(_0x2d30dd){_0x380a44=_0x2d30dd;_0x1c9a10[_0x8398('0x3c')]=_[_0x8398('0x3e')](db['Dynamics365Field'][_0x8398('0x39')]);_0x1c9a10[_0x8398('0x3f')]=_[_0x8398('0x3e')](_0x389df2[_0x8398('0x3f')]);_0x1c9a10[_0x8398('0x40')]=_[_0x8398('0x41')](_0x1c9a10[_0x8398('0x3c')],_0x1c9a10[_0x8398('0x3f')]);_0x30609a['attributes']=_['intersection'](_0x1c9a10['model'],qs[_0x8398('0x42')](_0x389df2[_0x8398('0x3f')]['fields']));_0x30609a[_0x8398('0x43')]=_0x30609a[_0x8398('0x43')]['length']?_0x30609a[_0x8398('0x43')]:_0x1c9a10[_0x8398('0x3c')];_0x30609a[_0x8398('0x59')]=qs[_0x8398('0x45')](_0x389df2[_0x8398('0x3f')]['sort']);_0x30609a['where']=qs[_0x8398('0x40')](_['pick'](_0x389df2[_0x8398('0x3f')],_0x1c9a10[_0x8398('0x40')]));if(_0x389df2[_0x8398('0x3f')][_0x8398('0x48')]){_0x30609a[_0x8398('0x46')]=_[_0x8398('0x49')](_0x30609a[_0x8398('0x46')],{'$or':_['map'](_0x30609a[_0x8398('0x43')],function(_0x2ea5a1){var _0x403223={};_0x403223[_0x2ea5a1]={'$like':'%'+_0x389df2[_0x8398('0x3f')][_0x8398('0x48')]+'%'};return _0x403223;})});}_0x30609a=_[_0x8398('0x49')]({},_0x30609a,_0x389df2[_0x8398('0x4b')]);return _0x380a44[_0x8398('0x5c')](_0x30609a);}})[_0x8398('0x34')](function(_0x54bdee){if(_0x54bdee){_0x5bb25f=_0x54bdee[_0x8398('0x51')];if(!_0x389df2['query'][_0x8398('0x5a')]('nolimit')){_0x30609a[_0x8398('0x2d')]=qs[_0x8398('0x2d')](_0x389df2[_0x8398('0x3f')][_0x8398('0x2d')]);_0x30609a[_0x8398('0x2c')]=qs[_0x8398('0x2c')](_0x389df2['query'][_0x8398('0x2c')]);}return _0x380a44[_0x8398('0x5c')](_0x30609a);}})[_0x8398('0x34')](function(_0x1d35ef){if(_0x1d35ef){return _0x1d35ef?{'count':_0x5bb25f,'rows':_0x1d35ef}:null;}})[_0x8398('0x34')](respondWithResult(_0x1145ba,null))[_0x8398('0x26')](handleError(_0x1145ba,null));}; \ No newline at end of file +var _0x81bb=['nolimit','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','limit','order','sort','filters','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','getFields','Dynamics365Field','pick','filter','hasOwnProperty'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x81bb,0x178));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb81b('0x0'));var emlformat=require(_0xb81b('0x1'));var rimraf=require(_0xb81b('0x2'));var zipdir=require(_0xb81b('0x3'));var jsonpatch=require(_0xb81b('0x4'));var rp=require(_0xb81b('0x5'));var moment=require(_0xb81b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb81b('0x7'));var util=require(_0xb81b('0x8'));var path=require(_0xb81b('0x9'));var sox=require(_0xb81b('0xa'));var csv=require(_0xb81b('0xb'));var ejs=require(_0xb81b('0xc'));var fs=require('fs');var _=require(_0xb81b('0xd'));var squel=require(_0xb81b('0xe'));var crypto=require(_0xb81b('0xf'));var jsforce=require(_0xb81b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb81b('0xb'));var querystring=require('querystring');var Papa=require(_0xb81b('0x11'));var Redis=require(_0xb81b('0x12'));var authService=require(_0xb81b('0x13'));var qs=require(_0xb81b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb81b('0x15'))('api');var utils=require(_0xb81b('0x16'));var config=require(_0xb81b('0x17'));var licenseUtil=require(_0xb81b('0x18'));var db=require(_0xb81b('0x19'))['db'];var jayson=require(_0xb81b('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x472c4b,_0x1555f1,_0x58f915,_0x152552){return new BPromise(function(_0x4aa227,_0x184c9c){var _0x3131eb=_0x152552||client;return _0x3131eb[_0xb81b('0x1b')](_0x472c4b,_0x58f915)[_0xb81b('0x1c')](function(_0x584b28){logger['info'](_0xb81b('0x1d'),_0x1555f1,_0xb81b('0x1e'));logger[_0xb81b('0x1f')](_0xb81b('0x20'),_0x1555f1,_0xb81b('0x1e'),JSON[_0xb81b('0x21')](_0x584b28));if(_0x584b28[_0xb81b('0x22')]){if(_0x584b28['error'][_0xb81b('0x23')]===0x1f4){logger[_0xb81b('0x22')](_0xb81b('0x1d'),_0x1555f1,_0x584b28[_0xb81b('0x22')][_0xb81b('0x24')]);return _0x184c9c(_0x584b28[_0xb81b('0x22')]['message']);}logger['error'](_0xb81b('0x1d'),_0x1555f1,_0x584b28[_0xb81b('0x22')]['message']);return _0x4aa227(_0x584b28[_0xb81b('0x22')][_0xb81b('0x24')]);}else{logger[_0xb81b('0x25')](_0xb81b('0x1d'),_0x1555f1,_0xb81b('0x1e'));_0x4aa227(_0x584b28[_0xb81b('0x26')][_0xb81b('0x24')]);}})[_0xb81b('0x27')](function(_0xc0c540){logger[_0xb81b('0x22')](_0xb81b('0x1d'),_0x1555f1,_0xc0c540);_0x184c9c(_0xc0c540);});});}function respondWithStatusCode(_0x35977d,_0x55c8ed){_0x55c8ed=_0x55c8ed||0xcc;return function(_0x5181c8){if(_0x5181c8){return _0x35977d['sendStatus'](_0x55c8ed);}return _0x35977d[_0xb81b('0x28')](_0x55c8ed)[_0xb81b('0x29')]();};}function respondWithResult(_0x328c74,_0x5bb9ab){_0x5bb9ab=_0x5bb9ab||0xc8;return function(_0x3a5a75){if(_0x3a5a75){return _0x328c74[_0xb81b('0x28')](_0x5bb9ab)[_0xb81b('0x2a')](_0x3a5a75);}};}function respondWithFilteredResult(_0x5a2980,_0x4e4084){return function(_0x3e1af2){if(_0x3e1af2){var _0x388c4d=_0x3e1af2[_0xb81b('0x2b')],_0x32f93a=_0x4e4084[_0xb81b('0x2c')],_0x5f090c=_0x4e4084[_0xb81b('0x2c')]+_0x4e4084['limit'],_0x25c29d;if(_0x5f090c>=_0x388c4d){_0x5f090c=_0x388c4d;_0x25c29d=0xc8;}else{_0x25c29d=0xce;}_0x5a2980[_0xb81b('0x28')](_0x25c29d);return _0x5a2980[_0xb81b('0x2d')](_0xb81b('0x2e'),_0x32f93a+'-'+_0x5f090c+'/'+_0x388c4d)[_0xb81b('0x2a')](_0x3e1af2);}return null;};}function patchUpdates(_0x275e90){return function(_0x2af5ef){try{jsonpatch[_0xb81b('0x2f')](_0x2af5ef,_0x275e90,!![]);}catch(_0x1a52d4){return BPromise[_0xb81b('0x30')](_0x1a52d4);}return _0x2af5ef[_0xb81b('0x31')]();};}function saveUpdates(_0x1c72ec,_0x493506){return function(_0x417339){if(_0x417339){return _0x417339[_0xb81b('0x32')](_0x1c72ec)['then'](function(_0x553483){return _0x553483;});}return null;};}function removeEntity(_0x1eb2fb,_0x3e0e3b){return function(_0x22907b){if(_0x22907b){return _0x22907b[_0xb81b('0x33')]()['then'](function(){_0x1eb2fb[_0xb81b('0x28')](0xcc)[_0xb81b('0x29')]();});}};}function handleEntityNotFound(_0x1d9358,_0x30d29c){return function(_0x4bfdd9){if(!_0x4bfdd9){_0x1d9358['sendStatus'](0x194);}return _0x4bfdd9;};}function handleError(_0x242767,_0x514c00){_0x514c00=_0x514c00||0x1f4;return function(_0x1252fa){logger[_0xb81b('0x22')](_0x1252fa[_0xb81b('0x34')]);if(_0x1252fa[_0xb81b('0x35')]){delete _0x1252fa[_0xb81b('0x35')];}_0x242767['status'](_0x514c00)[_0xb81b('0x36')](_0x1252fa);};}exports[_0xb81b('0x37')]=function(_0x21534b,_0xc2a474){var _0x24a86f={},_0x5e9f33={},_0x148b7e={'count':0x0,'rows':[]};var _0x54c494=_[_0xb81b('0x38')](db[_0xb81b('0x39')][_0xb81b('0x3a')],function(_0x2b4aca){return{'name':_0x2b4aca[_0xb81b('0x3b')],'type':_0x2b4aca[_0xb81b('0x3c')][_0xb81b('0x3d')]};});_0x5e9f33['model']=_[_0xb81b('0x38')](_0x54c494,_0xb81b('0x35'));_0x5e9f33[_0xb81b('0x3e')]=_[_0xb81b('0x3f')](_0x21534b[_0xb81b('0x3e')]);_0x5e9f33['filters']=_['intersection'](_0x5e9f33[_0xb81b('0x40')],_0x5e9f33[_0xb81b('0x3e')]);_0x24a86f[_0xb81b('0x41')]=_[_0xb81b('0x42')](_0x5e9f33['model'],qs[_0xb81b('0x43')](_0x21534b[_0xb81b('0x3e')][_0xb81b('0x43')]));_0x24a86f['attributes']=_0x24a86f['attributes'][_0xb81b('0x44')]?_0x24a86f[_0xb81b('0x41')]:_0x5e9f33['model'];if(!_0x21534b[_0xb81b('0x3e')]['hasOwnProperty']('nolimit')){_0x24a86f[_0xb81b('0x45')]=qs[_0xb81b('0x45')](_0x21534b[_0xb81b('0x3e')][_0xb81b('0x45')]);_0x24a86f[_0xb81b('0x2c')]=qs[_0xb81b('0x2c')](_0x21534b['query']['offset']);}_0x24a86f[_0xb81b('0x46')]=qs[_0xb81b('0x47')](_0x21534b[_0xb81b('0x3e')][_0xb81b('0x47')]);_0x24a86f['where']=qs['filters'](_['pick'](_0x21534b[_0xb81b('0x3e')],_0x5e9f33[_0xb81b('0x48')]),_0x54c494);if(_0x21534b[_0xb81b('0x3e')]['filter']){_0x24a86f[_0xb81b('0x49')]=_[_0xb81b('0x4a')](_0x24a86f[_0xb81b('0x49')],{'$or':_[_0xb81b('0x38')](_0x54c494,function(_0x28f9c9){if(_0x28f9c9[_0xb81b('0x3c')]!==_0xb81b('0x4b')){var _0x4dc443={};_0x4dc443[_0x28f9c9['name']]={'$like':'%'+_0x21534b[_0xb81b('0x3e')]['filter']+'%'};return _0x4dc443;}})});}_0x24a86f=_[_0xb81b('0x4a')]({},_0x24a86f,_0x21534b[_0xb81b('0x4c')]);var _0x41b155={'where':_0x24a86f[_0xb81b('0x49')]};return db[_0xb81b('0x39')]['count'](_0x41b155)[_0xb81b('0x1c')](function(_0x1582a3){_0x148b7e[_0xb81b('0x2b')]=_0x1582a3;if(_0x21534b['query'][_0xb81b('0x4d')]){_0x24a86f[_0xb81b('0x4e')]=[{'all':!![]}];}return db[_0xb81b('0x39')]['findAll'](_0x24a86f);})['then'](function(_0xfbca39){_0x148b7e[_0xb81b('0x4f')]=_0xfbca39;return _0x148b7e;})[_0xb81b('0x1c')](respondWithFilteredResult(_0xc2a474,_0x24a86f))[_0xb81b('0x27')](handleError(_0xc2a474,null));};exports['show']=function(_0x56060a,_0x275004){var _0x2a983d={'raw':![],'where':{'id':_0x56060a[_0xb81b('0x50')]['id']}},_0x4908c8={};_0x4908c8[_0xb81b('0x40')]=_['keys'](db[_0xb81b('0x39')][_0xb81b('0x3a')]);_0x4908c8['query']=_['keys'](_0x56060a[_0xb81b('0x3e')]);_0x4908c8[_0xb81b('0x48')]=_[_0xb81b('0x42')](_0x4908c8[_0xb81b('0x40')],_0x4908c8[_0xb81b('0x3e')]);_0x2a983d[_0xb81b('0x41')]=_[_0xb81b('0x42')](_0x4908c8[_0xb81b('0x40')],qs[_0xb81b('0x43')](_0x56060a[_0xb81b('0x3e')][_0xb81b('0x43')]));_0x2a983d[_0xb81b('0x41')]=_0x2a983d[_0xb81b('0x41')]['length']?_0x2a983d[_0xb81b('0x41')]:_0x4908c8[_0xb81b('0x40')];if(_0x56060a['query'][_0xb81b('0x4d')]){_0x2a983d[_0xb81b('0x4e')]=[{'all':!![]}];}_0x2a983d=_[_0xb81b('0x4a')]({},_0x2a983d,_0x56060a[_0xb81b('0x4c')]);return db['Dynamics365Configuration'][_0xb81b('0x51')](_0x2a983d)[_0xb81b('0x1c')](handleEntityNotFound(_0x275004,null))[_0xb81b('0x1c')](respondWithResult(_0x275004,null))['catch'](handleError(_0x275004,null));};exports['create']=function(_0x409b64,_0x45052f){return db[_0xb81b('0x39')][_0xb81b('0x52')](_0x409b64[_0xb81b('0x53')],{})[_0xb81b('0x1c')](respondWithResult(_0x45052f,0xc9))['catch'](handleError(_0x45052f,null));};exports['update']=function(_0x447aad,_0x278be2){if(_0x447aad[_0xb81b('0x53')]['id']){delete _0x447aad[_0xb81b('0x53')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x447aad['params']['id']}})['then'](handleEntityNotFound(_0x278be2,null))[_0xb81b('0x1c')](saveUpdates(_0x447aad[_0xb81b('0x53')],null))[_0xb81b('0x1c')](respondWithResult(_0x278be2,null))['catch'](handleError(_0x278be2,null));};exports[_0xb81b('0x33')]=function(_0x22158c,_0x1b9ad4){return db[_0xb81b('0x39')]['find']({'where':{'id':_0x22158c['params']['id']}})[_0xb81b('0x1c')](handleEntityNotFound(_0x1b9ad4,null))[_0xb81b('0x1c')](removeEntity(_0x1b9ad4,null))['catch'](handleError(_0x1b9ad4,null));};exports[_0xb81b('0x54')]=function(_0x35f628,_0x26beae,_0x112ec4){var _0x2e6e8d={};var _0x5454c0={};var _0x58639a;var _0x5704db;return db[_0xb81b('0x39')]['findOne']({'where':{'id':_0x35f628[_0xb81b('0x50')]['id']}})[_0xb81b('0x1c')](handleEntityNotFound(_0x26beae,null))[_0xb81b('0x1c')](function(_0x22a65b){if(_0x22a65b){_0x58639a=_0x22a65b;_0x5454c0[_0xb81b('0x40')]=_[_0xb81b('0x3f')](db[_0xb81b('0x55')][_0xb81b('0x3a')]);_0x5454c0[_0xb81b('0x3e')]=_[_0xb81b('0x3f')](_0x35f628[_0xb81b('0x3e')]);_0x5454c0[_0xb81b('0x48')]=_[_0xb81b('0x42')](_0x5454c0['model'],_0x5454c0[_0xb81b('0x3e')]);_0x2e6e8d[_0xb81b('0x41')]=_['intersection'](_0x5454c0[_0xb81b('0x40')],qs['fields'](_0x35f628[_0xb81b('0x3e')][_0xb81b('0x43')]));_0x2e6e8d[_0xb81b('0x41')]=_0x2e6e8d[_0xb81b('0x41')][_0xb81b('0x44')]?_0x2e6e8d[_0xb81b('0x41')]:_0x5454c0[_0xb81b('0x40')];_0x2e6e8d[_0xb81b('0x46')]=qs[_0xb81b('0x47')](_0x35f628[_0xb81b('0x3e')]['sort']);_0x2e6e8d[_0xb81b('0x49')]=qs['filters'](_[_0xb81b('0x56')](_0x35f628[_0xb81b('0x3e')],_0x5454c0[_0xb81b('0x48')]));if(_0x35f628[_0xb81b('0x3e')]['filter']){_0x2e6e8d['where']=_[_0xb81b('0x4a')](_0x2e6e8d['where'],{'$or':_[_0xb81b('0x38')](_0x2e6e8d[_0xb81b('0x41')],function(_0x1c222e){var _0x222cc4={};_0x222cc4[_0x1c222e]={'$like':'%'+_0x35f628[_0xb81b('0x3e')][_0xb81b('0x57')]+'%'};return _0x222cc4;})});}_0x2e6e8d=_[_0xb81b('0x4a')]({},_0x2e6e8d,_0x35f628[_0xb81b('0x4c')]);return _0x58639a[_0xb81b('0x54')](_0x2e6e8d);}})[_0xb81b('0x1c')](function(_0xea4826){if(_0xea4826){_0x5704db=_0xea4826['length'];if(!_0x35f628[_0xb81b('0x3e')][_0xb81b('0x58')](_0xb81b('0x59'))){_0x2e6e8d[_0xb81b('0x45')]=qs[_0xb81b('0x45')](_0x35f628[_0xb81b('0x3e')][_0xb81b('0x45')]);_0x2e6e8d['offset']=qs[_0xb81b('0x2c')](_0x35f628[_0xb81b('0x3e')][_0xb81b('0x2c')]);}return _0x58639a[_0xb81b('0x54')](_0x2e6e8d);}})['then'](function(_0x45a668){if(_0x45a668){return _0x45a668?{'count':_0x5704db,'rows':_0x45a668}:null;}})[_0xb81b('0x1c')](respondWithResult(_0x26beae,null))['catch'](handleError(_0x26beae,null));};exports[_0xb81b('0x5a')]=function(_0x2527ee,_0x7286a2,_0x225255){var _0x5c5bcb={};var _0xe5cf20={};var _0x18a0f0;var _0x2eff1f;return db['Dynamics365Configuration'][_0xb81b('0x5b')]({'where':{'id':_0x2527ee[_0xb81b('0x50')]['id']}})[_0xb81b('0x1c')](handleEntityNotFound(_0x7286a2,null))[_0xb81b('0x1c')](function(_0x3aa0db){if(_0x3aa0db){_0x18a0f0=_0x3aa0db;_0xe5cf20[_0xb81b('0x40')]=_[_0xb81b('0x3f')](db[_0xb81b('0x55')][_0xb81b('0x3a')]);_0xe5cf20[_0xb81b('0x3e')]=_['keys'](_0x2527ee['query']);_0xe5cf20[_0xb81b('0x48')]=_[_0xb81b('0x42')](_0xe5cf20[_0xb81b('0x40')],_0xe5cf20['query']);_0x5c5bcb[_0xb81b('0x41')]=_[_0xb81b('0x42')](_0xe5cf20['model'],qs[_0xb81b('0x43')](_0x2527ee['query'][_0xb81b('0x43')]));_0x5c5bcb[_0xb81b('0x41')]=_0x5c5bcb[_0xb81b('0x41')][_0xb81b('0x44')]?_0x5c5bcb[_0xb81b('0x41')]:_0xe5cf20[_0xb81b('0x40')];_0x5c5bcb[_0xb81b('0x46')]=qs[_0xb81b('0x47')](_0x2527ee['query']['sort']);_0x5c5bcb[_0xb81b('0x49')]=qs[_0xb81b('0x48')](_[_0xb81b('0x56')](_0x2527ee['query'],_0xe5cf20['filters']));if(_0x2527ee[_0xb81b('0x3e')][_0xb81b('0x57')]){_0x5c5bcb[_0xb81b('0x49')]=_['merge'](_0x5c5bcb[_0xb81b('0x49')],{'$or':_[_0xb81b('0x38')](_0x5c5bcb[_0xb81b('0x41')],function(_0x4c765a){var _0x518a5b={};_0x518a5b[_0x4c765a]={'$like':'%'+_0x2527ee['query'][_0xb81b('0x57')]+'%'};return _0x518a5b;})});}_0x5c5bcb=_[_0xb81b('0x4a')]({},_0x5c5bcb,_0x2527ee['options']);return _0x18a0f0[_0xb81b('0x5a')](_0x5c5bcb);}})[_0xb81b('0x1c')](function(_0x113284){if(_0x113284){_0x2eff1f=_0x113284[_0xb81b('0x44')];if(!_0x2527ee[_0xb81b('0x3e')][_0xb81b('0x58')](_0xb81b('0x59'))){_0x5c5bcb[_0xb81b('0x45')]=qs[_0xb81b('0x45')](_0x2527ee[_0xb81b('0x3e')]['limit']);_0x5c5bcb[_0xb81b('0x2c')]=qs[_0xb81b('0x2c')](_0x2527ee[_0xb81b('0x3e')][_0xb81b('0x2c')]);}return _0x18a0f0[_0xb81b('0x5a')](_0x5c5bcb);}})[_0xb81b('0x1c')](function(_0x2d0c05){if(_0x2d0c05){return _0x2d0c05?{'count':_0x2eff1f,'rows':_0x2d0c05}:null;}})[_0xb81b('0x1c')](respondWithResult(_0x7286a2,null))[_0xb81b('0x27')](handleError(_0x7286a2,null));};exports[_0xb81b('0x5c')]=function(_0x51757e,_0x572b2c,_0x5d4046){var _0xa72a22={};var _0x35ffbc={};var _0x5205a3;var _0x28db8f;return db[_0xb81b('0x39')][_0xb81b('0x5b')]({'where':{'id':_0x51757e[_0xb81b('0x50')]['id']}})['then'](handleEntityNotFound(_0x572b2c,null))[_0xb81b('0x1c')](function(_0x425043){if(_0x425043){_0x5205a3=_0x425043;_0x35ffbc['model']=_[_0xb81b('0x3f')](db['Dynamics365Field']['rawAttributes']);_0x35ffbc[_0xb81b('0x3e')]=_['keys'](_0x51757e[_0xb81b('0x3e')]);_0x35ffbc['filters']=_[_0xb81b('0x42')](_0x35ffbc[_0xb81b('0x40')],_0x35ffbc[_0xb81b('0x3e')]);_0xa72a22[_0xb81b('0x41')]=_[_0xb81b('0x42')](_0x35ffbc[_0xb81b('0x40')],qs[_0xb81b('0x43')](_0x51757e[_0xb81b('0x3e')]['fields']));_0xa72a22[_0xb81b('0x41')]=_0xa72a22['attributes']['length']?_0xa72a22[_0xb81b('0x41')]:_0x35ffbc[_0xb81b('0x40')];_0xa72a22[_0xb81b('0x46')]=qs[_0xb81b('0x47')](_0x51757e['query'][_0xb81b('0x47')]);_0xa72a22[_0xb81b('0x49')]=qs[_0xb81b('0x48')](_[_0xb81b('0x56')](_0x51757e[_0xb81b('0x3e')],_0x35ffbc[_0xb81b('0x48')]));if(_0x51757e['query']['filter']){_0xa72a22[_0xb81b('0x49')]=_['merge'](_0xa72a22[_0xb81b('0x49')],{'$or':_[_0xb81b('0x38')](_0xa72a22[_0xb81b('0x41')],function(_0x475d46){var _0x1eb818={};_0x1eb818[_0x475d46]={'$like':'%'+_0x51757e[_0xb81b('0x3e')][_0xb81b('0x57')]+'%'};return _0x1eb818;})});}_0xa72a22=_['merge']({},_0xa72a22,_0x51757e[_0xb81b('0x4c')]);return _0x5205a3['getDescriptions'](_0xa72a22);}})['then'](function(_0x2b186e){if(_0x2b186e){_0x28db8f=_0x2b186e['length'];if(!_0x51757e[_0xb81b('0x3e')][_0xb81b('0x58')](_0xb81b('0x59'))){_0xa72a22[_0xb81b('0x45')]=qs[_0xb81b('0x45')](_0x51757e['query'][_0xb81b('0x45')]);_0xa72a22[_0xb81b('0x2c')]=qs[_0xb81b('0x2c')](_0x51757e[_0xb81b('0x3e')][_0xb81b('0x2c')]);}return _0x5205a3['getDescriptions'](_0xa72a22);}})[_0xb81b('0x1c')](function(_0x3fb200){if(_0x3fb200){return _0x3fb200?{'count':_0x28db8f,'rows':_0x3fb200}:null;}})['then'](respondWithResult(_0x572b2c,null))['catch'](handleError(_0x572b2c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ee10606..0d91eea 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 _0x723b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x723b,0x11b));var _0xb723=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x723b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb723('0x0'));var logger=require(_0xb723('0x1'))(_0xb723('0x2'));var moment=require(_0xb723('0x3'));var BPromise=require(_0xb723('0x4'));var rp=require(_0xb723('0x5'));var fs=require('fs');var path=require(_0xb723('0x6'));var rimraf=require(_0xb723('0x7'));var config=require(_0xb723('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xb723('0x9')]=function(_0x1ab8de,_0x559223){return _0x1ab8de[_0xb723('0xa')](_0xb723('0xb'),attributes,{'tableName':_0xb723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x773d=['int_dynamics365_configurations','util','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x56e0aa,_0x3f34e5){var _0x4975b6=function(_0x1092df){while(--_0x1092df){_0x56e0aa['push'](_0x56e0aa['shift']());}};_0x4975b6(++_0x3f34e5);}(_0x773d,0xa1));var _0xd773=function(_0x48d2dc,_0x1c0133){_0x48d2dc=_0x48d2dc-0x0;var _0x4b15cd=_0x773d[_0x48d2dc];return _0x4b15cd;};'use strict';var _=require('lodash');var util=require(_0xd773('0x0'));var logger=require('../../config/logger')(_0xd773('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd773('0x2'));var fs=require('fs');var path=require(_0xd773('0x3'));var rimraf=require(_0xd773('0x4'));var config=require(_0xd773('0x5'));var attributes=require(_0xd773('0x6'));module[_0xd773('0x7')]=function(_0x441232,_0x3bdf3c){return _0x441232[_0xd773('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0xd773('0x9'),'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 2fabe30..0c410b0 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 _0xd957=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x16495f,_0x5c1d14){var _0x1d62b5=function(_0x4b33ad){while(--_0x4b33ad){_0x16495f['push'](_0x16495f['shift']());}};_0x1d62b5(++_0x5c1d14);}(_0xd957,0xf2));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var moment=require(_0x7d95('0x2'));var BPromise=require(_0x7d95('0x3'));var rs=require(_0x7d95('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d95('0x5'))['db'];var utils=require(_0x7d95('0x6'));var logger=require(_0x7d95('0x7'))(_0x7d95('0x8'));var config=require(_0x7d95('0x9'));var jayson=require(_0x7d95('0xa'));var client=jayson[_0x7d95('0xb')][_0x7d95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48138d,_0x50c87c,_0x3f8729){return new BPromise(function(_0x25039c,_0x5bb990){return client['request'](_0x48138d,_0x3f8729)['then'](function(_0x142c25){logger[_0x7d95('0xd')](_0x7d95('0xe'),_0x50c87c,_0x7d95('0xf'));logger['debug'](_0x7d95('0x10'),_0x50c87c,_0x7d95('0xf'),JSON['stringify'](_0x142c25));if(_0x142c25['error']){if(_0x142c25[_0x7d95('0x11')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x50c87c,_0x142c25['error']['message']);return _0x5bb990(_0x142c25[_0x7d95('0x11')][_0x7d95('0x12')]);}logger[_0x7d95('0x11')](_0x7d95('0xe'),_0x50c87c,_0x142c25[_0x7d95('0x11')][_0x7d95('0x12')]);return _0x25039c(_0x142c25[_0x7d95('0x11')][_0x7d95('0x12')]);}else{logger[_0x7d95('0xd')](_0x7d95('0xe'),_0x50c87c,'request\x20sent');_0x25039c(_0x142c25['result'][_0x7d95('0x12')]);}})[_0x7d95('0x13')](function(_0x4212fa){logger[_0x7d95('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x50c87c,_0x4212fa);_0x5bb990(_0x4212fa);});});} \ No newline at end of file +var _0xfdb1=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x5531f1,_0x542d23){var _0x57fa92=function(_0x295c85){while(--_0x295c85){_0x5531f1['push'](_0x5531f1['shift']());}};_0x57fa92(++_0x542d23);}(_0xfdb1,0x1d4));var _0x1fdb=function(_0x16f1eb,_0x2d0d23){_0x16f1eb=_0x16f1eb-0x0;var _0x575749=_0xfdb1[_0x16f1eb];return _0x575749;};'use strict';var _=require(_0x1fdb('0x0'));var util=require(_0x1fdb('0x1'));var moment=require(_0x1fdb('0x2'));var BPromise=require(_0x1fdb('0x3'));var rs=require(_0x1fdb('0x4'));var fs=require('fs');var Redis=require(_0x1fdb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fdb('0x6'));var logger=require(_0x1fdb('0x7'))(_0x1fdb('0x8'));var config=require(_0x1fdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1fdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7934a2,_0x524abd,_0x3f937){return new BPromise(function(_0x1b057c,_0x416e93){return client[_0x1fdb('0xb')](_0x7934a2,_0x3f937)[_0x1fdb('0xc')](function(_0x2c4fb5){logger[_0x1fdb('0xd')](_0x1fdb('0xe'),_0x524abd,'request\x20sent');logger[_0x1fdb('0xf')](_0x1fdb('0x10'),_0x524abd,_0x1fdb('0x11'),JSON['stringify'](_0x2c4fb5));if(_0x2c4fb5['error']){if(_0x2c4fb5[_0x1fdb('0x12')][_0x1fdb('0x13')]===0x1f4){logger[_0x1fdb('0x12')](_0x1fdb('0xe'),_0x524abd,_0x2c4fb5['error'][_0x1fdb('0x14')]);return _0x416e93(_0x2c4fb5[_0x1fdb('0x12')]['message']);}logger[_0x1fdb('0x12')](_0x1fdb('0xe'),_0x524abd,_0x2c4fb5[_0x1fdb('0x12')]['message']);return _0x1b057c(_0x2c4fb5[_0x1fdb('0x12')][_0x1fdb('0x14')]);}else{logger[_0x1fdb('0xd')](_0x1fdb('0xe'),_0x524abd,_0x1fdb('0x11'));_0x1b057c(_0x2c4fb5[_0x1fdb('0x15')][_0x1fdb('0x14')]);}})[_0x1fdb('0x16')](function(_0x5febf){logger[_0x1fdb('0x12')](_0x1fdb('0xe'),_0x524abd,_0x5febf);_0x416e93(_0x5febf);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 424ed58..eb5fec8 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 _0xdb07=['update','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x2f3722,_0x5b49bc){var _0x2f836f=function(_0x188a24){while(--_0x188a24){_0x2f3722['push'](_0x2f3722['shift']());}};_0x2f836f(++_0x5b49bc);}(_0xdb07,0x7a));var _0x7db0=function(_0x30f781,_0x1ce35d){_0x30f781=_0x30f781-0x0;var _0x461df7=_0xdb07[_0x30f781];return _0x461df7;};'use strict';var multer=require(_0x7db0('0x0'));var util=require('util');var path=require(_0x7db0('0x1'));var timeout=require(_0x7db0('0x2'));var express=require('express');var router=express[_0x7db0('0x3')]();var auth=require(_0x7db0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7db0('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x7db0('0x6')]('/',auth[_0x7db0('0x7')](),controller['index']);router[_0x7db0('0x6')](_0x7db0('0x8'),auth[_0x7db0('0x7')](),controller[_0x7db0('0x9')]);router[_0x7db0('0xa')]('/',auth['isAuthenticated'](),controller[_0x7db0('0xb')]);router[_0x7db0('0xc')](_0x7db0('0x8'),auth[_0x7db0('0x7')](),controller[_0x7db0('0xd')]);router[_0x7db0('0xe')](_0x7db0('0x8'),auth[_0x7db0('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x452b=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','create','put','/:id','update','destroy'];(function(_0x11088e,_0x5a5df3){var _0x3d8f41=function(_0x5df772){while(--_0x5df772){_0x11088e['push'](_0x11088e['shift']());}};_0x3d8f41(++_0x5a5df3);}(_0x452b,0x111));var _0xb452=function(_0x21de4d,_0x5a5b33){_0x21de4d=_0x21de4d-0x0;var _0x3fb622=_0x452b[_0x21de4d];return _0x3fb622;};'use strict';var multer=require(_0xb452('0x0'));var util=require(_0xb452('0x1'));var path=require(_0xb452('0x2'));var timeout=require(_0xb452('0x3'));var express=require('express');var router=express[_0xb452('0x4')]();var auth=require(_0xb452('0x5'));var interaction=require(_0xb452('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0xb452('0x7')]('/',auth[_0xb452('0x8')](),controller[_0xb452('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb452('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb452('0xb')]);router[_0xb452('0xc')](_0xb452('0xd'),auth[_0xb452('0x8')](),controller[_0xb452('0xe')]);router['delete'](_0xb452('0xd'),auth[_0xb452('0x8')](),controller[_0xb452('0xf')]);module[_0xb452('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a7504a0..d9cd684 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 _0xb4c7=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x4a36df,_0x5f5a5b){var _0x151a86=function(_0x54928d){while(--_0x54928d){_0x4a36df['push'](_0x4a36df['shift']());}};_0x151a86(++_0x5f5a5b);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x41f5d3,_0x557dcf){_0x41f5d3=_0x41f5d3-0x0;var _0x125cad=_0xb4c7[_0x41f5d3];return _0x125cad;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'type':{'type':Sequelize[_0x7b4c('0x2')](_0x7b4c('0x3'),_0x7b4c('0x4'),'customVariable',_0x7b4c('0x5'),_0x7b4c('0x6')),'defaultValue':_0x7b4c('0x3')},'content':{'type':Sequelize[_0x7b4c('0x7')]},'key':{'type':Sequelize[_0x7b4c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7b4c('0x3'),_0x7b4c('0x4'),_0x7b4c('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7b4c('0x7')]},'nameField':{'type':Sequelize[_0x7b4c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b4c('0x7')]}}; \ No newline at end of file +var _0x7217=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1dedee,_0x30a762){var _0x2bae7b=function(_0x5a24cc){while(--_0x5a24cc){_0x1dedee['push'](_0x1dedee['shift']());}};_0x2bae7b(++_0x30a762);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'type':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7721('0x6')]},'key':{'type':Sequelize[_0x7721('0x6')]},'keyType':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'))},'keyContent':{'type':Sequelize[_0x7721('0x6')]},'idField':{'type':Sequelize[_0x7721('0x6')]},'nameField':{'type':Sequelize[_0x7721('0x6')]},'customField':{'type':Sequelize[_0x7721('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7721('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index abd877d..c30ae0f 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 _0x9c99=['offset','limit','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','Dynamics365Field','findAll','rows','catch','show','includeAll','find','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','count'];(function(_0x4a9804,_0x9c5a94){var _0x395b9c=function(_0xabc39b){while(--_0xabc39b){_0x4a9804['push'](_0x4a9804['shift']());}};_0x395b9c(++_0x9c5a94);}(_0x9c99,0x14c));var _0x99c9=function(_0x8b69e9,_0x1407f9){_0x8b69e9=_0x8b69e9-0x0;var _0x485d2d=_0x9c99[_0x8b69e9];return _0x485d2d;};'use strict';var pdf=require(_0x99c9('0x0'));var emlformat=require(_0x99c9('0x1'));var rimraf=require(_0x99c9('0x2'));var zipdir=require(_0x99c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x99c9('0x5'));var util=require(_0x99c9('0x6'));var path=require(_0x99c9('0x7'));var sox=require(_0x99c9('0x8'));var csv=require(_0x99c9('0x9'));var ejs=require(_0x99c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x99c9('0xb'));var jsforce=require(_0x99c9('0xc'));var deskjs=require(_0x99c9('0xd'));var toCsv=require(_0x99c9('0x9'));var querystring=require(_0x99c9('0xe'));var Papa=require(_0x99c9('0xf'));var Redis=require(_0x99c9('0x10'));var authService=require(_0x99c9('0x11'));var qs=require(_0x99c9('0x12'));var as=require(_0x99c9('0x13'));var hardwareService=require(_0x99c9('0x14'));var logger=require(_0x99c9('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x99c9('0x16'));var db=require(_0x99c9('0x17'))['db'];function respondWithStatusCode(_0x55cd3c,_0x52accc){_0x52accc=_0x52accc||0xcc;return function(_0x12c215){if(_0x12c215){return _0x55cd3c[_0x99c9('0x18')](_0x52accc);}return _0x55cd3c[_0x99c9('0x19')](_0x52accc)['end']();};}function respondWithResult(_0xab0eaa,_0x10004b){_0x10004b=_0x10004b||0xc8;return function(_0x4e490c){if(_0x4e490c){return _0xab0eaa['status'](_0x10004b)[_0x99c9('0x1a')](_0x4e490c);}};}function respondWithFilteredResult(_0x12f68c,_0x10bbfa){return function(_0x40c677){if(_0x40c677){var _0x5e17da=_0x40c677[_0x99c9('0x1b')],_0x1ca396=_0x10bbfa[_0x99c9('0x1c')],_0x134aad=_0x10bbfa['offset']+_0x10bbfa[_0x99c9('0x1d')],_0x2ea316;if(_0x134aad>=_0x5e17da){_0x134aad=_0x5e17da;_0x2ea316=0xc8;}else{_0x2ea316=0xce;}_0x12f68c[_0x99c9('0x19')](_0x2ea316);return _0x12f68c['set'](_0x99c9('0x1e'),_0x1ca396+'-'+_0x134aad+'/'+_0x5e17da)['json'](_0x40c677);}return null;};}function patchUpdates(_0x2fb701){return function(_0x4d101d){try{jsonpatch[_0x99c9('0x1f')](_0x4d101d,_0x2fb701,!![]);}catch(_0x13abf3){return BPromise['reject'](_0x13abf3);}return _0x4d101d[_0x99c9('0x20')]();};}function saveUpdates(_0x34b232,_0x339c8f){return function(_0x279d0d){if(_0x279d0d){return _0x279d0d[_0x99c9('0x21')](_0x34b232)[_0x99c9('0x22')](function(_0x13359d){return _0x13359d;});}return null;};}function removeEntity(_0x1cc157,_0x233ecf){return function(_0x43a069){if(_0x43a069){return _0x43a069['destroy']()[_0x99c9('0x22')](function(){_0x1cc157[_0x99c9('0x19')](0xcc)[_0x99c9('0x23')]();});}};}function handleEntityNotFound(_0x3a53bb,_0x54d94b){return function(_0x1b82f6){if(!_0x1b82f6){_0x3a53bb[_0x99c9('0x18')](0x194);}return _0x1b82f6;};}function handleError(_0x2974eb,_0x31ee1b){_0x31ee1b=_0x31ee1b||0x1f4;return function(_0x25c238){logger[_0x99c9('0x24')](_0x25c238[_0x99c9('0x25')]);if(_0x25c238[_0x99c9('0x26')]){delete _0x25c238['name'];}_0x2974eb[_0x99c9('0x19')](_0x31ee1b)[_0x99c9('0x27')](_0x25c238);};}exports[_0x99c9('0x28')]=function(_0x407e81,_0x1ec1c1){var _0x24f193={},_0x24c5c1={},_0x4745c2={'count':0x0,'rows':[]};var _0x4a2307=_[_0x99c9('0x29')](db['Dynamics365Field'][_0x99c9('0x2a')],function(_0x3f63a0){return{'name':_0x3f63a0[_0x99c9('0x2b')],'type':_0x3f63a0['type']['key']};});_0x24c5c1[_0x99c9('0x2c')]=_[_0x99c9('0x29')](_0x4a2307,'name');_0x24c5c1['query']=_[_0x99c9('0x2d')](_0x407e81['query']);_0x24c5c1[_0x99c9('0x2e')]=_['intersection'](_0x24c5c1['model'],_0x24c5c1[_0x99c9('0x2f')]);_0x24f193[_0x99c9('0x30')]=_[_0x99c9('0x31')](_0x24c5c1[_0x99c9('0x2c')],qs[_0x99c9('0x32')](_0x407e81[_0x99c9('0x2f')]['fields']));_0x24f193[_0x99c9('0x30')]=_0x24f193['attributes'][_0x99c9('0x33')]?_0x24f193[_0x99c9('0x30')]:_0x24c5c1[_0x99c9('0x2c')];if(!_0x407e81['query']['hasOwnProperty'](_0x99c9('0x34'))){_0x24f193[_0x99c9('0x1d')]=qs[_0x99c9('0x1d')](_0x407e81[_0x99c9('0x2f')][_0x99c9('0x1d')]);_0x24f193[_0x99c9('0x1c')]=qs[_0x99c9('0x1c')](_0x407e81['query'][_0x99c9('0x1c')]);}_0x24f193['order']=qs[_0x99c9('0x35')](_0x407e81[_0x99c9('0x2f')][_0x99c9('0x35')]);_0x24f193[_0x99c9('0x36')]=qs['filters'](_[_0x99c9('0x37')](_0x407e81[_0x99c9('0x2f')],_0x24c5c1['filters']),_0x4a2307);if(_0x407e81[_0x99c9('0x2f')][_0x99c9('0x38')]){_0x24f193['where']=_[_0x99c9('0x39')](_0x24f193[_0x99c9('0x36')],{'$or':_[_0x99c9('0x29')](_0x4a2307,function(_0x16084e){if(_0x16084e['type']!==_0x99c9('0x3a')){var _0x1406e5={};_0x1406e5[_0x16084e[_0x99c9('0x26')]]={'$like':'%'+_0x407e81['query'][_0x99c9('0x38')]+'%'};return _0x1406e5;}})});}_0x24f193=_[_0x99c9('0x39')]({},_0x24f193,_0x407e81[_0x99c9('0x3b')]);var _0x30a7b9={'where':_0x24f193[_0x99c9('0x36')]};return db['Dynamics365Field'][_0x99c9('0x1b')](_0x30a7b9)['then'](function(_0x1a9b8b){_0x4745c2[_0x99c9('0x1b')]=_0x1a9b8b;if(_0x407e81[_0x99c9('0x2f')]['includeAll']){_0x24f193[_0x99c9('0x3c')]=[{'all':!![]}];}return db[_0x99c9('0x3d')][_0x99c9('0x3e')](_0x24f193);})['then'](function(_0x1013b4){_0x4745c2[_0x99c9('0x3f')]=_0x1013b4;return _0x4745c2;})[_0x99c9('0x22')](respondWithFilteredResult(_0x1ec1c1,_0x24f193))[_0x99c9('0x40')](handleError(_0x1ec1c1,null));};exports[_0x99c9('0x41')]=function(_0x4608cd,_0x25e21b){var _0x11ecf4={'raw':!![],'where':{'id':_0x4608cd['params']['id']}},_0x4c4a27={};_0x4c4a27[_0x99c9('0x2c')]=_[_0x99c9('0x2d')](db['Dynamics365Field'][_0x99c9('0x2a')]);_0x4c4a27[_0x99c9('0x2f')]=_[_0x99c9('0x2d')](_0x4608cd['query']);_0x4c4a27[_0x99c9('0x2e')]=_[_0x99c9('0x31')](_0x4c4a27['model'],_0x4c4a27[_0x99c9('0x2f')]);_0x11ecf4['attributes']=_[_0x99c9('0x31')](_0x4c4a27['model'],qs['fields'](_0x4608cd[_0x99c9('0x2f')]['fields']));_0x11ecf4[_0x99c9('0x30')]=_0x11ecf4[_0x99c9('0x30')]['length']?_0x11ecf4[_0x99c9('0x30')]:_0x4c4a27[_0x99c9('0x2c')];if(_0x4608cd[_0x99c9('0x2f')][_0x99c9('0x42')]){_0x11ecf4[_0x99c9('0x3c')]=[{'all':!![]}];}_0x11ecf4=_[_0x99c9('0x39')]({},_0x11ecf4,_0x4608cd[_0x99c9('0x3b')]);return db[_0x99c9('0x3d')][_0x99c9('0x43')](_0x11ecf4)[_0x99c9('0x22')](handleEntityNotFound(_0x25e21b,null))['then'](respondWithResult(_0x25e21b,null))[_0x99c9('0x40')](handleError(_0x25e21b,null));};exports[_0x99c9('0x44')]=function(_0x4128d4,_0x5575ac){return db[_0x99c9('0x3d')][_0x99c9('0x44')](_0x4128d4[_0x99c9('0x45')],{})['then'](respondWithResult(_0x5575ac,0xc9))[_0x99c9('0x40')](handleError(_0x5575ac,null));};exports['update']=function(_0x2c0b1b,_0x1d07ff){if(_0x2c0b1b[_0x99c9('0x45')]['id']){delete _0x2c0b1b['body']['id'];}return db[_0x99c9('0x3d')][_0x99c9('0x43')]({'where':{'id':_0x2c0b1b['params']['id']}})['then'](handleEntityNotFound(_0x1d07ff,null))[_0x99c9('0x22')](saveUpdates(_0x2c0b1b[_0x99c9('0x45')],null))[_0x99c9('0x22')](respondWithResult(_0x1d07ff,null))[_0x99c9('0x40')](handleError(_0x1d07ff,null));};exports[_0x99c9('0x46')]=function(_0x282bc9,_0x55c5c1){return db['Dynamics365Field'][_0x99c9('0x43')]({'where':{'id':_0x282bc9[_0x99c9('0x47')]['id']}})[_0x99c9('0x22')](handleEntityNotFound(_0x55c5c1,null))[_0x99c9('0x22')](removeEntity(_0x55c5c1,null))[_0x99c9('0x40')](handleError(_0x55c5c1,null));}; \ No newline at end of file +var _0x8c89=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x8c89,0x113));var _0x98c8=function(_0x4e6d56,_0x3a7f7b){_0x4e6d56=_0x4e6d56-0x0;var _0x415041=_0x8c89[_0x4e6d56];return _0x415041;};'use strict';var pdf=require(_0x98c8('0x0'));var emlformat=require(_0x98c8('0x1'));var rimraf=require(_0x98c8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98c8('0x3'));var rp=require(_0x98c8('0x4'));var moment=require(_0x98c8('0x5'));var BPromise=require(_0x98c8('0x6'));var Mustache=require(_0x98c8('0x7'));var util=require('util');var path=require(_0x98c8('0x8'));var sox=require(_0x98c8('0x9'));var csv=require(_0x98c8('0xa'));var ejs=require(_0x98c8('0xb'));var fs=require('fs');var _=require(_0x98c8('0xc'));var squel=require(_0x98c8('0xd'));var crypto=require(_0x98c8('0xe'));var jsforce=require(_0x98c8('0xf'));var deskjs=require(_0x98c8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98c8('0x11'));var Papa=require(_0x98c8('0x12'));var Redis=require(_0x98c8('0x13'));var authService=require(_0x98c8('0x14'));var qs=require(_0x98c8('0x15'));var as=require(_0x98c8('0x16'));var hardwareService=require(_0x98c8('0x17'));var logger=require('../../config/logger')(_0x98c8('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x98c8('0x19'));var db=require(_0x98c8('0x1a'))['db'];function respondWithStatusCode(_0x532b2e,_0x4dca43){_0x4dca43=_0x4dca43||0xcc;return function(_0x2a3bef){if(_0x2a3bef){return _0x532b2e['sendStatus'](_0x4dca43);}return _0x532b2e[_0x98c8('0x1b')](_0x4dca43)[_0x98c8('0x1c')]();};}function respondWithResult(_0x34b372,_0x6302dd){_0x6302dd=_0x6302dd||0xc8;return function(_0x1b6dd){if(_0x1b6dd){return _0x34b372['status'](_0x6302dd)['json'](_0x1b6dd);}};}function respondWithFilteredResult(_0x60417b,_0x3a1545){return function(_0x15fb24){if(_0x15fb24){var _0x58600b=_0x15fb24[_0x98c8('0x1d')],_0x1143a6=_0x3a1545[_0x98c8('0x1e')],_0x1217e2=_0x3a1545[_0x98c8('0x1e')]+_0x3a1545[_0x98c8('0x1f')],_0x5cca36;if(_0x1217e2>=_0x58600b){_0x1217e2=_0x58600b;_0x5cca36=0xc8;}else{_0x5cca36=0xce;}_0x60417b[_0x98c8('0x1b')](_0x5cca36);return _0x60417b['set'](_0x98c8('0x20'),_0x1143a6+'-'+_0x1217e2+'/'+_0x58600b)[_0x98c8('0x21')](_0x15fb24);}return null;};}function patchUpdates(_0x579e6d){return function(_0x2e3119){try{jsonpatch[_0x98c8('0x22')](_0x2e3119,_0x579e6d,!![]);}catch(_0x540dca){return BPromise[_0x98c8('0x23')](_0x540dca);}return _0x2e3119[_0x98c8('0x24')]();};}function saveUpdates(_0x4d8fd4,_0x1cec71){return function(_0x3595f5){if(_0x3595f5){return _0x3595f5[_0x98c8('0x25')](_0x4d8fd4)[_0x98c8('0x26')](function(_0x2d20ca){return _0x2d20ca;});}return null;};}function removeEntity(_0x36314a,_0x593109){return function(_0x4dfbe6){if(_0x4dfbe6){return _0x4dfbe6['destroy']()['then'](function(){_0x36314a[_0x98c8('0x1b')](0xcc)[_0x98c8('0x1c')]();});}};}function handleEntityNotFound(_0x3f360f,_0x400733){return function(_0xc30218){if(!_0xc30218){_0x3f360f['sendStatus'](0x194);}return _0xc30218;};}function handleError(_0x1aec00,_0x12a3d4){_0x12a3d4=_0x12a3d4||0x1f4;return function(_0x4299c7){logger[_0x98c8('0x27')](_0x4299c7['stack']);if(_0x4299c7[_0x98c8('0x28')]){delete _0x4299c7[_0x98c8('0x28')];}_0x1aec00[_0x98c8('0x1b')](_0x12a3d4)[_0x98c8('0x29')](_0x4299c7);};}exports[_0x98c8('0x2a')]=function(_0x2242a6,_0xe671c){var _0x53d7a0={},_0x22134e={},_0x37b00f={'count':0x0,'rows':[]};var _0xc4a023=_[_0x98c8('0x2b')](db[_0x98c8('0x2c')][_0x98c8('0x2d')],function(_0x37982d){return{'name':_0x37982d[_0x98c8('0x2e')],'type':_0x37982d[_0x98c8('0x2f')][_0x98c8('0x30')]};});_0x22134e['model']=_['map'](_0xc4a023,'name');_0x22134e['query']=_[_0x98c8('0x31')](_0x2242a6[_0x98c8('0x32')]);_0x22134e[_0x98c8('0x33')]=_[_0x98c8('0x34')](_0x22134e[_0x98c8('0x35')],_0x22134e['query']);_0x53d7a0[_0x98c8('0x36')]=_[_0x98c8('0x34')](_0x22134e['model'],qs['fields'](_0x2242a6[_0x98c8('0x32')][_0x98c8('0x37')]));_0x53d7a0['attributes']=_0x53d7a0[_0x98c8('0x36')][_0x98c8('0x38')]?_0x53d7a0[_0x98c8('0x36')]:_0x22134e['model'];if(!_0x2242a6[_0x98c8('0x32')][_0x98c8('0x39')](_0x98c8('0x3a'))){_0x53d7a0[_0x98c8('0x1f')]=qs[_0x98c8('0x1f')](_0x2242a6['query'][_0x98c8('0x1f')]);_0x53d7a0[_0x98c8('0x1e')]=qs['offset'](_0x2242a6[_0x98c8('0x32')]['offset']);}_0x53d7a0[_0x98c8('0x3b')]=qs['sort'](_0x2242a6[_0x98c8('0x32')][_0x98c8('0x3c')]);_0x53d7a0[_0x98c8('0x3d')]=qs[_0x98c8('0x33')](_['pick'](_0x2242a6['query'],_0x22134e[_0x98c8('0x33')]),_0xc4a023);if(_0x2242a6[_0x98c8('0x32')][_0x98c8('0x3e')]){_0x53d7a0[_0x98c8('0x3d')]=_[_0x98c8('0x3f')](_0x53d7a0[_0x98c8('0x3d')],{'$or':_[_0x98c8('0x2b')](_0xc4a023,function(_0x539579){if(_0x539579[_0x98c8('0x2f')]!==_0x98c8('0x40')){var _0xf74e8d={};_0xf74e8d[_0x539579[_0x98c8('0x28')]]={'$like':'%'+_0x2242a6['query'][_0x98c8('0x3e')]+'%'};return _0xf74e8d;}})});}_0x53d7a0=_['merge']({},_0x53d7a0,_0x2242a6[_0x98c8('0x41')]);var _0x117d0a={'where':_0x53d7a0[_0x98c8('0x3d')]};return db[_0x98c8('0x2c')][_0x98c8('0x1d')](_0x117d0a)['then'](function(_0xf07341){_0x37b00f[_0x98c8('0x1d')]=_0xf07341;if(_0x2242a6[_0x98c8('0x32')][_0x98c8('0x42')]){_0x53d7a0['include']=[{'all':!![]}];}return db[_0x98c8('0x2c')][_0x98c8('0x43')](_0x53d7a0);})[_0x98c8('0x26')](function(_0x4ac2a7){_0x37b00f[_0x98c8('0x44')]=_0x4ac2a7;return _0x37b00f;})[_0x98c8('0x26')](respondWithFilteredResult(_0xe671c,_0x53d7a0))['catch'](handleError(_0xe671c,null));};exports['show']=function(_0x15faa4,_0x109065){var _0x34aa21={'raw':!![],'where':{'id':_0x15faa4['params']['id']}},_0x10827e={};_0x10827e['model']=_[_0x98c8('0x31')](db[_0x98c8('0x2c')][_0x98c8('0x2d')]);_0x10827e[_0x98c8('0x32')]=_[_0x98c8('0x31')](_0x15faa4[_0x98c8('0x32')]);_0x10827e[_0x98c8('0x33')]=_[_0x98c8('0x34')](_0x10827e['model'],_0x10827e[_0x98c8('0x32')]);_0x34aa21[_0x98c8('0x36')]=_['intersection'](_0x10827e[_0x98c8('0x35')],qs['fields'](_0x15faa4['query'][_0x98c8('0x37')]));_0x34aa21[_0x98c8('0x36')]=_0x34aa21[_0x98c8('0x36')][_0x98c8('0x38')]?_0x34aa21[_0x98c8('0x36')]:_0x10827e['model'];if(_0x15faa4[_0x98c8('0x32')][_0x98c8('0x42')]){_0x34aa21[_0x98c8('0x45')]=[{'all':!![]}];}_0x34aa21=_[_0x98c8('0x3f')]({},_0x34aa21,_0x15faa4[_0x98c8('0x41')]);return db[_0x98c8('0x2c')][_0x98c8('0x46')](_0x34aa21)['then'](handleEntityNotFound(_0x109065,null))[_0x98c8('0x26')](respondWithResult(_0x109065,null))[_0x98c8('0x47')](handleError(_0x109065,null));};exports[_0x98c8('0x48')]=function(_0x1cd68e,_0x3db413){return db[_0x98c8('0x2c')][_0x98c8('0x48')](_0x1cd68e[_0x98c8('0x49')],{})[_0x98c8('0x26')](respondWithResult(_0x3db413,0xc9))[_0x98c8('0x47')](handleError(_0x3db413,null));};exports[_0x98c8('0x25')]=function(_0xc7696e,_0x12413f){if(_0xc7696e[_0x98c8('0x49')]['id']){delete _0xc7696e[_0x98c8('0x49')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0xc7696e[_0x98c8('0x4a')]['id']}})[_0x98c8('0x26')](handleEntityNotFound(_0x12413f,null))['then'](saveUpdates(_0xc7696e[_0x98c8('0x49')],null))[_0x98c8('0x26')](respondWithResult(_0x12413f,null))[_0x98c8('0x47')](handleError(_0x12413f,null));};exports[_0x98c8('0x4b')]=function(_0x269dc0,_0x244ca0){return db[_0x98c8('0x2c')]['find']({'where':{'id':_0x269dc0[_0x98c8('0x4a')]['id']}})[_0x98c8('0x26')](handleEntityNotFound(_0x244ca0,null))[_0x98c8('0x26')](removeEntity(_0x244ca0,null))[_0x98c8('0x47')](handleError(_0x244ca0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 0f99135..cb20b8b 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 _0x4b1f=['dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields'];(function(_0xd67341,_0x5d7dc8){var _0x2df853=function(_0x216ae2){while(--_0x216ae2){_0xd67341['push'](_0xd67341['shift']());}};_0x2df853(++_0x5d7dc8);}(_0x4b1f,0x102));var _0xf4b1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4b1f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require(_0xf4b1('0x2'))(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var BPromise=require(_0xf4b1('0x5'));var rp=require(_0xf4b1('0x6'));var fs=require('fs');var path=require(_0xf4b1('0x7'));var rimraf=require(_0xf4b1('0x8'));var config=require(_0xf4b1('0x9'));var attributes=require(_0xf4b1('0xa'));module['exports']=function(_0x5460d8,_0x441ea2){return _0x5460d8[_0xf4b1('0xb')](_0xf4b1('0xc'),attributes,{'tableName':_0xf4b1('0xd'),'paranoid':![],'indexes':[{'name':_0xf4b1('0xe'),'fields':[_0xf4b1('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa848=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','request-promise'];(function(_0x1532be,_0x23a6e2){var _0x4f12f8=function(_0x55eb4f){while(--_0x55eb4f){_0x1532be['push'](_0x1532be['shift']());}};_0x4f12f8(++_0x23a6e2);}(_0xa848,0x64));var _0x8a84=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa848[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var logger=require(_0x8a84('0x2'))(_0x8a84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a84('0x4'));var fs=require('fs');var path=require(_0x8a84('0x5'));var rimraf=require(_0x8a84('0x6'));var config=require(_0x8a84('0x7'));var attributes=require(_0x8a84('0x8'));module[_0x8a84('0x9')]=function(_0x888994,_0x4e0090){return _0x888994[_0x8a84('0xa')](_0x8a84('0xb'),attributes,{'tableName':_0x8a84('0xc'),'paranoid':![],'indexes':[{'name':_0x8a84('0xd'),'fields':[_0x8a84('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index dbc361c..aabd58e 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 _0xdded=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x451218,_0x372cd7){var _0x6127fd=function(_0x44003d){while(--_0x44003d){_0x451218['push'](_0x451218['shift']());}};_0x6127fd(++_0x372cd7);}(_0xdded,0x17a));var _0xddde=function(_0x5a33d0,_0x17f33a){_0x5a33d0=_0x5a33d0-0x0;var _0x1e54f9=_0xdded[_0x5a33d0];return _0x1e54f9;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var moment=require(_0xddde('0x2'));var BPromise=require(_0xddde('0x3'));var rs=require(_0xddde('0x4'));var fs=require('fs');var Redis=require(_0xddde('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xddde('0x6'));var logger=require(_0xddde('0x7'))(_0xddde('0x8'));var config=require(_0xddde('0x9'));var jayson=require(_0xddde('0xa'));var client=jayson[_0xddde('0xb')][_0xddde('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cea18,_0x516eb5,_0x18d8b8){return new BPromise(function(_0x3a5e8a,_0x5f1a34){return client[_0xddde('0xd')](_0x3cea18,_0x18d8b8)['then'](function(_0x48dd55){logger['info'](_0xddde('0xe'),_0x516eb5,'request\x20sent');logger[_0xddde('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x516eb5,_0xddde('0x10'),JSON[_0xddde('0x11')](_0x48dd55));if(_0x48dd55[_0xddde('0x12')]){if(_0x48dd55[_0xddde('0x12')][_0xddde('0x13')]===0x1f4){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')]['message']);return _0x5f1a34(_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);}logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);return _0x3a5e8a(_0x48dd55['error'][_0xddde('0x14')]);}else{logger[_0xddde('0x15')](_0xddde('0xe'),_0x516eb5,'request\x20sent');_0x3a5e8a(_0x48dd55['result'][_0xddde('0x14')]);}})['catch'](function(_0x30a9da){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x30a9da);_0x5f1a34(_0x30a9da);});});} \ No newline at end of file +var _0x3e0c=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b6241,_0x4bd222){var _0x4a558c=function(_0x2d6fa8){while(--_0x2d6fa8){_0x5b6241['push'](_0x5b6241['shift']());}};_0x4a558c(++_0x4bd222);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x5304c0,_0x240d71){_0x5304c0=_0x5304c0-0x0;var _0x11d983=_0x3e0c[_0x5304c0];return _0x11d983;};'use strict';var _=require(_0xc3e0('0x0'));var util=require(_0xc3e0('0x1'));var moment=require(_0xc3e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e0('0x3'));var fs=require('fs');var Redis=require(_0xc3e0('0x4'));var db=require(_0xc3e0('0x5'))['db'];var utils=require(_0xc3e0('0x6'));var logger=require(_0xc3e0('0x7'))('rpc');var config=require(_0xc3e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x553e6d,_0x6db846,_0x32976c){return new BPromise(function(_0x1cfcf5,_0x4ad1bd){return client['request'](_0x553e6d,_0x32976c)['then'](function(_0x5a2630){logger[_0xc3e0('0x9')](_0xc3e0('0xa'),_0x6db846,_0xc3e0('0xb'));logger[_0xc3e0('0xc')](_0xc3e0('0xd'),_0x6db846,_0xc3e0('0xb'),JSON[_0xc3e0('0xe')](_0x5a2630));if(_0x5a2630['error']){if(_0x5a2630[_0xc3e0('0xf')]['code']===0x1f4){logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x5a2630['error'][_0xc3e0('0x10')]);return _0x4ad1bd(_0x5a2630['error'][_0xc3e0('0x10')]);}logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x5a2630[_0xc3e0('0xf')][_0xc3e0('0x10')]);return _0x1cfcf5(_0x5a2630[_0xc3e0('0xf')][_0xc3e0('0x10')]);}else{logger['info'](_0xc3e0('0xa'),_0x6db846,_0xc3e0('0xb'));_0x1cfcf5(_0x5a2630['result'][_0xc3e0('0x10')]);}})[_0xc3e0('0x11')](function(_0x25891a){logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x25891a);_0x4ad1bd(_0x25891a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8a23f7a..8f41dbb 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 _0xeb51=['Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','post','addConfiguration','put','update','/:id','exports','multer','util','connect-timeout','express'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xeb51,0x164));var _0x1eb5=function(_0x8c88fe,_0x4b818b){_0x8c88fe=_0x8c88fe-0x0;var _0xd83814=_0xeb51[_0x8c88fe];return _0xd83814;};'use strict';var multer=require(_0x1eb5('0x0'));var util=require(_0x1eb5('0x1'));var path=require('path');var timeout=require(_0x1eb5('0x2'));var express=require(_0x1eb5('0x3'));var router=express[_0x1eb5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1eb5('0x5'));var config=require('../../config/environment');var controller=require(_0x1eb5('0x6'));router[_0x1eb5('0x7')]('/',auth[_0x1eb5('0x8')](),controller[_0x1eb5('0x9')]);router[_0x1eb5('0x7')]('/:id',auth[_0x1eb5('0x8')](),controller['show']);router[_0x1eb5('0x7')](_0x1eb5('0xa'),auth[_0x1eb5('0x8')](),controller[_0x1eb5('0xb')]);router[_0x1eb5('0x7')]('/:id/fields',auth[_0x1eb5('0x8')](),controller['getFields']);router[_0x1eb5('0xc')]('/',auth[_0x1eb5('0x8')](),controller['create']);router[_0x1eb5('0xc')](_0x1eb5('0xa'),auth[_0x1eb5('0x8')](),controller[_0x1eb5('0xd')]);router[_0x1eb5('0xe')]('/:id',auth[_0x1eb5('0x8')](),controller[_0x1eb5('0xf')]);router['delete'](_0x1eb5('0x10'),auth[_0x1eb5('0x8')](),controller['destroy']);module[_0x1eb5('0x11')]=router; \ No newline at end of file +var _0x164a=['exports','util','path','connect-timeout','Router','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x1f6ab9,_0x4df4bd){var _0x184e50=function(_0x20eb4a){while(--_0x20eb4a){_0x1f6ab9['push'](_0x1f6ab9['shift']());}};_0x184e50(++_0x4df4bd);}(_0x164a,0x133));var _0xa164=function(_0x4399a6,_0x4f3ef7){_0x4399a6=_0x4399a6-0x0;var _0x20ba25=_0x164a[_0x4399a6];return _0x20ba25;};'use strict';var multer=require('multer');var util=require(_0xa164('0x0'));var path=require(_0xa164('0x1'));var timeout=require(_0xa164('0x2'));var express=require('express');var router=express[_0xa164('0x3')]();var auth=require(_0xa164('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa164('0x5'));router[_0xa164('0x6')]('/',auth[_0xa164('0x7')](),controller['index']);router[_0xa164('0x6')](_0xa164('0x8'),auth[_0xa164('0x7')](),controller['show']);router[_0xa164('0x6')](_0xa164('0x9'),auth[_0xa164('0x7')](),controller['getConfigurations']);router[_0xa164('0x6')](_0xa164('0xa'),auth[_0xa164('0x7')](),controller['getFields']);router[_0xa164('0xb')]('/',auth[_0xa164('0x7')](),controller[_0xa164('0xc')]);router[_0xa164('0xb')]('/:id/configurations',auth[_0xa164('0x7')](),controller[_0xa164('0xd')]);router[_0xa164('0xe')](_0xa164('0x8'),auth['isAuthenticated'](),controller[_0xa164('0xf')]);router[_0xa164('0x10')]('/:id',auth[_0xa164('0x7')](),controller['destroy']);module[_0xa164('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a3587ae..70816da 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 _0x91ba=['exports','STRING','sequelize'];(function(_0x208af6,_0x553409){var _0x132ace=function(_0x421734){while(--_0x421734){_0x208af6['push'](_0x208af6['shift']());}};_0x132ace(++_0x553409);}(_0x91ba,0x74));var _0xa91b=function(_0x2c3611,_0x1c1615){_0x2c3611=_0x2c3611-0x0;var _0x464eee=_0x91ba[_0x2c3611];return _0x464eee;};'use strict';var Sequelize=require(_0xa91b('0x0'));module[_0xa91b('0x1')]={'name':{'type':Sequelize[_0xa91b('0x2')]},'description':{'type':Sequelize[_0xa91b('0x2')]},'username':{'type':Sequelize[_0xa91b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xa91b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa91b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbb4d=['exports','STRING','sequelize'];(function(_0x1d9123,_0x56d6b4){var _0x578902=function(_0x3c51e2){while(--_0x3c51e2){_0x1d9123['push'](_0x1d9123['shift']());}};_0x578902(++_0x56d6b4);}(_0xbb4d,0x1d6));var _0xdbb4=function(_0x24896c,_0x3d3472){_0x24896c=_0x24896c-0x0;var _0x4dbcf6=_0xbb4d[_0x24896c];return _0x4dbcf6;};'use strict';var Sequelize=require(_0xdbb4('0x0'));module[_0xdbb4('0x1')]={'name':{'type':Sequelize[_0xdbb4('0x2')]},'description':{'type':Sequelize[_0xdbb4('0x2')]},'username':{'type':Sequelize[_0xdbb4('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdbb4('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdbb4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index edfec03..529058a 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 _0xd8e7=['group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','map','FreshdeskAccount','rawAttributes','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','destroy','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshdeskField','getFields','findOne','remoteUri','apiKey','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','%s:X','toString','base64','requester','subject','agent','description','priority'];(function(_0x17373b,_0x2beab7){var _0x351660=function(_0x245dc1){while(--_0x245dc1){_0x17373b['push'](_0x17373b['shift']());}};_0x351660(++_0x2beab7);}(_0xd8e7,0x108));var _0x7d8e=function(_0x1c45aa,_0xdc51f){_0x1c45aa=_0x1c45aa-0x0;var _0x124a4d=_0xd8e7[_0x1c45aa];return _0x124a4d;};'use strict';var pdf=require(_0x7d8e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d8e('0x1'));var jsonpatch=require(_0x7d8e('0x2'));var rp=require(_0x7d8e('0x3'));var moment=require('moment');var BPromise=require(_0x7d8e('0x4'));var Mustache=require(_0x7d8e('0x5'));var util=require(_0x7d8e('0x6'));var path=require(_0x7d8e('0x7'));var sox=require(_0x7d8e('0x8'));var csv=require(_0x7d8e('0x9'));var ejs=require(_0x7d8e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7d8e('0xb'));var jsforce=require(_0x7d8e('0xc'));var deskjs=require(_0x7d8e('0xd'));var toCsv=require(_0x7d8e('0x9'));var querystring=require(_0x7d8e('0xe'));var Papa=require(_0x7d8e('0xf'));var Redis=require('ioredis');var authService=require(_0x7d8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d8e('0x11'));var hardwareService=require(_0x7d8e('0x12'));var logger=require(_0x7d8e('0x13'))(_0x7d8e('0x14'));var utils=require(_0x7d8e('0x15'));var config=require(_0x7d8e('0x16'));var licenseUtil=require(_0x7d8e('0x17'));var db=require(_0x7d8e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x7d8e('0x19')][_0x7d8e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2d1d8f,_0x39446a,_0x375c9f,_0x4edd9c){return new BPromise(function(_0x41d41b,_0x13d33d){var _0x2a9f61=_0x4edd9c||client;return _0x2a9f61['request'](_0x2d1d8f,_0x375c9f)[_0x7d8e('0x1b')](function(_0x3bb066){logger[_0x7d8e('0x1c')](_0x7d8e('0x1d'),_0x39446a,_0x7d8e('0x1e'));logger[_0x7d8e('0x1f')](_0x7d8e('0x20'),_0x39446a,_0x7d8e('0x1e'),JSON[_0x7d8e('0x21')](_0x3bb066));if(_0x3bb066[_0x7d8e('0x22')]){if(_0x3bb066[_0x7d8e('0x22')]['code']===0x1f4){logger[_0x7d8e('0x22')](_0x7d8e('0x1d'),_0x39446a,_0x3bb066[_0x7d8e('0x22')][_0x7d8e('0x23')]);return _0x13d33d(_0x3bb066[_0x7d8e('0x22')]['message']);}logger[_0x7d8e('0x22')](_0x7d8e('0x1d'),_0x39446a,_0x3bb066[_0x7d8e('0x22')]['message']);return _0x41d41b(_0x3bb066[_0x7d8e('0x22')][_0x7d8e('0x23')]);}else{logger[_0x7d8e('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x39446a,_0x7d8e('0x1e'));_0x41d41b(_0x3bb066[_0x7d8e('0x24')][_0x7d8e('0x23')]);}})[_0x7d8e('0x25')](function(_0x4859c7){logger['error'](_0x7d8e('0x1d'),_0x39446a,_0x4859c7);_0x13d33d(_0x4859c7);});});}function respondWithStatusCode(_0x4660dc,_0x40f6d7){_0x40f6d7=_0x40f6d7||0xcc;return function(_0xd1f27a){if(_0xd1f27a){return _0x4660dc['sendStatus'](_0x40f6d7);}return _0x4660dc[_0x7d8e('0x26')](_0x40f6d7)[_0x7d8e('0x27')]();};}function respondWithResult(_0xf235a8,_0x2228f1){_0x2228f1=_0x2228f1||0xc8;return function(_0x5890ee){if(_0x5890ee){return _0xf235a8[_0x7d8e('0x26')](_0x2228f1)[_0x7d8e('0x28')](_0x5890ee);}};}function respondWithFilteredResult(_0x20cd88,_0x2531fe){return function(_0x2e6c30){if(_0x2e6c30){var _0x491fea=_0x2e6c30[_0x7d8e('0x29')],_0xaccf54=_0x2531fe[_0x7d8e('0x2a')],_0x2ff3ff=_0x2531fe['offset']+_0x2531fe[_0x7d8e('0x2b')],_0x3b26f8;if(_0x2ff3ff>=_0x491fea){_0x2ff3ff=_0x491fea;_0x3b26f8=0xc8;}else{_0x3b26f8=0xce;}_0x20cd88[_0x7d8e('0x26')](_0x3b26f8);return _0x20cd88['set'](_0x7d8e('0x2c'),_0xaccf54+'-'+_0x2ff3ff+'/'+_0x491fea)['json'](_0x2e6c30);}return null;};}function patchUpdates(_0x2c228e){return function(_0x5424ce){try{jsonpatch[_0x7d8e('0x2d')](_0x5424ce,_0x2c228e,!![]);}catch(_0x45104b){return BPromise[_0x7d8e('0x2e')](_0x45104b);}return _0x5424ce[_0x7d8e('0x2f')]();};}function saveUpdates(_0x2f9a50,_0x7fd043){return function(_0x41246a){if(_0x41246a){return _0x41246a[_0x7d8e('0x30')](_0x2f9a50)[_0x7d8e('0x1b')](function(_0x1c590a){return _0x1c590a;});}return null;};}function removeEntity(_0x530430,_0x3d8f3e){return function(_0x19d70b){if(_0x19d70b){return _0x19d70b['destroy']()['then'](function(){_0x530430[_0x7d8e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x528965,_0x6fdcd7){return function(_0x358c1c){if(!_0x358c1c){_0x528965[_0x7d8e('0x31')](0x194);}return _0x358c1c;};}function handleError(_0x15bf46,_0xa23613){_0xa23613=_0xa23613||0x1f4;return function(_0x55e7ff){logger[_0x7d8e('0x22')](_0x55e7ff[_0x7d8e('0x32')]);if(_0x55e7ff[_0x7d8e('0x33')]){delete _0x55e7ff[_0x7d8e('0x33')];}_0x15bf46['status'](_0xa23613)[_0x7d8e('0x34')](_0x55e7ff);};}exports['index']=function(_0x3d265b,_0x4f0f78){var _0x1b396f={},_0x36d847={},_0x265851={'count':0x0,'rows':[]};var _0x53bf5f=_[_0x7d8e('0x35')](db[_0x7d8e('0x36')][_0x7d8e('0x37')],function(_0x1b9397){return{'name':_0x1b9397['fieldName'],'type':_0x1b9397['type'][_0x7d8e('0x38')]};});_0x36d847['model']=_[_0x7d8e('0x35')](_0x53bf5f,_0x7d8e('0x33'));_0x36d847['query']=_['keys'](_0x3d265b[_0x7d8e('0x39')]);_0x36d847[_0x7d8e('0x3a')]=_['intersection'](_0x36d847[_0x7d8e('0x3b')],_0x36d847[_0x7d8e('0x39')]);_0x1b396f[_0x7d8e('0x3c')]=_[_0x7d8e('0x3d')](_0x36d847[_0x7d8e('0x3b')],qs[_0x7d8e('0x3e')](_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x3e')]));_0x1b396f[_0x7d8e('0x3c')]=_0x1b396f[_0x7d8e('0x3c')][_0x7d8e('0x3f')]?_0x1b396f['attributes']:_0x36d847[_0x7d8e('0x3b')];if(!_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x40')](_0x7d8e('0x41'))){_0x1b396f[_0x7d8e('0x2b')]=qs[_0x7d8e('0x2b')](_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x2b')]);_0x1b396f[_0x7d8e('0x2a')]=qs[_0x7d8e('0x2a')](_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x2a')]);}_0x1b396f[_0x7d8e('0x42')]=qs[_0x7d8e('0x43')](_0x3d265b[_0x7d8e('0x39')]['sort']);_0x1b396f['where']=qs[_0x7d8e('0x3a')](_['pick'](_0x3d265b['query'],_0x36d847[_0x7d8e('0x3a')]),_0x53bf5f);if(_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x44')]){_0x1b396f[_0x7d8e('0x45')]=_['merge'](_0x1b396f[_0x7d8e('0x45')],{'$or':_[_0x7d8e('0x35')](_0x53bf5f,function(_0x206260){if(_0x206260[_0x7d8e('0x46')]!==_0x7d8e('0x47')){var _0x2da4c8={};_0x2da4c8[_0x206260[_0x7d8e('0x33')]]={'$like':'%'+_0x3d265b['query'][_0x7d8e('0x44')]+'%'};return _0x2da4c8;}})});}_0x1b396f=_[_0x7d8e('0x48')]({},_0x1b396f,_0x3d265b[_0x7d8e('0x49')]);var _0x2d9dd3={'where':_0x1b396f[_0x7d8e('0x45')]};return db[_0x7d8e('0x36')][_0x7d8e('0x29')](_0x2d9dd3)[_0x7d8e('0x1b')](function(_0x4f87d7){_0x265851[_0x7d8e('0x29')]=_0x4f87d7;if(_0x3d265b[_0x7d8e('0x39')][_0x7d8e('0x4a')]){_0x1b396f[_0x7d8e('0x4b')]=[{'all':!![]}];}return db[_0x7d8e('0x36')][_0x7d8e('0x4c')](_0x1b396f);})['then'](function(_0x402f16){_0x265851[_0x7d8e('0x4d')]=_0x402f16;return _0x265851;})[_0x7d8e('0x1b')](respondWithFilteredResult(_0x4f0f78,_0x1b396f))['catch'](handleError(_0x4f0f78,null));};exports[_0x7d8e('0x4e')]=function(_0x2136c1,_0x5a1eea){var _0x361642={'raw':![],'where':{'id':_0x2136c1['params']['id']}},_0x360702={};_0x360702['model']=_[_0x7d8e('0x4f')](db['FreshdeskAccount'][_0x7d8e('0x37')]);_0x360702['query']=_[_0x7d8e('0x4f')](_0x2136c1[_0x7d8e('0x39')]);_0x360702[_0x7d8e('0x3a')]=_[_0x7d8e('0x3d')](_0x360702[_0x7d8e('0x3b')],_0x360702[_0x7d8e('0x39')]);_0x361642[_0x7d8e('0x3c')]=_[_0x7d8e('0x3d')](_0x360702['model'],qs[_0x7d8e('0x3e')](_0x2136c1[_0x7d8e('0x39')][_0x7d8e('0x3e')]));_0x361642['attributes']=_0x361642[_0x7d8e('0x3c')][_0x7d8e('0x3f')]?_0x361642[_0x7d8e('0x3c')]:_0x360702[_0x7d8e('0x3b')];if(_0x2136c1['query']['includeAll']){_0x361642[_0x7d8e('0x4b')]=[{'all':!![]}];}_0x361642=_[_0x7d8e('0x48')]({},_0x361642,_0x2136c1[_0x7d8e('0x49')]);return db[_0x7d8e('0x36')][_0x7d8e('0x50')](_0x361642)[_0x7d8e('0x1b')](handleEntityNotFound(_0x5a1eea,null))[_0x7d8e('0x1b')](respondWithResult(_0x5a1eea,null))['catch'](handleError(_0x5a1eea,null));};exports[_0x7d8e('0x51')]=function(_0x435731,_0x581cc8){return db['FreshdeskAccount']['create'](_0x435731['body'],{})[_0x7d8e('0x1b')](respondWithResult(_0x581cc8,0xc9))['catch'](handleError(_0x581cc8,null));};exports[_0x7d8e('0x30')]=function(_0x308389,_0x7f1dde){if(_0x308389['body']['id']){delete _0x308389[_0x7d8e('0x52')]['id'];}return db[_0x7d8e('0x36')]['find']({'where':{'id':_0x308389[_0x7d8e('0x53')]['id']}})[_0x7d8e('0x1b')](handleEntityNotFound(_0x7f1dde,null))[_0x7d8e('0x1b')](saveUpdates(_0x308389[_0x7d8e('0x52')],null))['then'](respondWithResult(_0x7f1dde,null))[_0x7d8e('0x25')](handleError(_0x7f1dde,null));};exports[_0x7d8e('0x54')]=function(_0x2b8f46,_0x2442e1){return db['FreshdeskAccount']['find']({'where':{'id':_0x2b8f46[_0x7d8e('0x53')]['id']}})['then'](handleEntityNotFound(_0x2442e1,null))[_0x7d8e('0x1b')](removeEntity(_0x2442e1,null))[_0x7d8e('0x25')](handleError(_0x2442e1,null));};exports['getConfigurations']=function(_0x3f2672,_0x4a47b9,_0x212e03){var _0x5d271c={};var _0x2c8bf0={};var _0x3063b7;var _0xebca95;return db[_0x7d8e('0x36')]['findOne']({'where':{'id':_0x3f2672['params']['id']}})[_0x7d8e('0x1b')](handleEntityNotFound(_0x4a47b9,null))[_0x7d8e('0x1b')](function(_0xb12a15){if(_0xb12a15){_0x3063b7=_0xb12a15;_0x2c8bf0[_0x7d8e('0x3b')]=_[_0x7d8e('0x4f')](db['FreshdeskConfiguration'][_0x7d8e('0x37')]);_0x2c8bf0[_0x7d8e('0x39')]=_['keys'](_0x3f2672[_0x7d8e('0x39')]);_0x2c8bf0[_0x7d8e('0x3a')]=_[_0x7d8e('0x3d')](_0x2c8bf0['model'],_0x2c8bf0['query']);_0x5d271c['attributes']=_['intersection'](_0x2c8bf0[_0x7d8e('0x3b')],qs[_0x7d8e('0x3e')](_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x3e')]));_0x5d271c[_0x7d8e('0x3c')]=_0x5d271c[_0x7d8e('0x3c')]['length']?_0x5d271c[_0x7d8e('0x3c')]:_0x2c8bf0['model'];_0x5d271c[_0x7d8e('0x42')]=qs[_0x7d8e('0x43')](_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x43')]);_0x5d271c[_0x7d8e('0x45')]=qs['filters'](_['pick'](_0x3f2672[_0x7d8e('0x39')],_0x2c8bf0[_0x7d8e('0x3a')]));if(_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x44')]){_0x5d271c[_0x7d8e('0x45')]=_[_0x7d8e('0x48')](_0x5d271c['where'],{'$or':_['map'](_0x5d271c[_0x7d8e('0x3c')],function(_0x2da8a){var _0x310b4b={};_0x310b4b[_0x2da8a]={'$like':'%'+_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x44')]+'%'};return _0x310b4b;})});}_0x5d271c=_[_0x7d8e('0x48')]({},_0x5d271c,_0x3f2672[_0x7d8e('0x49')]);return _0x3063b7[_0x7d8e('0x55')](_0x5d271c);}})[_0x7d8e('0x1b')](function(_0x5e9540){if(_0x5e9540){_0xebca95=_0x5e9540[_0x7d8e('0x3f')];if(!_0x3f2672['query'][_0x7d8e('0x40')](_0x7d8e('0x41'))){_0x5d271c['limit']=qs[_0x7d8e('0x2b')](_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x2b')]);_0x5d271c['offset']=qs[_0x7d8e('0x2a')](_0x3f2672[_0x7d8e('0x39')][_0x7d8e('0x2a')]);}return _0x3063b7[_0x7d8e('0x55')](_0x5d271c);}})[_0x7d8e('0x1b')](function(_0x26d623){if(_0x26d623){return _0x26d623?{'count':_0xebca95,'rows':_0x26d623}:null;}})[_0x7d8e('0x1b')](respondWithResult(_0x4a47b9,null))['catch'](handleError(_0x4a47b9,null));};exports[_0x7d8e('0x56')]=function(_0x588814,_0x19a5a5,_0x2be0c9){if(_0x588814[_0x7d8e('0x52')]['id']){delete _0x588814['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x588814[_0x7d8e('0x53')]['id']}})[_0x7d8e('0x1b')](handleEntityNotFound(_0x19a5a5,null))['then'](function(_0x19e691){if(_0x19e691){_0x588814['body'][_0x7d8e('0x57')]=_0x19e691['id'];_0x588814[_0x7d8e('0x52')]['Subjects']=integrations[_0x7d8e('0x58')](_0x588814[_0x7d8e('0x52')]['channel'],_0x588814[_0x7d8e('0x52')][_0x7d8e('0x46')]);_0x588814[_0x7d8e('0x52')][_0x7d8e('0x59')]=integrations[_0x7d8e('0x5a')](_0x588814[_0x7d8e('0x52')][_0x7d8e('0x5b')],_0x588814[_0x7d8e('0x52')][_0x7d8e('0x46')]);return db['FreshdeskConfiguration'][_0x7d8e('0x51')](_0x588814[_0x7d8e('0x52')],{'include':[{'model':db['FreshdeskField'],'as':_0x7d8e('0x5c')},{'model':db[_0x7d8e('0x5d')],'as':_0x7d8e('0x59')}]});}return null;})[_0x7d8e('0x1b')](respondWithResult(_0x19a5a5,null))['catch'](handleError(_0x19a5a5,null));};exports[_0x7d8e('0x5e')]=function(_0x2ac778,_0x2a1c53,_0x1a05d7){var _0x375f97='';return db[_0x7d8e('0x36')][_0x7d8e('0x5f')]({'where':{'id':_0x2ac778[_0x7d8e('0x53')]['id']},'attributes':['id',_0x7d8e('0x60'),_0x7d8e('0x61')]})[_0x7d8e('0x1b')](handleEntityNotFound(_0x2a1c53,null))[_0x7d8e('0x1b')](function(_0xe0505f){if(_0xe0505f){_0x375f97=_0xe0505f[_0x7d8e('0x60')];var _0x163f9c=_0x375f97['slice'](-0x1);if(_0x163f9c==='/'){_0x375f97=_0x375f97['substring'](0x0,_0x375f97[_0x7d8e('0x62')](_0x163f9c));}return rp({'method':_0x7d8e('0x63'),'uri':util['format'](_0x7d8e('0x64'),_0x375f97,_0x7d8e('0x65')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x7d8e('0x66')](_0x7d8e('0x67'),_0xe0505f[_0x7d8e('0x61')]))[_0x7d8e('0x68')](_0x7d8e('0x69')))},'json':!![]});}})['then'](function(_0x5ae424){if(_0x5ae424){var _0x2bc36f=[_0x7d8e('0x6a'),_0x7d8e('0x6b'),_0x7d8e('0x6c'),_0x7d8e('0x6d'),_0x7d8e('0x26'),_0x7d8e('0x6e'),_0x7d8e('0x6f'),_0x7d8e('0x70'),_0x7d8e('0x71'),_0x7d8e('0x6f'),_0x7d8e('0x72')];_[_0x7d8e('0x73')](_0x5ae424,function(_0x509762){return _0x2bc36f[_0x7d8e('0x74')](_0x509762[_0x7d8e('0x33')])||!_0x509762[_0x7d8e('0x75')]&&_0x509762[_0x7d8e('0x46')]!==_0x7d8e('0x76')&&_0x509762[_0x7d8e('0x46')]!==_0x7d8e('0x77');});return{'count':_0x5ae424[_0x7d8e('0x3f')],'rows':_[_0x7d8e('0x35')](_0x5ae424,function(_0x438b65){return{'id':_0x438b65[_0x7d8e('0x33')],'name':_0x438b65['label'],'custom':!_0x438b65[_0x7d8e('0x75')],'options':_0x438b65[_0x7d8e('0x78')]?_[_0x7d8e('0x35')](_0x438b65[_0x7d8e('0x78')],function(_0x4db6a0){return{'name':_[_0x7d8e('0x79')](_0x4db6a0),'value':_0x4db6a0};}):[]};})};}})[_0x7d8e('0x1b')](respondWithResult(_0x2a1c53,null))[_0x7d8e('0x25')](function(_0x16d8ae){var _0x3dcaa6=_0x2ac778[_0x7d8e('0x39')][_0x7d8e('0x7a')]?0x1f4:_0x16d8ae[_0x7d8e('0x7b')]||0x1f4;logger[_0x7d8e('0x22')](_0x7d8e('0x7c'),_0x7d8e('0x5e'),_0x3dcaa6,JSON['stringify'](_0x16d8ae));delete _0x16d8ae[_0x7d8e('0x33')];if(_0x3dcaa6===0x191){_0x3dcaa6=0x190;}_0x2a1c53[_0x7d8e('0x26')](_0x3dcaa6)[_0x7d8e('0x34')](_0x2ac778['query'][_0x7d8e('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x16d8ae['statusCode']}:_0x16d8ae);});}; \ No newline at end of file +var _0x1d7e=['send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','params','options','find','create','body','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','subject','agent','description','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name'];(function(_0x4fcfbe,_0x107dc6){var _0x50b203=function(_0x3a9083){while(--_0x3a9083){_0x4fcfbe['push'](_0x4fcfbe['shift']());}};_0x50b203(++_0x107dc6);}(_0x1d7e,0x1ad));var _0xe1d7=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1d7e[_0x2ec461];return _0x28603d;};'use strict';var pdf=require(_0xe1d7('0x0'));var emlformat=require(_0xe1d7('0x1'));var rimraf=require(_0xe1d7('0x2'));var zipdir=require(_0xe1d7('0x3'));var jsonpatch=require(_0xe1d7('0x4'));var rp=require(_0xe1d7('0x5'));var moment=require('moment');var BPromise=require(_0xe1d7('0x6'));var Mustache=require('mustache');var util=require(_0xe1d7('0x7'));var path=require('path');var sox=require(_0xe1d7('0x8'));var csv=require(_0xe1d7('0x9'));var ejs=require(_0xe1d7('0xa'));var fs=require('fs');var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe1d7('0xd'));var toCsv=require(_0xe1d7('0x9'));var querystring=require('querystring');var Papa=require(_0xe1d7('0xe'));var Redis=require(_0xe1d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x10'));var as=require(_0xe1d7('0x11'));var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe1d7('0x13'));var licenseUtil=require(_0xe1d7('0x14'));var db=require(_0xe1d7('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xe1d7('0x16')][_0xe1d7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x38f4b2,_0x2281fe,_0x34c899,_0x1e8b8b){return new BPromise(function(_0x1f9996,_0x536ce9){var _0xc42d76=_0x1e8b8b||client;return _0xc42d76[_0xe1d7('0x18')](_0x38f4b2,_0x34c899)['then'](function(_0x53f97a){logger[_0xe1d7('0x19')]('FreshdeskAccount,\x20%s,\x20%s',_0x2281fe,'request\x20sent');logger[_0xe1d7('0x1a')](_0xe1d7('0x1b'),_0x2281fe,_0xe1d7('0x1c'),JSON[_0xe1d7('0x1d')](_0x53f97a));if(_0x53f97a['error']){if(_0x53f97a[_0xe1d7('0x1e')][_0xe1d7('0x1f')]===0x1f4){logger[_0xe1d7('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x2281fe,_0x53f97a[_0xe1d7('0x1e')]['message']);return _0x536ce9(_0x53f97a[_0xe1d7('0x1e')][_0xe1d7('0x20')]);}logger['error'](_0xe1d7('0x21'),_0x2281fe,_0x53f97a[_0xe1d7('0x1e')][_0xe1d7('0x20')]);return _0x1f9996(_0x53f97a[_0xe1d7('0x1e')][_0xe1d7('0x20')]);}else{logger[_0xe1d7('0x19')](_0xe1d7('0x21'),_0x2281fe,_0xe1d7('0x1c'));_0x1f9996(_0x53f97a['result'][_0xe1d7('0x20')]);}})[_0xe1d7('0x22')](function(_0x2377d1){logger[_0xe1d7('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x2281fe,_0x2377d1);_0x536ce9(_0x2377d1);});});}function respondWithStatusCode(_0x34bed8,_0x474011){_0x474011=_0x474011||0xcc;return function(_0x1b4bea){if(_0x1b4bea){return _0x34bed8[_0xe1d7('0x23')](_0x474011);}return _0x34bed8[_0xe1d7('0x24')](_0x474011)[_0xe1d7('0x25')]();};}function respondWithResult(_0x16c58a,_0x8a16a6){_0x8a16a6=_0x8a16a6||0xc8;return function(_0x20c45f){if(_0x20c45f){return _0x16c58a['status'](_0x8a16a6)[_0xe1d7('0x26')](_0x20c45f);}};}function respondWithFilteredResult(_0x1b7e97,_0x35a4cc){return function(_0x3b6fde){if(_0x3b6fde){var _0x4a1593=_0x3b6fde[_0xe1d7('0x27')],_0x14e418=_0x35a4cc[_0xe1d7('0x28')],_0x41107e=_0x35a4cc[_0xe1d7('0x28')]+_0x35a4cc[_0xe1d7('0x29')],_0x11f698;if(_0x41107e>=_0x4a1593){_0x41107e=_0x4a1593;_0x11f698=0xc8;}else{_0x11f698=0xce;}_0x1b7e97[_0xe1d7('0x24')](_0x11f698);return _0x1b7e97[_0xe1d7('0x2a')](_0xe1d7('0x2b'),_0x14e418+'-'+_0x41107e+'/'+_0x4a1593)[_0xe1d7('0x26')](_0x3b6fde);}return null;};}function patchUpdates(_0x30ec13){return function(_0x1f198a){try{jsonpatch['apply'](_0x1f198a,_0x30ec13,!![]);}catch(_0x1a0861){return BPromise[_0xe1d7('0x2c')](_0x1a0861);}return _0x1f198a[_0xe1d7('0x2d')]();};}function saveUpdates(_0x232a70,_0x10bb04){return function(_0x51fa13){if(_0x51fa13){return _0x51fa13[_0xe1d7('0x2e')](_0x232a70)[_0xe1d7('0x2f')](function(_0x470e60){return _0x470e60;});}return null;};}function removeEntity(_0x4db920,_0x535efb){return function(_0x980d8c){if(_0x980d8c){return _0x980d8c[_0xe1d7('0x30')]()[_0xe1d7('0x2f')](function(){_0x4db920[_0xe1d7('0x24')](0xcc)[_0xe1d7('0x25')]();});}};}function handleEntityNotFound(_0x572409,_0x5274ae){return function(_0x209d5a){if(!_0x209d5a){_0x572409[_0xe1d7('0x23')](0x194);}return _0x209d5a;};}function handleError(_0x3005e0,_0x1c1041){_0x1c1041=_0x1c1041||0x1f4;return function(_0x419e7c){logger[_0xe1d7('0x1e')](_0x419e7c[_0xe1d7('0x31')]);if(_0x419e7c[_0xe1d7('0x32')]){delete _0x419e7c['name'];}_0x3005e0[_0xe1d7('0x24')](_0x1c1041)[_0xe1d7('0x33')](_0x419e7c);};}exports[_0xe1d7('0x34')]=function(_0x4a1448,_0xda77d7){var _0x2f10af={},_0x18f4fa={},_0x251412={'count':0x0,'rows':[]};var _0x39d5e3=_[_0xe1d7('0x35')](db[_0xe1d7('0x36')][_0xe1d7('0x37')],function(_0x7d8f08){return{'name':_0x7d8f08[_0xe1d7('0x38')],'type':_0x7d8f08[_0xe1d7('0x39')][_0xe1d7('0x3a')]};});_0x18f4fa['model']=_[_0xe1d7('0x35')](_0x39d5e3,'name');_0x18f4fa[_0xe1d7('0x3b')]=_[_0xe1d7('0x3c')](_0x4a1448['query']);_0x18f4fa[_0xe1d7('0x3d')]=_[_0xe1d7('0x3e')](_0x18f4fa[_0xe1d7('0x3f')],_0x18f4fa[_0xe1d7('0x3b')]);_0x2f10af[_0xe1d7('0x40')]=_[_0xe1d7('0x3e')](_0x18f4fa[_0xe1d7('0x3f')],qs[_0xe1d7('0x41')](_0x4a1448[_0xe1d7('0x3b')]['fields']));_0x2f10af['attributes']=_0x2f10af[_0xe1d7('0x40')][_0xe1d7('0x42')]?_0x2f10af[_0xe1d7('0x40')]:_0x18f4fa['model'];if(!_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x43')](_0xe1d7('0x44'))){_0x2f10af[_0xe1d7('0x29')]=qs['limit'](_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x29')]);_0x2f10af['offset']=qs[_0xe1d7('0x28')](_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x28')]);}_0x2f10af[_0xe1d7('0x45')]=qs[_0xe1d7('0x46')](_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x46')]);_0x2f10af['where']=qs[_0xe1d7('0x3d')](_[_0xe1d7('0x47')](_0x4a1448['query'],_0x18f4fa['filters']),_0x39d5e3);if(_0x4a1448['query'][_0xe1d7('0x48')]){_0x2f10af['where']=_[_0xe1d7('0x49')](_0x2f10af['where'],{'$or':_['map'](_0x39d5e3,function(_0x2bccd1){if(_0x2bccd1[_0xe1d7('0x39')]!==_0xe1d7('0x4a')){var _0x4df46b={};_0x4df46b[_0x2bccd1[_0xe1d7('0x32')]]={'$like':'%'+_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x48')]+'%'};return _0x4df46b;}})});}_0x2f10af=_[_0xe1d7('0x49')]({},_0x2f10af,_0x4a1448['options']);var _0xbb08a9={'where':_0x2f10af[_0xe1d7('0x4b')]};return db[_0xe1d7('0x36')][_0xe1d7('0x27')](_0xbb08a9)['then'](function(_0x6aeca0){_0x251412[_0xe1d7('0x27')]=_0x6aeca0;if(_0x4a1448[_0xe1d7('0x3b')][_0xe1d7('0x4c')]){_0x2f10af[_0xe1d7('0x4d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xe1d7('0x4e')](_0x2f10af);})['then'](function(_0x2a0e62){_0x251412[_0xe1d7('0x4f')]=_0x2a0e62;return _0x251412;})[_0xe1d7('0x2f')](respondWithFilteredResult(_0xda77d7,_0x2f10af))['catch'](handleError(_0xda77d7,null));};exports['show']=function(_0x1714ea,_0x50cdbd){var _0x22bd42={'raw':![],'where':{'id':_0x1714ea[_0xe1d7('0x50')]['id']}},_0x1a2541={};_0x1a2541[_0xe1d7('0x3f')]=_[_0xe1d7('0x3c')](db[_0xe1d7('0x36')][_0xe1d7('0x37')]);_0x1a2541[_0xe1d7('0x3b')]=_[_0xe1d7('0x3c')](_0x1714ea[_0xe1d7('0x3b')]);_0x1a2541[_0xe1d7('0x3d')]=_[_0xe1d7('0x3e')](_0x1a2541[_0xe1d7('0x3f')],_0x1a2541[_0xe1d7('0x3b')]);_0x22bd42[_0xe1d7('0x40')]=_[_0xe1d7('0x3e')](_0x1a2541[_0xe1d7('0x3f')],qs[_0xe1d7('0x41')](_0x1714ea['query']['fields']));_0x22bd42['attributes']=_0x22bd42[_0xe1d7('0x40')][_0xe1d7('0x42')]?_0x22bd42['attributes']:_0x1a2541[_0xe1d7('0x3f')];if(_0x1714ea['query'][_0xe1d7('0x4c')]){_0x22bd42[_0xe1d7('0x4d')]=[{'all':!![]}];}_0x22bd42=_[_0xe1d7('0x49')]({},_0x22bd42,_0x1714ea[_0xe1d7('0x51')]);return db[_0xe1d7('0x36')][_0xe1d7('0x52')](_0x22bd42)[_0xe1d7('0x2f')](handleEntityNotFound(_0x50cdbd,null))[_0xe1d7('0x2f')](respondWithResult(_0x50cdbd,null))[_0xe1d7('0x22')](handleError(_0x50cdbd,null));};exports[_0xe1d7('0x53')]=function(_0x5bb533,_0x188fff){return db[_0xe1d7('0x36')][_0xe1d7('0x53')](_0x5bb533['body'],{})[_0xe1d7('0x2f')](respondWithResult(_0x188fff,0xc9))['catch'](handleError(_0x188fff,null));};exports['update']=function(_0xc0d060,_0x21528f){if(_0xc0d060[_0xe1d7('0x54')]['id']){delete _0xc0d060[_0xe1d7('0x54')]['id'];}return db[_0xe1d7('0x36')][_0xe1d7('0x52')]({'where':{'id':_0xc0d060[_0xe1d7('0x50')]['id']}})[_0xe1d7('0x2f')](handleEntityNotFound(_0x21528f,null))[_0xe1d7('0x2f')](saveUpdates(_0xc0d060['body'],null))[_0xe1d7('0x2f')](respondWithResult(_0x21528f,null))[_0xe1d7('0x22')](handleError(_0x21528f,null));};exports[_0xe1d7('0x30')]=function(_0x239196,_0x4cd37e){return db[_0xe1d7('0x36')][_0xe1d7('0x52')]({'where':{'id':_0x239196[_0xe1d7('0x50')]['id']}})[_0xe1d7('0x2f')](handleEntityNotFound(_0x4cd37e,null))[_0xe1d7('0x2f')](removeEntity(_0x4cd37e,null))['catch'](handleError(_0x4cd37e,null));};exports[_0xe1d7('0x55')]=function(_0x951535,_0xe77d86,_0x1e0114){var _0x4b8332={};var _0x4a676d={};var _0x353a0d;var _0x2fa996;return db[_0xe1d7('0x36')]['findOne']({'where':{'id':_0x951535['params']['id']}})[_0xe1d7('0x2f')](handleEntityNotFound(_0xe77d86,null))[_0xe1d7('0x2f')](function(_0x38b36a){if(_0x38b36a){_0x353a0d=_0x38b36a;_0x4a676d[_0xe1d7('0x3f')]=_[_0xe1d7('0x3c')](db['FreshdeskConfiguration']['rawAttributes']);_0x4a676d[_0xe1d7('0x3b')]=_[_0xe1d7('0x3c')](_0x951535[_0xe1d7('0x3b')]);_0x4a676d['filters']=_[_0xe1d7('0x3e')](_0x4a676d[_0xe1d7('0x3f')],_0x4a676d[_0xe1d7('0x3b')]);_0x4b8332[_0xe1d7('0x40')]=_[_0xe1d7('0x3e')](_0x4a676d[_0xe1d7('0x3f')],qs[_0xe1d7('0x41')](_0x951535[_0xe1d7('0x3b')]['fields']));_0x4b8332[_0xe1d7('0x40')]=_0x4b8332['attributes'][_0xe1d7('0x42')]?_0x4b8332[_0xe1d7('0x40')]:_0x4a676d[_0xe1d7('0x3f')];_0x4b8332['order']=qs[_0xe1d7('0x46')](_0x951535[_0xe1d7('0x3b')][_0xe1d7('0x46')]);_0x4b8332[_0xe1d7('0x4b')]=qs[_0xe1d7('0x3d')](_[_0xe1d7('0x47')](_0x951535[_0xe1d7('0x3b')],_0x4a676d[_0xe1d7('0x3d')]));if(_0x951535[_0xe1d7('0x3b')][_0xe1d7('0x48')]){_0x4b8332[_0xe1d7('0x4b')]=_[_0xe1d7('0x49')](_0x4b8332[_0xe1d7('0x4b')],{'$or':_[_0xe1d7('0x35')](_0x4b8332[_0xe1d7('0x40')],function(_0x2b5bde){var _0x518479={};_0x518479[_0x2b5bde]={'$like':'%'+_0x951535['query'][_0xe1d7('0x48')]+'%'};return _0x518479;})});}_0x4b8332=_[_0xe1d7('0x49')]({},_0x4b8332,_0x951535['options']);return _0x353a0d[_0xe1d7('0x55')](_0x4b8332);}})[_0xe1d7('0x2f')](function(_0x12cf8f){if(_0x12cf8f){_0x2fa996=_0x12cf8f[_0xe1d7('0x42')];if(!_0x951535[_0xe1d7('0x3b')][_0xe1d7('0x43')](_0xe1d7('0x44'))){_0x4b8332['limit']=qs[_0xe1d7('0x29')](_0x951535['query']['limit']);_0x4b8332[_0xe1d7('0x28')]=qs[_0xe1d7('0x28')](_0x951535[_0xe1d7('0x3b')][_0xe1d7('0x28')]);}return _0x353a0d[_0xe1d7('0x55')](_0x4b8332);}})['then'](function(_0x2a364c){if(_0x2a364c){return _0x2a364c?{'count':_0x2fa996,'rows':_0x2a364c}:null;}})['then'](respondWithResult(_0xe77d86,null))[_0xe1d7('0x22')](handleError(_0xe77d86,null));};exports['addConfiguration']=function(_0x5dcc52,_0x32f53d,_0x38b79f){if(_0x5dcc52[_0xe1d7('0x54')]['id']){delete _0x5dcc52[_0xe1d7('0x54')]['id'];}return db[_0xe1d7('0x36')]['findOne']({'where':{'id':_0x5dcc52[_0xe1d7('0x50')]['id']}})[_0xe1d7('0x2f')](handleEntityNotFound(_0x32f53d,null))[_0xe1d7('0x2f')](function(_0x5bef48){if(_0x5bef48){_0x5dcc52['body']['AccountId']=_0x5bef48['id'];_0x5dcc52['body'][_0xe1d7('0x56')]=integrations[_0xe1d7('0x57')](_0x5dcc52[_0xe1d7('0x54')][_0xe1d7('0x58')],_0x5dcc52['body'][_0xe1d7('0x39')]);_0x5dcc52['body'][_0xe1d7('0x59')]=integrations[_0xe1d7('0x5a')](_0x5dcc52['body'][_0xe1d7('0x58')],_0x5dcc52[_0xe1d7('0x54')][_0xe1d7('0x39')]);return db[_0xe1d7('0x5b')][_0xe1d7('0x53')](_0x5dcc52[_0xe1d7('0x54')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xe1d7('0x59')}]});}return null;})[_0xe1d7('0x2f')](respondWithResult(_0x32f53d,null))['catch'](handleError(_0x32f53d,null));};exports['getFields']=function(_0x4c0b97,_0x3d3f92,_0x252038){var _0x152f43='';return db[_0xe1d7('0x36')]['findOne']({'where':{'id':_0x4c0b97[_0xe1d7('0x50')]['id']},'attributes':['id',_0xe1d7('0x5c'),_0xe1d7('0x5d')]})[_0xe1d7('0x2f')](handleEntityNotFound(_0x3d3f92,null))[_0xe1d7('0x2f')](function(_0x313a7d){if(_0x313a7d){_0x152f43=_0x313a7d[_0xe1d7('0x5c')];var _0x486fbe=_0x152f43[_0xe1d7('0x5e')](-0x1);if(_0x486fbe==='/'){_0x152f43=_0x152f43[_0xe1d7('0x5f')](0x0,_0x152f43[_0xe1d7('0x60')](_0x486fbe));}return rp({'method':_0xe1d7('0x61'),'uri':util[_0xe1d7('0x62')]('%s/%s',_0x152f43,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xe1d7('0x63'),new Buffer(util[_0xe1d7('0x62')](_0xe1d7('0x64'),_0x313a7d[_0xe1d7('0x5d')]))[_0xe1d7('0x65')](_0xe1d7('0x66')))},'json':!![]});}})[_0xe1d7('0x2f')](function(_0x5c7530){if(_0x5c7530){var _0x2016e0=['requester',_0xe1d7('0x67'),_0xe1d7('0x68'),_0xe1d7('0x69'),_0xe1d7('0x24'),'priority',_0xe1d7('0x6a'),'source',_0xe1d7('0x6b'),_0xe1d7('0x6a'),_0xe1d7('0x6c')];_[_0xe1d7('0x6d')](_0x5c7530,function(_0x200082){return _0x2016e0[_0xe1d7('0x6e')](_0x200082[_0xe1d7('0x32')])||!_0x200082[_0xe1d7('0x6f')]&&_0x200082[_0xe1d7('0x39')]!==_0xe1d7('0x70')&&_0x200082['type']!==_0xe1d7('0x71');});return{'count':_0x5c7530[_0xe1d7('0x42')],'rows':_['map'](_0x5c7530,function(_0x48fc29){return{'id':_0x48fc29['name'],'name':_0x48fc29[_0xe1d7('0x72')],'custom':!_0x48fc29[_0xe1d7('0x6f')],'options':_0x48fc29['choices']?_[_0xe1d7('0x35')](_0x48fc29[_0xe1d7('0x73')],function(_0x4855d2){return{'name':_['capitalize'](_0x4855d2),'value':_0x4855d2};}):[]};})};}})['then'](respondWithResult(_0x3d3f92,null))['catch'](function(_0x58acf6){var _0x38308b=_0x4c0b97[_0xe1d7('0x3b')][_0xe1d7('0x74')]?0x1f4:_0x58acf6['statusCode']||0x1f4;logger['error'](_0xe1d7('0x75'),_0xe1d7('0x76'),_0x38308b,JSON['stringify'](_0x58acf6));delete _0x58acf6[_0xe1d7('0x32')];if(_0x38308b===0x191){_0x38308b=0x190;}_0x3d3f92[_0xe1d7('0x24')](_0x38308b)[_0xe1d7('0x33')](_0x4c0b97[_0xe1d7('0x3b')][_0xe1d7('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x58acf6[_0xe1d7('0x77')]}:_0x58acf6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index dc01ed1..384d22b 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 _0x830b=['define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x830b,0xec));var _0xb830=function(_0x5583d8,_0x320062){_0x5583d8=_0x5583d8-0x0;var _0x3360e2=_0x830b[_0x5583d8];return _0x3360e2;};'use strict';var _=require(_0xb830('0x0'));var util=require(_0xb830('0x1'));var logger=require(_0xb830('0x2'))(_0xb830('0x3'));var moment=require(_0xb830('0x4'));var BPromise=require(_0xb830('0x5'));var rp=require(_0xb830('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb830('0x7'));var config=require('../../config/environment');var attributes=require(_0xb830('0x8'));var integrations=require(_0xb830('0x9'));module[_0xb830('0xa')]=function(_0x19826c,_0x2b723e){return _0x19826c[_0xb830('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xb830('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db0=['../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x1c2421,_0x1c152c){var _0x5867b2=function(_0x16e49c){while(--_0x16e49c){_0x1c2421['push'](_0x1c2421['shift']());}};_0x5867b2(++_0x1c152c);}(_0x9db0,0xf4));var _0x09db=function(_0x1b8d33,_0x39d490){_0x1b8d33=_0x1b8d33-0x0;var _0x511281=_0x9db0[_0x1b8d33];return _0x511281;};'use strict';var _=require(_0x09db('0x0'));var util=require('util');var logger=require(_0x09db('0x1'))(_0x09db('0x2'));var moment=require(_0x09db('0x3'));var BPromise=require(_0x09db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09db('0x5'));var rimraf=require('rimraf');var config=require(_0x09db('0x6'));var attributes=require(_0x09db('0x7'));var integrations=require(_0x09db('0x8'));module[_0x09db('0x9')]=function(_0x4007e2,_0x127b3d){return _0x4007e2[_0x09db('0xa')](_0x09db('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 37c4e69..329b1ec 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 _0xfc39=['result','catch','findAll','options','limit','include','map','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x3b33dc,_0x2452e4){var _0x183c3b=function(_0x452a21){while(--_0x452a21){_0x3b33dc['push'](_0x3b33dc['shift']());}};_0x183c3b(++_0x2452e4);}(_0xfc39,0x1f0));var _0x9fc3=function(_0x341409,_0x355b72){_0x341409=_0x341409-0x0;var _0x5a6fc0=_0xfc39[_0x341409];return _0x5a6fc0;};'use strict';var _=require(_0x9fc3('0x0'));var util=require(_0x9fc3('0x1'));var moment=require(_0x9fc3('0x2'));var BPromise=require(_0x9fc3('0x3'));var rs=require(_0x9fc3('0x4'));var fs=require('fs');var Redis=require(_0x9fc3('0x5'));var db=require(_0x9fc3('0x6'))['db'];var utils=require(_0x9fc3('0x7'));var logger=require(_0x9fc3('0x8'))(_0x9fc3('0x9'));var config=require('../../config/environment');var jayson=require(_0x9fc3('0xa'));var client=jayson[_0x9fc3('0xb')][_0x9fc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfcb112,_0xfda28f,_0x5869c7){return new BPromise(function(_0x24d340,_0x50cc54){return client['request'](_0xfcb112,_0x5869c7)[_0x9fc3('0xd')](function(_0xc10f6a){logger['info'](_0x9fc3('0xe'),_0xfda28f,_0x9fc3('0xf'));logger[_0x9fc3('0x10')](_0x9fc3('0x11'),_0xfda28f,_0x9fc3('0xf'),JSON['stringify'](_0xc10f6a));if(_0xc10f6a[_0x9fc3('0x12')]){if(_0xc10f6a['error'][_0x9fc3('0x13')]===0x1f4){logger[_0x9fc3('0x12')](_0x9fc3('0xe'),_0xfda28f,_0xc10f6a['error'][_0x9fc3('0x14')]);return _0x50cc54(_0xc10f6a[_0x9fc3('0x12')][_0x9fc3('0x14')]);}logger[_0x9fc3('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xfda28f,_0xc10f6a['error'][_0x9fc3('0x14')]);return _0x24d340(_0xc10f6a[_0x9fc3('0x12')]['message']);}else{logger[_0x9fc3('0x15')](_0x9fc3('0xe'),_0xfda28f,_0x9fc3('0xf'));_0x24d340(_0xc10f6a[_0x9fc3('0x16')]['message']);}})[_0x9fc3('0x17')](function(_0x357890){logger[_0x9fc3('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xfda28f,_0x357890);_0x50cc54(_0x357890);});});}exports['GetFreshdeskAccount']=function(_0x321d54){var _0x122e6a=this;return new Promise(function(_0x1668c3,_0x162da9){return db['FreshdeskAccount'][_0x9fc3('0x18')]({'raw':_0x321d54[_0x9fc3('0x19')]?_0x321d54[_0x9fc3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x321d54['options']?_0x321d54['options']['where']||null:null,'attributes':_0x321d54[_0x9fc3('0x19')]?_0x321d54[_0x9fc3('0x19')]['attributes']||null:null,'limit':_0x321d54[_0x9fc3('0x19')]?_0x321d54[_0x9fc3('0x19')][_0x9fc3('0x1a')]||null:null,'include':_0x321d54['options']?_0x321d54[_0x9fc3('0x19')][_0x9fc3('0x1b')]?_[_0x9fc3('0x1c')](_0x321d54[_0x9fc3('0x19')][_0x9fc3('0x1b')],function(_0x398cf5){return{'model':db[_0x398cf5['model']],'as':_0x398cf5['as'],'attributes':_0x398cf5[_0x9fc3('0x1d')],'include':_0x398cf5[_0x9fc3('0x1b')]?_['map'](_0x398cf5['include'],function(_0x883bab){return{'model':db[_0x883bab[_0x9fc3('0x1e')]],'as':_0x883bab['as'],'attributes':_0x883bab[_0x9fc3('0x1d')],'include':_0x883bab[_0x9fc3('0x1b')]?_['map'](_0x883bab[_0x9fc3('0x1b')],function(_0x1d2d31){return{'model':db[_0x1d2d31[_0x9fc3('0x1e')]],'as':_0x1d2d31['as'],'attributes':_0x1d2d31[_0x9fc3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9fc3('0xd')](function(_0x4aa729){logger[_0x9fc3('0x15')](_0x9fc3('0x1f'),_0x321d54);logger[_0x9fc3('0x10')](_0x9fc3('0x1f'),_0x321d54,JSON['stringify'](_0x4aa729));_0x1668c3(_0x4aa729);})[_0x9fc3('0x17')](function(_0x50e1a3){logger[_0x9fc3('0x12')](_0x9fc3('0x1f'),_0x50e1a3[_0x9fc3('0x14')],_0x321d54);_0x162da9(_0x122e6a['error'](0x1f4,_0x50e1a3[_0x9fc3('0x14')]));});});};exports[_0x9fc3('0x20')]=function(_0xb2eaff){var _0x522903=this;return new Promise(function(_0x4027ab,_0x3825cb){return db['FreshdeskAccount'][_0x9fc3('0x21')]({'raw':_0xb2eaff['options']?_0xb2eaff['options'][_0x9fc3('0x22')]===undefined?!![]:![]:!![],'where':_0xb2eaff[_0x9fc3('0x19')]?_0xb2eaff[_0x9fc3('0x19')][_0x9fc3('0x23')]||null:null,'attributes':_0xb2eaff[_0x9fc3('0x19')]?_0xb2eaff[_0x9fc3('0x19')][_0x9fc3('0x1d')]||null:null,'include':_0xb2eaff[_0x9fc3('0x19')]?_0xb2eaff['options'][_0x9fc3('0x1b')]?_[_0x9fc3('0x1c')](_0xb2eaff['options']['include'],function(_0x5c4c95){return{'model':db[_0x5c4c95[_0x9fc3('0x1e')]],'as':_0x5c4c95['as'],'attributes':_0x5c4c95[_0x9fc3('0x1d')],'include':_0x5c4c95[_0x9fc3('0x1b')]?_[_0x9fc3('0x1c')](_0x5c4c95[_0x9fc3('0x1b')],function(_0x5c0884){return{'model':db[_0x5c0884[_0x9fc3('0x1e')]],'as':_0x5c0884['as'],'attributes':_0x5c0884['attributes'],'include':_0x5c0884[_0x9fc3('0x1b')]?_[_0x9fc3('0x1c')](_0x5c0884['include'],function(_0x135f7b){return{'model':db[_0x135f7b[_0x9fc3('0x1e')]],'as':_0x135f7b['as'],'attributes':_0x135f7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fc3('0xd')](function(_0x4fe316){logger['info']('ShowFreshdeskAccount',_0xb2eaff);logger[_0x9fc3('0x10')](_0x9fc3('0x20'),_0xb2eaff,JSON[_0x9fc3('0x24')](_0x4fe316));_0x4027ab(_0x4fe316);})[_0x9fc3('0x17')](function(_0x5953f5){logger[_0x9fc3('0x12')](_0x9fc3('0x20'),_0x5953f5['message'],_0xb2eaff);_0x3825cb(_0x522903['error'](0x1f4,_0x5953f5['message']));});});}; \ No newline at end of file +var _0xbd27=['model','debug','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x2d4a07,_0x2e1f4d){var _0x43f637=function(_0x2992cf){while(--_0x2992cf){_0x2d4a07['push'](_0x2d4a07['shift']());}};_0x43f637(++_0x2e1f4d);}(_0xbd27,0x145));var _0x7bd2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd27[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7bd2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bd2('0x1'));var rs=require(_0x7bd2('0x2'));var fs=require('fs');var Redis=require(_0x7bd2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bd2('0x4'));var logger=require(_0x7bd2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7bd2('0x6'));var client=jayson[_0x7bd2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac683,_0x5b88a0,_0x41835f){return new BPromise(function(_0x36b687,_0x3c1221){return client[_0x7bd2('0x8')](_0x4ac683,_0x41835f)[_0x7bd2('0x9')](function(_0x5ad5bb){logger[_0x7bd2('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x5b88a0,_0x7bd2('0xb'));logger['debug'](_0x7bd2('0xc'),_0x5b88a0,_0x7bd2('0xb'),JSON[_0x7bd2('0xd')](_0x5ad5bb));if(_0x5ad5bb[_0x7bd2('0xe')]){if(_0x5ad5bb[_0x7bd2('0xe')]['code']===0x1f4){logger[_0x7bd2('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5b88a0,_0x5ad5bb[_0x7bd2('0xe')]['message']);return _0x3c1221(_0x5ad5bb[_0x7bd2('0xe')][_0x7bd2('0xf')]);}logger[_0x7bd2('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5b88a0,_0x5ad5bb[_0x7bd2('0xe')][_0x7bd2('0xf')]);return _0x36b687(_0x5ad5bb[_0x7bd2('0xe')][_0x7bd2('0xf')]);}else{logger[_0x7bd2('0xa')](_0x7bd2('0x10'),_0x5b88a0,_0x7bd2('0xb'));_0x36b687(_0x5ad5bb['result'][_0x7bd2('0xf')]);}})[_0x7bd2('0x11')](function(_0x287bb9){logger[_0x7bd2('0xe')](_0x7bd2('0x10'),_0x5b88a0,_0x287bb9);_0x3c1221(_0x287bb9);});});}exports[_0x7bd2('0x12')]=function(_0xb75c88){var _0x2363ab=this;return new Promise(function(_0x1e4fea,_0x507338){return db['FreshdeskAccount'][_0x7bd2('0x13')]({'raw':_0xb75c88['options']?_0xb75c88[_0x7bd2('0x14')][_0x7bd2('0x15')]===undefined?!![]:![]:!![],'where':_0xb75c88['options']?_0xb75c88[_0x7bd2('0x14')][_0x7bd2('0x16')]||null:null,'attributes':_0xb75c88[_0x7bd2('0x14')]?_0xb75c88[_0x7bd2('0x14')][_0x7bd2('0x17')]||null:null,'limit':_0xb75c88[_0x7bd2('0x14')]?_0xb75c88[_0x7bd2('0x14')][_0x7bd2('0x18')]||null:null,'include':_0xb75c88['options']?_0xb75c88['options']['include']?_[_0x7bd2('0x19')](_0xb75c88[_0x7bd2('0x14')][_0x7bd2('0x1a')],function(_0x27bc51){return{'model':db[_0x27bc51[_0x7bd2('0x1b')]],'as':_0x27bc51['as'],'attributes':_0x27bc51[_0x7bd2('0x17')],'include':_0x27bc51[_0x7bd2('0x1a')]?_[_0x7bd2('0x19')](_0x27bc51['include'],function(_0x5f0968){return{'model':db[_0x5f0968[_0x7bd2('0x1b')]],'as':_0x5f0968['as'],'attributes':_0x5f0968[_0x7bd2('0x17')],'include':_0x5f0968['include']?_[_0x7bd2('0x19')](_0x5f0968['include'],function(_0x55cfa0){return{'model':db[_0x55cfa0['model']],'as':_0x55cfa0['as'],'attributes':_0x55cfa0[_0x7bd2('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7bd2('0x9')](function(_0x111b7a){logger[_0x7bd2('0xa')]('GetFreshdeskAccount',_0xb75c88);logger[_0x7bd2('0x1c')]('GetFreshdeskAccount',_0xb75c88,JSON[_0x7bd2('0xd')](_0x111b7a));_0x1e4fea(_0x111b7a);})['catch'](function(_0x1c12bc){logger[_0x7bd2('0xe')]('GetFreshdeskAccount',_0x1c12bc[_0x7bd2('0xf')],_0xb75c88);_0x507338(_0x2363ab[_0x7bd2('0xe')](0x1f4,_0x1c12bc[_0x7bd2('0xf')]));});});};exports[_0x7bd2('0x1d')]=function(_0x224e72){var _0x4bc958=this;return new Promise(function(_0x53dcb7,_0x59bdfa){return db[_0x7bd2('0x1e')][_0x7bd2('0x1f')]({'raw':_0x224e72['options']?_0x224e72[_0x7bd2('0x14')][_0x7bd2('0x15')]===undefined?!![]:![]:!![],'where':_0x224e72[_0x7bd2('0x14')]?_0x224e72[_0x7bd2('0x14')]['where']||null:null,'attributes':_0x224e72[_0x7bd2('0x14')]?_0x224e72[_0x7bd2('0x14')]['attributes']||null:null,'include':_0x224e72[_0x7bd2('0x14')]?_0x224e72[_0x7bd2('0x14')]['include']?_['map'](_0x224e72[_0x7bd2('0x14')][_0x7bd2('0x1a')],function(_0x428eb3){return{'model':db[_0x428eb3[_0x7bd2('0x1b')]],'as':_0x428eb3['as'],'attributes':_0x428eb3[_0x7bd2('0x17')],'include':_0x428eb3['include']?_['map'](_0x428eb3[_0x7bd2('0x1a')],function(_0x1f9ccc){return{'model':db[_0x1f9ccc[_0x7bd2('0x1b')]],'as':_0x1f9ccc['as'],'attributes':_0x1f9ccc['attributes'],'include':_0x1f9ccc[_0x7bd2('0x1a')]?_['map'](_0x1f9ccc[_0x7bd2('0x1a')],function(_0x4523e1){return{'model':db[_0x4523e1[_0x7bd2('0x1b')]],'as':_0x4523e1['as'],'attributes':_0x4523e1[_0x7bd2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5740a0){logger[_0x7bd2('0xa')](_0x7bd2('0x1d'),_0x224e72);logger['debug'](_0x7bd2('0x1d'),_0x224e72,JSON['stringify'](_0x5740a0));_0x53dcb7(_0x5740a0);})[_0x7bd2('0x11')](function(_0x313b67){logger['error']('ShowFreshdeskAccount',_0x313b67['message'],_0x224e72);_0x59bdfa(_0x4bc958[_0x7bd2('0xe')](0x1f4,_0x313b67[_0x7bd2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f13f57a..ef645f4 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 _0xd3dd=['isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','/:id'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd3dd,0x153));var _0xdd3d=function(_0x1c7b08,_0x5ad498){_0x1c7b08=_0x1c7b08-0x0;var _0x42c14b=_0xd3dd[_0x1c7b08];return _0x42c14b;};'use strict';var multer=require(_0xdd3d('0x0'));var util=require(_0xdd3d('0x1'));var path=require('path');var timeout=require(_0xdd3d('0x2'));var express=require(_0xdd3d('0x3'));var router=express[_0xdd3d('0x4')]();var auth=require(_0xdd3d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdd3d('0x6'));var controller=require(_0xdd3d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd3d('0x8')]);router[_0xdd3d('0x9')](_0xdd3d('0xa'),auth[_0xdd3d('0xb')](),controller['show']);router[_0xdd3d('0x9')](_0xdd3d('0xc'),auth[_0xdd3d('0xb')](),controller['getFields']);router[_0xdd3d('0x9')](_0xdd3d('0xd'),auth['isAuthenticated'](),controller[_0xdd3d('0xe')]);router[_0xdd3d('0x9')](_0xdd3d('0xf'),auth[_0xdd3d('0xb')](),controller[_0xdd3d('0x10')]);router[_0xdd3d('0x9')]('/:id/tags',auth[_0xdd3d('0xb')](),controller[_0xdd3d('0x11')]);router[_0xdd3d('0x12')]('/',auth[_0xdd3d('0xb')](),controller['create']);router[_0xdd3d('0x12')](_0xdd3d('0x13'),auth[_0xdd3d('0xb')](),controller[_0xdd3d('0x14')]);router[_0xdd3d('0x15')](_0xdd3d('0xa'),auth[_0xdd3d('0xb')](),controller[_0xdd3d('0x16')]);router[_0xdd3d('0x17')](_0xdd3d('0xa'),auth[_0xdd3d('0xb')](),controller['destroy']);module[_0xdd3d('0x18')]=router; \ No newline at end of file +var _0xeac8=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','update','delete','destroy','exports','multer','express','Router','../../components/auth/service'];(function(_0x2136a6,_0x348595){var _0x23a213=function(_0x1ace22){while(--_0x1ace22){_0x2136a6['push'](_0x2136a6['shift']());}};_0x23a213(++_0x348595);}(_0xeac8,0x8c));var _0x8eac=function(_0x266505,_0x48254c){_0x266505=_0x266505-0x0;var _0x473e5f=_0xeac8[_0x266505];return _0x473e5f;};'use strict';var multer=require(_0x8eac('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8eac('0x1'));var router=express[_0x8eac('0x2')]();var auth=require(_0x8eac('0x3'));var interaction=require(_0x8eac('0x4'));var config=require(_0x8eac('0x5'));var controller=require(_0x8eac('0x6'));router[_0x8eac('0x7')]('/',auth[_0x8eac('0x8')](),controller[_0x8eac('0x9')]);router['get'](_0x8eac('0xa'),auth[_0x8eac('0x8')](),controller[_0x8eac('0xb')]);router[_0x8eac('0x7')]('/:id/fields',auth[_0x8eac('0x8')](),controller[_0x8eac('0xc')]);router[_0x8eac('0x7')](_0x8eac('0xd'),auth[_0x8eac('0x8')](),controller[_0x8eac('0xe')]);router[_0x8eac('0x7')](_0x8eac('0xf'),auth[_0x8eac('0x8')](),controller[_0x8eac('0x10')]);router['get'](_0x8eac('0x11'),auth[_0x8eac('0x8')](),controller[_0x8eac('0x12')]);router[_0x8eac('0x13')]('/',auth[_0x8eac('0x8')](),controller['create']);router[_0x8eac('0x13')](_0x8eac('0x11'),auth['isAuthenticated'](),controller['setTags']);router['put'](_0x8eac('0xa'),auth[_0x8eac('0x8')](),controller[_0x8eac('0x14')]);router[_0x8eac('0x15')](_0x8eac('0xa'),auth[_0x8eac('0x8')](),controller[_0x8eac('0x16')]);module[_0x8eac('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 140df0f..a33c768 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 _0xe955=['STRING','exports'];(function(_0x39f64c,_0xd16cc4){var _0x57768f=function(_0x2b9e65){while(--_0x2b9e65){_0x39f64c['push'](_0x39f64c['shift']());}};_0x57768f(++_0xd16cc4);}(_0xe955,0x15f));var _0x5e95=function(_0x279815,_0x4a41fe){_0x279815=_0x279815-0x0;var _0x4a5cf4=_0xe955[_0x279815];return _0x4a5cf4;};'use strict';var Sequelize=require('sequelize');module[_0x5e95('0x0')]={'name':{'type':Sequelize[_0x5e95('0x1')]},'description':{'type':Sequelize[_0x5e95('0x1')]}}; \ No newline at end of file +var _0x878f=['exports','sequelize'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x878f,0x1bb));var _0xf878=function(_0x277ed6,_0x174a63){_0x277ed6=_0x277ed6-0x0;var _0x567aa4=_0x878f[_0x277ed6];return _0x567aa4;};'use strict';var Sequelize=require(_0xf878('0x0'));module[_0xf878('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a9a141e..97f1e4f 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 _0xa530=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','params','includeAll','options','find','catch','create','body','getFields','findOne','FreshdeskField','keys','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','name','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','filters','attributes','intersection'];(function(_0x47695d,_0x4d91ef){var _0x5c4d91=function(_0x1f1d08){while(--_0x1f1d08){_0x47695d['push'](_0x47695d['shift']());}};_0x5c4d91(++_0x4d91ef);}(_0xa530,0x78));var _0x0a53=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0xa530[_0x101134];return _0xc47acc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0a53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a53('0x1'));var jsonpatch=require(_0x0a53('0x2'));var rp=require(_0x0a53('0x3'));var moment=require(_0x0a53('0x4'));var BPromise=require(_0x0a53('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0a53('0x6'));var csv=require(_0x0a53('0x7'));var ejs=require(_0x0a53('0x8'));var fs=require('fs');var _=require(_0x0a53('0x9'));var squel=require(_0x0a53('0xa'));var crypto=require(_0x0a53('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a53('0xc'));var toCsv=require(_0x0a53('0x7'));var querystring=require('querystring');var Papa=require(_0x0a53('0xd'));var Redis=require(_0x0a53('0xe'));var authService=require(_0x0a53('0xf'));var qs=require(_0x0a53('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a53('0x11'));var logger=require(_0x0a53('0x12'))(_0x0a53('0x13'));var utils=require('../../config/utils');var config=require(_0x0a53('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a53('0x15'))['db'];var jayson=require(_0x0a53('0x16'));var client=jayson[_0x0a53('0x17')][_0x0a53('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x57d717,_0x1ce453,_0x3ef9c4,_0x2b091e){return new BPromise(function(_0x59cb23,_0xe489f8){var _0x4ca46f=_0x2b091e||client;return _0x4ca46f[_0x0a53('0x19')](_0x57d717,_0x3ef9c4)['then'](function(_0x2d4fd7){logger[_0x0a53('0x1a')](_0x0a53('0x1b'),_0x1ce453,_0x0a53('0x1c'));logger[_0x0a53('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ce453,_0x0a53('0x1c'),JSON[_0x0a53('0x1e')](_0x2d4fd7));if(_0x2d4fd7[_0x0a53('0x1f')]){if(_0x2d4fd7[_0x0a53('0x1f')]['code']===0x1f4){logger[_0x0a53('0x1f')](_0x0a53('0x1b'),_0x1ce453,_0x2d4fd7['error'][_0x0a53('0x20')]);return _0xe489f8(_0x2d4fd7['error'][_0x0a53('0x20')]);}logger[_0x0a53('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ce453,_0x2d4fd7[_0x0a53('0x1f')][_0x0a53('0x20')]);return _0x59cb23(_0x2d4fd7[_0x0a53('0x1f')]['message']);}else{logger['info'](_0x0a53('0x1b'),_0x1ce453,_0x0a53('0x1c'));_0x59cb23(_0x2d4fd7[_0x0a53('0x21')][_0x0a53('0x20')]);}})['catch'](function(_0x49d47d){logger[_0x0a53('0x1f')](_0x0a53('0x1b'),_0x1ce453,_0x49d47d);_0xe489f8(_0x49d47d);});});}function respondWithStatusCode(_0x5f3609,_0x280dba){_0x280dba=_0x280dba||0xcc;return function(_0x254658){if(_0x254658){return _0x5f3609[_0x0a53('0x22')](_0x280dba);}return _0x5f3609['status'](_0x280dba)[_0x0a53('0x23')]();};}function respondWithResult(_0x4c9a5a,_0x441316){_0x441316=_0x441316||0xc8;return function(_0xc79a89){if(_0xc79a89){return _0x4c9a5a[_0x0a53('0x24')](_0x441316)[_0x0a53('0x25')](_0xc79a89);}};}function respondWithFilteredResult(_0x598486,_0x8de5b){return function(_0x5279f7){if(_0x5279f7){var _0x7defcd=_0x5279f7[_0x0a53('0x26')],_0x35a356=_0x8de5b[_0x0a53('0x27')],_0x1b2b90=_0x8de5b[_0x0a53('0x27')]+_0x8de5b[_0x0a53('0x28')],_0x5dee2c;if(_0x1b2b90>=_0x7defcd){_0x1b2b90=_0x7defcd;_0x5dee2c=0xc8;}else{_0x5dee2c=0xce;}_0x598486[_0x0a53('0x24')](_0x5dee2c);return _0x598486['set'](_0x0a53('0x29'),_0x35a356+'-'+_0x1b2b90+'/'+_0x7defcd)[_0x0a53('0x25')](_0x5279f7);}return null;};}function patchUpdates(_0x503030){return function(_0x18ecef){try{jsonpatch[_0x0a53('0x2a')](_0x18ecef,_0x503030,!![]);}catch(_0x14389a){return BPromise[_0x0a53('0x2b')](_0x14389a);}return _0x18ecef[_0x0a53('0x2c')]();};}function saveUpdates(_0xc5c95e,_0x211001){return function(_0x3442f1){if(_0x3442f1){return _0x3442f1['update'](_0xc5c95e)[_0x0a53('0x2d')](function(_0x35affc){return _0x35affc;});}return null;};}function removeEntity(_0x3c12ae,_0x5dbfa2){return function(_0x1de811){if(_0x1de811){return _0x1de811[_0x0a53('0x2e')]()[_0x0a53('0x2d')](function(){_0x3c12ae[_0x0a53('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af75e,_0x502842){return function(_0x1019a7){if(!_0x1019a7){_0x2af75e[_0x0a53('0x22')](0x194);}return _0x1019a7;};}function handleError(_0x5a8196,_0x35183b){_0x35183b=_0x35183b||0x1f4;return function(_0x515a83){logger[_0x0a53('0x1f')](_0x515a83['stack']);if(_0x515a83[_0x0a53('0x2f')]){delete _0x515a83[_0x0a53('0x2f')];}_0x5a8196['status'](_0x35183b)['send'](_0x515a83);};}exports[_0x0a53('0x30')]=function(_0x35cc04,_0x2a6022){var _0x12a286={},_0x369d48={},_0x18d9c2={'count':0x0,'rows':[]};var _0x28dcc8=_[_0x0a53('0x31')](db[_0x0a53('0x32')][_0x0a53('0x33')],function(_0x10d8f9){return{'name':_0x10d8f9['fieldName'],'type':_0x10d8f9['type'][_0x0a53('0x34')]};});_0x369d48[_0x0a53('0x35')]=_['map'](_0x28dcc8,_0x0a53('0x2f'));_0x369d48[_0x0a53('0x36')]=_['keys'](_0x35cc04[_0x0a53('0x36')]);_0x369d48[_0x0a53('0x37')]=_['intersection'](_0x369d48['model'],_0x369d48[_0x0a53('0x36')]);_0x12a286[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x369d48['model'],qs['fields'](_0x35cc04[_0x0a53('0x36')][_0x0a53('0x3a')]));_0x12a286[_0x0a53('0x38')]=_0x12a286[_0x0a53('0x38')][_0x0a53('0x3b')]?_0x12a286[_0x0a53('0x38')]:_0x369d48['model'];if(!_0x35cc04[_0x0a53('0x36')][_0x0a53('0x3c')](_0x0a53('0x3d'))){_0x12a286['limit']=qs[_0x0a53('0x28')](_0x35cc04[_0x0a53('0x36')][_0x0a53('0x28')]);_0x12a286[_0x0a53('0x27')]=qs[_0x0a53('0x27')](_0x35cc04[_0x0a53('0x36')]['offset']);}_0x12a286[_0x0a53('0x3e')]=qs[_0x0a53('0x3f')](_0x35cc04[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x12a286['where']=qs[_0x0a53('0x37')](_[_0x0a53('0x40')](_0x35cc04[_0x0a53('0x36')],_0x369d48[_0x0a53('0x37')]),_0x28dcc8);if(_0x35cc04['query'][_0x0a53('0x41')]){_0x12a286[_0x0a53('0x42')]=_[_0x0a53('0x43')](_0x12a286['where'],{'$or':_[_0x0a53('0x31')](_0x28dcc8,function(_0x48d76d){if(_0x48d76d['type']!==_0x0a53('0x44')){var _0xbd90ce={};_0xbd90ce[_0x48d76d[_0x0a53('0x2f')]]={'$like':'%'+_0x35cc04[_0x0a53('0x36')][_0x0a53('0x41')]+'%'};return _0xbd90ce;}})});}_0x12a286=_[_0x0a53('0x43')]({},_0x12a286,_0x35cc04['options']);var _0x22e9ae={'where':_0x12a286[_0x0a53('0x42')]};return db[_0x0a53('0x32')][_0x0a53('0x26')](_0x22e9ae)[_0x0a53('0x2d')](function(_0x229c1c){_0x18d9c2['count']=_0x229c1c;if(_0x35cc04['query']['includeAll']){_0x12a286[_0x0a53('0x45')]=[{'all':!![]}];}return db[_0x0a53('0x32')][_0x0a53('0x46')](_0x12a286);})['then'](function(_0x2c4556){_0x18d9c2[_0x0a53('0x47')]=_0x2c4556;return _0x18d9c2;})[_0x0a53('0x2d')](respondWithFilteredResult(_0x2a6022,_0x12a286))['catch'](handleError(_0x2a6022,null));};exports['show']=function(_0x302c08,_0xd9fe3b){var _0x86d9f={'raw':![],'where':{'id':_0x302c08[_0x0a53('0x48')]['id']}},_0x7577cd={};_0x7577cd[_0x0a53('0x35')]=_['keys'](db[_0x0a53('0x32')]['rawAttributes']);_0x7577cd[_0x0a53('0x36')]=_['keys'](_0x302c08[_0x0a53('0x36')]);_0x7577cd['filters']=_['intersection'](_0x7577cd[_0x0a53('0x35')],_0x7577cd[_0x0a53('0x36')]);_0x86d9f[_0x0a53('0x38')]=_['intersection'](_0x7577cd['model'],qs[_0x0a53('0x3a')](_0x302c08[_0x0a53('0x36')][_0x0a53('0x3a')]));_0x86d9f[_0x0a53('0x38')]=_0x86d9f[_0x0a53('0x38')][_0x0a53('0x3b')]?_0x86d9f[_0x0a53('0x38')]:_0x7577cd['model'];if(_0x302c08[_0x0a53('0x36')][_0x0a53('0x49')]){_0x86d9f[_0x0a53('0x45')]=[{'all':!![]}];}_0x86d9f=_['merge']({},_0x86d9f,_0x302c08[_0x0a53('0x4a')]);return db[_0x0a53('0x32')][_0x0a53('0x4b')](_0x86d9f)[_0x0a53('0x2d')](handleEntityNotFound(_0xd9fe3b,null))[_0x0a53('0x2d')](respondWithResult(_0xd9fe3b,null))[_0x0a53('0x4c')](handleError(_0xd9fe3b,null));};exports[_0x0a53('0x4d')]=function(_0x35fb18,_0x238533){return db[_0x0a53('0x32')][_0x0a53('0x4d')](_0x35fb18[_0x0a53('0x4e')],{})[_0x0a53('0x2d')](respondWithResult(_0x238533,0xc9))[_0x0a53('0x4c')](handleError(_0x238533,null));};exports['update']=function(_0xf35e62,_0xafd91a){if(_0xf35e62[_0x0a53('0x4e')]['id']){delete _0xf35e62['body']['id'];}return db[_0x0a53('0x32')][_0x0a53('0x4b')]({'where':{'id':_0xf35e62['params']['id']}})[_0x0a53('0x2d')](handleEntityNotFound(_0xafd91a,null))[_0x0a53('0x2d')](saveUpdates(_0xf35e62['body'],null))[_0x0a53('0x2d')](respondWithResult(_0xafd91a,null))[_0x0a53('0x4c')](handleError(_0xafd91a,null));};exports[_0x0a53('0x2e')]=function(_0x18990b,_0x96e1b6){return db[_0x0a53('0x32')]['find']({'where':{'id':_0x18990b['params']['id']}})['then'](handleEntityNotFound(_0x96e1b6,null))[_0x0a53('0x2d')](removeEntity(_0x96e1b6,null))['catch'](handleError(_0x96e1b6,null));};exports[_0x0a53('0x4f')]=function(_0x7d6b53,_0x6d3afb,_0x1e43f4){var _0x42d417={};var _0x348ffb={};var _0x5176a3;var _0x107d8f;return db[_0x0a53('0x32')][_0x0a53('0x50')]({'where':{'id':_0x7d6b53[_0x0a53('0x48')]['id']}})[_0x0a53('0x2d')](handleEntityNotFound(_0x6d3afb,null))[_0x0a53('0x2d')](function(_0x10bc3d){if(_0x10bc3d){_0x5176a3=_0x10bc3d;_0x348ffb[_0x0a53('0x35')]=_['keys'](db[_0x0a53('0x51')][_0x0a53('0x33')]);_0x348ffb[_0x0a53('0x36')]=_[_0x0a53('0x52')](_0x7d6b53[_0x0a53('0x36')]);_0x348ffb['filters']=_[_0x0a53('0x39')](_0x348ffb[_0x0a53('0x35')],_0x348ffb[_0x0a53('0x36')]);_0x42d417[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x348ffb[_0x0a53('0x35')],qs[_0x0a53('0x3a')](_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x3a')]));_0x42d417[_0x0a53('0x38')]=_0x42d417[_0x0a53('0x38')][_0x0a53('0x3b')]?_0x42d417[_0x0a53('0x38')]:_0x348ffb[_0x0a53('0x35')];_0x42d417[_0x0a53('0x3e')]=qs[_0x0a53('0x3f')](_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x42d417[_0x0a53('0x42')]=qs[_0x0a53('0x37')](_['pick'](_0x7d6b53[_0x0a53('0x36')],_0x348ffb[_0x0a53('0x37')]));if(_0x7d6b53['query'][_0x0a53('0x41')]){_0x42d417[_0x0a53('0x42')]=_[_0x0a53('0x43')](_0x42d417[_0x0a53('0x42')],{'$or':_[_0x0a53('0x31')](_0x42d417[_0x0a53('0x38')],function(_0x726345){var _0x483300={};_0x483300[_0x726345]={'$like':'%'+_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x41')]+'%'};return _0x483300;})});}_0x42d417=_[_0x0a53('0x43')]({},_0x42d417,_0x7d6b53[_0x0a53('0x4a')]);return _0x5176a3[_0x0a53('0x4f')](_0x42d417);}})[_0x0a53('0x2d')](function(_0x32bd73){if(_0x32bd73){_0x107d8f=_0x32bd73[_0x0a53('0x3b')];if(!_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x3c')](_0x0a53('0x3d'))){_0x42d417[_0x0a53('0x28')]=qs[_0x0a53('0x28')](_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x28')]);_0x42d417['offset']=qs[_0x0a53('0x27')](_0x7d6b53[_0x0a53('0x36')][_0x0a53('0x27')]);}return _0x5176a3[_0x0a53('0x4f')](_0x42d417);}})[_0x0a53('0x2d')](function(_0x50f708){if(_0x50f708){return _0x50f708?{'count':_0x107d8f,'rows':_0x50f708}:null;}})[_0x0a53('0x2d')](respondWithResult(_0x6d3afb,null))[_0x0a53('0x4c')](handleError(_0x6d3afb,null));};exports[_0x0a53('0x53')]=function(_0x3009c6,_0x199d39,_0x185b6d){var _0x2e9ace={};var _0x7fc53a={};var _0xf88b0a;var _0xc8d982;return db[_0x0a53('0x32')][_0x0a53('0x50')]({'where':{'id':_0x3009c6['params']['id']}})[_0x0a53('0x2d')](handleEntityNotFound(_0x199d39,null))[_0x0a53('0x2d')](function(_0x569ad2){if(_0x569ad2){_0xf88b0a=_0x569ad2;_0x7fc53a[_0x0a53('0x35')]=_['keys'](db[_0x0a53('0x51')][_0x0a53('0x33')]);_0x7fc53a['query']=_[_0x0a53('0x52')](_0x3009c6[_0x0a53('0x36')]);_0x7fc53a[_0x0a53('0x37')]=_[_0x0a53('0x39')](_0x7fc53a[_0x0a53('0x35')],_0x7fc53a[_0x0a53('0x36')]);_0x2e9ace[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x7fc53a[_0x0a53('0x35')],qs['fields'](_0x3009c6[_0x0a53('0x36')][_0x0a53('0x3a')]));_0x2e9ace[_0x0a53('0x38')]=_0x2e9ace[_0x0a53('0x38')]['length']?_0x2e9ace[_0x0a53('0x38')]:_0x7fc53a[_0x0a53('0x35')];_0x2e9ace[_0x0a53('0x3e')]=qs[_0x0a53('0x3f')](_0x3009c6[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x2e9ace[_0x0a53('0x42')]=qs[_0x0a53('0x37')](_[_0x0a53('0x40')](_0x3009c6[_0x0a53('0x36')],_0x7fc53a[_0x0a53('0x37')]));if(_0x3009c6[_0x0a53('0x36')][_0x0a53('0x41')]){_0x2e9ace[_0x0a53('0x42')]=_[_0x0a53('0x43')](_0x2e9ace[_0x0a53('0x42')],{'$or':_[_0x0a53('0x31')](_0x2e9ace[_0x0a53('0x38')],function(_0xdd465f){var _0x1b2c93={};_0x1b2c93[_0xdd465f]={'$like':'%'+_0x3009c6[_0x0a53('0x36')][_0x0a53('0x41')]+'%'};return _0x1b2c93;})});}_0x2e9ace=_['merge']({},_0x2e9ace,_0x3009c6['options']);return _0xf88b0a[_0x0a53('0x53')](_0x2e9ace);}})[_0x0a53('0x2d')](function(_0x1b9b38){if(_0x1b9b38){_0xc8d982=_0x1b9b38[_0x0a53('0x3b')];if(!_0x3009c6[_0x0a53('0x36')][_0x0a53('0x3c')](_0x0a53('0x3d'))){_0x2e9ace['limit']=qs[_0x0a53('0x28')](_0x3009c6['query']['limit']);_0x2e9ace['offset']=qs['offset'](_0x3009c6[_0x0a53('0x36')][_0x0a53('0x27')]);}return _0xf88b0a[_0x0a53('0x53')](_0x2e9ace);}})[_0x0a53('0x2d')](function(_0x382a87){if(_0x382a87){return _0x382a87?{'count':_0xc8d982,'rows':_0x382a87}:null;}})[_0x0a53('0x2d')](respondWithResult(_0x199d39,null))[_0x0a53('0x4c')](handleError(_0x199d39,null));};exports[_0x0a53('0x54')]=function(_0x2360ae,_0x4d2c19,_0x21a973){var _0x1767c1={};var _0x218d1f={};var _0x952b62;var _0x4b2123;return db[_0x0a53('0x32')][_0x0a53('0x50')]({'where':{'id':_0x2360ae[_0x0a53('0x48')]['id']}})[_0x0a53('0x2d')](handleEntityNotFound(_0x4d2c19,null))[_0x0a53('0x2d')](function(_0x5d4b9a){if(_0x5d4b9a){_0x952b62=_0x5d4b9a;_0x218d1f[_0x0a53('0x35')]=_[_0x0a53('0x52')](db[_0x0a53('0x51')][_0x0a53('0x33')]);_0x218d1f['query']=_['keys'](_0x2360ae['query']);_0x218d1f['filters']=_[_0x0a53('0x39')](_0x218d1f['model'],_0x218d1f[_0x0a53('0x36')]);_0x1767c1[_0x0a53('0x38')]=_[_0x0a53('0x39')](_0x218d1f[_0x0a53('0x35')],qs[_0x0a53('0x3a')](_0x2360ae['query'][_0x0a53('0x3a')]));_0x1767c1[_0x0a53('0x38')]=_0x1767c1['attributes'][_0x0a53('0x3b')]?_0x1767c1[_0x0a53('0x38')]:_0x218d1f['model'];_0x1767c1[_0x0a53('0x3e')]=qs[_0x0a53('0x3f')](_0x2360ae[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x1767c1[_0x0a53('0x42')]=qs[_0x0a53('0x37')](_[_0x0a53('0x40')](_0x2360ae[_0x0a53('0x36')],_0x218d1f[_0x0a53('0x37')]));if(_0x2360ae[_0x0a53('0x36')][_0x0a53('0x41')]){_0x1767c1[_0x0a53('0x42')]=_[_0x0a53('0x43')](_0x1767c1[_0x0a53('0x42')],{'$or':_['map'](_0x1767c1['attributes'],function(_0x59592a){var _0x24ee51={};_0x24ee51[_0x59592a]={'$like':'%'+_0x2360ae[_0x0a53('0x36')][_0x0a53('0x41')]+'%'};return _0x24ee51;})});}_0x1767c1=_[_0x0a53('0x43')]({},_0x1767c1,_0x2360ae[_0x0a53('0x4a')]);return _0x952b62['getDescriptions'](_0x1767c1);}})['then'](function(_0x504341){if(_0x504341){_0x4b2123=_0x504341[_0x0a53('0x3b')];if(!_0x2360ae[_0x0a53('0x36')]['hasOwnProperty'](_0x0a53('0x3d'))){_0x1767c1[_0x0a53('0x28')]=qs[_0x0a53('0x28')](_0x2360ae[_0x0a53('0x36')]['limit']);_0x1767c1[_0x0a53('0x27')]=qs[_0x0a53('0x27')](_0x2360ae['query']['offset']);}return _0x952b62[_0x0a53('0x54')](_0x1767c1);}})[_0x0a53('0x2d')](function(_0x2b99c2){if(_0x2b99c2){return _0x2b99c2?{'count':_0x4b2123,'rows':_0x2b99c2}:null;}})[_0x0a53('0x2d')](respondWithResult(_0x4d2c19,null))[_0x0a53('0x4c')](handleError(_0x4d2c19,null));};exports[_0x0a53('0x55')]=function(_0x212f6f,_0x40a27b,_0x58d848){var _0x3e85d7={};var _0x30bb6c={};var _0x16df49;var _0x4c12ac;return db[_0x0a53('0x32')][_0x0a53('0x50')]({'where':{'id':_0x212f6f[_0x0a53('0x48')]['id']}})['then'](handleEntityNotFound(_0x40a27b,null))[_0x0a53('0x2d')](function(_0x7245b1){if(_0x7245b1){_0x16df49=_0x7245b1;_0x30bb6c['model']=_[_0x0a53('0x52')](db[_0x0a53('0x56')][_0x0a53('0x33')]);_0x30bb6c[_0x0a53('0x36')]=_[_0x0a53('0x52')](_0x212f6f[_0x0a53('0x36')]);_0x30bb6c[_0x0a53('0x37')]=_[_0x0a53('0x39')](_0x30bb6c['model'],_0x30bb6c[_0x0a53('0x36')]);_0x3e85d7[_0x0a53('0x38')]=_['intersection'](_0x30bb6c[_0x0a53('0x35')],qs[_0x0a53('0x3a')](_0x212f6f[_0x0a53('0x36')][_0x0a53('0x3a')]));_0x3e85d7['attributes']=_0x3e85d7[_0x0a53('0x38')][_0x0a53('0x3b')]?_0x3e85d7[_0x0a53('0x38')]:_0x30bb6c[_0x0a53('0x35')];_0x3e85d7['order']=qs[_0x0a53('0x3f')](_0x212f6f[_0x0a53('0x36')][_0x0a53('0x3f')]);_0x3e85d7['where']=qs[_0x0a53('0x37')](_[_0x0a53('0x40')](_0x212f6f[_0x0a53('0x36')],_0x30bb6c[_0x0a53('0x37')]));if(_0x212f6f[_0x0a53('0x36')][_0x0a53('0x41')]){_0x3e85d7['where']=_[_0x0a53('0x43')](_0x3e85d7[_0x0a53('0x42')],{'$or':_[_0x0a53('0x31')](_0x3e85d7['attributes'],function(_0x3494a0){var _0x1458ce={};_0x1458ce[_0x3494a0]={'$like':'%'+_0x212f6f['query'][_0x0a53('0x41')]+'%'};return _0x1458ce;})});}_0x3e85d7=_[_0x0a53('0x43')]({},_0x3e85d7,_0x212f6f[_0x0a53('0x4a')]);return _0x16df49[_0x0a53('0x55')](_0x3e85d7);}})[_0x0a53('0x2d')](function(_0x23c593){if(_0x23c593){_0x4c12ac=_0x23c593[_0x0a53('0x3b')];if(!_0x212f6f[_0x0a53('0x36')][_0x0a53('0x3c')](_0x0a53('0x3d'))){_0x3e85d7[_0x0a53('0x28')]=qs[_0x0a53('0x28')](_0x212f6f[_0x0a53('0x36')][_0x0a53('0x28')]);_0x3e85d7[_0x0a53('0x27')]=qs[_0x0a53('0x27')](_0x212f6f[_0x0a53('0x36')][_0x0a53('0x27')]);}return _0x16df49[_0x0a53('0x55')](_0x3e85d7);}})[_0x0a53('0x2d')](function(_0x1b8bc2){if(_0x1b8bc2){return _0x1b8bc2?{'count':_0x4c12ac,'rows':_0x1b8bc2}:null;}})[_0x0a53('0x2d')](respondWithResult(_0x40a27b,null))['catch'](handleError(_0x40a27b,null));};exports['setTags']=function(_0x3e15e2,_0x34a222,_0x1a6e09){if(_0x3e15e2[_0x0a53('0x4e')]['id']){delete _0x3e15e2[_0x0a53('0x4e')]['id'];}return db[_0x0a53('0x32')][_0x0a53('0x50')]({'where':{'id':_0x3e15e2[_0x0a53('0x48')]['id']}})[_0x0a53('0x2d')](handleEntityNotFound(_0x34a222,null))[_0x0a53('0x2d')](function(_0x41fa76){if(_0x41fa76){return _0x41fa76[_0x0a53('0x57')](_0x3e15e2[_0x0a53('0x4e')][_0x0a53('0x58')]||[]);}return null;})[_0x0a53('0x2d')](respondWithResult(_0x34a222,null))[_0x0a53('0x4c')](handleError(_0x34a222,null));}; \ No newline at end of file +var _0x0b44=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','client','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','FreshdeskField','order','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x0b44,0x10c));var _0x40b4=function(_0x1eea9b,_0x4af2aa){_0x1eea9b=_0x1eea9b-0x0;var _0x33e46f=_0x0b44[_0x1eea9b];return _0x33e46f;};'use strict';var pdf=require(_0x40b4('0x0'));var emlformat=require(_0x40b4('0x1'));var rimraf=require(_0x40b4('0x2'));var zipdir=require(_0x40b4('0x3'));var jsonpatch=require(_0x40b4('0x4'));var rp=require('request-promise');var moment=require(_0x40b4('0x5'));var BPromise=require(_0x40b4('0x6'));var Mustache=require(_0x40b4('0x7'));var util=require(_0x40b4('0x8'));var path=require(_0x40b4('0x9'));var sox=require(_0x40b4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x40b4('0xb'));var jsforce=require(_0x40b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x40b4('0xd'));var querystring=require('querystring');var Papa=require(_0x40b4('0xe'));var Redis=require(_0x40b4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x40b4('0x10'));var hardwareService=require(_0x40b4('0x11'));var logger=require(_0x40b4('0x12'))(_0x40b4('0x13'));var utils=require(_0x40b4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x40b4('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x40b4('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x92edbb,_0x3a1e54,_0x426bf5,_0x3bed8e){return new BPromise(function(_0x325a15,_0x36f84c){var _0xdf1d2d=_0x3bed8e||client;return _0xdf1d2d['request'](_0x92edbb,_0x426bf5)['then'](function(_0x14d34e){logger[_0x40b4('0x17')](_0x40b4('0x18'),_0x3a1e54,'request\x20sent');logger[_0x40b4('0x19')](_0x40b4('0x1a'),_0x3a1e54,'request\x20sent',JSON[_0x40b4('0x1b')](_0x14d34e));if(_0x14d34e['error']){if(_0x14d34e[_0x40b4('0x1c')][_0x40b4('0x1d')]===0x1f4){logger['error'](_0x40b4('0x18'),_0x3a1e54,_0x14d34e[_0x40b4('0x1c')][_0x40b4('0x1e')]);return _0x36f84c(_0x14d34e[_0x40b4('0x1c')][_0x40b4('0x1e')]);}logger[_0x40b4('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1e54,_0x14d34e[_0x40b4('0x1c')][_0x40b4('0x1e')]);return _0x325a15(_0x14d34e[_0x40b4('0x1c')]['message']);}else{logger[_0x40b4('0x17')](_0x40b4('0x18'),_0x3a1e54,_0x40b4('0x1f'));_0x325a15(_0x14d34e['result']['message']);}})[_0x40b4('0x20')](function(_0x1386c4){logger[_0x40b4('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1e54,_0x1386c4);_0x36f84c(_0x1386c4);});});}function respondWithStatusCode(_0x2ac4f7,_0x1ab35c){_0x1ab35c=_0x1ab35c||0xcc;return function(_0x598281){if(_0x598281){return _0x2ac4f7['sendStatus'](_0x1ab35c);}return _0x2ac4f7[_0x40b4('0x21')](_0x1ab35c)[_0x40b4('0x22')]();};}function respondWithResult(_0x2fbd0c,_0x424853){_0x424853=_0x424853||0xc8;return function(_0x471414){if(_0x471414){return _0x2fbd0c['status'](_0x424853)[_0x40b4('0x23')](_0x471414);}};}function respondWithFilteredResult(_0x2e7cb7,_0x46832a){return function(_0x14fcf9){if(_0x14fcf9){var _0x7532bb=_0x14fcf9[_0x40b4('0x24')],_0x4150f0=_0x46832a[_0x40b4('0x25')],_0x185a13=_0x46832a[_0x40b4('0x25')]+_0x46832a[_0x40b4('0x26')],_0x373a8e;if(_0x185a13>=_0x7532bb){_0x185a13=_0x7532bb;_0x373a8e=0xc8;}else{_0x373a8e=0xce;}_0x2e7cb7[_0x40b4('0x21')](_0x373a8e);return _0x2e7cb7[_0x40b4('0x27')]('Content-Range',_0x4150f0+'-'+_0x185a13+'/'+_0x7532bb)[_0x40b4('0x23')](_0x14fcf9);}return null;};}function patchUpdates(_0x8bc41e){return function(_0x4a9f79){try{jsonpatch[_0x40b4('0x28')](_0x4a9f79,_0x8bc41e,!![]);}catch(_0x21babb){return BPromise[_0x40b4('0x29')](_0x21babb);}return _0x4a9f79[_0x40b4('0x2a')]();};}function saveUpdates(_0x5d6ad4,_0x1bd565){return function(_0x844121){if(_0x844121){return _0x844121[_0x40b4('0x2b')](_0x5d6ad4)[_0x40b4('0x2c')](function(_0x7a68d3){return _0x7a68d3;});}return null;};}function removeEntity(_0x6f2dc2,_0x218f4e){return function(_0x23c3e3){if(_0x23c3e3){return _0x23c3e3[_0x40b4('0x2d')]()['then'](function(){_0x6f2dc2[_0x40b4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31f5a4,_0x2f72b7){return function(_0x502491){if(!_0x502491){_0x31f5a4['sendStatus'](0x194);}return _0x502491;};}function handleError(_0x14ce80,_0xf61b8c){_0xf61b8c=_0xf61b8c||0x1f4;return function(_0x5e37ba){logger[_0x40b4('0x1c')](_0x5e37ba[_0x40b4('0x2e')]);if(_0x5e37ba[_0x40b4('0x2f')]){delete _0x5e37ba[_0x40b4('0x2f')];}_0x14ce80[_0x40b4('0x21')](_0xf61b8c)[_0x40b4('0x30')](_0x5e37ba);};}exports[_0x40b4('0x31')]=function(_0x37d971,_0x4e7ac6){var _0x27165f={},_0x335c40={},_0x139705={'count':0x0,'rows':[]};var _0x3fad12=_[_0x40b4('0x32')](db[_0x40b4('0x33')][_0x40b4('0x34')],function(_0x5144e4){return{'name':_0x5144e4[_0x40b4('0x35')],'type':_0x5144e4[_0x40b4('0x36')][_0x40b4('0x37')]};});_0x335c40[_0x40b4('0x38')]=_['map'](_0x3fad12,_0x40b4('0x2f'));_0x335c40['query']=_[_0x40b4('0x39')](_0x37d971[_0x40b4('0x3a')]);_0x335c40[_0x40b4('0x3b')]=_[_0x40b4('0x3c')](_0x335c40[_0x40b4('0x38')],_0x335c40['query']);_0x27165f['attributes']=_[_0x40b4('0x3c')](_0x335c40[_0x40b4('0x38')],qs[_0x40b4('0x3d')](_0x37d971[_0x40b4('0x3a')][_0x40b4('0x3d')]));_0x27165f[_0x40b4('0x3e')]=_0x27165f[_0x40b4('0x3e')][_0x40b4('0x3f')]?_0x27165f['attributes']:_0x335c40[_0x40b4('0x38')];if(!_0x37d971[_0x40b4('0x3a')]['hasOwnProperty'](_0x40b4('0x40'))){_0x27165f[_0x40b4('0x26')]=qs[_0x40b4('0x26')](_0x37d971[_0x40b4('0x3a')][_0x40b4('0x26')]);_0x27165f['offset']=qs[_0x40b4('0x25')](_0x37d971[_0x40b4('0x3a')][_0x40b4('0x25')]);}_0x27165f['order']=qs[_0x40b4('0x41')](_0x37d971[_0x40b4('0x3a')][_0x40b4('0x41')]);_0x27165f[_0x40b4('0x42')]=qs[_0x40b4('0x3b')](_['pick'](_0x37d971[_0x40b4('0x3a')],_0x335c40[_0x40b4('0x3b')]),_0x3fad12);if(_0x37d971['query'][_0x40b4('0x43')]){_0x27165f[_0x40b4('0x42')]=_[_0x40b4('0x44')](_0x27165f['where'],{'$or':_[_0x40b4('0x32')](_0x3fad12,function(_0x5a2f26){if(_0x5a2f26['type']!=='VIRTUAL'){var _0x638dc3={};_0x638dc3[_0x5a2f26['name']]={'$like':'%'+_0x37d971[_0x40b4('0x3a')][_0x40b4('0x43')]+'%'};return _0x638dc3;}})});}_0x27165f=_['merge']({},_0x27165f,_0x37d971[_0x40b4('0x45')]);var _0x2a6e6d={'where':_0x27165f[_0x40b4('0x42')]};return db['FreshdeskConfiguration'][_0x40b4('0x24')](_0x2a6e6d)[_0x40b4('0x2c')](function(_0x418a10){_0x139705[_0x40b4('0x24')]=_0x418a10;if(_0x37d971[_0x40b4('0x3a')][_0x40b4('0x46')]){_0x27165f[_0x40b4('0x47')]=[{'all':!![]}];}return db[_0x40b4('0x33')]['findAll'](_0x27165f);})[_0x40b4('0x2c')](function(_0x5a2532){_0x139705[_0x40b4('0x48')]=_0x5a2532;return _0x139705;})[_0x40b4('0x2c')](respondWithFilteredResult(_0x4e7ac6,_0x27165f))['catch'](handleError(_0x4e7ac6,null));};exports[_0x40b4('0x49')]=function(_0x4337f2,_0x5e5097){var _0xa43496={'raw':![],'where':{'id':_0x4337f2[_0x40b4('0x4a')]['id']}},_0x595e55={};_0x595e55['model']=_['keys'](db[_0x40b4('0x33')]['rawAttributes']);_0x595e55['query']=_[_0x40b4('0x39')](_0x4337f2[_0x40b4('0x3a')]);_0x595e55['filters']=_[_0x40b4('0x3c')](_0x595e55[_0x40b4('0x38')],_0x595e55[_0x40b4('0x3a')]);_0xa43496['attributes']=_['intersection'](_0x595e55[_0x40b4('0x38')],qs[_0x40b4('0x3d')](_0x4337f2[_0x40b4('0x3a')]['fields']));_0xa43496[_0x40b4('0x3e')]=_0xa43496[_0x40b4('0x3e')]['length']?_0xa43496[_0x40b4('0x3e')]:_0x595e55[_0x40b4('0x38')];if(_0x4337f2[_0x40b4('0x3a')][_0x40b4('0x46')]){_0xa43496[_0x40b4('0x47')]=[{'all':!![]}];}_0xa43496=_['merge']({},_0xa43496,_0x4337f2[_0x40b4('0x45')]);return db[_0x40b4('0x33')][_0x40b4('0x4b')](_0xa43496)[_0x40b4('0x2c')](handleEntityNotFound(_0x5e5097,null))[_0x40b4('0x2c')](respondWithResult(_0x5e5097,null))[_0x40b4('0x20')](handleError(_0x5e5097,null));};exports[_0x40b4('0x4c')]=function(_0x4e5417,_0x408ab2){return db[_0x40b4('0x33')][_0x40b4('0x4c')](_0x4e5417[_0x40b4('0x4d')],{})[_0x40b4('0x2c')](respondWithResult(_0x408ab2,0xc9))[_0x40b4('0x20')](handleError(_0x408ab2,null));};exports['update']=function(_0x1d225a,_0xe1196b){if(_0x1d225a['body']['id']){delete _0x1d225a[_0x40b4('0x4d')]['id'];}return db[_0x40b4('0x33')][_0x40b4('0x4b')]({'where':{'id':_0x1d225a[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0xe1196b,null))[_0x40b4('0x2c')](saveUpdates(_0x1d225a[_0x40b4('0x4d')],null))[_0x40b4('0x2c')](respondWithResult(_0xe1196b,null))['catch'](handleError(_0xe1196b,null));};exports['destroy']=function(_0x2fa9e7,_0x146850){return db['FreshdeskConfiguration'][_0x40b4('0x4b')]({'where':{'id':_0x2fa9e7[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0x146850,null))[_0x40b4('0x2c')](removeEntity(_0x146850,null))['catch'](handleError(_0x146850,null));};exports[_0x40b4('0x4e')]=function(_0xcaf8b2,_0x4bc5d7,_0x3e2aea){var _0x26fead={};var _0x3172bb={};var _0x119457;var _0x4d551d;return db[_0x40b4('0x33')][_0x40b4('0x4f')]({'where':{'id':_0xcaf8b2[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0x4bc5d7,null))[_0x40b4('0x2c')](function(_0x2620c0){if(_0x2620c0){_0x119457=_0x2620c0;_0x3172bb['model']=_[_0x40b4('0x39')](db[_0x40b4('0x50')]['rawAttributes']);_0x3172bb[_0x40b4('0x3a')]=_[_0x40b4('0x39')](_0xcaf8b2[_0x40b4('0x3a')]);_0x3172bb['filters']=_[_0x40b4('0x3c')](_0x3172bb[_0x40b4('0x38')],_0x3172bb['query']);_0x26fead[_0x40b4('0x3e')]=_['intersection'](_0x3172bb[_0x40b4('0x38')],qs['fields'](_0xcaf8b2[_0x40b4('0x3a')]['fields']));_0x26fead['attributes']=_0x26fead[_0x40b4('0x3e')][_0x40b4('0x3f')]?_0x26fead[_0x40b4('0x3e')]:_0x3172bb[_0x40b4('0x38')];_0x26fead[_0x40b4('0x51')]=qs['sort'](_0xcaf8b2['query'][_0x40b4('0x41')]);_0x26fead[_0x40b4('0x42')]=qs[_0x40b4('0x3b')](_[_0x40b4('0x52')](_0xcaf8b2[_0x40b4('0x3a')],_0x3172bb[_0x40b4('0x3b')]));if(_0xcaf8b2[_0x40b4('0x3a')]['filter']){_0x26fead[_0x40b4('0x42')]=_[_0x40b4('0x44')](_0x26fead[_0x40b4('0x42')],{'$or':_[_0x40b4('0x32')](_0x26fead['attributes'],function(_0x258255){var _0xfa757e={};_0xfa757e[_0x258255]={'$like':'%'+_0xcaf8b2['query'][_0x40b4('0x43')]+'%'};return _0xfa757e;})});}_0x26fead=_[_0x40b4('0x44')]({},_0x26fead,_0xcaf8b2[_0x40b4('0x45')]);return _0x119457[_0x40b4('0x4e')](_0x26fead);}})[_0x40b4('0x2c')](function(_0x4b07ea){if(_0x4b07ea){_0x4d551d=_0x4b07ea[_0x40b4('0x3f')];if(!_0xcaf8b2[_0x40b4('0x3a')]['hasOwnProperty'](_0x40b4('0x40'))){_0x26fead[_0x40b4('0x26')]=qs['limit'](_0xcaf8b2['query'][_0x40b4('0x26')]);_0x26fead[_0x40b4('0x25')]=qs[_0x40b4('0x25')](_0xcaf8b2[_0x40b4('0x3a')][_0x40b4('0x25')]);}return _0x119457[_0x40b4('0x4e')](_0x26fead);}})[_0x40b4('0x2c')](function(_0x21a648){if(_0x21a648){return _0x21a648?{'count':_0x4d551d,'rows':_0x21a648}:null;}})[_0x40b4('0x2c')](respondWithResult(_0x4bc5d7,null))[_0x40b4('0x20')](handleError(_0x4bc5d7,null));};exports[_0x40b4('0x53')]=function(_0x1ba4f0,_0x128797,_0x3c54a3){var _0x20baa7={};var _0x5c6de0={};var _0x168083;var _0x7f7807;return db[_0x40b4('0x33')][_0x40b4('0x4f')]({'where':{'id':_0x1ba4f0[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0x128797,null))[_0x40b4('0x2c')](function(_0x785419){if(_0x785419){_0x168083=_0x785419;_0x5c6de0[_0x40b4('0x38')]=_[_0x40b4('0x39')](db[_0x40b4('0x50')][_0x40b4('0x34')]);_0x5c6de0[_0x40b4('0x3a')]=_[_0x40b4('0x39')](_0x1ba4f0[_0x40b4('0x3a')]);_0x5c6de0[_0x40b4('0x3b')]=_[_0x40b4('0x3c')](_0x5c6de0[_0x40b4('0x38')],_0x5c6de0['query']);_0x20baa7['attributes']=_[_0x40b4('0x3c')](_0x5c6de0[_0x40b4('0x38')],qs[_0x40b4('0x3d')](_0x1ba4f0[_0x40b4('0x3a')][_0x40b4('0x3d')]));_0x20baa7['attributes']=_0x20baa7[_0x40b4('0x3e')][_0x40b4('0x3f')]?_0x20baa7[_0x40b4('0x3e')]:_0x5c6de0[_0x40b4('0x38')];_0x20baa7['order']=qs[_0x40b4('0x41')](_0x1ba4f0['query'][_0x40b4('0x41')]);_0x20baa7[_0x40b4('0x42')]=qs[_0x40b4('0x3b')](_[_0x40b4('0x52')](_0x1ba4f0[_0x40b4('0x3a')],_0x5c6de0['filters']));if(_0x1ba4f0['query'][_0x40b4('0x43')]){_0x20baa7['where']=_[_0x40b4('0x44')](_0x20baa7[_0x40b4('0x42')],{'$or':_['map'](_0x20baa7[_0x40b4('0x3e')],function(_0x47cbc2){var _0x2a24bb={};_0x2a24bb[_0x47cbc2]={'$like':'%'+_0x1ba4f0[_0x40b4('0x3a')][_0x40b4('0x43')]+'%'};return _0x2a24bb;})});}_0x20baa7=_[_0x40b4('0x44')]({},_0x20baa7,_0x1ba4f0[_0x40b4('0x45')]);return _0x168083[_0x40b4('0x53')](_0x20baa7);}})[_0x40b4('0x2c')](function(_0x4d61a0){if(_0x4d61a0){_0x7f7807=_0x4d61a0[_0x40b4('0x3f')];if(!_0x1ba4f0['query'][_0x40b4('0x54')](_0x40b4('0x40'))){_0x20baa7[_0x40b4('0x26')]=qs[_0x40b4('0x26')](_0x1ba4f0[_0x40b4('0x3a')][_0x40b4('0x26')]);_0x20baa7[_0x40b4('0x25')]=qs[_0x40b4('0x25')](_0x1ba4f0[_0x40b4('0x3a')]['offset']);}return _0x168083[_0x40b4('0x53')](_0x20baa7);}})[_0x40b4('0x2c')](function(_0x2fb2a4){if(_0x2fb2a4){return _0x2fb2a4?{'count':_0x7f7807,'rows':_0x2fb2a4}:null;}})['then'](respondWithResult(_0x128797,null))[_0x40b4('0x20')](handleError(_0x128797,null));};exports[_0x40b4('0x55')]=function(_0x2a5f1e,_0x2e4ed1,_0x1b3de9){var _0x12cfa3={};var _0x5b88c0={};var _0x56c792;var _0x15a7af;return db[_0x40b4('0x33')][_0x40b4('0x4f')]({'where':{'id':_0x2a5f1e[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0x2e4ed1,null))[_0x40b4('0x2c')](function(_0x51e388){if(_0x51e388){_0x56c792=_0x51e388;_0x5b88c0[_0x40b4('0x38')]=_[_0x40b4('0x39')](db[_0x40b4('0x50')]['rawAttributes']);_0x5b88c0[_0x40b4('0x3a')]=_[_0x40b4('0x39')](_0x2a5f1e[_0x40b4('0x3a')]);_0x5b88c0['filters']=_[_0x40b4('0x3c')](_0x5b88c0['model'],_0x5b88c0[_0x40b4('0x3a')]);_0x12cfa3['attributes']=_[_0x40b4('0x3c')](_0x5b88c0[_0x40b4('0x38')],qs['fields'](_0x2a5f1e[_0x40b4('0x3a')][_0x40b4('0x3d')]));_0x12cfa3[_0x40b4('0x3e')]=_0x12cfa3[_0x40b4('0x3e')][_0x40b4('0x3f')]?_0x12cfa3['attributes']:_0x5b88c0[_0x40b4('0x38')];_0x12cfa3[_0x40b4('0x51')]=qs['sort'](_0x2a5f1e[_0x40b4('0x3a')]['sort']);_0x12cfa3['where']=qs[_0x40b4('0x3b')](_[_0x40b4('0x52')](_0x2a5f1e[_0x40b4('0x3a')],_0x5b88c0[_0x40b4('0x3b')]));if(_0x2a5f1e[_0x40b4('0x3a')][_0x40b4('0x43')]){_0x12cfa3[_0x40b4('0x42')]=_[_0x40b4('0x44')](_0x12cfa3[_0x40b4('0x42')],{'$or':_['map'](_0x12cfa3['attributes'],function(_0x540e1c){var _0x3e1104={};_0x3e1104[_0x540e1c]={'$like':'%'+_0x2a5f1e[_0x40b4('0x3a')]['filter']+'%'};return _0x3e1104;})});}_0x12cfa3=_[_0x40b4('0x44')]({},_0x12cfa3,_0x2a5f1e[_0x40b4('0x45')]);return _0x56c792['getDescriptions'](_0x12cfa3);}})[_0x40b4('0x2c')](function(_0xdf2cbb){if(_0xdf2cbb){_0x15a7af=_0xdf2cbb['length'];if(!_0x2a5f1e[_0x40b4('0x3a')][_0x40b4('0x54')](_0x40b4('0x40'))){_0x12cfa3[_0x40b4('0x26')]=qs[_0x40b4('0x26')](_0x2a5f1e[_0x40b4('0x3a')][_0x40b4('0x26')]);_0x12cfa3['offset']=qs[_0x40b4('0x25')](_0x2a5f1e[_0x40b4('0x3a')][_0x40b4('0x25')]);}return _0x56c792[_0x40b4('0x55')](_0x12cfa3);}})[_0x40b4('0x2c')](function(_0x1e7846){if(_0x1e7846){return _0x1e7846?{'count':_0x15a7af,'rows':_0x1e7846}:null;}})[_0x40b4('0x2c')](respondWithResult(_0x2e4ed1,null))[_0x40b4('0x20')](handleError(_0x2e4ed1,null));};exports[_0x40b4('0x56')]=function(_0x4ed13f,_0xd93f47,_0x5ee820){var _0x42ab5b={};var _0x22d666={};var _0x4b5792;var _0x5f00e4;return db[_0x40b4('0x33')][_0x40b4('0x4f')]({'where':{'id':_0x4ed13f[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0xd93f47,null))[_0x40b4('0x2c')](function(_0x111e83){if(_0x111e83){_0x4b5792=_0x111e83;_0x22d666[_0x40b4('0x38')]=_['keys'](db[_0x40b4('0x57')][_0x40b4('0x34')]);_0x22d666[_0x40b4('0x3a')]=_[_0x40b4('0x39')](_0x4ed13f[_0x40b4('0x3a')]);_0x22d666[_0x40b4('0x3b')]=_['intersection'](_0x22d666[_0x40b4('0x38')],_0x22d666[_0x40b4('0x3a')]);_0x42ab5b[_0x40b4('0x3e')]=_[_0x40b4('0x3c')](_0x22d666[_0x40b4('0x38')],qs[_0x40b4('0x3d')](_0x4ed13f['query']['fields']));_0x42ab5b[_0x40b4('0x3e')]=_0x42ab5b['attributes'][_0x40b4('0x3f')]?_0x42ab5b['attributes']:_0x22d666['model'];_0x42ab5b[_0x40b4('0x51')]=qs[_0x40b4('0x41')](_0x4ed13f[_0x40b4('0x3a')][_0x40b4('0x41')]);_0x42ab5b['where']=qs[_0x40b4('0x3b')](_[_0x40b4('0x52')](_0x4ed13f[_0x40b4('0x3a')],_0x22d666[_0x40b4('0x3b')]));if(_0x4ed13f[_0x40b4('0x3a')]['filter']){_0x42ab5b['where']=_[_0x40b4('0x44')](_0x42ab5b[_0x40b4('0x42')],{'$or':_[_0x40b4('0x32')](_0x42ab5b[_0x40b4('0x3e')],function(_0x55ac20){var _0x4ff2a1={};_0x4ff2a1[_0x55ac20]={'$like':'%'+_0x4ed13f[_0x40b4('0x3a')][_0x40b4('0x43')]+'%'};return _0x4ff2a1;})});}_0x42ab5b=_[_0x40b4('0x44')]({},_0x42ab5b,_0x4ed13f['options']);return _0x4b5792[_0x40b4('0x56')](_0x42ab5b);}})['then'](function(_0xe973b4){if(_0xe973b4){_0x5f00e4=_0xe973b4['length'];if(!_0x4ed13f[_0x40b4('0x3a')][_0x40b4('0x54')](_0x40b4('0x40'))){_0x42ab5b[_0x40b4('0x26')]=qs[_0x40b4('0x26')](_0x4ed13f['query']['limit']);_0x42ab5b[_0x40b4('0x25')]=qs[_0x40b4('0x25')](_0x4ed13f['query'][_0x40b4('0x25')]);}return _0x4b5792[_0x40b4('0x56')](_0x42ab5b);}})[_0x40b4('0x2c')](function(_0x80f115){if(_0x80f115){return _0x80f115?{'count':_0x5f00e4,'rows':_0x80f115}:null;}})[_0x40b4('0x2c')](respondWithResult(_0xd93f47,null))[_0x40b4('0x20')](handleError(_0xd93f47,null));};exports[_0x40b4('0x58')]=function(_0x593183,_0x2019de,_0x3d7e4a){if(_0x593183[_0x40b4('0x4d')]['id']){delete _0x593183[_0x40b4('0x4d')]['id'];}return db[_0x40b4('0x33')][_0x40b4('0x4f')]({'where':{'id':_0x593183[_0x40b4('0x4a')]['id']}})[_0x40b4('0x2c')](handleEntityNotFound(_0x2019de,null))['then'](function(_0x2d3c7d){if(_0x2d3c7d){return _0x2d3c7d['setTags'](_0x593183[_0x40b4('0x4d')][_0x40b4('0x59')]||[]);}return null;})[_0x40b4('0x2c')](respondWithResult(_0x2019de,null))['catch'](handleError(_0x2019de,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9597bd1..9a4a632 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 _0xa0ae=['util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x7e79c0,_0x150b74){var _0x22d3f0=function(_0x36fc47){while(--_0x36fc47){_0x7e79c0['push'](_0x7e79c0['shift']());}};_0x22d3f0(++_0x150b74);}(_0xa0ae,0x1c6));var _0xea0a=function(_0x22c50e,_0x4ea131){_0x22c50e=_0x22c50e-0x0;var _0x500f85=_0xa0ae[_0x22c50e];return _0x500f85;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var logger=require('../../config/logger')(_0xea0a('0x2'));var moment=require(_0xea0a('0x3'));var BPromise=require(_0xea0a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea0a('0x5'));var rimraf=require(_0xea0a('0x6'));var config=require(_0xea0a('0x7'));var attributes=require(_0xea0a('0x8'));module[_0xea0a('0x9')]=function(_0x35acbe,_0x3db83e){return _0x35acbe[_0xea0a('0xa')](_0xea0a('0xb'),attributes,{'tableName':_0xea0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaa1=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x3bea4,_0x56a1a5){var _0xf8e956=function(_0x489bd7){while(--_0x489bd7){_0x3bea4['push'](_0x3bea4['shift']());}};_0xf8e956(++_0x56a1a5);}(_0xcaa1,0x114));var _0x1caa=function(_0x29b8f7,_0x3446c7){_0x29b8f7=_0x29b8f7-0x0;var _0x18eadc=_0xcaa1[_0x29b8f7];return _0x18eadc;};'use strict';var _=require(_0x1caa('0x0'));var util=require('util');var logger=require(_0x1caa('0x1'))(_0x1caa('0x2'));var moment=require(_0x1caa('0x3'));var BPromise=require(_0x1caa('0x4'));var rp=require(_0x1caa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1caa('0x6'));var config=require(_0x1caa('0x7'));var attributes=require(_0x1caa('0x8'));module[_0x1caa('0x9')]=function(_0x2a89dd,_0x418c84){return _0x2a89dd[_0x1caa('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x1caa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index f2b033a..43fa201 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 _0xbc69=['jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','../../mysqldb','rpc','../../config/environment'];(function(_0x250fd8,_0xe7ba17){var _0x1771bd=function(_0xb000f){while(--_0xb000f){_0x250fd8['push'](_0x250fd8['shift']());}};_0x1771bd(++_0xe7ba17);}(_0xbc69,0xd7));var _0x9bc6=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xbc69[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x9bc6('0x0'));var util=require('util');var moment=require(_0x9bc6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bc6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9bc6('0x3'));var config=require(_0x9bc6('0x4'));var jayson=require(_0x9bc6('0x5'));var client=jayson[_0x9bc6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cf2d5,_0x43ee13,_0x17178f){return new BPromise(function(_0x3a1ab4,_0x4a1e92){return client[_0x9bc6('0x7')](_0x2cf2d5,_0x17178f)[_0x9bc6('0x8')](function(_0x4d6f57){logger[_0x9bc6('0x9')](_0x9bc6('0xa'),_0x43ee13,_0x9bc6('0xb'));logger[_0x9bc6('0xc')](_0x9bc6('0xd'),_0x43ee13,_0x9bc6('0xb'),JSON[_0x9bc6('0xe')](_0x4d6f57));if(_0x4d6f57[_0x9bc6('0xf')]){if(_0x4d6f57[_0x9bc6('0xf')][_0x9bc6('0x10')]===0x1f4){logger['error'](_0x9bc6('0xa'),_0x43ee13,_0x4d6f57[_0x9bc6('0xf')]['message']);return _0x4a1e92(_0x4d6f57[_0x9bc6('0xf')]['message']);}logger[_0x9bc6('0xf')](_0x9bc6('0xa'),_0x43ee13,_0x4d6f57[_0x9bc6('0xf')][_0x9bc6('0x11')]);return _0x3a1ab4(_0x4d6f57['error'][_0x9bc6('0x11')]);}else{logger[_0x9bc6('0x9')](_0x9bc6('0xa'),_0x43ee13,_0x9bc6('0xb'));_0x3a1ab4(_0x4d6f57[_0x9bc6('0x12')]['message']);}})[_0x9bc6('0x13')](function(_0x210a4b){logger['error'](_0x9bc6('0xa'),_0x43ee13,_0x210a4b);_0x4a1e92(_0x210a4b);});});} \ No newline at end of file +var _0x5a0d=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5a0d,0x1e8));var _0xd5a0=function(_0x223c66,_0x314c7c){_0x223c66=_0x223c66-0x0;var _0x24bebf=_0x5a0d[_0x223c66];return _0x24bebf;};'use strict';var _=require(_0xd5a0('0x0'));var util=require(_0xd5a0('0x1'));var moment=require('moment');var BPromise=require(_0xd5a0('0x2'));var rs=require(_0xd5a0('0x3'));var fs=require('fs');var Redis=require(_0xd5a0('0x4'));var db=require(_0xd5a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5a0('0x6'))(_0xd5a0('0x7'));var config=require(_0xd5a0('0x8'));var jayson=require(_0xd5a0('0x9'));var client=jayson[_0xd5a0('0xa')][_0xd5a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238cce,_0xb30b4b,_0x15cbaa){return new BPromise(function(_0x3f6a2b,_0x18662e){return client['request'](_0x238cce,_0x15cbaa)[_0xd5a0('0xc')](function(_0x40ae37){logger[_0xd5a0('0xd')](_0xd5a0('0xe'),_0xb30b4b,_0xd5a0('0xf'));logger[_0xd5a0('0x10')](_0xd5a0('0x11'),_0xb30b4b,_0xd5a0('0xf'),JSON[_0xd5a0('0x12')](_0x40ae37));if(_0x40ae37[_0xd5a0('0x13')]){if(_0x40ae37[_0xd5a0('0x13')][_0xd5a0('0x14')]===0x1f4){logger[_0xd5a0('0x13')](_0xd5a0('0xe'),_0xb30b4b,_0x40ae37[_0xd5a0('0x13')][_0xd5a0('0x15')]);return _0x18662e(_0x40ae37[_0xd5a0('0x13')][_0xd5a0('0x15')]);}logger[_0xd5a0('0x13')](_0xd5a0('0xe'),_0xb30b4b,_0x40ae37[_0xd5a0('0x13')][_0xd5a0('0x15')]);return _0x3f6a2b(_0x40ae37[_0xd5a0('0x13')][_0xd5a0('0x15')]);}else{logger['info'](_0xd5a0('0xe'),_0xb30b4b,_0xd5a0('0xf'));_0x3f6a2b(_0x40ae37[_0xd5a0('0x16')][_0xd5a0('0x15')]);}})['catch'](function(_0x48ed40){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xb30b4b,_0x48ed40);_0x18662e(_0x48ed40);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7e0b339..f22f805 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 _0xc2e6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','Router'];(function(_0x1b8ad9,_0x301373){var _0x279227=function(_0x254c26){while(--_0x254c26){_0x1b8ad9['push'](_0x1b8ad9['shift']());}};_0x279227(++_0x301373);}(_0xc2e6,0x12f));var _0x6c2e=function(_0x317b89,_0x35ce92){_0x317b89=_0x317b89-0x0;var _0x497d59=_0xc2e6[_0x317b89];return _0x497d59;};'use strict';var multer=require('multer');var util=require(_0x6c2e('0x0'));var path=require(_0x6c2e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c2e('0x2')]();var auth=require(_0x6c2e('0x3'));var interaction=require(_0x6c2e('0x4'));var config=require(_0x6c2e('0x5'));var controller=require(_0x6c2e('0x6'));router[_0x6c2e('0x7')]('/',auth[_0x6c2e('0x8')](),controller[_0x6c2e('0x9')]);router[_0x6c2e('0x7')](_0x6c2e('0xa'),auth[_0x6c2e('0x8')](),controller[_0x6c2e('0xb')]);router[_0x6c2e('0xc')]('/',auth[_0x6c2e('0x8')](),controller[_0x6c2e('0xd')]);router['put'](_0x6c2e('0xa'),auth[_0x6c2e('0x8')](),controller[_0x6c2e('0xe')]);router[_0x6c2e('0xf')](_0x6c2e('0xa'),auth[_0x6c2e('0x8')](),controller[_0x6c2e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd7a5=['get','show','post','create','put','update','delete','/:id','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated'];(function(_0x3a3bed,_0x17101a){var _0x1aaa7e=function(_0x98ace8){while(--_0x98ace8){_0x3a3bed['push'](_0x3a3bed['shift']());}};_0x1aaa7e(++_0x17101a);}(_0xd7a5,0x1cb));var _0x5d7a=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0xd7a5[_0x20cb20];return _0x2fcf4b;};'use strict';var multer=require('multer');var util=require(_0x5d7a('0x0'));var path=require(_0x5d7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d7a('0x2'));var router=express[_0x5d7a('0x3')]();var auth=require(_0x5d7a('0x4'));var interaction=require(_0x5d7a('0x5'));var config=require(_0x5d7a('0x6'));var controller=require(_0x5d7a('0x7'));router['get']('/',auth[_0x5d7a('0x8')](),controller['index']);router[_0x5d7a('0x9')]('/:id',auth[_0x5d7a('0x8')](),controller[_0x5d7a('0xa')]);router[_0x5d7a('0xb')]('/',auth[_0x5d7a('0x8')](),controller[_0x5d7a('0xc')]);router[_0x5d7a('0xd')]('/:id',auth[_0x5d7a('0x8')](),controller[_0x5d7a('0xe')]);router[_0x5d7a('0xf')](_0x5d7a('0x10'),auth[_0x5d7a('0x8')](),controller[_0x5d7a('0x11')]);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 ad8e40f..cf2186b 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 _0xda55=['BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xda55,0x6d));var _0x5da5=function(_0x11fc67,_0x1eda19){_0x11fc67=_0x11fc67-0x0;var _0x50bb19=_0xda55[_0x11fc67];return _0x50bb19;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5da5('0x2'),_0x5da5('0x3'),_0x5da5('0x4'),_0x5da5('0x5')),'defaultValue':_0x5da5('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5da5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5da5('0x6'),'variable',_0x5da5('0x3'))},'keyContent':{'type':Sequelize[_0x5da5('0x7')]},'idField':{'type':Sequelize[_0x5da5('0x7')]},'nameField':{'type':Sequelize[_0x5da5('0x7')]},'customField':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5da5('0x7')]}}; \ No newline at end of file +var _0xf2cb=['exports','string','customVariable','picklist','ENUM','variable','STRING','BOOLEAN'];(function(_0x4c49ce,_0x3ebd38){var _0x586d80=function(_0x59a512){while(--_0x59a512){_0x4c49ce['push'](_0x4c49ce['shift']());}};_0x586d80(++_0x3ebd38);}(_0xf2cb,0x130));var _0xbf2c=function(_0x31883b,_0x2a04d4){_0x31883b=_0x31883b-0x0;var _0xff1d51=_0xf2cb[_0x31883b];return _0xff1d51;};'use strict';var Sequelize=require('sequelize');module[_0xbf2c('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbf2c('0x1'),'variable',_0xbf2c('0x2'),'keyValue',_0xbf2c('0x3')),'defaultValue':_0xbf2c('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbf2c('0x4')](_0xbf2c('0x1'),_0xbf2c('0x5'),_0xbf2c('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbf2c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbf2c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b3a427b..c7a273c 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 _0xb2e8=['filters','pick','merge','map','filter','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','offset','apply','reject','save','destroy','then','end','error','name','send','index','FreshdeskField','fieldName','type','key','model','query','intersection','fields','attributes','length','limit','order','sort','where'];(function(_0x255821,_0x3c0088){var _0x2741b2=function(_0x3bd70c){while(--_0x3bd70c){_0x255821['push'](_0x255821['shift']());}};_0x2741b2(++_0x3c0088);}(_0xb2e8,0x1ef));var _0x8b2e=function(_0x269f69,_0x3fefe2){_0x269f69=_0x269f69-0x0;var _0x1f6894=_0xb2e8[_0x269f69];return _0x1f6894;};'use strict';var pdf=require(_0x8b2e('0x0'));var emlformat=require(_0x8b2e('0x1'));var rimraf=require(_0x8b2e('0x2'));var zipdir=require(_0x8b2e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b2e('0x4'));var moment=require(_0x8b2e('0x5'));var BPromise=require(_0x8b2e('0x6'));var Mustache=require(_0x8b2e('0x7'));var util=require(_0x8b2e('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b2e('0x9'));var fs=require('fs');var _=require(_0x8b2e('0xa'));var squel=require(_0x8b2e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b2e('0xc'));var toCsv=require(_0x8b2e('0xd'));var querystring=require('querystring');var Papa=require(_0x8b2e('0xe'));var Redis=require('ioredis');var authService=require(_0x8b2e('0xf'));var qs=require(_0x8b2e('0x10'));var as=require(_0x8b2e('0x11'));var hardwareService=require(_0x8b2e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8b2e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b2e('0x14'))['db'];function respondWithStatusCode(_0x1195af,_0x60dd14){_0x60dd14=_0x60dd14||0xcc;return function(_0x389af3){if(_0x389af3){return _0x1195af[_0x8b2e('0x15')](_0x60dd14);}return _0x1195af[_0x8b2e('0x16')](_0x60dd14)['end']();};}function respondWithResult(_0x44d570,_0x468cf4){_0x468cf4=_0x468cf4||0xc8;return function(_0x3e2042){if(_0x3e2042){return _0x44d570[_0x8b2e('0x16')](_0x468cf4)[_0x8b2e('0x17')](_0x3e2042);}};}function respondWithFilteredResult(_0x3fcb01,_0x4ea870){return function(_0xa6003e){if(_0xa6003e){var _0x2bb352=_0xa6003e['count'],_0x37f049=_0x4ea870[_0x8b2e('0x18')],_0x5974c6=_0x4ea870[_0x8b2e('0x18')]+_0x4ea870['limit'],_0x52bfb6;if(_0x5974c6>=_0x2bb352){_0x5974c6=_0x2bb352;_0x52bfb6=0xc8;}else{_0x52bfb6=0xce;}_0x3fcb01[_0x8b2e('0x16')](_0x52bfb6);return _0x3fcb01['set']('Content-Range',_0x37f049+'-'+_0x5974c6+'/'+_0x2bb352)['json'](_0xa6003e);}return null;};}function patchUpdates(_0x77a267){return function(_0x473382){try{jsonpatch[_0x8b2e('0x19')](_0x473382,_0x77a267,!![]);}catch(_0x528b30){return BPromise[_0x8b2e('0x1a')](_0x528b30);}return _0x473382[_0x8b2e('0x1b')]();};}function saveUpdates(_0x2556a5,_0x654b76){return function(_0x233d9a){if(_0x233d9a){return _0x233d9a['update'](_0x2556a5)['then'](function(_0x3090ba){return _0x3090ba;});}return null;};}function removeEntity(_0xadab6d,_0x44eb01){return function(_0x1dd524){if(_0x1dd524){return _0x1dd524[_0x8b2e('0x1c')]()[_0x8b2e('0x1d')](function(){_0xadab6d[_0x8b2e('0x16')](0xcc)[_0x8b2e('0x1e')]();});}};}function handleEntityNotFound(_0x1131c6,_0x1a7ff3){return function(_0x3f83b9){if(!_0x3f83b9){_0x1131c6[_0x8b2e('0x15')](0x194);}return _0x3f83b9;};}function handleError(_0x21c4cf,_0x1644bf){_0x1644bf=_0x1644bf||0x1f4;return function(_0x3c0ac0){logger[_0x8b2e('0x1f')](_0x3c0ac0['stack']);if(_0x3c0ac0['name']){delete _0x3c0ac0[_0x8b2e('0x20')];}_0x21c4cf[_0x8b2e('0x16')](_0x1644bf)[_0x8b2e('0x21')](_0x3c0ac0);};}exports[_0x8b2e('0x22')]=function(_0x521b16,_0xa71ba){var _0x2c932a={},_0x13e9d5={},_0x1e354c={'count':0x0,'rows':[]};var _0x408747=_['map'](db[_0x8b2e('0x23')]['rawAttributes'],function(_0x205118){return{'name':_0x205118[_0x8b2e('0x24')],'type':_0x205118[_0x8b2e('0x25')][_0x8b2e('0x26')]};});_0x13e9d5[_0x8b2e('0x27')]=_['map'](_0x408747,_0x8b2e('0x20'));_0x13e9d5['query']=_['keys'](_0x521b16[_0x8b2e('0x28')]);_0x13e9d5['filters']=_[_0x8b2e('0x29')](_0x13e9d5[_0x8b2e('0x27')],_0x13e9d5['query']);_0x2c932a['attributes']=_[_0x8b2e('0x29')](_0x13e9d5['model'],qs['fields'](_0x521b16[_0x8b2e('0x28')][_0x8b2e('0x2a')]));_0x2c932a[_0x8b2e('0x2b')]=_0x2c932a[_0x8b2e('0x2b')][_0x8b2e('0x2c')]?_0x2c932a['attributes']:_0x13e9d5['model'];if(!_0x521b16[_0x8b2e('0x28')]['hasOwnProperty']('nolimit')){_0x2c932a[_0x8b2e('0x2d')]=qs[_0x8b2e('0x2d')](_0x521b16['query'][_0x8b2e('0x2d')]);_0x2c932a[_0x8b2e('0x18')]=qs[_0x8b2e('0x18')](_0x521b16['query'][_0x8b2e('0x18')]);}_0x2c932a[_0x8b2e('0x2e')]=qs[_0x8b2e('0x2f')](_0x521b16['query'][_0x8b2e('0x2f')]);_0x2c932a[_0x8b2e('0x30')]=qs[_0x8b2e('0x31')](_[_0x8b2e('0x32')](_0x521b16['query'],_0x13e9d5['filters']),_0x408747);if(_0x521b16['query']['filter']){_0x2c932a[_0x8b2e('0x30')]=_[_0x8b2e('0x33')](_0x2c932a[_0x8b2e('0x30')],{'$or':_[_0x8b2e('0x34')](_0x408747,function(_0x22aa3){if(_0x22aa3[_0x8b2e('0x25')]!=='VIRTUAL'){var _0x4b62ca={};_0x4b62ca[_0x22aa3[_0x8b2e('0x20')]]={'$like':'%'+_0x521b16[_0x8b2e('0x28')][_0x8b2e('0x35')]+'%'};return _0x4b62ca;}})});}_0x2c932a=_['merge']({},_0x2c932a,_0x521b16[_0x8b2e('0x36')]);var _0x2937c6={'where':_0x2c932a['where']};return db['FreshdeskField']['count'](_0x2937c6)[_0x8b2e('0x1d')](function(_0x56e9ae){_0x1e354c[_0x8b2e('0x37')]=_0x56e9ae;if(_0x521b16[_0x8b2e('0x28')][_0x8b2e('0x38')]){_0x2c932a[_0x8b2e('0x39')]=[{'all':!![]}];}return db[_0x8b2e('0x23')][_0x8b2e('0x3a')](_0x2c932a);})['then'](function(_0x10458a){_0x1e354c[_0x8b2e('0x3b')]=_0x10458a;return _0x1e354c;})[_0x8b2e('0x1d')](respondWithFilteredResult(_0xa71ba,_0x2c932a))[_0x8b2e('0x3c')](handleError(_0xa71ba,null));};exports[_0x8b2e('0x3d')]=function(_0xe9649d,_0x455e6b){var _0x5a33d4={'raw':!![],'where':{'id':_0xe9649d['params']['id']}},_0x2f411d={};_0x2f411d[_0x8b2e('0x27')]=_[_0x8b2e('0x3e')](db[_0x8b2e('0x23')][_0x8b2e('0x3f')]);_0x2f411d['query']=_[_0x8b2e('0x3e')](_0xe9649d['query']);_0x2f411d['filters']=_[_0x8b2e('0x29')](_0x2f411d[_0x8b2e('0x27')],_0x2f411d[_0x8b2e('0x28')]);_0x5a33d4[_0x8b2e('0x2b')]=_[_0x8b2e('0x29')](_0x2f411d[_0x8b2e('0x27')],qs['fields'](_0xe9649d[_0x8b2e('0x28')][_0x8b2e('0x2a')]));_0x5a33d4['attributes']=_0x5a33d4[_0x8b2e('0x2b')][_0x8b2e('0x2c')]?_0x5a33d4[_0x8b2e('0x2b')]:_0x2f411d[_0x8b2e('0x27')];if(_0xe9649d['query']['includeAll']){_0x5a33d4['include']=[{'all':!![]}];}_0x5a33d4=_[_0x8b2e('0x33')]({},_0x5a33d4,_0xe9649d['options']);return db['FreshdeskField'][_0x8b2e('0x40')](_0x5a33d4)[_0x8b2e('0x1d')](handleEntityNotFound(_0x455e6b,null))['then'](respondWithResult(_0x455e6b,null))[_0x8b2e('0x3c')](handleError(_0x455e6b,null));};exports[_0x8b2e('0x41')]=function(_0xa67367,_0x3572e5){return db['FreshdeskField'][_0x8b2e('0x41')](_0xa67367[_0x8b2e('0x42')],{})['then'](respondWithResult(_0x3572e5,0xc9))[_0x8b2e('0x3c')](handleError(_0x3572e5,null));};exports['update']=function(_0xc88324,_0x1f91c0){if(_0xc88324[_0x8b2e('0x42')]['id']){delete _0xc88324[_0x8b2e('0x42')]['id'];}return db[_0x8b2e('0x23')][_0x8b2e('0x40')]({'where':{'id':_0xc88324[_0x8b2e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f91c0,null))['then'](saveUpdates(_0xc88324['body'],null))[_0x8b2e('0x1d')](respondWithResult(_0x1f91c0,null))[_0x8b2e('0x3c')](handleError(_0x1f91c0,null));};exports['destroy']=function(_0x492c80,_0x3aff76){return db[_0x8b2e('0x23')]['find']({'where':{'id':_0x492c80[_0x8b2e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3aff76,null))['then'](removeEntity(_0x3aff76,null))[_0x8b2e('0x3c')](handleError(_0x3aff76,null));}; \ No newline at end of file +var _0x851c=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x3821b3,_0x53b36c){var _0x5a03a7=function(_0x59360a){while(--_0x59360a){_0x3821b3['push'](_0x3821b3['shift']());}};_0x5a03a7(++_0x53b36c);}(_0x851c,0x19d));var _0xc851=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x851c[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xc851('0x0'));var emlformat=require(_0xc851('0x1'));var rimraf=require(_0xc851('0x2'));var zipdir=require(_0xc851('0x3'));var jsonpatch=require(_0xc851('0x4'));var rp=require(_0xc851('0x5'));var moment=require(_0xc851('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc851('0x7'));var util=require(_0xc851('0x8'));var path=require('path');var sox=require(_0xc851('0x9'));var csv=require(_0xc851('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc851('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc851('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc851('0xd'));var Papa=require(_0xc851('0xe'));var Redis=require(_0xc851('0xf'));var authService=require(_0xc851('0x10'));var qs=require(_0xc851('0x11'));var as=require(_0xc851('0x12'));var hardwareService=require(_0xc851('0x13'));var logger=require(_0xc851('0x14'))('api');var utils=require(_0xc851('0x15'));var config=require(_0xc851('0x16'));var licenseUtil=require(_0xc851('0x17'));var db=require(_0xc851('0x18'))['db'];function respondWithStatusCode(_0x46227a,_0xd918b6){_0xd918b6=_0xd918b6||0xcc;return function(_0x3301f8){if(_0x3301f8){return _0x46227a[_0xc851('0x19')](_0xd918b6);}return _0x46227a[_0xc851('0x1a')](_0xd918b6)[_0xc851('0x1b')]();};}function respondWithResult(_0x24d83a,_0x3fddbe){_0x3fddbe=_0x3fddbe||0xc8;return function(_0x35be4d){if(_0x35be4d){return _0x24d83a[_0xc851('0x1a')](_0x3fddbe)[_0xc851('0x1c')](_0x35be4d);}};}function respondWithFilteredResult(_0x458951,_0x5e67ee){return function(_0xc2be54){if(_0xc2be54){var _0x5ad5e1=_0xc2be54[_0xc851('0x1d')],_0x2b4839=_0x5e67ee[_0xc851('0x1e')],_0x5178ca=_0x5e67ee[_0xc851('0x1e')]+_0x5e67ee[_0xc851('0x1f')],_0x110261;if(_0x5178ca>=_0x5ad5e1){_0x5178ca=_0x5ad5e1;_0x110261=0xc8;}else{_0x110261=0xce;}_0x458951[_0xc851('0x1a')](_0x110261);return _0x458951[_0xc851('0x20')]('Content-Range',_0x2b4839+'-'+_0x5178ca+'/'+_0x5ad5e1)[_0xc851('0x1c')](_0xc2be54);}return null;};}function patchUpdates(_0x2c3cb1){return function(_0x543377){try{jsonpatch[_0xc851('0x21')](_0x543377,_0x2c3cb1,!![]);}catch(_0x628458){return BPromise[_0xc851('0x22')](_0x628458);}return _0x543377[_0xc851('0x23')]();};}function saveUpdates(_0x5ad006,_0x28fb91){return function(_0xfc72dc){if(_0xfc72dc){return _0xfc72dc[_0xc851('0x24')](_0x5ad006)[_0xc851('0x25')](function(_0x30e85f){return _0x30e85f;});}return null;};}function removeEntity(_0x4bcc4b,_0x5ad1b1){return function(_0x442271){if(_0x442271){return _0x442271[_0xc851('0x26')]()[_0xc851('0x25')](function(){_0x4bcc4b[_0xc851('0x1a')](0xcc)[_0xc851('0x1b')]();});}};}function handleEntityNotFound(_0x35525a,_0x57b70b){return function(_0x3f95d5){if(!_0x3f95d5){_0x35525a['sendStatus'](0x194);}return _0x3f95d5;};}function handleError(_0x5b44b2,_0x7a59cd){_0x7a59cd=_0x7a59cd||0x1f4;return function(_0x1d6bc4){logger['error'](_0x1d6bc4[_0xc851('0x27')]);if(_0x1d6bc4[_0xc851('0x28')]){delete _0x1d6bc4[_0xc851('0x28')];}_0x5b44b2['status'](_0x7a59cd)[_0xc851('0x29')](_0x1d6bc4);};}exports[_0xc851('0x2a')]=function(_0x283b10,_0xc34e1a){var _0x1a08a8={},_0x2fc8f1={},_0x3ebd7b={'count':0x0,'rows':[]};var _0x3d20eb=_[_0xc851('0x2b')](db[_0xc851('0x2c')][_0xc851('0x2d')],function(_0x13a826){return{'name':_0x13a826['fieldName'],'type':_0x13a826[_0xc851('0x2e')][_0xc851('0x2f')]};});_0x2fc8f1['model']=_[_0xc851('0x2b')](_0x3d20eb,'name');_0x2fc8f1['query']=_['keys'](_0x283b10[_0xc851('0x30')]);_0x2fc8f1['filters']=_[_0xc851('0x31')](_0x2fc8f1['model'],_0x2fc8f1[_0xc851('0x30')]);_0x1a08a8[_0xc851('0x32')]=_[_0xc851('0x31')](_0x2fc8f1[_0xc851('0x33')],qs[_0xc851('0x34')](_0x283b10[_0xc851('0x30')][_0xc851('0x34')]));_0x1a08a8[_0xc851('0x32')]=_0x1a08a8[_0xc851('0x32')][_0xc851('0x35')]?_0x1a08a8[_0xc851('0x32')]:_0x2fc8f1['model'];if(!_0x283b10[_0xc851('0x30')]['hasOwnProperty'](_0xc851('0x36'))){_0x1a08a8[_0xc851('0x1f')]=qs[_0xc851('0x1f')](_0x283b10[_0xc851('0x30')][_0xc851('0x1f')]);_0x1a08a8[_0xc851('0x1e')]=qs[_0xc851('0x1e')](_0x283b10['query']['offset']);}_0x1a08a8[_0xc851('0x37')]=qs[_0xc851('0x38')](_0x283b10['query']['sort']);_0x1a08a8[_0xc851('0x39')]=qs[_0xc851('0x3a')](_[_0xc851('0x3b')](_0x283b10['query'],_0x2fc8f1[_0xc851('0x3a')]),_0x3d20eb);if(_0x283b10[_0xc851('0x30')][_0xc851('0x3c')]){_0x1a08a8[_0xc851('0x39')]=_[_0xc851('0x3d')](_0x1a08a8[_0xc851('0x39')],{'$or':_[_0xc851('0x2b')](_0x3d20eb,function(_0x4b02b5){if(_0x4b02b5[_0xc851('0x2e')]!==_0xc851('0x3e')){var _0xe966e4={};_0xe966e4[_0x4b02b5[_0xc851('0x28')]]={'$like':'%'+_0x283b10[_0xc851('0x30')]['filter']+'%'};return _0xe966e4;}})});}_0x1a08a8=_[_0xc851('0x3d')]({},_0x1a08a8,_0x283b10[_0xc851('0x3f')]);var _0x2be2aa={'where':_0x1a08a8['where']};return db[_0xc851('0x2c')]['count'](_0x2be2aa)[_0xc851('0x25')](function(_0x4c29d7){_0x3ebd7b[_0xc851('0x1d')]=_0x4c29d7;if(_0x283b10['query'][_0xc851('0x40')]){_0x1a08a8[_0xc851('0x41')]=[{'all':!![]}];}return db[_0xc851('0x2c')]['findAll'](_0x1a08a8);})[_0xc851('0x25')](function(_0x6a80c2){_0x3ebd7b[_0xc851('0x42')]=_0x6a80c2;return _0x3ebd7b;})[_0xc851('0x25')](respondWithFilteredResult(_0xc34e1a,_0x1a08a8))['catch'](handleError(_0xc34e1a,null));};exports[_0xc851('0x43')]=function(_0x337047,_0x471f3d){var _0x546f5d={'raw':!![],'where':{'id':_0x337047[_0xc851('0x44')]['id']}},_0x4bc46b={};_0x4bc46b['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x4bc46b[_0xc851('0x30')]=_[_0xc851('0x45')](_0x337047[_0xc851('0x30')]);_0x4bc46b[_0xc851('0x3a')]=_[_0xc851('0x31')](_0x4bc46b[_0xc851('0x33')],_0x4bc46b[_0xc851('0x30')]);_0x546f5d[_0xc851('0x32')]=_[_0xc851('0x31')](_0x4bc46b[_0xc851('0x33')],qs[_0xc851('0x34')](_0x337047[_0xc851('0x30')][_0xc851('0x34')]));_0x546f5d[_0xc851('0x32')]=_0x546f5d['attributes']['length']?_0x546f5d[_0xc851('0x32')]:_0x4bc46b['model'];if(_0x337047['query'][_0xc851('0x40')]){_0x546f5d[_0xc851('0x41')]=[{'all':!![]}];}_0x546f5d=_['merge']({},_0x546f5d,_0x337047['options']);return db[_0xc851('0x2c')][_0xc851('0x46')](_0x546f5d)['then'](handleEntityNotFound(_0x471f3d,null))[_0xc851('0x25')](respondWithResult(_0x471f3d,null))[_0xc851('0x47')](handleError(_0x471f3d,null));};exports['create']=function(_0x2d364f,_0x3188b5){return db[_0xc851('0x2c')][_0xc851('0x48')](_0x2d364f[_0xc851('0x49')],{})['then'](respondWithResult(_0x3188b5,0xc9))[_0xc851('0x47')](handleError(_0x3188b5,null));};exports[_0xc851('0x24')]=function(_0x2782ac,_0x51ff8f){if(_0x2782ac[_0xc851('0x49')]['id']){delete _0x2782ac[_0xc851('0x49')]['id'];}return db[_0xc851('0x2c')]['find']({'where':{'id':_0x2782ac['params']['id']}})[_0xc851('0x25')](handleEntityNotFound(_0x51ff8f,null))[_0xc851('0x25')](saveUpdates(_0x2782ac[_0xc851('0x49')],null))['then'](respondWithResult(_0x51ff8f,null))[_0xc851('0x47')](handleError(_0x51ff8f,null));};exports['destroy']=function(_0x370b58,_0x2b7fab){return db[_0xc851('0x2c')][_0xc851('0x46')]({'where':{'id':_0x370b58[_0xc851('0x44')]['id']}})[_0xc851('0x25')](handleEntityNotFound(_0x2b7fab,null))[_0xc851('0x25')](removeEntity(_0x2b7fab,null))[_0xc851('0x47')](handleError(_0x2b7fab,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7cdd535..9518a95 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 _0xe684=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index'];(function(_0x483570,_0x1a08f3){var _0x1d7103=function(_0x33d90d){while(--_0x33d90d){_0x483570['push'](_0x483570['shift']());}};_0x1d7103(++_0x1a08f3);}(_0xe684,0xc4));var _0x4e68=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe684[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x4e68('0x0'));var util=require(_0x4e68('0x1'));var logger=require(_0x4e68('0x2'))(_0x4e68('0x3'));var moment=require(_0x4e68('0x4'));var BPromise=require(_0x4e68('0x5'));var rp=require(_0x4e68('0x6'));var fs=require('fs');var path=require(_0x4e68('0x7'));var rimraf=require(_0x4e68('0x8'));var config=require(_0x4e68('0x9'));var attributes=require(_0x4e68('0xa'));module['exports']=function(_0x111d05,_0x2117ef){return _0x111d05[_0x4e68('0xb')](_0x4e68('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x4e68('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0589=['freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x104bc0,_0x3a7391){var _0x24c02e=function(_0x4c0f08){while(--_0x4c0f08){_0x104bc0['push'](_0x104bc0['shift']());}};_0x24c02e(++_0x3a7391);}(_0x0589,0x1d4));var _0x9058=function(_0x51a00a,_0x2eb166){_0x51a00a=_0x51a00a-0x0;var _0x40f99f=_0x0589[_0x51a00a];return _0x40f99f;};'use strict';var _=require(_0x9058('0x0'));var util=require(_0x9058('0x1'));var logger=require(_0x9058('0x2'))(_0x9058('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9058('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9058('0x5'));var config=require(_0x9058('0x6'));var attributes=require(_0x9058('0x7'));module[_0x9058('0x8')]=function(_0x413902,_0x1326fe){return _0x413902[_0x9058('0x9')](_0x9058('0xa'),attributes,{'tableName':_0x9058('0xb'),'paranoid':![],'indexes':[{'name':_0x9058('0xc'),'fields':[_0x9058('0xd'),_0x9058('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index de30e73..82d141e 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4f819d,_0x2ff250){_0x4f819d=_0x4f819d-0x0;var _0x32a8cd=_0x7a54[_0x4f819d];return _0x32a8cd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x208468,_0x653dfb){_0x208468=_0x208468-0x0;var _0x12e1ac=_0x7a54[_0x208468];return _0x12e1ac;};'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 6a45018..cc20b44 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 _0xcc99=['create','addConfiguration','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post'];(function(_0x217e48,_0x2e4ae2){var _0x47f9c4=function(_0x4dc60c){while(--_0x4dc60c){_0x217e48['push'](_0x217e48['shift']());}};_0x47f9c4(++_0x2e4ae2);}(_0xcc99,0x10f));var _0x9cc9=function(_0x32624e,_0x2043f9){_0x32624e=_0x32624e-0x0;var _0x313fbe=_0xcc99[_0x32624e];return _0x313fbe;};'use strict';var multer=require(_0x9cc9('0x0'));var util=require('util');var path=require(_0x9cc9('0x1'));var timeout=require(_0x9cc9('0x2'));var express=require(_0x9cc9('0x3'));var router=express[_0x9cc9('0x4')]();var auth=require(_0x9cc9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9cc9('0x6'));router[_0x9cc9('0x7')]('/',auth[_0x9cc9('0x8')](),controller['index']);router['get'](_0x9cc9('0x9'),auth[_0x9cc9('0x8')](),controller[_0x9cc9('0xa')]);router['get'](_0x9cc9('0xb'),auth['isAuthenticated'](),controller[_0x9cc9('0xc')]);router[_0x9cc9('0x7')]('/:id/fields',auth[_0x9cc9('0x8')](),controller['getFields']);router[_0x9cc9('0xd')]('/',auth['isAuthenticated'](),controller[_0x9cc9('0xe')]);router[_0x9cc9('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x9cc9('0xf')]);router['put'](_0x9cc9('0x9'),auth[_0x9cc9('0x8')](),controller[_0x9cc9('0x10')]);router[_0x9cc9('0x11')](_0x9cc9('0x9'),auth[_0x9cc9('0x8')](),controller['destroy']);module[_0x9cc9('0x12')]=router; \ No newline at end of file +var _0x6a0f=['get','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x4f5c57,_0x1099d3){var _0x5097b6=function(_0x2a7cd5){while(--_0x2a7cd5){_0x4f5c57['push'](_0x4f5c57['shift']());}};_0x5097b6(++_0x1099d3);}(_0x6a0f,0x132));var _0xf6a0=function(_0xe1ed18,_0x44f58b){_0xe1ed18=_0xe1ed18-0x0;var _0x4920b0=_0x6a0f[_0xe1ed18];return _0x4920b0;};'use strict';var multer=require(_0xf6a0('0x0'));var util=require(_0xf6a0('0x1'));var path=require(_0xf6a0('0x2'));var timeout=require(_0xf6a0('0x3'));var express=require(_0xf6a0('0x4'));var router=express[_0xf6a0('0x5')]();var auth=require(_0xf6a0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6a0('0x7'));var controller=require(_0xf6a0('0x8'));router[_0xf6a0('0x9')]('/',auth[_0xf6a0('0xa')](),controller['index']);router[_0xf6a0('0x9')]('/:id',auth[_0xf6a0('0xa')](),controller['show']);router[_0xf6a0('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf6a0('0xb')]);router[_0xf6a0('0x9')](_0xf6a0('0xc'),auth[_0xf6a0('0xa')](),controller[_0xf6a0('0xd')]);router[_0xf6a0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xf6a0('0xa')](),controller[_0xf6a0('0xf')]);router[_0xf6a0('0x10')](_0xf6a0('0x11'),auth[_0xf6a0('0xa')](),controller[_0xf6a0('0x12')]);router[_0xf6a0('0x13')]('/:id',auth[_0xf6a0('0xa')](),controller[_0xf6a0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 669547d..923b24e 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 _0x93bb=['exports','STRING','remoteUri','sequelize'];(function(_0x201328,_0x3d57a4){var _0x5d7c5c=function(_0x1adcfb){while(--_0x1adcfb){_0x201328['push'](_0x201328['shift']());}};_0x5d7c5c(++_0x3d57a4);}(_0x93bb,0x13f));var _0xb93b=function(_0x188673,_0x572ff){_0x188673=_0x188673-0x0;var _0x316af3=_0x93bb[_0x188673];return _0x316af3;};'use strict';var Sequelize=require(_0xb93b('0x0'));module[_0xb93b('0x1')]={'name':{'type':Sequelize[_0xb93b('0x2')]},'description':{'type':Sequelize[_0xb93b('0x2')]},'username':{'type':Sequelize[_0xb93b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb93b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb93b('0x3')},'serverUrl':{'type':Sequelize[_0xb93b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x577f=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1892b4,_0x3c954d){var _0x4ef4b8=function(_0x4af0f2){while(--_0x4af0f2){_0x1892b4['push'](_0x1892b4['shift']());}};_0x4ef4b8(++_0x3c954d);}(_0x577f,0xe0));var _0xf577=function(_0xc251a4,_0x185d9f){_0xc251a4=_0xc251a4-0x0;var _0x87dcaa=_0x577f[_0xc251a4];return _0x87dcaa;};'use strict';var Sequelize=require(_0xf577('0x0'));module[_0xf577('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf577('0x2')]},'username':{'type':Sequelize[_0xf577('0x2')],'unique':_0xf577('0x3')},'apiKey':{'type':Sequelize[_0xf577('0x2')]},'remoteUri':{'type':Sequelize[_0xf577('0x2')],'unique':_0xf577('0x4')},'serverUrl':{'type':Sequelize[_0xf577('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a3855d3..9b75731 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 _0x2750=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','info','request\x20sent','debug','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','update','then','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2750,0x13b));var _0x0275=function(_0x4487ef,_0x4c617f){_0x4487ef=_0x4487ef-0x0;var _0x20f136=_0x2750[_0x4487ef];return _0x20f136;};'use strict';var pdf=require(_0x0275('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0275('0x1'));var zipdir=require(_0x0275('0x2'));var jsonpatch=require(_0x0275('0x3'));var rp=require(_0x0275('0x4'));var moment=require(_0x0275('0x5'));var BPromise=require(_0x0275('0x6'));var Mustache=require(_0x0275('0x7'));var util=require(_0x0275('0x8'));var path=require(_0x0275('0x9'));var sox=require(_0x0275('0xa'));var csv=require('to-csv');var ejs=require(_0x0275('0xb'));var fs=require('fs');var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0x10'));var querystring=require(_0x0275('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x13'));var hardwareService=require(_0x0275('0x14'));var logger=require(_0x0275('0x15'))(_0x0275('0x16'));var utils=require(_0x0275('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x18'));var db=require(_0x0275('0x19'))['db'];var integrations=require(_0x0275('0x1a'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0275('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x395398,_0x37f809,_0x46a729,_0x28827b){return new BPromise(function(_0x36921c,_0x5910b5){var _0x3e0791=_0x28827b||client;return _0x3e0791[_0x0275('0x1c')](_0x395398,_0x46a729)['then'](function(_0x6344fc){logger[_0x0275('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x37f809,_0x0275('0x1e'));logger[_0x0275('0x1f')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x37f809,'request\x20sent',JSON['stringify'](_0x6344fc));if(_0x6344fc['error']){if(_0x6344fc['error'][_0x0275('0x20')]===0x1f4){logger[_0x0275('0x21')](_0x0275('0x22'),_0x37f809,_0x6344fc['error'][_0x0275('0x23')]);return _0x5910b5(_0x6344fc[_0x0275('0x21')][_0x0275('0x23')]);}logger['error'](_0x0275('0x22'),_0x37f809,_0x6344fc[_0x0275('0x21')]['message']);return _0x36921c(_0x6344fc['error'][_0x0275('0x23')]);}else{logger[_0x0275('0x1d')](_0x0275('0x22'),_0x37f809,'request\x20sent');_0x36921c(_0x6344fc[_0x0275('0x24')]['message']);}})[_0x0275('0x25')](function(_0x5c75f1){logger[_0x0275('0x21')](_0x0275('0x22'),_0x37f809,_0x5c75f1);_0x5910b5(_0x5c75f1);});});}function respondWithStatusCode(_0x594321,_0x140a18){_0x140a18=_0x140a18||0xcc;return function(_0x3004bf){if(_0x3004bf){return _0x594321[_0x0275('0x26')](_0x140a18);}return _0x594321['status'](_0x140a18)[_0x0275('0x27')]();};}function respondWithResult(_0x44bbf8,_0x24c928){_0x24c928=_0x24c928||0xc8;return function(_0x15813f){if(_0x15813f){return _0x44bbf8[_0x0275('0x28')](_0x24c928)[_0x0275('0x29')](_0x15813f);}};}function respondWithFilteredResult(_0x56f26c,_0x35343c){return function(_0x14d7d8){if(_0x14d7d8){var _0x1d24b2=_0x14d7d8[_0x0275('0x2a')],_0x275dac=_0x35343c[_0x0275('0x2b')],_0x4689a3=_0x35343c[_0x0275('0x2b')]+_0x35343c[_0x0275('0x2c')],_0x512d26;if(_0x4689a3>=_0x1d24b2){_0x4689a3=_0x1d24b2;_0x512d26=0xc8;}else{_0x512d26=0xce;}_0x56f26c[_0x0275('0x28')](_0x512d26);return _0x56f26c['set'](_0x0275('0x2d'),_0x275dac+'-'+_0x4689a3+'/'+_0x1d24b2)[_0x0275('0x29')](_0x14d7d8);}return null;};}function patchUpdates(_0x127bbd){return function(_0x489d7f){try{jsonpatch['apply'](_0x489d7f,_0x127bbd,!![]);}catch(_0x3cb2d7){return BPromise[_0x0275('0x2e')](_0x3cb2d7);}return _0x489d7f['save']();};}function saveUpdates(_0x7eff96,_0x155a50){return function(_0x4378dd){if(_0x4378dd){return _0x4378dd[_0x0275('0x2f')](_0x7eff96)['then'](function(_0x24c762){return _0x24c762;});}return null;};}function removeEntity(_0x86940b,_0x3bba47){return function(_0x2002c2){if(_0x2002c2){return _0x2002c2['destroy']()[_0x0275('0x30')](function(){_0x86940b['status'](0xcc)[_0x0275('0x27')]();});}};}function handleEntityNotFound(_0x4ead8e,_0x26aae0){return function(_0x165157){if(!_0x165157){_0x4ead8e['sendStatus'](0x194);}return _0x165157;};}function handleError(_0xceb9f5,_0x459f83){_0x459f83=_0x459f83||0x1f4;return function(_0x1575be){logger[_0x0275('0x21')](_0x1575be['stack']);if(_0x1575be[_0x0275('0x31')]){delete _0x1575be[_0x0275('0x31')];}_0xceb9f5[_0x0275('0x28')](_0x459f83)[_0x0275('0x32')](_0x1575be);};}exports[_0x0275('0x33')]=function(_0x58e3f3,_0x2a18c3){var _0x2ad334={},_0x1b7276={},_0x364773={'count':0x0,'rows':[]};var _0xc64cf4=_[_0x0275('0x34')](db[_0x0275('0x35')][_0x0275('0x36')],function(_0x3bf52d){return{'name':_0x3bf52d[_0x0275('0x37')],'type':_0x3bf52d[_0x0275('0x38')]['key']};});_0x1b7276[_0x0275('0x39')]=_[_0x0275('0x34')](_0xc64cf4,_0x0275('0x31'));_0x1b7276[_0x0275('0x3a')]=_[_0x0275('0x3b')](_0x58e3f3[_0x0275('0x3a')]);_0x1b7276[_0x0275('0x3c')]=_[_0x0275('0x3d')](_0x1b7276[_0x0275('0x39')],_0x1b7276[_0x0275('0x3a')]);_0x2ad334[_0x0275('0x3e')]=_[_0x0275('0x3d')](_0x1b7276[_0x0275('0x39')],qs[_0x0275('0x3f')](_0x58e3f3['query'][_0x0275('0x3f')]));_0x2ad334[_0x0275('0x3e')]=_0x2ad334['attributes'][_0x0275('0x40')]?_0x2ad334[_0x0275('0x3e')]:_0x1b7276[_0x0275('0x39')];if(!_0x58e3f3[_0x0275('0x3a')][_0x0275('0x41')](_0x0275('0x42'))){_0x2ad334[_0x0275('0x2c')]=qs['limit'](_0x58e3f3[_0x0275('0x3a')][_0x0275('0x2c')]);_0x2ad334[_0x0275('0x2b')]=qs[_0x0275('0x2b')](_0x58e3f3['query'][_0x0275('0x2b')]);}_0x2ad334[_0x0275('0x43')]=qs[_0x0275('0x44')](_0x58e3f3[_0x0275('0x3a')]['sort']);_0x2ad334[_0x0275('0x45')]=qs['filters'](_[_0x0275('0x46')](_0x58e3f3[_0x0275('0x3a')],_0x1b7276[_0x0275('0x3c')]),_0xc64cf4);if(_0x58e3f3[_0x0275('0x3a')]['filter']){_0x2ad334[_0x0275('0x45')]=_[_0x0275('0x47')](_0x2ad334['where'],{'$or':_[_0x0275('0x34')](_0xc64cf4,function(_0x352d33){if(_0x352d33[_0x0275('0x38')]!=='VIRTUAL'){var _0x162327={};_0x162327[_0x352d33[_0x0275('0x31')]]={'$like':'%'+_0x58e3f3['query'][_0x0275('0x48')]+'%'};return _0x162327;}})});}_0x2ad334=_[_0x0275('0x47')]({},_0x2ad334,_0x58e3f3[_0x0275('0x49')]);var _0x437aa3={'where':_0x2ad334[_0x0275('0x45')]};return db[_0x0275('0x35')][_0x0275('0x2a')](_0x437aa3)[_0x0275('0x30')](function(_0xb15d65){_0x364773[_0x0275('0x2a')]=_0xb15d65;if(_0x58e3f3[_0x0275('0x3a')]['includeAll']){_0x2ad334[_0x0275('0x4a')]=[{'all':!![]}];}return db[_0x0275('0x35')][_0x0275('0x4b')](_0x2ad334);})[_0x0275('0x30')](function(_0x29633c){_0x364773[_0x0275('0x4c')]=_0x29633c;return _0x364773;})[_0x0275('0x30')](respondWithFilteredResult(_0x2a18c3,_0x2ad334))[_0x0275('0x25')](handleError(_0x2a18c3,null));};exports[_0x0275('0x4d')]=function(_0x3ac454,_0x348de0){var _0x598d15={'raw':![],'where':{'id':_0x3ac454[_0x0275('0x4e')]['id']}},_0x589401={};_0x589401[_0x0275('0x39')]=_[_0x0275('0x3b')](db[_0x0275('0x35')][_0x0275('0x36')]);_0x589401['query']=_[_0x0275('0x3b')](_0x3ac454['query']);_0x589401[_0x0275('0x3c')]=_[_0x0275('0x3d')](_0x589401[_0x0275('0x39')],_0x589401[_0x0275('0x3a')]);_0x598d15['attributes']=_[_0x0275('0x3d')](_0x589401['model'],qs['fields'](_0x3ac454['query'][_0x0275('0x3f')]));_0x598d15['attributes']=_0x598d15[_0x0275('0x3e')][_0x0275('0x40')]?_0x598d15[_0x0275('0x3e')]:_0x589401[_0x0275('0x39')];if(_0x3ac454[_0x0275('0x3a')][_0x0275('0x4f')]){_0x598d15[_0x0275('0x4a')]=[{'all':!![]}];}_0x598d15=_['merge']({},_0x598d15,_0x3ac454[_0x0275('0x49')]);return db['FreshsalesAccount'][_0x0275('0x50')](_0x598d15)[_0x0275('0x30')](handleEntityNotFound(_0x348de0,null))[_0x0275('0x30')](respondWithResult(_0x348de0,null))[_0x0275('0x25')](handleError(_0x348de0,null));};exports[_0x0275('0x51')]=function(_0x4097e8,_0x78dc83){return db[_0x0275('0x35')][_0x0275('0x51')](_0x4097e8[_0x0275('0x52')],{})['then'](respondWithResult(_0x78dc83,0xc9))['catch'](handleError(_0x78dc83,null));};exports[_0x0275('0x2f')]=function(_0x4fe422,_0x5a6f3c){if(_0x4fe422[_0x0275('0x52')]['id']){delete _0x4fe422[_0x0275('0x52')]['id'];}return db[_0x0275('0x35')][_0x0275('0x50')]({'where':{'id':_0x4fe422[_0x0275('0x4e')]['id']}})[_0x0275('0x30')](handleEntityNotFound(_0x5a6f3c,null))['then'](saveUpdates(_0x4fe422[_0x0275('0x52')],null))[_0x0275('0x30')](respondWithResult(_0x5a6f3c,null))[_0x0275('0x25')](handleError(_0x5a6f3c,null));};exports[_0x0275('0x53')]=function(_0x16892d,_0x1ec297){return db['FreshsalesAccount'][_0x0275('0x50')]({'where':{'id':_0x16892d[_0x0275('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ec297,null))[_0x0275('0x30')](removeEntity(_0x1ec297,null))['catch'](handleError(_0x1ec297,null));};exports[_0x0275('0x54')]=function(_0x240db2,_0x93bc6c,_0x3ae09e){var _0x2258f1={};var _0x7749c4={};var _0x30ad5b;var _0x40511b;return db[_0x0275('0x35')][_0x0275('0x55')]({'where':{'id':_0x240db2[_0x0275('0x4e')]['id']}})['then'](handleEntityNotFound(_0x93bc6c,null))[_0x0275('0x30')](function(_0x3697b0){if(_0x3697b0){_0x30ad5b=_0x3697b0;_0x7749c4[_0x0275('0x39')]=_['keys'](db[_0x0275('0x56')][_0x0275('0x36')]);_0x7749c4['query']=_[_0x0275('0x3b')](_0x240db2['query']);_0x7749c4[_0x0275('0x3c')]=_[_0x0275('0x3d')](_0x7749c4[_0x0275('0x39')],_0x7749c4[_0x0275('0x3a')]);_0x2258f1['attributes']=_[_0x0275('0x3d')](_0x7749c4[_0x0275('0x39')],qs[_0x0275('0x3f')](_0x240db2[_0x0275('0x3a')]['fields']));_0x2258f1[_0x0275('0x3e')]=_0x2258f1[_0x0275('0x3e')]['length']?_0x2258f1[_0x0275('0x3e')]:_0x7749c4[_0x0275('0x39')];_0x2258f1['order']=qs['sort'](_0x240db2[_0x0275('0x3a')][_0x0275('0x44')]);_0x2258f1['where']=qs['filters'](_[_0x0275('0x46')](_0x240db2[_0x0275('0x3a')],_0x7749c4[_0x0275('0x3c')]));if(_0x240db2[_0x0275('0x3a')][_0x0275('0x48')]){_0x2258f1[_0x0275('0x45')]=_[_0x0275('0x47')](_0x2258f1[_0x0275('0x45')],{'$or':_['map'](_0x2258f1[_0x0275('0x3e')],function(_0x115753){var _0x78e378={};_0x78e378[_0x115753]={'$like':'%'+_0x240db2[_0x0275('0x3a')][_0x0275('0x48')]+'%'};return _0x78e378;})});}_0x2258f1=_[_0x0275('0x47')]({},_0x2258f1,_0x240db2['options']);return _0x30ad5b[_0x0275('0x54')](_0x2258f1);}})['then'](function(_0x422ff4){if(_0x422ff4){_0x40511b=_0x422ff4[_0x0275('0x40')];if(!_0x240db2[_0x0275('0x3a')][_0x0275('0x41')]('nolimit')){_0x2258f1[_0x0275('0x2c')]=qs[_0x0275('0x2c')](_0x240db2[_0x0275('0x3a')][_0x0275('0x2c')]);_0x2258f1[_0x0275('0x2b')]=qs[_0x0275('0x2b')](_0x240db2[_0x0275('0x3a')][_0x0275('0x2b')]);}return _0x30ad5b[_0x0275('0x54')](_0x2258f1);}})['then'](function(_0x5bc165){if(_0x5bc165){return _0x5bc165?{'count':_0x40511b,'rows':_0x5bc165}:null;}})['then'](respondWithResult(_0x93bc6c,null))[_0x0275('0x25')](handleError(_0x93bc6c,null));};exports[_0x0275('0x57')]=function(_0x2dfadd,_0x58439d,_0x3b8e6a){if(_0x2dfadd[_0x0275('0x52')]['id']){delete _0x2dfadd[_0x0275('0x52')]['id'];}return db[_0x0275('0x35')][_0x0275('0x55')]({'where':{'id':_0x2dfadd['params']['id']}})[_0x0275('0x30')](handleEntityNotFound(_0x58439d,null))['then'](function(_0x207483){if(_0x207483){_0x2dfadd[_0x0275('0x52')][_0x0275('0x58')]=_0x207483['id'];_0x2dfadd[_0x0275('0x52')]['Subjects']=integrations[_0x0275('0x59')](_0x2dfadd[_0x0275('0x52')][_0x0275('0x5a')],_0x2dfadd['body'][_0x0275('0x38')]);_0x2dfadd[_0x0275('0x52')][_0x0275('0x5b')]=integrations[_0x0275('0x5c')](_0x2dfadd[_0x0275('0x52')][_0x0275('0x5a')],_0x2dfadd[_0x0275('0x52')][_0x0275('0x38')]);return db['FreshsalesConfiguration']['create'](_0x2dfadd['body'],{'include':[{'model':db[_0x0275('0x5d')],'as':_0x0275('0x5e')},{'model':db[_0x0275('0x5d')],'as':_0x0275('0x5b')}]});}return null;})[_0x0275('0x30')](respondWithResult(_0x58439d,null))['catch'](handleError(_0x58439d,null));};exports[_0x0275('0x5f')]=function(_0x55d769,_0x4820b0,_0x46d110){var _0x4b3d73='';var _0x158000='';return db[_0x0275('0x35')][_0x0275('0x55')]({'where':{'id':_0x55d769[_0x0275('0x4e')]['id']},'attributes':['id',_0x0275('0x60'),_0x0275('0x61'),_0x0275('0x62')]})[_0x0275('0x30')](handleEntityNotFound(_0x4820b0,null))[_0x0275('0x30')](function(_0x11e17f){if(_0x11e17f){_0x158000=_0x11e17f[_0x0275('0x60')];_0x4b3d73=_0x11e17f[_0x0275('0x61')];var _0x473d09=_0x11e17f[_0x0275('0x61')][_0x0275('0x63')](-0x1);if(_0x473d09==='/'){_0x4b3d73=_0x4b3d73[_0x0275('0x64')](0x0,_0x4b3d73[_0x0275('0x65')](_0x473d09));}return rp({'method':_0x0275('0x66'),'uri':util[_0x0275('0x67')](_0x0275('0x68'),_0x4b3d73,_0x0275('0x69')),'headers':{'Authorization':'Token\x20token='+_0x11e17f[_0x0275('0x62')]},'json':!![]});}})[_0x0275('0x30')](function(_0x8c891a){if(_0x8c891a){var _0x1a9540=_0x8c891a[_0x0275('0x6a')];var _0x60d12f=![];var _0x5c1c96=null;for(_0x5c1c96=0x0;_0x5c1c96<_0x1a9540[_0x0275('0x40')];_0x5c1c96++){if(_0x1a9540[_0x5c1c96][_0x0275('0x6b')]===_0x158000){_0x60d12f=!![];}}if(_0x60d12f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x0275('0x30')](respondWithResult(_0x4820b0,null))[_0x0275('0x25')](function(_0x236039){var _0x17d994=_0x55d769['query'][_0x0275('0x6c')]?0x1f4:_0x236039[_0x0275('0x6d')]||0x1f4;logger['error'](_0x0275('0x6e'),'getFields',_0x17d994,JSON[_0x0275('0x6f')](_0x236039));delete _0x236039[_0x0275('0x31')];if(_0x17d994===0x191){_0x17d994=0x190;}_0x4820b0['status'](_0x17d994)[_0x0275('0x32')](_0x55d769[_0x0275('0x3a')][_0x0275('0x6c')]?{'message':_0x0275('0x70'),'statusCode':_0x236039[_0x0275('0x6d')]}:_0x236039);});}; \ No newline at end of file +var _0x99e9=['set','Content-Range','apply','reject','save','update','then','destroy','stack','index','rawAttributes','fieldName','name','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','map','type','VIRTUAL','count','includeAll','include','FreshsalesAccount','rows','options','catch','create','body','find','params','findOne','order','merge','getConfigurations','nolimit','AccountId','Subjects','getSubjects','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','lastIndexOf','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','limit'];(function(_0x4816a9,_0x24a58c){var _0x5bede9=function(_0xf14c91){while(--_0xf14c91){_0x4816a9['push'](_0x4816a9['shift']());}};_0x5bede9(++_0x24a58c);}(_0x99e9,0xb4));var _0x999e=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0x99e9[_0x388914];return _0x1f9111;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require(_0x999e('0x3'));var rp=require('request-promise');var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require(_0x999e('0x6'));var util=require('util');var path=require(_0x999e('0x7'));var sox=require('sox');var csv=require(_0x999e('0x8'));var ejs=require(_0x999e('0x9'));var fs=require('fs');var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0x8'));var querystring=require(_0x999e('0xe'));var Papa=require(_0x999e('0xf'));var Redis=require(_0x999e('0x10'));var authService=require(_0x999e('0x11'));var qs=require(_0x999e('0x12'));var as=require(_0x999e('0x13'));var hardwareService=require(_0x999e('0x14'));var logger=require(_0x999e('0x15'))(_0x999e('0x16'));var utils=require(_0x999e('0x17'));var config=require(_0x999e('0x18'));var licenseUtil=require(_0x999e('0x19'));var db=require(_0x999e('0x1a'))['db'];var integrations=require(_0x999e('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e6f5a,_0x387924,_0x2fbc3e,_0x538a92){return new BPromise(function(_0x28bdd1,_0x4d1716){var _0xa44e4c=_0x538a92||client;return _0xa44e4c['request'](_0x3e6f5a,_0x2fbc3e)['then'](function(_0x1eee64){logger[_0x999e('0x1d')](_0x999e('0x1e'),_0x387924,_0x999e('0x1f'));logger[_0x999e('0x20')](_0x999e('0x21'),_0x387924,'request\x20sent',JSON['stringify'](_0x1eee64));if(_0x1eee64['error']){if(_0x1eee64[_0x999e('0x22')][_0x999e('0x23')]===0x1f4){logger[_0x999e('0x22')](_0x999e('0x1e'),_0x387924,_0x1eee64[_0x999e('0x22')][_0x999e('0x24')]);return _0x4d1716(_0x1eee64['error']['message']);}logger[_0x999e('0x22')](_0x999e('0x1e'),_0x387924,_0x1eee64[_0x999e('0x22')]['message']);return _0x28bdd1(_0x1eee64[_0x999e('0x22')][_0x999e('0x24')]);}else{logger[_0x999e('0x1d')](_0x999e('0x1e'),_0x387924,_0x999e('0x1f'));_0x28bdd1(_0x1eee64[_0x999e('0x25')][_0x999e('0x24')]);}})['catch'](function(_0x54ad83){logger[_0x999e('0x22')](_0x999e('0x1e'),_0x387924,_0x54ad83);_0x4d1716(_0x54ad83);});});}function respondWithStatusCode(_0x4c5491,_0x452acd){_0x452acd=_0x452acd||0xcc;return function(_0xe324d8){if(_0xe324d8){return _0x4c5491[_0x999e('0x26')](_0x452acd);}return _0x4c5491[_0x999e('0x27')](_0x452acd)[_0x999e('0x28')]();};}function respondWithResult(_0x320634,_0x4f8406){_0x4f8406=_0x4f8406||0xc8;return function(_0x2e1cc5){if(_0x2e1cc5){return _0x320634[_0x999e('0x27')](_0x4f8406)[_0x999e('0x29')](_0x2e1cc5);}};}function respondWithFilteredResult(_0x12b9ad,_0x1b7adb){return function(_0x1d2dc6){if(_0x1d2dc6){var _0x44b790=_0x1d2dc6['count'],_0x5798f3=_0x1b7adb[_0x999e('0x2a')],_0x28f803=_0x1b7adb[_0x999e('0x2a')]+_0x1b7adb[_0x999e('0x2b')],_0x5ba8b0;if(_0x28f803>=_0x44b790){_0x28f803=_0x44b790;_0x5ba8b0=0xc8;}else{_0x5ba8b0=0xce;}_0x12b9ad['status'](_0x5ba8b0);return _0x12b9ad[_0x999e('0x2c')](_0x999e('0x2d'),_0x5798f3+'-'+_0x28f803+'/'+_0x44b790)[_0x999e('0x29')](_0x1d2dc6);}return null;};}function patchUpdates(_0x4339bf){return function(_0x15dca1){try{jsonpatch[_0x999e('0x2e')](_0x15dca1,_0x4339bf,!![]);}catch(_0x82e067){return BPromise[_0x999e('0x2f')](_0x82e067);}return _0x15dca1[_0x999e('0x30')]();};}function saveUpdates(_0x3ddacb,_0x53ece1){return function(_0x1c8feb){if(_0x1c8feb){return _0x1c8feb[_0x999e('0x31')](_0x3ddacb)[_0x999e('0x32')](function(_0x4c2ce8){return _0x4c2ce8;});}return null;};}function removeEntity(_0x2ca5b8,_0x5af72c){return function(_0x5dce40){if(_0x5dce40){return _0x5dce40[_0x999e('0x33')]()[_0x999e('0x32')](function(){_0x2ca5b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5def61,_0x12eb93){return function(_0x10a17d){if(!_0x10a17d){_0x5def61[_0x999e('0x26')](0x194);}return _0x10a17d;};}function handleError(_0x59baab,_0x2724be){_0x2724be=_0x2724be||0x1f4;return function(_0x41d6f1){logger[_0x999e('0x22')](_0x41d6f1[_0x999e('0x34')]);if(_0x41d6f1['name']){delete _0x41d6f1['name'];}_0x59baab[_0x999e('0x27')](_0x2724be)['send'](_0x41d6f1);};}exports[_0x999e('0x35')]=function(_0x2fda68,_0x69e059){var _0x14c9e0={},_0x5ad3f1={},_0xebda67={'count':0x0,'rows':[]};var _0x28df26=_['map'](db['FreshsalesAccount'][_0x999e('0x36')],function(_0x4aa98c){return{'name':_0x4aa98c[_0x999e('0x37')],'type':_0x4aa98c['type']['key']};});_0x5ad3f1['model']=_['map'](_0x28df26,_0x999e('0x38'));_0x5ad3f1['query']=_[_0x999e('0x39')](_0x2fda68['query']);_0x5ad3f1['filters']=_['intersection'](_0x5ad3f1[_0x999e('0x3a')],_0x5ad3f1[_0x999e('0x3b')]);_0x14c9e0[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x5ad3f1[_0x999e('0x3a')],qs[_0x999e('0x3e')](_0x2fda68[_0x999e('0x3b')][_0x999e('0x3e')]));_0x14c9e0['attributes']=_0x14c9e0[_0x999e('0x3c')][_0x999e('0x3f')]?_0x14c9e0[_0x999e('0x3c')]:_0x5ad3f1[_0x999e('0x3a')];if(!_0x2fda68['query'][_0x999e('0x40')]('nolimit')){_0x14c9e0[_0x999e('0x2b')]=qs[_0x999e('0x2b')](_0x2fda68[_0x999e('0x3b')][_0x999e('0x2b')]);_0x14c9e0['offset']=qs[_0x999e('0x2a')](_0x2fda68[_0x999e('0x3b')][_0x999e('0x2a')]);}_0x14c9e0['order']=qs['sort'](_0x2fda68[_0x999e('0x3b')][_0x999e('0x41')]);_0x14c9e0[_0x999e('0x42')]=qs[_0x999e('0x43')](_[_0x999e('0x44')](_0x2fda68[_0x999e('0x3b')],_0x5ad3f1[_0x999e('0x43')]),_0x28df26);if(_0x2fda68[_0x999e('0x3b')][_0x999e('0x45')]){_0x14c9e0[_0x999e('0x42')]=_['merge'](_0x14c9e0['where'],{'$or':_[_0x999e('0x46')](_0x28df26,function(_0x30a60d){if(_0x30a60d[_0x999e('0x47')]!==_0x999e('0x48')){var _0x206991={};_0x206991[_0x30a60d[_0x999e('0x38')]]={'$like':'%'+_0x2fda68['query'][_0x999e('0x45')]+'%'};return _0x206991;}})});}_0x14c9e0=_['merge']({},_0x14c9e0,_0x2fda68['options']);var _0x88b11e={'where':_0x14c9e0['where']};return db['FreshsalesAccount']['count'](_0x88b11e)['then'](function(_0xc89b1){_0xebda67[_0x999e('0x49')]=_0xc89b1;if(_0x2fda68['query'][_0x999e('0x4a')]){_0x14c9e0[_0x999e('0x4b')]=[{'all':!![]}];}return db[_0x999e('0x4c')]['findAll'](_0x14c9e0);})['then'](function(_0x415d4f){_0xebda67[_0x999e('0x4d')]=_0x415d4f;return _0xebda67;})[_0x999e('0x32')](respondWithFilteredResult(_0x69e059,_0x14c9e0))['catch'](handleError(_0x69e059,null));};exports['show']=function(_0x4d0358,_0x5ee14d){var _0x8f1afa={'raw':![],'where':{'id':_0x4d0358['params']['id']}},_0x56a064={};_0x56a064[_0x999e('0x3a')]=_[_0x999e('0x39')](db['FreshsalesAccount'][_0x999e('0x36')]);_0x56a064[_0x999e('0x3b')]=_['keys'](_0x4d0358[_0x999e('0x3b')]);_0x56a064['filters']=_[_0x999e('0x3d')](_0x56a064[_0x999e('0x3a')],_0x56a064['query']);_0x8f1afa[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x56a064['model'],qs['fields'](_0x4d0358[_0x999e('0x3b')]['fields']));_0x8f1afa['attributes']=_0x8f1afa['attributes'][_0x999e('0x3f')]?_0x8f1afa[_0x999e('0x3c')]:_0x56a064[_0x999e('0x3a')];if(_0x4d0358[_0x999e('0x3b')][_0x999e('0x4a')]){_0x8f1afa[_0x999e('0x4b')]=[{'all':!![]}];}_0x8f1afa=_['merge']({},_0x8f1afa,_0x4d0358[_0x999e('0x4e')]);return db[_0x999e('0x4c')]['find'](_0x8f1afa)[_0x999e('0x32')](handleEntityNotFound(_0x5ee14d,null))[_0x999e('0x32')](respondWithResult(_0x5ee14d,null))[_0x999e('0x4f')](handleError(_0x5ee14d,null));};exports[_0x999e('0x50')]=function(_0x5e4890,_0x334d19){return db[_0x999e('0x4c')][_0x999e('0x50')](_0x5e4890[_0x999e('0x51')],{})['then'](respondWithResult(_0x334d19,0xc9))[_0x999e('0x4f')](handleError(_0x334d19,null));};exports[_0x999e('0x31')]=function(_0x39ae4b,_0x71df6c){if(_0x39ae4b['body']['id']){delete _0x39ae4b[_0x999e('0x51')]['id'];}return db[_0x999e('0x4c')][_0x999e('0x52')]({'where':{'id':_0x39ae4b[_0x999e('0x53')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x71df6c,null))[_0x999e('0x32')](saveUpdates(_0x39ae4b[_0x999e('0x51')],null))[_0x999e('0x32')](respondWithResult(_0x71df6c,null))['catch'](handleError(_0x71df6c,null));};exports['destroy']=function(_0xd118f9,_0x297b0e){return db[_0x999e('0x4c')][_0x999e('0x52')]({'where':{'id':_0xd118f9[_0x999e('0x53')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x297b0e,null))[_0x999e('0x32')](removeEntity(_0x297b0e,null))['catch'](handleError(_0x297b0e,null));};exports['getConfigurations']=function(_0xb9d60b,_0x55ae5,_0x36c3dc){var _0x3e9531={};var _0x25176f={};var _0x51b329;var _0x10f82f;return db[_0x999e('0x4c')][_0x999e('0x54')]({'where':{'id':_0xb9d60b[_0x999e('0x53')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x55ae5,null))[_0x999e('0x32')](function(_0x2b4bbe){if(_0x2b4bbe){_0x51b329=_0x2b4bbe;_0x25176f['model']=_[_0x999e('0x39')](db['FreshsalesConfiguration'][_0x999e('0x36')]);_0x25176f[_0x999e('0x3b')]=_[_0x999e('0x39')](_0xb9d60b[_0x999e('0x3b')]);_0x25176f[_0x999e('0x43')]=_[_0x999e('0x3d')](_0x25176f['model'],_0x25176f[_0x999e('0x3b')]);_0x3e9531[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x25176f[_0x999e('0x3a')],qs[_0x999e('0x3e')](_0xb9d60b[_0x999e('0x3b')][_0x999e('0x3e')]));_0x3e9531[_0x999e('0x3c')]=_0x3e9531[_0x999e('0x3c')][_0x999e('0x3f')]?_0x3e9531[_0x999e('0x3c')]:_0x25176f[_0x999e('0x3a')];_0x3e9531[_0x999e('0x55')]=qs[_0x999e('0x41')](_0xb9d60b[_0x999e('0x3b')]['sort']);_0x3e9531[_0x999e('0x42')]=qs[_0x999e('0x43')](_[_0x999e('0x44')](_0xb9d60b[_0x999e('0x3b')],_0x25176f['filters']));if(_0xb9d60b['query'][_0x999e('0x45')]){_0x3e9531[_0x999e('0x42')]=_[_0x999e('0x56')](_0x3e9531[_0x999e('0x42')],{'$or':_[_0x999e('0x46')](_0x3e9531[_0x999e('0x3c')],function(_0x1596bb){var _0x3e75a3={};_0x3e75a3[_0x1596bb]={'$like':'%'+_0xb9d60b[_0x999e('0x3b')]['filter']+'%'};return _0x3e75a3;})});}_0x3e9531=_[_0x999e('0x56')]({},_0x3e9531,_0xb9d60b['options']);return _0x51b329[_0x999e('0x57')](_0x3e9531);}})[_0x999e('0x32')](function(_0x4941e0){if(_0x4941e0){_0x10f82f=_0x4941e0[_0x999e('0x3f')];if(!_0xb9d60b[_0x999e('0x3b')][_0x999e('0x40')](_0x999e('0x58'))){_0x3e9531[_0x999e('0x2b')]=qs['limit'](_0xb9d60b[_0x999e('0x3b')][_0x999e('0x2b')]);_0x3e9531['offset']=qs['offset'](_0xb9d60b['query'][_0x999e('0x2a')]);}return _0x51b329[_0x999e('0x57')](_0x3e9531);}})[_0x999e('0x32')](function(_0x378f60){if(_0x378f60){return _0x378f60?{'count':_0x10f82f,'rows':_0x378f60}:null;}})[_0x999e('0x32')](respondWithResult(_0x55ae5,null))['catch'](handleError(_0x55ae5,null));};exports['addConfiguration']=function(_0x4e229e,_0x49293d,_0x513580){if(_0x4e229e['body']['id']){delete _0x4e229e[_0x999e('0x51')]['id'];}return db['FreshsalesAccount'][_0x999e('0x54')]({'where':{'id':_0x4e229e[_0x999e('0x53')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x49293d,null))['then'](function(_0x3ca455){if(_0x3ca455){_0x4e229e[_0x999e('0x51')][_0x999e('0x59')]=_0x3ca455['id'];_0x4e229e[_0x999e('0x51')][_0x999e('0x5a')]=integrations[_0x999e('0x5b')](_0x4e229e[_0x999e('0x51')]['channel'],_0x4e229e[_0x999e('0x51')][_0x999e('0x47')]);_0x4e229e[_0x999e('0x51')]['Descriptions']=integrations[_0x999e('0x5c')](_0x4e229e[_0x999e('0x51')]['channel'],_0x4e229e[_0x999e('0x51')][_0x999e('0x47')]);return db[_0x999e('0x5d')][_0x999e('0x50')](_0x4e229e[_0x999e('0x51')],{'include':[{'model':db[_0x999e('0x5e')],'as':_0x999e('0x5a')},{'model':db[_0x999e('0x5e')],'as':_0x999e('0x5f')}]});}return null;})['then'](respondWithResult(_0x49293d,null))[_0x999e('0x4f')](handleError(_0x49293d,null));};exports[_0x999e('0x60')]=function(_0x3ec467,_0x58a51e,_0x46365a){var _0x48e0ca='';var _0x14f13a='';return db[_0x999e('0x4c')][_0x999e('0x54')]({'where':{'id':_0x3ec467['params']['id']},'attributes':['id',_0x999e('0x61'),_0x999e('0x62'),_0x999e('0x63')]})[_0x999e('0x32')](handleEntityNotFound(_0x58a51e,null))[_0x999e('0x32')](function(_0x1900d3){if(_0x1900d3){_0x14f13a=_0x1900d3['username'];_0x48e0ca=_0x1900d3[_0x999e('0x62')];var _0x498e70=_0x1900d3[_0x999e('0x62')]['slice'](-0x1);if(_0x498e70==='/'){_0x48e0ca=_0x48e0ca['substring'](0x0,_0x48e0ca[_0x999e('0x64')](_0x498e70));}return rp({'method':'GET','uri':util[_0x999e('0x65')](_0x999e('0x66'),_0x48e0ca,'/api/selector/owners'),'headers':{'Authorization':_0x999e('0x67')+_0x1900d3[_0x999e('0x63')]},'json':!![]});}})['then'](function(_0x2a4d85){if(_0x2a4d85){var _0x6492cc=_0x2a4d85[_0x999e('0x68')];var _0x224242=![];var _0x382c65=null;for(_0x382c65=0x0;_0x382c65<_0x6492cc[_0x999e('0x3f')];_0x382c65++){if(_0x6492cc[_0x382c65][_0x999e('0x69')]===_0x14f13a){_0x224242=!![];}}if(_0x224242){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x999e('0x6a')});}}})['then'](respondWithResult(_0x58a51e,null))['catch'](function(_0x34541f){var _0x20da28=_0x3ec467[_0x999e('0x3b')][_0x999e('0x6b')]?0x1f4:_0x34541f[_0x999e('0x6c')]||0x1f4;logger[_0x999e('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x999e('0x60'),_0x20da28,JSON[_0x999e('0x6d')](_0x34541f));delete _0x34541f['name'];if(_0x20da28===0x191){_0x20da28=0x190;}_0x58a51e[_0x999e('0x27')](_0x20da28)[_0x999e('0x6e')](_0x3ec467[_0x999e('0x3b')]['test']?{'message':_0x999e('0x6f'),'statusCode':_0x34541f[_0x999e('0x6c')]}:_0x34541f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 42fc36e..078a227 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 _0x4366=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4366,0xa9));var _0x6436=function(_0x27651f,_0x490a89){_0x27651f=_0x27651f-0x0;var _0x35fc81=_0x4366[_0x27651f];return _0x35fc81;};'use strict';var _=require(_0x6436('0x0'));var util=require(_0x6436('0x1'));var logger=require(_0x6436('0x2'))(_0x6436('0x3'));var moment=require(_0x6436('0x4'));var BPromise=require('bluebird');var rp=require(_0x6436('0x5'));var fs=require('fs');var path=require(_0x6436('0x6'));var rimraf=require(_0x6436('0x7'));var config=require(_0x6436('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6436('0x9'));module[_0x6436('0xa')]=function(_0x34b664,_0x1075a9){return _0x34b664[_0x6436('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x6436('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9540=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x15b824,_0x2ee9c1){var _0x424d0b=function(_0xd3bba9){while(--_0xd3bba9){_0x15b824['push'](_0x15b824['shift']());}};_0x424d0b(++_0x2ee9c1);}(_0x9540,0xdb));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0954('0x0'));var util=require(_0x0954('0x1'));var logger=require(_0x0954('0x2'))(_0x0954('0x3'));var moment=require('moment');var BPromise=require(_0x0954('0x4'));var rp=require(_0x0954('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0954('0x6'));var config=require(_0x0954('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0954('0x8'));module[_0x0954('0x9')]=function(_0x5be3f7,_0x1970a5){return _0x5be3f7[_0x0954('0xa')](_0x0954('0xb'),attributes,{'tableName':_0x0954('0xc'),'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 297a031..b13738e 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 _0x9ab9=['message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowFreshsalesAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x61e635,_0x16f4df){var _0x13e7c4=function(_0x465f33){while(--_0x465f33){_0x61e635['push'](_0x61e635['shift']());}};_0x13e7c4(++_0x16f4df);}(_0x9ab9,0x19d));var _0x99ab=function(_0x118cef,_0x510928){_0x118cef=_0x118cef-0x0;var _0x29c71f=_0x9ab9[_0x118cef];return _0x29c71f;};'use strict';var _=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var moment=require(_0x99ab('0x2'));var BPromise=require(_0x99ab('0x3'));var rs=require(_0x99ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99ab('0x5'))['db'];var utils=require(_0x99ab('0x6'));var logger=require('../../config/logger')(_0x99ab('0x7'));var config=require('../../config/environment');var jayson=require(_0x99ab('0x8'));var client=jayson[_0x99ab('0x9')][_0x99ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249c1f,_0x1d2cb7,_0x513653){return new BPromise(function(_0x5762c1,_0x3f5a2c){return client[_0x99ab('0xb')](_0x249c1f,_0x513653)['then'](function(_0x14d083){logger[_0x99ab('0xc')](_0x99ab('0xd'),_0x1d2cb7,_0x99ab('0xe'));logger[_0x99ab('0xf')](_0x99ab('0x10'),_0x1d2cb7,'request\x20sent',JSON[_0x99ab('0x11')](_0x14d083));if(_0x14d083[_0x99ab('0x12')]){if(_0x14d083[_0x99ab('0x12')]['code']===0x1f4){logger['error'](_0x99ab('0xd'),_0x1d2cb7,_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);return _0x3f5a2c(_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);}logger[_0x99ab('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d2cb7,_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);return _0x5762c1(_0x14d083['error'][_0x99ab('0x13')]);}else{logger[_0x99ab('0xc')](_0x99ab('0xd'),_0x1d2cb7,'request\x20sent');_0x5762c1(_0x14d083[_0x99ab('0x14')][_0x99ab('0x13')]);}})[_0x99ab('0x15')](function(_0x31b340){logger[_0x99ab('0x12')](_0x99ab('0xd'),_0x1d2cb7,_0x31b340);_0x3f5a2c(_0x31b340);});});}exports[_0x99ab('0x16')]=function(_0x2c24c9){var _0x478b37=this;return new Promise(function(_0x14a515,_0x368b52){return db[_0x99ab('0x17')][_0x99ab('0x18')]({'raw':_0x2c24c9[_0x99ab('0x19')]?_0x2c24c9[_0x99ab('0x19')][_0x99ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c24c9[_0x99ab('0x19')]?_0x2c24c9[_0x99ab('0x19')]['where']||null:null,'attributes':_0x2c24c9['options']?_0x2c24c9[_0x99ab('0x19')][_0x99ab('0x1b')]||null:null,'limit':_0x2c24c9[_0x99ab('0x19')]?_0x2c24c9['options'][_0x99ab('0x1c')]||null:null,'include':_0x2c24c9[_0x99ab('0x19')]?_0x2c24c9[_0x99ab('0x19')][_0x99ab('0x1d')]?_[_0x99ab('0x1e')](_0x2c24c9[_0x99ab('0x19')][_0x99ab('0x1d')],function(_0x5411a6){return{'model':db[_0x5411a6[_0x99ab('0x1f')]],'as':_0x5411a6['as'],'attributes':_0x5411a6['attributes'],'include':_0x5411a6[_0x99ab('0x1d')]?_['map'](_0x5411a6['include'],function(_0x2d3281){return{'model':db[_0x2d3281[_0x99ab('0x1f')]],'as':_0x2d3281['as'],'attributes':_0x2d3281[_0x99ab('0x1b')],'include':_0x2d3281['include']?_[_0x99ab('0x1e')](_0x2d3281[_0x99ab('0x1d')],function(_0x447ef0){return{'model':db[_0x447ef0[_0x99ab('0x1f')]],'as':_0x447ef0['as'],'attributes':_0x447ef0[_0x99ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x99ab('0x20')](function(_0x970ce7){logger[_0x99ab('0xc')](_0x99ab('0x16'),_0x2c24c9);logger['debug'](_0x99ab('0x16'),_0x2c24c9,JSON[_0x99ab('0x11')](_0x970ce7));_0x14a515(_0x970ce7);})['catch'](function(_0x35d09e){logger[_0x99ab('0x12')](_0x99ab('0x16'),_0x35d09e['message'],_0x2c24c9);_0x368b52(_0x478b37['error'](0x1f4,_0x35d09e[_0x99ab('0x13')]));});});};exports[_0x99ab('0x21')]=function(_0x1aeca3){var _0x3efd67=this;return new Promise(function(_0x16b405,_0x36c0f1){return db[_0x99ab('0x17')][_0x99ab('0x22')]({'raw':_0x1aeca3['options']?_0x1aeca3[_0x99ab('0x19')][_0x99ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x1aeca3['options']?_0x1aeca3[_0x99ab('0x19')][_0x99ab('0x23')]||null:null,'attributes':_0x1aeca3['options']?_0x1aeca3['options'][_0x99ab('0x1b')]||null:null,'include':_0x1aeca3[_0x99ab('0x19')]?_0x1aeca3[_0x99ab('0x19')]['include']?_['map'](_0x1aeca3['options']['include'],function(_0x5507b6){return{'model':db[_0x5507b6['model']],'as':_0x5507b6['as'],'attributes':_0x5507b6[_0x99ab('0x1b')],'include':_0x5507b6[_0x99ab('0x1d')]?_[_0x99ab('0x1e')](_0x5507b6['include'],function(_0xb32f1e){return{'model':db[_0xb32f1e[_0x99ab('0x1f')]],'as':_0xb32f1e['as'],'attributes':_0xb32f1e[_0x99ab('0x1b')],'include':_0xb32f1e['include']?_[_0x99ab('0x1e')](_0xb32f1e[_0x99ab('0x1d')],function(_0x338e88){return{'model':db[_0x338e88[_0x99ab('0x1f')]],'as':_0x338e88['as'],'attributes':_0x338e88[_0x99ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x99ab('0x20')](function(_0x334ae7){logger['info']('ShowFreshsalesAccount',_0x1aeca3);logger[_0x99ab('0xf')](_0x99ab('0x21'),_0x1aeca3,JSON['stringify'](_0x334ae7));_0x16b405(_0x334ae7);})[_0x99ab('0x15')](function(_0x41a54d){logger[_0x99ab('0x12')]('ShowFreshsalesAccount',_0x41a54d[_0x99ab('0x13')],_0x1aeca3);_0x36c0f1(_0x3efd67[_0x99ab('0x12')](0x1f4,_0x41a54d[_0x99ab('0x13')]));});});}; \ No newline at end of file +var _0x94d4=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','model','map','attributes','then','stringify','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0x1ff6ed,_0x5903d2){var _0x287a2c=function(_0x5dba59){while(--_0x5dba59){_0x1ff6ed['push'](_0x1ff6ed['shift']());}};_0x287a2c(++_0x5903d2);}(_0x94d4,0xa5));var _0x494d=function(_0x3b09ed,_0x132388){_0x3b09ed=_0x3b09ed-0x0;var _0x4c8afb=_0x94d4[_0x3b09ed];return _0x4c8afb;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});}exports[_0x494d('0x15')]=function(_0x4301fc){var _0x1552bb=this;return new Promise(function(_0x12a484,_0xd67ea4){return db[_0x494d('0x16')][_0x494d('0x17')]({'raw':_0x4301fc[_0x494d('0x18')]?_0x4301fc[_0x494d('0x18')][_0x494d('0x19')]===undefined?!![]:![]:!![],'where':_0x4301fc['options']?_0x4301fc[_0x494d('0x18')][_0x494d('0x1a')]||null:null,'attributes':_0x4301fc[_0x494d('0x18')]?_0x4301fc[_0x494d('0x18')]['attributes']||null:null,'limit':_0x4301fc['options']?_0x4301fc[_0x494d('0x18')][_0x494d('0x1b')]||null:null,'include':_0x4301fc['options']?_0x4301fc['options'][_0x494d('0x1c')]?_['map'](_0x4301fc[_0x494d('0x18')]['include'],function(_0x2be6f0){return{'model':db[_0x2be6f0[_0x494d('0x1d')]],'as':_0x2be6f0['as'],'attributes':_0x2be6f0['attributes'],'include':_0x2be6f0[_0x494d('0x1c')]?_[_0x494d('0x1e')](_0x2be6f0[_0x494d('0x1c')],function(_0x2ab88b){return{'model':db[_0x2ab88b[_0x494d('0x1d')]],'as':_0x2ab88b['as'],'attributes':_0x2ab88b['attributes'],'include':_0x2ab88b[_0x494d('0x1c')]?_[_0x494d('0x1e')](_0x2ab88b['include'],function(_0x5d8d88){return{'model':db[_0x5d8d88[_0x494d('0x1d')]],'as':_0x5d8d88['as'],'attributes':_0x5d8d88[_0x494d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x494d('0x20')](function(_0x2c025d){logger[_0x494d('0xc')](_0x494d('0x15'),_0x4301fc);logger[_0x494d('0xe')](_0x494d('0x15'),_0x4301fc,JSON[_0x494d('0x21')](_0x2c025d));_0x12a484(_0x2c025d);})[_0x494d('0x14')](function(_0x1a8d4b){logger[_0x494d('0x10')](_0x494d('0x15'),_0x1a8d4b['message'],_0x4301fc);_0xd67ea4(_0x1552bb[_0x494d('0x10')](0x1f4,_0x1a8d4b[_0x494d('0x11')]));});});};exports[_0x494d('0x22')]=function(_0x18dfae){var _0x2636ce=this;return new Promise(function(_0x25328a,_0x29ccfd){return db[_0x494d('0x16')][_0x494d('0x23')]({'raw':_0x18dfae[_0x494d('0x18')]?_0x18dfae['options'][_0x494d('0x19')]===undefined?!![]:![]:!![],'where':_0x18dfae[_0x494d('0x18')]?_0x18dfae['options'][_0x494d('0x1a')]||null:null,'attributes':_0x18dfae[_0x494d('0x18')]?_0x18dfae['options']['attributes']||null:null,'include':_0x18dfae[_0x494d('0x18')]?_0x18dfae['options'][_0x494d('0x1c')]?_[_0x494d('0x1e')](_0x18dfae[_0x494d('0x18')][_0x494d('0x1c')],function(_0x5db6cd){return{'model':db[_0x5db6cd['model']],'as':_0x5db6cd['as'],'attributes':_0x5db6cd[_0x494d('0x1f')],'include':_0x5db6cd[_0x494d('0x1c')]?_[_0x494d('0x1e')](_0x5db6cd['include'],function(_0x599ae5){return{'model':db[_0x599ae5[_0x494d('0x1d')]],'as':_0x599ae5['as'],'attributes':_0x599ae5[_0x494d('0x1f')],'include':_0x599ae5['include']?_[_0x494d('0x1e')](_0x599ae5[_0x494d('0x1c')],function(_0x14814d){return{'model':db[_0x14814d['model']],'as':_0x14814d['as'],'attributes':_0x14814d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x437636){logger['info']('ShowFreshsalesAccount',_0x18dfae);logger[_0x494d('0xe')](_0x494d('0x22'),_0x18dfae,JSON[_0x494d('0x21')](_0x437636));_0x25328a(_0x437636);})[_0x494d('0x14')](function(_0x2080ef){logger['error'](_0x494d('0x22'),_0x2080ef[_0x494d('0x11')],_0x18dfae);_0x29ccfd(_0x2636ce[_0x494d('0x10')](0x1f4,_0x2080ef[_0x494d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a0ae820..4e0a9af 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 _0x6eb7=['getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','/:id','update','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','show','/:id/subjects','isAuthenticated'];(function(_0x14e9c7,_0x2e5f38){var _0x100736=function(_0x3c8e9c){while(--_0x3c8e9c){_0x14e9c7['push'](_0x14e9c7['shift']());}};_0x100736(++_0x2e5f38);}(_0x6eb7,0x86));var _0x76eb=function(_0x21c9bc,_0x4ca121){_0x21c9bc=_0x21c9bc-0x0;var _0x3a9411=_0x6eb7[_0x21c9bc];return _0x3a9411;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x76eb('0x0'));var express=require(_0x76eb('0x1'));var router=express[_0x76eb('0x2')]();var auth=require(_0x76eb('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x76eb('0x4'));router[_0x76eb('0x5')]('/',auth['isAuthenticated'](),controller[_0x76eb('0x6')]);router[_0x76eb('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x76eb('0x7')]);router[_0x76eb('0x5')](_0x76eb('0x8'),auth[_0x76eb('0x9')](),controller[_0x76eb('0xa')]);router['get'](_0x76eb('0xb'),auth[_0x76eb('0x9')](),controller[_0x76eb('0xc')]);router[_0x76eb('0x5')]('/:id/fields',auth[_0x76eb('0x9')](),controller[_0x76eb('0xd')]);router[_0x76eb('0xe')]('/',auth[_0x76eb('0x9')](),controller[_0x76eb('0xf')]);router['put'](_0x76eb('0x10'),auth[_0x76eb('0x9')](),controller[_0x76eb('0x11')]);router['delete'](_0x76eb('0x10'),auth[_0x76eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x401a=['../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x307699,_0x7c8bc6){var _0x2a144f=function(_0x4ef81f){while(--_0x4ef81f){_0x307699['push'](_0x307699['shift']());}};_0x2a144f(++_0x7c8bc6);}(_0x401a,0x83));var _0xa401=function(_0x3f9feb,_0x9201c1){_0x3f9feb=_0x3f9feb-0x0;var _0x1ba3f6=_0x401a[_0x3f9feb];return _0x1ba3f6;};'use strict';var multer=require('multer');var util=require(_0xa401('0x0'));var path=require(_0xa401('0x1'));var timeout=require(_0xa401('0x2'));var express=require(_0xa401('0x3'));var router=express[_0xa401('0x4')]();var auth=require(_0xa401('0x5'));var interaction=require(_0xa401('0x6'));var config=require(_0xa401('0x7'));var controller=require(_0xa401('0x8'));router['get']('/',auth[_0xa401('0x9')](),controller[_0xa401('0xa')]);router[_0xa401('0xb')](_0xa401('0xc'),auth[_0xa401('0x9')](),controller[_0xa401('0xd')]);router[_0xa401('0xb')](_0xa401('0xe'),auth[_0xa401('0x9')](),controller[_0xa401('0xf')]);router[_0xa401('0xb')](_0xa401('0x10'),auth[_0xa401('0x9')](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0xa401('0x9')](),controller['getFields']);router[_0xa401('0x11')]('/',auth[_0xa401('0x9')](),controller[_0xa401('0x12')]);router[_0xa401('0x13')](_0xa401('0xc'),auth[_0xa401('0x9')](),controller[_0xa401('0x14')]);router['delete'](_0xa401('0xc'),auth[_0xa401('0x9')](),controller[_0xa401('0x15')]);module[_0xa401('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 edfbab3..a688135 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 _0x9475=['STRING','exports'];(function(_0x4756a1,_0x3f8d1){var _0x177c4f=function(_0xddb5e2){while(--_0xddb5e2){_0x4756a1['push'](_0x4756a1['shift']());}};_0x177c4f(++_0x3f8d1);}(_0x9475,0x12f));var _0x5947=function(_0x524d11,_0x29612f){_0x524d11=_0x524d11-0x0;var _0x1c4ad3=_0x9475[_0x524d11];return _0x1c4ad3;};'use strict';var Sequelize=require('sequelize');module[_0x5947('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5947('0x1')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8252521..41056dc 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x3eab3a,_0x89a286){var _0x47ea45=function(_0x156cb9){while(--_0x156cb9){_0x3eab3a['push'](_0x3eab3a['shift']());}};_0x47ea45(++_0x89a286);}(_0x53ec,0x192));var _0xc53e=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x53ec[_0x38841c];return _0x500610;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file +var _0xabce=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','json','offset','set','Content-Range','apply','reject','update','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','limit','order','pick','filters','where','VIRTUAL','merge','options','FreshsalesConfiguration','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','getSubjects','findOne','sort','filter','getDescriptions','FreshsalesField','hasOwnProperty','nolimit','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xabce,0x103));var _0xeabc=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xabce[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53df9c,_0x235c2d,_0x1319f3,_0x3251c6){return new BPromise(function(_0x55f0de,_0x5f4ee8){var _0x3170ea=_0x3251c6||client;return _0x3170ea[_0xeabc('0x1d')](_0x53df9c,_0x1319f3)[_0xeabc('0x1e')](function(_0x53d5cb){logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,'request\x20sent');logger['debug'](_0xeabc('0x21'),_0x235c2d,'request\x20sent',JSON[_0xeabc('0x22')](_0x53d5cb));if(_0x53d5cb[_0xeabc('0x23')]){if(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x24')]===0x1f4){logger[_0xeabc('0x23')](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);return _0x5f4ee8(_0x53d5cb['error'][_0xeabc('0x25')]);}logger['error'](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')]['message']);return _0x55f0de(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);}else{logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,_0xeabc('0x26'));_0x55f0de(_0x53d5cb['result'][_0xeabc('0x25')]);}})[_0xeabc('0x27')](function(_0x91ab00){logger['error'](_0xeabc('0x20'),_0x235c2d,_0x91ab00);_0x5f4ee8(_0x91ab00);});});}function respondWithStatusCode(_0x3854d2,_0x214953){_0x214953=_0x214953||0xcc;return function(_0x319119){if(_0x319119){return _0x3854d2['sendStatus'](_0x214953);}return _0x3854d2[_0xeabc('0x28')](_0x214953)['end']();};}function respondWithResult(_0x27dbaf,_0x4d4e29){_0x4d4e29=_0x4d4e29||0xc8;return function(_0x811f0d){if(_0x811f0d){return _0x27dbaf[_0xeabc('0x28')](_0x4d4e29)[_0xeabc('0x29')](_0x811f0d);}};}function respondWithFilteredResult(_0x3f194e,_0x3a1a04){return function(_0x137293){if(_0x137293){var _0x131722=_0x137293['count'],_0x4c2693=_0x3a1a04[_0xeabc('0x2a')],_0x5b2934=_0x3a1a04[_0xeabc('0x2a')]+_0x3a1a04['limit'],_0x459c8a;if(_0x5b2934>=_0x131722){_0x5b2934=_0x131722;_0x459c8a=0xc8;}else{_0x459c8a=0xce;}_0x3f194e[_0xeabc('0x28')](_0x459c8a);return _0x3f194e[_0xeabc('0x2b')](_0xeabc('0x2c'),_0x4c2693+'-'+_0x5b2934+'/'+_0x131722)[_0xeabc('0x29')](_0x137293);}return null;};}function patchUpdates(_0x149170){return function(_0x481ee1){try{jsonpatch[_0xeabc('0x2d')](_0x481ee1,_0x149170,!![]);}catch(_0x38dc0a){return BPromise[_0xeabc('0x2e')](_0x38dc0a);}return _0x481ee1['save']();};}function saveUpdates(_0x5b34dd,_0x5bb1f1){return function(_0x2f03e8){if(_0x2f03e8){return _0x2f03e8[_0xeabc('0x2f')](_0x5b34dd)[_0xeabc('0x1e')](function(_0x3c606a){return _0x3c606a;});}return null;};}function removeEntity(_0x73c8d4,_0x368b8a){return function(_0x61c0af){if(_0x61c0af){return _0x61c0af['destroy']()[_0xeabc('0x1e')](function(){_0x73c8d4[_0xeabc('0x28')](0xcc)[_0xeabc('0x30')]();});}};}function handleEntityNotFound(_0x4918e2,_0x1e74ca){return function(_0x3777c1){if(!_0x3777c1){_0x4918e2[_0xeabc('0x31')](0x194);}return _0x3777c1;};}function handleError(_0x4e9e17,_0xc0a5b0){_0xc0a5b0=_0xc0a5b0||0x1f4;return function(_0x36cc2f){logger[_0xeabc('0x23')](_0x36cc2f['stack']);if(_0x36cc2f[_0xeabc('0x32')]){delete _0x36cc2f[_0xeabc('0x32')];}_0x4e9e17['status'](_0xc0a5b0)['send'](_0x36cc2f);};}exports[_0xeabc('0x33')]=function(_0x3829a9,_0x4fc60c){var _0x43df50={},_0x81976d={},_0x3edee7={'count':0x0,'rows':[]};var _0x10434e=_[_0xeabc('0x34')](db['FreshsalesConfiguration'][_0xeabc('0x35')],function(_0x5b61fa){return{'name':_0x5b61fa[_0xeabc('0x36')],'type':_0x5b61fa[_0xeabc('0x37')][_0xeabc('0x38')]};});_0x81976d['model']=_['map'](_0x10434e,_0xeabc('0x32'));_0x81976d['query']=_[_0xeabc('0x39')](_0x3829a9['query']);_0x81976d['filters']=_['intersection'](_0x81976d['model'],_0x81976d[_0xeabc('0x3a')]);_0x43df50['attributes']=_[_0xeabc('0x3b')](_0x81976d[_0xeabc('0x3c')],qs['fields'](_0x3829a9[_0xeabc('0x3a')]['fields']));_0x43df50[_0xeabc('0x3d')]=_0x43df50['attributes'][_0xeabc('0x3e')]?_0x43df50[_0xeabc('0x3d')]:_0x81976d[_0xeabc('0x3c')];if(!_0x3829a9['query']['hasOwnProperty']('nolimit')){_0x43df50[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x3829a9[_0xeabc('0x3a')]['limit']);_0x43df50['offset']=qs[_0xeabc('0x2a')](_0x3829a9[_0xeabc('0x3a')]['offset']);}_0x43df50[_0xeabc('0x40')]=qs['sort'](_0x3829a9[_0xeabc('0x3a')]['sort']);_0x43df50['where']=qs['filters'](_[_0xeabc('0x41')](_0x3829a9[_0xeabc('0x3a')],_0x81976d[_0xeabc('0x42')]),_0x10434e);if(_0x3829a9[_0xeabc('0x3a')]['filter']){_0x43df50[_0xeabc('0x43')]=_['merge'](_0x43df50[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x10434e,function(_0x3a7807){if(_0x3a7807[_0xeabc('0x37')]!==_0xeabc('0x44')){var _0x48b988={};_0x48b988[_0x3a7807['name']]={'$like':'%'+_0x3829a9[_0xeabc('0x3a')]['filter']+'%'};return _0x48b988;}})});}_0x43df50=_[_0xeabc('0x45')]({},_0x43df50,_0x3829a9[_0xeabc('0x46')]);var _0x4d92b2={'where':_0x43df50[_0xeabc('0x43')]};return db[_0xeabc('0x47')][_0xeabc('0x48')](_0x4d92b2)[_0xeabc('0x1e')](function(_0x4360d7){_0x3edee7[_0xeabc('0x48')]=_0x4360d7;if(_0x3829a9[_0xeabc('0x3a')]['includeAll']){_0x43df50[_0xeabc('0x49')]=[{'all':!![]}];}return db[_0xeabc('0x47')][_0xeabc('0x4a')](_0x43df50);})[_0xeabc('0x1e')](function(_0x271f8c){_0x3edee7[_0xeabc('0x4b')]=_0x271f8c;return _0x3edee7;})[_0xeabc('0x1e')](respondWithFilteredResult(_0x4fc60c,_0x43df50))[_0xeabc('0x27')](handleError(_0x4fc60c,null));};exports[_0xeabc('0x4c')]=function(_0x44e714,_0x5689fc){var _0x38356c={'raw':![],'where':{'id':_0x44e714[_0xeabc('0x4d')]['id']}},_0x2e6efb={};_0x2e6efb[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db[_0xeabc('0x47')][_0xeabc('0x35')]);_0x2e6efb['query']=_[_0xeabc('0x39')](_0x44e714[_0xeabc('0x3a')]);_0x2e6efb[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],_0x2e6efb['query']);_0x38356c[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x44e714['query'][_0xeabc('0x4e')]));_0x38356c[_0xeabc('0x3d')]=_0x38356c['attributes'][_0xeabc('0x3e')]?_0x38356c['attributes']:_0x2e6efb[_0xeabc('0x3c')];if(_0x44e714['query'][_0xeabc('0x4f')]){_0x38356c[_0xeabc('0x49')]=[{'all':!![]}];}_0x38356c=_[_0xeabc('0x45')]({},_0x38356c,_0x44e714[_0xeabc('0x46')]);return db[_0xeabc('0x47')][_0xeabc('0x50')](_0x38356c)[_0xeabc('0x1e')](handleEntityNotFound(_0x5689fc,null))[_0xeabc('0x1e')](respondWithResult(_0x5689fc,null))[_0xeabc('0x27')](handleError(_0x5689fc,null));};exports[_0xeabc('0x51')]=function(_0x48a13f,_0x180a14){return db[_0xeabc('0x47')][_0xeabc('0x51')](_0x48a13f[_0xeabc('0x52')],{})['then'](respondWithResult(_0x180a14,0xc9))[_0xeabc('0x27')](handleError(_0x180a14,null));};exports[_0xeabc('0x2f')]=function(_0x10d56f,_0x21f972){if(_0x10d56f['body']['id']){delete _0x10d56f[_0xeabc('0x52')]['id'];}return db[_0xeabc('0x47')][_0xeabc('0x50')]({'where':{'id':_0x10d56f[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x21f972,null))[_0xeabc('0x1e')](saveUpdates(_0x10d56f[_0xeabc('0x52')],null))[_0xeabc('0x1e')](respondWithResult(_0x21f972,null))[_0xeabc('0x27')](handleError(_0x21f972,null));};exports['destroy']=function(_0x4546c4,_0x4cdb05){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4546c4[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x4cdb05,null))[_0xeabc('0x1e')](removeEntity(_0x4cdb05,null))[_0xeabc('0x27')](handleError(_0x4cdb05,null));};exports[_0xeabc('0x53')]=function(_0x2f78f3,_0x4a2ad6,_0x4358d7){var _0x25fd83={};var _0x19f61e={};var _0x104c1e;var _0x2ddc53;return db[_0xeabc('0x47')][_0xeabc('0x54')]({'where':{'id':_0x2f78f3[_0xeabc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2ad6,null))['then'](function(_0x180e62){if(_0x180e62){_0x104c1e=_0x180e62;_0x19f61e[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db['FreshsalesField'][_0xeabc('0x35')]);_0x19f61e['query']=_['keys'](_0x2f78f3[_0xeabc('0x3a')]);_0x19f61e[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x19f61e[_0xeabc('0x3c')],_0x19f61e[_0xeabc('0x3a')]);_0x25fd83[_0xeabc('0x3d')]=_['intersection'](_0x19f61e[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x4e')]));_0x25fd83[_0xeabc('0x3d')]=_0x25fd83[_0xeabc('0x3d')]['length']?_0x25fd83[_0xeabc('0x3d')]:_0x19f61e[_0xeabc('0x3c')];_0x25fd83[_0xeabc('0x40')]=qs[_0xeabc('0x55')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x25fd83[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_[_0xeabc('0x41')](_0x2f78f3['query'],_0x19f61e[_0xeabc('0x42')]));if(_0x2f78f3['query'][_0xeabc('0x56')]){_0x25fd83[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x25fd83[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x25fd83[_0xeabc('0x3d')],function(_0xf48062){var _0xb59a2a={};_0xb59a2a[_0xf48062]={'$like':'%'+_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x56')]+'%'};return _0xb59a2a;})});}_0x25fd83=_['merge']({},_0x25fd83,_0x2f78f3[_0xeabc('0x46')]);return _0x104c1e[_0xeabc('0x53')](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x41cad5){if(_0x41cad5){_0x2ddc53=_0x41cad5['length'];if(!_0x2f78f3[_0xeabc('0x3a')]['hasOwnProperty']('nolimit')){_0x25fd83[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x3f')]);_0x25fd83['offset']=qs['offset'](_0x2f78f3[_0xeabc('0x3a')]['offset']);}return _0x104c1e['getSubjects'](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x4f1a4f){if(_0x4f1a4f){return _0x4f1a4f?{'count':_0x2ddc53,'rows':_0x4f1a4f}:null;}})['then'](respondWithResult(_0x4a2ad6,null))[_0xeabc('0x27')](handleError(_0x4a2ad6,null));};exports[_0xeabc('0x57')]=function(_0x5613ef,_0x48cccc,_0xd866c0){var _0x5d183a={};var _0x238e2d={};var _0x15ca17;var _0x4c84a9;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x5613ef[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x48cccc,null))[_0xeabc('0x1e')](function(_0x1debaa){if(_0x1debaa){_0x15ca17=_0x1debaa;_0x238e2d['model']=_['keys'](db[_0xeabc('0x58')]['rawAttributes']);_0x238e2d[_0xeabc('0x3a')]=_['keys'](_0x5613ef[_0xeabc('0x3a')]);_0x238e2d['filters']=_[_0xeabc('0x3b')](_0x238e2d['model'],_0x238e2d[_0xeabc('0x3a')]);_0x5d183a[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x238e2d[_0xeabc('0x3c')],qs['fields'](_0x5613ef[_0xeabc('0x3a')]['fields']));_0x5d183a[_0xeabc('0x3d')]=_0x5d183a[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x5d183a[_0xeabc('0x3d')]:_0x238e2d[_0xeabc('0x3c')];_0x5d183a['order']=qs[_0xeabc('0x55')](_0x5613ef[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x5d183a[_0xeabc('0x43')]=qs['filters'](_[_0xeabc('0x41')](_0x5613ef[_0xeabc('0x3a')],_0x238e2d[_0xeabc('0x42')]));if(_0x5613ef[_0xeabc('0x3a')]['filter']){_0x5d183a[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x5d183a[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x5d183a['attributes'],function(_0x56b7d0){var _0x30e9eb={};_0x30e9eb[_0x56b7d0]={'$like':'%'+_0x5613ef['query']['filter']+'%'};return _0x30e9eb;})});}_0x5d183a=_[_0xeabc('0x45')]({},_0x5d183a,_0x5613ef[_0xeabc('0x46')]);return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})['then'](function(_0x1baf30){if(_0x1baf30){_0x4c84a9=_0x1baf30[_0xeabc('0x3e')];if(!_0x5613ef['query'][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x5d183a[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x5613ef[_0xeabc('0x3a')]['limit']);_0x5d183a[_0xeabc('0x2a')]=qs['offset'](_0x5613ef['query']['offset']);}return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})[_0xeabc('0x1e')](function(_0x1b6e9e){if(_0x1b6e9e){return _0x1b6e9e?{'count':_0x4c84a9,'rows':_0x1b6e9e}:null;}})[_0xeabc('0x1e')](respondWithResult(_0x48cccc,null))[_0xeabc('0x27')](handleError(_0x48cccc,null));};exports['getFields']=function(_0x39f961,_0x47fd82,_0x1795fe){var _0x2f95c7={};var _0x4dac49={};var _0x11dda7;var _0x4d7821;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x39f961[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x47fd82,null))[_0xeabc('0x1e')](function(_0x3c6a49){if(_0x3c6a49){_0x11dda7=_0x3c6a49;_0x4dac49['model']=_[_0xeabc('0x39')](db[_0xeabc('0x58')][_0xeabc('0x35')]);_0x4dac49[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x39f961[_0xeabc('0x3a')]);_0x4dac49[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],_0x4dac49[_0xeabc('0x3a')]);_0x2f95c7['attributes']=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x39f961['query']['fields']));_0x2f95c7[_0xeabc('0x3d')]=_0x2f95c7[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x2f95c7[_0xeabc('0x3d')]:_0x4dac49[_0xeabc('0x3c')];_0x2f95c7['order']=qs[_0xeabc('0x55')](_0x39f961['query']['sort']);_0x2f95c7[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_['pick'](_0x39f961[_0xeabc('0x3a')],_0x4dac49[_0xeabc('0x42')]));if(_0x39f961[_0xeabc('0x3a')][_0xeabc('0x56')]){_0x2f95c7[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x2f95c7[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x2f95c7[_0xeabc('0x3d')],function(_0x1b0995){var _0x1f8197={};_0x1f8197[_0x1b0995]={'$like':'%'+_0x39f961['query'][_0xeabc('0x56')]+'%'};return _0x1f8197;})});}_0x2f95c7=_['merge']({},_0x2f95c7,_0x39f961[_0xeabc('0x46')]);return _0x11dda7[_0xeabc('0x5b')](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x2d1441){if(_0x2d1441){_0x4d7821=_0x2d1441[_0xeabc('0x3e')];if(!_0x39f961[_0xeabc('0x3a')][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x2f95c7[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x39f961[_0xeabc('0x3a')]['limit']);_0x2f95c7[_0xeabc('0x2a')]=qs[_0xeabc('0x2a')](_0x39f961[_0xeabc('0x3a')][_0xeabc('0x2a')]);}return _0x11dda7['getFields'](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x180f99){if(_0x180f99){return _0x180f99?{'count':_0x4d7821,'rows':_0x180f99}:null;}})['then'](respondWithResult(_0x47fd82,null))[_0xeabc('0x27')](handleError(_0x47fd82,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 74ef174..c0888c8 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 _0x3512=['./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3512,0x13b));var _0x2351=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3512[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x2351('0x0'));var logger=require(_0x2351('0x1'))(_0x2351('0x2'));var moment=require(_0x2351('0x3'));var BPromise=require(_0x2351('0x4'));var rp=require(_0x2351('0x5'));var fs=require('fs');var path=require(_0x2351('0x6'));var rimraf=require(_0x2351('0x7'));var config=require(_0x2351('0x8'));var attributes=require(_0x2351('0x9'));module['exports']=function(_0x23eaa0,_0x24ef90){return _0x23eaa0['define'](_0x2351('0xa'),attributes,{'tableName':_0x2351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9584=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x392651,_0x4ba1d9){var _0x1526be=function(_0x1fcc9b){while(--_0x1fcc9b){_0x392651['push'](_0x392651['shift']());}};_0x1526be(++_0x4ba1d9);}(_0x9584,0x1b9));var _0x4958=function(_0xc6a761,_0x486f76){_0xc6a761=_0xc6a761-0x0;var _0x5576bf=_0x9584[_0xc6a761];return _0x5576bf;};'use strict';var _=require(_0x4958('0x0'));var util=require(_0x4958('0x1'));var logger=require(_0x4958('0x2'))('api');var moment=require(_0x4958('0x3'));var BPromise=require(_0x4958('0x4'));var rp=require(_0x4958('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4958('0x6'));var config=require(_0x4958('0x7'));var attributes=require(_0x4958('0x8'));module[_0x4958('0x9')]=function(_0x4082c0,_0x12e8ef){return _0x4082c0['define'](_0x4958('0xa'),attributes,{'tableName':_0x4958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 1a56671..fdb3d41 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 _0xd48a=['code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd48a,0x96));var _0xad48=function(_0x5a33ee,_0x232006){_0x5a33ee=_0x5a33ee-0x0;var _0x114024=_0xd48a[_0x5a33ee];return _0x114024;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var moment=require(_0xad48('0x1'));var BPromise=require(_0xad48('0x2'));var rs=require(_0xad48('0x3'));var fs=require('fs');var Redis=require(_0xad48('0x4'));var db=require(_0xad48('0x5'))['db'];var utils=require(_0xad48('0x6'));var logger=require('../../config/logger')(_0xad48('0x7'));var config=require(_0xad48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5e0d,_0x5b1183,_0x3e133b){return new BPromise(function(_0x2df566,_0x23e617){return client[_0xad48('0xa')](_0x4e5e0d,_0x3e133b)[_0xad48('0xb')](function(_0x13d47d){logger[_0xad48('0xc')](_0xad48('0xd'),_0x5b1183,'request\x20sent');logger[_0xad48('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5b1183,_0xad48('0xf'),JSON[_0xad48('0x10')](_0x13d47d));if(_0x13d47d['error']){if(_0x13d47d[_0xad48('0x11')][_0xad48('0x12')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b1183,_0x13d47d[_0xad48('0x11')][_0xad48('0x13')]);return _0x23e617(_0x13d47d['error'][_0xad48('0x13')]);}logger[_0xad48('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b1183,_0x13d47d[_0xad48('0x11')][_0xad48('0x13')]);return _0x2df566(_0x13d47d[_0xad48('0x11')][_0xad48('0x13')]);}else{logger['info'](_0xad48('0xd'),_0x5b1183,'request\x20sent');_0x2df566(_0x13d47d['result']['message']);}})[_0xad48('0x14')](function(_0x18b4a1){logger[_0xad48('0x11')](_0xad48('0xd'),_0x5b1183,_0x18b4a1);_0x23e617(_0x18b4a1);});});} \ No newline at end of file +var _0xffdc=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xffdc,0x7f));var _0xcffd=function(_0x36153d,_0x4fed67){_0x36153d=_0x36153d-0x0;var _0xfdacff=_0xffdc[_0x36153d];return _0xfdacff;};'use strict';var _=require(_0xcffd('0x0'));var util=require(_0xcffd('0x1'));var moment=require('moment');var BPromise=require(_0xcffd('0x2'));var rs=require(_0xcffd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcffd('0x4'))['db'];var utils=require(_0xcffd('0x5'));var logger=require(_0xcffd('0x6'))(_0xcffd('0x7'));var config=require(_0xcffd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcffd('0x9')][_0xcffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12e830,_0x5b14be,_0x199df3){return new BPromise(function(_0x463334,_0x552fa7){return client[_0xcffd('0xb')](_0x12e830,_0x199df3)[_0xcffd('0xc')](function(_0x5dec7e){logger[_0xcffd('0xd')](_0xcffd('0xe'),_0x5b14be,_0xcffd('0xf'));logger['debug'](_0xcffd('0x10'),_0x5b14be,_0xcffd('0xf'),JSON[_0xcffd('0x11')](_0x5dec7e));if(_0x5dec7e[_0xcffd('0x12')]){if(_0x5dec7e['error']['code']===0x1f4){logger[_0xcffd('0x12')](_0xcffd('0xe'),_0x5b14be,_0x5dec7e[_0xcffd('0x12')]['message']);return _0x552fa7(_0x5dec7e[_0xcffd('0x12')]['message']);}logger['error'](_0xcffd('0xe'),_0x5b14be,_0x5dec7e[_0xcffd('0x12')]['message']);return _0x463334(_0x5dec7e[_0xcffd('0x12')][_0xcffd('0x13')]);}else{logger[_0xcffd('0xd')](_0xcffd('0xe'),_0x5b14be,'request\x20sent');_0x463334(_0x5dec7e['result'][_0xcffd('0x13')]);}})[_0xcffd('0x14')](function(_0x1da405){logger[_0xcffd('0x12')](_0xcffd('0xe'),_0x5b14be,_0x1da405);_0x552fa7(_0x1da405);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8a9adbb..fac8090 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 _0x2c1d=['../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x44e83a,_0x3145d7){var _0x54aa9c=function(_0x589e46){while(--_0x589e46){_0x44e83a['push'](_0x44e83a['shift']());}};_0x54aa9c(++_0x3145d7);}(_0x2c1d,0x122));var _0xd2c1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x2c1d[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xd2c1('0x0'));var util=require('util');var path=require(_0xd2c1('0x1'));var timeout=require(_0xd2c1('0x2'));var express=require(_0xd2c1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd2c1('0x4'));var controller=require(_0xd2c1('0x5'));router['get']('/',auth[_0xd2c1('0x6')](),controller['index']);router['get'](_0xd2c1('0x7'),auth[_0xd2c1('0x6')](),controller['show']);router[_0xd2c1('0x8')]('/',auth[_0xd2c1('0x6')](),controller['create']);router[_0xd2c1('0x9')]('/:id',auth[_0xd2c1('0x6')](),controller[_0xd2c1('0xa')]);router[_0xd2c1('0xb')]('/:id',auth[_0xd2c1('0x6')](),controller[_0xd2c1('0xc')]);module[_0xd2c1('0xd')]=router; \ No newline at end of file +var _0x2c2e=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer'];(function(_0x34a512,_0x4533d2){var _0x3a22df=function(_0x34fbfa){while(--_0x34fbfa){_0x34a512['push'](_0x34a512['shift']());}};_0x3a22df(++_0x4533d2);}(_0x2c2e,0x10d));var _0xe2c2=function(_0x182e13,_0x436a2f){_0x182e13=_0x182e13-0x0;var _0x4f67b1=_0x2c2e[_0x182e13];return _0x4f67b1;};'use strict';var multer=require(_0xe2c2('0x0'));var util=require(_0xe2c2('0x1'));var path=require(_0xe2c2('0x2'));var timeout=require(_0xe2c2('0x3'));var express=require(_0xe2c2('0x4'));var router=express[_0xe2c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe2c2('0x6'));var config=require(_0xe2c2('0x7'));var controller=require(_0xe2c2('0x8'));router[_0xe2c2('0x9')]('/',auth[_0xe2c2('0xa')](),controller[_0xe2c2('0xb')]);router[_0xe2c2('0x9')](_0xe2c2('0xc'),auth[_0xe2c2('0xa')](),controller[_0xe2c2('0xd')]);router[_0xe2c2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2c2('0xf')](_0xe2c2('0xc'),auth[_0xe2c2('0xa')](),controller[_0xe2c2('0x10')]);router['delete'](_0xe2c2('0xc'),auth[_0xe2c2('0xa')](),controller['destroy']);module[_0xe2c2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 3a236d8..06ff9e7 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 _0x56a4=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','picklist'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x56a4,0x11b));var _0x456a=function(_0x33fc57,_0xdd2591){_0x33fc57=_0x33fc57-0x0;var _0xf701ca=_0x56a4[_0x33fc57];return _0xf701ca;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x456a('0x2'),_0x456a('0x3'),'customVariable','keyValue',_0x456a('0x4')),'defaultValue':_0x456a('0x2')},'content':{'type':Sequelize[_0x456a('0x5')]},'key':{'type':Sequelize[_0x456a('0x5')]},'keyType':{'type':Sequelize[_0x456a('0x6')]('string',_0x456a('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x456a('0x5')]},'nameField':{'type':Sequelize[_0x456a('0x5')]},'customField':{'type':Sequelize[_0x456a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f47=['ENUM','variable','keyValue','string','STRING','customVariable','BOOLEAN','exports'];(function(_0x9a62de,_0x127f28){var _0x14d7b3=function(_0x23d73f){while(--_0x23d73f){_0x9a62de['push'](_0x9a62de['shift']());}};_0x14d7b3(++_0x127f28);}(_0x6f47,0xc7));var _0x76f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6f47[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),'customVariable',_0x76f4('0x3'),'picklist'),'defaultValue':_0x76f4('0x4')},'content':{'type':Sequelize[_0x76f4('0x5')]},'key':{'type':Sequelize[_0x76f4('0x5')]},'keyType':{'type':Sequelize[_0x76f4('0x1')]('string',_0x76f4('0x2'),_0x76f4('0x6'))},'keyContent':{'type':Sequelize[_0x76f4('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x76f4('0x5')]},'customField':{'type':Sequelize[_0x76f4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x76f4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 493c326..7511828 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 _0x60c9=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','set','json','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','FreshsalesField','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x13c5be,_0x576253){var _0x1660a2=function(_0x1661e9){while(--_0x1661e9){_0x13c5be['push'](_0x13c5be['shift']());}};_0x1660a2(++_0x576253);}(_0x60c9,0x7c));var _0x960c=function(_0xeac199,_0x598651){_0xeac199=_0xeac199-0x0;var _0x284968=_0x60c9[_0xeac199];return _0x284968;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x960c('0x0'));var zipdir=require(_0x960c('0x1'));var jsonpatch=require(_0x960c('0x2'));var rp=require(_0x960c('0x3'));var moment=require('moment');var BPromise=require(_0x960c('0x4'));var Mustache=require(_0x960c('0x5'));var util=require(_0x960c('0x6'));var path=require(_0x960c('0x7'));var sox=require(_0x960c('0x8'));var csv=require('to-csv');var ejs=require(_0x960c('0x9'));var fs=require('fs');var _=require(_0x960c('0xa'));var squel=require('squel');var crypto=require(_0x960c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x960c('0xc'));var toCsv=require(_0x960c('0xd'));var querystring=require(_0x960c('0xe'));var Papa=require(_0x960c('0xf'));var Redis=require(_0x960c('0x10'));var authService=require(_0x960c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x960c('0x12'));var hardwareService=require(_0x960c('0x13'));var logger=require(_0x960c('0x14'))(_0x960c('0x15'));var utils=require(_0x960c('0x16'));var config=require(_0x960c('0x17'));var licenseUtil=require(_0x960c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dad53,_0x458c88){_0x458c88=_0x458c88||0xcc;return function(_0x1dcb6c){if(_0x1dcb6c){return _0x4dad53[_0x960c('0x19')](_0x458c88);}return _0x4dad53['status'](_0x458c88)[_0x960c('0x1a')]();};}function respondWithResult(_0x173c14,_0x174f6d){_0x174f6d=_0x174f6d||0xc8;return function(_0x439ec9){if(_0x439ec9){return _0x173c14[_0x960c('0x1b')](_0x174f6d)['json'](_0x439ec9);}};}function respondWithFilteredResult(_0x5d893c,_0x5a5fbc){return function(_0x321acb){if(_0x321acb){var _0x4e6e56=_0x321acb[_0x960c('0x1c')],_0x195a5e=_0x5a5fbc['offset'],_0x3bba7b=_0x5a5fbc[_0x960c('0x1d')]+_0x5a5fbc['limit'],_0x1d311c;if(_0x3bba7b>=_0x4e6e56){_0x3bba7b=_0x4e6e56;_0x1d311c=0xc8;}else{_0x1d311c=0xce;}_0x5d893c[_0x960c('0x1b')](_0x1d311c);return _0x5d893c[_0x960c('0x1e')]('Content-Range',_0x195a5e+'-'+_0x3bba7b+'/'+_0x4e6e56)[_0x960c('0x1f')](_0x321acb);}return null;};}function patchUpdates(_0x2d9da0){return function(_0xfdf48a){try{jsonpatch['apply'](_0xfdf48a,_0x2d9da0,!![]);}catch(_0x206676){return BPromise[_0x960c('0x20')](_0x206676);}return _0xfdf48a[_0x960c('0x21')]();};}function saveUpdates(_0x3d39c6,_0x2dbe28){return function(_0x3516e0){if(_0x3516e0){return _0x3516e0[_0x960c('0x22')](_0x3d39c6)['then'](function(_0x217310){return _0x217310;});}return null;};}function removeEntity(_0x2d1dfd,_0x27dd7){return function(_0x4ae7b9){if(_0x4ae7b9){return _0x4ae7b9[_0x960c('0x23')]()[_0x960c('0x24')](function(){_0x2d1dfd[_0x960c('0x1b')](0xcc)[_0x960c('0x1a')]();});}};}function handleEntityNotFound(_0x6d6a69,_0x317e3f){return function(_0x5865d9){if(!_0x5865d9){_0x6d6a69[_0x960c('0x19')](0x194);}return _0x5865d9;};}function handleError(_0x292698,_0x381d1e){_0x381d1e=_0x381d1e||0x1f4;return function(_0x316acf){logger[_0x960c('0x25')](_0x316acf[_0x960c('0x26')]);if(_0x316acf[_0x960c('0x27')]){delete _0x316acf[_0x960c('0x27')];}_0x292698[_0x960c('0x1b')](_0x381d1e)['send'](_0x316acf);};}exports[_0x960c('0x28')]=function(_0x107048,_0x3d1be9){var _0x1ad68f={},_0x2191fc={},_0x4935f1={'count':0x0,'rows':[]};var _0x911ee3=_[_0x960c('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x402767){return{'name':_0x402767[_0x960c('0x2a')],'type':_0x402767[_0x960c('0x2b')][_0x960c('0x2c')]};});_0x2191fc[_0x960c('0x2d')]=_['map'](_0x911ee3,'name');_0x2191fc['query']=_['keys'](_0x107048[_0x960c('0x2e')]);_0x2191fc[_0x960c('0x2f')]=_[_0x960c('0x30')](_0x2191fc[_0x960c('0x2d')],_0x2191fc[_0x960c('0x2e')]);_0x1ad68f[_0x960c('0x31')]=_[_0x960c('0x30')](_0x2191fc[_0x960c('0x2d')],qs[_0x960c('0x32')](_0x107048[_0x960c('0x2e')][_0x960c('0x32')]));_0x1ad68f[_0x960c('0x31')]=_0x1ad68f[_0x960c('0x31')][_0x960c('0x33')]?_0x1ad68f['attributes']:_0x2191fc[_0x960c('0x2d')];if(!_0x107048[_0x960c('0x2e')]['hasOwnProperty'](_0x960c('0x34'))){_0x1ad68f[_0x960c('0x35')]=qs['limit'](_0x107048[_0x960c('0x2e')]['limit']);_0x1ad68f['offset']=qs['offset'](_0x107048[_0x960c('0x2e')][_0x960c('0x1d')]);}_0x1ad68f[_0x960c('0x36')]=qs[_0x960c('0x37')](_0x107048[_0x960c('0x2e')]['sort']);_0x1ad68f[_0x960c('0x38')]=qs['filters'](_['pick'](_0x107048['query'],_0x2191fc['filters']),_0x911ee3);if(_0x107048[_0x960c('0x2e')][_0x960c('0x39')]){_0x1ad68f[_0x960c('0x38')]=_['merge'](_0x1ad68f[_0x960c('0x38')],{'$or':_[_0x960c('0x29')](_0x911ee3,function(_0x5ec312){if(_0x5ec312[_0x960c('0x2b')]!==_0x960c('0x3a')){var _0x503a4e={};_0x503a4e[_0x5ec312[_0x960c('0x27')]]={'$like':'%'+_0x107048['query'][_0x960c('0x39')]+'%'};return _0x503a4e;}})});}_0x1ad68f=_[_0x960c('0x3b')]({},_0x1ad68f,_0x107048[_0x960c('0x3c')]);var _0x30ff48={'where':_0x1ad68f[_0x960c('0x38')]};return db[_0x960c('0x3d')][_0x960c('0x1c')](_0x30ff48)[_0x960c('0x24')](function(_0x976f53){_0x4935f1[_0x960c('0x1c')]=_0x976f53;if(_0x107048[_0x960c('0x2e')][_0x960c('0x3e')]){_0x1ad68f[_0x960c('0x3f')]=[{'all':!![]}];}return db[_0x960c('0x3d')][_0x960c('0x40')](_0x1ad68f);})[_0x960c('0x24')](function(_0x40755f){_0x4935f1['rows']=_0x40755f;return _0x4935f1;})[_0x960c('0x24')](respondWithFilteredResult(_0x3d1be9,_0x1ad68f))[_0x960c('0x41')](handleError(_0x3d1be9,null));};exports[_0x960c('0x42')]=function(_0x435a67,_0x3fa046){var _0x45844b={'raw':!![],'where':{'id':_0x435a67[_0x960c('0x43')]['id']}},_0x18cde4={};_0x18cde4['model']=_[_0x960c('0x44')](db[_0x960c('0x3d')]['rawAttributes']);_0x18cde4[_0x960c('0x2e')]=_[_0x960c('0x44')](_0x435a67[_0x960c('0x2e')]);_0x18cde4[_0x960c('0x2f')]=_[_0x960c('0x30')](_0x18cde4[_0x960c('0x2d')],_0x18cde4[_0x960c('0x2e')]);_0x45844b[_0x960c('0x31')]=_[_0x960c('0x30')](_0x18cde4['model'],qs[_0x960c('0x32')](_0x435a67[_0x960c('0x2e')][_0x960c('0x32')]));_0x45844b[_0x960c('0x31')]=_0x45844b[_0x960c('0x31')][_0x960c('0x33')]?_0x45844b[_0x960c('0x31')]:_0x18cde4['model'];if(_0x435a67[_0x960c('0x2e')]['includeAll']){_0x45844b[_0x960c('0x3f')]=[{'all':!![]}];}_0x45844b=_['merge']({},_0x45844b,_0x435a67['options']);return db[_0x960c('0x3d')][_0x960c('0x45')](_0x45844b)['then'](handleEntityNotFound(_0x3fa046,null))['then'](respondWithResult(_0x3fa046,null))[_0x960c('0x41')](handleError(_0x3fa046,null));};exports[_0x960c('0x46')]=function(_0x34ec0c,_0x22cabf){return db[_0x960c('0x3d')][_0x960c('0x46')](_0x34ec0c[_0x960c('0x47')],{})['then'](respondWithResult(_0x22cabf,0xc9))[_0x960c('0x41')](handleError(_0x22cabf,null));};exports[_0x960c('0x22')]=function(_0xf0b231,_0x4c4362){if(_0xf0b231[_0x960c('0x47')]['id']){delete _0xf0b231['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0xf0b231['params']['id']}})[_0x960c('0x24')](handleEntityNotFound(_0x4c4362,null))['then'](saveUpdates(_0xf0b231['body'],null))['then'](respondWithResult(_0x4c4362,null))[_0x960c('0x41')](handleError(_0x4c4362,null));};exports[_0x960c('0x23')]=function(_0x14a73b,_0x3d0da7){return db[_0x960c('0x3d')]['find']({'where':{'id':_0x14a73b[_0x960c('0x43')]['id']}})[_0x960c('0x24')](handleEntityNotFound(_0x3d0da7,null))['then'](removeEntity(_0x3d0da7,null))[_0x960c('0x41')](handleError(_0x3d0da7,null));}; \ No newline at end of file +var _0x8db7=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','keys','include','find','catch','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce'];(function(_0x26e3a0,_0x418608){var _0x1214d3=function(_0x38e23b){while(--_0x38e23b){_0x26e3a0['push'](_0x26e3a0['shift']());}};_0x1214d3(++_0x418608);}(_0x8db7,0x1ab));var _0x78db=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x8db7[_0x36eaaa];return _0x461349;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x78db('0x0'));var rimraf=require(_0x78db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78db('0x2'));var BPromise=require(_0x78db('0x3'));var Mustache=require(_0x78db('0x4'));var util=require(_0x78db('0x5'));var path=require(_0x78db('0x6'));var sox=require(_0x78db('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x78db('0x8'));var crypto=require(_0x78db('0x9'));var jsforce=require(_0x78db('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x78db('0xb'));var querystring=require(_0x78db('0xc'));var Papa=require(_0x78db('0xd'));var Redis=require(_0x78db('0xe'));var authService=require(_0x78db('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x78db('0x10'));var hardwareService=require(_0x78db('0x11'));var logger=require(_0x78db('0x12'))(_0x78db('0x13'));var utils=require(_0x78db('0x14'));var config=require(_0x78db('0x15'));var licenseUtil=require(_0x78db('0x16'));var db=require(_0x78db('0x17'))['db'];function respondWithStatusCode(_0xadad33,_0x54fcaa){_0x54fcaa=_0x54fcaa||0xcc;return function(_0x49c5bc){if(_0x49c5bc){return _0xadad33[_0x78db('0x18')](_0x54fcaa);}return _0xadad33['status'](_0x54fcaa)['end']();};}function respondWithResult(_0x20a261,_0x24e665){_0x24e665=_0x24e665||0xc8;return function(_0x39a5c2){if(_0x39a5c2){return _0x20a261[_0x78db('0x19')](_0x24e665)[_0x78db('0x1a')](_0x39a5c2);}};}function respondWithFilteredResult(_0x54f7c3,_0x3f4030){return function(_0x58f441){if(_0x58f441){var _0x3e5e7e=_0x58f441[_0x78db('0x1b')],_0x18a90b=_0x3f4030[_0x78db('0x1c')],_0x6dbc1f=_0x3f4030[_0x78db('0x1c')]+_0x3f4030[_0x78db('0x1d')],_0xea2693;if(_0x6dbc1f>=_0x3e5e7e){_0x6dbc1f=_0x3e5e7e;_0xea2693=0xc8;}else{_0xea2693=0xce;}_0x54f7c3[_0x78db('0x19')](_0xea2693);return _0x54f7c3['set'](_0x78db('0x1e'),_0x18a90b+'-'+_0x6dbc1f+'/'+_0x3e5e7e)[_0x78db('0x1a')](_0x58f441);}return null;};}function patchUpdates(_0x1d3d23){return function(_0x4ce2d7){try{jsonpatch[_0x78db('0x1f')](_0x4ce2d7,_0x1d3d23,!![]);}catch(_0x5f11ac){return BPromise[_0x78db('0x20')](_0x5f11ac);}return _0x4ce2d7[_0x78db('0x21')]();};}function saveUpdates(_0x1275e5,_0x2b134b){return function(_0x42febf){if(_0x42febf){return _0x42febf[_0x78db('0x22')](_0x1275e5)[_0x78db('0x23')](function(_0x58ca42){return _0x58ca42;});}return null;};}function removeEntity(_0x59ad1c,_0x4edda8){return function(_0x43d09c){if(_0x43d09c){return _0x43d09c[_0x78db('0x24')]()['then'](function(){_0x59ad1c[_0x78db('0x19')](0xcc)[_0x78db('0x25')]();});}};}function handleEntityNotFound(_0x2000a3,_0x415e52){return function(_0x55f632){if(!_0x55f632){_0x2000a3[_0x78db('0x18')](0x194);}return _0x55f632;};}function handleError(_0x4ab055,_0x39565a){_0x39565a=_0x39565a||0x1f4;return function(_0x5dd7b7){logger[_0x78db('0x26')](_0x5dd7b7[_0x78db('0x27')]);if(_0x5dd7b7['name']){delete _0x5dd7b7[_0x78db('0x28')];}_0x4ab055[_0x78db('0x19')](_0x39565a)[_0x78db('0x29')](_0x5dd7b7);};}exports[_0x78db('0x2a')]=function(_0x3c510d,_0x27a7d0){var _0x1c744c={},_0x4afa75={},_0x2c4761={'count':0x0,'rows':[]};var _0x5f06cf=_['map'](db[_0x78db('0x2b')][_0x78db('0x2c')],function(_0x13c8d8){return{'name':_0x13c8d8[_0x78db('0x2d')],'type':_0x13c8d8[_0x78db('0x2e')][_0x78db('0x2f')]};});_0x4afa75[_0x78db('0x30')]=_[_0x78db('0x31')](_0x5f06cf,_0x78db('0x28'));_0x4afa75['query']=_['keys'](_0x3c510d[_0x78db('0x32')]);_0x4afa75[_0x78db('0x33')]=_['intersection'](_0x4afa75[_0x78db('0x30')],_0x4afa75['query']);_0x1c744c[_0x78db('0x34')]=_[_0x78db('0x35')](_0x4afa75[_0x78db('0x30')],qs[_0x78db('0x36')](_0x3c510d['query'][_0x78db('0x36')]));_0x1c744c['attributes']=_0x1c744c[_0x78db('0x34')][_0x78db('0x37')]?_0x1c744c[_0x78db('0x34')]:_0x4afa75[_0x78db('0x30')];if(!_0x3c510d['query']['hasOwnProperty'](_0x78db('0x38'))){_0x1c744c['limit']=qs[_0x78db('0x1d')](_0x3c510d[_0x78db('0x32')][_0x78db('0x1d')]);_0x1c744c[_0x78db('0x1c')]=qs['offset'](_0x3c510d[_0x78db('0x32')][_0x78db('0x1c')]);}_0x1c744c[_0x78db('0x39')]=qs[_0x78db('0x3a')](_0x3c510d[_0x78db('0x32')][_0x78db('0x3a')]);_0x1c744c[_0x78db('0x3b')]=qs[_0x78db('0x33')](_[_0x78db('0x3c')](_0x3c510d['query'],_0x4afa75['filters']),_0x5f06cf);if(_0x3c510d[_0x78db('0x32')][_0x78db('0x3d')]){_0x1c744c[_0x78db('0x3b')]=_[_0x78db('0x3e')](_0x1c744c[_0x78db('0x3b')],{'$or':_['map'](_0x5f06cf,function(_0x218f34){if(_0x218f34[_0x78db('0x2e')]!==_0x78db('0x3f')){var _0x43d27b={};_0x43d27b[_0x218f34[_0x78db('0x28')]]={'$like':'%'+_0x3c510d[_0x78db('0x32')][_0x78db('0x3d')]+'%'};return _0x43d27b;}})});}_0x1c744c=_[_0x78db('0x3e')]({},_0x1c744c,_0x3c510d[_0x78db('0x40')]);var _0x10c40c={'where':_0x1c744c[_0x78db('0x3b')]};return db[_0x78db('0x2b')][_0x78db('0x1b')](_0x10c40c)[_0x78db('0x23')](function(_0x4fd9dc){_0x2c4761['count']=_0x4fd9dc;if(_0x3c510d[_0x78db('0x32')]['includeAll']){_0x1c744c['include']=[{'all':!![]}];}return db[_0x78db('0x2b')]['findAll'](_0x1c744c);})[_0x78db('0x23')](function(_0xa5440c){_0x2c4761[_0x78db('0x41')]=_0xa5440c;return _0x2c4761;})[_0x78db('0x23')](respondWithFilteredResult(_0x27a7d0,_0x1c744c))['catch'](handleError(_0x27a7d0,null));};exports['show']=function(_0x38bf6c,_0x95da71){var _0x56f62e={'raw':!![],'where':{'id':_0x38bf6c['params']['id']}},_0x5ec945={};_0x5ec945['model']=_['keys'](db[_0x78db('0x2b')]['rawAttributes']);_0x5ec945[_0x78db('0x32')]=_[_0x78db('0x42')](_0x38bf6c[_0x78db('0x32')]);_0x5ec945[_0x78db('0x33')]=_[_0x78db('0x35')](_0x5ec945['model'],_0x5ec945[_0x78db('0x32')]);_0x56f62e[_0x78db('0x34')]=_[_0x78db('0x35')](_0x5ec945[_0x78db('0x30')],qs[_0x78db('0x36')](_0x38bf6c[_0x78db('0x32')][_0x78db('0x36')]));_0x56f62e[_0x78db('0x34')]=_0x56f62e[_0x78db('0x34')][_0x78db('0x37')]?_0x56f62e[_0x78db('0x34')]:_0x5ec945['model'];if(_0x38bf6c[_0x78db('0x32')]['includeAll']){_0x56f62e[_0x78db('0x43')]=[{'all':!![]}];}_0x56f62e=_[_0x78db('0x3e')]({},_0x56f62e,_0x38bf6c[_0x78db('0x40')]);return db[_0x78db('0x2b')][_0x78db('0x44')](_0x56f62e)[_0x78db('0x23')](handleEntityNotFound(_0x95da71,null))[_0x78db('0x23')](respondWithResult(_0x95da71,null))[_0x78db('0x45')](handleError(_0x95da71,null));};exports[_0x78db('0x46')]=function(_0x425694,_0x109164){return db[_0x78db('0x2b')][_0x78db('0x46')](_0x425694[_0x78db('0x47')],{})['then'](respondWithResult(_0x109164,0xc9))['catch'](handleError(_0x109164,null));};exports['update']=function(_0xc2fe1e,_0x20fcae){if(_0xc2fe1e['body']['id']){delete _0xc2fe1e[_0x78db('0x47')]['id'];}return db[_0x78db('0x2b')][_0x78db('0x44')]({'where':{'id':_0xc2fe1e['params']['id']}})[_0x78db('0x23')](handleEntityNotFound(_0x20fcae,null))[_0x78db('0x23')](saveUpdates(_0xc2fe1e[_0x78db('0x47')],null))[_0x78db('0x23')](respondWithResult(_0x20fcae,null))['catch'](handleError(_0x20fcae,null));};exports[_0x78db('0x24')]=function(_0x3f2fb3,_0x4dc4e3){return db[_0x78db('0x2b')]['find']({'where':{'id':_0x3f2fb3[_0x78db('0x48')]['id']}})[_0x78db('0x23')](handleEntityNotFound(_0x4dc4e3,null))['then'](removeEntity(_0x4dc4e3,null))[_0x78db('0x45')](handleError(_0x4dc4e3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2631c71..df9ef83 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 _0x2355=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger'];(function(_0x155839,_0x3f679d){var _0x51d322=function(_0xf96e28){while(--_0xf96e28){_0x155839['push'](_0x155839['shift']());}};_0x51d322(++_0x3f679d);}(_0x2355,0x1b0));var _0x5235=function(_0x29d896,_0x1b451a){_0x29d896=_0x29d896-0x0;var _0x32abfb=_0x2355[_0x29d896];return _0x32abfb;};'use strict';var _=require(_0x5235('0x0'));var util=require('util');var logger=require(_0x5235('0x1'))('api');var moment=require(_0x5235('0x2'));var BPromise=require(_0x5235('0x3'));var rp=require(_0x5235('0x4'));var fs=require('fs');var path=require(_0x5235('0x5'));var rimraf=require(_0x5235('0x6'));var config=require(_0x5235('0x7'));var attributes=require(_0x5235('0x8'));module['exports']=function(_0x1255c6,_0x278b47){return _0x1255c6[_0x5235('0x9')](_0x5235('0xa'),attributes,{'tableName':_0x5235('0xb'),'paranoid':![],'indexes':[{'name':_0x5235('0xc'),'fields':['idField',_0x5235('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c2b=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','FieldId','lodash'];(function(_0x2d05af,_0x25622b){var _0x5744df=function(_0x442aba){while(--_0x442aba){_0x2d05af['push'](_0x2d05af['shift']());}};_0x5744df(++_0x25622b);}(_0x3c2b,0x117));var _0xb3c2=function(_0x5283f3,_0x5069d2){_0x5283f3=_0x5283f3-0x0;var _0x2ff816=_0x3c2b[_0x5283f3];return _0x2ff816;};'use strict';var _=require(_0xb3c2('0x0'));var util=require(_0xb3c2('0x1'));var logger=require(_0xb3c2('0x2'))(_0xb3c2('0x3'));var moment=require('moment');var BPromise=require(_0xb3c2('0x4'));var rp=require(_0xb3c2('0x5'));var fs=require('fs');var path=require(_0xb3c2('0x6'));var rimraf=require(_0xb3c2('0x7'));var config=require(_0xb3c2('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0xb3c2('0x9')]=function(_0x4d1a51,_0x27d8e8){return _0x4d1a51[_0xb3c2('0xa')](_0xb3c2('0xb'),attributes,{'tableName':_0xb3c2('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0xb3c2('0xd')],'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 5949ab5..a424fc5 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 _0x039a=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x230d46,_0x3d452c){var _0x49401c=function(_0x4bc449){while(--_0x4bc449){_0x230d46['push'](_0x230d46['shift']());}};_0x49401c(++_0x3d452c);}(_0x039a,0x19f));var _0xa039=function(_0x459172,_0x38b0ff){_0x459172=_0x459172-0x0;var _0x353bf9=_0x039a[_0x459172];return _0x353bf9;};'use strict';var _=require(_0xa039('0x0'));var util=require(_0xa039('0x1'));var moment=require(_0xa039('0x2'));var BPromise=require(_0xa039('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa039('0x4'))['db'];var utils=require(_0xa039('0x5'));var logger=require(_0xa039('0x6'))('rpc');var config=require(_0xa039('0x7'));var jayson=require(_0xa039('0x8'));var client=jayson[_0xa039('0x9')][_0xa039('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb23046,_0x400ab2,_0x3920c5){return new BPromise(function(_0x86dffc,_0x4ca3a3){return client[_0xa039('0xb')](_0xb23046,_0x3920c5)[_0xa039('0xc')](function(_0x24f908){logger[_0xa039('0xd')](_0xa039('0xe'),_0x400ab2,_0xa039('0xf'));logger[_0xa039('0x10')](_0xa039('0x11'),_0x400ab2,_0xa039('0xf'),JSON[_0xa039('0x12')](_0x24f908));if(_0x24f908[_0xa039('0x13')]){if(_0x24f908[_0xa039('0x13')]['code']===0x1f4){logger[_0xa039('0x13')](_0xa039('0xe'),_0x400ab2,_0x24f908[_0xa039('0x13')]['message']);return _0x4ca3a3(_0x24f908['error'][_0xa039('0x14')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x400ab2,_0x24f908[_0xa039('0x13')][_0xa039('0x14')]);return _0x86dffc(_0x24f908[_0xa039('0x13')][_0xa039('0x14')]);}else{logger[_0xa039('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x400ab2,_0xa039('0xf'));_0x86dffc(_0x24f908['result'][_0xa039('0x14')]);}})[_0xa039('0x15')](function(_0x4d1781){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x400ab2,_0x4d1781);_0x4ca3a3(_0x4d1781);});});} \ No newline at end of file +var _0x78b2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x413d16,_0x2272e2){var _0x17c7d1=function(_0x534d50){while(--_0x534d50){_0x413d16['push'](_0x413d16['shift']());}};_0x17c7d1(++_0x2272e2);}(_0x78b2,0x91));var _0x278b=function(_0x1872cf,_0x590c62){_0x1872cf=_0x1872cf-0x0;var _0x2faf1b=_0x78b2[_0x1872cf];return _0x2faf1b;};'use strict';var _=require(_0x278b('0x0'));var util=require(_0x278b('0x1'));var moment=require(_0x278b('0x2'));var BPromise=require(_0x278b('0x3'));var rs=require(_0x278b('0x4'));var fs=require('fs');var Redis=require(_0x278b('0x5'));var db=require(_0x278b('0x6'))['db'];var utils=require(_0x278b('0x7'));var logger=require(_0x278b('0x8'))(_0x278b('0x9'));var config=require(_0x278b('0xa'));var jayson=require(_0x278b('0xb'));var client=jayson['client'][_0x278b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x472891,_0xa7b35f,_0xe6e40){return new BPromise(function(_0x2a0a52,_0xfaf87){return client[_0x278b('0xd')](_0x472891,_0xe6e40)[_0x278b('0xe')](function(_0x1eb3c4){logger[_0x278b('0xf')](_0x278b('0x10'),_0xa7b35f,_0x278b('0x11'));logger[_0x278b('0x12')](_0x278b('0x13'),_0xa7b35f,_0x278b('0x11'),JSON[_0x278b('0x14')](_0x1eb3c4));if(_0x1eb3c4[_0x278b('0x15')]){if(_0x1eb3c4[_0x278b('0x15')][_0x278b('0x16')]===0x1f4){logger['error'](_0x278b('0x10'),_0xa7b35f,_0x1eb3c4['error'][_0x278b('0x17')]);return _0xfaf87(_0x1eb3c4['error'][_0x278b('0x17')]);}logger['error'](_0x278b('0x10'),_0xa7b35f,_0x1eb3c4[_0x278b('0x15')][_0x278b('0x17')]);return _0x2a0a52(_0x1eb3c4[_0x278b('0x15')][_0x278b('0x17')]);}else{logger[_0x278b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xa7b35f,_0x278b('0x11'));_0x2a0a52(_0x1eb3c4[_0x278b('0x18')][_0x278b('0x17')]);}})['catch'](function(_0x1c9b3f){logger[_0x278b('0x15')](_0x278b('0x10'),_0xa7b35f,_0x1c9b3f);_0xfaf87(_0x1c9b3f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7770eb3..5a67d9f 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 _0xc39b=['create','addConfiguration','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x14f77f,_0x3c5939){var _0x228cc4=function(_0x4ae43f){while(--_0x4ae43f){_0x14f77f['push'](_0x14f77f['shift']());}};_0x228cc4(++_0x3c5939);}(_0xc39b,0x79));var _0xbc39=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xc39b[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0xbc39('0x0'));var util=require(_0xbc39('0x1'));var path=require(_0xbc39('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc39('0x3'));var router=express[_0xbc39('0x4')]();var auth=require(_0xbc39('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbc39('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xbc39('0x7')](),controller[_0xbc39('0x8')]);router[_0xbc39('0x9')](_0xbc39('0xa'),auth[_0xbc39('0x7')](),controller[_0xbc39('0xb')]);router[_0xbc39('0x9')](_0xbc39('0xc'),auth[_0xbc39('0x7')](),controller[_0xbc39('0xd')]);router[_0xbc39('0x9')](_0xbc39('0xe'),auth[_0xbc39('0x7')](),controller[_0xbc39('0xf')]);router[_0xbc39('0x10')]('/',auth[_0xbc39('0x7')](),controller[_0xbc39('0x11')]);router['post'](_0xbc39('0xc'),auth[_0xbc39('0x7')](),controller[_0xbc39('0x12')]);router[_0xbc39('0x13')](_0xbc39('0xa'),auth[_0xbc39('0x7')](),controller[_0xbc39('0x14')]);router[_0xbc39('0x15')](_0xbc39('0xa'),auth[_0xbc39('0x7')](),controller['destroy']);module[_0xbc39('0x16')]=router; \ No newline at end of file +var _0x9b0c=['post','addConfiguration','put','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b0c,0xf6));var _0xc9b0=function(_0x162d1a,_0x3b6f25){_0x162d1a=_0x162d1a-0x0;var _0x388fd1=_0x9b0c[_0x162d1a];return _0x388fd1;};'use strict';var multer=require(_0xc9b0('0x0'));var util=require(_0xc9b0('0x1'));var path=require(_0xc9b0('0x2'));var timeout=require(_0xc9b0('0x3'));var express=require('express');var router=express[_0xc9b0('0x4')]();var auth=require(_0xc9b0('0x5'));var interaction=require(_0xc9b0('0x6'));var config=require(_0xc9b0('0x7'));var controller=require(_0xc9b0('0x8'));router[_0xc9b0('0x9')]('/',auth[_0xc9b0('0xa')](),controller[_0xc9b0('0xb')]);router['get'](_0xc9b0('0xc'),auth[_0xc9b0('0xa')](),controller[_0xc9b0('0xd')]);router['get'](_0xc9b0('0xe'),auth[_0xc9b0('0xa')](),controller[_0xc9b0('0xf')]);router[_0xc9b0('0x9')](_0xc9b0('0x10'),auth[_0xc9b0('0xa')](),controller[_0xc9b0('0x11')]);router[_0xc9b0('0x12')]('/',auth[_0xc9b0('0xa')](),controller['create']);router[_0xc9b0('0x12')](_0xc9b0('0xe'),auth['isAuthenticated'](),controller[_0xc9b0('0x13')]);router[_0xc9b0('0x14')](_0xc9b0('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc9b0('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 eee67a1..0d3c78e 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 _0x4c83=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x4e8c7d,_0x13f09a){var _0x139334=function(_0x1a06cb){while(--_0x1a06cb){_0x4e8c7d['push'](_0x4e8c7d['shift']());}};_0x139334(++_0x13f09a);}(_0x4c83,0x6c));var _0x34c8=function(_0x2e3ba4,_0x513f97){_0x2e3ba4=_0x2e3ba4-0x0;var _0x58348e=_0x4c83[_0x2e3ba4];return _0x58348e;};'use strict';var Sequelize=require(_0x34c8('0x0'));module[_0x34c8('0x1')]={'name':{'type':Sequelize[_0x34c8('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x34c8('0x3')},'remoteUri':{'type':Sequelize[_0x34c8('0x2')]},'password':{'type':Sequelize[_0x34c8('0x2')]},'clientId':{'type':Sequelize[_0x34c8('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x34c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x34c8('0x4')](_0x34c8('0x5'),_0x34c8('0x6')),'defaultValue':_0x34c8('0x5')}}; \ No newline at end of file +var _0x7d09=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x1a79c6,_0x5bad0b){var _0x301647=function(_0x9d3817){while(--_0x9d3817){_0x1a79c6['push'](_0x1a79c6['shift']());}};_0x301647(++_0x5bad0b);}(_0x7d09,0xcd));var _0x97d0=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x7d09[_0x35fabd];return _0x61a8ee;};'use strict';var Sequelize=require(_0x97d0('0x0'));module[_0x97d0('0x1')]={'name':{'type':Sequelize[_0x97d0('0x2')]},'description':{'type':Sequelize[_0x97d0('0x2')]},'username':{'type':Sequelize[_0x97d0('0x2')],'unique':_0x97d0('0x3')},'remoteUri':{'type':Sequelize[_0x97d0('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x97d0('0x2')]},'securityToken':{'type':Sequelize[_0x97d0('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x97d0('0x4')](_0x97d0('0x5'),'newTab'),'defaultValue':_0x97d0('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 1b64e4d..0ff4d75 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 _0x1678=['error','code','message','result','status','json','count','offset','limit','set','Content-Range','apply','save','update','end','stack','name','index','map','SalesforceAccount','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c00ea,_0x1cf606){var _0x2754b6=function(_0x2bf125){while(--_0x2bf125){_0x4c00ea['push'](_0x4c00ea['shift']());}};_0x2754b6(++_0x1cf606);}(_0x1678,0x17b));var _0x8167=function(_0x53e44e,_0x3b3c1a){_0x53e44e=_0x53e44e-0x0;var _0x1bf496=_0x1678[_0x53e44e];return _0x1bf496;};'use strict';var pdf=require(_0x8167('0x0'));var emlformat=require(_0x8167('0x1'));var rimraf=require(_0x8167('0x2'));var zipdir=require(_0x8167('0x3'));var jsonpatch=require(_0x8167('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8167('0x5'));var Mustache=require(_0x8167('0x6'));var util=require(_0x8167('0x7'));var path=require(_0x8167('0x8'));var sox=require(_0x8167('0x9'));var csv=require(_0x8167('0xa'));var ejs=require(_0x8167('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8167('0xc'));var crypto=require(_0x8167('0xd'));var jsforce=require(_0x8167('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8167('0xf'));var Papa=require(_0x8167('0x10'));var Redis=require('ioredis');var authService=require(_0x8167('0x11'));var qs=require(_0x8167('0x12'));var as=require(_0x8167('0x13'));var hardwareService=require(_0x8167('0x14'));var logger=require(_0x8167('0x15'))(_0x8167('0x16'));var utils=require(_0x8167('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8167('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8167('0x19'));var client=jayson[_0x8167('0x1a')][_0x8167('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e7521,_0x45cb52,_0x4abe96,_0x438ee8){return new BPromise(function(_0x48890d,_0x5968f3){var _0x591413=_0x438ee8||client;return _0x591413['request'](_0x3e7521,_0x4abe96)[_0x8167('0x1c')](function(_0x240fce){logger[_0x8167('0x1d')](_0x8167('0x1e'),_0x45cb52,_0x8167('0x1f'));logger[_0x8167('0x20')](_0x8167('0x21'),_0x45cb52,_0x8167('0x1f'),JSON[_0x8167('0x22')](_0x240fce));if(_0x240fce[_0x8167('0x23')]){if(_0x240fce['error'][_0x8167('0x24')]===0x1f4){logger['error'](_0x8167('0x1e'),_0x45cb52,_0x240fce['error'][_0x8167('0x25')]);return _0x5968f3(_0x240fce[_0x8167('0x23')]['message']);}logger[_0x8167('0x23')](_0x8167('0x1e'),_0x45cb52,_0x240fce[_0x8167('0x23')][_0x8167('0x25')]);return _0x48890d(_0x240fce[_0x8167('0x23')][_0x8167('0x25')]);}else{logger[_0x8167('0x1d')](_0x8167('0x1e'),_0x45cb52,'request\x20sent');_0x48890d(_0x240fce[_0x8167('0x26')]['message']);}})['catch'](function(_0x98afa0){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x45cb52,_0x98afa0);_0x5968f3(_0x98afa0);});});}function respondWithStatusCode(_0x3be9c9,_0x5a9bce){_0x5a9bce=_0x5a9bce||0xcc;return function(_0xbf60c3){if(_0xbf60c3){return _0x3be9c9['sendStatus'](_0x5a9bce);}return _0x3be9c9[_0x8167('0x27')](_0x5a9bce)['end']();};}function respondWithResult(_0x44e579,_0x59a422){_0x59a422=_0x59a422||0xc8;return function(_0x16843e){if(_0x16843e){return _0x44e579[_0x8167('0x27')](_0x59a422)[_0x8167('0x28')](_0x16843e);}};}function respondWithFilteredResult(_0x5596f6,_0x7ce0a5){return function(_0x1cb49c){if(_0x1cb49c){var _0x120834=_0x1cb49c[_0x8167('0x29')],_0x3995b2=_0x7ce0a5['offset'],_0x643d1b=_0x7ce0a5[_0x8167('0x2a')]+_0x7ce0a5[_0x8167('0x2b')],_0x10fb6c;if(_0x643d1b>=_0x120834){_0x643d1b=_0x120834;_0x10fb6c=0xc8;}else{_0x10fb6c=0xce;}_0x5596f6['status'](_0x10fb6c);return _0x5596f6[_0x8167('0x2c')](_0x8167('0x2d'),_0x3995b2+'-'+_0x643d1b+'/'+_0x120834)[_0x8167('0x28')](_0x1cb49c);}return null;};}function patchUpdates(_0x23650d){return function(_0x1c28be){try{jsonpatch[_0x8167('0x2e')](_0x1c28be,_0x23650d,!![]);}catch(_0x1c9968){return BPromise['reject'](_0x1c9968);}return _0x1c28be[_0x8167('0x2f')]();};}function saveUpdates(_0x2f5871,_0x517c05){return function(_0x147fb2){if(_0x147fb2){return _0x147fb2[_0x8167('0x30')](_0x2f5871)[_0x8167('0x1c')](function(_0x3f1cee){return _0x3f1cee;});}return null;};}function removeEntity(_0x399318,_0x4850ad){return function(_0x13c927){if(_0x13c927){return _0x13c927['destroy']()[_0x8167('0x1c')](function(){_0x399318[_0x8167('0x27')](0xcc)[_0x8167('0x31')]();});}};}function handleEntityNotFound(_0x1480ef,_0x423edb){return function(_0x55e74a){if(!_0x55e74a){_0x1480ef['sendStatus'](0x194);}return _0x55e74a;};}function handleError(_0x4c5475,_0x5d936b){_0x5d936b=_0x5d936b||0x1f4;return function(_0x415cff){logger[_0x8167('0x23')](_0x415cff[_0x8167('0x32')]);if(_0x415cff[_0x8167('0x33')]){delete _0x415cff[_0x8167('0x33')];}_0x4c5475[_0x8167('0x27')](_0x5d936b)['send'](_0x415cff);};}exports[_0x8167('0x34')]=function(_0x4effd0,_0x1af583){var _0x43e21f={},_0x47cec4={},_0x5f36d8={'count':0x0,'rows':[]};var _0x105e1b=_[_0x8167('0x35')](db[_0x8167('0x36')][_0x8167('0x37')],function(_0x3e361b){return{'name':_0x3e361b['fieldName'],'type':_0x3e361b['type'][_0x8167('0x38')]};});_0x47cec4['model']=_[_0x8167('0x35')](_0x105e1b,_0x8167('0x33'));_0x47cec4['query']=_[_0x8167('0x39')](_0x4effd0[_0x8167('0x3a')]);_0x47cec4[_0x8167('0x3b')]=_[_0x8167('0x3c')](_0x47cec4[_0x8167('0x3d')],_0x47cec4[_0x8167('0x3a')]);_0x43e21f[_0x8167('0x3e')]=_[_0x8167('0x3c')](_0x47cec4[_0x8167('0x3d')],qs[_0x8167('0x3f')](_0x4effd0[_0x8167('0x3a')][_0x8167('0x3f')]));_0x43e21f[_0x8167('0x3e')]=_0x43e21f[_0x8167('0x3e')][_0x8167('0x40')]?_0x43e21f['attributes']:_0x47cec4[_0x8167('0x3d')];if(!_0x4effd0['query'][_0x8167('0x41')]('nolimit')){_0x43e21f[_0x8167('0x2b')]=qs[_0x8167('0x2b')](_0x4effd0['query'][_0x8167('0x2b')]);_0x43e21f['offset']=qs['offset'](_0x4effd0[_0x8167('0x3a')]['offset']);}_0x43e21f[_0x8167('0x42')]=qs['sort'](_0x4effd0[_0x8167('0x3a')][_0x8167('0x43')]);_0x43e21f['where']=qs[_0x8167('0x3b')](_[_0x8167('0x44')](_0x4effd0[_0x8167('0x3a')],_0x47cec4[_0x8167('0x3b')]),_0x105e1b);if(_0x4effd0[_0x8167('0x3a')][_0x8167('0x45')]){_0x43e21f[_0x8167('0x46')]=_[_0x8167('0x47')](_0x43e21f[_0x8167('0x46')],{'$or':_[_0x8167('0x35')](_0x105e1b,function(_0xdb3667){if(_0xdb3667[_0x8167('0x48')]!==_0x8167('0x49')){var _0x187f8={};_0x187f8[_0xdb3667['name']]={'$like':'%'+_0x4effd0[_0x8167('0x3a')][_0x8167('0x45')]+'%'};return _0x187f8;}})});}_0x43e21f=_[_0x8167('0x47')]({},_0x43e21f,_0x4effd0['options']);var _0x20eea7={'where':_0x43e21f[_0x8167('0x46')]};return db[_0x8167('0x36')][_0x8167('0x29')](_0x20eea7)[_0x8167('0x1c')](function(_0x214aa1){_0x5f36d8[_0x8167('0x29')]=_0x214aa1;if(_0x4effd0[_0x8167('0x3a')][_0x8167('0x4a')]){_0x43e21f[_0x8167('0x4b')]=[{'all':!![]}];}return db[_0x8167('0x36')][_0x8167('0x4c')](_0x43e21f);})[_0x8167('0x1c')](function(_0x543fef){_0x5f36d8[_0x8167('0x4d')]=_0x543fef;return _0x5f36d8;})[_0x8167('0x1c')](respondWithFilteredResult(_0x1af583,_0x43e21f))[_0x8167('0x4e')](handleError(_0x1af583,null));};exports[_0x8167('0x4f')]=function(_0x14f291,_0x1062f){var _0x417aa1={'raw':![],'where':{'id':_0x14f291[_0x8167('0x50')]['id']}},_0x5d9212={};_0x5d9212['model']=_[_0x8167('0x39')](db[_0x8167('0x36')][_0x8167('0x37')]);_0x5d9212[_0x8167('0x3a')]=_[_0x8167('0x39')](_0x14f291['query']);_0x5d9212[_0x8167('0x3b')]=_[_0x8167('0x3c')](_0x5d9212[_0x8167('0x3d')],_0x5d9212[_0x8167('0x3a')]);_0x417aa1[_0x8167('0x3e')]=_['intersection'](_0x5d9212[_0x8167('0x3d')],qs[_0x8167('0x3f')](_0x14f291[_0x8167('0x3a')][_0x8167('0x3f')]));_0x417aa1[_0x8167('0x3e')]=_0x417aa1[_0x8167('0x3e')][_0x8167('0x40')]?_0x417aa1[_0x8167('0x3e')]:_0x5d9212[_0x8167('0x3d')];if(_0x14f291[_0x8167('0x3a')][_0x8167('0x4a')]){_0x417aa1['include']=[{'all':!![]}];}_0x417aa1=_[_0x8167('0x47')]({},_0x417aa1,_0x14f291[_0x8167('0x51')]);return db[_0x8167('0x36')][_0x8167('0x52')](_0x417aa1)['then'](handleEntityNotFound(_0x1062f,null))[_0x8167('0x1c')](respondWithResult(_0x1062f,null))[_0x8167('0x4e')](handleError(_0x1062f,null));};exports[_0x8167('0x53')]=function(_0x46d1d9,_0x30aafe){return db[_0x8167('0x36')][_0x8167('0x53')](_0x46d1d9[_0x8167('0x54')],{})[_0x8167('0x1c')](respondWithResult(_0x30aafe,0xc9))['catch'](handleError(_0x30aafe,null));};exports[_0x8167('0x30')]=function(_0x51e864,_0x25f507){if(_0x51e864[_0x8167('0x54')]['id']){delete _0x51e864[_0x8167('0x54')]['id'];}return db[_0x8167('0x36')][_0x8167('0x52')]({'where':{'id':_0x51e864[_0x8167('0x50')]['id']}})['then'](handleEntityNotFound(_0x25f507,null))[_0x8167('0x1c')](saveUpdates(_0x51e864['body'],null))[_0x8167('0x1c')](respondWithResult(_0x25f507,null))['catch'](handleError(_0x25f507,null));};exports['destroy']=function(_0x4bb804,_0x255ea9){return db['SalesforceAccount'][_0x8167('0x52')]({'where':{'id':_0x4bb804[_0x8167('0x50')]['id']}})['then'](handleEntityNotFound(_0x255ea9,null))[_0x8167('0x1c')](removeEntity(_0x255ea9,null))[_0x8167('0x4e')](handleError(_0x255ea9,null));};exports[_0x8167('0x55')]=function(_0x1322a2,_0xf0ec12,_0x50d23c){var _0x52b0a1={};var _0x42bd84={};var _0x59c776;var _0x50ee15;return db[_0x8167('0x36')][_0x8167('0x56')]({'where':{'id':_0x1322a2[_0x8167('0x50')]['id']}})[_0x8167('0x1c')](handleEntityNotFound(_0xf0ec12,null))[_0x8167('0x1c')](function(_0x175b6c){if(_0x175b6c){_0x59c776=_0x175b6c;_0x42bd84[_0x8167('0x3d')]=_['keys'](db['SalesforceConfiguration'][_0x8167('0x37')]);_0x42bd84[_0x8167('0x3a')]=_[_0x8167('0x39')](_0x1322a2['query']);_0x42bd84[_0x8167('0x3b')]=_[_0x8167('0x3c')](_0x42bd84[_0x8167('0x3d')],_0x42bd84[_0x8167('0x3a')]);_0x52b0a1[_0x8167('0x3e')]=_[_0x8167('0x3c')](_0x42bd84[_0x8167('0x3d')],qs[_0x8167('0x3f')](_0x1322a2[_0x8167('0x3a')][_0x8167('0x3f')]));_0x52b0a1[_0x8167('0x3e')]=_0x52b0a1[_0x8167('0x3e')][_0x8167('0x40')]?_0x52b0a1[_0x8167('0x3e')]:_0x42bd84[_0x8167('0x3d')];_0x52b0a1['order']=qs[_0x8167('0x43')](_0x1322a2[_0x8167('0x3a')]['sort']);_0x52b0a1[_0x8167('0x46')]=qs[_0x8167('0x3b')](_['pick'](_0x1322a2[_0x8167('0x3a')],_0x42bd84['filters']));if(_0x1322a2[_0x8167('0x3a')][_0x8167('0x45')]){_0x52b0a1[_0x8167('0x46')]=_[_0x8167('0x47')](_0x52b0a1[_0x8167('0x46')],{'$or':_[_0x8167('0x35')](_0x52b0a1[_0x8167('0x3e')],function(_0x22b8e3){var _0x2e4e07={};_0x2e4e07[_0x22b8e3]={'$like':'%'+_0x1322a2[_0x8167('0x3a')][_0x8167('0x45')]+'%'};return _0x2e4e07;})});}_0x52b0a1=_['merge']({},_0x52b0a1,_0x1322a2[_0x8167('0x51')]);return _0x59c776[_0x8167('0x55')](_0x52b0a1);}})[_0x8167('0x1c')](function(_0xa519fc){if(_0xa519fc){_0x50ee15=_0xa519fc[_0x8167('0x40')];if(!_0x1322a2[_0x8167('0x3a')][_0x8167('0x41')](_0x8167('0x57'))){_0x52b0a1['limit']=qs[_0x8167('0x2b')](_0x1322a2[_0x8167('0x3a')]['limit']);_0x52b0a1[_0x8167('0x2a')]=qs[_0x8167('0x2a')](_0x1322a2[_0x8167('0x3a')][_0x8167('0x2a')]);}return _0x59c776[_0x8167('0x55')](_0x52b0a1);}})['then'](function(_0x1e9062){if(_0x1e9062){return _0x1e9062?{'count':_0x50ee15,'rows':_0x1e9062}:null;}})[_0x8167('0x1c')](respondWithResult(_0xf0ec12,null))['catch'](handleError(_0xf0ec12,null));};exports[_0x8167('0x58')]=function(_0x47016c,_0x4f944f,_0x390ac5){if(_0x47016c[_0x8167('0x54')]['id']){delete _0x47016c[_0x8167('0x54')]['id'];}return db[_0x8167('0x36')][_0x8167('0x56')]({'where':{'id':_0x47016c[_0x8167('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f944f,null))[_0x8167('0x1c')](function(_0x1125a9){if(_0x1125a9){_0x47016c[_0x8167('0x54')][_0x8167('0x59')]=_0x1125a9['id'];_0x47016c['body'][_0x8167('0x5a')]=integrations[_0x8167('0x5b')](_0x47016c[_0x8167('0x54')]['channel'],_0x47016c[_0x8167('0x54')][_0x8167('0x48')]);_0x47016c['body'][_0x8167('0x5c')]=integrations[_0x8167('0x5d')](_0x47016c['body'][_0x8167('0x5e')],_0x47016c[_0x8167('0x54')]['type']);return db[_0x8167('0x5f')][_0x8167('0x53')](_0x47016c[_0x8167('0x54')],{'include':[{'model':db[_0x8167('0x60')],'as':_0x8167('0x5a')},{'model':db['SalesforceField'],'as':_0x8167('0x5c')}]});}return null;})['then'](respondWithResult(_0x4f944f,null))[_0x8167('0x4e')](handleError(_0x4f944f,null));};exports[_0x8167('0x61')]=function(_0x4e81fb,_0x1b4e4d,_0x27f709){var _0x21c69b;var _0x3ec402='';var _0x3d6e10=_0x8167('0x62');return db['SalesforceAccount'][_0x8167('0x56')]({'where':{'id':_0x4e81fb[_0x8167('0x50')]['id']},'attributes':['id',_0x8167('0x63'),_0x8167('0x64'),_0x8167('0x65'),_0x8167('0x66'),_0x8167('0x67'),_0x8167('0x68')]})[_0x8167('0x1c')](handleEntityNotFound(_0x1b4e4d,null))[_0x8167('0x1c')](function(_0x3896b8){if(_0x3896b8){_0x3ec402=_0x3896b8[_0x8167('0x63')];var _0xd49171=_0x3ec402[_0x8167('0x69')](-0x1);if(_0xd49171==='/'){_0x3ec402=_0x3ec402[_0x8167('0x6a')](0x0,_0x3ec402[_0x8167('0x6b')](_0xd49171));}_0x21c69b=new jsforce[(_0x8167('0x6c'))]({'oauth2':{'loginUrl':_0x3ec402,'clientId':_0x3896b8[_0x8167('0x64')],'clientSecret':_0x3896b8[_0x8167('0x65')]}});return _0x21c69b[_0x8167('0x6d')](_0x3896b8[_0x8167('0x66')],_0x3896b8['password'][_0x8167('0x6e')](_0x3896b8[_0x8167('0x68')]));}})[_0x8167('0x1c')](function(_0x16e8a0){if(_0x16e8a0){if(!_['isNil'](_0x4e81fb[_0x8167('0x3a')][_0x8167('0x6f')])){_0x3d6e10=_0x4e81fb[_0x8167('0x3a')]['ticketType'];}return _0x21c69b[_0x8167('0x70')](_0x3d6e10)[_0x8167('0x71')]();}})[_0x8167('0x1c')](function(_0x4544b3){var _0x4d5075=['OwnerId',_0x8167('0x72'),_0x8167('0x73'),'IsRecurrence',_0x8167('0x74'),_0x8167('0x75')];var _0x53d018=[_0x8167('0x76'),_0x8167('0x77'),_0x8167('0x78'),_0x8167('0x79'),_0x8167('0x7a'),_0x8167('0x7b'),_0x8167('0x7c')];if(_0x4544b3){_[_0x8167('0x7d')](_0x4544b3[_0x8167('0x3f')],function(_0x347191){return _0x4d5075[_0x8167('0x7e')](_0x347191[_0x8167('0x33')])||!_0x53d018[_0x8167('0x7e')](_0x347191[_0x8167('0x48')]);});return{'count':_0x4544b3[_0x8167('0x3f')]['length'],'rows':_[_0x8167('0x35')](_0x4544b3[_0x8167('0x3f')],function(_0x371a46){return{'id':_0x371a46[_0x8167('0x33')],'name':_0x371a46['label'],'custom':_0x371a46[_0x8167('0x7f')],'options':_0x371a46[_0x8167('0x80')]['length']>0x0?_[_0x8167('0x35')](_0x371a46[_0x8167('0x80')],function(_0x48de24){return{'name':_0x48de24[_0x8167('0x81')],'value':_0x48de24[_0x8167('0x82')]};}):_0x371a46[_0x8167('0x48')]==_0x8167('0x79')?[{'name':_0x8167('0x83'),'value':_0x8167('0x84')},{'name':_0x8167('0x85'),'value':_0x8167('0x86')}]:[]};})};}})[_0x8167('0x1c')](respondWithResult(_0x1b4e4d,null))[_0x8167('0x4e')](function(_0xa4a57a){var _0xb6017e=_0x4e81fb['query'][_0x8167('0x87')]?0x1f4:_0xa4a57a['statusCode']||0x1f4;logger[_0x8167('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x8167('0x61'),_0xb6017e,JSON[_0x8167('0x22')](_0xa4a57a));delete _0xa4a57a[_0x8167('0x33')];if(_0xb6017e===0x191){_0xb6017e=0x190;}_0x1b4e4d[_0x8167('0x27')](_0xb6017e)['send'](_0x4e81fb[_0x8167('0x3a')]['test']?{'message':_0x8167('0x88'),'statusCode':_0xa4a57a[_0x8167('0x89')]}:_0xa4a57a);});}; \ No newline at end of file +var _0xfa94=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','json','reject','save','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SalesforceAccount','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','findOne','rawAttributes','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','password','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','boolean','textarea','remove','includes','label','picklistValues','value','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x52aa29,_0x4313cb){var _0x4820a2=function(_0x342af9){while(--_0x342af9){_0x52aa29['push'](_0x52aa29['shift']());}};_0x4820a2(++_0x4313cb);}(_0xfa94,0x1f2));var _0x4fa9=function(_0x485c9f,_0x399a20){_0x485c9f=_0x485c9f-0x0;var _0x2ba76e=_0xfa94[_0x485c9f];return _0x2ba76e;};'use strict';var pdf=require(_0x4fa9('0x0'));var emlformat=require(_0x4fa9('0x1'));var rimraf=require(_0x4fa9('0x2'));var zipdir=require(_0x4fa9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x4'));var moment=require(_0x4fa9('0x5'));var BPromise=require(_0x4fa9('0x6'));var Mustache=require(_0x4fa9('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4fa9('0x8'));var csv=require('to-csv');var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4fa9('0xa'));var crypto=require(_0x4fa9('0xb'));var jsforce=require(_0x4fa9('0xc'));var deskjs=require(_0x4fa9('0xd'));var toCsv=require(_0x4fa9('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4fa9('0xf'));var authService=require(_0x4fa9('0x10'));var qs=require(_0x4fa9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fa9('0x12'));var logger=require(_0x4fa9('0x13'))(_0x4fa9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4fa9('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4fa9('0x16'));var jayson=require(_0x4fa9('0x17'));var client=jayson['client'][_0x4fa9('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x51a848,_0x26e951,_0x41f382,_0x387ae6){return new BPromise(function(_0xfcc8b1,_0x110ad1){var _0x8cb141=_0x387ae6||client;return _0x8cb141['request'](_0x51a848,_0x41f382)[_0x4fa9('0x19')](function(_0x14d620){logger[_0x4fa9('0x1a')](_0x4fa9('0x1b'),_0x26e951,_0x4fa9('0x1c'));logger['debug'](_0x4fa9('0x1d'),_0x26e951,'request\x20sent',JSON[_0x4fa9('0x1e')](_0x14d620));if(_0x14d620[_0x4fa9('0x1f')]){if(_0x14d620[_0x4fa9('0x1f')][_0x4fa9('0x20')]===0x1f4){logger['error'](_0x4fa9('0x1b'),_0x26e951,_0x14d620[_0x4fa9('0x1f')][_0x4fa9('0x21')]);return _0x110ad1(_0x14d620['error'][_0x4fa9('0x21')]);}logger[_0x4fa9('0x1f')](_0x4fa9('0x1b'),_0x26e951,_0x14d620[_0x4fa9('0x1f')][_0x4fa9('0x21')]);return _0xfcc8b1(_0x14d620[_0x4fa9('0x1f')][_0x4fa9('0x21')]);}else{logger[_0x4fa9('0x1a')]('SalesforceAccount,\x20%s,\x20%s',_0x26e951,_0x4fa9('0x1c'));_0xfcc8b1(_0x14d620[_0x4fa9('0x22')][_0x4fa9('0x21')]);}})['catch'](function(_0x4abcac){logger[_0x4fa9('0x1f')](_0x4fa9('0x1b'),_0x26e951,_0x4abcac);_0x110ad1(_0x4abcac);});});}function respondWithStatusCode(_0x15650c,_0x5d6bd4){_0x5d6bd4=_0x5d6bd4||0xcc;return function(_0x2de40b){if(_0x2de40b){return _0x15650c[_0x4fa9('0x23')](_0x5d6bd4);}return _0x15650c[_0x4fa9('0x24')](_0x5d6bd4)[_0x4fa9('0x25')]();};}function respondWithResult(_0x536030,_0xd1f1c4){_0xd1f1c4=_0xd1f1c4||0xc8;return function(_0x2c84c5){if(_0x2c84c5){return _0x536030[_0x4fa9('0x24')](_0xd1f1c4)['json'](_0x2c84c5);}};}function respondWithFilteredResult(_0x20d5a8,_0x3fff09){return function(_0x286dfb){if(_0x286dfb){var _0x4e49cd=_0x286dfb['count'],_0x483257=_0x3fff09['offset'],_0x51b108=_0x3fff09[_0x4fa9('0x26')]+_0x3fff09[_0x4fa9('0x27')],_0x59592e;if(_0x51b108>=_0x4e49cd){_0x51b108=_0x4e49cd;_0x59592e=0xc8;}else{_0x59592e=0xce;}_0x20d5a8['status'](_0x59592e);return _0x20d5a8[_0x4fa9('0x28')]('Content-Range',_0x483257+'-'+_0x51b108+'/'+_0x4e49cd)[_0x4fa9('0x29')](_0x286dfb);}return null;};}function patchUpdates(_0x4f3605){return function(_0x1b686b){try{jsonpatch['apply'](_0x1b686b,_0x4f3605,!![]);}catch(_0x982a3b){return BPromise[_0x4fa9('0x2a')](_0x982a3b);}return _0x1b686b[_0x4fa9('0x2b')]();};}function saveUpdates(_0x58173b,_0xa82e38){return function(_0x4f1f08){if(_0x4f1f08){return _0x4f1f08[_0x4fa9('0x2c')](_0x58173b)['then'](function(_0x3555ec){return _0x3555ec;});}return null;};}function removeEntity(_0xb006eb,_0x3e926b){return function(_0x11c5bd){if(_0x11c5bd){return _0x11c5bd[_0x4fa9('0x2d')]()[_0x4fa9('0x19')](function(){_0xb006eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2575,_0x2afe2c){return function(_0x5df69a){if(!_0x5df69a){_0x2d2575[_0x4fa9('0x23')](0x194);}return _0x5df69a;};}function handleError(_0x4e48eb,_0x11e2b3){_0x11e2b3=_0x11e2b3||0x1f4;return function(_0x445f3b){logger['error'](_0x445f3b[_0x4fa9('0x2e')]);if(_0x445f3b[_0x4fa9('0x2f')]){delete _0x445f3b[_0x4fa9('0x2f')];}_0x4e48eb['status'](_0x11e2b3)[_0x4fa9('0x30')](_0x445f3b);};}exports[_0x4fa9('0x31')]=function(_0x3dac1a,_0x5bc426){var _0x3bed76={},_0x47b57b={},_0x55c134={'count':0x0,'rows':[]};var _0x288fa3=_[_0x4fa9('0x32')](db['SalesforceAccount']['rawAttributes'],function(_0x21fa08){return{'name':_0x21fa08[_0x4fa9('0x33')],'type':_0x21fa08['type'][_0x4fa9('0x34')]};});_0x47b57b[_0x4fa9('0x35')]=_['map'](_0x288fa3,_0x4fa9('0x2f'));_0x47b57b[_0x4fa9('0x36')]=_[_0x4fa9('0x37')](_0x3dac1a[_0x4fa9('0x36')]);_0x47b57b[_0x4fa9('0x38')]=_[_0x4fa9('0x39')](_0x47b57b['model'],_0x47b57b[_0x4fa9('0x36')]);_0x3bed76['attributes']=_['intersection'](_0x47b57b[_0x4fa9('0x35')],qs['fields'](_0x3dac1a[_0x4fa9('0x36')]['fields']));_0x3bed76[_0x4fa9('0x3a')]=_0x3bed76[_0x4fa9('0x3a')]['length']?_0x3bed76[_0x4fa9('0x3a')]:_0x47b57b['model'];if(!_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x3b')]('nolimit')){_0x3bed76[_0x4fa9('0x27')]=qs['limit'](_0x3dac1a['query'][_0x4fa9('0x27')]);_0x3bed76[_0x4fa9('0x26')]=qs['offset'](_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x26')]);}_0x3bed76[_0x4fa9('0x3c')]=qs['sort'](_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x3d')]);_0x3bed76['where']=qs[_0x4fa9('0x38')](_[_0x4fa9('0x3e')](_0x3dac1a[_0x4fa9('0x36')],_0x47b57b[_0x4fa9('0x38')]),_0x288fa3);if(_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x3f')]){_0x3bed76[_0x4fa9('0x40')]=_[_0x4fa9('0x41')](_0x3bed76[_0x4fa9('0x40')],{'$or':_[_0x4fa9('0x32')](_0x288fa3,function(_0x3597f3){if(_0x3597f3[_0x4fa9('0x42')]!==_0x4fa9('0x43')){var _0xd0c9={};_0xd0c9[_0x3597f3[_0x4fa9('0x2f')]]={'$like':'%'+_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x3f')]+'%'};return _0xd0c9;}})});}_0x3bed76=_[_0x4fa9('0x41')]({},_0x3bed76,_0x3dac1a[_0x4fa9('0x44')]);var _0x3daf11={'where':_0x3bed76[_0x4fa9('0x40')]};return db[_0x4fa9('0x45')][_0x4fa9('0x46')](_0x3daf11)['then'](function(_0x3842d1){_0x55c134[_0x4fa9('0x46')]=_0x3842d1;if(_0x3dac1a[_0x4fa9('0x36')][_0x4fa9('0x47')]){_0x3bed76[_0x4fa9('0x48')]=[{'all':!![]}];}return db[_0x4fa9('0x45')][_0x4fa9('0x49')](_0x3bed76);})[_0x4fa9('0x19')](function(_0x66fbb7){_0x55c134[_0x4fa9('0x4a')]=_0x66fbb7;return _0x55c134;})['then'](respondWithFilteredResult(_0x5bc426,_0x3bed76))[_0x4fa9('0x4b')](handleError(_0x5bc426,null));};exports[_0x4fa9('0x4c')]=function(_0x22f2ad,_0x2505e6){var _0x27fd79={'raw':![],'where':{'id':_0x22f2ad[_0x4fa9('0x4d')]['id']}},_0x358d1f={};_0x358d1f[_0x4fa9('0x35')]=_[_0x4fa9('0x37')](db[_0x4fa9('0x45')]['rawAttributes']);_0x358d1f[_0x4fa9('0x36')]=_[_0x4fa9('0x37')](_0x22f2ad[_0x4fa9('0x36')]);_0x358d1f['filters']=_['intersection'](_0x358d1f[_0x4fa9('0x35')],_0x358d1f[_0x4fa9('0x36')]);_0x27fd79[_0x4fa9('0x3a')]=_[_0x4fa9('0x39')](_0x358d1f[_0x4fa9('0x35')],qs[_0x4fa9('0x4e')](_0x22f2ad['query'][_0x4fa9('0x4e')]));_0x27fd79[_0x4fa9('0x3a')]=_0x27fd79[_0x4fa9('0x3a')]['length']?_0x27fd79[_0x4fa9('0x3a')]:_0x358d1f[_0x4fa9('0x35')];if(_0x22f2ad[_0x4fa9('0x36')]['includeAll']){_0x27fd79[_0x4fa9('0x48')]=[{'all':!![]}];}_0x27fd79=_[_0x4fa9('0x41')]({},_0x27fd79,_0x22f2ad[_0x4fa9('0x44')]);return db['SalesforceAccount'][_0x4fa9('0x4f')](_0x27fd79)[_0x4fa9('0x19')](handleEntityNotFound(_0x2505e6,null))['then'](respondWithResult(_0x2505e6,null))['catch'](handleError(_0x2505e6,null));};exports[_0x4fa9('0x50')]=function(_0x79331,_0xb1444f){return db[_0x4fa9('0x45')][_0x4fa9('0x50')](_0x79331[_0x4fa9('0x51')],{})[_0x4fa9('0x19')](respondWithResult(_0xb1444f,0xc9))[_0x4fa9('0x4b')](handleError(_0xb1444f,null));};exports['update']=function(_0x4eb665,_0x490afe){if(_0x4eb665['body']['id']){delete _0x4eb665['body']['id'];}return db[_0x4fa9('0x45')][_0x4fa9('0x4f')]({'where':{'id':_0x4eb665[_0x4fa9('0x4d')]['id']}})[_0x4fa9('0x19')](handleEntityNotFound(_0x490afe,null))[_0x4fa9('0x19')](saveUpdates(_0x4eb665[_0x4fa9('0x51')],null))[_0x4fa9('0x19')](respondWithResult(_0x490afe,null))[_0x4fa9('0x4b')](handleError(_0x490afe,null));};exports[_0x4fa9('0x2d')]=function(_0x5273b6,_0x5bca89){return db[_0x4fa9('0x45')]['find']({'where':{'id':_0x5273b6[_0x4fa9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5bca89,null))[_0x4fa9('0x19')](removeEntity(_0x5bca89,null))['catch'](handleError(_0x5bca89,null));};exports[_0x4fa9('0x52')]=function(_0x206d20,_0x19a527,_0x9299a3){var _0x821a3b={};var _0x4c847c={};var _0x12c595;var _0x1e83b0;return db['SalesforceAccount'][_0x4fa9('0x53')]({'where':{'id':_0x206d20['params']['id']}})[_0x4fa9('0x19')](handleEntityNotFound(_0x19a527,null))[_0x4fa9('0x19')](function(_0x2b4d9b){if(_0x2b4d9b){_0x12c595=_0x2b4d9b;_0x4c847c[_0x4fa9('0x35')]=_[_0x4fa9('0x37')](db['SalesforceConfiguration'][_0x4fa9('0x54')]);_0x4c847c[_0x4fa9('0x36')]=_[_0x4fa9('0x37')](_0x206d20[_0x4fa9('0x36')]);_0x4c847c[_0x4fa9('0x38')]=_[_0x4fa9('0x39')](_0x4c847c[_0x4fa9('0x35')],_0x4c847c[_0x4fa9('0x36')]);_0x821a3b[_0x4fa9('0x3a')]=_[_0x4fa9('0x39')](_0x4c847c[_0x4fa9('0x35')],qs[_0x4fa9('0x4e')](_0x206d20['query'][_0x4fa9('0x4e')]));_0x821a3b[_0x4fa9('0x3a')]=_0x821a3b[_0x4fa9('0x3a')]['length']?_0x821a3b[_0x4fa9('0x3a')]:_0x4c847c[_0x4fa9('0x35')];_0x821a3b[_0x4fa9('0x3c')]=qs[_0x4fa9('0x3d')](_0x206d20[_0x4fa9('0x36')][_0x4fa9('0x3d')]);_0x821a3b[_0x4fa9('0x40')]=qs[_0x4fa9('0x38')](_['pick'](_0x206d20[_0x4fa9('0x36')],_0x4c847c['filters']));if(_0x206d20[_0x4fa9('0x36')][_0x4fa9('0x3f')]){_0x821a3b[_0x4fa9('0x40')]=_[_0x4fa9('0x41')](_0x821a3b['where'],{'$or':_[_0x4fa9('0x32')](_0x821a3b[_0x4fa9('0x3a')],function(_0x7ce35d){var _0x1e4ceb={};_0x1e4ceb[_0x7ce35d]={'$like':'%'+_0x206d20['query'][_0x4fa9('0x3f')]+'%'};return _0x1e4ceb;})});}_0x821a3b=_[_0x4fa9('0x41')]({},_0x821a3b,_0x206d20['options']);return _0x12c595[_0x4fa9('0x52')](_0x821a3b);}})[_0x4fa9('0x19')](function(_0x5baea4){if(_0x5baea4){_0x1e83b0=_0x5baea4[_0x4fa9('0x55')];if(!_0x206d20[_0x4fa9('0x36')][_0x4fa9('0x3b')](_0x4fa9('0x56'))){_0x821a3b[_0x4fa9('0x27')]=qs[_0x4fa9('0x27')](_0x206d20[_0x4fa9('0x36')]['limit']);_0x821a3b['offset']=qs[_0x4fa9('0x26')](_0x206d20[_0x4fa9('0x36')]['offset']);}return _0x12c595[_0x4fa9('0x52')](_0x821a3b);}})[_0x4fa9('0x19')](function(_0xf8a640){if(_0xf8a640){return _0xf8a640?{'count':_0x1e83b0,'rows':_0xf8a640}:null;}})[_0x4fa9('0x19')](respondWithResult(_0x19a527,null))[_0x4fa9('0x4b')](handleError(_0x19a527,null));};exports[_0x4fa9('0x57')]=function(_0x5f43e8,_0x43e9ff,_0x1e021f){if(_0x5f43e8[_0x4fa9('0x51')]['id']){delete _0x5f43e8[_0x4fa9('0x51')]['id'];}return db[_0x4fa9('0x45')][_0x4fa9('0x53')]({'where':{'id':_0x5f43e8['params']['id']}})['then'](handleEntityNotFound(_0x43e9ff,null))[_0x4fa9('0x19')](function(_0x397215){if(_0x397215){_0x5f43e8['body'][_0x4fa9('0x58')]=_0x397215['id'];_0x5f43e8[_0x4fa9('0x51')][_0x4fa9('0x59')]=integrations[_0x4fa9('0x5a')](_0x5f43e8['body'][_0x4fa9('0x5b')],_0x5f43e8[_0x4fa9('0x51')]['type']);_0x5f43e8[_0x4fa9('0x51')][_0x4fa9('0x5c')]=integrations['getDescriptions'](_0x5f43e8[_0x4fa9('0x51')][_0x4fa9('0x5b')],_0x5f43e8[_0x4fa9('0x51')]['type']);return db[_0x4fa9('0x5d')][_0x4fa9('0x50')](_0x5f43e8[_0x4fa9('0x51')],{'include':[{'model':db[_0x4fa9('0x5e')],'as':_0x4fa9('0x59')},{'model':db[_0x4fa9('0x5e')],'as':_0x4fa9('0x5c')}]});}return null;})[_0x4fa9('0x19')](respondWithResult(_0x43e9ff,null))['catch'](handleError(_0x43e9ff,null));};exports[_0x4fa9('0x5f')]=function(_0x2b1837,_0x1fa107,_0x52466f){var _0x191f65;var _0x5a58db='';var _0x4332bd=_0x4fa9('0x60');return db[_0x4fa9('0x45')][_0x4fa9('0x53')]({'where':{'id':_0x2b1837[_0x4fa9('0x4d')]['id']},'attributes':['id',_0x4fa9('0x61'),'clientId',_0x4fa9('0x62'),_0x4fa9('0x63'),'password',_0x4fa9('0x64')]})[_0x4fa9('0x19')](handleEntityNotFound(_0x1fa107,null))['then'](function(_0x5723c5){if(_0x5723c5){_0x5a58db=_0x5723c5['remoteUri'];var _0x3b5fff=_0x5a58db[_0x4fa9('0x65')](-0x1);if(_0x3b5fff==='/'){_0x5a58db=_0x5a58db[_0x4fa9('0x66')](0x0,_0x5a58db[_0x4fa9('0x67')](_0x3b5fff));}_0x191f65=new jsforce[(_0x4fa9('0x68'))]({'oauth2':{'loginUrl':_0x5a58db,'clientId':_0x5723c5[_0x4fa9('0x69')],'clientSecret':_0x5723c5[_0x4fa9('0x62')]}});return _0x191f65['login'](_0x5723c5[_0x4fa9('0x63')],_0x5723c5[_0x4fa9('0x6a')]['concat'](_0x5723c5[_0x4fa9('0x64')]));}})[_0x4fa9('0x19')](function(_0x4c08c4){if(_0x4c08c4){if(!_[_0x4fa9('0x6b')](_0x2b1837['query']['ticketType'])){_0x4332bd=_0x2b1837['query'][_0x4fa9('0x6c')];}return _0x191f65[_0x4fa9('0x6d')](_0x4332bd)[_0x4fa9('0x6e')]();}})[_0x4fa9('0x19')](function(_0x3ee576){var _0x1d803d=[_0x4fa9('0x6f'),_0x4fa9('0x70'),_0x4fa9('0x71'),_0x4fa9('0x72'),_0x4fa9('0x73'),'Description'];var _0x50189c=['string','int','picklist',_0x4fa9('0x74'),'email',_0x4fa9('0x75'),'phone'];if(_0x3ee576){_[_0x4fa9('0x76')](_0x3ee576[_0x4fa9('0x4e')],function(_0x14027d){return _0x1d803d[_0x4fa9('0x77')](_0x14027d[_0x4fa9('0x2f')])||!_0x50189c['includes'](_0x14027d[_0x4fa9('0x42')]);});return{'count':_0x3ee576['fields'][_0x4fa9('0x55')],'rows':_[_0x4fa9('0x32')](_0x3ee576[_0x4fa9('0x4e')],function(_0xac9f6f){return{'id':_0xac9f6f['name'],'name':_0xac9f6f[_0x4fa9('0x78')],'custom':_0xac9f6f['custom'],'options':_0xac9f6f[_0x4fa9('0x79')]['length']>0x0?_[_0x4fa9('0x32')](_0xac9f6f[_0x4fa9('0x79')],function(_0x22fc77){return{'name':_0x22fc77[_0x4fa9('0x78')],'value':_0x22fc77[_0x4fa9('0x7a')]};}):_0xac9f6f[_0x4fa9('0x42')]==_0x4fa9('0x74')?[{'name':_0x4fa9('0x7b'),'value':_0x4fa9('0x7c')},{'name':_0x4fa9('0x7d'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x1fa107,null))[_0x4fa9('0x4b')](function(_0x436a0a){var _0x2b30ad=_0x2b1837[_0x4fa9('0x36')][_0x4fa9('0x7e')]?0x1f4:_0x436a0a['statusCode']||0x1f4;logger['error'](_0x4fa9('0x7f'),_0x4fa9('0x5f'),_0x2b30ad,JSON[_0x4fa9('0x1e')](_0x436a0a));delete _0x436a0a[_0x4fa9('0x2f')];if(_0x2b30ad===0x191){_0x2b30ad=0x190;}_0x1fa107[_0x4fa9('0x24')](_0x2b30ad)['send'](_0x2b1837['query'][_0x4fa9('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x436a0a[_0x4fa9('0x80')]}:_0x436a0a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fd50c4e..a1e330d 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 _0xbfd4=['../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfd4,0x16d));var _0x4bfd=function(_0x55e59b,_0x4ab5e2){_0x55e59b=_0x55e59b-0x0;var _0x20cbc4=_0xbfd4[_0x55e59b];return _0x20cbc4;};'use strict';var _=require(_0x4bfd('0x0'));var util=require('util');var logger=require(_0x4bfd('0x1'))(_0x4bfd('0x2'));var moment=require(_0x4bfd('0x3'));var BPromise=require('bluebird');var rp=require(_0x4bfd('0x4'));var fs=require('fs');var path=require(_0x4bfd('0x5'));var rimraf=require(_0x4bfd('0x6'));var config=require(_0x4bfd('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x4bfd('0x8'));module['exports']=function(_0x5a8ebe,_0x2a5587){return _0x5a8ebe[_0x4bfd('0x9')](_0x4bfd('0xa'),attributes,{'tableName':_0x4bfd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4c6=['../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xc4c6,0x1b1));var _0x6c4c=function(_0x100d34,_0x104cd3){_0x100d34=_0x100d34-0x0;var _0x538a42=_0xc4c6[_0x100d34];return _0x538a42;};'use strict';var _=require(_0x6c4c('0x0'));var util=require(_0x6c4c('0x1'));var logger=require(_0x6c4c('0x2'))(_0x6c4c('0x3'));var moment=require(_0x6c4c('0x4'));var BPromise=require(_0x6c4c('0x5'));var rp=require(_0x6c4c('0x6'));var fs=require('fs');var path=require(_0x6c4c('0x7'));var rimraf=require(_0x6c4c('0x8'));var config=require(_0x6c4c('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x6c4c('0xa'));module[_0x6c4c('0xb')]=function(_0x236ee8,_0x1c4162){return _0x236ee8['define'](_0x6c4c('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 61b76a5..b275a1d 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 _0x34e5=['where','attributes','limit','include','map','model','debug','catch','ShowSalesforceAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x34e5,0x172));var _0x534e=function(_0x4df03c,_0x3e4031){_0x4df03c=_0x4df03c-0x0;var _0x3b2d9e=_0x34e5[_0x4df03c];return _0x3b2d9e;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var moment=require('moment');var BPromise=require(_0x534e('0x1'));var rs=require(_0x534e('0x2'));var fs=require('fs');var Redis=require(_0x534e('0x3'));var db=require(_0x534e('0x4'))['db'];var utils=require(_0x534e('0x5'));var logger=require('../../config/logger')(_0x534e('0x6'));var config=require(_0x534e('0x7'));var jayson=require(_0x534e('0x8'));var client=jayson[_0x534e('0x9')][_0x534e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0370,_0x2760e7,_0x5620d4){return new BPromise(function(_0x24d562,_0x929597){return client[_0x534e('0xb')](_0x2d0370,_0x5620d4)['then'](function(_0x59fcff){logger[_0x534e('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x2760e7,_0x534e('0xd'));logger['debug'](_0x534e('0xe'),_0x2760e7,_0x534e('0xd'),JSON[_0x534e('0xf')](_0x59fcff));if(_0x59fcff['error']){if(_0x59fcff[_0x534e('0x10')][_0x534e('0x11')]===0x1f4){logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x59fcff[_0x534e('0x10')]['message']);return _0x929597(_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);}logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);return _0x24d562(_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);}else{logger[_0x534e('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x2760e7,_0x534e('0xd'));_0x24d562(_0x59fcff[_0x534e('0x14')]['message']);}})['catch'](function(_0x2de9d0){logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x2de9d0);_0x929597(_0x2de9d0);});});}exports[_0x534e('0x15')]=function(_0x22bc92){var _0x26938d=this;return new Promise(function(_0x100751,_0x54d399){return db[_0x534e('0x16')][_0x534e('0x17')]({'raw':_0x22bc92[_0x534e('0x18')]?_0x22bc92[_0x534e('0x18')][_0x534e('0x19')]===undefined?!![]:![]:!![],'where':_0x22bc92['options']?_0x22bc92[_0x534e('0x18')][_0x534e('0x1a')]||null:null,'attributes':_0x22bc92[_0x534e('0x18')]?_0x22bc92[_0x534e('0x18')][_0x534e('0x1b')]||null:null,'limit':_0x22bc92[_0x534e('0x18')]?_0x22bc92[_0x534e('0x18')][_0x534e('0x1c')]||null:null,'include':_0x22bc92[_0x534e('0x18')]?_0x22bc92['options'][_0x534e('0x1d')]?_[_0x534e('0x1e')](_0x22bc92[_0x534e('0x18')][_0x534e('0x1d')],function(_0x324205){return{'model':db[_0x324205[_0x534e('0x1f')]],'as':_0x324205['as'],'attributes':_0x324205[_0x534e('0x1b')],'include':_0x324205[_0x534e('0x1d')]?_['map'](_0x324205[_0x534e('0x1d')],function(_0x588c08){return{'model':db[_0x588c08[_0x534e('0x1f')]],'as':_0x588c08['as'],'attributes':_0x588c08[_0x534e('0x1b')],'include':_0x588c08[_0x534e('0x1d')]?_[_0x534e('0x1e')](_0x588c08[_0x534e('0x1d')],function(_0x57b216){return{'model':db[_0x57b216[_0x534e('0x1f')]],'as':_0x57b216['as'],'attributes':_0x57b216[_0x534e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bd073){logger[_0x534e('0xc')]('GetSalesforceAccount',_0x22bc92);logger[_0x534e('0x20')](_0x534e('0x15'),_0x22bc92,JSON[_0x534e('0xf')](_0x4bd073));_0x100751(_0x4bd073);})[_0x534e('0x21')](function(_0x15be5c){logger[_0x534e('0x10')](_0x534e('0x15'),_0x15be5c['message'],_0x22bc92);_0x54d399(_0x26938d['error'](0x1f4,_0x15be5c[_0x534e('0x13')]));});});};exports[_0x534e('0x22')]=function(_0x466dfc){var _0x2f1c49=this;return new Promise(function(_0x423502,_0x1efb5b){return db[_0x534e('0x16')][_0x534e('0x23')]({'raw':_0x466dfc[_0x534e('0x18')]?_0x466dfc[_0x534e('0x18')][_0x534e('0x19')]===undefined?!![]:![]:!![],'where':_0x466dfc[_0x534e('0x18')]?_0x466dfc['options'][_0x534e('0x1a')]||null:null,'attributes':_0x466dfc[_0x534e('0x18')]?_0x466dfc['options'][_0x534e('0x1b')]||null:null,'include':_0x466dfc['options']?_0x466dfc[_0x534e('0x18')][_0x534e('0x1d')]?_[_0x534e('0x1e')](_0x466dfc[_0x534e('0x18')]['include'],function(_0x1bb69f){return{'model':db[_0x1bb69f[_0x534e('0x1f')]],'as':_0x1bb69f['as'],'attributes':_0x1bb69f['attributes'],'include':_0x1bb69f['include']?_[_0x534e('0x1e')](_0x1bb69f[_0x534e('0x1d')],function(_0x38785d){return{'model':db[_0x38785d[_0x534e('0x1f')]],'as':_0x38785d['as'],'attributes':_0x38785d['attributes'],'include':_0x38785d[_0x534e('0x1d')]?_['map'](_0x38785d[_0x534e('0x1d')],function(_0x4a5aa1){return{'model':db[_0x4a5aa1[_0x534e('0x1f')]],'as':_0x4a5aa1['as'],'attributes':_0x4a5aa1[_0x534e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5cd1){logger['info']('ShowSalesforceAccount',_0x466dfc);logger['debug']('ShowSalesforceAccount',_0x466dfc,JSON[_0x534e('0xf')](_0x2f5cd1));_0x423502(_0x2f5cd1);})['catch'](function(_0x49f188){logger[_0x534e('0x10')](_0x534e('0x22'),_0x49f188[_0x534e('0x13')],_0x466dfc);_0x1efb5b(_0x2f1c49['error'](0x1f4,_0x49f188[_0x534e('0x13')]));});});}; \ No newline at end of file +var _0x9f62=['limit','include','model','map','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','find','then','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes'];(function(_0xb37505,_0x503bba){var _0x1c2c7c=function(_0x184c27){while(--_0x184c27){_0xb37505['push'](_0xb37505['shift']());}};_0x1c2c7c(++_0x503bba);}(_0x9f62,0x154));var _0x29f6=function(_0x48597a,_0x5baf60){_0x48597a=_0x48597a-0x0;var _0x5e2be2=_0x9f62[_0x48597a];return _0x5e2be2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});}exports['GetSalesforceAccount']=function(_0x2e66d3){var _0x3af478=this;return new Promise(function(_0xb31436,_0x5c8246){return db[_0x29f6('0x11')][_0x29f6('0x12')]({'raw':_0x2e66d3['options']?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x15')]||null:null,'attributes':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3['options'][_0x29f6('0x16')]||null:null,'limit':_0x2e66d3['options']?_0x2e66d3['options'][_0x29f6('0x17')]||null:null,'include':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x18')]?_['map'](_0x2e66d3[_0x29f6('0x13')]['include'],function(_0xd4179c){return{'model':db[_0xd4179c[_0x29f6('0x19')]],'as':_0xd4179c['as'],'attributes':_0xd4179c[_0x29f6('0x16')],'include':_0xd4179c[_0x29f6('0x18')]?_['map'](_0xd4179c[_0x29f6('0x18')],function(_0x4d494f){return{'model':db[_0x4d494f['model']],'as':_0x4d494f['as'],'attributes':_0x4d494f[_0x29f6('0x16')],'include':_0x4d494f[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4d494f[_0x29f6('0x18')],function(_0x84ccb7){return{'model':db[_0x84ccb7[_0x29f6('0x19')]],'as':_0x84ccb7['as'],'attributes':_0x84ccb7[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2183b7){logger[_0x29f6('0x9')](_0x29f6('0x1b'),_0x2e66d3);logger[_0x29f6('0x1c')](_0x29f6('0x1b'),_0x2e66d3,JSON[_0x29f6('0x1d')](_0x2183b7));_0xb31436(_0x2183b7);})[_0x29f6('0x10')](function(_0x17b2f2){logger[_0x29f6('0xd')](_0x29f6('0x1b'),_0x17b2f2[_0x29f6('0xe')],_0x2e66d3);_0x5c8246(_0x3af478[_0x29f6('0xd')](0x1f4,_0x17b2f2[_0x29f6('0xe')]));});});};exports[_0x29f6('0x1e')]=function(_0x375564){var _0x218931=this;return new Promise(function(_0x3a7249,_0x5492c2){return db['SalesforceAccount'][_0x29f6('0x1f')]({'raw':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')]['where']||null:null,'attributes':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x16')]||null:null,'include':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')][_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x375564[_0x29f6('0x13')][_0x29f6('0x18')],function(_0xad83a3){return{'model':db[_0xad83a3[_0x29f6('0x19')]],'as':_0xad83a3['as'],'attributes':_0xad83a3[_0x29f6('0x16')],'include':_0xad83a3[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0xad83a3[_0x29f6('0x18')],function(_0x4e6304){return{'model':db[_0x4e6304['model']],'as':_0x4e6304['as'],'attributes':_0x4e6304[_0x29f6('0x16')],'include':_0x4e6304[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4e6304['include'],function(_0x3e1e25){return{'model':db[_0x3e1e25[_0x29f6('0x19')]],'as':_0x3e1e25['as'],'attributes':_0x3e1e25[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x29f6('0x20')](function(_0x1d2b3c){logger['info'](_0x29f6('0x1e'),_0x375564);logger[_0x29f6('0x1c')](_0x29f6('0x1e'),_0x375564,JSON[_0x29f6('0x1d')](_0x1d2b3c));_0x3a7249(_0x1d2b3c);})['catch'](function(_0x30d747){logger[_0x29f6('0xd')](_0x29f6('0x1e'),_0x30d747[_0x29f6('0xe')],_0x375564);_0x5492c2(_0x218931['error'](0x1f4,_0x30d747['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3cd6b55..7e9370f 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 _0xa5f2=['getFields','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields'];(function(_0x183c76,_0x5e75cc){var _0x2a3673=function(_0x3a60a2){while(--_0x3a60a2){_0x183c76['push'](_0x183c76['shift']());}};_0x2a3673(++_0x5e75cc);}(_0xa5f2,0x1ed));var _0x2a5f=function(_0x52a01f,_0x476c6a){_0x52a01f=_0x52a01f-0x0;var _0x37748f=_0xa5f2[_0x52a01f];return _0x37748f;};'use strict';var multer=require('multer');var util=require(_0x2a5f('0x0'));var path=require(_0x2a5f('0x1'));var timeout=require(_0x2a5f('0x2'));var express=require(_0x2a5f('0x3'));var router=express[_0x2a5f('0x4')]();var auth=require(_0x2a5f('0x5'));var interaction=require(_0x2a5f('0x6'));var config=require(_0x2a5f('0x7'));var controller=require('./intSalesforceConfiguration.controller');router[_0x2a5f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2a5f('0x9'),auth[_0x2a5f('0xa')](),controller[_0x2a5f('0xb')]);router['get'](_0x2a5f('0xc'),auth[_0x2a5f('0xa')](),controller[_0x2a5f('0xd')]);router[_0x2a5f('0x8')]('/:id/subjects',auth[_0x2a5f('0xa')](),controller['getSubjects']);router[_0x2a5f('0x8')](_0x2a5f('0xe'),auth['isAuthenticated'](),controller[_0x2a5f('0xf')]);router[_0x2a5f('0x10')]('/',auth[_0x2a5f('0xa')](),controller[_0x2a5f('0x11')]);router['put'](_0x2a5f('0x9'),auth[_0x2a5f('0xa')](),controller[_0x2a5f('0x12')]);router[_0x2a5f('0x13')](_0x2a5f('0x9'),auth['isAuthenticated'](),controller[_0x2a5f('0x14')]);module[_0x2a5f('0x15')]=router; \ No newline at end of file +var _0xbd9b=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','show'];(function(_0x2d5cf7,_0x27891c){var _0x44399a=function(_0x3ae8cf){while(--_0x3ae8cf){_0x2d5cf7['push'](_0x2d5cf7['shift']());}};_0x44399a(++_0x27891c);}(_0xbd9b,0xfe));var _0xbbd9=function(_0xe93df1,_0x55bfe3){_0xe93df1=_0xe93df1-0x0;var _0x37a10e=_0xbd9b[_0xe93df1];return _0x37a10e;};'use strict';var multer=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var path=require(_0xbbd9('0x2'));var timeout=require(_0xbbd9('0x3'));var express=require('express');var router=express[_0xbbd9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbd9('0x5'));var config=require('../../config/environment');var controller=require(_0xbbd9('0x6'));router[_0xbbd9('0x7')]('/',auth[_0xbbd9('0x8')](),controller['index']);router['get']('/:id',auth[_0xbbd9('0x8')](),controller[_0xbbd9('0x9')]);router[_0xbbd9('0x7')](_0xbbd9('0xa'),auth[_0xbbd9('0x8')](),controller[_0xbbd9('0xb')]);router[_0xbbd9('0x7')](_0xbbd9('0xc'),auth[_0xbbd9('0x8')](),controller[_0xbbd9('0xd')]);router[_0xbbd9('0x7')](_0xbbd9('0xe'),auth[_0xbbd9('0x8')](),controller['getDescriptions']);router[_0xbbd9('0xf')]('/',auth[_0xbbd9('0x8')](),controller[_0xbbd9('0x10')]);router[_0xbbd9('0x11')](_0xbbd9('0x12'),auth[_0xbbd9('0x8')](),controller[_0xbbd9('0x13')]);router[_0xbbd9('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbbd9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c07744f..078f03a 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 _0xc1a2=['ENUM','Task','Case','contact','lead','account_contact_lead','account','nothing','sequelize','STRING'];(function(_0xd637dd,_0x12d25d){var _0x327cc1=function(_0x14c75e){while(--_0x14c75e){_0xd637dd['push'](_0xd637dd['shift']());}};_0x327cc1(++_0x12d25d);}(_0xc1a2,0x148));var _0x2c1a=function(_0x145229,_0x50dcd1){_0x145229=_0x145229-0x0;var _0xc9a6cf=_0xc1a2[_0x145229];return _0xc9a6cf;};'use strict';var Sequelize=require(_0x2c1a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c1a('0x1')]},'ticketType':{'type':Sequelize[_0x2c1a('0x2')](_0x2c1a('0x3'),_0x2c1a('0x4')),'defaultValue':_0x2c1a('0x3')},'moduleSearch':{'type':Sequelize[_0x2c1a('0x2')]('contact_lead',_0x2c1a('0x5'),_0x2c1a('0x6'),_0x2c1a('0x7'),_0x2c1a('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2c1a('0x2')](_0x2c1a('0x9'),_0x2c1a('0x5'),'lead',_0x2c1a('0x8')),'defaultValue':_0x2c1a('0x6')},'leadId':{'type':Sequelize[_0x2c1a('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x2c1a('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x2c1a('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x2c1a('0x1')]}}; \ No newline at end of file +var _0x4f28=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x4f28,0x6e));var _0x84f2=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x4f28[_0x42c118];return _0x112ebd;};'use strict';var Sequelize=require(_0x84f2('0x0'));module[_0x84f2('0x1')]={'name':{'type':Sequelize[_0x84f2('0x2')]},'description':{'type':Sequelize[_0x84f2('0x2')]},'ticketType':{'type':Sequelize[_0x84f2('0x3')](_0x84f2('0x4'),_0x84f2('0x5')),'defaultValue':_0x84f2('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x84f2('0x6'),_0x84f2('0x7'),_0x84f2('0x8'),'account_contact_lead',_0x84f2('0x9')),'defaultValue':_0x84f2('0x6')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x84f2('0x7'),_0x84f2('0x8'),'account'),'defaultValue':_0x84f2('0x8')},'leadId':{'type':Sequelize[_0x84f2('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x84f2('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x84f2('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x84f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d51a8de..1b63b5b 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 _0x0501=['merge','options','SalesforceConfiguration','count','includeAll','rows','intersection','include','create','body','params','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','json','offset','set','Content-Range','reject','save','destroy','end','stack','name','index','map','rawAttributes','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter'];(function(_0x3493ec,_0x91e7e4){var _0x2ae8af=function(_0x49e161){while(--_0x49e161){_0x3493ec['push'](_0x3493ec['shift']());}};_0x2ae8af(++_0x91e7e4);}(_0x0501,0x66));var _0x1050=function(_0x244f5d,_0x3c98c6){_0x244f5d=_0x244f5d-0x0;var _0x1a3886=_0x0501[_0x244f5d];return _0x1a3886;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1050('0x0'));var zipdir=require(_0x1050('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1050('0x2'));var moment=require(_0x1050('0x3'));var BPromise=require(_0x1050('0x4'));var Mustache=require(_0x1050('0x5'));var util=require('util');var path=require(_0x1050('0x6'));var sox=require(_0x1050('0x7'));var csv=require('to-csv');var ejs=require(_0x1050('0x8'));var fs=require('fs');var _=require(_0x1050('0x9'));var squel=require('squel');var crypto=require(_0x1050('0xa'));var jsforce=require(_0x1050('0xb'));var deskjs=require(_0x1050('0xc'));var toCsv=require(_0x1050('0xd'));var querystring=require(_0x1050('0xe'));var Papa=require(_0x1050('0xf'));var Redis=require(_0x1050('0x10'));var authService=require(_0x1050('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1050('0x12'));var logger=require(_0x1050('0x13'))('api');var utils=require(_0x1050('0x14'));var config=require(_0x1050('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1050('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x1050('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2adb95,_0x53d551,_0x2eaba8,_0x4fc770){return new BPromise(function(_0xf28e89,_0x4a2330){var _0x1cfb73=_0x4fc770||client;return _0x1cfb73[_0x1050('0x18')](_0x2adb95,_0x2eaba8)[_0x1050('0x19')](function(_0x4d51d0){logger[_0x1050('0x1a')]('SalesforceConfiguration,\x20%s,\x20%s',_0x53d551,'request\x20sent');logger[_0x1050('0x1b')](_0x1050('0x1c'),_0x53d551,'request\x20sent',JSON[_0x1050('0x1d')](_0x4d51d0));if(_0x4d51d0[_0x1050('0x1e')]){if(_0x4d51d0[_0x1050('0x1e')][_0x1050('0x1f')]===0x1f4){logger[_0x1050('0x1e')](_0x1050('0x20'),_0x53d551,_0x4d51d0[_0x1050('0x1e')][_0x1050('0x21')]);return _0x4a2330(_0x4d51d0[_0x1050('0x1e')][_0x1050('0x21')]);}logger[_0x1050('0x1e')](_0x1050('0x20'),_0x53d551,_0x4d51d0[_0x1050('0x1e')][_0x1050('0x21')]);return _0xf28e89(_0x4d51d0['error'][_0x1050('0x21')]);}else{logger[_0x1050('0x1a')](_0x1050('0x20'),_0x53d551,_0x1050('0x22'));_0xf28e89(_0x4d51d0['result']['message']);}})[_0x1050('0x23')](function(_0x24502a){logger['error'](_0x1050('0x20'),_0x53d551,_0x24502a);_0x4a2330(_0x24502a);});});}function respondWithStatusCode(_0x1ea074,_0x86ae3f){_0x86ae3f=_0x86ae3f||0xcc;return function(_0x1c3914){if(_0x1c3914){return _0x1ea074[_0x1050('0x24')](_0x86ae3f);}return _0x1ea074[_0x1050('0x25')](_0x86ae3f)['end']();};}function respondWithResult(_0x1afa54,_0x1644a3){_0x1644a3=_0x1644a3||0xc8;return function(_0x5866d1){if(_0x5866d1){return _0x1afa54[_0x1050('0x25')](_0x1644a3)[_0x1050('0x26')](_0x5866d1);}};}function respondWithFilteredResult(_0x418e28,_0x266696){return function(_0xf3aeb4){if(_0xf3aeb4){var _0x168b68=_0xf3aeb4['count'],_0x39c6cd=_0x266696[_0x1050('0x27')],_0x31a377=_0x266696['offset']+_0x266696['limit'],_0x42c1ea;if(_0x31a377>=_0x168b68){_0x31a377=_0x168b68;_0x42c1ea=0xc8;}else{_0x42c1ea=0xce;}_0x418e28[_0x1050('0x25')](_0x42c1ea);return _0x418e28[_0x1050('0x28')](_0x1050('0x29'),_0x39c6cd+'-'+_0x31a377+'/'+_0x168b68)[_0x1050('0x26')](_0xf3aeb4);}return null;};}function patchUpdates(_0x31948a){return function(_0x45c2b0){try{jsonpatch['apply'](_0x45c2b0,_0x31948a,!![]);}catch(_0x3105da){return BPromise[_0x1050('0x2a')](_0x3105da);}return _0x45c2b0[_0x1050('0x2b')]();};}function saveUpdates(_0x4d179b,_0x20dfd3){return function(_0x382d3c){if(_0x382d3c){return _0x382d3c['update'](_0x4d179b)[_0x1050('0x19')](function(_0x2f5c82){return _0x2f5c82;});}return null;};}function removeEntity(_0x149499,_0x4df098){return function(_0x50323b){if(_0x50323b){return _0x50323b[_0x1050('0x2c')]()[_0x1050('0x19')](function(){_0x149499[_0x1050('0x25')](0xcc)[_0x1050('0x2d')]();});}};}function handleEntityNotFound(_0x2377a8,_0xf4c3b6){return function(_0x1f4db1){if(!_0x1f4db1){_0x2377a8[_0x1050('0x24')](0x194);}return _0x1f4db1;};}function handleError(_0x1fda48,_0x2667c1){_0x2667c1=_0x2667c1||0x1f4;return function(_0x2ac354){logger[_0x1050('0x1e')](_0x2ac354[_0x1050('0x2e')]);if(_0x2ac354[_0x1050('0x2f')]){delete _0x2ac354[_0x1050('0x2f')];}_0x1fda48[_0x1050('0x25')](_0x2667c1)['send'](_0x2ac354);};}exports[_0x1050('0x30')]=function(_0x3fbba0,_0xeb3107){var _0x3214d2={},_0x3ab911={},_0x2e27c4={'count':0x0,'rows':[]};var _0x195b55=_[_0x1050('0x31')](db['SalesforceConfiguration'][_0x1050('0x32')],function(_0x3aa2cf){return{'name':_0x3aa2cf['fieldName'],'type':_0x3aa2cf[_0x1050('0x33')][_0x1050('0x34')]};});_0x3ab911['model']=_[_0x1050('0x31')](_0x195b55,_0x1050('0x2f'));_0x3ab911[_0x1050('0x35')]=_[_0x1050('0x36')](_0x3fbba0[_0x1050('0x35')]);_0x3ab911['filters']=_['intersection'](_0x3ab911['model'],_0x3ab911[_0x1050('0x35')]);_0x3214d2['attributes']=_['intersection'](_0x3ab911[_0x1050('0x37')],qs[_0x1050('0x38')](_0x3fbba0[_0x1050('0x35')][_0x1050('0x38')]));_0x3214d2[_0x1050('0x39')]=_0x3214d2[_0x1050('0x39')][_0x1050('0x3a')]?_0x3214d2['attributes']:_0x3ab911[_0x1050('0x37')];if(!_0x3fbba0['query'][_0x1050('0x3b')](_0x1050('0x3c'))){_0x3214d2['limit']=qs['limit'](_0x3fbba0['query'][_0x1050('0x3d')]);_0x3214d2[_0x1050('0x27')]=qs[_0x1050('0x27')](_0x3fbba0[_0x1050('0x35')][_0x1050('0x27')]);}_0x3214d2[_0x1050('0x3e')]=qs[_0x1050('0x3f')](_0x3fbba0[_0x1050('0x35')][_0x1050('0x3f')]);_0x3214d2[_0x1050('0x40')]=qs[_0x1050('0x41')](_[_0x1050('0x42')](_0x3fbba0['query'],_0x3ab911[_0x1050('0x41')]),_0x195b55);if(_0x3fbba0[_0x1050('0x35')][_0x1050('0x43')]){_0x3214d2[_0x1050('0x40')]=_[_0x1050('0x44')](_0x3214d2['where'],{'$or':_['map'](_0x195b55,function(_0x49c0c7){if(_0x49c0c7[_0x1050('0x33')]!=='VIRTUAL'){var _0x99cf6c={};_0x99cf6c[_0x49c0c7[_0x1050('0x2f')]]={'$like':'%'+_0x3fbba0[_0x1050('0x35')][_0x1050('0x43')]+'%'};return _0x99cf6c;}})});}_0x3214d2=_[_0x1050('0x44')]({},_0x3214d2,_0x3fbba0[_0x1050('0x45')]);var _0x3ca988={'where':_0x3214d2[_0x1050('0x40')]};return db[_0x1050('0x46')]['count'](_0x3ca988)['then'](function(_0x5401a2){_0x2e27c4[_0x1050('0x47')]=_0x5401a2;if(_0x3fbba0[_0x1050('0x35')][_0x1050('0x48')]){_0x3214d2['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x3214d2);})['then'](function(_0x34a3ee){_0x2e27c4[_0x1050('0x49')]=_0x34a3ee;return _0x2e27c4;})[_0x1050('0x19')](respondWithFilteredResult(_0xeb3107,_0x3214d2))['catch'](handleError(_0xeb3107,null));};exports['show']=function(_0x289ada,_0x449ddb){var _0x2034f3={'raw':![],'where':{'id':_0x289ada['params']['id']}},_0x5be49e={};_0x5be49e[_0x1050('0x37')]=_[_0x1050('0x36')](db[_0x1050('0x46')]['rawAttributes']);_0x5be49e[_0x1050('0x35')]=_['keys'](_0x289ada[_0x1050('0x35')]);_0x5be49e['filters']=_[_0x1050('0x4a')](_0x5be49e['model'],_0x5be49e[_0x1050('0x35')]);_0x2034f3[_0x1050('0x39')]=_[_0x1050('0x4a')](_0x5be49e[_0x1050('0x37')],qs[_0x1050('0x38')](_0x289ada['query'][_0x1050('0x38')]));_0x2034f3[_0x1050('0x39')]=_0x2034f3[_0x1050('0x39')]['length']?_0x2034f3[_0x1050('0x39')]:_0x5be49e[_0x1050('0x37')];if(_0x289ada[_0x1050('0x35')][_0x1050('0x48')]){_0x2034f3[_0x1050('0x4b')]=[{'all':!![]}];}_0x2034f3=_['merge']({},_0x2034f3,_0x289ada[_0x1050('0x45')]);return db[_0x1050('0x46')]['find'](_0x2034f3)[_0x1050('0x19')](handleEntityNotFound(_0x449ddb,null))['then'](respondWithResult(_0x449ddb,null))['catch'](handleError(_0x449ddb,null));};exports[_0x1050('0x4c')]=function(_0x18c43e,_0x1fd93c){return db[_0x1050('0x46')]['create'](_0x18c43e[_0x1050('0x4d')],{})[_0x1050('0x19')](respondWithResult(_0x1fd93c,0xc9))[_0x1050('0x23')](handleError(_0x1fd93c,null));};exports['update']=function(_0x249b65,_0x267432){if(_0x249b65['body']['id']){delete _0x249b65[_0x1050('0x4d')]['id'];}return db[_0x1050('0x46')]['find']({'where':{'id':_0x249b65[_0x1050('0x4e')]['id']}})[_0x1050('0x19')](handleEntityNotFound(_0x267432,null))['then'](saveUpdates(_0x249b65[_0x1050('0x4d')],null))[_0x1050('0x19')](respondWithResult(_0x267432,null))['catch'](handleError(_0x267432,null));};exports[_0x1050('0x2c')]=function(_0x313ae4,_0x1d414c){return db[_0x1050('0x46')][_0x1050('0x4f')]({'where':{'id':_0x313ae4[_0x1050('0x4e')]['id']}})[_0x1050('0x19')](handleEntityNotFound(_0x1d414c,null))[_0x1050('0x19')](removeEntity(_0x1d414c,null))['catch'](handleError(_0x1d414c,null));};exports[_0x1050('0x50')]=function(_0x46537e,_0x2674ff,_0x39086d){var _0x6907b5={};var _0x9fa449={};var _0x480059;var _0x11cbec;return db['SalesforceConfiguration'][_0x1050('0x51')]({'where':{'id':_0x46537e[_0x1050('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2674ff,null))[_0x1050('0x19')](function(_0x1d31db){if(_0x1d31db){_0x480059=_0x1d31db;_0x9fa449['model']=_[_0x1050('0x36')](db[_0x1050('0x52')][_0x1050('0x32')]);_0x9fa449['query']=_['keys'](_0x46537e['query']);_0x9fa449[_0x1050('0x41')]=_[_0x1050('0x4a')](_0x9fa449[_0x1050('0x37')],_0x9fa449['query']);_0x6907b5[_0x1050('0x39')]=_[_0x1050('0x4a')](_0x9fa449[_0x1050('0x37')],qs['fields'](_0x46537e[_0x1050('0x35')]['fields']));_0x6907b5[_0x1050('0x39')]=_0x6907b5['attributes'][_0x1050('0x3a')]?_0x6907b5[_0x1050('0x39')]:_0x9fa449[_0x1050('0x37')];_0x6907b5[_0x1050('0x3e')]=qs[_0x1050('0x3f')](_0x46537e[_0x1050('0x35')]['sort']);_0x6907b5[_0x1050('0x40')]=qs[_0x1050('0x41')](_[_0x1050('0x42')](_0x46537e[_0x1050('0x35')],_0x9fa449[_0x1050('0x41')]));if(_0x46537e[_0x1050('0x35')][_0x1050('0x43')]){_0x6907b5[_0x1050('0x40')]=_[_0x1050('0x44')](_0x6907b5[_0x1050('0x40')],{'$or':_['map'](_0x6907b5[_0x1050('0x39')],function(_0x1b3790){var _0x267115={};_0x267115[_0x1b3790]={'$like':'%'+_0x46537e[_0x1050('0x35')][_0x1050('0x43')]+'%'};return _0x267115;})});}_0x6907b5=_[_0x1050('0x44')]({},_0x6907b5,_0x46537e['options']);return _0x480059[_0x1050('0x50')](_0x6907b5);}})[_0x1050('0x19')](function(_0x551a5f){if(_0x551a5f){_0x11cbec=_0x551a5f[_0x1050('0x3a')];if(!_0x46537e[_0x1050('0x35')][_0x1050('0x3b')](_0x1050('0x3c'))){_0x6907b5[_0x1050('0x3d')]=qs[_0x1050('0x3d')](_0x46537e[_0x1050('0x35')][_0x1050('0x3d')]);_0x6907b5[_0x1050('0x27')]=qs[_0x1050('0x27')](_0x46537e['query'][_0x1050('0x27')]);}return _0x480059[_0x1050('0x50')](_0x6907b5);}})[_0x1050('0x19')](function(_0x324823){if(_0x324823){return _0x324823?{'count':_0x11cbec,'rows':_0x324823}:null;}})[_0x1050('0x19')](respondWithResult(_0x2674ff,null))[_0x1050('0x23')](handleError(_0x2674ff,null));};exports[_0x1050('0x53')]=function(_0x49ed78,_0x417900,_0x14b989){var _0x258ac0={};var _0xd3342e={};var _0x91fc42;var _0x57d520;return db['SalesforceConfiguration'][_0x1050('0x51')]({'where':{'id':_0x49ed78['params']['id']}})['then'](handleEntityNotFound(_0x417900,null))[_0x1050('0x19')](function(_0x1149ca){if(_0x1149ca){_0x91fc42=_0x1149ca;_0xd3342e['model']=_[_0x1050('0x36')](db['SalesforceField'][_0x1050('0x32')]);_0xd3342e['query']=_['keys'](_0x49ed78[_0x1050('0x35')]);_0xd3342e['filters']=_[_0x1050('0x4a')](_0xd3342e[_0x1050('0x37')],_0xd3342e['query']);_0x258ac0[_0x1050('0x39')]=_[_0x1050('0x4a')](_0xd3342e[_0x1050('0x37')],qs[_0x1050('0x38')](_0x49ed78[_0x1050('0x35')][_0x1050('0x38')]));_0x258ac0[_0x1050('0x39')]=_0x258ac0['attributes'][_0x1050('0x3a')]?_0x258ac0[_0x1050('0x39')]:_0xd3342e[_0x1050('0x37')];_0x258ac0[_0x1050('0x3e')]=qs[_0x1050('0x3f')](_0x49ed78[_0x1050('0x35')][_0x1050('0x3f')]);_0x258ac0[_0x1050('0x40')]=qs[_0x1050('0x41')](_['pick'](_0x49ed78['query'],_0xd3342e[_0x1050('0x41')]));if(_0x49ed78[_0x1050('0x35')][_0x1050('0x43')]){_0x258ac0['where']=_[_0x1050('0x44')](_0x258ac0[_0x1050('0x40')],{'$or':_[_0x1050('0x31')](_0x258ac0[_0x1050('0x39')],function(_0x2c6b27){var _0xc9049b={};_0xc9049b[_0x2c6b27]={'$like':'%'+_0x49ed78[_0x1050('0x35')]['filter']+'%'};return _0xc9049b;})});}_0x258ac0=_[_0x1050('0x44')]({},_0x258ac0,_0x49ed78[_0x1050('0x45')]);return _0x91fc42['getSubjects'](_0x258ac0);}})[_0x1050('0x19')](function(_0x34932d){if(_0x34932d){_0x57d520=_0x34932d[_0x1050('0x3a')];if(!_0x49ed78[_0x1050('0x35')][_0x1050('0x3b')](_0x1050('0x3c'))){_0x258ac0[_0x1050('0x3d')]=qs[_0x1050('0x3d')](_0x49ed78[_0x1050('0x35')][_0x1050('0x3d')]);_0x258ac0[_0x1050('0x27')]=qs[_0x1050('0x27')](_0x49ed78['query'][_0x1050('0x27')]);}return _0x91fc42['getSubjects'](_0x258ac0);}})[_0x1050('0x19')](function(_0x5d892b){if(_0x5d892b){return _0x5d892b?{'count':_0x57d520,'rows':_0x5d892b}:null;}})[_0x1050('0x19')](respondWithResult(_0x417900,null))[_0x1050('0x23')](handleError(_0x417900,null));};exports[_0x1050('0x54')]=function(_0xc82e4,_0x172f27,_0x4476d){var _0x2238fd={};var _0x10e988={};var _0x2989e6;var _0xa4ec7c;return db[_0x1050('0x46')][_0x1050('0x51')]({'where':{'id':_0xc82e4[_0x1050('0x4e')]['id']}})[_0x1050('0x19')](handleEntityNotFound(_0x172f27,null))[_0x1050('0x19')](function(_0x44bef7){if(_0x44bef7){_0x2989e6=_0x44bef7;_0x10e988[_0x1050('0x37')]=_['keys'](db[_0x1050('0x52')][_0x1050('0x32')]);_0x10e988['query']=_['keys'](_0xc82e4[_0x1050('0x35')]);_0x10e988[_0x1050('0x41')]=_[_0x1050('0x4a')](_0x10e988[_0x1050('0x37')],_0x10e988[_0x1050('0x35')]);_0x2238fd[_0x1050('0x39')]=_[_0x1050('0x4a')](_0x10e988[_0x1050('0x37')],qs['fields'](_0xc82e4[_0x1050('0x35')]['fields']));_0x2238fd[_0x1050('0x39')]=_0x2238fd[_0x1050('0x39')][_0x1050('0x3a')]?_0x2238fd[_0x1050('0x39')]:_0x10e988[_0x1050('0x37')];_0x2238fd[_0x1050('0x3e')]=qs[_0x1050('0x3f')](_0xc82e4['query'][_0x1050('0x3f')]);_0x2238fd[_0x1050('0x40')]=qs['filters'](_[_0x1050('0x42')](_0xc82e4[_0x1050('0x35')],_0x10e988[_0x1050('0x41')]));if(_0xc82e4[_0x1050('0x35')][_0x1050('0x43')]){_0x2238fd[_0x1050('0x40')]=_[_0x1050('0x44')](_0x2238fd[_0x1050('0x40')],{'$or':_[_0x1050('0x31')](_0x2238fd[_0x1050('0x39')],function(_0x405b0b){var _0x348270={};_0x348270[_0x405b0b]={'$like':'%'+_0xc82e4[_0x1050('0x35')][_0x1050('0x43')]+'%'};return _0x348270;})});}_0x2238fd=_['merge']({},_0x2238fd,_0xc82e4[_0x1050('0x45')]);return _0x2989e6[_0x1050('0x54')](_0x2238fd);}})['then'](function(_0x2018ce){if(_0x2018ce){_0xa4ec7c=_0x2018ce[_0x1050('0x3a')];if(!_0xc82e4[_0x1050('0x35')][_0x1050('0x3b')](_0x1050('0x3c'))){_0x2238fd[_0x1050('0x3d')]=qs[_0x1050('0x3d')](_0xc82e4[_0x1050('0x35')][_0x1050('0x3d')]);_0x2238fd['offset']=qs[_0x1050('0x27')](_0xc82e4[_0x1050('0x35')][_0x1050('0x27')]);}return _0x2989e6[_0x1050('0x54')](_0x2238fd);}})[_0x1050('0x19')](function(_0x1c0d2f){if(_0x1c0d2f){return _0x1c0d2f?{'count':_0xa4ec7c,'rows':_0x1c0d2f}:null;}})[_0x1050('0x19')](respondWithResult(_0x172f27,null))[_0x1050('0x23')](handleError(_0x172f27,null));}; \ No newline at end of file +var _0xba3d=['jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','stack','name','send','SalesforceConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','attributes','intersection','model','fields','length','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','SalesforceField','sort','getFields','hasOwnProperty','nolimit','getSubjects','findOne','order','getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb'];(function(_0x497535,_0x3eb672){var _0x2cd591=function(_0x17f6ea){while(--_0x17f6ea){_0x497535['push'](_0x497535['shift']());}};_0x2cd591(++_0x3eb672);}(_0xba3d,0x1a8));var _0xdba3=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xba3d[_0x256b72];return _0x2183e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdba3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdba3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdba3('0x2'));var moment=require('moment');var BPromise=require(_0xdba3('0x3'));var Mustache=require(_0xdba3('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdba3('0x5'));var csv=require(_0xdba3('0x6'));var ejs=require(_0xdba3('0x7'));var fs=require('fs');var _=require(_0xdba3('0x8'));var squel=require(_0xdba3('0x9'));var crypto=require('crypto');var jsforce=require(_0xdba3('0xa'));var deskjs=require(_0xdba3('0xb'));var toCsv=require(_0xdba3('0x6'));var querystring=require(_0xdba3('0xc'));var Papa=require(_0xdba3('0xd'));var Redis=require(_0xdba3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdba3('0xf'));var as=require(_0xdba3('0x10'));var hardwareService=require(_0xdba3('0x11'));var logger=require(_0xdba3('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdba3('0x13'));var db=require(_0xdba3('0x14'))['db'];var jayson=require(_0xdba3('0x15'));var client=jayson[_0xdba3('0x16')][_0xdba3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x143da0,_0x41465d,_0x1a4124,_0x2e5288){return new BPromise(function(_0x577f38,_0x2d3f5c){var _0x4748f8=_0x2e5288||client;return _0x4748f8[_0xdba3('0x18')](_0x143da0,_0x1a4124)[_0xdba3('0x19')](function(_0x1f874f){logger[_0xdba3('0x1a')](_0xdba3('0x1b'),_0x41465d,'request\x20sent');logger[_0xdba3('0x1c')](_0xdba3('0x1d'),_0x41465d,'request\x20sent',JSON[_0xdba3('0x1e')](_0x1f874f));if(_0x1f874f[_0xdba3('0x1f')]){if(_0x1f874f[_0xdba3('0x1f')][_0xdba3('0x20')]===0x1f4){logger[_0xdba3('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41465d,_0x1f874f[_0xdba3('0x1f')][_0xdba3('0x21')]);return _0x2d3f5c(_0x1f874f[_0xdba3('0x1f')][_0xdba3('0x21')]);}logger['error'](_0xdba3('0x1b'),_0x41465d,_0x1f874f['error'][_0xdba3('0x21')]);return _0x577f38(_0x1f874f['error'][_0xdba3('0x21')]);}else{logger[_0xdba3('0x1a')](_0xdba3('0x1b'),_0x41465d,_0xdba3('0x22'));_0x577f38(_0x1f874f[_0xdba3('0x23')][_0xdba3('0x21')]);}})['catch'](function(_0x3abe3c){logger[_0xdba3('0x1f')](_0xdba3('0x1b'),_0x41465d,_0x3abe3c);_0x2d3f5c(_0x3abe3c);});});}function respondWithStatusCode(_0x8f8123,_0x46d73f){_0x46d73f=_0x46d73f||0xcc;return function(_0x3812a6){if(_0x3812a6){return _0x8f8123[_0xdba3('0x24')](_0x46d73f);}return _0x8f8123[_0xdba3('0x25')](_0x46d73f)[_0xdba3('0x26')]();};}function respondWithResult(_0x34759b,_0x3e6a06){_0x3e6a06=_0x3e6a06||0xc8;return function(_0x38c8bf){if(_0x38c8bf){return _0x34759b[_0xdba3('0x25')](_0x3e6a06)[_0xdba3('0x27')](_0x38c8bf);}};}function respondWithFilteredResult(_0x2716af,_0x16aaac){return function(_0x536e3f){if(_0x536e3f){var _0x355436=_0x536e3f[_0xdba3('0x28')],_0x2f098c=_0x16aaac[_0xdba3('0x29')],_0x603a40=_0x16aaac[_0xdba3('0x29')]+_0x16aaac[_0xdba3('0x2a')],_0x505666;if(_0x603a40>=_0x355436){_0x603a40=_0x355436;_0x505666=0xc8;}else{_0x505666=0xce;}_0x2716af[_0xdba3('0x25')](_0x505666);return _0x2716af[_0xdba3('0x2b')](_0xdba3('0x2c'),_0x2f098c+'-'+_0x603a40+'/'+_0x355436)[_0xdba3('0x27')](_0x536e3f);}return null;};}function patchUpdates(_0x4dce76){return function(_0x5caf98){try{jsonpatch['apply'](_0x5caf98,_0x4dce76,!![]);}catch(_0x3f8739){return BPromise['reject'](_0x3f8739);}return _0x5caf98['save']();};}function saveUpdates(_0x24f4a5,_0x335079){return function(_0x4d1c6f){if(_0x4d1c6f){return _0x4d1c6f[_0xdba3('0x2d')](_0x24f4a5)[_0xdba3('0x19')](function(_0x6cf40e){return _0x6cf40e;});}return null;};}function removeEntity(_0x4a17e3,_0x8f22c6){return function(_0x4cde8a){if(_0x4cde8a){return _0x4cde8a[_0xdba3('0x2e')]()[_0xdba3('0x19')](function(){_0x4a17e3[_0xdba3('0x25')](0xcc)[_0xdba3('0x26')]();});}};}function handleEntityNotFound(_0x86121b,_0x1b6518){return function(_0x4ea077){if(!_0x4ea077){_0x86121b[_0xdba3('0x24')](0x194);}return _0x4ea077;};}function handleError(_0x361dc3,_0x58791f){_0x58791f=_0x58791f||0x1f4;return function(_0x5c18a2){logger[_0xdba3('0x1f')](_0x5c18a2[_0xdba3('0x2f')]);if(_0x5c18a2[_0xdba3('0x30')]){delete _0x5c18a2['name'];}_0x361dc3[_0xdba3('0x25')](_0x58791f)[_0xdba3('0x31')](_0x5c18a2);};}exports['index']=function(_0x7666d,_0x3f1db8){var _0x21ee6a={},_0x2729a6={},_0x226880={'count':0x0,'rows':[]};var _0x3a1f43=_['map'](db[_0xdba3('0x32')][_0xdba3('0x33')],function(_0x5918da){return{'name':_0x5918da[_0xdba3('0x34')],'type':_0x5918da[_0xdba3('0x35')][_0xdba3('0x36')]};});_0x2729a6['model']=_[_0xdba3('0x37')](_0x3a1f43,_0xdba3('0x30'));_0x2729a6['query']=_[_0xdba3('0x38')](_0x7666d[_0xdba3('0x39')]);_0x2729a6[_0xdba3('0x3a')]=_['intersection'](_0x2729a6['model'],_0x2729a6['query']);_0x21ee6a[_0xdba3('0x3b')]=_[_0xdba3('0x3c')](_0x2729a6[_0xdba3('0x3d')],qs[_0xdba3('0x3e')](_0x7666d[_0xdba3('0x39')][_0xdba3('0x3e')]));_0x21ee6a['attributes']=_0x21ee6a[_0xdba3('0x3b')][_0xdba3('0x3f')]?_0x21ee6a[_0xdba3('0x3b')]:_0x2729a6[_0xdba3('0x3d')];if(!_0x7666d['query']['hasOwnProperty']('nolimit')){_0x21ee6a[_0xdba3('0x2a')]=qs[_0xdba3('0x2a')](_0x7666d['query'][_0xdba3('0x2a')]);_0x21ee6a['offset']=qs['offset'](_0x7666d[_0xdba3('0x39')][_0xdba3('0x29')]);}_0x21ee6a['order']=qs['sort'](_0x7666d[_0xdba3('0x39')]['sort']);_0x21ee6a[_0xdba3('0x40')]=qs[_0xdba3('0x3a')](_[_0xdba3('0x41')](_0x7666d['query'],_0x2729a6[_0xdba3('0x3a')]),_0x3a1f43);if(_0x7666d[_0xdba3('0x39')][_0xdba3('0x42')]){_0x21ee6a[_0xdba3('0x40')]=_[_0xdba3('0x43')](_0x21ee6a['where'],{'$or':_[_0xdba3('0x37')](_0x3a1f43,function(_0x5a6065){if(_0x5a6065[_0xdba3('0x35')]!==_0xdba3('0x44')){var _0xa6067a={};_0xa6067a[_0x5a6065[_0xdba3('0x30')]]={'$like':'%'+_0x7666d['query'][_0xdba3('0x42')]+'%'};return _0xa6067a;}})});}_0x21ee6a=_[_0xdba3('0x43')]({},_0x21ee6a,_0x7666d[_0xdba3('0x45')]);var _0x49bd03={'where':_0x21ee6a[_0xdba3('0x40')]};return db[_0xdba3('0x32')][_0xdba3('0x28')](_0x49bd03)[_0xdba3('0x19')](function(_0x11d79b){_0x226880[_0xdba3('0x28')]=_0x11d79b;if(_0x7666d[_0xdba3('0x39')][_0xdba3('0x46')]){_0x21ee6a[_0xdba3('0x47')]=[{'all':!![]}];}return db[_0xdba3('0x32')][_0xdba3('0x48')](_0x21ee6a);})[_0xdba3('0x19')](function(_0x119b19){_0x226880[_0xdba3('0x49')]=_0x119b19;return _0x226880;})[_0xdba3('0x19')](respondWithFilteredResult(_0x3f1db8,_0x21ee6a))[_0xdba3('0x4a')](handleError(_0x3f1db8,null));};exports[_0xdba3('0x4b')]=function(_0x302ff2,_0x1826a2){var _0x4c7f0b={'raw':![],'where':{'id':_0x302ff2[_0xdba3('0x4c')]['id']}},_0x15a605={};_0x15a605[_0xdba3('0x3d')]=_[_0xdba3('0x38')](db[_0xdba3('0x32')]['rawAttributes']);_0x15a605['query']=_[_0xdba3('0x38')](_0x302ff2[_0xdba3('0x39')]);_0x15a605[_0xdba3('0x3a')]=_[_0xdba3('0x3c')](_0x15a605[_0xdba3('0x3d')],_0x15a605[_0xdba3('0x39')]);_0x4c7f0b[_0xdba3('0x3b')]=_[_0xdba3('0x3c')](_0x15a605[_0xdba3('0x3d')],qs[_0xdba3('0x3e')](_0x302ff2[_0xdba3('0x39')][_0xdba3('0x3e')]));_0x4c7f0b[_0xdba3('0x3b')]=_0x4c7f0b[_0xdba3('0x3b')][_0xdba3('0x3f')]?_0x4c7f0b['attributes']:_0x15a605['model'];if(_0x302ff2[_0xdba3('0x39')][_0xdba3('0x46')]){_0x4c7f0b[_0xdba3('0x47')]=[{'all':!![]}];}_0x4c7f0b=_[_0xdba3('0x43')]({},_0x4c7f0b,_0x302ff2[_0xdba3('0x45')]);return db[_0xdba3('0x32')][_0xdba3('0x4d')](_0x4c7f0b)[_0xdba3('0x19')](handleEntityNotFound(_0x1826a2,null))[_0xdba3('0x19')](respondWithResult(_0x1826a2,null))['catch'](handleError(_0x1826a2,null));};exports['create']=function(_0x2dd4cd,_0x5e324b){return db['SalesforceConfiguration'][_0xdba3('0x4e')](_0x2dd4cd[_0xdba3('0x4f')],{})['then'](respondWithResult(_0x5e324b,0xc9))[_0xdba3('0x4a')](handleError(_0x5e324b,null));};exports[_0xdba3('0x2d')]=function(_0xbbef25,_0x3372ad){if(_0xbbef25[_0xdba3('0x4f')]['id']){delete _0xbbef25[_0xdba3('0x4f')]['id'];}return db[_0xdba3('0x32')][_0xdba3('0x4d')]({'where':{'id':_0xbbef25[_0xdba3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3372ad,null))[_0xdba3('0x19')](saveUpdates(_0xbbef25[_0xdba3('0x4f')],null))[_0xdba3('0x19')](respondWithResult(_0x3372ad,null))[_0xdba3('0x4a')](handleError(_0x3372ad,null));};exports[_0xdba3('0x2e')]=function(_0xed9c10,_0x236f16){return db['SalesforceConfiguration'][_0xdba3('0x4d')]({'where':{'id':_0xed9c10[_0xdba3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x236f16,null))[_0xdba3('0x19')](removeEntity(_0x236f16,null))[_0xdba3('0x4a')](handleError(_0x236f16,null));};exports['getFields']=function(_0x51a593,_0x595de3,_0x928117){var _0x1debb1={};var _0x580a8a={};var _0x4b1605;var _0x5bbe0e;return db[_0xdba3('0x32')]['findOne']({'where':{'id':_0x51a593['params']['id']}})[_0xdba3('0x19')](handleEntityNotFound(_0x595de3,null))[_0xdba3('0x19')](function(_0x1347e7){if(_0x1347e7){_0x4b1605=_0x1347e7;_0x580a8a[_0xdba3('0x3d')]=_['keys'](db[_0xdba3('0x50')][_0xdba3('0x33')]);_0x580a8a['query']=_['keys'](_0x51a593[_0xdba3('0x39')]);_0x580a8a[_0xdba3('0x3a')]=_[_0xdba3('0x3c')](_0x580a8a[_0xdba3('0x3d')],_0x580a8a['query']);_0x1debb1[_0xdba3('0x3b')]=_['intersection'](_0x580a8a[_0xdba3('0x3d')],qs[_0xdba3('0x3e')](_0x51a593[_0xdba3('0x39')][_0xdba3('0x3e')]));_0x1debb1[_0xdba3('0x3b')]=_0x1debb1['attributes']['length']?_0x1debb1[_0xdba3('0x3b')]:_0x580a8a['model'];_0x1debb1['order']=qs[_0xdba3('0x51')](_0x51a593[_0xdba3('0x39')][_0xdba3('0x51')]);_0x1debb1['where']=qs[_0xdba3('0x3a')](_[_0xdba3('0x41')](_0x51a593['query'],_0x580a8a[_0xdba3('0x3a')]));if(_0x51a593['query'][_0xdba3('0x42')]){_0x1debb1[_0xdba3('0x40')]=_['merge'](_0x1debb1['where'],{'$or':_[_0xdba3('0x37')](_0x1debb1['attributes'],function(_0x39b693){var _0x5ce44b={};_0x5ce44b[_0x39b693]={'$like':'%'+_0x51a593['query'][_0xdba3('0x42')]+'%'};return _0x5ce44b;})});}_0x1debb1=_[_0xdba3('0x43')]({},_0x1debb1,_0x51a593[_0xdba3('0x45')]);return _0x4b1605[_0xdba3('0x52')](_0x1debb1);}})[_0xdba3('0x19')](function(_0x4587c7){if(_0x4587c7){_0x5bbe0e=_0x4587c7['length'];if(!_0x51a593[_0xdba3('0x39')][_0xdba3('0x53')](_0xdba3('0x54'))){_0x1debb1[_0xdba3('0x2a')]=qs[_0xdba3('0x2a')](_0x51a593[_0xdba3('0x39')][_0xdba3('0x2a')]);_0x1debb1[_0xdba3('0x29')]=qs['offset'](_0x51a593[_0xdba3('0x39')][_0xdba3('0x29')]);}return _0x4b1605[_0xdba3('0x52')](_0x1debb1);}})[_0xdba3('0x19')](function(_0x365b2e){if(_0x365b2e){return _0x365b2e?{'count':_0x5bbe0e,'rows':_0x365b2e}:null;}})[_0xdba3('0x19')](respondWithResult(_0x595de3,null))[_0xdba3('0x4a')](handleError(_0x595de3,null));};exports[_0xdba3('0x55')]=function(_0x38137b,_0x17684b,_0x291f94){var _0x9bd9f={};var _0x1c44e3={};var _0x52a4e3;var _0x1b432e;return db[_0xdba3('0x32')][_0xdba3('0x56')]({'where':{'id':_0x38137b['params']['id']}})[_0xdba3('0x19')](handleEntityNotFound(_0x17684b,null))['then'](function(_0x334ad3){if(_0x334ad3){_0x52a4e3=_0x334ad3;_0x1c44e3[_0xdba3('0x3d')]=_[_0xdba3('0x38')](db['SalesforceField']['rawAttributes']);_0x1c44e3[_0xdba3('0x39')]=_['keys'](_0x38137b[_0xdba3('0x39')]);_0x1c44e3[_0xdba3('0x3a')]=_['intersection'](_0x1c44e3['model'],_0x1c44e3['query']);_0x9bd9f[_0xdba3('0x3b')]=_[_0xdba3('0x3c')](_0x1c44e3[_0xdba3('0x3d')],qs[_0xdba3('0x3e')](_0x38137b[_0xdba3('0x39')][_0xdba3('0x3e')]));_0x9bd9f[_0xdba3('0x3b')]=_0x9bd9f[_0xdba3('0x3b')][_0xdba3('0x3f')]?_0x9bd9f['attributes']:_0x1c44e3[_0xdba3('0x3d')];_0x9bd9f[_0xdba3('0x57')]=qs[_0xdba3('0x51')](_0x38137b[_0xdba3('0x39')][_0xdba3('0x51')]);_0x9bd9f[_0xdba3('0x40')]=qs[_0xdba3('0x3a')](_[_0xdba3('0x41')](_0x38137b[_0xdba3('0x39')],_0x1c44e3[_0xdba3('0x3a')]));if(_0x38137b['query']['filter']){_0x9bd9f[_0xdba3('0x40')]=_[_0xdba3('0x43')](_0x9bd9f[_0xdba3('0x40')],{'$or':_['map'](_0x9bd9f[_0xdba3('0x3b')],function(_0x4511ac){var _0x4846e6={};_0x4846e6[_0x4511ac]={'$like':'%'+_0x38137b[_0xdba3('0x39')][_0xdba3('0x42')]+'%'};return _0x4846e6;})});}_0x9bd9f=_['merge']({},_0x9bd9f,_0x38137b[_0xdba3('0x45')]);return _0x52a4e3['getSubjects'](_0x9bd9f);}})['then'](function(_0x268190){if(_0x268190){_0x1b432e=_0x268190[_0xdba3('0x3f')];if(!_0x38137b[_0xdba3('0x39')][_0xdba3('0x53')]('nolimit')){_0x9bd9f[_0xdba3('0x2a')]=qs['limit'](_0x38137b[_0xdba3('0x39')]['limit']);_0x9bd9f[_0xdba3('0x29')]=qs['offset'](_0x38137b[_0xdba3('0x39')]['offset']);}return _0x52a4e3[_0xdba3('0x55')](_0x9bd9f);}})[_0xdba3('0x19')](function(_0x42eb16){if(_0x42eb16){return _0x42eb16?{'count':_0x1b432e,'rows':_0x42eb16}:null;}})[_0xdba3('0x19')](respondWithResult(_0x17684b,null))[_0xdba3('0x4a')](handleError(_0x17684b,null));};exports[_0xdba3('0x58')]=function(_0x3b0bfe,_0xe033c6,_0x7211ff){var _0x38d6ed={};var _0x539767={};var _0x6ba99f;var _0x3889ad;return db[_0xdba3('0x32')]['findOne']({'where':{'id':_0x3b0bfe['params']['id']}})[_0xdba3('0x19')](handleEntityNotFound(_0xe033c6,null))['then'](function(_0x3c75ec){if(_0x3c75ec){_0x6ba99f=_0x3c75ec;_0x539767[_0xdba3('0x3d')]=_[_0xdba3('0x38')](db['SalesforceField'][_0xdba3('0x33')]);_0x539767[_0xdba3('0x39')]=_[_0xdba3('0x38')](_0x3b0bfe[_0xdba3('0x39')]);_0x539767['filters']=_[_0xdba3('0x3c')](_0x539767[_0xdba3('0x3d')],_0x539767[_0xdba3('0x39')]);_0x38d6ed['attributes']=_['intersection'](_0x539767[_0xdba3('0x3d')],qs[_0xdba3('0x3e')](_0x3b0bfe[_0xdba3('0x39')][_0xdba3('0x3e')]));_0x38d6ed['attributes']=_0x38d6ed[_0xdba3('0x3b')][_0xdba3('0x3f')]?_0x38d6ed[_0xdba3('0x3b')]:_0x539767[_0xdba3('0x3d')];_0x38d6ed['order']=qs[_0xdba3('0x51')](_0x3b0bfe[_0xdba3('0x39')][_0xdba3('0x51')]);_0x38d6ed['where']=qs[_0xdba3('0x3a')](_['pick'](_0x3b0bfe[_0xdba3('0x39')],_0x539767['filters']));if(_0x3b0bfe[_0xdba3('0x39')][_0xdba3('0x42')]){_0x38d6ed[_0xdba3('0x40')]=_[_0xdba3('0x43')](_0x38d6ed[_0xdba3('0x40')],{'$or':_[_0xdba3('0x37')](_0x38d6ed[_0xdba3('0x3b')],function(_0x263ffb){var _0x5a9853={};_0x5a9853[_0x263ffb]={'$like':'%'+_0x3b0bfe[_0xdba3('0x39')]['filter']+'%'};return _0x5a9853;})});}_0x38d6ed=_[_0xdba3('0x43')]({},_0x38d6ed,_0x3b0bfe[_0xdba3('0x45')]);return _0x6ba99f[_0xdba3('0x58')](_0x38d6ed);}})['then'](function(_0x5d91b3){if(_0x5d91b3){_0x3889ad=_0x5d91b3[_0xdba3('0x3f')];if(!_0x3b0bfe[_0xdba3('0x39')]['hasOwnProperty'](_0xdba3('0x54'))){_0x38d6ed[_0xdba3('0x2a')]=qs['limit'](_0x3b0bfe[_0xdba3('0x39')][_0xdba3('0x2a')]);_0x38d6ed[_0xdba3('0x29')]=qs[_0xdba3('0x29')](_0x3b0bfe['query'][_0xdba3('0x29')]);}return _0x6ba99f[_0xdba3('0x58')](_0x38d6ed);}})[_0xdba3('0x19')](function(_0x449b3c){if(_0x449b3c){return _0x449b3c?{'count':_0x3889ad,'rows':_0x449b3c}:null;}})[_0xdba3('0x19')](respondWithResult(_0xe033c6,null))[_0xdba3('0x4a')](handleError(_0xe033c6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3afe328..3757333 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 _0x13b3=['path','rimraf','../../config/environment','exports','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x13b3,0x17b));var _0x313b=function(_0x444e1c,_0x1aadb2){_0x444e1c=_0x444e1c-0x0;var _0x5a8b5d=_0x13b3[_0x444e1c];return _0x5a8b5d;};'use strict';var _=require('lodash');var util=require(_0x313b('0x0'));var logger=require(_0x313b('0x1'))(_0x313b('0x2'));var moment=require(_0x313b('0x3'));var BPromise=require(_0x313b('0x4'));var rp=require(_0x313b('0x5'));var fs=require('fs');var path=require(_0x313b('0x6'));var rimraf=require(_0x313b('0x7'));var config=require(_0x313b('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x313b('0x9')]=function(_0x3f41c2,_0x453b41){return _0x3f41c2['define']('SalesforceConfiguration',attributes,{'tableName':_0x313b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66d8=['int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration'];(function(_0x4cfe95,_0xcd70fc){var _0x5128ec=function(_0x405799){while(--_0x405799){_0x4cfe95['push'](_0x4cfe95['shift']());}};_0x5128ec(++_0xcd70fc);}(_0x66d8,0x1c9));var _0x866d=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x66d8[_0x3fd275];return _0xe4f14f;};'use strict';var _=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var logger=require(_0x866d('0x2'))('api');var moment=require(_0x866d('0x3'));var BPromise=require(_0x866d('0x4'));var rp=require(_0x866d('0x5'));var fs=require('fs');var path=require(_0x866d('0x6'));var rimraf=require(_0x866d('0x7'));var config=require(_0x866d('0x8'));var attributes=require(_0x866d('0x9'));module['exports']=function(_0x4a8758,_0x2021c3){return _0x4a8758['define'](_0x866d('0xa'),attributes,{'tableName':_0x866d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index b41f9cb..f6eb5d9 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 _0xffc2=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x14db3b,_0x1c3cbf){var _0x94158d=function(_0x5da14b){while(--_0x5da14b){_0x14db3b['push'](_0x14db3b['shift']());}};_0x94158d(++_0x1c3cbf);}(_0xffc2,0xc7));var _0x2ffc=function(_0x1ccd8a,_0x5bf417){_0x1ccd8a=_0x1ccd8a-0x0;var _0x5a69d8=_0xffc2[_0x1ccd8a];return _0x5a69d8;};'use strict';var _=require(_0x2ffc('0x0'));var util=require(_0x2ffc('0x1'));var moment=require(_0x2ffc('0x2'));var BPromise=require(_0x2ffc('0x3'));var rs=require(_0x2ffc('0x4'));var fs=require('fs');var Redis=require(_0x2ffc('0x5'));var db=require(_0x2ffc('0x6'))['db'];var utils=require(_0x2ffc('0x7'));var logger=require(_0x2ffc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2ffc('0x9'));var client=jayson[_0x2ffc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa606,_0x5cc01f,_0x104895){return new BPromise(function(_0x39adcf,_0xd8641d){return client[_0x2ffc('0xb')](_0x4fa606,_0x104895)[_0x2ffc('0xc')](function(_0xcc659c){logger[_0x2ffc('0xd')](_0x2ffc('0xe'),_0x5cc01f,_0x2ffc('0xf'));logger[_0x2ffc('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5cc01f,_0x2ffc('0xf'),JSON['stringify'](_0xcc659c));if(_0xcc659c[_0x2ffc('0x11')]){if(_0xcc659c['error'][_0x2ffc('0x12')]===0x1f4){logger[_0x2ffc('0x11')](_0x2ffc('0xe'),_0x5cc01f,_0xcc659c['error'][_0x2ffc('0x13')]);return _0xd8641d(_0xcc659c[_0x2ffc('0x11')][_0x2ffc('0x13')]);}logger[_0x2ffc('0x11')](_0x2ffc('0xe'),_0x5cc01f,_0xcc659c[_0x2ffc('0x11')][_0x2ffc('0x13')]);return _0x39adcf(_0xcc659c[_0x2ffc('0x11')][_0x2ffc('0x13')]);}else{logger[_0x2ffc('0xd')](_0x2ffc('0xe'),_0x5cc01f,_0x2ffc('0xf'));_0x39adcf(_0xcc659c[_0x2ffc('0x14')][_0x2ffc('0x13')]);}})[_0x2ffc('0x15')](function(_0x5f005a){logger['error'](_0x2ffc('0xe'),_0x5cc01f,_0x5f005a);_0xd8641d(_0x5f005a);});});} \ No newline at end of file +var _0x3855=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x3855,0x190));var _0x5385=function(_0x11fd2b,_0x3a08a1){_0x11fd2b=_0x11fd2b-0x0;var _0x4881ab=_0x3855[_0x11fd2b];return _0x4881ab;};'use strict';var _=require(_0x5385('0x0'));var util=require(_0x5385('0x1'));var moment=require('moment');var BPromise=require(_0x5385('0x2'));var rs=require(_0x5385('0x3'));var fs=require('fs');var Redis=require(_0x5385('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5385('0x5'));var logger=require('../../config/logger')(_0x5385('0x6'));var config=require(_0x5385('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5385('0x8')][_0x5385('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59a059,_0x26b6e5,_0x357cd2){return new BPromise(function(_0x27e03a,_0x2a7371){return client['request'](_0x59a059,_0x357cd2)[_0x5385('0xa')](function(_0x23fd0f){logger['info'](_0x5385('0xb'),_0x26b6e5,_0x5385('0xc'));logger[_0x5385('0xd')](_0x5385('0xe'),_0x26b6e5,_0x5385('0xc'),JSON['stringify'](_0x23fd0f));if(_0x23fd0f[_0x5385('0xf')]){if(_0x23fd0f['error'][_0x5385('0x10')]===0x1f4){logger['error'](_0x5385('0xb'),_0x26b6e5,_0x23fd0f[_0x5385('0xf')][_0x5385('0x11')]);return _0x2a7371(_0x23fd0f[_0x5385('0xf')][_0x5385('0x11')]);}logger[_0x5385('0xf')](_0x5385('0xb'),_0x26b6e5,_0x23fd0f['error'][_0x5385('0x11')]);return _0x27e03a(_0x23fd0f[_0x5385('0xf')][_0x5385('0x11')]);}else{logger[_0x5385('0x12')](_0x5385('0xb'),_0x26b6e5,_0x5385('0xc'));_0x27e03a(_0x23fd0f[_0x5385('0x13')]['message']);}})['catch'](function(_0x712e3c){logger[_0x5385('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x26b6e5,_0x712e3c);_0x2a7371(_0x712e3c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ba728e7..a53f3f6 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 _0xeac9=['util','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer'];(function(_0x3a3cd6,_0x8e111e){var _0x120930=function(_0x2a03e0){while(--_0x2a03e0){_0x3a3cd6['push'](_0x3a3cd6['shift']());}};_0x120930(++_0x8e111e);}(_0xeac9,0x164));var _0x9eac=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xeac9[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x9eac('0x0'));var util=require(_0x9eac('0x1'));var path=require(_0x9eac('0x2'));var timeout=require('connect-timeout');var express=require(_0x9eac('0x3'));var router=express[_0x9eac('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9eac('0x5'));var config=require(_0x9eac('0x6'));var controller=require(_0x9eac('0x7'));router[_0x9eac('0x8')]('/',auth[_0x9eac('0x9')](),controller[_0x9eac('0xa')]);router[_0x9eac('0x8')](_0x9eac('0xb'),auth['isAuthenticated'](),controller[_0x9eac('0xc')]);router[_0x9eac('0xd')]('/',auth['isAuthenticated'](),controller[_0x9eac('0xe')]);router[_0x9eac('0xf')](_0x9eac('0xb'),auth[_0x9eac('0x9')](),controller['update']);router['delete'](_0x9eac('0xb'),auth[_0x9eac('0x9')](),controller['destroy']);module[_0x9eac('0x10')]=router; \ No newline at end of file +var _0xc2ec=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xc2ec,0x15b));var _0xcc2e=function(_0x410206,_0x4dbb5c){_0x410206=_0x410206-0x0;var _0x19d1e8=_0xc2ec[_0x410206];return _0x19d1e8;};'use strict';var multer=require('multer');var util=require(_0xcc2e('0x0'));var path=require(_0xcc2e('0x1'));var timeout=require(_0xcc2e('0x2'));var express=require('express');var router=express[_0xcc2e('0x3')]();var auth=require(_0xcc2e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcc2e('0x5'));var controller=require(_0xcc2e('0x6'));router[_0xcc2e('0x7')]('/',auth[_0xcc2e('0x8')](),controller[_0xcc2e('0x9')]);router[_0xcc2e('0x7')](_0xcc2e('0xa'),auth[_0xcc2e('0x8')](),controller[_0xcc2e('0xb')]);router[_0xcc2e('0xc')]('/',auth[_0xcc2e('0x8')](),controller['create']);router[_0xcc2e('0xd')](_0xcc2e('0xa'),auth[_0xcc2e('0x8')](),controller['update']);router[_0xcc2e('0xe')](_0xcc2e('0xa'),auth[_0xcc2e('0x8')](),controller['destroy']);module[_0xcc2e('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 903788b..8ff77fe 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 _0xa9e0=['string','STRING','variable','sequelize','exports','ENUM','customVariable','picklist'];(function(_0xc38caa,_0x5cb439){var _0x5cef32=function(_0x349f74){while(--_0x349f74){_0xc38caa['push'](_0xc38caa['shift']());}};_0x5cef32(++_0x5cb439);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c44=['variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0xbab353,_0x37e159){var _0x56871e=function(_0x474f77){while(--_0x474f77){_0xbab353['push'](_0xbab353['shift']());}};_0x56871e(++_0x37e159);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x6')]},'idField':{'type':Sequelize[_0x49c4('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 023fdb5..8b36bfa 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 _0x8016=['../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','SalesforceField','then','includeAll','include','catch','show','params','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5bdf2f,_0x5d9222){var _0x2f8acb=function(_0x4d5c45){while(--_0x4d5c45){_0x5bdf2f['push'](_0x5bdf2f['shift']());}};_0x2f8acb(++_0x5d9222);}(_0x8016,0x81));var _0x6801=function(_0x36feba,_0x541932){_0x36feba=_0x36feba-0x0;var _0x358e41=_0x8016[_0x36feba];return _0x358e41;};'use strict';var pdf=require(_0x6801('0x0'));var emlformat=require(_0x6801('0x1'));var rimraf=require(_0x6801('0x2'));var zipdir=require(_0x6801('0x3'));var jsonpatch=require(_0x6801('0x4'));var rp=require(_0x6801('0x5'));var moment=require(_0x6801('0x6'));var BPromise=require(_0x6801('0x7'));var Mustache=require(_0x6801('0x8'));var util=require(_0x6801('0x9'));var path=require(_0x6801('0xa'));var sox=require(_0x6801('0xb'));var csv=require('to-csv');var ejs=require(_0x6801('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6801('0xd'));var crypto=require(_0x6801('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6801('0xf'));var toCsv=require(_0x6801('0x10'));var querystring=require(_0x6801('0x11'));var Papa=require(_0x6801('0x12'));var Redis=require(_0x6801('0x13'));var authService=require(_0x6801('0x14'));var qs=require(_0x6801('0x15'));var as=require(_0x6801('0x16'));var hardwareService=require(_0x6801('0x17'));var logger=require(_0x6801('0x18'))('api');var utils=require(_0x6801('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6801('0x1a'));var db=require(_0x6801('0x1b'))['db'];function respondWithStatusCode(_0x403178,_0x1bbdf9){_0x1bbdf9=_0x1bbdf9||0xcc;return function(_0x4c7708){if(_0x4c7708){return _0x403178['sendStatus'](_0x1bbdf9);}return _0x403178[_0x6801('0x1c')](_0x1bbdf9)[_0x6801('0x1d')]();};}function respondWithResult(_0x20e0c0,_0x20cfe1){_0x20cfe1=_0x20cfe1||0xc8;return function(_0x486cc4){if(_0x486cc4){return _0x20e0c0[_0x6801('0x1c')](_0x20cfe1)[_0x6801('0x1e')](_0x486cc4);}};}function respondWithFilteredResult(_0x14ee23,_0x384051){return function(_0x213c23){if(_0x213c23){var _0x64f1bc=_0x213c23[_0x6801('0x1f')],_0x389db6=_0x384051[_0x6801('0x20')],_0x472184=_0x384051[_0x6801('0x20')]+_0x384051['limit'],_0x60ab8e;if(_0x472184>=_0x64f1bc){_0x472184=_0x64f1bc;_0x60ab8e=0xc8;}else{_0x60ab8e=0xce;}_0x14ee23[_0x6801('0x1c')](_0x60ab8e);return _0x14ee23[_0x6801('0x21')](_0x6801('0x22'),_0x389db6+'-'+_0x472184+'/'+_0x64f1bc)[_0x6801('0x1e')](_0x213c23);}return null;};}function patchUpdates(_0x129d21){return function(_0x281cf2){try{jsonpatch['apply'](_0x281cf2,_0x129d21,!![]);}catch(_0x1d9c2a){return BPromise[_0x6801('0x23')](_0x1d9c2a);}return _0x281cf2[_0x6801('0x24')]();};}function saveUpdates(_0x157b10,_0xd74248){return function(_0xb6a72a){if(_0xb6a72a){return _0xb6a72a[_0x6801('0x25')](_0x157b10)['then'](function(_0x28b2ec){return _0x28b2ec;});}return null;};}function removeEntity(_0x3adcd7,_0xa635f){return function(_0x4dce1e){if(_0x4dce1e){return _0x4dce1e[_0x6801('0x26')]()['then'](function(){_0x3adcd7[_0x6801('0x1c')](0xcc)[_0x6801('0x1d')]();});}};}function handleEntityNotFound(_0x30a38f,_0x80d65e){return function(_0x589273){if(!_0x589273){_0x30a38f[_0x6801('0x27')](0x194);}return _0x589273;};}function handleError(_0x1ebfb5,_0x38913d){_0x38913d=_0x38913d||0x1f4;return function(_0x24a8ab){logger['error'](_0x24a8ab[_0x6801('0x28')]);if(_0x24a8ab[_0x6801('0x29')]){delete _0x24a8ab[_0x6801('0x29')];}_0x1ebfb5[_0x6801('0x1c')](_0x38913d)[_0x6801('0x2a')](_0x24a8ab);};}exports['index']=function(_0x1f1b7b,_0x1e6750){var _0x3e6a73={},_0x1099b7={},_0x2e66e2={'count':0x0,'rows':[]};var _0x2fe3c5=_[_0x6801('0x2b')](db['SalesforceField'][_0x6801('0x2c')],function(_0x233d96){return{'name':_0x233d96[_0x6801('0x2d')],'type':_0x233d96[_0x6801('0x2e')][_0x6801('0x2f')]};});_0x1099b7[_0x6801('0x30')]=_[_0x6801('0x2b')](_0x2fe3c5,'name');_0x1099b7['query']=_[_0x6801('0x31')](_0x1f1b7b[_0x6801('0x32')]);_0x1099b7[_0x6801('0x33')]=_[_0x6801('0x34')](_0x1099b7[_0x6801('0x30')],_0x1099b7[_0x6801('0x32')]);_0x3e6a73[_0x6801('0x35')]=_[_0x6801('0x34')](_0x1099b7[_0x6801('0x30')],qs[_0x6801('0x36')](_0x1f1b7b['query'][_0x6801('0x36')]));_0x3e6a73[_0x6801('0x35')]=_0x3e6a73[_0x6801('0x35')][_0x6801('0x37')]?_0x3e6a73[_0x6801('0x35')]:_0x1099b7[_0x6801('0x30')];if(!_0x1f1b7b[_0x6801('0x32')][_0x6801('0x38')](_0x6801('0x39'))){_0x3e6a73[_0x6801('0x3a')]=qs[_0x6801('0x3a')](_0x1f1b7b[_0x6801('0x32')]['limit']);_0x3e6a73['offset']=qs['offset'](_0x1f1b7b[_0x6801('0x32')]['offset']);}_0x3e6a73[_0x6801('0x3b')]=qs[_0x6801('0x3c')](_0x1f1b7b[_0x6801('0x32')]['sort']);_0x3e6a73[_0x6801('0x3d')]=qs[_0x6801('0x33')](_[_0x6801('0x3e')](_0x1f1b7b['query'],_0x1099b7[_0x6801('0x33')]),_0x2fe3c5);if(_0x1f1b7b['query'][_0x6801('0x3f')]){_0x3e6a73[_0x6801('0x3d')]=_['merge'](_0x3e6a73[_0x6801('0x3d')],{'$or':_['map'](_0x2fe3c5,function(_0x5572f1){if(_0x5572f1['type']!==_0x6801('0x40')){var _0x31548a={};_0x31548a[_0x5572f1['name']]={'$like':'%'+_0x1f1b7b['query'][_0x6801('0x3f')]+'%'};return _0x31548a;}})});}_0x3e6a73=_[_0x6801('0x41')]({},_0x3e6a73,_0x1f1b7b['options']);var _0x40a6c9={'where':_0x3e6a73['where']};return db[_0x6801('0x42')]['count'](_0x40a6c9)[_0x6801('0x43')](function(_0x1ae16e){_0x2e66e2[_0x6801('0x1f')]=_0x1ae16e;if(_0x1f1b7b[_0x6801('0x32')][_0x6801('0x44')]){_0x3e6a73[_0x6801('0x45')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3e6a73);})[_0x6801('0x43')](function(_0x9df936){_0x2e66e2['rows']=_0x9df936;return _0x2e66e2;})[_0x6801('0x43')](respondWithFilteredResult(_0x1e6750,_0x3e6a73))[_0x6801('0x46')](handleError(_0x1e6750,null));};exports[_0x6801('0x47')]=function(_0x533352,_0x37d068){var _0x1b8f06={'raw':!![],'where':{'id':_0x533352[_0x6801('0x48')]['id']}},_0x4a19c9={};_0x4a19c9[_0x6801('0x30')]=_[_0x6801('0x31')](db[_0x6801('0x42')][_0x6801('0x2c')]);_0x4a19c9[_0x6801('0x32')]=_[_0x6801('0x31')](_0x533352[_0x6801('0x32')]);_0x4a19c9['filters']=_[_0x6801('0x34')](_0x4a19c9[_0x6801('0x30')],_0x4a19c9[_0x6801('0x32')]);_0x1b8f06['attributes']=_['intersection'](_0x4a19c9[_0x6801('0x30')],qs[_0x6801('0x36')](_0x533352['query']['fields']));_0x1b8f06['attributes']=_0x1b8f06[_0x6801('0x35')][_0x6801('0x37')]?_0x1b8f06['attributes']:_0x4a19c9[_0x6801('0x30')];if(_0x533352['query'][_0x6801('0x44')]){_0x1b8f06[_0x6801('0x45')]=[{'all':!![]}];}_0x1b8f06=_['merge']({},_0x1b8f06,_0x533352[_0x6801('0x49')]);return db[_0x6801('0x42')]['find'](_0x1b8f06)[_0x6801('0x43')](handleEntityNotFound(_0x37d068,null))[_0x6801('0x43')](respondWithResult(_0x37d068,null))[_0x6801('0x46')](handleError(_0x37d068,null));};exports[_0x6801('0x4a')]=function(_0x148127,_0x57771c){return db[_0x6801('0x42')][_0x6801('0x4a')](_0x148127[_0x6801('0x4b')],{})[_0x6801('0x43')](respondWithResult(_0x57771c,0xc9))[_0x6801('0x46')](handleError(_0x57771c,null));};exports[_0x6801('0x25')]=function(_0xd4eab7,_0x58b9d8){if(_0xd4eab7[_0x6801('0x4b')]['id']){delete _0xd4eab7[_0x6801('0x4b')]['id'];}return db[_0x6801('0x42')][_0x6801('0x4c')]({'where':{'id':_0xd4eab7['params']['id']}})[_0x6801('0x43')](handleEntityNotFound(_0x58b9d8,null))['then'](saveUpdates(_0xd4eab7[_0x6801('0x4b')],null))[_0x6801('0x43')](respondWithResult(_0x58b9d8,null))[_0x6801('0x46')](handleError(_0x58b9d8,null));};exports[_0x6801('0x26')]=function(_0x40d12b,_0x8ab6cb){return db['SalesforceField']['find']({'where':{'id':_0x40d12b[_0x6801('0x48')]['id']}})['then'](handleEntityNotFound(_0x8ab6cb,null))[_0x6801('0x43')](removeEntity(_0x8ab6cb,null))[_0x6801('0x46')](handleError(_0x8ab6cb,null));}; \ No newline at end of file +var _0x7c28=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','type','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','SalesforceField','include','findAll','rows','catch','show','fields','includeAll','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x7c28,0x11b));var _0x87c2=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7c28[_0x13ce0c];return _0x4388fb;};'use strict';var pdf=require(_0x87c2('0x0'));var emlformat=require(_0x87c2('0x1'));var rimraf=require(_0x87c2('0x2'));var zipdir=require(_0x87c2('0x3'));var jsonpatch=require(_0x87c2('0x4'));var rp=require(_0x87c2('0x5'));var moment=require(_0x87c2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x87c2('0x7'));var util=require(_0x87c2('0x8'));var path=require(_0x87c2('0x9'));var sox=require(_0x87c2('0xa'));var csv=require('to-csv');var ejs=require(_0x87c2('0xb'));var fs=require('fs');var _=require(_0x87c2('0xc'));var squel=require(_0x87c2('0xd'));var crypto=require(_0x87c2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x87c2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x87c2('0x10'));var Papa=require('papaparse');var Redis=require(_0x87c2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x87c2('0x12'));var as=require(_0x87c2('0x13'));var hardwareService=require(_0x87c2('0x14'));var logger=require(_0x87c2('0x15'))(_0x87c2('0x16'));var utils=require(_0x87c2('0x17'));var config=require(_0x87c2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59e4a3,_0x30cf22){_0x30cf22=_0x30cf22||0xcc;return function(_0x31b166){if(_0x31b166){return _0x59e4a3[_0x87c2('0x19')](_0x30cf22);}return _0x59e4a3[_0x87c2('0x1a')](_0x30cf22)[_0x87c2('0x1b')]();};}function respondWithResult(_0x16a248,_0x3fc1f4){_0x3fc1f4=_0x3fc1f4||0xc8;return function(_0x228eac){if(_0x228eac){return _0x16a248[_0x87c2('0x1a')](_0x3fc1f4)['json'](_0x228eac);}};}function respondWithFilteredResult(_0x286803,_0x1deb52){return function(_0x1af9c4){if(_0x1af9c4){var _0x1ba9fa=_0x1af9c4[_0x87c2('0x1c')],_0x2b0d97=_0x1deb52[_0x87c2('0x1d')],_0x3d17cc=_0x1deb52[_0x87c2('0x1d')]+_0x1deb52[_0x87c2('0x1e')],_0x3abc5;if(_0x3d17cc>=_0x1ba9fa){_0x3d17cc=_0x1ba9fa;_0x3abc5=0xc8;}else{_0x3abc5=0xce;}_0x286803[_0x87c2('0x1a')](_0x3abc5);return _0x286803['set'](_0x87c2('0x1f'),_0x2b0d97+'-'+_0x3d17cc+'/'+_0x1ba9fa)[_0x87c2('0x20')](_0x1af9c4);}return null;};}function patchUpdates(_0x5b9336){return function(_0x1ca462){try{jsonpatch[_0x87c2('0x21')](_0x1ca462,_0x5b9336,!![]);}catch(_0x21108a){return BPromise[_0x87c2('0x22')](_0x21108a);}return _0x1ca462[_0x87c2('0x23')]();};}function saveUpdates(_0x48e15b,_0x594d58){return function(_0xb2df8f){if(_0xb2df8f){return _0xb2df8f['update'](_0x48e15b)[_0x87c2('0x24')](function(_0x2a5972){return _0x2a5972;});}return null;};}function removeEntity(_0x252eaa,_0x4cbd14){return function(_0x1bb0a3){if(_0x1bb0a3){return _0x1bb0a3[_0x87c2('0x25')]()[_0x87c2('0x24')](function(){_0x252eaa[_0x87c2('0x1a')](0xcc)[_0x87c2('0x1b')]();});}};}function handleEntityNotFound(_0x4e93e5,_0x38d125){return function(_0x41c6c4){if(!_0x41c6c4){_0x4e93e5[_0x87c2('0x19')](0x194);}return _0x41c6c4;};}function handleError(_0x29ea57,_0x3cbd52){_0x3cbd52=_0x3cbd52||0x1f4;return function(_0x2178bc){logger[_0x87c2('0x26')](_0x2178bc[_0x87c2('0x27')]);if(_0x2178bc[_0x87c2('0x28')]){delete _0x2178bc[_0x87c2('0x28')];}_0x29ea57[_0x87c2('0x1a')](_0x3cbd52)['send'](_0x2178bc);};}exports['index']=function(_0x313cb4,_0x5ccb9d){var _0x597491={},_0x546101={},_0x21672d={'count':0x0,'rows':[]};var _0x166d29=_[_0x87c2('0x29')](db['SalesforceField'][_0x87c2('0x2a')],function(_0x392fc0){return{'name':_0x392fc0['fieldName'],'type':_0x392fc0[_0x87c2('0x2b')]['key']};});_0x546101[_0x87c2('0x2c')]=_[_0x87c2('0x29')](_0x166d29,_0x87c2('0x28'));_0x546101['query']=_[_0x87c2('0x2d')](_0x313cb4[_0x87c2('0x2e')]);_0x546101['filters']=_[_0x87c2('0x2f')](_0x546101[_0x87c2('0x2c')],_0x546101[_0x87c2('0x2e')]);_0x597491[_0x87c2('0x30')]=_[_0x87c2('0x2f')](_0x546101[_0x87c2('0x2c')],qs['fields'](_0x313cb4[_0x87c2('0x2e')]['fields']));_0x597491[_0x87c2('0x30')]=_0x597491[_0x87c2('0x30')][_0x87c2('0x31')]?_0x597491[_0x87c2('0x30')]:_0x546101['model'];if(!_0x313cb4[_0x87c2('0x2e')][_0x87c2('0x32')](_0x87c2('0x33'))){_0x597491['limit']=qs['limit'](_0x313cb4[_0x87c2('0x2e')][_0x87c2('0x1e')]);_0x597491['offset']=qs[_0x87c2('0x1d')](_0x313cb4[_0x87c2('0x2e')][_0x87c2('0x1d')]);}_0x597491[_0x87c2('0x34')]=qs[_0x87c2('0x35')](_0x313cb4[_0x87c2('0x2e')]['sort']);_0x597491['where']=qs[_0x87c2('0x36')](_[_0x87c2('0x37')](_0x313cb4['query'],_0x546101[_0x87c2('0x36')]),_0x166d29);if(_0x313cb4[_0x87c2('0x2e')][_0x87c2('0x38')]){_0x597491[_0x87c2('0x39')]=_['merge'](_0x597491[_0x87c2('0x39')],{'$or':_[_0x87c2('0x29')](_0x166d29,function(_0x37706a){if(_0x37706a[_0x87c2('0x2b')]!==_0x87c2('0x3a')){var _0x31e9c5={};_0x31e9c5[_0x37706a[_0x87c2('0x28')]]={'$like':'%'+_0x313cb4['query']['filter']+'%'};return _0x31e9c5;}})});}_0x597491=_[_0x87c2('0x3b')]({},_0x597491,_0x313cb4[_0x87c2('0x3c')]);var _0xec7421={'where':_0x597491[_0x87c2('0x39')]};return db[_0x87c2('0x3d')][_0x87c2('0x1c')](_0xec7421)[_0x87c2('0x24')](function(_0x310a87){_0x21672d['count']=_0x310a87;if(_0x313cb4[_0x87c2('0x2e')]['includeAll']){_0x597491[_0x87c2('0x3e')]=[{'all':!![]}];}return db['SalesforceField'][_0x87c2('0x3f')](_0x597491);})['then'](function(_0x1349cd){_0x21672d[_0x87c2('0x40')]=_0x1349cd;return _0x21672d;})[_0x87c2('0x24')](respondWithFilteredResult(_0x5ccb9d,_0x597491))[_0x87c2('0x41')](handleError(_0x5ccb9d,null));};exports[_0x87c2('0x42')]=function(_0x560efc,_0x4fa9a3){var _0x53e239={'raw':!![],'where':{'id':_0x560efc['params']['id']}},_0x519b72={};_0x519b72['model']=_[_0x87c2('0x2d')](db[_0x87c2('0x3d')]['rawAttributes']);_0x519b72[_0x87c2('0x2e')]=_[_0x87c2('0x2d')](_0x560efc[_0x87c2('0x2e')]);_0x519b72[_0x87c2('0x36')]=_[_0x87c2('0x2f')](_0x519b72[_0x87c2('0x2c')],_0x519b72['query']);_0x53e239[_0x87c2('0x30')]=_[_0x87c2('0x2f')](_0x519b72[_0x87c2('0x2c')],qs[_0x87c2('0x43')](_0x560efc['query']['fields']));_0x53e239[_0x87c2('0x30')]=_0x53e239['attributes']['length']?_0x53e239[_0x87c2('0x30')]:_0x519b72[_0x87c2('0x2c')];if(_0x560efc[_0x87c2('0x2e')][_0x87c2('0x44')]){_0x53e239[_0x87c2('0x3e')]=[{'all':!![]}];}_0x53e239=_[_0x87c2('0x3b')]({},_0x53e239,_0x560efc[_0x87c2('0x3c')]);return db['SalesforceField'][_0x87c2('0x45')](_0x53e239)[_0x87c2('0x24')](handleEntityNotFound(_0x4fa9a3,null))[_0x87c2('0x24')](respondWithResult(_0x4fa9a3,null))['catch'](handleError(_0x4fa9a3,null));};exports['create']=function(_0x568139,_0x12c461){return db[_0x87c2('0x3d')][_0x87c2('0x46')](_0x568139[_0x87c2('0x47')],{})[_0x87c2('0x24')](respondWithResult(_0x12c461,0xc9))[_0x87c2('0x41')](handleError(_0x12c461,null));};exports[_0x87c2('0x48')]=function(_0x2fe7b1,_0x31aba9){if(_0x2fe7b1['body']['id']){delete _0x2fe7b1[_0x87c2('0x47')]['id'];}return db[_0x87c2('0x3d')][_0x87c2('0x45')]({'where':{'id':_0x2fe7b1[_0x87c2('0x49')]['id']}})[_0x87c2('0x24')](handleEntityNotFound(_0x31aba9,null))[_0x87c2('0x24')](saveUpdates(_0x2fe7b1['body'],null))[_0x87c2('0x24')](respondWithResult(_0x31aba9,null))['catch'](handleError(_0x31aba9,null));};exports[_0x87c2('0x25')]=function(_0x3d8250,_0x51887e){return db[_0x87c2('0x3d')][_0x87c2('0x45')]({'where':{'id':_0x3d8250[_0x87c2('0x49')]['id']}})[_0x87c2('0x24')](handleEntityNotFound(_0x51887e,null))['then'](removeEntity(_0x51887e,null))['catch'](handleError(_0x51887e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c990c58..c85e7f0 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 _0xef8e=['request-promise','path','rimraf','exports','define','SalesforceField','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1fe976,_0x93ce76){var _0x15d9d3=function(_0x22a7e7){while(--_0x22a7e7){_0x1fe976['push'](_0x1fe976['shift']());}};_0x15d9d3(++_0x93ce76);}(_0xef8e,0x17b));var _0xeef8=function(_0x1634b6,_0x395bd3){_0x1634b6=_0x1634b6-0x0;var _0x5c02c2=_0xef8e[_0x1634b6];return _0x5c02c2;};'use strict';var _=require(_0xeef8('0x0'));var util=require('util');var logger=require(_0xeef8('0x1'))(_0xeef8('0x2'));var moment=require(_0xeef8('0x3'));var BPromise=require(_0xeef8('0x4'));var rp=require(_0xeef8('0x5'));var fs=require('fs');var path=require(_0xeef8('0x6'));var rimraf=require(_0xeef8('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xeef8('0x8')]=function(_0x2919c4,_0x247bf1){return _0x2919c4[_0xeef8('0x9')](_0xeef8('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xeef8('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb05=['request-promise','../../config/environment','exports','define','SalesforceField','idField','FieldId','../../config/logger','api','moment','bluebird'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xfb05,0x1b4));var _0x5fb0=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xfb05[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5fb0('0x0'))(_0x5fb0('0x1'));var moment=require(_0x5fb0('0x2'));var BPromise=require(_0x5fb0('0x3'));var rp=require(_0x5fb0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5fb0('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0x5fb0('0x6')]=function(_0xda0469,_0x2d8c25){return _0xda0469[_0x5fb0('0x7')](_0x5fb0('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x5fb0('0x9'),_0x5fb0('0xa')],'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 1a0ce21..96dabb9 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 _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x581dbf,_0x1fe0c5){var _0x41bf98=function(_0x31cfab){while(--_0x31cfab){_0x581dbf['push'](_0x581dbf['shift']());}};_0x41bf98(++_0x1fe0c5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x548050,_0x35f39d){_0x548050=_0x548050-0x0;var _0x1037fe=_0x9bde[_0x548050];return _0x1037fe;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18dfea,_0x43d571){var _0x5222e3=function(_0x3484ae){while(--_0x3484ae){_0x18dfea['push'](_0x18dfea['shift']());}};_0x5222e3(++_0x43d571);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xb4e6[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a0e0c7e..0c7e8a9 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 _0xda04=['create','addConfiguration','put','update','delete','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xda04,0x1be));var _0x4da0=function(_0xf785ae,_0x211032){_0xf785ae=_0xf785ae-0x0;var _0x2e9f79=_0xda04[_0xf785ae];return _0x2e9f79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4da0('0x0'));var timeout=require(_0x4da0('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4da0('0x2'));var interaction=require(_0x4da0('0x3'));var config=require(_0x4da0('0x4'));var controller=require(_0x4da0('0x5'));router[_0x4da0('0x6')]('/',auth[_0x4da0('0x7')](),controller[_0x4da0('0x8')]);router[_0x4da0('0x6')](_0x4da0('0x9'),auth[_0x4da0('0x7')](),controller[_0x4da0('0xa')]);router[_0x4da0('0x6')](_0x4da0('0xb'),auth['isAuthenticated'](),controller[_0x4da0('0xc')]);router[_0x4da0('0x6')](_0x4da0('0xd'),auth[_0x4da0('0x7')](),controller[_0x4da0('0xe')]);router[_0x4da0('0xf')]('/',auth[_0x4da0('0x7')](),controller[_0x4da0('0x10')]);router['post'](_0x4da0('0xb'),auth['isAuthenticated'](),controller[_0x4da0('0x11')]);router[_0x4da0('0x12')](_0x4da0('0x9'),auth[_0x4da0('0x7')](),controller[_0x4da0('0x13')]);router[_0x4da0('0x14')](_0x4da0('0x9'),auth[_0x4da0('0x7')](),controller['destroy']);module[_0x4da0('0x15')]=router; \ No newline at end of file +var _0x88de=['/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x88de,0x19c));var _0xe88d=function(_0x1df03c,_0x12d021){_0x1df03c=_0x1df03c-0x0;var _0x450e47=_0x88de[_0x1df03c];return _0x450e47;};'use strict';var multer=require(_0xe88d('0x0'));var util=require(_0xe88d('0x1'));var path=require(_0xe88d('0x2'));var timeout=require(_0xe88d('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe88d('0x4'));var config=require(_0xe88d('0x5'));var controller=require('./intServicenowAccount.controller');router[_0xe88d('0x6')]('/',auth['isAuthenticated'](),controller[_0xe88d('0x7')]);router[_0xe88d('0x6')](_0xe88d('0x8'),auth[_0xe88d('0x9')](),controller[_0xe88d('0xa')]);router[_0xe88d('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe88d('0xb')]);router[_0xe88d('0x6')](_0xe88d('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xe88d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe88d('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe88d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe88d('0x10')]);router[_0xe88d('0x11')](_0xe88d('0x8'),auth['isAuthenticated'](),controller[_0xe88d('0x12')]);module[_0xe88d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e60dd05..69efcc9 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 _0x7058=['STRING','username','sequelize','exports'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x7058,0xde));var _0x8705=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7058[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x8705('0x0'));module[_0x8705('0x1')]={'name':{'type':Sequelize[_0x8705('0x2')]},'description':{'type':Sequelize[_0x8705('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8705('0x3')},'password':{'type':Sequelize[_0x8705('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8705('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8705('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x30f2=['exports','STRING','username','remoteUri','sequelize'];(function(_0x553d2f,_0x5271dd){var _0xe5e4d1=function(_0xde51b1){while(--_0xde51b1){_0x553d2f['push'](_0x553d2f['shift']());}};_0xe5e4d1(++_0x5271dd);}(_0x30f2,0x103));var _0x230f=function(_0xec653d,_0x1fb313){_0xec653d=_0xec653d-0x0;var _0x360c95=_0x30f2[_0xec653d];return _0x360c95;};'use strict';var Sequelize=require(_0x230f('0x0'));module[_0x230f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x230f('0x2')],'unique':_0x230f('0x3')},'password':{'type':Sequelize[_0x230f('0x2')]},'email':{'type':Sequelize[_0x230f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x230f('0x4')},'serverUrl':{'type':Sequelize[_0x230f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ee555bf..1354773 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 _0x0c22=['pick','where','filter','merge','options','includeAll','include','rows','show','params','length','find','create','body','update','destroy','getConfigurations','sort','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','parent','caused_by','watch_list','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','assign','remove','includes','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x0c22,0x7a));var _0x20c2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0c22[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x20c2('0x0'));var emlformat=require(_0x20c2('0x1'));var rimraf=require(_0x20c2('0x2'));var zipdir=require(_0x20c2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20c2('0x4'));var moment=require('moment');var BPromise=require(_0x20c2('0x5'));var Mustache=require(_0x20c2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x20c2('0x7'));var csv=require(_0x20c2('0x8'));var ejs=require(_0x20c2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x20c2('0xa'));var crypto=require(_0x20c2('0xb'));var jsforce=require(_0x20c2('0xc'));var deskjs=require(_0x20c2('0xd'));var toCsv=require(_0x20c2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20c2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x20c2('0xf'));var as=require(_0x20c2('0x10'));var hardwareService=require(_0x20c2('0x11'));var logger=require(_0x20c2('0x12'))(_0x20c2('0x13'));var utils=require(_0x20c2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x20c2('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x20c2('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x20c2('0x17')][_0x20c2('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xef591a,_0x2edd68,_0x5f1e41,_0x282495){return new BPromise(function(_0xbe3399,_0x1561e1){var _0x34629a=_0x282495||client;return _0x34629a[_0x20c2('0x19')](_0xef591a,_0x5f1e41)[_0x20c2('0x1a')](function(_0x1fdd50){logger[_0x20c2('0x1b')](_0x20c2('0x1c'),_0x2edd68,_0x20c2('0x1d'));logger['debug'](_0x20c2('0x1e'),_0x2edd68,_0x20c2('0x1d'),JSON[_0x20c2('0x1f')](_0x1fdd50));if(_0x1fdd50[_0x20c2('0x20')]){if(_0x1fdd50['error']['code']===0x1f4){logger[_0x20c2('0x20')](_0x20c2('0x1c'),_0x2edd68,_0x1fdd50[_0x20c2('0x20')][_0x20c2('0x21')]);return _0x1561e1(_0x1fdd50[_0x20c2('0x20')][_0x20c2('0x21')]);}logger[_0x20c2('0x20')](_0x20c2('0x1c'),_0x2edd68,_0x1fdd50['error'][_0x20c2('0x21')]);return _0xbe3399(_0x1fdd50[_0x20c2('0x20')]['message']);}else{logger[_0x20c2('0x1b')](_0x20c2('0x1c'),_0x2edd68,_0x20c2('0x1d'));_0xbe3399(_0x1fdd50[_0x20c2('0x22')][_0x20c2('0x21')]);}})[_0x20c2('0x23')](function(_0x58d683){logger[_0x20c2('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x2edd68,_0x58d683);_0x1561e1(_0x58d683);});});}function respondWithStatusCode(_0x4a80c4,_0x419729){_0x419729=_0x419729||0xcc;return function(_0x44f1ec){if(_0x44f1ec){return _0x4a80c4[_0x20c2('0x24')](_0x419729);}return _0x4a80c4['status'](_0x419729)['end']();};}function respondWithResult(_0x3dc883,_0x585894){_0x585894=_0x585894||0xc8;return function(_0x3fe559){if(_0x3fe559){return _0x3dc883[_0x20c2('0x25')](_0x585894)[_0x20c2('0x26')](_0x3fe559);}};}function respondWithFilteredResult(_0x5e34a4,_0x2d5c62){return function(_0x4d9eec){if(_0x4d9eec){var _0x2727f1=_0x4d9eec[_0x20c2('0x27')],_0x5ec88b=_0x2d5c62[_0x20c2('0x28')],_0x133721=_0x2d5c62[_0x20c2('0x28')]+_0x2d5c62[_0x20c2('0x29')],_0xbe36af;if(_0x133721>=_0x2727f1){_0x133721=_0x2727f1;_0xbe36af=0xc8;}else{_0xbe36af=0xce;}_0x5e34a4[_0x20c2('0x25')](_0xbe36af);return _0x5e34a4[_0x20c2('0x2a')]('Content-Range',_0x5ec88b+'-'+_0x133721+'/'+_0x2727f1)[_0x20c2('0x26')](_0x4d9eec);}return null;};}function patchUpdates(_0x3de7ec){return function(_0x1c0fc5){try{jsonpatch[_0x20c2('0x2b')](_0x1c0fc5,_0x3de7ec,!![]);}catch(_0x52e26d){return BPromise[_0x20c2('0x2c')](_0x52e26d);}return _0x1c0fc5['save']();};}function saveUpdates(_0x202316,_0x5cd3fa){return function(_0x430a29){if(_0x430a29){return _0x430a29['update'](_0x202316)['then'](function(_0x2b650c){return _0x2b650c;});}return null;};}function removeEntity(_0x1ff329,_0x560ee8){return function(_0x385ff5){if(_0x385ff5){return _0x385ff5['destroy']()[_0x20c2('0x1a')](function(){_0x1ff329[_0x20c2('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee883,_0x1f33d4){return function(_0x5551d9){if(!_0x5551d9){_0x1ee883[_0x20c2('0x24')](0x194);}return _0x5551d9;};}function handleError(_0x34b755,_0x372286){_0x372286=_0x372286||0x1f4;return function(_0x99de8e){logger[_0x20c2('0x20')](_0x99de8e[_0x20c2('0x2d')]);if(_0x99de8e[_0x20c2('0x2e')]){delete _0x99de8e[_0x20c2('0x2e')];}_0x34b755[_0x20c2('0x25')](_0x372286)[_0x20c2('0x2f')](_0x99de8e);};}exports[_0x20c2('0x30')]=function(_0x4a9aca,_0x263cb6){var _0x2efc79={},_0x44c5ea={},_0x241bdc={'count':0x0,'rows':[]};var _0x145f89=_[_0x20c2('0x31')](db[_0x20c2('0x32')][_0x20c2('0x33')],function(_0x5a29e8){return{'name':_0x5a29e8[_0x20c2('0x34')],'type':_0x5a29e8[_0x20c2('0x35')][_0x20c2('0x36')]};});_0x44c5ea[_0x20c2('0x37')]=_['map'](_0x145f89,_0x20c2('0x2e'));_0x44c5ea[_0x20c2('0x38')]=_[_0x20c2('0x39')](_0x4a9aca[_0x20c2('0x38')]);_0x44c5ea[_0x20c2('0x3a')]=_[_0x20c2('0x3b')](_0x44c5ea[_0x20c2('0x37')],_0x44c5ea[_0x20c2('0x38')]);_0x2efc79['attributes']=_[_0x20c2('0x3b')](_0x44c5ea[_0x20c2('0x37')],qs[_0x20c2('0x3c')](_0x4a9aca[_0x20c2('0x38')]['fields']));_0x2efc79['attributes']=_0x2efc79[_0x20c2('0x3d')]['length']?_0x2efc79[_0x20c2('0x3d')]:_0x44c5ea['model'];if(!_0x4a9aca[_0x20c2('0x38')][_0x20c2('0x3e')](_0x20c2('0x3f'))){_0x2efc79[_0x20c2('0x29')]=qs[_0x20c2('0x29')](_0x4a9aca[_0x20c2('0x38')][_0x20c2('0x29')]);_0x2efc79[_0x20c2('0x28')]=qs[_0x20c2('0x28')](_0x4a9aca['query'][_0x20c2('0x28')]);}_0x2efc79[_0x20c2('0x40')]=qs['sort'](_0x4a9aca['query']['sort']);_0x2efc79['where']=qs[_0x20c2('0x3a')](_[_0x20c2('0x41')](_0x4a9aca['query'],_0x44c5ea['filters']),_0x145f89);if(_0x4a9aca[_0x20c2('0x38')]['filter']){_0x2efc79[_0x20c2('0x42')]=_['merge'](_0x2efc79[_0x20c2('0x42')],{'$or':_[_0x20c2('0x31')](_0x145f89,function(_0x5c990f){if(_0x5c990f[_0x20c2('0x35')]!=='VIRTUAL'){var _0x53646c={};_0x53646c[_0x5c990f[_0x20c2('0x2e')]]={'$like':'%'+_0x4a9aca['query'][_0x20c2('0x43')]+'%'};return _0x53646c;}})});}_0x2efc79=_[_0x20c2('0x44')]({},_0x2efc79,_0x4a9aca[_0x20c2('0x45')]);var _0x2bebe9={'where':_0x2efc79[_0x20c2('0x42')]};return db['ServicenowAccount'][_0x20c2('0x27')](_0x2bebe9)['then'](function(_0x5b3915){_0x241bdc[_0x20c2('0x27')]=_0x5b3915;if(_0x4a9aca[_0x20c2('0x38')][_0x20c2('0x46')]){_0x2efc79[_0x20c2('0x47')]=[{'all':!![]}];}return db[_0x20c2('0x32')]['findAll'](_0x2efc79);})[_0x20c2('0x1a')](function(_0x403a52){_0x241bdc[_0x20c2('0x48')]=_0x403a52;return _0x241bdc;})[_0x20c2('0x1a')](respondWithFilteredResult(_0x263cb6,_0x2efc79))[_0x20c2('0x23')](handleError(_0x263cb6,null));};exports[_0x20c2('0x49')]=function(_0x24c65c,_0x3592f3){var _0x182762={'raw':![],'where':{'id':_0x24c65c[_0x20c2('0x4a')]['id']}},_0xf06cfa={};_0xf06cfa[_0x20c2('0x37')]=_[_0x20c2('0x39')](db[_0x20c2('0x32')][_0x20c2('0x33')]);_0xf06cfa[_0x20c2('0x38')]=_[_0x20c2('0x39')](_0x24c65c[_0x20c2('0x38')]);_0xf06cfa[_0x20c2('0x3a')]=_[_0x20c2('0x3b')](_0xf06cfa[_0x20c2('0x37')],_0xf06cfa[_0x20c2('0x38')]);_0x182762['attributes']=_[_0x20c2('0x3b')](_0xf06cfa['model'],qs['fields'](_0x24c65c[_0x20c2('0x38')][_0x20c2('0x3c')]));_0x182762[_0x20c2('0x3d')]=_0x182762['attributes'][_0x20c2('0x4b')]?_0x182762[_0x20c2('0x3d')]:_0xf06cfa[_0x20c2('0x37')];if(_0x24c65c['query']['includeAll']){_0x182762['include']=[{'all':!![]}];}_0x182762=_[_0x20c2('0x44')]({},_0x182762,_0x24c65c[_0x20c2('0x45')]);return db[_0x20c2('0x32')][_0x20c2('0x4c')](_0x182762)[_0x20c2('0x1a')](handleEntityNotFound(_0x3592f3,null))['then'](respondWithResult(_0x3592f3,null))[_0x20c2('0x23')](handleError(_0x3592f3,null));};exports[_0x20c2('0x4d')]=function(_0x1d1744,_0x21bca7){return db[_0x20c2('0x32')][_0x20c2('0x4d')](_0x1d1744[_0x20c2('0x4e')],{})[_0x20c2('0x1a')](respondWithResult(_0x21bca7,0xc9))['catch'](handleError(_0x21bca7,null));};exports[_0x20c2('0x4f')]=function(_0x21e540,_0x3dbf06){if(_0x21e540[_0x20c2('0x4e')]['id']){delete _0x21e540[_0x20c2('0x4e')]['id'];}return db[_0x20c2('0x32')][_0x20c2('0x4c')]({'where':{'id':_0x21e540[_0x20c2('0x4a')]['id']}})[_0x20c2('0x1a')](handleEntityNotFound(_0x3dbf06,null))[_0x20c2('0x1a')](saveUpdates(_0x21e540[_0x20c2('0x4e')],null))['then'](respondWithResult(_0x3dbf06,null))[_0x20c2('0x23')](handleError(_0x3dbf06,null));};exports[_0x20c2('0x50')]=function(_0x233e3a,_0x54b0f4){return db['ServicenowAccount'][_0x20c2('0x4c')]({'where':{'id':_0x233e3a[_0x20c2('0x4a')]['id']}})[_0x20c2('0x1a')](handleEntityNotFound(_0x54b0f4,null))['then'](removeEntity(_0x54b0f4,null))[_0x20c2('0x23')](handleError(_0x54b0f4,null));};exports[_0x20c2('0x51')]=function(_0x533f8d,_0x1a2c14,_0x4c35d5){var _0x27b8b5={};var _0x1a14cb={};var _0x469970;var _0xc5c4c6;return db[_0x20c2('0x32')]['findOne']({'where':{'id':_0x533f8d[_0x20c2('0x4a')]['id']}})[_0x20c2('0x1a')](handleEntityNotFound(_0x1a2c14,null))[_0x20c2('0x1a')](function(_0x1b21a7){if(_0x1b21a7){_0x469970=_0x1b21a7;_0x1a14cb[_0x20c2('0x37')]=_['keys'](db['ServicenowConfiguration'][_0x20c2('0x33')]);_0x1a14cb['query']=_[_0x20c2('0x39')](_0x533f8d[_0x20c2('0x38')]);_0x1a14cb[_0x20c2('0x3a')]=_[_0x20c2('0x3b')](_0x1a14cb[_0x20c2('0x37')],_0x1a14cb['query']);_0x27b8b5[_0x20c2('0x3d')]=_[_0x20c2('0x3b')](_0x1a14cb['model'],qs[_0x20c2('0x3c')](_0x533f8d[_0x20c2('0x38')][_0x20c2('0x3c')]));_0x27b8b5[_0x20c2('0x3d')]=_0x27b8b5[_0x20c2('0x3d')][_0x20c2('0x4b')]?_0x27b8b5[_0x20c2('0x3d')]:_0x1a14cb['model'];_0x27b8b5[_0x20c2('0x40')]=qs[_0x20c2('0x52')](_0x533f8d[_0x20c2('0x38')]['sort']);_0x27b8b5[_0x20c2('0x42')]=qs[_0x20c2('0x3a')](_[_0x20c2('0x41')](_0x533f8d[_0x20c2('0x38')],_0x1a14cb['filters']));if(_0x533f8d[_0x20c2('0x38')][_0x20c2('0x43')]){_0x27b8b5[_0x20c2('0x42')]=_[_0x20c2('0x44')](_0x27b8b5[_0x20c2('0x42')],{'$or':_[_0x20c2('0x31')](_0x27b8b5[_0x20c2('0x3d')],function(_0x548c11){var _0x46627e={};_0x46627e[_0x548c11]={'$like':'%'+_0x533f8d['query'][_0x20c2('0x43')]+'%'};return _0x46627e;})});}_0x27b8b5=_[_0x20c2('0x44')]({},_0x27b8b5,_0x533f8d[_0x20c2('0x45')]);return _0x469970[_0x20c2('0x51')](_0x27b8b5);}})[_0x20c2('0x1a')](function(_0x51470f){if(_0x51470f){_0xc5c4c6=_0x51470f[_0x20c2('0x4b')];if(!_0x533f8d[_0x20c2('0x38')]['hasOwnProperty'](_0x20c2('0x3f'))){_0x27b8b5[_0x20c2('0x29')]=qs[_0x20c2('0x29')](_0x533f8d['query'][_0x20c2('0x29')]);_0x27b8b5['offset']=qs[_0x20c2('0x28')](_0x533f8d[_0x20c2('0x38')][_0x20c2('0x28')]);}return _0x469970[_0x20c2('0x51')](_0x27b8b5);}})[_0x20c2('0x1a')](function(_0x23cf9e){if(_0x23cf9e){return _0x23cf9e?{'count':_0xc5c4c6,'rows':_0x23cf9e}:null;}})['then'](respondWithResult(_0x1a2c14,null))[_0x20c2('0x23')](handleError(_0x1a2c14,null));};exports[_0x20c2('0x53')]=function(_0x4b26ec,_0x3824d9,_0x1e791b){if(_0x4b26ec[_0x20c2('0x4e')]['id']){delete _0x4b26ec[_0x20c2('0x4e')]['id'];}return db[_0x20c2('0x32')][_0x20c2('0x54')]({'where':{'id':_0x4b26ec['params']['id']}})[_0x20c2('0x1a')](handleEntityNotFound(_0x3824d9,null))['then'](function(_0xf840d3){if(_0xf840d3){_0x4b26ec['body'][_0x20c2('0x55')]=_0xf840d3['id'];_0x4b26ec['body']['Subjects']=integrations[_0x20c2('0x56')](_0x4b26ec['body'][_0x20c2('0x57')],_0x4b26ec[_0x20c2('0x4e')]['type']);_0x4b26ec['body'][_0x20c2('0x58')]=integrations[_0x20c2('0x59')](_0x4b26ec[_0x20c2('0x4e')]['channel'],_0x4b26ec[_0x20c2('0x4e')][_0x20c2('0x35')]);return db['ServicenowConfiguration']['create'](_0x4b26ec['body'],{'include':[{'model':db[_0x20c2('0x5a')],'as':_0x20c2('0x5b')},{'model':db[_0x20c2('0x5a')],'as':'Descriptions'}]});}return null;})[_0x20c2('0x1a')](respondWithResult(_0x3824d9,null))['catch'](handleError(_0x3824d9,null));};exports[_0x20c2('0x5c')]=function(_0xaf1036,_0x2b3ded,_0x201b6f){var _0x38d78a=[_0x20c2('0x5d'),_0x20c2('0x5e'),_0x20c2('0x5f'),_0x20c2('0x60'),_0x20c2('0x61'),'notify','incident_state',_0x20c2('0x62'),'category'];var _0x2ffe82=[_0x20c2('0x63'),_0x20c2('0x5d'),_0x20c2('0x64'),_0x20c2('0x65'),'upon_reject','sys_updated_on',_0x20c2('0x66'),_0x20c2('0x5e'),_0x20c2('0x67'),_0x20c2('0x68'),_0x20c2('0x69'),_0x20c2('0x6a'),_0x20c2('0x6b'),_0x20c2('0x6c'),_0x20c2('0x6d'),_0x20c2('0x6e'),'state',_0x20c2('0x6f'),'knowledge','order',_0x20c2('0x70'),_0x20c2('0x71'),_0x20c2('0x72'),'delivery_plan',_0x20c2('0x73'),_0x20c2('0x74'),_0x20c2('0x75'),_0x20c2('0x76'),_0x20c2('0x77'),_0x20c2('0x78'),_0x20c2('0x79'),_0x20c2('0x7a'),'expected_start','opened_at',_0x20c2('0x7b'),'group_list','work_end',_0x20c2('0x7c'),'resolved_at',_0x20c2('0x7d'),'approval_set',_0x20c2('0x60'),_0x20c2('0x7e'),_0x20c2('0x7f'),_0x20c2('0x61'),_0x20c2('0x80'),_0x20c2('0x81'),'work_start','assignment_group',_0x20c2('0x82'),_0x20c2('0x83'),_0x20c2('0x84'),_0x20c2('0x85'),_0x20c2('0x86'),'sys_class_name',_0x20c2('0x87'),_0x20c2('0x88'),'follow_up',_0x20c2('0x89'),_0x20c2('0x8a'),_0x20c2('0x8b'),'reopened_by',_0x20c2('0x8c'),_0x20c2('0x8d'),_0x20c2('0x8e'),_0x20c2('0x8f'),_0x20c2('0x90'),_0x20c2('0x91'),_0x20c2('0x92'),'severity',_0x20c2('0x93'),'sla_due',_0x20c2('0x94'),_0x20c2('0x95'),_0x20c2('0x96'),'sys_mod_count',_0x20c2('0x97'),_0x20c2('0x98'),_0x20c2('0x99'),_0x20c2('0x9a'),'correlation_id','location','category'];var _0x2109ba='';var _0x3a06b3='';var _0x8b8f1e=[];var _0x44187e='';var _0x294cc0='';var _0x18f87f=[];var _0x5bcc61='';var _0x153e75='';var _0x5273cb={};var _0x1a0a14='';return db['ServicenowAccount'][_0x20c2('0x54')]({'where':{'id':_0xaf1036[_0x20c2('0x4a')]['id']},'attributes':['id',_0x20c2('0x9b'),_0x20c2('0x9c'),_0x20c2('0x9d'),_0x20c2('0x9e'),_0x20c2('0x9f')]})['then'](handleEntityNotFound(_0x2b3ded,null))['then'](function(_0x1fcbc3){if(_0x1fcbc3){_0x1a0a14=_0x1fcbc3[_0x20c2('0x9e')];var _0x406ae4=_0x1a0a14[_0x20c2('0xa0')](-0x1);if(_0x406ae4==='/'){_0x1a0a14=_0x1a0a14[_0x20c2('0xa1')](0x0,_0x1a0a14['lastIndexOf'](_0x406ae4));}_0x153e75=util['format'](_0x20c2('0xa2'),_0x1a0a14);_0x5bcc61=util[_0x20c2('0xa3')]('%s/api/now/table/',_0x1a0a14);_0x5273cb={'user':_0x1fcbc3[_0x20c2('0x9b')],'pass':_0x1fcbc3['password']};var _0x52d581={'method':_0x20c2('0xa4'),'uri':_0x153e75+_0x20c2('0xa5'),'auth':_0x5273cb,'json':!![]};return rp(_0x52d581);}})[_0x20c2('0x1a')](function(_0x4b00c6){if(_0x4b00c6['result']['length']>0x0){_0x2109ba=_0x4b00c6[_0x20c2('0x22')];}console['log']('incident\x20table\x20objects',_0x2109ba);_0x18f87f=[];_0x3a06b3=Object[_0x20c2('0xa6')]([],_0x2109ba);_[_0x20c2('0xa7')](_0x3a06b3,function(_0x3aec12){return!_0x38d78a[_0x20c2('0xa8')](_0x3aec12[_0x20c2('0x2e')]);});_0x3a06b3['forEach'](function(_0xc10af8){var _0x2e58ef=createFieldObject(_0x5bcc61,_0x5273cb,_0xc10af8['internalType'],_0xc10af8[_0x20c2('0x2e')],_0xc10af8[_0x20c2('0xa9')],![]);_0x18f87f[_0x20c2('0xaa')](_0x2e58ef);});return Promise[_0x20c2('0xab')](_0x18f87f);})[_0x20c2('0x1a')](function(_0x3d901d){_0x8b8f1e=_0x3d901d;_0x44187e=Object[_0x20c2('0xa6')]([],_0x2109ba);console[_0x20c2('0xac')](_0x20c2('0xad'),_0x2109ba);_['remove'](_0x44187e,function(_0x3490ce){return _0x2ffe82['includes'](_0x3490ce[_0x20c2('0x2e')]);});console[_0x20c2('0xac')](_0x20c2('0xae'),_0x44187e);_0x18f87f=[];_0x44187e[_0x20c2('0xaf')](function(_0x5c8642){var _0x31c30b=createFieldObject(_0x5bcc61,_0x5273cb,_0x5c8642[_0x20c2('0xb0')],_0x5c8642[_0x20c2('0x2e')],_0x5c8642[_0x20c2('0xa9')],!![]);_0x18f87f[_0x20c2('0xaa')](_0x31c30b);});return Promise[_0x20c2('0xab')](_0x18f87f);})[_0x20c2('0x1a')](function(_0x249d9e){_0x294cc0=_0x249d9e;var _0x15c2b0=_0x8b8f1e[_0x20c2('0xb1')](_0x294cc0);return{'count':_0x15c2b0['length'],'rows':_0x15c2b0};})[_0x20c2('0x1a')](respondWithResult(_0x2b3ded,null))[_0x20c2('0x23')](function(_0x5f53e4){console[_0x20c2('0xac')](_0x20c2('0xb2')+_0x5f53e4);var _0x18d666=_0xaf1036[_0x20c2('0x38')][_0x20c2('0xb3')]?0x1f4:_0x5f53e4[_0x20c2('0xb4')]||0x1f4;logger['error'](_0x5f53e4[_0x20c2('0x2d')]);delete _0x5f53e4['name'];if(_0x18d666===0x191){_0x18d666=0x190;}_0x2b3ded[_0x20c2('0x25')](_0x18d666)[_0x20c2('0x2f')](_0xaf1036[_0x20c2('0x38')][_0x20c2('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0x5f53e4[_0x20c2('0xb4')]}:_0x5f53e4);});};function createFieldObject(_0x3302f3,_0x464661,_0x4bf6e0,_0x5d3f13,_0x58df94,_0x4331f9){return new Promise(function(_0x3d1c05,_0x1fba86){var _0x4369f={'id':_0x5d3f13,'name':_0x58df94,'custom':_0x4331f9};if(_0x4bf6e0===_0x20c2('0xb5')){_0x4369f[_0x20c2('0x45')]=[{'name':'True','value':_0x20c2('0xb6')},{'name':_0x20c2('0xb7'),'value':_0x20c2('0xb8')}];_0x3d1c05(_0x4369f);}else{var _0x15b249={'method':_0x20c2('0xa4'),'uri':_0x3302f3+_0x20c2('0xb9')+_0x5d3f13,'auth':_0x464661,'json':!![]};return rp(_0x15b249)['then'](function(_0x5a8be2){var _0x32b15b=[];if(_0x5a8be2[_0x20c2('0x22')]['length']>0x0){_0x5a8be2[_0x20c2('0x22')]['forEach'](function(_0xafd681){if(_0xafd681[_0x20c2('0xba')]===_0x20c2('0xb8')){var _0x3fa711={'name':_0xafd681[_0x20c2('0xa9')],'value':_0xafd681['value']};_0x32b15b[_0x20c2('0xaa')](_0x3fa711);}});}_0x4369f[_0x20c2('0x45')]=_0x32b15b;if(_0x4369f[_0x20c2('0x45')][_0x20c2('0x4b')]>0x0){_0x3d1c05(_0x4369f);}else{if(_0x4331f9==![]){_0x3d1c05();}else{_0x3d1c05(_0x4369f);}}});}});} \ No newline at end of file +var _0x82a8=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','catch','create','body','update','find','getConfigurations','findOne','ServicenowConfiguration','sort','options','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','sys_created_by','cmdb_ci','delivery_plan','active','work_notes_list','priority','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','urgency','problem_id','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','location','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x82a8,0x84));var _0x882a=function(_0x417147,_0x512e27){_0x417147=_0x417147-0x0;var _0x210ff5=_0x82a8[_0x417147];return _0x210ff5;};'use strict';var pdf=require(_0x882a('0x0'));var emlformat=require(_0x882a('0x1'));var rimraf=require(_0x882a('0x2'));var zipdir=require(_0x882a('0x3'));var jsonpatch=require(_0x882a('0x4'));var rp=require(_0x882a('0x5'));var moment=require(_0x882a('0x6'));var BPromise=require(_0x882a('0x7'));var Mustache=require(_0x882a('0x8'));var util=require(_0x882a('0x9'));var path=require(_0x882a('0xa'));var sox=require('sox');var csv=require(_0x882a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x882a('0xc'));var squel=require(_0x882a('0xd'));var crypto=require('crypto');var jsforce=require(_0x882a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x882a('0xf'));var Papa=require(_0x882a('0x10'));var Redis=require(_0x882a('0x11'));var authService=require(_0x882a('0x12'));var qs=require(_0x882a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x882a('0x14'))(_0x882a('0x15'));var utils=require('../../config/utils');var config=require(_0x882a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x882a('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x882a('0x18'));var client=jayson[_0x882a('0x19')][_0x882a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x55fbc7,_0x14d906,_0x4d80c0,_0x3ea169){return new BPromise(function(_0x22c672,_0x260795){var _0x1a38c7=_0x3ea169||client;return _0x1a38c7[_0x882a('0x1b')](_0x55fbc7,_0x4d80c0)[_0x882a('0x1c')](function(_0x2532bb){logger[_0x882a('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x14d906,_0x882a('0x1e'));logger[_0x882a('0x1f')](_0x882a('0x20'),_0x14d906,_0x882a('0x1e'),JSON[_0x882a('0x21')](_0x2532bb));if(_0x2532bb[_0x882a('0x22')]){if(_0x2532bb[_0x882a('0x22')][_0x882a('0x23')]===0x1f4){logger[_0x882a('0x22')](_0x882a('0x24'),_0x14d906,_0x2532bb[_0x882a('0x22')][_0x882a('0x25')]);return _0x260795(_0x2532bb['error'][_0x882a('0x25')]);}logger[_0x882a('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x14d906,_0x2532bb[_0x882a('0x22')]['message']);return _0x22c672(_0x2532bb[_0x882a('0x22')]['message']);}else{logger[_0x882a('0x1d')](_0x882a('0x24'),_0x14d906,_0x882a('0x1e'));_0x22c672(_0x2532bb[_0x882a('0x26')][_0x882a('0x25')]);}})['catch'](function(_0x597387){logger[_0x882a('0x22')](_0x882a('0x24'),_0x14d906,_0x597387);_0x260795(_0x597387);});});}function respondWithStatusCode(_0x182c9f,_0x578e52){_0x578e52=_0x578e52||0xcc;return function(_0x6fd80a){if(_0x6fd80a){return _0x182c9f[_0x882a('0x27')](_0x578e52);}return _0x182c9f[_0x882a('0x28')](_0x578e52)[_0x882a('0x29')]();};}function respondWithResult(_0x55dd16,_0x59e3f5){_0x59e3f5=_0x59e3f5||0xc8;return function(_0x5b9278){if(_0x5b9278){return _0x55dd16[_0x882a('0x28')](_0x59e3f5)[_0x882a('0x2a')](_0x5b9278);}};}function respondWithFilteredResult(_0x28cc01,_0x1cb71c){return function(_0x3ab9d7){if(_0x3ab9d7){var _0xbf0fd1=_0x3ab9d7[_0x882a('0x2b')],_0x4445e4=_0x1cb71c['offset'],_0x1fbcbc=_0x1cb71c[_0x882a('0x2c')]+_0x1cb71c[_0x882a('0x2d')],_0x4949d7;if(_0x1fbcbc>=_0xbf0fd1){_0x1fbcbc=_0xbf0fd1;_0x4949d7=0xc8;}else{_0x4949d7=0xce;}_0x28cc01[_0x882a('0x28')](_0x4949d7);return _0x28cc01[_0x882a('0x2e')]('Content-Range',_0x4445e4+'-'+_0x1fbcbc+'/'+_0xbf0fd1)[_0x882a('0x2a')](_0x3ab9d7);}return null;};}function patchUpdates(_0x3ce196){return function(_0x3d0a9f){try{jsonpatch[_0x882a('0x2f')](_0x3d0a9f,_0x3ce196,!![]);}catch(_0x442404){return BPromise[_0x882a('0x30')](_0x442404);}return _0x3d0a9f['save']();};}function saveUpdates(_0x3604c9,_0x4aa387){return function(_0x58ade0){if(_0x58ade0){return _0x58ade0['update'](_0x3604c9)[_0x882a('0x1c')](function(_0x557776){return _0x557776;});}return null;};}function removeEntity(_0x408d22,_0x3f6814){return function(_0x3dfc9e){if(_0x3dfc9e){return _0x3dfc9e[_0x882a('0x31')]()[_0x882a('0x1c')](function(){_0x408d22['status'](0xcc)[_0x882a('0x29')]();});}};}function handleEntityNotFound(_0x33bbaf,_0x59d68b){return function(_0x4715d8){if(!_0x4715d8){_0x33bbaf[_0x882a('0x27')](0x194);}return _0x4715d8;};}function handleError(_0x2481c7,_0x4a6f6b){_0x4a6f6b=_0x4a6f6b||0x1f4;return function(_0x1b4ae7){logger[_0x882a('0x22')](_0x1b4ae7[_0x882a('0x32')]);if(_0x1b4ae7[_0x882a('0x33')]){delete _0x1b4ae7[_0x882a('0x33')];}_0x2481c7[_0x882a('0x28')](_0x4a6f6b)[_0x882a('0x34')](_0x1b4ae7);};}exports[_0x882a('0x35')]=function(_0x22cbab,_0x5ec4b7){var _0xbf334f={},_0x35ae06={},_0x578f83={'count':0x0,'rows':[]};var _0x62a5c8=_[_0x882a('0x36')](db[_0x882a('0x37')][_0x882a('0x38')],function(_0xfb9cc){return{'name':_0xfb9cc[_0x882a('0x39')],'type':_0xfb9cc[_0x882a('0x3a')][_0x882a('0x3b')]};});_0x35ae06[_0x882a('0x3c')]=_[_0x882a('0x36')](_0x62a5c8,_0x882a('0x33'));_0x35ae06[_0x882a('0x3d')]=_[_0x882a('0x3e')](_0x22cbab[_0x882a('0x3d')]);_0x35ae06[_0x882a('0x3f')]=_[_0x882a('0x40')](_0x35ae06[_0x882a('0x3c')],_0x35ae06[_0x882a('0x3d')]);_0xbf334f[_0x882a('0x41')]=_[_0x882a('0x40')](_0x35ae06['model'],qs[_0x882a('0x42')](_0x22cbab['query'][_0x882a('0x42')]));_0xbf334f[_0x882a('0x41')]=_0xbf334f[_0x882a('0x41')][_0x882a('0x43')]?_0xbf334f[_0x882a('0x41')]:_0x35ae06[_0x882a('0x3c')];if(!_0x22cbab[_0x882a('0x3d')][_0x882a('0x44')](_0x882a('0x45'))){_0xbf334f[_0x882a('0x2d')]=qs[_0x882a('0x2d')](_0x22cbab[_0x882a('0x3d')][_0x882a('0x2d')]);_0xbf334f[_0x882a('0x2c')]=qs[_0x882a('0x2c')](_0x22cbab[_0x882a('0x3d')][_0x882a('0x2c')]);}_0xbf334f[_0x882a('0x46')]=qs['sort'](_0x22cbab[_0x882a('0x3d')]['sort']);_0xbf334f[_0x882a('0x47')]=qs[_0x882a('0x3f')](_[_0x882a('0x48')](_0x22cbab[_0x882a('0x3d')],_0x35ae06[_0x882a('0x3f')]),_0x62a5c8);if(_0x22cbab[_0x882a('0x3d')][_0x882a('0x49')]){_0xbf334f[_0x882a('0x47')]=_['merge'](_0xbf334f[_0x882a('0x47')],{'$or':_[_0x882a('0x36')](_0x62a5c8,function(_0x245f16){if(_0x245f16[_0x882a('0x3a')]!==_0x882a('0x4a')){var _0x5aed81={};_0x5aed81[_0x245f16[_0x882a('0x33')]]={'$like':'%'+_0x22cbab[_0x882a('0x3d')][_0x882a('0x49')]+'%'};return _0x5aed81;}})});}_0xbf334f=_[_0x882a('0x4b')]({},_0xbf334f,_0x22cbab['options']);var _0x5c4095={'where':_0xbf334f[_0x882a('0x47')]};return db[_0x882a('0x37')][_0x882a('0x2b')](_0x5c4095)[_0x882a('0x1c')](function(_0x26370b){_0x578f83['count']=_0x26370b;if(_0x22cbab[_0x882a('0x3d')][_0x882a('0x4c')]){_0xbf334f[_0x882a('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0xbf334f);})['then'](function(_0xd5630d){_0x578f83[_0x882a('0x4e')]=_0xd5630d;return _0x578f83;})[_0x882a('0x1c')](respondWithFilteredResult(_0x5ec4b7,_0xbf334f))['catch'](handleError(_0x5ec4b7,null));};exports[_0x882a('0x4f')]=function(_0x3ec4b8,_0x56a460){var _0x1773ad={'raw':![],'where':{'id':_0x3ec4b8[_0x882a('0x50')]['id']}},_0x25c758={};_0x25c758['model']=_[_0x882a('0x3e')](db[_0x882a('0x37')][_0x882a('0x38')]);_0x25c758[_0x882a('0x3d')]=_[_0x882a('0x3e')](_0x3ec4b8[_0x882a('0x3d')]);_0x25c758['filters']=_['intersection'](_0x25c758[_0x882a('0x3c')],_0x25c758['query']);_0x1773ad[_0x882a('0x41')]=_[_0x882a('0x40')](_0x25c758[_0x882a('0x3c')],qs[_0x882a('0x42')](_0x3ec4b8[_0x882a('0x3d')][_0x882a('0x42')]));_0x1773ad['attributes']=_0x1773ad[_0x882a('0x41')][_0x882a('0x43')]?_0x1773ad[_0x882a('0x41')]:_0x25c758[_0x882a('0x3c')];if(_0x3ec4b8['query'][_0x882a('0x4c')]){_0x1773ad[_0x882a('0x4d')]=[{'all':!![]}];}_0x1773ad=_[_0x882a('0x4b')]({},_0x1773ad,_0x3ec4b8['options']);return db[_0x882a('0x37')]['find'](_0x1773ad)['then'](handleEntityNotFound(_0x56a460,null))[_0x882a('0x1c')](respondWithResult(_0x56a460,null))[_0x882a('0x51')](handleError(_0x56a460,null));};exports[_0x882a('0x52')]=function(_0x42d1d9,_0xf1613){return db[_0x882a('0x37')][_0x882a('0x52')](_0x42d1d9[_0x882a('0x53')],{})[_0x882a('0x1c')](respondWithResult(_0xf1613,0xc9))[_0x882a('0x51')](handleError(_0xf1613,null));};exports[_0x882a('0x54')]=function(_0x4cfe9a,_0x55d05d){if(_0x4cfe9a[_0x882a('0x53')]['id']){delete _0x4cfe9a[_0x882a('0x53')]['id'];}return db[_0x882a('0x37')][_0x882a('0x55')]({'where':{'id':_0x4cfe9a[_0x882a('0x50')]['id']}})[_0x882a('0x1c')](handleEntityNotFound(_0x55d05d,null))[_0x882a('0x1c')](saveUpdates(_0x4cfe9a['body'],null))[_0x882a('0x1c')](respondWithResult(_0x55d05d,null))['catch'](handleError(_0x55d05d,null));};exports[_0x882a('0x31')]=function(_0x47e221,_0x1addce){return db[_0x882a('0x37')][_0x882a('0x55')]({'where':{'id':_0x47e221[_0x882a('0x50')]['id']}})['then'](handleEntityNotFound(_0x1addce,null))['then'](removeEntity(_0x1addce,null))[_0x882a('0x51')](handleError(_0x1addce,null));};exports[_0x882a('0x56')]=function(_0xd0f58b,_0x514be,_0x34c4e6){var _0x16719e={};var _0x49c700={};var _0x1c66cb;var _0x5c01c7;return db[_0x882a('0x37')][_0x882a('0x57')]({'where':{'id':_0xd0f58b[_0x882a('0x50')]['id']}})['then'](handleEntityNotFound(_0x514be,null))[_0x882a('0x1c')](function(_0x3d5163){if(_0x3d5163){_0x1c66cb=_0x3d5163;_0x49c700[_0x882a('0x3c')]=_[_0x882a('0x3e')](db[_0x882a('0x58')][_0x882a('0x38')]);_0x49c700[_0x882a('0x3d')]=_[_0x882a('0x3e')](_0xd0f58b['query']);_0x49c700['filters']=_[_0x882a('0x40')](_0x49c700['model'],_0x49c700['query']);_0x16719e[_0x882a('0x41')]=_[_0x882a('0x40')](_0x49c700['model'],qs['fields'](_0xd0f58b[_0x882a('0x3d')][_0x882a('0x42')]));_0x16719e['attributes']=_0x16719e[_0x882a('0x41')][_0x882a('0x43')]?_0x16719e[_0x882a('0x41')]:_0x49c700[_0x882a('0x3c')];_0x16719e['order']=qs[_0x882a('0x59')](_0xd0f58b['query'][_0x882a('0x59')]);_0x16719e[_0x882a('0x47')]=qs['filters'](_['pick'](_0xd0f58b[_0x882a('0x3d')],_0x49c700['filters']));if(_0xd0f58b[_0x882a('0x3d')][_0x882a('0x49')]){_0x16719e[_0x882a('0x47')]=_[_0x882a('0x4b')](_0x16719e[_0x882a('0x47')],{'$or':_[_0x882a('0x36')](_0x16719e['attributes'],function(_0x42289b){var _0x3eb512={};_0x3eb512[_0x42289b]={'$like':'%'+_0xd0f58b[_0x882a('0x3d')]['filter']+'%'};return _0x3eb512;})});}_0x16719e=_[_0x882a('0x4b')]({},_0x16719e,_0xd0f58b[_0x882a('0x5a')]);return _0x1c66cb[_0x882a('0x56')](_0x16719e);}})[_0x882a('0x1c')](function(_0x55414e){if(_0x55414e){_0x5c01c7=_0x55414e[_0x882a('0x43')];if(!_0xd0f58b[_0x882a('0x3d')][_0x882a('0x44')](_0x882a('0x45'))){_0x16719e[_0x882a('0x2d')]=qs['limit'](_0xd0f58b[_0x882a('0x3d')][_0x882a('0x2d')]);_0x16719e[_0x882a('0x2c')]=qs[_0x882a('0x2c')](_0xd0f58b[_0x882a('0x3d')][_0x882a('0x2c')]);}return _0x1c66cb[_0x882a('0x56')](_0x16719e);}})[_0x882a('0x1c')](function(_0x1bf634){if(_0x1bf634){return _0x1bf634?{'count':_0x5c01c7,'rows':_0x1bf634}:null;}})['then'](respondWithResult(_0x514be,null))[_0x882a('0x51')](handleError(_0x514be,null));};exports[_0x882a('0x5b')]=function(_0x2c37bf,_0xe12f3d,_0x1d3d70){if(_0x2c37bf[_0x882a('0x53')]['id']){delete _0x2c37bf[_0x882a('0x53')]['id'];}return db['ServicenowAccount'][_0x882a('0x57')]({'where':{'id':_0x2c37bf[_0x882a('0x50')]['id']}})['then'](handleEntityNotFound(_0xe12f3d,null))[_0x882a('0x1c')](function(_0x17a60d){if(_0x17a60d){_0x2c37bf['body'][_0x882a('0x5c')]=_0x17a60d['id'];_0x2c37bf[_0x882a('0x53')][_0x882a('0x5d')]=integrations[_0x882a('0x5e')](_0x2c37bf[_0x882a('0x53')]['channel'],_0x2c37bf[_0x882a('0x53')][_0x882a('0x3a')]);_0x2c37bf[_0x882a('0x53')][_0x882a('0x5f')]=integrations['getDescriptions'](_0x2c37bf['body']['channel'],_0x2c37bf[_0x882a('0x53')]['type']);return db[_0x882a('0x58')][_0x882a('0x52')](_0x2c37bf['body'],{'include':[{'model':db[_0x882a('0x60')],'as':_0x882a('0x5d')},{'model':db[_0x882a('0x60')],'as':'Descriptions'}]});}return null;})[_0x882a('0x1c')](respondWithResult(_0xe12f3d,null))[_0x882a('0x51')](handleError(_0xe12f3d,null));};exports[_0x882a('0x61')]=function(_0x34f797,_0x51c6d5,_0x150b32){var _0x32fcb6=[_0x882a('0x62'),_0x882a('0x63'),_0x882a('0x64'),'subcategory',_0x882a('0x65'),_0x882a('0x66'),_0x882a('0x67'),_0x882a('0x68'),_0x882a('0x69')];var _0xb99e20=['parent',_0x882a('0x62'),_0x882a('0x6a'),'watch_list',_0x882a('0x6b'),_0x882a('0x6c'),'child_incidents',_0x882a('0x63'),_0x882a('0x6d'),_0x882a('0x6e'),_0x882a('0x6f'),'sys_updated_by','opened_by',_0x882a('0x70'),_0x882a('0x71'),_0x882a('0x72'),'state',_0x882a('0x73'),_0x882a('0x64'),_0x882a('0x46'),'calendar_stc','closed_at',_0x882a('0x74'),_0x882a('0x75'),'impact',_0x882a('0x76'),_0x882a('0x77'),'business_service',_0x882a('0x78'),'sys_domain_path',_0x882a('0x79'),_0x882a('0x7a'),_0x882a('0x7b'),_0x882a('0x7c'),_0x882a('0x7d'),'group_list',_0x882a('0x7e'),_0x882a('0x7f'),_0x882a('0x80'),_0x882a('0x81'),_0x882a('0x82'),_0x882a('0x83'),_0x882a('0x84'),_0x882a('0x85'),'close_code',_0x882a('0x86'),_0x882a('0x87'),'work_start',_0x882a('0x88'),_0x882a('0x89'),_0x882a('0x8a'),_0x882a('0x8b'),_0x882a('0x8c'),_0x882a('0x66'),_0x882a('0x8d'),_0x882a('0x8e'),_0x882a('0x8f'),_0x882a('0x90'),_0x882a('0x91'),'sys_id','contact_type',_0x882a('0x92'),'incident_state',_0x882a('0x93'),_0x882a('0x94'),'company','reassignment_count','activity_due',_0x882a('0x95'),_0x882a('0x68'),_0x882a('0x96'),_0x882a('0x97'),_0x882a('0x98'),'comments_and_work_notes',_0x882a('0x99'),_0x882a('0x9a'),_0x882a('0x9b'),_0x882a('0x9c'),'escalation',_0x882a('0x9d'),'correlation_id',_0x882a('0x9e'),_0x882a('0x69')];var _0x26c180='';var _0x4f5a7b='';var _0x46442d=[];var _0x38ff42='';var _0x92ffec='';var _0x23adb3=[];var _0x13e697='';var _0x43043f='';var _0x22c274={};var _0x206f93='';return db['ServicenowAccount'][_0x882a('0x57')]({'where':{'id':_0x34f797[_0x882a('0x50')]['id']},'attributes':['id',_0x882a('0x9f'),'password',_0x882a('0xa0'),_0x882a('0xa1'),'serverUrl']})['then'](handleEntityNotFound(_0x51c6d5,null))[_0x882a('0x1c')](function(_0x2879be){if(_0x2879be){_0x206f93=_0x2879be['remoteUri'];var _0x5011b9=_0x206f93[_0x882a('0xa2')](-0x1);if(_0x5011b9==='/'){_0x206f93=_0x206f93[_0x882a('0xa3')](0x0,_0x206f93[_0x882a('0xa4')](_0x5011b9));}_0x43043f=util['format']('%s/api/now/doc/table/schema/',_0x206f93);_0x13e697=util[_0x882a('0xa5')](_0x882a('0xa6'),_0x206f93);_0x22c274={'user':_0x2879be[_0x882a('0x9f')],'pass':_0x2879be[_0x882a('0xa7')]};var _0x50477c={'method':_0x882a('0xa8'),'uri':_0x43043f+_0x882a('0xa9'),'auth':_0x22c274,'json':!![]};return rp(_0x50477c);}})[_0x882a('0x1c')](function(_0x1254b5){if(_0x1254b5['result'][_0x882a('0x43')]>0x0){_0x26c180=_0x1254b5[_0x882a('0x26')];}console[_0x882a('0xaa')](_0x882a('0xab'),_0x26c180);_0x23adb3=[];_0x4f5a7b=Object[_0x882a('0xac')]([],_0x26c180);_[_0x882a('0xad')](_0x4f5a7b,function(_0x986dff){return!_0x32fcb6[_0x882a('0xae')](_0x986dff[_0x882a('0x33')]);});_0x4f5a7b[_0x882a('0xaf')](function(_0x36cd51){var _0x43363c=createFieldObject(_0x13e697,_0x22c274,_0x36cd51['internalType'],_0x36cd51[_0x882a('0x33')],_0x36cd51['label'],![]);_0x23adb3[_0x882a('0xb0')](_0x43363c);});return Promise[_0x882a('0xb1')](_0x23adb3);})[_0x882a('0x1c')](function(_0x1d6719){_0x46442d=_0x1d6719;_0x38ff42=Object[_0x882a('0xac')]([],_0x26c180);console[_0x882a('0xaa')](_0x882a('0xb2'),_0x26c180);_[_0x882a('0xad')](_0x38ff42,function(_0x5a6c0f){return _0xb99e20['includes'](_0x5a6c0f[_0x882a('0x33')]);});console[_0x882a('0xaa')](_0x882a('0xb3'),_0x38ff42);_0x23adb3=[];_0x38ff42[_0x882a('0xaf')](function(_0x1e5471){var _0x4cdba2=createFieldObject(_0x13e697,_0x22c274,_0x1e5471['internalType'],_0x1e5471[_0x882a('0x33')],_0x1e5471[_0x882a('0xb4')],!![]);_0x23adb3['push'](_0x4cdba2);});return Promise[_0x882a('0xb1')](_0x23adb3);})[_0x882a('0x1c')](function(_0x45b18a){_0x92ffec=_0x45b18a;var _0xe60b95=_0x46442d[_0x882a('0xb5')](_0x92ffec);return{'count':_0xe60b95[_0x882a('0x43')],'rows':_0xe60b95};})[_0x882a('0x1c')](respondWithResult(_0x51c6d5,null))[_0x882a('0x51')](function(_0x18ee86){console[_0x882a('0xaa')](_0x882a('0xb6')+_0x18ee86);var _0x30e75b=_0x34f797[_0x882a('0x3d')][_0x882a('0xb7')]?0x1f4:_0x18ee86[_0x882a('0xb8')]||0x1f4;logger[_0x882a('0x22')](_0x18ee86['stack']);delete _0x18ee86[_0x882a('0x33')];if(_0x30e75b===0x191){_0x30e75b=0x190;}_0x51c6d5[_0x882a('0x28')](_0x30e75b)[_0x882a('0x34')](_0x34f797['query'][_0x882a('0xb7')]?{'message':_0x882a('0xb9'),'statusCode':_0x18ee86[_0x882a('0xb8')]}:_0x18ee86);});};function createFieldObject(_0x23c07e,_0x1caacd,_0x2ead30,_0x3657bf,_0x323e12,_0x5e65e7){return new Promise(function(_0x2b8a95,_0x26ac88){var _0x14d041={'id':_0x3657bf,'name':_0x323e12,'custom':_0x5e65e7};if(_0x2ead30==='boolean'){_0x14d041[_0x882a('0x5a')]=[{'name':'True','value':'true'},{'name':'False','value':_0x882a('0xba')}];_0x2b8a95(_0x14d041);}else{var _0xdff94f={'method':_0x882a('0xa8'),'uri':_0x23c07e+_0x882a('0xbb')+_0x3657bf,'auth':_0x1caacd,'json':!![]};return rp(_0xdff94f)[_0x882a('0x1c')](function(_0x8f8c85){var _0x982295=[];if(_0x8f8c85[_0x882a('0x26')][_0x882a('0x43')]>0x0){_0x8f8c85['result'][_0x882a('0xaf')](function(_0x564f0f){if(_0x564f0f['inactive']==='false'){var _0x4b4249={'name':_0x564f0f[_0x882a('0xb4')],'value':_0x564f0f[_0x882a('0xbc')]};_0x982295[_0x882a('0xb0')](_0x4b4249);}});}_0x14d041['options']=_0x982295;if(_0x14d041[_0x882a('0x5a')][_0x882a('0x43')]>0x0){_0x2b8a95(_0x14d041);}else{if(_0x5e65e7==![]){_0x2b8a95();}else{_0x2b8a95(_0x14d041);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9df77ef..6ad1138 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 _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x91bde,_0x47336e){var _0x5019bd=function(_0x90237b){while(--_0x90237b){_0x91bde['push'](_0x91bde['shift']());}};_0x5019bd(++_0x47336e);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x415b28,_0x203d2b){_0x415b28=_0x415b28-0x0;var _0x4daf30=_0x9c5a[_0x415b28];return _0x4daf30;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x22aedf,_0x422977){var _0x40796d=function(_0x2157be){while(--_0x2157be){_0x22aedf['push'](_0x22aedf['shift']());}};_0x40796d(++_0x422977);}(_0xe14b,0x93));var _0xbe14=function(_0x1baa30,_0x6639f0){_0x1baa30=_0x1baa30-0x0;var _0x381894=_0xe14b[_0x1baa30];return _0x381894;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 0cba893..d635920 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 _0x552b=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','limit','map','include','model','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x552b,0x199));var _0xb552=function(_0x52c86e,_0x2e3d5d){_0x52c86e=_0x52c86e-0x0;var _0x1c7206=_0x552b[_0x52c86e];return _0x1c7206;};'use strict';var _=require(_0xb552('0x0'));var util=require(_0xb552('0x1'));var moment=require(_0xb552('0x2'));var BPromise=require('bluebird');var rs=require(_0xb552('0x3'));var fs=require('fs');var Redis=require(_0xb552('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb552('0x5'));var logger=require('../../config/logger')(_0xb552('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb552('0x7')][_0xb552('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51781f,_0x4fb89e,_0x166e82){return new BPromise(function(_0x487be4,_0x1f77cd){return client[_0xb552('0x9')](_0x51781f,_0x166e82)[_0xb552('0xa')](function(_0x53f43d){logger[_0xb552('0xb')](_0xb552('0xc'),_0x4fb89e,_0xb552('0xd'));logger[_0xb552('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4fb89e,'request\x20sent',JSON[_0xb552('0xf')](_0x53f43d));if(_0x53f43d[_0xb552('0x10')]){if(_0x53f43d[_0xb552('0x10')][_0xb552('0x11')]===0x1f4){logger[_0xb552('0x10')](_0xb552('0xc'),_0x4fb89e,_0x53f43d[_0xb552('0x10')]['message']);return _0x1f77cd(_0x53f43d[_0xb552('0x10')][_0xb552('0x12')]);}logger[_0xb552('0x10')](_0xb552('0xc'),_0x4fb89e,_0x53f43d['error'][_0xb552('0x12')]);return _0x487be4(_0x53f43d['error'][_0xb552('0x12')]);}else{logger[_0xb552('0xb')](_0xb552('0xc'),_0x4fb89e,_0xb552('0xd'));_0x487be4(_0x53f43d[_0xb552('0x13')][_0xb552('0x12')]);}})[_0xb552('0x14')](function(_0x11e155){logger[_0xb552('0x10')](_0xb552('0xc'),_0x4fb89e,_0x11e155);_0x1f77cd(_0x11e155);});});}exports[_0xb552('0x15')]=function(_0x4ba864){var _0x35f355=this;return new Promise(function(_0x5205a3,_0x58ca5a){return db[_0xb552('0x16')]['findAll']({'raw':_0x4ba864['options']?_0x4ba864['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ba864[_0xb552('0x17')]?_0x4ba864['options'][_0xb552('0x18')]||null:null,'attributes':_0x4ba864[_0xb552('0x17')]?_0x4ba864['options'][_0xb552('0x19')]||null:null,'limit':_0x4ba864[_0xb552('0x17')]?_0x4ba864[_0xb552('0x17')][_0xb552('0x1a')]||null:null,'include':_0x4ba864['options']?_0x4ba864['options']['include']?_[_0xb552('0x1b')](_0x4ba864[_0xb552('0x17')][_0xb552('0x1c')],function(_0x96e5be){return{'model':db[_0x96e5be['model']],'as':_0x96e5be['as'],'attributes':_0x96e5be[_0xb552('0x19')],'include':_0x96e5be['include']?_[_0xb552('0x1b')](_0x96e5be[_0xb552('0x1c')],function(_0x575abe){return{'model':db[_0x575abe[_0xb552('0x1d')]],'as':_0x575abe['as'],'attributes':_0x575abe[_0xb552('0x19')],'include':_0x575abe['include']?_[_0xb552('0x1b')](_0x575abe[_0xb552('0x1c')],function(_0x35eed7){return{'model':db[_0x35eed7['model']],'as':_0x35eed7['as'],'attributes':_0x35eed7[_0xb552('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb552('0xa')](function(_0x599d0b){logger[_0xb552('0xb')](_0xb552('0x15'),_0x4ba864);logger[_0xb552('0xe')](_0xb552('0x15'),_0x4ba864,JSON[_0xb552('0xf')](_0x599d0b));_0x5205a3(_0x599d0b);})[_0xb552('0x14')](function(_0x180b0d){logger[_0xb552('0x10')](_0xb552('0x15'),_0x180b0d['message'],_0x4ba864);_0x58ca5a(_0x35f355[_0xb552('0x10')](0x1f4,_0x180b0d[_0xb552('0x12')]));});});};exports[_0xb552('0x1e')]=function(_0x43e7f4){var _0x1a401c=this;return new Promise(function(_0x4edaa9,_0x276f71){return db['ServicenowAccount'][_0xb552('0x1f')]({'raw':_0x43e7f4[_0xb552('0x17')]?_0x43e7f4['options']['raw']===undefined?!![]:![]:!![],'where':_0x43e7f4['options']?_0x43e7f4[_0xb552('0x17')][_0xb552('0x18')]||null:null,'attributes':_0x43e7f4['options']?_0x43e7f4[_0xb552('0x17')]['attributes']||null:null,'include':_0x43e7f4[_0xb552('0x17')]?_0x43e7f4[_0xb552('0x17')][_0xb552('0x1c')]?_['map'](_0x43e7f4['options']['include'],function(_0x2d7259){return{'model':db[_0x2d7259[_0xb552('0x1d')]],'as':_0x2d7259['as'],'attributes':_0x2d7259[_0xb552('0x19')],'include':_0x2d7259[_0xb552('0x1c')]?_[_0xb552('0x1b')](_0x2d7259[_0xb552('0x1c')],function(_0x1eec71){return{'model':db[_0x1eec71[_0xb552('0x1d')]],'as':_0x1eec71['as'],'attributes':_0x1eec71[_0xb552('0x19')],'include':_0x1eec71[_0xb552('0x1c')]?_[_0xb552('0x1b')](_0x1eec71[_0xb552('0x1c')],function(_0x59446e){return{'model':db[_0x59446e[_0xb552('0x1d')]],'as':_0x59446e['as'],'attributes':_0x59446e[_0xb552('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39d7d0){logger[_0xb552('0xb')](_0xb552('0x1e'),_0x43e7f4);logger[_0xb552('0xe')](_0xb552('0x1e'),_0x43e7f4,JSON[_0xb552('0xf')](_0x39d7d0));_0x4edaa9(_0x39d7d0);})[_0xb552('0x14')](function(_0x5a05f1){logger[_0xb552('0x10')](_0xb552('0x1e'),_0x5a05f1[_0xb552('0x12')],_0x43e7f4);_0x276f71(_0x1a401c[_0xb552('0x10')](0x1f4,_0x5a05f1['message']));});});}; \ No newline at end of file +var _0xe386=['options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ServicenowAccount','findAll'];(function(_0x4c87c8,_0x193c77){var _0x24b62c=function(_0x1bd6b3){while(--_0x1bd6b3){_0x4c87c8['push'](_0x4c87c8['shift']());}};_0x24b62c(++_0x193c77);}(_0xe386,0x17f));var _0x6e38=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe386[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x6e38('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e38('0x1'));var db=require(_0x6e38('0x2'))['db'];var utils=require(_0x6e38('0x3'));var logger=require(_0x6e38('0x4'))('rpc');var config=require(_0x6e38('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e38('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x310e08,_0x643bc9,_0x256a6a){return new BPromise(function(_0x2dff9c,_0x5f1919){return client['request'](_0x310e08,_0x256a6a)[_0x6e38('0x7')](function(_0x309f17){logger[_0x6e38('0x8')](_0x6e38('0x9'),_0x643bc9,_0x6e38('0xa'));logger[_0x6e38('0xb')](_0x6e38('0xc'),_0x643bc9,'request\x20sent',JSON['stringify'](_0x309f17));if(_0x309f17[_0x6e38('0xd')]){if(_0x309f17['error'][_0x6e38('0xe')]===0x1f4){logger[_0x6e38('0xd')](_0x6e38('0x9'),_0x643bc9,_0x309f17[_0x6e38('0xd')][_0x6e38('0xf')]);return _0x5f1919(_0x309f17['error'][_0x6e38('0xf')]);}logger[_0x6e38('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x643bc9,_0x309f17[_0x6e38('0xd')][_0x6e38('0xf')]);return _0x2dff9c(_0x309f17[_0x6e38('0xd')][_0x6e38('0xf')]);}else{logger[_0x6e38('0x8')]('ServicenowAccount,\x20%s,\x20%s',_0x643bc9,'request\x20sent');_0x2dff9c(_0x309f17[_0x6e38('0x10')][_0x6e38('0xf')]);}})[_0x6e38('0x11')](function(_0x5b1f07){logger[_0x6e38('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x643bc9,_0x5b1f07);_0x5f1919(_0x5b1f07);});});}exports['GetServicenowAccount']=function(_0x497c02){var _0x220cec=this;return new Promise(function(_0x3faec1,_0x5b68f9){return db[_0x6e38('0x12')][_0x6e38('0x13')]({'raw':_0x497c02[_0x6e38('0x14')]?_0x497c02['options'][_0x6e38('0x15')]===undefined?!![]:![]:!![],'where':_0x497c02[_0x6e38('0x14')]?_0x497c02['options'][_0x6e38('0x16')]||null:null,'attributes':_0x497c02['options']?_0x497c02['options'][_0x6e38('0x17')]||null:null,'limit':_0x497c02['options']?_0x497c02['options'][_0x6e38('0x18')]||null:null,'include':_0x497c02['options']?_0x497c02[_0x6e38('0x14')][_0x6e38('0x19')]?_[_0x6e38('0x1a')](_0x497c02[_0x6e38('0x14')][_0x6e38('0x19')],function(_0x5c3ffb){return{'model':db[_0x5c3ffb['model']],'as':_0x5c3ffb['as'],'attributes':_0x5c3ffb[_0x6e38('0x17')],'include':_0x5c3ffb['include']?_['map'](_0x5c3ffb['include'],function(_0x248c1b){return{'model':db[_0x248c1b[_0x6e38('0x1b')]],'as':_0x248c1b['as'],'attributes':_0x248c1b[_0x6e38('0x17')],'include':_0x248c1b[_0x6e38('0x19')]?_[_0x6e38('0x1a')](_0x248c1b['include'],function(_0x2e98d9){return{'model':db[_0x2e98d9['model']],'as':_0x2e98d9['as'],'attributes':_0x2e98d9[_0x6e38('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13db69){logger[_0x6e38('0x8')]('GetServicenowAccount',_0x497c02);logger[_0x6e38('0xb')](_0x6e38('0x1c'),_0x497c02,JSON[_0x6e38('0x1d')](_0x13db69));_0x3faec1(_0x13db69);})['catch'](function(_0x7c63da){logger['error'](_0x6e38('0x1c'),_0x7c63da[_0x6e38('0xf')],_0x497c02);_0x5b68f9(_0x220cec[_0x6e38('0xd')](0x1f4,_0x7c63da[_0x6e38('0xf')]));});});};exports[_0x6e38('0x1e')]=function(_0x59613e){var _0x5f11ef=this;return new Promise(function(_0x12224e,_0x5e21d0){return db[_0x6e38('0x12')]['find']({'raw':_0x59613e['options']?_0x59613e[_0x6e38('0x14')][_0x6e38('0x15')]===undefined?!![]:![]:!![],'where':_0x59613e[_0x6e38('0x14')]?_0x59613e[_0x6e38('0x14')][_0x6e38('0x16')]||null:null,'attributes':_0x59613e[_0x6e38('0x14')]?_0x59613e['options']['attributes']||null:null,'include':_0x59613e[_0x6e38('0x14')]?_0x59613e['options'][_0x6e38('0x19')]?_[_0x6e38('0x1a')](_0x59613e[_0x6e38('0x14')]['include'],function(_0x2cf74b){return{'model':db[_0x2cf74b['model']],'as':_0x2cf74b['as'],'attributes':_0x2cf74b['attributes'],'include':_0x2cf74b[_0x6e38('0x19')]?_['map'](_0x2cf74b[_0x6e38('0x19')],function(_0x188002){return{'model':db[_0x188002['model']],'as':_0x188002['as'],'attributes':_0x188002[_0x6e38('0x17')],'include':_0x188002[_0x6e38('0x19')]?_[_0x6e38('0x1a')](_0x188002[_0x6e38('0x19')],function(_0x3a530d){return{'model':db[_0x3a530d['model']],'as':_0x3a530d['as'],'attributes':_0x3a530d[_0x6e38('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45371a){logger['info'](_0x6e38('0x1e'),_0x59613e);logger[_0x6e38('0xb')]('ShowServicenowAccount',_0x59613e,JSON[_0x6e38('0x1d')](_0x45371a));_0x12224e(_0x45371a);})[_0x6e38('0x11')](function(_0x275c2d){logger[_0x6e38('0xd')](_0x6e38('0x1e'),_0x275c2d[_0x6e38('0xf')],_0x59613e);_0x5e21d0(_0x5f11ef[_0x6e38('0xd')](0x1f4,_0x275c2d[_0x6e38('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6c487dc..566e311 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 _0xa706=['/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xa706,0x199));var _0x6a70=function(_0x453903,_0x2386e4){_0x453903=_0x453903-0x0;var _0x3b23c5=_0xa706[_0x453903];return _0x3b23c5;};'use strict';var multer=require('multer');var util=require(_0x6a70('0x0'));var path=require(_0x6a70('0x1'));var timeout=require(_0x6a70('0x2'));var express=require('express');var router=express[_0x6a70('0x3')]();var auth=require(_0x6a70('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a70('0x5'));var controller=require(_0x6a70('0x6'));router[_0x6a70('0x7')]('/',auth[_0x6a70('0x8')](),controller[_0x6a70('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6a70('0xa')]);router[_0x6a70('0x7')](_0x6a70('0xb'),auth[_0x6a70('0x8')](),controller[_0x6a70('0xc')]);router[_0x6a70('0x7')](_0x6a70('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6a70('0xe')]);router['post']('/',auth[_0x6a70('0x8')](),controller[_0x6a70('0xf')]);router[_0x6a70('0x10')](_0x6a70('0x11'),auth[_0x6a70('0x8')](),controller['update']);router[_0x6a70('0x12')](_0x6a70('0x11'),auth['isAuthenticated'](),controller[_0x6a70('0x13')]);module[_0x6a70('0x14')]=router; \ No newline at end of file +var _0xf843=['getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xeb1b60,_0x3017ee){var _0x423637=function(_0x44c90b){while(--_0x44c90b){_0xeb1b60['push'](_0xeb1b60['shift']());}};_0x423637(++_0x3017ee);}(_0xf843,0xbf));var _0x3f84=function(_0x4e56e6,_0x5677ab){_0x4e56e6=_0x4e56e6-0x0;var _0x59cef0=_0xf843[_0x4e56e6];return _0x59cef0;};'use strict';var multer=require(_0x3f84('0x0'));var util=require(_0x3f84('0x1'));var path=require('path');var timeout=require(_0x3f84('0x2'));var express=require(_0x3f84('0x3'));var router=express[_0x3f84('0x4')]();var auth=require(_0x3f84('0x5'));var interaction=require(_0x3f84('0x6'));var config=require(_0x3f84('0x7'));var controller=require(_0x3f84('0x8'));router[_0x3f84('0x9')]('/',auth[_0x3f84('0xa')](),controller[_0x3f84('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3f84('0xc')]);router[_0x3f84('0x9')](_0x3f84('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x3f84('0x9')](_0x3f84('0xe'),auth['isAuthenticated'](),controller[_0x3f84('0xf')]);router[_0x3f84('0x9')](_0x3f84('0x10'),auth[_0x3f84('0xa')](),controller[_0x3f84('0x11')]);router[_0x3f84('0x12')]('/',auth[_0x3f84('0xa')](),controller[_0x3f84('0x13')]);router[_0x3f84('0x14')](_0x3f84('0x15'),auth[_0x3f84('0xa')](),controller[_0x3f84('0x16')]);router[_0x3f84('0x17')](_0x3f84('0x15'),auth[_0x3f84('0xa')](),controller[_0x3f84('0x18')]);module[_0x3f84('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ff06939..ae35318 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 _0xc5ca=['STRING','exports'];(function(_0x1519d8,_0x35bd8d){var _0x18d3e1=function(_0x268174){while(--_0x268174){_0x1519d8['push'](_0x1519d8['shift']());}};_0x18d3e1(++_0x35bd8d);}(_0xc5ca,0x181));var _0xac5c=function(_0x24ac46,_0xde2c13){_0x24ac46=_0x24ac46-0x0;var _0x413ed5=_0xc5ca[_0x24ac46];return _0x413ed5;};'use strict';var Sequelize=require('sequelize');module[_0xac5c('0x0')]={'name':{'type':Sequelize[_0xac5c('0x1')]},'description':{'type':Sequelize[_0xac5c('0x1')]}}; \ No newline at end of file +var _0x2db6=['sequelize','exports','STRING'];(function(_0x3f7ebc,_0x20a132){var _0x22468e=function(_0x4a6add){while(--_0x4a6add){_0x3f7ebc['push'](_0x3f7ebc['shift']());}};_0x22468e(++_0x20a132);}(_0x2db6,0x1b0));var _0x62db=function(_0x3ad300,_0x23a814){_0x3ad300=_0x3ad300-0x0;var _0x551fe3=_0x2db6[_0x3ad300];return _0x551fe3;};'use strict';var Sequelize=require(_0x62db('0x0'));module[_0x62db('0x1')]={'name':{'type':Sequelize[_0x62db('0x2')]},'description':{'type':Sequelize[_0x62db('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5931240..5ac98cc 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 _0xf2b7=['status','json','count','offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','include','find','create','body','params','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus'];(function(_0xe83cd1,_0x553293){var _0x25d935=function(_0x348223){while(--_0x348223){_0xe83cd1['push'](_0xe83cd1['shift']());}};_0x25d935(++_0x553293);}(_0xf2b7,0x143));var _0x7f2b=function(_0x467164,_0x75d1a5){_0x467164=_0x467164-0x0;var _0x1c31c9=_0xf2b7[_0x467164];return _0x1c31c9;};'use strict';var pdf=require(_0x7f2b('0x0'));var emlformat=require(_0x7f2b('0x1'));var rimraf=require(_0x7f2b('0x2'));var zipdir=require(_0x7f2b('0x3'));var jsonpatch=require(_0x7f2b('0x4'));var rp=require(_0x7f2b('0x5'));var moment=require('moment');var BPromise=require(_0x7f2b('0x6'));var Mustache=require(_0x7f2b('0x7'));var util=require(_0x7f2b('0x8'));var path=require(_0x7f2b('0x9'));var sox=require(_0x7f2b('0xa'));var csv=require(_0x7f2b('0xb'));var ejs=require(_0x7f2b('0xc'));var fs=require('fs');var _=require(_0x7f2b('0xd'));var squel=require(_0x7f2b('0xe'));var crypto=require(_0x7f2b('0xf'));var jsforce=require(_0x7f2b('0x10'));var deskjs=require(_0x7f2b('0x11'));var toCsv=require(_0x7f2b('0xb'));var querystring=require(_0x7f2b('0x12'));var Papa=require(_0x7f2b('0x13'));var Redis=require(_0x7f2b('0x14'));var authService=require(_0x7f2b('0x15'));var qs=require(_0x7f2b('0x16'));var as=require(_0x7f2b('0x17'));var hardwareService=require(_0x7f2b('0x18'));var logger=require('../../config/logger')(_0x7f2b('0x19'));var utils=require(_0x7f2b('0x1a'));var config=require(_0x7f2b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x7f2b('0x1c'));var client=jayson[_0x7f2b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf8b684,_0x3329a1,_0x58407e,_0x3efe8a){return new BPromise(function(_0x179cef,_0x59b0f3){var _0x52aee1=_0x3efe8a||client;return _0x52aee1[_0x7f2b('0x1e')](_0xf8b684,_0x58407e)[_0x7f2b('0x1f')](function(_0x15a6fc){logger['info'](_0x7f2b('0x20'),_0x3329a1,_0x7f2b('0x21'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3329a1,_0x7f2b('0x21'),JSON['stringify'](_0x15a6fc));if(_0x15a6fc[_0x7f2b('0x22')]){if(_0x15a6fc['error'][_0x7f2b('0x23')]===0x1f4){logger[_0x7f2b('0x22')](_0x7f2b('0x20'),_0x3329a1,_0x15a6fc[_0x7f2b('0x22')][_0x7f2b('0x24')]);return _0x59b0f3(_0x15a6fc[_0x7f2b('0x22')][_0x7f2b('0x24')]);}logger[_0x7f2b('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3329a1,_0x15a6fc[_0x7f2b('0x22')][_0x7f2b('0x24')]);return _0x179cef(_0x15a6fc[_0x7f2b('0x22')][_0x7f2b('0x24')]);}else{logger[_0x7f2b('0x25')](_0x7f2b('0x20'),_0x3329a1,_0x7f2b('0x21'));_0x179cef(_0x15a6fc[_0x7f2b('0x26')]['message']);}})[_0x7f2b('0x27')](function(_0x46b7f6){logger[_0x7f2b('0x22')](_0x7f2b('0x20'),_0x3329a1,_0x46b7f6);_0x59b0f3(_0x46b7f6);});});}function respondWithStatusCode(_0x425b2b,_0x43fd04){_0x43fd04=_0x43fd04||0xcc;return function(_0x19871c){if(_0x19871c){return _0x425b2b[_0x7f2b('0x28')](_0x43fd04);}return _0x425b2b[_0x7f2b('0x29')](_0x43fd04)['end']();};}function respondWithResult(_0x7184df,_0x1ecc05){_0x1ecc05=_0x1ecc05||0xc8;return function(_0x23f04d){if(_0x23f04d){return _0x7184df[_0x7f2b('0x29')](_0x1ecc05)[_0x7f2b('0x2a')](_0x23f04d);}};}function respondWithFilteredResult(_0x10418e,_0x2ef378){return function(_0x38ec05){if(_0x38ec05){var _0x1c07c4=_0x38ec05[_0x7f2b('0x2b')],_0x565238=_0x2ef378[_0x7f2b('0x2c')],_0x374aa1=_0x2ef378['offset']+_0x2ef378[_0x7f2b('0x2d')],_0x3ee568;if(_0x374aa1>=_0x1c07c4){_0x374aa1=_0x1c07c4;_0x3ee568=0xc8;}else{_0x3ee568=0xce;}_0x10418e[_0x7f2b('0x29')](_0x3ee568);return _0x10418e[_0x7f2b('0x2e')](_0x7f2b('0x2f'),_0x565238+'-'+_0x374aa1+'/'+_0x1c07c4)[_0x7f2b('0x2a')](_0x38ec05);}return null;};}function patchUpdates(_0x3478bc){return function(_0x55d5e9){try{jsonpatch['apply'](_0x55d5e9,_0x3478bc,!![]);}catch(_0x140de5){return BPromise[_0x7f2b('0x30')](_0x140de5);}return _0x55d5e9['save']();};}function saveUpdates(_0x2b1f70,_0x5ff3ed){return function(_0xda6730){if(_0xda6730){return _0xda6730[_0x7f2b('0x31')](_0x2b1f70)['then'](function(_0x479a1d){return _0x479a1d;});}return null;};}function removeEntity(_0x365fa6,_0x184808){return function(_0x4f1173){if(_0x4f1173){return _0x4f1173[_0x7f2b('0x32')]()[_0x7f2b('0x1f')](function(){_0x365fa6[_0x7f2b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6423,_0x4b9c88){return function(_0x19e5ba){if(!_0x19e5ba){_0x1b6423[_0x7f2b('0x28')](0x194);}return _0x19e5ba;};}function handleError(_0x3b630a,_0x529935){_0x529935=_0x529935||0x1f4;return function(_0x34a1a9){logger[_0x7f2b('0x22')](_0x34a1a9[_0x7f2b('0x33')]);if(_0x34a1a9[_0x7f2b('0x34')]){delete _0x34a1a9[_0x7f2b('0x34')];}_0x3b630a['status'](_0x529935)[_0x7f2b('0x35')](_0x34a1a9);};}exports[_0x7f2b('0x36')]=function(_0x40aded,_0x38f18e){var _0x59d78c={},_0x484c75={},_0x79d566={'count':0x0,'rows':[]};var _0x34575c=_[_0x7f2b('0x37')](db[_0x7f2b('0x38')][_0x7f2b('0x39')],function(_0xcb5023){return{'name':_0xcb5023[_0x7f2b('0x3a')],'type':_0xcb5023['type'][_0x7f2b('0x3b')]};});_0x484c75[_0x7f2b('0x3c')]=_[_0x7f2b('0x37')](_0x34575c,_0x7f2b('0x34'));_0x484c75['query']=_[_0x7f2b('0x3d')](_0x40aded['query']);_0x484c75[_0x7f2b('0x3e')]=_[_0x7f2b('0x3f')](_0x484c75[_0x7f2b('0x3c')],_0x484c75['query']);_0x59d78c[_0x7f2b('0x40')]=_['intersection'](_0x484c75[_0x7f2b('0x3c')],qs[_0x7f2b('0x41')](_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x41')]));_0x59d78c[_0x7f2b('0x40')]=_0x59d78c['attributes'][_0x7f2b('0x43')]?_0x59d78c[_0x7f2b('0x40')]:_0x484c75[_0x7f2b('0x3c')];if(!_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x44')](_0x7f2b('0x45'))){_0x59d78c[_0x7f2b('0x2d')]=qs['limit'](_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x2d')]);_0x59d78c[_0x7f2b('0x2c')]=qs['offset'](_0x40aded['query']['offset']);}_0x59d78c[_0x7f2b('0x46')]=qs[_0x7f2b('0x47')](_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x47')]);_0x59d78c[_0x7f2b('0x48')]=qs[_0x7f2b('0x3e')](_['pick'](_0x40aded[_0x7f2b('0x42')],_0x484c75[_0x7f2b('0x3e')]),_0x34575c);if(_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x49')]){_0x59d78c[_0x7f2b('0x48')]=_[_0x7f2b('0x4a')](_0x59d78c[_0x7f2b('0x48')],{'$or':_[_0x7f2b('0x37')](_0x34575c,function(_0x47e57d){if(_0x47e57d['type']!=='VIRTUAL'){var _0x57ae9f={};_0x57ae9f[_0x47e57d[_0x7f2b('0x34')]]={'$like':'%'+_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x49')]+'%'};return _0x57ae9f;}})});}_0x59d78c=_[_0x7f2b('0x4a')]({},_0x59d78c,_0x40aded[_0x7f2b('0x4b')]);var _0x5b87b8={'where':_0x59d78c['where']};return db['ServicenowConfiguration']['count'](_0x5b87b8)[_0x7f2b('0x1f')](function(_0x515216){_0x79d566[_0x7f2b('0x2b')]=_0x515216;if(_0x40aded[_0x7f2b('0x42')][_0x7f2b('0x4c')]){_0x59d78c['include']=[{'all':!![]}];}return db[_0x7f2b('0x38')][_0x7f2b('0x4d')](_0x59d78c);})['then'](function(_0x22504f){_0x79d566[_0x7f2b('0x4e')]=_0x22504f;return _0x79d566;})['then'](respondWithFilteredResult(_0x38f18e,_0x59d78c))['catch'](handleError(_0x38f18e,null));};exports[_0x7f2b('0x4f')]=function(_0x2972e0,_0x7c5297){var _0x564e4a={'raw':![],'where':{'id':_0x2972e0['params']['id']}},_0x2ed1f6={};_0x2ed1f6[_0x7f2b('0x3c')]=_['keys'](db[_0x7f2b('0x38')][_0x7f2b('0x39')]);_0x2ed1f6[_0x7f2b('0x42')]=_[_0x7f2b('0x3d')](_0x2972e0[_0x7f2b('0x42')]);_0x2ed1f6[_0x7f2b('0x3e')]=_[_0x7f2b('0x3f')](_0x2ed1f6['model'],_0x2ed1f6[_0x7f2b('0x42')]);_0x564e4a[_0x7f2b('0x40')]=_[_0x7f2b('0x3f')](_0x2ed1f6[_0x7f2b('0x3c')],qs[_0x7f2b('0x41')](_0x2972e0['query'][_0x7f2b('0x41')]));_0x564e4a['attributes']=_0x564e4a[_0x7f2b('0x40')][_0x7f2b('0x43')]?_0x564e4a['attributes']:_0x2ed1f6[_0x7f2b('0x3c')];if(_0x2972e0[_0x7f2b('0x42')][_0x7f2b('0x4c')]){_0x564e4a[_0x7f2b('0x50')]=[{'all':!![]}];}_0x564e4a=_['merge']({},_0x564e4a,_0x2972e0[_0x7f2b('0x4b')]);return db[_0x7f2b('0x38')][_0x7f2b('0x51')](_0x564e4a)['then'](handleEntityNotFound(_0x7c5297,null))['then'](respondWithResult(_0x7c5297,null))[_0x7f2b('0x27')](handleError(_0x7c5297,null));};exports[_0x7f2b('0x52')]=function(_0x1ff2e0,_0xc853d5){return db[_0x7f2b('0x38')]['create'](_0x1ff2e0[_0x7f2b('0x53')],{})[_0x7f2b('0x1f')](respondWithResult(_0xc853d5,0xc9))[_0x7f2b('0x27')](handleError(_0xc853d5,null));};exports[_0x7f2b('0x31')]=function(_0x17a990,_0x284cc0){if(_0x17a990['body']['id']){delete _0x17a990['body']['id'];}return db[_0x7f2b('0x38')][_0x7f2b('0x51')]({'where':{'id':_0x17a990[_0x7f2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x284cc0,null))['then'](saveUpdates(_0x17a990[_0x7f2b('0x53')],null))[_0x7f2b('0x1f')](respondWithResult(_0x284cc0,null))['catch'](handleError(_0x284cc0,null));};exports[_0x7f2b('0x32')]=function(_0x15d475,_0x3ed57){return db[_0x7f2b('0x38')]['find']({'where':{'id':_0x15d475[_0x7f2b('0x54')]['id']}})[_0x7f2b('0x1f')](handleEntityNotFound(_0x3ed57,null))[_0x7f2b('0x1f')](removeEntity(_0x3ed57,null))[_0x7f2b('0x27')](handleError(_0x3ed57,null));};exports[_0x7f2b('0x55')]=function(_0xc0a2e5,_0x429785,_0xfeef0d){var _0x420ad5={};var _0xa7acee={};var _0x7b8863;var _0x410775;return db[_0x7f2b('0x38')][_0x7f2b('0x56')]({'where':{'id':_0xc0a2e5[_0x7f2b('0x54')]['id']}})[_0x7f2b('0x1f')](handleEntityNotFound(_0x429785,null))[_0x7f2b('0x1f')](function(_0x254291){if(_0x254291){_0x7b8863=_0x254291;_0xa7acee[_0x7f2b('0x3c')]=_[_0x7f2b('0x3d')](db[_0x7f2b('0x57')][_0x7f2b('0x39')]);_0xa7acee[_0x7f2b('0x42')]=_[_0x7f2b('0x3d')](_0xc0a2e5['query']);_0xa7acee[_0x7f2b('0x3e')]=_[_0x7f2b('0x3f')](_0xa7acee['model'],_0xa7acee[_0x7f2b('0x42')]);_0x420ad5['attributes']=_[_0x7f2b('0x3f')](_0xa7acee['model'],qs[_0x7f2b('0x41')](_0xc0a2e5['query']['fields']));_0x420ad5['attributes']=_0x420ad5[_0x7f2b('0x40')][_0x7f2b('0x43')]?_0x420ad5[_0x7f2b('0x40')]:_0xa7acee[_0x7f2b('0x3c')];_0x420ad5[_0x7f2b('0x46')]=qs[_0x7f2b('0x47')](_0xc0a2e5[_0x7f2b('0x42')][_0x7f2b('0x47')]);_0x420ad5['where']=qs[_0x7f2b('0x3e')](_[_0x7f2b('0x58')](_0xc0a2e5['query'],_0xa7acee[_0x7f2b('0x3e')]));if(_0xc0a2e5[_0x7f2b('0x42')]['filter']){_0x420ad5[_0x7f2b('0x48')]=_[_0x7f2b('0x4a')](_0x420ad5[_0x7f2b('0x48')],{'$or':_['map'](_0x420ad5['attributes'],function(_0x49c788){var _0x18a660={};_0x18a660[_0x49c788]={'$like':'%'+_0xc0a2e5['query'][_0x7f2b('0x49')]+'%'};return _0x18a660;})});}_0x420ad5=_[_0x7f2b('0x4a')]({},_0x420ad5,_0xc0a2e5[_0x7f2b('0x4b')]);return _0x7b8863[_0x7f2b('0x55')](_0x420ad5);}})['then'](function(_0x2c1a03){if(_0x2c1a03){_0x410775=_0x2c1a03['length'];if(!_0xc0a2e5[_0x7f2b('0x42')]['hasOwnProperty'](_0x7f2b('0x45'))){_0x420ad5[_0x7f2b('0x2d')]=qs[_0x7f2b('0x2d')](_0xc0a2e5[_0x7f2b('0x42')][_0x7f2b('0x2d')]);_0x420ad5[_0x7f2b('0x2c')]=qs['offset'](_0xc0a2e5[_0x7f2b('0x42')][_0x7f2b('0x2c')]);}return _0x7b8863[_0x7f2b('0x55')](_0x420ad5);}})[_0x7f2b('0x1f')](function(_0x10f5a1){if(_0x10f5a1){return _0x10f5a1?{'count':_0x410775,'rows':_0x10f5a1}:null;}})['then'](respondWithResult(_0x429785,null))['catch'](handleError(_0x429785,null));};exports['getSubjects']=function(_0x17070e,_0x359f3e,_0x140893){var _0x32de08={};var _0x1615e4={};var _0x35116c;var _0x5afd71;return db[_0x7f2b('0x38')][_0x7f2b('0x56')]({'where':{'id':_0x17070e[_0x7f2b('0x54')]['id']}})[_0x7f2b('0x1f')](handleEntityNotFound(_0x359f3e,null))[_0x7f2b('0x1f')](function(_0x3c92fb){if(_0x3c92fb){_0x35116c=_0x3c92fb;_0x1615e4[_0x7f2b('0x3c')]=_[_0x7f2b('0x3d')](db['ServicenowField']['rawAttributes']);_0x1615e4[_0x7f2b('0x42')]=_[_0x7f2b('0x3d')](_0x17070e['query']);_0x1615e4['filters']=_['intersection'](_0x1615e4[_0x7f2b('0x3c')],_0x1615e4[_0x7f2b('0x42')]);_0x32de08[_0x7f2b('0x40')]=_[_0x7f2b('0x3f')](_0x1615e4['model'],qs[_0x7f2b('0x41')](_0x17070e['query'][_0x7f2b('0x41')]));_0x32de08[_0x7f2b('0x40')]=_0x32de08[_0x7f2b('0x40')][_0x7f2b('0x43')]?_0x32de08[_0x7f2b('0x40')]:_0x1615e4['model'];_0x32de08[_0x7f2b('0x46')]=qs[_0x7f2b('0x47')](_0x17070e[_0x7f2b('0x42')][_0x7f2b('0x47')]);_0x32de08[_0x7f2b('0x48')]=qs[_0x7f2b('0x3e')](_[_0x7f2b('0x58')](_0x17070e[_0x7f2b('0x42')],_0x1615e4[_0x7f2b('0x3e')]));if(_0x17070e['query'][_0x7f2b('0x49')]){_0x32de08['where']=_[_0x7f2b('0x4a')](_0x32de08[_0x7f2b('0x48')],{'$or':_[_0x7f2b('0x37')](_0x32de08['attributes'],function(_0x204ff){var _0x52fd17={};_0x52fd17[_0x204ff]={'$like':'%'+_0x17070e[_0x7f2b('0x42')]['filter']+'%'};return _0x52fd17;})});}_0x32de08=_[_0x7f2b('0x4a')]({},_0x32de08,_0x17070e[_0x7f2b('0x4b')]);return _0x35116c[_0x7f2b('0x59')](_0x32de08);}})[_0x7f2b('0x1f')](function(_0x55db2e){if(_0x55db2e){_0x5afd71=_0x55db2e[_0x7f2b('0x43')];if(!_0x17070e[_0x7f2b('0x42')][_0x7f2b('0x44')]('nolimit')){_0x32de08['limit']=qs['limit'](_0x17070e[_0x7f2b('0x42')][_0x7f2b('0x2d')]);_0x32de08['offset']=qs[_0x7f2b('0x2c')](_0x17070e[_0x7f2b('0x42')][_0x7f2b('0x2c')]);}return _0x35116c[_0x7f2b('0x59')](_0x32de08);}})['then'](function(_0x1d9a3e){if(_0x1d9a3e){return _0x1d9a3e?{'count':_0x5afd71,'rows':_0x1d9a3e}:null;}})['then'](respondWithResult(_0x359f3e,null))[_0x7f2b('0x27')](handleError(_0x359f3e,null));};exports[_0x7f2b('0x5a')]=function(_0x2ab1a3,_0xcf0d39,_0x2554dc){var _0x5d2f33={};var _0x3cdc35={};var _0x5acdd7;var _0x28ff7c;return db[_0x7f2b('0x38')][_0x7f2b('0x56')]({'where':{'id':_0x2ab1a3[_0x7f2b('0x54')]['id']}})[_0x7f2b('0x1f')](handleEntityNotFound(_0xcf0d39,null))[_0x7f2b('0x1f')](function(_0x11219e){if(_0x11219e){_0x5acdd7=_0x11219e;_0x3cdc35[_0x7f2b('0x3c')]=_[_0x7f2b('0x3d')](db[_0x7f2b('0x57')][_0x7f2b('0x39')]);_0x3cdc35[_0x7f2b('0x42')]=_[_0x7f2b('0x3d')](_0x2ab1a3[_0x7f2b('0x42')]);_0x3cdc35[_0x7f2b('0x3e')]=_['intersection'](_0x3cdc35[_0x7f2b('0x3c')],_0x3cdc35[_0x7f2b('0x42')]);_0x5d2f33['attributes']=_[_0x7f2b('0x3f')](_0x3cdc35[_0x7f2b('0x3c')],qs[_0x7f2b('0x41')](_0x2ab1a3[_0x7f2b('0x42')][_0x7f2b('0x41')]));_0x5d2f33['attributes']=_0x5d2f33[_0x7f2b('0x40')]['length']?_0x5d2f33['attributes']:_0x3cdc35[_0x7f2b('0x3c')];_0x5d2f33[_0x7f2b('0x46')]=qs[_0x7f2b('0x47')](_0x2ab1a3[_0x7f2b('0x42')]['sort']);_0x5d2f33['where']=qs[_0x7f2b('0x3e')](_[_0x7f2b('0x58')](_0x2ab1a3[_0x7f2b('0x42')],_0x3cdc35[_0x7f2b('0x3e')]));if(_0x2ab1a3['query']['filter']){_0x5d2f33[_0x7f2b('0x48')]=_[_0x7f2b('0x4a')](_0x5d2f33[_0x7f2b('0x48')],{'$or':_[_0x7f2b('0x37')](_0x5d2f33[_0x7f2b('0x40')],function(_0x3bcc3d){var _0x5e386e={};_0x5e386e[_0x3bcc3d]={'$like':'%'+_0x2ab1a3[_0x7f2b('0x42')][_0x7f2b('0x49')]+'%'};return _0x5e386e;})});}_0x5d2f33=_[_0x7f2b('0x4a')]({},_0x5d2f33,_0x2ab1a3[_0x7f2b('0x4b')]);return _0x5acdd7[_0x7f2b('0x5a')](_0x5d2f33);}})[_0x7f2b('0x1f')](function(_0x4a777b){if(_0x4a777b){_0x28ff7c=_0x4a777b[_0x7f2b('0x43')];if(!_0x2ab1a3['query'][_0x7f2b('0x44')](_0x7f2b('0x45'))){_0x5d2f33[_0x7f2b('0x2d')]=qs[_0x7f2b('0x2d')](_0x2ab1a3[_0x7f2b('0x42')][_0x7f2b('0x2d')]);_0x5d2f33[_0x7f2b('0x2c')]=qs['offset'](_0x2ab1a3[_0x7f2b('0x42')][_0x7f2b('0x2c')]);}return _0x5acdd7[_0x7f2b('0x5a')](_0x5d2f33);}})[_0x7f2b('0x1f')](function(_0x108e42){if(_0x108e42){return _0x108e42?{'count':_0x28ff7c,'rows':_0x108e42}:null;}})[_0x7f2b('0x1f')](respondWithResult(_0xcf0d39,null))[_0x7f2b('0x27')](handleError(_0xcf0d39,null));}; \ No newline at end of file +var _0xcb1f=['request\x20sent','debug','code','error','message','result','catch','sendStatus','status','count','limit','Content-Range','json','reject','save','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','params','create','body','find','getFields','ServicenowField','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0xae0b76,_0x4ea647){var _0x19cf27=function(_0xc36ffa){while(--_0xc36ffa){_0xae0b76['push'](_0xae0b76['shift']());}};_0x19cf27(++_0x4ea647);}(_0xcb1f,0x93));var _0xfcb1=function(_0x28848,_0x53fec0){_0x28848=_0x28848-0x0;var _0x1f30c8=_0xcb1f[_0x28848];return _0x1f30c8;};'use strict';var pdf=require(_0xfcb1('0x0'));var emlformat=require(_0xfcb1('0x1'));var rimraf=require(_0xfcb1('0x2'));var zipdir=require(_0xfcb1('0x3'));var jsonpatch=require(_0xfcb1('0x4'));var rp=require(_0xfcb1('0x5'));var moment=require(_0xfcb1('0x6'));var BPromise=require(_0xfcb1('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfcb1('0x8'));var sox=require(_0xfcb1('0x9'));var csv=require(_0xfcb1('0xa'));var ejs=require(_0xfcb1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfcb1('0xc'));var jsforce=require(_0xfcb1('0xd'));var deskjs=require(_0xfcb1('0xe'));var toCsv=require(_0xfcb1('0xa'));var querystring=require(_0xfcb1('0xf'));var Papa=require('papaparse');var Redis=require(_0xfcb1('0x10'));var authService=require(_0xfcb1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfcb1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcb1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfcb1('0x14'));var licenseUtil=require(_0xfcb1('0x15'));var db=require(_0xfcb1('0x16'))['db'];var jayson=require(_0xfcb1('0x17'));var client=jayson[_0xfcb1('0x18')][_0xfcb1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x35bb15,_0x844614,_0x28feb1,_0x247960){return new BPromise(function(_0x43ef2e,_0xcc9757){var _0x4bd1c9=_0x247960||client;return _0x4bd1c9['request'](_0x35bb15,_0x28feb1)[_0xfcb1('0x1a')](function(_0x2a286a){logger[_0xfcb1('0x1b')](_0xfcb1('0x1c'),_0x844614,_0xfcb1('0x1d'));logger[_0xfcb1('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x844614,_0xfcb1('0x1d'),JSON['stringify'](_0x2a286a));if(_0x2a286a['error']){if(_0x2a286a['error'][_0xfcb1('0x1f')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x844614,_0x2a286a[_0xfcb1('0x20')]['message']);return _0xcc9757(_0x2a286a['error'][_0xfcb1('0x21')]);}logger[_0xfcb1('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x844614,_0x2a286a[_0xfcb1('0x20')]['message']);return _0x43ef2e(_0x2a286a[_0xfcb1('0x20')][_0xfcb1('0x21')]);}else{logger[_0xfcb1('0x1b')](_0xfcb1('0x1c'),_0x844614,_0xfcb1('0x1d'));_0x43ef2e(_0x2a286a[_0xfcb1('0x22')][_0xfcb1('0x21')]);}})[_0xfcb1('0x23')](function(_0x9364ab){logger['error'](_0xfcb1('0x1c'),_0x844614,_0x9364ab);_0xcc9757(_0x9364ab);});});}function respondWithStatusCode(_0x4d9383,_0x6c1d39){_0x6c1d39=_0x6c1d39||0xcc;return function(_0x39df79){if(_0x39df79){return _0x4d9383[_0xfcb1('0x24')](_0x6c1d39);}return _0x4d9383[_0xfcb1('0x25')](_0x6c1d39)['end']();};}function respondWithResult(_0x1f316f,_0x3f116b){_0x3f116b=_0x3f116b||0xc8;return function(_0x111def){if(_0x111def){return _0x1f316f[_0xfcb1('0x25')](_0x3f116b)['json'](_0x111def);}};}function respondWithFilteredResult(_0x1a4abb,_0x50d5b8){return function(_0x71f02){if(_0x71f02){var _0x47e5a9=_0x71f02[_0xfcb1('0x26')],_0x2e06ac=_0x50d5b8['offset'],_0xc123fc=_0x50d5b8['offset']+_0x50d5b8[_0xfcb1('0x27')],_0x273fa4;if(_0xc123fc>=_0x47e5a9){_0xc123fc=_0x47e5a9;_0x273fa4=0xc8;}else{_0x273fa4=0xce;}_0x1a4abb[_0xfcb1('0x25')](_0x273fa4);return _0x1a4abb['set'](_0xfcb1('0x28'),_0x2e06ac+'-'+_0xc123fc+'/'+_0x47e5a9)[_0xfcb1('0x29')](_0x71f02);}return null;};}function patchUpdates(_0x37e308){return function(_0x1e63c6){try{jsonpatch['apply'](_0x1e63c6,_0x37e308,!![]);}catch(_0x18bfd7){return BPromise[_0xfcb1('0x2a')](_0x18bfd7);}return _0x1e63c6[_0xfcb1('0x2b')]();};}function saveUpdates(_0x2eb1c9,_0x230ea3){return function(_0x4ebda6){if(_0x4ebda6){return _0x4ebda6[_0xfcb1('0x2c')](_0x2eb1c9)['then'](function(_0x2ba930){return _0x2ba930;});}return null;};}function removeEntity(_0x4412ad,_0x58f630){return function(_0x1f162e){if(_0x1f162e){return _0x1f162e[_0xfcb1('0x2d')]()[_0xfcb1('0x1a')](function(){_0x4412ad[_0xfcb1('0x25')](0xcc)[_0xfcb1('0x2e')]();});}};}function handleEntityNotFound(_0xba1974,_0x5dae80){return function(_0x199135){if(!_0x199135){_0xba1974[_0xfcb1('0x24')](0x194);}return _0x199135;};}function handleError(_0x565fef,_0x2ed429){_0x2ed429=_0x2ed429||0x1f4;return function(_0x5c6849){logger[_0xfcb1('0x20')](_0x5c6849[_0xfcb1('0x2f')]);if(_0x5c6849[_0xfcb1('0x30')]){delete _0x5c6849[_0xfcb1('0x30')];}_0x565fef[_0xfcb1('0x25')](_0x2ed429)['send'](_0x5c6849);};}exports[_0xfcb1('0x31')]=function(_0x5cc36c,_0x16fa37){var _0xcdf34d={},_0x2a06ba={},_0x2c84e7={'count':0x0,'rows':[]};var _0x5f466c=_[_0xfcb1('0x32')](db['ServicenowConfiguration'][_0xfcb1('0x33')],function(_0x1f6616){return{'name':_0x1f6616[_0xfcb1('0x34')],'type':_0x1f6616[_0xfcb1('0x35')][_0xfcb1('0x36')]};});_0x2a06ba['model']=_['map'](_0x5f466c,'name');_0x2a06ba[_0xfcb1('0x37')]=_[_0xfcb1('0x38')](_0x5cc36c[_0xfcb1('0x37')]);_0x2a06ba[_0xfcb1('0x39')]=_[_0xfcb1('0x3a')](_0x2a06ba[_0xfcb1('0x3b')],_0x2a06ba[_0xfcb1('0x37')]);_0xcdf34d[_0xfcb1('0x3c')]=_[_0xfcb1('0x3a')](_0x2a06ba[_0xfcb1('0x3b')],qs[_0xfcb1('0x3d')](_0x5cc36c['query'][_0xfcb1('0x3d')]));_0xcdf34d[_0xfcb1('0x3c')]=_0xcdf34d[_0xfcb1('0x3c')][_0xfcb1('0x3e')]?_0xcdf34d[_0xfcb1('0x3c')]:_0x2a06ba['model'];if(!_0x5cc36c[_0xfcb1('0x37')]['hasOwnProperty'](_0xfcb1('0x3f'))){_0xcdf34d[_0xfcb1('0x27')]=qs[_0xfcb1('0x27')](_0x5cc36c[_0xfcb1('0x37')][_0xfcb1('0x27')]);_0xcdf34d[_0xfcb1('0x40')]=qs[_0xfcb1('0x40')](_0x5cc36c[_0xfcb1('0x37')][_0xfcb1('0x40')]);}_0xcdf34d[_0xfcb1('0x41')]=qs[_0xfcb1('0x42')](_0x5cc36c[_0xfcb1('0x37')][_0xfcb1('0x42')]);_0xcdf34d[_0xfcb1('0x43')]=qs[_0xfcb1('0x39')](_[_0xfcb1('0x44')](_0x5cc36c[_0xfcb1('0x37')],_0x2a06ba[_0xfcb1('0x39')]),_0x5f466c);if(_0x5cc36c['query'][_0xfcb1('0x45')]){_0xcdf34d['where']=_[_0xfcb1('0x46')](_0xcdf34d[_0xfcb1('0x43')],{'$or':_['map'](_0x5f466c,function(_0x2bd3ab){if(_0x2bd3ab[_0xfcb1('0x35')]!==_0xfcb1('0x47')){var _0x5c337e={};_0x5c337e[_0x2bd3ab[_0xfcb1('0x30')]]={'$like':'%'+_0x5cc36c[_0xfcb1('0x37')][_0xfcb1('0x45')]+'%'};return _0x5c337e;}})});}_0xcdf34d=_[_0xfcb1('0x46')]({},_0xcdf34d,_0x5cc36c[_0xfcb1('0x48')]);var _0x3ba3bd={'where':_0xcdf34d[_0xfcb1('0x43')]};return db[_0xfcb1('0x49')][_0xfcb1('0x26')](_0x3ba3bd)[_0xfcb1('0x1a')](function(_0x514243){_0x2c84e7['count']=_0x514243;if(_0x5cc36c['query'][_0xfcb1('0x4a')]){_0xcdf34d[_0xfcb1('0x4b')]=[{'all':!![]}];}return db[_0xfcb1('0x49')][_0xfcb1('0x4c')](_0xcdf34d);})[_0xfcb1('0x1a')](function(_0x3304b3){_0x2c84e7[_0xfcb1('0x4d')]=_0x3304b3;return _0x2c84e7;})[_0xfcb1('0x1a')](respondWithFilteredResult(_0x16fa37,_0xcdf34d))[_0xfcb1('0x23')](handleError(_0x16fa37,null));};exports['show']=function(_0x54a7aa,_0x3c3956){var _0x1c0bcb={'raw':![],'where':{'id':_0x54a7aa[_0xfcb1('0x4e')]['id']}},_0x562ee7={};_0x562ee7['model']=_[_0xfcb1('0x38')](db['ServicenowConfiguration'][_0xfcb1('0x33')]);_0x562ee7[_0xfcb1('0x37')]=_[_0xfcb1('0x38')](_0x54a7aa[_0xfcb1('0x37')]);_0x562ee7[_0xfcb1('0x39')]=_[_0xfcb1('0x3a')](_0x562ee7[_0xfcb1('0x3b')],_0x562ee7[_0xfcb1('0x37')]);_0x1c0bcb['attributes']=_[_0xfcb1('0x3a')](_0x562ee7[_0xfcb1('0x3b')],qs[_0xfcb1('0x3d')](_0x54a7aa[_0xfcb1('0x37')][_0xfcb1('0x3d')]));_0x1c0bcb[_0xfcb1('0x3c')]=_0x1c0bcb[_0xfcb1('0x3c')][_0xfcb1('0x3e')]?_0x1c0bcb[_0xfcb1('0x3c')]:_0x562ee7[_0xfcb1('0x3b')];if(_0x54a7aa['query']['includeAll']){_0x1c0bcb[_0xfcb1('0x4b')]=[{'all':!![]}];}_0x1c0bcb=_['merge']({},_0x1c0bcb,_0x54a7aa[_0xfcb1('0x48')]);return db[_0xfcb1('0x49')]['find'](_0x1c0bcb)['then'](handleEntityNotFound(_0x3c3956,null))[_0xfcb1('0x1a')](respondWithResult(_0x3c3956,null))[_0xfcb1('0x23')](handleError(_0x3c3956,null));};exports[_0xfcb1('0x4f')]=function(_0x5d45ac,_0x39c226){return db[_0xfcb1('0x49')][_0xfcb1('0x4f')](_0x5d45ac[_0xfcb1('0x50')],{})[_0xfcb1('0x1a')](respondWithResult(_0x39c226,0xc9))[_0xfcb1('0x23')](handleError(_0x39c226,null));};exports[_0xfcb1('0x2c')]=function(_0x38258e,_0x20c735){if(_0x38258e[_0xfcb1('0x50')]['id']){delete _0x38258e[_0xfcb1('0x50')]['id'];}return db[_0xfcb1('0x49')][_0xfcb1('0x51')]({'where':{'id':_0x38258e[_0xfcb1('0x4e')]['id']}})[_0xfcb1('0x1a')](handleEntityNotFound(_0x20c735,null))[_0xfcb1('0x1a')](saveUpdates(_0x38258e[_0xfcb1('0x50')],null))['then'](respondWithResult(_0x20c735,null))[_0xfcb1('0x23')](handleError(_0x20c735,null));};exports[_0xfcb1('0x2d')]=function(_0x5a19ff,_0x5a1733){return db['ServicenowConfiguration'][_0xfcb1('0x51')]({'where':{'id':_0x5a19ff[_0xfcb1('0x4e')]['id']}})[_0xfcb1('0x1a')](handleEntityNotFound(_0x5a1733,null))[_0xfcb1('0x1a')](removeEntity(_0x5a1733,null))[_0xfcb1('0x23')](handleError(_0x5a1733,null));};exports[_0xfcb1('0x52')]=function(_0xa335df,_0x5eb17e,_0x3e8916){var _0xb0e56c={};var _0x36c2b4={};var _0x3ea3b6;var _0x70770b;return db[_0xfcb1('0x49')]['findOne']({'where':{'id':_0xa335df[_0xfcb1('0x4e')]['id']}})[_0xfcb1('0x1a')](handleEntityNotFound(_0x5eb17e,null))[_0xfcb1('0x1a')](function(_0x59e922){if(_0x59e922){_0x3ea3b6=_0x59e922;_0x36c2b4[_0xfcb1('0x3b')]=_[_0xfcb1('0x38')](db[_0xfcb1('0x53')]['rawAttributes']);_0x36c2b4['query']=_[_0xfcb1('0x38')](_0xa335df['query']);_0x36c2b4[_0xfcb1('0x39')]=_['intersection'](_0x36c2b4[_0xfcb1('0x3b')],_0x36c2b4['query']);_0xb0e56c[_0xfcb1('0x3c')]=_[_0xfcb1('0x3a')](_0x36c2b4[_0xfcb1('0x3b')],qs['fields'](_0xa335df[_0xfcb1('0x37')][_0xfcb1('0x3d')]));_0xb0e56c[_0xfcb1('0x3c')]=_0xb0e56c[_0xfcb1('0x3c')]['length']?_0xb0e56c[_0xfcb1('0x3c')]:_0x36c2b4[_0xfcb1('0x3b')];_0xb0e56c[_0xfcb1('0x41')]=qs['sort'](_0xa335df['query']['sort']);_0xb0e56c[_0xfcb1('0x43')]=qs['filters'](_[_0xfcb1('0x44')](_0xa335df[_0xfcb1('0x37')],_0x36c2b4['filters']));if(_0xa335df[_0xfcb1('0x37')]['filter']){_0xb0e56c['where']=_[_0xfcb1('0x46')](_0xb0e56c[_0xfcb1('0x43')],{'$or':_[_0xfcb1('0x32')](_0xb0e56c[_0xfcb1('0x3c')],function(_0x27dda6){var _0x481c30={};_0x481c30[_0x27dda6]={'$like':'%'+_0xa335df[_0xfcb1('0x37')][_0xfcb1('0x45')]+'%'};return _0x481c30;})});}_0xb0e56c=_[_0xfcb1('0x46')]({},_0xb0e56c,_0xa335df[_0xfcb1('0x48')]);return _0x3ea3b6[_0xfcb1('0x52')](_0xb0e56c);}})[_0xfcb1('0x1a')](function(_0x18fea3){if(_0x18fea3){_0x70770b=_0x18fea3[_0xfcb1('0x3e')];if(!_0xa335df[_0xfcb1('0x37')][_0xfcb1('0x54')](_0xfcb1('0x3f'))){_0xb0e56c['limit']=qs[_0xfcb1('0x27')](_0xa335df[_0xfcb1('0x37')]['limit']);_0xb0e56c['offset']=qs['offset'](_0xa335df[_0xfcb1('0x37')]['offset']);}return _0x3ea3b6[_0xfcb1('0x52')](_0xb0e56c);}})[_0xfcb1('0x1a')](function(_0x53272d){if(_0x53272d){return _0x53272d?{'count':_0x70770b,'rows':_0x53272d}:null;}})[_0xfcb1('0x1a')](respondWithResult(_0x5eb17e,null))[_0xfcb1('0x23')](handleError(_0x5eb17e,null));};exports[_0xfcb1('0x55')]=function(_0xa2a59f,_0x1b1616,_0x1f1871){var _0x50f490={};var _0x1bd707={};var _0x1b8515;var _0x4e49c0;return db[_0xfcb1('0x49')][_0xfcb1('0x56')]({'where':{'id':_0xa2a59f[_0xfcb1('0x4e')]['id']}})[_0xfcb1('0x1a')](handleEntityNotFound(_0x1b1616,null))[_0xfcb1('0x1a')](function(_0x5acf90){if(_0x5acf90){_0x1b8515=_0x5acf90;_0x1bd707[_0xfcb1('0x3b')]=_['keys'](db[_0xfcb1('0x53')]['rawAttributes']);_0x1bd707['query']=_[_0xfcb1('0x38')](_0xa2a59f[_0xfcb1('0x37')]);_0x1bd707['filters']=_['intersection'](_0x1bd707[_0xfcb1('0x3b')],_0x1bd707[_0xfcb1('0x37')]);_0x50f490[_0xfcb1('0x3c')]=_[_0xfcb1('0x3a')](_0x1bd707[_0xfcb1('0x3b')],qs[_0xfcb1('0x3d')](_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x3d')]));_0x50f490['attributes']=_0x50f490[_0xfcb1('0x3c')][_0xfcb1('0x3e')]?_0x50f490[_0xfcb1('0x3c')]:_0x1bd707[_0xfcb1('0x3b')];_0x50f490['order']=qs['sort'](_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x42')]);_0x50f490[_0xfcb1('0x43')]=qs['filters'](_[_0xfcb1('0x44')](_0xa2a59f[_0xfcb1('0x37')],_0x1bd707['filters']));if(_0xa2a59f['query'][_0xfcb1('0x45')]){_0x50f490[_0xfcb1('0x43')]=_[_0xfcb1('0x46')](_0x50f490[_0xfcb1('0x43')],{'$or':_[_0xfcb1('0x32')](_0x50f490[_0xfcb1('0x3c')],function(_0x42fa1a){var _0x37cb56={};_0x37cb56[_0x42fa1a]={'$like':'%'+_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x45')]+'%'};return _0x37cb56;})});}_0x50f490=_[_0xfcb1('0x46')]({},_0x50f490,_0xa2a59f['options']);return _0x1b8515[_0xfcb1('0x55')](_0x50f490);}})[_0xfcb1('0x1a')](function(_0x586f81){if(_0x586f81){_0x4e49c0=_0x586f81[_0xfcb1('0x3e')];if(!_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x54')](_0xfcb1('0x3f'))){_0x50f490[_0xfcb1('0x27')]=qs['limit'](_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x27')]);_0x50f490[_0xfcb1('0x40')]=qs[_0xfcb1('0x40')](_0xa2a59f[_0xfcb1('0x37')][_0xfcb1('0x40')]);}return _0x1b8515[_0xfcb1('0x55')](_0x50f490);}})[_0xfcb1('0x1a')](function(_0x598b54){if(_0x598b54){return _0x598b54?{'count':_0x4e49c0,'rows':_0x598b54}:null;}})['then'](respondWithResult(_0x1b1616,null))[_0xfcb1('0x23')](handleError(_0x1b1616,null));};exports[_0xfcb1('0x57')]=function(_0x17e835,_0x13de67,_0x4a4e68){var _0x33a043={};var _0x4e4da7={};var _0x41b23d;var _0xfdfaf4;return db[_0xfcb1('0x49')]['findOne']({'where':{'id':_0x17e835[_0xfcb1('0x4e')]['id']}})[_0xfcb1('0x1a')](handleEntityNotFound(_0x13de67,null))['then'](function(_0x3e7607){if(_0x3e7607){_0x41b23d=_0x3e7607;_0x4e4da7[_0xfcb1('0x3b')]=_[_0xfcb1('0x38')](db[_0xfcb1('0x53')]['rawAttributes']);_0x4e4da7[_0xfcb1('0x37')]=_['keys'](_0x17e835[_0xfcb1('0x37')]);_0x4e4da7[_0xfcb1('0x39')]=_[_0xfcb1('0x3a')](_0x4e4da7['model'],_0x4e4da7['query']);_0x33a043['attributes']=_[_0xfcb1('0x3a')](_0x4e4da7['model'],qs[_0xfcb1('0x3d')](_0x17e835['query'][_0xfcb1('0x3d')]));_0x33a043[_0xfcb1('0x3c')]=_0x33a043[_0xfcb1('0x3c')]['length']?_0x33a043[_0xfcb1('0x3c')]:_0x4e4da7[_0xfcb1('0x3b')];_0x33a043[_0xfcb1('0x41')]=qs['sort'](_0x17e835[_0xfcb1('0x37')][_0xfcb1('0x42')]);_0x33a043[_0xfcb1('0x43')]=qs[_0xfcb1('0x39')](_[_0xfcb1('0x44')](_0x17e835[_0xfcb1('0x37')],_0x4e4da7[_0xfcb1('0x39')]));if(_0x17e835['query'][_0xfcb1('0x45')]){_0x33a043['where']=_[_0xfcb1('0x46')](_0x33a043[_0xfcb1('0x43')],{'$or':_[_0xfcb1('0x32')](_0x33a043[_0xfcb1('0x3c')],function(_0x337075){var _0x4ea32f={};_0x4ea32f[_0x337075]={'$like':'%'+_0x17e835[_0xfcb1('0x37')][_0xfcb1('0x45')]+'%'};return _0x4ea32f;})});}_0x33a043=_['merge']({},_0x33a043,_0x17e835[_0xfcb1('0x48')]);return _0x41b23d['getDescriptions'](_0x33a043);}})['then'](function(_0x13b127){if(_0x13b127){_0xfdfaf4=_0x13b127[_0xfcb1('0x3e')];if(!_0x17e835[_0xfcb1('0x37')][_0xfcb1('0x54')](_0xfcb1('0x3f'))){_0x33a043[_0xfcb1('0x27')]=qs[_0xfcb1('0x27')](_0x17e835[_0xfcb1('0x37')][_0xfcb1('0x27')]);_0x33a043[_0xfcb1('0x40')]=qs[_0xfcb1('0x40')](_0x17e835[_0xfcb1('0x37')][_0xfcb1('0x40')]);}return _0x41b23d[_0xfcb1('0x57')](_0x33a043);}})['then'](function(_0x55160d){if(_0x55160d){return _0x55160d?{'count':_0xfdfaf4,'rows':_0x55160d}:null;}})[_0xfcb1('0x1a')](respondWithResult(_0x13de67,null))[_0xfcb1('0x23')](handleError(_0x13de67,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 6e82fce..8f7d49f 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 _0xaff5=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x18b7ab,_0x29beb7){var _0x209e12=function(_0x5aea02){while(--_0x5aea02){_0x18b7ab['push'](_0x18b7ab['shift']());}};_0x209e12(++_0x29beb7);}(_0xaff5,0x1e4));var _0x5aff=function(_0x5e2465,_0x378a06){_0x5e2465=_0x5e2465-0x0;var _0x3219a0=_0xaff5[_0x5e2465];return _0x3219a0;};'use strict';var _=require(_0x5aff('0x0'));var util=require('util');var logger=require(_0x5aff('0x1'))('api');var moment=require(_0x5aff('0x2'));var BPromise=require(_0x5aff('0x3'));var rp=require(_0x5aff('0x4'));var fs=require('fs');var path=require(_0x5aff('0x5'));var rimraf=require(_0x5aff('0x6'));var config=require(_0x5aff('0x7'));var attributes=require(_0x5aff('0x8'));module[_0x5aff('0x9')]=function(_0x20bcd2,_0x568c4c){return _0x20bcd2[_0x5aff('0xa')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x340a=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x21760d,_0x312290){var _0x58cdff=function(_0x5a9aa6){while(--_0x5a9aa6){_0x21760d['push'](_0x21760d['shift']());}};_0x58cdff(++_0x312290);}(_0x340a,0x14d));var _0xa340=function(_0x2830d8,_0x37da0c){_0x2830d8=_0x2830d8-0x0;var _0x3cc941=_0x340a[_0x2830d8];return _0x3cc941;};'use strict';var _=require(_0xa340('0x0'));var util=require(_0xa340('0x1'));var logger=require(_0xa340('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa340('0x3'));var rp=require(_0xa340('0x4'));var fs=require('fs');var path=require(_0xa340('0x5'));var rimraf=require(_0xa340('0x6'));var config=require(_0xa340('0x7'));var attributes=require(_0xa340('0x8'));module[_0xa340('0x9')]=function(_0x21bfcf,_0x2fe1b4){return _0x21bfcf[_0xa340('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0xa340('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 049a596..6f0ef67 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 _0x5a85=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x6c645e,_0x5f3bf6){var _0x179890=function(_0x1bba06){while(--_0x1bba06){_0x6c645e['push'](_0x6c645e['shift']());}};_0x179890(++_0x5f3bf6);}(_0x5a85,0x1a7));var _0x55a8=function(_0x2f3cd3,_0x1f903a){_0x2f3cd3=_0x2f3cd3-0x0;var _0xcf7f5b=_0x5a85[_0x2f3cd3];return _0xcf7f5b;};'use strict';var _=require(_0x55a8('0x0'));var util=require(_0x55a8('0x1'));var moment=require(_0x55a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x55a8('0x3'));var fs=require('fs');var Redis=require(_0x55a8('0x4'));var db=require(_0x55a8('0x5'))['db'];var utils=require(_0x55a8('0x6'));var logger=require(_0x55a8('0x7'))('rpc');var config=require(_0x55a8('0x8'));var jayson=require(_0x55a8('0x9'));var client=jayson[_0x55a8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96a091,_0x235c09,_0x42ffc1){return new BPromise(function(_0x408ad6,_0x9e7891){return client['request'](_0x96a091,_0x42ffc1)[_0x55a8('0xb')](function(_0x1bf924){logger[_0x55a8('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x235c09,_0x55a8('0xd'));logger['debug'](_0x55a8('0xe'),_0x235c09,_0x55a8('0xd'),JSON['stringify'](_0x1bf924));if(_0x1bf924['error']){if(_0x1bf924[_0x55a8('0xf')]['code']===0x1f4){logger[_0x55a8('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x235c09,_0x1bf924[_0x55a8('0xf')]['message']);return _0x9e7891(_0x1bf924[_0x55a8('0xf')]['message']);}logger[_0x55a8('0xf')](_0x55a8('0x10'),_0x235c09,_0x1bf924[_0x55a8('0xf')][_0x55a8('0x11')]);return _0x408ad6(_0x1bf924[_0x55a8('0xf')][_0x55a8('0x11')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x235c09,'request\x20sent');_0x408ad6(_0x1bf924['result']['message']);}})[_0x55a8('0x12')](function(_0x1af450){logger[_0x55a8('0xf')](_0x55a8('0x10'),_0x235c09,_0x1af450);_0x9e7891(_0x1af450);});});} \ No newline at end of file +var _0xdd9a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','util','moment'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xdd9a,0xee));var _0xadd9=function(_0x372ebd,_0x191883){_0x372ebd=_0x372ebd-0x0;var _0xeeea39=_0xdd9a[_0x372ebd];return _0xeeea39;};'use strict';var _=require('lodash');var util=require(_0xadd9('0x0'));var moment=require(_0xadd9('0x1'));var BPromise=require(_0xadd9('0x2'));var rs=require(_0xadd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadd9('0x4'))['db'];var utils=require(_0xadd9('0x5'));var logger=require(_0xadd9('0x6'))(_0xadd9('0x7'));var config=require('../../config/environment');var jayson=require(_0xadd9('0x8'));var client=jayson[_0xadd9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30664a,_0x4e89ee,_0x2553cb){return new BPromise(function(_0x19bef8,_0x2e5227){return client[_0xadd9('0xa')](_0x30664a,_0x2553cb)[_0xadd9('0xb')](function(_0x2c2e2d){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4e89ee,_0xadd9('0xc'));logger[_0xadd9('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4e89ee,_0xadd9('0xc'),JSON['stringify'](_0x2c2e2d));if(_0x2c2e2d['error']){if(_0x2c2e2d[_0xadd9('0xe')][_0xadd9('0xf')]===0x1f4){logger[_0xadd9('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4e89ee,_0x2c2e2d[_0xadd9('0xe')][_0xadd9('0x10')]);return _0x2e5227(_0x2c2e2d[_0xadd9('0xe')][_0xadd9('0x10')]);}logger[_0xadd9('0xe')](_0xadd9('0x11'),_0x4e89ee,_0x2c2e2d[_0xadd9('0xe')]['message']);return _0x19bef8(_0x2c2e2d[_0xadd9('0xe')][_0xadd9('0x10')]);}else{logger['info'](_0xadd9('0x11'),_0x4e89ee,_0xadd9('0xc'));_0x19bef8(_0x2c2e2d[_0xadd9('0x12')][_0xadd9('0x10')]);}})[_0xadd9('0x13')](function(_0x49c316){logger['error'](_0xadd9('0x11'),_0x4e89ee,_0x49c316);_0x2e5227(_0x49c316);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 22e055c..4a87204 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 _0xdf74=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x44493f,_0x3be7b0){var _0xa9db14=function(_0x5379e5){while(--_0x5379e5){_0x44493f['push'](_0x44493f['shift']());}};_0xa9db14(++_0x3be7b0);}(_0xdf74,0xd4));var _0x4df7=function(_0x435f20,_0x974a55){_0x435f20=_0x435f20-0x0;var _0x3a5851=_0xdf74[_0x435f20];return _0x3a5851;};'use strict';var multer=require(_0x4df7('0x0'));var util=require('util');var path=require(_0x4df7('0x1'));var timeout=require(_0x4df7('0x2'));var express=require(_0x4df7('0x3'));var router=express['Router']();var auth=require(_0x4df7('0x4'));var interaction=require(_0x4df7('0x5'));var config=require(_0x4df7('0x6'));var controller=require('./intServicenowField.controller');router[_0x4df7('0x7')]('/',auth[_0x4df7('0x8')](),controller[_0x4df7('0x9')]);router[_0x4df7('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4df7('0xa')]('/',auth[_0x4df7('0x8')](),controller[_0x4df7('0xb')]);router[_0x4df7('0xc')](_0x4df7('0xd'),auth[_0x4df7('0x8')](),controller[_0x4df7('0xe')]);router[_0x4df7('0xf')]('/:id',auth[_0x4df7('0x8')](),controller[_0x4df7('0x10')]);module[_0x4df7('0x11')]=router; \ No newline at end of file +var _0x6ad7=['./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x16046c,_0x3f5377){var _0x2d8ef2=function(_0x20784a){while(--_0x20784a){_0x16046c['push'](_0x16046c['shift']());}};_0x2d8ef2(++_0x3f5377);}(_0x6ad7,0xd2));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x76ad('0x0'));var path=require(_0x76ad('0x1'));var timeout=require(_0x76ad('0x2'));var express=require(_0x76ad('0x3'));var router=express[_0x76ad('0x4')]();var auth=require(_0x76ad('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x76ad('0x6'));router[_0x76ad('0x7')]('/',auth[_0x76ad('0x8')](),controller[_0x76ad('0x9')]);router[_0x76ad('0x7')]('/:id',auth[_0x76ad('0x8')](),controller[_0x76ad('0xa')]);router[_0x76ad('0xb')]('/',auth[_0x76ad('0x8')](),controller[_0x76ad('0xc')]);router[_0x76ad('0xd')]('/:id',auth[_0x76ad('0x8')](),controller[_0x76ad('0xe')]);router[_0x76ad('0xf')](_0x76ad('0x10'),auth[_0x76ad('0x8')](),controller['destroy']);module[_0x76ad('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7c7e7b0..56c231a 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 _0xcb66=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x9e3a2d,_0x502af5){var _0x5458d1=function(_0x4bd42b){while(--_0x4bd42b){_0x9e3a2d['push'](_0x9e3a2d['shift']());}};_0x5458d1(++_0x502af5);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0xcb66[_0x2cc711];return _0x31a52e;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'type':{'type':Sequelize[_0x6cb6('0x1')](_0x6cb6('0x2'),_0x6cb6('0x3'),_0x6cb6('0x4'),'keyValue',_0x6cb6('0x5')),'defaultValue':_0x6cb6('0x2')},'content':{'type':Sequelize[_0x6cb6('0x6')]},'key':{'type':Sequelize[_0x6cb6('0x6')]},'keyType':{'type':Sequelize[_0x6cb6('0x1')]('string','variable',_0x6cb6('0x4'))},'keyContent':{'type':Sequelize[_0x6cb6('0x6')]},'idField':{'type':Sequelize[_0x6cb6('0x6')]},'nameField':{'type':Sequelize[_0x6cb6('0x6')]},'customField':{'type':Sequelize[_0x6cb6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6cb6('0x6')]}}; \ No newline at end of file +var _0x8958=['exports','keyValue','string','STRING','variable','customVariable','BOOLEAN'];(function(_0x494467,_0x2fcf86){var _0x530c6e=function(_0x4bc87a){while(--_0x4bc87a){_0x494467['push'](_0x494467['shift']());}};_0x530c6e(++_0x2fcf86);}(_0x8958,0x93));var _0x8895=function(_0x36ab5c,_0x41a7a2){_0x36ab5c=_0x36ab5c-0x0;var _0x57bf02=_0x8958[_0x36ab5c];return _0x57bf02;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0x8895('0x1'),'picklist'),'defaultValue':_0x8895('0x2')},'content':{'type':Sequelize[_0x8895('0x3')]},'key':{'type':Sequelize[_0x8895('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x8895('0x2'),_0x8895('0x4'),_0x8895('0x5'))},'keyContent':{'type':Sequelize[_0x8895('0x3')]},'idField':{'type':Sequelize[_0x8895('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8895('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8895('0x3')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 49728e7..0aba73c 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 _0xc2da=['length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','keys','catch','create','body','find','params','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy','error','name','send','map','ServicenowField','rawAttributes','key','model','query','filters','attributes','intersection','fields'];(function(_0x588d0b,_0x528b7f){var _0x4f40a1=function(_0x65e32d){while(--_0x65e32d){_0x588d0b['push'](_0x588d0b['shift']());}};_0x4f40a1(++_0x528b7f);}(_0xc2da,0x124));var _0xac2d=function(_0x30efc1,_0xce84de){_0x30efc1=_0x30efc1-0x0;var _0x46d79e=_0xc2da[_0x30efc1];return _0x46d79e;};'use strict';var pdf=require(_0xac2d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xac2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac2d('0x2'));var rp=require('request-promise');var moment=require(_0xac2d('0x3'));var BPromise=require(_0xac2d('0x4'));var Mustache=require(_0xac2d('0x5'));var util=require(_0xac2d('0x6'));var path=require(_0xac2d('0x7'));var sox=require(_0xac2d('0x8'));var csv=require(_0xac2d('0x9'));var ejs=require(_0xac2d('0xa'));var fs=require('fs');var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x9'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var licenseUtil=require(_0xac2d('0x16'));var db=require(_0xac2d('0x17'))['db'];function respondWithStatusCode(_0x4b9e88,_0x21aa1b){_0x21aa1b=_0x21aa1b||0xcc;return function(_0x20fa0d){if(_0x20fa0d){return _0x4b9e88[_0xac2d('0x18')](_0x21aa1b);}return _0x4b9e88[_0xac2d('0x19')](_0x21aa1b)[_0xac2d('0x1a')]();};}function respondWithResult(_0x2bed84,_0x284984){_0x284984=_0x284984||0xc8;return function(_0x897641){if(_0x897641){return _0x2bed84[_0xac2d('0x19')](_0x284984)[_0xac2d('0x1b')](_0x897641);}};}function respondWithFilteredResult(_0x11a3aa,_0x33d014){return function(_0x74853a){if(_0x74853a){var _0x2d92b5=_0x74853a[_0xac2d('0x1c')],_0x324978=_0x33d014['offset'],_0x49c0a9=_0x33d014[_0xac2d('0x1d')]+_0x33d014[_0xac2d('0x1e')],_0x3170ae;if(_0x49c0a9>=_0x2d92b5){_0x49c0a9=_0x2d92b5;_0x3170ae=0xc8;}else{_0x3170ae=0xce;}_0x11a3aa[_0xac2d('0x19')](_0x3170ae);return _0x11a3aa['set'](_0xac2d('0x1f'),_0x324978+'-'+_0x49c0a9+'/'+_0x2d92b5)['json'](_0x74853a);}return null;};}function patchUpdates(_0x20266d){return function(_0x3651e6){try{jsonpatch['apply'](_0x3651e6,_0x20266d,!![]);}catch(_0x23ed75){return BPromise['reject'](_0x23ed75);}return _0x3651e6['save']();};}function saveUpdates(_0x510e85,_0x5eaaef){return function(_0xab392d){if(_0xab392d){return _0xab392d[_0xac2d('0x20')](_0x510e85)[_0xac2d('0x21')](function(_0x19a955){return _0x19a955;});}return null;};}function removeEntity(_0x211d26,_0x391911){return function(_0x3454ea){if(_0x3454ea){return _0x3454ea[_0xac2d('0x22')]()[_0xac2d('0x21')](function(){_0x211d26[_0xac2d('0x19')](0xcc)[_0xac2d('0x1a')]();});}};}function handleEntityNotFound(_0x226b6b,_0x1df55b){return function(_0xa8a259){if(!_0xa8a259){_0x226b6b[_0xac2d('0x18')](0x194);}return _0xa8a259;};}function handleError(_0x8d0e32,_0x13e1e7){_0x13e1e7=_0x13e1e7||0x1f4;return function(_0x10da1d){logger[_0xac2d('0x23')](_0x10da1d['stack']);if(_0x10da1d[_0xac2d('0x24')]){delete _0x10da1d[_0xac2d('0x24')];}_0x8d0e32[_0xac2d('0x19')](_0x13e1e7)[_0xac2d('0x25')](_0x10da1d);};}exports['index']=function(_0x543f93,_0x1714c1){var _0x1c69f1={},_0x2ad9b1={},_0x8c3390={'count':0x0,'rows':[]};var _0x15d043=_[_0xac2d('0x26')](db[_0xac2d('0x27')][_0xac2d('0x28')],function(_0x2ac875){return{'name':_0x2ac875['fieldName'],'type':_0x2ac875['type'][_0xac2d('0x29')]};});_0x2ad9b1[_0xac2d('0x2a')]=_[_0xac2d('0x26')](_0x15d043,_0xac2d('0x24'));_0x2ad9b1[_0xac2d('0x2b')]=_['keys'](_0x543f93[_0xac2d('0x2b')]);_0x2ad9b1[_0xac2d('0x2c')]=_['intersection'](_0x2ad9b1[_0xac2d('0x2a')],_0x2ad9b1[_0xac2d('0x2b')]);_0x1c69f1[_0xac2d('0x2d')]=_[_0xac2d('0x2e')](_0x2ad9b1['model'],qs[_0xac2d('0x2f')](_0x543f93['query'][_0xac2d('0x2f')]));_0x1c69f1[_0xac2d('0x2d')]=_0x1c69f1['attributes'][_0xac2d('0x30')]?_0x1c69f1[_0xac2d('0x2d')]:_0x2ad9b1[_0xac2d('0x2a')];if(!_0x543f93[_0xac2d('0x2b')][_0xac2d('0x31')]('nolimit')){_0x1c69f1[_0xac2d('0x1e')]=qs['limit'](_0x543f93[_0xac2d('0x2b')]['limit']);_0x1c69f1[_0xac2d('0x1d')]=qs[_0xac2d('0x1d')](_0x543f93['query']['offset']);}_0x1c69f1[_0xac2d('0x32')]=qs[_0xac2d('0x33')](_0x543f93[_0xac2d('0x2b')][_0xac2d('0x33')]);_0x1c69f1[_0xac2d('0x34')]=qs[_0xac2d('0x2c')](_[_0xac2d('0x35')](_0x543f93['query'],_0x2ad9b1[_0xac2d('0x2c')]),_0x15d043);if(_0x543f93[_0xac2d('0x2b')][_0xac2d('0x36')]){_0x1c69f1[_0xac2d('0x34')]=_[_0xac2d('0x37')](_0x1c69f1['where'],{'$or':_[_0xac2d('0x26')](_0x15d043,function(_0x1b3ae7){if(_0x1b3ae7[_0xac2d('0x38')]!==_0xac2d('0x39')){var _0x1ce9ad={};_0x1ce9ad[_0x1b3ae7[_0xac2d('0x24')]]={'$like':'%'+_0x543f93[_0xac2d('0x2b')][_0xac2d('0x36')]+'%'};return _0x1ce9ad;}})});}_0x1c69f1=_[_0xac2d('0x37')]({},_0x1c69f1,_0x543f93[_0xac2d('0x3a')]);var _0x510be1={'where':_0x1c69f1[_0xac2d('0x34')]};return db['ServicenowField'][_0xac2d('0x1c')](_0x510be1)[_0xac2d('0x21')](function(_0x392554){_0x8c3390[_0xac2d('0x1c')]=_0x392554;if(_0x543f93[_0xac2d('0x2b')]['includeAll']){_0x1c69f1[_0xac2d('0x3b')]=[{'all':!![]}];}return db[_0xac2d('0x27')][_0xac2d('0x3c')](_0x1c69f1);})[_0xac2d('0x21')](function(_0x2cbc7b){_0x8c3390['rows']=_0x2cbc7b;return _0x8c3390;})['then'](respondWithFilteredResult(_0x1714c1,_0x1c69f1))['catch'](handleError(_0x1714c1,null));};exports[_0xac2d('0x3d')]=function(_0x27e948,_0x3b40e2){var _0x23ad00={'raw':!![],'where':{'id':_0x27e948['params']['id']}},_0x1d176d={};_0x1d176d[_0xac2d('0x2a')]=_[_0xac2d('0x3e')](db['ServicenowField'][_0xac2d('0x28')]);_0x1d176d[_0xac2d('0x2b')]=_[_0xac2d('0x3e')](_0x27e948[_0xac2d('0x2b')]);_0x1d176d[_0xac2d('0x2c')]=_['intersection'](_0x1d176d[_0xac2d('0x2a')],_0x1d176d[_0xac2d('0x2b')]);_0x23ad00[_0xac2d('0x2d')]=_[_0xac2d('0x2e')](_0x1d176d['model'],qs['fields'](_0x27e948[_0xac2d('0x2b')]['fields']));_0x23ad00[_0xac2d('0x2d')]=_0x23ad00[_0xac2d('0x2d')]['length']?_0x23ad00['attributes']:_0x1d176d[_0xac2d('0x2a')];if(_0x27e948['query']['includeAll']){_0x23ad00['include']=[{'all':!![]}];}_0x23ad00=_[_0xac2d('0x37')]({},_0x23ad00,_0x27e948[_0xac2d('0x3a')]);return db[_0xac2d('0x27')]['find'](_0x23ad00)[_0xac2d('0x21')](handleEntityNotFound(_0x3b40e2,null))['then'](respondWithResult(_0x3b40e2,null))[_0xac2d('0x3f')](handleError(_0x3b40e2,null));};exports[_0xac2d('0x40')]=function(_0x5244ac,_0x43e90d){return db[_0xac2d('0x27')][_0xac2d('0x40')](_0x5244ac[_0xac2d('0x41')],{})[_0xac2d('0x21')](respondWithResult(_0x43e90d,0xc9))['catch'](handleError(_0x43e90d,null));};exports[_0xac2d('0x20')]=function(_0xaf71e4,_0x5326bd){if(_0xaf71e4[_0xac2d('0x41')]['id']){delete _0xaf71e4['body']['id'];}return db['ServicenowField'][_0xac2d('0x42')]({'where':{'id':_0xaf71e4[_0xac2d('0x43')]['id']}})['then'](handleEntityNotFound(_0x5326bd,null))[_0xac2d('0x21')](saveUpdates(_0xaf71e4[_0xac2d('0x41')],null))[_0xac2d('0x21')](respondWithResult(_0x5326bd,null))[_0xac2d('0x3f')](handleError(_0x5326bd,null));};exports[_0xac2d('0x22')]=function(_0x1ffa82,_0x658d69){return db[_0xac2d('0x27')][_0xac2d('0x42')]({'where':{'id':_0x1ffa82[_0xac2d('0x43')]['id']}})['then'](handleEntityNotFound(_0x658d69,null))[_0xac2d('0x21')](removeEntity(_0x658d69,null))[_0xac2d('0x3f')](handleError(_0x658d69,null));}; \ No newline at end of file +var _0x5f66=['moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','error','stack','send','index','map','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x23ed33,_0x242126){var _0x117ef7=function(_0x1e15ce){while(--_0x1e15ce){_0x23ed33['push'](_0x23ed33['shift']());}};_0x117ef7(++_0x242126);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=_0x19b9ff[_0x65f6('0x18')],_0x5dd324=_0x59154e[_0x65f6('0x19')],_0x1693e6=_0x59154e[_0x65f6('0x19')]+_0x59154e[_0x65f6('0x1a')],_0x5c69f8;if(_0x1693e6>=_0x49a913){_0x1693e6=_0x49a913;_0x5c69f8=0xc8;}else{_0x5c69f8=0xce;}_0x3440af[_0x65f6('0x15')](_0x5c69f8);return _0x3440af[_0x65f6('0x1b')]('Content-Range',_0x5dd324+'-'+_0x1693e6+'/'+_0x49a913)['json'](_0x19b9ff);}return null;};}function patchUpdates(_0x2d538c){return function(_0x5b4055){try{jsonpatch['apply'](_0x5b4055,_0x2d538c,!![]);}catch(_0x5c5b91){return BPromise[_0x65f6('0x1c')](_0x5c5b91);}return _0x5b4055[_0x65f6('0x1d')]();};}function saveUpdates(_0x5114a4,_0x39e19f){return function(_0x270893){if(_0x270893){return _0x270893[_0x65f6('0x1e')](_0x5114a4)[_0x65f6('0x1f')](function(_0x219ab2){return _0x219ab2;});}return null;};}function removeEntity(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['destroy']()['then'](function(){_0xc139c2[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x524e42,_0x1eeaaa){return function(_0x471a33){if(!_0x471a33){_0x524e42[_0x65f6('0x14')](0x194);}return _0x471a33;};}function handleError(_0x2774a1,_0x4f5a69){_0x4f5a69=_0x4f5a69||0x1f4;return function(_0x9d7bb0){logger[_0x65f6('0x20')](_0x9d7bb0[_0x65f6('0x21')]);if(_0x9d7bb0['name']){delete _0x9d7bb0['name'];}_0x2774a1['status'](_0x4f5a69)[_0x65f6('0x22')](_0x9d7bb0);};}exports[_0x65f6('0x23')]=function(_0x4b2292,_0x296cd9){var _0x28f710={},_0x52277c={},_0x325cb4={'count':0x0,'rows':[]};var _0x2bff2b=_[_0x65f6('0x24')](db['ServicenowField']['rawAttributes'],function(_0x488d36){return{'name':_0x488d36[_0x65f6('0x25')],'type':_0x488d36[_0x65f6('0x26')][_0x65f6('0x27')]};});_0x52277c[_0x65f6('0x28')]=_[_0x65f6('0x24')](_0x2bff2b,_0x65f6('0x29'));_0x52277c[_0x65f6('0x2a')]=_['keys'](_0x4b2292['query']);_0x52277c[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x52277c['model'],_0x52277c['query']);_0x28f710[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x52277c[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x2e')]));_0x28f710['attributes']=_0x28f710[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x28f710[_0x65f6('0x2d')]:_0x52277c['model'];if(!_0x4b2292[_0x65f6('0x2a')][_0x65f6('0x30')](_0x65f6('0x31'))){_0x28f710[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x4b2292[_0x65f6('0x2a')]['limit']);_0x28f710[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x4b2292['query'][_0x65f6('0x19')]);}_0x28f710['order']=qs[_0x65f6('0x32')](_0x4b2292['query'][_0x65f6('0x32')]);_0x28f710[_0x65f6('0x33')]=qs['filters'](_[_0x65f6('0x34')](_0x4b2292[_0x65f6('0x2a')],_0x52277c[_0x65f6('0x2b')]),_0x2bff2b);if(_0x4b2292['query']['filter']){_0x28f710[_0x65f6('0x33')]=_['merge'](_0x28f710[_0x65f6('0x33')],{'$or':_['map'](_0x2bff2b,function(_0x22d760){if(_0x22d760[_0x65f6('0x26')]!=='VIRTUAL'){var _0x44b809={};_0x44b809[_0x22d760['name']]={'$like':'%'+_0x4b2292['query'][_0x65f6('0x35')]+'%'};return _0x44b809;}})});}_0x28f710=_[_0x65f6('0x36')]({},_0x28f710,_0x4b2292[_0x65f6('0x37')]);var _0x313be5={'where':_0x28f710[_0x65f6('0x33')]};return db[_0x65f6('0x38')][_0x65f6('0x18')](_0x313be5)[_0x65f6('0x1f')](function(_0x4f933b){_0x325cb4[_0x65f6('0x18')]=_0x4f933b;if(_0x4b2292['query'][_0x65f6('0x39')]){_0x28f710[_0x65f6('0x3a')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x3b')](_0x28f710);})['then'](function(_0x32148f){_0x325cb4[_0x65f6('0x3c')]=_0x32148f;return _0x325cb4;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x296cd9,_0x28f710))[_0x65f6('0x3d')](handleError(_0x296cd9,null));};exports[_0x65f6('0x3e')]=function(_0x3f6103,_0xed4c96){var _0x2acca5={'raw':!![],'where':{'id':_0x3f6103['params']['id']}},_0x35c195={};_0x35c195[_0x65f6('0x28')]=_[_0x65f6('0x3f')](db[_0x65f6('0x38')][_0x65f6('0x40')]);_0x35c195[_0x65f6('0x2a')]=_[_0x65f6('0x3f')](_0x3f6103[_0x65f6('0x2a')]);_0x35c195[_0x65f6('0x2b')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],_0x35c195[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x2d')]=_[_0x65f6('0x2c')](_0x35c195[_0x65f6('0x28')],qs[_0x65f6('0x2e')](_0x3f6103[_0x65f6('0x2a')]['fields']));_0x2acca5[_0x65f6('0x2d')]=_0x2acca5[_0x65f6('0x2d')][_0x65f6('0x2f')]?_0x2acca5[_0x65f6('0x2d')]:_0x35c195['model'];if(_0x3f6103[_0x65f6('0x2a')][_0x65f6('0x39')]){_0x2acca5[_0x65f6('0x3a')]=[{'all':!![]}];}_0x2acca5=_['merge']({},_0x2acca5,_0x3f6103[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x2acca5)[_0x65f6('0x1f')](handleEntityNotFound(_0xed4c96,null))['then'](respondWithResult(_0xed4c96,null))[_0x65f6('0x3d')](handleError(_0xed4c96,null));};exports['create']=function(_0x3f1baa,_0x6968b){return db['ServicenowField'][_0x65f6('0x42')](_0x3f1baa['body'],{})[_0x65f6('0x1f')](respondWithResult(_0x6968b,0xc9))[_0x65f6('0x3d')](handleError(_0x6968b,null));};exports[_0x65f6('0x1e')]=function(_0xc0db01,_0x3ec18f){if(_0xc0db01[_0x65f6('0x43')]['id']){delete _0xc0db01['body']['id'];}return db['ServicenowField'][_0x65f6('0x41')]({'where':{'id':_0xc0db01[_0x65f6('0x44')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x3ec18f,null))[_0x65f6('0x1f')](saveUpdates(_0xc0db01[_0x65f6('0x43')],null))[_0x65f6('0x1f')](respondWithResult(_0x3ec18f,null))[_0x65f6('0x3d')](handleError(_0x3ec18f,null));};exports[_0x65f6('0x45')]=function(_0x414f49,_0x517a47){return db[_0x65f6('0x38')][_0x65f6('0x41')]({'where':{'id':_0x414f49[_0x65f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x517a47,null))[_0x65f6('0x1f')](removeEntity(_0x517a47,null))[_0x65f6('0x3d')](handleError(_0x517a47,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2ca10e5..c9a20b5 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 _0xf4dd=['idField','lodash','api','moment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4dd,0x1b9));var _0xdf4d=function(_0x31ae4b,_0xa50207){_0x31ae4b=_0x31ae4b-0x0;var _0x383ddf=_0xf4dd[_0x31ae4b];return _0x383ddf;};'use strict';var _=require(_0xdf4d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdf4d('0x1'));var moment=require(_0xdf4d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf4d('0x3'));module[_0xdf4d('0x4')]=function(_0x19a4f5,_0x1d31fc){return _0x19a4f5[_0xdf4d('0x5')](_0xdf4d('0x6'),attributes,{'tableName':_0xdf4d('0x7'),'paranoid':![],'indexes':[{'name':_0xdf4d('0x8'),'fields':[_0xdf4d('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41ee=['servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41ee,0x8a));var _0xe41e=function(_0x3e4e7d,_0x5c82c3){_0x3e4e7d=_0x3e4e7d-0x0;var _0x538152=_0x41ee[_0x3e4e7d];return _0x538152;};'use strict';var _=require('lodash');var util=require(_0xe41e('0x0'));var logger=require(_0xe41e('0x1'))(_0xe41e('0x2'));var moment=require(_0xe41e('0x3'));var BPromise=require(_0xe41e('0x4'));var rp=require(_0xe41e('0x5'));var fs=require('fs');var path=require(_0xe41e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe41e('0x7'));module[_0xe41e('0x8')]=function(_0x527ee3,_0x21a971){return _0x527ee3[_0xe41e('0x9')](_0xe41e('0xa'),attributes,{'tableName':_0xe41e('0xb'),'paranoid':![],'indexes':[{'name':_0xe41e('0xc'),'fields':[_0xe41e('0xd'),_0xe41e('0xe')],'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 1056cca..c3ae5d2 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 _0xed0c=['error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xed0c,0x1e5));var _0xced0=function(_0xb656ea,_0x29f197){_0xb656ea=_0xb656ea-0x0;var _0x4db52e=_0xed0c[_0xb656ea];return _0x4db52e;};'use strict';var _=require(_0xced0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xced0('0x1'));var rs=require(_0xced0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xced0('0x4'))('rpc');var config=require(_0xced0('0x5'));var jayson=require(_0xced0('0x6'));var client=jayson[_0xced0('0x7')][_0xced0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aea8c,_0x490853,_0x2d37d8){return new BPromise(function(_0xd9c554,_0x118c5d){return client['request'](_0x4aea8c,_0x2d37d8)[_0xced0('0x9')](function(_0x1744f5){logger['info'](_0xced0('0xa'),_0x490853,_0xced0('0xb'));logger[_0xced0('0xc')](_0xced0('0xd'),_0x490853,'request\x20sent',JSON[_0xced0('0xe')](_0x1744f5));if(_0x1744f5[_0xced0('0xf')]){if(_0x1744f5['error'][_0xced0('0x10')]===0x1f4){logger[_0xced0('0xf')](_0xced0('0xa'),_0x490853,_0x1744f5[_0xced0('0xf')]['message']);return _0x118c5d(_0x1744f5[_0xced0('0xf')]['message']);}logger[_0xced0('0xf')](_0xced0('0xa'),_0x490853,_0x1744f5[_0xced0('0xf')][_0xced0('0x11')]);return _0xd9c554(_0x1744f5[_0xced0('0xf')]['message']);}else{logger['info'](_0xced0('0xa'),_0x490853,'request\x20sent');_0xd9c554(_0x1744f5[_0xced0('0x12')][_0xced0('0x11')]);}})[_0xced0('0x13')](function(_0x17e39d){logger[_0xced0('0xf')](_0xced0('0xa'),_0x490853,_0x17e39d);_0x118c5d(_0x17e39d);});});} \ No newline at end of file +var _0x1153=['request\x20sent','error','code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x55214a,_0x30f5ac){var _0x58cb5b=function(_0x41cd14){while(--_0x41cd14){_0x55214a['push'](_0x55214a['shift']());}};_0x58cb5b(++_0x30f5ac);}(_0x1153,0x101));var _0x3115=function(_0x5c31dd,_0x15955b){_0x5c31dd=_0x5c31dd-0x0;var _0x574a5b=_0x1153[_0x5c31dd];return _0x574a5b;};'use strict';var _=require(_0x3115('0x0'));var util=require(_0x3115('0x1'));var moment=require(_0x3115('0x2'));var BPromise=require(_0x3115('0x3'));var rs=require(_0x3115('0x4'));var fs=require('fs');var Redis=require(_0x3115('0x5'));var db=require(_0x3115('0x6'))['db'];var utils=require(_0x3115('0x7'));var logger=require(_0x3115('0x8'))(_0x3115('0x9'));var config=require(_0x3115('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3115('0xb')][_0x3115('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c9e62,_0x5e93cd,_0x370861){return new BPromise(function(_0x109358,_0xad734e){return client[_0x3115('0xd')](_0x4c9e62,_0x370861)[_0x3115('0xe')](function(_0x4ba9b4){logger[_0x3115('0xf')]('ServicenowField,\x20%s,\x20%s',_0x5e93cd,'request\x20sent');logger[_0x3115('0x10')](_0x3115('0x11'),_0x5e93cd,_0x3115('0x12'),JSON['stringify'](_0x4ba9b4));if(_0x4ba9b4[_0x3115('0x13')]){if(_0x4ba9b4[_0x3115('0x13')][_0x3115('0x14')]===0x1f4){logger[_0x3115('0x13')](_0x3115('0x15'),_0x5e93cd,_0x4ba9b4['error'][_0x3115('0x16')]);return _0xad734e(_0x4ba9b4[_0x3115('0x13')][_0x3115('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x5e93cd,_0x4ba9b4[_0x3115('0x13')][_0x3115('0x16')]);return _0x109358(_0x4ba9b4[_0x3115('0x13')]['message']);}else{logger['info'](_0x3115('0x15'),_0x5e93cd,_0x3115('0x12'));_0x109358(_0x4ba9b4[_0x3115('0x17')][_0x3115('0x16')]);}})[_0x3115('0x18')](function(_0x47704b){logger['error'](_0x3115('0x15'),_0x5e93cd,_0x47704b);_0xad734e(_0x47704b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 53c905f..0d6f076 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 _0xffaa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','Router'];(function(_0x5c2b5f,_0x471aa3){var _0x6432f1=function(_0x4cd34f){while(--_0x4cd34f){_0x5c2b5f['push'](_0x5c2b5f['shift']());}};_0x6432f1(++_0x471aa3);}(_0xffaa,0x130));var _0xaffa=function(_0x25ed71,_0x3fc526){_0x25ed71=_0x25ed71-0x0;var _0x4743cc=_0xffaa[_0x25ed71];return _0x4743cc;};'use strict';var multer=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var path=require(_0xaffa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaffa('0x3')]();var auth=require(_0xaffa('0x4'));var interaction=require(_0xaffa('0x5'));var config=require(_0xaffa('0x6'));var controller=require(_0xaffa('0x7'));router[_0xaffa('0x8')]('/',auth[_0xaffa('0x9')](),controller[_0xaffa('0xa')]);router[_0xaffa('0x8')](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0xc')]);router[_0xaffa('0x8')](_0xaffa('0xd'),auth[_0xaffa('0x9')](),controller['getConfigurations']);router[_0xaffa('0x8')]('/:id/fields',auth[_0xaffa('0x9')](),controller[_0xaffa('0xe')]);router[_0xaffa('0xf')]('/',auth['isAuthenticated'](),controller[_0xaffa('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xaffa('0x11')]);router[_0xaffa('0x12')](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0x13')]);router['delete'](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0x14')]);module[_0xaffa('0x15')]=router; \ No newline at end of file +var _0x684d=['isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get'];(function(_0x5a7d26,_0x4cd0ba){var _0x56f50e=function(_0x49d27f){while(--_0x49d27f){_0x5a7d26['push'](_0x5a7d26['shift']());}};_0x56f50e(++_0x4cd0ba);}(_0x684d,0xcf));var _0xd684=function(_0x508365,_0x509c08){_0x508365=_0x508365-0x0;var _0x448e2c=_0x684d[_0x508365];return _0x448e2c;};'use strict';var multer=require(_0xd684('0x0'));var util=require(_0xd684('0x1'));var path=require('path');var timeout=require(_0xd684('0x2'));var express=require(_0xd684('0x3'));var router=express['Router']();var auth=require(_0xd684('0x4'));var interaction=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var controller=require(_0xd684('0x7'));router[_0xd684('0x8')]('/',auth[_0xd684('0x9')](),controller[_0xd684('0xa')]);router[_0xd684('0x8')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0xd684('0x9')](),controller[_0xd684('0xc')]);router[_0xd684('0x8')](_0xd684('0xd'),auth[_0xd684('0x9')](),controller[_0xd684('0xe')]);router[_0xd684('0xf')]('/',auth[_0xd684('0x9')](),controller[_0xd684('0x10')]);router['post'](_0xd684('0x11'),auth[_0xd684('0x9')](),controller[_0xd684('0x12')]);router[_0xd684('0x13')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller[_0xd684('0x14')]);router[_0xd684('0x15')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller[_0xd684('0x16')]);module[_0xd684('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a306552..903ddc3 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 _0x51e9=['exports','STRING','username','remoteUri','sequelize'];(function(_0x13164a,_0x5ad0a0){var _0x5a3be8=function(_0x3b00db){while(--_0x3b00db){_0x13164a['push'](_0x13164a['shift']());}};_0x5a3be8(++_0x5ad0a0);}(_0x51e9,0x121));var _0x951e=function(_0x50c03e,_0x25d8c7){_0x50c03e=_0x50c03e-0x0;var _0x5694b0=_0x51e9[_0x50c03e];return _0x5694b0;};'use strict';var Sequelize=require(_0x951e('0x0'));module[_0x951e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x951e('0x2')],'unique':_0x951e('0x3')},'password':{'type':Sequelize[_0x951e('0x2')]},'remoteUri':{'type':Sequelize[_0x951e('0x2')],'unique':_0x951e('0x4')},'serverUrl':{'type':Sequelize[_0x951e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe15c=['STRING','username','remoteUri'];(function(_0x152f04,_0x8586f8){var _0x7075e1=function(_0x3ff523){while(--_0x3ff523){_0x152f04['push'](_0x152f04['shift']());}};_0x7075e1(++_0x8586f8);}(_0xe15c,0x90));var _0xce15=function(_0x5dd47a,_0x16bfa2){_0x5dd47a=_0x5dd47a-0x0;var _0x4d6f80=_0xe15c[_0x5dd47a];return _0x4d6f80;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xce15('0x0')]},'description':{'type':Sequelize[_0xce15('0x0')]},'username':{'type':Sequelize[_0xce15('0x0')],'unique':_0xce15('0x1')},'password':{'type':Sequelize[_0xce15('0x0')]},'remoteUri':{'type':Sequelize[_0xce15('0x0')],'unique':_0xce15('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 86baadf..33fc615 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 _0xe73b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','SugarcrmAccount','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','SugarcrmConfiguration','rawAttributes','Subjects','getSubjects','channel','Descriptions','SugarcrmField','assigned_user_id','duration_hours','duration_minutes','parent_id','parent_name','findOne','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xe73b,0x81));var _0xbe73=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0xe73b[_0xd413a4];return _0x9170f4;};'use strict';var pdf=require(_0xbe73('0x0'));var emlformat=require(_0xbe73('0x1'));var rimraf=require(_0xbe73('0x2'));var zipdir=require(_0xbe73('0x3'));var jsonpatch=require(_0xbe73('0x4'));var rp=require(_0xbe73('0x5'));var moment=require(_0xbe73('0x6'));var BPromise=require(_0xbe73('0x7'));var Mustache=require(_0xbe73('0x8'));var util=require(_0xbe73('0x9'));var path=require(_0xbe73('0xa'));var sox=require(_0xbe73('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe73('0xc'));var squel=require('squel');var crypto=require(_0xbe73('0xd'));var jsforce=require(_0xbe73('0xe'));var deskjs=require(_0xbe73('0xf'));var toCsv=require(_0xbe73('0x10'));var querystring=require(_0xbe73('0x11'));var Papa=require(_0xbe73('0x12'));var Redis=require(_0xbe73('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe73('0x14'));var hardwareService=require(_0xbe73('0x15'));var logger=require(_0xbe73('0x16'))(_0xbe73('0x17'));var utils=require('../../config/utils');var config=require(_0xbe73('0x18'));var licenseUtil=require(_0xbe73('0x19'));var db=require(_0xbe73('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbe73('0x1b'));var client=jayson[_0xbe73('0x1c')][_0xbe73('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x58f75e,_0x41fee1,_0x175ff3,_0x539710){return new BPromise(function(_0xa3cfdd,_0x1a5533){var _0x225793=_0x539710||client;return _0x225793[_0xbe73('0x1e')](_0x58f75e,_0x175ff3)[_0xbe73('0x1f')](function(_0x1c9ddd){logger[_0xbe73('0x20')](_0xbe73('0x21'),_0x41fee1,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x41fee1,'request\x20sent',JSON[_0xbe73('0x22')](_0x1c9ddd));if(_0x1c9ddd[_0xbe73('0x23')]){if(_0x1c9ddd['error'][_0xbe73('0x24')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x41fee1,_0x1c9ddd[_0xbe73('0x23')][_0xbe73('0x25')]);return _0x1a5533(_0x1c9ddd[_0xbe73('0x23')][_0xbe73('0x25')]);}logger['error'](_0xbe73('0x21'),_0x41fee1,_0x1c9ddd['error'][_0xbe73('0x25')]);return _0xa3cfdd(_0x1c9ddd[_0xbe73('0x23')]['message']);}else{logger['info'](_0xbe73('0x21'),_0x41fee1,_0xbe73('0x26'));_0xa3cfdd(_0x1c9ddd[_0xbe73('0x27')][_0xbe73('0x25')]);}})[_0xbe73('0x28')](function(_0x3f11b8){logger[_0xbe73('0x23')](_0xbe73('0x21'),_0x41fee1,_0x3f11b8);_0x1a5533(_0x3f11b8);});});}function respondWithStatusCode(_0x1f1069,_0x56746b){_0x56746b=_0x56746b||0xcc;return function(_0xd0eb36){if(_0xd0eb36){return _0x1f1069['sendStatus'](_0x56746b);}return _0x1f1069[_0xbe73('0x29')](_0x56746b)[_0xbe73('0x2a')]();};}function respondWithResult(_0x360933,_0xab00f){_0xab00f=_0xab00f||0xc8;return function(_0x226acf){if(_0x226acf){return _0x360933['status'](_0xab00f)[_0xbe73('0x2b')](_0x226acf);}};}function respondWithFilteredResult(_0x30af9b,_0x46ebbd){return function(_0x22a27a){if(_0x22a27a){var _0x306e6e=_0x22a27a[_0xbe73('0x2c')],_0x476bc1=_0x46ebbd['offset'],_0x168a9b=_0x46ebbd['offset']+_0x46ebbd[_0xbe73('0x2d')],_0x11f9f1;if(_0x168a9b>=_0x306e6e){_0x168a9b=_0x306e6e;_0x11f9f1=0xc8;}else{_0x11f9f1=0xce;}_0x30af9b[_0xbe73('0x29')](_0x11f9f1);return _0x30af9b[_0xbe73('0x2e')](_0xbe73('0x2f'),_0x476bc1+'-'+_0x168a9b+'/'+_0x306e6e)[_0xbe73('0x2b')](_0x22a27a);}return null;};}function patchUpdates(_0x57a411){return function(_0x3f6fb3){try{jsonpatch[_0xbe73('0x30')](_0x3f6fb3,_0x57a411,!![]);}catch(_0x42b996){return BPromise[_0xbe73('0x31')](_0x42b996);}return _0x3f6fb3[_0xbe73('0x32')]();};}function saveUpdates(_0x543968,_0x243f3d){return function(_0x336944){if(_0x336944){return _0x336944[_0xbe73('0x33')](_0x543968)[_0xbe73('0x1f')](function(_0x49a166){return _0x49a166;});}return null;};}function removeEntity(_0x520e53,_0x357f0c){return function(_0x570b21){if(_0x570b21){return _0x570b21[_0xbe73('0x34')]()[_0xbe73('0x1f')](function(){_0x520e53[_0xbe73('0x29')](0xcc)[_0xbe73('0x2a')]();});}};}function handleEntityNotFound(_0x32b7fb,_0x4004aa){return function(_0x16a958){if(!_0x16a958){_0x32b7fb[_0xbe73('0x35')](0x194);}return _0x16a958;};}function handleError(_0x38084e,_0x22c469){_0x22c469=_0x22c469||0x1f4;return function(_0x30e0df){logger[_0xbe73('0x23')](_0x30e0df[_0xbe73('0x36')]);if(_0x30e0df[_0xbe73('0x37')]){delete _0x30e0df[_0xbe73('0x37')];}_0x38084e[_0xbe73('0x29')](_0x22c469)[_0xbe73('0x38')](_0x30e0df);};}exports[_0xbe73('0x39')]=function(_0x4cad7f,_0x2e6b88){var _0x11c23f={},_0x39d019={},_0x53c96c={'count':0x0,'rows':[]};var _0x25c731=_['map'](db[_0xbe73('0x3a')]['rawAttributes'],function(_0x234b9e){return{'name':_0x234b9e[_0xbe73('0x3b')],'type':_0x234b9e[_0xbe73('0x3c')][_0xbe73('0x3d')]};});_0x39d019[_0xbe73('0x3e')]=_[_0xbe73('0x3f')](_0x25c731,_0xbe73('0x37'));_0x39d019[_0xbe73('0x40')]=_[_0xbe73('0x41')](_0x4cad7f[_0xbe73('0x40')]);_0x39d019[_0xbe73('0x42')]=_['intersection'](_0x39d019[_0xbe73('0x3e')],_0x39d019['query']);_0x11c23f[_0xbe73('0x43')]=_[_0xbe73('0x44')](_0x39d019[_0xbe73('0x3e')],qs[_0xbe73('0x45')](_0x4cad7f[_0xbe73('0x40')]['fields']));_0x11c23f['attributes']=_0x11c23f['attributes'][_0xbe73('0x46')]?_0x11c23f[_0xbe73('0x43')]:_0x39d019[_0xbe73('0x3e')];if(!_0x4cad7f[_0xbe73('0x40')]['hasOwnProperty'](_0xbe73('0x47'))){_0x11c23f[_0xbe73('0x2d')]=qs['limit'](_0x4cad7f[_0xbe73('0x40')][_0xbe73('0x2d')]);_0x11c23f[_0xbe73('0x48')]=qs[_0xbe73('0x48')](_0x4cad7f[_0xbe73('0x40')][_0xbe73('0x48')]);}_0x11c23f['order']=qs['sort'](_0x4cad7f['query'][_0xbe73('0x49')]);_0x11c23f['where']=qs[_0xbe73('0x42')](_[_0xbe73('0x4a')](_0x4cad7f['query'],_0x39d019['filters']),_0x25c731);if(_0x4cad7f[_0xbe73('0x40')][_0xbe73('0x4b')]){_0x11c23f[_0xbe73('0x4c')]=_[_0xbe73('0x4d')](_0x11c23f[_0xbe73('0x4c')],{'$or':_[_0xbe73('0x3f')](_0x25c731,function(_0x5afbd9){if(_0x5afbd9['type']!==_0xbe73('0x4e')){var _0x30cc73={};_0x30cc73[_0x5afbd9[_0xbe73('0x37')]]={'$like':'%'+_0x4cad7f[_0xbe73('0x40')][_0xbe73('0x4b')]+'%'};return _0x30cc73;}})});}_0x11c23f=_[_0xbe73('0x4d')]({},_0x11c23f,_0x4cad7f[_0xbe73('0x4f')]);var _0x16b1a0={'where':_0x11c23f[_0xbe73('0x4c')]};return db['SugarcrmAccount'][_0xbe73('0x2c')](_0x16b1a0)[_0xbe73('0x1f')](function(_0x2aa213){_0x53c96c[_0xbe73('0x2c')]=_0x2aa213;if(_0x4cad7f[_0xbe73('0x40')]['includeAll']){_0x11c23f[_0xbe73('0x50')]=[{'all':!![]}];}return db[_0xbe73('0x3a')][_0xbe73('0x51')](_0x11c23f);})['then'](function(_0x20d1c9){_0x53c96c[_0xbe73('0x52')]=_0x20d1c9;return _0x53c96c;})[_0xbe73('0x1f')](respondWithFilteredResult(_0x2e6b88,_0x11c23f))[_0xbe73('0x28')](handleError(_0x2e6b88,null));};exports[_0xbe73('0x53')]=function(_0xfa8ad0,_0x5aebe4){var _0x3fafb6={'raw':![],'where':{'id':_0xfa8ad0[_0xbe73('0x54')]['id']}},_0x98f299={};_0x98f299[_0xbe73('0x3e')]=_[_0xbe73('0x41')](db['SugarcrmAccount']['rawAttributes']);_0x98f299['query']=_['keys'](_0xfa8ad0[_0xbe73('0x40')]);_0x98f299[_0xbe73('0x42')]=_[_0xbe73('0x44')](_0x98f299[_0xbe73('0x3e')],_0x98f299[_0xbe73('0x40')]);_0x3fafb6[_0xbe73('0x43')]=_[_0xbe73('0x44')](_0x98f299[_0xbe73('0x3e')],qs['fields'](_0xfa8ad0['query']['fields']));_0x3fafb6[_0xbe73('0x43')]=_0x3fafb6['attributes']['length']?_0x3fafb6[_0xbe73('0x43')]:_0x98f299[_0xbe73('0x3e')];if(_0xfa8ad0[_0xbe73('0x40')][_0xbe73('0x55')]){_0x3fafb6[_0xbe73('0x50')]=[{'all':!![]}];}_0x3fafb6=_['merge']({},_0x3fafb6,_0xfa8ad0[_0xbe73('0x4f')]);return db[_0xbe73('0x3a')][_0xbe73('0x56')](_0x3fafb6)[_0xbe73('0x1f')](handleEntityNotFound(_0x5aebe4,null))[_0xbe73('0x1f')](respondWithResult(_0x5aebe4,null))[_0xbe73('0x28')](handleError(_0x5aebe4,null));};exports[_0xbe73('0x57')]=function(_0x56f8c4,_0x1b82a3){return db[_0xbe73('0x3a')][_0xbe73('0x57')](_0x56f8c4['body'],{})['then'](respondWithResult(_0x1b82a3,0xc9))[_0xbe73('0x28')](handleError(_0x1b82a3,null));};exports[_0xbe73('0x33')]=function(_0x2fa2ce,_0x53bb70){if(_0x2fa2ce[_0xbe73('0x58')]['id']){delete _0x2fa2ce[_0xbe73('0x58')]['id'];}return db[_0xbe73('0x3a')]['find']({'where':{'id':_0x2fa2ce[_0xbe73('0x54')]['id']}})[_0xbe73('0x1f')](handleEntityNotFound(_0x53bb70,null))[_0xbe73('0x1f')](saveUpdates(_0x2fa2ce['body'],null))[_0xbe73('0x1f')](respondWithResult(_0x53bb70,null))[_0xbe73('0x28')](handleError(_0x53bb70,null));};exports['destroy']=function(_0x1a718a,_0x48d361){return db['SugarcrmAccount'][_0xbe73('0x56')]({'where':{'id':_0x1a718a[_0xbe73('0x54')]['id']}})[_0xbe73('0x1f')](handleEntityNotFound(_0x48d361,null))[_0xbe73('0x1f')](removeEntity(_0x48d361,null))[_0xbe73('0x28')](handleError(_0x48d361,null));};exports[_0xbe73('0x59')]=function(_0x1993f8,_0x40db78,_0x57d476){var _0x5dd99e={};var _0x39c3b5={};var _0x3ad5d5;var _0x3693d7;return db[_0xbe73('0x3a')]['findOne']({'where':{'id':_0x1993f8[_0xbe73('0x54')]['id']}})['then'](handleEntityNotFound(_0x40db78,null))[_0xbe73('0x1f')](function(_0x1818bd){if(_0x1818bd){_0x3ad5d5=_0x1818bd;_0x39c3b5[_0xbe73('0x3e')]=_[_0xbe73('0x41')](db[_0xbe73('0x5a')][_0xbe73('0x5b')]);_0x39c3b5[_0xbe73('0x40')]=_[_0xbe73('0x41')](_0x1993f8[_0xbe73('0x40')]);_0x39c3b5[_0xbe73('0x42')]=_[_0xbe73('0x44')](_0x39c3b5[_0xbe73('0x3e')],_0x39c3b5[_0xbe73('0x40')]);_0x5dd99e[_0xbe73('0x43')]=_[_0xbe73('0x44')](_0x39c3b5[_0xbe73('0x3e')],qs[_0xbe73('0x45')](_0x1993f8[_0xbe73('0x40')]['fields']));_0x5dd99e['attributes']=_0x5dd99e[_0xbe73('0x43')]['length']?_0x5dd99e['attributes']:_0x39c3b5[_0xbe73('0x3e')];_0x5dd99e['order']=qs[_0xbe73('0x49')](_0x1993f8[_0xbe73('0x40')]['sort']);_0x5dd99e[_0xbe73('0x4c')]=qs[_0xbe73('0x42')](_['pick'](_0x1993f8[_0xbe73('0x40')],_0x39c3b5[_0xbe73('0x42')]));if(_0x1993f8[_0xbe73('0x40')][_0xbe73('0x4b')]){_0x5dd99e['where']=_[_0xbe73('0x4d')](_0x5dd99e[_0xbe73('0x4c')],{'$or':_[_0xbe73('0x3f')](_0x5dd99e[_0xbe73('0x43')],function(_0x2e590f){var _0x526ab0={};_0x526ab0[_0x2e590f]={'$like':'%'+_0x1993f8[_0xbe73('0x40')][_0xbe73('0x4b')]+'%'};return _0x526ab0;})});}_0x5dd99e=_['merge']({},_0x5dd99e,_0x1993f8['options']);return _0x3ad5d5['getConfigurations'](_0x5dd99e);}})[_0xbe73('0x1f')](function(_0x532f48){if(_0x532f48){_0x3693d7=_0x532f48['length'];if(!_0x1993f8[_0xbe73('0x40')]['hasOwnProperty'](_0xbe73('0x47'))){_0x5dd99e[_0xbe73('0x2d')]=qs[_0xbe73('0x2d')](_0x1993f8['query'][_0xbe73('0x2d')]);_0x5dd99e[_0xbe73('0x48')]=qs[_0xbe73('0x48')](_0x1993f8[_0xbe73('0x40')]['offset']);}return _0x3ad5d5[_0xbe73('0x59')](_0x5dd99e);}})[_0xbe73('0x1f')](function(_0xe3d58){if(_0xe3d58){return _0xe3d58?{'count':_0x3693d7,'rows':_0xe3d58}:null;}})['then'](respondWithResult(_0x40db78,null))[_0xbe73('0x28')](handleError(_0x40db78,null));};exports['addConfiguration']=function(_0x5c2569,_0x6d2e41,_0x4c23a7){if(_0x5c2569[_0xbe73('0x58')]['id']){delete _0x5c2569[_0xbe73('0x58')]['id'];}return db[_0xbe73('0x3a')]['findOne']({'where':{'id':_0x5c2569[_0xbe73('0x54')]['id']}})['then'](handleEntityNotFound(_0x6d2e41,null))['then'](function(_0x49e482){if(_0x49e482){_0x5c2569[_0xbe73('0x58')]['AccountId']=_0x49e482['id'];_0x5c2569['body'][_0xbe73('0x5c')]=integrations[_0xbe73('0x5d')](_0x5c2569[_0xbe73('0x58')][_0xbe73('0x5e')],_0x5c2569[_0xbe73('0x58')][_0xbe73('0x3c')]);_0x5c2569[_0xbe73('0x58')][_0xbe73('0x5f')]=integrations['getDescriptions'](_0x5c2569['body'][_0xbe73('0x5e')],_0x5c2569[_0xbe73('0x58')]['type']);return db[_0xbe73('0x5a')]['create'](_0x5c2569['body'],{'include':[{'model':db[_0xbe73('0x60')],'as':'Subjects'},{'model':db[_0xbe73('0x60')],'as':_0xbe73('0x5f')}]});}return null;})[_0xbe73('0x1f')](respondWithResult(_0x6d2e41,null))[_0xbe73('0x28')](handleError(_0x6d2e41,null));};exports['getFields']=function(_0x56ab98,_0x1c4f50,_0x3c67fe){var _0x5e3570='';var _0x361b9d=['id',_0xbe73('0x37'),_0xbe73('0x61'),'created_by','description','date_start',_0xbe73('0x62'),_0xbe73('0x63'),_0xbe73('0x64'),'parent_type',_0xbe73('0x65'),'direction'];return db[_0xbe73('0x3a')][_0xbe73('0x66')]({'where':{'id':_0x56ab98[_0xbe73('0x54')]['id']},'attributes':['id',_0xbe73('0x67'),_0xbe73('0x68'),_0xbe73('0x69')]})[_0xbe73('0x1f')](handleEntityNotFound(_0x1c4f50,null))[_0xbe73('0x1f')](function(_0x2b61b7){if(_0x2b61b7){_0x5e3570=_0x2b61b7[_0xbe73('0x69')];var _0x18a52e=_0x5e3570[_0xbe73('0x6a')](-0x1);if(_0x18a52e==='/'){_0x5e3570=_0x5e3570[_0xbe73('0x6b')](0x0,_0x5e3570[_0xbe73('0x6c')](_0x18a52e));}return rp({'method':_0xbe73('0x6d'),'uri':util['format'](_0xbe73('0x6e'),_0x5e3570,_0xbe73('0x6f')),'json':!![],'form':{'method':_0xbe73('0x70'),'input_type':'JSON','response_type':_0xbe73('0x71'),'rest_data':JSON[_0xbe73('0x22')]({'user_auth':{'user_name':_0x2b61b7[_0xbe73('0x67')],'password':_0x2b61b7[_0xbe73('0x68')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xbe73('0x1f')](function(_0x1aaf0b){if(_0x1aaf0b&&_0x1aaf0b[_0xbe73('0x37')]!==_0xbe73('0x72')&&_0x1aaf0b[_0xbe73('0x37')]!==_0xbe73('0x73')){return rp({'method':_0xbe73('0x6d'),'uri':util[_0xbe73('0x74')]('%s%s',_0x5e3570,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xbe73('0x75'),'input_type':_0xbe73('0x71'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1aaf0b['id'],'module_name':_0xbe73('0x76')})}})[_0xbe73('0x1f')](function(_0x1c9452){if(_0x1c9452){var _0x3b7a2b=_[_0xbe73('0x77')](_0x1c9452[_0xbe73('0x78')]);_[_0xbe73('0x79')](_0x3b7a2b,function(_0x53b231){return _0x361b9d['includes'](_0x53b231[_0xbe73('0x37')]);});return{'count':_0x3b7a2b[_0xbe73('0x46')],'rows':_[_0xbe73('0x3f')](_0x3b7a2b,function(_0x2006ba){return{'id':_0x2006ba[_0xbe73('0x37')],'name':_0x2006ba[_0xbe73('0x7a')],'custom':_[_0xbe73('0x7b')](_0x2006ba['name'],'_c')?!![]:![],'options':_0x2006ba['options']?_[_0xbe73('0x3f')](_[_0xbe73('0x77')](_0x2006ba[_0xbe73('0x4f')]),function(_0x2be430){return{'name':_0x2be430[_0xbe73('0x7c')],'value':_0x2be430[_0xbe73('0x37')]};}):[]};})};}})[_0xbe73('0x1f')](respondWithResult(_0x1c4f50,null))['catch'](function(_0x593f39){var _0x1866c5=_0x56ab98[_0xbe73('0x40')][_0xbe73('0x7d')]?0x1f4:_0x593f39[_0xbe73('0x7e')]||0x1f4;logger[_0xbe73('0x23')](_0xbe73('0x7f'),_0xbe73('0x80'),_0x1866c5,JSON[_0xbe73('0x22')](_0x593f39));delete _0x593f39[_0xbe73('0x37')];if(_0x1866c5===0x191){_0x1866c5=0x190;}_0x1c4f50[_0xbe73('0x29')](_0x1866c5)[_0xbe73('0x38')](_0x56ab98[_0xbe73('0x40')][_0xbe73('0x7d')]?{'message':_0xbe73('0x81'),'statusCode':_0x593f39[_0xbe73('0x7e')]}:_0x593f39);});}else{var _0x40cc56=0x1f4;_0x1c4f50['status'](_0x40cc56)[_0xbe73('0x38')]({'message':_0xbe73('0x81'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb304=['show','params','rawAttributes','include','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_minutes','parent_id','direction','password','remoteUri','slice','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','Invalid\x20Login','Password\x20Expired','POST','Calls','values','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','SugarcrmAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb304,0xaf));var _0x4b30=function(_0x19393d,_0x3f3658){_0x19393d=_0x19393d-0x0;var _0xa9d7f8=_0xb304[_0x19393d];return _0xa9d7f8;};'use strict';var pdf=require(_0x4b30('0x0'));var emlformat=require(_0x4b30('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b30('0x3'));var moment=require(_0x4b30('0x4'));var BPromise=require(_0x4b30('0x5'));var Mustache=require(_0x4b30('0x6'));var util=require(_0x4b30('0x7'));var path=require(_0x4b30('0x8'));var sox=require(_0x4b30('0x9'));var csv=require(_0x4b30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b30('0xb'));var squel=require('squel');var crypto=require(_0x4b30('0xc'));var jsforce=require(_0x4b30('0xd'));var deskjs=require(_0x4b30('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4b30('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b30('0x10'));var authService=require(_0x4b30('0x11'));var qs=require(_0x4b30('0x12'));var as=require(_0x4b30('0x13'));var hardwareService=require(_0x4b30('0x14'));var logger=require(_0x4b30('0x15'))(_0x4b30('0x16'));var utils=require(_0x4b30('0x17'));var config=require(_0x4b30('0x18'));var licenseUtil=require(_0x4b30('0x19'));var db=require(_0x4b30('0x1a'))['db'];var integrations=require(_0x4b30('0x1b'));var jayson=require(_0x4b30('0x1c'));var client=jayson[_0x4b30('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdae598,_0x20b133,_0x27b026,_0x3e4ac3){return new BPromise(function(_0x1ba0fc,_0xc00aa9){var _0x5b8bec=_0x3e4ac3||client;return _0x5b8bec[_0x4b30('0x1e')](_0xdae598,_0x27b026)[_0x4b30('0x1f')](function(_0x5e93b5){logger[_0x4b30('0x20')](_0x4b30('0x21'),_0x20b133,'request\x20sent');logger['debug'](_0x4b30('0x22'),_0x20b133,_0x4b30('0x23'),JSON[_0x4b30('0x24')](_0x5e93b5));if(_0x5e93b5[_0x4b30('0x25')]){if(_0x5e93b5[_0x4b30('0x25')]['code']===0x1f4){logger['error'](_0x4b30('0x21'),_0x20b133,_0x5e93b5['error']['message']);return _0xc00aa9(_0x5e93b5[_0x4b30('0x25')][_0x4b30('0x26')]);}logger[_0x4b30('0x25')]('SugarcrmAccount,\x20%s,\x20%s',_0x20b133,_0x5e93b5['error']['message']);return _0x1ba0fc(_0x5e93b5[_0x4b30('0x25')][_0x4b30('0x26')]);}else{logger[_0x4b30('0x20')](_0x4b30('0x21'),_0x20b133,'request\x20sent');_0x1ba0fc(_0x5e93b5['result'][_0x4b30('0x26')]);}})['catch'](function(_0x34894e){logger[_0x4b30('0x25')](_0x4b30('0x21'),_0x20b133,_0x34894e);_0xc00aa9(_0x34894e);});});}function respondWithStatusCode(_0xc11f04,_0x491f97){_0x491f97=_0x491f97||0xcc;return function(_0x50e1e1){if(_0x50e1e1){return _0xc11f04[_0x4b30('0x27')](_0x491f97);}return _0xc11f04[_0x4b30('0x28')](_0x491f97)[_0x4b30('0x29')]();};}function respondWithResult(_0x6f345a,_0x471cbb){_0x471cbb=_0x471cbb||0xc8;return function(_0x5d4852){if(_0x5d4852){return _0x6f345a[_0x4b30('0x28')](_0x471cbb)[_0x4b30('0x2a')](_0x5d4852);}};}function respondWithFilteredResult(_0x2f021d,_0x4967eb){return function(_0x46d43e){if(_0x46d43e){var _0xaa6cb6=_0x46d43e[_0x4b30('0x2b')],_0x35806a=_0x4967eb[_0x4b30('0x2c')],_0x5442f8=_0x4967eb[_0x4b30('0x2c')]+_0x4967eb['limit'],_0xccb784;if(_0x5442f8>=_0xaa6cb6){_0x5442f8=_0xaa6cb6;_0xccb784=0xc8;}else{_0xccb784=0xce;}_0x2f021d[_0x4b30('0x28')](_0xccb784);return _0x2f021d[_0x4b30('0x2d')](_0x4b30('0x2e'),_0x35806a+'-'+_0x5442f8+'/'+_0xaa6cb6)['json'](_0x46d43e);}return null;};}function patchUpdates(_0x1f016d){return function(_0xb9792b){try{jsonpatch[_0x4b30('0x2f')](_0xb9792b,_0x1f016d,!![]);}catch(_0x1308ed){return BPromise[_0x4b30('0x30')](_0x1308ed);}return _0xb9792b[_0x4b30('0x31')]();};}function saveUpdates(_0x33d332,_0x11c5b0){return function(_0x2554b3){if(_0x2554b3){return _0x2554b3[_0x4b30('0x32')](_0x33d332)['then'](function(_0x255d1d){return _0x255d1d;});}return null;};}function removeEntity(_0x50b0ef,_0x3a723c){return function(_0x2dc77b){if(_0x2dc77b){return _0x2dc77b[_0x4b30('0x33')]()[_0x4b30('0x1f')](function(){_0x50b0ef[_0x4b30('0x28')](0xcc)[_0x4b30('0x29')]();});}};}function handleEntityNotFound(_0x2f5c1e,_0x271513){return function(_0x10748e){if(!_0x10748e){_0x2f5c1e['sendStatus'](0x194);}return _0x10748e;};}function handleError(_0x5ede73,_0x1a2c0c){_0x1a2c0c=_0x1a2c0c||0x1f4;return function(_0x259636){logger[_0x4b30('0x25')](_0x259636['stack']);if(_0x259636[_0x4b30('0x34')]){delete _0x259636['name'];}_0x5ede73[_0x4b30('0x28')](_0x1a2c0c)[_0x4b30('0x35')](_0x259636);};}exports['index']=function(_0x245275,_0x298282){var _0x5a2815={},_0x46c4b5={},_0x584a24={'count':0x0,'rows':[]};var _0x109d64=_[_0x4b30('0x36')](db[_0x4b30('0x37')]['rawAttributes'],function(_0x25ab80){return{'name':_0x25ab80[_0x4b30('0x38')],'type':_0x25ab80['type'][_0x4b30('0x39')]};});_0x46c4b5['model']=_[_0x4b30('0x36')](_0x109d64,_0x4b30('0x34'));_0x46c4b5[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x245275[_0x4b30('0x3a')]);_0x46c4b5[_0x4b30('0x3c')]=_[_0x4b30('0x3d')](_0x46c4b5['model'],_0x46c4b5[_0x4b30('0x3a')]);_0x5a2815['attributes']=_['intersection'](_0x46c4b5[_0x4b30('0x3e')],qs[_0x4b30('0x3f')](_0x245275[_0x4b30('0x3a')][_0x4b30('0x3f')]));_0x5a2815[_0x4b30('0x40')]=_0x5a2815[_0x4b30('0x40')][_0x4b30('0x41')]?_0x5a2815[_0x4b30('0x40')]:_0x46c4b5['model'];if(!_0x245275[_0x4b30('0x3a')]['hasOwnProperty'](_0x4b30('0x42'))){_0x5a2815[_0x4b30('0x43')]=qs[_0x4b30('0x43')](_0x245275[_0x4b30('0x3a')][_0x4b30('0x43')]);_0x5a2815['offset']=qs['offset'](_0x245275[_0x4b30('0x3a')]['offset']);}_0x5a2815['order']=qs[_0x4b30('0x44')](_0x245275['query'][_0x4b30('0x44')]);_0x5a2815['where']=qs[_0x4b30('0x3c')](_[_0x4b30('0x45')](_0x245275[_0x4b30('0x3a')],_0x46c4b5[_0x4b30('0x3c')]),_0x109d64);if(_0x245275[_0x4b30('0x3a')]['filter']){_0x5a2815[_0x4b30('0x46')]=_[_0x4b30('0x47')](_0x5a2815['where'],{'$or':_[_0x4b30('0x36')](_0x109d64,function(_0x3ba95a){if(_0x3ba95a[_0x4b30('0x48')]!==_0x4b30('0x49')){var _0x3aad7a={};_0x3aad7a[_0x3ba95a[_0x4b30('0x34')]]={'$like':'%'+_0x245275[_0x4b30('0x3a')][_0x4b30('0x4a')]+'%'};return _0x3aad7a;}})});}_0x5a2815=_[_0x4b30('0x47')]({},_0x5a2815,_0x245275[_0x4b30('0x4b')]);var _0x4e7970={'where':_0x5a2815['where']};return db[_0x4b30('0x37')][_0x4b30('0x2b')](_0x4e7970)[_0x4b30('0x1f')](function(_0x204777){_0x584a24['count']=_0x204777;if(_0x245275[_0x4b30('0x3a')][_0x4b30('0x4c')]){_0x5a2815['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x4b30('0x4d')](_0x5a2815);})['then'](function(_0x88b21b){_0x584a24['rows']=_0x88b21b;return _0x584a24;})[_0x4b30('0x1f')](respondWithFilteredResult(_0x298282,_0x5a2815))[_0x4b30('0x4e')](handleError(_0x298282,null));};exports[_0x4b30('0x4f')]=function(_0x5ee562,_0x208c28){var _0x48be4d={'raw':![],'where':{'id':_0x5ee562[_0x4b30('0x50')]['id']}},_0x1fa25b={};_0x1fa25b[_0x4b30('0x3e')]=_[_0x4b30('0x3b')](db['SugarcrmAccount'][_0x4b30('0x51')]);_0x1fa25b[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x5ee562[_0x4b30('0x3a')]);_0x1fa25b['filters']=_[_0x4b30('0x3d')](_0x1fa25b[_0x4b30('0x3e')],_0x1fa25b[_0x4b30('0x3a')]);_0x48be4d[_0x4b30('0x40')]=_[_0x4b30('0x3d')](_0x1fa25b[_0x4b30('0x3e')],qs[_0x4b30('0x3f')](_0x5ee562[_0x4b30('0x3a')]['fields']));_0x48be4d[_0x4b30('0x40')]=_0x48be4d[_0x4b30('0x40')][_0x4b30('0x41')]?_0x48be4d[_0x4b30('0x40')]:_0x1fa25b[_0x4b30('0x3e')];if(_0x5ee562['query'][_0x4b30('0x4c')]){_0x48be4d[_0x4b30('0x52')]=[{'all':!![]}];}_0x48be4d=_[_0x4b30('0x47')]({},_0x48be4d,_0x5ee562[_0x4b30('0x4b')]);return db[_0x4b30('0x37')]['find'](_0x48be4d)[_0x4b30('0x1f')](handleEntityNotFound(_0x208c28,null))[_0x4b30('0x1f')](respondWithResult(_0x208c28,null))[_0x4b30('0x4e')](handleError(_0x208c28,null));};exports[_0x4b30('0x53')]=function(_0x36dae3,_0x13b433){return db['SugarcrmAccount'][_0x4b30('0x53')](_0x36dae3['body'],{})[_0x4b30('0x1f')](respondWithResult(_0x13b433,0xc9))[_0x4b30('0x4e')](handleError(_0x13b433,null));};exports[_0x4b30('0x32')]=function(_0x5cd922,_0x156f9b){if(_0x5cd922[_0x4b30('0x54')]['id']){delete _0x5cd922[_0x4b30('0x54')]['id'];}return db[_0x4b30('0x37')][_0x4b30('0x55')]({'where':{'id':_0x5cd922['params']['id']}})[_0x4b30('0x1f')](handleEntityNotFound(_0x156f9b,null))[_0x4b30('0x1f')](saveUpdates(_0x5cd922[_0x4b30('0x54')],null))[_0x4b30('0x1f')](respondWithResult(_0x156f9b,null))[_0x4b30('0x4e')](handleError(_0x156f9b,null));};exports[_0x4b30('0x33')]=function(_0x5dc8a8,_0x2d9dc4){return db['SugarcrmAccount'][_0x4b30('0x55')]({'where':{'id':_0x5dc8a8[_0x4b30('0x50')]['id']}})[_0x4b30('0x1f')](handleEntityNotFound(_0x2d9dc4,null))[_0x4b30('0x1f')](removeEntity(_0x2d9dc4,null))['catch'](handleError(_0x2d9dc4,null));};exports[_0x4b30('0x56')]=function(_0xd48fb0,_0x3d9450,_0x323395){var _0x5c0d09={};var _0x378115={};var _0x2e808b;var _0x20450a;return db[_0x4b30('0x37')][_0x4b30('0x57')]({'where':{'id':_0xd48fb0[_0x4b30('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d9450,null))[_0x4b30('0x1f')](function(_0x479be5){if(_0x479be5){_0x2e808b=_0x479be5;_0x378115[_0x4b30('0x3e')]=_[_0x4b30('0x3b')](db[_0x4b30('0x58')][_0x4b30('0x51')]);_0x378115[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0xd48fb0[_0x4b30('0x3a')]);_0x378115[_0x4b30('0x3c')]=_[_0x4b30('0x3d')](_0x378115[_0x4b30('0x3e')],_0x378115[_0x4b30('0x3a')]);_0x5c0d09[_0x4b30('0x40')]=_['intersection'](_0x378115[_0x4b30('0x3e')],qs['fields'](_0xd48fb0['query'][_0x4b30('0x3f')]));_0x5c0d09[_0x4b30('0x40')]=_0x5c0d09[_0x4b30('0x40')][_0x4b30('0x41')]?_0x5c0d09[_0x4b30('0x40')]:_0x378115[_0x4b30('0x3e')];_0x5c0d09[_0x4b30('0x59')]=qs[_0x4b30('0x44')](_0xd48fb0[_0x4b30('0x3a')]['sort']);_0x5c0d09[_0x4b30('0x46')]=qs['filters'](_['pick'](_0xd48fb0[_0x4b30('0x3a')],_0x378115[_0x4b30('0x3c')]));if(_0xd48fb0[_0x4b30('0x3a')][_0x4b30('0x4a')]){_0x5c0d09['where']=_[_0x4b30('0x47')](_0x5c0d09['where'],{'$or':_['map'](_0x5c0d09['attributes'],function(_0x41528b){var _0x422f0f={};_0x422f0f[_0x41528b]={'$like':'%'+_0xd48fb0[_0x4b30('0x3a')][_0x4b30('0x4a')]+'%'};return _0x422f0f;})});}_0x5c0d09=_[_0x4b30('0x47')]({},_0x5c0d09,_0xd48fb0[_0x4b30('0x4b')]);return _0x2e808b[_0x4b30('0x56')](_0x5c0d09);}})[_0x4b30('0x1f')](function(_0x468ac0){if(_0x468ac0){_0x20450a=_0x468ac0[_0x4b30('0x41')];if(!_0xd48fb0[_0x4b30('0x3a')][_0x4b30('0x5a')](_0x4b30('0x42'))){_0x5c0d09[_0x4b30('0x43')]=qs[_0x4b30('0x43')](_0xd48fb0[_0x4b30('0x3a')][_0x4b30('0x43')]);_0x5c0d09['offset']=qs[_0x4b30('0x2c')](_0xd48fb0[_0x4b30('0x3a')][_0x4b30('0x2c')]);}return _0x2e808b[_0x4b30('0x56')](_0x5c0d09);}})['then'](function(_0x3bf050){if(_0x3bf050){return _0x3bf050?{'count':_0x20450a,'rows':_0x3bf050}:null;}})[_0x4b30('0x1f')](respondWithResult(_0x3d9450,null))[_0x4b30('0x4e')](handleError(_0x3d9450,null));};exports['addConfiguration']=function(_0x5dad60,_0x3ae0fe,_0x590b37){if(_0x5dad60[_0x4b30('0x54')]['id']){delete _0x5dad60[_0x4b30('0x54')]['id'];}return db['SugarcrmAccount'][_0x4b30('0x57')]({'where':{'id':_0x5dad60[_0x4b30('0x50')]['id']}})[_0x4b30('0x1f')](handleEntityNotFound(_0x3ae0fe,null))[_0x4b30('0x1f')](function(_0x5300f9){if(_0x5300f9){_0x5dad60['body']['AccountId']=_0x5300f9['id'];_0x5dad60['body'][_0x4b30('0x5b')]=integrations[_0x4b30('0x5c')](_0x5dad60['body'][_0x4b30('0x5d')],_0x5dad60[_0x4b30('0x54')][_0x4b30('0x48')]);_0x5dad60[_0x4b30('0x54')][_0x4b30('0x5e')]=integrations[_0x4b30('0x5f')](_0x5dad60['body'][_0x4b30('0x5d')],_0x5dad60['body'][_0x4b30('0x48')]);return db[_0x4b30('0x58')]['create'](_0x5dad60[_0x4b30('0x54')],{'include':[{'model':db[_0x4b30('0x60')],'as':_0x4b30('0x5b')},{'model':db[_0x4b30('0x60')],'as':_0x4b30('0x5e')}]});}return null;})[_0x4b30('0x1f')](respondWithResult(_0x3ae0fe,null))[_0x4b30('0x4e')](handleError(_0x3ae0fe,null));};exports[_0x4b30('0x61')]=function(_0x2250fa,_0x4c11d2,_0x8fe00d){var _0x117972='';var _0x1f3422=['id','name',_0x4b30('0x62'),'created_by',_0x4b30('0x63'),_0x4b30('0x64'),'duration_hours',_0x4b30('0x65'),_0x4b30('0x66'),'parent_type','parent_name',_0x4b30('0x67')];return db['SugarcrmAccount'][_0x4b30('0x57')]({'where':{'id':_0x2250fa[_0x4b30('0x50')]['id']},'attributes':['id','username',_0x4b30('0x68'),'remoteUri']})[_0x4b30('0x1f')](handleEntityNotFound(_0x4c11d2,null))[_0x4b30('0x1f')](function(_0x53e01a){if(_0x53e01a){_0x117972=_0x53e01a[_0x4b30('0x69')];var _0x4b6da7=_0x117972[_0x4b30('0x6a')](-0x1);if(_0x4b6da7==='/'){_0x117972=_0x117972['substring'](0x0,_0x117972['lastIndexOf'](_0x4b6da7));}return rp({'method':'POST','uri':util[_0x4b30('0x6b')](_0x4b30('0x6c'),_0x117972,_0x4b30('0x6d')),'json':!![],'form':{'method':'login','input_type':_0x4b30('0x6e'),'response_type':'JSON','rest_data':JSON[_0x4b30('0x24')]({'user_auth':{'user_name':_0x53e01a[_0x4b30('0x6f')],'password':_0x53e01a[_0x4b30('0x68')],'encryption':_0x4b30('0x70')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x4b30('0x1f')](function(_0x61b5d0){if(_0x61b5d0&&_0x61b5d0[_0x4b30('0x34')]!==_0x4b30('0x71')&&_0x61b5d0[_0x4b30('0x34')]!==_0x4b30('0x72')){return rp({'method':_0x4b30('0x73'),'uri':util[_0x4b30('0x6b')]('%s%s',_0x117972,_0x4b30('0x6d')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x4b30('0x6e'),'response_type':'JSON','rest_data':JSON[_0x4b30('0x24')]({'session':_0x61b5d0['id'],'module_name':_0x4b30('0x74')})}})[_0x4b30('0x1f')](function(_0x418851){if(_0x418851){var _0x23119c=_[_0x4b30('0x75')](_0x418851['module_fields']);_[_0x4b30('0x76')](_0x23119c,function(_0x4249e4){return _0x1f3422[_0x4b30('0x77')](_0x4249e4[_0x4b30('0x34')]);});return{'count':_0x23119c[_0x4b30('0x41')],'rows':_['map'](_0x23119c,function(_0x20c3c6){return{'id':_0x20c3c6[_0x4b30('0x34')],'name':_0x20c3c6[_0x4b30('0x78')],'custom':_[_0x4b30('0x79')](_0x20c3c6[_0x4b30('0x34')],'_c')?!![]:![],'options':_0x20c3c6[_0x4b30('0x4b')]?_[_0x4b30('0x36')](_[_0x4b30('0x75')](_0x20c3c6[_0x4b30('0x4b')]),function(_0xaca075){return{'name':_0xaca075[_0x4b30('0x7a')],'value':_0xaca075[_0x4b30('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x4c11d2,null))[_0x4b30('0x4e')](function(_0x12383d){var _0x2cb8a7=_0x2250fa[_0x4b30('0x3a')]['test']?0x1f4:_0x12383d[_0x4b30('0x7b')]||0x1f4;logger[_0x4b30('0x25')](_0x4b30('0x7c'),_0x4b30('0x61'),_0x2cb8a7,JSON[_0x4b30('0x24')](_0x12383d));delete _0x12383d[_0x4b30('0x34')];if(_0x2cb8a7===0x191){_0x2cb8a7=0x190;}_0x4c11d2[_0x4b30('0x28')](_0x2cb8a7)[_0x4b30('0x35')](_0x2250fa[_0x4b30('0x3a')][_0x4b30('0x7d')]?{'message':_0x4b30('0x7e'),'statusCode':_0x12383d['statusCode']}:_0x12383d);});}else{var _0x55e9b1=0x1f4;_0x4c11d2[_0x4b30('0x28')](_0x55e9b1)[_0x4b30('0x35')]({'message':_0x4b30('0x7e'),'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 dcf4505..e05d5e1 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 _0xe523=['rimraf','../../config/environment','../../components/integrations/configuration','exports','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0xe523,0x170));var _0x3e52=function(_0x44059a,_0x893209){_0x44059a=_0x44059a-0x0;var _0x144e66=_0xe523[_0x44059a];return _0x144e66;};'use strict';var _=require(_0x3e52('0x0'));var util=require(_0x3e52('0x1'));var logger=require(_0x3e52('0x2'))('api');var moment=require(_0x3e52('0x3'));var BPromise=require(_0x3e52('0x4'));var rp=require(_0x3e52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e52('0x6'));var config=require(_0x3e52('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x3e52('0x8'));module[_0x3e52('0x9')]=function(_0x313cf8,_0x31edf4){return _0x313cf8['define']('SugarcrmAccount',attributes,{'tableName':_0x3e52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x527b=['moment','path','rimraf','../../components/integrations/configuration','lodash','util','../../config/logger','api'];(function(_0x5e03fd,_0x35211f){var _0x5d9677=function(_0x36f8da){while(--_0x36f8da){_0x5e03fd['push'](_0x5e03fd['shift']());}};_0x5d9677(++_0x35211f);}(_0x527b,0xac));var _0xb527=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x527b[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0xb527('0x0'));var util=require(_0xb527('0x1'));var logger=require(_0xb527('0x2'))(_0xb527('0x3'));var moment=require(_0xb527('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb527('0x5'));var rimraf=require(_0xb527('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xb527('0x7'));module['exports']=function(_0x4375ca,_0x5d3f69){return _0x4375ca['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 33b6095..e26f244 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 _0xc831=['ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','GetSugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','SugarcrmAccount','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc831,0x173));var _0x1c83=function(_0x959dfc,_0x241dd5){_0x959dfc=_0x959dfc-0x0;var _0x14cdd7=_0xc831[_0x959dfc];return _0x14cdd7;};'use strict';var _=require(_0x1c83('0x0'));var util=require(_0x1c83('0x1'));var moment=require('moment');var BPromise=require(_0x1c83('0x2'));var rs=require(_0x1c83('0x3'));var fs=require('fs');var Redis=require(_0x1c83('0x4'));var db=require(_0x1c83('0x5'))['db'];var utils=require(_0x1c83('0x6'));var logger=require(_0x1c83('0x7'))(_0x1c83('0x8'));var config=require(_0x1c83('0x9'));var jayson=require(_0x1c83('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d8933,_0x4675a4,_0x3483bc){return new BPromise(function(_0x375908,_0x233ccc){return client[_0x1c83('0xb')](_0x4d8933,_0x3483bc)[_0x1c83('0xc')](function(_0x4d1ab5){logger[_0x1c83('0xd')](_0x1c83('0xe'),_0x4675a4,_0x1c83('0xf'));logger[_0x1c83('0x10')](_0x1c83('0x11'),_0x4675a4,_0x1c83('0xf'),JSON[_0x1c83('0x12')](_0x4d1ab5));if(_0x4d1ab5[_0x1c83('0x13')]){if(_0x4d1ab5[_0x1c83('0x13')][_0x1c83('0x14')]===0x1f4){logger[_0x1c83('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4675a4,_0x4d1ab5[_0x1c83('0x13')]['message']);return _0x233ccc(_0x4d1ab5[_0x1c83('0x13')]['message']);}logger[_0x1c83('0x13')](_0x1c83('0xe'),_0x4675a4,_0x4d1ab5[_0x1c83('0x13')]['message']);return _0x375908(_0x4d1ab5[_0x1c83('0x13')]['message']);}else{logger[_0x1c83('0xd')](_0x1c83('0xe'),_0x4675a4,'request\x20sent');_0x375908(_0x4d1ab5[_0x1c83('0x15')][_0x1c83('0x16')]);}})['catch'](function(_0x472624){logger[_0x1c83('0x13')](_0x1c83('0xe'),_0x4675a4,_0x472624);_0x233ccc(_0x472624);});});}exports[_0x1c83('0x17')]=function(_0xaff3d2){var _0x2fc55c=this;return new Promise(function(_0x56da48,_0x3084e9){return db['SugarcrmAccount'][_0x1c83('0x18')]({'raw':_0xaff3d2[_0x1c83('0x19')]?_0xaff3d2[_0x1c83('0x19')][_0x1c83('0x1a')]===undefined?!![]:![]:!![],'where':_0xaff3d2[_0x1c83('0x19')]?_0xaff3d2[_0x1c83('0x19')][_0x1c83('0x1b')]||null:null,'attributes':_0xaff3d2[_0x1c83('0x19')]?_0xaff3d2[_0x1c83('0x19')]['attributes']||null:null,'limit':_0xaff3d2[_0x1c83('0x19')]?_0xaff3d2['options'][_0x1c83('0x1c')]||null:null,'include':_0xaff3d2[_0x1c83('0x19')]?_0xaff3d2[_0x1c83('0x19')][_0x1c83('0x1d')]?_[_0x1c83('0x1e')](_0xaff3d2['options'][_0x1c83('0x1d')],function(_0x4d415b){return{'model':db[_0x4d415b[_0x1c83('0x1f')]],'as':_0x4d415b['as'],'attributes':_0x4d415b[_0x1c83('0x20')],'include':_0x4d415b[_0x1c83('0x1d')]?_[_0x1c83('0x1e')](_0x4d415b['include'],function(_0x358400){return{'model':db[_0x358400[_0x1c83('0x1f')]],'as':_0x358400['as'],'attributes':_0x358400[_0x1c83('0x20')],'include':_0x358400['include']?_['map'](_0x358400['include'],function(_0x4d68f3){return{'model':db[_0x4d68f3[_0x1c83('0x1f')]],'as':_0x4d68f3['as'],'attributes':_0x4d68f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c83('0xc')](function(_0x3883d3){logger[_0x1c83('0xd')](_0x1c83('0x17'),_0xaff3d2);logger['debug'](_0x1c83('0x17'),_0xaff3d2,JSON['stringify'](_0x3883d3));_0x56da48(_0x3883d3);})[_0x1c83('0x21')](function(_0xf5101b){logger['error'](_0x1c83('0x17'),_0xf5101b[_0x1c83('0x16')],_0xaff3d2);_0x3084e9(_0x2fc55c[_0x1c83('0x13')](0x1f4,_0xf5101b[_0x1c83('0x16')]));});});};exports['ShowSugarcrmAccount']=function(_0x2e7e05){var _0x5ba246=this;return new Promise(function(_0x41fa7d,_0x3e5546){return db[_0x1c83('0x22')][_0x1c83('0x23')]({'raw':_0x2e7e05[_0x1c83('0x19')]?_0x2e7e05[_0x1c83('0x19')][_0x1c83('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e7e05['options']?_0x2e7e05[_0x1c83('0x19')]['where']||null:null,'attributes':_0x2e7e05[_0x1c83('0x19')]?_0x2e7e05[_0x1c83('0x19')][_0x1c83('0x20')]||null:null,'include':_0x2e7e05[_0x1c83('0x19')]?_0x2e7e05[_0x1c83('0x19')][_0x1c83('0x1d')]?_['map'](_0x2e7e05[_0x1c83('0x19')][_0x1c83('0x1d')],function(_0x10c09f){return{'model':db[_0x10c09f[_0x1c83('0x1f')]],'as':_0x10c09f['as'],'attributes':_0x10c09f[_0x1c83('0x20')],'include':_0x10c09f[_0x1c83('0x1d')]?_[_0x1c83('0x1e')](_0x10c09f[_0x1c83('0x1d')],function(_0x47b69a){return{'model':db[_0x47b69a[_0x1c83('0x1f')]],'as':_0x47b69a['as'],'attributes':_0x47b69a['attributes'],'include':_0x47b69a[_0x1c83('0x1d')]?_['map'](_0x47b69a[_0x1c83('0x1d')],function(_0x2dca43){return{'model':db[_0x2dca43[_0x1c83('0x1f')]],'as':_0x2dca43['as'],'attributes':_0x2dca43[_0x1c83('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1c83('0xc')](function(_0x5aafda){logger['info']('ShowSugarcrmAccount',_0x2e7e05);logger[_0x1c83('0x10')](_0x1c83('0x24'),_0x2e7e05,JSON[_0x1c83('0x12')](_0x5aafda));_0x41fa7d(_0x5aafda);})['catch'](function(_0x2f4fe8){logger[_0x1c83('0x13')]('ShowSugarcrmAccount',_0x2f4fe8['message'],_0x2e7e05);_0x3e5546(_0x5ba246[_0x1c83('0x13')](0x1f4,_0x2f4fe8[_0x1c83('0x16')]));});});}; \ No newline at end of file +var _0x67f3=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','include','model','ShowSugarcrmAccount','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4b3a3,_0xaa5739){var _0x364df1=function(_0x317713){while(--_0x317713){_0x4b3a3['push'](_0x4b3a3['shift']());}};_0x364df1(++_0xaa5739);}(_0x67f3,0xab));var _0x367f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x67f3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x367f('0x0'));var util=require(_0x367f('0x1'));var moment=require(_0x367f('0x2'));var BPromise=require(_0x367f('0x3'));var rs=require(_0x367f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x367f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x367f('0x6'))('rpc');var config=require(_0x367f('0x7'));var jayson=require(_0x367f('0x8'));var client=jayson[_0x367f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b217d,_0x463292,_0x492ddb){return new BPromise(function(_0x4ba202,_0x560f4d){return client[_0x367f('0xa')](_0x2b217d,_0x492ddb)[_0x367f('0xb')](function(_0x31a943){logger[_0x367f('0xc')](_0x367f('0xd'),_0x463292,'request\x20sent');logger[_0x367f('0xe')](_0x367f('0xf'),_0x463292,_0x367f('0x10'),JSON[_0x367f('0x11')](_0x31a943));if(_0x31a943[_0x367f('0x12')]){if(_0x31a943[_0x367f('0x12')][_0x367f('0x13')]===0x1f4){logger[_0x367f('0x12')](_0x367f('0xd'),_0x463292,_0x31a943['error'][_0x367f('0x14')]);return _0x560f4d(_0x31a943[_0x367f('0x12')][_0x367f('0x14')]);}logger[_0x367f('0x12')](_0x367f('0xd'),_0x463292,_0x31a943[_0x367f('0x12')][_0x367f('0x14')]);return _0x4ba202(_0x31a943[_0x367f('0x12')][_0x367f('0x14')]);}else{logger[_0x367f('0xc')](_0x367f('0xd'),_0x463292,_0x367f('0x10'));_0x4ba202(_0x31a943[_0x367f('0x15')][_0x367f('0x14')]);}})[_0x367f('0x16')](function(_0x51938a){logger['error'](_0x367f('0xd'),_0x463292,_0x51938a);_0x560f4d(_0x51938a);});});}exports[_0x367f('0x17')]=function(_0x214f64){var _0x425fba=this;return new Promise(function(_0x1cded7,_0x49cf55){return db[_0x367f('0x18')][_0x367f('0x19')]({'raw':_0x214f64[_0x367f('0x1a')]?_0x214f64['options']['raw']===undefined?!![]:![]:!![],'where':_0x214f64[_0x367f('0x1a')]?_0x214f64[_0x367f('0x1a')]['where']||null:null,'attributes':_0x214f64[_0x367f('0x1a')]?_0x214f64['options'][_0x367f('0x1b')]||null:null,'limit':_0x214f64[_0x367f('0x1a')]?_0x214f64[_0x367f('0x1a')]['limit']||null:null,'include':_0x214f64[_0x367f('0x1a')]?_0x214f64[_0x367f('0x1a')]['include']?_['map'](_0x214f64[_0x367f('0x1a')][_0x367f('0x1c')],function(_0x24475c){return{'model':db[_0x24475c[_0x367f('0x1d')]],'as':_0x24475c['as'],'attributes':_0x24475c[_0x367f('0x1b')],'include':_0x24475c[_0x367f('0x1c')]?_['map'](_0x24475c['include'],function(_0x2e9f8a){return{'model':db[_0x2e9f8a['model']],'as':_0x2e9f8a['as'],'attributes':_0x2e9f8a[_0x367f('0x1b')],'include':_0x2e9f8a[_0x367f('0x1c')]?_['map'](_0x2e9f8a['include'],function(_0xca12a6){return{'model':db[_0xca12a6[_0x367f('0x1d')]],'as':_0xca12a6['as'],'attributes':_0xca12a6['attributes']};}):[]};}):[]};}):[]:[]})[_0x367f('0xb')](function(_0x384a4e){logger[_0x367f('0xc')](_0x367f('0x17'),_0x214f64);logger[_0x367f('0xe')](_0x367f('0x17'),_0x214f64,JSON[_0x367f('0x11')](_0x384a4e));_0x1cded7(_0x384a4e);})['catch'](function(_0x27bb45){logger[_0x367f('0x12')]('GetSugarcrmAccount',_0x27bb45[_0x367f('0x14')],_0x214f64);_0x49cf55(_0x425fba['error'](0x1f4,_0x27bb45['message']));});});};exports[_0x367f('0x1e')]=function(_0x33ab2f){var _0x5a887f=this;return new Promise(function(_0x6848be,_0x543ac5){return db[_0x367f('0x18')]['find']({'raw':_0x33ab2f[_0x367f('0x1a')]?_0x33ab2f[_0x367f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33ab2f[_0x367f('0x1a')]?_0x33ab2f[_0x367f('0x1a')]['where']||null:null,'attributes':_0x33ab2f[_0x367f('0x1a')]?_0x33ab2f[_0x367f('0x1a')][_0x367f('0x1b')]||null:null,'include':_0x33ab2f[_0x367f('0x1a')]?_0x33ab2f['options'][_0x367f('0x1c')]?_[_0x367f('0x1f')](_0x33ab2f[_0x367f('0x1a')][_0x367f('0x1c')],function(_0x457ba6){return{'model':db[_0x457ba6[_0x367f('0x1d')]],'as':_0x457ba6['as'],'attributes':_0x457ba6[_0x367f('0x1b')],'include':_0x457ba6[_0x367f('0x1c')]?_[_0x367f('0x1f')](_0x457ba6[_0x367f('0x1c')],function(_0xb22fc3){return{'model':db[_0xb22fc3[_0x367f('0x1d')]],'as':_0xb22fc3['as'],'attributes':_0xb22fc3[_0x367f('0x1b')],'include':_0xb22fc3[_0x367f('0x1c')]?_[_0x367f('0x1f')](_0xb22fc3['include'],function(_0x3a1bad){return{'model':db[_0x3a1bad[_0x367f('0x1d')]],'as':_0x3a1bad['as'],'attributes':_0x3a1bad[_0x367f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x367f('0xb')](function(_0x4decbb){logger['info'](_0x367f('0x1e'),_0x33ab2f);logger[_0x367f('0xe')]('ShowSugarcrmAccount',_0x33ab2f,JSON[_0x367f('0x11')](_0x4decbb));_0x6848be(_0x4decbb);})[_0x367f('0x16')](function(_0x58065f){logger[_0x367f('0x12')](_0x367f('0x1e'),_0x58065f[_0x367f('0x14')],_0x33ab2f);_0x543ac5(_0x5a887f[_0x367f('0x12')](0x1f4,_0x58065f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e2520b7..adf9463 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 _0x04db=['getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x5c0d95,_0xccce88){var _0x5ee6fd=function(_0x3f6d5f){while(--_0x3f6d5f){_0x5c0d95['push'](_0x5c0d95['shift']());}};_0x5ee6fd(++_0xccce88);}(_0x04db,0x149));var _0xb04d=function(_0xbb1fb8,_0x302408){_0xbb1fb8=_0xbb1fb8-0x0;var _0x36c531=_0x04db[_0xbb1fb8];return _0x36c531;};'use strict';var multer=require('multer');var util=require(_0xb04d('0x0'));var path=require('path');var timeout=require(_0xb04d('0x1'));var express=require(_0xb04d('0x2'));var router=express[_0xb04d('0x3')]();var auth=require(_0xb04d('0x4'));var interaction=require(_0xb04d('0x5'));var config=require(_0xb04d('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xb04d('0x7')](),controller['index']);router[_0xb04d('0x8')](_0xb04d('0x9'),auth['isAuthenticated'](),controller[_0xb04d('0xa')]);router[_0xb04d('0x8')]('/:id/fields',auth[_0xb04d('0x7')](),controller[_0xb04d('0xb')]);router[_0xb04d('0x8')](_0xb04d('0xc'),auth[_0xb04d('0x7')](),controller[_0xb04d('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb04d('0xe')]);router[_0xb04d('0xf')]('/',auth[_0xb04d('0x7')](),controller[_0xb04d('0x10')]);router[_0xb04d('0x11')](_0xb04d('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb04d('0x9'),auth[_0xb04d('0x7')](),controller[_0xb04d('0x12')]);module[_0xb04d('0x13')]=router; \ No newline at end of file +var _0xe04f=['show','/:id/fields','getFields','/:id/subjects','get','/:id/descriptions','getDescriptions','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index','isAuthenticated'];(function(_0x1a0158,_0x184e0d){var _0x1ab2fe=function(_0x2215c1){while(--_0x2215c1){_0x1a0158['push'](_0x1a0158['shift']());}};_0x1ab2fe(++_0x184e0d);}(_0xe04f,0x1e2));var _0xfe04=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xe04f[_0x283127];return _0x43da5d;};'use strict';var multer=require(_0xfe04('0x0'));var util=require(_0xfe04('0x1'));var path=require(_0xfe04('0x2'));var timeout=require(_0xfe04('0x3'));var express=require(_0xfe04('0x4'));var router=express[_0xfe04('0x5')]();var auth=require(_0xfe04('0x6'));var interaction=require(_0xfe04('0x7'));var config=require(_0xfe04('0x8'));var controller=require(_0xfe04('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe04('0xa')]);router['get']('/:id',auth[_0xfe04('0xb')](),controller[_0xfe04('0xc')]);router['get'](_0xfe04('0xd'),auth['isAuthenticated'](),controller[_0xfe04('0xe')]);router['get'](_0xfe04('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xfe04('0x10')](_0xfe04('0x11'),auth['isAuthenticated'](),controller[_0xfe04('0x12')]);router[_0xfe04('0x13')]('/',auth['isAuthenticated'](),controller[_0xfe04('0x14')]);router[_0xfe04('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfe04('0x16')](_0xfe04('0x17'),auth[_0xfe04('0xb')](),controller[_0xfe04('0x18')]);module[_0xfe04('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 2b2c1a6..eb711e5 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 _0xa8db=['exports','STRING'];(function(_0x38d1c1,_0x5bd327){var _0x4535d9=function(_0x1a5715){while(--_0x1a5715){_0x38d1c1['push'](_0x38d1c1['shift']());}};_0x4535d9(++_0x5bd327);}(_0xa8db,0x6a));var _0xba8d=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xa8db[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require('sequelize');module[_0xba8d('0x0')]={'name':{'type':Sequelize[_0xba8d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0572=['exports','STRING'];(function(_0x3563cd,_0x20f9d1){var _0x28961d=function(_0x56eb88){while(--_0x56eb88){_0x3563cd['push'](_0x3563cd['shift']());}};_0x28961d(++_0x20f9d1);}(_0x0572,0x1a0));var _0x2057=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0572[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x2057('0x0')]={'name':{'type':Sequelize[_0x2057('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4dca710..30a8502 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 _0x519c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','show','params','keys','include','merge','find','create','body','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce'];(function(_0x160987,_0x306911){var _0x2d46c8=function(_0x23b27a){while(--_0x23b27a){_0x160987['push'](_0x160987['shift']());}};_0x2d46c8(++_0x306911);}(_0x519c,0x155));var _0xc519=function(_0x44ddfd,_0x27e6d7){_0x44ddfd=_0x44ddfd-0x0;var _0x43fd8f=_0x519c[_0x44ddfd];return _0x43fd8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc519('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc519('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc519('0x2'));var moment=require(_0xc519('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc519('0x4'));var path=require(_0xc519('0x5'));var sox=require('sox');var csv=require(_0xc519('0x6'));var ejs=require(_0xc519('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc519('0x8'));var crypto=require(_0xc519('0x9'));var jsforce=require(_0xc519('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc519('0x6'));var querystring=require(_0xc519('0xb'));var Papa=require(_0xc519('0xc'));var Redis=require('ioredis');var authService=require(_0xc519('0xd'));var qs=require(_0xc519('0xe'));var as=require(_0xc519('0xf'));var hardwareService=require(_0xc519('0x10'));var logger=require(_0xc519('0x11'))(_0xc519('0x12'));var utils=require(_0xc519('0x13'));var config=require(_0xc519('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc519('0x15'))['db'];var jayson=require(_0xc519('0x16'));var client=jayson[_0xc519('0x17')][_0xc519('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x9ed6ab,_0x4a13e3,_0x2387d1,_0x3d421a){return new BPromise(function(_0x22bc65,_0x5129e7){var _0x4f23d3=_0x3d421a||client;return _0x4f23d3[_0xc519('0x19')](_0x9ed6ab,_0x2387d1)['then'](function(_0x5205e5){logger['info'](_0xc519('0x1a'),_0x4a13e3,_0xc519('0x1b'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4a13e3,_0xc519('0x1b'),JSON[_0xc519('0x1c')](_0x5205e5));if(_0x5205e5[_0xc519('0x1d')]){if(_0x5205e5[_0xc519('0x1d')]['code']===0x1f4){logger['error'](_0xc519('0x1a'),_0x4a13e3,_0x5205e5['error'][_0xc519('0x1e')]);return _0x5129e7(_0x5205e5[_0xc519('0x1d')][_0xc519('0x1e')]);}logger[_0xc519('0x1d')](_0xc519('0x1a'),_0x4a13e3,_0x5205e5[_0xc519('0x1d')][_0xc519('0x1e')]);return _0x22bc65(_0x5205e5[_0xc519('0x1d')]['message']);}else{logger['info'](_0xc519('0x1a'),_0x4a13e3,_0xc519('0x1b'));_0x22bc65(_0x5205e5[_0xc519('0x1f')]['message']);}})[_0xc519('0x20')](function(_0x428ffa){logger['error'](_0xc519('0x1a'),_0x4a13e3,_0x428ffa);_0x5129e7(_0x428ffa);});});}function respondWithStatusCode(_0x15fd87,_0x53d218){_0x53d218=_0x53d218||0xcc;return function(_0x11bb12){if(_0x11bb12){return _0x15fd87['sendStatus'](_0x53d218);}return _0x15fd87[_0xc519('0x21')](_0x53d218)['end']();};}function respondWithResult(_0x187a5a,_0x46fdd5){_0x46fdd5=_0x46fdd5||0xc8;return function(_0x28011d){if(_0x28011d){return _0x187a5a['status'](_0x46fdd5)[_0xc519('0x22')](_0x28011d);}};}function respondWithFilteredResult(_0x5c5610,_0x300c0a){return function(_0x2d01a6){if(_0x2d01a6){var _0x116030=_0x2d01a6[_0xc519('0x23')],_0xa08176=_0x300c0a[_0xc519('0x24')],_0x5cff73=_0x300c0a[_0xc519('0x24')]+_0x300c0a[_0xc519('0x25')],_0x1dd3c9;if(_0x5cff73>=_0x116030){_0x5cff73=_0x116030;_0x1dd3c9=0xc8;}else{_0x1dd3c9=0xce;}_0x5c5610['status'](_0x1dd3c9);return _0x5c5610[_0xc519('0x26')](_0xc519('0x27'),_0xa08176+'-'+_0x5cff73+'/'+_0x116030)[_0xc519('0x22')](_0x2d01a6);}return null;};}function patchUpdates(_0x419515){return function(_0x3bbb1e){try{jsonpatch[_0xc519('0x28')](_0x3bbb1e,_0x419515,!![]);}catch(_0x28c86d){return BPromise[_0xc519('0x29')](_0x28c86d);}return _0x3bbb1e[_0xc519('0x2a')]();};}function saveUpdates(_0x43a66c,_0x9bbee3){return function(_0x18dfb9){if(_0x18dfb9){return _0x18dfb9[_0xc519('0x2b')](_0x43a66c)['then'](function(_0x317530){return _0x317530;});}return null;};}function removeEntity(_0x2e50b1,_0x443e82){return function(_0x23e122){if(_0x23e122){return _0x23e122[_0xc519('0x2c')]()[_0xc519('0x2d')](function(){_0x2e50b1[_0xc519('0x21')](0xcc)[_0xc519('0x2e')]();});}};}function handleEntityNotFound(_0x51a648,_0x3c4053){return function(_0x4a2b61){if(!_0x4a2b61){_0x51a648[_0xc519('0x2f')](0x194);}return _0x4a2b61;};}function handleError(_0x538a5b,_0x3a2104){_0x3a2104=_0x3a2104||0x1f4;return function(_0x1e3124){logger['error'](_0x1e3124[_0xc519('0x30')]);if(_0x1e3124[_0xc519('0x31')]){delete _0x1e3124['name'];}_0x538a5b['status'](_0x3a2104)['send'](_0x1e3124);};}exports[_0xc519('0x32')]=function(_0x32bb74,_0x5b5bf1){var _0x52ebb7={},_0x1f7085={},_0x28c629={'count':0x0,'rows':[]};var _0x5ed846=_['map'](db[_0xc519('0x33')][_0xc519('0x34')],function(_0x31c171){return{'name':_0x31c171[_0xc519('0x35')],'type':_0x31c171[_0xc519('0x36')][_0xc519('0x37')]};});_0x1f7085[_0xc519('0x38')]=_[_0xc519('0x39')](_0x5ed846,_0xc519('0x31'));_0x1f7085[_0xc519('0x3a')]=_['keys'](_0x32bb74[_0xc519('0x3a')]);_0x1f7085[_0xc519('0x3b')]=_['intersection'](_0x1f7085['model'],_0x1f7085['query']);_0x52ebb7['attributes']=_[_0xc519('0x3c')](_0x1f7085[_0xc519('0x38')],qs['fields'](_0x32bb74['query'][_0xc519('0x3d')]));_0x52ebb7[_0xc519('0x3e')]=_0x52ebb7[_0xc519('0x3e')][_0xc519('0x3f')]?_0x52ebb7[_0xc519('0x3e')]:_0x1f7085['model'];if(!_0x32bb74['query'][_0xc519('0x40')](_0xc519('0x41'))){_0x52ebb7[_0xc519('0x25')]=qs['limit'](_0x32bb74[_0xc519('0x3a')][_0xc519('0x25')]);_0x52ebb7[_0xc519('0x24')]=qs['offset'](_0x32bb74[_0xc519('0x3a')]['offset']);}_0x52ebb7[_0xc519('0x42')]=qs[_0xc519('0x43')](_0x32bb74[_0xc519('0x3a')][_0xc519('0x43')]);_0x52ebb7[_0xc519('0x44')]=qs[_0xc519('0x3b')](_[_0xc519('0x45')](_0x32bb74[_0xc519('0x3a')],_0x1f7085[_0xc519('0x3b')]),_0x5ed846);if(_0x32bb74[_0xc519('0x3a')][_0xc519('0x46')]){_0x52ebb7[_0xc519('0x44')]=_['merge'](_0x52ebb7[_0xc519('0x44')],{'$or':_[_0xc519('0x39')](_0x5ed846,function(_0xd71985){if(_0xd71985[_0xc519('0x36')]!==_0xc519('0x47')){var _0x2b6154={};_0x2b6154[_0xd71985[_0xc519('0x31')]]={'$like':'%'+_0x32bb74[_0xc519('0x3a')][_0xc519('0x46')]+'%'};return _0x2b6154;}})});}_0x52ebb7=_['merge']({},_0x52ebb7,_0x32bb74[_0xc519('0x48')]);var _0x513f9b={'where':_0x52ebb7[_0xc519('0x44')]};return db['SugarcrmConfiguration'][_0xc519('0x23')](_0x513f9b)[_0xc519('0x2d')](function(_0xc36c2b){_0x28c629[_0xc519('0x23')]=_0xc36c2b;if(_0x32bb74['query'][_0xc519('0x49')]){_0x52ebb7['include']=[{'all':!![]}];}return db[_0xc519('0x33')][_0xc519('0x4a')](_0x52ebb7);})[_0xc519('0x2d')](function(_0x47e2ec){_0x28c629['rows']=_0x47e2ec;return _0x28c629;})[_0xc519('0x2d')](respondWithFilteredResult(_0x5b5bf1,_0x52ebb7))['catch'](handleError(_0x5b5bf1,null));};exports[_0xc519('0x4b')]=function(_0x32e72c,_0x16c9fa){var _0x3bf468={'raw':![],'where':{'id':_0x32e72c[_0xc519('0x4c')]['id']}},_0x118863={};_0x118863[_0xc519('0x38')]=_[_0xc519('0x4d')](db['SugarcrmConfiguration']['rawAttributes']);_0x118863[_0xc519('0x3a')]=_[_0xc519('0x4d')](_0x32e72c['query']);_0x118863[_0xc519('0x3b')]=_[_0xc519('0x3c')](_0x118863[_0xc519('0x38')],_0x118863['query']);_0x3bf468[_0xc519('0x3e')]=_['intersection'](_0x118863[_0xc519('0x38')],qs[_0xc519('0x3d')](_0x32e72c['query'][_0xc519('0x3d')]));_0x3bf468['attributes']=_0x3bf468[_0xc519('0x3e')][_0xc519('0x3f')]?_0x3bf468[_0xc519('0x3e')]:_0x118863['model'];if(_0x32e72c['query'][_0xc519('0x49')]){_0x3bf468[_0xc519('0x4e')]=[{'all':!![]}];}_0x3bf468=_[_0xc519('0x4f')]({},_0x3bf468,_0x32e72c[_0xc519('0x48')]);return db['SugarcrmConfiguration'][_0xc519('0x50')](_0x3bf468)['then'](handleEntityNotFound(_0x16c9fa,null))[_0xc519('0x2d')](respondWithResult(_0x16c9fa,null))['catch'](handleError(_0x16c9fa,null));};exports['create']=function(_0x107c5f,_0x32e797){return db[_0xc519('0x33')][_0xc519('0x51')](_0x107c5f[_0xc519('0x52')],{})['then'](respondWithResult(_0x32e797,0xc9))[_0xc519('0x20')](handleError(_0x32e797,null));};exports[_0xc519('0x2b')]=function(_0x27eaf7,_0x18e536){if(_0x27eaf7['body']['id']){delete _0x27eaf7[_0xc519('0x52')]['id'];}return db[_0xc519('0x33')][_0xc519('0x50')]({'where':{'id':_0x27eaf7[_0xc519('0x4c')]['id']}})[_0xc519('0x2d')](handleEntityNotFound(_0x18e536,null))[_0xc519('0x2d')](saveUpdates(_0x27eaf7[_0xc519('0x52')],null))[_0xc519('0x2d')](respondWithResult(_0x18e536,null))['catch'](handleError(_0x18e536,null));};exports[_0xc519('0x2c')]=function(_0x1dceaa,_0x1b7d8b){return db[_0xc519('0x33')][_0xc519('0x50')]({'where':{'id':_0x1dceaa[_0xc519('0x4c')]['id']}})[_0xc519('0x2d')](handleEntityNotFound(_0x1b7d8b,null))['then'](removeEntity(_0x1b7d8b,null))['catch'](handleError(_0x1b7d8b,null));};exports[_0xc519('0x53')]=function(_0x453207,_0x1a70d9,_0x55525a){var _0x3972ba={};var _0xe64fee={};var _0x38c766;var _0x8e834f;return db[_0xc519('0x33')]['findOne']({'where':{'id':_0x453207[_0xc519('0x4c')]['id']}})[_0xc519('0x2d')](handleEntityNotFound(_0x1a70d9,null))[_0xc519('0x2d')](function(_0x40792d){if(_0x40792d){_0x38c766=_0x40792d;_0xe64fee[_0xc519('0x38')]=_[_0xc519('0x4d')](db[_0xc519('0x54')][_0xc519('0x34')]);_0xe64fee[_0xc519('0x3a')]=_[_0xc519('0x4d')](_0x453207[_0xc519('0x3a')]);_0xe64fee[_0xc519('0x3b')]=_[_0xc519('0x3c')](_0xe64fee[_0xc519('0x38')],_0xe64fee['query']);_0x3972ba['attributes']=_['intersection'](_0xe64fee[_0xc519('0x38')],qs[_0xc519('0x3d')](_0x453207[_0xc519('0x3a')][_0xc519('0x3d')]));_0x3972ba[_0xc519('0x3e')]=_0x3972ba[_0xc519('0x3e')][_0xc519('0x3f')]?_0x3972ba[_0xc519('0x3e')]:_0xe64fee['model'];_0x3972ba[_0xc519('0x42')]=qs[_0xc519('0x43')](_0x453207[_0xc519('0x3a')]['sort']);_0x3972ba[_0xc519('0x44')]=qs[_0xc519('0x3b')](_[_0xc519('0x45')](_0x453207[_0xc519('0x3a')],_0xe64fee[_0xc519('0x3b')]));if(_0x453207['query'][_0xc519('0x46')]){_0x3972ba[_0xc519('0x44')]=_['merge'](_0x3972ba[_0xc519('0x44')],{'$or':_[_0xc519('0x39')](_0x3972ba[_0xc519('0x3e')],function(_0x5d7e22){var _0x2cd137={};_0x2cd137[_0x5d7e22]={'$like':'%'+_0x453207[_0xc519('0x3a')][_0xc519('0x46')]+'%'};return _0x2cd137;})});}_0x3972ba=_['merge']({},_0x3972ba,_0x453207['options']);return _0x38c766[_0xc519('0x53')](_0x3972ba);}})[_0xc519('0x2d')](function(_0x35cf31){if(_0x35cf31){_0x8e834f=_0x35cf31[_0xc519('0x3f')];if(!_0x453207[_0xc519('0x3a')][_0xc519('0x40')](_0xc519('0x41'))){_0x3972ba[_0xc519('0x25')]=qs[_0xc519('0x25')](_0x453207[_0xc519('0x3a')][_0xc519('0x25')]);_0x3972ba['offset']=qs[_0xc519('0x24')](_0x453207[_0xc519('0x3a')]['offset']);}return _0x38c766[_0xc519('0x53')](_0x3972ba);}})[_0xc519('0x2d')](function(_0x2112a5){if(_0x2112a5){return _0x2112a5?{'count':_0x8e834f,'rows':_0x2112a5}:null;}})[_0xc519('0x2d')](respondWithResult(_0x1a70d9,null))['catch'](handleError(_0x1a70d9,null));};exports[_0xc519('0x55')]=function(_0x5b13d7,_0xfba7c1,_0x5595dd){var _0x4387d8={};var _0x698619={};var _0x360a90;var _0x5e74cc;return db[_0xc519('0x33')][_0xc519('0x56')]({'where':{'id':_0x5b13d7[_0xc519('0x4c')]['id']}})[_0xc519('0x2d')](handleEntityNotFound(_0xfba7c1,null))[_0xc519('0x2d')](function(_0x4168e1){if(_0x4168e1){_0x360a90=_0x4168e1;_0x698619[_0xc519('0x38')]=_[_0xc519('0x4d')](db[_0xc519('0x54')][_0xc519('0x34')]);_0x698619[_0xc519('0x3a')]=_[_0xc519('0x4d')](_0x5b13d7['query']);_0x698619[_0xc519('0x3b')]=_[_0xc519('0x3c')](_0x698619[_0xc519('0x38')],_0x698619[_0xc519('0x3a')]);_0x4387d8[_0xc519('0x3e')]=_['intersection'](_0x698619['model'],qs['fields'](_0x5b13d7['query'][_0xc519('0x3d')]));_0x4387d8[_0xc519('0x3e')]=_0x4387d8[_0xc519('0x3e')][_0xc519('0x3f')]?_0x4387d8[_0xc519('0x3e')]:_0x698619[_0xc519('0x38')];_0x4387d8[_0xc519('0x42')]=qs[_0xc519('0x43')](_0x5b13d7[_0xc519('0x3a')][_0xc519('0x43')]);_0x4387d8[_0xc519('0x44')]=qs[_0xc519('0x3b')](_['pick'](_0x5b13d7[_0xc519('0x3a')],_0x698619[_0xc519('0x3b')]));if(_0x5b13d7[_0xc519('0x3a')][_0xc519('0x46')]){_0x4387d8[_0xc519('0x44')]=_['merge'](_0x4387d8[_0xc519('0x44')],{'$or':_[_0xc519('0x39')](_0x4387d8[_0xc519('0x3e')],function(_0x19685b){var _0x4e5d95={};_0x4e5d95[_0x19685b]={'$like':'%'+_0x5b13d7[_0xc519('0x3a')][_0xc519('0x46')]+'%'};return _0x4e5d95;})});}_0x4387d8=_[_0xc519('0x4f')]({},_0x4387d8,_0x5b13d7[_0xc519('0x48')]);return _0x360a90[_0xc519('0x55')](_0x4387d8);}})[_0xc519('0x2d')](function(_0x2884e2){if(_0x2884e2){_0x5e74cc=_0x2884e2[_0xc519('0x3f')];if(!_0x5b13d7[_0xc519('0x3a')][_0xc519('0x40')]('nolimit')){_0x4387d8[_0xc519('0x25')]=qs[_0xc519('0x25')](_0x5b13d7[_0xc519('0x3a')][_0xc519('0x25')]);_0x4387d8[_0xc519('0x24')]=qs[_0xc519('0x24')](_0x5b13d7[_0xc519('0x3a')][_0xc519('0x24')]);}return _0x360a90['getSubjects'](_0x4387d8);}})['then'](function(_0x2528a4){if(_0x2528a4){return _0x2528a4?{'count':_0x5e74cc,'rows':_0x2528a4}:null;}})[_0xc519('0x2d')](respondWithResult(_0xfba7c1,null))['catch'](handleError(_0xfba7c1,null));};exports[_0xc519('0x57')]=function(_0xd2d697,_0x144bd4,_0x59d8b8){var _0x34aa85={};var _0x3336a8={};var _0x1ff0c3;var _0x29d200;return db['SugarcrmConfiguration'][_0xc519('0x56')]({'where':{'id':_0xd2d697[_0xc519('0x4c')]['id']}})[_0xc519('0x2d')](handleEntityNotFound(_0x144bd4,null))[_0xc519('0x2d')](function(_0x143d2f){if(_0x143d2f){_0x1ff0c3=_0x143d2f;_0x3336a8[_0xc519('0x38')]=_[_0xc519('0x4d')](db[_0xc519('0x54')]['rawAttributes']);_0x3336a8[_0xc519('0x3a')]=_['keys'](_0xd2d697[_0xc519('0x3a')]);_0x3336a8['filters']=_['intersection'](_0x3336a8[_0xc519('0x38')],_0x3336a8['query']);_0x34aa85[_0xc519('0x3e')]=_[_0xc519('0x3c')](_0x3336a8['model'],qs[_0xc519('0x3d')](_0xd2d697['query']['fields']));_0x34aa85[_0xc519('0x3e')]=_0x34aa85['attributes']['length']?_0x34aa85[_0xc519('0x3e')]:_0x3336a8[_0xc519('0x38')];_0x34aa85[_0xc519('0x42')]=qs[_0xc519('0x43')](_0xd2d697[_0xc519('0x3a')][_0xc519('0x43')]);_0x34aa85['where']=qs['filters'](_[_0xc519('0x45')](_0xd2d697[_0xc519('0x3a')],_0x3336a8[_0xc519('0x3b')]));if(_0xd2d697[_0xc519('0x3a')][_0xc519('0x46')]){_0x34aa85['where']=_['merge'](_0x34aa85[_0xc519('0x44')],{'$or':_[_0xc519('0x39')](_0x34aa85[_0xc519('0x3e')],function(_0x282145){var _0x136bc5={};_0x136bc5[_0x282145]={'$like':'%'+_0xd2d697[_0xc519('0x3a')][_0xc519('0x46')]+'%'};return _0x136bc5;})});}_0x34aa85=_[_0xc519('0x4f')]({},_0x34aa85,_0xd2d697[_0xc519('0x48')]);return _0x1ff0c3['getDescriptions'](_0x34aa85);}})[_0xc519('0x2d')](function(_0x20bb36){if(_0x20bb36){_0x29d200=_0x20bb36['length'];if(!_0xd2d697['query'][_0xc519('0x40')]('nolimit')){_0x34aa85['limit']=qs['limit'](_0xd2d697[_0xc519('0x3a')][_0xc519('0x25')]);_0x34aa85[_0xc519('0x24')]=qs[_0xc519('0x24')](_0xd2d697['query']['offset']);}return _0x1ff0c3['getDescriptions'](_0x34aa85);}})['then'](function(_0x287adb){if(_0x287adb){return _0x287adb?{'count':_0x29d200,'rows':_0x287adb}:null;}})['then'](respondWithResult(_0x144bd4,null))[_0xc519('0x20')](handleError(_0x144bd4,null));}; \ No newline at end of file +var _0x63b6=['where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','destroy','find','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0xf105aa,_0x22d153){var _0x34d1e5=function(_0xba77e){while(--_0xba77e){_0xf105aa['push'](_0xf105aa['shift']());}};_0x34d1e5(++_0x22d153);}(_0x63b6,0x73));var _0x663b=function(_0x3009b1,_0x1ed650){_0x3009b1=_0x3009b1-0x0;var _0x433c7e=_0x63b6[_0x3009b1];return _0x433c7e;};'use strict';var pdf=require(_0x663b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x663b('0x1'));var jsonpatch=require(_0x663b('0x2'));var rp=require('request-promise');var moment=require(_0x663b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x663b('0x4'));var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x663b('0x7'));var fs=require('fs');var _=require(_0x663b('0x8'));var squel=require(_0x663b('0x9'));var crypto=require(_0x663b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x663b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x663b('0xc'));var Papa=require(_0x663b('0xd'));var Redis=require(_0x663b('0xe'));var authService=require(_0x663b('0xf'));var qs=require(_0x663b('0x10'));var as=require(_0x663b('0x11'));var hardwareService=require(_0x663b('0x12'));var logger=require(_0x663b('0x13'))(_0x663b('0x14'));var utils=require('../../config/utils');var config=require(_0x663b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x663b('0x16'));var client=jayson[_0x663b('0x17')][_0x663b('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x371039,_0x2a61ea,_0x4ea76b,_0x3effd4){return new BPromise(function(_0x17800b,_0x43f458){var _0xacb20b=_0x3effd4||client;return _0xacb20b[_0x663b('0x19')](_0x371039,_0x4ea76b)['then'](function(_0x819a09){logger[_0x663b('0x1a')](_0x663b('0x1b'),_0x2a61ea,_0x663b('0x1c'));logger[_0x663b('0x1d')](_0x663b('0x1e'),_0x2a61ea,'request\x20sent',JSON[_0x663b('0x1f')](_0x819a09));if(_0x819a09[_0x663b('0x20')]){if(_0x819a09['error'][_0x663b('0x21')]===0x1f4){logger[_0x663b('0x20')](_0x663b('0x1b'),_0x2a61ea,_0x819a09[_0x663b('0x20')]['message']);return _0x43f458(_0x819a09['error']['message']);}logger[_0x663b('0x20')](_0x663b('0x1b'),_0x2a61ea,_0x819a09['error'][_0x663b('0x22')]);return _0x17800b(_0x819a09[_0x663b('0x20')][_0x663b('0x22')]);}else{logger[_0x663b('0x1a')](_0x663b('0x1b'),_0x2a61ea,_0x663b('0x1c'));_0x17800b(_0x819a09[_0x663b('0x23')][_0x663b('0x22')]);}})[_0x663b('0x24')](function(_0x20c438){logger['error'](_0x663b('0x1b'),_0x2a61ea,_0x20c438);_0x43f458(_0x20c438);});});}function respondWithStatusCode(_0x53d48b,_0x5c0bcd){_0x5c0bcd=_0x5c0bcd||0xcc;return function(_0x5cd258){if(_0x5cd258){return _0x53d48b[_0x663b('0x25')](_0x5c0bcd);}return _0x53d48b[_0x663b('0x26')](_0x5c0bcd)[_0x663b('0x27')]();};}function respondWithResult(_0x233af5,_0x3f7b54){_0x3f7b54=_0x3f7b54||0xc8;return function(_0x12d035){if(_0x12d035){return _0x233af5[_0x663b('0x26')](_0x3f7b54)[_0x663b('0x28')](_0x12d035);}};}function respondWithFilteredResult(_0x47c89c,_0x236a5c){return function(_0x49e90d){if(_0x49e90d){var _0x24f0d7=_0x49e90d[_0x663b('0x29')],_0x8d2ead=_0x236a5c[_0x663b('0x2a')],_0x1fbd2f=_0x236a5c[_0x663b('0x2a')]+_0x236a5c[_0x663b('0x2b')],_0x1f4606;if(_0x1fbd2f>=_0x24f0d7){_0x1fbd2f=_0x24f0d7;_0x1f4606=0xc8;}else{_0x1f4606=0xce;}_0x47c89c[_0x663b('0x26')](_0x1f4606);return _0x47c89c['set'](_0x663b('0x2c'),_0x8d2ead+'-'+_0x1fbd2f+'/'+_0x24f0d7)[_0x663b('0x28')](_0x49e90d);}return null;};}function patchUpdates(_0x2a7988){return function(_0x4d0894){try{jsonpatch[_0x663b('0x2d')](_0x4d0894,_0x2a7988,!![]);}catch(_0x2d9143){return BPromise[_0x663b('0x2e')](_0x2d9143);}return _0x4d0894[_0x663b('0x2f')]();};}function saveUpdates(_0x2b35fc,_0xa68425){return function(_0xb1b68a){if(_0xb1b68a){return _0xb1b68a[_0x663b('0x30')](_0x2b35fc)[_0x663b('0x31')](function(_0x118f2f){return _0x118f2f;});}return null;};}function removeEntity(_0x2e8291,_0x258f24){return function(_0x4073d0){if(_0x4073d0){return _0x4073d0['destroy']()[_0x663b('0x31')](function(){_0x2e8291[_0x663b('0x26')](0xcc)[_0x663b('0x27')]();});}};}function handleEntityNotFound(_0x4013cb,_0x15dd7f){return function(_0x2b87d5){if(!_0x2b87d5){_0x4013cb[_0x663b('0x25')](0x194);}return _0x2b87d5;};}function handleError(_0x3553e4,_0xe7d011){_0xe7d011=_0xe7d011||0x1f4;return function(_0x84dfcc){logger['error'](_0x84dfcc[_0x663b('0x32')]);if(_0x84dfcc[_0x663b('0x33')]){delete _0x84dfcc[_0x663b('0x33')];}_0x3553e4[_0x663b('0x26')](_0xe7d011)['send'](_0x84dfcc);};}exports[_0x663b('0x34')]=function(_0xad1334,_0x127da8){var _0x3ac32d={},_0x252f8d={},_0x85a4b1={'count':0x0,'rows':[]};var _0x4b6265=_[_0x663b('0x35')](db[_0x663b('0x36')][_0x663b('0x37')],function(_0x18d132){return{'name':_0x18d132[_0x663b('0x38')],'type':_0x18d132[_0x663b('0x39')][_0x663b('0x3a')]};});_0x252f8d[_0x663b('0x3b')]=_[_0x663b('0x35')](_0x4b6265,_0x663b('0x33'));_0x252f8d[_0x663b('0x3c')]=_[_0x663b('0x3d')](_0xad1334['query']);_0x252f8d['filters']=_[_0x663b('0x3e')](_0x252f8d[_0x663b('0x3b')],_0x252f8d[_0x663b('0x3c')]);_0x3ac32d[_0x663b('0x3f')]=_[_0x663b('0x3e')](_0x252f8d['model'],qs[_0x663b('0x40')](_0xad1334[_0x663b('0x3c')][_0x663b('0x40')]));_0x3ac32d['attributes']=_0x3ac32d[_0x663b('0x3f')][_0x663b('0x41')]?_0x3ac32d[_0x663b('0x3f')]:_0x252f8d[_0x663b('0x3b')];if(!_0xad1334[_0x663b('0x3c')][_0x663b('0x42')](_0x663b('0x43'))){_0x3ac32d[_0x663b('0x2b')]=qs[_0x663b('0x2b')](_0xad1334[_0x663b('0x3c')][_0x663b('0x2b')]);_0x3ac32d[_0x663b('0x2a')]=qs[_0x663b('0x2a')](_0xad1334[_0x663b('0x3c')][_0x663b('0x2a')]);}_0x3ac32d['order']=qs['sort'](_0xad1334['query'][_0x663b('0x44')]);_0x3ac32d[_0x663b('0x45')]=qs[_0x663b('0x46')](_[_0x663b('0x47')](_0xad1334[_0x663b('0x3c')],_0x252f8d[_0x663b('0x46')]),_0x4b6265);if(_0xad1334[_0x663b('0x3c')][_0x663b('0x48')]){_0x3ac32d[_0x663b('0x45')]=_[_0x663b('0x49')](_0x3ac32d[_0x663b('0x45')],{'$or':_[_0x663b('0x35')](_0x4b6265,function(_0x49bc3c){if(_0x49bc3c[_0x663b('0x39')]!==_0x663b('0x4a')){var _0x2b3e1c={};_0x2b3e1c[_0x49bc3c['name']]={'$like':'%'+_0xad1334['query'][_0x663b('0x48')]+'%'};return _0x2b3e1c;}})});}_0x3ac32d=_[_0x663b('0x49')]({},_0x3ac32d,_0xad1334[_0x663b('0x4b')]);var _0x2669f8={'where':_0x3ac32d['where']};return db[_0x663b('0x36')][_0x663b('0x29')](_0x2669f8)[_0x663b('0x31')](function(_0x294108){_0x85a4b1[_0x663b('0x29')]=_0x294108;if(_0xad1334['query'][_0x663b('0x4c')]){_0x3ac32d[_0x663b('0x4d')]=[{'all':!![]}];}return db[_0x663b('0x36')][_0x663b('0x4e')](_0x3ac32d);})[_0x663b('0x31')](function(_0x54b07d){_0x85a4b1[_0x663b('0x4f')]=_0x54b07d;return _0x85a4b1;})[_0x663b('0x31')](respondWithFilteredResult(_0x127da8,_0x3ac32d))[_0x663b('0x24')](handleError(_0x127da8,null));};exports[_0x663b('0x50')]=function(_0x3ee02f,_0x685785){var _0x4690c9={'raw':![],'where':{'id':_0x3ee02f[_0x663b('0x51')]['id']}},_0x247ea3={};_0x247ea3[_0x663b('0x3b')]=_[_0x663b('0x3d')](db[_0x663b('0x36')][_0x663b('0x37')]);_0x247ea3[_0x663b('0x3c')]=_[_0x663b('0x3d')](_0x3ee02f[_0x663b('0x3c')]);_0x247ea3['filters']=_[_0x663b('0x3e')](_0x247ea3[_0x663b('0x3b')],_0x247ea3[_0x663b('0x3c')]);_0x4690c9['attributes']=_['intersection'](_0x247ea3[_0x663b('0x3b')],qs[_0x663b('0x40')](_0x3ee02f['query'][_0x663b('0x40')]));_0x4690c9[_0x663b('0x3f')]=_0x4690c9[_0x663b('0x3f')][_0x663b('0x41')]?_0x4690c9[_0x663b('0x3f')]:_0x247ea3[_0x663b('0x3b')];if(_0x3ee02f[_0x663b('0x3c')]['includeAll']){_0x4690c9[_0x663b('0x4d')]=[{'all':!![]}];}_0x4690c9=_['merge']({},_0x4690c9,_0x3ee02f['options']);return db[_0x663b('0x36')]['find'](_0x4690c9)[_0x663b('0x31')](handleEntityNotFound(_0x685785,null))['then'](respondWithResult(_0x685785,null))['catch'](handleError(_0x685785,null));};exports[_0x663b('0x52')]=function(_0x2443ac,_0xf48168){return db[_0x663b('0x36')][_0x663b('0x52')](_0x2443ac['body'],{})[_0x663b('0x31')](respondWithResult(_0xf48168,0xc9))[_0x663b('0x24')](handleError(_0xf48168,null));};exports[_0x663b('0x30')]=function(_0x1fbf22,_0x5ecc6b){if(_0x1fbf22[_0x663b('0x53')]['id']){delete _0x1fbf22[_0x663b('0x53')]['id'];}return db[_0x663b('0x36')]['find']({'where':{'id':_0x1fbf22[_0x663b('0x51')]['id']}})[_0x663b('0x31')](handleEntityNotFound(_0x5ecc6b,null))[_0x663b('0x31')](saveUpdates(_0x1fbf22[_0x663b('0x53')],null))[_0x663b('0x31')](respondWithResult(_0x5ecc6b,null))[_0x663b('0x24')](handleError(_0x5ecc6b,null));};exports[_0x663b('0x54')]=function(_0x5e89e3,_0x21e01c){return db[_0x663b('0x36')][_0x663b('0x55')]({'where':{'id':_0x5e89e3[_0x663b('0x51')]['id']}})[_0x663b('0x31')](handleEntityNotFound(_0x21e01c,null))[_0x663b('0x31')](removeEntity(_0x21e01c,null))[_0x663b('0x24')](handleError(_0x21e01c,null));};exports[_0x663b('0x56')]=function(_0x108641,_0x283c3a,_0x59740e){var _0x5b01c1={};var _0x39d591={};var _0x296141;var _0x37304f;return db['SugarcrmConfiguration'][_0x663b('0x57')]({'where':{'id':_0x108641[_0x663b('0x51')]['id']}})[_0x663b('0x31')](handleEntityNotFound(_0x283c3a,null))[_0x663b('0x31')](function(_0x3bee82){if(_0x3bee82){_0x296141=_0x3bee82;_0x39d591[_0x663b('0x3b')]=_['keys'](db[_0x663b('0x58')][_0x663b('0x37')]);_0x39d591[_0x663b('0x3c')]=_[_0x663b('0x3d')](_0x108641[_0x663b('0x3c')]);_0x39d591[_0x663b('0x46')]=_[_0x663b('0x3e')](_0x39d591[_0x663b('0x3b')],_0x39d591[_0x663b('0x3c')]);_0x5b01c1[_0x663b('0x3f')]=_['intersection'](_0x39d591[_0x663b('0x3b')],qs[_0x663b('0x40')](_0x108641[_0x663b('0x3c')][_0x663b('0x40')]));_0x5b01c1['attributes']=_0x5b01c1[_0x663b('0x3f')][_0x663b('0x41')]?_0x5b01c1[_0x663b('0x3f')]:_0x39d591[_0x663b('0x3b')];_0x5b01c1[_0x663b('0x59')]=qs[_0x663b('0x44')](_0x108641['query'][_0x663b('0x44')]);_0x5b01c1['where']=qs[_0x663b('0x46')](_[_0x663b('0x47')](_0x108641[_0x663b('0x3c')],_0x39d591[_0x663b('0x46')]));if(_0x108641[_0x663b('0x3c')][_0x663b('0x48')]){_0x5b01c1['where']=_[_0x663b('0x49')](_0x5b01c1[_0x663b('0x45')],{'$or':_[_0x663b('0x35')](_0x5b01c1[_0x663b('0x3f')],function(_0x1682d4){var _0x5a71c4={};_0x5a71c4[_0x1682d4]={'$like':'%'+_0x108641[_0x663b('0x3c')][_0x663b('0x48')]+'%'};return _0x5a71c4;})});}_0x5b01c1=_[_0x663b('0x49')]({},_0x5b01c1,_0x108641[_0x663b('0x4b')]);return _0x296141[_0x663b('0x56')](_0x5b01c1);}})['then'](function(_0x278678){if(_0x278678){_0x37304f=_0x278678[_0x663b('0x41')];if(!_0x108641[_0x663b('0x3c')][_0x663b('0x42')]('nolimit')){_0x5b01c1[_0x663b('0x2b')]=qs[_0x663b('0x2b')](_0x108641[_0x663b('0x3c')][_0x663b('0x2b')]);_0x5b01c1['offset']=qs[_0x663b('0x2a')](_0x108641['query'][_0x663b('0x2a')]);}return _0x296141[_0x663b('0x56')](_0x5b01c1);}})[_0x663b('0x31')](function(_0xcc9cfb){if(_0xcc9cfb){return _0xcc9cfb?{'count':_0x37304f,'rows':_0xcc9cfb}:null;}})[_0x663b('0x31')](respondWithResult(_0x283c3a,null))[_0x663b('0x24')](handleError(_0x283c3a,null));};exports[_0x663b('0x5a')]=function(_0x329917,_0x56be9c,_0x4aa286){var _0x4c5a9b={};var _0x4d4e08={};var _0x11316a;var _0x35d473;return db[_0x663b('0x36')][_0x663b('0x57')]({'where':{'id':_0x329917[_0x663b('0x51')]['id']}})[_0x663b('0x31')](handleEntityNotFound(_0x56be9c,null))[_0x663b('0x31')](function(_0x6218ad){if(_0x6218ad){_0x11316a=_0x6218ad;_0x4d4e08[_0x663b('0x3b')]=_[_0x663b('0x3d')](db['SugarcrmField'][_0x663b('0x37')]);_0x4d4e08['query']=_[_0x663b('0x3d')](_0x329917[_0x663b('0x3c')]);_0x4d4e08[_0x663b('0x46')]=_[_0x663b('0x3e')](_0x4d4e08[_0x663b('0x3b')],_0x4d4e08['query']);_0x4c5a9b[_0x663b('0x3f')]=_['intersection'](_0x4d4e08[_0x663b('0x3b')],qs[_0x663b('0x40')](_0x329917[_0x663b('0x3c')][_0x663b('0x40')]));_0x4c5a9b[_0x663b('0x3f')]=_0x4c5a9b['attributes'][_0x663b('0x41')]?_0x4c5a9b[_0x663b('0x3f')]:_0x4d4e08[_0x663b('0x3b')];_0x4c5a9b[_0x663b('0x59')]=qs['sort'](_0x329917[_0x663b('0x3c')][_0x663b('0x44')]);_0x4c5a9b[_0x663b('0x45')]=qs['filters'](_['pick'](_0x329917[_0x663b('0x3c')],_0x4d4e08[_0x663b('0x46')]));if(_0x329917[_0x663b('0x3c')]['filter']){_0x4c5a9b[_0x663b('0x45')]=_[_0x663b('0x49')](_0x4c5a9b[_0x663b('0x45')],{'$or':_['map'](_0x4c5a9b[_0x663b('0x3f')],function(_0x1b2e9d){var _0x2f7e7e={};_0x2f7e7e[_0x1b2e9d]={'$like':'%'+_0x329917['query'][_0x663b('0x48')]+'%'};return _0x2f7e7e;})});}_0x4c5a9b=_[_0x663b('0x49')]({},_0x4c5a9b,_0x329917[_0x663b('0x4b')]);return _0x11316a['getSubjects'](_0x4c5a9b);}})[_0x663b('0x31')](function(_0x2d6bc2){if(_0x2d6bc2){_0x35d473=_0x2d6bc2[_0x663b('0x41')];if(!_0x329917[_0x663b('0x3c')][_0x663b('0x42')](_0x663b('0x43'))){_0x4c5a9b[_0x663b('0x2b')]=qs[_0x663b('0x2b')](_0x329917[_0x663b('0x3c')][_0x663b('0x2b')]);_0x4c5a9b[_0x663b('0x2a')]=qs['offset'](_0x329917['query'][_0x663b('0x2a')]);}return _0x11316a[_0x663b('0x5a')](_0x4c5a9b);}})[_0x663b('0x31')](function(_0x249ee5){if(_0x249ee5){return _0x249ee5?{'count':_0x35d473,'rows':_0x249ee5}:null;}})['then'](respondWithResult(_0x56be9c,null))[_0x663b('0x24')](handleError(_0x56be9c,null));};exports[_0x663b('0x5b')]=function(_0x2dd15d,_0x7bdfde,_0xf9524e){var _0x48af65={};var _0x3703b8={};var _0x326004;var _0x35471b;return db[_0x663b('0x36')][_0x663b('0x57')]({'where':{'id':_0x2dd15d[_0x663b('0x51')]['id']}})[_0x663b('0x31')](handleEntityNotFound(_0x7bdfde,null))[_0x663b('0x31')](function(_0x450829){if(_0x450829){_0x326004=_0x450829;_0x3703b8[_0x663b('0x3b')]=_[_0x663b('0x3d')](db['SugarcrmField'][_0x663b('0x37')]);_0x3703b8[_0x663b('0x3c')]=_['keys'](_0x2dd15d[_0x663b('0x3c')]);_0x3703b8[_0x663b('0x46')]=_[_0x663b('0x3e')](_0x3703b8['model'],_0x3703b8[_0x663b('0x3c')]);_0x48af65[_0x663b('0x3f')]=_['intersection'](_0x3703b8[_0x663b('0x3b')],qs[_0x663b('0x40')](_0x2dd15d[_0x663b('0x3c')][_0x663b('0x40')]));_0x48af65[_0x663b('0x3f')]=_0x48af65['attributes'][_0x663b('0x41')]?_0x48af65[_0x663b('0x3f')]:_0x3703b8[_0x663b('0x3b')];_0x48af65[_0x663b('0x59')]=qs[_0x663b('0x44')](_0x2dd15d['query'][_0x663b('0x44')]);_0x48af65[_0x663b('0x45')]=qs['filters'](_[_0x663b('0x47')](_0x2dd15d['query'],_0x3703b8[_0x663b('0x46')]));if(_0x2dd15d['query'][_0x663b('0x48')]){_0x48af65['where']=_[_0x663b('0x49')](_0x48af65[_0x663b('0x45')],{'$or':_[_0x663b('0x35')](_0x48af65[_0x663b('0x3f')],function(_0x31ced9){var _0x572bb7={};_0x572bb7[_0x31ced9]={'$like':'%'+_0x2dd15d['query']['filter']+'%'};return _0x572bb7;})});}_0x48af65=_['merge']({},_0x48af65,_0x2dd15d['options']);return _0x326004['getDescriptions'](_0x48af65);}})[_0x663b('0x31')](function(_0x994178){if(_0x994178){_0x35471b=_0x994178[_0x663b('0x41')];if(!_0x2dd15d[_0x663b('0x3c')][_0x663b('0x42')](_0x663b('0x43'))){_0x48af65[_0x663b('0x2b')]=qs[_0x663b('0x2b')](_0x2dd15d[_0x663b('0x3c')][_0x663b('0x2b')]);_0x48af65[_0x663b('0x2a')]=qs[_0x663b('0x2a')](_0x2dd15d['query'][_0x663b('0x2a')]);}return _0x326004[_0x663b('0x5b')](_0x48af65);}})[_0x663b('0x31')](function(_0x40b433){if(_0x40b433){return _0x40b433?{'count':_0x35471b,'rows':_0x40b433}:null;}})[_0x663b('0x31')](respondWithResult(_0x7bdfde,null))[_0x663b('0x24')](handleError(_0x7bdfde,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2fb4d98..a12f368 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 _0xe428=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','util'];(function(_0xf24af6,_0x5f3412){var _0x1c141c=function(_0x2ded7f){while(--_0x2ded7f){_0xf24af6['push'](_0xf24af6['shift']());}};_0x1c141c(++_0x5f3412);}(_0xe428,0xef));var _0x8e42=function(_0x4554f0,_0x5c2b5d){_0x4554f0=_0x4554f0-0x0;var _0x5af976=_0xe428[_0x4554f0];return _0x5af976;};'use strict';var _=require('lodash');var util=require(_0x8e42('0x0'));var logger=require(_0x8e42('0x1'))(_0x8e42('0x2'));var moment=require(_0x8e42('0x3'));var BPromise=require(_0x8e42('0x4'));var rp=require(_0x8e42('0x5'));var fs=require('fs');var path=require(_0x8e42('0x6'));var rimraf=require(_0x8e42('0x7'));var config=require(_0x8e42('0x8'));var attributes=require(_0x8e42('0x9'));module[_0x8e42('0xa')]=function(_0x5e3b64,_0x537b5a){return _0x5e3b64[_0x8e42('0xb')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3f9=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e4b30,_0x2f7bd9){var _0x59e813=function(_0x34e1b5){while(--_0x34e1b5){_0x2e4b30['push'](_0x2e4b30['shift']());}};_0x59e813(++_0x2f7bd9);}(_0xe3f9,0xa1));var _0x9e3f=function(_0x105ace,_0x3bb3c1){_0x105ace=_0x105ace-0x0;var _0x3131b7=_0xe3f9[_0x105ace];return _0x3131b7;};'use strict';var _=require('lodash');var util=require(_0x9e3f('0x0'));var logger=require('../../config/logger')(_0x9e3f('0x1'));var moment=require(_0x9e3f('0x2'));var BPromise=require(_0x9e3f('0x3'));var rp=require(_0x9e3f('0x4'));var fs=require('fs');var path=require(_0x9e3f('0x5'));var rimraf=require(_0x9e3f('0x6'));var config=require(_0x9e3f('0x7'));var attributes=require(_0x9e3f('0x8'));module[_0x9e3f('0x9')]=function(_0x5d6d3b,_0x20dac5){return _0x5d6d3b[_0x9e3f('0xa')](_0x9e3f('0xb'),attributes,{'tableName':_0x9e3f('0xc'),'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 8b3945a..45e5605 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 _0xf56e=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0xf56e,0x190));var _0xef56=function(_0x281ad3,_0x1602e0){_0x281ad3=_0x281ad3-0x0;var _0x30a754=_0xf56e[_0x281ad3];return _0x30a754;};'use strict';var _=require('lodash');var util=require(_0xef56('0x0'));var moment=require(_0xef56('0x1'));var BPromise=require(_0xef56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef56('0x3'));var db=require(_0xef56('0x4'))['db'];var utils=require(_0xef56('0x5'));var logger=require(_0xef56('0x6'))(_0xef56('0x7'));var config=require(_0xef56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef56('0x9')][_0xef56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x254bee,_0x20d758,_0x1497fe){return new BPromise(function(_0x2407fe,_0x4e4a8d){return client[_0xef56('0xb')](_0x254bee,_0x1497fe)[_0xef56('0xc')](function(_0x4b00d7){logger['info'](_0xef56('0xd'),_0x20d758,_0xef56('0xe'));logger[_0xef56('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x20d758,_0xef56('0xe'),JSON['stringify'](_0x4b00d7));if(_0x4b00d7[_0xef56('0x10')]){if(_0x4b00d7[_0xef56('0x10')][_0xef56('0x11')]===0x1f4){logger[_0xef56('0x10')](_0xef56('0xd'),_0x20d758,_0x4b00d7[_0xef56('0x10')][_0xef56('0x12')]);return _0x4e4a8d(_0x4b00d7['error'][_0xef56('0x12')]);}logger[_0xef56('0x10')](_0xef56('0xd'),_0x20d758,_0x4b00d7['error'][_0xef56('0x12')]);return _0x2407fe(_0x4b00d7['error'][_0xef56('0x12')]);}else{logger['info'](_0xef56('0xd'),_0x20d758,_0xef56('0xe'));_0x2407fe(_0x4b00d7[_0xef56('0x13')]['message']);}})['catch'](function(_0x2b8e05){logger[_0xef56('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x20d758,_0x2b8e05);_0x4e4a8d(_0x2b8e05);});});} \ No newline at end of file +var _0x2c6c=['code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x2c6c,0x1bb));var _0xc2c6=function(_0x2c4d43,_0x528a91){_0x2c4d43=_0x2c4d43-0x0;var _0x4ae76a=_0x2c6c[_0x2c4d43];return _0x4ae76a;};'use strict';var _=require('lodash');var util=require(_0xc2c6('0x0'));var moment=require(_0xc2c6('0x1'));var BPromise=require(_0xc2c6('0x2'));var rs=require(_0xc2c6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc2c6('0x4'));var logger=require(_0xc2c6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2c6('0x6'));var client=jayson[_0xc2c6('0x7')][_0xc2c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13e9be,_0x1f224d,_0x440d72){return new BPromise(function(_0x22129c,_0x4e6401){return client[_0xc2c6('0x9')](_0x13e9be,_0x440d72)[_0xc2c6('0xa')](function(_0x37612f){logger[_0xc2c6('0xb')](_0xc2c6('0xc'),_0x1f224d,'request\x20sent');logger[_0xc2c6('0xd')](_0xc2c6('0xe'),_0x1f224d,'request\x20sent',JSON[_0xc2c6('0xf')](_0x37612f));if(_0x37612f['error']){if(_0x37612f[_0xc2c6('0x10')][_0xc2c6('0x11')]===0x1f4){logger['error'](_0xc2c6('0xc'),_0x1f224d,_0x37612f[_0xc2c6('0x10')][_0xc2c6('0x12')]);return _0x4e6401(_0x37612f[_0xc2c6('0x10')]['message']);}logger[_0xc2c6('0x10')](_0xc2c6('0xc'),_0x1f224d,_0x37612f[_0xc2c6('0x10')][_0xc2c6('0x12')]);return _0x22129c(_0x37612f['error']['message']);}else{logger[_0xc2c6('0xb')](_0xc2c6('0xc'),_0x1f224d,'request\x20sent');_0x22129c(_0x37612f[_0xc2c6('0x13')][_0xc2c6('0x12')]);}})['catch'](function(_0x5d2eee){logger[_0xc2c6('0x10')](_0xc2c6('0xc'),_0x1f224d,_0x5d2eee);_0x4e6401(_0x5d2eee);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b62177c..aa0ac8a 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x184b3d,_0x19645f){var _0x7a6ad5=function(_0x309bde){while(--_0x309bde){_0x184b3d['push'](_0x184b3d['shift']());}};_0x7a6ad5(++_0x19645f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index b92a912..04d75a1 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 _0x1cc7=['string','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist'];(function(_0x5b8646,_0x3e1589){var _0x363e4c=function(_0x37484a){while(--_0x37484a){_0x5b8646['push'](_0x5b8646['shift']());}};_0x363e4c(++_0x3e1589);}(_0x1cc7,0x15a));var _0x71cc=function(_0x1a8e10,_0x214c0a){_0x1a8e10=_0x1a8e10-0x0;var _0xf8b1b4=_0x1cc7[_0x1a8e10];return _0xf8b1b4;};'use strict';var Sequelize=require(_0x71cc('0x0'));module[_0x71cc('0x1')]={'type':{'type':Sequelize[_0x71cc('0x2')]('string','variable','customVariable',_0x71cc('0x3'),_0x71cc('0x4')),'defaultValue':_0x71cc('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x71cc('0x5'),'variable',_0x71cc('0x6'))},'keyContent':{'type':Sequelize[_0x71cc('0x7')]},'idField':{'type':Sequelize[_0x71cc('0x7')]},'nameField':{'type':Sequelize[_0x71cc('0x7')]},'customField':{'type':Sequelize[_0x71cc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0bde=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x177ea2,_0x422b87){var _0x2eaf79=function(_0x25c2c8){while(--_0x25c2c8){_0x177ea2['push'](_0x177ea2['shift']());}};_0x2eaf79(++_0x422b87);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe0bd('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe0bd('0x1'),_0xe0bd('0x2'),_0xe0bd('0x3'),_0xe0bd('0x4'),_0xe0bd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe0bd('0x6')]},'key':{'type':Sequelize[_0xe0bd('0x6')]},'keyType':{'type':Sequelize[_0xe0bd('0x7')](_0xe0bd('0x1'),_0xe0bd('0x2'),_0xe0bd('0x3'))},'keyContent':{'type':Sequelize[_0xe0bd('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe0bd('0x6')]},'customField':{'type':Sequelize[_0xe0bd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1df1706..18a30ac 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 _0x46ed=['merge','VIRTUAL','options','includeAll','catch','params','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','limit','sort','where','pick','filter'];(function(_0x5759a2,_0x42eaf4){var _0x26c197=function(_0x1308e5){while(--_0x1308e5){_0x5759a2['push'](_0x5759a2['shift']());}};_0x26c197(++_0x42eaf4);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=_0x417402[_0xd46e('0x1c')],_0x36a317=_0x44a620[_0xd46e('0x1d')],_0x47fa8f=_0x44a620['offset']+_0x44a620['limit'],_0x1d50a5;if(_0x47fa8f>=_0x3d72ce){_0x47fa8f=_0x3d72ce;_0x1d50a5=0xc8;}else{_0x1d50a5=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x1d50a5);return _0x3b6d25[_0xd46e('0x1e')]('Content-Range',_0x36a317+'-'+_0x47fa8f+'/'+_0x3d72ce)['json'](_0x417402);}return null;};}function patchUpdates(_0x2d6f2c){return function(_0x2f2571){try{jsonpatch[_0xd46e('0x1f')](_0x2f2571,_0x2d6f2c,!![]);}catch(_0x2273c5){return BPromise[_0xd46e('0x20')](_0x2273c5);}return _0x2f2571[_0xd46e('0x21')]();};}function saveUpdates(_0x3b5fa4,_0x327b7e){return function(_0xb4940){if(_0xb4940){return _0xb4940[_0xd46e('0x22')](_0x3b5fa4)[_0xd46e('0x23')](function(_0x5ba94d){return _0x5ba94d;});}return null;};}function removeEntity(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')]()[_0xd46e('0x23')](function(){_0x259072[_0xd46e('0x1b')](0xcc)[_0xd46e('0x25')]();});}};}function handleEntityNotFound(_0x8a1be,_0x62dea5){return function(_0x4cf899){if(!_0x4cf899){_0x8a1be[_0xd46e('0x1a')](0x194);}return _0x4cf899;};}function handleError(_0x5424e5,_0x4b8f6a){_0x4b8f6a=_0x4b8f6a||0x1f4;return function(_0x371054){logger[_0xd46e('0x26')](_0x371054[_0xd46e('0x27')]);if(_0x371054[_0xd46e('0x28')]){delete _0x371054[_0xd46e('0x28')];}_0x5424e5[_0xd46e('0x1b')](_0x4b8f6a)[_0xd46e('0x29')](_0x371054);};}exports['index']=function(_0x45d789,_0x3c301a){var _0xddbce9={},_0x17db79={},_0x96f15c={'count':0x0,'rows':[]};var _0x16e941=_['map'](db[_0xd46e('0x2a')][_0xd46e('0x2b')],function(_0x2d1afe){return{'name':_0x2d1afe[_0xd46e('0x2c')],'type':_0x2d1afe[_0xd46e('0x2d')][_0xd46e('0x2e')]};});_0x17db79[_0xd46e('0x2f')]=_[_0xd46e('0x30')](_0x16e941,_0xd46e('0x28'));_0x17db79[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x45d789[_0xd46e('0x31')]);_0x17db79[_0xd46e('0x33')]=_['intersection'](_0x17db79[_0xd46e('0x2f')],_0x17db79[_0xd46e('0x31')]);_0xddbce9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x17db79['model'],qs[_0xd46e('0x36')](_0x45d789[_0xd46e('0x31')]['fields']));_0xddbce9[_0xd46e('0x34')]=_0xddbce9[_0xd46e('0x34')]['length']?_0xddbce9[_0xd46e('0x34')]:_0x17db79[_0xd46e('0x2f')];if(!_0x45d789[_0xd46e('0x31')]['hasOwnProperty']('nolimit')){_0xddbce9[_0xd46e('0x37')]=qs[_0xd46e('0x37')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x37')]);_0xddbce9[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x1d')]);}_0xddbce9['order']=qs[_0xd46e('0x38')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x38')]);_0xddbce9[_0xd46e('0x39')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3a')](_0x45d789[_0xd46e('0x31')],_0x17db79['filters']),_0x16e941);if(_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]){_0xddbce9['where']=_[_0xd46e('0x3c')](_0xddbce9[_0xd46e('0x39')],{'$or':_[_0xd46e('0x30')](_0x16e941,function(_0x3b6e67){if(_0x3b6e67['type']!==_0xd46e('0x3d')){var _0x3ecf34={};_0x3ecf34[_0x3b6e67[_0xd46e('0x28')]]={'$like':'%'+_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]+'%'};return _0x3ecf34;}})});}_0xddbce9=_[_0xd46e('0x3c')]({},_0xddbce9,_0x45d789[_0xd46e('0x3e')]);var _0x411318={'where':_0xddbce9['where']};return db[_0xd46e('0x2a')][_0xd46e('0x1c')](_0x411318)[_0xd46e('0x23')](function(_0x25657a){_0x96f15c[_0xd46e('0x1c')]=_0x25657a;if(_0x45d789['query'][_0xd46e('0x3f')]){_0xddbce9['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0xddbce9);})['then'](function(_0x17c3d9){_0x96f15c['rows']=_0x17c3d9;return _0x96f15c;})[_0xd46e('0x23')](respondWithFilteredResult(_0x3c301a,_0xddbce9))[_0xd46e('0x40')](handleError(_0x3c301a,null));};exports['show']=function(_0x462477,_0x4114e6){var _0x3bd5e9={'raw':!![],'where':{'id':_0x462477[_0xd46e('0x41')]['id']}},_0x31ba12={};_0x31ba12[_0xd46e('0x2f')]=_[_0xd46e('0x32')](db[_0xd46e('0x2a')][_0xd46e('0x2b')]);_0x31ba12[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x462477['query']);_0x31ba12['filters']=_['intersection'](_0x31ba12[_0xd46e('0x2f')],_0x31ba12['query']);_0x3bd5e9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x31ba12[_0xd46e('0x2f')],qs[_0xd46e('0x36')](_0x462477[_0xd46e('0x31')][_0xd46e('0x36')]));_0x3bd5e9[_0xd46e('0x34')]=_0x3bd5e9[_0xd46e('0x34')]['length']?_0x3bd5e9[_0xd46e('0x34')]:_0x31ba12['model'];if(_0x462477[_0xd46e('0x31')][_0xd46e('0x3f')]){_0x3bd5e9[_0xd46e('0x42')]=[{'all':!![]}];}_0x3bd5e9=_[_0xd46e('0x3c')]({},_0x3bd5e9,_0x462477[_0xd46e('0x3e')]);return db['SugarcrmField'][_0xd46e('0x43')](_0x3bd5e9)[_0xd46e('0x23')](handleEntityNotFound(_0x4114e6,null))[_0xd46e('0x23')](respondWithResult(_0x4114e6,null))[_0xd46e('0x40')](handleError(_0x4114e6,null));};exports[_0xd46e('0x44')]=function(_0x587784,_0x11fdda){return db[_0xd46e('0x2a')][_0xd46e('0x44')](_0x587784[_0xd46e('0x45')],{})[_0xd46e('0x23')](respondWithResult(_0x11fdda,0xc9))['catch'](handleError(_0x11fdda,null));};exports[_0xd46e('0x22')]=function(_0x3ea9e6,_0x45baf1){if(_0x3ea9e6[_0xd46e('0x45')]['id']){delete _0x3ea9e6[_0xd46e('0x45')]['id'];}return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x3ea9e6[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x45baf1,null))[_0xd46e('0x23')](saveUpdates(_0x3ea9e6[_0xd46e('0x45')],null))[_0xd46e('0x23')](respondWithResult(_0x45baf1,null))[_0xd46e('0x40')](handleError(_0x45baf1,null));};exports[_0xd46e('0x24')]=function(_0x4e84c8,_0x4ae314){return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x4e84c8[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ae314,null))['then'](removeEntity(_0x4ae314,null))[_0xd46e('0x40')](handleError(_0x4ae314,null));}; \ No newline at end of file +var _0x7dfd=['html-pdf','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find'];(function(_0x5a4ff7,_0x5c6ab3){var _0x3c1591=function(_0x546f3d){while(--_0x546f3d){_0x5a4ff7['push'](_0x5a4ff7['shift']());}};_0x3c1591(++_0x5c6ab3);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd7df('0x0'));var emlformat=require(_0xd7df('0x1'));var rimraf=require(_0xd7df('0x2'));var zipdir=require(_0xd7df('0x3'));var jsonpatch=require(_0xd7df('0x4'));var rp=require(_0xd7df('0x5'));var moment=require(_0xd7df('0x6'));var BPromise=require(_0xd7df('0x7'));var Mustache=require(_0xd7df('0x8'));var util=require(_0xd7df('0x9'));var path=require(_0xd7df('0xa'));var sox=require(_0xd7df('0xb'));var csv=require(_0xd7df('0xc'));var ejs=require(_0xd7df('0xd'));var fs=require('fs');var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xc'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=_0x23cdbc[_0xd7df('0x20')],_0x18d38f=_0x4c5cf[_0xd7df('0x21')],_0xbe1c5e=_0x4c5cf[_0xd7df('0x21')]+_0x4c5cf['limit'],_0x5d3beb;if(_0xbe1c5e>=_0x513b13){_0xbe1c5e=_0x513b13;_0x5d3beb=0xc8;}else{_0x5d3beb=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x5d3beb);return _0x57b8be[_0xd7df('0x22')](_0xd7df('0x23'),_0x18d38f+'-'+_0xbe1c5e+'/'+_0x513b13)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x96d86e){return function(_0x20dc3e){try{jsonpatch[_0xd7df('0x24')](_0x20dc3e,_0x96d86e,!![]);}catch(_0x5acb0a){return BPromise[_0xd7df('0x25')](_0x5acb0a);}return _0x20dc3e['save']();};}function saveUpdates(_0x225e33,_0x5ab737){return function(_0x3ae7c3){if(_0x3ae7c3){return _0x3ae7c3[_0xd7df('0x26')](_0x225e33)[_0xd7df('0x27')](function(_0x5e59c3){return _0x5e59c3;});}return null;};}function removeEntity(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x28')]()[_0xd7df('0x27')](function(){_0xc50077[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0xa80cbf,_0x1e3bf3){return function(_0x5e5c1a){if(!_0x5e5c1a){_0xa80cbf['sendStatus'](0x194);}return _0x5e5c1a;};}function handleError(_0x36f2bd,_0x38db14){_0x38db14=_0x38db14||0x1f4;return function(_0x26047f){logger[_0xd7df('0x29')](_0x26047f[_0xd7df('0x2a')]);if(_0x26047f[_0xd7df('0x2b')]){delete _0x26047f[_0xd7df('0x2b')];}_0x36f2bd[_0xd7df('0x1d')](_0x38db14)[_0xd7df('0x2c')](_0x26047f);};}exports['index']=function(_0xe53f53,_0x132fd1){var _0x46c0db={},_0x29f0e8={},_0x29b812={'count':0x0,'rows':[]};var _0x2aa5a8=_[_0xd7df('0x2d')](db[_0xd7df('0x2e')]['rawAttributes'],function(_0x4ba779){return{'name':_0x4ba779['fieldName'],'type':_0x4ba779['type']['key']};});_0x29f0e8[_0xd7df('0x2f')]=_['map'](_0x2aa5a8,_0xd7df('0x2b'));_0x29f0e8[_0xd7df('0x30')]=_['keys'](_0xe53f53[_0xd7df('0x30')]);_0x29f0e8[_0xd7df('0x31')]=_['intersection'](_0x29f0e8[_0xd7df('0x2f')],_0x29f0e8[_0xd7df('0x30')]);_0x46c0db[_0xd7df('0x32')]=_[_0xd7df('0x33')](_0x29f0e8[_0xd7df('0x2f')],qs[_0xd7df('0x34')](_0xe53f53['query'][_0xd7df('0x34')]));_0x46c0db[_0xd7df('0x32')]=_0x46c0db[_0xd7df('0x32')][_0xd7df('0x35')]?_0x46c0db[_0xd7df('0x32')]:_0x29f0e8[_0xd7df('0x2f')];if(!_0xe53f53[_0xd7df('0x30')][_0xd7df('0x36')](_0xd7df('0x37'))){_0x46c0db[_0xd7df('0x38')]=qs[_0xd7df('0x38')](_0xe53f53['query']['limit']);_0x46c0db[_0xd7df('0x21')]=qs['offset'](_0xe53f53[_0xd7df('0x30')][_0xd7df('0x21')]);}_0x46c0db[_0xd7df('0x39')]=qs[_0xd7df('0x3a')](_0xe53f53['query']['sort']);_0x46c0db['where']=qs[_0xd7df('0x31')](_[_0xd7df('0x3b')](_0xe53f53['query'],_0x29f0e8[_0xd7df('0x31')]),_0x2aa5a8);if(_0xe53f53[_0xd7df('0x30')][_0xd7df('0x3c')]){_0x46c0db[_0xd7df('0x3d')]=_['merge'](_0x46c0db[_0xd7df('0x3d')],{'$or':_[_0xd7df('0x2d')](_0x2aa5a8,function(_0x5f0a6d){if(_0x5f0a6d[_0xd7df('0x3e')]!=='VIRTUAL'){var _0x15089f={};_0x15089f[_0x5f0a6d[_0xd7df('0x2b')]]={'$like':'%'+_0xe53f53[_0xd7df('0x30')]['filter']+'%'};return _0x15089f;}})});}_0x46c0db=_[_0xd7df('0x3f')]({},_0x46c0db,_0xe53f53[_0xd7df('0x40')]);var _0x3d5e80={'where':_0x46c0db[_0xd7df('0x3d')]};return db['SugarcrmField'][_0xd7df('0x20')](_0x3d5e80)[_0xd7df('0x27')](function(_0x2314e6){_0x29b812['count']=_0x2314e6;if(_0xe53f53[_0xd7df('0x30')][_0xd7df('0x41')]){_0x46c0db[_0xd7df('0x42')]=[{'all':!![]}];}return db['SugarcrmField'][_0xd7df('0x43')](_0x46c0db);})[_0xd7df('0x27')](function(_0x4910cb){_0x29b812['rows']=_0x4910cb;return _0x29b812;})[_0xd7df('0x27')](respondWithFilteredResult(_0x132fd1,_0x46c0db))[_0xd7df('0x44')](handleError(_0x132fd1,null));};exports[_0xd7df('0x45')]=function(_0x4a5152,_0x5e8cd0){var _0x2c149e={'raw':!![],'where':{'id':_0x4a5152[_0xd7df('0x46')]['id']}},_0x4ebdbe={};_0x4ebdbe['model']=_['keys'](db[_0xd7df('0x2e')]['rawAttributes']);_0x4ebdbe[_0xd7df('0x30')]=_[_0xd7df('0x47')](_0x4a5152[_0xd7df('0x30')]);_0x4ebdbe[_0xd7df('0x31')]=_[_0xd7df('0x33')](_0x4ebdbe[_0xd7df('0x2f')],_0x4ebdbe[_0xd7df('0x30')]);_0x2c149e[_0xd7df('0x32')]=_[_0xd7df('0x33')](_0x4ebdbe['model'],qs[_0xd7df('0x34')](_0x4a5152['query'][_0xd7df('0x34')]));_0x2c149e[_0xd7df('0x32')]=_0x2c149e[_0xd7df('0x32')][_0xd7df('0x35')]?_0x2c149e[_0xd7df('0x32')]:_0x4ebdbe[_0xd7df('0x2f')];if(_0x4a5152[_0xd7df('0x30')][_0xd7df('0x41')]){_0x2c149e[_0xd7df('0x42')]=[{'all':!![]}];}_0x2c149e=_['merge']({},_0x2c149e,_0x4a5152[_0xd7df('0x40')]);return db[_0xd7df('0x2e')]['find'](_0x2c149e)['then'](handleEntityNotFound(_0x5e8cd0,null))[_0xd7df('0x27')](respondWithResult(_0x5e8cd0,null))[_0xd7df('0x44')](handleError(_0x5e8cd0,null));};exports[_0xd7df('0x48')]=function(_0x51748d,_0x4b1184){return db[_0xd7df('0x2e')]['create'](_0x51748d[_0xd7df('0x49')],{})[_0xd7df('0x27')](respondWithResult(_0x4b1184,0xc9))[_0xd7df('0x44')](handleError(_0x4b1184,null));};exports[_0xd7df('0x26')]=function(_0x1838aa,_0x28c13f){if(_0x1838aa[_0xd7df('0x49')]['id']){delete _0x1838aa[_0xd7df('0x49')]['id'];}return db[_0xd7df('0x2e')][_0xd7df('0x4a')]({'where':{'id':_0x1838aa[_0xd7df('0x46')]['id']}})[_0xd7df('0x27')](handleEntityNotFound(_0x28c13f,null))['then'](saveUpdates(_0x1838aa[_0xd7df('0x49')],null))[_0xd7df('0x27')](respondWithResult(_0x28c13f,null))[_0xd7df('0x44')](handleError(_0x28c13f,null));};exports[_0xd7df('0x28')]=function(_0x215251,_0x5c3281){return db[_0xd7df('0x2e')][_0xd7df('0x4a')]({'where':{'id':_0x215251[_0xd7df('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c3281,null))[_0xd7df('0x27')](removeEntity(_0x5c3281,null))['catch'](handleError(_0x5c3281,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8d6ec55..75ea83b 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 _0x250d=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','../../config/logger','api','moment','bluebird'];(function(_0x3c9fa3,_0x2d26f4){var _0x42854a=function(_0xeab2d0){while(--_0xeab2d0){_0x3c9fa3['push'](_0x3c9fa3['shift']());}};_0x42854a(++_0x2d26f4);}(_0x250d,0xbf));var _0xd250=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x250d[_0x2dbcef];return _0x5a90ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd250('0x0'))(_0xd250('0x1'));var moment=require(_0xd250('0x2'));var BPromise=require(_0xd250('0x3'));var rp=require(_0xd250('0x4'));var fs=require('fs');var path=require(_0xd250('0x5'));var rimraf=require(_0xd250('0x6'));var config=require(_0xd250('0x7'));var attributes=require(_0xd250('0x8'));module[_0xd250('0x9')]=function(_0x19df14,_0x14f7be){return _0x19df14[_0xd250('0xa')](_0xd250('0xb'),attributes,{'tableName':_0xd250('0xc'),'paranoid':![],'indexes':[{'name':_0xd250('0xd'),'fields':[_0xd250('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcc1=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x193979,_0x287848){var _0x5b69ab=function(_0x5e5b8e){while(--_0x5e5b8e){_0x193979['push'](_0x193979['shift']());}};_0x5b69ab(++_0x287848);}(_0xdcc1,0x9a));var _0x1dcc=function(_0x4302ec,_0x122d9e){_0x4302ec=_0x4302ec-0x0;var _0x49e979=_0xdcc1[_0x4302ec];return _0x49e979;};'use strict';var _=require('lodash');var util=require(_0x1dcc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1dcc('0x1'));var BPromise=require(_0x1dcc('0x2'));var rp=require(_0x1dcc('0x3'));var fs=require('fs');var path=require(_0x1dcc('0x4'));var rimraf=require(_0x1dcc('0x5'));var config=require(_0x1dcc('0x6'));var attributes=require(_0x1dcc('0x7'));module[_0x1dcc('0x8')]=function(_0x4f2211,_0x536b8c){return _0x4f2211[_0x1dcc('0x9')](_0x1dcc('0xa'),attributes,{'tableName':_0x1dcc('0xb'),'paranoid':![],'indexes':[{'name':_0x1dcc('0xc'),'fields':[_0x1dcc('0xd'),_0x1dcc('0xe')],'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 4c5de77..8d837f8 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x1b5f32,_0x1aa47b){var _0x37d0d9=function(_0x49258d){while(--_0x49258d){_0x1b5f32['push'](_0x1b5f32['shift']());}};_0x37d0d9(++_0x1aa47b);}(_0x2032,0xd9));var _0x2203=function(_0x3aff1c,_0x9d27e3){_0x3aff1c=_0x3aff1c-0x0;var _0x4f6dc9=_0x2032[_0x3aff1c];return _0x4f6dc9;};'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')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\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);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x24182f,_0x5b066b){var _0x479194=function(_0x33a648){while(--_0x33a648){_0x24182f['push'](_0x24182f['shift']());}};_0x479194(++_0x5b066b);}(_0x14a0,0x8e));var _0x014a=function(_0x50ba3a,_0x2afbd0){_0x50ba3a=_0x50ba3a-0x0;var _0x5a8554=_0x14a0[_0x50ba3a];return _0x5a8554;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b81fae6..99a1d8a 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 _0x9c83=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x3ac224,_0x54f0f9){var _0x56afbf=function(_0x30ea44){while(--_0x30ea44){_0x3ac224['push'](_0x3ac224['shift']());}};_0x56afbf(++_0x54f0f9);}(_0x9c83,0x138));var _0x39c8=function(_0x3985f7,_0x441490){_0x3985f7=_0x3985f7-0x0;var _0x3bafd7=_0x9c83[_0x3985f7];return _0x3bafd7;};'use strict';var multer=require(_0x39c8('0x0'));var util=require('util');var path=require(_0x39c8('0x1'));var timeout=require(_0x39c8('0x2'));var express=require(_0x39c8('0x3'));var router=express['Router']();var auth=require(_0x39c8('0x4'));var interaction=require(_0x39c8('0x5'));var config=require(_0x39c8('0x6'));var controller=require(_0x39c8('0x7'));router[_0x39c8('0x8')]('/',auth[_0x39c8('0x9')](),controller['index']);router['get']('/:id',auth[_0x39c8('0x9')](),controller[_0x39c8('0xa')]);router['get'](_0x39c8('0xb'),auth[_0x39c8('0x9')](),controller[_0x39c8('0xc')]);router[_0x39c8('0x8')](_0x39c8('0xd'),auth[_0x39c8('0x9')](),controller[_0x39c8('0xe')]);router[_0x39c8('0xf')]('/',auth[_0x39c8('0x9')](),controller[_0x39c8('0x10')]);router['post']('/:id/configurations',auth[_0x39c8('0x9')](),controller['addConfiguration']);router[_0x39c8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x39c8('0x12')]);router[_0x39c8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x39c8('0x14')]);module[_0x39c8('0x15')]=router; \ No newline at end of file +var _0xaf74=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x95ac8b,_0x3706f5){var _0x5b0792=function(_0x215405){while(--_0x215405){_0x95ac8b['push'](_0x95ac8b['shift']());}};_0x5b0792(++_0x3706f5);}(_0xaf74,0x173));var _0x4af7=function(_0x42c38d,_0x393918){_0x42c38d=_0x42c38d-0x0;var _0x155420=_0xaf74[_0x42c38d];return _0x155420;};'use strict';var multer=require('multer');var util=require(_0x4af7('0x0'));var path=require(_0x4af7('0x1'));var timeout=require(_0x4af7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4af7('0x3'));var interaction=require(_0x4af7('0x4'));var config=require(_0x4af7('0x5'));var controller=require(_0x4af7('0x6'));router[_0x4af7('0x7')]('/',auth[_0x4af7('0x8')](),controller['index']);router['get'](_0x4af7('0x9'),auth[_0x4af7('0x8')](),controller[_0x4af7('0xa')]);router['get'](_0x4af7('0xb'),auth[_0x4af7('0x8')](),controller[_0x4af7('0xc')]);router[_0x4af7('0x7')](_0x4af7('0xd'),auth[_0x4af7('0x8')](),controller['getFields']);router[_0x4af7('0xe')]('/',auth['isAuthenticated'](),controller[_0x4af7('0xf')]);router[_0x4af7('0xe')](_0x4af7('0xb'),auth[_0x4af7('0x8')](),controller['addConfiguration']);router['put'](_0x4af7('0x9'),auth[_0x4af7('0x8')](),controller[_0x4af7('0x10')]);router[_0x4af7('0x11')](_0x4af7('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x4af7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index f802322..54f425c 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 _0xd337=['exports','STRING','HelpDesk','sequelize'];(function(_0x13bb38,_0x120811){var _0x49f2b0=function(_0x5ea6d2){while(--_0x5ea6d2){_0x13bb38['push'](_0x13bb38['shift']());}};_0x49f2b0(++_0x120811);}(_0xd337,0xc3));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7d33('0x0'));module[_0x7d33('0x1')]={'name':{'type':Sequelize[_0x7d33('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d33('0x2')]},'username':{'type':Sequelize[_0x7d33('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7d33('0x2')],'allowNull':![],'defaultValue':_0x7d33('0x3')},'remoteUri':{'type':Sequelize[_0x7d33('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7d33('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf831=['exports','STRING'];(function(_0x476ee0,_0xc72b45){var _0x1e699a=function(_0x27c046){while(--_0x27c046){_0x476ee0['push'](_0x476ee0['shift']());}};_0x1e699a(++_0xc72b45);}(_0xf831,0x72));var _0x1f83=function(_0x5040f0,_0x45af33){_0x5040f0=_0x5040f0-0x0;var _0x1615be=_0xf831[_0x5040f0];return _0x1615be;};'use strict';var Sequelize=require('sequelize');module[_0x1f83('0x0')]={'name':{'type':Sequelize[_0x1f83('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1f83('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x1f83('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1f83('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1f83('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7d15621..b555dde 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 _0x596d=['substring','lastIndexOf','format','GET','getchallenge','success','POST','login','sessionName','reference','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','destroy','end','stack','name','send','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','update','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','channel','Descriptions','VtigerField','Subjects','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice'];(function(_0x4c7ec9,_0x4a755f){var _0x3fe95a=function(_0x1f2c26){while(--_0x1f2c26){_0x4c7ec9['push'](_0x4c7ec9['shift']());}};_0x3fe95a(++_0x4a755f);}(_0x596d,0x19c));var _0xd596=function(_0x48539a,_0x47c81b){_0x48539a=_0x48539a-0x0;var _0x17a653=_0x596d[_0x48539a];return _0x17a653;};'use strict';var pdf=require(_0xd596('0x0'));var emlformat=require(_0xd596('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd596('0x2'));var jsonpatch=require(_0xd596('0x3'));var rp=require(_0xd596('0x4'));var moment=require(_0xd596('0x5'));var BPromise=require(_0xd596('0x6'));var Mustache=require(_0xd596('0x7'));var util=require('util');var path=require(_0xd596('0x8'));var sox=require(_0xd596('0x9'));var csv=require('to-csv');var ejs=require(_0xd596('0xa'));var fs=require('fs');var _=require(_0xd596('0xb'));var squel=require(_0xd596('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd596('0xd'));var toCsv=require(_0xd596('0xe'));var querystring=require(_0xd596('0xf'));var Papa=require(_0xd596('0x10'));var Redis=require(_0xd596('0x11'));var authService=require(_0xd596('0x12'));var qs=require(_0xd596('0x13'));var as=require(_0xd596('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd596('0x15'));var utils=require(_0xd596('0x16'));var config=require(_0xd596('0x17'));var licenseUtil=require(_0xd596('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd596('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xd596('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5df88e,_0x341a25,_0x3e0731,_0x525ca9){return new BPromise(function(_0x3232cf,_0x4730d8){var _0x1991b7=_0x525ca9||client;return _0x1991b7[_0xd596('0x1b')](_0x5df88e,_0x3e0731)[_0xd596('0x1c')](function(_0x4ba619){logger[_0xd596('0x1d')]('VtigerAccount,\x20%s,\x20%s',_0x341a25,'request\x20sent');logger[_0xd596('0x1e')](_0xd596('0x1f'),_0x341a25,_0xd596('0x20'),JSON[_0xd596('0x21')](_0x4ba619));if(_0x4ba619[_0xd596('0x22')]){if(_0x4ba619['error']['code']===0x1f4){logger[_0xd596('0x22')](_0xd596('0x23'),_0x341a25,_0x4ba619[_0xd596('0x22')][_0xd596('0x24')]);return _0x4730d8(_0x4ba619['error']['message']);}logger[_0xd596('0x22')](_0xd596('0x23'),_0x341a25,_0x4ba619['error'][_0xd596('0x24')]);return _0x3232cf(_0x4ba619[_0xd596('0x22')]['message']);}else{logger[_0xd596('0x1d')](_0xd596('0x23'),_0x341a25,_0xd596('0x20'));_0x3232cf(_0x4ba619[_0xd596('0x25')][_0xd596('0x24')]);}})[_0xd596('0x26')](function(_0xe011e9){logger[_0xd596('0x22')](_0xd596('0x23'),_0x341a25,_0xe011e9);_0x4730d8(_0xe011e9);});});}function respondWithStatusCode(_0xcb09f2,_0x1db3b2){_0x1db3b2=_0x1db3b2||0xcc;return function(_0x4a5740){if(_0x4a5740){return _0xcb09f2[_0xd596('0x27')](_0x1db3b2);}return _0xcb09f2[_0xd596('0x28')](_0x1db3b2)['end']();};}function respondWithResult(_0x1c63b8,_0x2a84cb){_0x2a84cb=_0x2a84cb||0xc8;return function(_0x3bab69){if(_0x3bab69){return _0x1c63b8['status'](_0x2a84cb)[_0xd596('0x29')](_0x3bab69);}};}function respondWithFilteredResult(_0x12b054,_0x156f82){return function(_0x19f0f0){if(_0x19f0f0){var _0x49ab79=_0x19f0f0[_0xd596('0x2a')],_0xd25c00=_0x156f82[_0xd596('0x2b')],_0x35163c=_0x156f82['offset']+_0x156f82[_0xd596('0x2c')],_0x384ca4;if(_0x35163c>=_0x49ab79){_0x35163c=_0x49ab79;_0x384ca4=0xc8;}else{_0x384ca4=0xce;}_0x12b054[_0xd596('0x28')](_0x384ca4);return _0x12b054['set'](_0xd596('0x2d'),_0xd25c00+'-'+_0x35163c+'/'+_0x49ab79)[_0xd596('0x29')](_0x19f0f0);}return null;};}function patchUpdates(_0x14eb1b){return function(_0x3ead85){try{jsonpatch[_0xd596('0x2e')](_0x3ead85,_0x14eb1b,!![]);}catch(_0x197c8e){return BPromise[_0xd596('0x2f')](_0x197c8e);}return _0x3ead85['save']();};}function saveUpdates(_0x56afe6,_0xf942b6){return function(_0x4994a0){if(_0x4994a0){return _0x4994a0['update'](_0x56afe6)[_0xd596('0x1c')](function(_0x37d36d){return _0x37d36d;});}return null;};}function removeEntity(_0x188098,_0x8328b){return function(_0x5802c8){if(_0x5802c8){return _0x5802c8[_0xd596('0x30')]()[_0xd596('0x1c')](function(){_0x188098[_0xd596('0x28')](0xcc)[_0xd596('0x31')]();});}};}function handleEntityNotFound(_0x56c2a5,_0x1ae672){return function(_0x5d5776){if(!_0x5d5776){_0x56c2a5['sendStatus'](0x194);}return _0x5d5776;};}function handleError(_0x6ae61c,_0x17fda8){_0x17fda8=_0x17fda8||0x1f4;return function(_0x302eec){logger[_0xd596('0x22')](_0x302eec[_0xd596('0x32')]);if(_0x302eec['name']){delete _0x302eec[_0xd596('0x33')];}_0x6ae61c[_0xd596('0x28')](_0x17fda8)[_0xd596('0x34')](_0x302eec);};}exports['index']=function(_0x187d12,_0x259db3){var _0x122d27={},_0x263781={},_0x5b7828={'count':0x0,'rows':[]};var _0x4dde20=_['map'](db[_0xd596('0x35')][_0xd596('0x36')],function(_0x104b3a){return{'name':_0x104b3a[_0xd596('0x37')],'type':_0x104b3a[_0xd596('0x38')][_0xd596('0x39')]};});_0x263781[_0xd596('0x3a')]=_['map'](_0x4dde20,'name');_0x263781[_0xd596('0x3b')]=_[_0xd596('0x3c')](_0x187d12['query']);_0x263781[_0xd596('0x3d')]=_['intersection'](_0x263781[_0xd596('0x3a')],_0x263781[_0xd596('0x3b')]);_0x122d27[_0xd596('0x3e')]=_[_0xd596('0x3f')](_0x263781[_0xd596('0x3a')],qs['fields'](_0x187d12[_0xd596('0x3b')][_0xd596('0x40')]));_0x122d27[_0xd596('0x3e')]=_0x122d27['attributes'][_0xd596('0x41')]?_0x122d27[_0xd596('0x3e')]:_0x263781[_0xd596('0x3a')];if(!_0x187d12[_0xd596('0x3b')][_0xd596('0x42')](_0xd596('0x43'))){_0x122d27[_0xd596('0x2c')]=qs['limit'](_0x187d12['query'][_0xd596('0x2c')]);_0x122d27['offset']=qs[_0xd596('0x2b')](_0x187d12['query']['offset']);}_0x122d27[_0xd596('0x44')]=qs[_0xd596('0x45')](_0x187d12[_0xd596('0x3b')][_0xd596('0x45')]);_0x122d27[_0xd596('0x46')]=qs['filters'](_[_0xd596('0x47')](_0x187d12[_0xd596('0x3b')],_0x263781[_0xd596('0x3d')]),_0x4dde20);if(_0x187d12[_0xd596('0x3b')][_0xd596('0x48')]){_0x122d27[_0xd596('0x46')]=_[_0xd596('0x49')](_0x122d27[_0xd596('0x46')],{'$or':_[_0xd596('0x4a')](_0x4dde20,function(_0x5547dd){if(_0x5547dd['type']!==_0xd596('0x4b')){var _0x133153={};_0x133153[_0x5547dd[_0xd596('0x33')]]={'$like':'%'+_0x187d12[_0xd596('0x3b')][_0xd596('0x48')]+'%'};return _0x133153;}})});}_0x122d27=_['merge']({},_0x122d27,_0x187d12[_0xd596('0x4c')]);var _0x22e117={'where':_0x122d27['where']};return db[_0xd596('0x35')]['count'](_0x22e117)[_0xd596('0x1c')](function(_0x3f5c2a){_0x5b7828[_0xd596('0x2a')]=_0x3f5c2a;if(_0x187d12[_0xd596('0x3b')][_0xd596('0x4d')]){_0x122d27[_0xd596('0x4e')]=[{'all':!![]}];}return db[_0xd596('0x35')][_0xd596('0x4f')](_0x122d27);})[_0xd596('0x1c')](function(_0x3ead23){_0x5b7828[_0xd596('0x50')]=_0x3ead23;return _0x5b7828;})['then'](respondWithFilteredResult(_0x259db3,_0x122d27))[_0xd596('0x26')](handleError(_0x259db3,null));};exports[_0xd596('0x51')]=function(_0x249332,_0x39f724){var _0x460eec={'raw':![],'where':{'id':_0x249332[_0xd596('0x52')]['id']}},_0x52c565={};_0x52c565['model']=_[_0xd596('0x3c')](db[_0xd596('0x35')][_0xd596('0x36')]);_0x52c565[_0xd596('0x3b')]=_[_0xd596('0x3c')](_0x249332[_0xd596('0x3b')]);_0x52c565[_0xd596('0x3d')]=_[_0xd596('0x3f')](_0x52c565['model'],_0x52c565[_0xd596('0x3b')]);_0x460eec['attributes']=_[_0xd596('0x3f')](_0x52c565[_0xd596('0x3a')],qs[_0xd596('0x40')](_0x249332[_0xd596('0x3b')][_0xd596('0x40')]));_0x460eec[_0xd596('0x3e')]=_0x460eec[_0xd596('0x3e')]['length']?_0x460eec['attributes']:_0x52c565[_0xd596('0x3a')];if(_0x249332[_0xd596('0x3b')]['includeAll']){_0x460eec[_0xd596('0x4e')]=[{'all':!![]}];}_0x460eec=_[_0xd596('0x49')]({},_0x460eec,_0x249332[_0xd596('0x4c')]);return db[_0xd596('0x35')]['find'](_0x460eec)[_0xd596('0x1c')](handleEntityNotFound(_0x39f724,null))[_0xd596('0x1c')](respondWithResult(_0x39f724,null))[_0xd596('0x26')](handleError(_0x39f724,null));};exports[_0xd596('0x53')]=function(_0x28d5f4,_0xe8c42c){return db[_0xd596('0x35')][_0xd596('0x53')](_0x28d5f4[_0xd596('0x54')],{})['then'](respondWithResult(_0xe8c42c,0xc9))['catch'](handleError(_0xe8c42c,null));};exports[_0xd596('0x55')]=function(_0x22ac91,_0x39c1ea){if(_0x22ac91[_0xd596('0x54')]['id']){delete _0x22ac91[_0xd596('0x54')]['id'];}return db[_0xd596('0x35')][_0xd596('0x56')]({'where':{'id':_0x22ac91['params']['id']}})[_0xd596('0x1c')](handleEntityNotFound(_0x39c1ea,null))[_0xd596('0x1c')](saveUpdates(_0x22ac91[_0xd596('0x54')],null))['then'](respondWithResult(_0x39c1ea,null))[_0xd596('0x26')](handleError(_0x39c1ea,null));};exports['destroy']=function(_0x506157,_0x12e47e){return db[_0xd596('0x35')]['find']({'where':{'id':_0x506157[_0xd596('0x52')]['id']}})[_0xd596('0x1c')](handleEntityNotFound(_0x12e47e,null))[_0xd596('0x1c')](removeEntity(_0x12e47e,null))[_0xd596('0x26')](handleError(_0x12e47e,null));};exports[_0xd596('0x57')]=function(_0x167d54,_0x182618,_0x46649d){var _0x498946={};var _0x142731={};var _0x38bc35;var _0x443543;return db[_0xd596('0x35')][_0xd596('0x58')]({'where':{'id':_0x167d54['params']['id']}})[_0xd596('0x1c')](handleEntityNotFound(_0x182618,null))['then'](function(_0x1dc561){if(_0x1dc561){_0x38bc35=_0x1dc561;_0x142731[_0xd596('0x3a')]=_['keys'](db[_0xd596('0x59')]['rawAttributes']);_0x142731[_0xd596('0x3b')]=_['keys'](_0x167d54[_0xd596('0x3b')]);_0x142731[_0xd596('0x3d')]=_[_0xd596('0x3f')](_0x142731[_0xd596('0x3a')],_0x142731[_0xd596('0x3b')]);_0x498946[_0xd596('0x3e')]=_[_0xd596('0x3f')](_0x142731[_0xd596('0x3a')],qs[_0xd596('0x40')](_0x167d54[_0xd596('0x3b')][_0xd596('0x40')]));_0x498946[_0xd596('0x3e')]=_0x498946[_0xd596('0x3e')][_0xd596('0x41')]?_0x498946[_0xd596('0x3e')]:_0x142731[_0xd596('0x3a')];_0x498946[_0xd596('0x44')]=qs[_0xd596('0x45')](_0x167d54[_0xd596('0x3b')]['sort']);_0x498946[_0xd596('0x46')]=qs[_0xd596('0x3d')](_[_0xd596('0x47')](_0x167d54[_0xd596('0x3b')],_0x142731[_0xd596('0x3d')]));if(_0x167d54[_0xd596('0x3b')][_0xd596('0x48')]){_0x498946['where']=_[_0xd596('0x49')](_0x498946['where'],{'$or':_['map'](_0x498946[_0xd596('0x3e')],function(_0x444b0f){var _0x4a4c25={};_0x4a4c25[_0x444b0f]={'$like':'%'+_0x167d54[_0xd596('0x3b')][_0xd596('0x48')]+'%'};return _0x4a4c25;})});}_0x498946=_[_0xd596('0x49')]({},_0x498946,_0x167d54[_0xd596('0x4c')]);return _0x38bc35[_0xd596('0x57')](_0x498946);}})[_0xd596('0x1c')](function(_0x4d5835){if(_0x4d5835){_0x443543=_0x4d5835['length'];if(!_0x167d54['query'][_0xd596('0x42')](_0xd596('0x43'))){_0x498946[_0xd596('0x2c')]=qs[_0xd596('0x2c')](_0x167d54[_0xd596('0x3b')]['limit']);_0x498946[_0xd596('0x2b')]=qs[_0xd596('0x2b')](_0x167d54['query'][_0xd596('0x2b')]);}return _0x38bc35[_0xd596('0x57')](_0x498946);}})[_0xd596('0x1c')](function(_0x576777){if(_0x576777){return _0x576777?{'count':_0x443543,'rows':_0x576777}:null;}})[_0xd596('0x1c')](respondWithResult(_0x182618,null))[_0xd596('0x26')](handleError(_0x182618,null));};exports[_0xd596('0x5a')]=function(_0x2b8172,_0x9bb598,_0x3dab30){if(_0x2b8172['body']['id']){delete _0x2b8172[_0xd596('0x54')]['id'];}return db[_0xd596('0x35')][_0xd596('0x58')]({'where':{'id':_0x2b8172[_0xd596('0x52')]['id']}})['then'](handleEntityNotFound(_0x9bb598,null))['then'](function(_0x4f9c2c){if(_0x4f9c2c){_0x2b8172[_0xd596('0x54')][_0xd596('0x5b')]=_0x4f9c2c['id'];_0x2b8172[_0xd596('0x54')]['Subjects']=integrations['getSubjects'](_0x2b8172[_0xd596('0x54')][_0xd596('0x5c')],_0x2b8172['body'][_0xd596('0x38')]);_0x2b8172['body'][_0xd596('0x5d')]=integrations['getDescriptions'](_0x2b8172[_0xd596('0x54')][_0xd596('0x5c')],_0x2b8172[_0xd596('0x54')]['type']);return db[_0xd596('0x59')][_0xd596('0x53')](_0x2b8172[_0xd596('0x54')],{'include':[{'model':db[_0xd596('0x5e')],'as':_0xd596('0x5f')},{'model':db['VtigerField'],'as':_0xd596('0x5d')}]});}return null;})[_0xd596('0x1c')](respondWithResult(_0x9bb598,null))[_0xd596('0x26')](handleError(_0x9bb598,null));};var md5=require(_0xd596('0x60'));exports[_0xd596('0x61')]=function(_0x27e04f,_0x598fa0,_0x497b17){var _0x8c6c44=null;var _0x268beb=null;var _0xed2b6a=null;var _0x24fbac=null;var _0x2cb531='';return db[_0xd596('0x35')][_0xd596('0x58')]({'where':{'id':_0x27e04f[_0xd596('0x52')]['id']},'attributes':['id',_0xd596('0x33'),_0xd596('0x62'),'description',_0xd596('0x63'),_0xd596('0x64'),_0xd596('0x65'),_0xd596('0x66')]})[_0xd596('0x1c')](handleEntityNotFound(_0x598fa0,null))['then'](function(_0x49c747){if(_0x49c747){_0x8c6c44=_0x49c747[_0xd596('0x62')];_0x268beb=_0x49c747['accessKey'];_0xed2b6a=_0x49c747[_0xd596('0x63')];_0x2cb531=_0x49c747[_0xd596('0x64')];var _0x53a561=_0x2cb531[_0xd596('0x67')](-0x1);if(_0x53a561==='/'){_0x2cb531=_0x2cb531[_0xd596('0x68')](0x0,_0x2cb531[_0xd596('0x69')](_0x53a561));}_0x24fbac=util[_0xd596('0x6a')]('%s/webservice.php',_0x2cb531);var _0x55f917={'method':_0xd596('0x6b'),'uri':_0x24fbac,'qs':{'operation':_0xd596('0x6c'),'username':_0x49c747['username']},'json':!![]};return rp(_0x55f917);}})[_0xd596('0x1c')](function(_0x21f133){if(_0x21f133[_0xd596('0x6d')]){var _0x199578={'method':_0xd596('0x6e'),'uri':_0x24fbac,'form':{'operation':_0xd596('0x6f'),'username':_0x8c6c44,'accessKey':md5(_0x21f133[_0xd596('0x25')]['token']+_0x268beb)},'json':!![]};return rp(_0x199578);}})['then'](function(_0x2bb947){if(_0x2bb947[_0xd596('0x6d')]){var _0x407452={'method':'GET','uri':_0x24fbac,'qs':{'operation':'describe','username':_0x8c6c44,'sessionName':_0x2bb947[_0xd596('0x25')][_0xd596('0x70')],'elementType':_0xed2b6a},'json':!![]};return rp(_0x407452);}})['then'](function(_0x2c9caa){if(_0x2c9caa[_0xd596('0x6d')]){var _0x219ff5=['autogenerated',_0xd596('0x71'),'owner'];_['remove'](_0x2c9caa[_0xd596('0x25')][_0xd596('0x40')],function(_0x2f4baf){return _0x219ff5[_0xd596('0x72')](_0x2f4baf[_0xd596('0x38')]['name']);});_[_0xd596('0x73')](_0x2c9caa[_0xd596('0x25')][_0xd596('0x40')],function(_0xf9136e){return _0xf9136e[_0xd596('0x74')]===_0xd596('0x75');});return{'count':_0x2c9caa[_0xd596('0x25')][_0xd596('0x40')]['length'],'rows':_[_0xd596('0x4a')](_0x2c9caa['result'][_0xd596('0x40')],function(_0x2fe22f){return{'id':_0x2fe22f['name'],'name':_0x2fe22f[_0xd596('0x76')],'custom':_[_0xd596('0x77')](_0x2fe22f['name'],_0xd596('0x78'))?!![]:![],'options':_0x2fe22f[_0xd596('0x38')][_0xd596('0x33')]===_0xd596('0x79')&&_0x2fe22f[_0xd596('0x38')][_0xd596('0x7a')][_0xd596('0x41')]>0x0?_[_0xd596('0x4a')](_0x2fe22f[_0xd596('0x38')][_0xd596('0x7a')],function(_0x2a9e8f){return{'name':_0x2a9e8f[_0xd596('0x76')],'value':_0x2a9e8f[_0xd596('0x7b')]};}):[]};})};}})[_0xd596('0x1c')](respondWithResult(_0x598fa0,null))[_0xd596('0x26')](function(_0xcf9451){console[_0xd596('0x7c')]('vTiger\x20error:\x20'+_0xcf9451);var _0x38a48d=_0x27e04f[_0xd596('0x3b')][_0xd596('0x7d')]?0x1f4:_0xcf9451['statusCode']||0x1f4;logger[_0xd596('0x22')](_0xd596('0x7e'),_0xd596('0x61'),_0x38a48d,JSON['stringify'](_0xcf9451));delete _0xcf9451[_0xd596('0x33')];if(_0x38a48d===0x191){_0x38a48d=0x190;}_0x598fa0[_0xd596('0x28')](_0x38a48d)[_0xd596('0x34')](_0x27e04f['query'][_0xd596('0x7d')]?{'message':_0xd596('0x7f'),'statusCode':_0xcf9451[_0xd596('0x80')]}:_0xcf9451);});}; \ No newline at end of file +var _0xe13a=['Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rawAttributes','create','body','find','params','VtigerConfiguration','order','pick','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','md5','getFields','username','description','serverUrl','moduleName','slice','substring','format','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','label','startsWith','cf_','picklistValues','value','test','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x429c65,_0x3b9745){var _0x5befcf=function(_0x293067){while(--_0x293067){_0x429c65['push'](_0x429c65['shift']());}};_0x5befcf(++_0x3b9745);}(_0xe13a,0x1ee));var _0xae13=function(_0x28a2bd,_0x3cbdb3){_0x28a2bd=_0x28a2bd-0x0;var _0x16cc57=_0xe13a[_0x28a2bd];return _0x16cc57;};'use strict';var pdf=require(_0xae13('0x0'));var emlformat=require(_0xae13('0x1'));var rimraf=require(_0xae13('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae13('0x4'));var Mustache=require(_0xae13('0x5'));var util=require('util');var path=require(_0xae13('0x6'));var sox=require(_0xae13('0x7'));var csv=require(_0xae13('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae13('0x9'));var squel=require('squel');var crypto=require(_0xae13('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xae13('0xb'));var toCsv=require(_0xae13('0x8'));var querystring=require(_0xae13('0xc'));var Papa=require(_0xae13('0xd'));var Redis=require(_0xae13('0xe'));var authService=require(_0xae13('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xae13('0x10'));var hardwareService=require(_0xae13('0x11'));var logger=require(_0xae13('0x12'))(_0xae13('0x13'));var utils=require(_0xae13('0x14'));var config=require(_0xae13('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xae13('0x16'))['db'];var integrations=require(_0xae13('0x17'));var jayson=require(_0xae13('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12acc4,_0x16b7f4,_0x21a392,_0x228cad){return new BPromise(function(_0x53661d,_0x2e6427){var _0x270f30=_0x228cad||client;return _0x270f30[_0xae13('0x19')](_0x12acc4,_0x21a392)['then'](function(_0x50ebdf){logger[_0xae13('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x16b7f4,_0xae13('0x1b'));logger[_0xae13('0x1c')](_0xae13('0x1d'),_0x16b7f4,_0xae13('0x1b'),JSON['stringify'](_0x50ebdf));if(_0x50ebdf[_0xae13('0x1e')]){if(_0x50ebdf[_0xae13('0x1e')]['code']===0x1f4){logger[_0xae13('0x1e')](_0xae13('0x1f'),_0x16b7f4,_0x50ebdf[_0xae13('0x1e')][_0xae13('0x20')]);return _0x2e6427(_0x50ebdf[_0xae13('0x1e')]['message']);}logger[_0xae13('0x1e')](_0xae13('0x1f'),_0x16b7f4,_0x50ebdf[_0xae13('0x1e')][_0xae13('0x20')]);return _0x53661d(_0x50ebdf['error'][_0xae13('0x20')]);}else{logger[_0xae13('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x16b7f4,'request\x20sent');_0x53661d(_0x50ebdf[_0xae13('0x21')]['message']);}})[_0xae13('0x22')](function(_0x472406){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x16b7f4,_0x472406);_0x2e6427(_0x472406);});});}function respondWithStatusCode(_0x455365,_0x35bd44){_0x35bd44=_0x35bd44||0xcc;return function(_0xfff4d9){if(_0xfff4d9){return _0x455365[_0xae13('0x23')](_0x35bd44);}return _0x455365[_0xae13('0x24')](_0x35bd44)[_0xae13('0x25')]();};}function respondWithResult(_0x508137,_0x330cdd){_0x330cdd=_0x330cdd||0xc8;return function(_0x20eb44){if(_0x20eb44){return _0x508137['status'](_0x330cdd)[_0xae13('0x26')](_0x20eb44);}};}function respondWithFilteredResult(_0x1c85c2,_0x3f7ea4){return function(_0x482471){if(_0x482471){var _0x29928e=_0x482471[_0xae13('0x27')],_0x534d8e=_0x3f7ea4['offset'],_0x4b5b2b=_0x3f7ea4[_0xae13('0x28')]+_0x3f7ea4[_0xae13('0x29')],_0x1e23e6;if(_0x4b5b2b>=_0x29928e){_0x4b5b2b=_0x29928e;_0x1e23e6=0xc8;}else{_0x1e23e6=0xce;}_0x1c85c2[_0xae13('0x24')](_0x1e23e6);return _0x1c85c2[_0xae13('0x2a')](_0xae13('0x2b'),_0x534d8e+'-'+_0x4b5b2b+'/'+_0x29928e)[_0xae13('0x26')](_0x482471);}return null;};}function patchUpdates(_0x4c773b){return function(_0x4af705){try{jsonpatch[_0xae13('0x2c')](_0x4af705,_0x4c773b,!![]);}catch(_0x355514){return BPromise['reject'](_0x355514);}return _0x4af705[_0xae13('0x2d')]();};}function saveUpdates(_0x2b5a10,_0x112cb1){return function(_0x4e759f){if(_0x4e759f){return _0x4e759f[_0xae13('0x2e')](_0x2b5a10)[_0xae13('0x2f')](function(_0x535161){return _0x535161;});}return null;};}function removeEntity(_0x5f3cb6,_0x4aadbe){return function(_0xac6684){if(_0xac6684){return _0xac6684[_0xae13('0x30')]()[_0xae13('0x2f')](function(){_0x5f3cb6[_0xae13('0x24')](0xcc)[_0xae13('0x25')]();});}};}function handleEntityNotFound(_0x1c81e1,_0x908f2c){return function(_0x38fefe){if(!_0x38fefe){_0x1c81e1['sendStatus'](0x194);}return _0x38fefe;};}function handleError(_0x3081fa,_0x15caf6){_0x15caf6=_0x15caf6||0x1f4;return function(_0x47a24f){logger[_0xae13('0x1e')](_0x47a24f['stack']);if(_0x47a24f[_0xae13('0x31')]){delete _0x47a24f[_0xae13('0x31')];}_0x3081fa['status'](_0x15caf6)[_0xae13('0x32')](_0x47a24f);};}exports[_0xae13('0x33')]=function(_0x4cac1e,_0xf9aada){var _0x3bda89={},_0x4f5b0c={},_0x4842d7={'count':0x0,'rows':[]};var _0x3b920e=_[_0xae13('0x34')](db[_0xae13('0x35')]['rawAttributes'],function(_0x331e37){return{'name':_0x331e37[_0xae13('0x36')],'type':_0x331e37[_0xae13('0x37')][_0xae13('0x38')]};});_0x4f5b0c[_0xae13('0x39')]=_[_0xae13('0x34')](_0x3b920e,_0xae13('0x31'));_0x4f5b0c[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x4cac1e[_0xae13('0x3a')]);_0x4f5b0c[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x4f5b0c[_0xae13('0x39')],_0x4f5b0c[_0xae13('0x3a')]);_0x3bda89[_0xae13('0x3e')]=_[_0xae13('0x3d')](_0x4f5b0c[_0xae13('0x39')],qs['fields'](_0x4cac1e[_0xae13('0x3a')][_0xae13('0x3f')]));_0x3bda89[_0xae13('0x3e')]=_0x3bda89['attributes'][_0xae13('0x40')]?_0x3bda89[_0xae13('0x3e')]:_0x4f5b0c[_0xae13('0x39')];if(!_0x4cac1e[_0xae13('0x3a')][_0xae13('0x41')](_0xae13('0x42'))){_0x3bda89[_0xae13('0x29')]=qs[_0xae13('0x29')](_0x4cac1e[_0xae13('0x3a')][_0xae13('0x29')]);_0x3bda89['offset']=qs[_0xae13('0x28')](_0x4cac1e[_0xae13('0x3a')][_0xae13('0x28')]);}_0x3bda89['order']=qs[_0xae13('0x43')](_0x4cac1e[_0xae13('0x3a')][_0xae13('0x43')]);_0x3bda89['where']=qs[_0xae13('0x3c')](_['pick'](_0x4cac1e[_0xae13('0x3a')],_0x4f5b0c[_0xae13('0x3c')]),_0x3b920e);if(_0x4cac1e['query'][_0xae13('0x44')]){_0x3bda89[_0xae13('0x45')]=_[_0xae13('0x46')](_0x3bda89[_0xae13('0x45')],{'$or':_[_0xae13('0x34')](_0x3b920e,function(_0x2347c1){if(_0x2347c1['type']!==_0xae13('0x47')){var _0x3ffeca={};_0x3ffeca[_0x2347c1[_0xae13('0x31')]]={'$like':'%'+_0x4cac1e[_0xae13('0x3a')][_0xae13('0x44')]+'%'};return _0x3ffeca;}})});}_0x3bda89=_['merge']({},_0x3bda89,_0x4cac1e[_0xae13('0x48')]);var _0x112ca8={'where':_0x3bda89['where']};return db[_0xae13('0x35')][_0xae13('0x27')](_0x112ca8)[_0xae13('0x2f')](function(_0xc05dd0){_0x4842d7[_0xae13('0x27')]=_0xc05dd0;if(_0x4cac1e[_0xae13('0x3a')][_0xae13('0x49')]){_0x3bda89['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x3bda89);})[_0xae13('0x2f')](function(_0x2a0e45){_0x4842d7['rows']=_0x2a0e45;return _0x4842d7;})['then'](respondWithFilteredResult(_0xf9aada,_0x3bda89))[_0xae13('0x22')](handleError(_0xf9aada,null));};exports['show']=function(_0x39cffe,_0x28aef2){var _0x2ee190={'raw':![],'where':{'id':_0x39cffe['params']['id']}},_0x470bcf={};_0x470bcf['model']=_['keys'](db['VtigerAccount'][_0xae13('0x4a')]);_0x470bcf[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x39cffe[_0xae13('0x3a')]);_0x470bcf[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x470bcf[_0xae13('0x39')],_0x470bcf[_0xae13('0x3a')]);_0x2ee190[_0xae13('0x3e')]=_[_0xae13('0x3d')](_0x470bcf[_0xae13('0x39')],qs[_0xae13('0x3f')](_0x39cffe['query'][_0xae13('0x3f')]));_0x2ee190[_0xae13('0x3e')]=_0x2ee190[_0xae13('0x3e')][_0xae13('0x40')]?_0x2ee190[_0xae13('0x3e')]:_0x470bcf[_0xae13('0x39')];if(_0x39cffe[_0xae13('0x3a')][_0xae13('0x49')]){_0x2ee190['include']=[{'all':!![]}];}_0x2ee190=_[_0xae13('0x46')]({},_0x2ee190,_0x39cffe[_0xae13('0x48')]);return db['VtigerAccount']['find'](_0x2ee190)['then'](handleEntityNotFound(_0x28aef2,null))['then'](respondWithResult(_0x28aef2,null))['catch'](handleError(_0x28aef2,null));};exports[_0xae13('0x4b')]=function(_0x2084cd,_0x3a959a){return db[_0xae13('0x35')][_0xae13('0x4b')](_0x2084cd[_0xae13('0x4c')],{})[_0xae13('0x2f')](respondWithResult(_0x3a959a,0xc9))[_0xae13('0x22')](handleError(_0x3a959a,null));};exports['update']=function(_0x46907b,_0x37ae78){if(_0x46907b[_0xae13('0x4c')]['id']){delete _0x46907b[_0xae13('0x4c')]['id'];}return db[_0xae13('0x35')][_0xae13('0x4d')]({'where':{'id':_0x46907b[_0xae13('0x4e')]['id']}})[_0xae13('0x2f')](handleEntityNotFound(_0x37ae78,null))[_0xae13('0x2f')](saveUpdates(_0x46907b[_0xae13('0x4c')],null))['then'](respondWithResult(_0x37ae78,null))[_0xae13('0x22')](handleError(_0x37ae78,null));};exports[_0xae13('0x30')]=function(_0x302485,_0xd9e417){return db[_0xae13('0x35')][_0xae13('0x4d')]({'where':{'id':_0x302485[_0xae13('0x4e')]['id']}})[_0xae13('0x2f')](handleEntityNotFound(_0xd9e417,null))[_0xae13('0x2f')](removeEntity(_0xd9e417,null))[_0xae13('0x22')](handleError(_0xd9e417,null));};exports['getConfigurations']=function(_0x5ee38f,_0x39ac6f,_0x2a246d){var _0x485225={};var _0x3ec263={};var _0x56052b;var _0x2c8777;return db[_0xae13('0x35')]['findOne']({'where':{'id':_0x5ee38f['params']['id']}})[_0xae13('0x2f')](handleEntityNotFound(_0x39ac6f,null))['then'](function(_0x1a9b7c){if(_0x1a9b7c){_0x56052b=_0x1a9b7c;_0x3ec263['model']=_[_0xae13('0x3b')](db[_0xae13('0x4f')][_0xae13('0x4a')]);_0x3ec263[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x5ee38f[_0xae13('0x3a')]);_0x3ec263[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x3ec263[_0xae13('0x39')],_0x3ec263[_0xae13('0x3a')]);_0x485225[_0xae13('0x3e')]=_[_0xae13('0x3d')](_0x3ec263[_0xae13('0x39')],qs[_0xae13('0x3f')](_0x5ee38f[_0xae13('0x3a')]['fields']));_0x485225[_0xae13('0x3e')]=_0x485225[_0xae13('0x3e')][_0xae13('0x40')]?_0x485225[_0xae13('0x3e')]:_0x3ec263[_0xae13('0x39')];_0x485225[_0xae13('0x50')]=qs[_0xae13('0x43')](_0x5ee38f[_0xae13('0x3a')][_0xae13('0x43')]);_0x485225[_0xae13('0x45')]=qs[_0xae13('0x3c')](_[_0xae13('0x51')](_0x5ee38f[_0xae13('0x3a')],_0x3ec263[_0xae13('0x3c')]));if(_0x5ee38f[_0xae13('0x3a')][_0xae13('0x44')]){_0x485225[_0xae13('0x45')]=_[_0xae13('0x46')](_0x485225['where'],{'$or':_[_0xae13('0x34')](_0x485225[_0xae13('0x3e')],function(_0x37545e){var _0x4f24d8={};_0x4f24d8[_0x37545e]={'$like':'%'+_0x5ee38f[_0xae13('0x3a')][_0xae13('0x44')]+'%'};return _0x4f24d8;})});}_0x485225=_[_0xae13('0x46')]({},_0x485225,_0x5ee38f[_0xae13('0x48')]);return _0x56052b[_0xae13('0x52')](_0x485225);}})[_0xae13('0x2f')](function(_0x3b16f3){if(_0x3b16f3){_0x2c8777=_0x3b16f3[_0xae13('0x40')];if(!_0x5ee38f[_0xae13('0x3a')]['hasOwnProperty'](_0xae13('0x42'))){_0x485225[_0xae13('0x29')]=qs[_0xae13('0x29')](_0x5ee38f[_0xae13('0x3a')][_0xae13('0x29')]);_0x485225['offset']=qs[_0xae13('0x28')](_0x5ee38f['query'][_0xae13('0x28')]);}return _0x56052b[_0xae13('0x52')](_0x485225);}})['then'](function(_0x18a26c){if(_0x18a26c){return _0x18a26c?{'count':_0x2c8777,'rows':_0x18a26c}:null;}})['then'](respondWithResult(_0x39ac6f,null))[_0xae13('0x22')](handleError(_0x39ac6f,null));};exports['addConfiguration']=function(_0x20309f,_0x3b73ad,_0x34e03c){if(_0x20309f['body']['id']){delete _0x20309f[_0xae13('0x4c')]['id'];}return db[_0xae13('0x35')][_0xae13('0x53')]({'where':{'id':_0x20309f['params']['id']}})[_0xae13('0x2f')](handleEntityNotFound(_0x3b73ad,null))[_0xae13('0x2f')](function(_0x5c16a9){if(_0x5c16a9){_0x20309f['body'][_0xae13('0x54')]=_0x5c16a9['id'];_0x20309f[_0xae13('0x4c')][_0xae13('0x55')]=integrations[_0xae13('0x56')](_0x20309f['body']['channel'],_0x20309f['body']['type']);_0x20309f['body']['Descriptions']=integrations[_0xae13('0x57')](_0x20309f[_0xae13('0x4c')][_0xae13('0x58')],_0x20309f[_0xae13('0x4c')][_0xae13('0x37')]);return db[_0xae13('0x4f')][_0xae13('0x4b')](_0x20309f[_0xae13('0x4c')],{'include':[{'model':db[_0xae13('0x59')],'as':_0xae13('0x55')},{'model':db[_0xae13('0x59')],'as':_0xae13('0x5a')}]});}return null;})[_0xae13('0x2f')](respondWithResult(_0x3b73ad,null))['catch'](handleError(_0x3b73ad,null));};var md5=require(_0xae13('0x5b'));exports[_0xae13('0x5c')]=function(_0xe11f48,_0x51d3de,_0xacce36){var _0x3628df=null;var _0x37d217=null;var _0x2088bd=null;var _0x5e1802=null;var _0x534d91='';return db[_0xae13('0x35')][_0xae13('0x53')]({'where':{'id':_0xe11f48[_0xae13('0x4e')]['id']},'attributes':['id',_0xae13('0x31'),_0xae13('0x5d'),_0xae13('0x5e'),'moduleName','remoteUri',_0xae13('0x5f'),'accessKey']})[_0xae13('0x2f')](handleEntityNotFound(_0x51d3de,null))[_0xae13('0x2f')](function(_0x1c89e2){if(_0x1c89e2){_0x3628df=_0x1c89e2['username'];_0x37d217=_0x1c89e2['accessKey'];_0x2088bd=_0x1c89e2[_0xae13('0x60')];_0x534d91=_0x1c89e2['remoteUri'];var _0x36b4cc=_0x534d91[_0xae13('0x61')](-0x1);if(_0x36b4cc==='/'){_0x534d91=_0x534d91[_0xae13('0x62')](0x0,_0x534d91['lastIndexOf'](_0x36b4cc));}_0x5e1802=util[_0xae13('0x63')]('%s/webservice.php',_0x534d91);var _0x5b2ca1={'method':_0xae13('0x64'),'uri':_0x5e1802,'qs':{'operation':_0xae13('0x65'),'username':_0x1c89e2[_0xae13('0x5d')]},'json':!![]};return rp(_0x5b2ca1);}})['then'](function(_0x42a9fc){if(_0x42a9fc[_0xae13('0x66')]){var _0x570661={'method':_0xae13('0x67'),'uri':_0x5e1802,'form':{'operation':_0xae13('0x68'),'username':_0x3628df,'accessKey':md5(_0x42a9fc[_0xae13('0x21')][_0xae13('0x69')]+_0x37d217)},'json':!![]};return rp(_0x570661);}})[_0xae13('0x2f')](function(_0x4fb378){if(_0x4fb378[_0xae13('0x66')]){var _0x3c5299={'method':_0xae13('0x64'),'uri':_0x5e1802,'qs':{'operation':_0xae13('0x6a'),'username':_0x3628df,'sessionName':_0x4fb378['result'][_0xae13('0x6b')],'elementType':_0x2088bd},'json':!![]};return rp(_0x3c5299);}})['then'](function(_0x4eefb8){if(_0x4eefb8[_0xae13('0x66')]){var _0x35a782=[_0xae13('0x6c'),_0xae13('0x6d'),_0xae13('0x6e')];_[_0xae13('0x6f')](_0x4eefb8[_0xae13('0x21')][_0xae13('0x3f')],function(_0x36ce98){return _0x35a782[_0xae13('0x70')](_0x36ce98['type'][_0xae13('0x31')]);});_['remove'](_0x4eefb8['result']['fields'],function(_0x22025b){return _0x22025b['editable']==='false';});return{'count':_0x4eefb8[_0xae13('0x21')][_0xae13('0x3f')][_0xae13('0x40')],'rows':_[_0xae13('0x34')](_0x4eefb8['result']['fields'],function(_0x485fb8){return{'id':_0x485fb8[_0xae13('0x31')],'name':_0x485fb8[_0xae13('0x71')],'custom':_[_0xae13('0x72')](_0x485fb8[_0xae13('0x31')],_0xae13('0x73'))?!![]:![],'options':_0x485fb8[_0xae13('0x37')][_0xae13('0x31')]==='picklist'&&_0x485fb8[_0xae13('0x37')][_0xae13('0x74')]['length']>0x0?_[_0xae13('0x34')](_0x485fb8[_0xae13('0x37')][_0xae13('0x74')],function(_0x4a2ea3){return{'name':_0x4a2ea3[_0xae13('0x71')],'value':_0x4a2ea3[_0xae13('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x51d3de,null))['catch'](function(_0x2d1e85){console['log']('vTiger\x20error:\x20'+_0x2d1e85);var _0x37d9a6=_0xe11f48['query'][_0xae13('0x76')]?0x1f4:_0x2d1e85['statusCode']||0x1f4;logger['error'](_0xae13('0x77'),_0xae13('0x5c'),_0x37d9a6,JSON[_0xae13('0x78')](_0x2d1e85));delete _0x2d1e85[_0xae13('0x31')];if(_0x37d9a6===0x191){_0x37d9a6=0x190;}_0x51d3de[_0xae13('0x24')](_0x37d9a6)['send'](_0xe11f48['query'][_0xae13('0x76')]?{'message':_0xae13('0x79'),'statusCode':_0x2d1e85[_0xae13('0x7a')]}:_0x2d1e85);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d910b17..806a376 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 _0xc968=['lodash','util','api','moment','bluebird','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x169ff9,_0x424a6){var _0x333d89=function(_0x2f4502){while(--_0x2f4502){_0x169ff9['push'](_0x169ff9['shift']());}};_0x333d89(++_0x424a6);}(_0xc968,0x1e1));var _0x8c96=function(_0x19409d,_0xf48905){_0x19409d=_0x19409d-0x0;var _0x5de146=_0xc968[_0x19409d];return _0x5de146;};'use strict';var _=require(_0x8c96('0x0'));var util=require(_0x8c96('0x1'));var logger=require('../../config/logger')(_0x8c96('0x2'));var moment=require(_0x8c96('0x3'));var BPromise=require(_0x8c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c96('0x5'));var rimraf=require(_0x8c96('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c96('0x7'));var integrations=require(_0x8c96('0x8'));module[_0x8c96('0x9')]=function(_0x5a5425,_0x1a8e66){return _0x5a5425[_0x8c96('0xa')](_0x8c96('0xb'),attributes,{'tableName':_0x8c96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7302=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x7302,0xdf));var _0x2730=function(_0x48cd96,_0x45479c){_0x48cd96=_0x48cd96-0x0;var _0x3d07a4=_0x7302[_0x48cd96];return _0x3d07a4;};'use strict';var _=require(_0x2730('0x0'));var util=require('util');var logger=require(_0x2730('0x1'))(_0x2730('0x2'));var moment=require(_0x2730('0x3'));var BPromise=require(_0x2730('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2730('0x5'));var rimraf=require(_0x2730('0x6'));var config=require(_0x2730('0x7'));var attributes=require(_0x2730('0x8'));var integrations=require(_0x2730('0x9'));module['exports']=function(_0xc46fe1,_0x3c6f73){return _0xc46fe1['define'](_0x2730('0xa'),attributes,{'tableName':_0x2730('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 676db8b..fc2a579 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 _0x085f=['map','info','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','options','raw','where','attributes','limit','include','model'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x085f,0x101));var _0xf085=function(_0x330fd9,_0x4508dc){_0x330fd9=_0x330fd9-0x0;var _0x27f9d4=_0x085f[_0x330fd9];return _0x27f9d4;};'use strict';var _=require(_0xf085('0x0'));var util=require(_0xf085('0x1'));var moment=require(_0xf085('0x2'));var BPromise=require(_0xf085('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf085('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf085('0x5'));var logger=require(_0xf085('0x6'))(_0xf085('0x7'));var config=require(_0xf085('0x8'));var jayson=require(_0xf085('0x9'));var client=jayson[_0xf085('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de7ed,_0xa6b3ef,_0x2c7e68){return new BPromise(function(_0x4a40cc,_0x43327d){return client[_0xf085('0xb')](_0x2de7ed,_0x2c7e68)[_0xf085('0xc')](function(_0x4cea3b){logger['info']('VtigerAccount,\x20%s,\x20%s',_0xa6b3ef,_0xf085('0xd'));logger[_0xf085('0xe')](_0xf085('0xf'),_0xa6b3ef,_0xf085('0xd'),JSON[_0xf085('0x10')](_0x4cea3b));if(_0x4cea3b[_0xf085('0x11')]){if(_0x4cea3b['error'][_0xf085('0x12')]===0x1f4){logger[_0xf085('0x11')](_0xf085('0x13'),_0xa6b3ef,_0x4cea3b['error']['message']);return _0x43327d(_0x4cea3b[_0xf085('0x11')]['message']);}logger[_0xf085('0x11')](_0xf085('0x13'),_0xa6b3ef,_0x4cea3b[_0xf085('0x11')][_0xf085('0x14')]);return _0x4a40cc(_0x4cea3b[_0xf085('0x11')]['message']);}else{logger['info'](_0xf085('0x13'),_0xa6b3ef,_0xf085('0xd'));_0x4a40cc(_0x4cea3b[_0xf085('0x15')]['message']);}})[_0xf085('0x16')](function(_0x11e2fc){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xa6b3ef,_0x11e2fc);_0x43327d(_0x11e2fc);});});}exports['GetVtigerAccount']=function(_0x41798c){var _0x40836e=this;return new Promise(function(_0x460cdc,_0x32c31c){return db[_0xf085('0x17')]['findAll']({'raw':_0x41798c[_0xf085('0x18')]?_0x41798c[_0xf085('0x18')][_0xf085('0x19')]===undefined?!![]:![]:!![],'where':_0x41798c[_0xf085('0x18')]?_0x41798c[_0xf085('0x18')][_0xf085('0x1a')]||null:null,'attributes':_0x41798c[_0xf085('0x18')]?_0x41798c[_0xf085('0x18')][_0xf085('0x1b')]||null:null,'limit':_0x41798c[_0xf085('0x18')]?_0x41798c[_0xf085('0x18')][_0xf085('0x1c')]||null:null,'include':_0x41798c[_0xf085('0x18')]?_0x41798c['options']['include']?_['map'](_0x41798c['options'][_0xf085('0x1d')],function(_0x5d5628){return{'model':db[_0x5d5628[_0xf085('0x1e')]],'as':_0x5d5628['as'],'attributes':_0x5d5628[_0xf085('0x1b')],'include':_0x5d5628['include']?_[_0xf085('0x1f')](_0x5d5628['include'],function(_0x107a64){return{'model':db[_0x107a64[_0xf085('0x1e')]],'as':_0x107a64['as'],'attributes':_0x107a64[_0xf085('0x1b')],'include':_0x107a64[_0xf085('0x1d')]?_[_0xf085('0x1f')](_0x107a64['include'],function(_0x42f211){return{'model':db[_0x42f211['model']],'as':_0x42f211['as'],'attributes':_0x42f211['attributes']};}):[]};}):[]};}):[]:[]})[_0xf085('0xc')](function(_0x1357c9){logger[_0xf085('0x20')]('GetVtigerAccount',_0x41798c);logger[_0xf085('0xe')](_0xf085('0x21'),_0x41798c,JSON[_0xf085('0x10')](_0x1357c9));_0x460cdc(_0x1357c9);})[_0xf085('0x16')](function(_0x2160ca){logger[_0xf085('0x11')](_0xf085('0x21'),_0x2160ca[_0xf085('0x14')],_0x41798c);_0x32c31c(_0x40836e['error'](0x1f4,_0x2160ca[_0xf085('0x14')]));});});};exports[_0xf085('0x22')]=function(_0x23e7f4){var _0x111617=this;return new Promise(function(_0x3e4383,_0x354590){return db[_0xf085('0x17')][_0xf085('0x23')]({'raw':_0x23e7f4['options']?_0x23e7f4[_0xf085('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23e7f4[_0xf085('0x18')]?_0x23e7f4[_0xf085('0x18')][_0xf085('0x1a')]||null:null,'attributes':_0x23e7f4[_0xf085('0x18')]?_0x23e7f4['options'][_0xf085('0x1b')]||null:null,'include':_0x23e7f4[_0xf085('0x18')]?_0x23e7f4[_0xf085('0x18')][_0xf085('0x1d')]?_['map'](_0x23e7f4[_0xf085('0x18')][_0xf085('0x1d')],function(_0x2c60b4){return{'model':db[_0x2c60b4[_0xf085('0x1e')]],'as':_0x2c60b4['as'],'attributes':_0x2c60b4[_0xf085('0x1b')],'include':_0x2c60b4[_0xf085('0x1d')]?_['map'](_0x2c60b4[_0xf085('0x1d')],function(_0x1f8ea3){return{'model':db[_0x1f8ea3['model']],'as':_0x1f8ea3['as'],'attributes':_0x1f8ea3[_0xf085('0x1b')],'include':_0x1f8ea3['include']?_[_0xf085('0x1f')](_0x1f8ea3[_0xf085('0x1d')],function(_0xaf7992){return{'model':db[_0xaf7992[_0xf085('0x1e')]],'as':_0xaf7992['as'],'attributes':_0xaf7992[_0xf085('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf085('0xc')](function(_0x2d329f){logger['info'](_0xf085('0x22'),_0x23e7f4);logger[_0xf085('0xe')](_0xf085('0x22'),_0x23e7f4,JSON[_0xf085('0x10')](_0x2d329f));_0x3e4383(_0x2d329f);})[_0xf085('0x16')](function(_0x99e4c2){logger['error']('ShowVtigerAccount',_0x99e4c2[_0xf085('0x14')],_0x23e7f4);_0x354590(_0x111617[_0xf085('0x11')](0x1f4,_0x99e4c2[_0xf085('0x14')]));});});}; \ No newline at end of file +var _0x0ad3=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowVtigerAccount','find','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x58969f,_0x51598a){var _0x5c2408=function(_0x256870){while(--_0x256870){_0x58969f['push'](_0x58969f['shift']());}};_0x5c2408(++_0x51598a);}(_0x0ad3,0x124));var _0x30ad=function(_0x2c57a0,_0x256a8c){_0x2c57a0=_0x2c57a0-0x0;var _0x3a5623=_0x0ad3[_0x2c57a0];return _0x3a5623;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30ad('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30ad('0x1'))['db'];var utils=require(_0x30ad('0x2'));var logger=require(_0x30ad('0x3'))(_0x30ad('0x4'));var config=require(_0x30ad('0x5'));var jayson=require(_0x30ad('0x6'));var client=jayson[_0x30ad('0x7')][_0x30ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb2766,_0x3109ad,_0x3c3ff1){return new BPromise(function(_0x507232,_0x4e400c){return client[_0x30ad('0x9')](_0xcb2766,_0x3c3ff1)[_0x30ad('0xa')](function(_0x8bc7c5){logger[_0x30ad('0xb')](_0x30ad('0xc'),_0x3109ad,_0x30ad('0xd'));logger[_0x30ad('0xe')](_0x30ad('0xf'),_0x3109ad,'request\x20sent',JSON[_0x30ad('0x10')](_0x8bc7c5));if(_0x8bc7c5[_0x30ad('0x11')]){if(_0x8bc7c5[_0x30ad('0x11')]['code']===0x1f4){logger['error'](_0x30ad('0xc'),_0x3109ad,_0x8bc7c5['error'][_0x30ad('0x12')]);return _0x4e400c(_0x8bc7c5[_0x30ad('0x11')][_0x30ad('0x12')]);}logger[_0x30ad('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x3109ad,_0x8bc7c5['error'][_0x30ad('0x12')]);return _0x507232(_0x8bc7c5[_0x30ad('0x11')][_0x30ad('0x12')]);}else{logger['info'](_0x30ad('0xc'),_0x3109ad,'request\x20sent');_0x507232(_0x8bc7c5[_0x30ad('0x13')][_0x30ad('0x12')]);}})[_0x30ad('0x14')](function(_0x192aad){logger['error'](_0x30ad('0xc'),_0x3109ad,_0x192aad);_0x4e400c(_0x192aad);});});}exports[_0x30ad('0x15')]=function(_0x5747e7){var _0x4fa62c=this;return new Promise(function(_0x15558f,_0x1fa40b){return db[_0x30ad('0x16')][_0x30ad('0x17')]({'raw':_0x5747e7[_0x30ad('0x18')]?_0x5747e7[_0x30ad('0x18')][_0x30ad('0x19')]===undefined?!![]:![]:!![],'where':_0x5747e7[_0x30ad('0x18')]?_0x5747e7[_0x30ad('0x18')][_0x30ad('0x1a')]||null:null,'attributes':_0x5747e7[_0x30ad('0x18')]?_0x5747e7[_0x30ad('0x18')]['attributes']||null:null,'limit':_0x5747e7[_0x30ad('0x18')]?_0x5747e7[_0x30ad('0x18')][_0x30ad('0x1b')]||null:null,'include':_0x5747e7[_0x30ad('0x18')]?_0x5747e7['options'][_0x30ad('0x1c')]?_[_0x30ad('0x1d')](_0x5747e7['options']['include'],function(_0x3b63f5){return{'model':db[_0x3b63f5[_0x30ad('0x1e')]],'as':_0x3b63f5['as'],'attributes':_0x3b63f5['attributes'],'include':_0x3b63f5[_0x30ad('0x1c')]?_[_0x30ad('0x1d')](_0x3b63f5[_0x30ad('0x1c')],function(_0x306a12){return{'model':db[_0x306a12[_0x30ad('0x1e')]],'as':_0x306a12['as'],'attributes':_0x306a12[_0x30ad('0x1f')],'include':_0x306a12[_0x30ad('0x1c')]?_[_0x30ad('0x1d')](_0x306a12[_0x30ad('0x1c')],function(_0x2a7bcd){return{'model':db[_0x2a7bcd[_0x30ad('0x1e')]],'as':_0x2a7bcd['as'],'attributes':_0x2a7bcd[_0x30ad('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122527){logger[_0x30ad('0xb')](_0x30ad('0x15'),_0x5747e7);logger[_0x30ad('0xe')]('GetVtigerAccount',_0x5747e7,JSON[_0x30ad('0x10')](_0x122527));_0x15558f(_0x122527);})[_0x30ad('0x14')](function(_0xfbde1e){logger[_0x30ad('0x11')](_0x30ad('0x15'),_0xfbde1e[_0x30ad('0x12')],_0x5747e7);_0x1fa40b(_0x4fa62c[_0x30ad('0x11')](0x1f4,_0xfbde1e[_0x30ad('0x12')]));});});};exports[_0x30ad('0x20')]=function(_0x420abc){var _0xad9745=this;return new Promise(function(_0x45a16a,_0x5c9006){return db['VtigerAccount'][_0x30ad('0x21')]({'raw':_0x420abc['options']?_0x420abc[_0x30ad('0x18')][_0x30ad('0x19')]===undefined?!![]:![]:!![],'where':_0x420abc[_0x30ad('0x18')]?_0x420abc[_0x30ad('0x18')]['where']||null:null,'attributes':_0x420abc[_0x30ad('0x18')]?_0x420abc[_0x30ad('0x18')][_0x30ad('0x1f')]||null:null,'include':_0x420abc['options']?_0x420abc[_0x30ad('0x18')][_0x30ad('0x1c')]?_[_0x30ad('0x1d')](_0x420abc['options'][_0x30ad('0x1c')],function(_0x495ec7){return{'model':db[_0x495ec7[_0x30ad('0x1e')]],'as':_0x495ec7['as'],'attributes':_0x495ec7[_0x30ad('0x1f')],'include':_0x495ec7[_0x30ad('0x1c')]?_[_0x30ad('0x1d')](_0x495ec7[_0x30ad('0x1c')],function(_0x5a1849){return{'model':db[_0x5a1849[_0x30ad('0x1e')]],'as':_0x5a1849['as'],'attributes':_0x5a1849[_0x30ad('0x1f')],'include':_0x5a1849[_0x30ad('0x1c')]?_['map'](_0x5a1849[_0x30ad('0x1c')],function(_0x3fd6cb){return{'model':db[_0x3fd6cb[_0x30ad('0x1e')]],'as':_0x3fd6cb['as'],'attributes':_0x3fd6cb[_0x30ad('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5d17){logger[_0x30ad('0xb')](_0x30ad('0x20'),_0x420abc);logger[_0x30ad('0xe')](_0x30ad('0x20'),_0x420abc,JSON[_0x30ad('0x10')](_0x3d5d17));_0x45a16a(_0x3d5d17);})[_0x30ad('0x14')](function(_0x20def5){logger[_0x30ad('0x11')]('ShowVtigerAccount',_0x20def5[_0x30ad('0x12')],_0x420abc);_0x5c9006(_0xad9745[_0x30ad('0x11')](0x1f4,_0x20def5[_0x30ad('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c94192f..88c9d4e 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(_0x39f828,_0x35dcdd){var _0x366118=function(_0x5b56f9){while(--_0x5b56f9){_0x39f828['push'](_0x39f828['shift']());}};_0x366118(++_0x35dcdd);}(_0xb10b,0x12a));var _0xbb10=function(_0x24eab8,_0x2f471c){_0x24eab8=_0x24eab8-0x0;var _0x41d883=_0xb10b[_0x24eab8];return _0x41d883;};'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 _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(_0x417423,_0x385162){var _0x19c3ca=function(_0x1881c6){while(--_0x1881c6){_0x417423['push'](_0x417423['shift']());}};_0x19c3ca(++_0x385162);}(_0xb10b,0x12a));var _0xbb10=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb10b[_0x44a64f];return _0x52024b;};'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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 7d66e93..caf534e 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 _0x4e29=['STRING','exports'];(function(_0x538ac8,_0x7c28bf){var _0x1c14cb=function(_0x4d042d){while(--_0x4d042d){_0x538ac8['push'](_0x538ac8['shift']());}};_0x1c14cb(++_0x7c28bf);}(_0x4e29,0xe9));var _0x94e2=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x4e29[_0x291f8b];return _0x275171;};'use strict';var Sequelize=require('sequelize');module[_0x94e2('0x0')]={'name':{'type':Sequelize[_0x94e2('0x1')]},'description':{'type':Sequelize[_0x94e2('0x1')]}}; \ No newline at end of file +var _0x7d8a=['exports','STRING'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0x7d8a,0x10e));var _0xa7d8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x7d8a[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require('sequelize');module[_0xa7d8('0x0')]={'name':{'type':Sequelize[_0xa7d8('0x1')]},'description':{'type':Sequelize[_0xa7d8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 50e8811..62cc44b 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 _0x595e=['getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','keys','find','body','params','getFields','findOne','VtigerField','pick','hasOwnProperty','nolimit'];(function(_0x2912df,_0x4229b7){var _0x2e5971=function(_0x2d5d1e){while(--_0x2d5d1e){_0x2912df['push'](_0x2912df['shift']());}};_0x2e5971(++_0x4229b7);}(_0x595e,0x1d3));var _0xe595=function(_0x3398df,_0x248b0f){_0x3398df=_0x3398df-0x0;var _0x176fed=_0x595e[_0x3398df];return _0x176fed;};'use strict';var pdf=require(_0xe595('0x0'));var emlformat=require(_0xe595('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe595('0x2'));var jsonpatch=require(_0xe595('0x3'));var rp=require(_0xe595('0x4'));var moment=require('moment');var BPromise=require(_0xe595('0x5'));var Mustache=require(_0xe595('0x6'));var util=require(_0xe595('0x7'));var path=require(_0xe595('0x8'));var sox=require(_0xe595('0x9'));var csv=require('to-csv');var ejs=require(_0xe595('0xa'));var fs=require('fs');var _=require(_0xe595('0xb'));var squel=require(_0xe595('0xc'));var crypto=require(_0xe595('0xd'));var jsforce=require(_0xe595('0xe'));var deskjs=require(_0xe595('0xf'));var toCsv=require(_0xe595('0x10'));var querystring=require('querystring');var Papa=require(_0xe595('0x11'));var Redis=require(_0xe595('0x12'));var authService=require(_0xe595('0x13'));var qs=require(_0xe595('0x14'));var as=require(_0xe595('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe595('0x16'));var utils=require(_0xe595('0x17'));var config=require(_0xe595('0x18'));var licenseUtil=require(_0xe595('0x19'));var db=require(_0xe595('0x1a'))['db'];var jayson=require(_0xe595('0x1b'));var client=jayson['client'][_0xe595('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xc1b920,_0x566d0f,_0x1d77ed,_0x2780cd){return new BPromise(function(_0x183b54,_0x495f5b){var _0x466ebe=_0x2780cd||client;return _0x466ebe[_0xe595('0x1d')](_0xc1b920,_0x1d77ed)['then'](function(_0x4180d6){logger[_0xe595('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x566d0f,_0xe595('0x1f'));logger[_0xe595('0x20')](_0xe595('0x21'),_0x566d0f,_0xe595('0x1f'),JSON[_0xe595('0x22')](_0x4180d6));if(_0x4180d6[_0xe595('0x23')]){if(_0x4180d6['error']['code']===0x1f4){logger[_0xe595('0x23')](_0xe595('0x24'),_0x566d0f,_0x4180d6[_0xe595('0x23')][_0xe595('0x25')]);return _0x495f5b(_0x4180d6[_0xe595('0x23')][_0xe595('0x25')]);}logger[_0xe595('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x566d0f,_0x4180d6[_0xe595('0x23')][_0xe595('0x25')]);return _0x183b54(_0x4180d6[_0xe595('0x23')]['message']);}else{logger[_0xe595('0x1e')](_0xe595('0x24'),_0x566d0f,_0xe595('0x1f'));_0x183b54(_0x4180d6[_0xe595('0x26')][_0xe595('0x25')]);}})[_0xe595('0x27')](function(_0x3df570){logger['error'](_0xe595('0x24'),_0x566d0f,_0x3df570);_0x495f5b(_0x3df570);});});}function respondWithStatusCode(_0x17516a,_0x47b903){_0x47b903=_0x47b903||0xcc;return function(_0x1f3656){if(_0x1f3656){return _0x17516a[_0xe595('0x28')](_0x47b903);}return _0x17516a[_0xe595('0x29')](_0x47b903)['end']();};}function respondWithResult(_0x153d25,_0x10ed22){_0x10ed22=_0x10ed22||0xc8;return function(_0x115cb6){if(_0x115cb6){return _0x153d25[_0xe595('0x29')](_0x10ed22)[_0xe595('0x2a')](_0x115cb6);}};}function respondWithFilteredResult(_0x4abb5b,_0x1bda59){return function(_0x4a4503){if(_0x4a4503){var _0x49b6cb=_0x4a4503['count'],_0x1b5eeb=_0x1bda59['offset'],_0x1d35fd=_0x1bda59[_0xe595('0x2b')]+_0x1bda59['limit'],_0x5e3ad6;if(_0x1d35fd>=_0x49b6cb){_0x1d35fd=_0x49b6cb;_0x5e3ad6=0xc8;}else{_0x5e3ad6=0xce;}_0x4abb5b[_0xe595('0x29')](_0x5e3ad6);return _0x4abb5b['set'](_0xe595('0x2c'),_0x1b5eeb+'-'+_0x1d35fd+'/'+_0x49b6cb)['json'](_0x4a4503);}return null;};}function patchUpdates(_0x233f7f){return function(_0x3c5ec){try{jsonpatch[_0xe595('0x2d')](_0x3c5ec,_0x233f7f,!![]);}catch(_0xa407b6){return BPromise[_0xe595('0x2e')](_0xa407b6);}return _0x3c5ec['save']();};}function saveUpdates(_0x426dba,_0x29b17a){return function(_0x37adfb){if(_0x37adfb){return _0x37adfb[_0xe595('0x2f')](_0x426dba)[_0xe595('0x30')](function(_0x4d34b){return _0x4d34b;});}return null;};}function removeEntity(_0x37c707,_0x28439a){return function(_0x86cd86){if(_0x86cd86){return _0x86cd86[_0xe595('0x31')]()[_0xe595('0x30')](function(){_0x37c707[_0xe595('0x29')](0xcc)[_0xe595('0x32')]();});}};}function handleEntityNotFound(_0x26ab1f,_0x1a1dad){return function(_0x5ca361){if(!_0x5ca361){_0x26ab1f[_0xe595('0x28')](0x194);}return _0x5ca361;};}function handleError(_0x52abc5,_0x5cef22){_0x5cef22=_0x5cef22||0x1f4;return function(_0x369127){logger[_0xe595('0x23')](_0x369127[_0xe595('0x33')]);if(_0x369127[_0xe595('0x34')]){delete _0x369127[_0xe595('0x34')];}_0x52abc5[_0xe595('0x29')](_0x5cef22)[_0xe595('0x35')](_0x369127);};}exports[_0xe595('0x36')]=function(_0x54042c,_0x5af4ca){var _0xf45e17={},_0x18b38c={},_0x269b9a={'count':0x0,'rows':[]};var _0x538bae=_[_0xe595('0x37')](db[_0xe595('0x38')][_0xe595('0x39')],function(_0x3fff63){return{'name':_0x3fff63[_0xe595('0x3a')],'type':_0x3fff63[_0xe595('0x3b')][_0xe595('0x3c')]};});_0x18b38c[_0xe595('0x3d')]=_['map'](_0x538bae,'name');_0x18b38c[_0xe595('0x3e')]=_['keys'](_0x54042c[_0xe595('0x3e')]);_0x18b38c['filters']=_[_0xe595('0x3f')](_0x18b38c[_0xe595('0x3d')],_0x18b38c[_0xe595('0x3e')]);_0xf45e17[_0xe595('0x40')]=_['intersection'](_0x18b38c['model'],qs[_0xe595('0x41')](_0x54042c[_0xe595('0x3e')]['fields']));_0xf45e17['attributes']=_0xf45e17['attributes'][_0xe595('0x42')]?_0xf45e17[_0xe595('0x40')]:_0x18b38c[_0xe595('0x3d')];if(!_0x54042c['query']['hasOwnProperty']('nolimit')){_0xf45e17['limit']=qs[_0xe595('0x43')](_0x54042c[_0xe595('0x3e')][_0xe595('0x43')]);_0xf45e17['offset']=qs[_0xe595('0x2b')](_0x54042c[_0xe595('0x3e')][_0xe595('0x2b')]);}_0xf45e17[_0xe595('0x44')]=qs[_0xe595('0x45')](_0x54042c['query']['sort']);_0xf45e17[_0xe595('0x46')]=qs[_0xe595('0x47')](_['pick'](_0x54042c['query'],_0x18b38c['filters']),_0x538bae);if(_0x54042c[_0xe595('0x3e')][_0xe595('0x48')]){_0xf45e17[_0xe595('0x46')]=_[_0xe595('0x49')](_0xf45e17['where'],{'$or':_[_0xe595('0x37')](_0x538bae,function(_0xcd6ee5){if(_0xcd6ee5['type']!==_0xe595('0x4a')){var _0x5d3ded={};_0x5d3ded[_0xcd6ee5[_0xe595('0x34')]]={'$like':'%'+_0x54042c[_0xe595('0x3e')][_0xe595('0x48')]+'%'};return _0x5d3ded;}})});}_0xf45e17=_[_0xe595('0x49')]({},_0xf45e17,_0x54042c[_0xe595('0x4b')]);var _0xd67fc2={'where':_0xf45e17['where']};return db[_0xe595('0x38')][_0xe595('0x4c')](_0xd67fc2)[_0xe595('0x30')](function(_0x4778d4){_0x269b9a[_0xe595('0x4c')]=_0x4778d4;if(_0x54042c[_0xe595('0x3e')][_0xe595('0x4d')]){_0xf45e17[_0xe595('0x4e')]=[{'all':!![]}];}return db[_0xe595('0x38')][_0xe595('0x4f')](_0xf45e17);})[_0xe595('0x30')](function(_0x4d409e){_0x269b9a[_0xe595('0x50')]=_0x4d409e;return _0x269b9a;})[_0xe595('0x30')](respondWithFilteredResult(_0x5af4ca,_0xf45e17))[_0xe595('0x27')](handleError(_0x5af4ca,null));};exports['show']=function(_0x3493e4,_0x5d8499){var _0x43fab9={'raw':![],'where':{'id':_0x3493e4['params']['id']}},_0x17d9ba={};_0x17d9ba[_0xe595('0x3d')]=_[_0xe595('0x51')](db[_0xe595('0x38')]['rawAttributes']);_0x17d9ba['query']=_[_0xe595('0x51')](_0x3493e4[_0xe595('0x3e')]);_0x17d9ba[_0xe595('0x47')]=_[_0xe595('0x3f')](_0x17d9ba['model'],_0x17d9ba['query']);_0x43fab9[_0xe595('0x40')]=_['intersection'](_0x17d9ba[_0xe595('0x3d')],qs[_0xe595('0x41')](_0x3493e4['query'][_0xe595('0x41')]));_0x43fab9[_0xe595('0x40')]=_0x43fab9[_0xe595('0x40')][_0xe595('0x42')]?_0x43fab9['attributes']:_0x17d9ba[_0xe595('0x3d')];if(_0x3493e4[_0xe595('0x3e')]['includeAll']){_0x43fab9[_0xe595('0x4e')]=[{'all':!![]}];}_0x43fab9=_[_0xe595('0x49')]({},_0x43fab9,_0x3493e4[_0xe595('0x4b')]);return db[_0xe595('0x38')][_0xe595('0x52')](_0x43fab9)[_0xe595('0x30')](handleEntityNotFound(_0x5d8499,null))['then'](respondWithResult(_0x5d8499,null))[_0xe595('0x27')](handleError(_0x5d8499,null));};exports['create']=function(_0x3f64fe,_0x17c932){return db['VtigerConfiguration']['create'](_0x3f64fe[_0xe595('0x53')],{})[_0xe595('0x30')](respondWithResult(_0x17c932,0xc9))['catch'](handleError(_0x17c932,null));};exports['update']=function(_0x48f65b,_0x4e3ca3){if(_0x48f65b[_0xe595('0x53')]['id']){delete _0x48f65b[_0xe595('0x53')]['id'];}return db[_0xe595('0x38')]['find']({'where':{'id':_0x48f65b[_0xe595('0x54')]['id']}})[_0xe595('0x30')](handleEntityNotFound(_0x4e3ca3,null))[_0xe595('0x30')](saveUpdates(_0x48f65b[_0xe595('0x53')],null))['then'](respondWithResult(_0x4e3ca3,null))[_0xe595('0x27')](handleError(_0x4e3ca3,null));};exports[_0xe595('0x31')]=function(_0x4a18ea,_0x5dcd0a){return db[_0xe595('0x38')][_0xe595('0x52')]({'where':{'id':_0x4a18ea[_0xe595('0x54')]['id']}})[_0xe595('0x30')](handleEntityNotFound(_0x5dcd0a,null))['then'](removeEntity(_0x5dcd0a,null))[_0xe595('0x27')](handleError(_0x5dcd0a,null));};exports[_0xe595('0x55')]=function(_0x2951ff,_0xc3f7e0,_0x10d9b1){var _0x45fe4e={};var _0x4b110f={};var _0x9a068c;var _0x4605b8;return db[_0xe595('0x38')][_0xe595('0x56')]({'where':{'id':_0x2951ff[_0xe595('0x54')]['id']}})['then'](handleEntityNotFound(_0xc3f7e0,null))['then'](function(_0x408e62){if(_0x408e62){_0x9a068c=_0x408e62;_0x4b110f[_0xe595('0x3d')]=_[_0xe595('0x51')](db[_0xe595('0x57')][_0xe595('0x39')]);_0x4b110f['query']=_[_0xe595('0x51')](_0x2951ff['query']);_0x4b110f[_0xe595('0x47')]=_['intersection'](_0x4b110f[_0xe595('0x3d')],_0x4b110f[_0xe595('0x3e')]);_0x45fe4e[_0xe595('0x40')]=_['intersection'](_0x4b110f[_0xe595('0x3d')],qs[_0xe595('0x41')](_0x2951ff[_0xe595('0x3e')][_0xe595('0x41')]));_0x45fe4e[_0xe595('0x40')]=_0x45fe4e['attributes'][_0xe595('0x42')]?_0x45fe4e[_0xe595('0x40')]:_0x4b110f[_0xe595('0x3d')];_0x45fe4e[_0xe595('0x44')]=qs['sort'](_0x2951ff['query'][_0xe595('0x45')]);_0x45fe4e[_0xe595('0x46')]=qs[_0xe595('0x47')](_[_0xe595('0x58')](_0x2951ff[_0xe595('0x3e')],_0x4b110f[_0xe595('0x47')]));if(_0x2951ff[_0xe595('0x3e')][_0xe595('0x48')]){_0x45fe4e[_0xe595('0x46')]=_['merge'](_0x45fe4e['where'],{'$or':_[_0xe595('0x37')](_0x45fe4e[_0xe595('0x40')],function(_0x55f04a){var _0x791d0c={};_0x791d0c[_0x55f04a]={'$like':'%'+_0x2951ff[_0xe595('0x3e')]['filter']+'%'};return _0x791d0c;})});}_0x45fe4e=_[_0xe595('0x49')]({},_0x45fe4e,_0x2951ff[_0xe595('0x4b')]);return _0x9a068c[_0xe595('0x55')](_0x45fe4e);}})[_0xe595('0x30')](function(_0x1c18c2){if(_0x1c18c2){_0x4605b8=_0x1c18c2[_0xe595('0x42')];if(!_0x2951ff[_0xe595('0x3e')][_0xe595('0x59')](_0xe595('0x5a'))){_0x45fe4e[_0xe595('0x43')]=qs[_0xe595('0x43')](_0x2951ff[_0xe595('0x3e')][_0xe595('0x43')]);_0x45fe4e[_0xe595('0x2b')]=qs['offset'](_0x2951ff[_0xe595('0x3e')]['offset']);}return _0x9a068c[_0xe595('0x55')](_0x45fe4e);}})[_0xe595('0x30')](function(_0x216a78){if(_0x216a78){return _0x216a78?{'count':_0x4605b8,'rows':_0x216a78}:null;}})[_0xe595('0x30')](respondWithResult(_0xc3f7e0,null))[_0xe595('0x27')](handleError(_0xc3f7e0,null));};exports[_0xe595('0x5b')]=function(_0x4ccd80,_0x403634,_0x53c457){var _0x577509={};var _0x91b715={};var _0x5f49d6;var _0x2cc607;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4ccd80[_0xe595('0x54')]['id']}})[_0xe595('0x30')](handleEntityNotFound(_0x403634,null))[_0xe595('0x30')](function(_0x2053ac){if(_0x2053ac){_0x5f49d6=_0x2053ac;_0x91b715[_0xe595('0x3d')]=_[_0xe595('0x51')](db[_0xe595('0x57')][_0xe595('0x39')]);_0x91b715[_0xe595('0x3e')]=_['keys'](_0x4ccd80[_0xe595('0x3e')]);_0x91b715[_0xe595('0x47')]=_[_0xe595('0x3f')](_0x91b715['model'],_0x91b715[_0xe595('0x3e')]);_0x577509[_0xe595('0x40')]=_[_0xe595('0x3f')](_0x91b715[_0xe595('0x3d')],qs[_0xe595('0x41')](_0x4ccd80[_0xe595('0x3e')]['fields']));_0x577509[_0xe595('0x40')]=_0x577509[_0xe595('0x40')]['length']?_0x577509[_0xe595('0x40')]:_0x91b715[_0xe595('0x3d')];_0x577509[_0xe595('0x44')]=qs['sort'](_0x4ccd80[_0xe595('0x3e')][_0xe595('0x45')]);_0x577509[_0xe595('0x46')]=qs['filters'](_[_0xe595('0x58')](_0x4ccd80['query'],_0x91b715[_0xe595('0x47')]));if(_0x4ccd80['query']['filter']){_0x577509[_0xe595('0x46')]=_[_0xe595('0x49')](_0x577509[_0xe595('0x46')],{'$or':_[_0xe595('0x37')](_0x577509[_0xe595('0x40')],function(_0x2653a2){var _0x2930e={};_0x2930e[_0x2653a2]={'$like':'%'+_0x4ccd80[_0xe595('0x3e')][_0xe595('0x48')]+'%'};return _0x2930e;})});}_0x577509=_[_0xe595('0x49')]({},_0x577509,_0x4ccd80['options']);return _0x5f49d6[_0xe595('0x5b')](_0x577509);}})[_0xe595('0x30')](function(_0x29fbcb){if(_0x29fbcb){_0x2cc607=_0x29fbcb['length'];if(!_0x4ccd80[_0xe595('0x3e')][_0xe595('0x59')](_0xe595('0x5a'))){_0x577509[_0xe595('0x43')]=qs[_0xe595('0x43')](_0x4ccd80['query'][_0xe595('0x43')]);_0x577509[_0xe595('0x2b')]=qs[_0xe595('0x2b')](_0x4ccd80[_0xe595('0x3e')]['offset']);}return _0x5f49d6[_0xe595('0x5b')](_0x577509);}})[_0xe595('0x30')](function(_0x5b3e57){if(_0x5b3e57){return _0x5b3e57?{'count':_0x2cc607,'rows':_0x5b3e57}:null;}})[_0xe595('0x30')](respondWithResult(_0x403634,null))[_0xe595('0x27')](handleError(_0x403634,null));};exports[_0xe595('0x5c')]=function(_0x23edc3,_0x532a18,_0x5069dd){var _0x44e7a5={};var _0x4d7100={};var _0x258dfa;var _0x55d9c0;return db[_0xe595('0x38')][_0xe595('0x56')]({'where':{'id':_0x23edc3[_0xe595('0x54')]['id']}})['then'](handleEntityNotFound(_0x532a18,null))[_0xe595('0x30')](function(_0x3e687a){if(_0x3e687a){_0x258dfa=_0x3e687a;_0x4d7100[_0xe595('0x3d')]=_[_0xe595('0x51')](db['VtigerField'][_0xe595('0x39')]);_0x4d7100[_0xe595('0x3e')]=_[_0xe595('0x51')](_0x23edc3['query']);_0x4d7100['filters']=_['intersection'](_0x4d7100[_0xe595('0x3d')],_0x4d7100[_0xe595('0x3e')]);_0x44e7a5['attributes']=_[_0xe595('0x3f')](_0x4d7100['model'],qs[_0xe595('0x41')](_0x23edc3[_0xe595('0x3e')][_0xe595('0x41')]));_0x44e7a5[_0xe595('0x40')]=_0x44e7a5[_0xe595('0x40')][_0xe595('0x42')]?_0x44e7a5[_0xe595('0x40')]:_0x4d7100[_0xe595('0x3d')];_0x44e7a5['order']=qs['sort'](_0x23edc3[_0xe595('0x3e')]['sort']);_0x44e7a5[_0xe595('0x46')]=qs[_0xe595('0x47')](_['pick'](_0x23edc3[_0xe595('0x3e')],_0x4d7100['filters']));if(_0x23edc3[_0xe595('0x3e')][_0xe595('0x48')]){_0x44e7a5['where']=_[_0xe595('0x49')](_0x44e7a5[_0xe595('0x46')],{'$or':_['map'](_0x44e7a5[_0xe595('0x40')],function(_0x40f71c){var _0xb09911={};_0xb09911[_0x40f71c]={'$like':'%'+_0x23edc3[_0xe595('0x3e')][_0xe595('0x48')]+'%'};return _0xb09911;})});}_0x44e7a5=_[_0xe595('0x49')]({},_0x44e7a5,_0x23edc3[_0xe595('0x4b')]);return _0x258dfa['getDescriptions'](_0x44e7a5);}})['then'](function(_0x1e30c0){if(_0x1e30c0){_0x55d9c0=_0x1e30c0[_0xe595('0x42')];if(!_0x23edc3[_0xe595('0x3e')]['hasOwnProperty']('nolimit')){_0x44e7a5[_0xe595('0x43')]=qs[_0xe595('0x43')](_0x23edc3[_0xe595('0x3e')][_0xe595('0x43')]);_0x44e7a5[_0xe595('0x2b')]=qs[_0xe595('0x2b')](_0x23edc3[_0xe595('0x3e')][_0xe595('0x2b')]);}return _0x258dfa[_0xe595('0x5c')](_0x44e7a5);}})['then'](function(_0x4682fd){if(_0x4682fd){return _0x4682fd?{'count':_0x55d9c0,'rows':_0x4682fd}:null;}})[_0xe595('0x30')](respondWithResult(_0x532a18,null))[_0xe595('0x27')](handleError(_0x532a18,null));}; \ No newline at end of file +var _0xdc10=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','params','includeAll','include','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xdc10,0x162));var _0x0dc1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xdc10[_0x346737];return _0x1ade2e;};'use strict';var pdf=require(_0x0dc1('0x0'));var emlformat=require(_0x0dc1('0x1'));var rimraf=require(_0x0dc1('0x2'));var zipdir=require(_0x0dc1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dc1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0dc1('0x5'));var util=require('util');var path=require(_0x0dc1('0x6'));var sox=require(_0x0dc1('0x7'));var csv=require('to-csv');var ejs=require(_0x0dc1('0x8'));var fs=require('fs');var _=require(_0x0dc1('0x9'));var squel=require(_0x0dc1('0xa'));var crypto=require(_0x0dc1('0xb'));var jsforce=require(_0x0dc1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0dc1('0xd'));var querystring=require(_0x0dc1('0xe'));var Papa=require(_0x0dc1('0xf'));var Redis=require(_0x0dc1('0x10'));var authService=require(_0x0dc1('0x11'));var qs=require(_0x0dc1('0x12'));var as=require(_0x0dc1('0x13'));var hardwareService=require(_0x0dc1('0x14'));var logger=require(_0x0dc1('0x15'))(_0x0dc1('0x16'));var utils=require(_0x0dc1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0dc1('0x18'));var db=require(_0x0dc1('0x19'))['db'];var jayson=require(_0x0dc1('0x1a'));var client=jayson[_0x0dc1('0x1b')][_0x0dc1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x28a963,_0x19759b,_0x57b7ac,_0x3248f1){return new BPromise(function(_0x14f4e1,_0x160771){var _0xe453cd=_0x3248f1||client;return _0xe453cd['request'](_0x28a963,_0x57b7ac)['then'](function(_0x40d93b){logger[_0x0dc1('0x1d')](_0x0dc1('0x1e'),_0x19759b,_0x0dc1('0x1f'));logger[_0x0dc1('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19759b,_0x0dc1('0x1f'),JSON[_0x0dc1('0x21')](_0x40d93b));if(_0x40d93b[_0x0dc1('0x22')]){if(_0x40d93b[_0x0dc1('0x22')][_0x0dc1('0x23')]===0x1f4){logger[_0x0dc1('0x22')](_0x0dc1('0x1e'),_0x19759b,_0x40d93b[_0x0dc1('0x22')][_0x0dc1('0x24')]);return _0x160771(_0x40d93b[_0x0dc1('0x22')][_0x0dc1('0x24')]);}logger[_0x0dc1('0x22')](_0x0dc1('0x1e'),_0x19759b,_0x40d93b[_0x0dc1('0x22')][_0x0dc1('0x24')]);return _0x14f4e1(_0x40d93b[_0x0dc1('0x22')][_0x0dc1('0x24')]);}else{logger[_0x0dc1('0x1d')](_0x0dc1('0x1e'),_0x19759b,'request\x20sent');_0x14f4e1(_0x40d93b[_0x0dc1('0x25')][_0x0dc1('0x24')]);}})[_0x0dc1('0x26')](function(_0x34b0b0){logger[_0x0dc1('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x19759b,_0x34b0b0);_0x160771(_0x34b0b0);});});}function respondWithStatusCode(_0x254a6a,_0x5e1eae){_0x5e1eae=_0x5e1eae||0xcc;return function(_0x2e39d1){if(_0x2e39d1){return _0x254a6a[_0x0dc1('0x27')](_0x5e1eae);}return _0x254a6a[_0x0dc1('0x28')](_0x5e1eae)['end']();};}function respondWithResult(_0x427be9,_0x25ae66){_0x25ae66=_0x25ae66||0xc8;return function(_0x3c2426){if(_0x3c2426){return _0x427be9[_0x0dc1('0x28')](_0x25ae66)[_0x0dc1('0x29')](_0x3c2426);}};}function respondWithFilteredResult(_0x468fcc,_0x3df152){return function(_0x51a719){if(_0x51a719){var _0x2d5236=_0x51a719[_0x0dc1('0x2a')],_0x31478f=_0x3df152['offset'],_0x2db301=_0x3df152[_0x0dc1('0x2b')]+_0x3df152[_0x0dc1('0x2c')],_0x4e963e;if(_0x2db301>=_0x2d5236){_0x2db301=_0x2d5236;_0x4e963e=0xc8;}else{_0x4e963e=0xce;}_0x468fcc[_0x0dc1('0x28')](_0x4e963e);return _0x468fcc[_0x0dc1('0x2d')](_0x0dc1('0x2e'),_0x31478f+'-'+_0x2db301+'/'+_0x2d5236)[_0x0dc1('0x29')](_0x51a719);}return null;};}function patchUpdates(_0x2b0e12){return function(_0x2c6dd6){try{jsonpatch[_0x0dc1('0x2f')](_0x2c6dd6,_0x2b0e12,!![]);}catch(_0x33eb07){return BPromise[_0x0dc1('0x30')](_0x33eb07);}return _0x2c6dd6['save']();};}function saveUpdates(_0x4cc595,_0x298080){return function(_0x88c49b){if(_0x88c49b){return _0x88c49b['update'](_0x4cc595)[_0x0dc1('0x31')](function(_0x379a3d){return _0x379a3d;});}return null;};}function removeEntity(_0x4f9be6,_0xf80eae){return function(_0x420389){if(_0x420389){return _0x420389['destroy']()[_0x0dc1('0x31')](function(){_0x4f9be6[_0x0dc1('0x28')](0xcc)[_0x0dc1('0x32')]();});}};}function handleEntityNotFound(_0x1e44ce,_0xfa45cb){return function(_0x28833b){if(!_0x28833b){_0x1e44ce['sendStatus'](0x194);}return _0x28833b;};}function handleError(_0x150b8a,_0x20b330){_0x20b330=_0x20b330||0x1f4;return function(_0x527ed2){logger[_0x0dc1('0x22')](_0x527ed2[_0x0dc1('0x33')]);if(_0x527ed2[_0x0dc1('0x34')]){delete _0x527ed2[_0x0dc1('0x34')];}_0x150b8a[_0x0dc1('0x28')](_0x20b330)[_0x0dc1('0x35')](_0x527ed2);};}exports[_0x0dc1('0x36')]=function(_0x57e2cb,_0x5892bc){var _0x3797da={},_0x25040a={},_0x2c6216={'count':0x0,'rows':[]};var _0x16a241=_[_0x0dc1('0x37')](db[_0x0dc1('0x38')][_0x0dc1('0x39')],function(_0x19ee12){return{'name':_0x19ee12[_0x0dc1('0x3a')],'type':_0x19ee12[_0x0dc1('0x3b')]['key']};});_0x25040a[_0x0dc1('0x3c')]=_['map'](_0x16a241,_0x0dc1('0x34'));_0x25040a[_0x0dc1('0x3d')]=_[_0x0dc1('0x3e')](_0x57e2cb[_0x0dc1('0x3d')]);_0x25040a['filters']=_[_0x0dc1('0x3f')](_0x25040a[_0x0dc1('0x3c')],_0x25040a['query']);_0x3797da['attributes']=_[_0x0dc1('0x3f')](_0x25040a[_0x0dc1('0x3c')],qs[_0x0dc1('0x40')](_0x57e2cb[_0x0dc1('0x3d')][_0x0dc1('0x40')]));_0x3797da['attributes']=_0x3797da[_0x0dc1('0x41')][_0x0dc1('0x42')]?_0x3797da['attributes']:_0x25040a[_0x0dc1('0x3c')];if(!_0x57e2cb['query'][_0x0dc1('0x43')]('nolimit')){_0x3797da['limit']=qs[_0x0dc1('0x2c')](_0x57e2cb[_0x0dc1('0x3d')][_0x0dc1('0x2c')]);_0x3797da['offset']=qs[_0x0dc1('0x2b')](_0x57e2cb[_0x0dc1('0x3d')][_0x0dc1('0x2b')]);}_0x3797da[_0x0dc1('0x44')]=qs[_0x0dc1('0x45')](_0x57e2cb[_0x0dc1('0x3d')][_0x0dc1('0x45')]);_0x3797da['where']=qs[_0x0dc1('0x46')](_[_0x0dc1('0x47')](_0x57e2cb[_0x0dc1('0x3d')],_0x25040a[_0x0dc1('0x46')]),_0x16a241);if(_0x57e2cb[_0x0dc1('0x3d')][_0x0dc1('0x48')]){_0x3797da[_0x0dc1('0x49')]=_[_0x0dc1('0x4a')](_0x3797da[_0x0dc1('0x49')],{'$or':_[_0x0dc1('0x37')](_0x16a241,function(_0x31871f){if(_0x31871f['type']!==_0x0dc1('0x4b')){var _0x3c6997={};_0x3c6997[_0x31871f[_0x0dc1('0x34')]]={'$like':'%'+_0x57e2cb['query']['filter']+'%'};return _0x3c6997;}})});}_0x3797da=_['merge']({},_0x3797da,_0x57e2cb[_0x0dc1('0x4c')]);var _0x5696ec={'where':_0x3797da[_0x0dc1('0x49')]};return db['VtigerConfiguration'][_0x0dc1('0x2a')](_0x5696ec)[_0x0dc1('0x31')](function(_0x210c6e){_0x2c6216['count']=_0x210c6e;if(_0x57e2cb[_0x0dc1('0x3d')]['includeAll']){_0x3797da['include']=[{'all':!![]}];}return db[_0x0dc1('0x38')][_0x0dc1('0x4d')](_0x3797da);})[_0x0dc1('0x31')](function(_0x1f7377){_0x2c6216[_0x0dc1('0x4e')]=_0x1f7377;return _0x2c6216;})[_0x0dc1('0x31')](respondWithFilteredResult(_0x5892bc,_0x3797da))[_0x0dc1('0x26')](handleError(_0x5892bc,null));};exports['show']=function(_0x4635fc,_0x5e41bf){var _0x5ac30d={'raw':![],'where':{'id':_0x4635fc[_0x0dc1('0x4f')]['id']}},_0x45dfb0={};_0x45dfb0[_0x0dc1('0x3c')]=_['keys'](db[_0x0dc1('0x38')][_0x0dc1('0x39')]);_0x45dfb0[_0x0dc1('0x3d')]=_[_0x0dc1('0x3e')](_0x4635fc[_0x0dc1('0x3d')]);_0x45dfb0[_0x0dc1('0x46')]=_[_0x0dc1('0x3f')](_0x45dfb0[_0x0dc1('0x3c')],_0x45dfb0[_0x0dc1('0x3d')]);_0x5ac30d[_0x0dc1('0x41')]=_['intersection'](_0x45dfb0[_0x0dc1('0x3c')],qs[_0x0dc1('0x40')](_0x4635fc['query'][_0x0dc1('0x40')]));_0x5ac30d[_0x0dc1('0x41')]=_0x5ac30d[_0x0dc1('0x41')][_0x0dc1('0x42')]?_0x5ac30d[_0x0dc1('0x41')]:_0x45dfb0[_0x0dc1('0x3c')];if(_0x4635fc[_0x0dc1('0x3d')][_0x0dc1('0x50')]){_0x5ac30d[_0x0dc1('0x51')]=[{'all':!![]}];}_0x5ac30d=_['merge']({},_0x5ac30d,_0x4635fc[_0x0dc1('0x4c')]);return db[_0x0dc1('0x38')][_0x0dc1('0x52')](_0x5ac30d)[_0x0dc1('0x31')](handleEntityNotFound(_0x5e41bf,null))[_0x0dc1('0x31')](respondWithResult(_0x5e41bf,null))['catch'](handleError(_0x5e41bf,null));};exports[_0x0dc1('0x53')]=function(_0x21b0e1,_0x3277b1){return db[_0x0dc1('0x38')][_0x0dc1('0x53')](_0x21b0e1['body'],{})[_0x0dc1('0x31')](respondWithResult(_0x3277b1,0xc9))[_0x0dc1('0x26')](handleError(_0x3277b1,null));};exports['update']=function(_0x7fee65,_0x52bad2){if(_0x7fee65['body']['id']){delete _0x7fee65[_0x0dc1('0x54')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x7fee65['params']['id']}})[_0x0dc1('0x31')](handleEntityNotFound(_0x52bad2,null))[_0x0dc1('0x31')](saveUpdates(_0x7fee65[_0x0dc1('0x54')],null))['then'](respondWithResult(_0x52bad2,null))[_0x0dc1('0x26')](handleError(_0x52bad2,null));};exports[_0x0dc1('0x55')]=function(_0x58c150,_0x42e121){return db['VtigerConfiguration']['find']({'where':{'id':_0x58c150[_0x0dc1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42e121,null))[_0x0dc1('0x31')](removeEntity(_0x42e121,null))[_0x0dc1('0x26')](handleError(_0x42e121,null));};exports[_0x0dc1('0x56')]=function(_0x108c2d,_0x5165e6,_0x38050f){var _0x4a26a5={};var _0xb38e8d={};var _0x1e13bf;var _0x5e944a;return db['VtigerConfiguration'][_0x0dc1('0x57')]({'where':{'id':_0x108c2d[_0x0dc1('0x4f')]['id']}})[_0x0dc1('0x31')](handleEntityNotFound(_0x5165e6,null))[_0x0dc1('0x31')](function(_0x5ec522){if(_0x5ec522){_0x1e13bf=_0x5ec522;_0xb38e8d[_0x0dc1('0x3c')]=_[_0x0dc1('0x3e')](db[_0x0dc1('0x58')][_0x0dc1('0x39')]);_0xb38e8d[_0x0dc1('0x3d')]=_[_0x0dc1('0x3e')](_0x108c2d[_0x0dc1('0x3d')]);_0xb38e8d[_0x0dc1('0x46')]=_[_0x0dc1('0x3f')](_0xb38e8d[_0x0dc1('0x3c')],_0xb38e8d[_0x0dc1('0x3d')]);_0x4a26a5[_0x0dc1('0x41')]=_[_0x0dc1('0x3f')](_0xb38e8d[_0x0dc1('0x3c')],qs[_0x0dc1('0x40')](_0x108c2d['query'][_0x0dc1('0x40')]));_0x4a26a5[_0x0dc1('0x41')]=_0x4a26a5['attributes'][_0x0dc1('0x42')]?_0x4a26a5['attributes']:_0xb38e8d['model'];_0x4a26a5[_0x0dc1('0x44')]=qs[_0x0dc1('0x45')](_0x108c2d[_0x0dc1('0x3d')][_0x0dc1('0x45')]);_0x4a26a5[_0x0dc1('0x49')]=qs['filters'](_[_0x0dc1('0x47')](_0x108c2d[_0x0dc1('0x3d')],_0xb38e8d[_0x0dc1('0x46')]));if(_0x108c2d[_0x0dc1('0x3d')]['filter']){_0x4a26a5[_0x0dc1('0x49')]=_[_0x0dc1('0x4a')](_0x4a26a5[_0x0dc1('0x49')],{'$or':_[_0x0dc1('0x37')](_0x4a26a5[_0x0dc1('0x41')],function(_0x1782de){var _0x195e9d={};_0x195e9d[_0x1782de]={'$like':'%'+_0x108c2d[_0x0dc1('0x3d')][_0x0dc1('0x48')]+'%'};return _0x195e9d;})});}_0x4a26a5=_[_0x0dc1('0x4a')]({},_0x4a26a5,_0x108c2d[_0x0dc1('0x4c')]);return _0x1e13bf[_0x0dc1('0x56')](_0x4a26a5);}})[_0x0dc1('0x31')](function(_0x50b336){if(_0x50b336){_0x5e944a=_0x50b336[_0x0dc1('0x42')];if(!_0x108c2d[_0x0dc1('0x3d')][_0x0dc1('0x43')](_0x0dc1('0x59'))){_0x4a26a5['limit']=qs[_0x0dc1('0x2c')](_0x108c2d[_0x0dc1('0x3d')][_0x0dc1('0x2c')]);_0x4a26a5['offset']=qs['offset'](_0x108c2d['query']['offset']);}return _0x1e13bf[_0x0dc1('0x56')](_0x4a26a5);}})[_0x0dc1('0x31')](function(_0xb73659){if(_0xb73659){return _0xb73659?{'count':_0x5e944a,'rows':_0xb73659}:null;}})[_0x0dc1('0x31')](respondWithResult(_0x5165e6,null))['catch'](handleError(_0x5165e6,null));};exports[_0x0dc1('0x5a')]=function(_0xd47bfc,_0x412af1,_0x2983b4){var _0x45598c={};var _0x1d1d05={};var _0x52f920;var _0x3460d7;return db[_0x0dc1('0x38')][_0x0dc1('0x57')]({'where':{'id':_0xd47bfc[_0x0dc1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x412af1,null))[_0x0dc1('0x31')](function(_0x1160ac){if(_0x1160ac){_0x52f920=_0x1160ac;_0x1d1d05[_0x0dc1('0x3c')]=_[_0x0dc1('0x3e')](db[_0x0dc1('0x58')][_0x0dc1('0x39')]);_0x1d1d05[_0x0dc1('0x3d')]=_['keys'](_0xd47bfc[_0x0dc1('0x3d')]);_0x1d1d05[_0x0dc1('0x46')]=_[_0x0dc1('0x3f')](_0x1d1d05[_0x0dc1('0x3c')],_0x1d1d05[_0x0dc1('0x3d')]);_0x45598c[_0x0dc1('0x41')]=_[_0x0dc1('0x3f')](_0x1d1d05[_0x0dc1('0x3c')],qs[_0x0dc1('0x40')](_0xd47bfc[_0x0dc1('0x3d')][_0x0dc1('0x40')]));_0x45598c[_0x0dc1('0x41')]=_0x45598c[_0x0dc1('0x41')][_0x0dc1('0x42')]?_0x45598c['attributes']:_0x1d1d05[_0x0dc1('0x3c')];_0x45598c['order']=qs[_0x0dc1('0x45')](_0xd47bfc[_0x0dc1('0x3d')][_0x0dc1('0x45')]);_0x45598c['where']=qs[_0x0dc1('0x46')](_['pick'](_0xd47bfc[_0x0dc1('0x3d')],_0x1d1d05['filters']));if(_0xd47bfc[_0x0dc1('0x3d')][_0x0dc1('0x48')]){_0x45598c[_0x0dc1('0x49')]=_['merge'](_0x45598c[_0x0dc1('0x49')],{'$or':_[_0x0dc1('0x37')](_0x45598c['attributes'],function(_0x1f6df1){var _0x479665={};_0x479665[_0x1f6df1]={'$like':'%'+_0xd47bfc['query'][_0x0dc1('0x48')]+'%'};return _0x479665;})});}_0x45598c=_[_0x0dc1('0x4a')]({},_0x45598c,_0xd47bfc[_0x0dc1('0x4c')]);return _0x52f920[_0x0dc1('0x5a')](_0x45598c);}})[_0x0dc1('0x31')](function(_0x3f4163){if(_0x3f4163){_0x3460d7=_0x3f4163[_0x0dc1('0x42')];if(!_0xd47bfc[_0x0dc1('0x3d')][_0x0dc1('0x43')]('nolimit')){_0x45598c[_0x0dc1('0x2c')]=qs['limit'](_0xd47bfc[_0x0dc1('0x3d')][_0x0dc1('0x2c')]);_0x45598c[_0x0dc1('0x2b')]=qs[_0x0dc1('0x2b')](_0xd47bfc[_0x0dc1('0x3d')]['offset']);}return _0x52f920[_0x0dc1('0x5a')](_0x45598c);}})[_0x0dc1('0x31')](function(_0x40340e){if(_0x40340e){return _0x40340e?{'count':_0x3460d7,'rows':_0x40340e}:null;}})[_0x0dc1('0x31')](respondWithResult(_0x412af1,null))['catch'](handleError(_0x412af1,null));};exports[_0x0dc1('0x5b')]=function(_0x46cd1f,_0x23a549,_0x234ac6){var _0x8511b7={};var _0x2954dc={};var _0xba1d76;var _0x34927e;return db['VtigerConfiguration'][_0x0dc1('0x57')]({'where':{'id':_0x46cd1f[_0x0dc1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x23a549,null))[_0x0dc1('0x31')](function(_0x112941){if(_0x112941){_0xba1d76=_0x112941;_0x2954dc[_0x0dc1('0x3c')]=_[_0x0dc1('0x3e')](db[_0x0dc1('0x58')][_0x0dc1('0x39')]);_0x2954dc[_0x0dc1('0x3d')]=_[_0x0dc1('0x3e')](_0x46cd1f[_0x0dc1('0x3d')]);_0x2954dc[_0x0dc1('0x46')]=_[_0x0dc1('0x3f')](_0x2954dc[_0x0dc1('0x3c')],_0x2954dc['query']);_0x8511b7['attributes']=_['intersection'](_0x2954dc[_0x0dc1('0x3c')],qs['fields'](_0x46cd1f['query']['fields']));_0x8511b7[_0x0dc1('0x41')]=_0x8511b7[_0x0dc1('0x41')]['length']?_0x8511b7['attributes']:_0x2954dc[_0x0dc1('0x3c')];_0x8511b7[_0x0dc1('0x44')]=qs[_0x0dc1('0x45')](_0x46cd1f[_0x0dc1('0x3d')][_0x0dc1('0x45')]);_0x8511b7[_0x0dc1('0x49')]=qs[_0x0dc1('0x46')](_[_0x0dc1('0x47')](_0x46cd1f[_0x0dc1('0x3d')],_0x2954dc[_0x0dc1('0x46')]));if(_0x46cd1f[_0x0dc1('0x3d')][_0x0dc1('0x48')]){_0x8511b7[_0x0dc1('0x49')]=_[_0x0dc1('0x4a')](_0x8511b7[_0x0dc1('0x49')],{'$or':_[_0x0dc1('0x37')](_0x8511b7[_0x0dc1('0x41')],function(_0x226014){var _0x16eac6={};_0x16eac6[_0x226014]={'$like':'%'+_0x46cd1f[_0x0dc1('0x3d')][_0x0dc1('0x48')]+'%'};return _0x16eac6;})});}_0x8511b7=_['merge']({},_0x8511b7,_0x46cd1f['options']);return _0xba1d76[_0x0dc1('0x5b')](_0x8511b7);}})['then'](function(_0x4ae16c){if(_0x4ae16c){_0x34927e=_0x4ae16c['length'];if(!_0x46cd1f[_0x0dc1('0x3d')][_0x0dc1('0x43')](_0x0dc1('0x59'))){_0x8511b7[_0x0dc1('0x2c')]=qs[_0x0dc1('0x2c')](_0x46cd1f[_0x0dc1('0x3d')]['limit']);_0x8511b7[_0x0dc1('0x2b')]=qs[_0x0dc1('0x2b')](_0x46cd1f[_0x0dc1('0x3d')]['offset']);}return _0xba1d76[_0x0dc1('0x5b')](_0x8511b7);}})[_0x0dc1('0x31')](function(_0x2f9a6e){if(_0x2f9a6e){return _0x2f9a6e?{'count':_0x34927e,'rows':_0x2f9a6e}:null;}})[_0x0dc1('0x31')](respondWithResult(_0x23a549,null))[_0x0dc1('0x26')](handleError(_0x23a549,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d4ae66a..61c9306 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 _0x0706=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x2ff333,_0x6d2ad4){var _0x49e242=function(_0x6e4abe){while(--_0x6e4abe){_0x2ff333['push'](_0x2ff333['shift']());}};_0x49e242(++_0x6d2ad4);}(_0x0706,0x1dc));var _0x6070=function(_0x23bb81,_0x1361de){_0x23bb81=_0x23bb81-0x0;var _0x433299=_0x0706[_0x23bb81];return _0x433299;};'use strict';var _=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var logger=require(_0x6070('0x2'))(_0x6070('0x3'));var moment=require(_0x6070('0x4'));var BPromise=require(_0x6070('0x5'));var rp=require(_0x6070('0x6'));var fs=require('fs');var path=require(_0x6070('0x7'));var rimraf=require(_0x6070('0x8'));var config=require(_0x6070('0x9'));var attributes=require(_0x6070('0xa'));module[_0x6070('0xb')]=function(_0x599113,_0x2c7c28){return _0x599113[_0x6070('0xc')](_0x6070('0xd'),attributes,{'tableName':_0x6070('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb65c=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x26dd5,_0xdbe031){var _0xa7ca3c=function(_0x1ceaf8){while(--_0x1ceaf8){_0x26dd5['push'](_0x26dd5['shift']());}};_0xa7ca3c(++_0xdbe031);}(_0xb65c,0x17a));var _0xcb65=function(_0x28e334,_0x419adf){_0x28e334=_0x28e334-0x0;var _0x5d65fa=_0xb65c[_0x28e334];return _0x5d65fa;};'use strict';var _=require(_0xcb65('0x0'));var util=require(_0xcb65('0x1'));var logger=require(_0xcb65('0x2'))('api');var moment=require(_0xcb65('0x3'));var BPromise=require(_0xcb65('0x4'));var rp=require(_0xcb65('0x5'));var fs=require('fs');var path=require(_0xcb65('0x6'));var rimraf=require('rimraf');var config=require(_0xcb65('0x7'));var attributes=require(_0xcb65('0x8'));module['exports']=function(_0x2328f2,_0x2a8172){return _0x2328f2[_0xcb65('0x9')](_0xcb65('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 3ff0e70..53f1430 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 _0x5a69=['info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0xb7dc7d,_0x7fed85){var _0x5d2bcf=function(_0x28fd31){while(--_0x28fd31){_0xb7dc7d['push'](_0xb7dc7d['shift']());}};_0x5d2bcf(++_0x7fed85);}(_0x5a69,0x1e6));var _0x95a6=function(_0xf40860,_0x533e94){_0xf40860=_0xf40860-0x0;var _0x1bf008=_0x5a69[_0xf40860];return _0x1bf008;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var moment=require(_0x95a6('0x2'));var BPromise=require(_0x95a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95a6('0x4'))['db'];var utils=require(_0x95a6('0x5'));var logger=require('../../config/logger')(_0x95a6('0x6'));var config=require(_0x95a6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7079de,_0x3081c0,_0x7f0218){return new BPromise(function(_0x298925,_0x33becf){return client[_0x95a6('0x8')](_0x7079de,_0x7f0218)[_0x95a6('0x9')](function(_0x482aad){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x3081c0,_0x95a6('0xa'));logger[_0x95a6('0xb')](_0x95a6('0xc'),_0x3081c0,_0x95a6('0xa'),JSON[_0x95a6('0xd')](_0x482aad));if(_0x482aad['error']){if(_0x482aad[_0x95a6('0xe')][_0x95a6('0xf')]===0x1f4){logger[_0x95a6('0xe')](_0x95a6('0x10'),_0x3081c0,_0x482aad[_0x95a6('0xe')][_0x95a6('0x11')]);return _0x33becf(_0x482aad['error'][_0x95a6('0x11')]);}logger[_0x95a6('0xe')](_0x95a6('0x10'),_0x3081c0,_0x482aad[_0x95a6('0xe')]['message']);return _0x298925(_0x482aad[_0x95a6('0xe')][_0x95a6('0x11')]);}else{logger[_0x95a6('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3081c0,_0x95a6('0xa'));_0x298925(_0x482aad[_0x95a6('0x13')][_0x95a6('0x11')]);}})[_0x95a6('0x14')](function(_0x1d05ac){logger[_0x95a6('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3081c0,_0x1d05ac);_0x33becf(_0x1d05ac);});});} \ No newline at end of file +var _0x62f5=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c78e1,_0x1aff4a){var _0x3b36d1=function(_0x545749){while(--_0x545749){_0x4c78e1['push'](_0x4c78e1['shift']());}};_0x3b36d1(++_0x1aff4a);}(_0x62f5,0xa2));var _0x562f=function(_0x2236dd,_0x3d3c58){_0x2236dd=_0x2236dd-0x0;var _0x1fe24b=_0x62f5[_0x2236dd];return _0x1fe24b;};'use strict';var _=require('lodash');var util=require(_0x562f('0x0'));var moment=require(_0x562f('0x1'));var BPromise=require(_0x562f('0x2'));var rs=require(_0x562f('0x3'));var fs=require('fs');var Redis=require(_0x562f('0x4'));var db=require(_0x562f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x562f('0x6'))('rpc');var config=require(_0x562f('0x7'));var jayson=require(_0x562f('0x8'));var client=jayson[_0x562f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x189091,_0x30f2e8,_0xfec9e5){return new BPromise(function(_0x189b17,_0xaae212){return client[_0x562f('0xa')](_0x189091,_0xfec9e5)[_0x562f('0xb')](function(_0x417658){logger[_0x562f('0xc')](_0x562f('0xd'),_0x30f2e8,'request\x20sent');logger['debug'](_0x562f('0xe'),_0x30f2e8,'request\x20sent',JSON[_0x562f('0xf')](_0x417658));if(_0x417658[_0x562f('0x10')]){if(_0x417658[_0x562f('0x10')][_0x562f('0x11')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x30f2e8,_0x417658[_0x562f('0x10')][_0x562f('0x12')]);return _0xaae212(_0x417658[_0x562f('0x10')][_0x562f('0x12')]);}logger[_0x562f('0x10')](_0x562f('0xd'),_0x30f2e8,_0x417658[_0x562f('0x10')][_0x562f('0x12')]);return _0x189b17(_0x417658[_0x562f('0x10')][_0x562f('0x12')]);}else{logger[_0x562f('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x30f2e8,'request\x20sent');_0x189b17(_0x417658[_0x562f('0x13')][_0x562f('0x12')]);}})[_0x562f('0x14')](function(_0x249c7e){logger[_0x562f('0x10')](_0x562f('0xd'),_0x30f2e8,_0x249c7e);_0xaae212(_0x249c7e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c787e6c..ba41e8c 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 _0x4b74=['/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x4b74,0x75));var _0x44b7=function(_0x446f2f,_0x1fab5d){_0x446f2f=_0x446f2f-0x0;var _0xfc2a83=_0x4b74[_0x446f2f];return _0xfc2a83;};'use strict';var multer=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var path=require(_0x44b7('0x2'));var timeout=require(_0x44b7('0x3'));var express=require(_0x44b7('0x4'));var router=express[_0x44b7('0x5')]();var auth=require(_0x44b7('0x6'));var interaction=require(_0x44b7('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b7('0x8')]);router['get'](_0x44b7('0x9'),auth[_0x44b7('0xa')](),controller[_0x44b7('0xb')]);router[_0x44b7('0xc')]('/',auth[_0x44b7('0xa')](),controller[_0x44b7('0xd')]);router[_0x44b7('0xe')](_0x44b7('0x9'),auth[_0x44b7('0xa')](),controller['update']);router[_0x44b7('0xf')](_0x44b7('0x9'),auth[_0x44b7('0xa')](),controller[_0x44b7('0x10')]);module[_0x44b7('0x11')]=router; \ No newline at end of file +var _0x6afc=['./intVtigerField.controller','get','index','show','isAuthenticated','create','put','update','delete','/:id','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2fc8a3,_0xba3d70){var _0x1d043a=function(_0x4ad21f){while(--_0x4ad21f){_0x2fc8a3['push'](_0x2fc8a3['shift']());}};_0x1d043a(++_0xba3d70);}(_0x6afc,0xcb));var _0xc6af=function(_0x4ddecb,_0x1426ba){_0x4ddecb=_0x4ddecb-0x0;var _0x38f858=_0x6afc[_0x4ddecb];return _0x38f858;};'use strict';var multer=require('multer');var util=require(_0xc6af('0x0'));var path=require('path');var timeout=require(_0xc6af('0x1'));var express=require(_0xc6af('0x2'));var router=express['Router']();var auth=require(_0xc6af('0x3'));var interaction=require(_0xc6af('0x4'));var config=require('../../config/environment');var controller=require(_0xc6af('0x5'));router[_0xc6af('0x6')]('/',auth['isAuthenticated'](),controller[_0xc6af('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc6af('0x8')]);router['post']('/',auth[_0xc6af('0x9')](),controller[_0xc6af('0xa')]);router[_0xc6af('0xb')]('/:id',auth[_0xc6af('0x9')](),controller[_0xc6af('0xc')]);router[_0xc6af('0xd')](_0xc6af('0xe'),auth['isAuthenticated'](),controller[_0xc6af('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index daf8396..430bad8 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 _0x2121=['keyValue','picklist','string','STRING','sequelize','exports','variable','customVariable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2121,0x1b4));var _0x1212=function(_0x77043d,_0x127413){_0x77043d=_0x77043d-0x0;var _0x467b23=_0x2121[_0x77043d];return _0x467b23;};'use strict';var Sequelize=require(_0x1212('0x0'));module[_0x1212('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1212('0x2'),_0x1212('0x3'),_0x1212('0x4'),_0x1212('0x5')),'defaultValue':_0x1212('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1212('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1212('0x6'),_0x1212('0x2'),_0x1212('0x3'))},'keyContent':{'type':Sequelize[_0x1212('0x7')]},'idField':{'type':Sequelize[_0x1212('0x7')]},'nameField':{'type':Sequelize[_0x1212('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1212('0x7')]}}; \ No newline at end of file +var _0x9aea=['customVariable','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x2e22e1,_0x23b71f){var _0x5c55cd=function(_0x13d46d){while(--_0x13d46d){_0x2e22e1['push'](_0x2e22e1['shift']());}};_0x5c55cd(++_0x23b71f);}(_0x9aea,0xdd));var _0xa9ae=function(_0x255209,_0x219150){_0x255209=_0x255209-0x0;var _0x56bc3f=_0x9aea[_0x255209];return _0x56bc3f;};'use strict';var Sequelize=require(_0xa9ae('0x0'));module['exports']={'type':{'type':Sequelize[_0xa9ae('0x1')]('string',_0xa9ae('0x2'),_0xa9ae('0x3'),'keyValue',_0xa9ae('0x4')),'defaultValue':_0xa9ae('0x5')},'content':{'type':Sequelize[_0xa9ae('0x6')]},'key':{'type':Sequelize[_0xa9ae('0x6')]},'keyType':{'type':Sequelize[_0xa9ae('0x1')]('string',_0xa9ae('0x2'),_0xa9ae('0x3'))},'keyContent':{'type':Sequelize[_0xa9ae('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa9ae('0x6')]},'customField':{'type':Sequelize[_0xa9ae('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9ae('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3b0d8b7..2794bb9 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 _0xc949=['fields','include','options','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params'];(function(_0x2471bd,_0x5e4ded){var _0x2de3c3=function(_0xced2cd){while(--_0xced2cd){_0x2471bd['push'](_0x2471bd['shift']());}};_0x2de3c3(++_0x5e4ded);}(_0xc949,0x181));var _0x9c94=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc949[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x9c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c94('0x1'));var zipdir=require(_0x9c94('0x2'));var jsonpatch=require(_0x9c94('0x3'));var rp=require(_0x9c94('0x4'));var moment=require('moment');var BPromise=require(_0x9c94('0x5'));var Mustache=require(_0x9c94('0x6'));var util=require('util');var path=require(_0x9c94('0x7'));var sox=require(_0x9c94('0x8'));var csv=require(_0x9c94('0x9'));var ejs=require(_0x9c94('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x9'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=_0xe52641[_0x9c94('0x1f')],_0x56e4e1=_0x4f0013[_0x9c94('0x20')],_0xf4054e=_0x4f0013['offset']+_0x4f0013[_0x9c94('0x21')],_0x48d121;if(_0xf4054e>=_0x4d6308){_0xf4054e=_0x4d6308;_0x48d121=0xc8;}else{_0x48d121=0xce;}_0x26e629[_0x9c94('0x1c')](_0x48d121);return _0x26e629[_0x9c94('0x22')](_0x9c94('0x23'),_0x56e4e1+'-'+_0xf4054e+'/'+_0x4d6308)[_0x9c94('0x1e')](_0xe52641);}return null;};}function patchUpdates(_0xfbcc7c){return function(_0x3e361c){try{jsonpatch['apply'](_0x3e361c,_0xfbcc7c,!![]);}catch(_0x2c9736){return BPromise[_0x9c94('0x24')](_0x2c9736);}return _0x3e361c['save']();};}function saveUpdates(_0x141801,_0x845304){return function(_0x3caab0){if(_0x3caab0){return _0x3caab0[_0x9c94('0x25')](_0x141801)[_0x9c94('0x26')](function(_0x3b1481){return _0x3b1481;});}return null;};}function removeEntity(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x27')]()[_0x9c94('0x26')](function(){_0xadab16[_0x9c94('0x1c')](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x8c0b7f,_0x5b1020){return function(_0x1f3b14){if(!_0x1f3b14){_0x8c0b7f[_0x9c94('0x1b')](0x194);}return _0x1f3b14;};}function handleError(_0x5c2647,_0x102130){_0x102130=_0x102130||0x1f4;return function(_0x2c3d25){logger[_0x9c94('0x28')](_0x2c3d25[_0x9c94('0x29')]);if(_0x2c3d25[_0x9c94('0x2a')]){delete _0x2c3d25['name'];}_0x5c2647[_0x9c94('0x1c')](_0x102130)[_0x9c94('0x2b')](_0x2c3d25);};}exports['index']=function(_0x248280,_0x4cfb9c){var _0xa5df6f={},_0x14d41b={},_0x330bd4={'count':0x0,'rows':[]};var _0x4008e8=_[_0x9c94('0x2c')](db[_0x9c94('0x2d')][_0x9c94('0x2e')],function(_0x561fdc){return{'name':_0x561fdc['fieldName'],'type':_0x561fdc[_0x9c94('0x2f')][_0x9c94('0x30')]};});_0x14d41b[_0x9c94('0x31')]=_['map'](_0x4008e8,_0x9c94('0x2a'));_0x14d41b['query']=_[_0x9c94('0x32')](_0x248280[_0x9c94('0x33')]);_0x14d41b[_0x9c94('0x34')]=_['intersection'](_0x14d41b['model'],_0x14d41b[_0x9c94('0x33')]);_0xa5df6f[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x14d41b['model'],qs['fields'](_0x248280['query']['fields']));_0xa5df6f[_0x9c94('0x35')]=_0xa5df6f['attributes'][_0x9c94('0x37')]?_0xa5df6f[_0x9c94('0x35')]:_0x14d41b['model'];if(!_0x248280['query'][_0x9c94('0x38')](_0x9c94('0x39'))){_0xa5df6f[_0x9c94('0x21')]=qs[_0x9c94('0x21')](_0x248280[_0x9c94('0x33')][_0x9c94('0x21')]);_0xa5df6f[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x248280[_0x9c94('0x33')][_0x9c94('0x20')]);}_0xa5df6f[_0x9c94('0x3a')]=qs[_0x9c94('0x3b')](_0x248280[_0x9c94('0x33')][_0x9c94('0x3b')]);_0xa5df6f[_0x9c94('0x3c')]=qs[_0x9c94('0x34')](_[_0x9c94('0x3d')](_0x248280[_0x9c94('0x33')],_0x14d41b['filters']),_0x4008e8);if(_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]){_0xa5df6f[_0x9c94('0x3c')]=_[_0x9c94('0x3f')](_0xa5df6f[_0x9c94('0x3c')],{'$or':_[_0x9c94('0x2c')](_0x4008e8,function(_0x13f94c){if(_0x13f94c['type']!==_0x9c94('0x40')){var _0x591011={};_0x591011[_0x13f94c[_0x9c94('0x2a')]]={'$like':'%'+_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]+'%'};return _0x591011;}})});}_0xa5df6f=_[_0x9c94('0x3f')]({},_0xa5df6f,_0x248280['options']);var _0x245278={'where':_0xa5df6f['where']};return db[_0x9c94('0x2d')][_0x9c94('0x1f')](_0x245278)[_0x9c94('0x26')](function(_0x5e3119){_0x330bd4[_0x9c94('0x1f')]=_0x5e3119;if(_0x248280['query'][_0x9c94('0x41')]){_0xa5df6f['include']=[{'all':!![]}];}return db['VtigerField'][_0x9c94('0x42')](_0xa5df6f);})[_0x9c94('0x26')](function(_0x11c1c0){_0x330bd4[_0x9c94('0x43')]=_0x11c1c0;return _0x330bd4;})['then'](respondWithFilteredResult(_0x4cfb9c,_0xa5df6f))[_0x9c94('0x44')](handleError(_0x4cfb9c,null));};exports[_0x9c94('0x45')]=function(_0x425778,_0x360960){var _0x57ab57={'raw':!![],'where':{'id':_0x425778[_0x9c94('0x46')]['id']}},_0x1039e8={};_0x1039e8['model']=_[_0x9c94('0x32')](db[_0x9c94('0x2d')][_0x9c94('0x2e')]);_0x1039e8['query']=_['keys'](_0x425778[_0x9c94('0x33')]);_0x1039e8[_0x9c94('0x34')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],_0x1039e8[_0x9c94('0x33')]);_0x57ab57[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],qs[_0x9c94('0x47')](_0x425778[_0x9c94('0x33')][_0x9c94('0x47')]));_0x57ab57['attributes']=_0x57ab57[_0x9c94('0x35')]['length']?_0x57ab57[_0x9c94('0x35')]:_0x1039e8[_0x9c94('0x31')];if(_0x425778[_0x9c94('0x33')][_0x9c94('0x41')]){_0x57ab57[_0x9c94('0x48')]=[{'all':!![]}];}_0x57ab57=_[_0x9c94('0x3f')]({},_0x57ab57,_0x425778[_0x9c94('0x49')]);return db['VtigerField']['find'](_0x57ab57)[_0x9c94('0x26')](handleEntityNotFound(_0x360960,null))[_0x9c94('0x26')](respondWithResult(_0x360960,null))[_0x9c94('0x44')](handleError(_0x360960,null));};exports['create']=function(_0x3c507f,_0x3966fa){return db['VtigerField']['create'](_0x3c507f['body'],{})['then'](respondWithResult(_0x3966fa,0xc9))[_0x9c94('0x44')](handleError(_0x3966fa,null));};exports['update']=function(_0x5ccc46,_0x157df2){if(_0x5ccc46['body']['id']){delete _0x5ccc46[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x2d')][_0x9c94('0x4b')]({'where':{'id':_0x5ccc46[_0x9c94('0x46')]['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x157df2,null))['then'](saveUpdates(_0x5ccc46[_0x9c94('0x4a')],null))[_0x9c94('0x26')](respondWithResult(_0x157df2,null))[_0x9c94('0x44')](handleError(_0x157df2,null));};exports[_0x9c94('0x27')]=function(_0x41226a,_0x1c6634){return db['VtigerField'][_0x9c94('0x4b')]({'where':{'id':_0x41226a['params']['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x1c6634,null))[_0x9c94('0x26')](removeEntity(_0x1c6634,null))[_0x9c94('0x44')](handleError(_0x1c6634,null));}; \ No newline at end of file +var _0x6f47=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','VtigerField','findAll','catch','show','params','find','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6f47,0xc7));var _0x76f4=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x6f47[_0x2aec52];return _0x3b8835;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76f4('0x0'));var rimraf=require(_0x76f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76f4('0x2'));var rp=require('request-promise');var moment=require(_0x76f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x76f4('0x4'));var util=require(_0x76f4('0x5'));var path=require(_0x76f4('0x6'));var sox=require(_0x76f4('0x7'));var csv=require('to-csv');var ejs=require(_0x76f4('0x8'));var fs=require('fs');var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0xd'));var querystring=require(_0x76f4('0xe'));var Papa=require(_0x76f4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0x10'));var as=require(_0x76f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x12'));var utils=require(_0x76f4('0x13'));var config=require(_0x76f4('0x14'));var licenseUtil=require(_0x76f4('0x15'));var db=require(_0x76f4('0x16'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x17')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x18')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x19')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=_0x40252d[_0x76f4('0x1a')],_0x2b5e23=_0x979946[_0x76f4('0x1b')],_0x46ba51=_0x979946[_0x76f4('0x1b')]+_0x979946[_0x76f4('0x1c')],_0x981a87;if(_0x46ba51>=_0x3d8f5a){_0x46ba51=_0x3d8f5a;_0x981a87=0xc8;}else{_0x981a87=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x981a87);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2b5e23+'-'+_0x46ba51+'/'+_0x3d8f5a)[_0x76f4('0x19')](_0x40252d);}return null;};}function patchUpdates(_0xfedbe4){return function(_0x3e809f){try{jsonpatch[_0x76f4('0x20')](_0x3e809f,_0xfedbe4,!![]);}catch(_0x35b406){return BPromise[_0x76f4('0x21')](_0x35b406);}return _0x3e809f[_0x76f4('0x22')]();};}function saveUpdates(_0x5bf3d5,_0x262937){return function(_0x4dad9b){if(_0x4dad9b){return _0x4dad9b[_0x76f4('0x23')](_0x5bf3d5)[_0x76f4('0x24')](function(_0xf8f722){return _0xf8f722;});}return null;};}function removeEntity(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x25')]()[_0x76f4('0x24')](function(){_0x517c00[_0x76f4('0x1d')](0xcc)[_0x76f4('0x18')]();});}};}function handleEntityNotFound(_0x42ef70,_0x4786c9){return function(_0x3f4d11){if(!_0x3f4d11){_0x42ef70['sendStatus'](0x194);}return _0x3f4d11;};}function handleError(_0x504aa8,_0x3794fa){_0x3794fa=_0x3794fa||0x1f4;return function(_0x497913){logger[_0x76f4('0x26')](_0x497913['stack']);if(_0x497913['name']){delete _0x497913['name'];}_0x504aa8[_0x76f4('0x1d')](_0x3794fa)[_0x76f4('0x27')](_0x497913);};}exports[_0x76f4('0x28')]=function(_0x1d1fe6,_0x13d219){var _0x447dbc={},_0x5ca31f={},_0x306cb4={'count':0x0,'rows':[]};var _0x59d133=_['map'](db['VtigerField'][_0x76f4('0x29')],function(_0x30f02e){return{'name':_0x30f02e[_0x76f4('0x2a')],'type':_0x30f02e[_0x76f4('0x2b')]['key']};});_0x5ca31f[_0x76f4('0x2c')]=_['map'](_0x59d133,_0x76f4('0x2d'));_0x5ca31f[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x1d1fe6[_0x76f4('0x2e')]);_0x5ca31f[_0x76f4('0x30')]=_['intersection'](_0x5ca31f['model'],_0x5ca31f[_0x76f4('0x2e')]);_0x447dbc[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x5ca31f[_0x76f4('0x2c')],qs[_0x76f4('0x33')](_0x1d1fe6[_0x76f4('0x2e')][_0x76f4('0x33')]));_0x447dbc[_0x76f4('0x31')]=_0x447dbc[_0x76f4('0x31')][_0x76f4('0x34')]?_0x447dbc[_0x76f4('0x31')]:_0x5ca31f[_0x76f4('0x2c')];if(!_0x1d1fe6['query']['hasOwnProperty']('nolimit')){_0x447dbc['limit']=qs[_0x76f4('0x1c')](_0x1d1fe6[_0x76f4('0x2e')][_0x76f4('0x1c')]);_0x447dbc[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x1d1fe6['query'][_0x76f4('0x1b')]);}_0x447dbc[_0x76f4('0x35')]=qs[_0x76f4('0x36')](_0x1d1fe6[_0x76f4('0x2e')][_0x76f4('0x36')]);_0x447dbc[_0x76f4('0x37')]=qs[_0x76f4('0x30')](_[_0x76f4('0x38')](_0x1d1fe6[_0x76f4('0x2e')],_0x5ca31f[_0x76f4('0x30')]),_0x59d133);if(_0x1d1fe6[_0x76f4('0x2e')][_0x76f4('0x39')]){_0x447dbc[_0x76f4('0x37')]=_[_0x76f4('0x3a')](_0x447dbc[_0x76f4('0x37')],{'$or':_[_0x76f4('0x3b')](_0x59d133,function(_0x3308e3){if(_0x3308e3[_0x76f4('0x2b')]!=='VIRTUAL'){var _0x4038b3={};_0x4038b3[_0x3308e3[_0x76f4('0x2d')]]={'$like':'%'+_0x1d1fe6[_0x76f4('0x2e')]['filter']+'%'};return _0x4038b3;}})});}_0x447dbc=_['merge']({},_0x447dbc,_0x1d1fe6[_0x76f4('0x3c')]);var _0x487926={'where':_0x447dbc[_0x76f4('0x37')]};return db['VtigerField'][_0x76f4('0x1a')](_0x487926)[_0x76f4('0x24')](function(_0x312243){_0x306cb4[_0x76f4('0x1a')]=_0x312243;if(_0x1d1fe6[_0x76f4('0x2e')][_0x76f4('0x3d')]){_0x447dbc[_0x76f4('0x3e')]=[{'all':!![]}];}return db[_0x76f4('0x3f')][_0x76f4('0x40')](_0x447dbc);})[_0x76f4('0x24')](function(_0x5340a9){_0x306cb4['rows']=_0x5340a9;return _0x306cb4;})[_0x76f4('0x24')](respondWithFilteredResult(_0x13d219,_0x447dbc))[_0x76f4('0x41')](handleError(_0x13d219,null));};exports[_0x76f4('0x42')]=function(_0x427c70,_0x2b7dc8){var _0x2d6068={'raw':!![],'where':{'id':_0x427c70[_0x76f4('0x43')]['id']}},_0x42754d={};_0x42754d[_0x76f4('0x2c')]=_['keys'](db[_0x76f4('0x3f')][_0x76f4('0x29')]);_0x42754d['query']=_['keys'](_0x427c70[_0x76f4('0x2e')]);_0x42754d[_0x76f4('0x30')]=_[_0x76f4('0x32')](_0x42754d[_0x76f4('0x2c')],_0x42754d[_0x76f4('0x2e')]);_0x2d6068['attributes']=_[_0x76f4('0x32')](_0x42754d[_0x76f4('0x2c')],qs[_0x76f4('0x33')](_0x427c70[_0x76f4('0x2e')][_0x76f4('0x33')]));_0x2d6068[_0x76f4('0x31')]=_0x2d6068['attributes'][_0x76f4('0x34')]?_0x2d6068[_0x76f4('0x31')]:_0x42754d[_0x76f4('0x2c')];if(_0x427c70['query']['includeAll']){_0x2d6068[_0x76f4('0x3e')]=[{'all':!![]}];}_0x2d6068=_[_0x76f4('0x3a')]({},_0x2d6068,_0x427c70[_0x76f4('0x3c')]);return db[_0x76f4('0x3f')][_0x76f4('0x44')](_0x2d6068)['then'](handleEntityNotFound(_0x2b7dc8,null))['then'](respondWithResult(_0x2b7dc8,null))[_0x76f4('0x41')](handleError(_0x2b7dc8,null));};exports['create']=function(_0x42b30d,_0x3eaa0c){return db['VtigerField']['create'](_0x42b30d[_0x76f4('0x45')],{})[_0x76f4('0x24')](respondWithResult(_0x3eaa0c,0xc9))[_0x76f4('0x41')](handleError(_0x3eaa0c,null));};exports[_0x76f4('0x23')]=function(_0x55e4cc,_0x9baa0f){if(_0x55e4cc[_0x76f4('0x45')]['id']){delete _0x55e4cc[_0x76f4('0x45')]['id'];}return db['VtigerField'][_0x76f4('0x44')]({'where':{'id':_0x55e4cc[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x9baa0f,null))['then'](saveUpdates(_0x55e4cc[_0x76f4('0x45')],null))[_0x76f4('0x24')](respondWithResult(_0x9baa0f,null))[_0x76f4('0x41')](handleError(_0x9baa0f,null));};exports[_0x76f4('0x25')]=function(_0x2a61d3,_0x524503){return db[_0x76f4('0x3f')]['find']({'where':{'id':_0x2a61d3[_0x76f4('0x43')]['id']}})[_0x76f4('0x24')](handleEntityNotFound(_0x524503,null))[_0x76f4('0x24')](removeEntity(_0x524503,null))['catch'](handleError(_0x524503,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5738d16..dbb4d47 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(_0x44a887,_0x16378f){var _0x1befec=function(_0x5e3ecb){while(--_0x5e3ecb){_0x44a887['push'](_0x44a887['shift']());}};_0x1befec(++_0x16378f);}(_0x7a54,0x106));var _0x47a5=function(_0xd85d0b,_0x2705d2){_0xd85d0b=_0xd85d0b-0x0;var _0x55fa85=_0x7a54[_0xd85d0b];return _0x55fa85;};'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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 8e63607..5df0f40 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 _0x8a9d=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x2e1696,_0x20f5d7){var _0x37c33e=function(_0x23f04b){while(--_0x23f04b){_0x2e1696['push'](_0x2e1696['shift']());}};_0x37c33e(++_0x20f5d7);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x2bf1fb,_0x10022d){_0x2bf1fb=_0x2bf1fb-0x0;var _0x5e7e68=_0x8a9d[_0x2bf1fb];return _0x5e7e68;};'use strict';var _=require(_0xd8a9('0x0'));var util=require(_0xd8a9('0x1'));var moment=require('moment');var BPromise=require(_0xd8a9('0x2'));var rs=require(_0xd8a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8a9('0x5'));var config=require(_0xd8a9('0x6'));var jayson=require(_0xd8a9('0x7'));var client=jayson['client'][_0xd8a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37b86d,_0x16bcb2,_0x5610b7){return new BPromise(function(_0x5c3949,_0x824a6e){return client[_0xd8a9('0x9')](_0x37b86d,_0x5610b7)['then'](function(_0x3a851f){logger[_0xd8a9('0xa')](_0xd8a9('0xb'),_0x16bcb2,_0xd8a9('0xc'));logger[_0xd8a9('0xd')](_0xd8a9('0xe'),_0x16bcb2,_0xd8a9('0xc'),JSON[_0xd8a9('0xf')](_0x3a851f));if(_0x3a851f[_0xd8a9('0x10')]){if(_0x3a851f[_0xd8a9('0x10')][_0xd8a9('0x11')]===0x1f4){logger[_0xd8a9('0x10')](_0xd8a9('0xb'),_0x16bcb2,_0x3a851f[_0xd8a9('0x10')][_0xd8a9('0x12')]);return _0x824a6e(_0x3a851f[_0xd8a9('0x10')]['message']);}logger[_0xd8a9('0x10')]('VtigerField,\x20%s,\x20%s',_0x16bcb2,_0x3a851f[_0xd8a9('0x10')][_0xd8a9('0x12')]);return _0x5c3949(_0x3a851f[_0xd8a9('0x10')]['message']);}else{logger['info'](_0xd8a9('0xb'),_0x16bcb2,'request\x20sent');_0x5c3949(_0x3a851f[_0xd8a9('0x13')][_0xd8a9('0x12')]);}})[_0xd8a9('0x14')](function(_0x3fe899){logger['error'](_0xd8a9('0xb'),_0x16bcb2,_0x3fe899);_0x824a6e(_0x3fe899);});});} \ No newline at end of file +var _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerField,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20455f,_0x423034){var _0x185213=function(_0x11260d){while(--_0x11260d){_0x20455f['push'](_0x20455f['shift']());}};_0x185213(++_0x423034);}(_0x505d,0x93));var _0xd505=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x505d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('VtigerField,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('VtigerField,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 183825b..46f49e7 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 _0xee64=['index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x3fc06b,_0x2e225c){var _0x392fd9=function(_0x4c0392){while(--_0x4c0392){_0x3fc06b['push'](_0x3fc06b['shift']());}};_0x392fd9(++_0x2e225c);}(_0xee64,0xa7));var _0x4ee6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xee64[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4ee6('0x0'));var util=require('util');var path=require(_0x4ee6('0x1'));var timeout=require(_0x4ee6('0x2'));var express=require('express');var router=express[_0x4ee6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ee6('0x4'));var config=require(_0x4ee6('0x5'));var controller=require(_0x4ee6('0x6'));router[_0x4ee6('0x7')]('/',auth[_0x4ee6('0x8')](),controller[_0x4ee6('0x9')]);router[_0x4ee6('0x7')]('/:id',auth[_0x4ee6('0x8')](),controller[_0x4ee6('0xa')]);router[_0x4ee6('0x7')](_0x4ee6('0xb'),auth[_0x4ee6('0x8')](),controller[_0x4ee6('0xc')]);router[_0x4ee6('0x7')](_0x4ee6('0xd'),auth[_0x4ee6('0x8')](),controller[_0x4ee6('0xe')]);router[_0x4ee6('0xf')]('/',auth[_0x4ee6('0x8')](),controller[_0x4ee6('0x10')]);router[_0x4ee6('0xf')]('/:id/configurations',auth[_0x4ee6('0x8')](),controller[_0x4ee6('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4ee6('0x12')]);router[_0x4ee6('0x13')](_0x4ee6('0x14'),auth[_0x4ee6('0x8')](),controller['destroy']);module[_0x4ee6('0x15')]=router; \ No newline at end of file +var _0x2516=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x1eb3a9,_0x1bc3d2){var _0x588a71=function(_0x4399d8){while(--_0x4399d8){_0x1eb3a9['push'](_0x1eb3a9['shift']());}};_0x588a71(++_0x1bc3d2);}(_0x2516,0x16f));var _0x6251=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2516[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var path=require(_0x6251('0x2'));var timeout=require(_0x6251('0x3'));var express=require('express');var router=express[_0x6251('0x4')]();var auth=require(_0x6251('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6251('0x6'));router[_0x6251('0x7')]('/',auth[_0x6251('0x8')](),controller[_0x6251('0x9')]);router[_0x6251('0x7')](_0x6251('0xa'),auth[_0x6251('0x8')](),controller['show']);router[_0x6251('0x7')](_0x6251('0xb'),auth['isAuthenticated'](),controller[_0x6251('0xc')]);router[_0x6251('0x7')](_0x6251('0xd'),auth[_0x6251('0x8')](),controller[_0x6251('0xe')]);router['post']('/',auth[_0x6251('0x8')](),controller[_0x6251('0xf')]);router[_0x6251('0x10')](_0x6251('0xb'),auth[_0x6251('0x8')](),controller[_0x6251('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6251('0x12')]);router[_0x6251('0x13')](_0x6251('0xa'),auth[_0x6251('0x8')](),controller[_0x6251('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3928c8f..efc7ef2 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 _0x9749=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0x3cb776,_0x5a6aff){var _0x3fa224=function(_0x109d93){while(--_0x109d93){_0x3cb776['push'](_0x3cb776['shift']());}};_0x3fa224(++_0x5a6aff);}(_0x9749,0x1ca));var _0x9974=function(_0x502414,_0x550420){_0x502414=_0x502414-0x0;var _0x2c9221=_0x9749[_0x502414];return _0x2c9221;};'use strict';var Sequelize=require(_0x9974('0x0'));module[_0x9974('0x1')]={'name':{'type':Sequelize[_0x9974('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9974('0x2')],'unique':_0x9974('0x3')},'password':{'type':Sequelize[_0x9974('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x9974('0x4')]('password','token'),'defaultValue':_0x9974('0x5')},'serverUrl':{'type':Sequelize[_0x9974('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9974('0x4')](_0x9974('0x6'),_0x9974('0x7')),'defaultValue':_0x9974('0x6')}}; \ No newline at end of file +var _0xb108=['exports','STRING','remoteUri','ENUM','password','token','integrationTab','sequelize'];(function(_0x5cda8e,_0x2cd3b7){var _0x17c67b=function(_0x22747a){while(--_0x22747a){_0x5cda8e['push'](_0x5cda8e['shift']());}};_0x17c67b(++_0x2cd3b7);}(_0xb108,0xd7));var _0x8b10=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb108[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8b10('0x0'));module[_0x8b10('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8b10('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x8b10('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8b10('0x2')],'unique':_0x8b10('0x3')},'authType':{'type':Sequelize[_0x8b10('0x4')](_0x8b10('0x5'),_0x8b10('0x6')),'defaultValue':_0x8b10('0x5')},'serverUrl':{'type':Sequelize[_0x8b10('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8b10('0x4')](_0x8b10('0x7'),'newTab'),'defaultValue':_0x8b10('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1461046..a4d9c99 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 _0x13f6=['map','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','show','params','length','find','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ZendeskField','username','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','toString','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','json','count','offset','limit','reject','save','update','destroy','name','send','index'];(function(_0x4ceb13,_0x5e70f7){var _0x11f6e7=function(_0x1ffe46){while(--_0x1ffe46){_0x4ceb13['push'](_0x4ceb13['shift']());}};_0x11f6e7(++_0x5e70f7);}(_0x13f6,0x124));var _0x613f=function(_0x4027e6,_0x2a0112){_0x4027e6=_0x4027e6-0x0;var _0x1f4792=_0x13f6[_0x4027e6];return _0x1f4792;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x13'));var db=require(_0x613f('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x613f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1ebab5,_0x3832d8,_0x375db1,_0x329fcf){return new BPromise(function(_0x4a6fc,_0x305894){var _0x291268=_0x329fcf||client;return _0x291268[_0x613f('0x16')](_0x1ebab5,_0x375db1)[_0x613f('0x17')](function(_0x548218){logger[_0x613f('0x18')]('ZendeskAccount,\x20%s,\x20%s',_0x3832d8,'request\x20sent');logger[_0x613f('0x19')](_0x613f('0x1a'),_0x3832d8,'request\x20sent',JSON[_0x613f('0x1b')](_0x548218));if(_0x548218['error']){if(_0x548218[_0x613f('0x1c')][_0x613f('0x1d')]===0x1f4){logger[_0x613f('0x1c')](_0x613f('0x1e'),_0x3832d8,_0x548218[_0x613f('0x1c')][_0x613f('0x1f')]);return _0x305894(_0x548218['error']['message']);}logger[_0x613f('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0x3832d8,_0x548218['error'][_0x613f('0x1f')]);return _0x4a6fc(_0x548218[_0x613f('0x1c')]['message']);}else{logger[_0x613f('0x18')](_0x613f('0x1e'),_0x3832d8,_0x613f('0x20'));_0x4a6fc(_0x548218['result']['message']);}})[_0x613f('0x21')](function(_0x309437){logger[_0x613f('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0x3832d8,_0x309437);_0x305894(_0x309437);});});}function respondWithStatusCode(_0x41104e,_0x33e0c6){_0x33e0c6=_0x33e0c6||0xcc;return function(_0x30de90){if(_0x30de90){return _0x41104e[_0x613f('0x22')](_0x33e0c6);}return _0x41104e[_0x613f('0x23')](_0x33e0c6)['end']();};}function respondWithResult(_0x30fb15,_0x204185){_0x204185=_0x204185||0xc8;return function(_0x51bba1){if(_0x51bba1){return _0x30fb15[_0x613f('0x23')](_0x204185)[_0x613f('0x24')](_0x51bba1);}};}function respondWithFilteredResult(_0x32e747,_0x4a878d){return function(_0x53e32b){if(_0x53e32b){var _0x5a4a8b=_0x53e32b[_0x613f('0x25')],_0x379920=_0x4a878d['offset'],_0x594c28=_0x4a878d[_0x613f('0x26')]+_0x4a878d[_0x613f('0x27')],_0x412269;if(_0x594c28>=_0x5a4a8b){_0x594c28=_0x5a4a8b;_0x412269=0xc8;}else{_0x412269=0xce;}_0x32e747['status'](_0x412269);return _0x32e747['set']('Content-Range',_0x379920+'-'+_0x594c28+'/'+_0x5a4a8b)[_0x613f('0x24')](_0x53e32b);}return null;};}function patchUpdates(_0x7c1a94){return function(_0xcad8d6){try{jsonpatch['apply'](_0xcad8d6,_0x7c1a94,!![]);}catch(_0x23eda8){return BPromise[_0x613f('0x28')](_0x23eda8);}return _0xcad8d6[_0x613f('0x29')]();};}function saveUpdates(_0x19bb8f,_0x4f8500){return function(_0x31ccbd){if(_0x31ccbd){return _0x31ccbd[_0x613f('0x2a')](_0x19bb8f)[_0x613f('0x17')](function(_0x728f45){return _0x728f45;});}return null;};}function removeEntity(_0x10fa2b,_0x1664f1){return function(_0x5d7e9a){if(_0x5d7e9a){return _0x5d7e9a[_0x613f('0x2b')]()[_0x613f('0x17')](function(){_0x10fa2b[_0x613f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a1d1,_0x4af0de){return function(_0x3df7bf){if(!_0x3df7bf){_0x21a1d1[_0x613f('0x22')](0x194);}return _0x3df7bf;};}function handleError(_0xc8976c,_0x28c06c){_0x28c06c=_0x28c06c||0x1f4;return function(_0x2bceaa){logger[_0x613f('0x1c')](_0x2bceaa['stack']);if(_0x2bceaa[_0x613f('0x2c')]){delete _0x2bceaa[_0x613f('0x2c')];}_0xc8976c[_0x613f('0x23')](_0x28c06c)[_0x613f('0x2d')](_0x2bceaa);};}exports[_0x613f('0x2e')]=function(_0x47a9f6,_0x59236e){var _0x4eea2c={},_0x3d79f0={},_0x72c804={'count':0x0,'rows':[]};var _0x22074f=_[_0x613f('0x2f')](db['ZendeskAccount'][_0x613f('0x30')],function(_0xaedbbd){return{'name':_0xaedbbd['fieldName'],'type':_0xaedbbd[_0x613f('0x31')]['key']};});_0x3d79f0[_0x613f('0x32')]=_['map'](_0x22074f,_0x613f('0x2c'));_0x3d79f0['query']=_[_0x613f('0x33')](_0x47a9f6[_0x613f('0x34')]);_0x3d79f0[_0x613f('0x35')]=_['intersection'](_0x3d79f0[_0x613f('0x32')],_0x3d79f0[_0x613f('0x34')]);_0x4eea2c[_0x613f('0x36')]=_[_0x613f('0x37')](_0x3d79f0[_0x613f('0x32')],qs[_0x613f('0x38')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x38')]));_0x4eea2c[_0x613f('0x36')]=_0x4eea2c[_0x613f('0x36')]['length']?_0x4eea2c[_0x613f('0x36')]:_0x3d79f0[_0x613f('0x32')];if(!_0x47a9f6[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x4eea2c[_0x613f('0x27')]=qs[_0x613f('0x27')](_0x47a9f6['query'][_0x613f('0x27')]);_0x4eea2c[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x26')]);}_0x4eea2c[_0x613f('0x3b')]=qs[_0x613f('0x3c')](_0x47a9f6['query'][_0x613f('0x3c')]);_0x4eea2c[_0x613f('0x3d')]=qs[_0x613f('0x35')](_[_0x613f('0x3e')](_0x47a9f6[_0x613f('0x34')],_0x3d79f0[_0x613f('0x35')]),_0x22074f);if(_0x47a9f6[_0x613f('0x34')][_0x613f('0x3f')]){_0x4eea2c[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x4eea2c[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x22074f,function(_0xdd4918){if(_0xdd4918['type']!==_0x613f('0x41')){var _0x121c91={};_0x121c91[_0xdd4918[_0x613f('0x2c')]]={'$like':'%'+_0x47a9f6[_0x613f('0x34')]['filter']+'%'};return _0x121c91;}})});}_0x4eea2c=_[_0x613f('0x40')]({},_0x4eea2c,_0x47a9f6[_0x613f('0x42')]);var _0x38aa12={'where':_0x4eea2c[_0x613f('0x3d')]};return db[_0x613f('0x43')][_0x613f('0x25')](_0x38aa12)[_0x613f('0x17')](function(_0x132745){_0x72c804[_0x613f('0x25')]=_0x132745;if(_0x47a9f6[_0x613f('0x34')]['includeAll']){_0x4eea2c['include']=[{'all':!![]}];}return db[_0x613f('0x43')][_0x613f('0x44')](_0x4eea2c);})['then'](function(_0x2ffa3c){_0x72c804[_0x613f('0x45')]=_0x2ffa3c;return _0x72c804;})[_0x613f('0x17')](respondWithFilteredResult(_0x59236e,_0x4eea2c))[_0x613f('0x21')](handleError(_0x59236e,null));};exports[_0x613f('0x46')]=function(_0x1c0b07,_0x412dd4){var _0x3a7f95={'raw':![],'where':{'id':_0x1c0b07[_0x613f('0x47')]['id']}},_0x3d938e={};_0x3d938e[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x43')][_0x613f('0x30')]);_0x3d938e[_0x613f('0x34')]=_[_0x613f('0x33')](_0x1c0b07[_0x613f('0x34')]);_0x3d938e[_0x613f('0x35')]=_['intersection'](_0x3d938e['model'],_0x3d938e[_0x613f('0x34')]);_0x3a7f95[_0x613f('0x36')]=_['intersection'](_0x3d938e['model'],qs[_0x613f('0x38')](_0x1c0b07['query']['fields']));_0x3a7f95[_0x613f('0x36')]=_0x3a7f95[_0x613f('0x36')][_0x613f('0x48')]?_0x3a7f95['attributes']:_0x3d938e[_0x613f('0x32')];if(_0x1c0b07[_0x613f('0x34')]['includeAll']){_0x3a7f95['include']=[{'all':!![]}];}_0x3a7f95=_[_0x613f('0x40')]({},_0x3a7f95,_0x1c0b07[_0x613f('0x42')]);return db[_0x613f('0x43')][_0x613f('0x49')](_0x3a7f95)[_0x613f('0x17')](handleEntityNotFound(_0x412dd4,null))[_0x613f('0x17')](respondWithResult(_0x412dd4,null))[_0x613f('0x21')](handleError(_0x412dd4,null));};exports['create']=function(_0x4c6096,_0x38d781){return db['ZendeskAccount']['create'](_0x4c6096[_0x613f('0x4a')],{})[_0x613f('0x17')](respondWithResult(_0x38d781,0xc9))[_0x613f('0x21')](handleError(_0x38d781,null));};exports['update']=function(_0x27adac,_0x3ab684){if(_0x27adac[_0x613f('0x4a')]['id']){delete _0x27adac[_0x613f('0x4a')]['id'];}return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x27adac[_0x613f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ab684,null))[_0x613f('0x17')](saveUpdates(_0x27adac['body'],null))[_0x613f('0x17')](respondWithResult(_0x3ab684,null))[_0x613f('0x21')](handleError(_0x3ab684,null));};exports[_0x613f('0x2b')]=function(_0x3d1f1a,_0x5f1b88){return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x3d1f1a[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x5f1b88,null))[_0x613f('0x17')](removeEntity(_0x5f1b88,null))[_0x613f('0x21')](handleError(_0x5f1b88,null));};exports[_0x613f('0x4b')]=function(_0x43c238,_0x54ad8f,_0x4f316c){var _0x687e56={};var _0x4b6eb3={};var _0xcb1c9d;var _0x3c3cd7;return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x43c238[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x54ad8f,null))[_0x613f('0x17')](function(_0x3cc31b){if(_0x3cc31b){_0xcb1c9d=_0x3cc31b;_0x4b6eb3[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x4d')]['rawAttributes']);_0x4b6eb3[_0x613f('0x34')]=_[_0x613f('0x33')](_0x43c238[_0x613f('0x34')]);_0x4b6eb3[_0x613f('0x35')]=_['intersection'](_0x4b6eb3[_0x613f('0x32')],_0x4b6eb3[_0x613f('0x34')]);_0x687e56['attributes']=_['intersection'](_0x4b6eb3[_0x613f('0x32')],qs['fields'](_0x43c238['query']['fields']));_0x687e56[_0x613f('0x36')]=_0x687e56['attributes']['length']?_0x687e56['attributes']:_0x4b6eb3[_0x613f('0x32')];_0x687e56[_0x613f('0x3b')]=qs['sort'](_0x43c238[_0x613f('0x34')][_0x613f('0x3c')]);_0x687e56[_0x613f('0x3d')]=qs[_0x613f('0x35')](_['pick'](_0x43c238[_0x613f('0x34')],_0x4b6eb3[_0x613f('0x35')]));if(_0x43c238['query'][_0x613f('0x3f')]){_0x687e56[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x687e56[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x687e56[_0x613f('0x36')],function(_0xbead7c){var _0x130f54={};_0x130f54[_0xbead7c]={'$like':'%'+_0x43c238[_0x613f('0x34')][_0x613f('0x3f')]+'%'};return _0x130f54;})});}_0x687e56=_[_0x613f('0x40')]({},_0x687e56,_0x43c238[_0x613f('0x42')]);return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x428aab){if(_0x428aab){_0x3c3cd7=_0x428aab[_0x613f('0x48')];if(!_0x43c238[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x687e56['limit']=qs[_0x613f('0x27')](_0x43c238[_0x613f('0x34')][_0x613f('0x27')]);_0x687e56[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x43c238[_0x613f('0x34')]['offset']);}return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x25a550){if(_0x25a550){return _0x25a550?{'count':_0x3c3cd7,'rows':_0x25a550}:null;}})[_0x613f('0x17')](respondWithResult(_0x54ad8f,null))[_0x613f('0x21')](handleError(_0x54ad8f,null));};exports['addConfiguration']=function(_0x11d2f4,_0x29e5c8,_0x3d8777){if(_0x11d2f4[_0x613f('0x4a')]['id']){delete _0x11d2f4['body']['id'];}return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x11d2f4[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x29e5c8,null))[_0x613f('0x17')](function(_0x45e933){if(_0x45e933){_0x11d2f4[_0x613f('0x4a')][_0x613f('0x4e')]=_0x45e933['id'];_0x11d2f4['body'][_0x613f('0x4f')]=integrations[_0x613f('0x50')](_0x11d2f4[_0x613f('0x4a')][_0x613f('0x51')],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);_0x11d2f4[_0x613f('0x4a')][_0x613f('0x52')]=integrations[_0x613f('0x53')](_0x11d2f4[_0x613f('0x4a')]['channel'],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);return db[_0x613f('0x4d')][_0x613f('0x54')](_0x11d2f4[_0x613f('0x4a')],{'include':[{'model':db[_0x613f('0x55')],'as':_0x613f('0x4f')},{'model':db[_0x613f('0x55')],'as':_0x613f('0x52')}]});}return null;})[_0x613f('0x17')](respondWithResult(_0x29e5c8,null))[_0x613f('0x21')](handleError(_0x29e5c8,null));};exports['getFields']=function(_0xb36b52,_0x1739ac,_0x2bfb0a){var _0x907273='';return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0xb36b52[_0x613f('0x47')]['id']},'attributes':['id',_0x613f('0x56'),_0x613f('0x57'),_0x613f('0x58'),_0x613f('0x59'),_0x613f('0x5a')]})['then'](handleEntityNotFound(_0x1739ac,null))[_0x613f('0x17')](function(_0x38e9dd){if(_0x38e9dd){_0x907273=_0x38e9dd['remoteUri'];var _0xb4ad75=_0x907273['slice'](-0x1);if(_0xb4ad75==='/'){_0x907273=_0x907273[_0x613f('0x5b')](0x0,_0x907273['lastIndexOf'](_0xb4ad75));}var _0x49cb13={'method':_0x613f('0x5c'),'uri':util[_0x613f('0x5d')](_0x613f('0x5e'),_0x907273,_0x613f('0x5f')),'json':!![]};switch(_0x38e9dd[_0x613f('0x59')]){case _0x613f('0x57'):_0x49cb13[_0x613f('0x60')]={'Authorization':util['format'](_0x613f('0x61'),new Buffer(util[_0x613f('0x5d')](_0x613f('0x62'),_0x38e9dd[_0x613f('0x56')],_0x38e9dd[_0x613f('0x57')]))['toString'](_0x613f('0x63')))};break;case _0x613f('0x58'):_0x49cb13['headers']={'Authorization':util[_0x613f('0x5d')](_0x613f('0x61'),new Buffer(util[_0x613f('0x5d')]('%s/token:%s',_0x38e9dd['username'],_0x38e9dd['token']))[_0x613f('0x64')](_0x613f('0x63')))};break;default:throw new db['Sequelize'][(_0x613f('0x65'))](_0x613f('0x66'));}return rp(_0x49cb13);}})[_0x613f('0x17')](function(_0x59e0e1){if(_0x59e0e1){var _0x4618e9=['subject',_0x613f('0x67'),'group','assignee'];_[_0x613f('0x68')](_0x59e0e1[_0x613f('0x5f')],function(_0x87c83d){return _0x4618e9[_0x613f('0x69')](_0x87c83d[_0x613f('0x31')]);});return{'count':_0x59e0e1[_0x613f('0x5f')][_0x613f('0x48')],'rows':_[_0x613f('0x2f')](_0x59e0e1[_0x613f('0x5f')],function(_0x5fb7a4){return{'id':_0x5fb7a4['id'],'name':_0x5fb7a4[_0x613f('0x6a')]>0x7?_0x5fb7a4['title']:_0x5fb7a4[_0x613f('0x31')],'custom':_0x5fb7a4[_0x613f('0x6a')]>0x7?!![]:![],'options':_0x5fb7a4[_0x613f('0x6b')]?_0x5fb7a4[_0x613f('0x6b')]:_0x5fb7a4[_0x613f('0x6c')]?_0x5fb7a4[_0x613f('0x6c')]:[]};})};}})[_0x613f('0x17')](respondWithResult(_0x1739ac,null))['catch'](function(_0x2f1139){var _0x3136c4=_0xb36b52[_0x613f('0x34')][_0x613f('0x6d')]?0x1f4:_0x2f1139['statusCode']||0x1f4;logger[_0x613f('0x1c')](_0x613f('0x6e'),_0x613f('0x6f'),_0x3136c4,JSON[_0x613f('0x1b')](_0x2f1139));delete _0x2f1139[_0x613f('0x2c')];if(_0x3136c4===0x191){_0x3136c4=0x190;}_0x1739ac[_0x613f('0x23')](_0x3136c4)['send'](_0xb36b52[_0x613f('0x34')][_0x613f('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x2f1139[_0x613f('0x70')]}:_0x2f1139);});}; \ No newline at end of file +var _0x7229=['to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','reject','save','update','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','username','Sequelize','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x165795,_0x98f2d5){var _0x274035=function(_0x4c51cf){while(--_0x4c51cf){_0x165795['push'](_0x165795['shift']());}};_0x274035(++_0x98f2d5);}(_0x7229,0x76));var _0x9722=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7229[_0x1d9aa0];return _0x226868;};'use strict';var pdf=require(_0x9722('0x0'));var emlformat=require(_0x9722('0x1'));var rimraf=require(_0x9722('0x2'));var zipdir=require(_0x9722('0x3'));var jsonpatch=require(_0x9722('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9722('0x5'));var Mustache=require(_0x9722('0x6'));var util=require(_0x9722('0x7'));var path=require(_0x9722('0x8'));var sox=require(_0x9722('0x9'));var csv=require(_0x9722('0xa'));var ejs=require(_0x9722('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9722('0xc'));var crypto=require('crypto');var jsforce=require(_0x9722('0xd'));var deskjs=require(_0x9722('0xe'));var toCsv=require(_0x9722('0xa'));var querystring=require(_0x9722('0xf'));var Papa=require(_0x9722('0x10'));var Redis=require(_0x9722('0x11'));var authService=require(_0x9722('0x12'));var qs=require(_0x9722('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9722('0x14'))(_0x9722('0x15'));var utils=require(_0x9722('0x16'));var config=require(_0x9722('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9722('0x18'))['db'];var integrations=require(_0x9722('0x19'));var jayson=require(_0x9722('0x1a'));var client=jayson[_0x9722('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404414,_0xa13dd5,_0x256348,_0x248bdf){return new BPromise(function(_0x2f1c3b,_0x5e84b8){var _0x16d70f=_0x248bdf||client;return _0x16d70f[_0x9722('0x1c')](_0x404414,_0x256348)[_0x9722('0x1d')](function(_0x482ad4){logger[_0x9722('0x1e')](_0x9722('0x1f'),_0xa13dd5,'request\x20sent');logger[_0x9722('0x20')](_0x9722('0x21'),_0xa13dd5,_0x9722('0x22'),JSON['stringify'](_0x482ad4));if(_0x482ad4[_0x9722('0x23')]){if(_0x482ad4[_0x9722('0x23')][_0x9722('0x24')]===0x1f4){logger[_0x9722('0x23')](_0x9722('0x1f'),_0xa13dd5,_0x482ad4[_0x9722('0x23')][_0x9722('0x25')]);return _0x5e84b8(_0x482ad4[_0x9722('0x23')][_0x9722('0x25')]);}logger[_0x9722('0x23')](_0x9722('0x1f'),_0xa13dd5,_0x482ad4[_0x9722('0x23')][_0x9722('0x25')]);return _0x2f1c3b(_0x482ad4[_0x9722('0x23')][_0x9722('0x25')]);}else{logger[_0x9722('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0xa13dd5,_0x9722('0x22'));_0x2f1c3b(_0x482ad4[_0x9722('0x26')][_0x9722('0x25')]);}})[_0x9722('0x27')](function(_0x2fb2b9){logger[_0x9722('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0xa13dd5,_0x2fb2b9);_0x5e84b8(_0x2fb2b9);});});}function respondWithStatusCode(_0x73c303,_0x1aff40){_0x1aff40=_0x1aff40||0xcc;return function(_0xdc3330){if(_0xdc3330){return _0x73c303[_0x9722('0x28')](_0x1aff40);}return _0x73c303[_0x9722('0x29')](_0x1aff40)[_0x9722('0x2a')]();};}function respondWithResult(_0x3b3ce9,_0x1f2ad8){_0x1f2ad8=_0x1f2ad8||0xc8;return function(_0x4aab4e){if(_0x4aab4e){return _0x3b3ce9[_0x9722('0x29')](_0x1f2ad8)['json'](_0x4aab4e);}};}function respondWithFilteredResult(_0x141c7d,_0x19a7b6){return function(_0x8b8cf9){if(_0x8b8cf9){var _0x129891=_0x8b8cf9[_0x9722('0x2b')],_0x1f60a6=_0x19a7b6['offset'],_0x1f9152=_0x19a7b6[_0x9722('0x2c')]+_0x19a7b6['limit'],_0x24bbb3;if(_0x1f9152>=_0x129891){_0x1f9152=_0x129891;_0x24bbb3=0xc8;}else{_0x24bbb3=0xce;}_0x141c7d['status'](_0x24bbb3);return _0x141c7d[_0x9722('0x2d')](_0x9722('0x2e'),_0x1f60a6+'-'+_0x1f9152+'/'+_0x129891)['json'](_0x8b8cf9);}return null;};}function patchUpdates(_0xa69142){return function(_0xb87abc){try{jsonpatch['apply'](_0xb87abc,_0xa69142,!![]);}catch(_0x4b2129){return BPromise[_0x9722('0x2f')](_0x4b2129);}return _0xb87abc[_0x9722('0x30')]();};}function saveUpdates(_0x195515,_0x2d52a4){return function(_0x27d698){if(_0x27d698){return _0x27d698[_0x9722('0x31')](_0x195515)['then'](function(_0x22e49f){return _0x22e49f;});}return null;};}function removeEntity(_0x444d0e,_0xa11358){return function(_0x371b67){if(_0x371b67){return _0x371b67['destroy']()[_0x9722('0x1d')](function(){_0x444d0e[_0x9722('0x29')](0xcc)[_0x9722('0x2a')]();});}};}function handleEntityNotFound(_0x5ae1ca,_0x47eaf5){return function(_0x1cb6c3){if(!_0x1cb6c3){_0x5ae1ca['sendStatus'](0x194);}return _0x1cb6c3;};}function handleError(_0x3c59c4,_0x46acb8){_0x46acb8=_0x46acb8||0x1f4;return function(_0x445481){logger[_0x9722('0x23')](_0x445481[_0x9722('0x32')]);if(_0x445481[_0x9722('0x33')]){delete _0x445481[_0x9722('0x33')];}_0x3c59c4[_0x9722('0x29')](_0x46acb8)[_0x9722('0x34')](_0x445481);};}exports[_0x9722('0x35')]=function(_0x427244,_0x340e47){var _0x53e12c={},_0x50a958={},_0x2130d3={'count':0x0,'rows':[]};var _0x2b74ed=_[_0x9722('0x36')](db[_0x9722('0x37')][_0x9722('0x38')],function(_0x1ac799){return{'name':_0x1ac799[_0x9722('0x39')],'type':_0x1ac799[_0x9722('0x3a')]['key']};});_0x50a958[_0x9722('0x3b')]=_['map'](_0x2b74ed,'name');_0x50a958[_0x9722('0x3c')]=_[_0x9722('0x3d')](_0x427244[_0x9722('0x3c')]);_0x50a958['filters']=_[_0x9722('0x3e')](_0x50a958[_0x9722('0x3b')],_0x50a958[_0x9722('0x3c')]);_0x53e12c[_0x9722('0x3f')]=_['intersection'](_0x50a958['model'],qs[_0x9722('0x40')](_0x427244[_0x9722('0x3c')][_0x9722('0x40')]));_0x53e12c[_0x9722('0x3f')]=_0x53e12c[_0x9722('0x3f')][_0x9722('0x41')]?_0x53e12c[_0x9722('0x3f')]:_0x50a958[_0x9722('0x3b')];if(!_0x427244[_0x9722('0x3c')][_0x9722('0x42')]('nolimit')){_0x53e12c['limit']=qs['limit'](_0x427244['query'][_0x9722('0x43')]);_0x53e12c[_0x9722('0x2c')]=qs['offset'](_0x427244['query'][_0x9722('0x2c')]);}_0x53e12c['order']=qs['sort'](_0x427244[_0x9722('0x3c')][_0x9722('0x44')]);_0x53e12c[_0x9722('0x45')]=qs[_0x9722('0x46')](_[_0x9722('0x47')](_0x427244[_0x9722('0x3c')],_0x50a958[_0x9722('0x46')]),_0x2b74ed);if(_0x427244['query'][_0x9722('0x48')]){_0x53e12c[_0x9722('0x45')]=_[_0x9722('0x49')](_0x53e12c['where'],{'$or':_[_0x9722('0x36')](_0x2b74ed,function(_0xed44c4){if(_0xed44c4[_0x9722('0x3a')]!==_0x9722('0x4a')){var _0xcf02d3={};_0xcf02d3[_0xed44c4[_0x9722('0x33')]]={'$like':'%'+_0x427244['query'][_0x9722('0x48')]+'%'};return _0xcf02d3;}})});}_0x53e12c=_[_0x9722('0x49')]({},_0x53e12c,_0x427244[_0x9722('0x4b')]);var _0x4cc775={'where':_0x53e12c[_0x9722('0x45')]};return db[_0x9722('0x37')][_0x9722('0x2b')](_0x4cc775)[_0x9722('0x1d')](function(_0x485829){_0x2130d3[_0x9722('0x2b')]=_0x485829;if(_0x427244[_0x9722('0x3c')][_0x9722('0x4c')]){_0x53e12c[_0x9722('0x4d')]=[{'all':!![]}];}return db[_0x9722('0x37')][_0x9722('0x4e')](_0x53e12c);})[_0x9722('0x1d')](function(_0x524163){_0x2130d3[_0x9722('0x4f')]=_0x524163;return _0x2130d3;})[_0x9722('0x1d')](respondWithFilteredResult(_0x340e47,_0x53e12c))[_0x9722('0x27')](handleError(_0x340e47,null));};exports[_0x9722('0x50')]=function(_0x3d409e,_0xc4c140){var _0x534972={'raw':![],'where':{'id':_0x3d409e[_0x9722('0x51')]['id']}},_0x40b591={};_0x40b591[_0x9722('0x3b')]=_[_0x9722('0x3d')](db[_0x9722('0x37')][_0x9722('0x38')]);_0x40b591[_0x9722('0x3c')]=_[_0x9722('0x3d')](_0x3d409e[_0x9722('0x3c')]);_0x40b591['filters']=_[_0x9722('0x3e')](_0x40b591[_0x9722('0x3b')],_0x40b591[_0x9722('0x3c')]);_0x534972[_0x9722('0x3f')]=_[_0x9722('0x3e')](_0x40b591['model'],qs['fields'](_0x3d409e[_0x9722('0x3c')][_0x9722('0x40')]));_0x534972['attributes']=_0x534972[_0x9722('0x3f')][_0x9722('0x41')]?_0x534972['attributes']:_0x40b591[_0x9722('0x3b')];if(_0x3d409e[_0x9722('0x3c')]['includeAll']){_0x534972[_0x9722('0x4d')]=[{'all':!![]}];}_0x534972=_[_0x9722('0x49')]({},_0x534972,_0x3d409e[_0x9722('0x4b')]);return db[_0x9722('0x37')]['find'](_0x534972)[_0x9722('0x1d')](handleEntityNotFound(_0xc4c140,null))[_0x9722('0x1d')](respondWithResult(_0xc4c140,null))[_0x9722('0x27')](handleError(_0xc4c140,null));};exports['create']=function(_0x3988eb,_0x33aedc){return db[_0x9722('0x37')][_0x9722('0x52')](_0x3988eb['body'],{})['then'](respondWithResult(_0x33aedc,0xc9))[_0x9722('0x27')](handleError(_0x33aedc,null));};exports[_0x9722('0x31')]=function(_0x3f5c28,_0x2ea629){if(_0x3f5c28[_0x9722('0x53')]['id']){delete _0x3f5c28[_0x9722('0x53')]['id'];}return db[_0x9722('0x37')][_0x9722('0x54')]({'where':{'id':_0x3f5c28[_0x9722('0x51')]['id']}})[_0x9722('0x1d')](handleEntityNotFound(_0x2ea629,null))['then'](saveUpdates(_0x3f5c28[_0x9722('0x53')],null))[_0x9722('0x1d')](respondWithResult(_0x2ea629,null))[_0x9722('0x27')](handleError(_0x2ea629,null));};exports['destroy']=function(_0x4bb665,_0x2b058d){return db[_0x9722('0x37')][_0x9722('0x54')]({'where':{'id':_0x4bb665[_0x9722('0x51')]['id']}})[_0x9722('0x1d')](handleEntityNotFound(_0x2b058d,null))[_0x9722('0x1d')](removeEntity(_0x2b058d,null))[_0x9722('0x27')](handleError(_0x2b058d,null));};exports[_0x9722('0x55')]=function(_0xdd10f4,_0x31a17d,_0x8a9339){var _0x897fcd={};var _0x29c4fa={};var _0x57a72f;var _0x4bfc1e;return db['ZendeskAccount'][_0x9722('0x56')]({'where':{'id':_0xdd10f4[_0x9722('0x51')]['id']}})[_0x9722('0x1d')](handleEntityNotFound(_0x31a17d,null))[_0x9722('0x1d')](function(_0x16245c){if(_0x16245c){_0x57a72f=_0x16245c;_0x29c4fa[_0x9722('0x3b')]=_[_0x9722('0x3d')](db[_0x9722('0x57')]['rawAttributes']);_0x29c4fa['query']=_[_0x9722('0x3d')](_0xdd10f4['query']);_0x29c4fa['filters']=_['intersection'](_0x29c4fa[_0x9722('0x3b')],_0x29c4fa['query']);_0x897fcd['attributes']=_[_0x9722('0x3e')](_0x29c4fa['model'],qs[_0x9722('0x40')](_0xdd10f4[_0x9722('0x3c')][_0x9722('0x40')]));_0x897fcd[_0x9722('0x3f')]=_0x897fcd[_0x9722('0x3f')]['length']?_0x897fcd[_0x9722('0x3f')]:_0x29c4fa[_0x9722('0x3b')];_0x897fcd[_0x9722('0x58')]=qs[_0x9722('0x44')](_0xdd10f4['query'][_0x9722('0x44')]);_0x897fcd[_0x9722('0x45')]=qs[_0x9722('0x46')](_['pick'](_0xdd10f4[_0x9722('0x3c')],_0x29c4fa['filters']));if(_0xdd10f4[_0x9722('0x3c')]['filter']){_0x897fcd[_0x9722('0x45')]=_[_0x9722('0x49')](_0x897fcd[_0x9722('0x45')],{'$or':_[_0x9722('0x36')](_0x897fcd[_0x9722('0x3f')],function(_0x5895d9){var _0x3b106e={};_0x3b106e[_0x5895d9]={'$like':'%'+_0xdd10f4[_0x9722('0x3c')][_0x9722('0x48')]+'%'};return _0x3b106e;})});}_0x897fcd=_['merge']({},_0x897fcd,_0xdd10f4[_0x9722('0x4b')]);return _0x57a72f[_0x9722('0x55')](_0x897fcd);}})[_0x9722('0x1d')](function(_0x5a07af){if(_0x5a07af){_0x4bfc1e=_0x5a07af[_0x9722('0x41')];if(!_0xdd10f4[_0x9722('0x3c')][_0x9722('0x42')](_0x9722('0x59'))){_0x897fcd[_0x9722('0x43')]=qs['limit'](_0xdd10f4[_0x9722('0x3c')][_0x9722('0x43')]);_0x897fcd[_0x9722('0x2c')]=qs[_0x9722('0x2c')](_0xdd10f4[_0x9722('0x3c')][_0x9722('0x2c')]);}return _0x57a72f[_0x9722('0x55')](_0x897fcd);}})['then'](function(_0x14d40e){if(_0x14d40e){return _0x14d40e?{'count':_0x4bfc1e,'rows':_0x14d40e}:null;}})[_0x9722('0x1d')](respondWithResult(_0x31a17d,null))['catch'](handleError(_0x31a17d,null));};exports[_0x9722('0x5a')]=function(_0x524786,_0x43ed76,_0x3d3062){if(_0x524786[_0x9722('0x53')]['id']){delete _0x524786[_0x9722('0x53')]['id'];}return db[_0x9722('0x37')][_0x9722('0x56')]({'where':{'id':_0x524786['params']['id']}})[_0x9722('0x1d')](handleEntityNotFound(_0x43ed76,null))[_0x9722('0x1d')](function(_0xb4fc80){if(_0xb4fc80){_0x524786['body'][_0x9722('0x5b')]=_0xb4fc80['id'];_0x524786['body'][_0x9722('0x5c')]=integrations['getSubjects'](_0x524786['body'][_0x9722('0x5d')],_0x524786['body'][_0x9722('0x3a')]);_0x524786['body'][_0x9722('0x5e')]=integrations['getDescriptions'](_0x524786[_0x9722('0x53')][_0x9722('0x5d')],_0x524786[_0x9722('0x53')][_0x9722('0x3a')]);return db[_0x9722('0x57')][_0x9722('0x52')](_0x524786[_0x9722('0x53')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x9722('0x5f')],'as':_0x9722('0x5e')}]});}return null;})[_0x9722('0x1d')](respondWithResult(_0x43ed76,null))[_0x9722('0x27')](handleError(_0x43ed76,null));};exports[_0x9722('0x60')]=function(_0xf5bbbe,_0x30c469,_0x47564d){var _0x3d5f46='';return db[_0x9722('0x37')][_0x9722('0x56')]({'where':{'id':_0xf5bbbe[_0x9722('0x51')]['id']},'attributes':['id','username',_0x9722('0x61'),_0x9722('0x62'),_0x9722('0x63'),_0x9722('0x64')]})[_0x9722('0x1d')](handleEntityNotFound(_0x30c469,null))[_0x9722('0x1d')](function(_0x3edb65){if(_0x3edb65){_0x3d5f46=_0x3edb65['remoteUri'];var _0x1aaeb7=_0x3d5f46[_0x9722('0x65')](-0x1);if(_0x1aaeb7==='/'){_0x3d5f46=_0x3d5f46['substring'](0x0,_0x3d5f46[_0x9722('0x66')](_0x1aaeb7));}var _0x2e58a1={'method':_0x9722('0x67'),'uri':util[_0x9722('0x68')](_0x9722('0x69'),_0x3d5f46,_0x9722('0x6a')),'json':!![]};switch(_0x3edb65[_0x9722('0x63')]){case _0x9722('0x61'):_0x2e58a1[_0x9722('0x6b')]={'Authorization':util[_0x9722('0x68')](_0x9722('0x6c'),new Buffer(util[_0x9722('0x68')]('%s:%s',_0x3edb65['username'],_0x3edb65[_0x9722('0x61')]))[_0x9722('0x6d')](_0x9722('0x6e')))};break;case _0x9722('0x62'):_0x2e58a1[_0x9722('0x6b')]={'Authorization':util[_0x9722('0x68')](_0x9722('0x6c'),new Buffer(util[_0x9722('0x68')](_0x9722('0x6f'),_0x3edb65[_0x9722('0x70')],_0x3edb65[_0x9722('0x62')]))[_0x9722('0x6d')]('base64'))};break;default:throw new db[(_0x9722('0x71'))]['ValidationError'](_0x9722('0x72'));}return rp(_0x2e58a1);}})[_0x9722('0x1d')](function(_0x37a9e8){if(_0x37a9e8){var _0x5c1a4b=[_0x9722('0x73'),_0x9722('0x74'),_0x9722('0x75'),'assignee'];_[_0x9722('0x76')](_0x37a9e8[_0x9722('0x6a')],function(_0x42316f){return _0x5c1a4b[_0x9722('0x77')](_0x42316f['type']);});return{'count':_0x37a9e8[_0x9722('0x6a')][_0x9722('0x41')],'rows':_['map'](_0x37a9e8[_0x9722('0x6a')],function(_0xf7c3b0){return{'id':_0xf7c3b0['id'],'name':_0xf7c3b0[_0x9722('0x78')]>0x7?_0xf7c3b0[_0x9722('0x79')]:_0xf7c3b0[_0x9722('0x3a')],'custom':_0xf7c3b0['position']>0x7?!![]:![],'options':_0xf7c3b0[_0x9722('0x7a')]?_0xf7c3b0[_0x9722('0x7a')]:_0xf7c3b0[_0x9722('0x7b')]?_0xf7c3b0[_0x9722('0x7b')]:[]};})};}})[_0x9722('0x1d')](respondWithResult(_0x30c469,null))[_0x9722('0x27')](function(_0x55188f){var _0x429af7=_0xf5bbbe[_0x9722('0x3c')]['test']?0x1f4:_0x55188f[_0x9722('0x7c')]||0x1f4;logger[_0x9722('0x23')](_0x9722('0x7d'),_0x9722('0x60'),_0x429af7,JSON[_0x9722('0x7e')](_0x55188f));delete _0x55188f[_0x9722('0x33')];if(_0x429af7===0x191){_0x429af7=0x190;}_0x30c469[_0x9722('0x29')](_0x429af7)[_0x9722('0x34')](_0xf5bbbe[_0x9722('0x3c')]['test']?{'message':_0x9722('0x7f'),'statusCode':_0x55188f[_0x9722('0x7c')]}:_0x55188f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e2395f9..0eaf959 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 _0x3b48=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x3b48,0x1c4));var _0x83b4=function(_0x255b9b,_0x517a0f){_0x255b9b=_0x255b9b-0x0;var _0x1345b6=_0x3b48[_0x255b9b];return _0x1345b6;};'use strict';var _=require(_0x83b4('0x0'));var util=require('util');var logger=require(_0x83b4('0x1'))(_0x83b4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83b4('0x3'));var fs=require('fs');var path=require(_0x83b4('0x4'));var rimraf=require(_0x83b4('0x5'));var config=require(_0x83b4('0x6'));var attributes=require(_0x83b4('0x7'));var integrations=require(_0x83b4('0x8'));module[_0x83b4('0x9')]=function(_0x4c6f79,_0x2fbb9b){return _0x4c6f79[_0x83b4('0xa')](_0x83b4('0xb'),attributes,{'tableName':_0x83b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c41=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','api'];(function(_0x5f4046,_0x244c4e){var _0x35ceb3=function(_0x50c948){while(--_0x50c948){_0x5f4046['push'](_0x5f4046['shift']());}};_0x35ceb3(++_0x244c4e);}(_0x0c41,0x14d));var _0x10c4=function(_0x2b9ae2,_0x1cc25f){_0x2b9ae2=_0x2b9ae2-0x0;var _0x2072d5=_0x0c41[_0x2b9ae2];return _0x2072d5;};'use strict';var _=require(_0x10c4('0x0'));var util=require(_0x10c4('0x1'));var logger=require('../../config/logger')(_0x10c4('0x2'));var moment=require('moment');var BPromise=require(_0x10c4('0x3'));var rp=require(_0x10c4('0x4'));var fs=require('fs');var path=require(_0x10c4('0x5'));var rimraf=require(_0x10c4('0x6'));var config=require(_0x10c4('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x10c4('0x8'));module[_0x10c4('0x9')]=function(_0x2a907e,_0x12fcb7){return _0x2a907e[_0x10c4('0xa')]('ZendeskAccount',attributes,{'tableName':_0x10c4('0xb'),'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 a67ebfd..f6c5f92 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xcb91[_0x4429e0];return _0x51a5b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x1711d3,_0x2809e9){var _0x29e4de=function(_0x18c7e3){while(--_0x18c7e3){_0x1711d3['push'](_0x1711d3['shift']());}};_0x29e4de(++_0x2809e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 479b044..835a8e5 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 _0xea90=['create','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x303b08,_0x130e2a){var _0x52c85f=function(_0x485881){while(--_0x485881){_0x303b08['push'](_0x303b08['shift']());}};_0x52c85f(++_0x130e2a);}(_0xea90,0xe8));var _0x0ea9=function(_0x3b48bc,_0x572105){_0x3b48bc=_0x3b48bc-0x0;var _0x27b95d=_0xea90[_0x3b48bc];return _0x27b95d;};'use strict';var multer=require(_0x0ea9('0x0'));var util=require(_0x0ea9('0x1'));var path=require(_0x0ea9('0x2'));var timeout=require(_0x0ea9('0x3'));var express=require(_0x0ea9('0x4'));var router=express[_0x0ea9('0x5')]();var auth=require(_0x0ea9('0x6'));var interaction=require(_0x0ea9('0x7'));var config=require(_0x0ea9('0x8'));var controller=require('./intZendeskConfiguration.controller');router[_0x0ea9('0x9')]('/',auth[_0x0ea9('0xa')](),controller['index']);router[_0x0ea9('0x9')](_0x0ea9('0xb'),auth['isAuthenticated'](),controller[_0x0ea9('0xc')]);router[_0x0ea9('0x9')](_0x0ea9('0xd'),auth[_0x0ea9('0xa')](),controller[_0x0ea9('0xe')]);router[_0x0ea9('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x0ea9('0xf')]);router[_0x0ea9('0x9')](_0x0ea9('0x10'),auth[_0x0ea9('0xa')](),controller[_0x0ea9('0x11')]);router['get'](_0x0ea9('0x12'),auth['isAuthenticated'](),controller[_0x0ea9('0x13')]);router['post']('/',auth[_0x0ea9('0xa')](),controller[_0x0ea9('0x14')]);router[_0x0ea9('0x15')](_0x0ea9('0x12'),auth[_0x0ea9('0xa')](),controller[_0x0ea9('0x16')]);router[_0x0ea9('0x17')](_0x0ea9('0xb'),auth[_0x0ea9('0xa')](),controller[_0x0ea9('0x18')]);router[_0x0ea9('0x19')](_0x0ea9('0xb'),auth[_0x0ea9('0xa')](),controller[_0x0ea9('0x1a')]);module[_0x0ea9('0x1b')]=router; \ No newline at end of file +var _0x6a5e=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6a5e,0xc4));var _0xe6a5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x6a5e[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0xe6a5('0x0'));var util=require(_0xe6a5('0x1'));var path=require(_0xe6a5('0x2'));var timeout=require(_0xe6a5('0x3'));var express=require(_0xe6a5('0x4'));var router=express['Router']();var auth=require(_0xe6a5('0x5'));var interaction=require(_0xe6a5('0x6'));var config=require(_0xe6a5('0x7'));var controller=require(_0xe6a5('0x8'));router[_0xe6a5('0x9')]('/',auth[_0xe6a5('0xa')](),controller[_0xe6a5('0xb')]);router['get']('/:id',auth[_0xe6a5('0xa')](),controller['show']);router[_0xe6a5('0x9')](_0xe6a5('0xc'),auth[_0xe6a5('0xa')](),controller[_0xe6a5('0xd')]);router[_0xe6a5('0x9')](_0xe6a5('0xe'),auth[_0xe6a5('0xa')](),controller[_0xe6a5('0xf')]);router[_0xe6a5('0x9')](_0xe6a5('0x10'),auth[_0xe6a5('0xa')](),controller[_0xe6a5('0x11')]);router[_0xe6a5('0x9')]('/:id/tags',auth[_0xe6a5('0xa')](),controller[_0xe6a5('0x12')]);router[_0xe6a5('0x13')]('/',auth[_0xe6a5('0xa')](),controller[_0xe6a5('0x14')]);router[_0xe6a5('0x13')]('/:id/tags',auth[_0xe6a5('0xa')](),controller['setTags']);router[_0xe6a5('0x15')](_0xe6a5('0x16'),auth[_0xe6a5('0xa')](),controller[_0xe6a5('0x17')]);router[_0xe6a5('0x18')]('/:id',auth[_0xe6a5('0xa')](),controller[_0xe6a5('0x19')]);module[_0xe6a5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 99a6184..2d84614 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 _0x9ede=['sequelize','exports','STRING'];(function(_0x530a4d,_0x325c2e){var _0x361dd1=function(_0x3ce2db){while(--_0x3ce2db){_0x530a4d['push'](_0x530a4d['shift']());}};_0x361dd1(++_0x325c2e);}(_0x9ede,0x1d4));var _0xe9ed=function(_0x3e1aa3,_0x210891){_0x3e1aa3=_0x3e1aa3-0x0;var _0x3739dc=_0x9ede[_0x3e1aa3];return _0x3739dc;};'use strict';var Sequelize=require(_0xe9ed('0x0'));module[_0xe9ed('0x1')]={'name':{'type':Sequelize[_0xe9ed('0x2')]},'description':{'type':Sequelize[_0xe9ed('0x2')]}}; \ No newline at end of file +var _0xfe96=['sequelize','exports','STRING'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xfe96,0xed));var _0x6fe9=function(_0x83609a,_0x4623de){_0x83609a=_0x83609a-0x0;var _0x3de3aa=_0xfe96[_0x83609a];return _0x3de3aa;};'use strict';var Sequelize=require(_0x6fe9('0x0'));module[_0x6fe9('0x1')]={'name':{'type':Sequelize[_0x6fe9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0fef34f..0dc07f6 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 _0xcf5f=['filter','where','merge','VIRTUAL','options','includeAll','ZendeskConfiguration','findAll','params','include','find','create','body','getFields','order','getSubjects','ZendeskField','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','fast-json-patch','request-promise','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick'];(function(_0x3fb166,_0x4eb985){var _0x5e91be=function(_0x53f4d9){while(--_0x53f4d9){_0x3fb166['push'](_0x3fb166['shift']());}};_0x5e91be(++_0x4eb985);}(_0xcf5f,0x12e));var _0xfcf5=function(_0x5a9938,_0x1e8cc8){_0x5a9938=_0x5a9938-0x0;var _0x2de653=_0xcf5f[_0x5a9938];return _0x2de653;};'use strict';var pdf=require(_0xfcf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfcf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcf5('0x2'));var rp=require(_0xfcf5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcf5('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfcf5('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcf5('0x6'));var squel=require(_0xfcf5('0x7'));var crypto=require(_0xfcf5('0x8'));var jsforce=require(_0xfcf5('0x9'));var deskjs=require(_0xfcf5('0xa'));var toCsv=require(_0xfcf5('0x5'));var querystring=require(_0xfcf5('0xb'));var Papa=require(_0xfcf5('0xc'));var Redis=require(_0xfcf5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfcf5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf5('0xf'));var logger=require(_0xfcf5('0x10'))(_0xfcf5('0x11'));var utils=require(_0xfcf5('0x12'));var config=require(_0xfcf5('0x13'));var licenseUtil=require(_0xfcf5('0x14'));var db=require(_0xfcf5('0x15'))['db'];var jayson=require(_0xfcf5('0x16'));var client=jayson[_0xfcf5('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf55d52,_0x41e6fd,_0x5dab1b,_0x3c37b5){return new BPromise(function(_0x1f3cb2,_0x56d60d){var _0x3bb868=_0x3c37b5||client;return _0x3bb868[_0xfcf5('0x18')](_0xf55d52,_0x5dab1b)[_0xfcf5('0x19')](function(_0x103440){logger[_0xfcf5('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x41e6fd,_0xfcf5('0x1b'));logger[_0xfcf5('0x1c')](_0xfcf5('0x1d'),_0x41e6fd,_0xfcf5('0x1b'),JSON[_0xfcf5('0x1e')](_0x103440));if(_0x103440['error']){if(_0x103440[_0xfcf5('0x1f')]['code']===0x1f4){logger[_0xfcf5('0x1f')](_0xfcf5('0x20'),_0x41e6fd,_0x103440[_0xfcf5('0x1f')][_0xfcf5('0x21')]);return _0x56d60d(_0x103440[_0xfcf5('0x1f')][_0xfcf5('0x21')]);}logger['error'](_0xfcf5('0x20'),_0x41e6fd,_0x103440[_0xfcf5('0x1f')][_0xfcf5('0x21')]);return _0x1f3cb2(_0x103440[_0xfcf5('0x1f')]['message']);}else{logger[_0xfcf5('0x1a')](_0xfcf5('0x20'),_0x41e6fd,'request\x20sent');_0x1f3cb2(_0x103440[_0xfcf5('0x22')][_0xfcf5('0x21')]);}})[_0xfcf5('0x23')](function(_0x474eb9){logger[_0xfcf5('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x41e6fd,_0x474eb9);_0x56d60d(_0x474eb9);});});}function respondWithStatusCode(_0x3c03d0,_0x3400b8){_0x3400b8=_0x3400b8||0xcc;return function(_0xac53c){if(_0xac53c){return _0x3c03d0['sendStatus'](_0x3400b8);}return _0x3c03d0[_0xfcf5('0x24')](_0x3400b8)[_0xfcf5('0x25')]();};}function respondWithResult(_0x248473,_0x4ff677){_0x4ff677=_0x4ff677||0xc8;return function(_0x156700){if(_0x156700){return _0x248473[_0xfcf5('0x24')](_0x4ff677)[_0xfcf5('0x26')](_0x156700);}};}function respondWithFilteredResult(_0x3b5208,_0x313d9d){return function(_0x57db44){if(_0x57db44){var _0x2f1578=_0x57db44[_0xfcf5('0x27')],_0x3ba717=_0x313d9d[_0xfcf5('0x28')],_0xb5f56e=_0x313d9d['offset']+_0x313d9d['limit'],_0x12c945;if(_0xb5f56e>=_0x2f1578){_0xb5f56e=_0x2f1578;_0x12c945=0xc8;}else{_0x12c945=0xce;}_0x3b5208[_0xfcf5('0x24')](_0x12c945);return _0x3b5208[_0xfcf5('0x29')](_0xfcf5('0x2a'),_0x3ba717+'-'+_0xb5f56e+'/'+_0x2f1578)['json'](_0x57db44);}return null;};}function patchUpdates(_0x27aca6){return function(_0x5d5971){try{jsonpatch[_0xfcf5('0x2b')](_0x5d5971,_0x27aca6,!![]);}catch(_0x351f6d){return BPromise[_0xfcf5('0x2c')](_0x351f6d);}return _0x5d5971[_0xfcf5('0x2d')]();};}function saveUpdates(_0x391172,_0x1ad43d){return function(_0x4dcc4f){if(_0x4dcc4f){return _0x4dcc4f[_0xfcf5('0x2e')](_0x391172)['then'](function(_0x3daa68){return _0x3daa68;});}return null;};}function removeEntity(_0xee020,_0x42f962){return function(_0x12d245){if(_0x12d245){return _0x12d245[_0xfcf5('0x2f')]()[_0xfcf5('0x19')](function(){_0xee020[_0xfcf5('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235a74,_0x456950){return function(_0x58473f){if(!_0x58473f){_0x235a74[_0xfcf5('0x30')](0x194);}return _0x58473f;};}function handleError(_0x42b873,_0x93c453){_0x93c453=_0x93c453||0x1f4;return function(_0x4c9522){logger['error'](_0x4c9522[_0xfcf5('0x31')]);if(_0x4c9522[_0xfcf5('0x32')]){delete _0x4c9522[_0xfcf5('0x32')];}_0x42b873['status'](_0x93c453)[_0xfcf5('0x33')](_0x4c9522);};}exports[_0xfcf5('0x34')]=function(_0x30009c,_0x2c8097){var _0x4f2d7c={},_0x1ce525={},_0x475baa={'count':0x0,'rows':[]};var _0x44192c=_[_0xfcf5('0x35')](db['ZendeskConfiguration'][_0xfcf5('0x36')],function(_0x4e96f0){return{'name':_0x4e96f0['fieldName'],'type':_0x4e96f0[_0xfcf5('0x37')][_0xfcf5('0x38')]};});_0x1ce525[_0xfcf5('0x39')]=_[_0xfcf5('0x35')](_0x44192c,_0xfcf5('0x32'));_0x1ce525[_0xfcf5('0x3a')]=_[_0xfcf5('0x3b')](_0x30009c[_0xfcf5('0x3a')]);_0x1ce525[_0xfcf5('0x3c')]=_[_0xfcf5('0x3d')](_0x1ce525[_0xfcf5('0x39')],_0x1ce525[_0xfcf5('0x3a')]);_0x4f2d7c[_0xfcf5('0x3e')]=_['intersection'](_0x1ce525[_0xfcf5('0x39')],qs[_0xfcf5('0x3f')](_0x30009c['query'][_0xfcf5('0x3f')]));_0x4f2d7c['attributes']=_0x4f2d7c[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x4f2d7c['attributes']:_0x1ce525[_0xfcf5('0x39')];if(!_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x41')](_0xfcf5('0x42'))){_0x4f2d7c[_0xfcf5('0x43')]=qs[_0xfcf5('0x43')](_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x43')]);_0x4f2d7c[_0xfcf5('0x28')]=qs[_0xfcf5('0x28')](_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x28')]);}_0x4f2d7c['order']=qs[_0xfcf5('0x44')](_0x30009c['query'][_0xfcf5('0x44')]);_0x4f2d7c['where']=qs[_0xfcf5('0x3c')](_[_0xfcf5('0x45')](_0x30009c['query'],_0x1ce525[_0xfcf5('0x3c')]),_0x44192c);if(_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x46')]){_0x4f2d7c[_0xfcf5('0x47')]=_[_0xfcf5('0x48')](_0x4f2d7c[_0xfcf5('0x47')],{'$or':_['map'](_0x44192c,function(_0xbf4f10){if(_0xbf4f10[_0xfcf5('0x37')]!==_0xfcf5('0x49')){var _0x419064={};_0x419064[_0xbf4f10[_0xfcf5('0x32')]]={'$like':'%'+_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x46')]+'%'};return _0x419064;}})});}_0x4f2d7c=_[_0xfcf5('0x48')]({},_0x4f2d7c,_0x30009c[_0xfcf5('0x4a')]);var _0x393c54={'where':_0x4f2d7c[_0xfcf5('0x47')]};return db['ZendeskConfiguration']['count'](_0x393c54)[_0xfcf5('0x19')](function(_0x962f06){_0x475baa[_0xfcf5('0x27')]=_0x962f06;if(_0x30009c[_0xfcf5('0x3a')][_0xfcf5('0x4b')]){_0x4f2d7c['include']=[{'all':!![]}];}return db[_0xfcf5('0x4c')][_0xfcf5('0x4d')](_0x4f2d7c);})[_0xfcf5('0x19')](function(_0x26c680){_0x475baa['rows']=_0x26c680;return _0x475baa;})[_0xfcf5('0x19')](respondWithFilteredResult(_0x2c8097,_0x4f2d7c))[_0xfcf5('0x23')](handleError(_0x2c8097,null));};exports['show']=function(_0x92b175,_0x1b56a6){var _0x2641ff={'raw':![],'where':{'id':_0x92b175[_0xfcf5('0x4e')]['id']}},_0x1b8518={};_0x1b8518[_0xfcf5('0x39')]=_[_0xfcf5('0x3b')](db[_0xfcf5('0x4c')][_0xfcf5('0x36')]);_0x1b8518[_0xfcf5('0x3a')]=_[_0xfcf5('0x3b')](_0x92b175[_0xfcf5('0x3a')]);_0x1b8518['filters']=_['intersection'](_0x1b8518[_0xfcf5('0x39')],_0x1b8518[_0xfcf5('0x3a')]);_0x2641ff[_0xfcf5('0x3e')]=_[_0xfcf5('0x3d')](_0x1b8518[_0xfcf5('0x39')],qs[_0xfcf5('0x3f')](_0x92b175[_0xfcf5('0x3a')][_0xfcf5('0x3f')]));_0x2641ff[_0xfcf5('0x3e')]=_0x2641ff[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x2641ff[_0xfcf5('0x3e')]:_0x1b8518[_0xfcf5('0x39')];if(_0x92b175[_0xfcf5('0x3a')]['includeAll']){_0x2641ff[_0xfcf5('0x4f')]=[{'all':!![]}];}_0x2641ff=_['merge']({},_0x2641ff,_0x92b175[_0xfcf5('0x4a')]);return db[_0xfcf5('0x4c')][_0xfcf5('0x50')](_0x2641ff)['then'](handleEntityNotFound(_0x1b56a6,null))[_0xfcf5('0x19')](respondWithResult(_0x1b56a6,null))[_0xfcf5('0x23')](handleError(_0x1b56a6,null));};exports['create']=function(_0xed7784,_0x4542d1){return db[_0xfcf5('0x4c')][_0xfcf5('0x51')](_0xed7784['body'],{})['then'](respondWithResult(_0x4542d1,0xc9))['catch'](handleError(_0x4542d1,null));};exports[_0xfcf5('0x2e')]=function(_0x539ccd,_0x7262d6){if(_0x539ccd['body']['id']){delete _0x539ccd['body']['id'];}return db[_0xfcf5('0x4c')]['find']({'where':{'id':_0x539ccd['params']['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x7262d6,null))['then'](saveUpdates(_0x539ccd[_0xfcf5('0x52')],null))['then'](respondWithResult(_0x7262d6,null))[_0xfcf5('0x23')](handleError(_0x7262d6,null));};exports['destroy']=function(_0x4e661f,_0x3d74a6){return db[_0xfcf5('0x4c')]['find']({'where':{'id':_0x4e661f['params']['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x3d74a6,null))[_0xfcf5('0x19')](removeEntity(_0x3d74a6,null))[_0xfcf5('0x23')](handleError(_0x3d74a6,null));};exports[_0xfcf5('0x53')]=function(_0x5baa2b,_0x236b99,_0x55787a){var _0x52ebab={};var _0x2904ca={};var _0x248963;var _0x1c4260;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5baa2b[_0xfcf5('0x4e')]['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x236b99,null))[_0xfcf5('0x19')](function(_0x3ed213){if(_0x3ed213){_0x248963=_0x3ed213;_0x2904ca[_0xfcf5('0x39')]=_[_0xfcf5('0x3b')](db['ZendeskField']['rawAttributes']);_0x2904ca[_0xfcf5('0x3a')]=_['keys'](_0x5baa2b[_0xfcf5('0x3a')]);_0x2904ca[_0xfcf5('0x3c')]=_[_0xfcf5('0x3d')](_0x2904ca[_0xfcf5('0x39')],_0x2904ca[_0xfcf5('0x3a')]);_0x52ebab[_0xfcf5('0x3e')]=_[_0xfcf5('0x3d')](_0x2904ca[_0xfcf5('0x39')],qs[_0xfcf5('0x3f')](_0x5baa2b[_0xfcf5('0x3a')][_0xfcf5('0x3f')]));_0x52ebab[_0xfcf5('0x3e')]=_0x52ebab[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x52ebab['attributes']:_0x2904ca[_0xfcf5('0x39')];_0x52ebab[_0xfcf5('0x54')]=qs[_0xfcf5('0x44')](_0x5baa2b[_0xfcf5('0x3a')][_0xfcf5('0x44')]);_0x52ebab[_0xfcf5('0x47')]=qs[_0xfcf5('0x3c')](_[_0xfcf5('0x45')](_0x5baa2b[_0xfcf5('0x3a')],_0x2904ca[_0xfcf5('0x3c')]));if(_0x5baa2b['query'][_0xfcf5('0x46')]){_0x52ebab[_0xfcf5('0x47')]=_[_0xfcf5('0x48')](_0x52ebab[_0xfcf5('0x47')],{'$or':_[_0xfcf5('0x35')](_0x52ebab['attributes'],function(_0x2e83d1){var _0x380cd5={};_0x380cd5[_0x2e83d1]={'$like':'%'+_0x5baa2b[_0xfcf5('0x3a')][_0xfcf5('0x46')]+'%'};return _0x380cd5;})});}_0x52ebab=_[_0xfcf5('0x48')]({},_0x52ebab,_0x5baa2b[_0xfcf5('0x4a')]);return _0x248963[_0xfcf5('0x53')](_0x52ebab);}})[_0xfcf5('0x19')](function(_0x585bc2){if(_0x585bc2){_0x1c4260=_0x585bc2[_0xfcf5('0x40')];if(!_0x5baa2b[_0xfcf5('0x3a')][_0xfcf5('0x41')]('nolimit')){_0x52ebab[_0xfcf5('0x43')]=qs[_0xfcf5('0x43')](_0x5baa2b[_0xfcf5('0x3a')][_0xfcf5('0x43')]);_0x52ebab[_0xfcf5('0x28')]=qs[_0xfcf5('0x28')](_0x5baa2b['query']['offset']);}return _0x248963[_0xfcf5('0x53')](_0x52ebab);}})['then'](function(_0xb343ef){if(_0xb343ef){return _0xb343ef?{'count':_0x1c4260,'rows':_0xb343ef}:null;}})[_0xfcf5('0x19')](respondWithResult(_0x236b99,null))[_0xfcf5('0x23')](handleError(_0x236b99,null));};exports[_0xfcf5('0x55')]=function(_0x330ebc,_0xc74f3f,_0x45bd45){var _0x1632bb={};var _0x2a5e9c={};var _0x4a01e1;var _0x2152c9;return db[_0xfcf5('0x4c')]['findOne']({'where':{'id':_0x330ebc[_0xfcf5('0x4e')]['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0xc74f3f,null))[_0xfcf5('0x19')](function(_0x20634c){if(_0x20634c){_0x4a01e1=_0x20634c;_0x2a5e9c[_0xfcf5('0x39')]=_[_0xfcf5('0x3b')](db[_0xfcf5('0x56')][_0xfcf5('0x36')]);_0x2a5e9c[_0xfcf5('0x3a')]=_[_0xfcf5('0x3b')](_0x330ebc[_0xfcf5('0x3a')]);_0x2a5e9c[_0xfcf5('0x3c')]=_[_0xfcf5('0x3d')](_0x2a5e9c[_0xfcf5('0x39')],_0x2a5e9c['query']);_0x1632bb[_0xfcf5('0x3e')]=_['intersection'](_0x2a5e9c['model'],qs[_0xfcf5('0x3f')](_0x330ebc[_0xfcf5('0x3a')][_0xfcf5('0x3f')]));_0x1632bb[_0xfcf5('0x3e')]=_0x1632bb[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x1632bb[_0xfcf5('0x3e')]:_0x2a5e9c[_0xfcf5('0x39')];_0x1632bb[_0xfcf5('0x54')]=qs['sort'](_0x330ebc[_0xfcf5('0x3a')][_0xfcf5('0x44')]);_0x1632bb[_0xfcf5('0x47')]=qs['filters'](_[_0xfcf5('0x45')](_0x330ebc[_0xfcf5('0x3a')],_0x2a5e9c[_0xfcf5('0x3c')]));if(_0x330ebc[_0xfcf5('0x3a')][_0xfcf5('0x46')]){_0x1632bb[_0xfcf5('0x47')]=_['merge'](_0x1632bb[_0xfcf5('0x47')],{'$or':_['map'](_0x1632bb[_0xfcf5('0x3e')],function(_0xad11fc){var _0x1bb3e4={};_0x1bb3e4[_0xad11fc]={'$like':'%'+_0x330ebc['query']['filter']+'%'};return _0x1bb3e4;})});}_0x1632bb=_[_0xfcf5('0x48')]({},_0x1632bb,_0x330ebc[_0xfcf5('0x4a')]);return _0x4a01e1[_0xfcf5('0x55')](_0x1632bb);}})['then'](function(_0x3be4d2){if(_0x3be4d2){_0x2152c9=_0x3be4d2[_0xfcf5('0x40')];if(!_0x330ebc[_0xfcf5('0x3a')]['hasOwnProperty']('nolimit')){_0x1632bb[_0xfcf5('0x43')]=qs[_0xfcf5('0x43')](_0x330ebc['query']['limit']);_0x1632bb['offset']=qs['offset'](_0x330ebc['query'][_0xfcf5('0x28')]);}return _0x4a01e1['getSubjects'](_0x1632bb);}})[_0xfcf5('0x19')](function(_0xfb314d){if(_0xfb314d){return _0xfb314d?{'count':_0x2152c9,'rows':_0xfb314d}:null;}})['then'](respondWithResult(_0xc74f3f,null))['catch'](handleError(_0xc74f3f,null));};exports['getDescriptions']=function(_0xc6a63a,_0x1bf4c1,_0x1b4bcb){var _0x40c0a8={};var _0x7e2c8={};var _0x18c35f;var _0x5cdc8e;return db[_0xfcf5('0x4c')][_0xfcf5('0x57')]({'where':{'id':_0xc6a63a[_0xfcf5('0x4e')]['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x1bf4c1,null))[_0xfcf5('0x19')](function(_0x4f72c5){if(_0x4f72c5){_0x18c35f=_0x4f72c5;_0x7e2c8['model']=_[_0xfcf5('0x3b')](db[_0xfcf5('0x56')][_0xfcf5('0x36')]);_0x7e2c8[_0xfcf5('0x3a')]=_[_0xfcf5('0x3b')](_0xc6a63a[_0xfcf5('0x3a')]);_0x7e2c8[_0xfcf5('0x3c')]=_[_0xfcf5('0x3d')](_0x7e2c8['model'],_0x7e2c8[_0xfcf5('0x3a')]);_0x40c0a8['attributes']=_[_0xfcf5('0x3d')](_0x7e2c8[_0xfcf5('0x39')],qs[_0xfcf5('0x3f')](_0xc6a63a[_0xfcf5('0x3a')][_0xfcf5('0x3f')]));_0x40c0a8['attributes']=_0x40c0a8[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x40c0a8[_0xfcf5('0x3e')]:_0x7e2c8['model'];_0x40c0a8['order']=qs[_0xfcf5('0x44')](_0xc6a63a[_0xfcf5('0x3a')][_0xfcf5('0x44')]);_0x40c0a8[_0xfcf5('0x47')]=qs['filters'](_[_0xfcf5('0x45')](_0xc6a63a[_0xfcf5('0x3a')],_0x7e2c8['filters']));if(_0xc6a63a[_0xfcf5('0x3a')][_0xfcf5('0x46')]){_0x40c0a8[_0xfcf5('0x47')]=_[_0xfcf5('0x48')](_0x40c0a8['where'],{'$or':_[_0xfcf5('0x35')](_0x40c0a8['attributes'],function(_0x57e9ae){var _0xbd7318={};_0xbd7318[_0x57e9ae]={'$like':'%'+_0xc6a63a['query'][_0xfcf5('0x46')]+'%'};return _0xbd7318;})});}_0x40c0a8=_['merge']({},_0x40c0a8,_0xc6a63a[_0xfcf5('0x4a')]);return _0x18c35f['getDescriptions'](_0x40c0a8);}})[_0xfcf5('0x19')](function(_0x5d5f31){if(_0x5d5f31){_0x5cdc8e=_0x5d5f31['length'];if(!_0xc6a63a['query'][_0xfcf5('0x41')]('nolimit')){_0x40c0a8['limit']=qs[_0xfcf5('0x43')](_0xc6a63a[_0xfcf5('0x3a')][_0xfcf5('0x43')]);_0x40c0a8[_0xfcf5('0x28')]=qs[_0xfcf5('0x28')](_0xc6a63a[_0xfcf5('0x3a')][_0xfcf5('0x28')]);}return _0x18c35f[_0xfcf5('0x58')](_0x40c0a8);}})[_0xfcf5('0x19')](function(_0x94fd23){if(_0x94fd23){return _0x94fd23?{'count':_0x5cdc8e,'rows':_0x94fd23}:null;}})['then'](respondWithResult(_0x1bf4c1,null))[_0xfcf5('0x23')](handleError(_0x1bf4c1,null));};exports[_0xfcf5('0x59')]=function(_0x47290f,_0x4c64db,_0x1b111b){var _0x410f04={};var _0x5a39cb={};var _0x3525f1;var _0x48a1b7;return db[_0xfcf5('0x4c')]['findOne']({'where':{'id':_0x47290f['params']['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x4c64db,null))[_0xfcf5('0x19')](function(_0x5d201b){if(_0x5d201b){_0x3525f1=_0x5d201b;_0x5a39cb[_0xfcf5('0x39')]=_[_0xfcf5('0x3b')](db[_0xfcf5('0x5a')][_0xfcf5('0x36')]);_0x5a39cb[_0xfcf5('0x3a')]=_[_0xfcf5('0x3b')](_0x47290f[_0xfcf5('0x3a')]);_0x5a39cb[_0xfcf5('0x3c')]=_['intersection'](_0x5a39cb[_0xfcf5('0x39')],_0x5a39cb['query']);_0x410f04['attributes']=_['intersection'](_0x5a39cb[_0xfcf5('0x39')],qs[_0xfcf5('0x3f')](_0x47290f[_0xfcf5('0x3a')][_0xfcf5('0x3f')]));_0x410f04[_0xfcf5('0x3e')]=_0x410f04[_0xfcf5('0x3e')][_0xfcf5('0x40')]?_0x410f04[_0xfcf5('0x3e')]:_0x5a39cb['model'];_0x410f04[_0xfcf5('0x54')]=qs[_0xfcf5('0x44')](_0x47290f[_0xfcf5('0x3a')]['sort']);_0x410f04[_0xfcf5('0x47')]=qs[_0xfcf5('0x3c')](_[_0xfcf5('0x45')](_0x47290f['query'],_0x5a39cb['filters']));if(_0x47290f[_0xfcf5('0x3a')][_0xfcf5('0x46')]){_0x410f04[_0xfcf5('0x47')]=_[_0xfcf5('0x48')](_0x410f04[_0xfcf5('0x47')],{'$or':_[_0xfcf5('0x35')](_0x410f04[_0xfcf5('0x3e')],function(_0x399a40){var _0x4d4633={};_0x4d4633[_0x399a40]={'$like':'%'+_0x47290f[_0xfcf5('0x3a')][_0xfcf5('0x46')]+'%'};return _0x4d4633;})});}_0x410f04=_['merge']({},_0x410f04,_0x47290f[_0xfcf5('0x4a')]);return _0x3525f1[_0xfcf5('0x59')](_0x410f04);}})[_0xfcf5('0x19')](function(_0x4c0212){if(_0x4c0212){_0x48a1b7=_0x4c0212[_0xfcf5('0x40')];if(!_0x47290f['query'][_0xfcf5('0x41')](_0xfcf5('0x42'))){_0x410f04[_0xfcf5('0x43')]=qs[_0xfcf5('0x43')](_0x47290f['query'][_0xfcf5('0x43')]);_0x410f04['offset']=qs[_0xfcf5('0x28')](_0x47290f[_0xfcf5('0x3a')]['offset']);}return _0x3525f1[_0xfcf5('0x59')](_0x410f04);}})[_0xfcf5('0x19')](function(_0x8da407){if(_0x8da407){return _0x8da407?{'count':_0x48a1b7,'rows':_0x8da407}:null;}})[_0xfcf5('0x19')](respondWithResult(_0x4c64db,null))['catch'](handleError(_0x4c64db,null));};exports[_0xfcf5('0x5b')]=function(_0x18b757,_0x40d8fc,_0x43fa80){if(_0x18b757[_0xfcf5('0x52')]['id']){delete _0x18b757[_0xfcf5('0x52')]['id'];}return db[_0xfcf5('0x4c')]['findOne']({'where':{'id':_0x18b757[_0xfcf5('0x4e')]['id']}})[_0xfcf5('0x19')](handleEntityNotFound(_0x40d8fc,null))[_0xfcf5('0x19')](function(_0x24e1ee){if(_0x24e1ee){return _0x24e1ee[_0xfcf5('0x5b')](_0x18b757['body'][_0xfcf5('0x5c')]||[]);}return null;})[_0xfcf5('0x19')](respondWithResult(_0x40d8fc,null))['catch'](handleError(_0x40d8fc,null));}; \ No newline at end of file +var _0x9363=['index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','pick','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','params','filters','include','find','create','body','getFields','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','findOne','filter','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send'];(function(_0x4d95aa,_0x5cf888){var _0xdcd571=function(_0x465212){while(--_0x465212){_0x4d95aa['push'](_0x4d95aa['shift']());}};_0xdcd571(++_0x5cf888);}(_0x9363,0x147));var _0x3936=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9363[_0x1cb18a];return _0x22442e;};'use strict';var pdf=require(_0x3936('0x0'));var emlformat=require(_0x3936('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3936('0x2'));var jsonpatch=require(_0x3936('0x3'));var rp=require(_0x3936('0x4'));var moment=require(_0x3936('0x5'));var BPromise=require(_0x3936('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3936('0x7'));var sox=require('sox');var csv=require(_0x3936('0x8'));var ejs=require(_0x3936('0x9'));var fs=require('fs');var _=require(_0x3936('0xa'));var squel=require('squel');var crypto=require(_0x3936('0xb'));var jsforce=require(_0x3936('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3936('0x8'));var querystring=require(_0x3936('0xd'));var Papa=require(_0x3936('0xe'));var Redis=require(_0x3936('0xf'));var authService=require(_0x3936('0x10'));var qs=require(_0x3936('0x11'));var as=require(_0x3936('0x12'));var hardwareService=require(_0x3936('0x13'));var logger=require(_0x3936('0x14'))(_0x3936('0x15'));var utils=require(_0x3936('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3936('0x17'))['db'];var jayson=require(_0x3936('0x18'));var client=jayson[_0x3936('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e43c,_0x333556,_0x5f26d0,_0x495f39){return new BPromise(function(_0x473296,_0x273788){var _0xc2281b=_0x495f39||client;return _0xc2281b[_0x3936('0x1a')](_0x32e43c,_0x5f26d0)['then'](function(_0x28340f){logger[_0x3936('0x1b')](_0x3936('0x1c'),_0x333556,'request\x20sent');logger['debug'](_0x3936('0x1d'),_0x333556,_0x3936('0x1e'),JSON[_0x3936('0x1f')](_0x28340f));if(_0x28340f['error']){if(_0x28340f[_0x3936('0x20')][_0x3936('0x21')]===0x1f4){logger[_0x3936('0x20')](_0x3936('0x1c'),_0x333556,_0x28340f[_0x3936('0x20')]['message']);return _0x273788(_0x28340f[_0x3936('0x20')][_0x3936('0x22')]);}logger['error'](_0x3936('0x1c'),_0x333556,_0x28340f[_0x3936('0x20')][_0x3936('0x22')]);return _0x473296(_0x28340f[_0x3936('0x20')][_0x3936('0x22')]);}else{logger[_0x3936('0x1b')](_0x3936('0x1c'),_0x333556,_0x3936('0x1e'));_0x473296(_0x28340f[_0x3936('0x23')]['message']);}})[_0x3936('0x24')](function(_0x41e493){logger['error'](_0x3936('0x1c'),_0x333556,_0x41e493);_0x273788(_0x41e493);});});}function respondWithStatusCode(_0x28b9bd,_0x4f6ef7){_0x4f6ef7=_0x4f6ef7||0xcc;return function(_0x4ceb48){if(_0x4ceb48){return _0x28b9bd[_0x3936('0x25')](_0x4f6ef7);}return _0x28b9bd[_0x3936('0x26')](_0x4f6ef7)[_0x3936('0x27')]();};}function respondWithResult(_0x5ed25f,_0x33b8f6){_0x33b8f6=_0x33b8f6||0xc8;return function(_0x2d7d73){if(_0x2d7d73){return _0x5ed25f[_0x3936('0x26')](_0x33b8f6)[_0x3936('0x28')](_0x2d7d73);}};}function respondWithFilteredResult(_0x871f3a,_0x548633){return function(_0x9fec20){if(_0x9fec20){var _0x53e03b=_0x9fec20['count'],_0x472013=_0x548633[_0x3936('0x29')],_0x41059d=_0x548633[_0x3936('0x29')]+_0x548633[_0x3936('0x2a')],_0x399660;if(_0x41059d>=_0x53e03b){_0x41059d=_0x53e03b;_0x399660=0xc8;}else{_0x399660=0xce;}_0x871f3a[_0x3936('0x26')](_0x399660);return _0x871f3a[_0x3936('0x2b')](_0x3936('0x2c'),_0x472013+'-'+_0x41059d+'/'+_0x53e03b)[_0x3936('0x28')](_0x9fec20);}return null;};}function patchUpdates(_0x5296a3){return function(_0x53e736){try{jsonpatch[_0x3936('0x2d')](_0x53e736,_0x5296a3,!![]);}catch(_0x5b39ce){return BPromise[_0x3936('0x2e')](_0x5b39ce);}return _0x53e736[_0x3936('0x2f')]();};}function saveUpdates(_0x36e1f5,_0x41e180){return function(_0x28f5ae){if(_0x28f5ae){return _0x28f5ae[_0x3936('0x30')](_0x36e1f5)['then'](function(_0x42f7c7){return _0x42f7c7;});}return null;};}function removeEntity(_0x2ff8d9,_0xb6b490){return function(_0x12cdeb){if(_0x12cdeb){return _0x12cdeb[_0x3936('0x31')]()[_0x3936('0x32')](function(){_0x2ff8d9[_0x3936('0x26')](0xcc)[_0x3936('0x27')]();});}};}function handleEntityNotFound(_0x1fb6da,_0x2a9533){return function(_0x4ec2b9){if(!_0x4ec2b9){_0x1fb6da['sendStatus'](0x194);}return _0x4ec2b9;};}function handleError(_0x4be19f,_0x3b0f8e){_0x3b0f8e=_0x3b0f8e||0x1f4;return function(_0x10b65b){logger[_0x3936('0x20')](_0x10b65b['stack']);if(_0x10b65b[_0x3936('0x33')]){delete _0x10b65b[_0x3936('0x33')];}_0x4be19f[_0x3936('0x26')](_0x3b0f8e)[_0x3936('0x34')](_0x10b65b);};}exports[_0x3936('0x35')]=function(_0x23ed84,_0x1ff735){var _0x34d15b={},_0x5912bf={},_0x50ac70={'count':0x0,'rows':[]};var _0x29e5ea=_[_0x3936('0x36')](db[_0x3936('0x37')][_0x3936('0x38')],function(_0x1dbcc9){return{'name':_0x1dbcc9['fieldName'],'type':_0x1dbcc9[_0x3936('0x39')][_0x3936('0x3a')]};});_0x5912bf[_0x3936('0x3b')]=_[_0x3936('0x36')](_0x29e5ea,_0x3936('0x33'));_0x5912bf[_0x3936('0x3c')]=_[_0x3936('0x3d')](_0x23ed84[_0x3936('0x3c')]);_0x5912bf['filters']=_[_0x3936('0x3e')](_0x5912bf['model'],_0x5912bf[_0x3936('0x3c')]);_0x34d15b['attributes']=_[_0x3936('0x3e')](_0x5912bf['model'],qs[_0x3936('0x3f')](_0x23ed84[_0x3936('0x3c')][_0x3936('0x3f')]));_0x34d15b[_0x3936('0x40')]=_0x34d15b[_0x3936('0x40')][_0x3936('0x41')]?_0x34d15b[_0x3936('0x40')]:_0x5912bf['model'];if(!_0x23ed84[_0x3936('0x3c')]['hasOwnProperty'](_0x3936('0x42'))){_0x34d15b[_0x3936('0x2a')]=qs['limit'](_0x23ed84['query'][_0x3936('0x2a')]);_0x34d15b[_0x3936('0x29')]=qs[_0x3936('0x29')](_0x23ed84[_0x3936('0x3c')][_0x3936('0x29')]);}_0x34d15b['order']=qs['sort'](_0x23ed84[_0x3936('0x3c')][_0x3936('0x43')]);_0x34d15b['where']=qs['filters'](_[_0x3936('0x44')](_0x23ed84[_0x3936('0x3c')],_0x5912bf['filters']),_0x29e5ea);if(_0x23ed84['query']['filter']){_0x34d15b[_0x3936('0x45')]=_['merge'](_0x34d15b[_0x3936('0x45')],{'$or':_['map'](_0x29e5ea,function(_0x157671){if(_0x157671[_0x3936('0x39')]!==_0x3936('0x46')){var _0x1b8844={};_0x1b8844[_0x157671[_0x3936('0x33')]]={'$like':'%'+_0x23ed84['query']['filter']+'%'};return _0x1b8844;}})});}_0x34d15b=_[_0x3936('0x47')]({},_0x34d15b,_0x23ed84[_0x3936('0x48')]);var _0x1aeae1={'where':_0x34d15b[_0x3936('0x45')]};return db[_0x3936('0x37')]['count'](_0x1aeae1)[_0x3936('0x32')](function(_0x1d0f8c){_0x50ac70[_0x3936('0x49')]=_0x1d0f8c;if(_0x23ed84[_0x3936('0x3c')][_0x3936('0x4a')]){_0x34d15b['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x3936('0x4b')](_0x34d15b);})[_0x3936('0x32')](function(_0x50ab60){_0x50ac70[_0x3936('0x4c')]=_0x50ab60;return _0x50ac70;})[_0x3936('0x32')](respondWithFilteredResult(_0x1ff735,_0x34d15b))['catch'](handleError(_0x1ff735,null));};exports['show']=function(_0x407902,_0x5ca593){var _0x3544df={'raw':![],'where':{'id':_0x407902[_0x3936('0x4d')]['id']}},_0x57be6c={};_0x57be6c[_0x3936('0x3b')]=_[_0x3936('0x3d')](db[_0x3936('0x37')][_0x3936('0x38')]);_0x57be6c[_0x3936('0x3c')]=_[_0x3936('0x3d')](_0x407902[_0x3936('0x3c')]);_0x57be6c[_0x3936('0x4e')]=_['intersection'](_0x57be6c[_0x3936('0x3b')],_0x57be6c['query']);_0x3544df[_0x3936('0x40')]=_['intersection'](_0x57be6c[_0x3936('0x3b')],qs['fields'](_0x407902[_0x3936('0x3c')]['fields']));_0x3544df[_0x3936('0x40')]=_0x3544df[_0x3936('0x40')][_0x3936('0x41')]?_0x3544df[_0x3936('0x40')]:_0x57be6c['model'];if(_0x407902['query'][_0x3936('0x4a')]){_0x3544df[_0x3936('0x4f')]=[{'all':!![]}];}_0x3544df=_['merge']({},_0x3544df,_0x407902[_0x3936('0x48')]);return db[_0x3936('0x37')][_0x3936('0x50')](_0x3544df)[_0x3936('0x32')](handleEntityNotFound(_0x5ca593,null))['then'](respondWithResult(_0x5ca593,null))[_0x3936('0x24')](handleError(_0x5ca593,null));};exports[_0x3936('0x51')]=function(_0x4ac234,_0x53eef8){return db['ZendeskConfiguration'][_0x3936('0x51')](_0x4ac234[_0x3936('0x52')],{})['then'](respondWithResult(_0x53eef8,0xc9))[_0x3936('0x24')](handleError(_0x53eef8,null));};exports['update']=function(_0x2ea0b7,_0x3915a8){if(_0x2ea0b7[_0x3936('0x52')]['id']){delete _0x2ea0b7[_0x3936('0x52')]['id'];}return db[_0x3936('0x37')][_0x3936('0x50')]({'where':{'id':_0x2ea0b7[_0x3936('0x4d')]['id']}})[_0x3936('0x32')](handleEntityNotFound(_0x3915a8,null))[_0x3936('0x32')](saveUpdates(_0x2ea0b7[_0x3936('0x52')],null))[_0x3936('0x32')](respondWithResult(_0x3915a8,null))[_0x3936('0x24')](handleError(_0x3915a8,null));};exports[_0x3936('0x31')]=function(_0x59153e,_0x33cb30){return db[_0x3936('0x37')][_0x3936('0x50')]({'where':{'id':_0x59153e[_0x3936('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33cb30,null))[_0x3936('0x32')](removeEntity(_0x33cb30,null))[_0x3936('0x24')](handleError(_0x33cb30,null));};exports[_0x3936('0x53')]=function(_0x40af28,_0x29214c,_0x262888){var _0x312a5b={};var _0x24add3={};var _0x159932;var _0x29a499;return db[_0x3936('0x37')]['findOne']({'where':{'id':_0x40af28[_0x3936('0x4d')]['id']}})[_0x3936('0x32')](handleEntityNotFound(_0x29214c,null))[_0x3936('0x32')](function(_0x151920){if(_0x151920){_0x159932=_0x151920;_0x24add3[_0x3936('0x3b')]=_[_0x3936('0x3d')](db[_0x3936('0x54')][_0x3936('0x38')]);_0x24add3['query']=_[_0x3936('0x3d')](_0x40af28[_0x3936('0x3c')]);_0x24add3[_0x3936('0x4e')]=_[_0x3936('0x3e')](_0x24add3['model'],_0x24add3[_0x3936('0x3c')]);_0x312a5b[_0x3936('0x40')]=_[_0x3936('0x3e')](_0x24add3[_0x3936('0x3b')],qs[_0x3936('0x3f')](_0x40af28[_0x3936('0x3c')][_0x3936('0x3f')]));_0x312a5b[_0x3936('0x40')]=_0x312a5b[_0x3936('0x40')]['length']?_0x312a5b[_0x3936('0x40')]:_0x24add3[_0x3936('0x3b')];_0x312a5b[_0x3936('0x55')]=qs[_0x3936('0x43')](_0x40af28[_0x3936('0x3c')][_0x3936('0x43')]);_0x312a5b[_0x3936('0x45')]=qs[_0x3936('0x4e')](_[_0x3936('0x44')](_0x40af28['query'],_0x24add3[_0x3936('0x4e')]));if(_0x40af28['query']['filter']){_0x312a5b[_0x3936('0x45')]=_[_0x3936('0x47')](_0x312a5b[_0x3936('0x45')],{'$or':_[_0x3936('0x36')](_0x312a5b[_0x3936('0x40')],function(_0x2bbd92){var _0x26a3fc={};_0x26a3fc[_0x2bbd92]={'$like':'%'+_0x40af28[_0x3936('0x3c')]['filter']+'%'};return _0x26a3fc;})});}_0x312a5b=_['merge']({},_0x312a5b,_0x40af28[_0x3936('0x48')]);return _0x159932['getFields'](_0x312a5b);}})['then'](function(_0x256ea5){if(_0x256ea5){_0x29a499=_0x256ea5['length'];if(!_0x40af28[_0x3936('0x3c')][_0x3936('0x56')](_0x3936('0x42'))){_0x312a5b[_0x3936('0x2a')]=qs['limit'](_0x40af28[_0x3936('0x3c')]['limit']);_0x312a5b['offset']=qs[_0x3936('0x29')](_0x40af28[_0x3936('0x3c')]['offset']);}return _0x159932[_0x3936('0x53')](_0x312a5b);}})[_0x3936('0x32')](function(_0x299459){if(_0x299459){return _0x299459?{'count':_0x29a499,'rows':_0x299459}:null;}})[_0x3936('0x32')](respondWithResult(_0x29214c,null))[_0x3936('0x24')](handleError(_0x29214c,null));};exports[_0x3936('0x57')]=function(_0x3ced93,_0x26e464,_0x112558){var _0x410106={};var _0x13ef65={};var _0x582cc9;var _0x442a8a;return db[_0x3936('0x37')]['findOne']({'where':{'id':_0x3ced93[_0x3936('0x4d')]['id']}})[_0x3936('0x32')](handleEntityNotFound(_0x26e464,null))[_0x3936('0x32')](function(_0x5a24b7){if(_0x5a24b7){_0x582cc9=_0x5a24b7;_0x13ef65[_0x3936('0x3b')]=_[_0x3936('0x3d')](db[_0x3936('0x54')][_0x3936('0x38')]);_0x13ef65['query']=_[_0x3936('0x3d')](_0x3ced93[_0x3936('0x3c')]);_0x13ef65[_0x3936('0x4e')]=_['intersection'](_0x13ef65[_0x3936('0x3b')],_0x13ef65['query']);_0x410106[_0x3936('0x40')]=_[_0x3936('0x3e')](_0x13ef65[_0x3936('0x3b')],qs[_0x3936('0x3f')](_0x3ced93[_0x3936('0x3c')][_0x3936('0x3f')]));_0x410106[_0x3936('0x40')]=_0x410106[_0x3936('0x40')][_0x3936('0x41')]?_0x410106[_0x3936('0x40')]:_0x13ef65[_0x3936('0x3b')];_0x410106[_0x3936('0x55')]=qs[_0x3936('0x43')](_0x3ced93[_0x3936('0x3c')][_0x3936('0x43')]);_0x410106[_0x3936('0x45')]=qs[_0x3936('0x4e')](_[_0x3936('0x44')](_0x3ced93[_0x3936('0x3c')],_0x13ef65[_0x3936('0x4e')]));if(_0x3ced93[_0x3936('0x3c')]['filter']){_0x410106[_0x3936('0x45')]=_[_0x3936('0x47')](_0x410106[_0x3936('0x45')],{'$or':_[_0x3936('0x36')](_0x410106[_0x3936('0x40')],function(_0x70cce0){var _0x5b5711={};_0x5b5711[_0x70cce0]={'$like':'%'+_0x3ced93[_0x3936('0x3c')]['filter']+'%'};return _0x5b5711;})});}_0x410106=_['merge']({},_0x410106,_0x3ced93[_0x3936('0x48')]);return _0x582cc9['getSubjects'](_0x410106);}})['then'](function(_0xe36ee4){if(_0xe36ee4){_0x442a8a=_0xe36ee4[_0x3936('0x41')];if(!_0x3ced93[_0x3936('0x3c')][_0x3936('0x56')](_0x3936('0x42'))){_0x410106[_0x3936('0x2a')]=qs[_0x3936('0x2a')](_0x3ced93[_0x3936('0x3c')][_0x3936('0x2a')]);_0x410106['offset']=qs['offset'](_0x3ced93[_0x3936('0x3c')]['offset']);}return _0x582cc9[_0x3936('0x57')](_0x410106);}})[_0x3936('0x32')](function(_0x2368db){if(_0x2368db){return _0x2368db?{'count':_0x442a8a,'rows':_0x2368db}:null;}})[_0x3936('0x32')](respondWithResult(_0x26e464,null))[_0x3936('0x24')](handleError(_0x26e464,null));};exports[_0x3936('0x58')]=function(_0x382896,_0x36931f,_0x2bdfae){var _0x5f08f0={};var _0x39098e={};var _0x47b4f6;var _0x214dee;return db['ZendeskConfiguration'][_0x3936('0x59')]({'where':{'id':_0x382896[_0x3936('0x4d')]['id']}})[_0x3936('0x32')](handleEntityNotFound(_0x36931f,null))[_0x3936('0x32')](function(_0x31f998){if(_0x31f998){_0x47b4f6=_0x31f998;_0x39098e[_0x3936('0x3b')]=_[_0x3936('0x3d')](db['ZendeskField'][_0x3936('0x38')]);_0x39098e[_0x3936('0x3c')]=_[_0x3936('0x3d')](_0x382896['query']);_0x39098e[_0x3936('0x4e')]=_[_0x3936('0x3e')](_0x39098e['model'],_0x39098e[_0x3936('0x3c')]);_0x5f08f0['attributes']=_[_0x3936('0x3e')](_0x39098e[_0x3936('0x3b')],qs['fields'](_0x382896['query'][_0x3936('0x3f')]));_0x5f08f0[_0x3936('0x40')]=_0x5f08f0[_0x3936('0x40')][_0x3936('0x41')]?_0x5f08f0[_0x3936('0x40')]:_0x39098e[_0x3936('0x3b')];_0x5f08f0[_0x3936('0x55')]=qs[_0x3936('0x43')](_0x382896[_0x3936('0x3c')]['sort']);_0x5f08f0[_0x3936('0x45')]=qs[_0x3936('0x4e')](_[_0x3936('0x44')](_0x382896[_0x3936('0x3c')],_0x39098e[_0x3936('0x4e')]));if(_0x382896[_0x3936('0x3c')][_0x3936('0x5a')]){_0x5f08f0[_0x3936('0x45')]=_['merge'](_0x5f08f0[_0x3936('0x45')],{'$or':_[_0x3936('0x36')](_0x5f08f0[_0x3936('0x40')],function(_0x26c889){var _0x219bbe={};_0x219bbe[_0x26c889]={'$like':'%'+_0x382896[_0x3936('0x3c')][_0x3936('0x5a')]+'%'};return _0x219bbe;})});}_0x5f08f0=_[_0x3936('0x47')]({},_0x5f08f0,_0x382896['options']);return _0x47b4f6[_0x3936('0x58')](_0x5f08f0);}})[_0x3936('0x32')](function(_0x4da759){if(_0x4da759){_0x214dee=_0x4da759['length'];if(!_0x382896['query']['hasOwnProperty']('nolimit')){_0x5f08f0[_0x3936('0x2a')]=qs[_0x3936('0x2a')](_0x382896[_0x3936('0x3c')]['limit']);_0x5f08f0[_0x3936('0x29')]=qs[_0x3936('0x29')](_0x382896['query'][_0x3936('0x29')]);}return _0x47b4f6['getDescriptions'](_0x5f08f0);}})['then'](function(_0x1277b0){if(_0x1277b0){return _0x1277b0?{'count':_0x214dee,'rows':_0x1277b0}:null;}})[_0x3936('0x32')](respondWithResult(_0x36931f,null))[_0x3936('0x24')](handleError(_0x36931f,null));};exports[_0x3936('0x5b')]=function(_0x40cb7a,_0x1fe54d,_0x5c5a82){var _0xd23977={};var _0x1d8804={};var _0x4a9102;var _0x244122;return db[_0x3936('0x37')]['findOne']({'where':{'id':_0x40cb7a[_0x3936('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1fe54d,null))[_0x3936('0x32')](function(_0x57a799){if(_0x57a799){_0x4a9102=_0x57a799;_0x1d8804['model']=_['keys'](db[_0x3936('0x5c')]['rawAttributes']);_0x1d8804[_0x3936('0x3c')]=_[_0x3936('0x3d')](_0x40cb7a['query']);_0x1d8804['filters']=_['intersection'](_0x1d8804[_0x3936('0x3b')],_0x1d8804[_0x3936('0x3c')]);_0xd23977[_0x3936('0x40')]=_['intersection'](_0x1d8804[_0x3936('0x3b')],qs[_0x3936('0x3f')](_0x40cb7a['query'][_0x3936('0x3f')]));_0xd23977[_0x3936('0x40')]=_0xd23977[_0x3936('0x40')][_0x3936('0x41')]?_0xd23977[_0x3936('0x40')]:_0x1d8804['model'];_0xd23977[_0x3936('0x55')]=qs[_0x3936('0x43')](_0x40cb7a[_0x3936('0x3c')]['sort']);_0xd23977[_0x3936('0x45')]=qs[_0x3936('0x4e')](_[_0x3936('0x44')](_0x40cb7a[_0x3936('0x3c')],_0x1d8804[_0x3936('0x4e')]));if(_0x40cb7a[_0x3936('0x3c')][_0x3936('0x5a')]){_0xd23977[_0x3936('0x45')]=_[_0x3936('0x47')](_0xd23977[_0x3936('0x45')],{'$or':_[_0x3936('0x36')](_0xd23977[_0x3936('0x40')],function(_0x5bcf9a){var _0x4911e6={};_0x4911e6[_0x5bcf9a]={'$like':'%'+_0x40cb7a[_0x3936('0x3c')][_0x3936('0x5a')]+'%'};return _0x4911e6;})});}_0xd23977=_['merge']({},_0xd23977,_0x40cb7a[_0x3936('0x48')]);return _0x4a9102[_0x3936('0x5b')](_0xd23977);}})['then'](function(_0x52f0cf){if(_0x52f0cf){_0x244122=_0x52f0cf['length'];if(!_0x40cb7a[_0x3936('0x3c')][_0x3936('0x56')](_0x3936('0x42'))){_0xd23977[_0x3936('0x2a')]=qs['limit'](_0x40cb7a[_0x3936('0x3c')][_0x3936('0x2a')]);_0xd23977[_0x3936('0x29')]=qs[_0x3936('0x29')](_0x40cb7a[_0x3936('0x3c')][_0x3936('0x29')]);}return _0x4a9102['getTags'](_0xd23977);}})[_0x3936('0x32')](function(_0x5ed99e){if(_0x5ed99e){return _0x5ed99e?{'count':_0x244122,'rows':_0x5ed99e}:null;}})[_0x3936('0x32')](respondWithResult(_0x1fe54d,null))[_0x3936('0x24')](handleError(_0x1fe54d,null));};exports['setTags']=function(_0x189f50,_0x514d4d,_0x531230){if(_0x189f50['body']['id']){delete _0x189f50[_0x3936('0x52')]['id'];}return db[_0x3936('0x37')][_0x3936('0x59')]({'where':{'id':_0x189f50[_0x3936('0x4d')]['id']}})[_0x3936('0x32')](handleEntityNotFound(_0x514d4d,null))[_0x3936('0x32')](function(_0x42fd17){if(_0x42fd17){return _0x42fd17[_0x3936('0x5d')](_0x189f50['body'][_0x3936('0x5e')]||[]);}return null;})[_0x3936('0x32')](respondWithResult(_0x514d4d,null))[_0x3936('0x24')](handleError(_0x514d4d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 673de96..183a0b4 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 _0x20e5=['lodash','../../config/logger','api','moment','request-promise','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x20e5,0xbb));var _0x520e=function(_0x81b88e,_0x3d5378){_0x81b88e=_0x81b88e-0x0;var _0x1f21c7=_0x20e5[_0x81b88e];return _0x1f21c7;};'use strict';var _=require(_0x520e('0x0'));var util=require('util');var logger=require(_0x520e('0x1'))(_0x520e('0x2'));var moment=require(_0x520e('0x3'));var BPromise=require('bluebird');var rp=require(_0x520e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x520e('0x5'));var config=require('../../config/environment');var attributes=require(_0x520e('0x6'));module[_0x520e('0x7')]=function(_0x225dcf,_0x4d5d66){return _0x225dcf[_0x520e('0x8')](_0x520e('0x9'),attributes,{'tableName':_0x520e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0867=['exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','path'];(function(_0x53377b,_0x166f23){var _0x39cba9=function(_0x4be07d){while(--_0x4be07d){_0x53377b['push'](_0x53377b['shift']());}};_0x39cba9(++_0x166f23);}(_0x0867,0x1cc));var _0x7086=function(_0x11d2ff,_0x338a73){_0x11d2ff=_0x11d2ff-0x0;var _0x1a25da=_0x0867[_0x11d2ff];return _0x1a25da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7086('0x0'))(_0x7086('0x1'));var moment=require(_0x7086('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7086('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x7086('0x4')]=function(_0x183299,_0x533a58){return _0x183299[_0x7086('0x5')](_0x7086('0x6'),attributes,{'tableName':_0x7086('0x7'),'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 6516b41..31bc567 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 _0x50c4=['ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48845c,_0x3d24b8){var _0x56c202=function(_0x236d44){while(--_0x236d44){_0x48845c['push'](_0x48845c['shift']());}};_0x56c202(++_0x3d24b8);}(_0x50c4,0x16d));var _0x450c=function(_0x254761,_0x550307){_0x254761=_0x254761-0x0;var _0x4236de=_0x50c4[_0x254761];return _0x4236de;};'use strict';var _=require(_0x450c('0x0'));var util=require('util');var moment=require(_0x450c('0x1'));var BPromise=require('bluebird');var rs=require(_0x450c('0x2'));var fs=require('fs');var Redis=require(_0x450c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x450c('0x4'));var logger=require(_0x450c('0x5'))(_0x450c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x450c('0x7')][_0x450c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x366fbb,_0x1f8f2b,_0x8f3a30){return new BPromise(function(_0x179e4a,_0x3c444a){return client['request'](_0x366fbb,_0x8f3a30)[_0x450c('0x9')](function(_0x5c83fd){logger[_0x450c('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f8f2b,'request\x20sent');logger[_0x450c('0xb')](_0x450c('0xc'),_0x1f8f2b,'request\x20sent',JSON['stringify'](_0x5c83fd));if(_0x5c83fd[_0x450c('0xd')]){if(_0x5c83fd[_0x450c('0xd')][_0x450c('0xe')]===0x1f4){logger[_0x450c('0xd')](_0x450c('0xf'),_0x1f8f2b,_0x5c83fd[_0x450c('0xd')][_0x450c('0x10')]);return _0x3c444a(_0x5c83fd[_0x450c('0xd')][_0x450c('0x10')]);}logger[_0x450c('0xd')](_0x450c('0xf'),_0x1f8f2b,_0x5c83fd[_0x450c('0xd')][_0x450c('0x10')]);return _0x179e4a(_0x5c83fd[_0x450c('0xd')][_0x450c('0x10')]);}else{logger[_0x450c('0xa')](_0x450c('0xf'),_0x1f8f2b,_0x450c('0x11'));_0x179e4a(_0x5c83fd[_0x450c('0x12')][_0x450c('0x10')]);}})['catch'](function(_0x14ffe6){logger[_0x450c('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f8f2b,_0x14ffe6);_0x3c444a(_0x14ffe6);});});} \ No newline at end of file +var _0x970e=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3829ba,_0x20649d){var _0x202277=function(_0x53536c){while(--_0x53536c){_0x3829ba['push'](_0x3829ba['shift']());}};_0x202277(++_0x20649d);}(_0x970e,0x132));var _0xe970=function(_0x51e638,_0x23b710){_0x51e638=_0x51e638-0x0;var _0x2de955=_0x970e[_0x51e638];return _0x2de955;};'use strict';var _=require(_0xe970('0x0'));var util=require(_0xe970('0x1'));var moment=require(_0xe970('0x2'));var BPromise=require(_0xe970('0x3'));var rs=require(_0xe970('0x4'));var fs=require('fs');var Redis=require(_0xe970('0x5'));var db=require(_0xe970('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe970('0x7'))('rpc');var config=require(_0xe970('0x8'));var jayson=require(_0xe970('0x9'));var client=jayson['client'][_0xe970('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55d74c,_0xabfb1d,_0x4007e1){return new BPromise(function(_0x5a47be,_0x569404){return client[_0xe970('0xb')](_0x55d74c,_0x4007e1)[_0xe970('0xc')](function(_0x35a18d){logger[_0xe970('0xd')](_0xe970('0xe'),_0xabfb1d,_0xe970('0xf'));logger[_0xe970('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xabfb1d,'request\x20sent',JSON['stringify'](_0x35a18d));if(_0x35a18d[_0xe970('0x11')]){if(_0x35a18d['error'][_0xe970('0x12')]===0x1f4){logger[_0xe970('0x11')](_0xe970('0xe'),_0xabfb1d,_0x35a18d[_0xe970('0x11')][_0xe970('0x13')]);return _0x569404(_0x35a18d['error']['message']);}logger[_0xe970('0x11')](_0xe970('0xe'),_0xabfb1d,_0x35a18d[_0xe970('0x11')][_0xe970('0x13')]);return _0x5a47be(_0x35a18d[_0xe970('0x11')][_0xe970('0x13')]);}else{logger[_0xe970('0xd')](_0xe970('0xe'),_0xabfb1d,_0xe970('0xf'));_0x5a47be(_0x35a18d['result'][_0xe970('0x13')]);}})['catch'](function(_0x441583){logger['error'](_0xe970('0xe'),_0xabfb1d,_0x441583);_0x569404(_0x441583);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e3314d5..2c9d70e 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 _0x14cc=['exports','multer','util','path','connect-timeout','express','Router','./intZendeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy'];(function(_0x435348,_0x617493){var _0x35d479=function(_0x17b1af){while(--_0x17b1af){_0x435348['push'](_0x435348['shift']());}};_0x35d479(++_0x617493);}(_0x14cc,0x17b));var _0xc14c=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x14cc[_0x2fd69d];return _0x5d5ef3;};'use strict';var multer=require(_0xc14c('0x0'));var util=require(_0xc14c('0x1'));var path=require(_0xc14c('0x2'));var timeout=require(_0xc14c('0x3'));var express=require(_0xc14c('0x4'));var router=express[_0xc14c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc14c('0x6'));router[_0xc14c('0x7')]('/',auth[_0xc14c('0x8')](),controller[_0xc14c('0x9')]);router[_0xc14c('0x7')]('/:id',auth[_0xc14c('0x8')](),controller[_0xc14c('0xa')]);router[_0xc14c('0xb')]('/',auth[_0xc14c('0x8')](),controller['create']);router[_0xc14c('0xc')](_0xc14c('0xd'),auth[_0xc14c('0x8')](),controller[_0xc14c('0xe')]);router[_0xc14c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc14c('0x10')]);module[_0xc14c('0x11')]=router; \ No newline at end of file +var _0x15a4=['util','express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x52a750,_0x3d7274){var _0x4feb54=function(_0x1ece15){while(--_0x1ece15){_0x52a750['push'](_0x52a750['shift']());}};_0x4feb54(++_0x3d7274);}(_0x15a4,0x10d));var _0x415a=function(_0x35e779,_0x366e51){_0x35e779=_0x35e779-0x0;var _0x5446a8=_0x15a4[_0x35e779];return _0x5446a8;};'use strict';var multer=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x415a('0x2'));var router=express[_0x415a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x415a('0x4'));var config=require(_0x415a('0x5'));var controller=require(_0x415a('0x6'));router[_0x415a('0x7')]('/',auth[_0x415a('0x8')](),controller[_0x415a('0x9')]);router[_0x415a('0x7')](_0x415a('0xa'),auth[_0x415a('0x8')](),controller['show']);router[_0x415a('0xb')]('/',auth[_0x415a('0x8')](),controller[_0x415a('0xc')]);router[_0x415a('0xd')](_0x415a('0xa'),auth['isAuthenticated'](),controller[_0x415a('0xe')]);router[_0x415a('0xf')]('/:id',auth[_0x415a('0x8')](),controller[_0x415a('0x10')]);module[_0x415a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7347a96..2b11e70 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 _0x1306=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x501fe6,_0xb74e75){var _0x2262da=function(_0x5e8584){while(--_0x5e8584){_0x501fe6['push'](_0x501fe6['shift']());}};_0x2262da(++_0xb74e75);}(_0x1306,0x17a));var _0x6130=function(_0x573289,_0x3379d0){_0x573289=_0x573289-0x0;var _0x44b4a2=_0x1306[_0x573289];return _0x44b4a2;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'type':{'type':Sequelize[_0x6130('0x2')](_0x6130('0x3'),_0x6130('0x4'),_0x6130('0x5'),_0x6130('0x6'),_0x6130('0x7')),'defaultValue':_0x6130('0x3')},'content':{'type':Sequelize[_0x6130('0x8')]},'key':{'type':Sequelize[_0x6130('0x8')]},'keyType':{'type':Sequelize[_0x6130('0x2')](_0x6130('0x3'),_0x6130('0x4'),_0x6130('0x5'))},'keyContent':{'type':Sequelize[_0x6130('0x8')]},'idField':{'type':Sequelize[_0x6130('0x8')]},'nameField':{'type':Sequelize[_0x6130('0x8')]},'customField':{'type':Sequelize[_0x6130('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6130('0x8')]}}; \ No newline at end of file +var _0x6c32=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x7bb86e,_0x54a3df){var _0x5b4b26=function(_0x22ad41){while(--_0x22ad41){_0x7bb86e['push'](_0x7bb86e['shift']());}};_0x5b4b26(++_0x54a3df);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'type':{'type':Sequelize[_0x26c3('0x2')](_0x26c3('0x3'),_0x26c3('0x4'),_0x26c3('0x5'),_0x26c3('0x6'),_0x26c3('0x7')),'defaultValue':_0x26c3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x26c3('0x8')]},'keyType':{'type':Sequelize[_0x26c3('0x2')](_0x26c3('0x3'),'variable',_0x26c3('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x26c3('0x8')]},'nameField':{'type':Sequelize[_0x26c3('0x8')]},'customField':{'type':Sequelize[_0x26c3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26c3('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b21ad19..8132c16 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 _0x8e3f=['count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','include','create','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x4ad0be,_0x522417){var _0x15bb73=function(_0xafe5a4){while(--_0xafe5a4){_0x4ad0be['push'](_0x4ad0be['shift']());}};_0x15bb73(++_0x522417);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xf8e3('0x0'));var emlformat=require(_0xf8e3('0x1'));var rimraf=require(_0xf8e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8e3('0x3'));var rp=require(_0xf8e3('0x4'));var moment=require(_0xf8e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8e3('0x6'));var util=require(_0xf8e3('0x7'));var path=require('path');var sox=require(_0xf8e3('0x8'));var csv=require(_0xf8e3('0x9'));var ejs=require(_0xf8e3('0xa'));var fs=require('fs');var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x9'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=_0x460629[_0xf8e3('0x1d')],_0x529c92=_0x40c196[_0xf8e3('0x1e')],_0x564f43=_0x40c196[_0xf8e3('0x1e')]+_0x40c196[_0xf8e3('0x1f')],_0x385dde;if(_0x564f43>=_0x570ee3){_0x564f43=_0x570ee3;_0x385dde=0xc8;}else{_0x385dde=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x385dde);return _0x1ec773[_0xf8e3('0x20')](_0xf8e3('0x21'),_0x529c92+'-'+_0x564f43+'/'+_0x570ee3)[_0xf8e3('0x22')](_0x460629);}return null;};}function patchUpdates(_0x59779f){return function(_0x20cc64){try{jsonpatch[_0xf8e3('0x23')](_0x20cc64,_0x59779f,!![]);}catch(_0x24e8d6){return BPromise[_0xf8e3('0x24')](_0x24e8d6);}return _0x20cc64[_0xf8e3('0x25')]();};}function saveUpdates(_0x11c58e,_0x1cae53){return function(_0x3fff85){if(_0x3fff85){return _0x3fff85['update'](_0x11c58e)[_0xf8e3('0x26')](function(_0x1351ca){return _0x1351ca;});}return null;};}function removeEntity(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')]()['then'](function(){_0x3c636d[_0xf8e3('0x1c')](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x33d526,_0x2dc856){return function(_0x1f4b68){if(!_0x1f4b68){_0x33d526[_0xf8e3('0x1a')](0x194);}return _0x1f4b68;};}function handleError(_0x512a83,_0x1b922f){_0x1b922f=_0x1b922f||0x1f4;return function(_0x2fc674){logger[_0xf8e3('0x28')](_0x2fc674[_0xf8e3('0x29')]);if(_0x2fc674[_0xf8e3('0x2a')]){delete _0x2fc674[_0xf8e3('0x2a')];}_0x512a83[_0xf8e3('0x1c')](_0x1b922f)[_0xf8e3('0x2b')](_0x2fc674);};}exports['index']=function(_0x356e0a,_0x3d5a27){var _0x12ebd2={},_0xc4f21a={},_0x15b28c={'count':0x0,'rows':[]};var _0x14cb5a=_[_0xf8e3('0x2c')](db[_0xf8e3('0x2d')]['rawAttributes'],function(_0x21e1c0){return{'name':_0x21e1c0[_0xf8e3('0x2e')],'type':_0x21e1c0[_0xf8e3('0x2f')][_0xf8e3('0x30')]};});_0xc4f21a['model']=_[_0xf8e3('0x2c')](_0x14cb5a,_0xf8e3('0x2a'));_0xc4f21a[_0xf8e3('0x31')]=_[_0xf8e3('0x32')](_0x356e0a[_0xf8e3('0x31')]);_0xc4f21a[_0xf8e3('0x33')]=_[_0xf8e3('0x34')](_0xc4f21a[_0xf8e3('0x35')],_0xc4f21a['query']);_0x12ebd2[_0xf8e3('0x36')]=_[_0xf8e3('0x34')](_0xc4f21a['model'],qs['fields'](_0x356e0a['query'][_0xf8e3('0x37')]));_0x12ebd2['attributes']=_0x12ebd2[_0xf8e3('0x36')][_0xf8e3('0x38')]?_0x12ebd2[_0xf8e3('0x36')]:_0xc4f21a[_0xf8e3('0x35')];if(!_0x356e0a['query']['hasOwnProperty'](_0xf8e3('0x39'))){_0x12ebd2[_0xf8e3('0x1f')]=qs[_0xf8e3('0x1f')](_0x356e0a[_0xf8e3('0x31')][_0xf8e3('0x1f')]);_0x12ebd2[_0xf8e3('0x1e')]=qs['offset'](_0x356e0a[_0xf8e3('0x31')]['offset']);}_0x12ebd2['order']=qs[_0xf8e3('0x3a')](_0x356e0a[_0xf8e3('0x31')][_0xf8e3('0x3a')]);_0x12ebd2[_0xf8e3('0x3b')]=qs['filters'](_['pick'](_0x356e0a[_0xf8e3('0x31')],_0xc4f21a[_0xf8e3('0x33')]),_0x14cb5a);if(_0x356e0a['query'][_0xf8e3('0x3c')]){_0x12ebd2[_0xf8e3('0x3b')]=_[_0xf8e3('0x3d')](_0x12ebd2[_0xf8e3('0x3b')],{'$or':_['map'](_0x14cb5a,function(_0x53cfea){if(_0x53cfea['type']!==_0xf8e3('0x3e')){var _0xcd2ffe={};_0xcd2ffe[_0x53cfea[_0xf8e3('0x2a')]]={'$like':'%'+_0x356e0a[_0xf8e3('0x31')]['filter']+'%'};return _0xcd2ffe;}})});}_0x12ebd2=_[_0xf8e3('0x3d')]({},_0x12ebd2,_0x356e0a['options']);var _0x20909b={'where':_0x12ebd2[_0xf8e3('0x3b')]};return db[_0xf8e3('0x2d')][_0xf8e3('0x1d')](_0x20909b)[_0xf8e3('0x26')](function(_0x34a6ba){_0x15b28c[_0xf8e3('0x1d')]=_0x34a6ba;if(_0x356e0a[_0xf8e3('0x31')][_0xf8e3('0x3f')]){_0x12ebd2['include']=[{'all':!![]}];}return db[_0xf8e3('0x2d')]['findAll'](_0x12ebd2);})[_0xf8e3('0x26')](function(_0x1e8917){_0x15b28c[_0xf8e3('0x40')]=_0x1e8917;return _0x15b28c;})[_0xf8e3('0x26')](respondWithFilteredResult(_0x3d5a27,_0x12ebd2))[_0xf8e3('0x41')](handleError(_0x3d5a27,null));};exports[_0xf8e3('0x42')]=function(_0x2faf92,_0x2f05b7){var _0x571ea5={'raw':!![],'where':{'id':_0x2faf92[_0xf8e3('0x43')]['id']}},_0x302d03={};_0x302d03[_0xf8e3('0x35')]=_[_0xf8e3('0x32')](db[_0xf8e3('0x2d')][_0xf8e3('0x44')]);_0x302d03[_0xf8e3('0x31')]=_[_0xf8e3('0x32')](_0x2faf92['query']);_0x302d03['filters']=_['intersection'](_0x302d03[_0xf8e3('0x35')],_0x302d03[_0xf8e3('0x31')]);_0x571ea5['attributes']=_[_0xf8e3('0x34')](_0x302d03['model'],qs[_0xf8e3('0x37')](_0x2faf92[_0xf8e3('0x31')]['fields']));_0x571ea5[_0xf8e3('0x36')]=_0x571ea5['attributes'][_0xf8e3('0x38')]?_0x571ea5[_0xf8e3('0x36')]:_0x302d03['model'];if(_0x2faf92[_0xf8e3('0x31')][_0xf8e3('0x3f')]){_0x571ea5[_0xf8e3('0x45')]=[{'all':!![]}];}_0x571ea5=_[_0xf8e3('0x3d')]({},_0x571ea5,_0x2faf92['options']);return db['ZendeskField']['find'](_0x571ea5)[_0xf8e3('0x26')](handleEntityNotFound(_0x2f05b7,null))[_0xf8e3('0x26')](respondWithResult(_0x2f05b7,null))[_0xf8e3('0x41')](handleError(_0x2f05b7,null));};exports['create']=function(_0x3258ef,_0x4bced6){return db[_0xf8e3('0x2d')][_0xf8e3('0x46')](_0x3258ef['body'],{})['then'](respondWithResult(_0x4bced6,0xc9))[_0xf8e3('0x41')](handleError(_0x4bced6,null));};exports[_0xf8e3('0x47')]=function(_0x1522ad,_0x364f69){if(_0x1522ad[_0xf8e3('0x48')]['id']){delete _0x1522ad[_0xf8e3('0x48')]['id'];}return db[_0xf8e3('0x2d')][_0xf8e3('0x49')]({'where':{'id':_0x1522ad[_0xf8e3('0x43')]['id']}})[_0xf8e3('0x26')](handleEntityNotFound(_0x364f69,null))[_0xf8e3('0x26')](saveUpdates(_0x1522ad['body'],null))[_0xf8e3('0x26')](respondWithResult(_0x364f69,null))[_0xf8e3('0x41')](handleError(_0x364f69,null));};exports[_0xf8e3('0x27')]=function(_0x458188,_0x385a8f){return db[_0xf8e3('0x2d')]['find']({'where':{'id':_0x458188[_0xf8e3('0x43')]['id']}})[_0xf8e3('0x26')](handleEntityNotFound(_0x385a8f,null))[_0xf8e3('0x26')](removeEntity(_0x385a8f,null))[_0xf8e3('0x41')](handleError(_0x385a8f,null));}; \ No newline at end of file +var _0x524e=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x419aac,_0x6a2e9e){var _0x33b9b0=function(_0x283866){while(--_0x283866){_0x419aac['push'](_0x419aac['shift']());}};_0x33b9b0(++_0x6a2e9e);}(_0x524e,0x15e));var _0xe524=function(_0x328466,_0x392433){_0x328466=_0x328466-0x0;var _0x3bc42f=_0x524e[_0x328466];return _0x3bc42f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['ZendeskField'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['ZendeskField'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5da734e..aee87c2 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 _0xa45c=['util','moment','request-promise','rimraf','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x1826fd,_0x26bed5){var _0x531c88=function(_0x51b060){while(--_0x51b060){_0x1826fd['push'](_0x1826fd['shift']());}};_0x531c88(++_0x26bed5);}(_0xa45c,0x6d));var _0xca45=function(_0x4f2bc0,_0x1f0c39){_0x4f2bc0=_0x4f2bc0-0x0;var _0x57c8d7=_0xa45c[_0x4f2bc0];return _0x57c8d7;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca45('0x2'));var BPromise=require('bluebird');var rp=require(_0xca45('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca45('0x4'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xca45('0x5')]=function(_0x3803d6,_0x18d789){return _0x3803d6[_0xca45('0x6')]('ZendeskField',attributes,{'tableName':_0xca45('0x7'),'paranoid':![],'indexes':[{'name':_0xca45('0x8'),'fields':[_0xca45('0x9'),_0xca45('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb67f=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb67f,0x12d));var _0xfb67=function(_0x28b2d7,_0x105d51){_0x28b2d7=_0x28b2d7-0x0;var _0x4e9477=_0xb67f[_0x28b2d7];return _0x4e9477;};'use strict';var _=require('lodash');var util=require(_0xfb67('0x0'));var logger=require(_0xfb67('0x1'))(_0xfb67('0x2'));var moment=require(_0xfb67('0x3'));var BPromise=require(_0xfb67('0x4'));var rp=require(_0xfb67('0x5'));var fs=require('fs');var path=require(_0xfb67('0x6'));var rimraf=require(_0xfb67('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb67('0x8'));module[_0xfb67('0x9')]=function(_0x2dc6bf,_0x43bc06){return _0x2dc6bf[_0xfb67('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xfb67('0xb'),_0xfb67('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 99ce80b..fc4b33d 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 _0x5279=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x5279,0x1e7));var _0x9527=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x5279[_0x53b53e];return _0xbb6179;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var moment=require(_0x9527('0x2'));var BPromise=require(_0x9527('0x3'));var rs=require(_0x9527('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9527('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9527('0x6'))('rpc');var config=require(_0x9527('0x7'));var jayson=require(_0x9527('0x8'));var client=jayson[_0x9527('0x9')][_0x9527('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40268,_0x3b9775,_0x1cb0d3){return new BPromise(function(_0x4910f1,_0x57b853){return client['request'](_0x40268,_0x1cb0d3)[_0x9527('0xb')](function(_0x8705ff){logger['info'](_0x9527('0xc'),_0x3b9775,'request\x20sent');logger[_0x9527('0xd')](_0x9527('0xe'),_0x3b9775,_0x9527('0xf'),JSON[_0x9527('0x10')](_0x8705ff));if(_0x8705ff[_0x9527('0x11')]){if(_0x8705ff[_0x9527('0x11')][_0x9527('0x12')]===0x1f4){logger[_0x9527('0x11')](_0x9527('0xc'),_0x3b9775,_0x8705ff[_0x9527('0x11')][_0x9527('0x13')]);return _0x57b853(_0x8705ff['error'][_0x9527('0x13')]);}logger['error'](_0x9527('0xc'),_0x3b9775,_0x8705ff[_0x9527('0x11')][_0x9527('0x13')]);return _0x4910f1(_0x8705ff['error']['message']);}else{logger[_0x9527('0x14')](_0x9527('0xc'),_0x3b9775,_0x9527('0xf'));_0x4910f1(_0x8705ff[_0x9527('0x15')]['message']);}})[_0x9527('0x16')](function(_0x4264d9){logger[_0x9527('0x11')](_0x9527('0xc'),_0x3b9775,_0x4264d9);_0x57b853(_0x4264d9);});});} \ No newline at end of file +var _0x88a6=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskField,\x20%s,\x20%s','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3f0c4a,_0x139e5b){var _0x146e60=function(_0x4b6edc){while(--_0x4b6edc){_0x3f0c4a['push'](_0x3f0c4a['shift']());}};_0x146e60(++_0x139e5b);}(_0x88a6,0x1ea));var _0x688a=function(_0x44cca6,_0x5e9271){_0x44cca6=_0x44cca6-0x0;var _0x175d04=_0x88a6[_0x44cca6];return _0x175d04;};'use strict';var _=require(_0x688a('0x0'));var util=require('util');var moment=require(_0x688a('0x1'));var BPromise=require('bluebird');var rs=require(_0x688a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x688a('0x3'))['db'];var utils=require(_0x688a('0x4'));var logger=require(_0x688a('0x5'))(_0x688a('0x6'));var config=require(_0x688a('0x7'));var jayson=require(_0x688a('0x8'));var client=jayson[_0x688a('0x9')][_0x688a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xde74f3,_0x3b1818,_0x27bf42){return new BPromise(function(_0x1d74f2,_0x3517c8){return client[_0x688a('0xb')](_0xde74f3,_0x27bf42)[_0x688a('0xc')](function(_0x9b023b){logger[_0x688a('0xd')]('ZendeskField,\x20%s,\x20%s',_0x3b1818,_0x688a('0xe'));logger[_0x688a('0xf')](_0x688a('0x10'),_0x3b1818,'request\x20sent',JSON[_0x688a('0x11')](_0x9b023b));if(_0x9b023b[_0x688a('0x12')]){if(_0x9b023b[_0x688a('0x12')]['code']===0x1f4){logger[_0x688a('0x12')](_0x688a('0x13'),_0x3b1818,_0x9b023b[_0x688a('0x12')][_0x688a('0x14')]);return _0x3517c8(_0x9b023b['error'][_0x688a('0x14')]);}logger[_0x688a('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b1818,_0x9b023b['error'][_0x688a('0x14')]);return _0x1d74f2(_0x9b023b[_0x688a('0x12')][_0x688a('0x14')]);}else{logger['info'](_0x688a('0x13'),_0x3b1818,'request\x20sent');_0x1d74f2(_0x9b023b[_0x688a('0x15')][_0x688a('0x14')]);}})['catch'](function(_0x3c948d){logger[_0x688a('0x12')](_0x688a('0x13'),_0x3b1818,_0x3c948d);_0x3517c8(_0x3c948d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a1ca5de..b732557 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x5bafc7,_0x1eb7bc){var _0x16e28a=function(_0x36f71a){while(--_0x36f71a){_0x5bafc7['push'](_0x5bafc7['shift']());}};_0x16e28a(++_0x1eb7bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x4cde20,_0x32e60b){var _0x14e22d=function(_0x4e1a3b){while(--_0x4e1a3b){_0x4cde20['push'](_0x4cde20['shift']());}};_0x14e22d(++_0x32e60b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e260d1b..115b2f2 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 _0xd5a7=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd5a7,0x67));var _0x7d5a=function(_0x519ad6,_0x338d02){_0x519ad6=_0x519ad6-0x0;var _0xc23af6=_0xd5a7[_0x519ad6];return _0xc23af6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7d5a('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x7d5a('0x0')]},'clientSecret':{'type':Sequelize[_0x7d5a('0x0')]},'serverUrl':{'type':Sequelize[_0x7d5a('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x7d5a('0x0')]},'refreshToken':{'type':Sequelize[_0x7d5a('0x0')]}}; \ No newline at end of file +var _0xa850=['sequelize','exports','STRING'];(function(_0x4b3f8c,_0x540611){var _0x4ac233=function(_0x2da294){while(--_0x2da294){_0x4b3f8c['push'](_0x4b3f8c['shift']());}};_0x4ac233(++_0x540611);}(_0xa850,0x1b3));var _0x0a85=function(_0x5397fe,_0x5b35f5){_0x5397fe=_0x5397fe-0x0;var _0x1f375e=_0xa850[_0x5397fe];return _0x1f375e;};'use strict';var Sequelize=require(_0x0a85('0x0'));module[_0x0a85('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0a85('0x2')]},'host':{'type':Sequelize[_0x0a85('0x2')]},'zone':{'type':Sequelize[_0x0a85('0x2')]},'clientId':{'type':Sequelize[_0x0a85('0x2')]},'clientSecret':{'type':Sequelize[_0x0a85('0x2')]},'serverUrl':{'type':Sequelize[_0x0a85('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a85('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6ad38bd..1c20d4c 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 _0xd98a=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','index','ZohoAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','rows','show','params','rawAttributes','length','include','create','body','find','filter','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','clientSecret','com','serverUrl','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x2187ce,_0x23bf9c){var _0x27858f=function(_0xe02c2f){while(--_0xe02c2f){_0x2187ce['push'](_0x2187ce['shift']());}};_0x27858f(++_0x23bf9c);}(_0xd98a,0xfc));var _0xad98=function(_0x5a0af1,_0x50e73b){_0x5a0af1=_0x5a0af1-0x0;var _0x456e76=_0xd98a[_0x5a0af1];return _0x456e76;};'use strict';var pdf=require(_0xad98('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad98('0x1'));var jsonpatch=require(_0xad98('0x2'));var rp=require(_0xad98('0x3'));var moment=require(_0xad98('0x4'));var BPromise=require(_0xad98('0x5'));var Mustache=require(_0xad98('0x6'));var util=require('util');var path=require('path');var sox=require(_0xad98('0x7'));var csv=require(_0xad98('0x8'));var ejs=require(_0xad98('0x9'));var fs=require('fs');var _=require(_0xad98('0xa'));var squel=require(_0xad98('0xb'));var crypto=require('crypto');var jsforce=require(_0xad98('0xc'));var deskjs=require(_0xad98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xad98('0xe'));var Papa=require('papaparse');var Redis=require(_0xad98('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad98('0x10'));var logger=require(_0xad98('0x11'))(_0xad98('0x12'));var utils=require(_0xad98('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad98('0x14'))['db'];var integrations=require(_0xad98('0x15'));var jayson=require(_0xad98('0x16'));var client=jayson[_0xad98('0x17')][_0xad98('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x43d6d6,_0x16c74b,_0x1f033b,_0x308cf8){return new BPromise(function(_0x5b2df6,_0x18886f){var _0x3747eb=_0x308cf8||client;return _0x3747eb[_0xad98('0x19')](_0x43d6d6,_0x1f033b)[_0xad98('0x1a')](function(_0x408e2a){logger[_0xad98('0x1b')](_0xad98('0x1c'),_0x16c74b,_0xad98('0x1d'));logger[_0xad98('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x16c74b,'request\x20sent',JSON[_0xad98('0x1f')](_0x408e2a));if(_0x408e2a['error']){if(_0x408e2a[_0xad98('0x20')][_0xad98('0x21')]===0x1f4){logger[_0xad98('0x20')](_0xad98('0x1c'),_0x16c74b,_0x408e2a[_0xad98('0x20')][_0xad98('0x22')]);return _0x18886f(_0x408e2a[_0xad98('0x20')][_0xad98('0x22')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x16c74b,_0x408e2a[_0xad98('0x20')]['message']);return _0x5b2df6(_0x408e2a[_0xad98('0x20')][_0xad98('0x22')]);}else{logger[_0xad98('0x1b')](_0xad98('0x1c'),_0x16c74b,_0xad98('0x1d'));_0x5b2df6(_0x408e2a[_0xad98('0x23')][_0xad98('0x22')]);}})[_0xad98('0x24')](function(_0x289b0d){logger[_0xad98('0x20')](_0xad98('0x1c'),_0x16c74b,_0x289b0d);_0x18886f(_0x289b0d);});});}function respondWithStatusCode(_0x1c8fd7,_0x25c80f){_0x25c80f=_0x25c80f||0xcc;return function(_0x5295ef){if(_0x5295ef){return _0x1c8fd7[_0xad98('0x25')](_0x25c80f);}return _0x1c8fd7[_0xad98('0x26')](_0x25c80f)[_0xad98('0x27')]();};}function respondWithResult(_0xf48fe4,_0x536907){_0x536907=_0x536907||0xc8;return function(_0x590b77){if(_0x590b77){return _0xf48fe4[_0xad98('0x26')](_0x536907)[_0xad98('0x28')](_0x590b77);}};}function respondWithFilteredResult(_0x383dba,_0x135e6d){return function(_0x1b0c36){if(_0x1b0c36){var _0x1d18e3=_0x1b0c36[_0xad98('0x29')],_0x1a84df=_0x135e6d[_0xad98('0x2a')],_0x53e5fc=_0x135e6d[_0xad98('0x2a')]+_0x135e6d[_0xad98('0x2b')],_0x3cc814;if(_0x53e5fc>=_0x1d18e3){_0x53e5fc=_0x1d18e3;_0x3cc814=0xc8;}else{_0x3cc814=0xce;}_0x383dba[_0xad98('0x26')](_0x3cc814);return _0x383dba[_0xad98('0x2c')](_0xad98('0x2d'),_0x1a84df+'-'+_0x53e5fc+'/'+_0x1d18e3)['json'](_0x1b0c36);}return null;};}function patchUpdates(_0x384709){return function(_0x10022c){try{jsonpatch[_0xad98('0x2e')](_0x10022c,_0x384709,!![]);}catch(_0x5a1a98){return BPromise[_0xad98('0x2f')](_0x5a1a98);}return _0x10022c[_0xad98('0x30')]();};}function saveUpdates(_0x2e0601,_0x214aef){return function(_0x4920db){if(_0x4920db){return _0x4920db[_0xad98('0x31')](_0x2e0601)[_0xad98('0x1a')](function(_0x397a87){return _0x397a87;});}return null;};}function removeEntity(_0x2ca32f,_0x4e1cf2){return function(_0x2a202){if(_0x2a202){return _0x2a202[_0xad98('0x32')]()[_0xad98('0x1a')](function(){_0x2ca32f[_0xad98('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb7b0,_0x387bcc){return function(_0x1eb6fe){if(!_0x1eb6fe){_0x1cb7b0['sendStatus'](0x194);}return _0x1eb6fe;};}function handleError(_0x8ff137,_0x3ed45e){_0x3ed45e=_0x3ed45e||0x1f4;return function(_0x462d99){logger[_0xad98('0x20')](_0x462d99['stack']);if(_0x462d99[_0xad98('0x33')]){delete _0x462d99[_0xad98('0x33')];}_0x8ff137[_0xad98('0x26')](_0x3ed45e)['send'](_0x462d99);};}exports[_0xad98('0x34')]=function(_0x679127,_0x17db12){var _0x4f2984={},_0x4e5f15={},_0x2da3e0={'count':0x0,'rows':[]};var _0x49c7f1=_['map'](db[_0xad98('0x35')]['rawAttributes'],function(_0x53bbd1){return{'name':_0x53bbd1[_0xad98('0x36')],'type':_0x53bbd1[_0xad98('0x37')][_0xad98('0x38')]};});_0x4e5f15[_0xad98('0x39')]=_[_0xad98('0x3a')](_0x49c7f1,_0xad98('0x33'));_0x4e5f15['query']=_[_0xad98('0x3b')](_0x679127[_0xad98('0x3c')]);_0x4e5f15[_0xad98('0x3d')]=_[_0xad98('0x3e')](_0x4e5f15['model'],_0x4e5f15[_0xad98('0x3c')]);_0x4f2984[_0xad98('0x3f')]=_[_0xad98('0x3e')](_0x4e5f15[_0xad98('0x39')],qs[_0xad98('0x40')](_0x679127[_0xad98('0x3c')][_0xad98('0x40')]));_0x4f2984[_0xad98('0x3f')]=_0x4f2984[_0xad98('0x3f')]['length']?_0x4f2984['attributes']:_0x4e5f15['model'];if(!_0x679127[_0xad98('0x3c')][_0xad98('0x41')](_0xad98('0x42'))){_0x4f2984[_0xad98('0x2b')]=qs[_0xad98('0x2b')](_0x679127['query']['limit']);_0x4f2984[_0xad98('0x2a')]=qs[_0xad98('0x2a')](_0x679127[_0xad98('0x3c')][_0xad98('0x2a')]);}_0x4f2984[_0xad98('0x43')]=qs[_0xad98('0x44')](_0x679127['query']['sort']);_0x4f2984[_0xad98('0x45')]=qs[_0xad98('0x3d')](_[_0xad98('0x46')](_0x679127[_0xad98('0x3c')],_0x4e5f15['filters']),_0x49c7f1);if(_0x679127[_0xad98('0x3c')]['filter']){_0x4f2984['where']=_['merge'](_0x4f2984[_0xad98('0x45')],{'$or':_[_0xad98('0x3a')](_0x49c7f1,function(_0x19181d){if(_0x19181d[_0xad98('0x37')]!==_0xad98('0x47')){var _0x127088={};_0x127088[_0x19181d[_0xad98('0x33')]]={'$like':'%'+_0x679127['query']['filter']+'%'};return _0x127088;}})});}_0x4f2984=_[_0xad98('0x48')]({},_0x4f2984,_0x679127['options']);var _0x22ced6={'where':_0x4f2984[_0xad98('0x45')]};return db['ZohoAccount']['count'](_0x22ced6)['then'](function(_0x41ea57){_0x2da3e0[_0xad98('0x29')]=_0x41ea57;if(_0x679127['query'][_0xad98('0x49')]){_0x4f2984['include']=[{'all':!![]}];}return db[_0xad98('0x35')]['findAll'](_0x4f2984);})[_0xad98('0x1a')](function(_0x30eda9){_0x2da3e0[_0xad98('0x4a')]=_0x30eda9;return _0x2da3e0;})[_0xad98('0x1a')](respondWithFilteredResult(_0x17db12,_0x4f2984))[_0xad98('0x24')](handleError(_0x17db12,null));};exports[_0xad98('0x4b')]=function(_0x4b5124,_0x1f4f4b){var _0x26c88={'raw':![],'where':{'id':_0x4b5124[_0xad98('0x4c')]['id']}},_0x269334={};_0x269334[_0xad98('0x39')]=_[_0xad98('0x3b')](db[_0xad98('0x35')][_0xad98('0x4d')]);_0x269334['query']=_[_0xad98('0x3b')](_0x4b5124[_0xad98('0x3c')]);_0x269334[_0xad98('0x3d')]=_['intersection'](_0x269334['model'],_0x269334['query']);_0x26c88[_0xad98('0x3f')]=_[_0xad98('0x3e')](_0x269334[_0xad98('0x39')],qs[_0xad98('0x40')](_0x4b5124[_0xad98('0x3c')][_0xad98('0x40')]));_0x26c88[_0xad98('0x3f')]=_0x26c88['attributes'][_0xad98('0x4e')]?_0x26c88['attributes']:_0x269334[_0xad98('0x39')];if(_0x4b5124['query'][_0xad98('0x49')]){_0x26c88[_0xad98('0x4f')]=[{'all':!![]}];}_0x26c88=_['merge']({},_0x26c88,_0x4b5124['options']);return db[_0xad98('0x35')]['find'](_0x26c88)[_0xad98('0x1a')](handleEntityNotFound(_0x1f4f4b,null))[_0xad98('0x1a')](respondWithResult(_0x1f4f4b,null))[_0xad98('0x24')](handleError(_0x1f4f4b,null));};exports['create']=function(_0xefeeaf,_0x1e2270){return db[_0xad98('0x35')][_0xad98('0x50')](_0xefeeaf[_0xad98('0x51')],{})[_0xad98('0x1a')](respondWithResult(_0x1e2270,0xc9))['catch'](handleError(_0x1e2270,null));};exports[_0xad98('0x31')]=function(_0x36b849,_0x1b9dd5){if(_0x36b849[_0xad98('0x51')]['id']){delete _0x36b849[_0xad98('0x51')]['id'];}return db[_0xad98('0x35')][_0xad98('0x52')]({'where':{'id':_0x36b849[_0xad98('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b9dd5,null))[_0xad98('0x1a')](saveUpdates(_0x36b849[_0xad98('0x51')],null))[_0xad98('0x1a')](respondWithResult(_0x1b9dd5,null))[_0xad98('0x24')](handleError(_0x1b9dd5,null));};exports[_0xad98('0x32')]=function(_0x3ded4e,_0xd501d9){return db['ZohoAccount']['find']({'where':{'id':_0x3ded4e[_0xad98('0x4c')]['id']}})[_0xad98('0x1a')](handleEntityNotFound(_0xd501d9,null))['then'](removeEntity(_0xd501d9,null))['catch'](handleError(_0xd501d9,null));};exports['getConfigurations']=function(_0x587c7c,_0x42f264,_0x22829d){var _0x13ea63={};var _0x3490bd={};var _0x23e201;var _0x2cb5be;return db[_0xad98('0x35')]['findOne']({'where':{'id':_0x587c7c[_0xad98('0x4c')]['id']}})[_0xad98('0x1a')](handleEntityNotFound(_0x42f264,null))[_0xad98('0x1a')](function(_0x22d114){if(_0x22d114){_0x23e201=_0x22d114;_0x3490bd[_0xad98('0x39')]=_[_0xad98('0x3b')](db['ZohoConfiguration'][_0xad98('0x4d')]);_0x3490bd['query']=_[_0xad98('0x3b')](_0x587c7c['query']);_0x3490bd[_0xad98('0x3d')]=_['intersection'](_0x3490bd[_0xad98('0x39')],_0x3490bd[_0xad98('0x3c')]);_0x13ea63[_0xad98('0x3f')]=_[_0xad98('0x3e')](_0x3490bd['model'],qs[_0xad98('0x40')](_0x587c7c[_0xad98('0x3c')][_0xad98('0x40')]));_0x13ea63[_0xad98('0x3f')]=_0x13ea63[_0xad98('0x3f')]['length']?_0x13ea63[_0xad98('0x3f')]:_0x3490bd[_0xad98('0x39')];_0x13ea63[_0xad98('0x43')]=qs[_0xad98('0x44')](_0x587c7c[_0xad98('0x3c')][_0xad98('0x44')]);_0x13ea63[_0xad98('0x45')]=qs[_0xad98('0x3d')](_['pick'](_0x587c7c[_0xad98('0x3c')],_0x3490bd[_0xad98('0x3d')]));if(_0x587c7c[_0xad98('0x3c')][_0xad98('0x53')]){_0x13ea63[_0xad98('0x45')]=_[_0xad98('0x48')](_0x13ea63[_0xad98('0x45')],{'$or':_[_0xad98('0x3a')](_0x13ea63[_0xad98('0x3f')],function(_0x1a33aa){var _0x36e801={};_0x36e801[_0x1a33aa]={'$like':'%'+_0x587c7c[_0xad98('0x3c')]['filter']+'%'};return _0x36e801;})});}_0x13ea63=_[_0xad98('0x48')]({},_0x13ea63,_0x587c7c['options']);return _0x23e201[_0xad98('0x54')](_0x13ea63);}})['then'](function(_0x436f87){if(_0x436f87){_0x2cb5be=_0x436f87[_0xad98('0x4e')];if(!_0x587c7c['query'][_0xad98('0x41')](_0xad98('0x42'))){_0x13ea63[_0xad98('0x2b')]=qs[_0xad98('0x2b')](_0x587c7c[_0xad98('0x3c')]['limit']);_0x13ea63[_0xad98('0x2a')]=qs['offset'](_0x587c7c[_0xad98('0x3c')][_0xad98('0x2a')]);}return _0x23e201['getConfigurations'](_0x13ea63);}})[_0xad98('0x1a')](function(_0x24333d){if(_0x24333d){return _0x24333d?{'count':_0x2cb5be,'rows':_0x24333d}:null;}})['then'](respondWithResult(_0x42f264,null))[_0xad98('0x24')](handleError(_0x42f264,null));};exports['addConfiguration']=function(_0x3b9438,_0x38685e,_0x1bafd4){if(_0x3b9438[_0xad98('0x51')]['id']){delete _0x3b9438['body']['id'];}return db[_0xad98('0x35')]['findOne']({'where':{'id':_0x3b9438[_0xad98('0x4c')]['id']}})[_0xad98('0x1a')](handleEntityNotFound(_0x38685e,null))[_0xad98('0x1a')](function(_0x1981b4){if(_0x1981b4){_0x3b9438[_0xad98('0x51')][_0xad98('0x55')]=_0x1981b4['id'];_0x3b9438[_0xad98('0x51')][_0xad98('0x56')]=integrations[_0xad98('0x57')](_0x3b9438[_0xad98('0x51')]['channel'],_0x3b9438['body'][_0xad98('0x37')]);_0x3b9438[_0xad98('0x51')][_0xad98('0x58')]=integrations[_0xad98('0x59')](_0x3b9438[_0xad98('0x51')][_0xad98('0x5a')],_0x3b9438[_0xad98('0x51')][_0xad98('0x37')]);return db['ZohoConfiguration'][_0xad98('0x50')](_0x3b9438[_0xad98('0x51')],{'include':[{'model':db[_0xad98('0x5b')],'as':_0xad98('0x56')},{'model':db[_0xad98('0x5b')],'as':_0xad98('0x58')}]});}return null;})[_0xad98('0x1a')](respondWithResult(_0x38685e,null))[_0xad98('0x24')](handleError(_0x38685e,null));};function getAccessToken(_0x1e6b17){return new Promise(function(_0x3c3592,_0x4f0acd){var _0x5ba6d;switch(_0x1e6b17[_0xad98('0x5c')]){case'US':_0x5ba6d='https://accounts.zoho.com';break;case'AU':_0x5ba6d=_0xad98('0x5d');break;case'EU':_0x5ba6d=_0xad98('0x5e');break;case'IN':_0x5ba6d=_0xad98('0x5f');break;case'CN':_0x5ba6d='https://accounts.zoho.com.cn';break;default:_0x5ba6d='https://accounts.zoho.eu';break;}var _0x5b5826={'method':_0xad98('0x60'),'uri':_0x5ba6d+_0xad98('0x61'),'qs':{'refresh_token':_0x1e6b17[_0xad98('0x62')],'client_id':_0x1e6b17[_0xad98('0x63')],'client_secret':_0x1e6b17['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5b5826)[_0xad98('0x1a')](function(_0x96abf8){if(_0x96abf8[_0xad98('0x64')]){_0x3c3592(_0x96abf8['access_token']);}else{_0x4f0acd(_0xad98('0x65'));}})['catch'](function(_0xd2e407){_0x4f0acd(_0xd2e407);});});}exports[_0xad98('0x66')]=function(_0x6288d4,_0x3439c0,_0x3a80fa){var _0x317446,_0x2ac940,_0x59212c,_0x390e65,_0x942d77;return db[_0xad98('0x35')][_0xad98('0x67')]({'where':{'id':_0x6288d4['params']['id']},'attributes':['id',_0xad98('0x68'),_0xad98('0x5c'),'clientId',_0xad98('0x69'),'serverUrl',_0xad98('0x21'),_0xad98('0x62')]})['then'](handleEntityNotFound(_0x3439c0,null))[_0xad98('0x1a')](function(_0x38bc3f){_0x942d77=_0x38bc3f;_0x317446=_0x942d77[_0xad98('0x68')];_0x2ac940=_0x317446==='zoho.eu'?'eu':_0xad98('0x6a');_0x59212c=_0x942d77[_0xad98('0x6b')];var _0xe16962=_0x59212c['slice'](-0x1);if(_0xe16962==='/'||_0xe16962==='\x5c'||_0xe16962===':'){_0x59212c=_0x59212c['substring'](0x0,_0x59212c[_0xad98('0x6c')](_0xe16962));}if(!_0x942d77['refreshToken']){throw new Error(_0xad98('0x6d'));}return getAccessToken(_0x942d77);})[_0xad98('0x1a')](function(_0x1b0c78){if(_0x1b0c78){return rp({'method':_0xad98('0x6e'),'uri':util[_0xad98('0x6f')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2ac940),'qs':{'module':_0xad98('0x70')},'headers':{'Authorization':_0xad98('0x71')+_0x1b0c78},'json':!![]});}})[_0xad98('0x1a')](function(_0x18eef9){if(_0x18eef9){if(_0x18eef9['response']&&_0x18eef9[_0xad98('0x72')][_0xad98('0x20')]){throw new Error(_0x18eef9[_0xad98('0x72')][_0xad98('0x20')]['message']);}var _0x588499=[];var _0x5b2e3f=[];var _0x41d951=[_0xad98('0x73'),_0xad98('0x74'),_0xad98('0x75'),_0xad98('0x76'),_0xad98('0x77'),_0xad98('0x78'),_0xad98('0x79'),_0xad98('0x7a')];_0x5b2e3f=_['remove'](_0x18eef9[_0xad98('0x40')],function(_0x42337e){return _0x41d951['includes'](_0x42337e[_0xad98('0x7b')]);});for(var _0xab8cb1=0x0;_0xab8cb1<_0x5b2e3f['length'];_0xab8cb1++){if(_0x5b2e3f[_0xab8cb1][_0xad98('0x7c')]===![]){_0x588499['push']({'id':_0x5b2e3f[_0xab8cb1]['id'],'name':_0x5b2e3f[_0xab8cb1][_0xad98('0x7d')],'custom':_0x5b2e3f[_0xab8cb1][_0xad98('0x7e')],'options':_0x5b2e3f[_0xab8cb1][_0xad98('0x7f')]===_0xad98('0x80')&&_0x5b2e3f[_0xab8cb1][_0xad98('0x81')][_0xad98('0x4e')]>-0x1?_['map'](_0x5b2e3f[_0xab8cb1][_0xad98('0x81')],function(_0x572764){return{'name':_0x572764,'value':_0x572764};}):[]});}}return{'count':_0x588499[_0xad98('0x4e')],'rows':_0x588499};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3439c0,null))[_0xad98('0x24')](function(_0x1052e7){var _0x24a16d=_0x6288d4['query']['test']?0x1f4:_0x1052e7[_0xad98('0x82')]||0x1f4;logger[_0xad98('0x20')](_0xad98('0x83'),_0xad98('0x66'),_0x24a16d,JSON['stringify'](_0x1052e7));delete _0x1052e7[_0xad98('0x33')];if(_0x24a16d===0x191){_0x24a16d=0x190;}_0x3439c0[_0xad98('0x26')](_0x24a16d)[_0xad98('0x84')](_0x6288d4[_0xad98('0x3c')]['test']?{'message':_0xad98('0x85'),'statusCode':_0x1052e7[_0xad98('0x82')]}:_0x1052e7);});}; \ No newline at end of file +var _0xd142=['Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','test','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','end','stack','name','send','ZohoAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','find','create','body','ZohoConfiguration','getConfigurations','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','POST','/oauth/v2/token','clientId','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','zoho.eu','com','slice'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0xd142,0x11a));var _0x2d14=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0xd142[_0x180ac2];return _0xfcaede;};'use strict';var pdf=require(_0x2d14('0x0'));var emlformat=require(_0x2d14('0x1'));var rimraf=require(_0x2d14('0x2'));var zipdir=require(_0x2d14('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d14('0x4'));var BPromise=require(_0x2d14('0x5'));var Mustache=require(_0x2d14('0x6'));var util=require(_0x2d14('0x7'));var path=require(_0x2d14('0x8'));var sox=require(_0x2d14('0x9'));var csv=require(_0x2d14('0xa'));var ejs=require(_0x2d14('0xb'));var fs=require('fs');var _=require(_0x2d14('0xc'));var squel=require(_0x2d14('0xd'));var crypto=require(_0x2d14('0xe'));var jsforce=require(_0x2d14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2d14('0xa'));var querystring=require(_0x2d14('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d14('0x11'));var authService=require(_0x2d14('0x12'));var qs=require(_0x2d14('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d14('0x14'));var logger=require(_0x2d14('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2d14('0x16'));var licenseUtil=require(_0x2d14('0x17'));var db=require(_0x2d14('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2d14('0x19'));var client=jayson[_0x2d14('0x1a')][_0x2d14('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x209b7c,_0x5e5d25,_0x142617,_0x30dfeb){return new BPromise(function(_0x488250,_0x2512df){var _0x2c2b4a=_0x30dfeb||client;return _0x2c2b4a[_0x2d14('0x1c')](_0x209b7c,_0x142617)[_0x2d14('0x1d')](function(_0x2dfcd4){logger['info'](_0x2d14('0x1e'),_0x5e5d25,_0x2d14('0x1f'));logger[_0x2d14('0x20')](_0x2d14('0x21'),_0x5e5d25,_0x2d14('0x1f'),JSON['stringify'](_0x2dfcd4));if(_0x2dfcd4[_0x2d14('0x22')]){if(_0x2dfcd4[_0x2d14('0x22')][_0x2d14('0x23')]===0x1f4){logger[_0x2d14('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x5e5d25,_0x2dfcd4['error'][_0x2d14('0x24')]);return _0x2512df(_0x2dfcd4['error']['message']);}logger[_0x2d14('0x22')](_0x2d14('0x1e'),_0x5e5d25,_0x2dfcd4[_0x2d14('0x22')]['message']);return _0x488250(_0x2dfcd4[_0x2d14('0x22')][_0x2d14('0x24')]);}else{logger['info'](_0x2d14('0x1e'),_0x5e5d25,_0x2d14('0x1f'));_0x488250(_0x2dfcd4['result'][_0x2d14('0x24')]);}})[_0x2d14('0x25')](function(_0x42e09b){logger[_0x2d14('0x22')](_0x2d14('0x1e'),_0x5e5d25,_0x42e09b);_0x2512df(_0x42e09b);});});}function respondWithStatusCode(_0x5ecbc0,_0x334ff7){_0x334ff7=_0x334ff7||0xcc;return function(_0x5d6ab5){if(_0x5d6ab5){return _0x5ecbc0[_0x2d14('0x26')](_0x334ff7);}return _0x5ecbc0['status'](_0x334ff7)['end']();};}function respondWithResult(_0x2af2cf,_0x1b32e2){_0x1b32e2=_0x1b32e2||0xc8;return function(_0x2724f3){if(_0x2724f3){return _0x2af2cf[_0x2d14('0x27')](_0x1b32e2)['json'](_0x2724f3);}};}function respondWithFilteredResult(_0x21a540,_0x376b71){return function(_0x58fdee){if(_0x58fdee){var _0x16fa67=_0x58fdee[_0x2d14('0x28')],_0x35ace8=_0x376b71['offset'],_0x572720=_0x376b71[_0x2d14('0x29')]+_0x376b71[_0x2d14('0x2a')],_0x104e0e;if(_0x572720>=_0x16fa67){_0x572720=_0x16fa67;_0x104e0e=0xc8;}else{_0x104e0e=0xce;}_0x21a540[_0x2d14('0x27')](_0x104e0e);return _0x21a540[_0x2d14('0x2b')](_0x2d14('0x2c'),_0x35ace8+'-'+_0x572720+'/'+_0x16fa67)[_0x2d14('0x2d')](_0x58fdee);}return null;};}function patchUpdates(_0x2b35a4){return function(_0x6289db){try{jsonpatch['apply'](_0x6289db,_0x2b35a4,!![]);}catch(_0xd4edb0){return BPromise[_0x2d14('0x2e')](_0xd4edb0);}return _0x6289db[_0x2d14('0x2f')]();};}function saveUpdates(_0x1da82a,_0x55ccb5){return function(_0xaf095c){if(_0xaf095c){return _0xaf095c[_0x2d14('0x30')](_0x1da82a)[_0x2d14('0x1d')](function(_0x4e8980){return _0x4e8980;});}return null;};}function removeEntity(_0xcee84d,_0x174656){return function(_0x251b90){if(_0x251b90){return _0x251b90[_0x2d14('0x31')]()[_0x2d14('0x1d')](function(){_0xcee84d[_0x2d14('0x27')](0xcc)[_0x2d14('0x32')]();});}};}function handleEntityNotFound(_0x39c3c1,_0x53f831){return function(_0x1c05b7){if(!_0x1c05b7){_0x39c3c1[_0x2d14('0x26')](0x194);}return _0x1c05b7;};}function handleError(_0x1a7ed8,_0x4388c9){_0x4388c9=_0x4388c9||0x1f4;return function(_0x85dd6e){logger['error'](_0x85dd6e[_0x2d14('0x33')]);if(_0x85dd6e[_0x2d14('0x34')]){delete _0x85dd6e[_0x2d14('0x34')];}_0x1a7ed8[_0x2d14('0x27')](_0x4388c9)[_0x2d14('0x35')](_0x85dd6e);};}exports['index']=function(_0x68b045,_0x2a3278){var _0xa4d9e7={},_0x4058e0={},_0x46b8be={'count':0x0,'rows':[]};var _0xc7fe6b=_['map'](db[_0x2d14('0x36')]['rawAttributes'],function(_0x30f9bc){return{'name':_0x30f9bc[_0x2d14('0x37')],'type':_0x30f9bc[_0x2d14('0x38')][_0x2d14('0x39')]};});_0x4058e0[_0x2d14('0x3a')]=_[_0x2d14('0x3b')](_0xc7fe6b,_0x2d14('0x34'));_0x4058e0['query']=_[_0x2d14('0x3c')](_0x68b045[_0x2d14('0x3d')]);_0x4058e0[_0x2d14('0x3e')]=_[_0x2d14('0x3f')](_0x4058e0[_0x2d14('0x3a')],_0x4058e0['query']);_0xa4d9e7[_0x2d14('0x40')]=_[_0x2d14('0x3f')](_0x4058e0[_0x2d14('0x3a')],qs[_0x2d14('0x41')](_0x68b045[_0x2d14('0x3d')][_0x2d14('0x41')]));_0xa4d9e7[_0x2d14('0x40')]=_0xa4d9e7[_0x2d14('0x40')][_0x2d14('0x42')]?_0xa4d9e7[_0x2d14('0x40')]:_0x4058e0[_0x2d14('0x3a')];if(!_0x68b045[_0x2d14('0x3d')][_0x2d14('0x43')](_0x2d14('0x44'))){_0xa4d9e7[_0x2d14('0x2a')]=qs['limit'](_0x68b045[_0x2d14('0x3d')][_0x2d14('0x2a')]);_0xa4d9e7[_0x2d14('0x29')]=qs[_0x2d14('0x29')](_0x68b045['query'][_0x2d14('0x29')]);}_0xa4d9e7[_0x2d14('0x45')]=qs['sort'](_0x68b045[_0x2d14('0x3d')][_0x2d14('0x46')]);_0xa4d9e7[_0x2d14('0x47')]=qs[_0x2d14('0x3e')](_[_0x2d14('0x48')](_0x68b045[_0x2d14('0x3d')],_0x4058e0['filters']),_0xc7fe6b);if(_0x68b045['query'][_0x2d14('0x49')]){_0xa4d9e7[_0x2d14('0x47')]=_[_0x2d14('0x4a')](_0xa4d9e7[_0x2d14('0x47')],{'$or':_['map'](_0xc7fe6b,function(_0x133ec2){if(_0x133ec2[_0x2d14('0x38')]!==_0x2d14('0x4b')){var _0x28fe9b={};_0x28fe9b[_0x133ec2[_0x2d14('0x34')]]={'$like':'%'+_0x68b045[_0x2d14('0x3d')][_0x2d14('0x49')]+'%'};return _0x28fe9b;}})});}_0xa4d9e7=_[_0x2d14('0x4a')]({},_0xa4d9e7,_0x68b045[_0x2d14('0x4c')]);var _0x12bd68={'where':_0xa4d9e7['where']};return db[_0x2d14('0x36')][_0x2d14('0x28')](_0x12bd68)[_0x2d14('0x1d')](function(_0x331a13){_0x46b8be['count']=_0x331a13;if(_0x68b045['query'][_0x2d14('0x4d')]){_0xa4d9e7['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0xa4d9e7);})[_0x2d14('0x1d')](function(_0x5aa300){_0x46b8be[_0x2d14('0x4e')]=_0x5aa300;return _0x46b8be;})[_0x2d14('0x1d')](respondWithFilteredResult(_0x2a3278,_0xa4d9e7))[_0x2d14('0x25')](handleError(_0x2a3278,null));};exports[_0x2d14('0x4f')]=function(_0x4e87a3,_0x1f95e4){var _0x5b4bc3={'raw':![],'where':{'id':_0x4e87a3[_0x2d14('0x50')]['id']}},_0xc1166d={};_0xc1166d['model']=_['keys'](db[_0x2d14('0x36')][_0x2d14('0x51')]);_0xc1166d[_0x2d14('0x3d')]=_[_0x2d14('0x3c')](_0x4e87a3['query']);_0xc1166d['filters']=_[_0x2d14('0x3f')](_0xc1166d[_0x2d14('0x3a')],_0xc1166d[_0x2d14('0x3d')]);_0x5b4bc3['attributes']=_['intersection'](_0xc1166d['model'],qs[_0x2d14('0x41')](_0x4e87a3['query'][_0x2d14('0x41')]));_0x5b4bc3[_0x2d14('0x40')]=_0x5b4bc3[_0x2d14('0x40')][_0x2d14('0x42')]?_0x5b4bc3['attributes']:_0xc1166d[_0x2d14('0x3a')];if(_0x4e87a3['query']['includeAll']){_0x5b4bc3['include']=[{'all':!![]}];}_0x5b4bc3=_[_0x2d14('0x4a')]({},_0x5b4bc3,_0x4e87a3[_0x2d14('0x4c')]);return db['ZohoAccount'][_0x2d14('0x52')](_0x5b4bc3)['then'](handleEntityNotFound(_0x1f95e4,null))[_0x2d14('0x1d')](respondWithResult(_0x1f95e4,null))[_0x2d14('0x25')](handleError(_0x1f95e4,null));};exports[_0x2d14('0x53')]=function(_0x4044f5,_0x24ee55){return db['ZohoAccount']['create'](_0x4044f5[_0x2d14('0x54')],{})['then'](respondWithResult(_0x24ee55,0xc9))[_0x2d14('0x25')](handleError(_0x24ee55,null));};exports['update']=function(_0x2e05fd,_0x4b4cdb){if(_0x2e05fd[_0x2d14('0x54')]['id']){delete _0x2e05fd[_0x2d14('0x54')]['id'];}return db['ZohoAccount'][_0x2d14('0x52')]({'where':{'id':_0x2e05fd['params']['id']}})[_0x2d14('0x1d')](handleEntityNotFound(_0x4b4cdb,null))['then'](saveUpdates(_0x2e05fd[_0x2d14('0x54')],null))['then'](respondWithResult(_0x4b4cdb,null))[_0x2d14('0x25')](handleError(_0x4b4cdb,null));};exports[_0x2d14('0x31')]=function(_0x552848,_0x55f2d4){return db[_0x2d14('0x36')][_0x2d14('0x52')]({'where':{'id':_0x552848[_0x2d14('0x50')]['id']}})[_0x2d14('0x1d')](handleEntityNotFound(_0x55f2d4,null))[_0x2d14('0x1d')](removeEntity(_0x55f2d4,null))[_0x2d14('0x25')](handleError(_0x55f2d4,null));};exports['getConfigurations']=function(_0x5cb80f,_0x108b9f,_0xa8157f){var _0x1a349e={};var _0x48f7f3={};var _0x48f9e5;var _0x3eebd1;return db[_0x2d14('0x36')]['findOne']({'where':{'id':_0x5cb80f[_0x2d14('0x50')]['id']}})[_0x2d14('0x1d')](handleEntityNotFound(_0x108b9f,null))['then'](function(_0xb8f770){if(_0xb8f770){_0x48f9e5=_0xb8f770;_0x48f7f3[_0x2d14('0x3a')]=_[_0x2d14('0x3c')](db[_0x2d14('0x55')][_0x2d14('0x51')]);_0x48f7f3[_0x2d14('0x3d')]=_['keys'](_0x5cb80f[_0x2d14('0x3d')]);_0x48f7f3[_0x2d14('0x3e')]=_[_0x2d14('0x3f')](_0x48f7f3[_0x2d14('0x3a')],_0x48f7f3[_0x2d14('0x3d')]);_0x1a349e[_0x2d14('0x40')]=_[_0x2d14('0x3f')](_0x48f7f3[_0x2d14('0x3a')],qs['fields'](_0x5cb80f['query'][_0x2d14('0x41')]));_0x1a349e[_0x2d14('0x40')]=_0x1a349e[_0x2d14('0x40')][_0x2d14('0x42')]?_0x1a349e[_0x2d14('0x40')]:_0x48f7f3['model'];_0x1a349e['order']=qs[_0x2d14('0x46')](_0x5cb80f[_0x2d14('0x3d')][_0x2d14('0x46')]);_0x1a349e[_0x2d14('0x47')]=qs[_0x2d14('0x3e')](_['pick'](_0x5cb80f[_0x2d14('0x3d')],_0x48f7f3['filters']));if(_0x5cb80f['query'][_0x2d14('0x49')]){_0x1a349e[_0x2d14('0x47')]=_[_0x2d14('0x4a')](_0x1a349e[_0x2d14('0x47')],{'$or':_[_0x2d14('0x3b')](_0x1a349e[_0x2d14('0x40')],function(_0x17e6bc){var _0x357d85={};_0x357d85[_0x17e6bc]={'$like':'%'+_0x5cb80f[_0x2d14('0x3d')][_0x2d14('0x49')]+'%'};return _0x357d85;})});}_0x1a349e=_[_0x2d14('0x4a')]({},_0x1a349e,_0x5cb80f[_0x2d14('0x4c')]);return _0x48f9e5[_0x2d14('0x56')](_0x1a349e);}})[_0x2d14('0x1d')](function(_0xbb79b1){if(_0xbb79b1){_0x3eebd1=_0xbb79b1[_0x2d14('0x42')];if(!_0x5cb80f[_0x2d14('0x3d')][_0x2d14('0x43')](_0x2d14('0x44'))){_0x1a349e['limit']=qs['limit'](_0x5cb80f[_0x2d14('0x3d')][_0x2d14('0x2a')]);_0x1a349e[_0x2d14('0x29')]=qs[_0x2d14('0x29')](_0x5cb80f['query'][_0x2d14('0x29')]);}return _0x48f9e5[_0x2d14('0x56')](_0x1a349e);}})['then'](function(_0x5ca3b1){if(_0x5ca3b1){return _0x5ca3b1?{'count':_0x3eebd1,'rows':_0x5ca3b1}:null;}})[_0x2d14('0x1d')](respondWithResult(_0x108b9f,null))[_0x2d14('0x25')](handleError(_0x108b9f,null));};exports[_0x2d14('0x57')]=function(_0x878ec2,_0x2d8df6,_0x293437){if(_0x878ec2[_0x2d14('0x54')]['id']){delete _0x878ec2['body']['id'];}return db[_0x2d14('0x36')][_0x2d14('0x58')]({'where':{'id':_0x878ec2[_0x2d14('0x50')]['id']}})['then'](handleEntityNotFound(_0x2d8df6,null))[_0x2d14('0x1d')](function(_0x1642c9){if(_0x1642c9){_0x878ec2['body'][_0x2d14('0x59')]=_0x1642c9['id'];_0x878ec2[_0x2d14('0x54')]['Subjects']=integrations['getSubjects'](_0x878ec2[_0x2d14('0x54')][_0x2d14('0x5a')],_0x878ec2[_0x2d14('0x54')][_0x2d14('0x38')]);_0x878ec2[_0x2d14('0x54')][_0x2d14('0x5b')]=integrations[_0x2d14('0x5c')](_0x878ec2['body'][_0x2d14('0x5a')],_0x878ec2[_0x2d14('0x54')]['type']);return db['ZohoConfiguration'][_0x2d14('0x53')](_0x878ec2['body'],{'include':[{'model':db[_0x2d14('0x5d')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x2d14('0x5b')}]});}return null;})[_0x2d14('0x1d')](respondWithResult(_0x2d8df6,null))[_0x2d14('0x25')](handleError(_0x2d8df6,null));};function getAccessToken(_0x5d2a74){return new Promise(function(_0x3bbb06,_0x482bd3){var _0x362958;switch(_0x5d2a74[_0x2d14('0x5e')]){case'US':_0x362958=_0x2d14('0x5f');break;case'AU':_0x362958='https://accounts.zoho.com.au';break;case'EU':_0x362958='https://accounts.zoho.eu';break;case'IN':_0x362958='https://accounts.zoho.in';break;case'CN':_0x362958='https://accounts.zoho.com.cn';break;default:_0x362958='https://accounts.zoho.eu';break;}var _0x4b3c3e={'method':_0x2d14('0x60'),'uri':_0x362958+_0x2d14('0x61'),'qs':{'refresh_token':_0x5d2a74['refreshToken'],'client_id':_0x5d2a74[_0x2d14('0x62')],'client_secret':_0x5d2a74['clientSecret'],'grant_type':_0x2d14('0x63')},'json':!![]};return rp(_0x4b3c3e)[_0x2d14('0x1d')](function(_0x23c591){if(_0x23c591['access_token']){_0x3bbb06(_0x23c591['access_token']);}else{_0x482bd3(_0x2d14('0x64'));}})[_0x2d14('0x25')](function(_0x4fe394){_0x482bd3(_0x4fe394);});});}exports[_0x2d14('0x65')]=function(_0x589897,_0x2cf985,_0x300b61){var _0x3fbe52,_0x4056f6,_0x2e4890,_0x1aca78,_0x4f3fa4;return db[_0x2d14('0x36')][_0x2d14('0x58')]({'where':{'id':_0x589897[_0x2d14('0x50')]['id']},'attributes':['id',_0x2d14('0x66'),'zone',_0x2d14('0x62'),_0x2d14('0x67'),_0x2d14('0x68'),_0x2d14('0x23'),'refreshToken']})[_0x2d14('0x1d')](handleEntityNotFound(_0x2cf985,null))[_0x2d14('0x1d')](function(_0x5ebc7b){_0x4f3fa4=_0x5ebc7b;_0x3fbe52=_0x4f3fa4[_0x2d14('0x66')];_0x4056f6=_0x3fbe52===_0x2d14('0x69')?'eu':_0x2d14('0x6a');_0x2e4890=_0x4f3fa4[_0x2d14('0x68')];var _0x5e4252=_0x2e4890[_0x2d14('0x6b')](-0x1);if(_0x5e4252==='/'||_0x5e4252==='\x5c'||_0x5e4252===':'){_0x2e4890=_0x2e4890['substring'](0x0,_0x2e4890['lastIndexOf'](_0x5e4252));}if(!_0x4f3fa4['refreshToken']){throw new Error(_0x2d14('0x6c'));}return getAccessToken(_0x4f3fa4);})[_0x2d14('0x1d')](function(_0x2d0e79){if(_0x2d0e79){return rp({'method':_0x2d14('0x6d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4056f6),'qs':{'module':_0x2d14('0x6e')},'headers':{'Authorization':_0x2d14('0x6f')+_0x2d0e79},'json':!![]});}})[_0x2d14('0x1d')](function(_0x4bcde7){if(_0x4bcde7){if(_0x4bcde7[_0x2d14('0x70')]&&_0x4bcde7[_0x2d14('0x70')][_0x2d14('0x22')]){throw new Error(_0x4bcde7[_0x2d14('0x70')]['error']['message']);}var _0x213469=[];var _0x3a9954=[];var _0x4ff249=[_0x2d14('0x71'),_0x2d14('0x72'),_0x2d14('0x73'),_0x2d14('0x74'),'Call_Duration',_0x2d14('0x75'),'Call_Start_Time','Call_Type'];_0x3a9954=_[_0x2d14('0x76')](_0x4bcde7[_0x2d14('0x41')],function(_0x37c99b){return _0x4ff249[_0x2d14('0x77')](_0x37c99b[_0x2d14('0x78')]);});for(var _0x2d8779=0x0;_0x2d8779<_0x3a9954['length'];_0x2d8779++){if(_0x3a9954[_0x2d8779]['system_mandatory']===![]){_0x213469[_0x2d14('0x79')]({'id':_0x3a9954[_0x2d8779]['id'],'name':_0x3a9954[_0x2d8779][_0x2d14('0x7a')],'custom':_0x3a9954[_0x2d8779][_0x2d14('0x7b')],'options':_0x3a9954[_0x2d8779][_0x2d14('0x7c')]===_0x2d14('0x7d')&&_0x3a9954[_0x2d8779]['pick_list_values'][_0x2d14('0x42')]>-0x1?_[_0x2d14('0x3b')](_0x3a9954[_0x2d8779]['pick_list_values'],function(_0x44793c){return{'name':_0x44793c,'value':_0x44793c};}):[]});}}return{'count':_0x213469[_0x2d14('0x42')],'rows':_0x213469};}else{return{'count':0x0,'rows':[]};}})[_0x2d14('0x1d')](respondWithResult(_0x2cf985,null))[_0x2d14('0x25')](function(_0x7a630e){var _0x1e33f8=_0x589897[_0x2d14('0x3d')][_0x2d14('0x7e')]?0x1f4:_0x7a630e[_0x2d14('0x7f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2d14('0x65'),_0x1e33f8,JSON[_0x2d14('0x80')](_0x7a630e));delete _0x7a630e[_0x2d14('0x34')];if(_0x1e33f8===0x191){_0x1e33f8=0x190;}_0x2cf985[_0x2d14('0x27')](_0x1e33f8)[_0x2d14('0x35')](_0x589897['query'][_0x2d14('0x7e')]?{'message':_0x2d14('0x81'),'statusCode':_0x7a630e[_0x2d14('0x7f')]}:_0x7a630e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6be486f..55bfec3 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 _0x2a9b=['clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.eu','POST','then','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code'];(function(_0xb02a51,_0x4fefca){var _0xfdc48f=function(_0x21ffb3){while(--_0x21ffb3){_0xb02a51['push'](_0xb02a51['shift']());}};_0xfdc48f(++_0x4fefca);}(_0x2a9b,0x14a));var _0xb2a9=function(_0x36925b,_0x2969df){_0x36925b=_0x36925b-0x0;var _0x3872a2=_0x2a9b[_0x36925b];return _0x3872a2;};'use strict';var _=require(_0xb2a9('0x0'));var util=require(_0xb2a9('0x1'));var logger=require(_0xb2a9('0x2'))(_0xb2a9('0x3'));var moment=require(_0xb2a9('0x4'));var BPromise=require(_0xb2a9('0x5'));var rp=require(_0xb2a9('0x6'));var fs=require('fs');var path=require(_0xb2a9('0x7'));var rimraf=require(_0xb2a9('0x8'));var config=require(_0xb2a9('0x9'));var attributes=require(_0xb2a9('0xa'));var integrations=require(_0xb2a9('0xb'));module[_0xb2a9('0xc')]=function(_0x282eb0,_0x14bc69){return _0x282eb0[_0xb2a9('0xd')](_0xb2a9('0xe'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15f0f2,_0x4a70f3,_0x266feb){if(_0x15f0f2[_0xb2a9('0xf')](_0xb2a9('0x10'))||_0x15f0f2[_0xb2a9('0xf')](_0xb2a9('0x11'))||_0x15f0f2[_0xb2a9('0xf')]('clientId')||_0x15f0f2[_0xb2a9('0xf')](_0xb2a9('0x12'))||_0x15f0f2[_0xb2a9('0xf')](_0xb2a9('0x13'))||_0x15f0f2[_0xb2a9('0xf')](_0xb2a9('0x14'))){var _0x49e6d5,_0x1fd7dd;_0x49e6d5=_0x15f0f2[_0xb2a9('0x11')];var _0x42a991=_0x49e6d5[_0xb2a9('0x15')](-0x1);if(_0x42a991==='/'||_0x42a991==='\x5c'||_0x42a991===':'){_0x49e6d5=_0x49e6d5[_0xb2a9('0x16')](0x0,_0x49e6d5[_0xb2a9('0x17')](_0x42a991));}switch(_0x15f0f2[_0xb2a9('0x10')]){case'US':_0x1fd7dd=_0xb2a9('0x18');break;case'AU':_0x1fd7dd=_0xb2a9('0x19');break;case'IN':_0x1fd7dd=_0xb2a9('0x1a');break;case'CN':_0x1fd7dd=_0xb2a9('0x1b');break;default:_0x1fd7dd='https://accounts.zoho.eu';break;}var _0x3accb5={'method':'POST','uri':_0x1fd7dd+_0xb2a9('0x1c'),'form':{'grant_type':_0xb2a9('0x1d'),'client_id':_0x15f0f2[_0xb2a9('0x1e')],'client_secret':_0x15f0f2[_0xb2a9('0x12')],'redirect_uri':_0x15f0f2[_0xb2a9('0x11')],'code':_0x15f0f2[_0xb2a9('0x13')]},'headers':{'Content-Type':_0xb2a9('0x1f')}};return rp(_0x3accb5)['then'](function(_0x2990da){var _0x2bd77f=JSON[_0xb2a9('0x20')](_0x2990da);if(_0x2bd77f[_0xb2a9('0x21')]){_0x15f0f2[_0xb2a9('0x22')]=_0x2bd77f[_0xb2a9('0x21')];logger['info'](util[_0xb2a9('0x23')](_0xb2a9('0x24'),_0x15f0f2[_0xb2a9('0x25')],_0x15f0f2['id']));}else{logger[_0xb2a9('0x26')](util[_0xb2a9('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x15f0f2[_0xb2a9('0x25')],_0x15f0f2['id']),util[_0xb2a9('0x27')](_0x2bd77f,{'showHidden':![],'depth':null}));}return _0x266feb(null,_0x4a70f3);})[_0xb2a9('0x28')](function(_0x5c18b7){logger[_0xb2a9('0x26')](util[_0xb2a9('0x23')](_0xb2a9('0x29'),_0x15f0f2['name'],_0x15f0f2['id']),util[_0xb2a9('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x266feb(_0x5c18b7);});}else{return _0x266feb(null,_0x4a70f3);}},'beforeUpdate':function(_0x37222b,_0x58e8bd,_0x2e1193){if(_0x37222b['changed'](_0xb2a9('0x10'))||_0x37222b[_0xb2a9('0xf')](_0xb2a9('0x11'))||_0x37222b[_0xb2a9('0xf')]('clientId')||_0x37222b[_0xb2a9('0xf')](_0xb2a9('0x12'))||_0x37222b[_0xb2a9('0xf')](_0xb2a9('0x13'))||_0x37222b[_0xb2a9('0xf')]('host')){var _0x105f26,_0x2dafe7;_0x105f26=_0x37222b[_0xb2a9('0x11')];var _0x4464ff=_0x105f26['slice'](-0x1);if(_0x4464ff==='/'||_0x4464ff==='\x5c'||_0x4464ff===':'){_0x105f26=_0x105f26['substring'](0x0,_0x105f26[_0xb2a9('0x17')](_0x4464ff));}switch(_0x37222b['zone']){case'US':_0x2dafe7=_0xb2a9('0x18');break;case'AU':_0x2dafe7='https://accounts.zoho.com.au';break;case'IN':_0x2dafe7=_0xb2a9('0x1a');break;case'CN':_0x2dafe7=_0xb2a9('0x1b');break;default:_0x2dafe7=_0xb2a9('0x2a');break;}var _0x43a65a={'method':_0xb2a9('0x2b'),'uri':_0x2dafe7+'/oauth/v2/token','form':{'grant_type':_0xb2a9('0x1d'),'client_id':_0x37222b[_0xb2a9('0x1e')],'client_secret':_0x37222b[_0xb2a9('0x12')],'redirect_uri':_0x37222b[_0xb2a9('0x11')],'code':_0x37222b[_0xb2a9('0x13')]},'headers':{'Content-Type':_0xb2a9('0x1f')}};return rp(_0x43a65a)[_0xb2a9('0x2c')](function(_0x36c1f4){var _0x409aee=JSON[_0xb2a9('0x20')](_0x36c1f4);if(_0x409aee[_0xb2a9('0x21')]){_0x37222b['refreshToken']=_0x409aee[_0xb2a9('0x21')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x37222b[_0xb2a9('0x25')],_0x37222b['id']));}else{logger[_0xb2a9('0x26')](util[_0xb2a9('0x23')](_0xb2a9('0x29'),_0x37222b['name'],_0x37222b['id']),util[_0xb2a9('0x27')](_0x409aee,{'showHidden':![],'depth':null}));}return _0x2e1193(null,_0x58e8bd);})[_0xb2a9('0x28')](function(_0x2dbc57){logger[_0xb2a9('0x26')](util['format'](_0xb2a9('0x29'),_0x37222b['name'],_0x37222b['id']),util[_0xb2a9('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e1193(_0x2dbc57);});}else{return _0x2e1193(null,_0x58e8bd);}}}});}; \ No newline at end of file +var _0xebc5=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','https://accounts.zoho.com.au','info','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x5709ba,_0x3c62ab){var _0x4aaf91=function(_0x4fd164){while(--_0x4fd164){_0x5709ba['push'](_0x5709ba['shift']());}};_0x4aaf91(++_0x3c62ab);}(_0xebc5,0x196));var _0x5ebc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xebc5[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x5ebc('0x0'));var util=require(_0x5ebc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5ebc('0x2'));var BPromise=require(_0x5ebc('0x3'));var rp=require(_0x5ebc('0x4'));var fs=require('fs');var path=require(_0x5ebc('0x5'));var rimraf=require(_0x5ebc('0x6'));var config=require(_0x5ebc('0x7'));var attributes=require(_0x5ebc('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5ebc('0x9')]=function(_0x247d90,_0x52dad5){return _0x247d90[_0x5ebc('0xa')]('ZohoAccount',attributes,{'tableName':_0x5ebc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43cdd2,_0x2e77c0,_0x473625){if(_0x43cdd2[_0x5ebc('0xc')](_0x5ebc('0xd'))||_0x43cdd2[_0x5ebc('0xc')](_0x5ebc('0xe'))||_0x43cdd2[_0x5ebc('0xc')](_0x5ebc('0xf'))||_0x43cdd2['changed'](_0x5ebc('0x10'))||_0x43cdd2[_0x5ebc('0xc')](_0x5ebc('0x11'))||_0x43cdd2[_0x5ebc('0xc')]('host')){var _0x481659,_0x2aa0a4;_0x481659=_0x43cdd2[_0x5ebc('0xe')];var _0x4fb54f=_0x481659[_0x5ebc('0x12')](-0x1);if(_0x4fb54f==='/'||_0x4fb54f==='\x5c'||_0x4fb54f===':'){_0x481659=_0x481659[_0x5ebc('0x13')](0x0,_0x481659[_0x5ebc('0x14')](_0x4fb54f));}switch(_0x43cdd2[_0x5ebc('0xd')]){case'US':_0x2aa0a4=_0x5ebc('0x15');break;case'AU':_0x2aa0a4='https://accounts.zoho.com.au';break;case'IN':_0x2aa0a4=_0x5ebc('0x16');break;case'CN':_0x2aa0a4=_0x5ebc('0x17');break;default:_0x2aa0a4=_0x5ebc('0x18');break;}var _0x436542={'method':_0x5ebc('0x19'),'uri':_0x2aa0a4+_0x5ebc('0x1a'),'form':{'grant_type':_0x5ebc('0x1b'),'client_id':_0x43cdd2[_0x5ebc('0xf')],'client_secret':_0x43cdd2['clientSecret'],'redirect_uri':_0x43cdd2[_0x5ebc('0xe')],'code':_0x43cdd2[_0x5ebc('0x11')]},'headers':{'Content-Type':_0x5ebc('0x1c')}};return rp(_0x436542)[_0x5ebc('0x1d')](function(_0x395566){var _0x55535f=JSON[_0x5ebc('0x1e')](_0x395566);if(_0x55535f[_0x5ebc('0x1f')]){_0x43cdd2[_0x5ebc('0x20')]=_0x55535f['refresh_token'];logger['info'](util['format'](_0x5ebc('0x21'),_0x43cdd2[_0x5ebc('0x22')],_0x43cdd2['id']));}else{logger[_0x5ebc('0x23')](util[_0x5ebc('0x24')](_0x5ebc('0x25'),_0x43cdd2['name'],_0x43cdd2['id']),util[_0x5ebc('0x26')](_0x55535f,{'showHidden':![],'depth':null}));}return _0x473625(null,_0x2e77c0);})[_0x5ebc('0x27')](function(_0xd6f233){logger[_0x5ebc('0x23')](util['format'](_0x5ebc('0x25'),_0x43cdd2[_0x5ebc('0x22')],_0x43cdd2['id']),util[_0x5ebc('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x473625(_0xd6f233);});}else{return _0x473625(null,_0x2e77c0);}},'beforeUpdate':function(_0x4d832a,_0x2020df,_0x16d5a2){if(_0x4d832a[_0x5ebc('0xc')](_0x5ebc('0xd'))||_0x4d832a[_0x5ebc('0xc')]('serverUrl')||_0x4d832a[_0x5ebc('0xc')]('clientId')||_0x4d832a[_0x5ebc('0xc')]('clientSecret')||_0x4d832a[_0x5ebc('0xc')](_0x5ebc('0x11'))||_0x4d832a[_0x5ebc('0xc')](_0x5ebc('0x28'))){var _0x4d0984,_0x3a9bd9;_0x4d0984=_0x4d832a[_0x5ebc('0xe')];var _0x4d9d03=_0x4d0984[_0x5ebc('0x12')](-0x1);if(_0x4d9d03==='/'||_0x4d9d03==='\x5c'||_0x4d9d03===':'){_0x4d0984=_0x4d0984[_0x5ebc('0x13')](0x0,_0x4d0984[_0x5ebc('0x14')](_0x4d9d03));}switch(_0x4d832a[_0x5ebc('0xd')]){case'US':_0x3a9bd9=_0x5ebc('0x15');break;case'AU':_0x3a9bd9=_0x5ebc('0x29');break;case'IN':_0x3a9bd9='https://accounts.zoho.in';break;case'CN':_0x3a9bd9=_0x5ebc('0x17');break;default:_0x3a9bd9=_0x5ebc('0x18');break;}var _0x4e1379={'method':_0x5ebc('0x19'),'uri':_0x3a9bd9+_0x5ebc('0x1a'),'form':{'grant_type':_0x5ebc('0x1b'),'client_id':_0x4d832a[_0x5ebc('0xf')],'client_secret':_0x4d832a[_0x5ebc('0x10')],'redirect_uri':_0x4d832a[_0x5ebc('0xe')],'code':_0x4d832a[_0x5ebc('0x11')]},'headers':{'Content-Type':_0x5ebc('0x1c')}};return rp(_0x4e1379)[_0x5ebc('0x1d')](function(_0x455d0d){var _0x2c665b=JSON[_0x5ebc('0x1e')](_0x455d0d);if(_0x2c665b['refresh_token']){_0x4d832a[_0x5ebc('0x20')]=_0x2c665b[_0x5ebc('0x1f')];logger[_0x5ebc('0x2a')](util[_0x5ebc('0x24')](_0x5ebc('0x21'),_0x4d832a['name'],_0x4d832a['id']));}else{logger[_0x5ebc('0x23')](util[_0x5ebc('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4d832a['name'],_0x4d832a['id']),util[_0x5ebc('0x26')](_0x2c665b,{'showHidden':![],'depth':null}));}return _0x16d5a2(null,_0x2020df);})['catch'](function(_0x43ebdc){logger['error'](util[_0x5ebc('0x24')](_0x5ebc('0x25'),_0x4d832a[_0x5ebc('0x22')],_0x4d832a['id']),util[_0x5ebc('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x16d5a2(_0x43ebdc);});}else{return _0x16d5a2(null,_0x2020df);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a1ae672..0448633 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 _0xcd01=['ShowZohoAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','options','where','attributes','map','include','model'];(function(_0x586688,_0x24d0b1){var _0x5cd28d=function(_0x3ae107){while(--_0x3ae107){_0x586688['push'](_0x586688['shift']());}};_0x5cd28d(++_0x24d0b1);}(_0xcd01,0xe3));var _0x1cd0=function(_0x36acd3,_0x1b3455){_0x36acd3=_0x36acd3-0x0;var _0x3e6dc3=_0xcd01[_0x36acd3];return _0x3e6dc3;};'use strict';var _=require(_0x1cd0('0x0'));var util=require('util');var moment=require(_0x1cd0('0x1'));var BPromise=require(_0x1cd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd0('0x3'));var db=require(_0x1cd0('0x4'))['db'];var utils=require(_0x1cd0('0x5'));var logger=require(_0x1cd0('0x6'))('rpc');var config=require(_0x1cd0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1cd0('0x8')][_0x1cd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x156073,_0x11316e,_0x441cef){return new BPromise(function(_0x41d1b0,_0x31aa3f){return client[_0x1cd0('0xa')](_0x156073,_0x441cef)[_0x1cd0('0xb')](function(_0x4f15ca){logger[_0x1cd0('0xc')](_0x1cd0('0xd'),_0x11316e,'request\x20sent');logger[_0x1cd0('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x11316e,_0x1cd0('0xf'),JSON[_0x1cd0('0x10')](_0x4f15ca));if(_0x4f15ca[_0x1cd0('0x11')]){if(_0x4f15ca['error'][_0x1cd0('0x12')]===0x1f4){logger[_0x1cd0('0x11')](_0x1cd0('0xd'),_0x11316e,_0x4f15ca[_0x1cd0('0x11')][_0x1cd0('0x13')]);return _0x31aa3f(_0x4f15ca['error']['message']);}logger[_0x1cd0('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x11316e,_0x4f15ca[_0x1cd0('0x11')][_0x1cd0('0x13')]);return _0x41d1b0(_0x4f15ca['error']['message']);}else{logger[_0x1cd0('0xc')](_0x1cd0('0xd'),_0x11316e,_0x1cd0('0xf'));_0x41d1b0(_0x4f15ca[_0x1cd0('0x14')]['message']);}})[_0x1cd0('0x15')](function(_0x6a2605){logger[_0x1cd0('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x11316e,_0x6a2605);_0x31aa3f(_0x6a2605);});});}exports[_0x1cd0('0x16')]=function(_0x58dee0){var _0x10a5cb=this;return new Promise(function(_0x339e54,_0x4f1f0e){return db['ZohoAccount']['findAll']({'raw':_0x58dee0['options']?_0x58dee0[_0x1cd0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58dee0[_0x1cd0('0x17')]?_0x58dee0[_0x1cd0('0x17')][_0x1cd0('0x18')]||null:null,'attributes':_0x58dee0[_0x1cd0('0x17')]?_0x58dee0[_0x1cd0('0x17')][_0x1cd0('0x19')]||null:null,'limit':_0x58dee0['options']?_0x58dee0[_0x1cd0('0x17')]['limit']||null:null,'include':_0x58dee0['options']?_0x58dee0['options']['include']?_[_0x1cd0('0x1a')](_0x58dee0['options'][_0x1cd0('0x1b')],function(_0xdc6612){return{'model':db[_0xdc6612[_0x1cd0('0x1c')]],'as':_0xdc6612['as'],'attributes':_0xdc6612['attributes'],'include':_0xdc6612[_0x1cd0('0x1b')]?_[_0x1cd0('0x1a')](_0xdc6612[_0x1cd0('0x1b')],function(_0x513952){return{'model':db[_0x513952[_0x1cd0('0x1c')]],'as':_0x513952['as'],'attributes':_0x513952[_0x1cd0('0x19')],'include':_0x513952[_0x1cd0('0x1b')]?_[_0x1cd0('0x1a')](_0x513952[_0x1cd0('0x1b')],function(_0x5bec74){return{'model':db[_0x5bec74[_0x1cd0('0x1c')]],'as':_0x5bec74['as'],'attributes':_0x5bec74[_0x1cd0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cd0('0xb')](function(_0x41ef64){logger['info']('GetZohoAccount',_0x58dee0);logger[_0x1cd0('0xe')]('GetZohoAccount',_0x58dee0,JSON[_0x1cd0('0x10')](_0x41ef64));_0x339e54(_0x41ef64);})[_0x1cd0('0x15')](function(_0x48028){logger['error'](_0x1cd0('0x16'),_0x48028[_0x1cd0('0x13')],_0x58dee0);_0x4f1f0e(_0x10a5cb[_0x1cd0('0x11')](0x1f4,_0x48028[_0x1cd0('0x13')]));});});};exports[_0x1cd0('0x1d')]=function(_0x3a217c){var _0x47d1f4=this;return new Promise(function(_0xf278d0,_0x47ee6d){return db['ZohoAccount'][_0x1cd0('0x1e')]({'raw':_0x3a217c[_0x1cd0('0x17')]?_0x3a217c[_0x1cd0('0x17')][_0x1cd0('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a217c[_0x1cd0('0x17')]?_0x3a217c[_0x1cd0('0x17')]['where']||null:null,'attributes':_0x3a217c['options']?_0x3a217c['options'][_0x1cd0('0x19')]||null:null,'include':_0x3a217c[_0x1cd0('0x17')]?_0x3a217c['options'][_0x1cd0('0x1b')]?_['map'](_0x3a217c[_0x1cd0('0x17')][_0x1cd0('0x1b')],function(_0x53fbe3){return{'model':db[_0x53fbe3[_0x1cd0('0x1c')]],'as':_0x53fbe3['as'],'attributes':_0x53fbe3['attributes'],'include':_0x53fbe3['include']?_[_0x1cd0('0x1a')](_0x53fbe3[_0x1cd0('0x1b')],function(_0x24fbfa){return{'model':db[_0x24fbfa[_0x1cd0('0x1c')]],'as':_0x24fbfa['as'],'attributes':_0x24fbfa[_0x1cd0('0x19')],'include':_0x24fbfa['include']?_['map'](_0x24fbfa[_0x1cd0('0x1b')],function(_0x569f94){return{'model':db[_0x569f94[_0x1cd0('0x1c')]],'as':_0x569f94['as'],'attributes':_0x569f94[_0x1cd0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cd0('0xb')](function(_0x2bc379){logger[_0x1cd0('0xc')](_0x1cd0('0x1d'),_0x3a217c);logger[_0x1cd0('0xe')](_0x1cd0('0x1d'),_0x3a217c,JSON[_0x1cd0('0x10')](_0x2bc379));_0xf278d0(_0x2bc379);})[_0x1cd0('0x15')](function(_0x4f6e6d){logger[_0x1cd0('0x11')](_0x1cd0('0x1d'),_0x4f6e6d[_0x1cd0('0x13')],_0x3a217c);_0x47ee6d(_0x47d1f4[_0x1cd0('0x11')](0x1f4,_0x4f6e6d[_0x1cd0('0x13')]));});});}; \ No newline at end of file +var _0x9060=['find','ShowZohoAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','info','result','catch','findAll','options','raw','where','attributes','include','map','model','GetZohoAccount'];(function(_0x42e455,_0x351c7f){var _0x1c252a=function(_0x2d5045){while(--_0x2d5045){_0x42e455['push'](_0x42e455['shift']());}};_0x1c252a(++_0x351c7f);}(_0x9060,0x1f1));var _0x0906=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x9060[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0906('0x0'));var BPromise=require(_0x0906('0x1'));var rs=require(_0x0906('0x2'));var fs=require('fs');var Redis=require(_0x0906('0x3'));var db=require(_0x0906('0x4'))['db'];var utils=require(_0x0906('0x5'));var logger=require(_0x0906('0x6'))(_0x0906('0x7'));var config=require('../../config/environment');var jayson=require(_0x0906('0x8'));var client=jayson['client'][_0x0906('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4041b0,_0x4654b4,_0x4f4ab4){return new BPromise(function(_0x2661d7,_0x12d237){return client[_0x0906('0xa')](_0x4041b0,_0x4f4ab4)[_0x0906('0xb')](function(_0x6a8418){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x4654b4,_0x0906('0xc'));logger[_0x0906('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4654b4,_0x0906('0xc'),JSON[_0x0906('0xe')](_0x6a8418));if(_0x6a8418[_0x0906('0xf')]){if(_0x6a8418[_0x0906('0xf')][_0x0906('0x10')]===0x1f4){logger[_0x0906('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4654b4,_0x6a8418[_0x0906('0xf')][_0x0906('0x11')]);return _0x12d237(_0x6a8418['error']['message']);}logger[_0x0906('0xf')](_0x0906('0x12'),_0x4654b4,_0x6a8418['error'][_0x0906('0x11')]);return _0x2661d7(_0x6a8418[_0x0906('0xf')]['message']);}else{logger[_0x0906('0x13')](_0x0906('0x12'),_0x4654b4,'request\x20sent');_0x2661d7(_0x6a8418[_0x0906('0x14')][_0x0906('0x11')]);}})[_0x0906('0x15')](function(_0x3ea130){logger[_0x0906('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4654b4,_0x3ea130);_0x12d237(_0x3ea130);});});}exports['GetZohoAccount']=function(_0x5774f7){var _0x327dee=this;return new Promise(function(_0x43e126,_0x3c7c28){return db['ZohoAccount'][_0x0906('0x16')]({'raw':_0x5774f7[_0x0906('0x17')]?_0x5774f7[_0x0906('0x17')][_0x0906('0x18')]===undefined?!![]:![]:!![],'where':_0x5774f7[_0x0906('0x17')]?_0x5774f7[_0x0906('0x17')][_0x0906('0x19')]||null:null,'attributes':_0x5774f7[_0x0906('0x17')]?_0x5774f7[_0x0906('0x17')][_0x0906('0x1a')]||null:null,'limit':_0x5774f7[_0x0906('0x17')]?_0x5774f7[_0x0906('0x17')]['limit']||null:null,'include':_0x5774f7[_0x0906('0x17')]?_0x5774f7[_0x0906('0x17')][_0x0906('0x1b')]?_[_0x0906('0x1c')](_0x5774f7[_0x0906('0x17')][_0x0906('0x1b')],function(_0x188a8b){return{'model':db[_0x188a8b[_0x0906('0x1d')]],'as':_0x188a8b['as'],'attributes':_0x188a8b['attributes'],'include':_0x188a8b[_0x0906('0x1b')]?_['map'](_0x188a8b['include'],function(_0x171026){return{'model':db[_0x171026[_0x0906('0x1d')]],'as':_0x171026['as'],'attributes':_0x171026['attributes'],'include':_0x171026[_0x0906('0x1b')]?_[_0x0906('0x1c')](_0x171026[_0x0906('0x1b')],function(_0x10f413){return{'model':db[_0x10f413[_0x0906('0x1d')]],'as':_0x10f413['as'],'attributes':_0x10f413[_0x0906('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0906('0xb')](function(_0x440612){logger['info']('GetZohoAccount',_0x5774f7);logger[_0x0906('0xd')](_0x0906('0x1e'),_0x5774f7,JSON[_0x0906('0xe')](_0x440612));_0x43e126(_0x440612);})[_0x0906('0x15')](function(_0x2e7d60){logger[_0x0906('0xf')]('GetZohoAccount',_0x2e7d60[_0x0906('0x11')],_0x5774f7);_0x3c7c28(_0x327dee[_0x0906('0xf')](0x1f4,_0x2e7d60['message']));});});};exports['ShowZohoAccount']=function(_0x273262){var _0x354c30=this;return new Promise(function(_0x507a50,_0x4d075f){return db['ZohoAccount'][_0x0906('0x1f')]({'raw':_0x273262['options']?_0x273262[_0x0906('0x17')][_0x0906('0x18')]===undefined?!![]:![]:!![],'where':_0x273262[_0x0906('0x17')]?_0x273262['options'][_0x0906('0x19')]||null:null,'attributes':_0x273262['options']?_0x273262['options'][_0x0906('0x1a')]||null:null,'include':_0x273262['options']?_0x273262['options'][_0x0906('0x1b')]?_['map'](_0x273262[_0x0906('0x17')][_0x0906('0x1b')],function(_0x74590){return{'model':db[_0x74590[_0x0906('0x1d')]],'as':_0x74590['as'],'attributes':_0x74590[_0x0906('0x1a')],'include':_0x74590['include']?_[_0x0906('0x1c')](_0x74590[_0x0906('0x1b')],function(_0x1c5fa7){return{'model':db[_0x1c5fa7[_0x0906('0x1d')]],'as':_0x1c5fa7['as'],'attributes':_0x1c5fa7['attributes'],'include':_0x1c5fa7[_0x0906('0x1b')]?_[_0x0906('0x1c')](_0x1c5fa7[_0x0906('0x1b')],function(_0x4331aa){return{'model':db[_0x4331aa['model']],'as':_0x4331aa['as'],'attributes':_0x4331aa[_0x0906('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0906('0xb')](function(_0x3692c1){logger['info'](_0x0906('0x20'),_0x273262);logger[_0x0906('0xd')](_0x0906('0x20'),_0x273262,JSON[_0x0906('0xe')](_0x3692c1));_0x507a50(_0x3692c1);})[_0x0906('0x15')](function(_0x2de691){logger[_0x0906('0xf')]('ShowZohoAccount',_0x2de691['message'],_0x273262);_0x4d075f(_0x354c30[_0x0906('0xf')](0x1f4,_0x2de691['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2a956e6..8c70060 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 _0x2182=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x198439,_0xbfa980){var _0xbfdbc2=function(_0x391173){while(--_0x391173){_0x198439['push'](_0x198439['shift']());}};_0xbfdbc2(++_0xbfa980);}(_0x2182,0xea));var _0x2218=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2182[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var path=require(_0x2218('0x2'));var timeout=require(_0x2218('0x3'));var express=require('express');var router=express[_0x2218('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2218('0x5'));var config=require(_0x2218('0x6'));var controller=require(_0x2218('0x7'));router[_0x2218('0x8')]('/',auth[_0x2218('0x9')](),controller[_0x2218('0xa')]);router[_0x2218('0x8')](_0x2218('0xb'),auth[_0x2218('0x9')](),controller[_0x2218('0xc')]);router['get'](_0x2218('0xd'),auth[_0x2218('0x9')](),controller[_0x2218('0xe')]);router[_0x2218('0x8')]('/:id/subjects',auth[_0x2218('0x9')](),controller[_0x2218('0xf')]);router[_0x2218('0x8')](_0x2218('0x10'),auth['isAuthenticated'](),controller[_0x2218('0x11')]);router[_0x2218('0x12')]('/',auth[_0x2218('0x9')](),controller[_0x2218('0x13')]);router[_0x2218('0x14')]('/:id',auth[_0x2218('0x9')](),controller['update']);router[_0x2218('0x15')](_0x2218('0xb'),auth[_0x2218('0x9')](),controller[_0x2218('0x16')]);module[_0x2218('0x17')]=router; \ No newline at end of file +var _0x8533=['util','path','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer'];(function(_0x174cf1,_0x3d935e){var _0x19b6b4=function(_0x57bd7d){while(--_0x57bd7d){_0x174cf1['push'](_0x174cf1['shift']());}};_0x19b6b4(++_0x3d935e);}(_0x8533,0x141));var _0x3853=function(_0x28d73c,_0x455fd9){_0x28d73c=_0x28d73c-0x0;var _0x40dd38=_0x8533[_0x28d73c];return _0x40dd38;};'use strict';var multer=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var path=require(_0x3853('0x2'));var timeout=require('connect-timeout');var express=require(_0x3853('0x3'));var router=express[_0x3853('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3853('0x5'));var config=require('../../config/environment');var controller=require(_0x3853('0x6'));router['get']('/',auth[_0x3853('0x7')](),controller[_0x3853('0x8')]);router[_0x3853('0x9')](_0x3853('0xa'),auth['isAuthenticated'](),controller[_0x3853('0xb')]);router[_0x3853('0x9')](_0x3853('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x3853('0x9')](_0x3853('0xd'),auth[_0x3853('0x7')](),controller[_0x3853('0xe')]);router['get'](_0x3853('0xf'),auth[_0x3853('0x7')](),controller[_0x3853('0x10')]);router[_0x3853('0x11')]('/',auth[_0x3853('0x7')](),controller[_0x3853('0x12')]);router['put'](_0x3853('0xa'),auth[_0x3853('0x7')](),controller[_0x3853('0x13')]);router[_0x3853('0x14')]('/:id',auth[_0x3853('0x7')](),controller[_0x3853('0x15')]);module[_0x3853('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index bc41be5..7e15478 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 _0x287a=['contact_lead','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x287a,0xe1));var _0xa287=function(_0xc6e9d,_0x4c0aac){_0xc6e9d=_0xc6e9d-0x0;var _0x1ddff1=_0x287a[_0xc6e9d];return _0x1ddff1;};'use strict';var Sequelize=require('sequelize');module[_0xa287('0x0')]={'name':{'type':Sequelize[_0xa287('0x1')]},'moduleCreate':{'type':Sequelize[_0xa287('0x2')](_0xa287('0x3'),_0xa287('0x4'),_0xa287('0x5')),'defaultValue':_0xa287('0x3')},'moduleSearch':{'type':Sequelize[_0xa287('0x2')](_0xa287('0x6'),_0xa287('0x4'),_0xa287('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xa287('0x1')]}}; \ No newline at end of file +var _0xd476=['sequelize','exports','ENUM','contact','nothing','lead','contact_lead','STRING'];(function(_0x5011fe,_0x46d921){var _0x5e6f08=function(_0x1199e2){while(--_0x1199e2){_0x5011fe['push'](_0x5011fe['shift']());}};_0x5e6f08(++_0x46d921);}(_0xd476,0xd8));var _0x6d47=function(_0x5a7922,_0x46f439){_0x5a7922=_0x5a7922-0x0;var _0x33eb94=_0xd476[_0x5a7922];return _0x33eb94;};'use strict';var Sequelize=require(_0x6d47('0x0'));module[_0x6d47('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x6d47('0x2')]('lead',_0x6d47('0x3'),_0x6d47('0x4')),'defaultValue':_0x6d47('0x5')},'moduleSearch':{'type':Sequelize[_0x6d47('0x2')](_0x6d47('0x6'),'contact',_0x6d47('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x6d47('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8ff8e86..c3ca580 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c2bbc2f..c2a1007 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 _0xd388=['../../config/environment','./intZohoConfiguration.attributes','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc243d,_0x46e5b6){var _0x36f320=function(_0x4c6e28){while(--_0x4c6e28){_0xc243d['push'](_0xc243d['shift']());}};_0x36f320(++_0x46e5b6);}(_0xd388,0x121));var _0x8d38=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xd388[_0x4232d8];return _0x324de2;};'use strict';var _=require('lodash');var util=require(_0x8d38('0x0'));var logger=require(_0x8d38('0x1'))(_0x8d38('0x2'));var moment=require(_0x8d38('0x3'));var BPromise=require(_0x8d38('0x4'));var rp=require(_0x8d38('0x5'));var fs=require('fs');var path=require(_0x8d38('0x6'));var rimraf=require(_0x8d38('0x7'));var config=require(_0x8d38('0x8'));var attributes=require(_0x8d38('0x9'));module['exports']=function(_0x428e8c,_0x581217){return _0x428e8c['define']('ZohoConfiguration',attributes,{'tableName':_0x8d38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x079d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x079d,0x15a));var _0xd079=function(_0x3d3e6a,_0x3ac662){_0x3d3e6a=_0x3d3e6a-0x0;var _0x389380=_0x079d[_0x3d3e6a];return _0x389380;};'use strict';var _=require(_0xd079('0x0'));var util=require(_0xd079('0x1'));var logger=require(_0xd079('0x2'))(_0xd079('0x3'));var moment=require('moment');var BPromise=require(_0xd079('0x4'));var rp=require(_0xd079('0x5'));var fs=require('fs');var path=require(_0xd079('0x6'));var rimraf=require(_0xd079('0x7'));var config=require(_0xd079('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x390340,_0x44afe9){return _0x390340[_0xd079('0x9')](_0xd079('0xa'),attributes,{'tableName':_0xd079('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 1ea3a6e..b97ca5e 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 _0xb427=['catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x135760,_0x1c8706){var _0x39e4da=function(_0x47fabc){while(--_0x47fabc){_0x135760['push'](_0x135760['shift']());}};_0x39e4da(++_0x1c8706);}(_0xb427,0x17d));var _0x7b42=function(_0x11c297,_0x4ae7cd){_0x11c297=_0x11c297-0x0;var _0x45675e=_0xb427[_0x11c297];return _0x45675e;};'use strict';var _=require(_0x7b42('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b42('0x1'));var db=require(_0x7b42('0x2'))['db'];var utils=require(_0x7b42('0x3'));var logger=require(_0x7b42('0x4'))(_0x7b42('0x5'));var config=require(_0x7b42('0x6'));var jayson=require(_0x7b42('0x7'));var client=jayson['client'][_0x7b42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x492544,_0x310512,_0x4041b8){return new BPromise(function(_0x257bd2,_0x44c74f){return client['request'](_0x492544,_0x4041b8)[_0x7b42('0x9')](function(_0x21a5ac){logger[_0x7b42('0xa')](_0x7b42('0xb'),_0x310512,'request\x20sent');logger[_0x7b42('0xc')](_0x7b42('0xd'),_0x310512,_0x7b42('0xe'),JSON[_0x7b42('0xf')](_0x21a5ac));if(_0x21a5ac[_0x7b42('0x10')]){if(_0x21a5ac[_0x7b42('0x10')]['code']===0x1f4){logger[_0x7b42('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x310512,_0x21a5ac[_0x7b42('0x10')][_0x7b42('0x11')]);return _0x44c74f(_0x21a5ac[_0x7b42('0x10')][_0x7b42('0x11')]);}logger[_0x7b42('0x10')](_0x7b42('0xb'),_0x310512,_0x21a5ac[_0x7b42('0x10')][_0x7b42('0x11')]);return _0x257bd2(_0x21a5ac[_0x7b42('0x10')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x310512,_0x7b42('0xe'));_0x257bd2(_0x21a5ac[_0x7b42('0x12')][_0x7b42('0x11')]);}})[_0x7b42('0x13')](function(_0x219301){logger[_0x7b42('0x10')](_0x7b42('0xb'),_0x310512,_0x219301);_0x44c74f(_0x219301);});});} \ No newline at end of file +var _0x5371=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x5371,0x10d));var _0x1537=function(_0x100922,_0xea3729){_0x100922=_0x100922-0x0;var _0x4f1245=_0x5371[_0x100922];return _0x4f1245;};'use strict';var _=require('lodash');var util=require(_0x1537('0x0'));var moment=require(_0x1537('0x1'));var BPromise=require(_0x1537('0x2'));var rs=require(_0x1537('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1537('0x4'))['db'];var utils=require(_0x1537('0x5'));var logger=require(_0x1537('0x6'))(_0x1537('0x7'));var config=require(_0x1537('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1537('0x9')][_0x1537('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199a23,_0x123e4b,_0x3b2c89){return new BPromise(function(_0x57b6a4,_0xf40a5a){return client['request'](_0x199a23,_0x3b2c89)[_0x1537('0xb')](function(_0x35fbdf){logger['info'](_0x1537('0xc'),_0x123e4b,'request\x20sent');logger['debug'](_0x1537('0xd'),_0x123e4b,_0x1537('0xe'),JSON[_0x1537('0xf')](_0x35fbdf));if(_0x35fbdf[_0x1537('0x10')]){if(_0x35fbdf[_0x1537('0x10')][_0x1537('0x11')]===0x1f4){logger[_0x1537('0x10')](_0x1537('0xc'),_0x123e4b,_0x35fbdf[_0x1537('0x10')][_0x1537('0x12')]);return _0xf40a5a(_0x35fbdf['error'][_0x1537('0x12')]);}logger['error'](_0x1537('0xc'),_0x123e4b,_0x35fbdf[_0x1537('0x10')]['message']);return _0x57b6a4(_0x35fbdf[_0x1537('0x10')][_0x1537('0x12')]);}else{logger[_0x1537('0x13')](_0x1537('0xc'),_0x123e4b,'request\x20sent');_0x57b6a4(_0x35fbdf['result']['message']);}})[_0x1537('0x14')](function(_0x606a03){logger[_0x1537('0x10')](_0x1537('0xc'),_0x123e4b,_0x606a03);_0xf40a5a(_0x606a03);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 98765a7..5a7e805 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 _0x85ff=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x19d969,_0x2d84f6){var _0x7ba25=function(_0x39f21e){while(--_0x39f21e){_0x19d969['push'](_0x19d969['shift']());}};_0x7ba25(++_0x2d84f6);}(_0x85ff,0x1d1));var _0xf85f=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x85ff[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xf85f('0x0'));var util=require(_0xf85f('0x1'));var path=require('path');var timeout=require(_0xf85f('0x2'));var express=require(_0xf85f('0x3'));var router=express[_0xf85f('0x4')]();var auth=require(_0xf85f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf85f('0x6'));var controller=require(_0xf85f('0x7'));router[_0xf85f('0x8')]('/',auth[_0xf85f('0x9')](),controller[_0xf85f('0xa')]);router[_0xf85f('0x8')](_0xf85f('0xb'),auth['isAuthenticated'](),controller[_0xf85f('0xc')]);router[_0xf85f('0xd')]('/',auth[_0xf85f('0x9')](),controller[_0xf85f('0xe')]);router[_0xf85f('0xf')](_0xf85f('0xb'),auth[_0xf85f('0x9')](),controller[_0xf85f('0x10')]);router[_0xf85f('0x11')]('/:id',auth[_0xf85f('0x9')](),controller[_0xf85f('0x12')]);module[_0xf85f('0x13')]=router; \ No newline at end of file +var _0xda56=['express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','delete','multer','connect-timeout'];(function(_0x5de5be,_0xdca74c){var _0x2b6aa7=function(_0x471f4b){while(--_0x471f4b){_0x5de5be['push'](_0x5de5be['shift']());}};_0x2b6aa7(++_0xdca74c);}(_0xda56,0x18a));var _0x6da5=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0xda56[_0x5bb3a6];return _0x279273;};'use strict';var multer=require(_0x6da5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6da5('0x1'));var express=require(_0x6da5('0x2'));var router=express[_0x6da5('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6da5('0x4'));var controller=require('./intZohoField.controller');router[_0x6da5('0x5')]('/',auth[_0x6da5('0x6')](),controller[_0x6da5('0x7')]);router[_0x6da5('0x5')](_0x6da5('0x8'),auth[_0x6da5('0x6')](),controller[_0x6da5('0x9')]);router['post']('/',auth[_0x6da5('0x6')](),controller['create']);router['put']('/:id',auth[_0x6da5('0x6')](),controller['update']);router[_0x6da5('0xa')](_0x6da5('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 44b6b55..b72731c 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 _0x4c4e=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x58f3ef,_0x348532){var _0xc96ec1=function(_0x44f19a){while(--_0x44f19a){_0x58f3ef['push'](_0x58f3ef['shift']());}};_0xc96ec1(++_0x348532);}(_0x4c4e,0x152));var _0xe4c4=function(_0x380b96,_0x4465ef){_0x380b96=_0x380b96-0x0;var _0x20a8a9=_0x4c4e[_0x380b96];return _0x20a8a9;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xe4c4('0x1')](_0xe4c4('0x2'),_0xe4c4('0x3'),'customVariable',_0xe4c4('0x4'),_0xe4c4('0x5')),'defaultValue':_0xe4c4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe4c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe4c4('0x2'),_0xe4c4('0x3'),_0xe4c4('0x7'))},'keyContent':{'type':Sequelize[_0xe4c4('0x6')]},'idField':{'type':Sequelize[_0xe4c4('0x6')]},'nameField':{'type':Sequelize[_0xe4c4('0x6')]},'customField':{'type':Sequelize[_0xe4c4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c4('0x6')]}}; \ No newline at end of file +var _0x8664=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2f05d0,_0x5d7bea){var _0x5762d0=function(_0x2d47eb){while(--_0x2d47eb){_0x2f05d0['push'](_0x2f05d0['shift']());}};_0x5762d0(++_0x5d7bea);}(_0x8664,0x11a));var _0x4866=function(_0x1ab342,_0x92ea3c){_0x1ab342=_0x1ab342-0x0;var _0x3751d1=_0x8664[_0x1ab342];return _0x3751d1;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'type':{'type':Sequelize[_0x4866('0x2')](_0x4866('0x3'),_0x4866('0x4'),_0x4866('0x5'),_0x4866('0x6'),_0x4866('0x7')),'defaultValue':_0x4866('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4866('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4866('0x3'),_0x4866('0x4'),_0x4866('0x5'))},'keyContent':{'type':Sequelize[_0x4866('0x8')]},'idField':{'type':Sequelize[_0x4866('0x8')]},'nameField':{'type':Sequelize[_0x4866('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4866('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f03c1a3..331bf50 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 _0xfd33=['Content-Range','apply','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','options','ZohoField','includeAll','include','findAll','then','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x642658,_0x1c0378){var _0x33e409=function(_0x54f6f3){while(--_0x54f6f3){_0x642658['push'](_0x642658['shift']());}};_0x33e409(++_0x1c0378);}(_0xfd33,0x14f));var _0x3fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd33[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3fd3('0x0'));var emlformat=require(_0x3fd3('0x1'));var rimraf=require(_0x3fd3('0x2'));var zipdir=require(_0x3fd3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fd3('0x4'));var moment=require(_0x3fd3('0x5'));var BPromise=require(_0x3fd3('0x6'));var Mustache=require('mustache');var util=require(_0x3fd3('0x7'));var path=require('path');var sox=require(_0x3fd3('0x8'));var csv=require(_0x3fd3('0x9'));var ejs=require(_0x3fd3('0xa'));var fs=require('fs');var _=require(_0x3fd3('0xb'));var squel=require(_0x3fd3('0xc'));var crypto=require(_0x3fd3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3fd3('0xe'));var toCsv=require(_0x3fd3('0x9'));var querystring=require(_0x3fd3('0xf'));var Papa=require(_0x3fd3('0x10'));var Redis=require(_0x3fd3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3fd3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fd3('0x13'));var logger=require(_0x3fd3('0x14'))('api');var utils=require(_0x3fd3('0x15'));var config=require(_0x3fd3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fd3('0x17'))['db'];function respondWithStatusCode(_0x483641,_0x415b3e){_0x415b3e=_0x415b3e||0xcc;return function(_0x4b9b03){if(_0x4b9b03){return _0x483641[_0x3fd3('0x18')](_0x415b3e);}return _0x483641[_0x3fd3('0x19')](_0x415b3e)[_0x3fd3('0x1a')]();};}function respondWithResult(_0x4b929c,_0x3714d3){_0x3714d3=_0x3714d3||0xc8;return function(_0x2e438f){if(_0x2e438f){return _0x4b929c['status'](_0x3714d3)[_0x3fd3('0x1b')](_0x2e438f);}};}function respondWithFilteredResult(_0xa0663f,_0x2064b3){return function(_0x2fa082){if(_0x2fa082){var _0x3a4186=_0x2fa082[_0x3fd3('0x1c')],_0x273cf3=_0x2064b3[_0x3fd3('0x1d')],_0x317085=_0x2064b3[_0x3fd3('0x1d')]+_0x2064b3['limit'],_0x598050;if(_0x317085>=_0x3a4186){_0x317085=_0x3a4186;_0x598050=0xc8;}else{_0x598050=0xce;}_0xa0663f[_0x3fd3('0x19')](_0x598050);return _0xa0663f['set'](_0x3fd3('0x1e'),_0x273cf3+'-'+_0x317085+'/'+_0x3a4186)['json'](_0x2fa082);}return null;};}function patchUpdates(_0x182c5c){return function(_0x3e704b){try{jsonpatch[_0x3fd3('0x1f')](_0x3e704b,_0x182c5c,!![]);}catch(_0x926194){return BPromise['reject'](_0x926194);}return _0x3e704b['save']();};}function saveUpdates(_0x134afe,_0x4f49dc){return function(_0x4c1742){if(_0x4c1742){return _0x4c1742[_0x3fd3('0x20')](_0x134afe)['then'](function(_0x2bf255){return _0x2bf255;});}return null;};}function removeEntity(_0x5d42e0,_0x1e617d){return function(_0x364c25){if(_0x364c25){return _0x364c25[_0x3fd3('0x21')]()['then'](function(){_0x5d42e0[_0x3fd3('0x19')](0xcc)[_0x3fd3('0x1a')]();});}};}function handleEntityNotFound(_0x4499b0,_0x34c994){return function(_0x121f33){if(!_0x121f33){_0x4499b0[_0x3fd3('0x18')](0x194);}return _0x121f33;};}function handleError(_0x2fb115,_0x1fe01d){_0x1fe01d=_0x1fe01d||0x1f4;return function(_0xdcd589){logger[_0x3fd3('0x22')](_0xdcd589[_0x3fd3('0x23')]);if(_0xdcd589[_0x3fd3('0x24')]){delete _0xdcd589[_0x3fd3('0x24')];}_0x2fb115[_0x3fd3('0x19')](_0x1fe01d)[_0x3fd3('0x25')](_0xdcd589);};}exports[_0x3fd3('0x26')]=function(_0x46c1b1,_0x1c3d78){var _0x57dce0={},_0x106a03={},_0x43171d={'count':0x0,'rows':[]};var _0x96be09=_[_0x3fd3('0x27')](db['ZohoField'][_0x3fd3('0x28')],function(_0x5633a7){return{'name':_0x5633a7[_0x3fd3('0x29')],'type':_0x5633a7[_0x3fd3('0x2a')][_0x3fd3('0x2b')]};});_0x106a03[_0x3fd3('0x2c')]=_['map'](_0x96be09,_0x3fd3('0x24'));_0x106a03[_0x3fd3('0x2d')]=_[_0x3fd3('0x2e')](_0x46c1b1['query']);_0x106a03['filters']=_[_0x3fd3('0x2f')](_0x106a03[_0x3fd3('0x2c')],_0x106a03['query']);_0x57dce0[_0x3fd3('0x30')]=_[_0x3fd3('0x2f')](_0x106a03['model'],qs[_0x3fd3('0x31')](_0x46c1b1[_0x3fd3('0x2d')][_0x3fd3('0x31')]));_0x57dce0[_0x3fd3('0x30')]=_0x57dce0['attributes']['length']?_0x57dce0['attributes']:_0x106a03['model'];if(!_0x46c1b1[_0x3fd3('0x2d')][_0x3fd3('0x32')](_0x3fd3('0x33'))){_0x57dce0[_0x3fd3('0x34')]=qs[_0x3fd3('0x34')](_0x46c1b1[_0x3fd3('0x2d')][_0x3fd3('0x34')]);_0x57dce0['offset']=qs[_0x3fd3('0x1d')](_0x46c1b1[_0x3fd3('0x2d')][_0x3fd3('0x1d')]);}_0x57dce0['order']=qs[_0x3fd3('0x35')](_0x46c1b1[_0x3fd3('0x2d')][_0x3fd3('0x35')]);_0x57dce0[_0x3fd3('0x36')]=qs[_0x3fd3('0x37')](_['pick'](_0x46c1b1['query'],_0x106a03[_0x3fd3('0x37')]),_0x96be09);if(_0x46c1b1[_0x3fd3('0x2d')]['filter']){_0x57dce0[_0x3fd3('0x36')]=_[_0x3fd3('0x38')](_0x57dce0[_0x3fd3('0x36')],{'$or':_['map'](_0x96be09,function(_0x250597){if(_0x250597['type']!==_0x3fd3('0x39')){var _0x1740da={};_0x1740da[_0x250597[_0x3fd3('0x24')]]={'$like':'%'+_0x46c1b1['query'][_0x3fd3('0x3a')]+'%'};return _0x1740da;}})});}_0x57dce0=_[_0x3fd3('0x38')]({},_0x57dce0,_0x46c1b1[_0x3fd3('0x3b')]);var _0x52ff5d={'where':_0x57dce0['where']};return db[_0x3fd3('0x3c')][_0x3fd3('0x1c')](_0x52ff5d)['then'](function(_0xe62d41){_0x43171d[_0x3fd3('0x1c')]=_0xe62d41;if(_0x46c1b1['query'][_0x3fd3('0x3d')]){_0x57dce0[_0x3fd3('0x3e')]=[{'all':!![]}];}return db[_0x3fd3('0x3c')][_0x3fd3('0x3f')](_0x57dce0);})[_0x3fd3('0x40')](function(_0xfce767){_0x43171d[_0x3fd3('0x41')]=_0xfce767;return _0x43171d;})['then'](respondWithFilteredResult(_0x1c3d78,_0x57dce0))[_0x3fd3('0x42')](handleError(_0x1c3d78,null));};exports[_0x3fd3('0x43')]=function(_0x144fe6,_0x35f1be){var _0x5bdb60={'raw':!![],'where':{'id':_0x144fe6[_0x3fd3('0x44')]['id']}},_0x54faa0={};_0x54faa0[_0x3fd3('0x2c')]=_[_0x3fd3('0x2e')](db[_0x3fd3('0x3c')][_0x3fd3('0x28')]);_0x54faa0[_0x3fd3('0x2d')]=_[_0x3fd3('0x2e')](_0x144fe6[_0x3fd3('0x2d')]);_0x54faa0[_0x3fd3('0x37')]=_[_0x3fd3('0x2f')](_0x54faa0[_0x3fd3('0x2c')],_0x54faa0['query']);_0x5bdb60[_0x3fd3('0x30')]=_[_0x3fd3('0x2f')](_0x54faa0['model'],qs['fields'](_0x144fe6[_0x3fd3('0x2d')]['fields']));_0x5bdb60[_0x3fd3('0x30')]=_0x5bdb60['attributes'][_0x3fd3('0x45')]?_0x5bdb60[_0x3fd3('0x30')]:_0x54faa0['model'];if(_0x144fe6[_0x3fd3('0x2d')][_0x3fd3('0x3d')]){_0x5bdb60[_0x3fd3('0x3e')]=[{'all':!![]}];}_0x5bdb60=_[_0x3fd3('0x38')]({},_0x5bdb60,_0x144fe6['options']);return db[_0x3fd3('0x3c')][_0x3fd3('0x46')](_0x5bdb60)[_0x3fd3('0x40')](handleEntityNotFound(_0x35f1be,null))[_0x3fd3('0x40')](respondWithResult(_0x35f1be,null))[_0x3fd3('0x42')](handleError(_0x35f1be,null));};exports[_0x3fd3('0x47')]=function(_0xda2688,_0x162626){return db[_0x3fd3('0x3c')]['create'](_0xda2688[_0x3fd3('0x48')],{})[_0x3fd3('0x40')](respondWithResult(_0x162626,0xc9))[_0x3fd3('0x42')](handleError(_0x162626,null));};exports['update']=function(_0x306b9e,_0x1519bf){if(_0x306b9e[_0x3fd3('0x48')]['id']){delete _0x306b9e[_0x3fd3('0x48')]['id'];}return db['ZohoField'][_0x3fd3('0x46')]({'where':{'id':_0x306b9e[_0x3fd3('0x44')]['id']}})[_0x3fd3('0x40')](handleEntityNotFound(_0x1519bf,null))['then'](saveUpdates(_0x306b9e[_0x3fd3('0x48')],null))[_0x3fd3('0x40')](respondWithResult(_0x1519bf,null))[_0x3fd3('0x42')](handleError(_0x1519bf,null));};exports[_0x3fd3('0x21')]=function(_0x43313c,_0x584a95){return db[_0x3fd3('0x3c')]['find']({'where':{'id':_0x43313c[_0x3fd3('0x44')]['id']}})[_0x3fd3('0x40')](handleEntityNotFound(_0x584a95,null))['then'](removeEntity(_0x584a95,null))[_0x3fd3('0x42')](handleError(_0x584a95,null));}; \ No newline at end of file +var _0x52b5=['attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','body','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3f4070,_0x392768){var _0x92be7c=function(_0x13ce6f){while(--_0x13ce6f){_0x3f4070['push'](_0x3f4070['shift']());}};_0x92be7c(++_0x392768);}(_0x52b5,0xed));var _0x552b=function(_0x5c7a48,_0x3f259d){_0x5c7a48=_0x5c7a48-0x0;var _0x4c2e26=_0x52b5[_0x5c7a48];return _0x4c2e26;};'use strict';var pdf=require(_0x552b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x552b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x552b('0x2'));var rp=require('request-promise');var moment=require(_0x552b('0x3'));var BPromise=require(_0x552b('0x4'));var Mustache=require(_0x552b('0x5'));var util=require(_0x552b('0x6'));var path=require(_0x552b('0x7'));var sox=require(_0x552b('0x8'));var csv=require('to-csv');var ejs=require(_0x552b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x552b('0xa'));var crypto=require('crypto');var jsforce=require(_0x552b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x552b('0xc'));var Papa=require(_0x552b('0xd'));var Redis=require(_0x552b('0xe'));var authService=require(_0x552b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x552b('0x10'));var hardwareService=require(_0x552b('0x11'));var logger=require(_0x552b('0x12'))(_0x552b('0x13'));var utils=require(_0x552b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x552b('0x15'));var db=require(_0x552b('0x16'))['db'];function respondWithStatusCode(_0x508a38,_0x10efb0){_0x10efb0=_0x10efb0||0xcc;return function(_0x4509b6){if(_0x4509b6){return _0x508a38[_0x552b('0x17')](_0x10efb0);}return _0x508a38[_0x552b('0x18')](_0x10efb0)[_0x552b('0x19')]();};}function respondWithResult(_0x533211,_0x3284be){_0x3284be=_0x3284be||0xc8;return function(_0x2e4439){if(_0x2e4439){return _0x533211['status'](_0x3284be)[_0x552b('0x1a')](_0x2e4439);}};}function respondWithFilteredResult(_0x548720,_0x1f96c8){return function(_0x102455){if(_0x102455){var _0x3d7e94=_0x102455[_0x552b('0x1b')],_0x3b926b=_0x1f96c8[_0x552b('0x1c')],_0x8b60f3=_0x1f96c8['offset']+_0x1f96c8[_0x552b('0x1d')],_0x5f5468;if(_0x8b60f3>=_0x3d7e94){_0x8b60f3=_0x3d7e94;_0x5f5468=0xc8;}else{_0x5f5468=0xce;}_0x548720[_0x552b('0x18')](_0x5f5468);return _0x548720[_0x552b('0x1e')](_0x552b('0x1f'),_0x3b926b+'-'+_0x8b60f3+'/'+_0x3d7e94)['json'](_0x102455);}return null;};}function patchUpdates(_0x120397){return function(_0x80bf15){try{jsonpatch[_0x552b('0x20')](_0x80bf15,_0x120397,!![]);}catch(_0x438ab7){return BPromise['reject'](_0x438ab7);}return _0x80bf15[_0x552b('0x21')]();};}function saveUpdates(_0x1bd8e3,_0x12d6d2){return function(_0x4b118a){if(_0x4b118a){return _0x4b118a[_0x552b('0x22')](_0x1bd8e3)[_0x552b('0x23')](function(_0x559988){return _0x559988;});}return null;};}function removeEntity(_0x10267e,_0x34fb5f){return function(_0x36d348){if(_0x36d348){return _0x36d348[_0x552b('0x24')]()[_0x552b('0x23')](function(){_0x10267e[_0x552b('0x18')](0xcc)[_0x552b('0x19')]();});}};}function handleEntityNotFound(_0x54fdd0,_0x1c1b72){return function(_0xbd0b6f){if(!_0xbd0b6f){_0x54fdd0[_0x552b('0x17')](0x194);}return _0xbd0b6f;};}function handleError(_0x4411af,_0x122d06){_0x122d06=_0x122d06||0x1f4;return function(_0x1fbb16){logger[_0x552b('0x25')](_0x1fbb16[_0x552b('0x26')]);if(_0x1fbb16['name']){delete _0x1fbb16[_0x552b('0x27')];}_0x4411af['status'](_0x122d06)['send'](_0x1fbb16);};}exports[_0x552b('0x28')]=function(_0x352487,_0x2df678){var _0x36a935={},_0x2cdb5b={},_0x445541={'count':0x0,'rows':[]};var _0x498df3=_[_0x552b('0x29')](db[_0x552b('0x2a')][_0x552b('0x2b')],function(_0x3db543){return{'name':_0x3db543[_0x552b('0x2c')],'type':_0x3db543[_0x552b('0x2d')][_0x552b('0x2e')]};});_0x2cdb5b[_0x552b('0x2f')]=_[_0x552b('0x29')](_0x498df3,_0x552b('0x27'));_0x2cdb5b[_0x552b('0x30')]=_[_0x552b('0x31')](_0x352487['query']);_0x2cdb5b[_0x552b('0x32')]=_['intersection'](_0x2cdb5b[_0x552b('0x2f')],_0x2cdb5b[_0x552b('0x30')]);_0x36a935[_0x552b('0x33')]=_[_0x552b('0x34')](_0x2cdb5b[_0x552b('0x2f')],qs[_0x552b('0x35')](_0x352487[_0x552b('0x30')][_0x552b('0x35')]));_0x36a935[_0x552b('0x33')]=_0x36a935['attributes']['length']?_0x36a935[_0x552b('0x33')]:_0x2cdb5b[_0x552b('0x2f')];if(!_0x352487[_0x552b('0x30')][_0x552b('0x36')](_0x552b('0x37'))){_0x36a935[_0x552b('0x1d')]=qs[_0x552b('0x1d')](_0x352487['query']['limit']);_0x36a935[_0x552b('0x1c')]=qs[_0x552b('0x1c')](_0x352487[_0x552b('0x30')][_0x552b('0x1c')]);}_0x36a935[_0x552b('0x38')]=qs[_0x552b('0x39')](_0x352487[_0x552b('0x30')][_0x552b('0x39')]);_0x36a935[_0x552b('0x3a')]=qs[_0x552b('0x32')](_['pick'](_0x352487[_0x552b('0x30')],_0x2cdb5b[_0x552b('0x32')]),_0x498df3);if(_0x352487[_0x552b('0x30')][_0x552b('0x3b')]){_0x36a935['where']=_['merge'](_0x36a935[_0x552b('0x3a')],{'$or':_[_0x552b('0x29')](_0x498df3,function(_0x53a0e0){if(_0x53a0e0['type']!==_0x552b('0x3c')){var _0x518400={};_0x518400[_0x53a0e0[_0x552b('0x27')]]={'$like':'%'+_0x352487[_0x552b('0x30')][_0x552b('0x3b')]+'%'};return _0x518400;}})});}_0x36a935=_[_0x552b('0x3d')]({},_0x36a935,_0x352487[_0x552b('0x3e')]);var _0x207836={'where':_0x36a935[_0x552b('0x3a')]};return db[_0x552b('0x2a')][_0x552b('0x1b')](_0x207836)['then'](function(_0x10a2b8){_0x445541[_0x552b('0x1b')]=_0x10a2b8;if(_0x352487[_0x552b('0x30')][_0x552b('0x3f')]){_0x36a935[_0x552b('0x40')]=[{'all':!![]}];}return db[_0x552b('0x2a')][_0x552b('0x41')](_0x36a935);})[_0x552b('0x23')](function(_0x2dd205){_0x445541['rows']=_0x2dd205;return _0x445541;})[_0x552b('0x23')](respondWithFilteredResult(_0x2df678,_0x36a935))[_0x552b('0x42')](handleError(_0x2df678,null));};exports[_0x552b('0x43')]=function(_0x16c6b2,_0x238077){var _0x1f3749={'raw':!![],'where':{'id':_0x16c6b2[_0x552b('0x44')]['id']}},_0x4b24b={};_0x4b24b[_0x552b('0x2f')]=_['keys'](db[_0x552b('0x2a')][_0x552b('0x2b')]);_0x4b24b[_0x552b('0x30')]=_[_0x552b('0x31')](_0x16c6b2['query']);_0x4b24b[_0x552b('0x32')]=_[_0x552b('0x34')](_0x4b24b['model'],_0x4b24b['query']);_0x1f3749[_0x552b('0x33')]=_[_0x552b('0x34')](_0x4b24b[_0x552b('0x2f')],qs[_0x552b('0x35')](_0x16c6b2[_0x552b('0x30')]['fields']));_0x1f3749[_0x552b('0x33')]=_0x1f3749['attributes'][_0x552b('0x45')]?_0x1f3749[_0x552b('0x33')]:_0x4b24b[_0x552b('0x2f')];if(_0x16c6b2[_0x552b('0x30')][_0x552b('0x3f')]){_0x1f3749[_0x552b('0x40')]=[{'all':!![]}];}_0x1f3749=_[_0x552b('0x3d')]({},_0x1f3749,_0x16c6b2[_0x552b('0x3e')]);return db[_0x552b('0x2a')][_0x552b('0x46')](_0x1f3749)[_0x552b('0x23')](handleEntityNotFound(_0x238077,null))['then'](respondWithResult(_0x238077,null))['catch'](handleError(_0x238077,null));};exports['create']=function(_0x2cd750,_0x3018df){return db['ZohoField']['create'](_0x2cd750['body'],{})[_0x552b('0x23')](respondWithResult(_0x3018df,0xc9))['catch'](handleError(_0x3018df,null));};exports[_0x552b('0x22')]=function(_0x500e60,_0x4fab0f){if(_0x500e60[_0x552b('0x47')]['id']){delete _0x500e60[_0x552b('0x47')]['id'];}return db[_0x552b('0x2a')][_0x552b('0x46')]({'where':{'id':_0x500e60[_0x552b('0x44')]['id']}})[_0x552b('0x23')](handleEntityNotFound(_0x4fab0f,null))['then'](saveUpdates(_0x500e60[_0x552b('0x47')],null))[_0x552b('0x23')](respondWithResult(_0x4fab0f,null))[_0x552b('0x42')](handleError(_0x4fab0f,null));};exports[_0x552b('0x24')]=function(_0x5cbad2,_0x389a85){return db[_0x552b('0x2a')][_0x552b('0x46')]({'where':{'id':_0x5cbad2[_0x552b('0x44')]['id']}})[_0x552b('0x23')](handleEntityNotFound(_0x389a85,null))[_0x552b('0x23')](removeEntity(_0x389a85,null))[_0x552b('0x42')](handleError(_0x389a85,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f7ff42d..8ec9495 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 _0x5e25=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x86527a,_0x2787c6){var _0x2f14b6=function(_0x4f1613){while(--_0x4f1613){_0x86527a['push'](_0x86527a['shift']());}};_0x2f14b6(++_0x2787c6);}(_0x5e25,0x134));var _0x55e2=function(_0x2bfb11,_0x33e4c2){_0x2bfb11=_0x2bfb11-0x0;var _0x54f42b=_0x5e25[_0x2bfb11];return _0x54f42b;};'use strict';var _=require(_0x55e2('0x0'));var util=require(_0x55e2('0x1'));var logger=require(_0x55e2('0x2'))(_0x55e2('0x3'));var moment=require(_0x55e2('0x4'));var BPromise=require(_0x55e2('0x5'));var rp=require(_0x55e2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x55e2('0x7'));module['exports']=function(_0x1a8f74,_0x456fd0){return _0x1a8f74[_0x55e2('0x8')](_0x55e2('0x9'),attributes,{'tableName':_0x55e2('0xa'),'paranoid':![],'indexes':[{'name':_0x55e2('0xb'),'fields':[_0x55e2('0xc'),_0x55e2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9277=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird'];(function(_0x536ffd,_0xbe6fb){var _0x29f75c=function(_0x1d64d8){while(--_0x1d64d8){_0x536ffd['push'](_0x536ffd['shift']());}};_0x29f75c(++_0xbe6fb);}(_0x9277,0x176));var _0x7927=function(_0x3f3125,_0x3f49d2){_0x3f3125=_0x3f3125-0x0;var _0x28bf12=_0x9277[_0x3f3125];return _0x28bf12;};'use strict';var _=require(_0x7927('0x0'));var util=require(_0x7927('0x1'));var logger=require(_0x7927('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7927('0x3'));var rp=require(_0x7927('0x4'));var fs=require('fs');var path=require(_0x7927('0x5'));var rimraf=require(_0x7927('0x6'));var config=require(_0x7927('0x7'));var attributes=require(_0x7927('0x8'));module['exports']=function(_0x50abc2,_0x3df845){return _0x50abc2['define'](_0x7927('0x9'),attributes,{'tableName':_0x7927('0xa'),'paranoid':![],'indexes':[{'name':_0x7927('0xb'),'fields':[_0x7927('0xc'),_0x7927('0xd')],'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 f2761cd..b7dd62c 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 _0xe5b3=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x25025f,_0x261af2){_0x25025f=_0x25025f-0x0;var _0x1ee1db=_0xe5b3[_0x25025f];return _0x1ee1db;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7217,0x19e));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'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')]('ZohoField,\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']('ZohoField,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ddf7069..c9cded7 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 _0xce4f=['util','path','Router','../../config/environment','exports','multer'];(function(_0xebc72a,_0x5a55c5){var _0x441d7d=function(_0x8a1eaf){while(--_0x8a1eaf){_0xebc72a['push'](_0xebc72a['shift']());}};_0x441d7d(++_0x5a55c5);}(_0xce4f,0xef));var _0xfce4=function(_0x2f8187,_0x3ff6c3){_0x2f8187=_0x2f8187-0x0;var _0x17e010=_0xce4f[_0x2f8187];return _0x17e010;};'use strict';var multer=require(_0xfce4('0x0'));var util=require(_0xfce4('0x1'));var path=require(_0xfce4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfce4('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfce4('0x4'));module[_0xfce4('0x5')]=router; \ No newline at end of file +var _0xc52c=['express','Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x4d1ce5,_0x97946){var _0x848e6d=function(_0x4a973d){while(--_0x4a973d){_0x4d1ce5['push'](_0x4d1ce5['shift']());}};_0x848e6d(++_0x97946);}(_0xc52c,0x144));var _0xcc52=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0xc52c[_0x4d3a2b];return _0xdd32c8;};'use strict';var multer=require(_0xcc52('0x0'));var util=require(_0xcc52('0x1'));var path=require(_0xcc52('0x2'));var timeout=require(_0xcc52('0x3'));var express=require(_0xcc52('0x4'));var router=express[_0xcc52('0x5')]();var auth=require(_0xcc52('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xcc52('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1b0505a..1a5be8a 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 _0xb84a=['STRING','unique_name_and_version','app.js','INTEGER','sequelize','exports'];(function(_0x5171fb,_0x5b8548){var _0x3d7573=function(_0x197d5d){while(--_0x197d5d){_0x5171fb['push'](_0x5171fb['shift']());}};_0x3d7573(++_0x5b8548);}(_0xb84a,0x82));var _0xab84=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb84a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xab84('0x0'));module[_0xab84('0x1')]={'name':{'type':Sequelize[_0xab84('0x2')],'allowNull':![],'unique':_0xab84('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xab84('0x2')],'defaultValue':_0xab84('0x4')},'filename':{'type':Sequelize[_0xab84('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xab84('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xab84('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0xab84('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xab84('0x2')]},'link':{'type':Sequelize[_0xab84('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xff89=['STRING','unique_name_and_version','BOOLEAN','state','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xff89,0xcc));var _0x9ff8=function(_0xbc5913,_0x7bb525){_0xbc5913=_0xbc5913-0x0;var _0x4a0c86=_0xff89[_0xbc5913];return _0x4a0c86;};'use strict';var Sequelize=require(_0x9ff8('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ff8('0x1')],'allowNull':![],'unique':_0x9ff8('0x2')},'version':{'type':Sequelize[_0x9ff8('0x1')],'allowNull':![],'unique':_0x9ff8('0x2')},'main':{'type':Sequelize[_0x9ff8('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9ff8('0x1')]},'path':{'type':Sequelize[_0x9ff8('0x1')]},'type':{'type':Sequelize[_0x9ff8('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9ff8('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x9ff8('0x1')]},'logo':{'type':Sequelize[_0x9ff8('0x1')]},'state':{'type':Sequelize[_0x9ff8('0x1')],'unique':_0x9ff8('0x4')},'description':{'type':Sequelize[_0x9ff8('0x1')]},'title':{'type':Sequelize[_0x9ff8('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x9ff8('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9874ce3..5ea0e40 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 _0xf8ff=['jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','json','apply','then','destroy','error','send','Integration','rawAttributes','fieldName','type','model','map','name','query','filters','attributes','intersection','fields','length','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','params','keys','create','update','body','find','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto'];(function(_0x32e2c0,_0x2f7f76){var _0x566ec4=function(_0x4f1f3a){while(--_0x4f1f3a){_0x32e2c0['push'](_0x32e2c0['shift']());}};_0x566ec4(++_0x2f7f76);}(_0xf8ff,0x127));var _0xff8f=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0xf8ff[_0x328b1c];return _0x4dbeaa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xff8f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff8f('0x1'));var rp=require(_0xff8f('0x2'));var moment=require(_0xff8f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff8f('0x4'));var path=require('path');var sox=require(_0xff8f('0x5'));var csv=require(_0xff8f('0x6'));var ejs=require(_0xff8f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff8f('0x8'));var crypto=require(_0xff8f('0x9'));var jsforce=require(_0xff8f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xff8f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff8f('0xb'));var authService=require(_0xff8f('0xc'));var qs=require(_0xff8f('0xd'));var as=require(_0xff8f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8f('0xf'))(_0xff8f('0x10'));var utils=require(_0xff8f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xff8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8de29e,_0x41b45f){_0x41b45f=_0x41b45f||0xcc;return function(_0x99791b){if(_0x99791b){return _0x8de29e[_0xff8f('0x13')](_0x41b45f);}return _0x8de29e[_0xff8f('0x14')](_0x41b45f)[_0xff8f('0x15')]();};}function respondWithResult(_0x5af7da,_0x27ea91){_0x27ea91=_0x27ea91||0xc8;return function(_0x2b9cd1){if(_0x2b9cd1){return _0x5af7da['status'](_0x27ea91)['json'](_0x2b9cd1);}};}function respondWithFilteredResult(_0xb45836,_0x59e2a8){return function(_0x159441){if(_0x159441){var _0x55d2d3=_0x159441[_0xff8f('0x16')],_0x17617d=_0x59e2a8[_0xff8f('0x17')],_0x4c3e9d=_0x59e2a8[_0xff8f('0x17')]+_0x59e2a8[_0xff8f('0x18')],_0x399d55;if(_0x4c3e9d>=_0x55d2d3){_0x4c3e9d=_0x55d2d3;_0x399d55=0xc8;}else{_0x399d55=0xce;}_0xb45836[_0xff8f('0x14')](_0x399d55);return _0xb45836[_0xff8f('0x19')]('Content-Range',_0x17617d+'-'+_0x4c3e9d+'/'+_0x55d2d3)[_0xff8f('0x1a')](_0x159441);}return null;};}function patchUpdates(_0x24bc57){return function(_0xb8bb32){try{jsonpatch[_0xff8f('0x1b')](_0xb8bb32,_0x24bc57,!![]);}catch(_0x2735c8){return BPromise['reject'](_0x2735c8);}return _0xb8bb32['save']();};}function saveUpdates(_0x3a6c4b,_0x5a58ee){return function(_0x3d68ca){if(_0x3d68ca){return _0x3d68ca['update'](_0x3a6c4b)[_0xff8f('0x1c')](function(_0xaddc94){return _0xaddc94;});}return null;};}function removeEntity(_0xb0f80a,_0x44fb06){return function(_0xeaf441){if(_0xeaf441){return _0xeaf441[_0xff8f('0x1d')]()['then'](function(){_0xb0f80a[_0xff8f('0x14')](0xcc)[_0xff8f('0x15')]();});}};}function handleEntityNotFound(_0x21058c,_0x20c390){return function(_0x3a9244){if(!_0x3a9244){_0x21058c[_0xff8f('0x13')](0x194);}return _0x3a9244;};}function handleError(_0x51c599,_0x56c7d9){_0x56c7d9=_0x56c7d9||0x1f4;return function(_0x59c197){logger[_0xff8f('0x1e')](_0x59c197['stack']);if(_0x59c197['name']){delete _0x59c197['name'];}_0x51c599['status'](_0x56c7d9)[_0xff8f('0x1f')](_0x59c197);};}exports['index']=function(_0x45359a,_0x5385fe){var _0x271252={},_0x22372d={},_0x3519ab={'count':0x0,'rows':[]};var _0xb1ed64=_['map'](db[_0xff8f('0x20')][_0xff8f('0x21')],function(_0x447ad8){return{'name':_0x447ad8[_0xff8f('0x22')],'type':_0x447ad8[_0xff8f('0x23')]['key']};});_0x22372d[_0xff8f('0x24')]=_[_0xff8f('0x25')](_0xb1ed64,_0xff8f('0x26'));_0x22372d[_0xff8f('0x27')]=_['keys'](_0x45359a[_0xff8f('0x27')]);_0x22372d[_0xff8f('0x28')]=_['intersection'](_0x22372d[_0xff8f('0x24')],_0x22372d['query']);_0x271252[_0xff8f('0x29')]=_[_0xff8f('0x2a')](_0x22372d['model'],qs[_0xff8f('0x2b')](_0x45359a['query'][_0xff8f('0x2b')]));_0x271252[_0xff8f('0x29')]=_0x271252[_0xff8f('0x29')][_0xff8f('0x2c')]?_0x271252['attributes']:_0x22372d['model'];if(!_0x45359a[_0xff8f('0x27')]['hasOwnProperty']('nolimit')){_0x271252[_0xff8f('0x18')]=qs[_0xff8f('0x18')](_0x45359a[_0xff8f('0x27')]['limit']);_0x271252['offset']=qs[_0xff8f('0x17')](_0x45359a[_0xff8f('0x27')]['offset']);}_0x271252[_0xff8f('0x2d')]=qs[_0xff8f('0x2e')](_0x45359a[_0xff8f('0x27')][_0xff8f('0x2e')]);_0x271252['where']=qs['filters'](_['pick'](_0x45359a['query'],_0x22372d[_0xff8f('0x28')]),_0xb1ed64);if(_0x45359a[_0xff8f('0x27')][_0xff8f('0x2f')]){_0x271252[_0xff8f('0x30')]=_[_0xff8f('0x31')](_0x271252[_0xff8f('0x30')],{'$or':_[_0xff8f('0x25')](_0xb1ed64,function(_0x698c98){if(_0x698c98[_0xff8f('0x23')]!=='VIRTUAL'){var _0x2aea46={};_0x2aea46[_0x698c98[_0xff8f('0x26')]]={'$like':'%'+_0x45359a[_0xff8f('0x27')][_0xff8f('0x2f')]+'%'};return _0x2aea46;}})});}_0x271252=_[_0xff8f('0x31')]({},_0x271252,_0x45359a[_0xff8f('0x32')]);var _0x10f4f0={'where':_0x271252[_0xff8f('0x30')]};return db[_0xff8f('0x20')]['count'](_0x10f4f0)['then'](function(_0x5b9f72){_0x3519ab['count']=_0x5b9f72;if(_0x45359a[_0xff8f('0x27')][_0xff8f('0x33')]){_0x271252[_0xff8f('0x34')]=[{'all':!![]}];}return db[_0xff8f('0x20')][_0xff8f('0x35')](_0x271252);})[_0xff8f('0x1c')](function(_0x38b5e7){_0x3519ab['rows']=_0x38b5e7;return _0x3519ab;})[_0xff8f('0x1c')](respondWithFilteredResult(_0x5385fe,_0x271252))[_0xff8f('0x36')](handleError(_0x5385fe,null));};exports['show']=function(_0x5693d5,_0x386685){var _0x15bc94={'raw':![],'where':{'id':_0x5693d5[_0xff8f('0x37')]['id']}},_0x118901={};_0x118901[_0xff8f('0x24')]=_[_0xff8f('0x38')](db[_0xff8f('0x20')][_0xff8f('0x21')]);_0x118901['query']=_[_0xff8f('0x38')](_0x5693d5[_0xff8f('0x27')]);_0x118901[_0xff8f('0x28')]=_[_0xff8f('0x2a')](_0x118901[_0xff8f('0x24')],_0x118901['query']);_0x15bc94[_0xff8f('0x29')]=_[_0xff8f('0x2a')](_0x118901[_0xff8f('0x24')],qs[_0xff8f('0x2b')](_0x5693d5[_0xff8f('0x27')]['fields']));_0x15bc94[_0xff8f('0x29')]=_0x15bc94['attributes'][_0xff8f('0x2c')]?_0x15bc94[_0xff8f('0x29')]:_0x118901[_0xff8f('0x24')];if(_0x5693d5[_0xff8f('0x27')][_0xff8f('0x33')]){_0x15bc94[_0xff8f('0x34')]=[{'all':!![]}];}_0x15bc94=_[_0xff8f('0x31')]({},_0x15bc94,_0x5693d5[_0xff8f('0x32')]);return db[_0xff8f('0x20')]['find'](_0x15bc94)[_0xff8f('0x1c')](handleEntityNotFound(_0x386685,null))[_0xff8f('0x1c')](respondWithResult(_0x386685,null))[_0xff8f('0x36')](handleError(_0x386685,null));};exports[_0xff8f('0x39')]=function(_0x266748,_0x36cd92){return db['Integration'][_0xff8f('0x39')](_0x266748['body'],{})[_0xff8f('0x1c')](respondWithResult(_0x36cd92,0xc9))[_0xff8f('0x36')](handleError(_0x36cd92,null));};exports[_0xff8f('0x3a')]=function(_0x45ead3,_0x33b1b1){if(_0x45ead3[_0xff8f('0x3b')]['id']){delete _0x45ead3[_0xff8f('0x3b')]['id'];}return db[_0xff8f('0x20')][_0xff8f('0x3c')]({'where':{'id':_0x45ead3[_0xff8f('0x37')]['id']}})[_0xff8f('0x1c')](handleEntityNotFound(_0x33b1b1,null))[_0xff8f('0x1c')](saveUpdates(_0x45ead3[_0xff8f('0x3b')],null))['then'](respondWithResult(_0x33b1b1,null))[_0xff8f('0x36')](handleError(_0x33b1b1,null));};exports['destroy']=function(_0xa4ed9e,_0x57d2a4){return db[_0xff8f('0x20')]['find']({'where':{'id':_0xa4ed9e[_0xff8f('0x37')]['id']}})[_0xff8f('0x1c')](handleEntityNotFound(_0x57d2a4,null))[_0xff8f('0x1c')](removeEntity(_0x57d2a4,null))[_0xff8f('0x36')](handleError(_0x57d2a4,null));}; \ No newline at end of file +var _0xe888=['key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','save','then','error','name','send','index','map','Integration','fieldName','type'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0xe888,0x194));var _0x8e88=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xe888[_0x2ed8f3];return _0x525a55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8e88('0x0'));var rimraf=require(_0x8e88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e88('0x2'));var rp=require(_0x8e88('0x3'));var moment=require(_0x8e88('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8e88('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8e88('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e88('0x7'));var squel=require(_0x8e88('0x8'));var crypto=require(_0x8e88('0x9'));var jsforce=require(_0x8e88('0xa'));var deskjs=require(_0x8e88('0xb'));var toCsv=require(_0x8e88('0xc'));var querystring=require(_0x8e88('0xd'));var Papa=require(_0x8e88('0xe'));var Redis=require(_0x8e88('0xf'));var authService=require(_0x8e88('0x10'));var qs=require(_0x8e88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e88('0x12'));var utils=require('../../config/utils');var config=require(_0x8e88('0x13'));var licenseUtil=require(_0x8e88('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6450,_0x260cbd){_0x260cbd=_0x260cbd||0xcc;return function(_0x517782){if(_0x517782){return _0x4c6450[_0x8e88('0x15')](_0x260cbd);}return _0x4c6450[_0x8e88('0x16')](_0x260cbd)['end']();};}function respondWithResult(_0x1e9576,_0x4f5b93){_0x4f5b93=_0x4f5b93||0xc8;return function(_0x59bb99){if(_0x59bb99){return _0x1e9576[_0x8e88('0x16')](_0x4f5b93)[_0x8e88('0x17')](_0x59bb99);}};}function respondWithFilteredResult(_0x1aab93,_0x83c243){return function(_0x28fdd1){if(_0x28fdd1){var _0x3429bf=_0x28fdd1[_0x8e88('0x18')],_0x196e1a=_0x83c243[_0x8e88('0x19')],_0x408fa3=_0x83c243['offset']+_0x83c243[_0x8e88('0x1a')],_0x2d8d93;if(_0x408fa3>=_0x3429bf){_0x408fa3=_0x3429bf;_0x2d8d93=0xc8;}else{_0x2d8d93=0xce;}_0x1aab93[_0x8e88('0x16')](_0x2d8d93);return _0x1aab93['set']('Content-Range',_0x196e1a+'-'+_0x408fa3+'/'+_0x3429bf)[_0x8e88('0x17')](_0x28fdd1);}return null;};}function patchUpdates(_0x1b7c1f){return function(_0x16a9c9){try{jsonpatch['apply'](_0x16a9c9,_0x1b7c1f,!![]);}catch(_0x5ad719){return BPromise['reject'](_0x5ad719);}return _0x16a9c9[_0x8e88('0x1b')]();};}function saveUpdates(_0xd4964d,_0x3ee585){return function(_0x117dba){if(_0x117dba){return _0x117dba['update'](_0xd4964d)['then'](function(_0x263a25){return _0x263a25;});}return null;};}function removeEntity(_0x1e2be7,_0x9dead2){return function(_0x29ad86){if(_0x29ad86){return _0x29ad86['destroy']()[_0x8e88('0x1c')](function(){_0x1e2be7[_0x8e88('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0060,_0x501633){return function(_0x12f2ce){if(!_0x12f2ce){_0x3a0060[_0x8e88('0x15')](0x194);}return _0x12f2ce;};}function handleError(_0x36ea72,_0x418100){_0x418100=_0x418100||0x1f4;return function(_0x17c7a1){logger[_0x8e88('0x1d')](_0x17c7a1['stack']);if(_0x17c7a1[_0x8e88('0x1e')]){delete _0x17c7a1['name'];}_0x36ea72[_0x8e88('0x16')](_0x418100)[_0x8e88('0x1f')](_0x17c7a1);};}exports[_0x8e88('0x20')]=function(_0x191469,_0x401d77){var _0x15904d={},_0x4edb70={},_0x7be393={'count':0x0,'rows':[]};var _0x5c73e0=_[_0x8e88('0x21')](db[_0x8e88('0x22')]['rawAttributes'],function(_0x2dd626){return{'name':_0x2dd626[_0x8e88('0x23')],'type':_0x2dd626[_0x8e88('0x24')][_0x8e88('0x25')]};});_0x4edb70[_0x8e88('0x26')]=_[_0x8e88('0x21')](_0x5c73e0,_0x8e88('0x1e'));_0x4edb70['query']=_[_0x8e88('0x27')](_0x191469[_0x8e88('0x28')]);_0x4edb70['filters']=_['intersection'](_0x4edb70[_0x8e88('0x26')],_0x4edb70[_0x8e88('0x28')]);_0x15904d[_0x8e88('0x29')]=_[_0x8e88('0x2a')](_0x4edb70[_0x8e88('0x26')],qs[_0x8e88('0x2b')](_0x191469['query'][_0x8e88('0x2b')]));_0x15904d[_0x8e88('0x29')]=_0x15904d[_0x8e88('0x29')][_0x8e88('0x2c')]?_0x15904d[_0x8e88('0x29')]:_0x4edb70[_0x8e88('0x26')];if(!_0x191469['query'][_0x8e88('0x2d')](_0x8e88('0x2e'))){_0x15904d['limit']=qs[_0x8e88('0x1a')](_0x191469[_0x8e88('0x28')][_0x8e88('0x1a')]);_0x15904d[_0x8e88('0x19')]=qs[_0x8e88('0x19')](_0x191469[_0x8e88('0x28')]['offset']);}_0x15904d[_0x8e88('0x2f')]=qs['sort'](_0x191469['query']['sort']);_0x15904d['where']=qs[_0x8e88('0x30')](_[_0x8e88('0x31')](_0x191469['query'],_0x4edb70['filters']),_0x5c73e0);if(_0x191469[_0x8e88('0x28')][_0x8e88('0x32')]){_0x15904d['where']=_[_0x8e88('0x33')](_0x15904d['where'],{'$or':_[_0x8e88('0x21')](_0x5c73e0,function(_0x2de72e){if(_0x2de72e[_0x8e88('0x24')]!==_0x8e88('0x34')){var _0x6c3ad6={};_0x6c3ad6[_0x2de72e[_0x8e88('0x1e')]]={'$like':'%'+_0x191469[_0x8e88('0x28')][_0x8e88('0x32')]+'%'};return _0x6c3ad6;}})});}_0x15904d=_[_0x8e88('0x33')]({},_0x15904d,_0x191469['options']);var _0x2c7943={'where':_0x15904d['where']};return db[_0x8e88('0x22')][_0x8e88('0x18')](_0x2c7943)[_0x8e88('0x1c')](function(_0x155de8){_0x7be393[_0x8e88('0x18')]=_0x155de8;if(_0x191469[_0x8e88('0x28')][_0x8e88('0x35')]){_0x15904d[_0x8e88('0x36')]=[{'all':!![]}];}return db[_0x8e88('0x22')]['findAll'](_0x15904d);})[_0x8e88('0x1c')](function(_0x43ef42){_0x7be393['rows']=_0x43ef42;return _0x7be393;})[_0x8e88('0x1c')](respondWithFilteredResult(_0x401d77,_0x15904d))['catch'](handleError(_0x401d77,null));};exports[_0x8e88('0x37')]=function(_0xcd750d,_0x177e76){var _0x51f292={'raw':![],'where':{'id':_0xcd750d[_0x8e88('0x38')]['id']}},_0x1eaf43={};_0x1eaf43['model']=_['keys'](db[_0x8e88('0x22')]['rawAttributes']);_0x1eaf43[_0x8e88('0x28')]=_[_0x8e88('0x27')](_0xcd750d[_0x8e88('0x28')]);_0x1eaf43[_0x8e88('0x30')]=_[_0x8e88('0x2a')](_0x1eaf43[_0x8e88('0x26')],_0x1eaf43[_0x8e88('0x28')]);_0x51f292[_0x8e88('0x29')]=_[_0x8e88('0x2a')](_0x1eaf43[_0x8e88('0x26')],qs[_0x8e88('0x2b')](_0xcd750d[_0x8e88('0x28')][_0x8e88('0x2b')]));_0x51f292[_0x8e88('0x29')]=_0x51f292[_0x8e88('0x29')]['length']?_0x51f292[_0x8e88('0x29')]:_0x1eaf43[_0x8e88('0x26')];if(_0xcd750d['query']['includeAll']){_0x51f292[_0x8e88('0x36')]=[{'all':!![]}];}_0x51f292=_[_0x8e88('0x33')]({},_0x51f292,_0xcd750d[_0x8e88('0x39')]);return db[_0x8e88('0x22')][_0x8e88('0x3a')](_0x51f292)[_0x8e88('0x1c')](handleEntityNotFound(_0x177e76,null))['then'](respondWithResult(_0x177e76,null))[_0x8e88('0x3b')](handleError(_0x177e76,null));};exports['create']=function(_0x4e02a1,_0x435f09){return db[_0x8e88('0x22')][_0x8e88('0x3c')](_0x4e02a1[_0x8e88('0x3d')],{})[_0x8e88('0x1c')](respondWithResult(_0x435f09,0xc9))[_0x8e88('0x3b')](handleError(_0x435f09,null));};exports['update']=function(_0x4e7282,_0x28186a){if(_0x4e7282['body']['id']){delete _0x4e7282[_0x8e88('0x3d')]['id'];}return db[_0x8e88('0x22')][_0x8e88('0x3a')]({'where':{'id':_0x4e7282[_0x8e88('0x38')]['id']}})['then'](handleEntityNotFound(_0x28186a,null))['then'](saveUpdates(_0x4e7282[_0x8e88('0x3d')],null))[_0x8e88('0x1c')](respondWithResult(_0x28186a,null))[_0x8e88('0x3b')](handleError(_0x28186a,null));};exports[_0x8e88('0x3e')]=function(_0xabe5b3,_0x36e164){return db[_0x8e88('0x22')]['find']({'where':{'id':_0xabe5b3[_0x8e88('0x38')]['id']}})[_0x8e88('0x1c')](handleEntityNotFound(_0x36e164,null))[_0x8e88('0x1c')](removeEntity(_0x36e164,null))['catch'](handleError(_0x36e164,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9b79fd0..219cbac 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 _0x4c4c=['path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c4c,0x6f));var _0xc4c4=function(_0x421096,_0x16eb98){_0x421096=_0x421096-0x0;var _0x137df3=_0x4c4c[_0x421096];return _0x137df3;};'use strict';var _=require(_0xc4c4('0x0'));var util=require(_0xc4c4('0x1'));var logger=require(_0xc4c4('0x2'))(_0xc4c4('0x3'));var moment=require(_0xc4c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc4c4('0x5'));var fs=require('fs');var path=require(_0xc4c4('0x6'));var rimraf=require('rimraf');var config=require(_0xc4c4('0x7'));var attributes=require(_0xc4c4('0x8'));module[_0xc4c4('0x9')]=function(_0x220bd7,_0x17fdd7){return _0x220bd7[_0xc4c4('0xa')](_0xc4c4('0xb'),attributes,{'tableName':_0xc4c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf2=['./integration.attributes','exports','define','lodash','api','rimraf','../../config/environment'];(function(_0x4b28d2,_0x5d3e9c){var _0x3cdb53=function(_0x4ed934){while(--_0x4ed934){_0x4b28d2['push'](_0x4b28d2['shift']());}};_0x3cdb53(++_0x5d3e9c);}(_0xfaf2,0xb2));var _0x2faf=function(_0x3ef61b,_0x26b96f){_0x3ef61b=_0x3ef61b-0x0;var _0x51879f=_0xfaf2[_0x3ef61b];return _0x51879f;};'use strict';var _=require(_0x2faf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2faf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2faf('0x2'));var config=require(_0x2faf('0x3'));var attributes=require(_0x2faf('0x4'));module[_0x2faf('0x5')]=function(_0x1d6087,_0x10e4bd){return _0x1d6087[_0x2faf('0x6')]('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 27f1b67..88714be 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 _0xb613=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xb613,0x9d));var _0x3b61=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xb613[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require(_0x3b61('0x0'));var util=require(_0x3b61('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3b61('0x2'));var fs=require('fs');var Redis=require(_0x3b61('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b61('0x4'));var logger=require(_0x3b61('0x5'))(_0x3b61('0x6'));var config=require(_0x3b61('0x7'));var jayson=require(_0x3b61('0x8'));var client=jayson[_0x3b61('0x9')][_0x3b61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509397,_0x3d3c71,_0x4282e4){return new BPromise(function(_0x2e0a08,_0x1fbd4c){return client[_0x3b61('0xb')](_0x509397,_0x4282e4)[_0x3b61('0xc')](function(_0xa9bdea){logger[_0x3b61('0xd')](_0x3b61('0xe'),_0x3d3c71,_0x3b61('0xf'));logger[_0x3b61('0x10')](_0x3b61('0x11'),_0x3d3c71,_0x3b61('0xf'),JSON[_0x3b61('0x12')](_0xa9bdea));if(_0xa9bdea[_0x3b61('0x13')]){if(_0xa9bdea['error'][_0x3b61('0x14')]===0x1f4){logger[_0x3b61('0x13')](_0x3b61('0xe'),_0x3d3c71,_0xa9bdea[_0x3b61('0x13')]['message']);return _0x1fbd4c(_0xa9bdea[_0x3b61('0x13')][_0x3b61('0x15')]);}logger[_0x3b61('0x13')](_0x3b61('0xe'),_0x3d3c71,_0xa9bdea[_0x3b61('0x13')]['message']);return _0x2e0a08(_0xa9bdea['error']['message']);}else{logger[_0x3b61('0xd')]('Integration,\x20%s,\x20%s',_0x3d3c71,_0x3b61('0xf'));_0x2e0a08(_0xa9bdea[_0x3b61('0x16')][_0x3b61('0x15')]);}})['catch'](function(_0x94b9df){logger['error'](_0x3b61('0xe'),_0x3d3c71,_0x94b9df);_0x1fbd4c(_0x94b9df);});});} \ No newline at end of file +var _0x97ed=['stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug'];(function(_0x4a1791,_0x4c5077){var _0x3680d4=function(_0x3174ef){while(--_0x3174ef){_0x4a1791['push'](_0x4a1791['shift']());}};_0x3680d4(++_0x4c5077);}(_0x97ed,0x1e7));var _0xd97e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x97ed[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd97e('0x0'));var util=require(_0xd97e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd97e('0x2'));var fs=require('fs');var Redis=require(_0xd97e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd97e('0x4'));var logger=require(_0xd97e('0x5'))(_0xd97e('0x6'));var config=require(_0xd97e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd97e('0x8')][_0xd97e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f7f99,_0x3f16ae,_0x52a86d){return new BPromise(function(_0x51a495,_0x4200d5){return client['request'](_0x4f7f99,_0x52a86d)['then'](function(_0x5e3514){logger[_0xd97e('0xa')]('Integration,\x20%s,\x20%s',_0x3f16ae,_0xd97e('0xb'));logger[_0xd97e('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x3f16ae,_0xd97e('0xb'),JSON[_0xd97e('0xd')](_0x5e3514));if(_0x5e3514[_0xd97e('0xe')]){if(_0x5e3514['error'][_0xd97e('0xf')]===0x1f4){logger[_0xd97e('0xe')](_0xd97e('0x10'),_0x3f16ae,_0x5e3514[_0xd97e('0xe')][_0xd97e('0x11')]);return _0x4200d5(_0x5e3514[_0xd97e('0xe')][_0xd97e('0x11')]);}logger[_0xd97e('0xe')](_0xd97e('0x10'),_0x3f16ae,_0x5e3514[_0xd97e('0xe')]['message']);return _0x51a495(_0x5e3514[_0xd97e('0xe')]['message']);}else{logger[_0xd97e('0xa')](_0xd97e('0x10'),_0x3f16ae,_0xd97e('0xb'));_0x51a495(_0x5e3514[_0xd97e('0x12')][_0xd97e('0x11')]);}})[_0xd97e('0x13')](function(_0x48bae3){logger[_0xd97e('0xe')](_0xd97e('0x10'),_0x3f16ae,_0x48bae3);_0x4200d5(_0x48bae3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 953f1ce..948825c 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 _0x9652=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x9652,0xaf));var _0x2965=function(_0x5ea451,_0x133637){_0x5ea451=_0x5ea451-0x0;var _0x37a06a=_0x9652[_0x5ea451];return _0x37a06a;};'use strict';var multer=require(_0x2965('0x0'));var util=require(_0x2965('0x1'));var path=require('path');var timeout=require(_0x2965('0x2'));var express=require(_0x2965('0x3'));var router=express[_0x2965('0x4')]();var auth=require(_0x2965('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2965('0x6'));router[_0x2965('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2965('0x8'),auth[_0x2965('0x9')](),controller[_0x2965('0xa')]);router[_0x2965('0x7')](_0x2965('0xb'),auth['isAuthenticated'](),controller[_0x2965('0xc')]);router[_0x2965('0xd')]('/',auth[_0x2965('0x9')](),controller[_0x2965('0xe')]);router[_0x2965('0xf')]('/:id',auth[_0x2965('0x9')](),controller[_0x2965('0x10')]);router['delete'](_0x2965('0xb'),auth[_0x2965('0x9')](),controller[_0x2965('0x11')]);module[_0x2965('0x12')]=router; \ No newline at end of file +var _0x0b05=['put','/:id','update','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x13bdb6,_0x46f501){var _0x53d733=function(_0x28301c){while(--_0x28301c){_0x13bdb6['push'](_0x13bdb6['shift']());}};_0x53d733(++_0x46f501);}(_0x0b05,0x1ae));var _0x50b0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0b05[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x50b0('0x0'));var timeout=require(_0x50b0('0x1'));var express=require(_0x50b0('0x2'));var router=express[_0x50b0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x50b0('0x4'));var config=require(_0x50b0('0x5'));var controller=require(_0x50b0('0x6'));router[_0x50b0('0x7')]('/',auth[_0x50b0('0x8')](),controller[_0x50b0('0x9')]);router[_0x50b0('0x7')](_0x50b0('0xa'),auth[_0x50b0('0x8')](),controller[_0x50b0('0xb')]);router[_0x50b0('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x50b0('0x8')](),controller['create']);router[_0x50b0('0xc')](_0x50b0('0xd'),auth[_0x50b0('0x8')](),controller[_0x50b0('0xe')]);router[_0x50b0('0xf')](_0x50b0('0xd'),auth[_0x50b0('0x8')](),controller[_0x50b0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 31e6f1c..475693e 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 _0xfe85=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','FAILED'];(function(_0x3b7314,_0x4da394){var _0x38dda7=function(_0x37957f){while(--_0x37957f){_0x3b7314['push'](_0x3b7314['shift']());}};_0x38dda7(++_0x4da394);}(_0xfe85,0x1a7));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5fe8('0x0'));module[_0x5fe8('0x1')]={'integration':{'type':Sequelize[_0x5fe8('0x2')]},'eventChannel':{'type':Sequelize[_0x5fe8('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5fe8('0x2')]},'integrationId':{'type':Sequelize[_0x5fe8('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5fe8('0x2')]},'calleridnum':{'type':Sequelize[_0x5fe8('0x2')]},'calleridname':{'type':Sequelize[_0x5fe8('0x2')]},'queue':{'type':Sequelize[_0x5fe8('0x2')]},'interface':{'type':Sequelize[_0x5fe8('0x2')]},'membername':{'type':Sequelize[_0x5fe8('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5fe8('0x4')]},'agentconnectAt':{'type':Sequelize[_0x5fe8('0x4')]},'holdtime':{'type':Sequelize[_0x5fe8('0x3')]},'agentcomplete':{'type':Sequelize[_0x5fe8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5fe8('0x4')]},'talktime':{'type':Sequelize[_0x5fe8('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5fe8('0x3')]},'reason':{'type':Sequelize[_0x5fe8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5fe8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5fe8('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5fe8('0x4')]},'lastevent':{'type':Sequelize[_0x5fe8('0x2')]},'channel':{'type':Sequelize[_0x5fe8('0x2')]},'channelstate':{'type':Sequelize[_0x5fe8('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5fe8('0x2')]},'connectedlinename':{'type':Sequelize[_0x5fe8('0x2')]},'language':{'type':Sequelize[_0x5fe8('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5fe8('0x2')]},'exten':{'type':Sequelize[_0x5fe8('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5fe8('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5fe8('0x2')]},'destcalleridname':{'type':Sequelize[_0x5fe8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5fe8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5fe8('0x2')]},'destlanguage':{'type':Sequelize[_0x5fe8('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x5fe8('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5fe8('0x2')]},'destuniqueid':{'type':Sequelize[_0x5fe8('0x2')]},'messageId':{'type':Sequelize[_0x5fe8('0x2')]},'inReplyTo':{'type':Sequelize[_0x5fe8('0x2')]},'subject':{'type':Sequelize[_0x5fe8('0x2')]},'from':{'type':Sequelize[_0x5fe8('0x2')]},'to':{'type':Sequelize[_0x5fe8('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x5fe8('0x6')]},'text':{'type':Sequelize[_0x5fe8('0x6')]},'status':{'type':Sequelize['ENUM'](_0x5fe8('0x7'),'SENDING','RECEIVED',_0x5fe8('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x5fe8('0x2')]},'projectId':{'type':Sequelize[_0x5fe8('0x3')]}}; \ No newline at end of file +var _0x8e12=['BOOLEAN','TEXT','ENUM','SENT','RECEIVED','STRING','INTEGER','DATE'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x8e12,0x1cd));var _0x28e1=function(_0x357457,_0x29ddf5){_0x357457=_0x357457-0x0;var _0x7c124=_0x8e12[_0x357457];return _0x7c124;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x28e1('0x0')]},'eventChannel':{'type':Sequelize[_0x28e1('0x0')]},'exitStatus':{'type':Sequelize[_0x28e1('0x0')]},'ticketId':{'type':Sequelize[_0x28e1('0x0')]},'integrationId':{'type':Sequelize[_0x28e1('0x1')]},'contacts':{'type':Sequelize[_0x28e1('0x0')]},'uniqueid':{'type':Sequelize[_0x28e1('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x28e1('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x28e1('0x0')]},'membername':{'type':Sequelize[_0x28e1('0x0')]},'agentcalledAt':{'type':Sequelize[_0x28e1('0x2')]},'agentconnectAt':{'type':Sequelize[_0x28e1('0x2')]},'holdtime':{'type':Sequelize[_0x28e1('0x1')]},'agentcomplete':{'type':Sequelize[_0x28e1('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x28e1('0x2')]},'talktime':{'type':Sequelize[_0x28e1('0x1')]},'agentacw':{'type':Sequelize[_0x28e1('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x28e1('0x1')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x28e1('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x28e1('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x28e1('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x28e1('0x0')]},'channelstate':{'type':Sequelize[_0x28e1('0x1')]},'channelstatedesc':{'type':Sequelize[_0x28e1('0x0')]},'connectedlinenum':{'type':Sequelize[_0x28e1('0x0')]},'connectedlinename':{'type':Sequelize[_0x28e1('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x28e1('0x0')]},'context':{'type':Sequelize[_0x28e1('0x0')]},'exten':{'type':Sequelize[_0x28e1('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x28e1('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x28e1('0x0')]},'destcalleridnum':{'type':Sequelize[_0x28e1('0x0')]},'destcalleridname':{'type':Sequelize[_0x28e1('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x28e1('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x28e1('0x0')]},'destlanguage':{'type':Sequelize[_0x28e1('0x0')]},'destaccountcode':{'type':Sequelize[_0x28e1('0x0')]},'destcontext':{'type':Sequelize[_0x28e1('0x0')]},'destexten':{'type':Sequelize[_0x28e1('0x0')]},'destpriority':{'type':Sequelize[_0x28e1('0x0')]},'destuniqueid':{'type':Sequelize[_0x28e1('0x0')]},'messageId':{'type':Sequelize[_0x28e1('0x0')]},'inReplyTo':{'type':Sequelize[_0x28e1('0x0')]},'subject':{'type':Sequelize[_0x28e1('0x0')]},'from':{'type':Sequelize[_0x28e1('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x28e1('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x28e1('0x4')]},'status':{'type':Sequelize[_0x28e1('0x5')](_0x28e1('0x6'),'SENDING',_0x28e1('0x7'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x28e1('0x0')]},'appdata':{'type':Sequelize[_0x28e1('0x0')]},'projectId':{'type':Sequelize[_0x28e1('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 614a6ed..79f42a5 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 _0xd398=['hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','filter','include','findAll','rows','params','includeAll','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x595439,_0x1653d0){var _0x2fd012=function(_0x45113d){while(--_0x45113d){_0x595439['push'](_0x595439['shift']());}};_0x2fd012(++_0x1653d0);}(_0xd398,0xb1));var _0x8d39=function(_0x23ca0b,_0x2c9a47){_0x23ca0b=_0x23ca0b-0x0;var _0x235eb6=_0xd398[_0x23ca0b];return _0x235eb6;};'use strict';var pdf=require(_0x8d39('0x0'));var emlformat=require(_0x8d39('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8d39('0x2'));var jsonpatch=require(_0x8d39('0x3'));var rp=require(_0x8d39('0x4'));var moment=require(_0x8d39('0x5'));var BPromise=require(_0x8d39('0x6'));var Mustache=require(_0x8d39('0x7'));var util=require(_0x8d39('0x8'));var path=require(_0x8d39('0x9'));var sox=require(_0x8d39('0xa'));var csv=require(_0x8d39('0xb'));var ejs=require(_0x8d39('0xc'));var fs=require('fs');var _=require(_0x8d39('0xd'));var squel=require(_0x8d39('0xe'));var crypto=require(_0x8d39('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8d39('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d39('0x11'));var Papa=require(_0x8d39('0x12'));var Redis=require('ioredis');var authService=require(_0x8d39('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8d39('0x14'));var hardwareService=require(_0x8d39('0x15'));var logger=require(_0x8d39('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8d39('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d39('0x18'))['db'];function respondWithStatusCode(_0x5c8fd3,_0x3c9b6d){_0x3c9b6d=_0x3c9b6d||0xcc;return function(_0x3b8028){if(_0x3b8028){return _0x5c8fd3[_0x8d39('0x19')](_0x3c9b6d);}return _0x5c8fd3['status'](_0x3c9b6d)[_0x8d39('0x1a')]();};}function respondWithResult(_0x22697b,_0x360d94){_0x360d94=_0x360d94||0xc8;return function(_0x49156d){if(_0x49156d){return _0x22697b[_0x8d39('0x1b')](_0x360d94)[_0x8d39('0x1c')](_0x49156d);}};}function respondWithFilteredResult(_0x3f0714,_0x3c70ab){return function(_0x3c56cd){if(_0x3c56cd){var _0x3eefeb=_0x3c56cd[_0x8d39('0x1d')],_0x3bf870=_0x3c70ab[_0x8d39('0x1e')],_0x22a490=_0x3c70ab[_0x8d39('0x1e')]+_0x3c70ab[_0x8d39('0x1f')],_0x1f8c3d;if(_0x22a490>=_0x3eefeb){_0x22a490=_0x3eefeb;_0x1f8c3d=0xc8;}else{_0x1f8c3d=0xce;}_0x3f0714[_0x8d39('0x1b')](_0x1f8c3d);return _0x3f0714[_0x8d39('0x20')](_0x8d39('0x21'),_0x3bf870+'-'+_0x22a490+'/'+_0x3eefeb)[_0x8d39('0x1c')](_0x3c56cd);}return null;};}function patchUpdates(_0x4db350){return function(_0x209b3b){try{jsonpatch[_0x8d39('0x22')](_0x209b3b,_0x4db350,!![]);}catch(_0x2bb846){return BPromise[_0x8d39('0x23')](_0x2bb846);}return _0x209b3b[_0x8d39('0x24')]();};}function saveUpdates(_0x5ad402,_0x2bec28){return function(_0x2a2392){if(_0x2a2392){return _0x2a2392[_0x8d39('0x25')](_0x5ad402)[_0x8d39('0x26')](function(_0x12100e){return _0x12100e;});}return null;};}function removeEntity(_0x327c38,_0x24070b){return function(_0x571adf){if(_0x571adf){return _0x571adf[_0x8d39('0x27')]()[_0x8d39('0x26')](function(){_0x327c38[_0x8d39('0x1b')](0xcc)[_0x8d39('0x1a')]();});}};}function handleEntityNotFound(_0x36586d,_0x589cdb){return function(_0x44ef2f){if(!_0x44ef2f){_0x36586d[_0x8d39('0x19')](0x194);}return _0x44ef2f;};}function handleError(_0x5dd31d,_0x20e1c1){_0x20e1c1=_0x20e1c1||0x1f4;return function(_0xf72963){logger['error'](_0xf72963[_0x8d39('0x28')]);if(_0xf72963[_0x8d39('0x29')]){delete _0xf72963[_0x8d39('0x29')];}_0x5dd31d[_0x8d39('0x1b')](_0x20e1c1)[_0x8d39('0x2a')](_0xf72963);};}exports[_0x8d39('0x2b')]=function(_0x2d562c,_0x4f4e14){var _0x485e84={},_0x55282a={},_0x2839fc={'count':0x0,'rows':[]};var _0xf13a14=_[_0x8d39('0x2c')](db[_0x8d39('0x2d')][_0x8d39('0x2e')],function(_0x118577){return{'name':_0x118577[_0x8d39('0x2f')],'type':_0x118577[_0x8d39('0x30')][_0x8d39('0x31')]};});_0x55282a[_0x8d39('0x32')]=_['map'](_0xf13a14,'name');_0x55282a[_0x8d39('0x33')]=_[_0x8d39('0x34')](_0x2d562c[_0x8d39('0x33')]);_0x55282a['filters']=_[_0x8d39('0x35')](_0x55282a[_0x8d39('0x32')],_0x55282a[_0x8d39('0x33')]);_0x485e84[_0x8d39('0x36')]=_[_0x8d39('0x35')](_0x55282a[_0x8d39('0x32')],qs['fields'](_0x2d562c[_0x8d39('0x33')][_0x8d39('0x37')]));_0x485e84[_0x8d39('0x36')]=_0x485e84[_0x8d39('0x36')][_0x8d39('0x38')]?_0x485e84['attributes']:_0x55282a[_0x8d39('0x32')];if(!_0x2d562c[_0x8d39('0x33')][_0x8d39('0x39')](_0x8d39('0x3a'))){_0x485e84['limit']=qs[_0x8d39('0x1f')](_0x2d562c[_0x8d39('0x33')][_0x8d39('0x1f')]);_0x485e84[_0x8d39('0x1e')]=qs[_0x8d39('0x1e')](_0x2d562c['query']['offset']);}_0x485e84[_0x8d39('0x3b')]=qs[_0x8d39('0x3c')](_0x2d562c[_0x8d39('0x33')][_0x8d39('0x3c')]);_0x485e84['where']=qs['filters'](_[_0x8d39('0x3d')](_0x2d562c[_0x8d39('0x33')],_0x55282a[_0x8d39('0x3e')]),_0xf13a14);if(_0x2d562c[_0x8d39('0x33')]['filter']){_0x485e84['where']=_[_0x8d39('0x3f')](_0x485e84[_0x8d39('0x40')],{'$or':_[_0x8d39('0x2c')](_0xf13a14,function(_0x185b0a){if(_0x185b0a[_0x8d39('0x30')]!==_0x8d39('0x41')){var _0x4a5032={};_0x4a5032[_0x185b0a['name']]={'$like':'%'+_0x2d562c[_0x8d39('0x33')][_0x8d39('0x42')]+'%'};return _0x4a5032;}})});}_0x485e84=_[_0x8d39('0x3f')]({},_0x485e84,_0x2d562c['options']);var _0xa37390={'where':_0x485e84['where']};return db[_0x8d39('0x2d')][_0x8d39('0x1d')](_0xa37390)[_0x8d39('0x26')](function(_0x11adb7){_0x2839fc[_0x8d39('0x1d')]=_0x11adb7;if(_0x2d562c[_0x8d39('0x33')]['includeAll']){_0x485e84[_0x8d39('0x43')]=[{'all':!![]}];}return db[_0x8d39('0x2d')][_0x8d39('0x44')](_0x485e84);})[_0x8d39('0x26')](function(_0x55558d){_0x2839fc[_0x8d39('0x45')]=_0x55558d;return _0x2839fc;})['then'](respondWithFilteredResult(_0x4f4e14,_0x485e84))['catch'](handleError(_0x4f4e14,null));};exports['show']=function(_0x2738c5,_0x5b66c2){var _0xb1d310={'raw':![],'where':{'id':_0x2738c5[_0x8d39('0x46')]['id']}},_0x380e06={};_0x380e06[_0x8d39('0x32')]=_[_0x8d39('0x34')](db[_0x8d39('0x2d')][_0x8d39('0x2e')]);_0x380e06[_0x8d39('0x33')]=_['keys'](_0x2738c5[_0x8d39('0x33')]);_0x380e06[_0x8d39('0x3e')]=_[_0x8d39('0x35')](_0x380e06[_0x8d39('0x32')],_0x380e06[_0x8d39('0x33')]);_0xb1d310[_0x8d39('0x36')]=_[_0x8d39('0x35')](_0x380e06[_0x8d39('0x32')],qs['fields'](_0x2738c5[_0x8d39('0x33')][_0x8d39('0x37')]));_0xb1d310[_0x8d39('0x36')]=_0xb1d310['attributes'][_0x8d39('0x38')]?_0xb1d310[_0x8d39('0x36')]:_0x380e06[_0x8d39('0x32')];if(_0x2738c5[_0x8d39('0x33')][_0x8d39('0x47')]){_0xb1d310[_0x8d39('0x43')]=[{'all':!![]}];}_0xb1d310=_['merge']({},_0xb1d310,_0x2738c5[_0x8d39('0x48')]);return db['IntegrationReport'][_0x8d39('0x49')](_0xb1d310)['then'](handleEntityNotFound(_0x5b66c2,null))['then'](respondWithResult(_0x5b66c2,null))[_0x8d39('0x4a')](handleError(_0x5b66c2,null));};exports['create']=function(_0xba1f8,_0x41ee85){return db[_0x8d39('0x2d')][_0x8d39('0x4b')](_0xba1f8[_0x8d39('0x4c')],{})[_0x8d39('0x26')](respondWithResult(_0x41ee85,0xc9))[_0x8d39('0x4a')](handleError(_0x41ee85,null));};exports[_0x8d39('0x25')]=function(_0x227b56,_0x1d65e0){if(_0x227b56['body']['id']){delete _0x227b56['body']['id'];}return db['IntegrationReport'][_0x8d39('0x49')]({'where':{'id':_0x227b56[_0x8d39('0x46')]['id']}})[_0x8d39('0x26')](handleEntityNotFound(_0x1d65e0,null))['then'](saveUpdates(_0x227b56['body'],null))[_0x8d39('0x26')](respondWithResult(_0x1d65e0,null))['catch'](handleError(_0x1d65e0,null));};exports[_0x8d39('0x27')]=function(_0x2d6b1e,_0x11d571){return db[_0x8d39('0x2d')][_0x8d39('0x49')]({'where':{'id':_0x2d6b1e[_0x8d39('0x46')]['id']}})['then'](handleEntityNotFound(_0x11d571,null))[_0x8d39('0x26')](removeEntity(_0x11d571,null))[_0x8d39('0x4a')](handleError(_0x11d571,null));};exports[_0x8d39('0x4d')]=function(_0x2a4f4d,_0x38b7f5){return db[_0x8d39('0x2d')]['describe']()[_0x8d39('0x26')](respondWithResult(_0x38b7f5,null))[_0x8d39('0x4a')](handleError(_0x38b7f5,null));}; \ No newline at end of file +var _0x46c0=['../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x16acf3,_0x4ae3a6){var _0x463d09=function(_0x2f0ead){while(--_0x2f0ead){_0x16acf3['push'](_0x16acf3['shift']());}};_0x463d09(++_0x4ae3a6);}(_0x46c0,0x101));var _0x046c=function(_0x4d7df6,_0x3f6139){_0x4d7df6=_0x4d7df6-0x0;var _0x4c0d29=_0x46c0[_0x4d7df6];return _0x4c0d29;};'use strict';var pdf=require(_0x046c('0x0'));var emlformat=require(_0x046c('0x1'));var rimraf=require(_0x046c('0x2'));var zipdir=require(_0x046c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x046c('0x4'));var moment=require(_0x046c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x046c('0x6'));var sox=require(_0x046c('0x7'));var csv=require('to-csv');var ejs=require(_0x046c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x046c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x046c('0xa'));var querystring=require(_0x046c('0xb'));var Papa=require('papaparse');var Redis=require(_0x046c('0xc'));var authService=require(_0x046c('0xd'));var qs=require(_0x046c('0xe'));var as=require(_0x046c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x046c('0x10'))(_0x046c('0x11'));var utils=require('../../config/utils');var config=require(_0x046c('0x12'));var licenseUtil=require(_0x046c('0x13'));var db=require(_0x046c('0x14'))['db'];function respondWithStatusCode(_0x3ab345,_0x4138ec){_0x4138ec=_0x4138ec||0xcc;return function(_0x4c09ce){if(_0x4c09ce){return _0x3ab345['sendStatus'](_0x4138ec);}return _0x3ab345[_0x046c('0x15')](_0x4138ec)[_0x046c('0x16')]();};}function respondWithResult(_0x59a600,_0x514400){_0x514400=_0x514400||0xc8;return function(_0xd0519a){if(_0xd0519a){return _0x59a600[_0x046c('0x15')](_0x514400)[_0x046c('0x17')](_0xd0519a);}};}function respondWithFilteredResult(_0x331dd4,_0x467d05){return function(_0x5bd88e){if(_0x5bd88e){var _0x4a5b71=_0x5bd88e[_0x046c('0x18')],_0x345923=_0x467d05[_0x046c('0x19')],_0x23d214=_0x467d05[_0x046c('0x19')]+_0x467d05[_0x046c('0x1a')],_0x26a441;if(_0x23d214>=_0x4a5b71){_0x23d214=_0x4a5b71;_0x26a441=0xc8;}else{_0x26a441=0xce;}_0x331dd4['status'](_0x26a441);return _0x331dd4[_0x046c('0x1b')]('Content-Range',_0x345923+'-'+_0x23d214+'/'+_0x4a5b71)['json'](_0x5bd88e);}return null;};}function patchUpdates(_0x493311){return function(_0x88fd35){try{jsonpatch[_0x046c('0x1c')](_0x88fd35,_0x493311,!![]);}catch(_0x453cdc){return BPromise[_0x046c('0x1d')](_0x453cdc);}return _0x88fd35[_0x046c('0x1e')]();};}function saveUpdates(_0x2c73a3,_0x3859a4){return function(_0x5eb9fd){if(_0x5eb9fd){return _0x5eb9fd['update'](_0x2c73a3)[_0x046c('0x1f')](function(_0x5a53c9){return _0x5a53c9;});}return null;};}function removeEntity(_0x31b3fb,_0x293e4d){return function(_0x3c1dbd){if(_0x3c1dbd){return _0x3c1dbd[_0x046c('0x20')]()[_0x046c('0x1f')](function(){_0x31b3fb[_0x046c('0x15')](0xcc)[_0x046c('0x16')]();});}};}function handleEntityNotFound(_0xfc1d7a,_0x5719f7){return function(_0x3e600a){if(!_0x3e600a){_0xfc1d7a[_0x046c('0x21')](0x194);}return _0x3e600a;};}function handleError(_0x22d7a3,_0x268a11){_0x268a11=_0x268a11||0x1f4;return function(_0x2428ac){logger['error'](_0x2428ac['stack']);if(_0x2428ac[_0x046c('0x22')]){delete _0x2428ac[_0x046c('0x22')];}_0x22d7a3['status'](_0x268a11)['send'](_0x2428ac);};}exports[_0x046c('0x23')]=function(_0x4370bc,_0x295d3e){var _0x72a1cb={},_0x1d5d3f={},_0x137674={'count':0x0,'rows':[]};var _0x49b4a7=_[_0x046c('0x24')](db[_0x046c('0x25')][_0x046c('0x26')],function(_0x5cb95d){return{'name':_0x5cb95d[_0x046c('0x27')],'type':_0x5cb95d[_0x046c('0x28')][_0x046c('0x29')]};});_0x1d5d3f[_0x046c('0x2a')]=_[_0x046c('0x24')](_0x49b4a7,_0x046c('0x22'));_0x1d5d3f[_0x046c('0x2b')]=_[_0x046c('0x2c')](_0x4370bc[_0x046c('0x2b')]);_0x1d5d3f[_0x046c('0x2d')]=_[_0x046c('0x2e')](_0x1d5d3f['model'],_0x1d5d3f[_0x046c('0x2b')]);_0x72a1cb[_0x046c('0x2f')]=_[_0x046c('0x2e')](_0x1d5d3f[_0x046c('0x2a')],qs[_0x046c('0x30')](_0x4370bc[_0x046c('0x2b')][_0x046c('0x30')]));_0x72a1cb[_0x046c('0x2f')]=_0x72a1cb[_0x046c('0x2f')]['length']?_0x72a1cb['attributes']:_0x1d5d3f[_0x046c('0x2a')];if(!_0x4370bc[_0x046c('0x2b')][_0x046c('0x31')](_0x046c('0x32'))){_0x72a1cb[_0x046c('0x1a')]=qs[_0x046c('0x1a')](_0x4370bc[_0x046c('0x2b')][_0x046c('0x1a')]);_0x72a1cb[_0x046c('0x19')]=qs[_0x046c('0x19')](_0x4370bc['query'][_0x046c('0x19')]);}_0x72a1cb['order']=qs[_0x046c('0x33')](_0x4370bc[_0x046c('0x2b')][_0x046c('0x33')]);_0x72a1cb[_0x046c('0x34')]=qs[_0x046c('0x2d')](_[_0x046c('0x35')](_0x4370bc[_0x046c('0x2b')],_0x1d5d3f[_0x046c('0x2d')]),_0x49b4a7);if(_0x4370bc[_0x046c('0x2b')][_0x046c('0x36')]){_0x72a1cb['where']=_[_0x046c('0x37')](_0x72a1cb[_0x046c('0x34')],{'$or':_['map'](_0x49b4a7,function(_0x33107b){if(_0x33107b[_0x046c('0x28')]!=='VIRTUAL'){var _0x475745={};_0x475745[_0x33107b['name']]={'$like':'%'+_0x4370bc[_0x046c('0x2b')]['filter']+'%'};return _0x475745;}})});}_0x72a1cb=_[_0x046c('0x37')]({},_0x72a1cb,_0x4370bc[_0x046c('0x38')]);var _0x56b42a={'where':_0x72a1cb[_0x046c('0x34')]};return db[_0x046c('0x25')][_0x046c('0x18')](_0x56b42a)[_0x046c('0x1f')](function(_0x7ca26e){_0x137674[_0x046c('0x18')]=_0x7ca26e;if(_0x4370bc['query'][_0x046c('0x39')]){_0x72a1cb['include']=[{'all':!![]}];}return db[_0x046c('0x25')][_0x046c('0x3a')](_0x72a1cb);})[_0x046c('0x1f')](function(_0x504014){_0x137674['rows']=_0x504014;return _0x137674;})[_0x046c('0x1f')](respondWithFilteredResult(_0x295d3e,_0x72a1cb))[_0x046c('0x3b')](handleError(_0x295d3e,null));};exports[_0x046c('0x3c')]=function(_0x47b96c,_0x293eca){var _0xf40271={'raw':![],'where':{'id':_0x47b96c[_0x046c('0x3d')]['id']}},_0x3cdf99={};_0x3cdf99['model']=_[_0x046c('0x2c')](db[_0x046c('0x25')][_0x046c('0x26')]);_0x3cdf99['query']=_[_0x046c('0x2c')](_0x47b96c[_0x046c('0x2b')]);_0x3cdf99['filters']=_['intersection'](_0x3cdf99[_0x046c('0x2a')],_0x3cdf99[_0x046c('0x2b')]);_0xf40271[_0x046c('0x2f')]=_['intersection'](_0x3cdf99['model'],qs['fields'](_0x47b96c[_0x046c('0x2b')][_0x046c('0x30')]));_0xf40271['attributes']=_0xf40271[_0x046c('0x2f')][_0x046c('0x3e')]?_0xf40271[_0x046c('0x2f')]:_0x3cdf99['model'];if(_0x47b96c[_0x046c('0x2b')]['includeAll']){_0xf40271[_0x046c('0x3f')]=[{'all':!![]}];}_0xf40271=_[_0x046c('0x37')]({},_0xf40271,_0x47b96c['options']);return db[_0x046c('0x25')][_0x046c('0x40')](_0xf40271)['then'](handleEntityNotFound(_0x293eca,null))['then'](respondWithResult(_0x293eca,null))[_0x046c('0x3b')](handleError(_0x293eca,null));};exports[_0x046c('0x41')]=function(_0x5ca738,_0x18c075){return db[_0x046c('0x25')][_0x046c('0x41')](_0x5ca738[_0x046c('0x42')],{})[_0x046c('0x1f')](respondWithResult(_0x18c075,0xc9))[_0x046c('0x3b')](handleError(_0x18c075,null));};exports[_0x046c('0x43')]=function(_0x40d23d,_0x5aa44f){if(_0x40d23d[_0x046c('0x42')]['id']){delete _0x40d23d['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x40d23d[_0x046c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5aa44f,null))[_0x046c('0x1f')](saveUpdates(_0x40d23d['body'],null))[_0x046c('0x1f')](respondWithResult(_0x5aa44f,null))[_0x046c('0x3b')](handleError(_0x5aa44f,null));};exports[_0x046c('0x20')]=function(_0x23cd85,_0x18503e){return db['IntegrationReport'][_0x046c('0x40')]({'where':{'id':_0x23cd85[_0x046c('0x3d')]['id']}})[_0x046c('0x1f')](handleEntityNotFound(_0x18503e,null))['then'](removeEntity(_0x18503e,null))[_0x046c('0x3b')](handleError(_0x18503e,null));};exports[_0x046c('0x44')]=function(_0x41381a,_0x38d3d9){return db[_0x046c('0x25')]['describe']()['then'](respondWithResult(_0x38d3d9,null))[_0x046c('0x3b')](handleError(_0x38d3d9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 652a59e..a5bda6e 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 _0xbfdf=['moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api'];(function(_0x3fa87c,_0x2e86b6){var _0xaab868=function(_0x2af2ec){while(--_0x2af2ec){_0x3fa87c['push'](_0x3fa87c['shift']());}};_0xaab868(++_0x2e86b6);}(_0xbfdf,0x169));var _0xfbfd=function(_0xe45fc1,_0x2676a7){_0xe45fc1=_0xe45fc1-0x0;var _0x4914fc=_0xbfdf[_0xe45fc1];return _0x4914fc;};'use strict';var _=require(_0xfbfd('0x0'));var util=require('util');var logger=require(_0xfbfd('0x1'))(_0xfbfd('0x2'));var moment=require(_0xfbfd('0x3'));var BPromise=require(_0xfbfd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbfd('0x5'));var rimraf=require(_0xfbfd('0x6'));var config=require(_0xfbfd('0x7'));var attributes=require(_0xfbfd('0x8'));module[_0xfbfd('0x9')]=function(_0x353186,_0x534c6d){return _0x353186[_0xfbfd('0xa')](_0xfbfd('0xb'),attributes,{'tableName':_0xfbfd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcac6=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','moment','bluebird'];(function(_0x252a77,_0x5f36e7){var _0x1217c2=function(_0xff9288){while(--_0xff9288){_0x252a77['push'](_0x252a77['shift']());}};_0x1217c2(++_0x5f36e7);}(_0xcac6,0xaf));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6cac('0x0'));var util=require(_0x6cac('0x1'));var logger=require(_0x6cac('0x2'))('api');var moment=require(_0x6cac('0x3'));var BPromise=require(_0x6cac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cac('0x5'));var rimraf=require(_0x6cac('0x6'));var config=require(_0x6cac('0x7'));var attributes=require(_0x6cac('0x8'));module[_0x6cac('0x9')]=function(_0x2d946f,_0x3a7091){return _0x2d946f[_0x6cac('0xa')](_0x6cac('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 1cd39d3..a6630ef 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4cfb49,_0xcc1831){var _0x3c4e98=function(_0x5c09ec){while(--_0x5c09ec){_0x4cfb49['push'](_0x4cfb49['shift']());}};_0x3c4e98(++_0xcc1831);}(_0xb10b,0x12a));var _0xbb10=function(_0x1865d4,_0x569a81){_0x1865d4=_0x1865d4-0x0;var _0x1f0e1c=_0xb10b[_0x1865d4];return _0x1f0e1c;};'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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8603,0x190));var _0x3860=function(_0x33ac28,_0xbcde95){_0x33ac28=_0x33ac28-0x0;var _0x263076=_0x8603[_0x33ac28];return _0x263076;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 30dcfbe..c545368 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0x55ca[_0x3af955];return _0x167de5;};'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 _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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x55ca[_0x2605dc];return _0x4568c9;};'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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 6ff4a33..03fb0d6 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 _0xac53=['exports','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xac53,0xf4));var _0x3ac5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac53[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3ac5('0x0')]={'name':{'type':Sequelize[_0x3ac5('0x1')]},'description':{'type':Sequelize[_0x3ac5('0x1')]},'interval':{'type':Sequelize[_0x3ac5('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x1350=['STRING','exports'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x1350,0x113));var _0x0135=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1350[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x0135('0x0')]={'name':{'type':Sequelize[_0x0135('0x1')]},'description':{'type':Sequelize[_0x0135('0x1')]},'interval':{'type':Sequelize[_0x0135('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 01753b9..04c4935 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 _0x8616=['catch','show','params','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Intervals','error','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows'];(function(_0x4494fb,_0x214efb){var _0x472e38=function(_0x2c6247){while(--_0x2c6247){_0x4494fb['push'](_0x4494fb['shift']());}};_0x472e38(++_0x214efb);}(_0x8616,0xc1));var _0x6861=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8616[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6861('0x0'));var rimraf=require(_0x6861('0x1'));var zipdir=require(_0x6861('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6861('0x3'));var moment=require(_0x6861('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6861('0x5'));var path=require('path');var sox=require(_0x6861('0x6'));var csv=require(_0x6861('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6861('0x8'));var squel=require('squel');var crypto=require(_0x6861('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6861('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6861('0xb'));var Papa=require(_0x6861('0xc'));var Redis=require('ioredis');var authService=require(_0x6861('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6861('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6861('0xf'))(_0x6861('0x10'));var utils=require(_0x6861('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6861('0x12'));var db=require(_0x6861('0x13'))['db'];var extensions=require(_0x6861('0x14'));function respondWithStatusCode(_0x3c19db,_0x241d17){_0x241d17=_0x241d17||0xcc;return function(_0x36b3e6){if(_0x36b3e6){return _0x3c19db[_0x6861('0x15')](_0x241d17);}return _0x3c19db[_0x6861('0x16')](_0x241d17)[_0x6861('0x17')]();};}function respondWithResult(_0x817098,_0x1fdacc){_0x1fdacc=_0x1fdacc||0xc8;return function(_0x1ee393){if(_0x1ee393){return _0x817098[_0x6861('0x16')](_0x1fdacc)[_0x6861('0x18')](_0x1ee393);}};}function respondWithFilteredResult(_0x22e1bc,_0xa71162){return function(_0x5eb775){if(_0x5eb775){var _0x13fc85=_0x5eb775[_0x6861('0x19')],_0x5ebccb=_0xa71162[_0x6861('0x1a')],_0x22cd13=_0xa71162['offset']+_0xa71162[_0x6861('0x1b')],_0x1a758b;if(_0x22cd13>=_0x13fc85){_0x22cd13=_0x13fc85;_0x1a758b=0xc8;}else{_0x1a758b=0xce;}_0x22e1bc[_0x6861('0x16')](_0x1a758b);return _0x22e1bc[_0x6861('0x1c')](_0x6861('0x1d'),_0x5ebccb+'-'+_0x22cd13+'/'+_0x13fc85)['json'](_0x5eb775);}return null;};}function patchUpdates(_0x197b5d){return function(_0xda4bc6){try{jsonpatch['apply'](_0xda4bc6,_0x197b5d,!![]);}catch(_0x53519c){return BPromise[_0x6861('0x1e')](_0x53519c);}return _0xda4bc6['save']();};}function saveUpdates(_0x4a3c11,_0x1b0d6c){return function(_0x4e7249){if(_0x4e7249){return _0x4e7249[_0x6861('0x1f')](_0x4a3c11)[_0x6861('0x20')](function(_0x29f139){return _0x29f139;});}return null;};}function removeEntity(_0x2153a0,_0x3c245a){return function(_0x328730){if(_0x328730){return _0x328730[_0x6861('0x21')]()['then'](function(){var _0x1d6f1b=_0x328730[_0x6861('0x22')]({'plain':!![]});var _0x5efdf4=_0x6861('0x23');return db['UserProfileResource'][_0x6861('0x21')]({'where':{'type':_0x5efdf4,'resourceId':_0x1d6f1b['id']}})['then'](function(){return _0x328730;});})[_0x6861('0x20')](function(){_0x2153a0[_0x6861('0x16')](0xcc)[_0x6861('0x17')]();});}};}function handleEntityNotFound(_0xdb7670,_0x47466a){return function(_0xa78aff){if(!_0xa78aff){_0xdb7670[_0x6861('0x15')](0x194);}return _0xa78aff;};}function handleError(_0x5b6ba0,_0x33979e){_0x33979e=_0x33979e||0x1f4;return function(_0x14ba59){logger[_0x6861('0x24')](_0x14ba59['stack']);if(_0x14ba59[_0x6861('0x25')]){delete _0x14ba59[_0x6861('0x25')];}_0x5b6ba0['status'](_0x33979e)[_0x6861('0x26')](_0x14ba59);};}exports['index']=function(_0x21e718,_0x33fd9a){var _0x492c7d={},_0x7a7301={},_0x3ca508={'count':0x0,'rows':[]};var _0xb477d3=_[_0x6861('0x27')](db[_0x6861('0x28')][_0x6861('0x29')],function(_0x215666){return{'name':_0x215666[_0x6861('0x2a')],'type':_0x215666[_0x6861('0x2b')][_0x6861('0x2c')]};});_0x7a7301['model']=_[_0x6861('0x27')](_0xb477d3,_0x6861('0x25'));_0x7a7301[_0x6861('0x2d')]=_[_0x6861('0x2e')](_0x21e718[_0x6861('0x2d')]);_0x7a7301[_0x6861('0x2f')]=_['intersection'](_0x7a7301[_0x6861('0x30')],_0x7a7301[_0x6861('0x2d')]);_0x492c7d['attributes']=_[_0x6861('0x31')](_0x7a7301[_0x6861('0x30')],qs[_0x6861('0x32')](_0x21e718[_0x6861('0x2d')]['fields']));_0x492c7d[_0x6861('0x33')]=_0x492c7d['attributes']['length']?_0x492c7d[_0x6861('0x33')]:_0x7a7301['model'];if(!_0x21e718[_0x6861('0x2d')][_0x6861('0x34')](_0x6861('0x35'))){_0x492c7d['limit']=qs[_0x6861('0x1b')](_0x21e718[_0x6861('0x2d')][_0x6861('0x1b')]);_0x492c7d[_0x6861('0x1a')]=qs['offset'](_0x21e718['query'][_0x6861('0x1a')]);}_0x492c7d[_0x6861('0x36')]=qs[_0x6861('0x37')](_0x21e718[_0x6861('0x2d')][_0x6861('0x37')]);_0x492c7d['where']=qs[_0x6861('0x2f')](_[_0x6861('0x38')](_0x21e718['query'],_0x7a7301[_0x6861('0x2f')]),_0xb477d3);if(_0x21e718[_0x6861('0x2d')]['filter']){_0x492c7d[_0x6861('0x39')]=_[_0x6861('0x3a')](_0x492c7d[_0x6861('0x39')],{'$or':_['map'](_0xb477d3,function(_0x5237d6){if(_0x5237d6[_0x6861('0x2b')]!==_0x6861('0x3b')){var _0x387936={};_0x387936[_0x5237d6[_0x6861('0x25')]]={'$like':'%'+_0x21e718[_0x6861('0x2d')][_0x6861('0x3c')]+'%'};return _0x387936;}})});}_0x492c7d=_[_0x6861('0x3a')]({},_0x492c7d,_0x21e718[_0x6861('0x3d')]);var _0x528bc6={'where':_0x492c7d[_0x6861('0x39')]};return db[_0x6861('0x28')]['count'](_0x528bc6)[_0x6861('0x20')](function(_0xc45a84){_0x3ca508[_0x6861('0x19')]=_0xc45a84;if(_0x21e718['query'][_0x6861('0x3e')]){_0x492c7d['include']=[{'all':!![]}];}return db['Interval'][_0x6861('0x3f')](_0x492c7d);})[_0x6861('0x20')](function(_0x34386d){_0x3ca508[_0x6861('0x40')]=_0x34386d;return _0x3ca508;})['then'](respondWithFilteredResult(_0x33fd9a,_0x492c7d))[_0x6861('0x41')](handleError(_0x33fd9a,null));};exports[_0x6861('0x42')]=function(_0x2f99e7,_0x572cba){var _0x24eaa1={'raw':!![],'where':{'id':_0x2f99e7[_0x6861('0x43')]['id']}},_0x5b29ba={};_0x5b29ba['model']=_[_0x6861('0x2e')](db[_0x6861('0x28')][_0x6861('0x29')]);_0x5b29ba['query']=_['keys'](_0x2f99e7[_0x6861('0x2d')]);_0x5b29ba[_0x6861('0x2f')]=_[_0x6861('0x31')](_0x5b29ba[_0x6861('0x30')],_0x5b29ba['query']);_0x24eaa1['attributes']=_[_0x6861('0x31')](_0x5b29ba['model'],qs[_0x6861('0x32')](_0x2f99e7['query'][_0x6861('0x32')]));_0x24eaa1[_0x6861('0x33')]=_0x24eaa1['attributes'][_0x6861('0x44')]?_0x24eaa1[_0x6861('0x33')]:_0x5b29ba[_0x6861('0x30')];if(_0x2f99e7['query'][_0x6861('0x3e')]){_0x24eaa1[_0x6861('0x45')]=[{'all':!![]}];}_0x24eaa1=_[_0x6861('0x3a')]({},_0x24eaa1,_0x2f99e7['options']);return db['Interval']['find'](_0x24eaa1)[_0x6861('0x20')](handleEntityNotFound(_0x572cba,null))['then'](respondWithResult(_0x572cba,null))['catch'](handleError(_0x572cba,null));};exports[_0x6861('0x46')]=function(_0x326488,_0x2d706d){return db[_0x6861('0x28')]['create'](_0x326488[_0x6861('0x47')],{})[_0x6861('0x20')](function(_0x2f0b0d){var _0x533a82=_0x326488['user'][_0x6861('0x22')]({'plain':!![]});if(!_0x533a82)throw new Error(_0x6861('0x48'));if(_0x533a82[_0x6861('0x49')]==='user'){var _0x53eb22=_0x2f0b0d['get']({'plain':!![]});var _0x1413b7='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x1413b7,'userProfileId':_0x533a82[_0x6861('0x4a')]},'raw':!![]})['then'](function(_0x36ae46){if(_0x36ae46&&_0x36ae46[_0x6861('0x4b')]===0x0){return db[_0x6861('0x4c')]['create']({'name':_0x53eb22[_0x6861('0x25')],'resourceId':_0x53eb22['id'],'type':_0x36ae46[_0x6861('0x25')],'sectionId':_0x36ae46['id']},{})[_0x6861('0x20')](function(){return _0x2f0b0d;});}else{return _0x2f0b0d;}})['catch'](function(_0x2c4ad6){logger[_0x6861('0x24')](_0x6861('0x4d'),_0x2c4ad6);throw _0x2c4ad6;});}return _0x2f0b0d;})[_0x6861('0x20')](respondWithResult(_0x2d706d,0xc9))[_0x6861('0x41')](handleError(_0x2d706d,null));};exports[_0x6861('0x1f')]=function(_0x2e46e4,_0x449de1){if(_0x2e46e4['body']['id']){delete _0x2e46e4['body']['id'];}return db[_0x6861('0x28')][_0x6861('0x4e')]({'where':{'id':_0x2e46e4[_0x6861('0x43')]['id']}})['then'](handleEntityNotFound(_0x449de1,null))[_0x6861('0x20')](saveUpdates(_0x2e46e4[_0x6861('0x47')],null))['then'](respondWithResult(_0x449de1,null))['catch'](handleError(_0x449de1,null));};exports['destroy']=function(_0x28aae9,_0x48cd9c){return db['Interval'][_0x6861('0x4e')]({'where':{'id':_0x28aae9[_0x6861('0x43')]['id']}})[_0x6861('0x20')](handleEntityNotFound(_0x48cd9c,null))['then'](removeEntity(_0x48cd9c,null))[_0x6861('0x41')](handleError(_0x48cd9c,null));};exports[_0x6861('0x4f')]=function(_0x256030,_0x3859b7,_0x58f520){if(_0x256030['body']['id']){delete _0x256030['body']['id'];}return db[_0x6861('0x28')][_0x6861('0x4e')]({'where':{'id':_0x256030[_0x6861('0x43')]['id']}})[_0x6861('0x20')](handleEntityNotFound(_0x3859b7,null))[_0x6861('0x20')](function(_0x3e7071){if(_0x3e7071){_0x256030[_0x6861('0x47')][_0x6861('0x50')]=_0x3e7071['id'];return db[_0x6861('0x28')][_0x6861('0x46')](_0x256030[_0x6861('0x47')]);}})[_0x6861('0x20')](respondWithResult(_0x3859b7,null))[_0x6861('0x41')](handleError(_0x3859b7,null));};exports[_0x6861('0x51')]=function(_0x33de29,_0xae33c7,_0x3b188b){var _0x194994={};var _0x20ab15={};var _0x2cf201;var _0x5745b7;return db[_0x6861('0x28')][_0x6861('0x52')]({'where':{'id':_0x33de29[_0x6861('0x43')]['id']}})[_0x6861('0x20')](handleEntityNotFound(_0xae33c7,null))[_0x6861('0x20')](function(_0x5d7922){if(_0x5d7922){_0x2cf201=_0x5d7922;_0x20ab15[_0x6861('0x30')]=_[_0x6861('0x2e')](db[_0x6861('0x28')]['rawAttributes']);_0x20ab15[_0x6861('0x2d')]=_[_0x6861('0x2e')](_0x33de29[_0x6861('0x2d')]);_0x20ab15[_0x6861('0x2f')]=_['intersection'](_0x20ab15[_0x6861('0x30')],_0x20ab15[_0x6861('0x2d')]);_0x194994[_0x6861('0x33')]=_[_0x6861('0x31')](_0x20ab15[_0x6861('0x30')],qs[_0x6861('0x32')](_0x33de29[_0x6861('0x2d')]['fields']));_0x194994['attributes']=_0x194994[_0x6861('0x33')]['length']?_0x194994[_0x6861('0x33')]:_0x20ab15['model'];_0x194994['order']=qs['sort'](_0x33de29[_0x6861('0x2d')][_0x6861('0x37')]);_0x194994[_0x6861('0x39')]=qs[_0x6861('0x2f')](_['pick'](_0x33de29[_0x6861('0x2d')],_0x20ab15[_0x6861('0x2f')]));if(_0x33de29[_0x6861('0x2d')][_0x6861('0x3c')]){_0x194994[_0x6861('0x39')]=_[_0x6861('0x3a')](_0x194994['where'],{'$or':_[_0x6861('0x27')](_0x194994[_0x6861('0x33')],function(_0x3eb612){var _0x26e506={};_0x26e506[_0x3eb612]={'$like':'%'+_0x33de29[_0x6861('0x2d')][_0x6861('0x3c')]+'%'};return _0x26e506;})});}_0x194994=_[_0x6861('0x3a')]({},_0x194994,_0x33de29[_0x6861('0x3d')]);return _0x2cf201[_0x6861('0x51')](_0x194994);}})['then'](function(_0x352d14){if(_0x352d14){_0x5745b7=_0x352d14[_0x6861('0x44')];if(!_0x33de29['query'][_0x6861('0x34')](_0x6861('0x35'))){_0x194994[_0x6861('0x1b')]=qs[_0x6861('0x1b')](_0x33de29[_0x6861('0x2d')]['limit']);_0x194994[_0x6861('0x1a')]=qs[_0x6861('0x1a')](_0x33de29[_0x6861('0x2d')]['offset']);}return _0x2cf201[_0x6861('0x51')](_0x194994);}})[_0x6861('0x20')](function(_0x2aebab){if(_0x2aebab){return _0x2aebab?{'count':_0x5745b7,'rows':_0x2aebab}:null;}})[_0x6861('0x20')](respondWithResult(_0xae33c7,null))[_0x6861('0x41')](handleError(_0xae33c7,null));};exports['addIntervals']=function(_0x399303,_0x8463eb,_0x3aef56){return db[_0x6861('0x28')][_0x6861('0x52')]({'where':{'id':_0x399303[_0x6861('0x43')]['id']}})['then'](handleEntityNotFound(_0x8463eb,null))[_0x6861('0x20')](function(_0xc83ce0){if(_0xc83ce0){return db[_0x6861('0x53')][_0x6861('0x54')](function(_0x4839f1){return db[_0x6861('0x28')][_0x6861('0x21')]({'where':{'IntervalId':_0x399303[_0x6861('0x43')]['id']},'transaction':_0x4839f1})['then'](function(_0x20d5c2){var _0x589b41=_[_0x6861('0x27')](_0x399303[_0x6861('0x47')],function(_0x355cbb){delete _0x355cbb['id'];_0x355cbb[_0x6861('0x50')]=_0x399303[_0x6861('0x43')]['id'];return _0x355cbb;});return db['Interval'][_0x6861('0x55')](_0x589b41,{'transaction':_0x4839f1});});})[_0x6861('0x20')](function(){return db[_0x6861('0x28')][_0x6861('0x3f')]({'where':{'IntervalId':_0x399303[_0x6861('0x43')]['id']}});});}})[_0x6861('0x20')](respondWithResult(_0x8463eb,null))['catch'](handleError(_0x8463eb,null));}; \ No newline at end of file +var _0xf3ed=['sort','where','filter','merge','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','apply','reject','update','then','UserProfileResource','error','name','send','index','map','Interval','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf3ed,0x1d9));var _0xdf3e=function(_0x40aa56,_0x246d24){_0x40aa56=_0x40aa56-0x0;var _0x290254=_0xf3ed[_0x40aa56];return _0x290254;};'use strict';var pdf=require(_0xdf3e('0x0'));var emlformat=require(_0xdf3e('0x1'));var rimraf=require(_0xdf3e('0x2'));var zipdir=require(_0xdf3e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf3e('0x4'));var moment=require('moment');var BPromise=require(_0xdf3e('0x5'));var Mustache=require(_0xdf3e('0x6'));var util=require('util');var path=require(_0xdf3e('0x7'));var sox=require(_0xdf3e('0x8'));var csv=require(_0xdf3e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf3e('0xa'));var squel=require('squel');var crypto=require(_0xdf3e('0xb'));var jsforce=require(_0xdf3e('0xc'));var deskjs=require(_0xdf3e('0xd'));var toCsv=require(_0xdf3e('0x9'));var querystring=require('querystring');var Papa=require(_0xdf3e('0xe'));var Redis=require(_0xdf3e('0xf'));var authService=require(_0xdf3e('0x10'));var qs=require(_0xdf3e('0x11'));var as=require(_0xdf3e('0x12'));var hardwareService=require(_0xdf3e('0x13'));var logger=require(_0xdf3e('0x14'))(_0xdf3e('0x15'));var utils=require(_0xdf3e('0x16'));var config=require(_0xdf3e('0x17'));var licenseUtil=require(_0xdf3e('0x18'));var db=require(_0xdf3e('0x19'))['db'];var extensions=require(_0xdf3e('0x1a'));function respondWithStatusCode(_0x4ade28,_0x280800){_0x280800=_0x280800||0xcc;return function(_0x440aac){if(_0x440aac){return _0x4ade28[_0xdf3e('0x1b')](_0x280800);}return _0x4ade28[_0xdf3e('0x1c')](_0x280800)[_0xdf3e('0x1d')]();};}function respondWithResult(_0x293d8f,_0x1127b7){_0x1127b7=_0x1127b7||0xc8;return function(_0x13bcec){if(_0x13bcec){return _0x293d8f[_0xdf3e('0x1c')](_0x1127b7)['json'](_0x13bcec);}};}function respondWithFilteredResult(_0x217e46,_0x2b9d3a){return function(_0x198083){if(_0x198083){var _0x30f40d=_0x198083['count'],_0x5af25d=_0x2b9d3a[_0xdf3e('0x1e')],_0x3eb3ba=_0x2b9d3a[_0xdf3e('0x1e')]+_0x2b9d3a[_0xdf3e('0x1f')],_0x1c335f;if(_0x3eb3ba>=_0x30f40d){_0x3eb3ba=_0x30f40d;_0x1c335f=0xc8;}else{_0x1c335f=0xce;}_0x217e46[_0xdf3e('0x1c')](_0x1c335f);return _0x217e46[_0xdf3e('0x20')]('Content-Range',_0x5af25d+'-'+_0x3eb3ba+'/'+_0x30f40d)['json'](_0x198083);}return null;};}function patchUpdates(_0x435b1a){return function(_0x1a6c6e){try{jsonpatch[_0xdf3e('0x21')](_0x1a6c6e,_0x435b1a,!![]);}catch(_0x4ee8f2){return BPromise[_0xdf3e('0x22')](_0x4ee8f2);}return _0x1a6c6e['save']();};}function saveUpdates(_0x178e2a,_0x22e190){return function(_0x4beb4c){if(_0x4beb4c){return _0x4beb4c[_0xdf3e('0x23')](_0x178e2a)['then'](function(_0x4ceb98){return _0x4ceb98;});}return null;};}function removeEntity(_0x76a017,_0x1f7f3f){return function(_0x24e602){if(_0x24e602){return _0x24e602['destroy']()[_0xdf3e('0x24')](function(){var _0x43e33c=_0x24e602['get']({'plain':!![]});var _0x2a9733='Intervals';return db[_0xdf3e('0x25')]['destroy']({'where':{'type':_0x2a9733,'resourceId':_0x43e33c['id']}})[_0xdf3e('0x24')](function(){return _0x24e602;});})[_0xdf3e('0x24')](function(){_0x76a017[_0xdf3e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db781,_0x4251c1){return function(_0x2788ed){if(!_0x2788ed){_0x3db781[_0xdf3e('0x1b')](0x194);}return _0x2788ed;};}function handleError(_0xb3b972,_0x5771d1){_0x5771d1=_0x5771d1||0x1f4;return function(_0x13e529){logger[_0xdf3e('0x26')](_0x13e529['stack']);if(_0x13e529[_0xdf3e('0x27')]){delete _0x13e529['name'];}_0xb3b972[_0xdf3e('0x1c')](_0x5771d1)[_0xdf3e('0x28')](_0x13e529);};}exports[_0xdf3e('0x29')]=function(_0x272188,_0x53f300){var _0x26ff68={},_0x1960b8={},_0x8d88de={'count':0x0,'rows':[]};var _0x177c0d=_[_0xdf3e('0x2a')](db[_0xdf3e('0x2b')]['rawAttributes'],function(_0x183f08){return{'name':_0x183f08[_0xdf3e('0x2c')],'type':_0x183f08[_0xdf3e('0x2d')][_0xdf3e('0x2e')]};});_0x1960b8[_0xdf3e('0x2f')]=_[_0xdf3e('0x2a')](_0x177c0d,_0xdf3e('0x27'));_0x1960b8[_0xdf3e('0x30')]=_['keys'](_0x272188[_0xdf3e('0x30')]);_0x1960b8[_0xdf3e('0x31')]=_['intersection'](_0x1960b8[_0xdf3e('0x2f')],_0x1960b8[_0xdf3e('0x30')]);_0x26ff68[_0xdf3e('0x32')]=_[_0xdf3e('0x33')](_0x1960b8[_0xdf3e('0x2f')],qs['fields'](_0x272188[_0xdf3e('0x30')][_0xdf3e('0x34')]));_0x26ff68['attributes']=_0x26ff68[_0xdf3e('0x32')][_0xdf3e('0x35')]?_0x26ff68['attributes']:_0x1960b8['model'];if(!_0x272188[_0xdf3e('0x30')]['hasOwnProperty']('nolimit')){_0x26ff68[_0xdf3e('0x1f')]=qs[_0xdf3e('0x1f')](_0x272188[_0xdf3e('0x30')]['limit']);_0x26ff68[_0xdf3e('0x1e')]=qs[_0xdf3e('0x1e')](_0x272188[_0xdf3e('0x30')][_0xdf3e('0x1e')]);}_0x26ff68[_0xdf3e('0x36')]=qs[_0xdf3e('0x37')](_0x272188[_0xdf3e('0x30')][_0xdf3e('0x37')]);_0x26ff68[_0xdf3e('0x38')]=qs[_0xdf3e('0x31')](_['pick'](_0x272188[_0xdf3e('0x30')],_0x1960b8['filters']),_0x177c0d);if(_0x272188[_0xdf3e('0x30')][_0xdf3e('0x39')]){_0x26ff68[_0xdf3e('0x38')]=_[_0xdf3e('0x3a')](_0x26ff68['where'],{'$or':_['map'](_0x177c0d,function(_0xbe58e1){if(_0xbe58e1[_0xdf3e('0x2d')]!=='VIRTUAL'){var _0x7082c8={};_0x7082c8[_0xbe58e1[_0xdf3e('0x27')]]={'$like':'%'+_0x272188['query']['filter']+'%'};return _0x7082c8;}})});}_0x26ff68=_[_0xdf3e('0x3a')]({},_0x26ff68,_0x272188['options']);var _0x260a20={'where':_0x26ff68[_0xdf3e('0x38')]};return db[_0xdf3e('0x2b')]['count'](_0x260a20)['then'](function(_0x5ad6bf){_0x8d88de[_0xdf3e('0x3b')]=_0x5ad6bf;if(_0x272188['query'][_0xdf3e('0x3c')]){_0x26ff68[_0xdf3e('0x3d')]=[{'all':!![]}];}return db['Interval'][_0xdf3e('0x3e')](_0x26ff68);})['then'](function(_0x43924d){_0x8d88de[_0xdf3e('0x3f')]=_0x43924d;return _0x8d88de;})[_0xdf3e('0x24')](respondWithFilteredResult(_0x53f300,_0x26ff68))[_0xdf3e('0x40')](handleError(_0x53f300,null));};exports['show']=function(_0x325bfa,_0x5c0158){var _0x88838b={'raw':!![],'where':{'id':_0x325bfa[_0xdf3e('0x41')]['id']}},_0x123efe={};_0x123efe['model']=_[_0xdf3e('0x42')](db['Interval'][_0xdf3e('0x43')]);_0x123efe[_0xdf3e('0x30')]=_[_0xdf3e('0x42')](_0x325bfa[_0xdf3e('0x30')]);_0x123efe[_0xdf3e('0x31')]=_[_0xdf3e('0x33')](_0x123efe['model'],_0x123efe[_0xdf3e('0x30')]);_0x88838b['attributes']=_[_0xdf3e('0x33')](_0x123efe['model'],qs[_0xdf3e('0x34')](_0x325bfa[_0xdf3e('0x30')][_0xdf3e('0x34')]));_0x88838b['attributes']=_0x88838b[_0xdf3e('0x32')]['length']?_0x88838b['attributes']:_0x123efe[_0xdf3e('0x2f')];if(_0x325bfa[_0xdf3e('0x30')][_0xdf3e('0x3c')]){_0x88838b[_0xdf3e('0x3d')]=[{'all':!![]}];}_0x88838b=_['merge']({},_0x88838b,_0x325bfa[_0xdf3e('0x44')]);return db[_0xdf3e('0x2b')][_0xdf3e('0x45')](_0x88838b)[_0xdf3e('0x24')](handleEntityNotFound(_0x5c0158,null))[_0xdf3e('0x24')](respondWithResult(_0x5c0158,null))[_0xdf3e('0x40')](handleError(_0x5c0158,null));};exports[_0xdf3e('0x46')]=function(_0x5cf64a,_0x11d275){return db[_0xdf3e('0x2b')]['create'](_0x5cf64a[_0xdf3e('0x47')],{})[_0xdf3e('0x24')](function(_0x490884){var _0x42b2e3=_0x5cf64a['user']['get']({'plain':!![]});if(!_0x42b2e3)throw new Error(_0xdf3e('0x48'));if(_0x42b2e3['role']===_0xdf3e('0x49')){var _0x503d66=_0x490884[_0xdf3e('0x4a')]({'plain':!![]});var _0x41d5b1=_0xdf3e('0x4b');return db[_0xdf3e('0x4c')][_0xdf3e('0x45')]({'where':{'name':_0x41d5b1,'userProfileId':_0x42b2e3[_0xdf3e('0x4d')]},'raw':!![]})[_0xdf3e('0x24')](function(_0x13228d){if(_0x13228d&&_0x13228d[_0xdf3e('0x4e')]===0x0){return db[_0xdf3e('0x25')][_0xdf3e('0x46')]({'name':_0x503d66[_0xdf3e('0x27')],'resourceId':_0x503d66['id'],'type':_0x13228d[_0xdf3e('0x27')],'sectionId':_0x13228d['id']},{})['then'](function(){return _0x490884;});}else{return _0x490884;}})[_0xdf3e('0x40')](function(_0x56430c){logger[_0xdf3e('0x26')](_0xdf3e('0x4f'),_0x56430c);throw _0x56430c;});}return _0x490884;})[_0xdf3e('0x24')](respondWithResult(_0x11d275,0xc9))[_0xdf3e('0x40')](handleError(_0x11d275,null));};exports[_0xdf3e('0x23')]=function(_0x4b5d58,_0x1c1cfc){if(_0x4b5d58['body']['id']){delete _0x4b5d58[_0xdf3e('0x47')]['id'];}return db['Interval'][_0xdf3e('0x45')]({'where':{'id':_0x4b5d58[_0xdf3e('0x41')]['id']}})[_0xdf3e('0x24')](handleEntityNotFound(_0x1c1cfc,null))[_0xdf3e('0x24')](saveUpdates(_0x4b5d58[_0xdf3e('0x47')],null))[_0xdf3e('0x24')](respondWithResult(_0x1c1cfc,null))[_0xdf3e('0x40')](handleError(_0x1c1cfc,null));};exports['destroy']=function(_0x3a2577,_0x39b493){return db['Interval'][_0xdf3e('0x45')]({'where':{'id':_0x3a2577['params']['id']}})[_0xdf3e('0x24')](handleEntityNotFound(_0x39b493,null))[_0xdf3e('0x24')](removeEntity(_0x39b493,null))['catch'](handleError(_0x39b493,null));};exports[_0xdf3e('0x50')]=function(_0x8fa379,_0xfec989,_0x3a69a5){if(_0x8fa379[_0xdf3e('0x47')]['id']){delete _0x8fa379[_0xdf3e('0x47')]['id'];}return db[_0xdf3e('0x2b')][_0xdf3e('0x45')]({'where':{'id':_0x8fa379[_0xdf3e('0x41')]['id']}})[_0xdf3e('0x24')](handleEntityNotFound(_0xfec989,null))['then'](function(_0x2b2e99){if(_0x2b2e99){_0x8fa379[_0xdf3e('0x47')][_0xdf3e('0x51')]=_0x2b2e99['id'];return db['Interval'][_0xdf3e('0x46')](_0x8fa379[_0xdf3e('0x47')]);}})[_0xdf3e('0x24')](respondWithResult(_0xfec989,null))[_0xdf3e('0x40')](handleError(_0xfec989,null));};exports[_0xdf3e('0x52')]=function(_0x27eab9,_0x28b2df,_0x198922){var _0x564320={};var _0xf4a568={};var _0x12eb28;var _0x3d37eb;return db[_0xdf3e('0x2b')][_0xdf3e('0x53')]({'where':{'id':_0x27eab9['params']['id']}})[_0xdf3e('0x24')](handleEntityNotFound(_0x28b2df,null))[_0xdf3e('0x24')](function(_0x498f4b){if(_0x498f4b){_0x12eb28=_0x498f4b;_0xf4a568[_0xdf3e('0x2f')]=_[_0xdf3e('0x42')](db['Interval'][_0xdf3e('0x43')]);_0xf4a568['query']=_[_0xdf3e('0x42')](_0x27eab9[_0xdf3e('0x30')]);_0xf4a568[_0xdf3e('0x31')]=_[_0xdf3e('0x33')](_0xf4a568[_0xdf3e('0x2f')],_0xf4a568[_0xdf3e('0x30')]);_0x564320[_0xdf3e('0x32')]=_['intersection'](_0xf4a568['model'],qs[_0xdf3e('0x34')](_0x27eab9[_0xdf3e('0x30')]['fields']));_0x564320[_0xdf3e('0x32')]=_0x564320['attributes'][_0xdf3e('0x35')]?_0x564320[_0xdf3e('0x32')]:_0xf4a568[_0xdf3e('0x2f')];_0x564320['order']=qs[_0xdf3e('0x37')](_0x27eab9[_0xdf3e('0x30')][_0xdf3e('0x37')]);_0x564320[_0xdf3e('0x38')]=qs[_0xdf3e('0x31')](_['pick'](_0x27eab9[_0xdf3e('0x30')],_0xf4a568[_0xdf3e('0x31')]));if(_0x27eab9[_0xdf3e('0x30')][_0xdf3e('0x39')]){_0x564320['where']=_['merge'](_0x564320[_0xdf3e('0x38')],{'$or':_[_0xdf3e('0x2a')](_0x564320[_0xdf3e('0x32')],function(_0x18f01e){var _0x31f392={};_0x31f392[_0x18f01e]={'$like':'%'+_0x27eab9[_0xdf3e('0x30')][_0xdf3e('0x39')]+'%'};return _0x31f392;})});}_0x564320=_[_0xdf3e('0x3a')]({},_0x564320,_0x27eab9['options']);return _0x12eb28[_0xdf3e('0x52')](_0x564320);}})['then'](function(_0x3ca5c8){if(_0x3ca5c8){_0x3d37eb=_0x3ca5c8[_0xdf3e('0x35')];if(!_0x27eab9[_0xdf3e('0x30')]['hasOwnProperty'](_0xdf3e('0x54'))){_0x564320[_0xdf3e('0x1f')]=qs['limit'](_0x27eab9['query'][_0xdf3e('0x1f')]);_0x564320[_0xdf3e('0x1e')]=qs[_0xdf3e('0x1e')](_0x27eab9['query'][_0xdf3e('0x1e')]);}return _0x12eb28[_0xdf3e('0x52')](_0x564320);}})[_0xdf3e('0x24')](function(_0x26d845){if(_0x26d845){return _0x26d845?{'count':_0x3d37eb,'rows':_0x26d845}:null;}})[_0xdf3e('0x24')](respondWithResult(_0x28b2df,null))[_0xdf3e('0x40')](handleError(_0x28b2df,null));};exports['addIntervals']=function(_0x417dbb,_0x480cea,_0x7d177a){return db[_0xdf3e('0x2b')]['findOne']({'where':{'id':_0x417dbb[_0xdf3e('0x41')]['id']}})['then'](handleEntityNotFound(_0x480cea,null))['then'](function(_0x326e8f){if(_0x326e8f){return db[_0xdf3e('0x55')][_0xdf3e('0x56')](function(_0x1b8014){return db[_0xdf3e('0x2b')]['destroy']({'where':{'IntervalId':_0x417dbb[_0xdf3e('0x41')]['id']},'transaction':_0x1b8014})['then'](function(_0x530007){var _0x1a4344=_[_0xdf3e('0x2a')](_0x417dbb[_0xdf3e('0x47')],function(_0x4de6c9){delete _0x4de6c9['id'];_0x4de6c9[_0xdf3e('0x51')]=_0x417dbb[_0xdf3e('0x41')]['id'];return _0x4de6c9;});return db[_0xdf3e('0x2b')][_0xdf3e('0x57')](_0x1a4344,{'transaction':_0x1b8014});});})[_0xdf3e('0x24')](function(){return db[_0xdf3e('0x2b')][_0xdf3e('0x3e')]({'where':{'IntervalId':_0x417dbb['params']['id']}});});}})[_0xdf3e('0x24')](respondWithResult(_0x480cea,null))['catch'](handleError(_0x480cea,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bc1353a..f5c8ae6 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 _0x4dc0=['bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','exports','rewrite','../../config/logger','api','moment'];(function(_0x28234c,_0xf5b80){var _0x388423=function(_0x49d7ba){while(--_0x49d7ba){_0x28234c['push'](_0x28234c['shift']());}};_0x388423(++_0xf5b80);}(_0x4dc0,0x13d));var _0x04dc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4dc0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04dc('0x0'))(_0x04dc('0x1'));var moment=require(_0x04dc('0x2'));var BPromise=require(_0x04dc('0x3'));var rp=require(_0x04dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04dc('0x5'));var config=require(_0x04dc('0x6'));var attributes=require(_0x04dc('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x04dc('0x8')]=function(_0x40b21a,_0x40d327){return _0x40b21a['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x118c0e,_0x8bc895){extensions[_0x04dc('0x9')](_0x40b21a,_0x118c0e);},'afterBulkCreate':function(_0x2641fa,_0x3cd9c7,_0xbcd08a){_0xbcd08a();extensions[_0x04dc('0x9')](_0x40b21a,_0x2641fa[0x0]);},'afterUpdate':function(_0x287d25,_0x5b4524){extensions[_0x04dc('0x9')](_0x40b21a,_0x287d25);},'afterDestroy':function(_0x1d4087,_0x3ba3c2){extensions['rewrite'](_0x40b21a,_0x1d4087);}}});}; \ No newline at end of file +var _0x33e5=['Interval','rewrite','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../components/extensions/rewrite','exports','define'];(function(_0x24192f,_0x2d65e8){var _0x1eda52=function(_0x591a23){while(--_0x591a23){_0x24192f['push'](_0x24192f['shift']());}};_0x1eda52(++_0x2d65e8);}(_0x33e5,0x13a));var _0x533e=function(_0x83e784,_0x2c8524){_0x83e784=_0x83e784-0x0;var _0x20eb25=_0x33e5[_0x83e784];return _0x20eb25;};'use strict';var _=require(_0x533e('0x0'));var util=require(_0x533e('0x1'));var logger=require(_0x533e('0x2'))('api');var moment=require(_0x533e('0x3'));var BPromise=require('bluebird');var rp=require(_0x533e('0x4'));var fs=require('fs');var path=require(_0x533e('0x5'));var rimraf=require(_0x533e('0x6'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x533e('0x7'));module[_0x533e('0x8')]=function(_0x275007,_0x2e951a){return _0x275007[_0x533e('0x9')](_0x533e('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x298a51,_0x4908e3){extensions[_0x533e('0xb')](_0x275007,_0x298a51);},'afterBulkCreate':function(_0x366e66,_0xe9ad29,_0x550643){_0x550643();extensions[_0x533e('0xb')](_0x275007,_0x366e66[0x0]);},'afterUpdate':function(_0x1c0741,_0x4f25a5){extensions[_0x533e('0xb')](_0x275007,_0x1c0741);},'afterDestroy':function(_0x311fa6,_0x2772da){extensions[_0x533e('0xb')](_0x275007,_0x311fa6);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9478c1d..ea579fc 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 _0xf225=['ShowInterval','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','info'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xf225,0x12b));var _0x5f22=function(_0x44a85f,_0x1ee66a){_0x44a85f=_0x44a85f-0x0;var _0xa4a6e8=_0xf225[_0x44a85f];return _0xa4a6e8;};'use strict';var _=require('lodash');var util=require(_0x5f22('0x0'));var moment=require(_0x5f22('0x1'));var BPromise=require(_0x5f22('0x2'));var rs=require(_0x5f22('0x3'));var fs=require('fs');var Redis=require(_0x5f22('0x4'));var db=require(_0x5f22('0x5'))['db'];var utils=require(_0x5f22('0x6'));var logger=require(_0x5f22('0x7'))(_0x5f22('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f22('0x9'));var client=jayson[_0x5f22('0xa')][_0x5f22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25bc4,_0x59da45,_0x6dbdc1){return new BPromise(function(_0x3c216b,_0x55d78b){return client['request'](_0x25bc4,_0x6dbdc1)[_0x5f22('0xc')](function(_0x1e4f72){logger['info'](_0x5f22('0xd'),_0x59da45,'request\x20sent');logger[_0x5f22('0xe')](_0x5f22('0xf'),_0x59da45,_0x5f22('0x10'),JSON[_0x5f22('0x11')](_0x1e4f72));if(_0x1e4f72[_0x5f22('0x12')]){if(_0x1e4f72['error'][_0x5f22('0x13')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x59da45,_0x1e4f72[_0x5f22('0x12')][_0x5f22('0x14')]);return _0x55d78b(_0x1e4f72[_0x5f22('0x12')][_0x5f22('0x14')]);}logger['error']('Interval,\x20%s,\x20%s',_0x59da45,_0x1e4f72[_0x5f22('0x12')]['message']);return _0x3c216b(_0x1e4f72[_0x5f22('0x12')]['message']);}else{logger['info'](_0x5f22('0xd'),_0x59da45,_0x5f22('0x10'));_0x3c216b(_0x1e4f72[_0x5f22('0x15')][_0x5f22('0x14')]);}})[_0x5f22('0x16')](function(_0x1c5d73){logger[_0x5f22('0x12')]('Interval,\x20%s,\x20%s',_0x59da45,_0x1c5d73);_0x55d78b(_0x1c5d73);});});}exports[_0x5f22('0x17')]=function(_0xdae093){var _0x367235=this;return new Promise(function(_0x166ac0,_0x3f5b1b){return db[_0x5f22('0x18')][_0x5f22('0x19')]({'raw':_0xdae093[_0x5f22('0x1a')]?_0xdae093['options']['raw']===undefined?!![]:![]:!![],'where':_0xdae093['options']?_0xdae093['options'][_0x5f22('0x1b')]||null:null,'attributes':_0xdae093[_0x5f22('0x1a')]?_0xdae093[_0x5f22('0x1a')][_0x5f22('0x1c')]||null:null,'limit':_0xdae093[_0x5f22('0x1a')]?_0xdae093[_0x5f22('0x1a')][_0x5f22('0x1d')]||null:null,'include':_0xdae093[_0x5f22('0x1a')]?_0xdae093[_0x5f22('0x1a')][_0x5f22('0x1e')]?_[_0x5f22('0x1f')](_0xdae093[_0x5f22('0x1a')][_0x5f22('0x1e')],function(_0x2e0bfe){return{'model':db[_0x2e0bfe['model']],'as':_0x2e0bfe['as'],'attributes':_0x2e0bfe['attributes'],'include':_0x2e0bfe[_0x5f22('0x1e')]?_[_0x5f22('0x1f')](_0x2e0bfe[_0x5f22('0x1e')],function(_0x3f806f){return{'model':db[_0x3f806f[_0x5f22('0x20')]],'as':_0x3f806f['as'],'attributes':_0x3f806f[_0x5f22('0x1c')],'include':_0x3f806f[_0x5f22('0x1e')]?_[_0x5f22('0x1f')](_0x3f806f[_0x5f22('0x1e')],function(_0x1df00){return{'model':db[_0x1df00[_0x5f22('0x20')]],'as':_0x1df00['as'],'attributes':_0x1df00[_0x5f22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5f22('0xc')](function(_0x4300bb){logger[_0x5f22('0x21')](_0x5f22('0x17'),_0xdae093);logger[_0x5f22('0xe')](_0x5f22('0x17'),_0xdae093,JSON['stringify'](_0x4300bb));_0x166ac0(_0x4300bb);})[_0x5f22('0x16')](function(_0x309454){logger['error']('GetInterval',_0x309454[_0x5f22('0x14')],_0xdae093);_0x3f5b1b(_0x367235[_0x5f22('0x12')](0x1f4,_0x309454['message']));});});};exports[_0x5f22('0x22')]=function(_0x154744){var _0x351fc9=this;return new Promise(function(_0x1cf779,_0x5e936){return db[_0x5f22('0x18')][_0x5f22('0x23')]({'raw':_0x154744[_0x5f22('0x1a')]?_0x154744[_0x5f22('0x1a')][_0x5f22('0x24')]===undefined?!![]:![]:!![],'where':_0x154744['options']?_0x154744[_0x5f22('0x1a')][_0x5f22('0x1b')]||null:null,'attributes':_0x154744[_0x5f22('0x1a')]?_0x154744[_0x5f22('0x1a')][_0x5f22('0x1c')]||null:null,'include':_0x154744[_0x5f22('0x1a')]?_0x154744[_0x5f22('0x1a')][_0x5f22('0x1e')]?_[_0x5f22('0x1f')](_0x154744[_0x5f22('0x1a')][_0x5f22('0x1e')],function(_0x2c1b49){return{'model':db[_0x2c1b49[_0x5f22('0x20')]],'as':_0x2c1b49['as'],'attributes':_0x2c1b49['attributes'],'include':_0x2c1b49[_0x5f22('0x1e')]?_[_0x5f22('0x1f')](_0x2c1b49[_0x5f22('0x1e')],function(_0x57186a){return{'model':db[_0x57186a[_0x5f22('0x20')]],'as':_0x57186a['as'],'attributes':_0x57186a[_0x5f22('0x1c')],'include':_0x57186a[_0x5f22('0x1e')]?_['map'](_0x57186a[_0x5f22('0x1e')],function(_0x103587){return{'model':db[_0x103587['model']],'as':_0x103587['as'],'attributes':_0x103587['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f22('0xc')](function(_0x5ce0e1){logger[_0x5f22('0x21')](_0x5f22('0x22'),_0x154744);logger[_0x5f22('0xe')](_0x5f22('0x22'),_0x154744,JSON[_0x5f22('0x11')](_0x5ce0e1));_0x1cf779(_0x5ce0e1);})[_0x5f22('0x16')](function(_0x17b809){logger[_0x5f22('0x12')](_0x5f22('0x22'),_0x17b809[_0x5f22('0x14')],_0x154744);_0x5e936(_0x351fc9[_0x5f22('0x12')](0x1f4,_0x17b809['message']));});});}; \ No newline at end of file +var _0xa14a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','Interval,\x20%s,\x20%s','request\x20sent','error','message','info','catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','map','then','debug','stringify','find','ShowInterval','util'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xa14a,0x1ef));var _0xaa14=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xa14a[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xaa14('0x0'));var moment=require('moment');var BPromise=require(_0xaa14('0x1'));var rs=require(_0xaa14('0x2'));var fs=require('fs');var Redis=require(_0xaa14('0x3'));var db=require(_0xaa14('0x4'))['db'];var utils=require(_0xaa14('0x5'));var logger=require(_0xaa14('0x6'))('rpc');var config=require(_0xaa14('0x7'));var jayson=require(_0xaa14('0x8'));var client=jayson['client'][_0xaa14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x97c8d3,_0x15edb0,_0x183c73){return new BPromise(function(_0x108500,_0x4c108a){return client['request'](_0x97c8d3,_0x183c73)['then'](function(_0x511a7c){logger['info'](_0xaa14('0xa'),_0x15edb0,_0xaa14('0xb'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x15edb0,_0xaa14('0xb'),JSON['stringify'](_0x511a7c));if(_0x511a7c['error']){if(_0x511a7c['error']['code']===0x1f4){logger[_0xaa14('0xc')](_0xaa14('0xa'),_0x15edb0,_0x511a7c[_0xaa14('0xc')][_0xaa14('0xd')]);return _0x4c108a(_0x511a7c[_0xaa14('0xc')][_0xaa14('0xd')]);}logger[_0xaa14('0xc')](_0xaa14('0xa'),_0x15edb0,_0x511a7c[_0xaa14('0xc')]['message']);return _0x108500(_0x511a7c['error'][_0xaa14('0xd')]);}else{logger[_0xaa14('0xe')](_0xaa14('0xa'),_0x15edb0,'request\x20sent');_0x108500(_0x511a7c['result']['message']);}})[_0xaa14('0xf')](function(_0x2c391a){logger[_0xaa14('0xc')](_0xaa14('0xa'),_0x15edb0,_0x2c391a);_0x4c108a(_0x2c391a);});});}exports[_0xaa14('0x10')]=function(_0x30f062){var _0x434b6f=this;return new Promise(function(_0x34e6f7,_0x2fa23e){return db[_0xaa14('0x11')][_0xaa14('0x12')]({'raw':_0x30f062[_0xaa14('0x13')]?_0x30f062[_0xaa14('0x13')][_0xaa14('0x14')]===undefined?!![]:![]:!![],'where':_0x30f062['options']?_0x30f062[_0xaa14('0x13')][_0xaa14('0x15')]||null:null,'attributes':_0x30f062['options']?_0x30f062[_0xaa14('0x13')][_0xaa14('0x16')]||null:null,'limit':_0x30f062[_0xaa14('0x13')]?_0x30f062['options']['limit']||null:null,'include':_0x30f062['options']?_0x30f062['options'][_0xaa14('0x17')]?_['map'](_0x30f062['options'][_0xaa14('0x17')],function(_0x42922c){return{'model':db[_0x42922c[_0xaa14('0x18')]],'as':_0x42922c['as'],'attributes':_0x42922c[_0xaa14('0x16')],'include':_0x42922c['include']?_[_0xaa14('0x19')](_0x42922c[_0xaa14('0x17')],function(_0x5ddf8f){return{'model':db[_0x5ddf8f['model']],'as':_0x5ddf8f['as'],'attributes':_0x5ddf8f[_0xaa14('0x16')],'include':_0x5ddf8f[_0xaa14('0x17')]?_[_0xaa14('0x19')](_0x5ddf8f[_0xaa14('0x17')],function(_0x467ae0){return{'model':db[_0x467ae0[_0xaa14('0x18')]],'as':_0x467ae0['as'],'attributes':_0x467ae0['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa14('0x1a')](function(_0x293df6){logger[_0xaa14('0xe')](_0xaa14('0x10'),_0x30f062);logger[_0xaa14('0x1b')](_0xaa14('0x10'),_0x30f062,JSON[_0xaa14('0x1c')](_0x293df6));_0x34e6f7(_0x293df6);})[_0xaa14('0xf')](function(_0x269f4e){logger['error'](_0xaa14('0x10'),_0x269f4e[_0xaa14('0xd')],_0x30f062);_0x2fa23e(_0x434b6f[_0xaa14('0xc')](0x1f4,_0x269f4e[_0xaa14('0xd')]));});});};exports['ShowInterval']=function(_0x5d711f){var _0x32299b=this;return new Promise(function(_0x59e613,_0x490ad5){return db['Interval'][_0xaa14('0x1d')]({'raw':_0x5d711f[_0xaa14('0x13')]?_0x5d711f[_0xaa14('0x13')][_0xaa14('0x14')]===undefined?!![]:![]:!![],'where':_0x5d711f['options']?_0x5d711f[_0xaa14('0x13')][_0xaa14('0x15')]||null:null,'attributes':_0x5d711f['options']?_0x5d711f[_0xaa14('0x13')][_0xaa14('0x16')]||null:null,'include':_0x5d711f[_0xaa14('0x13')]?_0x5d711f['options'][_0xaa14('0x17')]?_[_0xaa14('0x19')](_0x5d711f['options']['include'],function(_0x3dcce5){return{'model':db[_0x3dcce5[_0xaa14('0x18')]],'as':_0x3dcce5['as'],'attributes':_0x3dcce5[_0xaa14('0x16')],'include':_0x3dcce5['include']?_[_0xaa14('0x19')](_0x3dcce5[_0xaa14('0x17')],function(_0x343228){return{'model':db[_0x343228[_0xaa14('0x18')]],'as':_0x343228['as'],'attributes':_0x343228[_0xaa14('0x16')],'include':_0x343228[_0xaa14('0x17')]?_[_0xaa14('0x19')](_0x343228[_0xaa14('0x17')],function(_0x2a7c19){return{'model':db[_0x2a7c19[_0xaa14('0x18')]],'as':_0x2a7c19['as'],'attributes':_0x2a7c19[_0xaa14('0x16')]};}):[]};}):[]};}):[]:[]})[_0xaa14('0x1a')](function(_0x4701dc){logger[_0xaa14('0xe')]('ShowInterval',_0x5d711f);logger[_0xaa14('0x1b')](_0xaa14('0x1e'),_0x5d711f,JSON['stringify'](_0x4701dc));_0x59e613(_0x4701dc);})[_0xaa14('0xf')](function(_0x1afee2){logger[_0xaa14('0xc')]('ShowInterval',_0x1afee2[_0xaa14('0xd')],_0x5d711f);_0x490ad5(_0x32299b[_0xaa14('0xc')](0x1f4,_0x1afee2[_0xaa14('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index aabc799..f9bdcb4 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 _0x8ae5=['post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8ae5,0x1dd));var _0x58ae=function(_0x48a326,_0x4cf645){_0x48a326=_0x48a326-0x0;var _0x22a0a3=_0x8ae5[_0x48a326];return _0x22a0a3;};'use strict';var express=require(_0x58ae('0x0'));var router=express[_0x58ae('0x1')]();var auth=require(_0x58ae('0x2'));var controller=require('./jira.controller');router[_0x58ae('0x3')]('/',auth[_0x58ae('0x4')](),controller['send']);module[_0x58ae('0x5')]=router; \ No newline at end of file +var _0x5419=['./jira.controller','post','isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x3bde54,_0x5f160a){var _0x35d746=function(_0x563ec0){while(--_0x563ec0){_0x3bde54['push'](_0x3bde54['shift']());}};_0x35d746(++_0x5f160a);}(_0x5419,0x175));var _0x9541=function(_0x2193cc,_0x1f9e4b){_0x2193cc=_0x2193cc-0x0;var _0x143fa4=_0x5419[_0x2193cc];return _0x143fa4;};'use strict';var express=require(_0x9541('0x0'));var router=express[_0x9541('0x1')]();var auth=require(_0x9541('0x2'));var controller=require(_0x9541('0x3'));router[_0x9541('0x4')]('/',auth[_0x9541('0x5')](),controller[_0x9541('0x6')]);module[_0x9541('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 133e846..e240606 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 _0x99c0=['status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99c0,0x94));var _0x099c=function(_0x5179b4,_0x1cd27b){_0x5179b4=_0x5179b4-0x0;var _0x4281d8=_0x99c0[_0x5179b4];return _0x4281d8;};'use strict';var BPromise=require(_0x099c('0x0'));var https=require('https');var logger=require(_0x099c('0x1'))(_0x099c('0x2'));var USERNAME=_0x099c('0x3');var PASSWORD=_0x099c('0x4');function openIssue(_0x462fdc,_0x1d1d7b){var _0x47f38a={'fields':{'project':{'key':_0x462fdc[_0x099c('0x5')]||_0x099c('0x6')},'summary':(_0x462fdc['summary']||_0x099c('0x7'))+_0x099c('0x8')+_0x462fdc['ip'],'description':_0x462fdc[_0x099c('0x9')]||JSON['stringify'](_0x462fdc),'issuetype':{'name':_0x462fdc[_0x099c('0xa')]||_0x099c('0xb')}}};_0x47f38a['fields'][_0x099c('0xc')]=_0x462fdc[_0x099c('0xd')];_0x47f38a[_0x099c('0xe')][_0x099c('0xf')]=_0x462fdc[_0x099c('0x10')];_0x47f38a[_0x099c('0xe')]['customfield_11502']=_0x462fdc[_0x099c('0x11')];_0x47f38a['fields']['customfield_11503']=_0x462fdc[_0x099c('0x12')];_0x47f38a[_0x099c('0xe')][_0x099c('0x13')]=_0x462fdc[_0x099c('0x14')];_0x47f38a[_0x099c('0xe')][_0x099c('0x15')]=_0x462fdc['ip'];var _0x8047c1={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x099c('0x16'),'method':_0x099c('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x099c('0x18'),'Authorization':_0x099c('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x099c('0x1a')](_0x099c('0x1b'))}};var _0x5a46ce=JSON['stringify'](_0x47f38a);var _0x1af9b3=https[_0x099c('0x1c')](_0x8047c1,function(_0x520451){_0x520451[_0x099c('0x1d')](_0x099c('0x1e'));var _0x1a58b7='';_0x520451['on']('data',function(_0x6ea172){_0x1a58b7+=_0x6ea172;});_0x520451['on'](_0x099c('0x1f'),function(){if(_0x1d1d7b){return _0x1d1d7b[_0x099c('0x20')](_0x520451['statusCode'])[_0x099c('0x21')](JSON[_0x099c('0x22')](_0x1a58b7));}});});_0x1af9b3['on'](_0x099c('0x23'),function(_0x3f5a0d){if(_0x1d1d7b){return _0x1d1d7b[_0x099c('0x20')](0x1f4)['json']({'errors':[{'message':_0x099c('0x24'),'type':_0x099c('0x25')}]});}});_0x1af9b3['write'](_0x5a46ce);_0x1af9b3[_0x099c('0x1f')]();}exports[_0x099c('0x26')]=openIssue;exports['send']=function(_0x2598ca,_0x272a6d){_0x2598ca[_0x099c('0x27')]['ip']=_0x2598ca[_0x099c('0x28')][_0x099c('0x29')]||_0x2598ca[_0x099c('0x2a')]['remoteAddress']||_0x2598ca[_0x099c('0x2b')][_0x099c('0x2c')]||_0x2598ca['connection']['socket']['remoteAddress'];return openIssue(_0x2598ca[_0x099c('0x27')],_0x272a6d);}; \ No newline at end of file +var _0xb693=['statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','utf8','data','end','status'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0xb693,0x157));var _0x3b69=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0xb693[_0x2f02d4];return _0x4b707d;};'use strict';var BPromise=require(_0x3b69('0x0'));var https=require(_0x3b69('0x1'));var logger=require(_0x3b69('0x2'))(_0x3b69('0x3'));var USERNAME='support';var PASSWORD=_0x3b69('0x4');function openIssue(_0x1c382b,_0x298502){var _0x15815a={'fields':{'project':{'key':_0x1c382b[_0x3b69('0x5')]||'MOTGUI'},'summary':(_0x1c382b[_0x3b69('0x6')]||_0x3b69('0x7'))+_0x3b69('0x8')+_0x1c382b['ip'],'description':_0x1c382b[_0x3b69('0x9')]||JSON[_0x3b69('0xa')](_0x1c382b),'issuetype':{'name':_0x1c382b[_0x3b69('0xb')]||'Bug'}}};_0x15815a[_0x3b69('0xc')]['customfield_11500']=_0x1c382b[_0x3b69('0xd')];_0x15815a[_0x3b69('0xc')][_0x3b69('0xe')]=_0x1c382b[_0x3b69('0xf')];_0x15815a[_0x3b69('0xc')][_0x3b69('0x10')]=_0x1c382b[_0x3b69('0x11')];_0x15815a[_0x3b69('0xc')][_0x3b69('0x12')]=_0x1c382b[_0x3b69('0x13')];_0x15815a[_0x3b69('0xc')]['customfield_11504']=_0x1c382b[_0x3b69('0x14')];_0x15815a[_0x3b69('0xc')][_0x3b69('0x15')]=_0x1c382b['ip'];var _0x281312={'host':_0x3b69('0x16'),'port':0x1bb,'path':_0x3b69('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x3b69('0x18'),'Authorization':_0x3b69('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x3b69('0x1a')](_0x3b69('0x1b'))}};var _0x44e2dd=JSON[_0x3b69('0xa')](_0x15815a);var _0x1912f2=https[_0x3b69('0x1c')](_0x281312,function(_0x2aef5c){_0x2aef5c['setEncoding'](_0x3b69('0x1d'));var _0x49d0b8='';_0x2aef5c['on'](_0x3b69('0x1e'),function(_0xcbd21b){_0x49d0b8+=_0xcbd21b;});_0x2aef5c['on'](_0x3b69('0x1f'),function(){if(_0x298502){return _0x298502[_0x3b69('0x20')](_0x2aef5c[_0x3b69('0x21')])['json'](JSON['parse'](_0x49d0b8));}});});_0x1912f2['on'](_0x3b69('0x22'),function(_0x4ee2f2){if(_0x298502){return _0x298502['status'](0x1f4)[_0x3b69('0x23')]({'errors':[{'message':_0x3b69('0x24'),'type':_0x3b69('0x25')}]});}});_0x1912f2[_0x3b69('0x26')](_0x44e2dd);_0x1912f2['end']();}exports[_0x3b69('0x27')]=openIssue;exports[_0x3b69('0x28')]=function(_0x46daf5,_0x267811){_0x46daf5[_0x3b69('0x29')]['ip']=_0x46daf5[_0x3b69('0x2a')][_0x3b69('0x2b')]||_0x46daf5[_0x3b69('0x2c')]['remoteAddress']||_0x46daf5[_0x3b69('0x2d')][_0x3b69('0x2e')]||_0x46daf5[_0x3b69('0x2c')][_0x3b69('0x2d')][_0x3b69('0x2e')];return openIssue(_0x46daf5[_0x3b69('0x29')],_0x267811);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e670570..86ffccd 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 _0x34a9=['Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x34a9,0xc3));var _0x934a=function(_0x45bed4,_0x50dffe){_0x45bed4=_0x45bed4-0x0;var _0x274c02=_0x34a9[_0x45bed4];return _0x274c02;};'use strict';var multer=require('multer');var util=require(_0x934a('0x0'));var path=require(_0x934a('0x1'));var timeout=require('connect-timeout');var express=require(_0x934a('0x2'));var router=express[_0x934a('0x3')]();var auth=require(_0x934a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x934a('0x5'));var controller=require(_0x934a('0x6'));router[_0x934a('0x7')]('/',auth[_0x934a('0x8')](),controller[_0x934a('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x934a('0x7')](_0x934a('0xa'),auth[_0x934a('0x8')](),controller[_0x934a('0xb')]);router[_0x934a('0xc')]('/',auth[_0x934a('0x8')](),controller[_0x934a('0xd')]);router[_0x934a('0xe')](_0x934a('0xa'),auth['isAuthenticated'](),controller[_0x934a('0xf')]);router['delete'](_0x934a('0xa'),auth[_0x934a('0x8')](),controller[_0x934a('0x10')]);module[_0x934a('0x11')]=router; \ No newline at end of file +var _0xa7ab=['express','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','/describe','describe','get','put','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x8956d9,_0x3ccca7){var _0x42f439=function(_0x40eda4){while(--_0x40eda4){_0x8956d9['push'](_0x8956d9['shift']());}};_0x42f439(++_0x3ccca7);}(_0xa7ab,0x1ed));var _0xba7a=function(_0x58c424,_0x44148c){_0x58c424=_0x58c424-0x0;var _0x3dc393=_0xa7ab[_0x58c424];return _0x3dc393;};'use strict';var multer=require('multer');var util=require(_0xba7a('0x0'));var path=require(_0xba7a('0x1'));var timeout=require(_0xba7a('0x2'));var express=require(_0xba7a('0x3'));var router=express['Router']();var auth=require(_0xba7a('0x4'));var interaction=require(_0xba7a('0x5'));var config=require('../../config/environment');var controller=require(_0xba7a('0x6'));router['get']('/',auth[_0xba7a('0x7')](),controller['index']);router['get'](_0xba7a('0x8'),auth[_0xba7a('0x7')](),controller[_0xba7a('0x9')]);router[_0xba7a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xba7a('0x7')](),controller['create']);router[_0xba7a('0xb')](_0xba7a('0xc'),auth[_0xba7a('0x7')](),controller[_0xba7a('0xd')]);router[_0xba7a('0xe')](_0xba7a('0xc'),auth['isAuthenticated'](),controller[_0xba7a('0xf')]);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 470f030..0bd4c09 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 _0x823c=['TEXT','long','STRING','sequelize'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x823c,0x143));var _0xc823=function(_0x4ca594,_0x40d1bf){_0x4ca594=_0x4ca594-0x0;var _0x3637ff=_0x823c[_0x4ca594];return _0x3637ff;};'use strict';var Sequelize=require(_0xc823('0x0'));module['exports']={'question':{'type':Sequelize[_0xc823('0x1')]},'answer':{'type':Sequelize[_0xc823('0x1')](_0xc823('0x2'))},'membername':{'type':Sequelize[_0xc823('0x3')]},'projectname':{'type':Sequelize[_0xc823('0x3')]},'queue':{'type':Sequelize[_0xc823('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc823('0x3')]},'calleridnum':{'type':Sequelize[_0xc823('0x3')]},'questionId':{'type':Sequelize[_0xc823('0x3')]}}; \ No newline at end of file +var _0xa902=['STRING','sequelize','exports','TEXT','long'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xa902,0x8d));var _0x2a90=function(_0x2b073d,_0x2c0769){_0x2b073d=_0x2b073d-0x0;var _0x5f4750=_0xa902[_0x2b073d];return _0x5f4750;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'question':{'type':Sequelize[_0x2a90('0x2')]},'answer':{'type':Sequelize[_0x2a90('0x2')](_0x2a90('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2a90('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a90('0x4')]},'calleridnum':{'type':Sequelize[_0x2a90('0x4')]},'questionId':{'type':Sequelize[_0x2a90('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index e8eba8f..c0f10ba 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 _0x1e5f=['fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','JscriptyAnswerReport','catch','show','length','find','create','body','params','describe','html-pdf','eml-format'];(function(_0x4815f1,_0x2b41cd){var _0x1afdf4=function(_0x48d7ff){while(--_0x48d7ff){_0x4815f1['push'](_0x4815f1['shift']());}};_0x1afdf4(++_0x2b41cd);}(_0x1e5f,0xd6));var _0xf1e5=function(_0x53d578,_0x4ca37f){_0x53d578=_0x53d578-0x0;var _0x5ce805=_0x1e5f[_0x53d578];return _0x5ce805;};'use strict';var pdf=require(_0xf1e5('0x0'));var emlformat=require(_0xf1e5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1e5('0x2'));var rp=require(_0xf1e5('0x3'));var moment=require('moment');var BPromise=require(_0xf1e5('0x4'));var Mustache=require(_0xf1e5('0x5'));var util=require('util');var path=require(_0xf1e5('0x6'));var sox=require('sox');var csv=require(_0xf1e5('0x7'));var ejs=require(_0xf1e5('0x8'));var fs=require('fs');var _=require(_0xf1e5('0x9'));var squel=require(_0xf1e5('0xa'));var crypto=require('crypto');var jsforce=require(_0xf1e5('0xb'));var deskjs=require(_0xf1e5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf1e5('0xd'));var Papa=require(_0xf1e5('0xe'));var Redis=require(_0xf1e5('0xf'));var authService=require(_0xf1e5('0x10'));var qs=require(_0xf1e5('0x11'));var as=require(_0xf1e5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf1e5('0x13'));var utils=require('../../config/utils');var config=require(_0xf1e5('0x14'));var licenseUtil=require(_0xf1e5('0x15'));var db=require(_0xf1e5('0x16'))['db'];function respondWithStatusCode(_0x40c0de,_0x13e9ea){_0x13e9ea=_0x13e9ea||0xcc;return function(_0x50df95){if(_0x50df95){return _0x40c0de[_0xf1e5('0x17')](_0x13e9ea);}return _0x40c0de['status'](_0x13e9ea)['end']();};}function respondWithResult(_0x2c3c8c,_0x3c6800){_0x3c6800=_0x3c6800||0xc8;return function(_0x559308){if(_0x559308){return _0x2c3c8c[_0xf1e5('0x18')](_0x3c6800)[_0xf1e5('0x19')](_0x559308);}};}function respondWithFilteredResult(_0x112344,_0x5b73d1){return function(_0x521e87){if(_0x521e87){var _0x423b64=_0x521e87[_0xf1e5('0x1a')],_0x13e082=_0x5b73d1['offset'],_0x344f8d=_0x5b73d1[_0xf1e5('0x1b')]+_0x5b73d1[_0xf1e5('0x1c')],_0x4c0601;if(_0x344f8d>=_0x423b64){_0x344f8d=_0x423b64;_0x4c0601=0xc8;}else{_0x4c0601=0xce;}_0x112344[_0xf1e5('0x18')](_0x4c0601);return _0x112344[_0xf1e5('0x1d')]('Content-Range',_0x13e082+'-'+_0x344f8d+'/'+_0x423b64)['json'](_0x521e87);}return null;};}function patchUpdates(_0x6e302a){return function(_0x3d2bdc){try{jsonpatch[_0xf1e5('0x1e')](_0x3d2bdc,_0x6e302a,!![]);}catch(_0x4faae9){return BPromise[_0xf1e5('0x1f')](_0x4faae9);}return _0x3d2bdc[_0xf1e5('0x20')]();};}function saveUpdates(_0x14ec4e,_0x12b0e1){return function(_0x299c32){if(_0x299c32){return _0x299c32[_0xf1e5('0x21')](_0x14ec4e)[_0xf1e5('0x22')](function(_0x5c2ec7){return _0x5c2ec7;});}return null;};}function removeEntity(_0x202d84,_0x16a0ad){return function(_0x4e07f9){if(_0x4e07f9){return _0x4e07f9[_0xf1e5('0x23')]()[_0xf1e5('0x22')](function(){_0x202d84[_0xf1e5('0x18')](0xcc)[_0xf1e5('0x24')]();});}};}function handleEntityNotFound(_0x5db97a,_0x16b182){return function(_0x94454e){if(!_0x94454e){_0x5db97a[_0xf1e5('0x17')](0x194);}return _0x94454e;};}function handleError(_0x501772,_0x5ef5b1){_0x5ef5b1=_0x5ef5b1||0x1f4;return function(_0x1359a4){logger['error'](_0x1359a4['stack']);if(_0x1359a4[_0xf1e5('0x25')]){delete _0x1359a4['name'];}_0x501772['status'](_0x5ef5b1)[_0xf1e5('0x26')](_0x1359a4);};}exports[_0xf1e5('0x27')]=function(_0x4c6eec,_0x172d45){var _0x11c7a4={},_0x21498d={},_0x43e1b7={'count':0x0,'rows':[]};var _0x3938ce=_[_0xf1e5('0x28')](db['JscriptyAnswerReport'][_0xf1e5('0x29')],function(_0x480f6f){return{'name':_0x480f6f[_0xf1e5('0x2a')],'type':_0x480f6f[_0xf1e5('0x2b')]['key']};});_0x21498d[_0xf1e5('0x2c')]=_[_0xf1e5('0x28')](_0x3938ce,_0xf1e5('0x25'));_0x21498d[_0xf1e5('0x2d')]=_[_0xf1e5('0x2e')](_0x4c6eec[_0xf1e5('0x2d')]);_0x21498d[_0xf1e5('0x2f')]=_['intersection'](_0x21498d[_0xf1e5('0x2c')],_0x21498d[_0xf1e5('0x2d')]);_0x11c7a4[_0xf1e5('0x30')]=_[_0xf1e5('0x31')](_0x21498d['model'],qs[_0xf1e5('0x32')](_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x32')]));_0x11c7a4[_0xf1e5('0x30')]=_0x11c7a4['attributes']['length']?_0x11c7a4['attributes']:_0x21498d[_0xf1e5('0x2c')];if(!_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x33')](_0xf1e5('0x34'))){_0x11c7a4[_0xf1e5('0x1c')]=qs[_0xf1e5('0x1c')](_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x1c')]);_0x11c7a4[_0xf1e5('0x1b')]=qs[_0xf1e5('0x1b')](_0x4c6eec[_0xf1e5('0x2d')]['offset']);}_0x11c7a4[_0xf1e5('0x35')]=qs[_0xf1e5('0x36')](_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x36')]);_0x11c7a4[_0xf1e5('0x37')]=qs[_0xf1e5('0x2f')](_[_0xf1e5('0x38')](_0x4c6eec[_0xf1e5('0x2d')],_0x21498d[_0xf1e5('0x2f')]),_0x3938ce);if(_0x4c6eec[_0xf1e5('0x2d')]['filter']){_0x11c7a4[_0xf1e5('0x37')]=_['merge'](_0x11c7a4['where'],{'$or':_[_0xf1e5('0x28')](_0x3938ce,function(_0x4c189e){if(_0x4c189e[_0xf1e5('0x2b')]!==_0xf1e5('0x39')){var _0x4c0b9e={};_0x4c0b9e[_0x4c189e[_0xf1e5('0x25')]]={'$like':'%'+_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x3a')]+'%'};return _0x4c0b9e;}})});}_0x11c7a4=_[_0xf1e5('0x3b')]({},_0x11c7a4,_0x4c6eec[_0xf1e5('0x3c')]);var _0x2433b2={'where':_0x11c7a4['where']};return db['JscriptyAnswerReport']['count'](_0x2433b2)[_0xf1e5('0x22')](function(_0x34cd40){_0x43e1b7['count']=_0x34cd40;if(_0x4c6eec[_0xf1e5('0x2d')][_0xf1e5('0x3d')]){_0x11c7a4[_0xf1e5('0x3e')]=[{'all':!![]}];}return db[_0xf1e5('0x3f')]['findAll'](_0x11c7a4);})[_0xf1e5('0x22')](function(_0x4f32e0){_0x43e1b7['rows']=_0x4f32e0;return _0x43e1b7;})[_0xf1e5('0x22')](respondWithFilteredResult(_0x172d45,_0x11c7a4))[_0xf1e5('0x40')](handleError(_0x172d45,null));};exports[_0xf1e5('0x41')]=function(_0x51df8f,_0x3cbf4b){var _0x3bc539={'raw':!![],'where':{'id':_0x51df8f['params']['id']}},_0x10806c={};_0x10806c[_0xf1e5('0x2c')]=_['keys'](db[_0xf1e5('0x3f')][_0xf1e5('0x29')]);_0x10806c[_0xf1e5('0x2d')]=_[_0xf1e5('0x2e')](_0x51df8f[_0xf1e5('0x2d')]);_0x10806c[_0xf1e5('0x2f')]=_[_0xf1e5('0x31')](_0x10806c[_0xf1e5('0x2c')],_0x10806c[_0xf1e5('0x2d')]);_0x3bc539['attributes']=_['intersection'](_0x10806c['model'],qs['fields'](_0x51df8f['query'][_0xf1e5('0x32')]));_0x3bc539[_0xf1e5('0x30')]=_0x3bc539['attributes'][_0xf1e5('0x42')]?_0x3bc539['attributes']:_0x10806c[_0xf1e5('0x2c')];if(_0x51df8f['query'][_0xf1e5('0x3d')]){_0x3bc539[_0xf1e5('0x3e')]=[{'all':!![]}];}_0x3bc539=_[_0xf1e5('0x3b')]({},_0x3bc539,_0x51df8f[_0xf1e5('0x3c')]);return db['JscriptyAnswerReport'][_0xf1e5('0x43')](_0x3bc539)[_0xf1e5('0x22')](handleEntityNotFound(_0x3cbf4b,null))['then'](respondWithResult(_0x3cbf4b,null))[_0xf1e5('0x40')](handleError(_0x3cbf4b,null));};exports[_0xf1e5('0x44')]=function(_0x6a612a,_0x774b43){return db[_0xf1e5('0x3f')]['create'](_0x6a612a[_0xf1e5('0x45')],{})[_0xf1e5('0x22')](respondWithResult(_0x774b43,0xc9))[_0xf1e5('0x40')](handleError(_0x774b43,null));};exports[_0xf1e5('0x21')]=function(_0x25ebb,_0x1c1213){if(_0x25ebb['body']['id']){delete _0x25ebb[_0xf1e5('0x45')]['id'];}return db[_0xf1e5('0x3f')]['find']({'where':{'id':_0x25ebb[_0xf1e5('0x46')]['id']}})[_0xf1e5('0x22')](handleEntityNotFound(_0x1c1213,null))[_0xf1e5('0x22')](saveUpdates(_0x25ebb[_0xf1e5('0x45')],null))[_0xf1e5('0x22')](respondWithResult(_0x1c1213,null))[_0xf1e5('0x40')](handleError(_0x1c1213,null));};exports[_0xf1e5('0x23')]=function(_0x2aa36b,_0xef3ad1){return db[_0xf1e5('0x3f')][_0xf1e5('0x43')]({'where':{'id':_0x2aa36b[_0xf1e5('0x46')]['id']}})[_0xf1e5('0x22')](handleEntityNotFound(_0xef3ad1,null))[_0xf1e5('0x22')](removeEntity(_0xef3ad1,null))[_0xf1e5('0x40')](handleError(_0xef3ad1,null));};exports['describe']=function(_0x113b0f,_0x147404){return db['JscriptyAnswerReport'][_0xf1e5('0x47')]()[_0xf1e5('0x22')](respondWithResult(_0x147404,null))[_0xf1e5('0x40')](handleError(_0x147404,null));}; \ No newline at end of file +var _0x21d9=['api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','name','map','JscriptyAnswerReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x39e6d5,_0x4bdfb3){var _0x1d46bf=function(_0x2c67c2){while(--_0x2c67c2){_0x39e6d5['push'](_0x39e6d5['shift']());}};_0x1d46bf(++_0x4bdfb3);}(_0x21d9,0xbc));var _0x921d=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0x21d9[_0x469ae2];return _0x5e33e4;};'use strict';var pdf=require(_0x921d('0x0'));var emlformat=require(_0x921d('0x1'));var rimraf=require(_0x921d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x921d('0x3'));var moment=require(_0x921d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x921d('0x5'));var util=require(_0x921d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x921d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x921d('0x8'));var squel=require(_0x921d('0x9'));var crypto=require(_0x921d('0xa'));var jsforce=require(_0x921d('0xb'));var deskjs=require(_0x921d('0xc'));var toCsv=require(_0x921d('0x7'));var querystring=require(_0x921d('0xd'));var Papa=require(_0x921d('0xe'));var Redis=require('ioredis');var authService=require(_0x921d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x921d('0x10'));var hardwareService=require(_0x921d('0x11'));var logger=require(_0x921d('0x12'))(_0x921d('0x13'));var utils=require(_0x921d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x921d('0x15'))['db'];function respondWithStatusCode(_0x31db6c,_0x950222){_0x950222=_0x950222||0xcc;return function(_0x558e93){if(_0x558e93){return _0x31db6c[_0x921d('0x16')](_0x950222);}return _0x31db6c[_0x921d('0x17')](_0x950222)[_0x921d('0x18')]();};}function respondWithResult(_0x9bb652,_0x1437bf){_0x1437bf=_0x1437bf||0xc8;return function(_0x5cd974){if(_0x5cd974){return _0x9bb652[_0x921d('0x17')](_0x1437bf)['json'](_0x5cd974);}};}function respondWithFilteredResult(_0x2d6277,_0x480d55){return function(_0x144304){if(_0x144304){var _0x3dff4d=_0x144304[_0x921d('0x19')],_0x55f7c3=_0x480d55[_0x921d('0x1a')],_0x48a6b0=_0x480d55[_0x921d('0x1a')]+_0x480d55[_0x921d('0x1b')],_0x360073;if(_0x48a6b0>=_0x3dff4d){_0x48a6b0=_0x3dff4d;_0x360073=0xc8;}else{_0x360073=0xce;}_0x2d6277[_0x921d('0x17')](_0x360073);return _0x2d6277[_0x921d('0x1c')](_0x921d('0x1d'),_0x55f7c3+'-'+_0x48a6b0+'/'+_0x3dff4d)[_0x921d('0x1e')](_0x144304);}return null;};}function patchUpdates(_0x4ab757){return function(_0x21bf78){try{jsonpatch[_0x921d('0x1f')](_0x21bf78,_0x4ab757,!![]);}catch(_0x3d6c5d){return BPromise[_0x921d('0x20')](_0x3d6c5d);}return _0x21bf78['save']();};}function saveUpdates(_0x329d3f,_0x266492){return function(_0x5b82c5){if(_0x5b82c5){return _0x5b82c5[_0x921d('0x21')](_0x329d3f)['then'](function(_0x3feea6){return _0x3feea6;});}return null;};}function removeEntity(_0x9b59a5,_0x3f47c2){return function(_0x4d7f97){if(_0x4d7f97){return _0x4d7f97[_0x921d('0x22')]()[_0x921d('0x23')](function(){_0x9b59a5[_0x921d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cd5c,_0x4aec31){return function(_0x1039e6){if(!_0x1039e6){_0x18cd5c[_0x921d('0x16')](0x194);}return _0x1039e6;};}function handleError(_0x468a7c,_0x499342){_0x499342=_0x499342||0x1f4;return function(_0x3cd1be){logger['error'](_0x3cd1be['stack']);if(_0x3cd1be[_0x921d('0x24')]){delete _0x3cd1be['name'];}_0x468a7c[_0x921d('0x17')](_0x499342)['send'](_0x3cd1be);};}exports['index']=function(_0x20cc73,_0x432e65){var _0x322c8b={},_0x5686d6={},_0x423188={'count':0x0,'rows':[]};var _0xfb1fa1=_[_0x921d('0x25')](db[_0x921d('0x26')]['rawAttributes'],function(_0x26024a){return{'name':_0x26024a[_0x921d('0x27')],'type':_0x26024a['type'][_0x921d('0x28')]};});_0x5686d6[_0x921d('0x29')]=_['map'](_0xfb1fa1,_0x921d('0x24'));_0x5686d6[_0x921d('0x2a')]=_[_0x921d('0x2b')](_0x20cc73[_0x921d('0x2a')]);_0x5686d6['filters']=_[_0x921d('0x2c')](_0x5686d6[_0x921d('0x29')],_0x5686d6[_0x921d('0x2a')]);_0x322c8b[_0x921d('0x2d')]=_[_0x921d('0x2c')](_0x5686d6[_0x921d('0x29')],qs[_0x921d('0x2e')](_0x20cc73[_0x921d('0x2a')][_0x921d('0x2e')]));_0x322c8b['attributes']=_0x322c8b[_0x921d('0x2d')][_0x921d('0x2f')]?_0x322c8b[_0x921d('0x2d')]:_0x5686d6[_0x921d('0x29')];if(!_0x20cc73[_0x921d('0x2a')]['hasOwnProperty'](_0x921d('0x30'))){_0x322c8b['limit']=qs[_0x921d('0x1b')](_0x20cc73[_0x921d('0x2a')]['limit']);_0x322c8b[_0x921d('0x1a')]=qs[_0x921d('0x1a')](_0x20cc73[_0x921d('0x2a')]['offset']);}_0x322c8b[_0x921d('0x31')]=qs[_0x921d('0x32')](_0x20cc73[_0x921d('0x2a')]['sort']);_0x322c8b['where']=qs[_0x921d('0x33')](_[_0x921d('0x34')](_0x20cc73['query'],_0x5686d6[_0x921d('0x33')]),_0xfb1fa1);if(_0x20cc73[_0x921d('0x2a')][_0x921d('0x35')]){_0x322c8b[_0x921d('0x36')]=_['merge'](_0x322c8b[_0x921d('0x36')],{'$or':_[_0x921d('0x25')](_0xfb1fa1,function(_0x2da7b1){if(_0x2da7b1['type']!=='VIRTUAL'){var _0x216efe={};_0x216efe[_0x2da7b1[_0x921d('0x24')]]={'$like':'%'+_0x20cc73[_0x921d('0x2a')][_0x921d('0x35')]+'%'};return _0x216efe;}})});}_0x322c8b=_[_0x921d('0x37')]({},_0x322c8b,_0x20cc73[_0x921d('0x38')]);var _0x45e609={'where':_0x322c8b['where']};return db[_0x921d('0x26')][_0x921d('0x19')](_0x45e609)[_0x921d('0x23')](function(_0x431090){_0x423188[_0x921d('0x19')]=_0x431090;if(_0x20cc73['query'][_0x921d('0x39')]){_0x322c8b[_0x921d('0x3a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x921d('0x3b')](_0x322c8b);})[_0x921d('0x23')](function(_0x98d48c){_0x423188[_0x921d('0x3c')]=_0x98d48c;return _0x423188;})[_0x921d('0x23')](respondWithFilteredResult(_0x432e65,_0x322c8b))[_0x921d('0x3d')](handleError(_0x432e65,null));};exports[_0x921d('0x3e')]=function(_0x285692,_0x26e767){var _0x1446a1={'raw':!![],'where':{'id':_0x285692[_0x921d('0x3f')]['id']}},_0x10290d={};_0x10290d[_0x921d('0x29')]=_[_0x921d('0x2b')](db[_0x921d('0x26')][_0x921d('0x40')]);_0x10290d[_0x921d('0x2a')]=_[_0x921d('0x2b')](_0x285692['query']);_0x10290d[_0x921d('0x33')]=_['intersection'](_0x10290d[_0x921d('0x29')],_0x10290d[_0x921d('0x2a')]);_0x1446a1['attributes']=_[_0x921d('0x2c')](_0x10290d[_0x921d('0x29')],qs['fields'](_0x285692[_0x921d('0x2a')][_0x921d('0x2e')]));_0x1446a1[_0x921d('0x2d')]=_0x1446a1[_0x921d('0x2d')][_0x921d('0x2f')]?_0x1446a1[_0x921d('0x2d')]:_0x10290d[_0x921d('0x29')];if(_0x285692['query'][_0x921d('0x39')]){_0x1446a1['include']=[{'all':!![]}];}_0x1446a1=_[_0x921d('0x37')]({},_0x1446a1,_0x285692[_0x921d('0x38')]);return db[_0x921d('0x26')]['find'](_0x1446a1)['then'](handleEntityNotFound(_0x26e767,null))[_0x921d('0x23')](respondWithResult(_0x26e767,null))['catch'](handleError(_0x26e767,null));};exports[_0x921d('0x41')]=function(_0x3c5f96,_0x56281e){return db[_0x921d('0x26')][_0x921d('0x41')](_0x3c5f96[_0x921d('0x42')],{})[_0x921d('0x23')](respondWithResult(_0x56281e,0xc9))[_0x921d('0x3d')](handleError(_0x56281e,null));};exports[_0x921d('0x21')]=function(_0x60992f,_0x248f9e){if(_0x60992f[_0x921d('0x42')]['id']){delete _0x60992f[_0x921d('0x42')]['id'];}return db[_0x921d('0x26')]['find']({'where':{'id':_0x60992f[_0x921d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x248f9e,null))[_0x921d('0x23')](saveUpdates(_0x60992f[_0x921d('0x42')],null))[_0x921d('0x23')](respondWithResult(_0x248f9e,null))[_0x921d('0x3d')](handleError(_0x248f9e,null));};exports[_0x921d('0x22')]=function(_0x5148c4,_0x39ded2){return db['JscriptyAnswerReport'][_0x921d('0x43')]({'where':{'id':_0x5148c4[_0x921d('0x3f')]['id']}})[_0x921d('0x23')](handleEntityNotFound(_0x39ded2,null))[_0x921d('0x23')](removeEntity(_0x39ded2,null))[_0x921d('0x3d')](handleError(_0x39ded2,null));};exports[_0x921d('0x44')]=function(_0x74a16e,_0x24c50e){return db[_0x921d('0x26')][_0x921d('0x44')]()[_0x921d('0x23')](respondWithResult(_0x24c50e,null))[_0x921d('0x3d')](handleError(_0x24c50e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c081d7e..9bc70a2 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 _0x7be9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger'];(function(_0x190e1f,_0x11e558){var _0x2ba93a=function(_0x395440){while(--_0x395440){_0x190e1f['push'](_0x190e1f['shift']());}};_0x2ba93a(++_0x11e558);}(_0x7be9,0x1ea));var _0x97be=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x7be9[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x97be('0x0'));var util=require('util');var logger=require(_0x97be('0x1'))(_0x97be('0x2'));var moment=require(_0x97be('0x3'));var BPromise=require(_0x97be('0x4'));var rp=require(_0x97be('0x5'));var fs=require('fs');var path=require(_0x97be('0x6'));var rimraf=require(_0x97be('0x7'));var config=require(_0x97be('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x19761b,_0x415240){return _0x19761b[_0x97be('0x9')](_0x97be('0xa'),attributes,{'tableName':_0x97be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x221b=['request-promise','path','rimraf','../../config/environment','define','report_jscripty_answers','lodash','../../config/logger','api','bluebird'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0x221b,0x114));var _0xb221=function(_0x6c3f58,_0x5b4af2){_0x6c3f58=_0x6c3f58-0x0;var _0x2381b6=_0x221b[_0x6c3f58];return _0x2381b6;};'use strict';var _=require(_0xb221('0x0'));var util=require('util');var logger=require(_0xb221('0x1'))(_0xb221('0x2'));var moment=require('moment');var BPromise=require(_0xb221('0x3'));var rp=require(_0xb221('0x4'));var fs=require('fs');var path=require(_0xb221('0x5'));var rimraf=require(_0xb221('0x6'));var config=require(_0xb221('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x53f531,_0x12949f){return _0x53f531[_0xb221('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xb221('0x9'),'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 bcb6b82..1af3823 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 _0x208f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','moment','bluebird'];(function(_0x39fdad,_0x3ea49b){var _0x35e83b=function(_0x211f30){while(--_0x211f30){_0x39fdad['push'](_0x39fdad['shift']());}};_0x35e83b(++_0x3ea49b);}(_0x208f,0x154));var _0xf208=function(_0x3d0d63,_0x39cfa5){_0x3d0d63=_0x3d0d63-0x0;var _0x11dafe=_0x208f[_0x3d0d63];return _0x11dafe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf208('0x0'));var BPromise=require(_0xf208('0x1'));var rs=require(_0xf208('0x2'));var fs=require('fs');var Redis=require(_0xf208('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf208('0x4'));var logger=require(_0xf208('0x5'))(_0xf208('0x6'));var config=require('../../config/environment');var jayson=require(_0xf208('0x7'));var client=jayson[_0xf208('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x125a1f,_0x4af426,_0x251b08){return new BPromise(function(_0x233fcd,_0x531e53){return client[_0xf208('0x9')](_0x125a1f,_0x251b08)[_0xf208('0xa')](function(_0x12376f){logger[_0xf208('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4af426,_0xf208('0xc'));logger[_0xf208('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4af426,_0xf208('0xc'),JSON[_0xf208('0xe')](_0x12376f));if(_0x12376f[_0xf208('0xf')]){if(_0x12376f['error']['code']===0x1f4){logger[_0xf208('0xf')](_0xf208('0x10'),_0x4af426,_0x12376f[_0xf208('0xf')][_0xf208('0x11')]);return _0x531e53(_0x12376f[_0xf208('0xf')][_0xf208('0x11')]);}logger[_0xf208('0xf')](_0xf208('0x10'),_0x4af426,_0x12376f['error'][_0xf208('0x11')]);return _0x233fcd(_0x12376f['error'][_0xf208('0x11')]);}else{logger[_0xf208('0xb')](_0xf208('0x10'),_0x4af426,_0xf208('0xc'));_0x233fcd(_0x12376f['result'][_0xf208('0x11')]);}})[_0xf208('0x12')](function(_0x58d285){logger[_0xf208('0xf')](_0xf208('0x10'),_0x4af426,_0x58d285);_0x531e53(_0x58d285);});});} \ No newline at end of file +var _0xa193=['../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4ca160,_0x14886c){var _0x303ae9=function(_0xa1d94c){while(--_0xa1d94c){_0x4ca160['push'](_0x4ca160['shift']());}};_0x303ae9(++_0x14886c);}(_0xa193,0x186));var _0x3a19=function(_0x9bfac8,_0x40288a){_0x9bfac8=_0x9bfac8-0x0;var _0x465d84=_0xa193[_0x9bfac8];return _0x465d84;};'use strict';var _=require(_0x3a19('0x0'));var util=require(_0x3a19('0x1'));var moment=require(_0x3a19('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a19('0x3'));var fs=require('fs');var Redis=require(_0x3a19('0x4'));var db=require(_0x3a19('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a19('0x6'))(_0x3a19('0x7'));var config=require(_0x3a19('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25299b,_0x48e0e7,_0x2bb01d){return new BPromise(function(_0x5a94fc,_0x5f0fe7){return client[_0x3a19('0xa')](_0x25299b,_0x2bb01d)[_0x3a19('0xb')](function(_0x58d2b3){logger[_0x3a19('0xc')](_0x3a19('0xd'),_0x48e0e7,_0x3a19('0xe'));logger[_0x3a19('0xf')](_0x3a19('0x10'),_0x48e0e7,'request\x20sent',JSON[_0x3a19('0x11')](_0x58d2b3));if(_0x58d2b3['error']){if(_0x58d2b3['error'][_0x3a19('0x12')]===0x1f4){logger[_0x3a19('0x13')](_0x3a19('0xd'),_0x48e0e7,_0x58d2b3['error'][_0x3a19('0x14')]);return _0x5f0fe7(_0x58d2b3['error']['message']);}logger['error'](_0x3a19('0xd'),_0x48e0e7,_0x58d2b3[_0x3a19('0x13')]['message']);return _0x5a94fc(_0x58d2b3['error'][_0x3a19('0x14')]);}else{logger[_0x3a19('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x48e0e7,_0x3a19('0xe'));_0x5a94fc(_0x58d2b3['result'][_0x3a19('0x14')]);}})[_0x3a19('0x15')](function(_0x16b4f0){logger[_0x3a19('0x13')](_0x3a19('0xd'),_0x48e0e7,_0x16b4f0);_0x5f0fe7(_0x16b4f0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e373159..13a5d0c 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 _0x8398=['../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','post','create','/:id/clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3239ff,_0x4edc68){var _0xd0c9fc=function(_0x4e68af){while(--_0x4e68af){_0x3239ff['push'](_0x3239ff['shift']());}};_0xd0c9fc(++_0x4edc68);}(_0x8398,0x170));var _0x8839=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8398[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var path=require(_0x8839('0x2'));var timeout=require(_0x8839('0x3'));var express=require(_0x8839('0x4'));var router=express['Router']();var auth=require(_0x8839('0x5'));var interaction=require(_0x8839('0x6'));var config=require(_0x8839('0x7'));var controller=require(_0x8839('0x8'));router[_0x8839('0x9')]('/',auth[_0x8839('0xa')](),controller[_0x8839('0xb')]);router[_0x8839('0x9')]('/:id',auth[_0x8839('0xa')](),controller[_0x8839('0xc')]);router[_0x8839('0x9')](_0x8839('0xd'),auth[_0x8839('0xa')](),controller[_0x8839('0xe')]);router['get'](_0x8839('0xf'),auth[_0x8839('0xa')](),controller['getAnswers']);router[_0x8839('0x9')]('/:id/summary',auth[_0x8839('0xa')](),timeout('30s'),controller['getSummary']);router[_0x8839('0x10')]('/',auth[_0x8839('0xa')](),controller[_0x8839('0x11')]);router['post'](_0x8839('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0x8839('0x13')](_0x8839('0x14'),auth[_0x8839('0xa')](),controller[_0x8839('0x15')]);router[_0x8839('0x16')]('/:id',auth[_0x8839('0xa')](),controller[_0x8839('0x17')]);module[_0x8839('0x18')]=router; \ No newline at end of file +var _0xf9b6=['getSessions','/:id/answers','30s','post','create','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sessions'];(function(_0x111f90,_0x1fa9fe){var _0x14132d=function(_0x281e41){while(--_0x281e41){_0x111f90['push'](_0x111f90['shift']());}};_0x14132d(++_0x1fa9fe);}(_0xf9b6,0x1bf));var _0x6f9b=function(_0x110ea8,_0xacb6fa){_0x110ea8=_0x110ea8-0x0;var _0x4073cf=_0xf9b6[_0x110ea8];return _0x4073cf;};'use strict';var multer=require(_0x6f9b('0x0'));var util=require(_0x6f9b('0x1'));var path=require(_0x6f9b('0x2'));var timeout=require(_0x6f9b('0x3'));var express=require(_0x6f9b('0x4'));var router=express[_0x6f9b('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f9b('0x6'));var controller=require('./jscriptyProject.controller');router[_0x6f9b('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f9b('0x8')]);router['get'](_0x6f9b('0x9'),auth[_0x6f9b('0xa')](),controller[_0x6f9b('0xb')]);router['get'](_0x6f9b('0xc'),auth[_0x6f9b('0xa')](),controller[_0x6f9b('0xd')]);router[_0x6f9b('0x7')](_0x6f9b('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/summary',auth[_0x6f9b('0xa')](),timeout(_0x6f9b('0xf')),controller['getSummary']);router[_0x6f9b('0x10')]('/',auth[_0x6f9b('0xa')](),controller[_0x6f9b('0x11')]);router[_0x6f9b('0x10')]('/:id/clone',auth[_0x6f9b('0xa')](),controller[_0x6f9b('0x12')]);router[_0x6f9b('0x13')](_0x6f9b('0x9'),auth[_0x6f9b('0xa')](),controller['update']);router[_0x6f9b('0x14')](_0x6f9b('0x9'),auth[_0x6f9b('0xa')](),controller[_0x6f9b('0x15')]);module[_0x6f9b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index beedd8e..7a606c6 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 _0xb7f8=['description','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x31d487,_0x2ba214){var _0x4e9664=function(_0x5bffca){while(--_0x5bffca){_0x31d487['push'](_0x31d487['shift']());}};_0x4e9664(++_0x2ba214);}(_0xb7f8,0x1c3));var _0x8b7f=function(_0x569496,_0x556d9d){_0x569496=_0x569496-0x0;var _0xa8b0a3=_0xb7f8[_0x569496];return _0xa8b0a3;};'use strict';var Sequelize=require(_0x8b7f('0x0'));var _=require(_0x8b7f('0x1'));var util=require(_0x8b7f('0x2'));module['exports']={'name':{'type':Sequelize[_0x8b7f('0x3')],'unique':_0x8b7f('0x4')},'description':{'type':Sequelize[_0x8b7f('0x3')]},'formData':{'type':Sequelize[_0x8b7f('0x5')](_0x8b7f('0x6')),'set':function(_0xa47189){if(_[_0x8b7f('0x7')](_0xa47189)){this[_0x8b7f('0x8')](_0x8b7f('0x9'),JSON[_0x8b7f('0xa')](_0xa47189));}else if(_[_0x8b7f('0xb')](_0xa47189)){this[_0x8b7f('0x8')](_0x8b7f('0x9'),_0xa47189);}else{this[_0x8b7f('0x8')](_0x8b7f('0x9'),util[_0x8b7f('0xc')](_0x8b7f('0xd'),this['getDataValue'](_0x8b7f('0x4'))||'',this['getDataValue'](_0x8b7f('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6566=['setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','isObjectLike'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x6566,0x119));var _0x6656=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x6566[_0x5933fb];return _0x44d988;};'use strict';var Sequelize=require(_0x6656('0x0'));var _=require('lodash');var util=require(_0x6656('0x1'));module[_0x6656('0x2')]={'name':{'type':Sequelize[_0x6656('0x3')],'unique':_0x6656('0x4')},'description':{'type':Sequelize[_0x6656('0x3')]},'formData':{'type':Sequelize[_0x6656('0x5')]('long'),'set':function(_0x5a9576){if(_[_0x6656('0x6')](_0x5a9576)){this[_0x6656('0x7')](_0x6656('0x8'),JSON[_0x6656('0x9')](_0x5a9576));}else if(_[_0x6656('0xa')](_0x5a9576)){this[_0x6656('0x7')](_0x6656('0x8'),_0x5a9576);}else{this[_0x6656('0x7')](_0x6656('0x8'),util[_0x6656('0xb')](_0x6656('0xc'),this[_0x6656('0xd')](_0x6656('0x4'))||'',this[_0x6656('0xd')](_0x6656('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6656('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6656('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 63b8834..059be5e 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 _0x232e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','JscriptyProject','count','includeAll','include','catch','show','params','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','create','UserProfileSection','getSessions','findOne','filter','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','ProjectId','rows','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv','html-pdf','zip-dir','fast-json-patch','bluebird','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x3fe944,_0x5356e9){var _0x1bc66c=function(_0x3958d9){while(--_0x3958d9){_0x3fe944['push'](_0x3fe944['shift']());}};_0x1bc66c(++_0x5356e9);}(_0x232e,0xdc));var _0xe232=function(_0x31b02e,_0x1c677a){_0x31b02e=_0x31b02e-0x0;var _0x505ae4=_0x232e[_0x31b02e];return _0x505ae4;};'use strict';var pdf=require(_0xe232('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe232('0x1'));var jsonpatch=require(_0xe232('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe232('0x3'));var Mustache=require('mustache');var util=require(_0xe232('0x4'));var path=require('path');var sox=require(_0xe232('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe232('0x6'));var squel=require(_0xe232('0x7'));var crypto=require('crypto');var jsforce=require(_0xe232('0x8'));var deskjs=require(_0xe232('0x9'));var toCsv=require(_0xe232('0xa'));var querystring=require(_0xe232('0xb'));var Papa=require(_0xe232('0xc'));var Redis=require(_0xe232('0xd'));var authService=require(_0xe232('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe232('0xf'));var hardwareService=require(_0xe232('0x10'));var logger=require(_0xe232('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe232('0x12'));var licenseUtil=require(_0xe232('0x13'));var db=require(_0xe232('0x14'))['db'];function respondWithStatusCode(_0x34bebf,_0x3ec9ca){_0x3ec9ca=_0x3ec9ca||0xcc;return function(_0x45b566){if(_0x45b566){return _0x34bebf[_0xe232('0x15')](_0x3ec9ca);}return _0x34bebf['status'](_0x3ec9ca)[_0xe232('0x16')]();};}function respondWithResult(_0x44556e,_0x47684e){_0x47684e=_0x47684e||0xc8;return function(_0x231029){if(_0x231029){return _0x44556e[_0xe232('0x17')](_0x47684e)[_0xe232('0x18')](_0x231029);}};}function respondWithFilteredResult(_0x14d955,_0x4216a2){return function(_0x335548){if(_0x335548){var _0x2ed119=_0x335548['count'],_0x598476=_0x4216a2[_0xe232('0x19')],_0x519357=_0x4216a2[_0xe232('0x19')]+_0x4216a2[_0xe232('0x1a')],_0x152ded;if(_0x519357>=_0x2ed119){_0x519357=_0x2ed119;_0x152ded=0xc8;}else{_0x152ded=0xce;}_0x14d955[_0xe232('0x17')](_0x152ded);return _0x14d955[_0xe232('0x1b')](_0xe232('0x1c'),_0x598476+'-'+_0x519357+'/'+_0x2ed119)['json'](_0x335548);}return null;};}function patchUpdates(_0x36484c){return function(_0x211522){try{jsonpatch['apply'](_0x211522,_0x36484c,!![]);}catch(_0x122a92){return BPromise['reject'](_0x122a92);}return _0x211522['save']();};}function saveUpdates(_0x11afef,_0x6cfee9){return function(_0x97f30c){if(_0x97f30c){return _0x97f30c[_0xe232('0x1d')](_0x11afef)['then'](function(_0x125b36){return _0x125b36;});}return null;};}function removeEntity(_0xe5c3df,_0x2e3d88){return function(_0xace4e6){if(_0xace4e6){return _0xace4e6[_0xe232('0x1e')]()['then'](function(){var _0x4f7f9c=_0xace4e6[_0xe232('0x1f')]({'plain':!![]});var _0x5cb7e5='Projects';return db[_0xe232('0x20')][_0xe232('0x1e')]({'where':{'type':_0x5cb7e5,'resourceId':_0x4f7f9c['id']}})[_0xe232('0x21')](function(){return _0xace4e6;});})[_0xe232('0x21')](function(){_0xe5c3df[_0xe232('0x17')](0xcc)[_0xe232('0x16')]();});}};}function handleEntityNotFound(_0x97ec63,_0x19c5c3){return function(_0xc86ad){if(!_0xc86ad){_0x97ec63[_0xe232('0x15')](0x194);}return _0xc86ad;};}function handleError(_0x52c491,_0x55e6ba){_0x55e6ba=_0x55e6ba||0x1f4;return function(_0xb86372){logger[_0xe232('0x22')](_0xb86372[_0xe232('0x23')]);if(_0xb86372[_0xe232('0x24')]){delete _0xb86372[_0xe232('0x24')];}_0x52c491[_0xe232('0x17')](_0x55e6ba)[_0xe232('0x25')](_0xb86372);};}exports[_0xe232('0x26')]=function(_0x1e7eec,_0xfefe71){var _0x2c1882={},_0x355ab8={},_0x317a09={'count':0x0,'rows':[]};var _0x198e2f=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x2c36bc){return{'name':_0x2c36bc[_0xe232('0x27')],'type':_0x2c36bc[_0xe232('0x28')][_0xe232('0x29')]};});_0x355ab8[_0xe232('0x2a')]=_[_0xe232('0x2b')](_0x198e2f,_0xe232('0x24'));_0x355ab8[_0xe232('0x2c')]=_[_0xe232('0x2d')](_0x1e7eec[_0xe232('0x2c')]);_0x355ab8['filters']=_[_0xe232('0x2e')](_0x355ab8['model'],_0x355ab8[_0xe232('0x2c')]);_0x2c1882['attributes']=_[_0xe232('0x2e')](_0x355ab8[_0xe232('0x2a')],qs[_0xe232('0x2f')](_0x1e7eec[_0xe232('0x2c')][_0xe232('0x2f')]));_0x2c1882[_0xe232('0x30')]=_0x2c1882[_0xe232('0x30')]['length']?_0x2c1882[_0xe232('0x30')]:_0x355ab8[_0xe232('0x2a')];if(!_0x1e7eec['query'][_0xe232('0x31')](_0xe232('0x32'))){_0x2c1882[_0xe232('0x1a')]=qs[_0xe232('0x1a')](_0x1e7eec[_0xe232('0x2c')][_0xe232('0x1a')]);_0x2c1882['offset']=qs['offset'](_0x1e7eec[_0xe232('0x2c')][_0xe232('0x19')]);}_0x2c1882[_0xe232('0x33')]=qs[_0xe232('0x34')](_0x1e7eec[_0xe232('0x2c')][_0xe232('0x34')]);_0x2c1882[_0xe232('0x35')]=qs[_0xe232('0x36')](_[_0xe232('0x37')](_0x1e7eec['query'],_0x355ab8[_0xe232('0x36')]),_0x198e2f);if(_0x1e7eec[_0xe232('0x2c')]['filter']){_0x2c1882[_0xe232('0x35')]=_[_0xe232('0x38')](_0x2c1882[_0xe232('0x35')],{'$or':_[_0xe232('0x2b')](_0x198e2f,function(_0x253dc7){if(_0x253dc7[_0xe232('0x28')]!==_0xe232('0x39')){var _0x32d445={};_0x32d445[_0x253dc7[_0xe232('0x24')]]={'$like':'%'+_0x1e7eec[_0xe232('0x2c')]['filter']+'%'};return _0x32d445;}})});}_0x2c1882=_[_0xe232('0x38')]({},_0x2c1882,_0x1e7eec[_0xe232('0x3a')]);var _0x2b102e={'where':_0x2c1882[_0xe232('0x35')]};return db[_0xe232('0x3b')]['count'](_0x2b102e)[_0xe232('0x21')](function(_0x4d4101){_0x317a09[_0xe232('0x3c')]=_0x4d4101;if(_0x1e7eec[_0xe232('0x2c')][_0xe232('0x3d')]){_0x2c1882[_0xe232('0x3e')]=[{'all':!![]}];}return db[_0xe232('0x3b')]['findAll'](_0x2c1882);})[_0xe232('0x21')](function(_0x14baf6){_0x317a09['rows']=_0x14baf6;return _0x317a09;})[_0xe232('0x21')](respondWithFilteredResult(_0xfefe71,_0x2c1882))[_0xe232('0x3f')](handleError(_0xfefe71,null));};exports[_0xe232('0x40')]=function(_0x4375d8,_0x32ac48){var _0x23f2b4={'raw':![],'where':{'id':_0x4375d8[_0xe232('0x41')]['id']}},_0x5c4e31={};_0x5c4e31[_0xe232('0x2a')]=_[_0xe232('0x2d')](db[_0xe232('0x3b')][_0xe232('0x42')]);_0x5c4e31[_0xe232('0x2c')]=_[_0xe232('0x2d')](_0x4375d8[_0xe232('0x2c')]);_0x5c4e31['filters']=_['intersection'](_0x5c4e31[_0xe232('0x2a')],_0x5c4e31[_0xe232('0x2c')]);_0x23f2b4[_0xe232('0x30')]=_['intersection'](_0x5c4e31['model'],qs[_0xe232('0x2f')](_0x4375d8[_0xe232('0x2c')][_0xe232('0x2f')]));_0x23f2b4[_0xe232('0x30')]=_0x23f2b4['attributes'][_0xe232('0x43')]?_0x23f2b4[_0xe232('0x30')]:_0x5c4e31[_0xe232('0x2a')];if(_0x4375d8[_0xe232('0x2c')][_0xe232('0x3d')]){_0x23f2b4[_0xe232('0x3e')]=[{'all':!![]}];}_0x23f2b4=_[_0xe232('0x38')]({},_0x23f2b4,_0x4375d8[_0xe232('0x3a')]);return db[_0xe232('0x3b')][_0xe232('0x44')](_0x23f2b4)[_0xe232('0x21')](handleEntityNotFound(_0x32ac48,null))[_0xe232('0x21')](respondWithResult(_0x32ac48,null))['catch'](handleError(_0x32ac48,null));};exports['create']=function(_0x3171c3,_0x2c86b9){return db['JscriptyProject']['create'](_0x3171c3[_0xe232('0x45')],{})[_0xe232('0x21')](function(_0x1e9c0f){var _0x4d2d40=_0x3171c3[_0xe232('0x46')][_0xe232('0x1f')]({'plain':!![]});if(!_0x4d2d40)throw new Error(_0xe232('0x47'));if(_0x4d2d40[_0xe232('0x48')]===_0xe232('0x46')){var _0x9dd786=_0x1e9c0f['get']({'plain':!![]});var _0x504678=_0xe232('0x49');return db['UserProfileSection'][_0xe232('0x44')]({'where':{'name':_0x504678,'userProfileId':_0x4d2d40[_0xe232('0x4a')]},'raw':!![]})[_0xe232('0x21')](function(_0x397f82){if(_0x397f82&&_0x397f82['autoAssociation']===0x0){return db[_0xe232('0x20')]['create']({'name':_0x9dd786[_0xe232('0x24')],'resourceId':_0x9dd786['id'],'type':_0x397f82[_0xe232('0x24')],'sectionId':_0x397f82['id']},{})['then'](function(){return _0x1e9c0f;});}else{return _0x1e9c0f;}})['catch'](function(_0xa80cfa){logger[_0xe232('0x22')](_0xe232('0x4b'),_0xa80cfa);throw _0xa80cfa;});}return _0x1e9c0f;})[_0xe232('0x21')](respondWithResult(_0x2c86b9,0xc9))[_0xe232('0x3f')](handleError(_0x2c86b9,null));};exports[_0xe232('0x4c')]=function(_0x26c9b1,_0x219a2d){var _0x43ed8f={'where':{'id':_0x26c9b1['params']['id']}},_0x537443={};_0x537443['model']=_[_0xe232('0x2d')](db['JscriptyProject'][_0xe232('0x42')]);_0x43ed8f[_0xe232('0x30')]=_[_0xe232('0x2e')](_0x537443[_0xe232('0x2a')],qs[_0xe232('0x2f')](_0x26c9b1[_0xe232('0x2c')][_0xe232('0x2f')]));_0x43ed8f['attributes']=_0x43ed8f[_0xe232('0x30')]['length']?_0x43ed8f[_0xe232('0x30')]:_0x537443[_0xe232('0x2a')];if(_0x26c9b1['query'][_0xe232('0x3d')]){_0x43ed8f[_0xe232('0x3e')]=[{'all':!![]}];}_0x43ed8f=_[_0xe232('0x38')]({},_0x43ed8f,_0x26c9b1[_0xe232('0x3a')]);return db[_0xe232('0x3b')][_0xe232('0x44')](_0x43ed8f)[_0xe232('0x21')](handleEntityNotFound(_0x219a2d,null))['then'](function(_0x5c8e28){if(_0x5c8e28){var _0x4cecb0=_0x5c8e28[_0xe232('0x1f')]({'plain':!![]});_0x4cecb0=qs[_0xe232('0x4d')](_0x4cecb0,['id','createdAt',_0xe232('0x4e')]);_0x26c9b1[_0xe232('0x45')]=_[_0xe232('0x4d')](_0x26c9b1[_0xe232('0x45')],['id',_0xe232('0x4f'),_0xe232('0x4e')]);return db['JscriptyProject'][_0xe232('0x50')](_[_0xe232('0x38')](_0x4cecb0,_0x26c9b1[_0xe232('0x45')]),{'include':_0x26c9b1['query'][_0xe232('0x3d')]?[{'all':!![]}]:undefined})[_0xe232('0x21')](function(_0x58426d){var _0x3fe141=_0x26c9b1[_0xe232('0x46')][_0xe232('0x1f')]({'plain':!![]});if(!_0x3fe141)throw new Error(_0xe232('0x47'));if(_0x3fe141[_0xe232('0x48')]==='user'){var _0x22dbce=_0x58426d['get']({'plain':!![]});var _0x4c3d91=_0xe232('0x49');return db[_0xe232('0x51')][_0xe232('0x44')]({'where':{'name':_0x4c3d91,'userProfileId':_0x3fe141['userProfileId']},'raw':!![]})[_0xe232('0x21')](function(_0x2578f4){if(_0x2578f4&&_0x2578f4['autoAssociation']===0x0){return db[_0xe232('0x20')][_0xe232('0x50')]({'name':_0x22dbce[_0xe232('0x24')],'resourceId':_0x22dbce['id'],'type':_0x2578f4[_0xe232('0x24')],'sectionId':_0x2578f4['id']},{})[_0xe232('0x21')](function(){return _0x58426d;});}else{return _0x58426d;}})[_0xe232('0x3f')](function(_0x40fdf4){logger[_0xe232('0x22')](_0xe232('0x4b'),_0x40fdf4);throw _0x40fdf4;});}return _0x58426d;});}})[_0xe232('0x21')](respondWithResult(_0x219a2d,0xc9))[_0xe232('0x3f')](handleError(_0x219a2d,null));};exports['update']=function(_0x313437,_0x2c8b79){if(_0x313437['body']['id']){delete _0x313437['body']['id'];}return db[_0xe232('0x3b')][_0xe232('0x44')]({'where':{'id':_0x313437[_0xe232('0x41')]['id']}})[_0xe232('0x21')](handleEntityNotFound(_0x2c8b79,null))['then'](saveUpdates(_0x313437[_0xe232('0x45')],null))['then'](respondWithResult(_0x2c8b79,null))[_0xe232('0x3f')](handleError(_0x2c8b79,null));};exports[_0xe232('0x1e')]=function(_0x47a97a,_0x7194bb){return db[_0xe232('0x3b')][_0xe232('0x44')]({'where':{'id':_0x47a97a[_0xe232('0x41')]['id']}})[_0xe232('0x21')](handleEntityNotFound(_0x7194bb,null))['then'](removeEntity(_0x7194bb,null))[_0xe232('0x3f')](handleError(_0x7194bb,null));};exports[_0xe232('0x52')]=function(_0x3eac2b,_0x456b33,_0x455888){var _0x5cd912={'raw':!![],'where':{}};var _0x12d648={};var _0x2a8a13={'count':0x0,'rows':[]};return db[_0xe232('0x3b')][_0xe232('0x53')]({'where':{'id':_0x3eac2b[_0xe232('0x41')]['id']}})['then'](handleEntityNotFound(_0x456b33,null))[_0xe232('0x21')](function(_0x32ace9){if(_0x32ace9){_0x12d648['model']=_[_0xe232('0x2d')](db['JscriptySessionReport'][_0xe232('0x42')]);_0x12d648[_0xe232('0x2c')]=_[_0xe232('0x2d')](_0x3eac2b[_0xe232('0x2c')]);_0x12d648[_0xe232('0x36')]=_[_0xe232('0x2e')](_0x12d648[_0xe232('0x2a')],_0x12d648[_0xe232('0x2c')]);_0x5cd912[_0xe232('0x30')]=_[_0xe232('0x2e')](_0x12d648['model'],qs[_0xe232('0x2f')](_0x3eac2b[_0xe232('0x2c')][_0xe232('0x2f')]));_0x5cd912[_0xe232('0x30')]=_0x5cd912[_0xe232('0x30')][_0xe232('0x43')]?_0x5cd912[_0xe232('0x30')]:_0x12d648['model'];if(!_0x3eac2b['query']['hasOwnProperty']('nolimit')){_0x5cd912[_0xe232('0x1a')]=qs[_0xe232('0x1a')](_0x3eac2b[_0xe232('0x2c')][_0xe232('0x1a')]);_0x5cd912[_0xe232('0x19')]=qs[_0xe232('0x19')](_0x3eac2b['query'][_0xe232('0x19')]);}_0x5cd912['order']=qs[_0xe232('0x34')](_0x3eac2b[_0xe232('0x2c')][_0xe232('0x34')]);_0x5cd912[_0xe232('0x35')]=qs[_0xe232('0x36')](_['pick'](_0x3eac2b['query'],_0x12d648[_0xe232('0x36')]));_0x5cd912[_0xe232('0x35')]['ProjectId']=_0x32ace9['id'];if(_0x3eac2b[_0xe232('0x2c')][_0xe232('0x54')]){_0x5cd912[_0xe232('0x35')]=_[_0xe232('0x38')](_0x5cd912[_0xe232('0x35')],{'$or':_[_0xe232('0x2b')](_0x5cd912[_0xe232('0x30')],function(_0x1aac15){var _0x25b8c6={};_0x25b8c6[_0x1aac15]={'$like':'%'+_0x3eac2b[_0xe232('0x2c')]['filter']+'%'};return _0x25b8c6;})});}_0x5cd912=_[_0xe232('0x38')]({},_0x5cd912,_0x3eac2b[_0xe232('0x3a')]);return db[_0xe232('0x55')][_0xe232('0x3c')]({'where':_0x5cd912[_0xe232('0x35')]})[_0xe232('0x21')](function(_0x2c63cc){_0x2a8a13[_0xe232('0x3c')]=_0x2c63cc;if(_0x3eac2b['query'][_0xe232('0x3d')]){_0x5cd912['include']=[{'all':!![]}];}return db[_0xe232('0x55')][_0xe232('0x56')](_0x5cd912);})['then'](function(_0x888091){_0x2a8a13['rows']=_0x888091;return _0x2a8a13;});}})['then'](respondWithFilteredResult(_0x456b33,_0x5cd912))[_0xe232('0x3f')](handleError(_0x456b33,null));};exports[_0xe232('0x57')]=function(_0x33d6da,_0xf45ea9,_0x3946ac){var _0x558d77={'raw':!![],'where':{}};var _0xdfec01={};var _0x80a443={'count':0x0,'rows':[]};return db[_0xe232('0x3b')][_0xe232('0x53')]({'where':{'id':_0x33d6da['params']['id']}})[_0xe232('0x21')](handleEntityNotFound(_0xf45ea9,null))[_0xe232('0x21')](function(_0x4c692c){if(_0x4c692c){_0xdfec01['model']=_[_0xe232('0x2d')](db[_0xe232('0x58')][_0xe232('0x42')]);_0xdfec01['query']=_[_0xe232('0x2d')](_0x33d6da['query']);_0xdfec01[_0xe232('0x36')]=_[_0xe232('0x2e')](_0xdfec01[_0xe232('0x2a')],_0xdfec01[_0xe232('0x2c')]);_0x558d77[_0xe232('0x30')]=_[_0xe232('0x2e')](_0xdfec01[_0xe232('0x2a')],qs[_0xe232('0x2f')](_0x33d6da[_0xe232('0x2c')][_0xe232('0x2f')]));_0x558d77[_0xe232('0x30')]=_0x558d77[_0xe232('0x30')][_0xe232('0x43')]?_0x558d77[_0xe232('0x30')]:_0xdfec01[_0xe232('0x2a')];if(!_0x33d6da[_0xe232('0x2c')][_0xe232('0x31')](_0xe232('0x32'))){_0x558d77['limit']=qs['limit'](_0x33d6da['query'][_0xe232('0x1a')]);_0x558d77[_0xe232('0x19')]=qs[_0xe232('0x19')](_0x33d6da[_0xe232('0x2c')][_0xe232('0x19')]);}_0x558d77[_0xe232('0x33')]=qs[_0xe232('0x34')](_0x33d6da[_0xe232('0x2c')]['sort']);_0x558d77[_0xe232('0x35')]=qs[_0xe232('0x36')](_['pick'](_0x33d6da[_0xe232('0x2c')],_0xdfec01[_0xe232('0x36')]));_0x558d77[_0xe232('0x35')][_0xe232('0x59')]=_0x4c692c['id'];if(_0x33d6da['query'][_0xe232('0x54')]){_0x558d77[_0xe232('0x35')]=_[_0xe232('0x38')](_0x558d77[_0xe232('0x35')],{'$or':_['map'](_0x558d77['attributes'],function(_0x31b953){var _0x4233f4={};_0x4233f4[_0x31b953]={'$like':'%'+_0x33d6da[_0xe232('0x2c')][_0xe232('0x54')]+'%'};return _0x4233f4;})});}_0x558d77=_[_0xe232('0x38')]({},_0x558d77,_0x33d6da[_0xe232('0x3a')]);return db[_0xe232('0x58')]['count']({'where':_0x558d77[_0xe232('0x35')]})[_0xe232('0x21')](function(_0x3ec5ed){_0x80a443['count']=_0x3ec5ed;if(_0x33d6da[_0xe232('0x2c')]['includeAll']){_0x558d77[_0xe232('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe232('0x56')](_0x558d77);})[_0xe232('0x21')](function(_0x12df7d){_0x80a443[_0xe232('0x5a')]=_0x12df7d;return _0x80a443;});}})[_0xe232('0x21')](respondWithFilteredResult(_0xf45ea9,_0x558d77))[_0xe232('0x3f')](handleError(_0xf45ea9,null));};function char(_0x14b885){return _0xe232('0x5b')===typeof _0x14b885?String[_0xe232('0x5c')]['apply'](null,arguments):_0x14b885;}function needsEncapsulation(_0x57e2bd){return!!_0x57e2bd&&(_0x57e2bd[_0xe232('0x5d')]()[_0xe232('0x5e')](char(0xd))>=0x0||_0x57e2bd[_0xe232('0x5d')]()['indexOf'](char(0xa))>=0x0||_0x57e2bd[_0xe232('0x5d')]()[_0xe232('0x5e')](char(0x2c))>=0x0||_0x57e2bd[_0xe232('0x5d')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4ea725){var _0x58e513=char(0x22),_0x573062='\x5c'+char(0x22),_0x214c28=_0x4ea725['toString']()[_0xe232('0x5f')](new RegExp(_0x58e513,'g'),_0x573062);return _0x58e513+_0x214c28+_0x58e513;}exports[_0xe232('0x60')]=function(_0xf0e55b,_0x35900a,_0x3312ef){var _0x340df1,_0x25cf69;var _0x276f70={'where':{'ProjectId':_0xf0e55b[_0xe232('0x41')]['id']}};if(_0xf0e55b['query'][_0xe232('0x61')]){_0x276f70[_0xe232('0x35')][_0xe232('0x62')]=JSON[_0xe232('0x63')](_0xf0e55b[_0xe232('0x2c')][_0xe232('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x276f70)['then'](handleEntityNotFound(_0x35900a,null))[_0xe232('0x21')](function(_0xe3d7c3){if(_0xe3d7c3){_0x340df1=_0xe3d7c3;return db[_0xe232('0x64')][_0xe232('0x56')]({'where':{'SessionId':{'$in':_['map'](_0x340df1,'id')},'ProjectId':_0xf0e55b[_0xe232('0x41')]['id']},'order':_0xe232('0x65')});}})[_0xe232('0x21')](handleEntityNotFound(_0x35900a,null))[_0xe232('0x21')](function(_0x1a5f1a){if(_0x1a5f1a){_0x25cf69=_0x1a5f1a;var _0x30dd5c={};for(var _0x58c4ce=0x0,_0x51cba3=_0x25cf69[_0xe232('0x43')];_0x58c4ce<_0x51cba3;_0x58c4ce++){if(!_0x30dd5c[_0xe232('0x31')](_0x25cf69[_0x58c4ce]['questionId'])){_0x30dd5c[_0x25cf69[_0x58c4ce][_0xe232('0x66')]]=needsEncapsulation(_0x25cf69[_0x58c4ce]['question'])?encapsulate(_0x25cf69[_0x58c4ce][_0xe232('0x67')]):_0x25cf69[_0x58c4ce][_0xe232('0x67')];}}var _0x2570f1=[],_0x5d5ef1={};for(var _0x27169a=0x0,_0x406eb8=_0x340df1[_0xe232('0x43')];_0x27169a<_0x406eb8;_0x27169a++){_0x5d5ef1={'ProjectId':_0xf0e55b[_0xe232('0x41')]['id'],'SessionId':_0x340df1[_0x27169a]['id'],'StartTime':moment(_0x340df1[_0x27169a]['starttime'])[_0xe232('0x68')](_0xe232('0x69'))};for(var _0x3d44e0=0x0,_0x160661=_0x25cf69[_0xe232('0x43')];_0x3d44e0<_0x160661;_0x3d44e0++){if(_0x25cf69[_0x3d44e0]['SessionId']==_0x340df1[_0x27169a]['id']&&_0x30dd5c[_0xe232('0x31')](_0x25cf69[_0x3d44e0][_0xe232('0x66')])){_0x5d5ef1[_0x30dd5c[_0x25cf69[_0x3d44e0]['questionId']]]=_0x25cf69[_0x3d44e0][_0xe232('0x6a')];}}for(var _0x212997 in _0x30dd5c){if(!_0x5d5ef1[_0xe232('0x31')](_0x30dd5c[_0x212997])){_0x5d5ef1[_0x30dd5c[_0x212997]]=null;}}_0x2570f1[_0xe232('0x6b')](_0x5d5ef1);}return _0x2570f1;}})[_0xe232('0x21')](function(_0x5d4105){if(!_[_0xe232('0x6c')](_0x5d4105)){var _0x531943=toCsv(_0x5d4105);var _0x11942b=Date[_0xe232('0x6d')]();fs[_0xe232('0x6e')](util[_0xe232('0x68')](_0xe232('0x6f'),_0xf0e55b[_0xe232('0x41')]['id'],_0x11942b),_0x531943);_0x35900a[_0xe232('0x70')](_0xe232('0x71'),_0xe232('0x72')+util[_0xe232('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0xf0e55b[_0xe232('0x41')]['id'],_0x11942b));_0x35900a['setHeader']('Content-type',_0xe232('0x73'));return _0x35900a['download'](util[_0xe232('0x68')](_0xe232('0x6f'),_0xf0e55b[_0xe232('0x41')]['id'],_0x11942b));}else{return _0x35900a[_0xe232('0x15')](0xcc);}})[_0xe232('0x3f')](handleError(_0x35900a,null));}; \ No newline at end of file +var _0x35a3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','body','role','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','html-pdf'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x35a3,0xf3));var _0x335a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x35a3[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x335a('0x0'));var emlformat=require(_0x335a('0x1'));var rimraf=require(_0x335a('0x2'));var zipdir=require(_0x335a('0x3'));var jsonpatch=require(_0x335a('0x4'));var rp=require(_0x335a('0x5'));var moment=require(_0x335a('0x6'));var BPromise=require(_0x335a('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x335a('0x8'));var csv=require(_0x335a('0x9'));var ejs=require(_0x335a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x335a('0xb'));var jsforce=require(_0x335a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x335a('0x9'));var querystring=require(_0x335a('0xd'));var Papa=require(_0x335a('0xe'));var Redis=require(_0x335a('0xf'));var authService=require(_0x335a('0x10'));var qs=require(_0x335a('0x11'));var as=require(_0x335a('0x12'));var hardwareService=require(_0x335a('0x13'));var logger=require('../../config/logger')(_0x335a('0x14'));var utils=require(_0x335a('0x15'));var config=require(_0x335a('0x16'));var licenseUtil=require(_0x335a('0x17'));var db=require(_0x335a('0x18'))['db'];function respondWithStatusCode(_0x44e72d,_0x2324d0){_0x2324d0=_0x2324d0||0xcc;return function(_0x4bf219){if(_0x4bf219){return _0x44e72d[_0x335a('0x19')](_0x2324d0);}return _0x44e72d[_0x335a('0x1a')](_0x2324d0)[_0x335a('0x1b')]();};}function respondWithResult(_0x577278,_0xb1c934){_0xb1c934=_0xb1c934||0xc8;return function(_0x50a731){if(_0x50a731){return _0x577278[_0x335a('0x1a')](_0xb1c934)[_0x335a('0x1c')](_0x50a731);}};}function respondWithFilteredResult(_0x3176c7,_0x49a9a1){return function(_0x19eb51){if(_0x19eb51){var _0x589bee=_0x19eb51[_0x335a('0x1d')],_0x9cfec9=_0x49a9a1['offset'],_0x2a6454=_0x49a9a1[_0x335a('0x1e')]+_0x49a9a1['limit'],_0x20768c;if(_0x2a6454>=_0x589bee){_0x2a6454=_0x589bee;_0x20768c=0xc8;}else{_0x20768c=0xce;}_0x3176c7[_0x335a('0x1a')](_0x20768c);return _0x3176c7[_0x335a('0x1f')](_0x335a('0x20'),_0x9cfec9+'-'+_0x2a6454+'/'+_0x589bee)['json'](_0x19eb51);}return null;};}function patchUpdates(_0x275bf2){return function(_0x4b7f8a){try{jsonpatch[_0x335a('0x21')](_0x4b7f8a,_0x275bf2,!![]);}catch(_0x37cdd3){return BPromise[_0x335a('0x22')](_0x37cdd3);}return _0x4b7f8a[_0x335a('0x23')]();};}function saveUpdates(_0x4ccf05,_0x307383){return function(_0x3dbc0e){if(_0x3dbc0e){return _0x3dbc0e[_0x335a('0x24')](_0x4ccf05)[_0x335a('0x25')](function(_0x320684){return _0x320684;});}return null;};}function removeEntity(_0x3c71a3,_0x4fe7bb){return function(_0x5b9b51){if(_0x5b9b51){return _0x5b9b51['destroy']()[_0x335a('0x25')](function(){var _0x2541f3=_0x5b9b51[_0x335a('0x26')]({'plain':!![]});var _0x41dd53=_0x335a('0x27');return db[_0x335a('0x28')][_0x335a('0x29')]({'where':{'type':_0x41dd53,'resourceId':_0x2541f3['id']}})[_0x335a('0x25')](function(){return _0x5b9b51;});})[_0x335a('0x25')](function(){_0x3c71a3[_0x335a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552f97,_0x483809){return function(_0x579563){if(!_0x579563){_0x552f97[_0x335a('0x19')](0x194);}return _0x579563;};}function handleError(_0x306247,_0x41a306){_0x41a306=_0x41a306||0x1f4;return function(_0x34c6ae){logger[_0x335a('0x2a')](_0x34c6ae[_0x335a('0x2b')]);if(_0x34c6ae[_0x335a('0x2c')]){delete _0x34c6ae[_0x335a('0x2c')];}_0x306247[_0x335a('0x1a')](_0x41a306)[_0x335a('0x2d')](_0x34c6ae);};}exports[_0x335a('0x2e')]=function(_0x3b8b63,_0xe03998){var _0x3a14b6={},_0x46283a={},_0xcd7431={'count':0x0,'rows':[]};var _0x30f299=_[_0x335a('0x2f')](db[_0x335a('0x30')][_0x335a('0x31')],function(_0x2d8c12){return{'name':_0x2d8c12[_0x335a('0x32')],'type':_0x2d8c12[_0x335a('0x33')][_0x335a('0x34')]};});_0x46283a[_0x335a('0x35')]=_[_0x335a('0x2f')](_0x30f299,_0x335a('0x2c'));_0x46283a[_0x335a('0x36')]=_['keys'](_0x3b8b63['query']);_0x46283a['filters']=_[_0x335a('0x37')](_0x46283a[_0x335a('0x35')],_0x46283a['query']);_0x3a14b6[_0x335a('0x38')]=_[_0x335a('0x37')](_0x46283a[_0x335a('0x35')],qs[_0x335a('0x39')](_0x3b8b63[_0x335a('0x36')][_0x335a('0x39')]));_0x3a14b6[_0x335a('0x38')]=_0x3a14b6[_0x335a('0x38')][_0x335a('0x3a')]?_0x3a14b6[_0x335a('0x38')]:_0x46283a[_0x335a('0x35')];if(!_0x3b8b63[_0x335a('0x36')][_0x335a('0x3b')](_0x335a('0x3c'))){_0x3a14b6[_0x335a('0x3d')]=qs[_0x335a('0x3d')](_0x3b8b63[_0x335a('0x36')][_0x335a('0x3d')]);_0x3a14b6[_0x335a('0x1e')]=qs['offset'](_0x3b8b63[_0x335a('0x36')][_0x335a('0x1e')]);}_0x3a14b6['order']=qs['sort'](_0x3b8b63['query'][_0x335a('0x3e')]);_0x3a14b6['where']=qs['filters'](_[_0x335a('0x3f')](_0x3b8b63[_0x335a('0x36')],_0x46283a[_0x335a('0x40')]),_0x30f299);if(_0x3b8b63[_0x335a('0x36')][_0x335a('0x41')]){_0x3a14b6['where']=_['merge'](_0x3a14b6['where'],{'$or':_[_0x335a('0x2f')](_0x30f299,function(_0x2db515){if(_0x2db515['type']!==_0x335a('0x42')){var _0x4d59c5={};_0x4d59c5[_0x2db515['name']]={'$like':'%'+_0x3b8b63[_0x335a('0x36')][_0x335a('0x41')]+'%'};return _0x4d59c5;}})});}_0x3a14b6=_['merge']({},_0x3a14b6,_0x3b8b63[_0x335a('0x43')]);var _0x133f82={'where':_0x3a14b6[_0x335a('0x44')]};return db[_0x335a('0x30')][_0x335a('0x1d')](_0x133f82)[_0x335a('0x25')](function(_0xbbaf17){_0xcd7431[_0x335a('0x1d')]=_0xbbaf17;if(_0x3b8b63[_0x335a('0x36')][_0x335a('0x45')]){_0x3a14b6[_0x335a('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0x335a('0x47')](_0x3a14b6);})[_0x335a('0x25')](function(_0x4ab1ff){_0xcd7431[_0x335a('0x48')]=_0x4ab1ff;return _0xcd7431;})[_0x335a('0x25')](respondWithFilteredResult(_0xe03998,_0x3a14b6))[_0x335a('0x49')](handleError(_0xe03998,null));};exports['show']=function(_0x58e093,_0x511c84){var _0x5ca758={'raw':![],'where':{'id':_0x58e093['params']['id']}},_0x1b713c={};_0x1b713c[_0x335a('0x35')]=_[_0x335a('0x4a')](db[_0x335a('0x30')]['rawAttributes']);_0x1b713c['query']=_[_0x335a('0x4a')](_0x58e093[_0x335a('0x36')]);_0x1b713c[_0x335a('0x40')]=_[_0x335a('0x37')](_0x1b713c['model'],_0x1b713c[_0x335a('0x36')]);_0x5ca758[_0x335a('0x38')]=_[_0x335a('0x37')](_0x1b713c['model'],qs[_0x335a('0x39')](_0x58e093['query'][_0x335a('0x39')]));_0x5ca758['attributes']=_0x5ca758[_0x335a('0x38')]['length']?_0x5ca758['attributes']:_0x1b713c[_0x335a('0x35')];if(_0x58e093[_0x335a('0x36')][_0x335a('0x45')]){_0x5ca758[_0x335a('0x46')]=[{'all':!![]}];}_0x5ca758=_['merge']({},_0x5ca758,_0x58e093[_0x335a('0x43')]);return db[_0x335a('0x30')][_0x335a('0x4b')](_0x5ca758)[_0x335a('0x25')](handleEntityNotFound(_0x511c84,null))[_0x335a('0x25')](respondWithResult(_0x511c84,null))[_0x335a('0x49')](handleError(_0x511c84,null));};exports[_0x335a('0x4c')]=function(_0x2f6ce7,_0x3ff261){return db[_0x335a('0x30')][_0x335a('0x4c')](_0x2f6ce7['body'],{})[_0x335a('0x25')](function(_0x466e1e){var _0x2961bf=_0x2f6ce7[_0x335a('0x4d')][_0x335a('0x26')]({'plain':!![]});if(!_0x2961bf)throw new Error(_0x335a('0x4e'));if(_0x2961bf['role']===_0x335a('0x4d')){var _0x410839=_0x466e1e[_0x335a('0x26')]({'plain':!![]});var _0x23158c='Projects';return db[_0x335a('0x4f')][_0x335a('0x4b')]({'where':{'name':_0x23158c,'userProfileId':_0x2961bf[_0x335a('0x50')]},'raw':!![]})[_0x335a('0x25')](function(_0x186f5a){if(_0x186f5a&&_0x186f5a[_0x335a('0x51')]===0x0){return db['UserProfileResource'][_0x335a('0x4c')]({'name':_0x410839['name'],'resourceId':_0x410839['id'],'type':_0x186f5a[_0x335a('0x2c')],'sectionId':_0x186f5a['id']},{})[_0x335a('0x25')](function(){return _0x466e1e;});}else{return _0x466e1e;}})[_0x335a('0x49')](function(_0x16bde5){logger['error'](_0x335a('0x52'),_0x16bde5);throw _0x16bde5;});}return _0x466e1e;})[_0x335a('0x25')](respondWithResult(_0x3ff261,0xc9))[_0x335a('0x49')](handleError(_0x3ff261,null));};exports[_0x335a('0x53')]=function(_0x2d5ae7,_0x4e3aa0){var _0x94fa19={'where':{'id':_0x2d5ae7['params']['id']}},_0x29224d={};_0x29224d[_0x335a('0x35')]=_['keys'](db[_0x335a('0x30')][_0x335a('0x31')]);_0x94fa19['attributes']=_[_0x335a('0x37')](_0x29224d[_0x335a('0x35')],qs[_0x335a('0x39')](_0x2d5ae7[_0x335a('0x36')][_0x335a('0x39')]));_0x94fa19['attributes']=_0x94fa19[_0x335a('0x38')][_0x335a('0x3a')]?_0x94fa19[_0x335a('0x38')]:_0x29224d[_0x335a('0x35')];if(_0x2d5ae7[_0x335a('0x36')][_0x335a('0x45')]){_0x94fa19[_0x335a('0x46')]=[{'all':!![]}];}_0x94fa19=_[_0x335a('0x54')]({},_0x94fa19,_0x2d5ae7[_0x335a('0x43')]);return db[_0x335a('0x30')][_0x335a('0x4b')](_0x94fa19)[_0x335a('0x25')](handleEntityNotFound(_0x4e3aa0,null))['then'](function(_0x186612){if(_0x186612){var _0x513636=_0x186612['get']({'plain':!![]});_0x513636=qs[_0x335a('0x55')](_0x513636,['id',_0x335a('0x56'),_0x335a('0x57')]);_0x2d5ae7[_0x335a('0x58')]=_[_0x335a('0x55')](_0x2d5ae7[_0x335a('0x58')],['id',_0x335a('0x56'),'updatedAt']);return db[_0x335a('0x30')]['create'](_[_0x335a('0x54')](_0x513636,_0x2d5ae7[_0x335a('0x58')]),{'include':_0x2d5ae7['query'][_0x335a('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x2dd94b){var _0x76b9de=_0x2d5ae7[_0x335a('0x4d')][_0x335a('0x26')]({'plain':!![]});if(!_0x76b9de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x76b9de[_0x335a('0x59')]===_0x335a('0x4d')){var _0xfd10a5=_0x2dd94b['get']({'plain':!![]});var _0x39b0c1='Projects';return db[_0x335a('0x4f')][_0x335a('0x4b')]({'where':{'name':_0x39b0c1,'userProfileId':_0x76b9de[_0x335a('0x50')]},'raw':!![]})[_0x335a('0x25')](function(_0x33a7b3){if(_0x33a7b3&&_0x33a7b3[_0x335a('0x51')]===0x0){return db[_0x335a('0x28')]['create']({'name':_0xfd10a5['name'],'resourceId':_0xfd10a5['id'],'type':_0x33a7b3[_0x335a('0x2c')],'sectionId':_0x33a7b3['id']},{})[_0x335a('0x25')](function(){return _0x2dd94b;});}else{return _0x2dd94b;}})[_0x335a('0x49')](function(_0x63d131){logger[_0x335a('0x2a')](_0x335a('0x52'),_0x63d131);throw _0x63d131;});}return _0x2dd94b;});}})[_0x335a('0x25')](respondWithResult(_0x4e3aa0,0xc9))[_0x335a('0x49')](handleError(_0x4e3aa0,null));};exports['update']=function(_0x5390d8,_0x486a72){if(_0x5390d8['body']['id']){delete _0x5390d8[_0x335a('0x58')]['id'];}return db[_0x335a('0x30')][_0x335a('0x4b')]({'where':{'id':_0x5390d8[_0x335a('0x5a')]['id']}})[_0x335a('0x25')](handleEntityNotFound(_0x486a72,null))['then'](saveUpdates(_0x5390d8[_0x335a('0x58')],null))['then'](respondWithResult(_0x486a72,null))[_0x335a('0x49')](handleError(_0x486a72,null));};exports[_0x335a('0x29')]=function(_0x48a651,_0x4d5b8c){return db[_0x335a('0x30')][_0x335a('0x4b')]({'where':{'id':_0x48a651[_0x335a('0x5a')]['id']}})[_0x335a('0x25')](handleEntityNotFound(_0x4d5b8c,null))[_0x335a('0x25')](removeEntity(_0x4d5b8c,null))[_0x335a('0x49')](handleError(_0x4d5b8c,null));};exports[_0x335a('0x5b')]=function(_0x41d49f,_0x4dcf08,_0x1df8d8){var _0x5ce260={'raw':!![],'where':{}};var _0x147dad={};var _0x211da6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x335a('0x5c')]({'where':{'id':_0x41d49f[_0x335a('0x5a')]['id']}})[_0x335a('0x25')](handleEntityNotFound(_0x4dcf08,null))['then'](function(_0xbe2ee4){if(_0xbe2ee4){_0x147dad[_0x335a('0x35')]=_[_0x335a('0x4a')](db[_0x335a('0x5d')][_0x335a('0x31')]);_0x147dad[_0x335a('0x36')]=_[_0x335a('0x4a')](_0x41d49f[_0x335a('0x36')]);_0x147dad[_0x335a('0x40')]=_[_0x335a('0x37')](_0x147dad[_0x335a('0x35')],_0x147dad[_0x335a('0x36')]);_0x5ce260[_0x335a('0x38')]=_[_0x335a('0x37')](_0x147dad[_0x335a('0x35')],qs[_0x335a('0x39')](_0x41d49f[_0x335a('0x36')][_0x335a('0x39')]));_0x5ce260[_0x335a('0x38')]=_0x5ce260[_0x335a('0x38')][_0x335a('0x3a')]?_0x5ce260[_0x335a('0x38')]:_0x147dad[_0x335a('0x35')];if(!_0x41d49f[_0x335a('0x36')][_0x335a('0x3b')](_0x335a('0x3c'))){_0x5ce260[_0x335a('0x3d')]=qs['limit'](_0x41d49f[_0x335a('0x36')]['limit']);_0x5ce260[_0x335a('0x1e')]=qs[_0x335a('0x1e')](_0x41d49f[_0x335a('0x36')]['offset']);}_0x5ce260[_0x335a('0x5e')]=qs[_0x335a('0x3e')](_0x41d49f[_0x335a('0x36')][_0x335a('0x3e')]);_0x5ce260[_0x335a('0x44')]=qs[_0x335a('0x40')](_[_0x335a('0x3f')](_0x41d49f['query'],_0x147dad[_0x335a('0x40')]));_0x5ce260['where'][_0x335a('0x5f')]=_0xbe2ee4['id'];if(_0x41d49f['query']['filter']){_0x5ce260[_0x335a('0x44')]=_[_0x335a('0x54')](_0x5ce260[_0x335a('0x44')],{'$or':_[_0x335a('0x2f')](_0x5ce260['attributes'],function(_0x4589bb){var _0x5f3320={};_0x5f3320[_0x4589bb]={'$like':'%'+_0x41d49f[_0x335a('0x36')][_0x335a('0x41')]+'%'};return _0x5f3320;})});}_0x5ce260=_['merge']({},_0x5ce260,_0x41d49f[_0x335a('0x43')]);return db[_0x335a('0x5d')][_0x335a('0x1d')]({'where':_0x5ce260[_0x335a('0x44')]})[_0x335a('0x25')](function(_0x1e1d0f){_0x211da6[_0x335a('0x1d')]=_0x1e1d0f;if(_0x41d49f[_0x335a('0x36')]['includeAll']){_0x5ce260[_0x335a('0x46')]=[{'all':!![]}];}return db[_0x335a('0x5d')][_0x335a('0x47')](_0x5ce260);})[_0x335a('0x25')](function(_0x32a183){_0x211da6[_0x335a('0x48')]=_0x32a183;return _0x211da6;});}})[_0x335a('0x25')](respondWithFilteredResult(_0x4dcf08,_0x5ce260))['catch'](handleError(_0x4dcf08,null));};exports['getAnswers']=function(_0x1d54e1,_0x516e32,_0x2af2ed){var _0x9676a7={'raw':!![],'where':{}};var _0x41ce25={};var _0x37ee79={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x335a('0x5c')]({'where':{'id':_0x1d54e1[_0x335a('0x5a')]['id']}})[_0x335a('0x25')](handleEntityNotFound(_0x516e32,null))['then'](function(_0x499096){if(_0x499096){_0x41ce25[_0x335a('0x35')]=_['keys'](db[_0x335a('0x60')]['rawAttributes']);_0x41ce25[_0x335a('0x36')]=_[_0x335a('0x4a')](_0x1d54e1[_0x335a('0x36')]);_0x41ce25[_0x335a('0x40')]=_[_0x335a('0x37')](_0x41ce25['model'],_0x41ce25[_0x335a('0x36')]);_0x9676a7['attributes']=_[_0x335a('0x37')](_0x41ce25[_0x335a('0x35')],qs[_0x335a('0x39')](_0x1d54e1[_0x335a('0x36')][_0x335a('0x39')]));_0x9676a7['attributes']=_0x9676a7[_0x335a('0x38')][_0x335a('0x3a')]?_0x9676a7[_0x335a('0x38')]:_0x41ce25[_0x335a('0x35')];if(!_0x1d54e1['query'][_0x335a('0x3b')]('nolimit')){_0x9676a7[_0x335a('0x3d')]=qs[_0x335a('0x3d')](_0x1d54e1['query'][_0x335a('0x3d')]);_0x9676a7[_0x335a('0x1e')]=qs['offset'](_0x1d54e1['query'][_0x335a('0x1e')]);}_0x9676a7['order']=qs[_0x335a('0x3e')](_0x1d54e1['query'][_0x335a('0x3e')]);_0x9676a7[_0x335a('0x44')]=qs[_0x335a('0x40')](_[_0x335a('0x3f')](_0x1d54e1['query'],_0x41ce25[_0x335a('0x40')]));_0x9676a7['where'][_0x335a('0x5f')]=_0x499096['id'];if(_0x1d54e1[_0x335a('0x36')][_0x335a('0x41')]){_0x9676a7['where']=_[_0x335a('0x54')](_0x9676a7[_0x335a('0x44')],{'$or':_['map'](_0x9676a7[_0x335a('0x38')],function(_0xf08c26){var _0x2e7008={};_0x2e7008[_0xf08c26]={'$like':'%'+_0x1d54e1[_0x335a('0x36')]['filter']+'%'};return _0x2e7008;})});}_0x9676a7=_['merge']({},_0x9676a7,_0x1d54e1[_0x335a('0x43')]);return db[_0x335a('0x60')][_0x335a('0x1d')]({'where':_0x9676a7[_0x335a('0x44')]})[_0x335a('0x25')](function(_0x34a2ed){_0x37ee79['count']=_0x34a2ed;if(_0x1d54e1[_0x335a('0x36')][_0x335a('0x45')]){_0x9676a7[_0x335a('0x46')]=[{'all':!![]}];}return db[_0x335a('0x60')][_0x335a('0x47')](_0x9676a7);})[_0x335a('0x25')](function(_0x42a2f3){_0x37ee79[_0x335a('0x48')]=_0x42a2f3;return _0x37ee79;});}})['then'](respondWithFilteredResult(_0x516e32,_0x9676a7))[_0x335a('0x49')](handleError(_0x516e32,null));};function char(_0x304fcc){return _0x335a('0x61')===typeof _0x304fcc?String[_0x335a('0x62')][_0x335a('0x21')](null,arguments):_0x304fcc;}function needsEncapsulation(_0x61549c){return!!_0x61549c&&(_0x61549c[_0x335a('0x63')]()[_0x335a('0x64')](char(0xd))>=0x0||_0x61549c[_0x335a('0x63')]()[_0x335a('0x64')](char(0xa))>=0x0||_0x61549c['toString']()[_0x335a('0x64')](char(0x2c))>=0x0||_0x61549c[_0x335a('0x63')]()[_0x335a('0x64')](char(0x22))>=0x0);}function encapsulate(_0x216684){var _0x4e381c=char(0x22),_0x22e205='\x5c'+char(0x22),_0x211ada=_0x216684[_0x335a('0x63')]()[_0x335a('0x65')](new RegExp(_0x4e381c,'g'),_0x22e205);return _0x4e381c+_0x211ada+_0x4e381c;}exports[_0x335a('0x66')]=function(_0x1e1238,_0x3b726b,_0xa26c8e){var _0x5b2acc,_0x51c2c8;var _0x57223f={'where':{'ProjectId':_0x1e1238[_0x335a('0x5a')]['id']}};if(_0x1e1238[_0x335a('0x36')]['startTime']){_0x57223f[_0x335a('0x44')]['starttime']=JSON[_0x335a('0x67')](_0x1e1238[_0x335a('0x36')][_0x335a('0x68')]);}return db[_0x335a('0x5d')][_0x335a('0x47')](_0x57223f)[_0x335a('0x25')](handleEntityNotFound(_0x3b726b,null))[_0x335a('0x25')](function(_0x5ee367){if(_0x5ee367){_0x5b2acc=_0x5ee367;return db[_0x335a('0x69')]['findAll']({'where':{'SessionId':{'$in':_[_0x335a('0x2f')](_0x5b2acc,'id')},'ProjectId':_0x1e1238[_0x335a('0x5a')]['id']},'order':_0x335a('0x6a')});}})['then'](handleEntityNotFound(_0x3b726b,null))[_0x335a('0x25')](function(_0x3a0a99){if(_0x3a0a99){_0x51c2c8=_0x3a0a99;var _0x2e3b3d={};for(var _0x8af74a=0x0,_0x205cbe=_0x51c2c8['length'];_0x8af74a<_0x205cbe;_0x8af74a++){if(!_0x2e3b3d[_0x335a('0x3b')](_0x51c2c8[_0x8af74a]['questionId'])){_0x2e3b3d[_0x51c2c8[_0x8af74a][_0x335a('0x6b')]]=needsEncapsulation(_0x51c2c8[_0x8af74a]['question'])?encapsulate(_0x51c2c8[_0x8af74a]['question']):_0x51c2c8[_0x8af74a][_0x335a('0x6c')];}}var _0x1b9802=[],_0x360cf7={};for(var _0x5a8cc8=0x0,_0x42bad9=_0x5b2acc[_0x335a('0x3a')];_0x5a8cc8<_0x42bad9;_0x5a8cc8++){_0x360cf7={'ProjectId':_0x1e1238['params']['id'],'SessionId':_0x5b2acc[_0x5a8cc8]['id'],'StartTime':moment(_0x5b2acc[_0x5a8cc8][_0x335a('0x6d')])[_0x335a('0x6e')](_0x335a('0x6f'))};for(var _0x2c0c2e=0x0,_0x1f08e2=_0x51c2c8[_0x335a('0x3a')];_0x2c0c2e<_0x1f08e2;_0x2c0c2e++){if(_0x51c2c8[_0x2c0c2e][_0x335a('0x70')]==_0x5b2acc[_0x5a8cc8]['id']&&_0x2e3b3d[_0x335a('0x3b')](_0x51c2c8[_0x2c0c2e][_0x335a('0x6b')])){_0x360cf7[_0x2e3b3d[_0x51c2c8[_0x2c0c2e]['questionId']]]=_0x51c2c8[_0x2c0c2e][_0x335a('0x71')];}}for(var _0x3f38aa in _0x2e3b3d){if(!_0x360cf7[_0x335a('0x3b')](_0x2e3b3d[_0x3f38aa])){_0x360cf7[_0x2e3b3d[_0x3f38aa]]=null;}}_0x1b9802[_0x335a('0x72')](_0x360cf7);}return _0x1b9802;}})['then'](function(_0x4bf546){if(!_[_0x335a('0x73')](_0x4bf546)){var _0x107d74=toCsv(_0x4bf546);var _0x53cdd7=Date['now']();fs[_0x335a('0x74')](util[_0x335a('0x6e')](_0x335a('0x75'),_0x1e1238['params']['id'],_0x53cdd7),_0x107d74);_0x3b726b[_0x335a('0x76')](_0x335a('0x77'),'attachment;\x20filename='+util[_0x335a('0x6e')](_0x335a('0x78'),_0x1e1238[_0x335a('0x5a')]['id'],_0x53cdd7));_0x3b726b['setHeader'](_0x335a('0x79'),'text/csv');return _0x3b726b['download'](util[_0x335a('0x6e')](_0x335a('0x75'),_0x1e1238[_0x335a('0x5a')]['id'],_0x53cdd7));}else{return _0x3b726b['sendStatus'](0xcc);}})['catch'](handleError(_0x3b726b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c487b79..e9f7726 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 _0xf04f=['path','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','util','../../config/logger','api','bluebird','request-promise'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xf04f,0x119));var _0xff04=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf04f[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require(_0xff04('0x0'));var logger=require(_0xff04('0x1'))(_0xff04('0x2'));var moment=require('moment');var BPromise=require(_0xff04('0x3'));var rp=require(_0xff04('0x4'));var fs=require('fs');var path=require(_0xff04('0x5'));var rimraf=require('rimraf');var config=require(_0xff04('0x6'));var attributes=require(_0xff04('0x7'));module[_0xff04('0x8')]=function(_0x1f6526,_0x181535){return _0x1f6526[_0xff04('0x9')]('JscriptyProject',attributes,{'tableName':_0xff04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1911=['moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','util','../../config/logger'];(function(_0x47f94a,_0x44a09d){var _0x4a03ed=function(_0x54b5f9){while(--_0x54b5f9){_0x47f94a['push'](_0x47f94a['shift']());}};_0x4a03ed(++_0x44a09d);}(_0x1911,0x195));var _0x1191=function(_0x45fdcc,_0x40572f){_0x45fdcc=_0x45fdcc-0x0;var _0xfe8141=_0x1911[_0x45fdcc];return _0xfe8141;};'use strict';var _=require('lodash');var util=require(_0x1191('0x0'));var logger=require(_0x1191('0x1'))('api');var moment=require(_0x1191('0x2'));var BPromise=require(_0x1191('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1191('0x4'));var rimraf=require(_0x1191('0x5'));var config=require(_0x1191('0x6'));var attributes=require(_0x1191('0x7'));module[_0x1191('0x8')]=function(_0x2b8c79,_0x2a09b3){return _0x2b8c79[_0x1191('0x9')]('JscriptyProject',attributes,{'tableName':_0x1191('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index d450562..ce93753 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 _0x231c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','ioredis'];(function(_0x31aaeb,_0x6194ef){var _0x2e97da=function(_0x17b1bd){while(--_0x17b1bd){_0x31aaeb['push'](_0x31aaeb['shift']());}};_0x2e97da(++_0x6194ef);}(_0x231c,0x1c5));var _0xc231=function(_0xe39c75,_0x35e363){_0xe39c75=_0xe39c75-0x0;var _0x56f9cd=_0x231c[_0xe39c75];return _0x56f9cd;};'use strict';var _=require(_0xc231('0x0'));var util=require(_0xc231('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc231('0x2'));var db=require(_0xc231('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc231('0x4'))(_0xc231('0x5'));var config=require(_0xc231('0x6'));var jayson=require(_0xc231('0x7'));var client=jayson[_0xc231('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ab3dd,_0x2b68a4,_0x19b2e8){return new BPromise(function(_0x3e861a,_0x999ceb){return client['request'](_0x4ab3dd,_0x19b2e8)[_0xc231('0x9')](function(_0x4c3e32){logger[_0xc231('0xa')](_0xc231('0xb'),_0x2b68a4,'request\x20sent');logger[_0xc231('0xc')](_0xc231('0xd'),_0x2b68a4,_0xc231('0xe'),JSON['stringify'](_0x4c3e32));if(_0x4c3e32[_0xc231('0xf')]){if(_0x4c3e32[_0xc231('0xf')][_0xc231('0x10')]===0x1f4){logger[_0xc231('0xf')](_0xc231('0xb'),_0x2b68a4,_0x4c3e32[_0xc231('0xf')][_0xc231('0x11')]);return _0x999ceb(_0x4c3e32[_0xc231('0xf')][_0xc231('0x11')]);}logger[_0xc231('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2b68a4,_0x4c3e32[_0xc231('0xf')][_0xc231('0x11')]);return _0x3e861a(_0x4c3e32[_0xc231('0xf')][_0xc231('0x11')]);}else{logger[_0xc231('0xa')](_0xc231('0xb'),_0x2b68a4,_0xc231('0xe'));_0x3e861a(_0x4c3e32[_0xc231('0x12')][_0xc231('0x11')]);}})['catch'](function(_0x3b37fd){logger[_0xc231('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2b68a4,_0x3b37fd);_0x999ceb(_0x3b37fd);});});} \ No newline at end of file +var _0x3a48=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird'];(function(_0x3cf0f6,_0x3ff689){var _0x29e0be=function(_0x12dfb3){while(--_0x12dfb3){_0x3cf0f6['push'](_0x3cf0f6['shift']());}};_0x29e0be(++_0x3ff689);}(_0x3a48,0x95));var _0x83a4=function(_0x277bf2,_0xefafee){_0x277bf2=_0x277bf2-0x0;var _0x3e453e=_0x3a48[_0x277bf2];return _0x3e453e;};'use strict';var _=require(_0x83a4('0x0'));var util=require('util');var moment=require(_0x83a4('0x1'));var BPromise=require(_0x83a4('0x2'));var rs=require(_0x83a4('0x3'));var fs=require('fs');var Redis=require(_0x83a4('0x4'));var db=require(_0x83a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x83a4('0x6'));var jayson=require(_0x83a4('0x7'));var client=jayson[_0x83a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a88e2,_0x47a100,_0x74258c){return new BPromise(function(_0x2f4ce7,_0x34fb11){return client['request'](_0x3a88e2,_0x74258c)[_0x83a4('0x9')](function(_0x444de4){logger['info'](_0x83a4('0xa'),_0x47a100,_0x83a4('0xb'));logger[_0x83a4('0xc')](_0x83a4('0xd'),_0x47a100,_0x83a4('0xb'),JSON[_0x83a4('0xe')](_0x444de4));if(_0x444de4[_0x83a4('0xf')]){if(_0x444de4[_0x83a4('0xf')]['code']===0x1f4){logger[_0x83a4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x47a100,_0x444de4['error']['message']);return _0x34fb11(_0x444de4['error'][_0x83a4('0x10')]);}logger[_0x83a4('0xf')](_0x83a4('0xa'),_0x47a100,_0x444de4[_0x83a4('0xf')][_0x83a4('0x10')]);return _0x2f4ce7(_0x444de4[_0x83a4('0xf')][_0x83a4('0x10')]);}else{logger[_0x83a4('0x11')](_0x83a4('0xa'),_0x47a100,_0x83a4('0xb'));_0x2f4ce7(_0x444de4[_0x83a4('0x12')]['message']);}})['catch'](function(_0x5665d0){logger[_0x83a4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x47a100,_0x5665d0);_0x34fb11(_0x5665d0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 073b64b..80cf2d1 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 _0x28f2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x41b6d4,_0x34ff7a){var _0x3b0a5d=function(_0xd4b87e){while(--_0xd4b87e){_0x41b6d4['push'](_0x41b6d4['shift']());}};_0x3b0a5d(++_0x34ff7a);}(_0x28f2,0x193));var _0x228f=function(_0x47c612,_0x2d1009){_0x47c612=_0x47c612-0x0;var _0xa0e81b=_0x28f2[_0x47c612];return _0xa0e81b;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var auth=require(_0x228f('0x5'));var interaction=require(_0x228f('0x6'));var config=require(_0x228f('0x7'));var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth['isAuthenticated'](),controller[_0x228f('0xf')]);router['post']('/',auth[_0x228f('0xa')](),controller[_0x228f('0x10')]);router['put'](_0x228f('0xe'),auth[_0x228f('0xa')](),controller[_0x228f('0x11')]);router[_0x228f('0x12')](_0x228f('0xe'),auth['isAuthenticated'](),controller[_0x228f('0x13')]);module[_0x228f('0x14')]=router; \ No newline at end of file +var _0x2080=['describe','/:id','show','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x4dde73,_0x131b0c){var _0x57aa74=function(_0x4f87aa){while(--_0x4f87aa){_0x4dde73['push'](_0x4dde73['shift']());}};_0x57aa74(++_0x131b0c);}(_0x2080,0x19f));var _0x0208=function(_0x2165a9,_0x25d22e){_0x2165a9=_0x2165a9-0x0;var _0xc29206=_0x2080[_0x2165a9];return _0xc29206;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0208('0x0'));var timeout=require(_0x0208('0x1'));var express=require(_0x0208('0x2'));var router=express[_0x0208('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0208('0x4'));var config=require(_0x0208('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x0208('0x6')]('/',auth[_0x0208('0x7')](),controller[_0x0208('0x8')]);router[_0x0208('0x6')](_0x0208('0x9'),auth['isAuthenticated'](),controller[_0x0208('0xa')]);router[_0x0208('0x6')](_0x0208('0xb'),auth[_0x0208('0x7')](),controller[_0x0208('0xc')]);router['post']('/',auth[_0x0208('0x7')](),controller['create']);router[_0x0208('0xd')](_0x0208('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0208('0xe')](_0x0208('0xb'),auth[_0x0208('0x7')](),controller[_0x0208('0xf')]);module[_0x0208('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b38c49b..e82c463 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 _0xccde=['STRING','sequelize','TEXT','long'];(function(_0x399c3a,_0x259362){var _0x4113f3=function(_0x7a442b){while(--_0x7a442b){_0x399c3a['push'](_0x399c3a['shift']());}};_0x4113f3(++_0x259362);}(_0xccde,0x1e1));var _0xeccd=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xccde[_0x2405bc];return _0x5272d4;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'question':{'type':Sequelize[_0xeccd('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xeccd('0x2'))},'membername':{'type':Sequelize[_0xeccd('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xeccd('0x3')]},'calleridname':{'type':Sequelize[_0xeccd('0x3')]},'calleridnum':{'type':Sequelize[_0xeccd('0x3')]},'questionId':{'type':Sequelize[_0xeccd('0x3')]}}; \ No newline at end of file +var _0x131e=['TEXT','long','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x131e,0x1ec));var _0xe131=function(_0x29a09e,_0x2cb3cd){_0x29a09e=_0x29a09e-0x0;var _0x4f5b40=_0x131e[_0x29a09e];return _0x4f5b40;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0xe131('0x0')](_0xe131('0x1'))},'membername':{'type':Sequelize[_0xe131('0x2')]},'projectname':{'type':Sequelize[_0xe131('0x2')]},'queue':{'type':Sequelize[_0xe131('0x2')]},'uniqueid':{'type':Sequelize[_0xe131('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe131('0x2')]},'questionId':{'type':Sequelize[_0xe131('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index f0041b6..4ec6476 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 _0x9182=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','count','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xd2884b,_0x5f1e57){var _0x3c8a14=function(_0x644316){while(--_0x644316){_0xd2884b['push'](_0xd2884b['shift']());}};_0x3c8a14(++_0x5f1e57);}(_0x9182,0x109));var _0x2918=function(_0x34d18c,_0x495720){_0x34d18c=_0x34d18c-0x0;var _0x88f134=_0x9182[_0x34d18c];return _0x88f134;};'use strict';var pdf=require(_0x2918('0x0'));var emlformat=require(_0x2918('0x1'));var rimraf=require(_0x2918('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2918('0x3'));var rp=require('request-promise');var moment=require(_0x2918('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2918('0x5'));var util=require(_0x2918('0x6'));var path=require(_0x2918('0x7'));var sox=require(_0x2918('0x8'));var csv=require(_0x2918('0x9'));var ejs=require(_0x2918('0xa'));var fs=require('fs');var _=require(_0x2918('0xb'));var squel=require(_0x2918('0xc'));var crypto=require(_0x2918('0xd'));var jsforce=require(_0x2918('0xe'));var deskjs=require(_0x2918('0xf'));var toCsv=require(_0x2918('0x9'));var querystring=require('querystring');var Papa=require(_0x2918('0x10'));var Redis=require('ioredis');var authService=require(_0x2918('0x11'));var qs=require(_0x2918('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2918('0x13'));var logger=require(_0x2918('0x14'))(_0x2918('0x15'));var utils=require(_0x2918('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2918('0x17'));var db=require(_0x2918('0x18'))['db'];function respondWithStatusCode(_0x20d3b6,_0x767b9b){_0x767b9b=_0x767b9b||0xcc;return function(_0x1c12b7){if(_0x1c12b7){return _0x20d3b6[_0x2918('0x19')](_0x767b9b);}return _0x20d3b6[_0x2918('0x1a')](_0x767b9b)[_0x2918('0x1b')]();};}function respondWithResult(_0x38ceb1,_0x2631be){_0x2631be=_0x2631be||0xc8;return function(_0x3a590b){if(_0x3a590b){return _0x38ceb1[_0x2918('0x1a')](_0x2631be)['json'](_0x3a590b);}};}function respondWithFilteredResult(_0x2da44e,_0x2d219c){return function(_0x34389b){if(_0x34389b){var _0x3bf052=_0x34389b['count'],_0x48ba1c=_0x2d219c[_0x2918('0x1c')],_0x1f1c90=_0x2d219c[_0x2918('0x1c')]+_0x2d219c[_0x2918('0x1d')],_0x3f19f1;if(_0x1f1c90>=_0x3bf052){_0x1f1c90=_0x3bf052;_0x3f19f1=0xc8;}else{_0x3f19f1=0xce;}_0x2da44e[_0x2918('0x1a')](_0x3f19f1);return _0x2da44e['set'](_0x2918('0x1e'),_0x48ba1c+'-'+_0x1f1c90+'/'+_0x3bf052)['json'](_0x34389b);}return null;};}function patchUpdates(_0x13b94e){return function(_0x31050e){try{jsonpatch[_0x2918('0x1f')](_0x31050e,_0x13b94e,!![]);}catch(_0x444f77){return BPromise['reject'](_0x444f77);}return _0x31050e['save']();};}function saveUpdates(_0x2e1e34,_0x33f45a){return function(_0x56af16){if(_0x56af16){return _0x56af16[_0x2918('0x20')](_0x2e1e34)[_0x2918('0x21')](function(_0x1aca35){return _0x1aca35;});}return null;};}function removeEntity(_0x2e568d,_0x5c5681){return function(_0x5ccbea){if(_0x5ccbea){return _0x5ccbea[_0x2918('0x22')]()[_0x2918('0x21')](function(){_0x2e568d[_0x2918('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ef77,_0x1da884){return function(_0x2b652c){if(!_0x2b652c){_0x34ef77[_0x2918('0x19')](0x194);}return _0x2b652c;};}function handleError(_0x3e5a4e,_0x4cf196){_0x4cf196=_0x4cf196||0x1f4;return function(_0x3c7244){logger['error'](_0x3c7244[_0x2918('0x23')]);if(_0x3c7244[_0x2918('0x24')]){delete _0x3c7244['name'];}_0x3e5a4e[_0x2918('0x1a')](_0x4cf196)[_0x2918('0x25')](_0x3c7244);};}exports[_0x2918('0x26')]=function(_0x5e9c65,_0x12289a){var _0x3b2f80={},_0xc1f258={},_0x4559eb={'count':0x0,'rows':[]};var _0x507513=_[_0x2918('0x27')](db[_0x2918('0x28')][_0x2918('0x29')],function(_0x36804f){return{'name':_0x36804f[_0x2918('0x2a')],'type':_0x36804f[_0x2918('0x2b')][_0x2918('0x2c')]};});_0xc1f258[_0x2918('0x2d')]=_[_0x2918('0x27')](_0x507513,_0x2918('0x24'));_0xc1f258[_0x2918('0x2e')]=_[_0x2918('0x2f')](_0x5e9c65[_0x2918('0x2e')]);_0xc1f258['filters']=_[_0x2918('0x30')](_0xc1f258[_0x2918('0x2d')],_0xc1f258[_0x2918('0x2e')]);_0x3b2f80[_0x2918('0x31')]=_['intersection'](_0xc1f258[_0x2918('0x2d')],qs[_0x2918('0x32')](_0x5e9c65['query'][_0x2918('0x32')]));_0x3b2f80['attributes']=_0x3b2f80['attributes']['length']?_0x3b2f80[_0x2918('0x31')]:_0xc1f258[_0x2918('0x2d')];if(!_0x5e9c65[_0x2918('0x2e')]['hasOwnProperty'](_0x2918('0x33'))){_0x3b2f80[_0x2918('0x1d')]=qs[_0x2918('0x1d')](_0x5e9c65[_0x2918('0x2e')][_0x2918('0x1d')]);_0x3b2f80['offset']=qs[_0x2918('0x1c')](_0x5e9c65[_0x2918('0x2e')][_0x2918('0x1c')]);}_0x3b2f80[_0x2918('0x34')]=qs[_0x2918('0x35')](_0x5e9c65[_0x2918('0x2e')][_0x2918('0x35')]);_0x3b2f80['where']=qs[_0x2918('0x36')](_[_0x2918('0x37')](_0x5e9c65[_0x2918('0x2e')],_0xc1f258['filters']),_0x507513);if(_0x5e9c65[_0x2918('0x2e')][_0x2918('0x38')]){_0x3b2f80[_0x2918('0x39')]=_[_0x2918('0x3a')](_0x3b2f80[_0x2918('0x39')],{'$or':_[_0x2918('0x27')](_0x507513,function(_0xce7f7b){if(_0xce7f7b[_0x2918('0x2b')]!=='VIRTUAL'){var _0xa8ae0b={};_0xa8ae0b[_0xce7f7b[_0x2918('0x24')]]={'$like':'%'+_0x5e9c65['query'][_0x2918('0x38')]+'%'};return _0xa8ae0b;}})});}_0x3b2f80=_[_0x2918('0x3a')]({},_0x3b2f80,_0x5e9c65['options']);var _0xbb1d8={'where':_0x3b2f80[_0x2918('0x39')]};return db[_0x2918('0x28')][_0x2918('0x3b')](_0xbb1d8)[_0x2918('0x21')](function(_0x2d3031){_0x4559eb[_0x2918('0x3b')]=_0x2d3031;if(_0x5e9c65[_0x2918('0x2e')][_0x2918('0x3c')]){_0x3b2f80['include']=[{'all':!![]}];}return db[_0x2918('0x28')][_0x2918('0x3d')](_0x3b2f80);})[_0x2918('0x21')](function(_0x54ce70){_0x4559eb[_0x2918('0x3e')]=_0x54ce70;return _0x4559eb;})[_0x2918('0x21')](respondWithFilteredResult(_0x12289a,_0x3b2f80))[_0x2918('0x3f')](handleError(_0x12289a,null));};exports[_0x2918('0x40')]=function(_0x58c7b5,_0x56c815){var _0x4f4ad8={'raw':!![],'where':{'id':_0x58c7b5[_0x2918('0x41')]['id']}},_0x3d6744={};_0x3d6744[_0x2918('0x2d')]=_[_0x2918('0x2f')](db[_0x2918('0x28')]['rawAttributes']);_0x3d6744[_0x2918('0x2e')]=_[_0x2918('0x2f')](_0x58c7b5[_0x2918('0x2e')]);_0x3d6744['filters']=_[_0x2918('0x30')](_0x3d6744[_0x2918('0x2d')],_0x3d6744[_0x2918('0x2e')]);_0x4f4ad8[_0x2918('0x31')]=_[_0x2918('0x30')](_0x3d6744[_0x2918('0x2d')],qs[_0x2918('0x32')](_0x58c7b5['query'][_0x2918('0x32')]));_0x4f4ad8[_0x2918('0x31')]=_0x4f4ad8[_0x2918('0x31')][_0x2918('0x42')]?_0x4f4ad8[_0x2918('0x31')]:_0x3d6744[_0x2918('0x2d')];if(_0x58c7b5[_0x2918('0x2e')][_0x2918('0x3c')]){_0x4f4ad8[_0x2918('0x43')]=[{'all':!![]}];}_0x4f4ad8=_[_0x2918('0x3a')]({},_0x4f4ad8,_0x58c7b5['options']);return db[_0x2918('0x28')][_0x2918('0x44')](_0x4f4ad8)['then'](handleEntityNotFound(_0x56c815,null))[_0x2918('0x21')](respondWithResult(_0x56c815,null))[_0x2918('0x3f')](handleError(_0x56c815,null));};exports[_0x2918('0x45')]=function(_0x4bdccb,_0x18536f){return db[_0x2918('0x28')][_0x2918('0x45')](_0x4bdccb['body'],{})['then'](respondWithResult(_0x18536f,0xc9))[_0x2918('0x3f')](handleError(_0x18536f,null));};exports[_0x2918('0x20')]=function(_0x2a9f43,_0x233770){if(_0x2a9f43['body']['id']){delete _0x2a9f43[_0x2918('0x46')]['id'];}return db[_0x2918('0x28')][_0x2918('0x44')]({'where':{'id':_0x2a9f43[_0x2918('0x41')]['id']}})[_0x2918('0x21')](handleEntityNotFound(_0x233770,null))[_0x2918('0x21')](saveUpdates(_0x2a9f43[_0x2918('0x46')],null))[_0x2918('0x21')](respondWithResult(_0x233770,null))[_0x2918('0x3f')](handleError(_0x233770,null));};exports[_0x2918('0x22')]=function(_0x485cee,_0x98181b){return db[_0x2918('0x28')][_0x2918('0x44')]({'where':{'id':_0x485cee['params']['id']}})[_0x2918('0x21')](handleEntityNotFound(_0x98181b,null))[_0x2918('0x21')](removeEntity(_0x98181b,null))[_0x2918('0x3f')](handleError(_0x98181b,null));};exports[_0x2918('0x47')]=function(_0x4965b7,_0x5c8709){return db[_0x2918('0x28')][_0x2918('0x47')]()[_0x2918('0x21')](respondWithResult(_0x5c8709,null))[_0x2918('0x3f')](handleError(_0x5c8709,null));}; \ No newline at end of file +var _0x7110=['name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack'];(function(_0x51090c,_0x2ed2b5){var _0x5e6f26=function(_0x3d0fb6){while(--_0x3d0fb6){_0x51090c['push'](_0x51090c['shift']());}};_0x5e6f26(++_0x2ed2b5);}(_0x7110,0xbe));var _0x0711=function(_0x23c315,_0x1be62f){_0x23c315=_0x23c315-0x0;var _0xf9ebf1=_0x7110[_0x23c315];return _0xf9ebf1;};'use strict';var pdf=require(_0x0711('0x0'));var emlformat=require(_0x0711('0x1'));var rimraf=require(_0x0711('0x2'));var zipdir=require(_0x0711('0x3'));var jsonpatch=require(_0x0711('0x4'));var rp=require(_0x0711('0x5'));var moment=require(_0x0711('0x6'));var BPromise=require(_0x0711('0x7'));var Mustache=require(_0x0711('0x8'));var util=require('util');var path=require(_0x0711('0x9'));var sox=require(_0x0711('0xa'));var csv=require('to-csv');var ejs=require(_0x0711('0xb'));var fs=require('fs');var _=require(_0x0711('0xc'));var squel=require(_0x0711('0xd'));var crypto=require('crypto');var jsforce=require(_0x0711('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0711('0xf'));var querystring=require(_0x0711('0x10'));var Papa=require(_0x0711('0x11'));var Redis=require(_0x0711('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0711('0x13'));var as=require(_0x0711('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0711('0x15'));var utils=require(_0x0711('0x16'));var config=require(_0x0711('0x17'));var licenseUtil=require(_0x0711('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x960d95,_0x4bd020){_0x4bd020=_0x4bd020||0xcc;return function(_0xab56e8){if(_0xab56e8){return _0x960d95['sendStatus'](_0x4bd020);}return _0x960d95[_0x0711('0x19')](_0x4bd020)[_0x0711('0x1a')]();};}function respondWithResult(_0x53c7e9,_0x572d43){_0x572d43=_0x572d43||0xc8;return function(_0x1c26b1){if(_0x1c26b1){return _0x53c7e9['status'](_0x572d43)['json'](_0x1c26b1);}};}function respondWithFilteredResult(_0x503b5a,_0x53e6cb){return function(_0x254f41){if(_0x254f41){var _0x415f40=_0x254f41[_0x0711('0x1b')],_0x56504b=_0x53e6cb[_0x0711('0x1c')],_0xbd915e=_0x53e6cb[_0x0711('0x1c')]+_0x53e6cb[_0x0711('0x1d')],_0x3d7841;if(_0xbd915e>=_0x415f40){_0xbd915e=_0x415f40;_0x3d7841=0xc8;}else{_0x3d7841=0xce;}_0x503b5a[_0x0711('0x19')](_0x3d7841);return _0x503b5a[_0x0711('0x1e')](_0x0711('0x1f'),_0x56504b+'-'+_0xbd915e+'/'+_0x415f40)['json'](_0x254f41);}return null;};}function patchUpdates(_0x203c9b){return function(_0x53effd){try{jsonpatch[_0x0711('0x20')](_0x53effd,_0x203c9b,!![]);}catch(_0x4095dd){return BPromise[_0x0711('0x21')](_0x4095dd);}return _0x53effd['save']();};}function saveUpdates(_0x30e519,_0x4c6c82){return function(_0x5570e1){if(_0x5570e1){return _0x5570e1['update'](_0x30e519)[_0x0711('0x22')](function(_0x4ffa4f){return _0x4ffa4f;});}return null;};}function removeEntity(_0x2a3164,_0x5571ab){return function(_0x194317){if(_0x194317){return _0x194317[_0x0711('0x23')]()[_0x0711('0x22')](function(){_0x2a3164[_0x0711('0x19')](0xcc)[_0x0711('0x1a')]();});}};}function handleEntityNotFound(_0x4cb740,_0xefda6){return function(_0x564795){if(!_0x564795){_0x4cb740['sendStatus'](0x194);}return _0x564795;};}function handleError(_0x4c014a,_0x2f67bd){_0x2f67bd=_0x2f67bd||0x1f4;return function(_0x4c4d5a){logger[_0x0711('0x24')](_0x4c4d5a[_0x0711('0x25')]);if(_0x4c4d5a[_0x0711('0x26')]){delete _0x4c4d5a[_0x0711('0x26')];}_0x4c014a['status'](_0x2f67bd)[_0x0711('0x27')](_0x4c4d5a);};}exports[_0x0711('0x28')]=function(_0x3d3eab,_0x325024){var _0x2c6841={},_0x5a4c11={},_0x364315={'count':0x0,'rows':[]};var _0x3b6d03=_[_0x0711('0x29')](db[_0x0711('0x2a')][_0x0711('0x2b')],function(_0x169fe1){return{'name':_0x169fe1['fieldName'],'type':_0x169fe1[_0x0711('0x2c')][_0x0711('0x2d')]};});_0x5a4c11[_0x0711('0x2e')]=_[_0x0711('0x29')](_0x3b6d03,_0x0711('0x26'));_0x5a4c11[_0x0711('0x2f')]=_[_0x0711('0x30')](_0x3d3eab['query']);_0x5a4c11[_0x0711('0x31')]=_[_0x0711('0x32')](_0x5a4c11[_0x0711('0x2e')],_0x5a4c11['query']);_0x2c6841[_0x0711('0x33')]=_['intersection'](_0x5a4c11[_0x0711('0x2e')],qs[_0x0711('0x34')](_0x3d3eab[_0x0711('0x2f')]['fields']));_0x2c6841['attributes']=_0x2c6841['attributes'][_0x0711('0x35')]?_0x2c6841[_0x0711('0x33')]:_0x5a4c11[_0x0711('0x2e')];if(!_0x3d3eab[_0x0711('0x2f')][_0x0711('0x36')](_0x0711('0x37'))){_0x2c6841[_0x0711('0x1d')]=qs[_0x0711('0x1d')](_0x3d3eab[_0x0711('0x2f')][_0x0711('0x1d')]);_0x2c6841['offset']=qs[_0x0711('0x1c')](_0x3d3eab[_0x0711('0x2f')][_0x0711('0x1c')]);}_0x2c6841[_0x0711('0x38')]=qs[_0x0711('0x39')](_0x3d3eab[_0x0711('0x2f')]['sort']);_0x2c6841[_0x0711('0x3a')]=qs[_0x0711('0x31')](_[_0x0711('0x3b')](_0x3d3eab[_0x0711('0x2f')],_0x5a4c11['filters']),_0x3b6d03);if(_0x3d3eab[_0x0711('0x2f')][_0x0711('0x3c')]){_0x2c6841['where']=_[_0x0711('0x3d')](_0x2c6841[_0x0711('0x3a')],{'$or':_[_0x0711('0x29')](_0x3b6d03,function(_0xb82351){if(_0xb82351[_0x0711('0x2c')]!==_0x0711('0x3e')){var _0x264c11={};_0x264c11[_0xb82351[_0x0711('0x26')]]={'$like':'%'+_0x3d3eab[_0x0711('0x2f')][_0x0711('0x3c')]+'%'};return _0x264c11;}})});}_0x2c6841=_['merge']({},_0x2c6841,_0x3d3eab[_0x0711('0x3f')]);var _0x3f3fa7={'where':_0x2c6841['where']};return db[_0x0711('0x2a')][_0x0711('0x1b')](_0x3f3fa7)[_0x0711('0x22')](function(_0x113a2d){_0x364315[_0x0711('0x1b')]=_0x113a2d;if(_0x3d3eab['query'][_0x0711('0x40')]){_0x2c6841[_0x0711('0x41')]=[{'all':!![]}];}return db[_0x0711('0x2a')][_0x0711('0x42')](_0x2c6841);})[_0x0711('0x22')](function(_0x1152eb){_0x364315[_0x0711('0x43')]=_0x1152eb;return _0x364315;})['then'](respondWithFilteredResult(_0x325024,_0x2c6841))['catch'](handleError(_0x325024,null));};exports[_0x0711('0x44')]=function(_0x5d4706,_0x527402){var _0x39e1dd={'raw':!![],'where':{'id':_0x5d4706[_0x0711('0x45')]['id']}},_0x3cb0c4={};_0x3cb0c4['model']=_[_0x0711('0x30')](db[_0x0711('0x2a')][_0x0711('0x2b')]);_0x3cb0c4[_0x0711('0x2f')]=_[_0x0711('0x30')](_0x5d4706['query']);_0x3cb0c4[_0x0711('0x31')]=_[_0x0711('0x32')](_0x3cb0c4['model'],_0x3cb0c4['query']);_0x39e1dd[_0x0711('0x33')]=_[_0x0711('0x32')](_0x3cb0c4[_0x0711('0x2e')],qs[_0x0711('0x34')](_0x5d4706[_0x0711('0x2f')][_0x0711('0x34')]));_0x39e1dd[_0x0711('0x33')]=_0x39e1dd[_0x0711('0x33')]['length']?_0x39e1dd[_0x0711('0x33')]:_0x3cb0c4['model'];if(_0x5d4706[_0x0711('0x2f')][_0x0711('0x40')]){_0x39e1dd[_0x0711('0x41')]=[{'all':!![]}];}_0x39e1dd=_[_0x0711('0x3d')]({},_0x39e1dd,_0x5d4706['options']);return db[_0x0711('0x2a')][_0x0711('0x46')](_0x39e1dd)[_0x0711('0x22')](handleEntityNotFound(_0x527402,null))['then'](respondWithResult(_0x527402,null))[_0x0711('0x47')](handleError(_0x527402,null));};exports[_0x0711('0x48')]=function(_0x373663,_0x112298){return db[_0x0711('0x2a')]['create'](_0x373663[_0x0711('0x49')],{})[_0x0711('0x22')](respondWithResult(_0x112298,0xc9))[_0x0711('0x47')](handleError(_0x112298,null));};exports[_0x0711('0x4a')]=function(_0x5a4d2c,_0x1bedc1){if(_0x5a4d2c['body']['id']){delete _0x5a4d2c['body']['id'];}return db['JscriptyQuestionReport'][_0x0711('0x46')]({'where':{'id':_0x5a4d2c['params']['id']}})[_0x0711('0x22')](handleEntityNotFound(_0x1bedc1,null))[_0x0711('0x22')](saveUpdates(_0x5a4d2c[_0x0711('0x49')],null))['then'](respondWithResult(_0x1bedc1,null))[_0x0711('0x47')](handleError(_0x1bedc1,null));};exports[_0x0711('0x23')]=function(_0x1ebe40,_0x257ed2){return db[_0x0711('0x2a')][_0x0711('0x46')]({'where':{'id':_0x1ebe40[_0x0711('0x45')]['id']}})[_0x0711('0x22')](handleEntityNotFound(_0x257ed2,null))[_0x0711('0x22')](removeEntity(_0x257ed2,null))['catch'](handleError(_0x257ed2,null));};exports['describe']=function(_0xa0b73c,_0x5d819b){return db[_0x0711('0x2a')][_0x0711('0x4b')]()['then'](respondWithResult(_0x5d819b,null))[_0x0711('0x47')](handleError(_0x5d819b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a789868..8ef3cad 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 _0x014d=['api','moment','request-promise','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x16ce7b,_0x5d6229){var _0x1db477=function(_0x41d79c){while(--_0x41d79c){_0x16ce7b['push'](_0x16ce7b['shift']());}};_0x1db477(++_0x5d6229);}(_0x014d,0x1a6));var _0xd014=function(_0x1bd1a0,_0x13a535){_0x1bd1a0=_0x1bd1a0-0x0;var _0x59d174=_0x014d[_0x1bd1a0];return _0x59d174;};'use strict';var _=require(_0xd014('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd014('0x1'));var moment=require(_0xd014('0x2'));var BPromise=require('bluebird');var rp=require(_0xd014('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd014('0x4'));module[_0xd014('0x5')]=function(_0x1bf79d,_0x45d84e){return _0x1bf79d[_0xd014('0x6')](_0xd014('0x7'),attributes,{'tableName':_0xd014('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b01=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2b01,0x119));var _0x12b0=function(_0x360a07,_0x21b50d){_0x360a07=_0x360a07-0x0;var _0x155a54=_0x2b01[_0x360a07];return _0x155a54;};'use strict';var _=require(_0x12b0('0x0'));var util=require(_0x12b0('0x1'));var logger=require('../../config/logger')(_0x12b0('0x2'));var moment=require('moment');var BPromise=require(_0x12b0('0x3'));var rp=require(_0x12b0('0x4'));var fs=require('fs');var path=require(_0x12b0('0x5'));var rimraf=require(_0x12b0('0x6'));var config=require(_0x12b0('0x7'));var attributes=require(_0x12b0('0x8'));module[_0x12b0('0x9')]=function(_0x49fdab,_0x2a9b5f){return _0x49fdab['define'](_0x12b0('0xa'),attributes,{'tableName':_0x12b0('0xb'),'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 467e6bf..90c56ba 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 _0x6302=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x4d6f88,_0x4de140){var _0x173f0c=function(_0x5dbdaa){while(--_0x5dbdaa){_0x4d6f88['push'](_0x4d6f88['shift']());}};_0x173f0c(++_0x4de140);}(_0x6302,0xf0));var _0x2630=function(_0x34cc63,_0x37a8a5){_0x34cc63=_0x34cc63-0x0;var _0x1afc03=_0x6302[_0x34cc63];return _0x1afc03;};'use strict';var _=require(_0x2630('0x0'));var util=require(_0x2630('0x1'));var moment=require(_0x2630('0x2'));var BPromise=require(_0x2630('0x3'));var rs=require(_0x2630('0x4'));var fs=require('fs');var Redis=require(_0x2630('0x5'));var db=require(_0x2630('0x6'))['db'];var utils=require(_0x2630('0x7'));var logger=require(_0x2630('0x8'))('rpc');var config=require(_0x2630('0x9'));var jayson=require(_0x2630('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c2ed0,_0x185a0f,_0xce1871){return new BPromise(function(_0x42989c,_0x5f4ecb){return client['request'](_0x2c2ed0,_0xce1871)[_0x2630('0xb')](function(_0x33fa93){logger['info'](_0x2630('0xc'),_0x185a0f,_0x2630('0xd'));logger[_0x2630('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x185a0f,_0x2630('0xd'),JSON[_0x2630('0xf')](_0x33fa93));if(_0x33fa93[_0x2630('0x10')]){if(_0x33fa93['error'][_0x2630('0x11')]===0x1f4){logger['error'](_0x2630('0xc'),_0x185a0f,_0x33fa93[_0x2630('0x10')][_0x2630('0x12')]);return _0x5f4ecb(_0x33fa93[_0x2630('0x10')][_0x2630('0x12')]);}logger[_0x2630('0x10')](_0x2630('0xc'),_0x185a0f,_0x33fa93['error'][_0x2630('0x12')]);return _0x42989c(_0x33fa93[_0x2630('0x10')][_0x2630('0x12')]);}else{logger[_0x2630('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x185a0f,_0x2630('0xd'));_0x42989c(_0x33fa93[_0x2630('0x14')][_0x2630('0x12')]);}})[_0x2630('0x15')](function(_0x10d481){logger[_0x2630('0x10')](_0x2630('0xc'),_0x185a0f,_0x10d481);_0x5f4ecb(_0x10d481);});});} \ No newline at end of file +var _0xf399=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x50c693,_0x58e18d){var _0x570ae1=function(_0x274a39){while(--_0x274a39){_0x50c693['push'](_0x50c693['shift']());}};_0x570ae1(++_0x58e18d);}(_0xf399,0xe6));var _0x9f39=function(_0x23de9b,_0x35dc0b){_0x23de9b=_0x23de9b-0x0;var _0x5a36e2=_0xf399[_0x23de9b];return _0x5a36e2;};'use strict';var _=require(_0x9f39('0x0'));var util=require(_0x9f39('0x1'));var moment=require(_0x9f39('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f39('0x4'))['db'];var utils=require(_0x9f39('0x5'));var logger=require(_0x9f39('0x6'))(_0x9f39('0x7'));var config=require(_0x9f39('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a3fa,_0x4afaef,_0x565397){return new BPromise(function(_0x2ccc26,_0x43d57a){return client[_0x9f39('0xa')](_0x11a3fa,_0x565397)['then'](function(_0x69c5d7){logger[_0x9f39('0xb')](_0x9f39('0xc'),_0x4afaef,_0x9f39('0xd'));logger[_0x9f39('0xe')](_0x9f39('0xf'),_0x4afaef,_0x9f39('0xd'),JSON[_0x9f39('0x10')](_0x69c5d7));if(_0x69c5d7['error']){if(_0x69c5d7['error'][_0x9f39('0x11')]===0x1f4){logger[_0x9f39('0x12')](_0x9f39('0xc'),_0x4afaef,_0x69c5d7[_0x9f39('0x12')][_0x9f39('0x13')]);return _0x43d57a(_0x69c5d7[_0x9f39('0x12')][_0x9f39('0x13')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4afaef,_0x69c5d7['error'][_0x9f39('0x13')]);return _0x2ccc26(_0x69c5d7[_0x9f39('0x12')]['message']);}else{logger[_0x9f39('0xb')](_0x9f39('0xc'),_0x4afaef,_0x9f39('0xd'));_0x2ccc26(_0x69c5d7[_0x9f39('0x14')][_0x9f39('0x13')]);}})[_0x9f39('0x15')](function(_0x4928a0){logger[_0x9f39('0x12')](_0x9f39('0xc'),_0x4afaef,_0x4928a0);_0x43d57a(_0x4928a0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 45618f5..31d8900 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 _0xa630=['multer','util','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','delete','destroy'];(function(_0x55c433,_0x344d3f){var _0xef64ee=function(_0x98918b){while(--_0x98918b){_0x55c433['push'](_0x55c433['shift']());}};_0xef64ee(++_0x344d3f);}(_0xa630,0xbe));var _0x0a63=function(_0x8e0243,_0x52c38a){_0x8e0243=_0x8e0243-0x0;var _0x32ee55=_0xa630[_0x8e0243];return _0x32ee55;};'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('0x6')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller['show']);router[_0x0a63('0x6')](_0x0a63('0xc'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);router[_0x0a63('0x10')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller['update']);router[_0x0a63('0x11')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5c12=['./jscriptySessionReport.controller','get','index','/describe','/:id','isAuthenticated','show','getQuestions','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bb3fd,_0x8fde58){var _0x34ed7e=function(_0x6677bb){while(--_0x6677bb){_0x3bb3fd['push'](_0x3bb3fd['shift']());}};_0x34ed7e(++_0x8fde58);}(_0x5c12,0x188));var _0x25c1=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x5c12[_0x996bc8];return _0x20b0ea;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x25c1('0x8')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0x8')]('/:id/questions',auth[_0x25c1('0xc')](),controller[_0x25c1('0xe')]);router[_0x25c1('0xf')]('/',auth[_0x25c1('0xc')](),controller[_0x25c1('0x10')]);router['put'](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller['update']);router[_0x25c1('0x11')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller[_0x25c1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9ca9847..dfcf96c 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 _0xcd21=['format','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xcd21,0x78));var _0x1cd2=function(_0x3577a4,_0x187c88){_0x3577a4=_0x3577a4-0x0;var _0x5b24e6=_0xcd21[_0x3577a4];return _0x5b24e6;};'use strict';var moment=require(_0x1cd2('0x0'));var Sequelize=require(_0x1cd2('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1cd2('0x2')],'set':function(_0x26107d){this[_0x1cd2('0x3')](_0x1cd2('0x4'),_0x26107d);this['setDataValue'](_0x1cd2('0x5'),moment()[_0x1cd2('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1cd2('0x2')]},'membername':{'type':Sequelize[_0x1cd2('0x7')]},'projectname':{'type':Sequelize[_0x1cd2('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1cd2('0x7')]},'calleridnum':{'type':Sequelize[_0x1cd2('0x7')]},'completed':{'type':Sequelize[_0x1cd2('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x04a9=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','format'];(function(_0xe22ee0,_0x1eb1c3){var _0x3243c9=function(_0x40d332){while(--_0x40d332){_0xe22ee0['push'](_0xe22ee0['shift']());}};_0x3243c9(++_0x1eb1c3);}(_0x04a9,0x1c5));var _0x904a=function(_0x1083d3,_0x3c56fc){_0x1083d3=_0x1083d3-0x0;var _0xc7963a=_0x04a9[_0x1083d3];return _0xc7963a;};'use strict';var moment=require(_0x904a('0x0'));var Sequelize=require(_0x904a('0x1'));module[_0x904a('0x2')]={'starttime':{'type':Sequelize[_0x904a('0x3')],'set':function(_0x20cd9a){this[_0x904a('0x4')]('starttime',_0x20cd9a);this[_0x904a('0x4')](_0x904a('0x5'),moment()[_0x904a('0x6')](_0x904a('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x904a('0x8')]},'projectname':{'type':Sequelize[_0x904a('0x8')]},'queue':{'type':Sequelize[_0x904a('0x8')]},'uniqueid':{'type':Sequelize[_0x904a('0x8')]},'calleridname':{'type':Sequelize[_0x904a('0x8')]},'calleridnum':{'type':Sequelize[_0x904a('0x8')]},'completed':{'type':Sequelize[_0x904a('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 01c50a4..f78206c 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 _0x36dd=['filter','merge','JscriptySessionReport','count','include','catch','show','params','includeAll','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','findAll','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','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','../../config/utils','../../config/environment','status','end','json','offset','limit','Content-Range','apply','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where'];(function(_0x6f95db,_0x22c73a){var _0x2c71e7=function(_0x1396fa){while(--_0x1396fa){_0x6f95db['push'](_0x6f95db['shift']());}};_0x2c71e7(++_0x22c73a);}(_0x36dd,0x186));var _0xd36d=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x36dd[_0x365e54];return _0x13317a;};'use strict';var pdf=require(_0xd36d('0x0'));var emlformat=require(_0xd36d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd36d('0x2'));var rp=require(_0xd36d('0x3'));var moment=require(_0xd36d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd36d('0x5'));var util=require('util');var path=require(_0xd36d('0x6'));var sox=require('sox');var csv=require(_0xd36d('0x7'));var ejs=require(_0xd36d('0x8'));var fs=require('fs');var _=require(_0xd36d('0x9'));var squel=require(_0xd36d('0xa'));var crypto=require(_0xd36d('0xb'));var jsforce=require(_0xd36d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd36d('0x7'));var querystring=require(_0xd36d('0xd'));var Papa=require(_0xd36d('0xe'));var Redis=require(_0xd36d('0xf'));var authService=require(_0xd36d('0x10'));var qs=require(_0xd36d('0x11'));var as=require(_0xd36d('0x12'));var hardwareService=require(_0xd36d('0x13'));var logger=require(_0xd36d('0x14'))(_0xd36d('0x15'));var utils=require(_0xd36d('0x16'));var config=require(_0xd36d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x407f4e,_0x287ffa){_0x287ffa=_0x287ffa||0xcc;return function(_0x3f4843){if(_0x3f4843){return _0x407f4e['sendStatus'](_0x287ffa);}return _0x407f4e[_0xd36d('0x18')](_0x287ffa)[_0xd36d('0x19')]();};}function respondWithResult(_0x2e50c1,_0x4215cc){_0x4215cc=_0x4215cc||0xc8;return function(_0x174d72){if(_0x174d72){return _0x2e50c1[_0xd36d('0x18')](_0x4215cc)[_0xd36d('0x1a')](_0x174d72);}};}function respondWithFilteredResult(_0x2e7677,_0x3b5d7d){return function(_0x5af24b){if(_0x5af24b){var _0x59634e=_0x5af24b['count'],_0x2177f9=_0x3b5d7d[_0xd36d('0x1b')],_0x469c66=_0x3b5d7d[_0xd36d('0x1b')]+_0x3b5d7d[_0xd36d('0x1c')],_0x5620f9;if(_0x469c66>=_0x59634e){_0x469c66=_0x59634e;_0x5620f9=0xc8;}else{_0x5620f9=0xce;}_0x2e7677[_0xd36d('0x18')](_0x5620f9);return _0x2e7677['set'](_0xd36d('0x1d'),_0x2177f9+'-'+_0x469c66+'/'+_0x59634e)[_0xd36d('0x1a')](_0x5af24b);}return null;};}function patchUpdates(_0x49b9f1){return function(_0xc4ec20){try{jsonpatch[_0xd36d('0x1e')](_0xc4ec20,_0x49b9f1,!![]);}catch(_0x383ad6){return BPromise['reject'](_0x383ad6);}return _0xc4ec20[_0xd36d('0x1f')]();};}function saveUpdates(_0x4c330d,_0x44d8c8){return function(_0x14591c){if(_0x14591c){return _0x14591c['update'](_0x4c330d)['then'](function(_0x517b97){return _0x517b97;});}return null;};}function removeEntity(_0x32c77c,_0x2be1af){return function(_0x286323){if(_0x286323){return _0x286323[_0xd36d('0x20')]()[_0xd36d('0x21')](function(){_0x32c77c[_0xd36d('0x18')](0xcc)[_0xd36d('0x19')]();});}};}function handleEntityNotFound(_0xf69f77,_0x58a420){return function(_0x2637f2){if(!_0x2637f2){_0xf69f77['sendStatus'](0x194);}return _0x2637f2;};}function handleError(_0x100ca9,_0x2d2f4d){_0x2d2f4d=_0x2d2f4d||0x1f4;return function(_0x46619b){logger[_0xd36d('0x22')](_0x46619b['stack']);if(_0x46619b['name']){delete _0x46619b[_0xd36d('0x23')];}_0x100ca9['status'](_0x2d2f4d)[_0xd36d('0x24')](_0x46619b);};}exports[_0xd36d('0x25')]=function(_0x47d9e9,_0x46476c){var _0x52d16b={},_0x4199e7={},_0x588302={'count':0x0,'rows':[]};var _0x5ce2eb=_[_0xd36d('0x26')](db['JscriptySessionReport'][_0xd36d('0x27')],function(_0x4b79bd){return{'name':_0x4b79bd[_0xd36d('0x28')],'type':_0x4b79bd[_0xd36d('0x29')][_0xd36d('0x2a')]};});_0x4199e7[_0xd36d('0x2b')]=_['map'](_0x5ce2eb,'name');_0x4199e7['query']=_[_0xd36d('0x2c')](_0x47d9e9[_0xd36d('0x2d')]);_0x4199e7[_0xd36d('0x2e')]=_[_0xd36d('0x2f')](_0x4199e7[_0xd36d('0x2b')],_0x4199e7[_0xd36d('0x2d')]);_0x52d16b[_0xd36d('0x30')]=_[_0xd36d('0x2f')](_0x4199e7[_0xd36d('0x2b')],qs[_0xd36d('0x31')](_0x47d9e9[_0xd36d('0x2d')][_0xd36d('0x31')]));_0x52d16b['attributes']=_0x52d16b[_0xd36d('0x30')][_0xd36d('0x32')]?_0x52d16b[_0xd36d('0x30')]:_0x4199e7['model'];if(!_0x47d9e9[_0xd36d('0x2d')]['hasOwnProperty'](_0xd36d('0x33'))){_0x52d16b[_0xd36d('0x1c')]=qs[_0xd36d('0x1c')](_0x47d9e9['query']['limit']);_0x52d16b['offset']=qs[_0xd36d('0x1b')](_0x47d9e9['query'][_0xd36d('0x1b')]);}_0x52d16b['order']=qs[_0xd36d('0x34')](_0x47d9e9[_0xd36d('0x2d')][_0xd36d('0x34')]);_0x52d16b[_0xd36d('0x35')]=qs[_0xd36d('0x2e')](_['pick'](_0x47d9e9[_0xd36d('0x2d')],_0x4199e7[_0xd36d('0x2e')]),_0x5ce2eb);if(_0x47d9e9[_0xd36d('0x2d')][_0xd36d('0x36')]){_0x52d16b[_0xd36d('0x35')]=_[_0xd36d('0x37')](_0x52d16b['where'],{'$or':_[_0xd36d('0x26')](_0x5ce2eb,function(_0x1cf6dd){if(_0x1cf6dd[_0xd36d('0x29')]!=='VIRTUAL'){var _0x5199a7={};_0x5199a7[_0x1cf6dd[_0xd36d('0x23')]]={'$like':'%'+_0x47d9e9[_0xd36d('0x2d')][_0xd36d('0x36')]+'%'};return _0x5199a7;}})});}_0x52d16b=_[_0xd36d('0x37')]({},_0x52d16b,_0x47d9e9['options']);var _0x3ed731={'where':_0x52d16b['where']};return db[_0xd36d('0x38')][_0xd36d('0x39')](_0x3ed731)['then'](function(_0x35f302){_0x588302[_0xd36d('0x39')]=_0x35f302;if(_0x47d9e9[_0xd36d('0x2d')]['includeAll']){_0x52d16b[_0xd36d('0x3a')]=[{'all':!![]}];}return db[_0xd36d('0x38')]['findAll'](_0x52d16b);})[_0xd36d('0x21')](function(_0x21cad0){_0x588302['rows']=_0x21cad0;return _0x588302;})[_0xd36d('0x21')](respondWithFilteredResult(_0x46476c,_0x52d16b))[_0xd36d('0x3b')](handleError(_0x46476c,null));};exports[_0xd36d('0x3c')]=function(_0x3d83bd,_0x3ad0eb){var _0x583093={'raw':!![],'where':{'id':_0x3d83bd[_0xd36d('0x3d')]['id']}},_0x549707={};_0x549707['model']=_[_0xd36d('0x2c')](db[_0xd36d('0x38')][_0xd36d('0x27')]);_0x549707[_0xd36d('0x2d')]=_[_0xd36d('0x2c')](_0x3d83bd['query']);_0x549707[_0xd36d('0x2e')]=_['intersection'](_0x549707['model'],_0x549707[_0xd36d('0x2d')]);_0x583093['attributes']=_['intersection'](_0x549707[_0xd36d('0x2b')],qs['fields'](_0x3d83bd[_0xd36d('0x2d')]['fields']));_0x583093[_0xd36d('0x30')]=_0x583093[_0xd36d('0x30')][_0xd36d('0x32')]?_0x583093['attributes']:_0x549707['model'];if(_0x3d83bd[_0xd36d('0x2d')][_0xd36d('0x3e')]){_0x583093['include']=[{'all':!![]}];}_0x583093=_['merge']({},_0x583093,_0x3d83bd[_0xd36d('0x3f')]);return db[_0xd36d('0x38')][_0xd36d('0x40')](_0x583093)[_0xd36d('0x21')](handleEntityNotFound(_0x3ad0eb,null))[_0xd36d('0x21')](respondWithResult(_0x3ad0eb,null))['catch'](handleError(_0x3ad0eb,null));};exports[_0xd36d('0x41')]=function(_0x472c2d,_0x56e4e5){return db[_0xd36d('0x38')]['create'](_0x472c2d[_0xd36d('0x42')],{})['then'](respondWithResult(_0x56e4e5,0xc9))['catch'](handleError(_0x56e4e5,null));};exports[_0xd36d('0x43')]=function(_0x1d55b5,_0x3296c8){if(_0x1d55b5[_0xd36d('0x42')]['id']){delete _0x1d55b5[_0xd36d('0x42')]['id'];}return db['JscriptySessionReport'][_0xd36d('0x40')]({'where':{'id':_0x1d55b5[_0xd36d('0x3d')]['id']}})[_0xd36d('0x21')](handleEntityNotFound(_0x3296c8,null))[_0xd36d('0x21')](saveUpdates(_0x1d55b5[_0xd36d('0x42')],null))[_0xd36d('0x21')](respondWithResult(_0x3296c8,null))['catch'](handleError(_0x3296c8,null));};exports[_0xd36d('0x20')]=function(_0x4afa1b,_0x539591){return db['JscriptySessionReport'][_0xd36d('0x40')]({'where':{'id':_0x4afa1b[_0xd36d('0x3d')]['id']}})[_0xd36d('0x21')](handleEntityNotFound(_0x539591,null))[_0xd36d('0x21')](removeEntity(_0x539591,null))[_0xd36d('0x3b')](handleError(_0x539591,null));};exports[_0xd36d('0x44')]=function(_0x5c0f21,_0x5dfda6){return db['JscriptySessionReport']['describe']()[_0xd36d('0x21')](respondWithResult(_0x5dfda6,null))['catch'](handleError(_0x5dfda6,null));};exports[_0xd36d('0x45')]=function(_0x5e324d,_0x399ba8,_0x32cc11){var _0x14363a={'raw':!![],'where':{}};var _0x6ab9ba={};var _0x461ce1={'count':0x0,'rows':[]};return db[_0xd36d('0x38')][_0xd36d('0x46')]({'where':{'id':_0x5e324d[_0xd36d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x399ba8,null))[_0xd36d('0x21')](function(_0xa00713){if(_0xa00713){_0x6ab9ba[_0xd36d('0x2b')]=_['keys'](db[_0xd36d('0x47')][_0xd36d('0x27')]);_0x6ab9ba['query']=_[_0xd36d('0x2c')](_0x5e324d['query']);_0x6ab9ba[_0xd36d('0x2e')]=_['intersection'](_0x6ab9ba[_0xd36d('0x2b')],_0x6ab9ba[_0xd36d('0x2d')]);_0x14363a['attributes']=_[_0xd36d('0x2f')](_0x6ab9ba['model'],qs[_0xd36d('0x31')](_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x31')]));_0x14363a['attributes']=_0x14363a[_0xd36d('0x30')][_0xd36d('0x32')]?_0x14363a['attributes']:_0x6ab9ba[_0xd36d('0x2b')];if(!_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x48')]('nolimit')){_0x14363a[_0xd36d('0x1c')]=qs['limit'](_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x1c')]);_0x14363a[_0xd36d('0x1b')]=qs['offset'](_0x5e324d[_0xd36d('0x2d')]['offset']);}_0x14363a['order']=qs[_0xd36d('0x34')](_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x34')]);_0x14363a[_0xd36d('0x35')]=qs[_0xd36d('0x2e')](_['pick'](_0x5e324d[_0xd36d('0x2d')],_0x6ab9ba['filters']));_0x14363a[_0xd36d('0x35')]['SessionId']=_0xa00713['id'];if(_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x36')]){_0x14363a[_0xd36d('0x35')]=_[_0xd36d('0x37')](_0x14363a[_0xd36d('0x35')],{'$or':_[_0xd36d('0x26')](_0x14363a[_0xd36d('0x30')],function(_0x56e05d){var _0x4ba3b0={};_0x4ba3b0[_0x56e05d]={'$like':'%'+_0x5e324d['query'][_0xd36d('0x36')]+'%'};return _0x4ba3b0;})});}_0x14363a=_[_0xd36d('0x37')]({},_0x14363a,_0x5e324d[_0xd36d('0x3f')]);return db[_0xd36d('0x47')][_0xd36d('0x39')]({'where':_0x14363a[_0xd36d('0x35')]})[_0xd36d('0x21')](function(_0x42158c){_0x461ce1[_0xd36d('0x39')]=_0x42158c;if(_0x5e324d[_0xd36d('0x2d')][_0xd36d('0x3e')]){_0x14363a['include']=[{'all':!![]}];}return db[_0xd36d('0x47')][_0xd36d('0x49')](_0x14363a);})['then'](function(_0x32a781){_0x461ce1['rows']=_0x32a781;return _0x461ce1;});}})['then'](respondWithFilteredResult(_0x399ba8,_0x14363a))[_0xd36d('0x3b')](handleError(_0x399ba8,null));}; \ No newline at end of file +var _0x0141=['save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','count','include','JscriptySessionReport','findAll','rows','catch','show','includeAll','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','reject'];(function(_0x2e43fc,_0xeb1410){var _0xae5c7b=function(_0x188a68){while(--_0x188a68){_0x2e43fc['push'](_0x2e43fc['shift']());}};_0xae5c7b(++_0xeb1410);}(_0x0141,0x84));var _0x1014=function(_0x3e9488,_0x569a04){_0x3e9488=_0x3e9488-0x0;var _0x56afe8=_0x0141[_0x3e9488];return _0x56afe8;};'use strict';var pdf=require(_0x1014('0x0'));var emlformat=require(_0x1014('0x1'));var rimraf=require(_0x1014('0x2'));var zipdir=require(_0x1014('0x3'));var jsonpatch=require(_0x1014('0x4'));var rp=require(_0x1014('0x5'));var moment=require('moment');var BPromise=require(_0x1014('0x6'));var Mustache=require(_0x1014('0x7'));var util=require(_0x1014('0x8'));var path=require(_0x1014('0x9'));var sox=require(_0x1014('0xa'));var csv=require(_0x1014('0xb'));var ejs=require(_0x1014('0xc'));var fs=require('fs');var _=require(_0x1014('0xd'));var squel=require(_0x1014('0xe'));var crypto=require(_0x1014('0xf'));var jsforce=require(_0x1014('0x10'));var deskjs=require(_0x1014('0x11'));var toCsv=require(_0x1014('0xb'));var querystring=require('querystring');var Papa=require(_0x1014('0x12'));var Redis=require(_0x1014('0x13'));var authService=require(_0x1014('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1014('0x15'));var hardwareService=require(_0x1014('0x16'));var logger=require(_0x1014('0x17'))('api');var utils=require(_0x1014('0x18'));var config=require(_0x1014('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d0eb,_0x53e9ec){_0x53e9ec=_0x53e9ec||0xcc;return function(_0x40533e){if(_0x40533e){return _0x10d0eb['sendStatus'](_0x53e9ec);}return _0x10d0eb[_0x1014('0x1a')](_0x53e9ec)[_0x1014('0x1b')]();};}function respondWithResult(_0x3fc2ff,_0x144004){_0x144004=_0x144004||0xc8;return function(_0x5bf1b5){if(_0x5bf1b5){return _0x3fc2ff[_0x1014('0x1a')](_0x144004)[_0x1014('0x1c')](_0x5bf1b5);}};}function respondWithFilteredResult(_0x24d905,_0x1b22c4){return function(_0x365b46){if(_0x365b46){var _0x391cd5=_0x365b46['count'],_0x4dc418=_0x1b22c4['offset'],_0x36790e=_0x1b22c4[_0x1014('0x1d')]+_0x1b22c4['limit'],_0x189251;if(_0x36790e>=_0x391cd5){_0x36790e=_0x391cd5;_0x189251=0xc8;}else{_0x189251=0xce;}_0x24d905['status'](_0x189251);return _0x24d905[_0x1014('0x1e')](_0x1014('0x1f'),_0x4dc418+'-'+_0x36790e+'/'+_0x391cd5)[_0x1014('0x1c')](_0x365b46);}return null;};}function patchUpdates(_0x21e154){return function(_0x5c5be4){try{jsonpatch[_0x1014('0x20')](_0x5c5be4,_0x21e154,!![]);}catch(_0x432a4e){return BPromise[_0x1014('0x21')](_0x432a4e);}return _0x5c5be4[_0x1014('0x22')]();};}function saveUpdates(_0x167345,_0x52a0ae){return function(_0x3f8225){if(_0x3f8225){return _0x3f8225[_0x1014('0x23')](_0x167345)[_0x1014('0x24')](function(_0x4fae77){return _0x4fae77;});}return null;};}function removeEntity(_0x21ad9b,_0x59edb8){return function(_0x267acb){if(_0x267acb){return _0x267acb['destroy']()[_0x1014('0x24')](function(){_0x21ad9b[_0x1014('0x1a')](0xcc)[_0x1014('0x1b')]();});}};}function handleEntityNotFound(_0x5a9b87,_0x4b3378){return function(_0x4a4cf7){if(!_0x4a4cf7){_0x5a9b87[_0x1014('0x25')](0x194);}return _0x4a4cf7;};}function handleError(_0x2414d4,_0x377ba3){_0x377ba3=_0x377ba3||0x1f4;return function(_0x5f5b99){logger[_0x1014('0x26')](_0x5f5b99[_0x1014('0x27')]);if(_0x5f5b99[_0x1014('0x28')]){delete _0x5f5b99[_0x1014('0x28')];}_0x2414d4['status'](_0x377ba3)[_0x1014('0x29')](_0x5f5b99);};}exports[_0x1014('0x2a')]=function(_0x51c5fe,_0x417936){var _0x5e25d8={},_0x3f3eb6={},_0x466079={'count':0x0,'rows':[]};var _0x28ff49=_[_0x1014('0x2b')](db['JscriptySessionReport'][_0x1014('0x2c')],function(_0x2ea4a8){return{'name':_0x2ea4a8[_0x1014('0x2d')],'type':_0x2ea4a8[_0x1014('0x2e')][_0x1014('0x2f')]};});_0x3f3eb6[_0x1014('0x30')]=_[_0x1014('0x2b')](_0x28ff49,_0x1014('0x28'));_0x3f3eb6[_0x1014('0x31')]=_[_0x1014('0x32')](_0x51c5fe[_0x1014('0x31')]);_0x3f3eb6['filters']=_['intersection'](_0x3f3eb6[_0x1014('0x30')],_0x3f3eb6[_0x1014('0x31')]);_0x5e25d8[_0x1014('0x33')]=_[_0x1014('0x34')](_0x3f3eb6[_0x1014('0x30')],qs[_0x1014('0x35')](_0x51c5fe['query']['fields']));_0x5e25d8[_0x1014('0x33')]=_0x5e25d8[_0x1014('0x33')][_0x1014('0x36')]?_0x5e25d8[_0x1014('0x33')]:_0x3f3eb6[_0x1014('0x30')];if(!_0x51c5fe[_0x1014('0x31')][_0x1014('0x37')](_0x1014('0x38'))){_0x5e25d8[_0x1014('0x39')]=qs[_0x1014('0x39')](_0x51c5fe[_0x1014('0x31')][_0x1014('0x39')]);_0x5e25d8[_0x1014('0x1d')]=qs[_0x1014('0x1d')](_0x51c5fe['query'][_0x1014('0x1d')]);}_0x5e25d8[_0x1014('0x3a')]=qs[_0x1014('0x3b')](_0x51c5fe[_0x1014('0x31')][_0x1014('0x3b')]);_0x5e25d8[_0x1014('0x3c')]=qs['filters'](_['pick'](_0x51c5fe[_0x1014('0x31')],_0x3f3eb6[_0x1014('0x3d')]),_0x28ff49);if(_0x51c5fe[_0x1014('0x31')][_0x1014('0x3e')]){_0x5e25d8[_0x1014('0x3c')]=_['merge'](_0x5e25d8[_0x1014('0x3c')],{'$or':_[_0x1014('0x2b')](_0x28ff49,function(_0x4dc711){if(_0x4dc711['type']!==_0x1014('0x3f')){var _0x248162={};_0x248162[_0x4dc711[_0x1014('0x28')]]={'$like':'%'+_0x51c5fe['query'][_0x1014('0x3e')]+'%'};return _0x248162;}})});}_0x5e25d8=_[_0x1014('0x40')]({},_0x5e25d8,_0x51c5fe[_0x1014('0x41')]);var _0x304b6d={'where':_0x5e25d8[_0x1014('0x3c')]};return db['JscriptySessionReport'][_0x1014('0x42')](_0x304b6d)[_0x1014('0x24')](function(_0x1bd886){_0x466079[_0x1014('0x42')]=_0x1bd886;if(_0x51c5fe[_0x1014('0x31')]['includeAll']){_0x5e25d8[_0x1014('0x43')]=[{'all':!![]}];}return db[_0x1014('0x44')][_0x1014('0x45')](_0x5e25d8);})[_0x1014('0x24')](function(_0x4206b4){_0x466079[_0x1014('0x46')]=_0x4206b4;return _0x466079;})[_0x1014('0x24')](respondWithFilteredResult(_0x417936,_0x5e25d8))[_0x1014('0x47')](handleError(_0x417936,null));};exports[_0x1014('0x48')]=function(_0x429ae9,_0x56cd38){var _0x418049={'raw':!![],'where':{'id':_0x429ae9['params']['id']}},_0x374b30={};_0x374b30['model']=_[_0x1014('0x32')](db[_0x1014('0x44')][_0x1014('0x2c')]);_0x374b30[_0x1014('0x31')]=_[_0x1014('0x32')](_0x429ae9[_0x1014('0x31')]);_0x374b30['filters']=_['intersection'](_0x374b30['model'],_0x374b30[_0x1014('0x31')]);_0x418049['attributes']=_[_0x1014('0x34')](_0x374b30['model'],qs[_0x1014('0x35')](_0x429ae9[_0x1014('0x31')][_0x1014('0x35')]));_0x418049['attributes']=_0x418049[_0x1014('0x33')][_0x1014('0x36')]?_0x418049[_0x1014('0x33')]:_0x374b30[_0x1014('0x30')];if(_0x429ae9[_0x1014('0x31')][_0x1014('0x49')]){_0x418049['include']=[{'all':!![]}];}_0x418049=_[_0x1014('0x40')]({},_0x418049,_0x429ae9[_0x1014('0x41')]);return db[_0x1014('0x44')][_0x1014('0x4a')](_0x418049)[_0x1014('0x24')](handleEntityNotFound(_0x56cd38,null))[_0x1014('0x24')](respondWithResult(_0x56cd38,null))[_0x1014('0x47')](handleError(_0x56cd38,null));};exports[_0x1014('0x4b')]=function(_0x5229a2,_0x41802e){return db['JscriptySessionReport']['create'](_0x5229a2[_0x1014('0x4c')],{})['then'](respondWithResult(_0x41802e,0xc9))['catch'](handleError(_0x41802e,null));};exports['update']=function(_0x421209,_0x24533a){if(_0x421209['body']['id']){delete _0x421209['body']['id'];}return db[_0x1014('0x44')][_0x1014('0x4a')]({'where':{'id':_0x421209['params']['id']}})[_0x1014('0x24')](handleEntityNotFound(_0x24533a,null))[_0x1014('0x24')](saveUpdates(_0x421209[_0x1014('0x4c')],null))[_0x1014('0x24')](respondWithResult(_0x24533a,null))[_0x1014('0x47')](handleError(_0x24533a,null));};exports['destroy']=function(_0x3b09a8,_0x134eac){return db[_0x1014('0x44')][_0x1014('0x4a')]({'where':{'id':_0x3b09a8[_0x1014('0x4d')]['id']}})[_0x1014('0x24')](handleEntityNotFound(_0x134eac,null))[_0x1014('0x24')](removeEntity(_0x134eac,null))[_0x1014('0x47')](handleError(_0x134eac,null));};exports[_0x1014('0x4e')]=function(_0x3e80a5,_0x398b1b){return db[_0x1014('0x44')][_0x1014('0x4e')]()['then'](respondWithResult(_0x398b1b,null))[_0x1014('0x47')](handleError(_0x398b1b,null));};exports[_0x1014('0x4f')]=function(_0x1e2939,_0x42afd9,_0x2d4df4){var _0x299bb7={'raw':!![],'where':{}};var _0x74ed19={};var _0x393c79={'count':0x0,'rows':[]};return db[_0x1014('0x44')][_0x1014('0x50')]({'where':{'id':_0x1e2939[_0x1014('0x4d')]['id']}})[_0x1014('0x24')](handleEntityNotFound(_0x42afd9,null))[_0x1014('0x24')](function(_0x4d244d){if(_0x4d244d){_0x74ed19[_0x1014('0x30')]=_[_0x1014('0x32')](db[_0x1014('0x51')][_0x1014('0x2c')]);_0x74ed19[_0x1014('0x31')]=_[_0x1014('0x32')](_0x1e2939['query']);_0x74ed19[_0x1014('0x3d')]=_['intersection'](_0x74ed19['model'],_0x74ed19[_0x1014('0x31')]);_0x299bb7[_0x1014('0x33')]=_[_0x1014('0x34')](_0x74ed19[_0x1014('0x30')],qs[_0x1014('0x35')](_0x1e2939[_0x1014('0x31')][_0x1014('0x35')]));_0x299bb7['attributes']=_0x299bb7['attributes'][_0x1014('0x36')]?_0x299bb7[_0x1014('0x33')]:_0x74ed19[_0x1014('0x30')];if(!_0x1e2939[_0x1014('0x31')][_0x1014('0x37')]('nolimit')){_0x299bb7[_0x1014('0x39')]=qs[_0x1014('0x39')](_0x1e2939[_0x1014('0x31')][_0x1014('0x39')]);_0x299bb7[_0x1014('0x1d')]=qs[_0x1014('0x1d')](_0x1e2939['query'][_0x1014('0x1d')]);}_0x299bb7[_0x1014('0x3a')]=qs[_0x1014('0x3b')](_0x1e2939[_0x1014('0x31')][_0x1014('0x3b')]);_0x299bb7[_0x1014('0x3c')]=qs[_0x1014('0x3d')](_[_0x1014('0x52')](_0x1e2939['query'],_0x74ed19[_0x1014('0x3d')]));_0x299bb7[_0x1014('0x3c')]['SessionId']=_0x4d244d['id'];if(_0x1e2939[_0x1014('0x31')][_0x1014('0x3e')]){_0x299bb7[_0x1014('0x3c')]=_[_0x1014('0x40')](_0x299bb7[_0x1014('0x3c')],{'$or':_['map'](_0x299bb7[_0x1014('0x33')],function(_0x1151ed){var _0x32bd7c={};_0x32bd7c[_0x1151ed]={'$like':'%'+_0x1e2939[_0x1014('0x31')][_0x1014('0x3e')]+'%'};return _0x32bd7c;})});}_0x299bb7=_['merge']({},_0x299bb7,_0x1e2939['options']);return db[_0x1014('0x51')][_0x1014('0x42')]({'where':_0x299bb7[_0x1014('0x3c')]})['then'](function(_0x2c05f3){_0x393c79[_0x1014('0x42')]=_0x2c05f3;if(_0x1e2939['query']['includeAll']){_0x299bb7[_0x1014('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1014('0x45')](_0x299bb7);})[_0x1014('0x24')](function(_0x5b16ec){_0x393c79[_0x1014('0x46')]=_0x5b16ec;return _0x393c79;});}})['then'](respondWithFilteredResult(_0x42afd9,_0x299bb7))['catch'](handleError(_0x42afd9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0ebb2b1..4ab7a83 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 _0x8f71=['bluebird','request-promise','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util','../../config/logger','api','moment'];(function(_0xa979d2,_0x217409){var _0x1e7149=function(_0x1b317c){while(--_0x1b317c){_0xa979d2['push'](_0xa979d2['shift']());}};_0x1e7149(++_0x217409);}(_0x8f71,0x146));var _0x18f7=function(_0x3beee4,_0x592717){_0x3beee4=_0x3beee4-0x0;var _0x4ca99f=_0x8f71[_0x3beee4];return _0x4ca99f;};'use strict';var _=require('lodash');var util=require(_0x18f7('0x0'));var logger=require(_0x18f7('0x1'))(_0x18f7('0x2'));var moment=require(_0x18f7('0x3'));var BPromise=require(_0x18f7('0x4'));var rp=require(_0x18f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x18f7('0x7'));module[_0x18f7('0x8')]=function(_0x21ecdc,_0x4333fa){return _0x21ecdc[_0x18f7('0x9')](_0x18f7('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03cd=['api','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger'];(function(_0x5f41c9,_0x160beb){var _0xdb7812=function(_0x4575d4){while(--_0x4575d4){_0x5f41c9['push'](_0x5f41c9['shift']());}};_0xdb7812(++_0x160beb);}(_0x03cd,0x9e));var _0xd03c=function(_0x440c81,_0x3ea6d7){_0x440c81=_0x440c81-0x0;var _0x2ed55b=_0x03cd[_0x440c81];return _0x2ed55b;};'use strict';var _=require('lodash');var util=require(_0xd03c('0x0'));var logger=require(_0xd03c('0x1'))(_0xd03c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd03c('0x3'));var fs=require('fs');var path=require(_0xd03c('0x4'));var rimraf=require('rimraf');var config=require(_0xd03c('0x5'));var attributes=require(_0xd03c('0x6'));module[_0xd03c('0x7')]=function(_0x24d362,_0x41d8fa){return _0x24d362['define'](_0xd03c('0x8'),attributes,{'tableName':_0xd03c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e18716a..9cf277c 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 _0xd3ef=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd3ef,0xce));var _0xfd3e=function(_0x556771,_0x447992){_0x556771=_0x556771-0x0;var _0x4c9da8=_0xd3ef[_0x556771];return _0x4c9da8;};'use strict';var _=require('lodash');var util=require(_0xfd3e('0x0'));var moment=require(_0xfd3e('0x1'));var BPromise=require(_0xfd3e('0x2'));var rs=require(_0xfd3e('0x3'));var fs=require('fs');var Redis=require(_0xfd3e('0x4'));var db=require(_0xfd3e('0x5'))['db'];var utils=require(_0xfd3e('0x6'));var logger=require(_0xfd3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd3e('0x8'));var client=jayson[_0xfd3e('0x9')][_0xfd3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x94129d,_0x41a08c,_0x2a1bee){return new BPromise(function(_0x3465e3,_0x1dcbff){return client[_0xfd3e('0xb')](_0x94129d,_0x2a1bee)[_0xfd3e('0xc')](function(_0x542b78){logger[_0xfd3e('0xd')](_0xfd3e('0xe'),_0x41a08c,_0xfd3e('0xf'));logger[_0xfd3e('0x10')](_0xfd3e('0x11'),_0x41a08c,'request\x20sent',JSON[_0xfd3e('0x12')](_0x542b78));if(_0x542b78[_0xfd3e('0x13')]){if(_0x542b78['error']['code']===0x1f4){logger[_0xfd3e('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x41a08c,_0x542b78[_0xfd3e('0x13')][_0xfd3e('0x14')]);return _0x1dcbff(_0x542b78['error']['message']);}logger[_0xfd3e('0x13')](_0xfd3e('0xe'),_0x41a08c,_0x542b78[_0xfd3e('0x13')][_0xfd3e('0x14')]);return _0x3465e3(_0x542b78[_0xfd3e('0x13')][_0xfd3e('0x14')]);}else{logger[_0xfd3e('0xd')](_0xfd3e('0xe'),_0x41a08c,'request\x20sent');_0x3465e3(_0x542b78[_0xfd3e('0x15')][_0xfd3e('0x14')]);}})[_0xfd3e('0x16')](function(_0x303f12){logger[_0xfd3e('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x41a08c,_0x303f12);_0x1dcbff(_0x303f12);});});} \ No newline at end of file +var _0x4a58=['../../config/logger','rpc','../../config/environment','client','http','request','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x54e7d9,_0x1c42c7){var _0x166bb1=function(_0x372d37){while(--_0x372d37){_0x54e7d9['push'](_0x54e7d9['shift']());}};_0x166bb1(++_0x1c42c7);}(_0x4a58,0x1b1));var _0x84a5=function(_0x868611,_0x1a176e){_0x868611=_0x868611-0x0;var _0x143a08=_0x4a58[_0x868611];return _0x143a08;};'use strict';var _=require(_0x84a5('0x0'));var util=require(_0x84a5('0x1'));var moment=require(_0x84a5('0x2'));var BPromise=require(_0x84a5('0x3'));var rs=require(_0x84a5('0x4'));var fs=require('fs');var Redis=require(_0x84a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84a5('0x6'));var logger=require(_0x84a5('0x7'))(_0x84a5('0x8'));var config=require(_0x84a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x84a5('0xa')][_0x84a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d0d85,_0x57a13d,_0x3541d3){return new BPromise(function(_0x425d72,_0xd4fa62){return client[_0x84a5('0xc')](_0x3d0d85,_0x3541d3)['then'](function(_0x1f5b72){logger['info'](_0x84a5('0xd'),_0x57a13d,'request\x20sent');logger[_0x84a5('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x57a13d,_0x84a5('0xf'),JSON[_0x84a5('0x10')](_0x1f5b72));if(_0x1f5b72['error']){if(_0x1f5b72[_0x84a5('0x11')][_0x84a5('0x12')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x57a13d,_0x1f5b72['error'][_0x84a5('0x13')]);return _0xd4fa62(_0x1f5b72[_0x84a5('0x11')][_0x84a5('0x13')]);}logger[_0x84a5('0x11')](_0x84a5('0xd'),_0x57a13d,_0x1f5b72[_0x84a5('0x11')][_0x84a5('0x13')]);return _0x425d72(_0x1f5b72[_0x84a5('0x11')][_0x84a5('0x13')]);}else{logger[_0x84a5('0x14')](_0x84a5('0xd'),_0x57a13d,'request\x20sent');_0x425d72(_0x1f5b72[_0x84a5('0x15')][_0x84a5('0x13')]);}})['catch'](function(_0x39f740){logger[_0x84a5('0x11')](_0x84a5('0xd'),_0x57a13d,_0x39f740);_0xd4fa62(_0x39f740);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 79082e5..b90d863 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 _0x61ad=['/:id','isAuthenticated','update','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index'];(function(_0x4b8bf6,_0x4904ff){var _0x5f2b16=function(_0x27a6e4){while(--_0x27a6e4){_0x4b8bf6['push'](_0x4b8bf6['shift']());}};_0x5f2b16(++_0x4904ff);}(_0x61ad,0xab));var _0xd61a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ad[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd61a('0x0'));var util=require(_0xd61a('0x1'));var path=require(_0xd61a('0x2'));var timeout=require(_0xd61a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd61a('0x4'));var interaction=require(_0xd61a('0x5'));var config=require(_0xd61a('0x6'));var controller=require(_0xd61a('0x7'));router['get']('/',controller[_0xd61a('0x8')]);router['put'](_0xd61a('0x9'),auth[_0xd61a('0xa')](),controller[_0xd61a('0xb')]);module['exports']=router; \ No newline at end of file +var _0x008c=['./license.controller','index','/:id','isAuthenticated','exports','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0x008c,0xff));var _0xc008=function(_0x178619,_0x35734e){_0x178619=_0x178619-0x0;var _0x2a71e9=_0x008c[_0x178619];return _0x2a71e9;};'use strict';var multer=require('multer');var util=require(_0xc008('0x0'));var path=require(_0xc008('0x1'));var timeout=require('connect-timeout');var express=require(_0xc008('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc008('0x3'));var config=require(_0xc008('0x4'));var controller=require(_0xc008('0x5'));router['get']('/',controller[_0xc008('0x6')]);router['put'](_0xc008('0x7'),auth[_0xc008('0x8')](),controller['update']);module[_0xc008('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index f402794..9230589 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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1d2bca,_0x2ee9c4){_0x1d2bca=_0x1d2bca-0x0;var _0x13cb6c=_0xdbf5[_0x1d2bca];return _0x13cb6c;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba34,0x119));var _0x4ba3=function(_0xe832bb,_0x5dc949){_0xe832bb=_0xe832bb-0x0;var _0x3647ed=_0xba34[_0xe832bb];return _0x3647ed;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 bb6671f..32ee533 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 _0xff98=['status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','filters','intersection','query','attributes','fields','length','merge','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5f2328,_0x35a913){var _0x19d65f=function(_0x2cdf89){while(--_0x2cdf89){_0x5f2328['push'](_0x5f2328['shift']());}};_0x19d65f(++_0x35a913);}(_0xff98,0x9c));var _0x8ff9=function(_0x4581d8,_0x44f636){_0x4581d8=_0x4581d8-0x0;var _0x24a238=_0xff98[_0x4581d8];return _0x24a238;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ff9('0x0'));var rimraf=require(_0x8ff9('0x1'));var zipdir=require(_0x8ff9('0x2'));var jsonpatch=require(_0x8ff9('0x3'));var rp=require('request-promise');var moment=require(_0x8ff9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ff9('0x5'));var util=require('util');var path=require(_0x8ff9('0x6'));var sox=require('sox');var csv=require(_0x8ff9('0x7'));var ejs=require(_0x8ff9('0x8'));var fs=require('fs');var _=require(_0x8ff9('0x9'));var squel=require(_0x8ff9('0xa'));var crypto=require(_0x8ff9('0xb'));var jsforce=require(_0x8ff9('0xc'));var deskjs=require(_0x8ff9('0xd'));var toCsv=require(_0x8ff9('0x7'));var querystring=require('querystring');var Papa=require(_0x8ff9('0xe'));var Redis=require(_0x8ff9('0xf'));var authService=require(_0x8ff9('0x10'));var qs=require(_0x8ff9('0x11'));var as=require(_0x8ff9('0x12'));var hardwareService=require(_0x8ff9('0x13'));var logger=require(_0x8ff9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ff9('0x15'));var db=require(_0x8ff9('0x16'))['db'];function respondWithStatusCode(_0x440659,_0x4d7d7c){_0x4d7d7c=_0x4d7d7c||0xcc;return function(_0x3c655c){if(_0x3c655c){return _0x440659[_0x8ff9('0x17')](_0x4d7d7c);}return _0x440659[_0x8ff9('0x18')](_0x4d7d7c)[_0x8ff9('0x19')]();};}function respondWithResult(_0x405aac,_0x169a0e){_0x169a0e=_0x169a0e||0xc8;return function(_0x340068){if(_0x340068){return _0x405aac['status'](_0x169a0e)[_0x8ff9('0x1a')](_0x340068);}};}function respondWithFilteredResult(_0x25ca31,_0x313d09){return function(_0x5b5a3e){if(_0x5b5a3e){var _0x42e911=_0x5b5a3e['count'],_0x52ff51=_0x313d09['offset'],_0x3e62ef=_0x313d09['offset']+_0x313d09[_0x8ff9('0x1b')],_0x578fe3;if(_0x3e62ef>=_0x42e911){_0x3e62ef=_0x42e911;_0x578fe3=0xc8;}else{_0x578fe3=0xce;}_0x25ca31[_0x8ff9('0x18')](_0x578fe3);return _0x25ca31[_0x8ff9('0x1c')](_0x8ff9('0x1d'),_0x52ff51+'-'+_0x3e62ef+'/'+_0x42e911)[_0x8ff9('0x1a')](_0x5b5a3e);}return null;};}function patchUpdates(_0x23664d){return function(_0x34390b){try{jsonpatch['apply'](_0x34390b,_0x23664d,!![]);}catch(_0x11f616){return BPromise[_0x8ff9('0x1e')](_0x11f616);}return _0x34390b[_0x8ff9('0x1f')]();};}function saveUpdates(_0x47eb4d,_0x39d4d1){return function(_0x3ac144){if(_0x3ac144){return _0x3ac144[_0x8ff9('0x20')](_0x47eb4d)[_0x8ff9('0x21')](function(_0x1699fc){return _0x1699fc;});}return null;};}function removeEntity(_0x34a7ec,_0x1fc0a9){return function(_0x2ca5c3){if(_0x2ca5c3){return _0x2ca5c3[_0x8ff9('0x22')]()[_0x8ff9('0x21')](function(){_0x34a7ec[_0x8ff9('0x18')](0xcc)[_0x8ff9('0x19')]();});}};}function handleEntityNotFound(_0x3aff05,_0x58e7b9){return function(_0x4de8b5){if(!_0x4de8b5){_0x3aff05[_0x8ff9('0x17')](0x194);}return _0x4de8b5;};}function handleError(_0x5f188a,_0x2060d9){_0x2060d9=_0x2060d9||0x1f4;return function(_0x5a1116){logger[_0x8ff9('0x23')](_0x5a1116[_0x8ff9('0x24')]);if(_0x5a1116[_0x8ff9('0x25')]){delete _0x5a1116[_0x8ff9('0x25')];}_0x5f188a[_0x8ff9('0x18')](_0x2060d9)[_0x8ff9('0x26')](_0x5a1116);};}var utilLicense=require(_0x8ff9('0x15'));exports[_0x8ff9('0x27')]=function(_0x40df52,_0x1207b2){var _0x4ccd5e={'raw':!![],'where':{'id':0x1}},_0x7e1823={};_0x7e1823[_0x8ff9('0x28')]=_[_0x8ff9('0x29')](db[_0x8ff9('0x2a')][_0x8ff9('0x2b')]);_0x7e1823['query']=_[_0x8ff9('0x29')](_0x40df52['query']);_0x7e1823[_0x8ff9('0x2c')]=_[_0x8ff9('0x2d')](_0x7e1823[_0x8ff9('0x28')],_0x7e1823[_0x8ff9('0x2e')]);_0x4ccd5e[_0x8ff9('0x2f')]=_[_0x8ff9('0x2d')](_0x7e1823['model'],qs[_0x8ff9('0x30')](_0x40df52[_0x8ff9('0x2e')][_0x8ff9('0x30')]));_0x4ccd5e[_0x8ff9('0x2f')]=_0x4ccd5e[_0x8ff9('0x2f')][_0x8ff9('0x31')]?_0x4ccd5e['attributes']:_0x7e1823['model'];_0x4ccd5e=_[_0x8ff9('0x32')]({},_0x4ccd5e,_0x40df52['options']);return utilLicense[_0x8ff9('0x33')](_0x4ccd5e)[_0x8ff9('0x21')](respondWithResult(_0x1207b2,null))[_0x8ff9('0x34')](handleError(_0x1207b2,null));};exports[_0x8ff9('0x20')]=function(_0x1f8207,_0x2d2089){if(_0x1f8207['body']['id']){delete _0x1f8207[_0x8ff9('0x35')]['id'];}return db[_0x8ff9('0x2a')][_0x8ff9('0x36')]({'where':{'id':_0x1f8207[_0x8ff9('0x37')]['id']}})['then'](handleEntityNotFound(_0x2d2089,null))[_0x8ff9('0x21')](function(_0x468d5d){var _0x1dc393=_0x468d5d[_0x8ff9('0x38')]({'plain':!![]});return utilLicense[_0x8ff9('0x39')](_0x1dc393,_0x1f8207[_0x8ff9('0x35')][_0x8ff9('0x3a')]);})[_0x8ff9('0x21')](function(_0x5ac4b1){if(!_0x5ac4b1[_0x8ff9('0x3b')]){return saveUpdates(_0x1f8207[_0x8ff9('0x35')],null);}return _0x5ac4b1;})['then'](respondWithResult(_0x2d2089,null))['catch'](handleError(_0x2d2089,null));}; \ No newline at end of file +var _0xc23a=['sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','destroy','error','name','send','index','model','keys','License','rawAttributes','query','filters','attributes','fields','options','getLicense','then','catch','body','find','params','checkLicense','key','demo','eml-format','rimraf','zip-dir','request-promise','mustache','path'];(function(_0x1b1365,_0x205568){var _0x5edfd8=function(_0xae9b3d){while(--_0xae9b3d){_0x1b1365['push'](_0x1b1365['shift']());}};_0x5edfd8(++_0x205568);}(_0xc23a,0xd2));var _0xac23=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0xc23a[_0x2cef86];return _0x46dfd6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xac23('0x0'));var rimraf=require(_0xac23('0x1'));var zipdir=require(_0xac23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac23('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xac23('0x4'));var util=require('util');var path=require(_0xac23('0x5'));var sox=require(_0xac23('0x6'));var csv=require(_0xac23('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac23('0x8'));var crypto=require(_0xac23('0x9'));var jsforce=require(_0xac23('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xac23('0x7'));var querystring=require(_0xac23('0xb'));var Papa=require(_0xac23('0xc'));var Redis=require(_0xac23('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac23('0xe'));var logger=require(_0xac23('0xf'))('api');var utils=require(_0xac23('0x10'));var config=require(_0xac23('0x11'));var licenseUtil=require(_0xac23('0x12'));var db=require(_0xac23('0x13'))['db'];function respondWithStatusCode(_0x261ee1,_0x4340db){_0x4340db=_0x4340db||0xcc;return function(_0x375024){if(_0x375024){return _0x261ee1[_0xac23('0x14')](_0x4340db);}return _0x261ee1[_0xac23('0x15')](_0x4340db)[_0xac23('0x16')]();};}function respondWithResult(_0x4d36dd,_0x16f660){_0x16f660=_0x16f660||0xc8;return function(_0x391add){if(_0x391add){return _0x4d36dd['status'](_0x16f660)['json'](_0x391add);}};}function respondWithFilteredResult(_0x110bef,_0x21d5ee){return function(_0x618735){if(_0x618735){var _0x49fa85=_0x618735[_0xac23('0x17')],_0x138548=_0x21d5ee['offset'],_0x1c117f=_0x21d5ee[_0xac23('0x18')]+_0x21d5ee[_0xac23('0x19')],_0xaf49de;if(_0x1c117f>=_0x49fa85){_0x1c117f=_0x49fa85;_0xaf49de=0xc8;}else{_0xaf49de=0xce;}_0x110bef[_0xac23('0x15')](_0xaf49de);return _0x110bef['set']('Content-Range',_0x138548+'-'+_0x1c117f+'/'+_0x49fa85)[_0xac23('0x1a')](_0x618735);}return null;};}function patchUpdates(_0x2d1ac1){return function(_0x3fae55){try{jsonpatch[_0xac23('0x1b')](_0x3fae55,_0x2d1ac1,!![]);}catch(_0x52dc23){return BPromise[_0xac23('0x1c')](_0x52dc23);}return _0x3fae55[_0xac23('0x1d')]();};}function saveUpdates(_0x34c6b8,_0xd39dc2){return function(_0x127555){if(_0x127555){return _0x127555[_0xac23('0x1e')](_0x34c6b8)['then'](function(_0x2a42a2){return _0x2a42a2;});}return null;};}function removeEntity(_0x1b2a89,_0xcdbf38){return function(_0x4697ab){if(_0x4697ab){return _0x4697ab[_0xac23('0x1f')]()['then'](function(){_0x1b2a89[_0xac23('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33bed2,_0x9239d6){return function(_0x3cfa4a){if(!_0x3cfa4a){_0x33bed2[_0xac23('0x14')](0x194);}return _0x3cfa4a;};}function handleError(_0x3f1e14,_0x281356){_0x281356=_0x281356||0x1f4;return function(_0x58de43){logger[_0xac23('0x20')](_0x58de43['stack']);if(_0x58de43[_0xac23('0x21')]){delete _0x58de43[_0xac23('0x21')];}_0x3f1e14[_0xac23('0x15')](_0x281356)[_0xac23('0x22')](_0x58de43);};}var utilLicense=require(_0xac23('0x12'));exports[_0xac23('0x23')]=function(_0x625160,_0x2190f8){var _0x29375f={'raw':!![],'where':{'id':0x1}},_0x8ea71={};_0x8ea71[_0xac23('0x24')]=_[_0xac23('0x25')](db[_0xac23('0x26')][_0xac23('0x27')]);_0x8ea71[_0xac23('0x28')]=_['keys'](_0x625160['query']);_0x8ea71[_0xac23('0x29')]=_['intersection'](_0x8ea71['model'],_0x8ea71[_0xac23('0x28')]);_0x29375f[_0xac23('0x2a')]=_['intersection'](_0x8ea71['model'],qs[_0xac23('0x2b')](_0x625160['query']['fields']));_0x29375f[_0xac23('0x2a')]=_0x29375f[_0xac23('0x2a')]['length']?_0x29375f[_0xac23('0x2a')]:_0x8ea71[_0xac23('0x24')];_0x29375f=_['merge']({},_0x29375f,_0x625160[_0xac23('0x2c')]);return utilLicense[_0xac23('0x2d')](_0x29375f)[_0xac23('0x2e')](respondWithResult(_0x2190f8,null))[_0xac23('0x2f')](handleError(_0x2190f8,null));};exports['update']=function(_0x2f71e1,_0x57dd7d){if(_0x2f71e1[_0xac23('0x30')]['id']){delete _0x2f71e1[_0xac23('0x30')]['id'];}return db[_0xac23('0x26')][_0xac23('0x31')]({'where':{'id':_0x2f71e1[_0xac23('0x32')]['id']}})[_0xac23('0x2e')](handleEntityNotFound(_0x57dd7d,null))[_0xac23('0x2e')](function(_0x176a85){var _0x485354=_0x176a85['get']({'plain':!![]});return utilLicense[_0xac23('0x33')](_0x485354,_0x2f71e1[_0xac23('0x30')][_0xac23('0x34')]);})['then'](function(_0xd6ef6b){if(!_0xd6ef6b[_0xac23('0x35')]){return saveUpdates(_0x2f71e1[_0xac23('0x30')],null);}return _0xd6ef6b;})[_0xac23('0x2e')](respondWithResult(_0x57dd7d,null))['catch'](handleError(_0x57dd7d,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 369e886..9ce253b 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 _0xb941=['bluebird','rimraf','../../config/environment','./license.attributes','exports','License','lodash','util','../../config/logger','moment'];(function(_0x212098,_0x4322a1){var _0xe48443=function(_0x33c06d){while(--_0x33c06d){_0x212098['push'](_0x212098['shift']());}};_0xe48443(++_0x4322a1);}(_0xb941,0x7e));var _0x1b94=function(_0x252cc2,_0x1d343f){_0x252cc2=_0x252cc2-0x0;var _0xc53f00=_0xb941[_0x252cc2];return _0xc53f00;};'use strict';var _=require(_0x1b94('0x0'));var util=require(_0x1b94('0x1'));var logger=require(_0x1b94('0x2'))('api');var moment=require(_0x1b94('0x3'));var BPromise=require(_0x1b94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b94('0x5'));var config=require(_0x1b94('0x6'));var attributes=require(_0x1b94('0x7'));module[_0x1b94('0x8')]=function(_0x2dd182,_0x218356){return _0x2dd182['define'](_0x1b94('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe747=['request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','lodash','util','api'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xe747,0x13d));var _0x7e74=function(_0x1d80e6,_0x28a8b0){_0x1d80e6=_0x1d80e6-0x0;var _0x3d651d=_0xe747[_0x1d80e6];return _0x3d651d;};'use strict';var _=require(_0x7e74('0x0'));var util=require(_0x7e74('0x1'));var logger=require('../../config/logger')(_0x7e74('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e74('0x3'));var fs=require('fs');var path=require(_0x7e74('0x4'));var rimraf=require(_0x7e74('0x5'));var config=require(_0x7e74('0x6'));var attributes=require(_0x7e74('0x7'));module['exports']=function(_0x33b887,_0x141853){return _0x33b887[_0x7e74('0x8')](_0x7e74('0x9'),attributes,{'tableName':'license','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 1e5b2b6..bfc4a54 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 _0x3aa2=['lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aa2,0x13b));var _0x23aa=function(_0x571852,_0x34ae1f){_0x571852=_0x571852-0x0;var _0x1ec365=_0x3aa2[_0x571852];return _0x1ec365;};'use strict';var _=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var moment=require('moment');var BPromise=require(_0x23aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23aa('0x3'))['db'];var utils=require(_0x23aa('0x4'));var logger=require('../../config/logger')(_0x23aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x23aa('0x6'));var client=jayson[_0x23aa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461bde,_0xacc1a7,_0x31e9e4){return new BPromise(function(_0x5f3efd,_0x41bfc5){return client[_0x23aa('0x8')](_0x461bde,_0x31e9e4)[_0x23aa('0x9')](function(_0x5c2595){logger['info'](_0x23aa('0xa'),_0xacc1a7,'request\x20sent');logger[_0x23aa('0xb')](_0x23aa('0xc'),_0xacc1a7,_0x23aa('0xd'),JSON[_0x23aa('0xe')](_0x5c2595));if(_0x5c2595[_0x23aa('0xf')]){if(_0x5c2595[_0x23aa('0xf')][_0x23aa('0x10')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0xacc1a7,_0x5c2595['error'][_0x23aa('0x11')]);return _0x41bfc5(_0x5c2595[_0x23aa('0xf')][_0x23aa('0x11')]);}logger[_0x23aa('0xf')](_0x23aa('0xa'),_0xacc1a7,_0x5c2595[_0x23aa('0xf')][_0x23aa('0x11')]);return _0x5f3efd(_0x5c2595[_0x23aa('0xf')]['message']);}else{logger[_0x23aa('0x12')]('License,\x20%s,\x20%s',_0xacc1a7,'request\x20sent');_0x5f3efd(_0x5c2595[_0x23aa('0x13')][_0x23aa('0x11')]);}})[_0x23aa('0x14')](function(_0x4300a0){logger[_0x23aa('0xf')](_0x23aa('0xa'),_0xacc1a7,_0x4300a0);_0x41bfc5(_0x4300a0);});});} \ No newline at end of file +var _0x9e5e=['License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0x1752b9,_0xe749ee){var _0x56da6d=function(_0x1000f2){while(--_0x1000f2){_0x1752b9['push'](_0x1752b9['shift']());}};_0x56da6d(++_0xe749ee);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x9e5e[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var moment=require('moment');var BPromise=require(_0xe9e5('0x2'));var rs=require(_0xe9e5('0x3'));var fs=require('fs');var Redis=require(_0xe9e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9e5('0x5'));var logger=require('../../config/logger')(_0xe9e5('0x6'));var config=require(_0xe9e5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe9e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2333df,_0x4e0730,_0x3648a5){return new BPromise(function(_0x2533d8,_0x3c5c1b){return client[_0xe9e5('0x9')](_0x2333df,_0x3648a5)[_0xe9e5('0xa')](function(_0x18a551){logger[_0xe9e5('0xb')](_0xe9e5('0xc'),_0x4e0730,_0xe9e5('0xd'));logger['debug'](_0xe9e5('0xe'),_0x4e0730,_0xe9e5('0xd'),JSON['stringify'](_0x18a551));if(_0x18a551['error']){if(_0x18a551['error']['code']===0x1f4){logger[_0xe9e5('0xf')](_0xe9e5('0xc'),_0x4e0730,_0x18a551[_0xe9e5('0xf')][_0xe9e5('0x10')]);return _0x3c5c1b(_0x18a551[_0xe9e5('0xf')][_0xe9e5('0x10')]);}logger[_0xe9e5('0xf')](_0xe9e5('0xc'),_0x4e0730,_0x18a551[_0xe9e5('0xf')][_0xe9e5('0x10')]);return _0x2533d8(_0x18a551['error'][_0xe9e5('0x10')]);}else{logger[_0xe9e5('0xb')](_0xe9e5('0xc'),_0x4e0730,_0xe9e5('0xd'));_0x2533d8(_0x18a551[_0xe9e5('0x11')][_0xe9e5('0x10')]);}})[_0xe9e5('0x12')](function(_0x293c5b){logger[_0xe9e5('0xf')](_0xe9e5('0xc'),_0x4e0730,_0x293c5b);_0x3c5c1b(_0x293c5b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8ed30cf..0e446d5 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 _0x0283=['/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x2cf6af,_0x310460){var _0x1ee29c=function(_0x1dfd31){while(--_0x1dfd31){_0x2cf6af['push'](_0x2cf6af['shift']());}};_0x1ee29c(++_0x310460);}(_0x0283,0xa2));var _0x3028=function(_0x186020,_0x1fc7f9){_0x186020=_0x186020-0x0;var _0x30380a=_0x0283[_0x186020];return _0x30380a;};'use strict';var multer=require(_0x3028('0x0'));var util=require(_0x3028('0x1'));var path=require(_0x3028('0x2'));var timeout=require('connect-timeout');var express=require(_0x3028('0x3'));var router=express[_0x3028('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3028('0x5'));var controller=require(_0x3028('0x6'));router[_0x3028('0x7')]('/',auth[_0x3028('0x8')](),controller['index']);router[_0x3028('0x7')](_0x3028('0x9'),auth[_0x3028('0x8')](),controller[_0x3028('0xa')]);router[_0x3028('0x7')](_0x3028('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3028('0xc'),auth['isAuthenticated'](),controller[_0x3028('0xd')]);router[_0x3028('0x7')](_0x3028('0xe'),auth[_0x3028('0x8')](),controller['getAnswers']);router[_0x3028('0x7')](_0x3028('0xf'),auth[_0x3028('0x8')](),controller[_0x3028('0x10')]);router['get'](_0x3028('0x11'),auth[_0x3028('0x8')](),controller[_0x3028('0x12')]);router['get']('/:id/interactions',auth[_0x3028('0x8')](),controller['getInteractions']);router[_0x3028('0x7')](_0x3028('0x13'),auth[_0x3028('0x8')](),controller[_0x3028('0x14')]);router['get'](_0x3028('0x15'),auth[_0x3028('0x8')](),controller[_0x3028('0x16')]);router['get'](_0x3028('0x17'),auth[_0x3028('0x8')](),controller[_0x3028('0x18')]);router[_0x3028('0x7')](_0x3028('0x19'),auth[_0x3028('0x8')](),controller['getAgents']);router['post'](_0x3028('0xc'),auth[_0x3028('0x8')](),controller[_0x3028('0x1a')]);router[_0x3028('0x1b')](_0x3028('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x3028('0x1b')]('/',auth[_0x3028('0x8')](),controller[_0x3028('0x1c')]);router['post'](_0x3028('0xf'),auth[_0x3028('0x8')](),controller[_0x3028('0x1d')]);router[_0x3028('0x1b')](_0x3028('0x11'),auth[_0x3028('0x8')](),controller[_0x3028('0x1e')]);router['post'](_0x3028('0x1f'),auth['isAuthenticated'](),controller[_0x3028('0x20')]);router[_0x3028('0x1b')](_0x3028('0x13'),auth[_0x3028('0x8')](),controller[_0x3028('0x21')]);router[_0x3028('0x1b')](_0x3028('0x22'),auth[_0x3028('0x8')](),controller['send']);router[_0x3028('0x1b')](_0x3028('0x19'),auth[_0x3028('0x8')](),controller[_0x3028('0x23')]);router['put'](_0x3028('0xb'),auth['isAuthenticated'](),controller[_0x3028('0x24')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3028('0x25')]);router['delete'](_0x3028('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3028('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x3028('0x27')]);router['delete'](_0x3028('0x11'),auth['isAuthenticated'](),controller[_0x3028('0x28')]);router[_0x3028('0x26')]('/:id',auth[_0x3028('0x8')](),controller[_0x3028('0x29')]);router[_0x3028('0x26')](_0x3028('0x19'),auth[_0x3028('0x8')](),controller[_0x3028('0x2a')]);module[_0x3028('0x2b')]=router; \ No newline at end of file +var _0xad27=['show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','addAgents','/:id','update','delete','removeDispositions','removeAnswers','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xad27,0x7b));var _0x7ad2=function(_0x4e46b0,_0x1eca2b){_0x4e46b0=_0x4e46b0-0x0;var _0x43d295=_0xad27[_0x4e46b0];return _0x43d295;};'use strict';var multer=require(_0x7ad2('0x0'));var util=require(_0x7ad2('0x1'));var path=require(_0x7ad2('0x2'));var timeout=require(_0x7ad2('0x3'));var express=require(_0x7ad2('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7ad2('0x5'));var config=require(_0x7ad2('0x6'));var controller=require(_0x7ad2('0x7'));router[_0x7ad2('0x8')]('/',auth[_0x7ad2('0x9')](),controller[_0x7ad2('0xa')]);router['get']('/describe',auth[_0x7ad2('0x9')](),controller[_0x7ad2('0xb')]);router[_0x7ad2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7ad2('0xc')]);router[_0x7ad2('0x8')](_0x7ad2('0xd'),auth['isAuthenticated'](),controller[_0x7ad2('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7ad2('0xf')]);router[_0x7ad2('0x8')](_0x7ad2('0x10'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x11')]);router[_0x7ad2('0x8')](_0x7ad2('0x12'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x13')]);router['get'](_0x7ad2('0x14'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x15')]);router[_0x7ad2('0x8')]('/:id/applications',auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x16')]);router['get'](_0x7ad2('0x17'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7ad2('0x8')]('/:id/verify',auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x18')]);router['get'](_0x7ad2('0x19'),auth['isAuthenticated'](),controller[_0x7ad2('0x1a')]);router['post'](_0x7ad2('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7ad2('0x1b')](_0x7ad2('0x1c'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x1d')]);router[_0x7ad2('0x1b')]('/',auth['isAuthenticated'](),controller[_0x7ad2('0x1e')]);router['post'](_0x7ad2('0x10'),auth[_0x7ad2('0x9')](),controller['addImap']);router[_0x7ad2('0x1b')]('/:id/out_servers',auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x1f')]);router[_0x7ad2('0x1b')](_0x7ad2('0x14'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x20')]);router['post'](_0x7ad2('0x21'),auth['isAuthenticated'](),controller[_0x7ad2('0x22')]);router[_0x7ad2('0x1b')](_0x7ad2('0x23'),auth['isAuthenticated'](),controller['send']);router[_0x7ad2('0x1b')](_0x7ad2('0x19'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x24')]);router['put'](_0x7ad2('0x25'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x26')]);router[_0x7ad2('0x27')](_0x7ad2('0xd'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x28')]);router[_0x7ad2('0x27')](_0x7ad2('0x1c'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x29')]);router[_0x7ad2('0x27')]('/:id/in_servers',auth[_0x7ad2('0x9')](),controller['removeImap']);router[_0x7ad2('0x27')](_0x7ad2('0x12'),auth[_0x7ad2('0x9')](),controller['removeSmtp']);router['delete'](_0x7ad2('0x25'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x2a')]);router[_0x7ad2('0x27')](_0x7ad2('0x19'),auth[_0x7ad2('0x9')](),controller[_0x7ad2('0x2b')]);module[_0x7ad2('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bf44595..c109461 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 _0x0dc4=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','BOOLEAN','STRING'];(function(_0x2d5ba2,_0x7be95f){var _0x4f9b48=function(_0x3052e6){while(--_0x3052e6){_0x2d5ba2['push'](_0x2d5ba2['shift']());}};_0x4f9b48(++_0x7be95f);}(_0x0dc4,0x11d));var _0x40dc=function(_0x26f4f5,_0x53419e){_0x26f4f5=_0x26f4f5-0x0;var _0x91bf0a=_0x0dc4[_0x26f4f5];return _0x91bf0a;};'use strict';var Sequelize=require('sequelize');module[_0x40dc('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x40dc('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x40dc('0x3')]},'markAsUnread':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x40dc('0x2')],'allowNull':![],'defaultValue':_0x40dc('0x4')},'fontSize':{'type':Sequelize[_0x40dc('0x5')](0x2)[_0x40dc('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x40dc('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40dc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x40dc('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40dc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40dc('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x40dc('0x8'),'set':function(_0x866d00){if(!_0x866d00)this['setDataValue'](_0x40dc('0x9'),null);this[_0x40dc('0xa')](_0x40dc('0xb'),_0x866d00);}}}; \ No newline at end of file +var _0xf5ce=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','STRING'];(function(_0x2d7e09,_0x16be83){var _0x1ba707=function(_0x4d3063){while(--_0x4d3063){_0x2d7e09['push'](_0x2d7e09['shift']());}};_0x1ba707(++_0x16be83);}(_0xf5ce,0x154));var _0xef5c=function(_0x37cbee,_0x1487dd){_0x37cbee=_0x37cbee-0x0;var _0x361d10=_0xf5ce[_0x37cbee];return _0x361d10;};'use strict';var Sequelize=require(_0xef5c('0x0'));module['exports']={'description':{'type':Sequelize[_0xef5c('0x1')]},'name':{'type':Sequelize[_0xef5c('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xef5c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xef5c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xef5c('0x3')]},'markAsUnread':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xef5c('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xef5c('0x4');}},'notificationSound':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef5c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef5c('0x5')],'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['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xef5c('0x2')],'defaultValue':![],'comment':_0xef5c('0x6'),'set':function(_0x34e7bb){if(!_0x34e7bb)this['setDataValue'](_0xef5c('0x7'),null);this[_0xef5c('0x8')]('mandatoryDisposition',_0x34e7bb);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 374c03d..00060f4 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 _0x6978=['userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','limit','Content-Range','apply','reject','save','update','MailAccounts','UserProfileResource','end','sendStatus','stack','name','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','VIRTUAL','filter','merge','options','count','includeAll','rows','show','params','Imap','Pause','include','find','body','Smtp','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','rawAttributes','sort','removeDispositions','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','ids','email','ListId','isNil','active','description','cauthentication','cuser','password','pass','cpassword','authentication','host','port','service','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','destroy','findAndCountAll','priority','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit'];(function(_0x51a348,_0xbefe61){var _0x54f460=function(_0x28c890){while(--_0x28c890){_0x51a348['push'](_0x51a348['shift']());}};_0x54f460(++_0xbefe61);}(_0x6978,0x18e));var _0x8697=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x6978[_0x4ed32d];return _0xf624df;};'use strict';var pdf=require(_0x8697('0x0'));var emlformat=require(_0x8697('0x1'));var rimraf=require(_0x8697('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8697('0x3'));var rp=require(_0x8697('0x4'));var moment=require('moment');var BPromise=require(_0x8697('0x5'));var Mustache=require(_0x8697('0x6'));var util=require(_0x8697('0x7'));var path=require(_0x8697('0x8'));var sox=require(_0x8697('0x9'));var csv=require(_0x8697('0xa'));var ejs=require(_0x8697('0xb'));var fs=require('fs');var _=require(_0x8697('0xc'));var squel=require(_0x8697('0xd'));var crypto=require(_0x8697('0xe'));var jsforce=require(_0x8697('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8697('0xa'));var querystring=require(_0x8697('0x10'));var Papa=require(_0x8697('0x11'));var htmlToText=require(_0x8697('0x12'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x8697('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8697('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8697('0x15'))(_0x8697('0x16'));var utils=require(_0x8697('0x17'));var config=require(_0x8697('0x18'));var licenseUtil=require(_0x8697('0x19'));var db=require(_0x8697('0x1a'))['db'];config[_0x8697('0x1b')]=_[_0x8697('0x1c')](config['redis'],{'host':_0x8697('0x1d'),'port':0x18eb});var socket=require(_0x8697('0x1e'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x8697('0x1f')](socket);var jayson=require(_0x8697('0x20'));var client=jayson[_0x8697('0x21')][_0x8697('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x333327,_0x2807a3,_0x216312,_0x332f56){return new BPromise(function(_0x3eb50e,_0x3cc511){var _0x16238b=_0x332f56||client;return _0x16238b['request'](_0x333327,_0x216312)[_0x8697('0x23')](function(_0x31a4cb){logger[_0x8697('0x24')](_0x8697('0x25'),_0x2807a3,_0x8697('0x26'));logger[_0x8697('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2807a3,'request\x20sent',JSON[_0x8697('0x28')](_0x31a4cb));if(_0x31a4cb[_0x8697('0x29')]){if(_0x31a4cb[_0x8697('0x29')][_0x8697('0x2a')]===0x1f4){logger['error'](_0x8697('0x25'),_0x2807a3,_0x31a4cb[_0x8697('0x29')][_0x8697('0x2b')]);return _0x3cc511(_0x31a4cb['error'][_0x8697('0x2b')]);}logger[_0x8697('0x29')](_0x8697('0x25'),_0x2807a3,_0x31a4cb[_0x8697('0x29')][_0x8697('0x2b')]);return _0x3eb50e(_0x31a4cb['error'][_0x8697('0x2b')]);}else{logger[_0x8697('0x24')](_0x8697('0x25'),_0x2807a3,_0x8697('0x26'));_0x3eb50e(_0x31a4cb['result'][_0x8697('0x2b')]);}})[_0x8697('0x2c')](function(_0x24d675){logger[_0x8697('0x29')](_0x8697('0x25'),_0x2807a3,_0x24d675);_0x3cc511(_0x24d675);});});}function respondWithStatusCode(_0x3a393e,_0x2cd05e){_0x2cd05e=_0x2cd05e||0xcc;return function(_0x9652ce){if(_0x9652ce){return _0x3a393e['sendStatus'](_0x2cd05e);}return _0x3a393e[_0x8697('0x2d')](_0x2cd05e)['end']();};}function respondWithResult(_0x52703b,_0x745dfa){_0x745dfa=_0x745dfa||0xc8;return function(_0x2d27d2){if(_0x2d27d2){return _0x52703b[_0x8697('0x2d')](_0x745dfa)[_0x8697('0x2e')](_0x2d27d2);}};}function respondWithFilteredResult(_0x497330,_0x3c8e70){return function(_0x3b20a3){if(_0x3b20a3){var _0x1d0ce9=_0x3b20a3['count'],_0x385977=_0x3c8e70['offset'],_0x2c35f5=_0x3c8e70['offset']+_0x3c8e70[_0x8697('0x2f')],_0x452fa0;if(_0x2c35f5>=_0x1d0ce9){_0x2c35f5=_0x1d0ce9;_0x452fa0=0xc8;}else{_0x452fa0=0xce;}_0x497330[_0x8697('0x2d')](_0x452fa0);return _0x497330['set'](_0x8697('0x30'),_0x385977+'-'+_0x2c35f5+'/'+_0x1d0ce9)[_0x8697('0x2e')](_0x3b20a3);}return null;};}function patchUpdates(_0xbf09eb){return function(_0x3aba66){try{jsonpatch[_0x8697('0x31')](_0x3aba66,_0xbf09eb,!![]);}catch(_0x58f61d){return BPromise[_0x8697('0x32')](_0x58f61d);}return _0x3aba66[_0x8697('0x33')]();};}function saveUpdates(_0x3675b7,_0x1b9f60){return function(_0x1a216c){if(_0x1a216c){return _0x1a216c[_0x8697('0x34')](_0x3675b7)['then'](function(_0x5e2983){return _0x5e2983;});}return null;};}function removeEntity(_0x1c5a8a,_0x304af4){return function(_0x4a3a69){if(_0x4a3a69){return _0x4a3a69['destroy']()[_0x8697('0x23')](function(){var _0x1a9e30=_0x4a3a69['get']({'plain':!![]});var _0x55678f=_0x8697('0x35');return db[_0x8697('0x36')]['destroy']({'where':{'type':_0x55678f,'resourceId':_0x1a9e30['id']}})['then'](function(){return _0x4a3a69;});})[_0x8697('0x23')](function(){_0x1c5a8a['status'](0xcc)[_0x8697('0x37')]();});}};}function handleEntityNotFound(_0x5a983b,_0x1c216e){return function(_0x5b599b){if(!_0x5b599b){_0x5a983b[_0x8697('0x38')](0x194);}return _0x5b599b;};}function handleError(_0x5e612c,_0x1eaefb){_0x1eaefb=_0x1eaefb||0x1f4;return function(_0x3ed5f4){logger[_0x8697('0x29')](_0x3ed5f4[_0x8697('0x39')]);if(_0x3ed5f4['name']){delete _0x3ed5f4[_0x8697('0x3a')];}_0x5e612c[_0x8697('0x2d')](_0x1eaefb)['send'](_0x3ed5f4);};}exports[_0x8697('0x3b')]=function(_0x5584d0,_0x5bab2b){var _0x783f57={'include':[{'model':db[_0x8697('0x3c')],'as':'Imap'},{'model':db[_0x8697('0x3d')],'as':'Smtp'},{'model':db['Pause'],'as':_0x8697('0x3e')}]},_0x5b9708={},_0x4d3c70={'count':0x0,'rows':[]};var _0x3ad6c0=_[_0x8697('0x3f')](db[_0x8697('0x40')]['rawAttributes'],function(_0x49f51e){return{'name':_0x49f51e['fieldName'],'type':_0x49f51e[_0x8697('0x41')][_0x8697('0x42')]};});_0x5b9708[_0x8697('0x43')]=_[_0x8697('0x3f')](_0x3ad6c0,_0x8697('0x3a'));_0x5b9708[_0x8697('0x44')]=_[_0x8697('0x45')](_0x5584d0['query']);_0x5b9708[_0x8697('0x46')]=_['intersection'](_0x5b9708['model'],_0x5b9708['query']);_0x783f57[_0x8697('0x47')]=_[_0x8697('0x48')](_0x5b9708[_0x8697('0x43')],qs[_0x8697('0x49')](_0x5584d0['query'][_0x8697('0x49')]));_0x783f57['attributes']=_0x783f57[_0x8697('0x47')][_0x8697('0x4a')]?_0x783f57[_0x8697('0x47')]:_0x5b9708[_0x8697('0x43')];if(!_0x5584d0[_0x8697('0x44')][_0x8697('0x4b')](_0x8697('0x4c'))){_0x783f57[_0x8697('0x2f')]=qs[_0x8697('0x2f')](_0x5584d0[_0x8697('0x44')]['limit']);_0x783f57[_0x8697('0x4d')]=qs[_0x8697('0x4d')](_0x5584d0['query'][_0x8697('0x4d')]);}_0x783f57[_0x8697('0x4e')]=qs['sort'](_0x5584d0['query']['sort']);_0x783f57[_0x8697('0x4f')]=qs[_0x8697('0x46')](_[_0x8697('0x50')](_0x5584d0['query'],_0x5b9708[_0x8697('0x46')]),_0x3ad6c0);if(_0x5584d0[_0x8697('0x44')]['filter']){_0x783f57[_0x8697('0x4f')]=_['merge'](_0x783f57['where'],{'$or':_[_0x8697('0x3f')](_0x3ad6c0,function(_0xfc7c1e){if(_0xfc7c1e['type']!==_0x8697('0x51')){var _0x282728={};_0x282728[_0xfc7c1e['name']]={'$like':'%'+_0x5584d0[_0x8697('0x44')][_0x8697('0x52')]+'%'};return _0x282728;}})});}_0x783f57=_[_0x8697('0x53')]({},_0x783f57,_0x5584d0[_0x8697('0x54')]);var _0x2d161a={'where':_0x783f57[_0x8697('0x4f')]};return db['MailAccount']['count'](_0x2d161a)[_0x8697('0x23')](function(_0x1f47a1){_0x4d3c70[_0x8697('0x55')]=_0x1f47a1;if(_0x5584d0[_0x8697('0x44')][_0x8697('0x56')]){_0x783f57['include']=[{'all':!![]}];}return db[_0x8697('0x40')]['findAll'](_0x783f57);})[_0x8697('0x23')](function(_0x57a9c0){_0x4d3c70[_0x8697('0x57')]=_0x57a9c0;return _0x4d3c70;})[_0x8697('0x23')](respondWithFilteredResult(_0x5bab2b,_0x783f57))['catch'](handleError(_0x5bab2b,null));};exports[_0x8697('0x58')]=function(_0x7e1924,_0x55e31a){var _0x5832ae={'raw':![],'where':{'id':_0x7e1924[_0x8697('0x59')]['id']},'include':[{'model':db[_0x8697('0x3c')],'as':_0x8697('0x5a')},{'model':db[_0x8697('0x3d')],'as':'Smtp'},{'model':db[_0x8697('0x5b')],'as':_0x8697('0x3e')}]},_0x133fb8={};_0x133fb8[_0x8697('0x43')]=_[_0x8697('0x45')](db[_0x8697('0x40')]['rawAttributes']);_0x133fb8[_0x8697('0x44')]=_[_0x8697('0x45')](_0x7e1924[_0x8697('0x44')]);_0x133fb8['filters']=_[_0x8697('0x48')](_0x133fb8[_0x8697('0x43')],_0x133fb8[_0x8697('0x44')]);_0x5832ae[_0x8697('0x47')]=_[_0x8697('0x48')](_0x133fb8[_0x8697('0x43')],qs[_0x8697('0x49')](_0x7e1924[_0x8697('0x44')][_0x8697('0x49')]));_0x5832ae[_0x8697('0x47')]=_0x5832ae[_0x8697('0x47')][_0x8697('0x4a')]?_0x5832ae[_0x8697('0x47')]:_0x133fb8['model'];if(_0x7e1924[_0x8697('0x44')]['includeAll']){_0x5832ae[_0x8697('0x5c')]=[{'all':!![]}];}_0x5832ae=_['merge']({},_0x5832ae,_0x7e1924[_0x8697('0x54')]);return db['MailAccount'][_0x8697('0x5d')](_0x5832ae)[_0x8697('0x23')](handleEntityNotFound(_0x55e31a,null))[_0x8697('0x23')](respondWithResult(_0x55e31a,null))[_0x8697('0x2c')](handleError(_0x55e31a,null));};exports[_0x8697('0x34')]=function(_0x1f5b6c,_0x2e8810){if(_0x1f5b6c[_0x8697('0x5e')]['id']){delete _0x1f5b6c[_0x8697('0x5e')]['id'];}return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x1f5b6c[_0x8697('0x59')]['id']},'include':[{'model':db[_0x8697('0x3c')],'as':'Imap'},{'model':db[_0x8697('0x3d')],'as':'Smtp'},{'model':db[_0x8697('0x5b')],'as':_0x8697('0x3e')}]})[_0x8697('0x23')](handleEntityNotFound(_0x2e8810,null))[_0x8697('0x23')](saveUpdates(_0x1f5b6c['body'],null))[_0x8697('0x23')](function(_0x28b4c1){if(_0x28b4c1&&_0x1f5b6c[_0x8697('0x5e')]['Imap']){return db['MailServerIn'][_0x8697('0x34')](_0x1f5b6c[_0x8697('0x5e')][_0x8697('0x5a')],{'where':{'MailAccountId':_0x28b4c1['id']}})[_0x8697('0x23')](function(){return _0x28b4c1;});}return _0x28b4c1;})[_0x8697('0x23')](function(_0x32778f){if(_0x32778f&&_0x1f5b6c[_0x8697('0x5e')][_0x8697('0x5f')]){return db[_0x8697('0x3d')][_0x8697('0x34')](_0x1f5b6c[_0x8697('0x5e')][_0x8697('0x5f')],{'where':{'MailAccountId':_0x32778f['id']}})[_0x8697('0x23')](function(){return _0x32778f;});}return _0x32778f;})['then'](respondWithResult(_0x2e8810,null))[_0x8697('0x2c')](handleError(_0x2e8810,null));};exports[_0x8697('0x60')]=function(_0x515344,_0x2b1c7e){return db[_0x8697('0x40')][_0x8697('0x60')]()['then'](respondWithResult(_0x2b1c7e,null))[_0x8697('0x2c')](handleError(_0x2b1c7e,null));};exports[_0x8697('0x61')]=function(_0x4f430c,_0x453258,_0x240ec){if(_0x4f430c['body']['id']){delete _0x4f430c['body']['id'];}return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x4f430c[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x453258,null))[_0x8697('0x23')](function(_0xabb9ce){if(_0xabb9ce){_0x4f430c['body'][_0x8697('0x62')]=_0xabb9ce['id'];return db[_0x8697('0x63')][_0x8697('0x64')](_0x4f430c[_0x8697('0x5e')]);}})[_0x8697('0x23')](respondWithResult(_0x453258,null))[_0x8697('0x2c')](handleError(_0x453258,null));};exports[_0x8697('0x65')]=function(_0x5e7884,_0x5c74c9,_0x2cc585){var _0x319e86={'raw':![],'where':{}};var _0x26f9b6={};var _0x1a3901={'count':0x0,'rows':[]};return db[_0x8697('0x40')]['findOne']({'where':{'id':_0x5e7884[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x5c74c9,null))[_0x8697('0x23')](function(_0x15fc78){if(_0x15fc78){_0x26f9b6['model']=_['keys'](db[_0x8697('0x63')][_0x8697('0x66')]);_0x26f9b6[_0x8697('0x44')]=_[_0x8697('0x45')](_0x5e7884[_0x8697('0x44')]);_0x26f9b6[_0x8697('0x46')]=_['intersection'](_0x26f9b6[_0x8697('0x43')],_0x26f9b6[_0x8697('0x44')]);_0x319e86['attributes']=_[_0x8697('0x48')](_0x26f9b6[_0x8697('0x43')],qs[_0x8697('0x49')](_0x5e7884[_0x8697('0x44')][_0x8697('0x49')]));_0x319e86[_0x8697('0x47')]=_0x319e86[_0x8697('0x47')][_0x8697('0x4a')]?_0x319e86['attributes']:_0x26f9b6[_0x8697('0x43')];if(!_0x5e7884[_0x8697('0x44')][_0x8697('0x4b')](_0x8697('0x4c'))){_0x319e86['limit']=qs[_0x8697('0x2f')](_0x5e7884[_0x8697('0x44')][_0x8697('0x2f')]);_0x319e86['offset']=qs[_0x8697('0x4d')](_0x5e7884[_0x8697('0x44')][_0x8697('0x4d')]);}_0x319e86[_0x8697('0x4e')]=qs[_0x8697('0x67')](_0x5e7884['query'][_0x8697('0x67')]);_0x319e86[_0x8697('0x4f')]=qs[_0x8697('0x46')](_[_0x8697('0x50')](_0x5e7884[_0x8697('0x44')],_0x26f9b6[_0x8697('0x46')]));_0x319e86[_0x8697('0x4f')]['MailAccountId']=_0x15fc78['id'];if(_0x5e7884[_0x8697('0x44')][_0x8697('0x52')]){_0x319e86[_0x8697('0x4f')]=_['merge'](_0x319e86[_0x8697('0x4f')],{'$or':_[_0x8697('0x3f')](_0x319e86[_0x8697('0x47')],function(_0x516e46){var _0x5cb9e4={};_0x5cb9e4[_0x516e46]={'$like':'%'+_0x5e7884['query'][_0x8697('0x52')]+'%'};return _0x5cb9e4;})});}_0x319e86=_['merge']({},_0x319e86,_0x5e7884['options']);return db['Disposition'][_0x8697('0x55')]({'where':_0x319e86[_0x8697('0x4f')]})[_0x8697('0x23')](function(_0x47988e){_0x1a3901[_0x8697('0x55')]=_0x47988e;if(_0x5e7884[_0x8697('0x44')][_0x8697('0x56')]){_0x319e86['include']=[{'all':!![]}];}return db[_0x8697('0x63')]['findAll'](_0x319e86);})[_0x8697('0x23')](function(_0x3ea60e){_0x1a3901[_0x8697('0x57')]=_0x3ea60e;return _0x1a3901;});}})['then'](respondWithFilteredResult(_0x5c74c9,_0x319e86))['catch'](handleError(_0x5c74c9,null));};exports[_0x8697('0x68')]=function(_0x14a21e,_0x5f4b03,_0x26bc4e){return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x14a21e[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x5f4b03,null))['then'](function(_0x24c309){if(_0x24c309){return _0x24c309[_0x8697('0x68')](_0x14a21e[_0x8697('0x44')]['ids']);}})[_0x8697('0x23')](respondWithStatusCode(_0x5f4b03,null))[_0x8697('0x2c')](handleError(_0x5f4b03,null));};exports['addAnswer']=function(_0x3d3766,_0x4878f8,_0xe8b5f){if(_0x3d3766[_0x8697('0x5e')]['id']){delete _0x3d3766['body']['id'];}return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x3d3766[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x4878f8,null))[_0x8697('0x23')](function(_0x5b7693){if(_0x5b7693){_0x3d3766[_0x8697('0x5e')][_0x8697('0x62')]=_0x5b7693['id'];return db[_0x8697('0x69')]['create'](_0x3d3766['body']);}})['then'](respondWithResult(_0x4878f8,null))['catch'](handleError(_0x4878f8,null));};exports[_0x8697('0x6a')]=function(_0x38ada0,_0x23755a,_0x46b15c){var _0x174d0a={'raw':![],'where':{}};var _0x23f8bf={};var _0x8fa6c0={'count':0x0,'rows':[]};return db[_0x8697('0x40')][_0x8697('0x6b')]({'where':{'id':_0x38ada0[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x23755a,null))[_0x8697('0x23')](function(_0x51b4e3){if(_0x51b4e3){_0x23f8bf[_0x8697('0x43')]=_[_0x8697('0x45')](db['CannedAnswer'][_0x8697('0x66')]);_0x23f8bf[_0x8697('0x44')]=_['keys'](_0x38ada0[_0x8697('0x44')]);_0x23f8bf[_0x8697('0x46')]=_[_0x8697('0x48')](_0x23f8bf[_0x8697('0x43')],_0x23f8bf[_0x8697('0x44')]);_0x174d0a[_0x8697('0x47')]=_[_0x8697('0x48')](_0x23f8bf[_0x8697('0x43')],qs[_0x8697('0x49')](_0x38ada0['query']['fields']));_0x174d0a[_0x8697('0x47')]=_0x174d0a[_0x8697('0x47')][_0x8697('0x4a')]?_0x174d0a[_0x8697('0x47')]:_0x23f8bf[_0x8697('0x43')];if(!_0x38ada0[_0x8697('0x44')]['hasOwnProperty']('nolimit')){_0x174d0a['limit']=qs[_0x8697('0x2f')](_0x38ada0[_0x8697('0x44')][_0x8697('0x2f')]);_0x174d0a['offset']=qs[_0x8697('0x4d')](_0x38ada0[_0x8697('0x44')][_0x8697('0x4d')]);}_0x174d0a['order']=qs[_0x8697('0x67')](_0x38ada0[_0x8697('0x44')][_0x8697('0x67')]);_0x174d0a[_0x8697('0x4f')]=qs[_0x8697('0x46')](_[_0x8697('0x50')](_0x38ada0[_0x8697('0x44')],_0x23f8bf[_0x8697('0x46')]));_0x174d0a['where'][_0x8697('0x62')]=_0x51b4e3['id'];if(_0x38ada0[_0x8697('0x44')][_0x8697('0x52')]){_0x174d0a['where']=_[_0x8697('0x53')](_0x174d0a[_0x8697('0x4f')],{'$or':_[_0x8697('0x3f')](_0x174d0a['attributes'],function(_0x489263){var _0x3ff563={};_0x3ff563[_0x489263]={'$like':'%'+_0x38ada0[_0x8697('0x44')][_0x8697('0x52')]+'%'};return _0x3ff563;})});}_0x174d0a=_[_0x8697('0x53')]({},_0x174d0a,_0x38ada0[_0x8697('0x54')]);return db[_0x8697('0x69')]['count']({'where':_0x174d0a[_0x8697('0x4f')]})['then'](function(_0x153c0b){_0x8fa6c0[_0x8697('0x55')]=_0x153c0b;if(_0x38ada0[_0x8697('0x44')][_0x8697('0x56')]){_0x174d0a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x8697('0x6c')](_0x174d0a);})[_0x8697('0x23')](function(_0xff2065){_0x8fa6c0[_0x8697('0x57')]=_0xff2065;return _0x8fa6c0;});}})['then'](respondWithFilteredResult(_0x23755a,_0x174d0a))[_0x8697('0x2c')](handleError(_0x23755a,null));};exports['removeAnswers']=function(_0x45c7e3,_0x45d441,_0x5595ac){return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x45c7e3['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x45d441,null))['then'](function(_0x3a5731){if(_0x3a5731){return _0x3a5731[_0x8697('0x6d')](_0x45c7e3[_0x8697('0x44')][_0x8697('0x6e')]);}})[_0x8697('0x23')](respondWithStatusCode(_0x45d441,null))[_0x8697('0x2c')](handleError(_0x45d441,null));};exports[_0x8697('0x64')]=function(_0x2e05a6,_0x290215){var _0x3b8aeb={'name':_0x2e05a6[_0x8697('0x5e')]['name'],'key':_0x2e05a6[_0x8697('0x5e')][_0x8697('0x42')],'email':_0x2e05a6[_0x8697('0x5e')][_0x8697('0x6f')],'ListId':_0x2e05a6['body'][_0x8697('0x70')],'active':!_[_0x8697('0x71')](_0x2e05a6[_0x8697('0x5e')][_0x8697('0x72')])?_0x2e05a6[_0x8697('0x5e')][_0x8697('0x72')]:!![],'description':_0x2e05a6[_0x8697('0x5e')][_0x8697('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x8697('0x71')](_0x2e05a6[_0x8697('0x5e')]['cservice'])){if(_0x2e05a6['body'][_0x8697('0x74')]){_0x3b8aeb[_0x8697('0x5a')]['user']=_0x3b8aeb[_0x8697('0x5f')]['user']=_0x2e05a6['body'][_0x8697('0x75')];_0x3b8aeb['Imap'][_0x8697('0x76')]=_0x3b8aeb[_0x8697('0x5f')][_0x8697('0x77')]=_0x2e05a6[_0x8697('0x5e')][_0x8697('0x78')];}else{_0x3b8aeb[_0x8697('0x5a')][_0x8697('0x79')]=_0x3b8aeb[_0x8697('0x5f')][_0x8697('0x79')]=![];}_0x3b8aeb[_0x8697('0x5a')][_0x8697('0x7a')]=_0x2e05a6[_0x8697('0x5e')]['Imap'][_0x8697('0x7a')];_0x3b8aeb['Imap'][_0x8697('0x7b')]=_0x2e05a6[_0x8697('0x5e')][_0x8697('0x5a')][_0x8697('0x7b')];_0x3b8aeb[_0x8697('0x5f')]['host']=_0x2e05a6[_0x8697('0x5e')][_0x8697('0x5f')][_0x8697('0x7a')];_0x3b8aeb[_0x8697('0x5f')]['port']=_0x2e05a6[_0x8697('0x5e')]['Smtp'][_0x8697('0x7b')];}else{_0x3b8aeb[_0x8697('0x5a')]['service']=_0x3b8aeb[_0x8697('0x5f')][_0x8697('0x7c')]=_0x2e05a6[_0x8697('0x5e')]['cservice'];_0x3b8aeb['Imap'][_0x8697('0x7d')]=_0x3b8aeb[_0x8697('0x5f')][_0x8697('0x7d')]=_0x2e05a6[_0x8697('0x5e')][_0x8697('0x75')];_0x3b8aeb[_0x8697('0x5a')]['password']=_0x3b8aeb[_0x8697('0x5f')][_0x8697('0x77')]=_0x2e05a6[_0x8697('0x5e')][_0x8697('0x78')];}return db[_0x8697('0x40')]['create'](_0x3b8aeb,{'include':[{'model':db[_0x8697('0x3d')],'as':'Smtp'},{'model':db[_0x8697('0x3c')],'as':_0x8697('0x5a')}]})['then'](function(_0x569ad6){var _0x39c9ae=_0x2e05a6[_0x8697('0x7d')][_0x8697('0x7e')]({'plain':!![]});if(!_0x39c9ae)throw new Error(_0x8697('0x7f'));if(_0x39c9ae[_0x8697('0x80')]==='user'){var _0xc646eb=_0x569ad6[_0x8697('0x7e')]({'plain':!![]});return db[_0x8697('0x81')]['find']({'where':{'name':_0x8697('0x35'),'userProfileId':_0x39c9ae[_0x8697('0x82')]},'raw':!![]})['then'](function(_0x4eb44a){if(_0x4eb44a&&_0x4eb44a[_0x8697('0x83')]===0x0){return db[_0x8697('0x36')][_0x8697('0x64')]({'name':_0xc646eb[_0x8697('0x3a')],'resourceId':_0xc646eb['id'],'type':_0x4eb44a['name'],'sectionId':_0x4eb44a['id']},{})[_0x8697('0x23')](function(){return _0x569ad6;});}else{return _0x569ad6;}})[_0x8697('0x2c')](function(_0x3b01a7){logger[_0x8697('0x29')](_0x8697('0x84'),_0x3b01a7);throw _0x3b01a7;});}return _0x569ad6;})[_0x8697('0x23')](respondWithResult(_0x290215,0xc9))[_0x8697('0x2c')](handleError(_0x290215,null));};exports[_0x8697('0x85')]=function(_0x2069da,_0x100c96,_0x3fd374){return db[_0x8697('0x40')][_0x8697('0x6b')]({'where':{'id':_0x2069da[_0x8697('0x59')]['id']}})['then'](handleEntityNotFound(_0x100c96,null))['then'](function(_0x1934fc){if(_0x1934fc){return _0x1934fc[_0x8697('0x85')]();}return null;})['then'](respondWithResult(_0x100c96,null))[_0x8697('0x2c')](handleError(_0x100c96,null));};exports[_0x8697('0x86')]=function(_0x5af148,_0x82f3cd,_0x2e7886){if(_0x5af148[_0x8697('0x5e')]['id']){delete _0x5af148[_0x8697('0x5e')]['id'];}return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x5af148[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x82f3cd,null))['then'](function(_0x27a5a9){if(_0x27a5a9){_0x5af148[_0x8697('0x5e')][_0x8697('0x62')]=_0x27a5a9['id'];return db[_0x8697('0x3c')][_0x8697('0x64')](_0x5af148[_0x8697('0x5e')]);}})['then'](respondWithResult(_0x82f3cd,null))['catch'](handleError(_0x82f3cd,null));};exports['removeImap']=function(_0x488bdc,_0x1be6b4,_0x2265f1){return db[_0x8697('0x40')]['findOne']({'where':{'id':_0x488bdc[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x1be6b4,null))['then'](function(_0xf6980a){if(_0xf6980a){return _0xf6980a[_0x8697('0x87')](null);}return null;})[_0x8697('0x23')](respondWithStatusCode(_0x1be6b4,null))['catch'](handleError(_0x1be6b4,null));};exports['getSmtp']=function(_0x3c1078,_0x51b143,_0x232ff3){return db['MailAccount'][_0x8697('0x6b')]({'where':{'id':_0x3c1078['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x51b143,null))[_0x8697('0x23')](function(_0x1dd9e8){if(_0x1dd9e8){return _0x1dd9e8[_0x8697('0x88')]();}return null;})[_0x8697('0x23')](respondWithResult(_0x51b143,null))[_0x8697('0x2c')](handleError(_0x51b143,null));};exports['addSmtp']=function(_0x51100f,_0x39460e,_0x32c770){if(_0x51100f[_0x8697('0x5e')]['id']){delete _0x51100f[_0x8697('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x51100f['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x39460e,null))[_0x8697('0x23')](function(_0x3cf2c9){if(_0x3cf2c9){_0x51100f[_0x8697('0x5e')][_0x8697('0x62')]=_0x3cf2c9['id'];return db['MailServerOut'][_0x8697('0x64')](_0x51100f[_0x8697('0x5e')]);}})['then'](respondWithResult(_0x39460e,null))['catch'](handleError(_0x39460e,null));};exports[_0x8697('0x89')]=function(_0x45dfa3,_0x27ebb2,_0x667d05){return db[_0x8697('0x40')][_0x8697('0x6b')]({'where':{'id':_0x45dfa3[_0x8697('0x59')]['id']}})['then'](handleEntityNotFound(_0x27ebb2,null))[_0x8697('0x23')](function(_0x22ad97){if(_0x22ad97){return _0x22ad97[_0x8697('0x8a')](null);}return null;})[_0x8697('0x23')](respondWithStatusCode(_0x27ebb2,null))[_0x8697('0x2c')](handleError(_0x27ebb2,null));};exports['addInteraction']=function(_0x5d04e9,_0x37c720,_0x4171e8){return db[_0x8697('0x8b')]['find']({'where':{'id':_0x5d04e9[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x37c720,null))[_0x8697('0x23')](function(_0x25b165){if(_0x25b165){return _0x25b165[_0x8697('0x8c')](_0x5d04e9[_0x8697('0x5e')][_0x8697('0x6e')],_[_0x8697('0x8d')](_0x5d04e9[_0x8697('0x5e')],[_0x8697('0x6e'),'id'])||{});}})[_0x8697('0x23')](respondWithResult(_0x37c720,null))[_0x8697('0x2c')](handleError(_0x37c720,null));};exports[_0x8697('0x8e')]=function(_0x4c835f,_0x2de608,_0x4bcaff){var _0x232648={'raw':![],'where':{}};var _0x395d68={};var _0x5cbf79={'count':0x0,'rows':[]};return db['MailAccount'][_0x8697('0x6b')]({'where':{'id':_0x4c835f[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x2de608,null))[_0x8697('0x23')](function(_0x339ffa){if(_0x339ffa){_0x395d68['model']=_[_0x8697('0x45')](db[_0x8697('0x8b')][_0x8697('0x66')]);_0x395d68[_0x8697('0x44')]=_[_0x8697('0x45')](_0x4c835f['query']);_0x395d68[_0x8697('0x46')]=_[_0x8697('0x48')](_0x395d68['model'],_0x395d68[_0x8697('0x44')]);_0x232648[_0x8697('0x47')]=_[_0x8697('0x48')](_0x395d68[_0x8697('0x43')],qs[_0x8697('0x49')](_0x4c835f[_0x8697('0x44')][_0x8697('0x49')]));_0x232648['attributes']=_0x232648[_0x8697('0x47')][_0x8697('0x4a')]?_0x232648[_0x8697('0x47')]:_0x395d68[_0x8697('0x43')];if(!_0x4c835f[_0x8697('0x44')][_0x8697('0x4b')](_0x8697('0x4c'))){_0x232648[_0x8697('0x2f')]=qs[_0x8697('0x2f')](_0x4c835f[_0x8697('0x44')]['limit']);_0x232648[_0x8697('0x4d')]=qs['offset'](_0x4c835f[_0x8697('0x44')][_0x8697('0x4d')]);}_0x232648[_0x8697('0x4e')]=qs[_0x8697('0x67')](_0x4c835f[_0x8697('0x44')]['sort']);_0x232648[_0x8697('0x4f')]=qs[_0x8697('0x46')](_['pick'](_0x4c835f['query'],_0x395d68[_0x8697('0x46')]));_0x232648[_0x8697('0x4f')][_0x8697('0x62')]=_0x339ffa['id'];if(_0x4c835f['query']['filter']){_0x232648[_0x8697('0x4f')]=_[_0x8697('0x53')](_0x232648['where'],{'$or':_['map'](_0x232648['attributes'],function(_0x239a72){var _0x1e3d3c={};_0x1e3d3c[_0x239a72]={'$like':'%'+_0x4c835f['query'][_0x8697('0x52')]+'%'};return _0x1e3d3c;})});}_0x232648=_[_0x8697('0x53')]({},_0x232648,_0x4c835f[_0x8697('0x54')]);return db['MailInteraction'][_0x8697('0x55')]({'where':_0x232648[_0x8697('0x4f')]})[_0x8697('0x23')](function(_0x13526f){_0x5cbf79[_0x8697('0x55')]=_0x13526f;if(_0x4c835f['query']['includeAll']){_0x232648[_0x8697('0x5c')]=[{'model':db['CmContact'],'as':_0x8697('0x8f'),'required':![]},{'model':db[_0x8697('0x90')],'as':_0x8697('0x91'),'attributes':['name',_0x8697('0x92'),'internal'],'required':![]},{'model':db[_0x8697('0x93')],'as':'Tags','attributes':['id',_0x8697('0x3a'),_0x8697('0x94')],'where':_0x4c835f[_0x8697('0x44')][_0x8697('0x95')]?{'id':_0x4c835f[_0x8697('0x44')][_0x8697('0x95')]}:undefined,'required':_0x4c835f['query'][_0x8697('0x95')]?!![]:![]}];}return db[_0x8697('0x8b')][_0x8697('0x6c')](_0x232648);})[_0x8697('0x23')](function(_0x2c76b4){_0x5cbf79['rows']=_0x2c76b4;return _0x5cbf79;});}})['then'](respondWithFilteredResult(_0x2de608,_0x232648))[_0x8697('0x2c')](handleError(_0x2de608,null));};exports[_0x8697('0x96')]=function(_0x976b19,_0x1b0d66,_0x3ad8f1){return db[_0x8697('0x40')][_0x8697('0x6b')]({'where':{'id':_0x976b19[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x1b0d66,null))[_0x8697('0x23')](function(_0x4f142d){if(_0x4f142d){return db[_0x8697('0x97')][_0x8697('0x98')](function(_0x48daa9){return db[_0x8697('0x99')][_0x8697('0x9a')]({'where':{'MailAccountId':_0x976b19['params']['id']},'transaction':_0x48daa9})[_0x8697('0x23')](function(_0x12a93b){var _0x2130d5=_[_0x8697('0x3f')](_0x976b19[_0x8697('0x5e')],function(_0x23ca59){_0x23ca59[_0x8697('0x62')]=_0x976b19[_0x8697('0x59')]['id'];return _0x23ca59;});return db[_0x8697('0x99')]['bulkCreate'](_0x2130d5,{'transaction':_0x48daa9});});})['then'](function(){return db[_0x8697('0x99')][_0x8697('0x9b')]({'where':{'MailAccountId':_0x976b19[_0x8697('0x59')]['id']},'order':_0x8697('0x9c')});});}})[_0x8697('0x23')](respondWithResult(_0x1b0d66,null))[_0x8697('0x2c')](handleError(_0x1b0d66,null));};exports['getApplications']=function(_0x90f459,_0xab3609,_0x228a5f){var _0x5d2853={};var _0x4e0e8c={};var _0x1cc4ba;var _0x108607;return db[_0x8697('0x40')][_0x8697('0x6b')]({'where':{'id':_0x90f459[_0x8697('0x59')]['id']}})['then'](handleEntityNotFound(_0xab3609,null))[_0x8697('0x23')](function(_0x424e0e){if(_0x424e0e){_0x1cc4ba=_0x424e0e;_0x4e0e8c[_0x8697('0x43')]=_['keys'](db['MailApplication'][_0x8697('0x66')]);_0x4e0e8c['query']=_['keys'](_0x90f459[_0x8697('0x44')]);_0x4e0e8c['filters']=_['intersection'](_0x4e0e8c[_0x8697('0x43')],_0x4e0e8c['query']);_0x5d2853[_0x8697('0x47')]=_[_0x8697('0x48')](_0x4e0e8c['model'],qs[_0x8697('0x49')](_0x90f459[_0x8697('0x44')][_0x8697('0x49')]));_0x5d2853[_0x8697('0x47')]=_0x5d2853[_0x8697('0x47')][_0x8697('0x4a')]?_0x5d2853['attributes']:_0x4e0e8c[_0x8697('0x43')];_0x5d2853[_0x8697('0x4e')]=qs[_0x8697('0x67')](_0x90f459[_0x8697('0x44')]['sort']);_0x5d2853[_0x8697('0x4f')]=qs['filters'](_['pick'](_0x90f459[_0x8697('0x44')],_0x4e0e8c['filters']));if(_0x90f459[_0x8697('0x44')][_0x8697('0x52')]){_0x5d2853[_0x8697('0x4f')]=_['merge'](_0x5d2853['where'],{'$or':_['map'](_0x5d2853[_0x8697('0x47')],function(_0x51ff6d){var _0x3b6997={};_0x3b6997[_0x51ff6d]={'$like':'%'+_0x90f459[_0x8697('0x44')][_0x8697('0x52')]+'%'};return _0x3b6997;})});}_0x5d2853=_[_0x8697('0x53')]({},_0x5d2853,_0x90f459[_0x8697('0x54')]);return _0x1cc4ba[_0x8697('0x9d')](_0x5d2853);}})[_0x8697('0x23')](function(_0x252b3a){if(_0x252b3a){_0x108607=_0x252b3a[_0x8697('0x4a')];if(!_0x90f459[_0x8697('0x44')][_0x8697('0x4b')](_0x8697('0x4c'))){_0x5d2853['limit']=qs[_0x8697('0x2f')](_0x90f459[_0x8697('0x44')][_0x8697('0x2f')]);_0x5d2853[_0x8697('0x4d')]=qs[_0x8697('0x4d')](_0x90f459[_0x8697('0x44')]['offset']);}return _0x1cc4ba[_0x8697('0x9d')](_0x5d2853);}})[_0x8697('0x23')](function(_0x2bda80){if(_0x2bda80){return _0x2bda80?{'count':_0x108607,'rows':_0x2bda80}:null;}})[_0x8697('0x23')](respondWithResult(_0xab3609,null))['catch'](handleError(_0xab3609,null));};exports['getMessages']=function(_0x5287fd,_0x2209e8,_0x58f62a){var _0x11c31c={'raw':!![],'where':{}};var _0x22a318={};var _0x3adb7c={'count':0x0,'rows':[]};return db[_0x8697('0x40')]['findOne']({'where':{'id':_0x5287fd[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x2209e8,null))['then'](function(_0x56938b){if(_0x56938b){_0x22a318[_0x8697('0x43')]=_['keys'](db[_0x8697('0x9e')][_0x8697('0x66')]);_0x22a318[_0x8697('0x44')]=_['keys'](_0x5287fd[_0x8697('0x44')]);_0x22a318[_0x8697('0x46')]=_[_0x8697('0x48')](_0x22a318['model'],_0x22a318[_0x8697('0x44')]);_0x11c31c[_0x8697('0x47')]=_[_0x8697('0x48')](_0x22a318['model'],qs[_0x8697('0x49')](_0x5287fd[_0x8697('0x44')]['fields']));_0x11c31c[_0x8697('0x47')]=_0x11c31c[_0x8697('0x47')][_0x8697('0x4a')]?_0x11c31c[_0x8697('0x47')]:_0x22a318[_0x8697('0x43')];if(!_0x5287fd['query'][_0x8697('0x4b')](_0x8697('0x4c'))){_0x11c31c[_0x8697('0x2f')]=qs[_0x8697('0x2f')](_0x5287fd['query'][_0x8697('0x2f')]);_0x11c31c[_0x8697('0x4d')]=qs['offset'](_0x5287fd[_0x8697('0x44')][_0x8697('0x4d')]);}_0x11c31c['order']=qs[_0x8697('0x67')](_0x5287fd[_0x8697('0x44')][_0x8697('0x67')]);_0x11c31c[_0x8697('0x4f')]=qs['filters'](_[_0x8697('0x50')](_0x5287fd[_0x8697('0x44')],_0x22a318[_0x8697('0x46')]));_0x11c31c[_0x8697('0x4f')]['MailAccountId']=_0x56938b['id'];if(_0x5287fd[_0x8697('0x44')][_0x8697('0x52')]){_0x11c31c[_0x8697('0x4f')]=_[_0x8697('0x53')](_0x11c31c['where'],{'$or':_[_0x8697('0x3f')](_0x11c31c[_0x8697('0x47')],function(_0x3061d4){var _0x5cd370={};_0x5cd370[_0x3061d4]={'$like':'%'+_0x5287fd[_0x8697('0x44')][_0x8697('0x52')]+'%'};return _0x5cd370;})});}if(_0x5287fd[_0x8697('0x44')]['$gte']){var _0x36c9f0=_0x5287fd[_0x8697('0x44')]['$gte'][_0x8697('0x9f')](',');var _0x40a7b6={};_0x40a7b6[_0x36c9f0[0x0]]={'$gte':moment(_0x36c9f0[0x1])[_0x8697('0xa0')](_0x8697('0xa1'))};_0x11c31c['where']=_['merge'](_0x11c31c[_0x8697('0x4f')],_0x40a7b6);}_0x11c31c=_[_0x8697('0x53')]({},_0x11c31c,_0x5287fd[_0x8697('0x54')]);return db['MailMessage']['count']({'where':_0x11c31c[_0x8697('0x4f')]})[_0x8697('0x23')](function(_0x4cd926){_0x3adb7c[_0x8697('0x55')]=_0x4cd926;if(_0x5287fd[_0x8697('0x44')]['includeAll']){_0x11c31c['include']=[{'all':!![]}];}return db[_0x8697('0x9e')]['findAll'](_0x11c31c);})['then'](function(_0x87c3bd){if(_0x5287fd[_0x8697('0x44')][_0x8697('0xa2')]==='true'){for(var _0xb70ce9=0x0;_0xb70ce9<_0x87c3bd['length'];_0xb70ce9++){_0x87c3bd[_0xb70ce9][_0x8697('0x5e')]=juice(_0x87c3bd[_0xb70ce9][_0x8697('0x5e')]);}}_0x3adb7c[_0x8697('0x57')]=_0x87c3bd;return _0x3adb7c;});}})[_0x8697('0x23')](respondWithFilteredResult(_0x2209e8,_0x11c31c))[_0x8697('0x2c')](handleError(_0x2209e8,null));};exports['send']=function(_0x1a6ba0,_0x3c4590,_0x23e487){var _0x3bbe25,_0xedfda0={},_0x236e7e;if(_0x1a6ba0['body']['to']){_0x236e7e=_0x1a6ba0[_0x8697('0x5e')]['to'][_0x8697('0x9f')](',')[0x0];}return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x1a6ba0['params']['id']},'include':[{'model':db['CmList'],'as':_0x8697('0xa3'),'include':[{'model':db[_0x8697('0xa4')],'as':_0x8697('0xa5'),'where':{'email':_0x236e7e},'limit':0x1,'order':[[_0x8697('0xa6'),_0x8697('0xa7')]]}]},{'model':db[_0x8697('0x3d')],'as':'Smtp','raw':!![]}]})[_0x8697('0x23')](handleEntityNotFound(_0x3c4590,null))[_0x8697('0x23')](function(_0x574469){if(_0x574469){_0x3bbe25=_0x574469;if(_0x574469[_0x8697('0x5f')]){if(_['isNil'](_0x1a6ba0[_0x8697('0x5e')]['from'])){_0x1a6ba0['body'][_0x8697('0xa8')]=util['format'](_0x8697('0xa9'),_0x574469[_0x8697('0x3a')],_0x574469[_0x8697('0x6f')]||_0x574469[_0x8697('0x5f')][_0x8697('0x7d')]);}if(_0x1a6ba0['body'][_0x8697('0xaa')]&&_0x1a6ba0[_0x8697('0x5e')][_0x8697('0xaa')][_0x8697('0x4a')]){for(var _0x353b8e=0x0;_0x353b8e<_0x1a6ba0['body'][_0x8697('0xaa')][_0x8697('0x4a')];_0x353b8e+=0x1){_0x1a6ba0['body'][_0x8697('0xaa')][_0x353b8e]={'filename':_0x1a6ba0[_0x8697('0x5e')]['attachments'][_0x353b8e][_0x8697('0x3a')],'path':path[_0x8697('0xab')](config[_0x8697('0xac')],_0x8697('0xad'),_0x1a6ba0[_0x8697('0x5e')][_0x8697('0xaa')][_0x353b8e][_0x8697('0xae')])};}}var _0x3f89e4={'tls':{'rejectUnauthorized':![]}};if(_[_0x8697('0x71')](_0x574469[_0x8697('0x5f')][_0x8697('0x7c')])){if(_0x574469['Smtp']['authentication']){_0x3f89e4['auth']={'user':_0x574469[_0x8697('0x5f')]['user'],'pass':_0x574469[_0x8697('0x5f')][_0x8697('0x77')]};}_0x3f89e4[_0x8697('0x7a')]=_0x574469[_0x8697('0x5f')][_0x8697('0x7a')];_0x3f89e4[_0x8697('0x7b')]=_0x574469[_0x8697('0x5f')][_0x8697('0x7b')];_0x3f89e4['secure']=_0x574469[_0x8697('0x5f')][_0x8697('0xaf')];}else{_0x3f89e4['service']=_0x574469[_0x8697('0x5f')][_0x8697('0x7c')];_0x3f89e4[_0x8697('0xb0')]={'user':_0x574469[_0x8697('0x5f')]['user'],'pass':_0x574469[_0x8697('0x5f')]['pass']};}return respondWithRpcPromise(_0x8697('0xb1'),_0x8697('0xb2'),{'account':_0x3f89e4,'message':_0x1a6ba0[_0x8697('0x5e')]});}else{throw new Error(_0x8697('0xb3'));}}})['then'](function(_0x4454c5){if(_0x4454c5){_0xedfda0=_0x4454c5;if(_0x3bbe25[_0x8697('0xa3')]){if(_0x3bbe25[_0x8697('0xa3')][_0x8697('0xa5')][_0x8697('0x4a')]){return _0x3bbe25[_0x8697('0xa3')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x8697('0x1c')](_0x1a6ba0[_0x8697('0x5e')],{'firstName':_0x1a6ba0['body']['to'],'email':_0x1a6ba0[_0x8697('0x5e')]['to'],'phone':_0x1a6ba0[_0x8697('0x5e')]['to'],'ListId':_0x3bbe25[_0x8697('0x70')]}));}}else{throw new Error(_0x8697('0xb3'));}}})[_0x8697('0x23')](function(_0x1802e9){if(_0x1802e9){var _0x3889af={'UserId':_0x1a6ba0[_0x8697('0x7d')]['id'],'ContactId':_0x1802e9['id'],'MailAccountId':_0x3bbe25['id'],'inReplyTo':_0xedfda0[_0x8697('0xb4')],'to':_0x1a6ba0['body'][_0x8697('0xa8')],'cc':_0x1a6ba0[_0x8697('0x5e')]['cc'],'subject':_0x1a6ba0['body']['subject'],'attach':_0x1a6ba0[_0x8697('0x5e')][_0x8697('0xb5')],'firstMsgDirection':_0x8697('0xb6'),'lastMsgAt':moment()[_0x8697('0xa0')](_0x8697('0xa1')),'lastMsgDirection':_0x8697('0xb6'),'Messages':[_[_0x8697('0x53')](_0x1a6ba0['body'],{'messageId':_0xedfda0['messageId'],'sentAt':moment()[_0x8697('0xa0')](_0x8697('0xa1')),'read':!![],'MailAccountId':_0x3bbe25['id'],'UserId':_0x1a6ba0['user']['id'],'ContactId':_0x1802e9['id']})]};if(_0x1a6ba0[_0x8697('0x5e')]['Interaction']){_0x3889af=_[_0x8697('0x53')](_0x3889af,_0x1a6ba0[_0x8697('0x5e')][_0x8697('0xb7')]);}return db[_0x8697('0x8b')][_0x8697('0x64')](_0x3889af,{'include':[{'model':db['MailMessage'],'as':_0x8697('0xb8')}]});}})[_0x8697('0x23')](respondWithResult(_0x3c4590,null))['catch'](handleError(_0x3c4590,null));};exports[_0x8697('0xb9')]=function(_0x420342,_0xb8c1a,_0xa1e71f){return db['MailAccount']['find']({'where':{'id':_0x420342[_0x8697('0x59')]['id']},'include':[{'model':db[_0x8697('0x3d')],'as':_0x8697('0x5f'),'raw':!![]}]})['then'](handleEntityNotFound(_0xb8c1a,null))[_0x8697('0x23')](function(_0x1c582f){if(_0x1c582f&&_0x1c582f['Smtp']){var _0x264ebf={'id':_0x1c582f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1c582f[_0x8697('0x5f')][_0x8697('0x7c')]){_0x264ebf[_0x8697('0x7c')]=_0x1c582f[_0x8697('0x5f')][_0x8697('0x7c')];}else{_0x264ebf[_0x8697('0x7a')]=_0x1c582f[_0x8697('0x5f')][_0x8697('0x7a')];_0x264ebf[_0x8697('0x7b')]=_0x1c582f['Smtp'][_0x8697('0x7b')];_0x264ebf['secure']=_0x1c582f[_0x8697('0x5f')]['secure'];}if(_0x1c582f[_0x8697('0x5f')]['authentication']){_0x264ebf[_0x8697('0xb0')]={'user':_0x1c582f[_0x8697('0x5f')]['user'],'pass':_0x1c582f[_0x8697('0x5f')]['pass']};}return respondWithRpcPromise(_0x8697('0xba'),_0x8697('0xb9'),{'account':_0x264ebf});}})[_0x8697('0x23')](respondWithResult(_0xb8c1a,null))['catch'](handleError(_0xb8c1a,null));};exports[_0x8697('0x9a')]=function(_0x2531f2,_0x462568){return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x2531f2[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x462568,null))['then'](function(_0x49f90e){if(_0x49f90e&&_0x49f90e[_0x8697('0x7c')]){throw new db[(_0x8697('0xbb'))][(_0x8697('0xbc'))](_0x8697('0xbd'));}return _0x49f90e;})[_0x8697('0x23')](removeEntity(_0x462568,null))[_0x8697('0x2c')](handleError(_0x462568,null));};exports[_0x8697('0xbe')]=function(_0x19b4fb,_0x299f02,_0x800146){return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x19b4fb[_0x8697('0x59')]['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x299f02,null))[_0x8697('0x23')](function(_0x122a52){if(_0x122a52){return _0x122a52[_0x8697('0xbe')](_0x19b4fb[_0x8697('0x5e')][_0x8697('0x6e')],_[_0x8697('0x8d')](_0x19b4fb[_0x8697('0x5e')],[_0x8697('0x6e'),'id'])||{})[_0x8697('0xbf')](function(_0x47b3ac){for(var _0x564714=0x0;_0x564714<_0x19b4fb[_0x8697('0x5e')][_0x8697('0x6e')][_0x8697('0x4a')];_0x564714+=0x1){socket[_0x8697('0xc0')](_0x8697('0xc1'),{'UserId':_0x19b4fb[_0x8697('0x5e')][_0x8697('0x6e')][_0x564714],'MailAccountId':_0x19b4fb['params']['id']});}return _0x47b3ac;});}})[_0x8697('0x23')](respondWithResult(_0x299f02,null))[_0x8697('0x2c')](handleError(_0x299f02,null));};exports[_0x8697('0xc2')]=function(_0x543d46,_0x78d326,_0x572dc4){return db[_0x8697('0x40')][_0x8697('0x5d')]({'where':{'id':_0x543d46['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x78d326,null))[_0x8697('0x23')](function(_0x1d9993){if(_0x1d9993){return _0x1d9993['removeAgents'](_0x543d46[_0x8697('0x44')][_0x8697('0x6e')])[_0x8697('0x23')](function(){if(_['isArray'](_0x543d46[_0x8697('0x44')][_0x8697('0x6e')])){for(var _0x2f43f0=0x0;_0x2f43f0<_0x543d46['query'][_0x8697('0x6e')][_0x8697('0x4a')];_0x2f43f0+=0x1){socket[_0x8697('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x543d46['query']['ids'][_0x2f43f0]),'MailAccountId':Number(_0x543d46[_0x8697('0x59')]['id'])});}}else{socket[_0x8697('0xc0')](_0x8697('0xc3'),{'UserId':Number(_0x543d46['query'][_0x8697('0x6e')]),'MailAccountId':Number(_0x543d46[_0x8697('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x78d326,null))['catch'](handleError(_0x78d326,null));};exports[_0x8697('0xc4')]=function(_0x4f1e31,_0x1b3855,_0xfb4834){var _0x49c138={};var _0x474d3a={};var _0xcad834;var _0x2c5a39;return db['MailAccount'][_0x8697('0x6b')]({'where':{'id':_0x4f1e31['params']['id']}})[_0x8697('0x23')](handleEntityNotFound(_0x1b3855,null))['then'](function(_0x502da7){if(_0x502da7){_0xcad834=_0x502da7;_0x474d3a[_0x8697('0x43')]=_[_0x8697('0x45')](db[_0x8697('0x90')][_0x8697('0x66')]);_0x474d3a[_0x8697('0x44')]=_[_0x8697('0x45')](_0x4f1e31[_0x8697('0x44')]);_0x474d3a[_0x8697('0x46')]=_[_0x8697('0x48')](_0x474d3a['model'],_0x474d3a[_0x8697('0x44')]);_0x49c138[_0x8697('0x47')]=_['intersection'](_0x474d3a[_0x8697('0x43')],qs['fields'](_0x4f1e31[_0x8697('0x44')][_0x8697('0x49')]));_0x49c138[_0x8697('0x47')]=_0x49c138['attributes'][_0x8697('0x4a')]?_0x49c138[_0x8697('0x47')]:_0x474d3a[_0x8697('0x43')];_0x49c138['order']=qs['sort'](_0x4f1e31[_0x8697('0x44')][_0x8697('0x67')]);_0x49c138[_0x8697('0x4f')]=qs[_0x8697('0x46')](_[_0x8697('0x50')](_0x4f1e31[_0x8697('0x44')],_0x474d3a[_0x8697('0x46')]));if(_0x4f1e31[_0x8697('0x44')][_0x8697('0x52')]){_0x49c138[_0x8697('0x4f')]=_[_0x8697('0x53')](_0x49c138['where'],{'$or':_['map'](_0x49c138[_0x8697('0x47')],function(_0x227386){var _0x3b259d={};_0x3b259d[_0x227386]={'$like':'%'+_0x4f1e31[_0x8697('0x44')]['filter']+'%'};return _0x3b259d;})});}_0x49c138=_[_0x8697('0x53')]({},_0x49c138,_0x4f1e31[_0x8697('0x54')]);return _0xcad834[_0x8697('0xc4')](_0x49c138);}})[_0x8697('0x23')](function(_0x650a75){if(_0x650a75){_0x2c5a39=_0x650a75['length'];if(!_0x4f1e31[_0x8697('0x44')][_0x8697('0x4b')](_0x8697('0x4c'))){_0x49c138[_0x8697('0x2f')]=qs[_0x8697('0x2f')](_0x4f1e31[_0x8697('0x44')]['limit']);_0x49c138[_0x8697('0x4d')]=qs['offset'](_0x4f1e31['query'][_0x8697('0x4d')]);}return _0xcad834[_0x8697('0xc4')](_0x49c138);}})['then'](function(_0xf781df){if(_0xf781df){return _0xf781df?{'count':_0x2c5a39,'rows':_0xf781df}:null;}})[_0x8697('0x23')](respondWithResult(_0x1b3855,null))[_0x8697('0x2c')](handleError(_0x1b3855,null));}; \ No newline at end of file +var _0xa8b1=['apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','MailServerIn','Imap','Smtp','Pause','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','count','include','MailAccount','findAll','rows','catch','show','MailServerOut','includeAll','find','body','params','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','isNil','active','cauthentication','user','cuser','authentication','host','port','service','cservice','password','pass','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','fullname','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','auth','secure','SendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','ids','emit','userMailAccount:save','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','request','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','Content-Range'];(function(_0x1c8253,_0x1c4de2){var _0x380d59=function(_0x5bbf67){while(--_0x5bbf67){_0x1c8253['push'](_0x1c8253['shift']());}};_0x380d59(++_0x1c4de2);}(_0xa8b1,0x8b));var _0x1a8b=function(_0x2e0e1d,_0x354ac7){_0x2e0e1d=_0x2e0e1d-0x0;var _0x36bf27=_0xa8b1[_0x2e0e1d];return _0x36bf27;};'use strict';var pdf=require(_0x1a8b('0x0'));var emlformat=require(_0x1a8b('0x1'));var rimraf=require(_0x1a8b('0x2'));var zipdir=require(_0x1a8b('0x3'));var jsonpatch=require(_0x1a8b('0x4'));var rp=require('request-promise');var moment=require(_0x1a8b('0x5'));var BPromise=require(_0x1a8b('0x6'));var Mustache=require(_0x1a8b('0x7'));var util=require('util');var path=require(_0x1a8b('0x8'));var sox=require(_0x1a8b('0x9'));var csv=require(_0x1a8b('0xa'));var ejs=require(_0x1a8b('0xb'));var fs=require('fs');var _=require(_0x1a8b('0xc'));var squel=require(_0x1a8b('0xd'));var crypto=require(_0x1a8b('0xe'));var jsforce=require(_0x1a8b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a8b('0x10'));var Papa=require(_0x1a8b('0x11'));var htmlToText=require(_0x1a8b('0x12'));var juice=require(_0x1a8b('0x13'));var Redis=require(_0x1a8b('0x14'));var authService=require(_0x1a8b('0x15'));var qs=require(_0x1a8b('0x16'));var as=require(_0x1a8b('0x17'));var hardwareService=require(_0x1a8b('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a8b('0x19'));var db=require(_0x1a8b('0x1a'))['db'];config['redis']=_[_0x1a8b('0x1b')](config[_0x1a8b('0x1c')],{'host':_0x1a8b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a8b('0x1c')]));require(_0x1a8b('0x1e'))[_0x1a8b('0x1f')](socket);var jayson=require(_0x1a8b('0x20'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x18db4e,_0x5116cd,_0xec0283,_0xaa9a33){return new BPromise(function(_0x504437,_0x2e2aac){var _0x20bb50=_0xaa9a33||client;return _0x20bb50[_0x1a8b('0x21')](_0x18db4e,_0xec0283)['then'](function(_0x238710){logger[_0x1a8b('0x22')]('MailAccount,\x20%s,\x20%s',_0x5116cd,'request\x20sent');logger['debug'](_0x1a8b('0x23'),_0x5116cd,_0x1a8b('0x24'),JSON[_0x1a8b('0x25')](_0x238710));if(_0x238710['error']){if(_0x238710[_0x1a8b('0x26')][_0x1a8b('0x27')]===0x1f4){logger['error'](_0x1a8b('0x28'),_0x5116cd,_0x238710[_0x1a8b('0x26')][_0x1a8b('0x29')]);return _0x2e2aac(_0x238710[_0x1a8b('0x26')][_0x1a8b('0x29')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5116cd,_0x238710[_0x1a8b('0x26')]['message']);return _0x504437(_0x238710[_0x1a8b('0x26')][_0x1a8b('0x29')]);}else{logger[_0x1a8b('0x22')](_0x1a8b('0x28'),_0x5116cd,_0x1a8b('0x24'));_0x504437(_0x238710[_0x1a8b('0x2a')][_0x1a8b('0x29')]);}})['catch'](function(_0x8e53d3){logger[_0x1a8b('0x26')](_0x1a8b('0x28'),_0x5116cd,_0x8e53d3);_0x2e2aac(_0x8e53d3);});});}function respondWithStatusCode(_0x229270,_0x4081b3){_0x4081b3=_0x4081b3||0xcc;return function(_0x12487a){if(_0x12487a){return _0x229270[_0x1a8b('0x2b')](_0x4081b3);}return _0x229270[_0x1a8b('0x2c')](_0x4081b3)[_0x1a8b('0x2d')]();};}function respondWithResult(_0x41e881,_0x3a2522){_0x3a2522=_0x3a2522||0xc8;return function(_0x586f6e){if(_0x586f6e){return _0x41e881[_0x1a8b('0x2c')](_0x3a2522)[_0x1a8b('0x2e')](_0x586f6e);}};}function respondWithFilteredResult(_0x2d6641,_0x1aad3a){return function(_0x20dc17){if(_0x20dc17){var _0x444020=_0x20dc17['count'],_0x474696=_0x1aad3a['offset'],_0x1eb3d8=_0x1aad3a[_0x1a8b('0x2f')]+_0x1aad3a[_0x1a8b('0x30')],_0x4bf816;if(_0x1eb3d8>=_0x444020){_0x1eb3d8=_0x444020;_0x4bf816=0xc8;}else{_0x4bf816=0xce;}_0x2d6641[_0x1a8b('0x2c')](_0x4bf816);return _0x2d6641['set'](_0x1a8b('0x31'),_0x474696+'-'+_0x1eb3d8+'/'+_0x444020)[_0x1a8b('0x2e')](_0x20dc17);}return null;};}function patchUpdates(_0x523990){return function(_0x10d54a){try{jsonpatch[_0x1a8b('0x32')](_0x10d54a,_0x523990,!![]);}catch(_0x547366){return BPromise[_0x1a8b('0x33')](_0x547366);}return _0x10d54a['save']();};}function saveUpdates(_0x1329b1,_0x3697e1){return function(_0x4afd94){if(_0x4afd94){return _0x4afd94[_0x1a8b('0x34')](_0x1329b1)[_0x1a8b('0x35')](function(_0x328d2b){return _0x328d2b;});}return null;};}function removeEntity(_0x489aa9,_0x50df3e){return function(_0x26c9f9){if(_0x26c9f9){return _0x26c9f9[_0x1a8b('0x36')]()[_0x1a8b('0x35')](function(){var _0x3ca567=_0x26c9f9[_0x1a8b('0x37')]({'plain':!![]});var _0x27701e='MailAccounts';return db[_0x1a8b('0x38')][_0x1a8b('0x36')]({'where':{'type':_0x27701e,'resourceId':_0x3ca567['id']}})[_0x1a8b('0x35')](function(){return _0x26c9f9;});})[_0x1a8b('0x35')](function(){_0x489aa9[_0x1a8b('0x2c')](0xcc)[_0x1a8b('0x2d')]();});}};}function handleEntityNotFound(_0x5bc180,_0x445ae2){return function(_0x3aca38){if(!_0x3aca38){_0x5bc180['sendStatus'](0x194);}return _0x3aca38;};}function handleError(_0x5c7804,_0x1d1310){_0x1d1310=_0x1d1310||0x1f4;return function(_0x27c9ce){logger['error'](_0x27c9ce[_0x1a8b('0x39')]);if(_0x27c9ce[_0x1a8b('0x3a')]){delete _0x27c9ce[_0x1a8b('0x3a')];}_0x5c7804['status'](_0x1d1310)['send'](_0x27c9ce);};}exports[_0x1a8b('0x3b')]=function(_0x4bd401,_0x4ba2ca){var _0x4a62c7={'include':[{'model':db[_0x1a8b('0x3c')],'as':_0x1a8b('0x3d')},{'model':db['MailServerOut'],'as':_0x1a8b('0x3e')},{'model':db[_0x1a8b('0x3f')],'as':'mandatoryDispositionPause'}]},_0x303eb2={},_0x38fd37={'count':0x0,'rows':[]};var _0x2feaf=_['map'](db['MailAccount'][_0x1a8b('0x40')],function(_0x9696cd){return{'name':_0x9696cd['fieldName'],'type':_0x9696cd['type'][_0x1a8b('0x41')]};});_0x303eb2[_0x1a8b('0x42')]=_[_0x1a8b('0x43')](_0x2feaf,_0x1a8b('0x3a'));_0x303eb2[_0x1a8b('0x44')]=_[_0x1a8b('0x45')](_0x4bd401[_0x1a8b('0x44')]);_0x303eb2[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0x303eb2[_0x1a8b('0x42')],_0x303eb2[_0x1a8b('0x44')]);_0x4a62c7[_0x1a8b('0x48')]=_[_0x1a8b('0x47')](_0x303eb2[_0x1a8b('0x42')],qs[_0x1a8b('0x49')](_0x4bd401[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x4a62c7[_0x1a8b('0x48')]=_0x4a62c7[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x4a62c7['attributes']:_0x303eb2[_0x1a8b('0x42')];if(!_0x4bd401[_0x1a8b('0x44')]['hasOwnProperty'](_0x1a8b('0x4b'))){_0x4a62c7[_0x1a8b('0x30')]=qs[_0x1a8b('0x30')](_0x4bd401[_0x1a8b('0x44')][_0x1a8b('0x30')]);_0x4a62c7[_0x1a8b('0x2f')]=qs[_0x1a8b('0x2f')](_0x4bd401['query'][_0x1a8b('0x2f')]);}_0x4a62c7[_0x1a8b('0x4c')]=qs[_0x1a8b('0x4d')](_0x4bd401[_0x1a8b('0x44')][_0x1a8b('0x4d')]);_0x4a62c7[_0x1a8b('0x4e')]=qs[_0x1a8b('0x46')](_[_0x1a8b('0x4f')](_0x4bd401[_0x1a8b('0x44')],_0x303eb2[_0x1a8b('0x46')]),_0x2feaf);if(_0x4bd401[_0x1a8b('0x44')][_0x1a8b('0x50')]){_0x4a62c7[_0x1a8b('0x4e')]=_[_0x1a8b('0x51')](_0x4a62c7['where'],{'$or':_[_0x1a8b('0x43')](_0x2feaf,function(_0x5650ed){if(_0x5650ed[_0x1a8b('0x52')]!=='VIRTUAL'){var _0x2cf6f7={};_0x2cf6f7[_0x5650ed[_0x1a8b('0x3a')]]={'$like':'%'+_0x4bd401['query'][_0x1a8b('0x50')]+'%'};return _0x2cf6f7;}})});}_0x4a62c7=_['merge']({},_0x4a62c7,_0x4bd401[_0x1a8b('0x53')]);var _0x280d1f={'where':_0x4a62c7[_0x1a8b('0x4e')]};return db['MailAccount'][_0x1a8b('0x54')](_0x280d1f)['then'](function(_0x2306aa){_0x38fd37[_0x1a8b('0x54')]=_0x2306aa;if(_0x4bd401['query']['includeAll']){_0x4a62c7[_0x1a8b('0x55')]=[{'all':!![]}];}return db[_0x1a8b('0x56')][_0x1a8b('0x57')](_0x4a62c7);})[_0x1a8b('0x35')](function(_0x24c556){_0x38fd37[_0x1a8b('0x58')]=_0x24c556;return _0x38fd37;})[_0x1a8b('0x35')](respondWithFilteredResult(_0x4ba2ca,_0x4a62c7))[_0x1a8b('0x59')](handleError(_0x4ba2ca,null));};exports[_0x1a8b('0x5a')]=function(_0x3426e4,_0xcf8d99){var _0x342158={'raw':![],'where':{'id':_0x3426e4['params']['id']},'include':[{'model':db[_0x1a8b('0x3c')],'as':_0x1a8b('0x3d')},{'model':db[_0x1a8b('0x5b')],'as':_0x1a8b('0x3e')},{'model':db[_0x1a8b('0x3f')],'as':'mandatoryDispositionPause'}]},_0x4bbd5d={};_0x4bbd5d[_0x1a8b('0x42')]=_[_0x1a8b('0x45')](db[_0x1a8b('0x56')][_0x1a8b('0x40')]);_0x4bbd5d[_0x1a8b('0x44')]=_[_0x1a8b('0x45')](_0x3426e4['query']);_0x4bbd5d[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0x4bbd5d[_0x1a8b('0x42')],_0x4bbd5d[_0x1a8b('0x44')]);_0x342158[_0x1a8b('0x48')]=_[_0x1a8b('0x47')](_0x4bbd5d[_0x1a8b('0x42')],qs[_0x1a8b('0x49')](_0x3426e4[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x342158[_0x1a8b('0x48')]=_0x342158['attributes'][_0x1a8b('0x4a')]?_0x342158[_0x1a8b('0x48')]:_0x4bbd5d['model'];if(_0x3426e4[_0x1a8b('0x44')][_0x1a8b('0x5c')]){_0x342158[_0x1a8b('0x55')]=[{'all':!![]}];}_0x342158=_[_0x1a8b('0x51')]({},_0x342158,_0x3426e4[_0x1a8b('0x53')]);return db[_0x1a8b('0x56')][_0x1a8b('0x5d')](_0x342158)[_0x1a8b('0x35')](handleEntityNotFound(_0xcf8d99,null))['then'](respondWithResult(_0xcf8d99,null))[_0x1a8b('0x59')](handleError(_0xcf8d99,null));};exports['update']=function(_0x291bf1,_0x1afa30){if(_0x291bf1[_0x1a8b('0x5e')]['id']){delete _0x291bf1[_0x1a8b('0x5e')]['id'];}return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x291bf1[_0x1a8b('0x5f')]['id']},'include':[{'model':db[_0x1a8b('0x3c')],'as':_0x1a8b('0x3d')},{'model':db[_0x1a8b('0x5b')],'as':_0x1a8b('0x3e')},{'model':db[_0x1a8b('0x3f')],'as':_0x1a8b('0x60')}]})['then'](handleEntityNotFound(_0x1afa30,null))['then'](saveUpdates(_0x291bf1['body'],null))['then'](function(_0x2cda94){if(_0x2cda94&&_0x291bf1[_0x1a8b('0x5e')]['Imap']){return db['MailServerIn'][_0x1a8b('0x34')](_0x291bf1[_0x1a8b('0x5e')][_0x1a8b('0x3d')],{'where':{'MailAccountId':_0x2cda94['id']}})[_0x1a8b('0x35')](function(){return _0x2cda94;});}return _0x2cda94;})[_0x1a8b('0x35')](function(_0x44b31b){if(_0x44b31b&&_0x291bf1[_0x1a8b('0x5e')][_0x1a8b('0x3e')]){return db[_0x1a8b('0x5b')]['update'](_0x291bf1[_0x1a8b('0x5e')][_0x1a8b('0x3e')],{'where':{'MailAccountId':_0x44b31b['id']}})['then'](function(){return _0x44b31b;});}return _0x44b31b;})[_0x1a8b('0x35')](respondWithResult(_0x1afa30,null))[_0x1a8b('0x59')](handleError(_0x1afa30,null));};exports[_0x1a8b('0x61')]=function(_0x2d00cb,_0x21102f){return db['MailAccount'][_0x1a8b('0x61')]()['then'](respondWithResult(_0x21102f,null))['catch'](handleError(_0x21102f,null));};exports[_0x1a8b('0x62')]=function(_0x129399,_0x46c8ed,_0x235789){if(_0x129399[_0x1a8b('0x5e')]['id']){delete _0x129399['body']['id'];}return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x129399[_0x1a8b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46c8ed,null))['then'](function(_0x3bbf51){if(_0x3bbf51){_0x129399[_0x1a8b('0x5e')][_0x1a8b('0x63')]=_0x3bbf51['id'];return db[_0x1a8b('0x64')][_0x1a8b('0x65')](_0x129399[_0x1a8b('0x5e')]);}})[_0x1a8b('0x35')](respondWithResult(_0x46c8ed,null))[_0x1a8b('0x59')](handleError(_0x46c8ed,null));};exports[_0x1a8b('0x66')]=function(_0xc01f29,_0x235f42,_0x9a4dc9){var _0x354de9={'raw':![],'where':{}};var _0x44dffa={};var _0x30f365={'count':0x0,'rows':[]};return db[_0x1a8b('0x56')][_0x1a8b('0x67')]({'where':{'id':_0xc01f29[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x235f42,null))['then'](function(_0x16bea0){if(_0x16bea0){_0x44dffa[_0x1a8b('0x42')]=_['keys'](db[_0x1a8b('0x64')]['rawAttributes']);_0x44dffa['query']=_[_0x1a8b('0x45')](_0xc01f29[_0x1a8b('0x44')]);_0x44dffa[_0x1a8b('0x46')]=_['intersection'](_0x44dffa[_0x1a8b('0x42')],_0x44dffa[_0x1a8b('0x44')]);_0x354de9[_0x1a8b('0x48')]=_[_0x1a8b('0x47')](_0x44dffa[_0x1a8b('0x42')],qs[_0x1a8b('0x49')](_0xc01f29[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x354de9['attributes']=_0x354de9[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x354de9['attributes']:_0x44dffa['model'];if(!_0xc01f29[_0x1a8b('0x44')][_0x1a8b('0x68')]('nolimit')){_0x354de9['limit']=qs[_0x1a8b('0x30')](_0xc01f29['query'][_0x1a8b('0x30')]);_0x354de9[_0x1a8b('0x2f')]=qs['offset'](_0xc01f29['query'][_0x1a8b('0x2f')]);}_0x354de9['order']=qs[_0x1a8b('0x4d')](_0xc01f29[_0x1a8b('0x44')][_0x1a8b('0x4d')]);_0x354de9[_0x1a8b('0x4e')]=qs[_0x1a8b('0x46')](_['pick'](_0xc01f29['query'],_0x44dffa[_0x1a8b('0x46')]));_0x354de9['where'][_0x1a8b('0x63')]=_0x16bea0['id'];if(_0xc01f29[_0x1a8b('0x44')][_0x1a8b('0x50')]){_0x354de9['where']=_[_0x1a8b('0x51')](_0x354de9[_0x1a8b('0x4e')],{'$or':_[_0x1a8b('0x43')](_0x354de9['attributes'],function(_0x2dd271){var _0x148107={};_0x148107[_0x2dd271]={'$like':'%'+_0xc01f29['query'][_0x1a8b('0x50')]+'%'};return _0x148107;})});}_0x354de9=_[_0x1a8b('0x51')]({},_0x354de9,_0xc01f29[_0x1a8b('0x53')]);return db['Disposition']['count']({'where':_0x354de9['where']})[_0x1a8b('0x35')](function(_0x5a7d9a){_0x30f365[_0x1a8b('0x54')]=_0x5a7d9a;if(_0xc01f29[_0x1a8b('0x44')]['includeAll']){_0x354de9[_0x1a8b('0x55')]=[{'all':!![]}];}return db[_0x1a8b('0x64')][_0x1a8b('0x57')](_0x354de9);})['then'](function(_0x550f23){_0x30f365[_0x1a8b('0x58')]=_0x550f23;return _0x30f365;});}})[_0x1a8b('0x35')](respondWithFilteredResult(_0x235f42,_0x354de9))[_0x1a8b('0x59')](handleError(_0x235f42,null));};exports[_0x1a8b('0x69')]=function(_0x481539,_0x5b1519,_0x2c4a01){return db[_0x1a8b('0x56')]['find']({'where':{'id':_0x481539['params']['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x5b1519,null))[_0x1a8b('0x35')](function(_0x3e3b70){if(_0x3e3b70){return _0x3e3b70[_0x1a8b('0x69')](_0x481539[_0x1a8b('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x5b1519,null))[_0x1a8b('0x59')](handleError(_0x5b1519,null));};exports[_0x1a8b('0x6a')]=function(_0x2e910a,_0x315f73,_0x253102){if(_0x2e910a[_0x1a8b('0x5e')]['id']){delete _0x2e910a[_0x1a8b('0x5e')]['id'];}return db[_0x1a8b('0x56')]['find']({'where':{'id':_0x2e910a[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x315f73,null))[_0x1a8b('0x35')](function(_0x2e0b12){if(_0x2e0b12){_0x2e910a[_0x1a8b('0x5e')][_0x1a8b('0x63')]=_0x2e0b12['id'];return db[_0x1a8b('0x6b')][_0x1a8b('0x65')](_0x2e910a[_0x1a8b('0x5e')]);}})[_0x1a8b('0x35')](respondWithResult(_0x315f73,null))[_0x1a8b('0x59')](handleError(_0x315f73,null));};exports[_0x1a8b('0x6c')]=function(_0x553172,_0x1b6d4b,_0x500259){var _0x1cde45={'raw':![],'where':{}};var _0x2d7c60={};var _0x2e8cb6={'count':0x0,'rows':[]};return db['MailAccount'][_0x1a8b('0x67')]({'where':{'id':_0x553172[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x1b6d4b,null))[_0x1a8b('0x35')](function(_0x42a831){if(_0x42a831){_0x2d7c60['model']=_['keys'](db[_0x1a8b('0x6b')]['rawAttributes']);_0x2d7c60[_0x1a8b('0x44')]=_['keys'](_0x553172['query']);_0x2d7c60[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0x2d7c60[_0x1a8b('0x42')],_0x2d7c60['query']);_0x1cde45['attributes']=_[_0x1a8b('0x47')](_0x2d7c60[_0x1a8b('0x42')],qs['fields'](_0x553172[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x1cde45[_0x1a8b('0x48')]=_0x1cde45[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x1cde45[_0x1a8b('0x48')]:_0x2d7c60[_0x1a8b('0x42')];if(!_0x553172[_0x1a8b('0x44')][_0x1a8b('0x68')](_0x1a8b('0x4b'))){_0x1cde45[_0x1a8b('0x30')]=qs[_0x1a8b('0x30')](_0x553172[_0x1a8b('0x44')][_0x1a8b('0x30')]);_0x1cde45['offset']=qs[_0x1a8b('0x2f')](_0x553172['query'][_0x1a8b('0x2f')]);}_0x1cde45[_0x1a8b('0x4c')]=qs[_0x1a8b('0x4d')](_0x553172[_0x1a8b('0x44')][_0x1a8b('0x4d')]);_0x1cde45[_0x1a8b('0x4e')]=qs[_0x1a8b('0x46')](_[_0x1a8b('0x4f')](_0x553172[_0x1a8b('0x44')],_0x2d7c60[_0x1a8b('0x46')]));_0x1cde45[_0x1a8b('0x4e')][_0x1a8b('0x63')]=_0x42a831['id'];if(_0x553172['query'][_0x1a8b('0x50')]){_0x1cde45[_0x1a8b('0x4e')]=_['merge'](_0x1cde45['where'],{'$or':_[_0x1a8b('0x43')](_0x1cde45[_0x1a8b('0x48')],function(_0x14db69){var _0xe5f1ba={};_0xe5f1ba[_0x14db69]={'$like':'%'+_0x553172[_0x1a8b('0x44')][_0x1a8b('0x50')]+'%'};return _0xe5f1ba;})});}_0x1cde45=_[_0x1a8b('0x51')]({},_0x1cde45,_0x553172[_0x1a8b('0x53')]);return db['CannedAnswer'][_0x1a8b('0x54')]({'where':_0x1cde45[_0x1a8b('0x4e')]})[_0x1a8b('0x35')](function(_0x493d26){_0x2e8cb6['count']=_0x493d26;if(_0x553172[_0x1a8b('0x44')][_0x1a8b('0x5c')]){_0x1cde45['include']=[{'all':!![]}];}return db[_0x1a8b('0x6b')]['findAll'](_0x1cde45);})['then'](function(_0x243460){_0x2e8cb6[_0x1a8b('0x58')]=_0x243460;return _0x2e8cb6;});}})['then'](respondWithFilteredResult(_0x1b6d4b,_0x1cde45))[_0x1a8b('0x59')](handleError(_0x1b6d4b,null));};exports[_0x1a8b('0x6d')]=function(_0x38d52a,_0x5b27c3,_0x291662){return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x38d52a[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x5b27c3,null))[_0x1a8b('0x35')](function(_0x54590a){if(_0x54590a){return _0x54590a['removeAnswers'](_0x38d52a['query']['ids']);}})[_0x1a8b('0x35')](respondWithStatusCode(_0x5b27c3,null))[_0x1a8b('0x59')](handleError(_0x5b27c3,null));};exports[_0x1a8b('0x65')]=function(_0x441f3b,_0x54b958){var _0x5bb615={'name':_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x3a')],'key':_0x441f3b[_0x1a8b('0x5e')]['key'],'email':_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x6e')],'ListId':_0x441f3b['body']['ListId'],'active':!_[_0x1a8b('0x6f')](_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x70')])?_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x70')]:!![],'description':_0x441f3b[_0x1a8b('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x441f3b[_0x1a8b('0x5e')]['cservice'])){if(_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x71')]){_0x5bb615[_0x1a8b('0x3d')]['user']=_0x5bb615[_0x1a8b('0x3e')][_0x1a8b('0x72')]=_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x73')];_0x5bb615[_0x1a8b('0x3d')]['password']=_0x5bb615[_0x1a8b('0x3e')]['pass']=_0x441f3b[_0x1a8b('0x5e')]['cpassword'];}else{_0x5bb615['Imap']['authentication']=_0x5bb615['Smtp'][_0x1a8b('0x74')]=![];}_0x5bb615['Imap'][_0x1a8b('0x75')]=_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x3d')][_0x1a8b('0x75')];_0x5bb615['Imap']['port']=_0x441f3b[_0x1a8b('0x5e')]['Imap'][_0x1a8b('0x76')];_0x5bb615[_0x1a8b('0x3e')][_0x1a8b('0x75')]=_0x441f3b['body'][_0x1a8b('0x3e')][_0x1a8b('0x75')];_0x5bb615[_0x1a8b('0x3e')][_0x1a8b('0x76')]=_0x441f3b['body'][_0x1a8b('0x3e')][_0x1a8b('0x76')];}else{_0x5bb615[_0x1a8b('0x3d')][_0x1a8b('0x77')]=_0x5bb615['Smtp'][_0x1a8b('0x77')]=_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x78')];_0x5bb615['Imap'][_0x1a8b('0x72')]=_0x5bb615['Smtp'][_0x1a8b('0x72')]=_0x441f3b['body'][_0x1a8b('0x73')];_0x5bb615[_0x1a8b('0x3d')][_0x1a8b('0x79')]=_0x5bb615['Smtp'][_0x1a8b('0x7a')]=_0x441f3b[_0x1a8b('0x5e')][_0x1a8b('0x7b')];}return db[_0x1a8b('0x56')][_0x1a8b('0x65')](_0x5bb615,{'include':[{'model':db[_0x1a8b('0x5b')],'as':'Smtp'},{'model':db[_0x1a8b('0x3c')],'as':_0x1a8b('0x3d')}]})['then'](function(_0x20d7a0){var _0xfd994f=_0x441f3b[_0x1a8b('0x72')][_0x1a8b('0x37')]({'plain':!![]});if(!_0xfd994f)throw new Error(_0x1a8b('0x7c'));if(_0xfd994f[_0x1a8b('0x7d')]==='user'){var _0x2509ff=_0x20d7a0['get']({'plain':!![]});return db[_0x1a8b('0x7e')][_0x1a8b('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0xfd994f[_0x1a8b('0x7f')]},'raw':!![]})[_0x1a8b('0x35')](function(_0xd6b174){if(_0xd6b174&&_0xd6b174[_0x1a8b('0x80')]===0x0){return db['UserProfileResource'][_0x1a8b('0x65')]({'name':_0x2509ff[_0x1a8b('0x3a')],'resourceId':_0x2509ff['id'],'type':_0xd6b174['name'],'sectionId':_0xd6b174['id']},{})[_0x1a8b('0x35')](function(){return _0x20d7a0;});}else{return _0x20d7a0;}})[_0x1a8b('0x59')](function(_0x247fdf){logger[_0x1a8b('0x26')](_0x1a8b('0x81'),_0x247fdf);throw _0x247fdf;});}return _0x20d7a0;})[_0x1a8b('0x35')](respondWithResult(_0x54b958,0xc9))[_0x1a8b('0x59')](handleError(_0x54b958,null));};exports[_0x1a8b('0x82')]=function(_0x73ca16,_0x2ff8f5,_0xfd790e){return db[_0x1a8b('0x56')]['findOne']({'where':{'id':_0x73ca16[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x2ff8f5,null))['then'](function(_0x1bfde8){if(_0x1bfde8){return _0x1bfde8[_0x1a8b('0x82')]();}return null;})[_0x1a8b('0x35')](respondWithResult(_0x2ff8f5,null))[_0x1a8b('0x59')](handleError(_0x2ff8f5,null));};exports['addImap']=function(_0x11ccc3,_0xb31906,_0x24d030){if(_0x11ccc3[_0x1a8b('0x5e')]['id']){delete _0x11ccc3[_0x1a8b('0x5e')]['id'];}return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x11ccc3[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0xb31906,null))[_0x1a8b('0x35')](function(_0x2721cb){if(_0x2721cb){_0x11ccc3[_0x1a8b('0x5e')][_0x1a8b('0x63')]=_0x2721cb['id'];return db['MailServerIn']['create'](_0x11ccc3[_0x1a8b('0x5e')]);}})['then'](respondWithResult(_0xb31906,null))[_0x1a8b('0x59')](handleError(_0xb31906,null));};exports[_0x1a8b('0x83')]=function(_0x336be8,_0x109fbd,_0x36e0d7){return db['MailAccount']['findOne']({'where':{'id':_0x336be8['params']['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x109fbd,null))['then'](function(_0x543cae){if(_0x543cae){return _0x543cae[_0x1a8b('0x84')](null);}return null;})[_0x1a8b('0x35')](respondWithStatusCode(_0x109fbd,null))['catch'](handleError(_0x109fbd,null));};exports['getSmtp']=function(_0x644066,_0x99ea4c,_0x580718){return db['MailAccount'][_0x1a8b('0x67')]({'where':{'id':_0x644066[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x99ea4c,null))[_0x1a8b('0x35')](function(_0x2315ea){if(_0x2315ea){return _0x2315ea[_0x1a8b('0x85')]();}return null;})[_0x1a8b('0x35')](respondWithResult(_0x99ea4c,null))[_0x1a8b('0x59')](handleError(_0x99ea4c,null));};exports[_0x1a8b('0x86')]=function(_0x244377,_0x29e3be,_0x104e8d){if(_0x244377['body']['id']){delete _0x244377['body']['id'];}return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x244377['params']['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x29e3be,null))['then'](function(_0x4e2f89){if(_0x4e2f89){_0x244377['body'][_0x1a8b('0x63')]=_0x4e2f89['id'];return db[_0x1a8b('0x5b')][_0x1a8b('0x65')](_0x244377[_0x1a8b('0x5e')]);}})[_0x1a8b('0x35')](respondWithResult(_0x29e3be,null))[_0x1a8b('0x59')](handleError(_0x29e3be,null));};exports[_0x1a8b('0x87')]=function(_0x2c3677,_0x36230e,_0x5672ab){return db[_0x1a8b('0x56')][_0x1a8b('0x67')]({'where':{'id':_0x2c3677[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x36230e,null))['then'](function(_0x291e1c){if(_0x291e1c){return _0x291e1c['setSmtp'](null);}return null;})[_0x1a8b('0x35')](respondWithStatusCode(_0x36230e,null))[_0x1a8b('0x59')](handleError(_0x36230e,null));};exports[_0x1a8b('0x88')]=function(_0x1a9342,_0x959c78,_0xae7fc3){return db['MailInteraction']['find']({'where':{'id':_0x1a9342[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x959c78,null))['then'](function(_0x1d6f27){if(_0x1d6f27){return _0x1d6f27[_0x1a8b('0x88')](_0x1a9342[_0x1a8b('0x5e')]['ids'],_[_0x1a8b('0x89')](_0x1a9342['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x959c78,null))[_0x1a8b('0x59')](handleError(_0x959c78,null));};exports[_0x1a8b('0x8a')]=function(_0x235b2d,_0x2dd93b,_0x70edbe){var _0x24574c={'raw':![],'where':{}};var _0xfec0d2={};var _0x3baa35={'count':0x0,'rows':[]};return db['MailAccount'][_0x1a8b('0x67')]({'where':{'id':_0x235b2d[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x2dd93b,null))[_0x1a8b('0x35')](function(_0x2213d4){if(_0x2213d4){_0xfec0d2[_0x1a8b('0x42')]=_[_0x1a8b('0x45')](db[_0x1a8b('0x8b')][_0x1a8b('0x40')]);_0xfec0d2[_0x1a8b('0x44')]=_[_0x1a8b('0x45')](_0x235b2d[_0x1a8b('0x44')]);_0xfec0d2[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0xfec0d2[_0x1a8b('0x42')],_0xfec0d2[_0x1a8b('0x44')]);_0x24574c[_0x1a8b('0x48')]=_[_0x1a8b('0x47')](_0xfec0d2[_0x1a8b('0x42')],qs[_0x1a8b('0x49')](_0x235b2d[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x24574c[_0x1a8b('0x48')]=_0x24574c[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x24574c[_0x1a8b('0x48')]:_0xfec0d2['model'];if(!_0x235b2d[_0x1a8b('0x44')]['hasOwnProperty']('nolimit')){_0x24574c['limit']=qs[_0x1a8b('0x30')](_0x235b2d['query'][_0x1a8b('0x30')]);_0x24574c[_0x1a8b('0x2f')]=qs['offset'](_0x235b2d[_0x1a8b('0x44')][_0x1a8b('0x2f')]);}_0x24574c[_0x1a8b('0x4c')]=qs[_0x1a8b('0x4d')](_0x235b2d[_0x1a8b('0x44')]['sort']);_0x24574c['where']=qs[_0x1a8b('0x46')](_[_0x1a8b('0x4f')](_0x235b2d[_0x1a8b('0x44')],_0xfec0d2[_0x1a8b('0x46')]));_0x24574c[_0x1a8b('0x4e')][_0x1a8b('0x63')]=_0x2213d4['id'];if(_0x235b2d[_0x1a8b('0x44')][_0x1a8b('0x50')]){_0x24574c[_0x1a8b('0x4e')]=_[_0x1a8b('0x51')](_0x24574c[_0x1a8b('0x4e')],{'$or':_[_0x1a8b('0x43')](_0x24574c[_0x1a8b('0x48')],function(_0x82ff87){var _0x5284a4={};_0x5284a4[_0x82ff87]={'$like':'%'+_0x235b2d[_0x1a8b('0x44')][_0x1a8b('0x50')]+'%'};return _0x5284a4;})});}_0x24574c=_[_0x1a8b('0x51')]({},_0x24574c,_0x235b2d[_0x1a8b('0x53')]);return db[_0x1a8b('0x8b')][_0x1a8b('0x54')]({'where':_0x24574c[_0x1a8b('0x4e')]})[_0x1a8b('0x35')](function(_0x950c09){_0x3baa35['count']=_0x950c09;if(_0x235b2d['query'][_0x1a8b('0x5c')]){_0x24574c[_0x1a8b('0x55')]=[{'model':db[_0x1a8b('0x8c')],'as':_0x1a8b('0x8d'),'required':![]},{'model':db[_0x1a8b('0x8e')],'as':'Owner','attributes':['name',_0x1a8b('0x8f'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x1a8b('0x90')],'where':_0x235b2d[_0x1a8b('0x44')]['tag']?{'id':_0x235b2d[_0x1a8b('0x44')][_0x1a8b('0x91')]}:undefined,'required':_0x235b2d['query']['tag']?!![]:![]}];}return db[_0x1a8b('0x8b')][_0x1a8b('0x57')](_0x24574c);})['then'](function(_0xc0aa4){_0x3baa35['rows']=_0xc0aa4;return _0x3baa35;});}})[_0x1a8b('0x35')](respondWithFilteredResult(_0x2dd93b,_0x24574c))[_0x1a8b('0x59')](handleError(_0x2dd93b,null));};exports[_0x1a8b('0x92')]=function(_0x41d227,_0x1942ca,_0x3876b6){return db['MailAccount'][_0x1a8b('0x67')]({'where':{'id':_0x41d227['params']['id']}})['then'](handleEntityNotFound(_0x1942ca,null))[_0x1a8b('0x35')](function(_0x34c432){if(_0x34c432){return db[_0x1a8b('0x93')][_0x1a8b('0x94')](function(_0x2b9eba){return db[_0x1a8b('0x95')][_0x1a8b('0x36')]({'where':{'MailAccountId':_0x41d227[_0x1a8b('0x5f')]['id']},'transaction':_0x2b9eba})[_0x1a8b('0x35')](function(_0x5c468d){var _0x29da79=_[_0x1a8b('0x43')](_0x41d227[_0x1a8b('0x5e')],function(_0x180270){_0x180270['MailAccountId']=_0x41d227[_0x1a8b('0x5f')]['id'];return _0x180270;});return db[_0x1a8b('0x95')]['bulkCreate'](_0x29da79,{'transaction':_0x2b9eba});});})[_0x1a8b('0x35')](function(){return db['MailApplication'][_0x1a8b('0x96')]({'where':{'MailAccountId':_0x41d227[_0x1a8b('0x5f')]['id']},'order':_0x1a8b('0x97')});});}})[_0x1a8b('0x35')](respondWithResult(_0x1942ca,null))['catch'](handleError(_0x1942ca,null));};exports[_0x1a8b('0x98')]=function(_0x20adf4,_0x3837e5,_0x2f597d){var _0x3d879d={};var _0x4a4d87={};var _0x56a946;var _0x5e682f;return db['MailAccount']['findOne']({'where':{'id':_0x20adf4[_0x1a8b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3837e5,null))['then'](function(_0x293a52){if(_0x293a52){_0x56a946=_0x293a52;_0x4a4d87[_0x1a8b('0x42')]=_[_0x1a8b('0x45')](db['MailApplication'][_0x1a8b('0x40')]);_0x4a4d87['query']=_[_0x1a8b('0x45')](_0x20adf4[_0x1a8b('0x44')]);_0x4a4d87[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0x4a4d87[_0x1a8b('0x42')],_0x4a4d87[_0x1a8b('0x44')]);_0x3d879d['attributes']=_[_0x1a8b('0x47')](_0x4a4d87[_0x1a8b('0x42')],qs['fields'](_0x20adf4['query'][_0x1a8b('0x49')]));_0x3d879d['attributes']=_0x3d879d[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x3d879d[_0x1a8b('0x48')]:_0x4a4d87[_0x1a8b('0x42')];_0x3d879d['order']=qs[_0x1a8b('0x4d')](_0x20adf4[_0x1a8b('0x44')][_0x1a8b('0x4d')]);_0x3d879d[_0x1a8b('0x4e')]=qs[_0x1a8b('0x46')](_[_0x1a8b('0x4f')](_0x20adf4['query'],_0x4a4d87[_0x1a8b('0x46')]));if(_0x20adf4[_0x1a8b('0x44')][_0x1a8b('0x50')]){_0x3d879d[_0x1a8b('0x4e')]=_[_0x1a8b('0x51')](_0x3d879d[_0x1a8b('0x4e')],{'$or':_[_0x1a8b('0x43')](_0x3d879d[_0x1a8b('0x48')],function(_0x3c8633){var _0x1178b8={};_0x1178b8[_0x3c8633]={'$like':'%'+_0x20adf4[_0x1a8b('0x44')][_0x1a8b('0x50')]+'%'};return _0x1178b8;})});}_0x3d879d=_[_0x1a8b('0x51')]({},_0x3d879d,_0x20adf4[_0x1a8b('0x53')]);return _0x56a946[_0x1a8b('0x98')](_0x3d879d);}})[_0x1a8b('0x35')](function(_0x53c679){if(_0x53c679){_0x5e682f=_0x53c679['length'];if(!_0x20adf4[_0x1a8b('0x44')][_0x1a8b('0x68')]('nolimit')){_0x3d879d[_0x1a8b('0x30')]=qs['limit'](_0x20adf4[_0x1a8b('0x44')][_0x1a8b('0x30')]);_0x3d879d['offset']=qs[_0x1a8b('0x2f')](_0x20adf4[_0x1a8b('0x44')]['offset']);}return _0x56a946[_0x1a8b('0x98')](_0x3d879d);}})[_0x1a8b('0x35')](function(_0x567ec1){if(_0x567ec1){return _0x567ec1?{'count':_0x5e682f,'rows':_0x567ec1}:null;}})['then'](respondWithResult(_0x3837e5,null))[_0x1a8b('0x59')](handleError(_0x3837e5,null));};exports[_0x1a8b('0x99')]=function(_0x17d9ce,_0x1c95bd,_0x1d999e){var _0x8bfed5={'raw':!![],'where':{}};var _0x4df335={};var _0x31b824={'count':0x0,'rows':[]};return db[_0x1a8b('0x56')][_0x1a8b('0x67')]({'where':{'id':_0x17d9ce[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x1c95bd,null))[_0x1a8b('0x35')](function(_0x742041){if(_0x742041){_0x4df335[_0x1a8b('0x42')]=_[_0x1a8b('0x45')](db[_0x1a8b('0x9a')][_0x1a8b('0x40')]);_0x4df335[_0x1a8b('0x44')]=_['keys'](_0x17d9ce[_0x1a8b('0x44')]);_0x4df335[_0x1a8b('0x46')]=_[_0x1a8b('0x47')](_0x4df335[_0x1a8b('0x42')],_0x4df335[_0x1a8b('0x44')]);_0x8bfed5['attributes']=_[_0x1a8b('0x47')](_0x4df335[_0x1a8b('0x42')],qs['fields'](_0x17d9ce[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x8bfed5[_0x1a8b('0x48')]=_0x8bfed5[_0x1a8b('0x48')][_0x1a8b('0x4a')]?_0x8bfed5[_0x1a8b('0x48')]:_0x4df335[_0x1a8b('0x42')];if(!_0x17d9ce['query'][_0x1a8b('0x68')](_0x1a8b('0x4b'))){_0x8bfed5[_0x1a8b('0x30')]=qs[_0x1a8b('0x30')](_0x17d9ce[_0x1a8b('0x44')][_0x1a8b('0x30')]);_0x8bfed5[_0x1a8b('0x2f')]=qs[_0x1a8b('0x2f')](_0x17d9ce[_0x1a8b('0x44')][_0x1a8b('0x2f')]);}_0x8bfed5[_0x1a8b('0x4c')]=qs[_0x1a8b('0x4d')](_0x17d9ce['query'][_0x1a8b('0x4d')]);_0x8bfed5['where']=qs[_0x1a8b('0x46')](_['pick'](_0x17d9ce[_0x1a8b('0x44')],_0x4df335[_0x1a8b('0x46')]));_0x8bfed5['where'][_0x1a8b('0x63')]=_0x742041['id'];if(_0x17d9ce['query']['filter']){_0x8bfed5[_0x1a8b('0x4e')]=_[_0x1a8b('0x51')](_0x8bfed5[_0x1a8b('0x4e')],{'$or':_[_0x1a8b('0x43')](_0x8bfed5[_0x1a8b('0x48')],function(_0x226a7d){var _0x4a2321={};_0x4a2321[_0x226a7d]={'$like':'%'+_0x17d9ce['query'][_0x1a8b('0x50')]+'%'};return _0x4a2321;})});}if(_0x17d9ce[_0x1a8b('0x44')][_0x1a8b('0x9b')]){var _0x2496ca=_0x17d9ce['query']['$gte']['split'](',');var _0x11e5af={};_0x11e5af[_0x2496ca[0x0]]={'$gte':moment(_0x2496ca[0x1])[_0x1a8b('0x9c')](_0x1a8b('0x9d'))};_0x8bfed5[_0x1a8b('0x4e')]=_['merge'](_0x8bfed5[_0x1a8b('0x4e')],_0x11e5af);}_0x8bfed5=_[_0x1a8b('0x51')]({},_0x8bfed5,_0x17d9ce[_0x1a8b('0x53')]);return db[_0x1a8b('0x9a')][_0x1a8b('0x54')]({'where':_0x8bfed5['where']})['then'](function(_0x5bc73e){_0x31b824[_0x1a8b('0x54')]=_0x5bc73e;if(_0x17d9ce[_0x1a8b('0x44')][_0x1a8b('0x5c')]){_0x8bfed5['include']=[{'all':!![]}];}return db['MailMessage'][_0x1a8b('0x57')](_0x8bfed5);})[_0x1a8b('0x35')](function(_0x4bdec3){if(_0x17d9ce[_0x1a8b('0x44')]['inlineCss']===_0x1a8b('0x9e')){for(var _0x52bf39=0x0;_0x52bf39<_0x4bdec3[_0x1a8b('0x4a')];_0x52bf39++){_0x4bdec3[_0x52bf39][_0x1a8b('0x5e')]=juice(_0x4bdec3[_0x52bf39][_0x1a8b('0x5e')]);}}_0x31b824['rows']=_0x4bdec3;return _0x31b824;});}})[_0x1a8b('0x35')](respondWithFilteredResult(_0x1c95bd,_0x8bfed5))[_0x1a8b('0x59')](handleError(_0x1c95bd,null));};exports['send']=function(_0x415bcd,_0x2caed0,_0x47e167){var _0x2b6af7,_0x27f62a={},_0x147278;if(_0x415bcd[_0x1a8b('0x5e')]['to']){_0x147278=_0x415bcd['body']['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x415bcd[_0x1a8b('0x5f')]['id']},'include':[{'model':db[_0x1a8b('0x9f')],'as':_0x1a8b('0xa0'),'include':[{'model':db[_0x1a8b('0x8c')],'as':_0x1a8b('0xa1'),'where':{'email':_0x147278},'limit':0x1,'order':[[_0x1a8b('0xa2'),_0x1a8b('0xa3')]]}]},{'model':db['MailServerOut'],'as':_0x1a8b('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2caed0,null))[_0x1a8b('0x35')](function(_0x2ff586){if(_0x2ff586){_0x2b6af7=_0x2ff586;if(_0x2ff586[_0x1a8b('0x3e')]){if(_['isNil'](_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa4')])){_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa4')]=util['format'](_0x1a8b('0xa5'),_0x2ff586[_0x1a8b('0x3a')],_0x2ff586[_0x1a8b('0x6e')]||_0x2ff586[_0x1a8b('0x3e')]['user']);}if(_0x415bcd['body']['attachments']&&_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa6')][_0x1a8b('0x4a')]){for(var _0x44c1f1=0x0;_0x44c1f1<_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa6')]['length'];_0x44c1f1+=0x1){_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa6')][_0x44c1f1]={'filename':_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xa6')][_0x44c1f1][_0x1a8b('0x3a')],'path':path[_0x1a8b('0xa7')](config[_0x1a8b('0xa8')],'server/files/attachments',_0x415bcd['body']['attachments'][_0x44c1f1]['basename'])};}}var _0x23a19c={'tls':{'rejectUnauthorized':![]}};if(_[_0x1a8b('0x6f')](_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0x77')])){if(_0x2ff586[_0x1a8b('0x3e')]['authentication']){_0x23a19c[_0x1a8b('0xa9')]={'user':_0x2ff586[_0x1a8b('0x3e')]['user'],'pass':_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0x7a')]};}_0x23a19c[_0x1a8b('0x75')]=_0x2ff586['Smtp']['host'];_0x23a19c[_0x1a8b('0x76')]=_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0x76')];_0x23a19c[_0x1a8b('0xaa')]=_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0xaa')];}else{_0x23a19c[_0x1a8b('0x77')]=_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0x77')];_0x23a19c[_0x1a8b('0xa9')]={'user':_0x2ff586[_0x1a8b('0x3e')][_0x1a8b('0x72')],'pass':_0x2ff586['Smtp'][_0x1a8b('0x7a')]};}return respondWithRpcPromise(_0x1a8b('0xab'),'sendMail',{'account':_0x23a19c,'message':_0x415bcd[_0x1a8b('0x5e')]});}else{throw new Error(_0x1a8b('0xac'));}}})['then'](function(_0xfba8b3){if(_0xfba8b3){_0x27f62a=_0xfba8b3;if(_0x2b6af7['List']){if(_0x2b6af7[_0x1a8b('0xa0')][_0x1a8b('0xa1')][_0x1a8b('0x4a')]){return _0x2b6af7[_0x1a8b('0xa0')][_0x1a8b('0xa1')][0x0];}else{return db[_0x1a8b('0x8c')][_0x1a8b('0x65')](_[_0x1a8b('0x1b')](_0x415bcd[_0x1a8b('0x5e')],{'firstName':_0x415bcd[_0x1a8b('0x5e')]['to'],'email':_0x415bcd[_0x1a8b('0x5e')]['to'],'phone':_0x415bcd[_0x1a8b('0x5e')]['to'],'ListId':_0x2b6af7['ListId']}));}}else{throw new Error(_0x1a8b('0xac'));}}})['then'](function(_0x263926){if(_0x263926){var _0x48e91f={'UserId':_0x415bcd[_0x1a8b('0x72')]['id'],'ContactId':_0x263926['id'],'MailAccountId':_0x2b6af7['id'],'inReplyTo':_0x27f62a[_0x1a8b('0xad')],'to':_0x415bcd['body'][_0x1a8b('0xa4')],'cc':_0x415bcd[_0x1a8b('0x5e')]['cc'],'subject':_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xae')],'attach':_0x415bcd['body'][_0x1a8b('0xaf')],'firstMsgDirection':_0x1a8b('0xb0'),'lastMsgAt':moment()[_0x1a8b('0x9c')](_0x1a8b('0x9d')),'lastMsgDirection':_0x1a8b('0xb0'),'Messages':[_[_0x1a8b('0x51')](_0x415bcd[_0x1a8b('0x5e')],{'messageId':_0x27f62a[_0x1a8b('0xad')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2b6af7['id'],'UserId':_0x415bcd['user']['id'],'ContactId':_0x263926['id']})]};if(_0x415bcd[_0x1a8b('0x5e')][_0x1a8b('0xb1')]){_0x48e91f=_[_0x1a8b('0x51')](_0x48e91f,_0x415bcd[_0x1a8b('0x5e')]['Interaction']);}return db[_0x1a8b('0x8b')][_0x1a8b('0x65')](_0x48e91f,{'include':[{'model':db[_0x1a8b('0x9a')],'as':_0x1a8b('0xb2')}]});}})[_0x1a8b('0x35')](respondWithResult(_0x2caed0,null))[_0x1a8b('0x59')](handleError(_0x2caed0,null));};exports['verifySmtp']=function(_0x311ee6,_0x59cd5b,_0x314624){return db[_0x1a8b('0x56')]['find']({'where':{'id':_0x311ee6['params']['id']},'include':[{'model':db[_0x1a8b('0x5b')],'as':_0x1a8b('0x3e'),'raw':!![]}]})[_0x1a8b('0x35')](handleEntityNotFound(_0x59cd5b,null))['then'](function(_0x14ec62){if(_0x14ec62&&_0x14ec62['Smtp']){var _0x1e67bd={'id':_0x14ec62['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14ec62[_0x1a8b('0x3e')][_0x1a8b('0x77')]){_0x1e67bd[_0x1a8b('0x77')]=_0x14ec62[_0x1a8b('0x3e')][_0x1a8b('0x77')];}else{_0x1e67bd[_0x1a8b('0x75')]=_0x14ec62[_0x1a8b('0x3e')][_0x1a8b('0x75')];_0x1e67bd['port']=_0x14ec62[_0x1a8b('0x3e')][_0x1a8b('0x76')];_0x1e67bd['secure']=_0x14ec62[_0x1a8b('0x3e')][_0x1a8b('0xaa')];}if(_0x14ec62[_0x1a8b('0x3e')]['authentication']){_0x1e67bd['auth']={'user':_0x14ec62['Smtp'][_0x1a8b('0x72')],'pass':_0x14ec62[_0x1a8b('0x3e')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x1a8b('0xb3'),{'account':_0x1e67bd});}})['then'](respondWithResult(_0x59cd5b,null))[_0x1a8b('0x59')](handleError(_0x59cd5b,null));};exports[_0x1a8b('0x36')]=function(_0x3082b6,_0x31a46a){return db['MailAccount']['find']({'where':{'id':_0x3082b6[_0x1a8b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31a46a,null))[_0x1a8b('0x35')](function(_0x543977){if(_0x543977&&_0x543977[_0x1a8b('0x77')]){throw new db[(_0x1a8b('0xb4'))][(_0x1a8b('0xb5'))](_0x1a8b('0xb6'));}return _0x543977;})[_0x1a8b('0x35')](removeEntity(_0x31a46a,null))[_0x1a8b('0x59')](handleError(_0x31a46a,null));};exports['addAgents']=function(_0x2889b7,_0xd6930a,_0x1df33f){return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0x2889b7['params']['id']}})['then'](handleEntityNotFound(_0xd6930a,null))['then'](function(_0x4e11f5){if(_0x4e11f5){return _0x4e11f5[_0x1a8b('0xb7')](_0x2889b7[_0x1a8b('0x5e')][_0x1a8b('0xb8')],_[_0x1a8b('0x89')](_0x2889b7[_0x1a8b('0x5e')],[_0x1a8b('0xb8'),'id'])||{})['spread'](function(_0xd16a2b){for(var _0x5048d3=0x0;_0x5048d3<_0x2889b7[_0x1a8b('0x5e')][_0x1a8b('0xb8')][_0x1a8b('0x4a')];_0x5048d3+=0x1){socket[_0x1a8b('0xb9')](_0x1a8b('0xba'),{'UserId':_0x2889b7[_0x1a8b('0x5e')][_0x1a8b('0xb8')][_0x5048d3],'MailAccountId':_0x2889b7['params']['id']});}return _0xd16a2b;});}})[_0x1a8b('0x35')](respondWithResult(_0xd6930a,null))[_0x1a8b('0x59')](handleError(_0xd6930a,null));};exports['removeAgents']=function(_0xb9c907,_0x1d4a09,_0x25049f){return db[_0x1a8b('0x56')][_0x1a8b('0x5d')]({'where':{'id':_0xb9c907[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x1d4a09,null))['then'](function(_0x1fc88e){if(_0x1fc88e){return _0x1fc88e['removeAgents'](_0xb9c907[_0x1a8b('0x44')][_0x1a8b('0xb8')])[_0x1a8b('0x35')](function(){if(_['isArray'](_0xb9c907[_0x1a8b('0x44')][_0x1a8b('0xb8')])){for(var _0x5c779c=0x0;_0x5c779c<_0xb9c907['query'][_0x1a8b('0xb8')][_0x1a8b('0x4a')];_0x5c779c+=0x1){socket[_0x1a8b('0xb9')](_0x1a8b('0xbb'),{'UserId':Number(_0xb9c907[_0x1a8b('0x44')]['ids'][_0x5c779c]),'MailAccountId':Number(_0xb9c907['params']['id'])});}}else{socket[_0x1a8b('0xb9')](_0x1a8b('0xbb'),{'UserId':Number(_0xb9c907[_0x1a8b('0x44')][_0x1a8b('0xb8')]),'MailAccountId':Number(_0xb9c907[_0x1a8b('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d4a09,null))[_0x1a8b('0x59')](handleError(_0x1d4a09,null));};exports[_0x1a8b('0xbc')]=function(_0x1348d9,_0x44acff,_0x57b851){var _0x1730cc={};var _0x19ad15={};var _0xfdd2af;var _0x2f9168;return db[_0x1a8b('0x56')][_0x1a8b('0x67')]({'where':{'id':_0x1348d9[_0x1a8b('0x5f')]['id']}})[_0x1a8b('0x35')](handleEntityNotFound(_0x44acff,null))['then'](function(_0x498273){if(_0x498273){_0xfdd2af=_0x498273;_0x19ad15[_0x1a8b('0x42')]=_[_0x1a8b('0x45')](db['User'][_0x1a8b('0x40')]);_0x19ad15[_0x1a8b('0x44')]=_[_0x1a8b('0x45')](_0x1348d9['query']);_0x19ad15['filters']=_['intersection'](_0x19ad15[_0x1a8b('0x42')],_0x19ad15[_0x1a8b('0x44')]);_0x1730cc['attributes']=_[_0x1a8b('0x47')](_0x19ad15['model'],qs[_0x1a8b('0x49')](_0x1348d9[_0x1a8b('0x44')][_0x1a8b('0x49')]));_0x1730cc['attributes']=_0x1730cc['attributes'][_0x1a8b('0x4a')]?_0x1730cc['attributes']:_0x19ad15[_0x1a8b('0x42')];_0x1730cc[_0x1a8b('0x4c')]=qs[_0x1a8b('0x4d')](_0x1348d9[_0x1a8b('0x44')][_0x1a8b('0x4d')]);_0x1730cc[_0x1a8b('0x4e')]=qs['filters'](_[_0x1a8b('0x4f')](_0x1348d9[_0x1a8b('0x44')],_0x19ad15['filters']));if(_0x1348d9[_0x1a8b('0x44')]['filter']){_0x1730cc['where']=_[_0x1a8b('0x51')](_0x1730cc['where'],{'$or':_[_0x1a8b('0x43')](_0x1730cc[_0x1a8b('0x48')],function(_0x26deb7){var _0xd1d5d5={};_0xd1d5d5[_0x26deb7]={'$like':'%'+_0x1348d9['query']['filter']+'%'};return _0xd1d5d5;})});}_0x1730cc=_['merge']({},_0x1730cc,_0x1348d9[_0x1a8b('0x53')]);return _0xfdd2af[_0x1a8b('0xbc')](_0x1730cc);}})[_0x1a8b('0x35')](function(_0x5c5140){if(_0x5c5140){_0x2f9168=_0x5c5140[_0x1a8b('0x4a')];if(!_0x1348d9[_0x1a8b('0x44')][_0x1a8b('0x68')](_0x1a8b('0x4b'))){_0x1730cc['limit']=qs[_0x1a8b('0x30')](_0x1348d9['query'][_0x1a8b('0x30')]);_0x1730cc[_0x1a8b('0x2f')]=qs[_0x1a8b('0x2f')](_0x1348d9[_0x1a8b('0x44')][_0x1a8b('0x2f')]);}return _0xfdd2af[_0x1a8b('0xbc')](_0x1730cc);}})['then'](function(_0x5eb475){if(_0x5eb475){return _0x5eb475?{'count':_0x2f9168,'rows':_0x5eb475}:null;}})[_0x1a8b('0x35')](respondWithResult(_0x44acff,null))[_0x1a8b('0x59')](handleError(_0x44acff,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e43d2cb..194e7d9 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 _0x1c45=['../../mysqldb','MailAccount','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x1c45,0xe1));var _0x51c4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c45[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x51c4('0x0'))['db'][_0x51c4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51c4('0x2'),'afterUpdate':_0x51c4('0x3'),'afterDestroy':_0x51c4('0x4')};function emitEvent(_0x23b00e){return function(_0x8f3802,_0x58b022,_0xe998c1){MailAccountEvents[_0x51c4('0x5')](_0x23b00e+':'+_0x8f3802['id'],_0x8f3802);MailAccountEvents['emit'](_0x23b00e,_0x8f3802);_0xe998c1(null);};}for(var e in events){if(events[_0x51c4('0x6')](e)){var event=events[e];MailAccount[_0x51c4('0x7')](e,emitEvent(event));}}module[_0x51c4('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xf6ff=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x11908c,_0x547af6){var _0x10cd4e=function(_0x2c0d66){while(--_0x2c0d66){_0x11908c['push'](_0x11908c['shift']());}};_0x10cd4e(++_0x547af6);}(_0xf6ff,0x11b));var _0xff6f=function(_0x241d9b,_0x45d294){_0x241d9b=_0x241d9b-0x0;var _0x4e5a52=_0xf6ff[_0x241d9b];return _0x4e5a52;};'use strict';var EventEmitter=require(_0xff6f('0x0'));var MailAccount=require(_0xff6f('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xff6f('0x2')](0x0);var events={'afterCreate':_0xff6f('0x3'),'afterUpdate':'update','afterDestroy':_0xff6f('0x4')};function emitEvent(_0x4f6861){return function(_0x2bc3eb,_0x48936f,_0x43a1f1){MailAccountEvents['emit'](_0x4f6861+':'+_0x2bc3eb['id'],_0x2bc3eb);MailAccountEvents['emit'](_0x4f6861,_0x2bc3eb);_0x43a1f1(null);};}for(var e in events){if(events[_0xff6f('0x5')](e)){var event=events[e];MailAccount[_0xff6f('0x6')](e,emitEvent(event));}}module[_0xff6f('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7429d33..c14493e 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 _0xb1e0=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','lodash','util','api','moment','bluebird'];(function(_0x187aa1,_0x3e6fe5){var _0x1686a5=function(_0x5103c1){while(--_0x5103c1){_0x187aa1['push'](_0x187aa1['shift']());}};_0x1686a5(++_0x3e6fe5);}(_0xb1e0,0x126));var _0x0b1e=function(_0x4d01ff,_0x223439){_0x4d01ff=_0x4d01ff-0x0;var _0x5362df=_0xb1e0[_0x4d01ff];return _0x5362df;};'use strict';var _=require(_0x0b1e('0x0'));var util=require(_0x0b1e('0x1'));var logger=require('../../config/logger')(_0x0b1e('0x2'));var moment=require(_0x0b1e('0x3'));var BPromise=require(_0x0b1e('0x4'));var rp=require(_0x0b1e('0x5'));var fs=require('fs');var path=require(_0x0b1e('0x6'));var rimraf=require(_0x0b1e('0x7'));var config=require(_0x0b1e('0x8'));var attributes=require(_0x0b1e('0x9'));module[_0x0b1e('0xa')]=function(_0x2d20a6,_0x1cc263){return _0x2d20a6[_0x0b1e('0xb')]('MailAccount',attributes,{'tableName':_0x0b1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f6d=['../../config/logger','api','moment','request-promise','path','rimraf','./mailAccount.attributes','define','MailAccount','lodash','util'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x0f6d,0xe5));var _0xd0f6=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x0f6d[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var logger=require(_0xd0f6('0x2'))(_0xd0f6('0x3'));var moment=require(_0xd0f6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd0f6('0x5'));var fs=require('fs');var path=require(_0xd0f6('0x6'));var rimraf=require(_0xd0f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd0f6('0x8'));module['exports']=function(_0x268250,_0x1f8f4e){return _0x268250[_0xd0f6('0x9')](_0xd0f6('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ca9324b..a290e1f 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 _0x0f92=['close','autoclose','length','from','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','inReplyTo','Contact\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','*,*,*,*','startRouting','Start','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowMailAccount','raw','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','Contacts','DESC','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority'];(function(_0x5835fb,_0x4f873d){var _0x3b9fe9=function(_0x1c72ef){while(--_0x1c72ef){_0x5835fb['push'](_0x5835fb['shift']());}};_0x3b9fe9(++_0x4f873d);}(_0x0f92,0x83));var _0x20f9=function(_0x4ec044,_0x24f1b5){_0x4ec044=_0x4ec044-0x0;var _0x5dfb27=_0x0f92[_0x4ec044];return _0x5dfb27;};'use strict';var _=require('lodash');var util=require(_0x20f9('0x0'));var moment=require(_0x20f9('0x1'));var BPromise=require(_0x20f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20f9('0x3'));var db=require(_0x20f9('0x4'))['db'];var utils=require(_0x20f9('0x5'));var logger=require('../../config/logger')(_0x20f9('0x6'));var config=require(_0x20f9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x20f9('0x8')][_0x20f9('0x9')]({'port':0x232c});config[_0x20f9('0xa')]=_[_0x20f9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x20f9('0xc'))(new Redis(config[_0x20f9('0xa')]));require(_0x20f9('0xd'))[_0x20f9('0xe')](socket);function respondWithRpcPromise(_0x491711,_0x2e5fcd,_0x41bf94){return new BPromise(function(_0x37487e,_0x13d530){return client[_0x20f9('0xf')](_0x491711,_0x41bf94)[_0x20f9('0x10')](function(_0x1c46bb){logger[_0x20f9('0x11')](_0x20f9('0x12'),_0x2e5fcd,_0x20f9('0x13'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x2e5fcd,_0x20f9('0x13'),JSON[_0x20f9('0x14')](_0x1c46bb));if(_0x1c46bb[_0x20f9('0x15')]){if(_0x1c46bb[_0x20f9('0x15')][_0x20f9('0x16')]===0x1f4){logger['error'](_0x20f9('0x12'),_0x2e5fcd,_0x1c46bb[_0x20f9('0x15')][_0x20f9('0x17')]);return _0x13d530(_0x1c46bb[_0x20f9('0x15')][_0x20f9('0x17')]);}logger['error'](_0x20f9('0x12'),_0x2e5fcd,_0x1c46bb[_0x20f9('0x15')][_0x20f9('0x17')]);return _0x37487e(_0x1c46bb[_0x20f9('0x15')][_0x20f9('0x17')]);}else{logger[_0x20f9('0x11')](_0x20f9('0x12'),_0x2e5fcd,_0x20f9('0x13'));_0x37487e(_0x1c46bb['result'][_0x20f9('0x17')]);}})['catch'](function(_0x2d27d7){logger[_0x20f9('0x15')](_0x20f9('0x12'),_0x2e5fcd,_0x2d27d7);_0x13d530(_0x2d27d7);});});}exports[_0x20f9('0x18')]=function(_0x55157b){var _0x329d7a=this;return new Promise(function(_0x11f621,_0x23db30){return db[_0x20f9('0x19')][_0x20f9('0x1a')]({'raw':_0x55157b[_0x20f9('0x1b')]?_0x55157b[_0x20f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x55157b[_0x20f9('0x1b')]?_0x55157b[_0x20f9('0x1b')][_0x20f9('0x1c')]||null:null,'attributes':_0x55157b[_0x20f9('0x1b')]?_0x55157b[_0x20f9('0x1b')][_0x20f9('0x1d')]||null:null,'limit':_0x55157b[_0x20f9('0x1b')]?_0x55157b[_0x20f9('0x1b')][_0x20f9('0x1e')]||null:null,'include':_0x55157b['options']?_0x55157b['options'][_0x20f9('0x1f')]?_[_0x20f9('0x20')](_0x55157b[_0x20f9('0x1b')][_0x20f9('0x1f')],function(_0x4fee5d){return{'model':db[_0x4fee5d[_0x20f9('0x21')]],'as':_0x4fee5d['as'],'attributes':_0x4fee5d[_0x20f9('0x1d')],'include':_0x4fee5d[_0x20f9('0x1f')]?_[_0x20f9('0x20')](_0x4fee5d['include'],function(_0x33a7ad){return{'model':db[_0x33a7ad[_0x20f9('0x21')]],'as':_0x33a7ad['as'],'attributes':_0x33a7ad[_0x20f9('0x1d')],'include':_0x33a7ad[_0x20f9('0x1f')]?_[_0x20f9('0x20')](_0x33a7ad[_0x20f9('0x1f')],function(_0x1009cd){return{'model':db[_0x1009cd['model']],'as':_0x1009cd['as'],'attributes':_0x1009cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x20f9('0x10')](function(_0x54d238){logger[_0x20f9('0x11')](_0x20f9('0x18'),_0x55157b);logger[_0x20f9('0x22')]('GetMailAccount',_0x55157b,JSON['stringify'](_0x54d238));_0x11f621(_0x54d238);})[_0x20f9('0x23')](function(_0x40b960){logger[_0x20f9('0x15')](_0x20f9('0x18'),_0x40b960[_0x20f9('0x17')],_0x55157b);_0x23db30(_0x329d7a[_0x20f9('0x15')](0x1f4,_0x40b960[_0x20f9('0x17')]));});});};exports[_0x20f9('0x24')]=function(_0x36b6dc){var _0x3ff21f=this;return new Promise(function(_0x1ec213,_0x1ee1d2){return db[_0x20f9('0x19')]['find']({'raw':_0x36b6dc['options']?_0x36b6dc[_0x20f9('0x1b')][_0x20f9('0x25')]===undefined?!![]:![]:!![],'where':_0x36b6dc['options']?_0x36b6dc[_0x20f9('0x1b')]['where']||null:null,'attributes':_0x36b6dc[_0x20f9('0x1b')]?_0x36b6dc[_0x20f9('0x1b')][_0x20f9('0x1d')]||null:null,'include':_0x36b6dc[_0x20f9('0x1b')]?_0x36b6dc[_0x20f9('0x1b')][_0x20f9('0x1f')]?_[_0x20f9('0x20')](_0x36b6dc[_0x20f9('0x1b')]['include'],function(_0x1d52e7){return{'model':db[_0x1d52e7[_0x20f9('0x21')]],'as':_0x1d52e7['as'],'attributes':_0x1d52e7[_0x20f9('0x1d')],'include':_0x1d52e7['include']?_[_0x20f9('0x20')](_0x1d52e7[_0x20f9('0x1f')],function(_0x2fe9f5){return{'model':db[_0x2fe9f5[_0x20f9('0x21')]],'as':_0x2fe9f5['as'],'attributes':_0x2fe9f5[_0x20f9('0x1d')],'include':_0x2fe9f5['include']?_[_0x20f9('0x20')](_0x2fe9f5[_0x20f9('0x1f')],function(_0x213478){return{'model':db[_0x213478[_0x20f9('0x21')]],'as':_0x213478['as'],'attributes':_0x213478[_0x20f9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x20f9('0x10')](function(_0x58e4f9){logger[_0x20f9('0x11')](_0x20f9('0x24'),_0x36b6dc);logger['debug'](_0x20f9('0x24'),_0x36b6dc,JSON[_0x20f9('0x14')](_0x58e4f9));_0x1ec213(_0x58e4f9);})['catch'](function(_0x5b1048){logger[_0x20f9('0x15')](_0x20f9('0x24'),_0x5b1048['message'],_0x36b6dc);_0x1ee1d2(_0x3ff21f[_0x20f9('0x15')](0x1f4,_0x5b1048[_0x20f9('0x17')]));});});};exports[_0x20f9('0x26')]=function(_0x446f92){var _0x44bb6f=this;return new Promise(function(_0x4ee4a1,_0xc8c1ad){var _0x961222={'body':_0x446f92[_0x20f9('0x27')],'channel':_0x20f9('0x28')};var _0x6d2ecf=_[_0x20f9('0x29')](_['keys'](db['CmContact'][_0x20f9('0x2a')]),[_0x20f9('0x2b'),_0x20f9('0x2c'),_0x20f9('0x2d'),_0x20f9('0x2e')]);var _0x37ec83=![];if(_0x446f92[_0x20f9('0x27')]['id']){delete _0x446f92[_0x20f9('0x27')]['id'];}if(_['isNil'](_0x446f92[_0x20f9('0x27')]['from'])){return _0xc8c1ad(_0x44bb6f[_0x20f9('0x15')](0x1f4,_0x20f9('0x2f')));}if(_[_0x20f9('0x30')](_0x446f92[_0x20f9('0x27')][_0x20f9('0x27')])||_0x446f92[_0x20f9('0x27')][_0x20f9('0x27')]===''){return _0xc8c1ad(_0x44bb6f[_0x20f9('0x15')](0x1f4,_0x20f9('0x31')));}if(_[_0x20f9('0x30')](_0x446f92[_0x20f9('0x27')][_0x20f9('0x32')])){return _0xc8c1ad(_0x44bb6f[_0x20f9('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6d2ecf));}if(!_[_0x20f9('0x33')](_0x6d2ecf,_0x446f92['body'][_0x20f9('0x32')])){return _0xc8c1ad(_0x44bb6f[_0x20f9('0x15')](0x1f4,_0x20f9('0x34')+_0x6d2ecf));}var _0x204d71={};_0x204d71[_0x446f92[_0x20f9('0x27')]['mapKey']]=_0x446f92['body']['from'];return db['MailAccount'][_0x20f9('0x35')]({'where':{'id':_0x446f92[_0x20f9('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x20f9('0x37'),'include':[{'model':db[_0x20f9('0x38')],'as':_0x20f9('0x39'),'where':_0x204d71,'limit':0x1,'order':[[_0x20f9('0x2c'),_0x20f9('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x20f9('0x3b')},{'model':db[_0x20f9('0x3c')],'as':_0x20f9('0x3d')}]})[_0x20f9('0x10')](function(_0x49cd72){if(_0x49cd72&&_0x49cd72[_0x20f9('0x37')]){var _0x4e705d=_0x49cd72[_0x20f9('0x3e')]({'plain':!![]});_0x961222[_0x20f9('0x36')]=_[_0x20f9('0x3f')](_0x4e705d,[_0x20f9('0x3b'),_0x20f9('0x37')]);_0x961222[_0x20f9('0x40')]=_0x4e705d[_0x20f9('0x3b')];_0x961222['list']=_0x4e705d[_0x20f9('0x37')];_0x961222[_0x20f9('0x40')]=_[_0x20f9('0x41')](_0x961222[_0x20f9('0x40')],[_0x20f9('0x42')],['asc']);if(_0x961222['account']&&_0x961222['account']['autoclose']){_0x961222[_0x20f9('0x40')]['push']({'id':0x0,'priority':_0x961222['applications']['length']+0x1,'app':_0x20f9('0x43'),'appdata':_0x20f9('0x44'),'interval':'*,*,*,*'});}if(_0x961222[_0x20f9('0x36')]['Applications']){delete _0x961222[_0x20f9('0x36')][_0x20f9('0x3b')];}if(_0x961222['account'][_0x20f9('0x37')]){delete _0x961222['account'][_0x20f9('0x37')];}if(_0x4e705d[_0x20f9('0x37')][_0x20f9('0x39')][_0x20f9('0x45')]){return _0x4e705d[_0x20f9('0x37')]['Contacts'][0x0];}var _0xb4edae=_['defaults'](_0x446f92[_0x20f9('0x27')],{'firstName':_0x446f92['body'][_0x20f9('0x46')],'ListId':_0x4e705d[_0x20f9('0x2e')]});_0xb4edae[_0x446f92[_0x20f9('0x27')]['mapKey']]=_0x446f92[_0x20f9('0x27')][_0x20f9('0x46')];return db[_0x20f9('0x38')][_0x20f9('0x47')](_0xb4edae);}else{throw new Error(_0x20f9('0x48'));}})[_0x20f9('0x10')](function(_0x2de466){_0x961222['contact']=_0x2de466;if(_0x2de466){if(!_0x446f92[_0x20f9('0x27')]['message'][_0x20f9('0x49')]){_0x446f92[_0x20f9('0x27')]['message'][_0x20f9('0x49')]=rs[_0x20f9('0x4a')]()+'\x20'+_0x446f92[_0x20f9('0x27')]['message'][_0x20f9('0x46')];}var _0x4844d4={'ContactId':_0x2de466['id'],'MailAccountId':_0x446f92['account']['id'],'inReplyTo':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x49')],'to':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x46')],'cc':_0x446f92[_0x20f9('0x27')]['message']['cc'],'subject':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x4b')],'attach':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x20f9('0x4d')][_0x20f9('0x35')]({'where':{'closed':![],'MailAccountId':_0x446f92[_0x20f9('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x20f9('0x49')],'where':{'messageId':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x4e')]}}]})['then'](function(_0x3ab301){if(_0x3ab301){return[_0x3ab301,![]];}return db[_0x20f9('0x4d')][_0x20f9('0x47')](_0x4844d4)[_0x20f9('0x10')](function(_0x105e59){return[_0x105e59,!![]];});});}else{throw new Error(_0x20f9('0x4f'));}})['spread'](function(_0x492fde,_0x23c7ee){if(_0x492fde){_0x37ec83=_0x23c7ee;if(!_0x23c7ee){return _0x492fde['update']({'inReplyTo':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x49')],'to':_0x446f92[_0x20f9('0x27')]['message'][_0x20f9('0x46')],'cc':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['cc'],'subject':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x4b')],'attach':_0x492fde[_0x20f9('0x4c')]?_0x492fde[_0x20f9('0x4c')]:_0x446f92['body'][_0x20f9('0x17')][_0x20f9('0x4c')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x20f9('0x50')](_0x20f9('0x51')),'lastMsgDirection':'in'});}else{return _0x492fde;}}})['then'](function(_0x1dd424){_0x961222[_0x20f9('0x52')]=_0x1dd424[_0x20f9('0x3e')]({'plain':!![]});_0x961222['interaction'][_0x20f9('0x53')]=_0x37ec83;return db['MailMessage'][_0x20f9('0x47')]({'body':_0x446f92[_0x20f9('0x27')]['body'],'MailAccountId':_0x446f92[_0x20f9('0x36')]['id'],'MailInteractionId':_0x1dd424['id'],'direction':'in','ContactId':_0x961222[_0x20f9('0x54')]['id'],'messageId':_0x446f92[_0x20f9('0x27')]['message']['messageId'],'from':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x46')],'to':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['to'],'cc':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['cc'],'subject':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['subject'],'attach':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['attach'],'Attachments':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')]['attachments'],'originTo':_0x446f92[_0x20f9('0x27')]['message'][_0x20f9('0x55')],'originCc':_0x446f92[_0x20f9('0x27')]['message']['originCc'],'bcc':_0x446f92['body']['message'][_0x20f9('0x56')],'ChatWebsiteId':_0x446f92['body'][_0x20f9('0x17')][_0x20f9('0x57')]||null,'originChannel':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x58')]||_0x20f9('0x59'),'ChatOfflineMessageId':_0x446f92[_0x20f9('0x27')][_0x20f9('0x17')][_0x20f9('0x5a')]||null},{'include':[{'model':db['Attachment'],'as':_0x20f9('0x5b')}]});})['then'](function(_0x13c06c){_0x961222[_0x20f9('0x17')]=_0x13c06c;if(_0x961222['interaction'][_0x20f9('0x5c')]){return db[_0x20f9('0x5d')]['find']({'attributes':['id','name'],'where':{'id':_0x961222[_0x20f9('0x52')]['UserId']}})['then'](function(_0x5961df){if(_0x5961df){_0x961222[_0x20f9('0x40')][_0x20f9('0x5e')]({'id':0x0,'priority':0x0,'app':_0x20f9('0x5f'),'appdata':_0x5961df['name']+','+(_0x961222[_0x20f9('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x20f9('0x60')});}return respondWithRpcPromise('Start',_0x20f9('0x61'),_0x961222);});}return respondWithRpcPromise(_0x20f9('0x62'),_0x20f9('0x61'),_0x961222);})[_0x20f9('0x10')](function(_0x50ad39){_0x4ee4a1(_0x50ad39);})[_0x20f9('0x23')](function(_0xc51b78){_0xc8c1ad(_0x44bb6f[_0x20f9('0x15')](0x1f4,_0xc51b78[_0x20f9('0x17')]));});});}; \ No newline at end of file +var _0x5c45=['Messages','messageId','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','created','contact','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','where','limit','include','map','model','attributes','GetMailAccount','catch','ShowMailAccount','MailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','MailApplication','Applications','MailServerOut','Smtp','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5c45,0x1c5));var _0x55c4=function(_0x463f26,_0x3936e6){_0x463f26=_0x463f26-0x0;var _0x105589=_0x5c45[_0x463f26];return _0x105589;};'use strict';var _=require(_0x55c4('0x0'));var util=require(_0x55c4('0x1'));var moment=require(_0x55c4('0x2'));var BPromise=require(_0x55c4('0x3'));var rs=require(_0x55c4('0x4'));var fs=require('fs');var Redis=require(_0x55c4('0x5'));var db=require(_0x55c4('0x6'))['db'];var utils=require(_0x55c4('0x7'));var logger=require(_0x55c4('0x8'))(_0x55c4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x55c4('0xa')]({'port':0x232c});config[_0x55c4('0xb')]=_[_0x55c4('0xc')](config['redis'],{'host':_0x55c4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55c4('0xb')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2cb9fa,_0x22f34a,_0x2d2376){return new BPromise(function(_0x1e8a80,_0x3d3c9a){return client[_0x55c4('0xe')](_0x2cb9fa,_0x2d2376)[_0x55c4('0xf')](function(_0x211966){logger[_0x55c4('0x10')](_0x55c4('0x11'),_0x22f34a,'request\x20sent');logger[_0x55c4('0x12')](_0x55c4('0x13'),_0x22f34a,'request\x20sent',JSON[_0x55c4('0x14')](_0x211966));if(_0x211966['error']){if(_0x211966[_0x55c4('0x15')][_0x55c4('0x16')]===0x1f4){logger[_0x55c4('0x15')](_0x55c4('0x11'),_0x22f34a,_0x211966[_0x55c4('0x15')]['message']);return _0x3d3c9a(_0x211966[_0x55c4('0x15')][_0x55c4('0x17')]);}logger[_0x55c4('0x15')]('MailAccount,\x20%s,\x20%s',_0x22f34a,_0x211966['error'][_0x55c4('0x17')]);return _0x1e8a80(_0x211966[_0x55c4('0x15')]['message']);}else{logger[_0x55c4('0x10')](_0x55c4('0x11'),_0x22f34a,'request\x20sent');_0x1e8a80(_0x211966[_0x55c4('0x18')][_0x55c4('0x17')]);}})['catch'](function(_0x484dbd){logger[_0x55c4('0x15')]('MailAccount,\x20%s,\x20%s',_0x22f34a,_0x484dbd);_0x3d3c9a(_0x484dbd);});});}exports['GetMailAccount']=function(_0xcf0e7c){var _0x531c8e=this;return new Promise(function(_0x1831c6,_0x2eb2fc){return db['MailAccount']['findAll']({'raw':_0xcf0e7c['options']?_0xcf0e7c[_0x55c4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xcf0e7c[_0x55c4('0x19')]?_0xcf0e7c['options'][_0x55c4('0x1a')]||null:null,'attributes':_0xcf0e7c['options']?_0xcf0e7c[_0x55c4('0x19')]['attributes']||null:null,'limit':_0xcf0e7c['options']?_0xcf0e7c[_0x55c4('0x19')][_0x55c4('0x1b')]||null:null,'include':_0xcf0e7c[_0x55c4('0x19')]?_0xcf0e7c['options'][_0x55c4('0x1c')]?_[_0x55c4('0x1d')](_0xcf0e7c[_0x55c4('0x19')][_0x55c4('0x1c')],function(_0xd58029){return{'model':db[_0xd58029[_0x55c4('0x1e')]],'as':_0xd58029['as'],'attributes':_0xd58029[_0x55c4('0x1f')],'include':_0xd58029['include']?_[_0x55c4('0x1d')](_0xd58029[_0x55c4('0x1c')],function(_0x4a6382){return{'model':db[_0x4a6382['model']],'as':_0x4a6382['as'],'attributes':_0x4a6382[_0x55c4('0x1f')],'include':_0x4a6382[_0x55c4('0x1c')]?_['map'](_0x4a6382[_0x55c4('0x1c')],function(_0xb09bb2){return{'model':db[_0xb09bb2[_0x55c4('0x1e')]],'as':_0xb09bb2['as'],'attributes':_0xb09bb2['attributes']};}):[]};}):[]};}):[]:[]})[_0x55c4('0xf')](function(_0x3dc1f6){logger[_0x55c4('0x10')]('GetMailAccount',_0xcf0e7c);logger['debug'](_0x55c4('0x20'),_0xcf0e7c,JSON[_0x55c4('0x14')](_0x3dc1f6));_0x1831c6(_0x3dc1f6);})[_0x55c4('0x21')](function(_0x38194e){logger[_0x55c4('0x15')](_0x55c4('0x20'),_0x38194e[_0x55c4('0x17')],_0xcf0e7c);_0x2eb2fc(_0x531c8e['error'](0x1f4,_0x38194e[_0x55c4('0x17')]));});});};exports[_0x55c4('0x22')]=function(_0x3dab67){var _0x39c39b=this;return new Promise(function(_0x2e09cf,_0x368a78){return db[_0x55c4('0x23')][_0x55c4('0x24')]({'raw':_0x3dab67[_0x55c4('0x19')]?_0x3dab67['options']['raw']===undefined?!![]:![]:!![],'where':_0x3dab67[_0x55c4('0x19')]?_0x3dab67[_0x55c4('0x19')]['where']||null:null,'attributes':_0x3dab67[_0x55c4('0x19')]?_0x3dab67[_0x55c4('0x19')][_0x55c4('0x1f')]||null:null,'include':_0x3dab67['options']?_0x3dab67[_0x55c4('0x19')]['include']?_[_0x55c4('0x1d')](_0x3dab67[_0x55c4('0x19')][_0x55c4('0x1c')],function(_0x4bba25){return{'model':db[_0x4bba25[_0x55c4('0x1e')]],'as':_0x4bba25['as'],'attributes':_0x4bba25[_0x55c4('0x1f')],'include':_0x4bba25[_0x55c4('0x1c')]?_[_0x55c4('0x1d')](_0x4bba25[_0x55c4('0x1c')],function(_0x510e61){return{'model':db[_0x510e61[_0x55c4('0x1e')]],'as':_0x510e61['as'],'attributes':_0x510e61[_0x55c4('0x1f')],'include':_0x510e61[_0x55c4('0x1c')]?_[_0x55c4('0x1d')](_0x510e61[_0x55c4('0x1c')],function(_0x588def){return{'model':db[_0x588def[_0x55c4('0x1e')]],'as':_0x588def['as'],'attributes':_0x588def[_0x55c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x55c4('0xf')](function(_0x1dab84){logger[_0x55c4('0x10')](_0x55c4('0x22'),_0x3dab67);logger[_0x55c4('0x12')]('ShowMailAccount',_0x3dab67,JSON[_0x55c4('0x14')](_0x1dab84));_0x2e09cf(_0x1dab84);})[_0x55c4('0x21')](function(_0x45fcab){logger[_0x55c4('0x15')]('ShowMailAccount',_0x45fcab[_0x55c4('0x17')],_0x3dab67);_0x368a78(_0x39c39b[_0x55c4('0x15')](0x1f4,_0x45fcab[_0x55c4('0x17')]));});});};exports[_0x55c4('0x25')]=function(_0x3b94b9){var _0x27653a=this;return new Promise(function(_0x2c0adc,_0x26bd87){var _0x27ebdd={'body':_0x3b94b9['body'],'channel':_0x55c4('0x26')};var _0x1f4871=_[_0x55c4('0x27')](_[_0x55c4('0x28')](db[_0x55c4('0x29')][_0x55c4('0x2a')]),[_0x55c4('0x2b'),'updatedAt',_0x55c4('0x2c'),_0x55c4('0x2d')]);var _0x4dedb9=![];if(_0x3b94b9[_0x55c4('0x2e')]['id']){delete _0x3b94b9[_0x55c4('0x2e')]['id'];}if(_['isNil'](_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x2f')])){return _0x26bd87(_0x27653a[_0x55c4('0x15')](0x1f4,_0x55c4('0x30')));}if(_[_0x55c4('0x31')](_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x2e')])||_0x3b94b9[_0x55c4('0x2e')]['body']===''){return _0x26bd87(_0x27653a[_0x55c4('0x15')](0x1f4,_0x55c4('0x32')));}if(_[_0x55c4('0x31')](_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x33')])){return _0x26bd87(_0x27653a['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f4871));}if(!_[_0x55c4('0x34')](_0x1f4871,_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x33')])){return _0x26bd87(_0x27653a[_0x55c4('0x15')](0x1f4,_0x55c4('0x35')+_0x1f4871));}var _0x4b143a={};_0x4b143a[_0x3b94b9['body']['mapKey']]=_0x3b94b9['body'][_0x55c4('0x2f')];return db[_0x55c4('0x23')][_0x55c4('0x24')]({'where':{'id':_0x3b94b9['account']['id']},'include':[{'model':db[_0x55c4('0x36')],'as':_0x55c4('0x37'),'include':[{'model':db['CmContact'],'as':_0x55c4('0x38'),'where':_0x4b143a,'limit':0x1,'order':[[_0x55c4('0x39'),'DESC']]}]},{'model':db[_0x55c4('0x3a')],'as':_0x55c4('0x3b')},{'model':db[_0x55c4('0x3c')],'as':_0x55c4('0x3d')}]})[_0x55c4('0xf')](function(_0x5d5342){if(_0x5d5342&&_0x5d5342[_0x55c4('0x37')]){var _0x3f0465=_0x5d5342[_0x55c4('0x3e')]({'plain':!![]});_0x27ebdd[_0x55c4('0x3f')]=_[_0x55c4('0x40')](_0x3f0465,[_0x55c4('0x3b'),_0x55c4('0x37')]);_0x27ebdd[_0x55c4('0x41')]=_0x3f0465[_0x55c4('0x3b')];_0x27ebdd[_0x55c4('0x42')]=_0x3f0465['List'];_0x27ebdd['applications']=_[_0x55c4('0x43')](_0x27ebdd[_0x55c4('0x41')],[_0x55c4('0x44')],[_0x55c4('0x45')]);if(_0x27ebdd[_0x55c4('0x3f')]&&_0x27ebdd[_0x55c4('0x3f')][_0x55c4('0x46')]){_0x27ebdd['applications'][_0x55c4('0x47')]({'id':0x0,'priority':_0x27ebdd['applications'][_0x55c4('0x48')]+0x1,'app':_0x55c4('0x49'),'appdata':_0x55c4('0x46'),'interval':_0x55c4('0x4a')});}if(_0x27ebdd[_0x55c4('0x3f')]['Applications']){delete _0x27ebdd[_0x55c4('0x3f')][_0x55c4('0x3b')];}if(_0x27ebdd[_0x55c4('0x3f')]['List']){delete _0x27ebdd[_0x55c4('0x3f')]['List'];}if(_0x3f0465[_0x55c4('0x37')][_0x55c4('0x38')]['length']){return _0x3f0465[_0x55c4('0x37')][_0x55c4('0x38')][0x0];}var _0x3ff8c8=_[_0x55c4('0xc')](_0x3b94b9[_0x55c4('0x2e')],{'firstName':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x2f')],'ListId':_0x3f0465[_0x55c4('0x2d')]});_0x3ff8c8[_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x33')]]=_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x2f')];return db[_0x55c4('0x29')]['create'](_0x3ff8c8);}else{throw new Error('List\x20not\x20found');}})[_0x55c4('0xf')](function(_0x2bf551){_0x27ebdd['contact']=_0x2bf551;if(_0x2bf551){if(!_0x3b94b9['body'][_0x55c4('0x17')]['messageId']){_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')]['messageId']=rs[_0x55c4('0x4b')]()+'\x20'+_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x2f')];}var _0x2e8688={'ContactId':_0x2bf551['id'],'MailAccountId':_0x3b94b9[_0x55c4('0x3f')]['id'],'inReplyTo':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')]['messageId'],'to':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x2f')],'cc':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')]['cc'],'subject':_0x3b94b9['body'][_0x55c4('0x17')][_0x55c4('0x4c')],'attach':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x4d')],'lastMsgAt':moment()[_0x55c4('0x4e')](_0x55c4('0x4f')),'lastMsgDirection':'in'};return db[_0x55c4('0x50')][_0x55c4('0x24')]({'where':{'closed':![],'MailAccountId':_0x3b94b9[_0x55c4('0x3f')]['id']},'include':[{'model':db[_0x55c4('0x51')],'as':_0x55c4('0x52'),'attributes':[_0x55c4('0x53')],'where':{'messageId':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x54')]}}]})[_0x55c4('0xf')](function(_0x30e918){if(_0x30e918){return[_0x30e918,![]];}return db['MailInteraction'][_0x55c4('0x55')](_0x2e8688)[_0x55c4('0xf')](function(_0x45ae00){return[_0x45ae00,!![]];});});}else{throw new Error(_0x55c4('0x56'));}})[_0x55c4('0x57')](function(_0x1cea5b,_0xa07dcd){if(_0x1cea5b){_0x4dedb9=_0xa07dcd;if(!_0xa07dcd){return _0x1cea5b[_0x55c4('0x58')]({'inReplyTo':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x53')],'to':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x2f')],'cc':_0x3b94b9[_0x55c4('0x2e')]['message']['cc'],'subject':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x4c')],'attach':_0x1cea5b['attach']?_0x1cea5b[_0x55c4('0x4d')]:_0x3b94b9['body'][_0x55c4('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x55c4('0x4e')](_0x55c4('0x4f')),'lastMsgAt':moment()[_0x55c4('0x4e')](_0x55c4('0x4f')),'lastMsgDirection':'in'});}else{return _0x1cea5b;}}})[_0x55c4('0xf')](function(_0x30af0d){_0x27ebdd['interaction']=_0x30af0d[_0x55c4('0x3e')]({'plain':!![]});_0x27ebdd[_0x55c4('0x59')][_0x55c4('0x5a')]=_0x4dedb9;return db[_0x55c4('0x51')][_0x55c4('0x55')]({'body':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x2e')],'MailAccountId':_0x3b94b9[_0x55c4('0x3f')]['id'],'MailInteractionId':_0x30af0d['id'],'direction':'in','ContactId':_0x27ebdd[_0x55c4('0x5b')]['id'],'messageId':_0x3b94b9['body'][_0x55c4('0x17')][_0x55c4('0x53')],'from':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x2f')],'to':_0x3b94b9[_0x55c4('0x2e')]['message']['to'],'cc':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')]['cc'],'subject':_0x3b94b9[_0x55c4('0x2e')]['message']['subject'],'attach':_0x3b94b9[_0x55c4('0x2e')]['message'][_0x55c4('0x4d')],'Attachments':_0x3b94b9['body'][_0x55c4('0x17')][_0x55c4('0x5c')],'originTo':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x5d')],'originCc':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x5e')],'bcc':_0x3b94b9['body']['message']['bcc'],'ChatWebsiteId':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x5f')]||null,'originChannel':_0x3b94b9[_0x55c4('0x2e')][_0x55c4('0x17')][_0x55c4('0x60')]||_0x55c4('0x61'),'ChatOfflineMessageId':_0x3b94b9[_0x55c4('0x2e')]['message'][_0x55c4('0x62')]||null},{'include':[{'model':db[_0x55c4('0x63')],'as':'Attachments'}]});})[_0x55c4('0xf')](function(_0x44652){_0x27ebdd['message']=_0x44652;if(_0x27ebdd[_0x55c4('0x59')][_0x55c4('0x64')]){return db[_0x55c4('0x65')][_0x55c4('0x24')]({'attributes':['id',_0x55c4('0x66')],'where':{'id':_0x27ebdd[_0x55c4('0x59')][_0x55c4('0x64')]}})[_0x55c4('0xf')](function(_0x307db7){if(_0x307db7){_0x27ebdd[_0x55c4('0x41')][_0x55c4('0x67')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x307db7['name']+','+(_0x27ebdd['account'][_0x55c4('0x68')]||0xa),'interval':_0x55c4('0x4a')});}return respondWithRpcPromise(_0x55c4('0x69'),_0x55c4('0x6a'),_0x27ebdd);});}return respondWithRpcPromise(_0x55c4('0x69'),_0x55c4('0x6a'),_0x27ebdd);})[_0x55c4('0xf')](function(_0x2e26bc){_0x2c0adc(_0x2e26bc);})[_0x55c4('0x21')](function(_0x33e6af){_0x26bd87(_0x27653a[_0x55c4('0x15')](0x1f4,_0x33e6af['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f6c8cb0..4304c19 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 _0x6dac=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x246233,_0x322137){var _0x48f431=function(_0x2f41e4){while(--_0x2f41e4){_0x246233['push'](_0x246233['shift']());}};_0x48f431(++_0x322137);}(_0x6dac,0x16e));var _0xc6da=function(_0x26d1ee,_0x2392ae){_0x26d1ee=_0x26d1ee-0x0;var _0x16b1d8=_0x6dac[_0x26d1ee];return _0x16b1d8;};'use strict';var MailAccountEvents=require(_0xc6da('0x0'));var events=[_0xc6da('0x1'),_0xc6da('0x2'),_0xc6da('0x3')];function createListener(_0x133ecc,_0x224a52){return function(_0x3391f5){_0x224a52[_0xc6da('0x4')](_0x133ecc,_0x3391f5);};}function removeListener(_0x28663f,_0x338470){return function(){MailAccountEvents[_0xc6da('0x5')](_0x28663f,_0x338470);};}exports[_0xc6da('0x6')]=function(_0x325f49){for(var _0x5caf49=0x0,_0x1ebd11=events[_0xc6da('0x7')];_0x5caf49<_0x1ebd11;_0x5caf49++){var _0x5a0d8d=events[_0x5caf49];var _0x3047d3=createListener(_0xc6da('0x8')+_0x5a0d8d,_0x325f49);MailAccountEvents['on'](_0x5a0d8d,_0x3047d3);}}; \ No newline at end of file +var _0xdd68=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xdd68,0x196));var _0x8dd6=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xdd68[_0x4d21ff];return _0x22b554;};'use strict';var MailAccountEvents=require(_0x8dd6('0x0'));var events=['save',_0x8dd6('0x1'),_0x8dd6('0x2')];function createListener(_0x1aa630,_0x437161){return function(_0x5be787){_0x437161[_0x8dd6('0x3')](_0x1aa630,_0x5be787);};}function removeListener(_0x469e0c,_0x5c7c72){return function(){MailAccountEvents[_0x8dd6('0x4')](_0x469e0c,_0x5c7c72);};}exports[_0x8dd6('0x5')]=function(_0x5aa303){for(var _0x54708f=0x0,_0x4c021f=events[_0x8dd6('0x6')];_0x54708f<_0x4c021f;_0x54708f++){var _0x51f78e=events[_0x54708f];var _0x199f07=createListener(_0x8dd6('0x7')+_0x51f78e,_0x5aa303);MailAccountEvents['on'](_0x51f78e,_0x199f07);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 583d8f3..8f230a7 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 _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x5e0970,_0x46f0bd){var _0x82f16c=function(_0x386882){while(--_0x386882){_0x5e0970['push'](_0x5e0970['shift']());}};_0x82f16c(++_0x46f0bd);}(_0xeffd,0x6b));var _0xdeff=function(_0x293e86,_0x1a3ddd){_0x293e86=_0x293e86-0x0;var _0x6c764=_0xeffd[_0x293e86];return _0x6c764;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xd')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xf')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);module[_0xdeff('0x11')]=router; \ No newline at end of file +var _0x3f8c=['/:id','isAuthenticated','show','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2ddea4,_0x3b4d83){var _0xb3eb2=function(_0x11ab0a){while(--_0x11ab0a){_0x2ddea4['push'](_0x2ddea4['shift']());}};_0xb3eb2(++_0x3b4d83);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1f6a71,_0x28f8c8){_0x1f6a71=_0x1f6a71-0x0;var _0x3854b2=_0x3f8c[_0x1f6a71];return _0x3854b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x7')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0x8')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);module[_0xc3f8('0xa')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ec78ede..fc1faef 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 _0xe4e7=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe4e7,0x78));var _0x7e4e=function(_0xf34bcf,_0x41d6be){_0xf34bcf=_0xf34bcf-0x0;var _0x2b733b=_0xe4e7[_0xf34bcf];return _0x2b733b;};'use strict';var Sequelize=require(_0x7e4e('0x0'));module[_0x7e4e('0x1')]={'priority':{'type':Sequelize[_0x7e4e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e4e('0x3')],'allowNull':![],'defaultValue':_0x7e4e('0x4')},'appdata':{'type':Sequelize[_0x7e4e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa33d=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x52db06,_0x36c011){var _0x568a1f=function(_0x26fdca){while(--_0x26fdca){_0x52db06['push'](_0x52db06['shift']());}};_0x568a1f(++_0x36c011);}(_0xa33d,0x8f));var _0xda33=function(_0x3dccad,_0x1a176f){_0x3dccad=_0x3dccad-0x0;var _0x522ef1=_0xa33d[_0x3dccad];return _0x522ef1;};'use strict';var Sequelize=require('sequelize');module[_0xda33('0x0')]={'priority':{'type':Sequelize[_0xda33('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xda33('0x2')],'allowNull':![],'defaultValue':_0xda33('0x3')},'appdata':{'type':Sequelize[_0xda33('0x4')]()},'description':{'type':Sequelize[_0xda33('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index cd82a55..c63aec9 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 _0x7002=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','apply','save','update','then','sendStatus','error','stack','name','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js'];(function(_0xf2cf08,_0x1ce1bc){var _0x2f87ee=function(_0x43c1e9){while(--_0x43c1e9){_0xf2cf08['push'](_0xf2cf08['shift']());}};_0x2f87ee(++_0x1ce1bc);}(_0x7002,0x180));var _0x2700=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x7002[_0x845505];return _0x2513b9;};'use strict';var pdf=require(_0x2700('0x0'));var emlformat=require(_0x2700('0x1'));var rimraf=require(_0x2700('0x2'));var zipdir=require(_0x2700('0x3'));var jsonpatch=require(_0x2700('0x4'));var rp=require(_0x2700('0x5'));var moment=require(_0x2700('0x6'));var BPromise=require(_0x2700('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2700('0x8'));var sox=require(_0x2700('0x9'));var csv=require(_0x2700('0xa'));var ejs=require(_0x2700('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2700('0xc'));var jsforce=require(_0x2700('0xd'));var deskjs=require(_0x2700('0xe'));var toCsv=require(_0x2700('0xa'));var querystring=require(_0x2700('0xf'));var Papa=require(_0x2700('0x10'));var Redis=require(_0x2700('0x11'));var authService=require(_0x2700('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2700('0x13'));var hardwareService=require(_0x2700('0x14'));var logger=require(_0x2700('0x15'))(_0x2700('0x16'));var utils=require(_0x2700('0x17'));var config=require(_0x2700('0x18'));var licenseUtil=require(_0x2700('0x19'));var db=require(_0x2700('0x1a'))['db'];function respondWithStatusCode(_0x52542f,_0x2eef19){_0x2eef19=_0x2eef19||0xcc;return function(_0x284c84){if(_0x284c84){return _0x52542f['sendStatus'](_0x2eef19);}return _0x52542f['status'](_0x2eef19)[_0x2700('0x1b')]();};}function respondWithResult(_0x35dfb2,_0x312ce5){_0x312ce5=_0x312ce5||0xc8;return function(_0x5507e1){if(_0x5507e1){return _0x35dfb2[_0x2700('0x1c')](_0x312ce5)[_0x2700('0x1d')](_0x5507e1);}};}function respondWithFilteredResult(_0x6d0956,_0x173e53){return function(_0x54dedd){if(_0x54dedd){var _0x45169d=_0x54dedd['count'],_0x508fc0=_0x173e53[_0x2700('0x1e')],_0x1cbf4f=_0x173e53[_0x2700('0x1e')]+_0x173e53['limit'],_0x32d61d;if(_0x1cbf4f>=_0x45169d){_0x1cbf4f=_0x45169d;_0x32d61d=0xc8;}else{_0x32d61d=0xce;}_0x6d0956[_0x2700('0x1c')](_0x32d61d);return _0x6d0956['set']('Content-Range',_0x508fc0+'-'+_0x1cbf4f+'/'+_0x45169d)[_0x2700('0x1d')](_0x54dedd);}return null;};}function patchUpdates(_0x24a673){return function(_0x5e9a9b){try{jsonpatch[_0x2700('0x1f')](_0x5e9a9b,_0x24a673,!![]);}catch(_0x5d36e0){return BPromise['reject'](_0x5d36e0);}return _0x5e9a9b[_0x2700('0x20')]();};}function saveUpdates(_0x37b2fd,_0x60dfcc){return function(_0x319bd2){if(_0x319bd2){return _0x319bd2[_0x2700('0x21')](_0x37b2fd)[_0x2700('0x22')](function(_0x4a741e){return _0x4a741e;});}return null;};}function removeEntity(_0x3066b1,_0x359a27){return function(_0x1c74f5){if(_0x1c74f5){return _0x1c74f5['destroy']()[_0x2700('0x22')](function(){_0x3066b1['status'](0xcc)[_0x2700('0x1b')]();});}};}function handleEntityNotFound(_0x99abed,_0x49fa06){return function(_0x2c4843){if(!_0x2c4843){_0x99abed[_0x2700('0x23')](0x194);}return _0x2c4843;};}function handleError(_0x120da6,_0x5b299f){_0x5b299f=_0x5b299f||0x1f4;return function(_0x4f0ca8){logger[_0x2700('0x24')](_0x4f0ca8[_0x2700('0x25')]);if(_0x4f0ca8[_0x2700('0x26')]){delete _0x4f0ca8['name'];}_0x120da6[_0x2700('0x1c')](_0x5b299f)['send'](_0x4f0ca8);};}exports[_0x2700('0x27')]=function(_0x2c1e08,_0x141df7){var _0x422225={'raw':!![],'where':{'id':_0x2c1e08[_0x2700('0x28')]['id']}},_0x43d164={};_0x43d164[_0x2700('0x29')]=_[_0x2700('0x2a')](db[_0x2700('0x2b')][_0x2700('0x2c')]);_0x43d164['query']=_[_0x2700('0x2a')](_0x2c1e08[_0x2700('0x2d')]);_0x43d164[_0x2700('0x2e')]=_[_0x2700('0x2f')](_0x43d164[_0x2700('0x29')],_0x43d164[_0x2700('0x2d')]);_0x422225[_0x2700('0x30')]=_[_0x2700('0x2f')](_0x43d164[_0x2700('0x29')],qs[_0x2700('0x31')](_0x2c1e08[_0x2700('0x2d')][_0x2700('0x31')]));_0x422225[_0x2700('0x30')]=_0x422225[_0x2700('0x30')][_0x2700('0x32')]?_0x422225[_0x2700('0x30')]:_0x43d164[_0x2700('0x29')];if(_0x2c1e08[_0x2700('0x2d')]['includeAll']){_0x422225[_0x2700('0x33')]=[{'all':!![]}];}_0x422225=_[_0x2700('0x34')]({},_0x422225,_0x2c1e08[_0x2700('0x35')]);return db[_0x2700('0x2b')][_0x2700('0x36')](_0x422225)[_0x2700('0x22')](handleEntityNotFound(_0x141df7,null))[_0x2700('0x22')](respondWithResult(_0x141df7,null))[_0x2700('0x37')](handleError(_0x141df7,null));};exports[_0x2700('0x21')]=function(_0x5bb017,_0x27be3b){if(_0x5bb017[_0x2700('0x38')]['id']){delete _0x5bb017[_0x2700('0x38')]['id'];}return db[_0x2700('0x2b')][_0x2700('0x36')]({'where':{'id':_0x5bb017['params']['id']}})[_0x2700('0x22')](handleEntityNotFound(_0x27be3b,null))[_0x2700('0x22')](saveUpdates(_0x5bb017[_0x2700('0x38')],null))[_0x2700('0x22')](respondWithResult(_0x27be3b,null))['catch'](handleError(_0x27be3b,null));};exports['destroy']=function(_0x38be8e,_0x74178c){return db[_0x2700('0x2b')][_0x2700('0x36')]({'where':{'id':_0x38be8e[_0x2700('0x28')]['id']}})[_0x2700('0x22')](handleEntityNotFound(_0x74178c,null))[_0x2700('0x22')](removeEntity(_0x74178c,null))[_0x2700('0x37')](handleError(_0x74178c,null));}; \ No newline at end of file +var _0xea2c=['rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','includeAll','include','merge','catch','MailApplication','find','body','eml-format'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xea2c,0x180));var _0xcea2=function(_0x1f9609,_0x2240d2){_0x1f9609=_0x1f9609-0x0;var _0x1b7d74=_0xea2c[_0x1f9609];return _0x1b7d74;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcea2('0x0'));var rimraf=require(_0xcea2('0x1'));var zipdir=require(_0xcea2('0x2'));var jsonpatch=require(_0xcea2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcea2('0x4'));var Mustache=require('mustache');var util=require(_0xcea2('0x5'));var path=require('path');var sox=require(_0xcea2('0x6'));var csv=require(_0xcea2('0x7'));var ejs=require(_0xcea2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcea2('0x9'));var crypto=require(_0xcea2('0xa'));var jsforce=require(_0xcea2('0xb'));var deskjs=require(_0xcea2('0xc'));var toCsv=require(_0xcea2('0x7'));var querystring=require('querystring');var Papa=require(_0xcea2('0xd'));var Redis=require(_0xcea2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcea2('0xf'));var as=require(_0xcea2('0x10'));var hardwareService=require(_0xcea2('0x11'));var logger=require(_0xcea2('0x12'))(_0xcea2('0x13'));var utils=require(_0xcea2('0x14'));var config=require(_0xcea2('0x15'));var licenseUtil=require(_0xcea2('0x16'));var db=require(_0xcea2('0x17'))['db'];function respondWithStatusCode(_0x1056d6,_0x4b1116){_0x4b1116=_0x4b1116||0xcc;return function(_0x1aedbe){if(_0x1aedbe){return _0x1056d6[_0xcea2('0x18')](_0x4b1116);}return _0x1056d6[_0xcea2('0x19')](_0x4b1116)[_0xcea2('0x1a')]();};}function respondWithResult(_0x4ddde0,_0x380423){_0x380423=_0x380423||0xc8;return function(_0x49df88){if(_0x49df88){return _0x4ddde0[_0xcea2('0x19')](_0x380423)['json'](_0x49df88);}};}function respondWithFilteredResult(_0xc0a2dd,_0x1babff){return function(_0x5c90a9){if(_0x5c90a9){var _0x23a075=_0x5c90a9[_0xcea2('0x1b')],_0x14c05b=_0x1babff[_0xcea2('0x1c')],_0x1f3139=_0x1babff[_0xcea2('0x1c')]+_0x1babff[_0xcea2('0x1d')],_0x4a4116;if(_0x1f3139>=_0x23a075){_0x1f3139=_0x23a075;_0x4a4116=0xc8;}else{_0x4a4116=0xce;}_0xc0a2dd['status'](_0x4a4116);return _0xc0a2dd['set']('Content-Range',_0x14c05b+'-'+_0x1f3139+'/'+_0x23a075)['json'](_0x5c90a9);}return null;};}function patchUpdates(_0x44f68c){return function(_0x4ca1b7){try{jsonpatch[_0xcea2('0x1e')](_0x4ca1b7,_0x44f68c,!![]);}catch(_0x5b7be7){return BPromise[_0xcea2('0x1f')](_0x5b7be7);}return _0x4ca1b7[_0xcea2('0x20')]();};}function saveUpdates(_0x2b3b31,_0x1c92bd){return function(_0x3d097c){if(_0x3d097c){return _0x3d097c[_0xcea2('0x21')](_0x2b3b31)[_0xcea2('0x22')](function(_0x593a3a){return _0x593a3a;});}return null;};}function removeEntity(_0x45e68c,_0x8bd71){return function(_0x46d274){if(_0x46d274){return _0x46d274[_0xcea2('0x23')]()[_0xcea2('0x22')](function(){_0x45e68c[_0xcea2('0x19')](0xcc)[_0xcea2('0x1a')]();});}};}function handleEntityNotFound(_0x2c04cd,_0x1cc0d4){return function(_0x481772){if(!_0x481772){_0x2c04cd[_0xcea2('0x18')](0x194);}return _0x481772;};}function handleError(_0x6695bb,_0x3b8bee){_0x3b8bee=_0x3b8bee||0x1f4;return function(_0x1bbfae){logger[_0xcea2('0x24')](_0x1bbfae[_0xcea2('0x25')]);if(_0x1bbfae['name']){delete _0x1bbfae['name'];}_0x6695bb[_0xcea2('0x19')](_0x3b8bee)[_0xcea2('0x26')](_0x1bbfae);};}exports[_0xcea2('0x27')]=function(_0x5bafba,_0x183392){var _0x1df4d8={'raw':!![],'where':{'id':_0x5bafba[_0xcea2('0x28')]['id']}},_0x573728={};_0x573728[_0xcea2('0x29')]=_[_0xcea2('0x2a')](db['MailApplication'][_0xcea2('0x2b')]);_0x573728[_0xcea2('0x2c')]=_[_0xcea2('0x2a')](_0x5bafba[_0xcea2('0x2c')]);_0x573728[_0xcea2('0x2d')]=_['intersection'](_0x573728[_0xcea2('0x29')],_0x573728['query']);_0x1df4d8['attributes']=_[_0xcea2('0x2e')](_0x573728[_0xcea2('0x29')],qs[_0xcea2('0x2f')](_0x5bafba[_0xcea2('0x2c')][_0xcea2('0x2f')]));_0x1df4d8['attributes']=_0x1df4d8['attributes']['length']?_0x1df4d8['attributes']:_0x573728[_0xcea2('0x29')];if(_0x5bafba[_0xcea2('0x2c')][_0xcea2('0x30')]){_0x1df4d8[_0xcea2('0x31')]=[{'all':!![]}];}_0x1df4d8=_[_0xcea2('0x32')]({},_0x1df4d8,_0x5bafba['options']);return db['MailApplication']['find'](_0x1df4d8)['then'](handleEntityNotFound(_0x183392,null))['then'](respondWithResult(_0x183392,null))[_0xcea2('0x33')](handleError(_0x183392,null));};exports[_0xcea2('0x21')]=function(_0x2631ee,_0x144bc8){if(_0x2631ee['body']['id']){delete _0x2631ee['body']['id'];}return db[_0xcea2('0x34')][_0xcea2('0x35')]({'where':{'id':_0x2631ee[_0xcea2('0x28')]['id']}})[_0xcea2('0x22')](handleEntityNotFound(_0x144bc8,null))['then'](saveUpdates(_0x2631ee[_0xcea2('0x36')],null))[_0xcea2('0x22')](respondWithResult(_0x144bc8,null))[_0xcea2('0x33')](handleError(_0x144bc8,null));};exports[_0xcea2('0x23')]=function(_0x25c993,_0x388550){return db[_0xcea2('0x34')]['find']({'where':{'id':_0x25c993['params']['id']}})[_0xcea2('0x22')](handleEntityNotFound(_0x388550,null))['then'](removeEntity(_0x388550,null))[_0xcea2('0x33')](handleError(_0x388550,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 265c4ab..af9c3cb 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 _0xa9fc=['request-promise','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x3de86b,_0x57de35){var _0x4c4026=function(_0x2d9771){while(--_0x2d9771){_0x3de86b['push'](_0x3de86b['shift']());}};_0x4c4026(++_0x57de35);}(_0xa9fc,0x19f));var _0xca9f=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xa9fc[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var logger=require(_0xca9f('0x2'))(_0xca9f('0x3'));var moment=require(_0xca9f('0x4'));var BPromise=require('bluebird');var rp=require(_0xca9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x5c7268,_0x234d90){return _0x5c7268['define'](_0xca9f('0x8'),attributes,{'tableName':_0xca9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca9f('0xa'),'collate':_0xca9f('0xb')});}; \ No newline at end of file +var _0x6132=['util','api','moment','bluebird','rimraf','./mailApplication.attributes','define','mail_applications','utf8mb4'];(function(_0x266324,_0x459e79){var _0x4d419a=function(_0x4ad404){while(--_0x4ad404){_0x266324['push'](_0x266324['shift']());}};_0x4d419a(++_0x459e79);}(_0x6132,0xf3));var _0x2613=function(_0x58daaf,_0x1cf458){_0x58daaf=_0x58daaf-0x0;var _0xbed8aa=_0x6132[_0x58daaf];return _0xbed8aa;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var logger=require('../../config/logger')(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2613('0x4'));var config=require('../../config/environment');var attributes=require(_0x2613('0x5'));module['exports']=function(_0x4479f6,_0x3f8ef6){return _0x4479f6[_0x2613('0x6')]('MailApplication',attributes,{'tableName':_0x2613('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2613('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 99ca2b2..487d08b 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 _0x4381=['stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x4381,0x11c));var _0x1438=function(_0x201be6,_0x19aa3e){_0x201be6=_0x201be6-0x0;var _0x4feea8=_0x4381[_0x201be6];return _0x4feea8;};'use strict';var _=require(_0x1438('0x0'));var util=require(_0x1438('0x1'));var moment=require(_0x1438('0x2'));var BPromise=require('bluebird');var rs=require(_0x1438('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1438('0x4'))['db'];var utils=require(_0x1438('0x5'));var logger=require(_0x1438('0x6'))(_0x1438('0x7'));var config=require(_0x1438('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1438('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e793c,_0x2668ba,_0x279747){return new BPromise(function(_0x1b3732,_0x1fc683){return client[_0x1438('0xa')](_0x1e793c,_0x279747)['then'](function(_0x2d77cd){logger[_0x1438('0xb')](_0x1438('0xc'),_0x2668ba,'request\x20sent');logger[_0x1438('0xd')](_0x1438('0xe'),_0x2668ba,_0x1438('0xf'),JSON[_0x1438('0x10')](_0x2d77cd));if(_0x2d77cd[_0x1438('0x11')]){if(_0x2d77cd[_0x1438('0x11')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x2668ba,_0x2d77cd[_0x1438('0x11')]['message']);return _0x1fc683(_0x2d77cd[_0x1438('0x11')][_0x1438('0x12')]);}logger[_0x1438('0x11')](_0x1438('0xc'),_0x2668ba,_0x2d77cd[_0x1438('0x11')][_0x1438('0x12')]);return _0x1b3732(_0x2d77cd['error'][_0x1438('0x12')]);}else{logger[_0x1438('0xb')](_0x1438('0xc'),_0x2668ba,_0x1438('0xf'));_0x1b3732(_0x2d77cd[_0x1438('0x13')]['message']);}})[_0x1438('0x14')](function(_0x3f2f5f){logger[_0x1438('0x11')](_0x1438('0xc'),_0x2668ba,_0x3f2f5f);_0x1fc683(_0x3f2f5f);});});}exports[_0x1438('0x15')]=function(_0x3d0ba5){var _0xac2cf2=this;return new Promise(function(_0x28d9ef,_0x3d2db2){return db[_0x1438('0x16')][_0x1438('0x17')](_0x3d0ba5[_0x1438('0x18')],{'raw':_0x3d0ba5['options']?_0x3d0ba5[_0x1438('0x19')][_0x1438('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0ba5[_0x1438('0x19')]?_0x3d0ba5['options'][_0x1438('0x1b')]||null:null,'attributes':_0x3d0ba5['options']?_0x3d0ba5[_0x1438('0x19')]['attributes']||null:null,'limit':_0x3d0ba5[_0x1438('0x19')]?_0x3d0ba5[_0x1438('0x19')][_0x1438('0x1c')]||null:null})[_0x1438('0x1d')](function(_0xf026ac){logger['info'](_0x1438('0x15'),_0x3d0ba5);logger['debug'](_0x1438('0x15'),_0x3d0ba5,JSON[_0x1438('0x10')](_0xf026ac));_0x28d9ef(_0xf026ac);})['catch'](function(_0x60a477){logger[_0x1438('0x11')](_0x1438('0x15'),_0x60a477[_0x1438('0x12')],_0x3d0ba5);_0x3d2db2(_0xac2cf2[_0x1438('0x11')](0x1f4,_0x60a477['message']));});});}; \ No newline at end of file +var _0xcdc5=['http','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4bdfdc,_0x4433ff){var _0x1bb5fe=function(_0x32330c){while(--_0x32330c){_0x4bdfdc['push'](_0x4bdfdc['shift']());}};_0x1bb5fe(++_0x4433ff);}(_0xcdc5,0xa4));var _0x5cdc=function(_0x22a409,_0x1e7083){_0x22a409=_0x22a409-0x0;var _0x4ffcf0=_0xcdc5[_0x22a409];return _0x4ffcf0;};'use strict';var _=require(_0x5cdc('0x0'));var util=require(_0x5cdc('0x1'));var moment=require(_0x5cdc('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cdc('0x3'));var fs=require('fs');var Redis=require(_0x5cdc('0x4'));var db=require(_0x5cdc('0x5'))['db'];var utils=require(_0x5cdc('0x6'));var logger=require('../../config/logger')(_0x5cdc('0x7'));var config=require('../../config/environment');var jayson=require(_0x5cdc('0x8'));var client=jayson[_0x5cdc('0x9')][_0x5cdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437850,_0x4eb5ee,_0xb4afae){return new BPromise(function(_0x1e7c24,_0x95649e){return client[_0x5cdc('0xb')](_0x437850,_0xb4afae)['then'](function(_0x37e9ee){logger[_0x5cdc('0xc')](_0x5cdc('0xd'),_0x4eb5ee,'request\x20sent');logger['debug'](_0x5cdc('0xe'),_0x4eb5ee,_0x5cdc('0xf'),JSON[_0x5cdc('0x10')](_0x37e9ee));if(_0x37e9ee[_0x5cdc('0x11')]){if(_0x37e9ee[_0x5cdc('0x11')]['code']===0x1f4){logger[_0x5cdc('0x11')](_0x5cdc('0xd'),_0x4eb5ee,_0x37e9ee[_0x5cdc('0x11')]['message']);return _0x95649e(_0x37e9ee[_0x5cdc('0x11')][_0x5cdc('0x12')]);}logger[_0x5cdc('0x11')]('MailApplication,\x20%s,\x20%s',_0x4eb5ee,_0x37e9ee[_0x5cdc('0x11')][_0x5cdc('0x12')]);return _0x1e7c24(_0x37e9ee[_0x5cdc('0x11')][_0x5cdc('0x12')]);}else{logger[_0x5cdc('0xc')]('MailApplication,\x20%s,\x20%s',_0x4eb5ee,_0x5cdc('0xf'));_0x1e7c24(_0x37e9ee[_0x5cdc('0x13')]['message']);}})[_0x5cdc('0x14')](function(_0x19846f){logger['error']('MailApplication,\x20%s,\x20%s',_0x4eb5ee,_0x19846f);_0x95649e(_0x19846f);});});}exports[_0x5cdc('0x15')]=function(_0x44e322){var _0x1c9119=this;return new Promise(function(_0x162ed1,_0x11a718){return db['MailApplication'][_0x5cdc('0x16')](_0x44e322[_0x5cdc('0x17')],{'raw':_0x44e322[_0x5cdc('0x18')]?_0x44e322[_0x5cdc('0x18')][_0x5cdc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e322[_0x5cdc('0x18')]?_0x44e322['options'][_0x5cdc('0x1a')]||null:null,'attributes':_0x44e322[_0x5cdc('0x18')]?_0x44e322['options'][_0x5cdc('0x1b')]||null:null,'limit':_0x44e322[_0x5cdc('0x18')]?_0x44e322[_0x5cdc('0x18')]['limit']||null:null})['then'](function(_0x445eff){logger[_0x5cdc('0xc')](_0x5cdc('0x15'),_0x44e322);logger[_0x5cdc('0x1c')](_0x5cdc('0x15'),_0x44e322,JSON[_0x5cdc('0x10')](_0x445eff));_0x162ed1(_0x445eff);})[_0x5cdc('0x14')](function(_0x3e7e02){logger[_0x5cdc('0x11')](_0x5cdc('0x15'),_0x3e7e02['message'],_0x44e322);_0x11a718(_0x1c9119[_0x5cdc('0x11')](0x1f4,_0x3e7e02[_0x5cdc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8582f46..5dc06ee 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 _0x403c=['delete','mailinteraction:destroy','destroy','removeTags','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','mail','addTags','tracked','mailinteraction:update'];(function(_0x1d60f1,_0x5deb31){var _0x8e29f3=function(_0x1398a7){while(--_0x1398a7){_0x1d60f1['push'](_0x1d60f1['shift']());}};_0x8e29f3(++_0x5deb31);}(_0x403c,0x19a));var _0xc403=function(_0x57988a,_0x16102b){_0x57988a=_0x57988a-0x0;var _0x27cdf1=_0x403c[_0x57988a];return _0x27cdf1;};'use strict';var multer=require(_0xc403('0x0'));var util=require(_0xc403('0x1'));var path=require(_0xc403('0x2'));var timeout=require('connect-timeout');var express=require(_0xc403('0x3'));var router=express[_0xc403('0x4')]();var auth=require(_0xc403('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc403('0x6'));var controller=require(_0xc403('0x7'));router[_0xc403('0x8')]('/',auth[_0xc403('0x9')](),controller[_0xc403('0xa')]);router[_0xc403('0x8')]('/describe',auth[_0xc403('0x9')](),controller[_0xc403('0xb')]);router[_0xc403('0x8')](_0xc403('0xc'),auth[_0xc403('0x9')](),controller[_0xc403('0xd')]);router[_0xc403('0x8')](_0xc403('0xe'),auth[_0xc403('0x9')](),controller[_0xc403('0xf')]);router['get'](_0xc403('0x10'),auth[_0xc403('0x9')](),controller['download']);router[_0xc403('0x11')]('/',auth[_0xc403('0x9')](),controller[_0xc403('0x12')]);router[_0xc403('0x11')](_0xc403('0xe'),auth[_0xc403('0x9')](),controller[_0xc403('0x13')]);router[_0xc403('0x11')](_0xc403('0x14'),auth[_0xc403('0x9')](),interaction['tracked'](_0xc403('0x15'),'mailinteraction:addtags'),controller[_0xc403('0x16')]);router['put'](_0xc403('0xc'),auth[_0xc403('0x9')](),interaction[_0xc403('0x17')](_0xc403('0x15'),_0xc403('0x18')),controller['update']);router[_0xc403('0x19')](_0xc403('0xc'),auth['isAuthenticated'](),interaction[_0xc403('0x17')](_0xc403('0x15'),_0xc403('0x1a')),controller[_0xc403('0x1b')]);router[_0xc403('0x19')]('/:id/tags',auth[_0xc403('0x9')](),controller[_0xc403('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbe41=['path','connect-timeout','Router','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','multer','util'];(function(_0x36888d,_0x22988e){var _0x14f524=function(_0x5cdbfe){while(--_0x5cdbfe){_0x36888d['push'](_0x36888d['shift']());}};_0x14f524(++_0x22988e);}(_0xbe41,0x1eb));var _0x1be4=function(_0x3b556d,_0x255e5f){_0x3b556d=_0x3b556d-0x0;var _0x49af2c=_0xbe41[_0x3b556d];return _0x49af2c;};'use strict';var multer=require(_0x1be4('0x0'));var util=require(_0x1be4('0x1'));var path=require(_0x1be4('0x2'));var timeout=require(_0x1be4('0x3'));var express=require('express');var router=express[_0x1be4('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1be4('0x5'));var controller=require(_0x1be4('0x6'));router[_0x1be4('0x7')]('/',auth[_0x1be4('0x8')](),controller[_0x1be4('0x9')]);router[_0x1be4('0x7')](_0x1be4('0xa'),auth[_0x1be4('0x8')](),controller['describe']);router[_0x1be4('0x7')](_0x1be4('0xb'),auth['isAuthenticated'](),controller[_0x1be4('0xc')]);router[_0x1be4('0x7')](_0x1be4('0xd'),auth[_0x1be4('0x8')](),controller[_0x1be4('0xe')]);router[_0x1be4('0x7')](_0x1be4('0xf'),auth['isAuthenticated'](),controller[_0x1be4('0x10')]);router[_0x1be4('0x11')]('/',auth[_0x1be4('0x8')](),controller[_0x1be4('0x12')]);router[_0x1be4('0x11')](_0x1be4('0xd'),auth[_0x1be4('0x8')](),controller['addMessage']);router[_0x1be4('0x11')]('/:id/tags',auth[_0x1be4('0x8')](),interaction[_0x1be4('0x13')](_0x1be4('0x14'),_0x1be4('0x15')),controller[_0x1be4('0x16')]);router['put'](_0x1be4('0xb'),auth[_0x1be4('0x8')](),interaction[_0x1be4('0x13')]('mail',_0x1be4('0x17')),controller[_0x1be4('0x18')]);router[_0x1be4('0x19')](_0x1be4('0xb'),auth[_0x1be4('0x8')](),interaction[_0x1be4('0x13')](_0x1be4('0x14'),_0x1be4('0x1a')),controller[_0x1be4('0x1b')]);router[_0x1be4('0x19')](_0x1be4('0x1c'),auth[_0x1be4('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a1a1f5c..ea20c8c 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 _0xb42a=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xb42a,0x1a3));var _0xab42=function(_0x25e61b,_0x56898d){_0x25e61b=_0x25e61b-0x0;var _0x173d84=_0xb42a[_0x25e61b];return _0x173d84;};'use strict';var Sequelize=require(_0xab42('0x0'));var iconv=require(_0xab42('0x1'));module[_0xab42('0x2')]={'closed':{'type':Sequelize[_0xab42('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab42('0x4')]},'disposition':{'type':Sequelize[_0xab42('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xab42('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xab42('0x5')](0x1fe)},'to':{'type':Sequelize[_0xab42('0x5')]},'cc':{'type':Sequelize[_0xab42('0x6')](_0xab42('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xab42('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xab42('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xab42('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab42('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xab42('0x8')]('in',_0xab42('0x9')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8bc9=['TEXT','DATE','ENUM','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x2c396c,_0x4db177){var _0x26219b=function(_0x1a4a6e){while(--_0x1a4a6e){_0x2c396c['push'](_0x2c396c['shift']());}};_0x26219b(++_0x4db177);}(_0x8bc9,0x1bb));var _0x98bc=function(_0x199326,_0x303784){_0x199326=_0x199326-0x0;var _0x2dd88c=_0x8bc9[_0x199326];return _0x2dd88c;};'use strict';var Sequelize=require(_0x98bc('0x0'));var iconv=require(_0x98bc('0x1'));module[_0x98bc('0x2')]={'closed':{'type':Sequelize[_0x98bc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x98bc('0x4')]},'secondDisposition':{'type':Sequelize[_0x98bc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x98bc('0x4')]},'inReplyTo':{'type':Sequelize[_0x98bc('0x4')](0x1fe)},'to':{'type':Sequelize[_0x98bc('0x4')]},'cc':{'type':Sequelize[_0x98bc('0x5')]('long')},'subject':{'type':Sequelize[_0x98bc('0x5')]()},'attach':{'type':Sequelize[_0x98bc('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x98bc('0x6')]},'substatus':{'type':Sequelize[_0x98bc('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x98bc('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x98bc('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3438937..077bbf0 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 _0x410d=['root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','subject','get','mkdirSync','createdAt','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','field','color','tools_tags','select','u.id','u.fullname','from','user_has_mail_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','options','create','body','describe','omit','ids','getMessages','nolimit','format','include','findAll','true','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','unix','join'];(function(_0x5ca7b8,_0x1d8f03){var _0x58e84e=function(_0x2f0ffa){while(--_0x2f0ffa){_0x5ca7b8['push'](_0x5ca7b8['shift']());}};_0x58e84e(++_0x1d8f03);}(_0x410d,0x106));var _0xd410=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x410d[_0x20589d];return _0x422de9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd410('0x0'));var rimraf=require(_0xd410('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd410('0x2'));var rp=require('request-promise');var moment=require(_0xd410('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd410('0x4'));var path=require(_0xd410('0x5'));var sox=require('sox');var csv=require(_0xd410('0x6'));var ejs=require(_0xd410('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd410('0x8'));var jsforce=require(_0xd410('0x9'));var deskjs=require(_0xd410('0xa'));var toCsv=require(_0xd410('0x6'));var querystring=require(_0xd410('0xb'));var Papa=require(_0xd410('0xc'));var htmlToText=require('html-to-text');var juice=require(_0xd410('0xd'));var Redis=require(_0xd410('0xe'));var authService=require(_0xd410('0xf'));var qs=require(_0xd410('0x10'));var as=require(_0xd410('0x11'));var hardwareService=require(_0xd410('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd410('0x13'));var licenseUtil=require(_0xd410('0x14'));var db=require('../../mysqldb')['db'];config[_0xd410('0x15')]=_[_0xd410('0x16')](config[_0xd410('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd410('0x17'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1da901,_0x4f8bcd){_0x4f8bcd=_0x4f8bcd||0xcc;return function(_0x12d1f2){if(_0x12d1f2){return _0x1da901[_0xd410('0x18')](_0x4f8bcd);}return _0x1da901[_0xd410('0x19')](_0x4f8bcd)['end']();};}function respondWithResult(_0x3ee4d3,_0x31f8b3){_0x31f8b3=_0x31f8b3||0xc8;return function(_0x33b2e1){if(_0x33b2e1){return _0x3ee4d3[_0xd410('0x19')](_0x31f8b3)[_0xd410('0x1a')](_0x33b2e1);}};}function respondWithFilteredResult(_0x1d1676,_0x3d97f3){return function(_0x5aadec){if(_0x5aadec){var _0x4fa485=_0x5aadec[_0xd410('0x1b')],_0x4ba77a=_0x3d97f3[_0xd410('0x1c')],_0x2846b4=_0x3d97f3[_0xd410('0x1c')]+_0x3d97f3['limit'],_0x3c1ace;if(_0x2846b4>=_0x4fa485){_0x2846b4=_0x4fa485;_0x3c1ace=0xc8;}else{_0x3c1ace=0xce;}_0x1d1676[_0xd410('0x19')](_0x3c1ace);return _0x1d1676['set'](_0xd410('0x1d'),_0x4ba77a+'-'+_0x2846b4+'/'+_0x4fa485)[_0xd410('0x1a')](_0x5aadec);}return null;};}function patchUpdates(_0x237d80){return function(_0x2cb460){try{jsonpatch[_0xd410('0x1e')](_0x2cb460,_0x237d80,!![]);}catch(_0x35ea47){return BPromise[_0xd410('0x1f')](_0x35ea47);}return _0x2cb460[_0xd410('0x20')]();};}function saveUpdates(_0x422b33,_0x140502){return function(_0x119e72){if(_0x119e72){return _0x119e72[_0xd410('0x21')](_0x422b33)[_0xd410('0x22')](function(_0xad347f){return _0xad347f;});}return null;};}function removeEntity(_0x255a9c,_0x4a85b6){return function(_0x256d3f){if(_0x256d3f){return _0x256d3f[_0xd410('0x23')]()[_0xd410('0x22')](function(){_0x255a9c[_0xd410('0x19')](0xcc)[_0xd410('0x24')]();});}};}function handleEntityNotFound(_0xbc663a,_0x168a0b){return function(_0x516eb3){if(!_0x516eb3){_0xbc663a[_0xd410('0x18')](0x194);}return _0x516eb3;};}function handleError(_0x172312,_0x171912){_0x171912=_0x171912||0x1f4;return function(_0x1228cf){logger['error'](_0x1228cf['stack']);if(_0x1228cf[_0xd410('0x25')]){delete _0x1228cf[_0xd410('0x25')];}_0x172312[_0xd410('0x19')](_0x171912)[_0xd410('0x26')](_0x1228cf);};}function getInteractionUsers(_0x1cdcbb,_0x1829dd){return new BPromise(function(_0x54b28b,_0xdb586d){try{if(_0x1829dd[_0x1cdcbb['id']]){_0x1cdcbb[_0xd410('0x27')]=_[_0xd410('0x28')](_0x1829dd[_0x1cdcbb['id']],function(_0x31eb17){return{'id':_0x31eb17['id'],'fullname':_0x31eb17[_0xd410('0x29')]};});}}catch(_0x44b9cf){_0xdb586d(_0x44b9cf);}_0x54b28b(_0x1cdcbb);});}function getInteractionTags(_0x169a1d,_0x7d054b){return new BPromise(function(_0x4295a6,_0x438686){try{if(_0x169a1d[_0xd410('0x2a')]){_0x169a1d[_0xd410('0x2b')]=[];_0x169a1d[_0xd410('0x2a')][_0xd410('0x2c')](',')[_0xd410('0x2d')](function(_0x530e5f){_0x169a1d['Tags'][_0xd410('0x2e')](_0x7d054b[_0x530e5f]);});}delete _0x169a1d['TagIds'];}catch(_0x2ecdcb){_0x438686(_0x2ecdcb);}_0x4295a6(_0x169a1d);});}function getLastMessageText(_0x3b026b){return new BPromise(function(_0x4434b8,_0x584177){return db[_0xd410('0x2f')][_0xd410('0x30')]({'where':{'$and':[{'MailInteractionId':_0x3b026b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd410('0x31')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd410('0x32')],'order':_0xd410('0x33'),'raw':!![]})[_0xd410('0x22')](function(_0x3cdb55){if(_0x3cdb55&&_0x3cdb55['plainBody']){_0x3b026b[_0xd410('0x34')]=_[_0xd410('0x35')](_0x3cdb55['plainBody']);}_0x4434b8(_0x3b026b);})['catch'](function(_0x4c46d9){_0x584177(_0x4c46d9);});});}function updateMailInteraction(_0x31b405,_0x5a5dae,_0x90aea0,_0x16e487){return new BPromise(function(_0x5a3863,_0x56bec1){return getInteractionUsers(_0x31b405,_0x90aea0)[_0xd410('0x22')](function(_0xc1083a){return getInteractionTags(_0xc1083a,_0x5a5dae);})['then'](function(_0x20779d){if(_0x16e487){_0x5a3863(getLastMessageText(_0x20779d));}else{_0x5a3863(_0x20779d);}})[_0xd410('0x36')](function(_0x2f3942){_0x56bec1(_0x2f3942);});});}exports[_0xd410('0x37')]=function(_0xe37d0f,_0x3670b9){var _0x4cdbaa={},_0x23dd9f={},_0x3bfd4f={'count':0x0,'rows':[]};var _0x20d9c1=_[_0xd410('0x28')](db[_0xd410('0x38')][_0xd410('0x39')],function(_0x518b78){return{'name':_0x518b78[_0xd410('0x3a')],'type':_0x518b78[_0xd410('0x3b')][_0xd410('0x3c')]};});_0x23dd9f[_0xd410('0x3d')]=_[_0xd410('0x28')](_0x20d9c1,_0xd410('0x25'));_0x23dd9f[_0xd410('0x3e')]=_[_0xd410('0x3f')](_0xe37d0f[_0xd410('0x3e')]);_0x23dd9f[_0xd410('0x40')]=_[_0xd410('0x41')](_0x23dd9f[_0xd410('0x3d')],_0x23dd9f[_0xd410('0x3e')]);_0x4cdbaa[_0xd410('0x42')]=_[_0xd410('0x41')](_0x23dd9f[_0xd410('0x3d')],qs[_0xd410('0x43')](_0xe37d0f[_0xd410('0x3e')][_0xd410('0x43')]));_0x4cdbaa['attributes']=_0x4cdbaa[_0xd410('0x42')][_0xd410('0x44')]?_0x4cdbaa[_0xd410('0x42')]:_0x23dd9f[_0xd410('0x3d')];if(!_0xe37d0f[_0xd410('0x3e')][_0xd410('0x45')]('nolimit')){_0x4cdbaa[_0xd410('0x46')]=qs[_0xd410('0x46')](_0xe37d0f[_0xd410('0x3e')][_0xd410('0x46')]);_0x4cdbaa[_0xd410('0x1c')]=qs[_0xd410('0x1c')](_0xe37d0f[_0xd410('0x3e')][_0xd410('0x1c')]);}_0x4cdbaa[_0xd410('0x47')]=qs[_0xd410('0x48')](_0xe37d0f[_0xd410('0x3e')]['sort']);_0x4cdbaa[_0xd410('0x49')]=qs[_0xd410('0x40')](_[_0xd410('0x4a')](_0xe37d0f['query'],_0x23dd9f['filters']),_0x20d9c1);var _0x195fa8=[];var _0x5b0b97=squel['select']()[_0xd410('0x4b')]('id')[_0xd410('0x4b')](_0xd410('0x25'))[_0xd410('0x4b')](_0xd410('0x4c'))['from'](_0xd410('0x4d'));var _0x324b9e=squel[_0xd410('0x4e')]()[_0xd410('0x4b')](_0xd410('0x4f'))['field'](_0xd410('0x50'))[_0xd410('0x4b')]('ui.MailInteractionId')[_0xd410('0x51')](_0xd410('0x52'),'ui')[_0xd410('0x53')](_0xd410('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x4315c5=squel[_0xd410('0x4e')]()['from']('mail_interactions','i')[_0xd410('0x53')](_0xd410('0x55'),'c',_0xd410('0x56'))[_0xd410('0x53')]('users','o','o.id\x20=\x20i.UserId')[_0xd410('0x53')](_0xd410('0x57'),'a',_0xd410('0x58'))[_0xd410('0x53')](_0xd410('0x59'),'me',_0xd410('0x5a'))[_0xd410('0x53')](_0xd410('0x5b'),'it',_0xd410('0x5c'))[_0xd410('0x53')](_0xd410('0x4d'),'t',_0xd410('0x5d'));var _0x47355b=squel['expr']();var _0x27e960=[];var _0x376ef6=squel[_0xd410('0x5e')]();var _0xabdf9b;if(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x5f')]){_0xabdf9b=as['parseSearch'](_0xe37d0f[_0xd410('0x3e')][_0xd410('0x5f')]);var _0x5afa18=_0xabdf9b[_0xd410('0x60')];for(var _0x476bb8=0x0;_0x476bb8<_0xabdf9b[_0xd410('0x61')][_0xd410('0x44')];_0x476bb8++){var _0x56acbd=_0xabdf9b[_0xd410('0x61')][_0x476bb8];var _0x1b0116='i';var _0x1bddad=_[_0xd410('0x62')](_0x20d9c1,[_0xd410('0x25'),_0x56acbd[_0xd410('0x4b')]]);if(!_0x1bddad){switch(_0x56acbd['field']){case _0xd410('0x63'):if(_0x56acbd[_0xd410('0x64')]==0x1){_0x4315c5[_0xd410('0x65')]('`'+_0x56acbd[_0xd410('0x4b')]+_0xd410('0x66'));}else{_0x4315c5['having']('`'+_0x56acbd[_0xd410('0x4b')]+_0xd410('0x67'));}break;case _0xd410('0x68'):if(_0x56acbd[_0xd410('0x69')]===_0xd410('0x6a')){if(_0x56acbd[_0xd410('0x64')]['split']('\x20')[_0xd410('0x44')]>0x1){_0x47355b[_0x5afa18]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd410('0x6b')](_0x56acbd[_0xd410('0x64')]),null);}else{var _0x506467='%'+_0x56acbd[_0xd410('0x64')]+'%';_0x47355b[_0x5afa18]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x506467,_0x506467,_0x506467);}}else{_0x1bddad=_[_0xd410('0x62')](_0x20d9c1,['name',_0xd410('0x6c')]);_0x56acbd[_0xd410('0x4b')]=_0xd410('0x6c');_0x17f8b5=as[_0xd410('0x6d')](_0x1b0116,_0x1bddad['type'],_0x56acbd);_0x47355b[_0x5afa18](_0x17f8b5[_0xd410('0x6e')],_0x17f8b5[_0xd410('0x64')]['start'],_0x17f8b5['value'][_0xd410('0x24')]);}break;case'Tag':var _0x3bce54=_0x56acbd[_0xd410('0x64')]['split'](',')['map'](function(_0x31cc61){return Number(_0x31cc61);});_0x3bce54['forEach'](function(_0xa982bc){_0x376ef6['or'](_0xd410('0x6f'),'%,'+_0xa982bc+',%');});_0x27e960=_[_0xd410('0x70')](_0x27e960,_0x3bce54);break;case _0xd410('0x71'):if(_0x56acbd['operator']===_0xd410('0x6a')){_0x47355b[_0x5afa18](_0xd410('0x72'),'%'+_0x56acbd['value']+'%',null);}else{_0x1bddad=_[_0xd410('0x62')](_0x20d9c1,[_0xd410('0x25'),_0xd410('0x73')]);_0x56acbd[_0xd410('0x4b')]=_0xd410('0x73');_0x17f8b5=as[_0xd410('0x6d')](_0x1b0116,_0x1bddad['type'],_0x56acbd);_0x47355b[_0x5afa18](_0x17f8b5[_0xd410('0x6e')],_0x17f8b5['value'][_0xd410('0x74')],_0x17f8b5[_0xd410('0x64')]['end']);}break;case _0xd410('0x32'):_0x17f8b5=as['buildExpression']('me',null,_0x56acbd);_0x47355b[_0x5afa18](_0x17f8b5['text'],_0x17f8b5['value']['start'],_0x17f8b5[_0xd410('0x64')][_0xd410('0x24')]);break;}}else{var _0x17f8b5=as[_0xd410('0x6d')](_0x1b0116,_0x1bddad[_0xd410('0x3b')],_0x56acbd);_0x47355b[_0x5afa18](_0x17f8b5['text'],_0x17f8b5[_0xd410('0x64')][_0xd410('0x74')],_0x17f8b5[_0xd410('0x64')][_0xd410('0x24')]);}}}else{var _0x35b88a=_(_0xe37d0f[_0xd410('0x3e')])[_0xd410('0x3f')]()[_0xd410('0x28')](function(_0xc8187){return _[_0xd410('0x75')](_0x20d9c1,[_0xd410('0x25'),_0xc8187])?_0xc8187:undefined;})[_0xd410('0x76')]()[_0xd410('0x64')]();if(!_[_0xd410('0x77')](_0x35b88a)){_0x35b88a['forEach'](function(_0x2c34f3){if(_0x2c34f3===_0xd410('0x78')){_0x4315c5[_0xd410('0x49')](_0xd410('0x79'),[][_0xd410('0x7a')](_0xe37d0f[_0xd410('0x3e')][_0x2c34f3]));}else if(_0x2c34f3==='createdAt'){var _0x43bcc4=JSON[_0xd410('0x7b')](_0xe37d0f[_0xd410('0x3e')][_0x2c34f3])[_0xd410('0x7c')];var _0xdf72be=JSON[_0xd410('0x7b')](_0xe37d0f[_0xd410('0x3e')][_0x2c34f3])[_0xd410('0x7d')];_0x4315c5['where'](_0xd410('0x7e'),_0x43bcc4,_0xdf72be);}else{if(_0xe37d0f[_0xd410('0x3e')][_0x2c34f3]===_0xd410('0x7f')){_0x4315c5[_0xd410('0x49')]('i.'+_0x2c34f3+_0xd410('0x80'));}else{_0x4315c5[_0xd410('0x49')]('i.'+_0x2c34f3+_0xd410('0x81'),_0xe37d0f[_0xd410('0x3e')][_0x2c34f3]);}}});}if(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x82')]){if(_0xe37d0f[_0xd410('0x3e')]['read']==0x1){_0x4315c5['having']('`unreadMessages`\x20=\x200');}else{_0x4315c5[_0xd410('0x65')]('`unreadMessages`\x20>\x200');}}if(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x83')]){_0x27e960=_['isArray'](_0xe37d0f[_0xd410('0x3e')][_0xd410('0x83')])?_0xe37d0f['query']['tag']:new Array(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x83')]);_0x27e960[_0xd410('0x2d')](function(_0x37cfcc){_0x376ef6['or'](_0xd410('0x6f'),'%,'+_0x37cfcc+',%');});}if(_0xe37d0f['query']['filter']){var _0x5ac5bb=_0xe37d0f[_0xd410('0x3e')][_0xd410('0x84')][_0xd410('0x85')]('\x5c','\x5c\x5c')[_0xd410('0x85')](/'/g,'\x27\x27');if(qs[_0xd410('0x86')](_0x5ac5bb)){_0x47355b['or'](_0xd410('0x87'),_0x5ac5bb+'%');}else if(qs['isEmail'](_0x5ac5bb)){_0x47355b['or'](_0xd410('0x88'),_0x5ac5bb+'%');}else{_0x47355b['or'](_0xd410('0x89'),qs[_0xd410('0x6b')](_0x5ac5bb))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd410('0x6b')](_0x5ac5bb));}}}_0x4315c5[_0xd410('0x49')](_0x47355b);_0x4315c5[_0xd410('0x8a')](_0xd410('0x8b'));var _0x33066d={'type':db[_0xd410('0x8c')]['QueryTypes'][_0xd410('0x8d')],'raw':!![]};var _0x2692c5=_0x4315c5[_0xd410('0x8e')]();_0x2692c5[_0xd410('0x4b')](_0xd410('0x8b'));_0x2692c5[_0xd410('0x4b')](_0xd410('0x8f'),_0xd410('0x63'));if(_0x4cdbaa['order']){_0x4cdbaa[_0xd410('0x47')][_0xd410('0x2d')](function(_0xea924a){var _0x112e05=_0xea924a[0x0]==='contactName'?_0xea924a[0x0]:'i.'+_0xea924a[0x0];_0x4315c5[_0xd410('0x47')](_0x112e05,_0xea924a[0x1]===_0xd410('0x90')?![]:!![]);});}if(!_[_0xd410('0x77')](_0x27e960)){_0x4315c5[_0xd410('0x65')](_0x376ef6);_0x2692c5['where']('t.id\x20IN\x20?',_0x27e960);}BPromise['resolve']()[_0xd410('0x22')](function(){if(!_0xabdf9b){if(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x78')])return;_0x2692c5[_0xd410('0x49')](_0xd410('0x91'));_0x4315c5[_0xd410('0x49')](_0xd410('0x91'));return;}if(_0xe37d0f['user']['role']!==_0xd410('0x92'))return;return _0xe37d0f[_0xd410('0x93')][_0xd410('0x94')]({'attributes':['id'],'raw':!![]})[_0xd410('0x22')](function(_0x157cd2){if(_[_0xd410('0x77')](_0x157cd2)){_0x2692c5['where']('i.MailAccountId\x20IS\x20NULL');_0x4315c5[_0xd410('0x49')](_0xd410('0x95'));}else{_0x2692c5[_0xd410('0x49')](_0xd410('0x79'),_[_0xd410('0x28')](_0x157cd2,'id'));_0x4315c5[_0xd410('0x49')](_0xd410('0x79'),_[_0xd410('0x28')](_0x157cd2,'id'));}});})['then'](function(){if(_0xe37d0f[_0xd410('0x93')][_0xd410('0x96')]===_0xd410('0x92')&&!_0xabdf9b&&!_0xe37d0f[_0xd410('0x3e')][_0xd410('0x78')])return[];return db[_0xd410('0x97')]['query'](_0x2692c5[_0xd410('0x98')](),_0x33066d);})[_0xd410('0x22')](function(_0x4aa9cc){_0x3bfd4f[_0xd410('0x1b')]=_0x4aa9cc['length'];if(_0x3bfd4f[_0xd410('0x1b')]===0x0)return[];return db['sequelize']['query'](_0x5b0b97[_0xd410('0x98')](),_0x33066d)[_0xd410('0x22')](function(_0x122356){_0x195fa8=_[_0xd410('0x99')](_0x122356,'id');_0x33066d=_[_0xd410('0x9a')](_0x33066d,{'model':db[_0xd410('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe37d0f[_0xd410('0x3e')][_0xd410('0x43')]){_0x4cdbaa['attributes']['forEach'](function(_0xcdf36d){_0x4315c5['field']('i.'+_0xcdf36d);});}else{_0x4315c5[_0xd410('0x4b')](_0xd410('0x8f'),_0xd410('0x63'));_0x4315c5['field']('a.key',_0xd410('0x9b'));_0x4315c5[_0xd410('0x4b')](_0xd410('0x9c'),_0xd410('0x9d'));_0x4315c5[_0xd410('0x4b')](_0xd410('0x9e'),_0xd410('0x9f'));_0x4315c5[_0xd410('0x4b')](_0xd410('0x8b'));_0x4315c5['field'](_0xd410('0xa0'));_0x4315c5['field'](_0xd410('0xa1'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xa2'));_0x4315c5[_0xd410('0x4b')]('i.closedAt');_0x4315c5[_0xd410('0x4b')](_0xd410('0xa3'));_0x4315c5['field'](_0xd410('0xa4'));_0x4315c5['field'](_0xd410('0xa5'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xa6'));_0x4315c5[_0xd410('0x4b')]('i.disposition');_0x4315c5[_0xd410('0x4b')](_0xd410('0xa7'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xa8'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xa9'));_0x4315c5['field'](_0xd410('0xaa'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xab'));_0x4315c5[_0xd410('0x4b')]('i.MailAccountId');_0x4315c5[_0xd410('0x4b')]('i.UserId');_0x4315c5[_0xd410('0x4b')](_0xd410('0xac'),_0xd410('0xad'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xae'),_0xd410('0xaf'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xb0'),_0xd410('0xb1'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xb2'),_0xd410('0xb3'));_0x4315c5[_0xd410('0x4b')]('c.mobile',_0xd410('0xb4'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xb5'),_0xd410('0xb6'));_0x4315c5[_0xd410('0x4b')]('o.fullname',_0xd410('0xb7'));_0x4315c5['field'](_0xd410('0xb8'),_0xd410('0xb9'));_0x4315c5[_0xd410('0x4b')](_0xd410('0xba'),'TagIds');}if(_0x4cdbaa[_0xd410('0x46')])_0x4315c5[_0xd410('0x46')](_0x4cdbaa['limit']);if(_0x4cdbaa[_0xd410('0x1c')])_0x4315c5[_0xd410('0x1c')](_0x4cdbaa[_0xd410('0x1c')]);return db['sequelize'][_0xd410('0x3e')](_0x4315c5[_0xd410('0x98')](),_0x33066d);})[_0xd410('0x22')](function(_0x165056){_0x324b9e[_0xd410('0x49')](_0xd410('0xbb'),_[_0xd410('0x28')](_0x165056,'id'));return db['sequelize'][_0xd410('0x3e')](_0x324b9e[_0xd410('0x98')](),_0x33066d)[_0xd410('0x22')](function(_0x3be48c){var _0x5d5d6f=_[_0xd410('0xbc')](_0x3be48c,_0xd410('0xbd'));var _0x5487aa=[];return db[_0xd410('0xbe')][_0xd410('0x30')]({'attributes':[_0xd410('0xbf')],'raw':!![]})[_0xd410('0x22')](function(_0x4efe8e){var _0x577554=_0x4efe8e['enableEmailPreview'];_0x165056[_0xd410('0x2d')](function(_0x577f0d){_0x5487aa[_0xd410('0x2e')](updateMailInteraction(_0x577f0d,_0x195fa8,_0x5d5d6f,_0x577554));});return BPromise[_0xd410('0xc0')](_0x5487aa);});});});})[_0xd410('0x22')](function(_0x5a7f94){_0x3bfd4f[_0xd410('0xc1')]=_0x5a7f94;return _0x3bfd4f;})[_0xd410('0x22')](respondWithFilteredResult(_0x3670b9,_0x4cdbaa))['catch'](handleError(_0x3670b9,null));};exports[_0xd410('0xc2')]=function(_0x3726ed,_0x4c135e){var _0x10dd5e={'raw':![],'where':{'id':_0x3726ed[_0xd410('0xc3')]['id']}},_0x4d3ae4={};_0x4d3ae4[_0xd410('0x3d')]=_[_0xd410('0x3f')](db['MailInteraction'][_0xd410('0x39')]);_0x4d3ae4[_0xd410('0x3e')]=_[_0xd410('0x3f')](_0x3726ed['query']);_0x4d3ae4[_0xd410('0x40')]=_['intersection'](_0x4d3ae4['model'],_0x4d3ae4[_0xd410('0x3e')]);_0x10dd5e[_0xd410('0x42')]=_['intersection'](_0x4d3ae4['model'],qs[_0xd410('0x43')](_0x3726ed[_0xd410('0x3e')]['fields']));_0x10dd5e[_0xd410('0x42')]=_0x10dd5e[_0xd410('0x42')][_0xd410('0x44')]?_0x10dd5e[_0xd410('0x42')]:_0x4d3ae4['model'];if(_0x3726ed['query'][_0xd410('0xc4')]){_0x10dd5e['include']=[{'all':!![]}];}_0x10dd5e=_[_0xd410('0x9a')]({},_0x10dd5e,_0x3726ed[_0xd410('0xc5')]);return db['MailInteraction'][_0xd410('0x62')](_0x10dd5e)[_0xd410('0x22')](handleEntityNotFound(_0x4c135e,null))[_0xd410('0x22')](respondWithResult(_0x4c135e,null))[_0xd410('0x36')](handleError(_0x4c135e,null));};exports[_0xd410('0xc6')]=function(_0x48ba7e,_0x10f3a0){return db['MailInteraction'][_0xd410('0xc6')](_0x48ba7e['body'],{})[_0xd410('0x22')](respondWithResult(_0x10f3a0,0xc9))['catch'](handleError(_0x10f3a0,null));};exports[_0xd410('0x21')]=function(_0x27ebb5,_0x5f57d7){if(_0x27ebb5[_0xd410('0xc7')]['id']){delete _0x27ebb5[_0xd410('0xc7')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x27ebb5[_0xd410('0xc3')]['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x5f57d7,null))[_0xd410('0x22')](saveUpdates(_0x27ebb5[_0xd410('0xc7')],null))[_0xd410('0x22')](respondWithResult(_0x5f57d7,null))[_0xd410('0x36')](handleError(_0x5f57d7,null));};exports[_0xd410('0x23')]=function(_0x3a7408,_0x116eb7){return db['MailInteraction']['find']({'where':{'id':_0x3a7408['params']['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x116eb7,null))['then'](removeEntity(_0x116eb7,null))[_0xd410('0x36')](handleError(_0x116eb7,null));};exports[_0xd410('0xc8')]=function(_0x14f499,_0x48cc42){return db['MailInteraction'][_0xd410('0xc8')]()[_0xd410('0x22')](respondWithResult(_0x48cc42,null))[_0xd410('0x36')](handleError(_0x48cc42,null));};exports['addMessage']=function(_0x33e900,_0x44f75b,_0x489fc9){return db['MailMessage']['find']({'where':{'id':_0x33e900[_0xd410('0xc3')]['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x44f75b,null))['then'](function(_0x2c697a){if(_0x2c697a){return _0x2c697a['addMessage'](_0x33e900[_0xd410('0xc7')]['ids'],_[_0xd410('0xc9')](_0x33e900['body'],[_0xd410('0xca'),'id'])||{});}})['then'](respondWithResult(_0x44f75b,null))[_0xd410('0x36')](handleError(_0x44f75b,null));};exports[_0xd410('0xcb')]=function(_0x5423c3,_0x64cefd,_0x166c84){var _0x295c8f={'raw':![],'where':{}};var _0x27a064={};var _0x50cb0b={'count':0x0,'rows':[]};return db[_0xd410('0x38')][_0xd410('0x30')]({'where':{'id':_0x5423c3['params']['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x64cefd,null))['then'](function(_0x545b25){if(_0x545b25){_0x27a064['model']=_[_0xd410('0x3f')](db[_0xd410('0x2f')]['rawAttributes']);_0x27a064['query']=_[_0xd410('0x3f')](_0x5423c3['query']);_0x27a064['filters']=_['intersection'](_0x27a064[_0xd410('0x3d')],_0x27a064[_0xd410('0x3e')]);_0x295c8f[_0xd410('0x42')]=_[_0xd410('0x41')](_0x27a064[_0xd410('0x3d')],qs[_0xd410('0x43')](_0x5423c3[_0xd410('0x3e')]['fields']));_0x295c8f[_0xd410('0x42')]=_0x295c8f['attributes']['length']?_0x295c8f[_0xd410('0x42')]:_0x27a064['model'];if(!_0x5423c3[_0xd410('0x3e')]['hasOwnProperty'](_0xd410('0xcc'))){_0x295c8f['limit']=qs[_0xd410('0x46')](_0x5423c3[_0xd410('0x3e')][_0xd410('0x46')]);_0x295c8f[_0xd410('0x1c')]=qs['offset'](_0x5423c3['query'][_0xd410('0x1c')]);}_0x295c8f[_0xd410('0x47')]=qs[_0xd410('0x48')](_0x5423c3[_0xd410('0x3e')][_0xd410('0x48')]);_0x295c8f[_0xd410('0x49')]=qs[_0xd410('0x40')](_[_0xd410('0x4a')](_0x5423c3[_0xd410('0x3e')],_0x27a064[_0xd410('0x40')]));_0x295c8f[_0xd410('0x49')][_0xd410('0xbd')]=_0x545b25['id'];if(_0x5423c3[_0xd410('0x3e')][_0xd410('0x84')]){_0x295c8f[_0xd410('0x49')]=_[_0xd410('0x9a')](_0x295c8f[_0xd410('0x49')],{'$or':_['map'](_0x295c8f['attributes'],function(_0x15935b){var _0x3dfe00={};_0x3dfe00[_0x15935b]={'$like':'%'+_0x5423c3[_0xd410('0x3e')][_0xd410('0x84')]+'%'};return _0x3dfe00;})});}if(_0x5423c3[_0xd410('0x3e')]['$gte']){var _0x27ce83=_0x5423c3[_0xd410('0x3e')][_0xd410('0x7c')]['split'](',');var _0x32ce2c={};_0x32ce2c[_0x27ce83[0x0]]={'$gte':moment(_0x27ce83[0x1])[_0xd410('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x295c8f['where']=_['merge'](_0x295c8f[_0xd410('0x49')],_0x32ce2c);}_0x295c8f=_[_0xd410('0x9a')]({},_0x295c8f,_0x5423c3[_0xd410('0xc5')]);return db[_0xd410('0x2f')][_0xd410('0x1b')]({'where':_0x295c8f[_0xd410('0x49')]})['then'](function(_0x19f690){_0x50cb0b[_0xd410('0x1b')]=_0x19f690;if(_0x5423c3['query']['includeAll']){_0x295c8f[_0xd410('0xce')]=[{'all':!![]}];}return db[_0xd410('0x2f')][_0xd410('0xcf')](_0x295c8f);})[_0xd410('0x22')](function(_0x54a652){if(_0x5423c3[_0xd410('0x3e')]['inlineCss']===_0xd410('0xd0')){for(var _0x296c12=0x0;_0x296c12<_0x54a652['length'];_0x296c12++){_0x54a652[_0x296c12]['body']=juice(_0x54a652[_0x296c12]['body']);}}_0x50cb0b[_0xd410('0xc1')]=_0x54a652;return _0x50cb0b;});}})[_0xd410('0x22')](respondWithFilteredResult(_0x64cefd,_0x295c8f))['catch'](handleError(_0x64cefd,null));};exports[_0xd410('0xd1')]=function(_0x52ce79,_0x3190eb,_0x545c1b){return db[_0xd410('0x38')]['find']({'where':{'id':_0x52ce79[_0xd410('0xc3')]['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x3190eb,null))[_0xd410('0x22')](function(_0xb8cce8){if(_0xb8cce8){return _0xb8cce8[_0xd410('0xd2')](_0x52ce79[_0xd410('0xc7')]['ids'],_[_0xd410('0xc9')](_0x52ce79[_0xd410('0xc7')],['ids','id'])||{})[_0xd410('0xd3')](function(){return db[_0xd410('0xd4')][_0xd410('0xcf')]({'attributes':['id',_0xd410('0x25'),'color'],'where':{'id':_0x52ce79[_0xd410('0xc7')][_0xd410('0xca')]}});})['then'](function(_0x5a6d7a){socket[_0xd410('0xd5')](_0xd410('0xd6'),{'id':Number(_0x52ce79[_0xd410('0xc3')]['id']),'tags':_0x5a6d7a||[]});return{'id':Number(_0x52ce79[_0xd410('0xc3')]['id']),'tags':_0x5a6d7a||[]};});}})[_0xd410('0x22')](respondWithResult(_0x3190eb,null))[_0xd410('0x36')](handleError(_0x3190eb,null));};exports[_0xd410('0xd7')]=function(_0x309cd4,_0x2c3256,_0x429294){return db[_0xd410('0x38')][_0xd410('0x62')]({'where':{'id':_0x309cd4[_0xd410('0xc3')]['id']}})[_0xd410('0x22')](handleEntityNotFound(_0x2c3256,null))[_0xd410('0x22')](function(_0x2944a0){if(_0x2944a0){return _0x2944a0[_0xd410('0xd7')](_0x309cd4[_0xd410('0x3e')][_0xd410('0xca')]);}})['then'](respondWithStatusCode(_0x2c3256,null))[_0xd410('0x36')](handleError(_0x2c3256,null));};exports['download']=function(_0x2c6157,_0x3eb924){var _0x455b79=moment()[_0xd410('0xd8')]()[_0xd410('0x98')]();var _0x609a86=path[_0xd410('0xd9')](config[_0xd410('0xda')],_0xd410('0xdb'),_0xd410('0xdc'),_0xd410('0xdd'));var _0x459e8a=path[_0xd410('0xd9')](config[_0xd410('0xda')],'server','files',_0xd410('0xde'));var _0x84d9f3=path['join'](_0x609a86,_0x455b79);var _0x4ebe12=util[_0xd410('0xcd')](_0xd410('0xdf'),_0x2c6157['params']['id'],_0x455b79);var _0x5ded9c=path['join'](_0x609a86,_0x4ebe12);var _0x35f181=[];if(_0x2c6157[_0xd410('0x3e')][_0xd410('0xde')]){_0x35f181[_0xd410('0x2e')]({'model':db[_0xd410('0xe0')],'as':'Attachments','raw':!![]});}var _0x49da44=[{'model':db[_0xd410('0x2f')],'as':_0xd410('0xe1'),'attributes':['id',_0xd410('0xc7'),_0xd410('0x51'),'to','cc','bcc',_0xd410('0xe2'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x35f181}];return db[_0xd410('0x38')][_0xd410('0x62')]({'where':{'id':_0x2c6157[_0xd410('0xc3')]['id']},'include':_0x49da44})['then'](handleEntityNotFound(_0x3eb924,null))[_0xd410('0x22')](function(_0xcbfb6){if(_0xcbfb6&&_0xcbfb6['Messages']){var _0x527e7b=_0xcbfb6[_0xd410('0xe3')]({'plain':!![]});fs[_0xd410('0xe4')](_0x84d9f3);return BPromise['each'](_0x527e7b[_0xd410('0xe1')],function(_0x207ccb,_0x86202d){var _0x55233e={'from':_0x207ccb['from'],'to':_0x207ccb['to'],'subject':_0x207ccb[_0xd410('0xe2')],'html':_0x207ccb[_0xd410('0xc7')],'headers':{'Date':moment(_0x207ccb[_0xd410('0xe5')])[_0xd410('0xcd')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x207ccb['cc']){_0x55233e[_0xd410('0xe6')]['Cc']=_0x207ccb['cc'];}if(_0x207ccb['bcc']){_0x55233e[_0xd410('0xe6')]['Bcc']=_0x207ccb[_0xd410('0xe7')];}return new BPromise(function(_0x9ffada,_0x3b3b57){if(_0x207ccb[_0xd410('0xe8')]){for(var _0x34cb91=0x0;_0x34cb91<_0x207ccb[_0xd410('0xe8')]['length'];_0x34cb91++){var _0x5abeb4=_0x207ccb[_0xd410('0xe8')][_0x34cb91];var _0x5046ea=path['join'](_0x459e8a,_0x5abeb4[_0xd410('0xe9')]);if(fs[_0xd410('0xea')](_0x5046ea)){_0x55233e['attachments'][_0xd410('0x2e')]({'name':_0x5abeb4[_0xd410('0x25')],'contentType':_0x5abeb4[_0xd410('0x3b')],'data':fs[_0xd410('0xeb')](_0x5046ea)});}}}emlformat[_0xd410('0xec')](_0x55233e,function(_0x37f130,_0x2a7b3b){if(_0x37f130)return _0x3b3b57(_0x37f130);fs[_0xd410('0xed')](path[_0xd410('0xd9')](_0x84d9f3,util[_0xd410('0xcd')]('message%d.eml',_0x86202d)),_0x2a7b3b);return _0x9ffada(_0x2a7b3b);});});})[_0xd410('0x22')](function(){return new BPromise(function(_0x1194b8,_0x15b406){zipdir(_0x84d9f3,{'saveTo':_0x5ded9c},function(_0x2d471c,_0x426c7a){if(_0x2d471c)return _0x15b406(_0x2d471c);return _0x1194b8(_0x426c7a);});})['then'](function(){return new BPromise(function(_0x5205e8,_0x4d6d53){rimraf(_0x84d9f3,function(_0x38148a){if(_0x38148a)_0x4d6d53(_0x38148a);return _0x5205e8();});});})[_0xd410('0x22')](function(){return _0x3eb924['download'](_0x5ded9c,_0x4ebe12,function(_0x1108a0){if(_0x1108a0){console['log'](_0xd410('0xee'),_0x1108a0);}else{fs[_0xd410('0xef')](_0x5ded9c);}});});});}else{return _0x3eb924[_0xd410('0x18')](0xc8);}})['catch'](handleError(_0x3eb924,null));}; \ No newline at end of file +var _0x96a6=['headers','Bcc','Attachments','existsSync','readFileSync','build','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','findOne','out','plainBody','lastMsgText','catch','MailInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','field','color','from','tools_tags','select','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','find','ContactId','buildExpression','type','start','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','some','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','length','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','rows','show','params','includeAll','include','create','body','addMessage','MailMessage','ids','getMessages','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Messages','bcc','get','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0x96a6,0xfd));var _0x696a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x96a6[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x696a('0x0'));var emlformat=require(_0x696a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x696a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x696a('0x3'));var Mustache=require(_0x696a('0x4'));var util=require(_0x696a('0x5'));var path=require(_0x696a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x696a('0x7'));var squel=require(_0x696a('0x8'));var crypto=require('crypto');var jsforce=require(_0x696a('0x9'));var deskjs=require(_0x696a('0xa'));var toCsv=require(_0x696a('0xb'));var querystring=require(_0x696a('0xc'));var Papa=require(_0x696a('0xd'));var htmlToText=require(_0x696a('0xe'));var juice=require(_0x696a('0xf'));var Redis=require(_0x696a('0x10'));var authService=require(_0x696a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x696a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x696a('0x13'))(_0x696a('0x14'));var utils=require(_0x696a('0x15'));var config=require(_0x696a('0x16'));var licenseUtil=require(_0x696a('0x17'));var db=require(_0x696a('0x18'))['db'];config[_0x696a('0x19')]=_['defaults'](config['redis'],{'host':_0x696a('0x1a'),'port':0x18eb});var socket=require(_0x696a('0x1b'))(new Redis(config[_0x696a('0x19')]));require(_0x696a('0x1c'))[_0x696a('0x1d')](socket);function respondWithStatusCode(_0x15542d,_0x318b74){_0x318b74=_0x318b74||0xcc;return function(_0x12003e){if(_0x12003e){return _0x15542d['sendStatus'](_0x318b74);}return _0x15542d[_0x696a('0x1e')](_0x318b74)['end']();};}function respondWithResult(_0x283c7a,_0x33fccf){_0x33fccf=_0x33fccf||0xc8;return function(_0x4d2d9c){if(_0x4d2d9c){return _0x283c7a[_0x696a('0x1e')](_0x33fccf)[_0x696a('0x1f')](_0x4d2d9c);}};}function respondWithFilteredResult(_0x43e93c,_0x57a0dd){return function(_0x2e2bbd){if(_0x2e2bbd){var _0x5d0f22=_0x2e2bbd[_0x696a('0x20')],_0xff732d=_0x57a0dd[_0x696a('0x21')],_0x3986c8=_0x57a0dd['offset']+_0x57a0dd[_0x696a('0x22')],_0x3cfcc6;if(_0x3986c8>=_0x5d0f22){_0x3986c8=_0x5d0f22;_0x3cfcc6=0xc8;}else{_0x3cfcc6=0xce;}_0x43e93c['status'](_0x3cfcc6);return _0x43e93c[_0x696a('0x23')](_0x696a('0x24'),_0xff732d+'-'+_0x3986c8+'/'+_0x5d0f22)[_0x696a('0x1f')](_0x2e2bbd);}return null;};}function patchUpdates(_0x2709c2){return function(_0x2d2653){try{jsonpatch[_0x696a('0x25')](_0x2d2653,_0x2709c2,!![]);}catch(_0x2409b7){return BPromise[_0x696a('0x26')](_0x2409b7);}return _0x2d2653['save']();};}function saveUpdates(_0x41684a,_0x158746){return function(_0x4e4cce){if(_0x4e4cce){return _0x4e4cce[_0x696a('0x27')](_0x41684a)[_0x696a('0x28')](function(_0x54eb5c){return _0x54eb5c;});}return null;};}function removeEntity(_0x10c633,_0x3a8ba2){return function(_0x11be14){if(_0x11be14){return _0x11be14[_0x696a('0x29')]()[_0x696a('0x28')](function(){_0x10c633['status'](0xcc)[_0x696a('0x2a')]();});}};}function handleEntityNotFound(_0x13a4c5,_0x209fad){return function(_0x3ace9a){if(!_0x3ace9a){_0x13a4c5[_0x696a('0x2b')](0x194);}return _0x3ace9a;};}function handleError(_0x52e94b,_0x20bf03){_0x20bf03=_0x20bf03||0x1f4;return function(_0x3bd37d){logger['error'](_0x3bd37d['stack']);if(_0x3bd37d['name']){delete _0x3bd37d[_0x696a('0x2c')];}_0x52e94b['status'](_0x20bf03)[_0x696a('0x2d')](_0x3bd37d);};}function getInteractionUsers(_0x12ed66,_0x4b58b1){return new BPromise(function(_0x175b5d,_0x504f72){try{if(_0x4b58b1[_0x12ed66['id']]){_0x12ed66[_0x696a('0x2e')]=_[_0x696a('0x2f')](_0x4b58b1[_0x12ed66['id']],function(_0xf74c4f){return{'id':_0xf74c4f['id'],'fullname':_0xf74c4f[_0x696a('0x30')]};});}}catch(_0x15366b){_0x504f72(_0x15366b);}_0x175b5d(_0x12ed66);});}function getInteractionTags(_0x2ff7ae,_0x58cf17){return new BPromise(function(_0x1c3bee,_0x3f0f21){try{if(_0x2ff7ae[_0x696a('0x31')]){_0x2ff7ae[_0x696a('0x32')]=[];_0x2ff7ae[_0x696a('0x31')][_0x696a('0x33')](',')[_0x696a('0x34')](function(_0x5a9560){_0x2ff7ae[_0x696a('0x32')][_0x696a('0x35')](_0x58cf17[_0x5a9560]);});}delete _0x2ff7ae[_0x696a('0x31')];}catch(_0x3d97b1){_0x3f0f21(_0x3d97b1);}_0x1c3bee(_0x2ff7ae);});}function getLastMessageText(_0x34a2b3){return new BPromise(function(_0x5bc809,_0x34ed02){return db['MailMessage'][_0x696a('0x36')]({'where':{'$and':[{'MailInteractionId':_0x34a2b3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x696a('0x37')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x696a('0x38')],'order':'-id','raw':!![]})[_0x696a('0x28')](function(_0x41644c){if(_0x41644c&&_0x41644c[_0x696a('0x38')]){_0x34a2b3[_0x696a('0x39')]=_['trimStart'](_0x41644c['plainBody']);}_0x5bc809(_0x34a2b3);})[_0x696a('0x3a')](function(_0x13979b){_0x34ed02(_0x13979b);});});}function updateMailInteraction(_0x36dcf9,_0x1e2546,_0x47a92a,_0x564f22){return new BPromise(function(_0xecb795,_0x129a01){return getInteractionUsers(_0x36dcf9,_0x47a92a)[_0x696a('0x28')](function(_0x101532){return getInteractionTags(_0x101532,_0x1e2546);})[_0x696a('0x28')](function(_0x250c3a){if(_0x564f22){_0xecb795(getLastMessageText(_0x250c3a));}else{_0xecb795(_0x250c3a);}})['catch'](function(_0x412c0f){_0x129a01(_0x412c0f);});});}exports['index']=function(_0x1db57c,_0x54ea90){var _0x13b485={},_0xf7d051={},_0xc8c70d={'count':0x0,'rows':[]};var _0x332fab=_[_0x696a('0x2f')](db[_0x696a('0x3b')][_0x696a('0x3c')],function(_0x53d562){return{'name':_0x53d562[_0x696a('0x3d')],'type':_0x53d562['type']['key']};});_0xf7d051[_0x696a('0x3e')]=_[_0x696a('0x2f')](_0x332fab,'name');_0xf7d051[_0x696a('0x3f')]=_[_0x696a('0x40')](_0x1db57c[_0x696a('0x3f')]);_0xf7d051[_0x696a('0x41')]=_[_0x696a('0x42')](_0xf7d051[_0x696a('0x3e')],_0xf7d051['query']);_0x13b485[_0x696a('0x43')]=_[_0x696a('0x42')](_0xf7d051[_0x696a('0x3e')],qs[_0x696a('0x44')](_0x1db57c[_0x696a('0x3f')][_0x696a('0x44')]));_0x13b485[_0x696a('0x43')]=_0x13b485[_0x696a('0x43')]['length']?_0x13b485[_0x696a('0x43')]:_0xf7d051[_0x696a('0x3e')];if(!_0x1db57c[_0x696a('0x3f')][_0x696a('0x45')](_0x696a('0x46'))){_0x13b485[_0x696a('0x22')]=qs[_0x696a('0x22')](_0x1db57c[_0x696a('0x3f')][_0x696a('0x22')]);_0x13b485[_0x696a('0x21')]=qs[_0x696a('0x21')](_0x1db57c[_0x696a('0x3f')][_0x696a('0x21')]);}_0x13b485['order']=qs['sort'](_0x1db57c['query'][_0x696a('0x47')]);_0x13b485['where']=qs['filters'](_['pick'](_0x1db57c['query'],_0xf7d051[_0x696a('0x41')]),_0x332fab);var _0x5c87a2=[];var _0x44e871=squel['select']()[_0x696a('0x48')]('id')[_0x696a('0x48')]('name')[_0x696a('0x48')](_0x696a('0x49'))[_0x696a('0x4a')](_0x696a('0x4b'));var _0x2f6906=squel[_0x696a('0x4c')]()[_0x696a('0x48')]('u.id')[_0x696a('0x48')](_0x696a('0x4d'))[_0x696a('0x48')](_0x696a('0x4e'))[_0x696a('0x4a')](_0x696a('0x4f'),'ui')[_0x696a('0x50')]('users','u',_0x696a('0x51'));var _0x954e85=squel[_0x696a('0x4c')]()[_0x696a('0x4a')](_0x696a('0x52'),'i')['left_join'](_0x696a('0x53'),'c',_0x696a('0x54'))[_0x696a('0x50')](_0x696a('0x55'),'o',_0x696a('0x56'))[_0x696a('0x50')]('mail_accounts','a',_0x696a('0x57'))['left_join'](_0x696a('0x58'),'me','me.MailInteractionId\x20=\x20i.id')[_0x696a('0x50')](_0x696a('0x59'),'it',_0x696a('0x5a'))['left_join'](_0x696a('0x4b'),'t',_0x696a('0x5b'));var _0x2d3c53=squel[_0x696a('0x5c')]();var _0x9e97e9=[];var _0x14ec14=squel[_0x696a('0x5c')]();var _0x289b6b;if(_0x1db57c[_0x696a('0x3f')]['search']){_0x289b6b=as['parseSearch'](_0x1db57c[_0x696a('0x3f')][_0x696a('0x5d')]);var _0x1df12b=_0x289b6b[_0x696a('0x5e')];for(var _0x366098=0x0;_0x366098<_0x289b6b[_0x696a('0x5f')]['length'];_0x366098++){var _0x262513=_0x289b6b[_0x696a('0x5f')][_0x366098];var _0x1aba61='i';var _0x2a2d29=_['find'](_0x332fab,[_0x696a('0x2c'),_0x262513[_0x696a('0x48')]]);if(!_0x2a2d29){switch(_0x262513['field']){case _0x696a('0x60'):if(_0x262513[_0x696a('0x61')]==0x1){_0x954e85[_0x696a('0x62')]('`'+_0x262513['field']+_0x696a('0x63'));}else{_0x954e85['having']('`'+_0x262513[_0x696a('0x48')]+'`\x20>\x200');}break;case _0x696a('0x64'):if(_0x262513[_0x696a('0x65')]===_0x696a('0x66')){if(_0x262513[_0x696a('0x61')]['split']('\x20')['length']>0x1){_0x2d3c53[_0x1df12b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x696a('0x67')](_0x262513['value']),null);}else{var _0x43c805='%'+_0x262513[_0x696a('0x61')]+'%';_0x2d3c53[_0x1df12b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x43c805,_0x43c805,_0x43c805);}}else{_0x2a2d29=_[_0x696a('0x68')](_0x332fab,[_0x696a('0x2c'),_0x696a('0x69')]);_0x262513[_0x696a('0x48')]=_0x696a('0x69');_0x3a4b27=as[_0x696a('0x6a')](_0x1aba61,_0x2a2d29[_0x696a('0x6b')],_0x262513);_0x2d3c53[_0x1df12b](_0x3a4b27['text'],_0x3a4b27[_0x696a('0x61')][_0x696a('0x6c')],_0x3a4b27[_0x696a('0x61')]['end']);}break;case'Tag':var _0x48fb37=_0x262513[_0x696a('0x61')][_0x696a('0x33')](',')[_0x696a('0x2f')](function(_0x567229){return Number(_0x567229);});_0x48fb37[_0x696a('0x34')](function(_0x19fdb0){_0x14ec14['or'](_0x696a('0x6d'),'%,'+_0x19fdb0+',%');});_0x9e97e9=_[_0x696a('0x6e')](_0x9e97e9,_0x48fb37);break;case _0x696a('0x6f'):if(_0x262513[_0x696a('0x65')]===_0x696a('0x66')){_0x2d3c53[_0x1df12b](_0x696a('0x70'),'%'+_0x262513[_0x696a('0x61')]+'%',null);}else{_0x2a2d29=_[_0x696a('0x68')](_0x332fab,[_0x696a('0x2c'),_0x696a('0x71')]);_0x262513[_0x696a('0x48')]=_0x696a('0x71');_0x3a4b27=as[_0x696a('0x6a')](_0x1aba61,_0x2a2d29[_0x696a('0x6b')],_0x262513);_0x2d3c53[_0x1df12b](_0x3a4b27[_0x696a('0x72')],_0x3a4b27[_0x696a('0x61')][_0x696a('0x6c')],_0x3a4b27[_0x696a('0x61')][_0x696a('0x2a')]);}break;case _0x696a('0x38'):_0x3a4b27=as[_0x696a('0x6a')]('me',null,_0x262513);_0x2d3c53[_0x1df12b](_0x3a4b27[_0x696a('0x72')],_0x3a4b27[_0x696a('0x61')][_0x696a('0x6c')],_0x3a4b27[_0x696a('0x61')][_0x696a('0x2a')]);break;}}else{var _0x3a4b27=as[_0x696a('0x6a')](_0x1aba61,_0x2a2d29[_0x696a('0x6b')],_0x262513);_0x2d3c53[_0x1df12b](_0x3a4b27[_0x696a('0x72')],_0x3a4b27[_0x696a('0x61')]['start'],_0x3a4b27[_0x696a('0x61')]['end']);}}}else{var _0x5c1360=_(_0x1db57c['query'])[_0x696a('0x40')]()[_0x696a('0x2f')](function(_0x54b79d){return _[_0x696a('0x73')](_0x332fab,[_0x696a('0x2c'),_0x54b79d])?_0x54b79d:undefined;})['compact']()[_0x696a('0x61')]();if(!_[_0x696a('0x74')](_0x5c1360)){_0x5c1360[_0x696a('0x34')](function(_0x360945){if(_0x360945===_0x696a('0x75')){_0x954e85[_0x696a('0x76')](_0x696a('0x77'),[][_0x696a('0x78')](_0x1db57c['query'][_0x360945]));}else if(_0x360945===_0x696a('0x79')){var _0x3f9f79=JSON[_0x696a('0x7a')](_0x1db57c[_0x696a('0x3f')][_0x360945])[_0x696a('0x7b')];var _0x4b55fb=JSON[_0x696a('0x7a')](_0x1db57c['query'][_0x360945])[_0x696a('0x7c')];_0x954e85[_0x696a('0x76')](_0x696a('0x7d'),_0x3f9f79,_0x4b55fb);}else{if(_0x1db57c['query'][_0x360945]===_0x696a('0x7e')){_0x954e85['where']('i.'+_0x360945+_0x696a('0x7f'));}else{_0x954e85['where']('i.'+_0x360945+_0x696a('0x80'),_0x1db57c['query'][_0x360945]);}}});}if(_0x1db57c[_0x696a('0x3f')]['read']){if(_0x1db57c[_0x696a('0x3f')]['read']==0x1){_0x954e85[_0x696a('0x62')](_0x696a('0x81'));}else{_0x954e85[_0x696a('0x62')](_0x696a('0x82'));}}if(_0x1db57c[_0x696a('0x3f')][_0x696a('0x83')]){_0x9e97e9=_[_0x696a('0x84')](_0x1db57c[_0x696a('0x3f')]['tag'])?_0x1db57c['query'][_0x696a('0x83')]:new Array(_0x1db57c[_0x696a('0x3f')][_0x696a('0x83')]);_0x9e97e9[_0x696a('0x34')](function(_0x479c9a){_0x14ec14['or'](_0x696a('0x6d'),'%,'+_0x479c9a+',%');});}if(_0x1db57c[_0x696a('0x3f')][_0x696a('0x85')]){var _0x2b58c7=_0x1db57c[_0x696a('0x3f')][_0x696a('0x85')][_0x696a('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x696a('0x87')](_0x2b58c7)){_0x2d3c53['or'](_0x696a('0x88'),_0x2b58c7+'%');}else if(qs[_0x696a('0x89')](_0x2b58c7)){_0x2d3c53['or'](_0x696a('0x8a'),_0x2b58c7+'%');}else{_0x2d3c53['or'](_0x696a('0x8b'),qs[_0x696a('0x67')](_0x2b58c7))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x696a('0x67')](_0x2b58c7));}}}_0x954e85['where'](_0x2d3c53);_0x954e85['group'](_0x696a('0x8c'));var _0x4e56b6={'type':db[_0x696a('0x8d')][_0x696a('0x8e')][_0x696a('0x8f')],'raw':!![]};var _0x3fa4c8=_0x954e85[_0x696a('0x90')]();_0x3fa4c8[_0x696a('0x48')]('i.id');_0x3fa4c8[_0x696a('0x48')](_0x696a('0x91'),_0x696a('0x60'));if(_0x13b485['order']){_0x13b485[_0x696a('0x92')][_0x696a('0x34')](function(_0x597a6e){var _0x2fdf60=_0x597a6e[0x0]===_0x696a('0x93')?_0x597a6e[0x0]:'i.'+_0x597a6e[0x0];_0x954e85['order'](_0x2fdf60,_0x597a6e[0x1]===_0x696a('0x94')?![]:!![]);});}if(!_[_0x696a('0x74')](_0x9e97e9)){_0x954e85[_0x696a('0x62')](_0x14ec14);_0x3fa4c8[_0x696a('0x76')](_0x696a('0x95'),_0x9e97e9);}BPromise[_0x696a('0x96')]()[_0x696a('0x28')](function(){if(!_0x289b6b){if(_0x1db57c[_0x696a('0x3f')][_0x696a('0x75')])return;_0x3fa4c8[_0x696a('0x76')](_0x696a('0x97'));_0x954e85['where'](_0x696a('0x97'));return;}if(_0x1db57c['user'][_0x696a('0x98')]!==_0x696a('0x99'))return;return _0x1db57c[_0x696a('0x9a')][_0x696a('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34cbf9){if(_[_0x696a('0x74')](_0x34cbf9)){_0x3fa4c8[_0x696a('0x76')](_0x696a('0x9c'));_0x954e85[_0x696a('0x76')](_0x696a('0x9c'));}else{_0x3fa4c8[_0x696a('0x76')](_0x696a('0x77'),_[_0x696a('0x2f')](_0x34cbf9,'id'));_0x954e85[_0x696a('0x76')]('i.MailAccountId\x20IN\x20?',_[_0x696a('0x2f')](_0x34cbf9,'id'));}});})['then'](function(){if(_0x1db57c[_0x696a('0x9a')][_0x696a('0x98')]==='agent'&&!_0x289b6b&&!_0x1db57c[_0x696a('0x3f')][_0x696a('0x75')])return[];return db[_0x696a('0x9d')][_0x696a('0x3f')](_0x3fa4c8[_0x696a('0x9e')](),_0x4e56b6);})[_0x696a('0x28')](function(_0x529cec){_0xc8c70d[_0x696a('0x20')]=_0x529cec[_0x696a('0x9f')];if(_0xc8c70d[_0x696a('0x20')]===0x0)return[];return db[_0x696a('0x9d')][_0x696a('0x3f')](_0x44e871[_0x696a('0x9e')](),_0x4e56b6)[_0x696a('0x28')](function(_0x31bcc6){_0x5c87a2=_[_0x696a('0xa0')](_0x31bcc6,'id');_0x4e56b6=_[_0x696a('0xa1')](_0x4e56b6,{'model':db[_0x696a('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1db57c[_0x696a('0x3f')][_0x696a('0x44')]){_0x13b485[_0x696a('0x43')]['forEach'](function(_0x217e6b){_0x954e85['field']('i.'+_0x217e6b);});}else{_0x954e85[_0x696a('0x48')](_0x696a('0x91'),'unreadMessages');_0x954e85[_0x696a('0x48')](_0x696a('0xa2'),_0x696a('0xa3'));_0x954e85[_0x696a('0x48')]('a.mandatoryDisposition',_0x696a('0xa4'));_0x954e85[_0x696a('0x48')](_0x696a('0xa5'),_0x696a('0x93'));_0x954e85[_0x696a('0x48')](_0x696a('0x8c'));_0x954e85[_0x696a('0x48')]('i.createdAt');_0x954e85[_0x696a('0x48')](_0x696a('0xa6'));_0x954e85['field'](_0x696a('0xa7'));_0x954e85[_0x696a('0x48')]('i.closedAt');_0x954e85['field']('i.attach');_0x954e85['field'](_0x696a('0xa8'));_0x954e85[_0x696a('0x48')](_0x696a('0xa9'));_0x954e85[_0x696a('0x48')](_0x696a('0xaa'));_0x954e85[_0x696a('0x48')](_0x696a('0xab'));_0x954e85[_0x696a('0x48')](_0x696a('0xac'));_0x954e85[_0x696a('0x48')](_0x696a('0xad'));_0x954e85['field'](_0x696a('0xae'));_0x954e85[_0x696a('0x48')](_0x696a('0xaf'));_0x954e85['field']('i.ContactId');_0x954e85['field'](_0x696a('0xb0'));_0x954e85[_0x696a('0x48')](_0x696a('0xb1'));_0x954e85[_0x696a('0x48')]('c.firstName',_0x696a('0xb2'));_0x954e85[_0x696a('0x48')](_0x696a('0xb3'),'Contact.lastName');_0x954e85[_0x696a('0x48')](_0x696a('0xb4'),_0x696a('0xb5'));_0x954e85[_0x696a('0x48')](_0x696a('0xb6'),_0x696a('0xb7'));_0x954e85[_0x696a('0x48')](_0x696a('0xb8'),_0x696a('0xb9'));_0x954e85[_0x696a('0x48')]('c.fax',_0x696a('0xba'));_0x954e85[_0x696a('0x48')](_0x696a('0xbb'),_0x696a('0xbc'));_0x954e85[_0x696a('0x48')](_0x696a('0xbd'),'Owner.internal');_0x954e85[_0x696a('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x696a('0x31'));}if(_0x13b485['limit'])_0x954e85[_0x696a('0x22')](_0x13b485['limit']);if(_0x13b485[_0x696a('0x21')])_0x954e85['offset'](_0x13b485[_0x696a('0x21')]);return db['sequelize']['query'](_0x954e85[_0x696a('0x9e')](),_0x4e56b6);})[_0x696a('0x28')](function(_0x25d946){_0x2f6906[_0x696a('0x76')](_0x696a('0xbe'),_['map'](_0x25d946,'id'));return db[_0x696a('0x9d')][_0x696a('0x3f')](_0x2f6906['toString'](),_0x4e56b6)['then'](function(_0x5ec52d){var _0x54e0de=_[_0x696a('0xbf')](_0x5ec52d,'MailInteractionId');var _0x4dde80=[];return db[_0x696a('0xc0')][_0x696a('0x36')]({'attributes':[_0x696a('0xc1')],'raw':!![]})['then'](function(_0x20b55a){var _0x30a9f2=_0x20b55a[_0x696a('0xc1')];_0x25d946[_0x696a('0x34')](function(_0xe58abb){_0x4dde80[_0x696a('0x35')](updateMailInteraction(_0xe58abb,_0x5c87a2,_0x54e0de,_0x30a9f2));});return BPromise['all'](_0x4dde80);});});});})[_0x696a('0x28')](function(_0x18157b){_0xc8c70d[_0x696a('0xc2')]=_0x18157b;return _0xc8c70d;})[_0x696a('0x28')](respondWithFilteredResult(_0x54ea90,_0x13b485))[_0x696a('0x3a')](handleError(_0x54ea90,null));};exports[_0x696a('0xc3')]=function(_0x14d199,_0x158201){var _0x1d8b78={'raw':![],'where':{'id':_0x14d199[_0x696a('0xc4')]['id']}},_0x215880={};_0x215880[_0x696a('0x3e')]=_[_0x696a('0x40')](db['MailInteraction'][_0x696a('0x3c')]);_0x215880[_0x696a('0x3f')]=_[_0x696a('0x40')](_0x14d199[_0x696a('0x3f')]);_0x215880['filters']=_[_0x696a('0x42')](_0x215880[_0x696a('0x3e')],_0x215880[_0x696a('0x3f')]);_0x1d8b78[_0x696a('0x43')]=_['intersection'](_0x215880['model'],qs['fields'](_0x14d199['query']['fields']));_0x1d8b78[_0x696a('0x43')]=_0x1d8b78[_0x696a('0x43')][_0x696a('0x9f')]?_0x1d8b78[_0x696a('0x43')]:_0x215880[_0x696a('0x3e')];if(_0x14d199['query'][_0x696a('0xc5')]){_0x1d8b78[_0x696a('0xc6')]=[{'all':!![]}];}_0x1d8b78=_[_0x696a('0xa1')]({},_0x1d8b78,_0x14d199['options']);return db[_0x696a('0x3b')][_0x696a('0x68')](_0x1d8b78)['then'](handleEntityNotFound(_0x158201,null))[_0x696a('0x28')](respondWithResult(_0x158201,null))[_0x696a('0x3a')](handleError(_0x158201,null));};exports[_0x696a('0xc7')]=function(_0x14e29c,_0x385e31){return db[_0x696a('0x3b')][_0x696a('0xc7')](_0x14e29c[_0x696a('0xc8')],{})[_0x696a('0x28')](respondWithResult(_0x385e31,0xc9))['catch'](handleError(_0x385e31,null));};exports[_0x696a('0x27')]=function(_0x35e13e,_0xf72288){if(_0x35e13e[_0x696a('0xc8')]['id']){delete _0x35e13e[_0x696a('0xc8')]['id'];}return db[_0x696a('0x3b')][_0x696a('0x68')]({'where':{'id':_0x35e13e[_0x696a('0xc4')]['id']}})[_0x696a('0x28')](handleEntityNotFound(_0xf72288,null))[_0x696a('0x28')](saveUpdates(_0x35e13e['body'],null))[_0x696a('0x28')](respondWithResult(_0xf72288,null))[_0x696a('0x3a')](handleError(_0xf72288,null));};exports[_0x696a('0x29')]=function(_0x125696,_0x41b0d0){return db[_0x696a('0x3b')][_0x696a('0x68')]({'where':{'id':_0x125696[_0x696a('0xc4')]['id']}})[_0x696a('0x28')](handleEntityNotFound(_0x41b0d0,null))[_0x696a('0x28')](removeEntity(_0x41b0d0,null))[_0x696a('0x3a')](handleError(_0x41b0d0,null));};exports['describe']=function(_0x4e1096,_0x2aa584){return db[_0x696a('0x3b')]['describe']()[_0x696a('0x28')](respondWithResult(_0x2aa584,null))[_0x696a('0x3a')](handleError(_0x2aa584,null));};exports[_0x696a('0xc9')]=function(_0x17eb8a,_0x5c1fc2,_0x104930){return db[_0x696a('0xca')][_0x696a('0x68')]({'where':{'id':_0x17eb8a[_0x696a('0xc4')]['id']}})[_0x696a('0x28')](handleEntityNotFound(_0x5c1fc2,null))[_0x696a('0x28')](function(_0x4521e0){if(_0x4521e0){return _0x4521e0['addMessage'](_0x17eb8a[_0x696a('0xc8')][_0x696a('0xcb')],_['omit'](_0x17eb8a['body'],[_0x696a('0xcb'),'id'])||{});}})[_0x696a('0x28')](respondWithResult(_0x5c1fc2,null))[_0x696a('0x3a')](handleError(_0x5c1fc2,null));};exports[_0x696a('0xcc')]=function(_0x429a2b,_0x2fea19,_0x2071ee){var _0x3cbbbe={'raw':![],'where':{}};var _0x3511c9={};var _0xede0e0={'count':0x0,'rows':[]};return db[_0x696a('0x3b')][_0x696a('0x36')]({'where':{'id':_0x429a2b['params']['id']}})[_0x696a('0x28')](handleEntityNotFound(_0x2fea19,null))[_0x696a('0x28')](function(_0x2f3b1d){if(_0x2f3b1d){_0x3511c9[_0x696a('0x3e')]=_['keys'](db[_0x696a('0xca')][_0x696a('0x3c')]);_0x3511c9[_0x696a('0x3f')]=_[_0x696a('0x40')](_0x429a2b[_0x696a('0x3f')]);_0x3511c9[_0x696a('0x41')]=_[_0x696a('0x42')](_0x3511c9[_0x696a('0x3e')],_0x3511c9['query']);_0x3cbbbe[_0x696a('0x43')]=_['intersection'](_0x3511c9['model'],qs['fields'](_0x429a2b[_0x696a('0x3f')]['fields']));_0x3cbbbe[_0x696a('0x43')]=_0x3cbbbe[_0x696a('0x43')]['length']?_0x3cbbbe['attributes']:_0x3511c9[_0x696a('0x3e')];if(!_0x429a2b[_0x696a('0x3f')][_0x696a('0x45')]('nolimit')){_0x3cbbbe[_0x696a('0x22')]=qs[_0x696a('0x22')](_0x429a2b['query'][_0x696a('0x22')]);_0x3cbbbe[_0x696a('0x21')]=qs[_0x696a('0x21')](_0x429a2b['query'][_0x696a('0x21')]);}_0x3cbbbe[_0x696a('0x92')]=qs['sort'](_0x429a2b['query']['sort']);_0x3cbbbe[_0x696a('0x76')]=qs[_0x696a('0x41')](_[_0x696a('0xcd')](_0x429a2b[_0x696a('0x3f')],_0x3511c9[_0x696a('0x41')]));_0x3cbbbe[_0x696a('0x76')][_0x696a('0xce')]=_0x2f3b1d['id'];if(_0x429a2b[_0x696a('0x3f')][_0x696a('0x85')]){_0x3cbbbe[_0x696a('0x76')]=_['merge'](_0x3cbbbe[_0x696a('0x76')],{'$or':_['map'](_0x3cbbbe[_0x696a('0x43')],function(_0x1f8114){var _0xc9706={};_0xc9706[_0x1f8114]={'$like':'%'+_0x429a2b[_0x696a('0x3f')][_0x696a('0x85')]+'%'};return _0xc9706;})});}if(_0x429a2b[_0x696a('0x3f')]['$gte']){var _0x1560fe=_0x429a2b[_0x696a('0x3f')][_0x696a('0x7b')]['split'](',');var _0x5ebd52={};_0x5ebd52[_0x1560fe[0x0]]={'$gte':moment(_0x1560fe[0x1])[_0x696a('0xcf')](_0x696a('0xd0'))};_0x3cbbbe[_0x696a('0x76')]=_[_0x696a('0xa1')](_0x3cbbbe[_0x696a('0x76')],_0x5ebd52);}_0x3cbbbe=_[_0x696a('0xa1')]({},_0x3cbbbe,_0x429a2b[_0x696a('0xd1')]);return db[_0x696a('0xca')]['count']({'where':_0x3cbbbe['where']})[_0x696a('0x28')](function(_0x2272c0){_0xede0e0[_0x696a('0x20')]=_0x2272c0;if(_0x429a2b[_0x696a('0x3f')][_0x696a('0xc5')]){_0x3cbbbe[_0x696a('0xc6')]=[{'all':!![]}];}return db[_0x696a('0xca')][_0x696a('0xd2')](_0x3cbbbe);})[_0x696a('0x28')](function(_0x1365f3){if(_0x429a2b[_0x696a('0x3f')][_0x696a('0xd3')]===_0x696a('0xd4')){for(var _0x28afb9=0x0;_0x28afb9<_0x1365f3['length'];_0x28afb9++){_0x1365f3[_0x28afb9][_0x696a('0xc8')]=juice(_0x1365f3[_0x28afb9][_0x696a('0xc8')]);}}_0xede0e0['rows']=_0x1365f3;return _0xede0e0;});}})[_0x696a('0x28')](respondWithFilteredResult(_0x2fea19,_0x3cbbbe))[_0x696a('0x3a')](handleError(_0x2fea19,null));};exports['addTags']=function(_0x338ef9,_0x1a0007,_0x29b979){return db['MailInteraction'][_0x696a('0x68')]({'where':{'id':_0x338ef9[_0x696a('0xc4')]['id']}})[_0x696a('0x28')](handleEntityNotFound(_0x1a0007,null))[_0x696a('0x28')](function(_0x4cfc7e){if(_0x4cfc7e){return _0x4cfc7e[_0x696a('0xd5')](_0x338ef9[_0x696a('0xc8')][_0x696a('0xcb')],_[_0x696a('0xd6')](_0x338ef9[_0x696a('0xc8')],[_0x696a('0xcb'),'id'])||{})[_0x696a('0xd7')](function(){return db['Tag'][_0x696a('0xd2')]({'attributes':['id','name',_0x696a('0x49')],'where':{'id':_0x338ef9['body'][_0x696a('0xcb')]}});})[_0x696a('0x28')](function(_0x48786f){socket[_0x696a('0xd8')](_0x696a('0xd9'),{'id':Number(_0x338ef9[_0x696a('0xc4')]['id']),'tags':_0x48786f||[]});return{'id':Number(_0x338ef9[_0x696a('0xc4')]['id']),'tags':_0x48786f||[]};});}})[_0x696a('0x28')](respondWithResult(_0x1a0007,null))[_0x696a('0x3a')](handleError(_0x1a0007,null));};exports[_0x696a('0xda')]=function(_0x1ca349,_0x3fe1a7,_0x190dec){return db['MailInteraction'][_0x696a('0x68')]({'where':{'id':_0x1ca349[_0x696a('0xc4')]['id']}})['then'](handleEntityNotFound(_0x3fe1a7,null))[_0x696a('0x28')](function(_0x1e1de7){if(_0x1e1de7){return _0x1e1de7[_0x696a('0xda')](_0x1ca349[_0x696a('0x3f')][_0x696a('0xcb')]);}})[_0x696a('0x28')](respondWithStatusCode(_0x3fe1a7,null))[_0x696a('0x3a')](handleError(_0x3fe1a7,null));};exports[_0x696a('0xdb')]=function(_0x47224c,_0x5a18c2){var _0x4e2f5b=moment()[_0x696a('0xdc')]()['toString']();var _0x5d58ca=path['join'](config[_0x696a('0xdd')],_0x696a('0xde'),_0x696a('0xdf'),_0x696a('0xe0'));var _0x3df351=path[_0x696a('0xe1')](config[_0x696a('0xdd')],_0x696a('0xde'),_0x696a('0xdf'),_0x696a('0xe2'));var _0x5afdeb=path[_0x696a('0xe1')](_0x5d58ca,_0x4e2f5b);var _0x23f358=util['format'](_0x696a('0xe3'),_0x47224c['params']['id'],_0x4e2f5b);var _0x5acaf0=path['join'](_0x5d58ca,_0x23f358);var _0x39234d=[];if(_0x47224c[_0x696a('0x3f')][_0x696a('0xe2')]){_0x39234d[_0x696a('0x35')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x3f21f6=[{'model':db['MailMessage'],'as':_0x696a('0xe4'),'attributes':['id','body',_0x696a('0x4a'),'to','cc',_0x696a('0xe5'),'subject',_0x696a('0x79')],'where':{'secret':![]},'order':qs[_0x696a('0x47')]('id'),'include':_0x39234d}];return db['MailInteraction'][_0x696a('0x68')]({'where':{'id':_0x47224c[_0x696a('0xc4')]['id']},'include':_0x3f21f6})[_0x696a('0x28')](handleEntityNotFound(_0x5a18c2,null))['then'](function(_0xdc41ef){if(_0xdc41ef&&_0xdc41ef[_0x696a('0xe4')]){var _0xd0a5f=_0xdc41ef[_0x696a('0xe6')]({'plain':!![]});fs['mkdirSync'](_0x5afdeb);return BPromise['each'](_0xd0a5f['Messages'],function(_0x3c4a7e,_0x1bbc71){var _0x5c91ef={'from':_0x3c4a7e[_0x696a('0x4a')],'to':_0x3c4a7e['to'],'subject':_0x3c4a7e[_0x696a('0xe7')],'html':_0x3c4a7e[_0x696a('0xc8')],'headers':{'Date':moment(_0x3c4a7e[_0x696a('0x79')])[_0x696a('0xcf')](_0x696a('0xe8'))},'attachments':[]};if(_0x3c4a7e['cc']){_0x5c91ef[_0x696a('0xe9')]['Cc']=_0x3c4a7e['cc'];}if(_0x3c4a7e[_0x696a('0xe5')]){_0x5c91ef['headers'][_0x696a('0xea')]=_0x3c4a7e['bcc'];}return new BPromise(function(_0x265f2d,_0x2d9c0f){if(_0x3c4a7e[_0x696a('0xeb')]){for(var _0x2d1b5b=0x0;_0x2d1b5b<_0x3c4a7e['Attachments'][_0x696a('0x9f')];_0x2d1b5b++){var _0x5f45c2=_0x3c4a7e['Attachments'][_0x2d1b5b];var _0x2c5709=path[_0x696a('0xe1')](_0x3df351,_0x5f45c2['basename']);if(fs[_0x696a('0xec')](_0x2c5709)){_0x5c91ef[_0x696a('0xe2')][_0x696a('0x35')]({'name':_0x5f45c2[_0x696a('0x2c')],'contentType':_0x5f45c2[_0x696a('0x6b')],'data':fs[_0x696a('0xed')](_0x2c5709)});}}}emlformat[_0x696a('0xee')](_0x5c91ef,function(_0x490f59,_0x49715d){if(_0x490f59)return _0x2d9c0f(_0x490f59);fs['writeFileSync'](path['join'](_0x5afdeb,util['format'](_0x696a('0xef'),_0x1bbc71)),_0x49715d);return _0x265f2d(_0x49715d);});});})[_0x696a('0x28')](function(){return new BPromise(function(_0x240a7c,_0x5697b0){zipdir(_0x5afdeb,{'saveTo':_0x5acaf0},function(_0x34c49e,_0x2548c7){if(_0x34c49e)return _0x5697b0(_0x34c49e);return _0x240a7c(_0x2548c7);});})[_0x696a('0x28')](function(){return new BPromise(function(_0x106fc7,_0x58935f){rimraf(_0x5afdeb,function(_0x361541){if(_0x361541)_0x58935f(_0x361541);return _0x106fc7();});});})[_0x696a('0x28')](function(){return _0x5a18c2[_0x696a('0xdb')](_0x5acaf0,_0x23f358,function(_0xff281e){if(_0xff281e){console[_0x696a('0xf0')](_0x696a('0xf1'),_0xff281e);}else{fs[_0x696a('0xf2')](_0x5acaf0);}});});});}else{return _0x5a18c2[_0x696a('0x2b')](0xc8);}})[_0x696a('0x3a')](handleError(_0x5a18c2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d7ad66b..680daa8 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 _0x535e=['update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x354016,_0x3c2014){var _0x499c8a=function(_0x2fb91e){while(--_0x2fb91e){_0x354016['push'](_0x354016['shift']());}};_0x499c8a(++_0x3c2014);}(_0x535e,0x10b));var _0xe535=function(_0x2b84cb,_0x149228){_0x2b84cb=_0x2b84cb-0x0;var _0x3639cc=_0x535e[_0x2b84cb];return _0x3639cc;};'use strict';var EventEmitter=require(_0xe535('0x0'));var MailInteraction=require(_0xe535('0x1'))['db'][_0xe535('0x2')];var MailMessage=require(_0xe535('0x1'))['db'][_0xe535('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe535('0x4'),'afterUpdate':_0xe535('0x5'),'afterDestroy':_0xe535('0x6')};function emitEvent(_0x46a30a){return function(_0x3b6658,_0x5b6523,_0x59b63c){_0x3b6658[_0xe535('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5b4771){_0x3b6658[_0xe535('0x8')]('Users',_0x5b4771[_0xe535('0x9')](function(_0x299366){return{'id':_0x299366['id']};}));return MailMessage[_0xe535('0xa')]({'where':{'MailInteractionId':_0x3b6658['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe535('0xb')](function(_0x1ed4e9){_0x3b6658[_0xe535('0x8')](_0xe535('0xc'),_0x1ed4e9[_0xe535('0xd')]);MailInteractionEvents[_0xe535('0xe')](_0x46a30a+':'+_0x3b6658['id'],_0x3b6658);MailInteractionEvents['emit'](_0x46a30a,_0x3b6658);_0x59b63c(null);})['catch'](_0x59b63c(null));};}for(var e in events){if(events[_0xe535('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xe535('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x7039=['getUsers','then','setDataValue','map','unreadMessages','length','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7039,0x1e9));var _0x9703=function(_0x404064,_0x5382a8){_0x404064=_0x404064-0x0;var _0x5e2835=_0x7039[_0x404064];return _0x5e2835;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x9703('0x0'))['db'][_0x9703('0x1')];var MailMessage=require(_0x9703('0x0'))['db'][_0x9703('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9703('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9703('0x4'),'afterDestroy':_0x9703('0x5')};function emitEvent(_0x51bc4b){return function(_0x44cf24,_0x5c50e6,_0x3da269){_0x44cf24[_0x9703('0x6')]({'attributes':['id'],'raw':!![]})[_0x9703('0x7')](function(_0x44f45){_0x44cf24[_0x9703('0x8')]('Users',_0x44f45[_0x9703('0x9')](function(_0x255e0e){return{'id':_0x255e0e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x44cf24['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9703('0x7')](function(_0x4ef0c6){_0x44cf24['setDataValue'](_0x9703('0xa'),_0x4ef0c6[_0x9703('0xb')]);MailInteractionEvents['emit'](_0x51bc4b+':'+_0x44cf24['id'],_0x44cf24);MailInteractionEvents['emit'](_0x51bc4b,_0x44cf24);_0x3da269(null);})[_0x9703('0xc')](_0x3da269(null));};}for(var e in events){if(events[_0x9703('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x9703('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 21ac0c1..9d6f4f4 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 _0x0439=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','closedAt','changed','YYYY-MM-DD\x20HH:mm:ss','closed','models','get','then','catch','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x2e4f29,_0x5dba24){var _0x3d0cb0=function(_0x4b5f9d){while(--_0x4b5f9d){_0x2e4f29['push'](_0x2e4f29['shift']());}};_0x3d0cb0(++_0x5dba24);}(_0x0439,0xdd));var _0x9043=function(_0x4ed649,_0x5f5c00){_0x4ed649=_0x4ed649-0x0;var _0x582bf3=_0x0439[_0x4ed649];return _0x582bf3;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var logger=require(_0x9043('0x2'))(_0x9043('0x3'));var moment=require(_0x9043('0x4'));var BPromise=require(_0x9043('0x5'));var rp=require(_0x9043('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9043('0x7'));var config=require(_0x9043('0x8'));var attributes=require(_0x9043('0x9'));module['exports']=function(_0x3a1c0e,_0x5ea31e){return _0x3a1c0e['define'](_0x9043('0xa'),attributes,{'tableName':_0x9043('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x9043('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x22c34e,_0x36a5cb,_0x5e106f){if(_0x22c34e[_0x9043('0xd')]){_0x22c34e[_0x9043('0xe')]=moment()[_0x9043('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x22c34e['closed']){_0x22c34e[_0x9043('0x10')]=moment()[_0x9043('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e106f(null,_0x36a5cb);},'beforeUpdate':function(_0x18fafb,_0x3887f8,_0x3d8d67){if(_0x18fafb[_0x9043('0x11')](_0x9043('0xd'))){_0x18fafb[_0x9043('0xe')]=_0x18fafb['substatus']?moment()[_0x9043('0xf')](_0x9043('0x12')):null;}if(_0x18fafb['changed'](_0x9043('0x13'))){_0x18fafb[_0x9043('0x10')]=moment()['format'](_0x9043('0x12'));_0x18fafb[_0x9043('0xd')]=null;_0x18fafb[_0x9043('0xe')]=null;}_0x3d8d67(null,_0x18fafb);},'afterUpdate':function(_0x2b3c2d,_0x1691e9,_0x2bd42e){var _0x13b613=_0x3a1c0e[_0x9043('0x14')];var _0x21f330=_0x2b3c2d[_0x9043('0x15')]({'plain':!![]});if(_0x21f330['closed']){return _0x13b613['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x21f330['id']}})[_0x9043('0x16')](function(){_0x2bd42e();})[_0x9043('0x17')](function(_0x35e70b){_0x2bd42e(_0x35e70b);});}else{_0x2bd42e();}}},'charset':_0x9043('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xacc5=['bluebird','request-promise','path','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x119d13,_0x263cd2){var _0x333c35=function(_0x422c6e){while(--_0x422c6e){_0x119d13['push'](_0x119d13['shift']());}};_0x333c35(++_0x263cd2);}(_0xacc5,0x104));var _0x5acc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xacc5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5acc('0x0'));var util=require(_0x5acc('0x1'));var logger=require(_0x5acc('0x2'))(_0x5acc('0x3'));var moment=require('moment');var BPromise=require(_0x5acc('0x4'));var rp=require(_0x5acc('0x5'));var fs=require('fs');var path=require(_0x5acc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x2af785,_0x5c25cb){return _0x2af785[_0x5acc('0x7')](_0x5acc('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5acc('0x9'),'fields':['subject','to'],'type':_0x5acc('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4badbd,_0x312a95,_0x30ccee){if(_0x4badbd[_0x5acc('0xb')]){_0x4badbd[_0x5acc('0xc')]=moment()[_0x5acc('0xd')](_0x5acc('0xe'));}if(_0x4badbd[_0x5acc('0xf')]){_0x4badbd[_0x5acc('0x10')]=moment()[_0x5acc('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x30ccee(null,_0x312a95);},'beforeUpdate':function(_0x4c7f2b,_0x8e02b5,_0x17beba){if(_0x4c7f2b[_0x5acc('0x11')]('substatus')){_0x4c7f2b[_0x5acc('0xc')]=_0x4c7f2b[_0x5acc('0xb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4c7f2b['changed']('closed')){_0x4c7f2b[_0x5acc('0x10')]=moment()['format'](_0x5acc('0xe'));_0x4c7f2b[_0x5acc('0xb')]=null;_0x4c7f2b[_0x5acc('0xc')]=null;}_0x17beba(null,_0x4c7f2b);},'afterUpdate':function(_0x289184,_0x28b4fb,_0x37433f){var _0x175d9f=_0x2af785['models'];var _0x1053aa=_0x289184['get']({'plain':!![]});if(_0x1053aa[_0x5acc('0xf')]){return _0x175d9f['MailMessage'][_0x5acc('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x1053aa['id']}})[_0x5acc('0x13')](function(){_0x37433f();})[_0x5acc('0x14')](function(_0x548019){_0x37433f(_0x548019);});}else{_0x37433f();}}},'charset':'utf8mb4','collate':_0x5acc('0x15')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a849af8..9af511c 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 _0x0506=['../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','debug','find','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x37bd0e,_0x3dcab0){var _0x3ae0b5=function(_0xca4eb1){while(--_0xca4eb1){_0x37bd0e['push'](_0x37bd0e['shift']());}};_0x3ae0b5(++_0x3dcab0);}(_0x0506,0x1d1));var _0x6050=function(_0x57353e,_0x2b60df){_0x57353e=_0x57353e-0x0;var _0x168fea=_0x0506[_0x57353e];return _0x168fea;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var moment=require(_0x6050('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(_0x6050('0x3'));var logger=require('../../config/logger')(_0x6050('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6050('0x5')][_0x6050('0x6')]({'port':0x232a});config[_0x6050('0x7')]=_[_0x6050('0x8')](config[_0x6050('0x7')],{'host':_0x6050('0x9'),'port':0x18eb});var socket=require(_0x6050('0xa'))(new Redis(config[_0x6050('0x7')]));require('./mailInteraction.socket')[_0x6050('0xb')](socket);function respondWithRpcPromise(_0x4f149a,_0x15ad99,_0x1b0140){return new BPromise(function(_0xd01ae7,_0x24f726){return client[_0x6050('0xc')](_0x4f149a,_0x1b0140)[_0x6050('0xd')](function(_0x105915){logger[_0x6050('0xe')](_0x6050('0xf'),_0x15ad99,_0x6050('0x10'));logger['debug'](_0x6050('0x11'),_0x15ad99,'request\x20sent',JSON[_0x6050('0x12')](_0x105915));if(_0x105915[_0x6050('0x13')]){if(_0x105915[_0x6050('0x13')][_0x6050('0x14')]===0x1f4){logger['error'](_0x6050('0xf'),_0x15ad99,_0x105915['error'][_0x6050('0x15')]);return _0x24f726(_0x105915[_0x6050('0x13')][_0x6050('0x15')]);}logger[_0x6050('0x13')](_0x6050('0xf'),_0x15ad99,_0x105915[_0x6050('0x13')][_0x6050('0x15')]);return _0xd01ae7(_0x105915[_0x6050('0x13')][_0x6050('0x15')]);}else{logger[_0x6050('0xe')](_0x6050('0xf'),_0x15ad99,_0x6050('0x10'));_0xd01ae7(_0x105915['result'][_0x6050('0x15')]);}})[_0x6050('0x16')](function(_0x44e65d){logger['error']('MailInteraction,\x20%s,\x20%s',_0x15ad99,_0x44e65d);_0x24f726(_0x44e65d);});});}exports['UpdateMailInteraction']=function(_0x521916){var _0x3c7c33=this;return new Promise(function(_0x259e5f,_0x4c0270){return db[_0x6050('0x17')][_0x6050('0x18')](_0x521916[_0x6050('0x19')],{'raw':_0x521916[_0x6050('0x1a')]?_0x521916[_0x6050('0x1a')][_0x6050('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521916['options']?_0x521916[_0x6050('0x1a')][_0x6050('0x1c')]||null:null,'attributes':_0x521916[_0x6050('0x1a')]?_0x521916[_0x6050('0x1a')][_0x6050('0x1d')]||null:null,'limit':_0x521916[_0x6050('0x1a')]?_0x521916[_0x6050('0x1a')][_0x6050('0x1e')]||null:null})['then'](function(_0x453869){logger['info'](_0x6050('0x1f'),_0x521916);logger[_0x6050('0x20')](_0x6050('0x1f'),_0x521916,JSON[_0x6050('0x12')](_0x453869));_0x259e5f(_0x453869);})[_0x6050('0x16')](function(_0x45ba65){logger['error'](_0x6050('0x1f'),_0x45ba65[_0x6050('0x15')],_0x521916);_0x4c0270(_0x3c7c33[_0x6050('0x13')](0x1f4,_0x45ba65[_0x6050('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x1527ea){return new Promise(function(_0xaf9ebe,_0x1698fa){return db[_0x6050('0x17')][_0x6050('0x21')]({'where':_0x1527ea[_0x6050('0x1a')]?_0x1527ea[_0x6050('0x1a')]['where']||null:null})[_0x6050('0xd')](function(_0x2c9c0e){if(_0x2c9c0e){return _0x2c9c0e[_0x6050('0x22')](_0x1527ea[_0x6050('0x19')][_0x6050('0x23')],_[_0x6050('0x24')](_0x1527ea[_0x6050('0x19')],[_0x6050('0x23'),'id'])||{});}})[_0x6050('0x25')](function(_0x484fe1){logger[_0x6050('0xe')]('AddTags',_0x1527ea);logger['debug'](_0x6050('0x26'),_0x1527ea,JSON[_0x6050('0x12')](_0x484fe1));_0xaf9ebe(_0x484fe1);})[_0x6050('0x16')](function(_0x536f51){logger[_0x6050('0x13')]('AddTags',_0x536f51['message'],_0x1527ea);_0x1698fa(_this[_0x6050('0x13')](0x1f4,_0x536f51[_0x6050('0x15')]));});});}; \ No newline at end of file +var _0x2e31=['catch','body','options','raw','where','attributes','limit','UpdateMailInteraction','MailInteraction','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2e31,0x145));var _0x12e3=function(_0x163b06,_0x1c742a){_0x163b06=_0x163b06-0x0;var _0x27382c=_0x2e31[_0x163b06];return _0x27382c;};'use strict';var _=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var moment=require(_0x12e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e3('0x3'));var fs=require('fs');var Redis=require(_0x12e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12e3('0x5'))(_0x12e3('0x6'));var config=require(_0x12e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12e3('0x8')][_0x12e3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x12e3('0xa')],{'host':_0x12e3('0xb'),'port':0x18eb});var socket=require(_0x12e3('0xc'))(new Redis(config[_0x12e3('0xa')]));require('./mailInteraction.socket')[_0x12e3('0xd')](socket);function respondWithRpcPromise(_0x3ec880,_0x40bf58,_0x5208d6){return new BPromise(function(_0x5901b3,_0x3e7283){return client[_0x12e3('0xe')](_0x3ec880,_0x5208d6)[_0x12e3('0xf')](function(_0x3d6c3c){logger[_0x12e3('0x10')](_0x12e3('0x11'),_0x40bf58,_0x12e3('0x12'));logger[_0x12e3('0x13')](_0x12e3('0x14'),_0x40bf58,_0x12e3('0x12'),JSON[_0x12e3('0x15')](_0x3d6c3c));if(_0x3d6c3c[_0x12e3('0x16')]){if(_0x3d6c3c['error'][_0x12e3('0x17')]===0x1f4){logger[_0x12e3('0x16')](_0x12e3('0x11'),_0x40bf58,_0x3d6c3c['error'][_0x12e3('0x18')]);return _0x3e7283(_0x3d6c3c[_0x12e3('0x16')]['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x40bf58,_0x3d6c3c[_0x12e3('0x16')]['message']);return _0x5901b3(_0x3d6c3c[_0x12e3('0x16')][_0x12e3('0x18')]);}else{logger[_0x12e3('0x10')](_0x12e3('0x11'),_0x40bf58,_0x12e3('0x12'));_0x5901b3(_0x3d6c3c[_0x12e3('0x19')]['message']);}})[_0x12e3('0x1a')](function(_0x199e1d){logger['error']('MailInteraction,\x20%s,\x20%s',_0x40bf58,_0x199e1d);_0x3e7283(_0x199e1d);});});}exports['UpdateMailInteraction']=function(_0x2e5f1a){var _0x577b74=this;return new Promise(function(_0x3db972,_0x2ddfbf){return db['MailInteraction']['update'](_0x2e5f1a[_0x12e3('0x1b')],{'raw':_0x2e5f1a[_0x12e3('0x1c')]?_0x2e5f1a[_0x12e3('0x1c')][_0x12e3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e5f1a['options']?_0x2e5f1a['options'][_0x12e3('0x1e')]||null:null,'attributes':_0x2e5f1a[_0x12e3('0x1c')]?_0x2e5f1a[_0x12e3('0x1c')][_0x12e3('0x1f')]||null:null,'limit':_0x2e5f1a[_0x12e3('0x1c')]?_0x2e5f1a['options'][_0x12e3('0x20')]||null:null})[_0x12e3('0xf')](function(_0xd04cbc){logger[_0x12e3('0x10')](_0x12e3('0x21'),_0x2e5f1a);logger[_0x12e3('0x13')]('UpdateMailInteraction',_0x2e5f1a,JSON[_0x12e3('0x15')](_0xd04cbc));_0x3db972(_0xd04cbc);})[_0x12e3('0x1a')](function(_0x4213db){logger[_0x12e3('0x16')]('UpdateMailInteraction',_0x4213db[_0x12e3('0x18')],_0x2e5f1a);_0x2ddfbf(_0x577b74[_0x12e3('0x16')](0x1f4,_0x4213db[_0x12e3('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x25f4c7){return new Promise(function(_0x2f9a7d,_0x329d32){return db[_0x12e3('0x22')]['find']({'where':_0x25f4c7[_0x12e3('0x1c')]?_0x25f4c7[_0x12e3('0x1c')][_0x12e3('0x1e')]||null:null})['then'](function(_0x1ff722){if(_0x1ff722){return _0x1ff722['addTags'](_0x25f4c7[_0x12e3('0x1b')][_0x12e3('0x23')],_[_0x12e3('0x24')](_0x25f4c7[_0x12e3('0x1b')],[_0x12e3('0x23'),'id'])||{});}})[_0x12e3('0x25')](function(_0x58355e){logger[_0x12e3('0x10')](_0x12e3('0x26'),_0x25f4c7);logger['debug'](_0x12e3('0x26'),_0x25f4c7,JSON[_0x12e3('0x15')](_0x58355e));_0x2f9a7d(_0x58355e);})['catch'](function(_0x3012c9){logger[_0x12e3('0x16')]('AddTags',_0x3012c9[_0x12e3('0x18')],_0x25f4c7);_0x329d32(_this[_0x12e3('0x16')](0x1f4,_0x3012c9[_0x12e3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a43494c..7ea4a4d 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 _0x5e76=['./mailInteraction.events','save','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x5534b7,_0xbe6ba4){var _0x34af05=function(_0x2f8d94){while(--_0x2f8d94){_0x5534b7['push'](_0x5534b7['shift']());}};_0x34af05(++_0xbe6ba4);}(_0x5e76,0x14d));var _0x65e7=function(_0x21a135,_0x226f30){_0x21a135=_0x21a135-0x0;var _0x3c13e0=_0x5e76[_0x21a135];return _0x3c13e0;};'use strict';var MailInteractionEvents=require(_0x65e7('0x0'));var events=[_0x65e7('0x1'),_0x65e7('0x2'),_0x65e7('0x3')];function createListener(_0xc1f478,_0x6e1a1e){return function(_0xccbbb0){_0x6e1a1e[_0x65e7('0x4')](_0xc1f478,_0xccbbb0);};}function removeListener(_0x44699b,_0x1e14c5){return function(){MailInteractionEvents[_0x65e7('0x5')](_0x44699b,_0x1e14c5);};}exports[_0x65e7('0x6')]=function(_0x2c24c9){for(var _0x5d64b2=0x0,_0x3497ce=events[_0x65e7('0x7')];_0x5d64b2<_0x3497ce;_0x5d64b2++){var _0x28df33=events[_0x5d64b2];var _0xf42929=createListener(_0x65e7('0x8')+_0x28df33,_0x2c24c9);MailInteractionEvents['on'](_0x28df33,_0xf42929);}}; \ No newline at end of file +var _0x0871=['./mailInteraction.events','save','remove','update','emit','removeListener','register','mailInteraction:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0871,0x88));var _0x1087=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x0871[_0x44a64f];return _0x52024b;};'use strict';var MailInteractionEvents=require(_0x1087('0x0'));var events=[_0x1087('0x1'),_0x1087('0x2'),_0x1087('0x3')];function createListener(_0xf04a9b,_0x5938a6){return function(_0x4f88fa){_0x5938a6[_0x1087('0x4')](_0xf04a9b,_0x4f88fa);};}function removeListener(_0x3d2d6e,_0x16436d){return function(){MailInteractionEvents[_0x1087('0x5')](_0x3d2d6e,_0x16436d);};}exports[_0x1087('0x6')]=function(_0x5db29d){for(var _0x5eb665=0x0,_0x5e3ade=events['length'];_0x5eb665<_0x5e3ade;_0x5eb665++){var _0x553894=events[_0x5eb665];var _0x4212bd=createListener(_0x1087('0x7')+_0x553894,_0x5db29d);MailInteractionEvents['on'](_0x553894,_0x4212bd);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a783e29..105dfc3 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 _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(_0x4f4fe1,_0x1fd810){var _0x299347=function(_0x420215){while(--_0x420215){_0x4f4fe1['push'](_0x4f4fe1['shift']());}};_0x299347(++_0x1fd810);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d9f41,_0x4f30c0){_0x3d9f41=_0x3d9f41-0x0;var _0x10344e=_0xa41a[_0x3d9f41];return _0x10344e;};'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 +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53d986,_0x2fa7da){_0x53d986=_0x53d986-0x0;var _0xfb297=_0x8ef6[_0x53d986];return _0xfb297;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),interaction[_0x68ef('0x12')](_0x68ef('0x13'),_0x68ef('0x14')),controller['create']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fd05cdd..c2edef2 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 _0xcfa5=['STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x2787bd,_0x36d7d4){var _0x3b94a2=function(_0x3f5718){while(--_0x3f5718){_0x2787bd['push'](_0x2787bd['shift']());}};_0x3b94a2(++_0x36d7d4);}(_0xcfa5,0x1e6));var _0x5cfa=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcfa5[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5cfa('0x0'));var _=require(_0x5cfa('0x1'));module[_0x5cfa('0x2')]={'body':{'type':Sequelize[_0x5cfa('0x3')](_0x5cfa('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5cfa('0x3')]('medium')},'read':{'type':Sequelize[_0x5cfa('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5cfa('0x6')]('in',_0x5cfa('0x7')),'defaultValue':_0x5cfa('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5cfa('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5cfa('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize['TEXT'](_0x5cfa('0x4'))},'bcc':{'type':Sequelize[_0x5cfa('0x3')](_0x5cfa('0x4'))},'subject':{'type':Sequelize[_0x5cfa('0x3')]},'sentAt':{'type':Sequelize[_0x5cfa('0x9')]},'attach':{'type':Sequelize[_0x5cfa('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5cfa('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5cfa('0x9')]},'originTo':{'type':Sequelize[_0x5cfa('0x3')](_0x5cfa('0x4'))},'originCc':{'type':Sequelize[_0x5cfa('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x5cfa('0xb'),_0x5cfa('0xc')),'defaultValue':_0x5cfa('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x032c=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize','lodash'];(function(_0x27bd84,_0x4b5a05){var _0x4f3a07=function(_0x27b73a){while(--_0x27b73a){_0x27bd84['push'](_0x27bd84['shift']());}};_0x4f3a07(++_0x4b5a05);}(_0x032c,0x1da));var _0xc032=function(_0x23b1fd,_0x347756){_0x23b1fd=_0x23b1fd-0x0;var _0x2bac5d=_0x032c[_0x23b1fd];return _0x2bac5d;};'use strict';var Sequelize=require(_0xc032('0x0'));var _=require(_0xc032('0x1'));module[_0xc032('0x2')]={'body':{'type':Sequelize[_0xc032('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc032('0x3')](_0xc032('0x4'))},'read':{'type':Sequelize[_0xc032('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc032('0x6')]('in',_0xc032('0x7')),'defaultValue':_0xc032('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xc032('0x8')]},'to':{'type':Sequelize[_0xc032('0x3')](_0xc032('0x9'))},'cc':{'type':Sequelize[_0xc032('0x3')](_0xc032('0x9'))},'bcc':{'type':Sequelize['TEXT'](_0xc032('0x9'))},'subject':{'type':Sequelize[_0xc032('0x3')]},'sentAt':{'type':Sequelize[_0xc032('0xa')]},'attach':{'type':Sequelize[_0xc032('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc032('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc032('0xa')]},'originTo':{'type':Sequelize[_0xc032('0x3')](_0xc032('0x9'))},'originCc':{'type':Sequelize[_0xc032('0x3')](_0xc032('0x9'))},'originChannel':{'type':Sequelize[_0xc032('0x6')](_0xc032('0xc'),_0xc032('0xd')),'defaultValue':_0xc032('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f79b0a0..3a99b9b 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d62d0,_0x5b5aa8){var _0x15024e=function(_0xa180d5){while(--_0xa180d5){_0x2d62d0['push'](_0x2d62d0['shift']());}};_0x15024e(++_0x5b5aa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x499158,_0x38e534){var _0x23a78f=function(_0x370519){while(--_0x370519){_0x499158['push'](_0x499158['shift']());}};_0x23a78f(++_0x38e534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b3fdff0..88d7764 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 _0x89a7=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x5c67e2,_0xc6b5cf){var _0xfa30e5=function(_0x2de7b2){while(--_0x2de7b2){_0x5c67e2['push'](_0x5c67e2['shift']());}};_0xfa30e5(++_0xc6b5cf);}(_0x89a7,0xcd));var _0x789a=function(_0x17134f,_0x1c26dc){_0x17134f=_0x17134f-0x0;var _0x2abcc4=_0x89a7[_0x17134f];return _0x2abcc4;};'use strict';var EventEmitter=require(_0x789a('0x0'));var MailMessage=require(_0x789a('0x1'))['db'][_0x789a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x789a('0x3')](0x0);var events={'afterCreate':_0x789a('0x4'),'afterUpdate':_0x789a('0x5'),'afterDestroy':_0x789a('0x6')};function emitEvent(_0x8392a6){return function(_0x5c55f3,_0x3f5bc4,_0x18cd4e){MailMessageEvents[_0x789a('0x7')](_0x8392a6+':'+_0x5c55f3['id'],_0x5c55f3);MailMessageEvents[_0x789a('0x7')](_0x8392a6,_0x5c55f3);_0x18cd4e(null);};}for(var e in events){if(events[_0x789a('0x8')](e)){var event=events[e];MailMessage[_0x789a('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xf659=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xf659,0xd3));var _0x9f65=function(_0x2145e9,_0x425ad9){_0x2145e9=_0x2145e9-0x0;var _0x383b77=_0xf659[_0x2145e9];return _0x383b77;};'use strict';var EventEmitter=require(_0x9f65('0x0'));var MailMessage=require(_0x9f65('0x1'))['db'][_0x9f65('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9f65('0x3')](0x0);var events={'afterCreate':_0x9f65('0x4'),'afterUpdate':_0x9f65('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4719ef){return function(_0xc99069,_0x5e82fd,_0x292300){MailMessageEvents[_0x9f65('0x6')](_0x4719ef+':'+_0xc99069['id'],_0xc99069);MailMessageEvents['emit'](_0x4719ef,_0xc99069);_0x292300(null);};}for(var e in events){if(events[_0x9f65('0x7')](e)){var event=events[e];MailMessage[_0x9f65('0x8')](e,emitEvent(event));}}module[_0x9f65('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6067982..7259cce 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 _0x8779=['plainBody','fromString','models','get','toLowerCase','out','secret','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','subject','FULLTEXT','body'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8779,0x1c3));var _0x9877=function(_0x41fca4,_0x3d642e){_0x41fca4=_0x41fca4-0x0;var _0x1e228f=_0x8779[_0x41fca4];return _0x1e228f;};'use strict';var _=require(_0x9877('0x0'));var util=require('util');var logger=require(_0x9877('0x1'))(_0x9877('0x2'));var moment=require('moment');var BPromise=require(_0x9877('0x3'));var rp=require(_0x9877('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9877('0x5'));var attributes=require(_0x9877('0x6'));module[_0x9877('0x7')]=function(_0x42fbc1,_0x2aee60){return _0x42fbc1['define'](_0x9877('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x9877('0x9'),'fields':[_0x9877('0x9')]},{'name':_0x9877('0xa'),'fields':['plainBody',_0x9877('0xb')],'type':_0x9877('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x201471,_0x13472c,_0x227469){if(_0x201471[_0x9877('0xd')]){_0x201471[_0x9877('0xe')]=htmlToText[_0x9877('0xf')](_0x201471[_0x9877('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x227469(null,_0x13472c);},'afterCreate':function(_0x480106,_0xd6dc5,_0x1182bf){var _0x2a2156=_0x42fbc1[_0x9877('0x10')];var _0x57b5fe=_0x480106[_0x9877('0x11')]({'plain':!![]});if(_0x57b5fe['direction'][_0x9877('0x12')]()==='in'||_0x57b5fe['direction'][_0x9877('0x12')]()===_0x9877('0x13')&&!_0x57b5fe[_0x9877('0x14')]&&!_['isNil'](_0x57b5fe['UserId'])){_0x2a2156[_0x9877('0x15')][_0x9877('0x16')]({'where':{'id':_0x57b5fe[_0x9877('0x17')]}})[_0x9877('0x18')](function(_0x286d96){if(_0x286d96){_0x286d96[_0x9877('0x19')]({'lastMsgAt':_0x57b5fe[_0x9877('0x1a')],'lastMsgDirection':_0x57b5fe['direction']['toLowerCase']()});}})[_0x9877('0x1b')](function(_0x5ca1fa){console[_0x9877('0x1c')](_0x5ca1fa);});}_0x1182bf();}},'charset':_0x9877('0x1d'),'collate':_0x9877('0x1e')});}; \ No newline at end of file +var _0xcaf0=['FULLTEXT','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','html-to-text','rimraf','../../config/environment','define','mail_messages','messageId','fti_mail_messages','plainBody','subject'];(function(_0x564312,_0x30f17f){var _0x1b0a5c=function(_0x4314b9){while(--_0x4314b9){_0x564312['push'](_0x564312['shift']());}};_0x1b0a5c(++_0x30f17f);}(_0xcaf0,0xf9));var _0x0caf=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0xcaf0[_0x454f02];return _0x3369f7;};'use strict';var _=require(_0x0caf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0caf('0x1'));var rp=require(_0x0caf('0x2'));var htmlToText=require(_0x0caf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0caf('0x4'));var config=require(_0x0caf('0x5'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x189b06,_0xc70d24){return _0x189b06[_0x0caf('0x6')]('MailMessage',attributes,{'tableName':_0x0caf('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0caf('0x8')]},{'name':_0x0caf('0x9'),'fields':[_0x0caf('0xa'),_0x0caf('0xb')],'type':_0x0caf('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x143880,_0x14fc3c,_0x453b8c){if(_0x143880['body']){_0x143880[_0x0caf('0xa')]=htmlToText[_0x0caf('0xd')](_0x143880['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x453b8c(null,_0x14fc3c);},'afterCreate':function(_0x128159,_0x24c5f1,_0x498f69){var _0x1e3ead=_0x189b06[_0x0caf('0xe')];var _0x509e84=_0x128159[_0x0caf('0xf')]({'plain':!![]});if(_0x509e84[_0x0caf('0x10')][_0x0caf('0x11')]()==='in'||_0x509e84['direction'][_0x0caf('0x11')]()===_0x0caf('0x12')&&!_0x509e84[_0x0caf('0x13')]&&!_[_0x0caf('0x14')](_0x509e84[_0x0caf('0x15')])){_0x1e3ead[_0x0caf('0x16')][_0x0caf('0x17')]({'where':{'id':_0x509e84[_0x0caf('0x18')]}})['then'](function(_0x548d07){if(_0x548d07){_0x548d07[_0x0caf('0x19')]({'lastMsgAt':_0x509e84['createdAt'],'lastMsgDirection':_0x509e84[_0x0caf('0x10')]['toLowerCase']()});}})['catch'](function(_0x34d36e){console[_0x0caf('0x1a')](_0x34d36e);});}_0x498f69();}},'charset':_0x0caf('0x1b'),'collate':_0x0caf('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a416f27..63e745e 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 _0x61b8=['defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','create','options','CreateMailMessage','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x2b2616,_0x4c5875){var _0x4ea136=function(_0x129914){while(--_0x129914){_0x2b2616['push'](_0x2b2616['shift']());}};_0x4ea136(++_0x4c5875);}(_0x61b8,0x169));var _0x861b=function(_0x12b0ef,_0x4deffb){_0x12b0ef=_0x12b0ef-0x0;var _0x113f35=_0x61b8[_0x12b0ef];return _0x113f35;};'use strict';var _=require(_0x861b('0x0'));var util=require(_0x861b('0x1'));var moment=require(_0x861b('0x2'));var BPromise=require('bluebird');var rs=require(_0x861b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x861b('0x4'));var logger=require(_0x861b('0x5'))(_0x861b('0x6'));var config=require('../../config/environment');var jayson=require(_0x861b('0x7'));var client=jayson[_0x861b('0x8')][_0x861b('0x9')]({'port':0x232a});config[_0x861b('0xa')]=_[_0x861b('0xb')](config[_0x861b('0xa')],{'host':_0x861b('0xc'),'port':0x18eb});var socket=require(_0x861b('0xd'))(new Redis(config[_0x861b('0xa')]));require(_0x861b('0xe'))[_0x861b('0xf')](socket);function respondWithRpcPromise(_0x5c6fc1,_0xdc4df8,_0x23a689){return new BPromise(function(_0x45b90f,_0x4f53d8){return client[_0x861b('0x10')](_0x5c6fc1,_0x23a689)['then'](function(_0x3450f6){logger[_0x861b('0x11')]('MailMessage,\x20%s,\x20%s',_0xdc4df8,_0x861b('0x12'));logger[_0x861b('0x13')](_0x861b('0x14'),_0xdc4df8,_0x861b('0x12'),JSON[_0x861b('0x15')](_0x3450f6));if(_0x3450f6[_0x861b('0x16')]){if(_0x3450f6[_0x861b('0x16')][_0x861b('0x17')]===0x1f4){logger[_0x861b('0x16')](_0x861b('0x18'),_0xdc4df8,_0x3450f6[_0x861b('0x16')][_0x861b('0x19')]);return _0x4f53d8(_0x3450f6[_0x861b('0x16')][_0x861b('0x19')]);}logger[_0x861b('0x16')](_0x861b('0x18'),_0xdc4df8,_0x3450f6['error'][_0x861b('0x19')]);return _0x45b90f(_0x3450f6['error']['message']);}else{logger[_0x861b('0x11')]('MailMessage,\x20%s,\x20%s',_0xdc4df8,_0x861b('0x12'));_0x45b90f(_0x3450f6[_0x861b('0x1a')]['message']);}})[_0x861b('0x1b')](function(_0x276493){logger[_0x861b('0x16')](_0x861b('0x18'),_0xdc4df8,_0x276493);_0x4f53d8(_0x276493);});});}exports['CreateMailMessage']=function(_0x55d21b){var _0x156d25=this;return new Promise(function(_0x426a99,_0x20422f){return db['MailMessage'][_0x861b('0x1c')](_0x55d21b['body'],{'raw':_0x55d21b[_0x861b('0x1d')]?_0x55d21b[_0x861b('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x474f49){logger[_0x861b('0x11')]('CreateMailMessage',_0x55d21b);logger['debug'](_0x861b('0x1e'),_0x55d21b,JSON['stringify'](_0x474f49));_0x426a99(_0x474f49);})['catch'](function(_0x26c7b9){logger['error']('CreateMailMessage',_0x26c7b9[_0x861b('0x19')],_0x55d21b);_0x20422f(_0x156d25[_0x861b('0x16')](0x1f4,_0x26c7b9[_0x861b('0x19')]));});});}; \ No newline at end of file +var _0x4ff6=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage','create','body','options','raw','CreateMailMessage','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info'];(function(_0x15b527,_0x56105e){var _0x2e8b46=function(_0x45d54b){while(--_0x45d54b){_0x15b527['push'](_0x15b527['shift']());}};_0x2e8b46(++_0x56105e);}(_0x4ff6,0xd5));var _0x64ff=function(_0x5829e3,_0x491d8c){_0x5829e3=_0x5829e3-0x0;var _0x507841=_0x4ff6[_0x5829e3];return _0x507841;};'use strict';var _=require('lodash');var util=require(_0x64ff('0x0'));var moment=require(_0x64ff('0x1'));var BPromise=require(_0x64ff('0x2'));var rs=require(_0x64ff('0x3'));var fs=require('fs');var Redis=require(_0x64ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64ff('0x5'));var logger=require(_0x64ff('0x6'))(_0x64ff('0x7'));var config=require(_0x64ff('0x8'));var jayson=require(_0x64ff('0x9'));var client=jayson[_0x64ff('0xa')][_0x64ff('0xb')]({'port':0x232a});config[_0x64ff('0xc')]=_[_0x64ff('0xd')](config[_0x64ff('0xc')],{'host':_0x64ff('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64ff('0xc')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0xcbad84,_0x17a616,_0x201e84){return new BPromise(function(_0x2b8cde,_0x41405b){return client[_0x64ff('0xf')](_0xcbad84,_0x201e84)[_0x64ff('0x10')](function(_0x95b3a3){logger[_0x64ff('0x11')](_0x64ff('0x12'),_0x17a616,_0x64ff('0x13'));logger[_0x64ff('0x14')](_0x64ff('0x15'),_0x17a616,_0x64ff('0x13'),JSON[_0x64ff('0x16')](_0x95b3a3));if(_0x95b3a3['error']){if(_0x95b3a3[_0x64ff('0x17')][_0x64ff('0x18')]===0x1f4){logger[_0x64ff('0x17')]('MailMessage,\x20%s,\x20%s',_0x17a616,_0x95b3a3['error'][_0x64ff('0x19')]);return _0x41405b(_0x95b3a3['error'][_0x64ff('0x19')]);}logger[_0x64ff('0x17')](_0x64ff('0x12'),_0x17a616,_0x95b3a3[_0x64ff('0x17')][_0x64ff('0x19')]);return _0x2b8cde(_0x95b3a3['error'][_0x64ff('0x19')]);}else{logger['info'](_0x64ff('0x12'),_0x17a616,_0x64ff('0x13'));_0x2b8cde(_0x95b3a3['result'][_0x64ff('0x19')]);}})['catch'](function(_0x10df94){logger[_0x64ff('0x17')]('MailMessage,\x20%s,\x20%s',_0x17a616,_0x10df94);_0x41405b(_0x10df94);});});}exports['CreateMailMessage']=function(_0x4fc266){var _0x2c2384=this;return new Promise(function(_0x12b99e,_0x454ec8){return db[_0x64ff('0x1a')][_0x64ff('0x1b')](_0x4fc266[_0x64ff('0x1c')],{'raw':_0x4fc266[_0x64ff('0x1d')]?_0x4fc266[_0x64ff('0x1d')][_0x64ff('0x1e')]===undefined?!![]:![]:!![]})[_0x64ff('0x10')](function(_0x229efe){logger[_0x64ff('0x11')](_0x64ff('0x1f'),_0x4fc266);logger['debug'](_0x64ff('0x1f'),_0x4fc266,JSON[_0x64ff('0x16')](_0x229efe));_0x12b99e(_0x229efe);})[_0x64ff('0x20')](function(_0x2fc1f1){logger['error'](_0x64ff('0x1f'),_0x2fc1f1[_0x64ff('0x19')],_0x4fc266);_0x454ec8(_0x2c2384['error'](0x1f4,_0x2fc1f1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ecdc50e..79064f2 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 _0xe20e=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x1865e4,_0x40f3c8){var _0x2d38ec=function(_0x147720){while(--_0x147720){_0x1865e4['push'](_0x1865e4['shift']());}};_0x2d38ec(++_0x40f3c8);}(_0xe20e,0x195));var _0xee20=function(_0xcf098d,_0x1b9e69){_0xcf098d=_0xcf098d-0x0;var _0x99daff=_0xe20e[_0xcf098d];return _0x99daff;};'use strict';var MailMessageEvents=require(_0xee20('0x0'));var events=[_0xee20('0x1'),'remove',_0xee20('0x2')];function createListener(_0x2a306d,_0x594545){return function(_0x4b68d1){_0x594545[_0xee20('0x3')](_0x2a306d,_0x4b68d1);};}function removeListener(_0x56bfdc,_0x111719){return function(){MailMessageEvents[_0xee20('0x4')](_0x56bfdc,_0x111719);};}exports[_0xee20('0x5')]=function(_0x411721){for(var _0x3ca08d=0x0,_0xd8d1e=events[_0xee20('0x6')];_0x3ca08d<_0xd8d1e;_0x3ca08d++){var _0x15f380=events[_0x3ca08d];var _0x34f82d=createListener(_0xee20('0x7')+_0x15f380,_0x411721);MailMessageEvents['on'](_0x15f380,_0x34f82d);}}; \ No newline at end of file +var _0xa2ab=['save','remove','emit','removeListener','mailMessage:','./mailMessage.events'];(function(_0x162b16,_0x238fbd){var _0x3bc0a0=function(_0x138709){while(--_0x138709){_0x162b16['push'](_0x162b16['shift']());}};_0x3bc0a0(++_0x238fbd);}(_0xa2ab,0xa7));var _0xba2a=function(_0x45a263,_0x2c0be7){_0x45a263=_0x45a263-0x0;var _0x337fe2=_0xa2ab[_0x45a263];return _0x337fe2;};'use strict';var MailMessageEvents=require(_0xba2a('0x0'));var events=[_0xba2a('0x1'),_0xba2a('0x2'),'update'];function createListener(_0x297229,_0x385aac){return function(_0x3c1bf2){_0x385aac[_0xba2a('0x3')](_0x297229,_0x3c1bf2);};}function removeListener(_0x24423b,_0x1b27f8){return function(){MailMessageEvents[_0xba2a('0x4')](_0x24423b,_0x1b27f8);};}exports['register']=function(_0x12f994){for(var _0x42e864=0x0,_0x3eb9f9=events['length'];_0x42e864<_0x3eb9f9;_0x42e864++){var _0xd09a60=events[_0x42e864];var _0xf818d1=createListener(_0xba2a('0x5')+_0xd09a60,_0x12f994);MailMessageEvents['on'](_0xd09a60,_0xf818d1);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0004c1a..af4f151 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 _0xc153=['getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0xc153,0x1a3));var _0x3c15=function(_0x4df97b,_0x4276c8){_0x4df97b=_0x4df97b-0x0;var _0xfbc902=_0xc153[_0x4df97b];return _0xfbc902;};'use strict';var multer=require('multer');var util=require(_0x3c15('0x0'));var path=require('path');var timeout=require(_0x3c15('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x3c15('0x2'));var interaction=require(_0x3c15('0x3'));var config=require(_0x3c15('0x4'));var controller=require('./mailQueue.controller');router[_0x3c15('0x5')]('/',auth[_0x3c15('0x6')](),controller[_0x3c15('0x7')]);router[_0x3c15('0x5')]('/describe',auth[_0x3c15('0x6')](),controller[_0x3c15('0x8')]);router[_0x3c15('0x5')](_0x3c15('0x9'),auth[_0x3c15('0x6')](),controller[_0x3c15('0xa')]);router[_0x3c15('0x5')]('/:id/members',auth[_0x3c15('0x6')](),controller[_0x3c15('0xb')]);router[_0x3c15('0x5')](_0x3c15('0xc'),auth['isAuthenticated'](),controller[_0x3c15('0xd')]);router[_0x3c15('0x5')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x3c15('0xe')]('/',auth[_0x3c15('0x6')](),controller[_0x3c15('0xf')]);router[_0x3c15('0xe')](_0x3c15('0xc'),auth['isAuthenticated'](),controller[_0x3c15('0x10')]);router[_0x3c15('0xe')](_0x3c15('0x11'),auth['isAuthenticated'](),controller[_0x3c15('0x12')]);router[_0x3c15('0x13')]('/:id',auth[_0x3c15('0x6')](),controller[_0x3c15('0x14')]);router[_0x3c15('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3c15('0x15')](_0x3c15('0xc'),auth[_0x3c15('0x6')](),controller['removeTeams']);router[_0x3c15('0x15')](_0x3c15('0x11'),auth['isAuthenticated'](),controller[_0x3c15('0x16')]);module[_0x3c15('0x17')]=router; \ No newline at end of file +var _0xb21f=['removeAgents','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0xb21f,0xcd));var _0xfb21=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xb21f[_0x10291b];return _0x1d5fbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb21('0x0'));var timeout=require(_0xfb21('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xfb21('0x2'));var interaction=require(_0xfb21('0x3'));var config=require(_0xfb21('0x4'));var controller=require(_0xfb21('0x5'));router[_0xfb21('0x6')]('/',auth[_0xfb21('0x7')](),controller[_0xfb21('0x8')]);router[_0xfb21('0x6')](_0xfb21('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xfb21('0x6')](_0xfb21('0xa'),auth[_0xfb21('0x7')](),controller[_0xfb21('0xb')]);router[_0xfb21('0x6')](_0xfb21('0xc'),auth[_0xfb21('0x7')](),controller[_0xfb21('0xd')]);router[_0xfb21('0x6')](_0xfb21('0xe'),auth[_0xfb21('0x7')](),controller[_0xfb21('0xf')]);router[_0xfb21('0x6')](_0xfb21('0x10'),auth[_0xfb21('0x7')](),controller[_0xfb21('0x11')]);router['post']('/',auth[_0xfb21('0x7')](),controller[_0xfb21('0x12')]);router[_0xfb21('0x13')](_0xfb21('0xe'),auth['isAuthenticated'](),controller[_0xfb21('0x14')]);router[_0xfb21('0x13')](_0xfb21('0x10'),auth[_0xfb21('0x7')](),controller[_0xfb21('0x15')]);router[_0xfb21('0x16')](_0xfb21('0xa'),auth[_0xfb21('0x7')](),controller[_0xfb21('0x17')]);router[_0xfb21('0x18')](_0xfb21('0xa'),auth['isAuthenticated'](),controller[_0xfb21('0x19')]);router[_0xfb21('0x18')]('/:id/teams',auth[_0xfb21('0x7')](),controller[_0xfb21('0x1a')]);router[_0xfb21('0x18')]('/:id/users',auth[_0xfb21('0x7')](),controller[_0xfb21('0x1b')]);module[_0xfb21('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9098635..5778c12 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 _0xcbe2=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x24e85d,_0x397b80){var _0x423f4f=function(_0x1b3ba3){while(--_0x1b3ba3){_0x24e85d['push'](_0x24e85d['shift']());}};_0x423f4f(++_0x397b80);}(_0xcbe2,0x148));var _0x2cbe=function(_0x265756,_0x298c09){_0x265756=_0x265756-0x0;var _0x4efaa5=_0xcbe2[_0x265756];return _0x4efaa5;};'use strict';var Sequelize=require(_0x2cbe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2cbe('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2cbe('0x2')]},'timeout':{'type':Sequelize[_0x2cbe('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2cbe('0x4')]('rrmemory',_0x2cbe('0x5'),_0x2cbe('0x6'))}}; \ No newline at end of file +var _0x803c=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x803c,0x65));var _0xc803=function(_0x149e30,_0x2232be){_0x149e30=_0x149e30-0x0;var _0x3c71c0=_0x803c[_0x149e30];return _0x3c71c0;};'use strict';var Sequelize=require(_0xc803('0x0'));module[_0xc803('0x1')]={'name':{'type':Sequelize[_0xc803('0x2')],'unique':_0xc803('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc803('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc803('0x5')](_0xc803('0x6'),'beepall',_0xc803('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a8c35d1..9b1de01 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 _0x4dd2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','status','count','offset','limit','json','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','MailQueue','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','body','describe','getMembers','findOne','UserMailQueue','rawAttributes','nolimit','User','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','forEach','emit','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x27091c,_0x309348){var _0x3ad65a=function(_0x2be2ba){while(--_0x2be2ba){_0x27091c['push'](_0x27091c['shift']());}};_0x3ad65a(++_0x309348);}(_0x4dd2,0xf1));var _0x24dd=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0x4dd2[_0x13945b];return _0x1b1643;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x24dd('0x0'));var rimraf=require(_0x24dd('0x1'));var zipdir=require(_0x24dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24dd('0x3'));var moment=require('moment');var BPromise=require(_0x24dd('0x4'));var Mustache=require('mustache');var util=require(_0x24dd('0x5'));var path=require(_0x24dd('0x6'));var sox=require(_0x24dd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x24dd('0x8'));var squel=require(_0x24dd('0x9'));var crypto=require(_0x24dd('0xa'));var jsforce=require(_0x24dd('0xb'));var deskjs=require(_0x24dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24dd('0xd'));var Papa=require(_0x24dd('0xe'));var Redis=require(_0x24dd('0xf'));var authService=require(_0x24dd('0x10'));var qs=require(_0x24dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24dd('0x12'));var logger=require(_0x24dd('0x13'))(_0x24dd('0x14'));var utils=require(_0x24dd('0x15'));var config=require(_0x24dd('0x16'));var licenseUtil=require(_0x24dd('0x17'));var db=require(_0x24dd('0x18'))['db'];config[_0x24dd('0x19')]=_['defaults'](config[_0x24dd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x24dd('0x1a'))(new Redis(config[_0x24dd('0x19')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x45da78,_0x15ed4d){_0x15ed4d=_0x15ed4d||0xcc;return function(_0x3971fb){if(_0x3971fb){return _0x45da78['sendStatus'](_0x15ed4d);}return _0x45da78[_0x24dd('0x1b')](_0x15ed4d)['end']();};}function respondWithResult(_0x397e7e,_0x23dc56){_0x23dc56=_0x23dc56||0xc8;return function(_0x2aba20){if(_0x2aba20){return _0x397e7e[_0x24dd('0x1b')](_0x23dc56)['json'](_0x2aba20);}};}function respondWithFilteredResult(_0x1fbef8,_0x1ede28){return function(_0x593c8c){if(_0x593c8c){var _0x4cce12=_0x593c8c[_0x24dd('0x1c')],_0x2962d0=_0x1ede28[_0x24dd('0x1d')],_0x5751cb=_0x1ede28[_0x24dd('0x1d')]+_0x1ede28[_0x24dd('0x1e')],_0x3debf8;if(_0x5751cb>=_0x4cce12){_0x5751cb=_0x4cce12;_0x3debf8=0xc8;}else{_0x3debf8=0xce;}_0x1fbef8[_0x24dd('0x1b')](_0x3debf8);return _0x1fbef8['set']('Content-Range',_0x2962d0+'-'+_0x5751cb+'/'+_0x4cce12)[_0x24dd('0x1f')](_0x593c8c);}return null;};}function patchUpdates(_0x2ffe3c){return function(_0x4bafcf){try{jsonpatch['apply'](_0x4bafcf,_0x2ffe3c,!![]);}catch(_0x3c73e8){return BPromise['reject'](_0x3c73e8);}return _0x4bafcf[_0x24dd('0x20')]();};}function saveUpdates(_0x22f177,_0x47c4ce){return function(_0x56a1c1){if(_0x56a1c1){return _0x56a1c1[_0x24dd('0x21')](_0x22f177)[_0x24dd('0x22')](function(_0x930681){return _0x930681;});}return null;};}function removeEntity(_0xa3262,_0x28d6e2){return function(_0x4a47eb){if(_0x4a47eb){return _0x4a47eb[_0x24dd('0x23')]()[_0x24dd('0x22')](function(){var _0xab4def=_0x4a47eb['get']({'plain':!![]});var _0x1d3a8f=_0x24dd('0x24');return db[_0x24dd('0x25')][_0x24dd('0x23')]({'where':{'type':_0x1d3a8f,'resourceId':_0xab4def['id']}})[_0x24dd('0x22')](function(){return _0x4a47eb;});})['then'](function(){_0xa3262['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23c3f8,_0x26d9aa){return function(_0x20c92){if(!_0x20c92){_0x23c3f8['sendStatus'](0x194);}return _0x20c92;};}function handleError(_0x48b1c8,_0x52dc35){_0x52dc35=_0x52dc35||0x1f4;return function(_0x3329a6){logger[_0x24dd('0x26')](_0x3329a6[_0x24dd('0x27')]);if(_0x3329a6[_0x24dd('0x28')]){delete _0x3329a6[_0x24dd('0x28')];}_0x48b1c8['status'](_0x52dc35)[_0x24dd('0x29')](_0x3329a6);};}exports['index']=function(_0xbf954a,_0x3058c7){var _0x23ea3d={},_0x49925b={},_0x1c8dad={'count':0x0,'rows':[]};var _0x3cb5f0=_['map'](db[_0x24dd('0x2a')]['rawAttributes'],function(_0xfdd965){return{'name':_0xfdd965[_0x24dd('0x2b')],'type':_0xfdd965['type']['key']};});_0x49925b[_0x24dd('0x2c')]=_[_0x24dd('0x2d')](_0x3cb5f0,_0x24dd('0x28'));_0x49925b[_0x24dd('0x2e')]=_[_0x24dd('0x2f')](_0xbf954a[_0x24dd('0x2e')]);_0x49925b[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x49925b[_0x24dd('0x2c')],_0x49925b[_0x24dd('0x2e')]);_0x23ea3d[_0x24dd('0x32')]=_[_0x24dd('0x31')](_0x49925b['model'],qs[_0x24dd('0x33')](_0xbf954a[_0x24dd('0x2e')]['fields']));_0x23ea3d[_0x24dd('0x32')]=_0x23ea3d['attributes']['length']?_0x23ea3d[_0x24dd('0x32')]:_0x49925b[_0x24dd('0x2c')];if(!_0xbf954a['query'][_0x24dd('0x34')]('nolimit')){_0x23ea3d[_0x24dd('0x1e')]=qs[_0x24dd('0x1e')](_0xbf954a[_0x24dd('0x2e')][_0x24dd('0x1e')]);_0x23ea3d[_0x24dd('0x1d')]=qs[_0x24dd('0x1d')](_0xbf954a[_0x24dd('0x2e')][_0x24dd('0x1d')]);}_0x23ea3d[_0x24dd('0x35')]=qs[_0x24dd('0x36')](_0xbf954a[_0x24dd('0x2e')][_0x24dd('0x36')]);_0x23ea3d[_0x24dd('0x37')]=qs[_0x24dd('0x30')](_[_0x24dd('0x38')](_0xbf954a['query'],_0x49925b[_0x24dd('0x30')]),_0x3cb5f0);if(_0xbf954a['query'][_0x24dd('0x39')]){_0x23ea3d[_0x24dd('0x37')]=_[_0x24dd('0x3a')](_0x23ea3d[_0x24dd('0x37')],{'$or':_[_0x24dd('0x2d')](_0x3cb5f0,function(_0x39f875){if(_0x39f875[_0x24dd('0x3b')]!=='VIRTUAL'){var _0x1b4cd8={};_0x1b4cd8[_0x39f875[_0x24dd('0x28')]]={'$like':'%'+_0xbf954a[_0x24dd('0x2e')][_0x24dd('0x39')]+'%'};return _0x1b4cd8;}})});}_0x23ea3d=_[_0x24dd('0x3a')]({},_0x23ea3d,_0xbf954a[_0x24dd('0x3c')]);var _0x29c7e5={'where':_0x23ea3d[_0x24dd('0x37')]};return db['MailQueue'][_0x24dd('0x1c')](_0x29c7e5)[_0x24dd('0x22')](function(_0x3addda){_0x1c8dad[_0x24dd('0x1c')]=_0x3addda;if(_0xbf954a[_0x24dd('0x2e')][_0x24dd('0x3d')]){_0x23ea3d[_0x24dd('0x3e')]=[{'all':!![]}];}return db[_0x24dd('0x2a')][_0x24dd('0x3f')](_0x23ea3d);})[_0x24dd('0x22')](function(_0x2cab73){_0x1c8dad[_0x24dd('0x40')]=_0x2cab73;return _0x1c8dad;})[_0x24dd('0x22')](respondWithFilteredResult(_0x3058c7,_0x23ea3d))[_0x24dd('0x41')](handleError(_0x3058c7,null));};exports[_0x24dd('0x42')]=function(_0x1559e1,_0x43015c){var _0x31988b={'raw':!![],'where':{'id':_0x1559e1[_0x24dd('0x43')]['id']}},_0x421390={};_0x421390[_0x24dd('0x2c')]=_['keys'](db[_0x24dd('0x2a')]['rawAttributes']);_0x421390['query']=_[_0x24dd('0x2f')](_0x1559e1[_0x24dd('0x2e')]);_0x421390[_0x24dd('0x30')]=_['intersection'](_0x421390[_0x24dd('0x2c')],_0x421390[_0x24dd('0x2e')]);_0x31988b[_0x24dd('0x32')]=_['intersection'](_0x421390[_0x24dd('0x2c')],qs[_0x24dd('0x33')](_0x1559e1[_0x24dd('0x2e')][_0x24dd('0x33')]));_0x31988b[_0x24dd('0x32')]=_0x31988b[_0x24dd('0x32')][_0x24dd('0x44')]?_0x31988b[_0x24dd('0x32')]:_0x421390['model'];if(_0x1559e1[_0x24dd('0x2e')][_0x24dd('0x3d')]){_0x31988b[_0x24dd('0x3e')]=[{'all':!![]}];}_0x31988b=_[_0x24dd('0x3a')]({},_0x31988b,_0x1559e1[_0x24dd('0x3c')]);return db[_0x24dd('0x2a')][_0x24dd('0x45')](_0x31988b)[_0x24dd('0x22')](handleEntityNotFound(_0x43015c,null))['then'](respondWithResult(_0x43015c,null))[_0x24dd('0x41')](handleError(_0x43015c,null));};exports['create']=function(_0x3b7557,_0x1a4339){return db['MailQueue'][_0x24dd('0x46')](_0x3b7557['body'],{})[_0x24dd('0x22')](function(_0x3ff73b){var _0x3f8105=_0x3b7557[_0x24dd('0x47')][_0x24dd('0x48')]({'plain':!![]});if(!_0x3f8105)throw new Error(_0x24dd('0x49'));if(_0x3f8105[_0x24dd('0x4a')]===_0x24dd('0x47')){var _0x426004=_0x3ff73b['get']({'plain':!![]});var _0x43c11e='MailQueues';return db[_0x24dd('0x4b')]['find']({'where':{'name':_0x43c11e,'userProfileId':_0x3f8105['userProfileId']},'raw':!![]})[_0x24dd('0x22')](function(_0x5e2d8e){if(_0x5e2d8e&&_0x5e2d8e['autoAssociation']===0x0){return db['UserProfileResource'][_0x24dd('0x46')]({'name':_0x426004[_0x24dd('0x28')],'resourceId':_0x426004['id'],'type':_0x5e2d8e[_0x24dd('0x28')],'sectionId':_0x5e2d8e['id']},{})[_0x24dd('0x22')](function(){return _0x3ff73b;});}else{return _0x3ff73b;}})[_0x24dd('0x41')](function(_0x33927d){logger[_0x24dd('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33927d);throw _0x33927d;});}return _0x3ff73b;})[_0x24dd('0x22')](respondWithResult(_0x1a4339,0xc9))[_0x24dd('0x41')](handleError(_0x1a4339,null));};exports[_0x24dd('0x21')]=function(_0x20ed1e,_0x257c3f){if(_0x20ed1e[_0x24dd('0x4c')]['id']){delete _0x20ed1e[_0x24dd('0x4c')]['id'];}return db[_0x24dd('0x2a')][_0x24dd('0x45')]({'where':{'id':_0x20ed1e[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x257c3f,null))[_0x24dd('0x22')](saveUpdates(_0x20ed1e[_0x24dd('0x4c')],null))['then'](respondWithResult(_0x257c3f,null))[_0x24dd('0x41')](handleError(_0x257c3f,null));};exports[_0x24dd('0x23')]=function(_0x551f93,_0x2bcc8a){return db[_0x24dd('0x2a')][_0x24dd('0x45')]({'where':{'id':_0x551f93[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x2bcc8a,null))[_0x24dd('0x22')](removeEntity(_0x2bcc8a,null))[_0x24dd('0x41')](handleError(_0x2bcc8a,null));};exports[_0x24dd('0x4d')]=function(_0x2576c3,_0x3fe9f0){return db['MailQueue']['describe']()['then'](respondWithResult(_0x3fe9f0,null))['catch'](handleError(_0x3fe9f0,null));};exports[_0x24dd('0x4e')]=function(_0x3a9f1c,_0x5633d5,_0x602024){var _0x4eff9a={'raw':!![],'where':{}},_0x384240={},_0x47dc08;return db[_0x24dd('0x2a')][_0x24dd('0x4f')]({'where':{'id':_0x3a9f1c[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x5633d5,null))[_0x24dd('0x22')](function(_0x3fe307){if(_0x3fe307){_0x47dc08=_0x3fe307['get']({'plain':!![]});_0x384240['model']=_['keys'](db[_0x24dd('0x50')][_0x24dd('0x51')]);_0x384240[_0x24dd('0x2e')]=_['keys'](_0x3a9f1c[_0x24dd('0x2e')]);_0x384240[_0x24dd('0x30')]=_['intersection'](_0x384240['model'],_0x384240[_0x24dd('0x2e')]);_0x4eff9a[_0x24dd('0x32')]=_['intersection'](_0x384240['model'],qs[_0x24dd('0x33')](_0x3a9f1c['query']['fields']));_0x4eff9a[_0x24dd('0x32')]=_0x4eff9a['attributes'][_0x24dd('0x44')]?_0x4eff9a[_0x24dd('0x32')]:_0x384240[_0x24dd('0x2c')];if(!_0x3a9f1c[_0x24dd('0x2e')][_0x24dd('0x34')](_0x24dd('0x52'))){_0x4eff9a['limit']=qs[_0x24dd('0x1e')](_0x3a9f1c[_0x24dd('0x2e')][_0x24dd('0x1e')]);_0x4eff9a[_0x24dd('0x1d')]=qs[_0x24dd('0x1d')](_0x3a9f1c[_0x24dd('0x2e')]['offset']);}_0x4eff9a['order']=qs[_0x24dd('0x36')](_0x3a9f1c['query'][_0x24dd('0x36')]);_0x4eff9a[_0x24dd('0x37')]=qs[_0x24dd('0x30')](_[_0x24dd('0x38')](_0x3a9f1c[_0x24dd('0x2e')],_0x384240[_0x24dd('0x30')]));_0x4eff9a[_0x24dd('0x37')]['MailQueueId']=_0x3fe307['id'];if(_0x3a9f1c[_0x24dd('0x2e')]['filter']){_0x4eff9a[_0x24dd('0x37')]=_[_0x24dd('0x3a')](_0x4eff9a[_0x24dd('0x37')],{'$or':_[_0x24dd('0x2d')](_0x4eff9a['attributes'],function(_0xd63b4c){var _0xa0c733={};_0xa0c733[_0xd63b4c]={'$like':'%'+_0x3a9f1c[_0x24dd('0x2e')][_0x24dd('0x39')]+'%'};return _0xa0c733;})});}_0x4eff9a=_['merge']({},_0x4eff9a,_0x3a9f1c[_0x24dd('0x3c')]);return db[_0x24dd('0x50')][_0x24dd('0x3f')](_0x4eff9a);}})[_0x24dd('0x22')](function(_0x20ad34){if(_0x20ad34){return db[_0x24dd('0x53')]['findAndCountAll']({'where':{'id':_[_0x24dd('0x2d')](_0x20ad34,_0x24dd('0x54')),'role':_0x24dd('0x55')},'attributes':['id','name',_0x24dd('0x56'),_0x24dd('0x57'),_0x24dd('0x58')]});}})[_0x24dd('0x22')](function(_0x47db22){if(_0x47db22){return{'count':_0x47db22[_0x24dd('0x1c')],'rows':_['map'](_0x47db22['rows'],function(_0x5190a2){return{'membername':_0x5190a2[_0x24dd('0x28')],'UserId':_0x5190a2['id'],'queue_name':_0x47dc08['name'],'MailQueueId':_0x47dc08['id'],'interface':util['format'](_0x24dd('0x59'),_0x24dd('0x5a'),_0x5190a2[_0x24dd('0x28')]),'penalty':0x0,'paused':_0x5190a2['mailPause'],'createdAt':_0x5190a2['createdAt'],'updatedAt':_0x5190a2[_0x24dd('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x24dd('0x22')](respondWithFilteredResult(_0x5633d5,_0x4eff9a))[_0x24dd('0x41')](handleError(_0x5633d5,null));};exports[_0x24dd('0x5b')]=function(_0x455b63,_0x532268,_0xbc8eeb){var _0x27be64={};var _0x5c9fb4={};var _0x2a599b;var _0xb7a7;return db[_0x24dd('0x2a')][_0x24dd('0x4f')]({'where':{'id':_0x455b63[_0x24dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x532268,null))[_0x24dd('0x22')](function(_0x140d61){if(_0x140d61){_0x2a599b=_0x140d61;_0x5c9fb4[_0x24dd('0x2c')]=_[_0x24dd('0x2f')](db[_0x24dd('0x5c')][_0x24dd('0x51')]);_0x5c9fb4[_0x24dd('0x2e')]=_['keys'](_0x455b63[_0x24dd('0x2e')]);_0x5c9fb4[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x5c9fb4[_0x24dd('0x2c')],_0x5c9fb4[_0x24dd('0x2e')]);_0x27be64['attributes']=_[_0x24dd('0x31')](_0x5c9fb4[_0x24dd('0x2c')],qs['fields'](_0x455b63[_0x24dd('0x2e')]['fields']));_0x27be64[_0x24dd('0x32')]=_0x27be64['attributes'][_0x24dd('0x44')]?_0x27be64['attributes']:_0x5c9fb4['model'];_0x27be64[_0x24dd('0x35')]=qs[_0x24dd('0x36')](_0x455b63[_0x24dd('0x2e')][_0x24dd('0x36')]);_0x27be64['where']=qs[_0x24dd('0x30')](_[_0x24dd('0x38')](_0x455b63[_0x24dd('0x2e')],_0x5c9fb4[_0x24dd('0x30')]));if(_0x455b63['query']['filter']){_0x27be64[_0x24dd('0x37')]=_['merge'](_0x27be64['where'],{'$or':_['map'](_0x27be64[_0x24dd('0x32')],function(_0x3e375c){var _0x20feb8={};_0x20feb8[_0x3e375c]={'$like':'%'+_0x455b63[_0x24dd('0x2e')][_0x24dd('0x39')]+'%'};return _0x20feb8;})});}_0x27be64=_[_0x24dd('0x3a')]({},_0x27be64,_0x455b63[_0x24dd('0x3c')]);return _0x2a599b['getTeams'](_0x27be64);}})['then'](function(_0x12c6c4){if(_0x12c6c4){_0xb7a7=_0x12c6c4[_0x24dd('0x44')];if(!_0x455b63[_0x24dd('0x2e')][_0x24dd('0x34')](_0x24dd('0x52'))){_0x27be64['limit']=qs[_0x24dd('0x1e')](_0x455b63[_0x24dd('0x2e')][_0x24dd('0x1e')]);_0x27be64[_0x24dd('0x1d')]=qs[_0x24dd('0x1d')](_0x455b63[_0x24dd('0x2e')][_0x24dd('0x1d')]);}return _0x2a599b[_0x24dd('0x5b')](_0x27be64);}})[_0x24dd('0x22')](function(_0x484bee){if(_0x484bee){return _0x484bee?{'count':_0xb7a7,'rows':_0x484bee}:null;}})['then'](respondWithResult(_0x532268,null))[_0x24dd('0x41')](handleError(_0x532268,null));};exports[_0x24dd('0x5d')]=function(_0x36d268,_0x5145c8,_0x2b386a){var _0x50a5d3=_0x36d268[_0x24dd('0x4c')][_0x24dd('0x5e')];return db[_0x24dd('0x5c')][_0x24dd('0x3f')]({'where':{'id':_0x50a5d3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x24dd('0x5f'),'attributes':['id','name',_0x24dd('0x60'),_0x24dd('0x61'),_0x24dd('0x62')],'raw':!![]}]})[_0x24dd('0x22')](function(_0x170303){if(_0x170303){var _0xcc8f38=_['flatMap'](_0x170303,function(_0x1394cc){var _0x3ce14e=_0x1394cc[_0x24dd('0x48')]({'plain':!![]});return _0x3ce14e[_0x24dd('0x5f')];});return db['MailQueue'][_0x24dd('0x45')]({'where':{'id':_0x36d268[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](function(_0x3b6672){return db[_0x24dd('0x63')][_0x24dd('0x64')](function(_0x255688){return _0x3b6672[_0x24dd('0x5d')](_0x50a5d3,{'transaction':_0x255688})[_0x24dd('0x22')](function(){return BPromise['each'](_0xcc8f38,function(_0x511b7b){return db[_0x24dd('0x50')]['findOrCreate']({'where':{'UserId':_0x511b7b['id'],'MailQueueId':_0x36d268[_0x24dd('0x43')]['id']},'transaction':_0x255688});});})[_0x24dd('0x22')](function(){_0xcc8f38[_0x24dd('0x65')](function(_0x350f4f){socket[_0x24dd('0x66')]('userMailQueue:save',{'UserId':_0x350f4f['id'],'MailQueueId':_0x3b6672['id']});});});});});}})[_0x24dd('0x22')](respondWithStatusCode(_0x5145c8,null))[_0x24dd('0x41')](handleError(_0x5145c8,null));};exports['removeTeams']=function(_0x244c93,_0x114ff2,_0x41c6b8){return db[_0x24dd('0x5c')][_0x24dd('0x3f')]({'where':{'id':_0x244c93[_0x24dd('0x2e')][_0x24dd('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x24dd('0x53')],'as':_0x24dd('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x24dd('0x22')](handleEntityNotFound(_0x114ff2,null))[_0x24dd('0x22')](function(_0x3e8e66){var _0x11b686=_[_0x24dd('0x2d')](_0x3e8e66,'id');var _0x57b393=[];var _0x2cda5b=[];var _0x272b6d=squel[_0x24dd('0x67')]();_0x272b6d[_0x24dd('0x68')](_0x24dd('0x69'))[_0x24dd('0x6a')]('team_has_mail_queues','tq')[_0x24dd('0x6b')](_0x24dd('0x6c'),'ut',_0x24dd('0x6d'))[_0x24dd('0x37')](_0x24dd('0x6e'),_0x244c93[_0x24dd('0x43')]['id']);for(var _0x500bd2=0x0;_0x500bd2<_0x3e8e66[_0x24dd('0x44')];_0x500bd2+=0x1){let _0x505bf4=_0x3e8e66[_0x500bd2];for(var _0x2dcf43=0x0;_0x2dcf43<_0x505bf4[_0x24dd('0x5f')][_0x24dd('0x44')];_0x2dcf43+=0x1){let _0xb66ddb=_0x505bf4['Agents'][_0x2dcf43];var _0x595ae4=_0x272b6d[_0x24dd('0x6f')]();_0x595ae4[_0x24dd('0x37')](_0x24dd('0x70'),_0xb66ddb['id']);_0x2cda5b['push'](db['sequelize'][_0x24dd('0x2e')](_0x595ae4[_0x24dd('0x71')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x4bcba8){if(_0x4bcba8[_0x24dd('0x44')]===0x1){return _0xb66ddb['id'];}else{var _0x335230=_[_0x24dd('0x72')](_['map'](_0x4bcba8,'TeamId'),function(_0x4f442d){return _[_0x24dd('0x73')](_0x11b686,_0x4f442d);});if(_0x335230){return _0xb66ddb['id'];}}}));}}return BPromise[_0x24dd('0x74')](_0x2cda5b)[_0x24dd('0x22')](function(_0x97caf6){_0x57b393=_(_0x57b393)[_0x24dd('0x75')](_0x97caf6)[_0x24dd('0x76')]()[_0x24dd('0x77')]();return db['MailQueue'][_0x24dd('0x45')]({'where':{'id':_0x244c93[_0x24dd('0x43')]['id']}})['then'](function(_0x19051e){return db[_0x24dd('0x63')][_0x24dd('0x64')](function(_0x135836){return _0x19051e['removeTeams'](_0x244c93[_0x24dd('0x2e')]['ids'],{'transaction':_0x135836})[_0x24dd('0x22')](function(){if(!_[_0x24dd('0x78')](_0x57b393)){return _0x19051e[_0x24dd('0x79')](_0x57b393,{'transaction':_0x135836});}})[_0x24dd('0x22')](function(){_0x57b393[_0x24dd('0x65')](function(_0x24b7c9){socket[_0x24dd('0x66')](_0x24dd('0x7a'),{'UserId':_0x24b7c9,'MailQueueId':_0x19051e['id']});});});});});});})[_0x24dd('0x22')](respondWithStatusCode(_0x114ff2,null))['catch'](handleError(_0x114ff2,null));};exports[_0x24dd('0x7b')]=function(_0x544265,_0x5760ed,_0xad5afd){return db[_0x24dd('0x2a')]['find']({'where':{'id':_0x544265[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x5760ed,null))[_0x24dd('0x22')](function(_0x4094be){if(_0x4094be){return _0x4094be[_0x24dd('0x7b')](_0x544265[_0x24dd('0x4c')][_0x24dd('0x5e')],_[_0x24dd('0x7c')](_0x544265[_0x24dd('0x4c')],[_0x24dd('0x5e'),'id'])||{})['spread'](function(_0x1f2a28){for(var _0x260fa8=0x0;_0x260fa8<_0x544265['body'][_0x24dd('0x5e')]['length'];_0x260fa8+=0x1){socket[_0x24dd('0x66')](_0x24dd('0x7d'),{'UserId':_0x544265[_0x24dd('0x4c')][_0x24dd('0x5e')][_0x260fa8],'MailQueueId':_0x544265['params']['id']});}return _0x1f2a28;});}})[_0x24dd('0x22')](respondWithResult(_0x5760ed,null))[_0x24dd('0x41')](handleError(_0x5760ed,null));};exports[_0x24dd('0x79')]=function(_0x525600,_0x4b4878,_0x4973c5){return db['MailQueue'][_0x24dd('0x45')]({'where':{'id':_0x525600[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x4b4878,null))['then'](function(_0x2824ae){if(_0x2824ae){return _0x2824ae['removeAgents'](_0x525600[_0x24dd('0x2e')]['ids'])[_0x24dd('0x22')](function(){if(_[_0x24dd('0x7e')](_0x525600['query'][_0x24dd('0x5e')])){for(var _0x55d1c4=0x0;_0x55d1c4<_0x525600[_0x24dd('0x2e')][_0x24dd('0x5e')][_0x24dd('0x44')];_0x55d1c4+=0x1){socket[_0x24dd('0x66')]('userMailQueue:remove',{'UserId':Number(_0x525600[_0x24dd('0x2e')][_0x24dd('0x5e')][_0x55d1c4]),'MailQueueId':Number(_0x525600[_0x24dd('0x43')]['id'])});}}else{socket[_0x24dd('0x66')](_0x24dd('0x7a'),{'UserId':Number(_0x525600[_0x24dd('0x2e')][_0x24dd('0x5e')]),'MailQueueId':Number(_0x525600[_0x24dd('0x43')]['id'])});}});}})[_0x24dd('0x22')](respondWithStatusCode(_0x4b4878,null))[_0x24dd('0x41')](handleError(_0x4b4878,null));};exports[_0x24dd('0x7f')]=function(_0x453ce8,_0x59a110,_0x42e966){var _0x5c05ef={};var _0x320133={};var _0x100bd3;var _0x6f43a5;return db['MailQueue'][_0x24dd('0x4f')]({'where':{'id':_0x453ce8[_0x24dd('0x43')]['id']}})[_0x24dd('0x22')](handleEntityNotFound(_0x59a110,null))[_0x24dd('0x22')](function(_0x18c064){if(_0x18c064){_0x100bd3=_0x18c064;_0x320133['model']=_[_0x24dd('0x2f')](db[_0x24dd('0x53')]['rawAttributes']);_0x320133['query']=_[_0x24dd('0x2f')](_0x453ce8['query']);_0x320133[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x320133[_0x24dd('0x2c')],_0x320133[_0x24dd('0x2e')]);_0x5c05ef[_0x24dd('0x32')]=_[_0x24dd('0x31')](_0x320133[_0x24dd('0x2c')],qs[_0x24dd('0x33')](_0x453ce8[_0x24dd('0x2e')][_0x24dd('0x33')]));_0x5c05ef[_0x24dd('0x32')]=_0x5c05ef['attributes'][_0x24dd('0x44')]?_0x5c05ef[_0x24dd('0x32')]:_0x320133[_0x24dd('0x2c')];_0x5c05ef['order']=qs[_0x24dd('0x36')](_0x453ce8[_0x24dd('0x2e')][_0x24dd('0x36')]);_0x5c05ef[_0x24dd('0x37')]=qs[_0x24dd('0x30')](_[_0x24dd('0x38')](_0x453ce8[_0x24dd('0x2e')],_0x320133[_0x24dd('0x30')]));if(_0x453ce8['query'][_0x24dd('0x39')]){_0x5c05ef['where']=_[_0x24dd('0x3a')](_0x5c05ef[_0x24dd('0x37')],{'$or':_[_0x24dd('0x2d')](_0x5c05ef[_0x24dd('0x32')],function(_0x9b06f2){var _0x321e72={};_0x321e72[_0x9b06f2]={'$like':'%'+_0x453ce8[_0x24dd('0x2e')][_0x24dd('0x39')]+'%'};return _0x321e72;})});}_0x5c05ef=_[_0x24dd('0x3a')]({},_0x5c05ef,_0x453ce8[_0x24dd('0x3c')]);return _0x100bd3[_0x24dd('0x7f')](_0x5c05ef);}})[_0x24dd('0x22')](function(_0x17e78e){if(_0x17e78e){_0x6f43a5=_0x17e78e[_0x24dd('0x44')];if(!_0x453ce8['query'][_0x24dd('0x34')](_0x24dd('0x52'))){_0x5c05ef[_0x24dd('0x1e')]=qs['limit'](_0x453ce8['query'][_0x24dd('0x1e')]);_0x5c05ef[_0x24dd('0x1d')]=qs[_0x24dd('0x1d')](_0x453ce8['query'][_0x24dd('0x1d')]);}return _0x100bd3[_0x24dd('0x7f')](_0x5c05ef);}})[_0x24dd('0x22')](function(_0x256322){if(_0x256322){return _0x256322?{'count':_0x6f43a5,'rows':_0x256322}:null;}})[_0x24dd('0x22')](respondWithResult(_0x59a110,null))[_0x24dd('0x41')](handleError(_0x59a110,null));}; \ No newline at end of file +var _0xa2cb=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','user','get','role','MailQueues','UserProfileSection','autoAssociation','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','interface','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','sequelize','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x435e79,_0x4816f8){var _0x3087a0=function(_0xebb8a1){while(--_0xebb8a1){_0x435e79['push'](_0x435e79['shift']());}};_0x3087a0(++_0x4816f8);}(_0xa2cb,0x7d));var _0xba2c=function(_0x253574,_0x56c888){_0x253574=_0x253574-0x0;var _0x194a6e=_0xa2cb[_0x253574];return _0x194a6e;};'use strict';var pdf=require(_0xba2c('0x0'));var emlformat=require(_0xba2c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xba2c('0x2'));var jsonpatch=require(_0xba2c('0x3'));var rp=require(_0xba2c('0x4'));var moment=require(_0xba2c('0x5'));var BPromise=require(_0xba2c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xba2c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xba2c('0x8'));var crypto=require('crypto');var jsforce=require(_0xba2c('0x9'));var deskjs=require(_0xba2c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xba2c('0xb'));var Papa=require(_0xba2c('0xc'));var Redis=require('ioredis');var authService=require(_0xba2c('0xd'));var qs=require(_0xba2c('0xe'));var as=require(_0xba2c('0xf'));var hardwareService=require(_0xba2c('0x10'));var logger=require('../../config/logger')(_0xba2c('0x11'));var utils=require(_0xba2c('0x12'));var config=require(_0xba2c('0x13'));var licenseUtil=require(_0xba2c('0x14'));var db=require(_0xba2c('0x15'))['db'];config[_0xba2c('0x16')]=_[_0xba2c('0x17')](config[_0xba2c('0x16')],{'host':_0xba2c('0x18'),'port':0x18eb});var socket=require(_0xba2c('0x19'))(new Redis(config['redis']));require(_0xba2c('0x1a'))[_0xba2c('0x1b')](socket);function respondWithStatusCode(_0x3fc26e,_0x210203){_0x210203=_0x210203||0xcc;return function(_0x3e6f61){if(_0x3e6f61){return _0x3fc26e[_0xba2c('0x1c')](_0x210203);}return _0x3fc26e[_0xba2c('0x1d')](_0x210203)[_0xba2c('0x1e')]();};}function respondWithResult(_0x121bbc,_0x54018c){_0x54018c=_0x54018c||0xc8;return function(_0x10cd6a){if(_0x10cd6a){return _0x121bbc[_0xba2c('0x1d')](_0x54018c)[_0xba2c('0x1f')](_0x10cd6a);}};}function respondWithFilteredResult(_0x3282ea,_0x5d6866){return function(_0x48227c){if(_0x48227c){var _0x1b281f=_0x48227c['count'],_0xe2e0d5=_0x5d6866['offset'],_0x555c1e=_0x5d6866[_0xba2c('0x20')]+_0x5d6866[_0xba2c('0x21')],_0x596599;if(_0x555c1e>=_0x1b281f){_0x555c1e=_0x1b281f;_0x596599=0xc8;}else{_0x596599=0xce;}_0x3282ea[_0xba2c('0x1d')](_0x596599);return _0x3282ea[_0xba2c('0x22')](_0xba2c('0x23'),_0xe2e0d5+'-'+_0x555c1e+'/'+_0x1b281f)[_0xba2c('0x1f')](_0x48227c);}return null;};}function patchUpdates(_0x2327e1){return function(_0x14902f){try{jsonpatch[_0xba2c('0x24')](_0x14902f,_0x2327e1,!![]);}catch(_0x3f6e98){return BPromise[_0xba2c('0x25')](_0x3f6e98);}return _0x14902f[_0xba2c('0x26')]();};}function saveUpdates(_0x31cd64,_0x3e0c06){return function(_0x369588){if(_0x369588){return _0x369588[_0xba2c('0x27')](_0x31cd64)[_0xba2c('0x28')](function(_0xf79e4c){return _0xf79e4c;});}return null;};}function removeEntity(_0x5ea429,_0x2d8123){return function(_0xda1ede){if(_0xda1ede){return _0xda1ede[_0xba2c('0x29')]()[_0xba2c('0x28')](function(){var _0x590f6a=_0xda1ede['get']({'plain':!![]});var _0x199b1d='MailQueues';return db[_0xba2c('0x2a')][_0xba2c('0x29')]({'where':{'type':_0x199b1d,'resourceId':_0x590f6a['id']}})[_0xba2c('0x28')](function(){return _0xda1ede;});})[_0xba2c('0x28')](function(){_0x5ea429[_0xba2c('0x1d')](0xcc)[_0xba2c('0x1e')]();});}};}function handleEntityNotFound(_0x5667bf,_0x5c245a){return function(_0x37a4f9){if(!_0x37a4f9){_0x5667bf[_0xba2c('0x1c')](0x194);}return _0x37a4f9;};}function handleError(_0x19ee5a,_0x46d3f9){_0x46d3f9=_0x46d3f9||0x1f4;return function(_0x4875f8){logger[_0xba2c('0x2b')](_0x4875f8[_0xba2c('0x2c')]);if(_0x4875f8[_0xba2c('0x2d')]){delete _0x4875f8[_0xba2c('0x2d')];}_0x19ee5a[_0xba2c('0x1d')](_0x46d3f9)[_0xba2c('0x2e')](_0x4875f8);};}exports[_0xba2c('0x2f')]=function(_0x1b3dfa,_0x367106){var _0x3f3f6b={},_0x261383={},_0x4584b8={'count':0x0,'rows':[]};var _0x415c24=_[_0xba2c('0x30')](db[_0xba2c('0x31')][_0xba2c('0x32')],function(_0x2fcc34){return{'name':_0x2fcc34['fieldName'],'type':_0x2fcc34[_0xba2c('0x33')]['key']};});_0x261383[_0xba2c('0x34')]=_[_0xba2c('0x30')](_0x415c24,_0xba2c('0x2d'));_0x261383[_0xba2c('0x35')]=_[_0xba2c('0x36')](_0x1b3dfa[_0xba2c('0x35')]);_0x261383['filters']=_[_0xba2c('0x37')](_0x261383[_0xba2c('0x34')],_0x261383[_0xba2c('0x35')]);_0x3f3f6b[_0xba2c('0x38')]=_[_0xba2c('0x37')](_0x261383[_0xba2c('0x34')],qs[_0xba2c('0x39')](_0x1b3dfa[_0xba2c('0x35')][_0xba2c('0x39')]));_0x3f3f6b['attributes']=_0x3f3f6b[_0xba2c('0x38')][_0xba2c('0x3a')]?_0x3f3f6b[_0xba2c('0x38')]:_0x261383['model'];if(!_0x1b3dfa[_0xba2c('0x35')][_0xba2c('0x3b')](_0xba2c('0x3c'))){_0x3f3f6b[_0xba2c('0x21')]=qs['limit'](_0x1b3dfa['query'][_0xba2c('0x21')]);_0x3f3f6b['offset']=qs[_0xba2c('0x20')](_0x1b3dfa['query']['offset']);}_0x3f3f6b[_0xba2c('0x3d')]=qs[_0xba2c('0x3e')](_0x1b3dfa[_0xba2c('0x35')][_0xba2c('0x3e')]);_0x3f3f6b['where']=qs[_0xba2c('0x3f')](_[_0xba2c('0x40')](_0x1b3dfa[_0xba2c('0x35')],_0x261383['filters']),_0x415c24);if(_0x1b3dfa[_0xba2c('0x35')][_0xba2c('0x41')]){_0x3f3f6b[_0xba2c('0x42')]=_[_0xba2c('0x43')](_0x3f3f6b[_0xba2c('0x42')],{'$or':_['map'](_0x415c24,function(_0x36672f){if(_0x36672f[_0xba2c('0x33')]!==_0xba2c('0x44')){var _0x3654a4={};_0x3654a4[_0x36672f[_0xba2c('0x2d')]]={'$like':'%'+_0x1b3dfa['query']['filter']+'%'};return _0x3654a4;}})});}_0x3f3f6b=_[_0xba2c('0x43')]({},_0x3f3f6b,_0x1b3dfa[_0xba2c('0x45')]);var _0x5ecdaa={'where':_0x3f3f6b[_0xba2c('0x42')]};return db[_0xba2c('0x31')][_0xba2c('0x46')](_0x5ecdaa)[_0xba2c('0x28')](function(_0xfeb352){_0x4584b8[_0xba2c('0x46')]=_0xfeb352;if(_0x1b3dfa[_0xba2c('0x35')][_0xba2c('0x47')]){_0x3f3f6b[_0xba2c('0x48')]=[{'all':!![]}];}return db['MailQueue'][_0xba2c('0x49')](_0x3f3f6b);})[_0xba2c('0x28')](function(_0x44137b){_0x4584b8['rows']=_0x44137b;return _0x4584b8;})[_0xba2c('0x28')](respondWithFilteredResult(_0x367106,_0x3f3f6b))[_0xba2c('0x4a')](handleError(_0x367106,null));};exports[_0xba2c('0x4b')]=function(_0x52d973,_0x16f4e8){var _0x25aac0={'raw':!![],'where':{'id':_0x52d973[_0xba2c('0x4c')]['id']}},_0x2c9917={};_0x2c9917['model']=_[_0xba2c('0x36')](db[_0xba2c('0x31')][_0xba2c('0x32')]);_0x2c9917[_0xba2c('0x35')]=_[_0xba2c('0x36')](_0x52d973[_0xba2c('0x35')]);_0x2c9917['filters']=_[_0xba2c('0x37')](_0x2c9917[_0xba2c('0x34')],_0x2c9917[_0xba2c('0x35')]);_0x25aac0[_0xba2c('0x38')]=_['intersection'](_0x2c9917['model'],qs[_0xba2c('0x39')](_0x52d973[_0xba2c('0x35')]['fields']));_0x25aac0[_0xba2c('0x38')]=_0x25aac0['attributes'][_0xba2c('0x3a')]?_0x25aac0[_0xba2c('0x38')]:_0x2c9917['model'];if(_0x52d973['query'][_0xba2c('0x47')]){_0x25aac0['include']=[{'all':!![]}];}_0x25aac0=_['merge']({},_0x25aac0,_0x52d973['options']);return db[_0xba2c('0x31')][_0xba2c('0x4d')](_0x25aac0)['then'](handleEntityNotFound(_0x16f4e8,null))[_0xba2c('0x28')](respondWithResult(_0x16f4e8,null))[_0xba2c('0x4a')](handleError(_0x16f4e8,null));};exports[_0xba2c('0x4e')]=function(_0x225c61,_0x499b97){return db[_0xba2c('0x31')][_0xba2c('0x4e')](_0x225c61[_0xba2c('0x4f')],{})[_0xba2c('0x28')](function(_0x4f52f6){var _0x4009ee=_0x225c61[_0xba2c('0x50')][_0xba2c('0x51')]({'plain':!![]});if(!_0x4009ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4009ee[_0xba2c('0x52')]==='user'){var _0x1c82e9=_0x4f52f6[_0xba2c('0x51')]({'plain':!![]});var _0x7c734=_0xba2c('0x53');return db[_0xba2c('0x54')][_0xba2c('0x4d')]({'where':{'name':_0x7c734,'userProfileId':_0x4009ee['userProfileId']},'raw':!![]})['then'](function(_0x45e4e5){if(_0x45e4e5&&_0x45e4e5[_0xba2c('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c82e9['name'],'resourceId':_0x1c82e9['id'],'type':_0x45e4e5[_0xba2c('0x2d')],'sectionId':_0x45e4e5['id']},{})[_0xba2c('0x28')](function(){return _0x4f52f6;});}else{return _0x4f52f6;}})[_0xba2c('0x4a')](function(_0x2e5752){logger[_0xba2c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e5752);throw _0x2e5752;});}return _0x4f52f6;})[_0xba2c('0x28')](respondWithResult(_0x499b97,0xc9))[_0xba2c('0x4a')](handleError(_0x499b97,null));};exports[_0xba2c('0x27')]=function(_0x1f64af,_0x504c77){if(_0x1f64af[_0xba2c('0x4f')]['id']){delete _0x1f64af[_0xba2c('0x4f')]['id'];}return db['MailQueue'][_0xba2c('0x4d')]({'where':{'id':_0x1f64af['params']['id']}})['then'](handleEntityNotFound(_0x504c77,null))[_0xba2c('0x28')](saveUpdates(_0x1f64af[_0xba2c('0x4f')],null))[_0xba2c('0x28')](respondWithResult(_0x504c77,null))['catch'](handleError(_0x504c77,null));};exports[_0xba2c('0x29')]=function(_0x1e6849,_0x1fe69a){return db[_0xba2c('0x31')]['find']({'where':{'id':_0x1e6849[_0xba2c('0x4c')]['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x1fe69a,null))[_0xba2c('0x28')](removeEntity(_0x1fe69a,null))[_0xba2c('0x4a')](handleError(_0x1fe69a,null));};exports['describe']=function(_0x1f29aa,_0xed99a7){return db[_0xba2c('0x31')][_0xba2c('0x56')]()['then'](respondWithResult(_0xed99a7,null))[_0xba2c('0x4a')](handleError(_0xed99a7,null));};exports[_0xba2c('0x57')]=function(_0xba1358,_0x5c5c18,_0x12ecec){var _0x5ed6e3={'raw':!![],'where':{}},_0xe37166={},_0x248d43;return db[_0xba2c('0x31')][_0xba2c('0x58')]({'where':{'id':_0xba1358[_0xba2c('0x4c')]['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x5c5c18,null))[_0xba2c('0x28')](function(_0x530a42){if(_0x530a42){_0x248d43=_0x530a42['get']({'plain':!![]});_0xe37166[_0xba2c('0x34')]=_[_0xba2c('0x36')](db[_0xba2c('0x59')][_0xba2c('0x32')]);_0xe37166[_0xba2c('0x35')]=_['keys'](_0xba1358[_0xba2c('0x35')]);_0xe37166[_0xba2c('0x3f')]=_[_0xba2c('0x37')](_0xe37166[_0xba2c('0x34')],_0xe37166[_0xba2c('0x35')]);_0x5ed6e3[_0xba2c('0x38')]=_[_0xba2c('0x37')](_0xe37166[_0xba2c('0x34')],qs[_0xba2c('0x39')](_0xba1358[_0xba2c('0x35')]['fields']));_0x5ed6e3[_0xba2c('0x38')]=_0x5ed6e3[_0xba2c('0x38')][_0xba2c('0x3a')]?_0x5ed6e3[_0xba2c('0x38')]:_0xe37166[_0xba2c('0x34')];if(!_0xba1358['query']['hasOwnProperty'](_0xba2c('0x3c'))){_0x5ed6e3[_0xba2c('0x21')]=qs[_0xba2c('0x21')](_0xba1358['query'][_0xba2c('0x21')]);_0x5ed6e3[_0xba2c('0x20')]=qs[_0xba2c('0x20')](_0xba1358['query'][_0xba2c('0x20')]);}_0x5ed6e3['order']=qs[_0xba2c('0x3e')](_0xba1358[_0xba2c('0x35')]['sort']);_0x5ed6e3[_0xba2c('0x42')]=qs[_0xba2c('0x3f')](_[_0xba2c('0x40')](_0xba1358[_0xba2c('0x35')],_0xe37166[_0xba2c('0x3f')]));_0x5ed6e3['where'][_0xba2c('0x5a')]=_0x530a42['id'];if(_0xba1358['query'][_0xba2c('0x41')]){_0x5ed6e3['where']=_[_0xba2c('0x43')](_0x5ed6e3['where'],{'$or':_[_0xba2c('0x30')](_0x5ed6e3[_0xba2c('0x38')],function(_0x52d643){var _0x42cf74={};_0x42cf74[_0x52d643]={'$like':'%'+_0xba1358[_0xba2c('0x35')][_0xba2c('0x41')]+'%'};return _0x42cf74;})});}_0x5ed6e3=_[_0xba2c('0x43')]({},_0x5ed6e3,_0xba1358['options']);return db[_0xba2c('0x59')]['findAll'](_0x5ed6e3);}})[_0xba2c('0x28')](function(_0x425e31){if(_0x425e31){return db[_0xba2c('0x5b')][_0xba2c('0x5c')]({'where':{'id':_[_0xba2c('0x30')](_0x425e31,_0xba2c('0x5d')),'role':_0xba2c('0x5e')},'attributes':['id',_0xba2c('0x2d'),_0xba2c('0x5f'),_0xba2c('0x60'),_0xba2c('0x61')]});}})[_0xba2c('0x28')](function(_0x43b915){if(_0x43b915){return{'count':_0x43b915[_0xba2c('0x46')],'rows':_[_0xba2c('0x30')](_0x43b915[_0xba2c('0x62')],function(_0x575f25){return{'membername':_0x575f25[_0xba2c('0x2d')],'UserId':_0x575f25['id'],'queue_name':_0x248d43[_0xba2c('0x2d')],'MailQueueId':_0x248d43['id'],'interface':util['format'](_0xba2c('0x63'),_0xba2c('0x64'),_0x575f25[_0xba2c('0x2d')]),'penalty':0x0,'paused':_0x575f25[_0xba2c('0x5f')],'createdAt':_0x575f25[_0xba2c('0x61')],'updatedAt':_0x575f25[_0xba2c('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xba2c('0x28')](respondWithFilteredResult(_0x5c5c18,_0x5ed6e3))[_0xba2c('0x4a')](handleError(_0x5c5c18,null));};exports['getTeams']=function(_0x403497,_0x6edc54,_0x2df1d9){var _0x2313ca={};var _0x216cb6={};var _0x531e92;var _0x374adc;return db[_0xba2c('0x31')][_0xba2c('0x58')]({'where':{'id':_0x403497[_0xba2c('0x4c')]['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x6edc54,null))[_0xba2c('0x28')](function(_0x359cf1){if(_0x359cf1){_0x531e92=_0x359cf1;_0x216cb6[_0xba2c('0x34')]=_[_0xba2c('0x36')](db[_0xba2c('0x65')][_0xba2c('0x32')]);_0x216cb6[_0xba2c('0x35')]=_[_0xba2c('0x36')](_0x403497[_0xba2c('0x35')]);_0x216cb6['filters']=_['intersection'](_0x216cb6['model'],_0x216cb6['query']);_0x2313ca[_0xba2c('0x38')]=_[_0xba2c('0x37')](_0x216cb6[_0xba2c('0x34')],qs['fields'](_0x403497[_0xba2c('0x35')][_0xba2c('0x39')]));_0x2313ca[_0xba2c('0x38')]=_0x2313ca[_0xba2c('0x38')][_0xba2c('0x3a')]?_0x2313ca['attributes']:_0x216cb6[_0xba2c('0x34')];_0x2313ca[_0xba2c('0x3d')]=qs[_0xba2c('0x3e')](_0x403497[_0xba2c('0x35')][_0xba2c('0x3e')]);_0x2313ca[_0xba2c('0x42')]=qs['filters'](_['pick'](_0x403497['query'],_0x216cb6[_0xba2c('0x3f')]));if(_0x403497['query'][_0xba2c('0x41')]){_0x2313ca[_0xba2c('0x42')]=_[_0xba2c('0x43')](_0x2313ca[_0xba2c('0x42')],{'$or':_['map'](_0x2313ca['attributes'],function(_0xa93254){var _0x1fdc8c={};_0x1fdc8c[_0xa93254]={'$like':'%'+_0x403497[_0xba2c('0x35')][_0xba2c('0x41')]+'%'};return _0x1fdc8c;})});}_0x2313ca=_[_0xba2c('0x43')]({},_0x2313ca,_0x403497[_0xba2c('0x45')]);return _0x531e92[_0xba2c('0x66')](_0x2313ca);}})['then'](function(_0x1fc04d){if(_0x1fc04d){_0x374adc=_0x1fc04d[_0xba2c('0x3a')];if(!_0x403497[_0xba2c('0x35')]['hasOwnProperty']('nolimit')){_0x2313ca['limit']=qs[_0xba2c('0x21')](_0x403497[_0xba2c('0x35')][_0xba2c('0x21')]);_0x2313ca[_0xba2c('0x20')]=qs['offset'](_0x403497[_0xba2c('0x35')]['offset']);}return _0x531e92[_0xba2c('0x66')](_0x2313ca);}})[_0xba2c('0x28')](function(_0x5f108a){if(_0x5f108a){return _0x5f108a?{'count':_0x374adc,'rows':_0x5f108a}:null;}})['then'](respondWithResult(_0x6edc54,null))[_0xba2c('0x4a')](handleError(_0x6edc54,null));};exports[_0xba2c('0x67')]=function(_0x13328a,_0x260af0,_0x4f6ae7){var _0x21b086=_0x13328a['body'][_0xba2c('0x68')];return db[_0xba2c('0x65')][_0xba2c('0x49')]({'where':{'id':_0x21b086},'attributes':['id'],'include':[{'model':db['User'],'as':_0xba2c('0x69'),'attributes':['id',_0xba2c('0x2d'),_0xba2c('0x6a'),'voicePause',_0xba2c('0x6b')],'raw':!![]}]})[_0xba2c('0x28')](function(_0x1c1cce){if(_0x1c1cce){var _0x19d11c=_['flatMap'](_0x1c1cce,function(_0x5ea0da){var _0x3e1447=_0x5ea0da[_0xba2c('0x51')]({'plain':!![]});return _0x3e1447['Agents'];});return db[_0xba2c('0x31')][_0xba2c('0x4d')]({'where':{'id':_0x13328a['params']['id']}})[_0xba2c('0x28')](function(_0x496c6d){return db['sequelize'][_0xba2c('0x6c')](function(_0x2d0d1c){return _0x496c6d['addTeams'](_0x21b086,{'transaction':_0x2d0d1c})[_0xba2c('0x28')](function(){return BPromise[_0xba2c('0x6d')](_0x19d11c,function(_0x5dfe65){return db[_0xba2c('0x59')][_0xba2c('0x6e')]({'where':{'UserId':_0x5dfe65['id'],'MailQueueId':_0x13328a['params']['id']},'transaction':_0x2d0d1c});});})['then'](function(){_0x19d11c[_0xba2c('0x6f')](function(_0xdff01e){socket[_0xba2c('0x70')](_0xba2c('0x71'),{'UserId':_0xdff01e['id'],'MailQueueId':_0x496c6d['id']});});});});});}})['then'](respondWithStatusCode(_0x260af0,null))[_0xba2c('0x4a')](handleError(_0x260af0,null));};exports['removeTeams']=function(_0x1b903b,_0x13f360,_0x38e590){return db[_0xba2c('0x65')][_0xba2c('0x49')]({'where':{'id':_0x1b903b[_0xba2c('0x35')][_0xba2c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xba2c('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x13f360,null))['then'](function(_0x4275fe){var _0x1cf2ff=_['map'](_0x4275fe,'id');var _0xde74f1=[];var _0x9d6f86=[];var _0x4871e3=squel[_0xba2c('0x72')]();_0x4871e3[_0xba2c('0x73')]('tq.TeamId')['from'](_0xba2c('0x74'),'tq')['join'](_0xba2c('0x75'),'ut',_0xba2c('0x76'))[_0xba2c('0x42')](_0xba2c('0x77'),_0x1b903b['params']['id']);for(var _0x2d8895=0x0;_0x2d8895<_0x4275fe[_0xba2c('0x3a')];_0x2d8895+=0x1){let _0x5ebfda=_0x4275fe[_0x2d8895];for(var _0x1f2069=0x0;_0x1f2069<_0x5ebfda['Agents'][_0xba2c('0x3a')];_0x1f2069+=0x1){let _0x533ae2=_0x5ebfda['Agents'][_0x1f2069];var _0x24a5d0=_0x4871e3[_0xba2c('0x78')]();_0x24a5d0[_0xba2c('0x42')](_0xba2c('0x79'),_0x533ae2['id']);_0x9d6f86[_0xba2c('0x7a')](db['sequelize'][_0xba2c('0x35')](_0x24a5d0[_0xba2c('0x7b')](),{'type':db['sequelize'][_0xba2c('0x7c')]['SELECT']})['then'](function(_0x103f8d){if(_0x103f8d[_0xba2c('0x3a')]===0x1){return _0x533ae2['id'];}else{var _0x448bbb=_[_0xba2c('0x7d')](_['map'](_0x103f8d,_0xba2c('0x7e')),function(_0x105bcd){return _[_0xba2c('0x7f')](_0x1cf2ff,_0x105bcd);});if(_0x448bbb){return _0x533ae2['id'];}}}));}}return BPromise[_0xba2c('0x80')](_0x9d6f86)['then'](function(_0x54e83a){_0xde74f1=_(_0xde74f1)[_0xba2c('0x81')](_0x54e83a)[_0xba2c('0x82')]()[_0xba2c('0x83')]();return db[_0xba2c('0x31')][_0xba2c('0x4d')]({'where':{'id':_0x1b903b[_0xba2c('0x4c')]['id']}})['then'](function(_0x1c53f7){return db[_0xba2c('0x84')]['transaction'](function(_0x129050){return _0x1c53f7[_0xba2c('0x85')](_0x1b903b['query'][_0xba2c('0x68')],{'transaction':_0x129050})['then'](function(){if(!_[_0xba2c('0x86')](_0xde74f1)){return _0x1c53f7['removeAgents'](_0xde74f1,{'transaction':_0x129050});}})[_0xba2c('0x28')](function(){_0xde74f1['forEach'](function(_0x50966a){socket[_0xba2c('0x70')](_0xba2c('0x87'),{'UserId':_0x50966a,'MailQueueId':_0x1c53f7['id']});});});});});});})[_0xba2c('0x28')](respondWithStatusCode(_0x13f360,null))[_0xba2c('0x4a')](handleError(_0x13f360,null));};exports[_0xba2c('0x88')]=function(_0xdcf460,_0x2ceb4b,_0x39a0d4){return db[_0xba2c('0x31')][_0xba2c('0x4d')]({'where':{'id':_0xdcf460['params']['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x2ceb4b,null))['then'](function(_0x15756f){if(_0x15756f){return _0x15756f['addAgents'](_0xdcf460[_0xba2c('0x4f')][_0xba2c('0x68')],_[_0xba2c('0x89')](_0xdcf460[_0xba2c('0x4f')],[_0xba2c('0x68'),'id'])||{})[_0xba2c('0x8a')](function(_0x15ee17){for(var _0x2ba13c=0x0;_0x2ba13c<_0xdcf460[_0xba2c('0x4f')]['ids'][_0xba2c('0x3a')];_0x2ba13c+=0x1){socket[_0xba2c('0x70')]('userMailQueue:save',{'UserId':_0xdcf460['body'][_0xba2c('0x68')][_0x2ba13c],'MailQueueId':_0xdcf460[_0xba2c('0x4c')]['id']});}return _0x15ee17;});}})['then'](respondWithResult(_0x2ceb4b,null))[_0xba2c('0x4a')](handleError(_0x2ceb4b,null));};exports['removeAgents']=function(_0x172a70,_0x7d4bf2,_0x4c6a88){return db[_0xba2c('0x31')][_0xba2c('0x4d')]({'where':{'id':_0x172a70[_0xba2c('0x4c')]['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x7d4bf2,null))[_0xba2c('0x28')](function(_0x15d7a1){if(_0x15d7a1){return _0x15d7a1[_0xba2c('0x8b')](_0x172a70['query'][_0xba2c('0x68')])[_0xba2c('0x28')](function(){if(_['isArray'](_0x172a70[_0xba2c('0x35')][_0xba2c('0x68')])){for(var _0x9af760=0x0;_0x9af760<_0x172a70['query'][_0xba2c('0x68')][_0xba2c('0x3a')];_0x9af760+=0x1){socket[_0xba2c('0x70')](_0xba2c('0x87'),{'UserId':Number(_0x172a70[_0xba2c('0x35')][_0xba2c('0x68')][_0x9af760]),'MailQueueId':Number(_0x172a70[_0xba2c('0x4c')]['id'])});}}else{socket[_0xba2c('0x70')](_0xba2c('0x87'),{'UserId':Number(_0x172a70[_0xba2c('0x35')][_0xba2c('0x68')]),'MailQueueId':Number(_0x172a70[_0xba2c('0x4c')]['id'])});}});}})[_0xba2c('0x28')](respondWithStatusCode(_0x7d4bf2,null))[_0xba2c('0x4a')](handleError(_0x7d4bf2,null));};exports[_0xba2c('0x8c')]=function(_0x82ef6,_0x4e9c57,_0x3690a3){var _0xc2d61e={};var _0x2f4869={};var _0x1784af;var _0x473b74;return db[_0xba2c('0x31')]['findOne']({'where':{'id':_0x82ef6[_0xba2c('0x4c')]['id']}})[_0xba2c('0x28')](handleEntityNotFound(_0x4e9c57,null))[_0xba2c('0x28')](function(_0x559f23){if(_0x559f23){_0x1784af=_0x559f23;_0x2f4869[_0xba2c('0x34')]=_['keys'](db['User'][_0xba2c('0x32')]);_0x2f4869[_0xba2c('0x35')]=_['keys'](_0x82ef6['query']);_0x2f4869[_0xba2c('0x3f')]=_[_0xba2c('0x37')](_0x2f4869[_0xba2c('0x34')],_0x2f4869[_0xba2c('0x35')]);_0xc2d61e[_0xba2c('0x38')]=_[_0xba2c('0x37')](_0x2f4869[_0xba2c('0x34')],qs['fields'](_0x82ef6[_0xba2c('0x35')][_0xba2c('0x39')]));_0xc2d61e[_0xba2c('0x38')]=_0xc2d61e[_0xba2c('0x38')]['length']?_0xc2d61e[_0xba2c('0x38')]:_0x2f4869[_0xba2c('0x34')];_0xc2d61e[_0xba2c('0x3d')]=qs[_0xba2c('0x3e')](_0x82ef6[_0xba2c('0x35')][_0xba2c('0x3e')]);_0xc2d61e['where']=qs['filters'](_['pick'](_0x82ef6[_0xba2c('0x35')],_0x2f4869[_0xba2c('0x3f')]));if(_0x82ef6[_0xba2c('0x35')][_0xba2c('0x41')]){_0xc2d61e[_0xba2c('0x42')]=_['merge'](_0xc2d61e[_0xba2c('0x42')],{'$or':_[_0xba2c('0x30')](_0xc2d61e[_0xba2c('0x38')],function(_0x5ae3f8){var _0x1155c5={};_0x1155c5[_0x5ae3f8]={'$like':'%'+_0x82ef6[_0xba2c('0x35')][_0xba2c('0x41')]+'%'};return _0x1155c5;})});}_0xc2d61e=_[_0xba2c('0x43')]({},_0xc2d61e,_0x82ef6['options']);return _0x1784af[_0xba2c('0x8c')](_0xc2d61e);}})[_0xba2c('0x28')](function(_0x21520a){if(_0x21520a){_0x473b74=_0x21520a[_0xba2c('0x3a')];if(!_0x82ef6['query']['hasOwnProperty'](_0xba2c('0x3c'))){_0xc2d61e['limit']=qs[_0xba2c('0x21')](_0x82ef6[_0xba2c('0x35')][_0xba2c('0x21')]);_0xc2d61e['offset']=qs[_0xba2c('0x20')](_0x82ef6[_0xba2c('0x35')][_0xba2c('0x20')]);}return _0x1784af[_0xba2c('0x8c')](_0xc2d61e);}})['then'](function(_0x4780ab){if(_0x4780ab){return _0x4780ab?{'count':_0x473b74,'rows':_0x4780ab}:null;}})[_0xba2c('0x28')](respondWithResult(_0x4e9c57,null))[_0xba2c('0x4a')](handleError(_0x4e9c57,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 773f6b4..67ba60c 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 _0xd3d9=['../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd3d9,0xef));var _0x9d3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3d9[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x9d3d('0x0'));var MailQueue=require(_0x9d3d('0x1'))['db'][_0x9d3d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9d3d('0x3')](0x0);var events={'afterCreate':_0x9d3d('0x4'),'afterUpdate':_0x9d3d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x630bc1){return function(_0x52210c,_0x14064c,_0xd51329){MailQueueEvents[_0x9d3d('0x6')](_0x630bc1+':'+_0x52210c['id'],_0x52210c);MailQueueEvents[_0x9d3d('0x6')](_0x630bc1,_0x52210c);_0xd51329(null);};}for(var e in events){if(events[_0x9d3d('0x7')](e)){var event=events[e];MailQueue[_0x9d3d('0x8')](e,emitEvent(event));}}module[_0x9d3d('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xb033=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit'];(function(_0x329918,_0x3feaba){var _0x4b1dec=function(_0x2fe09f){while(--_0x2fe09f){_0x329918['push'](_0x329918['shift']());}};_0x4b1dec(++_0x3feaba);}(_0xb033,0xe3));var _0x3b03=function(_0x41b021,_0x1c6d86){_0x41b021=_0x41b021-0x0;var _0x12585b=_0xb033[_0x41b021];return _0x12585b;};'use strict';var EventEmitter=require(_0x3b03('0x0'));var MailQueue=require(_0x3b03('0x1'))['db'][_0x3b03('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3b03('0x3')](0x0);var events={'afterCreate':_0x3b03('0x4'),'afterUpdate':_0x3b03('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5538e6){return function(_0x4c5ba6,_0x466ca8,_0x55977f){MailQueueEvents['emit'](_0x5538e6+':'+_0x4c5ba6['id'],_0x4c5ba6);MailQueueEvents[_0x3b03('0x6')](_0x5538e6,_0x4c5ba6);_0x55977f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3b03('0x7')](e,emitEvent(event));}}module[_0x3b03('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 134b2a5..ecd04a9 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 _0x4e9c=['path','rimraf','../../config/environment','define','MailQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x4e9c,0x118));var _0xc4e9=function(_0x486195,_0x457be4){_0x486195=_0x486195-0x0;var _0x2115e6=_0x4e9c[_0x486195];return _0x2115e6;};'use strict';var _=require(_0xc4e9('0x0'));var util=require(_0xc4e9('0x1'));var logger=require('../../config/logger')(_0xc4e9('0x2'));var moment=require(_0xc4e9('0x3'));var BPromise=require(_0xc4e9('0x4'));var rp=require(_0xc4e9('0x5'));var fs=require('fs');var path=require(_0xc4e9('0x6'));var rimraf=require(_0xc4e9('0x7'));var config=require(_0xc4e9('0x8'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x3821f7,_0x2bc810){return _0x3821f7[_0xc4e9('0x9')](_0xc4e9('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd5=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','../../config/logger','api','moment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3dd5,0x188));var _0x53dd=function(_0xcd1c62,_0x26084c){_0xcd1c62=_0xcd1c62-0x0;var _0x57c137=_0x3dd5[_0xcd1c62];return _0x57c137;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var logger=require(_0x53dd('0x1'))(_0x53dd('0x2'));var moment=require(_0x53dd('0x3'));var BPromise=require(_0x53dd('0x4'));var rp=require(_0x53dd('0x5'));var fs=require('fs');var path=require(_0x53dd('0x6'));var rimraf=require(_0x53dd('0x7'));var config=require(_0x53dd('0x8'));var attributes=require(_0x53dd('0x9'));module[_0x53dd('0xa')]=function(_0x51dc61,_0x436e22){return _0x51dc61['define'](_0x53dd('0xb'),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 15f5f30..0baddc4 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 _0x63a1=['map','include','model','debug','catch','ShowMailQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x63a1,0x1b4));var _0x163a=function(_0x3519a6,_0x114952){_0x3519a6=_0x3519a6-0x0;var _0x5ae646=_0x63a1[_0x3519a6];return _0x5ae646;};'use strict';var _=require(_0x163a('0x0'));var util=require(_0x163a('0x1'));var moment=require(_0x163a('0x2'));var BPromise=require('bluebird');var rs=require(_0x163a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x163a('0x4'))['db'];var utils=require(_0x163a('0x5'));var logger=require('../../config/logger')(_0x163a('0x6'));var config=require(_0x163a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x163a('0x8')]({'port':0x232a});config[_0x163a('0x9')]=_[_0x163a('0xa')](config[_0x163a('0x9')],{'host':_0x163a('0xb'),'port':0x18eb});var socket=require(_0x163a('0xc'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x163a('0xd')](socket);function respondWithRpcPromise(_0x3b7c1e,_0x2de654,_0xae41d5){return new BPromise(function(_0x4443ce,_0x3128d6){return client[_0x163a('0xe')](_0x3b7c1e,_0xae41d5)[_0x163a('0xf')](function(_0x2a6bb0){logger[_0x163a('0x10')](_0x163a('0x11'),_0x2de654,_0x163a('0x12'));logger['debug'](_0x163a('0x13'),_0x2de654,'request\x20sent',JSON[_0x163a('0x14')](_0x2a6bb0));if(_0x2a6bb0[_0x163a('0x15')]){if(_0x2a6bb0[_0x163a('0x15')][_0x163a('0x16')]===0x1f4){logger[_0x163a('0x15')](_0x163a('0x11'),_0x2de654,_0x2a6bb0[_0x163a('0x15')][_0x163a('0x17')]);return _0x3128d6(_0x2a6bb0[_0x163a('0x15')][_0x163a('0x17')]);}logger[_0x163a('0x15')]('MailQueue,\x20%s,\x20%s',_0x2de654,_0x2a6bb0[_0x163a('0x15')]['message']);return _0x4443ce(_0x2a6bb0['error'][_0x163a('0x17')]);}else{logger[_0x163a('0x10')]('MailQueue,\x20%s,\x20%s',_0x2de654,_0x163a('0x12'));_0x4443ce(_0x2a6bb0['result'][_0x163a('0x17')]);}})['catch'](function(_0x5dd6e2){logger[_0x163a('0x15')](_0x163a('0x11'),_0x2de654,_0x5dd6e2);_0x3128d6(_0x5dd6e2);});});}exports[_0x163a('0x18')]=function(_0xb6785d){var _0x54654a=this;return new Promise(function(_0x3f9b62,_0xdcc7a3){return db[_0x163a('0x19')][_0x163a('0x1a')]({'raw':_0xb6785d[_0x163a('0x1b')]?_0xb6785d[_0x163a('0x1b')][_0x163a('0x1c')]===undefined?!![]:![]:!![],'where':_0xb6785d[_0x163a('0x1b')]?_0xb6785d[_0x163a('0x1b')][_0x163a('0x1d')]||null:null,'attributes':_0xb6785d[_0x163a('0x1b')]?_0xb6785d[_0x163a('0x1b')][_0x163a('0x1e')]||null:null,'limit':_0xb6785d[_0x163a('0x1b')]?_0xb6785d[_0x163a('0x1b')][_0x163a('0x1f')]||null:null,'include':_0xb6785d[_0x163a('0x1b')]?_0xb6785d[_0x163a('0x1b')]['include']?_[_0x163a('0x20')](_0xb6785d[_0x163a('0x1b')][_0x163a('0x21')],function(_0x3c3915){return{'model':db[_0x3c3915[_0x163a('0x22')]],'as':_0x3c3915['as'],'attributes':_0x3c3915[_0x163a('0x1e')],'include':_0x3c3915[_0x163a('0x21')]?_[_0x163a('0x20')](_0x3c3915['include'],function(_0x232c0f){return{'model':db[_0x232c0f['model']],'as':_0x232c0f['as'],'attributes':_0x232c0f[_0x163a('0x1e')],'include':_0x232c0f['include']?_['map'](_0x232c0f[_0x163a('0x21')],function(_0x3e2dd0){return{'model':db[_0x3e2dd0[_0x163a('0x22')]],'as':_0x3e2dd0['as'],'attributes':_0x3e2dd0[_0x163a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d35f3){logger[_0x163a('0x10')]('GetMailQueue',_0xb6785d);logger[_0x163a('0x23')]('GetMailQueue',_0xb6785d,JSON[_0x163a('0x14')](_0x1d35f3));_0x3f9b62(_0x1d35f3);})[_0x163a('0x24')](function(_0x309ead){logger['error'](_0x163a('0x18'),_0x309ead[_0x163a('0x17')],_0xb6785d);_0xdcc7a3(_0x54654a[_0x163a('0x15')](0x1f4,_0x309ead[_0x163a('0x17')]));});});};exports[_0x163a('0x25')]=function(_0x4d98c6){var _0x4bcff4=this;return new Promise(function(_0x25ef80,_0x1dd808){return db[_0x163a('0x19')][_0x163a('0x26')]({'raw':_0x4d98c6[_0x163a('0x1b')]?_0x4d98c6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d98c6[_0x163a('0x1b')]?_0x4d98c6[_0x163a('0x1b')][_0x163a('0x1d')]||null:null,'attributes':_0x4d98c6['options']?_0x4d98c6[_0x163a('0x1b')][_0x163a('0x1e')]||null:null,'include':_0x4d98c6[_0x163a('0x1b')]?_0x4d98c6[_0x163a('0x1b')][_0x163a('0x21')]?_[_0x163a('0x20')](_0x4d98c6[_0x163a('0x1b')][_0x163a('0x21')],function(_0x414e53){return{'model':db[_0x414e53[_0x163a('0x22')]],'as':_0x414e53['as'],'attributes':_0x414e53['attributes'],'include':_0x414e53[_0x163a('0x21')]?_[_0x163a('0x20')](_0x414e53[_0x163a('0x21')],function(_0xfc1f68){return{'model':db[_0xfc1f68[_0x163a('0x22')]],'as':_0xfc1f68['as'],'attributes':_0xfc1f68[_0x163a('0x1e')],'include':_0xfc1f68[_0x163a('0x21')]?_['map'](_0xfc1f68[_0x163a('0x21')],function(_0x39e8ad){return{'model':db[_0x39e8ad[_0x163a('0x22')]],'as':_0x39e8ad['as'],'attributes':_0x39e8ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x163a('0xf')](function(_0x37ea58){logger['info'](_0x163a('0x25'),_0x4d98c6);logger['debug'](_0x163a('0x25'),_0x4d98c6,JSON[_0x163a('0x14')](_0x37ea58));_0x25ef80(_0x37ea58);})['catch'](function(_0x24e2de){logger[_0x163a('0x15')](_0x163a('0x25'),_0x24e2de['message'],_0x4d98c6);_0x1dd808(_0x4bcff4[_0x163a('0x15')](0x1f4,_0x24e2de[_0x163a('0x17')]));});});}; \ No newline at end of file +var _0x2305=['info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','model','map','include','debug','ShowMailQueue','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','socket.io-emitter','register'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x2305,0x122));var _0x5230=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x2305[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x5230('0x0'));var util=require(_0x5230('0x1'));var moment=require(_0x5230('0x2'));var BPromise=require(_0x5230('0x3'));var rs=require(_0x5230('0x4'));var fs=require('fs');var Redis=require(_0x5230('0x5'));var db=require(_0x5230('0x6'))['db'];var utils=require(_0x5230('0x7'));var logger=require('../../config/logger')(_0x5230('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5230('0x9')][_0x5230('0xa')]({'port':0x232a});config[_0x5230('0xb')]=_['defaults'](config[_0x5230('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5230('0xc'))(new Redis(config[_0x5230('0xb')]));require('./mailQueue.socket')[_0x5230('0xd')](socket);function respondWithRpcPromise(_0xfaf343,_0x2b958e,_0xf23651){return new BPromise(function(_0x30c4db,_0x17cb6d){return client['request'](_0xfaf343,_0xf23651)['then'](function(_0x2b2c63){logger[_0x5230('0xe')](_0x5230('0xf'),_0x2b958e,_0x5230('0x10'));logger['debug'](_0x5230('0x11'),_0x2b958e,'request\x20sent',JSON[_0x5230('0x12')](_0x2b2c63));if(_0x2b2c63[_0x5230('0x13')]){if(_0x2b2c63[_0x5230('0x13')]['code']===0x1f4){logger[_0x5230('0x13')](_0x5230('0xf'),_0x2b958e,_0x2b2c63['error']['message']);return _0x17cb6d(_0x2b2c63[_0x5230('0x13')]['message']);}logger[_0x5230('0x13')](_0x5230('0xf'),_0x2b958e,_0x2b2c63[_0x5230('0x13')]['message']);return _0x30c4db(_0x2b2c63[_0x5230('0x13')][_0x5230('0x14')]);}else{logger[_0x5230('0xe')](_0x5230('0xf'),_0x2b958e,'request\x20sent');_0x30c4db(_0x2b2c63[_0x5230('0x15')]['message']);}})[_0x5230('0x16')](function(_0xee77e6){logger[_0x5230('0x13')]('MailQueue,\x20%s,\x20%s',_0x2b958e,_0xee77e6);_0x17cb6d(_0xee77e6);});});}exports[_0x5230('0x17')]=function(_0x58f755){var _0x47ee45=this;return new Promise(function(_0x53f805,_0x1ea59a){return db[_0x5230('0x18')][_0x5230('0x19')]({'raw':_0x58f755[_0x5230('0x1a')]?_0x58f755[_0x5230('0x1a')][_0x5230('0x1b')]===undefined?!![]:![]:!![],'where':_0x58f755['options']?_0x58f755[_0x5230('0x1a')][_0x5230('0x1c')]||null:null,'attributes':_0x58f755[_0x5230('0x1a')]?_0x58f755[_0x5230('0x1a')][_0x5230('0x1d')]||null:null,'limit':_0x58f755[_0x5230('0x1a')]?_0x58f755['options'][_0x5230('0x1e')]||null:null,'include':_0x58f755['options']?_0x58f755[_0x5230('0x1a')]['include']?_['map'](_0x58f755[_0x5230('0x1a')]['include'],function(_0x40e7aa){return{'model':db[_0x40e7aa[_0x5230('0x1f')]],'as':_0x40e7aa['as'],'attributes':_0x40e7aa[_0x5230('0x1d')],'include':_0x40e7aa['include']?_[_0x5230('0x20')](_0x40e7aa[_0x5230('0x21')],function(_0x5da0a6){return{'model':db[_0x5da0a6[_0x5230('0x1f')]],'as':_0x5da0a6['as'],'attributes':_0x5da0a6[_0x5230('0x1d')],'include':_0x5da0a6['include']?_[_0x5230('0x20')](_0x5da0a6[_0x5230('0x21')],function(_0x150bdf){return{'model':db[_0x150bdf['model']],'as':_0x150bdf['as'],'attributes':_0x150bdf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42bac7){logger[_0x5230('0xe')](_0x5230('0x17'),_0x58f755);logger[_0x5230('0x22')](_0x5230('0x17'),_0x58f755,JSON[_0x5230('0x12')](_0x42bac7));_0x53f805(_0x42bac7);})[_0x5230('0x16')](function(_0xa4d848){logger['error'](_0x5230('0x17'),_0xa4d848['message'],_0x58f755);_0x1ea59a(_0x47ee45[_0x5230('0x13')](0x1f4,_0xa4d848['message']));});});};exports[_0x5230('0x23')]=function(_0x2b8c83){var _0x11ce68=this;return new Promise(function(_0x218fbb,_0x53c768){return db[_0x5230('0x18')][_0x5230('0x24')]({'raw':_0x2b8c83['options']?_0x2b8c83['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b8c83[_0x5230('0x1a')]?_0x2b8c83['options'][_0x5230('0x1c')]||null:null,'attributes':_0x2b8c83[_0x5230('0x1a')]?_0x2b8c83['options'][_0x5230('0x1d')]||null:null,'include':_0x2b8c83[_0x5230('0x1a')]?_0x2b8c83[_0x5230('0x1a')][_0x5230('0x21')]?_[_0x5230('0x20')](_0x2b8c83[_0x5230('0x1a')]['include'],function(_0x28a861){return{'model':db[_0x28a861[_0x5230('0x1f')]],'as':_0x28a861['as'],'attributes':_0x28a861[_0x5230('0x1d')],'include':_0x28a861[_0x5230('0x21')]?_[_0x5230('0x20')](_0x28a861[_0x5230('0x21')],function(_0xdb9dcb){return{'model':db[_0xdb9dcb[_0x5230('0x1f')]],'as':_0xdb9dcb['as'],'attributes':_0xdb9dcb[_0x5230('0x1d')],'include':_0xdb9dcb[_0x5230('0x21')]?_[_0x5230('0x20')](_0xdb9dcb[_0x5230('0x21')],function(_0x1cca7f){return{'model':db[_0x1cca7f[_0x5230('0x1f')]],'as':_0x1cca7f['as'],'attributes':_0x1cca7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5230('0x25')](function(_0x48c5ee){logger[_0x5230('0xe')](_0x5230('0x23'),_0x2b8c83);logger['debug'](_0x5230('0x23'),_0x2b8c83,JSON[_0x5230('0x12')](_0x48c5ee));_0x218fbb(_0x48c5ee);})[_0x5230('0x16')](function(_0x4959ce){logger[_0x5230('0x13')]('ShowMailQueue',_0x4959ce[_0x5230('0x14')],_0x2b8c83);_0x53c768(_0x11ce68[_0x5230('0x13')](0x1f4,_0x4959ce[_0x5230('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index cb9d69e..1d92879 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 _0x559d=['mailQueue:','./mailQueue.events','save','remove','update','removeListener','register','length'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x559d,0x109));var _0xd559=function(_0x3b91ad,_0x4feee7){_0x3b91ad=_0x3b91ad-0x0;var _0x36f0cc=_0x559d[_0x3b91ad];return _0x36f0cc;};'use strict';var MailQueueEvents=require(_0xd559('0x0'));var events=[_0xd559('0x1'),_0xd559('0x2'),_0xd559('0x3')];function createListener(_0x42be20,_0x2cdce5){return function(_0x2229e8){_0x2cdce5['emit'](_0x42be20,_0x2229e8);};}function removeListener(_0x3653b5,_0x989900){return function(){MailQueueEvents[_0xd559('0x4')](_0x3653b5,_0x989900);};}exports[_0xd559('0x5')]=function(_0x5368c4){for(var _0x1fc512=0x0,_0x1ae7a3=events[_0xd559('0x6')];_0x1fc512<_0x1ae7a3;_0x1fc512++){var _0x442488=events[_0x1fc512];var _0x28f1e3=createListener(_0xd559('0x7')+_0x442488,_0x5368c4);MailQueueEvents['on'](_0x442488,_0x28f1e3);}}; \ No newline at end of file +var _0x93e2=['mailQueue:','./mailQueue.events','remove','update','emit','removeListener'];(function(_0x3f143b,_0x37217a){var _0x257751=function(_0x92a303){while(--_0x92a303){_0x3f143b['push'](_0x3f143b['shift']());}};_0x257751(++_0x37217a);}(_0x93e2,0x139));var _0x293e=function(_0x4a87fc,_0x85d2cc){_0x4a87fc=_0x4a87fc-0x0;var _0x278f47=_0x93e2[_0x4a87fc];return _0x278f47;};'use strict';var MailQueueEvents=require(_0x293e('0x0'));var events=['save',_0x293e('0x1'),_0x293e('0x2')];function createListener(_0x563f1c,_0x31bc95){return function(_0x13ce69){_0x31bc95[_0x293e('0x3')](_0x563f1c,_0x13ce69);};}function removeListener(_0x5d5676,_0x2a5324){return function(){MailQueueEvents[_0x293e('0x4')](_0x5d5676,_0x2a5324);};}exports['register']=function(_0x5b711a){for(var _0x1b9c9b=0x0,_0x5bc5a3=events['length'];_0x1b9c9b<_0x5bc5a3;_0x1b9c9b++){var _0x2bbff5=events[_0x1b9c9b];var _0xf7ded0=createListener(_0x293e('0x5')+_0x2bbff5,_0x5b711a);MailQueueEvents['on'](_0x2bbff5,_0xf7ded0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0261faa..0507c98 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 _0x9699=['/:id','post','put','update','delete','destroy','multer','path','connect-timeout','express','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x3f7595,_0x5ad6a1){var _0x5b763b=function(_0x44d344){while(--_0x44d344){_0x3f7595['push'](_0x3f7595['shift']());}};_0x5b763b(++_0x5ad6a1);}(_0x9699,0x105));var _0x9969=function(_0x42ec09,_0x29ab5b){_0x42ec09=_0x42ec09-0x0;var _0x144584=_0x9699[_0x42ec09];return _0x144584;};'use strict';var multer=require(_0x9969('0x0'));var util=require('util');var path=require(_0x9969('0x1'));var timeout=require(_0x9969('0x2'));var express=require(_0x9969('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9969('0x4'));var controller=require(_0x9969('0x5'));router[_0x9969('0x6')]('/',auth[_0x9969('0x7')](),controller['index']);router[_0x9969('0x6')](_0x9969('0x8'),auth[_0x9969('0x7')](),controller['describe']);router[_0x9969('0x6')](_0x9969('0x9'),auth[_0x9969('0x7')](),controller['show']);router[_0x9969('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9969('0xb')]('/:id',auth[_0x9969('0x7')](),controller[_0x9969('0xc')]);router[_0x9969('0xd')](_0x9969('0x9'),auth['isAuthenticated'](),controller[_0x9969('0xe')]);module['exports']=router; \ No newline at end of file +var _0x288a=['multer','util','path','express','Router','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x288a,0x1c8));var _0xa288=function(_0x4b8d46,_0x747cae){_0x4b8d46=_0x4b8d46-0x0;var _0x3212b1=_0x288a[_0x4b8d46];return _0x3212b1;};'use strict';var multer=require(_0xa288('0x0'));var util=require(_0xa288('0x1'));var path=require(_0xa288('0x2'));var timeout=require('connect-timeout');var express=require(_0xa288('0x3'));var router=express[_0xa288('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa288('0x5'));var controller=require(_0xa288('0x6'));router[_0xa288('0x7')]('/',auth[_0xa288('0x8')](),controller[_0xa288('0x9')]);router[_0xa288('0x7')]('/describe',auth[_0xa288('0x8')](),controller[_0xa288('0xa')]);router['get'](_0xa288('0xb'),auth['isAuthenticated'](),controller[_0xa288('0xc')]);router[_0xa288('0xd')]('/',auth['isAuthenticated'](),controller[_0xa288('0xe')]);router[_0xa288('0xf')](_0xa288('0xb'),auth[_0xa288('0x8')](),controller['update']);router[_0xa288('0x10')](_0xa288('0xb'),auth[_0xa288('0x8')](),controller[_0xa288('0x11')]);module[_0xa288('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 67668f5..ec7ff73 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 _0x36b7=['DATE','moment','sequelize','STRING'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x36b7,0x11d));var _0x736b=function(_0x5a3202,_0x4a9c0d){_0x5a3202=_0x5a3202-0x0;var _0xb4cf2=_0x36b7[_0x5a3202];return _0xb4cf2;};'use strict';var moment=require(_0x736b('0x0'));var Sequelize=require(_0x736b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x736b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x736b('0x2')]},'joinAt':{'type':Sequelize[_0x736b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x736b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5bce=['sequelize','exports','STRING','DATE'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x5bce,0x1a4));var _0xe5bc=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x5bce[_0x2525f1];return _0x13c1b5;};'use strict';var moment=require('moment');var Sequelize=require(_0xe5bc('0x0'));module[_0xe5bc('0x1')]={'uniqueid':{'type':Sequelize[_0xe5bc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe5bc('0x2')]},'joinAt':{'type':Sequelize[_0xe5bc('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe5bc('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe5bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3f712c0..2862e9b 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 _0x9fe9=['type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9fe9,0x17f));var _0x99fe=function(_0x2e8b2d,_0x2cbeb8){_0x2e8b2d=_0x2e8b2d-0x0;var _0x4c0cb2=_0x9fe9[_0x2e8b2d];return _0x4c0cb2;};'use strict';var pdf=require(_0x99fe('0x0'));var emlformat=require(_0x99fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99fe('0x3'));var moment=require('moment');var BPromise=require(_0x99fe('0x4'));var Mustache=require(_0x99fe('0x5'));var util=require('util');var path=require('path');var sox=require(_0x99fe('0x6'));var csv=require(_0x99fe('0x7'));var ejs=require(_0x99fe('0x8'));var fs=require('fs');var _=require(_0x99fe('0x9'));var squel=require(_0x99fe('0xa'));var crypto=require(_0x99fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x99fe('0xc'));var toCsv=require(_0x99fe('0x7'));var querystring=require(_0x99fe('0xd'));var Papa=require(_0x99fe('0xe'));var Redis=require(_0x99fe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x99fe('0x10'));var as=require(_0x99fe('0x11'));var hardwareService=require(_0x99fe('0x12'));var logger=require(_0x99fe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x99fe('0x14'));var licenseUtil=require(_0x99fe('0x15'));var db=require(_0x99fe('0x16'))['db'];function respondWithStatusCode(_0x21ab22,_0x326d3d){_0x326d3d=_0x326d3d||0xcc;return function(_0x3cbf17){if(_0x3cbf17){return _0x21ab22[_0x99fe('0x17')](_0x326d3d);}return _0x21ab22[_0x99fe('0x18')](_0x326d3d)[_0x99fe('0x19')]();};}function respondWithResult(_0x4a7b0e,_0x593a27){_0x593a27=_0x593a27||0xc8;return function(_0x12e3e9){if(_0x12e3e9){return _0x4a7b0e['status'](_0x593a27)[_0x99fe('0x1a')](_0x12e3e9);}};}function respondWithFilteredResult(_0x57b17c,_0x5ba278){return function(_0x45cac2){if(_0x45cac2){var _0x77a3da=_0x45cac2[_0x99fe('0x1b')],_0x208ff8=_0x5ba278['offset'],_0x18898e=_0x5ba278[_0x99fe('0x1c')]+_0x5ba278[_0x99fe('0x1d')],_0x2b45ab;if(_0x18898e>=_0x77a3da){_0x18898e=_0x77a3da;_0x2b45ab=0xc8;}else{_0x2b45ab=0xce;}_0x57b17c[_0x99fe('0x18')](_0x2b45ab);return _0x57b17c['set'](_0x99fe('0x1e'),_0x208ff8+'-'+_0x18898e+'/'+_0x77a3da)[_0x99fe('0x1a')](_0x45cac2);}return null;};}function patchUpdates(_0x63c09a){return function(_0xb413be){try{jsonpatch[_0x99fe('0x1f')](_0xb413be,_0x63c09a,!![]);}catch(_0x2719c7){return BPromise[_0x99fe('0x20')](_0x2719c7);}return _0xb413be[_0x99fe('0x21')]();};}function saveUpdates(_0x3be27f,_0x2e2ec8){return function(_0x12ff4f){if(_0x12ff4f){return _0x12ff4f[_0x99fe('0x22')](_0x3be27f)[_0x99fe('0x23')](function(_0x27afb9){return _0x27afb9;});}return null;};}function removeEntity(_0x566f60,_0x29a8e3){return function(_0x385f3d){if(_0x385f3d){return _0x385f3d[_0x99fe('0x24')]()['then'](function(){_0x566f60[_0x99fe('0x18')](0xcc)[_0x99fe('0x19')]();});}};}function handleEntityNotFound(_0x5bbd98,_0x25574d){return function(_0x2201c8){if(!_0x2201c8){_0x5bbd98[_0x99fe('0x17')](0x194);}return _0x2201c8;};}function handleError(_0x37c126,_0x1f2768){_0x1f2768=_0x1f2768||0x1f4;return function(_0x1f6681){logger['error'](_0x1f6681[_0x99fe('0x25')]);if(_0x1f6681['name']){delete _0x1f6681[_0x99fe('0x26')];}_0x37c126[_0x99fe('0x18')](_0x1f2768)[_0x99fe('0x27')](_0x1f6681);};}exports[_0x99fe('0x28')]=function(_0x47688f,_0x448523){var _0xb58564={},_0x174eac={},_0x25426f={'count':0x0,'rows':[]};var _0x231ad4=_[_0x99fe('0x29')](db[_0x99fe('0x2a')][_0x99fe('0x2b')],function(_0x5a9cbd){return{'name':_0x5a9cbd[_0x99fe('0x2c')],'type':_0x5a9cbd['type'][_0x99fe('0x2d')]};});_0x174eac[_0x99fe('0x2e')]=_[_0x99fe('0x29')](_0x231ad4,_0x99fe('0x26'));_0x174eac[_0x99fe('0x2f')]=_[_0x99fe('0x30')](_0x47688f[_0x99fe('0x2f')]);_0x174eac['filters']=_[_0x99fe('0x31')](_0x174eac[_0x99fe('0x2e')],_0x174eac[_0x99fe('0x2f')]);_0xb58564[_0x99fe('0x32')]=_[_0x99fe('0x31')](_0x174eac[_0x99fe('0x2e')],qs[_0x99fe('0x33')](_0x47688f[_0x99fe('0x2f')][_0x99fe('0x33')]));_0xb58564['attributes']=_0xb58564['attributes'][_0x99fe('0x34')]?_0xb58564[_0x99fe('0x32')]:_0x174eac['model'];if(!_0x47688f['query'][_0x99fe('0x35')](_0x99fe('0x36'))){_0xb58564[_0x99fe('0x1d')]=qs[_0x99fe('0x1d')](_0x47688f[_0x99fe('0x2f')][_0x99fe('0x1d')]);_0xb58564[_0x99fe('0x1c')]=qs[_0x99fe('0x1c')](_0x47688f['query'][_0x99fe('0x1c')]);}_0xb58564[_0x99fe('0x37')]=qs[_0x99fe('0x38')](_0x47688f[_0x99fe('0x2f')][_0x99fe('0x38')]);_0xb58564[_0x99fe('0x39')]=qs[_0x99fe('0x3a')](_['pick'](_0x47688f[_0x99fe('0x2f')],_0x174eac[_0x99fe('0x3a')]),_0x231ad4);if(_0x47688f[_0x99fe('0x2f')][_0x99fe('0x3b')]){_0xb58564[_0x99fe('0x39')]=_[_0x99fe('0x3c')](_0xb58564[_0x99fe('0x39')],{'$or':_[_0x99fe('0x29')](_0x231ad4,function(_0x1341e5){if(_0x1341e5[_0x99fe('0x3d')]!==_0x99fe('0x3e')){var _0x401148={};_0x401148[_0x1341e5[_0x99fe('0x26')]]={'$like':'%'+_0x47688f['query'][_0x99fe('0x3b')]+'%'};return _0x401148;}})});}_0xb58564=_['merge']({},_0xb58564,_0x47688f[_0x99fe('0x3f')]);var _0x570720={'where':_0xb58564[_0x99fe('0x39')]};return db[_0x99fe('0x2a')]['count'](_0x570720)[_0x99fe('0x23')](function(_0x4353cc){_0x25426f[_0x99fe('0x1b')]=_0x4353cc;if(_0x47688f['query'][_0x99fe('0x40')]){_0xb58564[_0x99fe('0x41')]=[{'all':!![]}];}return db[_0x99fe('0x2a')][_0x99fe('0x42')](_0xb58564);})[_0x99fe('0x23')](function(_0x22e258){_0x25426f['rows']=_0x22e258;return _0x25426f;})[_0x99fe('0x23')](respondWithFilteredResult(_0x448523,_0xb58564))[_0x99fe('0x43')](handleError(_0x448523,null));};exports[_0x99fe('0x44')]=function(_0x57a332,_0x406cac){var _0x40000e={'raw':!![],'where':{'id':_0x57a332[_0x99fe('0x45')]['id']}},_0x71ff7c={};_0x71ff7c[_0x99fe('0x2e')]=_['keys'](db[_0x99fe('0x2a')][_0x99fe('0x2b')]);_0x71ff7c['query']=_[_0x99fe('0x30')](_0x57a332[_0x99fe('0x2f')]);_0x71ff7c[_0x99fe('0x3a')]=_['intersection'](_0x71ff7c[_0x99fe('0x2e')],_0x71ff7c[_0x99fe('0x2f')]);_0x40000e['attributes']=_[_0x99fe('0x31')](_0x71ff7c[_0x99fe('0x2e')],qs[_0x99fe('0x33')](_0x57a332[_0x99fe('0x2f')][_0x99fe('0x33')]));_0x40000e[_0x99fe('0x32')]=_0x40000e[_0x99fe('0x32')]['length']?_0x40000e[_0x99fe('0x32')]:_0x71ff7c[_0x99fe('0x2e')];if(_0x57a332['query'][_0x99fe('0x40')]){_0x40000e['include']=[{'all':!![]}];}_0x40000e=_[_0x99fe('0x3c')]({},_0x40000e,_0x57a332[_0x99fe('0x3f')]);return db[_0x99fe('0x2a')]['find'](_0x40000e)['then'](handleEntityNotFound(_0x406cac,null))[_0x99fe('0x23')](respondWithResult(_0x406cac,null))[_0x99fe('0x43')](handleError(_0x406cac,null));};exports[_0x99fe('0x46')]=function(_0x58b875,_0x3a830a){return db[_0x99fe('0x2a')]['create'](_0x58b875['body'],{})[_0x99fe('0x23')](respondWithResult(_0x3a830a,0xc9))['catch'](handleError(_0x3a830a,null));};exports[_0x99fe('0x22')]=function(_0x9b6a37,_0x4cebe3){if(_0x9b6a37[_0x99fe('0x47')]['id']){delete _0x9b6a37['body']['id'];}return db[_0x99fe('0x2a')][_0x99fe('0x48')]({'where':{'id':_0x9b6a37[_0x99fe('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cebe3,null))['then'](saveUpdates(_0x9b6a37[_0x99fe('0x47')],null))[_0x99fe('0x23')](respondWithResult(_0x4cebe3,null))[_0x99fe('0x43')](handleError(_0x4cebe3,null));};exports[_0x99fe('0x24')]=function(_0x2828c3,_0x12ca2e){return db[_0x99fe('0x2a')][_0x99fe('0x48')]({'where':{'id':_0x2828c3['params']['id']}})[_0x99fe('0x23')](handleEntityNotFound(_0x12ca2e,null))[_0x99fe('0x23')](removeEntity(_0x12ca2e,null))[_0x99fe('0x43')](handleError(_0x12ca2e,null));};exports[_0x99fe('0x49')]=function(_0x53e117,_0x1f5cb1){return db[_0x99fe('0x2a')][_0x99fe('0x49')]()[_0x99fe('0x23')](respondWithResult(_0x1f5cb1,null))['catch'](handleError(_0x1f5cb1,null));}; \ No newline at end of file +var _0xf44d=['params','fields','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x22999e,_0x9d57f2){var _0x4650a6=function(_0x42997){while(--_0x42997){_0x22999e['push'](_0x22999e['shift']());}};_0x4650a6(++_0x9d57f2);}(_0xf44d,0x13f));var _0xdf44=function(_0x3f00c6,_0x425ec8){_0x3f00c6=_0x3f00c6-0x0;var _0x53aaa8=_0xf44d[_0x3f00c6];return _0x53aaa8;};'use strict';var pdf=require(_0xdf44('0x0'));var emlformat=require(_0xdf44('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf44('0x2'));var jsonpatch=require(_0xdf44('0x3'));var rp=require(_0xdf44('0x4'));var moment=require(_0xdf44('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf44('0x6'));var util=require(_0xdf44('0x7'));var path=require(_0xdf44('0x8'));var sox=require(_0xdf44('0x9'));var csv=require(_0xdf44('0xa'));var ejs=require(_0xdf44('0xb'));var fs=require('fs');var _=require(_0xdf44('0xc'));var squel=require(_0xdf44('0xd'));var crypto=require(_0xdf44('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf44('0xf'));var toCsv=require(_0xdf44('0xa'));var querystring=require(_0xdf44('0x10'));var Papa=require(_0xdf44('0x11'));var Redis=require(_0xdf44('0x12'));var authService=require(_0xdf44('0x13'));var qs=require(_0xdf44('0x14'));var as=require(_0xdf44('0x15'));var hardwareService=require(_0xdf44('0x16'));var logger=require(_0xdf44('0x17'))('api');var utils=require(_0xdf44('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdf44('0x19'))['db'];function respondWithStatusCode(_0x191aa2,_0x4cca4d){_0x4cca4d=_0x4cca4d||0xcc;return function(_0x2eab4a){if(_0x2eab4a){return _0x191aa2[_0xdf44('0x1a')](_0x4cca4d);}return _0x191aa2['status'](_0x4cca4d)[_0xdf44('0x1b')]();};}function respondWithResult(_0xbca0f8,_0x356b72){_0x356b72=_0x356b72||0xc8;return function(_0x4c3506){if(_0x4c3506){return _0xbca0f8[_0xdf44('0x1c')](_0x356b72)[_0xdf44('0x1d')](_0x4c3506);}};}function respondWithFilteredResult(_0x47578a,_0x2198c7){return function(_0x345f9c){if(_0x345f9c){var _0x2efb38=_0x345f9c[_0xdf44('0x1e')],_0x49eacb=_0x2198c7['offset'],_0x561e86=_0x2198c7[_0xdf44('0x1f')]+_0x2198c7[_0xdf44('0x20')],_0x3ba0d3;if(_0x561e86>=_0x2efb38){_0x561e86=_0x2efb38;_0x3ba0d3=0xc8;}else{_0x3ba0d3=0xce;}_0x47578a['status'](_0x3ba0d3);return _0x47578a['set'](_0xdf44('0x21'),_0x49eacb+'-'+_0x561e86+'/'+_0x2efb38)[_0xdf44('0x1d')](_0x345f9c);}return null;};}function patchUpdates(_0x47e931){return function(_0x436d2f){try{jsonpatch[_0xdf44('0x22')](_0x436d2f,_0x47e931,!![]);}catch(_0x2e987e){return BPromise[_0xdf44('0x23')](_0x2e987e);}return _0x436d2f[_0xdf44('0x24')]();};}function saveUpdates(_0x648bb9,_0x24ae03){return function(_0x5b50b4){if(_0x5b50b4){return _0x5b50b4[_0xdf44('0x25')](_0x648bb9)[_0xdf44('0x26')](function(_0xa86dc){return _0xa86dc;});}return null;};}function removeEntity(_0xef1624,_0x5366f2){return function(_0x21ef11){if(_0x21ef11){return _0x21ef11[_0xdf44('0x27')]()['then'](function(){_0xef1624[_0xdf44('0x1c')](0xcc)[_0xdf44('0x1b')]();});}};}function handleEntityNotFound(_0x3d6598,_0x4e76e9){return function(_0x20ab84){if(!_0x20ab84){_0x3d6598[_0xdf44('0x1a')](0x194);}return _0x20ab84;};}function handleError(_0x246194,_0x3f7eb7){_0x3f7eb7=_0x3f7eb7||0x1f4;return function(_0x2b1267){logger[_0xdf44('0x28')](_0x2b1267[_0xdf44('0x29')]);if(_0x2b1267['name']){delete _0x2b1267[_0xdf44('0x2a')];}_0x246194[_0xdf44('0x1c')](_0x3f7eb7)[_0xdf44('0x2b')](_0x2b1267);};}exports[_0xdf44('0x2c')]=function(_0x49d8e8,_0xa0f5b6){var _0x25af8a={},_0x19d2f9={},_0x26ff84={'count':0x0,'rows':[]};var _0x252b20=_[_0xdf44('0x2d')](db[_0xdf44('0x2e')][_0xdf44('0x2f')],function(_0x5047dd){return{'name':_0x5047dd[_0xdf44('0x30')],'type':_0x5047dd[_0xdf44('0x31')]['key']};});_0x19d2f9[_0xdf44('0x32')]=_[_0xdf44('0x2d')](_0x252b20,_0xdf44('0x2a'));_0x19d2f9[_0xdf44('0x33')]=_[_0xdf44('0x34')](_0x49d8e8[_0xdf44('0x33')]);_0x19d2f9[_0xdf44('0x35')]=_[_0xdf44('0x36')](_0x19d2f9['model'],_0x19d2f9[_0xdf44('0x33')]);_0x25af8a['attributes']=_[_0xdf44('0x36')](_0x19d2f9[_0xdf44('0x32')],qs['fields'](_0x49d8e8[_0xdf44('0x33')]['fields']));_0x25af8a[_0xdf44('0x37')]=_0x25af8a[_0xdf44('0x37')][_0xdf44('0x38')]?_0x25af8a[_0xdf44('0x37')]:_0x19d2f9[_0xdf44('0x32')];if(!_0x49d8e8[_0xdf44('0x33')][_0xdf44('0x39')](_0xdf44('0x3a'))){_0x25af8a[_0xdf44('0x20')]=qs['limit'](_0x49d8e8['query']['limit']);_0x25af8a['offset']=qs[_0xdf44('0x1f')](_0x49d8e8['query'][_0xdf44('0x1f')]);}_0x25af8a[_0xdf44('0x3b')]=qs[_0xdf44('0x3c')](_0x49d8e8['query'][_0xdf44('0x3c')]);_0x25af8a[_0xdf44('0x3d')]=qs[_0xdf44('0x35')](_['pick'](_0x49d8e8[_0xdf44('0x33')],_0x19d2f9[_0xdf44('0x35')]),_0x252b20);if(_0x49d8e8[_0xdf44('0x33')]['filter']){_0x25af8a[_0xdf44('0x3d')]=_['merge'](_0x25af8a[_0xdf44('0x3d')],{'$or':_[_0xdf44('0x2d')](_0x252b20,function(_0x431355){if(_0x431355['type']!==_0xdf44('0x3e')){var _0x1484bc={};_0x1484bc[_0x431355[_0xdf44('0x2a')]]={'$like':'%'+_0x49d8e8[_0xdf44('0x33')][_0xdf44('0x3f')]+'%'};return _0x1484bc;}})});}_0x25af8a=_[_0xdf44('0x40')]({},_0x25af8a,_0x49d8e8[_0xdf44('0x41')]);var _0x550a09={'where':_0x25af8a['where']};return db[_0xdf44('0x2e')][_0xdf44('0x1e')](_0x550a09)[_0xdf44('0x26')](function(_0x2573f2){_0x26ff84[_0xdf44('0x1e')]=_0x2573f2;if(_0x49d8e8[_0xdf44('0x33')][_0xdf44('0x42')]){_0x25af8a[_0xdf44('0x43')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdf44('0x44')](_0x25af8a);})[_0xdf44('0x26')](function(_0x11a646){_0x26ff84[_0xdf44('0x45')]=_0x11a646;return _0x26ff84;})[_0xdf44('0x26')](respondWithFilteredResult(_0xa0f5b6,_0x25af8a))['catch'](handleError(_0xa0f5b6,null));};exports[_0xdf44('0x46')]=function(_0xa321d5,_0xa71122){var _0xaebb64={'raw':!![],'where':{'id':_0xa321d5[_0xdf44('0x47')]['id']}},_0x4d009b={};_0x4d009b['model']=_[_0xdf44('0x34')](db[_0xdf44('0x2e')][_0xdf44('0x2f')]);_0x4d009b[_0xdf44('0x33')]=_[_0xdf44('0x34')](_0xa321d5['query']);_0x4d009b[_0xdf44('0x35')]=_[_0xdf44('0x36')](_0x4d009b[_0xdf44('0x32')],_0x4d009b[_0xdf44('0x33')]);_0xaebb64['attributes']=_[_0xdf44('0x36')](_0x4d009b[_0xdf44('0x32')],qs[_0xdf44('0x48')](_0xa321d5[_0xdf44('0x33')][_0xdf44('0x48')]));_0xaebb64[_0xdf44('0x37')]=_0xaebb64[_0xdf44('0x37')]['length']?_0xaebb64[_0xdf44('0x37')]:_0x4d009b['model'];if(_0xa321d5[_0xdf44('0x33')][_0xdf44('0x42')]){_0xaebb64[_0xdf44('0x43')]=[{'all':!![]}];}_0xaebb64=_[_0xdf44('0x40')]({},_0xaebb64,_0xa321d5[_0xdf44('0x41')]);return db[_0xdf44('0x2e')][_0xdf44('0x49')](_0xaebb64)[_0xdf44('0x26')](handleEntityNotFound(_0xa71122,null))[_0xdf44('0x26')](respondWithResult(_0xa71122,null))[_0xdf44('0x4a')](handleError(_0xa71122,null));};exports['create']=function(_0x128727,_0x143034){return db[_0xdf44('0x2e')][_0xdf44('0x4b')](_0x128727[_0xdf44('0x4c')],{})[_0xdf44('0x26')](respondWithResult(_0x143034,0xc9))[_0xdf44('0x4a')](handleError(_0x143034,null));};exports[_0xdf44('0x25')]=function(_0xb9bf55,_0x3a5d25){if(_0xb9bf55[_0xdf44('0x4c')]['id']){delete _0xb9bf55['body']['id'];}return db[_0xdf44('0x2e')][_0xdf44('0x49')]({'where':{'id':_0xb9bf55['params']['id']}})[_0xdf44('0x26')](handleEntityNotFound(_0x3a5d25,null))[_0xdf44('0x26')](saveUpdates(_0xb9bf55[_0xdf44('0x4c')],null))['then'](respondWithResult(_0x3a5d25,null))[_0xdf44('0x4a')](handleError(_0x3a5d25,null));};exports[_0xdf44('0x27')]=function(_0x2c4dc0,_0x3a43f6){return db[_0xdf44('0x2e')][_0xdf44('0x49')]({'where':{'id':_0x2c4dc0[_0xdf44('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a43f6,null))[_0xdf44('0x26')](removeEntity(_0x3a43f6,null))['catch'](handleError(_0x3a43f6,null));};exports[_0xdf44('0x4d')]=function(_0x22146b,_0x543f6e){return db[_0xdf44('0x2e')][_0xdf44('0x4d')]()[_0xdf44('0x26')](respondWithResult(_0x543f6e,null))[_0xdf44('0x4a')](handleError(_0x543f6e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 976b643..60beede 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 _0x33bf=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2ac334,_0x3f2235){var _0x3850d3=function(_0x1599c7){while(--_0x1599c7){_0x2ac334['push'](_0x2ac334['shift']());}};_0x3850d3(++_0x3f2235);}(_0x33bf,0x125));var _0xf33b=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x33bf[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0xf33b('0x0'));var util=require(_0xf33b('0x1'));var logger=require(_0xf33b('0x2'))('api');var moment=require(_0xf33b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf33b('0x4'));var fs=require('fs');var path=require(_0xf33b('0x5'));var rimraf=require('rimraf');var config=require(_0xf33b('0x6'));var attributes=require(_0xf33b('0x7'));module[_0xf33b('0x8')]=function(_0x2ef02d,_0x483c1e){return _0x2ef02d[_0xf33b('0x9')](_0xf33b('0xa'),attributes,{'tableName':_0xf33b('0xb'),'paranoid':![],'indexes':[{'name':_0xf33b('0xc'),'fields':[_0xf33b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x19053d,_0xdcfb4d){var _0x51a086=function(_0x4f97c5){while(--_0x4f97c5){_0x19053d['push'](_0x19053d['shift']());}};_0x51a086(++_0xdcfb4d);}(_0x9649,0x19f));var _0x9964=function(_0x4ce30a,_0x4f772e){_0x4ce30a=_0x4ce30a-0x0;var _0x285771=_0x9649[_0x4ce30a];return _0x285771;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9964('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 923990b..1050798 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 _0xa57f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','stringify','UpdateMailQueueReport','update','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x269d4f,_0x39c149){var _0x32d4b1=function(_0x3a3a30){while(--_0x3a3a30){_0x269d4f['push'](_0x269d4f['shift']());}};_0x32d4b1(++_0x39c149);}(_0xa57f,0x188));var _0xfa57=function(_0x1b5737,_0x13de3e){_0x1b5737=_0x1b5737-0x0;var _0x4a8628=_0xa57f[_0x1b5737];return _0x4a8628;};'use strict';var _=require(_0xfa57('0x0'));var util=require('util');var moment=require(_0xfa57('0x1'));var BPromise=require(_0xfa57('0x2'));var rs=require(_0xfa57('0x3'));var fs=require('fs');var Redis=require(_0xfa57('0x4'));var db=require(_0xfa57('0x5'))['db'];var utils=require(_0xfa57('0x6'));var logger=require(_0xfa57('0x7'))(_0xfa57('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa57('0x9')][_0xfa57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7d5f,_0x508b9e,_0xd3f7cd){return new BPromise(function(_0x2ecb48,_0x3ef909){return client[_0xfa57('0xb')](_0x4a7d5f,_0xd3f7cd)[_0xfa57('0xc')](function(_0x4e8c1a){logger[_0xfa57('0xd')](_0xfa57('0xe'),_0x508b9e,_0xfa57('0xf'));logger[_0xfa57('0x10')](_0xfa57('0x11'),_0x508b9e,_0xfa57('0xf'),JSON['stringify'](_0x4e8c1a));if(_0x4e8c1a[_0xfa57('0x12')]){if(_0x4e8c1a[_0xfa57('0x12')][_0xfa57('0x13')]===0x1f4){logger[_0xfa57('0x12')](_0xfa57('0xe'),_0x508b9e,_0x4e8c1a[_0xfa57('0x12')][_0xfa57('0x14')]);return _0x3ef909(_0x4e8c1a[_0xfa57('0x12')]['message']);}logger['error'](_0xfa57('0xe'),_0x508b9e,_0x4e8c1a['error'][_0xfa57('0x14')]);return _0x2ecb48(_0x4e8c1a['error']['message']);}else{logger[_0xfa57('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x508b9e,_0xfa57('0xf'));_0x2ecb48(_0x4e8c1a['result'][_0xfa57('0x14')]);}})[_0xfa57('0x15')](function(_0x31da95){logger[_0xfa57('0x12')](_0xfa57('0xe'),_0x508b9e,_0x31da95);_0x3ef909(_0x31da95);});});}exports[_0xfa57('0x16')]=function(_0x1e2eb4){var _0x4ce7c5=this;return new Promise(function(_0xa90fca,_0x43600c){return db[_0xfa57('0x17')][_0xfa57('0x18')](_0x1e2eb4[_0xfa57('0x19')],{'raw':_0x1e2eb4['options']?_0x1e2eb4[_0xfa57('0x1a')][_0xfa57('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x683fb4){logger[_0xfa57('0xd')]('CreateMailQueueReport',_0x1e2eb4);logger[_0xfa57('0x10')]('CreateMailQueueReport',_0x1e2eb4,JSON[_0xfa57('0x1c')](_0x683fb4));_0xa90fca(_0x683fb4);})[_0xfa57('0x15')](function(_0x57115d){logger[_0xfa57('0x12')](_0xfa57('0x16'),_0x57115d[_0xfa57('0x14')],_0x1e2eb4);_0x43600c(_0x4ce7c5['error'](0x1f4,_0x57115d[_0xfa57('0x14')]));});});};exports[_0xfa57('0x1d')]=function(_0x4d6367){var _0x4c0204=this;return new Promise(function(_0x30dd8e,_0x481fd7){return db[_0xfa57('0x17')][_0xfa57('0x1e')](_0x4d6367[_0xfa57('0x19')],{'raw':_0x4d6367['options']?_0x4d6367[_0xfa57('0x1a')][_0xfa57('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d6367[_0xfa57('0x1a')]?_0x4d6367['options']['where']||null:null,'attributes':_0x4d6367[_0xfa57('0x1a')]?_0x4d6367[_0xfa57('0x1a')][_0xfa57('0x1f')]||null:null,'limit':_0x4d6367[_0xfa57('0x1a')]?_0x4d6367[_0xfa57('0x1a')][_0xfa57('0x20')]||null:null})['then'](function(_0x41cba8){logger[_0xfa57('0xd')](_0xfa57('0x1d'),_0x4d6367);logger['debug']('UpdateMailQueueReport',_0x4d6367,JSON[_0xfa57('0x1c')](_0x41cba8));_0x30dd8e(_0x41cba8);})['catch'](function(_0x12a3b4){logger['error'](_0xfa57('0x1d'),_0x12a3b4[_0xfa57('0x14')],_0x4d6367);_0x481fd7(_0x4c0204[_0xfa57('0x12')](0x1f4,_0x12a3b4[_0xfa57('0x14')]));});});}; \ No newline at end of file +var _0x0fa6=['options','raw','then','UpdateMailQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x475741,_0x30bf38){var _0x4e34ec=function(_0x2e91c9){while(--_0x2e91c9){_0x475741['push'](_0x475741['shift']());}};_0x4e34ec(++_0x30bf38);}(_0x0fa6,0x86));var _0x60fa=function(_0x4105fa,_0x22a667){_0x4105fa=_0x4105fa-0x0;var _0x5e197c=_0x0fa6[_0x4105fa];return _0x5e197c;};'use strict';var _=require('lodash');var util=require(_0x60fa('0x0'));var moment=require(_0x60fa('0x1'));var BPromise=require(_0x60fa('0x2'));var rs=require(_0x60fa('0x3'));var fs=require('fs');var Redis=require(_0x60fa('0x4'));var db=require(_0x60fa('0x5'))['db'];var utils=require(_0x60fa('0x6'));var logger=require(_0x60fa('0x7'))(_0x60fa('0x8'));var config=require('../../config/environment');var jayson=require(_0x60fa('0x9'));var client=jayson['client'][_0x60fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166471,_0x3d9252,_0x1c940c){return new BPromise(function(_0x43484a,_0x10f699){return client[_0x60fa('0xb')](_0x166471,_0x1c940c)['then'](function(_0x5eff65){logger['info'](_0x60fa('0xc'),_0x3d9252,_0x60fa('0xd'));logger[_0x60fa('0xe')](_0x60fa('0xf'),_0x3d9252,_0x60fa('0xd'),JSON[_0x60fa('0x10')](_0x5eff65));if(_0x5eff65['error']){if(_0x5eff65[_0x60fa('0x11')][_0x60fa('0x12')]===0x1f4){logger['error'](_0x60fa('0xc'),_0x3d9252,_0x5eff65['error'][_0x60fa('0x13')]);return _0x10f699(_0x5eff65['error'][_0x60fa('0x13')]);}logger['error'](_0x60fa('0xc'),_0x3d9252,_0x5eff65[_0x60fa('0x11')]['message']);return _0x43484a(_0x5eff65[_0x60fa('0x11')][_0x60fa('0x13')]);}else{logger[_0x60fa('0x14')](_0x60fa('0xc'),_0x3d9252,_0x60fa('0xd'));_0x43484a(_0x5eff65[_0x60fa('0x15')][_0x60fa('0x13')]);}})[_0x60fa('0x16')](function(_0x20f334){logger[_0x60fa('0x11')](_0x60fa('0xc'),_0x3d9252,_0x20f334);_0x10f699(_0x20f334);});});}exports[_0x60fa('0x17')]=function(_0x10c799){var _0x15c5cf=this;return new Promise(function(_0x4ee135,_0x45b403){return db[_0x60fa('0x18')]['create'](_0x10c799[_0x60fa('0x19')],{'raw':_0x10c799[_0x60fa('0x1a')]?_0x10c799[_0x60fa('0x1a')][_0x60fa('0x1b')]===undefined?!![]:![]:!![]})[_0x60fa('0x1c')](function(_0x15c3d3){logger[_0x60fa('0x14')](_0x60fa('0x17'),_0x10c799);logger[_0x60fa('0xe')](_0x60fa('0x17'),_0x10c799,JSON[_0x60fa('0x10')](_0x15c3d3));_0x4ee135(_0x15c3d3);})[_0x60fa('0x16')](function(_0xba5813){logger[_0x60fa('0x11')]('CreateMailQueueReport',_0xba5813[_0x60fa('0x13')],_0x10c799);_0x45b403(_0x15c5cf[_0x60fa('0x11')](0x1f4,_0xba5813[_0x60fa('0x13')]));});});};exports[_0x60fa('0x1d')]=function(_0x5f27cf){var _0xfde714=this;return new Promise(function(_0x1b632b,_0x84b0a4){return db[_0x60fa('0x18')][_0x60fa('0x1e')](_0x5f27cf[_0x60fa('0x19')],{'raw':_0x5f27cf[_0x60fa('0x1a')]?_0x5f27cf['options'][_0x60fa('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f27cf[_0x60fa('0x1a')]?_0x5f27cf[_0x60fa('0x1a')]['where']||null:null,'attributes':_0x5f27cf[_0x60fa('0x1a')]?_0x5f27cf[_0x60fa('0x1a')]['attributes']||null:null,'limit':_0x5f27cf[_0x60fa('0x1a')]?_0x5f27cf[_0x60fa('0x1a')][_0x60fa('0x1f')]||null:null})[_0x60fa('0x1c')](function(_0x45c04a){logger[_0x60fa('0x14')](_0x60fa('0x1d'),_0x5f27cf);logger[_0x60fa('0xe')]('UpdateMailQueueReport',_0x5f27cf,JSON['stringify'](_0x45c04a));_0x1b632b(_0x45c04a);})[_0x60fa('0x16')](function(_0x192b1a){logger[_0x60fa('0x11')](_0x60fa('0x1d'),_0x192b1a[_0x60fa('0x13')],_0x5f27cf);_0x84b0a4(_0xfde714[_0x60fa('0x11')](0x1f4,_0x192b1a[_0x60fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7c88575..ed3d24a 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 _0xaeb1=['multer','util','path','connect-timeout','express','Router'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xaeb1,0x114));var _0x1aeb=function(_0x17c20f,_0x2ed078){_0x17c20f=_0x17c20f-0x0;var _0x28a66e=_0xaeb1[_0x17c20f];return _0x28a66e;};'use strict';var multer=require(_0x1aeb('0x0'));var util=require(_0x1aeb('0x1'));var path=require(_0x1aeb('0x2'));var timeout=require(_0x1aeb('0x3'));var express=require(_0x1aeb('0x4'));var router=express[_0x1aeb('0x5')]();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 _0x1554=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express','Router'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x1554,0xa5));var _0x4155=function(_0x4ec62f,_0x129364){_0x4ec62f=_0x4ec62f-0x0;var _0x3e3027=_0x1554[_0x4ec62f];return _0x3e3027;};'use strict';var multer=require(_0x4155('0x0'));var util=require(_0x4155('0x1'));var path=require(_0x4155('0x2'));var timeout=require(_0x4155('0x3'));var express=require(_0x4155('0x4'));var router=express[_0x4155('0x5')]();var auth=require(_0x4155('0x6'));var interaction=require(_0x4155('0x7'));var config=require(_0x4155('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 873e875..aa36037 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 _0xe021=['BOOLEAN','username','INTEGER','exports','STRING'];(function(_0x34877a,_0x4e92f8){var _0x2a06b8=function(_0x2c75dc){while(--_0x2c75dc){_0x34877a['push'](_0x34877a['shift']());}};_0x2a06b8(++_0x4e92f8);}(_0xe021,0x1b6));var _0x1e02=function(_0x649764,_0x51c4a2){_0x649764=_0x649764-0x0;var _0x16aadd=_0xe021[_0x649764];return _0x16aadd;};'use strict';var Sequelize=require('sequelize');module[_0x1e02('0x0')]={'description':{'type':Sequelize[_0x1e02('0x1')]},'host':{'type':Sequelize[_0x1e02('0x1')]},'authentication':{'type':Sequelize[_0x1e02('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1e02('0x1')],'unique':_0x1e02('0x3')},'password':{'type':Sequelize[_0x1e02('0x1')]},'port':{'type':Sequelize[_0x1e02('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1e02('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x1e02('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1e02('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1e02('0x1')]}}; \ No newline at end of file +var _0x2d48=['exports','STRING','INTEGER','INBOX'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x2d48,0x8c));var _0x82d4=function(_0x11e1ab,_0x4bb093){_0x11e1ab=_0x11e1ab-0x0;var _0x530ca0=_0x2d48[_0x11e1ab];return _0x530ca0;};'use strict';var Sequelize=require('sequelize');module[_0x82d4('0x0')]={'description':{'type':Sequelize[_0x82d4('0x1')]},'host':{'type':Sequelize[_0x82d4('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x82d4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x82d4('0x1')]},'port':{'type':Sequelize[_0x82d4('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x82d4('0x3')},'connTimeout':{'type':Sequelize[_0x82d4('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x82d4('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x82d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1fb1ac7..4e5e8b5 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x27def7,_0x3f0835){var _0x581cbc=function(_0x5b8ae4){while(--_0x5b8ae4){_0x27def7['push'](_0x27def7['shift']());}};_0x581cbc(++_0x3f0835);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xe5b5[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['request-promise','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2acb61,_0x35278f){var _0x139a40=function(_0x302113){while(--_0x302113){_0x2acb61['push'](_0x2acb61['shift']());}};_0x139a40(++_0x35278f);}(_0x42f4,0x19d));var _0x442f=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x42f4[_0x330414];return _0x99dbff;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 4795d7e..9b342b0 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 _0xf367=['request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5d3e09,_0x4b6360){var _0x213f49=function(_0x3a5a72){while(--_0x3a5a72){_0x5d3e09['push'](_0x5d3e09['shift']());}};_0x213f49(++_0x4b6360);}(_0xf367,0x7f));var _0x7f36=function(_0x511449,_0x548794){_0x511449=_0x511449-0x0;var _0x32ce12=_0xf367[_0x511449];return _0x32ce12;};'use strict';var _=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var moment=require(_0x7f36('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f36('0x3'));var fs=require('fs');var Redis=require(_0x7f36('0x4'));var db=require(_0x7f36('0x5'))['db'];var utils=require(_0x7f36('0x6'));var logger=require(_0x7f36('0x7'))(_0x7f36('0x8'));var config=require(_0x7f36('0x9'));var jayson=require(_0x7f36('0xa'));var client=jayson[_0x7f36('0xb')][_0x7f36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57edbf,_0x2d7b05,_0x1afd04){return new BPromise(function(_0x9e6d5d,_0x41b930){return client[_0x7f36('0xd')](_0x57edbf,_0x1afd04)[_0x7f36('0xe')](function(_0x281249){logger[_0x7f36('0xf')](_0x7f36('0x10'),_0x2d7b05,'request\x20sent');logger[_0x7f36('0x11')](_0x7f36('0x12'),_0x2d7b05,_0x7f36('0x13'),JSON[_0x7f36('0x14')](_0x281249));if(_0x281249[_0x7f36('0x15')]){if(_0x281249['error'][_0x7f36('0x16')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2d7b05,_0x281249['error']['message']);return _0x41b930(_0x281249[_0x7f36('0x15')][_0x7f36('0x17')]);}logger[_0x7f36('0x15')](_0x7f36('0x10'),_0x2d7b05,_0x281249['error'][_0x7f36('0x17')]);return _0x9e6d5d(_0x281249[_0x7f36('0x15')][_0x7f36('0x17')]);}else{logger[_0x7f36('0xf')](_0x7f36('0x10'),_0x2d7b05,'request\x20sent');_0x9e6d5d(_0x281249['result'][_0x7f36('0x17')]);}})[_0x7f36('0x18')](function(_0x4d80a2){logger[_0x7f36('0x15')](_0x7f36('0x10'),_0x2d7b05,_0x4d80a2);_0x41b930(_0x4d80a2);});});}exports[_0x7f36('0x19')]=function(_0xf727c){var _0x252c5f=this;return new Promise(function(_0x14f057,_0x49e980){return db[_0x7f36('0x1a')]['findAll']({'raw':_0xf727c[_0x7f36('0x1b')]?_0xf727c['options'][_0x7f36('0x1c')]===undefined?!![]:![]:!![],'where':_0xf727c[_0x7f36('0x1b')]?_0xf727c[_0x7f36('0x1b')][_0x7f36('0x1d')]||null:null,'attributes':_0xf727c[_0x7f36('0x1b')]?_0xf727c[_0x7f36('0x1b')][_0x7f36('0x1e')]||null:null,'limit':_0xf727c[_0x7f36('0x1b')]?_0xf727c[_0x7f36('0x1b')][_0x7f36('0x1f')]||null:null,'include':_0xf727c['options']?_0xf727c[_0x7f36('0x1b')][_0x7f36('0x20')]?_[_0x7f36('0x21')](_0xf727c[_0x7f36('0x1b')]['include'],function(_0x289174){return{'model':db[_0x289174[_0x7f36('0x22')]],'as':_0x289174['as'],'attributes':_0x289174['attributes'],'include':_0x289174[_0x7f36('0x20')]?_[_0x7f36('0x21')](_0x289174['include'],function(_0x5e0d68){return{'model':db[_0x5e0d68['model']],'as':_0x5e0d68['as'],'attributes':_0x5e0d68[_0x7f36('0x1e')],'include':_0x5e0d68[_0x7f36('0x20')]?_[_0x7f36('0x21')](_0x5e0d68[_0x7f36('0x20')],function(_0xf7d4a5){return{'model':db[_0xf7d4a5['model']],'as':_0xf7d4a5['as'],'attributes':_0xf7d4a5[_0x7f36('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7f36('0xe')](function(_0xb43504){logger['info'](_0x7f36('0x19'),_0xf727c);logger['debug'](_0x7f36('0x19'),_0xf727c,JSON[_0x7f36('0x14')](_0xb43504));_0x14f057(_0xb43504);})[_0x7f36('0x18')](function(_0x86ecdf){logger[_0x7f36('0x15')]('GetMailServerIn',_0x86ecdf[_0x7f36('0x17')],_0xf727c);_0x49e980(_0x252c5f[_0x7f36('0x15')](0x1f4,_0x86ecdf['message']));});});}; \ No newline at end of file +var _0x8b07=['info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b07,0x102));var _0x78b0=function(_0xcb0a0c,_0xdc69c2){_0xcb0a0c=_0xcb0a0c-0x0;var _0x53ad98=_0x8b07[_0xcb0a0c];return _0x53ad98;};'use strict';var _=require(_0x78b0('0x0'));var util=require(_0x78b0('0x1'));var moment=require(_0x78b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x78b0('0x3'));var fs=require('fs');var Redis=require(_0x78b0('0x4'));var db=require(_0x78b0('0x5'))['db'];var utils=require(_0x78b0('0x6'));var logger=require(_0x78b0('0x7'))('rpc');var config=require(_0x78b0('0x8'));var jayson=require(_0x78b0('0x9'));var client=jayson[_0x78b0('0xa')][_0x78b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31bdd4,_0x2a7882,_0x558f85){return new BPromise(function(_0x17994f,_0x3d7e72){return client[_0x78b0('0xc')](_0x31bdd4,_0x558f85)[_0x78b0('0xd')](function(_0x126fa9){logger[_0x78b0('0xe')](_0x78b0('0xf'),_0x2a7882,'request\x20sent');logger[_0x78b0('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2a7882,_0x78b0('0x11'),JSON[_0x78b0('0x12')](_0x126fa9));if(_0x126fa9[_0x78b0('0x13')]){if(_0x126fa9[_0x78b0('0x13')][_0x78b0('0x14')]===0x1f4){logger['error'](_0x78b0('0xf'),_0x2a7882,_0x126fa9[_0x78b0('0x13')][_0x78b0('0x15')]);return _0x3d7e72(_0x126fa9['error'][_0x78b0('0x15')]);}logger['error'](_0x78b0('0xf'),_0x2a7882,_0x126fa9[_0x78b0('0x13')]['message']);return _0x17994f(_0x126fa9[_0x78b0('0x13')]['message']);}else{logger['info'](_0x78b0('0xf'),_0x2a7882,_0x78b0('0x11'));_0x17994f(_0x126fa9[_0x78b0('0x16')][_0x78b0('0x15')]);}})[_0x78b0('0x17')](function(_0x5148b9){logger[_0x78b0('0x13')](_0x78b0('0xf'),_0x2a7882,_0x5148b9);_0x3d7e72(_0x5148b9);});});}exports[_0x78b0('0x18')]=function(_0x53644f){var _0x3d7e60=this;return new Promise(function(_0x4e25bb,_0x31e103){return db[_0x78b0('0x19')][_0x78b0('0x1a')]({'raw':_0x53644f[_0x78b0('0x1b')]?_0x53644f[_0x78b0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x53644f[_0x78b0('0x1b')]?_0x53644f[_0x78b0('0x1b')][_0x78b0('0x1c')]||null:null,'attributes':_0x53644f[_0x78b0('0x1b')]?_0x53644f[_0x78b0('0x1b')][_0x78b0('0x1d')]||null:null,'limit':_0x53644f[_0x78b0('0x1b')]?_0x53644f[_0x78b0('0x1b')][_0x78b0('0x1e')]||null:null,'include':_0x53644f[_0x78b0('0x1b')]?_0x53644f['options'][_0x78b0('0x1f')]?_[_0x78b0('0x20')](_0x53644f[_0x78b0('0x1b')][_0x78b0('0x1f')],function(_0x49557d){return{'model':db[_0x49557d[_0x78b0('0x21')]],'as':_0x49557d['as'],'attributes':_0x49557d[_0x78b0('0x1d')],'include':_0x49557d[_0x78b0('0x1f')]?_[_0x78b0('0x20')](_0x49557d[_0x78b0('0x1f')],function(_0x1c5eed){return{'model':db[_0x1c5eed[_0x78b0('0x21')]],'as':_0x1c5eed['as'],'attributes':_0x1c5eed[_0x78b0('0x1d')],'include':_0x1c5eed['include']?_[_0x78b0('0x20')](_0x1c5eed['include'],function(_0x562067){return{'model':db[_0x562067[_0x78b0('0x21')]],'as':_0x562067['as'],'attributes':_0x562067[_0x78b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x78b0('0xd')](function(_0x24f1de){logger[_0x78b0('0xe')](_0x78b0('0x18'),_0x53644f);logger[_0x78b0('0x10')](_0x78b0('0x18'),_0x53644f,JSON[_0x78b0('0x12')](_0x24f1de));_0x4e25bb(_0x24f1de);})[_0x78b0('0x17')](function(_0x9c6d41){logger[_0x78b0('0x13')](_0x78b0('0x18'),_0x9c6d41[_0x78b0('0x15')],_0x53644f);_0x31e103(_0x3d7e60[_0x78b0('0x13')](0x1f4,_0x9c6d41['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b6e74d8..7a36f73 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 _0x93aa=['update','delete','exports','multer','util','path','express','Router','./mailServerOut.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x16f775,_0x45b10f){var _0x17d9e2=function(_0x3d2ccf){while(--_0x3d2ccf){_0x16f775['push'](_0x16f775['shift']());}};_0x17d9e2(++_0x45b10f);}(_0x93aa,0x1df));var _0xa93a=function(_0x419e8d,_0x8fd8c2){_0x419e8d=_0x419e8d-0x0;var _0x542721=_0x93aa[_0x419e8d];return _0x542721;};'use strict';var multer=require(_0xa93a('0x0'));var util=require(_0xa93a('0x1'));var path=require(_0xa93a('0x2'));var timeout=require('connect-timeout');var express=require(_0xa93a('0x3'));var router=express[_0xa93a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa93a('0x5'));router[_0xa93a('0x6')]('/',auth['isAuthenticated'](),controller[_0xa93a('0x7')]);router['get'](_0xa93a('0x8'),auth[_0xa93a('0x9')](),controller[_0xa93a('0xa')]);router[_0xa93a('0xb')]('/',auth[_0xa93a('0x9')](),controller[_0xa93a('0xc')]);router[_0xa93a('0xd')](_0xa93a('0x8'),auth[_0xa93a('0x9')](),controller[_0xa93a('0xe')]);router[_0xa93a('0xf')](_0xa93a('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa93a('0x10')]=router; \ No newline at end of file +var _0x2def=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','show','post','update','destroy'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0x2def,0x6d));var _0xf2de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2def[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf2de('0x0'));var util=require(_0xf2de('0x1'));var path=require(_0xf2de('0x2'));var timeout=require(_0xf2de('0x3'));var express=require(_0xf2de('0x4'));var router=express[_0xf2de('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf2de('0x6'));var config=require(_0xf2de('0x7'));var controller=require(_0xf2de('0x8'));router['get']('/',auth[_0xf2de('0x9')](),controller[_0xf2de('0xa')]);router[_0xf2de('0xb')](_0xf2de('0xc'),auth[_0xf2de('0x9')](),controller[_0xf2de('0xd')]);router[_0xf2de('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf2de('0xc'),auth[_0xf2de('0x9')](),controller[_0xf2de('0xf')]);router['delete'](_0xf2de('0xc'),auth[_0xf2de('0x9')](),controller[_0xf2de('0x10')]);module[_0xf2de('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index c9ca767..390f6f7 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 _0x147b=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x147b,0x193));var _0xb147=function(_0x2948ba,_0x119762){_0x2948ba=_0x2948ba-0x0;var _0x39859e=_0x147b[_0x2948ba];return _0x39859e;};'use strict';var Sequelize=require(_0xb147('0x0'));module[_0xb147('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb147('0x2')]},'user':{'type':Sequelize[_0xb147('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb147('0x3')]},'secure':{'type':Sequelize[_0xb147('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xb147('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5e0c=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x88d024,_0x5ba904){var _0x37a4fd=function(_0x31b186){while(--_0x31b186){_0x88d024['push'](_0x88d024['shift']());}};_0x37a4fd(++_0x5ba904);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x400da3,_0x55d4fa){_0x400da3=_0x400da3-0x0;var _0x1c7073=_0x5e0c[_0x400da3];return _0x1c7073;};'use strict';var Sequelize=require('sequelize');module[_0xc5e0('0x0')]={'description':{'type':Sequelize[_0xc5e0('0x1')]},'host':{'type':Sequelize[_0xc5e0('0x1')]},'user':{'type':Sequelize[_0xc5e0('0x1')]},'pass':{'type':Sequelize[_0xc5e0('0x1')]},'port':{'type':Sequelize[_0xc5e0('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xc5e0('0x1')]},'authentication':{'type':Sequelize[_0xc5e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d88cebd..718bf5f 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 _0x409d=['where','type','VIRTUAL','MailServerOut','include','show','params','includeAll','options','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','send','rawAttributes','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x57b1a0,_0x2ca3e2){var _0xc7246a=function(_0x18aa12){while(--_0x18aa12){_0x57b1a0['push'](_0x57b1a0['shift']());}};_0xc7246a(++_0x2ca3e2);}(_0x409d,0x10d));var _0xd409=function(_0x8bd324,_0x3bdac5){_0x8bd324=_0x8bd324-0x0;var _0x3fcb48=_0x409d[_0x8bd324];return _0x3fcb48;};'use strict';var pdf=require(_0xd409('0x0'));var emlformat=require(_0xd409('0x1'));var rimraf=require(_0xd409('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd409('0x3'));var rp=require('request-promise');var moment=require(_0xd409('0x4'));var BPromise=require(_0xd409('0x5'));var Mustache=require(_0xd409('0x6'));var util=require('util');var path=require(_0xd409('0x7'));var sox=require(_0xd409('0x8'));var csv=require('to-csv');var ejs=require(_0xd409('0x9'));var fs=require('fs');var _=require(_0xd409('0xa'));var squel=require(_0xd409('0xb'));var crypto=require('crypto');var jsforce=require(_0xd409('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd409('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd409('0xe'));var authService=require(_0xd409('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd409('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd409('0x11'))(_0xd409('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd409('0x13'));var db=require(_0xd409('0x14'))['db'];function respondWithStatusCode(_0x58012b,_0x1ad6fc){_0x1ad6fc=_0x1ad6fc||0xcc;return function(_0x4edcec){if(_0x4edcec){return _0x58012b[_0xd409('0x15')](_0x1ad6fc);}return _0x58012b['status'](_0x1ad6fc)['end']();};}function respondWithResult(_0x480534,_0x335c36){_0x335c36=_0x335c36||0xc8;return function(_0x31e45b){if(_0x31e45b){return _0x480534[_0xd409('0x16')](_0x335c36)['json'](_0x31e45b);}};}function respondWithFilteredResult(_0x13b821,_0x5996a9){return function(_0x26fe5f){if(_0x26fe5f){var _0x4aa103=_0x26fe5f[_0xd409('0x17')],_0x5f4328=_0x5996a9[_0xd409('0x18')],_0x1fde56=_0x5996a9[_0xd409('0x18')]+_0x5996a9[_0xd409('0x19')],_0x10c87e;if(_0x1fde56>=_0x4aa103){_0x1fde56=_0x4aa103;_0x10c87e=0xc8;}else{_0x10c87e=0xce;}_0x13b821[_0xd409('0x16')](_0x10c87e);return _0x13b821[_0xd409('0x1a')](_0xd409('0x1b'),_0x5f4328+'-'+_0x1fde56+'/'+_0x4aa103)['json'](_0x26fe5f);}return null;};}function patchUpdates(_0x228eb5){return function(_0x5db1e8){try{jsonpatch[_0xd409('0x1c')](_0x5db1e8,_0x228eb5,!![]);}catch(_0x2353ce){return BPromise['reject'](_0x2353ce);}return _0x5db1e8[_0xd409('0x1d')]();};}function saveUpdates(_0x3b3b2d,_0x12c0b2){return function(_0x396c4e){if(_0x396c4e){return _0x396c4e[_0xd409('0x1e')](_0x3b3b2d)[_0xd409('0x1f')](function(_0x5a1686){return _0x5a1686;});}return null;};}function removeEntity(_0x6321b0,_0xcf8d8f){return function(_0x4b08d7){if(_0x4b08d7){return _0x4b08d7[_0xd409('0x20')]()[_0xd409('0x1f')](function(){_0x6321b0[_0xd409('0x16')](0xcc)[_0xd409('0x21')]();});}};}function handleEntityNotFound(_0x38708e,_0x19b074){return function(_0x134116){if(!_0x134116){_0x38708e[_0xd409('0x15')](0x194);}return _0x134116;};}function handleError(_0x92f870,_0x355fcf){_0x355fcf=_0x355fcf||0x1f4;return function(_0x228063){logger[_0xd409('0x22')](_0x228063[_0xd409('0x23')]);if(_0x228063['name']){delete _0x228063['name'];}_0x92f870['status'](_0x355fcf)[_0xd409('0x24')](_0x228063);};}exports['index']=function(_0x1aac58,_0x23bbe8){var _0x5c7f32={},_0x33f97e={},_0x356e4f={'count':0x0,'rows':[]};var _0x121a59=_['map'](db['MailServerOut'][_0xd409('0x25')],function(_0x2eaa1f){return{'name':_0x2eaa1f['fieldName'],'type':_0x2eaa1f['type'][_0xd409('0x26')]};});_0x33f97e[_0xd409('0x27')]=_[_0xd409('0x28')](_0x121a59,_0xd409('0x29'));_0x33f97e[_0xd409('0x2a')]=_[_0xd409('0x2b')](_0x1aac58[_0xd409('0x2a')]);_0x33f97e[_0xd409('0x2c')]=_['intersection'](_0x33f97e['model'],_0x33f97e[_0xd409('0x2a')]);_0x5c7f32[_0xd409('0x2d')]=_[_0xd409('0x2e')](_0x33f97e[_0xd409('0x27')],qs[_0xd409('0x2f')](_0x1aac58[_0xd409('0x2a')][_0xd409('0x2f')]));_0x5c7f32[_0xd409('0x2d')]=_0x5c7f32[_0xd409('0x2d')][_0xd409('0x30')]?_0x5c7f32[_0xd409('0x2d')]:_0x33f97e['model'];if(!_0x1aac58[_0xd409('0x2a')][_0xd409('0x31')]('nolimit')){_0x5c7f32[_0xd409('0x19')]=qs[_0xd409('0x19')](_0x1aac58[_0xd409('0x2a')]['limit']);_0x5c7f32[_0xd409('0x18')]=qs[_0xd409('0x18')](_0x1aac58['query'][_0xd409('0x18')]);}_0x5c7f32[_0xd409('0x32')]=qs['sort'](_0x1aac58[_0xd409('0x2a')]['sort']);_0x5c7f32['where']=qs[_0xd409('0x2c')](_['pick'](_0x1aac58[_0xd409('0x2a')],_0x33f97e['filters']),_0x121a59);if(_0x1aac58[_0xd409('0x2a')]['filter']){_0x5c7f32[_0xd409('0x33')]=_['merge'](_0x5c7f32[_0xd409('0x33')],{'$or':_[_0xd409('0x28')](_0x121a59,function(_0x2248a6){if(_0x2248a6[_0xd409('0x34')]!==_0xd409('0x35')){var _0x1ab725={};_0x1ab725[_0x2248a6[_0xd409('0x29')]]={'$like':'%'+_0x1aac58[_0xd409('0x2a')]['filter']+'%'};return _0x1ab725;}})});}_0x5c7f32=_['merge']({},_0x5c7f32,_0x1aac58['options']);var _0x5408b4={'where':_0x5c7f32[_0xd409('0x33')]};return db[_0xd409('0x36')][_0xd409('0x17')](_0x5408b4)[_0xd409('0x1f')](function(_0x431dc4){_0x356e4f[_0xd409('0x17')]=_0x431dc4;if(_0x1aac58[_0xd409('0x2a')]['includeAll']){_0x5c7f32[_0xd409('0x37')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x5c7f32);})[_0xd409('0x1f')](function(_0x59977b){_0x356e4f['rows']=_0x59977b;return _0x356e4f;})[_0xd409('0x1f')](respondWithFilteredResult(_0x23bbe8,_0x5c7f32))['catch'](handleError(_0x23bbe8,null));};exports[_0xd409('0x38')]=function(_0x3b1bba,_0x4e05e7){var _0x3ebd0a={'raw':!![],'where':{'id':_0x3b1bba[_0xd409('0x39')]['id']}},_0x1b9cb5={};_0x1b9cb5[_0xd409('0x27')]=_[_0xd409('0x2b')](db[_0xd409('0x36')][_0xd409('0x25')]);_0x1b9cb5[_0xd409('0x2a')]=_[_0xd409('0x2b')](_0x3b1bba[_0xd409('0x2a')]);_0x1b9cb5['filters']=_['intersection'](_0x1b9cb5['model'],_0x1b9cb5[_0xd409('0x2a')]);_0x3ebd0a[_0xd409('0x2d')]=_[_0xd409('0x2e')](_0x1b9cb5[_0xd409('0x27')],qs['fields'](_0x3b1bba[_0xd409('0x2a')][_0xd409('0x2f')]));_0x3ebd0a['attributes']=_0x3ebd0a[_0xd409('0x2d')][_0xd409('0x30')]?_0x3ebd0a[_0xd409('0x2d')]:_0x1b9cb5['model'];if(_0x3b1bba[_0xd409('0x2a')][_0xd409('0x3a')]){_0x3ebd0a[_0xd409('0x37')]=[{'all':!![]}];}_0x3ebd0a=_['merge']({},_0x3ebd0a,_0x3b1bba[_0xd409('0x3b')]);return db[_0xd409('0x36')][_0xd409('0x3c')](_0x3ebd0a)[_0xd409('0x1f')](handleEntityNotFound(_0x4e05e7,null))['then'](respondWithResult(_0x4e05e7,null))[_0xd409('0x3d')](handleError(_0x4e05e7,null));};exports['create']=function(_0x5e0c46,_0x1ba571){return db[_0xd409('0x36')][_0xd409('0x3e')](_0x5e0c46['body'],{})['then'](respondWithResult(_0x1ba571,0xc9))['catch'](handleError(_0x1ba571,null));};exports['update']=function(_0x25038f,_0x33d164){if(_0x25038f['body']['id']){delete _0x25038f[_0xd409('0x3f')]['id'];}return db[_0xd409('0x36')][_0xd409('0x3c')]({'where':{'id':_0x25038f[_0xd409('0x39')]['id']}})[_0xd409('0x1f')](handleEntityNotFound(_0x33d164,null))['then'](saveUpdates(_0x25038f['body'],null))['then'](respondWithResult(_0x33d164,null))[_0xd409('0x3d')](handleError(_0x33d164,null));};exports[_0xd409('0x20')]=function(_0xd2a46c,_0x566329){return db[_0xd409('0x36')]['find']({'where':{'id':_0xd2a46c[_0xd409('0x39')]['id']}})[_0xd409('0x1f')](handleEntityNotFound(_0x566329,null))[_0xd409('0x1f')](removeEntity(_0x566329,null))[_0xd409('0x3d')](handleError(_0x566329,null));}; \ No newline at end of file +var _0x7e5a=['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/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','name','send','index','MailServerOut','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x217e5b,_0x53776f){var _0x38f156=function(_0x24a68e){while(--_0x24a68e){_0x217e5b['push'](_0x217e5b['shift']());}};_0x38f156(++_0x53776f);}(_0x7e5a,0x128));var _0xa7e5=function(_0x4c9e6b,_0x39270c){_0x4c9e6b=_0x4c9e6b-0x0;var _0x368a46=_0x7e5a[_0x4c9e6b];return _0x368a46;};'use strict';var pdf=require(_0xa7e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa7e5('0x1'));var jsonpatch=require(_0xa7e5('0x2'));var rp=require(_0xa7e5('0x3'));var moment=require(_0xa7e5('0x4'));var BPromise=require(_0xa7e5('0x5'));var Mustache=require(_0xa7e5('0x6'));var util=require(_0xa7e5('0x7'));var path=require(_0xa7e5('0x8'));var sox=require(_0xa7e5('0x9'));var csv=require(_0xa7e5('0xa'));var ejs=require(_0xa7e5('0xb'));var fs=require('fs');var _=require(_0xa7e5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7e5('0xd'));var deskjs=require(_0xa7e5('0xe'));var toCsv=require(_0xa7e5('0xa'));var querystring=require(_0xa7e5('0xf'));var Papa=require(_0xa7e5('0x10'));var Redis=require(_0xa7e5('0x11'));var authService=require(_0xa7e5('0x12'));var qs=require(_0xa7e5('0x13'));var as=require(_0xa7e5('0x14'));var hardwareService=require(_0xa7e5('0x15'));var logger=require(_0xa7e5('0x16'))('api');var utils=require(_0xa7e5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa7e5('0x18'));var db=require(_0xa7e5('0x19'))['db'];function respondWithStatusCode(_0x1e9b77,_0x314afd){_0x314afd=_0x314afd||0xcc;return function(_0x3ad36e){if(_0x3ad36e){return _0x1e9b77['sendStatus'](_0x314afd);}return _0x1e9b77[_0xa7e5('0x1a')](_0x314afd)[_0xa7e5('0x1b')]();};}function respondWithResult(_0x4d4a72,_0x1c1772){_0x1c1772=_0x1c1772||0xc8;return function(_0x16f86f){if(_0x16f86f){return _0x4d4a72[_0xa7e5('0x1a')](_0x1c1772)[_0xa7e5('0x1c')](_0x16f86f);}};}function respondWithFilteredResult(_0x117133,_0x2f790f){return function(_0x4b670a){if(_0x4b670a){var _0x490813=_0x4b670a[_0xa7e5('0x1d')],_0x45de43=_0x2f790f['offset'],_0x11e613=_0x2f790f['offset']+_0x2f790f[_0xa7e5('0x1e')],_0x12d77a;if(_0x11e613>=_0x490813){_0x11e613=_0x490813;_0x12d77a=0xc8;}else{_0x12d77a=0xce;}_0x117133[_0xa7e5('0x1a')](_0x12d77a);return _0x117133[_0xa7e5('0x1f')](_0xa7e5('0x20'),_0x45de43+'-'+_0x11e613+'/'+_0x490813)[_0xa7e5('0x1c')](_0x4b670a);}return null;};}function patchUpdates(_0x8d5e6f){return function(_0x321343){try{jsonpatch['apply'](_0x321343,_0x8d5e6f,!![]);}catch(_0x591b84){return BPromise[_0xa7e5('0x21')](_0x591b84);}return _0x321343[_0xa7e5('0x22')]();};}function saveUpdates(_0x3b8254,_0x159b41){return function(_0x36e5c3){if(_0x36e5c3){return _0x36e5c3['update'](_0x3b8254)[_0xa7e5('0x23')](function(_0x22bf56){return _0x22bf56;});}return null;};}function removeEntity(_0x576e44,_0x16d836){return function(_0x21c83a){if(_0x21c83a){return _0x21c83a[_0xa7e5('0x24')]()['then'](function(){_0x576e44[_0xa7e5('0x1a')](0xcc)[_0xa7e5('0x1b')]();});}};}function handleEntityNotFound(_0x2a3d0c,_0x2ddffe){return function(_0x22ab5d){if(!_0x22ab5d){_0x2a3d0c[_0xa7e5('0x25')](0x194);}return _0x22ab5d;};}function handleError(_0x2e5177,_0x3e4dc8){_0x3e4dc8=_0x3e4dc8||0x1f4;return function(_0x102e0b){logger['error'](_0x102e0b['stack']);if(_0x102e0b[_0xa7e5('0x26')]){delete _0x102e0b['name'];}_0x2e5177['status'](_0x3e4dc8)[_0xa7e5('0x27')](_0x102e0b);};}exports[_0xa7e5('0x28')]=function(_0xe96042,_0x3e5d1d){var _0x30daff={},_0x4d3ab3={},_0x1a5741={'count':0x0,'rows':[]};var _0x37d3f5=_['map'](db[_0xa7e5('0x29')]['rawAttributes'],function(_0x17bd0e){return{'name':_0x17bd0e[_0xa7e5('0x2a')],'type':_0x17bd0e[_0xa7e5('0x2b')][_0xa7e5('0x2c')]};});_0x4d3ab3[_0xa7e5('0x2d')]=_[_0xa7e5('0x2e')](_0x37d3f5,_0xa7e5('0x26'));_0x4d3ab3[_0xa7e5('0x2f')]=_[_0xa7e5('0x30')](_0xe96042[_0xa7e5('0x2f')]);_0x4d3ab3[_0xa7e5('0x31')]=_[_0xa7e5('0x32')](_0x4d3ab3[_0xa7e5('0x2d')],_0x4d3ab3[_0xa7e5('0x2f')]);_0x30daff[_0xa7e5('0x33')]=_[_0xa7e5('0x32')](_0x4d3ab3['model'],qs[_0xa7e5('0x34')](_0xe96042[_0xa7e5('0x2f')][_0xa7e5('0x34')]));_0x30daff[_0xa7e5('0x33')]=_0x30daff['attributes']['length']?_0x30daff[_0xa7e5('0x33')]:_0x4d3ab3[_0xa7e5('0x2d')];if(!_0xe96042[_0xa7e5('0x2f')][_0xa7e5('0x35')](_0xa7e5('0x36'))){_0x30daff[_0xa7e5('0x1e')]=qs[_0xa7e5('0x1e')](_0xe96042[_0xa7e5('0x2f')]['limit']);_0x30daff[_0xa7e5('0x37')]=qs['offset'](_0xe96042[_0xa7e5('0x2f')][_0xa7e5('0x37')]);}_0x30daff[_0xa7e5('0x38')]=qs[_0xa7e5('0x39')](_0xe96042[_0xa7e5('0x2f')][_0xa7e5('0x39')]);_0x30daff[_0xa7e5('0x3a')]=qs[_0xa7e5('0x31')](_['pick'](_0xe96042[_0xa7e5('0x2f')],_0x4d3ab3[_0xa7e5('0x31')]),_0x37d3f5);if(_0xe96042[_0xa7e5('0x2f')]['filter']){_0x30daff['where']=_[_0xa7e5('0x3b')](_0x30daff['where'],{'$or':_[_0xa7e5('0x2e')](_0x37d3f5,function(_0x2baa2f){if(_0x2baa2f['type']!==_0xa7e5('0x3c')){var _0x58d91a={};_0x58d91a[_0x2baa2f[_0xa7e5('0x26')]]={'$like':'%'+_0xe96042[_0xa7e5('0x2f')][_0xa7e5('0x3d')]+'%'};return _0x58d91a;}})});}_0x30daff=_[_0xa7e5('0x3b')]({},_0x30daff,_0xe96042[_0xa7e5('0x3e')]);var _0x3feab0={'where':_0x30daff[_0xa7e5('0x3a')]};return db[_0xa7e5('0x29')][_0xa7e5('0x1d')](_0x3feab0)[_0xa7e5('0x23')](function(_0x4200dc){_0x1a5741[_0xa7e5('0x1d')]=_0x4200dc;if(_0xe96042['query'][_0xa7e5('0x3f')]){_0x30daff['include']=[{'all':!![]}];}return db[_0xa7e5('0x29')][_0xa7e5('0x40')](_0x30daff);})[_0xa7e5('0x23')](function(_0x3efb0a){_0x1a5741[_0xa7e5('0x41')]=_0x3efb0a;return _0x1a5741;})[_0xa7e5('0x23')](respondWithFilteredResult(_0x3e5d1d,_0x30daff))[_0xa7e5('0x42')](handleError(_0x3e5d1d,null));};exports[_0xa7e5('0x43')]=function(_0x3768fd,_0x4c4a3d){var _0x3727eb={'raw':!![],'where':{'id':_0x3768fd['params']['id']}},_0xc612e5={};_0xc612e5[_0xa7e5('0x2d')]=_[_0xa7e5('0x30')](db[_0xa7e5('0x29')][_0xa7e5('0x44')]);_0xc612e5[_0xa7e5('0x2f')]=_[_0xa7e5('0x30')](_0x3768fd[_0xa7e5('0x2f')]);_0xc612e5[_0xa7e5('0x31')]=_[_0xa7e5('0x32')](_0xc612e5[_0xa7e5('0x2d')],_0xc612e5[_0xa7e5('0x2f')]);_0x3727eb[_0xa7e5('0x33')]=_[_0xa7e5('0x32')](_0xc612e5['model'],qs[_0xa7e5('0x34')](_0x3768fd[_0xa7e5('0x2f')][_0xa7e5('0x34')]));_0x3727eb[_0xa7e5('0x33')]=_0x3727eb['attributes']['length']?_0x3727eb[_0xa7e5('0x33')]:_0xc612e5[_0xa7e5('0x2d')];if(_0x3768fd[_0xa7e5('0x2f')]['includeAll']){_0x3727eb[_0xa7e5('0x45')]=[{'all':!![]}];}_0x3727eb=_[_0xa7e5('0x3b')]({},_0x3727eb,_0x3768fd[_0xa7e5('0x3e')]);return db['MailServerOut'][_0xa7e5('0x46')](_0x3727eb)[_0xa7e5('0x23')](handleEntityNotFound(_0x4c4a3d,null))[_0xa7e5('0x23')](respondWithResult(_0x4c4a3d,null))[_0xa7e5('0x42')](handleError(_0x4c4a3d,null));};exports[_0xa7e5('0x47')]=function(_0x385dfa,_0x171d68){return db[_0xa7e5('0x29')]['create'](_0x385dfa[_0xa7e5('0x48')],{})[_0xa7e5('0x23')](respondWithResult(_0x171d68,0xc9))['catch'](handleError(_0x171d68,null));};exports[_0xa7e5('0x49')]=function(_0x283665,_0x434f90){if(_0x283665[_0xa7e5('0x48')]['id']){delete _0x283665['body']['id'];}return db['MailServerOut'][_0xa7e5('0x46')]({'where':{'id':_0x283665[_0xa7e5('0x4a')]['id']}})[_0xa7e5('0x23')](handleEntityNotFound(_0x434f90,null))[_0xa7e5('0x23')](saveUpdates(_0x283665[_0xa7e5('0x48')],null))[_0xa7e5('0x23')](respondWithResult(_0x434f90,null))[_0xa7e5('0x42')](handleError(_0x434f90,null));};exports[_0xa7e5('0x24')]=function(_0x5418d6,_0xf7b884){return db['MailServerOut']['find']({'where':{'id':_0x5418d6[_0xa7e5('0x4a')]['id']}})[_0xa7e5('0x23')](handleEntityNotFound(_0xf7b884,null))['then'](removeEntity(_0xf7b884,null))[_0xa7e5('0x42')](handleError(_0xf7b884,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 90ef22d..8c994b0 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./mailServerOut.attributes','define','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1e08c7,_0x5bee07){var _0x4ff85f=function(_0x115de5){while(--_0x115de5){_0x1e08c7['push'](_0x1e08c7['shift']());}};_0x4ff85f(++_0x5bee07);}(_0x31f0,0xb7));var _0x031f=function(_0x5cd7e8,_0x2ba24f){_0x5cd7e8=_0x5cd7e8-0x0;var _0xbdf59a=_0x31f0[_0x5cd7e8];return _0xbdf59a;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('MailServerOut',attributes,{'tableName':_0x031f('0x9'),'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 0d8f67a..5e5f5b7 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 _0x7c2c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird'];(function(_0x5a3a52,_0x54f317){var _0xe12ae0=function(_0x4e1cdd){while(--_0x4e1cdd){_0x5a3a52['push'](_0x5a3a52['shift']());}};_0xe12ae0(++_0x54f317);}(_0x7c2c,0x1a1));var _0xc7c2=function(_0x41fb5e,_0x7e09f5){_0x41fb5e=_0x41fb5e-0x0;var _0x51b3cb=_0x7c2c[_0x41fb5e];return _0x51b3cb;};'use strict';var _=require(_0xc7c2('0x0'));var util=require(_0xc7c2('0x1'));var moment=require('moment');var BPromise=require(_0xc7c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7c2('0x4'));var logger=require(_0xc7c2('0x5'))(_0xc7c2('0x6'));var config=require(_0xc7c2('0x7'));var jayson=require(_0xc7c2('0x8'));var client=jayson['client'][_0xc7c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd3bd9a,_0x408408,_0x3ef614){return new BPromise(function(_0x4f58a1,_0x545065){return client[_0xc7c2('0xa')](_0xd3bd9a,_0x3ef614)[_0xc7c2('0xb')](function(_0x4ac69d){logger['info'](_0xc7c2('0xc'),_0x408408,_0xc7c2('0xd'));logger['debug'](_0xc7c2('0xe'),_0x408408,_0xc7c2('0xd'),JSON[_0xc7c2('0xf')](_0x4ac69d));if(_0x4ac69d['error']){if(_0x4ac69d[_0xc7c2('0x10')]['code']===0x1f4){logger[_0xc7c2('0x10')](_0xc7c2('0xc'),_0x408408,_0x4ac69d[_0xc7c2('0x10')][_0xc7c2('0x11')]);return _0x545065(_0x4ac69d[_0xc7c2('0x10')]['message']);}logger[_0xc7c2('0x10')](_0xc7c2('0xc'),_0x408408,_0x4ac69d['error'][_0xc7c2('0x11')]);return _0x4f58a1(_0x4ac69d[_0xc7c2('0x10')][_0xc7c2('0x11')]);}else{logger[_0xc7c2('0x12')](_0xc7c2('0xc'),_0x408408,_0xc7c2('0xd'));_0x4f58a1(_0x4ac69d['result'][_0xc7c2('0x11')]);}})[_0xc7c2('0x13')](function(_0x2c20e9){logger[_0xc7c2('0x10')]('MailServerOut,\x20%s,\x20%s',_0x408408,_0x2c20e9);_0x545065(_0x2c20e9);});});} \ No newline at end of file +var _0x969e=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xe170ca,_0x2c26a2){var _0x51a2c2=function(_0x1c487a){while(--_0x1c487a){_0xe170ca['push'](_0xe170ca['shift']());}};_0x51a2c2(++_0x2c26a2);}(_0x969e,0x1b1));var _0xe969=function(_0x287532,_0xe61ecb){_0x287532=_0x287532-0x0;var _0xf75280=_0x969e[_0x287532];return _0xf75280;};'use strict';var _=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var moment=require('moment');var BPromise=require(_0xe969('0x2'));var rs=require(_0xe969('0x3'));var fs=require('fs');var Redis=require(_0xe969('0x4'));var db=require(_0xe969('0x5'))['db'];var utils=require(_0xe969('0x6'));var logger=require(_0xe969('0x7'))(_0xe969('0x8'));var config=require('../../config/environment');var jayson=require(_0xe969('0x9'));var client=jayson[_0xe969('0xa')][_0xe969('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e4eb4,_0x144bc2,_0x4294ee){return new BPromise(function(_0x8832ee,_0x1182a8){return client[_0xe969('0xc')](_0x1e4eb4,_0x4294ee)['then'](function(_0x2ddc26){logger[_0xe969('0xd')](_0xe969('0xe'),_0x144bc2,_0xe969('0xf'));logger[_0xe969('0x10')](_0xe969('0x11'),_0x144bc2,_0xe969('0xf'),JSON[_0xe969('0x12')](_0x2ddc26));if(_0x2ddc26['error']){if(_0x2ddc26[_0xe969('0x13')][_0xe969('0x14')]===0x1f4){logger[_0xe969('0x13')]('MailServerOut,\x20%s,\x20%s',_0x144bc2,_0x2ddc26[_0xe969('0x13')][_0xe969('0x15')]);return _0x1182a8(_0x2ddc26[_0xe969('0x13')][_0xe969('0x15')]);}logger['error'](_0xe969('0xe'),_0x144bc2,_0x2ddc26[_0xe969('0x13')]['message']);return _0x8832ee(_0x2ddc26['error'][_0xe969('0x15')]);}else{logger[_0xe969('0xd')](_0xe969('0xe'),_0x144bc2,_0xe969('0xf'));_0x8832ee(_0x2ddc26[_0xe969('0x16')][_0xe969('0x15')]);}})[_0xe969('0x17')](function(_0x26ddc7){logger[_0xe969('0x13')](_0xe969('0xe'),_0x144bc2,_0x26ddc7);_0x1182a8(_0x26ddc7);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 148ea13..3b18e4d 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 _0xc334=['/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x1372f6,_0x2af05b){var _0x3b8790=function(_0x266723){while(--_0x266723){_0x1372f6['push'](_0x1372f6['shift']());}};_0x3b8790(++_0x2af05b);}(_0xc334,0x13e));var _0x4c33=function(_0x393c24,_0x29c062){_0x393c24=_0x393c24-0x0;var _0x273e83=_0xc334[_0x393c24];return _0x273e83;};'use strict';var multer=require(_0x4c33('0x0'));var util=require(_0x4c33('0x1'));var path=require('path');var timeout=require(_0x4c33('0x2'));var express=require(_0x4c33('0x3'));var router=express[_0x4c33('0x4')]();var auth=require(_0x4c33('0x5'));var interaction=require(_0x4c33('0x6'));var config=require(_0x4c33('0x7'));var controller=require(_0x4c33('0x8'));router[_0x4c33('0x9')]('/',auth[_0x4c33('0xa')](),controller[_0x4c33('0xb')]);router[_0x4c33('0x9')](_0x4c33('0xc'),auth[_0x4c33('0xa')](),controller[_0x4c33('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4c33('0xe')]);router[_0x4c33('0xf')]('/',auth[_0x4c33('0xa')](),controller[_0x4c33('0x10')]);router['put'](_0x4c33('0x11'),auth['isAuthenticated'](),controller[_0x4c33('0x12')]);router[_0x4c33('0x13')](_0x4c33('0x11'),auth['isAuthenticated'](),controller[_0x4c33('0x14')]);module[_0x4c33('0x15')]=router; \ No newline at end of file +var _0x9a10=['express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x9a10,0x1cb));var _0x09a1=function(_0x31f0e6,_0x2293ae){_0x31f0e6=_0x31f0e6-0x0;var _0x321b20=_0x9a10[_0x31f0e6];return _0x321b20;};'use strict';var multer=require(_0x09a1('0x0'));var util=require(_0x09a1('0x1'));var path=require('path');var timeout=require(_0x09a1('0x2'));var express=require(_0x09a1('0x3'));var router=express[_0x09a1('0x4')]();var auth=require(_0x09a1('0x5'));var interaction=require(_0x09a1('0x6'));var config=require('../../config/environment');var controller=require(_0x09a1('0x7'));router['get']('/',auth[_0x09a1('0x8')](),controller[_0x09a1('0x9')]);router[_0x09a1('0xa')](_0x09a1('0xb'),auth[_0x09a1('0x8')](),controller[_0x09a1('0xc')]);router[_0x09a1('0xa')](_0x09a1('0xd'),auth[_0x09a1('0x8')](),controller[_0x09a1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x09a1('0xf')]);router[_0x09a1('0x10')](_0x09a1('0xd'),auth[_0x09a1('0x8')](),controller[_0x09a1('0x11')]);router[_0x09a1('0x12')](_0x09a1('0xd'),auth['isAuthenticated'](),controller[_0x09a1('0x13')]);module[_0x09a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1fdf7f5..0fa28fc 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 _0xd48e=['exports','STRING','name'];(function(_0x4e7342,_0x169f15){var _0x3cac52=function(_0xe2adc){while(--_0xe2adc){_0x4e7342['push'](_0x4e7342['shift']());}};_0x3cac52(++_0x169f15);}(_0xd48e,0x93));var _0xed48=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xd48e[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require('sequelize');module[_0xed48('0x0')]={'name':{'type':Sequelize[_0xed48('0x1')],'unique':_0xed48('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xed48('0x1')]}}; \ No newline at end of file +var _0xb422=['name'];(function(_0x418b88,_0x4ed053){var _0x3fd415=function(_0xd63a3d){while(--_0xd63a3d){_0x418b88['push'](_0x418b88['shift']());}};_0x3fd415(++_0x4ed053);}(_0xb422,0x85));var _0x2b42=function(_0x6450e9,_0x1523fd){_0x6450e9=_0x6450e9-0x0;var _0x1fa94a=_0xb422[_0x6450e9];return _0x1fa94a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2b42('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6457360..cafff62 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 _0x417e=['apply','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x1cdb26,_0x51d90d){var _0x183f16=function(_0x178284){while(--_0x178284){_0x1cdb26['push'](_0x1cdb26['shift']());}};_0x183f16(++_0x51d90d);}(_0x417e,0x74));var _0xe417=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x417e[_0x2f57b2];return _0x5ace77;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe417('0x0'));var zipdir=require(_0xe417('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe417('0x2'));var moment=require(_0xe417('0x3'));var BPromise=require(_0xe417('0x4'));var Mustache=require(_0xe417('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe417('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe417('0x7'));var squel=require(_0xe417('0x8'));var crypto=require(_0xe417('0x9'));var jsforce=require(_0xe417('0xa'));var deskjs=require(_0xe417('0xb'));var toCsv=require(_0xe417('0x6'));var querystring=require(_0xe417('0xc'));var Papa=require(_0xe417('0xd'));var Redis=require(_0xe417('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe417('0xf'));var hardwareService=require(_0xe417('0x10'));var logger=require(_0xe417('0x11'))('api');var utils=require(_0xe417('0x12'));var config=require(_0xe417('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38606a,_0x5ebaa3){_0x5ebaa3=_0x5ebaa3||0xcc;return function(_0x223835){if(_0x223835){return _0x38606a[_0xe417('0x14')](_0x5ebaa3);}return _0x38606a[_0xe417('0x15')](_0x5ebaa3)[_0xe417('0x16')]();};}function respondWithResult(_0x53aba0,_0x4befb5){_0x4befb5=_0x4befb5||0xc8;return function(_0x2f319d){if(_0x2f319d){return _0x53aba0[_0xe417('0x15')](_0x4befb5)[_0xe417('0x17')](_0x2f319d);}};}function respondWithFilteredResult(_0x504946,_0x23be21){return function(_0x11ee65){if(_0x11ee65){var _0x591ad7=_0x11ee65[_0xe417('0x18')],_0x1cf0ee=_0x23be21[_0xe417('0x19')],_0x5ca2e9=_0x23be21[_0xe417('0x19')]+_0x23be21['limit'],_0x96cfe2;if(_0x5ca2e9>=_0x591ad7){_0x5ca2e9=_0x591ad7;_0x96cfe2=0xc8;}else{_0x96cfe2=0xce;}_0x504946['status'](_0x96cfe2);return _0x504946[_0xe417('0x1a')](_0xe417('0x1b'),_0x1cf0ee+'-'+_0x5ca2e9+'/'+_0x591ad7)['json'](_0x11ee65);}return null;};}function patchUpdates(_0x3b6702){return function(_0x3843d8){try{jsonpatch[_0xe417('0x1c')](_0x3843d8,_0x3b6702,!![]);}catch(_0x1d0ac3){return BPromise['reject'](_0x1d0ac3);}return _0x3843d8[_0xe417('0x1d')]();};}function saveUpdates(_0x34047b,_0x30502b){return function(_0x395d89){if(_0x395d89){return _0x395d89[_0xe417('0x1e')](_0x34047b)[_0xe417('0x1f')](function(_0x5c12f6){return _0x5c12f6;});}return null;};}function removeEntity(_0x345039,_0x4eaa34){return function(_0x2982ad){if(_0x2982ad){return _0x2982ad['destroy']()[_0xe417('0x1f')](function(){_0x345039[_0xe417('0x15')](0xcc)[_0xe417('0x16')]();});}};}function handleEntityNotFound(_0x2eb806,_0x165c2b){return function(_0x35d398){if(!_0x35d398){_0x2eb806[_0xe417('0x14')](0x194);}return _0x35d398;};}function handleError(_0x13182a,_0x164ff0){_0x164ff0=_0x164ff0||0x1f4;return function(_0x333d11){logger[_0xe417('0x20')](_0x333d11[_0xe417('0x21')]);if(_0x333d11['name']){delete _0x333d11[_0xe417('0x22')];}_0x13182a[_0xe417('0x15')](_0x164ff0)[_0xe417('0x23')](_0x333d11);};}exports[_0xe417('0x24')]=function(_0x398122,_0x1fea38){var _0x3dbe71={},_0x3c6516={},_0xff7a19={'count':0x0,'rows':[]};var _0x7a53e6=_[_0xe417('0x25')](db[_0xe417('0x26')][_0xe417('0x27')],function(_0x5977a5){return{'name':_0x5977a5[_0xe417('0x28')],'type':_0x5977a5[_0xe417('0x29')][_0xe417('0x2a')]};});_0x3c6516['model']=_[_0xe417('0x25')](_0x7a53e6,_0xe417('0x22'));_0x3c6516[_0xe417('0x2b')]=_[_0xe417('0x2c')](_0x398122[_0xe417('0x2b')]);_0x3c6516['filters']=_[_0xe417('0x2d')](_0x3c6516[_0xe417('0x2e')],_0x3c6516[_0xe417('0x2b')]);_0x3dbe71['attributes']=_[_0xe417('0x2d')](_0x3c6516[_0xe417('0x2e')],qs[_0xe417('0x2f')](_0x398122['query']['fields']));_0x3dbe71['attributes']=_0x3dbe71[_0xe417('0x30')][_0xe417('0x31')]?_0x3dbe71['attributes']:_0x3c6516[_0xe417('0x2e')];if(!_0x398122['query'][_0xe417('0x32')](_0xe417('0x33'))){_0x3dbe71[_0xe417('0x34')]=qs[_0xe417('0x34')](_0x398122[_0xe417('0x2b')]['limit']);_0x3dbe71[_0xe417('0x19')]=qs[_0xe417('0x19')](_0x398122[_0xe417('0x2b')][_0xe417('0x19')]);}_0x3dbe71[_0xe417('0x35')]=qs[_0xe417('0x36')](_0x398122[_0xe417('0x2b')][_0xe417('0x36')]);_0x3dbe71[_0xe417('0x37')]=qs[_0xe417('0x38')](_[_0xe417('0x39')](_0x398122[_0xe417('0x2b')],_0x3c6516['filters']),_0x7a53e6);if(_0x398122[_0xe417('0x2b')][_0xe417('0x3a')]){_0x3dbe71[_0xe417('0x37')]=_[_0xe417('0x3b')](_0x3dbe71[_0xe417('0x37')],{'$or':_[_0xe417('0x25')](_0x7a53e6,function(_0x457f8a){if(_0x457f8a['type']!==_0xe417('0x3c')){var _0x2f6aed={};_0x2f6aed[_0x457f8a[_0xe417('0x22')]]={'$like':'%'+_0x398122[_0xe417('0x2b')][_0xe417('0x3a')]+'%'};return _0x2f6aed;}})});}_0x3dbe71=_[_0xe417('0x3b')]({},_0x3dbe71,_0x398122[_0xe417('0x3d')]);var _0x35b67c={'where':_0x3dbe71[_0xe417('0x37')]};return db['MailSubstatus'][_0xe417('0x18')](_0x35b67c)['then'](function(_0x433844){_0xff7a19['count']=_0x433844;if(_0x398122[_0xe417('0x2b')][_0xe417('0x3e')]){_0x3dbe71[_0xe417('0x3f')]=[{'all':!![]}];}return db[_0xe417('0x26')][_0xe417('0x40')](_0x3dbe71);})[_0xe417('0x1f')](function(_0x292492){_0xff7a19['rows']=_0x292492;return _0xff7a19;})['then'](respondWithFilteredResult(_0x1fea38,_0x3dbe71))['catch'](handleError(_0x1fea38,null));};exports['show']=function(_0x29ce4d,_0x4395a8){var _0x4a6256={'raw':!![],'where':{'id':_0x29ce4d[_0xe417('0x41')]['id']}},_0x18acf4={};_0x18acf4[_0xe417('0x2e')]=_[_0xe417('0x2c')](db[_0xe417('0x26')][_0xe417('0x27')]);_0x18acf4[_0xe417('0x2b')]=_['keys'](_0x29ce4d[_0xe417('0x2b')]);_0x18acf4['filters']=_['intersection'](_0x18acf4[_0xe417('0x2e')],_0x18acf4[_0xe417('0x2b')]);_0x4a6256[_0xe417('0x30')]=_[_0xe417('0x2d')](_0x18acf4[_0xe417('0x2e')],qs[_0xe417('0x2f')](_0x29ce4d['query'][_0xe417('0x2f')]));_0x4a6256[_0xe417('0x30')]=_0x4a6256[_0xe417('0x30')][_0xe417('0x31')]?_0x4a6256[_0xe417('0x30')]:_0x18acf4['model'];if(_0x29ce4d['query'][_0xe417('0x3e')]){_0x4a6256['include']=[{'all':!![]}];}_0x4a6256=_[_0xe417('0x3b')]({},_0x4a6256,_0x29ce4d[_0xe417('0x3d')]);return db[_0xe417('0x26')][_0xe417('0x42')](_0x4a6256)[_0xe417('0x1f')](handleEntityNotFound(_0x4395a8,null))[_0xe417('0x1f')](respondWithResult(_0x4395a8,null))[_0xe417('0x43')](handleError(_0x4395a8,null));};exports[_0xe417('0x44')]=function(_0x57aab1,_0x2aaf03){return db[_0xe417('0x26')][_0xe417('0x44')](_0x57aab1[_0xe417('0x45')],{})[_0xe417('0x1f')](respondWithResult(_0x2aaf03,0xc9))[_0xe417('0x43')](handleError(_0x2aaf03,null));};exports[_0xe417('0x1e')]=function(_0x152adf,_0x2060f6){if(_0x152adf[_0xe417('0x45')]['id']){delete _0x152adf[_0xe417('0x45')]['id'];}return db[_0xe417('0x26')][_0xe417('0x42')]({'where':{'id':_0x152adf[_0xe417('0x41')]['id']}})[_0xe417('0x1f')](handleEntityNotFound(_0x2060f6,null))[_0xe417('0x1f')](saveUpdates(_0x152adf[_0xe417('0x45')],null))[_0xe417('0x1f')](respondWithResult(_0x2060f6,null))[_0xe417('0x43')](handleError(_0x2060f6,null));};exports[_0xe417('0x46')]=function(_0x24b4ac,_0x3af132){return db['MailSubstatus'][_0xe417('0x42')]({'where':{'id':_0x24b4ac[_0xe417('0x41')]['id']}})[_0xe417('0x1f')](handleEntityNotFound(_0x3af132,null))[_0xe417('0x1f')](removeEntity(_0x3af132,null))[_0xe417('0x43')](handleError(_0x3af132,null));};exports[_0xe417('0x47')]=function(_0x55ca34,_0x91ad60){return db['MailSubstatus'][_0xe417('0x47')]()[_0xe417('0x1f')](respondWithResult(_0x91ad60,null))[_0xe417('0x43')](handleError(_0x91ad60,null));}; \ No newline at end of file +var _0xb8f1=['zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','save','destroy','then','stack','name','send','index','map','MailSubstatus','rawAttributes','type','model','query','keys','filters','attributes','fields','length','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','rimraf'];(function(_0x2a86b7,_0x1fc30c){var _0x391c61=function(_0x460be4){while(--_0x460be4){_0x2a86b7['push'](_0x2a86b7['shift']());}};_0x391c61(++_0x1fc30c);}(_0xb8f1,0x107));var _0x1b8f=function(_0x552330,_0x13f79a){_0x552330=_0x552330-0x0;var _0x2402dc=_0xb8f1[_0x552330];return _0x2402dc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1b8f('0x0'));var zipdir=require(_0x1b8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b8f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1b8f('0x3'));var util=require(_0x1b8f('0x4'));var path=require(_0x1b8f('0x5'));var sox=require(_0x1b8f('0x6'));var csv=require('to-csv');var ejs=require(_0x1b8f('0x7'));var fs=require('fs');var _=require(_0x1b8f('0x8'));var squel=require(_0x1b8f('0x9'));var crypto=require('crypto');var jsforce=require(_0x1b8f('0xa'));var deskjs=require(_0x1b8f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1b8f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1b8f('0xd'));var qs=require(_0x1b8f('0xe'));var as=require(_0x1b8f('0xf'));var hardwareService=require(_0x1b8f('0x10'));var logger=require(_0x1b8f('0x11'))('api');var utils=require(_0x1b8f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b8f('0x13'))['db'];function respondWithStatusCode(_0x34a217,_0x4a7536){_0x4a7536=_0x4a7536||0xcc;return function(_0x3f8c63){if(_0x3f8c63){return _0x34a217[_0x1b8f('0x14')](_0x4a7536);}return _0x34a217['status'](_0x4a7536)[_0x1b8f('0x15')]();};}function respondWithResult(_0x51cee4,_0x2a4ef2){_0x2a4ef2=_0x2a4ef2||0xc8;return function(_0x9b280d){if(_0x9b280d){return _0x51cee4[_0x1b8f('0x16')](_0x2a4ef2)[_0x1b8f('0x17')](_0x9b280d);}};}function respondWithFilteredResult(_0x5103e1,_0x2a8393){return function(_0x19a64a){if(_0x19a64a){var _0x5dee60=_0x19a64a['count'],_0x3148dc=_0x2a8393[_0x1b8f('0x18')],_0x2724cb=_0x2a8393[_0x1b8f('0x18')]+_0x2a8393[_0x1b8f('0x19')],_0x2c9485;if(_0x2724cb>=_0x5dee60){_0x2724cb=_0x5dee60;_0x2c9485=0xc8;}else{_0x2c9485=0xce;}_0x5103e1[_0x1b8f('0x16')](_0x2c9485);return _0x5103e1[_0x1b8f('0x1a')]('Content-Range',_0x3148dc+'-'+_0x2724cb+'/'+_0x5dee60)[_0x1b8f('0x17')](_0x19a64a);}return null;};}function patchUpdates(_0x19c98e){return function(_0x576a97){try{jsonpatch['apply'](_0x576a97,_0x19c98e,!![]);}catch(_0x273c2f){return BPromise[_0x1b8f('0x1b')](_0x273c2f);}return _0x576a97[_0x1b8f('0x1c')]();};}function saveUpdates(_0x57136c,_0x2ff6af){return function(_0x520571){if(_0x520571){return _0x520571['update'](_0x57136c)['then'](function(_0x115455){return _0x115455;});}return null;};}function removeEntity(_0x3f7083,_0x44fd34){return function(_0xb4d9a2){if(_0xb4d9a2){return _0xb4d9a2[_0x1b8f('0x1d')]()[_0x1b8f('0x1e')](function(){_0x3f7083[_0x1b8f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12282c,_0x2764e9){return function(_0x54f895){if(!_0x54f895){_0x12282c[_0x1b8f('0x14')](0x194);}return _0x54f895;};}function handleError(_0x47feaf,_0x5618df){_0x5618df=_0x5618df||0x1f4;return function(_0x556a6a){logger['error'](_0x556a6a[_0x1b8f('0x1f')]);if(_0x556a6a[_0x1b8f('0x20')]){delete _0x556a6a['name'];}_0x47feaf['status'](_0x5618df)[_0x1b8f('0x21')](_0x556a6a);};}exports[_0x1b8f('0x22')]=function(_0xde7c49,_0x5b6344){var _0x3e035a={},_0x4c5d0c={},_0x5891a2={'count':0x0,'rows':[]};var _0x2be28e=_[_0x1b8f('0x23')](db[_0x1b8f('0x24')][_0x1b8f('0x25')],function(_0x2ce219){return{'name':_0x2ce219['fieldName'],'type':_0x2ce219[_0x1b8f('0x26')]['key']};});_0x4c5d0c[_0x1b8f('0x27')]=_['map'](_0x2be28e,'name');_0x4c5d0c[_0x1b8f('0x28')]=_[_0x1b8f('0x29')](_0xde7c49[_0x1b8f('0x28')]);_0x4c5d0c[_0x1b8f('0x2a')]=_['intersection'](_0x4c5d0c[_0x1b8f('0x27')],_0x4c5d0c[_0x1b8f('0x28')]);_0x3e035a[_0x1b8f('0x2b')]=_['intersection'](_0x4c5d0c[_0x1b8f('0x27')],qs[_0x1b8f('0x2c')](_0xde7c49['query'][_0x1b8f('0x2c')]));_0x3e035a[_0x1b8f('0x2b')]=_0x3e035a['attributes'][_0x1b8f('0x2d')]?_0x3e035a[_0x1b8f('0x2b')]:_0x4c5d0c['model'];if(!_0xde7c49[_0x1b8f('0x28')]['hasOwnProperty']('nolimit')){_0x3e035a[_0x1b8f('0x19')]=qs[_0x1b8f('0x19')](_0xde7c49['query'][_0x1b8f('0x19')]);_0x3e035a['offset']=qs[_0x1b8f('0x18')](_0xde7c49[_0x1b8f('0x28')][_0x1b8f('0x18')]);}_0x3e035a['order']=qs[_0x1b8f('0x2e')](_0xde7c49[_0x1b8f('0x28')][_0x1b8f('0x2e')]);_0x3e035a['where']=qs[_0x1b8f('0x2a')](_[_0x1b8f('0x2f')](_0xde7c49[_0x1b8f('0x28')],_0x4c5d0c[_0x1b8f('0x2a')]),_0x2be28e);if(_0xde7c49[_0x1b8f('0x28')]['filter']){_0x3e035a[_0x1b8f('0x30')]=_[_0x1b8f('0x31')](_0x3e035a[_0x1b8f('0x30')],{'$or':_['map'](_0x2be28e,function(_0x1f53a4){if(_0x1f53a4[_0x1b8f('0x26')]!==_0x1b8f('0x32')){var _0x2fa1b4={};_0x2fa1b4[_0x1f53a4[_0x1b8f('0x20')]]={'$like':'%'+_0xde7c49[_0x1b8f('0x28')][_0x1b8f('0x33')]+'%'};return _0x2fa1b4;}})});}_0x3e035a=_['merge']({},_0x3e035a,_0xde7c49[_0x1b8f('0x34')]);var _0xbf7ccc={'where':_0x3e035a['where']};return db[_0x1b8f('0x24')][_0x1b8f('0x35')](_0xbf7ccc)[_0x1b8f('0x1e')](function(_0x4148b1){_0x5891a2[_0x1b8f('0x35')]=_0x4148b1;if(_0xde7c49['query'][_0x1b8f('0x36')]){_0x3e035a[_0x1b8f('0x37')]=[{'all':!![]}];}return db['MailSubstatus'][_0x1b8f('0x38')](_0x3e035a);})[_0x1b8f('0x1e')](function(_0x417190){_0x5891a2[_0x1b8f('0x39')]=_0x417190;return _0x5891a2;})['then'](respondWithFilteredResult(_0x5b6344,_0x3e035a))[_0x1b8f('0x3a')](handleError(_0x5b6344,null));};exports[_0x1b8f('0x3b')]=function(_0x2f1aeb,_0x474e27){var _0xaac498={'raw':!![],'where':{'id':_0x2f1aeb[_0x1b8f('0x3c')]['id']}},_0x257890={};_0x257890[_0x1b8f('0x27')]=_[_0x1b8f('0x29')](db[_0x1b8f('0x24')]['rawAttributes']);_0x257890[_0x1b8f('0x28')]=_[_0x1b8f('0x29')](_0x2f1aeb[_0x1b8f('0x28')]);_0x257890[_0x1b8f('0x2a')]=_[_0x1b8f('0x3d')](_0x257890[_0x1b8f('0x27')],_0x257890[_0x1b8f('0x28')]);_0xaac498[_0x1b8f('0x2b')]=_[_0x1b8f('0x3d')](_0x257890[_0x1b8f('0x27')],qs[_0x1b8f('0x2c')](_0x2f1aeb[_0x1b8f('0x28')][_0x1b8f('0x2c')]));_0xaac498['attributes']=_0xaac498['attributes'][_0x1b8f('0x2d')]?_0xaac498[_0x1b8f('0x2b')]:_0x257890['model'];if(_0x2f1aeb[_0x1b8f('0x28')][_0x1b8f('0x36')]){_0xaac498[_0x1b8f('0x37')]=[{'all':!![]}];}_0xaac498=_[_0x1b8f('0x31')]({},_0xaac498,_0x2f1aeb[_0x1b8f('0x34')]);return db[_0x1b8f('0x24')][_0x1b8f('0x3e')](_0xaac498)[_0x1b8f('0x1e')](handleEntityNotFound(_0x474e27,null))['then'](respondWithResult(_0x474e27,null))['catch'](handleError(_0x474e27,null));};exports[_0x1b8f('0x3f')]=function(_0x40f24a,_0x2c8268){return db['MailSubstatus']['create'](_0x40f24a[_0x1b8f('0x40')],{})['then'](respondWithResult(_0x2c8268,0xc9))[_0x1b8f('0x3a')](handleError(_0x2c8268,null));};exports['update']=function(_0x11919e,_0x1e85b6){if(_0x11919e[_0x1b8f('0x40')]['id']){delete _0x11919e[_0x1b8f('0x40')]['id'];}return db[_0x1b8f('0x24')]['find']({'where':{'id':_0x11919e[_0x1b8f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1e85b6,null))[_0x1b8f('0x1e')](saveUpdates(_0x11919e[_0x1b8f('0x40')],null))['then'](respondWithResult(_0x1e85b6,null))[_0x1b8f('0x3a')](handleError(_0x1e85b6,null));};exports[_0x1b8f('0x1d')]=function(_0x1ffb3e,_0x1687ec){return db[_0x1b8f('0x24')][_0x1b8f('0x3e')]({'where':{'id':_0x1ffb3e['params']['id']}})[_0x1b8f('0x1e')](handleEntityNotFound(_0x1687ec,null))['then'](removeEntity(_0x1687ec,null))['catch'](handleError(_0x1687ec,null));};exports['describe']=function(_0x379a08,_0x1777a2){return db[_0x1b8f('0x24')][_0x1b8f('0x41')]()[_0x1b8f('0x1e')](respondWithResult(_0x1777a2,null))[_0x1b8f('0x3a')](handleError(_0x1777a2,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 98ba9c1..1390a9d 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 _0x61d0=['rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','bluebird','path'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x61d0,0x187));var _0x061d=function(_0x4cd14a,_0x3c08b4){_0x4cd14a=_0x4cd14a-0x0;var _0x59ac6a=_0x61d0[_0x4cd14a];return _0x59ac6a;};'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 +var _0xcaef=['api','moment','request-promise','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x17e250,_0x4061c5){var _0x56fa28=function(_0x5032fd){while(--_0x5032fd){_0x17e250['push'](_0x17e250['shift']());}};_0x56fa28(++_0x4061c5);}(_0xcaef,0x1c9));var _0xfcae=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xcaef[_0x409353];return _0x4f4b59;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','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 8e7ea1b..fa71663 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 _0x5b02=['client','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x5b02,0xe9));var _0x25b0=function(_0x40ce9b,_0x3f2738){_0x40ce9b=_0x40ce9b-0x0;var _0x38cd0f=_0x5b02[_0x40ce9b];return _0x38cd0f;};'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')]('MailSubstatus,\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')]('MailSubstatus,\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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c00ea,_0x1cf606){var _0x2754b6=function(_0x2bf125){while(--_0x2bf125){_0x4c00ea['push'](_0x4c00ea['shift']());}};_0x2754b6(++_0x1cf606);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xb4e6[_0x14a862];return _0x245eb5;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a77ba1f..930a41f 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 _0x832b=['../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','express','Router'];(function(_0x48a12f,_0x57ee19){var _0x37fc9c=function(_0x17e75d){while(--_0x17e75d){_0x48a12f['push'](_0x48a12f['shift']());}};_0x37fc9c(++_0x57ee19);}(_0x832b,0x1ea));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb832('0x0'));var util=require(_0xb832('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb832('0x2'));var router=express[_0xb832('0x3')]();var auth=require(_0xb832('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb832('0x5'));var controller=require(_0xb832('0x6'));router['get']('/',auth[_0xb832('0x7')](),controller[_0xb832('0x8')]);router[_0xb832('0x9')](_0xb832('0xa'),auth[_0xb832('0x7')](),controller[_0xb832('0xb')]);router[_0xb832('0x9')](_0xb832('0xc'),auth[_0xb832('0x7')](),controller[_0xb832('0xd')]);router[_0xb832('0xe')]('/',auth[_0xb832('0x7')](),controller[_0xb832('0xf')]);router['put'](_0xb832('0xc'),auth['isAuthenticated'](),controller[_0xb832('0x10')]);router[_0xb832('0x11')](_0xb832('0xc'),auth[_0xb832('0x7')](),controller['destroy']);module[_0xb832('0x12')]=router; \ No newline at end of file +var _0xe8ce=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x41a1f5,_0x11b2b0){var _0x3c088c=function(_0x3741f1){while(--_0x3741f1){_0x41a1f5['push'](_0x41a1f5['shift']());}};_0x3c088c(++_0x11b2b0);}(_0xe8ce,0x153));var _0xee8c=function(_0x3f5086,_0x27972f){_0x3f5086=_0x3f5086-0x0;var _0x55d918=_0xe8ce[_0x3f5086];return _0x55d918;};'use strict';var multer=require(_0xee8c('0x0'));var util=require(_0xee8c('0x1'));var path=require(_0xee8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xee8c('0x3'));var router=express[_0xee8c('0x4')]();var auth=require(_0xee8c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xee8c('0x6'));var controller=require('./mailTransferReport.controller');router[_0xee8c('0x7')]('/',auth[_0xee8c('0x8')](),controller[_0xee8c('0x9')]);router[_0xee8c('0x7')](_0xee8c('0xa'),auth[_0xee8c('0x8')](),controller['describe']);router[_0xee8c('0x7')](_0xee8c('0xb'),auth[_0xee8c('0x8')](),controller[_0xee8c('0xc')]);router[_0xee8c('0xd')]('/',auth[_0xee8c('0x8')](),controller[_0xee8c('0xe')]);router['put'](_0xee8c('0xb'),auth[_0xee8c('0x8')](),controller[_0xee8c('0xf')]);router[_0xee8c('0x10')](_0xee8c('0xb'),auth[_0xee8c('0x8')](),controller[_0xee8c('0x11')]);module[_0xee8c('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7502142..10cbb77 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 _0xe966=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe966,0x1c7));var _0x6e96=function(_0x141488,_0x46c8f4){_0x141488=_0x141488-0x0;var _0x2f2d0e=_0xe966[_0x141488];return _0x2f2d0e;};'use strict';var moment=require(_0x6e96('0x0'));var Sequelize=require(_0x6e96('0x1'));module[_0x6e96('0x2')]={'uniqueid':{'type':Sequelize[_0x6e96('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6e96('0x4'),_0x6e96('0x5'),_0x6e96('0x6')),'allowNull':![],'defaultValue':_0x6e96('0x6')},'transferredAt':{'type':Sequelize[_0x6e96('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e96('0x8')]}}; \ No newline at end of file +var _0xb406=['moment','exports','STRING','agent','queue','DATE','NOW'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xb406,0x93));var _0x6b40=function(_0x522965,_0x3121f2){_0x522965=_0x522965-0x0;var _0x4eef0e=_0xb406[_0x522965];return _0x4eef0e;};'use strict';var moment=require(_0x6b40('0x0'));var Sequelize=require('sequelize');module[_0x6b40('0x1')]={'uniqueid':{'type':Sequelize[_0x6b40('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x6b40('0x3'),_0x6b40('0x4')),'allowNull':![],'defaultValue':_0x6b40('0x4')},'transferredAt':{'type':Sequelize[_0x6b40('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6b40('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d3ed32f..89fc1b0 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 _0x011a=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MailTransferReport','then','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','describe'];(function(_0x3fc86b,_0x531785){var _0x3689c9=function(_0x5d2917){while(--_0x5d2917){_0x3fc86b['push'](_0x3fc86b['shift']());}};_0x3689c9(++_0x531785);}(_0x011a,0x1c8));var _0xa011=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x011a[_0x18c44d];return _0x71abcf;};'use strict';var pdf=require(_0xa011('0x0'));var emlformat=require(_0xa011('0x1'));var rimraf=require(_0xa011('0x2'));var zipdir=require(_0xa011('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa011('0x4'));var moment=require(_0xa011('0x5'));var BPromise=require(_0xa011('0x6'));var Mustache=require(_0xa011('0x7'));var util=require(_0xa011('0x8'));var path=require(_0xa011('0x9'));var sox=require(_0xa011('0xa'));var csv=require(_0xa011('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa011('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa011('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa011('0xe'));var Papa=require(_0xa011('0xf'));var Redis=require('ioredis');var authService=require(_0xa011('0x10'));var qs=require(_0xa011('0x11'));var as=require(_0xa011('0x12'));var hardwareService=require(_0xa011('0x13'));var logger=require(_0xa011('0x14'))(_0xa011('0x15'));var utils=require('../../config/utils');var config=require(_0xa011('0x16'));var licenseUtil=require(_0xa011('0x17'));var db=require(_0xa011('0x18'))['db'];function respondWithStatusCode(_0x1993f0,_0x8dd0f3){_0x8dd0f3=_0x8dd0f3||0xcc;return function(_0x2f5164){if(_0x2f5164){return _0x1993f0[_0xa011('0x19')](_0x8dd0f3);}return _0x1993f0[_0xa011('0x1a')](_0x8dd0f3)[_0xa011('0x1b')]();};}function respondWithResult(_0x246eca,_0x510c70){_0x510c70=_0x510c70||0xc8;return function(_0x2b5a76){if(_0x2b5a76){return _0x246eca[_0xa011('0x1a')](_0x510c70)[_0xa011('0x1c')](_0x2b5a76);}};}function respondWithFilteredResult(_0x2c09b8,_0x14823e){return function(_0x37fc22){if(_0x37fc22){var _0x5abecd=_0x37fc22[_0xa011('0x1d')],_0xf48c93=_0x14823e[_0xa011('0x1e')],_0x54fb48=_0x14823e[_0xa011('0x1e')]+_0x14823e[_0xa011('0x1f')],_0xdc0235;if(_0x54fb48>=_0x5abecd){_0x54fb48=_0x5abecd;_0xdc0235=0xc8;}else{_0xdc0235=0xce;}_0x2c09b8[_0xa011('0x1a')](_0xdc0235);return _0x2c09b8[_0xa011('0x20')](_0xa011('0x21'),_0xf48c93+'-'+_0x54fb48+'/'+_0x5abecd)['json'](_0x37fc22);}return null;};}function patchUpdates(_0x4b159a){return function(_0x5b0ce5){try{jsonpatch[_0xa011('0x22')](_0x5b0ce5,_0x4b159a,!![]);}catch(_0x33e22e){return BPromise[_0xa011('0x23')](_0x33e22e);}return _0x5b0ce5[_0xa011('0x24')]();};}function saveUpdates(_0x443652,_0x5afb38){return function(_0x3538bf){if(_0x3538bf){return _0x3538bf[_0xa011('0x25')](_0x443652)['then'](function(_0x15aa0d){return _0x15aa0d;});}return null;};}function removeEntity(_0x33cc33,_0x173a07){return function(_0x1d706e){if(_0x1d706e){return _0x1d706e[_0xa011('0x26')]()['then'](function(){_0x33cc33[_0xa011('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0265c,_0x3661b6){return function(_0x33ac02){if(!_0x33ac02){_0xa0265c[_0xa011('0x19')](0x194);}return _0x33ac02;};}function handleError(_0x223f1f,_0x4e5cb9){_0x4e5cb9=_0x4e5cb9||0x1f4;return function(_0x526cbd){logger[_0xa011('0x27')](_0x526cbd[_0xa011('0x28')]);if(_0x526cbd['name']){delete _0x526cbd[_0xa011('0x29')];}_0x223f1f[_0xa011('0x1a')](_0x4e5cb9)[_0xa011('0x2a')](_0x526cbd);};}exports[_0xa011('0x2b')]=function(_0xf85006,_0x3b1a9d){var _0x26925c={},_0x48d8ab={},_0x1f1aa4={'count':0x0,'rows':[]};var _0x29ac22=_[_0xa011('0x2c')](db['MailTransferReport']['rawAttributes'],function(_0x437198){return{'name':_0x437198[_0xa011('0x2d')],'type':_0x437198[_0xa011('0x2e')][_0xa011('0x2f')]};});_0x48d8ab[_0xa011('0x30')]=_['map'](_0x29ac22,_0xa011('0x29'));_0x48d8ab[_0xa011('0x31')]=_['keys'](_0xf85006['query']);_0x48d8ab[_0xa011('0x32')]=_[_0xa011('0x33')](_0x48d8ab[_0xa011('0x30')],_0x48d8ab[_0xa011('0x31')]);_0x26925c['attributes']=_[_0xa011('0x33')](_0x48d8ab[_0xa011('0x30')],qs[_0xa011('0x34')](_0xf85006[_0xa011('0x31')][_0xa011('0x34')]));_0x26925c['attributes']=_0x26925c[_0xa011('0x35')][_0xa011('0x36')]?_0x26925c[_0xa011('0x35')]:_0x48d8ab[_0xa011('0x30')];if(!_0xf85006[_0xa011('0x31')][_0xa011('0x37')](_0xa011('0x38'))){_0x26925c[_0xa011('0x1f')]=qs[_0xa011('0x1f')](_0xf85006[_0xa011('0x31')][_0xa011('0x1f')]);_0x26925c[_0xa011('0x1e')]=qs['offset'](_0xf85006[_0xa011('0x31')][_0xa011('0x1e')]);}_0x26925c['order']=qs[_0xa011('0x39')](_0xf85006[_0xa011('0x31')][_0xa011('0x39')]);_0x26925c[_0xa011('0x3a')]=qs['filters'](_['pick'](_0xf85006[_0xa011('0x31')],_0x48d8ab[_0xa011('0x32')]),_0x29ac22);if(_0xf85006[_0xa011('0x31')][_0xa011('0x3b')]){_0x26925c[_0xa011('0x3a')]=_[_0xa011('0x3c')](_0x26925c[_0xa011('0x3a')],{'$or':_[_0xa011('0x2c')](_0x29ac22,function(_0x56b599){if(_0x56b599[_0xa011('0x2e')]!==_0xa011('0x3d')){var _0x319d81={};_0x319d81[_0x56b599['name']]={'$like':'%'+_0xf85006[_0xa011('0x31')][_0xa011('0x3b')]+'%'};return _0x319d81;}})});}_0x26925c=_[_0xa011('0x3c')]({},_0x26925c,_0xf85006[_0xa011('0x3e')]);var _0xf87da2={'where':_0x26925c[_0xa011('0x3a')]};return db[_0xa011('0x3f')][_0xa011('0x1d')](_0xf87da2)[_0xa011('0x40')](function(_0x243953){_0x1f1aa4[_0xa011('0x1d')]=_0x243953;if(_0xf85006['query'][_0xa011('0x41')]){_0x26925c[_0xa011('0x42')]=[{'all':!![]}];}return db['MailTransferReport'][_0xa011('0x43')](_0x26925c);})['then'](function(_0x2ab860){_0x1f1aa4['rows']=_0x2ab860;return _0x1f1aa4;})['then'](respondWithFilteredResult(_0x3b1a9d,_0x26925c))['catch'](handleError(_0x3b1a9d,null));};exports[_0xa011('0x44')]=function(_0x580a9c,_0x1b9241){var _0x4ff00f={'raw':!![],'where':{'id':_0x580a9c['params']['id']}},_0x25b754={};_0x25b754[_0xa011('0x30')]=_['keys'](db[_0xa011('0x3f')][_0xa011('0x45')]);_0x25b754[_0xa011('0x31')]=_['keys'](_0x580a9c[_0xa011('0x31')]);_0x25b754[_0xa011('0x32')]=_[_0xa011('0x33')](_0x25b754[_0xa011('0x30')],_0x25b754[_0xa011('0x31')]);_0x4ff00f['attributes']=_[_0xa011('0x33')](_0x25b754[_0xa011('0x30')],qs[_0xa011('0x34')](_0x580a9c[_0xa011('0x31')][_0xa011('0x34')]));_0x4ff00f['attributes']=_0x4ff00f[_0xa011('0x35')]['length']?_0x4ff00f['attributes']:_0x25b754[_0xa011('0x30')];if(_0x580a9c[_0xa011('0x31')][_0xa011('0x41')]){_0x4ff00f[_0xa011('0x42')]=[{'all':!![]}];}_0x4ff00f=_['merge']({},_0x4ff00f,_0x580a9c[_0xa011('0x3e')]);return db[_0xa011('0x3f')][_0xa011('0x46')](_0x4ff00f)[_0xa011('0x40')](handleEntityNotFound(_0x1b9241,null))[_0xa011('0x40')](respondWithResult(_0x1b9241,null))[_0xa011('0x47')](handleError(_0x1b9241,null));};exports['create']=function(_0x148b3b,_0x5d23f4){return db[_0xa011('0x3f')][_0xa011('0x48')](_0x148b3b['body'],{})['then'](respondWithResult(_0x5d23f4,0xc9))[_0xa011('0x47')](handleError(_0x5d23f4,null));};exports[_0xa011('0x25')]=function(_0x1c8709,_0x26cbbb){if(_0x1c8709[_0xa011('0x49')]['id']){delete _0x1c8709[_0xa011('0x49')]['id'];}return db[_0xa011('0x3f')][_0xa011('0x46')]({'where':{'id':_0x1c8709[_0xa011('0x4a')]['id']}})[_0xa011('0x40')](handleEntityNotFound(_0x26cbbb,null))[_0xa011('0x40')](saveUpdates(_0x1c8709[_0xa011('0x49')],null))['then'](respondWithResult(_0x26cbbb,null))[_0xa011('0x47')](handleError(_0x26cbbb,null));};exports[_0xa011('0x26')]=function(_0xcb37aa,_0xe714a4){return db['MailTransferReport']['find']({'where':{'id':_0xcb37aa[_0xa011('0x4a')]['id']}})[_0xa011('0x40')](handleEntityNotFound(_0xe714a4,null))[_0xa011('0x40')](removeEntity(_0xe714a4,null))[_0xa011('0x47')](handleError(_0xe714a4,null));};exports[_0xa011('0x4b')]=function(_0x1a9faa,_0x45804f){return db[_0xa011('0x3f')]['describe']()[_0xa011('0x40')](respondWithResult(_0x45804f,null))[_0xa011('0x47')](handleError(_0x45804f,null));}; \ No newline at end of file +var _0x954c=['end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x954c,0x155));var _0xc954=function(_0x2a504a,_0x50efa4){_0x2a504a=_0x2a504a-0x0;var _0x4efa27=_0x954c[_0x2a504a];return _0x4efa27;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc954('0x0'));var rimraf=require(_0xc954('0x1'));var zipdir=require(_0xc954('0x2'));var jsonpatch=require(_0xc954('0x3'));var rp=require('request-promise');var moment=require(_0xc954('0x4'));var BPromise=require(_0xc954('0x5'));var Mustache=require('mustache');var util=require(_0xc954('0x6'));var path=require(_0xc954('0x7'));var sox=require('sox');var csv=require(_0xc954('0x8'));var ejs=require(_0xc954('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc954('0xa'));var crypto=require(_0xc954('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc954('0x8'));var querystring=require(_0xc954('0xc'));var Papa=require(_0xc954('0xd'));var Redis=require(_0xc954('0xe'));var authService=require(_0xc954('0xf'));var qs=require(_0xc954('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc954('0x11'));var logger=require('../../config/logger')(_0xc954('0x12'));var utils=require(_0xc954('0x13'));var config=require(_0xc954('0x14'));var licenseUtil=require(_0xc954('0x15'));var db=require(_0xc954('0x16'))['db'];function respondWithStatusCode(_0x39367f,_0x176962){_0x176962=_0x176962||0xcc;return function(_0x2f345c){if(_0x2f345c){return _0x39367f[_0xc954('0x17')](_0x176962);}return _0x39367f['status'](_0x176962)[_0xc954('0x18')]();};}function respondWithResult(_0x281962,_0x959416){_0x959416=_0x959416||0xc8;return function(_0xea617a){if(_0xea617a){return _0x281962[_0xc954('0x19')](_0x959416)[_0xc954('0x1a')](_0xea617a);}};}function respondWithFilteredResult(_0x5d8dee,_0x8aa945){return function(_0x14ed50){if(_0x14ed50){var _0x560c8f=_0x14ed50[_0xc954('0x1b')],_0x17b817=_0x8aa945[_0xc954('0x1c')],_0x215077=_0x8aa945[_0xc954('0x1c')]+_0x8aa945[_0xc954('0x1d')],_0x208411;if(_0x215077>=_0x560c8f){_0x215077=_0x560c8f;_0x208411=0xc8;}else{_0x208411=0xce;}_0x5d8dee[_0xc954('0x19')](_0x208411);return _0x5d8dee[_0xc954('0x1e')](_0xc954('0x1f'),_0x17b817+'-'+_0x215077+'/'+_0x560c8f)[_0xc954('0x1a')](_0x14ed50);}return null;};}function patchUpdates(_0x56a4fe){return function(_0x4bb78a){try{jsonpatch[_0xc954('0x20')](_0x4bb78a,_0x56a4fe,!![]);}catch(_0x4bfc05){return BPromise[_0xc954('0x21')](_0x4bfc05);}return _0x4bb78a['save']();};}function saveUpdates(_0x3bae84,_0x577a84){return function(_0x1a4e61){if(_0x1a4e61){return _0x1a4e61['update'](_0x3bae84)[_0xc954('0x22')](function(_0x15785e){return _0x15785e;});}return null;};}function removeEntity(_0x3ccc96,_0x52e809){return function(_0x227bbb){if(_0x227bbb){return _0x227bbb[_0xc954('0x23')]()[_0xc954('0x22')](function(){_0x3ccc96[_0xc954('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530e0e,_0x47b9da){return function(_0x991434){if(!_0x991434){_0x530e0e[_0xc954('0x17')](0x194);}return _0x991434;};}function handleError(_0x157c2e,_0x1aae6d){_0x1aae6d=_0x1aae6d||0x1f4;return function(_0x4ce7b2){logger[_0xc954('0x24')](_0x4ce7b2['stack']);if(_0x4ce7b2['name']){delete _0x4ce7b2[_0xc954('0x25')];}_0x157c2e[_0xc954('0x19')](_0x1aae6d)[_0xc954('0x26')](_0x4ce7b2);};}exports[_0xc954('0x27')]=function(_0x503c77,_0x4a5732){var _0x51c5bf={},_0x4f053b={},_0x364ee6={'count':0x0,'rows':[]};var _0x435651=_[_0xc954('0x28')](db[_0xc954('0x29')][_0xc954('0x2a')],function(_0x3128ab){return{'name':_0x3128ab[_0xc954('0x2b')],'type':_0x3128ab[_0xc954('0x2c')][_0xc954('0x2d')]};});_0x4f053b[_0xc954('0x2e')]=_[_0xc954('0x28')](_0x435651,_0xc954('0x25'));_0x4f053b[_0xc954('0x2f')]=_['keys'](_0x503c77[_0xc954('0x2f')]);_0x4f053b[_0xc954('0x30')]=_[_0xc954('0x31')](_0x4f053b['model'],_0x4f053b[_0xc954('0x2f')]);_0x51c5bf[_0xc954('0x32')]=_[_0xc954('0x31')](_0x4f053b['model'],qs[_0xc954('0x33')](_0x503c77[_0xc954('0x2f')]['fields']));_0x51c5bf['attributes']=_0x51c5bf[_0xc954('0x32')][_0xc954('0x34')]?_0x51c5bf[_0xc954('0x32')]:_0x4f053b[_0xc954('0x2e')];if(!_0x503c77[_0xc954('0x2f')][_0xc954('0x35')]('nolimit')){_0x51c5bf[_0xc954('0x1d')]=qs[_0xc954('0x1d')](_0x503c77[_0xc954('0x2f')][_0xc954('0x1d')]);_0x51c5bf[_0xc954('0x1c')]=qs['offset'](_0x503c77['query']['offset']);}_0x51c5bf[_0xc954('0x36')]=qs[_0xc954('0x37')](_0x503c77[_0xc954('0x2f')][_0xc954('0x37')]);_0x51c5bf['where']=qs[_0xc954('0x30')](_[_0xc954('0x38')](_0x503c77['query'],_0x4f053b[_0xc954('0x30')]),_0x435651);if(_0x503c77['query'][_0xc954('0x39')]){_0x51c5bf[_0xc954('0x3a')]=_[_0xc954('0x3b')](_0x51c5bf[_0xc954('0x3a')],{'$or':_[_0xc954('0x28')](_0x435651,function(_0x632c0a){if(_0x632c0a[_0xc954('0x2c')]!==_0xc954('0x3c')){var _0x2a9a5e={};_0x2a9a5e[_0x632c0a[_0xc954('0x25')]]={'$like':'%'+_0x503c77[_0xc954('0x2f')][_0xc954('0x39')]+'%'};return _0x2a9a5e;}})});}_0x51c5bf=_[_0xc954('0x3b')]({},_0x51c5bf,_0x503c77[_0xc954('0x3d')]);var _0x3ebdee={'where':_0x51c5bf[_0xc954('0x3a')]};return db[_0xc954('0x29')][_0xc954('0x1b')](_0x3ebdee)[_0xc954('0x22')](function(_0x367368){_0x364ee6['count']=_0x367368;if(_0x503c77[_0xc954('0x2f')][_0xc954('0x3e')]){_0x51c5bf[_0xc954('0x3f')]=[{'all':!![]}];}return db[_0xc954('0x29')][_0xc954('0x40')](_0x51c5bf);})[_0xc954('0x22')](function(_0x19545d){_0x364ee6[_0xc954('0x41')]=_0x19545d;return _0x364ee6;})['then'](respondWithFilteredResult(_0x4a5732,_0x51c5bf))[_0xc954('0x42')](handleError(_0x4a5732,null));};exports['show']=function(_0x243967,_0x5b4db9){var _0x853e4b={'raw':!![],'where':{'id':_0x243967[_0xc954('0x43')]['id']}},_0x4493a2={};_0x4493a2['model']=_[_0xc954('0x44')](db[_0xc954('0x29')][_0xc954('0x2a')]);_0x4493a2['query']=_[_0xc954('0x44')](_0x243967['query']);_0x4493a2[_0xc954('0x30')]=_['intersection'](_0x4493a2[_0xc954('0x2e')],_0x4493a2['query']);_0x853e4b[_0xc954('0x32')]=_[_0xc954('0x31')](_0x4493a2[_0xc954('0x2e')],qs[_0xc954('0x33')](_0x243967[_0xc954('0x2f')][_0xc954('0x33')]));_0x853e4b[_0xc954('0x32')]=_0x853e4b[_0xc954('0x32')][_0xc954('0x34')]?_0x853e4b['attributes']:_0x4493a2['model'];if(_0x243967[_0xc954('0x2f')][_0xc954('0x3e')]){_0x853e4b['include']=[{'all':!![]}];}_0x853e4b=_['merge']({},_0x853e4b,_0x243967[_0xc954('0x3d')]);return db[_0xc954('0x29')][_0xc954('0x45')](_0x853e4b)[_0xc954('0x22')](handleEntityNotFound(_0x5b4db9,null))['then'](respondWithResult(_0x5b4db9,null))[_0xc954('0x42')](handleError(_0x5b4db9,null));};exports['create']=function(_0x1695fb,_0x4f2dab){return db[_0xc954('0x29')]['create'](_0x1695fb[_0xc954('0x46')],{})[_0xc954('0x22')](respondWithResult(_0x4f2dab,0xc9))[_0xc954('0x42')](handleError(_0x4f2dab,null));};exports[_0xc954('0x47')]=function(_0x927afb,_0x5266ef){if(_0x927afb[_0xc954('0x46')]['id']){delete _0x927afb[_0xc954('0x46')]['id'];}return db[_0xc954('0x29')][_0xc954('0x45')]({'where':{'id':_0x927afb[_0xc954('0x43')]['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x5266ef,null))[_0xc954('0x22')](saveUpdates(_0x927afb[_0xc954('0x46')],null))[_0xc954('0x22')](respondWithResult(_0x5266ef,null))[_0xc954('0x42')](handleError(_0x5266ef,null));};exports[_0xc954('0x23')]=function(_0x50ca0b,_0x5e4f2e){return db[_0xc954('0x29')][_0xc954('0x45')]({'where':{'id':_0x50ca0b['params']['id']}})['then'](handleEntityNotFound(_0x5e4f2e,null))[_0xc954('0x22')](removeEntity(_0x5e4f2e,null))['catch'](handleError(_0x5e4f2e,null));};exports[_0xc954('0x48')]=function(_0x5d5542,_0x21c228){return db['MailTransferReport'][_0xc954('0x48')]()['then'](respondWithResult(_0x21c228,null))[_0xc954('0x42')](handleError(_0x21c228,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b9730f5..e6c32a9 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 _0xb90f=['path','rimraf','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xb90f,0xba));var _0xfb90=function(_0x5d50cc,_0x3ef3af){_0x5d50cc=_0x5d50cc-0x0;var _0x588d5b=_0xb90f[_0x5d50cc];return _0x588d5b;};'use strict';var _=require(_0xfb90('0x0'));var util=require(_0xfb90('0x1'));var logger=require(_0xfb90('0x2'))(_0xfb90('0x3'));var moment=require('moment');var BPromise=require(_0xfb90('0x4'));var rp=require(_0xfb90('0x5'));var fs=require('fs');var path=require(_0xfb90('0x6'));var rimraf=require(_0xfb90('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xfb90('0x8')]=function(_0x1a3832,_0x2bee1c){return _0x1a3832['define'](_0xfb90('0x9'),attributes,{'tableName':_0xfb90('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfb90('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc53=['MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x731ce3,_0x46ecda){var _0x3ee6be=function(_0x4f8174){while(--_0x4f8174){_0x731ce3['push'](_0x731ce3['shift']());}};_0x3ee6be(++_0x46ecda);}(_0xbc53,0xb7));var _0x3bc5=function(_0x23f11b,_0x6a137c){_0x23f11b=_0x23f11b-0x0;var _0x356670=_0xbc53[_0x23f11b];return _0x356670;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3bc5('0x0'))('api');var moment=require(_0x3bc5('0x1'));var BPromise=require(_0x3bc5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bc5('0x3'));var rimraf=require(_0x3bc5('0x4'));var config=require(_0x3bc5('0x5'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xbc8f9c,_0x417918){return _0xbc8f9c[_0x3bc5('0x6')](_0x3bc5('0x7'),attributes,{'tableName':_0x3bc5('0x8'),'paranoid':![],'indexes':[{'name':_0x3bc5('0x9'),'fields':[_0x3bc5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 12d2c8b..e1543c1 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 _0x673b=['../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e1438,_0xc6962a){var _0x39ee96=function(_0x1f7698){while(--_0x1f7698){_0x3e1438['push'](_0x3e1438['shift']());}};_0x39ee96(++_0xc6962a);}(_0x673b,0xd8));var _0xb673=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0x673b[_0x279095];return _0x5a5cdb;};'use strict';var _=require(_0xb673('0x0'));var util=require('util');var moment=require(_0xb673('0x1'));var BPromise=require(_0xb673('0x2'));var rs=require(_0xb673('0x3'));var fs=require('fs');var Redis=require(_0xb673('0x4'));var db=require(_0xb673('0x5'))['db'];var utils=require(_0xb673('0x6'));var logger=require(_0xb673('0x7'))(_0xb673('0x8'));var config=require(_0xb673('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb673('0xa')][_0xb673('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fb95f,_0x22a3b3,_0x1d6c7d){return new BPromise(function(_0x43335e,_0x1da08c){return client[_0xb673('0xc')](_0x8fb95f,_0x1d6c7d)[_0xb673('0xd')](function(_0x32ed15){logger[_0xb673('0xe')](_0xb673('0xf'),_0x22a3b3,_0xb673('0x10'));logger[_0xb673('0x11')](_0xb673('0x12'),_0x22a3b3,_0xb673('0x10'),JSON[_0xb673('0x13')](_0x32ed15));if(_0x32ed15[_0xb673('0x14')]){if(_0x32ed15['error'][_0xb673('0x15')]===0x1f4){logger[_0xb673('0x14')](_0xb673('0xf'),_0x22a3b3,_0x32ed15['error']['message']);return _0x1da08c(_0x32ed15[_0xb673('0x14')]['message']);}logger[_0xb673('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x22a3b3,_0x32ed15[_0xb673('0x14')][_0xb673('0x16')]);return _0x43335e(_0x32ed15[_0xb673('0x14')]['message']);}else{logger[_0xb673('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x22a3b3,_0xb673('0x10'));_0x43335e(_0x32ed15[_0xb673('0x17')]['message']);}})[_0xb673('0x18')](function(_0x1415ea){logger[_0xb673('0x14')](_0xb673('0xf'),_0x22a3b3,_0x1415ea);_0x1da08c(_0x1415ea);});});} \ No newline at end of file +var _0xf2ed=['MailTransferReport,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0xf2ed,0x1a0));var _0xdf2e=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xf2ed[_0x22e9fe];return _0x47cd19;};'use strict';var _=require('lodash');var util=require(_0xdf2e('0x0'));var moment=require(_0xdf2e('0x1'));var BPromise=require(_0xdf2e('0x2'));var rs=require(_0xdf2e('0x3'));var fs=require('fs');var Redis=require(_0xdf2e('0x4'));var db=require(_0xdf2e('0x5'))['db'];var utils=require(_0xdf2e('0x6'));var logger=require('../../config/logger')(_0xdf2e('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf2e('0x8'));var client=jayson[_0xdf2e('0x9')][_0xdf2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x98cfe5,_0x3aa310,_0x3338a9){return new BPromise(function(_0x57bf00,_0x7b71bd){return client[_0xdf2e('0xb')](_0x98cfe5,_0x3338a9)[_0xdf2e('0xc')](function(_0x5f54b0){logger[_0xdf2e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3aa310,_0xdf2e('0xe'));logger[_0xdf2e('0xf')](_0xdf2e('0x10'),_0x3aa310,_0xdf2e('0xe'),JSON[_0xdf2e('0x11')](_0x5f54b0));if(_0x5f54b0[_0xdf2e('0x12')]){if(_0x5f54b0[_0xdf2e('0x12')][_0xdf2e('0x13')]===0x1f4){logger[_0xdf2e('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3aa310,_0x5f54b0[_0xdf2e('0x12')][_0xdf2e('0x14')]);return _0x7b71bd(_0x5f54b0[_0xdf2e('0x12')][_0xdf2e('0x14')]);}logger[_0xdf2e('0x12')](_0xdf2e('0x15'),_0x3aa310,_0x5f54b0['error'][_0xdf2e('0x14')]);return _0x57bf00(_0x5f54b0[_0xdf2e('0x12')][_0xdf2e('0x14')]);}else{logger[_0xdf2e('0xd')](_0xdf2e('0x15'),_0x3aa310,_0xdf2e('0xe'));_0x57bf00(_0x5f54b0[_0xdf2e('0x16')][_0xdf2e('0x14')]);}})['catch'](function(_0x11e96d){logger[_0xdf2e('0x12')](_0xdf2e('0x15'),_0x3aa310,_0x11e96d);_0x7b71bd(_0x11e96d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9a0a1c7..10d1c91 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 _0x0996=['/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x12f9d5,_0x3744df){var _0x2beb9a=function(_0x12111c){while(--_0x12111c){_0x12f9d5['push'](_0x12f9d5['shift']());}};_0x2beb9a(++_0x3744df);}(_0x0996,0x137));var _0x6099=function(_0x142dcb,_0x1e2ac0){_0x142dcb=_0x142dcb-0x0;var _0x5b9742=_0x0996[_0x142dcb];return _0x5b9742;};'use strict';var multer=require(_0x6099('0x0'));var util=require(_0x6099('0x1'));var path=require('path');var timeout=require(_0x6099('0x2'));var express=require(_0x6099('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6099('0x4'));var config=require(_0x6099('0x5'));var controller=require(_0x6099('0x6'));router['get']('/',auth[_0x6099('0x7')](),controller[_0x6099('0x8')]);router[_0x6099('0x9')](_0x6099('0xa'),auth[_0x6099('0x7')](),controller[_0x6099('0xb')]);router[_0x6099('0x9')](_0x6099('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6099('0x7')](),controller[_0x6099('0xd')]);router[_0x6099('0xe')](_0x6099('0xc'),auth['isAuthenticated'](),controller[_0x6099('0xf')]);router[_0x6099('0x10')](_0x6099('0xc'),auth[_0x6099('0x7')](),controller[_0x6099('0x11')]);module[_0x6099('0x12')]=router; \ No newline at end of file +var _0x740e=['../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x740e,0xd7));var _0xe740=function(_0x1e0448,_0x2c5a66){_0x1e0448=_0x1e0448-0x0;var _0x29dd26=_0x740e[_0x1e0448];return _0x29dd26;};'use strict';var multer=require(_0xe740('0x0'));var util=require(_0xe740('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe740('0x2')]();var auth=require(_0xe740('0x3'));var interaction=require(_0xe740('0x4'));var config=require(_0xe740('0x5'));var controller=require(_0xe740('0x6'));router[_0xe740('0x7')]('/',auth[_0xe740('0x8')](),controller['index']);router[_0xe740('0x7')](_0xe740('0x9'),auth[_0xe740('0x8')](),controller[_0xe740('0xa')]);router[_0xe740('0x7')](_0xe740('0xb'),auth[_0xe740('0x8')](),controller[_0xe740('0xc')]);router[_0xe740('0xd')]('/',auth[_0xe740('0x8')](),controller[_0xe740('0xe')]);router[_0xe740('0xf')](_0xe740('0xb'),auth[_0xe740('0x8')](),controller[_0xe740('0x10')]);router[_0xe740('0x11')](_0xe740('0xb'),auth[_0xe740('0x8')](),controller[_0xe740('0x12')]);module[_0xe740('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e325d80..ac763eb 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 _0x5c75=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x41ccfc,_0x307b8d){var _0x3c3609=function(_0x4bcb1f){while(--_0x4bcb1f){_0x41ccfc['push'](_0x41ccfc['shift']());}};_0x3c3609(++_0x307b8d);}(_0x5c75,0x1ea));var _0x55c7=function(_0x3ff7bc,_0x575e1e){_0x3ff7bc=_0x3ff7bc-0x0;var _0x5a1082=_0x5c75[_0x3ff7bc];return _0x5a1082;};'use strict';var Sequelize=require(_0x55c7('0x0'));var moment=require(_0x55c7('0x1'));module[_0x55c7('0x2')]={'channel':{'type':Sequelize[_0x55c7('0x3')]},'membername':{'type':Sequelize[_0x55c7('0x3')]},'interface':{'type':Sequelize[_0x55c7('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x55c7('0x4'),'comment':_0x55c7('0x5')},'duration':{'type':Sequelize[_0x55c7('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x556fee){var _0x1eff69=moment(_0x556fee);var _0x49126f=moment(this[_0x55c7('0x7')](_0x55c7('0x8')));var _0x42daba=_0x1eff69[_0x55c7('0x9')](_0x49126f,_0x55c7('0xa'));this[_0x55c7('0xb')](_0x55c7('0xc'),_0x556fee);this[_0x55c7('0xb')]('duration',_0x42daba||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x55c7('0xd')},'data2':{'type':Sequelize[_0x55c7('0x3')],'comment':_0x55c7('0xe')},'data3':{'type':Sequelize[_0x55c7('0x3')],'comment':_0x55c7('0xf')},'data4':{'type':Sequelize[_0x55c7('0x3')],'comment':_0x55c7('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x55c7('0x11')},'role':{'type':Sequelize[_0x55c7('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41af=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x41af,0x147));var _0xf41a=function(_0x369d70,_0x4750d2){_0x369d70=_0x369d70-0x0;var _0xbda593=_0x41af[_0x369d70];return _0xbda593;};'use strict';var Sequelize=require(_0xf41a('0x0'));var moment=require(_0xf41a('0x1'));module[_0xf41a('0x2')]={'channel':{'type':Sequelize[_0xf41a('0x3')]},'membername':{'type':Sequelize[_0xf41a('0x3')]},'interface':{'type':Sequelize[_0xf41a('0x3')]},'type':{'type':Sequelize[_0xf41a('0x3')],'defaultValue':_0xf41a('0x4'),'comment':_0xf41a('0x5')},'duration':{'type':Sequelize[_0xf41a('0x6')]},'enterAt':{'type':Sequelize[_0xf41a('0x7')]},'exitAt':{'type':Sequelize[_0xf41a('0x7')],'set':function(_0x534320){var _0x5ead3f=moment(_0x534320);var _0x413cfe=moment(this[_0xf41a('0x8')]('enterAt'));var _0x268ea7=_0x5ead3f[_0xf41a('0x9')](_0x413cfe,'seconds');this[_0xf41a('0xa')](_0xf41a('0xb'),_0x534320);this['setDataValue'](_0xf41a('0xc'),_0x268ea7||null);}},'data1':{'type':Sequelize[_0xf41a('0x3')],'comment':_0xf41a('0xd')},'data2':{'type':Sequelize[_0xf41a('0x3')],'comment':_0xf41a('0xe')},'data3':{'type':Sequelize[_0xf41a('0x3')],'comment':_0xf41a('0xf')},'data4':{'type':Sequelize[_0xf41a('0x3')],'comment':_0xf41a('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0xf41a('0x11')},'role':{'type':Sequelize[_0xf41a('0x3')]},'internal':{'type':Sequelize[_0xf41a('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 62f76ec..1429cee 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 _0x5a49=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','send','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb'];(function(_0x583056,_0xb4b31){var _0x3ce2dc=function(_0xcd5fbd){while(--_0xcd5fbd){_0x583056['push'](_0x583056['shift']());}};_0x3ce2dc(++_0xb4b31);}(_0x5a49,0x17e));var _0x95a4=function(_0x2f8b79,_0x31797d){_0x2f8b79=_0x2f8b79-0x0;var _0x676b72=_0x5a49[_0x2f8b79];return _0x676b72;};'use strict';var pdf=require(_0x95a4('0x0'));var emlformat=require(_0x95a4('0x1'));var rimraf=require(_0x95a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x95a4('0x3'));var moment=require(_0x95a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x95a4('0x5'));var util=require(_0x95a4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x95a4('0x7'));var ejs=require(_0x95a4('0x8'));var fs=require('fs');var _=require(_0x95a4('0x9'));var squel=require(_0x95a4('0xa'));var crypto=require(_0x95a4('0xb'));var jsforce=require(_0x95a4('0xc'));var deskjs=require(_0x95a4('0xd'));var toCsv=require(_0x95a4('0x7'));var querystring=require(_0x95a4('0xe'));var Papa=require(_0x95a4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95a4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95a4('0x11'));var utils=require(_0x95a4('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x95a4('0x13'))['db'];function respondWithStatusCode(_0x14bb72,_0x4aa9a5){_0x4aa9a5=_0x4aa9a5||0xcc;return function(_0x40df49){if(_0x40df49){return _0x14bb72[_0x95a4('0x14')](_0x4aa9a5);}return _0x14bb72[_0x95a4('0x15')](_0x4aa9a5)['end']();};}function respondWithResult(_0x4c538a,_0x10849e){_0x10849e=_0x10849e||0xc8;return function(_0x27f128){if(_0x27f128){return _0x4c538a[_0x95a4('0x15')](_0x10849e)[_0x95a4('0x16')](_0x27f128);}};}function respondWithFilteredResult(_0x4527a0,_0x4087f7){return function(_0x5d1009){if(_0x5d1009){var _0xc45b2e=_0x5d1009[_0x95a4('0x17')],_0x3d3f17=_0x4087f7['offset'],_0x3900a2=_0x4087f7[_0x95a4('0x18')]+_0x4087f7[_0x95a4('0x19')],_0x39eee0;if(_0x3900a2>=_0xc45b2e){_0x3900a2=_0xc45b2e;_0x39eee0=0xc8;}else{_0x39eee0=0xce;}_0x4527a0['status'](_0x39eee0);return _0x4527a0[_0x95a4('0x1a')](_0x95a4('0x1b'),_0x3d3f17+'-'+_0x3900a2+'/'+_0xc45b2e)[_0x95a4('0x16')](_0x5d1009);}return null;};}function patchUpdates(_0x5eead1){return function(_0x10eb44){try{jsonpatch[_0x95a4('0x1c')](_0x10eb44,_0x5eead1,!![]);}catch(_0x13cff8){return BPromise[_0x95a4('0x1d')](_0x13cff8);}return _0x10eb44['save']();};}function saveUpdates(_0x537905,_0x39024d){return function(_0x591d09){if(_0x591d09){return _0x591d09['update'](_0x537905)[_0x95a4('0x1e')](function(_0x33335c){return _0x33335c;});}return null;};}function removeEntity(_0x1b2c91,_0x4def84){return function(_0x496062){if(_0x496062){return _0x496062[_0x95a4('0x1f')]()[_0x95a4('0x1e')](function(){_0x1b2c91[_0x95a4('0x15')](0xcc)[_0x95a4('0x20')]();});}};}function handleEntityNotFound(_0x56abfb,_0x34f4a6){return function(_0x3f2c0d){if(!_0x3f2c0d){_0x56abfb[_0x95a4('0x14')](0x194);}return _0x3f2c0d;};}function handleError(_0x4e331a,_0x46fd42){_0x46fd42=_0x46fd42||0x1f4;return function(_0x4a58f8){logger[_0x95a4('0x21')](_0x4a58f8[_0x95a4('0x22')]);if(_0x4a58f8['name']){delete _0x4a58f8['name'];}_0x4e331a[_0x95a4('0x15')](_0x46fd42)[_0x95a4('0x23')](_0x4a58f8);};}exports['index']=function(_0xe39c80,_0x359729){var _0x36515a={},_0x55e08b={},_0x2bdb40={'count':0x0,'rows':[]};var _0x5020b2=_[_0x95a4('0x24')](db[_0x95a4('0x25')][_0x95a4('0x26')],function(_0x1785f5){return{'name':_0x1785f5[_0x95a4('0x27')],'type':_0x1785f5[_0x95a4('0x28')]['key']};});_0x55e08b[_0x95a4('0x29')]=_[_0x95a4('0x24')](_0x5020b2,'name');_0x55e08b[_0x95a4('0x2a')]=_[_0x95a4('0x2b')](_0xe39c80['query']);_0x55e08b[_0x95a4('0x2c')]=_[_0x95a4('0x2d')](_0x55e08b['model'],_0x55e08b[_0x95a4('0x2a')]);_0x36515a[_0x95a4('0x2e')]=_[_0x95a4('0x2d')](_0x55e08b[_0x95a4('0x29')],qs['fields'](_0xe39c80[_0x95a4('0x2a')][_0x95a4('0x2f')]));_0x36515a['attributes']=_0x36515a[_0x95a4('0x2e')][_0x95a4('0x30')]?_0x36515a[_0x95a4('0x2e')]:_0x55e08b['model'];if(!_0xe39c80[_0x95a4('0x2a')]['hasOwnProperty'](_0x95a4('0x31'))){_0x36515a[_0x95a4('0x19')]=qs['limit'](_0xe39c80[_0x95a4('0x2a')]['limit']);_0x36515a[_0x95a4('0x18')]=qs[_0x95a4('0x18')](_0xe39c80[_0x95a4('0x2a')][_0x95a4('0x18')]);}_0x36515a[_0x95a4('0x32')]=qs['sort'](_0xe39c80[_0x95a4('0x2a')][_0x95a4('0x33')]);_0x36515a['where']=qs[_0x95a4('0x2c')](_[_0x95a4('0x34')](_0xe39c80[_0x95a4('0x2a')],_0x55e08b['filters']),_0x5020b2);if(_0xe39c80[_0x95a4('0x2a')][_0x95a4('0x35')]){_0x36515a[_0x95a4('0x36')]=_[_0x95a4('0x37')](_0x36515a[_0x95a4('0x36')],{'$or':_[_0x95a4('0x24')](_0x5020b2,function(_0x5832ec){if(_0x5832ec[_0x95a4('0x28')]!=='VIRTUAL'){var _0x533097={};_0x533097[_0x5832ec['name']]={'$like':'%'+_0xe39c80[_0x95a4('0x2a')][_0x95a4('0x35')]+'%'};return _0x533097;}})});}_0x36515a=_[_0x95a4('0x37')]({},_0x36515a,_0xe39c80[_0x95a4('0x38')]);var _0x181a01={'where':_0x36515a['where']};return db[_0x95a4('0x25')][_0x95a4('0x17')](_0x181a01)[_0x95a4('0x1e')](function(_0x131a27){_0x2bdb40['count']=_0x131a27;if(_0xe39c80['query'][_0x95a4('0x39')]){_0x36515a[_0x95a4('0x3a')]=[{'all':!![]}];}return db[_0x95a4('0x25')][_0x95a4('0x3b')](_0x36515a);})[_0x95a4('0x1e')](function(_0x5229e4){_0x2bdb40[_0x95a4('0x3c')]=_0x5229e4;return _0x2bdb40;})[_0x95a4('0x1e')](respondWithFilteredResult(_0x359729,_0x36515a))[_0x95a4('0x3d')](handleError(_0x359729,null));};exports['show']=function(_0x50dbcf,_0x588da8){var _0x5e9260={'raw':!![],'where':{'id':_0x50dbcf['params']['id']}},_0x7bfbcc={};_0x7bfbcc[_0x95a4('0x29')]=_[_0x95a4('0x2b')](db['MemberReport'][_0x95a4('0x26')]);_0x7bfbcc[_0x95a4('0x2a')]=_[_0x95a4('0x2b')](_0x50dbcf[_0x95a4('0x2a')]);_0x7bfbcc['filters']=_['intersection'](_0x7bfbcc['model'],_0x7bfbcc['query']);_0x5e9260[_0x95a4('0x2e')]=_[_0x95a4('0x2d')](_0x7bfbcc[_0x95a4('0x29')],qs['fields'](_0x50dbcf[_0x95a4('0x2a')][_0x95a4('0x2f')]));_0x5e9260[_0x95a4('0x2e')]=_0x5e9260[_0x95a4('0x2e')][_0x95a4('0x30')]?_0x5e9260[_0x95a4('0x2e')]:_0x7bfbcc['model'];if(_0x50dbcf[_0x95a4('0x2a')][_0x95a4('0x39')]){_0x5e9260[_0x95a4('0x3a')]=[{'all':!![]}];}_0x5e9260=_[_0x95a4('0x37')]({},_0x5e9260,_0x50dbcf[_0x95a4('0x38')]);return db[_0x95a4('0x25')][_0x95a4('0x3e')](_0x5e9260)[_0x95a4('0x1e')](handleEntityNotFound(_0x588da8,null))['then'](respondWithResult(_0x588da8,null))[_0x95a4('0x3d')](handleError(_0x588da8,null));};exports[_0x95a4('0x3f')]=function(_0x801b4,_0x226b94){return db['MemberReport'][_0x95a4('0x3f')](_0x801b4[_0x95a4('0x40')],{})[_0x95a4('0x1e')](respondWithResult(_0x226b94,0xc9))[_0x95a4('0x3d')](handleError(_0x226b94,null));};exports['update']=function(_0x4d365e,_0x3d3f80){if(_0x4d365e[_0x95a4('0x40')]['id']){delete _0x4d365e['body']['id'];}return db[_0x95a4('0x25')][_0x95a4('0x3e')]({'where':{'id':_0x4d365e[_0x95a4('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d3f80,null))[_0x95a4('0x1e')](saveUpdates(_0x4d365e['body'],null))[_0x95a4('0x1e')](respondWithResult(_0x3d3f80,null))['catch'](handleError(_0x3d3f80,null));};exports['destroy']=function(_0x5d6ef4,_0xb6e0dd){return db[_0x95a4('0x25')][_0x95a4('0x3e')]({'where':{'id':_0x5d6ef4[_0x95a4('0x41')]['id']}})[_0x95a4('0x1e')](handleEntityNotFound(_0xb6e0dd,null))['then'](removeEntity(_0xb6e0dd,null))[_0x95a4('0x3d')](handleError(_0xb6e0dd,null));};exports[_0x95a4('0x42')]=function(_0x1e3f5a,_0x2a1643){return db[_0x95a4('0x25')][_0x95a4('0x42')]()['then'](respondWithResult(_0x2a1643,null))[_0x95a4('0x3d')](handleError(_0x2a1643,null));}; \ No newline at end of file +var _0xe4c6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','MemberReport','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x55af0b,_0x2755ac){var _0x357b62=function(_0x17db82){while(--_0x17db82){_0x55af0b['push'](_0x55af0b['shift']());}};_0x357b62(++_0x2755ac);}(_0xe4c6,0x1dc));var _0x6e4c=function(_0x1e6186,_0x506f03){_0x1e6186=_0x1e6186-0x0;var _0x40d6bf=_0xe4c6[_0x1e6186];return _0x40d6bf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6e4c('0x0'));var zipdir=require(_0x6e4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e4c('0x2'));var moment=require('moment');var BPromise=require(_0x6e4c('0x3'));var Mustache=require(_0x6e4c('0x4'));var util=require(_0x6e4c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6e4c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e4c('0x7'));var squel=require(_0x6e4c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e4c('0x6'));var querystring=require(_0x6e4c('0x9'));var Papa=require(_0x6e4c('0xa'));var Redis=require('ioredis');var authService=require(_0x6e4c('0xb'));var qs=require(_0x6e4c('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e4c('0xd'));var logger=require('../../config/logger')(_0x6e4c('0xe'));var utils=require(_0x6e4c('0xf'));var config=require(_0x6e4c('0x10'));var licenseUtil=require(_0x6e4c('0x11'));var db=require(_0x6e4c('0x12'))['db'];function respondWithStatusCode(_0xa5aa48,_0x2ef9db){_0x2ef9db=_0x2ef9db||0xcc;return function(_0x359a32){if(_0x359a32){return _0xa5aa48[_0x6e4c('0x13')](_0x2ef9db);}return _0xa5aa48[_0x6e4c('0x14')](_0x2ef9db)['end']();};}function respondWithResult(_0x469d5e,_0x3e96fa){_0x3e96fa=_0x3e96fa||0xc8;return function(_0x36d15e){if(_0x36d15e){return _0x469d5e[_0x6e4c('0x14')](_0x3e96fa)[_0x6e4c('0x15')](_0x36d15e);}};}function respondWithFilteredResult(_0x36c8fd,_0x57bf96){return function(_0x3a08bd){if(_0x3a08bd){var _0x2ae102=_0x3a08bd[_0x6e4c('0x16')],_0x357544=_0x57bf96['offset'],_0x2a7db5=_0x57bf96[_0x6e4c('0x17')]+_0x57bf96[_0x6e4c('0x18')],_0x47bcd4;if(_0x2a7db5>=_0x2ae102){_0x2a7db5=_0x2ae102;_0x47bcd4=0xc8;}else{_0x47bcd4=0xce;}_0x36c8fd[_0x6e4c('0x14')](_0x47bcd4);return _0x36c8fd['set']('Content-Range',_0x357544+'-'+_0x2a7db5+'/'+_0x2ae102)[_0x6e4c('0x15')](_0x3a08bd);}return null;};}function patchUpdates(_0x1e7d13){return function(_0x5d3426){try{jsonpatch[_0x6e4c('0x19')](_0x5d3426,_0x1e7d13,!![]);}catch(_0x57a0cd){return BPromise[_0x6e4c('0x1a')](_0x57a0cd);}return _0x5d3426[_0x6e4c('0x1b')]();};}function saveUpdates(_0x49954c,_0x38fa77){return function(_0x40344e){if(_0x40344e){return _0x40344e[_0x6e4c('0x1c')](_0x49954c)[_0x6e4c('0x1d')](function(_0x47830a){return _0x47830a;});}return null;};}function removeEntity(_0x136394,_0x4d9474){return function(_0x22d3b2){if(_0x22d3b2){return _0x22d3b2[_0x6e4c('0x1e')]()[_0x6e4c('0x1d')](function(){_0x136394[_0x6e4c('0x14')](0xcc)[_0x6e4c('0x1f')]();});}};}function handleEntityNotFound(_0x268cd0,_0x24c105){return function(_0x305cc0){if(!_0x305cc0){_0x268cd0['sendStatus'](0x194);}return _0x305cc0;};}function handleError(_0x28d15c,_0x131607){_0x131607=_0x131607||0x1f4;return function(_0x3f7263){logger[_0x6e4c('0x20')](_0x3f7263[_0x6e4c('0x21')]);if(_0x3f7263[_0x6e4c('0x22')]){delete _0x3f7263[_0x6e4c('0x22')];}_0x28d15c[_0x6e4c('0x14')](_0x131607)['send'](_0x3f7263);};}exports[_0x6e4c('0x23')]=function(_0x4490ca,_0x314962){var _0x414fab={},_0x3c3480={},_0x53bd79={'count':0x0,'rows':[]};var _0x242edf=_['map'](db['MemberReport'][_0x6e4c('0x24')],function(_0x1413c7){return{'name':_0x1413c7[_0x6e4c('0x25')],'type':_0x1413c7[_0x6e4c('0x26')][_0x6e4c('0x27')]};});_0x3c3480[_0x6e4c('0x28')]=_['map'](_0x242edf,_0x6e4c('0x22'));_0x3c3480['query']=_[_0x6e4c('0x29')](_0x4490ca[_0x6e4c('0x2a')]);_0x3c3480[_0x6e4c('0x2b')]=_[_0x6e4c('0x2c')](_0x3c3480['model'],_0x3c3480['query']);_0x414fab[_0x6e4c('0x2d')]=_[_0x6e4c('0x2c')](_0x3c3480[_0x6e4c('0x28')],qs[_0x6e4c('0x2e')](_0x4490ca[_0x6e4c('0x2a')]['fields']));_0x414fab[_0x6e4c('0x2d')]=_0x414fab[_0x6e4c('0x2d')][_0x6e4c('0x2f')]?_0x414fab[_0x6e4c('0x2d')]:_0x3c3480[_0x6e4c('0x28')];if(!_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x30')](_0x6e4c('0x31'))){_0x414fab['limit']=qs['limit'](_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x18')]);_0x414fab[_0x6e4c('0x17')]=qs[_0x6e4c('0x17')](_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x17')]);}_0x414fab[_0x6e4c('0x32')]=qs['sort'](_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x33')]);_0x414fab[_0x6e4c('0x34')]=qs[_0x6e4c('0x2b')](_[_0x6e4c('0x35')](_0x4490ca[_0x6e4c('0x2a')],_0x3c3480[_0x6e4c('0x2b')]),_0x242edf);if(_0x4490ca['query']['filter']){_0x414fab[_0x6e4c('0x34')]=_[_0x6e4c('0x36')](_0x414fab[_0x6e4c('0x34')],{'$or':_[_0x6e4c('0x37')](_0x242edf,function(_0x3a0907){if(_0x3a0907['type']!==_0x6e4c('0x38')){var _0x4a9792={};_0x4a9792[_0x3a0907[_0x6e4c('0x22')]]={'$like':'%'+_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x39')]+'%'};return _0x4a9792;}})});}_0x414fab=_[_0x6e4c('0x36')]({},_0x414fab,_0x4490ca[_0x6e4c('0x3a')]);var _0x377cc6={'where':_0x414fab[_0x6e4c('0x34')]};return db['MemberReport'][_0x6e4c('0x16')](_0x377cc6)[_0x6e4c('0x1d')](function(_0x2733ef){_0x53bd79[_0x6e4c('0x16')]=_0x2733ef;if(_0x4490ca[_0x6e4c('0x2a')][_0x6e4c('0x3b')]){_0x414fab[_0x6e4c('0x3c')]=[{'all':!![]}];}return db[_0x6e4c('0x3d')][_0x6e4c('0x3e')](_0x414fab);})[_0x6e4c('0x1d')](function(_0x39a41d){_0x53bd79[_0x6e4c('0x3f')]=_0x39a41d;return _0x53bd79;})['then'](respondWithFilteredResult(_0x314962,_0x414fab))[_0x6e4c('0x40')](handleError(_0x314962,null));};exports['show']=function(_0x308a8b,_0x5db8ea){var _0x3e33fe={'raw':!![],'where':{'id':_0x308a8b['params']['id']}},_0x2eedae={};_0x2eedae['model']=_[_0x6e4c('0x29')](db['MemberReport'][_0x6e4c('0x24')]);_0x2eedae['query']=_['keys'](_0x308a8b[_0x6e4c('0x2a')]);_0x2eedae[_0x6e4c('0x2b')]=_[_0x6e4c('0x2c')](_0x2eedae[_0x6e4c('0x28')],_0x2eedae[_0x6e4c('0x2a')]);_0x3e33fe['attributes']=_[_0x6e4c('0x2c')](_0x2eedae[_0x6e4c('0x28')],qs[_0x6e4c('0x2e')](_0x308a8b[_0x6e4c('0x2a')][_0x6e4c('0x2e')]));_0x3e33fe['attributes']=_0x3e33fe[_0x6e4c('0x2d')][_0x6e4c('0x2f')]?_0x3e33fe[_0x6e4c('0x2d')]:_0x2eedae[_0x6e4c('0x28')];if(_0x308a8b[_0x6e4c('0x2a')][_0x6e4c('0x3b')]){_0x3e33fe['include']=[{'all':!![]}];}_0x3e33fe=_[_0x6e4c('0x36')]({},_0x3e33fe,_0x308a8b[_0x6e4c('0x3a')]);return db[_0x6e4c('0x3d')][_0x6e4c('0x41')](_0x3e33fe)['then'](handleEntityNotFound(_0x5db8ea,null))[_0x6e4c('0x1d')](respondWithResult(_0x5db8ea,null))['catch'](handleError(_0x5db8ea,null));};exports[_0x6e4c('0x42')]=function(_0x41c365,_0x1ad5f3){return db[_0x6e4c('0x3d')]['create'](_0x41c365[_0x6e4c('0x43')],{})[_0x6e4c('0x1d')](respondWithResult(_0x1ad5f3,0xc9))[_0x6e4c('0x40')](handleError(_0x1ad5f3,null));};exports['update']=function(_0x379dfa,_0x47c969){if(_0x379dfa[_0x6e4c('0x43')]['id']){delete _0x379dfa[_0x6e4c('0x43')]['id'];}return db[_0x6e4c('0x3d')][_0x6e4c('0x41')]({'where':{'id':_0x379dfa[_0x6e4c('0x44')]['id']}})[_0x6e4c('0x1d')](handleEntityNotFound(_0x47c969,null))[_0x6e4c('0x1d')](saveUpdates(_0x379dfa[_0x6e4c('0x43')],null))['then'](respondWithResult(_0x47c969,null))[_0x6e4c('0x40')](handleError(_0x47c969,null));};exports['destroy']=function(_0x8b3aaa,_0x560368){return db[_0x6e4c('0x3d')][_0x6e4c('0x41')]({'where':{'id':_0x8b3aaa[_0x6e4c('0x44')]['id']}})[_0x6e4c('0x1d')](handleEntityNotFound(_0x560368,null))[_0x6e4c('0x1d')](removeEntity(_0x560368,null))['catch'](handleError(_0x560368,null));};exports['describe']=function(_0x49750e,_0xb6f754){return db[_0x6e4c('0x3d')][_0x6e4c('0x45')]()[_0x6e4c('0x1d')](respondWithResult(_0xb6f754,null))[_0x6e4c('0x40')](handleError(_0xb6f754,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index b467f01..3a4efb2 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 _0x199b=['request-promise','path','./memberReport.attributes','exports','define','report_member','membername_interface','membername','util','../../config/logger','api','moment','bluebird'];(function(_0x25a32a,_0xc7b0b2){var _0x5b6e6d=function(_0x4f184d){while(--_0x4f184d){_0x25a32a['push'](_0x25a32a['shift']());}};_0x5b6e6d(++_0xc7b0b2);}(_0x199b,0xbe));var _0xb199=function(_0x105b3a,_0x3f146c){_0x105b3a=_0x105b3a-0x0;var _0x561a8f=_0x199b[_0x105b3a];return _0x561a8f;};'use strict';var _=require('lodash');var util=require(_0xb199('0x0'));var logger=require(_0xb199('0x1'))(_0xb199('0x2'));var moment=require(_0xb199('0x3'));var BPromise=require(_0xb199('0x4'));var rp=require(_0xb199('0x5'));var fs=require('fs');var path=require(_0xb199('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb199('0x7'));module[_0xb199('0x8')]=function(_0x3472b5,_0x238b81){return _0x3472b5[_0xb199('0x9')]('MemberReport',attributes,{'tableName':_0xb199('0xa'),'paranoid':![],'indexes':[{'name':_0xb199('0xb'),'fields':[_0xb199('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8233=['bluebird','request-promise','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash','util','api','moment'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x8233,0x98));var _0x3823=function(_0x342072,_0x50bf45){_0x342072=_0x342072-0x0;var _0x530822=_0x8233[_0x342072];return _0x530822;};'use strict';var _=require(_0x3823('0x0'));var util=require(_0x3823('0x1'));var logger=require('../../config/logger')(_0x3823('0x2'));var moment=require(_0x3823('0x3'));var BPromise=require(_0x3823('0x4'));var rp=require(_0x3823('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3823('0x6'));var attributes=require(_0x3823('0x7'));module['exports']=function(_0x2a85d,_0x1889a3){return _0x2a85d[_0x3823('0x8')]('MemberReport',attributes,{'tableName':_0x3823('0x9'),'paranoid':![],'indexes':[{'name':_0x3823('0xa'),'fields':[_0x3823('0xb'),_0x3823('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 4e2c345..b065eac 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 _0x251d=['model','create','raw','CreateMemberReport','UpdateMemberReport','MemberReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','where','attributes','limit','include','map'];(function(_0x319412,_0x3e5995){var _0x2d78b3=function(_0x295ed6){while(--_0x295ed6){_0x319412['push'](_0x319412['shift']());}};_0x2d78b3(++_0x3e5995);}(_0x251d,0x1cf));var _0xd251=function(_0x38af15,_0x1f9dd0){_0x38af15=_0x38af15-0x0;var _0x552ed2=_0x251d[_0x38af15];return _0x552ed2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd251('0x0'));var BPromise=require(_0xd251('0x1'));var rs=require(_0xd251('0x2'));var fs=require('fs');var Redis=require(_0xd251('0x3'));var db=require(_0xd251('0x4'))['db'];var utils=require(_0xd251('0x5'));var logger=require(_0xd251('0x6'))(_0xd251('0x7'));var config=require(_0xd251('0x8'));var jayson=require(_0xd251('0x9'));var client=jayson['client'][_0xd251('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb18b5,_0x26fad5,_0x59f15f){return new BPromise(function(_0x476ecb,_0x5a0f81){return client[_0xd251('0xb')](_0xcb18b5,_0x59f15f)[_0xd251('0xc')](function(_0x2cf7bd){logger[_0xd251('0xd')](_0xd251('0xe'),_0x26fad5,_0xd251('0xf'));logger[_0xd251('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x26fad5,_0xd251('0xf'),JSON[_0xd251('0x11')](_0x2cf7bd));if(_0x2cf7bd[_0xd251('0x12')]){if(_0x2cf7bd[_0xd251('0x12')][_0xd251('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x26fad5,_0x2cf7bd[_0xd251('0x12')][_0xd251('0x14')]);return _0x5a0f81(_0x2cf7bd[_0xd251('0x12')][_0xd251('0x14')]);}logger[_0xd251('0x12')]('MemberReport,\x20%s,\x20%s',_0x26fad5,_0x2cf7bd[_0xd251('0x12')]['message']);return _0x476ecb(_0x2cf7bd[_0xd251('0x12')][_0xd251('0x14')]);}else{logger[_0xd251('0xd')](_0xd251('0xe'),_0x26fad5,'request\x20sent');_0x476ecb(_0x2cf7bd[_0xd251('0x15')][_0xd251('0x14')]);}})[_0xd251('0x16')](function(_0x21f491){logger[_0xd251('0x12')]('MemberReport,\x20%s,\x20%s',_0x26fad5,_0x21f491);_0x5a0f81(_0x21f491);});});}exports[_0xd251('0x17')]=function(_0xafd1f2){var _0x162002=this;return new Promise(function(_0x435ca8,_0x4acc17){return db['MemberReport'][_0xd251('0x18')]({'raw':_0xafd1f2[_0xd251('0x19')]?_0xafd1f2[_0xd251('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xafd1f2['options']?_0xafd1f2['options'][_0xd251('0x1a')]||null:null,'attributes':_0xafd1f2[_0xd251('0x19')]?_0xafd1f2[_0xd251('0x19')][_0xd251('0x1b')]||null:null,'limit':_0xafd1f2[_0xd251('0x19')]?_0xafd1f2[_0xd251('0x19')][_0xd251('0x1c')]||null:null,'include':_0xafd1f2['options']?_0xafd1f2[_0xd251('0x19')][_0xd251('0x1d')]?_[_0xd251('0x1e')](_0xafd1f2[_0xd251('0x19')]['include'],function(_0x56efc3){return{'model':db[_0x56efc3['model']],'as':_0x56efc3['as'],'attributes':_0x56efc3[_0xd251('0x1b')],'include':_0x56efc3['include']?_[_0xd251('0x1e')](_0x56efc3[_0xd251('0x1d')],function(_0x1c9e2a){return{'model':db[_0x1c9e2a[_0xd251('0x1f')]],'as':_0x1c9e2a['as'],'attributes':_0x1c9e2a['attributes'],'include':_0x1c9e2a[_0xd251('0x1d')]?_[_0xd251('0x1e')](_0x1c9e2a['include'],function(_0x2e5463){return{'model':db[_0x2e5463[_0xd251('0x1f')]],'as':_0x2e5463['as'],'attributes':_0x2e5463[_0xd251('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd251('0xc')](function(_0x3d18eb){logger[_0xd251('0xd')](_0xd251('0x17'),_0xafd1f2);logger[_0xd251('0x10')](_0xd251('0x17'),_0xafd1f2,JSON[_0xd251('0x11')](_0x3d18eb));_0x435ca8(_0x3d18eb);})['catch'](function(_0x31a0b3){logger[_0xd251('0x12')](_0xd251('0x17'),_0x31a0b3[_0xd251('0x14')],_0xafd1f2);_0x4acc17(_0x162002['error'](0x1f4,_0x31a0b3[_0xd251('0x14')]));});});};exports['CreateMemberReport']=function(_0x52df99){var _0x1394c3=this;return new Promise(function(_0x4a1104,_0x4f8a5b){return db['MemberReport'][_0xd251('0x20')](_0x52df99['body'],{'raw':_0x52df99[_0xd251('0x19')]?_0x52df99[_0xd251('0x19')][_0xd251('0x21')]===undefined?!![]:![]:!![]})[_0xd251('0xc')](function(_0xca2078){logger[_0xd251('0xd')](_0xd251('0x22'),_0x52df99);logger[_0xd251('0x10')](_0xd251('0x22'),_0x52df99,JSON[_0xd251('0x11')](_0xca2078));_0x4a1104(_0xca2078);})['catch'](function(_0x313c0e){logger[_0xd251('0x12')](_0xd251('0x22'),_0x313c0e[_0xd251('0x14')],_0x52df99);_0x4f8a5b(_0x1394c3[_0xd251('0x12')](0x1f4,_0x313c0e['message']));});});};exports[_0xd251('0x23')]=function(_0x463b79){var _0x51c98d=this;return new Promise(function(_0x5461b8,_0x270bbc){return db[_0xd251('0x24')][_0xd251('0x25')](_0x463b79['body'],{'raw':_0x463b79[_0xd251('0x19')]?_0x463b79[_0xd251('0x19')][_0xd251('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463b79[_0xd251('0x19')]?_0x463b79[_0xd251('0x19')][_0xd251('0x1a')]||null:null,'attributes':_0x463b79[_0xd251('0x19')]?_0x463b79[_0xd251('0x19')]['attributes']||null:null,'limit':_0x463b79[_0xd251('0x19')]?_0x463b79['options']['limit']||null:null})['then'](function(_0x4ec24c){logger[_0xd251('0xd')](_0xd251('0x23'),_0x463b79);logger[_0xd251('0x10')](_0xd251('0x23'),_0x463b79,JSON[_0xd251('0x11')](_0x4ec24c));_0x5461b8(_0x4ec24c);})['catch'](function(_0x579937){logger['error'](_0xd251('0x23'),_0x579937[_0xd251('0x14')],_0x463b79);_0x270bbc(_0x51c98d[_0xd251('0x12')](0x1f4,_0x579937[_0xd251('0x14')]));});});}; \ No newline at end of file +var _0x22dc=['update','UpdateMemberReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','stringify','catch','CreateMemberReport','create','body'];(function(_0x2eb582,_0x134d99){var _0x5e9585=function(_0x4744bc){while(--_0x4744bc){_0x2eb582['push'](_0x2eb582['shift']());}};_0x5e9585(++_0x134d99);}(_0x22dc,0xec));var _0xc22d=function(_0x18f040,_0xc6a0ac){_0x18f040=_0x18f040-0x0;var _0xa40e81=_0x22dc[_0x18f040];return _0xa40e81;};'use strict';var _=require(_0xc22d('0x0'));var util=require(_0xc22d('0x1'));var moment=require('moment');var BPromise=require(_0xc22d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc22d('0x3'));var db=require(_0xc22d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc22d('0x5'))(_0xc22d('0x6'));var config=require(_0xc22d('0x7'));var jayson=require(_0xc22d('0x8'));var client=jayson[_0xc22d('0x9')][_0xc22d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x819a7a,_0x40fc5e,_0x4b3aa8){return new BPromise(function(_0xa0c602,_0x2c526f){return client[_0xc22d('0xb')](_0x819a7a,_0x4b3aa8)[_0xc22d('0xc')](function(_0x57f4ad){logger[_0xc22d('0xd')](_0xc22d('0xe'),_0x40fc5e,_0xc22d('0xf'));logger[_0xc22d('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x40fc5e,_0xc22d('0xf'),JSON['stringify'](_0x57f4ad));if(_0x57f4ad[_0xc22d('0x11')]){if(_0x57f4ad['error'][_0xc22d('0x12')]===0x1f4){logger[_0xc22d('0x11')]('MemberReport,\x20%s,\x20%s',_0x40fc5e,_0x57f4ad['error'][_0xc22d('0x13')]);return _0x2c526f(_0x57f4ad['error'][_0xc22d('0x13')]);}logger['error'](_0xc22d('0xe'),_0x40fc5e,_0x57f4ad[_0xc22d('0x11')]['message']);return _0xa0c602(_0x57f4ad[_0xc22d('0x11')]['message']);}else{logger['info'](_0xc22d('0xe'),_0x40fc5e,'request\x20sent');_0xa0c602(_0x57f4ad[_0xc22d('0x14')]['message']);}})['catch'](function(_0x59af57){logger[_0xc22d('0x11')](_0xc22d('0xe'),_0x40fc5e,_0x59af57);_0x2c526f(_0x59af57);});});}exports[_0xc22d('0x15')]=function(_0xab8b5a){var _0x502b7b=this;return new Promise(function(_0x1e1596,_0x1d5e38){return db[_0xc22d('0x16')][_0xc22d('0x17')]({'raw':_0xab8b5a['options']?_0xab8b5a[_0xc22d('0x18')][_0xc22d('0x19')]===undefined?!![]:![]:!![],'where':_0xab8b5a['options']?_0xab8b5a['options'][_0xc22d('0x1a')]||null:null,'attributes':_0xab8b5a[_0xc22d('0x18')]?_0xab8b5a[_0xc22d('0x18')][_0xc22d('0x1b')]||null:null,'limit':_0xab8b5a[_0xc22d('0x18')]?_0xab8b5a[_0xc22d('0x18')][_0xc22d('0x1c')]||null:null,'include':_0xab8b5a[_0xc22d('0x18')]?_0xab8b5a[_0xc22d('0x18')][_0xc22d('0x1d')]?_['map'](_0xab8b5a[_0xc22d('0x18')][_0xc22d('0x1d')],function(_0x3a1bd5){return{'model':db[_0x3a1bd5[_0xc22d('0x1e')]],'as':_0x3a1bd5['as'],'attributes':_0x3a1bd5[_0xc22d('0x1b')],'include':_0x3a1bd5[_0xc22d('0x1d')]?_[_0xc22d('0x1f')](_0x3a1bd5[_0xc22d('0x1d')],function(_0x4f2e77){return{'model':db[_0x4f2e77[_0xc22d('0x1e')]],'as':_0x4f2e77['as'],'attributes':_0x4f2e77[_0xc22d('0x1b')],'include':_0x4f2e77[_0xc22d('0x1d')]?_[_0xc22d('0x1f')](_0x4f2e77[_0xc22d('0x1d')],function(_0x11b904){return{'model':db[_0x11b904[_0xc22d('0x1e')]],'as':_0x11b904['as'],'attributes':_0x11b904[_0xc22d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc22d('0xc')](function(_0x27f088){logger[_0xc22d('0xd')](_0xc22d('0x15'),_0xab8b5a);logger['debug'](_0xc22d('0x15'),_0xab8b5a,JSON[_0xc22d('0x20')](_0x27f088));_0x1e1596(_0x27f088);})[_0xc22d('0x21')](function(_0x385bec){logger[_0xc22d('0x11')]('GetMemberReport',_0x385bec['message'],_0xab8b5a);_0x1d5e38(_0x502b7b[_0xc22d('0x11')](0x1f4,_0x385bec[_0xc22d('0x13')]));});});};exports[_0xc22d('0x22')]=function(_0x36e661){var _0x2b8dcb=this;return new Promise(function(_0x1ec6ab,_0x3806c2){return db[_0xc22d('0x16')][_0xc22d('0x23')](_0x36e661[_0xc22d('0x24')],{'raw':_0x36e661[_0xc22d('0x18')]?_0x36e661[_0xc22d('0x18')][_0xc22d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x20d76f){logger[_0xc22d('0xd')](_0xc22d('0x22'),_0x36e661);logger['debug'](_0xc22d('0x22'),_0x36e661,JSON[_0xc22d('0x20')](_0x20d76f));_0x1ec6ab(_0x20d76f);})['catch'](function(_0x297d87){logger['error'](_0xc22d('0x22'),_0x297d87[_0xc22d('0x13')],_0x36e661);_0x3806c2(_0x2b8dcb['error'](0x1f4,_0x297d87['message']));});});};exports['UpdateMemberReport']=function(_0x3a4f21){var _0x5730ea=this;return new Promise(function(_0x22c160,_0x39bccf){return db['MemberReport'][_0xc22d('0x25')](_0x3a4f21[_0xc22d('0x24')],{'raw':_0x3a4f21[_0xc22d('0x18')]?_0x3a4f21[_0xc22d('0x18')][_0xc22d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4f21[_0xc22d('0x18')]?_0x3a4f21[_0xc22d('0x18')][_0xc22d('0x1a')]||null:null,'attributes':_0x3a4f21[_0xc22d('0x18')]?_0x3a4f21[_0xc22d('0x18')]['attributes']||null:null,'limit':_0x3a4f21[_0xc22d('0x18')]?_0x3a4f21['options'][_0xc22d('0x1c')]||null:null})[_0xc22d('0xc')](function(_0x9608c5){logger['info'](_0xc22d('0x26'),_0x3a4f21);logger['debug'](_0xc22d('0x26'),_0x3a4f21,JSON['stringify'](_0x9608c5));_0x22c160(_0x9608c5);})[_0xc22d('0x21')](function(_0x61370b){logger[_0xc22d('0x11')](_0xc22d('0x26'),_0x61370b[_0xc22d('0x13')],_0x3a4f21);_0x39bccf(_0x5730ea[_0xc22d('0x11')](0x1f4,_0x61370b[_0xc22d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7790e29..45f57d0 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 _0xf7b4=['../../config/environment','./migration.controller','get','index','exports','multer','connect-timeout','express','../../components/interaction/service'];(function(_0x167295,_0x555a81){var _0x400be6=function(_0x1edcba){while(--_0x1edcba){_0x167295['push'](_0x167295['shift']());}};_0x400be6(++_0x555a81);}(_0xf7b4,0x152));var _0x4f7b=function(_0x39ac27,_0x266860){_0x39ac27=_0x39ac27-0x0;var _0xa2169=_0xf7b4[_0x39ac27];return _0xa2169;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f7b('0x3'));var config=require(_0x4f7b('0x4'));var controller=require(_0x4f7b('0x5'));router[_0x4f7b('0x6')]('/',controller[_0x4f7b('0x7')]);module[_0x4f7b('0x8')]=router; \ No newline at end of file +var _0xae60=['../../components/auth/service','../../config/environment','./migration.controller','index','exports','multer','util','path','express','Router'];(function(_0x573c96,_0x21557a){var _0x102478=function(_0x54befb){while(--_0x54befb){_0x573c96['push'](_0x573c96['shift']());}};_0x102478(++_0x21557a);}(_0xae60,0x1c7));var _0x0ae6=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xae60[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var auth=require(_0x0ae6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae6('0x6'));var controller=require(_0x0ae6('0x7'));router['get']('/',controller[_0x0ae6('0x8')]);module[_0x0ae6('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b314b06..cf0fcec 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 _0xaca7=['sequelize'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xaca7,0x149));var _0x7aca=function(_0x5b5985,_0x465711){_0x5b5985=_0x5b5985-0x0;var _0x707c52=_0xaca7[_0x5b5985];return _0x707c52;};'use strict';var Sequelize=require(_0x7aca('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x69f6=['version','exports'];(function(_0x13a2ec,_0xacc0c1){var _0xede547=function(_0x7824ab){while(--_0x7824ab){_0x13a2ec['push'](_0x13a2ec['shift']());}};_0xede547(++_0xacc0c1);}(_0x69f6,0xed));var _0x669f=function(_0x495bd2,_0x252c0d){_0x495bd2=_0x495bd2-0x0;var _0x213531=_0x69f6[_0x495bd2];return _0x213531;};'use strict';var Sequelize=require('sequelize');module[_0x669f('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x669f('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2eba1c7..06a9e52 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 _0xb7c4=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','then','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x32df2b,_0x3295b){var _0x455d2f=function(_0x267ede){while(--_0x267ede){_0x32df2b['push'](_0x32df2b['shift']());}};_0x455d2f(++_0x3295b);}(_0xb7c4,0x9a));var _0x4b7c=function(_0x9bc63,_0x550044){_0x9bc63=_0x9bc63-0x0;var _0x295cef=_0xb7c4[_0x9bc63];return _0x295cef;};'use strict';var pdf=require(_0x4b7c('0x0'));var emlformat=require(_0x4b7c('0x1'));var rimraf=require(_0x4b7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b7c('0x3'));var rp=require(_0x4b7c('0x4'));var moment=require(_0x4b7c('0x5'));var BPromise=require(_0x4b7c('0x6'));var Mustache=require(_0x4b7c('0x7'));var util=require(_0x4b7c('0x8'));var path=require(_0x4b7c('0x9'));var sox=require(_0x4b7c('0xa'));var csv=require(_0x4b7c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b7c('0xc'));var squel=require(_0x4b7c('0xd'));var crypto=require(_0x4b7c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4b7c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b7c('0x10'));var Papa=require(_0x4b7c('0x11'));var Redis=require(_0x4b7c('0x12'));var authService=require(_0x4b7c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4b7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b7c('0x15'))(_0x4b7c('0x16'));var utils=require(_0x4b7c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4b7c('0x18'));var db=require(_0x4b7c('0x19'))['db'];function respondWithStatusCode(_0x6101fd,_0x311eb8){_0x311eb8=_0x311eb8||0xcc;return function(_0x417b4e){if(_0x417b4e){return _0x6101fd[_0x4b7c('0x1a')](_0x311eb8);}return _0x6101fd[_0x4b7c('0x1b')](_0x311eb8)['end']();};}function respondWithResult(_0x5a3cb4,_0x105a4b){_0x105a4b=_0x105a4b||0xc8;return function(_0x1b5c15){if(_0x1b5c15){return _0x5a3cb4[_0x4b7c('0x1b')](_0x105a4b)[_0x4b7c('0x1c')](_0x1b5c15);}};}function respondWithFilteredResult(_0x258ea0,_0x4d0739){return function(_0x41ba97){if(_0x41ba97){var _0x4ba9d5=_0x41ba97[_0x4b7c('0x1d')],_0x50d04d=_0x4d0739['offset'],_0x44d448=_0x4d0739[_0x4b7c('0x1e')]+_0x4d0739[_0x4b7c('0x1f')],_0x10ce1a;if(_0x44d448>=_0x4ba9d5){_0x44d448=_0x4ba9d5;_0x10ce1a=0xc8;}else{_0x10ce1a=0xce;}_0x258ea0[_0x4b7c('0x1b')](_0x10ce1a);return _0x258ea0[_0x4b7c('0x20')](_0x4b7c('0x21'),_0x50d04d+'-'+_0x44d448+'/'+_0x4ba9d5)[_0x4b7c('0x1c')](_0x41ba97);}return null;};}function patchUpdates(_0x16f98a){return function(_0x2b0945){try{jsonpatch[_0x4b7c('0x22')](_0x2b0945,_0x16f98a,!![]);}catch(_0x464a59){return BPromise[_0x4b7c('0x23')](_0x464a59);}return _0x2b0945[_0x4b7c('0x24')]();};}function saveUpdates(_0x53d591,_0x62a3b3){return function(_0x3ed2b5){if(_0x3ed2b5){return _0x3ed2b5['update'](_0x53d591)['then'](function(_0x30ed4a){return _0x30ed4a;});}return null;};}function removeEntity(_0x2abe95,_0x26c3a7){return function(_0x2ba2db){if(_0x2ba2db){return _0x2ba2db[_0x4b7c('0x25')]()['then'](function(){_0x2abe95[_0x4b7c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c23ff,_0x302e12){return function(_0x5f6fa){if(!_0x5f6fa){_0x3c23ff['sendStatus'](0x194);}return _0x5f6fa;};}function handleError(_0x29abf9,_0x48f54e){_0x48f54e=_0x48f54e||0x1f4;return function(_0x5e631b){logger['error'](_0x5e631b[_0x4b7c('0x26')]);if(_0x5e631b[_0x4b7c('0x27')]){delete _0x5e631b[_0x4b7c('0x27')];}_0x29abf9[_0x4b7c('0x1b')](_0x48f54e)[_0x4b7c('0x28')](_0x5e631b);};}exports[_0x4b7c('0x29')]=function(_0x147b35,_0xa7843){var _0x2607ba={},_0x52edac={},_0x44c620={'count':0x0,'rows':[]};var _0x36d803=_[_0x4b7c('0x2a')](db[_0x4b7c('0x2b')][_0x4b7c('0x2c')],function(_0x43a2cc){return{'name':_0x43a2cc[_0x4b7c('0x2d')],'type':_0x43a2cc[_0x4b7c('0x2e')]['key']};});_0x52edac[_0x4b7c('0x2f')]=_[_0x4b7c('0x2a')](_0x36d803,'name');_0x52edac[_0x4b7c('0x30')]=_[_0x4b7c('0x31')](_0x147b35[_0x4b7c('0x30')]);_0x52edac[_0x4b7c('0x32')]=_[_0x4b7c('0x33')](_0x52edac[_0x4b7c('0x2f')],_0x52edac[_0x4b7c('0x30')]);_0x2607ba[_0x4b7c('0x34')]=_[_0x4b7c('0x33')](_0x52edac[_0x4b7c('0x2f')],qs['fields'](_0x147b35[_0x4b7c('0x30')][_0x4b7c('0x35')]));_0x2607ba['attributes']=_0x2607ba[_0x4b7c('0x34')][_0x4b7c('0x36')]?_0x2607ba[_0x4b7c('0x34')]:_0x52edac[_0x4b7c('0x2f')];if(!_0x147b35[_0x4b7c('0x30')][_0x4b7c('0x37')](_0x4b7c('0x38'))){_0x2607ba['limit']=qs[_0x4b7c('0x1f')](_0x147b35[_0x4b7c('0x30')]['limit']);_0x2607ba[_0x4b7c('0x1e')]=qs['offset'](_0x147b35[_0x4b7c('0x30')][_0x4b7c('0x1e')]);}_0x2607ba[_0x4b7c('0x39')]=qs['sort'](_0x147b35['query'][_0x4b7c('0x3a')]);_0x2607ba[_0x4b7c('0x3b')]=qs[_0x4b7c('0x32')](_[_0x4b7c('0x3c')](_0x147b35[_0x4b7c('0x30')],_0x52edac[_0x4b7c('0x32')]),_0x36d803);if(_0x147b35[_0x4b7c('0x30')][_0x4b7c('0x3d')]){_0x2607ba['where']=_[_0x4b7c('0x3e')](_0x2607ba[_0x4b7c('0x3b')],{'$or':_[_0x4b7c('0x2a')](_0x36d803,function(_0x36c13a){if(_0x36c13a[_0x4b7c('0x2e')]!==_0x4b7c('0x3f')){var _0x47bf9a={};_0x47bf9a[_0x36c13a['name']]={'$like':'%'+_0x147b35['query']['filter']+'%'};return _0x47bf9a;}})});}_0x2607ba=_['merge']({},_0x2607ba,_0x147b35[_0x4b7c('0x40')]);var _0x5ac2e6={'where':_0x2607ba[_0x4b7c('0x3b')]};return db[_0x4b7c('0x2b')][_0x4b7c('0x1d')](_0x5ac2e6)['then'](function(_0x32529b){_0x44c620['count']=_0x32529b;if(_0x147b35[_0x4b7c('0x30')]['includeAll']){_0x2607ba['include']=[{'all':!![]}];}return db['Migration'][_0x4b7c('0x41')](_0x2607ba);})[_0x4b7c('0x42')](function(_0x5130eb){_0x44c620[_0x4b7c('0x43')]=_0x5130eb;return _0x44c620;})['then'](respondWithFilteredResult(_0xa7843,_0x2607ba))[_0x4b7c('0x44')](handleError(_0xa7843,null));}; \ No newline at end of file +var _0xe962=['util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Migration','includeAll','findAll','rows','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe962,0x17f));var _0x2e96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe962[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x2e96('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e96('0x1'));var zipdir=require(_0x2e96('0x2'));var jsonpatch=require(_0x2e96('0x3'));var rp=require(_0x2e96('0x4'));var moment=require('moment');var BPromise=require(_0x2e96('0x5'));var Mustache=require(_0x2e96('0x6'));var util=require(_0x2e96('0x7'));var path=require('path');var sox=require(_0x2e96('0x8'));var csv=require('to-csv');var ejs=require(_0x2e96('0x9'));var fs=require('fs');var _=require(_0x2e96('0xa'));var squel=require('squel');var crypto=require(_0x2e96('0xb'));var jsforce=require(_0x2e96('0xc'));var deskjs=require(_0x2e96('0xd'));var toCsv=require(_0x2e96('0xe'));var querystring=require(_0x2e96('0xf'));var Papa=require(_0x2e96('0x10'));var Redis=require('ioredis');var authService=require(_0x2e96('0x11'));var qs=require(_0x2e96('0x12'));var as=require(_0x2e96('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2e96('0x14'));var utils=require(_0x2e96('0x15'));var config=require(_0x2e96('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e96('0x17'))['db'];function respondWithStatusCode(_0x4e86bf,_0x1f01d6){_0x1f01d6=_0x1f01d6||0xcc;return function(_0xa43d36){if(_0xa43d36){return _0x4e86bf[_0x2e96('0x18')](_0x1f01d6);}return _0x4e86bf[_0x2e96('0x19')](_0x1f01d6)['end']();};}function respondWithResult(_0x5a5148,_0x1bc5e3){_0x1bc5e3=_0x1bc5e3||0xc8;return function(_0x59b0c8){if(_0x59b0c8){return _0x5a5148[_0x2e96('0x19')](_0x1bc5e3)[_0x2e96('0x1a')](_0x59b0c8);}};}function respondWithFilteredResult(_0x6b59e7,_0x13aa92){return function(_0x214d78){if(_0x214d78){var _0x312dff=_0x214d78[_0x2e96('0x1b')],_0x5d4a90=_0x13aa92['offset'],_0x4875ff=_0x13aa92[_0x2e96('0x1c')]+_0x13aa92[_0x2e96('0x1d')],_0x31d763;if(_0x4875ff>=_0x312dff){_0x4875ff=_0x312dff;_0x31d763=0xc8;}else{_0x31d763=0xce;}_0x6b59e7['status'](_0x31d763);return _0x6b59e7['set']('Content-Range',_0x5d4a90+'-'+_0x4875ff+'/'+_0x312dff)[_0x2e96('0x1a')](_0x214d78);}return null;};}function patchUpdates(_0x2e5e3f){return function(_0xebb33a){try{jsonpatch['apply'](_0xebb33a,_0x2e5e3f,!![]);}catch(_0x45bc65){return BPromise[_0x2e96('0x1e')](_0x45bc65);}return _0xebb33a[_0x2e96('0x1f')]();};}function saveUpdates(_0x43bb2f,_0x123a6d){return function(_0x1c22e1){if(_0x1c22e1){return _0x1c22e1[_0x2e96('0x20')](_0x43bb2f)[_0x2e96('0x21')](function(_0x4fda05){return _0x4fda05;});}return null;};}function removeEntity(_0x5abc76,_0x5c758b){return function(_0x28285a){if(_0x28285a){return _0x28285a[_0x2e96('0x22')]()['then'](function(){_0x5abc76['status'](0xcc)[_0x2e96('0x23')]();});}};}function handleEntityNotFound(_0x621aba,_0x1f1cbf){return function(_0x26055e){if(!_0x26055e){_0x621aba['sendStatus'](0x194);}return _0x26055e;};}function handleError(_0x1a6426,_0x39f11b){_0x39f11b=_0x39f11b||0x1f4;return function(_0x3f194c){logger[_0x2e96('0x24')](_0x3f194c[_0x2e96('0x25')]);if(_0x3f194c['name']){delete _0x3f194c[_0x2e96('0x26')];}_0x1a6426[_0x2e96('0x19')](_0x39f11b)[_0x2e96('0x27')](_0x3f194c);};}exports['index']=function(_0x31670a,_0xea4f51){var _0x1582a6={},_0x1e6084={},_0x894db9={'count':0x0,'rows':[]};var _0x40d523=_[_0x2e96('0x28')](db['Migration'][_0x2e96('0x29')],function(_0x1f6bea){return{'name':_0x1f6bea[_0x2e96('0x2a')],'type':_0x1f6bea[_0x2e96('0x2b')]['key']};});_0x1e6084[_0x2e96('0x2c')]=_['map'](_0x40d523,_0x2e96('0x26'));_0x1e6084[_0x2e96('0x2d')]=_[_0x2e96('0x2e')](_0x31670a['query']);_0x1e6084[_0x2e96('0x2f')]=_[_0x2e96('0x30')](_0x1e6084['model'],_0x1e6084[_0x2e96('0x2d')]);_0x1582a6[_0x2e96('0x31')]=_[_0x2e96('0x30')](_0x1e6084['model'],qs[_0x2e96('0x32')](_0x31670a[_0x2e96('0x2d')][_0x2e96('0x32')]));_0x1582a6[_0x2e96('0x31')]=_0x1582a6[_0x2e96('0x31')][_0x2e96('0x33')]?_0x1582a6['attributes']:_0x1e6084[_0x2e96('0x2c')];if(!_0x31670a['query'][_0x2e96('0x34')](_0x2e96('0x35'))){_0x1582a6[_0x2e96('0x1d')]=qs['limit'](_0x31670a['query'][_0x2e96('0x1d')]);_0x1582a6[_0x2e96('0x1c')]=qs[_0x2e96('0x1c')](_0x31670a[_0x2e96('0x2d')]['offset']);}_0x1582a6[_0x2e96('0x36')]=qs['sort'](_0x31670a[_0x2e96('0x2d')][_0x2e96('0x37')]);_0x1582a6['where']=qs[_0x2e96('0x2f')](_[_0x2e96('0x38')](_0x31670a[_0x2e96('0x2d')],_0x1e6084['filters']),_0x40d523);if(_0x31670a[_0x2e96('0x2d')][_0x2e96('0x39')]){_0x1582a6[_0x2e96('0x3a')]=_['merge'](_0x1582a6['where'],{'$or':_[_0x2e96('0x28')](_0x40d523,function(_0x2a9f2c){if(_0x2a9f2c[_0x2e96('0x2b')]!==_0x2e96('0x3b')){var _0x5ebf47={};_0x5ebf47[_0x2a9f2c[_0x2e96('0x26')]]={'$like':'%'+_0x31670a[_0x2e96('0x2d')][_0x2e96('0x39')]+'%'};return _0x5ebf47;}})});}_0x1582a6=_['merge']({},_0x1582a6,_0x31670a[_0x2e96('0x3c')]);var _0x5021b5={'where':_0x1582a6[_0x2e96('0x3a')]};return db[_0x2e96('0x3d')][_0x2e96('0x1b')](_0x5021b5)[_0x2e96('0x21')](function(_0x90f33e){_0x894db9[_0x2e96('0x1b')]=_0x90f33e;if(_0x31670a[_0x2e96('0x2d')][_0x2e96('0x3e')]){_0x1582a6['include']=[{'all':!![]}];}return db[_0x2e96('0x3d')][_0x2e96('0x3f')](_0x1582a6);})[_0x2e96('0x21')](function(_0x36d7a3){_0x894db9[_0x2e96('0x40')]=_0x36d7a3;return _0x894db9;})[_0x2e96('0x21')](respondWithFilteredResult(_0xea4f51,_0x1582a6))['catch'](handleError(_0xea4f51,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3008a84..a9d4e42 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 _0x56d9=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','migrations'];(function(_0x2a0fe9,_0x38cdc9){var _0x56a0e3=function(_0x4526b3){while(--_0x4526b3){_0x2a0fe9['push'](_0x2a0fe9['shift']());}};_0x56a0e3(++_0x38cdc9);}(_0x56d9,0x6e));var _0x956d=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x56d9[_0x5b7788];return _0x573871;};'use strict';var _=require(_0x956d('0x0'));var util=require(_0x956d('0x1'));var logger=require(_0x956d('0x2'))(_0x956d('0x3'));var moment=require(_0x956d('0x4'));var BPromise=require('bluebird');var rp=require(_0x956d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x956d('0x6'));var attributes=require('./migration.attributes');module[_0x956d('0x7')]=function(_0x2a8ab2,_0x4dec7b){return _0x2a8ab2[_0x956d('0x8')]('Migration',attributes,{'tableName':_0x956d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cf3=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','Migration','migrations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cf3,0xd2));var _0x37cf=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x7cf3[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require('lodash');var util=require(_0x37cf('0x0'));var logger=require(_0x37cf('0x1'))(_0x37cf('0x2'));var moment=require('moment');var BPromise=require(_0x37cf('0x3'));var rp=require(_0x37cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37cf('0x5'));var attributes=require('./migration.attributes');module[_0x37cf('0x6')]=function(_0x1b8683,_0x56bb09){return _0x1b8683[_0x37cf('0x7')](_0x37cf('0x8'),attributes,{'tableName':_0x37cf('0x9'),'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 abc6f8b..d052350 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 _0x5529=['lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x5529,0xc8));var _0x9552=function(_0x3f266c,_0x5bf3ce){_0x3f266c=_0x3f266c-0x0;var _0x49c6fc=_0x5529[_0x3f266c];return _0x49c6fc;};'use strict';var _=require(_0x9552('0x0'));var util=require(_0x9552('0x1'));var moment=require(_0x9552('0x2'));var BPromise=require(_0x9552('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9552('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9552('0x5'))(_0x9552('0x6'));var config=require(_0x9552('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x564700,_0x37b2c4,_0x47d326){return new BPromise(function(_0x5a8062,_0x4b388e){return client[_0x9552('0x8')](_0x564700,_0x47d326)['then'](function(_0x3e8e04){logger[_0x9552('0x9')]('Migration,\x20%s,\x20%s',_0x37b2c4,_0x9552('0xa'));logger[_0x9552('0xb')](_0x9552('0xc'),_0x37b2c4,_0x9552('0xa'),JSON[_0x9552('0xd')](_0x3e8e04));if(_0x3e8e04[_0x9552('0xe')]){if(_0x3e8e04[_0x9552('0xe')][_0x9552('0xf')]===0x1f4){logger[_0x9552('0xe')](_0x9552('0x10'),_0x37b2c4,_0x3e8e04[_0x9552('0xe')][_0x9552('0x11')]);return _0x4b388e(_0x3e8e04['error'][_0x9552('0x11')]);}logger[_0x9552('0xe')]('Migration,\x20%s,\x20%s',_0x37b2c4,_0x3e8e04[_0x9552('0xe')][_0x9552('0x11')]);return _0x5a8062(_0x3e8e04['error'][_0x9552('0x11')]);}else{logger[_0x9552('0x9')](_0x9552('0x10'),_0x37b2c4,_0x9552('0xa'));_0x5a8062(_0x3e8e04[_0x9552('0x12')][_0x9552('0x11')]);}})[_0x9552('0x13')](function(_0x1ff0ab){logger['error'](_0x9552('0x10'),_0x37b2c4,_0x1ff0ab);_0x4b388e(_0x1ff0ab);});});} \ No newline at end of file +var _0x0df5=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','info','Migration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0df5,0x18f));var _0x50df=function(_0x2e556a,_0x54da18){_0x2e556a=_0x2e556a-0x0;var _0x12fd7d=_0x0df5[_0x2e556a];return _0x12fd7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x50df('0x0'));var BPromise=require(_0x50df('0x1'));var rs=require(_0x50df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50df('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x50df('0x4'))(_0x50df('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x50df('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x139e23,_0x14aa90,_0x51a779){return new BPromise(function(_0x5b24bc,_0x5ab23b){return client['request'](_0x139e23,_0x51a779)['then'](function(_0x4a6835){logger[_0x50df('0x7')](_0x50df('0x8'),_0x14aa90,_0x50df('0x9'));logger['debug'](_0x50df('0xa'),_0x14aa90,_0x50df('0x9'),JSON[_0x50df('0xb')](_0x4a6835));if(_0x4a6835[_0x50df('0xc')]){if(_0x4a6835[_0x50df('0xc')][_0x50df('0xd')]===0x1f4){logger['error'](_0x50df('0x8'),_0x14aa90,_0x4a6835['error'][_0x50df('0xe')]);return _0x5ab23b(_0x4a6835[_0x50df('0xc')][_0x50df('0xe')]);}logger['error'](_0x50df('0x8'),_0x14aa90,_0x4a6835[_0x50df('0xc')]['message']);return _0x5b24bc(_0x4a6835[_0x50df('0xc')][_0x50df('0xe')]);}else{logger[_0x50df('0x7')](_0x50df('0x8'),_0x14aa90,_0x50df('0x9'));_0x5b24bc(_0x4a6835[_0x50df('0xf')][_0x50df('0xe')]);}})[_0x50df('0x10')](function(_0x29a8ea){logger['error']('Migration,\x20%s,\x20%s',_0x14aa90,_0x29a8ea);_0x5ab23b(_0x29a8ea);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4908ddf..4d10f33 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 _0x136b=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','create','destroy','exports'];(function(_0x47410f,_0x53d9b2){var _0x272541=function(_0x148183){while(--_0x148183){_0x47410f['push'](_0x47410f['shift']());}};_0x272541(++_0x53d9b2);}(_0x136b,0xfc));var _0xb136=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x136b[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb136('0x0'));var express=require(_0xb136('0x1'));var router=express[_0xb136('0x2')]();var auth=require(_0xb136('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb136('0x4'));var controller=require('./network.controller');router[_0xb136('0x5')]('/',auth[_0xb136('0x6')](),controller['index']);router[_0xb136('0x5')](_0xb136('0x7'),auth['isAuthenticated'](),controller[_0xb136('0x8')]);router['post']('/',auth[_0xb136('0x6')](),controller[_0xb136('0x9')]);router['put']('/:id',auth[_0xb136('0x6')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb136('0xa')]);module[_0xb136('0xb')]=router; \ No newline at end of file +var _0xd056=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','show','post','isAuthenticated','create','delete','multer','util','connect-timeout','express'];(function(_0x3ddd65,_0x348fd7){var _0x33bb80=function(_0x55838d){while(--_0x55838d){_0x3ddd65['push'](_0x3ddd65['shift']());}};_0x33bb80(++_0x348fd7);}(_0xd056,0x13f));var _0x6d05=function(_0x1b1845,_0xe45d99){_0x1b1845=_0x1b1845-0x0;var _0x3ca01f=_0xd056[_0x1b1845];return _0x3ca01f;};'use strict';var multer=require(_0x6d05('0x0'));var util=require(_0x6d05('0x1'));var path=require('path');var timeout=require(_0x6d05('0x2'));var express=require(_0x6d05('0x3'));var router=express[_0x6d05('0x4')]();var auth=require(_0x6d05('0x5'));var interaction=require(_0x6d05('0x6'));var config=require(_0x6d05('0x7'));var controller=require(_0x6d05('0x8'));router[_0x6d05('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d05('0xa')]);router[_0x6d05('0x9')](_0x6d05('0xb'),auth['isAuthenticated'](),controller[_0x6d05('0xc')]);router[_0x6d05('0xd')]('/',auth[_0x6d05('0xe')](),controller[_0x6d05('0xf')]);router['put'](_0x6d05('0xb'),auth[_0x6d05('0xe')](),controller['update']);router[_0x6d05('0x10')](_0x6d05('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index cccd27a..915d137 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(_0x52d177,_0x566ef0){var _0x4708b7=function(_0x179302){while(--_0x179302){_0x52d177['push'](_0x52d177['shift']());}};_0x4708b7(++_0x566ef0);}(_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')]={'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(_0x6bf23f,_0x5f4b02){var _0x1bebb1=function(_0x3a3e8d){while(--_0x3a3e8d){_0x6bf23f['push'](_0x6bf23f['shift']());}};_0x1bebb1(++_0x5f4b02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 96fcbc5..6cb706c 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 _0x4501=['stringify','error','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','Network','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','find','sequelize','transaction','create','findAll','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','client','http','then','info','Network,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xfc30f8,_0x1c1584){var _0x5c3117=function(_0x28b8f8){while(--_0x28b8f8){_0xfc30f8['push'](_0xfc30f8['shift']());}};_0x5c3117(++_0x1c1584);}(_0x4501,0x120));var _0x1450=function(_0xdc5682,_0x534056){_0xdc5682=_0xdc5682-0x0;var _0x1e3f8f=_0x4501[_0xdc5682];return _0x1e3f8f;};'use strict';var pdf=require(_0x1450('0x0'));var emlformat=require(_0x1450('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1450('0x2'));var rp=require(_0x1450('0x3'));var moment=require(_0x1450('0x4'));var BPromise=require(_0x1450('0x5'));var Mustache=require('mustache');var util=require(_0x1450('0x6'));var path=require(_0x1450('0x7'));var sox=require(_0x1450('0x8'));var csv=require(_0x1450('0x9'));var ejs=require(_0x1450('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1450('0xb'));var crypto=require(_0x1450('0xc'));var jsforce=require(_0x1450('0xd'));var deskjs=require(_0x1450('0xe'));var toCsv=require(_0x1450('0x9'));var querystring=require(_0x1450('0xf'));var Papa=require(_0x1450('0x10'));var Redis=require('ioredis');var authService=require(_0x1450('0x11'));var qs=require(_0x1450('0x12'));var as=require(_0x1450('0x13'));var hardwareService=require(_0x1450('0x14'));var logger=require(_0x1450('0x15'))(_0x1450('0x16'));var utils=require(_0x1450('0x17'));var config=require(_0x1450('0x18'));var licenseUtil=require(_0x1450('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1450('0x1a')][_0x1450('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x59b2a1,_0x21421b,_0x2867b0,_0x19f943){return new BPromise(function(_0x180f87,_0x42aeea){var _0x37ab23=_0x19f943||client;return _0x37ab23['request'](_0x59b2a1,_0x2867b0)[_0x1450('0x1c')](function(_0x7c5d94){logger[_0x1450('0x1d')](_0x1450('0x1e'),_0x21421b,'request\x20sent');logger[_0x1450('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x21421b,_0x1450('0x20'),JSON[_0x1450('0x21')](_0x7c5d94));if(_0x7c5d94['error']){if(_0x7c5d94['error']['code']===0x1f4){logger[_0x1450('0x22')](_0x1450('0x1e'),_0x21421b,_0x7c5d94[_0x1450('0x22')][_0x1450('0x23')]);return _0x42aeea(_0x7c5d94[_0x1450('0x22')][_0x1450('0x23')]);}logger[_0x1450('0x22')](_0x1450('0x1e'),_0x21421b,_0x7c5d94[_0x1450('0x22')][_0x1450('0x23')]);return _0x180f87(_0x7c5d94[_0x1450('0x22')]['message']);}else{logger[_0x1450('0x1d')](_0x1450('0x1e'),_0x21421b,_0x1450('0x20'));_0x180f87(_0x7c5d94[_0x1450('0x24')][_0x1450('0x23')]);}})[_0x1450('0x25')](function(_0x211fca){logger[_0x1450('0x22')]('Network,\x20%s,\x20%s',_0x21421b,_0x211fca);_0x42aeea(_0x211fca);});});}function respondWithStatusCode(_0xe4375,_0x406f0e){_0x406f0e=_0x406f0e||0xcc;return function(_0x497641){if(_0x497641){return _0xe4375['sendStatus'](_0x406f0e);}return _0xe4375[_0x1450('0x26')](_0x406f0e)[_0x1450('0x27')]();};}function respondWithResult(_0x4acbf0,_0x43e6e4){_0x43e6e4=_0x43e6e4||0xc8;return function(_0x54e095){if(_0x54e095){return _0x4acbf0[_0x1450('0x26')](_0x43e6e4)['json'](_0x54e095);}};}function respondWithFilteredResult(_0x485eac,_0x32c5d6){return function(_0x357314){if(_0x357314){var _0x106a7a=_0x357314[_0x1450('0x28')],_0x27836b=_0x32c5d6[_0x1450('0x29')],_0x2f3a34=_0x32c5d6['offset']+_0x32c5d6['limit'],_0x4a2a6e;if(_0x2f3a34>=_0x106a7a){_0x2f3a34=_0x106a7a;_0x4a2a6e=0xc8;}else{_0x4a2a6e=0xce;}_0x485eac[_0x1450('0x26')](_0x4a2a6e);return _0x485eac[_0x1450('0x2a')](_0x1450('0x2b'),_0x27836b+'-'+_0x2f3a34+'/'+_0x106a7a)[_0x1450('0x2c')](_0x357314);}return null;};}function patchUpdates(_0x412804){return function(_0x43bbdc){try{jsonpatch[_0x1450('0x2d')](_0x43bbdc,_0x412804,!![]);}catch(_0x137006){return BPromise[_0x1450('0x2e')](_0x137006);}return _0x43bbdc[_0x1450('0x2f')]();};}function saveUpdates(_0x191983,_0x37d1ef){return function(_0x219d5a){if(_0x219d5a){return _0x219d5a[_0x1450('0x30')](_0x191983)[_0x1450('0x1c')](function(_0x543157){return _0x543157;});}return null;};}function removeEntity(_0x33e0c3,_0x73bb74){return function(_0x329b5a){if(_0x329b5a){return _0x329b5a[_0x1450('0x31')]()['then'](function(){_0x33e0c3['status'](0xcc)[_0x1450('0x27')]();});}};}function handleEntityNotFound(_0x5881d1,_0x55def5){return function(_0x1f7bae){if(!_0x1f7bae){_0x5881d1[_0x1450('0x32')](0x194);}return _0x1f7bae;};}function handleError(_0x27c944,_0x36783d){_0x36783d=_0x36783d||0x1f4;return function(_0x2b140f){logger['error'](_0x2b140f[_0x1450('0x33')]);if(_0x2b140f[_0x1450('0x34')]){delete _0x2b140f['name'];}_0x27c944[_0x1450('0x26')](_0x36783d)[_0x1450('0x35')](_0x2b140f);};}exports['index']=function(_0xbb7cbd,_0x16aa20){var _0x44f1f1={},_0x217778={},_0x51e7a3={'count':0x0,'rows':[]};var _0x4ba8b4=_[_0x1450('0x36')](db[_0x1450('0x37')][_0x1450('0x38')],function(_0xc47398){return{'name':_0xc47398['fieldName'],'type':_0xc47398['type'][_0x1450('0x39')]};});_0x217778['model']=_[_0x1450('0x36')](_0x4ba8b4,'name');_0x217778[_0x1450('0x3a')]=_[_0x1450('0x3b')](_0xbb7cbd[_0x1450('0x3a')]);_0x217778[_0x1450('0x3c')]=_[_0x1450('0x3d')](_0x217778[_0x1450('0x3e')],_0x217778[_0x1450('0x3a')]);_0x44f1f1[_0x1450('0x3f')]=_[_0x1450('0x3d')](_0x217778[_0x1450('0x3e')],qs[_0x1450('0x40')](_0xbb7cbd['query'][_0x1450('0x40')]));_0x44f1f1[_0x1450('0x3f')]=_0x44f1f1[_0x1450('0x3f')][_0x1450('0x41')]?_0x44f1f1['attributes']:_0x217778[_0x1450('0x3e')];if(!_0xbb7cbd[_0x1450('0x3a')][_0x1450('0x42')]('nolimit')){_0x44f1f1['limit']=qs[_0x1450('0x43')](_0xbb7cbd['query'][_0x1450('0x43')]);_0x44f1f1['offset']=qs[_0x1450('0x29')](_0xbb7cbd[_0x1450('0x3a')]['offset']);}_0x44f1f1[_0x1450('0x44')]=qs['sort'](_0xbb7cbd[_0x1450('0x3a')][_0x1450('0x45')]);_0x44f1f1[_0x1450('0x46')]=qs[_0x1450('0x3c')](_[_0x1450('0x47')](_0xbb7cbd[_0x1450('0x3a')],_0x217778[_0x1450('0x3c')]),_0x4ba8b4);if(_0xbb7cbd[_0x1450('0x3a')][_0x1450('0x48')]){_0x44f1f1[_0x1450('0x46')]=_[_0x1450('0x49')](_0x44f1f1[_0x1450('0x46')],{'$or':_[_0x1450('0x36')](_0x4ba8b4,function(_0x3c6cb9){if(_0x3c6cb9[_0x1450('0x4a')]!==_0x1450('0x4b')){var _0x584042={};_0x584042[_0x3c6cb9[_0x1450('0x34')]]={'$like':'%'+_0xbb7cbd[_0x1450('0x3a')][_0x1450('0x48')]+'%'};return _0x584042;}})});}_0x44f1f1=_['merge']({},_0x44f1f1,_0xbb7cbd[_0x1450('0x4c')]);var _0x23f90a={'where':_0x44f1f1[_0x1450('0x46')]};return db[_0x1450('0x37')][_0x1450('0x28')](_0x23f90a)[_0x1450('0x1c')](function(_0x4929ea){_0x51e7a3[_0x1450('0x28')]=_0x4929ea;if(_0xbb7cbd[_0x1450('0x3a')][_0x1450('0x4d')]){_0x44f1f1[_0x1450('0x4e')]=[{'all':!![]}];}return db[_0x1450('0x37')]['findAll'](_0x44f1f1);})[_0x1450('0x1c')](function(_0x368f99){_0x51e7a3['rows']=_0x368f99;return _0x51e7a3;})[_0x1450('0x1c')](respondWithFilteredResult(_0x16aa20,_0x44f1f1))['catch'](handleError(_0x16aa20,null));};exports[_0x1450('0x4f')]=function(_0x31dfff,_0x2a7a12){var _0x140227={'raw':!![],'where':{'id':_0x31dfff[_0x1450('0x50')]['id']}},_0x56bf62={};_0x56bf62[_0x1450('0x3e')]=_[_0x1450('0x3b')](db['Network']['rawAttributes']);_0x56bf62[_0x1450('0x3a')]=_[_0x1450('0x3b')](_0x31dfff[_0x1450('0x3a')]);_0x56bf62[_0x1450('0x3c')]=_['intersection'](_0x56bf62['model'],_0x56bf62[_0x1450('0x3a')]);_0x140227[_0x1450('0x3f')]=_[_0x1450('0x3d')](_0x56bf62[_0x1450('0x3e')],qs[_0x1450('0x40')](_0x31dfff[_0x1450('0x3a')][_0x1450('0x40')]));_0x140227[_0x1450('0x3f')]=_0x140227[_0x1450('0x3f')][_0x1450('0x41')]?_0x140227[_0x1450('0x3f')]:_0x56bf62[_0x1450('0x3e')];if(_0x31dfff['query']['includeAll']){_0x140227['include']=[{'all':!![]}];}_0x140227=_['merge']({},_0x140227,_0x31dfff[_0x1450('0x4c')]);return db[_0x1450('0x37')][_0x1450('0x51')](_0x140227)[_0x1450('0x1c')](handleEntityNotFound(_0x2a7a12,null))[_0x1450('0x1c')](respondWithResult(_0x2a7a12,null))[_0x1450('0x25')](handleError(_0x2a7a12,null));};exports['create']=function(_0x4e09ef,_0x3d3dc7,_0x27979f){var _0x31d4bc;return db[_0x1450('0x52')][_0x1450('0x53')](function(_0x59d2e5){return db[_0x1450('0x37')][_0x1450('0x54')](_0x4e09ef['body'],{'raw':!![]})['then'](function(_0x5ba8de){_0x31d4bc=_0x5ba8de;return db[_0x1450('0x37')][_0x1450('0x55')]({'where':{'type':_0x4e09ef[_0x1450('0x56')]['type']},'raw':!![]});})[_0x1450('0x1c')](function(_0x2122c5){if(_0x31d4bc['type'][_0x1450('0x57')]()==_0x1450('0x58')){var _0x37ac32=fs['readFileSync'](path[_0x1450('0x59')](config[_0x1450('0x5a')],_0x1450('0x5b')),_0x1450('0x5c'));var _0x5ae38d=ejs[_0x1450('0x5d')](_0x37ac32,{'networks':_0x2122c5||[]});fs[_0x1450('0x5e')](_0x1450('0x5f'),_0x5ae38d);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x54'),{'module':_0x1450('0x61')});}else if(_0x31d4bc[_0x1450('0x4a')][_0x1450('0x57')]()==_0x1450('0x62')){var _0x1ef269=fs['readFileSync'](path[_0x1450('0x59')](config[_0x1450('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x1450('0x5c'));var _0x1542fa=ejs[_0x1450('0x5d')](_0x1ef269,{'networks':_0x2122c5||[]});fs[_0x1450('0x5e')](_0x1450('0x63'),_0x1542fa);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x54'),{'module':_0x1450('0x61')});}else{var _0x3bbb7a=fs[_0x1450('0x64')](path[_0x1450('0x59')](config['root'],_0x1450('0x65')),'utf8');var _0x1a96c1=ejs[_0x1450('0x5d')](_0x3bbb7a,{'networks':_0x2122c5||[]});fs[_0x1450('0x5e')](util[_0x1450('0x66')](_0x1450('0x67'),_0x4e09ef[_0x1450('0x56')][_0x1450('0x4a')][_0x1450('0x68')]()),_0x1a96c1);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x54'),{'module':_0x1450('0x69')});}return null;})[_0x1450('0x1c')](function(){return _0x31d4bc;});})['then'](respondWithResult(_0x3d3dc7,0xc9))[_0x1450('0x25')](handleError(_0x3d3dc7,null));};exports[_0x1450('0x30')]=function(_0x19bb38,_0x272a40,_0x564634){var _0x591153;return db['sequelize'][_0x1450('0x53')](function(_0x2f35ea){return db[_0x1450('0x37')][_0x1450('0x51')]({'where':{'id':_0x19bb38[_0x1450('0x50')]['id']}})[_0x1450('0x1c')](handleEntityNotFound(_0x272a40,null))[_0x1450('0x1c')](saveUpdates(_0x19bb38[_0x1450('0x56')],null))[_0x1450('0x1c')](function(_0x4ad69f){if(_0x4ad69f){_0x591153=_0x4ad69f;return db[_0x1450('0x37')][_0x1450('0x55')]({'where':{'type':_0x591153[_0x1450('0x4a')]},'raw':!![]});}return null;})['then'](function(_0x5606f1){if(_0x591153['type'][_0x1450('0x57')]()=='STUN'){var _0x44b5ed=fs[_0x1450('0x64')](path[_0x1450('0x59')](config[_0x1450('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x1450('0x5c'));var _0x229abb=ejs[_0x1450('0x5d')](_0x44b5ed,{'networks':_0x5606f1||[]});fs[_0x1450('0x5e')](_0x1450('0x5f'),_0x229abb);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x30'),{'module':_0x1450('0x61')});}else if(_0x591153['type'][_0x1450('0x57')]()==_0x1450('0x62')){var _0x468b57=fs[_0x1450('0x64')](path['join'](config[_0x1450('0x5a')],_0x1450('0x6a')),_0x1450('0x5c'));var _0x542c21=ejs[_0x1450('0x5d')](_0x468b57,{'networks':_0x5606f1||[]});fs[_0x1450('0x5e')](_0x1450('0x63'),_0x542c21);return respondWithRpcPromise('Reload','update',{'module':_0x1450('0x61')});}else{var _0x3ce5cf=fs['readFileSync'](path[_0x1450('0x59')](config['root'],_0x1450('0x65')),_0x1450('0x5c'));var _0x38dfbe=ejs['render'](_0x3ce5cf,{'networks':_0x5606f1||[]});fs[_0x1450('0x5e')](util[_0x1450('0x66')](_0x1450('0x67'),_0x19bb38['body'][_0x1450('0x4a')]['toLowerCase']()),_0x38dfbe);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x5a6a21){if(_0x5a6a21){return _0x591153;}return null;});})['then'](respondWithResult(_0x272a40,null))['catch'](handleError(_0x272a40,null));};exports[_0x1450('0x31')]=function(_0x5c5cbc,_0x4e36c2,_0x4860d7){var _0x9c7ef2;return db[_0x1450('0x37')][_0x1450('0x51')]({'where':{'id':_0x5c5cbc['params']['id']}})[_0x1450('0x1c')](function(_0x1422f3){_0x9c7ef2=_0x1422f3;return _0x1422f3;})[_0x1450('0x1c')](handleEntityNotFound(_0x4e36c2,null))[_0x1450('0x1c')](removeEntity(_0x4e36c2,null))[_0x1450('0x1c')](function(){if(_0x9c7ef2){return db[_0x1450('0x37')]['findAll']({'where':{'type':_0x9c7ef2['type']},'raw':!![]});}})['then'](function(_0x56fc16){if(_0x9c7ef2[_0x1450('0x4a')][_0x1450('0x57')]()=='STUN'){var _0x468940=fs[_0x1450('0x64')](path[_0x1450('0x59')](config[_0x1450('0x5a')],_0x1450('0x5b')),_0x1450('0x5c'));var _0x299bce=ejs[_0x1450('0x5d')](_0x468940,{'networks':_0x56fc16||[]});fs[_0x1450('0x5e')](_0x1450('0x5f'),_0x299bce);return respondWithRpcPromise(_0x1450('0x60'),_0x1450('0x31'),{'module':_0x1450('0x61')});}else if(_0x9c7ef2['type'][_0x1450('0x57')]()==_0x1450('0x62')){var _0x511dea=fs[_0x1450('0x64')](path[_0x1450('0x59')](config[_0x1450('0x5a')],_0x1450('0x6a')),_0x1450('0x5c'));var _0x40b8f8=ejs[_0x1450('0x5d')](_0x511dea,{'networks':_0x56fc16||[]});fs[_0x1450('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x40b8f8);return respondWithRpcPromise(_0x1450('0x60'),'destroy',{'module':_0x1450('0x61')});}else{var _0x59b5d6=fs['readFileSync'](path['join'](config[_0x1450('0x5a')],_0x1450('0x65')),_0x1450('0x5c'));var _0x4fd788=ejs[_0x1450('0x5d')](_0x59b5d6,{'networks':_0x56fc16||[]});fs[_0x1450('0x5e')](util[_0x1450('0x66')](_0x1450('0x67'),_0x5c5cbc[_0x1450('0x56')][_0x1450('0x4a')][_0x1450('0x68')]()),_0x4fd788);return respondWithRpcPromise('Reload',_0x1450('0x31'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x4e36c2,null));}; \ No newline at end of file +var _0x66e3=['code','message','info','catch','status','json','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','Network','count','includeAll','include','findAll','rows','show','rawAttributes','find','create','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','params','TURN','STUN','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f9fb4,_0x5bb000){var _0x1bb010=function(_0xc8bf6b){while(--_0xc8bf6b){_0x3f9fb4['push'](_0x3f9fb4['shift']());}};_0x1bb010(++_0x5bb000);}(_0x66e3,0x193));var _0x366e=function(_0x4204f4,_0x2539b7){_0x4204f4=_0x4204f4-0x0;var _0x2e039d=_0x66e3[_0x4204f4];return _0x2e039d;};'use strict';var pdf=require(_0x366e('0x0'));var emlformat=require(_0x366e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x366e('0x2'));var jsonpatch=require(_0x366e('0x3'));var rp=require(_0x366e('0x4'));var moment=require(_0x366e('0x5'));var BPromise=require(_0x366e('0x6'));var Mustache=require(_0x366e('0x7'));var util=require(_0x366e('0x8'));var path=require(_0x366e('0x9'));var sox=require(_0x366e('0xa'));var csv=require(_0x366e('0xb'));var ejs=require(_0x366e('0xc'));var fs=require('fs');var _=require(_0x366e('0xd'));var squel=require(_0x366e('0xe'));var crypto=require('crypto');var jsforce=require(_0x366e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x366e('0x10'));var Papa=require('papaparse');var Redis=require(_0x366e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x366e('0x12'));var as=require(_0x366e('0x13'));var hardwareService=require(_0x366e('0x14'));var logger=require(_0x366e('0x15'))(_0x366e('0x16'));var utils=require(_0x366e('0x17'));var config=require(_0x366e('0x18'));var licenseUtil=require(_0x366e('0x19'));var db=require(_0x366e('0x1a'))['db'];var jayson=require(_0x366e('0x1b'));var client=jayson[_0x366e('0x1c')][_0x366e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x42600a,_0x294315,_0xc56d5d,_0x1b8b77){return new BPromise(function(_0x2cdcd5,_0x3010bc){var _0x372585=_0x1b8b77||client;return _0x372585[_0x366e('0x1e')](_0x42600a,_0xc56d5d)['then'](function(_0x25d226){logger['info'](_0x366e('0x1f'),_0x294315,_0x366e('0x20'));logger[_0x366e('0x21')](_0x366e('0x22'),_0x294315,_0x366e('0x20'),JSON[_0x366e('0x23')](_0x25d226));if(_0x25d226[_0x366e('0x24')]){if(_0x25d226[_0x366e('0x24')][_0x366e('0x25')]===0x1f4){logger[_0x366e('0x24')](_0x366e('0x1f'),_0x294315,_0x25d226[_0x366e('0x24')]['message']);return _0x3010bc(_0x25d226[_0x366e('0x24')][_0x366e('0x26')]);}logger['error'](_0x366e('0x1f'),_0x294315,_0x25d226[_0x366e('0x24')][_0x366e('0x26')]);return _0x2cdcd5(_0x25d226[_0x366e('0x24')][_0x366e('0x26')]);}else{logger[_0x366e('0x27')](_0x366e('0x1f'),_0x294315,_0x366e('0x20'));_0x2cdcd5(_0x25d226['result'][_0x366e('0x26')]);}})[_0x366e('0x28')](function(_0x1936e3){logger['error'](_0x366e('0x1f'),_0x294315,_0x1936e3);_0x3010bc(_0x1936e3);});});}function respondWithStatusCode(_0x38de90,_0x3bfd4d){_0x3bfd4d=_0x3bfd4d||0xcc;return function(_0x28b0a4){if(_0x28b0a4){return _0x38de90['sendStatus'](_0x3bfd4d);}return _0x38de90[_0x366e('0x29')](_0x3bfd4d)['end']();};}function respondWithResult(_0xa45e2,_0x505acd){_0x505acd=_0x505acd||0xc8;return function(_0x481082){if(_0x481082){return _0xa45e2['status'](_0x505acd)[_0x366e('0x2a')](_0x481082);}};}function respondWithFilteredResult(_0x21396e,_0x5dc5ce){return function(_0x504cb3){if(_0x504cb3){var _0x3d2cd0=_0x504cb3['count'],_0x39645f=_0x5dc5ce[_0x366e('0x2b')],_0xb4b17=_0x5dc5ce[_0x366e('0x2b')]+_0x5dc5ce[_0x366e('0x2c')],_0x107873;if(_0xb4b17>=_0x3d2cd0){_0xb4b17=_0x3d2cd0;_0x107873=0xc8;}else{_0x107873=0xce;}_0x21396e[_0x366e('0x29')](_0x107873);return _0x21396e[_0x366e('0x2d')](_0x366e('0x2e'),_0x39645f+'-'+_0xb4b17+'/'+_0x3d2cd0)['json'](_0x504cb3);}return null;};}function patchUpdates(_0x79b378){return function(_0x4aac77){try{jsonpatch['apply'](_0x4aac77,_0x79b378,!![]);}catch(_0x2f2f31){return BPromise['reject'](_0x2f2f31);}return _0x4aac77[_0x366e('0x2f')]();};}function saveUpdates(_0x22e1e2,_0x32b7e9){return function(_0x18f59e){if(_0x18f59e){return _0x18f59e[_0x366e('0x30')](_0x22e1e2)[_0x366e('0x31')](function(_0x34b8d7){return _0x34b8d7;});}return null;};}function removeEntity(_0xc21a26,_0x227af7){return function(_0x240631){if(_0x240631){return _0x240631[_0x366e('0x32')]()[_0x366e('0x31')](function(){_0xc21a26[_0x366e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22659a,_0x4ab5a6){return function(_0x43bf9e){if(!_0x43bf9e){_0x22659a[_0x366e('0x33')](0x194);}return _0x43bf9e;};}function handleError(_0x24e403,_0x28ae70){_0x28ae70=_0x28ae70||0x1f4;return function(_0xa1c0f1){logger[_0x366e('0x24')](_0xa1c0f1[_0x366e('0x34')]);if(_0xa1c0f1[_0x366e('0x35')]){delete _0xa1c0f1['name'];}_0x24e403[_0x366e('0x29')](_0x28ae70)['send'](_0xa1c0f1);};}exports[_0x366e('0x36')]=function(_0x375da1,_0x10cc58){var _0x35d0d0={},_0x331dc1={},_0xdd2907={'count':0x0,'rows':[]};var _0x5521bf=_[_0x366e('0x37')](db['Network']['rawAttributes'],function(_0x843c6f){return{'name':_0x843c6f[_0x366e('0x38')],'type':_0x843c6f[_0x366e('0x39')][_0x366e('0x3a')]};});_0x331dc1['model']=_[_0x366e('0x37')](_0x5521bf,'name');_0x331dc1[_0x366e('0x3b')]=_[_0x366e('0x3c')](_0x375da1[_0x366e('0x3b')]);_0x331dc1[_0x366e('0x3d')]=_[_0x366e('0x3e')](_0x331dc1[_0x366e('0x3f')],_0x331dc1[_0x366e('0x3b')]);_0x35d0d0[_0x366e('0x40')]=_[_0x366e('0x3e')](_0x331dc1[_0x366e('0x3f')],qs[_0x366e('0x41')](_0x375da1[_0x366e('0x3b')][_0x366e('0x41')]));_0x35d0d0[_0x366e('0x40')]=_0x35d0d0['attributes'][_0x366e('0x42')]?_0x35d0d0[_0x366e('0x40')]:_0x331dc1['model'];if(!_0x375da1['query'][_0x366e('0x43')](_0x366e('0x44'))){_0x35d0d0['limit']=qs[_0x366e('0x2c')](_0x375da1[_0x366e('0x3b')][_0x366e('0x2c')]);_0x35d0d0['offset']=qs[_0x366e('0x2b')](_0x375da1[_0x366e('0x3b')][_0x366e('0x2b')]);}_0x35d0d0[_0x366e('0x45')]=qs[_0x366e('0x46')](_0x375da1[_0x366e('0x3b')]['sort']);_0x35d0d0[_0x366e('0x47')]=qs['filters'](_['pick'](_0x375da1[_0x366e('0x3b')],_0x331dc1[_0x366e('0x3d')]),_0x5521bf);if(_0x375da1[_0x366e('0x3b')]['filter']){_0x35d0d0[_0x366e('0x47')]=_['merge'](_0x35d0d0[_0x366e('0x47')],{'$or':_[_0x366e('0x37')](_0x5521bf,function(_0x29cc0c){if(_0x29cc0c['type']!==_0x366e('0x48')){var _0x244704={};_0x244704[_0x29cc0c[_0x366e('0x35')]]={'$like':'%'+_0x375da1[_0x366e('0x3b')][_0x366e('0x49')]+'%'};return _0x244704;}})});}_0x35d0d0=_[_0x366e('0x4a')]({},_0x35d0d0,_0x375da1[_0x366e('0x4b')]);var _0x135cbb={'where':_0x35d0d0[_0x366e('0x47')]};return db[_0x366e('0x4c')]['count'](_0x135cbb)[_0x366e('0x31')](function(_0x4a82df){_0xdd2907[_0x366e('0x4d')]=_0x4a82df;if(_0x375da1[_0x366e('0x3b')][_0x366e('0x4e')]){_0x35d0d0[_0x366e('0x4f')]=[{'all':!![]}];}return db[_0x366e('0x4c')][_0x366e('0x50')](_0x35d0d0);})['then'](function(_0x5af3a7){_0xdd2907[_0x366e('0x51')]=_0x5af3a7;return _0xdd2907;})[_0x366e('0x31')](respondWithFilteredResult(_0x10cc58,_0x35d0d0))[_0x366e('0x28')](handleError(_0x10cc58,null));};exports[_0x366e('0x52')]=function(_0x2d932e,_0x1a4bbc){var _0x8957a2={'raw':!![],'where':{'id':_0x2d932e['params']['id']}},_0x59821f={};_0x59821f[_0x366e('0x3f')]=_['keys'](db[_0x366e('0x4c')][_0x366e('0x53')]);_0x59821f[_0x366e('0x3b')]=_[_0x366e('0x3c')](_0x2d932e[_0x366e('0x3b')]);_0x59821f[_0x366e('0x3d')]=_[_0x366e('0x3e')](_0x59821f['model'],_0x59821f['query']);_0x8957a2[_0x366e('0x40')]=_[_0x366e('0x3e')](_0x59821f[_0x366e('0x3f')],qs[_0x366e('0x41')](_0x2d932e[_0x366e('0x3b')][_0x366e('0x41')]));_0x8957a2[_0x366e('0x40')]=_0x8957a2['attributes'][_0x366e('0x42')]?_0x8957a2[_0x366e('0x40')]:_0x59821f[_0x366e('0x3f')];if(_0x2d932e['query'][_0x366e('0x4e')]){_0x8957a2[_0x366e('0x4f')]=[{'all':!![]}];}_0x8957a2=_['merge']({},_0x8957a2,_0x2d932e[_0x366e('0x4b')]);return db[_0x366e('0x4c')][_0x366e('0x54')](_0x8957a2)[_0x366e('0x31')](handleEntityNotFound(_0x1a4bbc,null))[_0x366e('0x31')](respondWithResult(_0x1a4bbc,null))[_0x366e('0x28')](handleError(_0x1a4bbc,null));};exports[_0x366e('0x55')]=function(_0x33a28b,_0xefa936,_0x1ae278){var _0xec272c;return db['sequelize'][_0x366e('0x56')](function(_0x3e970a){return db['Network'][_0x366e('0x55')](_0x33a28b[_0x366e('0x57')],{'raw':!![]})[_0x366e('0x31')](function(_0x776d32){_0xec272c=_0x776d32;return db[_0x366e('0x4c')]['findAll']({'where':{'type':_0x33a28b[_0x366e('0x57')][_0x366e('0x39')]},'raw':!![]});})[_0x366e('0x31')](function(_0x225e37){if(_0xec272c['type'][_0x366e('0x58')]()=='STUN'){var _0x243087=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],_0x366e('0x5c')),'utf8');var _0x76c751=ejs[_0x366e('0x5d')](_0x243087,{'networks':_0x225e37||[]});fs['writeFileSync'](_0x366e('0x5e'),_0x76c751);return respondWithRpcPromise('Reload',_0x366e('0x55'),{'module':_0x366e('0x5f')});}else if(_0xec272c[_0x366e('0x39')][_0x366e('0x58')]()=='TURN'){var _0x2fe63b=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config['root'],_0x366e('0x60')),_0x366e('0x61'));var _0x233da3=ejs[_0x366e('0x5d')](_0x2fe63b,{'networks':_0x225e37||[]});fs[_0x366e('0x62')](_0x366e('0x63'),_0x233da3);return respondWithRpcPromise(_0x366e('0x64'),_0x366e('0x55'),{'module':_0x366e('0x5f')});}else{var _0xae3acb=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],_0x366e('0x65')),'utf8');var _0x3fb208=ejs['render'](_0xae3acb,{'networks':_0x225e37||[]});fs['writeFileSync'](util[_0x366e('0x66')](_0x366e('0x67'),_0x33a28b[_0x366e('0x57')][_0x366e('0x39')][_0x366e('0x68')]()),_0x3fb208);return respondWithRpcPromise(_0x366e('0x64'),'create',{'module':_0x366e('0x69')});}return null;})['then'](function(){return _0xec272c;});})['then'](respondWithResult(_0xefa936,0xc9))[_0x366e('0x28')](handleError(_0xefa936,null));};exports['update']=function(_0x14103e,_0x4f48fb,_0x371a03){var _0x431400;return db[_0x366e('0x6a')][_0x366e('0x56')](function(_0x4a0598){return db[_0x366e('0x4c')][_0x366e('0x54')]({'where':{'id':_0x14103e[_0x366e('0x6b')]['id']}})['then'](handleEntityNotFound(_0x4f48fb,null))['then'](saveUpdates(_0x14103e[_0x366e('0x57')],null))['then'](function(_0x5db551){if(_0x5db551){_0x431400=_0x5db551;return db[_0x366e('0x4c')][_0x366e('0x50')]({'where':{'type':_0x431400['type']},'raw':!![]});}return null;})[_0x366e('0x31')](function(_0x570e91){if(_0x431400[_0x366e('0x39')]['toUpperCase']()=='STUN'){var _0x1535d1=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2b4fec=ejs[_0x366e('0x5d')](_0x1535d1,{'networks':_0x570e91||[]});fs[_0x366e('0x62')](_0x366e('0x5e'),_0x2b4fec);return respondWithRpcPromise(_0x366e('0x64'),'update',{'module':_0x366e('0x5f')});}else if(_0x431400['type']['toUpperCase']()==_0x366e('0x6c')){var _0x2e91c8=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x366e('0x61'));var _0x5a4841=ejs[_0x366e('0x5d')](_0x2e91c8,{'networks':_0x570e91||[]});fs[_0x366e('0x62')](_0x366e('0x63'),_0x5a4841);return respondWithRpcPromise(_0x366e('0x64'),_0x366e('0x30'),{'module':_0x366e('0x5f')});}else{var _0x107c7b=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],_0x366e('0x65')),_0x366e('0x61'));var _0xd0b93e=ejs['render'](_0x107c7b,{'networks':_0x570e91||[]});fs['writeFileSync'](util[_0x366e('0x66')](_0x366e('0x67'),_0x14103e['body']['type'][_0x366e('0x68')]()),_0xd0b93e);return respondWithRpcPromise('Reload',_0x366e('0x30'),{'module':_0x366e('0x69')});}return null;})[_0x366e('0x31')](function(_0x3488e2){if(_0x3488e2){return _0x431400;}return null;});})[_0x366e('0x31')](respondWithResult(_0x4f48fb,null))[_0x366e('0x28')](handleError(_0x4f48fb,null));};exports['destroy']=function(_0x2f00bf,_0x2f256b,_0x34c1db){var _0xbb1ed9;return db['Network'][_0x366e('0x54')]({'where':{'id':_0x2f00bf[_0x366e('0x6b')]['id']}})[_0x366e('0x31')](function(_0x31bb46){_0xbb1ed9=_0x31bb46;return _0x31bb46;})['then'](handleEntityNotFound(_0x2f256b,null))[_0x366e('0x31')](removeEntity(_0x2f256b,null))[_0x366e('0x31')](function(){if(_0xbb1ed9){return db[_0x366e('0x4c')][_0x366e('0x50')]({'where':{'type':_0xbb1ed9['type']},'raw':!![]});}})['then'](function(_0x5ce2fe){if(_0xbb1ed9[_0x366e('0x39')][_0x366e('0x58')]()==_0x366e('0x6d')){var _0x786079=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config['root'],_0x366e('0x5c')),_0x366e('0x61'));var _0x478dea=ejs['render'](_0x786079,{'networks':_0x5ce2fe||[]});fs[_0x366e('0x62')]('/etc/asterisk/stun_xcally.conf',_0x478dea);return respondWithRpcPromise('Reload','destroy',{'module':_0x366e('0x5f')});}else if(_0xbb1ed9[_0x366e('0x39')][_0x366e('0x58')]()==_0x366e('0x6c')){var _0x4939ca=fs['readFileSync'](path[_0x366e('0x5a')](config['root'],_0x366e('0x60')),_0x366e('0x61'));var _0x226e6e=ejs[_0x366e('0x5d')](_0x4939ca,{'networks':_0x5ce2fe||[]});fs[_0x366e('0x62')](_0x366e('0x63'),_0x226e6e);return respondWithRpcPromise(_0x366e('0x64'),_0x366e('0x32'),{'module':_0x366e('0x5f')});}else{var _0x520d02=fs[_0x366e('0x59')](path[_0x366e('0x5a')](config[_0x366e('0x5b')],_0x366e('0x65')),_0x366e('0x61'));var _0x4d9eb0=ejs[_0x366e('0x5d')](_0x520d02,{'networks':_0x5ce2fe||[]});fs[_0x366e('0x62')](util[_0x366e('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x2f00bf[_0x366e('0x57')][_0x366e('0x39')][_0x366e('0x68')]()),_0x4d9eb0);return respondWithRpcPromise(_0x366e('0x64'),_0x366e('0x32'),{'module':_0x366e('0x69')});}return null;})[_0x366e('0x28')](handleError(_0x2f256b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a7d1e28..b1f0ff9 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 _0x2668=['network','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3024a8,_0xceec29){var _0x5f52e9=function(_0x1d4f81){while(--_0x1d4f81){_0x3024a8['push'](_0x3024a8['shift']());}};_0x5f52e9(++_0xceec29);}(_0x2668,0x7f));var _0x8266=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x2668[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x8266('0x0'));var util=require(_0x8266('0x1'));var logger=require(_0x8266('0x2'))(_0x8266('0x3'));var moment=require(_0x8266('0x4'));var BPromise=require(_0x8266('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8266('0x6'));var rimraf=require(_0x8266('0x7'));var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x22416c,_0x3c2ea6){return _0x22416c['define']('Network',attributes,{'tableName':_0x8266('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7227=['moment','request-promise','path','rimraf','./network.attributes','Network','util','../../config/logger','api'];(function(_0x3f9860,_0x2b0725){var _0x1ae6d3=function(_0x1cac8f){while(--_0x1cac8f){_0x3f9860['push'](_0x3f9860['shift']());}};_0x1ae6d3(++_0x2b0725);}(_0x7227,0x192));var _0x7722=function(_0x37f364,_0x56f6ae){_0x37f364=_0x37f364-0x0;var _0x1a97dd=_0x7227[_0x37f364];return _0x1a97dd;};'use strict';var _=require('lodash');var util=require(_0x7722('0x0'));var logger=require(_0x7722('0x1'))(_0x7722('0x2'));var moment=require(_0x7722('0x3'));var BPromise=require('bluebird');var rp=require(_0x7722('0x4'));var fs=require('fs');var path=require(_0x7722('0x5'));var rimraf=require(_0x7722('0x6'));var config=require('../../config/environment');var attributes=require(_0x7722('0x7'));module['exports']=function(_0x132b92,_0x42ecbb){return _0x132b92['define'](_0x7722('0x8'),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 1224200..a620a33 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 _0x0ad5=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s'];(function(_0xeb524b,_0x4520c3){var _0x2cfda9=function(_0x176bc7){while(--_0x176bc7){_0xeb524b['push'](_0xeb524b['shift']());}};_0x2cfda9(++_0x4520c3);}(_0x0ad5,0x17e));var _0x50ad=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0ad5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x50ad('0x0'));var util=require(_0x50ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50ad('0x2'));var db=require(_0x50ad('0x3'))['db'];var utils=require(_0x50ad('0x4'));var logger=require(_0x50ad('0x5'))(_0x50ad('0x6'));var config=require(_0x50ad('0x7'));var jayson=require(_0x50ad('0x8'));var client=jayson[_0x50ad('0x9')][_0x50ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b8314,_0x481e1b,_0x4fb7b4){return new BPromise(function(_0x2b1956,_0x373f05){return client['request'](_0x5b8314,_0x4fb7b4)[_0x50ad('0xb')](function(_0x245144){logger[_0x50ad('0xc')](_0x50ad('0xd'),_0x481e1b,_0x50ad('0xe'));logger[_0x50ad('0xf')](_0x50ad('0x10'),_0x481e1b,_0x50ad('0xe'),JSON['stringify'](_0x245144));if(_0x245144[_0x50ad('0x11')]){if(_0x245144[_0x50ad('0x11')][_0x50ad('0x12')]===0x1f4){logger[_0x50ad('0x11')](_0x50ad('0xd'),_0x481e1b,_0x245144[_0x50ad('0x11')][_0x50ad('0x13')]);return _0x373f05(_0x245144[_0x50ad('0x11')]['message']);}logger[_0x50ad('0x11')]('Network,\x20%s,\x20%s',_0x481e1b,_0x245144['error'][_0x50ad('0x13')]);return _0x2b1956(_0x245144[_0x50ad('0x11')][_0x50ad('0x13')]);}else{logger[_0x50ad('0xc')](_0x50ad('0xd'),_0x481e1b,_0x50ad('0xe'));_0x2b1956(_0x245144[_0x50ad('0x14')][_0x50ad('0x13')]);}})[_0x50ad('0x15')](function(_0x53f4fc){logger[_0x50ad('0x11')]('Network,\x20%s,\x20%s',_0x481e1b,_0x53f4fc);_0x373f05(_0x53f4fc);});});} \ No newline at end of file +var _0xdee9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xdee9,0x1ac));var _0x9dee=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xdee9[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x9dee('0x0'));var util=require(_0x9dee('0x1'));var moment=require(_0x9dee('0x2'));var BPromise=require(_0x9dee('0x3'));var rs=require(_0x9dee('0x4'));var fs=require('fs');var Redis=require(_0x9dee('0x5'));var db=require(_0x9dee('0x6'))['db'];var utils=require(_0x9dee('0x7'));var logger=require(_0x9dee('0x8'))(_0x9dee('0x9'));var config=require(_0x9dee('0xa'));var jayson=require(_0x9dee('0xb'));var client=jayson[_0x9dee('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e51f,_0x299899,_0x551ea1){return new BPromise(function(_0x33f16e,_0x400ed3){return client['request'](_0x26e51f,_0x551ea1)[_0x9dee('0xd')](function(_0x2032ad){logger[_0x9dee('0xe')]('Network,\x20%s,\x20%s',_0x299899,_0x9dee('0xf'));logger[_0x9dee('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x299899,_0x9dee('0xf'),JSON[_0x9dee('0x11')](_0x2032ad));if(_0x2032ad[_0x9dee('0x12')]){if(_0x2032ad[_0x9dee('0x12')][_0x9dee('0x13')]===0x1f4){logger['error'](_0x9dee('0x14'),_0x299899,_0x2032ad[_0x9dee('0x12')][_0x9dee('0x15')]);return _0x400ed3(_0x2032ad[_0x9dee('0x12')][_0x9dee('0x15')]);}logger[_0x9dee('0x12')](_0x9dee('0x14'),_0x299899,_0x2032ad[_0x9dee('0x12')]['message']);return _0x33f16e(_0x2032ad[_0x9dee('0x12')][_0x9dee('0x15')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x299899,_0x9dee('0xf'));_0x33f16e(_0x2032ad[_0x9dee('0x16')][_0x9dee('0x15')]);}})[_0x9dee('0x17')](function(_0x1c825b){logger[_0x9dee('0x12')](_0x9dee('0x14'),_0x299899,_0x1c825b);_0x400ed3(_0x1c825b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ef69ccd..5fab794 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 _0x1ee0=['notify','/:id/applications','/:id/users','addAgents','/:id/send','send','put','destroy','delete','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getAgents','post','addDisposition','addAnswer','/:id/notify'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x1ee0,0xb5));var _0x01ee=function(_0x9f12a7,_0x5cccb6){_0x9f12a7=_0x9f12a7-0x0;var _0x2ed407=_0x1ee0[_0x9f12a7];return _0x2ed407;};'use strict';var multer=require(_0x01ee('0x0'));var util=require(_0x01ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x01ee('0x2'));var router=express['Router']();var auth=require(_0x01ee('0x3'));var interaction=require(_0x01ee('0x4'));var config=require(_0x01ee('0x5'));var controller=require(_0x01ee('0x6'));router[_0x01ee('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x01ee('0x7')](_0x01ee('0x8'),auth[_0x01ee('0x9')](),controller[_0x01ee('0xa')]);router['get'](_0x01ee('0xb'),auth[_0x01ee('0x9')](),controller[_0x01ee('0xc')]);router[_0x01ee('0x7')](_0x01ee('0xd'),auth['isAuthenticated'](),controller[_0x01ee('0xe')]);router[_0x01ee('0x7')](_0x01ee('0xf'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x10')]);router[_0x01ee('0x7')]('/:id/applications',auth[_0x01ee('0x9')](),controller['getApplications']);router['get'](_0x01ee('0x11'),auth[_0x01ee('0x9')](),controller['getInteractions']);router[_0x01ee('0x7')]('/:id/users',auth[_0x01ee('0x9')](),controller[_0x01ee('0x12')]);router[_0x01ee('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01ee('0x13')](_0x01ee('0xd'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x14')]);router[_0x01ee('0x13')](_0x01ee('0xf'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x15')]);router['post'](_0x01ee('0x16'),controller[_0x01ee('0x17')]);router[_0x01ee('0x13')](_0x01ee('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x01ee('0x13')](_0x01ee('0x19'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x1a')]);router[_0x01ee('0x13')](_0x01ee('0x1b'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x1c')]);router[_0x01ee('0x1d')](_0x01ee('0xb'),auth[_0x01ee('0x9')](),controller['update']);router['delete'](_0x01ee('0xb'),auth[_0x01ee('0x9')](),controller[_0x01ee('0x1e')]);router[_0x01ee('0x1f')](_0x01ee('0xd'),auth[_0x01ee('0x9')](),controller['removeDispositions']);router[_0x01ee('0x1f')](_0x01ee('0xf'),auth[_0x01ee('0x9')](),controller['removeAnswers']);router[_0x01ee('0x1f')]('/:id/users',auth[_0x01ee('0x9')](),controller[_0x01ee('0x20')]);module[_0x01ee('0x21')]=router; \ No newline at end of file +var _0xb9de=['/:id/dispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x1de395,_0x450e4f){var _0x3c3d57=function(_0x184fa0){while(--_0x184fa0){_0x1de395['push'](_0x1de395['shift']());}};_0x3c3d57(++_0x450e4f);}(_0xb9de,0xfc));var _0xeb9d=function(_0x4d10a7,_0x314b9a){_0x4d10a7=_0x4d10a7-0x0;var _0x29ce43=_0xb9de[_0x4d10a7];return _0x29ce43;};'use strict';var multer=require(_0xeb9d('0x0'));var util=require(_0xeb9d('0x1'));var path=require(_0xeb9d('0x2'));var timeout=require(_0xeb9d('0x3'));var express=require(_0xeb9d('0x4'));var router=express[_0xeb9d('0x5')]();var auth=require(_0xeb9d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb9d('0x7'));var controller=require('./openchannelAccount.controller');router[_0xeb9d('0x8')]('/',auth[_0xeb9d('0x9')](),controller[_0xeb9d('0xa')]);router[_0xeb9d('0x8')](_0xeb9d('0xb'),auth[_0xeb9d('0x9')](),controller['describe']);router[_0xeb9d('0x8')]('/:id',auth[_0xeb9d('0x9')](),controller['show']);router[_0xeb9d('0x8')](_0xeb9d('0xc'),auth[_0xeb9d('0x9')](),controller['getDispositions']);router['get'](_0xeb9d('0xd'),auth[_0xeb9d('0x9')](),controller['getAnswers']);router[_0xeb9d('0x8')](_0xeb9d('0xe'),auth['isAuthenticated'](),controller['getApplications']);router[_0xeb9d('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xeb9d('0xf')]);router[_0xeb9d('0x8')](_0xeb9d('0x10'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x11')]);router[_0xeb9d('0x12')]('/',auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x13')]);router[_0xeb9d('0x12')](_0xeb9d('0xc'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x14')]);router[_0xeb9d('0x12')](_0xeb9d('0xd'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x15')]);router[_0xeb9d('0x12')](_0xeb9d('0x16'),controller[_0xeb9d('0x17')]);router[_0xeb9d('0x12')](_0xeb9d('0xe'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x18')]);router[_0xeb9d('0x12')](_0xeb9d('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xeb9d('0x12')](_0xeb9d('0x19'),auth['isAuthenticated'](),controller[_0xeb9d('0x1a')]);router[_0xeb9d('0x1b')](_0xeb9d('0x1c'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x1d')]);router[_0xeb9d('0x1e')](_0xeb9d('0x1c'),auth[_0xeb9d('0x9')](),controller['destroy']);router[_0xeb9d('0x1e')](_0xeb9d('0xc'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x1f')]);router['delete'](_0xeb9d('0xd'),auth[_0xeb9d('0x9')](),controller[_0xeb9d('0x20')]);router[_0xeb9d('0x1e')](_0xeb9d('0x10'),auth['isAuthenticated'](),controller['removeAgents']);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 fe8a280..958facc 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 _0x25c5=['name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x2ba777,_0x4e2357){var _0x70f550=function(_0x24e6d5){while(--_0x24e6d5){_0x2ba777['push'](_0x2ba777['shift']());}};_0x70f550(++_0x4e2357);}(_0x25c5,0x136));var _0x525c=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0x25c5[_0x3794a0];return _0x5bdaba;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x525c('0x0'));module[_0x525c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x525c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x525c('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x525c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x525c('0x4')],'defaultValue':function(){return _0x525c('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x525c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x525c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x525c('0x3')]},'queueTransfer':{'type':Sequelize[_0x525c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x525c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x525c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x525c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x525c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x525c('0x6')],'defaultValue':![],'comment':_0x525c('0x9'),'set':function(_0x235c78){if(!_0x235c78)this[_0x525c('0xa')](_0x525c('0xb'),null);this[_0x525c('0xa')](_0x525c('0xc'),_0x235c78);}}}; \ No newline at end of file +var _0x17c6=['exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x17c6,0x6b));var _0x617c=function(_0x4b7fc1,_0x456d16){_0x4b7fc1=_0x4b7fc1-0x0;var _0x2e6529=_0x17c6[_0x4b7fc1];return _0x2e6529;};'use strict';var Sequelize=require(_0x617c('0x0'));var rs=require('randomstring');module[_0x617c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x617c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x617c('0x3')],'defaultValue':function(){return rs[_0x617c('0x4')]();}},'replyUri':{'type':Sequelize[_0x617c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x617c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x617c('0x5')],'defaultValue':function(){return _0x617c('0x6');}},'notificationSound':{'type':Sequelize[_0x617c('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x617c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x617c('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x617c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x617c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x617c('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x617c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x617c('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x705332){if(!_0x705332)this[_0x617c('0xa')](_0x617c('0xb'),null);this[_0x617c('0xa')]('mandatoryDisposition',_0x705332);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e61bec4..0311411 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 _0x9775=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','OpenchannelAccounts','destroy','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','length','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','OpenchannelMessage','dataValues','Messages','eml-format','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9775,0x16d));var _0x5977=function(_0x467e30,_0x4c15a0){_0x467e30=_0x467e30-0x0;var _0x16e4eb=_0x9775[_0x467e30];return _0x16e4eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5977('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5977('0x1'));var rp=require('request-promise');var moment=require(_0x5977('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5977('0x3'));var path=require(_0x5977('0x4'));var sox=require('sox');var csv=require(_0x5977('0x5'));var ejs=require(_0x5977('0x6'));var fs=require('fs');var _=require(_0x5977('0x7'));var squel=require(_0x5977('0x8'));var crypto=require(_0x5977('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5977('0xa'));var toCsv=require(_0x5977('0x5'));var querystring=require(_0x5977('0xb'));var Papa=require(_0x5977('0xc'));var Redis=require(_0x5977('0xd'));var authService=require(_0x5977('0xe'));var qs=require(_0x5977('0xf'));var as=require(_0x5977('0x10'));var hardwareService=require(_0x5977('0x11'));var logger=require(_0x5977('0x12'))(_0x5977('0x13'));var utils=require(_0x5977('0x14'));var config=require(_0x5977('0x15'));var licenseUtil=require(_0x5977('0x16'));var db=require(_0x5977('0x17'))['db'];config[_0x5977('0x18')]=_[_0x5977('0x19')](config[_0x5977('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5977('0x1a'))[_0x5977('0x1b')](socket);var jayson=require(_0x5977('0x1c'));var client=jayson[_0x5977('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x5977('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57dea3,_0x5d13a8,_0x2c9fb3,_0x2e10b4){return new BPromise(function(_0x48a2a4,_0x3953ae){var _0xbd2385=_0x2e10b4||client;return _0xbd2385['request'](_0x57dea3,_0x2c9fb3)[_0x5977('0x1f')](function(_0xf1259b){logger[_0x5977('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d13a8,_0x5977('0x21'));logger[_0x5977('0x22')](_0x5977('0x23'),_0x5d13a8,_0x5977('0x21'),JSON[_0x5977('0x24')](_0xf1259b));if(_0xf1259b[_0x5977('0x25')]){if(_0xf1259b[_0x5977('0x25')][_0x5977('0x26')]===0x1f4){logger[_0x5977('0x25')](_0x5977('0x27'),_0x5d13a8,_0xf1259b[_0x5977('0x25')][_0x5977('0x28')]);return _0x3953ae(_0xf1259b[_0x5977('0x25')]['message']);}logger[_0x5977('0x25')](_0x5977('0x27'),_0x5d13a8,_0xf1259b[_0x5977('0x25')][_0x5977('0x28')]);return _0x48a2a4(_0xf1259b[_0x5977('0x25')]['message']);}else{logger[_0x5977('0x20')](_0x5977('0x27'),_0x5d13a8,_0x5977('0x21'));_0x48a2a4(_0xf1259b[_0x5977('0x29')]['message']);}})[_0x5977('0x2a')](function(_0x1e976a){logger[_0x5977('0x25')](_0x5977('0x27'),_0x5d13a8,_0x1e976a);_0x3953ae(_0x1e976a);});});}function respondWithStatusCode(_0x8b6a3e,_0x4c2009){_0x4c2009=_0x4c2009||0xcc;return function(_0x2a11ac){if(_0x2a11ac){return _0x8b6a3e[_0x5977('0x2b')](_0x4c2009);}return _0x8b6a3e[_0x5977('0x2c')](_0x4c2009)[_0x5977('0x2d')]();};}function respondWithResult(_0x3ea806,_0x52d540){_0x52d540=_0x52d540||0xc8;return function(_0x755ae9){if(_0x755ae9){return _0x3ea806[_0x5977('0x2c')](_0x52d540)['json'](_0x755ae9);}};}function respondWithFilteredResult(_0x2395d2,_0x4dc78b){return function(_0x301162){if(_0x301162){var _0x2acdf5=_0x301162[_0x5977('0x2e')],_0x599ade=_0x4dc78b[_0x5977('0x2f')],_0x3e8988=_0x4dc78b[_0x5977('0x2f')]+_0x4dc78b['limit'],_0x377710;if(_0x3e8988>=_0x2acdf5){_0x3e8988=_0x2acdf5;_0x377710=0xc8;}else{_0x377710=0xce;}_0x2395d2[_0x5977('0x2c')](_0x377710);return _0x2395d2[_0x5977('0x30')](_0x5977('0x31'),_0x599ade+'-'+_0x3e8988+'/'+_0x2acdf5)[_0x5977('0x32')](_0x301162);}return null;};}function patchUpdates(_0x2afbc0){return function(_0x203eeb){try{jsonpatch['apply'](_0x203eeb,_0x2afbc0,!![]);}catch(_0x58b6f1){return BPromise[_0x5977('0x33')](_0x58b6f1);}return _0x203eeb[_0x5977('0x34')]();};}function saveUpdates(_0x3add71,_0x9a9e98){return function(_0x50f661){if(_0x50f661){return _0x50f661['update'](_0x3add71)[_0x5977('0x1f')](function(_0x5161a){return _0x5161a;});}return null;};}function removeEntity(_0x1d5b06,_0x1e9585){return function(_0xa9891f){if(_0xa9891f){return _0xa9891f['destroy']()[_0x5977('0x1f')](function(){var _0x45894c=_0xa9891f['get']({'plain':!![]});var _0x31f2bb=_0x5977('0x35');return db['UserProfileResource'][_0x5977('0x36')]({'where':{'type':_0x31f2bb,'resourceId':_0x45894c['id']}})[_0x5977('0x1f')](function(){return _0xa9891f;});})[_0x5977('0x1f')](function(){_0x1d5b06[_0x5977('0x2c')](0xcc)[_0x5977('0x2d')]();});}};}function handleEntityNotFound(_0x3c55c3,_0x4f59a6){return function(_0x576f02){if(!_0x576f02){_0x3c55c3['sendStatus'](0x194);}return _0x576f02;};}function handleError(_0x4bb74f,_0x44d552){_0x44d552=_0x44d552||0x1f4;return function(_0x48659a){logger[_0x5977('0x25')](_0x48659a[_0x5977('0x37')]);if(_0x48659a[_0x5977('0x38')]){delete _0x48659a[_0x5977('0x38')];}_0x4bb74f['status'](_0x44d552)[_0x5977('0x39')](_0x48659a);};}exports[_0x5977('0x3a')]=function(_0x7ddc36,_0x39b55b){var _0x3df63e={'include':[{'model':db['Pause'],'as':_0x5977('0x3b')}]},_0x5a190c={},_0x1d1beb={'count':0x0,'rows':[]};var _0x417988=_[_0x5977('0x3c')](db[_0x5977('0x3d')][_0x5977('0x3e')],function(_0x28c433){return{'name':_0x28c433[_0x5977('0x3f')],'type':_0x28c433[_0x5977('0x40')][_0x5977('0x41')]};});_0x5a190c[_0x5977('0x42')]=_[_0x5977('0x3c')](_0x417988,_0x5977('0x38'));_0x5a190c[_0x5977('0x43')]=_[_0x5977('0x44')](_0x7ddc36[_0x5977('0x43')]);_0x5a190c[_0x5977('0x45')]=_[_0x5977('0x46')](_0x5a190c[_0x5977('0x42')],_0x5a190c[_0x5977('0x43')]);_0x3df63e['attributes']=_[_0x5977('0x46')](_0x5a190c[_0x5977('0x42')],qs[_0x5977('0x47')](_0x7ddc36[_0x5977('0x43')][_0x5977('0x47')]));_0x3df63e['attributes']=_0x3df63e[_0x5977('0x48')]['length']?_0x3df63e[_0x5977('0x48')]:_0x5a190c[_0x5977('0x42')];if(!_0x7ddc36['query'][_0x5977('0x49')](_0x5977('0x4a'))){_0x3df63e['limit']=qs[_0x5977('0x4b')](_0x7ddc36[_0x5977('0x43')][_0x5977('0x4b')]);_0x3df63e[_0x5977('0x2f')]=qs[_0x5977('0x2f')](_0x7ddc36['query'][_0x5977('0x2f')]);}_0x3df63e[_0x5977('0x4c')]=qs[_0x5977('0x4d')](_0x7ddc36[_0x5977('0x43')][_0x5977('0x4d')]);_0x3df63e['where']=qs[_0x5977('0x45')](_[_0x5977('0x4e')](_0x7ddc36[_0x5977('0x43')],_0x5a190c[_0x5977('0x45')]),_0x417988);if(_0x7ddc36[_0x5977('0x43')][_0x5977('0x4f')]){_0x3df63e[_0x5977('0x50')]=_[_0x5977('0x51')](_0x3df63e[_0x5977('0x50')],{'$or':_[_0x5977('0x3c')](_0x417988,function(_0x22bb2c){if(_0x22bb2c['type']!==_0x5977('0x52')){var _0x240ca9={};_0x240ca9[_0x22bb2c['name']]={'$like':'%'+_0x7ddc36['query'][_0x5977('0x4f')]+'%'};return _0x240ca9;}})});}_0x3df63e=_[_0x5977('0x51')]({},_0x3df63e,_0x7ddc36[_0x5977('0x53')]);var _0x4f06ad={'where':_0x3df63e[_0x5977('0x50')]};return db[_0x5977('0x3d')][_0x5977('0x2e')](_0x4f06ad)[_0x5977('0x1f')](function(_0x7b5ee4){_0x1d1beb[_0x5977('0x2e')]=_0x7b5ee4;if(_0x7ddc36[_0x5977('0x43')][_0x5977('0x54')]){_0x3df63e[_0x5977('0x55')]=[{'all':!![]}];}return db[_0x5977('0x3d')][_0x5977('0x56')](_0x3df63e);})[_0x5977('0x1f')](function(_0x2038cc){_0x1d1beb[_0x5977('0x57')]=_0x2038cc;return _0x1d1beb;})[_0x5977('0x1f')](respondWithFilteredResult(_0x39b55b,_0x3df63e))[_0x5977('0x2a')](handleError(_0x39b55b,null));};exports[_0x5977('0x58')]=function(_0x542fc4,_0x1b921e){var _0x31093b={'raw':![],'where':{'id':_0x542fc4[_0x5977('0x59')]['id']},'include':[{'model':db[_0x5977('0x5a')],'as':_0x5977('0x3b')}]},_0x568189={};_0x568189[_0x5977('0x42')]=_[_0x5977('0x44')](db[_0x5977('0x3d')][_0x5977('0x3e')]);_0x568189[_0x5977('0x43')]=_['keys'](_0x542fc4[_0x5977('0x43')]);_0x568189[_0x5977('0x45')]=_[_0x5977('0x46')](_0x568189['model'],_0x568189[_0x5977('0x43')]);_0x31093b['attributes']=_[_0x5977('0x46')](_0x568189[_0x5977('0x42')],qs['fields'](_0x542fc4['query'][_0x5977('0x47')]));_0x31093b['attributes']=_0x31093b[_0x5977('0x48')][_0x5977('0x5b')]?_0x31093b[_0x5977('0x48')]:_0x568189[_0x5977('0x42')];if(_0x542fc4[_0x5977('0x43')][_0x5977('0x54')]){_0x31093b['include']=[{'all':!![]}];}_0x31093b=_[_0x5977('0x51')]({},_0x31093b,_0x542fc4[_0x5977('0x53')]);return db[_0x5977('0x3d')][_0x5977('0x5c')](_0x31093b)['then'](handleEntityNotFound(_0x1b921e,null))[_0x5977('0x1f')](respondWithResult(_0x1b921e,null))['catch'](handleError(_0x1b921e,null));};exports[_0x5977('0x5d')]=function(_0x51628b,_0x21827a){return db[_0x5977('0x3d')][_0x5977('0x5d')](_0x51628b[_0x5977('0x5e')],{})[_0x5977('0x1f')](function(_0x4cdbfc){var _0x41c1a9=_0x51628b[_0x5977('0x5f')][_0x5977('0x60')]({'plain':!![]});if(!_0x41c1a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41c1a9[_0x5977('0x61')]==='user'){var _0x4f086c=_0x4cdbfc[_0x5977('0x60')]({'plain':!![]});var _0x328aaf='OpenchannelAccounts';return db[_0x5977('0x62')][_0x5977('0x5c')]({'where':{'name':_0x328aaf,'userProfileId':_0x41c1a9[_0x5977('0x63')]},'raw':!![]})[_0x5977('0x1f')](function(_0x2ce975){if(_0x2ce975&&_0x2ce975[_0x5977('0x64')]===0x0){return db[_0x5977('0x65')][_0x5977('0x5d')]({'name':_0x4f086c[_0x5977('0x38')],'resourceId':_0x4f086c['id'],'type':_0x2ce975[_0x5977('0x38')],'sectionId':_0x2ce975['id']},{})[_0x5977('0x1f')](function(){return _0x4cdbfc;});}else{return _0x4cdbfc;}})[_0x5977('0x2a')](function(_0x56a44e){logger[_0x5977('0x25')](_0x5977('0x66'),_0x56a44e);throw _0x56a44e;});}return _0x4cdbfc;})['then'](respondWithResult(_0x21827a,0xc9))[_0x5977('0x2a')](handleError(_0x21827a,null));};exports[_0x5977('0x67')]=function(_0x1e4d11,_0x3467c4){if(_0x1e4d11[_0x5977('0x5e')]['id']){delete _0x1e4d11[_0x5977('0x5e')]['id'];}return db[_0x5977('0x3d')][_0x5977('0x5c')]({'where':{'id':_0x1e4d11[_0x5977('0x59')]['id']},'include':[{'model':db[_0x5977('0x5a')],'as':_0x5977('0x3b')}]})[_0x5977('0x1f')](handleEntityNotFound(_0x3467c4,null))['then'](saveUpdates(_0x1e4d11[_0x5977('0x5e')],null))['then'](respondWithResult(_0x3467c4,null))['catch'](handleError(_0x3467c4,null));};exports[_0x5977('0x36')]=function(_0x3988a6,_0x5c8408){return db['OpenchannelAccount'][_0x5977('0x5c')]({'where':{'id':_0x3988a6[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x5c8408,null))[_0x5977('0x1f')](removeEntity(_0x5c8408,null))['catch'](handleError(_0x5c8408,null));};exports[_0x5977('0x68')]=function(_0x1bc522,_0x2e729f){return db[_0x5977('0x3d')][_0x5977('0x68')]()[_0x5977('0x1f')](respondWithResult(_0x2e729f,null))[_0x5977('0x2a')](handleError(_0x2e729f,null));};exports['addDisposition']=function(_0xb78bcb,_0x388f04,_0x461e59){if(_0xb78bcb[_0x5977('0x5e')]['id']){delete _0xb78bcb[_0x5977('0x5e')]['id'];}return db[_0x5977('0x3d')]['find']({'where':{'id':_0xb78bcb[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x388f04,null))[_0x5977('0x1f')](function(_0x2d9b85){if(_0x2d9b85){_0xb78bcb['body'][_0x5977('0x69')]=_0x2d9b85['id'];return db[_0x5977('0x6a')]['create'](_0xb78bcb[_0x5977('0x5e')]);}})[_0x5977('0x1f')](respondWithResult(_0x388f04,null))[_0x5977('0x2a')](handleError(_0x388f04,null));};exports[_0x5977('0x6b')]=function(_0x4841eb,_0x52716d,_0x55acac){var _0x131c20={'raw':![],'where':{}};var _0x485727={};var _0x110d10={'count':0x0,'rows':[]};return db[_0x5977('0x3d')][_0x5977('0x6c')]({'where':{'id':_0x4841eb['params']['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x52716d,null))['then'](function(_0x3df534){if(_0x3df534){_0x485727[_0x5977('0x42')]=_[_0x5977('0x44')](db[_0x5977('0x6a')][_0x5977('0x3e')]);_0x485727[_0x5977('0x43')]=_['keys'](_0x4841eb['query']);_0x485727['filters']=_[_0x5977('0x46')](_0x485727[_0x5977('0x42')],_0x485727['query']);_0x131c20[_0x5977('0x48')]=_[_0x5977('0x46')](_0x485727[_0x5977('0x42')],qs[_0x5977('0x47')](_0x4841eb[_0x5977('0x43')][_0x5977('0x47')]));_0x131c20['attributes']=_0x131c20[_0x5977('0x48')][_0x5977('0x5b')]?_0x131c20['attributes']:_0x485727[_0x5977('0x42')];if(!_0x4841eb[_0x5977('0x43')][_0x5977('0x49')]('nolimit')){_0x131c20[_0x5977('0x4b')]=qs[_0x5977('0x4b')](_0x4841eb[_0x5977('0x43')][_0x5977('0x4b')]);_0x131c20['offset']=qs[_0x5977('0x2f')](_0x4841eb['query'][_0x5977('0x2f')]);}_0x131c20['order']=qs['sort'](_0x4841eb[_0x5977('0x43')][_0x5977('0x4d')]);_0x131c20[_0x5977('0x50')]=qs[_0x5977('0x45')](_[_0x5977('0x4e')](_0x4841eb[_0x5977('0x43')],_0x485727['filters']));_0x131c20[_0x5977('0x50')][_0x5977('0x69')]=_0x3df534['id'];if(_0x4841eb[_0x5977('0x43')][_0x5977('0x4f')]){_0x131c20[_0x5977('0x50')]=_[_0x5977('0x51')](_0x131c20[_0x5977('0x50')],{'$or':_['map'](_0x131c20['attributes'],function(_0x5093e0){var _0x7b92b4={};_0x7b92b4[_0x5093e0]={'$like':'%'+_0x4841eb[_0x5977('0x43')][_0x5977('0x4f')]+'%'};return _0x7b92b4;})});}_0x131c20=_['merge']({},_0x131c20,_0x4841eb[_0x5977('0x53')]);return db[_0x5977('0x6a')][_0x5977('0x2e')]({'where':_0x131c20[_0x5977('0x50')]})[_0x5977('0x1f')](function(_0x3ce72e){_0x110d10[_0x5977('0x2e')]=_0x3ce72e;if(_0x4841eb['query'][_0x5977('0x54')]){_0x131c20[_0x5977('0x55')]=[{'all':!![]}];}return db[_0x5977('0x6a')][_0x5977('0x56')](_0x131c20);})[_0x5977('0x1f')](function(_0x10f804){_0x110d10[_0x5977('0x57')]=_0x10f804;return _0x110d10;});}})[_0x5977('0x1f')](respondWithFilteredResult(_0x52716d,_0x131c20))[_0x5977('0x2a')](handleError(_0x52716d,null));};exports[_0x5977('0x6d')]=function(_0x1d4a8b,_0x67525c,_0x2be4c0){return db['OpenchannelAccount'][_0x5977('0x5c')]({'where':{'id':_0x1d4a8b[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x67525c,null))['then'](function(_0x246c08){if(_0x246c08){return _0x246c08[_0x5977('0x6d')](_0x1d4a8b[_0x5977('0x43')][_0x5977('0x6e')]);}})[_0x5977('0x1f')](respondWithStatusCode(_0x67525c,null))[_0x5977('0x2a')](handleError(_0x67525c,null));};exports[_0x5977('0x6f')]=function(_0x55dce6,_0x48619e,_0x9a4afb){if(_0x55dce6['body']['id']){delete _0x55dce6[_0x5977('0x5e')]['id'];}return db['OpenchannelAccount'][_0x5977('0x5c')]({'where':{'id':_0x55dce6[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x48619e,null))[_0x5977('0x1f')](function(_0x1f8135){if(_0x1f8135){_0x55dce6[_0x5977('0x5e')][_0x5977('0x69')]=_0x1f8135['id'];return db['CannedAnswer'][_0x5977('0x5d')](_0x55dce6[_0x5977('0x5e')]);}})['then'](respondWithResult(_0x48619e,null))[_0x5977('0x2a')](handleError(_0x48619e,null));};exports['getAnswers']=function(_0x37ae04,_0x59eab2,_0x1509e9){var _0x177db8={'raw':![],'where':{}};var _0x5ba223={};var _0x1ab113={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5977('0x6c')]({'where':{'id':_0x37ae04[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x59eab2,null))[_0x5977('0x1f')](function(_0x155257){if(_0x155257){_0x5ba223[_0x5977('0x42')]=_[_0x5977('0x44')](db[_0x5977('0x70')][_0x5977('0x3e')]);_0x5ba223[_0x5977('0x43')]=_[_0x5977('0x44')](_0x37ae04[_0x5977('0x43')]);_0x5ba223[_0x5977('0x45')]=_[_0x5977('0x46')](_0x5ba223[_0x5977('0x42')],_0x5ba223['query']);_0x177db8[_0x5977('0x48')]=_[_0x5977('0x46')](_0x5ba223[_0x5977('0x42')],qs[_0x5977('0x47')](_0x37ae04[_0x5977('0x43')]['fields']));_0x177db8['attributes']=_0x177db8[_0x5977('0x48')][_0x5977('0x5b')]?_0x177db8[_0x5977('0x48')]:_0x5ba223[_0x5977('0x42')];if(!_0x37ae04['query'][_0x5977('0x49')](_0x5977('0x4a'))){_0x177db8[_0x5977('0x4b')]=qs[_0x5977('0x4b')](_0x37ae04[_0x5977('0x43')][_0x5977('0x4b')]);_0x177db8[_0x5977('0x2f')]=qs[_0x5977('0x2f')](_0x37ae04[_0x5977('0x43')]['offset']);}_0x177db8[_0x5977('0x4c')]=qs[_0x5977('0x4d')](_0x37ae04[_0x5977('0x43')][_0x5977('0x4d')]);_0x177db8[_0x5977('0x50')]=qs['filters'](_[_0x5977('0x4e')](_0x37ae04[_0x5977('0x43')],_0x5ba223['filters']));_0x177db8[_0x5977('0x50')][_0x5977('0x69')]=_0x155257['id'];if(_0x37ae04[_0x5977('0x43')][_0x5977('0x4f')]){_0x177db8[_0x5977('0x50')]=_[_0x5977('0x51')](_0x177db8[_0x5977('0x50')],{'$or':_['map'](_0x177db8[_0x5977('0x48')],function(_0x1e3969){var _0x18b8e7={};_0x18b8e7[_0x1e3969]={'$like':'%'+_0x37ae04[_0x5977('0x43')]['filter']+'%'};return _0x18b8e7;})});}_0x177db8=_[_0x5977('0x51')]({},_0x177db8,_0x37ae04[_0x5977('0x53')]);return db[_0x5977('0x70')][_0x5977('0x2e')]({'where':_0x177db8['where']})[_0x5977('0x1f')](function(_0x2dd6ea){_0x1ab113[_0x5977('0x2e')]=_0x2dd6ea;if(_0x37ae04[_0x5977('0x43')][_0x5977('0x54')]){_0x177db8['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5977('0x56')](_0x177db8);})[_0x5977('0x1f')](function(_0x4743b1){_0x1ab113[_0x5977('0x57')]=_0x4743b1;return _0x1ab113;});}})[_0x5977('0x1f')](respondWithFilteredResult(_0x59eab2,_0x177db8))[_0x5977('0x2a')](handleError(_0x59eab2,null));};exports[_0x5977('0x71')]=function(_0xea6f3,_0x2b72be,_0x371e46){return db['OpenchannelAccount'][_0x5977('0x5c')]({'where':{'id':_0xea6f3[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x2b72be,null))['then'](function(_0x2b364e){if(_0x2b364e){return _0x2b364e[_0x5977('0x71')](_0xea6f3[_0x5977('0x43')][_0x5977('0x6e')]);}})[_0x5977('0x1f')](respondWithStatusCode(_0x2b72be,null))[_0x5977('0x2a')](handleError(_0x2b72be,null));};exports[_0x5977('0x72')]=function(_0x2b9d8c,_0x3099c7,_0x47df3a){var _0x3b4660={'body':_0x2b9d8c[_0x5977('0x5e')],'channel':'openchannel'};var _0x5a46c8=[];var _0x4aba93=[];var _0x52da9d={};var _0x302780=![];return db[_0x5977('0x73')][_0x5977('0x68')]()[_0x5977('0x1f')](function(_0x38ff09){if(!_0x38ff09){throw new db[(_0x5977('0x74'))][(_0x5977('0x75'))](_0x5977('0x76'));}_0x5a46c8=_[_0x5977('0x77')](_['keys'](_0x38ff09),[_0x5977('0x78'),'updatedAt']);_0x4aba93=_[_0x5977('0x77')](_[_0x5977('0x44')](_0x38ff09),[_0x5977('0x78'),_0x5977('0x79'),_0x5977('0x7a'),_0x5977('0x7b')]);if(_0x2b9d8c['body']['id']){delete _0x2b9d8c[_0x5977('0x5e')]['id'];}if(_[_0x5977('0x7c')](_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x7d')])){throw new db[(_0x5977('0x74'))][(_0x5977('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2b9d8c['body']['body'])||_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x5e')]===''){throw new db[(_0x5977('0x74'))][(_0x5977('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5977('0x7c')](_0x2b9d8c[_0x5977('0x5e')]['mapKey'])){throw new db[(_0x5977('0x74'))][(_0x5977('0x75'))](_0x5977('0x7e')+_0x4aba93);}if(!_[_0x5977('0x7f')](_0x4aba93,_0x2b9d8c[_0x5977('0x5e')]['mapKey'])){throw new db[(_0x5977('0x74'))]['ValidationError'](_0x5977('0x80')+_0x4aba93);}_0x52da9d[_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x81')]]=_0x2b9d8c['body'][_0x5977('0x7d')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x2b9d8c[_0x5977('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x5977('0x82'),'include':[{'model':db['CmContact'],'as':_0x5977('0x83'),'where':_0x52da9d,'limit':0x1,'order':[['updatedAt',_0x5977('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':_0x5977('0x85')}]});})[_0x5977('0x1f')](handleEntityNotFound(_0x3099c7,null))[_0x5977('0x1f')](function(_0x2b8289){if(_0x2b8289&&_0x2b8289[_0x5977('0x82')]){_0x3b4660[_0x5977('0x86')]=_0x2b8289;_0x3b4660[_0x5977('0x87')]=_0x2b8289[_0x5977('0x85')];_0x3b4660[_0x5977('0x88')]=_0x2b8289[_0x5977('0x82')];_0x3b4660[_0x5977('0x87')]=_[_0x5977('0x89')](_0x3b4660[_0x5977('0x87')],[_0x5977('0x8a')],[_0x5977('0x8b')]);if(_0x3b4660[_0x5977('0x86')][_0x5977('0x85')]){delete _0x3b4660[_0x5977('0x86')][_0x5977('0x85')];}if(_0x3b4660[_0x5977('0x86')][_0x5977('0x82')]&&_0x3b4660['account'][_0x5977('0x82')]['Contacts'][_0x5977('0x5b')]){return _0x3b4660['account']['List'][_0x5977('0x83')][0x0];}var _0x51032e=_[_0x5977('0x19')](_0x2b9d8c['body'],{'firstName':_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x7d')],'ListId':_0x2b8289[_0x5977('0x7b')]});_0x51032e[_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x81')]]=_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x7d')];return db['CmContact'][_0x5977('0x5d')](_0x51032e,{'fields':_0x5a46c8,'raw':!![]});}})['then'](handleEntityNotFound(_0x3099c7,null))[_0x5977('0x1f')](function(_0x4d1414){_0x3b4660[_0x5977('0x8c')]=_0x4d1414;if(_0x4d1414){var _0x4157de={'ContactId':_0x4d1414['id'],'OpenchannelAccountId':_0x2b9d8c[_0x5977('0x59')]['id'],'from':(_0x4d1414[_0x5977('0x8d')]||'')+'\x20'+(_0x4d1414[_0x5977('0x8e')]||'')};var _0x47957c={'OpenchannelAccountId':_0x2b9d8c[_0x5977('0x59')]['id'],'closed':![]};if(_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x8f')]){_0x47957c['threadId']=_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x8f')];return db[_0x5977('0x90')]['find']({'where':_0x47957c})[_0x5977('0x1f')](function(_0x2a5d8e){if(_0x2a5d8e){return[_0x2a5d8e,![]];}_0x4157de['threadId']=_0x2b9d8c['body'][_0x5977('0x8f')];_0x4157de[_0x5977('0x91')]=_0x2b9d8c[_0x5977('0x5e')]['externalUrl'];return db[_0x5977('0x90')][_0x5977('0x5d')](_0x4157de)['then'](function(_0xa181da){return[_0xa181da,!![]];});});}else{_0x47957c[_0x5977('0x8f')]=null;}_0x47957c[_0x5977('0x92')]=_0x4d1414['id'];return db[_0x5977('0x90')][_0x5977('0x5c')]({'where':_0x47957c})[_0x5977('0x1f')](function(_0x4a04db){if(_0x4a04db){return[_0x4a04db,![]];}return db[_0x5977('0x90')]['create'](_0x4157de)[_0x5977('0x1f')](function(_0x4529e3){return[_0x4529e3,!![]];});});}})[_0x5977('0x93')](function(_0x1e1bac,_0x5c3952){if(_0x1e1bac){_0x302780=_0x5c3952;if(!_0x5c3952){var _0x385698={'from':(_0x3b4660['contact'][_0x5977('0x8d')]||'')+'\x20'+(_0x3b4660[_0x5977('0x8c')][_0x5977('0x8e')]||'')};if(_0x2b9d8c['body']['threadId']&&_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x94')]&&_0x2b9d8c['body'][_0x5977('0x8f')]!=_0x2b9d8c[_0x5977('0x5e')]['messageId']){_0x385698[_0x5977('0x8f')]=_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x94')];}return _0x1e1bac[_0x5977('0x67')](_0x385698);}else{return _0x1e1bac;}}})['then'](function(_0x616315){_0x3b4660[_0x5977('0x95')]=_0x616315[_0x5977('0x60')]({'plain':!![]});_0x3b4660[_0x5977('0x95')][_0x5977('0x96')]=_0x302780;if(_0x3b4660[_0x5977('0x95')][_0x5977('0x96')]){if(_0x3b4660[_0x5977('0x86')]['autoclose']){_0x3b4660[_0x5977('0x87')][_0x5977('0x97')]({'id':0x0,'priority':_0x3b4660[_0x5977('0x87')][_0x5977('0x5b')]+0x1,'app':_0x5977('0x98'),'appdata':_0x5977('0x99'),'interval':_0x5977('0x9a')});}}return db['OpenchannelMessage'][_0x5977('0x5d')]({'body':_0x2b9d8c[_0x5977('0x5e')][_0x5977('0x5e')],'OpenchannelAccountId':_0x2b9d8c[_0x5977('0x59')]['id'],'OpenchannelInteractionId':_0x616315['id'],'direction':'in','ContactId':_0x3b4660[_0x5977('0x8c')]['id'],'AttachmentId':_0x2b9d8c[_0x5977('0x5e')]['AttachmentId']});})[_0x5977('0x1f')](function(_0x399bc6){_0x3b4660[_0x5977('0x28')]=_0x399bc6;if(_0x3b4660[_0x5977('0x95')]['UserId']){return db[_0x5977('0x9b')]['find']({'attributes':['id',_0x5977('0x38')],'where':{'id':_0x3b4660[_0x5977('0x95')][_0x5977('0x9c')]}})[_0x5977('0x1f')](function(_0x4cdc51){if(_0x4cdc51){_0x3b4660[_0x5977('0x87')][_0x5977('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4cdc51[_0x5977('0x38')]+','+(_0x3b4660[_0x5977('0x86')][_0x5977('0x9e')]||0xa),'interval':_0x5977('0x9a')});_0x3b4660[_0x5977('0x9f')]=![];}return respondWithRpcPromise(_0x5977('0xa0'),_0x5977('0xa1'),_0x3b4660);});}return respondWithRpcPromise(_0x5977('0xa0'),_0x5977('0xa1'),_0x3b4660);})[_0x5977('0x1f')](function(_0x5d7c6c){respondWithRpcPromise(_0x5977('0xa2'),'EventManager',{'event':_0x5977('0x72'),'message':_0x5d7c6c},client9002);return _0x5d7c6c;})[_0x5977('0x1f')](respondWithResult(_0x3099c7,null))[_0x5977('0x2a')](handleError(_0x3099c7,null));};exports[_0x5977('0xa3')]=function(_0x204ded,_0x5870a7,_0x4615f0){return db['OpenchannelAccount'][_0x5977('0x6c')]({'where':{'id':_0x204ded[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x5870a7,null))['then'](function(_0x18b42c){if(_0x18b42c){return db[_0x5977('0xa4')][_0x5977('0xa5')](function(_0x3727be){return db[_0x5977('0xa6')][_0x5977('0x36')]({'where':{'OpenchannelAccountId':_0x204ded['params']['id']},'transaction':_0x3727be})[_0x5977('0x1f')](function(_0x16cd84){var _0x79bb8a=_[_0x5977('0x3c')](_0x204ded[_0x5977('0x5e')],function(_0x12fe3c){_0x12fe3c['OpenchannelAccountId']=_0x204ded['params']['id'];return _0x12fe3c;});return db[_0x5977('0xa6')][_0x5977('0xa7')](_0x79bb8a,{'transaction':_0x3727be});});})[_0x5977('0x1f')](function(){return db[_0x5977('0xa6')][_0x5977('0xa8')]({'where':{'OpenchannelAccountId':_0x204ded[_0x5977('0x59')]['id']},'order':_0x5977('0x8a')});});}})[_0x5977('0x1f')](respondWithResult(_0x5870a7,null))[_0x5977('0x2a')](handleError(_0x5870a7,null));};exports['getApplications']=function(_0x4b32c7,_0x2b913c,_0x36f066){var _0x50f674={};var _0x1a2ab2={};var _0x378331;var _0x30cae4;return db[_0x5977('0x3d')][_0x5977('0x6c')]({'where':{'id':_0x4b32c7[_0x5977('0x59')]['id']}})['then'](handleEntityNotFound(_0x2b913c,null))[_0x5977('0x1f')](function(_0xc30b3c){if(_0xc30b3c){_0x378331=_0xc30b3c;_0x1a2ab2['model']=_['keys'](db[_0x5977('0xa6')][_0x5977('0x3e')]);_0x1a2ab2['query']=_[_0x5977('0x44')](_0x4b32c7[_0x5977('0x43')]);_0x1a2ab2['filters']=_[_0x5977('0x46')](_0x1a2ab2[_0x5977('0x42')],_0x1a2ab2[_0x5977('0x43')]);_0x50f674[_0x5977('0x48')]=_[_0x5977('0x46')](_0x1a2ab2[_0x5977('0x42')],qs[_0x5977('0x47')](_0x4b32c7[_0x5977('0x43')][_0x5977('0x47')]));_0x50f674['attributes']=_0x50f674[_0x5977('0x48')]['length']?_0x50f674[_0x5977('0x48')]:_0x1a2ab2[_0x5977('0x42')];_0x50f674[_0x5977('0x4c')]=qs[_0x5977('0x4d')](_0x4b32c7['query'][_0x5977('0x4d')]);_0x50f674['where']=qs['filters'](_[_0x5977('0x4e')](_0x4b32c7[_0x5977('0x43')],_0x1a2ab2[_0x5977('0x45')]));if(_0x4b32c7['query']['filter']){_0x50f674[_0x5977('0x50')]=_[_0x5977('0x51')](_0x50f674[_0x5977('0x50')],{'$or':_[_0x5977('0x3c')](_0x50f674[_0x5977('0x48')],function(_0x5e3a6a){var _0x1a6cde={};_0x1a6cde[_0x5e3a6a]={'$like':'%'+_0x4b32c7[_0x5977('0x43')]['filter']+'%'};return _0x1a6cde;})});}_0x50f674=_[_0x5977('0x51')]({},_0x50f674,_0x4b32c7[_0x5977('0x53')]);return _0x378331[_0x5977('0xa9')](_0x50f674);}})['then'](function(_0x169d72){if(_0x169d72){_0x30cae4=_0x169d72['length'];if(!_0x4b32c7[_0x5977('0x43')][_0x5977('0x49')](_0x5977('0x4a'))){_0x50f674['limit']=qs[_0x5977('0x4b')](_0x4b32c7[_0x5977('0x43')][_0x5977('0x4b')]);_0x50f674['offset']=qs[_0x5977('0x2f')](_0x4b32c7[_0x5977('0x43')][_0x5977('0x2f')]);}return _0x378331[_0x5977('0xa9')](_0x50f674);}})[_0x5977('0x1f')](function(_0x2febb0){if(_0x2febb0){return _0x2febb0?{'count':_0x30cae4,'rows':_0x2febb0}:null;}})[_0x5977('0x1f')](respondWithResult(_0x2b913c,null))[_0x5977('0x2a')](handleError(_0x2b913c,null));};exports[_0x5977('0xaa')]=function(_0x31549d,_0x13e6fe,_0x4b1330){var _0x527362={'raw':![],'where':{}};var _0x4dd194={};var _0x44756a={'count':0x0,'rows':[]};return db[_0x5977('0x3d')][_0x5977('0x6c')]({'where':{'id':_0x31549d['params']['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x13e6fe,null))[_0x5977('0x1f')](function(_0xd82ba4){if(_0xd82ba4){_0x4dd194[_0x5977('0x42')]=_[_0x5977('0x44')](db['OpenchannelInteraction'][_0x5977('0x3e')]);_0x4dd194[_0x5977('0x43')]=_[_0x5977('0x44')](_0x31549d['query']);_0x4dd194[_0x5977('0x45')]=_[_0x5977('0x46')](_0x4dd194[_0x5977('0x42')],_0x4dd194['query']);_0x527362[_0x5977('0x48')]=_[_0x5977('0x46')](_0x4dd194[_0x5977('0x42')],qs['fields'](_0x31549d[_0x5977('0x43')][_0x5977('0x47')]));_0x527362['attributes']=_0x527362[_0x5977('0x48')][_0x5977('0x5b')]?_0x527362[_0x5977('0x48')]:_0x4dd194['model'];if(!_0x31549d['query']['hasOwnProperty'](_0x5977('0x4a'))){_0x527362[_0x5977('0x4b')]=qs['limit'](_0x31549d['query'][_0x5977('0x4b')]);_0x527362['offset']=qs[_0x5977('0x2f')](_0x31549d['query'][_0x5977('0x2f')]);}_0x527362[_0x5977('0x4c')]=qs[_0x5977('0x4d')](_0x31549d[_0x5977('0x43')][_0x5977('0x4d')]);_0x527362[_0x5977('0x50')]=qs[_0x5977('0x45')](_[_0x5977('0x4e')](_0x31549d[_0x5977('0x43')],_0x4dd194[_0x5977('0x45')]));_0x527362[_0x5977('0x50')][_0x5977('0x69')]=_0xd82ba4['id'];if(_0x31549d['query'][_0x5977('0x4f')]){_0x527362[_0x5977('0x50')]=_[_0x5977('0x51')](_0x527362[_0x5977('0x50')],{'$or':_['map'](_0x527362[_0x5977('0x48')],function(_0x332cdc){var _0x566e49={};_0x566e49[_0x332cdc]={'$like':'%'+_0x31549d['query'][_0x5977('0x4f')]+'%'};return _0x566e49;})});}_0x527362=_[_0x5977('0x51')]({},_0x527362,_0x31549d[_0x5977('0x53')]);return db[_0x5977('0x90')]['count']({'where':_0x527362[_0x5977('0x50')]})[_0x5977('0x1f')](function(_0x3f354f){_0x44756a['count']=_0x3f354f;if(_0x31549d[_0x5977('0x43')]['includeAll']){_0x527362[_0x5977('0x55')]=[{'model':db[_0x5977('0x73')],'as':_0x5977('0xab'),'required':![]},{'model':db[_0x5977('0x9b')],'as':_0x5977('0xac'),'attributes':['name',_0x5977('0xad'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x5977('0xae'),'attributes':['id',_0x5977('0x38'),_0x5977('0xaf')],'where':_0x31549d['query'][_0x5977('0xb0')]?{'id':_0x31549d[_0x5977('0x43')][_0x5977('0xb0')]}:undefined,'required':_0x31549d[_0x5977('0x43')][_0x5977('0xb0')]?!![]:![]}];}return db[_0x5977('0x90')][_0x5977('0x56')](_0x527362);})[_0x5977('0x1f')](function(_0x1a475b){_0x44756a[_0x5977('0x57')]=_0x1a475b;return _0x44756a;});}})['then'](respondWithFilteredResult(_0x13e6fe,_0x527362))[_0x5977('0x2a')](handleError(_0x13e6fe,null));};exports[_0x5977('0xb1')]=function(_0xeeee73,_0x3042cd,_0x5c5880){return db[_0x5977('0x3d')][_0x5977('0x5c')]({'where':{'id':_0xeeee73[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x3042cd,null))[_0x5977('0x1f')](function(_0x16a37f){if(_0x16a37f){return _0x16a37f[_0x5977('0xb1')](_0xeeee73[_0x5977('0x5e')]['ids'],_[_0x5977('0xb2')](_0xeeee73['body'],[_0x5977('0x6e'),'id'])||{})[_0x5977('0x93')](function(_0x185ade){for(var _0x1a8799=0x0;_0x1a8799<_0xeeee73[_0x5977('0x5e')][_0x5977('0x6e')][_0x5977('0x5b')];_0x1a8799+=0x1){socket[_0x5977('0xb3')]('userOpenchannelAccount:save',{'UserId':_0xeeee73[_0x5977('0x5e')][_0x5977('0x6e')][_0x1a8799],'OpenchannelAccountId':_0xeeee73['params']['id']});}return _0x185ade;});}})[_0x5977('0x1f')](respondWithResult(_0x3042cd,null))['catch'](handleError(_0x3042cd,null));};exports[_0x5977('0xb4')]=function(_0x2f7e60,_0x36ed5d,_0x26970f){return db[_0x5977('0x3d')][_0x5977('0x5c')]({'where':{'id':_0x2f7e60[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x36ed5d,null))['then'](function(_0x226306){if(_0x226306){return _0x226306[_0x5977('0xb4')](_0x2f7e60['query'][_0x5977('0x6e')])[_0x5977('0x1f')](function(){if(_[_0x5977('0xb5')](_0x2f7e60[_0x5977('0x43')][_0x5977('0x6e')])){for(var _0x5b4d13=0x0;_0x5b4d13<_0x2f7e60[_0x5977('0x43')][_0x5977('0x6e')][_0x5977('0x5b')];_0x5b4d13+=0x1){socket[_0x5977('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2f7e60[_0x5977('0x43')][_0x5977('0x6e')][_0x5b4d13]),'OpenchannelAccountId':Number(_0x2f7e60[_0x5977('0x59')]['id'])});}}else{socket[_0x5977('0xb3')](_0x5977('0xb6'),{'UserId':Number(_0x2f7e60[_0x5977('0x43')][_0x5977('0x6e')]),'OpenchannelAccountId':Number(_0x2f7e60[_0x5977('0x59')]['id'])});}});}})[_0x5977('0x1f')](respondWithStatusCode(_0x36ed5d,null))['catch'](handleError(_0x36ed5d,null));};exports['getAgents']=function(_0x21c53f,_0x3d4627,_0x539caf){var _0x4371ff={};var _0x4ce3e9={};var _0x1202bf;var _0x4bee25;return db[_0x5977('0x3d')][_0x5977('0x6c')]({'where':{'id':_0x21c53f[_0x5977('0x59')]['id']}})['then'](handleEntityNotFound(_0x3d4627,null))[_0x5977('0x1f')](function(_0x45a8db){if(_0x45a8db){_0x1202bf=_0x45a8db;_0x4ce3e9[_0x5977('0x42')]=_[_0x5977('0x44')](db[_0x5977('0x9b')][_0x5977('0x3e')]);_0x4ce3e9[_0x5977('0x43')]=_[_0x5977('0x44')](_0x21c53f[_0x5977('0x43')]);_0x4ce3e9[_0x5977('0x45')]=_[_0x5977('0x46')](_0x4ce3e9[_0x5977('0x42')],_0x4ce3e9[_0x5977('0x43')]);_0x4371ff[_0x5977('0x48')]=_['intersection'](_0x4ce3e9[_0x5977('0x42')],qs[_0x5977('0x47')](_0x21c53f['query'][_0x5977('0x47')]));_0x4371ff['attributes']=_0x4371ff[_0x5977('0x48')][_0x5977('0x5b')]?_0x4371ff[_0x5977('0x48')]:_0x4ce3e9[_0x5977('0x42')];_0x4371ff[_0x5977('0x4c')]=qs[_0x5977('0x4d')](_0x21c53f[_0x5977('0x43')][_0x5977('0x4d')]);_0x4371ff[_0x5977('0x50')]=qs['filters'](_[_0x5977('0x4e')](_0x21c53f[_0x5977('0x43')],_0x4ce3e9[_0x5977('0x45')]));if(_0x21c53f['query']['filter']){_0x4371ff[_0x5977('0x50')]=_[_0x5977('0x51')](_0x4371ff['where'],{'$or':_['map'](_0x4371ff[_0x5977('0x48')],function(_0x45b64c){var _0x1a5fb8={};_0x1a5fb8[_0x45b64c]={'$like':'%'+_0x21c53f[_0x5977('0x43')][_0x5977('0x4f')]+'%'};return _0x1a5fb8;})});}_0x4371ff=_[_0x5977('0x51')]({},_0x4371ff,_0x21c53f[_0x5977('0x53')]);return _0x1202bf[_0x5977('0xb7')](_0x4371ff);}})['then'](function(_0x3f6fe8){if(_0x3f6fe8){_0x4bee25=_0x3f6fe8[_0x5977('0x5b')];if(!_0x21c53f['query'][_0x5977('0x49')](_0x5977('0x4a'))){_0x4371ff[_0x5977('0x4b')]=qs['limit'](_0x21c53f[_0x5977('0x43')][_0x5977('0x4b')]);_0x4371ff[_0x5977('0x2f')]=qs[_0x5977('0x2f')](_0x21c53f[_0x5977('0x43')][_0x5977('0x2f')]);}return _0x1202bf[_0x5977('0xb7')](_0x4371ff);}})[_0x5977('0x1f')](function(_0x57acec){if(_0x57acec){return _0x57acec?{'count':_0x4bee25,'rows':_0x57acec}:null;}})[_0x5977('0x1f')](respondWithResult(_0x3d4627,null))['catch'](handleError(_0x3d4627,null));};exports[_0x5977('0x39')]=function(_0x382b52,_0x15f9e6,_0x3cac98){var _0x126c2b,_0x9a0448,_0x1d8bf2;if(_[_0x5977('0x7c')](_0x382b52['body'][_0x5977('0x5e')])||_0x382b52[_0x5977('0x5e')][_0x5977('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x5977('0xb8'));}if(_[_0x5977('0x7c')](_0x382b52['body']['to'])){}_0x126c2b=_0x382b52[_0x5977('0x5e')]['to'];return db[_0x5977('0x3d')][_0x5977('0x6c')]({'where':{'id':_0x382b52[_0x5977('0x59')]['id']}})[_0x5977('0x1f')](handleEntityNotFound(_0x15f9e6,null))[_0x5977('0x1f')](function(_0x511639){if(_0x511639){return db['OpenchannelAccount'][_0x5977('0x5c')]({'where':{'id':_0x511639['id']},'include':[{'model':db[_0x5977('0xb9')],'as':'List','include':[{'model':db[_0x5977('0x73')],'as':_0x5977('0x83'),'where':{[_0x511639['mapKey']]:_0x126c2b},'limit':0x1,'order':[[_0x5977('0x79'),_0x5977('0x84')]]}]}]})[_0x5977('0x1f')](handleEntityNotFound(_0x15f9e6,null))[_0x5977('0x1f')](function(_0x3b2381){if(_0x3b2381&&_0x3b2381[_0x5977('0x82')]){_0x9a0448=_0x3b2381[_0x5977('0x60')]({'plain':!![]});if(_0x9a0448['List']&&_0x9a0448[_0x5977('0x82')][_0x5977('0x83')][_0x5977('0x5b')]){return _0x9a0448[_0x5977('0x82')][_0x5977('0x83')][0x0];}return db[_0x5977('0x73')][_0x5977('0x5d')](_[_0x5977('0x19')](_0x382b52['body'],{'firstName':_0x126c2b,[_0x3b2381[_0x5977('0x81')]]:_0x126c2b,'phone':_0x126c2b,'ListId':_0x9a0448[_0x5977('0x7b')]}));}})['then'](handleEntityNotFound(_0x15f9e6,null))[_0x5977('0x1f')](function(_0x4270fb){if(_0x4270fb){_0x1d8bf2=_0x4270fb;return db[_0x5977('0x90')][_0x5977('0x5c')]({'where':{'ContactId':_0x1d8bf2['id'],'closed':![],'OpenchannelAccountId':_0x9a0448['id']}})[_0x5977('0x1f')](function(_0x1da2ba){if(_0x1da2ba){return[_0x1da2ba,![]];}return db[_0x5977('0x90')][_0x5977('0x5d')]({'UserId':_0x382b52[_0x5977('0x5f')]['id'],'ContactId':_0x1d8bf2['id'],'OpenchannelAccountId':_0x9a0448['id'],'lastMsgDirection':_0x5977('0xba'),'Messages':[_['merge'](_0x382b52[_0x5977('0x5e')],{'read':![],'body':_0x382b52['body'][_0x5977('0x5e')],'OpenchannelAccountId':_0x9a0448['id'],'UserId':_0x382b52[_0x5977('0x5f')]['id'],'ContactId':_0x1d8bf2['id']})]},{'include':[{'model':db[_0x5977('0xbb')],'as':'Messages'}]})['then'](function(_0xd751c2){return[_0xd751c2,!![]];});});}})[_0x5977('0x93')](function(_0x564243,_0x1dfb85){if(_0x1dfb85){return _0x564243;}return db[_0x5977('0xbb')][_0x5977('0x5d')](_[_0x5977('0x51')](_0x382b52['body'],{'read':![],'body':_0x382b52[_0x5977('0x5e')][_0x5977('0x5e')],'OpenchannelAccountId':_0x9a0448['id'],'OpenchannelInteractionId':_0x564243['id'],'UserId':_0x382b52[_0x5977('0x5f')]['id'],'ContactId':_0x1d8bf2['id']}))[_0x5977('0x1f')](function(_0x34e1cf){_0x564243[_0x5977('0xbc')]['Messages']=[];_0x564243[_0x5977('0xbc')][_0x5977('0xbd')][_0x5977('0x97')](_0x34e1cf[_0x5977('0xbc')]);return _0x564243;});});}})['then'](respondWithResult(_0x15f9e6,null))[_0x5977('0x2a')](handleError(_0x15f9e6,null));}; \ No newline at end of file +var _0x62f7=['index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','show','params','Pause','intersection','length','find','create','role','user','OpenchannelAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','rows','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','asc','firstName','lastName','threadId','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','nolimit','Owner','internal','Tags','color','tag','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','name','send'];(function(_0x1b473e,_0x757cc2){var _0x2f843c=function(_0xc48e1a){while(--_0xc48e1a){_0x1b473e['push'](_0x1b473e['shift']());}};_0x2f843c(++_0x757cc2);}(_0x62f7,0x1e9));var _0x762f=function(_0x192681,_0x26675f){_0x192681=_0x192681-0x0;var _0x58f886=_0x62f7[_0x192681];return _0x58f886;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x762f('0x0'));var rimraf=require(_0x762f('0x1'));var zipdir=require(_0x762f('0x2'));var jsonpatch=require(_0x762f('0x3'));var rp=require(_0x762f('0x4'));var moment=require(_0x762f('0x5'));var BPromise=require(_0x762f('0x6'));var Mustache=require(_0x762f('0x7'));var util=require('util');var path=require(_0x762f('0x8'));var sox=require('sox');var csv=require(_0x762f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x762f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x762f('0xb'));var deskjs=require(_0x762f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x762f('0xd'));var Redis=require(_0x762f('0xe'));var authService=require(_0x762f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x762f('0x10'));var hardwareService=require(_0x762f('0x11'));var logger=require(_0x762f('0x12'))(_0x762f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x762f('0x14'));var db=require('../../mysqldb')['db'];config[_0x762f('0x15')]=_[_0x762f('0x16')](config[_0x762f('0x15')],{'host':_0x762f('0x17'),'port':0x18eb});var socket=require(_0x762f('0x18'))(new Redis(config[_0x762f('0x15')]));require(_0x762f('0x19'))[_0x762f('0x1a')](socket);var jayson=require(_0x762f('0x1b'));var client=jayson[_0x762f('0x1c')][_0x762f('0x1d')]({'port':0x232c});var client9002=jayson[_0x762f('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2da1,_0x465e67,_0x2fbfe0,_0x27ef21){return new BPromise(function(_0x1d6271,_0x5ba871){var _0x14da3e=_0x27ef21||client;return _0x14da3e[_0x762f('0x1e')](_0x1e2da1,_0x2fbfe0)[_0x762f('0x1f')](function(_0x4a4f02){logger['info'](_0x762f('0x20'),_0x465e67,_0x762f('0x21'));logger[_0x762f('0x22')](_0x762f('0x23'),_0x465e67,'request\x20sent',JSON[_0x762f('0x24')](_0x4a4f02));if(_0x4a4f02[_0x762f('0x25')]){if(_0x4a4f02[_0x762f('0x25')][_0x762f('0x26')]===0x1f4){logger['error'](_0x762f('0x20'),_0x465e67,_0x4a4f02[_0x762f('0x25')][_0x762f('0x27')]);return _0x5ba871(_0x4a4f02['error'][_0x762f('0x27')]);}logger[_0x762f('0x25')](_0x762f('0x20'),_0x465e67,_0x4a4f02['error']['message']);return _0x1d6271(_0x4a4f02['error'][_0x762f('0x27')]);}else{logger[_0x762f('0x28')](_0x762f('0x20'),_0x465e67,_0x762f('0x21'));_0x1d6271(_0x4a4f02[_0x762f('0x29')]['message']);}})[_0x762f('0x2a')](function(_0x5a0e5d){logger[_0x762f('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x465e67,_0x5a0e5d);_0x5ba871(_0x5a0e5d);});});}function respondWithStatusCode(_0x292895,_0x2f4bcd){_0x2f4bcd=_0x2f4bcd||0xcc;return function(_0x27308e){if(_0x27308e){return _0x292895[_0x762f('0x2b')](_0x2f4bcd);}return _0x292895[_0x762f('0x2c')](_0x2f4bcd)['end']();};}function respondWithResult(_0x342756,_0x3f4433){_0x3f4433=_0x3f4433||0xc8;return function(_0x16cc1a){if(_0x16cc1a){return _0x342756[_0x762f('0x2c')](_0x3f4433)[_0x762f('0x2d')](_0x16cc1a);}};}function respondWithFilteredResult(_0x229c7b,_0x688f7c){return function(_0x448434){if(_0x448434){var _0x237fa8=_0x448434['count'],_0x4b93f2=_0x688f7c['offset'],_0x5dd875=_0x688f7c[_0x762f('0x2e')]+_0x688f7c[_0x762f('0x2f')],_0x485f38;if(_0x5dd875>=_0x237fa8){_0x5dd875=_0x237fa8;_0x485f38=0xc8;}else{_0x485f38=0xce;}_0x229c7b['status'](_0x485f38);return _0x229c7b[_0x762f('0x30')](_0x762f('0x31'),_0x4b93f2+'-'+_0x5dd875+'/'+_0x237fa8)[_0x762f('0x2d')](_0x448434);}return null;};}function patchUpdates(_0x124f74){return function(_0x116f2e){try{jsonpatch[_0x762f('0x32')](_0x116f2e,_0x124f74,!![]);}catch(_0x57bbb0){return BPromise[_0x762f('0x33')](_0x57bbb0);}return _0x116f2e[_0x762f('0x34')]();};}function saveUpdates(_0x3de135,_0x26a35c){return function(_0x79babb){if(_0x79babb){return _0x79babb[_0x762f('0x35')](_0x3de135)[_0x762f('0x1f')](function(_0x3d4280){return _0x3d4280;});}return null;};}function removeEntity(_0xcb9375,_0x443626){return function(_0x775f75){if(_0x775f75){return _0x775f75[_0x762f('0x36')]()[_0x762f('0x1f')](function(){var _0x12d730=_0x775f75[_0x762f('0x37')]({'plain':!![]});var _0x3d713a='OpenchannelAccounts';return db[_0x762f('0x38')][_0x762f('0x36')]({'where':{'type':_0x3d713a,'resourceId':_0x12d730['id']}})['then'](function(){return _0x775f75;});})['then'](function(){_0xcb9375[_0x762f('0x2c')](0xcc)[_0x762f('0x39')]();});}};}function handleEntityNotFound(_0x31e53c,_0x49460c){return function(_0xe2096e){if(!_0xe2096e){_0x31e53c['sendStatus'](0x194);}return _0xe2096e;};}function handleError(_0x4114b3,_0x4afe08){_0x4afe08=_0x4afe08||0x1f4;return function(_0x1597df){logger[_0x762f('0x25')](_0x1597df['stack']);if(_0x1597df[_0x762f('0x3a')]){delete _0x1597df[_0x762f('0x3a')];}_0x4114b3[_0x762f('0x2c')](_0x4afe08)[_0x762f('0x3b')](_0x1597df);};}exports[_0x762f('0x3c')]=function(_0x32d2b2,_0x142808){var _0x44117f={'include':[{'model':db['Pause'],'as':_0x762f('0x3d')}]},_0x2c2ba9={},_0x45309a={'count':0x0,'rows':[]};var _0x4fd503=_[_0x762f('0x3e')](db[_0x762f('0x3f')][_0x762f('0x40')],function(_0x3238b0){return{'name':_0x3238b0[_0x762f('0x41')],'type':_0x3238b0[_0x762f('0x42')][_0x762f('0x43')]};});_0x2c2ba9[_0x762f('0x44')]=_[_0x762f('0x3e')](_0x4fd503,_0x762f('0x3a'));_0x2c2ba9['query']=_[_0x762f('0x45')](_0x32d2b2['query']);_0x2c2ba9[_0x762f('0x46')]=_['intersection'](_0x2c2ba9['model'],_0x2c2ba9[_0x762f('0x47')]);_0x44117f[_0x762f('0x48')]=_['intersection'](_0x2c2ba9[_0x762f('0x44')],qs[_0x762f('0x49')](_0x32d2b2[_0x762f('0x47')][_0x762f('0x49')]));_0x44117f[_0x762f('0x48')]=_0x44117f[_0x762f('0x48')]['length']?_0x44117f[_0x762f('0x48')]:_0x2c2ba9[_0x762f('0x44')];if(!_0x32d2b2[_0x762f('0x47')][_0x762f('0x4a')]('nolimit')){_0x44117f[_0x762f('0x2f')]=qs[_0x762f('0x2f')](_0x32d2b2['query'][_0x762f('0x2f')]);_0x44117f[_0x762f('0x2e')]=qs[_0x762f('0x2e')](_0x32d2b2[_0x762f('0x47')]['offset']);}_0x44117f[_0x762f('0x4b')]=qs[_0x762f('0x4c')](_0x32d2b2[_0x762f('0x47')][_0x762f('0x4c')]);_0x44117f['where']=qs['filters'](_[_0x762f('0x4d')](_0x32d2b2[_0x762f('0x47')],_0x2c2ba9[_0x762f('0x46')]),_0x4fd503);if(_0x32d2b2[_0x762f('0x47')][_0x762f('0x4e')]){_0x44117f[_0x762f('0x4f')]=_[_0x762f('0x50')](_0x44117f[_0x762f('0x4f')],{'$or':_[_0x762f('0x3e')](_0x4fd503,function(_0x304c34){if(_0x304c34[_0x762f('0x42')]!=='VIRTUAL'){var _0x30b616={};_0x30b616[_0x304c34[_0x762f('0x3a')]]={'$like':'%'+_0x32d2b2[_0x762f('0x47')][_0x762f('0x4e')]+'%'};return _0x30b616;}})});}_0x44117f=_['merge']({},_0x44117f,_0x32d2b2[_0x762f('0x51')]);var _0x432cb4={'where':_0x44117f[_0x762f('0x4f')]};return db[_0x762f('0x3f')]['count'](_0x432cb4)[_0x762f('0x1f')](function(_0xcf3dfd){_0x45309a[_0x762f('0x52')]=_0xcf3dfd;if(_0x32d2b2[_0x762f('0x47')][_0x762f('0x53')]){_0x44117f[_0x762f('0x54')]=[{'all':!![]}];}return db[_0x762f('0x3f')][_0x762f('0x55')](_0x44117f);})[_0x762f('0x1f')](function(_0x2298ed){_0x45309a['rows']=_0x2298ed;return _0x45309a;})['then'](respondWithFilteredResult(_0x142808,_0x44117f))['catch'](handleError(_0x142808,null));};exports[_0x762f('0x56')]=function(_0x2b7750,_0x3b24cd){var _0x344f83={'raw':![],'where':{'id':_0x2b7750[_0x762f('0x57')]['id']},'include':[{'model':db[_0x762f('0x58')],'as':'mandatoryDispositionPause'}]},_0x5a847f={};_0x5a847f[_0x762f('0x44')]=_[_0x762f('0x45')](db[_0x762f('0x3f')][_0x762f('0x40')]);_0x5a847f['query']=_[_0x762f('0x45')](_0x2b7750['query']);_0x5a847f[_0x762f('0x46')]=_[_0x762f('0x59')](_0x5a847f[_0x762f('0x44')],_0x5a847f[_0x762f('0x47')]);_0x344f83[_0x762f('0x48')]=_[_0x762f('0x59')](_0x5a847f[_0x762f('0x44')],qs['fields'](_0x2b7750[_0x762f('0x47')][_0x762f('0x49')]));_0x344f83[_0x762f('0x48')]=_0x344f83['attributes'][_0x762f('0x5a')]?_0x344f83[_0x762f('0x48')]:_0x5a847f[_0x762f('0x44')];if(_0x2b7750[_0x762f('0x47')]['includeAll']){_0x344f83['include']=[{'all':!![]}];}_0x344f83=_['merge']({},_0x344f83,_0x2b7750[_0x762f('0x51')]);return db['OpenchannelAccount'][_0x762f('0x5b')](_0x344f83)[_0x762f('0x1f')](handleEntityNotFound(_0x3b24cd,null))[_0x762f('0x1f')](respondWithResult(_0x3b24cd,null))[_0x762f('0x2a')](handleError(_0x3b24cd,null));};exports['create']=function(_0x2d4289,_0x2df3f2){return db['OpenchannelAccount'][_0x762f('0x5c')](_0x2d4289['body'],{})[_0x762f('0x1f')](function(_0x1ad5ca){var _0x28dc12=_0x2d4289['user'][_0x762f('0x37')]({'plain':!![]});if(!_0x28dc12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28dc12[_0x762f('0x5d')]===_0x762f('0x5e')){var _0xc207c8=_0x1ad5ca['get']({'plain':!![]});var _0x359fc9=_0x762f('0x5f');return db['UserProfileSection'][_0x762f('0x5b')]({'where':{'name':_0x359fc9,'userProfileId':_0x28dc12[_0x762f('0x60')]},'raw':!![]})[_0x762f('0x1f')](function(_0x59e6b0){if(_0x59e6b0&&_0x59e6b0[_0x762f('0x61')]===0x0){return db['UserProfileResource'][_0x762f('0x5c')]({'name':_0xc207c8['name'],'resourceId':_0xc207c8['id'],'type':_0x59e6b0[_0x762f('0x3a')],'sectionId':_0x59e6b0['id']},{})[_0x762f('0x1f')](function(){return _0x1ad5ca;});}else{return _0x1ad5ca;}})['catch'](function(_0x486759){logger[_0x762f('0x25')](_0x762f('0x62'),_0x486759);throw _0x486759;});}return _0x1ad5ca;})[_0x762f('0x1f')](respondWithResult(_0x2df3f2,0xc9))[_0x762f('0x2a')](handleError(_0x2df3f2,null));};exports[_0x762f('0x35')]=function(_0x5d13b9,_0x5b7a39){if(_0x5d13b9[_0x762f('0x63')]['id']){delete _0x5d13b9[_0x762f('0x63')]['id'];}return db[_0x762f('0x3f')][_0x762f('0x5b')]({'where':{'id':_0x5d13b9['params']['id']},'include':[{'model':db[_0x762f('0x58')],'as':_0x762f('0x3d')}]})['then'](handleEntityNotFound(_0x5b7a39,null))[_0x762f('0x1f')](saveUpdates(_0x5d13b9[_0x762f('0x63')],null))[_0x762f('0x1f')](respondWithResult(_0x5b7a39,null))[_0x762f('0x2a')](handleError(_0x5b7a39,null));};exports['destroy']=function(_0x1a8759,_0x472592){return db[_0x762f('0x3f')][_0x762f('0x5b')]({'where':{'id':_0x1a8759[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x472592,null))[_0x762f('0x1f')](removeEntity(_0x472592,null))[_0x762f('0x2a')](handleError(_0x472592,null));};exports[_0x762f('0x64')]=function(_0x16f8ec,_0x139898){return db[_0x762f('0x3f')][_0x762f('0x64')]()['then'](respondWithResult(_0x139898,null))[_0x762f('0x2a')](handleError(_0x139898,null));};exports['addDisposition']=function(_0x52ef7d,_0x2a560f,_0x429010){if(_0x52ef7d[_0x762f('0x63')]['id']){delete _0x52ef7d['body']['id'];}return db['OpenchannelAccount'][_0x762f('0x5b')]({'where':{'id':_0x52ef7d[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x2a560f,null))[_0x762f('0x1f')](function(_0x351446){if(_0x351446){_0x52ef7d[_0x762f('0x63')]['OpenchannelAccountId']=_0x351446['id'];return db[_0x762f('0x65')]['create'](_0x52ef7d[_0x762f('0x63')]);}})[_0x762f('0x1f')](respondWithResult(_0x2a560f,null))['catch'](handleError(_0x2a560f,null));};exports[_0x762f('0x66')]=function(_0x109334,_0x324eaf,_0x467f2f){var _0x27f4a5={'raw':![],'where':{}};var _0xd9fd1d={};var _0x49849c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x762f('0x67')]({'where':{'id':_0x109334[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x324eaf,null))[_0x762f('0x1f')](function(_0x5c3a2d){if(_0x5c3a2d){_0xd9fd1d[_0x762f('0x44')]=_['keys'](db['Disposition'][_0x762f('0x40')]);_0xd9fd1d[_0x762f('0x47')]=_[_0x762f('0x45')](_0x109334[_0x762f('0x47')]);_0xd9fd1d[_0x762f('0x46')]=_[_0x762f('0x59')](_0xd9fd1d[_0x762f('0x44')],_0xd9fd1d['query']);_0x27f4a5[_0x762f('0x48')]=_[_0x762f('0x59')](_0xd9fd1d[_0x762f('0x44')],qs[_0x762f('0x49')](_0x109334['query'][_0x762f('0x49')]));_0x27f4a5[_0x762f('0x48')]=_0x27f4a5[_0x762f('0x48')]['length']?_0x27f4a5['attributes']:_0xd9fd1d[_0x762f('0x44')];if(!_0x109334[_0x762f('0x47')]['hasOwnProperty']('nolimit')){_0x27f4a5[_0x762f('0x2f')]=qs['limit'](_0x109334[_0x762f('0x47')]['limit']);_0x27f4a5['offset']=qs['offset'](_0x109334[_0x762f('0x47')]['offset']);}_0x27f4a5[_0x762f('0x4b')]=qs[_0x762f('0x4c')](_0x109334[_0x762f('0x47')][_0x762f('0x4c')]);_0x27f4a5[_0x762f('0x4f')]=qs[_0x762f('0x46')](_[_0x762f('0x4d')](_0x109334[_0x762f('0x47')],_0xd9fd1d[_0x762f('0x46')]));_0x27f4a5[_0x762f('0x4f')][_0x762f('0x68')]=_0x5c3a2d['id'];if(_0x109334[_0x762f('0x47')]['filter']){_0x27f4a5[_0x762f('0x4f')]=_[_0x762f('0x50')](_0x27f4a5[_0x762f('0x4f')],{'$or':_[_0x762f('0x3e')](_0x27f4a5[_0x762f('0x48')],function(_0x14cd81){var _0x29dacc={};_0x29dacc[_0x14cd81]={'$like':'%'+_0x109334[_0x762f('0x47')]['filter']+'%'};return _0x29dacc;})});}_0x27f4a5=_[_0x762f('0x50')]({},_0x27f4a5,_0x109334['options']);return db['Disposition']['count']({'where':_0x27f4a5[_0x762f('0x4f')]})[_0x762f('0x1f')](function(_0x422cf0){_0x49849c[_0x762f('0x52')]=_0x422cf0;if(_0x109334['query'][_0x762f('0x53')]){_0x27f4a5['include']=[{'all':!![]}];}return db[_0x762f('0x65')]['findAll'](_0x27f4a5);})[_0x762f('0x1f')](function(_0x4c0dae){_0x49849c['rows']=_0x4c0dae;return _0x49849c;});}})[_0x762f('0x1f')](respondWithFilteredResult(_0x324eaf,_0x27f4a5))[_0x762f('0x2a')](handleError(_0x324eaf,null));};exports[_0x762f('0x69')]=function(_0x4e6806,_0x4072e1,_0x446c11){return db['OpenchannelAccount'][_0x762f('0x5b')]({'where':{'id':_0x4e6806[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x4072e1,null))[_0x762f('0x1f')](function(_0x163e8b){if(_0x163e8b){return _0x163e8b['removeDispositions'](_0x4e6806[_0x762f('0x47')]['ids']);}})[_0x762f('0x1f')](respondWithStatusCode(_0x4072e1,null))[_0x762f('0x2a')](handleError(_0x4072e1,null));};exports[_0x762f('0x6a')]=function(_0x28726d,_0xb08dc6,_0x1a5cce){if(_0x28726d['body']['id']){delete _0x28726d['body']['id'];}return db[_0x762f('0x3f')]['find']({'where':{'id':_0x28726d[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0xb08dc6,null))[_0x762f('0x1f')](function(_0x5a0945){if(_0x5a0945){_0x28726d[_0x762f('0x63')][_0x762f('0x68')]=_0x5a0945['id'];return db[_0x762f('0x6b')][_0x762f('0x5c')](_0x28726d['body']);}})['then'](respondWithResult(_0xb08dc6,null))['catch'](handleError(_0xb08dc6,null));};exports['getAnswers']=function(_0x31028e,_0x19ea2c,_0xc24de5){var _0x530883={'raw':![],'where':{}};var _0x1a92aa={};var _0x14ac0d={'count':0x0,'rows':[]};return db[_0x762f('0x3f')][_0x762f('0x67')]({'where':{'id':_0x31028e[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x19ea2c,null))[_0x762f('0x1f')](function(_0x1308e7){if(_0x1308e7){_0x1a92aa[_0x762f('0x44')]=_['keys'](db[_0x762f('0x6b')]['rawAttributes']);_0x1a92aa[_0x762f('0x47')]=_[_0x762f('0x45')](_0x31028e[_0x762f('0x47')]);_0x1a92aa[_0x762f('0x46')]=_['intersection'](_0x1a92aa[_0x762f('0x44')],_0x1a92aa[_0x762f('0x47')]);_0x530883[_0x762f('0x48')]=_[_0x762f('0x59')](_0x1a92aa[_0x762f('0x44')],qs[_0x762f('0x49')](_0x31028e['query'][_0x762f('0x49')]));_0x530883['attributes']=_0x530883[_0x762f('0x48')]['length']?_0x530883['attributes']:_0x1a92aa[_0x762f('0x44')];if(!_0x31028e[_0x762f('0x47')][_0x762f('0x4a')]('nolimit')){_0x530883[_0x762f('0x2f')]=qs[_0x762f('0x2f')](_0x31028e['query']['limit']);_0x530883['offset']=qs[_0x762f('0x2e')](_0x31028e[_0x762f('0x47')][_0x762f('0x2e')]);}_0x530883[_0x762f('0x4b')]=qs[_0x762f('0x4c')](_0x31028e[_0x762f('0x47')]['sort']);_0x530883[_0x762f('0x4f')]=qs['filters'](_[_0x762f('0x4d')](_0x31028e[_0x762f('0x47')],_0x1a92aa[_0x762f('0x46')]));_0x530883[_0x762f('0x4f')][_0x762f('0x68')]=_0x1308e7['id'];if(_0x31028e[_0x762f('0x47')][_0x762f('0x4e')]){_0x530883[_0x762f('0x4f')]=_['merge'](_0x530883[_0x762f('0x4f')],{'$or':_['map'](_0x530883[_0x762f('0x48')],function(_0x331714){var _0x46af8a={};_0x46af8a[_0x331714]={'$like':'%'+_0x31028e[_0x762f('0x47')]['filter']+'%'};return _0x46af8a;})});}_0x530883=_['merge']({},_0x530883,_0x31028e['options']);return db[_0x762f('0x6b')][_0x762f('0x52')]({'where':_0x530883['where']})['then'](function(_0xdeed6c){_0x14ac0d['count']=_0xdeed6c;if(_0x31028e[_0x762f('0x47')][_0x762f('0x53')]){_0x530883['include']=[{'all':!![]}];}return db[_0x762f('0x6b')][_0x762f('0x55')](_0x530883);})[_0x762f('0x1f')](function(_0x53aa2a){_0x14ac0d[_0x762f('0x6c')]=_0x53aa2a;return _0x14ac0d;});}})[_0x762f('0x1f')](respondWithFilteredResult(_0x19ea2c,_0x530883))[_0x762f('0x2a')](handleError(_0x19ea2c,null));};exports[_0x762f('0x6d')]=function(_0x2ec566,_0x3c98be,_0x3a7c58){return db[_0x762f('0x3f')][_0x762f('0x5b')]({'where':{'id':_0x2ec566[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x3c98be,null))[_0x762f('0x1f')](function(_0x1d9f87){if(_0x1d9f87){return _0x1d9f87[_0x762f('0x6d')](_0x2ec566[_0x762f('0x47')]['ids']);}})[_0x762f('0x1f')](respondWithStatusCode(_0x3c98be,null))['catch'](handleError(_0x3c98be,null));};exports[_0x762f('0x6e')]=function(_0x45573a,_0x3cb9d0,_0x47749b){var _0x571297={'body':_0x45573a[_0x762f('0x63')],'channel':'openchannel'};var _0x3fd753=[];var _0x3c9f72=[];var _0x46c2a3={};var _0x3df186=![];return db[_0x762f('0x6f')][_0x762f('0x64')]()['then'](function(_0x5cf5ab){if(!_0x5cf5ab){throw new db[(_0x762f('0x70'))][(_0x762f('0x71'))](_0x762f('0x72'));}_0x3fd753=_['difference'](_[_0x762f('0x45')](_0x5cf5ab),['createdAt',_0x762f('0x73')]);_0x3c9f72=_['difference'](_[_0x762f('0x45')](_0x5cf5ab),[_0x762f('0x74'),'updatedAt',_0x762f('0x75'),_0x762f('0x76')]);if(_0x45573a[_0x762f('0x63')]['id']){delete _0x45573a[_0x762f('0x63')]['id'];}if(_['isNil'](_0x45573a[_0x762f('0x63')][_0x762f('0x77')])){throw new db['Sequelize'][(_0x762f('0x71'))](_0x762f('0x78'));}if(_[_0x762f('0x79')](_0x45573a[_0x762f('0x63')]['body'])||_0x45573a[_0x762f('0x63')][_0x762f('0x63')]===''){throw new db[(_0x762f('0x70'))][(_0x762f('0x71'))](_0x762f('0x7a'));}if(_[_0x762f('0x79')](_0x45573a['body'][_0x762f('0x7b')])){throw new db[(_0x762f('0x70'))]['ValidationError'](_0x762f('0x7c')+_0x3c9f72);}if(!_[_0x762f('0x7d')](_0x3c9f72,_0x45573a[_0x762f('0x63')][_0x762f('0x7b')])){throw new db['Sequelize'][(_0x762f('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c9f72);}_0x46c2a3[_0x45573a['body']['mapKey']]=_0x45573a['body'][_0x762f('0x77')];})['then'](function(){return db[_0x762f('0x3f')][_0x762f('0x5b')]({'where':{'id':_0x45573a[_0x762f('0x57')]['id']},'include':[{'model':db[_0x762f('0x7e')],'as':'List','include':[{'model':db[_0x762f('0x6f')],'as':_0x762f('0x7f'),'where':_0x46c2a3,'limit':0x1,'order':[['updatedAt',_0x762f('0x80')]]}]},{'model':db[_0x762f('0x81')],'as':_0x762f('0x82')}]});})[_0x762f('0x1f')](handleEntityNotFound(_0x3cb9d0,null))[_0x762f('0x1f')](function(_0x3a05b5){if(_0x3a05b5&&_0x3a05b5[_0x762f('0x83')]){_0x571297[_0x762f('0x84')]=_0x3a05b5;_0x571297[_0x762f('0x85')]=_0x3a05b5[_0x762f('0x82')];_0x571297['list']=_0x3a05b5[_0x762f('0x83')];_0x571297[_0x762f('0x85')]=_[_0x762f('0x86')](_0x571297[_0x762f('0x85')],['priority'],[_0x762f('0x87')]);if(_0x571297['account'][_0x762f('0x82')]){delete _0x571297[_0x762f('0x84')][_0x762f('0x82')];}if(_0x571297[_0x762f('0x84')]['List']&&_0x571297['account'][_0x762f('0x83')]['Contacts'][_0x762f('0x5a')]){return _0x571297['account'][_0x762f('0x83')][_0x762f('0x7f')][0x0];}var _0x509835=_[_0x762f('0x16')](_0x45573a['body'],{'firstName':_0x45573a['body'][_0x762f('0x77')],'ListId':_0x3a05b5[_0x762f('0x76')]});_0x509835[_0x45573a[_0x762f('0x63')]['mapKey']]=_0x45573a[_0x762f('0x63')][_0x762f('0x77')];return db['CmContact'][_0x762f('0x5c')](_0x509835,{'fields':_0x3fd753,'raw':!![]});}})[_0x762f('0x1f')](handleEntityNotFound(_0x3cb9d0,null))[_0x762f('0x1f')](function(_0x52eb82){_0x571297['contact']=_0x52eb82;if(_0x52eb82){var _0x5a3af3={'ContactId':_0x52eb82['id'],'OpenchannelAccountId':_0x45573a[_0x762f('0x57')]['id'],'from':(_0x52eb82[_0x762f('0x88')]||'')+'\x20'+(_0x52eb82[_0x762f('0x89')]||'')};var _0x1bbe2a={'OpenchannelAccountId':_0x45573a[_0x762f('0x57')]['id'],'closed':![]};if(_0x45573a[_0x762f('0x63')][_0x762f('0x8a')]){_0x1bbe2a['threadId']=_0x45573a['body']['threadId'];return db['OpenchannelInteraction'][_0x762f('0x5b')]({'where':_0x1bbe2a})['then'](function(_0x121124){if(_0x121124){return[_0x121124,![]];}_0x5a3af3[_0x762f('0x8a')]=_0x45573a[_0x762f('0x63')][_0x762f('0x8a')];_0x5a3af3['externalUrl']=_0x45573a[_0x762f('0x63')]['externalUrl'];return db[_0x762f('0x8b')][_0x762f('0x5c')](_0x5a3af3)[_0x762f('0x1f')](function(_0x499747){return[_0x499747,!![]];});});}else{_0x1bbe2a[_0x762f('0x8a')]=null;}_0x1bbe2a['ContactId']=_0x52eb82['id'];return db[_0x762f('0x8b')][_0x762f('0x5b')]({'where':_0x1bbe2a})[_0x762f('0x1f')](function(_0x112521){if(_0x112521){return[_0x112521,![]];}return db[_0x762f('0x8b')][_0x762f('0x5c')](_0x5a3af3)[_0x762f('0x1f')](function(_0xcb0059){return[_0xcb0059,!![]];});});}})[_0x762f('0x8c')](function(_0x18221b,_0x21b7e0){if(_0x18221b){_0x3df186=_0x21b7e0;if(!_0x21b7e0){var _0x3abc85={'from':(_0x571297[_0x762f('0x8d')]['firstName']||'')+'\x20'+(_0x571297['contact'][_0x762f('0x89')]||'')};if(_0x45573a[_0x762f('0x63')][_0x762f('0x8a')]&&_0x45573a[_0x762f('0x63')]['messageId']&&_0x45573a[_0x762f('0x63')][_0x762f('0x8a')]!=_0x45573a['body']['messageId']){_0x3abc85[_0x762f('0x8a')]=_0x45573a[_0x762f('0x63')][_0x762f('0x8e')];}return _0x18221b['update'](_0x3abc85);}else{return _0x18221b;}}})[_0x762f('0x1f')](function(_0x4d1a0b){_0x571297[_0x762f('0x8f')]=_0x4d1a0b['get']({'plain':!![]});_0x571297[_0x762f('0x8f')][_0x762f('0x90')]=_0x3df186;if(_0x571297[_0x762f('0x8f')]['created']){if(_0x571297['account'][_0x762f('0x91')]){_0x571297[_0x762f('0x85')]['push']({'id':0x0,'priority':_0x571297[_0x762f('0x85')]['length']+0x1,'app':_0x762f('0x92'),'appdata':_0x762f('0x93'),'interval':_0x762f('0x94')});}}return db['OpenchannelMessage']['create']({'body':_0x45573a['body'][_0x762f('0x63')],'OpenchannelAccountId':_0x45573a[_0x762f('0x57')]['id'],'OpenchannelInteractionId':_0x4d1a0b['id'],'direction':'in','ContactId':_0x571297[_0x762f('0x8d')]['id'],'AttachmentId':_0x45573a['body']['AttachmentId']});})[_0x762f('0x1f')](function(_0x42d35f){_0x571297['message']=_0x42d35f;if(_0x571297[_0x762f('0x8f')][_0x762f('0x95')]){return db[_0x762f('0x96')][_0x762f('0x5b')]({'attributes':['id',_0x762f('0x3a')],'where':{'id':_0x571297[_0x762f('0x8f')][_0x762f('0x95')]}})['then'](function(_0x17067c){if(_0x17067c){_0x571297[_0x762f('0x85')][_0x762f('0x97')]({'id':0x0,'priority':0x0,'app':_0x762f('0x98'),'appdata':_0x17067c[_0x762f('0x3a')]+','+(_0x571297[_0x762f('0x84')][_0x762f('0x99')]||0xa),'interval':_0x762f('0x94')});_0x571297[_0x762f('0x9a')]=![];}return respondWithRpcPromise('Start',_0x762f('0x9b'),_0x571297);});}return respondWithRpcPromise(_0x762f('0x9c'),_0x762f('0x9b'),_0x571297);})[_0x762f('0x1f')](function(_0x4b9aef){respondWithRpcPromise(_0x762f('0x9d'),_0x762f('0x9d'),{'event':'notify','message':_0x4b9aef},client9002);return _0x4b9aef;})[_0x762f('0x1f')](respondWithResult(_0x3cb9d0,null))['catch'](handleError(_0x3cb9d0,null));};exports[_0x762f('0x9e')]=function(_0x56c005,_0x3490f7,_0x41f1db){return db['OpenchannelAccount'][_0x762f('0x67')]({'where':{'id':_0x56c005[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x3490f7,null))[_0x762f('0x1f')](function(_0x578ea1){if(_0x578ea1){return db[_0x762f('0x9f')][_0x762f('0xa0')](function(_0x6f96a7){return db[_0x762f('0x81')][_0x762f('0x36')]({'where':{'OpenchannelAccountId':_0x56c005[_0x762f('0x57')]['id']},'transaction':_0x6f96a7})[_0x762f('0x1f')](function(_0xa25239){var _0x26b35a=_['map'](_0x56c005[_0x762f('0x63')],function(_0x1a6beb){_0x1a6beb[_0x762f('0x68')]=_0x56c005['params']['id'];return _0x1a6beb;});return db[_0x762f('0x81')][_0x762f('0xa1')](_0x26b35a,{'transaction':_0x6f96a7});});})[_0x762f('0x1f')](function(){return db[_0x762f('0x81')][_0x762f('0xa2')]({'where':{'OpenchannelAccountId':_0x56c005['params']['id']},'order':'priority'});});}})[_0x762f('0x1f')](respondWithResult(_0x3490f7,null))[_0x762f('0x2a')](handleError(_0x3490f7,null));};exports[_0x762f('0xa3')]=function(_0x109059,_0x455954,_0x2458dc){var _0x5c372e={};var _0x430554={};var _0x5512c9;var _0xa369e0;return db[_0x762f('0x3f')]['findOne']({'where':{'id':_0x109059[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x455954,null))[_0x762f('0x1f')](function(_0x39fc78){if(_0x39fc78){_0x5512c9=_0x39fc78;_0x430554[_0x762f('0x44')]=_[_0x762f('0x45')](db[_0x762f('0x81')]['rawAttributes']);_0x430554['query']=_[_0x762f('0x45')](_0x109059[_0x762f('0x47')]);_0x430554[_0x762f('0x46')]=_['intersection'](_0x430554['model'],_0x430554['query']);_0x5c372e[_0x762f('0x48')]=_[_0x762f('0x59')](_0x430554['model'],qs[_0x762f('0x49')](_0x109059[_0x762f('0x47')]['fields']));_0x5c372e[_0x762f('0x48')]=_0x5c372e[_0x762f('0x48')][_0x762f('0x5a')]?_0x5c372e[_0x762f('0x48')]:_0x430554[_0x762f('0x44')];_0x5c372e[_0x762f('0x4b')]=qs[_0x762f('0x4c')](_0x109059[_0x762f('0x47')][_0x762f('0x4c')]);_0x5c372e[_0x762f('0x4f')]=qs[_0x762f('0x46')](_[_0x762f('0x4d')](_0x109059[_0x762f('0x47')],_0x430554[_0x762f('0x46')]));if(_0x109059['query'][_0x762f('0x4e')]){_0x5c372e[_0x762f('0x4f')]=_[_0x762f('0x50')](_0x5c372e['where'],{'$or':_[_0x762f('0x3e')](_0x5c372e[_0x762f('0x48')],function(_0x7df66d){var _0x230601={};_0x230601[_0x7df66d]={'$like':'%'+_0x109059[_0x762f('0x47')][_0x762f('0x4e')]+'%'};return _0x230601;})});}_0x5c372e=_[_0x762f('0x50')]({},_0x5c372e,_0x109059[_0x762f('0x51')]);return _0x5512c9[_0x762f('0xa3')](_0x5c372e);}})[_0x762f('0x1f')](function(_0x5a72e4){if(_0x5a72e4){_0xa369e0=_0x5a72e4[_0x762f('0x5a')];if(!_0x109059['query'][_0x762f('0x4a')]('nolimit')){_0x5c372e[_0x762f('0x2f')]=qs['limit'](_0x109059[_0x762f('0x47')][_0x762f('0x2f')]);_0x5c372e[_0x762f('0x2e')]=qs[_0x762f('0x2e')](_0x109059['query'][_0x762f('0x2e')]);}return _0x5512c9['getApplications'](_0x5c372e);}})[_0x762f('0x1f')](function(_0x2a3bf4){if(_0x2a3bf4){return _0x2a3bf4?{'count':_0xa369e0,'rows':_0x2a3bf4}:null;}})['then'](respondWithResult(_0x455954,null))[_0x762f('0x2a')](handleError(_0x455954,null));};exports[_0x762f('0xa4')]=function(_0x40a169,_0x13ad0c,_0x8862f2){var _0xd208f4={'raw':![],'where':{}};var _0x3c2231={};var _0x40b579={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x762f('0x67')]({'where':{'id':_0x40a169['params']['id']}})['then'](handleEntityNotFound(_0x13ad0c,null))[_0x762f('0x1f')](function(_0x21c0e8){if(_0x21c0e8){_0x3c2231[_0x762f('0x44')]=_[_0x762f('0x45')](db[_0x762f('0x8b')]['rawAttributes']);_0x3c2231[_0x762f('0x47')]=_[_0x762f('0x45')](_0x40a169[_0x762f('0x47')]);_0x3c2231[_0x762f('0x46')]=_[_0x762f('0x59')](_0x3c2231[_0x762f('0x44')],_0x3c2231['query']);_0xd208f4['attributes']=_[_0x762f('0x59')](_0x3c2231[_0x762f('0x44')],qs[_0x762f('0x49')](_0x40a169['query'][_0x762f('0x49')]));_0xd208f4['attributes']=_0xd208f4['attributes']['length']?_0xd208f4[_0x762f('0x48')]:_0x3c2231['model'];if(!_0x40a169[_0x762f('0x47')][_0x762f('0x4a')](_0x762f('0xa5'))){_0xd208f4['limit']=qs[_0x762f('0x2f')](_0x40a169[_0x762f('0x47')]['limit']);_0xd208f4[_0x762f('0x2e')]=qs['offset'](_0x40a169[_0x762f('0x47')][_0x762f('0x2e')]);}_0xd208f4[_0x762f('0x4b')]=qs['sort'](_0x40a169['query']['sort']);_0xd208f4[_0x762f('0x4f')]=qs[_0x762f('0x46')](_[_0x762f('0x4d')](_0x40a169[_0x762f('0x47')],_0x3c2231[_0x762f('0x46')]));_0xd208f4[_0x762f('0x4f')][_0x762f('0x68')]=_0x21c0e8['id'];if(_0x40a169[_0x762f('0x47')]['filter']){_0xd208f4[_0x762f('0x4f')]=_[_0x762f('0x50')](_0xd208f4[_0x762f('0x4f')],{'$or':_[_0x762f('0x3e')](_0xd208f4[_0x762f('0x48')],function(_0x185fc2){var _0x7ee47b={};_0x7ee47b[_0x185fc2]={'$like':'%'+_0x40a169[_0x762f('0x47')]['filter']+'%'};return _0x7ee47b;})});}_0xd208f4=_['merge']({},_0xd208f4,_0x40a169['options']);return db['OpenchannelInteraction']['count']({'where':_0xd208f4['where']})[_0x762f('0x1f')](function(_0x552c71){_0x40b579[_0x762f('0x52')]=_0x552c71;if(_0x40a169[_0x762f('0x47')][_0x762f('0x53')]){_0xd208f4['include']=[{'model':db[_0x762f('0x6f')],'as':'Contact','required':![]},{'model':db[_0x762f('0x96')],'as':_0x762f('0xa6'),'attributes':['name','fullname',_0x762f('0xa7')],'required':![]},{'model':db['Tag'],'as':_0x762f('0xa8'),'attributes':['id','name',_0x762f('0xa9')],'where':_0x40a169['query']['tag']?{'id':_0x40a169[_0x762f('0x47')][_0x762f('0xaa')]}:undefined,'required':_0x40a169['query'][_0x762f('0xaa')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0xd208f4);})[_0x762f('0x1f')](function(_0x154d5e){_0x40b579[_0x762f('0x6c')]=_0x154d5e;return _0x40b579;});}})[_0x762f('0x1f')](respondWithFilteredResult(_0x13ad0c,_0xd208f4))[_0x762f('0x2a')](handleError(_0x13ad0c,null));};exports[_0x762f('0xab')]=function(_0x122c1b,_0x5dab30,_0x1180cd){return db['OpenchannelAccount']['find']({'where':{'id':_0x122c1b[_0x762f('0x57')]['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x5dab30,null))[_0x762f('0x1f')](function(_0x28552b){if(_0x28552b){return _0x28552b[_0x762f('0xab')](_0x122c1b['body'][_0x762f('0xac')],_[_0x762f('0xad')](_0x122c1b['body'],[_0x762f('0xac'),'id'])||{})[_0x762f('0x8c')](function(_0x215478){for(var _0x98be14=0x0;_0x98be14<_0x122c1b[_0x762f('0x63')][_0x762f('0xac')][_0x762f('0x5a')];_0x98be14+=0x1){socket['emit'](_0x762f('0xae'),{'UserId':_0x122c1b[_0x762f('0x63')][_0x762f('0xac')][_0x98be14],'OpenchannelAccountId':_0x122c1b[_0x762f('0x57')]['id']});}return _0x215478;});}})['then'](respondWithResult(_0x5dab30,null))['catch'](handleError(_0x5dab30,null));};exports[_0x762f('0xaf')]=function(_0x1e638b,_0x5346d7,_0x48091f){return db[_0x762f('0x3f')][_0x762f('0x5b')]({'where':{'id':_0x1e638b['params']['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0x5346d7,null))['then'](function(_0x1ba633){if(_0x1ba633){return _0x1ba633[_0x762f('0xaf')](_0x1e638b[_0x762f('0x47')][_0x762f('0xac')])['then'](function(){if(_['isArray'](_0x1e638b[_0x762f('0x47')][_0x762f('0xac')])){for(var _0x1ea024=0x0;_0x1ea024<_0x1e638b[_0x762f('0x47')]['ids'][_0x762f('0x5a')];_0x1ea024+=0x1){socket[_0x762f('0xb0')](_0x762f('0xb1'),{'UserId':Number(_0x1e638b[_0x762f('0x47')][_0x762f('0xac')][_0x1ea024]),'OpenchannelAccountId':Number(_0x1e638b[_0x762f('0x57')]['id'])});}}else{socket[_0x762f('0xb0')](_0x762f('0xb1'),{'UserId':Number(_0x1e638b[_0x762f('0x47')][_0x762f('0xac')]),'OpenchannelAccountId':Number(_0x1e638b[_0x762f('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5346d7,null))['catch'](handleError(_0x5346d7,null));};exports[_0x762f('0xb2')]=function(_0x226d89,_0x5ec260,_0x41fc7f){var _0x3a6147={};var _0x1ad694={};var _0x39ddc8;var _0x20fd3f;return db[_0x762f('0x3f')][_0x762f('0x67')]({'where':{'id':_0x226d89[_0x762f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5ec260,null))[_0x762f('0x1f')](function(_0x13898f){if(_0x13898f){_0x39ddc8=_0x13898f;_0x1ad694[_0x762f('0x44')]=_['keys'](db['User']['rawAttributes']);_0x1ad694[_0x762f('0x47')]=_[_0x762f('0x45')](_0x226d89[_0x762f('0x47')]);_0x1ad694['filters']=_['intersection'](_0x1ad694[_0x762f('0x44')],_0x1ad694['query']);_0x3a6147[_0x762f('0x48')]=_[_0x762f('0x59')](_0x1ad694[_0x762f('0x44')],qs[_0x762f('0x49')](_0x226d89[_0x762f('0x47')][_0x762f('0x49')]));_0x3a6147[_0x762f('0x48')]=_0x3a6147[_0x762f('0x48')][_0x762f('0x5a')]?_0x3a6147[_0x762f('0x48')]:_0x1ad694[_0x762f('0x44')];_0x3a6147[_0x762f('0x4b')]=qs[_0x762f('0x4c')](_0x226d89[_0x762f('0x47')][_0x762f('0x4c')]);_0x3a6147[_0x762f('0x4f')]=qs[_0x762f('0x46')](_[_0x762f('0x4d')](_0x226d89[_0x762f('0x47')],_0x1ad694['filters']));if(_0x226d89[_0x762f('0x47')]['filter']){_0x3a6147[_0x762f('0x4f')]=_[_0x762f('0x50')](_0x3a6147[_0x762f('0x4f')],{'$or':_[_0x762f('0x3e')](_0x3a6147['attributes'],function(_0x4de818){var _0x5df92a={};_0x5df92a[_0x4de818]={'$like':'%'+_0x226d89[_0x762f('0x47')]['filter']+'%'};return _0x5df92a;})});}_0x3a6147=_[_0x762f('0x50')]({},_0x3a6147,_0x226d89[_0x762f('0x51')]);return _0x39ddc8['getAgents'](_0x3a6147);}})['then'](function(_0x5418f4){if(_0x5418f4){_0x20fd3f=_0x5418f4['length'];if(!_0x226d89[_0x762f('0x47')][_0x762f('0x4a')]('nolimit')){_0x3a6147[_0x762f('0x2f')]=qs[_0x762f('0x2f')](_0x226d89[_0x762f('0x47')][_0x762f('0x2f')]);_0x3a6147[_0x762f('0x2e')]=qs['offset'](_0x226d89['query'][_0x762f('0x2e')]);}return _0x39ddc8[_0x762f('0xb2')](_0x3a6147);}})[_0x762f('0x1f')](function(_0x14270d){if(_0x14270d){return _0x14270d?{'count':_0x20fd3f,'rows':_0x14270d}:null;}})[_0x762f('0x1f')](respondWithResult(_0x5ec260,null))[_0x762f('0x2a')](handleError(_0x5ec260,null));};exports[_0x762f('0x3b')]=function(_0x27650b,_0xb894ca,_0x551c58){var _0x41c237,_0x3a5750,_0x3f1a97;if(_['isNil'](_0x27650b[_0x762f('0x63')][_0x762f('0x63')])||_0x27650b[_0x762f('0x63')]['body']===''){throw new db[(_0x762f('0x70'))][(_0x762f('0x71'))](_0x762f('0x7a'));}if(_[_0x762f('0x79')](_0x27650b[_0x762f('0x63')]['to'])){}_0x41c237=_0x27650b[_0x762f('0x63')]['to'];return db[_0x762f('0x3f')][_0x762f('0x67')]({'where':{'id':_0x27650b['params']['id']}})[_0x762f('0x1f')](handleEntityNotFound(_0xb894ca,null))[_0x762f('0x1f')](function(_0x3c857e){if(_0x3c857e){return db['OpenchannelAccount'][_0x762f('0x5b')]({'where':{'id':_0x3c857e['id']},'include':[{'model':db[_0x762f('0x7e')],'as':_0x762f('0x83'),'include':[{'model':db[_0x762f('0x6f')],'as':_0x762f('0x7f'),'where':{[_0x3c857e['mapKey']]:_0x41c237},'limit':0x1,'order':[['updatedAt',_0x762f('0x80')]]}]}]})['then'](handleEntityNotFound(_0xb894ca,null))[_0x762f('0x1f')](function(_0xca5a87){if(_0xca5a87&&_0xca5a87[_0x762f('0x83')]){_0x3a5750=_0xca5a87[_0x762f('0x37')]({'plain':!![]});if(_0x3a5750[_0x762f('0x83')]&&_0x3a5750['List'][_0x762f('0x7f')]['length']){return _0x3a5750[_0x762f('0x83')][_0x762f('0x7f')][0x0];}return db['CmContact'][_0x762f('0x5c')](_[_0x762f('0x16')](_0x27650b[_0x762f('0x63')],{'firstName':_0x41c237,[_0xca5a87[_0x762f('0x7b')]]:_0x41c237,'phone':_0x41c237,'ListId':_0x3a5750[_0x762f('0x76')]}));}})[_0x762f('0x1f')](handleEntityNotFound(_0xb894ca,null))[_0x762f('0x1f')](function(_0x23c636){if(_0x23c636){_0x3f1a97=_0x23c636;return db[_0x762f('0x8b')][_0x762f('0x5b')]({'where':{'ContactId':_0x3f1a97['id'],'closed':![],'OpenchannelAccountId':_0x3a5750['id']}})[_0x762f('0x1f')](function(_0x47e7b5){if(_0x47e7b5){return[_0x47e7b5,![]];}return db[_0x762f('0x8b')][_0x762f('0x5c')]({'UserId':_0x27650b['user']['id'],'ContactId':_0x3f1a97['id'],'OpenchannelAccountId':_0x3a5750['id'],'lastMsgDirection':_0x762f('0xb3'),'Messages':[_[_0x762f('0x50')](_0x27650b[_0x762f('0x63')],{'read':![],'body':_0x27650b[_0x762f('0x63')][_0x762f('0x63')],'OpenchannelAccountId':_0x3a5750['id'],'UserId':_0x27650b['user']['id'],'ContactId':_0x3f1a97['id']})]},{'include':[{'model':db[_0x762f('0xb4')],'as':_0x762f('0xb5')}]})[_0x762f('0x1f')](function(_0xfaabdb){return[_0xfaabdb,!![]];});});}})[_0x762f('0x8c')](function(_0x510f02,_0x3abc81){if(_0x3abc81){return _0x510f02;}return db[_0x762f('0xb4')][_0x762f('0x5c')](_['merge'](_0x27650b[_0x762f('0x63')],{'read':![],'body':_0x27650b[_0x762f('0x63')]['body'],'OpenchannelAccountId':_0x3a5750['id'],'OpenchannelInteractionId':_0x510f02['id'],'UserId':_0x27650b[_0x762f('0x5e')]['id'],'ContactId':_0x3f1a97['id']}))[_0x762f('0x1f')](function(_0x2a62de){_0x510f02[_0x762f('0xb6')]['Messages']=[];_0x510f02[_0x762f('0xb6')][_0x762f('0xb5')]['push'](_0x2a62de[_0x762f('0xb6')]);return _0x510f02;});});}})[_0x762f('0x1f')](respondWithResult(_0xb894ca,null))[_0x762f('0x2a')](handleError(_0xb894ca,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 90b70b5..6ef4dda 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 _0x1a9b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a9b,0x155));var _0xb1a9=function(_0x1c27f2,_0x59e41a){_0x1c27f2=_0x1c27f2-0x0;var _0x3b4373=_0x1a9b[_0x1c27f2];return _0x3b4373;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xb1a9('0x0'))['db'][_0xb1a9('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb1a9('0x2')](0x0);var events={'afterCreate':_0xb1a9('0x3'),'afterUpdate':_0xb1a9('0x4'),'afterDestroy':_0xb1a9('0x5')};function emitEvent(_0x8ca44a){return function(_0x3b0a64,_0x2c84cd,_0x1dd8a0){OpenchannelAccountEvents[_0xb1a9('0x6')](_0x8ca44a+':'+_0x3b0a64['id'],_0x3b0a64);OpenchannelAccountEvents[_0xb1a9('0x6')](_0x8ca44a,_0x3b0a64);_0x1dd8a0(null);};}for(var e in events){if(events[_0xb1a9('0x7')](e)){var event=events[e];OpenchannelAccount[_0xb1a9('0x8')](e,emitEvent(event));}}module[_0xb1a9('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5b16=['exports','events','../../mysqldb','OpenchannelAccount','save','remove','emit','hasOwnProperty','hook'];(function(_0x31366a,_0x1771f8){var _0x17a077=function(_0x4b8996){while(--_0x4b8996){_0x31366a['push'](_0x31366a['shift']());}};_0x17a077(++_0x1771f8);}(_0x5b16,0x145));var _0x65b1=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x5b16[_0x3de8a4];return _0x4635cf;};'use strict';var EventEmitter=require(_0x65b1('0x0'));var OpenchannelAccount=require(_0x65b1('0x1'))['db'][_0x65b1('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x65b1('0x3'),'afterUpdate':'update','afterDestroy':_0x65b1('0x4')};function emitEvent(_0x45db0d){return function(_0x528640,_0x27729a,_0x54f318){OpenchannelAccountEvents[_0x65b1('0x5')](_0x45db0d+':'+_0x528640['id'],_0x528640);OpenchannelAccountEvents['emit'](_0x45db0d,_0x528640);_0x54f318(null);};}for(var e in events){if(events[_0x65b1('0x6')](e)){var event=events[e];OpenchannelAccount[_0x65b1('0x7')](e,emitEvent(event));}}module[_0x65b1('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 0f2f0eb..de2f153 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 _0x1c5f=['../../config/logger','api','moment','request-promise','path','./openchannelAccount.attributes','exports','define','OpenchannelAccount','util'];(function(_0x322417,_0x50d69f){var _0x48b762=function(_0x290336){while(--_0x290336){_0x322417['push'](_0x322417['shift']());}};_0x48b762(++_0x50d69f);}(_0x1c5f,0x18f));var _0xf1c5=function(_0x2ee5b2,_0x4697df){_0x2ee5b2=_0x2ee5b2-0x0;var _0x234daa=_0x1c5f[_0x2ee5b2];return _0x234daa;};'use strict';var _=require('lodash');var util=require(_0xf1c5('0x0'));var logger=require(_0xf1c5('0x1'))(_0xf1c5('0x2'));var moment=require(_0xf1c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf1c5('0x4'));var fs=require('fs');var path=require(_0xf1c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1c5('0x6'));module[_0xf1c5('0x7')]=function(_0x1cf61f,_0x2949a2){return _0x1cf61f[_0xf1c5('0x8')](_0xf1c5('0x9'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64ac=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x64ac,0x75));var _0xc64a=function(_0xb39aed,_0x5b2722){_0xb39aed=_0xb39aed-0x0;var _0x255fd7=_0x64ac[_0xb39aed];return _0x255fd7;};'use strict';var _=require(_0xc64a('0x0'));var util=require('util');var logger=require(_0xc64a('0x1'))(_0xc64a('0x2'));var moment=require(_0xc64a('0x3'));var BPromise=require(_0xc64a('0x4'));var rp=require(_0xc64a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc64a('0x6'));var config=require(_0xc64a('0x7'));var attributes=require(_0xc64a('0x8'));module[_0xc64a('0x9')]=function(_0x201bee,_0x1264b1){return _0x201bee[_0xc64a('0xa')](_0xc64a('0xb'),attributes,{'tableName':_0xc64a('0xc'),'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 b1556c6..2a596da 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 _0x8a7b=['./openchannelAccount.socket','request','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','defaults','redis','socket.io-emitter'];(function(_0x29da6f,_0x17e9ba){var _0x56c49f=function(_0xb00c1e){while(--_0xb00c1e){_0x29da6f['push'](_0x29da6f['shift']());}};_0x56c49f(++_0x17e9ba);}(_0x8a7b,0x96));var _0xb8a7=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0x8a7b[_0x12a020];return _0x63cddd;};'use strict';var _=require('lodash');var util=require(_0xb8a7('0x0'));var moment=require(_0xb8a7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8a7('0x2'));var fs=require('fs');var Redis=require(_0xb8a7('0x3'));var db=require(_0xb8a7('0x4'))['db'];var utils=require(_0xb8a7('0x5'));var logger=require('../../config/logger')(_0xb8a7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb8a7('0x7')]({'port':0x232a});config['redis']=_[_0xb8a7('0x8')](config[_0xb8a7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8a7('0xa'))(new Redis(config[_0xb8a7('0x9')]));require(_0xb8a7('0xb'))['register'](socket);function respondWithRpcPromise(_0xf92c09,_0x368207,_0x350d58){return new BPromise(function(_0x670f49,_0x58bb4b){return client[_0xb8a7('0xc')](_0xf92c09,_0x350d58)['then'](function(_0x49f74f){logger['info'](_0xb8a7('0xd'),_0x368207,'request\x20sent');logger[_0xb8a7('0xe')](_0xb8a7('0xf'),_0x368207,_0xb8a7('0x10'),JSON[_0xb8a7('0x11')](_0x49f74f));if(_0x49f74f[_0xb8a7('0x12')]){if(_0x49f74f[_0xb8a7('0x12')][_0xb8a7('0x13')]===0x1f4){logger[_0xb8a7('0x12')](_0xb8a7('0xd'),_0x368207,_0x49f74f[_0xb8a7('0x12')][_0xb8a7('0x14')]);return _0x58bb4b(_0x49f74f[_0xb8a7('0x12')]['message']);}logger['error'](_0xb8a7('0xd'),_0x368207,_0x49f74f[_0xb8a7('0x12')][_0xb8a7('0x14')]);return _0x670f49(_0x49f74f['error']['message']);}else{logger[_0xb8a7('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x368207,'request\x20sent');_0x670f49(_0x49f74f[_0xb8a7('0x16')][_0xb8a7('0x14')]);}})['catch'](function(_0x5965de){logger['error'](_0xb8a7('0xd'),_0x368207,_0x5965de);_0x58bb4b(_0x5965de);});});} \ No newline at end of file +var _0x55da=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x4e1a60,_0x233ed1){var _0x19277a=function(_0x168124){while(--_0x168124){_0x4e1a60['push'](_0x4e1a60['shift']());}};_0x19277a(++_0x233ed1);}(_0x55da,0xd7));var _0xa55d=function(_0x3df1c2,_0x1d32db){_0x3df1c2=_0x3df1c2-0x0;var _0x70d3e8=_0x55da[_0x3df1c2];return _0x70d3e8;};'use strict';var _=require(_0xa55d('0x0'));var util=require(_0xa55d('0x1'));var moment=require('moment');var BPromise=require(_0xa55d('0x2'));var rs=require(_0xa55d('0x3'));var fs=require('fs');var Redis=require(_0xa55d('0x4'));var db=require(_0xa55d('0x5'))['db'];var utils=require(_0xa55d('0x6'));var logger=require('../../config/logger')(_0xa55d('0x7'));var config=require(_0xa55d('0x8'));var jayson=require(_0xa55d('0x9'));var client=jayson[_0xa55d('0xa')][_0xa55d('0xb')]({'port':0x232a});config[_0xa55d('0xc')]=_['defaults'](config['redis'],{'host':_0xa55d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xa55d('0xe')](socket);function respondWithRpcPromise(_0x44d8a7,_0x56390d,_0x2d0ce3){return new BPromise(function(_0xfa30ab,_0x2cac88){return client[_0xa55d('0xf')](_0x44d8a7,_0x2d0ce3)[_0xa55d('0x10')](function(_0x35f0f3){logger[_0xa55d('0x11')](_0xa55d('0x12'),_0x56390d,_0xa55d('0x13'));logger['debug'](_0xa55d('0x14'),_0x56390d,_0xa55d('0x13'),JSON[_0xa55d('0x15')](_0x35f0f3));if(_0x35f0f3['error']){if(_0x35f0f3['error'][_0xa55d('0x16')]===0x1f4){logger[_0xa55d('0x17')](_0xa55d('0x12'),_0x56390d,_0x35f0f3[_0xa55d('0x17')][_0xa55d('0x18')]);return _0x2cac88(_0x35f0f3[_0xa55d('0x17')][_0xa55d('0x18')]);}logger[_0xa55d('0x17')](_0xa55d('0x12'),_0x56390d,_0x35f0f3[_0xa55d('0x17')][_0xa55d('0x18')]);return _0xfa30ab(_0x35f0f3[_0xa55d('0x17')][_0xa55d('0x18')]);}else{logger[_0xa55d('0x11')](_0xa55d('0x12'),_0x56390d,_0xa55d('0x13'));_0xfa30ab(_0x35f0f3[_0xa55d('0x19')]['message']);}})[_0xa55d('0x1a')](function(_0x54c1f7){logger[_0xa55d('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x56390d,_0x54c1f7);_0x2cac88(_0x54c1f7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 925b563..6eee889 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 _0x2cae=['openchannelAccount:','save','update','removeListener','register','length'];(function(_0x1510b9,_0x2b0346){var _0x380390=function(_0x572449){while(--_0x572449){_0x1510b9['push'](_0x1510b9['shift']());}};_0x380390(++_0x2b0346);}(_0x2cae,0xfd));var _0xe2ca=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x2cae[_0x1406ae];return _0x23a076;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe2ca('0x0'),'remove',_0xe2ca('0x1')];function createListener(_0xf0df5a,_0x3a8d28){return function(_0x3e1a52){_0x3a8d28['emit'](_0xf0df5a,_0x3e1a52);};}function removeListener(_0xd3e34a,_0x2437b5){return function(){OpenchannelAccountEvents[_0xe2ca('0x2')](_0xd3e34a,_0x2437b5);};}exports[_0xe2ca('0x3')]=function(_0x2abd86){for(var _0x5ba300=0x0,_0x2e7bb1=events[_0xe2ca('0x4')];_0x5ba300<_0x2e7bb1;_0x5ba300++){var _0x3e8f85=events[_0x5ba300];var _0x287a42=createListener(_0xe2ca('0x5')+_0x3e8f85,_0x2abd86);OpenchannelAccountEvents['on'](_0x3e8f85,_0x287a42);}}; \ No newline at end of file +var _0x0d99=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0d99,0x1a7));var _0x90d9=function(_0x4e5e6c,_0x959eb4){_0x4e5e6c=_0x4e5e6c-0x0;var _0xcf9053=_0x0d99[_0x4e5e6c];return _0xcf9053;};'use strict';var OpenchannelAccountEvents=require(_0x90d9('0x0'));var events=[_0x90d9('0x1'),_0x90d9('0x2'),_0x90d9('0x3')];function createListener(_0x31e8ee,_0x4ffb19){return function(_0x4c1334){_0x4ffb19[_0x90d9('0x4')](_0x31e8ee,_0x4c1334);};}function removeListener(_0x361ab4,_0x10931c){return function(){OpenchannelAccountEvents[_0x90d9('0x5')](_0x361ab4,_0x10931c);};}exports[_0x90d9('0x6')]=function(_0x4d2fbb){for(var _0xb46ea0=0x0,_0x53c9f0=events[_0x90d9('0x7')];_0xb46ea0<_0x53c9f0;_0xb46ea0++){var _0x574e71=events[_0xb46ea0];var _0xc4f207=createListener(_0x90d9('0x8')+_0x574e71,_0x4d2fbb);OpenchannelAccountEvents['on'](_0x574e71,_0xc4f207);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index aec1314..6341c20 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 _0x016f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','put','delete','destroy','exports','multer','path','express','Router'];(function(_0x299566,_0x34dafb){var _0x549fd7=function(_0x2086a2){while(--_0x2086a2){_0x299566['push'](_0x299566['shift']());}};_0x549fd7(++_0x34dafb);}(_0x016f,0xe6));var _0xf016=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x016f[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xf016('0x0'));var util=require('util');var path=require(_0xf016('0x1'));var timeout=require('connect-timeout');var express=require(_0xf016('0x2'));var router=express[_0xf016('0x3')]();var auth=require(_0xf016('0x4'));var interaction=require(_0xf016('0x5'));var config=require(_0xf016('0x6'));var controller=require(_0xf016('0x7'));router['get']('/',auth[_0xf016('0x8')](),controller[_0xf016('0x9')]);router[_0xf016('0xa')](_0xf016('0xb'),auth['isAuthenticated'](),controller[_0xf016('0xc')]);router[_0xf016('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf016('0xe')](_0xf016('0xb'),auth[_0xf016('0x8')](),controller['update']);router[_0xf016('0xf')](_0xf016('0xb'),auth[_0xf016('0x8')](),controller[_0xf016('0x10')]);module[_0xf016('0x11')]=router; \ No newline at end of file +var _0x5a92=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x243c71,_0x5706ab){var _0x5c1d26=function(_0x4ad84b){while(--_0x4ad84b){_0x243c71['push'](_0x243c71['shift']());}};_0x5c1d26(++_0x5706ab);}(_0x5a92,0x131));var _0x25a9=function(_0x3780d6,_0x23899a){_0x3780d6=_0x3780d6-0x0;var _0x26c55b=_0x5a92[_0x3780d6];return _0x26c55b;};'use strict';var multer=require(_0x25a9('0x0'));var util=require(_0x25a9('0x1'));var path=require(_0x25a9('0x2'));var timeout=require(_0x25a9('0x3'));var express=require(_0x25a9('0x4'));var router=express[_0x25a9('0x5')]();var auth=require(_0x25a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x25a9('0x7'));var controller=require(_0x25a9('0x8'));router[_0x25a9('0x9')]('/',auth[_0x25a9('0xa')](),controller[_0x25a9('0xb')]);router['get'](_0x25a9('0xc'),auth['isAuthenticated'](),controller[_0x25a9('0xd')]);router[_0x25a9('0xe')]('/',auth[_0x25a9('0xa')](),controller[_0x25a9('0xf')]);router['put'](_0x25a9('0xc'),auth[_0x25a9('0xa')](),controller[_0x25a9('0x10')]);router[_0x25a9('0x11')]('/:id',auth[_0x25a9('0xa')](),controller[_0x25a9('0x12')]);module[_0x25a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2c1d9d1..6b88cf3 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 _0xf9fd=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x46c365,_0x25caa9){var _0x296b13=function(_0x117e97){while(--_0x117e97){_0x46c365['push'](_0x46c365['shift']());}};_0x296b13(++_0x25caa9);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdf9f('0x0')]={'priority':{'type':Sequelize[_0xdf9f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdf9f('0x2')],'allowNull':![],'defaultValue':_0xdf9f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdf9f('0x2')],'defaultValue':_0xdf9f('0x4')}}; \ No newline at end of file +var _0x8ea3=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x8ea3,0xbb));var _0x38ea=function(_0x303518,_0x441b0b){_0x303518=_0x303518-0x0;var _0x4221d7=_0x8ea3[_0x303518];return _0x4221d7;};'use strict';var Sequelize=require(_0x38ea('0x0'));module[_0x38ea('0x1')]={'priority':{'type':Sequelize[_0x38ea('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x38ea('0x3')],'allowNull':![],'defaultValue':_0x38ea('0x4')},'appdata':{'type':Sequelize[_0x38ea('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x38ea('0x3')],'defaultValue':_0x38ea('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7bd8488..a4e6e3e 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 _0x5e50=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x50576c,_0x502d9c){var _0x22c1ef=function(_0x4067e7){while(--_0x4067e7){_0x50576c['push'](_0x50576c['shift']());}};_0x22c1ef(++_0x502d9c);}(_0x5e50,0x123));var _0x05e5=function(_0x50e9dc,_0x2e589d){_0x50e9dc=_0x50e9dc-0x0;var _0x5d1a41=_0x5e50[_0x50e9dc];return _0x5d1a41;};'use strict';var pdf=require(_0x05e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05e5('0x1'));var jsonpatch=require(_0x05e5('0x2'));var rp=require(_0x05e5('0x3'));var moment=require(_0x05e5('0x4'));var BPromise=require(_0x05e5('0x5'));var Mustache=require(_0x05e5('0x6'));var util=require(_0x05e5('0x7'));var path=require(_0x05e5('0x8'));var sox=require(_0x05e5('0x9'));var csv=require(_0x05e5('0xa'));var ejs=require(_0x05e5('0xb'));var fs=require('fs');var _=require(_0x05e5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x05e5('0xa'));var querystring=require(_0x05e5('0xe'));var Papa=require(_0x05e5('0xf'));var Redis=require(_0x05e5('0x10'));var authService=require(_0x05e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x05e5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05e5('0x13'))(_0x05e5('0x14'));var utils=require(_0x05e5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x05e5('0x16'))['db'];function respondWithStatusCode(_0x386a3a,_0x38d406){_0x38d406=_0x38d406||0xcc;return function(_0x3509f7){if(_0x3509f7){return _0x386a3a['sendStatus'](_0x38d406);}return _0x386a3a['status'](_0x38d406)[_0x05e5('0x17')]();};}function respondWithResult(_0x1d8229,_0x5d2f2f){_0x5d2f2f=_0x5d2f2f||0xc8;return function(_0x43dc49){if(_0x43dc49){return _0x1d8229[_0x05e5('0x18')](_0x5d2f2f)[_0x05e5('0x19')](_0x43dc49);}};}function respondWithFilteredResult(_0x17ba71,_0x1dceba){return function(_0x35c4ff){if(_0x35c4ff){var _0x188ab7=_0x35c4ff[_0x05e5('0x1a')],_0x4b12bb=_0x1dceba[_0x05e5('0x1b')],_0x59bf2e=_0x1dceba[_0x05e5('0x1b')]+_0x1dceba[_0x05e5('0x1c')],_0x4c64a2;if(_0x59bf2e>=_0x188ab7){_0x59bf2e=_0x188ab7;_0x4c64a2=0xc8;}else{_0x4c64a2=0xce;}_0x17ba71[_0x05e5('0x18')](_0x4c64a2);return _0x17ba71[_0x05e5('0x1d')](_0x05e5('0x1e'),_0x4b12bb+'-'+_0x59bf2e+'/'+_0x188ab7)[_0x05e5('0x19')](_0x35c4ff);}return null;};}function patchUpdates(_0x23efa0){return function(_0x4131e3){try{jsonpatch[_0x05e5('0x1f')](_0x4131e3,_0x23efa0,!![]);}catch(_0x44d201){return BPromise[_0x05e5('0x20')](_0x44d201);}return _0x4131e3[_0x05e5('0x21')]();};}function saveUpdates(_0x2f47fc,_0x366177){return function(_0x548426){if(_0x548426){return _0x548426[_0x05e5('0x22')](_0x2f47fc)[_0x05e5('0x23')](function(_0x30e8df){return _0x30e8df;});}return null;};}function removeEntity(_0x2a5dd6,_0x605a8d){return function(_0x5c70c6){if(_0x5c70c6){return _0x5c70c6['destroy']()[_0x05e5('0x23')](function(){_0x2a5dd6['status'](0xcc)[_0x05e5('0x17')]();});}};}function handleEntityNotFound(_0x38ca37,_0x56b11e){return function(_0x43dc4c){if(!_0x43dc4c){_0x38ca37['sendStatus'](0x194);}return _0x43dc4c;};}function handleError(_0x27f8df,_0x52bbf4){_0x52bbf4=_0x52bbf4||0x1f4;return function(_0x5826c4){logger[_0x05e5('0x24')](_0x5826c4[_0x05e5('0x25')]);if(_0x5826c4['name']){delete _0x5826c4[_0x05e5('0x26')];}_0x27f8df[_0x05e5('0x18')](_0x52bbf4)[_0x05e5('0x27')](_0x5826c4);};}exports[_0x05e5('0x28')]=function(_0x47b54a,_0x325bab){var _0x563931={},_0x348d51={},_0x5dd44a={'count':0x0,'rows':[]};var _0x4b717a=_[_0x05e5('0x29')](db[_0x05e5('0x2a')]['rawAttributes'],function(_0x595486){return{'name':_0x595486[_0x05e5('0x2b')],'type':_0x595486[_0x05e5('0x2c')][_0x05e5('0x2d')]};});_0x348d51[_0x05e5('0x2e')]=_[_0x05e5('0x29')](_0x4b717a,_0x05e5('0x26'));_0x348d51[_0x05e5('0x2f')]=_[_0x05e5('0x30')](_0x47b54a[_0x05e5('0x2f')]);_0x348d51[_0x05e5('0x31')]=_[_0x05e5('0x32')](_0x348d51[_0x05e5('0x2e')],_0x348d51[_0x05e5('0x2f')]);_0x563931[_0x05e5('0x33')]=_[_0x05e5('0x32')](_0x348d51[_0x05e5('0x2e')],qs[_0x05e5('0x34')](_0x47b54a[_0x05e5('0x2f')]['fields']));_0x563931['attributes']=_0x563931[_0x05e5('0x33')][_0x05e5('0x35')]?_0x563931[_0x05e5('0x33')]:_0x348d51[_0x05e5('0x2e')];if(!_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x36')](_0x05e5('0x37'))){_0x563931[_0x05e5('0x1c')]=qs[_0x05e5('0x1c')](_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x1c')]);_0x563931[_0x05e5('0x1b')]=qs[_0x05e5('0x1b')](_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x1b')]);}_0x563931['order']=qs['sort'](_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x38')]);_0x563931[_0x05e5('0x39')]=qs[_0x05e5('0x31')](_[_0x05e5('0x3a')](_0x47b54a['query'],_0x348d51[_0x05e5('0x31')]),_0x4b717a);if(_0x47b54a[_0x05e5('0x2f')]['filter']){_0x563931['where']=_[_0x05e5('0x3b')](_0x563931[_0x05e5('0x39')],{'$or':_['map'](_0x4b717a,function(_0x51b2e2){if(_0x51b2e2[_0x05e5('0x2c')]!==_0x05e5('0x3c')){var _0x1cdbe1={};_0x1cdbe1[_0x51b2e2['name']]={'$like':'%'+_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x3d')]+'%'};return _0x1cdbe1;}})});}_0x563931=_[_0x05e5('0x3b')]({},_0x563931,_0x47b54a[_0x05e5('0x3e')]);var _0x5e3a38={'where':_0x563931[_0x05e5('0x39')]};return db['OpenchannelApplication'][_0x05e5('0x1a')](_0x5e3a38)[_0x05e5('0x23')](function(_0xacc33f){_0x5dd44a[_0x05e5('0x1a')]=_0xacc33f;if(_0x47b54a[_0x05e5('0x2f')][_0x05e5('0x3f')]){_0x563931[_0x05e5('0x40')]=[{'all':!![]}];}return db[_0x05e5('0x2a')][_0x05e5('0x41')](_0x563931);})[_0x05e5('0x23')](function(_0x47cd8b){_0x5dd44a[_0x05e5('0x42')]=_0x47cd8b;return _0x5dd44a;})[_0x05e5('0x23')](respondWithFilteredResult(_0x325bab,_0x563931))[_0x05e5('0x43')](handleError(_0x325bab,null));};exports[_0x05e5('0x44')]=function(_0x4b302d,_0x112eb4){var _0x3d73c0={'raw':!![],'where':{'id':_0x4b302d[_0x05e5('0x45')]['id']}},_0x1eb6b6={};_0x1eb6b6[_0x05e5('0x2e')]=_['keys'](db[_0x05e5('0x2a')]['rawAttributes']);_0x1eb6b6['query']=_[_0x05e5('0x30')](_0x4b302d[_0x05e5('0x2f')]);_0x1eb6b6[_0x05e5('0x31')]=_['intersection'](_0x1eb6b6[_0x05e5('0x2e')],_0x1eb6b6['query']);_0x3d73c0[_0x05e5('0x33')]=_[_0x05e5('0x32')](_0x1eb6b6[_0x05e5('0x2e')],qs[_0x05e5('0x34')](_0x4b302d[_0x05e5('0x2f')][_0x05e5('0x34')]));_0x3d73c0[_0x05e5('0x33')]=_0x3d73c0[_0x05e5('0x33')][_0x05e5('0x35')]?_0x3d73c0[_0x05e5('0x33')]:_0x1eb6b6[_0x05e5('0x2e')];if(_0x4b302d[_0x05e5('0x2f')][_0x05e5('0x3f')]){_0x3d73c0['include']=[{'all':!![]}];}_0x3d73c0=_[_0x05e5('0x3b')]({},_0x3d73c0,_0x4b302d[_0x05e5('0x3e')]);return db[_0x05e5('0x2a')][_0x05e5('0x46')](_0x3d73c0)[_0x05e5('0x23')](handleEntityNotFound(_0x112eb4,null))[_0x05e5('0x23')](respondWithResult(_0x112eb4,null))[_0x05e5('0x43')](handleError(_0x112eb4,null));};exports['create']=function(_0x3f74b8,_0x44a8a3){return db['OpenchannelApplication'][_0x05e5('0x47')](_0x3f74b8[_0x05e5('0x48')],{})[_0x05e5('0x23')](respondWithResult(_0x44a8a3,0xc9))[_0x05e5('0x43')](handleError(_0x44a8a3,null));};exports[_0x05e5('0x22')]=function(_0x520b51,_0x39d4ef){if(_0x520b51[_0x05e5('0x48')]['id']){delete _0x520b51[_0x05e5('0x48')]['id'];}return db[_0x05e5('0x2a')][_0x05e5('0x46')]({'where':{'id':_0x520b51['params']['id']}})[_0x05e5('0x23')](handleEntityNotFound(_0x39d4ef,null))[_0x05e5('0x23')](saveUpdates(_0x520b51[_0x05e5('0x48')],null))[_0x05e5('0x23')](respondWithResult(_0x39d4ef,null))[_0x05e5('0x43')](handleError(_0x39d4ef,null));};exports[_0x05e5('0x49')]=function(_0x5cad7a,_0x4f8d71){return db[_0x05e5('0x2a')][_0x05e5('0x46')]({'where':{'id':_0x5cad7a[_0x05e5('0x45')]['id']}})[_0x05e5('0x23')](handleEntityNotFound(_0x4f8d71,null))[_0x05e5('0x23')](removeEntity(_0x4f8d71,null))['catch'](handleError(_0x4f8d71,null));}; \ No newline at end of file +var _0xb400=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','destroy','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xb400,0x1b1));var _0x0b40=function(_0x5f82c0,_0x220e23){_0x5f82c0=_0x5f82c0-0x0;var _0x2feb5f=_0xb400[_0x5f82c0];return _0x2feb5f;};'use strict';var pdf=require(_0x0b40('0x0'));var emlformat=require(_0x0b40('0x1'));var rimraf=require(_0x0b40('0x2'));var zipdir=require(_0x0b40('0x3'));var jsonpatch=require(_0x0b40('0x4'));var rp=require(_0x0b40('0x5'));var moment=require(_0x0b40('0x6'));var BPromise=require(_0x0b40('0x7'));var Mustache=require(_0x0b40('0x8'));var util=require('util');var path=require(_0x0b40('0x9'));var sox=require(_0x0b40('0xa'));var csv=require(_0x0b40('0xb'));var ejs=require(_0x0b40('0xc'));var fs=require('fs');var _=require(_0x0b40('0xd'));var squel=require('squel');var crypto=require(_0x0b40('0xe'));var jsforce=require(_0x0b40('0xf'));var deskjs=require(_0x0b40('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0b40('0x11'));var Papa=require('papaparse');var Redis=require(_0x0b40('0x12'));var authService=require(_0x0b40('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0b40('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b40('0x15'))('api');var utils=require(_0x0b40('0x16'));var config=require(_0x0b40('0x17'));var licenseUtil=require(_0x0b40('0x18'));var db=require(_0x0b40('0x19'))['db'];function respondWithStatusCode(_0x3fedc4,_0x183af8){_0x183af8=_0x183af8||0xcc;return function(_0x3d9201){if(_0x3d9201){return _0x3fedc4['sendStatus'](_0x183af8);}return _0x3fedc4[_0x0b40('0x1a')](_0x183af8)[_0x0b40('0x1b')]();};}function respondWithResult(_0x2d7839,_0x57a95b){_0x57a95b=_0x57a95b||0xc8;return function(_0xd124ad){if(_0xd124ad){return _0x2d7839[_0x0b40('0x1a')](_0x57a95b)[_0x0b40('0x1c')](_0xd124ad);}};}function respondWithFilteredResult(_0x4a4aa1,_0x38e04a){return function(_0x955dd2){if(_0x955dd2){var _0x1a1526=_0x955dd2[_0x0b40('0x1d')],_0x2d1785=_0x38e04a['offset'],_0x557e21=_0x38e04a[_0x0b40('0x1e')]+_0x38e04a[_0x0b40('0x1f')],_0x3c46e1;if(_0x557e21>=_0x1a1526){_0x557e21=_0x1a1526;_0x3c46e1=0xc8;}else{_0x3c46e1=0xce;}_0x4a4aa1[_0x0b40('0x1a')](_0x3c46e1);return _0x4a4aa1[_0x0b40('0x20')](_0x0b40('0x21'),_0x2d1785+'-'+_0x557e21+'/'+_0x1a1526)[_0x0b40('0x1c')](_0x955dd2);}return null;};}function patchUpdates(_0x469929){return function(_0x59f4b2){try{jsonpatch[_0x0b40('0x22')](_0x59f4b2,_0x469929,!![]);}catch(_0x4c788b){return BPromise[_0x0b40('0x23')](_0x4c788b);}return _0x59f4b2['save']();};}function saveUpdates(_0x4d62bb,_0x4924ed){return function(_0x156b5e){if(_0x156b5e){return _0x156b5e['update'](_0x4d62bb)[_0x0b40('0x24')](function(_0x41a69d){return _0x41a69d;});}return null;};}function removeEntity(_0x534f58,_0x460b55){return function(_0xb53f3){if(_0xb53f3){return _0xb53f3['destroy']()['then'](function(){_0x534f58[_0x0b40('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x801d11,_0xc8e264){return function(_0x358869){if(!_0x358869){_0x801d11[_0x0b40('0x25')](0x194);}return _0x358869;};}function handleError(_0x377af7,_0x49301d){_0x49301d=_0x49301d||0x1f4;return function(_0x28b722){logger[_0x0b40('0x26')](_0x28b722[_0x0b40('0x27')]);if(_0x28b722['name']){delete _0x28b722[_0x0b40('0x28')];}_0x377af7[_0x0b40('0x1a')](_0x49301d)['send'](_0x28b722);};}exports[_0x0b40('0x29')]=function(_0x696952,_0x1e57cd){var _0x25df3a={},_0x2eb6ee={},_0x38334d={'count':0x0,'rows':[]};var _0x15cff8=_[_0x0b40('0x2a')](db[_0x0b40('0x2b')][_0x0b40('0x2c')],function(_0xc19c21){return{'name':_0xc19c21[_0x0b40('0x2d')],'type':_0xc19c21[_0x0b40('0x2e')][_0x0b40('0x2f')]};});_0x2eb6ee[_0x0b40('0x30')]=_[_0x0b40('0x2a')](_0x15cff8,'name');_0x2eb6ee[_0x0b40('0x31')]=_[_0x0b40('0x32')](_0x696952[_0x0b40('0x31')]);_0x2eb6ee[_0x0b40('0x33')]=_[_0x0b40('0x34')](_0x2eb6ee[_0x0b40('0x30')],_0x2eb6ee[_0x0b40('0x31')]);_0x25df3a[_0x0b40('0x35')]=_[_0x0b40('0x34')](_0x2eb6ee['model'],qs['fields'](_0x696952['query'][_0x0b40('0x36')]));_0x25df3a['attributes']=_0x25df3a[_0x0b40('0x35')][_0x0b40('0x37')]?_0x25df3a[_0x0b40('0x35')]:_0x2eb6ee['model'];if(!_0x696952[_0x0b40('0x31')]['hasOwnProperty']('nolimit')){_0x25df3a[_0x0b40('0x1f')]=qs[_0x0b40('0x1f')](_0x696952[_0x0b40('0x31')][_0x0b40('0x1f')]);_0x25df3a[_0x0b40('0x1e')]=qs['offset'](_0x696952[_0x0b40('0x31')][_0x0b40('0x1e')]);}_0x25df3a[_0x0b40('0x38')]=qs[_0x0b40('0x39')](_0x696952[_0x0b40('0x31')][_0x0b40('0x39')]);_0x25df3a[_0x0b40('0x3a')]=qs[_0x0b40('0x33')](_[_0x0b40('0x3b')](_0x696952[_0x0b40('0x31')],_0x2eb6ee[_0x0b40('0x33')]),_0x15cff8);if(_0x696952[_0x0b40('0x31')][_0x0b40('0x3c')]){_0x25df3a[_0x0b40('0x3a')]=_[_0x0b40('0x3d')](_0x25df3a[_0x0b40('0x3a')],{'$or':_[_0x0b40('0x2a')](_0x15cff8,function(_0x4779f3){if(_0x4779f3[_0x0b40('0x2e')]!==_0x0b40('0x3e')){var _0x103f08={};_0x103f08[_0x4779f3[_0x0b40('0x28')]]={'$like':'%'+_0x696952[_0x0b40('0x31')][_0x0b40('0x3c')]+'%'};return _0x103f08;}})});}_0x25df3a=_[_0x0b40('0x3d')]({},_0x25df3a,_0x696952[_0x0b40('0x3f')]);var _0x5859a0={'where':_0x25df3a[_0x0b40('0x3a')]};return db['OpenchannelApplication'][_0x0b40('0x1d')](_0x5859a0)[_0x0b40('0x24')](function(_0x227702){_0x38334d[_0x0b40('0x1d')]=_0x227702;if(_0x696952[_0x0b40('0x31')][_0x0b40('0x40')]){_0x25df3a[_0x0b40('0x41')]=[{'all':!![]}];}return db[_0x0b40('0x2b')][_0x0b40('0x42')](_0x25df3a);})[_0x0b40('0x24')](function(_0x2c7d7c){_0x38334d[_0x0b40('0x43')]=_0x2c7d7c;return _0x38334d;})[_0x0b40('0x24')](respondWithFilteredResult(_0x1e57cd,_0x25df3a))[_0x0b40('0x44')](handleError(_0x1e57cd,null));};exports[_0x0b40('0x45')]=function(_0x4fea0e,_0x5c50cc){var _0x246ca5={'raw':!![],'where':{'id':_0x4fea0e[_0x0b40('0x46')]['id']}},_0x2d5183={};_0x2d5183[_0x0b40('0x30')]=_['keys'](db[_0x0b40('0x2b')][_0x0b40('0x2c')]);_0x2d5183['query']=_[_0x0b40('0x32')](_0x4fea0e[_0x0b40('0x31')]);_0x2d5183[_0x0b40('0x33')]=_['intersection'](_0x2d5183[_0x0b40('0x30')],_0x2d5183[_0x0b40('0x31')]);_0x246ca5[_0x0b40('0x35')]=_[_0x0b40('0x34')](_0x2d5183[_0x0b40('0x30')],qs[_0x0b40('0x36')](_0x4fea0e[_0x0b40('0x31')][_0x0b40('0x36')]));_0x246ca5[_0x0b40('0x35')]=_0x246ca5[_0x0b40('0x35')][_0x0b40('0x37')]?_0x246ca5[_0x0b40('0x35')]:_0x2d5183['model'];if(_0x4fea0e[_0x0b40('0x31')][_0x0b40('0x40')]){_0x246ca5[_0x0b40('0x41')]=[{'all':!![]}];}_0x246ca5=_[_0x0b40('0x3d')]({},_0x246ca5,_0x4fea0e[_0x0b40('0x3f')]);return db[_0x0b40('0x2b')]['find'](_0x246ca5)[_0x0b40('0x24')](handleEntityNotFound(_0x5c50cc,null))[_0x0b40('0x24')](respondWithResult(_0x5c50cc,null))[_0x0b40('0x44')](handleError(_0x5c50cc,null));};exports['create']=function(_0x26a6f2,_0x1a4519){return db['OpenchannelApplication'][_0x0b40('0x47')](_0x26a6f2['body'],{})['then'](respondWithResult(_0x1a4519,0xc9))[_0x0b40('0x44')](handleError(_0x1a4519,null));};exports[_0x0b40('0x48')]=function(_0x58157f,_0x3e4fd4){if(_0x58157f[_0x0b40('0x49')]['id']){delete _0x58157f[_0x0b40('0x49')]['id'];}return db['OpenchannelApplication'][_0x0b40('0x4a')]({'where':{'id':_0x58157f[_0x0b40('0x46')]['id']}})[_0x0b40('0x24')](handleEntityNotFound(_0x3e4fd4,null))['then'](saveUpdates(_0x58157f[_0x0b40('0x49')],null))[_0x0b40('0x24')](respondWithResult(_0x3e4fd4,null))[_0x0b40('0x44')](handleError(_0x3e4fd4,null));};exports[_0x0b40('0x4b')]=function(_0x36eca1,_0x245fbf){return db[_0x0b40('0x2b')][_0x0b40('0x4a')]({'where':{'id':_0x36eca1['params']['id']}})['then'](handleEntityNotFound(_0x245fbf,null))[_0x0b40('0x24')](removeEntity(_0x245fbf,null))[_0x0b40('0x44')](handleError(_0x245fbf,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1d8473a..dbe4836 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 _0x9967=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x5cc017,_0x29935e){var _0x124338=function(_0x5a40e6){while(--_0x5a40e6){_0x5cc017['push'](_0x5cc017['shift']());}};_0x124338(++_0x29935e);}(_0x9967,0x154));var _0x7996=function(_0xfd094a,_0x3a2a46){_0xfd094a=_0xfd094a-0x0;var _0x49ecdd=_0x9967[_0xfd094a];return _0x49ecdd;};'use strict';var _=require(_0x7996('0x0'));var util=require(_0x7996('0x1'));var logger=require(_0x7996('0x2'))(_0x7996('0x3'));var moment=require('moment');var BPromise=require(_0x7996('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7996('0x5'));var rimraf=require(_0x7996('0x6'));var config=require(_0x7996('0x7'));var attributes=require(_0x7996('0x8'));module[_0x7996('0x9')]=function(_0x4c4bf2,_0xd3d061){return _0x4c4bf2[_0x7996('0xa')](_0x7996('0xb'),attributes,{'tableName':_0x7996('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7996('0xd')});}; \ No newline at end of file +var _0xab0a=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','define'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0xab0a,0xd0));var _0xaab0=function(_0x190032,_0x1b1f26){_0x190032=_0x190032-0x0;var _0x1c8f97=_0xab0a[_0x190032];return _0x1c8f97;};'use strict';var _=require(_0xaab0('0x0'));var util=require(_0xaab0('0x1'));var logger=require('../../config/logger')(_0xaab0('0x2'));var moment=require('moment');var BPromise=require(_0xaab0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaab0('0x4'));var config=require(_0xaab0('0x5'));var attributes=require(_0xaab0('0x6'));module['exports']=function(_0x3b32c5,_0x22861b){return _0x3b32c5[_0xaab0('0x7')](_0xaab0('0x8'),attributes,{'tableName':_0xaab0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaab0('0xa'),'collate':_0xaab0('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 885702d..bd168ac 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 _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(_0x2c460d,_0x59f200){var _0x4e3739=function(_0x79011d){while(--_0x79011d){_0x2c460d['push'](_0x2c460d['shift']());}};_0x4e3739(++_0x59f200);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e48bf,_0x4bde87){_0x2e48bf=_0x2e48bf-0x0;var _0x2b6b2d=_0xb10b[_0x2e48bf];return _0x2b6b2d;};'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 +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(_0xe6afe8,_0x3e6fe0){var _0x3498d5=function(_0x59fdf6){while(--_0x59fdf6){_0xe6afe8['push'](_0xe6afe8['shift']());}};_0x3498d5(++_0x3e6fe0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0xb10b[_0x5eaa6a];return _0x332a98;};'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 b2555a1..66dc349 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 _0x6079=['show','/:id/messages','getMessages','/:id/download','download','post','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x1461e7,_0x4b6199){var _0x3ef2fc=function(_0x4893e8){while(--_0x4893e8){_0x1461e7['push'](_0x1461e7['shift']());}};_0x3ef2fc(++_0x4b6199);}(_0x6079,0xe2));var _0x9607=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x6079[_0x53b8e0];return _0x10630c;};'use strict';var multer=require('multer');var util=require(_0x9607('0x0'));var path=require(_0x9607('0x1'));var timeout=require(_0x9607('0x2'));var express=require(_0x9607('0x3'));var router=express[_0x9607('0x4')]();var auth=require(_0x9607('0x5'));var interaction=require(_0x9607('0x6'));var config=require(_0x9607('0x7'));var controller=require(_0x9607('0x8'));router['get']('/',auth[_0x9607('0x9')](),controller['index']);router[_0x9607('0xa')](_0x9607('0xb'),auth[_0x9607('0x9')](),controller[_0x9607('0xc')]);router[_0x9607('0xa')](_0x9607('0xd'),auth[_0x9607('0x9')](),controller[_0x9607('0xe')]);router['get'](_0x9607('0xf'),auth[_0x9607('0x9')](),controller[_0x9607('0x10')]);router[_0x9607('0xa')](_0x9607('0x11'),auth[_0x9607('0x9')](),controller[_0x9607('0x12')]);router[_0x9607('0x13')]('/',auth[_0x9607('0x9')](),controller['create']);router[_0x9607('0x13')]('/:id/messages',auth[_0x9607('0x9')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x9607('0x9')](),interaction[_0x9607('0x14')](_0x9607('0x15'),'openchannelinteraction:addtags'),controller[_0x9607('0x16')]);router[_0x9607('0x17')](_0x9607('0xd'),auth[_0x9607('0x9')](),interaction['tracked'](_0x9607('0x15'),_0x9607('0x18')),controller[_0x9607('0x19')]);router[_0x9607('0x1a')]('/:id',auth[_0x9607('0x9')](),interaction[_0x9607('0x14')](_0x9607('0x15'),_0x9607('0x1b')),controller['destroy']);router[_0x9607('0x1a')]('/:id/tags',auth[_0x9607('0x9')](),controller[_0x9607('0x1c')]);module[_0x9607('0x1d')]=router; \ No newline at end of file +var _0xee89=['show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','openchannelinteraction:addtags','openchannel','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x3ddde9,_0x1a6a2b){var _0xdfb693=function(_0x1c1c20){while(--_0x1c1c20){_0x3ddde9['push'](_0x3ddde9['shift']());}};_0xdfb693(++_0x1a6a2b);}(_0xee89,0x1e1));var _0x9ee8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xee89[_0x311c35];return _0x5cc50c;};'use strict';var multer=require('multer');var util=require(_0x9ee8('0x0'));var path=require('path');var timeout=require(_0x9ee8('0x1'));var express=require(_0x9ee8('0x2'));var router=express[_0x9ee8('0x3')]();var auth=require(_0x9ee8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9ee8('0x5'));router['get']('/',auth[_0x9ee8('0x6')](),controller[_0x9ee8('0x7')]);router[_0x9ee8('0x8')](_0x9ee8('0x9'),auth[_0x9ee8('0x6')](),controller[_0x9ee8('0xa')]);router[_0x9ee8('0x8')](_0x9ee8('0xb'),auth[_0x9ee8('0x6')](),controller[_0x9ee8('0xc')]);router['get'](_0x9ee8('0xd'),auth['isAuthenticated'](),controller[_0x9ee8('0xe')]);router[_0x9ee8('0x8')]('/:id/download',auth[_0x9ee8('0x6')](),controller[_0x9ee8('0xf')]);router[_0x9ee8('0x10')]('/',auth[_0x9ee8('0x6')](),controller['create']);router['post'](_0x9ee8('0xd'),auth['isAuthenticated'](),controller[_0x9ee8('0x11')]);router[_0x9ee8('0x10')](_0x9ee8('0x12'),auth[_0x9ee8('0x6')](),interaction['tracked']('openchannel',_0x9ee8('0x13')),controller['addTags']);router['put'](_0x9ee8('0xb'),auth[_0x9ee8('0x6')](),interaction['tracked'](_0x9ee8('0x14'),_0x9ee8('0x15')),controller[_0x9ee8('0x16')]);router[_0x9ee8('0x17')](_0x9ee8('0xb'),auth[_0x9ee8('0x6')](),interaction[_0x9ee8('0x18')](_0x9ee8('0x14'),_0x9ee8('0x19')),controller[_0x9ee8('0x1a')]);router['delete']('/:id/tags',auth[_0x9ee8('0x6')](),controller[_0x9ee8('0x1b')]);module[_0x9ee8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3478ad3..c56a875 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 _0xe7c3=['BOOLEAN','STRING','DATE','ENUM','sequelize','exports'];(function(_0xf2ec77,_0x289193){var _0x241587=function(_0x5193ce){while(--_0x5193ce){_0xf2ec77['push'](_0xf2ec77['shift']());}};_0x241587(++_0x289193);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x83045d,_0x1e8e6c){_0x83045d=_0x83045d-0x0;var _0x4d0360=_0xe7c3[_0x83045d];return _0x4d0360;};'use strict';var Sequelize=require(_0x3e7c('0x0'));module[_0x3e7c('0x1')]={'closed':{'type':Sequelize[_0x3e7c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3e7c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3e7c('0x4')]},'threadId':{'type':Sequelize[_0x3e7c('0x3')]},'externalUrl':{'type':Sequelize[_0x3e7c('0x3')]},'lastMsgAt':{'type':Sequelize[_0x3e7c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3e7c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x62ac=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0x62ac,0xc8));var _0xc62a=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0x62ac[_0x312962];return _0x3e85d0;};'use strict';var Sequelize=require(_0xc62a('0x0'));module[_0xc62a('0x1')]={'closed':{'type':Sequelize[_0xc62a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc62a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc62a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc62a('0x4')]},'note':{'type':Sequelize[_0xc62a('0x4')]},'read1stAt':{'type':Sequelize[_0xc62a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xc62a('0x4')]},'lastMsgAt':{'type':Sequelize[_0xc62a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc62a('0x5')]('in',_0xc62a('0x6')),'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 89c5216..d0d5011 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 _0xd93b=['search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','Contact','operator','$substring','split','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?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','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','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.email','c.phone','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','show','params','includeAll','include','options','create','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','OpenchannelInteractionId','format','findAll','rows','addTags','setTags','spread','emit','removeTags','download','join','files','tmp','root','server','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','existsSync','basename','firstName','out','renderFile','downloadInteraction.html','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','Users','map','Tags','TagIds','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','field','color','from','tools_tags','select','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0xd93b,0x177));var _0xbd93=function(_0x3375fb,_0x3fe72a){_0x3375fb=_0x3375fb-0x0;var _0x336c52=_0xd93b[_0x3375fb];return _0x336c52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd93('0x0'));var rimraf=require(_0xbd93('0x1'));var zipdir=require(_0xbd93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd93('0x3'));var moment=require(_0xbd93('0x4'));var BPromise=require(_0xbd93('0x5'));var Mustache=require(_0xbd93('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbd93('0x7'));var csv=require(_0xbd93('0x8'));var ejs=require(_0xbd93('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd93('0xa'));var crypto=require(_0xbd93('0xb'));var jsforce=require(_0xbd93('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbd93('0xd'));var Papa=require(_0xbd93('0xe'));var Redis=require(_0xbd93('0xf'));var authService=require(_0xbd93('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbd93('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd93('0x12'))('api');var utils=require(_0xbd93('0x13'));var config=require(_0xbd93('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbd93('0x15')]=_[_0xbd93('0x16')](config[_0xbd93('0x15')],{'host':_0xbd93('0x17'),'port':0x18eb});var socket=require(_0xbd93('0x18'))(new Redis(config[_0xbd93('0x15')]));require(_0xbd93('0x19'))['register'](socket);function respondWithStatusCode(_0x273f33,_0x181ec0){_0x181ec0=_0x181ec0||0xcc;return function(_0x2fa602){if(_0x2fa602){return _0x273f33['sendStatus'](_0x181ec0);}return _0x273f33[_0xbd93('0x1a')](_0x181ec0)[_0xbd93('0x1b')]();};}function respondWithResult(_0x2e1827,_0x40f2a4){_0x40f2a4=_0x40f2a4||0xc8;return function(_0x253c54){if(_0x253c54){return _0x2e1827[_0xbd93('0x1a')](_0x40f2a4)[_0xbd93('0x1c')](_0x253c54);}};}function respondWithFilteredResult(_0x2803ca,_0x4dacaf){return function(_0xc6936a){if(_0xc6936a){var _0x1e02f9=_0xc6936a[_0xbd93('0x1d')],_0x27452b=_0x4dacaf[_0xbd93('0x1e')],_0x325cb5=_0x4dacaf['offset']+_0x4dacaf[_0xbd93('0x1f')],_0x24969d;if(_0x325cb5>=_0x1e02f9){_0x325cb5=_0x1e02f9;_0x24969d=0xc8;}else{_0x24969d=0xce;}_0x2803ca[_0xbd93('0x1a')](_0x24969d);return _0x2803ca[_0xbd93('0x20')](_0xbd93('0x21'),_0x27452b+'-'+_0x325cb5+'/'+_0x1e02f9)[_0xbd93('0x1c')](_0xc6936a);}return null;};}function patchUpdates(_0x160365){return function(_0x331bf5){try{jsonpatch[_0xbd93('0x22')](_0x331bf5,_0x160365,!![]);}catch(_0x1aff63){return BPromise[_0xbd93('0x23')](_0x1aff63);}return _0x331bf5['save']();};}function saveUpdates(_0x24c540,_0x5666bb){return function(_0x462e5f){if(_0x462e5f){return _0x462e5f[_0xbd93('0x24')](_0x24c540)[_0xbd93('0x25')](function(_0x4cd7b8){return _0x4cd7b8;});}return null;};}function removeEntity(_0x270dc5,_0x4bc6af){return function(_0x179a01){if(_0x179a01){return _0x179a01['destroy']()['then'](function(){_0x270dc5[_0xbd93('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cee37,_0x1a57f){return function(_0x113a19){if(!_0x113a19){_0x4cee37[_0xbd93('0x26')](0x194);}return _0x113a19;};}function handleError(_0x30ce97,_0x5e7466){_0x5e7466=_0x5e7466||0x1f4;return function(_0x2460b9){logger[_0xbd93('0x27')](_0x2460b9[_0xbd93('0x28')]);if(_0x2460b9[_0xbd93('0x29')]){delete _0x2460b9['name'];}_0x30ce97[_0xbd93('0x1a')](_0x5e7466)['send'](_0x2460b9);};}function getInteractionUsers(_0x2e1ed4,_0x559e68){return new BPromise(function(_0x34447b,_0x2c774b){try{if(_0x559e68[_0x2e1ed4['id']]){_0x2e1ed4[_0xbd93('0x2a')]=_[_0xbd93('0x2b')](_0x559e68[_0x2e1ed4['id']],function(_0x4c476d){return{'id':_0x4c476d['id'],'fullname':_0x4c476d['fullname']};});}}catch(_0x2772e3){_0x2c774b(_0x2772e3);}_0x34447b(_0x2e1ed4);});}function getInteractionTags(_0x89481,_0x2cd8e3){return new BPromise(function(_0x58b80c,_0x23f1e6){try{if(_0x89481['TagIds']){_0x89481[_0xbd93('0x2c')]=[];_0x89481[_0xbd93('0x2d')]['split'](',')[_0xbd93('0x2e')](function(_0x43ce20){_0x89481[_0xbd93('0x2c')][_0xbd93('0x2f')](_0x2cd8e3[_0x43ce20]);});}delete _0x89481['TagIds'];}catch(_0x106e7e){_0x23f1e6(_0x106e7e);}_0x58b80c(_0x89481);});}function updateOpenchannelInteraction(_0x9cb8c4,_0x158b9c,_0xa513dd){return new BPromise(function(_0x1142c,_0x35d453){return getInteractionUsers(_0x9cb8c4,_0xa513dd)[_0xbd93('0x25')](function(_0x14cbc7){return getInteractionTags(_0x14cbc7,_0x158b9c);})['then'](function(_0x17c701){_0x1142c(_0x17c701);})[_0xbd93('0x30')](function(_0x55f86a){_0x35d453(_0x55f86a);});});}exports[_0xbd93('0x31')]=function(_0x1843b2,_0x94a061){var _0x7fd225={},_0x31c5b0={},_0xdb315d={'count':0x0,'rows':[]};var _0x2dd8e8=_[_0xbd93('0x2b')](db[_0xbd93('0x32')][_0xbd93('0x33')],function(_0x456487){return{'name':_0x456487['fieldName'],'type':_0x456487[_0xbd93('0x34')]['key']};});_0x31c5b0[_0xbd93('0x35')]=_[_0xbd93('0x2b')](_0x2dd8e8,_0xbd93('0x29'));_0x31c5b0[_0xbd93('0x36')]=_['keys'](_0x1843b2[_0xbd93('0x36')]);_0x31c5b0['filters']=_[_0xbd93('0x37')](_0x31c5b0[_0xbd93('0x35')],_0x31c5b0[_0xbd93('0x36')]);_0x7fd225[_0xbd93('0x38')]=_['intersection'](_0x31c5b0[_0xbd93('0x35')],qs[_0xbd93('0x39')](_0x1843b2[_0xbd93('0x36')][_0xbd93('0x39')]));_0x7fd225[_0xbd93('0x38')]=_0x7fd225[_0xbd93('0x38')][_0xbd93('0x3a')]?_0x7fd225[_0xbd93('0x38')]:_0x31c5b0[_0xbd93('0x35')];if(!_0x1843b2['query'][_0xbd93('0x3b')](_0xbd93('0x3c'))){_0x7fd225[_0xbd93('0x1f')]=qs[_0xbd93('0x1f')](_0x1843b2[_0xbd93('0x36')][_0xbd93('0x1f')]);_0x7fd225[_0xbd93('0x1e')]=qs['offset'](_0x1843b2[_0xbd93('0x36')][_0xbd93('0x1e')]);}_0x7fd225[_0xbd93('0x3d')]=qs[_0xbd93('0x3e')](_0x1843b2[_0xbd93('0x36')]['sort']);_0x7fd225[_0xbd93('0x3f')]=qs['filters'](_[_0xbd93('0x40')](_0x1843b2[_0xbd93('0x36')],_0x31c5b0[_0xbd93('0x41')]),_0x2dd8e8);var _0x296453=[];var _0x14455e=squel['select']()[_0xbd93('0x42')]('id')[_0xbd93('0x42')](_0xbd93('0x29'))['field'](_0xbd93('0x43'))[_0xbd93('0x44')](_0xbd93('0x45'));var _0x297f75=squel[_0xbd93('0x46')]()['field'](_0xbd93('0x47'))[_0xbd93('0x42')](_0xbd93('0x48'))[_0xbd93('0x42')]('ui.OpenchannelInteractionId')[_0xbd93('0x44')]('user_has_openchannel_interactions','ui')[_0xbd93('0x49')](_0xbd93('0x4a'),'u',_0xbd93('0x4b'));var _0x54f561=squel[_0xbd93('0x46')]()['from'](_0xbd93('0x4c'),'i')[_0xbd93('0x49')](_0xbd93('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xbd93('0x49')](_0xbd93('0x4a'),'o',_0xbd93('0x4e'))['left_join'](_0xbd93('0x4f'),'a',_0xbd93('0x50'))['left_join'](_0xbd93('0x51'),'me',_0xbd93('0x52'))[_0xbd93('0x49')](_0xbd93('0x53'),'it',_0xbd93('0x54'))[_0xbd93('0x49')](_0xbd93('0x45'),'t',_0xbd93('0x55'));var _0x4b473a=squel[_0xbd93('0x56')]();var _0x5464c1=[];var _0x2ff424=squel[_0xbd93('0x56')]();var _0x499b51;if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x57')]){_0x499b51=as[_0xbd93('0x58')](_0x1843b2[_0xbd93('0x36')][_0xbd93('0x57')]);var _0x57e795=_0x499b51[_0xbd93('0x59')];for(var _0x5a7996=0x0;_0x5a7996<_0x499b51['conditions'][_0xbd93('0x3a')];_0x5a7996++){var _0x203da3=_0x499b51[_0xbd93('0x5a')][_0x5a7996];var _0x5996ab='i';var _0x82b4a8=_[_0xbd93('0x5b')](_0x2dd8e8,[_0xbd93('0x29'),_0x203da3[_0xbd93('0x42')]]);if(!_0x82b4a8){switch(_0x203da3[_0xbd93('0x42')]){case'unreadMessages':if(_0x203da3[_0xbd93('0x5c')]==0x1){_0x54f561['having']('`'+_0x203da3[_0xbd93('0x42')]+_0xbd93('0x5d'));}else{_0x54f561['having']('`'+_0x203da3[_0xbd93('0x42')]+'`\x20>\x200');}break;case _0xbd93('0x5e'):if(_0x203da3[_0xbd93('0x5f')]===_0xbd93('0x60')){if(_0x203da3[_0xbd93('0x5c')][_0xbd93('0x61')]('\x20')[_0xbd93('0x3a')]>0x1){_0x4b473a[_0x57e795]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbd93('0x62')](_0x203da3[_0xbd93('0x5c')]),null);}else{var _0x1cd17a='%'+_0x203da3[_0xbd93('0x5c')]+'%';_0x4b473a[_0x57e795](_0xbd93('0x63'),_0x1cd17a,_0x1cd17a,_0x1cd17a);}}else{_0x82b4a8=_[_0xbd93('0x5b')](_0x2dd8e8,[_0xbd93('0x29'),_0xbd93('0x64')]);_0x203da3[_0xbd93('0x42')]='ContactId';_0x539407=as[_0xbd93('0x65')](_0x5996ab,_0x82b4a8[_0xbd93('0x34')],_0x203da3);_0x4b473a[_0x57e795](_0x539407[_0xbd93('0x66')],_0x539407[_0xbd93('0x5c')][_0xbd93('0x67')],_0x539407[_0xbd93('0x5c')][_0xbd93('0x1b')]);}break;case _0xbd93('0x68'):var _0x38bcef=_0x203da3[_0xbd93('0x5c')][_0xbd93('0x61')](',')[_0xbd93('0x2b')](function(_0x17daf6){return Number(_0x17daf6);});_0x38bcef['forEach'](function(_0x58f06e){_0x2ff424['or'](_0xbd93('0x69'),'%,'+_0x58f06e+',%');});_0x5464c1=_['union'](_0x5464c1,_0x38bcef);break;case'User':if(_0x203da3[_0xbd93('0x5f')]===_0xbd93('0x60')){_0x4b473a[_0x57e795](_0xbd93('0x6a'),'%'+_0x203da3['value']+'%',null);}else{_0x82b4a8=_[_0xbd93('0x5b')](_0x2dd8e8,[_0xbd93('0x29'),_0xbd93('0x6b')]);_0x203da3['field']='UserId';_0x539407=as[_0xbd93('0x65')](_0x5996ab,_0x82b4a8[_0xbd93('0x34')],_0x203da3);_0x4b473a[_0x57e795](_0x539407[_0xbd93('0x66')],_0x539407[_0xbd93('0x5c')]['start'],_0x539407[_0xbd93('0x5c')]['end']);}break;case _0xbd93('0x6c'):_0x539407=as['buildExpression']('me',null,_0x203da3);_0x4b473a[_0x57e795](_0x539407[_0xbd93('0x66')],_0x539407[_0xbd93('0x5c')][_0xbd93('0x67')],_0x539407[_0xbd93('0x5c')][_0xbd93('0x1b')]);break;}}else{var _0x539407=as['buildExpression'](_0x5996ab,_0x82b4a8[_0xbd93('0x34')],_0x203da3);_0x4b473a[_0x57e795](_0x539407[_0xbd93('0x66')],_0x539407[_0xbd93('0x5c')]['start'],_0x539407['value']['end']);}}}else{var _0xd0aab=_(_0x1843b2[_0xbd93('0x36')])[_0xbd93('0x6d')]()[_0xbd93('0x2b')](function(_0x5ed627){return _[_0xbd93('0x6e')](_0x2dd8e8,[_0xbd93('0x29'),_0x5ed627])?_0x5ed627:undefined;})[_0xbd93('0x6f')]()[_0xbd93('0x5c')]();if(!_[_0xbd93('0x70')](_0xd0aab)){_0xd0aab[_0xbd93('0x2e')](function(_0x371917){if(_0x371917===_0xbd93('0x71')){_0x54f561[_0xbd93('0x3f')](_0xbd93('0x72'),[][_0xbd93('0x73')](_0x1843b2[_0xbd93('0x36')][_0x371917]));}else if(_0x371917===_0xbd93('0x74')){var _0x38c1bc=JSON[_0xbd93('0x75')](_0x1843b2['query'][_0x371917])[_0xbd93('0x76')];var _0xd038e4=JSON[_0xbd93('0x75')](_0x1843b2['query'][_0x371917])[_0xbd93('0x77')];_0x54f561[_0xbd93('0x3f')](_0xbd93('0x78'),_0x38c1bc,_0xd038e4);}else{if(_0x1843b2['query'][_0x371917]===_0xbd93('0x79')){_0x54f561[_0xbd93('0x3f')]('i.'+_0x371917+_0xbd93('0x7a'));}else{_0x54f561[_0xbd93('0x3f')]('i.'+_0x371917+_0xbd93('0x7b'),_0x1843b2[_0xbd93('0x36')][_0x371917]);}}});}if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x7c')]){if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x7c')]==0x1){_0x54f561[_0xbd93('0x7d')](_0xbd93('0x7e'));}else{_0x54f561[_0xbd93('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0x1843b2['query'][_0xbd93('0x7f')]){_0x5464c1=_['isArray'](_0x1843b2[_0xbd93('0x36')][_0xbd93('0x7f')])?_0x1843b2[_0xbd93('0x36')][_0xbd93('0x7f')]:new Array(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x7f')]);_0x5464c1[_0xbd93('0x2e')](function(_0x1fcc14){_0x2ff424['or'](_0xbd93('0x69'),'%,'+_0x1fcc14+',%');});}if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x80')]){var _0x42bee3=_0x1843b2[_0xbd93('0x36')]['filter'][_0xbd93('0x81')]('\x5c','\x5c\x5c')[_0xbd93('0x81')](/'/g,'\x27\x27');if(qs[_0xbd93('0x82')](_0x42bee3)){_0x4b473a['or'](_0xbd93('0x83'),_0x42bee3+'%');}else{_0x4b473a['or'](_0xbd93('0x84'),qs[_0xbd93('0x62')](_0x42bee3))['or'](_0xbd93('0x85'),_0x42bee3+'%')['or'](_0xbd93('0x86'),_0x42bee3+'%');}}}_0x54f561[_0xbd93('0x3f')](_0x4b473a);_0x54f561[_0xbd93('0x87')](_0xbd93('0x88'));var _0x5ba9fb={'type':db[_0xbd93('0x89')]['QueryTypes'][_0xbd93('0x8a')],'raw':!![]};var _0x129204=_0x54f561['clone']();_0x129204[_0xbd93('0x42')](_0xbd93('0x88'));_0x129204[_0xbd93('0x42')](_0xbd93('0x8b'),_0xbd93('0x8c'));if(_0x7fd225['order']){_0x7fd225[_0xbd93('0x3d')][_0xbd93('0x2e')](function(_0x123c12){var _0x3767cf=_0x123c12[0x0]===_0xbd93('0x8d')?_0x123c12[0x0]:'i.'+_0x123c12[0x0];_0x54f561[_0xbd93('0x3d')](_0x3767cf,_0x123c12[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbd93('0x70')](_0x5464c1)){_0x54f561['having'](_0x2ff424);_0x129204['where']('t.id\x20IN\x20?',_0x5464c1);}BPromise[_0xbd93('0x8e')]()[_0xbd93('0x25')](function(){if(!_0x499b51){if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x71')])return;_0x129204[_0xbd93('0x3f')](_0xbd93('0x8f'));_0x54f561[_0xbd93('0x3f')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1843b2['user']['role']!==_0xbd93('0x90'))return;return _0x1843b2[_0xbd93('0x91')][_0xbd93('0x92')]({'attributes':['id'],'raw':!![]})[_0xbd93('0x25')](function(_0x5b7b5e){if(_[_0xbd93('0x70')](_0x5b7b5e)){_0x129204[_0xbd93('0x3f')](_0xbd93('0x93'));_0x54f561[_0xbd93('0x3f')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x129204['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xbd93('0x2b')](_0x5b7b5e,'id'));_0x54f561[_0xbd93('0x3f')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5b7b5e,'id'));}});})[_0xbd93('0x25')](function(){if(_0x1843b2['user']['role']===_0xbd93('0x90')&&!_0x499b51&&!_0x1843b2['query'][_0xbd93('0x71')])return[];return db[_0xbd93('0x94')][_0xbd93('0x36')](_0x129204['toString'](),_0x5ba9fb);})[_0xbd93('0x25')](function(_0x3e28ee){_0xdb315d[_0xbd93('0x1d')]=_0x3e28ee['length'];if(_0xdb315d[_0xbd93('0x1d')]===0x0)return[];return db[_0xbd93('0x94')]['query'](_0x14455e[_0xbd93('0x95')](),_0x5ba9fb)[_0xbd93('0x25')](function(_0x5529d4){_0x296453=_['keyBy'](_0x5529d4,'id');_0x5ba9fb=_[_0xbd93('0x96')](_0x5ba9fb,{'model':db[_0xbd93('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1843b2[_0xbd93('0x36')][_0xbd93('0x39')]){_0x7fd225[_0xbd93('0x38')][_0xbd93('0x2e')](function(_0x3081a3){_0x54f561[_0xbd93('0x42')]('i.'+_0x3081a3);});}else{_0x54f561[_0xbd93('0x42')](_0xbd93('0x8b'),_0xbd93('0x8c'));_0x54f561[_0xbd93('0x42')]('a.key',_0xbd93('0x97'));_0x54f561[_0xbd93('0x42')](_0xbd93('0x98'),_0xbd93('0x99'));_0x54f561[_0xbd93('0x42')](_0xbd93('0x9a'),_0xbd93('0x8d'));_0x54f561[_0xbd93('0x42')](_0xbd93('0x9b'));_0x54f561[_0xbd93('0x42')](_0xbd93('0x9c'),'Contact.firstName');_0x54f561[_0xbd93('0x42')]('c.lastName','Contact.lastName');_0x54f561[_0xbd93('0x42')]('c.email',_0xbd93('0x9d'));_0x54f561[_0xbd93('0x42')](_0xbd93('0x9e'),_0xbd93('0x9f'));_0x54f561['field']('c.mobile','Contact.mobile');_0x54f561[_0xbd93('0x42')]('c.fax',_0xbd93('0xa0'));_0x54f561[_0xbd93('0x42')](_0xbd93('0xa1'),_0xbd93('0xa2'));_0x54f561[_0xbd93('0x42')](_0xbd93('0xa3'),_0xbd93('0xa4'));_0x54f561['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbd93('0x2d'));}if(_0x7fd225['limit'])_0x54f561[_0xbd93('0x1f')](_0x7fd225[_0xbd93('0x1f')]);if(_0x7fd225[_0xbd93('0x1e')])_0x54f561[_0xbd93('0x1e')](_0x7fd225[_0xbd93('0x1e')]);return db[_0xbd93('0x94')][_0xbd93('0x36')](_0x54f561['toString'](),_0x5ba9fb);})[_0xbd93('0x25')](function(_0x1c2eaa){_0x297f75['where'](_0xbd93('0xa5'),_[_0xbd93('0x2b')](_0x1c2eaa,'id'));return db[_0xbd93('0x94')][_0xbd93('0x36')](_0x297f75[_0xbd93('0x95')](),_0x5ba9fb)['then'](function(_0x2e99d2){var _0x1d04c3=_['groupBy'](_0x2e99d2,'OpenchannelInteractionId');var _0x437ddb=[];_0x1c2eaa[_0xbd93('0x2e')](function(_0x5c03ff){_0x437ddb[_0xbd93('0x2f')](updateOpenchannelInteraction(_0x5c03ff,_0x296453,_0x1d04c3));});return BPromise[_0xbd93('0xa6')](_0x437ddb);});});})[_0xbd93('0x25')](function(_0xce8dbb){_0xdb315d['rows']=_0xce8dbb;return _0xdb315d;})[_0xbd93('0x25')](respondWithFilteredResult(_0x94a061,_0x7fd225))[_0xbd93('0x30')](handleError(_0x94a061,null));};exports[_0xbd93('0xa7')]=function(_0x7d6253,_0x4609d5){var _0x270fb8={};if(_0x7d6253[_0xbd93('0x36')][_0xbd93('0x34')]&&_0x7d6253[_0xbd93('0x36')][_0xbd93('0x34')]==='from'){_0x270fb8['from']=_0x7d6253[_0xbd93('0xa8')]['id'];}else{_0x270fb8['id']=_0x7d6253[_0xbd93('0xa8')]['id'];}var _0x275d1e={'raw':![],'where':_0x270fb8},_0x205163={};_0x205163[_0xbd93('0x35')]=_[_0xbd93('0x6d')](db[_0xbd93('0x32')]['rawAttributes']);_0x205163[_0xbd93('0x36')]=_[_0xbd93('0x6d')](_0x7d6253[_0xbd93('0x36')]);_0x205163[_0xbd93('0x41')]=_['intersection'](_0x205163[_0xbd93('0x35')],_0x205163[_0xbd93('0x36')]);_0x275d1e['attributes']=_[_0xbd93('0x37')](_0x205163[_0xbd93('0x35')],qs[_0xbd93('0x39')](_0x7d6253[_0xbd93('0x36')][_0xbd93('0x39')]));_0x275d1e[_0xbd93('0x38')]=_0x275d1e['attributes'][_0xbd93('0x3a')]?_0x275d1e[_0xbd93('0x38')]:_0x205163[_0xbd93('0x35')];if(_0x7d6253[_0xbd93('0x36')][_0xbd93('0xa9')]){_0x275d1e[_0xbd93('0xaa')]=[{'all':!![]}];}_0x275d1e=_[_0xbd93('0x96')]({},_0x275d1e,_0x7d6253[_0xbd93('0xab')]);return db['OpenchannelInteraction']['find'](_0x275d1e)['then'](handleEntityNotFound(_0x4609d5,null))[_0xbd93('0x25')](respondWithResult(_0x4609d5,null))[_0xbd93('0x30')](handleError(_0x4609d5,null));};exports[_0xbd93('0xac')]=function(_0x58fe69,_0x1e7ef4){return db['OpenchannelInteraction']['create'](_0x58fe69[_0xbd93('0x6c')],{})['then'](respondWithResult(_0x1e7ef4,0xc9))[_0xbd93('0x30')](handleError(_0x1e7ef4,null));};exports[_0xbd93('0x24')]=function(_0x2b4489,_0x49765a){if(_0x2b4489[_0xbd93('0x6c')]['id']){delete _0x2b4489[_0xbd93('0x6c')]['id'];}return db[_0xbd93('0x32')][_0xbd93('0x5b')]({'where':{'id':_0x2b4489[_0xbd93('0xa8')]['id']}})['then'](handleEntityNotFound(_0x49765a,null))[_0xbd93('0x25')](saveUpdates(_0x2b4489[_0xbd93('0x6c')],null))[_0xbd93('0x25')](respondWithResult(_0x49765a,null))[_0xbd93('0x30')](handleError(_0x49765a,null));};exports[_0xbd93('0xad')]=function(_0x582cd3,_0x4ca7c9){return db[_0xbd93('0x32')][_0xbd93('0x5b')]({'where':{'id':_0x582cd3['params']['id']}})['then'](handleEntityNotFound(_0x4ca7c9,null))[_0xbd93('0x25')](removeEntity(_0x4ca7c9,null))[_0xbd93('0x30')](handleError(_0x4ca7c9,null));};exports[_0xbd93('0xae')]=function(_0x3b6960,_0x49fe8b){return db[_0xbd93('0x32')][_0xbd93('0xae')]()[_0xbd93('0x25')](respondWithResult(_0x49fe8b,null))['catch'](handleError(_0x49fe8b,null));};exports[_0xbd93('0xaf')]=function(_0x42626e,_0x45d8ae,_0x1222a8){return db[_0xbd93('0xb0')][_0xbd93('0x5b')]({'where':{'id':_0x42626e[_0xbd93('0xa8')]['id']}})[_0xbd93('0x25')](handleEntityNotFound(_0x45d8ae,null))[_0xbd93('0x25')](function(_0x376f31){if(_0x376f31){return _0x376f31[_0xbd93('0xaf')](_0x42626e['body']['ids'],_[_0xbd93('0xb1')](_0x42626e['body'],[_0xbd93('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x45d8ae,null))[_0xbd93('0x30')](handleError(_0x45d8ae,null));};exports[_0xbd93('0xb3')]=function(_0x2b64a5,_0x24833a,_0x53cfd1){var _0x29cbc2={'raw':![],'where':{}};var _0x1761d0={};var _0x333583={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xbd93('0xb4')]({'where':{'id':_0x2b64a5[_0xbd93('0xa8')]['id']}})[_0xbd93('0x25')](handleEntityNotFound(_0x24833a,null))[_0xbd93('0x25')](function(_0x4ed2b8){if(_0x4ed2b8){_0x1761d0['model']=_[_0xbd93('0x6d')](db[_0xbd93('0xb0')]['rawAttributes']);_0x1761d0[_0xbd93('0x36')]=_[_0xbd93('0x6d')](_0x2b64a5[_0xbd93('0x36')]);_0x1761d0[_0xbd93('0x41')]=_[_0xbd93('0x37')](_0x1761d0[_0xbd93('0x35')],_0x1761d0['query']);_0x29cbc2[_0xbd93('0x38')]=_[_0xbd93('0x37')](_0x1761d0[_0xbd93('0x35')],qs['fields'](_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x39')]));_0x29cbc2[_0xbd93('0x38')]=_0x29cbc2['attributes'][_0xbd93('0x3a')]?_0x29cbc2[_0xbd93('0x38')]:_0x1761d0['model'];if(!_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x3b')](_0xbd93('0x3c'))){_0x29cbc2[_0xbd93('0x1f')]=qs['limit'](_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x1f')]);_0x29cbc2[_0xbd93('0x1e')]=qs['offset'](_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x1e')]);}_0x29cbc2['order']=qs['sort'](_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x3e')]);_0x29cbc2[_0xbd93('0x3f')]=qs[_0xbd93('0x41')](_['pick'](_0x2b64a5['query'],_0x1761d0[_0xbd93('0x41')]));_0x29cbc2[_0xbd93('0x3f')][_0xbd93('0xb5')]=_0x4ed2b8['id'];if(_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x80')]){_0x29cbc2[_0xbd93('0x3f')]=_[_0xbd93('0x96')](_0x29cbc2[_0xbd93('0x3f')],{'$or':_[_0xbd93('0x2b')](_0x29cbc2[_0xbd93('0x38')],function(_0x3adf53){var _0x6edd0d={};_0x6edd0d[_0x3adf53]={'$like':'%'+_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x80')]+'%'};return _0x6edd0d;})});}if(_0x2b64a5[_0xbd93('0x36')][_0xbd93('0x76')]){var _0x481a78=_0x2b64a5['query']['$gte'][_0xbd93('0x61')](',');var _0x4b75b7={};_0x4b75b7[_0x481a78[0x0]]={'$gte':moment(_0x481a78[0x1])[_0xbd93('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x29cbc2['where']=_[_0xbd93('0x96')](_0x29cbc2[_0xbd93('0x3f')],_0x4b75b7);}_0x29cbc2=_['merge']({},_0x29cbc2,_0x2b64a5[_0xbd93('0xab')]);return db[_0xbd93('0xb0')]['count']({'where':_0x29cbc2[_0xbd93('0x3f')]})[_0xbd93('0x25')](function(_0xca5e95){_0x333583[_0xbd93('0x1d')]=_0xca5e95;if(_0x2b64a5['query'][_0xbd93('0xa9')]){_0x29cbc2['include']=[{'all':!![]}];}return db[_0xbd93('0xb0')][_0xbd93('0xb7')](_0x29cbc2);})['then'](function(_0x3cc6b6){_0x333583[_0xbd93('0xb8')]=_0x3cc6b6;return _0x333583;});}})[_0xbd93('0x25')](respondWithFilteredResult(_0x24833a,_0x29cbc2))[_0xbd93('0x30')](handleError(_0x24833a,null));};exports[_0xbd93('0xb9')]=function(_0xbd0f5e,_0x175940,_0x38db5e){return db['OpenchannelInteraction']['find']({'where':{'id':_0xbd0f5e[_0xbd93('0xa8')]['id']}})[_0xbd93('0x25')](handleEntityNotFound(_0x175940,null))[_0xbd93('0x25')](function(_0x12aa8f){if(_0x12aa8f){return _0x12aa8f[_0xbd93('0xba')](_0xbd0f5e[_0xbd93('0x6c')][_0xbd93('0xb2')],_[_0xbd93('0xb1')](_0xbd0f5e[_0xbd93('0x6c')],['ids','id'])||{})[_0xbd93('0xbb')](function(){return db[_0xbd93('0x68')][_0xbd93('0xb7')]({'attributes':['id',_0xbd93('0x29'),_0xbd93('0x43')],'where':{'id':_0xbd0f5e[_0xbd93('0x6c')][_0xbd93('0xb2')]}});})[_0xbd93('0x25')](function(_0x33097a){socket[_0xbd93('0xbc')]('openchannelInteractionTags:save',{'id':Number(_0xbd0f5e[_0xbd93('0xa8')]['id']),'tags':_0x33097a||[]});return{'id':Number(_0xbd0f5e[_0xbd93('0xa8')]['id']),'tags':_0x33097a||[]};});}})[_0xbd93('0x25')](respondWithResult(_0x175940,null))['catch'](handleError(_0x175940,null));};exports[_0xbd93('0xbd')]=function(_0x38e2a0,_0x1dccf0,_0x134c48){return db[_0xbd93('0x32')]['find']({'where':{'id':_0x38e2a0['params']['id']}})[_0xbd93('0x25')](handleEntityNotFound(_0x1dccf0,null))['then'](function(_0x4a64a5){if(_0x4a64a5){return _0x4a64a5[_0xbd93('0xbd')](_0x38e2a0[_0xbd93('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x1dccf0,null))[_0xbd93('0x30')](handleError(_0x1dccf0,null));};exports[_0xbd93('0xbe')]=function(_0x36790b,_0x53ae50){var _0xd3c9da=moment()['unix']()[_0xbd93('0x95')]();var _0x37c925=path[_0xbd93('0xbf')](config['root'],'server',_0xbd93('0xc0'),_0xbd93('0xc1'));var _0x1947a6=path[_0xbd93('0xbf')](config[_0xbd93('0xc2')],_0xbd93('0xc3'),_0xbd93('0xc0'),'attachments');var _0x94acbf=path[_0xbd93('0xbf')](_0x37c925,_0xd3c9da);var _0x552726=util[_0xbd93('0xb6')](_0xbd93('0xc4'),_0x36790b['params']['id'],_0xd3c9da);var _0x34209b=path[_0xbd93('0xbf')](_0x37c925,_0x552726);var _0x125306=[];_0x125306[_0xbd93('0x2f')]({'model':db['User'],'as':_0xbd93('0xc5'),'attributes':['id','fullname'],'raw':!![]});_0x125306[_0xbd93('0x2f')]({'model':db[_0xbd93('0xc6')],'as':_0xbd93('0x5e'),'attributes':['id','firstName',_0xbd93('0xc7')],'raw':!![]});if(_0x36790b['query']['attachments']){_0x125306[_0xbd93('0x2f')]({'model':db[_0xbd93('0xc8')],'as':_0xbd93('0xc8'),'raw':!![]});}var _0x278d40=[{'model':db[_0xbd93('0xb0')],'as':_0xbd93('0xc9'),'attributes':['id',_0xbd93('0x6c'),'createdAt',_0xbd93('0xca'),_0xbd93('0xcb'),'read'],'include':_0x125306}];_0x278d40[_0xbd93('0x2f')]({'model':db[_0xbd93('0xcc')],'as':_0xbd93('0xcd'),'attributes':['id',_0xbd93('0x29')]});_0x278d40['push']({'model':db[_0xbd93('0xc5')],'as':_0xbd93('0xce'),'attributes':['id',_0xbd93('0xcf')]});return db[_0xbd93('0x32')][_0xbd93('0x5b')]({'where':{'id':_0x36790b['params']['id']},'include':_0x278d40})[_0xbd93('0x25')](handleEntityNotFound(_0x53ae50,null))['then'](function(_0x10b0db){if(_0x10b0db){var _0x35ddcf=_0x10b0db[_0xbd93('0xd0')]({'plain':!![]});fs[_0xbd93('0xd1')](_0x94acbf);var _0x1b767a={'format':'A4','border':_0xbd93('0xd2'),'header':{'height':_0xbd93('0xd3'),'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':_0xbd93('0xd4'),'contents':{'default':util[_0xbd93('0xb6')](_0xbd93('0xd5'),util[_0xbd93('0xb6')]('%s\x20#%d',_0xbd93('0xd6'),_0x35ddcf['id']),moment()['format']('YYYY-MM-DD')[_0xbd93('0x95')]())}}};var _0x44c52f={'channel':_0xbd93('0xd6'),'account':_0x35ddcf[_0xbd93('0xcd')]['name'],'agent':_0x35ddcf[_0xbd93('0xce')]?_0x35ddcf[_0xbd93('0xce')][_0xbd93('0xcf')]:_0xbd93('0xd7'),'createdAt':moment(_0x35ddcf[_0xbd93('0x74')])[_0xbd93('0xb6')](_0xbd93('0xd8'))[_0xbd93('0x95')](),'closedAt':_0x35ddcf[_0xbd93('0xd9')]?moment(_0x35ddcf[_0xbd93('0xda')])[_0xbd93('0xb6')](_0xbd93('0xd8'))[_0xbd93('0x95')]():'','disposition':_0x35ddcf[_0xbd93('0xdb')],'visibility':_0x35ddcf['threadId']?_0xbd93('0xdc'):'Private','messages':_(_0x35ddcf[_0xbd93('0xc9')])[_0xbd93('0x80')]({'secret':![]})['map'](function(_0x187d9b){if(_0x187d9b['Attachment']){var _0x233d6e=path[_0xbd93('0xbf')](_0x1947a6,_0x187d9b[_0xbd93('0xc8')]['basename']);if(fs[_0xbd93('0xdd')](_0x233d6e)){fs['createReadStream'](_0x233d6e)['pipe'](fs['createWriteStream'](path[_0xbd93('0xbf')](_0x94acbf,_0x187d9b['Attachment'][_0xbd93('0xde')])));}}return{'date':moment(_0x187d9b[_0xbd93('0x74')])[_0xbd93('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x187d9b[_0xbd93('0xca')]==='out'?_0x187d9b[_0xbd93('0xc5')]?_0x187d9b[_0xbd93('0xc5')][_0xbd93('0xcf')]:'System':_0x187d9b[_0xbd93('0x5e')][_0xbd93('0xdf')]+(_0x187d9b[_0xbd93('0x5e')][_0xbd93('0xc7')]?'\x20'+_0x187d9b[_0xbd93('0x5e')][_0xbd93('0xc7')]:''),'body':_0x187d9b[_0xbd93('0xc8')]?_0x187d9b['Attachment'][_0xbd93('0xde')]:_0x187d9b[_0xbd93('0x6c')],'direction':_0x187d9b[_0xbd93('0xca')]===_0xbd93('0xe0')?'A':'C','secret':_0x187d9b[_0xbd93('0xcb')],'read':_0x187d9b['read'],'attachment':_0x187d9b['Attachment']};})[_0xbd93('0x5c')]()};return ejs[_0xbd93('0xe1')](path['join'](config['root'],_0xbd93('0xc3'),'views',_0xbd93('0xe2')),{'interaction':_0x44c52f})[_0xbd93('0x25')](function(_0x15d4f2){return new BPromise(function(_0x5258db,_0x1f051d){pdf['create'](_0x15d4f2,_0x1b767a)['toFile'](path[_0xbd93('0xbf')](_0x94acbf,_0xbd93('0xe3')+_0x35ddcf['id']+'-'+_0xd3c9da+'.pdf'),function(_0x4922e0,_0x5c1de2){if(_0x4922e0)return _0x1f051d(_0x4922e0);_0x5258db(_0x5c1de2);});});})['then'](function(){return new BPromise(function(_0x37b950,_0x424d7c){zipdir(_0x94acbf,{'saveTo':_0x34209b},function(_0x3bada3,_0xcac8d6){if(_0x3bada3)return _0x424d7c(_0x3bada3);return _0x37b950(_0xcac8d6);});})[_0xbd93('0x25')](function(){return new BPromise(function(_0x17ebbd,_0x34484d){rimraf(_0x94acbf,function(_0x4d4e3d){if(_0x4d4e3d)_0x34484d(_0x4d4e3d);return _0x17ebbd();});});})['then'](function(){return _0x53ae50[_0xbd93('0xbe')](_0x34209b,_0x552726,function(_0x3f8bae){if(_0x3f8bae){console[_0xbd93('0xe4')](_0xbd93('0xe5'),_0x3f8bae);}else{fs[_0xbd93('0xe6')](_0x34209b);}});});});}else{return _0x53ae50['sendStatus'](0xc8);}})[_0xbd93('0x30')](handleError(_0x53ae50,null));}; \ No newline at end of file +var _0x4e7e=['Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','contactName','DESC','isEmpty','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','count','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','params','keys','includeAll','include','merge','options','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','pick','OpenchannelInteractionId','$gte','format','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','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','\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','out','System','renderFile','views','downloadInteraction.html','create','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4e7e,0x1b7));var _0xe4e7=function(_0x1660ac,_0x3cb8d5){_0x1660ac=_0x1660ac-0x0;var _0xb523bc=_0x4e7e[_0x1660ac];return _0xb523bc;};'use strict';var pdf=require(_0xe4e7('0x0'));var emlformat=require(_0xe4e7('0x1'));var rimraf=require(_0xe4e7('0x2'));var zipdir=require(_0xe4e7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4e7('0x4'));var moment=require(_0xe4e7('0x5'));var BPromise=require(_0xe4e7('0x6'));var Mustache=require('mustache');var util=require(_0xe4e7('0x7'));var path=require(_0xe4e7('0x8'));var sox=require('sox');var csv=require(_0xe4e7('0x9'));var ejs=require(_0xe4e7('0xa'));var fs=require('fs');var _=require(_0xe4e7('0xb'));var squel=require('squel');var crypto=require(_0xe4e7('0xc'));var jsforce=require(_0xe4e7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe4e7('0x9'));var querystring=require(_0xe4e7('0xe'));var Papa=require(_0xe4e7('0xf'));var Redis=require('ioredis');var authService=require(_0xe4e7('0x10'));var qs=require(_0xe4e7('0x11'));var as=require(_0xe4e7('0x12'));var hardwareService=require(_0xe4e7('0x13'));var logger=require(_0xe4e7('0x14'))(_0xe4e7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe4e7('0x16'));var db=require(_0xe4e7('0x17'))['db'];config[_0xe4e7('0x18')]=_[_0xe4e7('0x19')](config[_0xe4e7('0x18')],{'host':_0xe4e7('0x1a'),'port':0x18eb});var socket=require(_0xe4e7('0x1b'))(new Redis(config[_0xe4e7('0x18')]));require(_0xe4e7('0x1c'))['register'](socket);function respondWithStatusCode(_0x5f1c54,_0x5f30ef){_0x5f30ef=_0x5f30ef||0xcc;return function(_0x22d8f1){if(_0x22d8f1){return _0x5f1c54['sendStatus'](_0x5f30ef);}return _0x5f1c54[_0xe4e7('0x1d')](_0x5f30ef)[_0xe4e7('0x1e')]();};}function respondWithResult(_0x41ca42,_0x4810ce){_0x4810ce=_0x4810ce||0xc8;return function(_0x185425){if(_0x185425){return _0x41ca42[_0xe4e7('0x1d')](_0x4810ce)[_0xe4e7('0x1f')](_0x185425);}};}function respondWithFilteredResult(_0x32efcd,_0x12ca57){return function(_0x51d1ed){if(_0x51d1ed){var _0x198d26=_0x51d1ed['count'],_0x55d458=_0x12ca57[_0xe4e7('0x20')],_0x1846d6=_0x12ca57[_0xe4e7('0x20')]+_0x12ca57[_0xe4e7('0x21')],_0x183506;if(_0x1846d6>=_0x198d26){_0x1846d6=_0x198d26;_0x183506=0xc8;}else{_0x183506=0xce;}_0x32efcd[_0xe4e7('0x1d')](_0x183506);return _0x32efcd[_0xe4e7('0x22')](_0xe4e7('0x23'),_0x55d458+'-'+_0x1846d6+'/'+_0x198d26)[_0xe4e7('0x1f')](_0x51d1ed);}return null;};}function patchUpdates(_0x45c5de){return function(_0x1909ab){try{jsonpatch[_0xe4e7('0x24')](_0x1909ab,_0x45c5de,!![]);}catch(_0x5b993c){return BPromise[_0xe4e7('0x25')](_0x5b993c);}return _0x1909ab[_0xe4e7('0x26')]();};}function saveUpdates(_0x46bce0,_0xf0703c){return function(_0x448951){if(_0x448951){return _0x448951[_0xe4e7('0x27')](_0x46bce0)[_0xe4e7('0x28')](function(_0x5ba4ab){return _0x5ba4ab;});}return null;};}function removeEntity(_0x3efa0a,_0x2099d5){return function(_0x34fb56){if(_0x34fb56){return _0x34fb56[_0xe4e7('0x29')]()['then'](function(){_0x3efa0a[_0xe4e7('0x1d')](0xcc)[_0xe4e7('0x1e')]();});}};}function handleEntityNotFound(_0x19b68b,_0xa7c332){return function(_0x59e118){if(!_0x59e118){_0x19b68b[_0xe4e7('0x2a')](0x194);}return _0x59e118;};}function handleError(_0x333e8c,_0x19f867){_0x19f867=_0x19f867||0x1f4;return function(_0x21ef09){logger[_0xe4e7('0x2b')](_0x21ef09[_0xe4e7('0x2c')]);if(_0x21ef09['name']){delete _0x21ef09['name'];}_0x333e8c['status'](_0x19f867)['send'](_0x21ef09);};}function getInteractionUsers(_0x54461d,_0x2c2d85){return new BPromise(function(_0x53fb56,_0x38a395){try{if(_0x2c2d85[_0x54461d['id']]){_0x54461d[_0xe4e7('0x2d')]=_[_0xe4e7('0x2e')](_0x2c2d85[_0x54461d['id']],function(_0xb2d684){return{'id':_0xb2d684['id'],'fullname':_0xb2d684[_0xe4e7('0x2f')]};});}}catch(_0xf70331){_0x38a395(_0xf70331);}_0x53fb56(_0x54461d);});}function getInteractionTags(_0x5b84ca,_0x37d2b5){return new BPromise(function(_0x271fcc,_0x40312b){try{if(_0x5b84ca[_0xe4e7('0x30')]){_0x5b84ca[_0xe4e7('0x31')]=[];_0x5b84ca['TagIds'][_0xe4e7('0x32')](',')[_0xe4e7('0x33')](function(_0x4a6e8d){_0x5b84ca[_0xe4e7('0x31')][_0xe4e7('0x34')](_0x37d2b5[_0x4a6e8d]);});}delete _0x5b84ca[_0xe4e7('0x30')];}catch(_0x390d8b){_0x40312b(_0x390d8b);}_0x271fcc(_0x5b84ca);});}function updateOpenchannelInteraction(_0x274fc7,_0x32e85a,_0x5729e7){return new BPromise(function(_0x194060,_0x377cba){return getInteractionUsers(_0x274fc7,_0x5729e7)['then'](function(_0x5e5a90){return getInteractionTags(_0x5e5a90,_0x32e85a);})[_0xe4e7('0x28')](function(_0x416251){_0x194060(_0x416251);})[_0xe4e7('0x35')](function(_0xe2e701){_0x377cba(_0xe2e701);});});}exports[_0xe4e7('0x36')]=function(_0x137d9e,_0x130d2f){var _0xe1b7c={},_0x365529={},_0x4bd983={'count':0x0,'rows':[]};var _0x346294=_['map'](db[_0xe4e7('0x37')][_0xe4e7('0x38')],function(_0x36d3b9){return{'name':_0x36d3b9[_0xe4e7('0x39')],'type':_0x36d3b9[_0xe4e7('0x3a')][_0xe4e7('0x3b')]};});_0x365529[_0xe4e7('0x3c')]=_['map'](_0x346294,_0xe4e7('0x3d'));_0x365529[_0xe4e7('0x3e')]=_['keys'](_0x137d9e[_0xe4e7('0x3e')]);_0x365529[_0xe4e7('0x3f')]=_[_0xe4e7('0x40')](_0x365529[_0xe4e7('0x3c')],_0x365529[_0xe4e7('0x3e')]);_0xe1b7c[_0xe4e7('0x41')]=_[_0xe4e7('0x40')](_0x365529[_0xe4e7('0x3c')],qs[_0xe4e7('0x42')](_0x137d9e['query'][_0xe4e7('0x42')]));_0xe1b7c['attributes']=_0xe1b7c[_0xe4e7('0x41')][_0xe4e7('0x43')]?_0xe1b7c[_0xe4e7('0x41')]:_0x365529[_0xe4e7('0x3c')];if(!_0x137d9e['query']['hasOwnProperty'](_0xe4e7('0x44'))){_0xe1b7c[_0xe4e7('0x21')]=qs[_0xe4e7('0x21')](_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x21')]);_0xe1b7c[_0xe4e7('0x20')]=qs[_0xe4e7('0x20')](_0x137d9e['query'][_0xe4e7('0x20')]);}_0xe1b7c[_0xe4e7('0x45')]=qs[_0xe4e7('0x46')](_0x137d9e['query'][_0xe4e7('0x46')]);_0xe1b7c[_0xe4e7('0x47')]=qs[_0xe4e7('0x3f')](_['pick'](_0x137d9e['query'],_0x365529[_0xe4e7('0x3f')]),_0x346294);var _0x138742=[];var _0x5d24d1=squel[_0xe4e7('0x48')]()[_0xe4e7('0x49')]('id')[_0xe4e7('0x49')](_0xe4e7('0x3d'))[_0xe4e7('0x49')](_0xe4e7('0x4a'))['from']('tools_tags');var _0x51712e=squel[_0xe4e7('0x48')]()[_0xe4e7('0x49')]('u.id')[_0xe4e7('0x49')](_0xe4e7('0x4b'))['field'](_0xe4e7('0x4c'))[_0xe4e7('0x4d')](_0xe4e7('0x4e'),'ui')[_0xe4e7('0x4f')](_0xe4e7('0x50'),'u',_0xe4e7('0x51'));var _0x34ba3e=squel[_0xe4e7('0x48')]()[_0xe4e7('0x4d')](_0xe4e7('0x52'),'i')[_0xe4e7('0x4f')]('cm_contacts','c',_0xe4e7('0x53'))[_0xe4e7('0x4f')](_0xe4e7('0x50'),'o','o.id\x20=\x20i.UserId')[_0xe4e7('0x4f')]('openchannel_accounts','a',_0xe4e7('0x54'))[_0xe4e7('0x4f')]('openchannel_messages','me',_0xe4e7('0x55'))['left_join'](_0xe4e7('0x56'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xe4e7('0x57'),'t',_0xe4e7('0x58'));var _0x5a8c63=squel[_0xe4e7('0x59')]();var _0x18c7dd=[];var _0x503af6=squel['expr']();var _0x1e1487;if(_0x137d9e['query'][_0xe4e7('0x5a')]){_0x1e1487=as[_0xe4e7('0x5b')](_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x5a')]);var _0x35df69=_0x1e1487['sqlOperator'];for(var _0x49b7b1=0x0;_0x49b7b1<_0x1e1487['conditions'][_0xe4e7('0x43')];_0x49b7b1++){var _0xa5ecc3=_0x1e1487[_0xe4e7('0x5c')][_0x49b7b1];var _0x40d394='i';var _0x3f90a9=_[_0xe4e7('0x5d')](_0x346294,['name',_0xa5ecc3[_0xe4e7('0x49')]]);if(!_0x3f90a9){switch(_0xa5ecc3[_0xe4e7('0x49')]){case _0xe4e7('0x5e'):if(_0xa5ecc3[_0xe4e7('0x5f')]==0x1){_0x34ba3e[_0xe4e7('0x60')]('`'+_0xa5ecc3[_0xe4e7('0x49')]+_0xe4e7('0x61'));}else{_0x34ba3e['having']('`'+_0xa5ecc3[_0xe4e7('0x49')]+_0xe4e7('0x62'));}break;case _0xe4e7('0x63'):if(_0xa5ecc3[_0xe4e7('0x64')]===_0xe4e7('0x65')){if(_0xa5ecc3['value']['split']('\x20')['length']>0x1){_0x5a8c63[_0x35df69](_0xe4e7('0x66'),qs[_0xe4e7('0x67')](_0xa5ecc3['value']),null);}else{var _0x4cd2d4='%'+_0xa5ecc3['value']+'%';_0x5a8c63[_0x35df69](_0xe4e7('0x68'),_0x4cd2d4,_0x4cd2d4,_0x4cd2d4);}}else{_0x3f90a9=_[_0xe4e7('0x5d')](_0x346294,[_0xe4e7('0x3d'),_0xe4e7('0x69')]);_0xa5ecc3[_0xe4e7('0x49')]=_0xe4e7('0x69');_0x2b1a37=as[_0xe4e7('0x6a')](_0x40d394,_0x3f90a9[_0xe4e7('0x3a')],_0xa5ecc3);_0x5a8c63[_0x35df69](_0x2b1a37[_0xe4e7('0x6b')],_0x2b1a37[_0xe4e7('0x5f')][_0xe4e7('0x6c')],_0x2b1a37[_0xe4e7('0x5f')]['end']);}break;case _0xe4e7('0x6d'):var _0x3d0d7a=_0xa5ecc3[_0xe4e7('0x5f')][_0xe4e7('0x32')](',')['map'](function(_0x59508b){return Number(_0x59508b);});_0x3d0d7a[_0xe4e7('0x33')](function(_0x5f2043){_0x503af6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f2043+',%');});_0x18c7dd=_['union'](_0x18c7dd,_0x3d0d7a);break;case _0xe4e7('0x6e'):if(_0xa5ecc3[_0xe4e7('0x64')]===_0xe4e7('0x65')){_0x5a8c63[_0x35df69]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xa5ecc3[_0xe4e7('0x5f')]+'%',null);}else{_0x3f90a9=_[_0xe4e7('0x5d')](_0x346294,[_0xe4e7('0x3d'),'UserId']);_0xa5ecc3[_0xe4e7('0x49')]='UserId';_0x2b1a37=as['buildExpression'](_0x40d394,_0x3f90a9[_0xe4e7('0x3a')],_0xa5ecc3);_0x5a8c63[_0x35df69](_0x2b1a37[_0xe4e7('0x6b')],_0x2b1a37['value'][_0xe4e7('0x6c')],_0x2b1a37[_0xe4e7('0x5f')][_0xe4e7('0x1e')]);}break;case _0xe4e7('0x6f'):_0x2b1a37=as['buildExpression']('me',null,_0xa5ecc3);_0x5a8c63[_0x35df69](_0x2b1a37['text'],_0x2b1a37['value'][_0xe4e7('0x6c')],_0x2b1a37[_0xe4e7('0x5f')]['end']);break;}}else{var _0x2b1a37=as['buildExpression'](_0x40d394,_0x3f90a9[_0xe4e7('0x3a')],_0xa5ecc3);_0x5a8c63[_0x35df69](_0x2b1a37['text'],_0x2b1a37['value']['start'],_0x2b1a37[_0xe4e7('0x5f')][_0xe4e7('0x1e')]);}}}else{var _0x21a995=_(_0x137d9e[_0xe4e7('0x3e')])['keys']()[_0xe4e7('0x2e')](function(_0x26fe48){return _[_0xe4e7('0x70')](_0x346294,['name',_0x26fe48])?_0x26fe48:undefined;})[_0xe4e7('0x71')]()[_0xe4e7('0x5f')]();if(!_['isEmpty'](_0x21a995)){_0x21a995['forEach'](function(_0x32d473){if(_0x32d473===_0xe4e7('0x72')){_0x34ba3e[_0xe4e7('0x47')](_0xe4e7('0x73'),[][_0xe4e7('0x74')](_0x137d9e[_0xe4e7('0x3e')][_0x32d473]));}else if(_0x32d473===_0xe4e7('0x75')){var _0x4cf437=JSON['parse'](_0x137d9e['query'][_0x32d473])['$gte'];var _0x1f4883=JSON[_0xe4e7('0x76')](_0x137d9e['query'][_0x32d473])[_0xe4e7('0x77')];_0x34ba3e[_0xe4e7('0x47')](_0xe4e7('0x78'),_0x4cf437,_0x1f4883);}else{if(_0x137d9e[_0xe4e7('0x3e')][_0x32d473]===_0xe4e7('0x79')){_0x34ba3e[_0xe4e7('0x47')]('i.'+_0x32d473+'\x20IS\x20NULL');}else{_0x34ba3e['where']('i.'+_0x32d473+_0xe4e7('0x7a'),_0x137d9e['query'][_0x32d473]);}}});}if(_0x137d9e['query'][_0xe4e7('0x7b')]){if(_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x7b')]==0x1){_0x34ba3e['having'](_0xe4e7('0x7c'));}else{_0x34ba3e[_0xe4e7('0x60')](_0xe4e7('0x7d'));}}if(_0x137d9e['query']['tag']){_0x18c7dd=_['isArray'](_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x7e')])?_0x137d9e['query'][_0xe4e7('0x7e')]:new Array(_0x137d9e['query']['tag']);_0x18c7dd['forEach'](function(_0x53223f){_0x503af6['or'](_0xe4e7('0x7f'),'%,'+_0x53223f+',%');});}if(_0x137d9e['query'][_0xe4e7('0x80')]){var _0x779b4f=_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x80')][_0xe4e7('0x81')]('\x5c','\x5c\x5c')[_0xe4e7('0x81')](/'/g,'\x27\x27');if(qs[_0xe4e7('0x82')](_0x779b4f)){_0x5a8c63['or'](_0xe4e7('0x83'),_0x779b4f+'%');}else{_0x5a8c63['or'](_0xe4e7('0x84'),qs['getFullTextValue'](_0x779b4f))['or'](_0xe4e7('0x85'),_0x779b4f+'%')['or'](_0xe4e7('0x86'),_0x779b4f+'%');}}}_0x34ba3e[_0xe4e7('0x47')](_0x5a8c63);_0x34ba3e[_0xe4e7('0x87')](_0xe4e7('0x88'));var _0x1ef17b={'type':db[_0xe4e7('0x89')][_0xe4e7('0x8a')]['SELECT'],'raw':!![]};var _0x39ade4=_0x34ba3e[_0xe4e7('0x8b')]();_0x39ade4[_0xe4e7('0x49')](_0xe4e7('0x88'));_0x39ade4['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe4e7('0x5e'));if(_0xe1b7c[_0xe4e7('0x45')]){_0xe1b7c[_0xe4e7('0x45')][_0xe4e7('0x33')](function(_0xf4953a){var _0x1a5ccc=_0xf4953a[0x0]===_0xe4e7('0x8c')?_0xf4953a[0x0]:'i.'+_0xf4953a[0x0];_0x34ba3e[_0xe4e7('0x45')](_0x1a5ccc,_0xf4953a[0x1]===_0xe4e7('0x8d')?![]:!![]);});}if(!_[_0xe4e7('0x8e')](_0x18c7dd)){_0x34ba3e['having'](_0x503af6);_0x39ade4['where']('t.id\x20IN\x20?',_0x18c7dd);}BPromise[_0xe4e7('0x8f')]()[_0xe4e7('0x28')](function(){if(!_0x1e1487){if(_0x137d9e[_0xe4e7('0x3e')]['OpenchannelAccountId'])return;_0x39ade4[_0xe4e7('0x47')](_0xe4e7('0x90'));_0x34ba3e[_0xe4e7('0x47')](_0xe4e7('0x90'));return;}if(_0x137d9e['user'][_0xe4e7('0x91')]!==_0xe4e7('0x92'))return;return _0x137d9e['user'][_0xe4e7('0x93')]({'attributes':['id'],'raw':!![]})[_0xe4e7('0x28')](function(_0x4df40e){if(_[_0xe4e7('0x8e')](_0x4df40e)){_0x39ade4[_0xe4e7('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x34ba3e[_0xe4e7('0x47')](_0xe4e7('0x94'));}else{_0x39ade4[_0xe4e7('0x47')](_0xe4e7('0x73'),_['map'](_0x4df40e,'id'));_0x34ba3e['where'](_0xe4e7('0x73'),_[_0xe4e7('0x2e')](_0x4df40e,'id'));}});})[_0xe4e7('0x28')](function(){if(_0x137d9e[_0xe4e7('0x95')]['role']===_0xe4e7('0x92')&&!_0x1e1487&&!_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x72')])return[];return db[_0xe4e7('0x96')][_0xe4e7('0x3e')](_0x39ade4[_0xe4e7('0x97')](),_0x1ef17b);})[_0xe4e7('0x28')](function(_0x417d1c){_0x4bd983[_0xe4e7('0x98')]=_0x417d1c['length'];if(_0x4bd983[_0xe4e7('0x98')]===0x0)return[];return db['sequelize'][_0xe4e7('0x3e')](_0x5d24d1['toString'](),_0x1ef17b)[_0xe4e7('0x28')](function(_0x4898db){_0x138742=_[_0xe4e7('0x99')](_0x4898db,'id');_0x1ef17b=_['merge'](_0x1ef17b,{'model':db[_0xe4e7('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x137d9e[_0xe4e7('0x3e')][_0xe4e7('0x42')]){_0xe1b7c[_0xe4e7('0x41')][_0xe4e7('0x33')](function(_0x755ccd){_0x34ba3e[_0xe4e7('0x49')]('i.'+_0x755ccd);});}else{_0x34ba3e['field'](_0xe4e7('0x9a'),_0xe4e7('0x5e'));_0x34ba3e[_0xe4e7('0x49')]('a.key','Account.key');_0x34ba3e[_0xe4e7('0x49')](_0xe4e7('0x9b'),_0xe4e7('0x9c'));_0x34ba3e[_0xe4e7('0x49')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe4e7('0x8c'));_0x34ba3e['field'](_0xe4e7('0x9d'));_0x34ba3e[_0xe4e7('0x49')](_0xe4e7('0x9e'),_0xe4e7('0x9f'));_0x34ba3e['field']('c.lastName',_0xe4e7('0xa0'));_0x34ba3e[_0xe4e7('0x49')]('c.email',_0xe4e7('0xa1'));_0x34ba3e[_0xe4e7('0x49')](_0xe4e7('0xa2'),_0xe4e7('0xa3'));_0x34ba3e[_0xe4e7('0x49')](_0xe4e7('0xa4'),_0xe4e7('0xa5'));_0x34ba3e[_0xe4e7('0x49')]('c.fax',_0xe4e7('0xa6'));_0x34ba3e[_0xe4e7('0x49')]('o.fullname',_0xe4e7('0xa7'));_0x34ba3e[_0xe4e7('0x49')]('o.internal',_0xe4e7('0xa8'));_0x34ba3e[_0xe4e7('0x49')](_0xe4e7('0xa9'),_0xe4e7('0x30'));}if(_0xe1b7c[_0xe4e7('0x21')])_0x34ba3e[_0xe4e7('0x21')](_0xe1b7c['limit']);if(_0xe1b7c['offset'])_0x34ba3e[_0xe4e7('0x20')](_0xe1b7c[_0xe4e7('0x20')]);return db[_0xe4e7('0x96')]['query'](_0x34ba3e['toString'](),_0x1ef17b);})[_0xe4e7('0x28')](function(_0x31ccf0){_0x51712e[_0xe4e7('0x47')](_0xe4e7('0xaa'),_[_0xe4e7('0x2e')](_0x31ccf0,'id'));return db[_0xe4e7('0x96')][_0xe4e7('0x3e')](_0x51712e[_0xe4e7('0x97')](),_0x1ef17b)[_0xe4e7('0x28')](function(_0xfaea01){var _0x3e091b=_[_0xe4e7('0xab')](_0xfaea01,'OpenchannelInteractionId');var _0x419a5b=[];_0x31ccf0[_0xe4e7('0x33')](function(_0x389da9){_0x419a5b[_0xe4e7('0x34')](updateOpenchannelInteraction(_0x389da9,_0x138742,_0x3e091b));});return BPromise[_0xe4e7('0xac')](_0x419a5b);});});})[_0xe4e7('0x28')](function(_0x2f7fa2){_0x4bd983[_0xe4e7('0xad')]=_0x2f7fa2;return _0x4bd983;})[_0xe4e7('0x28')](respondWithFilteredResult(_0x130d2f,_0xe1b7c))['catch'](handleError(_0x130d2f,null));};exports['show']=function(_0x6f8558,_0x31ce9e){var _0x3cc466={};if(_0x6f8558['query'][_0xe4e7('0x3a')]&&_0x6f8558['query']['type']==='from'){_0x3cc466[_0xe4e7('0x4d')]=_0x6f8558[_0xe4e7('0xae')]['id'];}else{_0x3cc466['id']=_0x6f8558[_0xe4e7('0xae')]['id'];}var _0x12ad1c={'raw':![],'where':_0x3cc466},_0x934094={};_0x934094['model']=_[_0xe4e7('0xaf')](db[_0xe4e7('0x37')]['rawAttributes']);_0x934094['query']=_[_0xe4e7('0xaf')](_0x6f8558[_0xe4e7('0x3e')]);_0x934094[_0xe4e7('0x3f')]=_[_0xe4e7('0x40')](_0x934094[_0xe4e7('0x3c')],_0x934094['query']);_0x12ad1c[_0xe4e7('0x41')]=_[_0xe4e7('0x40')](_0x934094[_0xe4e7('0x3c')],qs[_0xe4e7('0x42')](_0x6f8558['query'][_0xe4e7('0x42')]));_0x12ad1c['attributes']=_0x12ad1c['attributes'][_0xe4e7('0x43')]?_0x12ad1c[_0xe4e7('0x41')]:_0x934094[_0xe4e7('0x3c')];if(_0x6f8558[_0xe4e7('0x3e')][_0xe4e7('0xb0')]){_0x12ad1c[_0xe4e7('0xb1')]=[{'all':!![]}];}_0x12ad1c=_[_0xe4e7('0xb2')]({},_0x12ad1c,_0x6f8558[_0xe4e7('0xb3')]);return db[_0xe4e7('0x37')]['find'](_0x12ad1c)['then'](handleEntityNotFound(_0x31ce9e,null))[_0xe4e7('0x28')](respondWithResult(_0x31ce9e,null))[_0xe4e7('0x35')](handleError(_0x31ce9e,null));};exports['create']=function(_0x23405b,_0x2f9a52){return db[_0xe4e7('0x37')]['create'](_0x23405b[_0xe4e7('0x6f')],{})['then'](respondWithResult(_0x2f9a52,0xc9))[_0xe4e7('0x35')](handleError(_0x2f9a52,null));};exports[_0xe4e7('0x27')]=function(_0x587f28,_0xdf9d09){if(_0x587f28[_0xe4e7('0x6f')]['id']){delete _0x587f28[_0xe4e7('0x6f')]['id'];}return db['OpenchannelInteraction'][_0xe4e7('0x5d')]({'where':{'id':_0x587f28[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0xdf9d09,null))[_0xe4e7('0x28')](saveUpdates(_0x587f28[_0xe4e7('0x6f')],null))['then'](respondWithResult(_0xdf9d09,null))[_0xe4e7('0x35')](handleError(_0xdf9d09,null));};exports[_0xe4e7('0x29')]=function(_0x430e8e,_0x362f1a){return db[_0xe4e7('0x37')][_0xe4e7('0x5d')]({'where':{'id':_0x430e8e[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0x362f1a,null))[_0xe4e7('0x28')](removeEntity(_0x362f1a,null))[_0xe4e7('0x35')](handleError(_0x362f1a,null));};exports[_0xe4e7('0xb4')]=function(_0x49e43f,_0x45a59d){return db[_0xe4e7('0x37')][_0xe4e7('0xb4')]()[_0xe4e7('0x28')](respondWithResult(_0x45a59d,null))[_0xe4e7('0x35')](handleError(_0x45a59d,null));};exports[_0xe4e7('0xb5')]=function(_0xb23039,_0x3292e7,_0x1a5013){return db[_0xe4e7('0xb6')]['find']({'where':{'id':_0xb23039[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0x3292e7,null))[_0xe4e7('0x28')](function(_0x133ea4){if(_0x133ea4){return _0x133ea4[_0xe4e7('0xb5')](_0xb23039[_0xe4e7('0x6f')]['ids'],_[_0xe4e7('0xb7')](_0xb23039[_0xe4e7('0x6f')],[_0xe4e7('0xb8'),'id'])||{});}})[_0xe4e7('0x28')](respondWithResult(_0x3292e7,null))[_0xe4e7('0x35')](handleError(_0x3292e7,null));};exports[_0xe4e7('0xb9')]=function(_0x589160,_0x31c421,_0x337658){var _0xf7384={'raw':![],'where':{}};var _0x4b5073={};var _0x50503d={'count':0x0,'rows':[]};return db[_0xe4e7('0x37')]['findOne']({'where':{'id':_0x589160[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0x31c421,null))['then'](function(_0x4e14b1){if(_0x4e14b1){_0x4b5073[_0xe4e7('0x3c')]=_[_0xe4e7('0xaf')](db[_0xe4e7('0xb6')]['rawAttributes']);_0x4b5073[_0xe4e7('0x3e')]=_['keys'](_0x589160[_0xe4e7('0x3e')]);_0x4b5073[_0xe4e7('0x3f')]=_[_0xe4e7('0x40')](_0x4b5073[_0xe4e7('0x3c')],_0x4b5073[_0xe4e7('0x3e')]);_0xf7384['attributes']=_[_0xe4e7('0x40')](_0x4b5073[_0xe4e7('0x3c')],qs[_0xe4e7('0x42')](_0x589160[_0xe4e7('0x3e')][_0xe4e7('0x42')]));_0xf7384['attributes']=_0xf7384[_0xe4e7('0x41')][_0xe4e7('0x43')]?_0xf7384[_0xe4e7('0x41')]:_0x4b5073[_0xe4e7('0x3c')];if(!_0x589160[_0xe4e7('0x3e')]['hasOwnProperty'](_0xe4e7('0x44'))){_0xf7384[_0xe4e7('0x21')]=qs[_0xe4e7('0x21')](_0x589160[_0xe4e7('0x3e')][_0xe4e7('0x21')]);_0xf7384[_0xe4e7('0x20')]=qs[_0xe4e7('0x20')](_0x589160['query'][_0xe4e7('0x20')]);}_0xf7384[_0xe4e7('0x45')]=qs[_0xe4e7('0x46')](_0x589160['query'][_0xe4e7('0x46')]);_0xf7384['where']=qs['filters'](_[_0xe4e7('0xba')](_0x589160[_0xe4e7('0x3e')],_0x4b5073[_0xe4e7('0x3f')]));_0xf7384[_0xe4e7('0x47')][_0xe4e7('0xbb')]=_0x4e14b1['id'];if(_0x589160[_0xe4e7('0x3e')][_0xe4e7('0x80')]){_0xf7384['where']=_['merge'](_0xf7384['where'],{'$or':_['map'](_0xf7384[_0xe4e7('0x41')],function(_0x122f50){var _0x26f89f={};_0x26f89f[_0x122f50]={'$like':'%'+_0x589160[_0xe4e7('0x3e')][_0xe4e7('0x80')]+'%'};return _0x26f89f;})});}if(_0x589160['query'][_0xe4e7('0xbc')]){var _0x42307e=_0x589160[_0xe4e7('0x3e')][_0xe4e7('0xbc')]['split'](',');var _0x4260c1={};_0x4260c1[_0x42307e[0x0]]={'$gte':moment(_0x42307e[0x1])[_0xe4e7('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf7384[_0xe4e7('0x47')]=_[_0xe4e7('0xb2')](_0xf7384[_0xe4e7('0x47')],_0x4260c1);}_0xf7384=_['merge']({},_0xf7384,_0x589160[_0xe4e7('0xb3')]);return db[_0xe4e7('0xb6')][_0xe4e7('0x98')]({'where':_0xf7384[_0xe4e7('0x47')]})[_0xe4e7('0x28')](function(_0x4fdc77){_0x50503d[_0xe4e7('0x98')]=_0x4fdc77;if(_0x589160[_0xe4e7('0x3e')][_0xe4e7('0xb0')]){_0xf7384[_0xe4e7('0xb1')]=[{'all':!![]}];}return db[_0xe4e7('0xb6')][_0xe4e7('0xbe')](_0xf7384);})[_0xe4e7('0x28')](function(_0x4050e1){_0x50503d[_0xe4e7('0xad')]=_0x4050e1;return _0x50503d;});}})[_0xe4e7('0x28')](respondWithFilteredResult(_0x31c421,_0xf7384))[_0xe4e7('0x35')](handleError(_0x31c421,null));};exports[_0xe4e7('0xbf')]=function(_0x44eab0,_0x2a4bb0,_0x4a7456){return db[_0xe4e7('0x37')][_0xe4e7('0x5d')]({'where':{'id':_0x44eab0[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0x2a4bb0,null))[_0xe4e7('0x28')](function(_0x25bdc0){if(_0x25bdc0){return _0x25bdc0[_0xe4e7('0xc0')](_0x44eab0[_0xe4e7('0x6f')][_0xe4e7('0xb8')],_['omit'](_0x44eab0[_0xe4e7('0x6f')],[_0xe4e7('0xb8'),'id'])||{})['spread'](function(){return db[_0xe4e7('0x6d')][_0xe4e7('0xbe')]({'attributes':['id',_0xe4e7('0x3d'),_0xe4e7('0x4a')],'where':{'id':_0x44eab0[_0xe4e7('0x6f')][_0xe4e7('0xb8')]}});})[_0xe4e7('0x28')](function(_0x304b0a){socket[_0xe4e7('0xc1')]('openchannelInteractionTags:save',{'id':Number(_0x44eab0[_0xe4e7('0xae')]['id']),'tags':_0x304b0a||[]});return{'id':Number(_0x44eab0[_0xe4e7('0xae')]['id']),'tags':_0x304b0a||[]};});}})['then'](respondWithResult(_0x2a4bb0,null))[_0xe4e7('0x35')](handleError(_0x2a4bb0,null));};exports[_0xe4e7('0xc2')]=function(_0x1bb4f9,_0x32fd2d,_0x59cd6d){return db[_0xe4e7('0x37')]['find']({'where':{'id':_0x1bb4f9[_0xe4e7('0xae')]['id']}})[_0xe4e7('0x28')](handleEntityNotFound(_0x32fd2d,null))[_0xe4e7('0x28')](function(_0x339ece){if(_0x339ece){return _0x339ece[_0xe4e7('0xc2')](_0x1bb4f9[_0xe4e7('0x3e')]['ids']);}})[_0xe4e7('0x28')](respondWithStatusCode(_0x32fd2d,null))[_0xe4e7('0x35')](handleError(_0x32fd2d,null));};exports[_0xe4e7('0xc3')]=function(_0x72f3a5,_0x100437){var _0x4caa61=moment()[_0xe4e7('0xc4')]()[_0xe4e7('0x97')]();var _0x264286=path[_0xe4e7('0xc5')](config[_0xe4e7('0xc6')],_0xe4e7('0xc7'),_0xe4e7('0xc8'),_0xe4e7('0xc9'));var _0x2e2cd2=path[_0xe4e7('0xc5')](config['root'],_0xe4e7('0xc7'),_0xe4e7('0xc8'),_0xe4e7('0xca'));var _0x1071ba=path['join'](_0x264286,_0x4caa61);var _0x729d30=util[_0xe4e7('0xbd')]('transcript-%d-%s.zip',_0x72f3a5[_0xe4e7('0xae')]['id'],_0x4caa61);var _0x4d5f06=path[_0xe4e7('0xc5')](_0x264286,_0x729d30);var _0x10fc6e=[];_0x10fc6e[_0xe4e7('0x34')]({'model':db[_0xe4e7('0x6e')],'as':_0xe4e7('0x6e'),'attributes':['id',_0xe4e7('0x2f')],'raw':!![]});_0x10fc6e['push']({'model':db[_0xe4e7('0xcb')],'as':_0xe4e7('0x63'),'attributes':['id',_0xe4e7('0xcc'),_0xe4e7('0xcd')],'raw':!![]});if(_0x72f3a5[_0xe4e7('0x3e')]['attachments']){_0x10fc6e[_0xe4e7('0x34')]({'model':db[_0xe4e7('0xce')],'as':_0xe4e7('0xce'),'raw':!![]});}var _0x24e157=[{'model':db['OpenchannelMessage'],'as':_0xe4e7('0xcf'),'attributes':['id',_0xe4e7('0x6f'),'createdAt',_0xe4e7('0xd0'),_0xe4e7('0xd1'),_0xe4e7('0x7b')],'include':_0x10fc6e}];_0x24e157[_0xe4e7('0x34')]({'model':db[_0xe4e7('0xd2')],'as':'Account','attributes':['id','name']});_0x24e157[_0xe4e7('0x34')]({'model':db[_0xe4e7('0x6e')],'as':'Owner','attributes':['id',_0xe4e7('0x2f')]});return db[_0xe4e7('0x37')][_0xe4e7('0x5d')]({'where':{'id':_0x72f3a5[_0xe4e7('0xae')]['id']},'include':_0x24e157})[_0xe4e7('0x28')](handleEntityNotFound(_0x100437,null))[_0xe4e7('0x28')](function(_0x4d5fe0){if(_0x4d5fe0){var _0x289aa1=_0x4d5fe0[_0xe4e7('0xd3')]({'plain':!![]});fs[_0xe4e7('0xd4')](_0x1071ba);var _0x6fd38a={'format':'A4','border':_0xe4e7('0xd5'),'header':{'height':'40px','contents':{'first':_0xe4e7('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0xe4e7('0xbd')](_0xe4e7('0xd7'),util['format'](_0xe4e7('0xd8'),_0xe4e7('0xd9'),_0x289aa1['id']),moment()[_0xe4e7('0xbd')]('YYYY-MM-DD')[_0xe4e7('0x97')]())}}};var _0x114bd0={'channel':'Openchannel','account':_0x289aa1['Account']['name'],'agent':_0x289aa1[_0xe4e7('0xda')]?_0x289aa1[_0xe4e7('0xda')][_0xe4e7('0x2f')]:'N.A.','createdAt':moment(_0x289aa1[_0xe4e7('0x75')])[_0xe4e7('0xbd')](_0xe4e7('0xdb'))['toString'](),'closedAt':_0x289aa1['closed']?moment(_0x289aa1[_0xe4e7('0xdc')])[_0xe4e7('0xbd')](_0xe4e7('0xdb'))['toString']():'','disposition':_0x289aa1[_0xe4e7('0xdd')],'visibility':_0x289aa1[_0xe4e7('0xde')]?_0xe4e7('0xdf'):_0xe4e7('0xe0'),'messages':_(_0x289aa1['Messages'])[_0xe4e7('0x80')]({'secret':![]})[_0xe4e7('0x2e')](function(_0x2150a2){if(_0x2150a2[_0xe4e7('0xce')]){var _0x15e770=path['join'](_0x2e2cd2,_0x2150a2[_0xe4e7('0xce')][_0xe4e7('0xe1')]);if(fs[_0xe4e7('0xe2')](_0x15e770)){fs[_0xe4e7('0xe3')](_0x15e770)[_0xe4e7('0xe4')](fs[_0xe4e7('0xe5')](path[_0xe4e7('0xc5')](_0x1071ba,_0x2150a2[_0xe4e7('0xce')][_0xe4e7('0xe1')])));}}return{'date':moment(_0x2150a2[_0xe4e7('0x75')])['format'](_0xe4e7('0xdb'))[_0xe4e7('0x97')](),'sender':_0x2150a2[_0xe4e7('0xd0')]===_0xe4e7('0xe6')?_0x2150a2['User']?_0x2150a2[_0xe4e7('0x6e')][_0xe4e7('0x2f')]:_0xe4e7('0xe7'):_0x2150a2[_0xe4e7('0x63')][_0xe4e7('0xcc')]+(_0x2150a2['Contact'][_0xe4e7('0xcd')]?'\x20'+_0x2150a2[_0xe4e7('0x63')][_0xe4e7('0xcd')]:''),'body':_0x2150a2[_0xe4e7('0xce')]?_0x2150a2[_0xe4e7('0xce')][_0xe4e7('0xe1')]:_0x2150a2[_0xe4e7('0x6f')],'direction':_0x2150a2[_0xe4e7('0xd0')]===_0xe4e7('0xe6')?'A':'C','secret':_0x2150a2[_0xe4e7('0xd1')],'read':_0x2150a2['read'],'attachment':_0x2150a2[_0xe4e7('0xce')]};})[_0xe4e7('0x5f')]()};return ejs[_0xe4e7('0xe8')](path[_0xe4e7('0xc5')](config['root'],_0xe4e7('0xc7'),_0xe4e7('0xe9'),_0xe4e7('0xea')),{'interaction':_0x114bd0})[_0xe4e7('0x28')](function(_0x4f4a4b){return new BPromise(function(_0x329a37,_0x58b05d){pdf[_0xe4e7('0xeb')](_0x4f4a4b,_0x6fd38a)[_0xe4e7('0xec')](path[_0xe4e7('0xc5')](_0x1071ba,_0xe4e7('0xed')+_0x289aa1['id']+'-'+_0x4caa61+_0xe4e7('0xee')),function(_0x4f05c0,_0x36480a){if(_0x4f05c0)return _0x58b05d(_0x4f05c0);_0x329a37(_0x36480a);});});})['then'](function(){return new BPromise(function(_0x4fc25b,_0x31b92a){zipdir(_0x1071ba,{'saveTo':_0x4d5f06},function(_0x398edf,_0x547825){if(_0x398edf)return _0x31b92a(_0x398edf);return _0x4fc25b(_0x547825);});})[_0xe4e7('0x28')](function(){return new BPromise(function(_0x125bf1,_0x5392a2){rimraf(_0x1071ba,function(_0xf8b1ac){if(_0xf8b1ac)_0x5392a2(_0xf8b1ac);return _0x125bf1();});});})[_0xe4e7('0x28')](function(){return _0x100437[_0xe4e7('0xc3')](_0x4d5f06,_0x729d30,function(_0x2d5848){if(_0x2d5848){console[_0xe4e7('0xef')](_0xe4e7('0xf0'),_0x2d5848);}else{fs[_0xe4e7('0xf1')](_0x4d5f06);}});});});}else{return _0x100437[_0xe4e7('0x2a')](0xc8);}})['catch'](handleError(_0x100437,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d80ae98..aa91827 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 _0x09a5=['remove','then','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x09a5,0x1f4));var _0x509a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x09a5[_0x187ee1];return _0x388160;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x509a('0x0'))['db'][_0x509a('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x509a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x509a('0x3'),'afterDestroy':_0x509a('0x4')};function emitEvent(_0x27e039){return function(_0x43d2ab,_0x236ac3,_0x5d11d6){_0x43d2ab['getUsers']({'attributes':['id'],'raw':!![]})[_0x509a('0x5')](function(_0x543d65){_0x43d2ab['setDataValue'](_0x509a('0x6'),_0x543d65['map'](function(_0x866857){return{'id':_0x866857['id']};}));return OpenchannelMessage[_0x509a('0x7')]({'where':{'OpenchannelInteractionId':_0x43d2ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x509a('0x5')](function(_0x10dac5){_0x43d2ab['setDataValue'](_0x509a('0x8'),_0x10dac5['length']);OpenchannelInteractionEvents[_0x509a('0x9')](_0x27e039+':'+_0x43d2ab['id'],_0x43d2ab);OpenchannelInteractionEvents['emit'](_0x27e039,_0x43d2ab);_0x5d11d6(null);})[_0x509a('0xa')](_0x5d11d6(null));};}for(var e in events){if(events[_0x509a('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x509a('0xc')](e,emitEvent(event));}}module[_0x509a('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd4d3=['setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','getUsers','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4d3,0x1ba));var _0x3d4d=function(_0x346377,_0x39789a){_0x346377=_0x346377-0x0;var _0x15ae01=_0xd4d3[_0x346377];return _0x15ae01;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3d4d('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x3d4d('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3d4d('0x1')](0x0);var events={'afterCreate':_0x3d4d('0x2'),'afterUpdate':_0x3d4d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d0916){return function(_0x2d0735,_0x34ca62,_0x168d8e){_0x2d0735[_0x3d4d('0x4')]({'attributes':['id'],'raw':!![]})[_0x3d4d('0x5')](function(_0x210eff){_0x2d0735[_0x3d4d('0x6')](_0x3d4d('0x7'),_0x210eff[_0x3d4d('0x8')](function(_0x33df07){return{'id':_0x33df07['id']};}));return OpenchannelMessage[_0x3d4d('0x9')]({'where':{'OpenchannelInteractionId':_0x2d0735['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d4d('0x5')](function(_0x4a26e4){_0x2d0735[_0x3d4d('0x6')](_0x3d4d('0xa'),_0x4a26e4['length']);OpenchannelInteractionEvents[_0x3d4d('0xb')](_0x2d0916+':'+_0x2d0735['id'],_0x2d0735);OpenchannelInteractionEvents[_0x3d4d('0xb')](_0x2d0916,_0x2d0735);_0x168d8e(null);})['catch'](_0x168d8e(null));};}for(var e in events){if(events[_0x3d4d('0xc')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x3d4d('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 67cf599..24c8350 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 _0x2d72=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d72,0xa8));var _0x22d7=function(_0x1239e3,_0x22fb68){_0x1239e3=_0x1239e3-0x0;var _0x5751d9=_0x2d72[_0x1239e3];return _0x5751d9;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x492ca8,_0x3b12cd,_0x1abed9){if(_0x492ca8[_0x22d7('0xe')](_0x22d7('0xf'))){_0x492ca8['closedAt']=moment()['format'](_0x22d7('0x10'));}_0x1abed9(null,_0x492ca8);}}});}; \ No newline at end of file +var _0x8ece=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23f302,_0x4f652b){var _0xdd9093=function(_0x3dc6fe){while(--_0x3dc6fe){_0x23f302['push'](_0x23f302['shift']());}};_0xdd9093(++_0x4f652b);}(_0x8ece,0x195));var _0xe8ec=function(_0x25bbb9,_0x5a4bc4){_0x25bbb9=_0x25bbb9-0x0;var _0x38f504=_0x8ece[_0x25bbb9];return _0x38f504;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var logger=require(_0xe8ec('0x2'))(_0xe8ec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8ec('0x4'));var fs=require('fs');var path=require(_0xe8ec('0x5'));var rimraf=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var attributes=require(_0xe8ec('0x8'));module['exports']=function(_0x346577,_0x23fa35){return _0x346577[_0xe8ec('0x9')](_0xe8ec('0xa'),attributes,{'tableName':_0xe8ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x122f36,_0x406f7e,_0x5525f8){if(_0x122f36[_0xe8ec('0xc')]('closed')){_0x122f36[_0xe8ec('0xd')]=moment()['format'](_0xe8ec('0xe'));}_0x5525f8(null,_0x122f36);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 627f3e7..6888c54 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 _0x212d=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','info','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util'];(function(_0x2c9753,_0x201ce2){var _0xf98546=function(_0x17920e){while(--_0x17920e){_0x2c9753['push'](_0x2c9753['shift']());}};_0xf98546(++_0x201ce2);}(_0x212d,0xa6));var _0xd212=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x212d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd212('0x0'));var util=require(_0xd212('0x1'));var moment=require(_0xd212('0x2'));var BPromise=require('bluebird');var rs=require(_0xd212('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd212('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd212('0x5'))(_0xd212('0x6'));var config=require(_0xd212('0x7'));var jayson=require(_0xd212('0x8'));var client=jayson['client'][_0xd212('0x9')]({'port':0x232a});config['redis']=_[_0xd212('0xa')](config[_0xd212('0xb')],{'host':_0xd212('0xc'),'port':0x18eb});var socket=require(_0xd212('0xd'))(new Redis(config[_0xd212('0xb')]));require('./openchannelInteraction.socket')[_0xd212('0xe')](socket);function respondWithRpcPromise(_0x507bb0,_0x38af03,_0x51c0c1){return new BPromise(function(_0x4263b2,_0x440d2e){return client['request'](_0x507bb0,_0x51c0c1)[_0xd212('0xf')](function(_0x1ccfcf){logger['info'](_0xd212('0x10'),_0x38af03,'request\x20sent');logger[_0xd212('0x11')](_0xd212('0x12'),_0x38af03,'request\x20sent',JSON[_0xd212('0x13')](_0x1ccfcf));if(_0x1ccfcf[_0xd212('0x14')]){if(_0x1ccfcf[_0xd212('0x14')][_0xd212('0x15')]===0x1f4){logger[_0xd212('0x14')](_0xd212('0x10'),_0x38af03,_0x1ccfcf[_0xd212('0x14')][_0xd212('0x16')]);return _0x440d2e(_0x1ccfcf[_0xd212('0x14')][_0xd212('0x16')]);}logger[_0xd212('0x14')](_0xd212('0x10'),_0x38af03,_0x1ccfcf[_0xd212('0x14')][_0xd212('0x16')]);return _0x4263b2(_0x1ccfcf['error'][_0xd212('0x16')]);}else{logger['info'](_0xd212('0x10'),_0x38af03,_0xd212('0x17'));_0x4263b2(_0x1ccfcf[_0xd212('0x18')][_0xd212('0x16')]);}})[_0xd212('0x19')](function(_0x5cf300){logger[_0xd212('0x14')](_0xd212('0x10'),_0x38af03,_0x5cf300);_0x440d2e(_0x5cf300);});});}exports['UpdateOpenchannelInteraction']=function(_0x28f42c){var _0x4339db=this;return new Promise(function(_0x5dc3e8,_0x2edcce){return db[_0xd212('0x1a')][_0xd212('0x1b')](_0x28f42c[_0xd212('0x1c')],{'raw':_0x28f42c[_0xd212('0x1d')]?_0x28f42c['options'][_0xd212('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f42c['options']?_0x28f42c['options'][_0xd212('0x1f')]||null:null,'attributes':_0x28f42c['options']?_0x28f42c['options'][_0xd212('0x20')]||null:null,'limit':_0x28f42c[_0xd212('0x1d')]?_0x28f42c[_0xd212('0x1d')][_0xd212('0x21')]||null:null})[_0xd212('0xf')](function(_0x1bc517){logger[_0xd212('0x22')]('UpdateOpenchannelInteraction',_0x28f42c);logger['debug'](_0xd212('0x23'),_0x28f42c,JSON['stringify'](_0x1bc517));_0x5dc3e8(_0x1bc517);})['catch'](function(_0x180364){logger[_0xd212('0x14')](_0xd212('0x23'),_0x180364[_0xd212('0x16')],_0x28f42c);_0x2edcce(_0x4339db[_0xd212('0x14')](0x1f4,_0x180364['message']));});});};exports[_0xd212('0x24')]=function(_0x5a9e3f){return new Promise(function(_0x2f53b7,_0x1e8286){return db[_0xd212('0x1a')][_0xd212('0x25')]({'where':_0x5a9e3f[_0xd212('0x1d')]?_0x5a9e3f[_0xd212('0x1d')][_0xd212('0x1f')]||null:null})[_0xd212('0xf')](function(_0xf30a15){if(_0xf30a15){return _0xf30a15[_0xd212('0x26')](_0x5a9e3f[_0xd212('0x1c')][_0xd212('0x27')],_['omit'](_0x5a9e3f['body'],['ids','id'])||{});}})[_0xd212('0x28')](function(_0x50ee71){logger['info']('AddTags',_0x5a9e3f);logger[_0xd212('0x11')](_0xd212('0x29'),_0x5a9e3f,JSON[_0xd212('0x13')](_0x50ee71));_0x2f53b7(_0x50ee71);})['catch'](function(_0x3d5955){logger['error'](_0xd212('0x29'),_0x3d5955[_0xd212('0x16')],_0x5a9e3f);_0x1e8286(_this[_0xd212('0x14')](0x1f4,_0x3d5955[_0xd212('0x16')]));});});}; \ No newline at end of file +var _0x9244=['info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x4cde2b,_0x53abb8){var _0x2b6784=function(_0x4c49e3){while(--_0x4c49e3){_0x4cde2b['push'](_0x4cde2b['shift']());}};_0x2b6784(++_0x53abb8);}(_0x9244,0x165));var _0x4924=function(_0x5d4540,_0x3f654b){_0x5d4540=_0x5d4540-0x0;var _0x41f468=_0x9244[_0x5d4540];return _0x41f468;};'use strict';var _=require('lodash');var util=require(_0x4924('0x0'));var moment=require('moment');var BPromise=require(_0x4924('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4924('0x2'));var db=require(_0x4924('0x3'))['db'];var utils=require(_0x4924('0x4'));var logger=require(_0x4924('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4924('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x4924('0x7')]=_['defaults'](config['redis'],{'host':_0x4924('0x8'),'port':0x18eb});var socket=require(_0x4924('0x9'))(new Redis(config[_0x4924('0x7')]));require('./openchannelInteraction.socket')[_0x4924('0xa')](socket);function respondWithRpcPromise(_0x307eb2,_0x4ebe5e,_0x4e5036){return new BPromise(function(_0x7d325d,_0x13a736){return client[_0x4924('0xb')](_0x307eb2,_0x4e5036)[_0x4924('0xc')](function(_0x4fe280){logger[_0x4924('0xd')](_0x4924('0xe'),_0x4ebe5e,_0x4924('0xf'));logger[_0x4924('0x10')](_0x4924('0x11'),_0x4ebe5e,_0x4924('0xf'),JSON[_0x4924('0x12')](_0x4fe280));if(_0x4fe280[_0x4924('0x13')]){if(_0x4fe280['error'][_0x4924('0x14')]===0x1f4){logger['error'](_0x4924('0xe'),_0x4ebe5e,_0x4fe280[_0x4924('0x13')][_0x4924('0x15')]);return _0x13a736(_0x4fe280['error'][_0x4924('0x15')]);}logger[_0x4924('0x13')](_0x4924('0xe'),_0x4ebe5e,_0x4fe280[_0x4924('0x13')][_0x4924('0x15')]);return _0x7d325d(_0x4fe280[_0x4924('0x13')]['message']);}else{logger[_0x4924('0xd')](_0x4924('0xe'),_0x4ebe5e,_0x4924('0xf'));_0x7d325d(_0x4fe280['result']['message']);}})[_0x4924('0x16')](function(_0x455418){logger[_0x4924('0x13')](_0x4924('0xe'),_0x4ebe5e,_0x455418);_0x13a736(_0x455418);});});}exports['UpdateOpenchannelInteraction']=function(_0x3dbe62){var _0x69812d=this;return new Promise(function(_0x55b068,_0x1a615c){return db[_0x4924('0x17')]['update'](_0x3dbe62[_0x4924('0x18')],{'raw':_0x3dbe62[_0x4924('0x19')]?_0x3dbe62[_0x4924('0x19')][_0x4924('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dbe62['options']?_0x3dbe62[_0x4924('0x19')][_0x4924('0x1b')]||null:null,'attributes':_0x3dbe62[_0x4924('0x19')]?_0x3dbe62[_0x4924('0x19')][_0x4924('0x1c')]||null:null,'limit':_0x3dbe62[_0x4924('0x19')]?_0x3dbe62['options'][_0x4924('0x1d')]||null:null})['then'](function(_0x3cad8b){logger[_0x4924('0xd')](_0x4924('0x1e'),_0x3dbe62);logger[_0x4924('0x10')](_0x4924('0x1e'),_0x3dbe62,JSON[_0x4924('0x12')](_0x3cad8b));_0x55b068(_0x3cad8b);})[_0x4924('0x16')](function(_0x115874){logger['error']('UpdateOpenchannelInteraction',_0x115874[_0x4924('0x15')],_0x3dbe62);_0x1a615c(_0x69812d[_0x4924('0x13')](0x1f4,_0x115874[_0x4924('0x15')]));});});};exports[_0x4924('0x1f')]=function(_0x3c8b22){return new Promise(function(_0x2d0387,_0xff71fc){return db[_0x4924('0x17')][_0x4924('0x20')]({'where':_0x3c8b22[_0x4924('0x19')]?_0x3c8b22[_0x4924('0x19')]['where']||null:null})[_0x4924('0xc')](function(_0x1f479b){if(_0x1f479b){return _0x1f479b['addTags'](_0x3c8b22[_0x4924('0x18')][_0x4924('0x21')],_[_0x4924('0x22')](_0x3c8b22[_0x4924('0x18')],[_0x4924('0x21'),'id'])||{});}})[_0x4924('0x23')](function(_0x13a0b8){logger[_0x4924('0xd')](_0x4924('0x24'),_0x3c8b22);logger[_0x4924('0x10')](_0x4924('0x24'),_0x3c8b22,JSON[_0x4924('0x12')](_0x13a0b8));_0x2d0387(_0x13a0b8);})[_0x4924('0x16')](function(_0x4f5517){logger[_0x4924('0x13')]('AddTags',_0x4f5517['message'],_0x3c8b22);_0xff71fc(_this['error'](0x1f4,_0x4f5517['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2f83c4b..327c360 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 _0xe470=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener'];(function(_0x3c4276,_0x21d8b0){var _0x31e4ab=function(_0x332a82){while(--_0x332a82){_0x3c4276['push'](_0x3c4276['shift']());}};_0x31e4ab(++_0x21d8b0);}(_0xe470,0x106));var _0x0e47=function(_0x522e80,_0x43f4f0){_0x522e80=_0x522e80-0x0;var _0x463ffc=_0xe470[_0x522e80];return _0x463ffc;};'use strict';var OpenchannelInteractionEvents=require(_0x0e47('0x0'));var events=[_0x0e47('0x1'),'remove',_0x0e47('0x2')];function createListener(_0x47d26f,_0x3ab934){return function(_0x3513d7){_0x3ab934['emit'](_0x47d26f,_0x3513d7);};}function removeListener(_0x4090cf,_0x5508b2){return function(){OpenchannelInteractionEvents[_0x0e47('0x3')](_0x4090cf,_0x5508b2);};}exports[_0x0e47('0x4')]=function(_0x491c7b){for(var _0xc3b372=0x0,_0x41e7d9=events[_0x0e47('0x5')];_0xc3b372<_0x41e7d9;_0xc3b372++){var _0x38086f=events[_0xc3b372];var _0x38fe5b=createListener(_0x0e47('0x6')+_0x38086f,_0x491c7b);OpenchannelInteractionEvents['on'](_0x38086f,_0x38fe5b);}}; \ No newline at end of file +var _0x55cb=['./openchannelInteraction.events','save','remove','emit','register','length','openchannelInteraction:'];(function(_0x149653,_0x3bcd29){var _0x12bfff=function(_0x197c27){while(--_0x197c27){_0x149653['push'](_0x149653['shift']());}};_0x12bfff(++_0x3bcd29);}(_0x55cb,0x150));var _0xb55c=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x55cb[_0x1aab74];return _0x396af2;};'use strict';var OpenchannelInteractionEvents=require(_0xb55c('0x0'));var events=[_0xb55c('0x1'),_0xb55c('0x2'),'update'];function createListener(_0x5ca940,_0x3b5f44){return function(_0xf42c15){_0x3b5f44[_0xb55c('0x3')](_0x5ca940,_0xf42c15);};}function removeListener(_0x1afcf9,_0x134693){return function(){OpenchannelInteractionEvents['removeListener'](_0x1afcf9,_0x134693);};}exports[_0xb55c('0x4')]=function(_0x420d84){for(var _0x38ce01=0x0,_0x451f40=events[_0xb55c('0x5')];_0x38ce01<_0x451f40;_0x38ce01++){var _0x5e0c96=events[_0x38ce01];var _0x2a935c=createListener(_0xb55c('0x6')+_0x5e0c96,_0x420d84);OpenchannelInteractionEvents['on'](_0x5e0c96,_0x2a935c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 835e5c0..a42764a 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 _0x403c=['put','update','/:id/accept','reject','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','tracked','openchannelmessage:create','create'];(function(_0x13e3b8,_0x415d23){var _0x38c6ff=function(_0x4906ab){while(--_0x4906ab){_0x13e3b8['push'](_0x13e3b8['shift']());}};_0x38c6ff(++_0x415d23);}(_0x403c,0x64));var _0xc403=function(_0x4cda0c,_0x23caea){_0x4cda0c=_0x4cda0c-0x0;var _0x5c601a=_0x403c[_0x4cda0c];return _0x5c601a;};'use strict';var multer=require(_0xc403('0x0'));var util=require(_0xc403('0x1'));var path=require('path');var timeout=require(_0xc403('0x2'));var express=require(_0xc403('0x3'));var router=express[_0xc403('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc403('0x5'));var config=require(_0xc403('0x6'));var controller=require(_0xc403('0x7'));router[_0xc403('0x8')]('/',auth[_0xc403('0x9')](),controller['index']);router[_0xc403('0x8')](_0xc403('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc403('0x8')]('/:id',auth[_0xc403('0x9')](),controller['show']);router['post']('/',auth[_0xc403('0x9')](),interaction[_0xc403('0xb')]('openchannel',_0xc403('0xc')),controller[_0xc403('0xd')]);router[_0xc403('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc403('0xf')]);router['put'](_0xc403('0x10'),auth[_0xc403('0x9')](),controller['accept']);router[_0xc403('0xe')]('/:id/reject',auth['isAuthenticated'](),controller[_0xc403('0x11')]);router['delete']('/:id',auth[_0xc403('0x9')](),controller['destroy']);module[_0xc403('0x12')]=router; \ No newline at end of file +var _0x8cf9=['express','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','isAuthenticated','show','post','openchannel','/:id','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8cf9,0x1cb));var _0x98cf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8cf9[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x98cf('0x0'));var util=require(_0x98cf('0x1'));var path=require('path');var timeout=require(_0x98cf('0x2'));var express=require(_0x98cf('0x3'));var router=express['Router']();var auth=require(_0x98cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x98cf('0x5'));var controller=require(_0x98cf('0x6'));router[_0x98cf('0x7')]('/',auth['isAuthenticated'](),controller[_0x98cf('0x8')]);router[_0x98cf('0x7')](_0x98cf('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x98cf('0xa')](),controller[_0x98cf('0xb')]);router[_0x98cf('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x98cf('0xd'),'openchannelmessage:create'),controller['create']);router['put'](_0x98cf('0xe'),auth[_0x98cf('0xa')](),controller['update']);router[_0x98cf('0xf')](_0x98cf('0x10'),auth[_0x98cf('0xa')](),controller[_0x98cf('0x11')]);router[_0x98cf('0xf')](_0x98cf('0x12'),auth[_0x98cf('0xa')](),controller[_0x98cf('0x13')]);router['delete'](_0x98cf('0xe'),auth['isAuthenticated'](),controller[_0x98cf('0x14')]);module[_0x98cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6d87b9c..f000d75 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 _0x8d83=['medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT'];(function(_0x29b3a2,_0x130e3e){var _0x2a49e7=function(_0x55a44b){while(--_0x55a44b){_0x29b3a2['push'](_0x29b3a2['shift']());}};_0x2a49e7(++_0x130e3e);}(_0x8d83,0x11e));var _0x38d8=function(_0x45d987,_0x44b0e8){_0x45d987=_0x45d987-0x0;var _0x10e189=_0x8d83[_0x45d987];return _0x10e189;};'use strict';var Sequelize=require(_0x38d8('0x0'));module['exports']={'body':{'type':Sequelize[_0x38d8('0x1')](_0x38d8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x38d8('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x38d8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x38d8('0x4')]('in',_0x38d8('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x38d8('0x6')]},'providerName':{'type':Sequelize[_0x38d8('0x7')]},'providerResponse':{'type':Sequelize[_0x38d8('0x1')]}}; \ No newline at end of file +var _0xc333=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x1e7659,_0x42b9ef){var _0xd747a5=function(_0x3f6d72){while(--_0x3f6d72){_0x1e7659['push'](_0x1e7659['shift']());}};_0xd747a5(++_0x42b9ef);}(_0xc333,0x13f));var _0x3c33=function(_0x254422,_0x103422){_0x254422=_0x254422-0x0;var _0x1c9ef1=_0xc333[_0x254422];return _0x1c9ef1;};'use strict';var Sequelize=require(_0x3c33('0x0'));module[_0x3c33('0x1')]={'body':{'type':Sequelize[_0x3c33('0x2')](_0x3c33('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3c33('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c33('0x5')]('in',_0x3c33('0x6')),'defaultValue':_0x3c33('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3c33('0x7')]},'providerResponse':{'type':Sequelize[_0x3c33('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6c3db19..b92ea2b 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 _0x030c=['isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','SIP/%s','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','channel','event','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','end','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x030c,0xfe));var _0xc030=function(_0x49f795,_0x89dea1){_0x49f795=_0x49f795-0x0;var _0x5a4d7d=_0x030c[_0x49f795];return _0x5a4d7d;};'use strict';var pdf=require(_0xc030('0x0'));var emlformat=require(_0xc030('0x1'));var rimraf=require(_0xc030('0x2'));var zipdir=require(_0xc030('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc030('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc030('0x5'));var util=require(_0xc030('0x6'));var path=require('path');var sox=require(_0xc030('0x7'));var csv=require('to-csv');var ejs=require(_0xc030('0x8'));var fs=require('fs');var _=require(_0xc030('0x9'));var squel=require(_0xc030('0xa'));var crypto=require(_0xc030('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc030('0xc'));var toCsv=require(_0xc030('0xd'));var querystring=require(_0xc030('0xe'));var Papa=require('papaparse');var Redis=require(_0xc030('0xf'));var authService=require(_0xc030('0x10'));var qs=require(_0xc030('0x11'));var as=require(_0xc030('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc030('0x13'))(_0xc030('0x14'));var utils=require(_0xc030('0x15'));var config=require(_0xc030('0x16'));var licenseUtil=require(_0xc030('0x17'));var db=require('../../mysqldb')['db'];config[_0xc030('0x18')]=_[_0xc030('0x19')](config[_0xc030('0x18')],{'host':_0xc030('0x1a'),'port':0x18eb});var socket=require(_0xc030('0x1b'))(new Redis(config[_0xc030('0x18')]));require('./openchannelMessage.socket')[_0xc030('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc030('0x1d')][_0xc030('0x1e')]({'port':0x232c});var client9002=jayson[_0xc030('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24dd8c,_0x3ea8f2,_0x593f74,_0xa2c532){return new BPromise(function(_0x52914f,_0xe05d51){var _0x1c5624=_0xa2c532||client;return _0x1c5624[_0xc030('0x1f')](_0x24dd8c,_0x593f74)['then'](function(_0xe3fbc1){logger['info'](_0xc030('0x20'),_0x3ea8f2,_0xc030('0x21'));logger[_0xc030('0x22')](_0xc030('0x23'),_0x3ea8f2,'request\x20sent',JSON[_0xc030('0x24')](_0xe3fbc1));if(_0xe3fbc1[_0xc030('0x25')]){if(_0xe3fbc1['error'][_0xc030('0x26')]===0x1f4){logger[_0xc030('0x25')](_0xc030('0x20'),_0x3ea8f2,_0xe3fbc1[_0xc030('0x25')][_0xc030('0x27')]);return _0xe05d51(_0xe3fbc1['error']['message']);}logger[_0xc030('0x25')](_0xc030('0x20'),_0x3ea8f2,_0xe3fbc1['error'][_0xc030('0x27')]);return _0x52914f(_0xe3fbc1[_0xc030('0x25')][_0xc030('0x27')]);}else{logger[_0xc030('0x28')](_0xc030('0x20'),_0x3ea8f2,_0xc030('0x21'));_0x52914f(_0xe3fbc1[_0xc030('0x29')]['message']);}})['catch'](function(_0x5cbeab){logger[_0xc030('0x25')](_0xc030('0x20'),_0x3ea8f2,_0x5cbeab);_0xe05d51(_0x5cbeab);});});}function respondWithStatusCode(_0x388e2e,_0x34b4c8){_0x34b4c8=_0x34b4c8||0xcc;return function(_0x4028d5){if(_0x4028d5){return _0x388e2e[_0xc030('0x2a')](_0x34b4c8);}return _0x388e2e[_0xc030('0x2b')](_0x34b4c8)['end']();};}function respondWithResult(_0x4082ec,_0x38d148){_0x38d148=_0x38d148||0xc8;return function(_0x5da083){if(_0x5da083){return _0x4082ec['status'](_0x38d148)[_0xc030('0x2c')](_0x5da083);}};}function respondWithFilteredResult(_0x2c51c4,_0x3c82c7){return function(_0x184603){if(_0x184603){var _0x58c716=_0x184603[_0xc030('0x2d')],_0x1e088d=_0x3c82c7[_0xc030('0x2e')],_0xce31e5=_0x3c82c7[_0xc030('0x2e')]+_0x3c82c7[_0xc030('0x2f')],_0x1ca0ff;if(_0xce31e5>=_0x58c716){_0xce31e5=_0x58c716;_0x1ca0ff=0xc8;}else{_0x1ca0ff=0xce;}_0x2c51c4[_0xc030('0x2b')](_0x1ca0ff);return _0x2c51c4[_0xc030('0x30')](_0xc030('0x31'),_0x1e088d+'-'+_0xce31e5+'/'+_0x58c716)[_0xc030('0x2c')](_0x184603);}return null;};}function patchUpdates(_0x926662){return function(_0x18fd5d){try{jsonpatch[_0xc030('0x32')](_0x18fd5d,_0x926662,!![]);}catch(_0x1e9410){return BPromise['reject'](_0x1e9410);}return _0x18fd5d[_0xc030('0x33')]();};}function saveUpdates(_0x1b4246,_0x4cdcc7){return function(_0x1e5632){if(_0x1e5632){return _0x1e5632['update'](_0x1b4246)['then'](function(_0x221c71){return _0x221c71;});}return null;};}function removeEntity(_0x50a5fa,_0x238a3e){return function(_0x3bb3c3){if(_0x3bb3c3){return _0x3bb3c3[_0xc030('0x34')]()['then'](function(){_0x50a5fa['status'](0xcc)[_0xc030('0x35')]();});}};}function handleEntityNotFound(_0x49f44e,_0x11f74a){return function(_0x5867f5){if(!_0x5867f5){_0x49f44e[_0xc030('0x2a')](0x194);}return _0x5867f5;};}function handleError(_0x4ff789,_0xf82187){_0xf82187=_0xf82187||0x1f4;return function(_0x10975f){logger[_0xc030('0x25')](_0x10975f[_0xc030('0x36')]);if(_0x10975f[_0xc030('0x37')]){delete _0x10975f[_0xc030('0x37')];}_0x4ff789[_0xc030('0x2b')](_0xf82187)['send'](_0x10975f);};}exports[_0xc030('0x38')]=function(_0x45552b,_0x522435){var _0x2de465={},_0x1cc4d3={},_0x385c10={'count':0x0,'rows':[]};var _0x1d0f7c=_[_0xc030('0x39')](db[_0xc030('0x3a')][_0xc030('0x3b')],function(_0x5036ac){return{'name':_0x5036ac[_0xc030('0x3c')],'type':_0x5036ac['type']['key']};});_0x1cc4d3['model']=_[_0xc030('0x39')](_0x1d0f7c,_0xc030('0x37'));_0x1cc4d3[_0xc030('0x3d')]=_['keys'](_0x45552b[_0xc030('0x3d')]);_0x1cc4d3[_0xc030('0x3e')]=_[_0xc030('0x3f')](_0x1cc4d3[_0xc030('0x40')],_0x1cc4d3[_0xc030('0x3d')]);_0x2de465[_0xc030('0x41')]=_[_0xc030('0x3f')](_0x1cc4d3[_0xc030('0x40')],qs['fields'](_0x45552b['query']['fields']));_0x2de465[_0xc030('0x41')]=_0x2de465[_0xc030('0x41')]['length']?_0x2de465[_0xc030('0x41')]:_0x1cc4d3[_0xc030('0x40')];if(!_0x45552b[_0xc030('0x3d')][_0xc030('0x42')](_0xc030('0x43'))){_0x2de465['limit']=qs['limit'](_0x45552b[_0xc030('0x3d')]['limit']);_0x2de465[_0xc030('0x2e')]=qs[_0xc030('0x2e')](_0x45552b[_0xc030('0x3d')]['offset']);}_0x2de465['order']=qs[_0xc030('0x44')](_0x45552b[_0xc030('0x3d')][_0xc030('0x44')]);_0x2de465[_0xc030('0x45')]=qs[_0xc030('0x3e')](_[_0xc030('0x46')](_0x45552b[_0xc030('0x3d')],_0x1cc4d3[_0xc030('0x3e')]),_0x1d0f7c);if(_0x45552b[_0xc030('0x3d')][_0xc030('0x47')]){_0x2de465['where']=_[_0xc030('0x48')](_0x2de465[_0xc030('0x45')],{'$or':_[_0xc030('0x39')](_0x1d0f7c,function(_0x3c943b){if(_0x3c943b['type']!=='VIRTUAL'){var _0x282a0e={};_0x282a0e[_0x3c943b[_0xc030('0x37')]]={'$like':'%'+_0x45552b[_0xc030('0x3d')]['filter']+'%'};return _0x282a0e;}})});}_0x2de465=_[_0xc030('0x48')]({},_0x2de465,_0x45552b[_0xc030('0x49')]);var _0x27baf8={'where':_0x2de465[_0xc030('0x45')]};return db['OpenchannelMessage'][_0xc030('0x2d')](_0x27baf8)[_0xc030('0x4a')](function(_0x3f7082){_0x385c10['count']=_0x3f7082;if(_0x45552b[_0xc030('0x3d')][_0xc030('0x4b')]){_0x2de465[_0xc030('0x4c')]=[{'all':!![]}];}return db[_0xc030('0x3a')][_0xc030('0x4d')](_0x2de465);})[_0xc030('0x4a')](function(_0x717bd2){_0x385c10[_0xc030('0x4e')]=_0x717bd2;return _0x385c10;})[_0xc030('0x4a')](respondWithFilteredResult(_0x522435,_0x2de465))[_0xc030('0x4f')](handleError(_0x522435,null));};exports[_0xc030('0x50')]=function(_0x123c31,_0x8b30c3){var _0x49b5c6={'raw':!![],'where':{'id':_0x123c31[_0xc030('0x51')]['id']}},_0x2ffb52={};_0x2ffb52[_0xc030('0x40')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x2ffb52['query']=_[_0xc030('0x52')](_0x123c31[_0xc030('0x3d')]);_0x2ffb52[_0xc030('0x3e')]=_['intersection'](_0x2ffb52[_0xc030('0x40')],_0x2ffb52[_0xc030('0x3d')]);_0x49b5c6[_0xc030('0x41')]=_[_0xc030('0x3f')](_0x2ffb52[_0xc030('0x40')],qs[_0xc030('0x53')](_0x123c31[_0xc030('0x3d')][_0xc030('0x53')]));_0x49b5c6[_0xc030('0x41')]=_0x49b5c6[_0xc030('0x41')]['length']?_0x49b5c6[_0xc030('0x41')]:_0x2ffb52['model'];if(_0x123c31[_0xc030('0x3d')][_0xc030('0x4b')]){_0x49b5c6[_0xc030('0x4c')]=[{'all':!![]}];}_0x49b5c6=_[_0xc030('0x48')]({},_0x49b5c6,_0x123c31[_0xc030('0x49')]);return db[_0xc030('0x3a')][_0xc030('0x54')](_0x49b5c6)[_0xc030('0x4a')](handleEntityNotFound(_0x8b30c3,null))['then'](respondWithResult(_0x8b30c3,null))[_0xc030('0x4f')](handleError(_0x8b30c3,null));};exports[_0xc030('0x55')]=function(_0x2a047f,_0x561164){return db[_0xc030('0x3a')][_0xc030('0x55')](_0x2a047f[_0xc030('0x56')],{})['then'](respondWithResult(_0x561164,0xc9))['catch'](handleError(_0x561164,null));};exports['update']=function(_0x3de89d,_0x1b49cd){if(_0x3de89d[_0xc030('0x56')]['id']){delete _0x3de89d[_0xc030('0x56')]['id'];}return db[_0xc030('0x3a')]['find']({'where':{'id':_0x3de89d[_0xc030('0x51')]['id']}})[_0xc030('0x4a')](handleEntityNotFound(_0x1b49cd,null))[_0xc030('0x4a')](saveUpdates(_0x3de89d[_0xc030('0x56')],null))['then'](respondWithResult(_0x1b49cd,null))['catch'](handleError(_0x1b49cd,null));};exports[_0xc030('0x34')]=function(_0x38c53b,_0x31322f){return db['OpenchannelMessage'][_0xc030('0x54')]({'where':{'id':_0x38c53b[_0xc030('0x51')]['id']}})[_0xc030('0x4a')](handleEntityNotFound(_0x31322f,null))['then'](removeEntity(_0x31322f,null))[_0xc030('0x4f')](handleError(_0x31322f,null));};exports[_0xc030('0x57')]=function(_0x43fb68,_0x3433b7){return db[_0xc030('0x3a')]['describe']()[_0xc030('0x4a')](respondWithResult(_0x3433b7,null))['catch'](handleError(_0x3433b7,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xc030('0x58')]=function(_0x1d18ff,_0x66b9b5,_0x3116b1){var _0x5d1cac={'agent':{},'channel':_0xc030('0x59')};if(_0x1d18ff[_0xc030('0x56')]['id']){delete _0x1d18ff[_0xc030('0x56')]['id'];}_0x1d18ff[_0xc030('0x56')][_0xc030('0x5a')]=!![];_0x1d18ff[_0xc030('0x56')][_0xc030('0x5b')]=moment()['format'](_0xc030('0x5c'));_0x1d18ff[_0xc030('0x56')]['UserId']=_0x1d18ff[_0xc030('0x56')]['UserId']||_0x1d18ff[_0xc030('0x5d')]['id'];_0x5d1cac[_0xc030('0x5e')]['id']=_0x1d18ff['body'][_0xc030('0x5f')];return db[_0xc030('0x3a')][_0xc030('0x54')]({'where':{'id':_0x1d18ff[_0xc030('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xc030('0x4a')](handleEntityNotFound(_0x66b9b5,null))[_0xc030('0x4a')](saveUpdates(_0x1d18ff[_0xc030('0x56')],null))[_0xc030('0x4a')](function(_0x51dd4f){if(_0x51dd4f){_0x5d1cac[_0xc030('0x27')]=_0x51dd4f[_0xc030('0x60')]({'plain':!![]});return db[_0xc030('0x61')][_0xc030('0x54')]({'where':{'id':_0x51dd4f[_0xc030('0x62')]}});}return null;})[_0xc030('0x4a')](handleEntityNotFound(_0x66b9b5,null))[_0xc030('0x4a')](function(_0xd4d98a){if(_0xd4d98a){return _0xd4d98a[_0xc030('0x63')]({'UserId':_0x1d18ff[_0xc030('0x56')]['UserId'],'read1stAt':_[_0xc030('0x64')](_0xd4d98a[_0xc030('0x65')])?moment()[_0xc030('0x66')](_0xc030('0x5c')):undefined});}return null;})['then'](function(_0x277ee5){if(_0x277ee5){_0x5d1cac[_0xc030('0x67')]=_0x277ee5['get']({'plain':!![]});interaction_log[_0xc030('0x28')](_0xc030('0x68'),_0x1d18ff['user']['id'],_0x1d18ff[_0xc030('0x5d')][_0xc030('0x37')],_0x1d18ff[_0xc030('0x5d')]['role'],_0x5d1cac[_0xc030('0x67')]['id'],_0x1d18ff[_0xc030('0x56')]?JSON[_0xc030('0x24')](_0x1d18ff['body']):_0xc030('0x69'));return respondWithRpcPromise('AcceptMessage',_0xc030('0x6a'),_0x5d1cac);}return null;})[_0xc030('0x4a')](function(_0x44f99a){if(_0x44f99a){if(_0x1d18ff['body'][_0xc030('0x6b')]){_0x5d1cac['message']['interface']=util[_0xc030('0x66')](_0xc030('0x6c'),_0x1d18ff[_0xc030('0x5d')][_0xc030('0x37')]);_0x5d1cac[_0xc030('0x27')]['channel']=_0x5d1cac['channel'];_0x5d1cac[_0xc030('0x27')]['event']=_0xc030('0x58');return respondWithRpcPromise(_0xc030('0x6d'),_0xc030('0x6d'),{'event':'acceptmessage','message':_0x5d1cac[_0xc030('0x27')]},client9002)[_0xc030('0x4a')](function(){return _0x5d1cac;});}return _0x5d1cac;}return null;})['then'](respondWithResult(_0x66b9b5,null))[_0xc030('0x4f')](handleError(_0x66b9b5,null));};var interaction_log=require(_0xc030('0x13'))(_0xc030('0x6e'));exports['reject']=function(_0x148531,_0x567555,_0x417bf0){var _0x30dba3={'agent':{},'channel':'openchannel'};if(_0x148531[_0xc030('0x56')]['id']){delete _0x148531['body']['id'];}_0x148531[_0xc030('0x56')][_0xc030('0x5f')]=_0x148531[_0xc030('0x56')][_0xc030('0x5f')]||_0x148531['user']['id'];_0x30dba3[_0xc030('0x5e')]['id']=_0x148531[_0xc030('0x56')]['UserId'];return db[_0xc030('0x3a')]['find']({'where':{'id':_0x148531[_0xc030('0x51')]['id'],'UserId':null}})[_0xc030('0x4a')](handleEntityNotFound(_0x567555,null))['then'](function(_0x6ab2c1){if(_0x6ab2c1){_0x30dba3[_0xc030('0x27')]=_0x6ab2c1['get']({'plain':!![]});return db[_0xc030('0x61')][_0xc030('0x54')]({'where':{'id':_0x6ab2c1[_0xc030('0x62')]}});}return null;})[_0xc030('0x4a')](handleEntityNotFound(_0x567555,null))[_0xc030('0x4a')](function(_0x374cb1){if(_0x374cb1){_0x30dba3[_0xc030('0x67')]=_0x374cb1[_0xc030('0x60')]({'plain':!![]});interaction_log[_0xc030('0x28')](_0xc030('0x6f'),_0x148531[_0xc030('0x5d')]['id'],_0x148531['user'][_0xc030('0x37')],_0x148531[_0xc030('0x5d')]['role'],_0x30dba3['interaction']['id'],_0x148531[_0xc030('0x56')]?JSON[_0xc030('0x24')](_0x148531[_0xc030('0x56')]):_0xc030('0x69'));return respondWithRpcPromise(_0xc030('0x70'),_0xc030('0x71'),_0x30dba3);}return null;})[_0xc030('0x4a')](function(_0x385df2){if(_0x385df2){_0x385df2['message'][_0xc030('0x72')]=util['format'](_0xc030('0x6c'),_0x148531[_0xc030('0x5d')][_0xc030('0x37')]);_0x385df2['message'][_0xc030('0x73')]=_0x30dba3[_0xc030('0x73')];_0x385df2[_0xc030('0x27')][_0xc030('0x74')]='reject';respondWithRpcPromise(_0xc030('0x6d'),_0xc030('0x6d'),{'event':_0xc030('0x75'),'message':_0x385df2['message']},client9002);return _0x30dba3;}return null;})[_0xc030('0x4a')](respondWithResult(_0x567555,null))[_0xc030('0x4f')](handleError(_0x567555,null));}; \ No newline at end of file +var _0x763a=['role','null','acceptMessage','SIP/%s','event','EventManager','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','include','update','find','body','destroy','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x427734,_0x1bdd4e){var _0x5f101d=function(_0x2972f7){while(--_0x2972f7){_0x427734['push'](_0x427734['shift']());}};_0x5f101d(++_0x1bdd4e);}(_0x763a,0x158));var _0xa763=function(_0x106e54,_0x42cdc3){_0x106e54=_0x106e54-0x0;var _0x99aa6e=_0x763a[_0x106e54];return _0x99aa6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa763('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa763('0x1'));var jsonpatch=require(_0xa763('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa763('0x3'));var Mustache=require(_0xa763('0x4'));var util=require(_0xa763('0x5'));var path=require(_0xa763('0x6'));var sox=require('sox');var csv=require(_0xa763('0x7'));var ejs=require(_0xa763('0x8'));var fs=require('fs');var _=require(_0xa763('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa763('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa763('0xb'));var Papa=require(_0xa763('0xc'));var Redis=require(_0xa763('0xd'));var authService=require(_0xa763('0xe'));var qs=require(_0xa763('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa763('0x10'));var logger=require(_0xa763('0x11'))('api');var utils=require(_0xa763('0x12'));var config=require(_0xa763('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa763('0x14'))['db'];config[_0xa763('0x15')]=_[_0xa763('0x16')](config[_0xa763('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xa763('0x17'))(new Redis(config[_0xa763('0x15')]));require('./openchannelMessage.socket')[_0xa763('0x18')](socket);var jayson=require(_0xa763('0x19'));var client=jayson['client'][_0xa763('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6556,_0x52f15c,_0x5b261b,_0x19d82e){return new BPromise(function(_0x392a10,_0x4e5f21){var _0x54957b=_0x19d82e||client;return _0x54957b['request'](_0x4f6556,_0x5b261b)[_0xa763('0x1b')](function(_0x2d76dd){logger[_0xa763('0x1c')](_0xa763('0x1d'),_0x52f15c,_0xa763('0x1e'));logger[_0xa763('0x1f')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x52f15c,'request\x20sent',JSON[_0xa763('0x20')](_0x2d76dd));if(_0x2d76dd['error']){if(_0x2d76dd[_0xa763('0x21')]['code']===0x1f4){logger[_0xa763('0x21')](_0xa763('0x1d'),_0x52f15c,_0x2d76dd[_0xa763('0x21')][_0xa763('0x22')]);return _0x4e5f21(_0x2d76dd[_0xa763('0x21')][_0xa763('0x22')]);}logger[_0xa763('0x21')](_0xa763('0x1d'),_0x52f15c,_0x2d76dd['error'][_0xa763('0x22')]);return _0x392a10(_0x2d76dd[_0xa763('0x21')]['message']);}else{logger[_0xa763('0x1c')](_0xa763('0x1d'),_0x52f15c,_0xa763('0x1e'));_0x392a10(_0x2d76dd[_0xa763('0x23')][_0xa763('0x22')]);}})[_0xa763('0x24')](function(_0x4e6a31){logger[_0xa763('0x21')](_0xa763('0x1d'),_0x52f15c,_0x4e6a31);_0x4e5f21(_0x4e6a31);});});}function respondWithStatusCode(_0x2abc45,_0x2466e8){_0x2466e8=_0x2466e8||0xcc;return function(_0x3d517c){if(_0x3d517c){return _0x2abc45[_0xa763('0x25')](_0x2466e8);}return _0x2abc45['status'](_0x2466e8)[_0xa763('0x26')]();};}function respondWithResult(_0x470e9f,_0x3565ac){_0x3565ac=_0x3565ac||0xc8;return function(_0x22791a){if(_0x22791a){return _0x470e9f['status'](_0x3565ac)[_0xa763('0x27')](_0x22791a);}};}function respondWithFilteredResult(_0x26639e,_0x5cd3ae){return function(_0x2431fe){if(_0x2431fe){var _0x303d36=_0x2431fe[_0xa763('0x28')],_0x2760b1=_0x5cd3ae[_0xa763('0x29')],_0xe33201=_0x5cd3ae[_0xa763('0x29')]+_0x5cd3ae[_0xa763('0x2a')],_0x27f11e;if(_0xe33201>=_0x303d36){_0xe33201=_0x303d36;_0x27f11e=0xc8;}else{_0x27f11e=0xce;}_0x26639e[_0xa763('0x2b')](_0x27f11e);return _0x26639e[_0xa763('0x2c')]('Content-Range',_0x2760b1+'-'+_0xe33201+'/'+_0x303d36)[_0xa763('0x27')](_0x2431fe);}return null;};}function patchUpdates(_0x2a4c5a){return function(_0x4657ab){try{jsonpatch[_0xa763('0x2d')](_0x4657ab,_0x2a4c5a,!![]);}catch(_0x2255d5){return BPromise[_0xa763('0x2e')](_0x2255d5);}return _0x4657ab[_0xa763('0x2f')]();};}function saveUpdates(_0x47abca,_0xf4ca5){return function(_0x5d1afa){if(_0x5d1afa){return _0x5d1afa['update'](_0x47abca)[_0xa763('0x1b')](function(_0x304d6e){return _0x304d6e;});}return null;};}function removeEntity(_0x4bfe17,_0x524f80){return function(_0x1ed862){if(_0x1ed862){return _0x1ed862['destroy']()[_0xa763('0x1b')](function(){_0x4bfe17[_0xa763('0x2b')](0xcc)[_0xa763('0x26')]();});}};}function handleEntityNotFound(_0x57298d,_0x469dfd){return function(_0x3ff643){if(!_0x3ff643){_0x57298d[_0xa763('0x25')](0x194);}return _0x3ff643;};}function handleError(_0x102adc,_0x42739b){_0x42739b=_0x42739b||0x1f4;return function(_0xdcb2a7){logger[_0xa763('0x21')](_0xdcb2a7[_0xa763('0x30')]);if(_0xdcb2a7['name']){delete _0xdcb2a7[_0xa763('0x31')];}_0x102adc[_0xa763('0x2b')](_0x42739b)[_0xa763('0x32')](_0xdcb2a7);};}exports[_0xa763('0x33')]=function(_0x3cef83,_0x5b22e9){var _0xf2c46d={},_0x344d13={},_0x453d6={'count':0x0,'rows':[]};var _0x5eb48f=_[_0xa763('0x34')](db[_0xa763('0x35')][_0xa763('0x36')],function(_0x5c746a){return{'name':_0x5c746a['fieldName'],'type':_0x5c746a[_0xa763('0x37')][_0xa763('0x38')]};});_0x344d13[_0xa763('0x39')]=_[_0xa763('0x34')](_0x5eb48f,_0xa763('0x31'));_0x344d13[_0xa763('0x3a')]=_[_0xa763('0x3b')](_0x3cef83['query']);_0x344d13[_0xa763('0x3c')]=_[_0xa763('0x3d')](_0x344d13['model'],_0x344d13[_0xa763('0x3a')]);_0xf2c46d[_0xa763('0x3e')]=_['intersection'](_0x344d13[_0xa763('0x39')],qs[_0xa763('0x3f')](_0x3cef83[_0xa763('0x3a')][_0xa763('0x3f')]));_0xf2c46d[_0xa763('0x3e')]=_0xf2c46d[_0xa763('0x3e')]['length']?_0xf2c46d[_0xa763('0x3e')]:_0x344d13[_0xa763('0x39')];if(!_0x3cef83[_0xa763('0x3a')][_0xa763('0x40')](_0xa763('0x41'))){_0xf2c46d[_0xa763('0x2a')]=qs[_0xa763('0x2a')](_0x3cef83['query']['limit']);_0xf2c46d[_0xa763('0x29')]=qs[_0xa763('0x29')](_0x3cef83['query']['offset']);}_0xf2c46d[_0xa763('0x42')]=qs[_0xa763('0x43')](_0x3cef83[_0xa763('0x3a')][_0xa763('0x43')]);_0xf2c46d[_0xa763('0x44')]=qs[_0xa763('0x3c')](_[_0xa763('0x45')](_0x3cef83['query'],_0x344d13[_0xa763('0x3c')]),_0x5eb48f);if(_0x3cef83[_0xa763('0x3a')][_0xa763('0x46')]){_0xf2c46d['where']=_[_0xa763('0x47')](_0xf2c46d[_0xa763('0x44')],{'$or':_[_0xa763('0x34')](_0x5eb48f,function(_0xd4a8ae){if(_0xd4a8ae[_0xa763('0x37')]!==_0xa763('0x48')){var _0x41ebb6={};_0x41ebb6[_0xd4a8ae['name']]={'$like':'%'+_0x3cef83[_0xa763('0x3a')]['filter']+'%'};return _0x41ebb6;}})});}_0xf2c46d=_['merge']({},_0xf2c46d,_0x3cef83[_0xa763('0x49')]);var _0x5380a4={'where':_0xf2c46d[_0xa763('0x44')]};return db['OpenchannelMessage'][_0xa763('0x28')](_0x5380a4)[_0xa763('0x1b')](function(_0x4c1084){_0x453d6[_0xa763('0x28')]=_0x4c1084;if(_0x3cef83[_0xa763('0x3a')]['includeAll']){_0xf2c46d['include']=[{'all':!![]}];}return db[_0xa763('0x35')][_0xa763('0x4a')](_0xf2c46d);})['then'](function(_0x721ddf){_0x453d6[_0xa763('0x4b')]=_0x721ddf;return _0x453d6;})['then'](respondWithFilteredResult(_0x5b22e9,_0xf2c46d))[_0xa763('0x24')](handleError(_0x5b22e9,null));};exports['show']=function(_0x452e36,_0x46cece){var _0x496262={'raw':!![],'where':{'id':_0x452e36[_0xa763('0x4c')]['id']}},_0x26c9f1={};_0x26c9f1[_0xa763('0x39')]=_[_0xa763('0x3b')](db[_0xa763('0x35')][_0xa763('0x36')]);_0x26c9f1[_0xa763('0x3a')]=_[_0xa763('0x3b')](_0x452e36['query']);_0x26c9f1[_0xa763('0x3c')]=_[_0xa763('0x3d')](_0x26c9f1[_0xa763('0x39')],_0x26c9f1[_0xa763('0x3a')]);_0x496262[_0xa763('0x3e')]=_[_0xa763('0x3d')](_0x26c9f1[_0xa763('0x39')],qs[_0xa763('0x3f')](_0x452e36[_0xa763('0x3a')][_0xa763('0x3f')]));_0x496262[_0xa763('0x3e')]=_0x496262[_0xa763('0x3e')]['length']?_0x496262[_0xa763('0x3e')]:_0x26c9f1['model'];if(_0x452e36['query']['includeAll']){_0x496262[_0xa763('0x4d')]=[{'all':!![]}];}_0x496262=_[_0xa763('0x47')]({},_0x496262,_0x452e36[_0xa763('0x49')]);return db[_0xa763('0x35')]['find'](_0x496262)[_0xa763('0x1b')](handleEntityNotFound(_0x46cece,null))[_0xa763('0x1b')](respondWithResult(_0x46cece,null))[_0xa763('0x24')](handleError(_0x46cece,null));};exports['create']=function(_0x34728a,_0x4bb3e8){return db['OpenchannelMessage']['create'](_0x34728a['body'],{})[_0xa763('0x1b')](respondWithResult(_0x4bb3e8,0xc9))['catch'](handleError(_0x4bb3e8,null));};exports[_0xa763('0x4e')]=function(_0x2d8aa1,_0x215a05){if(_0x2d8aa1['body']['id']){delete _0x2d8aa1['body']['id'];}return db[_0xa763('0x35')][_0xa763('0x4f')]({'where':{'id':_0x2d8aa1[_0xa763('0x4c')]['id']}})[_0xa763('0x1b')](handleEntityNotFound(_0x215a05,null))[_0xa763('0x1b')](saveUpdates(_0x2d8aa1[_0xa763('0x50')],null))[_0xa763('0x1b')](respondWithResult(_0x215a05,null))['catch'](handleError(_0x215a05,null));};exports[_0xa763('0x51')]=function(_0x5554db,_0x23ca1e){return db[_0xa763('0x35')][_0xa763('0x4f')]({'where':{'id':_0x5554db[_0xa763('0x4c')]['id']}})[_0xa763('0x1b')](handleEntityNotFound(_0x23ca1e,null))[_0xa763('0x1b')](removeEntity(_0x23ca1e,null))[_0xa763('0x24')](handleError(_0x23ca1e,null));};exports[_0xa763('0x52')]=function(_0x1a77a9,_0xbcc84b){return db[_0xa763('0x35')][_0xa763('0x52')]()[_0xa763('0x1b')](respondWithResult(_0xbcc84b,null))['catch'](handleError(_0xbcc84b,null));};var interaction_log=require(_0xa763('0x11'))('openchannel-interactions');exports[_0xa763('0x53')]=function(_0x4fee26,_0x5cf298,_0x46e83c){var _0x2ca926={'agent':{},'channel':'openchannel'};if(_0x4fee26['body']['id']){delete _0x4fee26[_0xa763('0x50')]['id'];}_0x4fee26[_0xa763('0x50')]['read']=!![];_0x4fee26[_0xa763('0x50')][_0xa763('0x54')]=moment()[_0xa763('0x55')](_0xa763('0x56'));_0x4fee26[_0xa763('0x50')][_0xa763('0x57')]=_0x4fee26[_0xa763('0x50')][_0xa763('0x57')]||_0x4fee26[_0xa763('0x58')]['id'];_0x2ca926[_0xa763('0x59')]['id']=_0x4fee26[_0xa763('0x50')][_0xa763('0x57')];return db['OpenchannelMessage'][_0xa763('0x4f')]({'where':{'id':_0x4fee26[_0xa763('0x4c')]['id'],'UserId':null},'include':[{'model':db[_0xa763('0x5a')],'as':_0xa763('0x5b')}]})[_0xa763('0x1b')](handleEntityNotFound(_0x5cf298,null))[_0xa763('0x1b')](saveUpdates(_0x4fee26[_0xa763('0x50')],null))[_0xa763('0x1b')](function(_0x2f2676){if(_0x2f2676){_0x2ca926['message']=_0x2f2676[_0xa763('0x5c')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2f2676['OpenchannelInteractionId']}});}return null;})[_0xa763('0x1b')](handleEntityNotFound(_0x5cf298,null))[_0xa763('0x1b')](function(_0x51b1aa){if(_0x51b1aa){return _0x51b1aa[_0xa763('0x4e')]({'UserId':_0x4fee26[_0xa763('0x50')][_0xa763('0x57')],'read1stAt':_[_0xa763('0x5d')](_0x51b1aa['read1stAt'])?moment()[_0xa763('0x55')](_0xa763('0x56')):undefined});}return null;})[_0xa763('0x1b')](function(_0x479b2e){if(_0x479b2e){_0x2ca926[_0xa763('0x5e')]=_0x479b2e['get']({'plain':!![]});interaction_log[_0xa763('0x1c')](_0xa763('0x5f'),_0x4fee26['user']['id'],_0x4fee26[_0xa763('0x58')][_0xa763('0x31')],_0x4fee26[_0xa763('0x58')][_0xa763('0x60')],_0x2ca926[_0xa763('0x5e')]['id'],_0x4fee26[_0xa763('0x50')]?JSON['stringify'](_0x4fee26['body']):_0xa763('0x61'));return respondWithRpcPromise('AcceptMessage',_0xa763('0x62'),_0x2ca926);}return null;})['then'](function(_0xc75347){if(_0xc75347){if(_0x4fee26[_0xa763('0x50')]['manual']){_0x2ca926['message']['interface']=util[_0xa763('0x55')](_0xa763('0x63'),_0x4fee26['user'][_0xa763('0x31')]);_0x2ca926[_0xa763('0x22')]['channel']=_0x2ca926['channel'];_0x2ca926[_0xa763('0x22')][_0xa763('0x64')]=_0xa763('0x53');return respondWithRpcPromise(_0xa763('0x65'),_0xa763('0x65'),{'event':_0xa763('0x66'),'message':_0x2ca926[_0xa763('0x22')]},client9002)[_0xa763('0x1b')](function(){return _0x2ca926;});}return _0x2ca926;}return null;})['then'](respondWithResult(_0x5cf298,null))[_0xa763('0x24')](handleError(_0x5cf298,null));};var interaction_log=require(_0xa763('0x11'))(_0xa763('0x67'));exports[_0xa763('0x2e')]=function(_0x31c09f,_0x2475cc,_0x59b36a){var _0x74cc67={'agent':{},'channel':_0xa763('0x68')};if(_0x31c09f[_0xa763('0x50')]['id']){delete _0x31c09f[_0xa763('0x50')]['id'];}_0x31c09f['body'][_0xa763('0x57')]=_0x31c09f['body'][_0xa763('0x57')]||_0x31c09f['user']['id'];_0x74cc67[_0xa763('0x59')]['id']=_0x31c09f['body'][_0xa763('0x57')];return db[_0xa763('0x35')]['find']({'where':{'id':_0x31c09f[_0xa763('0x4c')]['id'],'UserId':null}})[_0xa763('0x1b')](handleEntityNotFound(_0x2475cc,null))[_0xa763('0x1b')](function(_0x44158d){if(_0x44158d){_0x74cc67[_0xa763('0x22')]=_0x44158d[_0xa763('0x5c')]({'plain':!![]});return db[_0xa763('0x69')][_0xa763('0x4f')]({'where':{'id':_0x44158d['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2475cc,null))[_0xa763('0x1b')](function(_0x42ab11){if(_0x42ab11){_0x74cc67[_0xa763('0x5e')]=_0x42ab11[_0xa763('0x5c')]({'plain':!![]});interaction_log[_0xa763('0x1c')](_0xa763('0x6a'),_0x31c09f[_0xa763('0x58')]['id'],_0x31c09f[_0xa763('0x58')][_0xa763('0x31')],_0x31c09f['user'][_0xa763('0x60')],_0x74cc67[_0xa763('0x5e')]['id'],_0x31c09f[_0xa763('0x50')]?JSON['stringify'](_0x31c09f[_0xa763('0x50')]):'null');return respondWithRpcPromise(_0xa763('0x6b'),_0xa763('0x6c'),_0x74cc67);}return null;})['then'](function(_0x591d75){if(_0x591d75){_0x591d75[_0xa763('0x22')]['interface']=util['format'](_0xa763('0x63'),_0x31c09f[_0xa763('0x58')][_0xa763('0x31')]);_0x591d75['message'][_0xa763('0x6d')]=_0x74cc67[_0xa763('0x6d')];_0x591d75['message']['event']=_0xa763('0x2e');respondWithRpcPromise(_0xa763('0x65'),_0xa763('0x65'),{'event':'rejectmessage','message':_0x591d75[_0xa763('0x22')]},client9002);return _0x74cc67;}return null;})[_0xa763('0x1b')](respondWithResult(_0x2475cc,null))['catch'](handleError(_0x2475cc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ac17b51..c56b697 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 _0x7b61=['hasOwnProperty','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x5248fc,_0x5a6078){var _0xbcaed5=function(_0x4ebd20){while(--_0x4ebd20){_0x5248fc['push'](_0x5248fc['shift']());}};_0xbcaed5(++_0x5a6078);}(_0x7b61,0x139));var _0x17b6=function(_0x44d125,_0x234deb){_0x44d125=_0x44d125-0x0;var _0x435b07=_0x7b61[_0x44d125];return _0x435b07;};'use strict';var EventEmitter=require(_0x17b6('0x0'));var OpenchannelMessage=require(_0x17b6('0x1'))['db'][_0x17b6('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x17b6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17b6('0x4'),'afterDestroy':_0x17b6('0x5')};function emitEvent(_0x151cf2){return function(_0x192ddc,_0x4d2085,_0x521590){OpenchannelMessageEvents[_0x17b6('0x6')](_0x151cf2+':'+_0x192ddc['id'],_0x192ddc);OpenchannelMessageEvents[_0x17b6('0x6')](_0x151cf2,_0x192ddc);_0x521590(null);};}for(var e in events){if(events[_0x17b6('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x47e3=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x35a1e4,_0x419f88){var _0x5a0106=function(_0xc7e511){while(--_0xc7e511){_0x35a1e4['push'](_0x35a1e4['shift']());}};_0x5a0106(++_0x419f88);}(_0x47e3,0x151));var _0x347e=function(_0x3dcd2d,_0x4dd24c){_0x3dcd2d=_0x3dcd2d-0x0;var _0x23e73e=_0x47e3[_0x3dcd2d];return _0x23e73e;};'use strict';var EventEmitter=require(_0x347e('0x0'));var OpenchannelMessage=require(_0x347e('0x1'))['db'][_0x347e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x347e('0x3')](0x0);var events={'afterCreate':_0x347e('0x4'),'afterUpdate':_0x347e('0x5'),'afterDestroy':_0x347e('0x6')};function emitEvent(_0x161aa5){return function(_0x118148,_0x4fc67d,_0x450eb3){OpenchannelMessageEvents[_0x347e('0x7')](_0x161aa5+':'+_0x118148['id'],_0x118148);OpenchannelMessageEvents[_0x347e('0x7')](_0x161aa5,_0x118148);_0x450eb3(null);};}for(var e in events){if(events[_0x347e('0x8')](e)){var event=events[e];OpenchannelMessage[_0x347e('0x9')](e,emitEvent(event));}}module[_0x347e('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4f8fd57..cb0f486 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 _0xf6bf=['FULLTEXT','models','get','direction','out','secret','isNil','UserId','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','afterCreate','threadId','update','finally','lodash','util','moment','bluebird','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0xf6bf,0x1ad));var _0xff6b=function(_0x5b1c2d,_0x14e401){_0x5b1c2d=_0x5b1c2d-0x0;var _0x2e790a=_0xf6bf[_0x5b1c2d];return _0x2e790a;};'use strict';var _=require(_0xff6b('0x0'));var util=require(_0xff6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xff6b('0x2'));var BPromise=require(_0xff6b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff6b('0x4'));var rimraf=require(_0xff6b('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0xff6b('0x6')]=function(_0x4bf531,_0x2f721e){return _0x4bf531[_0xff6b('0x7')](_0xff6b('0x8'),attributes,{'tableName':_0xff6b('0x9'),'paranoid':![],'indexes':[{'name':_0xff6b('0xa'),'fields':[_0xff6b('0xb')],'type':_0xff6b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcab796,_0x29c12e,_0x2f2361){var _0x3915c4=_0x4bf531[_0xff6b('0xd')];var _0x14bb42=_0xcab796[_0xff6b('0xe')]({'plain':!![]});if(_0x14bb42[_0xff6b('0xf')]['toLowerCase']()==='in'||_0x14bb42[_0xff6b('0xf')]['toLowerCase']()===_0xff6b('0x10')&&!_0x14bb42[_0xff6b('0x11')]&&!_[_0xff6b('0x12')](_0x14bb42[_0xff6b('0x13')])){_0x3915c4['OpenchannelInteraction']['findOne']({'where':{'id':_0x14bb42[_0xff6b('0x14')]}})[_0xff6b('0x15')](function(_0x51ba93){if(_0x51ba93){_0x51ba93['update']({'lastMsgAt':_0x14bb42[_0xff6b('0x16')],'lastMsgDirection':_0x14bb42['direction']['toLowerCase']()});}})[_0xff6b('0x17')](function(_0x13d77a){console[_0xff6b('0x18')](_0x13d77a);});}if(_0x14bb42['direction']===_0xff6b('0x10')&&!_0x14bb42[_0xff6b('0x11')]){var _0x19f971;_0x3915c4[_0xff6b('0x19')][_0xff6b('0x1a')]()['then'](function(_0x26a7fe){return _0x3915c4[_0xff6b('0x1b')][_0xff6b('0x1c')]({'where':{'id':_0x14bb42[_0xff6b('0x1d')]},'include':[{'model':_0x3915c4[_0xff6b('0x1e')],'as':_0xff6b('0x1f'),'where':{'id':_0x14bb42[_0xff6b('0x14')]},'limit':0x1,'include':[{'model':_0x3915c4[_0xff6b('0x19')],'as':'Contact','attributes':_[_0xff6b('0x20')](_0x26a7fe)}]}]});})[_0xff6b('0x15')](function(_0x2976ff){_0x19f971=_0x2976ff[_0xff6b('0xe')]({'plain':!![]});if(_0x19f971&&_0x19f971[_0xff6b('0x21')]){logger[_0xff6b('0x22')](_0xff6b('0x23'),'afterCreate',util[_0xff6b('0x24')](_0xff6b('0x25'),_0x14bb42['id'],_0x19f971[_0xff6b('0x21')]));if(_0x19f971[_0xff6b('0x1f')]&&_0x19f971[_0xff6b('0x1f')][_0xff6b('0x26')]){_0x14bb42[_0xff6b('0x27')]=_[_0xff6b('0x28')](_0x19f971['Interactions'][0x0],_0xff6b('0x29'));_0x14bb42[_0xff6b('0x29')]=_0x19f971[_0xff6b('0x1f')][0x0][_0xff6b('0x29')];}var _0x29c12e={'method':_0xff6b('0x2a'),'uri':encodeURI(_0x19f971[_0xff6b('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x29c12e[_0xff6b('0x2b')]){case _0xff6b('0x2c'):_0x29c12e['qs']=_0x14bb42;break;case _0xff6b('0x2a'):_0x29c12e[_0xff6b('0xb')]=_0x14bb42;break;}return rp(_0x29c12e)[_0xff6b('0x15')](function(_0x1aa95f){logger[_0xff6b('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xff6b('0x2d'),util[_0xff6b('0x24')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x14bb42['id'],_0x19f971[_0xff6b('0x21')]));if(_0x1aa95f[_0xff6b('0xb')][_0xff6b('0x2e')]&&_0x1aa95f[_0xff6b('0xb')]['threadId']!=_0x14bb42['Interaction'][_0xff6b('0x2e')]){return _0x3915c4[_0xff6b('0x1e')][_0xff6b('0x2f')]({'threadId':_0x1aa95f[_0xff6b('0xb')][_0xff6b('0x2e')]},{'logging':!![],'where':{'id':_0x14bb42[_0xff6b('0x27')]['id']}});}else{return;}})[_0xff6b('0x15')](function(){return _0xcab796[_0xff6b('0x2f')]({'read':!![]});})['catch'](function(_0x50e6f8){logger[_0xff6b('0x18')](_0xff6b('0x23'),_0xff6b('0x2d'),util['inspect'](_0x50e6f8,{'showHidden':![],'depth':null}));_0x2f2361();});}else{_0x2f2361();}})[_0xff6b('0x30')](function(){_0x2f2361();});}else{_0x2f2361();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf55d=['Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','GET','body','threadId','Interaction','error','afterCreate','inspect','finally','utf8mb4','lodash','bluebird','request-promise','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','secret','CmContact','describe','OpenchannelAccountId','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0xf55d,0x11c));var _0xdf55=function(_0x425720,_0x34ffc3){_0x425720=_0x425720-0x0;var _0x40f5ab=_0xf55d[_0x425720];return _0x40f5ab;};'use strict';var _=require(_0xdf55('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdf55('0x1'));var rp=require(_0xdf55('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf55('0x3'));var config=require(_0xdf55('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0xdf55('0x5')]=function(_0x4aa7d7,_0x153602){return _0x4aa7d7['define'](_0xdf55('0x6'),attributes,{'tableName':_0xdf55('0x7'),'paranoid':![],'indexes':[{'name':_0xdf55('0x8'),'fields':['body'],'type':_0xdf55('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ec96c,_0x16fa1a,_0x2bf6f6){var _0x52e191=_0x4aa7d7[_0xdf55('0xa')];var _0x55ae5f=_0x5ec96c['get']({'plain':!![]});if(_0x55ae5f[_0xdf55('0xb')][_0xdf55('0xc')]()==='in'||_0x55ae5f[_0xdf55('0xb')]['toLowerCase']()===_0xdf55('0xd')&&!_0x55ae5f['secret']&&!_[_0xdf55('0xe')](_0x55ae5f['UserId'])){_0x52e191[_0xdf55('0xf')][_0xdf55('0x10')]({'where':{'id':_0x55ae5f[_0xdf55('0x11')]}})[_0xdf55('0x12')](function(_0x3722ac){if(_0x3722ac){_0x3722ac[_0xdf55('0x13')]({'lastMsgAt':_0x55ae5f['createdAt'],'lastMsgDirection':_0x55ae5f[_0xdf55('0xb')][_0xdf55('0xc')]()});}})[_0xdf55('0x14')](function(_0x7149fa){console['error'](_0x7149fa);});}if(_0x55ae5f['direction']==='out'&&!_0x55ae5f[_0xdf55('0x15')]){var _0xc1997e;_0x52e191[_0xdf55('0x16')][_0xdf55('0x17')]()[_0xdf55('0x12')](function(_0x4a9bdf){return _0x52e191['OpenchannelAccount']['find']({'where':{'id':_0x55ae5f[_0xdf55('0x18')]},'include':[{'model':_0x52e191[_0xdf55('0xf')],'as':_0xdf55('0x19'),'where':{'id':_0x55ae5f['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x52e191[_0xdf55('0x16')],'as':'Contact','attributes':_[_0xdf55('0x1a')](_0x4a9bdf)}]}]});})[_0xdf55('0x12')](function(_0x20aa42){_0xc1997e=_0x20aa42['get']({'plain':!![]});if(_0xc1997e&&_0xc1997e[_0xdf55('0x1b')]){logger[_0xdf55('0x1c')](_0xdf55('0x1d'),'afterCreate',util[_0xdf55('0x1e')](_0xdf55('0x1f'),_0x55ae5f['id'],_0xc1997e[_0xdf55('0x1b')]));if(_0xc1997e[_0xdf55('0x19')]&&_0xc1997e[_0xdf55('0x19')][_0xdf55('0x20')]){_0x55ae5f['Interaction']=_[_0xdf55('0x21')](_0xc1997e[_0xdf55('0x19')][0x0],_0xdf55('0x22'));_0x55ae5f[_0xdf55('0x22')]=_0xc1997e['Interactions'][0x0][_0xdf55('0x22')];}var _0x16fa1a={'method':_0xdf55('0x23'),'uri':encodeURI(_0xc1997e['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x16fa1a['method']){case _0xdf55('0x24'):_0x16fa1a['qs']=_0x55ae5f;break;case'POST':_0x16fa1a[_0xdf55('0x25')]=_0x55ae5f;break;}return rp(_0x16fa1a)[_0xdf55('0x12')](function(_0x867409){logger['info'](_0xdf55('0x1d'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x55ae5f['id'],_0xc1997e[_0xdf55('0x1b')]));if(_0x867409[_0xdf55('0x25')]['threadId']&&_0x867409['body'][_0xdf55('0x26')]!=_0x55ae5f[_0xdf55('0x27')][_0xdf55('0x26')]){return _0x52e191['OpenchannelInteraction'][_0xdf55('0x13')]({'threadId':_0x867409[_0xdf55('0x25')][_0xdf55('0x26')]},{'logging':!![],'where':{'id':_0x55ae5f[_0xdf55('0x27')]['id']}});}else{return;}})['then'](function(){return _0x5ec96c[_0xdf55('0x13')]({'read':!![]});})[_0xdf55('0x14')](function(_0x461024){logger[_0xdf55('0x28')](_0xdf55('0x1d'),_0xdf55('0x29'),util[_0xdf55('0x2a')](_0x461024,{'showHidden':![],'depth':null}));_0x2bf6f6();});}else{_0x2bf6f6();}})[_0xdf55('0x2b')](function(){_0x2bf6f6();});}else{_0x2bf6f6();}}},'charset':_0xdf55('0x2c'),'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 8074ca4..27eeb8b 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0xfe76b5,_0x1c1c59){var _0x196a13=function(_0x29ee61){while(--_0x29ee61){_0xfe76b5['push'](_0xfe76b5['shift']());}};_0x196a13(++_0x1c1c59);}(_0xb10b,0x12a));var _0xbb10=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0xb10b[_0x226ad1];return _0x16b625;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0xbc6fc0,_0x135ebf){var _0x254b84=function(_0x3ab153){while(--_0x3ab153){_0xbc6fc0['push'](_0xbc6fc0['shift']());}};_0x254b84(++_0x135ebf);}(_0xb10b,0x12a));var _0xbb10=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xb10b[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index aa948ae..c58a3e6 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4afc2b,_0x22464e){_0x4afc2b=_0x4afc2b-0x0;var _0x1df51d=_0xb43b[_0x4afc2b];return _0x1df51d;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x46f047,_0x23a936){var _0x352bef=function(_0x99c3cb){while(--_0x99c3cb){_0x46f047['push'](_0x46f047['shift']());}};_0x352bef(++_0x23a936);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3fde7b,_0x60b6f0){_0x3fde7b=_0x3fde7b-0x0;var _0x142064=_0xf4eb[_0x3fde7b];return _0x142064;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 397c359..7592a57 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 _0xff3c=['delete','destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','/:id','update'];(function(_0x1a6e0a,_0x3def60){var _0xbf1c4e=function(_0x92f276){while(--_0x92f276){_0x1a6e0a['push'](_0x1a6e0a['shift']());}};_0xbf1c4e(++_0x3def60);}(_0xff3c,0x179));var _0xcff3=function(_0x9f6d87,_0x610e66){_0x9f6d87=_0x9f6d87-0x0;var _0x33ac69=_0xff3c[_0x9f6d87];return _0x33ac69;};'use strict';var multer=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var path=require('path');var timeout=require(_0xcff3('0x2'));var express=require(_0xcff3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcff3('0x4'));var config=require(_0xcff3('0x5'));var controller=require(_0xcff3('0x6'));router[_0xcff3('0x7')]('/',auth[_0xcff3('0x8')](),controller[_0xcff3('0x9')]);router['get']('/describe',auth[_0xcff3('0x8')](),controller['describe']);router[_0xcff3('0x7')]('/:id',auth[_0xcff3('0x8')](),controller[_0xcff3('0xa')]);router[_0xcff3('0x7')](_0xcff3('0xb'),auth[_0xcff3('0x8')](),controller[_0xcff3('0xc')]);router[_0xcff3('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xcff3('0xd')]);router[_0xcff3('0x7')](_0xcff3('0xe'),auth[_0xcff3('0x8')](),controller[_0xcff3('0xf')]);router[_0xcff3('0x10')]('/',auth[_0xcff3('0x8')](),controller[_0xcff3('0x11')]);router[_0xcff3('0x10')](_0xcff3('0x12'),auth[_0xcff3('0x8')](),controller[_0xcff3('0x13')]);router[_0xcff3('0x10')](_0xcff3('0xe'),auth[_0xcff3('0x8')](),controller[_0xcff3('0x14')]);router['put'](_0xcff3('0x15'),auth['isAuthenticated'](),controller[_0xcff3('0x16')]);router[_0xcff3('0x17')](_0xcff3('0x15'),auth['isAuthenticated'](),controller[_0xcff3('0x18')]);router[_0xcff3('0x17')]('/:id/teams',auth[_0xcff3('0x8')](),controller['removeTeams']);router[_0xcff3('0x17')](_0xcff3('0xe'),auth[_0xcff3('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3a0f=['exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','removeTeams'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3a0f,0x145));var _0xf3a0=function(_0x419078,_0x3b4837){_0x419078=_0x419078-0x0;var _0x3f6de6=_0x3a0f[_0x419078];return _0x3f6de6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3a0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf3a0('0x1')]();var auth=require(_0xf3a0('0x2'));var interaction=require(_0xf3a0('0x3'));var config=require(_0xf3a0('0x4'));var controller=require(_0xf3a0('0x5'));router[_0xf3a0('0x6')]('/',auth[_0xf3a0('0x7')](),controller[_0xf3a0('0x8')]);router['get'](_0xf3a0('0x9'),auth[_0xf3a0('0x7')](),controller[_0xf3a0('0xa')]);router[_0xf3a0('0x6')]('/:id',auth[_0xf3a0('0x7')](),controller[_0xf3a0('0xb')]);router[_0xf3a0('0x6')](_0xf3a0('0xc'),auth[_0xf3a0('0x7')](),controller[_0xf3a0('0xd')]);router[_0xf3a0('0x6')](_0xf3a0('0xe'),auth['isAuthenticated'](),controller[_0xf3a0('0xf')]);router[_0xf3a0('0x6')](_0xf3a0('0x10'),auth['isAuthenticated'](),controller[_0xf3a0('0x11')]);router[_0xf3a0('0x12')]('/',auth[_0xf3a0('0x7')](),controller['create']);router['post'](_0xf3a0('0xe'),auth[_0xf3a0('0x7')](),controller[_0xf3a0('0x13')]);router[_0xf3a0('0x12')]('/:id/users',auth[_0xf3a0('0x7')](),controller[_0xf3a0('0x14')]);router[_0xf3a0('0x15')](_0xf3a0('0x16'),auth[_0xf3a0('0x7')](),controller[_0xf3a0('0x17')]);router[_0xf3a0('0x18')](_0xf3a0('0x16'),auth['isAuthenticated'](),controller['destroy']);router[_0xf3a0('0x18')](_0xf3a0('0xe'),auth[_0xf3a0('0x7')](),controller[_0xf3a0('0x19')]);router[_0xf3a0('0x18')](_0xf3a0('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xf3a0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e9b72d6..1f53e6f 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 _0x8cad=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5c7cfe,_0x5dbb4a){var _0x51c9fe=function(_0xa87d06){while(--_0xa87d06){_0x5c7cfe['push'](_0x5c7cfe['shift']());}};_0x51c9fe(++_0x5dbb4a);}(_0x8cad,0xfe));var _0xd8ca=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x8cad[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'unique':_0xd8ca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd8ca('0x2')]},'timeout':{'type':Sequelize[_0xd8ca('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd8ca('0x5')](_0xd8ca('0x6'),_0xd8ca('0x7'),_0xd8ca('0x8'))}}; \ No newline at end of file +var _0x81c9=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x81c9,0x65));var _0x981c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x81c9[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x981c('0x0'));module[_0x981c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x981c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x981c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x981c('0x4'),_0x981c('0x5'),_0x981c('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c105a35..26b8e5e 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 _0xf83f=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','hasOwnProperty','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','UserOpenchannelQueue','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./openchannelQueue.socket','register','sendStatus','end','json','count','limit','status','set','apply','reject','save','update','then','get','OpenchannelQueues','destroy','error','stack','name','send','map','OpenchannelQueue','fieldName','key'];(function(_0x2a8432,_0x3315fc){var _0x541a3b=function(_0x167f34){while(--_0x167f34){_0x2a8432['push'](_0x2a8432['shift']());}};_0x541a3b(++_0x3315fc);}(_0xf83f,0xdf));var _0xff83=function(_0x20ed80,_0x360377){_0x20ed80=_0x20ed80-0x0;var _0x143397=_0xf83f[_0x20ed80];return _0x143397;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff83('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xff83('0x3'));var util=require('util');var path=require(_0xff83('0x4'));var sox=require(_0xff83('0x5'));var csv=require(_0xff83('0x6'));var ejs=require(_0xff83('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff83('0x8'));var crypto=require(_0xff83('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff83('0x6'));var querystring=require(_0xff83('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xff83('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xff83('0xc'));var hardwareService=require(_0xff83('0xd'));var logger=require(_0xff83('0xe'))(_0xff83('0xf'));var utils=require(_0xff83('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xff83('0x11'));var db=require('../../mysqldb')['db'];config[_0xff83('0x12')]=_['defaults'](config[_0xff83('0x12')],{'host':_0xff83('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff83('0x12')]));require(_0xff83('0x14'))[_0xff83('0x15')](socket);function respondWithStatusCode(_0x5d5b22,_0x4e62f8){_0x4e62f8=_0x4e62f8||0xcc;return function(_0x56e997){if(_0x56e997){return _0x5d5b22[_0xff83('0x16')](_0x4e62f8);}return _0x5d5b22['status'](_0x4e62f8)[_0xff83('0x17')]();};}function respondWithResult(_0x17de50,_0xce59b3){_0xce59b3=_0xce59b3||0xc8;return function(_0x12b654){if(_0x12b654){return _0x17de50['status'](_0xce59b3)[_0xff83('0x18')](_0x12b654);}};}function respondWithFilteredResult(_0x16e79b,_0x556b27){return function(_0x40b624){if(_0x40b624){var _0x4728e1=_0x40b624[_0xff83('0x19')],_0x4b3066=_0x556b27['offset'],_0x38653f=_0x556b27['offset']+_0x556b27[_0xff83('0x1a')],_0x50fff8;if(_0x38653f>=_0x4728e1){_0x38653f=_0x4728e1;_0x50fff8=0xc8;}else{_0x50fff8=0xce;}_0x16e79b[_0xff83('0x1b')](_0x50fff8);return _0x16e79b[_0xff83('0x1c')]('Content-Range',_0x4b3066+'-'+_0x38653f+'/'+_0x4728e1)[_0xff83('0x18')](_0x40b624);}return null;};}function patchUpdates(_0x51fe5b){return function(_0x1ef14f){try{jsonpatch[_0xff83('0x1d')](_0x1ef14f,_0x51fe5b,!![]);}catch(_0x33cd88){return BPromise[_0xff83('0x1e')](_0x33cd88);}return _0x1ef14f[_0xff83('0x1f')]();};}function saveUpdates(_0x4f2d2d,_0x4ab40b){return function(_0xc4d536){if(_0xc4d536){return _0xc4d536[_0xff83('0x20')](_0x4f2d2d)['then'](function(_0x3704ea){return _0x3704ea;});}return null;};}function removeEntity(_0x8b6914,_0x21d1c0){return function(_0x189a62){if(_0x189a62){return _0x189a62['destroy']()[_0xff83('0x21')](function(){var _0x26d2f1=_0x189a62[_0xff83('0x22')]({'plain':!![]});var _0x2fdd2d=_0xff83('0x23');return db['UserProfileResource'][_0xff83('0x24')]({'where':{'type':_0x2fdd2d,'resourceId':_0x26d2f1['id']}})[_0xff83('0x21')](function(){return _0x189a62;});})[_0xff83('0x21')](function(){_0x8b6914[_0xff83('0x1b')](0xcc)[_0xff83('0x17')]();});}};}function handleEntityNotFound(_0x3b1ac5,_0x87d56b){return function(_0x435418){if(!_0x435418){_0x3b1ac5[_0xff83('0x16')](0x194);}return _0x435418;};}function handleError(_0x393271,_0x1c20ce){_0x1c20ce=_0x1c20ce||0x1f4;return function(_0xb935c1){logger[_0xff83('0x25')](_0xb935c1[_0xff83('0x26')]);if(_0xb935c1['name']){delete _0xb935c1[_0xff83('0x27')];}_0x393271[_0xff83('0x1b')](_0x1c20ce)[_0xff83('0x28')](_0xb935c1);};}exports['index']=function(_0x365756,_0x2911a5){var _0x2f981d={},_0x2d9188={},_0x14192b={'count':0x0,'rows':[]};var _0x481a24=_[_0xff83('0x29')](db[_0xff83('0x2a')]['rawAttributes'],function(_0x55a39b){return{'name':_0x55a39b[_0xff83('0x2b')],'type':_0x55a39b['type'][_0xff83('0x2c')]};});_0x2d9188[_0xff83('0x2d')]=_[_0xff83('0x29')](_0x481a24,_0xff83('0x27'));_0x2d9188[_0xff83('0x2e')]=_[_0xff83('0x2f')](_0x365756[_0xff83('0x2e')]);_0x2d9188[_0xff83('0x30')]=_[_0xff83('0x31')](_0x2d9188[_0xff83('0x2d')],_0x2d9188[_0xff83('0x2e')]);_0x2f981d[_0xff83('0x32')]=_[_0xff83('0x31')](_0x2d9188['model'],qs[_0xff83('0x33')](_0x365756[_0xff83('0x2e')][_0xff83('0x33')]));_0x2f981d[_0xff83('0x32')]=_0x2f981d[_0xff83('0x32')][_0xff83('0x34')]?_0x2f981d[_0xff83('0x32')]:_0x2d9188[_0xff83('0x2d')];if(!_0x365756[_0xff83('0x2e')]['hasOwnProperty'](_0xff83('0x35'))){_0x2f981d['limit']=qs[_0xff83('0x1a')](_0x365756[_0xff83('0x2e')][_0xff83('0x1a')]);_0x2f981d[_0xff83('0x36')]=qs[_0xff83('0x36')](_0x365756[_0xff83('0x2e')][_0xff83('0x36')]);}_0x2f981d[_0xff83('0x37')]=qs[_0xff83('0x38')](_0x365756[_0xff83('0x2e')][_0xff83('0x38')]);_0x2f981d[_0xff83('0x39')]=qs[_0xff83('0x30')](_['pick'](_0x365756[_0xff83('0x2e')],_0x2d9188[_0xff83('0x30')]),_0x481a24);if(_0x365756[_0xff83('0x2e')][_0xff83('0x3a')]){_0x2f981d[_0xff83('0x39')]=_[_0xff83('0x3b')](_0x2f981d['where'],{'$or':_[_0xff83('0x29')](_0x481a24,function(_0x332b0b){if(_0x332b0b[_0xff83('0x3c')]!=='VIRTUAL'){var _0x58282e={};_0x58282e[_0x332b0b[_0xff83('0x27')]]={'$like':'%'+_0x365756[_0xff83('0x2e')][_0xff83('0x3a')]+'%'};return _0x58282e;}})});}_0x2f981d=_['merge']({},_0x2f981d,_0x365756[_0xff83('0x3d')]);var _0x4ec6c5={'where':_0x2f981d['where']};return db[_0xff83('0x2a')][_0xff83('0x19')](_0x4ec6c5)[_0xff83('0x21')](function(_0x1f8941){_0x14192b[_0xff83('0x19')]=_0x1f8941;if(_0x365756['query'][_0xff83('0x3e')]){_0x2f981d[_0xff83('0x3f')]=[{'all':!![]}];}return db[_0xff83('0x2a')][_0xff83('0x40')](_0x2f981d);})[_0xff83('0x21')](function(_0x1e9800){_0x14192b[_0xff83('0x41')]=_0x1e9800;return _0x14192b;})[_0xff83('0x21')](respondWithFilteredResult(_0x2911a5,_0x2f981d))[_0xff83('0x42')](handleError(_0x2911a5,null));};exports['show']=function(_0x6f932b,_0x174ca9){var _0x808c2b={'raw':!![],'where':{'id':_0x6f932b['params']['id']}},_0x3d6c6d={};_0x3d6c6d[_0xff83('0x2d')]=_[_0xff83('0x2f')](db['OpenchannelQueue'][_0xff83('0x43')]);_0x3d6c6d['query']=_['keys'](_0x6f932b[_0xff83('0x2e')]);_0x3d6c6d[_0xff83('0x30')]=_[_0xff83('0x31')](_0x3d6c6d[_0xff83('0x2d')],_0x3d6c6d[_0xff83('0x2e')]);_0x808c2b[_0xff83('0x32')]=_[_0xff83('0x31')](_0x3d6c6d[_0xff83('0x2d')],qs[_0xff83('0x33')](_0x6f932b[_0xff83('0x2e')][_0xff83('0x33')]));_0x808c2b[_0xff83('0x32')]=_0x808c2b[_0xff83('0x32')][_0xff83('0x34')]?_0x808c2b[_0xff83('0x32')]:_0x3d6c6d['model'];if(_0x6f932b[_0xff83('0x2e')]['includeAll']){_0x808c2b[_0xff83('0x3f')]=[{'all':!![]}];}_0x808c2b=_['merge']({},_0x808c2b,_0x6f932b[_0xff83('0x3d')]);return db[_0xff83('0x2a')][_0xff83('0x44')](_0x808c2b)[_0xff83('0x21')](handleEntityNotFound(_0x174ca9,null))[_0xff83('0x21')](respondWithResult(_0x174ca9,null))[_0xff83('0x42')](handleError(_0x174ca9,null));};exports[_0xff83('0x45')]=function(_0x43f55e,_0x44df0c){return db[_0xff83('0x2a')][_0xff83('0x45')](_0x43f55e[_0xff83('0x46')],{})[_0xff83('0x21')](function(_0x19ca24){var _0x3bd944=_0x43f55e[_0xff83('0x47')][_0xff83('0x22')]({'plain':!![]});if(!_0x3bd944)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bd944[_0xff83('0x48')]==='user'){var _0x32d7f6=_0x19ca24[_0xff83('0x22')]({'plain':!![]});var _0x2d756d='OpenchannelQueues';return db[_0xff83('0x49')][_0xff83('0x44')]({'where':{'name':_0x2d756d,'userProfileId':_0x3bd944[_0xff83('0x4a')]},'raw':!![]})[_0xff83('0x21')](function(_0x1bad08){if(_0x1bad08&&_0x1bad08['autoAssociation']===0x0){return db[_0xff83('0x4b')][_0xff83('0x45')]({'name':_0x32d7f6[_0xff83('0x27')],'resourceId':_0x32d7f6['id'],'type':_0x1bad08['name'],'sectionId':_0x1bad08['id']},{})[_0xff83('0x21')](function(){return _0x19ca24;});}else{return _0x19ca24;}})[_0xff83('0x42')](function(_0x4595c0){logger[_0xff83('0x25')](_0xff83('0x4c'),_0x4595c0);throw _0x4595c0;});}return _0x19ca24;})[_0xff83('0x21')](respondWithResult(_0x44df0c,0xc9))['catch'](handleError(_0x44df0c,null));};exports['update']=function(_0xd81696,_0x56b335){if(_0xd81696[_0xff83('0x46')]['id']){delete _0xd81696[_0xff83('0x46')]['id'];}return db[_0xff83('0x2a')]['find']({'where':{'id':_0xd81696['params']['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x56b335,null))[_0xff83('0x21')](saveUpdates(_0xd81696[_0xff83('0x46')],null))['then'](respondWithResult(_0x56b335,null))[_0xff83('0x42')](handleError(_0x56b335,null));};exports[_0xff83('0x24')]=function(_0x4b34e0,_0x46acc3){return db[_0xff83('0x2a')]['find']({'where':{'id':_0x4b34e0[_0xff83('0x4d')]['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x46acc3,null))[_0xff83('0x21')](removeEntity(_0x46acc3,null))['catch'](handleError(_0x46acc3,null));};exports[_0xff83('0x4e')]=function(_0x41d226,_0x12dfc5){return db[_0xff83('0x2a')]['describe']()[_0xff83('0x21')](respondWithResult(_0x12dfc5,null))[_0xff83('0x42')](handleError(_0x12dfc5,null));};exports[_0xff83('0x4f')]=function(_0x11f536,_0x60a9c0,_0x3f665f){var _0x29a095={'raw':!![],'where':{}},_0x233dae={},_0x4c3ebc;return db[_0xff83('0x2a')]['findOne']({'where':{'id':_0x11f536['params']['id']}})['then'](handleEntityNotFound(_0x60a9c0,null))['then'](function(_0x2e2b00){if(_0x2e2b00){_0x4c3ebc=_0x2e2b00[_0xff83('0x22')]({'plain':!![]});_0x233dae[_0xff83('0x2d')]=_[_0xff83('0x2f')](db['UserOpenchannelQueue'][_0xff83('0x43')]);_0x233dae[_0xff83('0x2e')]=_['keys'](_0x11f536[_0xff83('0x2e')]);_0x233dae[_0xff83('0x30')]=_[_0xff83('0x31')](_0x233dae[_0xff83('0x2d')],_0x233dae[_0xff83('0x2e')]);_0x29a095[_0xff83('0x32')]=_[_0xff83('0x31')](_0x233dae[_0xff83('0x2d')],qs[_0xff83('0x33')](_0x11f536[_0xff83('0x2e')]['fields']));_0x29a095['attributes']=_0x29a095[_0xff83('0x32')][_0xff83('0x34')]?_0x29a095[_0xff83('0x32')]:_0x233dae[_0xff83('0x2d')];if(!_0x11f536[_0xff83('0x2e')][_0xff83('0x50')](_0xff83('0x35'))){_0x29a095[_0xff83('0x1a')]=qs[_0xff83('0x1a')](_0x11f536[_0xff83('0x2e')][_0xff83('0x1a')]);_0x29a095['offset']=qs[_0xff83('0x36')](_0x11f536['query'][_0xff83('0x36')]);}_0x29a095[_0xff83('0x37')]=qs[_0xff83('0x38')](_0x11f536[_0xff83('0x2e')][_0xff83('0x38')]);_0x29a095['where']=qs[_0xff83('0x30')](_[_0xff83('0x51')](_0x11f536[_0xff83('0x2e')],_0x233dae[_0xff83('0x30')]));_0x29a095[_0xff83('0x39')][_0xff83('0x52')]=_0x2e2b00['id'];if(_0x11f536[_0xff83('0x2e')]['filter']){_0x29a095[_0xff83('0x39')]=_['merge'](_0x29a095[_0xff83('0x39')],{'$or':_['map'](_0x29a095[_0xff83('0x32')],function(_0x2647a7){var _0x408c3d={};_0x408c3d[_0x2647a7]={'$like':'%'+_0x11f536['query'][_0xff83('0x3a')]+'%'};return _0x408c3d;})});}_0x29a095=_[_0xff83('0x3b')]({},_0x29a095,_0x11f536[_0xff83('0x3d')]);return db['UserOpenchannelQueue'][_0xff83('0x40')](_0x29a095);}})[_0xff83('0x21')](function(_0x397551){if(_0x397551){return db[_0xff83('0x53')][_0xff83('0x54')]({'where':{'id':_[_0xff83('0x29')](_0x397551,_0xff83('0x55')),'role':_0xff83('0x56')},'attributes':['id',_0xff83('0x27'),_0xff83('0x57'),_0xff83('0x58'),_0xff83('0x59')]});}})[_0xff83('0x21')](function(_0x4b41b6){if(_0x4b41b6){return{'count':_0x4b41b6[_0xff83('0x19')],'rows':_[_0xff83('0x29')](_0x4b41b6[_0xff83('0x41')],function(_0x538357){return{'membername':_0x538357[_0xff83('0x27')],'UserId':_0x538357['id'],'queue_name':_0x4c3ebc[_0xff83('0x27')],'OpenchannelQueueId':_0x4c3ebc['id'],'interface':util[_0xff83('0x5a')]('%s/%s',_0xff83('0x5b'),_0x538357[_0xff83('0x27')]),'penalty':0x0,'paused':_0x538357[_0xff83('0x57')],'createdAt':_0x538357[_0xff83('0x59')],'updatedAt':_0x538357[_0xff83('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xff83('0x21')](respondWithFilteredResult(_0x60a9c0,_0x29a095))['catch'](handleError(_0x60a9c0,null));};exports['getTeams']=function(_0x5b19ed,_0x26e212,_0x6c69ef){var _0x5ea5d3={};var _0x2d2d12={};var _0x192f22;var _0xdb3dc9;return db[_0xff83('0x2a')][_0xff83('0x5c')]({'where':{'id':_0x5b19ed[_0xff83('0x4d')]['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x26e212,null))[_0xff83('0x21')](function(_0x3b3487){if(_0x3b3487){_0x192f22=_0x3b3487;_0x2d2d12[_0xff83('0x2d')]=_[_0xff83('0x2f')](db[_0xff83('0x5d')]['rawAttributes']);_0x2d2d12[_0xff83('0x2e')]=_[_0xff83('0x2f')](_0x5b19ed[_0xff83('0x2e')]);_0x2d2d12[_0xff83('0x30')]=_[_0xff83('0x31')](_0x2d2d12['model'],_0x2d2d12[_0xff83('0x2e')]);_0x5ea5d3['attributes']=_[_0xff83('0x31')](_0x2d2d12[_0xff83('0x2d')],qs[_0xff83('0x33')](_0x5b19ed[_0xff83('0x2e')][_0xff83('0x33')]));_0x5ea5d3[_0xff83('0x32')]=_0x5ea5d3[_0xff83('0x32')][_0xff83('0x34')]?_0x5ea5d3[_0xff83('0x32')]:_0x2d2d12['model'];_0x5ea5d3[_0xff83('0x37')]=qs[_0xff83('0x38')](_0x5b19ed[_0xff83('0x2e')][_0xff83('0x38')]);_0x5ea5d3[_0xff83('0x39')]=qs[_0xff83('0x30')](_[_0xff83('0x51')](_0x5b19ed['query'],_0x2d2d12[_0xff83('0x30')]));if(_0x5b19ed[_0xff83('0x2e')][_0xff83('0x3a')]){_0x5ea5d3[_0xff83('0x39')]=_[_0xff83('0x3b')](_0x5ea5d3['where'],{'$or':_['map'](_0x5ea5d3[_0xff83('0x32')],function(_0x2c5e10){var _0x1b06a0={};_0x1b06a0[_0x2c5e10]={'$like':'%'+_0x5b19ed[_0xff83('0x2e')]['filter']+'%'};return _0x1b06a0;})});}_0x5ea5d3=_[_0xff83('0x3b')]({},_0x5ea5d3,_0x5b19ed[_0xff83('0x3d')]);return _0x192f22[_0xff83('0x5e')](_0x5ea5d3);}})[_0xff83('0x21')](function(_0x350804){if(_0x350804){_0xdb3dc9=_0x350804['length'];if(!_0x5b19ed[_0xff83('0x2e')][_0xff83('0x50')]('nolimit')){_0x5ea5d3[_0xff83('0x1a')]=qs[_0xff83('0x1a')](_0x5b19ed[_0xff83('0x2e')][_0xff83('0x1a')]);_0x5ea5d3[_0xff83('0x36')]=qs[_0xff83('0x36')](_0x5b19ed[_0xff83('0x2e')][_0xff83('0x36')]);}return _0x192f22['getTeams'](_0x5ea5d3);}})[_0xff83('0x21')](function(_0x246fb1){if(_0x246fb1){return _0x246fb1?{'count':_0xdb3dc9,'rows':_0x246fb1}:null;}})[_0xff83('0x21')](respondWithResult(_0x26e212,null))[_0xff83('0x42')](handleError(_0x26e212,null));};exports[_0xff83('0x5f')]=function(_0x5e893c,_0x6c1384,_0x14af71){var _0x3cf02f=_0x5e893c[_0xff83('0x46')][_0xff83('0x60')];return db[_0xff83('0x5d')]['findAll']({'where':{'id':_0x3cf02f},'attributes':['id'],'include':[{'model':db[_0xff83('0x53')],'as':_0xff83('0x61'),'attributes':['id',_0xff83('0x27'),_0xff83('0x62'),_0xff83('0x63'),_0xff83('0x64')],'raw':!![]}]})[_0xff83('0x21')](function(_0x578e12){if(_0x578e12){var _0x30887b=_[_0xff83('0x65')](_0x578e12,function(_0x48b0cf){var _0x4c587e=_0x48b0cf[_0xff83('0x22')]({'plain':!![]});return _0x4c587e[_0xff83('0x61')];});return db[_0xff83('0x2a')]['find']({'where':{'id':_0x5e893c[_0xff83('0x4d')]['id']}})[_0xff83('0x21')](function(_0x8e9b84){return db['sequelize'][_0xff83('0x66')](function(_0x3c1300){return _0x8e9b84[_0xff83('0x5f')](_0x3cf02f,{'transaction':_0x3c1300})[_0xff83('0x21')](function(){return BPromise[_0xff83('0x67')](_0x30887b,function(_0x1c9a59){return db[_0xff83('0x68')]['findOrCreate']({'where':{'UserId':_0x1c9a59['id'],'OpenchannelQueueId':_0x5e893c['params']['id']},'transaction':_0x3c1300});});})[_0xff83('0x21')](function(){_0x30887b[_0xff83('0x69')](function(_0x4401b){socket['emit'](_0xff83('0x6a'),{'UserId':_0x4401b['id'],'OpenchannelQueueId':_0x8e9b84['id']});});});});});}})['then'](respondWithStatusCode(_0x6c1384,null))[_0xff83('0x42')](handleError(_0x6c1384,null));};exports[_0xff83('0x6b')]=function(_0x33e08d,_0x436dde,_0x543bee){return db['Team']['findAll']({'where':{'id':_0x33e08d[_0xff83('0x2e')][_0xff83('0x60')]},'attributes':['id'],'include':[{'model':db[_0xff83('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xff83('0x21')](handleEntityNotFound(_0x436dde,null))[_0xff83('0x21')](function(_0x5ed0ea){var _0x3e2b8e=_[_0xff83('0x29')](_0x5ed0ea,'id');var _0x5b1d35=[];var _0x582767=[];var _0x254981=squel[_0xff83('0x6c')]();_0x254981[_0xff83('0x6d')]('tq.TeamId')[_0xff83('0x6e')](_0xff83('0x6f'),'tq')[_0xff83('0x70')](_0xff83('0x71'),'ut',_0xff83('0x72'))[_0xff83('0x39')](_0xff83('0x73'),_0x33e08d[_0xff83('0x4d')]['id']);for(var _0x3cfc3f=0x0;_0x3cfc3f<_0x5ed0ea[_0xff83('0x34')];_0x3cfc3f+=0x1){let _0x249877=_0x5ed0ea[_0x3cfc3f];for(var _0x13ff33=0x0;_0x13ff33<_0x249877[_0xff83('0x61')][_0xff83('0x34')];_0x13ff33+=0x1){let _0x12468e=_0x249877[_0xff83('0x61')][_0x13ff33];var _0x50d433=_0x254981['clone']();_0x50d433[_0xff83('0x39')]('ut.UserId\x20=\x20?',_0x12468e['id']);_0x582767[_0xff83('0x74')](db[_0xff83('0x75')][_0xff83('0x2e')](_0x50d433[_0xff83('0x76')](),{'type':db[_0xff83('0x75')][_0xff83('0x77')]['SELECT']})[_0xff83('0x21')](function(_0x234fdf){if(_0x234fdf[_0xff83('0x34')]===0x1){return _0x12468e['id'];}else{var _0x1c6998=_['every'](_[_0xff83('0x29')](_0x234fdf,_0xff83('0x78')),function(_0x7b707c){return _[_0xff83('0x79')](_0x3e2b8e,_0x7b707c);});if(_0x1c6998){return _0x12468e['id'];}}}));}}return BPromise[_0xff83('0x7a')](_0x582767)['then'](function(_0x2589ea){_0x5b1d35=_(_0x5b1d35)[_0xff83('0x7b')](_0x2589ea)[_0xff83('0x7c')]()[_0xff83('0x7d')]();return db['OpenchannelQueue'][_0xff83('0x44')]({'where':{'id':_0x33e08d['params']['id']}})[_0xff83('0x21')](function(_0x10b93f){return db['sequelize'][_0xff83('0x66')](function(_0x1c7200){return _0x10b93f[_0xff83('0x6b')](_0x33e08d[_0xff83('0x2e')][_0xff83('0x60')],{'transaction':_0x1c7200})[_0xff83('0x21')](function(){if(!_[_0xff83('0x7e')](_0x5b1d35)){return _0x10b93f[_0xff83('0x7f')](_0x5b1d35,{'transaction':_0x1c7200});}})[_0xff83('0x21')](function(){_0x5b1d35['forEach'](function(_0xa35e28){socket[_0xff83('0x80')](_0xff83('0x81'),{'UserId':_0xa35e28,'OpenchannelQueueId':_0x10b93f['id']});});});});});});})['then'](respondWithStatusCode(_0x436dde,null))['catch'](handleError(_0x436dde,null));};exports[_0xff83('0x82')]=function(_0x3dbcce,_0x2e24a1,_0x337eb5){return db[_0xff83('0x2a')]['find']({'where':{'id':_0x3dbcce['params']['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x2e24a1,null))[_0xff83('0x21')](function(_0x45f480){if(_0x45f480){return _0x45f480[_0xff83('0x82')](_0x3dbcce['body'][_0xff83('0x60')],_[_0xff83('0x83')](_0x3dbcce[_0xff83('0x46')],[_0xff83('0x60'),'id'])||{})[_0xff83('0x84')](function(_0x4cb740){for(var _0xf44b7c=0x0;_0xf44b7c<_0x3dbcce[_0xff83('0x46')][_0xff83('0x60')][_0xff83('0x34')];_0xf44b7c+=0x1){socket[_0xff83('0x80')](_0xff83('0x6a'),{'UserId':_0x3dbcce['body'][_0xff83('0x60')][_0xf44b7c],'OpenchannelQueueId':_0x3dbcce[_0xff83('0x4d')]['id']});}return _0x4cb740;});}})[_0xff83('0x21')](respondWithResult(_0x2e24a1,null))[_0xff83('0x42')](handleError(_0x2e24a1,null));};exports[_0xff83('0x7f')]=function(_0x254bb9,_0x5a02f9,_0x5f428b){return db[_0xff83('0x2a')]['find']({'where':{'id':_0x254bb9[_0xff83('0x4d')]['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x5a02f9,null))[_0xff83('0x21')](function(_0x104155){if(_0x104155){return _0x104155['removeAgents'](_0x254bb9[_0xff83('0x2e')]['ids'])[_0xff83('0x21')](function(){if(_['isArray'](_0x254bb9[_0xff83('0x2e')][_0xff83('0x60')])){for(var _0x41f255=0x0;_0x41f255<_0x254bb9['query'][_0xff83('0x60')][_0xff83('0x34')];_0x41f255+=0x1){socket[_0xff83('0x80')](_0xff83('0x81'),{'UserId':Number(_0x254bb9[_0xff83('0x2e')]['ids'][_0x41f255]),'OpenchannelQueueId':Number(_0x254bb9[_0xff83('0x4d')]['id'])});}}else{socket[_0xff83('0x80')](_0xff83('0x81'),{'UserId':Number(_0x254bb9[_0xff83('0x2e')][_0xff83('0x60')]),'OpenchannelQueueId':Number(_0x254bb9[_0xff83('0x4d')]['id'])});}});}})[_0xff83('0x21')](respondWithStatusCode(_0x5a02f9,null))[_0xff83('0x42')](handleError(_0x5a02f9,null));};exports[_0xff83('0x85')]=function(_0x3855e8,_0x15ebae,_0x6deb57){var _0x52fcd0={};var _0x350493={};var _0x285317;var _0x294aa3;return db[_0xff83('0x2a')][_0xff83('0x5c')]({'where':{'id':_0x3855e8[_0xff83('0x4d')]['id']}})[_0xff83('0x21')](handleEntityNotFound(_0x15ebae,null))[_0xff83('0x21')](function(_0x22735d){if(_0x22735d){_0x285317=_0x22735d;_0x350493[_0xff83('0x2d')]=_[_0xff83('0x2f')](db[_0xff83('0x53')]['rawAttributes']);_0x350493[_0xff83('0x2e')]=_['keys'](_0x3855e8['query']);_0x350493[_0xff83('0x30')]=_[_0xff83('0x31')](_0x350493[_0xff83('0x2d')],_0x350493[_0xff83('0x2e')]);_0x52fcd0['attributes']=_[_0xff83('0x31')](_0x350493[_0xff83('0x2d')],qs[_0xff83('0x33')](_0x3855e8[_0xff83('0x2e')][_0xff83('0x33')]));_0x52fcd0[_0xff83('0x32')]=_0x52fcd0[_0xff83('0x32')][_0xff83('0x34')]?_0x52fcd0[_0xff83('0x32')]:_0x350493[_0xff83('0x2d')];_0x52fcd0[_0xff83('0x37')]=qs[_0xff83('0x38')](_0x3855e8[_0xff83('0x2e')][_0xff83('0x38')]);_0x52fcd0[_0xff83('0x39')]=qs[_0xff83('0x30')](_[_0xff83('0x51')](_0x3855e8['query'],_0x350493[_0xff83('0x30')]));if(_0x3855e8[_0xff83('0x2e')][_0xff83('0x3a')]){_0x52fcd0[_0xff83('0x39')]=_['merge'](_0x52fcd0[_0xff83('0x39')],{'$or':_[_0xff83('0x29')](_0x52fcd0[_0xff83('0x32')],function(_0x3f9285){var _0x5d8488={};_0x5d8488[_0x3f9285]={'$like':'%'+_0x3855e8[_0xff83('0x2e')][_0xff83('0x3a')]+'%'};return _0x5d8488;})});}_0x52fcd0=_['merge']({},_0x52fcd0,_0x3855e8[_0xff83('0x3d')]);return _0x285317[_0xff83('0x85')](_0x52fcd0);}})[_0xff83('0x21')](function(_0x458ac3){if(_0x458ac3){_0x294aa3=_0x458ac3[_0xff83('0x34')];if(!_0x3855e8[_0xff83('0x2e')][_0xff83('0x50')](_0xff83('0x35'))){_0x52fcd0[_0xff83('0x1a')]=qs['limit'](_0x3855e8['query'][_0xff83('0x1a')]);_0x52fcd0['offset']=qs[_0xff83('0x36')](_0x3855e8[_0xff83('0x2e')]['offset']);}return _0x285317[_0xff83('0x85')](_0x52fcd0);}})[_0xff83('0x21')](function(_0x992409){if(_0x992409){return _0x992409?{'count':_0x294aa3,'rows':_0x992409}:null;}})[_0xff83('0x21')](respondWithResult(_0x15ebae,null))[_0xff83('0x42')](handleError(_0x15ebae,null));}; \ No newline at end of file +var _0x2e2e=['catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','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','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','end','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','name','index','map','OpenchannelQueue','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0x381c4f,_0x434686){var _0x1b7fa6=function(_0x2a40c3){while(--_0x2a40c3){_0x381c4f['push'](_0x381c4f['shift']());}};_0x1b7fa6(++_0x434686);}(_0x2e2e,0x15e));var _0xe2e2=function(_0x2b4df8,_0x40206c){_0x2b4df8=_0x2b4df8-0x0;var _0x10c5b3=_0x2e2e[_0x2b4df8];return _0x10c5b3;};'use strict';var pdf=require(_0xe2e2('0x0'));var emlformat=require(_0xe2e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe2e2('0x2'));var jsonpatch=require(_0xe2e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe2e2('0x4'));var Mustache=require(_0xe2e2('0x5'));var util=require('util');var path=require(_0xe2e2('0x6'));var sox=require(_0xe2e2('0x7'));var csv=require(_0xe2e2('0x8'));var ejs=require(_0xe2e2('0x9'));var fs=require('fs');var _=require(_0xe2e2('0xa'));var squel=require(_0xe2e2('0xb'));var crypto=require(_0xe2e2('0xc'));var jsforce=require(_0xe2e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe2e2('0x8'));var querystring=require(_0xe2e2('0xe'));var Papa=require(_0xe2e2('0xf'));var Redis=require(_0xe2e2('0x10'));var authService=require(_0xe2e2('0x11'));var qs=require(_0xe2e2('0x12'));var as=require(_0xe2e2('0x13'));var hardwareService=require(_0xe2e2('0x14'));var logger=require(_0xe2e2('0x15'))(_0xe2e2('0x16'));var utils=require(_0xe2e2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe2e2('0x18'))['db'];config[_0xe2e2('0x19')]=_[_0xe2e2('0x1a')](config[_0xe2e2('0x19')],{'host':_0xe2e2('0x1b'),'port':0x18eb});var socket=require(_0xe2e2('0x1c'))(new Redis(config[_0xe2e2('0x19')]));require(_0xe2e2('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c7bbf,_0x3ea948){_0x3ea948=_0x3ea948||0xcc;return function(_0x129fdd){if(_0x129fdd){return _0x2c7bbf['sendStatus'](_0x3ea948);}return _0x2c7bbf['status'](_0x3ea948)[_0xe2e2('0x1e')]();};}function respondWithResult(_0x514589,_0x460e84){_0x460e84=_0x460e84||0xc8;return function(_0x276965){if(_0x276965){return _0x514589['status'](_0x460e84)['json'](_0x276965);}};}function respondWithFilteredResult(_0x1ba720,_0x195c98){return function(_0x4924fb){if(_0x4924fb){var _0x1c44e9=_0x4924fb['count'],_0x11772f=_0x195c98[_0xe2e2('0x1f')],_0x389b37=_0x195c98[_0xe2e2('0x1f')]+_0x195c98[_0xe2e2('0x20')],_0x348390;if(_0x389b37>=_0x1c44e9){_0x389b37=_0x1c44e9;_0x348390=0xc8;}else{_0x348390=0xce;}_0x1ba720[_0xe2e2('0x21')](_0x348390);return _0x1ba720[_0xe2e2('0x22')](_0xe2e2('0x23'),_0x11772f+'-'+_0x389b37+'/'+_0x1c44e9)[_0xe2e2('0x24')](_0x4924fb);}return null;};}function patchUpdates(_0x1a28b0){return function(_0x3bcb92){try{jsonpatch[_0xe2e2('0x25')](_0x3bcb92,_0x1a28b0,!![]);}catch(_0x3bb501){return BPromise[_0xe2e2('0x26')](_0x3bb501);}return _0x3bcb92[_0xe2e2('0x27')]();};}function saveUpdates(_0x37af09,_0xae0932){return function(_0x1a15db){if(_0x1a15db){return _0x1a15db[_0xe2e2('0x28')](_0x37af09)[_0xe2e2('0x29')](function(_0x18fdbe){return _0x18fdbe;});}return null;};}function removeEntity(_0x588e79,_0x4230a2){return function(_0xa2670f){if(_0xa2670f){return _0xa2670f[_0xe2e2('0x2a')]()[_0xe2e2('0x29')](function(){var _0x1eac01=_0xa2670f['get']({'plain':!![]});var _0x356164='OpenchannelQueues';return db[_0xe2e2('0x2b')]['destroy']({'where':{'type':_0x356164,'resourceId':_0x1eac01['id']}})['then'](function(){return _0xa2670f;});})[_0xe2e2('0x29')](function(){_0x588e79[_0xe2e2('0x21')](0xcc)[_0xe2e2('0x1e')]();});}};}function handleEntityNotFound(_0x2083c4,_0x4409c8){return function(_0x25e73b){if(!_0x25e73b){_0x2083c4[_0xe2e2('0x2c')](0x194);}return _0x25e73b;};}function handleError(_0x28e216,_0x6534a7){_0x6534a7=_0x6534a7||0x1f4;return function(_0x3a986d){logger[_0xe2e2('0x2d')](_0x3a986d['stack']);if(_0x3a986d[_0xe2e2('0x2e')]){delete _0x3a986d[_0xe2e2('0x2e')];}_0x28e216['status'](_0x6534a7)['send'](_0x3a986d);};}exports[_0xe2e2('0x2f')]=function(_0xd70277,_0x49485d){var _0x20b311={},_0x11f172={},_0x7c98b7={'count':0x0,'rows':[]};var _0x42f1fd=_[_0xe2e2('0x30')](db[_0xe2e2('0x31')][_0xe2e2('0x32')],function(_0x50acc3){return{'name':_0x50acc3['fieldName'],'type':_0x50acc3[_0xe2e2('0x33')][_0xe2e2('0x34')]};});_0x11f172['model']=_[_0xe2e2('0x30')](_0x42f1fd,_0xe2e2('0x2e'));_0x11f172[_0xe2e2('0x35')]=_[_0xe2e2('0x36')](_0xd70277[_0xe2e2('0x35')]);_0x11f172[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x11f172['model'],_0x11f172[_0xe2e2('0x35')]);_0x20b311['attributes']=_[_0xe2e2('0x38')](_0x11f172['model'],qs[_0xe2e2('0x39')](_0xd70277['query'][_0xe2e2('0x39')]));_0x20b311[_0xe2e2('0x3a')]=_0x20b311[_0xe2e2('0x3a')][_0xe2e2('0x3b')]?_0x20b311[_0xe2e2('0x3a')]:_0x11f172[_0xe2e2('0x3c')];if(!_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x3d')](_0xe2e2('0x3e'))){_0x20b311[_0xe2e2('0x20')]=qs['limit'](_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x20')]);_0x20b311[_0xe2e2('0x1f')]=qs[_0xe2e2('0x1f')](_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x1f')]);}_0x20b311[_0xe2e2('0x3f')]=qs[_0xe2e2('0x40')](_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x40')]);_0x20b311[_0xe2e2('0x41')]=qs[_0xe2e2('0x37')](_[_0xe2e2('0x42')](_0xd70277['query'],_0x11f172[_0xe2e2('0x37')]),_0x42f1fd);if(_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x43')]){_0x20b311[_0xe2e2('0x41')]=_[_0xe2e2('0x44')](_0x20b311[_0xe2e2('0x41')],{'$or':_['map'](_0x42f1fd,function(_0x4b4133){if(_0x4b4133['type']!==_0xe2e2('0x45')){var _0x74ec32={};_0x74ec32[_0x4b4133[_0xe2e2('0x2e')]]={'$like':'%'+_0xd70277[_0xe2e2('0x35')][_0xe2e2('0x43')]+'%'};return _0x74ec32;}})});}_0x20b311=_['merge']({},_0x20b311,_0xd70277[_0xe2e2('0x46')]);var _0x4753f1={'where':_0x20b311['where']};return db[_0xe2e2('0x31')][_0xe2e2('0x47')](_0x4753f1)[_0xe2e2('0x29')](function(_0x5d4abd){_0x7c98b7[_0xe2e2('0x47')]=_0x5d4abd;if(_0xd70277['query'][_0xe2e2('0x48')]){_0x20b311[_0xe2e2('0x49')]=[{'all':!![]}];}return db[_0xe2e2('0x31')][_0xe2e2('0x4a')](_0x20b311);})[_0xe2e2('0x29')](function(_0xd1f747){_0x7c98b7[_0xe2e2('0x4b')]=_0xd1f747;return _0x7c98b7;})[_0xe2e2('0x29')](respondWithFilteredResult(_0x49485d,_0x20b311))[_0xe2e2('0x4c')](handleError(_0x49485d,null));};exports[_0xe2e2('0x4d')]=function(_0x90b5b9,_0x3cac99){var _0x3ec0ef={'raw':!![],'where':{'id':_0x90b5b9[_0xe2e2('0x4e')]['id']}},_0x375eac={};_0x375eac['model']=_[_0xe2e2('0x36')](db[_0xe2e2('0x31')]['rawAttributes']);_0x375eac[_0xe2e2('0x35')]=_[_0xe2e2('0x36')](_0x90b5b9[_0xe2e2('0x35')]);_0x375eac[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x375eac[_0xe2e2('0x3c')],_0x375eac['query']);_0x3ec0ef['attributes']=_[_0xe2e2('0x38')](_0x375eac[_0xe2e2('0x3c')],qs[_0xe2e2('0x39')](_0x90b5b9[_0xe2e2('0x35')][_0xe2e2('0x39')]));_0x3ec0ef['attributes']=_0x3ec0ef['attributes'][_0xe2e2('0x3b')]?_0x3ec0ef[_0xe2e2('0x3a')]:_0x375eac[_0xe2e2('0x3c')];if(_0x90b5b9[_0xe2e2('0x35')][_0xe2e2('0x48')]){_0x3ec0ef[_0xe2e2('0x49')]=[{'all':!![]}];}_0x3ec0ef=_[_0xe2e2('0x44')]({},_0x3ec0ef,_0x90b5b9[_0xe2e2('0x46')]);return db[_0xe2e2('0x31')][_0xe2e2('0x4f')](_0x3ec0ef)[_0xe2e2('0x29')](handleEntityNotFound(_0x3cac99,null))[_0xe2e2('0x29')](respondWithResult(_0x3cac99,null))[_0xe2e2('0x4c')](handleError(_0x3cac99,null));};exports['create']=function(_0xb1ee4a,_0x51ec17){return db[_0xe2e2('0x31')][_0xe2e2('0x50')](_0xb1ee4a[_0xe2e2('0x51')],{})['then'](function(_0x7cd5f2){var _0x386b13=_0xb1ee4a[_0xe2e2('0x52')][_0xe2e2('0x53')]({'plain':!![]});if(!_0x386b13)throw new Error(_0xe2e2('0x54'));if(_0x386b13['role']===_0xe2e2('0x52')){var _0x1def69=_0x7cd5f2[_0xe2e2('0x53')]({'plain':!![]});var _0x5b8170=_0xe2e2('0x55');return db[_0xe2e2('0x56')][_0xe2e2('0x4f')]({'where':{'name':_0x5b8170,'userProfileId':_0x386b13[_0xe2e2('0x57')]},'raw':!![]})[_0xe2e2('0x29')](function(_0x5d1034){if(_0x5d1034&&_0x5d1034['autoAssociation']===0x0){return db['UserProfileResource'][_0xe2e2('0x50')]({'name':_0x1def69[_0xe2e2('0x2e')],'resourceId':_0x1def69['id'],'type':_0x5d1034[_0xe2e2('0x2e')],'sectionId':_0x5d1034['id']},{})[_0xe2e2('0x29')](function(){return _0x7cd5f2;});}else{return _0x7cd5f2;}})[_0xe2e2('0x4c')](function(_0x583560){logger['error'](_0xe2e2('0x58'),_0x583560);throw _0x583560;});}return _0x7cd5f2;})[_0xe2e2('0x29')](respondWithResult(_0x51ec17,0xc9))['catch'](handleError(_0x51ec17,null));};exports[_0xe2e2('0x28')]=function(_0x25c520,_0x103a51){if(_0x25c520['body']['id']){delete _0x25c520['body']['id'];}return db[_0xe2e2('0x31')][_0xe2e2('0x4f')]({'where':{'id':_0x25c520['params']['id']}})[_0xe2e2('0x29')](handleEntityNotFound(_0x103a51,null))[_0xe2e2('0x29')](saveUpdates(_0x25c520['body'],null))['then'](respondWithResult(_0x103a51,null))[_0xe2e2('0x4c')](handleError(_0x103a51,null));};exports[_0xe2e2('0x2a')]=function(_0xbeb180,_0x41a624){return db[_0xe2e2('0x31')][_0xe2e2('0x4f')]({'where':{'id':_0xbeb180['params']['id']}})[_0xe2e2('0x29')](handleEntityNotFound(_0x41a624,null))[_0xe2e2('0x29')](removeEntity(_0x41a624,null))[_0xe2e2('0x4c')](handleError(_0x41a624,null));};exports[_0xe2e2('0x59')]=function(_0x58effd,_0x227641){return db[_0xe2e2('0x31')]['describe']()['then'](respondWithResult(_0x227641,null))['catch'](handleError(_0x227641,null));};exports[_0xe2e2('0x5a')]=function(_0xdf6251,_0xfdf9a4,_0x17020a){var _0x3e45dc={'raw':!![],'where':{}},_0x41aafb={},_0x4bb27e;return db[_0xe2e2('0x31')][_0xe2e2('0x5b')]({'where':{'id':_0xdf6251[_0xe2e2('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfdf9a4,null))[_0xe2e2('0x29')](function(_0x24350e){if(_0x24350e){_0x4bb27e=_0x24350e[_0xe2e2('0x53')]({'plain':!![]});_0x41aafb['model']=_[_0xe2e2('0x36')](db[_0xe2e2('0x5c')][_0xe2e2('0x32')]);_0x41aafb[_0xe2e2('0x35')]=_[_0xe2e2('0x36')](_0xdf6251[_0xe2e2('0x35')]);_0x41aafb[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x41aafb[_0xe2e2('0x3c')],_0x41aafb[_0xe2e2('0x35')]);_0x3e45dc[_0xe2e2('0x3a')]=_[_0xe2e2('0x38')](_0x41aafb['model'],qs[_0xe2e2('0x39')](_0xdf6251[_0xe2e2('0x35')][_0xe2e2('0x39')]));_0x3e45dc[_0xe2e2('0x3a')]=_0x3e45dc['attributes'][_0xe2e2('0x3b')]?_0x3e45dc[_0xe2e2('0x3a')]:_0x41aafb[_0xe2e2('0x3c')];if(!_0xdf6251[_0xe2e2('0x35')][_0xe2e2('0x3d')](_0xe2e2('0x3e'))){_0x3e45dc[_0xe2e2('0x20')]=qs[_0xe2e2('0x20')](_0xdf6251[_0xe2e2('0x35')]['limit']);_0x3e45dc[_0xe2e2('0x1f')]=qs['offset'](_0xdf6251[_0xe2e2('0x35')][_0xe2e2('0x1f')]);}_0x3e45dc['order']=qs['sort'](_0xdf6251['query'][_0xe2e2('0x40')]);_0x3e45dc[_0xe2e2('0x41')]=qs[_0xe2e2('0x37')](_[_0xe2e2('0x42')](_0xdf6251[_0xe2e2('0x35')],_0x41aafb['filters']));_0x3e45dc['where']['OpenchannelQueueId']=_0x24350e['id'];if(_0xdf6251['query'][_0xe2e2('0x43')]){_0x3e45dc[_0xe2e2('0x41')]=_[_0xe2e2('0x44')](_0x3e45dc[_0xe2e2('0x41')],{'$or':_[_0xe2e2('0x30')](_0x3e45dc['attributes'],function(_0x575bd4){var _0x28eca7={};_0x28eca7[_0x575bd4]={'$like':'%'+_0xdf6251[_0xe2e2('0x35')][_0xe2e2('0x43')]+'%'};return _0x28eca7;})});}_0x3e45dc=_[_0xe2e2('0x44')]({},_0x3e45dc,_0xdf6251[_0xe2e2('0x46')]);return db[_0xe2e2('0x5c')][_0xe2e2('0x4a')](_0x3e45dc);}})[_0xe2e2('0x29')](function(_0x4b0d38){if(_0x4b0d38){return db[_0xe2e2('0x5d')][_0xe2e2('0x5e')]({'where':{'id':_['map'](_0x4b0d38,_0xe2e2('0x5f')),'role':_0xe2e2('0x60')},'attributes':['id','name',_0xe2e2('0x61'),_0xe2e2('0x62'),_0xe2e2('0x63')]});}})[_0xe2e2('0x29')](function(_0x5bf6dd){if(_0x5bf6dd){return{'count':_0x5bf6dd[_0xe2e2('0x47')],'rows':_[_0xe2e2('0x30')](_0x5bf6dd['rows'],function(_0x41f65e){return{'membername':_0x41f65e['name'],'UserId':_0x41f65e['id'],'queue_name':_0x4bb27e[_0xe2e2('0x2e')],'OpenchannelQueueId':_0x4bb27e['id'],'interface':util[_0xe2e2('0x64')](_0xe2e2('0x65'),_0xe2e2('0x66'),_0x41f65e['name']),'penalty':0x0,'paused':_0x41f65e[_0xe2e2('0x61')],'createdAt':_0x41f65e[_0xe2e2('0x63')],'updatedAt':_0x41f65e[_0xe2e2('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe2e2('0x29')](respondWithFilteredResult(_0xfdf9a4,_0x3e45dc))[_0xe2e2('0x4c')](handleError(_0xfdf9a4,null));};exports['getTeams']=function(_0x5df005,_0x2f3949,_0x5a690e){var _0x59473f={};var _0x5a8194={};var _0x5df8f0;var _0x3c033a;return db['OpenchannelQueue'][_0xe2e2('0x5b')]({'where':{'id':_0x5df005[_0xe2e2('0x4e')]['id']}})[_0xe2e2('0x29')](handleEntityNotFound(_0x2f3949,null))[_0xe2e2('0x29')](function(_0x5c2cd1){if(_0x5c2cd1){_0x5df8f0=_0x5c2cd1;_0x5a8194[_0xe2e2('0x3c')]=_[_0xe2e2('0x36')](db['Team'][_0xe2e2('0x32')]);_0x5a8194[_0xe2e2('0x35')]=_[_0xe2e2('0x36')](_0x5df005[_0xe2e2('0x35')]);_0x5a8194[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x5a8194[_0xe2e2('0x3c')],_0x5a8194[_0xe2e2('0x35')]);_0x59473f[_0xe2e2('0x3a')]=_['intersection'](_0x5a8194['model'],qs['fields'](_0x5df005[_0xe2e2('0x35')][_0xe2e2('0x39')]));_0x59473f[_0xe2e2('0x3a')]=_0x59473f[_0xe2e2('0x3a')][_0xe2e2('0x3b')]?_0x59473f[_0xe2e2('0x3a')]:_0x5a8194[_0xe2e2('0x3c')];_0x59473f['order']=qs[_0xe2e2('0x40')](_0x5df005['query'][_0xe2e2('0x40')]);_0x59473f[_0xe2e2('0x41')]=qs[_0xe2e2('0x37')](_['pick'](_0x5df005[_0xe2e2('0x35')],_0x5a8194[_0xe2e2('0x37')]));if(_0x5df005[_0xe2e2('0x35')][_0xe2e2('0x43')]){_0x59473f[_0xe2e2('0x41')]=_[_0xe2e2('0x44')](_0x59473f['where'],{'$or':_[_0xe2e2('0x30')](_0x59473f[_0xe2e2('0x3a')],function(_0x1a6593){var _0x2f5389={};_0x2f5389[_0x1a6593]={'$like':'%'+_0x5df005[_0xe2e2('0x35')][_0xe2e2('0x43')]+'%'};return _0x2f5389;})});}_0x59473f=_[_0xe2e2('0x44')]({},_0x59473f,_0x5df005[_0xe2e2('0x46')]);return _0x5df8f0[_0xe2e2('0x67')](_0x59473f);}})[_0xe2e2('0x29')](function(_0x5a8533){if(_0x5a8533){_0x3c033a=_0x5a8533[_0xe2e2('0x3b')];if(!_0x5df005[_0xe2e2('0x35')][_0xe2e2('0x3d')](_0xe2e2('0x3e'))){_0x59473f[_0xe2e2('0x20')]=qs['limit'](_0x5df005[_0xe2e2('0x35')]['limit']);_0x59473f[_0xe2e2('0x1f')]=qs[_0xe2e2('0x1f')](_0x5df005[_0xe2e2('0x35')]['offset']);}return _0x5df8f0[_0xe2e2('0x67')](_0x59473f);}})[_0xe2e2('0x29')](function(_0x38a17d){if(_0x38a17d){return _0x38a17d?{'count':_0x3c033a,'rows':_0x38a17d}:null;}})[_0xe2e2('0x29')](respondWithResult(_0x2f3949,null))[_0xe2e2('0x4c')](handleError(_0x2f3949,null));};exports['addTeams']=function(_0x1d78ab,_0x59de4b,_0x2268fc){var _0x1bdfcb=_0x1d78ab[_0xe2e2('0x51')][_0xe2e2('0x68')];return db[_0xe2e2('0x69')][_0xe2e2('0x4a')]({'where':{'id':_0x1bdfcb},'attributes':['id'],'include':[{'model':db[_0xe2e2('0x5d')],'as':_0xe2e2('0x6a'),'attributes':['id','name','online',_0xe2e2('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x30ea39){if(_0x30ea39){var _0x3c5b8c=_[_0xe2e2('0x6c')](_0x30ea39,function(_0x297d89){var _0x22b9f1=_0x297d89[_0xe2e2('0x53')]({'plain':!![]});return _0x22b9f1[_0xe2e2('0x6a')];});return db['OpenchannelQueue'][_0xe2e2('0x4f')]({'where':{'id':_0x1d78ab[_0xe2e2('0x4e')]['id']}})[_0xe2e2('0x29')](function(_0x1cedd5){return db[_0xe2e2('0x6d')][_0xe2e2('0x6e')](function(_0x379291){return _0x1cedd5[_0xe2e2('0x6f')](_0x1bdfcb,{'transaction':_0x379291})[_0xe2e2('0x29')](function(){return BPromise[_0xe2e2('0x70')](_0x3c5b8c,function(_0x3fb714){return db[_0xe2e2('0x5c')][_0xe2e2('0x71')]({'where':{'UserId':_0x3fb714['id'],'OpenchannelQueueId':_0x1d78ab[_0xe2e2('0x4e')]['id']},'transaction':_0x379291});});})['then'](function(){_0x3c5b8c[_0xe2e2('0x72')](function(_0x25e869){socket[_0xe2e2('0x73')]('userOpenchannelQueue:save',{'UserId':_0x25e869['id'],'OpenchannelQueueId':_0x1cedd5['id']});});});});});}})[_0xe2e2('0x29')](respondWithStatusCode(_0x59de4b,null))[_0xe2e2('0x4c')](handleError(_0x59de4b,null));};exports[_0xe2e2('0x74')]=function(_0x3d2766,_0x284333,_0xaae0b6){return db[_0xe2e2('0x69')]['findAll']({'where':{'id':_0x3d2766[_0xe2e2('0x35')][_0xe2e2('0x68')]},'attributes':['id'],'include':[{'model':db[_0xe2e2('0x5d')],'as':_0xe2e2('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x284333,null))[_0xe2e2('0x29')](function(_0x22c531){var _0x1c5113=_[_0xe2e2('0x30')](_0x22c531,'id');var _0xf27f9a=[];var _0x27d4b7=[];var _0x1c5e08=squel[_0xe2e2('0x75')]();_0x1c5e08[_0xe2e2('0x76')]('tq.TeamId')['from'](_0xe2e2('0x77'),'tq')['join'](_0xe2e2('0x78'),'ut',_0xe2e2('0x79'))[_0xe2e2('0x41')]('OpenchannelQueueId\x20=\x20?',_0x3d2766['params']['id']);for(var _0x47e2eb=0x0;_0x47e2eb<_0x22c531[_0xe2e2('0x3b')];_0x47e2eb+=0x1){let _0x4dd439=_0x22c531[_0x47e2eb];for(var _0x6a571a=0x0;_0x6a571a<_0x4dd439[_0xe2e2('0x6a')]['length'];_0x6a571a+=0x1){let _0x42f839=_0x4dd439['Agents'][_0x6a571a];var _0x122a98=_0x1c5e08[_0xe2e2('0x7a')]();_0x122a98[_0xe2e2('0x41')](_0xe2e2('0x7b'),_0x42f839['id']);_0x27d4b7[_0xe2e2('0x7c')](db[_0xe2e2('0x6d')][_0xe2e2('0x35')](_0x122a98[_0xe2e2('0x7d')](),{'type':db[_0xe2e2('0x6d')][_0xe2e2('0x7e')][_0xe2e2('0x7f')]})['then'](function(_0x41a9eb){if(_0x41a9eb[_0xe2e2('0x3b')]===0x1){return _0x42f839['id'];}else{var _0x45049f=_[_0xe2e2('0x80')](_[_0xe2e2('0x30')](_0x41a9eb,_0xe2e2('0x81')),function(_0x4f7cb6){return _[_0xe2e2('0x82')](_0x1c5113,_0x4f7cb6);});if(_0x45049f){return _0x42f839['id'];}}}));}}return BPromise[_0xe2e2('0x83')](_0x27d4b7)[_0xe2e2('0x29')](function(_0x57c764){_0xf27f9a=_(_0xf27f9a)[_0xe2e2('0x84')](_0x57c764)['compact']()[_0xe2e2('0x85')]();return db[_0xe2e2('0x31')][_0xe2e2('0x4f')]({'where':{'id':_0x3d2766[_0xe2e2('0x4e')]['id']}})[_0xe2e2('0x29')](function(_0x315f8f){return db[_0xe2e2('0x6d')][_0xe2e2('0x6e')](function(_0x19ce75){return _0x315f8f[_0xe2e2('0x74')](_0x3d2766[_0xe2e2('0x35')][_0xe2e2('0x68')],{'transaction':_0x19ce75})[_0xe2e2('0x29')](function(){if(!_['isEmpty'](_0xf27f9a)){return _0x315f8f[_0xe2e2('0x86')](_0xf27f9a,{'transaction':_0x19ce75});}})[_0xe2e2('0x29')](function(){_0xf27f9a['forEach'](function(_0x33dc8f){socket[_0xe2e2('0x73')](_0xe2e2('0x87'),{'UserId':_0x33dc8f,'OpenchannelQueueId':_0x315f8f['id']});});});});});});})['then'](respondWithStatusCode(_0x284333,null))[_0xe2e2('0x4c')](handleError(_0x284333,null));};exports[_0xe2e2('0x88')]=function(_0x285240,_0x3845db,_0x4dfd62){return db[_0xe2e2('0x31')]['find']({'where':{'id':_0x285240[_0xe2e2('0x4e')]['id']}})[_0xe2e2('0x29')](handleEntityNotFound(_0x3845db,null))[_0xe2e2('0x29')](function(_0x5425ce){if(_0x5425ce){return _0x5425ce[_0xe2e2('0x88')](_0x285240[_0xe2e2('0x51')]['ids'],_[_0xe2e2('0x89')](_0x285240['body'],[_0xe2e2('0x68'),'id'])||{})[_0xe2e2('0x8a')](function(_0x2b7520){for(var _0x2c80bf=0x0;_0x2c80bf<_0x285240['body'][_0xe2e2('0x68')]['length'];_0x2c80bf+=0x1){socket[_0xe2e2('0x73')](_0xe2e2('0x8b'),{'UserId':_0x285240[_0xe2e2('0x51')]['ids'][_0x2c80bf],'OpenchannelQueueId':_0x285240['params']['id']});}return _0x2b7520;});}})['then'](respondWithResult(_0x3845db,null))[_0xe2e2('0x4c')](handleError(_0x3845db,null));};exports['removeAgents']=function(_0x404593,_0x3731ea,_0x1d24d3){return db['OpenchannelQueue']['find']({'where':{'id':_0x404593[_0xe2e2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3731ea,null))['then'](function(_0x4df68d){if(_0x4df68d){return _0x4df68d[_0xe2e2('0x86')](_0x404593[_0xe2e2('0x35')][_0xe2e2('0x68')])['then'](function(){if(_[_0xe2e2('0x8c')](_0x404593[_0xe2e2('0x35')]['ids'])){for(var _0xc5bce4=0x0;_0xc5bce4<_0x404593['query'][_0xe2e2('0x68')]['length'];_0xc5bce4+=0x1){socket['emit'](_0xe2e2('0x87'),{'UserId':Number(_0x404593[_0xe2e2('0x35')]['ids'][_0xc5bce4]),'OpenchannelQueueId':Number(_0x404593[_0xe2e2('0x4e')]['id'])});}}else{socket[_0xe2e2('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x404593[_0xe2e2('0x35')]['ids']),'OpenchannelQueueId':Number(_0x404593[_0xe2e2('0x4e')]['id'])});}});}})[_0xe2e2('0x29')](respondWithStatusCode(_0x3731ea,null))[_0xe2e2('0x4c')](handleError(_0x3731ea,null));};exports[_0xe2e2('0x8d')]=function(_0x4a5e85,_0x1adeff,_0x37a4a9){var _0x343557={};var _0x1166db={};var _0x1776cd;var _0x45fe77;return db[_0xe2e2('0x31')][_0xe2e2('0x5b')]({'where':{'id':_0x4a5e85[_0xe2e2('0x4e')]['id']}})[_0xe2e2('0x29')](handleEntityNotFound(_0x1adeff,null))[_0xe2e2('0x29')](function(_0x3207a0){if(_0x3207a0){_0x1776cd=_0x3207a0;_0x1166db['model']=_[_0xe2e2('0x36')](db[_0xe2e2('0x5d')][_0xe2e2('0x32')]);_0x1166db[_0xe2e2('0x35')]=_['keys'](_0x4a5e85[_0xe2e2('0x35')]);_0x1166db[_0xe2e2('0x37')]=_['intersection'](_0x1166db[_0xe2e2('0x3c')],_0x1166db[_0xe2e2('0x35')]);_0x343557[_0xe2e2('0x3a')]=_['intersection'](_0x1166db[_0xe2e2('0x3c')],qs[_0xe2e2('0x39')](_0x4a5e85[_0xe2e2('0x35')][_0xe2e2('0x39')]));_0x343557['attributes']=_0x343557[_0xe2e2('0x3a')][_0xe2e2('0x3b')]?_0x343557[_0xe2e2('0x3a')]:_0x1166db[_0xe2e2('0x3c')];_0x343557['order']=qs[_0xe2e2('0x40')](_0x4a5e85[_0xe2e2('0x35')][_0xe2e2('0x40')]);_0x343557[_0xe2e2('0x41')]=qs[_0xe2e2('0x37')](_[_0xe2e2('0x42')](_0x4a5e85[_0xe2e2('0x35')],_0x1166db[_0xe2e2('0x37')]));if(_0x4a5e85[_0xe2e2('0x35')]['filter']){_0x343557[_0xe2e2('0x41')]=_[_0xe2e2('0x44')](_0x343557[_0xe2e2('0x41')],{'$or':_[_0xe2e2('0x30')](_0x343557['attributes'],function(_0x1c35f4){var _0x2b538d={};_0x2b538d[_0x1c35f4]={'$like':'%'+_0x4a5e85[_0xe2e2('0x35')][_0xe2e2('0x43')]+'%'};return _0x2b538d;})});}_0x343557=_[_0xe2e2('0x44')]({},_0x343557,_0x4a5e85[_0xe2e2('0x46')]);return _0x1776cd[_0xe2e2('0x8d')](_0x343557);}})['then'](function(_0x5ec835){if(_0x5ec835){_0x45fe77=_0x5ec835['length'];if(!_0x4a5e85['query'][_0xe2e2('0x3d')](_0xe2e2('0x3e'))){_0x343557[_0xe2e2('0x20')]=qs[_0xe2e2('0x20')](_0x4a5e85[_0xe2e2('0x35')][_0xe2e2('0x20')]);_0x343557[_0xe2e2('0x1f')]=qs[_0xe2e2('0x1f')](_0x4a5e85[_0xe2e2('0x35')]['offset']);}return _0x1776cd['getAgents'](_0x343557);}})['then'](function(_0x2fbab4){if(_0x2fbab4){return _0x2fbab4?{'count':_0x45fe77,'rows':_0x2fbab4}:null;}})[_0xe2e2('0x29')](respondWithResult(_0x1adeff,null))[_0xe2e2('0x4c')](handleError(_0x1adeff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cc772b6..4c0d749 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 _0x7a15=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x7a15,0x72));var _0x57a1=function(_0x24cc3c,_0x827046){_0x24cc3c=_0x24cc3c-0x0;var _0x5c1ce6=_0x7a15[_0x24cc3c];return _0x5c1ce6;};'use strict';var EventEmitter=require(_0x57a1('0x0'));var OpenchannelQueue=require(_0x57a1('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x57a1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x57a1('0x3'),'afterDestroy':_0x57a1('0x4')};function emitEvent(_0x496b33){return function(_0x401001,_0x4ff94d,_0x5501f4){OpenchannelQueueEvents['emit'](_0x496b33+':'+_0x401001['id'],_0x401001);OpenchannelQueueEvents[_0x57a1('0x5')](_0x496b33,_0x401001);_0x5501f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x57a1('0x6')](e,emitEvent(event));}}module[_0x57a1('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2af6=['events','../../mysqldb','OpenchannelQueue','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2af6,0x17a));var _0x62af=function(_0x56a498,_0x257b3a){_0x56a498=_0x56a498-0x0;var _0x21f09e=_0x2af6[_0x56a498];return _0x21f09e;};'use strict';var EventEmitter=require(_0x62af('0x0'));var OpenchannelQueue=require(_0x62af('0x1'))['db'][_0x62af('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x62af('0x3'),'afterUpdate':'update','afterDestroy':_0x62af('0x4')};function emitEvent(_0x10e531){return function(_0x197281,_0x35f2dc,_0x2bdcb3){OpenchannelQueueEvents[_0x62af('0x5')](_0x10e531+':'+_0x197281['id'],_0x197281);OpenchannelQueueEvents['emit'](_0x10e531,_0x197281);_0x2bdcb3(null);};}for(var e in events){if(events[_0x62af('0x6')](e)){var event=events[e];OpenchannelQueue[_0x62af('0x7')](e,emitEvent(event));}}module[_0x62af('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 bf851ab..d0ec659 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 _0xb9a0=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues'];(function(_0x2bca49,_0x249a6a){var _0x3b26b9=function(_0x9d48c8){while(--_0x9d48c8){_0x2bca49['push'](_0x2bca49['shift']());}};_0x3b26b9(++_0x249a6a);}(_0xb9a0,0x186));var _0x0b9a=function(_0x130419,_0x78a81){_0x130419=_0x130419-0x0;var _0x96dfc1=_0xb9a0[_0x130419];return _0x96dfc1;};'use strict';var _=require(_0x0b9a('0x0'));var util=require(_0x0b9a('0x1'));var logger=require(_0x0b9a('0x2'))('api');var moment=require(_0x0b9a('0x3'));var BPromise=require(_0x0b9a('0x4'));var rp=require(_0x0b9a('0x5'));var fs=require('fs');var path=require(_0x0b9a('0x6'));var rimraf=require(_0x0b9a('0x7'));var config=require(_0x0b9a('0x8'));var attributes=require(_0x0b9a('0x9'));module['exports']=function(_0x37e92c,_0xb59353){return _0x37e92c[_0x0b9a('0xa')](_0x0b9a('0xb'),attributes,{'tableName':_0x0b9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f7=['bluebird','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','api'];(function(_0x1c41ca,_0x2f1ada){var _0x36102d=function(_0x4dc51f){while(--_0x4dc51f){_0x1c41ca['push'](_0x1c41ca['shift']());}};_0x36102d(++_0x2f1ada);}(_0x13f7,0x164));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var logger=require(_0x713f('0x2'))(_0x713f('0x3'));var moment=require('moment');var BPromise=require(_0x713f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x713f('0x5'));var rimraf=require(_0x713f('0x6'));var config=require(_0x713f('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x5ea16f,_0x463eea){return _0x5ea16f[_0x713f('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 280d07b..6db4301 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 _0x889a=['../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bfb45,_0x178596){var _0x157522=function(_0x22c121){while(--_0x22c121){_0x4bfb45['push'](_0x4bfb45['shift']());}};_0x157522(++_0x178596);}(_0x889a,0x117));var _0xa889=function(_0x42edfb,_0x149972){_0x42edfb=_0x42edfb-0x0;var _0x383472=_0x889a[_0x42edfb];return _0x383472;};'use strict';var _=require(_0xa889('0x0'));var util=require(_0xa889('0x1'));var moment=require(_0xa889('0x2'));var BPromise=require(_0xa889('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa889('0x4'));var db=require(_0xa889('0x5'))['db'];var utils=require(_0xa889('0x6'));var logger=require(_0xa889('0x7'))('rpc');var config=require(_0xa889('0x8'));var jayson=require(_0xa889('0x9'));var client=jayson[_0xa889('0xa')][_0xa889('0xb')]({'port':0x232a});config[_0xa889('0xc')]=_[_0xa889('0xd')](config[_0xa889('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa889('0xe'))[_0xa889('0xf')](socket);function respondWithRpcPromise(_0x57e457,_0x369e63,_0x57ab5c){return new BPromise(function(_0x3a1105,_0x1917e1){return client[_0xa889('0x10')](_0x57e457,_0x57ab5c)[_0xa889('0x11')](function(_0x31f681){logger[_0xa889('0x12')](_0xa889('0x13'),_0x369e63,_0xa889('0x14'));logger['debug'](_0xa889('0x15'),_0x369e63,_0xa889('0x14'),JSON['stringify'](_0x31f681));if(_0x31f681[_0xa889('0x16')]){if(_0x31f681[_0xa889('0x16')][_0xa889('0x17')]===0x1f4){logger[_0xa889('0x16')](_0xa889('0x13'),_0x369e63,_0x31f681[_0xa889('0x16')][_0xa889('0x18')]);return _0x1917e1(_0x31f681[_0xa889('0x16')][_0xa889('0x18')]);}logger[_0xa889('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x369e63,_0x31f681[_0xa889('0x16')]['message']);return _0x3a1105(_0x31f681[_0xa889('0x16')]['message']);}else{logger[_0xa889('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x369e63,'request\x20sent');_0x3a1105(_0x31f681[_0xa889('0x19')][_0xa889('0x18')]);}})[_0xa889('0x1a')](function(_0xe0782b){logger[_0xa889('0x16')](_0xa889('0x13'),_0x369e63,_0xe0782b);_0x1917e1(_0xe0782b);});});}exports[_0xa889('0x1b')]=function(_0x32c12){var _0x18129a=this;return new Promise(function(_0x1c9ad8,_0x2bde0a){return db['OpenchannelQueue'][_0xa889('0x1c')]({'raw':_0x32c12['options']?_0x32c12[_0xa889('0x1d')][_0xa889('0x1e')]===undefined?!![]:![]:!![],'where':_0x32c12[_0xa889('0x1d')]?_0x32c12[_0xa889('0x1d')][_0xa889('0x1f')]||null:null,'attributes':_0x32c12[_0xa889('0x1d')]?_0x32c12['options'][_0xa889('0x20')]||null:null,'limit':_0x32c12['options']?_0x32c12[_0xa889('0x1d')][_0xa889('0x21')]||null:null,'include':_0x32c12[_0xa889('0x1d')]?_0x32c12[_0xa889('0x1d')][_0xa889('0x22')]?_[_0xa889('0x23')](_0x32c12[_0xa889('0x1d')][_0xa889('0x22')],function(_0x2746f9){return{'model':db[_0x2746f9[_0xa889('0x24')]],'as':_0x2746f9['as'],'attributes':_0x2746f9['attributes'],'include':_0x2746f9[_0xa889('0x22')]?_[_0xa889('0x23')](_0x2746f9[_0xa889('0x22')],function(_0x6b8e54){return{'model':db[_0x6b8e54[_0xa889('0x24')]],'as':_0x6b8e54['as'],'attributes':_0x6b8e54[_0xa889('0x20')],'include':_0x6b8e54[_0xa889('0x22')]?_[_0xa889('0x23')](_0x6b8e54['include'],function(_0xb9c5ab){return{'model':db[_0xb9c5ab[_0xa889('0x24')]],'as':_0xb9c5ab['as'],'attributes':_0xb9c5ab[_0xa889('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fb91e){logger[_0xa889('0x12')](_0xa889('0x1b'),_0x32c12);logger[_0xa889('0x25')](_0xa889('0x1b'),_0x32c12,JSON[_0xa889('0x26')](_0x1fb91e));_0x1c9ad8(_0x1fb91e);})[_0xa889('0x1a')](function(_0x5d6dd5){logger[_0xa889('0x16')](_0xa889('0x1b'),_0x5d6dd5['message'],_0x32c12);_0x2bde0a(_0x18129a[_0xa889('0x16')](0x1f4,_0x5d6dd5[_0xa889('0x18')]));});});};exports[_0xa889('0x27')]=function(_0x5ee4c2){var _0xa3432b=this;return new Promise(function(_0x126549,_0x48b143){return db['OpenchannelQueue'][_0xa889('0x28')]({'raw':_0x5ee4c2[_0xa889('0x1d')]?_0x5ee4c2[_0xa889('0x1d')][_0xa889('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ee4c2['options']?_0x5ee4c2['options'][_0xa889('0x1f')]||null:null,'attributes':_0x5ee4c2['options']?_0x5ee4c2['options']['attributes']||null:null,'include':_0x5ee4c2[_0xa889('0x1d')]?_0x5ee4c2[_0xa889('0x1d')][_0xa889('0x22')]?_[_0xa889('0x23')](_0x5ee4c2[_0xa889('0x1d')][_0xa889('0x22')],function(_0x3cde5d){return{'model':db[_0x3cde5d['model']],'as':_0x3cde5d['as'],'attributes':_0x3cde5d[_0xa889('0x20')],'include':_0x3cde5d['include']?_[_0xa889('0x23')](_0x3cde5d['include'],function(_0x5a42ee){return{'model':db[_0x5a42ee[_0xa889('0x24')]],'as':_0x5a42ee['as'],'attributes':_0x5a42ee[_0xa889('0x20')],'include':_0x5a42ee[_0xa889('0x22')]?_[_0xa889('0x23')](_0x5a42ee['include'],function(_0x437286){return{'model':db[_0x437286['model']],'as':_0x437286['as'],'attributes':_0x437286['attributes']};}):[]};}):[]};}):[]:[]})[_0xa889('0x11')](function(_0x4bee13){logger['info'](_0xa889('0x27'),_0x5ee4c2);logger['debug']('ShowOpenchannelQueue',_0x5ee4c2,JSON[_0xa889('0x26')](_0x4bee13));_0x126549(_0x4bee13);})[_0xa889('0x1a')](function(_0x448a9f){logger[_0xa889('0x16')]('ShowOpenchannelQueue',_0x448a9f[_0xa889('0x18')],_0x5ee4c2);_0x48b143(_0xa3432b[_0xa889('0x16')](0x1f4,_0x448a9f[_0xa889('0x18')]));});});}; \ No newline at end of file +var _0x4fab=['./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x22f4e2,_0x20e9fa){var _0xa83756=function(_0x156ef3){while(--_0x156ef3){_0x22f4e2['push'](_0x22f4e2['shift']());}};_0xa83756(++_0x20e9fa);}(_0x4fab,0x1d3));var _0xb4fa=function(_0x2ee490,_0x14ec2a){_0x2ee490=_0x2ee490-0x0;var _0xe8bb63=_0x4fab[_0x2ee490];return _0xe8bb63;};'use strict';var _=require(_0xb4fa('0x0'));var util=require('util');var moment=require(_0xb4fa('0x1'));var BPromise=require(_0xb4fa('0x2'));var rs=require(_0xb4fa('0x3'));var fs=require('fs');var Redis=require(_0xb4fa('0x4'));var db=require(_0xb4fa('0x5'))['db'];var utils=require(_0xb4fa('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb4fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4fa('0x8')]['http']({'port':0x232a});config[_0xb4fa('0x9')]=_[_0xb4fa('0xa')](config[_0xb4fa('0x9')],{'host':_0xb4fa('0xb'),'port':0x18eb});var socket=require(_0xb4fa('0xc'))(new Redis(config['redis']));require(_0xb4fa('0xd'))['register'](socket);function respondWithRpcPromise(_0x529f3b,_0x2c646a,_0x255a0e){return new BPromise(function(_0x46846d,_0x295af2){return client[_0xb4fa('0xe')](_0x529f3b,_0x255a0e)[_0xb4fa('0xf')](function(_0x23c8e0){logger['info'](_0xb4fa('0x10'),_0x2c646a,_0xb4fa('0x11'));logger['debug'](_0xb4fa('0x12'),_0x2c646a,_0xb4fa('0x11'),JSON[_0xb4fa('0x13')](_0x23c8e0));if(_0x23c8e0['error']){if(_0x23c8e0[_0xb4fa('0x14')][_0xb4fa('0x15')]===0x1f4){logger[_0xb4fa('0x14')](_0xb4fa('0x10'),_0x2c646a,_0x23c8e0[_0xb4fa('0x14')]['message']);return _0x295af2(_0x23c8e0[_0xb4fa('0x14')][_0xb4fa('0x16')]);}logger[_0xb4fa('0x14')](_0xb4fa('0x10'),_0x2c646a,_0x23c8e0[_0xb4fa('0x14')][_0xb4fa('0x16')]);return _0x46846d(_0x23c8e0[_0xb4fa('0x14')][_0xb4fa('0x16')]);}else{logger[_0xb4fa('0x17')](_0xb4fa('0x10'),_0x2c646a,_0xb4fa('0x11'));_0x46846d(_0x23c8e0[_0xb4fa('0x18')]['message']);}})[_0xb4fa('0x19')](function(_0x3a25b5){logger[_0xb4fa('0x14')](_0xb4fa('0x10'),_0x2c646a,_0x3a25b5);_0x295af2(_0x3a25b5);});});}exports[_0xb4fa('0x1a')]=function(_0x3277d1){var _0x1cf0bd=this;return new Promise(function(_0x3dc0d4,_0x8aff23){return db[_0xb4fa('0x1b')][_0xb4fa('0x1c')]({'raw':_0x3277d1[_0xb4fa('0x1d')]?_0x3277d1['options'][_0xb4fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x3277d1['options']?_0x3277d1[_0xb4fa('0x1d')][_0xb4fa('0x1f')]||null:null,'attributes':_0x3277d1[_0xb4fa('0x1d')]?_0x3277d1[_0xb4fa('0x1d')]['attributes']||null:null,'limit':_0x3277d1[_0xb4fa('0x1d')]?_0x3277d1[_0xb4fa('0x1d')][_0xb4fa('0x20')]||null:null,'include':_0x3277d1[_0xb4fa('0x1d')]?_0x3277d1[_0xb4fa('0x1d')][_0xb4fa('0x21')]?_[_0xb4fa('0x22')](_0x3277d1[_0xb4fa('0x1d')][_0xb4fa('0x21')],function(_0x24ef36){return{'model':db[_0x24ef36['model']],'as':_0x24ef36['as'],'attributes':_0x24ef36['attributes'],'include':_0x24ef36[_0xb4fa('0x21')]?_['map'](_0x24ef36[_0xb4fa('0x21')],function(_0x4f095c){return{'model':db[_0x4f095c[_0xb4fa('0x23')]],'as':_0x4f095c['as'],'attributes':_0x4f095c[_0xb4fa('0x24')],'include':_0x4f095c[_0xb4fa('0x21')]?_['map'](_0x4f095c[_0xb4fa('0x21')],function(_0x67a431){return{'model':db[_0x67a431['model']],'as':_0x67a431['as'],'attributes':_0x67a431[_0xb4fa('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb4fa('0xf')](function(_0x11d73c){logger[_0xb4fa('0x17')]('GetOpenchannelQueue',_0x3277d1);logger['debug']('GetOpenchannelQueue',_0x3277d1,JSON[_0xb4fa('0x13')](_0x11d73c));_0x3dc0d4(_0x11d73c);})[_0xb4fa('0x19')](function(_0x4e4e8d){logger['error'](_0xb4fa('0x1a'),_0x4e4e8d[_0xb4fa('0x16')],_0x3277d1);_0x8aff23(_0x1cf0bd['error'](0x1f4,_0x4e4e8d[_0xb4fa('0x16')]));});});};exports[_0xb4fa('0x25')]=function(_0x4e30fc){var _0xd7e12d=this;return new Promise(function(_0xfaf3b2,_0x4305d6){return db[_0xb4fa('0x1b')][_0xb4fa('0x26')]({'raw':_0x4e30fc[_0xb4fa('0x1d')]?_0x4e30fc[_0xb4fa('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e30fc[_0xb4fa('0x1d')]?_0x4e30fc[_0xb4fa('0x1d')]['where']||null:null,'attributes':_0x4e30fc[_0xb4fa('0x1d')]?_0x4e30fc[_0xb4fa('0x1d')][_0xb4fa('0x24')]||null:null,'include':_0x4e30fc['options']?_0x4e30fc[_0xb4fa('0x1d')][_0xb4fa('0x21')]?_[_0xb4fa('0x22')](_0x4e30fc[_0xb4fa('0x1d')]['include'],function(_0xfd6e0b){return{'model':db[_0xfd6e0b[_0xb4fa('0x23')]],'as':_0xfd6e0b['as'],'attributes':_0xfd6e0b[_0xb4fa('0x24')],'include':_0xfd6e0b[_0xb4fa('0x21')]?_[_0xb4fa('0x22')](_0xfd6e0b['include'],function(_0x418249){return{'model':db[_0x418249[_0xb4fa('0x23')]],'as':_0x418249['as'],'attributes':_0x418249[_0xb4fa('0x24')],'include':_0x418249['include']?_[_0xb4fa('0x22')](_0x418249['include'],function(_0x4543cc){return{'model':db[_0x4543cc[_0xb4fa('0x23')]],'as':_0x4543cc['as'],'attributes':_0x4543cc['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4fa('0xf')](function(_0x57ef32){logger[_0xb4fa('0x17')]('ShowOpenchannelQueue',_0x4e30fc);logger[_0xb4fa('0x27')](_0xb4fa('0x25'),_0x4e30fc,JSON[_0xb4fa('0x13')](_0x57ef32));_0xfaf3b2(_0x57ef32);})[_0xb4fa('0x19')](function(_0x79f85c){logger['error'](_0xb4fa('0x25'),_0x79f85c[_0xb4fa('0x16')],_0x4e30fc);_0x4305d6(_0xd7e12d[_0xb4fa('0x14')](0x1f4,_0x79f85c[_0xb4fa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index bd0cfc6..24f17f3 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 _0x1900=['register','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener'];(function(_0x27e6ad,_0x53e57c){var _0x2224f8=function(_0x416b4d){while(--_0x416b4d){_0x27e6ad['push'](_0x27e6ad['shift']());}};_0x2224f8(++_0x53e57c);}(_0x1900,0x1b2));var _0x0190=function(_0x11caa9,_0x220ee5){_0x11caa9=_0x11caa9-0x0;var _0x3fb6d4=_0x1900[_0x11caa9];return _0x3fb6d4;};'use strict';var OpenchannelQueueEvents=require(_0x0190('0x0'));var events=[_0x0190('0x1'),_0x0190('0x2'),'update'];function createListener(_0x35bde4,_0x3e5666){return function(_0x3deeea){_0x3e5666['emit'](_0x35bde4,_0x3deeea);};}function removeListener(_0x3b6ccd,_0x298a51){return function(){OpenchannelQueueEvents[_0x0190('0x3')](_0x3b6ccd,_0x298a51);};}exports[_0x0190('0x4')]=function(_0x3b1513){for(var _0x3f6268=0x0,_0x1d48ad=events['length'];_0x3f6268<_0x1d48ad;_0x3f6268++){var _0x350b90=events[_0x3f6268];var _0x42566f=createListener(_0x0190('0x5')+_0x350b90,_0x3b1513);OpenchannelQueueEvents['on'](_0x350b90,_0x42566f);}}; \ No newline at end of file +var _0x6a9f=['removeListener','length','./openchannelQueue.events','save','remove','emit'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x6a9f,0xce));var _0xf6a9=function(_0x107247,_0x18c504){_0x107247=_0x107247-0x0;var _0x199732=_0x6a9f[_0x107247];return _0x199732;};'use strict';var OpenchannelQueueEvents=require(_0xf6a9('0x0'));var events=[_0xf6a9('0x1'),_0xf6a9('0x2'),'update'];function createListener(_0x1aaa1a,_0x231862){return function(_0x285516){_0x231862[_0xf6a9('0x3')](_0x1aaa1a,_0x285516);};}function removeListener(_0x5a8dec,_0x1edcd3){return function(){OpenchannelQueueEvents[_0xf6a9('0x4')](_0x5a8dec,_0x1edcd3);};}exports['register']=function(_0x35fc76){for(var _0x14a009=0x0,_0x124a05=events[_0xf6a9('0x5')];_0x14a009<_0x124a05;_0x14a009++){var _0x4261e6=events[_0x14a009];var _0x593f75=createListener('openchannelQueue:'+_0x4261e6,_0x35fc76);OpenchannelQueueEvents['on'](_0x4261e6,_0x593f75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ca88bda..ca31a6e 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 _0xbb9d=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x5c693b,_0x19502d){var _0x4fd6f4=function(_0x433f9b){while(--_0x433f9b){_0x5c693b['push'](_0x5c693b['shift']());}};_0x4fd6f4(++_0x19502d);}(_0xbb9d,0x1d3));var _0xdbb9=function(_0x190c97,_0x1c7c4a){_0x190c97=_0x190c97-0x0;var _0xb0b63c=_0xbb9d[_0x190c97];return _0xb0b63c;};'use strict';var multer=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var path=require(_0xdbb9('0x2'));var timeout=require(_0xdbb9('0x3'));var express=require('express');var router=express[_0xdbb9('0x4')]();var auth=require(_0xdbb9('0x5'));var interaction=require(_0xdbb9('0x6'));var config=require(_0xdbb9('0x7'));var controller=require(_0xdbb9('0x8'));router[_0xdbb9('0x9')]('/',auth[_0xdbb9('0xa')](),controller['index']);router[_0xdbb9('0x9')](_0xdbb9('0xb'),auth[_0xdbb9('0xa')](),controller['describe']);router[_0xdbb9('0x9')](_0xdbb9('0xc'),auth[_0xdbb9('0xa')](),controller[_0xdbb9('0xd')]);router[_0xdbb9('0xe')]('/',auth[_0xdbb9('0xa')](),controller[_0xdbb9('0xf')]);router['put'](_0xdbb9('0xc'),auth[_0xdbb9('0xa')](),controller[_0xdbb9('0x10')]);router[_0xdbb9('0x11')](_0xdbb9('0xc'),auth[_0xdbb9('0xa')](),controller[_0xdbb9('0x12')]);module[_0xdbb9('0x13')]=router; \ No newline at end of file +var _0x2842=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x391ed5,_0x4dc7ff){var _0x43492a=function(_0x143b5b){while(--_0x143b5b){_0x391ed5['push'](_0x391ed5['shift']());}};_0x43492a(++_0x4dc7ff);}(_0x2842,0x11d));var _0x2284=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2842[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2284('0x0'));var util=require(_0x2284('0x1'));var path=require(_0x2284('0x2'));var timeout=require(_0x2284('0x3'));var express=require(_0x2284('0x4'));var router=express[_0x2284('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2284('0x6'));var config=require(_0x2284('0x7'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x2284('0x8')](),controller[_0x2284('0x9')]);router[_0x2284('0xa')](_0x2284('0xb'),auth['isAuthenticated'](),controller[_0x2284('0xc')]);router[_0x2284('0xa')](_0x2284('0xd'),auth['isAuthenticated'](),controller[_0x2284('0xe')]);router['post']('/',auth[_0x2284('0x8')](),controller[_0x2284('0xf')]);router[_0x2284('0x10')](_0x2284('0xd'),auth[_0x2284('0x8')](),controller[_0x2284('0x11')]);router[_0x2284('0x12')]('/:id',auth[_0x2284('0x8')](),controller[_0x2284('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6a60253..4b175a5 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 _0xfdc1=['DATE','moment','sequelize','exports','STRING'];(function(_0x17c3e6,_0x18eac5){var _0x3453c4=function(_0x3124bf){while(--_0x3124bf){_0x17c3e6['push'](_0x17c3e6['shift']());}};_0x3453c4(++_0x18eac5);}(_0xfdc1,0x182));var _0x1fdc=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xfdc1[_0x26b80e];return _0x84a8a8;};'use strict';var moment=require(_0x1fdc('0x0'));var Sequelize=require(_0x1fdc('0x1'));module[_0x1fdc('0x2')]={'uniqueid':{'type':Sequelize[_0x1fdc('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1fdc('0x4')]},'leaveAt':{'type':Sequelize[_0x1fdc('0x4')]},'acceptAt':{'type':Sequelize[_0x1fdc('0x4')]},'exitAt':{'type':Sequelize[_0x1fdc('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7119=['STRING','DATE','sequelize','exports'];(function(_0x549a22,_0x1d6b56){var _0x1e8b50=function(_0x37f5d3){while(--_0x37f5d3){_0x549a22['push'](_0x549a22['shift']());}};_0x1e8b50(++_0x1d6b56);}(_0x7119,0x8e));var _0x9711=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0x7119[_0x324d77];return _0x2a77a7;};'use strict';var moment=require('moment');var Sequelize=require(_0x9711('0x0'));module[_0x9711('0x1')]={'uniqueid':{'type':Sequelize[_0x9711('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9711('0x2')]},'joinAt':{'type':Sequelize[_0x9711('0x3')]},'leaveAt':{'type':Sequelize[_0x9711('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9711('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fa5d3a9..131959e 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 _0x04d0=['params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','reject','update','destroy','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','includeAll','create','body','find'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x04d0,0x10a));var _0x004d=function(_0xcb0943,_0x16de35){_0xcb0943=_0xcb0943-0x0;var _0xd48f32=_0x04d0[_0xcb0943];return _0xd48f32;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x004d('0x0'));var zipdir=require(_0x004d('0x1'));var jsonpatch=require(_0x004d('0x2'));var rp=require(_0x004d('0x3'));var moment=require(_0x004d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x004d('0x5'));var path=require('path');var sox=require(_0x004d('0x6'));var csv=require(_0x004d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x7'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x004d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d2651,_0x46c972){_0x46c972=_0x46c972||0xcc;return function(_0x3ec7fb){if(_0x3ec7fb){return _0x1d2651[_0x004d('0x13')](_0x46c972);}return _0x1d2651[_0x004d('0x14')](_0x46c972)[_0x004d('0x15')]();};}function respondWithResult(_0x1af576,_0x32e867){_0x32e867=_0x32e867||0xc8;return function(_0x4f4785){if(_0x4f4785){return _0x1af576[_0x004d('0x14')](_0x32e867)[_0x004d('0x16')](_0x4f4785);}};}function respondWithFilteredResult(_0x22d22d,_0x1822f5){return function(_0x43f5fb){if(_0x43f5fb){var _0x402969=_0x43f5fb[_0x004d('0x17')],_0x1904a6=_0x1822f5[_0x004d('0x18')],_0x365c20=_0x1822f5[_0x004d('0x18')]+_0x1822f5['limit'],_0x5b4f40;if(_0x365c20>=_0x402969){_0x365c20=_0x402969;_0x5b4f40=0xc8;}else{_0x5b4f40=0xce;}_0x22d22d[_0x004d('0x14')](_0x5b4f40);return _0x22d22d['set'](_0x004d('0x19'),_0x1904a6+'-'+_0x365c20+'/'+_0x402969)[_0x004d('0x16')](_0x43f5fb);}return null;};}function patchUpdates(_0x2d0b1c){return function(_0x66dd7f){try{jsonpatch['apply'](_0x66dd7f,_0x2d0b1c,!![]);}catch(_0x1c184c){return BPromise[_0x004d('0x1a')](_0x1c184c);}return _0x66dd7f['save']();};}function saveUpdates(_0x31ac5c,_0x158339){return function(_0x1b69e8){if(_0x1b69e8){return _0x1b69e8[_0x004d('0x1b')](_0x31ac5c)['then'](function(_0x9049a2){return _0x9049a2;});}return null;};}function removeEntity(_0x39a02e,_0x2da052){return function(_0xb9eda8){if(_0xb9eda8){return _0xb9eda8[_0x004d('0x1c')]()[_0x004d('0x1d')](function(){_0x39a02e[_0x004d('0x14')](0xcc)[_0x004d('0x15')]();});}};}function handleEntityNotFound(_0x31a6fb,_0x1cfdaa){return function(_0x421f33){if(!_0x421f33){_0x31a6fb[_0x004d('0x13')](0x194);}return _0x421f33;};}function handleError(_0x58a6de,_0x5bab9a){_0x5bab9a=_0x5bab9a||0x1f4;return function(_0x1263d8){logger[_0x004d('0x1e')](_0x1263d8['stack']);if(_0x1263d8[_0x004d('0x1f')]){delete _0x1263d8[_0x004d('0x1f')];}_0x58a6de[_0x004d('0x14')](_0x5bab9a)[_0x004d('0x20')](_0x1263d8);};}exports[_0x004d('0x21')]=function(_0x1ccb0e,_0x12430e){var _0x5a761d={},_0x2e6ab1={},_0x5c55a3={'count':0x0,'rows':[]};var _0x5b3c9a=_[_0x004d('0x22')](db[_0x004d('0x23')][_0x004d('0x24')],function(_0x1e13b1){return{'name':_0x1e13b1['fieldName'],'type':_0x1e13b1[_0x004d('0x25')][_0x004d('0x26')]};});_0x2e6ab1[_0x004d('0x27')]=_[_0x004d('0x22')](_0x5b3c9a,_0x004d('0x1f'));_0x2e6ab1[_0x004d('0x28')]=_['keys'](_0x1ccb0e[_0x004d('0x28')]);_0x2e6ab1[_0x004d('0x29')]=_[_0x004d('0x2a')](_0x2e6ab1[_0x004d('0x27')],_0x2e6ab1['query']);_0x5a761d['attributes']=_[_0x004d('0x2a')](_0x2e6ab1['model'],qs[_0x004d('0x2b')](_0x1ccb0e[_0x004d('0x28')][_0x004d('0x2b')]));_0x5a761d[_0x004d('0x2c')]=_0x5a761d[_0x004d('0x2c')][_0x004d('0x2d')]?_0x5a761d[_0x004d('0x2c')]:_0x2e6ab1[_0x004d('0x27')];if(!_0x1ccb0e[_0x004d('0x28')][_0x004d('0x2e')]('nolimit')){_0x5a761d[_0x004d('0x2f')]=qs[_0x004d('0x2f')](_0x1ccb0e[_0x004d('0x28')][_0x004d('0x2f')]);_0x5a761d['offset']=qs[_0x004d('0x18')](_0x1ccb0e[_0x004d('0x28')]['offset']);}_0x5a761d[_0x004d('0x30')]=qs[_0x004d('0x31')](_0x1ccb0e[_0x004d('0x28')][_0x004d('0x31')]);_0x5a761d[_0x004d('0x32')]=qs['filters'](_[_0x004d('0x33')](_0x1ccb0e[_0x004d('0x28')],_0x2e6ab1[_0x004d('0x29')]),_0x5b3c9a);if(_0x1ccb0e[_0x004d('0x28')][_0x004d('0x34')]){_0x5a761d[_0x004d('0x32')]=_[_0x004d('0x35')](_0x5a761d[_0x004d('0x32')],{'$or':_['map'](_0x5b3c9a,function(_0xd97acc){if(_0xd97acc['type']!==_0x004d('0x36')){var _0x458815={};_0x458815[_0xd97acc[_0x004d('0x1f')]]={'$like':'%'+_0x1ccb0e['query'][_0x004d('0x34')]+'%'};return _0x458815;}})});}_0x5a761d=_[_0x004d('0x35')]({},_0x5a761d,_0x1ccb0e[_0x004d('0x37')]);var _0x48be35={'where':_0x5a761d[_0x004d('0x32')]};return db['OpenchannelQueueReport'][_0x004d('0x17')](_0x48be35)[_0x004d('0x1d')](function(_0x3c5a4b){_0x5c55a3[_0x004d('0x17')]=_0x3c5a4b;if(_0x1ccb0e[_0x004d('0x28')]['includeAll']){_0x5a761d['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x004d('0x38')](_0x5a761d);})['then'](function(_0x5f23b4){_0x5c55a3[_0x004d('0x39')]=_0x5f23b4;return _0x5c55a3;})['then'](respondWithFilteredResult(_0x12430e,_0x5a761d))[_0x004d('0x3a')](handleError(_0x12430e,null));};exports['show']=function(_0x4ad12e,_0x283a58){var _0x45b6d6={'raw':!![],'where':{'id':_0x4ad12e['params']['id']}},_0x1f306e={};_0x1f306e['model']=_[_0x004d('0x3b')](db[_0x004d('0x23')][_0x004d('0x24')]);_0x1f306e[_0x004d('0x28')]=_[_0x004d('0x3b')](_0x4ad12e[_0x004d('0x28')]);_0x1f306e[_0x004d('0x29')]=_[_0x004d('0x2a')](_0x1f306e[_0x004d('0x27')],_0x1f306e[_0x004d('0x28')]);_0x45b6d6['attributes']=_[_0x004d('0x2a')](_0x1f306e[_0x004d('0x27')],qs[_0x004d('0x2b')](_0x4ad12e[_0x004d('0x28')][_0x004d('0x2b')]));_0x45b6d6[_0x004d('0x2c')]=_0x45b6d6['attributes'][_0x004d('0x2d')]?_0x45b6d6[_0x004d('0x2c')]:_0x1f306e[_0x004d('0x27')];if(_0x4ad12e[_0x004d('0x28')][_0x004d('0x3c')]){_0x45b6d6['include']=[{'all':!![]}];}_0x45b6d6=_[_0x004d('0x35')]({},_0x45b6d6,_0x4ad12e[_0x004d('0x37')]);return db[_0x004d('0x23')]['find'](_0x45b6d6)[_0x004d('0x1d')](handleEntityNotFound(_0x283a58,null))[_0x004d('0x1d')](respondWithResult(_0x283a58,null))[_0x004d('0x3a')](handleError(_0x283a58,null));};exports[_0x004d('0x3d')]=function(_0x5b61af,_0x495116){return db[_0x004d('0x23')][_0x004d('0x3d')](_0x5b61af[_0x004d('0x3e')],{})[_0x004d('0x1d')](respondWithResult(_0x495116,0xc9))['catch'](handleError(_0x495116,null));};exports[_0x004d('0x1b')]=function(_0x432af3,_0x22fa50){if(_0x432af3[_0x004d('0x3e')]['id']){delete _0x432af3['body']['id'];}return db['OpenchannelQueueReport'][_0x004d('0x3f')]({'where':{'id':_0x432af3[_0x004d('0x40')]['id']}})['then'](handleEntityNotFound(_0x22fa50,null))['then'](saveUpdates(_0x432af3[_0x004d('0x3e')],null))[_0x004d('0x1d')](respondWithResult(_0x22fa50,null))['catch'](handleError(_0x22fa50,null));};exports['destroy']=function(_0x522217,_0x2ab3db){return db['OpenchannelQueueReport'][_0x004d('0x3f')]({'where':{'id':_0x522217[_0x004d('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ab3db,null))[_0x004d('0x1d')](removeEntity(_0x2ab3db,null))['catch'](handleError(_0x2ab3db,null));};exports[_0x004d('0x41')]=function(_0x57288b,_0x1b2360){return db[_0x004d('0x23')][_0x004d('0x41')]()['then'](respondWithResult(_0x1b2360,null))['catch'](handleError(_0x1b2360,null));}; \ No newline at end of file +var _0xae79=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','limit','apply','save','then','error','name','map','OpenchannelQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','update','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xae79,0x1d3));var _0x9ae7=function(_0x58c284,_0x5c1f4c){_0x58c284=_0x58c284-0x0;var _0x272ca5=_0xae79[_0x58c284];return _0x272ca5;};'use strict';var pdf=require(_0x9ae7('0x0'));var emlformat=require(_0x9ae7('0x1'));var rimraf=require(_0x9ae7('0x2'));var zipdir=require(_0x9ae7('0x3'));var jsonpatch=require(_0x9ae7('0x4'));var rp=require(_0x9ae7('0x5'));var moment=require(_0x9ae7('0x6'));var BPromise=require(_0x9ae7('0x7'));var Mustache=require(_0x9ae7('0x8'));var util=require(_0x9ae7('0x9'));var path=require(_0x9ae7('0xa'));var sox=require(_0x9ae7('0xb'));var csv=require(_0x9ae7('0xc'));var ejs=require(_0x9ae7('0xd'));var fs=require('fs');var _=require(_0x9ae7('0xe'));var squel=require('squel');var crypto=require(_0x9ae7('0xf'));var jsforce=require(_0x9ae7('0x10'));var deskjs=require(_0x9ae7('0x11'));var toCsv=require(_0x9ae7('0xc'));var querystring=require(_0x9ae7('0x12'));var Papa=require(_0x9ae7('0x13'));var Redis=require('ioredis');var authService=require(_0x9ae7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9ae7('0x15'));var hardwareService=require(_0x9ae7('0x16'));var logger=require(_0x9ae7('0x17'))(_0x9ae7('0x18'));var utils=require(_0x9ae7('0x19'));var config=require(_0x9ae7('0x1a'));var licenseUtil=require(_0x9ae7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf0ddd1,_0x41a773){_0x41a773=_0x41a773||0xcc;return function(_0x4fec37){if(_0x4fec37){return _0xf0ddd1[_0x9ae7('0x1c')](_0x41a773);}return _0xf0ddd1[_0x9ae7('0x1d')](_0x41a773)[_0x9ae7('0x1e')]();};}function respondWithResult(_0x18ff9d,_0x1bc8a1){_0x1bc8a1=_0x1bc8a1||0xc8;return function(_0x39ac53){if(_0x39ac53){return _0x18ff9d[_0x9ae7('0x1d')](_0x1bc8a1)['json'](_0x39ac53);}};}function respondWithFilteredResult(_0x1b9b21,_0x3f8a2d){return function(_0x1f8008){if(_0x1f8008){var _0x44c0bc=_0x1f8008[_0x9ae7('0x1f')],_0x533481=_0x3f8a2d['offset'],_0x109526=_0x3f8a2d['offset']+_0x3f8a2d[_0x9ae7('0x20')],_0xe1a2d1;if(_0x109526>=_0x44c0bc){_0x109526=_0x44c0bc;_0xe1a2d1=0xc8;}else{_0xe1a2d1=0xce;}_0x1b9b21['status'](_0xe1a2d1);return _0x1b9b21['set']('Content-Range',_0x533481+'-'+_0x109526+'/'+_0x44c0bc)['json'](_0x1f8008);}return null;};}function patchUpdates(_0x120a5c){return function(_0x1366cd){try{jsonpatch[_0x9ae7('0x21')](_0x1366cd,_0x120a5c,!![]);}catch(_0x22ea73){return BPromise['reject'](_0x22ea73);}return _0x1366cd[_0x9ae7('0x22')]();};}function saveUpdates(_0x1d94fb,_0x481e47){return function(_0x20fd14){if(_0x20fd14){return _0x20fd14['update'](_0x1d94fb)[_0x9ae7('0x23')](function(_0x272936){return _0x272936;});}return null;};}function removeEntity(_0x583937,_0x356559){return function(_0x550e52){if(_0x550e52){return _0x550e52['destroy']()[_0x9ae7('0x23')](function(){_0x583937[_0x9ae7('0x1d')](0xcc)[_0x9ae7('0x1e')]();});}};}function handleEntityNotFound(_0x1159a0,_0x5aad24){return function(_0xa32e45){if(!_0xa32e45){_0x1159a0[_0x9ae7('0x1c')](0x194);}return _0xa32e45;};}function handleError(_0x30ddfd,_0x3d276d){_0x3d276d=_0x3d276d||0x1f4;return function(_0x5da136){logger[_0x9ae7('0x24')](_0x5da136['stack']);if(_0x5da136[_0x9ae7('0x25')]){delete _0x5da136[_0x9ae7('0x25')];}_0x30ddfd['status'](_0x3d276d)['send'](_0x5da136);};}exports['index']=function(_0x49123b,_0x43f2c9){var _0x26680c={},_0x58f130={},_0x23cca8={'count':0x0,'rows':[]};var _0xf3bdcb=_[_0x9ae7('0x26')](db[_0x9ae7('0x27')][_0x9ae7('0x28')],function(_0x51527d){return{'name':_0x51527d['fieldName'],'type':_0x51527d[_0x9ae7('0x29')]['key']};});_0x58f130[_0x9ae7('0x2a')]=_[_0x9ae7('0x26')](_0xf3bdcb,'name');_0x58f130[_0x9ae7('0x2b')]=_[_0x9ae7('0x2c')](_0x49123b[_0x9ae7('0x2b')]);_0x58f130['filters']=_[_0x9ae7('0x2d')](_0x58f130[_0x9ae7('0x2a')],_0x58f130[_0x9ae7('0x2b')]);_0x26680c[_0x9ae7('0x2e')]=_['intersection'](_0x58f130['model'],qs[_0x9ae7('0x2f')](_0x49123b[_0x9ae7('0x2b')][_0x9ae7('0x2f')]));_0x26680c[_0x9ae7('0x2e')]=_0x26680c[_0x9ae7('0x2e')][_0x9ae7('0x30')]?_0x26680c[_0x9ae7('0x2e')]:_0x58f130[_0x9ae7('0x2a')];if(!_0x49123b[_0x9ae7('0x2b')]['hasOwnProperty'](_0x9ae7('0x31'))){_0x26680c[_0x9ae7('0x20')]=qs['limit'](_0x49123b[_0x9ae7('0x2b')][_0x9ae7('0x20')]);_0x26680c['offset']=qs['offset'](_0x49123b['query'][_0x9ae7('0x32')]);}_0x26680c['order']=qs[_0x9ae7('0x33')](_0x49123b[_0x9ae7('0x2b')][_0x9ae7('0x33')]);_0x26680c[_0x9ae7('0x34')]=qs[_0x9ae7('0x35')](_[_0x9ae7('0x36')](_0x49123b[_0x9ae7('0x2b')],_0x58f130[_0x9ae7('0x35')]),_0xf3bdcb);if(_0x49123b[_0x9ae7('0x2b')]['filter']){_0x26680c[_0x9ae7('0x34')]=_[_0x9ae7('0x37')](_0x26680c['where'],{'$or':_[_0x9ae7('0x26')](_0xf3bdcb,function(_0x4a5239){if(_0x4a5239[_0x9ae7('0x29')]!==_0x9ae7('0x38')){var _0x42faec={};_0x42faec[_0x4a5239[_0x9ae7('0x25')]]={'$like':'%'+_0x49123b[_0x9ae7('0x2b')]['filter']+'%'};return _0x42faec;}})});}_0x26680c=_[_0x9ae7('0x37')]({},_0x26680c,_0x49123b[_0x9ae7('0x39')]);var _0x24ee9f={'where':_0x26680c[_0x9ae7('0x34')]};return db['OpenchannelQueueReport'][_0x9ae7('0x1f')](_0x24ee9f)[_0x9ae7('0x23')](function(_0x1b1fc9){_0x23cca8['count']=_0x1b1fc9;if(_0x49123b[_0x9ae7('0x2b')]['includeAll']){_0x26680c[_0x9ae7('0x3a')]=[{'all':!![]}];}return db[_0x9ae7('0x27')][_0x9ae7('0x3b')](_0x26680c);})[_0x9ae7('0x23')](function(_0x1d4dd8){_0x23cca8[_0x9ae7('0x3c')]=_0x1d4dd8;return _0x23cca8;})[_0x9ae7('0x23')](respondWithFilteredResult(_0x43f2c9,_0x26680c))[_0x9ae7('0x3d')](handleError(_0x43f2c9,null));};exports['show']=function(_0x5f0b6c,_0x220056){var _0x4453be={'raw':!![],'where':{'id':_0x5f0b6c[_0x9ae7('0x3e')]['id']}},_0x221a08={};_0x221a08['model']=_[_0x9ae7('0x2c')](db['OpenchannelQueueReport'][_0x9ae7('0x28')]);_0x221a08[_0x9ae7('0x2b')]=_[_0x9ae7('0x2c')](_0x5f0b6c[_0x9ae7('0x2b')]);_0x221a08[_0x9ae7('0x35')]=_[_0x9ae7('0x2d')](_0x221a08[_0x9ae7('0x2a')],_0x221a08[_0x9ae7('0x2b')]);_0x4453be[_0x9ae7('0x2e')]=_['intersection'](_0x221a08[_0x9ae7('0x2a')],qs[_0x9ae7('0x2f')](_0x5f0b6c['query'][_0x9ae7('0x2f')]));_0x4453be['attributes']=_0x4453be[_0x9ae7('0x2e')]['length']?_0x4453be[_0x9ae7('0x2e')]:_0x221a08[_0x9ae7('0x2a')];if(_0x5f0b6c[_0x9ae7('0x2b')][_0x9ae7('0x3f')]){_0x4453be[_0x9ae7('0x3a')]=[{'all':!![]}];}_0x4453be=_[_0x9ae7('0x37')]({},_0x4453be,_0x5f0b6c['options']);return db[_0x9ae7('0x27')]['find'](_0x4453be)[_0x9ae7('0x23')](handleEntityNotFound(_0x220056,null))[_0x9ae7('0x23')](respondWithResult(_0x220056,null))[_0x9ae7('0x3d')](handleError(_0x220056,null));};exports[_0x9ae7('0x40')]=function(_0x3d88c3,_0x3a196f){return db['OpenchannelQueueReport'][_0x9ae7('0x40')](_0x3d88c3[_0x9ae7('0x41')],{})[_0x9ae7('0x23')](respondWithResult(_0x3a196f,0xc9))[_0x9ae7('0x3d')](handleError(_0x3a196f,null));};exports[_0x9ae7('0x42')]=function(_0x51e15d,_0x32a6c8){if(_0x51e15d['body']['id']){delete _0x51e15d[_0x9ae7('0x41')]['id'];}return db[_0x9ae7('0x27')]['find']({'where':{'id':_0x51e15d['params']['id']}})['then'](handleEntityNotFound(_0x32a6c8,null))[_0x9ae7('0x23')](saveUpdates(_0x51e15d[_0x9ae7('0x41')],null))[_0x9ae7('0x23')](respondWithResult(_0x32a6c8,null))[_0x9ae7('0x3d')](handleError(_0x32a6c8,null));};exports[_0x9ae7('0x43')]=function(_0x4ac375,_0xd89ebf){return db[_0x9ae7('0x27')][_0x9ae7('0x44')]({'where':{'id':_0x4ac375[_0x9ae7('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd89ebf,null))['then'](removeEntity(_0xd89ebf,null))[_0x9ae7('0x3d')](handleError(_0xd89ebf,null));};exports[_0x9ae7('0x45')]=function(_0x32df79,_0x176c39){return db[_0x9ae7('0x27')][_0x9ae7('0x45')]()[_0x9ae7('0x23')](respondWithResult(_0x176c39,null))['catch'](handleError(_0x176c39,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 281f974..3a33d23 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 _0xca74=['exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xca74,0x170));var _0x4ca7=function(_0xcf95b4,_0x24baf1){_0xcf95b4=_0xcf95b4-0x0;var _0x20d28b=_0xca74[_0xcf95b4];return _0x20d28b;};'use strict';var _=require(_0x4ca7('0x0'));var util=require('util');var logger=require(_0x4ca7('0x1'))(_0x4ca7('0x2'));var moment=require(_0x4ca7('0x3'));var BPromise=require(_0x4ca7('0x4'));var rp=require(_0x4ca7('0x5'));var fs=require('fs');var path=require(_0x4ca7('0x6'));var rimraf=require(_0x4ca7('0x7'));var config=require(_0x4ca7('0x8'));var attributes=require(_0x4ca7('0x9'));module[_0x4ca7('0xa')]=function(_0x2e950a,_0xab134){return _0x2e950a[_0x4ca7('0xb')](_0x4ca7('0xc'),attributes,{'tableName':_0x4ca7('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcef4=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','report_openchannel_queue','uniqueid','lodash'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0xcef4,0x1e9));var _0x4cef=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xcef4[_0x5a6961];return _0x4af0a6;};'use strict';var _=require(_0x4cef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4cef('0x1'));var rp=require(_0x4cef('0x2'));var fs=require('fs');var path=require(_0x4cef('0x3'));var rimraf=require(_0x4cef('0x4'));var config=require(_0x4cef('0x5'));var attributes=require(_0x4cef('0x6'));module[_0x4cef('0x7')]=function(_0x227982,_0x15e95b){return _0x227982['define']('OpenchannelQueueReport',attributes,{'tableName':_0x4cef('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4cef('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index dc2557a..d6c4863 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 _0x96c5=['create','body','options','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1dbea0,_0x264133){var _0x46fd77=function(_0x33ec26){while(--_0x33ec26){_0x1dbea0['push'](_0x1dbea0['shift']());}};_0x46fd77(++_0x264133);}(_0x96c5,0x137));var _0x596c=function(_0x52c932,_0x4fcaed){_0x52c932=_0x52c932-0x0;var _0x403e9a=_0x96c5[_0x52c932];return _0x403e9a;};'use strict';var _=require(_0x596c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x596c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x596c('0x2'));var db=require(_0x596c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x596c('0x4'))(_0x596c('0x5'));var config=require('../../config/environment');var jayson=require(_0x596c('0x6'));var client=jayson['client'][_0x596c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11cea4,_0xe54365,_0x1d2e63){return new BPromise(function(_0x162a6d,_0x5cf78c){return client[_0x596c('0x8')](_0x11cea4,_0x1d2e63)[_0x596c('0x9')](function(_0x1d6e5a){logger['info'](_0x596c('0xa'),_0xe54365,_0x596c('0xb'));logger[_0x596c('0xc')](_0x596c('0xd'),_0xe54365,_0x596c('0xb'),JSON[_0x596c('0xe')](_0x1d6e5a));if(_0x1d6e5a[_0x596c('0xf')]){if(_0x1d6e5a[_0x596c('0xf')][_0x596c('0x10')]===0x1f4){logger['error'](_0x596c('0xa'),_0xe54365,_0x1d6e5a[_0x596c('0xf')]['message']);return _0x5cf78c(_0x1d6e5a[_0x596c('0xf')][_0x596c('0x11')]);}logger[_0x596c('0xf')](_0x596c('0xa'),_0xe54365,_0x1d6e5a[_0x596c('0xf')][_0x596c('0x11')]);return _0x162a6d(_0x1d6e5a[_0x596c('0xf')][_0x596c('0x11')]);}else{logger[_0x596c('0x12')](_0x596c('0xa'),_0xe54365,_0x596c('0xb'));_0x162a6d(_0x1d6e5a['result'][_0x596c('0x11')]);}})['catch'](function(_0x573545){logger[_0x596c('0xf')](_0x596c('0xa'),_0xe54365,_0x573545);_0x5cf78c(_0x573545);});});}exports['CreateOpenchannelQueueReport']=function(_0x42d35b){var _0x33dea9=this;return new Promise(function(_0x418d79,_0xffabc7){return db['OpenchannelQueueReport'][_0x596c('0x13')](_0x42d35b[_0x596c('0x14')],{'raw':_0x42d35b['options']?_0x42d35b[_0x596c('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x596c('0x9')](function(_0x3f6b75){logger[_0x596c('0x12')](_0x596c('0x16'),_0x42d35b);logger[_0x596c('0xc')](_0x596c('0x16'),_0x42d35b,JSON[_0x596c('0xe')](_0x3f6b75));_0x418d79(_0x3f6b75);})[_0x596c('0x17')](function(_0x2f1572){logger[_0x596c('0xf')](_0x596c('0x16'),_0x2f1572[_0x596c('0x11')],_0x42d35b);_0xffabc7(_0x33dea9['error'](0x1f4,_0x2f1572[_0x596c('0x11')]));});});};exports[_0x596c('0x18')]=function(_0x2c193a){var _0x15dace=this;return new Promise(function(_0x3be935,_0x5baf09){return db[_0x596c('0x19')][_0x596c('0x1a')](_0x2c193a[_0x596c('0x14')],{'raw':_0x2c193a[_0x596c('0x15')]?_0x2c193a[_0x596c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c193a['options']?_0x2c193a[_0x596c('0x15')][_0x596c('0x1b')]||null:null,'attributes':_0x2c193a[_0x596c('0x15')]?_0x2c193a[_0x596c('0x15')][_0x596c('0x1c')]||null:null,'limit':_0x2c193a[_0x596c('0x15')]?_0x2c193a['options'][_0x596c('0x1d')]||null:null})[_0x596c('0x9')](function(_0x1a99f2){logger[_0x596c('0x12')]('UpdateOpenchannelQueueReport',_0x2c193a);logger[_0x596c('0xc')]('UpdateOpenchannelQueueReport',_0x2c193a,JSON['stringify'](_0x1a99f2));_0x3be935(_0x1a99f2);})[_0x596c('0x17')](function(_0x144727){logger['error']('UpdateOpenchannelQueueReport',_0x144727[_0x596c('0x11')],_0x2c193a);_0x5baf09(_0x15dace[_0x596c('0xf')](0x1f4,_0x144727[_0x596c('0x11')]));});});}; \ No newline at end of file +var _0x1d02=['../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','UpdateOpenchannelQueueReport','update','raw','where','limit','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4690a8,_0x250671){var _0x52e447=function(_0x5d74f6){while(--_0x5d74f6){_0x4690a8['push'](_0x4690a8['shift']());}};_0x52e447(++_0x250671);}(_0x1d02,0xb8));var _0x21d0=function(_0x2eb019,_0x588702){_0x2eb019=_0x2eb019-0x0;var _0x6e7bf7=_0x1d02[_0x2eb019];return _0x6e7bf7;};'use strict';var _=require(_0x21d0('0x0'));var util=require('util');var moment=require(_0x21d0('0x1'));var BPromise=require('bluebird');var rs=require(_0x21d0('0x2'));var fs=require('fs');var Redis=require(_0x21d0('0x3'));var db=require(_0x21d0('0x4'))['db'];var utils=require(_0x21d0('0x5'));var logger=require(_0x21d0('0x6'))(_0x21d0('0x7'));var config=require(_0x21d0('0x8'));var jayson=require(_0x21d0('0x9'));var client=jayson['client'][_0x21d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5558e8,_0x30292d,_0x381384){return new BPromise(function(_0x337301,_0x290ce6){return client[_0x21d0('0xb')](_0x5558e8,_0x381384)[_0x21d0('0xc')](function(_0x28e141){logger[_0x21d0('0xd')](_0x21d0('0xe'),_0x30292d,'request\x20sent');logger[_0x21d0('0xf')](_0x21d0('0x10'),_0x30292d,_0x21d0('0x11'),JSON['stringify'](_0x28e141));if(_0x28e141[_0x21d0('0x12')]){if(_0x28e141[_0x21d0('0x12')][_0x21d0('0x13')]===0x1f4){logger[_0x21d0('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30292d,_0x28e141[_0x21d0('0x12')][_0x21d0('0x14')]);return _0x290ce6(_0x28e141[_0x21d0('0x12')][_0x21d0('0x14')]);}logger['error'](_0x21d0('0xe'),_0x30292d,_0x28e141[_0x21d0('0x12')][_0x21d0('0x14')]);return _0x337301(_0x28e141[_0x21d0('0x12')][_0x21d0('0x14')]);}else{logger[_0x21d0('0xd')](_0x21d0('0xe'),_0x30292d,_0x21d0('0x11'));_0x337301(_0x28e141['result'][_0x21d0('0x14')]);}})[_0x21d0('0x15')](function(_0x4e4b4c){logger[_0x21d0('0x12')](_0x21d0('0xe'),_0x30292d,_0x4e4b4c);_0x290ce6(_0x4e4b4c);});});}exports[_0x21d0('0x16')]=function(_0x35c478){var _0x313538=this;return new Promise(function(_0x33474c,_0xc0008f){return db[_0x21d0('0x17')]['create'](_0x35c478[_0x21d0('0x18')],{'raw':_0x35c478[_0x21d0('0x19')]?_0x35c478[_0x21d0('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38709e){logger['info'](_0x21d0('0x16'),_0x35c478);logger[_0x21d0('0xf')](_0x21d0('0x16'),_0x35c478,JSON['stringify'](_0x38709e));_0x33474c(_0x38709e);})[_0x21d0('0x15')](function(_0x1213b0){logger[_0x21d0('0x12')]('CreateOpenchannelQueueReport',_0x1213b0[_0x21d0('0x14')],_0x35c478);_0xc0008f(_0x313538['error'](0x1f4,_0x1213b0[_0x21d0('0x14')]));});});};exports[_0x21d0('0x1a')]=function(_0x4b1fe2){var _0x25d81c=this;return new Promise(function(_0x2ce9f8,_0x450a93){return db['OpenchannelQueueReport'][_0x21d0('0x1b')](_0x4b1fe2['body'],{'raw':_0x4b1fe2[_0x21d0('0x19')]?_0x4b1fe2['options'][_0x21d0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1fe2[_0x21d0('0x19')]?_0x4b1fe2[_0x21d0('0x19')][_0x21d0('0x1d')]||null:null,'attributes':_0x4b1fe2[_0x21d0('0x19')]?_0x4b1fe2[_0x21d0('0x19')]['attributes']||null:null,'limit':_0x4b1fe2[_0x21d0('0x19')]?_0x4b1fe2['options'][_0x21d0('0x1e')]||null:null})['then'](function(_0x1aa2ee){logger[_0x21d0('0xd')](_0x21d0('0x1a'),_0x4b1fe2);logger[_0x21d0('0xf')]('UpdateOpenchannelQueueReport',_0x4b1fe2,JSON[_0x21d0('0x1f')](_0x1aa2ee));_0x2ce9f8(_0x1aa2ee);})[_0x21d0('0x15')](function(_0x1986ef){logger[_0x21d0('0x12')](_0x21d0('0x1a'),_0x1986ef[_0x21d0('0x14')],_0x4b1fe2);_0x450a93(_0x25d81c[_0x21d0('0x12')](0x1f4,_0x1986ef[_0x21d0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c2a1f60..c5010d1 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(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['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 5585c45..88b66b0 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 _0xc2db=['moment','exports','STRING','ENUM','queue','DATE','NOW'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xc2db,0x111));var _0xbc2d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc2db[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0xbc2d('0x0'));var Sequelize=require('sequelize');module[_0xbc2d('0x1')]={'uniqueid':{'type':Sequelize[_0xbc2d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbc2d('0x3')]('account','agent',_0xbc2d('0x4')),'allowNull':![],'defaultValue':_0xbc2d('0x4')},'transferredAt':{'type':Sequelize[_0xbc2d('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xbc2d('0x6')]}}; \ No newline at end of file +var _0xb8a8=['ENUM','account','queue','moment','sequelize','exports','STRING'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xb8a8,0xb9));var _0x8b8a=function(_0x16d818,_0x264158){_0x16d818=_0x16d818-0x0;var _0x140e0b=_0xb8a8[_0x16d818];return _0x140e0b;};'use strict';var moment=require(_0x8b8a('0x0'));var Sequelize=require(_0x8b8a('0x1'));module[_0x8b8a('0x2')]={'uniqueid':{'type':Sequelize[_0x8b8a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8b8a('0x4')](_0x8b8a('0x5'),'agent',_0x8b8a('0x6')),'allowNull':![],'defaultValue':_0x8b8a('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8040ec0..0f20024 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 _0x3eac=['OpenchannelTransferReport','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0x3eac,0x145));var _0xc3ea=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x3eac[_0x60286b];return _0x5dff69;};'use strict';var pdf=require(_0xc3ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3ea('0x1'));var zipdir=require(_0xc3ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3ea('0x3'));var moment=require('moment');var BPromise=require(_0xc3ea('0x4'));var Mustache=require(_0xc3ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc3ea('0x6'));var csv=require(_0xc3ea('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc3ea('0x8'));var squel=require(_0xc3ea('0x9'));var crypto=require(_0xc3ea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc3ea('0xb'));var toCsv=require(_0xc3ea('0x7'));var querystring=require(_0xc3ea('0xc'));var Papa=require(_0xc3ea('0xd'));var Redis=require(_0xc3ea('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc3ea('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3ea('0x10'))(_0xc3ea('0x11'));var utils=require('../../config/utils');var config=require(_0xc3ea('0x12'));var licenseUtil=require(_0xc3ea('0x13'));var db=require(_0xc3ea('0x14'))['db'];function respondWithStatusCode(_0x4662fe,_0x4e2abc){_0x4e2abc=_0x4e2abc||0xcc;return function(_0x26c037){if(_0x26c037){return _0x4662fe['sendStatus'](_0x4e2abc);}return _0x4662fe[_0xc3ea('0x15')](_0x4e2abc)[_0xc3ea('0x16')]();};}function respondWithResult(_0x2af5b6,_0x59d2c2){_0x59d2c2=_0x59d2c2||0xc8;return function(_0x2e27b4){if(_0x2e27b4){return _0x2af5b6[_0xc3ea('0x15')](_0x59d2c2)[_0xc3ea('0x17')](_0x2e27b4);}};}function respondWithFilteredResult(_0x9cc19d,_0x2f85fe){return function(_0x553dde){if(_0x553dde){var _0x37e686=_0x553dde['count'],_0x38215f=_0x2f85fe[_0xc3ea('0x18')],_0x3c51d3=_0x2f85fe[_0xc3ea('0x18')]+_0x2f85fe['limit'],_0x197851;if(_0x3c51d3>=_0x37e686){_0x3c51d3=_0x37e686;_0x197851=0xc8;}else{_0x197851=0xce;}_0x9cc19d[_0xc3ea('0x15')](_0x197851);return _0x9cc19d[_0xc3ea('0x19')](_0xc3ea('0x1a'),_0x38215f+'-'+_0x3c51d3+'/'+_0x37e686)['json'](_0x553dde);}return null;};}function patchUpdates(_0x5cccbf){return function(_0x1cfa3c){try{jsonpatch[_0xc3ea('0x1b')](_0x1cfa3c,_0x5cccbf,!![]);}catch(_0x46063f){return BPromise[_0xc3ea('0x1c')](_0x46063f);}return _0x1cfa3c[_0xc3ea('0x1d')]();};}function saveUpdates(_0x6fe578,_0x25db5b){return function(_0x17187d){if(_0x17187d){return _0x17187d[_0xc3ea('0x1e')](_0x6fe578)[_0xc3ea('0x1f')](function(_0x1a67e6){return _0x1a67e6;});}return null;};}function removeEntity(_0x52da7f,_0xe9fead){return function(_0x2ee99d){if(_0x2ee99d){return _0x2ee99d[_0xc3ea('0x20')]()[_0xc3ea('0x1f')](function(){_0x52da7f[_0xc3ea('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x286e46,_0x39c30b){return function(_0x41d726){if(!_0x41d726){_0x286e46[_0xc3ea('0x21')](0x194);}return _0x41d726;};}function handleError(_0x31ef9c,_0x18fdf4){_0x18fdf4=_0x18fdf4||0x1f4;return function(_0x5644a4){logger[_0xc3ea('0x22')](_0x5644a4[_0xc3ea('0x23')]);if(_0x5644a4[_0xc3ea('0x24')]){delete _0x5644a4['name'];}_0x31ef9c[_0xc3ea('0x15')](_0x18fdf4)[_0xc3ea('0x25')](_0x5644a4);};}exports[_0xc3ea('0x26')]=function(_0x38abf6,_0x3f6a1){var _0x37e04d={},_0x4f6694={},_0x2eb678={'count':0x0,'rows':[]};var _0x189818=_[_0xc3ea('0x27')](db[_0xc3ea('0x28')]['rawAttributes'],function(_0x5d6e16){return{'name':_0x5d6e16[_0xc3ea('0x29')],'type':_0x5d6e16[_0xc3ea('0x2a')][_0xc3ea('0x2b')]};});_0x4f6694[_0xc3ea('0x2c')]=_['map'](_0x189818,'name');_0x4f6694[_0xc3ea('0x2d')]=_['keys'](_0x38abf6[_0xc3ea('0x2d')]);_0x4f6694['filters']=_[_0xc3ea('0x2e')](_0x4f6694[_0xc3ea('0x2c')],_0x4f6694['query']);_0x37e04d[_0xc3ea('0x2f')]=_['intersection'](_0x4f6694['model'],qs[_0xc3ea('0x30')](_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x30')]));_0x37e04d['attributes']=_0x37e04d[_0xc3ea('0x2f')][_0xc3ea('0x31')]?_0x37e04d[_0xc3ea('0x2f')]:_0x4f6694[_0xc3ea('0x2c')];if(!_0x38abf6[_0xc3ea('0x2d')]['hasOwnProperty'](_0xc3ea('0x32'))){_0x37e04d[_0xc3ea('0x33')]=qs[_0xc3ea('0x33')](_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x33')]);_0x37e04d[_0xc3ea('0x18')]=qs['offset'](_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x18')]);}_0x37e04d[_0xc3ea('0x34')]=qs[_0xc3ea('0x35')](_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x35')]);_0x37e04d[_0xc3ea('0x36')]=qs[_0xc3ea('0x37')](_['pick'](_0x38abf6['query'],_0x4f6694[_0xc3ea('0x37')]),_0x189818);if(_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x38')]){_0x37e04d[_0xc3ea('0x36')]=_[_0xc3ea('0x39')](_0x37e04d[_0xc3ea('0x36')],{'$or':_[_0xc3ea('0x27')](_0x189818,function(_0x33b110){if(_0x33b110[_0xc3ea('0x2a')]!=='VIRTUAL'){var _0x25e4e7={};_0x25e4e7[_0x33b110['name']]={'$like':'%'+_0x38abf6[_0xc3ea('0x2d')][_0xc3ea('0x38')]+'%'};return _0x25e4e7;}})});}_0x37e04d=_[_0xc3ea('0x39')]({},_0x37e04d,_0x38abf6[_0xc3ea('0x3a')]);var _0x138b67={'where':_0x37e04d['where']};return db[_0xc3ea('0x28')][_0xc3ea('0x3b')](_0x138b67)[_0xc3ea('0x1f')](function(_0x2d9280){_0x2eb678[_0xc3ea('0x3b')]=_0x2d9280;if(_0x38abf6['query'][_0xc3ea('0x3c')]){_0x37e04d[_0xc3ea('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc3ea('0x3e')](_0x37e04d);})['then'](function(_0x1253af){_0x2eb678[_0xc3ea('0x3f')]=_0x1253af;return _0x2eb678;})['then'](respondWithFilteredResult(_0x3f6a1,_0x37e04d))[_0xc3ea('0x40')](handleError(_0x3f6a1,null));};exports[_0xc3ea('0x41')]=function(_0x21a790,_0x9a46f7){var _0x3bb7a6={'raw':!![],'where':{'id':_0x21a790[_0xc3ea('0x42')]['id']}},_0x2f75d5={};_0x2f75d5[_0xc3ea('0x2c')]=_[_0xc3ea('0x43')](db[_0xc3ea('0x28')][_0xc3ea('0x44')]);_0x2f75d5[_0xc3ea('0x2d')]=_[_0xc3ea('0x43')](_0x21a790['query']);_0x2f75d5['filters']=_[_0xc3ea('0x2e')](_0x2f75d5[_0xc3ea('0x2c')],_0x2f75d5[_0xc3ea('0x2d')]);_0x3bb7a6[_0xc3ea('0x2f')]=_[_0xc3ea('0x2e')](_0x2f75d5['model'],qs[_0xc3ea('0x30')](_0x21a790[_0xc3ea('0x2d')][_0xc3ea('0x30')]));_0x3bb7a6[_0xc3ea('0x2f')]=_0x3bb7a6[_0xc3ea('0x2f')]['length']?_0x3bb7a6['attributes']:_0x2f75d5['model'];if(_0x21a790[_0xc3ea('0x2d')]['includeAll']){_0x3bb7a6[_0xc3ea('0x3d')]=[{'all':!![]}];}_0x3bb7a6=_['merge']({},_0x3bb7a6,_0x21a790[_0xc3ea('0x3a')]);return db[_0xc3ea('0x28')][_0xc3ea('0x45')](_0x3bb7a6)[_0xc3ea('0x1f')](handleEntityNotFound(_0x9a46f7,null))[_0xc3ea('0x1f')](respondWithResult(_0x9a46f7,null))[_0xc3ea('0x40')](handleError(_0x9a46f7,null));};exports[_0xc3ea('0x46')]=function(_0x74508f,_0x14a1fe){return db['OpenchannelTransferReport'][_0xc3ea('0x46')](_0x74508f[_0xc3ea('0x47')],{})[_0xc3ea('0x1f')](respondWithResult(_0x14a1fe,0xc9))['catch'](handleError(_0x14a1fe,null));};exports[_0xc3ea('0x1e')]=function(_0x53bb22,_0x3753a5){if(_0x53bb22[_0xc3ea('0x47')]['id']){delete _0x53bb22[_0xc3ea('0x47')]['id'];}return db[_0xc3ea('0x28')][_0xc3ea('0x45')]({'where':{'id':_0x53bb22['params']['id']}})[_0xc3ea('0x1f')](handleEntityNotFound(_0x3753a5,null))['then'](saveUpdates(_0x53bb22[_0xc3ea('0x47')],null))[_0xc3ea('0x1f')](respondWithResult(_0x3753a5,null))[_0xc3ea('0x40')](handleError(_0x3753a5,null));};exports[_0xc3ea('0x20')]=function(_0x2c7c40,_0x26acb6){return db[_0xc3ea('0x28')][_0xc3ea('0x45')]({'where':{'id':_0x2c7c40[_0xc3ea('0x42')]['id']}})[_0xc3ea('0x1f')](handleEntityNotFound(_0x26acb6,null))[_0xc3ea('0x1f')](removeEntity(_0x26acb6,null))[_0xc3ea('0x40')](handleError(_0x26acb6,null));};exports[_0xc3ea('0x48')]=function(_0xfe8d9c,_0x197689){return db[_0xc3ea('0x28')][_0xc3ea('0x48')]()[_0xc3ea('0x1f')](respondWithResult(_0x197689,null))[_0xc3ea('0x40')](handleError(_0x197689,null));}; \ No newline at end of file +var _0x6019=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','stack','name','OpenchannelTransferReport','key','model','map','keys','intersection','query','fields','attributes','length','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','catch','show','params','merge','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x6019,0x1ee));var _0x9601=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6019[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x9601('0x0'));var emlformat=require(_0x9601('0x1'));var rimraf=require(_0x9601('0x2'));var zipdir=require(_0x9601('0x3'));var jsonpatch=require(_0x9601('0x4'));var rp=require(_0x9601('0x5'));var moment=require(_0x9601('0x6'));var BPromise=require(_0x9601('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9601('0x8'));var sox=require(_0x9601('0x9'));var csv=require(_0x9601('0xa'));var ejs=require(_0x9601('0xb'));var fs=require('fs');var _=require(_0x9601('0xc'));var squel=require(_0x9601('0xd'));var crypto=require(_0x9601('0xe'));var jsforce=require(_0x9601('0xf'));var deskjs=require(_0x9601('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9601('0x11'));var Redis=require(_0x9601('0x12'));var authService=require(_0x9601('0x13'));var qs=require(_0x9601('0x14'));var as=require(_0x9601('0x15'));var hardwareService=require(_0x9601('0x16'));var logger=require(_0x9601('0x17'))(_0x9601('0x18'));var utils=require(_0x9601('0x19'));var config=require(_0x9601('0x1a'));var licenseUtil=require(_0x9601('0x1b'));var db=require(_0x9601('0x1c'))['db'];function respondWithStatusCode(_0x2b9ac4,_0x106d52){_0x106d52=_0x106d52||0xcc;return function(_0x460315){if(_0x460315){return _0x2b9ac4[_0x9601('0x1d')](_0x106d52);}return _0x2b9ac4[_0x9601('0x1e')](_0x106d52)[_0x9601('0x1f')]();};}function respondWithResult(_0x2a4116,_0x3cf378){_0x3cf378=_0x3cf378||0xc8;return function(_0x10dae0){if(_0x10dae0){return _0x2a4116[_0x9601('0x1e')](_0x3cf378)[_0x9601('0x20')](_0x10dae0);}};}function respondWithFilteredResult(_0x2f29d5,_0x1a4739){return function(_0x4158cc){if(_0x4158cc){var _0x17dd7b=_0x4158cc[_0x9601('0x21')],_0x17ec30=_0x1a4739[_0x9601('0x22')],_0x4a0ef5=_0x1a4739[_0x9601('0x22')]+_0x1a4739['limit'],_0x9309d4;if(_0x4a0ef5>=_0x17dd7b){_0x4a0ef5=_0x17dd7b;_0x9309d4=0xc8;}else{_0x9309d4=0xce;}_0x2f29d5[_0x9601('0x1e')](_0x9309d4);return _0x2f29d5[_0x9601('0x23')](_0x9601('0x24'),_0x17ec30+'-'+_0x4a0ef5+'/'+_0x17dd7b)['json'](_0x4158cc);}return null;};}function patchUpdates(_0x156a40){return function(_0x156336){try{jsonpatch[_0x9601('0x25')](_0x156336,_0x156a40,!![]);}catch(_0x79f37f){return BPromise[_0x9601('0x26')](_0x79f37f);}return _0x156336['save']();};}function saveUpdates(_0x57af33,_0x25e061){return function(_0x321dc7){if(_0x321dc7){return _0x321dc7['update'](_0x57af33)['then'](function(_0x195f1c){return _0x195f1c;});}return null;};}function removeEntity(_0x4949e5,_0x4ecb15){return function(_0x11c759){if(_0x11c759){return _0x11c759[_0x9601('0x27')]()[_0x9601('0x28')](function(){_0x4949e5[_0x9601('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5009a2,_0x278973){return function(_0x4f1683){if(!_0x4f1683){_0x5009a2[_0x9601('0x1d')](0x194);}return _0x4f1683;};}function handleError(_0x53716d,_0x2365d5){_0x2365d5=_0x2365d5||0x1f4;return function(_0x29591e){logger['error'](_0x29591e[_0x9601('0x29')]);if(_0x29591e[_0x9601('0x2a')]){delete _0x29591e[_0x9601('0x2a')];}_0x53716d[_0x9601('0x1e')](_0x2365d5)['send'](_0x29591e);};}exports['index']=function(_0x2be012,_0x18683e){var _0x15c825={},_0x29bc58={},_0x2728a1={'count':0x0,'rows':[]};var _0x429af9=_['map'](db[_0x9601('0x2b')]['rawAttributes'],function(_0x3ea05f){return{'name':_0x3ea05f['fieldName'],'type':_0x3ea05f['type'][_0x9601('0x2c')]};});_0x29bc58[_0x9601('0x2d')]=_[_0x9601('0x2e')](_0x429af9,_0x9601('0x2a'));_0x29bc58['query']=_[_0x9601('0x2f')](_0x2be012['query']);_0x29bc58['filters']=_[_0x9601('0x30')](_0x29bc58[_0x9601('0x2d')],_0x29bc58[_0x9601('0x31')]);_0x15c825['attributes']=_[_0x9601('0x30')](_0x29bc58[_0x9601('0x2d')],qs[_0x9601('0x32')](_0x2be012[_0x9601('0x31')][_0x9601('0x32')]));_0x15c825[_0x9601('0x33')]=_0x15c825['attributes'][_0x9601('0x34')]?_0x15c825[_0x9601('0x33')]:_0x29bc58[_0x9601('0x2d')];if(!_0x2be012[_0x9601('0x31')]['hasOwnProperty'](_0x9601('0x35'))){_0x15c825[_0x9601('0x36')]=qs['limit'](_0x2be012['query']['limit']);_0x15c825[_0x9601('0x22')]=qs[_0x9601('0x22')](_0x2be012[_0x9601('0x31')][_0x9601('0x22')]);}_0x15c825['order']=qs['sort'](_0x2be012[_0x9601('0x31')][_0x9601('0x37')]);_0x15c825[_0x9601('0x38')]=qs[_0x9601('0x39')](_[_0x9601('0x3a')](_0x2be012['query'],_0x29bc58[_0x9601('0x39')]),_0x429af9);if(_0x2be012[_0x9601('0x31')][_0x9601('0x3b')]){_0x15c825[_0x9601('0x38')]=_['merge'](_0x15c825[_0x9601('0x38')],{'$or':_[_0x9601('0x2e')](_0x429af9,function(_0x54a258){if(_0x54a258['type']!==_0x9601('0x3c')){var _0x4e7c6c={};_0x4e7c6c[_0x54a258['name']]={'$like':'%'+_0x2be012[_0x9601('0x31')]['filter']+'%'};return _0x4e7c6c;}})});}_0x15c825=_['merge']({},_0x15c825,_0x2be012[_0x9601('0x3d')]);var _0x3ac174={'where':_0x15c825[_0x9601('0x38')]};return db[_0x9601('0x2b')][_0x9601('0x21')](_0x3ac174)['then'](function(_0x186da9){_0x2728a1[_0x9601('0x21')]=_0x186da9;if(_0x2be012[_0x9601('0x31')][_0x9601('0x3e')]){_0x15c825[_0x9601('0x3f')]=[{'all':!![]}];}return db[_0x9601('0x2b')]['findAll'](_0x15c825);})[_0x9601('0x28')](function(_0x370b98){_0x2728a1['rows']=_0x370b98;return _0x2728a1;})[_0x9601('0x28')](respondWithFilteredResult(_0x18683e,_0x15c825))[_0x9601('0x40')](handleError(_0x18683e,null));};exports[_0x9601('0x41')]=function(_0x56382c,_0x5ec631){var _0x2214b7={'raw':!![],'where':{'id':_0x56382c[_0x9601('0x42')]['id']}},_0x9ec6f8={};_0x9ec6f8['model']=_[_0x9601('0x2f')](db[_0x9601('0x2b')]['rawAttributes']);_0x9ec6f8['query']=_[_0x9601('0x2f')](_0x56382c[_0x9601('0x31')]);_0x9ec6f8[_0x9601('0x39')]=_[_0x9601('0x30')](_0x9ec6f8[_0x9601('0x2d')],_0x9ec6f8['query']);_0x2214b7['attributes']=_['intersection'](_0x9ec6f8['model'],qs['fields'](_0x56382c[_0x9601('0x31')][_0x9601('0x32')]));_0x2214b7[_0x9601('0x33')]=_0x2214b7['attributes'][_0x9601('0x34')]?_0x2214b7[_0x9601('0x33')]:_0x9ec6f8[_0x9601('0x2d')];if(_0x56382c[_0x9601('0x31')]['includeAll']){_0x2214b7[_0x9601('0x3f')]=[{'all':!![]}];}_0x2214b7=_[_0x9601('0x43')]({},_0x2214b7,_0x56382c['options']);return db['OpenchannelTransferReport']['find'](_0x2214b7)['then'](handleEntityNotFound(_0x5ec631,null))[_0x9601('0x28')](respondWithResult(_0x5ec631,null))[_0x9601('0x40')](handleError(_0x5ec631,null));};exports[_0x9601('0x44')]=function(_0x10d3fe,_0x837938){return db['OpenchannelTransferReport'][_0x9601('0x44')](_0x10d3fe[_0x9601('0x45')],{})[_0x9601('0x28')](respondWithResult(_0x837938,0xc9))['catch'](handleError(_0x837938,null));};exports[_0x9601('0x46')]=function(_0xd52c03,_0x49ed19){if(_0xd52c03[_0x9601('0x45')]['id']){delete _0xd52c03[_0x9601('0x45')]['id'];}return db[_0x9601('0x2b')][_0x9601('0x47')]({'where':{'id':_0xd52c03[_0x9601('0x42')]['id']}})[_0x9601('0x28')](handleEntityNotFound(_0x49ed19,null))[_0x9601('0x28')](saveUpdates(_0xd52c03['body'],null))[_0x9601('0x28')](respondWithResult(_0x49ed19,null))[_0x9601('0x40')](handleError(_0x49ed19,null));};exports[_0x9601('0x27')]=function(_0x5978ab,_0x24fa41){return db['OpenchannelTransferReport'][_0x9601('0x47')]({'where':{'id':_0x5978ab[_0x9601('0x42')]['id']}})['then'](handleEntityNotFound(_0x24fa41,null))[_0x9601('0x28')](removeEntity(_0x24fa41,null))[_0x9601('0x40')](handleError(_0x24fa41,null));};exports['describe']=function(_0x294b25,_0x262382){return db['OpenchannelTransferReport'][_0x9601('0x48')]()[_0x9601('0x28')](respondWithResult(_0x262382,null))[_0x9601('0x40')](handleError(_0x262382,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 76db85e..7992b7e 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 _0x7048=['../../config/environment','exports','define','report_openchannel_transfer','uniqueid','util','api','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7048,0xec));var _0x8704=function(_0x5b169a,_0x1196a9){_0x5b169a=_0x5b169a-0x0;var _0x447ec1=_0x7048[_0x5b169a];return _0x447ec1;};'use strict';var _=require('lodash');var util=require(_0x8704('0x0'));var logger=require('../../config/logger')(_0x8704('0x1'));var moment=require('moment');var BPromise=require(_0x8704('0x2'));var rp=require(_0x8704('0x3'));var fs=require('fs');var path=require(_0x8704('0x4'));var rimraf=require(_0x8704('0x5'));var config=require(_0x8704('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8704('0x7')]=function(_0x5c8c07,_0x22e5b2){return _0x5c8c07[_0x8704('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8704('0x9'),'paranoid':![],'indexes':[{'name':_0x8704('0xa'),'fields':[_0x8704('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb92f=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','report_openchannel_transfer','uniqueid','lodash'];(function(_0x4afc33,_0x5088fd){var _0x448b1c=function(_0x152051){while(--_0x152051){_0x4afc33['push'](_0x4afc33['shift']());}};_0x448b1c(++_0x5088fd);}(_0xb92f,0xe6));var _0xfb92=function(_0x4113ad,_0xd7e9fa){_0x4113ad=_0x4113ad-0x0;var _0x1e767a=_0xb92f[_0x4113ad];return _0x1e767a;};'use strict';var _=require(_0xfb92('0x0'));var util=require(_0xfb92('0x1'));var logger=require(_0xfb92('0x2'))(_0xfb92('0x3'));var moment=require('moment');var BPromise=require(_0xfb92('0x4'));var rp=require(_0xfb92('0x5'));var fs=require('fs');var path=require(_0xfb92('0x6'));var rimraf=require(_0xfb92('0x7'));var config=require(_0xfb92('0x8'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x1f2021,_0x503404){return _0x1f2021['define']('OpenchannelTransferReport',attributes,{'tableName':_0xfb92('0x9'),'paranoid':![],'indexes':[{'name':_0xfb92('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 49b4117..bc8f1ee 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 _0x020c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4cdc2e,_0x1a0b37){var _0x2849ad=function(_0x59534c){while(--_0x59534c){_0x4cdc2e['push'](_0x4cdc2e['shift']());}};_0x2849ad(++_0x1a0b37);}(_0x020c,0xd2));var _0xc020=function(_0x101645,_0x285985){_0x101645=_0x101645-0x0;var _0x5a5305=_0x020c[_0x101645];return _0x5a5305;};'use strict';var _=require(_0xc020('0x0'));var util=require(_0xc020('0x1'));var moment=require(_0xc020('0x2'));var BPromise=require(_0xc020('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc020('0x4'));var db=require(_0xc020('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc020('0x6'))(_0xc020('0x7'));var config=require(_0xc020('0x8'));var jayson=require(_0xc020('0x9'));var client=jayson[_0xc020('0xa')][_0xc020('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e2164,_0x1a8dc5,_0x34931d){return new BPromise(function(_0x1f7f90,_0x408dfe){return client[_0xc020('0xc')](_0x1e2164,_0x34931d)[_0xc020('0xd')](function(_0x4e0271){logger[_0xc020('0xe')](_0xc020('0xf'),_0x1a8dc5,_0xc020('0x10'));logger['debug'](_0xc020('0x11'),_0x1a8dc5,_0xc020('0x10'),JSON['stringify'](_0x4e0271));if(_0x4e0271[_0xc020('0x12')]){if(_0x4e0271[_0xc020('0x12')][_0xc020('0x13')]===0x1f4){logger[_0xc020('0x12')](_0xc020('0xf'),_0x1a8dc5,_0x4e0271['error'][_0xc020('0x14')]);return _0x408dfe(_0x4e0271['error'][_0xc020('0x14')]);}logger['error'](_0xc020('0xf'),_0x1a8dc5,_0x4e0271[_0xc020('0x12')]['message']);return _0x1f7f90(_0x4e0271[_0xc020('0x12')][_0xc020('0x14')]);}else{logger[_0xc020('0xe')](_0xc020('0xf'),_0x1a8dc5,_0xc020('0x10'));_0x1f7f90(_0x4e0271['result']['message']);}})['catch'](function(_0x5dd314){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1a8dc5,_0x5dd314);_0x408dfe(_0x5dd314);});});} \ No newline at end of file +var _0x7177=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x11fdeb,_0x5f0ebf){var _0x5a57fe=function(_0x22cb0a){while(--_0x22cb0a){_0x11fdeb['push'](_0x11fdeb['shift']());}};_0x5a57fe(++_0x5f0ebf);}(_0x7177,0x174));var _0x7717=function(_0x1c5ad6,_0x47b206){_0x1c5ad6=_0x1c5ad6-0x0;var _0x1d5829=_0x7177[_0x1c5ad6];return _0x1d5829;};'use strict';var _=require(_0x7717('0x0'));var util=require(_0x7717('0x1'));var moment=require(_0x7717('0x2'));var BPromise=require(_0x7717('0x3'));var rs=require(_0x7717('0x4'));var fs=require('fs');var Redis=require(_0x7717('0x5'));var db=require(_0x7717('0x6'))['db'];var utils=require(_0x7717('0x7'));var logger=require(_0x7717('0x8'))('rpc');var config=require(_0x7717('0x9'));var jayson=require(_0x7717('0xa'));var client=jayson[_0x7717('0xb')][_0x7717('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x542fb1,_0x2d20cb,_0x1f2d82){return new BPromise(function(_0x5bb3e1,_0xe67e60){return client[_0x7717('0xd')](_0x542fb1,_0x1f2d82)[_0x7717('0xe')](function(_0x63a5f7){logger[_0x7717('0xf')](_0x7717('0x10'),_0x2d20cb,_0x7717('0x11'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2d20cb,_0x7717('0x11'),JSON[_0x7717('0x12')](_0x63a5f7));if(_0x63a5f7[_0x7717('0x13')]){if(_0x63a5f7[_0x7717('0x13')][_0x7717('0x14')]===0x1f4){logger[_0x7717('0x13')](_0x7717('0x10'),_0x2d20cb,_0x63a5f7[_0x7717('0x13')][_0x7717('0x15')]);return _0xe67e60(_0x63a5f7[_0x7717('0x13')]['message']);}logger[_0x7717('0x13')](_0x7717('0x10'),_0x2d20cb,_0x63a5f7[_0x7717('0x13')][_0x7717('0x15')]);return _0x5bb3e1(_0x63a5f7['error'][_0x7717('0x15')]);}else{logger[_0x7717('0xf')](_0x7717('0x10'),_0x2d20cb,_0x7717('0x11'));_0x5bb3e1(_0x63a5f7['result']['message']);}})[_0x7717('0x16')](function(_0x344942){logger['error'](_0x7717('0x10'),_0x2d20cb,_0x344942);_0xe67e60(_0x344942);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8d3e77a..8ce39da 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 _0xf3e1=['../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','post','create','put','delete','exports','multer','express','Router'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xf3e1,0x1bd));var _0x1f3e=function(_0x4aadbc,_0x4afc4d){_0x4aadbc=_0x4aadbc-0x0;var _0x372f33=_0xf3e1[_0x4aadbc];return _0x372f33;};'use strict';var multer=require(_0x1f3e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f3e('0x1'));var router=express[_0x1f3e('0x2')]();var auth=require(_0x1f3e('0x3'));var interaction=require(_0x1f3e('0x4'));var config=require('../../config/environment');var controller=require(_0x1f3e('0x5'));router[_0x1f3e('0x6')]('/',auth[_0x1f3e('0x7')](),controller['index']);router[_0x1f3e('0x6')](_0x1f3e('0x8'),auth[_0x1f3e('0x7')](),controller['show']);router[_0x1f3e('0x9')]('/',auth[_0x1f3e('0x7')](),controller[_0x1f3e('0xa')]);router[_0x1f3e('0xb')](_0x1f3e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x1f3e('0xc')](_0x1f3e('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f3e('0xd')]=router; \ No newline at end of file +var _0x64d4=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x35c497,_0x2a6b9f){var _0x3d402f=function(_0x1e235b){while(--_0x1e235b){_0x35c497['push'](_0x35c497['shift']());}};_0x3d402f(++_0x2a6b9f);}(_0x64d4,0x152));var _0x464d=function(_0x3b36f0,_0x3d7be2){_0x3b36f0=_0x3b36f0-0x0;var _0x4e8cd0=_0x64d4[_0x3b36f0];return _0x4e8cd0;};'use strict';var multer=require(_0x464d('0x0'));var util=require('util');var path=require(_0x464d('0x1'));var timeout=require(_0x464d('0x2'));var express=require(_0x464d('0x3'));var router=express[_0x464d('0x4')]();var auth=require(_0x464d('0x5'));var interaction=require(_0x464d('0x6'));var config=require(_0x464d('0x7'));var controller=require(_0x464d('0x8'));router[_0x464d('0x9')]('/',auth[_0x464d('0xa')](),controller[_0x464d('0xb')]);router[_0x464d('0x9')](_0x464d('0xc'),auth[_0x464d('0xa')](),controller[_0x464d('0xd')]);router[_0x464d('0xe')]('/',auth[_0x464d('0xa')](),controller[_0x464d('0xf')]);router[_0x464d('0x10')](_0x464d('0xc'),auth[_0x464d('0xa')](),controller[_0x464d('0x11')]);router[_0x464d('0x12')](_0x464d('0xc'),auth['isAuthenticated'](),controller[_0x464d('0x13')]);module[_0x464d('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index eb08bdc..3a6d3ba 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 _0x7cff=['name','sequelize','exports','STRING'];(function(_0x412e68,_0x8d2687){var _0x5cf112=function(_0x3efd82){while(--_0x3efd82){_0x412e68['push'](_0x412e68['shift']());}};_0x5cf112(++_0x8d2687);}(_0x7cff,0x7d));var _0xf7cf=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x7cff[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0xf7cf('0x0'));module[_0xf7cf('0x1')]={'name':{'type':Sequelize[_0xf7cf('0x2')],'unique':_0xf7cf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf7cf('0x2')]}}; \ No newline at end of file +var _0x14b9=['name','sequelize','STRING'];(function(_0x407a62,_0x519fb4){var _0x384ab3=function(_0x95823a){while(--_0x95823a){_0x407a62['push'](_0x407a62['shift']());}};_0x384ab3(++_0x519fb4);}(_0x14b9,0xfa));var _0x914b=function(_0x416c90,_0x4c1be4){_0x416c90=_0x416c90-0x0;var _0x400b84=_0x14b9[_0x416c90];return _0x400b84;};'use strict';var Sequelize=require(_0x914b('0x0'));module['exports']={'name':{'type':Sequelize[_0x914b('0x1')],'unique':_0x914b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x914b('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2421a8c..fbb2961 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 _0x8801=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','then','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user'];(function(_0x42d91b,_0x236a1d){var _0x4e66b8=function(_0x4cb738){while(--_0x4cb738){_0x42d91b['push'](_0x42d91b['shift']());}};_0x4e66b8(++_0x236a1d);}(_0x8801,0xf7));var _0x1880=function(_0x5ebe37,_0x3c7aae){_0x5ebe37=_0x5ebe37-0x0;var _0xf341a5=_0x8801[_0x5ebe37];return _0xf341a5;};'use strict';var pdf=require(_0x1880('0x0'));var emlformat=require(_0x1880('0x1'));var rimraf=require(_0x1880('0x2'));var zipdir=require(_0x1880('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1880('0x4'));var moment=require(_0x1880('0x5'));var BPromise=require(_0x1880('0x6'));var Mustache=require(_0x1880('0x7'));var util=require(_0x1880('0x8'));var path=require(_0x1880('0x9'));var sox=require(_0x1880('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1880('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1880('0xc'));var deskjs=require(_0x1880('0xd'));var toCsv=require(_0x1880('0xe'));var querystring=require(_0x1880('0xf'));var Papa=require('papaparse');var Redis=require(_0x1880('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1880('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1880('0x12'));var logger=require(_0x1880('0x13'))(_0x1880('0x14'));var utils=require(_0x1880('0x15'));var config=require(_0x1880('0x16'));var licenseUtil=require(_0x1880('0x17'));var db=require(_0x1880('0x18'))['db'];function respondWithStatusCode(_0x4f6367,_0x5ae171){_0x5ae171=_0x5ae171||0xcc;return function(_0x7f7d63){if(_0x7f7d63){return _0x4f6367['sendStatus'](_0x5ae171);}return _0x4f6367[_0x1880('0x19')](_0x5ae171)[_0x1880('0x1a')]();};}function respondWithResult(_0x2c49c7,_0x3db404){_0x3db404=_0x3db404||0xc8;return function(_0xd7ad57){if(_0xd7ad57){return _0x2c49c7[_0x1880('0x19')](_0x3db404)[_0x1880('0x1b')](_0xd7ad57);}};}function respondWithFilteredResult(_0x11500b,_0x4451cc){return function(_0x37f24a){if(_0x37f24a){var _0x4c80ce=_0x37f24a[_0x1880('0x1c')],_0xb363ba=_0x4451cc[_0x1880('0x1d')],_0x50b60b=_0x4451cc[_0x1880('0x1d')]+_0x4451cc[_0x1880('0x1e')],_0x38841a;if(_0x50b60b>=_0x4c80ce){_0x50b60b=_0x4c80ce;_0x38841a=0xc8;}else{_0x38841a=0xce;}_0x11500b['status'](_0x38841a);return _0x11500b['set'](_0x1880('0x1f'),_0xb363ba+'-'+_0x50b60b+'/'+_0x4c80ce)[_0x1880('0x1b')](_0x37f24a);}return null;};}function patchUpdates(_0x433cb2){return function(_0x134f3d){try{jsonpatch['apply'](_0x134f3d,_0x433cb2,!![]);}catch(_0x7b0c87){return BPromise[_0x1880('0x20')](_0x7b0c87);}return _0x134f3d[_0x1880('0x21')]();};}function saveUpdates(_0x2ee7cd,_0x3690ca){return function(_0x423468){if(_0x423468){return _0x423468['update'](_0x2ee7cd)[_0x1880('0x22')](function(_0x3df1bf){return _0x3df1bf;});}return null;};}function removeEntity(_0x2a9cd3,_0x35e716){return function(_0x47058a){if(_0x47058a){return _0x47058a['destroy']()['then'](function(){var _0x5b7ac7=_0x47058a['get']({'plain':!![]});var _0x39b33b=_0x1880('0x23');return db[_0x1880('0x24')]['destroy']({'where':{'type':_0x39b33b,'resourceId':_0x5b7ac7['id']}})['then'](function(){return _0x47058a;});})[_0x1880('0x22')](function(){_0x2a9cd3[_0x1880('0x19')](0xcc)[_0x1880('0x1a')]();});}};}function handleEntityNotFound(_0x5a0890,_0x416bcf){return function(_0x37d832){if(!_0x37d832){_0x5a0890[_0x1880('0x25')](0x194);}return _0x37d832;};}function handleError(_0x170878,_0x173499){_0x173499=_0x173499||0x1f4;return function(_0x194055){logger[_0x1880('0x26')](_0x194055[_0x1880('0x27')]);if(_0x194055[_0x1880('0x28')]){delete _0x194055['name'];}_0x170878[_0x1880('0x19')](_0x173499)[_0x1880('0x29')](_0x194055);};}exports[_0x1880('0x2a')]=function(_0x3eb008,_0x4c451b){var _0x4258a2={},_0x335f68={},_0x1a4d6a={'count':0x0,'rows':[]};var _0x127077=_[_0x1880('0x2b')](db[_0x1880('0x2c')][_0x1880('0x2d')],function(_0x21b237){return{'name':_0x21b237[_0x1880('0x2e')],'type':_0x21b237[_0x1880('0x2f')][_0x1880('0x30')]};});_0x335f68[_0x1880('0x31')]=_[_0x1880('0x2b')](_0x127077,_0x1880('0x28'));_0x335f68['query']=_['keys'](_0x3eb008[_0x1880('0x32')]);_0x335f68[_0x1880('0x33')]=_[_0x1880('0x34')](_0x335f68['model'],_0x335f68[_0x1880('0x32')]);_0x4258a2[_0x1880('0x35')]=_[_0x1880('0x34')](_0x335f68[_0x1880('0x31')],qs[_0x1880('0x36')](_0x3eb008[_0x1880('0x32')]['fields']));_0x4258a2[_0x1880('0x35')]=_0x4258a2[_0x1880('0x35')][_0x1880('0x37')]?_0x4258a2['attributes']:_0x335f68[_0x1880('0x31')];if(!_0x3eb008[_0x1880('0x32')][_0x1880('0x38')](_0x1880('0x39'))){_0x4258a2[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x3eb008[_0x1880('0x32')][_0x1880('0x1e')]);_0x4258a2[_0x1880('0x1d')]=qs[_0x1880('0x1d')](_0x3eb008[_0x1880('0x32')][_0x1880('0x1d')]);}_0x4258a2[_0x1880('0x3a')]=qs[_0x1880('0x3b')](_0x3eb008[_0x1880('0x32')][_0x1880('0x3b')]);_0x4258a2['where']=qs[_0x1880('0x33')](_[_0x1880('0x3c')](_0x3eb008['query'],_0x335f68[_0x1880('0x33')]),_0x127077);if(_0x3eb008[_0x1880('0x32')]['filter']){_0x4258a2[_0x1880('0x3d')]=_[_0x1880('0x3e')](_0x4258a2['where'],{'$or':_[_0x1880('0x2b')](_0x127077,function(_0x3c42a4){if(_0x3c42a4[_0x1880('0x2f')]!==_0x1880('0x3f')){var _0x18b0cf={};_0x18b0cf[_0x3c42a4[_0x1880('0x28')]]={'$like':'%'+_0x3eb008[_0x1880('0x32')][_0x1880('0x40')]+'%'};return _0x18b0cf;}})});}_0x4258a2=_['merge']({},_0x4258a2,_0x3eb008['options']);var _0x511d48={'where':_0x4258a2[_0x1880('0x3d')]};return db[_0x1880('0x2c')][_0x1880('0x1c')](_0x511d48)[_0x1880('0x22')](function(_0x4f1300){_0x1a4d6a['count']=_0x4f1300;if(_0x3eb008[_0x1880('0x32')]['includeAll']){_0x4258a2[_0x1880('0x41')]=[{'all':!![]}];}return db[_0x1880('0x2c')][_0x1880('0x42')](_0x4258a2);})[_0x1880('0x22')](function(_0x182264){_0x1a4d6a[_0x1880('0x43')]=_0x182264;return _0x1a4d6a;})['then'](respondWithFilteredResult(_0x4c451b,_0x4258a2))[_0x1880('0x44')](handleError(_0x4c451b,null));};exports[_0x1880('0x45')]=function(_0x33455b,_0x495e8e){var _0x1d4f3c={'raw':!![],'where':{'id':_0x33455b[_0x1880('0x46')]['id']}},_0x245184={};_0x245184[_0x1880('0x31')]=_[_0x1880('0x47')](db[_0x1880('0x2c')][_0x1880('0x2d')]);_0x245184[_0x1880('0x32')]=_['keys'](_0x33455b[_0x1880('0x32')]);_0x245184[_0x1880('0x33')]=_['intersection'](_0x245184[_0x1880('0x31')],_0x245184[_0x1880('0x32')]);_0x1d4f3c['attributes']=_[_0x1880('0x34')](_0x245184[_0x1880('0x31')],qs[_0x1880('0x36')](_0x33455b[_0x1880('0x32')][_0x1880('0x36')]));_0x1d4f3c[_0x1880('0x35')]=_0x1d4f3c[_0x1880('0x35')]['length']?_0x1d4f3c[_0x1880('0x35')]:_0x245184[_0x1880('0x31')];if(_0x33455b[_0x1880('0x32')][_0x1880('0x48')]){_0x1d4f3c[_0x1880('0x41')]=[{'all':!![]}];}_0x1d4f3c=_[_0x1880('0x3e')]({},_0x1d4f3c,_0x33455b['options']);return db['Pause'][_0x1880('0x49')](_0x1d4f3c)[_0x1880('0x22')](handleEntityNotFound(_0x495e8e,null))[_0x1880('0x22')](respondWithResult(_0x495e8e,null))['catch'](handleError(_0x495e8e,null));};exports[_0x1880('0x4a')]=function(_0x5f0f11,_0x32e830){return db[_0x1880('0x2c')][_0x1880('0x4a')](_0x5f0f11[_0x1880('0x4b')],{})['then'](function(_0x219a9d){var _0x4abc73=_0x5f0f11[_0x1880('0x4c')][_0x1880('0x4d')]({'plain':!![]});if(!_0x4abc73)throw new Error(_0x1880('0x4e'));if(_0x4abc73[_0x1880('0x4f')]===_0x1880('0x4c')){var _0x264fe1=_0x219a9d[_0x1880('0x4d')]({'plain':!![]});var _0x4efc39=_0x1880('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x4efc39,'userProfileId':_0x4abc73['userProfileId']},'raw':!![]})[_0x1880('0x22')](function(_0x13bcaf){if(_0x13bcaf&&_0x13bcaf['autoAssociation']===0x0){return db[_0x1880('0x24')]['create']({'name':_0x264fe1[_0x1880('0x28')],'resourceId':_0x264fe1['id'],'type':_0x13bcaf[_0x1880('0x28')],'sectionId':_0x13bcaf['id']},{})[_0x1880('0x22')](function(){return _0x219a9d;});}else{return _0x219a9d;}})[_0x1880('0x44')](function(_0x4c5ca7){logger['error'](_0x1880('0x50'),_0x4c5ca7);throw _0x4c5ca7;});}return _0x219a9d;})[_0x1880('0x22')](respondWithResult(_0x32e830,0xc9))['catch'](handleError(_0x32e830,null));};exports['update']=function(_0x555488,_0x1a88f1){if(_0x555488['body']['id']){delete _0x555488[_0x1880('0x4b')]['id'];}return db[_0x1880('0x2c')][_0x1880('0x49')]({'where':{'id':_0x555488[_0x1880('0x46')]['id']}})[_0x1880('0x22')](handleEntityNotFound(_0x1a88f1,null))['then'](saveUpdates(_0x555488[_0x1880('0x4b')],null))[_0x1880('0x22')](respondWithResult(_0x1a88f1,null))['catch'](handleError(_0x1a88f1,null));};exports['destroy']=function(_0x5a13cb,_0x52208e){return db['Pause'][_0x1880('0x49')]({'where':{'id':_0x5a13cb['params']['id']}})[_0x1880('0x22')](handleEntityNotFound(_0x52208e,null))[_0x1880('0x22')](removeEntity(_0x52208e,null))[_0x1880('0x44')](handleError(_0x52208e,null));}; \ No newline at end of file +var _0x4197=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','stack','name','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','merge','Pause','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x10ce94,_0xb67c89){var _0x2af122=function(_0x382a41){while(--_0x382a41){_0x10ce94['push'](_0x10ce94['shift']());}};_0x2af122(++_0xb67c89);}(_0x4197,0x138));var _0x7419=function(_0x4ed423,_0x306aa5){_0x4ed423=_0x4ed423-0x0;var _0x5703ee=_0x4197[_0x4ed423];return _0x5703ee;};'use strict';var pdf=require(_0x7419('0x0'));var emlformat=require(_0x7419('0x1'));var rimraf=require(_0x7419('0x2'));var zipdir=require(_0x7419('0x3'));var jsonpatch=require(_0x7419('0x4'));var rp=require(_0x7419('0x5'));var moment=require(_0x7419('0x6'));var BPromise=require(_0x7419('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7419('0x8'));var ejs=require(_0x7419('0x9'));var fs=require('fs');var _=require(_0x7419('0xa'));var squel=require(_0x7419('0xb'));var crypto=require(_0x7419('0xc'));var jsforce=require(_0x7419('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7419('0x8'));var querystring=require('querystring');var Papa=require(_0x7419('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7419('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7419('0x10'));var utils=require(_0x7419('0x11'));var config=require(_0x7419('0x12'));var licenseUtil=require(_0x7419('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3e3b,_0x44bb78){_0x44bb78=_0x44bb78||0xcc;return function(_0x4577cc){if(_0x4577cc){return _0x5f3e3b[_0x7419('0x14')](_0x44bb78);}return _0x5f3e3b[_0x7419('0x15')](_0x44bb78)[_0x7419('0x16')]();};}function respondWithResult(_0x1c203f,_0x1c9514){_0x1c9514=_0x1c9514||0xc8;return function(_0xd82fc0){if(_0xd82fc0){return _0x1c203f[_0x7419('0x15')](_0x1c9514)[_0x7419('0x17')](_0xd82fc0);}};}function respondWithFilteredResult(_0x43bacb,_0x4f5996){return function(_0x50680c){if(_0x50680c){var _0x56878a=_0x50680c[_0x7419('0x18')],_0x293a66=_0x4f5996[_0x7419('0x19')],_0xe507a3=_0x4f5996['offset']+_0x4f5996['limit'],_0x445edd;if(_0xe507a3>=_0x56878a){_0xe507a3=_0x56878a;_0x445edd=0xc8;}else{_0x445edd=0xce;}_0x43bacb[_0x7419('0x15')](_0x445edd);return _0x43bacb[_0x7419('0x1a')](_0x7419('0x1b'),_0x293a66+'-'+_0xe507a3+'/'+_0x56878a)[_0x7419('0x17')](_0x50680c);}return null;};}function patchUpdates(_0x3d0043){return function(_0x240c52){try{jsonpatch[_0x7419('0x1c')](_0x240c52,_0x3d0043,!![]);}catch(_0x2fa569){return BPromise[_0x7419('0x1d')](_0x2fa569);}return _0x240c52[_0x7419('0x1e')]();};}function saveUpdates(_0xa57535,_0x9608f4){return function(_0xdb550){if(_0xdb550){return _0xdb550['update'](_0xa57535)[_0x7419('0x1f')](function(_0x3d464c){return _0x3d464c;});}return null;};}function removeEntity(_0x384194,_0x2512e4){return function(_0x189ae1){if(_0x189ae1){return _0x189ae1[_0x7419('0x20')]()[_0x7419('0x1f')](function(){var _0x7f78fa=_0x189ae1[_0x7419('0x21')]({'plain':!![]});var _0x1f1021=_0x7419('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f1021,'resourceId':_0x7f78fa['id']}})[_0x7419('0x1f')](function(){return _0x189ae1;});})[_0x7419('0x1f')](function(){_0x384194[_0x7419('0x15')](0xcc)[_0x7419('0x16')]();});}};}function handleEntityNotFound(_0x155c80,_0x1439c6){return function(_0x4fc5ce){if(!_0x4fc5ce){_0x155c80[_0x7419('0x14')](0x194);}return _0x4fc5ce;};}function handleError(_0x4640bc,_0x574703){_0x574703=_0x574703||0x1f4;return function(_0x25e05a){logger['error'](_0x25e05a[_0x7419('0x23')]);if(_0x25e05a['name']){delete _0x25e05a[_0x7419('0x24')];}_0x4640bc[_0x7419('0x15')](_0x574703)['send'](_0x25e05a);};}exports[_0x7419('0x25')]=function(_0x5f38b2,_0x8c905d){var _0x2e7ac1={},_0x3a2f30={},_0xf202b7={'count':0x0,'rows':[]};var _0x8d5a23=_[_0x7419('0x26')](db['Pause']['rawAttributes'],function(_0x45b53e){return{'name':_0x45b53e[_0x7419('0x27')],'type':_0x45b53e['type'][_0x7419('0x28')]};});_0x3a2f30[_0x7419('0x29')]=_[_0x7419('0x26')](_0x8d5a23,'name');_0x3a2f30[_0x7419('0x2a')]=_[_0x7419('0x2b')](_0x5f38b2[_0x7419('0x2a')]);_0x3a2f30['filters']=_[_0x7419('0x2c')](_0x3a2f30[_0x7419('0x29')],_0x3a2f30['query']);_0x2e7ac1['attributes']=_[_0x7419('0x2c')](_0x3a2f30['model'],qs[_0x7419('0x2d')](_0x5f38b2[_0x7419('0x2a')]['fields']));_0x2e7ac1[_0x7419('0x2e')]=_0x2e7ac1[_0x7419('0x2e')][_0x7419('0x2f')]?_0x2e7ac1[_0x7419('0x2e')]:_0x3a2f30[_0x7419('0x29')];if(!_0x5f38b2[_0x7419('0x2a')][_0x7419('0x30')](_0x7419('0x31'))){_0x2e7ac1[_0x7419('0x32')]=qs[_0x7419('0x32')](_0x5f38b2[_0x7419('0x2a')][_0x7419('0x32')]);_0x2e7ac1[_0x7419('0x19')]=qs[_0x7419('0x19')](_0x5f38b2[_0x7419('0x2a')][_0x7419('0x19')]);}_0x2e7ac1[_0x7419('0x33')]=qs[_0x7419('0x34')](_0x5f38b2[_0x7419('0x2a')][_0x7419('0x34')]);_0x2e7ac1[_0x7419('0x35')]=qs[_0x7419('0x36')](_['pick'](_0x5f38b2[_0x7419('0x2a')],_0x3a2f30[_0x7419('0x36')]),_0x8d5a23);if(_0x5f38b2[_0x7419('0x2a')][_0x7419('0x37')]){_0x2e7ac1[_0x7419('0x35')]=_['merge'](_0x2e7ac1[_0x7419('0x35')],{'$or':_[_0x7419('0x26')](_0x8d5a23,function(_0x7a10ec){if(_0x7a10ec[_0x7419('0x38')]!=='VIRTUAL'){var _0x269783={};_0x269783[_0x7a10ec[_0x7419('0x24')]]={'$like':'%'+_0x5f38b2[_0x7419('0x2a')][_0x7419('0x37')]+'%'};return _0x269783;}})});}_0x2e7ac1=_[_0x7419('0x39')]({},_0x2e7ac1,_0x5f38b2['options']);var _0x15dc5e={'where':_0x2e7ac1[_0x7419('0x35')]};return db[_0x7419('0x3a')]['count'](_0x15dc5e)[_0x7419('0x1f')](function(_0x3112f8){_0xf202b7[_0x7419('0x18')]=_0x3112f8;if(_0x5f38b2[_0x7419('0x2a')][_0x7419('0x3b')]){_0x2e7ac1[_0x7419('0x3c')]=[{'all':!![]}];}return db[_0x7419('0x3a')][_0x7419('0x3d')](_0x2e7ac1);})[_0x7419('0x1f')](function(_0x3bd156){_0xf202b7['rows']=_0x3bd156;return _0xf202b7;})[_0x7419('0x1f')](respondWithFilteredResult(_0x8c905d,_0x2e7ac1))[_0x7419('0x3e')](handleError(_0x8c905d,null));};exports[_0x7419('0x3f')]=function(_0x1fc738,_0x16eb3f){var _0x9f676a={'raw':!![],'where':{'id':_0x1fc738[_0x7419('0x40')]['id']}},_0x307984={};_0x307984[_0x7419('0x29')]=_[_0x7419('0x2b')](db['Pause'][_0x7419('0x41')]);_0x307984[_0x7419('0x2a')]=_[_0x7419('0x2b')](_0x1fc738[_0x7419('0x2a')]);_0x307984['filters']=_[_0x7419('0x2c')](_0x307984[_0x7419('0x29')],_0x307984[_0x7419('0x2a')]);_0x9f676a['attributes']=_[_0x7419('0x2c')](_0x307984[_0x7419('0x29')],qs[_0x7419('0x2d')](_0x1fc738[_0x7419('0x2a')][_0x7419('0x2d')]));_0x9f676a['attributes']=_0x9f676a[_0x7419('0x2e')][_0x7419('0x2f')]?_0x9f676a[_0x7419('0x2e')]:_0x307984[_0x7419('0x29')];if(_0x1fc738[_0x7419('0x2a')][_0x7419('0x3b')]){_0x9f676a[_0x7419('0x3c')]=[{'all':!![]}];}_0x9f676a=_[_0x7419('0x39')]({},_0x9f676a,_0x1fc738[_0x7419('0x42')]);return db[_0x7419('0x3a')][_0x7419('0x43')](_0x9f676a)[_0x7419('0x1f')](handleEntityNotFound(_0x16eb3f,null))[_0x7419('0x1f')](respondWithResult(_0x16eb3f,null))[_0x7419('0x3e')](handleError(_0x16eb3f,null));};exports[_0x7419('0x44')]=function(_0xf08102,_0x50b806){return db['Pause'][_0x7419('0x44')](_0xf08102[_0x7419('0x45')],{})[_0x7419('0x1f')](function(_0x1edcef){var _0x4550fe=_0xf08102[_0x7419('0x46')]['get']({'plain':!![]});if(!_0x4550fe)throw new Error(_0x7419('0x47'));if(_0x4550fe[_0x7419('0x48')]===_0x7419('0x46')){var _0x364c20=_0x1edcef[_0x7419('0x21')]({'plain':!![]});var _0x1ae8ed=_0x7419('0x22');return db['UserProfileSection'][_0x7419('0x43')]({'where':{'name':_0x1ae8ed,'userProfileId':_0x4550fe[_0x7419('0x49')]},'raw':!![]})[_0x7419('0x1f')](function(_0x469f94){if(_0x469f94&&_0x469f94[_0x7419('0x4a')]===0x0){return db['UserProfileResource'][_0x7419('0x44')]({'name':_0x364c20['name'],'resourceId':_0x364c20['id'],'type':_0x469f94[_0x7419('0x24')],'sectionId':_0x469f94['id']},{})[_0x7419('0x1f')](function(){return _0x1edcef;});}else{return _0x1edcef;}})[_0x7419('0x3e')](function(_0x1cb969){logger[_0x7419('0x4b')](_0x7419('0x4c'),_0x1cb969);throw _0x1cb969;});}return _0x1edcef;})[_0x7419('0x1f')](respondWithResult(_0x50b806,0xc9))[_0x7419('0x3e')](handleError(_0x50b806,null));};exports[_0x7419('0x4d')]=function(_0x3ed532,_0x22958f){if(_0x3ed532[_0x7419('0x45')]['id']){delete _0x3ed532[_0x7419('0x45')]['id'];}return db['Pause'][_0x7419('0x43')]({'where':{'id':_0x3ed532[_0x7419('0x40')]['id']}})[_0x7419('0x1f')](handleEntityNotFound(_0x22958f,null))[_0x7419('0x1f')](saveUpdates(_0x3ed532[_0x7419('0x45')],null))['then'](respondWithResult(_0x22958f,null))[_0x7419('0x3e')](handleError(_0x22958f,null));};exports['destroy']=function(_0x4ecc67,_0x14dd93){return db[_0x7419('0x3a')][_0x7419('0x43')]({'where':{'id':_0x4ecc67['params']['id']}})['then'](handleEntityNotFound(_0x14dd93,null))[_0x7419('0x1f')](removeEntity(_0x14dd93,null))[_0x7419('0x3e')](handleError(_0x14dd93,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2713adb..7b6be0b 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 _0x5523=['./pause.attributes','exports','tools_pauses','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5523,0x137));var _0x3552=function(_0x34f0ad,_0x533cd5){_0x34f0ad=_0x34f0ad-0x0;var _0x1c894d=_0x5523[_0x34f0ad];return _0x1c894d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('Pause',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb350=['define','Pause','tools_pauses','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./pause.attributes','exports'];(function(_0x1e1a55,_0x46c9f0){var _0x454435=function(_0x3a0ec0){while(--_0x3a0ec0){_0x1e1a55['push'](_0x1e1a55['shift']());}};_0x454435(++_0x46c9f0);}(_0xb350,0x6f));var _0x0b35=function(_0xa84425,_0x2442a2){_0xa84425=_0xa84425-0x0;var _0xfe4280=_0xb350[_0xa84425];return _0xfe4280;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index a33ef47..5077869 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 _0x73ef=['attributes','include','map','model','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowPause','Pause','find','options','where'];(function(_0x3967aa,_0x377d96){var _0x41381b=function(_0x4eeea7){while(--_0x4eeea7){_0x3967aa['push'](_0x3967aa['shift']());}};_0x41381b(++_0x377d96);}(_0x73ef,0x1b7));var _0xf73e=function(_0x496336,_0x454c7e){_0x496336=_0x496336-0x0;var _0x3ba8c6=_0x73ef[_0x496336];return _0x3ba8c6;};'use strict';var _=require(_0xf73e('0x0'));var util=require(_0xf73e('0x1'));var moment=require(_0xf73e('0x2'));var BPromise=require(_0xf73e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf73e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf73e('0x5'));var logger=require(_0xf73e('0x6'))(_0xf73e('0x7'));var config=require(_0xf73e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf73e('0x9')][_0xf73e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470484,_0x38a0be,_0x50395a){return new BPromise(function(_0x131405,_0x343435){return client['request'](_0x470484,_0x50395a)[_0xf73e('0xb')](function(_0x3b7ea3){logger[_0xf73e('0xc')](_0xf73e('0xd'),_0x38a0be,_0xf73e('0xe'));logger[_0xf73e('0xf')](_0xf73e('0x10'),_0x38a0be,_0xf73e('0xe'),JSON[_0xf73e('0x11')](_0x3b7ea3));if(_0x3b7ea3['error']){if(_0x3b7ea3[_0xf73e('0x12')]['code']===0x1f4){logger[_0xf73e('0x12')]('Pause,\x20%s,\x20%s',_0x38a0be,_0x3b7ea3[_0xf73e('0x12')][_0xf73e('0x13')]);return _0x343435(_0x3b7ea3[_0xf73e('0x12')]['message']);}logger[_0xf73e('0x12')](_0xf73e('0xd'),_0x38a0be,_0x3b7ea3['error']['message']);return _0x131405(_0x3b7ea3[_0xf73e('0x12')][_0xf73e('0x13')]);}else{logger[_0xf73e('0xc')](_0xf73e('0xd'),_0x38a0be,_0xf73e('0xe'));_0x131405(_0x3b7ea3[_0xf73e('0x14')]['message']);}})['catch'](function(_0x1962a2){logger[_0xf73e('0x12')]('Pause,\x20%s,\x20%s',_0x38a0be,_0x1962a2);_0x343435(_0x1962a2);});});}exports[_0xf73e('0x15')]=function(_0x226c59){var _0x219922=this;return new Promise(function(_0xeb622b,_0x20d288){return db[_0xf73e('0x16')][_0xf73e('0x17')]({'raw':_0x226c59['options']?_0x226c59['options']['raw']===undefined?!![]:![]:!![],'where':_0x226c59[_0xf73e('0x18')]?_0x226c59['options'][_0xf73e('0x19')]||null:null,'attributes':_0x226c59[_0xf73e('0x18')]?_0x226c59['options'][_0xf73e('0x1a')]||null:null,'include':_0x226c59[_0xf73e('0x18')]?_0x226c59[_0xf73e('0x18')][_0xf73e('0x1b')]?_[_0xf73e('0x1c')](_0x226c59['options'][_0xf73e('0x1b')],function(_0x5d2739){return{'model':db[_0x5d2739['model']],'as':_0x5d2739['as'],'attributes':_0x5d2739['attributes'],'include':_0x5d2739[_0xf73e('0x1b')]?_[_0xf73e('0x1c')](_0x5d2739[_0xf73e('0x1b')],function(_0x16229c){return{'model':db[_0x16229c[_0xf73e('0x1d')]],'as':_0x16229c['as'],'attributes':_0x16229c[_0xf73e('0x1a')],'include':_0x16229c['include']?_[_0xf73e('0x1c')](_0x16229c[_0xf73e('0x1b')],function(_0x175895){return{'model':db[_0x175895[_0xf73e('0x1d')]],'as':_0x175895['as'],'attributes':_0x175895[_0xf73e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf73e('0xb')](function(_0x27f7f0){logger[_0xf73e('0xc')](_0xf73e('0x15'),_0x226c59);logger[_0xf73e('0xf')](_0xf73e('0x15'),_0x226c59,JSON[_0xf73e('0x11')](_0x27f7f0));_0xeb622b(_0x27f7f0);})[_0xf73e('0x1e')](function(_0x514ec8){logger[_0xf73e('0x12')](_0xf73e('0x15'),_0x514ec8[_0xf73e('0x13')],_0x226c59);_0x20d288(_0x219922[_0xf73e('0x12')](0x1f4,_0x514ec8[_0xf73e('0x13')]));});});}; \ No newline at end of file +var _0xfa7a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Pause,\x20%s,\x20%s','catch','Pause','find','options','raw','attributes','map','include','model','ShowPause','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x34694e,_0x4ea58e){_0x34694e=_0x34694e-0x0;var _0x256abe=_0xfa7a[_0x34694e];return _0x256abe;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var moment=require(_0xafa7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafa7('0x3'));var db=require(_0xafa7('0x4'))['db'];var utils=require(_0xafa7('0x5'));var logger=require(_0xafa7('0x6'))('rpc');var config=require(_0xafa7('0x7'));var jayson=require(_0xafa7('0x8'));var client=jayson[_0xafa7('0x9')][_0xafa7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc26e,_0x91c971,_0x1d8552){return new BPromise(function(_0x41103b,_0x5a9b0c){return client[_0xafa7('0xb')](_0x2fc26e,_0x1d8552)['then'](function(_0x42f79b){logger[_0xafa7('0xc')]('Pause,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));logger[_0xafa7('0xe')](_0xafa7('0xf'),_0x91c971,_0xafa7('0xd'),JSON[_0xafa7('0x10')](_0x42f79b));if(_0x42f79b[_0xafa7('0x11')]){if(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x12')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x91c971,_0x42f79b[_0xafa7('0x11')]['message']);return _0x5a9b0c(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x13')]);}logger['error'](_0xafa7('0x14'),_0x91c971,_0x42f79b['error'][_0xafa7('0x13')]);return _0x41103b(_0x42f79b['error'][_0xafa7('0x13')]);}else{logger[_0xafa7('0xc')]('Pause,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));_0x41103b(_0x42f79b['result']['message']);}})[_0xafa7('0x15')](function(_0x58c121){logger[_0xafa7('0x11')]('Pause,\x20%s,\x20%s',_0x91c971,_0x58c121);_0x5a9b0c(_0x58c121);});});}exports['ShowPause']=function(_0x5e12e0){var _0x5881e3=this;return new Promise(function(_0x3f304b,_0x4bee88){return db[_0xafa7('0x16')][_0xafa7('0x17')]({'raw':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0['options'][_0xafa7('0x19')]===undefined?!![]:![]:!![],'where':_0x5e12e0['options']?_0x5e12e0[_0xafa7('0x18')]['where']||null:null,'attributes':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0[_0xafa7('0x18')][_0xafa7('0x1a')]||null:null,'include':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0['options']['include']?_[_0xafa7('0x1b')](_0x5e12e0[_0xafa7('0x18')]['include'],function(_0x225255){return{'model':db[_0x225255['model']],'as':_0x225255['as'],'attributes':_0x225255['attributes'],'include':_0x225255[_0xafa7('0x1c')]?_['map'](_0x225255[_0xafa7('0x1c')],function(_0xb02aee){return{'model':db[_0xb02aee[_0xafa7('0x1d')]],'as':_0xb02aee['as'],'attributes':_0xb02aee[_0xafa7('0x1a')],'include':_0xb02aee[_0xafa7('0x1c')]?_[_0xafa7('0x1b')](_0xb02aee['include'],function(_0x9605f2){return{'model':db[_0x9605f2[_0xafa7('0x1d')]],'as':_0x9605f2['as'],'attributes':_0x9605f2[_0xafa7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58a0ad){logger[_0xafa7('0xc')](_0xafa7('0x1e'),_0x5e12e0);logger[_0xafa7('0xe')](_0xafa7('0x1e'),_0x5e12e0,JSON[_0xafa7('0x10')](_0x58a0ad));_0x3f304b(_0x58a0ad);})['catch'](function(_0xd054b2){logger['error'](_0xafa7('0x1e'),_0xd054b2[_0xafa7('0x13')],_0x5e12e0);_0x4bee88(_0x5881e3[_0xafa7('0x11')](0x1f4,_0xd054b2['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3a4aa20..3fda21c 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 _0x3c9c=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x8d5e8c,_0xd993e4){var _0x56087e=function(_0x230781){while(--_0x230781){_0x8d5e8c['push'](_0x8d5e8c['shift']());}};_0x56087e(++_0xd993e4);}(_0x3c9c,0xc7));var _0xc3c9=function(_0x53914a,_0x5ab5e6){_0x53914a=_0x53914a-0x0;var _0xec624d=_0x3c9c[_0x53914a];return _0xec624d;};'use strict';var multer=require(_0xc3c9('0x0'));var util=require('util');var path=require(_0xc3c9('0x1'));var timeout=require(_0xc3c9('0x2'));var express=require(_0xc3c9('0x3'));var router=express['Router']();var auth=require(_0xc3c9('0x4'));var interaction=require(_0xc3c9('0x5'));var config=require(_0xc3c9('0x6'));var controller=require(_0xc3c9('0x7'));router[_0xc3c9('0x8')]('/',auth[_0xc3c9('0x9')](),controller['index']);router['get']('/webhook',controller[_0xc3c9('0xa')]);router[_0xc3c9('0x8')]('/:id',auth[_0xc3c9('0x9')](),controller[_0xc3c9('0xb')]);router[_0xc3c9('0x8')](_0xc3c9('0xc'),auth[_0xc3c9('0x9')](),controller[_0xc3c9('0xd')]);var upload=multer({'storage':multer[_0xc3c9('0xe')]({'destination':function(_0x3ffd95,_0x487a61,_0x43bb8c){_0x43bb8c(null,path[_0xc3c9('0xf')](config[_0xc3c9('0x10')],_0xc3c9('0x11')));},'filename':function(_0xc80c15,_0xf315d0,_0x1d4e20){_0xf315d0['originalname']=_0xf315d0[_0xc3c9('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d4e20(null,util[_0xc3c9('0x13')](_0xc3c9('0x14'),path['basename'](_0xf315d0[_0xc3c9('0x12')],path[_0xc3c9('0x15')](_0xf315d0['originalname'])),Date[_0xc3c9('0x16')](),path['extname'](_0xf315d0[_0xc3c9('0x12')])));}})});router[_0xc3c9('0x17')]('/',upload[_0xc3c9('0x18')](_0xc3c9('0x19')),controller[_0xc3c9('0x1a')]);router[_0xc3c9('0x17')](_0xc3c9('0x1b'),controller[_0xc3c9('0x1c')]);router[_0xc3c9('0x1d')](_0xc3c9('0x1e'),auth[_0xc3c9('0x9')](),controller[_0xc3c9('0x1f')]);router[_0xc3c9('0x20')](_0xc3c9('0x1e'),auth[_0xc3c9('0x9')](),controller['delete']);module[_0xc3c9('0x21')]=router; \ No newline at end of file +var _0x0b69=['format','basename','originalname','extname','post','single','file','upload','webhookPost','update','delete','exports','multer','util','path','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','replace'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x0b69,0xe5));var _0x90b6=function(_0xd6c2c9,_0x5a0c76){_0xd6c2c9=_0xd6c2c9-0x0;var _0x3a8f1f=_0x0b69[_0xd6c2c9];return _0x3a8f1f;};'use strict';var multer=require(_0x90b6('0x0'));var util=require(_0x90b6('0x1'));var path=require(_0x90b6('0x2'));var timeout=require('connect-timeout');var express=require(_0x90b6('0x3'));var router=express['Router']();var auth=require(_0x90b6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x90b6('0x5'));var controller=require('./plugin.controller');router['get']('/',auth[_0x90b6('0x6')](),controller[_0x90b6('0x7')]);router[_0x90b6('0x8')](_0x90b6('0x9'),controller[_0x90b6('0xa')]);router['get'](_0x90b6('0xb'),auth[_0x90b6('0x6')](),controller[_0x90b6('0xc')]);router[_0x90b6('0x8')]('/:id/download',auth[_0x90b6('0x6')](),controller[_0x90b6('0xd')]);var upload=multer({'storage':multer[_0x90b6('0xe')]({'destination':function(_0x3388d1,_0xd0132d,_0x2405d5){_0x2405d5(null,path[_0x90b6('0xf')](config[_0x90b6('0x10')],_0x90b6('0x11')));},'filename':function(_0x3cd63b,_0x4a0b8b,_0x13adb5){_0x4a0b8b['originalname']=_0x4a0b8b['originalname'][_0x90b6('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13adb5(null,util[_0x90b6('0x13')]('%s-%s%s',path[_0x90b6('0x14')](_0x4a0b8b[_0x90b6('0x15')],path[_0x90b6('0x16')](_0x4a0b8b[_0x90b6('0x15')])),Date['now'](),path[_0x90b6('0x16')](_0x4a0b8b[_0x90b6('0x15')])));}})});router[_0x90b6('0x17')]('/',upload[_0x90b6('0x18')](_0x90b6('0x19')),controller[_0x90b6('0x1a')]);router[_0x90b6('0x17')]('/webhook',controller[_0x90b6('0x1b')]);router['put'](_0x90b6('0xb'),auth[_0x90b6('0x6')](),controller[_0x90b6('0x1c')]);router[_0x90b6('0x1d')](_0x90b6('0xb'),auth[_0x90b6('0x6')](),controller[_0x90b6('0x1d')]);module[_0x90b6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1a15abc..70ab815 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 _0x7777=['sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x7777,0x9c));var _0x7777=function(_0x25f334,_0x44aab9){_0x25f334=_0x25f334-0x0;var _0x11fb6e=_0x7777[_0x25f334];return _0x11fb6e;};'use strict';var Sequelize=require(_0x7777('0x0'));module[_0x7777('0x1')]={'name':{'type':Sequelize[_0x7777('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7777('0x3'),_0x7777('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7777('0x5')]},'path':{'type':Sequelize[_0x7777('0x2')],'comment':_0x7777('0x6')},'active':{'type':Sequelize[_0x7777('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x7777('0x8'),_0x7777('0x9'),_0x7777('0xa'),_0x7777('0xb')),'defaultValue':'always','comment':_0x7777('0xc')},'icon':{'type':Sequelize[_0x7777('0x2')]},'adminUrl':{'type':Sequelize[_0x7777('0x2')]},'agentUrl':{'type':Sequelize[_0x7777('0x2')]},'scriptName':{'type':Sequelize[_0x7777('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6b2=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0xb6b2,0x1ca));var _0x2b6b=function(_0x2db332,_0x3c827d){_0x2db332=_0x2db332-0x0;var _0x277bd2=_0xb6b2[_0x2db332];return _0x277bd2;};'use strict';var Sequelize=require(_0x2b6b('0x0'));module[_0x2b6b('0x1')]={'name':{'type':Sequelize[_0x2b6b('0x2')]},'type':{'type':Sequelize[_0x2b6b('0x3')](_0x2b6b('0x4'),_0x2b6b('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x2b6b('0x6')]},'path':{'type':Sequelize[_0x2b6b('0x2')],'comment':_0x2b6b('0x7')},'active':{'type':Sequelize[_0x2b6b('0x8')],'defaultValue':0x0,'comment':_0x2b6b('0x9')},'sidebar':{'type':Sequelize[_0x2b6b('0x3')](_0x2b6b('0xa'),_0x2b6b('0xb'),_0x2b6b('0xc'),_0x2b6b('0xd')),'defaultValue':'always','comment':_0x2b6b('0xe')},'icon':{'type':Sequelize[_0x2b6b('0x2')]},'adminUrl':{'type':Sequelize[_0x2b6b('0x2')]},'agentUrl':{'type':Sequelize[_0x2b6b('0x2')]},'scriptName':{'type':Sequelize[_0x2b6b('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 259bbb6..9dd57fe 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 _0x8ed2=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','merge','options','Plugin','count','include','findAll','catch','keys','find','path','root','format','%s.zip','basename','zip','ENOENT','error','Sequelize','Error','pipe','glob','join','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Plugins','userProfileId','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','params','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','save','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x8ed2,0x10d));var _0x28ed=function(_0x2efb55,_0x3b549c){_0x2efb55=_0x2efb55-0x0;var _0x2bcebc=_0x8ed2[_0x2efb55];return _0x2bcebc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28ed('0x0'));var rimraf=require(_0x28ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x28ed('0x3'));var Mustache=require(_0x28ed('0x4'));var util=require(_0x28ed('0x5'));var path=require('path');var sox=require(_0x28ed('0x6'));var csv=require(_0x28ed('0x7'));var ejs=require(_0x28ed('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x28ed('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x28ed('0xa'));var toCsv=require(_0x28ed('0x7'));var querystring=require('querystring');var Papa=require(_0x28ed('0xb'));var extract=require(_0x28ed('0xc'));var rimraf=require('rimraf');var archiver=require(_0x28ed('0xd'));var Redis=require(_0x28ed('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x28ed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28ed('0x10'));var logger=require(_0x28ed('0x11'))(_0x28ed('0x12'));var utils=require('../../config/utils');var config=require(_0x28ed('0x13'));var licenseUtil=require(_0x28ed('0x14'));var db=require(_0x28ed('0x15'))['db'];config[_0x28ed('0x16')]=_[_0x28ed('0x17')](config[_0x28ed('0x16')],{'host':_0x28ed('0x18'),'port':0x18eb});var socket=require(_0x28ed('0x19'))(new Redis(config['redis']));require('./plugin.socket')[_0x28ed('0x1a')](socket);function respondWithStatusCode(_0x359a24,_0x8e4912){_0x8e4912=_0x8e4912||0xcc;return function(_0x4cf9a4){if(_0x4cf9a4){return _0x359a24[_0x28ed('0x1b')](_0x8e4912);}return _0x359a24[_0x28ed('0x1c')](_0x8e4912)['end']();};}function respondWithResult(_0xf012ca,_0x2a8957){_0x2a8957=_0x2a8957||0xc8;return function(_0x4ee0de){if(_0x4ee0de){return _0xf012ca[_0x28ed('0x1c')](_0x2a8957)[_0x28ed('0x1d')](_0x4ee0de);}};}function respondWithFilteredResult(_0x392c6b,_0xfc4883){return function(_0x3b8843){if(_0x3b8843){var _0x763b6e=_0x3b8843['count'],_0x19b12c=_0xfc4883[_0x28ed('0x1e')],_0x4bd332=_0xfc4883[_0x28ed('0x1e')]+_0xfc4883[_0x28ed('0x1f')],_0x38ac5c;if(_0x4bd332>=_0x763b6e){_0x4bd332=_0x763b6e;_0x38ac5c=0xc8;}else{_0x38ac5c=0xce;}_0x392c6b[_0x28ed('0x1c')](_0x38ac5c);return _0x392c6b[_0x28ed('0x20')]('Content-Range',_0x19b12c+'-'+_0x4bd332+'/'+_0x763b6e)[_0x28ed('0x1d')](_0x3b8843);}return null;};}function patchUpdates(_0xc22ac1){return function(_0x1bced9){try{jsonpatch['apply'](_0x1bced9,_0xc22ac1,!![]);}catch(_0x274199){return BPromise['reject'](_0x274199);}return _0x1bced9[_0x28ed('0x21')]();};}function saveUpdates(_0x18c684,_0x104eb4){return function(_0x5e66b1){if(_0x5e66b1){return _0x5e66b1['update'](_0x18c684)[_0x28ed('0x22')](function(_0x2dbdac){return _0x2dbdac;});}return null;};}function removeEntity(_0x16d53b,_0xb290b6){return function(_0x220871){if(_0x220871){return _0x220871['destroy']()[_0x28ed('0x22')](function(){var _0x49ae55=_0x220871[_0x28ed('0x23')]({'plain':!![]});var _0x599dcf='Plugins';return db[_0x28ed('0x24')][_0x28ed('0x25')]({'where':{'type':_0x599dcf,'resourceId':_0x49ae55['id']}})['then'](function(){return _0x220871;});})[_0x28ed('0x22')](function(){_0x16d53b['status'](0xcc)[_0x28ed('0x26')]();});}};}function handleEntityNotFound(_0x3341c1,_0x3e787d){return function(_0x293a6c){if(!_0x293a6c){_0x3341c1['sendStatus'](0x194);}return _0x293a6c;};}function handleError(_0x4db8d6,_0x47f758){_0x47f758=_0x47f758||0x1f4;return function(_0x3b55ac){logger['error'](_0x3b55ac[_0x28ed('0x27')]);if(_0x3b55ac[_0x28ed('0x28')]){delete _0x3b55ac['name'];}_0x4db8d6[_0x28ed('0x1c')](_0x47f758)[_0x28ed('0x29')](_0x3b55ac);};}exports[_0x28ed('0x2a')]=function(_0x14bb6e,_0x19b52a){var _0x4cbf4f={},_0x2522e5={},_0x40547b={'count':0x0,'rows':[]};var _0x485779=_[_0x28ed('0x2b')](db['Plugin'][_0x28ed('0x2c')],function(_0x364df9){return{'name':_0x364df9[_0x28ed('0x2d')],'type':_0x364df9['type'][_0x28ed('0x2e')]};});_0x2522e5[_0x28ed('0x2f')]=_[_0x28ed('0x2b')](_0x485779,_0x28ed('0x28'));_0x2522e5['query']=_['keys'](_0x14bb6e[_0x28ed('0x30')]);_0x2522e5['filters']=_[_0x28ed('0x31')](_0x2522e5['model'],_0x2522e5['query']);_0x4cbf4f['attributes']=_[_0x28ed('0x31')](_0x2522e5[_0x28ed('0x2f')],qs[_0x28ed('0x32')](_0x14bb6e[_0x28ed('0x30')][_0x28ed('0x32')]));_0x4cbf4f[_0x28ed('0x33')]=_0x4cbf4f['attributes'][_0x28ed('0x34')]?_0x4cbf4f[_0x28ed('0x33')]:_0x2522e5['model'];if(!_0x14bb6e[_0x28ed('0x30')][_0x28ed('0x35')](_0x28ed('0x36'))){_0x4cbf4f[_0x28ed('0x1f')]=qs[_0x28ed('0x1f')](_0x14bb6e[_0x28ed('0x30')][_0x28ed('0x1f')]);_0x4cbf4f['offset']=qs[_0x28ed('0x1e')](_0x14bb6e[_0x28ed('0x30')][_0x28ed('0x1e')]);}_0x4cbf4f[_0x28ed('0x37')]=qs[_0x28ed('0x38')](_0x14bb6e[_0x28ed('0x30')][_0x28ed('0x38')]);_0x4cbf4f[_0x28ed('0x39')]=qs[_0x28ed('0x3a')](_[_0x28ed('0x3b')](_0x14bb6e['query'],_0x2522e5[_0x28ed('0x3a')]),_0x485779);if(_0x14bb6e[_0x28ed('0x30')]['filter']){_0x4cbf4f[_0x28ed('0x39')]=_['merge'](_0x4cbf4f[_0x28ed('0x39')],{'$or':_['map'](_0x485779,function(_0x48313a){if(_0x48313a[_0x28ed('0x3c')]!=='VIRTUAL'){var _0x572f34={};_0x572f34[_0x48313a[_0x28ed('0x28')]]={'$like':'%'+_0x14bb6e[_0x28ed('0x30')]['filter']+'%'};return _0x572f34;}})});}_0x4cbf4f=_[_0x28ed('0x3d')]({},_0x4cbf4f,_0x14bb6e[_0x28ed('0x3e')]);var _0x41e8d3={'where':_0x4cbf4f[_0x28ed('0x39')]};return db[_0x28ed('0x3f')]['count'](_0x41e8d3)['then'](function(_0x4c46ea){_0x40547b[_0x28ed('0x40')]=_0x4c46ea;if(_0x14bb6e[_0x28ed('0x30')]['includeAll']){_0x4cbf4f[_0x28ed('0x41')]=[{'all':!![]}];}return db[_0x28ed('0x3f')][_0x28ed('0x42')](_0x4cbf4f);})[_0x28ed('0x22')](function(_0x21cda5){_0x40547b['rows']=_0x21cda5;return _0x40547b;})[_0x28ed('0x22')](respondWithFilteredResult(_0x19b52a,_0x4cbf4f))[_0x28ed('0x43')](handleError(_0x19b52a,null));};exports['show']=function(_0x163d6f,_0x28462a){var _0x2664b9={'raw':!![],'where':{'id':_0x163d6f['params']['id']}},_0x212c60={};_0x212c60[_0x28ed('0x2f')]=_[_0x28ed('0x44')](db[_0x28ed('0x3f')][_0x28ed('0x2c')]);_0x212c60['query']=_[_0x28ed('0x44')](_0x163d6f['query']);_0x212c60['filters']=_[_0x28ed('0x31')](_0x212c60[_0x28ed('0x2f')],_0x212c60['query']);_0x2664b9[_0x28ed('0x33')]=_[_0x28ed('0x31')](_0x212c60[_0x28ed('0x2f')],qs[_0x28ed('0x32')](_0x163d6f[_0x28ed('0x30')][_0x28ed('0x32')]));_0x2664b9[_0x28ed('0x33')]=_0x2664b9[_0x28ed('0x33')][_0x28ed('0x34')]?_0x2664b9['attributes']:_0x212c60[_0x28ed('0x2f')];if(_0x163d6f[_0x28ed('0x30')]['includeAll']){_0x2664b9[_0x28ed('0x41')]=[{'all':!![]}];}_0x2664b9=_[_0x28ed('0x3d')]({},_0x2664b9,_0x163d6f[_0x28ed('0x3e')]);return db[_0x28ed('0x3f')]['find'](_0x2664b9)[_0x28ed('0x22')](handleEntityNotFound(_0x28462a,null))[_0x28ed('0x22')](respondWithResult(_0x28462a,null))[_0x28ed('0x43')](handleError(_0x28462a,null));};exports['download']=function(_0x1767ef,_0x31a068,_0x3e2b0c){return db[_0x28ed('0x3f')][_0x28ed('0x45')]({'where':{'id':_0x1767ef['params']['id']},'attributes':[_0x28ed('0x28'),_0x28ed('0x46')],'raw':!![]})[_0x28ed('0x22')](handleEntityNotFound(_0x31a068,null))[_0x28ed('0x22')](function(_0x190770){if(_0x190770){var _0x44ea69=path['join'](config[_0x28ed('0x47')],'server/files/plugins',util[_0x28ed('0x48')](_0x28ed('0x49'),path[_0x28ed('0x4a')](_0x190770['path'])));var _0x1405a7=fs['createWriteStream'](_0x44ea69);var _0x13807d=archiver(_0x28ed('0x4b'),{'zlib':{'level':0x9}});_0x13807d['on']('warning',function(_0x40dff4){if(_0x40dff4['code']===_0x28ed('0x4c')){logger[_0x28ed('0x4d')](_0x40dff4);}else{throw new db[(_0x28ed('0x4e'))][(_0x28ed('0x4f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x13807d['on'](_0x28ed('0x4d'),function(_0x8c5d17){throw new db[(_0x28ed('0x4e'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x13807d[_0x28ed('0x50')](_0x1405a7);_0x13807d[_0x28ed('0x51')]('**/*',{'cwd':path[_0x28ed('0x52')](config[_0x28ed('0x47')],_0x28ed('0x53'),path[_0x28ed('0x54')](_0x190770[_0x28ed('0x46')])),'ignore':[path[_0x28ed('0x52')](path[_0x28ed('0x4a')](_0x190770[_0x28ed('0x46')]),'node_modules/**/*'),path[_0x28ed('0x52')](path['basename'](_0x190770[_0x28ed('0x46')]),_0x28ed('0x55'))],'nodir':!![]})[_0x28ed('0x56')]();_0x1405a7['on'](_0x28ed('0x57'),function(){if(!fs[_0x28ed('0x58')](_0x44ea69)){throw new db[(_0x28ed('0x4e'))][(_0x28ed('0x4f'))](_0x28ed('0x59'));}return _0x31a068[_0x28ed('0x5a')](_0x44ea69,util['format']('%s.zip',path['basename'](_0x190770[_0x28ed('0x46')])),function(_0x2991a9){if(_0x2991a9){throw new db[(_0x28ed('0x4e'))][(_0x28ed('0x4f'))](_0x28ed('0x5b'));}fs[_0x28ed('0x5c')](_0x44ea69);logger[_0x28ed('0x5d')](_0x28ed('0x5e'));logger['info'](_0x28ed('0x5f'));});});}return null;})[_0x28ed('0x43')](handleError(_0x31a068,null));};exports[_0x28ed('0x60')]=function(_0x45cd29,_0x2bbd43,_0x36603f){var _0x20fad8=path[_0x28ed('0x4a')](_0x45cd29[_0x28ed('0x61')][_0x28ed('0x62')],path['extname'](_0x45cd29[_0x28ed('0x61')][_0x28ed('0x62')]));var _0x546fec=path[_0x28ed('0x52')](config['root'],_0x28ed('0x53'),_0x45cd29[_0x28ed('0x61')][_0x28ed('0x62')]);var _0x49977f=path[_0x28ed('0x52')](config[_0x28ed('0x47')],'server/files/plugins',_0x20fad8);logger[_0x28ed('0x5d')](_0x28ed('0x63'),_0x546fec);logger[_0x28ed('0x5d')](_0x28ed('0x64'),_0x49977f);try{fs['chmodSync'](_0x546fec,parseInt(_0x28ed('0x65'),0x8));extract(_0x546fec,{'dir':_0x49977f},function(_0x25e08c){if(_0x25e08c){logger[_0x28ed('0x4d')](_0x25e08c);handleError(_0x25e08c,!![]);};var _0x4a4a34=fs[_0x28ed('0x66')](_0x49977f);if(_0x4a4a34[_0x28ed('0x34')]>0x1){removeReferences(_0x546fec,_0x49977f);logger[_0x28ed('0x4d')]('Invalid\x20plugin\x20structure');return _0x36603f(new Error(_0x28ed('0x67')));}var _0x4c4e1a=fs[_0x28ed('0x68')](path[_0x28ed('0x52')](_0x49977f,_0x4a4a34[0x0]));if(_0x4c4e1a[_0x28ed('0x69')]()){removeReferences(_0x546fec,_0x49977f);logger['error'](_0x28ed('0x67'));return _0x36603f(new Error(_0x28ed('0x67')));}if(_0x4c4e1a[_0x28ed('0x6a')]()){var _0x10f41c=fs[_0x28ed('0x66')](path[_0x28ed('0x52')](_0x49977f,_0x4a4a34[0x0]));if(_0x10f41c[_0x28ed('0x34')]===0x0){removeReferences(_0x546fec,_0x49977f);logger[_0x28ed('0x4d')](_0x28ed('0x67'));return _0x36603f(new Error(_0x28ed('0x67')));}var _0x28fcd8=_0x10f41c['some'](function(_0x537870){return _0x537870==='manifest.json';});if(!_0x28fcd8){return _0x36603f(new Error(_0x28ed('0x6b')));}var _0x15490b=fs['readFileSync'](path[_0x28ed('0x52')](_0x49977f,_0x4a4a34[0x0],'manifest.json'));var _0x31ed08=JSON[_0x28ed('0x6c')](_0x15490b);if('undefined'==typeof _0x31ed08[_0x28ed('0x28')]){return _0x36603f(new Error(_0x28ed('0x6d')));}if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x3c')]){return _0x36603f(new Error(_0x28ed('0x6f')));}if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x70')]){return _0x36603f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x71')]){return _0x36603f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x31ed08[_0x28ed('0x3c')]===_0x28ed('0x72')){if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x71')]['views']){return _0x36603f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')][_0x28ed('0x74')]&&_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')][_0x28ed('0x75')]){return _0x36603f(new Error(_0x28ed('0x76')));}}else if(_0x31ed08[_0x28ed('0x3c')]===_0x28ed('0x77')){if(_0x28ed('0x6e')==typeof _0x31ed08['parameters'][_0x28ed('0x78')]){return _0x36603f(new Error(_0x28ed('0x79')));}if(_0x28ed('0x6e')==typeof _0x31ed08[_0x28ed('0x71')][_0x28ed('0x7a')]){return _0x36603f(new Error(_0x28ed('0x7b')));}}else{return _0x36603f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2635af=_0x31ed08[_0x28ed('0x28')];var _0x2566f0=_0x31ed08[_0x28ed('0x7c')];var _0x18fcf0=_0x31ed08[_0x28ed('0x3c')];var _0x40385d=_0x31ed08[_0x28ed('0x7d')]?_0x31ed08[_0x28ed('0x7d')]:_0x28ed('0x7e');var _0x5d2808=_0x31ed08[_0x28ed('0x7f')]?_0x31ed08[_0x28ed('0x7f')]:_0x28ed('0x80');var _0x20d7ca='';var _0x3c9deb='';var _0x9e565e='';var _0x4832b6='';var _0x1d3a5b=_0x31ed08[_0x28ed('0x70')];if(_0x18fcf0===_0x28ed('0x72')){if(_0x28ed('0x6e')!=typeof _0x31ed08['parameters'][_0x28ed('0x73')][_0x28ed('0x74')]){var _0x8ad9b1=_0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')][_0x28ed('0x74')];if(!/^(f|ht)tps?:\/\//i[_0x28ed('0x81')](_0x8ad9b1)){_0x20d7ca=path[_0x28ed('0x52')](_0x28ed('0x82'),_0x20fad8,_0x4a4a34[0x0],_0x8ad9b1);}else{_0x20d7ca=_0x8ad9b1;}}else{logger[_0x28ed('0x5d')](_0x28ed('0x83'));}if(_0x28ed('0x6e')!=typeof _0x31ed08['parameters'][_0x28ed('0x73')]['agent']){var _0x174120=_0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x174120)){_0x3c9deb=path[_0x28ed('0x52')](_0x28ed('0x82'),_0x20fad8,_0x4a4a34[0x0],_0x174120);}else{_0x3c9deb=_0x174120;}}else{logger['info'](_0x28ed('0x84'));}}else if(_0x18fcf0===_0x28ed('0x77')){_0x9e565e=_0x31ed08[_0x28ed('0x71')][_0x28ed('0x78')];_0x4832b6=_0x31ed08[_0x28ed('0x71')][_0x28ed('0x7a')];if(_0x28ed('0x6e')!=typeof _0x31ed08[_0x28ed('0x71')]['views']){if(_0x28ed('0x6e')!=typeof _0x31ed08['parameters'][_0x28ed('0x73')][_0x28ed('0x74')]){var _0x8ad9b1=_0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x8ad9b1)){_0x20d7ca=path[_0x28ed('0x52')](_0x28ed('0x82'),_0x20fad8,_0x4a4a34[0x0],_0x8ad9b1);}else{_0x20d7ca=_0x8ad9b1;}}if(_0x28ed('0x6e')!=typeof _0x31ed08[_0x28ed('0x71')][_0x28ed('0x73')]['agent']){var _0x174120=_0x31ed08['parameters'][_0x28ed('0x73')][_0x28ed('0x75')];if(!/^(f|ht)tps?:\/\//i['test'](_0x174120)){_0x3c9deb=path['join'](_0x28ed('0x82'),_0x20fad8,_0x4a4a34[0x0],_0x174120);}else{_0x3c9deb=_0x174120;}}}}var _0x28f455={'name':_0x2635af,'description':_0x2566f0,'path':path['join'](_0x20fad8,_0x4a4a34[0x0]),'type':_0x18fcf0,'sidebar':_0x40385d,'icon':_0x5d2808,'adminUrl':_0x20d7ca,'agentUrl':_0x3c9deb,'scriptName':_0x9e565e,'scriptPath':_0x4832b6,'version':_0x1d3a5b};removeReferences(_0x546fec,null);return db['Plugin'][_0x28ed('0x85')](_0x28f455)['then'](function(_0x1d98c3){var _0xbbc078={'role':_0x45cd29[_0x28ed('0x86')]['role'],'userProfileId':_0x45cd29[_0x28ed('0x86')]['userProfileId']};if(!_0xbbc078)throw new Error(_0x28ed('0x87'));if(_0xbbc078[_0x28ed('0x88')]==='user'){var _0x1c9a89=_0x1d98c3[_0x28ed('0x23')]({'plain':!![]});return db[_0x28ed('0x89')]['find']({'where':{'name':_0x28ed('0x8a'),'userProfileId':_0xbbc078[_0x28ed('0x8b')]},'raw':!![]})[_0x28ed('0x22')](function(_0x4ca1b3){if(_0x4ca1b3&&_0x4ca1b3[_0x28ed('0x8c')]===0x0){return db[_0x28ed('0x24')][_0x28ed('0x85')]({'name':_0x1c9a89[_0x28ed('0x28')],'resourceId':_0x1c9a89['id'],'type':_0x4ca1b3[_0x28ed('0x28')],'sectionId':_0x4ca1b3['id']},{})[_0x28ed('0x22')](function(){return _0x1d98c3;});}else{return _0x1d98c3;}})[_0x28ed('0x43')](function(_0x2e563a){logger[_0x28ed('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e563a);throw _0x2e563a;});}return _0x1d98c3;})[_0x28ed('0x22')](respondWithResult(_0x2bbd43,null))[_0x28ed('0x43')](handleError(_0x2bbd43,null));}});}catch(_0x3a5ec0){_0x2bbd43[_0x28ed('0x1c')](0x1f4)[_0x28ed('0x29')](_0x3a5ec0);}};function removeReferences(_0x58827e,_0x2dd4fe){try{if(_0x58827e){fs[_0x28ed('0x5c')](_0x58827e);logger[_0x28ed('0x5d')](_0x28ed('0x8d'));}if(_0x2dd4fe){rimraf(_0x2dd4fe,function(){});logger[_0x28ed('0x5d')](_0x28ed('0x8e'));}}catch(_0x439ccd){logger[_0x28ed('0x4d')](_0x439ccd);}}exports[_0x28ed('0x8f')]=function(_0x5a8c1d,_0x379599,_0x1ef7a1){return db['Plugin']['find']({'where':{'id':_0x5a8c1d['params']['id']}})[_0x28ed('0x22')](handleEntityNotFound(_0x379599,null))[_0x28ed('0x22')](saveUpdates(_0x5a8c1d[_0x28ed('0x86')],null))[_0x28ed('0x22')](respondWithResult(_0x379599,null))[_0x28ed('0x43')](handleError(_0x379599,null));};exports['delete']=function(_0x39548c,_0x3c37cb,_0x3489e9){return db[_0x28ed('0x3f')][_0x28ed('0x45')]({'where':{'id':_0x39548c[_0x28ed('0x90')]['id']}})[_0x28ed('0x22')](function(_0x2e1a87){if(_0x2e1a87){return _0x2e1a87[_0x28ed('0x25')]();}})[_0x28ed('0x22')](function(_0x58d5d3){rimraf(path['join'](config[_0x28ed('0x47')],_0x28ed('0x53'),path[_0x28ed('0x54')](_0x58d5d3[_0x28ed('0x46')])),function(){});return _0x58d5d3;})[_0x28ed('0x22')](handleEntityNotFound(_0x3c37cb,null))[_0x28ed('0x22')](respondWithStatusCode(_0x3c37cb,null))[_0x28ed('0x43')](handleError(_0x3c37cb,null));};exports['webhookGet']=function(_0x5b6a35,_0x4a83,_0x3e95c5){return BPromise[_0x28ed('0x91')]()[_0x28ed('0x22')](function(){if(!_0x5b6a35[_0x28ed('0x30')]['path']){throw new Error(_0x28ed('0x92'));}if(!_0x5b6a35['query'][_0x28ed('0x93')]){throw new Error(_0x28ed('0x94'));}var _0x5e2f11=_0x5b6a35['query'][_0x28ed('0x95')]?_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x95')]+':'+_0x5b6a35['query']['port']:_0x28ed('0x96')+_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x93')];var _0xcfdffd=_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x1d')]?_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x1d')]:!![];var _0x185c8e=_0x5b6a35[_0x28ed('0x30')]['encoding']?_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x97')]:null;var _0x2a783a={'method':_0x5b6a35[_0x28ed('0x98')],'uri':util[_0x28ed('0x48')](_0x28ed('0x99'),_0x5e2f11,_0x5b6a35[_0x28ed('0x30')][_0x28ed('0x46')]),'json':_0xcfdffd,'resolveWithFullResponse':!![],'encoding':_0x185c8e,'qs':_0x5b6a35[_0x28ed('0x30')]};if(_0x5b6a35[_0x28ed('0x9a')]){_0x2a783a[_0x28ed('0x9a')]=_0x5b6a35[_0x28ed('0x9a')];if(_0x2a783a[_0x28ed('0x9a')][_0x28ed('0x9b')]){delete _0x2a783a[_0x28ed('0x9a')][_0x28ed('0x9b')];}}if(_0x2a783a[_0x28ed('0x9a')][_0x28ed('0x9c')]){delete _0x2a783a['headers'][_0x28ed('0x9c')];}return rp(_0x2a783a);})['then'](function(_0x3cd931){if(_0x3cd931){_0x4a83[_0x28ed('0x20')](_0x3cd931['headers']);logger[_0x28ed('0x5d')](_0x3cd931[_0x28ed('0x86')]);if(_['endsWith'](_0x5b6a35[_0x28ed('0x30')]['path'],_0x28ed('0x5a'))&&_0x3cd931[_0x28ed('0x9d')]==0x1f4){return _0x4a83['sendStatus'](_0x3cd931[_0x28ed('0x9d')]);}else{return _0x4a83[_0x28ed('0x1c')](_0x3cd931[_0x28ed('0x9d')])[_0x28ed('0x29')](_0x3cd931['body']);}}else{return _0x4a83[_0x28ed('0x1b')](0xc8);}})['catch'](handleError(_0x4a83,null));};exports[_0x28ed('0x9e')]=function(_0x5e230d,_0x496f2e,_0x30b551){return BPromise['resolve']()['then'](function(){if(!_0x5e230d['query']['path']){throw new Error(_0x28ed('0x92'));}if(!_0x5e230d[_0x28ed('0x30')]['port']){throw new Error(_0x28ed('0x94'));}var _0x549be7=_0x5e230d['query'][_0x28ed('0x95')]?_0x5e230d[_0x28ed('0x30')]['hostname']+':'+_0x5e230d['query'][_0x28ed('0x93')]:_0x28ed('0x96')+_0x5e230d[_0x28ed('0x30')]['port'];var _0x26e613=_0x5e230d['query']['json']?_0x5e230d['query'][_0x28ed('0x1d')]:!![];var _0x2d8e08=_0x5e230d[_0x28ed('0x30')][_0x28ed('0x97')]?_0x5e230d[_0x28ed('0x30')]['encoding']:null;var _0x1fe13c={'method':_0x5e230d['method'],'uri':util[_0x28ed('0x48')](_0x28ed('0x99'),_0x549be7,_0x5e230d['query'][_0x28ed('0x46')]),'json':_0x26e613,'resolveWithFullResponse':!![],'encoding':_0x2d8e08,'body':_0x5e230d[_0x28ed('0x86')]};if(_0x5e230d[_0x28ed('0x9a')]){_0x1fe13c[_0x28ed('0x9a')]=_0x5e230d['headers'];if(_0x1fe13c['headers'][_0x28ed('0x9b')]){delete _0x1fe13c['headers'][_0x28ed('0x9b')];}}if(_0x1fe13c[_0x28ed('0x9a')][_0x28ed('0x9c')]){delete _0x1fe13c[_0x28ed('0x9a')]['content-type'];}return rp(_0x1fe13c);})[_0x28ed('0x22')](function(_0x515e5e){if(_0x515e5e){_0x496f2e[_0x28ed('0x20')](_0x515e5e[_0x28ed('0x9a')]);logger['info'](_0x515e5e[_0x28ed('0x86')]);return _0x496f2e[_0x28ed('0x1c')](_0x515e5e[_0x28ed('0x9d')])[_0x28ed('0x29')](_0x515e5e[_0x28ed('0x86')]);}else{return _0x496f2e['sendStatus'](0xc8);}})[_0x28ed('0x43')](handleError(_0x496f2e,null));}; \ No newline at end of file +var _0xc65b=['update','destroy','get','Plugins','UserProfileResource','then','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./plugin.socket','register','end','status','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xc65b,0x1da));var _0xbc65=function(_0x247405,_0x390f4e){_0x247405=_0x247405-0x0;var _0x52404f=_0xc65b[_0x247405];return _0x52404f;};'use strict';var pdf=require(_0xbc65('0x0'));var emlformat=require(_0xbc65('0x1'));var rimraf=require(_0xbc65('0x2'));var zipdir=require(_0xbc65('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc65('0x4'));var moment=require('moment');var BPromise=require(_0xbc65('0x5'));var Mustache=require(_0xbc65('0x6'));var util=require(_0xbc65('0x7'));var path=require(_0xbc65('0x8'));var sox=require(_0xbc65('0x9'));var csv=require(_0xbc65('0xa'));var ejs=require(_0xbc65('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc65('0xc'));var jsforce=require(_0xbc65('0xd'));var deskjs=require(_0xbc65('0xe'));var toCsv=require(_0xbc65('0xa'));var querystring=require(_0xbc65('0xf'));var Papa=require(_0xbc65('0x10'));var extract=require(_0xbc65('0x11'));var rimraf=require(_0xbc65('0x2'));var archiver=require(_0xbc65('0x12'));var Redis=require('ioredis');var authService=require(_0xbc65('0x13'));var qs=require(_0xbc65('0x14'));var as=require(_0xbc65('0x15'));var hardwareService=require(_0xbc65('0x16'));var logger=require(_0xbc65('0x17'))(_0xbc65('0x18'));var utils=require(_0xbc65('0x19'));var config=require(_0xbc65('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbc65('0x1b')](config[_0xbc65('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc65('0x1d'))(new Redis(config[_0xbc65('0x1c')]));require(_0xbc65('0x1e'))[_0xbc65('0x1f')](socket);function respondWithStatusCode(_0x2d4b76,_0x2a31ce){_0x2a31ce=_0x2a31ce||0xcc;return function(_0x1e6842){if(_0x1e6842){return _0x2d4b76['sendStatus'](_0x2a31ce);}return _0x2d4b76['status'](_0x2a31ce)[_0xbc65('0x20')]();};}function respondWithResult(_0x1d4da2,_0x1a5e07){_0x1a5e07=_0x1a5e07||0xc8;return function(_0x1cb3ac){if(_0x1cb3ac){return _0x1d4da2[_0xbc65('0x21')](_0x1a5e07)[_0xbc65('0x22')](_0x1cb3ac);}};}function respondWithFilteredResult(_0x5ed3ad,_0x52f6ba){return function(_0x5a81a8){if(_0x5a81a8){var _0x57e4cf=_0x5a81a8['count'],_0x36bb59=_0x52f6ba[_0xbc65('0x23')],_0x2b3e20=_0x52f6ba[_0xbc65('0x23')]+_0x52f6ba[_0xbc65('0x24')],_0x46a9d7;if(_0x2b3e20>=_0x57e4cf){_0x2b3e20=_0x57e4cf;_0x46a9d7=0xc8;}else{_0x46a9d7=0xce;}_0x5ed3ad[_0xbc65('0x21')](_0x46a9d7);return _0x5ed3ad[_0xbc65('0x25')](_0xbc65('0x26'),_0x36bb59+'-'+_0x2b3e20+'/'+_0x57e4cf)[_0xbc65('0x22')](_0x5a81a8);}return null;};}function patchUpdates(_0x29783e){return function(_0x48dd36){try{jsonpatch[_0xbc65('0x27')](_0x48dd36,_0x29783e,!![]);}catch(_0x3cb6b9){return BPromise[_0xbc65('0x28')](_0x3cb6b9);}return _0x48dd36[_0xbc65('0x29')]();};}function saveUpdates(_0x271b7a,_0x1de6ef){return function(_0x5e7032){if(_0x5e7032){return _0x5e7032[_0xbc65('0x2a')](_0x271b7a)['then'](function(_0x1af80d){return _0x1af80d;});}return null;};}function removeEntity(_0x2d933a,_0x551917){return function(_0x16cc3f){if(_0x16cc3f){return _0x16cc3f[_0xbc65('0x2b')]()['then'](function(){var _0x90fe35=_0x16cc3f[_0xbc65('0x2c')]({'plain':!![]});var _0x37702e=_0xbc65('0x2d');return db[_0xbc65('0x2e')][_0xbc65('0x2b')]({'where':{'type':_0x37702e,'resourceId':_0x90fe35['id']}})[_0xbc65('0x2f')](function(){return _0x16cc3f;});})[_0xbc65('0x2f')](function(){_0x2d933a[_0xbc65('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153909,_0x165558){return function(_0xf2d1db){if(!_0xf2d1db){_0x153909['sendStatus'](0x194);}return _0xf2d1db;};}function handleError(_0x1d32ea,_0x491ab9){_0x491ab9=_0x491ab9||0x1f4;return function(_0x2ad2c7){logger[_0xbc65('0x30')](_0x2ad2c7[_0xbc65('0x31')]);if(_0x2ad2c7[_0xbc65('0x32')]){delete _0x2ad2c7['name'];}_0x1d32ea[_0xbc65('0x21')](_0x491ab9)[_0xbc65('0x33')](_0x2ad2c7);};}exports[_0xbc65('0x34')]=function(_0x55b761,_0x5d523d){var _0x40243b={},_0x339e29={},_0x4cc14b={'count':0x0,'rows':[]};var _0x125bd3=_[_0xbc65('0x35')](db[_0xbc65('0x36')][_0xbc65('0x37')],function(_0x500ee8){return{'name':_0x500ee8['fieldName'],'type':_0x500ee8[_0xbc65('0x38')][_0xbc65('0x39')]};});_0x339e29[_0xbc65('0x3a')]=_[_0xbc65('0x35')](_0x125bd3,_0xbc65('0x32'));_0x339e29['query']=_[_0xbc65('0x3b')](_0x55b761[_0xbc65('0x3c')]);_0x339e29[_0xbc65('0x3d')]=_['intersection'](_0x339e29[_0xbc65('0x3a')],_0x339e29[_0xbc65('0x3c')]);_0x40243b[_0xbc65('0x3e')]=_[_0xbc65('0x3f')](_0x339e29['model'],qs[_0xbc65('0x40')](_0x55b761[_0xbc65('0x3c')][_0xbc65('0x40')]));_0x40243b[_0xbc65('0x3e')]=_0x40243b['attributes'][_0xbc65('0x41')]?_0x40243b['attributes']:_0x339e29['model'];if(!_0x55b761[_0xbc65('0x3c')][_0xbc65('0x42')](_0xbc65('0x43'))){_0x40243b[_0xbc65('0x24')]=qs[_0xbc65('0x24')](_0x55b761[_0xbc65('0x3c')]['limit']);_0x40243b['offset']=qs[_0xbc65('0x23')](_0x55b761['query'][_0xbc65('0x23')]);}_0x40243b[_0xbc65('0x44')]=qs['sort'](_0x55b761['query'][_0xbc65('0x45')]);_0x40243b[_0xbc65('0x46')]=qs['filters'](_['pick'](_0x55b761[_0xbc65('0x3c')],_0x339e29[_0xbc65('0x3d')]),_0x125bd3);if(_0x55b761[_0xbc65('0x3c')]['filter']){_0x40243b[_0xbc65('0x46')]=_[_0xbc65('0x47')](_0x40243b[_0xbc65('0x46')],{'$or':_[_0xbc65('0x35')](_0x125bd3,function(_0x3ac504){if(_0x3ac504[_0xbc65('0x38')]!==_0xbc65('0x48')){var _0x48c115={};_0x48c115[_0x3ac504[_0xbc65('0x32')]]={'$like':'%'+_0x55b761[_0xbc65('0x3c')][_0xbc65('0x49')]+'%'};return _0x48c115;}})});}_0x40243b=_[_0xbc65('0x47')]({},_0x40243b,_0x55b761[_0xbc65('0x4a')]);var _0x5a2ce0={'where':_0x40243b['where']};return db[_0xbc65('0x36')][_0xbc65('0x4b')](_0x5a2ce0)['then'](function(_0xa0d873){_0x4cc14b[_0xbc65('0x4b')]=_0xa0d873;if(_0x55b761[_0xbc65('0x3c')][_0xbc65('0x4c')]){_0x40243b[_0xbc65('0x4d')]=[{'all':!![]}];}return db[_0xbc65('0x36')][_0xbc65('0x4e')](_0x40243b);})['then'](function(_0x3c7b0a){_0x4cc14b[_0xbc65('0x4f')]=_0x3c7b0a;return _0x4cc14b;})[_0xbc65('0x2f')](respondWithFilteredResult(_0x5d523d,_0x40243b))[_0xbc65('0x50')](handleError(_0x5d523d,null));};exports['show']=function(_0x39084f,_0x3390bf){var _0x44a52f={'raw':!![],'where':{'id':_0x39084f[_0xbc65('0x51')]['id']}},_0x1fc8e6={};_0x1fc8e6['model']=_['keys'](db[_0xbc65('0x36')][_0xbc65('0x37')]);_0x1fc8e6[_0xbc65('0x3c')]=_['keys'](_0x39084f[_0xbc65('0x3c')]);_0x1fc8e6[_0xbc65('0x3d')]=_['intersection'](_0x1fc8e6[_0xbc65('0x3a')],_0x1fc8e6[_0xbc65('0x3c')]);_0x44a52f[_0xbc65('0x3e')]=_[_0xbc65('0x3f')](_0x1fc8e6[_0xbc65('0x3a')],qs[_0xbc65('0x40')](_0x39084f[_0xbc65('0x3c')][_0xbc65('0x40')]));_0x44a52f['attributes']=_0x44a52f[_0xbc65('0x3e')][_0xbc65('0x41')]?_0x44a52f[_0xbc65('0x3e')]:_0x1fc8e6[_0xbc65('0x3a')];if(_0x39084f[_0xbc65('0x3c')][_0xbc65('0x4c')]){_0x44a52f['include']=[{'all':!![]}];}_0x44a52f=_[_0xbc65('0x47')]({},_0x44a52f,_0x39084f[_0xbc65('0x4a')]);return db[_0xbc65('0x36')][_0xbc65('0x52')](_0x44a52f)[_0xbc65('0x2f')](handleEntityNotFound(_0x3390bf,null))['then'](respondWithResult(_0x3390bf,null))[_0xbc65('0x50')](handleError(_0x3390bf,null));};exports[_0xbc65('0x53')]=function(_0x2e7ed1,_0x1ef01a,_0x2d90f8){return db[_0xbc65('0x36')][_0xbc65('0x52')]({'where':{'id':_0x2e7ed1['params']['id']},'attributes':[_0xbc65('0x32'),_0xbc65('0x8')],'raw':!![]})[_0xbc65('0x2f')](handleEntityNotFound(_0x1ef01a,null))['then'](function(_0x13046e){if(_0x13046e){var _0x291863=path[_0xbc65('0x54')](config[_0xbc65('0x55')],_0xbc65('0x56'),util[_0xbc65('0x57')](_0xbc65('0x58'),path[_0xbc65('0x59')](_0x13046e[_0xbc65('0x8')])));var _0x775f3d=fs[_0xbc65('0x5a')](_0x291863);var _0x1df581=archiver(_0xbc65('0x5b'),{'zlib':{'level':0x9}});_0x1df581['on']('warning',function(_0x5256ac){if(_0x5256ac[_0xbc65('0x5c')]===_0xbc65('0x5d')){logger[_0xbc65('0x30')](_0x5256ac);}else{throw new db[(_0xbc65('0x5e'))][(_0xbc65('0x5f'))](_0xbc65('0x60'));}});_0x1df581['on']('error',function(_0x2a7c37){throw new db[(_0xbc65('0x5e'))][(_0xbc65('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1df581['pipe'](_0x775f3d);_0x1df581['glob'](_0xbc65('0x61'),{'cwd':path[_0xbc65('0x54')](config[_0xbc65('0x55')],_0xbc65('0x56'),path[_0xbc65('0x62')](_0x13046e[_0xbc65('0x8')])),'ignore':[path[_0xbc65('0x54')](path[_0xbc65('0x59')](_0x13046e[_0xbc65('0x8')]),_0xbc65('0x63')),path[_0xbc65('0x54')](path[_0xbc65('0x59')](_0x13046e[_0xbc65('0x8')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x775f3d['on'](_0xbc65('0x64'),function(){if(!fs[_0xbc65('0x65')](_0x291863)){throw new db[(_0xbc65('0x5e'))][(_0xbc65('0x5f'))]('Plugin\x20not\x20found');}return _0x1ef01a[_0xbc65('0x53')](_0x291863,util[_0xbc65('0x57')](_0xbc65('0x58'),path[_0xbc65('0x59')](_0x13046e['path'])),function(_0x1aff01){if(_0x1aff01){throw new db[(_0xbc65('0x5e'))][(_0xbc65('0x5f'))](_0xbc65('0x66'));}fs[_0xbc65('0x67')](_0x291863);logger[_0xbc65('0x68')](_0xbc65('0x69'));logger[_0xbc65('0x68')](_0xbc65('0x6a'));});});}return null;})[_0xbc65('0x50')](handleError(_0x1ef01a,null));};exports[_0xbc65('0x6b')]=function(_0xaa671a,_0x2c1f27,_0x4dc7b4){var _0x46c7ab=path['basename'](_0xaa671a[_0xbc65('0x6c')][_0xbc65('0x6d')],path[_0xbc65('0x6e')](_0xaa671a[_0xbc65('0x6c')][_0xbc65('0x6d')]));var _0x45c5f7=path[_0xbc65('0x54')](config[_0xbc65('0x55')],_0xbc65('0x56'),_0xaa671a[_0xbc65('0x6c')][_0xbc65('0x6d')]);var _0xc2f9e4=path[_0xbc65('0x54')](config[_0xbc65('0x55')],_0xbc65('0x56'),_0x46c7ab);logger[_0xbc65('0x68')](_0xbc65('0x6f'),_0x45c5f7);logger[_0xbc65('0x68')](_0xbc65('0x70'),_0xc2f9e4);try{fs['chmodSync'](_0x45c5f7,parseInt(_0xbc65('0x71'),0x8));extract(_0x45c5f7,{'dir':_0xc2f9e4},function(_0x1156dd){if(_0x1156dd){logger['error'](_0x1156dd);handleError(_0x1156dd,!![]);};var _0x5576a2=fs[_0xbc65('0x72')](_0xc2f9e4);if(_0x5576a2[_0xbc65('0x41')]>0x1){removeReferences(_0x45c5f7,_0xc2f9e4);logger[_0xbc65('0x30')](_0xbc65('0x73'));return _0x4dc7b4(new Error(_0xbc65('0x73')));}var _0x2cf32a=fs[_0xbc65('0x74')](path['join'](_0xc2f9e4,_0x5576a2[0x0]));if(_0x2cf32a[_0xbc65('0x75')]()){removeReferences(_0x45c5f7,_0xc2f9e4);logger[_0xbc65('0x30')](_0xbc65('0x73'));return _0x4dc7b4(new Error(_0xbc65('0x73')));}if(_0x2cf32a[_0xbc65('0x76')]()){var _0x51a540=fs['readdirSync'](path[_0xbc65('0x54')](_0xc2f9e4,_0x5576a2[0x0]));if(_0x51a540[_0xbc65('0x41')]===0x0){removeReferences(_0x45c5f7,_0xc2f9e4);logger[_0xbc65('0x30')]('Invalid\x20plugin\x20structure');return _0x4dc7b4(new Error(_0xbc65('0x73')));}var _0x402e50=_0x51a540[_0xbc65('0x77')](function(_0x55fb40){return _0x55fb40===_0xbc65('0x78');});if(!_0x402e50){return _0x4dc7b4(new Error(_0xbc65('0x79')));}var _0x45a760=fs[_0xbc65('0x7a')](path[_0xbc65('0x54')](_0xc2f9e4,_0x5576a2[0x0],_0xbc65('0x78')));var _0x22c005=JSON[_0xbc65('0x7b')](_0x45a760);if(_0xbc65('0x7c')==typeof _0x22c005['name']){return _0x4dc7b4(new Error(_0xbc65('0x7d')));}if('undefined'==typeof _0x22c005[_0xbc65('0x38')]){return _0x4dc7b4(new Error(_0xbc65('0x7e')));}if('undefined'==typeof _0x22c005[_0xbc65('0x7f')]){return _0x4dc7b4(new Error(_0xbc65('0x80')));}if(_0xbc65('0x7c')==typeof _0x22c005[_0xbc65('0x81')]){return _0x4dc7b4(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x22c005[_0xbc65('0x38')]===_0xbc65('0x82')){if('undefined'==typeof _0x22c005[_0xbc65('0x81')][_0xbc65('0x83')]){return _0x4dc7b4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xbc65('0x7c')==typeof _0x22c005['parameters'][_0xbc65('0x83')][_0xbc65('0x84')]&&_0xbc65('0x7c')==typeof _0x22c005['parameters'][_0xbc65('0x83')][_0xbc65('0x85')]){return _0x4dc7b4(new Error(_0xbc65('0x86')));}}else if(_0x22c005[_0xbc65('0x38')]===_0xbc65('0x87')){if(_0xbc65('0x7c')==typeof _0x22c005[_0xbc65('0x81')][_0xbc65('0x88')]){return _0x4dc7b4(new Error(_0xbc65('0x89')));}if(_0xbc65('0x7c')==typeof _0x22c005[_0xbc65('0x81')][_0xbc65('0x8a')]){return _0x4dc7b4(new Error(_0xbc65('0x8b')));}}else{return _0x4dc7b4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x409976=_0x22c005[_0xbc65('0x32')];var _0x1ec982=_0x22c005[_0xbc65('0x8c')];var _0x4cc685=_0x22c005[_0xbc65('0x38')];var _0x271c1d=_0x22c005['sidebar']?_0x22c005[_0xbc65('0x8d')]:_0xbc65('0x8e');var _0xd52177=_0x22c005[_0xbc65('0x8f')]?_0x22c005[_0xbc65('0x8f')]:_0xbc65('0x90');var _0x381af5='';var _0xb7a121='';var _0x503a4f='';var _0x54712c='';var _0x18672b=_0x22c005[_0xbc65('0x7f')];if(_0x4cc685==='html'){if('undefined'!=typeof _0x22c005[_0xbc65('0x81')][_0xbc65('0x83')]['admin']){var _0x537f1c=_0x22c005['parameters'][_0xbc65('0x83')][_0xbc65('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xbc65('0x91')](_0x537f1c)){_0x381af5=path[_0xbc65('0x54')](_0xbc65('0x92'),_0x46c7ab,_0x5576a2[0x0],_0x537f1c);}else{_0x381af5=_0x537f1c;}}else{logger[_0xbc65('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xbc65('0x7c')!=typeof _0x22c005['parameters'][_0xbc65('0x83')][_0xbc65('0x85')]){var _0x2ed1af=_0x22c005[_0xbc65('0x81')][_0xbc65('0x83')][_0xbc65('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xbc65('0x91')](_0x2ed1af)){_0xb7a121=path[_0xbc65('0x54')](_0xbc65('0x92'),_0x46c7ab,_0x5576a2[0x0],_0x2ed1af);}else{_0xb7a121=_0x2ed1af;}}else{logger[_0xbc65('0x68')](_0xbc65('0x93'));}}else if(_0x4cc685===_0xbc65('0x87')){_0x503a4f=_0x22c005['parameters'][_0xbc65('0x88')];_0x54712c=_0x22c005[_0xbc65('0x81')][_0xbc65('0x8a')];if(_0xbc65('0x7c')!=typeof _0x22c005['parameters']['views']){if(_0xbc65('0x7c')!=typeof _0x22c005[_0xbc65('0x81')][_0xbc65('0x83')][_0xbc65('0x84')]){var _0x537f1c=_0x22c005[_0xbc65('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xbc65('0x91')](_0x537f1c)){_0x381af5=path[_0xbc65('0x54')](_0xbc65('0x92'),_0x46c7ab,_0x5576a2[0x0],_0x537f1c);}else{_0x381af5=_0x537f1c;}}if('undefined'!=typeof _0x22c005[_0xbc65('0x81')]['views'][_0xbc65('0x85')]){var _0x2ed1af=_0x22c005[_0xbc65('0x81')][_0xbc65('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbc65('0x91')](_0x2ed1af)){_0xb7a121=path[_0xbc65('0x54')](_0xbc65('0x92'),_0x46c7ab,_0x5576a2[0x0],_0x2ed1af);}else{_0xb7a121=_0x2ed1af;}}}}var _0x3ebda7={'name':_0x409976,'description':_0x1ec982,'path':path[_0xbc65('0x54')](_0x46c7ab,_0x5576a2[0x0]),'type':_0x4cc685,'sidebar':_0x271c1d,'icon':_0xd52177,'adminUrl':_0x381af5,'agentUrl':_0xb7a121,'scriptName':_0x503a4f,'scriptPath':_0x54712c,'version':_0x18672b};removeReferences(_0x45c5f7,null);return db[_0xbc65('0x36')][_0xbc65('0x94')](_0x3ebda7)[_0xbc65('0x2f')](function(_0x57b4b6){var _0x38b453={'role':_0xaa671a[_0xbc65('0x95')][_0xbc65('0x96')],'userProfileId':_0xaa671a['body'][_0xbc65('0x97')]};if(!_0x38b453)throw new Error(_0xbc65('0x98'));if(_0x38b453[_0xbc65('0x96')]==='user'){var _0x42f74a=_0x57b4b6[_0xbc65('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xbc65('0x52')]({'where':{'name':_0xbc65('0x2d'),'userProfileId':_0x38b453[_0xbc65('0x97')]},'raw':!![]})[_0xbc65('0x2f')](function(_0x3977f6){if(_0x3977f6&&_0x3977f6['autoAssociation']===0x0){return db['UserProfileResource'][_0xbc65('0x94')]({'name':_0x42f74a['name'],'resourceId':_0x42f74a['id'],'type':_0x3977f6[_0xbc65('0x32')],'sectionId':_0x3977f6['id']},{})['then'](function(){return _0x57b4b6;});}else{return _0x57b4b6;}})[_0xbc65('0x50')](function(_0x524d1f){logger[_0xbc65('0x30')](_0xbc65('0x99'),_0x524d1f);throw _0x524d1f;});}return _0x57b4b6;})[_0xbc65('0x2f')](respondWithResult(_0x2c1f27,null))[_0xbc65('0x50')](handleError(_0x2c1f27,null));}});}catch(_0x30bede){_0x2c1f27[_0xbc65('0x21')](0x1f4)[_0xbc65('0x33')](_0x30bede);}};function removeReferences(_0x101401,_0x57ec88){try{if(_0x101401){fs['unlinkSync'](_0x101401);logger[_0xbc65('0x68')](_0xbc65('0x9a'));}if(_0x57ec88){rimraf(_0x57ec88,function(){});logger['info'](_0xbc65('0x9b'));}}catch(_0x1bd29c){logger[_0xbc65('0x30')](_0x1bd29c);}}exports[_0xbc65('0x2a')]=function(_0xbf4343,_0x352857,_0x3e56e4){return db[_0xbc65('0x36')][_0xbc65('0x52')]({'where':{'id':_0xbf4343[_0xbc65('0x51')]['id']}})[_0xbc65('0x2f')](handleEntityNotFound(_0x352857,null))[_0xbc65('0x2f')](saveUpdates(_0xbf4343[_0xbc65('0x95')],null))['then'](respondWithResult(_0x352857,null))['catch'](handleError(_0x352857,null));};exports[_0xbc65('0x9c')]=function(_0x34dd3a,_0x52afe3,_0x3eae29){return db[_0xbc65('0x36')][_0xbc65('0x52')]({'where':{'id':_0x34dd3a[_0xbc65('0x51')]['id']}})[_0xbc65('0x2f')](function(_0x2fa070){if(_0x2fa070){return _0x2fa070[_0xbc65('0x2b')]();}})[_0xbc65('0x2f')](function(_0x5f521f){rimraf(path['join'](config[_0xbc65('0x55')],_0xbc65('0x56'),path[_0xbc65('0x62')](_0x5f521f[_0xbc65('0x8')])),function(){});return _0x5f521f;})[_0xbc65('0x2f')](handleEntityNotFound(_0x52afe3,null))[_0xbc65('0x2f')](respondWithStatusCode(_0x52afe3,null))['catch'](handleError(_0x52afe3,null));};exports['webhookGet']=function(_0x5efb0a,_0x51d035,_0x19518f){return BPromise['resolve']()['then'](function(){if(!_0x5efb0a['query'][_0xbc65('0x8')]){throw new Error(_0xbc65('0x9d'));}if(!_0x5efb0a['query'][_0xbc65('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4cdd05=_0x5efb0a[_0xbc65('0x3c')][_0xbc65('0x9f')]?_0x5efb0a[_0xbc65('0x3c')][_0xbc65('0x9f')]+':'+_0x5efb0a[_0xbc65('0x3c')]['port']:_0xbc65('0xa0')+_0x5efb0a[_0xbc65('0x3c')][_0xbc65('0x9e')];var _0x22befe=_0x5efb0a[_0xbc65('0x3c')]['json']?_0x5efb0a['query'][_0xbc65('0x22')]:!![];var _0x531675=_0x5efb0a[_0xbc65('0x3c')]['encoding']?_0x5efb0a['query'][_0xbc65('0xa1')]:null;var _0x286daa={'method':_0x5efb0a['method'],'uri':util[_0xbc65('0x57')](_0xbc65('0xa2'),_0x4cdd05,_0x5efb0a['query'][_0xbc65('0x8')]),'json':_0x22befe,'resolveWithFullResponse':!![],'encoding':_0x531675,'qs':_0x5efb0a['query']};if(_0x5efb0a[_0xbc65('0xa3')]){_0x286daa[_0xbc65('0xa3')]=_0x5efb0a[_0xbc65('0xa3')];if(_0x286daa['headers'][_0xbc65('0xa4')]){delete _0x286daa[_0xbc65('0xa3')]['content-length'];}}if(_0x286daa['headers']['content-type']){delete _0x286daa[_0xbc65('0xa3')][_0xbc65('0xa5')];}return rp(_0x286daa);})['then'](function(_0x4d225d){if(_0x4d225d){_0x51d035[_0xbc65('0x25')](_0x4d225d[_0xbc65('0xa3')]);logger['info'](_0x4d225d[_0xbc65('0x95')]);if(_[_0xbc65('0xa6')](_0x5efb0a['query'][_0xbc65('0x8')],'download')&&_0x4d225d[_0xbc65('0xa7')]==0x1f4){return _0x51d035[_0xbc65('0xa8')](_0x4d225d[_0xbc65('0xa7')]);}else{return _0x51d035[_0xbc65('0x21')](_0x4d225d[_0xbc65('0xa7')])[_0xbc65('0x33')](_0x4d225d[_0xbc65('0x95')]);}}else{return _0x51d035['sendStatus'](0xc8);}})[_0xbc65('0x50')](handleError(_0x51d035,null));};exports[_0xbc65('0xa9')]=function(_0x1939b0,_0x2143d0,_0x2ed5d1){return BPromise[_0xbc65('0xaa')]()[_0xbc65('0x2f')](function(){if(!_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x8')]){throw new Error(_0xbc65('0x9d'));}if(!_0x1939b0['query'][_0xbc65('0x9e')]){throw new Error(_0xbc65('0xab'));}var _0x4c9e34=_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x9f')]?_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x9f')]+':'+_0x1939b0['query'][_0xbc65('0x9e')]:'http://localhost:'+_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x9e')];var _0x380327=_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x22')]?_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x22')]:!![];var _0xe36983=_0x1939b0[_0xbc65('0x3c')][_0xbc65('0xa1')]?_0x1939b0[_0xbc65('0x3c')][_0xbc65('0xa1')]:null;var _0x1b2679={'method':_0x1939b0['method'],'uri':util[_0xbc65('0x57')](_0xbc65('0xa2'),_0x4c9e34,_0x1939b0[_0xbc65('0x3c')][_0xbc65('0x8')]),'json':_0x380327,'resolveWithFullResponse':!![],'encoding':_0xe36983,'body':_0x1939b0[_0xbc65('0x95')]};if(_0x1939b0[_0xbc65('0xa3')]){_0x1b2679[_0xbc65('0xa3')]=_0x1939b0[_0xbc65('0xa3')];if(_0x1b2679['headers'][_0xbc65('0xa4')]){delete _0x1b2679[_0xbc65('0xa3')]['content-length'];}}if(_0x1b2679['headers'][_0xbc65('0xa5')]){delete _0x1b2679[_0xbc65('0xa3')][_0xbc65('0xa5')];}return rp(_0x1b2679);})['then'](function(_0x4638e0){if(_0x4638e0){_0x2143d0[_0xbc65('0x25')](_0x4638e0[_0xbc65('0xa3')]);logger[_0xbc65('0x68')](_0x4638e0[_0xbc65('0x95')]);return _0x2143d0[_0xbc65('0x21')](_0x4638e0[_0xbc65('0xa7')])[_0xbc65('0x33')](_0x4638e0[_0xbc65('0x95')]);}else{return _0x2143d0[_0xbc65('0xa8')](0xc8);}})[_0xbc65('0x50')](handleError(_0x2143d0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 24b2cbe..a35ed11 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 _0x9582=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2275fe,_0x4c260e){var _0x1ccf5b=function(_0x103d37){while(--_0x103d37){_0x2275fe['push'](_0x2275fe['shift']());}};_0x1ccf5b(++_0x4c260e);}(_0x9582,0x95));var _0x2958=function(_0x17d1d6,_0x5c1d1a){_0x17d1d6=_0x17d1d6-0x0;var _0x283373=_0x9582[_0x17d1d6];return _0x283373;};'use strict';var EventEmitter=require(_0x2958('0x0'));var Plugin=require(_0x2958('0x1'))['db'][_0x2958('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x2958('0x3')](0x0);var events={'afterCreate':_0x2958('0x4'),'afterUpdate':_0x2958('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a44fa){return function(_0x3b907e,_0x136c77,_0x195138){PluginEvents[_0x2958('0x6')](_0x2a44fa+':'+_0x3b907e['id'],_0x3b907e);PluginEvents[_0x2958('0x6')](_0x2a44fa,_0x3b907e);_0x195138(null);};}for(var e in events){if(events[_0x2958('0x7')](e)){var event=events[e];Plugin[_0x2958('0x8')](e,emitEvent(event));}}module[_0x2958('0x9')]=PluginEvents; \ No newline at end of file +var _0x8603=['../../mysqldb','Plugin','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x57dfa5,_0x45802d){var _0x1779f1=function(_0x29f1f0){while(--_0x29f1f0){_0x57dfa5['push'](_0x57dfa5['shift']());}};_0x1779f1(++_0x45802d);}(_0x8603,0x190));var _0x3860=function(_0x471f8f,_0x2eaaf8){_0x471f8f=_0x471f8f-0x0;var _0x31da61=_0x8603[_0x471f8f];return _0x31da61;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x3860('0x0'))['db'][_0x3860('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x3860('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3860('0x3')};function emitEvent(_0x456900){return function(_0x2f56a3,_0x490262,_0x2fc97a){PluginEvents['emit'](_0x456900+':'+_0x2f56a3['id'],_0x2f56a3);PluginEvents[_0x3860('0x4')](_0x456900,_0x2f56a3);_0x2fc97a(null);};}for(var e in events){if(events[_0x3860('0x5')](e)){var event=events[e];Plugin[_0x3860('0x6')](e,emitEvent(event));}}module[_0x3860('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1218f14..b463964 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 _0x6aa7=['Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6aa7,0x178));var _0x76aa=function(_0x4111a6,_0x565fb2){_0x4111a6=_0x4111a6-0x0;var _0x44f1c9=_0x6aa7[_0x4111a6];return _0x44f1c9;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./plugin.attributes','exports','define','Plugin','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x38c30b,_0x23bc01){var _0x4e4f6f=function(_0x5c41d4){while(--_0x5c41d4){_0x38c30b['push'](_0x38c30b['shift']());}};_0x4e4f6f(++_0x23bc01);}(_0x1cb9,0x14e));var _0x91cb=function(_0x7bc1ab,_0x3d9bc9){_0x7bc1ab=_0x7bc1ab-0x0;var _0x4c3400=_0x1cb9[_0x7bc1ab];return _0x4c3400;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 7ebc606..547a3f4 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 _0x9427=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','catch','CreatePlugin','Plugin','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4baefc,_0x388dca){var _0x193979=function(_0x3bfe0e){while(--_0x3bfe0e){_0x4baefc['push'](_0x4baefc['shift']());}};_0x193979(++_0x388dca);}(_0x9427,0x18f));var _0x7942=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9427[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7942('0x0'));var util=require(_0x7942('0x1'));var moment=require(_0x7942('0x2'));var BPromise=require(_0x7942('0x3'));var rs=require(_0x7942('0x4'));var fs=require('fs');var Redis=require(_0x7942('0x5'));var db=require(_0x7942('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7942('0x7'))(_0x7942('0x8'));var config=require(_0x7942('0x9'));var jayson=require(_0x7942('0xa'));var client=jayson[_0x7942('0xb')][_0x7942('0xc')]({'port':0x232a});config[_0x7942('0xd')]=_['defaults'](config[_0x7942('0xd')],{'host':_0x7942('0xe'),'port':0x18eb});var socket=require(_0x7942('0xf'))(new Redis(config[_0x7942('0xd')]));require(_0x7942('0x10'))[_0x7942('0x11')](socket);function respondWithRpcPromise(_0x37a361,_0x238e30,_0x338a88){return new BPromise(function(_0x18ffdc,_0x48ba44){return client[_0x7942('0x12')](_0x37a361,_0x338a88)[_0x7942('0x13')](function(_0x40c63b){logger[_0x7942('0x14')](_0x7942('0x15'),_0x238e30,_0x7942('0x16'));logger[_0x7942('0x17')](_0x7942('0x18'),_0x238e30,_0x7942('0x16'),JSON['stringify'](_0x40c63b));if(_0x40c63b[_0x7942('0x19')]){if(_0x40c63b[_0x7942('0x19')]['code']===0x1f4){logger[_0x7942('0x19')]('Plugin,\x20%s,\x20%s',_0x238e30,_0x40c63b[_0x7942('0x19')][_0x7942('0x1a')]);return _0x48ba44(_0x40c63b['error'][_0x7942('0x1a')]);}logger[_0x7942('0x19')](_0x7942('0x15'),_0x238e30,_0x40c63b[_0x7942('0x19')][_0x7942('0x1a')]);return _0x18ffdc(_0x40c63b[_0x7942('0x19')][_0x7942('0x1a')]);}else{logger[_0x7942('0x14')](_0x7942('0x15'),_0x238e30,_0x7942('0x16'));_0x18ffdc(_0x40c63b['result'][_0x7942('0x1a')]);}})[_0x7942('0x1b')](function(_0x54b6c8){logger[_0x7942('0x19')](_0x7942('0x15'),_0x238e30,_0x54b6c8);_0x48ba44(_0x54b6c8);});});}exports[_0x7942('0x1c')]=function(_0x58f361){var _0xf6c67a=this;return new Promise(function(_0x8de9e2,_0x59d867){return db[_0x7942('0x1d')][_0x7942('0x1e')](_0x58f361[_0x7942('0x1f')],{'raw':_0x58f361['options']?_0x58f361[_0x7942('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x7942('0x13')](function(_0x22e379){logger[_0x7942('0x14')](_0x7942('0x1c'),_0x58f361);logger['debug'](_0x7942('0x1c'),_0x58f361,JSON[_0x7942('0x21')](_0x22e379));_0x8de9e2(_0x22e379);})[_0x7942('0x1b')](function(_0x31b2aa){logger['error']('CreatePlugin',_0x31b2aa[_0x7942('0x1a')],_0x58f361);_0x59d867(_0xf6c67a[_0x7942('0x19')](0x1f4,_0x31b2aa[_0x7942('0x1a')]));});});}; \ No newline at end of file +var _0x71b8=['stringify','error','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x741b11,_0x43df8a){var _0x13f7ba=function(_0x147af7){while(--_0x147af7){_0x741b11['push'](_0x741b11['shift']());}};_0x13f7ba(++_0x43df8a);}(_0x71b8,0x113));var _0x871b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x71b8[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x871b('0x0'));var util=require('util');var moment=require(_0x871b('0x1'));var BPromise=require(_0x871b('0x2'));var rs=require(_0x871b('0x3'));var fs=require('fs');var Redis=require(_0x871b('0x4'));var db=require(_0x871b('0x5'))['db'];var utils=require(_0x871b('0x6'));var logger=require(_0x871b('0x7'))('rpc');var config=require(_0x871b('0x8'));var jayson=require(_0x871b('0x9'));var client=jayson[_0x871b('0xa')]['http']({'port':0x232a});config[_0x871b('0xb')]=_[_0x871b('0xc')](config['redis'],{'host':_0x871b('0xd'),'port':0x18eb});var socket=require(_0x871b('0xe'))(new Redis(config[_0x871b('0xb')]));require('./plugin.socket')[_0x871b('0xf')](socket);function respondWithRpcPromise(_0x34a800,_0x11ebf0,_0x4b7c11){return new BPromise(function(_0xbf5001,_0x4d7db2){return client[_0x871b('0x10')](_0x34a800,_0x4b7c11)[_0x871b('0x11')](function(_0x3893c2){logger[_0x871b('0x12')](_0x871b('0x13'),_0x11ebf0,_0x871b('0x14'));logger[_0x871b('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x11ebf0,'request\x20sent',JSON[_0x871b('0x16')](_0x3893c2));if(_0x3893c2[_0x871b('0x17')]){if(_0x3893c2['error']['code']===0x1f4){logger[_0x871b('0x17')]('Plugin,\x20%s,\x20%s',_0x11ebf0,_0x3893c2['error']['message']);return _0x4d7db2(_0x3893c2[_0x871b('0x17')]['message']);}logger['error'](_0x871b('0x13'),_0x11ebf0,_0x3893c2[_0x871b('0x17')][_0x871b('0x18')]);return _0xbf5001(_0x3893c2[_0x871b('0x17')][_0x871b('0x18')]);}else{logger[_0x871b('0x12')](_0x871b('0x13'),_0x11ebf0,_0x871b('0x14'));_0xbf5001(_0x3893c2[_0x871b('0x19')][_0x871b('0x18')]);}})[_0x871b('0x1a')](function(_0x3785eb){logger['error'](_0x871b('0x13'),_0x11ebf0,_0x3785eb);_0x4d7db2(_0x3785eb);});});}exports['CreatePlugin']=function(_0x3ab7cf){var _0x371ff8=this;return new Promise(function(_0x32bb74,_0x496c82){return db[_0x871b('0x1b')][_0x871b('0x1c')](_0x3ab7cf[_0x871b('0x1d')],{'raw':_0x3ab7cf[_0x871b('0x1e')]?_0x3ab7cf['options'][_0x871b('0x1f')]===undefined?!![]:![]:!![]})[_0x871b('0x11')](function(_0x5ca002){logger['info'](_0x871b('0x20'),_0x3ab7cf);logger[_0x871b('0x15')]('CreatePlugin',_0x3ab7cf,JSON[_0x871b('0x16')](_0x5ca002));_0x32bb74(_0x5ca002);})['catch'](function(_0x14ba28){logger['error'](_0x871b('0x20'),_0x14ba28[_0x871b('0x18')],_0x3ab7cf);_0x496c82(_0x371ff8[_0x871b('0x17')](0x1f4,_0x14ba28[_0x871b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5752b93..1347a0c 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 _0xa63a=['removeListener','register','length','plugin:','save','remove','update','emit'];(function(_0x35b63b,_0x33b24a){var _0x2db926=function(_0xfaf6b4){while(--_0xfaf6b4){_0x35b63b['push'](_0x35b63b['shift']());}};_0x2db926(++_0x33b24a);}(_0xa63a,0x154));var _0xaa63=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xa63a[_0x29d2d2];return _0x3f6476;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xaa63('0x0'),_0xaa63('0x1'),_0xaa63('0x2')];function createListener(_0x23462e,_0x323e0c){return function(_0x7fc980){_0x323e0c[_0xaa63('0x3')](_0x23462e,_0x7fc980);};}function removeListener(_0x132b71,_0x17601c){return function(){PluginEvents[_0xaa63('0x4')](_0x132b71,_0x17601c);};}exports[_0xaa63('0x5')]=function(_0x49c76b){for(var _0x5160dc=0x0,_0x5ee756=events[_0xaa63('0x6')];_0x5160dc<_0x5ee756;_0x5160dc++){var _0x53e524=events[_0x5160dc];var _0x42f55d=createListener(_0xaa63('0x7')+_0x53e524,_0x49c76b);PluginEvents['on'](_0x53e524,_0x42f55d);}}; \ No newline at end of file +var _0x77e2=['length','plugin:','./plugin.events','save','update','register'];(function(_0x3e9ef1,_0x50b5ee){var _0x4e0de6=function(_0x40fe72){while(--_0x40fe72){_0x3e9ef1['push'](_0x3e9ef1['shift']());}};_0x4e0de6(++_0x50b5ee);}(_0x77e2,0x176));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x277e('0x0'));var events=[_0x277e('0x1'),'remove',_0x277e('0x2')];function createListener(_0x370698,_0x5ae922){return function(_0xf5e606){_0x5ae922['emit'](_0x370698,_0xf5e606);};}function removeListener(_0x1dab70,_0x41478e){return function(){PluginEvents['removeListener'](_0x1dab70,_0x41478e);};}exports[_0x277e('0x3')]=function(_0x1c4a71){for(var _0xc250e4=0x0,_0x36a00a=events[_0x277e('0x4')];_0xc250e4<_0x36a00a;_0xc250e4++){var _0x4eacc8=events[_0xc250e4];var _0x3b151d=createListener(_0x277e('0x5')+_0x4eacc8,_0x1c4a71);PluginEvents['on'](_0x4eacc8,_0x3b151d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index db7c53c..f985d7d 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 _0xa0e4=['create','put','update','destroy','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','post'];(function(_0x296453,_0x219c2a){var _0x37b596=function(_0x4d818e){while(--_0x4d818e){_0x296453['push'](_0x296453['shift']());}};_0x37b596(++_0x219c2a);}(_0xa0e4,0xa0));var _0x4a0e=function(_0x1233d1,_0x15cf04){_0x1233d1=_0x1233d1-0x0;var _0x56ee5e=_0xa0e4[_0x1233d1];return _0x56ee5e;};'use strict';var express=require(_0x4a0e('0x0'));var router=express[_0x4a0e('0x1')]();var auth=require(_0x4a0e('0x2'));var controller=require(_0x4a0e('0x3'));router[_0x4a0e('0x4')]('/',auth[_0x4a0e('0x5')](),controller[_0x4a0e('0x6')]);router[_0x4a0e('0x4')](_0x4a0e('0x7'),auth[_0x4a0e('0x5')](),controller['show']);router[_0x4a0e('0x8')]('/',auth[_0x4a0e('0x5')](),controller[_0x4a0e('0x9')]);router[_0x4a0e('0xa')]('/:id',auth[_0x4a0e('0x5')](),controller[_0x4a0e('0xb')]);router['delete'](_0x4a0e('0x7'),auth[_0x4a0e('0x5')](),controller[_0x4a0e('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1c7e=['post','create','put','/:id','update','delete','destroy','exports','express','Router','./pm2.controller','isAuthenticated','index','get'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1c7e,0x13c));var _0xe1c7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c7e[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xe1c7('0x0'));var router=express[_0xe1c7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe1c7('0x2'));router['get']('/',auth[_0xe1c7('0x3')](),controller[_0xe1c7('0x4')]);router[_0xe1c7('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe1c7('0x6')]('/',auth['isAuthenticated'](),controller[_0xe1c7('0x7')]);router[_0xe1c7('0x8')](_0xe1c7('0x9'),auth[_0xe1c7('0x3')](),controller[_0xe1c7('0xa')]);router[_0xe1c7('0xb')]('/:id',auth[_0xe1c7('0x3')](),controller[_0xe1c7('0xc')]);module[_0xe1c7('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index d35934f..7225937 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 _0xf93f=['child_process','exec','bluebird','sendStatus','json','stack','name','send','npm\x20install','info','index','list','reject','express','then','show','describe','catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','api','path'];(function(_0x4d4223,_0x325b3b){var _0x2f5cd7=function(_0x1c7ec2){while(--_0x1c7ec2){_0x4d4223['push'](_0x4d4223['shift']());}};_0x2f5cd7(++_0x325b3b);}(_0xf93f,0x182));var _0xff93=function(_0xf60cfb,_0x3bb1f2){_0xf60cfb=_0xf60cfb-0x0;var _0x5eb02d=_0xf93f[_0xf60cfb];return _0x5eb02d;};'use strict';var _=require(_0xff93('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xff93('0x1'))(_0xff93('0x2'));var path=require(_0xff93('0x3'));var exec=require(_0xff93('0x4'))[_0xff93('0x5')];var BPromise=require(_0xff93('0x6'));function handleEntityNotFound(_0x1d0979,_0x297b2d){return function(_0x16a12c){if(!_0x16a12c){_0x1d0979[_0xff93('0x7')](0x194);;}return _0x16a12c;};}function respondWithResult(_0x5639f3,_0xe21cb8){_0xe21cb8=_0xe21cb8||0xc8;return function(_0x20033c){if(_0x20033c){return _0x5639f3['status'](_0xe21cb8)[_0xff93('0x8')](_0x20033c);}return null;};}function handleError(_0x48462b,_0x2fe5cc){_0x2fe5cc=_0x2fe5cc||0x1f4;return function(_0x4be1f4){logger['error'](_0x4be1f4[_0xff93('0x9')]);if(_0x4be1f4['name']){delete _0x4be1f4[_0xff93('0xa')];}_0x48462b['status'](_0x2fe5cc)[_0xff93('0xb')](_0x4be1f4);};}function execChildProcess(){return new BPromise(function(_0x50278b,_0x42ee12){exec(_0xff93('0xc'),function(_0x3853e1,_0x10ffa6,_0x49aa9b){logger[_0xff93('0xd')](_0x10ffa6);logger[_0xff93('0xd')](_0x49aa9b);if(_0x3853e1){logger['error'](_0x3853e1);return _0x42ee12(_0x3853e1);}return _0x50278b(_0x10ffa6);});});}exports[_0xff93('0xe')]=function(_0x497186,_0x11d583){return pm2[_0xff93('0xf')]()['then'](function(_0x2cc424){if(_0x2cc424){var _0x2d54fb=_[_0xff93('0x10')](_0x2cc424,function(_0x43d4ec){return _0x43d4ec[_0xff93('0xa')]===_0xff93('0x11')||_0x43d4ec[_0xff93('0xa')]==='motion2';});return{'rows':_0x2d54fb,'count':_0x2d54fb['length']};}return null;})[_0xff93('0x12')](respondWithResult(_0x11d583,null))['catch'](handleError(_0x11d583,null));};exports[_0xff93('0x13')]=function(_0xd448ae,_0x32b6be){return pm2[_0xff93('0x14')](_0xd448ae['params']['id'])[_0xff93('0x12')](respondWithResult(_0x32b6be,null))[_0xff93('0x12')](handleEntityNotFound(_0x32b6be,null))[_0xff93('0x15')](handleError(_0x32b6be,null));};exports[_0xff93('0x16')]=function(_0x32aed0,_0x1141f1){if(_0x32aed0[_0xff93('0x17')]['name']&&_0x32aed0['body'][_0xff93('0x18')]){var _0x544784=path[_0xff93('0x19')](__dirname,_0xff93('0x1a'),_0x32aed0[_0xff93('0x17')][_0xff93('0x18')]);var _0xf9ae59=process[_0xff93('0x1b')]();process[_0xff93('0x1c')](path[_0xff93('0x1d')](_0x544784));return execChildProcess()[_0xff93('0x12')](function(_0x3d45ad){process[_0xff93('0x1c')](_0xf9ae59);return pm2[_0xff93('0x1e')]({'name':_0x32aed0[_0xff93('0x17')][_0xff93('0xa')],'script':_0x544784});})[_0xff93('0x12')](function(_0x3c9103){pm2[_0xff93('0x1f')]();return _0x3c9103[0x0];})[_0xff93('0x12')](respondWithResult(_0x1141f1,0xc9))['catch'](handleError(_0x1141f1,null));}else{return _0x1141f1[_0xff93('0x20')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x41392d,_0x139cc9){if(_0x41392d[_0xff93('0x17')]['id']){delete _0x41392d[_0xff93('0x17')]['id'];}var _0x1a1877={'online':_0xff93('0x21'),'stopped':'stop'};if(_0x1a1877[_0xff93('0x22')](_0x41392d['body'][_0xff93('0x20')])){return pm2[_0x1a1877[_0x41392d[_0xff93('0x17')][_0xff93('0x20')]]](_0x41392d[_0xff93('0x23')]['id'])['then'](respondWithResult(_0x139cc9,0xc8))[_0xff93('0x15')](handleError(_0x139cc9,null));}else{return _0x139cc9[_0xff93('0x20')](0x1f4)['send']({'message':_0xff93('0x24')});}};exports['destroy']=function(_0x1135f9,_0x41f698){if(_0x1135f9[_0xff93('0x17')]['id']){delete _0x1135f9[_0xff93('0x17')]['id'];}if(_0x1135f9[_0xff93('0x23')]['id']){return pm2[_0xff93('0x25')](_0x1135f9['params']['id'])['then'](function(_0x289e2d){pm2[_0xff93('0x1f')]();return _0x289e2d[0x0];})[_0xff93('0x12')](respondWithResult(_0x41f698,null))['catch'](handleError(_0x41f698,null));}else{return _0x41f698['status'](0x1f4)[_0xff93('0xb')]({'message':_0xff93('0x26')});}}; \ No newline at end of file +var _0x0f26=['dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','send','info','index','reject','name','motion2','length','then','catch','show','params','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x0f26,0xc5));var _0x60f2=function(_0x54afc3,_0x4c89c0){_0x54afc3=_0x54afc3-0x0;var _0x51f144=_0x0f26[_0x54afc3];return _0x51f144;};'use strict';var _=require(_0x60f2('0x0'));var pm2=require(_0x60f2('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x60f2('0x2'));var exec=require(_0x60f2('0x3'))[_0x60f2('0x4')];var BPromise=require(_0x60f2('0x5'));function handleEntityNotFound(_0x356880,_0x529ad7){return function(_0x54e7f8){if(!_0x54e7f8){_0x356880[_0x60f2('0x6')](0x194);;}return _0x54e7f8;};}function respondWithResult(_0x1cfed2,_0x453735){_0x453735=_0x453735||0xc8;return function(_0x568ea6){if(_0x568ea6){return _0x1cfed2[_0x60f2('0x7')](_0x453735)[_0x60f2('0x8')](_0x568ea6);}return null;};}function handleError(_0x3a3255,_0x37b34c){_0x37b34c=_0x37b34c||0x1f4;return function(_0xf12d2d){logger[_0x60f2('0x9')](_0xf12d2d[_0x60f2('0xa')]);if(_0xf12d2d['name']){delete _0xf12d2d['name'];}_0x3a3255['status'](_0x37b34c)[_0x60f2('0xb')](_0xf12d2d);};}function execChildProcess(){return new BPromise(function(_0x5889e9,_0x17d874){exec('npm\x20install',function(_0x273fec,_0x2b8206,_0x10a9e2){logger[_0x60f2('0xc')](_0x2b8206);logger[_0x60f2('0xc')](_0x10a9e2);if(_0x273fec){logger[_0x60f2('0x9')](_0x273fec);return _0x17d874(_0x273fec);}return _0x5889e9(_0x2b8206);});});}exports[_0x60f2('0xd')]=function(_0x1a2e94,_0x56a0da){return pm2['list']()['then'](function(_0x3dab78){if(_0x3dab78){var _0x2f236f=_[_0x60f2('0xe')](_0x3dab78,function(_0x47cd35){return _0x47cd35[_0x60f2('0xf')]==='express'||_0x47cd35[_0x60f2('0xf')]===_0x60f2('0x10');});return{'rows':_0x2f236f,'count':_0x2f236f[_0x60f2('0x11')]};}return null;})[_0x60f2('0x12')](respondWithResult(_0x56a0da,null))[_0x60f2('0x13')](handleError(_0x56a0da,null));};exports[_0x60f2('0x14')]=function(_0x34f268,_0x557f73){return pm2['describe'](_0x34f268[_0x60f2('0x15')]['id'])[_0x60f2('0x12')](respondWithResult(_0x557f73,null))['then'](handleEntityNotFound(_0x557f73,null))[_0x60f2('0x13')](handleError(_0x557f73,null));};exports[_0x60f2('0x16')]=function(_0x1a4a77,_0x2fd0cc){if(_0x1a4a77[_0x60f2('0x17')][_0x60f2('0xf')]&&_0x1a4a77[_0x60f2('0x17')]['script']){var _0x2ac092=path[_0x60f2('0x18')](__dirname,_0x60f2('0x19'),_0x1a4a77[_0x60f2('0x17')][_0x60f2('0x1a')]);var _0x567fc7=process[_0x60f2('0x1b')]();process[_0x60f2('0x1c')](path[_0x60f2('0x1d')](_0x2ac092));return execChildProcess()[_0x60f2('0x12')](function(_0x54073f){process[_0x60f2('0x1c')](_0x567fc7);return pm2[_0x60f2('0x1e')]({'name':_0x1a4a77[_0x60f2('0x17')][_0x60f2('0xf')],'script':_0x2ac092});})[_0x60f2('0x12')](function(_0x2a6d4c){pm2[_0x60f2('0x1f')]();return _0x2a6d4c[0x0];})[_0x60f2('0x12')](respondWithResult(_0x2fd0cc,0xc9))['catch'](handleError(_0x2fd0cc,null));}else{return _0x2fd0cc[_0x60f2('0x7')](0x1f4)[_0x60f2('0xb')]({'message':_0x60f2('0x20')});}};exports[_0x60f2('0x21')]=function(_0x39e3b0,_0x4287ae){if(_0x39e3b0[_0x60f2('0x17')]['id']){delete _0x39e3b0[_0x60f2('0x17')]['id'];}var _0x1d11b5={'online':_0x60f2('0x22'),'stopped':'stop'};if(_0x1d11b5[_0x60f2('0x23')](_0x39e3b0['body']['status'])){return pm2[_0x1d11b5[_0x39e3b0[_0x60f2('0x17')]['status']]](_0x39e3b0['params']['id'])[_0x60f2('0x12')](respondWithResult(_0x4287ae,0xc8))[_0x60f2('0x13')](handleError(_0x4287ae,null));}else{return _0x4287ae[_0x60f2('0x7')](0x1f4)[_0x60f2('0xb')]({'message':_0x60f2('0x24')});}};exports['destroy']=function(_0x598fd5,_0x20306a){if(_0x598fd5[_0x60f2('0x17')]['id']){delete _0x598fd5['body']['id'];}if(_0x598fd5[_0x60f2('0x15')]['id']){return pm2['delete'](_0x598fd5[_0x60f2('0x15')]['id'])[_0x60f2('0x12')](function(_0x4b5731){pm2[_0x60f2('0x1f')]();return _0x4b5731[0x0];})[_0x60f2('0x12')](respondWithResult(_0x20306a,null))[_0x60f2('0x13')](handleError(_0x20306a,null));}else{return _0x20306a[_0x60f2('0x7')](0x1f4)[_0x60f2('0xb')]({'message':_0x60f2('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6f4d924..0a618b2 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 _0x2ad1=['../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x44c3ee,_0x55a3db){var _0x37bfbc=function(_0x3b6c05){while(--_0x3b6c05){_0x44c3ee['push'](_0x44c3ee['shift']());}};_0x37bfbc(++_0x55a3db);}(_0x2ad1,0x137));var _0x12ad=function(_0x2c3135,_0x38e21f){_0x2c3135=_0x2c3135-0x0;var _0x333704=_0x2ad1[_0x2c3135];return _0x333704;};'use strict';var multer=require(_0x12ad('0x0'));var util=require(_0x12ad('0x1'));var path=require(_0x12ad('0x2'));var timeout=require(_0x12ad('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x12ad('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x12ad('0x5'));module[_0x12ad('0x6')]=router; \ No newline at end of file +var _0xc433=['../../components/interaction/service','../../config/environment','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0xc433,0x18b));var _0x3c43=function(_0x10ec0f,_0x5ece09){_0x10ec0f=_0x10ec0f-0x0;var _0x1587ee=_0xc433[_0x10ec0f];return _0x1587ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c43('0x0'));var timeout=require(_0x3c43('0x1'));var express=require(_0x3c43('0x2'));var router=express[_0x3c43('0x3')]();var auth=require(_0x3c43('0x4'));var interaction=require(_0x3c43('0x5'));var config=require(_0x3c43('0x6'));module[_0x3c43('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d871c08..04c92c4 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 _0xe5ee=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1296d3,_0x26b0e0){var _0x529bea=function(_0x1bc132){while(--_0x1bc132){_0x1296d3['push'](_0x1296d3['shift']());}};_0x529bea(++_0x26b0e0);}(_0xe5ee,0x132));var _0xee5e=function(_0x5248fa,_0x1334d1){_0x5248fa=_0x5248fa-0x0;var _0x10616c=_0xe5ee[_0x5248fa];return _0x10616c;};'use strict';var Sequelize=require(_0xee5e('0x0'));module[_0xee5e('0x1')]={'state':{'type':Sequelize[_0xee5e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xee5e('0x3')]},'scheduledat':{'type':Sequelize[_0xee5e('0x4')]},'uniqueid':{'type':Sequelize[_0xee5e('0x3')]},'starttime':{'type':Sequelize[_0xee5e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xee5e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xee5e('0x3')]}}; \ No newline at end of file +var _0x33e0=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3bb7df,_0x1b5d3a){var _0xb10d46=function(_0x2ed02d){while(--_0x2ed02d){_0x3bb7df['push'](_0x3bb7df['shift']());}};_0xb10d46(++_0x1b5d3a);}(_0x33e0,0xeb));var _0x033e=function(_0x298225,_0x52bd17){_0x298225=_0x298225-0x0;var _0x1b3eaa=_0x33e0[_0x298225];return _0x1b3eaa;};'use strict';var Sequelize=require(_0x033e('0x0'));module[_0x033e('0x1')]={'state':{'type':Sequelize[_0x033e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x033e('0x3')]},'scheduledat':{'type':Sequelize[_0x033e('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x033e('0x4')]},'ringtime':{'type':Sequelize[_0x033e('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x033e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x033e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e5575c8..c3784cf 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 _0x8ca2=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca2,0x171));var _0x28ca=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8ca2[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x28ca('0x0'));var util=require(_0x28ca('0x1'));var logger=require('../../config/logger')(_0x28ca('0x2'));var moment=require('moment');var BPromise=require(_0x28ca('0x3'));var rp=require(_0x28ca('0x4'));var fs=require('fs');var path=require(_0x28ca('0x5'));var rimraf=require(_0x28ca('0x6'));var config=require(_0x28ca('0x7'));var attributes=require(_0x28ca('0x8'));module['exports']=function(_0x270e7a,_0x28d3c8){return _0x270e7a[_0x28ca('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x28ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9429=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','path','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9429,0x7b));var _0x9942=function(_0xd7a7d6,_0x14dd2a){_0xd7a7d6=_0xd7a7d6-0x0;var _0xb58eb=_0x9429[_0xd7a7d6];return _0xb58eb;};'use strict';var _=require(_0x9942('0x0'));var util=require(_0x9942('0x1'));var logger=require(_0x9942('0x2'))(_0x9942('0x3'));var moment=require(_0x9942('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9942('0x5'));var rimraf=require('rimraf');var config=require(_0x9942('0x6'));var attributes=require(_0x9942('0x7'));module[_0x9942('0x8')]=function(_0x282283,_0x552f46){return _0x282283['define'](_0x9942('0x9'),attributes,{'tableName':_0x9942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 74ce9c1..26d6bb4 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 _0xd9d6=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','raw','then','debug','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x24c9d0,_0x4967b6){var _0x58c87f=function(_0x380793){while(--_0x380793){_0x24c9d0['push'](_0x24c9d0['shift']());}};_0x58c87f(++_0x4967b6);}(_0xd9d6,0x78));var _0x6d9d=function(_0x434543,_0x2fd498){_0x434543=_0x434543-0x0;var _0x3e6749=_0xd9d6[_0x434543];return _0x3e6749;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d9d('0x0'));var BPromise=require(_0x6d9d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d9d('0x2'));var db=require(_0x6d9d('0x3'))['db'];var utils=require(_0x6d9d('0x4'));var logger=require(_0x6d9d('0x5'))(_0x6d9d('0x6'));var config=require(_0x6d9d('0x7'));var jayson=require(_0x6d9d('0x8'));var client=jayson[_0x6d9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc460e4,_0x5af373,_0x3ccabd){return new BPromise(function(_0x484d01,_0x513771){return client[_0x6d9d('0xa')](_0xc460e4,_0x3ccabd)['then'](function(_0x426bb7){logger[_0x6d9d('0xb')](_0x6d9d('0xc'),_0x5af373,'request\x20sent');logger['debug'](_0x6d9d('0xd'),_0x5af373,_0x6d9d('0xe'),JSON['stringify'](_0x426bb7));if(_0x426bb7[_0x6d9d('0xf')]){if(_0x426bb7[_0x6d9d('0xf')][_0x6d9d('0x10')]===0x1f4){logger[_0x6d9d('0xf')](_0x6d9d('0xc'),_0x5af373,_0x426bb7['error'][_0x6d9d('0x11')]);return _0x513771(_0x426bb7[_0x6d9d('0xf')][_0x6d9d('0x11')]);}logger['error'](_0x6d9d('0xc'),_0x5af373,_0x426bb7['error'][_0x6d9d('0x11')]);return _0x484d01(_0x426bb7['error'][_0x6d9d('0x11')]);}else{logger['info'](_0x6d9d('0xc'),_0x5af373,'request\x20sent');_0x484d01(_0x426bb7[_0x6d9d('0x12')]['message']);}})[_0x6d9d('0x13')](function(_0x5f358f){logger['error'](_0x6d9d('0xc'),_0x5af373,_0x5f358f);_0x513771(_0x5f358f);});});}exports[_0x6d9d('0x14')]=function(_0x4a2a49){var _0x434345=this;return new Promise(function(_0xad640d,_0xaf973a){return db[_0x6d9d('0x15')]['create'](_0x4a2a49['body'],{'raw':_0x4a2a49['options']?_0x4a2a49[_0x6d9d('0x16')][_0x6d9d('0x17')]===undefined?!![]:![]:!![]})[_0x6d9d('0x18')](function(_0x1ecaf4){logger[_0x6d9d('0xb')]('CreateReportAgentPreview',_0x4a2a49);logger[_0x6d9d('0x19')](_0x6d9d('0x14'),_0x4a2a49,JSON[_0x6d9d('0x1a')](_0x1ecaf4));_0xad640d(_0x1ecaf4);})[_0x6d9d('0x13')](function(_0xca8857){logger[_0x6d9d('0xf')]('CreateReportAgentPreview',_0xca8857[_0x6d9d('0x11')],_0x4a2a49);_0xaf973a(_0x434345[_0x6d9d('0xf')](0x1f4,_0xca8857['message']));});});}; \ No newline at end of file +var _0xda28=['catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','stringify'];(function(_0x3250f7,_0x1c2afc){var _0xdb6ac4=function(_0x5a23f8){while(--_0x5a23f8){_0x3250f7['push'](_0x3250f7['shift']());}};_0xdb6ac4(++_0x1c2afc);}(_0xda28,0x114));var _0x8da2=function(_0x39785f,_0x409e74){_0x39785f=_0x39785f-0x0;var _0x5a5138=_0xda28[_0x39785f];return _0x5a5138;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8da2('0x0'));var BPromise=require('bluebird');var rs=require(_0x8da2('0x1'));var fs=require('fs');var Redis=require(_0x8da2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8da2('0x3'));var logger=require(_0x8da2('0x4'))(_0x8da2('0x5'));var config=require(_0x8da2('0x6'));var jayson=require(_0x8da2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1901dc,_0x4033e4,_0x42c748){return new BPromise(function(_0x3780ef,_0x137ee0){return client[_0x8da2('0x8')](_0x1901dc,_0x42c748)[_0x8da2('0x9')](function(_0x5f4007){logger[_0x8da2('0xa')](_0x8da2('0xb'),_0x4033e4,_0x8da2('0xc'));logger[_0x8da2('0xd')](_0x8da2('0xe'),_0x4033e4,_0x8da2('0xc'),JSON['stringify'](_0x5f4007));if(_0x5f4007[_0x8da2('0xf')]){if(_0x5f4007['error'][_0x8da2('0x10')]===0x1f4){logger[_0x8da2('0xf')](_0x8da2('0xb'),_0x4033e4,_0x5f4007[_0x8da2('0xf')][_0x8da2('0x11')]);return _0x137ee0(_0x5f4007['error'][_0x8da2('0x11')]);}logger[_0x8da2('0xf')](_0x8da2('0xb'),_0x4033e4,_0x5f4007[_0x8da2('0xf')][_0x8da2('0x11')]);return _0x3780ef(_0x5f4007['error'][_0x8da2('0x11')]);}else{logger[_0x8da2('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x4033e4,_0x8da2('0xc'));_0x3780ef(_0x5f4007[_0x8da2('0x12')][_0x8da2('0x11')]);}})['catch'](function(_0x570b05){logger[_0x8da2('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x4033e4,_0x570b05);_0x137ee0(_0x570b05);});});}exports[_0x8da2('0x13')]=function(_0x2fc7e7){var _0x2d25bf=this;return new Promise(function(_0x43c2e3,_0xcf3123){return db[_0x8da2('0x14')]['create'](_0x2fc7e7[_0x8da2('0x15')],{'raw':_0x2fc7e7['options']?_0x2fc7e7[_0x8da2('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x8da2('0x9')](function(_0x35a7ca){logger['info'](_0x8da2('0x13'),_0x2fc7e7);logger[_0x8da2('0xd')](_0x8da2('0x13'),_0x2fc7e7,JSON[_0x8da2('0x17')](_0x35a7ca));_0x43c2e3(_0x35a7ca);})[_0x8da2('0x18')](function(_0x203e15){logger[_0x8da2('0xf')](_0x8da2('0x13'),_0x203e15[_0x8da2('0x11')],_0x2fc7e7);_0xcf3123(_0x2d25bf[_0x8da2('0xf')](0x1f4,_0x203e15[_0x8da2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 753c3ad..c55338f 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 _0xaca0=['mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','/agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues'];(function(_0x384a25,_0x3e74f6){var _0x484068=function(_0x45894c){while(--_0x45894c){_0x384a25['push'](_0x384a25['shift']());}};_0x484068(++_0x3e74f6);}(_0xaca0,0xd2));var _0x0aca=function(_0xaa762f,_0x533991){_0xaa762f=_0xaa762f-0x0;var _0x2968ca=_0xaca0[_0xaa762f];return _0x2968ca;};'use strict';var multer=require('multer');var util=require(_0x0aca('0x0'));var path=require(_0x0aca('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x0aca('0x2')]('/voice/channels',auth[_0x0aca('0x3')](),controller[_0x0aca('0x4')]);router[_0x0aca('0x2')](_0x0aca('0x5'),auth[_0x0aca('0x3')](),controller['voiceChannelMixMonitor']);router[_0x0aca('0x2')](_0x0aca('0x6'),auth['isAuthenticated'](),controller[_0x0aca('0x7')]);router[_0x0aca('0x2')](_0x0aca('0x8'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x9')]);router[_0x0aca('0x2')](_0x0aca('0xa'),auth[_0x0aca('0x3')](),controller['chatQueues']);router[_0x0aca('0x2')](_0x0aca('0xb'),auth[_0x0aca('0x3')](),controller['mailQueues']);router[_0x0aca('0x2')]('/mail/accounts',auth[_0x0aca('0x3')](),controller[_0x0aca('0xc')]);router[_0x0aca('0x2')](_0x0aca('0xd'),auth[_0x0aca('0x3')](),controller[_0x0aca('0xe')]);router['get'](_0x0aca('0xf'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x10')]);router['get'](_0x0aca('0x11'),auth['isAuthenticated'](),controller[_0x0aca('0x12')]);router[_0x0aca('0x2')](_0x0aca('0x13'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x14')]);router[_0x0aca('0x2')](_0x0aca('0x15'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x16')]);router[_0x0aca('0x2')](_0x0aca('0x17'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x18')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x0aca('0x3')](),controller[_0x0aca('0x19')]);router[_0x0aca('0x2')](_0x0aca('0x1a'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x1b')]);router[_0x0aca('0x2')](_0x0aca('0x1c'),auth[_0x0aca('0x3')](),controller['voiceQueuesChannelRedirect']);router[_0x0aca('0x2')](_0x0aca('0x1d'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x1e')]);router[_0x0aca('0x1f')](_0x0aca('0x1d'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x20')]);router[_0x0aca('0x2')](_0x0aca('0x21'),auth[_0x0aca('0x3')](),controller['outbound']);router['get'](_0x0aca('0x22'),auth[_0x0aca('0x3')](),controller['outboundChannels']);router[_0x0aca('0x2')](_0x0aca('0x23'),auth[_0x0aca('0x3')](),controller['agents']);router['put'](_0x0aca('0x24'),auth[_0x0aca('0x3')](),controller['agentCapacity']);router[_0x0aca('0x2')](_0x0aca('0x25'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x26')]);router[_0x0aca('0x2')](_0x0aca('0x27'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x28')]);router[_0x0aca('0x2')](_0x0aca('0x29'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x2a')]);router[_0x0aca('0x2')](_0x0aca('0x2b'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x0aca('0x2')](_0x0aca('0x2c'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x2d')]);router['get'](_0x0aca('0x2e'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x2f')]);router[_0x0aca('0x2')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x0aca('0x30'),auth[_0x0aca('0x3')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x0aca('0x3')](),controller[_0x0aca('0x31')]);router['get'](_0x0aca('0x32'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x33')]);router['get'](_0x0aca('0x34'),auth[_0x0aca('0x3')](),controller['faxQueuesWaitingInteractions']);router[_0x0aca('0x35')]('/mail/queues/:id/notify',auth[_0x0aca('0x3')](),controller['queueNotify']('mail'));router['get'](_0x0aca('0x36'),auth[_0x0aca('0x3')](),controller['showMailQueues']);router[_0x0aca('0x35')](_0x0aca('0x37'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x38')](_0x0aca('0x39')));router[_0x0aca('0x2')](_0x0aca('0x3a'),auth['isAuthenticated'](),controller[_0x0aca('0x3b')]);router[_0x0aca('0x35')](_0x0aca('0x3c'),auth[_0x0aca('0x3')](),controller[_0x0aca('0x38')](_0x0aca('0x3d')));router[_0x0aca('0x2')]('/fax/queues/:id',auth[_0x0aca('0x3')](),controller[_0x0aca('0x3e')]);router[_0x0aca('0x35')](_0x0aca('0x3f'),auth[_0x0aca('0x3')](),controller['queueNotify']('openchannel'));router[_0x0aca('0x2')](_0x0aca('0x40'),auth['isAuthenticated'](),controller[_0x0aca('0x41')]);router[_0x0aca('0x35')]('/sms/queues/:id/notify',auth[_0x0aca('0x3')](),controller['queueNotify'](_0x0aca('0x42')));router[_0x0aca('0x35')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0aca('0x38')](_0x0aca('0x43')));router[_0x0aca('0x2')](_0x0aca('0x44'),auth['isAuthenticated'](),controller[_0x0aca('0x45')]);router[_0x0aca('0x2')](_0x0aca('0x46'),auth[_0x0aca('0x3')](),controller['showWhatsappQueues']);router['post'](_0x0aca('0x47'),auth['isAuthenticated'](),controller[_0x0aca('0x48')]);module[_0x0aca('0x49')]=router; \ No newline at end of file +var _0x828a=['voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannel','voiceQueuesChannelRedirect','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','put','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor'];(function(_0x25b2c4,_0x302ef7){var _0x1f36ea=function(_0x75a852){while(--_0x75a852){_0x25b2c4['push'](_0x25b2c4['shift']());}};_0x1f36ea(++_0x302ef7);}(_0x828a,0xda));var _0xa828=function(_0x362baa,_0x5ce96a){_0x362baa=_0x362baa-0x0;var _0x448f01=_0x828a[_0x362baa];return _0x448f01;};'use strict';var multer=require(_0xa828('0x0'));var util=require(_0xa828('0x1'));var path=require('path');var express=require(_0xa828('0x2'));var router=express[_0xa828('0x3')]();var auth=require(_0xa828('0x4'));var controller=require(_0xa828('0x5'));router[_0xa828('0x6')](_0xa828('0x7'),auth[_0xa828('0x8')](),controller[_0xa828('0x9')]);router[_0xa828('0x6')](_0xa828('0xa'),auth[_0xa828('0x8')](),controller[_0xa828('0xb')]);router[_0xa828('0x6')](_0xa828('0xc'),auth[_0xa828('0x8')](),controller[_0xa828('0xd')]);router[_0xa828('0x6')](_0xa828('0xe'),auth[_0xa828('0x8')](),controller[_0xa828('0xf')]);router[_0xa828('0x6')](_0xa828('0x10'),auth[_0xa828('0x8')](),controller[_0xa828('0x11')]);router['get'](_0xa828('0x12'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xa828('0x6')](_0xa828('0x13'),auth[_0xa828('0x8')](),controller[_0xa828('0x14')]);router['get'](_0xa828('0x15'),auth['isAuthenticated'](),controller[_0xa828('0x16')]);router[_0xa828('0x6')]('/sms/queues',auth[_0xa828('0x8')](),controller[_0xa828('0x17')]);router[_0xa828('0x6')](_0xa828('0x18'),auth[_0xa828('0x8')](),controller['whatsappQueues']);router[_0xa828('0x6')](_0xa828('0x19'),auth[_0xa828('0x8')](),controller[_0xa828('0x1a')]);router[_0xa828('0x6')](_0xa828('0x1b'),auth[_0xa828('0x8')](),controller['voiceQueuesPreview']);router[_0xa828('0x6')]('/voice/queues/channels',auth[_0xa828('0x8')](),controller['voiceQueuesChannels']);router[_0xa828('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xa828('0x8')](),controller[_0xa828('0x1c')]);router[_0xa828('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xa828('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xa828('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xa828('0x8')](),controller[_0xa828('0x1d')]);router[_0xa828('0x6')]('/voice/queues/:id',auth[_0xa828('0x8')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0xa828('0x8')](),controller[_0xa828('0x1e')]);router[_0xa828('0x6')](_0xa828('0x1f'),auth[_0xa828('0x8')](),controller[_0xa828('0x20')]);router[_0xa828('0x6')](_0xa828('0x21'),auth[_0xa828('0x8')](),controller['outboundChannels']);router[_0xa828('0x6')](_0xa828('0x22'),auth[_0xa828('0x8')](),controller['agents']);router[_0xa828('0x23')]('/agents/:id/capacity',auth[_0xa828('0x8')](),controller[_0xa828('0x24')]);router[_0xa828('0x6')](_0xa828('0x25'),auth[_0xa828('0x8')](),controller[_0xa828('0x26')]);router['get'](_0xa828('0x27'),auth[_0xa828('0x8')](),controller['trunks']);router[_0xa828('0x6')](_0xa828('0x28'),auth[_0xa828('0x8')](),controller[_0xa828('0x29')]);router[_0xa828('0x6')](_0xa828('0x2a'),auth[_0xa828('0x8')](),controller[_0xa828('0x2b')]);router[_0xa828('0x6')](_0xa828('0x2c'),auth[_0xa828('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xa828('0x6')](_0xa828('0x2d'),auth[_0xa828('0x8')](),controller[_0xa828('0x2e')]);router[_0xa828('0x6')](_0xa828('0x2f'),auth['isAuthenticated'](),controller[_0xa828('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xa828('0x31')]);router['get'](_0xa828('0x32'),auth['isAuthenticated'](),controller[_0xa828('0x33')]);router[_0xa828('0x6')](_0xa828('0x34'),auth[_0xa828('0x8')](),controller[_0xa828('0x35')]);router['get'](_0xa828('0x36'),auth[_0xa828('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xa828('0x37')]('/mail/queues/:id/notify',auth[_0xa828('0x8')](),controller[_0xa828('0x38')](_0xa828('0x39')));router[_0xa828('0x6')](_0xa828('0x3a'),auth[_0xa828('0x8')](),controller['showMailQueues']);router['post'](_0xa828('0x3b'),auth[_0xa828('0x8')](),controller[_0xa828('0x38')](_0xa828('0x3c')));router[_0xa828('0x6')](_0xa828('0x3d'),auth['isAuthenticated'](),controller[_0xa828('0x3e')]);router['post']('/fax/queues/:id/notify',auth[_0xa828('0x8')](),controller[_0xa828('0x38')](_0xa828('0x3f')));router[_0xa828('0x6')]('/fax/queues/:id',auth[_0xa828('0x8')](),controller[_0xa828('0x40')]);router[_0xa828('0x37')](_0xa828('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0xa828('0x42')));router[_0xa828('0x6')](_0xa828('0x43'),auth[_0xa828('0x8')](),controller[_0xa828('0x44')]);router[_0xa828('0x37')](_0xa828('0x45'),auth[_0xa828('0x8')](),controller[_0xa828('0x38')]('sms'));router['post'](_0xa828('0x46'),auth[_0xa828('0x8')](),controller[_0xa828('0x38')](_0xa828('0x47')));router[_0xa828('0x6')](_0xa828('0x48'),auth[_0xa828('0x8')](),controller['showSmsQueues']);router[_0xa828('0x6')](_0xa828('0x49'),auth[_0xa828('0x8')](),controller[_0xa828('0x4a')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xa828('0x4b')]);module[_0xa828('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index bc78cfe..1057f90 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 _0x7c29=['voiceChannelStopMixMonitor','params','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','length','updateAttributes','INTERACTION','interface','format','SIP/%s','agent','internal','AgentCapacity','telephones','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Account','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','Website','Agent\x20not\x20found','From','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','client','http','request','then','error','code','message','result','json','sendStatus','name','isNil','find','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','catch'];(function(_0x45b195,_0x224d5a){var _0x99678b=function(_0x19cf9c){while(--_0x19cf9c){_0x45b195['push'](_0x45b195['shift']());}};_0x99678b(++_0x224d5a);}(_0x7c29,0xcf));var _0x97c2=function(_0x17924b,_0x33a951){_0x17924b=_0x17924b-0x0;var _0xfb631f=_0x7c29[_0x17924b];return _0xfb631f;};'use strict';var BPromise=require(_0x97c2('0x0'));var moment=require(_0x97c2('0x1'));var _=require(_0x97c2('0x2'));var util=require(_0x97c2('0x3'));var db=require(_0x97c2('0x4'))['db'];var logger=require(_0x97c2('0x5'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x97c2('0x6')][_0x97c2('0x7')]({'port':0x232a});var mailClient=jayson[_0x97c2('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x97c2('0x6')][_0x97c2('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x25cef4,_0x6f551e,_0x40de61){return new BPromise(function(_0x44fca8,_0x790411){var _0x1d1e19=_0x40de61?_0x40de61:amiClient;return _0x1d1e19[_0x97c2('0x8')](_0x25cef4,_0x6f551e)[_0x97c2('0x9')](function(_0x3c688b){if(_0x3c688b[_0x97c2('0xa')]){if(_0x3c688b['error'][_0x97c2('0xb')]===0x1f4){return _0x790411(_0x3c688b['error'][_0x97c2('0xc')]);}return _0x44fca8(_0x3c688b['error'][_0x97c2('0xc')]);}else{_0x44fca8(_0x3c688b[_0x97c2('0xd')]);}})['catch'](function(_0x1dab43){_0x790411(_0x1dab43);});});}function respondWithResult(_0x40d20d,_0x5cd7f6){_0x5cd7f6=_0x5cd7f6||0xc8;return function(_0x44cdc6){if(_0x44cdc6){return _0x40d20d['status'](_0x5cd7f6)[_0x97c2('0xe')](_0x44cdc6);}return _0x40d20d[_0x97c2('0xf')](0x194);};}function handleError(_0x2a8b54,_0x2a2627){_0x2a2627=_0x2a2627||0x1f4;return function(_0xa67a04){logger[_0x97c2('0xa')](_0xa67a04['stack']);if(_0xa67a04[_0x97c2('0x10')]){delete _0xa67a04[_0x97c2('0x10')];}_0x2a8b54['status'](_0x2a2627)['send'](_0xa67a04);};}function findById(_0x31d1eb){return function(_0x10b010){if(!_[_0x97c2('0x11')](_0x31d1eb)&&!_[_0x97c2('0x11')](_0x10b010)&&!_[_0x97c2('0x11')](_0x10b010['rows'])){return _[_0x97c2('0x12')](_0x10b010['rows'],function(_0x236b0f){return _0x236b0f['id']==_0x31d1eb;});}return null;};}exports['voiceChannels']=function(_0x312f1e,_0x463b6d){return respondWithRpcPromise(_0x97c2('0x13'),_0x312f1e['query'])[_0x97c2('0x9')](respondWithResult(_0x463b6d,null))['catch'](handleError(_0x463b6d,null));};exports[_0x97c2('0x14')]=function(_0xf9f038,_0x3679b2){return respondWithRpcPromise(_0x97c2('0x15'),_[_0x97c2('0x16')](_0xf9f038[_0x97c2('0x17')],_0xf9f038['params']))[_0x97c2('0x9')](respondWithResult(_0x3679b2,null))[_0x97c2('0x18')](handleError(_0x3679b2,null));};exports[_0x97c2('0x19')]=function(_0x3b3d23,_0x2ea76e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x97c2('0x16')](_0x3b3d23[_0x97c2('0x17')],_0x3b3d23[_0x97c2('0x1a')]))[_0x97c2('0x9')](respondWithResult(_0x2ea76e,null))[_0x97c2('0x18')](handleError(_0x2ea76e,null));};exports['voiceQueues']=function(_0x3902a2,_0x4c11e3){return respondWithRpcPromise('VoiceQueues',_0x3902a2[_0x97c2('0x17')])[_0x97c2('0x9')](respondWithResult(_0x4c11e3,null))[_0x97c2('0x18')](handleError(_0x4c11e3,null));};exports['showVoiceQueues']=function(_0x19f407,_0x199cd2){return respondWithRpcPromise('VoiceQueues',_0x19f407[_0x97c2('0x17')])[_0x97c2('0x9')](findById(_0x19f407['params']['id']))['then'](respondWithResult(_0x199cd2,null))[_0x97c2('0x18')](handleError(_0x199cd2,null));};exports['updateVoiceQueue']=function(_0x57558b,_0x56eb40){return respondWithRpcPromise(_0x97c2('0x1b'),_[_0x97c2('0x16')](_0x57558b['body'],_0x57558b[_0x97c2('0x1a')]))[_0x97c2('0x9')](respondWithResult(_0x56eb40,null))[_0x97c2('0x18')](handleError(_0x56eb40,null));};exports[_0x97c2('0x1c')]=function(_0x2d1599,_0x23fb96){return respondWithRpcPromise(_0x97c2('0x1d'),_['merge'](_0x2d1599[_0x97c2('0x17')],_0x2d1599[_0x97c2('0x1a')]))[_0x97c2('0x9')](respondWithResult(_0x23fb96,null))[_0x97c2('0x18')](handleError(_0x23fb96,null));};exports[_0x97c2('0x1e')]=function(_0x2a796d,_0x44bba6){return respondWithRpcPromise('VoiceQueuesChannels',_0x2a796d['query'])[_0x97c2('0x9')](respondWithResult(_0x44bba6,null))[_0x97c2('0x18')](handleError(_0x44bba6,null));};exports['voiceQueuesChannel']=function(_0x5c269a,_0x4ff640){return respondWithRpcPromise(_0x97c2('0x1f'),_[_0x97c2('0x16')](_0x5c269a['query'],_0x5c269a['params']))[_0x97c2('0x9')](respondWithResult(_0x4ff640,null))[_0x97c2('0x18')](handleError(_0x4ff640,null));};exports[_0x97c2('0x20')]=function(_0x22b9ad,_0x28a3a2){return respondWithRpcPromise(_0x97c2('0x21'),_[_0x97c2('0x16')](_0x22b9ad[_0x97c2('0x17')],_0x22b9ad['params']))[_0x97c2('0x9')](respondWithResult(_0x28a3a2,null))['catch'](handleError(_0x28a3a2,null));};exports[_0x97c2('0x22')]=function(_0x3e0620,_0x3127ad){return respondWithRpcPromise(_0x97c2('0x23'),_['merge'](_0x3e0620[_0x97c2('0x17')],_0x3e0620['params']))[_0x97c2('0x9')](respondWithResult(_0x3127ad,null))[_0x97c2('0x18')](handleError(_0x3127ad,null));};exports['outbound']=function(_0x29abf4,_0x21106f){return respondWithRpcPromise(_0x97c2('0x24'),_0x29abf4[_0x97c2('0x17')])[_0x97c2('0x9')](respondWithResult(_0x21106f,null))[_0x97c2('0x18')](handleError(_0x21106f,null));};exports[_0x97c2('0x25')]=function(_0x4cea45,_0x18f9a6){return respondWithRpcPromise(_0x97c2('0x26'),_0x4cea45[_0x97c2('0x17')])['then'](respondWithResult(_0x18f9a6,null))[_0x97c2('0x18')](handleError(_0x18f9a6,null));};exports[_0x97c2('0x27')]=function(_0x567e07,_0x450768){var _0xbaf3ee;return respondWithRpcPromise(_0x97c2('0x28'),_0x567e07['query'])[_0x97c2('0x9')](function(_0xc23fc7){_0xbaf3ee=_0xc23fc7;return respondWithRpcPromise(_0x97c2('0x28'),_0x567e07[_0x97c2('0x17')],routingClient);})[_0x97c2('0x9')](function(_0x2019da){return _[_0x97c2('0x16')]({},_0x2019da,_0xbaf3ee);})[_0x97c2('0x9')](respondWithResult(_0x450768,null))['catch'](handleError(_0x450768,null));};exports[_0x97c2('0x29')]=function(_0x1652d1,_0x3f5b50){if(_0x1652d1['body']&&_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')]&&_0x1652d1['user']&&_0x1652d1[_0x97c2('0x2c')][_0x97c2('0x10')]){for(var _0x2e51dc in _0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')]){if(_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x97c2('0x2d')](_0x2e51dc)){db['MemberReport']['findAll']({'where':{'channel':_0x2e51dc,'membername':_0x1652d1[_0x97c2('0x2c')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc]&&_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc][_0x97c2('0x2e')]?{'$notIn':_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc]}:{'$ne':null}}})[_0x97c2('0x9')](function(_0x21d24e){var _0x1b58af=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x117ab3=0x0,_0x547ded=_0x21d24e[_0x97c2('0x2e')];_0x117ab3<_0x547ded;_0x117ab3+=0x1){_0x21d24e[_0x117ab3][_0x97c2('0x2f')]({'exitAt':_0x1b58af});}});for(var _0x35d48f=0x0;_0x35d48f<_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc][_0x97c2('0x2e')];_0x35d48f+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x2e51dc,'membername':_0x1652d1[_0x97c2('0x2c')]['name'],'type':_0x97c2('0x30'),'uniqueid':_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc][_0x35d48f],'exitAt':null},'defaults':{'channel':_0x2e51dc,'membername':_0x1652d1[_0x97c2('0x2c')][_0x97c2('0x10')],'interface':_[_0x97c2('0x11')](_0x1652d1[_0x97c2('0x2c')][_0x97c2('0x31')])?util[_0x97c2('0x32')](_0x97c2('0x33'),_0x1652d1['user'][_0x97c2('0x10')]):_0x1652d1[_0x97c2('0x2c')][_0x97c2('0x31')],'type':_0x97c2('0x30'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x97c2('0x34'),'internal':_0x1652d1[_0x97c2('0x2c')][_0x97c2('0x35')],'uniqueid':_0x1652d1[_0x97c2('0x2a')][_0x97c2('0x2b')][_0x2e51dc][_0x35d48f]}});}}}}return respondWithRpcPromise(_0x97c2('0x36'),{'id':_0x1652d1['params']['id'],'capacity':_0x1652d1[_0x97c2('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x3f5b50,null))[_0x97c2('0x18')](handleError(_0x3f5b50,null));};exports[_0x97c2('0x37')]=function(_0x8ce794,_0x337190){return respondWithRpcPromise('Telephones',_0x8ce794['query'])['then'](respondWithResult(_0x337190,null))[_0x97c2('0x18')](handleError(_0x337190,null));};exports['trunks']=function(_0x37d74a,_0x14499e){return respondWithRpcPromise(_0x97c2('0x38'),_0x37d74a['query'])[_0x97c2('0x9')](respondWithResult(_0x14499e,null))['catch'](handleError(_0x14499e,null));};exports['campaigns']=function(_0xaafc40,_0x5d5be9){return respondWithRpcPromise(_0x97c2('0x39'),_0xaafc40[_0x97c2('0x17')])[_0x97c2('0x9')](respondWithResult(_0x5d5be9,null))[_0x97c2('0x18')](handleError(_0x5d5be9,null));};exports['chatQueues']=function(_0x38e85e,_0x1ee317){return respondWithRpcPromise(_0x97c2('0x3a'),_0x38e85e[_0x97c2('0x17')],routingClient)['then'](respondWithResult(_0x1ee317,null))[_0x97c2('0x18')](handleError(_0x1ee317,null));};exports[_0x97c2('0x3b')]=function(_0x3daa57,_0x47aec2){return respondWithRpcPromise('ChatQueues',_0x3daa57['query'],routingClient)[_0x97c2('0x9')](findById(_0x3daa57[_0x97c2('0x1a')]['id']))[_0x97c2('0x9')](respondWithResult(_0x47aec2,null))[_0x97c2('0x18')](handleError(_0x47aec2,null));};exports[_0x97c2('0x3c')]=function(_0x495796,_0x101f0c){return respondWithRpcPromise(_0x97c2('0x3d'),_0x495796[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x101f0c,null))[_0x97c2('0x18')](handleError(_0x101f0c,null));};exports[_0x97c2('0x3e')]=function(_0x24d23a,_0x384b6e){return respondWithRpcPromise('MailQueues',_0x24d23a['query'],routingClient)[_0x97c2('0x9')](findById(_0x24d23a['params']['id']))[_0x97c2('0x9')](respondWithResult(_0x384b6e,null))['catch'](handleError(_0x384b6e,null));};exports[_0x97c2('0x3f')]=function(_0x42f085,_0x28959d){return respondWithRpcPromise(_0x97c2('0x40'),_0x42f085[_0x97c2('0x17')],mailClient)[_0x97c2('0x9')](respondWithResult(_0x28959d,null))[_0x97c2('0x18')](handleError(_0x28959d,null));};exports['openchannelQueues']=function(_0x11c34e,_0xd216bf){return respondWithRpcPromise(_0x97c2('0x41'),_0x11c34e[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0xd216bf,null))[_0x97c2('0x18')](handleError(_0xd216bf,null));};exports[_0x97c2('0x42')]=function(_0x34c8a7,_0x13b053){return respondWithRpcPromise(_0x97c2('0x41'),_0x34c8a7[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](findById(_0x34c8a7['params']['id']))[_0x97c2('0x9')](respondWithResult(_0x13b053,null))[_0x97c2('0x18')](handleError(_0x13b053,null));};exports[_0x97c2('0x43')]=function(_0x36877e,_0x45a9fc){return respondWithRpcPromise('SmsQueues',_0x36877e['query'],routingClient)[_0x97c2('0x9')](respondWithResult(_0x45a9fc,null))[_0x97c2('0x18')](handleError(_0x45a9fc,null));};exports['showSmsQueues']=function(_0x362c15,_0x3ae3c7){return respondWithRpcPromise('SmsQueues',_0x362c15[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](findById(_0x362c15[_0x97c2('0x1a')]['id']))['then'](respondWithResult(_0x3ae3c7,null))[_0x97c2('0x18')](handleError(_0x3ae3c7,null));};exports[_0x97c2('0x44')]=function(_0x19ca6e,_0x4e4589){return respondWithRpcPromise(_0x97c2('0x45'),_0x19ca6e[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x4e4589,null))[_0x97c2('0x18')](handleError(_0x4e4589,null));};exports['showWhatsappQueues']=function(_0x21fc1f,_0x4333a7){return respondWithRpcPromise(_0x97c2('0x45'),_0x21fc1f[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](findById(_0x21fc1f[_0x97c2('0x1a')]['id']))[_0x97c2('0x9')](respondWithResult(_0x4333a7,null))['catch'](handleError(_0x4333a7,null));};exports['faxQueues']=function(_0x3ad1bb,_0x4ce081){return respondWithRpcPromise(_0x97c2('0x46'),_0x3ad1bb[_0x97c2('0x17')],routingClient)['then'](respondWithResult(_0x4ce081,null))[_0x97c2('0x18')](handleError(_0x4ce081,null));};exports[_0x97c2('0x47')]=function(_0x53c450,_0x487e3f){return respondWithRpcPromise('FaxQueues',_0x53c450['query'],routingClient)['then'](findById(_0x53c450[_0x97c2('0x1a')]['id']))[_0x97c2('0x9')](respondWithResult(_0x487e3f,null))['catch'](handleError(_0x487e3f,null));};exports['faxAccounts']=function(_0x1d0c3e,_0x39eb4e){return respondWithRpcPromise(_0x97c2('0x48'),_0x1d0c3e['query'])[_0x97c2('0x9')](respondWithResult(_0x39eb4e,null))[_0x97c2('0x18')](handleError(_0x39eb4e,null));};exports[_0x97c2('0x49')]=function(_0x2be0c7,_0x315ad2){return respondWithRpcPromise(_0x97c2('0x4a'),_0x2be0c7[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x315ad2,null))[_0x97c2('0x18')](handleError(_0x315ad2,null));};exports[_0x97c2('0x4b')]=function(_0x518576,_0x427f45){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x518576[_0x97c2('0x17')],routingClient)['then'](respondWithResult(_0x427f45,null))[_0x97c2('0x18')](handleError(_0x427f45,null));};exports[_0x97c2('0x4c')]=function(_0x38a33a,_0x2e3471){return respondWithRpcPromise(_0x97c2('0x4d'),_0x38a33a[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x2e3471,null))[_0x97c2('0x18')](handleError(_0x2e3471,null));};exports[_0x97c2('0x4e')]=function(_0x44f392,_0x5bd5e5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x44f392[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](function(_0x164e75){if(_0x44f392[_0x97c2('0x17')][_0x97c2('0x4f')]!==undefined){var _0x53f517=_(_0x164e75[_0x97c2('0x50')])[_0x97c2('0x51')]([_0x44f392[_0x97c2('0x17')][_0x97c2('0x4f')],_0x44f392[_0x97c2('0x1a')]['id']])[_0x97c2('0x52')]('queue_id')[_0x97c2('0x53')]()[_0x97c2('0x54')]();return _0x164e75[_0x97c2('0x50')][_0x97c2('0x51')](function(_0x5bff3d){return _0x53f517[_0x97c2('0x55')](_0x5bff3d[_0x97c2('0x56')])>-0x1;});}else{return _0x164e75['rows'][_0x97c2('0x51')](function(_0x273546){return _0x273546[_0x97c2('0x56')]===parseInt(_0x44f392[_0x97c2('0x1a')]['id']);});}})[_0x97c2('0x9')](respondWithResult(_0x5bd5e5,null))[_0x97c2('0x18')](handleError(_0x5bd5e5,null));};exports[_0x97c2('0x57')]=function(_0x43d830,_0x323933){return respondWithRpcPromise(_0x97c2('0x58'),_0x43d830[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x323933,null))[_0x97c2('0x18')](handleError(_0x323933,null));};exports[_0x97c2('0x59')]=function(_0x18fa43,_0x3d0c24){return respondWithRpcPromise(_0x97c2('0x5a'),_0x18fa43[_0x97c2('0x17')],routingClient)[_0x97c2('0x9')](respondWithResult(_0x3d0c24,null))['catch'](handleError(_0x3d0c24,null));};exports[_0x97c2('0x5b')]=function(_0x3eaf63,_0x43fd5d){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x3eaf63['query'],routingClient)[_0x97c2('0x9')](respondWithResult(_0x43fd5d,null))[_0x97c2('0x18')](handleError(_0x43fd5d,null));};exports[_0x97c2('0x5c')]=function(_0x35d231){return function(_0x3e913d,_0x18f1d1){var _0x196d19,_0x5976da;var _0x4dab68=_[_0x97c2('0x5d')](_0x35d231);var _0x25087e=_0x35d231==='chat'?'Website':_0x97c2('0x5e');return db[_0x4dab68+'Queue'][_0x97c2('0x5f')]({'raw':!![],'where':{'id':_0x3e913d['params']['id']}})[_0x97c2('0x9')](function(_0x25ac94){if(_[_0x97c2('0x11')](_0x25ac94)){throw new Error(_0x4dab68+'\x20Queue\x20not\x20found');}_0x196d19=_0x25ac94;return db[_0x4dab68+'Message']['findOne']({'where':{'id':_0x3e913d['body'][_0x97c2('0x60')]},'include':[{'model':db[_0x4dab68+'Interaction'],'as':_0x97c2('0x61')},{'model':db[_0x4dab68+_0x25087e],'as':_0x97c2('0x5e')}]});})['then'](function(_0x605f90){if(_['isNil'](_0x605f90)){throw new Error(_0x4dab68+_0x97c2('0x62'));}_0x5976da=_0x605f90;return _0x605f90[_0x97c2('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x97c2('0x9')](function(){var _0x2d7636={'uniqueid':_0x35d231+'.'+_0x5976da['id']+'.'+_0x5976da[_0x97c2('0x61')]['id'],'FromUserId':_0x3e913d[_0x97c2('0x2c')]['id'],'type':_0x97c2('0x64')};_0x2d7636[_0x4dab68+_0x97c2('0x65')]=_0x5976da['id'];_0x2d7636[_0x4dab68+'InteractionId']=_0x5976da[_0x97c2('0x61')]['id'];_0x2d7636['From'+_0x4dab68+_0x25087e+'Id']=_0x5976da[_0x97c2('0x5e')]['id'];_0x2d7636['To'+_0x4dab68+_0x97c2('0x66')]=_0x196d19['id'];return db[_0x4dab68+_0x97c2('0x67')][_0x97c2('0x68')](_0x2d7636);})[_0x97c2('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x35d231,'interaction':_0x5976da[_0x97c2('0x61')],'message':_0x5976da,'account':_0x5976da[_0x97c2('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c2('0x64'),'appdata':_0x196d19[_0x97c2('0x10')]+','+(_0x5976da[_0x97c2('0x5e')][_0x97c2('0x69')]||0x12c),'interval':_0x97c2('0x6a')}]},routingClient);})[_0x97c2('0x9')](respondWithResult(_0x18f1d1,null))['catch'](handleError(_0x18f1d1,null));};};exports[_0x97c2('0x6b')]=function(_0x489cbb,_0x512706){var _0x400432,_0x446b42;if(_[_0x97c2('0x11')](_0x489cbb[_0x97c2('0x2a')][_0x97c2('0x6c')])){throw new Error(_0x97c2('0x6d'));}var _0x48ba82=_0x489cbb[_0x97c2('0x2a')][_0x97c2('0x6c')];var _0x5e8df9=_[_0x97c2('0x5d')](_0x48ba82);var _0x17dfab=_0x48ba82===_0x97c2('0x6e')?_0x97c2('0x6f'):_0x97c2('0x5e');return db['User'][_0x97c2('0x5f')]({'raw':!![],'where':{'id':_0x489cbb[_0x97c2('0x1a')]['id'],'role':'agent'}})[_0x97c2('0x9')](function(_0x4fa2c3){if(_[_0x97c2('0x11')](_0x4fa2c3)){throw new Error(_0x97c2('0x70'));}_0x400432=_0x4fa2c3;return db[_0x5e8df9+'Message'][_0x97c2('0x5f')]({'where':{'id':_0x489cbb[_0x97c2('0x2a')][_0x97c2('0x60')]},'include':[{'model':db[_0x5e8df9+'Interaction'],'as':_0x97c2('0x61')},{'model':db[_0x5e8df9+_0x17dfab],'as':_0x97c2('0x5e')}]});})['then'](function(_0x1e11c7){if(_[_0x97c2('0x11')](_0x1e11c7)){throw new Error(_0x5e8df9+'\x20Message\x20not\x20found');}_0x446b42=_0x1e11c7;return _0x1e11c7[_0x97c2('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x97c2('0x9')](function(){var _0x1f4ebd={'uniqueid':_0x48ba82+'.'+_0x446b42['id']+'.'+_0x446b42['Interaction']['id'],'FromUserId':_0x489cbb['user']['id'],'type':_0x97c2('0x64'),'ToUserId':_0x400432['id']};_0x1f4ebd[_0x5e8df9+_0x97c2('0x65')]=_0x446b42['id'];_0x1f4ebd[_0x5e8df9+'InteractionId']=_0x446b42[_0x97c2('0x61')]['id'];_0x1f4ebd[_0x97c2('0x71')+_0x5e8df9+_0x17dfab+'Id']=_0x446b42[_0x97c2('0x5e')]['id'];return db[_0x5e8df9+'TransferReport']['create'](_0x1f4ebd);})['then'](function(){return respondWithRpcPromise(_0x97c2('0x72'),{'channel':_0x48ba82,'interaction':_0x446b42[_0x97c2('0x61')],'message':_0x446b42,'account':_0x446b42[_0x97c2('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c2('0x34'),'appdata':_0x400432[_0x97c2('0x10')]+','+(_0x446b42['Account'][_0x97c2('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x512706,null))[_0x97c2('0x18')](handleError(_0x512706,null));}; \ No newline at end of file +var _0xf1fa=['voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','messageId','Start','agentTransferTimeout','*,*,*,*','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','http','client','request','error','code','message','result','catch','status','json','sendStatus','stack','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xf1fa,0x15c));var _0xaf1f=function(_0x36fcaf,_0x2d8d1c){_0x36fcaf=_0x36fcaf-0x0;var _0x121f71=_0xf1fa[_0x36fcaf];return _0x121f71;};'use strict';var BPromise=require(_0xaf1f('0x0'));var moment=require(_0xaf1f('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xaf1f('0x2'))['db'];var logger=require(_0xaf1f('0x3'))('api');var jayson=require(_0xaf1f('0x4'));var amiClient=jayson['client'][_0xaf1f('0x5')]({'port':0x232a});var mailClient=jayson[_0xaf1f('0x6')][_0xaf1f('0x5')]({'port':0x232b});var routingClient=jayson[_0xaf1f('0x6')][_0xaf1f('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xcbbdce,_0x43dfea,_0x2ea809){return new BPromise(function(_0x10a92f,_0x1b7227){var _0x198bd4=_0x2ea809?_0x2ea809:amiClient;return _0x198bd4[_0xaf1f('0x7')](_0xcbbdce,_0x43dfea)['then'](function(_0x178580){if(_0x178580[_0xaf1f('0x8')]){if(_0x178580[_0xaf1f('0x8')][_0xaf1f('0x9')]===0x1f4){return _0x1b7227(_0x178580['error'][_0xaf1f('0xa')]);}return _0x10a92f(_0x178580[_0xaf1f('0x8')][_0xaf1f('0xa')]);}else{_0x10a92f(_0x178580[_0xaf1f('0xb')]);}})[_0xaf1f('0xc')](function(_0x43cca1){_0x1b7227(_0x43cca1);});});}function respondWithResult(_0x2e75b6,_0x979a5c){_0x979a5c=_0x979a5c||0xc8;return function(_0x429357){if(_0x429357){return _0x2e75b6[_0xaf1f('0xd')](_0x979a5c)[_0xaf1f('0xe')](_0x429357);}return _0x2e75b6[_0xaf1f('0xf')](0x194);};}function handleError(_0x50d2be,_0x511eb9){_0x511eb9=_0x511eb9||0x1f4;return function(_0x4c7f3a){logger['error'](_0x4c7f3a[_0xaf1f('0x10')]);if(_0x4c7f3a['name']){delete _0x4c7f3a['name'];}_0x50d2be['status'](_0x511eb9)['send'](_0x4c7f3a);};}function findById(_0x40603f){return function(_0x552f45){if(!_[_0xaf1f('0x11')](_0x40603f)&&!_['isNil'](_0x552f45)&&!_[_0xaf1f('0x11')](_0x552f45[_0xaf1f('0x12')])){return _[_0xaf1f('0x13')](_0x552f45[_0xaf1f('0x12')],function(_0x27b891){return _0x27b891['id']==_0x40603f;});}return null;};}exports[_0xaf1f('0x14')]=function(_0x5afb69,_0x34b739){return respondWithRpcPromise(_0xaf1f('0x15'),_0x5afb69[_0xaf1f('0x16')])['then'](respondWithResult(_0x34b739,null))['catch'](handleError(_0x34b739,null));};exports[_0xaf1f('0x17')]=function(_0x34be0b,_0x1e9b6f){return respondWithRpcPromise(_0xaf1f('0x18'),_[_0xaf1f('0x19')](_0x34be0b[_0xaf1f('0x16')],_0x34be0b[_0xaf1f('0x1a')]))[_0xaf1f('0x1b')](respondWithResult(_0x1e9b6f,null))[_0xaf1f('0xc')](handleError(_0x1e9b6f,null));};exports[_0xaf1f('0x1c')]=function(_0x46f0b4,_0x49aa6b){return respondWithRpcPromise(_0xaf1f('0x1d'),_[_0xaf1f('0x19')](_0x46f0b4[_0xaf1f('0x16')],_0x46f0b4[_0xaf1f('0x1a')]))[_0xaf1f('0x1b')](respondWithResult(_0x49aa6b,null))[_0xaf1f('0xc')](handleError(_0x49aa6b,null));};exports[_0xaf1f('0x1e')]=function(_0x220605,_0x1e44f0){return respondWithRpcPromise('VoiceQueues',_0x220605[_0xaf1f('0x16')])[_0xaf1f('0x1b')](respondWithResult(_0x1e44f0,null))[_0xaf1f('0xc')](handleError(_0x1e44f0,null));};exports[_0xaf1f('0x1f')]=function(_0x1b0300,_0x53627f){return respondWithRpcPromise(_0xaf1f('0x20'),_0x1b0300[_0xaf1f('0x16')])[_0xaf1f('0x1b')](findById(_0x1b0300['params']['id']))['then'](respondWithResult(_0x53627f,null))[_0xaf1f('0xc')](handleError(_0x53627f,null));};exports[_0xaf1f('0x21')]=function(_0x1a0f07,_0x2ddf27){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xaf1f('0x19')](_0x1a0f07[_0xaf1f('0x22')],_0x1a0f07[_0xaf1f('0x1a')]))[_0xaf1f('0x1b')](respondWithResult(_0x2ddf27,null))[_0xaf1f('0xc')](handleError(_0x2ddf27,null));};exports[_0xaf1f('0x23')]=function(_0x184520,_0x5384e3){return respondWithRpcPromise(_0xaf1f('0x24'),_[_0xaf1f('0x19')](_0x184520[_0xaf1f('0x16')],_0x184520[_0xaf1f('0x1a')]))[_0xaf1f('0x1b')](respondWithResult(_0x5384e3,null))['catch'](handleError(_0x5384e3,null));};exports[_0xaf1f('0x25')]=function(_0x2fda34,_0x4ad137){return respondWithRpcPromise('VoiceQueuesChannels',_0x2fda34[_0xaf1f('0x16')])[_0xaf1f('0x1b')](respondWithResult(_0x4ad137,null))['catch'](handleError(_0x4ad137,null));};exports[_0xaf1f('0x26')]=function(_0x5c32f5,_0x110ed9){return respondWithRpcPromise(_0xaf1f('0x27'),_[_0xaf1f('0x19')](_0x5c32f5[_0xaf1f('0x16')],_0x5c32f5['params']))['then'](respondWithResult(_0x110ed9,null))['catch'](handleError(_0x110ed9,null));};exports[_0xaf1f('0x28')]=function(_0x25631a,_0x199d24){return respondWithRpcPromise(_0xaf1f('0x29'),_[_0xaf1f('0x19')](_0x25631a[_0xaf1f('0x16')],_0x25631a['params']))['then'](respondWithResult(_0x199d24,null))[_0xaf1f('0xc')](handleError(_0x199d24,null));};exports[_0xaf1f('0x2a')]=function(_0x8b46c6,_0x471801){return respondWithRpcPromise(_0xaf1f('0x2b'),_[_0xaf1f('0x19')](_0x8b46c6[_0xaf1f('0x16')],_0x8b46c6['params']))['then'](respondWithResult(_0x471801,null))[_0xaf1f('0xc')](handleError(_0x471801,null));};exports[_0xaf1f('0x2c')]=function(_0x34a480,_0x3743c2){return respondWithRpcPromise(_0xaf1f('0x2d'),_0x34a480[_0xaf1f('0x16')])[_0xaf1f('0x1b')](respondWithResult(_0x3743c2,null))['catch'](handleError(_0x3743c2,null));};exports[_0xaf1f('0x2e')]=function(_0x474723,_0x4a0c50){return respondWithRpcPromise('OutboundChannels',_0x474723[_0xaf1f('0x16')])[_0xaf1f('0x1b')](respondWithResult(_0x4a0c50,null))[_0xaf1f('0xc')](handleError(_0x4a0c50,null));};exports[_0xaf1f('0x2f')]=function(_0x50b9db,_0x16d9af){var _0x1774e9;return respondWithRpcPromise(_0xaf1f('0x30'),_0x50b9db[_0xaf1f('0x16')])['then'](function(_0x2d5810){_0x1774e9=_0x2d5810;return respondWithRpcPromise('Agents',_0x50b9db[_0xaf1f('0x16')],routingClient);})[_0xaf1f('0x1b')](function(_0x454cee){return _['merge']({},_0x454cee,_0x1774e9);})['then'](respondWithResult(_0x16d9af,null))[_0xaf1f('0xc')](handleError(_0x16d9af,null));};exports[_0xaf1f('0x31')]=function(_0x160a85,_0x27369c){if(_0x160a85[_0xaf1f('0x22')]&&_0x160a85[_0xaf1f('0x22')]['interaction']&&_0x160a85[_0xaf1f('0x32')]&&_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x33')]){for(var _0x20f4ee in _0x160a85['body']['interaction']){if(_0x160a85['body']['interaction'][_0xaf1f('0x34')](_0x20f4ee)){db[_0xaf1f('0x35')][_0xaf1f('0x36')]({'where':{'channel':_0x20f4ee,'membername':_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x33')],'type':_0xaf1f('0x37'),'exitAt':null,'uniqueid':_0x160a85['body']['interaction'][_0x20f4ee]&&_0x160a85[_0xaf1f('0x22')][_0xaf1f('0x38')][_0x20f4ee]['length']?{'$notIn':_0x160a85[_0xaf1f('0x22')][_0xaf1f('0x38')][_0x20f4ee]}:{'$ne':null}}})['then'](function(_0x317e7a){var _0xdd3313=moment()['format'](_0xaf1f('0x39'));for(var _0x259556=0x0,_0x2d6a93=_0x317e7a[_0xaf1f('0x3a')];_0x259556<_0x2d6a93;_0x259556+=0x1){_0x317e7a[_0x259556][_0xaf1f('0x3b')]({'exitAt':_0xdd3313});}});for(var _0x3ca02e=0x0;_0x3ca02e<_0x160a85['body'][_0xaf1f('0x38')][_0x20f4ee][_0xaf1f('0x3a')];_0x3ca02e+=0x1){db['MemberReport'][_0xaf1f('0x3c')]({'where':{'channel':_0x20f4ee,'membername':_0x160a85['user']['name'],'type':_0xaf1f('0x37'),'uniqueid':_0x160a85[_0xaf1f('0x22')][_0xaf1f('0x38')][_0x20f4ee][_0x3ca02e],'exitAt':null},'defaults':{'channel':_0x20f4ee,'membername':_0x160a85['user'][_0xaf1f('0x33')],'interface':_[_0xaf1f('0x11')](_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x3d')])?util[_0xaf1f('0x3e')](_0xaf1f('0x3f'),_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x33')]):_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x3d')],'type':_0xaf1f('0x37'),'enterAt':moment()[_0xaf1f('0x3e')](_0xaf1f('0x39')),'role':_0xaf1f('0x40'),'internal':_0x160a85[_0xaf1f('0x32')][_0xaf1f('0x41')],'uniqueid':_0x160a85[_0xaf1f('0x22')][_0xaf1f('0x38')][_0x20f4ee][_0x3ca02e]}});}}}}return respondWithRpcPromise(_0xaf1f('0x42'),{'id':_0x160a85[_0xaf1f('0x1a')]['id'],'capacity':_0x160a85[_0xaf1f('0x22')]['capacity']},routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x27369c,null))[_0xaf1f('0xc')](handleError(_0x27369c,null));};exports[_0xaf1f('0x43')]=function(_0x419c39,_0xb5cc6){return respondWithRpcPromise(_0xaf1f('0x44'),_0x419c39[_0xaf1f('0x16')])[_0xaf1f('0x1b')](respondWithResult(_0xb5cc6,null))['catch'](handleError(_0xb5cc6,null));};exports[_0xaf1f('0x45')]=function(_0x437f13,_0x3a179b){return respondWithRpcPromise(_0xaf1f('0x46'),_0x437f13[_0xaf1f('0x16')])['then'](respondWithResult(_0x3a179b,null))[_0xaf1f('0xc')](handleError(_0x3a179b,null));};exports[_0xaf1f('0x47')]=function(_0x2ee562,_0x2b534c){return respondWithRpcPromise(_0xaf1f('0x48'),_0x2ee562[_0xaf1f('0x16')])['then'](respondWithResult(_0x2b534c,null))['catch'](handleError(_0x2b534c,null));};exports[_0xaf1f('0x49')]=function(_0x9b2497,_0x4e7e16){return respondWithRpcPromise(_0xaf1f('0x4a'),_0x9b2497[_0xaf1f('0x16')],routingClient)['then'](respondWithResult(_0x4e7e16,null))['catch'](handleError(_0x4e7e16,null));};exports['showChatQueues']=function(_0x2403a7,_0x3b4c9f){return respondWithRpcPromise('ChatQueues',_0x2403a7[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](findById(_0x2403a7[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x3b4c9f,null))['catch'](handleError(_0x3b4c9f,null));};exports[_0xaf1f('0x4b')]=function(_0x286677,_0x289a24){return respondWithRpcPromise(_0xaf1f('0x4c'),_0x286677[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x289a24,null))[_0xaf1f('0xc')](handleError(_0x289a24,null));};exports['showMailQueues']=function(_0x4c9412,_0x356f3c){return respondWithRpcPromise(_0xaf1f('0x4c'),_0x4c9412[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](findById(_0x4c9412[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x356f3c,null))['catch'](handleError(_0x356f3c,null));};exports[_0xaf1f('0x4d')]=function(_0x4b7876,_0x59a641){return respondWithRpcPromise('MailAccounts',_0x4b7876[_0xaf1f('0x16')],mailClient)[_0xaf1f('0x1b')](respondWithResult(_0x59a641,null))['catch'](handleError(_0x59a641,null));};exports[_0xaf1f('0x4e')]=function(_0x3ecc3e,_0xa325b5){return respondWithRpcPromise(_0xaf1f('0x4f'),_0x3ecc3e[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0xa325b5,null))[_0xaf1f('0xc')](handleError(_0xa325b5,null));};exports['showOpenchannelQueues']=function(_0x388a5c,_0x32eb65){return respondWithRpcPromise(_0xaf1f('0x4f'),_0x388a5c[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](findById(_0x388a5c[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x32eb65,null))['catch'](handleError(_0x32eb65,null));};exports[_0xaf1f('0x50')]=function(_0x57c26e,_0x3d1d77){return respondWithRpcPromise('SmsQueues',_0x57c26e[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x3d1d77,null))[_0xaf1f('0xc')](handleError(_0x3d1d77,null));};exports['showSmsQueues']=function(_0x5d669d,_0x43e8c1){return respondWithRpcPromise(_0xaf1f('0x51'),_0x5d669d[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](findById(_0x5d669d[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x43e8c1,null))[_0xaf1f('0xc')](handleError(_0x43e8c1,null));};exports[_0xaf1f('0x52')]=function(_0x3c56f,_0x42d4ca){return respondWithRpcPromise(_0xaf1f('0x53'),_0x3c56f[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x42d4ca,null))[_0xaf1f('0xc')](handleError(_0x42d4ca,null));};exports['showWhatsappQueues']=function(_0x5f01b1,_0x5cc64f){return respondWithRpcPromise(_0xaf1f('0x53'),_0x5f01b1[_0xaf1f('0x16')],routingClient)['then'](findById(_0x5f01b1[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x5cc64f,null))[_0xaf1f('0xc')](handleError(_0x5cc64f,null));};exports['faxQueues']=function(_0xb9aad5,_0xd90fb2){return respondWithRpcPromise(_0xaf1f('0x54'),_0xb9aad5[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0xd90fb2,null))[_0xaf1f('0xc')](handleError(_0xd90fb2,null));};exports[_0xaf1f('0x55')]=function(_0x2e6f3d,_0x32c75b){return respondWithRpcPromise(_0xaf1f('0x54'),_0x2e6f3d[_0xaf1f('0x16')],routingClient)['then'](findById(_0x2e6f3d[_0xaf1f('0x1a')]['id']))[_0xaf1f('0x1b')](respondWithResult(_0x32c75b,null))[_0xaf1f('0xc')](handleError(_0x32c75b,null));};exports['faxAccounts']=function(_0x328638,_0x44f2cc){return respondWithRpcPromise('FaxAccounts',_0x328638['query'])[_0xaf1f('0x1b')](respondWithResult(_0x44f2cc,null))[_0xaf1f('0xc')](handleError(_0x44f2cc,null));};exports[_0xaf1f('0x56')]=function(_0x1fb071,_0x3f64e5){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1fb071[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x3f64e5,null))[_0xaf1f('0xc')](handleError(_0x3f64e5,null));};exports[_0xaf1f('0x57')]=function(_0xd22399,_0x105dd1){return respondWithRpcPromise(_0xaf1f('0x58'),_0xd22399[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x105dd1,null))[_0xaf1f('0xc')](handleError(_0x105dd1,null));};exports[_0xaf1f('0x59')]=function(_0x410256,_0x209682){return respondWithRpcPromise(_0xaf1f('0x5a'),_0x410256['query'],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x209682,null))[_0xaf1f('0xc')](handleError(_0x209682,null));};exports[_0xaf1f('0x5b')]=function(_0x2a8f7f,_0x109b31){return respondWithRpcPromise(_0xaf1f('0x5a'),_0x2a8f7f['query'],routingClient)[_0xaf1f('0x1b')](function(_0x2c8030){if(_0x2a8f7f['query'][_0xaf1f('0x5c')]!==undefined){var _0x36512a=_(_0x2c8030[_0xaf1f('0x12')])[_0xaf1f('0x5d')]([_0x2a8f7f[_0xaf1f('0x16')][_0xaf1f('0x5c')],_0x2a8f7f[_0xaf1f('0x1a')]['id']])[_0xaf1f('0x5e')](_0xaf1f('0x5f'))[_0xaf1f('0x60')]()['value']();return _0x2c8030['rows'][_0xaf1f('0x5d')](function(_0xbf74e5){return _0x36512a['indexOf'](_0xbf74e5[_0xaf1f('0x5f')])>-0x1;});}else{return _0x2c8030[_0xaf1f('0x12')][_0xaf1f('0x5d')](function(_0x1872e7){return _0x1872e7[_0xaf1f('0x5f')]===parseInt(_0x2a8f7f['params']['id']);});}})['then'](respondWithResult(_0x109b31,null))[_0xaf1f('0xc')](handleError(_0x109b31,null));};exports[_0xaf1f('0x61')]=function(_0x562816,_0x147e33){return respondWithRpcPromise(_0xaf1f('0x62'),_0x562816[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x147e33,null))[_0xaf1f('0xc')](handleError(_0x147e33,null));};exports[_0xaf1f('0x63')]=function(_0x5b7d2c,_0x163d33){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x5b7d2c[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x163d33,null))[_0xaf1f('0xc')](handleError(_0x163d33,null));};exports[_0xaf1f('0x64')]=function(_0x82a0d9,_0x2e782f){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x82a0d9[_0xaf1f('0x16')],routingClient)[_0xaf1f('0x1b')](respondWithResult(_0x2e782f,null))['catch'](handleError(_0x2e782f,null));};exports[_0xaf1f('0x65')]=function(_0x3ecb1d){return function(_0x35f050,_0x45f87c){var _0x4a082b,_0x2c4e38;var _0x4cb391=_[_0xaf1f('0x66')](_0x3ecb1d);var _0x92aa10=_0x3ecb1d===_0xaf1f('0x67')?_0xaf1f('0x68'):_0xaf1f('0x69');return db[_0x4cb391+_0xaf1f('0x6a')][_0xaf1f('0x6b')]({'raw':!![],'where':{'id':_0x35f050['params']['id']}})[_0xaf1f('0x1b')](function(_0x4ed140){if(_[_0xaf1f('0x11')](_0x4ed140)){throw new Error(_0x4cb391+'\x20Queue\x20not\x20found');}_0x4a082b=_0x4ed140;return db[_0x4cb391+_0xaf1f('0x6c')][_0xaf1f('0x6b')]({'where':{'id':_0x35f050[_0xaf1f('0x22')]['messageId']},'include':[{'model':db[_0x4cb391+_0xaf1f('0x6d')],'as':_0xaf1f('0x6d')},{'model':db[_0x4cb391+_0x92aa10],'as':_0xaf1f('0x69')}]});})[_0xaf1f('0x1b')](function(_0x47602e){if(_[_0xaf1f('0x11')](_0x47602e)){throw new Error(_0x4cb391+_0xaf1f('0x6e'));}_0x2c4e38=_0x47602e;return _0x47602e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xaf1f('0x1b')](function(){var _0x3ee14c={'uniqueid':_0x3ecb1d+'.'+_0x2c4e38['id']+'.'+_0x2c4e38[_0xaf1f('0x6d')]['id'],'FromUserId':_0x35f050[_0xaf1f('0x32')]['id'],'type':_0xaf1f('0x6f')};_0x3ee14c[_0x4cb391+_0xaf1f('0x70')]=_0x2c4e38['id'];_0x3ee14c[_0x4cb391+_0xaf1f('0x71')]=_0x2c4e38['Interaction']['id'];_0x3ee14c[_0xaf1f('0x72')+_0x4cb391+_0x92aa10+'Id']=_0x2c4e38[_0xaf1f('0x69')]['id'];_0x3ee14c['To'+_0x4cb391+_0xaf1f('0x73')]=_0x4a082b['id'];return db[_0x4cb391+_0xaf1f('0x74')][_0xaf1f('0x75')](_0x3ee14c);})[_0xaf1f('0x1b')](function(){return respondWithRpcPromise('Start',{'channel':_0x3ecb1d,'interaction':_0x2c4e38[_0xaf1f('0x6d')],'message':_0x2c4e38,'account':_0x2c4e38[_0xaf1f('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf1f('0x6f'),'appdata':_0x4a082b[_0xaf1f('0x33')]+','+(_0x2c4e38[_0xaf1f('0x69')][_0xaf1f('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xaf1f('0x1b')](respondWithResult(_0x45f87c,null))[_0xaf1f('0xc')](handleError(_0x45f87c,null));};};exports[_0xaf1f('0x77')]=function(_0x3e7d4a,_0x1547eb){var _0x4d51d9,_0x466de6;if(_[_0xaf1f('0x11')](_0x3e7d4a[_0xaf1f('0x22')][_0xaf1f('0x78')])){throw new Error(_0xaf1f('0x79'));}var _0xbea949=_0x3e7d4a[_0xaf1f('0x22')][_0xaf1f('0x78')];var _0x2ab23a=_['capitalize'](_0xbea949);var _0x55846e=_0xbea949===_0xaf1f('0x67')?_0xaf1f('0x68'):_0xaf1f('0x69');return db['User'][_0xaf1f('0x6b')]({'raw':!![],'where':{'id':_0x3e7d4a[_0xaf1f('0x1a')]['id'],'role':_0xaf1f('0x40')}})[_0xaf1f('0x1b')](function(_0x28b20d){if(_[_0xaf1f('0x11')](_0x28b20d)){throw new Error('Agent\x20not\x20found');}_0x4d51d9=_0x28b20d;return db[_0x2ab23a+'Message']['findOne']({'where':{'id':_0x3e7d4a[_0xaf1f('0x22')][_0xaf1f('0x7a')]},'include':[{'model':db[_0x2ab23a+_0xaf1f('0x6d')],'as':_0xaf1f('0x6d')},{'model':db[_0x2ab23a+_0x55846e],'as':'Account'}]});})[_0xaf1f('0x1b')](function(_0x5f2e78){if(_[_0xaf1f('0x11')](_0x5f2e78)){throw new Error(_0x2ab23a+'\x20Message\x20not\x20found');}_0x466de6=_0x5f2e78;return _0x5f2e78['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x23d6a7={'uniqueid':_0xbea949+'.'+_0x466de6['id']+'.'+_0x466de6[_0xaf1f('0x6d')]['id'],'FromUserId':_0x3e7d4a[_0xaf1f('0x32')]['id'],'type':_0xaf1f('0x6f'),'ToUserId':_0x4d51d9['id']};_0x23d6a7[_0x2ab23a+'MessageId']=_0x466de6['id'];_0x23d6a7[_0x2ab23a+_0xaf1f('0x71')]=_0x466de6[_0xaf1f('0x6d')]['id'];_0x23d6a7['From'+_0x2ab23a+_0x55846e+'Id']=_0x466de6['Account']['id'];return db[_0x2ab23a+'TransferReport'][_0xaf1f('0x75')](_0x23d6a7);})[_0xaf1f('0x1b')](function(){return respondWithRpcPromise(_0xaf1f('0x7b'),{'channel':_0xbea949,'interaction':_0x466de6[_0xaf1f('0x6d')],'message':_0x466de6,'account':_0x466de6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4d51d9[_0xaf1f('0x33')]+','+(_0x466de6[_0xaf1f('0x69')][_0xaf1f('0x7c')]||0x12c),'interval':_0xaf1f('0x7d')}]},routingClient);})[_0xaf1f('0x1b')](respondWithResult(_0x1547eb,null))[_0xaf1f('0xc')](handleError(_0x1547eb,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 03a5005..902ea52 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 _0xea95=['index','/:id','show','/:id/run','run','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xea95,0x198));var _0x5ea9=function(_0x1c95ec,_0x50e2e3){_0x1c95ec=_0x1c95ec-0x0;var _0x5b148d=_0xea95[_0x1c95ec];return _0x5b148d;};'use strict';var multer=require(_0x5ea9('0x0'));var util=require(_0x5ea9('0x1'));var path=require(_0x5ea9('0x2'));var timeout=require(_0x5ea9('0x3'));var express=require(_0x5ea9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5ea9('0x5'));var config=require(_0x5ea9('0x6'));var controller=require(_0x5ea9('0x7'));router[_0x5ea9('0x8')]('/',auth[_0x5ea9('0x9')](),controller[_0x5ea9('0xa')]);router[_0x5ea9('0x8')](_0x5ea9('0xb'),auth[_0x5ea9('0x9')](),controller[_0x5ea9('0xc')]);router[_0x5ea9('0x8')](_0x5ea9('0xd'),auth['isAuthenticated'](),controller[_0x5ea9('0xe')]);router['post']('/',auth[_0x5ea9('0x9')](),controller['create']);router[_0x5ea9('0xf')](_0x5ea9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5ea9('0x10')](_0x5ea9('0xb'),auth['isAuthenticated'](),controller[_0x5ea9('0x11')]);module[_0x5ea9('0x12')]=router; \ No newline at end of file +var _0x4ac8=['run','post','update','delete','destroy','express','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show'];(function(_0x53474b,_0x4ad7aa){var _0x23534d=function(_0x5c3661){while(--_0x5c3661){_0x53474b['push'](_0x53474b['shift']());}};_0x23534d(++_0x4ad7aa);}(_0x4ac8,0x171));var _0x84ac=function(_0xfeef0e,_0x593a7c){_0xfeef0e=_0xfeef0e-0x0;var _0x369f2f=_0x4ac8[_0xfeef0e];return _0x369f2f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x84ac('0x0'));var router=express['Router']();var auth=require(_0x84ac('0x1'));var interaction=require(_0x84ac('0x2'));var config=require('../../config/environment');var controller=require(_0x84ac('0x3'));router[_0x84ac('0x4')]('/',auth[_0x84ac('0x5')](),controller[_0x84ac('0x6')]);router[_0x84ac('0x4')](_0x84ac('0x7'),auth[_0x84ac('0x5')](),controller[_0x84ac('0x8')]);router[_0x84ac('0x4')]('/:id/run',auth[_0x84ac('0x5')](),controller[_0x84ac('0x9')]);router[_0x84ac('0xa')]('/',auth[_0x84ac('0x5')](),controller['create']);router['put']('/:id',auth[_0x84ac('0x5')](),controller[_0x84ac('0xb')]);router[_0x84ac('0xc')](_0x84ac('0x7'),auth[_0x84ac('0x5')](),controller[_0x84ac('0xd')]);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 8b5f246..c3eb116 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 _0xa6bb=['INTEGER','ENUM','years','weeks','days','hours','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','DATE'];(function(_0x135a08,_0x137c2b){var _0x2ecf19=function(_0xc08c93){while(--_0xc08c93){_0x135a08['push'](_0x135a08['shift']());}};_0x2ecf19(++_0x137c2b);}(_0xa6bb,0x12c));var _0xba6b=function(_0x5de322,_0x1e97ae){_0x5de322=_0x5de322-0x0;var _0x257cb5=_0xa6bb[_0x5de322];return _0x257cb5;};'use strict';var Sequelize=require('sequelize');module[_0xba6b('0x0')]={'name':{'type':Sequelize[_0xba6b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xba6b('0x1')]},'active':{'type':Sequelize[_0xba6b('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xba6b('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xba6b('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xba6b('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xba6b('0x5')](_0xba6b('0x6'),'quarters','months',_0xba6b('0x7'),_0xba6b('0x8'),_0xba6b('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xba6b('0x5')](_0xba6b('0xa'),_0xba6b('0xb'),_0xba6b('0xc')),'allowNull':![],'defaultValue':_0xba6b('0xa')},'type':{'type':Sequelize['ENUM'](_0xba6b('0xd'),_0xba6b('0xe')),'allowNull':![],'defaultValue':_0xba6b('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xba6b('0x1')]},'cc':{'type':Sequelize[_0xba6b('0xf')]},'bcc':{'type':Sequelize[_0xba6b('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xba6b('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6657=['custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx'];(function(_0x4b1520,_0x23bf70){var _0x24ddc6=function(_0x3c16ee){while(--_0x3c16ee){_0x4b1520['push'](_0x4b1520['shift']());}};_0x24ddc6(++_0x23bf70);}(_0x6657,0x17f));var _0x7665=function(_0x48e43a,_0x1c83af){_0x48e43a=_0x48e43a-0x0;var _0x4b0da4=_0x6657[_0x48e43a];return _0x4b0da4;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7665('0x1')]},'active':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7665('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x7665('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7665('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7665('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7665('0x5')](_0x7665('0x6'),_0x7665('0x7'),_0x7665('0x8'),_0x7665('0x9'),'days',_0x7665('0xa'),_0x7665('0xb')),'allowNull':![],'defaultValue':_0x7665('0xc')},'output':{'type':Sequelize[_0x7665('0x5')](_0x7665('0xd'),_0x7665('0xe'),_0x7665('0xf')),'allowNull':![],'defaultValue':_0x7665('0xd')},'type':{'type':Sequelize['ENUM'](_0x7665('0x10'),_0x7665('0x11')),'allowNull':![],'defaultValue':_0x7665('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7665('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x7665('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x7665('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 26ec8ca..cb6f7ab 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 _0xf3d0=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','error','run','../../config/schedule','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','get','Scheduler','destroy','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','options','create','body'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3d0,0x149));var _0x0f3d=function(_0x2b6c49,_0x138954){_0x2b6c49=_0x2b6c49-0x0;var _0x495c0f=_0xf3d0[_0x2b6c49];return _0x495c0f;};'use strict';var pdf=require(_0x0f3d('0x0'));var emlformat=require(_0x0f3d('0x1'));var rimraf=require(_0x0f3d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f3d('0x3'));var moment=require(_0x0f3d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f3d('0x5'));var util=require(_0x0f3d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0f3d('0x7'));var ejs=require(_0x0f3d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f3d('0x9'));var crypto=require(_0x0f3d('0xa'));var jsforce=require(_0x0f3d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0f3d('0x7'));var querystring=require('querystring');var Papa=require(_0x0f3d('0xc'));var Redis=require('ioredis');var authService=require(_0x0f3d('0xd'));var qs=require(_0x0f3d('0xe'));var as=require(_0x0f3d('0xf'));var hardwareService=require(_0x0f3d('0x10'));var logger=require('../../config/logger')(_0x0f3d('0x11'));var utils=require('../../config/utils');var config=require(_0x0f3d('0x12'));var licenseUtil=require(_0x0f3d('0x13'));var db=require(_0x0f3d('0x14'))['db'];function respondWithStatusCode(_0x23f8ee,_0x1b9c39){_0x1b9c39=_0x1b9c39||0xcc;return function(_0x2a42c9){if(_0x2a42c9){return _0x23f8ee[_0x0f3d('0x15')](_0x1b9c39);}return _0x23f8ee[_0x0f3d('0x16')](_0x1b9c39)[_0x0f3d('0x17')]();};}function respondWithResult(_0x151f03,_0x3a820f){_0x3a820f=_0x3a820f||0xc8;return function(_0x23d066){if(_0x23d066){return _0x151f03[_0x0f3d('0x16')](_0x3a820f)[_0x0f3d('0x18')](_0x23d066);}};}function respondWithFilteredResult(_0x34ffd2,_0x5c2a08){return function(_0x43ea45){if(_0x43ea45){var _0xf4acb9=_0x43ea45[_0x0f3d('0x19')],_0x2846ac=_0x5c2a08['offset'],_0x2eacd9=_0x5c2a08[_0x0f3d('0x1a')]+_0x5c2a08[_0x0f3d('0x1b')],_0x2cea7e;if(_0x2eacd9>=_0xf4acb9){_0x2eacd9=_0xf4acb9;_0x2cea7e=0xc8;}else{_0x2cea7e=0xce;}_0x34ffd2[_0x0f3d('0x16')](_0x2cea7e);return _0x34ffd2[_0x0f3d('0x1c')]('Content-Range',_0x2846ac+'-'+_0x2eacd9+'/'+_0xf4acb9)['json'](_0x43ea45);}return null;};}function patchUpdates(_0x3fc885){return function(_0x5bf034){try{jsonpatch['apply'](_0x5bf034,_0x3fc885,!![]);}catch(_0x19747e){return BPromise[_0x0f3d('0x1d')](_0x19747e);}return _0x5bf034[_0x0f3d('0x1e')]();};}function saveUpdates(_0x5506f1,_0x1b1754){return function(_0x508032){if(_0x508032){return _0x508032[_0x0f3d('0x1f')](_0x5506f1)[_0x0f3d('0x20')](function(_0x30e4dd){return _0x30e4dd;});}return null;};}function removeEntity(_0x4c575c,_0x1fee56){return function(_0x6eb44d){if(_0x6eb44d){return _0x6eb44d['destroy']()['then'](function(){var _0x5d96cb=_0x6eb44d[_0x0f3d('0x21')]({'plain':!![]});var _0xc72a1a=_0x0f3d('0x22');return db['UserProfileResource'][_0x0f3d('0x23')]({'where':{'type':_0xc72a1a,'resourceId':_0x5d96cb['id']}})[_0x0f3d('0x20')](function(){return _0x6eb44d;});})[_0x0f3d('0x20')](function(){_0x4c575c[_0x0f3d('0x16')](0xcc)[_0x0f3d('0x17')]();});}};}function handleEntityNotFound(_0x2ce7fa,_0x5080fe){return function(_0x2b352a){if(!_0x2b352a){_0x2ce7fa[_0x0f3d('0x15')](0x194);}return _0x2b352a;};}function handleError(_0x5c4bf0,_0x39ffcd){_0x39ffcd=_0x39ffcd||0x1f4;return function(_0x4d982f){logger['error'](_0x4d982f[_0x0f3d('0x24')]);if(_0x4d982f['name']){delete _0x4d982f[_0x0f3d('0x25')];}_0x5c4bf0[_0x0f3d('0x16')](_0x39ffcd)[_0x0f3d('0x26')](_0x4d982f);};}exports[_0x0f3d('0x27')]=function(_0x4f9d94,_0x56a158){var _0x184ad5={},_0x9c8a54={},_0x2415ed={'count':0x0,'rows':[]};var _0x1002f1=_[_0x0f3d('0x28')](db[_0x0f3d('0x29')][_0x0f3d('0x2a')],function(_0x5bd80d){return{'name':_0x5bd80d['fieldName'],'type':_0x5bd80d[_0x0f3d('0x2b')][_0x0f3d('0x2c')]};});_0x9c8a54[_0x0f3d('0x2d')]=_[_0x0f3d('0x28')](_0x1002f1,'name');_0x9c8a54[_0x0f3d('0x2e')]=_['keys'](_0x4f9d94[_0x0f3d('0x2e')]);_0x9c8a54[_0x0f3d('0x2f')]=_[_0x0f3d('0x30')](_0x9c8a54[_0x0f3d('0x2d')],_0x9c8a54[_0x0f3d('0x2e')]);_0x184ad5['attributes']=_['intersection'](_0x9c8a54[_0x0f3d('0x2d')],qs[_0x0f3d('0x31')](_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x31')]));_0x184ad5[_0x0f3d('0x32')]=_0x184ad5[_0x0f3d('0x32')][_0x0f3d('0x33')]?_0x184ad5['attributes']:_0x9c8a54[_0x0f3d('0x2d')];if(!_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x34')](_0x0f3d('0x35'))){_0x184ad5[_0x0f3d('0x1b')]=qs[_0x0f3d('0x1b')](_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x1b')]);_0x184ad5[_0x0f3d('0x1a')]=qs[_0x0f3d('0x1a')](_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x1a')]);}_0x184ad5[_0x0f3d('0x36')]=qs[_0x0f3d('0x37')](_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x37')]);_0x184ad5[_0x0f3d('0x38')]=qs[_0x0f3d('0x2f')](_[_0x0f3d('0x39')](_0x4f9d94[_0x0f3d('0x2e')],_0x9c8a54[_0x0f3d('0x2f')]),_0x1002f1);if(_0x4f9d94[_0x0f3d('0x2e')]['filter']){_0x184ad5['where']=_[_0x0f3d('0x3a')](_0x184ad5[_0x0f3d('0x38')],{'$or':_[_0x0f3d('0x28')](_0x1002f1,function(_0x4cd84f){if(_0x4cd84f[_0x0f3d('0x2b')]!==_0x0f3d('0x3b')){var _0x2afbac={};_0x2afbac[_0x4cd84f['name']]={'$like':'%'+_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x3c')]+'%'};return _0x2afbac;}})});}_0x184ad5=_['merge']({},_0x184ad5,_0x4f9d94['options']);var _0x5abd13={'where':_0x184ad5[_0x0f3d('0x38')]};return db[_0x0f3d('0x29')][_0x0f3d('0x19')](_0x5abd13)[_0x0f3d('0x20')](function(_0x655445){_0x2415ed[_0x0f3d('0x19')]=_0x655445;if(_0x4f9d94[_0x0f3d('0x2e')][_0x0f3d('0x3d')]){_0x184ad5[_0x0f3d('0x3e')]=[{'all':!![]}];}return db[_0x0f3d('0x29')][_0x0f3d('0x3f')](_0x184ad5);})[_0x0f3d('0x20')](function(_0x2536f7){_0x2415ed['rows']=_0x2536f7;return _0x2415ed;})[_0x0f3d('0x20')](respondWithFilteredResult(_0x56a158,_0x184ad5))[_0x0f3d('0x40')](handleError(_0x56a158,null));};exports[_0x0f3d('0x41')]=function(_0x4be9ff,_0x3e9fcf){var _0xe3b2eb={'raw':![],'where':{'id':_0x4be9ff[_0x0f3d('0x42')]['id']}},_0x1c2066={};_0x1c2066[_0x0f3d('0x2d')]=_[_0x0f3d('0x43')](db[_0x0f3d('0x29')]['rawAttributes']);_0x1c2066[_0x0f3d('0x2e')]=_[_0x0f3d('0x43')](_0x4be9ff[_0x0f3d('0x2e')]);_0x1c2066[_0x0f3d('0x2f')]=_[_0x0f3d('0x30')](_0x1c2066[_0x0f3d('0x2d')],_0x1c2066[_0x0f3d('0x2e')]);_0xe3b2eb[_0x0f3d('0x32')]=_[_0x0f3d('0x30')](_0x1c2066[_0x0f3d('0x2d')],qs['fields'](_0x4be9ff[_0x0f3d('0x2e')][_0x0f3d('0x31')]));_0xe3b2eb['attributes']=_0xe3b2eb[_0x0f3d('0x32')]['length']?_0xe3b2eb['attributes']:_0x1c2066[_0x0f3d('0x2d')];if(_0x4be9ff['query'][_0x0f3d('0x3d')]){_0xe3b2eb[_0x0f3d('0x3e')]=[{'all':!![]}];}_0xe3b2eb=_[_0x0f3d('0x3a')]({},_0xe3b2eb,_0x4be9ff[_0x0f3d('0x44')]);return db[_0x0f3d('0x29')]['find'](_0xe3b2eb)['then'](handleEntityNotFound(_0x3e9fcf,null))[_0x0f3d('0x20')](respondWithResult(_0x3e9fcf,null))[_0x0f3d('0x40')](handleError(_0x3e9fcf,null));};exports[_0x0f3d('0x45')]=function(_0x4abc54,_0x186c57){return db['Schedule'][_0x0f3d('0x45')](_0x4abc54[_0x0f3d('0x46')],{})[_0x0f3d('0x20')](function(_0x42ccda){var _0x1edf9b=_0x4abc54[_0x0f3d('0x47')][_0x0f3d('0x21')]({'plain':!![]});if(!_0x1edf9b)throw new Error(_0x0f3d('0x48'));if(_0x1edf9b[_0x0f3d('0x49')]===_0x0f3d('0x47')){var _0x51906b=_0x42ccda[_0x0f3d('0x21')]({'plain':!![]});var _0x5eb2bb='Scheduler';return db['UserProfileSection'][_0x0f3d('0x4a')]({'where':{'name':_0x5eb2bb,'userProfileId':_0x1edf9b['userProfileId']},'raw':!![]})[_0x0f3d('0x20')](function(_0x5a2ea2){if(_0x5a2ea2&&_0x5a2ea2[_0x0f3d('0x4b')]===0x0){return db[_0x0f3d('0x4c')][_0x0f3d('0x45')]({'name':_0x51906b[_0x0f3d('0x25')],'resourceId':_0x51906b['id'],'type':_0x5a2ea2[_0x0f3d('0x25')],'sectionId':_0x5a2ea2['id']},{})[_0x0f3d('0x20')](function(){return _0x42ccda;});}else{return _0x42ccda;}})[_0x0f3d('0x40')](function(_0x24e7e8){logger[_0x0f3d('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24e7e8);throw _0x24e7e8;});}return _0x42ccda;})[_0x0f3d('0x20')](respondWithResult(_0x186c57,0xc9))[_0x0f3d('0x40')](handleError(_0x186c57,null));};exports['update']=function(_0x546006,_0x321c4d){if(_0x546006['body']['id']){delete _0x546006['body']['id'];}return db[_0x0f3d('0x29')][_0x0f3d('0x4a')]({'where':{'id':_0x546006['params']['id']}})[_0x0f3d('0x20')](handleEntityNotFound(_0x321c4d,null))[_0x0f3d('0x20')](saveUpdates(_0x546006[_0x0f3d('0x46')],null))[_0x0f3d('0x20')](respondWithResult(_0x321c4d,null))[_0x0f3d('0x40')](handleError(_0x321c4d,null));};exports[_0x0f3d('0x23')]=function(_0x3f23eb,_0x372002){return db[_0x0f3d('0x29')][_0x0f3d('0x4a')]({'where':{'id':_0x3f23eb[_0x0f3d('0x42')]['id']}})[_0x0f3d('0x20')](handleEntityNotFound(_0x372002,null))[_0x0f3d('0x20')](removeEntity(_0x372002,null))[_0x0f3d('0x40')](handleError(_0x372002,null));};exports[_0x0f3d('0x4e')]=function(_0x306290,_0x474460,_0x52550f){var _0x54c434=require(_0x0f3d('0x4f'));return db[_0x0f3d('0x29')]['find']({'where':{'id':_0x306290['params']['id']},'raw':!![]})[_0x0f3d('0x20')](handleEntityNotFound(_0x474460,null))['then'](function(){_0x54c434[_0x0f3d('0x4e')](_0x306290[_0x0f3d('0x42')]['id']);})['then'](respondWithStatusCode(_0x474460,null))['catch'](handleError(_0x474460,null));}; \ No newline at end of file +var _0x2807=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','json','apply','reject','save','then','destroy','get','UserProfileResource','end','name','send','index','map','Schedule','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','options','count','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','rimraf'];(function(_0x3da128,_0x3f83b9){var _0x3e6b73=function(_0x2b18a4){while(--_0x2b18a4){_0x3da128['push'](_0x3da128['shift']());}};_0x3e6b73(++_0x3f83b9);}(_0x2807,0x156));var _0x7280=function(_0x40aea6,_0x3f5c1a){_0x40aea6=_0x40aea6-0x0;var _0x1aed83=_0x2807[_0x40aea6];return _0x1aed83;};'use strict';var pdf=require(_0x7280('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7280('0x1'));var zipdir=require(_0x7280('0x2'));var jsonpatch=require(_0x7280('0x3'));var rp=require(_0x7280('0x4'));var moment=require(_0x7280('0x5'));var BPromise=require(_0x7280('0x6'));var Mustache=require(_0x7280('0x7'));var util=require('util');var path=require(_0x7280('0x8'));var sox=require('sox');var csv=require(_0x7280('0x9'));var ejs=require(_0x7280('0xa'));var fs=require('fs');var _=require(_0x7280('0xb'));var squel=require(_0x7280('0xc'));var crypto=require(_0x7280('0xd'));var jsforce=require(_0x7280('0xe'));var deskjs=require(_0x7280('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7280('0x10'));var Papa=require(_0x7280('0x11'));var Redis=require(_0x7280('0x12'));var authService=require(_0x7280('0x13'));var qs=require(_0x7280('0x14'));var as=require(_0x7280('0x15'));var hardwareService=require(_0x7280('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x7280('0x17'));var config=require(_0x7280('0x18'));var licenseUtil=require(_0x7280('0x19'));var db=require(_0x7280('0x1a'))['db'];function respondWithStatusCode(_0x4cb200,_0x479003){_0x479003=_0x479003||0xcc;return function(_0x4db08c){if(_0x4db08c){return _0x4cb200['sendStatus'](_0x479003);}return _0x4cb200[_0x7280('0x1b')](_0x479003)['end']();};}function respondWithResult(_0x5e38fc,_0x34f862){_0x34f862=_0x34f862||0xc8;return function(_0x4b3ffc){if(_0x4b3ffc){return _0x5e38fc[_0x7280('0x1b')](_0x34f862)['json'](_0x4b3ffc);}};}function respondWithFilteredResult(_0xa79f85,_0xc920dc){return function(_0x130fad){if(_0x130fad){var _0x1d60eb=_0x130fad['count'],_0x253592=_0xc920dc[_0x7280('0x1c')],_0x226a5e=_0xc920dc[_0x7280('0x1c')]+_0xc920dc[_0x7280('0x1d')],_0x48c236;if(_0x226a5e>=_0x1d60eb){_0x226a5e=_0x1d60eb;_0x48c236=0xc8;}else{_0x48c236=0xce;}_0xa79f85[_0x7280('0x1b')](_0x48c236);return _0xa79f85[_0x7280('0x1e')]('Content-Range',_0x253592+'-'+_0x226a5e+'/'+_0x1d60eb)[_0x7280('0x1f')](_0x130fad);}return null;};}function patchUpdates(_0x2c2f8c){return function(_0x3cae45){try{jsonpatch[_0x7280('0x20')](_0x3cae45,_0x2c2f8c,!![]);}catch(_0x1dba8e){return BPromise[_0x7280('0x21')](_0x1dba8e);}return _0x3cae45[_0x7280('0x22')]();};}function saveUpdates(_0x48fe7a,_0x1f196b){return function(_0x5b1aad){if(_0x5b1aad){return _0x5b1aad['update'](_0x48fe7a)[_0x7280('0x23')](function(_0x247fd8){return _0x247fd8;});}return null;};}function removeEntity(_0x5282ff,_0x2b76ef){return function(_0x4a94a5){if(_0x4a94a5){return _0x4a94a5[_0x7280('0x24')]()[_0x7280('0x23')](function(){var _0x30e6f2=_0x4a94a5[_0x7280('0x25')]({'plain':!![]});var _0x27f6b2='Scheduler';return db[_0x7280('0x26')][_0x7280('0x24')]({'where':{'type':_0x27f6b2,'resourceId':_0x30e6f2['id']}})[_0x7280('0x23')](function(){return _0x4a94a5;});})[_0x7280('0x23')](function(){_0x5282ff[_0x7280('0x1b')](0xcc)[_0x7280('0x27')]();});}};}function handleEntityNotFound(_0x8e0ead,_0x30a8df){return function(_0xf180b8){if(!_0xf180b8){_0x8e0ead['sendStatus'](0x194);}return _0xf180b8;};}function handleError(_0x98a491,_0x1947b7){_0x1947b7=_0x1947b7||0x1f4;return function(_0x232c75){logger['error'](_0x232c75['stack']);if(_0x232c75['name']){delete _0x232c75[_0x7280('0x28')];}_0x98a491['status'](_0x1947b7)[_0x7280('0x29')](_0x232c75);};}exports[_0x7280('0x2a')]=function(_0x106228,_0xe7577a){var _0x2dfc26={},_0x3e5d20={},_0x555824={'count':0x0,'rows':[]};var _0x2fdb2c=_[_0x7280('0x2b')](db[_0x7280('0x2c')]['rawAttributes'],function(_0xc0841c){return{'name':_0xc0841c[_0x7280('0x2d')],'type':_0xc0841c['type'][_0x7280('0x2e')]};});_0x3e5d20[_0x7280('0x2f')]=_['map'](_0x2fdb2c,_0x7280('0x28'));_0x3e5d20[_0x7280('0x30')]=_[_0x7280('0x31')](_0x106228[_0x7280('0x30')]);_0x3e5d20['filters']=_['intersection'](_0x3e5d20['model'],_0x3e5d20['query']);_0x2dfc26[_0x7280('0x32')]=_[_0x7280('0x33')](_0x3e5d20[_0x7280('0x2f')],qs[_0x7280('0x34')](_0x106228[_0x7280('0x30')][_0x7280('0x34')]));_0x2dfc26[_0x7280('0x32')]=_0x2dfc26['attributes'][_0x7280('0x35')]?_0x2dfc26[_0x7280('0x32')]:_0x3e5d20[_0x7280('0x2f')];if(!_0x106228['query'][_0x7280('0x36')]('nolimit')){_0x2dfc26[_0x7280('0x1d')]=qs['limit'](_0x106228['query'][_0x7280('0x1d')]);_0x2dfc26['offset']=qs[_0x7280('0x1c')](_0x106228[_0x7280('0x30')]['offset']);}_0x2dfc26[_0x7280('0x37')]=qs[_0x7280('0x38')](_0x106228['query'][_0x7280('0x38')]);_0x2dfc26[_0x7280('0x39')]=qs[_0x7280('0x3a')](_['pick'](_0x106228[_0x7280('0x30')],_0x3e5d20['filters']),_0x2fdb2c);if(_0x106228['query'][_0x7280('0x3b')]){_0x2dfc26['where']=_[_0x7280('0x3c')](_0x2dfc26[_0x7280('0x39')],{'$or':_[_0x7280('0x2b')](_0x2fdb2c,function(_0x5a1741){if(_0x5a1741[_0x7280('0x3d')]!=='VIRTUAL'){var _0x572568={};_0x572568[_0x5a1741['name']]={'$like':'%'+_0x106228['query'][_0x7280('0x3b')]+'%'};return _0x572568;}})});}_0x2dfc26=_[_0x7280('0x3c')]({},_0x2dfc26,_0x106228[_0x7280('0x3e')]);var _0x51af75={'where':_0x2dfc26['where']};return db[_0x7280('0x2c')][_0x7280('0x3f')](_0x51af75)['then'](function(_0x6a68dc){_0x555824['count']=_0x6a68dc;if(_0x106228[_0x7280('0x30')][_0x7280('0x40')]){_0x2dfc26[_0x7280('0x41')]=[{'all':!![]}];}return db['Schedule'][_0x7280('0x42')](_0x2dfc26);})[_0x7280('0x23')](function(_0x2c6a84){_0x555824[_0x7280('0x43')]=_0x2c6a84;return _0x555824;})[_0x7280('0x23')](respondWithFilteredResult(_0xe7577a,_0x2dfc26))['catch'](handleError(_0xe7577a,null));};exports['show']=function(_0x305047,_0x2fe184){var _0x4fdf14={'raw':![],'where':{'id':_0x305047[_0x7280('0x44')]['id']}},_0x295c26={};_0x295c26[_0x7280('0x2f')]=_[_0x7280('0x31')](db[_0x7280('0x2c')][_0x7280('0x45')]);_0x295c26[_0x7280('0x30')]=_[_0x7280('0x31')](_0x305047[_0x7280('0x30')]);_0x295c26[_0x7280('0x3a')]=_[_0x7280('0x33')](_0x295c26[_0x7280('0x2f')],_0x295c26[_0x7280('0x30')]);_0x4fdf14[_0x7280('0x32')]=_[_0x7280('0x33')](_0x295c26[_0x7280('0x2f')],qs[_0x7280('0x34')](_0x305047[_0x7280('0x30')][_0x7280('0x34')]));_0x4fdf14['attributes']=_0x4fdf14[_0x7280('0x32')]['length']?_0x4fdf14['attributes']:_0x295c26['model'];if(_0x305047[_0x7280('0x30')]['includeAll']){_0x4fdf14[_0x7280('0x41')]=[{'all':!![]}];}_0x4fdf14=_[_0x7280('0x3c')]({},_0x4fdf14,_0x305047[_0x7280('0x3e')]);return db[_0x7280('0x2c')][_0x7280('0x46')](_0x4fdf14)['then'](handleEntityNotFound(_0x2fe184,null))[_0x7280('0x23')](respondWithResult(_0x2fe184,null))['catch'](handleError(_0x2fe184,null));};exports[_0x7280('0x47')]=function(_0x1d0c48,_0x1dda80){return db[_0x7280('0x2c')]['create'](_0x1d0c48[_0x7280('0x48')],{})[_0x7280('0x23')](function(_0x1fd13e){var _0x4b44bb=_0x1d0c48[_0x7280('0x49')][_0x7280('0x25')]({'plain':!![]});if(!_0x4b44bb)throw new Error(_0x7280('0x4a'));if(_0x4b44bb[_0x7280('0x4b')]===_0x7280('0x49')){var _0x4f14d4=_0x1fd13e[_0x7280('0x25')]({'plain':!![]});var _0xca5334=_0x7280('0x4c');return db[_0x7280('0x4d')][_0x7280('0x46')]({'where':{'name':_0xca5334,'userProfileId':_0x4b44bb[_0x7280('0x4e')]},'raw':!![]})[_0x7280('0x23')](function(_0x371a82){if(_0x371a82&&_0x371a82[_0x7280('0x4f')]===0x0){return db[_0x7280('0x26')][_0x7280('0x47')]({'name':_0x4f14d4['name'],'resourceId':_0x4f14d4['id'],'type':_0x371a82[_0x7280('0x28')],'sectionId':_0x371a82['id']},{})['then'](function(){return _0x1fd13e;});}else{return _0x1fd13e;}})[_0x7280('0x50')](function(_0xb3fbe9){logger[_0x7280('0x51')](_0x7280('0x52'),_0xb3fbe9);throw _0xb3fbe9;});}return _0x1fd13e;})[_0x7280('0x23')](respondWithResult(_0x1dda80,0xc9))[_0x7280('0x50')](handleError(_0x1dda80,null));};exports[_0x7280('0x53')]=function(_0x358c7f,_0x33fa3f){if(_0x358c7f[_0x7280('0x48')]['id']){delete _0x358c7f[_0x7280('0x48')]['id'];}return db[_0x7280('0x2c')][_0x7280('0x46')]({'where':{'id':_0x358c7f['params']['id']}})[_0x7280('0x23')](handleEntityNotFound(_0x33fa3f,null))[_0x7280('0x23')](saveUpdates(_0x358c7f['body'],null))[_0x7280('0x23')](respondWithResult(_0x33fa3f,null))[_0x7280('0x50')](handleError(_0x33fa3f,null));};exports[_0x7280('0x24')]=function(_0x367282,_0x3d1325){return db[_0x7280('0x2c')][_0x7280('0x46')]({'where':{'id':_0x367282[_0x7280('0x44')]['id']}})[_0x7280('0x23')](handleEntityNotFound(_0x3d1325,null))['then'](removeEntity(_0x3d1325,null))[_0x7280('0x50')](handleError(_0x3d1325,null));};exports[_0x7280('0x54')]=function(_0x38570c,_0x32dbc4,_0x543b54){var _0x5d3303=require(_0x7280('0x55'));return db['Schedule'][_0x7280('0x46')]({'where':{'id':_0x38570c[_0x7280('0x44')]['id']},'raw':!![]})[_0x7280('0x23')](handleEntityNotFound(_0x32dbc4,null))[_0x7280('0x23')](function(){_0x5d3303[_0x7280('0x54')](_0x38570c[_0x7280('0x44')]['id']);})[_0x7280('0x23')](respondWithStatusCode(_0x32dbc4,null))[_0x7280('0x50')](handleError(_0x32dbc4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 55b7cf8..e20f2b9 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 _0x7dcf=['./schedule.attributes','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x7dcf,0x1b3));var _0xf7dc=function(_0x32ad69,_0x518f0c){_0x32ad69=_0x32ad69-0x0;var _0x1062ef=_0x7dcf[_0x32ad69];return _0x1062ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf7dc('0x0'))('api');var moment=require('moment');var BPromise=require(_0xf7dc('0x1'));var rp=require(_0xf7dc('0x2'));var fs=require('fs');var path=require(_0xf7dc('0x3'));var rimraf=require(_0xf7dc('0x4'));var config=require(_0xf7dc('0x5'));var attributes=require(_0xf7dc('0x6'));module['exports']=function(_0x14675b,_0x59a438){return _0x14675b['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ff6=['rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfe2485,_0x39e98a){var _0x554f4b=function(_0x22815b){while(--_0x22815b){_0xfe2485['push'](_0xfe2485['shift']());}};_0x554f4b(++_0x39e98a);}(_0x1ff6,0x1e6));var _0x61ff=function(_0x845304,_0x154c0f){_0x845304=_0x845304-0x0;var _0x51c06d=_0x1ff6[_0x845304];return _0x51c06d;};'use strict';var _=require(_0x61ff('0x0'));var util=require('util');var logger=require(_0x61ff('0x1'))(_0x61ff('0x2'));var moment=require(_0x61ff('0x3'));var BPromise=require(_0x61ff('0x4'));var rp=require(_0x61ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61ff('0x6'));var config=require(_0x61ff('0x7'));var attributes=require(_0x61ff('0x8'));module[_0x61ff('0x9')]=function(_0x5bfaaa,_0x4da257){return _0x5bfaaa['define'](_0x61ff('0xa'),attributes,{'tableName':_0x61ff('0xb'),'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 0333426..14c96c2 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 _0x5f52=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x319d77,_0x445f72){var _0x1dd41c=function(_0x2c3e96){while(--_0x2c3e96){_0x319d77['push'](_0x319d77['shift']());}};_0x1dd41c(++_0x445f72);}(_0x5f52,0x98));var _0x25f5=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0x5f52[_0x4cefc3];return _0x1cc779;};'use strict';var _=require(_0x25f5('0x0'));var util=require(_0x25f5('0x1'));var moment=require(_0x25f5('0x2'));var BPromise=require(_0x25f5('0x3'));var rs=require(_0x25f5('0x4'));var fs=require('fs');var Redis=require(_0x25f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x25f5('0x6'));var logger=require(_0x25f5('0x7'))(_0x25f5('0x8'));var config=require(_0x25f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25f5('0xa')][_0x25f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb1220c,_0x393ef9,_0x471e2b){return new BPromise(function(_0x4986ee,_0x490a63){return client[_0x25f5('0xc')](_0xb1220c,_0x471e2b)['then'](function(_0x19ef9c){logger[_0x25f5('0xd')](_0x25f5('0xe'),_0x393ef9,'request\x20sent');logger['debug'](_0x25f5('0xf'),_0x393ef9,_0x25f5('0x10'),JSON[_0x25f5('0x11')](_0x19ef9c));if(_0x19ef9c['error']){if(_0x19ef9c[_0x25f5('0x12')]['code']===0x1f4){logger[_0x25f5('0x12')](_0x25f5('0xe'),_0x393ef9,_0x19ef9c[_0x25f5('0x12')]['message']);return _0x490a63(_0x19ef9c['error'][_0x25f5('0x13')]);}logger[_0x25f5('0x12')](_0x25f5('0xe'),_0x393ef9,_0x19ef9c['error'][_0x25f5('0x13')]);return _0x4986ee(_0x19ef9c[_0x25f5('0x12')][_0x25f5('0x13')]);}else{logger['info'](_0x25f5('0xe'),_0x393ef9,_0x25f5('0x10'));_0x4986ee(_0x19ef9c[_0x25f5('0x14')][_0x25f5('0x13')]);}})[_0x25f5('0x15')](function(_0x40b103){logger[_0x25f5('0x12')]('Schedule,\x20%s,\x20%s',_0x393ef9,_0x40b103);_0x490a63(_0x40b103);});});} \ No newline at end of file +var _0x5859=['../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5859,0xe8));var _0x9585=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x5859[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x9585('0x0'));var util=require('util');var moment=require(_0x9585('0x1'));var BPromise=require(_0x9585('0x2'));var rs=require(_0x9585('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9585('0x4'))['db'];var utils=require(_0x9585('0x5'));var logger=require(_0x9585('0x6'))(_0x9585('0x7'));var config=require(_0x9585('0x8'));var jayson=require(_0x9585('0x9'));var client=jayson[_0x9585('0xa')][_0x9585('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ab2a8,_0x36a1b0,_0x399a4c){return new BPromise(function(_0x38c32d,_0x2e8005){return client['request'](_0x4ab2a8,_0x399a4c)[_0x9585('0xc')](function(_0x2ea8bf){logger[_0x9585('0xd')](_0x9585('0xe'),_0x36a1b0,_0x9585('0xf'));logger[_0x9585('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x36a1b0,'request\x20sent',JSON[_0x9585('0x11')](_0x2ea8bf));if(_0x2ea8bf[_0x9585('0x12')]){if(_0x2ea8bf[_0x9585('0x12')]['code']===0x1f4){logger['error'](_0x9585('0xe'),_0x36a1b0,_0x2ea8bf[_0x9585('0x12')][_0x9585('0x13')]);return _0x2e8005(_0x2ea8bf[_0x9585('0x12')][_0x9585('0x13')]);}logger[_0x9585('0x12')](_0x9585('0xe'),_0x36a1b0,_0x2ea8bf[_0x9585('0x12')][_0x9585('0x13')]);return _0x38c32d(_0x2ea8bf[_0x9585('0x12')][_0x9585('0x13')]);}else{logger[_0x9585('0xd')](_0x9585('0xe'),_0x36a1b0,_0x9585('0xf'));_0x38c32d(_0x2ea8bf['result']['message']);}})['catch'](function(_0x17310f){logger['error'](_0x9585('0xe'),_0x36a1b0,_0x17310f);_0x2e8005(_0x17310f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ba743a5..1ae8311 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 _0x9d63=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','create','update','delete'];(function(_0xea09ad,_0x255fa2){var _0x44fb8e=function(_0x27c095){while(--_0x27c095){_0xea09ad['push'](_0xea09ad['shift']());}};_0x44fb8e(++_0x255fa2);}(_0x9d63,0x6f));var _0x39d6=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x9d63[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x39d6('0x0'));var util=require(_0x39d6('0x1'));var path=require(_0x39d6('0x2'));var timeout=require(_0x39d6('0x3'));var express=require(_0x39d6('0x4'));var router=express['Router']();var auth=require(_0x39d6('0x5'));var interaction=require(_0x39d6('0x6'));var config=require(_0x39d6('0x7'));var controller=require(_0x39d6('0x8'));router[_0x39d6('0x9')]('/',auth[_0x39d6('0xa')](),controller[_0x39d6('0xb')]);router[_0x39d6('0x9')](_0x39d6('0xc'),auth[_0x39d6('0xa')](),controller[_0x39d6('0xd')]);router[_0x39d6('0x9')](_0x39d6('0xe'),auth[_0x39d6('0xa')](),controller[_0x39d6('0xf')]);router[_0x39d6('0x9')]('/:id/download',auth[_0x39d6('0xa')](),controller[_0x39d6('0x10')]);router[_0x39d6('0x11')]('/',auth[_0x39d6('0xa')](),controller[_0x39d6('0x12')]);router['put'](_0x39d6('0xe'),auth[_0x39d6('0xa')](),controller[_0x39d6('0x13')]);router[_0x39d6('0x14')](_0x39d6('0xe'),auth[_0x39d6('0xa')](),controller[_0x39d6('0x15')]);module['exports']=router; \ No newline at end of file +var _0x522f=['post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x522f,0x1f4));var _0xf522=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x522f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xf522('0x0'));var util=require(_0xf522('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf522('0x2'));var router=express[_0xf522('0x3')]();var auth=require(_0xf522('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf522('0x5'));var controller=require(_0xf522('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf522('0x7')](_0xf522('0x8'),auth['isAuthenticated'](),controller[_0xf522('0x9')]);router['get'](_0xf522('0xa'),auth[_0xf522('0xb')](),controller[_0xf522('0xc')]);router[_0xf522('0x7')]('/:id/download',auth[_0xf522('0xb')](),controller['download']);router[_0xf522('0xd')]('/',auth[_0xf522('0xb')](),controller['create']);router[_0xf522('0xe')](_0xf522('0xa'),auth[_0xf522('0xb')](),controller[_0xf522('0xf')]);router[_0xf522('0x10')](_0xf522('0xa'),auth[_0xf522('0xb')](),controller[_0xf522('0x11')]);module[_0xf522('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e1a9fc1..b2255a3 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 _0xac31=['format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','value','INTEGER','setDataValue','subtract','closedAt','duration','DATE','startedAt'];(function(_0x4ce843,_0x2897bb){var _0x1b0e27=function(_0x265ab1){while(--_0x265ab1){_0x4ce843['push'](_0x4ce843['shift']());}};_0x1b0e27(++_0x2897bb);}(_0xac31,0xca));var _0x1ac3=function(_0x3bde86,_0x459ff4){_0x3bde86=_0x3bde86-0x0;var _0x453697=_0xac31[_0x3bde86];return _0x453697;};'use strict';var Sequelize=require(_0x1ac3('0x0'));var moment=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var config=require(_0x1ac3('0x3'));module[_0x1ac3('0x4')]={'format':{'type':Sequelize[_0x1ac3('0x5')],'get':function(){return this[_0x1ac3('0x6')]('value')?path[_0x1ac3('0x7')](this[_0x1ac3('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1ac3('0x8')]},'value':{'type':Sequelize[_0x1ac3('0x8')],'set':function(_0x2bf9b1){var _0x1be223=_0x2bf9b1[_0x1ac3('0x9')](/\\/g,'/');this['setDataValue'](_0x1ac3('0xa'),_0x1be223);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1ac3('0xb')],'set':function(_0x40b64c){this[_0x1ac3('0xc')]('startedAt',moment()[_0x1ac3('0xd')](_0x40b64c,'ms'));this[_0x1ac3('0xc')](_0x1ac3('0xe'),moment());this[_0x1ac3('0xc')](_0x1ac3('0xf'),_0x40b64c);}},'startedAt':{'type':Sequelize[_0x1ac3('0x10')],'get':function(){return moment(this['getDataValue'](_0x1ac3('0x11')))[_0x1ac3('0x12')](_0x1ac3('0x13'))[_0x1ac3('0x14')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1ac3('0x6')](_0x1ac3('0xe')))[_0x1ac3('0x12')](_0x1ac3('0x13'))['toString']();}},'createdAt':{'type':Sequelize[_0x1ac3('0x10')],'get':function(){return moment(this[_0x1ac3('0x6')]('createdAt'))[_0x1ac3('0x12')](_0x1ac3('0x13'))[_0x1ac3('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1ac3('0x6')](_0x1ac3('0x15')))[_0x1ac3('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x1ac3('0x14')]();}}}; \ No newline at end of file +var _0xe14b=['replace','INTEGER','setDataValue','startedAt','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','VIRTUAL','value','STRING'];(function(_0x55fc8c,_0x5d7cd8){var _0x3171ba=function(_0x3a80a8){while(--_0x3a80a8){_0x55fc8c['push'](_0x55fc8c['shift']());}};_0x3171ba(++_0x5d7cd8);}(_0xe14b,0x93));var _0xbe14=function(_0x4a988f,_0x5181fb){_0x4a988f=_0x4a988f-0x0;var _0x49f044=_0xe14b[_0x4a988f];return _0x49f044;};'use strict';var Sequelize=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var path=require('path');var config=require('../../config/environment');module[_0xbe14('0x2')]={'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){return this['getDataValue'](_0xbe14('0x4'))?path['extname'](this['getDataValue'](_0xbe14('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xbe14('0x5')]},'channel':{'type':Sequelize[_0xbe14('0x5')]},'value':{'type':Sequelize[_0xbe14('0x5')],'set':function(_0x1d9ade){var _0x39387e=_0x1d9ade[_0xbe14('0x6')](/\\/g,'/');this['setDataValue']('value',_0x39387e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbe14('0x7')],'set':function(_0x6fceff){this[_0xbe14('0x8')](_0xbe14('0x9'),moment()['subtract'](_0x6fceff,'ms'));this['setDataValue'](_0xbe14('0xa'),moment());this[_0xbe14('0x8')]('duration',_0x6fceff);}},'startedAt':{'type':Sequelize[_0xbe14('0xb')],'get':function(){return moment(this[_0xbe14('0xc')](_0xbe14('0x9')))[_0xbe14('0xd')](_0xbe14('0xe'))[_0xbe14('0xf')]();}},'closedAt':{'type':Sequelize[_0xbe14('0xb')],'get':function(){return moment(this[_0xbe14('0xc')](_0xbe14('0xa')))[_0xbe14('0xd')](_0xbe14('0xe'))[_0xbe14('0xf')]();}},'createdAt':{'type':Sequelize[_0xbe14('0xb')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xbe14('0xd')](_0xbe14('0xe'))[_0xbe14('0xf')]();}},'updatedAt':{'type':Sequelize[_0xbe14('0xb')],'get':function(){return moment(this['getDataValue'](_0xbe14('0x10')))[_0xbe14('0xd')](_0xbe14('0xe'))[_0xbe14('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3ee29f5..bdaed07 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 _0xf30b=['jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','differenceBy','format','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','findAll','show','params','catch','create','body','update','duration','closedAt','value','find','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','recording','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','lodash','squel'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf30b,0x172));var _0xbf30=function(_0x3b3489,_0x1da252){_0x3b3489=_0x3b3489-0x0;var _0x2a70a3=_0xf30b[_0x3b3489];return _0x2a70a3;};'use strict';var pdf=require(_0xbf30('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf30('0x1'));var zipdir=require(_0xbf30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf30('0x3'));var moment=require('moment');var BPromise=require(_0xbf30('0x4'));var Mustache=require('mustache');var util=require(_0xbf30('0x5'));var path=require(_0xbf30('0x6'));var sox=require(_0xbf30('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf30('0x8'));var squel=require(_0xbf30('0x9'));var crypto=require('crypto');var jsforce=require(_0xbf30('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf30('0xb'));var authService=require(_0xbf30('0xc'));var qs=require(_0xbf30('0xd'));var as=require(_0xbf30('0xe'));var hardwareService=require(_0xbf30('0xf'));var logger=require(_0xbf30('0x10'))(_0xbf30('0x11'));var utils=require(_0xbf30('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbf30('0x13'));var db=require(_0xbf30('0x14'))['db'];function respondWithStatusCode(_0x539065,_0x49c565){_0x49c565=_0x49c565||0xcc;return function(_0x5e3560){if(_0x5e3560){return _0x539065[_0xbf30('0x15')](_0x49c565);}return _0x539065[_0xbf30('0x16')](_0x49c565)[_0xbf30('0x17')]();};}function respondWithResult(_0x1fbea2,_0x1148d6){_0x1148d6=_0x1148d6||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x1fbea2[_0xbf30('0x16')](_0x1148d6)[_0xbf30('0x18')](_0x53fe28);}};}function respondWithFilteredResult(_0x3ef65c,_0x1105f9){return function(_0x2b5766){if(_0x2b5766){var _0x166aac=_0x2b5766[_0xbf30('0x19')],_0x549673=_0x1105f9[_0xbf30('0x1a')],_0x2719d2=_0x1105f9[_0xbf30('0x1a')]+_0x1105f9[_0xbf30('0x1b')],_0x41ef08;if(_0x2719d2>=_0x166aac){_0x2719d2=_0x166aac;_0x41ef08=0xc8;}else{_0x41ef08=0xce;}_0x3ef65c[_0xbf30('0x16')](_0x41ef08);return _0x3ef65c[_0xbf30('0x1c')]('Content-Range',_0x549673+'-'+_0x2719d2+'/'+_0x166aac)['json'](_0x2b5766);}return null;};}function patchUpdates(_0x30f560){return function(_0x1fe7c9){try{jsonpatch[_0xbf30('0x1d')](_0x1fe7c9,_0x30f560,!![]);}catch(_0x2405b0){return BPromise[_0xbf30('0x1e')](_0x2405b0);}return _0x1fe7c9['save']();};}function saveUpdates(_0x31015a,_0x1fe1ba){return function(_0x1a4b32){if(_0x1a4b32){return _0x1a4b32['update'](_0x31015a)[_0xbf30('0x1f')](function(_0x6849c){return _0x6849c;});}return null;};}function removeEntity(_0x27a5cd,_0x230505){return function(_0x461075){if(_0x461075){return _0x461075[_0xbf30('0x20')]()[_0xbf30('0x1f')](function(){_0x27a5cd['status'](0xcc)[_0xbf30('0x17')]();});}};}function handleEntityNotFound(_0x32f0dd,_0x26ddd8){return function(_0x1a2f9d){if(!_0x1a2f9d){_0x32f0dd[_0xbf30('0x15')](0x194);}return _0x1a2f9d;};}function handleError(_0x49c368,_0x3f4e47){_0x3f4e47=_0x3f4e47||0x1f4;return function(_0x14725d){logger[_0xbf30('0x21')](_0x14725d[_0xbf30('0x22')]);if(_0x14725d[_0xbf30('0x23')]){delete _0x14725d[_0xbf30('0x23')];}_0x49c368[_0xbf30('0x16')](_0x3f4e47)[_0xbf30('0x24')](_0x14725d);};}exports[_0xbf30('0x25')]=function(_0x49d643,_0x1a6a21){var _0x1c64dc={},_0x1c6f73={},_0x2bc016={'count':0x0,'rows':[]};var _0x26db82=_[_0xbf30('0x26')](db[_0xbf30('0x27')][_0xbf30('0x28')],function(_0x5f1ed4){return{'name':_0x5f1ed4[_0xbf30('0x29')],'type':_0x5f1ed4['type'][_0xbf30('0x2a')]};});_0x1c6f73['model']=_[_0xbf30('0x2b')](_[_0xbf30('0x26')](_0x26db82,'name'),[_0xbf30('0x2c')]);_0x1c6f73['query']=_[_0xbf30('0x2d')](_0x49d643[_0xbf30('0x2e')]);_0x1c6f73[_0xbf30('0x2f')]=_['intersection'](_0x1c6f73[_0xbf30('0x30')],_0x1c6f73[_0xbf30('0x2e')]);_0x1c64dc[_0xbf30('0x31')]=_[_0xbf30('0x32')](_0x1c6f73[_0xbf30('0x30')],qs[_0xbf30('0x33')](_0x49d643['query']['fields']));_0x1c64dc[_0xbf30('0x31')]=_0x1c64dc[_0xbf30('0x31')][_0xbf30('0x34')]?_0x1c64dc['attributes']:_0x1c6f73[_0xbf30('0x30')];if(!_0x49d643[_0xbf30('0x2e')][_0xbf30('0x35')](_0xbf30('0x36'))){_0x1c64dc['limit']=qs[_0xbf30('0x1b')](_0x49d643[_0xbf30('0x2e')][_0xbf30('0x1b')]);_0x1c64dc[_0xbf30('0x1a')]=qs['offset'](_0x49d643[_0xbf30('0x2e')][_0xbf30('0x1a')]);}_0x1c64dc[_0xbf30('0x37')]=qs[_0xbf30('0x38')](_0x49d643[_0xbf30('0x2e')][_0xbf30('0x38')]);_0x1c64dc['where']=qs[_0xbf30('0x2f')](_[_0xbf30('0x39')](_0x49d643[_0xbf30('0x2e')],_0x1c6f73[_0xbf30('0x2f')]),_0x26db82);if(_0x49d643['query'][_0xbf30('0x3a')]){_0x1c64dc[_0xbf30('0x3b')]=_[_0xbf30('0x3c')](_0x1c64dc[_0xbf30('0x3b')],{'$or':_[_0xbf30('0x26')](_0x26db82,function(_0x38b78f){if(_0x38b78f[_0xbf30('0x3d')]!=='VIRTUAL'){var _0x26482e={};_0x26482e[_0x38b78f[_0xbf30('0x23')]]={'$like':'%'+_0x49d643[_0xbf30('0x2e')][_0xbf30('0x3a')]+'%'};return _0x26482e;}})});}_0x1c64dc=_[_0xbf30('0x3c')]({},_0x1c64dc,_0x49d643['options']);var _0x208cd7={'where':_0x1c64dc[_0xbf30('0x3b')]};return db[_0xbf30('0x27')]['count'](_0x208cd7)[_0xbf30('0x1f')](function(_0x1b9c20){_0x2bc016[_0xbf30('0x19')]=_0x1b9c20;if(_0x49d643['query'][_0xbf30('0x3e')]){_0x1c64dc['include']=[{'all':!![]}];}return db[_0xbf30('0x27')][_0xbf30('0x3f')](_0x1c64dc);})[_0xbf30('0x1f')](function(_0x37a974){_0x2bc016['rows']=_0x37a974;return _0x2bc016;})[_0xbf30('0x1f')](respondWithFilteredResult(_0x1a6a21,_0x1c64dc))['catch'](handleError(_0x1a6a21,null));};exports[_0xbf30('0x40')]=function(_0x2c9694,_0x397a3c){var _0x53aa4a={'raw':![],'where':{'id':_0x2c9694[_0xbf30('0x41')]['id']}},_0x1155e9={};_0x1155e9['model']=_[_0xbf30('0x2d')](db[_0xbf30('0x27')]['rawAttributes']);_0x1155e9[_0xbf30('0x2e')]=_[_0xbf30('0x2d')](_0x2c9694[_0xbf30('0x2e')]);_0x1155e9[_0xbf30('0x2f')]=_['intersection'](_0x1155e9[_0xbf30('0x30')],_0x1155e9['query']);_0x53aa4a[_0xbf30('0x31')]=_[_0xbf30('0x32')](_0x1155e9[_0xbf30('0x30')],qs['fields'](_0x2c9694[_0xbf30('0x2e')][_0xbf30('0x33')]));_0x53aa4a[_0xbf30('0x31')]=_0x53aa4a['attributes'][_0xbf30('0x34')]?_0x53aa4a[_0xbf30('0x31')]:_0x1155e9[_0xbf30('0x30')];if(_0x2c9694[_0xbf30('0x2e')][_0xbf30('0x3e')]){_0x53aa4a['include']=[{'all':!![]}];}_0x53aa4a=_[_0xbf30('0x3c')]({},_0x53aa4a,_0x2c9694['options']);return db[_0xbf30('0x27')]['find'](_0x53aa4a)[_0xbf30('0x1f')](handleEntityNotFound(_0x397a3c,null))['then'](respondWithResult(_0x397a3c,null))[_0xbf30('0x42')](handleError(_0x397a3c,null));};exports[_0xbf30('0x43')]=function(_0x268823,_0x405c77){return db[_0xbf30('0x27')]['create'](_0x268823[_0xbf30('0x44')],{})[_0xbf30('0x1f')](respondWithResult(_0x405c77,0xc9))['catch'](handleError(_0x405c77,null));};exports[_0xbf30('0x45')]=function(_0x40e52b,_0x1ce76c){if(_0x40e52b['body']['id']){delete _0x40e52b['body']['id'];}delete _0x40e52b[_0xbf30('0x44')][_0xbf30('0x46')];delete _0x40e52b[_0xbf30('0x44')]['createdAt'];delete _0x40e52b[_0xbf30('0x44')][_0xbf30('0x47')];delete _0x40e52b[_0xbf30('0x44')][_0xbf30('0x48')];return db['ScreenRecording'][_0xbf30('0x49')]({'where':{'id':_0x40e52b[_0xbf30('0x41')]['id']}})[_0xbf30('0x1f')](handleEntityNotFound(_0x1ce76c,null))[_0xbf30('0x1f')](saveUpdates(_0x40e52b[_0xbf30('0x44')],null))[_0xbf30('0x1f')](respondWithResult(_0x1ce76c,null))['catch'](handleError(_0x1ce76c,null));};exports[_0xbf30('0x4a')]=function(_0x94a436,_0x5279bc){return db[_0xbf30('0x27')][_0xbf30('0x4a')]()['then'](respondWithResult(_0x5279bc,null))[_0xbf30('0x42')](handleError(_0x5279bc,null));};exports[_0xbf30('0x4b')]=function(_0x4f5955,_0xc39e23,_0xa048a8){var _0x17b3e1=require(_0xbf30('0x4c'));var _0x44925f=![];var _0x33b2f0={};if(_0x4f5955[_0xbf30('0x2e')][_0xbf30('0x3d')]&&_0x4f5955[_0xbf30('0x2e')][_0xbf30('0x3d')]==='uniqueid'){_0x33b2f0['uniqueid']=_0x4f5955[_0xbf30('0x41')]['id'];}else{_0x33b2f0['id']=_0x4f5955[_0xbf30('0x41')]['id'];}return db[_0xbf30('0x27')][_0xbf30('0x49')]({'where':_0x33b2f0,'attributes':['id',_0xbf30('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0xc39e23,null))[_0xbf30('0x1f')](function(_0x33bc91){if(_0x33bc91){var _0x289642=path[_0xbf30('0x4d')](config[_0xbf30('0x4e')],_0xbf30('0x4f'),_0x33bc91['value']);var _0x59e3b2=util[_0xbf30('0x2c')](_0xbf30('0x50'),_0x289642);if(fs[_0xbf30('0x51')](_0x59e3b2)){_0x44925f=!![];return _0x17b3e1['decryptFile'](_0x59e3b2,_0x289642,config['secrets'][_0xbf30('0x52')])['then'](function(){return _0x33bc91;});}return _0x33bc91;}})[_0xbf30('0x1f')](function(_0x327cde){if(_0x327cde){var _0x4fe547=path[_0xbf30('0x4d')](config[_0xbf30('0x4e')],_0xbf30('0x4f'),_0x327cde[_0xbf30('0x48')]);if(!fs[_0xbf30('0x51')](_0x4fe547)){throw new db['Sequelize'][(_0xbf30('0x53'))]('ScreenRecording\x20not\x20found');}if(_0x327cde['filename']){return _0xc39e23[_0xbf30('0x4b')](_0x4fe547,_0x327cde[_0xbf30('0x54')]+path[_0xbf30('0x55')](_0x4fe547),function(){if(_0x44925f){fs[_0xbf30('0x56')](_0x4fe547);}});}else{return _0xc39e23[_0xbf30('0x4b')](_0x4fe547,function(_0x24fb4d){if(_0x44925f){fs[_0xbf30('0x56')](_0x4fe547);}});}}})['catch'](function(_0x147484){if(_0x147484[_0xbf30('0x57')]===_0xbf30('0x58')){_0xc39e23[_0xbf30('0x16')](0x194)[_0xbf30('0x24')](_0xbf30('0x59'));}else{return handleError(_0xc39e23,null);}});};exports['destroy']=function(_0x42db84,_0x1e4f55){return db[_0xbf30('0x27')]['find']({'where':{'id':_0x42db84[_0xbf30('0x41')]['id']}})['then'](function(_0x34f69e){if(!_0x34f69e)throw new ReferenceError('Entity\x20not\x20found');return _0x34f69e;})[_0xbf30('0x1f')](function(_0x259801){var _0x5ed695=path[_0xbf30('0x4d')](config[_0xbf30('0x4e')],_0xbf30('0x4f'),_0x259801[_0xbf30('0x48')]);logger[_0xbf30('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x5ed695);if(!_[_0xbf30('0x5b')](_0x259801[_0xbf30('0x48')])&&fs[_0xbf30('0x51')](_0x5ed695)){logger['info']('File:\x20\x22'+_0x5ed695+_0xbf30('0x5c'));fs[_0xbf30('0x5d')](_0x5ed695);}_0x5ed695=_0x5ed695+_0xbf30('0x5e');if(!_['isNil'](_0x259801[_0xbf30('0x48')])&&fs[_0xbf30('0x51')](_0x5ed695)){logger[_0xbf30('0x5a')]('File:\x20\x22'+_0x5ed695+_0xbf30('0x5c'));fs['unlinkSync'](_0x5ed695);}return _0x259801;})['then'](function(_0xa1a353){if(!_0xa1a353)throw new InternalError();return _0xa1a353['destroy']();})[_0xbf30('0x1f')](function(){_0x1e4f55[_0xbf30('0x16')](0xcc)['end']();})[_0xbf30('0x42')](handleError(_0x1e4f55,null));}; \ No newline at end of file +var _0x7a4b=['includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','body','update','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','merge','ScreenRecording'];(function(_0x1d5aaf,_0xc6fe22){var _0x4264af=function(_0x5d33ae){while(--_0x5d33ae){_0x1d5aaf['push'](_0x1d5aaf['shift']());}};_0x4264af(++_0xc6fe22);}(_0x7a4b,0xf4));var _0xb7a4=function(_0xd6eed2,_0x273574){_0xd6eed2=_0xd6eed2-0x0;var _0x2364cb=_0x7a4b[_0xd6eed2];return _0x2364cb;};'use strict';var pdf=require(_0xb7a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb7a4('0x1'));var zipdir=require(_0xb7a4('0x2'));var jsonpatch=require(_0xb7a4('0x3'));var rp=require('request-promise');var moment=require(_0xb7a4('0x4'));var BPromise=require(_0xb7a4('0x5'));var Mustache=require(_0xb7a4('0x6'));var util=require(_0xb7a4('0x7'));var path=require(_0xb7a4('0x8'));var sox=require(_0xb7a4('0x9'));var csv=require('to-csv');var ejs=require(_0xb7a4('0xa'));var fs=require('fs');var _=require(_0xb7a4('0xb'));var squel=require('squel');var crypto=require(_0xb7a4('0xc'));var jsforce=require(_0xb7a4('0xd'));var deskjs=require(_0xb7a4('0xe'));var toCsv=require(_0xb7a4('0xf'));var querystring=require(_0xb7a4('0x10'));var Papa=require(_0xb7a4('0x11'));var Redis=require(_0xb7a4('0x12'));var authService=require(_0xb7a4('0x13'));var qs=require(_0xb7a4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7a4('0x15'));var logger=require('../../config/logger')(_0xb7a4('0x16'));var utils=require(_0xb7a4('0x17'));var config=require(_0xb7a4('0x18'));var licenseUtil=require(_0xb7a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x462a56,_0x16a825){_0x16a825=_0x16a825||0xcc;return function(_0x1ea7be){if(_0x1ea7be){return _0x462a56[_0xb7a4('0x1a')](_0x16a825);}return _0x462a56[_0xb7a4('0x1b')](_0x16a825)[_0xb7a4('0x1c')]();};}function respondWithResult(_0x2bd72c,_0x54602b){_0x54602b=_0x54602b||0xc8;return function(_0x2ce319){if(_0x2ce319){return _0x2bd72c[_0xb7a4('0x1b')](_0x54602b)[_0xb7a4('0x1d')](_0x2ce319);}};}function respondWithFilteredResult(_0x42d014,_0xea5c46){return function(_0x549467){if(_0x549467){var _0x10e181=_0x549467[_0xb7a4('0x1e')],_0x1742ab=_0xea5c46[_0xb7a4('0x1f')],_0x29a945=_0xea5c46['offset']+_0xea5c46[_0xb7a4('0x20')],_0x1a1ea9;if(_0x29a945>=_0x10e181){_0x29a945=_0x10e181;_0x1a1ea9=0xc8;}else{_0x1a1ea9=0xce;}_0x42d014[_0xb7a4('0x1b')](_0x1a1ea9);return _0x42d014[_0xb7a4('0x21')](_0xb7a4('0x22'),_0x1742ab+'-'+_0x29a945+'/'+_0x10e181)[_0xb7a4('0x1d')](_0x549467);}return null;};}function patchUpdates(_0x4cfa96){return function(_0x2dccc3){try{jsonpatch[_0xb7a4('0x23')](_0x2dccc3,_0x4cfa96,!![]);}catch(_0x426de6){return BPromise[_0xb7a4('0x24')](_0x426de6);}return _0x2dccc3[_0xb7a4('0x25')]();};}function saveUpdates(_0x585cce,_0x16e037){return function(_0x32a8f6){if(_0x32a8f6){return _0x32a8f6['update'](_0x585cce)[_0xb7a4('0x26')](function(_0x5074e7){return _0x5074e7;});}return null;};}function removeEntity(_0x13d760,_0xcdf1e9){return function(_0x3d7329){if(_0x3d7329){return _0x3d7329[_0xb7a4('0x27')]()[_0xb7a4('0x26')](function(){_0x13d760[_0xb7a4('0x1b')](0xcc)[_0xb7a4('0x1c')]();});}};}function handleEntityNotFound(_0x3d972c,_0x3a4703){return function(_0x5906c7){if(!_0x5906c7){_0x3d972c[_0xb7a4('0x1a')](0x194);}return _0x5906c7;};}function handleError(_0x559f52,_0xc9cce8){_0xc9cce8=_0xc9cce8||0x1f4;return function(_0x40bbcc){logger[_0xb7a4('0x28')](_0x40bbcc[_0xb7a4('0x29')]);if(_0x40bbcc['name']){delete _0x40bbcc[_0xb7a4('0x2a')];}_0x559f52[_0xb7a4('0x1b')](_0xc9cce8)[_0xb7a4('0x2b')](_0x40bbcc);};}exports[_0xb7a4('0x2c')]=function(_0xe413ba,_0x4a9fc3){var _0x3b8b47={},_0x5d7baa={},_0x52d6cc={'count':0x0,'rows':[]};var _0x84e2f4=_[_0xb7a4('0x2d')](db['ScreenRecording']['rawAttributes'],function(_0x4b892d){return{'name':_0x4b892d[_0xb7a4('0x2e')],'type':_0x4b892d[_0xb7a4('0x2f')][_0xb7a4('0x30')]};});_0x5d7baa[_0xb7a4('0x31')]=_['differenceBy'](_[_0xb7a4('0x2d')](_0x84e2f4,_0xb7a4('0x2a')),[_0xb7a4('0x32')]);_0x5d7baa['query']=_[_0xb7a4('0x33')](_0xe413ba[_0xb7a4('0x34')]);_0x5d7baa['filters']=_[_0xb7a4('0x35')](_0x5d7baa['model'],_0x5d7baa[_0xb7a4('0x34')]);_0x3b8b47[_0xb7a4('0x36')]=_[_0xb7a4('0x35')](_0x5d7baa[_0xb7a4('0x31')],qs[_0xb7a4('0x37')](_0xe413ba[_0xb7a4('0x34')][_0xb7a4('0x37')]));_0x3b8b47[_0xb7a4('0x36')]=_0x3b8b47[_0xb7a4('0x36')][_0xb7a4('0x38')]?_0x3b8b47[_0xb7a4('0x36')]:_0x5d7baa['model'];if(!_0xe413ba[_0xb7a4('0x34')][_0xb7a4('0x39')](_0xb7a4('0x3a'))){_0x3b8b47[_0xb7a4('0x20')]=qs['limit'](_0xe413ba['query']['limit']);_0x3b8b47[_0xb7a4('0x1f')]=qs[_0xb7a4('0x1f')](_0xe413ba[_0xb7a4('0x34')]['offset']);}_0x3b8b47['order']=qs['sort'](_0xe413ba[_0xb7a4('0x34')][_0xb7a4('0x3b')]);_0x3b8b47[_0xb7a4('0x3c')]=qs[_0xb7a4('0x3d')](_['pick'](_0xe413ba[_0xb7a4('0x34')],_0x5d7baa['filters']),_0x84e2f4);if(_0xe413ba[_0xb7a4('0x34')]['filter']){_0x3b8b47[_0xb7a4('0x3c')]=_['merge'](_0x3b8b47['where'],{'$or':_[_0xb7a4('0x2d')](_0x84e2f4,function(_0x5e21b3){if(_0x5e21b3['type']!==_0xb7a4('0x3e')){var _0x5491eb={};_0x5491eb[_0x5e21b3[_0xb7a4('0x2a')]]={'$like':'%'+_0xe413ba[_0xb7a4('0x34')]['filter']+'%'};return _0x5491eb;}})});}_0x3b8b47=_[_0xb7a4('0x3f')]({},_0x3b8b47,_0xe413ba['options']);var _0xa4e90c={'where':_0x3b8b47['where']};return db[_0xb7a4('0x40')][_0xb7a4('0x1e')](_0xa4e90c)[_0xb7a4('0x26')](function(_0x2d300e){_0x52d6cc['count']=_0x2d300e;if(_0xe413ba[_0xb7a4('0x34')][_0xb7a4('0x41')]){_0x3b8b47[_0xb7a4('0x42')]=[{'all':!![]}];}return db[_0xb7a4('0x40')][_0xb7a4('0x43')](_0x3b8b47);})[_0xb7a4('0x26')](function(_0x3251b4){_0x52d6cc[_0xb7a4('0x44')]=_0x3251b4;return _0x52d6cc;})[_0xb7a4('0x26')](respondWithFilteredResult(_0x4a9fc3,_0x3b8b47))['catch'](handleError(_0x4a9fc3,null));};exports[_0xb7a4('0x45')]=function(_0x55d142,_0x396ab0){var _0x23640e={'raw':![],'where':{'id':_0x55d142['params']['id']}},_0x1b4eaa={};_0x1b4eaa[_0xb7a4('0x31')]=_[_0xb7a4('0x33')](db[_0xb7a4('0x40')][_0xb7a4('0x46')]);_0x1b4eaa['query']=_[_0xb7a4('0x33')](_0x55d142[_0xb7a4('0x34')]);_0x1b4eaa[_0xb7a4('0x3d')]=_[_0xb7a4('0x35')](_0x1b4eaa['model'],_0x1b4eaa['query']);_0x23640e['attributes']=_[_0xb7a4('0x35')](_0x1b4eaa[_0xb7a4('0x31')],qs[_0xb7a4('0x37')](_0x55d142[_0xb7a4('0x34')][_0xb7a4('0x37')]));_0x23640e['attributes']=_0x23640e[_0xb7a4('0x36')][_0xb7a4('0x38')]?_0x23640e[_0xb7a4('0x36')]:_0x1b4eaa[_0xb7a4('0x31')];if(_0x55d142[_0xb7a4('0x34')]['includeAll']){_0x23640e[_0xb7a4('0x42')]=[{'all':!![]}];}_0x23640e=_['merge']({},_0x23640e,_0x55d142[_0xb7a4('0x47')]);return db['ScreenRecording'][_0xb7a4('0x48')](_0x23640e)['then'](handleEntityNotFound(_0x396ab0,null))['then'](respondWithResult(_0x396ab0,null))[_0xb7a4('0x49')](handleError(_0x396ab0,null));};exports[_0xb7a4('0x4a')]=function(_0x18a5af,_0x325bf2){return db[_0xb7a4('0x40')][_0xb7a4('0x4a')](_0x18a5af[_0xb7a4('0x4b')],{})[_0xb7a4('0x26')](respondWithResult(_0x325bf2,0xc9))['catch'](handleError(_0x325bf2,null));};exports[_0xb7a4('0x4c')]=function(_0x55362c,_0x5cced2){if(_0x55362c['body']['id']){delete _0x55362c[_0xb7a4('0x4b')]['id'];}delete _0x55362c['body']['duration'];delete _0x55362c[_0xb7a4('0x4b')][_0xb7a4('0x4d')];delete _0x55362c['body'][_0xb7a4('0x4e')];delete _0x55362c[_0xb7a4('0x4b')][_0xb7a4('0x4f')];return db['ScreenRecording'][_0xb7a4('0x48')]({'where':{'id':_0x55362c[_0xb7a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cced2,null))[_0xb7a4('0x26')](saveUpdates(_0x55362c[_0xb7a4('0x4b')],null))[_0xb7a4('0x26')](respondWithResult(_0x5cced2,null))['catch'](handleError(_0x5cced2,null));};exports[_0xb7a4('0x51')]=function(_0x5565e0,_0x88a16f){return db[_0xb7a4('0x40')][_0xb7a4('0x51')]()[_0xb7a4('0x26')](respondWithResult(_0x88a16f,null))['catch'](handleError(_0x88a16f,null));};exports[_0xb7a4('0x52')]=function(_0x122c2d,_0x30eb61,_0x60f085){var _0x558643=require('../../components/encryptor');var _0x583486=![];var _0x27f517={};if(_0x122c2d[_0xb7a4('0x34')][_0xb7a4('0x2f')]&&_0x122c2d[_0xb7a4('0x34')]['type']===_0xb7a4('0x53')){_0x27f517[_0xb7a4('0x53')]=_0x122c2d[_0xb7a4('0x50')]['id'];}else{_0x27f517['id']=_0x122c2d[_0xb7a4('0x50')]['id'];}return db['ScreenRecording'][_0xb7a4('0x48')]({'where':_0x27f517,'attributes':['id','value'],'raw':!![]})[_0xb7a4('0x26')](handleEntityNotFound(_0x30eb61,null))[_0xb7a4('0x26')](function(_0x30838e){if(_0x30838e){var _0x57d450=path[_0xb7a4('0x54')](config[_0xb7a4('0x55')],_0xb7a4('0x56'),_0x30838e[_0xb7a4('0x4f')]);var _0x346720=util['format']('%s.cypher',_0x57d450);if(fs[_0xb7a4('0x57')](_0x346720)){_0x583486=!![];return _0x558643[_0xb7a4('0x58')](_0x346720,_0x57d450,config[_0xb7a4('0x59')]['recording'])[_0xb7a4('0x26')](function(){return _0x30838e;});}return _0x30838e;}})[_0xb7a4('0x26')](function(_0x2776f7){if(_0x2776f7){var _0x617b2=path[_0xb7a4('0x54')](config[_0xb7a4('0x55')],_0xb7a4('0x56'),_0x2776f7[_0xb7a4('0x4f')]);if(!fs[_0xb7a4('0x57')](_0x617b2)){throw new db[(_0xb7a4('0x5a'))]['ValidationError'](_0xb7a4('0x5b'));}if(_0x2776f7[_0xb7a4('0x5c')]){return _0x30eb61[_0xb7a4('0x52')](_0x617b2,_0x2776f7[_0xb7a4('0x5c')]+path[_0xb7a4('0x5d')](_0x617b2),function(){if(_0x583486){fs['unlink'](_0x617b2);}});}else{return _0x30eb61[_0xb7a4('0x52')](_0x617b2,function(_0x3bacb7){if(_0x583486){fs[_0xb7a4('0x5e')](_0x617b2);}});}}})['catch'](function(_0x128863){if(_0x128863[_0xb7a4('0x5f')]===_0xb7a4('0x5b')){_0x30eb61[_0xb7a4('0x1b')](0x194)[_0xb7a4('0x2b')]('Not\x20found');}else{return handleError(_0x30eb61,null);}});};exports[_0xb7a4('0x27')]=function(_0x46b3c0,_0x2df989){return db['ScreenRecording']['find']({'where':{'id':_0x46b3c0[_0xb7a4('0x50')]['id']}})[_0xb7a4('0x26')](function(_0x4589f6){if(!_0x4589f6)throw new ReferenceError(_0xb7a4('0x60'));return _0x4589f6;})[_0xb7a4('0x26')](function(_0x217620){var _0x10f329=path[_0xb7a4('0x54')](config[_0xb7a4('0x55')],_0xb7a4('0x56'),_0x217620[_0xb7a4('0x4f')]);logger[_0xb7a4('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x10f329);if(!_[_0xb7a4('0x62')](_0x217620[_0xb7a4('0x4f')])&&fs['existsSync'](_0x10f329)){logger[_0xb7a4('0x61')](_0xb7a4('0x63')+_0x10f329+_0xb7a4('0x64'));fs[_0xb7a4('0x65')](_0x10f329);}_0x10f329=_0x10f329+_0xb7a4('0x66');if(!_['isNil'](_0x217620['value'])&&fs['existsSync'](_0x10f329)){logger[_0xb7a4('0x61')](_0xb7a4('0x63')+_0x10f329+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb7a4('0x65')](_0x10f329);}return _0x217620;})[_0xb7a4('0x26')](function(_0x916ff5){if(!_0x916ff5)throw new InternalError();return _0x916ff5[_0xb7a4('0x27')]();})[_0xb7a4('0x26')](function(){_0x2df989['status'](0xcc)[_0xb7a4('0x1c')]();})[_0xb7a4('0x49')](handleError(_0x2df989,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b9f9aa5..4d5426f 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 _0xcf44=['api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger'];(function(_0x1f4c9e,_0x1ed8f4){var _0x168c98=function(_0x2aadc9){while(--_0x2aadc9){_0x1f4c9e['push'](_0x1f4c9e['shift']());}};_0x168c98(++_0x1ed8f4);}(_0xcf44,0x15d));var _0x4cf4=function(_0x18342c,_0x19ab00){_0x18342c=_0x18342c-0x0;var _0x342ed8=_0xcf44[_0x18342c];return _0x342ed8;};'use strict';var _=require('lodash');var util=require(_0x4cf4('0x0'));var logger=require(_0x4cf4('0x1'))(_0x4cf4('0x2'));var moment=require(_0x4cf4('0x3'));var BPromise=require(_0x4cf4('0x4'));var rp=require(_0x4cf4('0x5'));var fs=require('fs');var path=require(_0x4cf4('0x6'));var rimraf=require(_0x4cf4('0x7'));var config=require('../../config/environment');var attributes=require(_0x4cf4('0x8'));module[_0x4cf4('0x9')]=function(_0x533c46,_0xf7992a){return _0x533c46['define'](_0x4cf4('0xa'),attributes,{'tableName':_0x4cf4('0xb'),'paranoid':![],'indexes':[{'name':_0x4cf4('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb368=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x520aa7,_0x2f23b1){var _0x40713f=function(_0x2b3031){while(--_0x2b3031){_0x520aa7['push'](_0x520aa7['shift']());}};_0x40713f(++_0x2f23b1);}(_0xb368,0xa8));var _0x8b36=function(_0x43c6bc,_0x4d3ed0){_0x43c6bc=_0x43c6bc-0x0;var _0x1bb9bb=_0xb368[_0x43c6bc];return _0x1bb9bb;};'use strict';var _=require(_0x8b36('0x0'));var util=require('util');var logger=require(_0x8b36('0x1'))(_0x8b36('0x2'));var moment=require(_0x8b36('0x3'));var BPromise=require(_0x8b36('0x4'));var rp=require(_0x8b36('0x5'));var fs=require('fs');var path=require(_0x8b36('0x6'));var rimraf=require(_0x8b36('0x7'));var config=require(_0x8b36('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x3524c4,_0xa0a1b){return _0x3524c4[_0x8b36('0x9')](_0x8b36('0xa'),attributes,{'tableName':_0x8b36('0xb'),'paranoid':![],'indexes':[{'name':_0x8b36('0xc'),'fields':[_0x8b36('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ba89e7b..539e52f 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(_0x23d00e,_0x404504){var _0x2970a0=function(_0x3406a9){while(--_0x3406a9){_0x23d00e['push'](_0x23d00e['shift']());}};_0x2970a0(++_0x404504);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x112656,_0x2f1164){var _0x1aad64=function(_0x413954){while(--_0x413954){_0x112656['push'](_0x112656['shift']());}};_0x1aad64(++_0x2f1164);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 3236815..436b2c1 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 _0xee29=['gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','addLogo','diskStorage','logologin','/:id/logo_login','file','extname','addPreferred','put','/:id','isAuthenticated','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','getLogoLogin','/:id/gdpr'];(function(_0x11bb1b,_0x5070d6){var _0x5e0890=function(_0x274456){while(--_0x274456){_0x11bb1b['push'](_0x11bb1b['shift']());}};_0x5e0890(++_0x5070d6);}(_0xee29,0xfd));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9ee2('0x0'));var path=require(_0x9ee2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ee2('0x2')]();var auth=require(_0x9ee2('0x3'));var interaction=require(_0x9ee2('0x4'));var config=require(_0x9ee2('0x5'));var controller=require(_0x9ee2('0x6'));router[_0x9ee2('0x7')]('/',auth['isAuthenticated'](),controller[_0x9ee2('0x8')]);router[_0x9ee2('0x7')](_0x9ee2('0x9'),controller[_0x9ee2('0xa')]);router[_0x9ee2('0x7')]('/:id',controller['show']);router[_0x9ee2('0x7')]('/:id/logo',controller['getLogo']);router[_0x9ee2('0x7')]('/:id/logo_login',controller[_0x9ee2('0xb')]);router[_0x9ee2('0x7')](_0x9ee2('0xc'),controller[_0x9ee2('0xd')]);router[_0x9ee2('0x7')](_0x9ee2('0xe'),controller[_0x9ee2('0xf')]);router[_0x9ee2('0x7')](_0x9ee2('0x10'),controller[_0x9ee2('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x324ce8,_0x19cdab,_0x1a0c47){_0x1a0c47(null,path[_0x9ee2('0x12')](config[_0x9ee2('0x13')],_0x9ee2('0x14')));},'filename':function(_0x1383f6,_0x3edb58,_0x81c03d){_0x81c03d(null,util[_0x9ee2('0x15')](_0x9ee2('0x16'),_0x9ee2('0x17'),path['extname'](_0x3edb58[_0x9ee2('0x18')])));}})});router[_0x9ee2('0x19')](_0x9ee2('0x1a'),upload['single']('file'),controller[_0x9ee2('0x1b')]);var upload=multer({'storage':multer[_0x9ee2('0x1c')]({'destination':function(_0x562bd6,_0x45b9f2,_0x2bc8c3){_0x2bc8c3(null,path['join'](config[_0x9ee2('0x13')],'server/files/images/logos/'));},'filename':function(_0x27eba4,_0x3726b8,_0xfcf676){_0xfcf676(null,util[_0x9ee2('0x15')](_0x9ee2('0x16'),_0x9ee2('0x1d'),path['extname'](_0x3726b8[_0x9ee2('0x18')])));}})});router[_0x9ee2('0x19')](_0x9ee2('0x1e'),upload['single'](_0x9ee2('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x9ee2('0x1c')]({'destination':function(_0x3acbec,_0x535118,_0x2f0ac5){_0x2f0ac5(null,path[_0x9ee2('0x12')](config[_0x9ee2('0x13')],'server/files/images/logos/'));},'filename':function(_0x14d675,_0x1a9aab,_0x35d1d6){_0x35d1d6(null,util['format'](_0x9ee2('0x16'),'preferred',path[_0x9ee2('0x20')](_0x1a9aab[_0x9ee2('0x18')])));}})});router[_0x9ee2('0x19')]('/:id/preferred',upload['single'](_0x9ee2('0x1f')),controller[_0x9ee2('0x21')]);var upload=multer({'storage':multer[_0x9ee2('0x1c')]({'destination':function(_0x3fa13f,_0x34bedd,_0x5a1ee4){_0x5a1ee4(null,path['join'](config['root'],_0x9ee2('0x14')));},'filename':function(_0x4fb5ed,_0x49e500,_0x50b105){_0x50b105(null,util[_0x9ee2('0x15')](_0x9ee2('0x16'),'favicon',path[_0x9ee2('0x20')](_0x49e500[_0x9ee2('0x18')])));}})});router[_0x9ee2('0x19')](_0x9ee2('0x10'),upload['single']('file'),controller['addFavicon']);router[_0x9ee2('0x22')](_0x9ee2('0x23'),auth[_0x9ee2('0x24')](),controller['update']);module[_0x9ee2('0x25')]=router; \ No newline at end of file +var _0x1c81=['exports','path','connect-timeout','express','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','getFavicon','root','format','%s%s','logo','extname','addLogo','diskStorage','join','server/files/images/logos/','logologin','originalname','post','single','file','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','/:id/favicon','addFavicon','put'];(function(_0x1a2cfb,_0x6a2918){var _0x57d841=function(_0x377c45){while(--_0x377c45){_0x1a2cfb['push'](_0x1a2cfb['shift']());}};_0x57d841(++_0x6a2918);}(_0x1c81,0x10b));var _0x11c8=function(_0x4e0f68,_0x479623){_0x4e0f68=_0x4e0f68-0x0;var _0x5a0915=_0x1c81[_0x4e0f68];return _0x5a0915;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11c8('0x0'));var timeout=require(_0x11c8('0x1'));var express=require(_0x11c8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x11c8('0x3'));var config=require('../../config/environment');var controller=require(_0x11c8('0x4'));router[_0x11c8('0x5')]('/',auth[_0x11c8('0x6')](),controller[_0x11c8('0x7')]);router[_0x11c8('0x5')]('/now',controller['getDate']);router[_0x11c8('0x5')](_0x11c8('0x8'),controller['show']);router[_0x11c8('0x5')](_0x11c8('0x9'),controller[_0x11c8('0xa')]);router['get']('/:id/logo_login',controller[_0x11c8('0xb')]);router[_0x11c8('0x5')](_0x11c8('0xc'),controller[_0x11c8('0xd')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x11c8('0x5')]('/:id/favicon',controller[_0x11c8('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x484bbc,_0x6688ec,_0x17f99e){_0x17f99e(null,path['join'](config[_0x11c8('0xf')],'server/files/images/logos/'));},'filename':function(_0x33ffe0,_0x530315,_0x5218c0){_0x5218c0(null,util[_0x11c8('0x10')](_0x11c8('0x11'),_0x11c8('0x12'),path[_0x11c8('0x13')](_0x530315['originalname'])));}})});router['post'](_0x11c8('0x9'),upload['single']('file'),controller[_0x11c8('0x14')]);var upload=multer({'storage':multer[_0x11c8('0x15')]({'destination':function(_0x2e126f,_0x18abcd,_0x3033bc){_0x3033bc(null,path[_0x11c8('0x16')](config[_0x11c8('0xf')],_0x11c8('0x17')));},'filename':function(_0x2846e6,_0xde295e,_0x398fe0){_0x398fe0(null,util['format'](_0x11c8('0x11'),_0x11c8('0x18'),path[_0x11c8('0x13')](_0xde295e[_0x11c8('0x19')])));}})});router[_0x11c8('0x1a')]('/:id/logo_login',upload[_0x11c8('0x1b')](_0x11c8('0x1c')),controller[_0x11c8('0x1d')]);var upload=multer({'storage':multer[_0x11c8('0x15')]({'destination':function(_0x4b96e8,_0x1da23c,_0x55f854){_0x55f854(null,path[_0x11c8('0x16')](config[_0x11c8('0xf')],'server/files/images/logos/'));},'filename':function(_0x21e5d0,_0x801f0e,_0xda8d1c){_0xda8d1c(null,util['format']('%s%s',_0x11c8('0x1e'),path[_0x11c8('0x13')](_0x801f0e[_0x11c8('0x19')])));}})});router['post'](_0x11c8('0x1f'),upload[_0x11c8('0x1b')](_0x11c8('0x1c')),controller[_0x11c8('0x20')]);var upload=multer({'storage':multer[_0x11c8('0x15')]({'destination':function(_0x153b41,_0x1cb6a0,_0x4f1013){_0x4f1013(null,path[_0x11c8('0x16')](config[_0x11c8('0xf')],_0x11c8('0x17')));},'filename':function(_0x16f8a1,_0x2d8db0,_0x499c7a){_0x499c7a(null,util[_0x11c8('0x10')](_0x11c8('0x11'),_0x11c8('0x21'),path[_0x11c8('0x13')](_0x2d8db0[_0x11c8('0x19')])));}})});router[_0x11c8('0x1a')](_0x11c8('0x22'),upload[_0x11c8('0x1b')](_0x11c8('0x1c')),controller[_0x11c8('0x23')]);router[_0x11c8('0x24')](_0x11c8('0x8'),auth[_0x11c8('0x6')](),controller['update']);module[_0x11c8('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 2ad18a1..4f41013 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 _0xad0b=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x492a6b,_0x2d1414){var _0x12aa5f=function(_0x4eb03f){while(--_0x4eb03f){_0x492a6b['push'](_0x492a6b['shift']());}};_0x12aa5f(++_0x2d1414);}(_0xad0b,0x1b4));var _0xbad0=function(_0x536c45,_0x46ca04){_0x536c45=_0x536c45-0x0;var _0x249252=_0xad0b[_0x536c45];return _0x249252;};'use strict';var Sequelize=require(_0xbad0('0x0'));module[_0xbad0('0x1')]={'min_internal':{'type':Sequelize[_0xbad0('0x2')](0xb),'unique':_0xbad0('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbad0('0x2')](0xb),'unique':_0xbad0('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbad0('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbad0('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xbad0('0x5')]},'defaultLogo':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xbad0('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbad0('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbad0('0x5')]},'turnaddr':{'type':Sequelize[_0xbad0('0x5')]},'turnusername':{'type':Sequelize[_0xbad0('0x5')]},'turnpassword':{'type':Sequelize[_0xbad0('0x5')]},'pageTitle':{'type':Sequelize[_0xbad0('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xbad0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xbad0('0x7')},'enableEmailPreview':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbad0('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbad0('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xbad0('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xbad0('0x5')]},'defaultFavicon':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xbad0('0x2')]},'transcribeRegion':{'type':Sequelize[_0xbad0('0x5')]},'sentiment':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbad0('0x2')]},'sentimentRegion':{'type':Sequelize[_0xbad0('0x5')]},'language':{'type':Sequelize[_0xbad0('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xbad0('0x2')](0x2)[_0xbad0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xbad0('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xbad0('0x2')](0x2)[_0xbad0('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xbad0('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xbad0('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa65c=['exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0xcc83c9,_0x48432e){var _0x30d64b=function(_0x2c9c38){while(--_0x2c9c38){_0xcc83c9['push'](_0xcc83c9['shift']());}};_0x30d64b(++_0x48432e);}(_0xa65c,0x153));var _0xca65=function(_0x2b3d3b,_0xe52bee){_0x2b3d3b=_0x2b3d3b-0x0;var _0x4f2684=_0xa65c[_0x2b3d3b];return _0x4f2684;};'use strict';var Sequelize=require(_0xca65('0x0'));module[_0xca65('0x1')]={'min_internal':{'type':Sequelize[_0xca65('0x2')](0xb),'unique':_0xca65('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xca65('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xca65('0x4')],'defaultValue':_0xca65('0x5')},'logo':{'type':Sequelize[_0xca65('0x4')]},'defaultLogo':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xca65('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xca65('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xca65('0x4')]},'turnaddr':{'type':Sequelize[_0xca65('0x4')]},'turnusername':{'type':Sequelize[_0xca65('0x4')]},'turnpassword':{'type':Sequelize[_0xca65('0x4')]},'pageTitle':{'type':Sequelize[_0xca65('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xca65('0x4')],'defaultValue':_0xca65('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xca65('0x4')],'defaultValue':_0xca65('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xca65('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xca65('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xca65('0x4')]},'language':{'type':Sequelize[_0xca65('0x4')]},'bucket':{'type':Sequelize[_0xca65('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xca65('0x2')](0x2)[_0xca65('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xca65('0x2')](0x2)[_0xca65('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xca65('0x2')](0x2)[_0xca65('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xca65('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xca65('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xca65('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4082e5c..affe23a 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 _0xb65d=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','destroy','end','stack','name','send','index','map','Setting','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','update','body','find','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','download','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0xb65d,0x1e3));var _0xdb65=function(_0x136032,_0x5ac848){_0x136032=_0x136032-0x0;var _0x21de33=_0xb65d[_0x136032];return _0x21de33;};'use strict';var pdf=require(_0xdb65('0x0'));var emlformat=require(_0xdb65('0x1'));var rimraf=require(_0xdb65('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb65('0x3'));var rp=require(_0xdb65('0x4'));var moment=require(_0xdb65('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdb65('0x6'));var util=require('util');var path=require(_0xdb65('0x7'));var sox=require(_0xdb65('0x8'));var csv=require(_0xdb65('0x9'));var ejs=require(_0xdb65('0xa'));var fs=require('fs');var _=require(_0xdb65('0xb'));var squel=require(_0xdb65('0xc'));var crypto=require(_0xdb65('0xd'));var jsforce=require(_0xdb65('0xe'));var deskjs=require(_0xdb65('0xf'));var toCsv=require(_0xdb65('0x9'));var querystring=require(_0xdb65('0x10'));var Papa=require(_0xdb65('0x11'));var Redis=require(_0xdb65('0x12'));var authService=require(_0xdb65('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdb65('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb65('0x15'))(_0xdb65('0x16'));var utils=require(_0xdb65('0x17'));var config=require(_0xdb65('0x18'));var licenseUtil=require(_0xdb65('0x19'));var db=require(_0xdb65('0x1a'))['db'];var jayson=require(_0xdb65('0x1b'));var client=jayson[_0xdb65('0x1c')][_0xdb65('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x36f92a,_0x475fb6,_0xf7572d,_0x27160e){return new BPromise(function(_0x2633cf,_0x54dc75){var _0x2b9644=_0x27160e||client;return _0x2b9644[_0xdb65('0x1e')](_0x36f92a,_0xf7572d)[_0xdb65('0x1f')](function(_0x3c0a3d){logger[_0xdb65('0x20')](_0xdb65('0x21'),_0x475fb6,_0xdb65('0x22'));logger[_0xdb65('0x23')](_0xdb65('0x24'),_0x475fb6,_0xdb65('0x22'),JSON[_0xdb65('0x25')](_0x3c0a3d));if(_0x3c0a3d[_0xdb65('0x26')]){if(_0x3c0a3d[_0xdb65('0x26')]['code']===0x1f4){logger[_0xdb65('0x26')]('Setting,\x20%s,\x20%s',_0x475fb6,_0x3c0a3d['error'][_0xdb65('0x27')]);return _0x54dc75(_0x3c0a3d[_0xdb65('0x26')]['message']);}logger[_0xdb65('0x26')](_0xdb65('0x21'),_0x475fb6,_0x3c0a3d[_0xdb65('0x26')][_0xdb65('0x27')]);return _0x2633cf(_0x3c0a3d[_0xdb65('0x26')][_0xdb65('0x27')]);}else{logger[_0xdb65('0x20')](_0xdb65('0x21'),_0x475fb6,_0xdb65('0x22'));_0x2633cf(_0x3c0a3d[_0xdb65('0x28')][_0xdb65('0x27')]);}})[_0xdb65('0x29')](function(_0x4ee65a){logger['error'](_0xdb65('0x21'),_0x475fb6,_0x4ee65a);_0x54dc75(_0x4ee65a);});});}function respondWithStatusCode(_0x247458,_0x2b9d50){_0x2b9d50=_0x2b9d50||0xcc;return function(_0x19d1ba){if(_0x19d1ba){return _0x247458[_0xdb65('0x2a')](_0x2b9d50);}return _0x247458[_0xdb65('0x2b')](_0x2b9d50)['end']();};}function respondWithResult(_0x19b9b4,_0x2b9d35){_0x2b9d35=_0x2b9d35||0xc8;return function(_0x179e0c){if(_0x179e0c){return _0x19b9b4[_0xdb65('0x2b')](_0x2b9d35)['json'](_0x179e0c);}};}function respondWithFilteredResult(_0x178312,_0x344986){return function(_0x4acbdb){if(_0x4acbdb){var _0x1288ad=_0x4acbdb[_0xdb65('0x2c')],_0x599b80=_0x344986['offset'],_0x55cb0b=_0x344986[_0xdb65('0x2d')]+_0x344986['limit'],_0x2d1dd9;if(_0x55cb0b>=_0x1288ad){_0x55cb0b=_0x1288ad;_0x2d1dd9=0xc8;}else{_0x2d1dd9=0xce;}_0x178312[_0xdb65('0x2b')](_0x2d1dd9);return _0x178312['set'](_0xdb65('0x2e'),_0x599b80+'-'+_0x55cb0b+'/'+_0x1288ad)[_0xdb65('0x2f')](_0x4acbdb);}return null;};}function patchUpdates(_0x44fb1e){return function(_0x2b72e1){try{jsonpatch[_0xdb65('0x30')](_0x2b72e1,_0x44fb1e,!![]);}catch(_0x395b09){return BPromise[_0xdb65('0x31')](_0x395b09);}return _0x2b72e1[_0xdb65('0x32')]();};}function saveUpdates(_0x43e277,_0x29a0b5){return function(_0x2e28c5){if(_0x2e28c5){return _0x2e28c5['update'](_0x43e277)[_0xdb65('0x1f')](function(_0x262876){return _0x262876;});}return null;};}function removeEntity(_0x15f7b5,_0x157fc2){return function(_0x44fad6){if(_0x44fad6){return _0x44fad6[_0xdb65('0x33')]()[_0xdb65('0x1f')](function(){_0x15f7b5[_0xdb65('0x2b')](0xcc)[_0xdb65('0x34')]();});}};}function handleEntityNotFound(_0x1692e4,_0x3566b3){return function(_0x2b3e66){if(!_0x2b3e66){_0x1692e4[_0xdb65('0x2a')](0x194);}return _0x2b3e66;};}function handleError(_0x209674,_0x1e94ca){_0x1e94ca=_0x1e94ca||0x1f4;return function(_0x2f7756){logger[_0xdb65('0x26')](_0x2f7756[_0xdb65('0x35')]);if(_0x2f7756[_0xdb65('0x36')]){delete _0x2f7756[_0xdb65('0x36')];}_0x209674['status'](_0x1e94ca)[_0xdb65('0x37')](_0x2f7756);};}exports[_0xdb65('0x38')]=function(_0x36fbd,_0x20166a){var _0x38b846={},_0xa1ba7b={},_0x300ccf={'count':0x0,'rows':[]};var _0x37b240=_[_0xdb65('0x39')](db[_0xdb65('0x3a')][_0xdb65('0x3b')],function(_0x565bec){return{'name':_0x565bec['fieldName'],'type':_0x565bec[_0xdb65('0x3c')]['key']};});_0xa1ba7b[_0xdb65('0x3d')]=_[_0xdb65('0x39')](_0x37b240,_0xdb65('0x36'));_0xa1ba7b[_0xdb65('0x3e')]=_[_0xdb65('0x3f')](_0x36fbd[_0xdb65('0x3e')]);_0xa1ba7b[_0xdb65('0x40')]=_[_0xdb65('0x41')](_0xa1ba7b[_0xdb65('0x3d')],_0xa1ba7b['query']);_0x38b846[_0xdb65('0x42')]=_[_0xdb65('0x41')](_0xa1ba7b[_0xdb65('0x3d')],qs[_0xdb65('0x43')](_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x43')]));_0x38b846[_0xdb65('0x42')]=_0x38b846[_0xdb65('0x42')][_0xdb65('0x44')]?_0x38b846[_0xdb65('0x42')]:_0xa1ba7b['model'];if(!_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x45')](_0xdb65('0x46'))){_0x38b846[_0xdb65('0x47')]=qs[_0xdb65('0x47')](_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x47')]);_0x38b846[_0xdb65('0x2d')]=qs[_0xdb65('0x2d')](_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x2d')]);}_0x38b846[_0xdb65('0x48')]=qs['sort'](_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x49')]);_0x38b846[_0xdb65('0x4a')]=qs['filters'](_['pick'](_0x36fbd[_0xdb65('0x3e')],_0xa1ba7b[_0xdb65('0x40')]),_0x37b240);if(_0x36fbd['query'][_0xdb65('0x4b')]){_0x38b846['where']=_[_0xdb65('0x4c')](_0x38b846['where'],{'$or':_[_0xdb65('0x39')](_0x37b240,function(_0x16db68){if(_0x16db68['type']!==_0xdb65('0x4d')){var _0x49e650={};_0x49e650[_0x16db68[_0xdb65('0x36')]]={'$like':'%'+_0x36fbd[_0xdb65('0x3e')][_0xdb65('0x4b')]+'%'};return _0x49e650;}})});}_0x38b846=_[_0xdb65('0x4c')]({},_0x38b846,_0x36fbd[_0xdb65('0x4e')]);var _0x59b0c9={'where':_0x38b846[_0xdb65('0x4a')]};return db['Setting'][_0xdb65('0x2c')](_0x59b0c9)[_0xdb65('0x1f')](function(_0x2776bb){_0x300ccf['count']=_0x2776bb;if(_0x36fbd['query'][_0xdb65('0x4f')]){_0x38b846[_0xdb65('0x50')]=[{'all':!![]}];}return db[_0xdb65('0x3a')][_0xdb65('0x51')](_0x38b846);})['then'](function(_0x7926dc){_0x300ccf['rows']=_0x7926dc;return _0x300ccf;})[_0xdb65('0x1f')](respondWithFilteredResult(_0x20166a,_0x38b846))[_0xdb65('0x29')](handleError(_0x20166a,null));};exports[_0xdb65('0x52')]=function(_0x15b280,_0xd6a54c){var _0x3ec328={'raw':![],'where':{'id':_0x15b280[_0xdb65('0x53')]['id']}},_0x91c393={};_0x91c393[_0xdb65('0x3d')]=_[_0xdb65('0x3f')](db[_0xdb65('0x3a')][_0xdb65('0x3b')]);_0x91c393['query']=_[_0xdb65('0x3f')](_0x15b280[_0xdb65('0x3e')]);_0x91c393[_0xdb65('0x40')]=_[_0xdb65('0x41')](_0x91c393[_0xdb65('0x3d')],_0x91c393[_0xdb65('0x3e')]);_0x3ec328[_0xdb65('0x42')]=_['intersection'](_0x91c393[_0xdb65('0x3d')],qs[_0xdb65('0x43')](_0x15b280[_0xdb65('0x3e')][_0xdb65('0x43')]));_0x3ec328[_0xdb65('0x42')]=_0x3ec328[_0xdb65('0x42')]['length']?_0x3ec328[_0xdb65('0x42')]:_0x91c393[_0xdb65('0x3d')];if(_0x15b280['query'][_0xdb65('0x4f')]){_0x3ec328[_0xdb65('0x50')]=[{'all':!![]}];}_0x3ec328=_[_0xdb65('0x4c')]({},_0x3ec328,_0x15b280[_0xdb65('0x4e')]);return db[_0xdb65('0x3a')]['find'](_0x3ec328)['then'](handleEntityNotFound(_0xd6a54c,null))[_0xdb65('0x1f')](respondWithResult(_0xd6a54c,null))[_0xdb65('0x29')](handleError(_0xd6a54c,null));};exports[_0xdb65('0x54')]=function(_0x31a441,_0x1884b1){if(_0x31a441[_0xdb65('0x55')]['id']){delete _0x31a441[_0xdb65('0x55')]['id'];}return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x31a441[_0xdb65('0x53')]['id']}})[_0xdb65('0x1f')](handleEntityNotFound(_0x1884b1,null))['then'](saveUpdates(_0x31a441['body'],null))[_0xdb65('0x1f')](respondWithResult(_0x1884b1,null))[_0xdb65('0x29')](handleError(_0x1884b1,null));};exports[_0xdb65('0x57')]=function(_0xedafdc,_0x36bc74,_0x29e882){if(_0xedafdc[_0xdb65('0x58')]&&_0xedafdc['file'][_0xdb65('0x59')]){_0xedafdc[_0xdb65('0x55')][_0xdb65('0x5a')]=_0xedafdc['file'][_0xdb65('0x59')];}return db[_0xdb65('0x3a')]['find']({'where':{'id':_0xedafdc['params']['id']}})[_0xdb65('0x1f')](handleEntityNotFound(_0x36bc74,null))[_0xdb65('0x1f')](saveUpdates(_0xedafdc['body'],null))[_0xdb65('0x1f')](respondWithResult(_0x36bc74,null))['catch'](handleError(_0x36bc74,null));};exports['addLogoLogin']=function(_0x1088db,_0x1497d7,_0x31c9c1){if(_0x1088db[_0xdb65('0x58')]&&_0x1088db[_0xdb65('0x58')][_0xdb65('0x59')]){_0x1088db[_0xdb65('0x55')][_0xdb65('0x5b')]=_0x1088db['file'][_0xdb65('0x59')];}return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x1088db[_0xdb65('0x53')]['id']}})['then'](handleEntityNotFound(_0x1497d7,null))[_0xdb65('0x1f')](saveUpdates(_0x1088db[_0xdb65('0x55')],null))[_0xdb65('0x1f')](respondWithResult(_0x1497d7,null))[_0xdb65('0x29')](handleError(_0x1497d7,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x2eb4c9,_0x2667aa,_0x49960b){var _0x35e42a=_0xdb65('0x5c');var _0x16ce52={'custom':![]};return utilLicense[_0xdb65('0x5d')]()[_0xdb65('0x1f')](function(_0x132c36){if(_0x132c36){_0x16ce52=_0x132c36;}return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x2eb4c9[_0xdb65('0x53')]['id']},'attributes':[_0xdb65('0x5a'),'loginLogo',_0xdb65('0x5e'),_0xdb65('0x5f'),_0xdb65('0x60'),_0xdb65('0x61'),_0xdb65('0x62'),_0xdb65('0x63')],'raw':!![]});})[_0xdb65('0x1f')](handleEntityNotFound(_0x2667aa,null))[_0xdb65('0x1f')](function(_0x376cf5){if(_0x376cf5){var _0x14f3f9=_0x376cf5[_0xdb65('0x5a')]&&fs[_0xdb65('0x64')](path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x35e42a,_[_0xdb65('0x67')](_0x376cf5[_0xdb65('0x5a')])))?path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x35e42a,_['toLower'](_0x376cf5[_0xdb65('0x5a')])):path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x35e42a,_['toLower']('default_logo.svg'));var _0x285765=_0xdb65('0x68')+_['upperFirst']('logo');if(_0x376cf5[_0x285765]||!_0x16ce52[_0xdb65('0x69')]){_0x14f3f9=path['join'](config['root'],_0x35e42a,_[_0xdb65('0x67')]('default_logo.svg'));}if(!fs[_0xdb65('0x64')](_0x14f3f9)){throw new db[(_0xdb65('0x6a'))][(_0xdb65('0x6b'))](_[_0xdb65('0x6c')](_0xdb65('0x5a'))+_0xdb65('0x6d'));}return _0x2667aa['download'](_0x14f3f9);}})[_0xdb65('0x29')](handleError(_0x2667aa,null));};var utilLicense=require(_0xdb65('0x19'));exports[_0xdb65('0x6e')]=function(_0x2af7c2,_0x435405,_0x18eee5){var _0x22fdd4='server/files/images/logos';var _0x253d64={'custom':![]};return utilLicense[_0xdb65('0x5d')]()[_0xdb65('0x1f')](function(_0x356749){if(_0x356749){_0x253d64=_0x356749;}return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x2af7c2[_0xdb65('0x53')]['id']},'attributes':['logo',_0xdb65('0x5b'),_0xdb65('0x5e'),'favicon','defaultLogo',_0xdb65('0x61'),_0xdb65('0x62'),_0xdb65('0x63')],'raw':!![]});})[_0xdb65('0x1f')](handleEntityNotFound(_0x435405,null))[_0xdb65('0x1f')](function(_0x3f131f){if(_0x3f131f){var _0x71f9b5=_0x3f131f[_0xdb65('0x5b')]&&fs[_0xdb65('0x64')](path[_0xdb65('0x65')](config['root'],_0x22fdd4,_[_0xdb65('0x67')](_0x3f131f[_0xdb65('0x5b')])))?path['join'](config['root'],_0x22fdd4,_[_0xdb65('0x67')](_0x3f131f['loginLogo'])):path[_0xdb65('0x65')](config['root'],_0x22fdd4,_[_0xdb65('0x67')](_0xdb65('0x6f')));var _0x57146b='default'+_[_0xdb65('0x6c')](_0xdb65('0x5b'));if(_0x3f131f[_0x57146b]||!_0x253d64[_0xdb65('0x69')]){_0x71f9b5=path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x22fdd4,_[_0xdb65('0x67')]('default_loginLogo.svg'));}if(!fs[_0xdb65('0x64')](_0x71f9b5)){throw new db['Sequelize'][(_0xdb65('0x6b'))](_[_0xdb65('0x6c')](_0xdb65('0x5b'))+_0xdb65('0x6d'));}return _0x435405['download'](_0x71f9b5);}})[_0xdb65('0x29')](handleError(_0x435405,null));};exports[_0xdb65('0x70')]=function(_0x1cfe4a,_0xfe37bd){return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x1cfe4a[_0xdb65('0x53')]['id']},'attributes':[_0xdb65('0x71')]})[_0xdb65('0x1f')](respondWithResult(_0xfe37bd,null))[_0xdb65('0x29')](handleError(_0xfe37bd,null));};exports[_0xdb65('0x72')]=function(_0x45fe53,_0x3e97de,_0x460919){if(_0x45fe53['file']&&_0x45fe53[_0xdb65('0x58')][_0xdb65('0x59')]){_0x45fe53[_0xdb65('0x55')][_0xdb65('0x5e')]=_0x45fe53['file'][_0xdb65('0x59')];}return db['Setting']['find']({'where':{'id':_0x45fe53[_0xdb65('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e97de,null))[_0xdb65('0x1f')](saveUpdates(_0x45fe53[_0xdb65('0x55')],null))[_0xdb65('0x1f')](respondWithResult(_0x3e97de,null))[_0xdb65('0x29')](handleError(_0x3e97de,null));};var utilLicense=require('../../config/license/util');exports[_0xdb65('0x73')]=function(_0x3d15af,_0x199b96,_0x3bc240){var _0xa62b34=_0xdb65('0x5c');var _0xfb64a2={'custom':![]};return utilLicense[_0xdb65('0x5d')]()[_0xdb65('0x1f')](function(_0x397f8d){if(_0x397f8d){_0xfb64a2=_0x397f8d;}return db[_0xdb65('0x3a')]['find']({'where':{'id':_0x3d15af[_0xdb65('0x53')]['id']},'attributes':['logo',_0xdb65('0x5b'),'preferred',_0xdb65('0x5f'),_0xdb65('0x60'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xdb65('0x1f')](handleEntityNotFound(_0x199b96,null))[_0xdb65('0x1f')](function(_0x1d19ab){if(_0x1d19ab){var _0x81da06=_0x1d19ab['preferred']&&fs['existsSync'](path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0xa62b34,_[_0xdb65('0x67')](_0x1d19ab[_0xdb65('0x5e')])))?path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0xa62b34,_[_0xdb65('0x67')](_0x1d19ab['preferred'])):path[_0xdb65('0x65')](config['root'],_0xa62b34,_[_0xdb65('0x67')](_0xdb65('0x74')));var _0x4e526b=_0xdb65('0x68')+_[_0xdb65('0x6c')](_0xdb65('0x5e'));if(_0x1d19ab[_0x4e526b]||!_0xfb64a2[_0xdb65('0x69')]||!_0xfb64a2[_0xdb65('0x5e')]){_0x81da06=path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0xa62b34,_[_0xdb65('0x67')](_0xdb65('0x74')));}if(!fs[_0xdb65('0x64')](_0x81da06)){throw new db[(_0xdb65('0x6a'))][(_0xdb65('0x6b'))](_[_0xdb65('0x6c')](_0xdb65('0x5e'))+'\x20not\x20found');}return _0x199b96[_0xdb65('0x75')](_0x81da06);}})['catch'](handleError(_0x199b96,null));};exports[_0xdb65('0x76')]=function(_0x2fcc3b,_0x66373f,_0x4d21b0){if(_0x2fcc3b['file']&&_0x2fcc3b[_0xdb65('0x58')][_0xdb65('0x59')]){_0x2fcc3b[_0xdb65('0x55')][_0xdb65('0x5f')]=_0x2fcc3b[_0xdb65('0x58')][_0xdb65('0x59')];}return db[_0xdb65('0x3a')][_0xdb65('0x56')]({'where':{'id':_0x2fcc3b[_0xdb65('0x53')]['id']}})['then'](handleEntityNotFound(_0x66373f,null))[_0xdb65('0x1f')](saveUpdates(_0x2fcc3b['body'],null))['then'](respondWithResult(_0x66373f,null))[_0xdb65('0x29')](handleError(_0x66373f,null));};var utilLicense=require(_0xdb65('0x19'));exports['getFavicon']=function(_0x5d7b3b,_0x6b21b,_0x4c083e){var _0x2956ea=_0xdb65('0x5c');var _0x426270={'custom':![]};return utilLicense[_0xdb65('0x5d')]()[_0xdb65('0x1f')](function(_0x2207c3){if(_0x2207c3){_0x426270=_0x2207c3;}return db['Setting']['find']({'where':{'id':_0x5d7b3b[_0xdb65('0x53')]['id']},'attributes':[_0xdb65('0x5a'),_0xdb65('0x5b'),_0xdb65('0x5e'),'favicon','defaultLogo',_0xdb65('0x61'),_0xdb65('0x62'),'defaultFavicon'],'raw':!![]});})[_0xdb65('0x1f')](handleEntityNotFound(_0x6b21b,null))[_0xdb65('0x1f')](function(_0x4ed41d){if(_0x4ed41d){var _0xfd5de=_0x4ed41d[_0xdb65('0x5f')]&&fs[_0xdb65('0x64')](path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x2956ea,_[_0xdb65('0x67')](_0x4ed41d[_0xdb65('0x5f')])))?path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x2956ea,_[_0xdb65('0x67')](_0x4ed41d['favicon'])):path[_0xdb65('0x65')](config[_0xdb65('0x66')],_0x2956ea,_[_0xdb65('0x67')]('default_favicon.ico'));var _0x294469=_0xdb65('0x68')+_[_0xdb65('0x6c')](_0xdb65('0x5f'));if(_0x4ed41d[_0x294469]||!_0x426270['custom']){_0xfd5de=path['join'](config[_0xdb65('0x66')],_0x2956ea,_[_0xdb65('0x67')](_0xdb65('0x77')));}if(!fs['existsSync'](_0xfd5de)){throw new db[(_0xdb65('0x6a'))]['ValidationError'](_[_0xdb65('0x6c')](_0xdb65('0x5f'))+_0xdb65('0x6d'));}return _0x6b21b[_0xdb65('0x75')](_0xfd5de);}})['catch'](handleError(_0x6b21b,null));};exports[_0xdb65('0x78')]=function(_0x38551e,_0x443181){var _0x40d406={'offset':moment()[_0xdb65('0x79')]()};_0x40d406['now']=moment()['utcOffset'](_0x40d406[_0xdb65('0x2d')])[_0xdb65('0x7a')](_0xdb65('0x7b'));return _0x443181[_0xdb65('0x2b')](0xc8)[_0xdb65('0x37')](_0x40d406);}; \ No newline at end of file +var _0x8973=['default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','body','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLicense','preferred','defaultFavicon','default_loginLogo.svg','\x20not\x20found','securePassword','defaultPreferred','default_preferred.png','getFavicon'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x8973,0xeb));var _0x3897=function(_0x115ac5,_0x3f28ea){_0x115ac5=_0x115ac5-0x0;var _0x4c8c3a=_0x8973[_0x115ac5];return _0x4c8c3a;};'use strict';var pdf=require(_0x3897('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3897('0x1'));var jsonpatch=require(_0x3897('0x2'));var rp=require(_0x3897('0x3'));var moment=require(_0x3897('0x4'));var BPromise=require(_0x3897('0x5'));var Mustache=require(_0x3897('0x6'));var util=require(_0x3897('0x7'));var path=require('path');var sox=require(_0x3897('0x8'));var csv=require('to-csv');var ejs=require(_0x3897('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3897('0xa'));var crypto=require('crypto');var jsforce=require(_0x3897('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3897('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3897('0xd'));var as=require(_0x3897('0xe'));var hardwareService=require(_0x3897('0xf'));var logger=require(_0x3897('0x10'))(_0x3897('0x11'));var utils=require(_0x3897('0x12'));var config=require(_0x3897('0x13'));var licenseUtil=require(_0x3897('0x14'));var db=require(_0x3897('0x15'))['db'];var jayson=require(_0x3897('0x16'));var client=jayson[_0x3897('0x17')][_0x3897('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x244c7a,_0x50d202,_0x247e88,_0x48050f){return new BPromise(function(_0x358536,_0xe5097e){var _0x332da8=_0x48050f||client;return _0x332da8['request'](_0x244c7a,_0x247e88)[_0x3897('0x19')](function(_0x215375){logger[_0x3897('0x1a')](_0x3897('0x1b'),_0x50d202,_0x3897('0x1c'));logger['debug'](_0x3897('0x1d'),_0x50d202,_0x3897('0x1c'),JSON['stringify'](_0x215375));if(_0x215375[_0x3897('0x1e')]){if(_0x215375[_0x3897('0x1e')][_0x3897('0x1f')]===0x1f4){logger[_0x3897('0x1e')](_0x3897('0x1b'),_0x50d202,_0x215375[_0x3897('0x1e')][_0x3897('0x20')]);return _0xe5097e(_0x215375[_0x3897('0x1e')][_0x3897('0x20')]);}logger['error'](_0x3897('0x1b'),_0x50d202,_0x215375['error'][_0x3897('0x20')]);return _0x358536(_0x215375[_0x3897('0x1e')][_0x3897('0x20')]);}else{logger[_0x3897('0x1a')](_0x3897('0x1b'),_0x50d202,_0x3897('0x1c'));_0x358536(_0x215375[_0x3897('0x21')][_0x3897('0x20')]);}})['catch'](function(_0x3b3049){logger[_0x3897('0x1e')]('Setting,\x20%s,\x20%s',_0x50d202,_0x3b3049);_0xe5097e(_0x3b3049);});});}function respondWithStatusCode(_0x3cade9,_0x37988d){_0x37988d=_0x37988d||0xcc;return function(_0x599bd2){if(_0x599bd2){return _0x3cade9['sendStatus'](_0x37988d);}return _0x3cade9[_0x3897('0x22')](_0x37988d)[_0x3897('0x23')]();};}function respondWithResult(_0x21673d,_0x8762af){_0x8762af=_0x8762af||0xc8;return function(_0x483b98){if(_0x483b98){return _0x21673d[_0x3897('0x22')](_0x8762af)[_0x3897('0x24')](_0x483b98);}};}function respondWithFilteredResult(_0x5ec4ee,_0x12e01c){return function(_0x5a1914){if(_0x5a1914){var _0x1c74b6=_0x5a1914[_0x3897('0x25')],_0x18ad60=_0x12e01c[_0x3897('0x26')],_0x57e5b2=_0x12e01c[_0x3897('0x26')]+_0x12e01c[_0x3897('0x27')],_0x146980;if(_0x57e5b2>=_0x1c74b6){_0x57e5b2=_0x1c74b6;_0x146980=0xc8;}else{_0x146980=0xce;}_0x5ec4ee['status'](_0x146980);return _0x5ec4ee[_0x3897('0x28')](_0x3897('0x29'),_0x18ad60+'-'+_0x57e5b2+'/'+_0x1c74b6)[_0x3897('0x24')](_0x5a1914);}return null;};}function patchUpdates(_0x2cb8b6){return function(_0x487bcb){try{jsonpatch[_0x3897('0x2a')](_0x487bcb,_0x2cb8b6,!![]);}catch(_0x94aa6){return BPromise[_0x3897('0x2b')](_0x94aa6);}return _0x487bcb['save']();};}function saveUpdates(_0x122e75,_0x12c846){return function(_0x4fce69){if(_0x4fce69){return _0x4fce69[_0x3897('0x2c')](_0x122e75)['then'](function(_0x4f68f8){return _0x4f68f8;});}return null;};}function removeEntity(_0x1d43e6,_0x31e425){return function(_0xc29c9d){if(_0xc29c9d){return _0xc29c9d['destroy']()[_0x3897('0x19')](function(){_0x1d43e6[_0x3897('0x22')](0xcc)[_0x3897('0x23')]();});}};}function handleEntityNotFound(_0x54dbfc,_0x1d88d3){return function(_0x3a680f){if(!_0x3a680f){_0x54dbfc['sendStatus'](0x194);}return _0x3a680f;};}function handleError(_0x376824,_0x102cd4){_0x102cd4=_0x102cd4||0x1f4;return function(_0x6ec68){logger['error'](_0x6ec68[_0x3897('0x2d')]);if(_0x6ec68[_0x3897('0x2e')]){delete _0x6ec68['name'];}_0x376824['status'](_0x102cd4)[_0x3897('0x2f')](_0x6ec68);};}exports[_0x3897('0x30')]=function(_0x5f042d,_0x22a060){var _0x4d6b03={},_0x5be9ba={},_0x14d466={'count':0x0,'rows':[]};var _0x3e5a48=_[_0x3897('0x31')](db[_0x3897('0x32')][_0x3897('0x33')],function(_0x22475d){return{'name':_0x22475d[_0x3897('0x34')],'type':_0x22475d[_0x3897('0x35')][_0x3897('0x36')]};});_0x5be9ba[_0x3897('0x37')]=_[_0x3897('0x31')](_0x3e5a48,_0x3897('0x2e'));_0x5be9ba['query']=_[_0x3897('0x38')](_0x5f042d['query']);_0x5be9ba[_0x3897('0x39')]=_[_0x3897('0x3a')](_0x5be9ba[_0x3897('0x37')],_0x5be9ba[_0x3897('0x3b')]);_0x4d6b03[_0x3897('0x3c')]=_['intersection'](_0x5be9ba[_0x3897('0x37')],qs[_0x3897('0x3d')](_0x5f042d[_0x3897('0x3b')][_0x3897('0x3d')]));_0x4d6b03[_0x3897('0x3c')]=_0x4d6b03[_0x3897('0x3c')][_0x3897('0x3e')]?_0x4d6b03[_0x3897('0x3c')]:_0x5be9ba[_0x3897('0x37')];if(!_0x5f042d[_0x3897('0x3b')][_0x3897('0x3f')](_0x3897('0x40'))){_0x4d6b03[_0x3897('0x27')]=qs['limit'](_0x5f042d[_0x3897('0x3b')][_0x3897('0x27')]);_0x4d6b03['offset']=qs[_0x3897('0x26')](_0x5f042d[_0x3897('0x3b')][_0x3897('0x26')]);}_0x4d6b03[_0x3897('0x41')]=qs[_0x3897('0x42')](_0x5f042d[_0x3897('0x3b')][_0x3897('0x42')]);_0x4d6b03[_0x3897('0x43')]=qs[_0x3897('0x39')](_[_0x3897('0x44')](_0x5f042d[_0x3897('0x3b')],_0x5be9ba['filters']),_0x3e5a48);if(_0x5f042d[_0x3897('0x3b')][_0x3897('0x45')]){_0x4d6b03[_0x3897('0x43')]=_[_0x3897('0x46')](_0x4d6b03[_0x3897('0x43')],{'$or':_[_0x3897('0x31')](_0x3e5a48,function(_0x1209be){if(_0x1209be['type']!==_0x3897('0x47')){var _0x17af1f={};_0x17af1f[_0x1209be['name']]={'$like':'%'+_0x5f042d['query'][_0x3897('0x45')]+'%'};return _0x17af1f;}})});}_0x4d6b03=_['merge']({},_0x4d6b03,_0x5f042d['options']);var _0x482daa={'where':_0x4d6b03[_0x3897('0x43')]};return db[_0x3897('0x32')][_0x3897('0x25')](_0x482daa)[_0x3897('0x19')](function(_0xee128a){_0x14d466[_0x3897('0x25')]=_0xee128a;if(_0x5f042d[_0x3897('0x3b')][_0x3897('0x48')]){_0x4d6b03[_0x3897('0x49')]=[{'all':!![]}];}return db[_0x3897('0x32')]['findAll'](_0x4d6b03);})['then'](function(_0x40aa8c){_0x14d466[_0x3897('0x4a')]=_0x40aa8c;return _0x14d466;})[_0x3897('0x19')](respondWithFilteredResult(_0x22a060,_0x4d6b03))['catch'](handleError(_0x22a060,null));};exports[_0x3897('0x4b')]=function(_0x49f667,_0x4edc4f){var _0x918c8c={'raw':![],'where':{'id':_0x49f667[_0x3897('0x4c')]['id']}},_0x32ae5b={};_0x32ae5b['model']=_[_0x3897('0x38')](db['Setting'][_0x3897('0x33')]);_0x32ae5b['query']=_['keys'](_0x49f667[_0x3897('0x3b')]);_0x32ae5b[_0x3897('0x39')]=_[_0x3897('0x3a')](_0x32ae5b[_0x3897('0x37')],_0x32ae5b[_0x3897('0x3b')]);_0x918c8c[_0x3897('0x3c')]=_['intersection'](_0x32ae5b[_0x3897('0x37')],qs[_0x3897('0x3d')](_0x49f667[_0x3897('0x3b')][_0x3897('0x3d')]));_0x918c8c['attributes']=_0x918c8c['attributes'][_0x3897('0x3e')]?_0x918c8c[_0x3897('0x3c')]:_0x32ae5b[_0x3897('0x37')];if(_0x49f667[_0x3897('0x3b')][_0x3897('0x48')]){_0x918c8c['include']=[{'all':!![]}];}_0x918c8c=_[_0x3897('0x46')]({},_0x918c8c,_0x49f667[_0x3897('0x4d')]);return db[_0x3897('0x32')][_0x3897('0x4e')](_0x918c8c)[_0x3897('0x19')](handleEntityNotFound(_0x4edc4f,null))[_0x3897('0x19')](respondWithResult(_0x4edc4f,null))[_0x3897('0x4f')](handleError(_0x4edc4f,null));};exports['update']=function(_0x331e0c,_0x188ceb){if(_0x331e0c[_0x3897('0x50')]['id']){delete _0x331e0c[_0x3897('0x50')]['id'];}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x331e0c[_0x3897('0x4c')]['id']}})['then'](handleEntityNotFound(_0x188ceb,null))[_0x3897('0x19')](saveUpdates(_0x331e0c[_0x3897('0x50')],null))[_0x3897('0x19')](respondWithResult(_0x188ceb,null))['catch'](handleError(_0x188ceb,null));};exports['addLogo']=function(_0x1223c5,_0x580c80,_0x5da318){if(_0x1223c5[_0x3897('0x51')]&&_0x1223c5[_0x3897('0x51')][_0x3897('0x52')]){_0x1223c5[_0x3897('0x50')]['logo']=_0x1223c5[_0x3897('0x51')]['filename'];}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x1223c5[_0x3897('0x4c')]['id']}})[_0x3897('0x19')](handleEntityNotFound(_0x580c80,null))[_0x3897('0x19')](saveUpdates(_0x1223c5[_0x3897('0x50')],null))[_0x3897('0x19')](respondWithResult(_0x580c80,null))[_0x3897('0x4f')](handleError(_0x580c80,null));};exports[_0x3897('0x53')]=function(_0xf2b51c,_0x33a2a8,_0x30e3e5){if(_0xf2b51c[_0x3897('0x51')]&&_0xf2b51c['file']['filename']){_0xf2b51c[_0x3897('0x50')][_0x3897('0x54')]=_0xf2b51c[_0x3897('0x51')][_0x3897('0x52')];}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0xf2b51c[_0x3897('0x4c')]['id']}})[_0x3897('0x19')](handleEntityNotFound(_0x33a2a8,null))[_0x3897('0x19')](saveUpdates(_0xf2b51c['body'],null))['then'](respondWithResult(_0x33a2a8,null))[_0x3897('0x4f')](handleError(_0x33a2a8,null));};var utilLicense=require(_0x3897('0x14'));exports['getLogo']=function(_0x3a7c10,_0x1a7769,_0x37b10f){var _0x11589e=_0x3897('0x55');var _0x20c84b={'custom':![]};return utilLicense['getLicense']()[_0x3897('0x19')](function(_0x6ec327){if(_0x6ec327){_0x20c84b=_0x6ec327;}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x3a7c10['params']['id']},'attributes':[_0x3897('0x56'),_0x3897('0x54'),'preferred',_0x3897('0x57'),_0x3897('0x58'),_0x3897('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x3897('0x19')](handleEntityNotFound(_0x1a7769,null))['then'](function(_0x1d5bc5){if(_0x1d5bc5){var _0x1c4faa=_0x1d5bc5['logo']&&fs[_0x3897('0x5a')](path[_0x3897('0x5b')](config[_0x3897('0x5c')],_0x11589e,_[_0x3897('0x5d')](_0x1d5bc5[_0x3897('0x56')])))?path['join'](config['root'],_0x11589e,_[_0x3897('0x5d')](_0x1d5bc5[_0x3897('0x56')])):path[_0x3897('0x5b')](config['root'],_0x11589e,_[_0x3897('0x5d')](_0x3897('0x5e')));var _0x2cf770=_0x3897('0x5f')+_[_0x3897('0x60')](_0x3897('0x56'));if(_0x1d5bc5[_0x2cf770]||!_0x20c84b[_0x3897('0x61')]){_0x1c4faa=path['join'](config[_0x3897('0x5c')],_0x11589e,_[_0x3897('0x5d')]('default_logo.svg'));}if(!fs[_0x3897('0x5a')](_0x1c4faa)){throw new db[(_0x3897('0x62'))][(_0x3897('0x63'))](_[_0x3897('0x60')](_0x3897('0x56'))+'\x20not\x20found');}return _0x1a7769[_0x3897('0x64')](_0x1c4faa);}})['catch'](handleError(_0x1a7769,null));};var utilLicense=require(_0x3897('0x14'));exports['getLogoLogin']=function(_0x527cbd,_0x4a7a44,_0x3bbe0f){var _0x27d52f=_0x3897('0x55');var _0x36e25e={'custom':![]};return utilLicense[_0x3897('0x65')]()[_0x3897('0x19')](function(_0x28b5c4){if(_0x28b5c4){_0x36e25e=_0x28b5c4;}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x527cbd['params']['id']},'attributes':[_0x3897('0x56'),_0x3897('0x54'),_0x3897('0x66'),_0x3897('0x57'),_0x3897('0x58'),_0x3897('0x59'),'defaultPreferred',_0x3897('0x67')],'raw':!![]});})[_0x3897('0x19')](handleEntityNotFound(_0x4a7a44,null))['then'](function(_0x15dd8d){if(_0x15dd8d){var _0x2e5f38=_0x15dd8d[_0x3897('0x54')]&&fs[_0x3897('0x5a')](path['join'](config['root'],_0x27d52f,_[_0x3897('0x5d')](_0x15dd8d[_0x3897('0x54')])))?path['join'](config[_0x3897('0x5c')],_0x27d52f,_[_0x3897('0x5d')](_0x15dd8d[_0x3897('0x54')])):path[_0x3897('0x5b')](config[_0x3897('0x5c')],_0x27d52f,_['toLower'](_0x3897('0x68')));var _0x2ab147=_0x3897('0x5f')+_[_0x3897('0x60')](_0x3897('0x54'));if(_0x15dd8d[_0x2ab147]||!_0x36e25e['custom']){_0x2e5f38=path['join'](config[_0x3897('0x5c')],_0x27d52f,_[_0x3897('0x5d')](_0x3897('0x68')));}if(!fs[_0x3897('0x5a')](_0x2e5f38)){throw new db['Sequelize'][(_0x3897('0x63'))](_[_0x3897('0x60')](_0x3897('0x54'))+_0x3897('0x69'));}return _0x4a7a44['download'](_0x2e5f38);}})[_0x3897('0x4f')](handleError(_0x4a7a44,null));};exports['gdpr']=function(_0x1e713b,_0x479155){return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x1e713b[_0x3897('0x4c')]['id']},'attributes':[_0x3897('0x6a')]})[_0x3897('0x19')](respondWithResult(_0x479155,null))[_0x3897('0x4f')](handleError(_0x479155,null));};exports['addPreferred']=function(_0x4a3bcd,_0xec3e92,_0xa148cf){if(_0x4a3bcd[_0x3897('0x51')]&&_0x4a3bcd['file']['filename']){_0x4a3bcd['body'][_0x3897('0x66')]=_0x4a3bcd[_0x3897('0x51')][_0x3897('0x52')];}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x4a3bcd['params']['id']}})[_0x3897('0x19')](handleEntityNotFound(_0xec3e92,null))[_0x3897('0x19')](saveUpdates(_0x4a3bcd[_0x3897('0x50')],null))[_0x3897('0x19')](respondWithResult(_0xec3e92,null))[_0x3897('0x4f')](handleError(_0xec3e92,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x3abbc8,_0x40714c,_0xff0f19){var _0x3c9eb8=_0x3897('0x55');var _0x170aa0={'custom':![]};return utilLicense[_0x3897('0x65')]()[_0x3897('0x19')](function(_0x2ac35f){if(_0x2ac35f){_0x170aa0=_0x2ac35f;}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x3abbc8[_0x3897('0x4c')]['id']},'attributes':[_0x3897('0x56'),'loginLogo',_0x3897('0x66'),_0x3897('0x57'),_0x3897('0x58'),_0x3897('0x59'),_0x3897('0x6b'),_0x3897('0x67')],'raw':!![]});})[_0x3897('0x19')](handleEntityNotFound(_0x40714c,null))[_0x3897('0x19')](function(_0x37e7f7){if(_0x37e7f7){var _0x53d0bc=_0x37e7f7[_0x3897('0x66')]&&fs[_0x3897('0x5a')](path[_0x3897('0x5b')](config[_0x3897('0x5c')],_0x3c9eb8,_[_0x3897('0x5d')](_0x37e7f7[_0x3897('0x66')])))?path[_0x3897('0x5b')](config['root'],_0x3c9eb8,_[_0x3897('0x5d')](_0x37e7f7[_0x3897('0x66')])):path[_0x3897('0x5b')](config[_0x3897('0x5c')],_0x3c9eb8,_[_0x3897('0x5d')](_0x3897('0x6c')));var _0x5b6e5e=_0x3897('0x5f')+_[_0x3897('0x60')](_0x3897('0x66'));if(_0x37e7f7[_0x5b6e5e]||!_0x170aa0[_0x3897('0x61')]||!_0x170aa0[_0x3897('0x66')]){_0x53d0bc=path[_0x3897('0x5b')](config[_0x3897('0x5c')],_0x3c9eb8,_[_0x3897('0x5d')](_0x3897('0x6c')));}if(!fs[_0x3897('0x5a')](_0x53d0bc)){throw new db['Sequelize'][(_0x3897('0x63'))](_['upperFirst']('preferred')+_0x3897('0x69'));}return _0x40714c[_0x3897('0x64')](_0x53d0bc);}})['catch'](handleError(_0x40714c,null));};exports['addFavicon']=function(_0x3f9a27,_0x2c3e5d,_0x255a1c){if(_0x3f9a27[_0x3897('0x51')]&&_0x3f9a27[_0x3897('0x51')][_0x3897('0x52')]){_0x3f9a27['body'][_0x3897('0x57')]=_0x3f9a27[_0x3897('0x51')]['filename'];}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x3f9a27[_0x3897('0x4c')]['id']}})[_0x3897('0x19')](handleEntityNotFound(_0x2c3e5d,null))[_0x3897('0x19')](saveUpdates(_0x3f9a27['body'],null))[_0x3897('0x19')](respondWithResult(_0x2c3e5d,null))[_0x3897('0x4f')](handleError(_0x2c3e5d,null));};var utilLicense=require(_0x3897('0x14'));exports[_0x3897('0x6d')]=function(_0x172e02,_0x413c6d,_0x23fc38){var _0x292aa4=_0x3897('0x55');var _0x2ba5dc={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x7850b8){if(_0x7850b8){_0x2ba5dc=_0x7850b8;}return db[_0x3897('0x32')][_0x3897('0x4e')]({'where':{'id':_0x172e02[_0x3897('0x4c')]['id']},'attributes':[_0x3897('0x56'),_0x3897('0x54'),'preferred','favicon',_0x3897('0x58'),_0x3897('0x59'),_0x3897('0x6b'),_0x3897('0x67')],'raw':!![]});})[_0x3897('0x19')](handleEntityNotFound(_0x413c6d,null))[_0x3897('0x19')](function(_0x11f95d){if(_0x11f95d){var _0x5d34aa=_0x11f95d[_0x3897('0x57')]&&fs['existsSync'](path['join'](config[_0x3897('0x5c')],_0x292aa4,_[_0x3897('0x5d')](_0x11f95d[_0x3897('0x57')])))?path['join'](config[_0x3897('0x5c')],_0x292aa4,_[_0x3897('0x5d')](_0x11f95d['favicon'])):path['join'](config['root'],_0x292aa4,_['toLower'](_0x3897('0x6e')));var _0x5c61e3='default'+_[_0x3897('0x60')](_0x3897('0x57'));if(_0x11f95d[_0x5c61e3]||!_0x2ba5dc['custom']){_0x5d34aa=path[_0x3897('0x5b')](config['root'],_0x292aa4,_[_0x3897('0x5d')](_0x3897('0x6e')));}if(!fs[_0x3897('0x5a')](_0x5d34aa)){throw new db[(_0x3897('0x62'))]['ValidationError'](_[_0x3897('0x60')](_0x3897('0x57'))+_0x3897('0x69'));}return _0x413c6d[_0x3897('0x64')](_0x5d34aa);}})[_0x3897('0x4f')](handleError(_0x413c6d,null));};exports['getDate']=function(_0x19ab50,_0x2570d5){var _0x4cbcc0={'offset':moment()[_0x3897('0x6f')]()};_0x4cbcc0[_0x3897('0x70')]=moment()[_0x3897('0x6f')](_0x4cbcc0[_0x3897('0x26')])[_0x3897('0x71')](_0x3897('0x72'));return _0x2570d5[_0x3897('0x22')](0xc8)[_0x3897('0x2f')](_0x4cbcc0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e92cbea..4388fa1 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 _0xade3=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','settings'];(function(_0xf1cb9f,_0x44b556){var _0x652eeb=function(_0x2f7b10){while(--_0x2f7b10){_0xf1cb9f['push'](_0xf1cb9f['shift']());}};_0x652eeb(++_0x44b556);}(_0xade3,0x82));var _0x3ade=function(_0x59e4f5,_0x3fd4ab){_0x59e4f5=_0x59e4f5-0x0;var _0x4ced86=_0xade3[_0x59e4f5];return _0x4ced86;};'use strict';var _=require('lodash');var util=require(_0x3ade('0x0'));var logger=require(_0x3ade('0x1'))(_0x3ade('0x2'));var moment=require('moment');var BPromise=require(_0x3ade('0x3'));var rp=require(_0x3ade('0x4'));var fs=require('fs');var path=require(_0x3ade('0x5'));var rimraf=require(_0x3ade('0x6'));var config=require(_0x3ade('0x7'));var attributes=require(_0x3ade('0x8'));module[_0x3ade('0x9')]=function(_0x3356af,_0x2d96ac){return _0x3356af[_0x3ade('0xa')](_0x3ade('0xb'),attributes,{'tableName':_0x3ade('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfad=['request-promise','path','../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xcfad,0x14d));var _0xdcfa=function(_0x62482,_0xfeb0df){_0x62482=_0x62482-0x0;var _0x38e62b=_0xcfad[_0x62482];return _0x38e62b;};'use strict';var _=require(_0xdcfa('0x0'));var util=require(_0xdcfa('0x1'));var logger=require(_0xdcfa('0x2'))('api');var moment=require(_0xdcfa('0x3'));var BPromise=require(_0xdcfa('0x4'));var rp=require(_0xdcfa('0x5'));var fs=require('fs');var path=require(_0xdcfa('0x6'));var rimraf=require('rimraf');var config=require(_0xdcfa('0x7'));var attributes=require(_0xdcfa('0x8'));module[_0xdcfa('0x9')]=function(_0xae2b7,_0x3416c3){return _0xae2b7[_0xdcfa('0xa')](_0xdcfa('0xb'),attributes,{'tableName':_0xdcfa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3024391..6f7147c 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 _0x6fca=['debug','stringify','error','message','result','catch','Setting','find','raw','options','where','include','map','model','attributes','ShowSetting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x6fca,0xfe));var _0xa6fc=function(_0x15a516,_0x1c9182){_0x15a516=_0x15a516-0x0;var _0x459d1a=_0x6fca[_0x15a516];return _0x459d1a;};'use strict';var _=require(_0xa6fc('0x0'));var util=require(_0xa6fc('0x1'));var moment=require(_0xa6fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6fc('0x3'));var fs=require('fs');var Redis=require(_0xa6fc('0x4'));var db=require(_0xa6fc('0x5'))['db'];var utils=require(_0xa6fc('0x6'));var logger=require(_0xa6fc('0x7'))(_0xa6fc('0x8'));var config=require(_0xa6fc('0x9'));var jayson=require(_0xa6fc('0xa'));var client=jayson[_0xa6fc('0xb')][_0xa6fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x560b96,_0x47a38c,_0x5e51af){return new BPromise(function(_0x450d13,_0x1572f7){return client[_0xa6fc('0xd')](_0x560b96,_0x5e51af)[_0xa6fc('0xe')](function(_0x2176b1){logger[_0xa6fc('0xf')](_0xa6fc('0x10'),_0x47a38c,_0xa6fc('0x11'));logger[_0xa6fc('0x12')]('Setting,\x20%s,\x20%s,\x20%s',_0x47a38c,_0xa6fc('0x11'),JSON[_0xa6fc('0x13')](_0x2176b1));if(_0x2176b1['error']){if(_0x2176b1[_0xa6fc('0x14')]['code']===0x1f4){logger[_0xa6fc('0x14')](_0xa6fc('0x10'),_0x47a38c,_0x2176b1[_0xa6fc('0x14')][_0xa6fc('0x15')]);return _0x1572f7(_0x2176b1['error'][_0xa6fc('0x15')]);}logger['error'](_0xa6fc('0x10'),_0x47a38c,_0x2176b1[_0xa6fc('0x14')]['message']);return _0x450d13(_0x2176b1[_0xa6fc('0x14')][_0xa6fc('0x15')]);}else{logger[_0xa6fc('0xf')]('Setting,\x20%s,\x20%s',_0x47a38c,_0xa6fc('0x11'));_0x450d13(_0x2176b1[_0xa6fc('0x16')]['message']);}})[_0xa6fc('0x17')](function(_0x2c3750){logger['error'](_0xa6fc('0x10'),_0x47a38c,_0x2c3750);_0x1572f7(_0x2c3750);});});}exports['ShowSetting']=function(_0x7c369b){var _0x1118e8=this;return new Promise(function(_0xf9f298,_0x3d5a5a){return db[_0xa6fc('0x18')][_0xa6fc('0x19')]({'raw':_0x7c369b['options']?_0x7c369b['options'][_0xa6fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x7c369b['options']?_0x7c369b[_0xa6fc('0x1b')][_0xa6fc('0x1c')]||null:null,'attributes':_0x7c369b[_0xa6fc('0x1b')]?_0x7c369b[_0xa6fc('0x1b')]['attributes']||null:null,'include':_0x7c369b[_0xa6fc('0x1b')]?_0x7c369b[_0xa6fc('0x1b')][_0xa6fc('0x1d')]?_[_0xa6fc('0x1e')](_0x7c369b[_0xa6fc('0x1b')][_0xa6fc('0x1d')],function(_0x4489b6){return{'model':db[_0x4489b6[_0xa6fc('0x1f')]],'as':_0x4489b6['as'],'attributes':_0x4489b6[_0xa6fc('0x20')],'include':_0x4489b6[_0xa6fc('0x1d')]?_[_0xa6fc('0x1e')](_0x4489b6['include'],function(_0x453faf){return{'model':db[_0x453faf[_0xa6fc('0x1f')]],'as':_0x453faf['as'],'attributes':_0x453faf[_0xa6fc('0x20')],'include':_0x453faf[_0xa6fc('0x1d')]?_[_0xa6fc('0x1e')](_0x453faf[_0xa6fc('0x1d')],function(_0x4e2504){return{'model':db[_0x4e2504[_0xa6fc('0x1f')]],'as':_0x4e2504['as'],'attributes':_0x4e2504['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc87121){logger[_0xa6fc('0xf')](_0xa6fc('0x21'),_0x7c369b);logger[_0xa6fc('0x12')](_0xa6fc('0x21'),_0x7c369b,JSON[_0xa6fc('0x13')](_0xc87121));_0xf9f298(_0xc87121);})[_0xa6fc('0x17')](function(_0x521d06){logger[_0xa6fc('0x14')](_0xa6fc('0x21'),_0x521d06[_0xa6fc('0x15')],_0x7c369b);_0x3d5a5a(_0x1118e8[_0xa6fc('0x14')](0x1f4,_0x521d06[_0xa6fc('0x15')]));});});}; \ No newline at end of file +var _0xec97=['Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','include','map','attributes','model','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2e242a,_0xa9bed0){var _0x3fd26d=function(_0x5e4bf1){while(--_0x5e4bf1){_0x2e242a['push'](_0x2e242a['shift']());}};_0x3fd26d(++_0xa9bed0);}(_0xec97,0x173));var _0x7ec9=function(_0x1d193c,_0x19e138){_0x1d193c=_0x1d193c-0x0;var _0xdcd99a=_0xec97[_0x1d193c];return _0xdcd99a;};'use strict';var _=require(_0x7ec9('0x0'));var util=require(_0x7ec9('0x1'));var moment=require('moment');var BPromise=require(_0x7ec9('0x2'));var rs=require(_0x7ec9('0x3'));var fs=require('fs');var Redis=require(_0x7ec9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ec9('0x5'));var logger=require(_0x7ec9('0x6'))(_0x7ec9('0x7'));var config=require(_0x7ec9('0x8'));var jayson=require(_0x7ec9('0x9'));var client=jayson[_0x7ec9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9ac0,_0x10da06,_0xdade83){return new BPromise(function(_0x347251,_0xc83d80){return client[_0x7ec9('0xb')](_0x3f9ac0,_0xdade83)[_0x7ec9('0xc')](function(_0x2bd278){logger['info'](_0x7ec9('0xd'),_0x10da06,_0x7ec9('0xe'));logger['debug'](_0x7ec9('0xf'),_0x10da06,_0x7ec9('0xe'),JSON['stringify'](_0x2bd278));if(_0x2bd278[_0x7ec9('0x10')]){if(_0x2bd278[_0x7ec9('0x10')]['code']===0x1f4){logger['error'](_0x7ec9('0xd'),_0x10da06,_0x2bd278[_0x7ec9('0x10')]['message']);return _0xc83d80(_0x2bd278[_0x7ec9('0x10')][_0x7ec9('0x11')]);}logger[_0x7ec9('0x10')](_0x7ec9('0xd'),_0x10da06,_0x2bd278[_0x7ec9('0x10')][_0x7ec9('0x11')]);return _0x347251(_0x2bd278[_0x7ec9('0x10')][_0x7ec9('0x11')]);}else{logger[_0x7ec9('0x12')](_0x7ec9('0xd'),_0x10da06,'request\x20sent');_0x347251(_0x2bd278[_0x7ec9('0x13')]['message']);}})[_0x7ec9('0x14')](function(_0x58cb42){logger['error']('Setting,\x20%s,\x20%s',_0x10da06,_0x58cb42);_0xc83d80(_0x58cb42);});});}exports[_0x7ec9('0x15')]=function(_0x4153db){var _0x2e72d1=this;return new Promise(function(_0x6d80bf,_0x5a2bd7){return db[_0x7ec9('0x16')][_0x7ec9('0x17')]({'raw':_0x4153db['options']?_0x4153db[_0x7ec9('0x18')][_0x7ec9('0x19')]===undefined?!![]:![]:!![],'where':_0x4153db[_0x7ec9('0x18')]?_0x4153db['options'][_0x7ec9('0x1a')]||null:null,'attributes':_0x4153db[_0x7ec9('0x18')]?_0x4153db[_0x7ec9('0x18')]['attributes']||null:null,'include':_0x4153db[_0x7ec9('0x18')]?_0x4153db['options'][_0x7ec9('0x1b')]?_[_0x7ec9('0x1c')](_0x4153db[_0x7ec9('0x18')][_0x7ec9('0x1b')],function(_0x214fac){return{'model':db[_0x214fac['model']],'as':_0x214fac['as'],'attributes':_0x214fac[_0x7ec9('0x1d')],'include':_0x214fac[_0x7ec9('0x1b')]?_[_0x7ec9('0x1c')](_0x214fac[_0x7ec9('0x1b')],function(_0x19bcac){return{'model':db[_0x19bcac[_0x7ec9('0x1e')]],'as':_0x19bcac['as'],'attributes':_0x19bcac[_0x7ec9('0x1d')],'include':_0x19bcac['include']?_[_0x7ec9('0x1c')](_0x19bcac[_0x7ec9('0x1b')],function(_0x2f57a8){return{'model':db[_0x2f57a8[_0x7ec9('0x1e')]],'as':_0x2f57a8['as'],'attributes':_0x2f57a8[_0x7ec9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7ec9('0xc')](function(_0x4dc354){logger[_0x7ec9('0x12')]('ShowSetting',_0x4153db);logger[_0x7ec9('0x1f')](_0x7ec9('0x15'),_0x4153db,JSON['stringify'](_0x4dc354));_0x6d80bf(_0x4dc354);})[_0x7ec9('0x14')](function(_0xf463f0){logger['error'](_0x7ec9('0x15'),_0xf463f0['message'],_0x4153db);_0x5a2bd7(_0x2e72d1[_0x7ec9('0x10')](0x1f4,_0xf463f0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c1ca08d..7735331 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 _0x9033=['delete','exports','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','/:id','update','destroy','removeDispositions'];(function(_0xba83b1,_0x3f81d1){var _0x60e057=function(_0x3cd902){while(--_0x3cd902){_0xba83b1['push'](_0xba83b1['shift']());}};_0x60e057(++_0x3f81d1);}(_0x9033,0x16a));var _0x3903=function(_0x2a6968,_0x5010ad){_0x2a6968=_0x2a6968-0x0;var _0x1bf164=_0x9033[_0x2a6968];return _0x1bf164;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3903('0x0'));var express=require(_0x3903('0x1'));var router=express[_0x3903('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3903('0x3'));var controller=require(_0x3903('0x4'));router[_0x3903('0x5')]('/',auth[_0x3903('0x6')](),controller[_0x3903('0x7')]);router[_0x3903('0x5')](_0x3903('0x8'),auth[_0x3903('0x6')](),controller[_0x3903('0x9')]);router[_0x3903('0x5')]('/:id',auth[_0x3903('0x6')](),controller[_0x3903('0xa')]);router[_0x3903('0x5')](_0x3903('0xb'),auth[_0x3903('0x6')](),controller[_0x3903('0xc')]);router['get'](_0x3903('0xd'),auth[_0x3903('0x6')](),controller[_0x3903('0xe')]);router[_0x3903('0x5')](_0x3903('0xf'),auth[_0x3903('0x6')](),controller[_0x3903('0x10')]);router['get'](_0x3903('0x11'),auth[_0x3903('0x6')](),controller[_0x3903('0x12')]);router['get'](_0x3903('0x13'),controller['statusGet']);router[_0x3903('0x5')](_0x3903('0x14'),auth[_0x3903('0x6')](),controller[_0x3903('0x15')]);router[_0x3903('0x16')]('/',auth['isAuthenticated'](),controller[_0x3903('0x17')]);router[_0x3903('0x16')](_0x3903('0xb'),auth['isAuthenticated'](),controller[_0x3903('0x18')]);router['post'](_0x3903('0xd'),auth[_0x3903('0x6')](),controller[_0x3903('0x19')]);router[_0x3903('0x16')](_0x3903('0x1a'),controller[_0x3903('0x1b')]);router['post'](_0x3903('0xf'),auth['isAuthenticated'](),controller[_0x3903('0x1c')]);router['post'](_0x3903('0x1d'),auth[_0x3903('0x6')](),controller[_0x3903('0x1e')]);router[_0x3903('0x16')]('/:id/status',controller[_0x3903('0x1f')]);router[_0x3903('0x16')]('/:id/users',auth[_0x3903('0x6')](),controller[_0x3903('0x20')]);router[_0x3903('0x21')](_0x3903('0x22'),auth[_0x3903('0x6')](),controller[_0x3903('0x23')]);router['delete'](_0x3903('0x22'),auth['isAuthenticated'](),controller[_0x3903('0x24')]);router['delete'](_0x3903('0xb'),auth['isAuthenticated'](),controller[_0x3903('0x25')]);router['delete'](_0x3903('0xd'),auth[_0x3903('0x6')](),controller['removeAnswers']);router[_0x3903('0x26')](_0x3903('0x14'),auth[_0x3903('0x6')](),controller['removeAgents']);module[_0x3903('0x27')]=router; \ No newline at end of file +var _0x7c40=['/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','statusGet'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x7c40,0x6a));var _0x07c4=function(_0x33fd68,_0x4c4d1d){_0x33fd68=_0x33fd68-0x0;var _0x2d3423=_0x7c40[_0x33fd68];return _0x2d3423;};'use strict';var multer=require(_0x07c4('0x0'));var util=require('util');var path=require(_0x07c4('0x1'));var timeout=require(_0x07c4('0x2'));var express=require(_0x07c4('0x3'));var router=express['Router']();var auth=require(_0x07c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x07c4('0x5'));var controller=require(_0x07c4('0x6'));router[_0x07c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x07c4('0x8')]);router[_0x07c4('0x7')](_0x07c4('0x9'),auth[_0x07c4('0xa')](),controller[_0x07c4('0xb')]);router['get'](_0x07c4('0xc'),auth[_0x07c4('0xa')](),controller[_0x07c4('0xd')]);router['get'](_0x07c4('0xe'),auth[_0x07c4('0xa')](),controller['getDispositions']);router[_0x07c4('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x07c4('0xf')]);router[_0x07c4('0x7')](_0x07c4('0x10'),auth[_0x07c4('0xa')](),controller[_0x07c4('0x11')]);router[_0x07c4('0x7')]('/:id/interactions',auth[_0x07c4('0xa')](),controller[_0x07c4('0x12')]);router[_0x07c4('0x7')]('/:id/status',controller[_0x07c4('0x13')]);router[_0x07c4('0x7')](_0x07c4('0x14'),auth['isAuthenticated'](),controller[_0x07c4('0x15')]);router[_0x07c4('0x16')]('/',auth[_0x07c4('0xa')](),controller[_0x07c4('0x17')]);router[_0x07c4('0x16')](_0x07c4('0xe'),auth[_0x07c4('0xa')](),controller[_0x07c4('0x18')]);router[_0x07c4('0x16')](_0x07c4('0x19'),auth['isAuthenticated'](),controller[_0x07c4('0x1a')]);router[_0x07c4('0x16')](_0x07c4('0x1b'),controller[_0x07c4('0x1c')]);router[_0x07c4('0x16')](_0x07c4('0x10'),auth[_0x07c4('0xa')](),controller[_0x07c4('0x1d')]);router[_0x07c4('0x16')](_0x07c4('0x1e'),auth[_0x07c4('0xa')](),controller[_0x07c4('0x1f')]);router[_0x07c4('0x16')](_0x07c4('0x20'),controller[_0x07c4('0x21')]);router[_0x07c4('0x16')]('/:id/users',auth[_0x07c4('0xa')](),controller[_0x07c4('0x22')]);router[_0x07c4('0x23')]('/:id',auth[_0x07c4('0xa')](),controller[_0x07c4('0x24')]);router[_0x07c4('0x25')]('/:id',auth[_0x07c4('0xa')](),controller[_0x07c4('0x26')]);router[_0x07c4('0x25')]('/:id/dispositions',auth[_0x07c4('0xa')](),controller[_0x07c4('0x27')]);router[_0x07c4('0x25')](_0x07c4('0x19'),auth[_0x07c4('0xa')](),controller[_0x07c4('0x28')]);router[_0x07c4('0x25')]('/:id/users',auth[_0x07c4('0xa')](),controller[_0x07c4('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e3e2dbb..908667c 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 _0x7dab=['intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth'];(function(_0x345335,_0x206556){var _0x1f33c0=function(_0x31e876){while(--_0x31e876){_0x345335['push'](_0x345335['shift']());}};_0x1f33c0(++_0x206556);}(_0x7dab,0xe5));var _0xb7da=function(_0x26b1bd,_0x5a8fb0){_0x26b1bd=_0x26b1bd-0x0;var _0x5ebda3=_0x7dab[_0x26b1bd];return _0x5ebda3;};'use strict';var Sequelize=require(_0xb7da('0x0'));var rs=require(_0xb7da('0x1'));module[_0xb7da('0x2')]={'name':{'type':Sequelize[_0xb7da('0x3')],'unique':_0xb7da('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb7da('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb7da('0x3')],'defaultValue':function(){return rs[_0xb7da('0x5')]();}},'phone':{'type':Sequelize[_0xb7da('0x3')]},'type':{'type':Sequelize[_0xb7da('0x6')](_0xb7da('0x7'),_0xb7da('0x8'),_0xb7da('0x9'),'clicksend',_0xb7da('0xa'),_0xb7da('0xb'),_0xb7da('0xc'),'csc','infobip',_0xb7da('0xd'))},'accountSid':{'type':Sequelize[_0xb7da('0x3')]},'authId':{'type':Sequelize[_0xb7da('0x3')]},'authToken':{'type':Sequelize[_0xb7da('0x3')]},'smsMethod':{'type':Sequelize[_0xb7da('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb7da('0x3')]},'password':{'type':Sequelize[_0xb7da('0x3')]},'apiKey':{'type':Sequelize[_0xb7da('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xb7da('0x3')]},'senderString':{'type':Sequelize[_0xb7da('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb7da('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb7da('0xe');}},'notificationSound':{'type':Sequelize[_0xb7da('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb7da('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb7da('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb7da('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb7da('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb7da('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb7da('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xb7da('0xf')],'defaultValue':![],'comment':_0xb7da('0x12'),'set':function(_0xab868c){if(!_0xab868c)this['setDataValue'](_0xb7da('0x13'),null);this[_0xb7da('0x14')](_0xb7da('0x15'),_0xab868c);}}}; \ No newline at end of file +var _0x4d41=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','skebby','connectel','clicksend','csc','infobip','intelepeer','ENUM','BOOLEAN','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'];(function(_0x368a3e,_0x47b292){var _0x3cb213=function(_0x1c283d){while(--_0x1c283d){_0x368a3e['push'](_0x368a3e['shift']());}};_0x3cb213(++_0x47b292);}(_0x4d41,0x153));var _0x14d4=function(_0x42f1e6,_0x372465){_0x42f1e6=_0x42f1e6-0x0;var _0xea2816=_0x4d41[_0x42f1e6];return _0xea2816;};'use strict';var Sequelize=require(_0x14d4('0x0'));var rs=require(_0x14d4('0x1'));module[_0x14d4('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x14d4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x14d4('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x14d4('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x14d4('0x4')],'defaultValue':function(){return rs[_0x14d4('0x5')]();}},'phone':{'type':Sequelize[_0x14d4('0x4')]},'type':{'type':Sequelize['ENUM']('twilio',_0x14d4('0x6'),_0x14d4('0x7'),_0x14d4('0x8'),'plivo','clickatell','bandwidth',_0x14d4('0x9'),_0x14d4('0xa'),_0x14d4('0xb'))},'accountSid':{'type':Sequelize[_0x14d4('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x14d4('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0x14d4('0x4')]},'password':{'type':Sequelize[_0x14d4('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x14d4('0x4')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x14d4('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x14d4('0xe');}},'notificationSound':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x14d4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x14d4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x14d4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x14d4('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x14d4('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x14d4('0xd')],'defaultValue':![],'comment':_0x14d4('0x11'),'set':function(_0x512c79){if(!_0x512c79)this[_0x14d4('0x12')](_0x14d4('0x13'),null);this[_0x14d4('0x12')](_0x14d4('0x14'),_0x512c79);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2e946a6..4ba1c0f 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 _0x32ff=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','sequelize','transaction','bulkCreate','priority','getApplications','pick','User','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','merge'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x32ff,0x8e));var _0xf32f=function(_0x514785,_0x5afccc){_0x514785=_0x514785-0x0;var _0x4807bb=_0x32ff[_0x514785];return _0x4807bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf32f('0x0'));var rimraf=require(_0xf32f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf32f('0x2'));var rp=require(_0xf32f('0x3'));var moment=require(_0xf32f('0x4'));var BPromise=require(_0xf32f('0x5'));var Mustache=require(_0xf32f('0x6'));var util=require(_0xf32f('0x7'));var path=require('path');var sox=require(_0xf32f('0x8'));var csv=require(_0xf32f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf32f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf32f('0xb'));var toCsv=require(_0xf32f('0x9'));var querystring=require(_0xf32f('0xc'));var Papa=require(_0xf32f('0xd'));var Redis=require(_0xf32f('0xe'));var authService=require(_0xf32f('0xf'));var qs=require(_0xf32f('0x10'));var as=require(_0xf32f('0x11'));var hardwareService=require(_0xf32f('0x12'));var logger=require('../../config/logger')(_0xf32f('0x13'));var utils=require(_0xf32f('0x14'));var config=require(_0xf32f('0x15'));var licenseUtil=require(_0xf32f('0x16'));var db=require(_0xf32f('0x17'))['db'];config[_0xf32f('0x18')]=_['defaults'](config['redis'],{'host':_0xf32f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf32f('0x18')]));require(_0xf32f('0x1a'))[_0xf32f('0x1b')](socket);var jayson=require(_0xf32f('0x1c'));var client=jayson[_0xf32f('0x1d')][_0xf32f('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x21a61e,_0x1d13c6,_0x522e7a,_0x69ee34){return new BPromise(function(_0x566a7a,_0x219b9d){var _0x387217=_0x69ee34||client;return _0x387217['request'](_0x21a61e,_0x522e7a)[_0xf32f('0x1f')](function(_0x295ca0){logger[_0xf32f('0x20')](_0xf32f('0x21'),_0x1d13c6,_0xf32f('0x22'));logger['debug'](_0xf32f('0x23'),_0x1d13c6,_0xf32f('0x22'),JSON['stringify'](_0x295ca0));if(_0x295ca0[_0xf32f('0x24')]){if(_0x295ca0[_0xf32f('0x24')][_0xf32f('0x25')]===0x1f4){logger['error'](_0xf32f('0x21'),_0x1d13c6,_0x295ca0['error'][_0xf32f('0x26')]);return _0x219b9d(_0x295ca0[_0xf32f('0x24')]['message']);}logger[_0xf32f('0x24')](_0xf32f('0x21'),_0x1d13c6,_0x295ca0[_0xf32f('0x24')][_0xf32f('0x26')]);return _0x566a7a(_0x295ca0['error'][_0xf32f('0x26')]);}else{logger[_0xf32f('0x20')](_0xf32f('0x21'),_0x1d13c6,_0xf32f('0x22'));_0x566a7a(_0x295ca0[_0xf32f('0x27')][_0xf32f('0x26')]);}})['catch'](function(_0xe8f797){logger[_0xf32f('0x24')](_0xf32f('0x21'),_0x1d13c6,_0xe8f797);_0x219b9d(_0xe8f797);});});}function respondWithStatusCode(_0x23497e,_0x16430b){_0x16430b=_0x16430b||0xcc;return function(_0x3e9b56){if(_0x3e9b56){return _0x23497e['sendStatus'](_0x16430b);}return _0x23497e[_0xf32f('0x28')](_0x16430b)['end']();};}function respondWithResult(_0x40ad1f,_0x4dd52b){_0x4dd52b=_0x4dd52b||0xc8;return function(_0x680031){if(_0x680031){return _0x40ad1f[_0xf32f('0x28')](_0x4dd52b)['json'](_0x680031);}};}function respondWithFilteredResult(_0x4e47ee,_0x44249b){return function(_0xc5bea8){if(_0xc5bea8){var _0x446019=_0xc5bea8[_0xf32f('0x29')],_0x5b8e53=_0x44249b[_0xf32f('0x2a')],_0x479ba1=_0x44249b['offset']+_0x44249b[_0xf32f('0x2b')],_0x338d34;if(_0x479ba1>=_0x446019){_0x479ba1=_0x446019;_0x338d34=0xc8;}else{_0x338d34=0xce;}_0x4e47ee[_0xf32f('0x28')](_0x338d34);return _0x4e47ee[_0xf32f('0x2c')](_0xf32f('0x2d'),_0x5b8e53+'-'+_0x479ba1+'/'+_0x446019)[_0xf32f('0x2e')](_0xc5bea8);}return null;};}function patchUpdates(_0x5b6e04){return function(_0x4a592a){try{jsonpatch[_0xf32f('0x2f')](_0x4a592a,_0x5b6e04,!![]);}catch(_0x48f795){return BPromise[_0xf32f('0x30')](_0x48f795);}return _0x4a592a[_0xf32f('0x31')]();};}function saveUpdates(_0x1c823f,_0x1d9c85){return function(_0x4075cf){if(_0x4075cf){return _0x4075cf['update'](_0x1c823f)[_0xf32f('0x1f')](function(_0x1ab613){return _0x1ab613;});}return null;};}function removeEntity(_0x42b7f4,_0x3eb8d5){return function(_0x98f184){if(_0x98f184){return _0x98f184[_0xf32f('0x32')]()['then'](function(){var _0x3d216b=_0x98f184[_0xf32f('0x33')]({'plain':!![]});var _0x5105c9=_0xf32f('0x34');return db[_0xf32f('0x35')][_0xf32f('0x32')]({'where':{'type':_0x5105c9,'resourceId':_0x3d216b['id']}})[_0xf32f('0x1f')](function(){return _0x98f184;});})[_0xf32f('0x1f')](function(){_0x42b7f4[_0xf32f('0x28')](0xcc)[_0xf32f('0x36')]();});}};}function handleEntityNotFound(_0x4670e4,_0xe2ed3){return function(_0x2b6bb1){if(!_0x2b6bb1){_0x4670e4[_0xf32f('0x37')](0x194);}return _0x2b6bb1;};}function handleError(_0x50c5d0,_0x36b522){_0x36b522=_0x36b522||0x1f4;return function(_0x2ab03e){logger[_0xf32f('0x24')](_0x2ab03e[_0xf32f('0x38')]);if(_0x2ab03e[_0xf32f('0x39')]){delete _0x2ab03e['name'];}_0x50c5d0[_0xf32f('0x28')](_0x36b522)[_0xf32f('0x3a')](_0x2ab03e);};}exports[_0xf32f('0x3b')]=function(_0x52b6fe,_0x53b8d8){var _0x5dafd0={'include':[{'model':db[_0xf32f('0x3c')],'as':_0xf32f('0x3d')}]},_0x19585b={},_0x2b9379={'count':0x0,'rows':[]};var _0xa5e6cc=_[_0xf32f('0x3e')](db[_0xf32f('0x3f')][_0xf32f('0x40')],function(_0x432eab){return{'name':_0x432eab[_0xf32f('0x41')],'type':_0x432eab[_0xf32f('0x42')][_0xf32f('0x43')]};});_0x19585b[_0xf32f('0x44')]=_[_0xf32f('0x3e')](_0xa5e6cc,_0xf32f('0x39'));_0x19585b[_0xf32f('0x45')]=_[_0xf32f('0x46')](_0x52b6fe[_0xf32f('0x45')]);_0x19585b['filters']=_['intersection'](_0x19585b[_0xf32f('0x44')],_0x19585b[_0xf32f('0x45')]);_0x5dafd0[_0xf32f('0x47')]=_[_0xf32f('0x48')](_0x19585b[_0xf32f('0x44')],qs['fields'](_0x52b6fe[_0xf32f('0x45')][_0xf32f('0x49')]));_0x5dafd0[_0xf32f('0x47')]=_0x5dafd0[_0xf32f('0x47')][_0xf32f('0x4a')]?_0x5dafd0[_0xf32f('0x47')]:_0x19585b[_0xf32f('0x44')];if(!_0x52b6fe[_0xf32f('0x45')]['hasOwnProperty']('nolimit')){_0x5dafd0[_0xf32f('0x2b')]=qs[_0xf32f('0x2b')](_0x52b6fe['query'][_0xf32f('0x2b')]);_0x5dafd0['offset']=qs['offset'](_0x52b6fe[_0xf32f('0x45')]['offset']);}_0x5dafd0[_0xf32f('0x4b')]=qs[_0xf32f('0x4c')](_0x52b6fe[_0xf32f('0x45')][_0xf32f('0x4c')]);_0x5dafd0[_0xf32f('0x4d')]=qs[_0xf32f('0x4e')](_['pick'](_0x52b6fe[_0xf32f('0x45')],_0x19585b[_0xf32f('0x4e')]),_0xa5e6cc);if(_0x52b6fe[_0xf32f('0x45')]['filter']){_0x5dafd0[_0xf32f('0x4d')]=_[_0xf32f('0x4f')](_0x5dafd0[_0xf32f('0x4d')],{'$or':_[_0xf32f('0x3e')](_0xa5e6cc,function(_0x217103){if(_0x217103['type']!==_0xf32f('0x50')){var _0x105f4d={};_0x105f4d[_0x217103['name']]={'$like':'%'+_0x52b6fe['query'][_0xf32f('0x51')]+'%'};return _0x105f4d;}})});}_0x5dafd0=_[_0xf32f('0x4f')]({},_0x5dafd0,_0x52b6fe[_0xf32f('0x52')]);var _0x4e12d7={'where':_0x5dafd0[_0xf32f('0x4d')]};return db[_0xf32f('0x3f')][_0xf32f('0x29')](_0x4e12d7)[_0xf32f('0x1f')](function(_0x2119bf){_0x2b9379[_0xf32f('0x29')]=_0x2119bf;if(_0x52b6fe[_0xf32f('0x45')][_0xf32f('0x53')]){_0x5dafd0[_0xf32f('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0xf32f('0x55')](_0x5dafd0);})[_0xf32f('0x1f')](function(_0x2f5b0d){_0x2b9379[_0xf32f('0x56')]=_0x2f5b0d;return _0x2b9379;})['then'](respondWithFilteredResult(_0x53b8d8,_0x5dafd0))[_0xf32f('0x57')](handleError(_0x53b8d8,null));};exports[_0xf32f('0x58')]=function(_0x285455,_0x2ce351){var _0x2ef2b3={'raw':![],'where':{'id':_0x285455[_0xf32f('0x59')]['id']},'include':[{'model':db[_0xf32f('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4c2833={};_0x4c2833[_0xf32f('0x44')]=_['keys'](db['SmsAccount'][_0xf32f('0x40')]);_0x4c2833['query']=_[_0xf32f('0x46')](_0x285455['query']);_0x4c2833[_0xf32f('0x4e')]=_['intersection'](_0x4c2833['model'],_0x4c2833[_0xf32f('0x45')]);_0x2ef2b3[_0xf32f('0x47')]=_[_0xf32f('0x48')](_0x4c2833[_0xf32f('0x44')],qs[_0xf32f('0x49')](_0x285455[_0xf32f('0x45')]['fields']));_0x2ef2b3[_0xf32f('0x47')]=_0x2ef2b3[_0xf32f('0x47')][_0xf32f('0x4a')]?_0x2ef2b3['attributes']:_0x4c2833[_0xf32f('0x44')];if(_0x285455['query'][_0xf32f('0x53')]){_0x2ef2b3[_0xf32f('0x54')]=[{'all':!![]}];}_0x2ef2b3=_[_0xf32f('0x4f')]({},_0x2ef2b3,_0x285455[_0xf32f('0x52')]);return db['SmsAccount'][_0xf32f('0x5a')](_0x2ef2b3)[_0xf32f('0x1f')](handleEntityNotFound(_0x2ce351,null))[_0xf32f('0x1f')](respondWithResult(_0x2ce351,null))[_0xf32f('0x57')](handleError(_0x2ce351,null));};exports['create']=function(_0xfb04b0,_0x5c8fb2){return db[_0xf32f('0x3f')][_0xf32f('0x5b')](_0xfb04b0[_0xf32f('0x5c')],{})[_0xf32f('0x1f')](function(_0xefe071){var _0x4a924a=_0xfb04b0[_0xf32f('0x5d')]['get']({'plain':!![]});if(!_0x4a924a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a924a['role']===_0xf32f('0x5d')){var _0x5ccc4d=_0xefe071[_0xf32f('0x33')]({'plain':!![]});var _0x55685f='SmsAccounts';return db[_0xf32f('0x5e')]['find']({'where':{'name':_0x55685f,'userProfileId':_0x4a924a[_0xf32f('0x5f')]},'raw':!![]})[_0xf32f('0x1f')](function(_0x410d90){if(_0x410d90&&_0x410d90['autoAssociation']===0x0){return db[_0xf32f('0x35')][_0xf32f('0x5b')]({'name':_0x5ccc4d[_0xf32f('0x39')],'resourceId':_0x5ccc4d['id'],'type':_0x410d90[_0xf32f('0x39')],'sectionId':_0x410d90['id']},{})['then'](function(){return _0xefe071;});}else{return _0xefe071;}})[_0xf32f('0x57')](function(_0x5cbdcb){logger[_0xf32f('0x24')](_0xf32f('0x60'),_0x5cbdcb);throw _0x5cbdcb;});}return _0xefe071;})['then'](respondWithResult(_0x5c8fb2,0xc9))[_0xf32f('0x57')](handleError(_0x5c8fb2,null));};exports[_0xf32f('0x61')]=function(_0x520941,_0x71a6cc){if(_0x520941['body']['id']){delete _0x520941[_0xf32f('0x5c')]['id'];}return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x520941[_0xf32f('0x59')]['id']},'include':[{'model':db[_0xf32f('0x3c')],'as':_0xf32f('0x3d')}]})[_0xf32f('0x1f')](handleEntityNotFound(_0x71a6cc,null))[_0xf32f('0x1f')](saveUpdates(_0x520941[_0xf32f('0x5c')],null))[_0xf32f('0x1f')](respondWithResult(_0x71a6cc,null))[_0xf32f('0x57')](handleError(_0x71a6cc,null));};exports[_0xf32f('0x32')]=function(_0x5075e4,_0x101cc3){return db['SmsAccount'][_0xf32f('0x5a')]({'where':{'id':_0x5075e4[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x101cc3,null))[_0xf32f('0x1f')](removeEntity(_0x101cc3,null))[_0xf32f('0x57')](handleError(_0x101cc3,null));};exports[_0xf32f('0x62')]=function(_0x471d24,_0x143d68){return db['SmsAccount'][_0xf32f('0x62')]()[_0xf32f('0x1f')](respondWithResult(_0x143d68,null))[_0xf32f('0x57')](handleError(_0x143d68,null));};exports[_0xf32f('0x63')]=function(_0x573275,_0x22cc7f,_0x22bef6){if(_0x573275['body']['id']){delete _0x573275['body']['id'];}return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x573275['params']['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x22cc7f,null))[_0xf32f('0x1f')](function(_0x1eb264){if(_0x1eb264){_0x573275['body']['SmsAccountId']=_0x1eb264['id'];return db[_0xf32f('0x64')][_0xf32f('0x5b')](_0x573275[_0xf32f('0x5c')]);}})['then'](respondWithResult(_0x22cc7f,null))[_0xf32f('0x57')](handleError(_0x22cc7f,null));};exports[_0xf32f('0x65')]=function(_0x1da5de,_0x4267bf,_0x527927){var _0x376ffa={'raw':![],'where':{}};var _0x4ce65f={};var _0x369b1a={'count':0x0,'rows':[]};return db[_0xf32f('0x3f')][_0xf32f('0x66')]({'where':{'id':_0x1da5de[_0xf32f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4267bf,null))[_0xf32f('0x1f')](function(_0x3ce1bc){if(_0x3ce1bc){_0x4ce65f[_0xf32f('0x44')]=_[_0xf32f('0x46')](db[_0xf32f('0x64')]['rawAttributes']);_0x4ce65f[_0xf32f('0x45')]=_[_0xf32f('0x46')](_0x1da5de[_0xf32f('0x45')]);_0x4ce65f[_0xf32f('0x4e')]=_['intersection'](_0x4ce65f[_0xf32f('0x44')],_0x4ce65f[_0xf32f('0x45')]);_0x376ffa[_0xf32f('0x47')]=_['intersection'](_0x4ce65f['model'],qs[_0xf32f('0x49')](_0x1da5de[_0xf32f('0x45')][_0xf32f('0x49')]));_0x376ffa[_0xf32f('0x47')]=_0x376ffa[_0xf32f('0x47')]['length']?_0x376ffa['attributes']:_0x4ce65f[_0xf32f('0x44')];if(!_0x1da5de[_0xf32f('0x45')][_0xf32f('0x67')](_0xf32f('0x68'))){_0x376ffa[_0xf32f('0x2b')]=qs[_0xf32f('0x2b')](_0x1da5de['query'][_0xf32f('0x2b')]);_0x376ffa[_0xf32f('0x2a')]=qs['offset'](_0x1da5de[_0xf32f('0x45')][_0xf32f('0x2a')]);}_0x376ffa[_0xf32f('0x4b')]=qs[_0xf32f('0x4c')](_0x1da5de[_0xf32f('0x45')][_0xf32f('0x4c')]);_0x376ffa[_0xf32f('0x4d')]=qs[_0xf32f('0x4e')](_['pick'](_0x1da5de[_0xf32f('0x45')],_0x4ce65f[_0xf32f('0x4e')]));_0x376ffa[_0xf32f('0x4d')][_0xf32f('0x69')]=_0x3ce1bc['id'];if(_0x1da5de['query'][_0xf32f('0x51')]){_0x376ffa['where']=_[_0xf32f('0x4f')](_0x376ffa[_0xf32f('0x4d')],{'$or':_[_0xf32f('0x3e')](_0x376ffa[_0xf32f('0x47')],function(_0x4de4d7){var _0x25566b={};_0x25566b[_0x4de4d7]={'$like':'%'+_0x1da5de[_0xf32f('0x45')][_0xf32f('0x51')]+'%'};return _0x25566b;})});}_0x376ffa=_[_0xf32f('0x4f')]({},_0x376ffa,_0x1da5de[_0xf32f('0x52')]);return db[_0xf32f('0x64')][_0xf32f('0x29')]({'where':_0x376ffa['where']})[_0xf32f('0x1f')](function(_0xb59f69){_0x369b1a[_0xf32f('0x29')]=_0xb59f69;if(_0x1da5de[_0xf32f('0x45')][_0xf32f('0x53')]){_0x376ffa[_0xf32f('0x54')]=[{'all':!![]}];}return db[_0xf32f('0x64')]['findAll'](_0x376ffa);})[_0xf32f('0x1f')](function(_0x16635c){_0x369b1a[_0xf32f('0x56')]=_0x16635c;return _0x369b1a;});}})[_0xf32f('0x1f')](respondWithFilteredResult(_0x4267bf,_0x376ffa))[_0xf32f('0x57')](handleError(_0x4267bf,null));};exports[_0xf32f('0x6a')]=function(_0x467f75,_0x554b84,_0xf0508f){return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x467f75['params']['id']}})['then'](handleEntityNotFound(_0x554b84,null))[_0xf32f('0x1f')](function(_0x2ca434){if(_0x2ca434){return _0x2ca434['removeDispositions'](_0x467f75[_0xf32f('0x45')][_0xf32f('0x6b')]);}})[_0xf32f('0x1f')](respondWithStatusCode(_0x554b84,null))[_0xf32f('0x57')](handleError(_0x554b84,null));};exports[_0xf32f('0x6c')]=function(_0x4dc641,_0x2c8093,_0x24993c){if(_0x4dc641[_0xf32f('0x5c')]['id']){delete _0x4dc641[_0xf32f('0x5c')]['id'];}return db[_0xf32f('0x3f')]['find']({'where':{'id':_0x4dc641['params']['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x2c8093,null))[_0xf32f('0x1f')](function(_0x3540d7){if(_0x3540d7){_0x4dc641[_0xf32f('0x5c')]['SmsAccountId']=_0x3540d7['id'];return db[_0xf32f('0x6d')]['create'](_0x4dc641[_0xf32f('0x5c')]);}})[_0xf32f('0x1f')](respondWithResult(_0x2c8093,null))[_0xf32f('0x57')](handleError(_0x2c8093,null));};exports[_0xf32f('0x6e')]=function(_0x342723,_0x247ae1,_0x56535f){var _0x5635d4={'raw':![],'where':{}};var _0x3b5211={};var _0x148668={'count':0x0,'rows':[]};return db[_0xf32f('0x3f')]['findOne']({'where':{'id':_0x342723[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x247ae1,null))[_0xf32f('0x1f')](function(_0x540369){if(_0x540369){_0x3b5211[_0xf32f('0x44')]=_['keys'](db[_0xf32f('0x6d')][_0xf32f('0x40')]);_0x3b5211['query']=_['keys'](_0x342723[_0xf32f('0x45')]);_0x3b5211['filters']=_[_0xf32f('0x48')](_0x3b5211[_0xf32f('0x44')],_0x3b5211[_0xf32f('0x45')]);_0x5635d4[_0xf32f('0x47')]=_['intersection'](_0x3b5211[_0xf32f('0x44')],qs['fields'](_0x342723[_0xf32f('0x45')][_0xf32f('0x49')]));_0x5635d4['attributes']=_0x5635d4['attributes'][_0xf32f('0x4a')]?_0x5635d4[_0xf32f('0x47')]:_0x3b5211[_0xf32f('0x44')];if(!_0x342723[_0xf32f('0x45')][_0xf32f('0x67')](_0xf32f('0x68'))){_0x5635d4[_0xf32f('0x2b')]=qs[_0xf32f('0x2b')](_0x342723[_0xf32f('0x45')][_0xf32f('0x2b')]);_0x5635d4[_0xf32f('0x2a')]=qs[_0xf32f('0x2a')](_0x342723[_0xf32f('0x45')][_0xf32f('0x2a')]);}_0x5635d4['order']=qs[_0xf32f('0x4c')](_0x342723[_0xf32f('0x45')][_0xf32f('0x4c')]);_0x5635d4[_0xf32f('0x4d')]=qs['filters'](_['pick'](_0x342723[_0xf32f('0x45')],_0x3b5211['filters']));_0x5635d4[_0xf32f('0x4d')]['SmsAccountId']=_0x540369['id'];if(_0x342723[_0xf32f('0x45')][_0xf32f('0x51')]){_0x5635d4[_0xf32f('0x4d')]=_[_0xf32f('0x4f')](_0x5635d4[_0xf32f('0x4d')],{'$or':_['map'](_0x5635d4[_0xf32f('0x47')],function(_0x4996d2){var _0x39d78a={};_0x39d78a[_0x4996d2]={'$like':'%'+_0x342723[_0xf32f('0x45')]['filter']+'%'};return _0x39d78a;})});}_0x5635d4=_[_0xf32f('0x4f')]({},_0x5635d4,_0x342723[_0xf32f('0x52')]);return db['CannedAnswer'][_0xf32f('0x29')]({'where':_0x5635d4['where']})[_0xf32f('0x1f')](function(_0x3eb076){_0x148668[_0xf32f('0x29')]=_0x3eb076;if(_0x342723['query'][_0xf32f('0x53')]){_0x5635d4['include']=[{'all':!![]}];}return db[_0xf32f('0x6d')][_0xf32f('0x55')](_0x5635d4);})[_0xf32f('0x1f')](function(_0x4556a8){_0x148668[_0xf32f('0x56')]=_0x4556a8;return _0x148668;});}})[_0xf32f('0x1f')](respondWithFilteredResult(_0x247ae1,_0x5635d4))[_0xf32f('0x57')](handleError(_0x247ae1,null));};exports['removeAnswers']=function(_0x1d4de3,_0x567bbe,_0x1fe538){return db['SmsAccount'][_0xf32f('0x5a')]({'where':{'id':_0x1d4de3[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x567bbe,null))[_0xf32f('0x1f')](function(_0x239f06){if(_0x239f06){return _0x239f06[_0xf32f('0x6f')](_0x1d4de3['query'][_0xf32f('0x6b')]);}})[_0xf32f('0x1f')](respondWithStatusCode(_0x567bbe,null))['catch'](handleError(_0x567bbe,null));};exports['notify']=function(_0x1ee390,_0x53eb99,_0x34c5ed){var _0xe4bdbd={'channel':'sms'};var _0x3f1698=[];var _0xa0464=[];var _0xd018f6={};return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x1ee390[_0xf32f('0x59')]['id']},'include':[{'model':db[_0xf32f('0x70')],'as':_0xf32f('0x71')}]})[_0xf32f('0x1f')](handleEntityNotFound(_0x53eb99,null))[_0xf32f('0x1f')](function(_0x4dcaba){_0xe4bdbd[_0xf32f('0x72')]=_0x4dcaba;_0xe4bdbd[_0xf32f('0x73')]=_[_0xf32f('0x74')](_0x4dcaba['Applications'],['priority'],['asc']);if(_0xe4bdbd[_0xf32f('0x72')][_0xf32f('0x71')]){delete _0xe4bdbd['account']['Applications'];}return db[_0xf32f('0x75')][_0xf32f('0x62')]();})[_0xf32f('0x1f')](function(_0x12c3e4){if(!_0x12c3e4){throw new db[(_0xf32f('0x76'))][(_0xf32f('0x77'))](_0xf32f('0x78'));}_0x3f1698=_[_0xf32f('0x79')](_[_0xf32f('0x46')](_0x12c3e4),['createdAt',_0xf32f('0x7a')]);_0xa0464=_[_0xf32f('0x79')](_[_0xf32f('0x46')](_0x12c3e4),['createdAt','updatedAt',_0xf32f('0x7b'),_0xf32f('0x7c')]);_0xe4bdbd['body']={'mapKey':_0xf32f('0x7d')};if(_0xe4bdbd[_0xf32f('0x72')][_0xf32f('0x42')]){switch(_0xe4bdbd[_0xf32f('0x72')][_0xf32f('0x42')]){case _0xf32f('0x7e'):_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')]=_0x1ee390['body'][_0xf32f('0x80')];_0xe4bdbd[_0xf32f('0x5c')]['body']=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x81')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x82')]=_0x1ee390[_0xf32f('0x5c')]['MessageSid'];break;case _0xf32f('0x83'):_0xe4bdbd['body'][_0xf32f('0x7f')]='+'+_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x84')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390['body'][_0xf32f('0x85')];break;case'connectel':_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')]=_0x1ee390['body'][_0xf32f('0x7f')];_0xe4bdbd[_0xf32f('0x5c')]['body']=_0x1ee390['body'][_0xf32f('0x26')];break;case _0xf32f('0x86'):_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')]=_0x1ee390['body']['from'];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390['body'][_0xf32f('0x5c')];_0xe4bdbd[_0xf32f('0x5c')]['messageId']=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x87')];break;case _0xf32f('0x88'):_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')]=_0x1ee390['body'][_0xf32f('0x80')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x89')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x82')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x8a')];break;case _0xf32f('0x8b'):_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')]='+'+_0x1ee390['body']['results'][0x0][_0xf32f('0x7f')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x8c')][0x0][_0xf32f('0x85')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x82')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x8c')][0x0][_0xf32f('0x82')];break;case _0xf32f('0x8d'):_0xe4bdbd['body'][_0xf32f('0x7f')]=_0x1ee390[_0xf32f('0x5c')]['originatingAddress'];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x8e')]['message'];break;case _0xf32f('0x8f'):_0xe4bdbd[_0xf32f('0x5c')]['from']=_0x1ee390[_0xf32f('0x5c')]['fromNumber'];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x85')];_0xe4bdbd['body']['messageId']=_0x1ee390[_0xf32f('0x5c')]['replyMessageId'];break;case _0xf32f('0x90'):_0xe4bdbd['body'][_0xf32f('0x82')]=_0x1ee390['body'][0x0][_0xf32f('0x26')]['id'];_0xe4bdbd['body'][_0xf32f('0x7f')]=_0x1ee390[_0xf32f('0x5c')][0x0]['message']['from'];_0xe4bdbd['body']['body']=_0x1ee390['body'][0x0]['message'][_0xf32f('0x85')];break;case _0xf32f('0x91'):_0xe4bdbd['body'][_0xf32f('0x7f')]=_0x1ee390[_0xf32f('0x5c')][_0xf32f('0x7f')];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x5c')]=_0x1ee390[_0xf32f('0x5c')]['message'];_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x82')]=_0x1ee390['body'][_0xf32f('0x92')];break;}}if(_0xe4bdbd[_0xf32f('0x5c')]['id']){delete _0xe4bdbd['body']['id'];}if(_[_0xf32f('0x93')](_0xe4bdbd['body'][_0xf32f('0x7f')])){throw new db[(_0xf32f('0x76'))]['ValidationError'](_0xf32f('0x94'));}if(_[_0xf32f('0x93')](_0xe4bdbd[_0xf32f('0x5c')]['body'])||_0xe4bdbd[_0xf32f('0x5c')]['body']===''){throw new db[(_0xf32f('0x76'))][(_0xf32f('0x77'))](_0xf32f('0x95'));}if(_[_0xf32f('0x93')](_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x96')])){throw new db[(_0xf32f('0x76'))]['ValidationError'](_0xf32f('0x97')+_0xa0464);}if(!_[_0xf32f('0x98')](_0xa0464,_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x96')])){throw new db[(_0xf32f('0x76'))][(_0xf32f('0x77'))](_0xf32f('0x99')+_0xa0464);}_0xd018f6[_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x96')]]=_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')];return db['CmList'][_0xf32f('0x5a')]({'where':{'id':_0xe4bdbd[_0xf32f('0x72')][_0xf32f('0x7c')]},'include':[{'model':db[_0xf32f('0x75')],'as':_0xf32f('0x9a'),'where':_0xd018f6,'limit':0x1,'order':[['updatedAt',_0xf32f('0x9b')]]}]});})[_0xf32f('0x1f')](handleEntityNotFound(_0x53eb99,null))[_0xf32f('0x1f')](function(_0x5af4ec){if(_0x5af4ec){_0xe4bdbd[_0xf32f('0x9c')]=_[_0xf32f('0x9d')](_0x5af4ec,[_0xf32f('0x9a')]);if(_0x5af4ec[_0xf32f('0x9a')][_0xf32f('0x4a')]){return _0x5af4ec['Contacts'][0x0];}var _0x15ba74=_[_0xf32f('0x9e')](_0xe4bdbd['body'],{'firstName':_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')],'ListId':_0x5af4ec['id']});_0x15ba74[_0xe4bdbd[_0xf32f('0x5c')]['mapKey']]=_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')];return db['CmContact'][_0xf32f('0x5b')](_0x15ba74,{'fields':_0x3f1698,'raw':!![]});}})[_0xf32f('0x1f')](handleEntityNotFound(_0x53eb99,null))[_0xf32f('0x1f')](function(_0x3627a6){if(_0x3627a6){_0xe4bdbd[_0xf32f('0x9f')]=_0x3627a6;var _0x49f708={'ContactId':_0x3627a6['id'],'phone':_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x7f')],'SmsAccountId':_0x1ee390[_0xf32f('0x59')]['id']};var _0x18705f={'ContactId':_0x3627a6['id'],'SmsAccountId':_0x1ee390[_0xf32f('0x59')]['id'],'closed':![]};return db[_0xf32f('0xa0')]['find']({'where':_0x18705f})['then'](function(_0x166b27){if(_0x166b27){return[_0x166b27,![]];}return db[_0xf32f('0xa0')][_0xf32f('0x5b')](_0x49f708)[_0xf32f('0x1f')](function(_0xeccb61){return[_0xeccb61,!![]];});});}})[_0xf32f('0xa1')](function(_0x407e13,_0x1e0133){_0xe4bdbd[_0xf32f('0xa2')]=_0x407e13['get']({'plain':!![]});_0xe4bdbd[_0xf32f('0xa2')][_0xf32f('0xa3')]=![];if(_0x1e0133){if(_0xe4bdbd[_0xf32f('0x72')]['autoclose']){_0xe4bdbd[_0xf32f('0x73')]['push']({'id':0x0,'priority':_0xe4bdbd[_0xf32f('0x73')][_0xf32f('0x4a')]+0x1,'app':_0xf32f('0xa4'),'appdata':_0xf32f('0xa5'),'interval':_0xf32f('0xa6')});}_0xe4bdbd[_0xf32f('0xa2')][_0xf32f('0xa3')]=!![];}return db[_0xf32f('0xa7')][_0xf32f('0x5b')]({'phone':_0xe4bdbd['body'][_0xf32f('0x7f')],'messageId':_0xe4bdbd[_0xf32f('0x5c')][_0xf32f('0x82')],'body':_0xe4bdbd['body'][_0xf32f('0x5c')],'SmsAccountId':_0x1ee390[_0xf32f('0x59')]['id'],'SmsInteractionId':_0x407e13['id'],'direction':'in','ContactId':_0x407e13[_0xf32f('0xa8')],'AttachmentId':_0xe4bdbd[_0xf32f('0x5c')]['AttachmentId']});})[_0xf32f('0x1f')](function(_0x56296c){_0xe4bdbd[_0xf32f('0x26')]=_0x56296c;if(_0xe4bdbd[_0xf32f('0xa2')]['UserId']){return db['User'][_0xf32f('0x5a')]({'attributes':['id',_0xf32f('0x39')],'where':{'id':_0xe4bdbd[_0xf32f('0xa2')][_0xf32f('0xa9')]}})[_0xf32f('0x1f')](function(_0x261317){if(_0x261317){_0xe4bdbd[_0xf32f('0x73')][_0xf32f('0xaa')]({'id':0x0,'priority':0x0,'app':_0xf32f('0xab'),'appdata':_0x261317['name']+','+(_0xe4bdbd[_0xf32f('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0xf32f('0xa6')});}return respondWithRpcPromise(_0xf32f('0xac'),'startRouting',_0xe4bdbd);});}return respondWithRpcPromise('Start',_0xf32f('0xad'),_0xe4bdbd);})[_0xf32f('0x1f')](function(_0x4a971a){if(_0x4a971a){var _0x557d51=0xc8;var _0x50c988=_0xf32f('0xae');logger['info'](_0xf32f('0x23'),_0x50c988,_0x557d51,_0xf32f('0xaf'));logger['debug'](_0xf32f('0xb0'),_0x50c988,_0x557d51,_0xf32f('0xaf'),JSON[_0xf32f('0xb1')](_0x4a971a));if(_0xe4bdbd[_0xf32f('0x72')]['type']===_0xf32f('0x7e')){return _0x53eb99['status'](_0x557d51)[_0xf32f('0x2c')](_0xf32f('0xb2'),'text/xml')[_0xf32f('0x3a')](_0xf32f('0xb3'));}else{return _0x53eb99[_0xf32f('0x28')](_0x557d51)[_0xf32f('0x2e')](_0x4a971a);}}})[_0xf32f('0x57')](handleError(_0x53eb99,null));};exports['addApplications']=function(_0x14348d,_0x3b96e1,_0x884958){return db[_0xf32f('0x3f')][_0xf32f('0x66')]({'where':{'id':_0x14348d[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x3b96e1,null))['then'](function(_0xf2f40e){if(_0xf2f40e){return db[_0xf32f('0xb4')][_0xf32f('0xb5')](function(_0x21bebc){return db[_0xf32f('0x70')][_0xf32f('0x32')]({'where':{'SmsAccountId':_0x14348d['params']['id']},'transaction':_0x21bebc})['then'](function(_0x2f3f77){var _0x2d9e9f=_[_0xf32f('0x3e')](_0x14348d['body'],function(_0x307143){_0x307143['SmsAccountId']=_0x14348d['params']['id'];return _0x307143;});return db[_0xf32f('0x70')][_0xf32f('0xb6')](_0x2d9e9f,{'transaction':_0x21bebc});});})[_0xf32f('0x1f')](function(){return db[_0xf32f('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x14348d[_0xf32f('0x59')]['id']},'order':_0xf32f('0xb7')});});}})[_0xf32f('0x1f')](respondWithResult(_0x3b96e1,null))[_0xf32f('0x57')](handleError(_0x3b96e1,null));};exports[_0xf32f('0xb8')]=function(_0x56e650,_0x43ba79,_0x5ba3e5){var _0x581bf9={};var _0x209181={};var _0x16b976;var _0x3852bb;return db[_0xf32f('0x3f')][_0xf32f('0x66')]({'where':{'id':_0x56e650[_0xf32f('0x59')]['id']}})['then'](handleEntityNotFound(_0x43ba79,null))[_0xf32f('0x1f')](function(_0x4300b6){if(_0x4300b6){_0x16b976=_0x4300b6;_0x209181[_0xf32f('0x44')]=_[_0xf32f('0x46')](db[_0xf32f('0x70')][_0xf32f('0x40')]);_0x209181['query']=_[_0xf32f('0x46')](_0x56e650[_0xf32f('0x45')]);_0x209181[_0xf32f('0x4e')]=_['intersection'](_0x209181['model'],_0x209181[_0xf32f('0x45')]);_0x581bf9[_0xf32f('0x47')]=_[_0xf32f('0x48')](_0x209181[_0xf32f('0x44')],qs[_0xf32f('0x49')](_0x56e650[_0xf32f('0x45')][_0xf32f('0x49')]));_0x581bf9[_0xf32f('0x47')]=_0x581bf9[_0xf32f('0x47')][_0xf32f('0x4a')]?_0x581bf9['attributes']:_0x209181[_0xf32f('0x44')];_0x581bf9[_0xf32f('0x4b')]=qs['sort'](_0x56e650[_0xf32f('0x45')]['sort']);_0x581bf9[_0xf32f('0x4d')]=qs[_0xf32f('0x4e')](_['pick'](_0x56e650[_0xf32f('0x45')],_0x209181[_0xf32f('0x4e')]));if(_0x56e650[_0xf32f('0x45')][_0xf32f('0x51')]){_0x581bf9[_0xf32f('0x4d')]=_[_0xf32f('0x4f')](_0x581bf9[_0xf32f('0x4d')],{'$or':_[_0xf32f('0x3e')](_0x581bf9[_0xf32f('0x47')],function(_0x5e5d02){var _0x31e1cc={};_0x31e1cc[_0x5e5d02]={'$like':'%'+_0x56e650[_0xf32f('0x45')]['filter']+'%'};return _0x31e1cc;})});}_0x581bf9=_[_0xf32f('0x4f')]({},_0x581bf9,_0x56e650['options']);return _0x16b976[_0xf32f('0xb8')](_0x581bf9);}})[_0xf32f('0x1f')](function(_0xd2d513){if(_0xd2d513){_0x3852bb=_0xd2d513[_0xf32f('0x4a')];if(!_0x56e650['query'][_0xf32f('0x67')](_0xf32f('0x68'))){_0x581bf9[_0xf32f('0x2b')]=qs[_0xf32f('0x2b')](_0x56e650[_0xf32f('0x45')][_0xf32f('0x2b')]);_0x581bf9['offset']=qs[_0xf32f('0x2a')](_0x56e650[_0xf32f('0x45')][_0xf32f('0x2a')]);}return _0x16b976[_0xf32f('0xb8')](_0x581bf9);}})[_0xf32f('0x1f')](function(_0x3585b0){if(_0x3585b0){return _0x3585b0?{'count':_0x3852bb,'rows':_0x3585b0}:null;}})['then'](respondWithResult(_0x43ba79,null))['catch'](handleError(_0x43ba79,null));};exports['getInteractions']=function(_0x13319e,_0x1fee32,_0x23a608){var _0x41093c={'raw':![],'where':{}};var _0x166f99={};var _0x5d5e2a={'count':0x0,'rows':[]};return db[_0xf32f('0x3f')][_0xf32f('0x66')]({'where':{'id':_0x13319e[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x1fee32,null))['then'](function(_0x1f9420){if(_0x1f9420){_0x166f99[_0xf32f('0x44')]=_['keys'](db[_0xf32f('0xa0')][_0xf32f('0x40')]);_0x166f99[_0xf32f('0x45')]=_[_0xf32f('0x46')](_0x13319e[_0xf32f('0x45')]);_0x166f99[_0xf32f('0x4e')]=_[_0xf32f('0x48')](_0x166f99[_0xf32f('0x44')],_0x166f99['query']);_0x41093c[_0xf32f('0x47')]=_[_0xf32f('0x48')](_0x166f99[_0xf32f('0x44')],qs[_0xf32f('0x49')](_0x13319e['query'][_0xf32f('0x49')]));_0x41093c[_0xf32f('0x47')]=_0x41093c['attributes'][_0xf32f('0x4a')]?_0x41093c['attributes']:_0x166f99[_0xf32f('0x44')];if(!_0x13319e[_0xf32f('0x45')][_0xf32f('0x67')](_0xf32f('0x68'))){_0x41093c[_0xf32f('0x2b')]=qs['limit'](_0x13319e[_0xf32f('0x45')][_0xf32f('0x2b')]);_0x41093c[_0xf32f('0x2a')]=qs[_0xf32f('0x2a')](_0x13319e[_0xf32f('0x45')][_0xf32f('0x2a')]);}_0x41093c[_0xf32f('0x4b')]=qs[_0xf32f('0x4c')](_0x13319e[_0xf32f('0x45')]['sort']);_0x41093c[_0xf32f('0x4d')]=qs[_0xf32f('0x4e')](_[_0xf32f('0xb9')](_0x13319e[_0xf32f('0x45')],_0x166f99[_0xf32f('0x4e')]));_0x41093c[_0xf32f('0x4d')][_0xf32f('0x69')]=_0x1f9420['id'];if(_0x13319e[_0xf32f('0x45')][_0xf32f('0x51')]){_0x41093c[_0xf32f('0x4d')]=_[_0xf32f('0x4f')](_0x41093c['where'],{'$or':_[_0xf32f('0x3e')](_0x41093c[_0xf32f('0x47')],function(_0x4cecc5){var _0x3474d1={};_0x3474d1[_0x4cecc5]={'$like':'%'+_0x13319e[_0xf32f('0x45')][_0xf32f('0x51')]+'%'};return _0x3474d1;})});}_0x41093c=_[_0xf32f('0x4f')]({},_0x41093c,_0x13319e[_0xf32f('0x52')]);return db['SmsInteraction'][_0xf32f('0x29')]({'where':_0x41093c[_0xf32f('0x4d')]})[_0xf32f('0x1f')](function(_0x9aea76){_0x5d5e2a[_0xf32f('0x29')]=_0x9aea76;if(_0x13319e[_0xf32f('0x45')][_0xf32f('0x53')]){_0x41093c[_0xf32f('0x54')]=[{'model':db[_0xf32f('0x75')],'as':'Contact','required':![]},{'model':db[_0xf32f('0xba')],'as':'Owner','attributes':[_0xf32f('0x39'),_0xf32f('0xbb'),'internal'],'required':![]},{'model':db[_0xf32f('0xbc')],'as':_0xf32f('0xbd'),'attributes':['id',_0xf32f('0x39'),_0xf32f('0xbe')],'where':_0x13319e[_0xf32f('0x45')][_0xf32f('0xbf')]?{'id':_0x13319e[_0xf32f('0x45')]['tag']}:undefined,'required':_0x13319e[_0xf32f('0x45')][_0xf32f('0xbf')]?!![]:![]}];}return db[_0xf32f('0xa0')][_0xf32f('0x55')](_0x41093c);})[_0xf32f('0x1f')](function(_0x489c81){_0x5d5e2a[_0xf32f('0x56')]=_0x489c81;return _0x5d5e2a;});}})['then'](respondWithFilteredResult(_0x1fee32,_0x41093c))['catch'](handleError(_0x1fee32,null));};exports[_0xf32f('0x3a')]=function(_0x4d472e,_0x1d5e54,_0x2e6770){var _0x283f5e,_0x3ca440,_0x149cb9;if(_[_0xf32f('0x93')](_0x4d472e['body']['body'])||_0x4d472e[_0xf32f('0x5c')]['body']===''){throw new db[(_0xf32f('0x76'))][(_0xf32f('0x77'))](_0xf32f('0x95'));}if(_[_0xf32f('0x93')](_0x4d472e[_0xf32f('0x5c')]['to'])){throw new db['Sequelize'][(_0xf32f('0x77'))](_0xf32f('0xc0'));}_0x283f5e=_0x4d472e[_0xf32f('0x5c')]['to'];return db['SmsAccount'][_0xf32f('0x5a')]({'where':{'id':_0x4d472e[_0xf32f('0x59')]['id']},'include':[{'model':db[_0xf32f('0xc1')],'as':_0xf32f('0xc2'),'include':[{'model':db[_0xf32f('0x75')],'as':'Contacts','where':{'mobile':_0x283f5e},'limit':0x1,'order':[[_0xf32f('0x7a'),_0xf32f('0x9b')]]}]}]})[_0xf32f('0x1f')](handleEntityNotFound(_0x1d5e54,null))[_0xf32f('0x1f')](function(_0x343640){if(_0x343640&&_0x343640[_0xf32f('0xc2')]){_0x3ca440=_0x343640[_0xf32f('0x33')]({'plain':!![]});if(_0x3ca440[_0xf32f('0xc2')]&&_0x3ca440['List']['Contacts']['length']){return _0x3ca440[_0xf32f('0xc2')][_0xf32f('0x9a')][0x0];}return db[_0xf32f('0x75')]['create'](_['defaults'](_0x4d472e['body'],{'firstName':_0x283f5e,'mobile':_0x283f5e,'phone':_0x283f5e,'ListId':_0x3ca440[_0xf32f('0x7c')]}));}})['then'](handleEntityNotFound(_0x1d5e54,null))['then'](function(_0x1b52ee){if(_0x1b52ee){_0x149cb9=_0x1b52ee;return db[_0xf32f('0xa0')][_0xf32f('0x5a')]({'where':{'ContactId':_0x149cb9['id'],'closed':![],'SmsAccountId':_0x3ca440['id']}})[_0xf32f('0x1f')](function(_0x453d69){if(_0x453d69){return[_0x453d69,![]];}return db[_0xf32f('0xa0')][_0xf32f('0x5b')]({'UserId':_0x4d472e[_0xf32f('0x5d')]['id'],'ContactId':_0x149cb9['id'],'SmsAccountId':_0x3ca440['id'],'phone':_0x283f5e,'firstMsgDirection':_0xf32f('0xc3'),'Messages':[_[_0xf32f('0x4f')](_0x4d472e['body'],{'read':![],'body':_0x4d472e['body'][_0xf32f('0x5c')],'phone':_0x283f5e,'SmsAccountId':_0x3ca440['id'],'UserId':_0x4d472e['user']['id'],'ContactId':_0x149cb9['id']})]},{'include':[{'model':db[_0xf32f('0xa7')],'as':'Messages'}]})['then'](function(_0x1baeee){return[_0x1baeee,!![]];});});}})[_0xf32f('0xa1')](function(_0x5b0761,_0x27701f){if(_0x27701f){return _0x5b0761;}return db[_0xf32f('0xa7')][_0xf32f('0x5b')](_[_0xf32f('0x4f')](_0x4d472e[_0xf32f('0x5c')],{'read':![],'body':_0x4d472e[_0xf32f('0x5c')][_0xf32f('0x5c')],'phone':_0x283f5e,'SmsAccountId':_0x3ca440['id'],'SmsInteractionId':_0x5b0761['id'],'UserId':_0x4d472e[_0xf32f('0x5d')]['id'],'ContactId':_0x149cb9['id']}))[_0xf32f('0x1f')](function(_0x29f83f){_0x5b0761[_0xf32f('0xc4')][_0xf32f('0xc5')]=[];_0x5b0761['dataValues'][_0xf32f('0xc5')]['push'](_0x29f83f[_0xf32f('0xc4')]);return _0x5b0761;});})['then'](respondWithResult(_0x1d5e54,null))[_0xf32f('0x57')](handleError(_0x1d5e54,null));};exports[_0xf32f('0x28')]=function(_0x5d56b9,_0x51f05,_0x120fec){if(_0x5d56b9['body']['id']){delete _0x5d56b9[_0xf32f('0x5c')]['id'];}var _0x592f70,_0x10f02c,_0x549520;return db[_0xf32f('0x3f')]['find']({'where':{'id':_0x5d56b9[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x51f05,null))[_0xf32f('0x1f')](function(_0x4c183b){if(_0x4c183b){_0x549520=_0x4c183b;logger[_0xf32f('0xc6')](_0xf32f('0x23'),_0xf32f('0x28'),_0xf32f('0xc7'),_0x4c183b['type'],util[_0xf32f('0xc8')](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));switch(_0x4c183b[_0xf32f('0x42')]){case _0xf32f('0x83'):if(_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xc9')]&&_0x5d56b9[_0xf32f('0x5c')]['status']){_0x10f02c=_0x5d56b9['body'][_0xf32f('0x28')];return db[_0xf32f('0xa7')]['find']({'where':{'messageId':_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xc9')]}});}break;case _0xf32f('0xca'):if(_0x5d56b9['body'][_0xf32f('0xcb')]&&_0x5d56b9['body'][_0xf32f('0xcc')]){_0x10f02c=_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xcc')];return db[_0xf32f('0xa7')][_0xf32f('0x5a')]({'where':{'messageId':_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xcb')]}});}break;case _0xf32f('0x86'):if(_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0x87')]&&_0x5d56b9['body'][_0xf32f('0xcd')]){_0x10f02c=_0x5d56b9[_0xf32f('0x5c')]['status_code'];return db[_0xf32f('0xa7')][_0xf32f('0x5a')]({'where':{'messageId':_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0x87')]}});}break;case'infobip':var _0x482c58=_0x5d56b9['body'][_0xf32f('0x8c')][0x0];if(_0x482c58[_0xf32f('0x82')]&&_0x482c58[_0xf32f('0x28')][_0xf32f('0xce')]==='DELIVERED'){_0x10f02c=_0x482c58[_0xf32f('0x28')][_0xf32f('0xce')];return db['SmsMessage'][_0xf32f('0x5a')]({'where':{'messageId':_0x482c58[_0xf32f('0x82')]}});}break;case _0xf32f('0x8f'):if(_0x5d56b9['body'][_0xf32f('0x82')]&&_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0x28')]){_0x10f02c=_0x5d56b9[_0xf32f('0x5c')]['status'];return db[_0xf32f('0xa7')][_0xf32f('0x5a')]({'where':{'messageId':_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0x82')]}});}break;case _0xf32f('0x90'):if(_0x5d56b9['body'][0x0]['message']['id']){_0x10f02c=_0x5d56b9[_0xf32f('0x5c')][0x0]['type'];return db['SmsMessage'][_0xf32f('0x5a')]({'where':{'messageId':_0x5d56b9['body'][0x0][_0xf32f('0x26')]['id']}});}break;case'intelepeer':if(_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xcf')]&&_0x5d56b9['body'][_0xf32f('0x28')]){_0x10f02c=_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0x28')];return db[_0xf32f('0xa7')][_0xf32f('0x5a')]({'where':{'messageId':_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xcf')]}});}break;}}})['then'](handleEntityNotFound(_0x51f05,null))[_0xf32f('0x1f')](function(_0x292a3b){if(_0x292a3b){_0x592f70=_0x292a3b;switch(_0x549520[_0xf32f('0x42')]){case _0xf32f('0x83'):if(_0x10f02c===_0xf32f('0xd0')){return _0x592f70['update']({'read':!![]});}else{logger[_0xf32f('0x24')](_0xf32f('0x23'),_0xf32f('0x28'),'skebby',util[_0xf32f('0xc8')](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x10f02c==='1'){return _0x592f70[_0xf32f('0x61')]({'read':!![]});}else{logger[_0xf32f('0x24')](_0xf32f('0x23'),'status',_0xf32f('0x83'),util[_0xf32f('0xc8')](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5d56b9[_0xf32f('0x5c')][_0xf32f('0xd1')]&&_0x10f02c>=0xc8&&_0x10f02c<=0xce){return _0x592f70[_0xf32f('0x61')]({'read':!![]});}else{logger[_0xf32f('0x24')](_0xf32f('0x23'),_0xf32f('0x28'),_0xf32f('0x86'),util[_0xf32f('0xc8')](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf32f('0x8b'):var _0x28c4ff=_0x5d56b9['body'][_0xf32f('0x8c')][0x0];if(_0x28c4ff['status']['groupName']===_0xf32f('0xd0')){return _0x592f70['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf32f('0x28'),_0xf32f('0x8b'),util['inspect'](_0x5d56b9['body'],{'showHidden':![],'depth':null}));}break;case _0xf32f('0x8f'):if(_0x10f02c==_0xf32f('0xd2')||_0x10f02c==_0xf32f('0xd3')){return _0x592f70[_0xf32f('0x61')]({'read':!![]});}else{logger[_0xf32f('0x24')](_0xf32f('0x23'),'status',_0xf32f('0x8f'),util['inspect'](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x10f02c==_0xf32f('0xd4')){return _0x592f70[_0xf32f('0x61')]({'read':!![]});}else{logger[_0xf32f('0x24')](_0xf32f('0x23'),'status',_0xf32f('0x90'),util[_0xf32f('0xc8')](_0x5d56b9['body'],{'showHidden':![],'depth':null}));}break;case _0xf32f('0x91'):if(_0x10f02c===_0xf32f('0xd5')||_0x10f02c==='ACCEPTD'){return _0x592f70['update']({'read':!![]});}else{logger[_0xf32f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf32f('0x28'),_0xf32f('0x91'),util[_0xf32f('0xc8')](_0x5d56b9[_0xf32f('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x592f70;}})[_0xf32f('0x1f')](respondWithResult(_0x51f05,null))[_0xf32f('0x57')](handleError(_0x51f05,null));};exports[_0xf32f('0xd6')]=function(_0x4f65d0,_0x3a8cc3,_0x2bd00a){var _0x2e0d4b,_0x3a317b,_0x11aa8c;return db['SmsAccount'][_0xf32f('0x5a')]({'where':{'id':_0x4f65d0[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x3a8cc3,null))[_0xf32f('0x1f')](function(_0x49d8b4){if(_0x49d8b4){_0x11aa8c=_0x49d8b4;logger[_0xf32f('0xc6')](_0xf32f('0x23'),_0xf32f('0x28'),_0xf32f('0xc7'),_0x49d8b4[_0xf32f('0x42')],util[_0xf32f('0xc8')](_0x4f65d0['query'],{'showHidden':![],'depth':null}));switch(_0x49d8b4[_0xf32f('0x42')]){case _0xf32f('0x8d'):if(_0x4f65d0[_0xf32f('0x45')][_0xf32f('0xd7')]&&_0x4f65d0[_0xf32f('0x45')][_0xf32f('0xd8')]){_0x3a317b=_0x4f65d0['query'][_0xf32f('0xd8')];return db[_0xf32f('0xa7')][_0xf32f('0x5a')]({'where':{'messageId':_0x4f65d0[_0xf32f('0x45')][_0xf32f('0xd7')]}});}break;}}})[_0xf32f('0x1f')](handleEntityNotFound(_0x3a8cc3,null))[_0xf32f('0x1f')](function(_0x665cb9){if(_0x665cb9){_0x2e0d4b=_0x665cb9;switch(_0x11aa8c[_0xf32f('0x42')]){case _0xf32f('0x8d'):if(_0x3a317b==='2'||_0x3a317b==='6'){return _0x2e0d4b[_0xf32f('0x61')]({'read':!![]});}else{logger['error'](_0xf32f('0x23'),_0xf32f('0x28'),_0xf32f('0x8d'),util[_0xf32f('0xc8')](_0x4f65d0[_0xf32f('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x2e0d4b;}})['then'](respondWithResult(_0x3a8cc3,null))[_0xf32f('0x57')](handleError(_0x3a8cc3,null));};exports['addAgents']=function(_0x508422,_0x35db8e,_0x40001f){return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x508422[_0xf32f('0x59')]['id']}})['then'](handleEntityNotFound(_0x35db8e,null))['then'](function(_0x273117){if(_0x273117){return _0x273117['addAgents'](_0x508422['body']['ids'],_[_0xf32f('0x9d')](_0x508422[_0xf32f('0x5c')],[_0xf32f('0x6b'),'id'])||{})[_0xf32f('0xa1')](function(_0x19d06a){for(var _0x49a74f=0x0;_0x49a74f<_0x508422[_0xf32f('0x5c')][_0xf32f('0x6b')][_0xf32f('0x4a')];_0x49a74f+=0x1){socket[_0xf32f('0xd9')](_0xf32f('0xda'),{'UserId':_0x508422[_0xf32f('0x5c')][_0xf32f('0x6b')][_0x49a74f],'SmsAccountId':_0x508422['params']['id']});}return _0x19d06a;});}})[_0xf32f('0x1f')](respondWithResult(_0x35db8e,null))[_0xf32f('0x57')](handleError(_0x35db8e,null));};exports[_0xf32f('0xdb')]=function(_0x696102,_0x5a6854,_0x39fef3){return db[_0xf32f('0x3f')][_0xf32f('0x5a')]({'where':{'id':_0x696102['params']['id']}})['then'](handleEntityNotFound(_0x5a6854,null))[_0xf32f('0x1f')](function(_0x47b9e4){if(_0x47b9e4){return _0x47b9e4[_0xf32f('0xdb')](_0x696102[_0xf32f('0x45')][_0xf32f('0x6b')])['then'](function(){if(_['isArray'](_0x696102[_0xf32f('0x45')][_0xf32f('0x6b')])){for(var _0x42f57c=0x0;_0x42f57c<_0x696102['query'][_0xf32f('0x6b')][_0xf32f('0x4a')];_0x42f57c+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x696102[_0xf32f('0x45')]['ids'][_0x42f57c]),'SmsAccountId':Number(_0x696102[_0xf32f('0x59')]['id'])});}}else{socket['emit'](_0xf32f('0xdc'),{'UserId':Number(_0x696102[_0xf32f('0x45')][_0xf32f('0x6b')]),'SmsAccountId':Number(_0x696102[_0xf32f('0x59')]['id'])});}});}})[_0xf32f('0x1f')](respondWithStatusCode(_0x5a6854,null))[_0xf32f('0x57')](handleError(_0x5a6854,null));};exports['getAgents']=function(_0x42327c,_0x2a69fa,_0x16aa50){var _0x2d1dda={};var _0x72809f={};var _0x3dfdbe;var _0xdae447;return db[_0xf32f('0x3f')][_0xf32f('0x66')]({'where':{'id':_0x42327c[_0xf32f('0x59')]['id']}})[_0xf32f('0x1f')](handleEntityNotFound(_0x2a69fa,null))[_0xf32f('0x1f')](function(_0x85aea5){if(_0x85aea5){_0x3dfdbe=_0x85aea5;_0x72809f[_0xf32f('0x44')]=_[_0xf32f('0x46')](db['User']['rawAttributes']);_0x72809f[_0xf32f('0x45')]=_[_0xf32f('0x46')](_0x42327c[_0xf32f('0x45')]);_0x72809f[_0xf32f('0x4e')]=_[_0xf32f('0x48')](_0x72809f[_0xf32f('0x44')],_0x72809f[_0xf32f('0x45')]);_0x2d1dda[_0xf32f('0x47')]=_[_0xf32f('0x48')](_0x72809f[_0xf32f('0x44')],qs[_0xf32f('0x49')](_0x42327c[_0xf32f('0x45')][_0xf32f('0x49')]));_0x2d1dda[_0xf32f('0x47')]=_0x2d1dda[_0xf32f('0x47')][_0xf32f('0x4a')]?_0x2d1dda[_0xf32f('0x47')]:_0x72809f[_0xf32f('0x44')];_0x2d1dda['order']=qs[_0xf32f('0x4c')](_0x42327c[_0xf32f('0x45')][_0xf32f('0x4c')]);_0x2d1dda['where']=qs[_0xf32f('0x4e')](_[_0xf32f('0xb9')](_0x42327c['query'],_0x72809f[_0xf32f('0x4e')]));if(_0x42327c[_0xf32f('0x45')]['filter']){_0x2d1dda[_0xf32f('0x4d')]=_[_0xf32f('0x4f')](_0x2d1dda[_0xf32f('0x4d')],{'$or':_[_0xf32f('0x3e')](_0x2d1dda[_0xf32f('0x47')],function(_0x16491d){var _0x5491bf={};_0x5491bf[_0x16491d]={'$like':'%'+_0x42327c['query']['filter']+'%'};return _0x5491bf;})});}_0x2d1dda=_[_0xf32f('0x4f')]({},_0x2d1dda,_0x42327c['options']);return _0x3dfdbe[_0xf32f('0xdd')](_0x2d1dda);}})['then'](function(_0x1da461){if(_0x1da461){_0xdae447=_0x1da461[_0xf32f('0x4a')];if(!_0x42327c[_0xf32f('0x45')][_0xf32f('0x67')](_0xf32f('0x68'))){_0x2d1dda['limit']=qs[_0xf32f('0x2b')](_0x42327c['query'][_0xf32f('0x2b')]);_0x2d1dda[_0xf32f('0x2a')]=qs[_0xf32f('0x2a')](_0x42327c['query'][_0xf32f('0x2a')]);}return _0x3dfdbe[_0xf32f('0xdd')](_0x2d1dda);}})[_0xf32f('0x1f')](function(_0x37e92d){if(_0x37e92d){return _0x37e92d?{'count':_0xdae447,'rows':_0x37e92d}:null;}})['then'](respondWithResult(_0x2a69fa,null))[_0xf32f('0x57')](handleError(_0x2a69fa,null));}; \ No newline at end of file +var _0x75d4=['SmsAccount,\x20%s,\x20%s','message','catch','end','status','json','count','set','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','name','options','includeAll','rows','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','account','applications','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','Body','MessageSid','skebby','sender','text','messageId','plivo','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','omit','Contacts','SmsInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','transaction','SmsApplication','priority','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','DESC','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','csc','message-id','state','emit','removeAgents','userSmsAccount:remove','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','redis','defaults','socket.io-emitter','jayson/promise','client','http','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2ac87c,_0x1b07b4){var _0x41a0b5=function(_0x390729){while(--_0x390729){_0x2ac87c['push'](_0x2ac87c['shift']());}};_0x41a0b5(++_0x1b07b4);}(_0x75d4,0x191));var _0x475d=function(_0x56af59,_0x462240){_0x56af59=_0x56af59-0x0;var _0x22c7da=_0x75d4[_0x56af59];return _0x22c7da;};'use strict';var pdf=require(_0x475d('0x0'));var emlformat=require(_0x475d('0x1'));var rimraf=require(_0x475d('0x2'));var zipdir=require(_0x475d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x475d('0x4'));var BPromise=require(_0x475d('0x5'));var Mustache=require(_0x475d('0x6'));var util=require(_0x475d('0x7'));var path=require('path');var sox=require(_0x475d('0x8'));var csv=require(_0x475d('0x9'));var ejs=require(_0x475d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x475d('0xb'));var crypto=require('crypto');var jsforce=require(_0x475d('0xc'));var deskjs=require(_0x475d('0xd'));var toCsv=require(_0x475d('0x9'));var querystring=require(_0x475d('0xe'));var Papa=require(_0x475d('0xf'));var Redis=require(_0x475d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x475d('0x11'));var as=require(_0x475d('0x12'));var hardwareService=require(_0x475d('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x475d('0x14'));var db=require('../../mysqldb')['db'];config[_0x475d('0x15')]=_[_0x475d('0x16')](config[_0x475d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x475d('0x17'))(new Redis(config[_0x475d('0x15')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x475d('0x18'));var client=jayson[_0x475d('0x19')][_0x475d('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x526961,_0x22aedb,_0x3e9a1d,_0x12c79c){return new BPromise(function(_0x2bfecd,_0x2c8f41){var _0x477c14=_0x12c79c||client;return _0x477c14['request'](_0x526961,_0x3e9a1d)['then'](function(_0x3f5c2f){logger[_0x475d('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x22aedb,'request\x20sent');logger[_0x475d('0x1c')](_0x475d('0x1d'),_0x22aedb,_0x475d('0x1e'),JSON[_0x475d('0x1f')](_0x3f5c2f));if(_0x3f5c2f[_0x475d('0x20')]){if(_0x3f5c2f[_0x475d('0x20')]['code']===0x1f4){logger['error'](_0x475d('0x21'),_0x22aedb,_0x3f5c2f[_0x475d('0x20')][_0x475d('0x22')]);return _0x2c8f41(_0x3f5c2f[_0x475d('0x20')][_0x475d('0x22')]);}logger[_0x475d('0x20')](_0x475d('0x21'),_0x22aedb,_0x3f5c2f[_0x475d('0x20')][_0x475d('0x22')]);return _0x2bfecd(_0x3f5c2f[_0x475d('0x20')][_0x475d('0x22')]);}else{logger[_0x475d('0x1b')](_0x475d('0x21'),_0x22aedb,_0x475d('0x1e'));_0x2bfecd(_0x3f5c2f['result'][_0x475d('0x22')]);}})[_0x475d('0x23')](function(_0x2fbc78){logger[_0x475d('0x20')](_0x475d('0x21'),_0x22aedb,_0x2fbc78);_0x2c8f41(_0x2fbc78);});});}function respondWithStatusCode(_0x3cd153,_0x14496e){_0x14496e=_0x14496e||0xcc;return function(_0x4651a2){if(_0x4651a2){return _0x3cd153['sendStatus'](_0x14496e);}return _0x3cd153['status'](_0x14496e)[_0x475d('0x24')]();};}function respondWithResult(_0x1631ab,_0x5198b0){_0x5198b0=_0x5198b0||0xc8;return function(_0x303fef){if(_0x303fef){return _0x1631ab[_0x475d('0x25')](_0x5198b0)[_0x475d('0x26')](_0x303fef);}};}function respondWithFilteredResult(_0x4b919c,_0x114c29){return function(_0x373c04){if(_0x373c04){var _0x443c9b=_0x373c04[_0x475d('0x27')],_0x385134=_0x114c29['offset'],_0x310f2f=_0x114c29['offset']+_0x114c29['limit'],_0x159565;if(_0x310f2f>=_0x443c9b){_0x310f2f=_0x443c9b;_0x159565=0xc8;}else{_0x159565=0xce;}_0x4b919c['status'](_0x159565);return _0x4b919c[_0x475d('0x28')]('Content-Range',_0x385134+'-'+_0x310f2f+'/'+_0x443c9b)[_0x475d('0x26')](_0x373c04);}return null;};}function patchUpdates(_0x5bc067){return function(_0x3c5774){try{jsonpatch[_0x475d('0x29')](_0x3c5774,_0x5bc067,!![]);}catch(_0x5f2c94){return BPromise[_0x475d('0x2a')](_0x5f2c94);}return _0x3c5774['save']();};}function saveUpdates(_0x463618,_0x94913b){return function(_0x3e8b35){if(_0x3e8b35){return _0x3e8b35[_0x475d('0x2b')](_0x463618)[_0x475d('0x2c')](function(_0x5d31d1){return _0x5d31d1;});}return null;};}function removeEntity(_0x35c8fb,_0x295491){return function(_0x2ba1de){if(_0x2ba1de){return _0x2ba1de[_0x475d('0x2d')]()[_0x475d('0x2c')](function(){var _0x2baa8a=_0x2ba1de[_0x475d('0x2e')]({'plain':!![]});var _0x556aac=_0x475d('0x2f');return db[_0x475d('0x30')][_0x475d('0x2d')]({'where':{'type':_0x556aac,'resourceId':_0x2baa8a['id']}})[_0x475d('0x2c')](function(){return _0x2ba1de;});})[_0x475d('0x2c')](function(){_0x35c8fb[_0x475d('0x25')](0xcc)[_0x475d('0x24')]();});}};}function handleEntityNotFound(_0xa78e61,_0x45048d){return function(_0x387df2){if(!_0x387df2){_0xa78e61[_0x475d('0x31')](0x194);}return _0x387df2;};}function handleError(_0x247446,_0x17e6cb){_0x17e6cb=_0x17e6cb||0x1f4;return function(_0x14faa9){logger[_0x475d('0x20')](_0x14faa9[_0x475d('0x32')]);if(_0x14faa9['name']){delete _0x14faa9['name'];}_0x247446[_0x475d('0x25')](_0x17e6cb)['send'](_0x14faa9);};}exports[_0x475d('0x33')]=function(_0x1f521a,_0x3157a9){var _0x5eacec={'include':[{'model':db[_0x475d('0x34')],'as':_0x475d('0x35')}]},_0x185e01={},_0x4c2552={'count':0x0,'rows':[]};var _0x5bdbe2=_[_0x475d('0x36')](db[_0x475d('0x37')][_0x475d('0x38')],function(_0x2e7690){return{'name':_0x2e7690[_0x475d('0x39')],'type':_0x2e7690[_0x475d('0x3a')][_0x475d('0x3b')]};});_0x185e01[_0x475d('0x3c')]=_[_0x475d('0x36')](_0x5bdbe2,'name');_0x185e01['query']=_[_0x475d('0x3d')](_0x1f521a[_0x475d('0x3e')]);_0x185e01['filters']=_['intersection'](_0x185e01['model'],_0x185e01['query']);_0x5eacec[_0x475d('0x3f')]=_[_0x475d('0x40')](_0x185e01[_0x475d('0x3c')],qs[_0x475d('0x41')](_0x1f521a['query'][_0x475d('0x41')]));_0x5eacec[_0x475d('0x3f')]=_0x5eacec[_0x475d('0x3f')]['length']?_0x5eacec[_0x475d('0x3f')]:_0x185e01[_0x475d('0x3c')];if(!_0x1f521a[_0x475d('0x3e')][_0x475d('0x42')](_0x475d('0x43'))){_0x5eacec[_0x475d('0x44')]=qs['limit'](_0x1f521a[_0x475d('0x3e')][_0x475d('0x44')]);_0x5eacec['offset']=qs['offset'](_0x1f521a[_0x475d('0x3e')][_0x475d('0x45')]);}_0x5eacec[_0x475d('0x46')]=qs['sort'](_0x1f521a[_0x475d('0x3e')][_0x475d('0x47')]);_0x5eacec[_0x475d('0x48')]=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0x1f521a[_0x475d('0x3e')],_0x185e01[_0x475d('0x49')]),_0x5bdbe2);if(_0x1f521a[_0x475d('0x3e')][_0x475d('0x4b')]){_0x5eacec[_0x475d('0x48')]=_[_0x475d('0x4c')](_0x5eacec[_0x475d('0x48')],{'$or':_['map'](_0x5bdbe2,function(_0x399fe1){if(_0x399fe1[_0x475d('0x3a')]!=='VIRTUAL'){var _0x54e763={};_0x54e763[_0x399fe1[_0x475d('0x4d')]]={'$like':'%'+_0x1f521a['query'][_0x475d('0x4b')]+'%'};return _0x54e763;}})});}_0x5eacec=_[_0x475d('0x4c')]({},_0x5eacec,_0x1f521a[_0x475d('0x4e')]);var _0x5e270d={'where':_0x5eacec[_0x475d('0x48')]};return db['SmsAccount'][_0x475d('0x27')](_0x5e270d)[_0x475d('0x2c')](function(_0x3bac1c){_0x4c2552[_0x475d('0x27')]=_0x3bac1c;if(_0x1f521a['query'][_0x475d('0x4f')]){_0x5eacec['include']=[{'all':!![]}];}return db[_0x475d('0x37')]['findAll'](_0x5eacec);})[_0x475d('0x2c')](function(_0x418bd3){_0x4c2552[_0x475d('0x50')]=_0x418bd3;return _0x4c2552;})[_0x475d('0x2c')](respondWithFilteredResult(_0x3157a9,_0x5eacec))[_0x475d('0x23')](handleError(_0x3157a9,null));};exports[_0x475d('0x51')]=function(_0x33969b,_0x35df83){var _0x52b984={'raw':![],'where':{'id':_0x33969b['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x467566={};_0x467566[_0x475d('0x3c')]=_[_0x475d('0x3d')](db[_0x475d('0x37')][_0x475d('0x38')]);_0x467566[_0x475d('0x3e')]=_[_0x475d('0x3d')](_0x33969b[_0x475d('0x3e')]);_0x467566[_0x475d('0x49')]=_[_0x475d('0x40')](_0x467566[_0x475d('0x3c')],_0x467566['query']);_0x52b984[_0x475d('0x3f')]=_['intersection'](_0x467566[_0x475d('0x3c')],qs[_0x475d('0x41')](_0x33969b[_0x475d('0x3e')][_0x475d('0x41')]));_0x52b984[_0x475d('0x3f')]=_0x52b984[_0x475d('0x3f')][_0x475d('0x52')]?_0x52b984['attributes']:_0x467566[_0x475d('0x3c')];if(_0x33969b[_0x475d('0x3e')]['includeAll']){_0x52b984['include']=[{'all':!![]}];}_0x52b984=_[_0x475d('0x4c')]({},_0x52b984,_0x33969b['options']);return db[_0x475d('0x37')]['find'](_0x52b984)[_0x475d('0x2c')](handleEntityNotFound(_0x35df83,null))[_0x475d('0x2c')](respondWithResult(_0x35df83,null))[_0x475d('0x23')](handleError(_0x35df83,null));};exports[_0x475d('0x53')]=function(_0x339c40,_0x431e92){return db['SmsAccount'][_0x475d('0x53')](_0x339c40[_0x475d('0x54')],{})[_0x475d('0x2c')](function(_0x28545e){var _0x41970d=_0x339c40[_0x475d('0x55')]['get']({'plain':!![]});if(!_0x41970d)throw new Error(_0x475d('0x56'));if(_0x41970d[_0x475d('0x57')]===_0x475d('0x55')){var _0x837f5c=_0x28545e[_0x475d('0x2e')]({'plain':!![]});var _0x529498=_0x475d('0x2f');return db[_0x475d('0x58')][_0x475d('0x59')]({'where':{'name':_0x529498,'userProfileId':_0x41970d[_0x475d('0x5a')]},'raw':!![]})['then'](function(_0x9c4fbc){if(_0x9c4fbc&&_0x9c4fbc[_0x475d('0x5b')]===0x0){return db['UserProfileResource'][_0x475d('0x53')]({'name':_0x837f5c[_0x475d('0x4d')],'resourceId':_0x837f5c['id'],'type':_0x9c4fbc[_0x475d('0x4d')],'sectionId':_0x9c4fbc['id']},{})[_0x475d('0x2c')](function(){return _0x28545e;});}else{return _0x28545e;}})[_0x475d('0x23')](function(_0x32231d){logger[_0x475d('0x20')](_0x475d('0x5c'),_0x32231d);throw _0x32231d;});}return _0x28545e;})[_0x475d('0x2c')](respondWithResult(_0x431e92,0xc9))['catch'](handleError(_0x431e92,null));};exports[_0x475d('0x2b')]=function(_0x5a939c,_0x47e010){if(_0x5a939c[_0x475d('0x54')]['id']){delete _0x5a939c[_0x475d('0x54')]['id'];}return db[_0x475d('0x37')]['find']({'where':{'id':_0x5a939c[_0x475d('0x5d')]['id']},'include':[{'model':db[_0x475d('0x34')],'as':_0x475d('0x35')}]})[_0x475d('0x2c')](handleEntityNotFound(_0x47e010,null))[_0x475d('0x2c')](saveUpdates(_0x5a939c[_0x475d('0x54')],null))[_0x475d('0x2c')](respondWithResult(_0x47e010,null))[_0x475d('0x23')](handleError(_0x47e010,null));};exports[_0x475d('0x2d')]=function(_0x395f7e,_0x38ccca){return db[_0x475d('0x37')][_0x475d('0x59')]({'where':{'id':_0x395f7e[_0x475d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x38ccca,null))[_0x475d('0x2c')](removeEntity(_0x38ccca,null))[_0x475d('0x23')](handleError(_0x38ccca,null));};exports['describe']=function(_0x59c92d,_0x4b1298){return db[_0x475d('0x37')][_0x475d('0x5e')]()['then'](respondWithResult(_0x4b1298,null))[_0x475d('0x23')](handleError(_0x4b1298,null));};exports['addDisposition']=function(_0x4af61b,_0x131666,_0x417c88){if(_0x4af61b[_0x475d('0x54')]['id']){delete _0x4af61b['body']['id'];}return db[_0x475d('0x37')][_0x475d('0x59')]({'where':{'id':_0x4af61b[_0x475d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x131666,null))['then'](function(_0x414947){if(_0x414947){_0x4af61b['body'][_0x475d('0x5f')]=_0x414947['id'];return db[_0x475d('0x60')][_0x475d('0x53')](_0x4af61b[_0x475d('0x54')]);}})[_0x475d('0x2c')](respondWithResult(_0x131666,null))[_0x475d('0x23')](handleError(_0x131666,null));};exports[_0x475d('0x61')]=function(_0x4353cf,_0xed2fb8,_0x964976){var _0xd78096={'raw':![],'where':{}};var _0x115797={};var _0x57f297={'count':0x0,'rows':[]};return db[_0x475d('0x37')][_0x475d('0x62')]({'where':{'id':_0x4353cf['params']['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0xed2fb8,null))[_0x475d('0x2c')](function(_0x152daf){if(_0x152daf){_0x115797['model']=_[_0x475d('0x3d')](db[_0x475d('0x60')][_0x475d('0x38')]);_0x115797[_0x475d('0x3e')]=_[_0x475d('0x3d')](_0x4353cf[_0x475d('0x3e')]);_0x115797[_0x475d('0x49')]=_['intersection'](_0x115797['model'],_0x115797[_0x475d('0x3e')]);_0xd78096[_0x475d('0x3f')]=_[_0x475d('0x40')](_0x115797[_0x475d('0x3c')],qs[_0x475d('0x41')](_0x4353cf['query'][_0x475d('0x41')]));_0xd78096[_0x475d('0x3f')]=_0xd78096[_0x475d('0x3f')][_0x475d('0x52')]?_0xd78096[_0x475d('0x3f')]:_0x115797[_0x475d('0x3c')];if(!_0x4353cf['query'][_0x475d('0x42')](_0x475d('0x43'))){_0xd78096[_0x475d('0x44')]=qs['limit'](_0x4353cf[_0x475d('0x3e')][_0x475d('0x44')]);_0xd78096[_0x475d('0x45')]=qs[_0x475d('0x45')](_0x4353cf[_0x475d('0x3e')][_0x475d('0x45')]);}_0xd78096[_0x475d('0x46')]=qs[_0x475d('0x47')](_0x4353cf[_0x475d('0x3e')]['sort']);_0xd78096[_0x475d('0x48')]=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0x4353cf['query'],_0x115797['filters']));_0xd78096[_0x475d('0x48')][_0x475d('0x5f')]=_0x152daf['id'];if(_0x4353cf[_0x475d('0x3e')][_0x475d('0x4b')]){_0xd78096[_0x475d('0x48')]=_[_0x475d('0x4c')](_0xd78096[_0x475d('0x48')],{'$or':_[_0x475d('0x36')](_0xd78096[_0x475d('0x3f')],function(_0x270647){var _0x435f8a={};_0x435f8a[_0x270647]={'$like':'%'+_0x4353cf['query']['filter']+'%'};return _0x435f8a;})});}_0xd78096=_[_0x475d('0x4c')]({},_0xd78096,_0x4353cf[_0x475d('0x4e')]);return db[_0x475d('0x60')]['count']({'where':_0xd78096[_0x475d('0x48')]})['then'](function(_0xdfaef1){_0x57f297[_0x475d('0x27')]=_0xdfaef1;if(_0x4353cf[_0x475d('0x3e')][_0x475d('0x4f')]){_0xd78096['include']=[{'all':!![]}];}return db['Disposition'][_0x475d('0x63')](_0xd78096);})[_0x475d('0x2c')](function(_0x228c3d){_0x57f297[_0x475d('0x50')]=_0x228c3d;return _0x57f297;});}})['then'](respondWithFilteredResult(_0xed2fb8,_0xd78096))[_0x475d('0x23')](handleError(_0xed2fb8,null));};exports[_0x475d('0x64')]=function(_0x8f3320,_0x44d46e,_0x21979f){return db['SmsAccount']['find']({'where':{'id':_0x8f3320[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x44d46e,null))[_0x475d('0x2c')](function(_0xdaeebd){if(_0xdaeebd){return _0xdaeebd[_0x475d('0x64')](_0x8f3320[_0x475d('0x3e')][_0x475d('0x65')]);}})[_0x475d('0x2c')](respondWithStatusCode(_0x44d46e,null))[_0x475d('0x23')](handleError(_0x44d46e,null));};exports[_0x475d('0x66')]=function(_0x978a6e,_0xdaa97a,_0x41e0dc){if(_0x978a6e[_0x475d('0x54')]['id']){delete _0x978a6e['body']['id'];}return db[_0x475d('0x37')]['find']({'where':{'id':_0x978a6e['params']['id']}})['then'](handleEntityNotFound(_0xdaa97a,null))[_0x475d('0x2c')](function(_0x2f1775){if(_0x2f1775){_0x978a6e[_0x475d('0x54')][_0x475d('0x5f')]=_0x2f1775['id'];return db[_0x475d('0x67')][_0x475d('0x53')](_0x978a6e[_0x475d('0x54')]);}})['then'](respondWithResult(_0xdaa97a,null))[_0x475d('0x23')](handleError(_0xdaa97a,null));};exports['getAnswers']=function(_0x1f1625,_0x6ed12,_0x11a4bd){var _0x3c6662={'raw':![],'where':{}};var _0xeabfd4={};var _0x498089={'count':0x0,'rows':[]};return db['SmsAccount'][_0x475d('0x62')]({'where':{'id':_0x1f1625[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x6ed12,null))[_0x475d('0x2c')](function(_0x132511){if(_0x132511){_0xeabfd4['model']=_[_0x475d('0x3d')](db[_0x475d('0x67')]['rawAttributes']);_0xeabfd4[_0x475d('0x3e')]=_[_0x475d('0x3d')](_0x1f1625[_0x475d('0x3e')]);_0xeabfd4['filters']=_['intersection'](_0xeabfd4[_0x475d('0x3c')],_0xeabfd4[_0x475d('0x3e')]);_0x3c6662[_0x475d('0x3f')]=_[_0x475d('0x40')](_0xeabfd4[_0x475d('0x3c')],qs[_0x475d('0x41')](_0x1f1625[_0x475d('0x3e')][_0x475d('0x41')]));_0x3c6662[_0x475d('0x3f')]=_0x3c6662[_0x475d('0x3f')][_0x475d('0x52')]?_0x3c6662[_0x475d('0x3f')]:_0xeabfd4[_0x475d('0x3c')];if(!_0x1f1625[_0x475d('0x3e')]['hasOwnProperty'](_0x475d('0x43'))){_0x3c6662[_0x475d('0x44')]=qs[_0x475d('0x44')](_0x1f1625[_0x475d('0x3e')][_0x475d('0x44')]);_0x3c6662['offset']=qs[_0x475d('0x45')](_0x1f1625[_0x475d('0x3e')][_0x475d('0x45')]);}_0x3c6662[_0x475d('0x46')]=qs[_0x475d('0x47')](_0x1f1625['query']['sort']);_0x3c6662['where']=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0x1f1625[_0x475d('0x3e')],_0xeabfd4[_0x475d('0x49')]));_0x3c6662[_0x475d('0x48')][_0x475d('0x5f')]=_0x132511['id'];if(_0x1f1625[_0x475d('0x3e')][_0x475d('0x4b')]){_0x3c6662[_0x475d('0x48')]=_[_0x475d('0x4c')](_0x3c6662['where'],{'$or':_[_0x475d('0x36')](_0x3c6662[_0x475d('0x3f')],function(_0x34c418){var _0x2981ed={};_0x2981ed[_0x34c418]={'$like':'%'+_0x1f1625['query']['filter']+'%'};return _0x2981ed;})});}_0x3c6662=_[_0x475d('0x4c')]({},_0x3c6662,_0x1f1625[_0x475d('0x4e')]);return db[_0x475d('0x67')][_0x475d('0x27')]({'where':_0x3c6662['where']})[_0x475d('0x2c')](function(_0x4e99bd){_0x498089['count']=_0x4e99bd;if(_0x1f1625[_0x475d('0x3e')][_0x475d('0x4f')]){_0x3c6662['include']=[{'all':!![]}];}return db[_0x475d('0x67')][_0x475d('0x63')](_0x3c6662);})[_0x475d('0x2c')](function(_0x52c384){_0x498089[_0x475d('0x50')]=_0x52c384;return _0x498089;});}})[_0x475d('0x2c')](respondWithFilteredResult(_0x6ed12,_0x3c6662))[_0x475d('0x23')](handleError(_0x6ed12,null));};exports[_0x475d('0x68')]=function(_0x4b7030,_0x213389,_0x2b140f){return db['SmsAccount'][_0x475d('0x59')]({'where':{'id':_0x4b7030[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x213389,null))[_0x475d('0x2c')](function(_0x4a4cf8){if(_0x4a4cf8){return _0x4a4cf8[_0x475d('0x68')](_0x4b7030[_0x475d('0x3e')][_0x475d('0x65')]);}})['then'](respondWithStatusCode(_0x213389,null))['catch'](handleError(_0x213389,null));};exports[_0x475d('0x69')]=function(_0x1dc0da,_0x59f4c2,_0x55bac2){var _0x553e72={'channel':'sms'};var _0x967cf=[];var _0x26db0e=[];var _0x5aaead={};return db[_0x475d('0x37')][_0x475d('0x59')]({'where':{'id':_0x1dc0da['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x475d('0x2c')](handleEntityNotFound(_0x59f4c2,null))[_0x475d('0x2c')](function(_0xc49ec1){_0x553e72[_0x475d('0x6a')]=_0xc49ec1;_0x553e72[_0x475d('0x6b')]=_[_0x475d('0x6c')](_0xc49ec1[_0x475d('0x6d')],['priority'],[_0x475d('0x6e')]);if(_0x553e72[_0x475d('0x6a')][_0x475d('0x6d')]){delete _0x553e72[_0x475d('0x6a')][_0x475d('0x6d')];}return db[_0x475d('0x6f')]['describe']();})[_0x475d('0x2c')](function(_0x5aebaa){if(!_0x5aebaa){throw new db['Sequelize'][(_0x475d('0x70'))](_0x475d('0x71'));}_0x967cf=_[_0x475d('0x72')](_['keys'](_0x5aebaa),[_0x475d('0x73'),_0x475d('0x74')]);_0x26db0e=_['difference'](_[_0x475d('0x3d')](_0x5aebaa),['createdAt',_0x475d('0x74'),_0x475d('0x75'),'ListId']);_0x553e72[_0x475d('0x54')]={'mapKey':'mobile'};if(_0x553e72['account'][_0x475d('0x3a')]){switch(_0x553e72[_0x475d('0x6a')][_0x475d('0x3a')]){case _0x475d('0x76'):_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x78')];_0x553e72[_0x475d('0x54')]['body']=_0x1dc0da[_0x475d('0x54')][_0x475d('0x79')];_0x553e72[_0x475d('0x54')]['messageId']=_0x1dc0da[_0x475d('0x54')][_0x475d('0x7a')];break;case _0x475d('0x7b'):_0x553e72[_0x475d('0x54')]['from']='+'+_0x1dc0da['body'][_0x475d('0x7c')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x7d')];break;case'connectel':_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x77')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da['body'][_0x475d('0x22')];break;case'clicksend':_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x77')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x54')];_0x553e72['body'][_0x475d('0x7e')]=_0x1dc0da[_0x475d('0x54')]['message_id'];break;case _0x475d('0x7f'):_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x78')];_0x553e72['body'][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x80')];_0x553e72['body']['messageId']=_0x1dc0da[_0x475d('0x54')][_0x475d('0x81')];break;case _0x475d('0x82'):_0x553e72[_0x475d('0x54')]['from']='+'+_0x1dc0da['body'][_0x475d('0x83')][0x0][_0x475d('0x77')];_0x553e72[_0x475d('0x54')]['body']=_0x1dc0da[_0x475d('0x54')][_0x475d('0x83')][0x0][_0x475d('0x7d')];_0x553e72[_0x475d('0x54')]['messageId']=_0x1dc0da['body']['results'][0x0][_0x475d('0x7e')];break;case'csc':_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x84')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')]['segmentedMessage']['message'];break;case _0x475d('0x85'):_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x86')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x7d')];_0x553e72[_0x475d('0x54')][_0x475d('0x7e')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x87')];break;case _0x475d('0x88'):_0x553e72['body'][_0x475d('0x7e')]=_0x1dc0da[_0x475d('0x54')][0x0]['message']['id'];_0x553e72['body'][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')][0x0][_0x475d('0x22')][_0x475d('0x77')];_0x553e72[_0x475d('0x54')][_0x475d('0x54')]=_0x1dc0da[_0x475d('0x54')][0x0][_0x475d('0x22')][_0x475d('0x7d')];break;case _0x475d('0x89'):_0x553e72[_0x475d('0x54')][_0x475d('0x77')]=_0x1dc0da[_0x475d('0x54')]['from'];_0x553e72[_0x475d('0x54')]['body']=_0x1dc0da['body']['message'];_0x553e72[_0x475d('0x54')][_0x475d('0x7e')]=_0x1dc0da[_0x475d('0x54')][_0x475d('0x8a')];break;}}if(_0x553e72[_0x475d('0x54')]['id']){delete _0x553e72[_0x475d('0x54')]['id'];}if(_[_0x475d('0x8b')](_0x553e72[_0x475d('0x54')][_0x475d('0x77')])){throw new db[(_0x475d('0x8c'))][(_0x475d('0x70'))](_0x475d('0x8d'));}if(_[_0x475d('0x8b')](_0x553e72[_0x475d('0x54')][_0x475d('0x54')])||_0x553e72[_0x475d('0x54')][_0x475d('0x54')]===''){throw new db[(_0x475d('0x8c'))][(_0x475d('0x70'))](_0x475d('0x8e'));}if(_[_0x475d('0x8b')](_0x553e72[_0x475d('0x54')][_0x475d('0x8f')])){throw new db[(_0x475d('0x8c'))]['ValidationError'](_0x475d('0x90')+_0x26db0e);}if(!_[_0x475d('0x91')](_0x26db0e,_0x553e72[_0x475d('0x54')][_0x475d('0x8f')])){throw new db[(_0x475d('0x8c'))]['ValidationError'](_0x475d('0x92')+_0x26db0e);}_0x5aaead[_0x553e72[_0x475d('0x54')][_0x475d('0x8f')]]=_0x553e72['body'][_0x475d('0x77')];return db[_0x475d('0x93')][_0x475d('0x59')]({'where':{'id':_0x553e72['account'][_0x475d('0x94')]},'include':[{'model':db[_0x475d('0x6f')],'as':'Contacts','where':_0x5aaead,'limit':0x1,'order':[[_0x475d('0x74'),'DESC']]}]});})['then'](handleEntityNotFound(_0x59f4c2,null))[_0x475d('0x2c')](function(_0x2f572b){if(_0x2f572b){_0x553e72['list']=_[_0x475d('0x95')](_0x2f572b,[_0x475d('0x96')]);if(_0x2f572b[_0x475d('0x96')][_0x475d('0x52')]){return _0x2f572b[_0x475d('0x96')][0x0];}var _0x177650=_[_0x475d('0x16')](_0x553e72[_0x475d('0x54')],{'firstName':_0x553e72[_0x475d('0x54')][_0x475d('0x77')],'ListId':_0x2f572b['id']});_0x177650[_0x553e72['body']['mapKey']]=_0x553e72['body'][_0x475d('0x77')];return db[_0x475d('0x6f')][_0x475d('0x53')](_0x177650,{'fields':_0x967cf,'raw':!![]});}})[_0x475d('0x2c')](handleEntityNotFound(_0x59f4c2,null))[_0x475d('0x2c')](function(_0x373f5d){if(_0x373f5d){_0x553e72['contact']=_0x373f5d;var _0x5317b3={'ContactId':_0x373f5d['id'],'phone':_0x553e72[_0x475d('0x54')][_0x475d('0x77')],'SmsAccountId':_0x1dc0da[_0x475d('0x5d')]['id']};var _0x25ed95={'ContactId':_0x373f5d['id'],'SmsAccountId':_0x1dc0da[_0x475d('0x5d')]['id'],'closed':![]};return db[_0x475d('0x97')][_0x475d('0x59')]({'where':_0x25ed95})[_0x475d('0x2c')](function(_0x27a6e5){if(_0x27a6e5){return[_0x27a6e5,![]];}return db[_0x475d('0x97')][_0x475d('0x53')](_0x5317b3)[_0x475d('0x2c')](function(_0x575389){return[_0x575389,!![]];});});}})['spread'](function(_0x27b991,_0xb3fda2){_0x553e72[_0x475d('0x98')]=_0x27b991[_0x475d('0x2e')]({'plain':!![]});_0x553e72['interaction']['created']=![];if(_0xb3fda2){if(_0x553e72[_0x475d('0x6a')][_0x475d('0x99')]){_0x553e72['applications'][_0x475d('0x9a')]({'id':0x0,'priority':_0x553e72[_0x475d('0x6b')][_0x475d('0x52')]+0x1,'app':_0x475d('0x9b'),'appdata':_0x475d('0x9c'),'interval':_0x475d('0x9d')});}_0x553e72['interaction'][_0x475d('0x9e')]=!![];}return db[_0x475d('0x9f')]['create']({'phone':_0x553e72[_0x475d('0x54')]['from'],'messageId':_0x553e72[_0x475d('0x54')][_0x475d('0x7e')],'body':_0x553e72[_0x475d('0x54')]['body'],'SmsAccountId':_0x1dc0da[_0x475d('0x5d')]['id'],'SmsInteractionId':_0x27b991['id'],'direction':'in','ContactId':_0x27b991[_0x475d('0xa0')],'AttachmentId':_0x553e72[_0x475d('0x54')][_0x475d('0xa1')]});})[_0x475d('0x2c')](function(_0x39b435){_0x553e72[_0x475d('0x22')]=_0x39b435;if(_0x553e72[_0x475d('0x98')]['UserId']){return db[_0x475d('0xa2')][_0x475d('0x59')]({'attributes':['id','name'],'where':{'id':_0x553e72[_0x475d('0x98')][_0x475d('0xa3')]}})['then'](function(_0x5907af){if(_0x5907af){_0x553e72['applications'][_0x475d('0xa4')]({'id':0x0,'priority':0x0,'app':_0x475d('0xa5'),'appdata':_0x5907af[_0x475d('0x4d')]+','+(_0x553e72[_0x475d('0x6a')][_0x475d('0xa6')]||0xa),'interval':_0x475d('0x9d')});}return respondWithRpcPromise(_0x475d('0xa7'),_0x475d('0xa8'),_0x553e72);});}return respondWithRpcPromise(_0x475d('0xa7'),_0x475d('0xa8'),_0x553e72);})[_0x475d('0x2c')](function(_0x3eebf0){if(_0x3eebf0){var _0x3b2251=0xc8;var _0x110d95=_0x475d('0xa9');logger[_0x475d('0x1b')](_0x475d('0x1d'),_0x110d95,_0x3b2251,_0x475d('0xaa'));logger[_0x475d('0x1c')](_0x475d('0xab'),_0x110d95,_0x3b2251,'entity\x20found',JSON['stringify'](_0x3eebf0));if(_0x553e72['account'][_0x475d('0x3a')]===_0x475d('0x76')){return _0x59f4c2['status'](_0x3b2251)[_0x475d('0x28')](_0x475d('0xac'),'text/xml')['send'](_0x475d('0xad'));}else{return _0x59f4c2['status'](_0x3b2251)[_0x475d('0x26')](_0x3eebf0);}}})[_0x475d('0x23')](handleError(_0x59f4c2,null));};exports[_0x475d('0xae')]=function(_0x209880,_0x29734b,_0x5d0576){return db[_0x475d('0x37')]['findOne']({'where':{'id':_0x209880[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x29734b,null))[_0x475d('0x2c')](function(_0x3ad8eb){if(_0x3ad8eb){return db['sequelize'][_0x475d('0xaf')](function(_0x5a2857){return db[_0x475d('0xb0')][_0x475d('0x2d')]({'where':{'SmsAccountId':_0x209880[_0x475d('0x5d')]['id']},'transaction':_0x5a2857})[_0x475d('0x2c')](function(_0x2c2138){var _0x24d307=_[_0x475d('0x36')](_0x209880[_0x475d('0x54')],function(_0x55b17d){_0x55b17d[_0x475d('0x5f')]=_0x209880['params']['id'];return _0x55b17d;});return db['SmsApplication']['bulkCreate'](_0x24d307,{'transaction':_0x5a2857});});})[_0x475d('0x2c')](function(){return db[_0x475d('0xb0')]['findAndCountAll']({'where':{'SmsAccountId':_0x209880[_0x475d('0x5d')]['id']},'order':_0x475d('0xb1')});});}})[_0x475d('0x2c')](respondWithResult(_0x29734b,null))[_0x475d('0x23')](handleError(_0x29734b,null));};exports[_0x475d('0xb2')]=function(_0xb4ced7,_0x3a07ff,_0x459a1e){var _0x580c9f={};var _0x1b876a={};var _0xbb4aa3;var _0x40f5b6;return db[_0x475d('0x37')]['findOne']({'where':{'id':_0xb4ced7[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x3a07ff,null))[_0x475d('0x2c')](function(_0x19f77e){if(_0x19f77e){_0xbb4aa3=_0x19f77e;_0x1b876a['model']=_[_0x475d('0x3d')](db['SmsApplication']['rawAttributes']);_0x1b876a[_0x475d('0x3e')]=_['keys'](_0xb4ced7[_0x475d('0x3e')]);_0x1b876a[_0x475d('0x49')]=_[_0x475d('0x40')](_0x1b876a[_0x475d('0x3c')],_0x1b876a[_0x475d('0x3e')]);_0x580c9f[_0x475d('0x3f')]=_['intersection'](_0x1b876a[_0x475d('0x3c')],qs['fields'](_0xb4ced7[_0x475d('0x3e')]['fields']));_0x580c9f[_0x475d('0x3f')]=_0x580c9f['attributes']['length']?_0x580c9f[_0x475d('0x3f')]:_0x1b876a[_0x475d('0x3c')];_0x580c9f[_0x475d('0x46')]=qs[_0x475d('0x47')](_0xb4ced7[_0x475d('0x3e')][_0x475d('0x47')]);_0x580c9f[_0x475d('0x48')]=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0xb4ced7[_0x475d('0x3e')],_0x1b876a[_0x475d('0x49')]));if(_0xb4ced7[_0x475d('0x3e')][_0x475d('0x4b')]){_0x580c9f[_0x475d('0x48')]=_['merge'](_0x580c9f['where'],{'$or':_['map'](_0x580c9f[_0x475d('0x3f')],function(_0x1fbcf8){var _0x36c21c={};_0x36c21c[_0x1fbcf8]={'$like':'%'+_0xb4ced7[_0x475d('0x3e')][_0x475d('0x4b')]+'%'};return _0x36c21c;})});}_0x580c9f=_[_0x475d('0x4c')]({},_0x580c9f,_0xb4ced7[_0x475d('0x4e')]);return _0xbb4aa3[_0x475d('0xb2')](_0x580c9f);}})['then'](function(_0x57edc0){if(_0x57edc0){_0x40f5b6=_0x57edc0[_0x475d('0x52')];if(!_0xb4ced7[_0x475d('0x3e')][_0x475d('0x42')](_0x475d('0x43'))){_0x580c9f[_0x475d('0x44')]=qs[_0x475d('0x44')](_0xb4ced7['query'][_0x475d('0x44')]);_0x580c9f[_0x475d('0x45')]=qs['offset'](_0xb4ced7['query'][_0x475d('0x45')]);}return _0xbb4aa3[_0x475d('0xb2')](_0x580c9f);}})[_0x475d('0x2c')](function(_0x4e14b7){if(_0x4e14b7){return _0x4e14b7?{'count':_0x40f5b6,'rows':_0x4e14b7}:null;}})[_0x475d('0x2c')](respondWithResult(_0x3a07ff,null))[_0x475d('0x23')](handleError(_0x3a07ff,null));};exports[_0x475d('0xb3')]=function(_0x1e9386,_0x18f1b9,_0x5b2694){var _0x20f3a2={'raw':![],'where':{}};var _0x32627d={};var _0x1750a5={'count':0x0,'rows':[]};return db['SmsAccount'][_0x475d('0x62')]({'where':{'id':_0x1e9386[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x18f1b9,null))[_0x475d('0x2c')](function(_0x511d55){if(_0x511d55){_0x32627d['model']=_[_0x475d('0x3d')](db[_0x475d('0x97')][_0x475d('0x38')]);_0x32627d['query']=_[_0x475d('0x3d')](_0x1e9386[_0x475d('0x3e')]);_0x32627d[_0x475d('0x49')]=_['intersection'](_0x32627d[_0x475d('0x3c')],_0x32627d[_0x475d('0x3e')]);_0x20f3a2[_0x475d('0x3f')]=_[_0x475d('0x40')](_0x32627d[_0x475d('0x3c')],qs['fields'](_0x1e9386[_0x475d('0x3e')][_0x475d('0x41')]));_0x20f3a2['attributes']=_0x20f3a2[_0x475d('0x3f')]['length']?_0x20f3a2[_0x475d('0x3f')]:_0x32627d[_0x475d('0x3c')];if(!_0x1e9386[_0x475d('0x3e')][_0x475d('0x42')](_0x475d('0x43'))){_0x20f3a2[_0x475d('0x44')]=qs['limit'](_0x1e9386[_0x475d('0x3e')][_0x475d('0x44')]);_0x20f3a2[_0x475d('0x45')]=qs['offset'](_0x1e9386[_0x475d('0x3e')][_0x475d('0x45')]);}_0x20f3a2['order']=qs[_0x475d('0x47')](_0x1e9386[_0x475d('0x3e')]['sort']);_0x20f3a2[_0x475d('0x48')]=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0x1e9386[_0x475d('0x3e')],_0x32627d[_0x475d('0x49')]));_0x20f3a2['where']['SmsAccountId']=_0x511d55['id'];if(_0x1e9386[_0x475d('0x3e')][_0x475d('0x4b')]){_0x20f3a2[_0x475d('0x48')]=_[_0x475d('0x4c')](_0x20f3a2[_0x475d('0x48')],{'$or':_[_0x475d('0x36')](_0x20f3a2['attributes'],function(_0x49d351){var _0x251447={};_0x251447[_0x49d351]={'$like':'%'+_0x1e9386['query'][_0x475d('0x4b')]+'%'};return _0x251447;})});}_0x20f3a2=_[_0x475d('0x4c')]({},_0x20f3a2,_0x1e9386['options']);return db[_0x475d('0x97')]['count']({'where':_0x20f3a2[_0x475d('0x48')]})[_0x475d('0x2c')](function(_0x186660){_0x1750a5['count']=_0x186660;if(_0x1e9386[_0x475d('0x3e')]['includeAll']){_0x20f3a2['include']=[{'model':db[_0x475d('0x6f')],'as':'Contact','required':![]},{'model':db[_0x475d('0xa2')],'as':_0x475d('0xb4'),'attributes':[_0x475d('0x4d'),_0x475d('0xb5'),_0x475d('0xb6')],'required':![]},{'model':db[_0x475d('0xb7')],'as':_0x475d('0xb8'),'attributes':['id',_0x475d('0x4d'),_0x475d('0xb9')],'where':_0x1e9386[_0x475d('0x3e')][_0x475d('0xba')]?{'id':_0x1e9386[_0x475d('0x3e')][_0x475d('0xba')]}:undefined,'required':_0x1e9386[_0x475d('0x3e')][_0x475d('0xba')]?!![]:![]}];}return db[_0x475d('0x97')]['findAll'](_0x20f3a2);})[_0x475d('0x2c')](function(_0x5e4732){_0x1750a5[_0x475d('0x50')]=_0x5e4732;return _0x1750a5;});}})['then'](respondWithFilteredResult(_0x18f1b9,_0x20f3a2))['catch'](handleError(_0x18f1b9,null));};exports[_0x475d('0xbb')]=function(_0x16cb89,_0x14af8e,_0x108d40){var _0x57935b,_0x4f403a,_0x1fbc80;if(_[_0x475d('0x8b')](_0x16cb89[_0x475d('0x54')]['body'])||_0x16cb89[_0x475d('0x54')]['body']===''){throw new db[(_0x475d('0x8c'))][(_0x475d('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x475d('0x8b')](_0x16cb89[_0x475d('0x54')]['to'])){throw new db[(_0x475d('0x8c'))][(_0x475d('0x70'))](_0x475d('0xbc'));}_0x57935b=_0x16cb89[_0x475d('0x54')]['to'];return db[_0x475d('0x37')][_0x475d('0x59')]({'where':{'id':_0x16cb89[_0x475d('0x5d')]['id']},'include':[{'model':db[_0x475d('0x93')],'as':_0x475d('0xbd'),'include':[{'model':db['CmContact'],'as':_0x475d('0x96'),'where':{'mobile':_0x57935b},'limit':0x1,'order':[[_0x475d('0x74'),_0x475d('0xbe')]]}]}]})[_0x475d('0x2c')](handleEntityNotFound(_0x14af8e,null))[_0x475d('0x2c')](function(_0x4da924){if(_0x4da924&&_0x4da924[_0x475d('0xbd')]){_0x4f403a=_0x4da924['get']({'plain':!![]});if(_0x4f403a[_0x475d('0xbd')]&&_0x4f403a[_0x475d('0xbd')][_0x475d('0x96')][_0x475d('0x52')]){return _0x4f403a[_0x475d('0xbd')][_0x475d('0x96')][0x0];}return db[_0x475d('0x6f')][_0x475d('0x53')](_[_0x475d('0x16')](_0x16cb89['body'],{'firstName':_0x57935b,'mobile':_0x57935b,'phone':_0x57935b,'ListId':_0x4f403a[_0x475d('0x94')]}));}})[_0x475d('0x2c')](handleEntityNotFound(_0x14af8e,null))[_0x475d('0x2c')](function(_0x193fdf){if(_0x193fdf){_0x1fbc80=_0x193fdf;return db[_0x475d('0x97')][_0x475d('0x59')]({'where':{'ContactId':_0x1fbc80['id'],'closed':![],'SmsAccountId':_0x4f403a['id']}})['then'](function(_0x457b0f){if(_0x457b0f){return[_0x457b0f,![]];}return db[_0x475d('0x97')][_0x475d('0x53')]({'UserId':_0x16cb89[_0x475d('0x55')]['id'],'ContactId':_0x1fbc80['id'],'SmsAccountId':_0x4f403a['id'],'phone':_0x57935b,'firstMsgDirection':'out','Messages':[_[_0x475d('0x4c')](_0x16cb89[_0x475d('0x54')],{'read':![],'body':_0x16cb89[_0x475d('0x54')][_0x475d('0x54')],'phone':_0x57935b,'SmsAccountId':_0x4f403a['id'],'UserId':_0x16cb89[_0x475d('0x55')]['id'],'ContactId':_0x1fbc80['id']})]},{'include':[{'model':db[_0x475d('0x9f')],'as':_0x475d('0xbf')}]})[_0x475d('0x2c')](function(_0x180169){return[_0x180169,!![]];});});}})[_0x475d('0xc0')](function(_0x4c6200,_0x50363c){if(_0x50363c){return _0x4c6200;}return db[_0x475d('0x9f')][_0x475d('0x53')](_[_0x475d('0x4c')](_0x16cb89[_0x475d('0x54')],{'read':![],'body':_0x16cb89['body']['body'],'phone':_0x57935b,'SmsAccountId':_0x4f403a['id'],'SmsInteractionId':_0x4c6200['id'],'UserId':_0x16cb89[_0x475d('0x55')]['id'],'ContactId':_0x1fbc80['id']}))[_0x475d('0x2c')](function(_0x4c1c08){_0x4c6200['dataValues'][_0x475d('0xbf')]=[];_0x4c6200[_0x475d('0xc1')][_0x475d('0xbf')]['push'](_0x4c1c08[_0x475d('0xc1')]);return _0x4c6200;});})['then'](respondWithResult(_0x14af8e,null))[_0x475d('0x23')](handleError(_0x14af8e,null));};exports[_0x475d('0x25')]=function(_0x26c521,_0x5108c3,_0x258a4f){if(_0x26c521[_0x475d('0x54')]['id']){delete _0x26c521[_0x475d('0x54')]['id'];}var _0x469323,_0x1a7c13,_0x7bb6c;return db[_0x475d('0x37')]['find']({'where':{'id':_0x26c521[_0x475d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5108c3,null))['then'](function(_0x4180d3){if(_0x4180d3){_0x7bb6c=_0x4180d3;logger['debug'](_0x475d('0x1d'),'status',_0x475d('0xc2'),_0x4180d3[_0x475d('0x3a')],util[_0x475d('0xc3')](_0x26c521['body'],{'showHidden':![],'depth':null}));switch(_0x4180d3[_0x475d('0x3a')]){case _0x475d('0x7b'):if(_0x26c521[_0x475d('0x54')]['skebby_dispatch_id']&&_0x26c521[_0x475d('0x54')][_0x475d('0x25')]){_0x1a7c13=_0x26c521[_0x475d('0x54')]['status'];return db[_0x475d('0x9f')]['find']({'where':{'messageId':_0x26c521[_0x475d('0x54')][_0x475d('0xc4')]}});}break;case _0x475d('0xc5'):if(_0x26c521[_0x475d('0x54')][_0x475d('0xc6')]&&_0x26c521[_0x475d('0x54')][_0x475d('0xc7')]){_0x1a7c13=_0x26c521['body'][_0x475d('0xc7')];return db[_0x475d('0x9f')][_0x475d('0x59')]({'where':{'messageId':_0x26c521[_0x475d('0x54')][_0x475d('0xc6')]}});}break;case'clicksend':if(_0x26c521[_0x475d('0x54')][_0x475d('0xc8')]&&_0x26c521[_0x475d('0x54')][_0x475d('0xc9')]){_0x1a7c13=_0x26c521['body'][_0x475d('0xc9')];return db['SmsMessage']['find']({'where':{'messageId':_0x26c521[_0x475d('0x54')][_0x475d('0xc8')]}});}break;case _0x475d('0x82'):var _0x598d48=_0x26c521['body'][_0x475d('0x83')][0x0];if(_0x598d48[_0x475d('0x7e')]&&_0x598d48['status'][_0x475d('0xca')]===_0x475d('0xcb')){_0x1a7c13=_0x598d48[_0x475d('0x25')][_0x475d('0xca')];return db[_0x475d('0x9f')][_0x475d('0x59')]({'where':{'messageId':_0x598d48[_0x475d('0x7e')]}});}break;case'clickatell':if(_0x26c521[_0x475d('0x54')][_0x475d('0x7e')]&&_0x26c521[_0x475d('0x54')][_0x475d('0x25')]){_0x1a7c13=_0x26c521[_0x475d('0x54')][_0x475d('0x25')];return db[_0x475d('0x9f')][_0x475d('0x59')]({'where':{'messageId':_0x26c521[_0x475d('0x54')]['messageId']}});}break;case _0x475d('0x88'):if(_0x26c521['body'][0x0][_0x475d('0x22')]['id']){_0x1a7c13=_0x26c521[_0x475d('0x54')][0x0][_0x475d('0x3a')];return db[_0x475d('0x9f')]['find']({'where':{'messageId':_0x26c521[_0x475d('0x54')][0x0]['message']['id']}});}break;case _0x475d('0x89'):if(_0x26c521['body'][_0x475d('0xcc')]&&_0x26c521['body'][_0x475d('0x25')]){_0x1a7c13=_0x26c521['body'][_0x475d('0x25')];return db[_0x475d('0x9f')]['find']({'where':{'messageId':_0x26c521['body'][_0x475d('0xcc')]}});}break;}}})['then'](handleEntityNotFound(_0x5108c3,null))['then'](function(_0x3eefd9){if(_0x3eefd9){_0x469323=_0x3eefd9;switch(_0x7bb6c[_0x475d('0x3a')]){case _0x475d('0x7b'):if(_0x1a7c13===_0x475d('0xcb')){return _0x469323[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')](_0x475d('0x1d'),_0x475d('0x25'),_0x475d('0x7b'),util[_0x475d('0xc3')](_0x26c521['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1a7c13==='1'){return _0x469323['update']({'read':!![]});}else{logger[_0x475d('0x20')](_0x475d('0x1d'),_0x475d('0x25'),_0x475d('0x7b'),util[_0x475d('0xc3')](_0x26c521[_0x475d('0x54')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x26c521[_0x475d('0x54')][_0x475d('0xcd')]&&_0x1a7c13>=0xc8&&_0x1a7c13<=0xce){return _0x469323[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')](_0x475d('0x1d'),_0x475d('0x25'),'clicksend',util[_0x475d('0xc3')](_0x26c521[_0x475d('0x54')],{'showHidden':![],'depth':null}));}break;case _0x475d('0x82'):var _0x4fd579=_0x26c521['body'][_0x475d('0x83')][0x0];if(_0x4fd579[_0x475d('0x25')][_0x475d('0xca')]===_0x475d('0xcb')){return _0x469323[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x475d('0x25'),_0x475d('0x82'),util[_0x475d('0xc3')](_0x26c521['body'],{'showHidden':![],'depth':null}));}break;case _0x475d('0x85'):if(_0x1a7c13==_0x475d('0xce')||_0x1a7c13==_0x475d('0xcf')){return _0x469323['update']({'read':!![]});}else{logger[_0x475d('0x20')](_0x475d('0x1d'),'status',_0x475d('0x85'),util[_0x475d('0xc3')](_0x26c521[_0x475d('0x54')],{'showHidden':![],'depth':null}));}break;case _0x475d('0x88'):if(_0x1a7c13==_0x475d('0xd0')){return _0x469323[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')](_0x475d('0x1d'),'status',_0x475d('0x88'),util['inspect'](_0x26c521[_0x475d('0x54')],{'showHidden':![],'depth':null}));}break;case _0x475d('0x89'):if(_0x1a7c13===_0x475d('0xd1')||_0x1a7c13===_0x475d('0xd2')){return _0x469323[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x475d('0x25'),_0x475d('0x89'),util[_0x475d('0xc3')](_0x26c521[_0x475d('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x469323;}})[_0x475d('0x2c')](respondWithResult(_0x5108c3,null))['catch'](handleError(_0x5108c3,null));};exports['statusGet']=function(_0x5db2da,_0x291425,_0x4a72e4){var _0x2d1cc3,_0x48facc,_0x58e5d0;return db['SmsAccount']['find']({'where':{'id':_0x5db2da[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x291425,null))['then'](function(_0xefbd82){if(_0xefbd82){_0x58e5d0=_0xefbd82;logger[_0x475d('0x1c')](_0x475d('0x1d'),_0x475d('0x25'),_0x475d('0xc2'),_0xefbd82[_0x475d('0x3a')],util[_0x475d('0xc3')](_0x5db2da[_0x475d('0x3e')],{'showHidden':![],'depth':null}));switch(_0xefbd82[_0x475d('0x3a')]){case _0x475d('0xd3'):if(_0x5db2da[_0x475d('0x3e')][_0x475d('0xd4')]&&_0x5db2da[_0x475d('0x3e')][_0x475d('0xd5')]){_0x48facc=_0x5db2da[_0x475d('0x3e')][_0x475d('0xd5')];return db['SmsMessage'][_0x475d('0x59')]({'where':{'messageId':_0x5db2da[_0x475d('0x3e')][_0x475d('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x291425,null))['then'](function(_0x441eca){if(_0x441eca){_0x2d1cc3=_0x441eca;switch(_0x58e5d0[_0x475d('0x3a')]){case'csc':if(_0x48facc==='2'||_0x48facc==='6'){return _0x2d1cc3[_0x475d('0x2b')]({'read':!![]});}else{logger[_0x475d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x475d('0x25'),_0x475d('0xd3'),util['inspect'](_0x5db2da[_0x475d('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x2d1cc3;}})['then'](respondWithResult(_0x291425,null))[_0x475d('0x23')](handleError(_0x291425,null));};exports['addAgents']=function(_0x401c27,_0x1fc6f3,_0x4f121f){return db['SmsAccount'][_0x475d('0x59')]({'where':{'id':_0x401c27[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x1fc6f3,null))[_0x475d('0x2c')](function(_0x588c86){if(_0x588c86){return _0x588c86['addAgents'](_0x401c27['body'][_0x475d('0x65')],_[_0x475d('0x95')](_0x401c27['body'],[_0x475d('0x65'),'id'])||{})['spread'](function(_0x7f917f){for(var _0x48a8ef=0x0;_0x48a8ef<_0x401c27[_0x475d('0x54')][_0x475d('0x65')][_0x475d('0x52')];_0x48a8ef+=0x1){socket[_0x475d('0xd6')]('userSmsAccount:save',{'UserId':_0x401c27[_0x475d('0x54')][_0x475d('0x65')][_0x48a8ef],'SmsAccountId':_0x401c27[_0x475d('0x5d')]['id']});}return _0x7f917f;});}})[_0x475d('0x2c')](respondWithResult(_0x1fc6f3,null))[_0x475d('0x23')](handleError(_0x1fc6f3,null));};exports['removeAgents']=function(_0xb639b6,_0x5e88fd,_0x415dc4){return db[_0x475d('0x37')][_0x475d('0x59')]({'where':{'id':_0xb639b6[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x5e88fd,null))['then'](function(_0x4e1419){if(_0x4e1419){return _0x4e1419[_0x475d('0xd7')](_0xb639b6['query']['ids'])[_0x475d('0x2c')](function(){if(_['isArray'](_0xb639b6[_0x475d('0x3e')]['ids'])){for(var _0x3e7de4=0x0;_0x3e7de4<_0xb639b6[_0x475d('0x3e')][_0x475d('0x65')][_0x475d('0x52')];_0x3e7de4+=0x1){socket[_0x475d('0xd6')](_0x475d('0xd8'),{'UserId':Number(_0xb639b6[_0x475d('0x3e')][_0x475d('0x65')][_0x3e7de4]),'SmsAccountId':Number(_0xb639b6[_0x475d('0x5d')]['id'])});}}else{socket['emit'](_0x475d('0xd8'),{'UserId':Number(_0xb639b6[_0x475d('0x3e')][_0x475d('0x65')]),'SmsAccountId':Number(_0xb639b6['params']['id'])});}});}})[_0x475d('0x2c')](respondWithStatusCode(_0x5e88fd,null))['catch'](handleError(_0x5e88fd,null));};exports['getAgents']=function(_0x217650,_0x3350f5,_0x136d2b){var _0x4619db={};var _0x3ff137={};var _0x1e145a;var _0x2205dc;return db[_0x475d('0x37')][_0x475d('0x62')]({'where':{'id':_0x217650[_0x475d('0x5d')]['id']}})[_0x475d('0x2c')](handleEntityNotFound(_0x3350f5,null))[_0x475d('0x2c')](function(_0x3c7e44){if(_0x3c7e44){_0x1e145a=_0x3c7e44;_0x3ff137[_0x475d('0x3c')]=_[_0x475d('0x3d')](db[_0x475d('0xa2')][_0x475d('0x38')]);_0x3ff137[_0x475d('0x3e')]=_[_0x475d('0x3d')](_0x217650['query']);_0x3ff137[_0x475d('0x49')]=_[_0x475d('0x40')](_0x3ff137[_0x475d('0x3c')],_0x3ff137['query']);_0x4619db[_0x475d('0x3f')]=_['intersection'](_0x3ff137[_0x475d('0x3c')],qs[_0x475d('0x41')](_0x217650[_0x475d('0x3e')][_0x475d('0x41')]));_0x4619db[_0x475d('0x3f')]=_0x4619db[_0x475d('0x3f')][_0x475d('0x52')]?_0x4619db[_0x475d('0x3f')]:_0x3ff137['model'];_0x4619db[_0x475d('0x46')]=qs[_0x475d('0x47')](_0x217650[_0x475d('0x3e')][_0x475d('0x47')]);_0x4619db[_0x475d('0x48')]=qs[_0x475d('0x49')](_[_0x475d('0x4a')](_0x217650[_0x475d('0x3e')],_0x3ff137[_0x475d('0x49')]));if(_0x217650[_0x475d('0x3e')][_0x475d('0x4b')]){_0x4619db['where']=_['merge'](_0x4619db[_0x475d('0x48')],{'$or':_['map'](_0x4619db[_0x475d('0x3f')],function(_0x2d05c8){var _0x1a7e9a={};_0x1a7e9a[_0x2d05c8]={'$like':'%'+_0x217650[_0x475d('0x3e')][_0x475d('0x4b')]+'%'};return _0x1a7e9a;})});}_0x4619db=_[_0x475d('0x4c')]({},_0x4619db,_0x217650[_0x475d('0x4e')]);return _0x1e145a['getAgents'](_0x4619db);}})['then'](function(_0x3d3e1f){if(_0x3d3e1f){_0x2205dc=_0x3d3e1f['length'];if(!_0x217650[_0x475d('0x3e')]['hasOwnProperty'](_0x475d('0x43'))){_0x4619db['limit']=qs[_0x475d('0x44')](_0x217650[_0x475d('0x3e')][_0x475d('0x44')]);_0x4619db[_0x475d('0x45')]=qs[_0x475d('0x45')](_0x217650[_0x475d('0x3e')][_0x475d('0x45')]);}return _0x1e145a['getAgents'](_0x4619db);}})[_0x475d('0x2c')](function(_0xfd30f1){if(_0xfd30f1){return _0xfd30f1?{'count':_0x2205dc,'rows':_0xfd30f1}:null;}})[_0x475d('0x2c')](respondWithResult(_0x3350f5,null))[_0x475d('0x23')](handleError(_0x3350f5,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c7df5be..196be16 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 _0xfde3=['SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xfde3,0xd7));var _0x3fde=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfde3[_0x413feb];return _0x40ee88;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x3fde('0x0'))['db'][_0x3fde('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3fde('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fde('0x3'),'afterDestroy':_0x3fde('0x4')};function emitEvent(_0x3707be){return function(_0x10ee75,_0x2ae2b7,_0x2e3e19){SmsAccountEvents[_0x3fde('0x5')](_0x3707be+':'+_0x10ee75['id'],_0x10ee75);SmsAccountEvents[_0x3fde('0x5')](_0x3707be,_0x10ee75);_0x2e3e19(null);};}for(var e in events){if(events[_0x3fde('0x6')](e)){var event=events[e];SmsAccount[_0x3fde('0x7')](e,emitEvent(event));}}module[_0x3fde('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x3732=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x3bf957,_0x168c65){var _0x551cc=function(_0x5368e8){while(--_0x5368e8){_0x3bf957['push'](_0x3bf957['shift']());}};_0x551cc(++_0x168c65);}(_0x3732,0x13d));var _0x2373=function(_0x194139,_0x1bcd30){_0x194139=_0x194139-0x0;var _0x2b7aa5=_0x3732[_0x194139];return _0x2b7aa5;};'use strict';var EventEmitter=require(_0x2373('0x0'));var SmsAccount=require(_0x2373('0x1'))['db'][_0x2373('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2373('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2373('0x4'),'afterDestroy':_0x2373('0x5')};function emitEvent(_0xb792a8){return function(_0x4f6b0c,_0x5148b4,_0x51ba4d){SmsAccountEvents[_0x2373('0x6')](_0xb792a8+':'+_0x4f6b0c['id'],_0x4f6b0c);SmsAccountEvents['emit'](_0xb792a8,_0x4f6b0c);_0x51ba4d(null);};}for(var e in events){if(events[_0x2373('0x7')](e)){var event=events[e];SmsAccount[_0x2373('0x8')](e,emitEvent(event));}}module[_0x2373('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5f8606c..63b8e71 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 _0xb871=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts'];(function(_0x90b1b1,_0x3c996d){var _0x2f23dc=function(_0x34646e){while(--_0x34646e){_0x90b1b1['push'](_0x90b1b1['shift']());}};_0x2f23dc(++_0x3c996d);}(_0xb871,0x138));var _0x1b87=function(_0x4f7a97,_0x14f986){_0x4f7a97=_0x4f7a97-0x0;var _0x2d97cb=_0xb871[_0x4f7a97];return _0x2d97cb;};'use strict';var _=require(_0x1b87('0x0'));var util=require(_0x1b87('0x1'));var logger=require(_0x1b87('0x2'))(_0x1b87('0x3'));var moment=require(_0x1b87('0x4'));var BPromise=require(_0x1b87('0x5'));var rp=require(_0x1b87('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b87('0x7'));var config=require(_0x1b87('0x8'));var attributes=require(_0x1b87('0x9'));module[_0x1b87('0xa')]=function(_0x4cd06c,_0x403010){return _0x4cd06c['define']('SmsAccount',attributes,{'tableName':_0x1b87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8963=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define','SmsAccount','sms_accounts'];(function(_0x51dcc7,_0x5f1595){var _0x56067a=function(_0x25a05e){while(--_0x25a05e){_0x51dcc7['push'](_0x51dcc7['shift']());}};_0x56067a(++_0x5f1595);}(_0x8963,0x18c));var _0x3896=function(_0x2b77ce,_0x5e86c5){_0x2b77ce=_0x2b77ce-0x0;var _0x42d280=_0x8963[_0x2b77ce];return _0x42d280;};'use strict';var _=require(_0x3896('0x0'));var util=require(_0x3896('0x1'));var logger=require(_0x3896('0x2'))('api');var moment=require(_0x3896('0x3'));var BPromise=require('bluebird');var rp=require(_0x3896('0x4'));var fs=require('fs');var path=require(_0x3896('0x5'));var rimraf=require(_0x3896('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x3896('0x7')]=function(_0x4a90e5,_0x50d6e2){return _0x4a90e5[_0x3896('0x8')](_0x3896('0x9'),attributes,{'tableName':_0x3896('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 165329d..47e0db1 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 _0xeca9=['socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','then','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost'];(function(_0x4fa4f1,_0x447bce){var _0x49db4e=function(_0x1d2306){while(--_0x1d2306){_0x4fa4f1['push'](_0x4fa4f1['shift']());}};_0x49db4e(++_0x447bce);}(_0xeca9,0x1af));var _0x9eca=function(_0x32c6da,_0x2b1221){_0x32c6da=_0x32c6da-0x0;var _0x19f25a=_0xeca9[_0x32c6da];return _0x19f25a;};'use strict';var _=require(_0x9eca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9eca('0x1'));var rs=require(_0x9eca('0x2'));var fs=require('fs');var Redis=require(_0x9eca('0x3'));var db=require(_0x9eca('0x4'))['db'];var utils=require(_0x9eca('0x5'));var logger=require(_0x9eca('0x6'))(_0x9eca('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9eca('0x8')][_0x9eca('0x9')]({'port':0x232a});config[_0x9eca('0xa')]=_[_0x9eca('0xb')](config['redis'],{'host':_0x9eca('0xc'),'port':0x18eb});var socket=require(_0x9eca('0xd'))(new Redis(config[_0x9eca('0xa')]));require(_0x9eca('0xe'))[_0x9eca('0xf')](socket);function respondWithRpcPromise(_0x1cf824,_0x2f526b,_0x47805a){return new BPromise(function(_0x31dd6f,_0x3894e6){return client[_0x9eca('0x10')](_0x1cf824,_0x47805a)['then'](function(_0x169485){logger[_0x9eca('0x11')](_0x9eca('0x12'),_0x2f526b,_0x9eca('0x13'));logger[_0x9eca('0x14')](_0x9eca('0x15'),_0x2f526b,_0x9eca('0x13'),JSON['stringify'](_0x169485));if(_0x169485['error']){if(_0x169485[_0x9eca('0x16')]['code']===0x1f4){logger[_0x9eca('0x16')](_0x9eca('0x12'),_0x2f526b,_0x169485[_0x9eca('0x16')][_0x9eca('0x17')]);return _0x3894e6(_0x169485['error'][_0x9eca('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x2f526b,_0x169485[_0x9eca('0x16')][_0x9eca('0x17')]);return _0x31dd6f(_0x169485[_0x9eca('0x16')][_0x9eca('0x17')]);}else{logger[_0x9eca('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2f526b,'request\x20sent');_0x31dd6f(_0x169485[_0x9eca('0x18')][_0x9eca('0x17')]);}})[_0x9eca('0x19')](function(_0xe50d34){logger[_0x9eca('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2f526b,_0xe50d34);_0x3894e6(_0xe50d34);});});}exports[_0x9eca('0x1a')]=function(_0x3248f5){var _0x5d091d=this;return new Promise(function(_0x16155a,_0x5626dc){return db[_0x9eca('0x1b')][_0x9eca('0x1c')]({'raw':_0x3248f5[_0x9eca('0x1d')]?_0x3248f5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3248f5[_0x9eca('0x1d')]?_0x3248f5[_0x9eca('0x1d')][_0x9eca('0x1e')]||null:null,'attributes':_0x3248f5['options']?_0x3248f5[_0x9eca('0x1d')][_0x9eca('0x1f')]||null:null,'include':_0x3248f5['options']?_0x3248f5[_0x9eca('0x1d')][_0x9eca('0x20')]?_[_0x9eca('0x21')](_0x3248f5[_0x9eca('0x1d')][_0x9eca('0x20')],function(_0x584459){return{'model':db[_0x584459[_0x9eca('0x22')]],'as':_0x584459['as'],'attributes':_0x584459[_0x9eca('0x1f')],'include':_0x584459[_0x9eca('0x20')]?_[_0x9eca('0x21')](_0x584459[_0x9eca('0x20')],function(_0x36ddd6){return{'model':db[_0x36ddd6['model']],'as':_0x36ddd6['as'],'attributes':_0x36ddd6[_0x9eca('0x1f')],'include':_0x36ddd6['include']?_[_0x9eca('0x21')](_0x36ddd6[_0x9eca('0x20')],function(_0x3fdb43){return{'model':db[_0x3fdb43['model']],'as':_0x3fdb43['as'],'attributes':_0x3fdb43[_0x9eca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9eca('0x23')](function(_0x2554ca){logger[_0x9eca('0x11')](_0x9eca('0x1a'),_0x3248f5);logger[_0x9eca('0x14')](_0x9eca('0x1a'),_0x3248f5,JSON[_0x9eca('0x24')](_0x2554ca));_0x16155a(_0x2554ca);})[_0x9eca('0x19')](function(_0x56e424){logger[_0x9eca('0x16')](_0x9eca('0x1a'),_0x56e424[_0x9eca('0x17')],_0x3248f5);_0x5626dc(_0x5d091d[_0x9eca('0x16')](0x1f4,_0x56e424['message']));});});}; \ No newline at end of file +var _0x4e9a=['redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','model','include','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x355543,_0x2338dd){var _0x468604=function(_0x4498e7){while(--_0x4498e7){_0x355543['push'](_0x355543['shift']());}};_0x468604(++_0x2338dd);}(_0x4e9a,0x12c));var _0xa4e9=function(_0x288b01,_0x21829e){_0x288b01=_0x288b01-0x0;var _0x3a4cc5=_0x4e9a[_0x288b01];return _0x3a4cc5;};'use strict';var _=require(_0xa4e9('0x0'));var util=require(_0xa4e9('0x1'));var moment=require(_0xa4e9('0x2'));var BPromise=require(_0xa4e9('0x3'));var rs=require(_0xa4e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4e9('0x5'))['db'];var utils=require(_0xa4e9('0x6'));var logger=require(_0xa4e9('0x7'))('rpc');var config=require(_0xa4e9('0x8'));var jayson=require(_0xa4e9('0x9'));var client=jayson[_0xa4e9('0xa')][_0xa4e9('0xb')]({'port':0x232a});config[_0xa4e9('0xc')]=_[_0xa4e9('0xd')](config[_0xa4e9('0xc')],{'host':_0xa4e9('0xe'),'port':0x18eb});var socket=require(_0xa4e9('0xf'))(new Redis(config[_0xa4e9('0xc')]));require(_0xa4e9('0x10'))[_0xa4e9('0x11')](socket);function respondWithRpcPromise(_0x259c44,_0x1f7fc8,_0x36c2aa){return new BPromise(function(_0x599845,_0x2a8aa4){return client['request'](_0x259c44,_0x36c2aa)[_0xa4e9('0x12')](function(_0x4778d1){logger[_0xa4e9('0x13')](_0xa4e9('0x14'),_0x1f7fc8,_0xa4e9('0x15'));logger[_0xa4e9('0x16')](_0xa4e9('0x17'),_0x1f7fc8,_0xa4e9('0x15'),JSON[_0xa4e9('0x18')](_0x4778d1));if(_0x4778d1[_0xa4e9('0x19')]){if(_0x4778d1['error'][_0xa4e9('0x1a')]===0x1f4){logger[_0xa4e9('0x19')](_0xa4e9('0x14'),_0x1f7fc8,_0x4778d1[_0xa4e9('0x19')]['message']);return _0x2a8aa4(_0x4778d1[_0xa4e9('0x19')][_0xa4e9('0x1b')]);}logger['error'](_0xa4e9('0x14'),_0x1f7fc8,_0x4778d1[_0xa4e9('0x19')]['message']);return _0x599845(_0x4778d1[_0xa4e9('0x19')]['message']);}else{logger[_0xa4e9('0x13')](_0xa4e9('0x14'),_0x1f7fc8,'request\x20sent');_0x599845(_0x4778d1[_0xa4e9('0x1c')][_0xa4e9('0x1b')]);}})[_0xa4e9('0x1d')](function(_0xeb0bc4){logger[_0xa4e9('0x19')](_0xa4e9('0x14'),_0x1f7fc8,_0xeb0bc4);_0x2a8aa4(_0xeb0bc4);});});}exports[_0xa4e9('0x1e')]=function(_0x13b3c3){var _0x2f9f0d=this;return new Promise(function(_0x202d4d,_0x3e3abf){return db[_0xa4e9('0x1f')]['find']({'raw':_0x13b3c3[_0xa4e9('0x20')]?_0x13b3c3[_0xa4e9('0x20')][_0xa4e9('0x21')]===undefined?!![]:![]:!![],'where':_0x13b3c3[_0xa4e9('0x20')]?_0x13b3c3[_0xa4e9('0x20')][_0xa4e9('0x22')]||null:null,'attributes':_0x13b3c3['options']?_0x13b3c3[_0xa4e9('0x20')][_0xa4e9('0x23')]||null:null,'include':_0x13b3c3[_0xa4e9('0x20')]?_0x13b3c3[_0xa4e9('0x20')]['include']?_['map'](_0x13b3c3[_0xa4e9('0x20')]['include'],function(_0x372685){return{'model':db[_0x372685[_0xa4e9('0x24')]],'as':_0x372685['as'],'attributes':_0x372685[_0xa4e9('0x23')],'include':_0x372685[_0xa4e9('0x25')]?_[_0xa4e9('0x26')](_0x372685['include'],function(_0x367501){return{'model':db[_0x367501[_0xa4e9('0x24')]],'as':_0x367501['as'],'attributes':_0x367501[_0xa4e9('0x23')],'include':_0x367501[_0xa4e9('0x25')]?_[_0xa4e9('0x26')](_0x367501[_0xa4e9('0x25')],function(_0x57f485){return{'model':db[_0x57f485[_0xa4e9('0x24')]],'as':_0x57f485['as'],'attributes':_0x57f485[_0xa4e9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa4e9('0x12')](function(_0x156fce){logger[_0xa4e9('0x13')]('ShowSmsAccount',_0x13b3c3);logger[_0xa4e9('0x16')](_0xa4e9('0x1e'),_0x13b3c3,JSON[_0xa4e9('0x18')](_0x156fce));_0x202d4d(_0x156fce);})[_0xa4e9('0x1d')](function(_0x3fc2f6){logger['error']('ShowSmsAccount',_0x3fc2f6['message'],_0x13b3c3);_0x3e3abf(_0x2f9f0d[_0xa4e9('0x19')](0x1f4,_0x3fc2f6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3825377..1d392dd 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 _0xc90a=['./smsAccount.events','save','remove','update','length','smsAccount:'];(function(_0x29d856,_0x39391f){var _0x380a26=function(_0x300268){while(--_0x300268){_0x29d856['push'](_0x29d856['shift']());}};_0x380a26(++_0x39391f);}(_0xc90a,0x102));var _0xac90=function(_0x3b4670,_0x3b0d40){_0x3b4670=_0x3b4670-0x0;var _0x5443f9=_0xc90a[_0x3b4670];return _0x5443f9;};'use strict';var SmsAccountEvents=require(_0xac90('0x0'));var events=[_0xac90('0x1'),_0xac90('0x2'),_0xac90('0x3')];function createListener(_0x17b10b,_0x3542cd){return function(_0x36cc52){_0x3542cd['emit'](_0x17b10b,_0x36cc52);};}function removeListener(_0x796ee6,_0x57d61f){return function(){SmsAccountEvents['removeListener'](_0x796ee6,_0x57d61f);};}exports['register']=function(_0x3afb5c){for(var _0x53bc4e=0x0,_0x4e1a04=events[_0xac90('0x4')];_0x53bc4e<_0x4e1a04;_0x53bc4e++){var _0x1d2640=events[_0x53bc4e];var _0x4b4361=createListener(_0xac90('0x5')+_0x1d2640,_0x3afb5c);SmsAccountEvents['on'](_0x1d2640,_0x4b4361);}}; \ No newline at end of file +var _0x344f=['./smsAccount.events','save','emit','removeListener','register','length','smsAccount:'];(function(_0x114e2b,_0x31a8ce){var _0x451e69=function(_0x40b954){while(--_0x40b954){_0x114e2b['push'](_0x114e2b['shift']());}};_0x451e69(++_0x31a8ce);}(_0x344f,0x103));var _0xf344=function(_0x4a8006,_0x52a373){_0x4a8006=_0x4a8006-0x0;var _0x5a4eaa=_0x344f[_0x4a8006];return _0x5a4eaa;};'use strict';var SmsAccountEvents=require(_0xf344('0x0'));var events=[_0xf344('0x1'),'remove','update'];function createListener(_0x24c672,_0x2c7eab){return function(_0x42f968){_0x2c7eab[_0xf344('0x2')](_0x24c672,_0x42f968);};}function removeListener(_0xb9a415,_0x4bead9){return function(){SmsAccountEvents[_0xf344('0x3')](_0xb9a415,_0x4bead9);};}exports[_0xf344('0x4')]=function(_0x5c5cdc){for(var _0x195345=0x0,_0x2bad58=events[_0xf344('0x5')];_0x195345<_0x2bad58;_0x195345++){var _0x5790f0=events[_0x195345];var _0x117190=createListener(_0xf344('0x6')+_0x5790f0,_0x5c5cdc);SmsAccountEvents['on'](_0x5790f0,_0x117190);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 3a8bb12..a45bcd6 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 _0x403c=['show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','isAuthenticated','index','/:id'];(function(_0x2714f5,_0x48bb7b){var _0x4e9251=function(_0x9db784){while(--_0x9db784){_0x2714f5['push'](_0x2714f5['shift']());}};_0x4e9251(++_0x48bb7b);}(_0x403c,0xde));var _0xc403=function(_0xbb4597,_0x5a749c){_0xbb4597=_0xbb4597-0x0;var _0xa772d0=_0x403c[_0xbb4597];return _0xa772d0;};'use strict';var multer=require(_0xc403('0x0'));var util=require(_0xc403('0x1'));var path=require(_0xc403('0x2'));var timeout=require(_0xc403('0x3'));var express=require(_0xc403('0x4'));var router=express[_0xc403('0x5')]();var auth=require(_0xc403('0x6'));var interaction=require(_0xc403('0x7'));var config=require('../../config/environment');var controller=require(_0xc403('0x8'));router['get']('/',auth[_0xc403('0x9')](),controller[_0xc403('0xa')]);router['get'](_0xc403('0xb'),auth['isAuthenticated'](),controller[_0xc403('0xc')]);router[_0xc403('0xd')]('/',auth[_0xc403('0x9')](),controller['create']);router[_0xc403('0xe')](_0xc403('0xb'),auth['isAuthenticated'](),controller[_0xc403('0xf')]);router[_0xc403('0x10')](_0xc403('0xb'),auth[_0xc403('0x9')](),controller['destroy']);module[_0xc403('0x11')]=router; \ No newline at end of file +var _0xb12e=['index','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','./smsApplication.controller','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb12e,0xd9));var _0xeb12=function(_0xcc9232,_0x46b955){_0xcc9232=_0xcc9232-0x0;var _0x31aebd=_0xb12e[_0xcc9232];return _0x31aebd;};'use strict';var multer=require(_0xeb12('0x0'));var util=require(_0xeb12('0x1'));var path=require(_0xeb12('0x2'));var timeout=require(_0xeb12('0x3'));var express=require(_0xeb12('0x4'));var router=express['Router']();var auth=require(_0xeb12('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb12('0x6'));router['get']('/',auth[_0xeb12('0x7')](),controller[_0xeb12('0x8')]);router['get'](_0xeb12('0x9'),auth[_0xeb12('0x7')](),controller[_0xeb12('0xa')]);router[_0xeb12('0xb')]('/',auth[_0xeb12('0x7')](),controller['create']);router['put'](_0xeb12('0x9'),auth['isAuthenticated'](),controller[_0xeb12('0xc')]);router[_0xeb12('0xd')](_0xeb12('0x9'),auth[_0xeb12('0x7')](),controller[_0xeb12('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 62cb74c..bab7e3c 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 _0x52e4=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x169594,_0x4b3228){var _0x5022cc=function(_0x467381){while(--_0x467381){_0x169594['push'](_0x169594['shift']());}};_0x5022cc(++_0x4b3228);}(_0x52e4,0xc9));var _0x452e=function(_0x1f2033,_0x4484b8){_0x1f2033=_0x1f2033-0x0;var _0x44f104=_0x52e4[_0x1f2033];return _0x44f104;};'use strict';var Sequelize=require(_0x452e('0x0'));module[_0x452e('0x1')]={'priority':{'type':Sequelize[_0x452e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x452e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x452e('0x3')]},'interval':{'type':Sequelize[_0x452e('0x3')],'defaultValue':_0x452e('0x4')}}; \ No newline at end of file +var _0x2d09=['STRING','*,*,*,*','sequelize','exports','noop','TEXT'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x2d09,0x104));var _0x92d0=function(_0x11a0f7,_0x5dc097){_0x11a0f7=_0x11a0f7-0x0;var _0x304711=_0x2d09[_0x11a0f7];return _0x304711;};'use strict';var Sequelize=require(_0x92d0('0x0'));module[_0x92d0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x92d0('0x2')},'appdata':{'type':Sequelize[_0x92d0('0x3')]()},'description':{'type':Sequelize[_0x92d0('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x92d0('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ce133a6..bc9d6e0 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 _0x0de8=['intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','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/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','map','SmsApplication','fieldName','type','key','model','query','keys'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x0de8,0x1db));var _0x80de=function(_0x597834,_0x159bb6){_0x597834=_0x597834-0x0;var _0x12da6c=_0x0de8[_0x597834];return _0x12da6c;};'use strict';var pdf=require(_0x80de('0x0'));var emlformat=require(_0x80de('0x1'));var rimraf=require(_0x80de('0x2'));var zipdir=require(_0x80de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x80de('0x4'));var Mustache=require(_0x80de('0x5'));var util=require(_0x80de('0x6'));var path=require('path');var sox=require(_0x80de('0x7'));var csv=require(_0x80de('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x80de('0x9'));var squel=require('squel');var crypto=require(_0x80de('0xa'));var jsforce=require(_0x80de('0xb'));var deskjs=require(_0x80de('0xc'));var toCsv=require(_0x80de('0x8'));var querystring=require(_0x80de('0xd'));var Papa=require(_0x80de('0xe'));var Redis=require('ioredis');var authService=require(_0x80de('0xf'));var qs=require(_0x80de('0x10'));var as=require(_0x80de('0x11'));var hardwareService=require(_0x80de('0x12'));var logger=require(_0x80de('0x13'))(_0x80de('0x14'));var utils=require(_0x80de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x80de('0x16'));var db=require(_0x80de('0x17'))['db'];function respondWithStatusCode(_0x4f765a,_0x18c3d1){_0x18c3d1=_0x18c3d1||0xcc;return function(_0x36be7c){if(_0x36be7c){return _0x4f765a['sendStatus'](_0x18c3d1);}return _0x4f765a[_0x80de('0x18')](_0x18c3d1)[_0x80de('0x19')]();};}function respondWithResult(_0x2ce7ac,_0x13cbd0){_0x13cbd0=_0x13cbd0||0xc8;return function(_0x2cbe37){if(_0x2cbe37){return _0x2ce7ac['status'](_0x13cbd0)[_0x80de('0x1a')](_0x2cbe37);}};}function respondWithFilteredResult(_0x14dd0d,_0x442c71){return function(_0x52120f){if(_0x52120f){var _0x5429a1=_0x52120f[_0x80de('0x1b')],_0x266c42=_0x442c71[_0x80de('0x1c')],_0x5d5d89=_0x442c71['offset']+_0x442c71[_0x80de('0x1d')],_0x267db1;if(_0x5d5d89>=_0x5429a1){_0x5d5d89=_0x5429a1;_0x267db1=0xc8;}else{_0x267db1=0xce;}_0x14dd0d['status'](_0x267db1);return _0x14dd0d[_0x80de('0x1e')](_0x80de('0x1f'),_0x266c42+'-'+_0x5d5d89+'/'+_0x5429a1)[_0x80de('0x1a')](_0x52120f);}return null;};}function patchUpdates(_0xbfb5ca){return function(_0x345091){try{jsonpatch[_0x80de('0x20')](_0x345091,_0xbfb5ca,!![]);}catch(_0x1cfa36){return BPromise[_0x80de('0x21')](_0x1cfa36);}return _0x345091[_0x80de('0x22')]();};}function saveUpdates(_0x1e88cc,_0xbab09f){return function(_0x50c4aa){if(_0x50c4aa){return _0x50c4aa[_0x80de('0x23')](_0x1e88cc)['then'](function(_0x474ea5){return _0x474ea5;});}return null;};}function removeEntity(_0x43c67f,_0x58390c){return function(_0x87f4d8){if(_0x87f4d8){return _0x87f4d8[_0x80de('0x24')]()[_0x80de('0x25')](function(){_0x43c67f['status'](0xcc)[_0x80de('0x19')]();});}};}function handleEntityNotFound(_0xeb9284,_0x92c73f){return function(_0x4d0829){if(!_0x4d0829){_0xeb9284[_0x80de('0x26')](0x194);}return _0x4d0829;};}function handleError(_0x3bd2b6,_0x3e0923){_0x3e0923=_0x3e0923||0x1f4;return function(_0x6f10be){logger['error'](_0x6f10be[_0x80de('0x27')]);if(_0x6f10be[_0x80de('0x28')]){delete _0x6f10be[_0x80de('0x28')];}_0x3bd2b6[_0x80de('0x18')](_0x3e0923)['send'](_0x6f10be);};}exports[_0x80de('0x29')]=function(_0x2f6b97,_0xf634e1){var _0x1ec298={},_0x454be8={},_0x383115={'count':0x0,'rows':[]};var _0x4b0092=_[_0x80de('0x2a')](db[_0x80de('0x2b')]['rawAttributes'],function(_0x33bdc5){return{'name':_0x33bdc5[_0x80de('0x2c')],'type':_0x33bdc5[_0x80de('0x2d')][_0x80de('0x2e')]};});_0x454be8[_0x80de('0x2f')]=_['map'](_0x4b0092,_0x80de('0x28'));_0x454be8[_0x80de('0x30')]=_[_0x80de('0x31')](_0x2f6b97[_0x80de('0x30')]);_0x454be8['filters']=_[_0x80de('0x32')](_0x454be8[_0x80de('0x2f')],_0x454be8[_0x80de('0x30')]);_0x1ec298[_0x80de('0x33')]=_[_0x80de('0x32')](_0x454be8[_0x80de('0x2f')],qs[_0x80de('0x34')](_0x2f6b97[_0x80de('0x30')][_0x80de('0x34')]));_0x1ec298[_0x80de('0x33')]=_0x1ec298['attributes'][_0x80de('0x35')]?_0x1ec298[_0x80de('0x33')]:_0x454be8['model'];if(!_0x2f6b97[_0x80de('0x30')]['hasOwnProperty'](_0x80de('0x36'))){_0x1ec298['limit']=qs['limit'](_0x2f6b97[_0x80de('0x30')][_0x80de('0x1d')]);_0x1ec298[_0x80de('0x1c')]=qs[_0x80de('0x1c')](_0x2f6b97[_0x80de('0x30')][_0x80de('0x1c')]);}_0x1ec298[_0x80de('0x37')]=qs[_0x80de('0x38')](_0x2f6b97['query'][_0x80de('0x38')]);_0x1ec298[_0x80de('0x39')]=qs[_0x80de('0x3a')](_[_0x80de('0x3b')](_0x2f6b97[_0x80de('0x30')],_0x454be8['filters']),_0x4b0092);if(_0x2f6b97[_0x80de('0x30')][_0x80de('0x3c')]){_0x1ec298[_0x80de('0x39')]=_[_0x80de('0x3d')](_0x1ec298[_0x80de('0x39')],{'$or':_['map'](_0x4b0092,function(_0x6b1db5){if(_0x6b1db5['type']!==_0x80de('0x3e')){var _0x45ef77={};_0x45ef77[_0x6b1db5[_0x80de('0x28')]]={'$like':'%'+_0x2f6b97[_0x80de('0x30')][_0x80de('0x3c')]+'%'};return _0x45ef77;}})});}_0x1ec298=_[_0x80de('0x3d')]({},_0x1ec298,_0x2f6b97[_0x80de('0x3f')]);var _0x3d4ea6={'where':_0x1ec298[_0x80de('0x39')]};return db['SmsApplication'][_0x80de('0x1b')](_0x3d4ea6)[_0x80de('0x25')](function(_0x8c4a0d){_0x383115[_0x80de('0x1b')]=_0x8c4a0d;if(_0x2f6b97[_0x80de('0x30')][_0x80de('0x40')]){_0x1ec298[_0x80de('0x41')]=[{'all':!![]}];}return db[_0x80de('0x2b')][_0x80de('0x42')](_0x1ec298);})[_0x80de('0x25')](function(_0x336f41){_0x383115[_0x80de('0x43')]=_0x336f41;return _0x383115;})[_0x80de('0x25')](respondWithFilteredResult(_0xf634e1,_0x1ec298))[_0x80de('0x44')](handleError(_0xf634e1,null));};exports[_0x80de('0x45')]=function(_0x36c6f2,_0x20f67d){var _0x46ddbc={'raw':!![],'where':{'id':_0x36c6f2[_0x80de('0x46')]['id']}},_0x53e550={};_0x53e550[_0x80de('0x2f')]=_[_0x80de('0x31')](db[_0x80de('0x2b')][_0x80de('0x47')]);_0x53e550[_0x80de('0x30')]=_[_0x80de('0x31')](_0x36c6f2[_0x80de('0x30')]);_0x53e550['filters']=_[_0x80de('0x32')](_0x53e550[_0x80de('0x2f')],_0x53e550[_0x80de('0x30')]);_0x46ddbc['attributes']=_[_0x80de('0x32')](_0x53e550[_0x80de('0x2f')],qs[_0x80de('0x34')](_0x36c6f2['query'][_0x80de('0x34')]));_0x46ddbc['attributes']=_0x46ddbc['attributes']['length']?_0x46ddbc['attributes']:_0x53e550[_0x80de('0x2f')];if(_0x36c6f2['query'][_0x80de('0x40')]){_0x46ddbc[_0x80de('0x41')]=[{'all':!![]}];}_0x46ddbc=_[_0x80de('0x3d')]({},_0x46ddbc,_0x36c6f2[_0x80de('0x3f')]);return db[_0x80de('0x2b')][_0x80de('0x48')](_0x46ddbc)['then'](handleEntityNotFound(_0x20f67d,null))[_0x80de('0x25')](respondWithResult(_0x20f67d,null))[_0x80de('0x44')](handleError(_0x20f67d,null));};exports['create']=function(_0x354de1,_0xe68412){return db[_0x80de('0x2b')][_0x80de('0x49')](_0x354de1[_0x80de('0x4a')],{})[_0x80de('0x25')](respondWithResult(_0xe68412,0xc9))[_0x80de('0x44')](handleError(_0xe68412,null));};exports['update']=function(_0x262856,_0xc2014b){if(_0x262856[_0x80de('0x4a')]['id']){delete _0x262856['body']['id'];}return db[_0x80de('0x2b')][_0x80de('0x48')]({'where':{'id':_0x262856['params']['id']}})[_0x80de('0x25')](handleEntityNotFound(_0xc2014b,null))[_0x80de('0x25')](saveUpdates(_0x262856[_0x80de('0x4a')],null))[_0x80de('0x25')](respondWithResult(_0xc2014b,null))['catch'](handleError(_0xc2014b,null));};exports[_0x80de('0x24')]=function(_0x37e2d5,_0xd15020){return db[_0x80de('0x2b')]['find']({'where':{'id':_0x37e2d5['params']['id']}})[_0x80de('0x25')](handleEntityNotFound(_0xd15020,null))[_0x80de('0x25')](removeEntity(_0xd15020,null))[_0x80de('0x44')](handleError(_0xd15020,null));}; \ No newline at end of file +var _0x88e8=['mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','then','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','filters','pick','filter','options','where','count','includeAll','findAll','catch','show','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x39cbf1,_0x5a2bf7){var _0x109774=function(_0xafcf87){while(--_0xafcf87){_0x39cbf1['push'](_0x39cbf1['shift']());}};_0x109774(++_0x5a2bf7);}(_0x88e8,0xcf));var _0x888e=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x88e8[_0x2ca616];return _0x53155f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x888e('0x0'));var rimraf=require(_0x888e('0x1'));var zipdir=require(_0x888e('0x2'));var jsonpatch=require(_0x888e('0x3'));var rp=require(_0x888e('0x4'));var moment=require(_0x888e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x888e('0x6'));var util=require('util');var path=require(_0x888e('0x7'));var sox=require(_0x888e('0x8'));var csv=require(_0x888e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x888e('0xa'));var crypto=require(_0x888e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x888e('0xc'));var toCsv=require(_0x888e('0x9'));var querystring=require(_0x888e('0xd'));var Papa=require(_0x888e('0xe'));var Redis=require('ioredis');var authService=require(_0x888e('0xf'));var qs=require(_0x888e('0x10'));var as=require(_0x888e('0x11'));var hardwareService=require(_0x888e('0x12'));var logger=require(_0x888e('0x13'))(_0x888e('0x14'));var utils=require(_0x888e('0x15'));var config=require(_0x888e('0x16'));var licenseUtil=require(_0x888e('0x17'));var db=require(_0x888e('0x18'))['db'];function respondWithStatusCode(_0x3f4e25,_0x1dff8e){_0x1dff8e=_0x1dff8e||0xcc;return function(_0x301e8e){if(_0x301e8e){return _0x3f4e25[_0x888e('0x19')](_0x1dff8e);}return _0x3f4e25[_0x888e('0x1a')](_0x1dff8e)[_0x888e('0x1b')]();};}function respondWithResult(_0x4d3acc,_0x501387){_0x501387=_0x501387||0xc8;return function(_0x1e6a5e){if(_0x1e6a5e){return _0x4d3acc['status'](_0x501387)[_0x888e('0x1c')](_0x1e6a5e);}};}function respondWithFilteredResult(_0xf1e4b5,_0x36604c){return function(_0x25bd24){if(_0x25bd24){var _0x121811=_0x25bd24['count'],_0x53e409=_0x36604c[_0x888e('0x1d')],_0x3b18ba=_0x36604c['offset']+_0x36604c['limit'],_0x34e629;if(_0x3b18ba>=_0x121811){_0x3b18ba=_0x121811;_0x34e629=0xc8;}else{_0x34e629=0xce;}_0xf1e4b5[_0x888e('0x1a')](_0x34e629);return _0xf1e4b5[_0x888e('0x1e')](_0x888e('0x1f'),_0x53e409+'-'+_0x3b18ba+'/'+_0x121811)[_0x888e('0x1c')](_0x25bd24);}return null;};}function patchUpdates(_0xc7b161){return function(_0x18d392){try{jsonpatch[_0x888e('0x20')](_0x18d392,_0xc7b161,!![]);}catch(_0x25f7e4){return BPromise[_0x888e('0x21')](_0x25f7e4);}return _0x18d392[_0x888e('0x22')]();};}function saveUpdates(_0x53422f,_0x3d0976){return function(_0x434f57){if(_0x434f57){return _0x434f57['update'](_0x53422f)['then'](function(_0x278968){return _0x278968;});}return null;};}function removeEntity(_0xc0642,_0x29ee92){return function(_0x204bfa){if(_0x204bfa){return _0x204bfa[_0x888e('0x23')]()[_0x888e('0x24')](function(){_0xc0642[_0x888e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d7c9,_0x349456){return function(_0x53a45c){if(!_0x53a45c){_0x23d7c9['sendStatus'](0x194);}return _0x53a45c;};}function handleError(_0xa53fd7,_0x3841ef){_0x3841ef=_0x3841ef||0x1f4;return function(_0x3c4e0e){logger['error'](_0x3c4e0e['stack']);if(_0x3c4e0e[_0x888e('0x25')]){delete _0x3c4e0e[_0x888e('0x25')];}_0xa53fd7[_0x888e('0x1a')](_0x3841ef)[_0x888e('0x26')](_0x3c4e0e);};}exports[_0x888e('0x27')]=function(_0x58348d,_0x148cb5){var _0x27bd62={},_0x3d3290={},_0x56716c={'count':0x0,'rows':[]};var _0x2b22e0=_[_0x888e('0x28')](db[_0x888e('0x29')][_0x888e('0x2a')],function(_0x2a05e8){return{'name':_0x2a05e8[_0x888e('0x2b')],'type':_0x2a05e8[_0x888e('0x2c')][_0x888e('0x2d')]};});_0x3d3290[_0x888e('0x2e')]=_[_0x888e('0x28')](_0x2b22e0,_0x888e('0x25'));_0x3d3290['query']=_[_0x888e('0x2f')](_0x58348d['query']);_0x3d3290['filters']=_[_0x888e('0x30')](_0x3d3290['model'],_0x3d3290[_0x888e('0x31')]);_0x27bd62[_0x888e('0x32')]=_[_0x888e('0x30')](_0x3d3290[_0x888e('0x2e')],qs[_0x888e('0x33')](_0x58348d['query']['fields']));_0x27bd62[_0x888e('0x32')]=_0x27bd62[_0x888e('0x32')][_0x888e('0x34')]?_0x27bd62[_0x888e('0x32')]:_0x3d3290[_0x888e('0x2e')];if(!_0x58348d['query'][_0x888e('0x35')]('nolimit')){_0x27bd62['limit']=qs['limit'](_0x58348d['query'][_0x888e('0x36')]);_0x27bd62[_0x888e('0x1d')]=qs[_0x888e('0x1d')](_0x58348d[_0x888e('0x31')][_0x888e('0x1d')]);}_0x27bd62[_0x888e('0x37')]=qs['sort'](_0x58348d[_0x888e('0x31')]['sort']);_0x27bd62['where']=qs[_0x888e('0x38')](_[_0x888e('0x39')](_0x58348d[_0x888e('0x31')],_0x3d3290[_0x888e('0x38')]),_0x2b22e0);if(_0x58348d['query'][_0x888e('0x3a')]){_0x27bd62['where']=_['merge'](_0x27bd62['where'],{'$or':_['map'](_0x2b22e0,function(_0x2adc6b){if(_0x2adc6b['type']!=='VIRTUAL'){var _0x54f59c={};_0x54f59c[_0x2adc6b[_0x888e('0x25')]]={'$like':'%'+_0x58348d[_0x888e('0x31')]['filter']+'%'};return _0x54f59c;}})});}_0x27bd62=_['merge']({},_0x27bd62,_0x58348d[_0x888e('0x3b')]);var _0x45f9b8={'where':_0x27bd62[_0x888e('0x3c')]};return db[_0x888e('0x29')][_0x888e('0x3d')](_0x45f9b8)[_0x888e('0x24')](function(_0x1eae79){_0x56716c[_0x888e('0x3d')]=_0x1eae79;if(_0x58348d[_0x888e('0x31')][_0x888e('0x3e')]){_0x27bd62['include']=[{'all':!![]}];}return db[_0x888e('0x29')][_0x888e('0x3f')](_0x27bd62);})[_0x888e('0x24')](function(_0x107ee9){_0x56716c['rows']=_0x107ee9;return _0x56716c;})[_0x888e('0x24')](respondWithFilteredResult(_0x148cb5,_0x27bd62))[_0x888e('0x40')](handleError(_0x148cb5,null));};exports[_0x888e('0x41')]=function(_0x3eaeef,_0x412d54){var _0x4d7f5a={'raw':!![],'where':{'id':_0x3eaeef[_0x888e('0x42')]['id']}},_0x39ea28={};_0x39ea28[_0x888e('0x2e')]=_[_0x888e('0x2f')](db[_0x888e('0x29')]['rawAttributes']);_0x39ea28[_0x888e('0x31')]=_['keys'](_0x3eaeef[_0x888e('0x31')]);_0x39ea28['filters']=_[_0x888e('0x30')](_0x39ea28[_0x888e('0x2e')],_0x39ea28['query']);_0x4d7f5a['attributes']=_['intersection'](_0x39ea28[_0x888e('0x2e')],qs[_0x888e('0x33')](_0x3eaeef[_0x888e('0x31')][_0x888e('0x33')]));_0x4d7f5a[_0x888e('0x32')]=_0x4d7f5a[_0x888e('0x32')]['length']?_0x4d7f5a[_0x888e('0x32')]:_0x39ea28[_0x888e('0x2e')];if(_0x3eaeef[_0x888e('0x31')]['includeAll']){_0x4d7f5a['include']=[{'all':!![]}];}_0x4d7f5a=_[_0x888e('0x43')]({},_0x4d7f5a,_0x3eaeef[_0x888e('0x3b')]);return db[_0x888e('0x29')][_0x888e('0x44')](_0x4d7f5a)[_0x888e('0x24')](handleEntityNotFound(_0x412d54,null))[_0x888e('0x24')](respondWithResult(_0x412d54,null))[_0x888e('0x40')](handleError(_0x412d54,null));};exports[_0x888e('0x45')]=function(_0x4bd6a,_0x2b7701){return db[_0x888e('0x29')][_0x888e('0x45')](_0x4bd6a[_0x888e('0x46')],{})[_0x888e('0x24')](respondWithResult(_0x2b7701,0xc9))['catch'](handleError(_0x2b7701,null));};exports['update']=function(_0x5de1ec,_0x1475a3){if(_0x5de1ec['body']['id']){delete _0x5de1ec[_0x888e('0x46')]['id'];}return db[_0x888e('0x29')][_0x888e('0x44')]({'where':{'id':_0x5de1ec[_0x888e('0x42')]['id']}})[_0x888e('0x24')](handleEntityNotFound(_0x1475a3,null))['then'](saveUpdates(_0x5de1ec['body'],null))[_0x888e('0x24')](respondWithResult(_0x1475a3,null))[_0x888e('0x40')](handleError(_0x1475a3,null));};exports[_0x888e('0x23')]=function(_0x409f06,_0x513344){return db[_0x888e('0x29')][_0x888e('0x44')]({'where':{'id':_0x409f06['params']['id']}})[_0x888e('0x24')](handleEntityNotFound(_0x513344,null))[_0x888e('0x24')](removeEntity(_0x513344,null))['catch'](handleError(_0x513344,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c17ec55..753f2cf 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 _0x45b7=['sms_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x38914a,_0xa01624){var _0x3b1813=function(_0x45a7dc){while(--_0x45a7dc){_0x38914a['push'](_0x38914a['shift']());}};_0x3b1813(++_0xa01624);}(_0x45b7,0x11f));var _0x745b=function(_0x51a95a,_0xbea60b){_0x51a95a=_0x51a95a-0x0;var _0xf9eb6c=_0x45b7[_0x51a95a];return _0xf9eb6c;};'use strict';var _=require(_0x745b('0x0'));var util=require(_0x745b('0x1'));var logger=require('../../config/logger')(_0x745b('0x2'));var moment=require(_0x745b('0x3'));var BPromise=require(_0x745b('0x4'));var rp=require(_0x745b('0x5'));var fs=require('fs');var path=require(_0x745b('0x6'));var rimraf=require(_0x745b('0x7'));var config=require(_0x745b('0x8'));var attributes=require(_0x745b('0x9'));module[_0x745b('0xa')]=function(_0xc75ce8,_0x42f923){return _0xc75ce8[_0x745b('0xb')](_0x745b('0xc'),attributes,{'tableName':_0x745b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x745b('0xe')});}; \ No newline at end of file +var _0x0dac=['bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x209581,_0x11f596){var _0x2fed45=function(_0x3daabd){while(--_0x3daabd){_0x209581['push'](_0x209581['shift']());}};_0x2fed45(++_0x11f596);}(_0x0dac,0x191));var _0xc0da=function(_0x3ee127,_0x31ebeb){_0x3ee127=_0x3ee127-0x0;var _0x513162=_0x0dac[_0x3ee127];return _0x513162;};'use strict';var _=require(_0xc0da('0x0'));var util=require('util');var logger=require(_0xc0da('0x1'))(_0xc0da('0x2'));var moment=require(_0xc0da('0x3'));var BPromise=require(_0xc0da('0x4'));var rp=require(_0xc0da('0x5'));var fs=require('fs');var path=require(_0xc0da('0x6'));var rimraf=require('rimraf');var config=require(_0xc0da('0x7'));var attributes=require(_0xc0da('0x8'));module[_0xc0da('0x9')]=function(_0x6f867b,_0x52f343){return _0x6f867b[_0xc0da('0xa')](_0xc0da('0xb'),attributes,{'tableName':_0xc0da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0da('0xd'),'collate':_0xc0da('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 774e4fc..b4c429c 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 _0x1793=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1793,0x1ce));var _0x3179=function(_0x9d9343,_0x494c83){_0x9d9343=_0x9d9343-0x0;var _0x2abcd2=_0x1793[_0x9d9343];return _0x2abcd2;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var moment=require(_0x3179('0x2'));var BPromise=require(_0x3179('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3179('0x4'));var db=require(_0x3179('0x5'))['db'];var utils=require(_0x3179('0x6'));var logger=require(_0x3179('0x7'))(_0x3179('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3179('0x9')][_0x3179('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52ff5c,_0x4e43f3,_0x446329){return new BPromise(function(_0x160208,_0x23d2ee){return client['request'](_0x52ff5c,_0x446329)[_0x3179('0xb')](function(_0x433f39){logger['info']('SmsApplication,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));logger[_0x3179('0xd')](_0x3179('0xe'),_0x4e43f3,'request\x20sent',JSON[_0x3179('0xf')](_0x433f39));if(_0x433f39[_0x3179('0x10')]){if(_0x433f39[_0x3179('0x10')][_0x3179('0x11')]===0x1f4){logger['error'](_0x3179('0x12'),_0x4e43f3,_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);return _0x23d2ee(_0x433f39['error']['message']);}logger[_0x3179('0x10')](_0x3179('0x12'),_0x4e43f3,_0x433f39['error']['message']);return _0x160208(_0x433f39[_0x3179('0x10')][_0x3179('0x13')]);}else{logger[_0x3179('0x14')]('SmsApplication,\x20%s,\x20%s',_0x4e43f3,_0x3179('0xc'));_0x160208(_0x433f39[_0x3179('0x15')][_0x3179('0x13')]);}})[_0x3179('0x16')](function(_0x24451a){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4e43f3,_0x24451a);_0x23d2ee(_0x24451a);});});} \ No newline at end of file +var _0x9b69=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0xeaf92d,_0x26a3bf){var _0x573a6a=function(_0x3214f1){while(--_0x3214f1){_0xeaf92d['push'](_0xeaf92d['shift']());}};_0x573a6a(++_0x26a3bf);}(_0x9b69,0xa3));var _0x99b6=function(_0x2aa250,_0x400316){_0x2aa250=_0x2aa250-0x0;var _0x4ab9e7=_0x9b69[_0x2aa250];return _0x4ab9e7;};'use strict';var _=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var moment=require(_0x99b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b6('0x4'));var logger=require(_0x99b6('0x5'))(_0x99b6('0x6'));var config=require('../../config/environment');var jayson=require(_0x99b6('0x7'));var client=jayson['client'][_0x99b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x319215,_0x3d96ae,_0x18647f){return new BPromise(function(_0x29155e,_0x1d188d){return client[_0x99b6('0x9')](_0x319215,_0x18647f)[_0x99b6('0xa')](function(_0x1e8826){logger[_0x99b6('0xb')](_0x99b6('0xc'),_0x3d96ae,_0x99b6('0xd'));logger[_0x99b6('0xe')](_0x99b6('0xf'),_0x3d96ae,_0x99b6('0xd'),JSON[_0x99b6('0x10')](_0x1e8826));if(_0x1e8826[_0x99b6('0x11')]){if(_0x1e8826[_0x99b6('0x11')][_0x99b6('0x12')]===0x1f4){logger[_0x99b6('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3d96ae,_0x1e8826['error']['message']);return _0x1d188d(_0x1e8826['error']['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x3d96ae,_0x1e8826[_0x99b6('0x11')][_0x99b6('0x13')]);return _0x29155e(_0x1e8826[_0x99b6('0x11')]['message']);}else{logger[_0x99b6('0xb')](_0x99b6('0xc'),_0x3d96ae,_0x99b6('0xd'));_0x29155e(_0x1e8826[_0x99b6('0x14')]['message']);}})[_0x99b6('0x15')](function(_0x52a4da){logger[_0x99b6('0x11')](_0x99b6('0xc'),_0x3d96ae,_0x52a4da);_0x1d188d(_0x52a4da);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6ebaa7a..9b4b85f 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 _0x44b3=['index','/:id','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44b3,0xb4));var _0x344b=function(_0x5b3ea6,_0x28e1ac){_0x5b3ea6=_0x5b3ea6-0x0;var _0x29a08a=_0x44b3[_0x5b3ea6];return _0x29a08a;};'use strict';var multer=require('multer');var util=require(_0x344b('0x0'));var path=require(_0x344b('0x1'));var timeout=require(_0x344b('0x2'));var express=require(_0x344b('0x3'));var router=express[_0x344b('0x4')]();var auth=require(_0x344b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x344b('0x6'));router[_0x344b('0x7')]('/',auth[_0x344b('0x8')](),controller[_0x344b('0x9')]);router['get']('/describe',auth[_0x344b('0x8')](),controller['describe']);router[_0x344b('0x7')](_0x344b('0xa'),auth[_0x344b('0x8')](),controller['show']);router[_0x344b('0x7')](_0x344b('0xb'),auth[_0x344b('0x8')](),controller['getMessages']);router[_0x344b('0x7')]('/:id/download',auth[_0x344b('0x8')](),controller[_0x344b('0xc')]);router[_0x344b('0xd')]('/',auth['isAuthenticated'](),controller[_0x344b('0xe')]);router[_0x344b('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0x344b('0xf')]);router['post'](_0x344b('0x10'),auth[_0x344b('0x8')](),interaction[_0x344b('0x11')](_0x344b('0x12'),_0x344b('0x13')),controller[_0x344b('0x14')]);router['put'](_0x344b('0xa'),auth[_0x344b('0x8')](),interaction[_0x344b('0x11')](_0x344b('0x12'),_0x344b('0x15')),controller[_0x344b('0x16')]);router[_0x344b('0x17')](_0x344b('0xa'),auth[_0x344b('0x8')](),interaction['tracked'](_0x344b('0x12'),'smsinteraction:destroy'),controller[_0x344b('0x18')]);router[_0x344b('0x17')](_0x344b('0x10'),auth[_0x344b('0x8')](),controller[_0x344b('0x19')]);module[_0x344b('0x1a')]=router; \ No newline at end of file +var _0xa2da=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x356b38,_0x4e099e){var _0x1c79cb=function(_0x43705a){while(--_0x43705a){_0x356b38['push'](_0x356b38['shift']());}};_0x1c79cb(++_0x4e099e);}(_0xa2da,0x7d));var _0xaa2d=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0xa2da[_0x4e21ba];return _0x55b94b;};'use strict';var multer=require('multer');var util=require(_0xaa2d('0x0'));var path=require(_0xaa2d('0x1'));var timeout=require(_0xaa2d('0x2'));var express=require(_0xaa2d('0x3'));var router=express[_0xaa2d('0x4')]();var auth=require(_0xaa2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa2d('0x6'));var controller=require('./smsInteraction.controller');router[_0xaa2d('0x7')]('/',auth[_0xaa2d('0x8')](),controller[_0xaa2d('0x9')]);router[_0xaa2d('0x7')](_0xaa2d('0xa'),auth[_0xaa2d('0x8')](),controller[_0xaa2d('0xb')]);router[_0xaa2d('0x7')]('/:id',auth[_0xaa2d('0x8')](),controller[_0xaa2d('0xc')]);router[_0xaa2d('0x7')]('/:id/messages',auth[_0xaa2d('0x8')](),controller['getMessages']);router[_0xaa2d('0x7')](_0xaa2d('0xd'),auth['isAuthenticated'](),controller[_0xaa2d('0xe')]);router[_0xaa2d('0xf')]('/',auth[_0xaa2d('0x8')](),controller['create']);router['post'](_0xaa2d('0x10'),auth[_0xaa2d('0x8')](),controller[_0xaa2d('0x11')]);router[_0xaa2d('0xf')](_0xaa2d('0x12'),auth[_0xaa2d('0x8')](),interaction[_0xaa2d('0x13')](_0xaa2d('0x14'),_0xaa2d('0x15')),controller['addTags']);router[_0xaa2d('0x16')](_0xaa2d('0x17'),auth[_0xaa2d('0x8')](),interaction['tracked'](_0xaa2d('0x14'),_0xaa2d('0x18')),controller[_0xaa2d('0x19')]);router[_0xaa2d('0x1a')](_0xaa2d('0x17'),auth['isAuthenticated'](),interaction[_0xaa2d('0x13')](_0xaa2d('0x14'),_0xaa2d('0x1b')),controller[_0xaa2d('0x1c')]);router[_0xaa2d('0x1a')]('/:id/tags',auth[_0xaa2d('0x8')](),controller[_0xaa2d('0x1d')]);module[_0xaa2d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c6667bc..3aa16ab 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 _0xbc13=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbc13,0x6e));var _0x3bc1=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xbc13[_0x4178af];return _0x20f4b1;};'use strict';var Sequelize=require(_0x3bc1('0x0'));var moment=require('moment');module[_0x3bc1('0x1')]={'closed':{'type':Sequelize[_0x3bc1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3bc1('0x3')]},'disposition':{'type':Sequelize[_0x3bc1('0x4')]},'secondDisposition':{'type':Sequelize[_0x3bc1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3bc1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3bc1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3bc1('0x5')]('in',_0x3bc1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3bc1('0x5')]('in',_0x3bc1('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x07ac=['ENUM','sequelize','exports','DATE','STRING'];(function(_0x398492,_0x2eef9a){var _0x256444=function(_0x597dca){while(--_0x597dca){_0x398492['push'](_0x398492['shift']());}};_0x256444(++_0x2eef9a);}(_0x07ac,0xf1));var _0xc07a=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x07ac[_0x4191bc];return _0x1ffd4e;};'use strict';var Sequelize=require(_0xc07a('0x0'));var moment=require('moment');module[_0xc07a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc07a('0x2')]},'disposition':{'type':Sequelize[_0xc07a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc07a('0x3')]},'note':{'type':Sequelize[_0xc07a('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc07a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc07a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc07a('0x4')]('in','out'),'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 1e14fd1..f8e2bee 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}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 updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}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 updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 51d0244..81e848a 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 _0x02a7=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02a7,0x7a));var _0x702a=function(_0x41d451,_0x36e3f7){_0x41d451=_0x41d451-0x0;var _0x5d988f=_0x02a7[_0x41d451];return _0x5d988f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x702a('0x0'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x702a('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x702a('0x2')](0x0);var events={'afterCreate':_0x702a('0x3'),'afterUpdate':_0x702a('0x4'),'afterDestroy':_0x702a('0x5')};function emitEvent(_0x1fc26b){return function(_0x3fb65a,_0x4a1d02,_0x1bcfe5){_0x3fb65a['getUsers']({'attributes':['id'],'raw':!![]})[_0x702a('0x6')](function(_0x1aa2c2){_0x3fb65a[_0x702a('0x7')](_0x702a('0x8'),_0x1aa2c2[_0x702a('0x9')](function(_0x20c009){return{'id':_0x20c009['id']};}));return SmsMessage[_0x702a('0xa')]({'where':{'SmsInteractionId':_0x3fb65a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x15acfb){_0x3fb65a['setDataValue']('unreadMessages',_0x15acfb[_0x702a('0xb')]);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b+':'+_0x3fb65a['id'],_0x3fb65a);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b,_0x3fb65a);_0x1bcfe5(null);})[_0x702a('0xd')](_0x1bcfe5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x702a('0xe')](e,emitEvent(event));}}module[_0x702a('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x5c12=['save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c12,0x188));var _0x25c1=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0x5c12[_0xa041de];return _0x1d654c;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x25c1('0x0'))['db'][_0x25c1('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x25c1('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x25c1('0x3')](0x0);var events={'afterCreate':_0x25c1('0x4'),'afterUpdate':_0x25c1('0x5'),'afterDestroy':_0x25c1('0x6')};function emitEvent(_0x21ec20){return function(_0x3f0f35,_0x5d1516,_0x204287){_0x3f0f35[_0x25c1('0x7')]({'attributes':['id'],'raw':!![]})[_0x25c1('0x8')](function(_0x4ab674){_0x3f0f35['setDataValue'](_0x25c1('0x9'),_0x4ab674[_0x25c1('0xa')](function(_0x449014){return{'id':_0x449014['id']};}));return SmsMessage[_0x25c1('0xb')]({'where':{'SmsInteractionId':_0x3f0f35['id'],'direction':'in','read':![]},'raw':!![]});})[_0x25c1('0x8')](function(_0x588f30){_0x3f0f35[_0x25c1('0xc')](_0x25c1('0xd'),_0x588f30[_0x25c1('0xe')]);SmsInteractionEvents[_0x25c1('0xf')](_0x21ec20+':'+_0x3f0f35['id'],_0x3f0f35);SmsInteractionEvents[_0x25c1('0xf')](_0x21ec20,_0x3f0f35);_0x204287(null);})['catch'](_0x204287(null));};}for(var e in events){if(events[_0x25c1('0x10')](e)){var event=events[e];SmsInteraction[_0x25c1('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a497060..baaeaa7 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 _0x4d1a=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format'];(function(_0x1327f7,_0x574202){var _0xa7a00c=function(_0x4cfe0b){while(--_0x4cfe0b){_0x1327f7['push'](_0x1327f7['shift']());}};_0xa7a00c(++_0x574202);}(_0x4d1a,0x100));var _0xa4d1=function(_0x4a4b1c,_0x5d0641){_0x4a4b1c=_0x4a4b1c-0x0;var _0xe80092=_0x4d1a[_0x4a4b1c];return _0xe80092;};'use strict';var _=require(_0xa4d1('0x0'));var util=require('util');var logger=require(_0xa4d1('0x1'))(_0xa4d1('0x2'));var moment=require(_0xa4d1('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4d1('0x4'));var fs=require('fs');var path=require(_0xa4d1('0x5'));var rimraf=require(_0xa4d1('0x6'));var config=require(_0xa4d1('0x7'));var attributes=require(_0xa4d1('0x8'));module[_0xa4d1('0x9')]=function(_0x3c1403,_0x3908de){return _0x3c1403[_0xa4d1('0xa')]('SmsInteraction',attributes,{'tableName':_0xa4d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xff67ff,_0x5f4319,_0x23e72a){if(_0xff67ff[_0xa4d1('0xc')](_0xa4d1('0xd'))){_0xff67ff[_0xa4d1('0xe')]=moment()[_0xa4d1('0xf')](_0xa4d1('0x10'));}_0x23e72a(null,_0xff67ff);}}});}; \ No newline at end of file +var _0x3834=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18c79d,_0x1883fa){var _0x3fbe7e=function(_0x394eb0){while(--_0x394eb0){_0x18c79d['push'](_0x18c79d['shift']());}};_0x3fbe7e(++_0x1883fa);}(_0x3834,0x71));var _0x4383=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3834[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4383('0x0'));var moment=require(_0x4383('0x1'));var BPromise=require(_0x4383('0x2'));var rp=require(_0x4383('0x3'));var fs=require('fs');var path=require(_0x4383('0x4'));var rimraf=require(_0x4383('0x5'));var config=require(_0x4383('0x6'));var attributes=require(_0x4383('0x7'));module['exports']=function(_0x30eee5,_0x46fcb7){return _0x30eee5[_0x4383('0x8')](_0x4383('0x9'),attributes,{'tableName':_0x4383('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b6251,_0x359dbc,_0x23fecd){if(_0x3b6251['changed'](_0x4383('0xb'))){_0x3b6251[_0x4383('0xc')]=moment()[_0x4383('0xd')](_0x4383('0xe'));}_0x23fecd(null,_0x3b6251);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index add75b1..56ea940 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 _0x0606=['AddTagsToSmsInteraction','find','where','addTags','body','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SmsInteraction','update','options','raw','debug','UpdateSmsInteraction','stringify'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x0606,0xcb));var _0x6060=function(_0x2468c2,_0x4bbde4){_0x2468c2=_0x2468c2-0x0;var _0x269141=_0x0606[_0x2468c2];return _0x269141;};'use strict';var _=require('lodash');var util=require(_0x6060('0x0'));var moment=require(_0x6060('0x1'));var BPromise=require(_0x6060('0x2'));var rs=require(_0x6060('0x3'));var fs=require('fs');var Redis=require(_0x6060('0x4'));var db=require(_0x6060('0x5'))['db'];var utils=require(_0x6060('0x6'));var logger=require(_0x6060('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6060('0x8')][_0x6060('0x9')]({'port':0x232a});config[_0x6060('0xa')]=_[_0x6060('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6060('0xa')]));require('./smsInteraction.socket')[_0x6060('0xc')](socket);function respondWithRpcPromise(_0x5d9849,_0x354eab,_0x333c10){return new BPromise(function(_0x23f565,_0x363667){return client[_0x6060('0xd')](_0x5d9849,_0x333c10)[_0x6060('0xe')](function(_0x41b04a){logger['info'](_0x6060('0xf'),_0x354eab,_0x6060('0x10'));logger['debug'](_0x6060('0x11'),_0x354eab,_0x6060('0x10'),JSON['stringify'](_0x41b04a));if(_0x41b04a[_0x6060('0x12')]){if(_0x41b04a[_0x6060('0x12')][_0x6060('0x13')]===0x1f4){logger[_0x6060('0x12')](_0x6060('0xf'),_0x354eab,_0x41b04a[_0x6060('0x12')]['message']);return _0x363667(_0x41b04a[_0x6060('0x12')][_0x6060('0x14')]);}logger[_0x6060('0x12')](_0x6060('0xf'),_0x354eab,_0x41b04a[_0x6060('0x12')][_0x6060('0x14')]);return _0x23f565(_0x41b04a[_0x6060('0x12')][_0x6060('0x14')]);}else{logger[_0x6060('0x15')](_0x6060('0xf'),_0x354eab,_0x6060('0x10'));_0x23f565(_0x41b04a[_0x6060('0x16')][_0x6060('0x14')]);}})[_0x6060('0x17')](function(_0x68c337){logger['error'](_0x6060('0xf'),_0x354eab,_0x68c337);_0x363667(_0x68c337);});});}exports['UpdateSmsInteraction']=function(_0x57a608){var _0x19b68=this;return new Promise(function(_0x4691bf,_0x238a6f){return db[_0x6060('0x18')][_0x6060('0x19')](_0x57a608['body'],{'raw':_0x57a608[_0x6060('0x1a')]?_0x57a608[_0x6060('0x1a')][_0x6060('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a608[_0x6060('0x1a')]?_0x57a608[_0x6060('0x1a')]['where']||null:null,'attributes':_0x57a608[_0x6060('0x1a')]?_0x57a608['options']['attributes']||null:null,'limit':_0x57a608['options']?_0x57a608[_0x6060('0x1a')]['limit']||null:null})[_0x6060('0xe')](function(_0x319952){logger[_0x6060('0x15')]('UpdateSmsInteraction',_0x57a608);logger[_0x6060('0x1c')](_0x6060('0x1d'),_0x57a608,JSON[_0x6060('0x1e')](_0x319952));_0x4691bf(_0x319952);})['catch'](function(_0x81700a){logger[_0x6060('0x12')](_0x6060('0x1d'),_0x81700a[_0x6060('0x14')],_0x57a608);_0x238a6f(_0x19b68[_0x6060('0x12')](0x1f4,_0x81700a[_0x6060('0x14')]));});});};exports[_0x6060('0x1f')]=function(_0x480f7){return new Promise(function(_0x5a640a,_0x2b716d){return db['SmsInteraction'][_0x6060('0x20')]({'where':_0x480f7[_0x6060('0x1a')]?_0x480f7[_0x6060('0x1a')][_0x6060('0x21')]||null:null})[_0x6060('0xe')](function(_0x5ea4e4){if(_0x5ea4e4){return _0x5ea4e4[_0x6060('0x22')](_0x480f7[_0x6060('0x23')][_0x6060('0x24')],_[_0x6060('0x25')](_0x480f7[_0x6060('0x23')],[_0x6060('0x24'),'id'])||{});}})['spread'](function(_0x485af9){logger[_0x6060('0x15')](_0x6060('0x26'),_0x480f7);logger[_0x6060('0x1c')](_0x6060('0x26'),_0x480f7,JSON[_0x6060('0x1e')](_0x485af9));_0x5a640a(_0x485af9);})[_0x6060('0x17')](function(_0x184a24){logger[_0x6060('0x12')](_0x6060('0x26'),_0x184a24['message'],_0x480f7);_0x2b716d(_this[_0x6060('0x12')](0x1f4,_0x184a24[_0x6060('0x14')]));});});}; \ No newline at end of file +var _0x9c4b=['result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','body','ids','omit','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x31903e,_0x25799d){var _0x5a9a47=function(_0x3648e7){while(--_0x3648e7){_0x31903e['push'](_0x31903e['shift']());}};_0x5a9a47(++_0x25799d);}(_0x9c4b,0x66));var _0xb9c4=function(_0x40f242,_0x3cf91){_0x40f242=_0x40f242-0x0;var _0x5e1f92=_0x9c4b[_0x40f242];return _0x5e1f92;};'use strict';var _=require(_0xb9c4('0x0'));var util=require(_0xb9c4('0x1'));var moment=require(_0xb9c4('0x2'));var BPromise=require(_0xb9c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9c4('0x4'))['db'];var utils=require(_0xb9c4('0x5'));var logger=require(_0xb9c4('0x6'))('rpc');var config=require(_0xb9c4('0x7'));var jayson=require(_0xb9c4('0x8'));var client=jayson['client'][_0xb9c4('0x9')]({'port':0x232a});config['redis']=_[_0xb9c4('0xa')](config['redis'],{'host':_0xb9c4('0xb'),'port':0x18eb});var socket=require(_0xb9c4('0xc'))(new Redis(config[_0xb9c4('0xd')]));require(_0xb9c4('0xe'))[_0xb9c4('0xf')](socket);function respondWithRpcPromise(_0x3e31c8,_0x2a2667,_0x4898bf){return new BPromise(function(_0x5bf227,_0x5af064){return client[_0xb9c4('0x10')](_0x3e31c8,_0x4898bf)[_0xb9c4('0x11')](function(_0x4545aa){logger[_0xb9c4('0x12')](_0xb9c4('0x13'),_0x2a2667,'request\x20sent');logger[_0xb9c4('0x14')](_0xb9c4('0x15'),_0x2a2667,'request\x20sent',JSON[_0xb9c4('0x16')](_0x4545aa));if(_0x4545aa[_0xb9c4('0x17')]){if(_0x4545aa[_0xb9c4('0x17')][_0xb9c4('0x18')]===0x1f4){logger[_0xb9c4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2a2667,_0x4545aa[_0xb9c4('0x17')][_0xb9c4('0x19')]);return _0x5af064(_0x4545aa[_0xb9c4('0x17')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2a2667,_0x4545aa[_0xb9c4('0x17')][_0xb9c4('0x19')]);return _0x5bf227(_0x4545aa[_0xb9c4('0x17')][_0xb9c4('0x19')]);}else{logger[_0xb9c4('0x12')](_0xb9c4('0x13'),_0x2a2667,_0xb9c4('0x1a'));_0x5bf227(_0x4545aa[_0xb9c4('0x1b')][_0xb9c4('0x19')]);}})[_0xb9c4('0x1c')](function(_0x3e05fb){logger[_0xb9c4('0x17')](_0xb9c4('0x13'),_0x2a2667,_0x3e05fb);_0x5af064(_0x3e05fb);});});}exports[_0xb9c4('0x1d')]=function(_0x15e63c){var _0x57d3b3=this;return new Promise(function(_0x50e431,_0x4eb671){return db[_0xb9c4('0x1e')][_0xb9c4('0x1f')](_0x15e63c['body'],{'raw':_0x15e63c[_0xb9c4('0x20')]?_0x15e63c['options'][_0xb9c4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e63c[_0xb9c4('0x20')]?_0x15e63c[_0xb9c4('0x20')][_0xb9c4('0x22')]||null:null,'attributes':_0x15e63c[_0xb9c4('0x20')]?_0x15e63c[_0xb9c4('0x20')][_0xb9c4('0x23')]||null:null,'limit':_0x15e63c[_0xb9c4('0x20')]?_0x15e63c[_0xb9c4('0x20')][_0xb9c4('0x24')]||null:null})[_0xb9c4('0x11')](function(_0x5d3d32){logger['info'](_0xb9c4('0x1d'),_0x15e63c);logger[_0xb9c4('0x14')]('UpdateSmsInteraction',_0x15e63c,JSON[_0xb9c4('0x16')](_0x5d3d32));_0x50e431(_0x5d3d32);})[_0xb9c4('0x1c')](function(_0x5a0104){logger['error'](_0xb9c4('0x1d'),_0x5a0104[_0xb9c4('0x19')],_0x15e63c);_0x4eb671(_0x57d3b3['error'](0x1f4,_0x5a0104[_0xb9c4('0x19')]));});});};exports[_0xb9c4('0x25')]=function(_0x3fcef3){return new Promise(function(_0x31d505,_0xbd429b){return db[_0xb9c4('0x1e')][_0xb9c4('0x26')]({'where':_0x3fcef3['options']?_0x3fcef3[_0xb9c4('0x20')][_0xb9c4('0x22')]||null:null})[_0xb9c4('0x11')](function(_0x412581){if(_0x412581){return _0x412581['addTags'](_0x3fcef3[_0xb9c4('0x27')][_0xb9c4('0x28')],_[_0xb9c4('0x29')](_0x3fcef3['body'],[_0xb9c4('0x28'),'id'])||{});}})['spread'](function(_0x1b9dc9){logger[_0xb9c4('0x12')]('AddTags',_0x3fcef3);logger[_0xb9c4('0x14')](_0xb9c4('0x2a'),_0x3fcef3,JSON[_0xb9c4('0x16')](_0x1b9dc9));_0x31d505(_0x1b9dc9);})['catch'](function(_0x2061a9){logger[_0xb9c4('0x17')](_0xb9c4('0x2a'),_0x2061a9[_0xb9c4('0x19')],_0x3fcef3);_0xbd429b(_this[_0xb9c4('0x17')](0x1f4,_0x2061a9[_0xb9c4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index db42c79..b17d9f5 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(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x2032,0xd9));var _0x2203=function(_0x14960f,_0x1952c8){_0x14960f=_0x14960f-0x0;var _0x42307f=_0x2032[_0x14960f];return _0x42307f;};'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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3d7d0b,_0x1f10de){var _0x4332e9=function(_0x420714){while(--_0x420714){_0x3d7d0b['push'](_0x3d7d0b['shift']());}};_0x4332e9(++_0x1f10de);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9de5fec..2817775 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 _0x9a5a=['create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','/describe','describe','isAuthenticated','show','post','sms','smsmessage:create'];(function(_0x5cd9ee,_0xee3e2b){var _0x308302=function(_0x3bbbdb){while(--_0x3bbbdb){_0x5cd9ee['push'](_0x5cd9ee['shift']());}};_0x308302(++_0xee3e2b);}(_0x9a5a,0xff));var _0xa9a5=function(_0x1c903e,_0x23f536){_0x1c903e=_0x1c903e-0x0;var _0x46086c=_0x9a5a[_0x1c903e];return _0x46086c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa9a5('0x0'));var express=require(_0xa9a5('0x1'));var router=express[_0xa9a5('0x2')]();var auth=require(_0xa9a5('0x3'));var interaction=require(_0xa9a5('0x4'));var config=require('../../config/environment');var controller=require(_0xa9a5('0x5'));router[_0xa9a5('0x6')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0x7')]);router[_0xa9a5('0x6')](_0xa9a5('0x8'),auth['isAuthenticated'](),controller[_0xa9a5('0x9')]);router['get']('/:id',auth[_0xa9a5('0xa')](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xa9a5('0xd'),_0xa9a5('0xe')),controller[_0xa9a5('0xf')]);router['post']('/:id/status',controller[_0xa9a5('0x10')]);router[_0xa9a5('0x11')](_0xa9a5('0x12'),auth['isAuthenticated'](),controller[_0xa9a5('0x13')]);router[_0xa9a5('0x11')](_0xa9a5('0x14'),auth['isAuthenticated'](),controller[_0xa9a5('0x15')]);router[_0xa9a5('0x11')](_0xa9a5('0x16'),auth[_0xa9a5('0xa')](),controller[_0xa9a5('0x17')]);router[_0xa9a5('0x18')]('/:id',auth[_0xa9a5('0xa')](),controller[_0xa9a5('0x19')]);module[_0xa9a5('0x1a')]=router; \ No newline at end of file +var _0x7f98=['accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','describe','/:id','isAuthenticated','post','smsmessage:create','put','update','/:id/accept'];(function(_0x22f5fb,_0x3c6904){var _0x4df63c=function(_0x44a08a){while(--_0x44a08a){_0x22f5fb['push'](_0x22f5fb['shift']());}};_0x4df63c(++_0x3c6904);}(_0x7f98,0x1b5));var _0x87f9=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7f98[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x87f9('0x0'));var util=require(_0x87f9('0x1'));var path=require(_0x87f9('0x2'));var timeout=require('connect-timeout');var express=require(_0x87f9('0x3'));var router=express[_0x87f9('0x4')]();var auth=require(_0x87f9('0x5'));var interaction=require(_0x87f9('0x6'));var config=require(_0x87f9('0x7'));var controller=require(_0x87f9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x87f9('0x9')]);router[_0x87f9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x87f9('0xb')]);router['get'](_0x87f9('0xc'),auth[_0x87f9('0xd')](),controller['show']);router[_0x87f9('0xe')]('/',auth[_0x87f9('0xd')](),interaction['tracked']('sms',_0x87f9('0xf')),controller['create']);router[_0x87f9('0xe')]('/:id/status',controller['status']);router[_0x87f9('0x10')](_0x87f9('0xc'),auth[_0x87f9('0xd')](),controller[_0x87f9('0x11')]);router['put'](_0x87f9('0x12'),auth[_0x87f9('0xd')](),controller[_0x87f9('0x13')]);router[_0x87f9('0x10')](_0x87f9('0x14'),auth[_0x87f9('0xd')](),controller['reject']);router[_0x87f9('0x15')](_0x87f9('0xc'),auth[_0x87f9('0xd')](),controller[_0x87f9('0x16')]);module[_0x87f9('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 758aba6..002f09b 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 _0xbc99=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xbc99,0x103));var _0x9bc9=function(_0xd4bee9,_0x458353){_0xd4bee9=_0xd4bee9-0x0;var _0x2c3a1f=_0xbc99[_0xd4bee9];return _0x2c3a1f;};'use strict';var Sequelize=require(_0x9bc9('0x0'));module[_0x9bc9('0x1')]={'body':{'type':Sequelize[_0x9bc9('0x2')](_0x9bc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9bc9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9bc9('0x5')]('in','out'),'defaultValue':_0x9bc9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9bc9('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9bc9('0x7')]},'readAt':{'type':Sequelize[_0x9bc9('0x8')]},'secret':{'type':Sequelize[_0x9bc9('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1b10=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3fb901,_0x3b4e7a){var _0x5d30a6=function(_0x19ada8){while(--_0x19ada8){_0x3fb901['push'](_0x3fb901['shift']());}};_0x5d30a6(++_0x3b4e7a);}(_0x1b10,0xe3));var _0x01b1=function(_0x2646f3,_0x812a2f){_0x2646f3=_0x2646f3-0x0;var _0x1267d7=_0x1b10[_0x2646f3];return _0x1267d7;};'use strict';var Sequelize=require(_0x01b1('0x0'));module[_0x01b1('0x1')]={'body':{'type':Sequelize[_0x01b1('0x2')](_0x01b1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x01b1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x01b1('0x5')]('in',_0x01b1('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x01b1('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x01b1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b37cb7c..12472d0 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 _0x4358=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','model','find','create','update','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','manual','SIP/%s','channel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','interface','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','Status','plivio','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info'];(function(_0x80303c,_0x565556){var _0x532ee0=function(_0x410ab3){while(--_0x410ab3){_0x80303c['push'](_0x80303c['shift']());}};_0x532ee0(++_0x565556);}(_0x4358,0xea));var _0x8435=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x4358[_0x50aa2e];return _0x5e07f0;};'use strict';var pdf=require(_0x8435('0x0'));var emlformat=require(_0x8435('0x1'));var rimraf=require(_0x8435('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8435('0x3'));var rp=require('request-promise');var moment=require(_0x8435('0x4'));var BPromise=require(_0x8435('0x5'));var Mustache=require(_0x8435('0x6'));var util=require(_0x8435('0x7'));var path=require('path');var sox=require(_0x8435('0x8'));var csv=require(_0x8435('0x9'));var ejs=require(_0x8435('0xa'));var fs=require('fs');var _=require(_0x8435('0xb'));var squel=require(_0x8435('0xc'));var crypto=require('crypto');var jsforce=require(_0x8435('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8435('0xe'));var Papa=require(_0x8435('0xf'));var Redis=require(_0x8435('0x10'));var authService=require(_0x8435('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8435('0x12'));var logger=require(_0x8435('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8435('0x14'));var licenseUtil=require(_0x8435('0x15'));var db=require(_0x8435('0x16'))['db'];config[_0x8435('0x17')]=_[_0x8435('0x18')](config[_0x8435('0x17')],{'host':_0x8435('0x19'),'port':0x18eb});var socket=require(_0x8435('0x1a'))(new Redis(config[_0x8435('0x17')]));require(_0x8435('0x1b'))[_0x8435('0x1c')](socket);var jayson=require(_0x8435('0x1d'));var client=jayson[_0x8435('0x1e')][_0x8435('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x8435('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ce538,_0xef418e,_0x4fd7dc,_0x41aa17){return new BPromise(function(_0x1abb04,_0x349a1e){var _0x1ca589=_0x41aa17||client;return _0x1ca589[_0x8435('0x20')](_0x2ce538,_0x4fd7dc)['then'](function(_0x2254a6){logger[_0x8435('0x21')]('SmsMessage,\x20%s,\x20%s',_0xef418e,'request\x20sent');logger[_0x8435('0x22')](_0x8435('0x23'),_0xef418e,_0x8435('0x24'),JSON[_0x8435('0x25')](_0x2254a6));if(_0x2254a6[_0x8435('0x26')]){if(_0x2254a6['error'][_0x8435('0x27')]===0x1f4){logger['error'](_0x8435('0x28'),_0xef418e,_0x2254a6['error'][_0x8435('0x29')]);return _0x349a1e(_0x2254a6[_0x8435('0x26')][_0x8435('0x29')]);}logger['error'](_0x8435('0x28'),_0xef418e,_0x2254a6[_0x8435('0x26')]['message']);return _0x1abb04(_0x2254a6[_0x8435('0x26')][_0x8435('0x29')]);}else{logger['info'](_0x8435('0x28'),_0xef418e,_0x8435('0x24'));_0x1abb04(_0x2254a6[_0x8435('0x2a')][_0x8435('0x29')]);}})[_0x8435('0x2b')](function(_0x9a3e98){logger['error'](_0x8435('0x28'),_0xef418e,_0x9a3e98);_0x349a1e(_0x9a3e98);});});}function respondWithStatusCode(_0x3a126b,_0x3ced5b){_0x3ced5b=_0x3ced5b||0xcc;return function(_0x29f6f2){if(_0x29f6f2){return _0x3a126b[_0x8435('0x2c')](_0x3ced5b);}return _0x3a126b['status'](_0x3ced5b)['end']();};}function respondWithResult(_0x640a7,_0xf1a575){_0xf1a575=_0xf1a575||0xc8;return function(_0x3c09bd){if(_0x3c09bd){return _0x640a7['status'](_0xf1a575)[_0x8435('0x2d')](_0x3c09bd);}};}function respondWithFilteredResult(_0x2780dc,_0x2b183e){return function(_0x3f227d){if(_0x3f227d){var _0x4e7151=_0x3f227d[_0x8435('0x2e')],_0x208de5=_0x2b183e['offset'],_0x3afa64=_0x2b183e[_0x8435('0x2f')]+_0x2b183e['limit'],_0x140885;if(_0x3afa64>=_0x4e7151){_0x3afa64=_0x4e7151;_0x140885=0xc8;}else{_0x140885=0xce;}_0x2780dc[_0x8435('0x30')](_0x140885);return _0x2780dc[_0x8435('0x31')](_0x8435('0x32'),_0x208de5+'-'+_0x3afa64+'/'+_0x4e7151)[_0x8435('0x2d')](_0x3f227d);}return null;};}function patchUpdates(_0x3b92e6){return function(_0x4f1d0e){try{jsonpatch[_0x8435('0x33')](_0x4f1d0e,_0x3b92e6,!![]);}catch(_0x19e817){return BPromise[_0x8435('0x34')](_0x19e817);}return _0x4f1d0e[_0x8435('0x35')]();};}function saveUpdates(_0x1682cd,_0x4a0336){return function(_0x117684){if(_0x117684){return _0x117684['update'](_0x1682cd)[_0x8435('0x36')](function(_0x35526c){return _0x35526c;});}return null;};}function removeEntity(_0x568772,_0x1202e3){return function(_0x1b90ad){if(_0x1b90ad){return _0x1b90ad[_0x8435('0x37')]()[_0x8435('0x36')](function(){_0x568772[_0x8435('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7630a,_0x696d92){return function(_0x441de5){if(!_0x441de5){_0xe7630a['sendStatus'](0x194);}return _0x441de5;};}function handleError(_0x556bc4,_0x4d1747){_0x4d1747=_0x4d1747||0x1f4;return function(_0x26d6d2){logger['error'](_0x26d6d2[_0x8435('0x38')]);if(_0x26d6d2[_0x8435('0x39')]){delete _0x26d6d2[_0x8435('0x39')];}_0x556bc4[_0x8435('0x30')](_0x4d1747)['send'](_0x26d6d2);};}exports[_0x8435('0x3a')]=function(_0x34eb4a,_0x19ed1e){var _0x4de632={},_0x534546={},_0x19e31f={'count':0x0,'rows':[]};var _0x257d46=_[_0x8435('0x3b')](db[_0x8435('0x3c')][_0x8435('0x3d')],function(_0x181492){return{'name':_0x181492[_0x8435('0x3e')],'type':_0x181492['type'][_0x8435('0x3f')]};});_0x534546['model']=_['map'](_0x257d46,_0x8435('0x39'));_0x534546[_0x8435('0x40')]=_[_0x8435('0x41')](_0x34eb4a['query']);_0x534546[_0x8435('0x42')]=_['intersection'](_0x534546['model'],_0x534546[_0x8435('0x40')]);_0x4de632[_0x8435('0x43')]=_[_0x8435('0x44')](_0x534546['model'],qs[_0x8435('0x45')](_0x34eb4a[_0x8435('0x40')][_0x8435('0x45')]));_0x4de632[_0x8435('0x43')]=_0x4de632['attributes'][_0x8435('0x46')]?_0x4de632['attributes']:_0x534546['model'];if(!_0x34eb4a[_0x8435('0x40')][_0x8435('0x47')]('nolimit')){_0x4de632['limit']=qs[_0x8435('0x48')](_0x34eb4a[_0x8435('0x40')][_0x8435('0x48')]);_0x4de632[_0x8435('0x2f')]=qs[_0x8435('0x2f')](_0x34eb4a['query']['offset']);}_0x4de632[_0x8435('0x49')]=qs['sort'](_0x34eb4a['query'][_0x8435('0x4a')]);_0x4de632[_0x8435('0x4b')]=qs[_0x8435('0x42')](_[_0x8435('0x4c')](_0x34eb4a['query'],_0x534546[_0x8435('0x42')]),_0x257d46);if(_0x34eb4a[_0x8435('0x40')][_0x8435('0x4d')]){_0x4de632['where']=_[_0x8435('0x4e')](_0x4de632[_0x8435('0x4b')],{'$or':_[_0x8435('0x3b')](_0x257d46,function(_0x3da725){if(_0x3da725[_0x8435('0x4f')]!==_0x8435('0x50')){var _0x26ee38={};_0x26ee38[_0x3da725['name']]={'$like':'%'+_0x34eb4a[_0x8435('0x40')][_0x8435('0x4d')]+'%'};return _0x26ee38;}})});}_0x4de632=_[_0x8435('0x4e')]({},_0x4de632,_0x34eb4a[_0x8435('0x51')]);var _0x331d48={'where':_0x4de632['where']};return db[_0x8435('0x3c')][_0x8435('0x2e')](_0x331d48)[_0x8435('0x36')](function(_0x20c923){_0x19e31f['count']=_0x20c923;if(_0x34eb4a['query'][_0x8435('0x52')]){_0x4de632[_0x8435('0x53')]=[{'all':!![]}];}return db[_0x8435('0x3c')][_0x8435('0x54')](_0x4de632);})[_0x8435('0x36')](function(_0x2f1f10){_0x19e31f[_0x8435('0x55')]=_0x2f1f10;return _0x19e31f;})['then'](respondWithFilteredResult(_0x19ed1e,_0x4de632))[_0x8435('0x2b')](handleError(_0x19ed1e,null));};exports[_0x8435('0x56')]=function(_0x203ff8,_0x2422b7){var _0x5e2717={'raw':!![],'where':{'id':_0x203ff8[_0x8435('0x57')]['id']}},_0xe9af29={};_0xe9af29[_0x8435('0x58')]=_['keys'](db['SmsMessage']['rawAttributes']);_0xe9af29[_0x8435('0x40')]=_[_0x8435('0x41')](_0x203ff8['query']);_0xe9af29[_0x8435('0x42')]=_['intersection'](_0xe9af29['model'],_0xe9af29[_0x8435('0x40')]);_0x5e2717[_0x8435('0x43')]=_[_0x8435('0x44')](_0xe9af29['model'],qs['fields'](_0x203ff8['query'][_0x8435('0x45')]));_0x5e2717[_0x8435('0x43')]=_0x5e2717[_0x8435('0x43')][_0x8435('0x46')]?_0x5e2717[_0x8435('0x43')]:_0xe9af29[_0x8435('0x58')];if(_0x203ff8[_0x8435('0x40')][_0x8435('0x52')]){_0x5e2717[_0x8435('0x53')]=[{'all':!![]}];}_0x5e2717=_[_0x8435('0x4e')]({},_0x5e2717,_0x203ff8[_0x8435('0x51')]);return db[_0x8435('0x3c')][_0x8435('0x59')](_0x5e2717)['then'](handleEntityNotFound(_0x2422b7,null))['then'](respondWithResult(_0x2422b7,null))[_0x8435('0x2b')](handleError(_0x2422b7,null));};exports[_0x8435('0x5a')]=function(_0x59a2e7,_0x3ba367){return db['SmsMessage'][_0x8435('0x5a')](_0x59a2e7['body'],{})[_0x8435('0x36')](respondWithResult(_0x3ba367,0xc9))[_0x8435('0x2b')](handleError(_0x3ba367,null));};exports[_0x8435('0x5b')]=function(_0x519710,_0x2a9b44){if(_0x519710['body']['id']){delete _0x519710[_0x8435('0x5c')]['id'];}return db[_0x8435('0x3c')][_0x8435('0x59')]({'where':{'id':_0x519710[_0x8435('0x57')]['id']}})[_0x8435('0x36')](handleEntityNotFound(_0x2a9b44,null))[_0x8435('0x36')](saveUpdates(_0x519710['body'],null))[_0x8435('0x36')](respondWithResult(_0x2a9b44,null))['catch'](handleError(_0x2a9b44,null));};exports['destroy']=function(_0x2ca679,_0x1447a6){return db['SmsMessage']['find']({'where':{'id':_0x2ca679['params']['id']}})[_0x8435('0x36')](handleEntityNotFound(_0x1447a6,null))[_0x8435('0x36')](removeEntity(_0x1447a6,null))[_0x8435('0x2b')](handleError(_0x1447a6,null));};exports[_0x8435('0x5d')]=function(_0xb8a319,_0x4f7cdd){return db[_0x8435('0x3c')][_0x8435('0x5d')]()[_0x8435('0x36')](respondWithResult(_0x4f7cdd,null))[_0x8435('0x2b')](handleError(_0x4f7cdd,null));};var interaction_log=require('../../config/logger')(_0x8435('0x5e'));exports[_0x8435('0x5f')]=function(_0x34d7d0,_0x4a886c,_0x287add){var _0x2dfe0d={'agent':{},'channel':_0x8435('0x60')};if(_0x34d7d0[_0x8435('0x5c')]['id']){delete _0x34d7d0[_0x8435('0x5c')]['id'];}_0x34d7d0[_0x8435('0x5c')][_0x8435('0x61')]=!![];_0x34d7d0[_0x8435('0x5c')]['readAt']=moment()[_0x8435('0x62')](_0x8435('0x63'));_0x34d7d0[_0x8435('0x5c')][_0x8435('0x64')]=_0x34d7d0[_0x8435('0x5c')]['UserId']||_0x34d7d0[_0x8435('0x65')]['id'];_0x2dfe0d[_0x8435('0x66')]['id']=_0x34d7d0[_0x8435('0x5c')][_0x8435('0x64')];return db[_0x8435('0x3c')][_0x8435('0x59')]({'where':{'id':_0x34d7d0['params']['id'],'UserId':null},'include':[{'model':db[_0x8435('0x67')],'as':_0x8435('0x68')}]})['then'](handleEntityNotFound(_0x4a886c,null))[_0x8435('0x36')](saveUpdates(_0x34d7d0['body'],null))[_0x8435('0x36')](function(_0x3554a0){if(_0x3554a0){_0x2dfe0d['message']=_0x3554a0[_0x8435('0x69')]({'plain':!![]});return db['SmsInteraction'][_0x8435('0x59')]({'where':{'id':_0x3554a0[_0x8435('0x6a')]}});}return null;})[_0x8435('0x36')](handleEntityNotFound(_0x4a886c,null))[_0x8435('0x36')](function(_0x3baf41){if(_0x3baf41){return _0x3baf41['update']({'UserId':_0x34d7d0['body'][_0x8435('0x64')],'read1stAt':_[_0x8435('0x6b')](_0x3baf41[_0x8435('0x6c')])?moment()[_0x8435('0x62')](_0x8435('0x63')):undefined});}return null;})[_0x8435('0x36')](function(_0x31b8cf){if(_0x31b8cf){_0x2dfe0d[_0x8435('0x6d')]=_0x31b8cf[_0x8435('0x69')]({'plain':!![]});interaction_log[_0x8435('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34d7d0[_0x8435('0x65')]['id'],_0x34d7d0[_0x8435('0x65')]['name'],_0x34d7d0['user']['role'],_0x2dfe0d[_0x8435('0x6d')]['id'],_0x34d7d0[_0x8435('0x5c')]?JSON[_0x8435('0x25')](_0x34d7d0['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2dfe0d);}return null;})['then'](function(_0x28cf6c){if(_0x28cf6c){if(_0x34d7d0[_0x8435('0x5c')][_0x8435('0x6e')]){_0x2dfe0d[_0x8435('0x29')]['interface']=util[_0x8435('0x62')](_0x8435('0x6f'),_0x34d7d0[_0x8435('0x65')]['name']);_0x2dfe0d[_0x8435('0x29')][_0x8435('0x70')]=_0x2dfe0d[_0x8435('0x70')];_0x2dfe0d['message'][_0x8435('0x71')]='accept';return respondWithRpcPromise('EventManager',_0x8435('0x72'),{'event':'acceptmessage','message':_0x2dfe0d[_0x8435('0x29')]},client9002)[_0x8435('0x36')](function(){return _0x2dfe0d;});}return _0x2dfe0d;}return null;})[_0x8435('0x36')](respondWithResult(_0x4a886c,null))['catch'](handleError(_0x4a886c,null));};var interaction_log=require(_0x8435('0x13'))('sms-interactions');exports[_0x8435('0x34')]=function(_0x58a047,_0x3637f2,_0x53a304){var _0x13d470={'agent':{},'channel':_0x8435('0x60')};if(_0x58a047['body']['id']){delete _0x58a047[_0x8435('0x5c')]['id'];}_0x58a047[_0x8435('0x5c')][_0x8435('0x64')]=_0x58a047[_0x8435('0x5c')]['UserId']||_0x58a047[_0x8435('0x65')]['id'];_0x13d470[_0x8435('0x66')]['id']=_0x58a047['body']['UserId'];return db[_0x8435('0x3c')][_0x8435('0x59')]({'where':{'id':_0x58a047[_0x8435('0x57')]['id'],'UserId':null}})[_0x8435('0x36')](handleEntityNotFound(_0x3637f2,null))[_0x8435('0x36')](function(_0x49f176){if(_0x49f176){_0x13d470['message']=_0x49f176[_0x8435('0x69')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x49f176[_0x8435('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3637f2,null))[_0x8435('0x36')](function(_0x14ec15){if(_0x14ec15){_0x13d470[_0x8435('0x6d')]=_0x14ec15[_0x8435('0x69')]({'plain':!![]});interaction_log['info'](_0x8435('0x73'),_0x58a047[_0x8435('0x65')]['id'],_0x58a047[_0x8435('0x65')]['name'],_0x58a047['user'][_0x8435('0x74')],_0x13d470[_0x8435('0x6d')]['id'],_0x58a047[_0x8435('0x5c')]?JSON['stringify'](_0x58a047[_0x8435('0x5c')]):_0x8435('0x75'));return respondWithRpcPromise(_0x8435('0x76'),'rejectMessage',_0x13d470);}return null;})[_0x8435('0x36')](function(_0x4b5f3b){if(_0x4b5f3b){_0x4b5f3b['message'][_0x8435('0x77')]=util['format'](_0x8435('0x6f'),_0x58a047['user'][_0x8435('0x39')]);_0x4b5f3b['message']['channel']=_0x13d470[_0x8435('0x70')];_0x4b5f3b['message'][_0x8435('0x71')]=_0x8435('0x34');respondWithRpcPromise(_0x8435('0x72'),_0x8435('0x72'),{'event':'rejectmessage','message':_0x4b5f3b['message']},client9002);return _0x13d470;}return null;})[_0x8435('0x36')](respondWithResult(_0x3637f2,null))['catch'](handleError(_0x3637f2,null));};exports['status']=function(_0x392faf,_0x1f4b4e,_0x1c8777){if(_0x392faf[_0x8435('0x5c')]['id']){delete _0x392faf[_0x8435('0x5c')]['id'];}var _0x33e53b;return db[_0x8435('0x3c')][_0x8435('0x59')]({'where':{'id':_0x392faf['params']['id']}})[_0x8435('0x36')](handleEntityNotFound(_0x1f4b4e,null))[_0x8435('0x36')](function(_0x143cc4){if(_0x143cc4){_0x33e53b=_0x143cc4;return db[_0x8435('0x78')]['find']({'where':{'id':_0x143cc4['SmsAccountId']}});}})[_0x8435('0x36')](handleEntityNotFound(_0x1f4b4e,null))[_0x8435('0x36')](function(_0x4573ac){if(_0x4573ac){logger[_0x8435('0x22')](_0x8435('0x23'),'status',_0x8435('0x79'),_0x4573ac[_0x8435('0x4f')],util[_0x8435('0x7a')](_0x392faf[_0x8435('0x5c')],{'showHidden':![],'depth':null}));switch(_0x4573ac[_0x8435('0x4f')]){case'twilio':if(_0x392faf[_0x8435('0x5c')][_0x8435('0x7b')]&&_0x392faf[_0x8435('0x5c')]['MessageSid']===_0x33e53b[_0x8435('0x7c')]){return _0x33e53b[_0x8435('0x5b')]({'read':!![]});}else{logger['error'](_0x8435('0x7d'),'status',_0x8435('0x7e'),util[_0x8435('0x7a')](_0x392faf[_0x8435('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8435('0x7f'):if(_0x392faf[_0x8435('0x5c')][_0x8435('0x80')]&&_0x392faf[_0x8435('0x5c')]['MessageUUID']===_0x33e53b[_0x8435('0x7c')]&&_[_0x8435('0x81')](['sent','delivered'],_0x392faf[_0x8435('0x5c')][_0x8435('0x82')])>=0x0){return _0x33e53b[_0x8435('0x5b')]({'read':!![]});}else{logger['error'](_0x8435('0x7d'),'status',_0x8435('0x83'),util[_0x8435('0x7a')](_0x392faf[_0x8435('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3ae640=_0x392faf[_0x8435('0x5c')]['results'][0x0];if(_0x3ae640[_0x8435('0x30')][_0x8435('0x84')]===_0x8435('0x85')){return _0x33e53b[_0x8435('0x5b')]({'read':!![]});}else{logger[_0x8435('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8435('0x30'),'infobip',util['inspect'](_0x392faf[_0x8435('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x33e53b;}})['then'](respondWithResult(_0x1f4b4e,null))[_0x8435('0x2b')](handleError(_0x1f4b4e,null));}; \ No newline at end of file +var _0x2f53=['AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','apply','reject','save','update','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','destroy','find','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x1a842d,_0x5b178e){var _0x257ce9=function(_0x2b75fc){while(--_0x2b75fc){_0x1a842d['push'](_0x1a842d['shift']());}};_0x257ce9(++_0x5b178e);}(_0x2f53,0x134));var _0x32f5=function(_0x203b19,_0x1f8b04){_0x203b19=_0x203b19-0x0;var _0x45bf7a=_0x2f53[_0x203b19];return _0x45bf7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32f5('0x1'));var jsonpatch=require(_0x32f5('0x2'));var rp=require(_0x32f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32f5('0x4'));var util=require(_0x32f5('0x5'));var path=require(_0x32f5('0x6'));var sox=require('sox');var csv=require(_0x32f5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x32f5('0x8'));var squel=require(_0x32f5('0x9'));var crypto=require(_0x32f5('0xa'));var jsforce=require(_0x32f5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32f5('0x7'));var querystring=require(_0x32f5('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32f5('0xd'));var qs=require(_0x32f5('0xe'));var as=require(_0x32f5('0xf'));var hardwareService=require(_0x32f5('0x10'));var logger=require(_0x32f5('0x11'))(_0x32f5('0x12'));var utils=require(_0x32f5('0x13'));var config=require(_0x32f5('0x14'));var licenseUtil=require(_0x32f5('0x15'));var db=require(_0x32f5('0x16'))['db'];config[_0x32f5('0x17')]=_[_0x32f5('0x18')](config[_0x32f5('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x32f5('0x19'))(new Redis(config[_0x32f5('0x17')]));require('./smsMessage.socket')[_0x32f5('0x1a')](socket);var jayson=require(_0x32f5('0x1b'));var client=jayson[_0x32f5('0x1c')][_0x32f5('0x1d')]({'port':0x232c});var client9002=jayson[_0x32f5('0x1c')][_0x32f5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x200888,_0x54fad2,_0x2fdfc7,_0x58096b){return new BPromise(function(_0x116777,_0x504ede){var _0x128c81=_0x58096b||client;return _0x128c81[_0x32f5('0x1e')](_0x200888,_0x2fdfc7)[_0x32f5('0x1f')](function(_0x59ffe2){logger[_0x32f5('0x20')](_0x32f5('0x21'),_0x54fad2,_0x32f5('0x22'));logger[_0x32f5('0x23')](_0x32f5('0x24'),_0x54fad2,_0x32f5('0x22'),JSON[_0x32f5('0x25')](_0x59ffe2));if(_0x59ffe2[_0x32f5('0x26')]){if(_0x59ffe2[_0x32f5('0x26')][_0x32f5('0x27')]===0x1f4){logger['error'](_0x32f5('0x21'),_0x54fad2,_0x59ffe2[_0x32f5('0x26')][_0x32f5('0x28')]);return _0x504ede(_0x59ffe2[_0x32f5('0x26')][_0x32f5('0x28')]);}logger[_0x32f5('0x26')](_0x32f5('0x21'),_0x54fad2,_0x59ffe2[_0x32f5('0x26')][_0x32f5('0x28')]);return _0x116777(_0x59ffe2['error'][_0x32f5('0x28')]);}else{logger[_0x32f5('0x20')](_0x32f5('0x21'),_0x54fad2,_0x32f5('0x22'));_0x116777(_0x59ffe2[_0x32f5('0x29')][_0x32f5('0x28')]);}})[_0x32f5('0x2a')](function(_0x550deb){logger['error'](_0x32f5('0x21'),_0x54fad2,_0x550deb);_0x504ede(_0x550deb);});});}function respondWithStatusCode(_0x51a794,_0x172a64){_0x172a64=_0x172a64||0xcc;return function(_0x72c32d){if(_0x72c32d){return _0x51a794[_0x32f5('0x2b')](_0x172a64);}return _0x51a794[_0x32f5('0x2c')](_0x172a64)['end']();};}function respondWithResult(_0x852650,_0x19138b){_0x19138b=_0x19138b||0xc8;return function(_0x15f61c){if(_0x15f61c){return _0x852650[_0x32f5('0x2c')](_0x19138b)['json'](_0x15f61c);}};}function respondWithFilteredResult(_0x29f7cc,_0x323647){return function(_0x4652d0){if(_0x4652d0){var _0x3719de=_0x4652d0['count'],_0x4e96c0=_0x323647[_0x32f5('0x2d')],_0x5b2dd0=_0x323647[_0x32f5('0x2d')]+_0x323647[_0x32f5('0x2e')],_0x2f2f81;if(_0x5b2dd0>=_0x3719de){_0x5b2dd0=_0x3719de;_0x2f2f81=0xc8;}else{_0x2f2f81=0xce;}_0x29f7cc['status'](_0x2f2f81);return _0x29f7cc[_0x32f5('0x2f')](_0x32f5('0x30'),_0x4e96c0+'-'+_0x5b2dd0+'/'+_0x3719de)['json'](_0x4652d0);}return null;};}function patchUpdates(_0x26d1fa){return function(_0x490287){try{jsonpatch[_0x32f5('0x31')](_0x490287,_0x26d1fa,!![]);}catch(_0x253e1e){return BPromise[_0x32f5('0x32')](_0x253e1e);}return _0x490287[_0x32f5('0x33')]();};}function saveUpdates(_0x2bbda9,_0x431712){return function(_0x5ade25){if(_0x5ade25){return _0x5ade25[_0x32f5('0x34')](_0x2bbda9)[_0x32f5('0x1f')](function(_0x56144d){return _0x56144d;});}return null;};}function removeEntity(_0x2aaec3,_0x49dae6){return function(_0x1ef6d7){if(_0x1ef6d7){return _0x1ef6d7['destroy']()[_0x32f5('0x1f')](function(){_0x2aaec3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2091cf,_0x2b96d2){return function(_0x5f2abd){if(!_0x5f2abd){_0x2091cf['sendStatus'](0x194);}return _0x5f2abd;};}function handleError(_0x55700e,_0xf2d552){_0xf2d552=_0xf2d552||0x1f4;return function(_0x56f956){logger[_0x32f5('0x26')](_0x56f956['stack']);if(_0x56f956[_0x32f5('0x35')]){delete _0x56f956[_0x32f5('0x35')];}_0x55700e[_0x32f5('0x2c')](_0xf2d552)[_0x32f5('0x36')](_0x56f956);};}exports['index']=function(_0x4084d5,_0x318e4c){var _0x1afe5f={},_0x559f14={},_0x5f2468={'count':0x0,'rows':[]};var _0x162037=_[_0x32f5('0x37')](db[_0x32f5('0x38')][_0x32f5('0x39')],function(_0x3e76b2){return{'name':_0x3e76b2[_0x32f5('0x3a')],'type':_0x3e76b2[_0x32f5('0x3b')][_0x32f5('0x3c')]};});_0x559f14[_0x32f5('0x3d')]=_['map'](_0x162037,_0x32f5('0x35'));_0x559f14[_0x32f5('0x3e')]=_[_0x32f5('0x3f')](_0x4084d5[_0x32f5('0x3e')]);_0x559f14[_0x32f5('0x40')]=_[_0x32f5('0x41')](_0x559f14[_0x32f5('0x3d')],_0x559f14[_0x32f5('0x3e')]);_0x1afe5f[_0x32f5('0x42')]=_[_0x32f5('0x41')](_0x559f14[_0x32f5('0x3d')],qs[_0x32f5('0x43')](_0x4084d5[_0x32f5('0x3e')]['fields']));_0x1afe5f[_0x32f5('0x42')]=_0x1afe5f[_0x32f5('0x42')][_0x32f5('0x44')]?_0x1afe5f[_0x32f5('0x42')]:_0x559f14[_0x32f5('0x3d')];if(!_0x4084d5['query'][_0x32f5('0x45')](_0x32f5('0x46'))){_0x1afe5f[_0x32f5('0x2e')]=qs[_0x32f5('0x2e')](_0x4084d5['query'][_0x32f5('0x2e')]);_0x1afe5f[_0x32f5('0x2d')]=qs['offset'](_0x4084d5[_0x32f5('0x3e')][_0x32f5('0x2d')]);}_0x1afe5f[_0x32f5('0x47')]=qs['sort'](_0x4084d5[_0x32f5('0x3e')][_0x32f5('0x48')]);_0x1afe5f[_0x32f5('0x49')]=qs[_0x32f5('0x40')](_[_0x32f5('0x4a')](_0x4084d5['query'],_0x559f14[_0x32f5('0x40')]),_0x162037);if(_0x4084d5[_0x32f5('0x3e')][_0x32f5('0x4b')]){_0x1afe5f['where']=_[_0x32f5('0x4c')](_0x1afe5f[_0x32f5('0x49')],{'$or':_[_0x32f5('0x37')](_0x162037,function(_0x3acc42){if(_0x3acc42[_0x32f5('0x3b')]!==_0x32f5('0x4d')){var _0xa0465a={};_0xa0465a[_0x3acc42[_0x32f5('0x35')]]={'$like':'%'+_0x4084d5[_0x32f5('0x3e')]['filter']+'%'};return _0xa0465a;}})});}_0x1afe5f=_[_0x32f5('0x4c')]({},_0x1afe5f,_0x4084d5[_0x32f5('0x4e')]);var _0x2ef2f5={'where':_0x1afe5f[_0x32f5('0x49')]};return db[_0x32f5('0x38')][_0x32f5('0x4f')](_0x2ef2f5)[_0x32f5('0x1f')](function(_0x2b6d00){_0x5f2468[_0x32f5('0x4f')]=_0x2b6d00;if(_0x4084d5[_0x32f5('0x3e')][_0x32f5('0x50')]){_0x1afe5f[_0x32f5('0x51')]=[{'all':!![]}];}return db[_0x32f5('0x38')][_0x32f5('0x52')](_0x1afe5f);})['then'](function(_0xbcf785){_0x5f2468[_0x32f5('0x53')]=_0xbcf785;return _0x5f2468;})[_0x32f5('0x1f')](respondWithFilteredResult(_0x318e4c,_0x1afe5f))[_0x32f5('0x2a')](handleError(_0x318e4c,null));};exports[_0x32f5('0x54')]=function(_0x4d4150,_0x431fd5){var _0x58155e={'raw':!![],'where':{'id':_0x4d4150[_0x32f5('0x55')]['id']}},_0x424b6e={};_0x424b6e['model']=_[_0x32f5('0x3f')](db[_0x32f5('0x38')][_0x32f5('0x39')]);_0x424b6e[_0x32f5('0x3e')]=_[_0x32f5('0x3f')](_0x4d4150[_0x32f5('0x3e')]);_0x424b6e[_0x32f5('0x40')]=_[_0x32f5('0x41')](_0x424b6e[_0x32f5('0x3d')],_0x424b6e[_0x32f5('0x3e')]);_0x58155e[_0x32f5('0x42')]=_[_0x32f5('0x41')](_0x424b6e[_0x32f5('0x3d')],qs['fields'](_0x4d4150['query'][_0x32f5('0x43')]));_0x58155e['attributes']=_0x58155e[_0x32f5('0x42')][_0x32f5('0x44')]?_0x58155e['attributes']:_0x424b6e[_0x32f5('0x3d')];if(_0x4d4150['query'][_0x32f5('0x50')]){_0x58155e['include']=[{'all':!![]}];}_0x58155e=_[_0x32f5('0x4c')]({},_0x58155e,_0x4d4150['options']);return db[_0x32f5('0x38')]['find'](_0x58155e)[_0x32f5('0x1f')](handleEntityNotFound(_0x431fd5,null))[_0x32f5('0x1f')](respondWithResult(_0x431fd5,null))[_0x32f5('0x2a')](handleError(_0x431fd5,null));};exports[_0x32f5('0x56')]=function(_0x502f28,_0x1148f6){return db[_0x32f5('0x38')][_0x32f5('0x56')](_0x502f28['body'],{})[_0x32f5('0x1f')](respondWithResult(_0x1148f6,0xc9))[_0x32f5('0x2a')](handleError(_0x1148f6,null));};exports[_0x32f5('0x34')]=function(_0x33d62c,_0x40706b){if(_0x33d62c[_0x32f5('0x57')]['id']){delete _0x33d62c[_0x32f5('0x57')]['id'];}return db[_0x32f5('0x38')]['find']({'where':{'id':_0x33d62c[_0x32f5('0x55')]['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x40706b,null))['then'](saveUpdates(_0x33d62c[_0x32f5('0x57')],null))[_0x32f5('0x1f')](respondWithResult(_0x40706b,null))[_0x32f5('0x2a')](handleError(_0x40706b,null));};exports[_0x32f5('0x58')]=function(_0x51ae3f,_0x4067f3){return db[_0x32f5('0x38')][_0x32f5('0x59')]({'where':{'id':_0x51ae3f[_0x32f5('0x55')]['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x4067f3,null))['then'](removeEntity(_0x4067f3,null))[_0x32f5('0x2a')](handleError(_0x4067f3,null));};exports[_0x32f5('0x5a')]=function(_0x44e75d,_0x20b8b5){return db['SmsMessage'][_0x32f5('0x5a')]()[_0x32f5('0x1f')](respondWithResult(_0x20b8b5,null))[_0x32f5('0x2a')](handleError(_0x20b8b5,null));};var interaction_log=require(_0x32f5('0x11'))('sms-interactions');exports['accept']=function(_0x42ad3b,_0x197914,_0xd0857e){var _0x287172={'agent':{},'channel':'sms'};if(_0x42ad3b[_0x32f5('0x57')]['id']){delete _0x42ad3b['body']['id'];}_0x42ad3b['body'][_0x32f5('0x5b')]=!![];_0x42ad3b[_0x32f5('0x57')][_0x32f5('0x5c')]=moment()[_0x32f5('0x5d')](_0x32f5('0x5e'));_0x42ad3b[_0x32f5('0x57')][_0x32f5('0x5f')]=_0x42ad3b['body'][_0x32f5('0x5f')]||_0x42ad3b[_0x32f5('0x60')]['id'];_0x287172[_0x32f5('0x61')]['id']=_0x42ad3b[_0x32f5('0x57')][_0x32f5('0x5f')];return db['SmsMessage'][_0x32f5('0x59')]({'where':{'id':_0x42ad3b[_0x32f5('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x32f5('0x62')],'as':_0x32f5('0x63')}]})[_0x32f5('0x1f')](handleEntityNotFound(_0x197914,null))[_0x32f5('0x1f')](saveUpdates(_0x42ad3b['body'],null))['then'](function(_0x3d423f){if(_0x3d423f){_0x287172[_0x32f5('0x28')]=_0x3d423f[_0x32f5('0x64')]({'plain':!![]});return db[_0x32f5('0x65')][_0x32f5('0x59')]({'where':{'id':_0x3d423f[_0x32f5('0x66')]}});}return null;})[_0x32f5('0x1f')](handleEntityNotFound(_0x197914,null))['then'](function(_0x7afc9f){if(_0x7afc9f){return _0x7afc9f['update']({'UserId':_0x42ad3b['body']['UserId'],'read1stAt':_[_0x32f5('0x67')](_0x7afc9f[_0x32f5('0x68')])?moment()['format'](_0x32f5('0x5e')):undefined});}return null;})['then'](function(_0x367e7d){if(_0x367e7d){_0x287172[_0x32f5('0x69')]=_0x367e7d['get']({'plain':!![]});interaction_log[_0x32f5('0x20')](_0x32f5('0x6a'),_0x42ad3b[_0x32f5('0x60')]['id'],_0x42ad3b[_0x32f5('0x60')][_0x32f5('0x35')],_0x42ad3b[_0x32f5('0x60')][_0x32f5('0x6b')],_0x287172[_0x32f5('0x69')]['id'],_0x42ad3b[_0x32f5('0x57')]?JSON[_0x32f5('0x25')](_0x42ad3b[_0x32f5('0x57')]):_0x32f5('0x6c'));return respondWithRpcPromise(_0x32f5('0x6d'),_0x32f5('0x6e'),_0x287172);}return null;})[_0x32f5('0x1f')](function(_0x4a61e4){if(_0x4a61e4){if(_0x42ad3b[_0x32f5('0x57')][_0x32f5('0x6f')]){_0x287172[_0x32f5('0x28')][_0x32f5('0x70')]=util[_0x32f5('0x5d')](_0x32f5('0x71'),_0x42ad3b[_0x32f5('0x60')][_0x32f5('0x35')]);_0x287172[_0x32f5('0x28')][_0x32f5('0x72')]=_0x287172['channel'];_0x287172[_0x32f5('0x28')]['event']=_0x32f5('0x73');return respondWithRpcPromise('EventManager',_0x32f5('0x74'),{'event':_0x32f5('0x75'),'message':_0x287172[_0x32f5('0x28')]},client9002)[_0x32f5('0x1f')](function(){return _0x287172;});}return _0x287172;}return null;})[_0x32f5('0x1f')](respondWithResult(_0x197914,null))[_0x32f5('0x2a')](handleError(_0x197914,null));};var interaction_log=require(_0x32f5('0x11'))('sms-interactions');exports[_0x32f5('0x32')]=function(_0x4fe3bb,_0x383a51,_0x184db5){var _0x1d7036={'agent':{},'channel':_0x32f5('0x76')};if(_0x4fe3bb[_0x32f5('0x57')]['id']){delete _0x4fe3bb['body']['id'];}_0x4fe3bb['body'][_0x32f5('0x5f')]=_0x4fe3bb[_0x32f5('0x57')][_0x32f5('0x5f')]||_0x4fe3bb['user']['id'];_0x1d7036[_0x32f5('0x61')]['id']=_0x4fe3bb['body'][_0x32f5('0x5f')];return db[_0x32f5('0x38')][_0x32f5('0x59')]({'where':{'id':_0x4fe3bb[_0x32f5('0x55')]['id'],'UserId':null}})[_0x32f5('0x1f')](handleEntityNotFound(_0x383a51,null))['then'](function(_0x4b9920){if(_0x4b9920){_0x1d7036[_0x32f5('0x28')]=_0x4b9920['get']({'plain':!![]});return db[_0x32f5('0x65')]['find']({'where':{'id':_0x4b9920[_0x32f5('0x66')]}});}return null;})[_0x32f5('0x1f')](handleEntityNotFound(_0x383a51,null))[_0x32f5('0x1f')](function(_0x3de6c3){if(_0x3de6c3){_0x1d7036[_0x32f5('0x69')]=_0x3de6c3['get']({'plain':!![]});interaction_log[_0x32f5('0x20')](_0x32f5('0x77'),_0x4fe3bb[_0x32f5('0x60')]['id'],_0x4fe3bb[_0x32f5('0x60')][_0x32f5('0x35')],_0x4fe3bb['user'][_0x32f5('0x6b')],_0x1d7036[_0x32f5('0x69')]['id'],_0x4fe3bb['body']?JSON[_0x32f5('0x25')](_0x4fe3bb[_0x32f5('0x57')]):_0x32f5('0x6c'));return respondWithRpcPromise(_0x32f5('0x78'),_0x32f5('0x79'),_0x1d7036);}return null;})[_0x32f5('0x1f')](function(_0x127c48){if(_0x127c48){_0x127c48[_0x32f5('0x28')][_0x32f5('0x70')]=util['format']('SIP/%s',_0x4fe3bb['user'][_0x32f5('0x35')]);_0x127c48[_0x32f5('0x28')][_0x32f5('0x72')]=_0x1d7036['channel'];_0x127c48[_0x32f5('0x28')][_0x32f5('0x7a')]=_0x32f5('0x32');respondWithRpcPromise(_0x32f5('0x74'),_0x32f5('0x74'),{'event':'rejectmessage','message':_0x127c48['message']},client9002);return _0x1d7036;}return null;})['then'](respondWithResult(_0x383a51,null))['catch'](handleError(_0x383a51,null));};exports[_0x32f5('0x2c')]=function(_0x2a9364,_0xd1ec5c,_0x2076df){if(_0x2a9364[_0x32f5('0x57')]['id']){delete _0x2a9364[_0x32f5('0x57')]['id'];}var _0x15983c;return db[_0x32f5('0x38')][_0x32f5('0x59')]({'where':{'id':_0x2a9364['params']['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0xd1ec5c,null))[_0x32f5('0x1f')](function(_0x3b8487){if(_0x3b8487){_0x15983c=_0x3b8487;return db['SmsAccount']['find']({'where':{'id':_0x3b8487[_0x32f5('0x7b')]}});}})[_0x32f5('0x1f')](handleEntityNotFound(_0xd1ec5c,null))[_0x32f5('0x1f')](function(_0x2c404f){if(_0x2c404f){logger[_0x32f5('0x23')](_0x32f5('0x24'),_0x32f5('0x2c'),_0x32f5('0x7c'),_0x2c404f[_0x32f5('0x3b')],util[_0x32f5('0x7d')](_0x2a9364[_0x32f5('0x57')],{'showHidden':![],'depth':null}));switch(_0x2c404f[_0x32f5('0x3b')]){case _0x32f5('0x7e'):if(_0x2a9364[_0x32f5('0x57')]['MessageSid']&&_0x2a9364[_0x32f5('0x57')][_0x32f5('0x7f')]===_0x15983c['messageId']){return _0x15983c[_0x32f5('0x34')]({'read':!![]});}else{logger[_0x32f5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x32f5('0x7e'),util[_0x32f5('0x7d')](_0x2a9364[_0x32f5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x32f5('0x80'):if(_0x2a9364[_0x32f5('0x57')]['MessageUUID']&&_0x2a9364[_0x32f5('0x57')][_0x32f5('0x81')]===_0x15983c['messageId']&&_[_0x32f5('0x82')]([_0x32f5('0x83'),_0x32f5('0x84')],_0x2a9364[_0x32f5('0x57')][_0x32f5('0x85')])>=0x0){return _0x15983c['update']({'read':!![]});}else{logger['error'](_0x32f5('0x86'),_0x32f5('0x2c'),_0x32f5('0x87'),util[_0x32f5('0x7d')](_0x2a9364[_0x32f5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x32f5('0x88'):var _0x3132d4=_0x2a9364[_0x32f5('0x57')][_0x32f5('0x89')][0x0];if(_0x3132d4[_0x32f5('0x2c')][_0x32f5('0x8a')]==='DELIVERED'){return _0x15983c['update']({'read':!![]});}else{logger['error'](_0x32f5('0x86'),'status',_0x32f5('0x88'),util[_0x32f5('0x7d')](_0x2a9364[_0x32f5('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x15983c;}})['then'](respondWithResult(_0xd1ec5c,null))[_0x32f5('0x2a')](handleError(_0xd1ec5c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 114f0c8..5eff7f3 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 _0x51ad=['events','../../mysqldb','SmsMessage','update','remove','emit','hasOwnProperty','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x51ad,0xd8));var _0xd51a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x51ad[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xd51a('0x0'));var SmsMessage=require(_0xd51a('0x1'))['db'][_0xd51a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd51a('0x3'),'afterDestroy':_0xd51a('0x4')};function emitEvent(_0x1e1890){return function(_0x2bc081,_0x4d7082,_0x582758){SmsMessageEvents['emit'](_0x1e1890+':'+_0x2bc081['id'],_0x2bc081);SmsMessageEvents[_0xd51a('0x5')](_0x1e1890,_0x2bc081);_0x582758(null);};}for(var e in events){if(events[_0xd51a('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xd51a('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x9fca=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x9fca,0xf5));var _0xa9fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9fca[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa9fc('0x0'));var SmsMessage=require(_0xa9fc('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa9fc('0x2')](0x0);var events={'afterCreate':_0xa9fc('0x3'),'afterUpdate':_0xa9fc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a2ef3){return function(_0x5358f2,_0x395e76,_0x38dfd8){SmsMessageEvents[_0xa9fc('0x5')](_0x2a2ef3+':'+_0x5358f2['id'],_0x5358f2);SmsMessageEvents['emit'](_0x2a2ef3,_0x5358f2);_0x38dfd8(null);};}for(var e in events){if(events[_0xa9fc('0x6')](e)){var event=events[e];SmsMessage[_0xa9fc('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 701d3bd..a68073f 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 _0x6f6a=['toString','message_uuid','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','login','keys','sort','createHash','md5','digest','hex','signature=','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','catch','find','then','type','twilio','accountSid','authToken','messages','create','phone','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x6f6a,0x189));var _0xa6f6=function(_0x4423e0,_0x20600e){_0x4423e0=_0x4423e0-0x0;var _0xfeee28=_0x6f6a[_0x4423e0];return _0xfeee28;};'use strict';var _=require(_0xa6f6('0x0'));var util=require(_0xa6f6('0x1'));var logger=require(_0xa6f6('0x2'))('api');var moment=require(_0xa6f6('0x3'));var BPromise=require(_0xa6f6('0x4'));var rp=require(_0xa6f6('0x5'));var fs=require('fs');var path=require(_0xa6f6('0x6'));var rimraf=require(_0xa6f6('0x7'));var config=require(_0xa6f6('0x8'));var attributes=require(_0xa6f6('0x9'));module['exports']=function(_0x36c04c,_0x376647){return _0x36c04c[_0xa6f6('0xa')](_0xa6f6('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa6f6('0xc'),'fields':[_0xa6f6('0xc')]},{'name':_0xa6f6('0xd'),'fields':[_0xa6f6('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b9f19,_0x4dfdbc,_0x13f294){var _0x5d0761=_0x36c04c[_0xa6f6('0xf')];var _0x37efc9=_0x4b9f19[_0xa6f6('0x10')]({'plain':!![]});if(_0x37efc9['direction']['toLowerCase']()==='in'||_0x37efc9[_0xa6f6('0x11')][_0xa6f6('0x12')]()===_0xa6f6('0x13')&&!_0x37efc9[_0xa6f6('0x14')]&&!_[_0xa6f6('0x15')](_0x37efc9[_0xa6f6('0x16')])){_0x5d0761[_0xa6f6('0x17')][_0xa6f6('0x18')]({'where':{'id':_0x37efc9[_0xa6f6('0x19')]}})['then'](function(_0x2ee2b1){if(_0x2ee2b1){_0x2ee2b1[_0xa6f6('0x1a')]({'lastMsgAt':_0x37efc9['createdAt'],'lastMsgDirection':_0x37efc9['direction']['toLowerCase']()});}})[_0xa6f6('0x1b')](function(_0x5bd907){console['error'](_0x5bd907);});}if(_0x37efc9[_0xa6f6('0x11')]===_0xa6f6('0x13')&&!_0x37efc9[_0xa6f6('0x14')]){var _0xad4aec;_0x5d0761['SmsAccount'][_0xa6f6('0x1c')]({'where':{'id':_0x37efc9['SmsAccountId']},'raw':!![]})[_0xa6f6('0x1d')](function(_0xb4db9a){_0xad4aec=_0xb4db9a;if(_0xad4aec&&_0xad4aec[_0xa6f6('0x1e')]){switch(_0xad4aec[_0xa6f6('0x1e')]){case _0xa6f6('0x1f'):var _0x15455a=require(_0xa6f6('0x1f'));if(_0xad4aec[_0xa6f6('0x20')]&&_0xad4aec[_0xa6f6('0x21')]&&_0xad4aec['phone']){var _0x1837c7=new _0x15455a(_0xad4aec['accountSid'],_0xad4aec[_0xa6f6('0x21')]);_0x1837c7[_0xa6f6('0x22')][_0xa6f6('0x23')]({'body':_0x37efc9[_0xa6f6('0xe')],'to':_0x37efc9[_0xa6f6('0x24')],'from':_0xad4aec[_0xa6f6('0x24')],'statusCallback':_0xad4aec[_0xa6f6('0x25')]+'/api/sms/messages/'+_0x37efc9['id']+_0xa6f6('0x26')+_0xad4aec[_0xa6f6('0x27')]})[_0xa6f6('0x1d')](function(_0x45030a){if(_0x45030a['sid']){return _0x4b9f19[_0xa6f6('0x1a')]({'messageId':_0x45030a[_0xa6f6('0x28')]});}})[_0xa6f6('0x1b')](function(_0x14c002){logger['error'](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x1f'),util[_0xa6f6('0x2b')](_0x14c002,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),'afterCreate',_0xa6f6('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x3142a6=_0xa6f6('0x2d');if(_0xad4aec[_0xa6f6('0x2e')]&&_0xad4aec[_0xa6f6('0x2f')]){var _0x17830e={'recipient':[_0x37efc9['phone']],'message':_0x37efc9[_0xa6f6('0xe')],'message_type':_0xad4aec[_0xa6f6('0x30')]};if(_0xad4aec[_0xa6f6('0x30')]&&_0xad4aec['smsMethod']!=='SI'){_0x17830e[_0xa6f6('0x31')]=_0xad4aec[_0xa6f6('0x24')];}var _0x35987b={'url':_0x3142a6+_0xa6f6('0x32')+_0xad4aec['username']+_0xa6f6('0x33')+_0xad4aec[_0xa6f6('0x2f')],'method':'GET'};rp(_0x35987b)[_0xa6f6('0x1d')](function(_0x4bd470){var _0x3f254d=_0x4bd470[_0xa6f6('0x34')](';');var _0x35c079={'user_key':_0x3f254d[0x0],'session_key':_0x3f254d[0x1]};_0x35987b={'url':_0x3142a6+_0xa6f6('0x35'),'method':_0xa6f6('0x36'),'headers':{'user_key':_0x35c079[_0xa6f6('0x37')],'Session_key':_0x35c079[_0xa6f6('0x38')]},'json':!![],'body':_0x17830e};return rp(_0x35987b);})[_0xa6f6('0x1d')](function(_0x3b9037){if(_0x3b9037[_0xa6f6('0x39')]>=0x1){var _0x242c59={'messageId':_0x3b9037[_0xa6f6('0x3a')]};if(_0xad4aec['smsMethod']!=='GP'||!_0xad4aec[_0xa6f6('0x3b')]){_0x242c59[_0xa6f6('0x3c')]=!![];}return _0x4b9f19['update'](_0x242c59);}else{return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x3d'),util['inspect'](_0x3b9037,{'showHidden':![],'depth':null}));}})['catch'](function(_0x47fce0){return logger[_0xa6f6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa6f6('0x2a'),_0xa6f6('0x3d'),util['inspect'](_0x47fce0,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x3d'),_0xa6f6('0x3e'));}break;case _0xa6f6('0x3f'):if(_0xad4aec['authToken']){var _0x3eb287={'recipient':_0x37efc9['phone'],'message':_0x37efc9[_0xa6f6('0xe')],'sender':_0xad4aec['senderString']||_0xad4aec['phone'],'authorization':_0xad4aec[_0xa6f6('0x21')]};var _0x4dfdbc={'method':_0xa6f6('0x36'),'uri':_0xa6f6('0x40'),'body':_0x3eb287,'json':!![]};rp(_0x4dfdbc)[_0xa6f6('0x1d')](function(_0x586273){var _0x35a593={'messageId':_0x586273[_0xa6f6('0x41')]};if(!_0xad4aec[_0xa6f6('0x3b')]){_0x35a593[_0xa6f6('0x3c')]=!![];}return _0x4b9f19[_0xa6f6('0x1a')](_0x35a593);})[_0xa6f6('0x1b')](function(_0x17f00e){logger[_0xa6f6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa6f6('0x2a'),'connectel',util[_0xa6f6('0x2b')](_0x17f00e,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'connectel',_0xa6f6('0x42'));}break;case'clicksend':if(_0xad4aec[_0xa6f6('0x2e')]&&_0xad4aec[_0xa6f6('0x2f')]){var _0x3eb287={'messages':[{'source':'xCALLY\x20Motion','to':_0x37efc9['phone'],'body':_0x37efc9[_0xa6f6('0xe')],'from':_0xad4aec[_0xa6f6('0x43')]||_0xad4aec[_0xa6f6('0x24')]}]};var _0x5312de=util[_0xa6f6('0x44')](_0xa6f6('0x45'),_0xad4aec[_0xa6f6('0x2e')],_0xad4aec[_0xa6f6('0x2f')]);var _0x4dfdbc={'method':_0xa6f6('0x36'),'uri':_0xa6f6('0x46'),'body':_0x3eb287,'headers':{'Authorization':util[_0xa6f6('0x44')](_0xa6f6('0x47'),new Buffer(_0x5312de)['toString'](_0xa6f6('0x48')))},'json':!![]};rp(_0x4dfdbc)['then'](function(_0x16bdf3){if(_0x16bdf3['http_code']>=0xc8&&_0x16bdf3[_0xa6f6('0x49')]<=0xce){if(_0x16bdf3[_0xa6f6('0x4a')]&&_0x16bdf3[_0xa6f6('0x4a')][_0xa6f6('0x4b')]>0x0){var _0x523413=_[_0xa6f6('0x4c')](_0x16bdf3[_0xa6f6('0x4a')]['messages']);var _0x398574={'messageId':_0x523413[_0xa6f6('0x4d')]};if(!_0xad4aec[_0xa6f6('0x3b')]){_0x398574[_0xa6f6('0x3c')]=!![];}return _0x4b9f19['update'](_0x398574);}else{logger[_0xa6f6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa6f6('0x4e'),util['inspect'](_0x16bdf3,{'showHidden':![],'depth':null}));}}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x4e'),util[_0xa6f6('0x2b')](_0x16bdf3,{'showHidden':![],'depth':null}));}})[_0xa6f6('0x1b')](function(_0x5c78dd){logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x4e'),util[_0xa6f6('0x2b')](_0x5c78dd,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'clickSend',_0xa6f6('0x3e'));}break;case _0xa6f6('0x4f'):if(_0xad4aec['authId']&&_0xad4aec[_0xa6f6('0x21')]){var _0x3eb287={'dst':_0x37efc9[_0xa6f6('0x24')],'text':_0x37efc9[_0xa6f6('0xe')],'src':_0xad4aec[_0xa6f6('0x43')]||_0xad4aec[_0xa6f6('0x24')],'url':_0xad4aec['remote']+_0xa6f6('0x50')+_0x37efc9['id']+_0xa6f6('0x26')+_0xad4aec[_0xa6f6('0x27')]};var _0x5312de=util['format']('%s:%s',_0xad4aec[_0xa6f6('0x51')],_0xad4aec[_0xa6f6('0x21')]);var _0x4dfdbc={'method':'POST','uri':util[_0xa6f6('0x44')](_0xa6f6('0x52'),_0xad4aec[_0xa6f6('0x51')]),'body':_0x3eb287,'headers':{'Authorization':util[_0xa6f6('0x44')](_0xa6f6('0x47'),new Buffer(_0x5312de)[_0xa6f6('0x53')](_0xa6f6('0x48')))},'json':!![]};rp(_0x4dfdbc)[_0xa6f6('0x1d')](function(_0x12ad7b){var _0x441695={'messageId':_0x12ad7b[_0xa6f6('0x54')][0x0]};return _0x4b9f19[_0xa6f6('0x1a')](_0x441695);})[_0xa6f6('0x1b')](function(_0x6b027b){logger['error'](_0xa6f6('0x29'),_0xa6f6('0x2a'),'plivo',util['inspect'](_0x6b027b,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xa6f6('0x55'):if(_0xad4aec[_0xa6f6('0x2e')]&&_0xad4aec[_0xa6f6('0x2f')]){if(_0xad4aec[_0xa6f6('0x56')]){var _0x28edae={'method':'POST','uri':_0xad4aec[_0xa6f6('0x56')]+'/auth/1/session','body':{'username':_0xad4aec['username'],'password':_0xad4aec[_0xa6f6('0x2f')]},'json':!![]};return rp(_0x28edae)[_0xa6f6('0x1d')](function(_0x2118f6){var _0x494ffd={'method':'POST','uri':_0xad4aec['baseUrl']+_0xa6f6('0x57'),'body':{'messages':[{'from':_0xad4aec[_0xa6f6('0x24')],'destinations':[{'to':_0x37efc9[_0xa6f6('0x24')]}],'text':_0x37efc9[_0xa6f6('0xe')],'notifyUrl':_0xad4aec[_0xa6f6('0x25')]+_0xa6f6('0x50')+_0x37efc9['id']+_0xa6f6('0x26')+_0xad4aec[_0xa6f6('0x27')],'notifyContentType':_0xa6f6('0x58'),'callbackData':_0xad4aec[_0xa6f6('0x24')]+';'+_0x37efc9[_0xa6f6('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2118f6[_0xa6f6('0x27')]},'json':!![]};return rp(_0x494ffd)['then'](function(_0x15bb48){if(_0x15bb48[_0xa6f6('0x22')]){var _0x30f3d0={'messageId':_0x15bb48[_0xa6f6('0x22')][0x0][_0xa6f6('0xc')]};if(!_0xad4aec['deliveryReport']){_0x30f3d0[_0xa6f6('0x3c')]=!![];}return _0x4b9f19[_0xa6f6('0x1a')](_0x30f3d0);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa6f6('0x2a'),_0xa6f6('0x55'),util['inspect'](_0x15bb48,{'showHidden':![],'depth':null}));}});})[_0xa6f6('0x1b')](function(_0x5a763f){return logger['error'](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x55'),util['inspect'](_0x5a763f,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),'afterCreate',_0xa6f6('0x55'),_0xa6f6('0x59'));}}else{logger['error'](_0xa6f6('0x29'),_0xa6f6('0x2a'),'infobip',_0xa6f6('0x3e'));}break;case _0xa6f6('0x5a'):var _0x39e9c3=require('crypto');if(_0xad4aec['apiKey']){var _0x87b8fe={};_0x87b8fe[_0xa6f6('0x5b')]=_0xad4aec[_0xa6f6('0x2e')];_0x87b8fe[_0xa6f6('0x24')]=_0x37efc9[_0xa6f6('0x24')];_0x87b8fe[_0xa6f6('0x31')]=_0xad4aec[_0xa6f6('0x24')];_0x87b8fe['text']=_0x37efc9['body'];_0x87b8fe['timestamp']=+new Date();var _0x297502='';var _0x3525e4='';var _0x36e684=Object[_0xa6f6('0x5c')](_0x87b8fe);_0x36e684[_0xa6f6('0x5d')]();for(var _0xe32d5a=0x0;_0xe32d5a<_0x36e684['length'];_0xe32d5a++){if(_0x297502!=''){_0x297502+='&';}_0x297502+=_0x36e684[_0xe32d5a]+'='+encodeURIComponent(_0x87b8fe[_0x36e684[_0xe32d5a]]);_0x3525e4+=_0x87b8fe[_0x36e684[_0xe32d5a]];}_0x3525e4+=_0xad4aec['apiKey'];_0x3525e4=_0x39e9c3[_0xa6f6('0x5e')](_0xa6f6('0x5f'))[_0xa6f6('0x1a')](_0x3525e4)[_0xa6f6('0x60')](_0xa6f6('0x61'));if(_0x297502!==''){_0x297502+='&';}_0x297502+=_0xa6f6('0x62')+_0x3525e4;var _0x35987b={'method':'GET','uri':_0xad4aec['baseUrl']+'/external/get/send.php?'+_0x297502,'json':!![]};return rp(_0x35987b)['then'](function(_0x5c3e1b){var _0x2d48a5=Object[_0xa6f6('0x5c')](_0x5c3e1b);if(_0x5c3e1b[_0x2d48a5[0x0]][_0xa6f6('0x2c')]&&parseInt(_0x5c3e1b[_0x2d48a5[0x0]][_0xa6f6('0x2c')])===0x0){var _0x429c65={'messageId':_0x5c3e1b[_0x2d48a5[0x0]]['id_sms']};if(!_0xad4aec[_0xa6f6('0x3b')]){_0x429c65[_0xa6f6('0x3c')]=!![];}return _0x4b9f19[_0xa6f6('0x1a')](_0x429c65);}else{return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'csc',util[_0xa6f6('0x2b')](_0x5c3e1b['error'],{'showHidden':![],'depth':null}));}})[_0xa6f6('0x1b')](function(_0x10f80d){return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'csc',util[_0xa6f6('0x2b')](_0x10f80d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa6f6('0x29'),'afterCreate',_0xa6f6('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0xa6f6('0x63'):if(_0xad4aec[_0xa6f6('0x64')]){var _0x4c9a4d={'method':_0xa6f6('0x36'),'uri':_0xa6f6('0x65'),'headers':{'Authorization':_0xad4aec['apiKey']},'body':{'content':_0x37efc9[_0xa6f6('0xe')],'to':[_0x37efc9[_0xa6f6('0x24')]],'from':_0xad4aec[_0xa6f6('0x24')],'binary':![],'clientMessageId':_0xa6f6('0x66'),'charset':_0xa6f6('0x67')},'json':!![]};rp(_0x4c9a4d)[_0xa6f6('0x1d')](function(_0x2c0f07){if(!_0x2c0f07['error']){var _0x56b2c2={'messageId':_0x2c0f07[_0xa6f6('0x22')][0x0][_0xa6f6('0x68')]};if(!_0xad4aec['deliveryReport']){_0x56b2c2[_0xa6f6('0x3c')]=!![];}return _0x4b9f19[_0xa6f6('0x1a')](_0x56b2c2);}else{return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x63'),util['inspect'](_0x2c0f07[_0xa6f6('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x410348){return logger['error'](_0xa6f6('0x29'),_0xa6f6('0x2a'),'clickatell',util['inspect'](_0x410348,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa6f6('0x2a'),_0xa6f6('0x63'),'Missing\x20parameters:\x20apiKey');}break;case _0xa6f6('0x69'):if(_0xad4aec[_0xa6f6('0x2e')]&&_0xad4aec[_0xa6f6('0x2f')]){var _0x5312de=util[_0xa6f6('0x44')](_0xa6f6('0x45'),_0xad4aec['username'],_0xad4aec[_0xa6f6('0x2f')]);var _0x4dfdbc={'method':_0xa6f6('0x36'),'uri':_0xa6f6('0x6a')+_0xad4aec[_0xa6f6('0x6b')]+'/messages','body':{'to':[_0x37efc9[_0xa6f6('0x24')]],'text':_0x37efc9[_0xa6f6('0xe')],'from':_0xad4aec[_0xa6f6('0x24')],'applicationId':_0xad4aec[_0xa6f6('0x6c')]},'headers':{'Authorization':util['format'](_0xa6f6('0x47'),new Buffer(_0x5312de)[_0xa6f6('0x53')](_0xa6f6('0x48')))},'json':!![]};rp(_0x4dfdbc)[_0xa6f6('0x1d')](function(_0x54bdba){if(_0x54bdba['id']){var _0x1cab8c={'messageId':_0x54bdba['id']};return _0x4b9f19['update'](_0x1cab8c);}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),'afterCreate',_0xa6f6('0x69'),util[_0xa6f6('0x2b')](_0x54bdba,{'showHidden':![],'depth':null}));}})['catch'](function(_0x15fad4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa6f6('0x2a'),_0xa6f6('0x69'),util[_0xa6f6('0x2b')](_0x15fad4,{'showHidden':![],'depth':null}));});}else{logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'bandwidth',_0xa6f6('0x3e'));}break;case _0xa6f6('0x6d'):if(_0xad4aec[_0xa6f6('0x64')]){var _0x5b8a97={};var _0x35987b={'method':'POST','uri':_0xa6f6('0x6e'),'headers':{'Authorization':_0xa6f6('0x6f')+_0xad4aec[_0xa6f6('0x64')],'Content-Type':_0xa6f6('0x58')},'body':{'from':_0xad4aec[_0xa6f6('0x24')],'to':_0x37efc9[_0xa6f6('0x24')],'text':_0x37efc9[_0xa6f6('0xe')]},'json':!![]};return rp(_0x35987b)[_0xa6f6('0x1d')](function(_0x10fd91){if(_0x10fd91['code']==0xca){_0x5b8a97[_0xa6f6('0x70')]=_0x10fd91;var _0x4ae85e={'method':_0xa6f6('0x36'),'uri':_0xa6f6('0x71'),'headers':{'Authorization':_0xa6f6('0x6f')+_0xad4aec[_0xa6f6('0x64')],'Content-Type':'application/json'},'body':{'refid':_0x5b8a97[_0xa6f6('0x70')][_0xa6f6('0x72')]},'json':!![]};return rp(_0x4ae85e)[_0xa6f6('0x1d')](function(_0x2e44df){_0x5b8a97[_0xa6f6('0x73')]=_0x2e44df;var _0x236241={'messageId':_0x5b8a97['message'][_0xa6f6('0x72')],'read':!![]};return _0x4b9f19[_0xa6f6('0x1a')](_0x236241);});}else{return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),'intelepeer',util[_0xa6f6('0x2b')](_0x10fd91,{'showHidden':![],'depth':null}));}})[_0xa6f6('0x1b')](function(_0xa3c807){return logger[_0xa6f6('0x2c')](_0xa6f6('0x29'),_0xa6f6('0x2a'),_0xa6f6('0x6d'),util[_0xa6f6('0x2b')](_0xa3c807,{'showHidden':![],'depth':null}));});}else{return logger[_0xa6f6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0xa6f6('0x74')](function(){_0x13f294();});}else{_0x13f294();}}},'charset':_0xa6f6('0x75'),'collate':_0xa6f6('0x76')});}; \ No newline at end of file +var _0x5fc6=['https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','length','digest','hex','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0x5fc6,0x132));var _0x65fc=function(_0x822b46,_0x5fe4e1){_0x822b46=_0x822b46-0x0;var _0x4ebddb=_0x5fc6[_0x822b46];return _0x4ebddb;};'use strict';var _=require(_0x65fc('0x0'));var util=require(_0x65fc('0x1'));var logger=require('../../config/logger')(_0x65fc('0x2'));var moment=require(_0x65fc('0x3'));var BPromise=require(_0x65fc('0x4'));var rp=require(_0x65fc('0x5'));var fs=require('fs');var path=require(_0x65fc('0x6'));var rimraf=require(_0x65fc('0x7'));var config=require(_0x65fc('0x8'));var attributes=require(_0x65fc('0x9'));module[_0x65fc('0xa')]=function(_0x38dabb,_0x4f0863){return _0x38dabb[_0x65fc('0xb')](_0x65fc('0xc'),attributes,{'tableName':_0x65fc('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x65fc('0xe')]},{'name':_0x65fc('0xf'),'fields':[_0x65fc('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8369f4,_0x9b3069,_0x44509f){var _0x1d7bc5=_0x38dabb[_0x65fc('0x11')];var _0x5d52a5=_0x8369f4[_0x65fc('0x12')]({'plain':!![]});if(_0x5d52a5['direction']['toLowerCase']()==='in'||_0x5d52a5[_0x65fc('0x13')][_0x65fc('0x14')]()===_0x65fc('0x15')&&!_0x5d52a5['secret']&&!_[_0x65fc('0x16')](_0x5d52a5['UserId'])){_0x1d7bc5[_0x65fc('0x17')][_0x65fc('0x18')]({'where':{'id':_0x5d52a5[_0x65fc('0x19')]}})[_0x65fc('0x1a')](function(_0x2a4e9d){if(_0x2a4e9d){_0x2a4e9d['update']({'lastMsgAt':_0x5d52a5[_0x65fc('0x1b')],'lastMsgDirection':_0x5d52a5[_0x65fc('0x13')][_0x65fc('0x14')]()});}})[_0x65fc('0x1c')](function(_0x435b90){console[_0x65fc('0x1d')](_0x435b90);});}if(_0x5d52a5[_0x65fc('0x13')]==='out'&&!_0x5d52a5[_0x65fc('0x1e')]){var _0x9fed05;_0x1d7bc5[_0x65fc('0x1f')]['find']({'where':{'id':_0x5d52a5[_0x65fc('0x20')]},'raw':!![]})[_0x65fc('0x1a')](function(_0x51ea62){_0x9fed05=_0x51ea62;if(_0x9fed05&&_0x9fed05[_0x65fc('0x21')]){switch(_0x9fed05[_0x65fc('0x21')]){case _0x65fc('0x22'):var _0x537c9e=require('twilio');if(_0x9fed05[_0x65fc('0x23')]&&_0x9fed05[_0x65fc('0x24')]&&_0x9fed05[_0x65fc('0x25')]){var _0x323278=new _0x537c9e(_0x9fed05[_0x65fc('0x23')],_0x9fed05['authToken']);_0x323278[_0x65fc('0x26')][_0x65fc('0x27')]({'body':_0x5d52a5[_0x65fc('0x10')],'to':_0x5d52a5[_0x65fc('0x25')],'from':_0x9fed05[_0x65fc('0x25')],'statusCallback':_0x9fed05[_0x65fc('0x28')]+_0x65fc('0x29')+_0x5d52a5['id']+_0x65fc('0x2a')+_0x9fed05[_0x65fc('0x2b')]})['then'](function(_0x273d66){if(_0x273d66[_0x65fc('0x2c')]){return _0x8369f4[_0x65fc('0x2d')]({'messageId':_0x273d66[_0x65fc('0x2c')]});}})[_0x65fc('0x1c')](function(_0x517035){logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),'twilio',util[_0x65fc('0x30')](_0x517035,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate','twilio',_0x65fc('0x31'));}break;case _0x65fc('0x32'):var _0x2bce0e=_0x65fc('0x33');if(_0x9fed05[_0x65fc('0x34')]&&_0x9fed05[_0x65fc('0x35')]){var _0xfc62b2={'recipient':[_0x5d52a5[_0x65fc('0x25')]],'message':_0x5d52a5[_0x65fc('0x10')],'message_type':_0x9fed05['smsMethod']};if(_0x9fed05[_0x65fc('0x36')]&&_0x9fed05[_0x65fc('0x36')]!=='SI'){_0xfc62b2[_0x65fc('0x37')]=_0x9fed05[_0x65fc('0x25')];}var _0x29a503={'url':_0x2bce0e+_0x65fc('0x38')+_0x9fed05[_0x65fc('0x34')]+_0x65fc('0x39')+_0x9fed05[_0x65fc('0x35')],'method':_0x65fc('0x3a')};rp(_0x29a503)['then'](function(_0x2905c3){var _0x24722a=_0x2905c3[_0x65fc('0x3b')](';');var _0x46000c={'user_key':_0x24722a[0x0],'session_key':_0x24722a[0x1]};_0x29a503={'url':_0x2bce0e+_0x65fc('0x3c'),'method':_0x65fc('0x3d'),'headers':{'user_key':_0x46000c[_0x65fc('0x3e')],'Session_key':_0x46000c[_0x65fc('0x3f')]},'json':!![],'body':_0xfc62b2};return rp(_0x29a503);})[_0x65fc('0x1a')](function(_0x56dc8d){if(_0x56dc8d['total_sent']>=0x1){var _0x5dca0e={'messageId':_0x56dc8d[_0x65fc('0x40')]};if(_0x9fed05['smsMethod']!=='GP'||!_0x9fed05[_0x65fc('0x41')]){_0x5dca0e[_0x65fc('0x42')]=!![];}return _0x8369f4[_0x65fc('0x2d')](_0x5dca0e);}else{return logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65fc('0x2f'),'skebby',util[_0x65fc('0x30')](_0x56dc8d,{'showHidden':![],'depth':null}));}})[_0x65fc('0x1c')](function(_0x58a78a){return logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate','skebby',util[_0x65fc('0x30')](_0x58a78a,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x32'),_0x65fc('0x43'));}break;case'connectel':if(_0x9fed05['authToken']){var _0x5021a0={'recipient':_0x5d52a5[_0x65fc('0x25')],'message':_0x5d52a5['body'],'sender':_0x9fed05[_0x65fc('0x44')]||_0x9fed05[_0x65fc('0x25')],'authorization':_0x9fed05['authToken']};var _0x9b3069={'method':_0x65fc('0x3d'),'uri':_0x65fc('0x45'),'body':_0x5021a0,'json':!![]};rp(_0x9b3069)[_0x65fc('0x1a')](function(_0x80ce32){var _0x3d4126={'messageId':_0x80ce32['requestid']};if(!_0x9fed05[_0x65fc('0x41')]){_0x3d4126['read']=!![];}return _0x8369f4['update'](_0x3d4126);})[_0x65fc('0x1c')](function(_0x556b32){logger['error'](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x46'),util['inspect'](_0x556b32,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x46'),_0x65fc('0x47'));}break;case'clicksend':if(_0x9fed05['username']&&_0x9fed05[_0x65fc('0x35')]){var _0x5021a0={'messages':[{'source':_0x65fc('0x48'),'to':_0x5d52a5[_0x65fc('0x25')],'body':_0x5d52a5['body'],'from':_0x9fed05[_0x65fc('0x44')]||_0x9fed05[_0x65fc('0x25')]}]};var _0x268b12=util['format'](_0x65fc('0x49'),_0x9fed05[_0x65fc('0x34')],_0x9fed05[_0x65fc('0x35')]);var _0x9b3069={'method':_0x65fc('0x3d'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5021a0,'headers':{'Authorization':util[_0x65fc('0x4a')](_0x65fc('0x4b'),new Buffer(_0x268b12)[_0x65fc('0x4c')](_0x65fc('0x4d')))},'json':!![]};rp(_0x9b3069)[_0x65fc('0x1a')](function(_0x462a97){if(_0x462a97[_0x65fc('0x4e')]>=0xc8&&_0x462a97[_0x65fc('0x4e')]<=0xce){if(_0x462a97['data']&&_0x462a97['data'][_0x65fc('0x4f')]>0x0){var _0x475673=_[_0x65fc('0x50')](_0x462a97[_0x65fc('0x51')]['messages']);var _0x305405={'messageId':_0x475673[_0x65fc('0x52')]};if(!_0x9fed05['deliveryReport']){_0x305405[_0x65fc('0x42')]=!![];}return _0x8369f4[_0x65fc('0x2d')](_0x305405);}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate',_0x65fc('0x53'),util['inspect'](_0x462a97,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65fc('0x2f'),_0x65fc('0x53'),util[_0x65fc('0x30')](_0x462a97,{'showHidden':![],'depth':null}));}})['catch'](function(_0x487f42){logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate',_0x65fc('0x53'),util[_0x65fc('0x30')](_0x487f42,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0x65fc('0x43'));}break;case _0x65fc('0x54'):if(_0x9fed05[_0x65fc('0x55')]&&_0x9fed05[_0x65fc('0x24')]){var _0x5021a0={'dst':_0x5d52a5[_0x65fc('0x25')],'text':_0x5d52a5[_0x65fc('0x10')],'src':_0x9fed05[_0x65fc('0x44')]||_0x9fed05['phone'],'url':_0x9fed05[_0x65fc('0x28')]+_0x65fc('0x29')+_0x5d52a5['id']+'/status?token='+_0x9fed05[_0x65fc('0x2b')]};var _0x268b12=util[_0x65fc('0x4a')](_0x65fc('0x49'),_0x9fed05[_0x65fc('0x55')],_0x9fed05[_0x65fc('0x24')]);var _0x9b3069={'method':_0x65fc('0x3d'),'uri':util[_0x65fc('0x4a')]('https://api.plivo.com/v1/Account/%s/Message/',_0x9fed05[_0x65fc('0x55')]),'body':_0x5021a0,'headers':{'Authorization':util[_0x65fc('0x4a')](_0x65fc('0x4b'),new Buffer(_0x268b12)[_0x65fc('0x4c')](_0x65fc('0x4d')))},'json':!![]};rp(_0x9b3069)[_0x65fc('0x1a')](function(_0x45d5bc){var _0xb3948c={'messageId':_0x45d5bc[_0x65fc('0x56')][0x0]};return _0x8369f4[_0x65fc('0x2d')](_0xb3948c);})[_0x65fc('0x1c')](function(_0x4315a5){logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate',_0x65fc('0x54'),util['inspect'](_0x4315a5,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),'plivo',_0x65fc('0x57'));}break;case _0x65fc('0x58'):if(_0x9fed05['username']&&_0x9fed05[_0x65fc('0x35')]){if(_0x9fed05[_0x65fc('0x59')]){var _0x3d8d54={'method':_0x65fc('0x3d'),'uri':_0x9fed05[_0x65fc('0x59')]+_0x65fc('0x5a'),'body':{'username':_0x9fed05[_0x65fc('0x34')],'password':_0x9fed05['password']},'json':!![]};return rp(_0x3d8d54)[_0x65fc('0x1a')](function(_0xfadc66){var _0x31290e={'method':_0x65fc('0x3d'),'uri':_0x9fed05['baseUrl']+_0x65fc('0x5b'),'body':{'messages':[{'from':_0x9fed05[_0x65fc('0x25')],'destinations':[{'to':_0x5d52a5[_0x65fc('0x25')]}],'text':_0x5d52a5[_0x65fc('0x10')],'notifyUrl':_0x9fed05[_0x65fc('0x28')]+'/api/sms/messages/'+_0x5d52a5['id']+'/status?token='+_0x9fed05[_0x65fc('0x2b')],'notifyContentType':_0x65fc('0x5c'),'callbackData':_0x9fed05[_0x65fc('0x25')]+';'+_0x5d52a5['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0xfadc66[_0x65fc('0x2b')]},'json':!![]};return rp(_0x31290e)[_0x65fc('0x1a')](function(_0x3f9c64){if(_0x3f9c64[_0x65fc('0x26')]){var _0x58aeef={'messageId':_0x3f9c64[_0x65fc('0x26')][0x0][_0x65fc('0xe')]};if(!_0x9fed05[_0x65fc('0x41')]){_0x58aeef[_0x65fc('0x42')]=!![];}return _0x8369f4[_0x65fc('0x2d')](_0x58aeef);}else{return logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65fc('0x2f'),'infobip',util['inspect'](_0x3f9c64,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4838cc){return logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),'infobip',util[_0x65fc('0x30')](_0x4838cc,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65fc('0x2f'),_0x65fc('0x58'),_0x65fc('0x5d'));}}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate','infobip',_0x65fc('0x43'));}break;case _0x65fc('0x5e'):var _0x196f7f=require(_0x65fc('0x5f'));if(_0x9fed05[_0x65fc('0x60')]){var _0xfa7bc7={};_0xfa7bc7[_0x65fc('0x61')]=_0x9fed05[_0x65fc('0x34')];_0xfa7bc7[_0x65fc('0x25')]=_0x5d52a5[_0x65fc('0x25')];_0xfa7bc7[_0x65fc('0x37')]=_0x9fed05[_0x65fc('0x25')];_0xfa7bc7['text']=_0x5d52a5[_0x65fc('0x10')];_0xfa7bc7[_0x65fc('0x62')]=+new Date();var _0x991a81='';var _0x58fc21='';var _0x5e4f63=Object[_0x65fc('0x63')](_0xfa7bc7);_0x5e4f63[_0x65fc('0x64')]();for(var _0x29d6de=0x0;_0x29d6de<_0x5e4f63[_0x65fc('0x65')];_0x29d6de++){if(_0x991a81!=''){_0x991a81+='&';}_0x991a81+=_0x5e4f63[_0x29d6de]+'='+encodeURIComponent(_0xfa7bc7[_0x5e4f63[_0x29d6de]]);_0x58fc21+=_0xfa7bc7[_0x5e4f63[_0x29d6de]];}_0x58fc21+=_0x9fed05[_0x65fc('0x60')];_0x58fc21=_0x196f7f['createHash']('md5')[_0x65fc('0x2d')](_0x58fc21)[_0x65fc('0x66')](_0x65fc('0x67'));if(_0x991a81!==''){_0x991a81+='&';}_0x991a81+='signature='+_0x58fc21;var _0x29a503={'method':_0x65fc('0x3a'),'uri':_0x9fed05[_0x65fc('0x59')]+'/external/get/send.php?'+_0x991a81,'json':!![]};return rp(_0x29a503)[_0x65fc('0x1a')](function(_0x3ad2a1){var _0x55cb61=Object[_0x65fc('0x63')](_0x3ad2a1);if(_0x3ad2a1[_0x55cb61[0x0]][_0x65fc('0x1d')]&&parseInt(_0x3ad2a1[_0x55cb61[0x0]][_0x65fc('0x1d')])===0x0){var _0x10f809={'messageId':_0x3ad2a1[_0x55cb61[0x0]][_0x65fc('0x68')]};if(!_0x9fed05['deliveryReport']){_0x10f809[_0x65fc('0x42')]=!![];}return _0x8369f4[_0x65fc('0x2d')](_0x10f809);}else{return logger['error'](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x5e'),util[_0x65fc('0x30')](_0x3ad2a1[_0x65fc('0x1d')],{'showHidden':![],'depth':null}));}})[_0x65fc('0x1c')](function(_0x4a59c7){return logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate',_0x65fc('0x5e'),util[_0x65fc('0x30')](_0x4a59c7,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),'afterCreate','csc',_0x65fc('0x69'));}break;case _0x65fc('0x6a'):if(_0x9fed05['apiKey']){var _0x15099c={'method':_0x65fc('0x3d'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x9fed05[_0x65fc('0x60')]},'body':{'content':_0x5d52a5[_0x65fc('0x10')],'to':[_0x5d52a5['phone']],'from':_0x9fed05['phone'],'binary':![],'clientMessageId':_0x65fc('0x6b'),'charset':_0x65fc('0x6c')},'json':!![]};rp(_0x15099c)[_0x65fc('0x1a')](function(_0x12a676){if(!_0x12a676[_0x65fc('0x1d')]){var _0x3db0fa={'messageId':_0x12a676['messages'][0x0][_0x65fc('0x6d')]};if(!_0x9fed05['deliveryReport']){_0x3db0fa[_0x65fc('0x42')]=!![];}return _0x8369f4['update'](_0x3db0fa);}else{return logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x6a'),util[_0x65fc('0x30')](_0x12a676['error'],{'showHidden':![],'depth':null}));}})[_0x65fc('0x1c')](function(_0x2f3512){return logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65fc('0x2f'),_0x65fc('0x6a'),util['inspect'](_0x2f3512,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x6a'),_0x65fc('0x69'));}break;case _0x65fc('0x6e'):if(_0x9fed05[_0x65fc('0x34')]&&_0x9fed05[_0x65fc('0x35')]){var _0x268b12=util[_0x65fc('0x4a')](_0x65fc('0x49'),_0x9fed05[_0x65fc('0x34')],_0x9fed05[_0x65fc('0x35')]);var _0x9b3069={'method':_0x65fc('0x3d'),'uri':_0x65fc('0x6f')+_0x9fed05[_0x65fc('0x70')]+_0x65fc('0x71'),'body':{'to':[_0x5d52a5['phone']],'text':_0x5d52a5['body'],'from':_0x9fed05[_0x65fc('0x25')],'applicationId':_0x9fed05[_0x65fc('0x72')]},'headers':{'Authorization':util[_0x65fc('0x4a')](_0x65fc('0x4b'),new Buffer(_0x268b12)[_0x65fc('0x4c')](_0x65fc('0x4d')))},'json':!![]};rp(_0x9b3069)[_0x65fc('0x1a')](function(_0x46dfd9){if(_0x46dfd9['id']){var _0x1e42b1={'messageId':_0x46dfd9['id']};return _0x8369f4[_0x65fc('0x2d')](_0x1e42b1);}else{logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x6e'),util[_0x65fc('0x30')](_0x46dfd9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x22ded7){logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),'bandwidth',util[_0x65fc('0x30')](_0x22ded7,{'showHidden':![],'depth':null}));});}else{logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65fc('0x6e'),_0x65fc('0x43'));}break;case'intelepeer':if(_0x9fed05[_0x65fc('0x60')]){var _0xe37541={};var _0x29a503={'method':_0x65fc('0x3d'),'uri':_0x65fc('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x9fed05['apiKey'],'Content-Type':_0x65fc('0x5c')},'body':{'from':_0x9fed05[_0x65fc('0x25')],'to':_0x5d52a5[_0x65fc('0x25')],'text':_0x5d52a5[_0x65fc('0x10')]},'json':!![]};return rp(_0x29a503)['then'](function(_0xe7616a){if(_0xe7616a[_0x65fc('0x74')]==0xca){_0xe37541[_0x65fc('0x75')]=_0xe7616a;var _0x44a8a9={'method':_0x65fc('0x3d'),'uri':_0x65fc('0x76'),'headers':{'Authorization':_0x65fc('0x77')+_0x9fed05[_0x65fc('0x60')],'Content-Type':_0x65fc('0x5c')},'body':{'refid':_0xe37541['message'][_0x65fc('0x78')]},'json':!![]};return rp(_0x44a8a9)[_0x65fc('0x1a')](function(_0x25095c){_0xe37541[_0x65fc('0x79')]=_0x25095c;var _0x469ec7={'messageId':_0xe37541[_0x65fc('0x75')][_0x65fc('0x78')],'read':!![]};return _0x8369f4[_0x65fc('0x2d')](_0x469ec7);});}else{return logger[_0x65fc('0x1d')](_0x65fc('0x2e'),_0x65fc('0x2f'),_0x65fc('0x7a'),util[_0x65fc('0x30')](_0xe7616a,{'showHidden':![],'depth':null}));}})[_0x65fc('0x1c')](function(_0x13adf3){return logger[_0x65fc('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x65fc('0x30')](_0x13adf3,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x65fc('0x2e'),'afterCreate',_0x65fc('0x7a'),'Token\x20not\x20received');}break;}}})[_0x65fc('0x7b')](function(){_0x44509f();});}else{_0x44509f();}}},'charset':_0x65fc('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 56e6075..aef3dd2 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 _0x37b9=['CreateSmsMessage','create','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x18ebd3,_0x3ab0a9){var _0x547fc3=function(_0x220906){while(--_0x220906){_0x18ebd3['push'](_0x18ebd3['shift']());}};_0x547fc3(++_0x3ab0a9);}(_0x37b9,0x64));var _0x937b=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x37b9[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x937b('0x0'));var util=require(_0x937b('0x1'));var moment=require(_0x937b('0x2'));var BPromise=require('bluebird');var rs=require(_0x937b('0x3'));var fs=require('fs');var Redis=require(_0x937b('0x4'));var db=require(_0x937b('0x5'))['db'];var utils=require(_0x937b('0x6'));var logger=require(_0x937b('0x7'))(_0x937b('0x8'));var config=require(_0x937b('0x9'));var jayson=require(_0x937b('0xa'));var client=jayson[_0x937b('0xb')]['http']({'port':0x232a});config['redis']=_[_0x937b('0xc')](config[_0x937b('0xd')],{'host':_0x937b('0xe'),'port':0x18eb});var socket=require(_0x937b('0xf'))(new Redis(config[_0x937b('0xd')]));require(_0x937b('0x10'))[_0x937b('0x11')](socket);function respondWithRpcPromise(_0xeaf1c0,_0x6823d,_0x14f503){return new BPromise(function(_0x4d88a8,_0x2cabff){return client['request'](_0xeaf1c0,_0x14f503)[_0x937b('0x12')](function(_0x474dc4){logger[_0x937b('0x13')](_0x937b('0x14'),_0x6823d,'request\x20sent');logger['debug'](_0x937b('0x15'),_0x6823d,_0x937b('0x16'),JSON[_0x937b('0x17')](_0x474dc4));if(_0x474dc4[_0x937b('0x18')]){if(_0x474dc4['error']['code']===0x1f4){logger[_0x937b('0x18')]('SmsMessage,\x20%s,\x20%s',_0x6823d,_0x474dc4[_0x937b('0x18')][_0x937b('0x19')]);return _0x2cabff(_0x474dc4[_0x937b('0x18')]['message']);}logger[_0x937b('0x18')](_0x937b('0x14'),_0x6823d,_0x474dc4['error'][_0x937b('0x19')]);return _0x4d88a8(_0x474dc4['error'][_0x937b('0x19')]);}else{logger[_0x937b('0x13')](_0x937b('0x14'),_0x6823d,_0x937b('0x16'));_0x4d88a8(_0x474dc4[_0x937b('0x1a')][_0x937b('0x19')]);}})[_0x937b('0x1b')](function(_0x5027d3){logger[_0x937b('0x18')](_0x937b('0x14'),_0x6823d,_0x5027d3);_0x2cabff(_0x5027d3);});});}exports[_0x937b('0x1c')]=function(_0x4daedc){var _0x2c7216=this;return new Promise(function(_0x5414c1,_0x291e5e){return db['SmsMessage'][_0x937b('0x1d')](_0x4daedc[_0x937b('0x1e')],{'raw':_0x4daedc[_0x937b('0x1f')]?_0x4daedc[_0x937b('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x937b('0x12')](function(_0x20d18c){logger[_0x937b('0x13')]('CreateSmsMessage',_0x4daedc);logger['debug'](_0x937b('0x1c'),_0x4daedc,JSON[_0x937b('0x17')](_0x20d18c));_0x5414c1(_0x20d18c);})[_0x937b('0x1b')](function(_0x2e6661){logger[_0x937b('0x18')](_0x937b('0x1c'),_0x2e6661['message'],_0x4daedc);_0x291e5e(_0x2c7216[_0x937b('0x18')](0x1f4,_0x2e6661[_0x937b('0x19')]));});});}; \ No newline at end of file +var _0x1e65=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsMessage','options','CreateSmsMessage'];(function(_0x9a86fc,_0x405ef5){var _0x32b0ba=function(_0xca1299){while(--_0xca1299){_0x9a86fc['push'](_0x9a86fc['shift']());}};_0x32b0ba(++_0x405ef5);}(_0x1e65,0x74));var _0x51e6=function(_0x1c9d7c,_0x3bc12b){_0x1c9d7c=_0x1c9d7c-0x0;var _0x443e32=_0x1e65[_0x1c9d7c];return _0x443e32;};'use strict';var _=require(_0x51e6('0x0'));var util=require(_0x51e6('0x1'));var moment=require(_0x51e6('0x2'));var BPromise=require(_0x51e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51e6('0x4'));var db=require(_0x51e6('0x5'))['db'];var utils=require(_0x51e6('0x6'));var logger=require(_0x51e6('0x7'))('rpc');var config=require(_0x51e6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x51e6('0x9')]({'port':0x232a});config[_0x51e6('0xa')]=_[_0x51e6('0xb')](config[_0x51e6('0xa')],{'host':_0x51e6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51e6('0xa')]));require(_0x51e6('0xd'))['register'](socket);function respondWithRpcPromise(_0x313910,_0x227835,_0x1895e2){return new BPromise(function(_0x4af7f0,_0x11c4ba){return client[_0x51e6('0xe')](_0x313910,_0x1895e2)[_0x51e6('0xf')](function(_0x278eeb){logger[_0x51e6('0x10')](_0x51e6('0x11'),_0x227835,_0x51e6('0x12'));logger[_0x51e6('0x13')](_0x51e6('0x14'),_0x227835,_0x51e6('0x12'),JSON[_0x51e6('0x15')](_0x278eeb));if(_0x278eeb[_0x51e6('0x16')]){if(_0x278eeb[_0x51e6('0x16')][_0x51e6('0x17')]===0x1f4){logger['error'](_0x51e6('0x11'),_0x227835,_0x278eeb['error'][_0x51e6('0x18')]);return _0x11c4ba(_0x278eeb['error']['message']);}logger[_0x51e6('0x16')]('SmsMessage,\x20%s,\x20%s',_0x227835,_0x278eeb[_0x51e6('0x16')][_0x51e6('0x18')]);return _0x4af7f0(_0x278eeb['error']['message']);}else{logger[_0x51e6('0x10')](_0x51e6('0x11'),_0x227835,_0x51e6('0x12'));_0x4af7f0(_0x278eeb[_0x51e6('0x19')][_0x51e6('0x18')]);}})['catch'](function(_0x52716a){logger[_0x51e6('0x16')]('SmsMessage,\x20%s,\x20%s',_0x227835,_0x52716a);_0x11c4ba(_0x52716a);});});}exports['CreateSmsMessage']=function(_0x12df8a){var _0xe98ce4=this;return new Promise(function(_0x4c3bda,_0xd38dae){return db[_0x51e6('0x1a')]['create'](_0x12df8a['body'],{'raw':_0x12df8a['options']?_0x12df8a[_0x51e6('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x253179){logger[_0x51e6('0x10')](_0x51e6('0x1c'),_0x12df8a);logger[_0x51e6('0x13')](_0x51e6('0x1c'),_0x12df8a,JSON[_0x51e6('0x15')](_0x253179));_0x4c3bda(_0x253179);})['catch'](function(_0x29a3d0){logger[_0x51e6('0x16')]('CreateSmsMessage',_0x29a3d0['message'],_0x12df8a);_0xd38dae(_0xe98ce4[_0x51e6('0x16')](0x1f4,_0x29a3d0[_0x51e6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 04b3ec5..e0129d3 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 _0x0a85=['save','remove','update','register','length','./smsMessage.events'];(function(_0x26e823,_0x519649){var _0x50fd0b=function(_0x175d6f){while(--_0x175d6f){_0x26e823['push'](_0x26e823['shift']());}};_0x50fd0b(++_0x519649);}(_0x0a85,0x1a9));var _0x50a8=function(_0x5be2c9,_0x5edc40){_0x5be2c9=_0x5be2c9-0x0;var _0x71ed0=_0x0a85[_0x5be2c9];return _0x71ed0;};'use strict';var SmsMessageEvents=require(_0x50a8('0x0'));var events=[_0x50a8('0x1'),_0x50a8('0x2'),_0x50a8('0x3')];function createListener(_0x56e901,_0x1d1d50){return function(_0x4524bb){_0x1d1d50['emit'](_0x56e901,_0x4524bb);};}function removeListener(_0x27eb81,_0x2a2453){return function(){SmsMessageEvents['removeListener'](_0x27eb81,_0x2a2453);};}exports[_0x50a8('0x4')]=function(_0x1ffc48){for(var _0x3a3d26=0x0,_0x4bbb68=events[_0x50a8('0x5')];_0x3a3d26<_0x4bbb68;_0x3a3d26++){var _0x114a68=events[_0x3a3d26];var _0x5427d2=createListener('smsMessage:'+_0x114a68,_0x1ffc48);SmsMessageEvents['on'](_0x114a68,_0x5427d2);}}; \ No newline at end of file +var _0x0bd5=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x27c3f0,_0x198aa2){var _0x11e51c=function(_0x2a48ec){while(--_0x2a48ec){_0x27c3f0['push'](_0x27c3f0['shift']());}};_0x11e51c(++_0x198aa2);}(_0x0bd5,0x10d));var _0x50bd=function(_0x29ded5,_0x228eb2){_0x29ded5=_0x29ded5-0x0;var _0x15a2fb=_0x0bd5[_0x29ded5];return _0x15a2fb;};'use strict';var SmsMessageEvents=require(_0x50bd('0x0'));var events=[_0x50bd('0x1'),'remove',_0x50bd('0x2')];function createListener(_0x2de0b0,_0x53c9ec){return function(_0x576e4f){_0x53c9ec[_0x50bd('0x3')](_0x2de0b0,_0x576e4f);};}function removeListener(_0x454337,_0x11ffe8){return function(){SmsMessageEvents[_0x50bd('0x4')](_0x454337,_0x11ffe8);};}exports[_0x50bd('0x5')]=function(_0x3312ea){for(var _0x81cd84=0x0,_0x29edc6=events[_0x50bd('0x6')];_0x81cd84<_0x29edc6;_0x81cd84++){var _0x1458c4=events[_0x81cd84];var _0x4b6359=createListener(_0x50bd('0x7')+_0x1458c4,_0x3312ea);SmsMessageEvents['on'](_0x1458c4,_0x4b6359);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 113c64c..e007208 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 _0xf03a=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xf03a,0x1a0));var _0xaf03=function(_0x1aeab7,_0x1849cb){_0x1aeab7=_0x1aeab7-0x0;var _0x19c68f=_0xf03a[_0x1aeab7];return _0x19c68f;};'use strict';var multer=require('multer');var util=require(_0xaf03('0x0'));var path=require(_0xaf03('0x1'));var timeout=require(_0xaf03('0x2'));var express=require(_0xaf03('0x3'));var router=express['Router']();var auth=require(_0xaf03('0x4'));var interaction=require(_0xaf03('0x5'));var config=require('../../config/environment');var controller=require(_0xaf03('0x6'));router[_0xaf03('0x7')]('/',auth[_0xaf03('0x8')](),controller[_0xaf03('0x9')]);router['get'](_0xaf03('0xa'),auth['isAuthenticated'](),controller[_0xaf03('0xb')]);router[_0xaf03('0x7')](_0xaf03('0xc'),auth[_0xaf03('0x8')](),controller[_0xaf03('0xd')]);router[_0xaf03('0x7')]('/:id/members',auth[_0xaf03('0x8')](),controller[_0xaf03('0xe')]);router[_0xaf03('0x7')](_0xaf03('0xf'),auth[_0xaf03('0x8')](),controller['getTeams']);router[_0xaf03('0x7')](_0xaf03('0x10'),auth[_0xaf03('0x8')](),controller[_0xaf03('0x11')]);router[_0xaf03('0x12')]('/',auth[_0xaf03('0x8')](),controller[_0xaf03('0x13')]);router['post']('/:id/teams',auth[_0xaf03('0x8')](),controller[_0xaf03('0x14')]);router[_0xaf03('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xaf03('0x15')]);router[_0xaf03('0x16')](_0xaf03('0xc'),auth[_0xaf03('0x8')](),controller[_0xaf03('0x17')]);router[_0xaf03('0x18')]('/:id',auth[_0xaf03('0x8')](),controller[_0xaf03('0x19')]);router[_0xaf03('0x18')](_0xaf03('0xf'),auth[_0xaf03('0x8')](),controller[_0xaf03('0x1a')]);router['delete']('/:id/users',auth[_0xaf03('0x8')](),controller[_0xaf03('0x1b')]);module[_0xaf03('0x1c')]=router; \ No newline at end of file +var _0xfd20=['removeAgents','exports','util','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','addTeams','put','update','destroy','/:id/teams','delete'];(function(_0x381e6b,_0x4f566d){var _0x1bbe8f=function(_0x143334){while(--_0x143334){_0x381e6b['push'](_0x381e6b['shift']());}};_0x1bbe8f(++_0x4f566d);}(_0xfd20,0x66));var _0x0fd2=function(_0x4fc9c1,_0x570e05){_0x4fc9c1=_0x4fc9c1-0x0;var _0x15d7a1=_0xfd20[_0x4fc9c1];return _0x15d7a1;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fd2('0x3'));var config=require('../../config/environment');var controller=require(_0x0fd2('0x4'));router[_0x0fd2('0x5')]('/',auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x7')]);router[_0x0fd2('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x0fd2('0x8')]);router[_0x0fd2('0x5')](_0x0fd2('0x9'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xa')]);router[_0x0fd2('0x5')](_0x0fd2('0xb'),auth['isAuthenticated'](),controller[_0x0fd2('0xc')]);router[_0x0fd2('0x5')]('/:id/teams',auth[_0x0fd2('0x6')](),controller['getTeams']);router[_0x0fd2('0x5')](_0x0fd2('0xd'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xe')]);router[_0x0fd2('0xf')]('/',auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x10')]);router[_0x0fd2('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0fd2('0x11')]);router[_0x0fd2('0xf')](_0x0fd2('0xd'),auth[_0x0fd2('0x6')](),controller['addAgents']);router[_0x0fd2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0fd2('0x13')]);router['delete'](_0x0fd2('0x9'),auth['isAuthenticated'](),controller[_0x0fd2('0x14')]);router['delete'](_0x0fd2('0x15'),auth[_0x0fd2('0x6')](),controller['removeTeams']);router[_0x0fd2('0x16')]('/:id/users',auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x17')]);module[_0x0fd2('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 142bf25..79f8bd5 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 _0x6616=['beepall','roundrobin','sequelize','exports','name','STRING','rrmemory'];(function(_0x4be503,_0x2f2549){var _0x2cdc68=function(_0xa6221c){while(--_0xa6221c){_0x4be503['push'](_0x4be503['shift']());}};_0x2cdc68(++_0x2f2549);}(_0x6616,0x13d));var _0x6661=function(_0x535c87,_0x291926){_0x535c87=_0x535c87-0x0;var _0x32fcbb=_0x6616[_0x535c87];return _0x32fcbb;};'use strict';var Sequelize=require(_0x6661('0x0'));module[_0x6661('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6661('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6661('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6661('0x4'),_0x6661('0x5'),_0x6661('0x6'))}}; \ No newline at end of file +var _0x5912=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4826f7,_0x2581cb){var _0x5f298e=function(_0x178a2d){while(--_0x178a2d){_0x4826f7['push'](_0x4826f7['shift']());}};_0x5f298e(++_0x2581cb);}(_0x5912,0x1cf));var _0x2591=function(_0x3af11e,_0x1aa52a){_0x3af11e=_0x3af11e-0x0;var _0x8313b3=_0x5912[_0x3af11e];return _0x8313b3;};'use strict';var Sequelize=require(_0x2591('0x0'));module['exports']={'name':{'type':Sequelize[_0x2591('0x1')],'unique':_0x2591('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2591('0x1')]},'timeout':{'type':Sequelize[_0x2591('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2591('0x4')](_0x2591('0x5'),_0x2591('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5ff730f..0d9446c 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 _0xd67b=['from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','SmsQueue','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAndCountAll','UserId','createdAt','format','%s/%s','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','User','select'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xd67b,0x133));var _0xbd67=function(_0x110e48,_0x333761){_0x110e48=_0x110e48-0x0;var _0x2b8ead=_0xd67b[_0x110e48];return _0x2b8ead;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd67('0x1'));var jsonpatch=require(_0xbd67('0x2'));var rp=require(_0xbd67('0x3'));var moment=require('moment');var BPromise=require(_0xbd67('0x4'));var Mustache=require('mustache');var util=require(_0xbd67('0x5'));var path=require('path');var sox=require(_0xbd67('0x6'));var csv=require(_0xbd67('0x7'));var ejs=require(_0xbd67('0x8'));var fs=require('fs');var _=require(_0xbd67('0x9'));var squel=require(_0xbd67('0xa'));var crypto=require(_0xbd67('0xb'));var jsforce=require(_0xbd67('0xc'));var deskjs=require(_0xbd67('0xd'));var toCsv=require(_0xbd67('0x7'));var querystring=require(_0xbd67('0xe'));var Papa=require(_0xbd67('0xf'));var Redis=require(_0xbd67('0x10'));var authService=require(_0xbd67('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd67('0x12'));var logger=require('../../config/logger')(_0xbd67('0x13'));var utils=require(_0xbd67('0x14'));var config=require(_0xbd67('0x15'));var licenseUtil=require(_0xbd67('0x16'));var db=require(_0xbd67('0x17'))['db'];config[_0xbd67('0x18')]=_[_0xbd67('0x19')](config[_0xbd67('0x18')],{'host':_0xbd67('0x1a'),'port':0x18eb});var socket=require(_0xbd67('0x1b'))(new Redis(config['redis']));require(_0xbd67('0x1c'))[_0xbd67('0x1d')](socket);function respondWithStatusCode(_0x2a5efd,_0x2abcf2){_0x2abcf2=_0x2abcf2||0xcc;return function(_0x84bdf1){if(_0x84bdf1){return _0x2a5efd[_0xbd67('0x1e')](_0x2abcf2);}return _0x2a5efd[_0xbd67('0x1f')](_0x2abcf2)[_0xbd67('0x20')]();};}function respondWithResult(_0xa45c76,_0x140df9){_0x140df9=_0x140df9||0xc8;return function(_0x591de9){if(_0x591de9){return _0xa45c76['status'](_0x140df9)[_0xbd67('0x21')](_0x591de9);}};}function respondWithFilteredResult(_0x475e36,_0xff31b){return function(_0x47d066){if(_0x47d066){var _0x3c0d33=_0x47d066[_0xbd67('0x22')],_0x2e0e21=_0xff31b['offset'],_0x357ff2=_0xff31b[_0xbd67('0x23')]+_0xff31b[_0xbd67('0x24')],_0x4b764f;if(_0x357ff2>=_0x3c0d33){_0x357ff2=_0x3c0d33;_0x4b764f=0xc8;}else{_0x4b764f=0xce;}_0x475e36[_0xbd67('0x1f')](_0x4b764f);return _0x475e36['set'](_0xbd67('0x25'),_0x2e0e21+'-'+_0x357ff2+'/'+_0x3c0d33)[_0xbd67('0x21')](_0x47d066);}return null;};}function patchUpdates(_0x37836c){return function(_0x32037f){try{jsonpatch[_0xbd67('0x26')](_0x32037f,_0x37836c,!![]);}catch(_0x4576c4){return BPromise['reject'](_0x4576c4);}return _0x32037f[_0xbd67('0x27')]();};}function saveUpdates(_0x36a634,_0x36cd19){return function(_0x78fe55){if(_0x78fe55){return _0x78fe55[_0xbd67('0x28')](_0x36a634)[_0xbd67('0x29')](function(_0x46c519){return _0x46c519;});}return null;};}function removeEntity(_0x922df8,_0x107827){return function(_0x36f7c8){if(_0x36f7c8){return _0x36f7c8[_0xbd67('0x2a')]()['then'](function(){var _0x3b75dc=_0x36f7c8['get']({'plain':!![]});var _0x25bf7a=_0xbd67('0x2b');return db[_0xbd67('0x2c')]['destroy']({'where':{'type':_0x25bf7a,'resourceId':_0x3b75dc['id']}})[_0xbd67('0x29')](function(){return _0x36f7c8;});})[_0xbd67('0x29')](function(){_0x922df8['status'](0xcc)[_0xbd67('0x20')]();});}};}function handleEntityNotFound(_0x1b3253,_0x374f1b){return function(_0x1c66ae){if(!_0x1c66ae){_0x1b3253[_0xbd67('0x1e')](0x194);}return _0x1c66ae;};}function handleError(_0x55c2d4,_0x5975dc){_0x5975dc=_0x5975dc||0x1f4;return function(_0x41856b){logger[_0xbd67('0x2d')](_0x41856b[_0xbd67('0x2e')]);if(_0x41856b[_0xbd67('0x2f')]){delete _0x41856b[_0xbd67('0x2f')];}_0x55c2d4[_0xbd67('0x1f')](_0x5975dc)[_0xbd67('0x30')](_0x41856b);};}exports[_0xbd67('0x31')]=function(_0x3436bd,_0x34e5a8){var _0x5cb0ce={},_0x5793ca={},_0x5fcae8={'count':0x0,'rows':[]};var _0x2b6d5a=_[_0xbd67('0x32')](db['SmsQueue'][_0xbd67('0x33')],function(_0x15da85){return{'name':_0x15da85[_0xbd67('0x34')],'type':_0x15da85[_0xbd67('0x35')]['key']};});_0x5793ca['model']=_['map'](_0x2b6d5a,_0xbd67('0x2f'));_0x5793ca[_0xbd67('0x36')]=_[_0xbd67('0x37')](_0x3436bd['query']);_0x5793ca['filters']=_[_0xbd67('0x38')](_0x5793ca[_0xbd67('0x39')],_0x5793ca[_0xbd67('0x36')]);_0x5cb0ce[_0xbd67('0x3a')]=_[_0xbd67('0x38')](_0x5793ca[_0xbd67('0x39')],qs['fields'](_0x3436bd[_0xbd67('0x36')][_0xbd67('0x3b')]));_0x5cb0ce[_0xbd67('0x3a')]=_0x5cb0ce['attributes'][_0xbd67('0x3c')]?_0x5cb0ce['attributes']:_0x5793ca[_0xbd67('0x39')];if(!_0x3436bd[_0xbd67('0x36')]['hasOwnProperty'](_0xbd67('0x3d'))){_0x5cb0ce[_0xbd67('0x24')]=qs[_0xbd67('0x24')](_0x3436bd[_0xbd67('0x36')][_0xbd67('0x24')]);_0x5cb0ce[_0xbd67('0x23')]=qs['offset'](_0x3436bd[_0xbd67('0x36')][_0xbd67('0x23')]);}_0x5cb0ce[_0xbd67('0x3e')]=qs[_0xbd67('0x3f')](_0x3436bd[_0xbd67('0x36')]['sort']);_0x5cb0ce['where']=qs[_0xbd67('0x40')](_[_0xbd67('0x41')](_0x3436bd[_0xbd67('0x36')],_0x5793ca['filters']),_0x2b6d5a);if(_0x3436bd[_0xbd67('0x36')][_0xbd67('0x42')]){_0x5cb0ce[_0xbd67('0x43')]=_[_0xbd67('0x44')](_0x5cb0ce['where'],{'$or':_['map'](_0x2b6d5a,function(_0x53cbee){if(_0x53cbee['type']!=='VIRTUAL'){var _0x2bca16={};_0x2bca16[_0x53cbee['name']]={'$like':'%'+_0x3436bd['query']['filter']+'%'};return _0x2bca16;}})});}_0x5cb0ce=_[_0xbd67('0x44')]({},_0x5cb0ce,_0x3436bd[_0xbd67('0x45')]);var _0x1abc7f={'where':_0x5cb0ce[_0xbd67('0x43')]};return db['SmsQueue'][_0xbd67('0x22')](_0x1abc7f)[_0xbd67('0x29')](function(_0x3f69c5){_0x5fcae8[_0xbd67('0x22')]=_0x3f69c5;if(_0x3436bd[_0xbd67('0x36')][_0xbd67('0x46')]){_0x5cb0ce[_0xbd67('0x47')]=[{'all':!![]}];}return db['SmsQueue'][_0xbd67('0x48')](_0x5cb0ce);})['then'](function(_0x20fd56){_0x5fcae8[_0xbd67('0x49')]=_0x20fd56;return _0x5fcae8;})[_0xbd67('0x29')](respondWithFilteredResult(_0x34e5a8,_0x5cb0ce))[_0xbd67('0x4a')](handleError(_0x34e5a8,null));};exports[_0xbd67('0x4b')]=function(_0x3ec233,_0x308e15){var _0xfe170b={'raw':!![],'where':{'id':_0x3ec233[_0xbd67('0x4c')]['id']}},_0x4dd9c1={};_0x4dd9c1[_0xbd67('0x39')]=_['keys'](db[_0xbd67('0x4d')][_0xbd67('0x33')]);_0x4dd9c1[_0xbd67('0x36')]=_['keys'](_0x3ec233['query']);_0x4dd9c1[_0xbd67('0x40')]=_[_0xbd67('0x38')](_0x4dd9c1[_0xbd67('0x39')],_0x4dd9c1['query']);_0xfe170b[_0xbd67('0x3a')]=_[_0xbd67('0x38')](_0x4dd9c1['model'],qs['fields'](_0x3ec233['query']['fields']));_0xfe170b[_0xbd67('0x3a')]=_0xfe170b[_0xbd67('0x3a')][_0xbd67('0x3c')]?_0xfe170b[_0xbd67('0x3a')]:_0x4dd9c1[_0xbd67('0x39')];if(_0x3ec233['query'][_0xbd67('0x46')]){_0xfe170b[_0xbd67('0x47')]=[{'all':!![]}];}_0xfe170b=_['merge']({},_0xfe170b,_0x3ec233[_0xbd67('0x45')]);return db[_0xbd67('0x4d')][_0xbd67('0x4e')](_0xfe170b)[_0xbd67('0x29')](handleEntityNotFound(_0x308e15,null))[_0xbd67('0x29')](respondWithResult(_0x308e15,null))['catch'](handleError(_0x308e15,null));};exports[_0xbd67('0x4f')]=function(_0x5ae43b,_0xe476dc){return db[_0xbd67('0x4d')]['create'](_0x5ae43b[_0xbd67('0x50')],{})[_0xbd67('0x29')](function(_0x1428f3){var _0x5af027=_0x5ae43b[_0xbd67('0x51')][_0xbd67('0x52')]({'plain':!![]});if(!_0x5af027)throw new Error(_0xbd67('0x53'));if(_0x5af027[_0xbd67('0x54')]===_0xbd67('0x51')){var _0x15f2f0=_0x1428f3[_0xbd67('0x52')]({'plain':!![]});var _0x565b13='SmsQueues';return db[_0xbd67('0x55')][_0xbd67('0x4e')]({'where':{'name':_0x565b13,'userProfileId':_0x5af027[_0xbd67('0x56')]},'raw':!![]})[_0xbd67('0x29')](function(_0x3d092){if(_0x3d092&&_0x3d092['autoAssociation']===0x0){return db['UserProfileResource'][_0xbd67('0x4f')]({'name':_0x15f2f0[_0xbd67('0x2f')],'resourceId':_0x15f2f0['id'],'type':_0x3d092[_0xbd67('0x2f')],'sectionId':_0x3d092['id']},{})[_0xbd67('0x29')](function(){return _0x1428f3;});}else{return _0x1428f3;}})[_0xbd67('0x4a')](function(_0x28ded5){logger[_0xbd67('0x2d')](_0xbd67('0x57'),_0x28ded5);throw _0x28ded5;});}return _0x1428f3;})[_0xbd67('0x29')](respondWithResult(_0xe476dc,0xc9))[_0xbd67('0x4a')](handleError(_0xe476dc,null));};exports['update']=function(_0x4d4784,_0x249a8f){if(_0x4d4784['body']['id']){delete _0x4d4784[_0xbd67('0x50')]['id'];}return db[_0xbd67('0x4d')][_0xbd67('0x4e')]({'where':{'id':_0x4d4784[_0xbd67('0x4c')]['id']}})['then'](handleEntityNotFound(_0x249a8f,null))[_0xbd67('0x29')](saveUpdates(_0x4d4784[_0xbd67('0x50')],null))[_0xbd67('0x29')](respondWithResult(_0x249a8f,null))['catch'](handleError(_0x249a8f,null));};exports[_0xbd67('0x2a')]=function(_0x563bd3,_0x166dfe){return db[_0xbd67('0x4d')]['find']({'where':{'id':_0x563bd3[_0xbd67('0x4c')]['id']}})[_0xbd67('0x29')](handleEntityNotFound(_0x166dfe,null))[_0xbd67('0x29')](removeEntity(_0x166dfe,null))[_0xbd67('0x4a')](handleError(_0x166dfe,null));};exports[_0xbd67('0x58')]=function(_0x2843ac,_0x434cd8){return db[_0xbd67('0x4d')][_0xbd67('0x58')]()[_0xbd67('0x29')](respondWithResult(_0x434cd8,null))[_0xbd67('0x4a')](handleError(_0x434cd8,null));};exports[_0xbd67('0x59')]=function(_0x2ee62e,_0x303da4,_0x3a9f86){var _0x27cef0={'raw':!![],'where':{}},_0x16f722={},_0x4d144b;return db['SmsQueue'][_0xbd67('0x5a')]({'where':{'id':_0x2ee62e[_0xbd67('0x4c')]['id']}})['then'](handleEntityNotFound(_0x303da4,null))[_0xbd67('0x29')](function(_0x276218){if(_0x276218){_0x4d144b=_0x276218[_0xbd67('0x52')]({'plain':!![]});_0x16f722['model']=_[_0xbd67('0x37')](db[_0xbd67('0x5b')][_0xbd67('0x33')]);_0x16f722[_0xbd67('0x36')]=_[_0xbd67('0x37')](_0x2ee62e[_0xbd67('0x36')]);_0x16f722['filters']=_[_0xbd67('0x38')](_0x16f722['model'],_0x16f722[_0xbd67('0x36')]);_0x27cef0[_0xbd67('0x3a')]=_['intersection'](_0x16f722['model'],qs[_0xbd67('0x3b')](_0x2ee62e[_0xbd67('0x36')][_0xbd67('0x3b')]));_0x27cef0[_0xbd67('0x3a')]=_0x27cef0[_0xbd67('0x3a')]['length']?_0x27cef0[_0xbd67('0x3a')]:_0x16f722[_0xbd67('0x39')];if(!_0x2ee62e[_0xbd67('0x36')][_0xbd67('0x5c')](_0xbd67('0x3d'))){_0x27cef0[_0xbd67('0x24')]=qs[_0xbd67('0x24')](_0x2ee62e[_0xbd67('0x36')][_0xbd67('0x24')]);_0x27cef0[_0xbd67('0x23')]=qs[_0xbd67('0x23')](_0x2ee62e['query'][_0xbd67('0x23')]);}_0x27cef0[_0xbd67('0x3e')]=qs['sort'](_0x2ee62e[_0xbd67('0x36')][_0xbd67('0x3f')]);_0x27cef0[_0xbd67('0x43')]=qs['filters'](_['pick'](_0x2ee62e[_0xbd67('0x36')],_0x16f722['filters']));_0x27cef0[_0xbd67('0x43')][_0xbd67('0x5d')]=_0x276218['id'];if(_0x2ee62e['query'][_0xbd67('0x42')]){_0x27cef0[_0xbd67('0x43')]=_[_0xbd67('0x44')](_0x27cef0[_0xbd67('0x43')],{'$or':_['map'](_0x27cef0[_0xbd67('0x3a')],function(_0x204091){var _0x55c71f={};_0x55c71f[_0x204091]={'$like':'%'+_0x2ee62e[_0xbd67('0x36')][_0xbd67('0x42')]+'%'};return _0x55c71f;})});}_0x27cef0=_[_0xbd67('0x44')]({},_0x27cef0,_0x2ee62e['options']);return db[_0xbd67('0x5b')][_0xbd67('0x48')](_0x27cef0);}})[_0xbd67('0x29')](function(_0x2e56cc){if(_0x2e56cc){return db['User'][_0xbd67('0x5e')]({'where':{'id':_[_0xbd67('0x32')](_0x2e56cc,_0xbd67('0x5f')),'role':'agent'},'attributes':['id',_0xbd67('0x2f'),'smsPause','updatedAt',_0xbd67('0x60')]});}})[_0xbd67('0x29')](function(_0x35a56e){if(_0x35a56e){return{'count':_0x35a56e[_0xbd67('0x22')],'rows':_[_0xbd67('0x32')](_0x35a56e[_0xbd67('0x49')],function(_0x429076){return{'membername':_0x429076[_0xbd67('0x2f')],'UserId':_0x429076['id'],'queue_name':_0x4d144b[_0xbd67('0x2f')],'SmsQueueId':_0x4d144b['id'],'interface':util[_0xbd67('0x61')](_0xbd67('0x62'),_0xbd67('0x63'),_0x429076[_0xbd67('0x2f')]),'penalty':0x0,'paused':_0x429076[_0xbd67('0x64')],'createdAt':_0x429076['createdAt'],'updatedAt':_0x429076[_0xbd67('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x303da4,_0x27cef0))['catch'](handleError(_0x303da4,null));};exports[_0xbd67('0x66')]=function(_0x185da8,_0x11487e,_0x26e872){var _0x406853={};var _0x3afa71={};var _0x565e37;var _0x45ff72;return db['SmsQueue']['findOne']({'where':{'id':_0x185da8['params']['id']}})[_0xbd67('0x29')](handleEntityNotFound(_0x11487e,null))[_0xbd67('0x29')](function(_0x2cc861){if(_0x2cc861){_0x565e37=_0x2cc861;_0x3afa71[_0xbd67('0x39')]=_[_0xbd67('0x37')](db[_0xbd67('0x67')]['rawAttributes']);_0x3afa71[_0xbd67('0x36')]=_[_0xbd67('0x37')](_0x185da8[_0xbd67('0x36')]);_0x3afa71['filters']=_['intersection'](_0x3afa71[_0xbd67('0x39')],_0x3afa71[_0xbd67('0x36')]);_0x406853[_0xbd67('0x3a')]=_['intersection'](_0x3afa71[_0xbd67('0x39')],qs[_0xbd67('0x3b')](_0x185da8['query'][_0xbd67('0x3b')]));_0x406853[_0xbd67('0x3a')]=_0x406853[_0xbd67('0x3a')][_0xbd67('0x3c')]?_0x406853[_0xbd67('0x3a')]:_0x3afa71[_0xbd67('0x39')];_0x406853[_0xbd67('0x3e')]=qs[_0xbd67('0x3f')](_0x185da8['query']['sort']);_0x406853[_0xbd67('0x43')]=qs[_0xbd67('0x40')](_[_0xbd67('0x41')](_0x185da8[_0xbd67('0x36')],_0x3afa71['filters']));if(_0x185da8[_0xbd67('0x36')][_0xbd67('0x42')]){_0x406853[_0xbd67('0x43')]=_['merge'](_0x406853['where'],{'$or':_[_0xbd67('0x32')](_0x406853['attributes'],function(_0x5a3811){var _0x3dd30a={};_0x3dd30a[_0x5a3811]={'$like':'%'+_0x185da8[_0xbd67('0x36')][_0xbd67('0x42')]+'%'};return _0x3dd30a;})});}_0x406853=_[_0xbd67('0x44')]({},_0x406853,_0x185da8['options']);return _0x565e37[_0xbd67('0x66')](_0x406853);}})[_0xbd67('0x29')](function(_0x3bbb48){if(_0x3bbb48){_0x45ff72=_0x3bbb48[_0xbd67('0x3c')];if(!_0x185da8[_0xbd67('0x36')][_0xbd67('0x5c')](_0xbd67('0x3d'))){_0x406853[_0xbd67('0x24')]=qs[_0xbd67('0x24')](_0x185da8[_0xbd67('0x36')][_0xbd67('0x24')]);_0x406853[_0xbd67('0x23')]=qs[_0xbd67('0x23')](_0x185da8['query'][_0xbd67('0x23')]);}return _0x565e37['getTeams'](_0x406853);}})[_0xbd67('0x29')](function(_0x2011c3){if(_0x2011c3){return _0x2011c3?{'count':_0x45ff72,'rows':_0x2011c3}:null;}})[_0xbd67('0x29')](respondWithResult(_0x11487e,null))[_0xbd67('0x4a')](handleError(_0x11487e,null));};exports[_0xbd67('0x68')]=function(_0x1aee48,_0x4dda6c,_0x5e01c2){var _0x606263=_0x1aee48[_0xbd67('0x50')][_0xbd67('0x69')];return db['Team'][_0xbd67('0x48')]({'where':{'id':_0x606263},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xbd67('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0x3c98e1){if(_0x3c98e1){var _0x38abc1=_[_0xbd67('0x6b')](_0x3c98e1,function(_0x23844b){var _0x22646d=_0x23844b[_0xbd67('0x52')]({'plain':!![]});return _0x22646d[_0xbd67('0x6c')];});return db[_0xbd67('0x4d')][_0xbd67('0x4e')]({'where':{'id':_0x1aee48[_0xbd67('0x4c')]['id']}})['then'](function(_0x5241cb){return db[_0xbd67('0x6d')][_0xbd67('0x6e')](function(_0x322d27){return _0x5241cb[_0xbd67('0x68')](_0x606263,{'transaction':_0x322d27})['then'](function(){return BPromise[_0xbd67('0x6f')](_0x38abc1,function(_0x40b5c4){return db[_0xbd67('0x5b')][_0xbd67('0x70')]({'where':{'UserId':_0x40b5c4['id'],'SmsQueueId':_0x1aee48['params']['id']},'transaction':_0x322d27});});})[_0xbd67('0x29')](function(){_0x38abc1[_0xbd67('0x71')](function(_0x30601f){socket[_0xbd67('0x72')](_0xbd67('0x73'),{'UserId':_0x30601f['id'],'SmsQueueId':_0x5241cb['id']});});});});});}})[_0xbd67('0x29')](respondWithStatusCode(_0x4dda6c,null))[_0xbd67('0x4a')](handleError(_0x4dda6c,null));};exports[_0xbd67('0x74')]=function(_0x545893,_0x3a54d1,_0x59c14a){return db[_0xbd67('0x67')][_0xbd67('0x48')]({'where':{'id':_0x545893[_0xbd67('0x36')][_0xbd67('0x69')]},'attributes':['id'],'include':[{'model':db[_0xbd67('0x75')],'as':_0xbd67('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xbd67('0x29')](handleEntityNotFound(_0x3a54d1,null))[_0xbd67('0x29')](function(_0x33d9b9){var _0x405e21=_[_0xbd67('0x32')](_0x33d9b9,'id');var _0x59049e=[];var _0x34c994=[];var _0x280d1d=squel[_0xbd67('0x76')]();_0x280d1d['field']('tq.TeamId')[_0xbd67('0x77')](_0xbd67('0x78'),'tq')[_0xbd67('0x79')](_0xbd67('0x7a'),'ut',_0xbd67('0x7b'))[_0xbd67('0x43')](_0xbd67('0x7c'),_0x545893[_0xbd67('0x4c')]['id']);for(var _0x2ddab6=0x0;_0x2ddab6<_0x33d9b9[_0xbd67('0x3c')];_0x2ddab6+=0x1){let _0x365c59=_0x33d9b9[_0x2ddab6];for(var _0x2e7f26=0x0;_0x2e7f26<_0x365c59['Agents']['length'];_0x2e7f26+=0x1){let _0x16ac1d=_0x365c59[_0xbd67('0x6c')][_0x2e7f26];var _0x3696aa=_0x280d1d[_0xbd67('0x7d')]();_0x3696aa[_0xbd67('0x43')]('ut.UserId\x20=\x20?',_0x16ac1d['id']);_0x34c994[_0xbd67('0x7e')](db[_0xbd67('0x6d')][_0xbd67('0x36')](_0x3696aa['toString'](),{'type':db['sequelize'][_0xbd67('0x7f')]['SELECT']})[_0xbd67('0x29')](function(_0x333380){if(_0x333380[_0xbd67('0x3c')]===0x1){return _0x16ac1d['id'];}else{var _0x256e2d=_['every'](_['map'](_0x333380,_0xbd67('0x80')),function(_0x43ef04){return _[_0xbd67('0x81')](_0x405e21,_0x43ef04);});if(_0x256e2d){return _0x16ac1d['id'];}}}));}}return BPromise[_0xbd67('0x82')](_0x34c994)[_0xbd67('0x29')](function(_0x1dec85){_0x59049e=_(_0x59049e)[_0xbd67('0x83')](_0x1dec85)[_0xbd67('0x84')]()[_0xbd67('0x85')]();return db[_0xbd67('0x4d')][_0xbd67('0x4e')]({'where':{'id':_0x545893[_0xbd67('0x4c')]['id']}})['then'](function(_0x2ec959){return db['sequelize'][_0xbd67('0x6e')](function(_0xc07434){return _0x2ec959[_0xbd67('0x74')](_0x545893[_0xbd67('0x36')][_0xbd67('0x69')],{'transaction':_0xc07434})['then'](function(){if(!_[_0xbd67('0x86')](_0x59049e)){return _0x2ec959['removeAgents'](_0x59049e,{'transaction':_0xc07434});}})[_0xbd67('0x29')](function(){_0x59049e['forEach'](function(_0x4b3411){socket[_0xbd67('0x72')](_0xbd67('0x87'),{'UserId':_0x4b3411,'SmsQueueId':_0x2ec959['id']});});});});});});})[_0xbd67('0x29')](respondWithStatusCode(_0x3a54d1,null))[_0xbd67('0x4a')](handleError(_0x3a54d1,null));};exports[_0xbd67('0x88')]=function(_0x36ee8e,_0x2b3778,_0x3af84b){return db[_0xbd67('0x4d')][_0xbd67('0x4e')]({'where':{'id':_0x36ee8e[_0xbd67('0x4c')]['id']}})[_0xbd67('0x29')](handleEntityNotFound(_0x2b3778,null))['then'](function(_0x3a7cc6){if(_0x3a7cc6){return _0x3a7cc6[_0xbd67('0x88')](_0x36ee8e[_0xbd67('0x50')][_0xbd67('0x69')],_[_0xbd67('0x89')](_0x36ee8e[_0xbd67('0x50')],[_0xbd67('0x69'),'id'])||{})[_0xbd67('0x8a')](function(_0xd43e8c){for(var _0x3fe706=0x0;_0x3fe706<_0x36ee8e[_0xbd67('0x50')][_0xbd67('0x69')][_0xbd67('0x3c')];_0x3fe706+=0x1){socket['emit'](_0xbd67('0x73'),{'UserId':_0x36ee8e['body'][_0xbd67('0x69')][_0x3fe706],'SmsQueueId':_0x36ee8e['params']['id']});}return _0xd43e8c;});}})[_0xbd67('0x29')](respondWithResult(_0x2b3778,null))['catch'](handleError(_0x2b3778,null));};exports[_0xbd67('0x8b')]=function(_0x30928f,_0x895586,_0x283ef){return db[_0xbd67('0x4d')][_0xbd67('0x4e')]({'where':{'id':_0x30928f[_0xbd67('0x4c')]['id']}})[_0xbd67('0x29')](handleEntityNotFound(_0x895586,null))[_0xbd67('0x29')](function(_0x144c39){if(_0x144c39){return _0x144c39[_0xbd67('0x8b')](_0x30928f[_0xbd67('0x36')][_0xbd67('0x69')])[_0xbd67('0x29')](function(){if(_[_0xbd67('0x8c')](_0x30928f['query'][_0xbd67('0x69')])){for(var _0x495796=0x0;_0x495796<_0x30928f['query'][_0xbd67('0x69')][_0xbd67('0x3c')];_0x495796+=0x1){socket[_0xbd67('0x72')](_0xbd67('0x87'),{'UserId':Number(_0x30928f[_0xbd67('0x36')]['ids'][_0x495796]),'SmsQueueId':Number(_0x30928f[_0xbd67('0x4c')]['id'])});}}else{socket['emit'](_0xbd67('0x87'),{'UserId':Number(_0x30928f[_0xbd67('0x36')][_0xbd67('0x69')]),'SmsQueueId':Number(_0x30928f[_0xbd67('0x4c')]['id'])});}});}})[_0xbd67('0x29')](respondWithStatusCode(_0x895586,null))['catch'](handleError(_0x895586,null));};exports[_0xbd67('0x8d')]=function(_0x394d58,_0x354157,_0x2e5e1d){var _0x5141f8={};var _0x900e85={};var _0x2572a1;var _0x4e5baa;return db[_0xbd67('0x4d')][_0xbd67('0x5a')]({'where':{'id':_0x394d58[_0xbd67('0x4c')]['id']}})[_0xbd67('0x29')](handleEntityNotFound(_0x354157,null))[_0xbd67('0x29')](function(_0x4e5c68){if(_0x4e5c68){_0x2572a1=_0x4e5c68;_0x900e85['model']=_['keys'](db['User']['rawAttributes']);_0x900e85[_0xbd67('0x36')]=_[_0xbd67('0x37')](_0x394d58[_0xbd67('0x36')]);_0x900e85[_0xbd67('0x40')]=_['intersection'](_0x900e85['model'],_0x900e85[_0xbd67('0x36')]);_0x5141f8[_0xbd67('0x3a')]=_[_0xbd67('0x38')](_0x900e85[_0xbd67('0x39')],qs['fields'](_0x394d58[_0xbd67('0x36')][_0xbd67('0x3b')]));_0x5141f8[_0xbd67('0x3a')]=_0x5141f8[_0xbd67('0x3a')][_0xbd67('0x3c')]?_0x5141f8[_0xbd67('0x3a')]:_0x900e85['model'];_0x5141f8[_0xbd67('0x3e')]=qs[_0xbd67('0x3f')](_0x394d58[_0xbd67('0x36')][_0xbd67('0x3f')]);_0x5141f8[_0xbd67('0x43')]=qs[_0xbd67('0x40')](_[_0xbd67('0x41')](_0x394d58['query'],_0x900e85[_0xbd67('0x40')]));if(_0x394d58[_0xbd67('0x36')][_0xbd67('0x42')]){_0x5141f8[_0xbd67('0x43')]=_[_0xbd67('0x44')](_0x5141f8[_0xbd67('0x43')],{'$or':_[_0xbd67('0x32')](_0x5141f8[_0xbd67('0x3a')],function(_0x586196){var _0xbeecfc={};_0xbeecfc[_0x586196]={'$like':'%'+_0x394d58[_0xbd67('0x36')]['filter']+'%'};return _0xbeecfc;})});}_0x5141f8=_[_0xbd67('0x44')]({},_0x5141f8,_0x394d58[_0xbd67('0x45')]);return _0x2572a1['getAgents'](_0x5141f8);}})[_0xbd67('0x29')](function(_0x619e23){if(_0x619e23){_0x4e5baa=_0x619e23['length'];if(!_0x394d58[_0xbd67('0x36')][_0xbd67('0x5c')](_0xbd67('0x3d'))){_0x5141f8[_0xbd67('0x24')]=qs[_0xbd67('0x24')](_0x394d58[_0xbd67('0x36')]['limit']);_0x5141f8[_0xbd67('0x23')]=qs[_0xbd67('0x23')](_0x394d58['query'][_0xbd67('0x23')]);}return _0x2572a1[_0xbd67('0x8d')](_0x5141f8);}})['then'](function(_0x41e033){if(_0x41e033){return _0x41e033?{'count':_0x4e5baa,'rows':_0x41e033}:null;}})[_0xbd67('0x29')](respondWithResult(_0x354157,null))[_0xbd67('0x4a')](handleError(_0x354157,null));}; \ No newline at end of file +var _0xc949=['count','offset','limit','status','Content-Range','apply','reject','save','update','then','get','SmsQueues','destroy','name','index','map','SmsQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','findAll','User','UserId','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','forEach','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','end','json'];(function(_0x156754,_0x4cc209){var _0x1a9bdc=function(_0xe9f4ec){while(--_0xe9f4ec){_0x156754['push'](_0x156754['shift']());}};_0x1a9bdc(++_0x4cc209);}(_0xc949,0x181));var _0x9c94=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc949[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x9c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c94('0x1'));var zipdir=require(_0x9c94('0x2'));var jsonpatch=require(_0x9c94('0x3'));var rp=require(_0x9c94('0x4'));var moment=require('moment');var BPromise=require(_0x9c94('0x5'));var Mustache=require(_0x9c94('0x6'));var util=require('util');var path=require(_0x9c94('0x7'));var sox=require(_0x9c94('0x8'));var csv=require(_0x9c94('0x9'));var ejs=require(_0x9c94('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x9'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];config[_0x9c94('0x1b')]=_[_0x9c94('0x1c')](config[_0x9c94('0x1b')],{'host':_0x9c94('0x1d'),'port':0x18eb});var socket=require(_0x9c94('0x1e'))(new Redis(config[_0x9c94('0x1b')]));require(_0x9c94('0x1f'))['register'](socket);function respondWithStatusCode(_0x9789bc,_0x496f83){_0x496f83=_0x496f83||0xcc;return function(_0x3d3de5){if(_0x3d3de5){return _0x9789bc[_0x9c94('0x20')](_0x496f83);}return _0x9789bc['status'](_0x496f83)[_0x9c94('0x21')]();};}function respondWithResult(_0x4d6308,_0x56e4e1){_0x56e4e1=_0x56e4e1||0xc8;return function(_0xf4054e){if(_0xf4054e){return _0x4d6308['status'](_0x56e4e1)[_0x9c94('0x22')](_0xf4054e);}};}function respondWithFilteredResult(_0x33bd19,_0x4d9266){return function(_0x201e04){if(_0x201e04){var _0x367eed=_0x201e04[_0x9c94('0x23')],_0x412804=_0x4d9266[_0x9c94('0x24')],_0x3b825e=_0x4d9266['offset']+_0x4d9266[_0x9c94('0x25')],_0x16ef2c;if(_0x3b825e>=_0x367eed){_0x3b825e=_0x367eed;_0x16ef2c=0xc8;}else{_0x16ef2c=0xce;}_0x33bd19[_0x9c94('0x26')](_0x16ef2c);return _0x33bd19['set'](_0x9c94('0x27'),_0x412804+'-'+_0x3b825e+'/'+_0x367eed)[_0x9c94('0x22')](_0x201e04);}return null;};}function patchUpdates(_0x3caab0){return function(_0x326b38){try{jsonpatch[_0x9c94('0x28')](_0x326b38,_0x3caab0,!![]);}catch(_0x3b1481){return BPromise[_0x9c94('0x29')](_0x3b1481);}return _0x326b38[_0x9c94('0x2a')]();};}function saveUpdates(_0x8fe4fb,_0x1b6cca){return function(_0x3b2725){if(_0x3b2725){return _0x3b2725[_0x9c94('0x2b')](_0x8fe4fb)[_0x9c94('0x2c')](function(_0x8c0b7f){return _0x8c0b7f;});}return null;};}function removeEntity(_0x5b1020,_0x1f3b14){return function(_0x2cdbf1){if(_0x2cdbf1){return _0x2cdbf1['destroy']()[_0x9c94('0x2c')](function(){var _0x2c3d25=_0x2cdbf1[_0x9c94('0x2d')]({'plain':!![]});var _0x335184=_0x9c94('0x2e');return db['UserProfileResource'][_0x9c94('0x2f')]({'where':{'type':_0x335184,'resourceId':_0x2c3d25['id']}})[_0x9c94('0x2c')](function(){return _0x2cdbf1;});})['then'](function(){_0x5b1020[_0x9c94('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa5df6f,_0x14d41b){return function(_0x330bd4){if(!_0x330bd4){_0xa5df6f[_0x9c94('0x20')](0x194);}return _0x330bd4;};}function handleError(_0x1581c0,_0x3f2622){_0x3f2622=_0x3f2622||0x1f4;return function(_0xf30dd1){logger['error'](_0xf30dd1['stack']);if(_0xf30dd1[_0x9c94('0x30')]){delete _0xf30dd1[_0x9c94('0x30')];}_0x1581c0[_0x9c94('0x26')](_0x3f2622)['send'](_0xf30dd1);};}exports[_0x9c94('0x31')]=function(_0x597072,_0x356ee8){var _0x4592e5={},_0x1fd8ab={},_0x57e7a6={'count':0x0,'rows':[]};var _0x514b78=_[_0x9c94('0x32')](db[_0x9c94('0x33')][_0x9c94('0x34')],function(_0x48cbe0){return{'name':_0x48cbe0['fieldName'],'type':_0x48cbe0['type']['key']};});_0x1fd8ab[_0x9c94('0x35')]=_['map'](_0x514b78,_0x9c94('0x30'));_0x1fd8ab[_0x9c94('0x36')]=_['keys'](_0x597072['query']);_0x1fd8ab[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x1fd8ab[_0x9c94('0x35')],_0x1fd8ab[_0x9c94('0x36')]);_0x4592e5[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0x1fd8ab[_0x9c94('0x35')],qs[_0x9c94('0x3a')](_0x597072[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x4592e5[_0x9c94('0x39')]=_0x4592e5[_0x9c94('0x39')][_0x9c94('0x3b')]?_0x4592e5[_0x9c94('0x39')]:_0x1fd8ab[_0x9c94('0x35')];if(!_0x597072[_0x9c94('0x36')][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x4592e5['limit']=qs[_0x9c94('0x25')](_0x597072[_0x9c94('0x36')][_0x9c94('0x25')]);_0x4592e5[_0x9c94('0x24')]=qs[_0x9c94('0x24')](_0x597072[_0x9c94('0x36')][_0x9c94('0x24')]);}_0x4592e5['order']=qs[_0x9c94('0x3e')](_0x597072['query'][_0x9c94('0x3e')]);_0x4592e5[_0x9c94('0x3f')]=qs[_0x9c94('0x37')](_[_0x9c94('0x40')](_0x597072['query'],_0x1fd8ab[_0x9c94('0x37')]),_0x514b78);if(_0x597072['query'][_0x9c94('0x41')]){_0x4592e5[_0x9c94('0x3f')]=_[_0x9c94('0x42')](_0x4592e5['where'],{'$or':_[_0x9c94('0x32')](_0x514b78,function(_0x4d4dc0){if(_0x4d4dc0[_0x9c94('0x43')]!=='VIRTUAL'){var _0x4f552b={};_0x4f552b[_0x4d4dc0[_0x9c94('0x30')]]={'$like':'%'+_0x597072[_0x9c94('0x36')][_0x9c94('0x41')]+'%'};return _0x4f552b;}})});}_0x4592e5=_[_0x9c94('0x42')]({},_0x4592e5,_0x597072['options']);var _0x437910={'where':_0x4592e5[_0x9c94('0x3f')]};return db[_0x9c94('0x33')][_0x9c94('0x23')](_0x437910)['then'](function(_0x1039e8){_0x57e7a6[_0x9c94('0x23')]=_0x1039e8;if(_0x597072['query'][_0x9c94('0x44')]){_0x4592e5[_0x9c94('0x45')]=[{'all':!![]}];}return db[_0x9c94('0x33')]['findAll'](_0x4592e5);})['then'](function(_0x2731c7){_0x57e7a6[_0x9c94('0x46')]=_0x2731c7;return _0x57e7a6;})[_0x9c94('0x2c')](respondWithFilteredResult(_0x356ee8,_0x4592e5))[_0x9c94('0x47')](handleError(_0x356ee8,null));};exports[_0x9c94('0x48')]=function(_0x1cc89a,_0x1b6571){var _0x31edae={'raw':!![],'where':{'id':_0x1cc89a[_0x9c94('0x49')]['id']}},_0x1d82a7={};_0x1d82a7[_0x9c94('0x35')]=_['keys'](db[_0x9c94('0x33')]['rawAttributes']);_0x1d82a7[_0x9c94('0x36')]=_[_0x9c94('0x4a')](_0x1cc89a[_0x9c94('0x36')]);_0x1d82a7[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x1d82a7[_0x9c94('0x35')],_0x1d82a7[_0x9c94('0x36')]);_0x31edae['attributes']=_['intersection'](_0x1d82a7[_0x9c94('0x35')],qs[_0x9c94('0x3a')](_0x1cc89a[_0x9c94('0x36')]['fields']));_0x31edae[_0x9c94('0x39')]=_0x31edae[_0x9c94('0x39')]['length']?_0x31edae['attributes']:_0x1d82a7['model'];if(_0x1cc89a['query'][_0x9c94('0x44')]){_0x31edae['include']=[{'all':!![]}];}_0x31edae=_['merge']({},_0x31edae,_0x1cc89a[_0x9c94('0x4b')]);return db['SmsQueue'][_0x9c94('0x4c')](_0x31edae)[_0x9c94('0x2c')](handleEntityNotFound(_0x1b6571,null))[_0x9c94('0x2c')](respondWithResult(_0x1b6571,null))[_0x9c94('0x47')](handleError(_0x1b6571,null));};exports[_0x9c94('0x4d')]=function(_0x5ae40c,_0x33ccef){return db[_0x9c94('0x33')][_0x9c94('0x4d')](_0x5ae40c[_0x9c94('0x4e')],{})[_0x9c94('0x2c')](function(_0x1c6634){var _0x551cfc=_0x5ae40c[_0x9c94('0x4f')]['get']({'plain':!![]});if(!_0x551cfc)throw new Error(_0x9c94('0x50'));if(_0x551cfc[_0x9c94('0x51')]===_0x9c94('0x4f')){var _0x48d368=_0x1c6634[_0x9c94('0x2d')]({'plain':!![]});var _0x3c03f2='SmsQueues';return db[_0x9c94('0x52')]['find']({'where':{'name':_0x3c03f2,'userProfileId':_0x551cfc[_0x9c94('0x53')]},'raw':!![]})[_0x9c94('0x2c')](function(_0x537c78){if(_0x537c78&&_0x537c78['autoAssociation']===0x0){return db[_0x9c94('0x54')]['create']({'name':_0x48d368[_0x9c94('0x30')],'resourceId':_0x48d368['id'],'type':_0x537c78[_0x9c94('0x30')],'sectionId':_0x537c78['id']},{})[_0x9c94('0x2c')](function(){return _0x1c6634;});}else{return _0x1c6634;}})[_0x9c94('0x47')](function(_0x5ba416){logger[_0x9c94('0x55')](_0x9c94('0x56'),_0x5ba416);throw _0x5ba416;});}return _0x1c6634;})['then'](respondWithResult(_0x33ccef,0xc9))['catch'](handleError(_0x33ccef,null));};exports[_0x9c94('0x2b')]=function(_0xf35376,_0x1c2ae8){if(_0xf35376[_0x9c94('0x4e')]['id']){delete _0xf35376[_0x9c94('0x4e')]['id'];}return db[_0x9c94('0x33')]['find']({'where':{'id':_0xf35376[_0x9c94('0x49')]['id']}})[_0x9c94('0x2c')](handleEntityNotFound(_0x1c2ae8,null))[_0x9c94('0x2c')](saveUpdates(_0xf35376[_0x9c94('0x4e')],null))[_0x9c94('0x2c')](respondWithResult(_0x1c2ae8,null))[_0x9c94('0x47')](handleError(_0x1c2ae8,null));};exports['destroy']=function(_0x2fad44,_0x4bf026){return db[_0x9c94('0x33')][_0x9c94('0x4c')]({'where':{'id':_0x2fad44[_0x9c94('0x49')]['id']}})['then'](handleEntityNotFound(_0x4bf026,null))[_0x9c94('0x2c')](removeEntity(_0x4bf026,null))['catch'](handleError(_0x4bf026,null));};exports['describe']=function(_0x7bc91d,_0x3b88be){return db['SmsQueue'][_0x9c94('0x57')]()[_0x9c94('0x2c')](respondWithResult(_0x3b88be,null))[_0x9c94('0x47')](handleError(_0x3b88be,null));};exports[_0x9c94('0x58')]=function(_0x1173f3,_0x168e8c,_0x44d90d){var _0x730b6d={'raw':!![],'where':{}},_0xead975={},_0x3403dd;return db[_0x9c94('0x33')]['findOne']({'where':{'id':_0x1173f3['params']['id']}})[_0x9c94('0x2c')](handleEntityNotFound(_0x168e8c,null))[_0x9c94('0x2c')](function(_0x4ff73a){if(_0x4ff73a){_0x3403dd=_0x4ff73a[_0x9c94('0x2d')]({'plain':!![]});_0xead975[_0x9c94('0x35')]=_[_0x9c94('0x4a')](db[_0x9c94('0x59')][_0x9c94('0x34')]);_0xead975[_0x9c94('0x36')]=_['keys'](_0x1173f3['query']);_0xead975['filters']=_[_0x9c94('0x38')](_0xead975['model'],_0xead975['query']);_0x730b6d[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0xead975[_0x9c94('0x35')],qs[_0x9c94('0x3a')](_0x1173f3[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x730b6d['attributes']=_0x730b6d[_0x9c94('0x39')]['length']?_0x730b6d[_0x9c94('0x39')]:_0xead975[_0x9c94('0x35')];if(!_0x1173f3['query'][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x730b6d['limit']=qs[_0x9c94('0x25')](_0x1173f3[_0x9c94('0x36')][_0x9c94('0x25')]);_0x730b6d[_0x9c94('0x24')]=qs['offset'](_0x1173f3[_0x9c94('0x36')][_0x9c94('0x24')]);}_0x730b6d['order']=qs['sort'](_0x1173f3[_0x9c94('0x36')][_0x9c94('0x3e')]);_0x730b6d[_0x9c94('0x3f')]=qs['filters'](_['pick'](_0x1173f3[_0x9c94('0x36')],_0xead975[_0x9c94('0x37')]));_0x730b6d[_0x9c94('0x3f')]['SmsQueueId']=_0x4ff73a['id'];if(_0x1173f3[_0x9c94('0x36')][_0x9c94('0x41')]){_0x730b6d[_0x9c94('0x3f')]=_[_0x9c94('0x42')](_0x730b6d[_0x9c94('0x3f')],{'$or':_[_0x9c94('0x32')](_0x730b6d['attributes'],function(_0x3d4c26){var _0x21547d={};_0x21547d[_0x3d4c26]={'$like':'%'+_0x1173f3[_0x9c94('0x36')][_0x9c94('0x41')]+'%'};return _0x21547d;})});}_0x730b6d=_[_0x9c94('0x42')]({},_0x730b6d,_0x1173f3[_0x9c94('0x4b')]);return db[_0x9c94('0x59')][_0x9c94('0x5a')](_0x730b6d);}})[_0x9c94('0x2c')](function(_0x1fe607){if(_0x1fe607){return db[_0x9c94('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x1fe607,_0x9c94('0x5c')),'role':'agent'},'attributes':['id','name','smsPause',_0x9c94('0x5d'),_0x9c94('0x5e')]});}})['then'](function(_0x26d115){if(_0x26d115){return{'count':_0x26d115[_0x9c94('0x23')],'rows':_[_0x9c94('0x32')](_0x26d115[_0x9c94('0x46')],function(_0xc20f98){return{'membername':_0xc20f98['name'],'UserId':_0xc20f98['id'],'queue_name':_0x3403dd[_0x9c94('0x30')],'SmsQueueId':_0x3403dd['id'],'interface':util['format'](_0x9c94('0x5f'),_0x9c94('0x60'),_0xc20f98[_0x9c94('0x30')]),'penalty':0x0,'paused':_0xc20f98[_0x9c94('0x61')],'createdAt':_0xc20f98[_0x9c94('0x5e')],'updatedAt':_0xc20f98[_0x9c94('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c94('0x2c')](respondWithFilteredResult(_0x168e8c,_0x730b6d))[_0x9c94('0x47')](handleError(_0x168e8c,null));};exports[_0x9c94('0x62')]=function(_0x183527,_0x1bcdf5,_0x540996){var _0x257174={};var _0x21939c={};var _0x16d000;var _0x5b4c36;return db[_0x9c94('0x33')][_0x9c94('0x63')]({'where':{'id':_0x183527[_0x9c94('0x49')]['id']}})[_0x9c94('0x2c')](handleEntityNotFound(_0x1bcdf5,null))[_0x9c94('0x2c')](function(_0x66483b){if(_0x66483b){_0x16d000=_0x66483b;_0x21939c[_0x9c94('0x35')]=_['keys'](db[_0x9c94('0x64')][_0x9c94('0x34')]);_0x21939c[_0x9c94('0x36')]=_['keys'](_0x183527[_0x9c94('0x36')]);_0x21939c[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x21939c[_0x9c94('0x35')],_0x21939c['query']);_0x257174[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0x21939c[_0x9c94('0x35')],qs[_0x9c94('0x3a')](_0x183527[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x257174['attributes']=_0x257174['attributes'][_0x9c94('0x3b')]?_0x257174[_0x9c94('0x39')]:_0x21939c[_0x9c94('0x35')];_0x257174['order']=qs[_0x9c94('0x3e')](_0x183527[_0x9c94('0x36')][_0x9c94('0x3e')]);_0x257174['where']=qs[_0x9c94('0x37')](_['pick'](_0x183527['query'],_0x21939c[_0x9c94('0x37')]));if(_0x183527[_0x9c94('0x36')]['filter']){_0x257174[_0x9c94('0x3f')]=_[_0x9c94('0x42')](_0x257174['where'],{'$or':_[_0x9c94('0x32')](_0x257174[_0x9c94('0x39')],function(_0xe7fc99){var _0x1bacd9={};_0x1bacd9[_0xe7fc99]={'$like':'%'+_0x183527[_0x9c94('0x36')][_0x9c94('0x41')]+'%'};return _0x1bacd9;})});}_0x257174=_[_0x9c94('0x42')]({},_0x257174,_0x183527[_0x9c94('0x4b')]);return _0x16d000[_0x9c94('0x62')](_0x257174);}})['then'](function(_0x3b20ab){if(_0x3b20ab){_0x5b4c36=_0x3b20ab[_0x9c94('0x3b')];if(!_0x183527[_0x9c94('0x36')][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x257174['limit']=qs[_0x9c94('0x25')](_0x183527['query'][_0x9c94('0x25')]);_0x257174[_0x9c94('0x24')]=qs['offset'](_0x183527['query'][_0x9c94('0x24')]);}return _0x16d000[_0x9c94('0x62')](_0x257174);}})[_0x9c94('0x2c')](function(_0x52d68a){if(_0x52d68a){return _0x52d68a?{'count':_0x5b4c36,'rows':_0x52d68a}:null;}})['then'](respondWithResult(_0x1bcdf5,null))[_0x9c94('0x47')](handleError(_0x1bcdf5,null));};exports[_0x9c94('0x65')]=function(_0x9219bd,_0x27cdde,_0x34edf2){var _0x3b7c65=_0x9219bd[_0x9c94('0x4e')][_0x9c94('0x66')];return db[_0x9c94('0x64')]['findAll']({'where':{'id':_0x3b7c65},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x9c94('0x67'),'voicePause',_0x9c94('0x68')],'raw':!![]}]})[_0x9c94('0x2c')](function(_0x22d5bc){if(_0x22d5bc){var _0x4e23c1=_[_0x9c94('0x69')](_0x22d5bc,function(_0x96636){var _0x3edf16=_0x96636['get']({'plain':!![]});return _0x3edf16[_0x9c94('0x6a')];});return db[_0x9c94('0x33')][_0x9c94('0x4c')]({'where':{'id':_0x9219bd[_0x9c94('0x49')]['id']}})[_0x9c94('0x2c')](function(_0x58f9e5){return db[_0x9c94('0x6b')][_0x9c94('0x6c')](function(_0xdee217){return _0x58f9e5[_0x9c94('0x65')](_0x3b7c65,{'transaction':_0xdee217})[_0x9c94('0x2c')](function(){return BPromise[_0x9c94('0x6d')](_0x4e23c1,function(_0x2bef6f){return db[_0x9c94('0x59')][_0x9c94('0x6e')]({'where':{'UserId':_0x2bef6f['id'],'SmsQueueId':_0x9219bd[_0x9c94('0x49')]['id']},'transaction':_0xdee217});});})['then'](function(){_0x4e23c1['forEach'](function(_0x5bf576){socket['emit']('userSmsQueue:save',{'UserId':_0x5bf576['id'],'SmsQueueId':_0x58f9e5['id']});});});});});}})[_0x9c94('0x2c')](respondWithStatusCode(_0x27cdde,null))[_0x9c94('0x47')](handleError(_0x27cdde,null));};exports[_0x9c94('0x6f')]=function(_0x4675f5,_0x45f937,_0x350c34){return db['Team'][_0x9c94('0x5a')]({'where':{'id':_0x4675f5[_0x9c94('0x36')][_0x9c94('0x66')]},'attributes':['id'],'include':[{'model':db[_0x9c94('0x5b')],'as':_0x9c94('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x45f937,null))[_0x9c94('0x2c')](function(_0x13139e){var _0x2f3ac3=_[_0x9c94('0x32')](_0x13139e,'id');var _0x448b89=[];var _0x59932b=[];var _0x3b6e60=squel[_0x9c94('0x70')]();_0x3b6e60[_0x9c94('0x71')](_0x9c94('0x72'))[_0x9c94('0x73')](_0x9c94('0x74'),'tq')[_0x9c94('0x75')](_0x9c94('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9c94('0x77'),_0x4675f5[_0x9c94('0x49')]['id']);for(var _0x5b96b5=0x0;_0x5b96b5<_0x13139e['length'];_0x5b96b5+=0x1){let _0x46cde8=_0x13139e[_0x5b96b5];for(var _0x505104=0x0;_0x505104<_0x46cde8['Agents']['length'];_0x505104+=0x1){let _0x4554a0=_0x46cde8['Agents'][_0x505104];var _0x1d746a=_0x3b6e60[_0x9c94('0x78')]();_0x1d746a[_0x9c94('0x3f')](_0x9c94('0x79'),_0x4554a0['id']);_0x59932b[_0x9c94('0x7a')](db[_0x9c94('0x6b')]['query'](_0x1d746a[_0x9c94('0x7b')](),{'type':db[_0x9c94('0x6b')][_0x9c94('0x7c')][_0x9c94('0x7d')]})[_0x9c94('0x2c')](function(_0x2d16d3){if(_0x2d16d3['length']===0x1){return _0x4554a0['id'];}else{var _0x4fe834=_[_0x9c94('0x7e')](_[_0x9c94('0x32')](_0x2d16d3,_0x9c94('0x7f')),function(_0x3e07e9){return _[_0x9c94('0x80')](_0x2f3ac3,_0x3e07e9);});if(_0x4fe834){return _0x4554a0['id'];}}}));}}return BPromise['all'](_0x59932b)[_0x9c94('0x2c')](function(_0x4dfc3b){_0x448b89=_(_0x448b89)['union'](_0x4dfc3b)[_0x9c94('0x81')]()[_0x9c94('0x82')]();return db[_0x9c94('0x33')][_0x9c94('0x4c')]({'where':{'id':_0x4675f5[_0x9c94('0x49')]['id']}})[_0x9c94('0x2c')](function(_0x43948e){return db[_0x9c94('0x6b')][_0x9c94('0x6c')](function(_0x23ebbd){return _0x43948e[_0x9c94('0x6f')](_0x4675f5[_0x9c94('0x36')][_0x9c94('0x66')],{'transaction':_0x23ebbd})[_0x9c94('0x2c')](function(){if(!_['isEmpty'](_0x448b89)){return _0x43948e['removeAgents'](_0x448b89,{'transaction':_0x23ebbd});}})['then'](function(){_0x448b89[_0x9c94('0x83')](function(_0x32bd43){socket[_0x9c94('0x84')](_0x9c94('0x85'),{'UserId':_0x32bd43,'SmsQueueId':_0x43948e['id']});});});});});});})[_0x9c94('0x2c')](respondWithStatusCode(_0x45f937,null))['catch'](handleError(_0x45f937,null));};exports[_0x9c94('0x86')]=function(_0x3ddf00,_0x4f084f,_0x17163e){return db[_0x9c94('0x33')][_0x9c94('0x4c')]({'where':{'id':_0x3ddf00['params']['id']}})['then'](handleEntityNotFound(_0x4f084f,null))[_0x9c94('0x2c')](function(_0x2b65f4){if(_0x2b65f4){return _0x2b65f4[_0x9c94('0x86')](_0x3ddf00[_0x9c94('0x4e')][_0x9c94('0x66')],_[_0x9c94('0x87')](_0x3ddf00[_0x9c94('0x4e')],['ids','id'])||{})[_0x9c94('0x88')](function(_0x3b3d40){for(var _0x34d830=0x0;_0x34d830<_0x3ddf00[_0x9c94('0x4e')][_0x9c94('0x66')][_0x9c94('0x3b')];_0x34d830+=0x1){socket[_0x9c94('0x84')]('userSmsQueue:save',{'UserId':_0x3ddf00['body'][_0x9c94('0x66')][_0x34d830],'SmsQueueId':_0x3ddf00[_0x9c94('0x49')]['id']});}return _0x3b3d40;});}})[_0x9c94('0x2c')](respondWithResult(_0x4f084f,null))[_0x9c94('0x47')](handleError(_0x4f084f,null));};exports[_0x9c94('0x89')]=function(_0x448bbc,_0x379f1e,_0x4169f3){return db[_0x9c94('0x33')][_0x9c94('0x4c')]({'where':{'id':_0x448bbc['params']['id']}})[_0x9c94('0x2c')](handleEntityNotFound(_0x379f1e,null))[_0x9c94('0x2c')](function(_0x1d3f6b){if(_0x1d3f6b){return _0x1d3f6b[_0x9c94('0x89')](_0x448bbc['query'][_0x9c94('0x66')])[_0x9c94('0x2c')](function(){if(_[_0x9c94('0x8a')](_0x448bbc[_0x9c94('0x36')][_0x9c94('0x66')])){for(var _0x4e5a9d=0x0;_0x4e5a9d<_0x448bbc[_0x9c94('0x36')]['ids'][_0x9c94('0x3b')];_0x4e5a9d+=0x1){socket[_0x9c94('0x84')](_0x9c94('0x85'),{'UserId':Number(_0x448bbc[_0x9c94('0x36')]['ids'][_0x4e5a9d]),'SmsQueueId':Number(_0x448bbc[_0x9c94('0x49')]['id'])});}}else{socket[_0x9c94('0x84')]('userSmsQueue:remove',{'UserId':Number(_0x448bbc[_0x9c94('0x36')][_0x9c94('0x66')]),'SmsQueueId':Number(_0x448bbc[_0x9c94('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x379f1e,null))[_0x9c94('0x47')](handleError(_0x379f1e,null));};exports[_0x9c94('0x8b')]=function(_0x50371d,_0x2d8335,_0x5a6cd5){var _0x4cdce0={};var _0x389bb3={};var _0x5c64a2;var _0x468fb5;return db[_0x9c94('0x33')][_0x9c94('0x63')]({'where':{'id':_0x50371d[_0x9c94('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d8335,null))[_0x9c94('0x2c')](function(_0x1e6ce1){if(_0x1e6ce1){_0x5c64a2=_0x1e6ce1;_0x389bb3[_0x9c94('0x35')]=_[_0x9c94('0x4a')](db[_0x9c94('0x5b')][_0x9c94('0x34')]);_0x389bb3['query']=_[_0x9c94('0x4a')](_0x50371d['query']);_0x389bb3[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x389bb3[_0x9c94('0x35')],_0x389bb3['query']);_0x4cdce0[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0x389bb3['model'],qs[_0x9c94('0x3a')](_0x50371d[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x4cdce0[_0x9c94('0x39')]=_0x4cdce0['attributes'][_0x9c94('0x3b')]?_0x4cdce0[_0x9c94('0x39')]:_0x389bb3['model'];_0x4cdce0['order']=qs[_0x9c94('0x3e')](_0x50371d[_0x9c94('0x36')]['sort']);_0x4cdce0[_0x9c94('0x3f')]=qs[_0x9c94('0x37')](_['pick'](_0x50371d[_0x9c94('0x36')],_0x389bb3[_0x9c94('0x37')]));if(_0x50371d[_0x9c94('0x36')]['filter']){_0x4cdce0[_0x9c94('0x3f')]=_[_0x9c94('0x42')](_0x4cdce0[_0x9c94('0x3f')],{'$or':_[_0x9c94('0x32')](_0x4cdce0['attributes'],function(_0x3eec5d){var _0x5a1972={};_0x5a1972[_0x3eec5d]={'$like':'%'+_0x50371d[_0x9c94('0x36')][_0x9c94('0x41')]+'%'};return _0x5a1972;})});}_0x4cdce0=_[_0x9c94('0x42')]({},_0x4cdce0,_0x50371d[_0x9c94('0x4b')]);return _0x5c64a2[_0x9c94('0x8b')](_0x4cdce0);}})['then'](function(_0x3543cc){if(_0x3543cc){_0x468fb5=_0x3543cc[_0x9c94('0x3b')];if(!_0x50371d[_0x9c94('0x36')][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x4cdce0[_0x9c94('0x25')]=qs[_0x9c94('0x25')](_0x50371d['query'][_0x9c94('0x25')]);_0x4cdce0[_0x9c94('0x24')]=qs['offset'](_0x50371d[_0x9c94('0x36')][_0x9c94('0x24')]);}return _0x5c64a2[_0x9c94('0x8b')](_0x4cdce0);}})[_0x9c94('0x2c')](function(_0x5e99cd){if(_0x5e99cd){return _0x5e99cd?{'count':_0x468fb5,'rows':_0x5e99cd}:null;}})[_0x9c94('0x2c')](respondWithResult(_0x2d8335,null))[_0x9c94('0x47')](handleError(_0x2d8335,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f1810cd..76361d5 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 _0x9806=['hasOwnProperty','hook','events','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x4a987d,_0x505a6c){var _0x1ea3bc=function(_0x289001){while(--_0x289001){_0x4a987d['push'](_0x4a987d['shift']());}};_0x1ea3bc(++_0x505a6c);}(_0x9806,0x12a));var _0x6980=function(_0x269056,_0x2b8715){_0x269056=_0x269056-0x0;var _0x40df3f=_0x9806[_0x269056];return _0x40df3f;};'use strict';var EventEmitter=require(_0x6980('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x6980('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6980('0x2')](0x0);var events={'afterCreate':_0x6980('0x3'),'afterUpdate':_0x6980('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a0e21){return function(_0x4f78d4,_0x1d7110,_0x26b3ea){SmsQueueEvents[_0x6980('0x5')](_0x2a0e21+':'+_0x4f78d4['id'],_0x4f78d4);SmsQueueEvents[_0x6980('0x5')](_0x2a0e21,_0x4f78d4);_0x26b3ea(null);};}for(var e in events){if(events[_0x6980('0x6')](e)){var event=events[e];SmsQueue[_0x6980('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x1b50=['update','remove','SmsQueue','setMaxListeners','save'];(function(_0x38dc26,_0x2cb13a){var _0x1f21b0=function(_0x235b3b){while(--_0x235b3b){_0x38dc26['push'](_0x38dc26['shift']());}};_0x1f21b0(++_0x2cb13a);}(_0x1b50,0x1c9));var _0x01b5=function(_0x44eb28,_0x4c4308){_0x44eb28=_0x44eb28-0x0;var _0x4da0d9=_0x1b50[_0x44eb28];return _0x4da0d9;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x01b5('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x01b5('0x1')](0x0);var events={'afterCreate':_0x01b5('0x2'),'afterUpdate':_0x01b5('0x3'),'afterDestroy':_0x01b5('0x4')};function emitEvent(_0x4ac36e){return function(_0x948937,_0x439302,_0xeafea2){SmsQueueEvents['emit'](_0x4ac36e+':'+_0x948937['id'],_0x948937);SmsQueueEvents['emit'](_0x4ac36e,_0x948937);_0xeafea2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d7f51d6..a5c0db8 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 _0xc00c=['SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports'];(function(_0x2b79bf,_0x594e47){var _0x250a45=function(_0x35844f){while(--_0x35844f){_0x2b79bf['push'](_0x2b79bf['shift']());}};_0x250a45(++_0x594e47);}(_0xc00c,0x92));var _0xcc00=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xc00c[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xcc00('0x0'));var util=require('util');var logger=require(_0xcc00('0x1'))(_0xcc00('0x2'));var moment=require(_0xcc00('0x3'));var BPromise=require(_0xcc00('0x4'));var rp=require(_0xcc00('0x5'));var fs=require('fs');var path=require(_0xcc00('0x6'));var rimraf=require(_0xcc00('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc00('0x8'));module[_0xcc00('0x9')]=function(_0x45c34d,_0x45ec2a){return _0x45c34d['define'](_0xcc00('0xa'),attributes,{'tableName':_0xcc00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b6=['path','../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x07b6,0xb5));var _0x607b=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x07b6[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0x607b('0x0'));var util=require('util');var logger=require(_0x607b('0x1'))(_0x607b('0x2'));var moment=require(_0x607b('0x3'));var BPromise=require(_0x607b('0x4'));var rp=require(_0x607b('0x5'));var fs=require('fs');var path=require(_0x607b('0x6'));var rimraf=require('rimraf');var config=require(_0x607b('0x7'));var attributes=require(_0x607b('0x8'));module['exports']=function(_0x2ab52b,_0x49163a){return _0x2ab52b['define'](_0x607b('0x9'),attributes,{'tableName':_0x607b('0xa'),'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 b48d798..fb2fb07 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 _0xf7bd=['stringify','error','SmsQueue,\x20%s,\x20%s','message','info','result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0xf7bd,0x117));var _0xdf7b=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0xf7bd[_0xc08f00];return _0x8649f7;};'use strict';var _=require(_0xdf7b('0x0'));var util=require(_0xdf7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf7b('0x2'));var fs=require('fs');var Redis=require(_0xdf7b('0x3'));var db=require(_0xdf7b('0x4'))['db'];var utils=require(_0xdf7b('0x5'));var logger=require(_0xdf7b('0x6'))(_0xdf7b('0x7'));var config=require(_0xdf7b('0x8'));var jayson=require(_0xdf7b('0x9'));var client=jayson[_0xdf7b('0xa')][_0xdf7b('0xb')]({'port':0x232a});config[_0xdf7b('0xc')]=_[_0xdf7b('0xd')](config['redis'],{'host':_0xdf7b('0xe'),'port':0x18eb});var socket=require(_0xdf7b('0xf'))(new Redis(config['redis']));require(_0xdf7b('0x10'))[_0xdf7b('0x11')](socket);function respondWithRpcPromise(_0x162f94,_0x117a38,_0x223d11){return new BPromise(function(_0x5473aa,_0x33feb0){return client[_0xdf7b('0x12')](_0x162f94,_0x223d11)[_0xdf7b('0x13')](function(_0x5e0252){logger['info']('SmsQueue,\x20%s,\x20%s',_0x117a38,_0xdf7b('0x14'));logger['debug'](_0xdf7b('0x15'),_0x117a38,_0xdf7b('0x14'),JSON[_0xdf7b('0x16')](_0x5e0252));if(_0x5e0252[_0xdf7b('0x17')]){if(_0x5e0252['error']['code']===0x1f4){logger['error'](_0xdf7b('0x18'),_0x117a38,_0x5e0252[_0xdf7b('0x17')][_0xdf7b('0x19')]);return _0x33feb0(_0x5e0252[_0xdf7b('0x17')][_0xdf7b('0x19')]);}logger[_0xdf7b('0x17')](_0xdf7b('0x18'),_0x117a38,_0x5e0252[_0xdf7b('0x17')]['message']);return _0x5473aa(_0x5e0252[_0xdf7b('0x17')][_0xdf7b('0x19')]);}else{logger[_0xdf7b('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x117a38,_0xdf7b('0x14'));_0x5473aa(_0x5e0252[_0xdf7b('0x1b')]['message']);}})[_0xdf7b('0x1c')](function(_0x3271d7){logger[_0xdf7b('0x17')](_0xdf7b('0x18'),_0x117a38,_0x3271d7);_0x33feb0(_0x3271d7);});});}exports['GetSmsQueue']=function(_0x332083){var _0x3cb344=this;return new Promise(function(_0x3d424e,_0x21c552){return db[_0xdf7b('0x1d')][_0xdf7b('0x1e')]({'raw':_0x332083['options']?_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x20')]===undefined?!![]:![]:!![],'where':_0x332083['options']?_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x21')]||null:null,'attributes':_0x332083[_0xdf7b('0x1f')]?_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x22')]||null:null,'limit':_0x332083[_0xdf7b('0x1f')]?_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x23')]||null:null,'include':_0x332083[_0xdf7b('0x1f')]?_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x24')]?_[_0xdf7b('0x25')](_0x332083[_0xdf7b('0x1f')][_0xdf7b('0x24')],function(_0x12baa6){return{'model':db[_0x12baa6['model']],'as':_0x12baa6['as'],'attributes':_0x12baa6[_0xdf7b('0x22')],'include':_0x12baa6[_0xdf7b('0x24')]?_[_0xdf7b('0x25')](_0x12baa6['include'],function(_0x2354dd){return{'model':db[_0x2354dd['model']],'as':_0x2354dd['as'],'attributes':_0x2354dd[_0xdf7b('0x22')],'include':_0x2354dd['include']?_[_0xdf7b('0x25')](_0x2354dd[_0xdf7b('0x24')],function(_0xa8e3c1){return{'model':db[_0xa8e3c1[_0xdf7b('0x26')]],'as':_0xa8e3c1['as'],'attributes':_0xa8e3c1[_0xdf7b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdf7b('0x13')](function(_0x179084){logger[_0xdf7b('0x1a')](_0xdf7b('0x27'),_0x332083);logger[_0xdf7b('0x28')](_0xdf7b('0x27'),_0x332083,JSON[_0xdf7b('0x16')](_0x179084));_0x3d424e(_0x179084);})[_0xdf7b('0x1c')](function(_0x2a4cc3){logger[_0xdf7b('0x17')]('GetSmsQueue',_0x2a4cc3[_0xdf7b('0x19')],_0x332083);_0x21c552(_0x3cb344[_0xdf7b('0x17')](0x1f4,_0x2a4cc3[_0xdf7b('0x19')]));});});};exports[_0xdf7b('0x29')]=function(_0x3c3ec8){var _0x395663=this;return new Promise(function(_0x53caf9,_0x213377){return db[_0xdf7b('0x1d')][_0xdf7b('0x2a')]({'raw':_0x3c3ec8[_0xdf7b('0x1f')]?_0x3c3ec8[_0xdf7b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3c3ec8['options']?_0x3c3ec8[_0xdf7b('0x1f')][_0xdf7b('0x21')]||null:null,'attributes':_0x3c3ec8['options']?_0x3c3ec8['options'][_0xdf7b('0x22')]||null:null,'include':_0x3c3ec8[_0xdf7b('0x1f')]?_0x3c3ec8[_0xdf7b('0x1f')]['include']?_['map'](_0x3c3ec8[_0xdf7b('0x1f')][_0xdf7b('0x24')],function(_0x1c64bf){return{'model':db[_0x1c64bf['model']],'as':_0x1c64bf['as'],'attributes':_0x1c64bf['attributes'],'include':_0x1c64bf[_0xdf7b('0x24')]?_[_0xdf7b('0x25')](_0x1c64bf[_0xdf7b('0x24')],function(_0x2277f6){return{'model':db[_0x2277f6[_0xdf7b('0x26')]],'as':_0x2277f6['as'],'attributes':_0x2277f6[_0xdf7b('0x22')],'include':_0x2277f6['include']?_[_0xdf7b('0x25')](_0x2277f6['include'],function(_0x2d31bb){return{'model':db[_0x2d31bb['model']],'as':_0x2d31bb['as'],'attributes':_0x2d31bb[_0xdf7b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdf7b('0x13')](function(_0x1ecd47){logger[_0xdf7b('0x1a')]('ShowSmsQueue',_0x3c3ec8);logger[_0xdf7b('0x28')](_0xdf7b('0x29'),_0x3c3ec8,JSON['stringify'](_0x1ecd47));_0x53caf9(_0x1ecd47);})[_0xdf7b('0x1c')](function(_0xc9bceb){logger[_0xdf7b('0x17')](_0xdf7b('0x29'),_0xc9bceb[_0xdf7b('0x19')],_0x3c3ec8);_0x213377(_0x395663[_0xdf7b('0x17')](0x1f4,_0xc9bceb[_0xdf7b('0x19')]));});});}; \ No newline at end of file +var _0x9975=['debug','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','options','limit','map','include','attributes','model','find','raw','where','ShowSmsQueue','lodash','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2a45ea,_0x2fdf2f){var _0x24eb57=function(_0x5e9252){while(--_0x5e9252){_0x2a45ea['push'](_0x2a45ea['shift']());}};_0x24eb57(++_0x2fdf2f);}(_0x9975,0x1cc));var _0x5997=function(_0x5d9823,_0xfda06){_0x5d9823=_0x5d9823-0x0;var _0x137a77=_0x9975[_0x5d9823];return _0x137a77;};'use strict';var _=require(_0x5997('0x0'));var util=require('util');var moment=require(_0x5997('0x1'));var BPromise=require(_0x5997('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5997('0x3'))('rpc');var config=require(_0x5997('0x4'));var jayson=require(_0x5997('0x5'));var client=jayson[_0x5997('0x6')][_0x5997('0x7')]({'port':0x232a});config[_0x5997('0x8')]=_['defaults'](config[_0x5997('0x8')],{'host':_0x5997('0x9'),'port':0x18eb});var socket=require(_0x5997('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x34552e,_0x2dcd66,_0x317fe3){return new BPromise(function(_0x574faf,_0x547820){return client[_0x5997('0xb')](_0x34552e,_0x317fe3)[_0x5997('0xc')](function(_0x1b4762){logger[_0x5997('0xd')](_0x5997('0xe'),_0x2dcd66,_0x5997('0xf'));logger[_0x5997('0x10')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2dcd66,_0x5997('0xf'),JSON[_0x5997('0x11')](_0x1b4762));if(_0x1b4762[_0x5997('0x12')]){if(_0x1b4762[_0x5997('0x12')][_0x5997('0x13')]===0x1f4){logger[_0x5997('0x12')](_0x5997('0xe'),_0x2dcd66,_0x1b4762[_0x5997('0x12')]['message']);return _0x547820(_0x1b4762[_0x5997('0x12')][_0x5997('0x14')]);}logger[_0x5997('0x12')](_0x5997('0xe'),_0x2dcd66,_0x1b4762[_0x5997('0x12')]['message']);return _0x574faf(_0x1b4762[_0x5997('0x12')][_0x5997('0x14')]);}else{logger[_0x5997('0xd')]('SmsQueue,\x20%s,\x20%s',_0x2dcd66,_0x5997('0xf'));_0x574faf(_0x1b4762['result']['message']);}})[_0x5997('0x15')](function(_0x59a882){logger[_0x5997('0x12')](_0x5997('0xe'),_0x2dcd66,_0x59a882);_0x547820(_0x59a882);});});}exports[_0x5997('0x16')]=function(_0x552245){var _0x5d3564=this;return new Promise(function(_0x10fbda,_0x29f852){return db[_0x5997('0x17')]['findAll']({'raw':_0x552245[_0x5997('0x18')]?_0x552245['options']['raw']===undefined?!![]:![]:!![],'where':_0x552245[_0x5997('0x18')]?_0x552245['options']['where']||null:null,'attributes':_0x552245[_0x5997('0x18')]?_0x552245['options']['attributes']||null:null,'limit':_0x552245[_0x5997('0x18')]?_0x552245[_0x5997('0x18')][_0x5997('0x19')]||null:null,'include':_0x552245[_0x5997('0x18')]?_0x552245['options']['include']?_[_0x5997('0x1a')](_0x552245[_0x5997('0x18')][_0x5997('0x1b')],function(_0x31e083){return{'model':db[_0x31e083['model']],'as':_0x31e083['as'],'attributes':_0x31e083[_0x5997('0x1c')],'include':_0x31e083['include']?_[_0x5997('0x1a')](_0x31e083[_0x5997('0x1b')],function(_0x5a9631){return{'model':db[_0x5a9631[_0x5997('0x1d')]],'as':_0x5a9631['as'],'attributes':_0x5a9631['attributes'],'include':_0x5a9631[_0x5997('0x1b')]?_[_0x5997('0x1a')](_0x5a9631[_0x5997('0x1b')],function(_0x51ea0d){return{'model':db[_0x51ea0d[_0x5997('0x1d')]],'as':_0x51ea0d['as'],'attributes':_0x51ea0d[_0x5997('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5997('0xc')](function(_0x3de87e){logger[_0x5997('0xd')](_0x5997('0x16'),_0x552245);logger[_0x5997('0x10')](_0x5997('0x16'),_0x552245,JSON[_0x5997('0x11')](_0x3de87e));_0x10fbda(_0x3de87e);})[_0x5997('0x15')](function(_0x54e23a){logger[_0x5997('0x12')]('GetSmsQueue',_0x54e23a[_0x5997('0x14')],_0x552245);_0x29f852(_0x5d3564[_0x5997('0x12')](0x1f4,_0x54e23a[_0x5997('0x14')]));});});};exports['ShowSmsQueue']=function(_0x20f9d1){var _0x4785dc=this;return new Promise(function(_0x4cf59d,_0x282d60){return db[_0x5997('0x17')][_0x5997('0x1e')]({'raw':_0x20f9d1[_0x5997('0x18')]?_0x20f9d1[_0x5997('0x18')][_0x5997('0x1f')]===undefined?!![]:![]:!![],'where':_0x20f9d1[_0x5997('0x18')]?_0x20f9d1[_0x5997('0x18')][_0x5997('0x20')]||null:null,'attributes':_0x20f9d1[_0x5997('0x18')]?_0x20f9d1[_0x5997('0x18')][_0x5997('0x1c')]||null:null,'include':_0x20f9d1[_0x5997('0x18')]?_0x20f9d1[_0x5997('0x18')][_0x5997('0x1b')]?_[_0x5997('0x1a')](_0x20f9d1[_0x5997('0x18')][_0x5997('0x1b')],function(_0x3e6c00){return{'model':db[_0x3e6c00[_0x5997('0x1d')]],'as':_0x3e6c00['as'],'attributes':_0x3e6c00[_0x5997('0x1c')],'include':_0x3e6c00[_0x5997('0x1b')]?_['map'](_0x3e6c00['include'],function(_0x11f8c2){return{'model':db[_0x11f8c2[_0x5997('0x1d')]],'as':_0x11f8c2['as'],'attributes':_0x11f8c2[_0x5997('0x1c')],'include':_0x11f8c2[_0x5997('0x1b')]?_[_0x5997('0x1a')](_0x11f8c2['include'],function(_0x1313f5){return{'model':db[_0x1313f5[_0x5997('0x1d')]],'as':_0x1313f5['as'],'attributes':_0x1313f5[_0x5997('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f38a7){logger[_0x5997('0xd')]('ShowSmsQueue',_0x20f9d1);logger[_0x5997('0x10')](_0x5997('0x21'),_0x20f9d1,JSON[_0x5997('0x11')](_0x3f38a7));_0x4cf59d(_0x3f38a7);})[_0x5997('0x15')](function(_0x1e702d){logger[_0x5997('0x12')](_0x5997('0x21'),_0x1e702d['message'],_0x20f9d1);_0x282d60(_0x4785dc['error'](0x1f4,_0x1e702d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 394f194..2c8b2b1 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 _0xd80f=['save','remove','update','removeListener','smsQueue:'];(function(_0x52c28e,_0x403f49){var _0x30c066=function(_0x4c0380){while(--_0x4c0380){_0x52c28e['push'](_0x52c28e['shift']());}};_0x30c066(++_0x403f49);}(_0xd80f,0xa5));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xfd80('0x0'),_0xfd80('0x1'),_0xfd80('0x2')];function createListener(_0xf688b,_0x4ebce7){return function(_0x15aef4){_0x4ebce7['emit'](_0xf688b,_0x15aef4);};}function removeListener(_0x112bdd,_0x12b93c){return function(){SmsQueueEvents[_0xfd80('0x3')](_0x112bdd,_0x12b93c);};}exports['register']=function(_0x283c23){for(var _0x484f9d=0x0,_0x11062a=events['length'];_0x484f9d<_0x11062a;_0x484f9d++){var _0x32c171=events[_0x484f9d];var _0x349b61=createListener(_0xfd80('0x4')+_0x32c171,_0x283c23);SmsQueueEvents['on'](_0x32c171,_0x349b61);}}; \ No newline at end of file +var _0x1957=['register','length','./smsQueue.events','save','remove','emit','removeListener'];(function(_0x3b7e10,_0x32c751){var _0xf7e7a6=function(_0x264c5a){while(--_0x264c5a){_0x3b7e10['push'](_0x3b7e10['shift']());}};_0xf7e7a6(++_0x32c751);}(_0x1957,0xf0));var _0x7195=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x1957[_0x4de586];return _0x46baf5;};'use strict';var SmsQueueEvents=require(_0x7195('0x0'));var events=[_0x7195('0x1'),_0x7195('0x2'),'update'];function createListener(_0x580de2,_0x2c199a){return function(_0x4b4990){_0x2c199a[_0x7195('0x3')](_0x580de2,_0x4b4990);};}function removeListener(_0x2a5cfc,_0x18a9d6){return function(){SmsQueueEvents[_0x7195('0x4')](_0x2a5cfc,_0x18a9d6);};}exports[_0x7195('0x5')]=function(_0x368e9c){for(var _0x4c960a=0x0,_0x2a840c=events[_0x7195('0x6')];_0x4c960a<_0x2a840c;_0x4c960a++){var _0x1332eb=events[_0x4c960a];var _0x5e37a4=createListener('smsQueue:'+_0x1332eb,_0x368e9c);SmsQueueEvents['on'](_0x1332eb,_0x5e37a4);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index cfd53d3..239a8e2 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 _0xc4b2=['../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','multer','util','path','express','Router'];(function(_0x32e641,_0x2361bc){var _0x1db89a=function(_0x4735f7){while(--_0x4735f7){_0x32e641['push'](_0x32e641['shift']());}};_0x1db89a(++_0x2361bc);}(_0xc4b2,0x118));var _0x2c4b=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0xc4b2[_0x1085db];return _0x392a60;};'use strict';var multer=require(_0x2c4b('0x0'));var util=require(_0x2c4b('0x1'));var path=require(_0x2c4b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c4b('0x3'));var router=express[_0x2c4b('0x4')]();var auth=require(_0x2c4b('0x5'));var interaction=require(_0x2c4b('0x6'));var config=require('../../config/environment');var controller=require(_0x2c4b('0x7'));router[_0x2c4b('0x8')]('/',auth[_0x2c4b('0x9')](),controller[_0x2c4b('0xa')]);router['get']('/describe',auth[_0x2c4b('0x9')](),controller[_0x2c4b('0xb')]);router[_0x2c4b('0x8')](_0x2c4b('0xc'),auth['isAuthenticated'](),controller[_0x2c4b('0xd')]);router[_0x2c4b('0xe')]('/',auth[_0x2c4b('0x9')](),controller[_0x2c4b('0xf')]);router[_0x2c4b('0x10')](_0x2c4b('0xc'),auth['isAuthenticated'](),controller[_0x2c4b('0x11')]);router[_0x2c4b('0x12')](_0x2c4b('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa460=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xa460,0x188));var _0x0a46=function(_0x4b78bf,_0x2af314){_0x4b78bf=_0x4b78bf-0x0;var _0x5ef80f=_0xa460[_0x4b78bf];return _0x5ef80f;};'use strict';var multer=require(_0x0a46('0x0'));var util=require(_0x0a46('0x1'));var path=require(_0x0a46('0x2'));var timeout=require(_0x0a46('0x3'));var express=require(_0x0a46('0x4'));var router=express[_0x0a46('0x5')]();var auth=require(_0x0a46('0x6'));var interaction=require(_0x0a46('0x7'));var config=require(_0x0a46('0x8'));var controller=require(_0x0a46('0x9'));router[_0x0a46('0xa')]('/',auth[_0x0a46('0xb')](),controller[_0x0a46('0xc')]);router[_0x0a46('0xa')](_0x0a46('0xd'),auth['isAuthenticated'](),controller[_0x0a46('0xe')]);router[_0x0a46('0xa')](_0x0a46('0xf'),auth['isAuthenticated'](),controller[_0x0a46('0x10')]);router['post']('/',auth[_0x0a46('0xb')](),controller[_0x0a46('0x11')]);router[_0x0a46('0x12')](_0x0a46('0xf'),auth['isAuthenticated'](),controller[_0x0a46('0x13')]);router[_0x0a46('0x14')](_0x0a46('0xf'),auth['isAuthenticated'](),controller[_0x0a46('0x15')]);module[_0x0a46('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ea575e6..4c069e3 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 _0x66f5=['exports','STRING','DATE','sequelize'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x66f5,0x16b));var _0x566f=function(_0x2c4ef8,_0x5cc03f){_0x2c4ef8=_0x2c4ef8-0x0;var _0x3f2544=_0x66f5[_0x2c4ef8];return _0x3f2544;};'use strict';var moment=require('moment');var Sequelize=require(_0x566f('0x0'));module[_0x566f('0x1')]={'uniqueid':{'type':Sequelize[_0x566f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x566f('0x2')]},'joinAt':{'type':Sequelize[_0x566f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x566f('0x3')]},'exitAt':{'type':Sequelize[_0x566f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42e6=['moment','sequelize','exports','STRING','DATE'];(function(_0x23ebd0,_0x24a419){var _0x2f7add=function(_0x589b26){while(--_0x589b26){_0x23ebd0['push'](_0x23ebd0['shift']());}};_0x2f7add(++_0x24a419);}(_0x42e6,0x1ae));var _0x642e=function(_0x3592ec,_0x4a41d0){_0x3592ec=_0x3592ec-0x0;var _0x4a683c=_0x42e6[_0x3592ec];return _0x4a683c;};'use strict';var moment=require(_0x642e('0x0'));var Sequelize=require(_0x642e('0x1'));module[_0x642e('0x2')]={'uniqueid':{'type':Sequelize[_0x642e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x642e('0x4')]},'leaveAt':{'type':Sequelize[_0x642e('0x4')]},'acceptAt':{'type':Sequelize[_0x642e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x642e('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index faa58ec..64fb319 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 _0x865f=['includeAll','include','findAll','rows','show','params','rawAttributes','length','create','catch','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','send','SmsQueueReport','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','nolimit','order','where','pick','filter','VIRTUAL','merge','options','count'];(function(_0xe6e3e2,_0x2b01da){var _0x126571=function(_0x515ab3){while(--_0x515ab3){_0xe6e3e2['push'](_0xe6e3e2['shift']());}};_0x126571(++_0x2b01da);}(_0x865f,0x14a));var _0xf865=function(_0x4be820,_0x52d6f7){_0x4be820=_0x4be820-0x0;var _0x222e5c=_0x865f[_0x4be820];return _0x222e5c;};'use strict';var pdf=require(_0xf865('0x0'));var emlformat=require(_0xf865('0x1'));var rimraf=require(_0xf865('0x2'));var zipdir=require(_0xf865('0x3'));var jsonpatch=require(_0xf865('0x4'));var rp=require(_0xf865('0x5'));var moment=require(_0xf865('0x6'));var BPromise=require(_0xf865('0x7'));var Mustache=require(_0xf865('0x8'));var util=require(_0xf865('0x9'));var path=require(_0xf865('0xa'));var sox=require(_0xf865('0xb'));var csv=require(_0xf865('0xc'));var ejs=require(_0xf865('0xd'));var fs=require('fs');var _=require(_0xf865('0xe'));var squel=require(_0xf865('0xf'));var crypto=require(_0xf865('0x10'));var jsforce=require(_0xf865('0x11'));var deskjs=require(_0xf865('0x12'));var toCsv=require(_0xf865('0xc'));var querystring=require('querystring');var Papa=require(_0xf865('0x13'));var Redis=require(_0xf865('0x14'));var authService=require(_0xf865('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf865('0x16'));var hardwareService=require(_0xf865('0x17'));var logger=require(_0xf865('0x18'))(_0xf865('0x19'));var utils=require(_0xf865('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf865('0x1b'));var db=require(_0xf865('0x1c'))['db'];function respondWithStatusCode(_0x56c148,_0x7449e9){_0x7449e9=_0x7449e9||0xcc;return function(_0x4eee02){if(_0x4eee02){return _0x56c148[_0xf865('0x1d')](_0x7449e9);}return _0x56c148[_0xf865('0x1e')](_0x7449e9)[_0xf865('0x1f')]();};}function respondWithResult(_0x1be5b1,_0x29f230){_0x29f230=_0x29f230||0xc8;return function(_0x4a3d9b){if(_0x4a3d9b){return _0x1be5b1[_0xf865('0x1e')](_0x29f230)['json'](_0x4a3d9b);}};}function respondWithFilteredResult(_0x4dc056,_0x25bfb3){return function(_0x5ecfbd){if(_0x5ecfbd){var _0x3fc383=_0x5ecfbd['count'],_0x5dde40=_0x25bfb3[_0xf865('0x20')],_0x50fdd4=_0x25bfb3[_0xf865('0x20')]+_0x25bfb3[_0xf865('0x21')],_0x5c02ed;if(_0x50fdd4>=_0x3fc383){_0x50fdd4=_0x3fc383;_0x5c02ed=0xc8;}else{_0x5c02ed=0xce;}_0x4dc056['status'](_0x5c02ed);return _0x4dc056[_0xf865('0x22')]('Content-Range',_0x5dde40+'-'+_0x50fdd4+'/'+_0x3fc383)[_0xf865('0x23')](_0x5ecfbd);}return null;};}function patchUpdates(_0x49c0f1){return function(_0x2d3027){try{jsonpatch[_0xf865('0x24')](_0x2d3027,_0x49c0f1,!![]);}catch(_0x41c437){return BPromise[_0xf865('0x25')](_0x41c437);}return _0x2d3027[_0xf865('0x26')]();};}function saveUpdates(_0x3237fc,_0xf74810){return function(_0x45d7f5){if(_0x45d7f5){return _0x45d7f5[_0xf865('0x27')](_0x3237fc)[_0xf865('0x28')](function(_0x3a043b){return _0x3a043b;});}return null;};}function removeEntity(_0x3669ca,_0xc0024){return function(_0x3bb888){if(_0x3bb888){return _0x3bb888['destroy']()[_0xf865('0x28')](function(){_0x3669ca[_0xf865('0x1e')](0xcc)[_0xf865('0x1f')]();});}};}function handleEntityNotFound(_0x33bee5,_0x375d31){return function(_0x37824e){if(!_0x37824e){_0x33bee5[_0xf865('0x1d')](0x194);}return _0x37824e;};}function handleError(_0x17ad95,_0x57cbf2){_0x57cbf2=_0x57cbf2||0x1f4;return function(_0x4a45a4){logger[_0xf865('0x29')](_0x4a45a4[_0xf865('0x2a')]);if(_0x4a45a4[_0xf865('0x2b')]){delete _0x4a45a4[_0xf865('0x2b')];}_0x17ad95['status'](_0x57cbf2)[_0xf865('0x2c')](_0x4a45a4);};}exports['index']=function(_0x48ef29,_0x449162){var _0x20547d={},_0xc9bd73={},_0x55aaa5={'count':0x0,'rows':[]};var _0x1e4dea=_['map'](db[_0xf865('0x2d')]['rawAttributes'],function(_0x47d0a6){return{'name':_0x47d0a6[_0xf865('0x2e')],'type':_0x47d0a6[_0xf865('0x2f')]['key']};});_0xc9bd73[_0xf865('0x30')]=_[_0xf865('0x31')](_0x1e4dea,_0xf865('0x2b'));_0xc9bd73['query']=_[_0xf865('0x32')](_0x48ef29['query']);_0xc9bd73[_0xf865('0x33')]=_[_0xf865('0x34')](_0xc9bd73[_0xf865('0x30')],_0xc9bd73[_0xf865('0x35')]);_0x20547d[_0xf865('0x36')]=_['intersection'](_0xc9bd73[_0xf865('0x30')],qs[_0xf865('0x37')](_0x48ef29[_0xf865('0x35')][_0xf865('0x37')]));_0x20547d[_0xf865('0x36')]=_0x20547d[_0xf865('0x36')]['length']?_0x20547d['attributes']:_0xc9bd73[_0xf865('0x30')];if(!_0x48ef29[_0xf865('0x35')]['hasOwnProperty'](_0xf865('0x38'))){_0x20547d['limit']=qs[_0xf865('0x21')](_0x48ef29[_0xf865('0x35')][_0xf865('0x21')]);_0x20547d[_0xf865('0x20')]=qs[_0xf865('0x20')](_0x48ef29[_0xf865('0x35')][_0xf865('0x20')]);}_0x20547d[_0xf865('0x39')]=qs['sort'](_0x48ef29[_0xf865('0x35')]['sort']);_0x20547d[_0xf865('0x3a')]=qs[_0xf865('0x33')](_[_0xf865('0x3b')](_0x48ef29['query'],_0xc9bd73['filters']),_0x1e4dea);if(_0x48ef29['query'][_0xf865('0x3c')]){_0x20547d[_0xf865('0x3a')]=_['merge'](_0x20547d[_0xf865('0x3a')],{'$or':_[_0xf865('0x31')](_0x1e4dea,function(_0x1742b1){if(_0x1742b1[_0xf865('0x2f')]!==_0xf865('0x3d')){var _0xc136d1={};_0xc136d1[_0x1742b1[_0xf865('0x2b')]]={'$like':'%'+_0x48ef29['query']['filter']+'%'};return _0xc136d1;}})});}_0x20547d=_[_0xf865('0x3e')]({},_0x20547d,_0x48ef29[_0xf865('0x3f')]);var _0x2fdf69={'where':_0x20547d[_0xf865('0x3a')]};return db[_0xf865('0x2d')][_0xf865('0x40')](_0x2fdf69)['then'](function(_0x62acc2){_0x55aaa5['count']=_0x62acc2;if(_0x48ef29['query'][_0xf865('0x41')]){_0x20547d[_0xf865('0x42')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xf865('0x43')](_0x20547d);})[_0xf865('0x28')](function(_0x185560){_0x55aaa5[_0xf865('0x44')]=_0x185560;return _0x55aaa5;})['then'](respondWithFilteredResult(_0x449162,_0x20547d))['catch'](handleError(_0x449162,null));};exports[_0xf865('0x45')]=function(_0x4c96ca,_0x14633d){var _0xf20791={'raw':!![],'where':{'id':_0x4c96ca[_0xf865('0x46')]['id']}},_0xacaed3={};_0xacaed3['model']=_[_0xf865('0x32')](db['SmsQueueReport'][_0xf865('0x47')]);_0xacaed3[_0xf865('0x35')]=_['keys'](_0x4c96ca[_0xf865('0x35')]);_0xacaed3[_0xf865('0x33')]=_[_0xf865('0x34')](_0xacaed3['model'],_0xacaed3[_0xf865('0x35')]);_0xf20791[_0xf865('0x36')]=_[_0xf865('0x34')](_0xacaed3[_0xf865('0x30')],qs[_0xf865('0x37')](_0x4c96ca['query'][_0xf865('0x37')]));_0xf20791['attributes']=_0xf20791[_0xf865('0x36')][_0xf865('0x48')]?_0xf20791[_0xf865('0x36')]:_0xacaed3[_0xf865('0x30')];if(_0x4c96ca[_0xf865('0x35')][_0xf865('0x41')]){_0xf20791[_0xf865('0x42')]=[{'all':!![]}];}_0xf20791=_[_0xf865('0x3e')]({},_0xf20791,_0x4c96ca[_0xf865('0x3f')]);return db[_0xf865('0x2d')]['find'](_0xf20791)[_0xf865('0x28')](handleEntityNotFound(_0x14633d,null))[_0xf865('0x28')](respondWithResult(_0x14633d,null))['catch'](handleError(_0x14633d,null));};exports[_0xf865('0x49')]=function(_0x1ef9cf,_0x129599){return db[_0xf865('0x2d')][_0xf865('0x49')](_0x1ef9cf['body'],{})[_0xf865('0x28')](respondWithResult(_0x129599,0xc9))[_0xf865('0x4a')](handleError(_0x129599,null));};exports[_0xf865('0x27')]=function(_0x20fdb9,_0x466231){if(_0x20fdb9[_0xf865('0x4b')]['id']){delete _0x20fdb9['body']['id'];}return db[_0xf865('0x2d')][_0xf865('0x4c')]({'where':{'id':_0x20fdb9[_0xf865('0x46')]['id']}})['then'](handleEntityNotFound(_0x466231,null))[_0xf865('0x28')](saveUpdates(_0x20fdb9[_0xf865('0x4b')],null))[_0xf865('0x28')](respondWithResult(_0x466231,null))['catch'](handleError(_0x466231,null));};exports[_0xf865('0x4d')]=function(_0x4b6a95,_0x6b4dd0){return db[_0xf865('0x2d')]['find']({'where':{'id':_0x4b6a95[_0xf865('0x46')]['id']}})['then'](handleEntityNotFound(_0x6b4dd0,null))[_0xf865('0x28')](removeEntity(_0x6b4dd0,null))[_0xf865('0x4a')](handleError(_0x6b4dd0,null));};exports[_0xf865('0x4e')]=function(_0x564ef7,_0x261034){return db[_0xf865('0x2d')][_0xf865('0x4e')]()[_0xf865('0x28')](respondWithResult(_0x261034,null))[_0xf865('0x4a')](handleError(_0x261034,null));}; \ No newline at end of file +var _0xd97f=['fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueueReport','includeAll','include','rows','catch','show','params','keys','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes'];(function(_0x13d574,_0x25659e){var _0x3eaa12=function(_0x3b32aa){while(--_0x3b32aa){_0x13d574['push'](_0x13d574['shift']());}};_0x3eaa12(++_0x25659e);}(_0xd97f,0x1e2));var _0xfd97=function(_0x403711,_0x184ace){_0x403711=_0x403711-0x0;var _0x4baa03=_0xd97f[_0x403711];return _0x4baa03;};'use strict';var pdf=require(_0xfd97('0x0'));var emlformat=require(_0xfd97('0x1'));var rimraf=require(_0xfd97('0x2'));var zipdir=require(_0xfd97('0x3'));var jsonpatch=require(_0xfd97('0x4'));var rp=require('request-promise');var moment=require(_0xfd97('0x5'));var BPromise=require(_0xfd97('0x6'));var Mustache=require(_0xfd97('0x7'));var util=require('util');var path=require(_0xfd97('0x8'));var sox=require('sox');var csv=require(_0xfd97('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd97('0xa'));var squel=require(_0xfd97('0xb'));var crypto=require(_0xfd97('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd97('0xd'));var toCsv=require(_0xfd97('0x9'));var querystring=require('querystring');var Papa=require(_0xfd97('0xe'));var Redis=require(_0xfd97('0xf'));var authService=require(_0xfd97('0x10'));var qs=require(_0xfd97('0x11'));var as=require(_0xfd97('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd97('0x13'))(_0xfd97('0x14'));var utils=require(_0xfd97('0x15'));var config=require(_0xfd97('0x16'));var licenseUtil=require(_0xfd97('0x17'));var db=require(_0xfd97('0x18'))['db'];function respondWithStatusCode(_0x2c1a17,_0xa23361){_0xa23361=_0xa23361||0xcc;return function(_0x56b36b){if(_0x56b36b){return _0x2c1a17[_0xfd97('0x19')](_0xa23361);}return _0x2c1a17[_0xfd97('0x1a')](_0xa23361)[_0xfd97('0x1b')]();};}function respondWithResult(_0x294363,_0x5f0c3c){_0x5f0c3c=_0x5f0c3c||0xc8;return function(_0x4959be){if(_0x4959be){return _0x294363[_0xfd97('0x1a')](_0x5f0c3c)[_0xfd97('0x1c')](_0x4959be);}};}function respondWithFilteredResult(_0x11e137,_0x18e4cd){return function(_0xb040d){if(_0xb040d){var _0x344be6=_0xb040d[_0xfd97('0x1d')],_0x5796c3=_0x18e4cd[_0xfd97('0x1e')],_0x4cba30=_0x18e4cd[_0xfd97('0x1e')]+_0x18e4cd['limit'],_0x500089;if(_0x4cba30>=_0x344be6){_0x4cba30=_0x344be6;_0x500089=0xc8;}else{_0x500089=0xce;}_0x11e137[_0xfd97('0x1a')](_0x500089);return _0x11e137[_0xfd97('0x1f')](_0xfd97('0x20'),_0x5796c3+'-'+_0x4cba30+'/'+_0x344be6)[_0xfd97('0x1c')](_0xb040d);}return null;};}function patchUpdates(_0xd8e5de){return function(_0x4853d3){try{jsonpatch[_0xfd97('0x21')](_0x4853d3,_0xd8e5de,!![]);}catch(_0x53fd8d){return BPromise['reject'](_0x53fd8d);}return _0x4853d3[_0xfd97('0x22')]();};}function saveUpdates(_0x1f2f14,_0x344ea7){return function(_0x165d0f){if(_0x165d0f){return _0x165d0f[_0xfd97('0x23')](_0x1f2f14)[_0xfd97('0x24')](function(_0x29d55f){return _0x29d55f;});}return null;};}function removeEntity(_0x2e5ab3,_0x42bac4){return function(_0x1d43c2){if(_0x1d43c2){return _0x1d43c2[_0xfd97('0x25')]()[_0xfd97('0x24')](function(){_0x2e5ab3[_0xfd97('0x1a')](0xcc)[_0xfd97('0x1b')]();});}};}function handleEntityNotFound(_0x227bb7,_0x229fca){return function(_0xd6e78b){if(!_0xd6e78b){_0x227bb7[_0xfd97('0x19')](0x194);}return _0xd6e78b;};}function handleError(_0x2be351,_0x44f151){_0x44f151=_0x44f151||0x1f4;return function(_0x4fd19c){logger[_0xfd97('0x26')](_0x4fd19c['stack']);if(_0x4fd19c[_0xfd97('0x27')]){delete _0x4fd19c['name'];}_0x2be351['status'](_0x44f151)['send'](_0x4fd19c);};}exports[_0xfd97('0x28')]=function(_0x381dae,_0x47cde6){var _0x25b4e9={},_0x41237b={},_0x5af2f2={'count':0x0,'rows':[]};var _0x46ee84=_[_0xfd97('0x29')](db['SmsQueueReport'][_0xfd97('0x2a')],function(_0x1cfcc3){return{'name':_0x1cfcc3[_0xfd97('0x2b')],'type':_0x1cfcc3[_0xfd97('0x2c')][_0xfd97('0x2d')]};});_0x41237b[_0xfd97('0x2e')]=_[_0xfd97('0x29')](_0x46ee84,_0xfd97('0x27'));_0x41237b[_0xfd97('0x2f')]=_['keys'](_0x381dae[_0xfd97('0x2f')]);_0x41237b[_0xfd97('0x30')]=_['intersection'](_0x41237b[_0xfd97('0x2e')],_0x41237b[_0xfd97('0x2f')]);_0x25b4e9[_0xfd97('0x31')]=_[_0xfd97('0x32')](_0x41237b[_0xfd97('0x2e')],qs[_0xfd97('0x33')](_0x381dae[_0xfd97('0x2f')][_0xfd97('0x33')]));_0x25b4e9['attributes']=_0x25b4e9[_0xfd97('0x31')][_0xfd97('0x34')]?_0x25b4e9['attributes']:_0x41237b[_0xfd97('0x2e')];if(!_0x381dae[_0xfd97('0x2f')]['hasOwnProperty'](_0xfd97('0x35'))){_0x25b4e9[_0xfd97('0x36')]=qs[_0xfd97('0x36')](_0x381dae[_0xfd97('0x2f')][_0xfd97('0x36')]);_0x25b4e9[_0xfd97('0x1e')]=qs['offset'](_0x381dae[_0xfd97('0x2f')][_0xfd97('0x1e')]);}_0x25b4e9[_0xfd97('0x37')]=qs['sort'](_0x381dae[_0xfd97('0x2f')][_0xfd97('0x38')]);_0x25b4e9[_0xfd97('0x39')]=qs[_0xfd97('0x30')](_[_0xfd97('0x3a')](_0x381dae[_0xfd97('0x2f')],_0x41237b[_0xfd97('0x30')]),_0x46ee84);if(_0x381dae['query'][_0xfd97('0x3b')]){_0x25b4e9[_0xfd97('0x39')]=_[_0xfd97('0x3c')](_0x25b4e9[_0xfd97('0x39')],{'$or':_[_0xfd97('0x29')](_0x46ee84,function(_0x4597b3){if(_0x4597b3[_0xfd97('0x2c')]!==_0xfd97('0x3d')){var _0x310250={};_0x310250[_0x4597b3[_0xfd97('0x27')]]={'$like':'%'+_0x381dae[_0xfd97('0x2f')][_0xfd97('0x3b')]+'%'};return _0x310250;}})});}_0x25b4e9=_['merge']({},_0x25b4e9,_0x381dae['options']);var _0x5c04bd={'where':_0x25b4e9[_0xfd97('0x39')]};return db[_0xfd97('0x3e')][_0xfd97('0x1d')](_0x5c04bd)[_0xfd97('0x24')](function(_0x55ce38){_0x5af2f2[_0xfd97('0x1d')]=_0x55ce38;if(_0x381dae[_0xfd97('0x2f')][_0xfd97('0x3f')]){_0x25b4e9[_0xfd97('0x40')]=[{'all':!![]}];}return db[_0xfd97('0x3e')]['findAll'](_0x25b4e9);})[_0xfd97('0x24')](function(_0x383600){_0x5af2f2[_0xfd97('0x41')]=_0x383600;return _0x5af2f2;})['then'](respondWithFilteredResult(_0x47cde6,_0x25b4e9))[_0xfd97('0x42')](handleError(_0x47cde6,null));};exports[_0xfd97('0x43')]=function(_0x1ddb2d,_0x399285){var _0x5661d4={'raw':!![],'where':{'id':_0x1ddb2d[_0xfd97('0x44')]['id']}},_0x16e3a1={};_0x16e3a1[_0xfd97('0x2e')]=_[_0xfd97('0x45')](db[_0xfd97('0x3e')][_0xfd97('0x2a')]);_0x16e3a1[_0xfd97('0x2f')]=_['keys'](_0x1ddb2d[_0xfd97('0x2f')]);_0x16e3a1[_0xfd97('0x30')]=_[_0xfd97('0x32')](_0x16e3a1[_0xfd97('0x2e')],_0x16e3a1[_0xfd97('0x2f')]);_0x5661d4['attributes']=_['intersection'](_0x16e3a1['model'],qs[_0xfd97('0x33')](_0x1ddb2d[_0xfd97('0x2f')][_0xfd97('0x33')]));_0x5661d4[_0xfd97('0x31')]=_0x5661d4['attributes'][_0xfd97('0x34')]?_0x5661d4['attributes']:_0x16e3a1['model'];if(_0x1ddb2d['query'][_0xfd97('0x3f')]){_0x5661d4[_0xfd97('0x40')]=[{'all':!![]}];}_0x5661d4=_[_0xfd97('0x3c')]({},_0x5661d4,_0x1ddb2d[_0xfd97('0x46')]);return db['SmsQueueReport'][_0xfd97('0x47')](_0x5661d4)[_0xfd97('0x24')](handleEntityNotFound(_0x399285,null))[_0xfd97('0x24')](respondWithResult(_0x399285,null))[_0xfd97('0x42')](handleError(_0x399285,null));};exports[_0xfd97('0x48')]=function(_0x54fab7,_0xcda5f9){return db[_0xfd97('0x3e')][_0xfd97('0x48')](_0x54fab7['body'],{})[_0xfd97('0x24')](respondWithResult(_0xcda5f9,0xc9))[_0xfd97('0x42')](handleError(_0xcda5f9,null));};exports[_0xfd97('0x23')]=function(_0x3738f6,_0x4675ab){if(_0x3738f6[_0xfd97('0x49')]['id']){delete _0x3738f6[_0xfd97('0x49')]['id'];}return db[_0xfd97('0x3e')][_0xfd97('0x47')]({'where':{'id':_0x3738f6[_0xfd97('0x44')]['id']}})[_0xfd97('0x24')](handleEntityNotFound(_0x4675ab,null))[_0xfd97('0x24')](saveUpdates(_0x3738f6['body'],null))['then'](respondWithResult(_0x4675ab,null))[_0xfd97('0x42')](handleError(_0x4675ab,null));};exports[_0xfd97('0x25')]=function(_0x28acd6,_0x2564a0){return db[_0xfd97('0x3e')][_0xfd97('0x47')]({'where':{'id':_0x28acd6[_0xfd97('0x44')]['id']}})[_0xfd97('0x24')](handleEntityNotFound(_0x2564a0,null))[_0xfd97('0x24')](removeEntity(_0x2564a0,null))['catch'](handleError(_0x2564a0,null));};exports[_0xfd97('0x4a')]=function(_0x4e368f,_0x55d0dd){return db[_0xfd97('0x3e')][_0xfd97('0x4a')]()['then'](respondWithResult(_0x55d0dd,null))['catch'](handleError(_0x55d0dd,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 543c5a3..f0f43db 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 _0xb664=['rimraf','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x4d72a3,_0xf31533){var _0x2dd149=function(_0x5b2a72){while(--_0x5b2a72){_0x4d72a3['push'](_0x4d72a3['shift']());}};_0x2dd149(++_0xf31533);}(_0xb664,0x192));var _0x4b66=function(_0x39d6b8,_0x7d5e5d){_0x39d6b8=_0x39d6b8-0x0;var _0x22a9ab=_0xb664[_0x39d6b8];return _0x22a9ab;};'use strict';var _=require(_0x4b66('0x0'));var util=require(_0x4b66('0x1'));var logger=require(_0x4b66('0x2'))('api');var moment=require(_0x4b66('0x3'));var BPromise=require(_0x4b66('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b66('0x5'));var rimraf=require(_0x4b66('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b66('0x7'));module['exports']=function(_0x280b38,_0x280f52){return _0x280b38[_0x4b66('0x8')](_0x4b66('0x9'),attributes,{'tableName':_0x4b66('0xa'),'paranoid':![],'indexes':[{'name':_0x4b66('0xb'),'fields':[_0x4b66('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cea=['SmsQueueReport','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define'];(function(_0x2b430a,_0x1aa926){var _0x40e162=function(_0x47ca1d){while(--_0x47ca1d){_0x2b430a['push'](_0x2b430a['shift']());}};_0x40e162(++_0x1aa926);}(_0x1cea,0xfe));var _0xa1ce=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x1cea[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1ce('0x0'))(_0xa1ce('0x1'));var moment=require(_0xa1ce('0x2'));var BPromise=require(_0xa1ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1ce('0x4'));var rimraf=require(_0xa1ce('0x5'));var config=require(_0xa1ce('0x6'));var attributes=require(_0xa1ce('0x7'));module[_0xa1ce('0x8')]=function(_0x17654c,_0x5aab1c){return _0x17654c[_0xa1ce('0x9')](_0xa1ce('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xa1ce('0xb'),'fields':[_0xa1ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e1461bf..d882368 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 _0xcc82=['update','options','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','raw'];(function(_0x3659df,_0x3dc5c9){var _0x3dec0=function(_0x1f4406){while(--_0x1f4406){_0x3659df['push'](_0x3659df['shift']());}};_0x3dec0(++_0x3dc5c9);}(_0xcc82,0xa5));var _0x2cc8=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0xcc82[_0x5e3a45];return _0x13419f;};'use strict';var _=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var moment=require(_0x2cc8('0x2'));var BPromise=require(_0x2cc8('0x3'));var rs=require(_0x2cc8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2cc8('0x5'))(_0x2cc8('0x6'));var config=require(_0x2cc8('0x7'));var jayson=require(_0x2cc8('0x8'));var client=jayson[_0x2cc8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169c63,_0x1d18f2,_0x1e5ca7){return new BPromise(function(_0x51ea74,_0xc19acc){return client['request'](_0x169c63,_0x1e5ca7)[_0x2cc8('0xa')](function(_0x4be8a8){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1d18f2,_0x2cc8('0xb'));logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x1d18f2,_0x2cc8('0xb'),JSON[_0x2cc8('0xe')](_0x4be8a8));if(_0x4be8a8[_0x2cc8('0xf')]){if(_0x4be8a8[_0x2cc8('0xf')][_0x2cc8('0x10')]===0x1f4){logger['error'](_0x2cc8('0x11'),_0x1d18f2,_0x4be8a8[_0x2cc8('0xf')][_0x2cc8('0x12')]);return _0xc19acc(_0x4be8a8['error'][_0x2cc8('0x12')]);}logger[_0x2cc8('0xf')](_0x2cc8('0x11'),_0x1d18f2,_0x4be8a8[_0x2cc8('0xf')][_0x2cc8('0x12')]);return _0x51ea74(_0x4be8a8['error'][_0x2cc8('0x12')]);}else{logger[_0x2cc8('0x13')](_0x2cc8('0x11'),_0x1d18f2,_0x2cc8('0xb'));_0x51ea74(_0x4be8a8[_0x2cc8('0x14')][_0x2cc8('0x12')]);}})[_0x2cc8('0x15')](function(_0x5e1573){logger[_0x2cc8('0xf')](_0x2cc8('0x11'),_0x1d18f2,_0x5e1573);_0xc19acc(_0x5e1573);});});}exports[_0x2cc8('0x16')]=function(_0x20c740){var _0x57856b=this;return new Promise(function(_0x24fee0,_0x25b2f8){return db[_0x2cc8('0x17')][_0x2cc8('0x18')](_0x20c740[_0x2cc8('0x19')],{'raw':_0x20c740['options']?_0x20c740['options'][_0x2cc8('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x587917){logger[_0x2cc8('0x13')](_0x2cc8('0x16'),_0x20c740);logger[_0x2cc8('0xc')]('CreateSmsQueueReport',_0x20c740,JSON[_0x2cc8('0xe')](_0x587917));_0x24fee0(_0x587917);})[_0x2cc8('0x15')](function(_0x1f3633){logger[_0x2cc8('0xf')](_0x2cc8('0x16'),_0x1f3633[_0x2cc8('0x12')],_0x20c740);_0x25b2f8(_0x57856b[_0x2cc8('0xf')](0x1f4,_0x1f3633['message']));});});};exports['UpdateSmsQueueReport']=function(_0x34f68b){var _0x45d3f7=this;return new Promise(function(_0x13100f,_0x389021){return db['SmsQueueReport'][_0x2cc8('0x1b')](_0x34f68b[_0x2cc8('0x19')],{'raw':_0x34f68b[_0x2cc8('0x1c')]?_0x34f68b[_0x2cc8('0x1c')][_0x2cc8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f68b[_0x2cc8('0x1c')]?_0x34f68b[_0x2cc8('0x1c')]['where']||null:null,'attributes':_0x34f68b[_0x2cc8('0x1c')]?_0x34f68b[_0x2cc8('0x1c')][_0x2cc8('0x1d')]||null:null,'limit':_0x34f68b['options']?_0x34f68b[_0x2cc8('0x1c')][_0x2cc8('0x1e')]||null:null})['then'](function(_0x4d779e){logger[_0x2cc8('0x13')](_0x2cc8('0x1f'),_0x34f68b);logger[_0x2cc8('0xc')]('UpdateSmsQueueReport',_0x34f68b,JSON[_0x2cc8('0xe')](_0x4d779e));_0x13100f(_0x4d779e);})['catch'](function(_0x5b48fd){logger[_0x2cc8('0xf')]('UpdateSmsQueueReport',_0x5b48fd[_0x2cc8('0x12')],_0x34f68b);_0x389021(_0x45d3f7['error'](0x1f4,_0x5b48fd[_0x2cc8('0x12')]));});});}; \ No newline at end of file +var _0x769b=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','update','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x41fc8e,_0x218378){var _0x4156a1=function(_0x3dc7cd){while(--_0x3dc7cd){_0x41fc8e['push'](_0x41fc8e['shift']());}};_0x4156a1(++_0x218378);}(_0x769b,0xb4));var _0xb769=function(_0x1af764,_0x300dd2){_0x1af764=_0x1af764-0x0;var _0x508d41=_0x769b[_0x1af764];return _0x508d41;};'use strict';var _=require('lodash');var util=require(_0xb769('0x0'));var moment=require(_0xb769('0x1'));var BPromise=require(_0xb769('0x2'));var rs=require(_0xb769('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb769('0x4'))['db'];var utils=require(_0xb769('0x5'));var logger=require(_0xb769('0x6'))('rpc');var config=require(_0xb769('0x7'));var jayson=require(_0xb769('0x8'));var client=jayson[_0xb769('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f608,_0x39346f,_0x38cb20){return new BPromise(function(_0x2b0306,_0xf33df8){return client[_0xb769('0xa')](_0x32f608,_0x38cb20)[_0xb769('0xb')](function(_0x4dc795){logger[_0xb769('0xc')](_0xb769('0xd'),_0x39346f,_0xb769('0xe'));logger[_0xb769('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x39346f,_0xb769('0xe'),JSON[_0xb769('0x10')](_0x4dc795));if(_0x4dc795['error']){if(_0x4dc795[_0xb769('0x11')][_0xb769('0x12')]===0x1f4){logger['error'](_0xb769('0xd'),_0x39346f,_0x4dc795[_0xb769('0x11')]['message']);return _0xf33df8(_0x4dc795[_0xb769('0x11')][_0xb769('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x39346f,_0x4dc795['error'][_0xb769('0x13')]);return _0x2b0306(_0x4dc795[_0xb769('0x11')]['message']);}else{logger[_0xb769('0xc')](_0xb769('0xd'),_0x39346f,_0xb769('0xe'));_0x2b0306(_0x4dc795[_0xb769('0x14')][_0xb769('0x13')]);}})[_0xb769('0x15')](function(_0x2b517e){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x39346f,_0x2b517e);_0xf33df8(_0x2b517e);});});}exports[_0xb769('0x16')]=function(_0x29309e){var _0x4bc457=this;return new Promise(function(_0x577f0d,_0x3c0213){return db[_0xb769('0x17')]['create'](_0x29309e[_0xb769('0x18')],{'raw':_0x29309e[_0xb769('0x19')]?_0x29309e[_0xb769('0x19')][_0xb769('0x1a')]===undefined?!![]:![]:!![]})[_0xb769('0xb')](function(_0x3f6d1e){logger[_0xb769('0xc')](_0xb769('0x16'),_0x29309e);logger[_0xb769('0xf')]('CreateSmsQueueReport',_0x29309e,JSON[_0xb769('0x10')](_0x3f6d1e));_0x577f0d(_0x3f6d1e);})['catch'](function(_0x45601a){logger[_0xb769('0x11')](_0xb769('0x16'),_0x45601a[_0xb769('0x13')],_0x29309e);_0x3c0213(_0x4bc457[_0xb769('0x11')](0x1f4,_0x45601a[_0xb769('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x23ac09){var _0x41da57=this;return new Promise(function(_0x28a8da,_0x37518a){return db[_0xb769('0x17')][_0xb769('0x1b')](_0x23ac09[_0xb769('0x18')],{'raw':_0x23ac09[_0xb769('0x19')]?_0x23ac09['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23ac09[_0xb769('0x19')]?_0x23ac09[_0xb769('0x19')]['where']||null:null,'attributes':_0x23ac09[_0xb769('0x19')]?_0x23ac09[_0xb769('0x19')][_0xb769('0x1c')]||null:null,'limit':_0x23ac09[_0xb769('0x19')]?_0x23ac09['options'][_0xb769('0x1d')]||null:null})['then'](function(_0x5131b3){logger[_0xb769('0xc')]('UpdateSmsQueueReport',_0x23ac09);logger[_0xb769('0xf')]('UpdateSmsQueueReport',_0x23ac09,JSON['stringify'](_0x5131b3));_0x28a8da(_0x5131b3);})[_0xb769('0x15')](function(_0x57ae8d){logger[_0xb769('0x11')](_0xb769('0x1e'),_0x57ae8d[_0xb769('0x13')],_0x23ac09);_0x37518a(_0x41da57['error'](0x1f4,_0x57ae8d[_0xb769('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 054ba1f..bf11ca3 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 _0x9ffd=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x3a2bdf,_0x38576d){var _0xb0ddb7=function(_0x1acdc6){while(--_0x1acdc6){_0x3a2bdf['push'](_0x3a2bdf['shift']());}};_0xb0ddb7(++_0x38576d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x59e1de,_0x47701e){_0x59e1de=_0x59e1de-0x0;var _0x53304e=_0x9ffd[_0x59e1de];return _0x53304e;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0xb688=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','util','path'];(function(_0x142a8b,_0x4ad194){var _0x275946=function(_0x3512a9){while(--_0x3512a9){_0x142a8b['push'](_0x142a8b['shift']());}};_0x275946(++_0x4ad194);}(_0xb688,0xcf));var _0x8b68=function(_0x2777c0,_0x3a3302){_0x2777c0=_0x2777c0-0x0;var _0x2a2e07=_0xb688[_0x2777c0];return _0x2a2e07;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',auth[_0x8b68('0x9')](),controller['index']);router[_0x8b68('0x8')]('/describe',auth[_0x8b68('0x9')](),controller[_0x8b68('0xa')]);router[_0x8b68('0x8')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')]('/',auth[_0x8b68('0x9')](),controller[_0x8b68('0xe')]);router[_0x8b68('0xf')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x10')]);router['delete'](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x11')]);module[_0x8b68('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index da32eee..6110f02 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 _0x482a=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x1a570e,_0x362bc2){var _0x483bd3=function(_0x3ac542){while(--_0x3ac542){_0x1a570e['push'](_0x1a570e['shift']());}};_0x483bd3(++_0x362bc2);}(_0x482a,0x197));var _0xa482=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x482a[_0x45f951];return _0x24756c;};'use strict';var moment=require(_0xa482('0x0'));var Sequelize=require(_0xa482('0x1'));module[_0xa482('0x2')]={'uniqueid':{'type':Sequelize[_0xa482('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa482('0x4')]('account',_0xa482('0x5'),_0xa482('0x6')),'allowNull':![],'defaultValue':_0xa482('0x6')},'transferredAt':{'type':Sequelize[_0xa482('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa482('0x8')]}}; \ No newline at end of file +var _0x9855=['STRING','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x6fef30,_0x28d692){var _0x29b11f=function(_0x2e4f5b){while(--_0x2e4f5b){_0x6fef30['push'](_0x6fef30['shift']());}};_0x29b11f(++_0x28d692);}(_0x9855,0x96));var _0x5985=function(_0x4abffa,_0x271252){_0x4abffa=_0x4abffa-0x0;var _0x393b45=_0x9855[_0x4abffa];return _0x393b45;};'use strict';var moment=require(_0x5985('0x0'));var Sequelize=require(_0x5985('0x1'));module[_0x5985('0x2')]={'uniqueid':{'type':Sequelize[_0x5985('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5985('0x4'),_0x5985('0x5'),'queue'),'allowNull':![],'defaultValue':_0x5985('0x6')},'transferredAt':{'type':Sequelize[_0x5985('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x5985('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bf17791..c7c863a 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 _0x28aa=['count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','reject','save','update','then','error','stack','index','SmsTransferReport','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x5dde79,_0x2ed14e){var _0x3a3679=function(_0x34ba4e){while(--_0x34ba4e){_0x5dde79['push'](_0x5dde79['shift']());}};_0x3a3679(++_0x2ed14e);}(_0x28aa,0xf8));var _0xa28a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x28aa[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa28a('0x0'));var rimraf=require(_0xa28a('0x1'));var zipdir=require(_0xa28a('0x2'));var jsonpatch=require(_0xa28a('0x3'));var rp=require(_0xa28a('0x4'));var moment=require(_0xa28a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa28a('0x6'));var util=require(_0xa28a('0x7'));var path=require(_0xa28a('0x8'));var sox=require(_0xa28a('0x9'));var csv=require('to-csv');var ejs=require(_0xa28a('0xa'));var fs=require('fs');var _=require(_0xa28a('0xb'));var squel=require(_0xa28a('0xc'));var crypto=require(_0xa28a('0xd'));var jsforce=require(_0xa28a('0xe'));var deskjs=require(_0xa28a('0xf'));var toCsv=require(_0xa28a('0x10'));var querystring=require(_0xa28a('0x11'));var Papa=require(_0xa28a('0x12'));var Redis=require(_0xa28a('0x13'));var authService=require(_0xa28a('0x14'));var qs=require(_0xa28a('0x15'));var as=require(_0xa28a('0x16'));var hardwareService=require(_0xa28a('0x17'));var logger=require(_0xa28a('0x18'))('api');var utils=require(_0xa28a('0x19'));var config=require(_0xa28a('0x1a'));var licenseUtil=require(_0xa28a('0x1b'));var db=require(_0xa28a('0x1c'))['db'];function respondWithStatusCode(_0x5c93d6,_0x94e91f){_0x94e91f=_0x94e91f||0xcc;return function(_0x3e254c){if(_0x3e254c){return _0x5c93d6['sendStatus'](_0x94e91f);}return _0x5c93d6[_0xa28a('0x1d')](_0x94e91f)[_0xa28a('0x1e')]();};}function respondWithResult(_0x69f85f,_0x412e0d){_0x412e0d=_0x412e0d||0xc8;return function(_0x52ee62){if(_0x52ee62){return _0x69f85f[_0xa28a('0x1d')](_0x412e0d)[_0xa28a('0x1f')](_0x52ee62);}};}function respondWithFilteredResult(_0x11ef7c,_0x1b4f6f){return function(_0x413d48){if(_0x413d48){var _0x56c1ae=_0x413d48['count'],_0x3018cd=_0x1b4f6f[_0xa28a('0x20')],_0x3d0607=_0x1b4f6f[_0xa28a('0x20')]+_0x1b4f6f[_0xa28a('0x21')],_0x15116a;if(_0x3d0607>=_0x56c1ae){_0x3d0607=_0x56c1ae;_0x15116a=0xc8;}else{_0x15116a=0xce;}_0x11ef7c[_0xa28a('0x1d')](_0x15116a);return _0x11ef7c[_0xa28a('0x22')]('Content-Range',_0x3018cd+'-'+_0x3d0607+'/'+_0x56c1ae)['json'](_0x413d48);}return null;};}function patchUpdates(_0x45d81b){return function(_0x516340){try{jsonpatch['apply'](_0x516340,_0x45d81b,!![]);}catch(_0x30f883){return BPromise[_0xa28a('0x23')](_0x30f883);}return _0x516340[_0xa28a('0x24')]();};}function saveUpdates(_0x46173d,_0x115d49){return function(_0x118736){if(_0x118736){return _0x118736[_0xa28a('0x25')](_0x46173d)[_0xa28a('0x26')](function(_0x28d062){return _0x28d062;});}return null;};}function removeEntity(_0x512e6c,_0x15b9cf){return function(_0x43bf00){if(_0x43bf00){return _0x43bf00['destroy']()[_0xa28a('0x26')](function(){_0x512e6c[_0xa28a('0x1d')](0xcc)[_0xa28a('0x1e')]();});}};}function handleEntityNotFound(_0x57cd58,_0x3770e4){return function(_0x27d680){if(!_0x27d680){_0x57cd58['sendStatus'](0x194);}return _0x27d680;};}function handleError(_0x413948,_0x19fff1){_0x19fff1=_0x19fff1||0x1f4;return function(_0xa3541b){logger[_0xa28a('0x27')](_0xa3541b[_0xa28a('0x28')]);if(_0xa3541b['name']){delete _0xa3541b['name'];}_0x413948[_0xa28a('0x1d')](_0x19fff1)['send'](_0xa3541b);};}exports[_0xa28a('0x29')]=function(_0x5f2579,_0x51b725){var _0x3d382e={},_0x3d0488={},_0x4713a2={'count':0x0,'rows':[]};var _0x3e5eb7=_['map'](db[_0xa28a('0x2a')]['rawAttributes'],function(_0x26c998){return{'name':_0x26c998[_0xa28a('0x2b')],'type':_0x26c998[_0xa28a('0x2c')][_0xa28a('0x2d')]};});_0x3d0488[_0xa28a('0x2e')]=_[_0xa28a('0x2f')](_0x3e5eb7,_0xa28a('0x30'));_0x3d0488[_0xa28a('0x31')]=_[_0xa28a('0x32')](_0x5f2579[_0xa28a('0x31')]);_0x3d0488[_0xa28a('0x33')]=_['intersection'](_0x3d0488[_0xa28a('0x2e')],_0x3d0488['query']);_0x3d382e[_0xa28a('0x34')]=_[_0xa28a('0x35')](_0x3d0488[_0xa28a('0x2e')],qs['fields'](_0x5f2579[_0xa28a('0x31')][_0xa28a('0x36')]));_0x3d382e[_0xa28a('0x34')]=_0x3d382e[_0xa28a('0x34')]['length']?_0x3d382e[_0xa28a('0x34')]:_0x3d0488[_0xa28a('0x2e')];if(!_0x5f2579['query'][_0xa28a('0x37')](_0xa28a('0x38'))){_0x3d382e[_0xa28a('0x21')]=qs[_0xa28a('0x21')](_0x5f2579[_0xa28a('0x31')]['limit']);_0x3d382e[_0xa28a('0x20')]=qs[_0xa28a('0x20')](_0x5f2579[_0xa28a('0x31')]['offset']);}_0x3d382e[_0xa28a('0x39')]=qs[_0xa28a('0x3a')](_0x5f2579['query'][_0xa28a('0x3a')]);_0x3d382e[_0xa28a('0x3b')]=qs[_0xa28a('0x33')](_[_0xa28a('0x3c')](_0x5f2579['query'],_0x3d0488[_0xa28a('0x33')]),_0x3e5eb7);if(_0x5f2579[_0xa28a('0x31')][_0xa28a('0x3d')]){_0x3d382e[_0xa28a('0x3b')]=_[_0xa28a('0x3e')](_0x3d382e['where'],{'$or':_[_0xa28a('0x2f')](_0x3e5eb7,function(_0x28887e){if(_0x28887e[_0xa28a('0x2c')]!=='VIRTUAL'){var _0x3d42a1={};_0x3d42a1[_0x28887e['name']]={'$like':'%'+_0x5f2579['query'][_0xa28a('0x3d')]+'%'};return _0x3d42a1;}})});}_0x3d382e=_[_0xa28a('0x3e')]({},_0x3d382e,_0x5f2579[_0xa28a('0x3f')]);var _0x42fab7={'where':_0x3d382e['where']};return db[_0xa28a('0x2a')]['count'](_0x42fab7)[_0xa28a('0x26')](function(_0x5a49dc){_0x4713a2[_0xa28a('0x40')]=_0x5a49dc;if(_0x5f2579[_0xa28a('0x31')][_0xa28a('0x41')]){_0x3d382e[_0xa28a('0x42')]=[{'all':!![]}];}return db[_0xa28a('0x2a')][_0xa28a('0x43')](_0x3d382e);})['then'](function(_0x1945b5){_0x4713a2[_0xa28a('0x44')]=_0x1945b5;return _0x4713a2;})['then'](respondWithFilteredResult(_0x51b725,_0x3d382e))[_0xa28a('0x45')](handleError(_0x51b725,null));};exports[_0xa28a('0x46')]=function(_0x42b765,_0x834133){var _0x433e19={'raw':!![],'where':{'id':_0x42b765[_0xa28a('0x47')]['id']}},_0x4132c2={};_0x4132c2[_0xa28a('0x2e')]=_[_0xa28a('0x32')](db[_0xa28a('0x2a')][_0xa28a('0x48')]);_0x4132c2[_0xa28a('0x31')]=_[_0xa28a('0x32')](_0x42b765[_0xa28a('0x31')]);_0x4132c2[_0xa28a('0x33')]=_[_0xa28a('0x35')](_0x4132c2['model'],_0x4132c2[_0xa28a('0x31')]);_0x433e19[_0xa28a('0x34')]=_['intersection'](_0x4132c2['model'],qs[_0xa28a('0x36')](_0x42b765[_0xa28a('0x31')]['fields']));_0x433e19[_0xa28a('0x34')]=_0x433e19[_0xa28a('0x34')]['length']?_0x433e19[_0xa28a('0x34')]:_0x4132c2['model'];if(_0x42b765[_0xa28a('0x31')]['includeAll']){_0x433e19['include']=[{'all':!![]}];}_0x433e19=_['merge']({},_0x433e19,_0x42b765[_0xa28a('0x3f')]);return db[_0xa28a('0x2a')][_0xa28a('0x49')](_0x433e19)[_0xa28a('0x26')](handleEntityNotFound(_0x834133,null))[_0xa28a('0x26')](respondWithResult(_0x834133,null))['catch'](handleError(_0x834133,null));};exports[_0xa28a('0x4a')]=function(_0x2e8f96,_0x2d0e11){return db[_0xa28a('0x2a')][_0xa28a('0x4a')](_0x2e8f96[_0xa28a('0x4b')],{})[_0xa28a('0x26')](respondWithResult(_0x2d0e11,0xc9))[_0xa28a('0x45')](handleError(_0x2d0e11,null));};exports[_0xa28a('0x25')]=function(_0xfaafa8,_0x27e245){if(_0xfaafa8['body']['id']){delete _0xfaafa8[_0xa28a('0x4b')]['id'];}return db[_0xa28a('0x2a')]['find']({'where':{'id':_0xfaafa8[_0xa28a('0x47')]['id']}})[_0xa28a('0x26')](handleEntityNotFound(_0x27e245,null))[_0xa28a('0x26')](saveUpdates(_0xfaafa8['body'],null))['then'](respondWithResult(_0x27e245,null))[_0xa28a('0x45')](handleError(_0x27e245,null));};exports[_0xa28a('0x4c')]=function(_0x49f53b,_0x3e0573){return db['SmsTransferReport']['find']({'where':{'id':_0x49f53b[_0xa28a('0x47')]['id']}})[_0xa28a('0x26')](handleEntityNotFound(_0x3e0573,null))[_0xa28a('0x26')](removeEntity(_0x3e0573,null))[_0xa28a('0x45')](handleError(_0x3e0573,null));};exports[_0xa28a('0x4d')]=function(_0x9d5c38,_0x25f85e){return db[_0xa28a('0x2a')]['describe']()[_0xa28a('0x26')](respondWithResult(_0x25f85e,null))[_0xa28a('0x45')](handleError(_0x25f85e,null));}; \ No newline at end of file +var _0x0834=['set','Content-Range','apply','reject','save','update','then','error','name','index','map','SmsTransferReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x2c47ae,_0x19cc1a){var _0x583e94=function(_0xe846a4){while(--_0xe846a4){_0x2c47ae['push'](_0x2c47ae['shift']());}};_0x583e94(++_0x19cc1a);}(_0x0834,0x18e));var _0x4083=function(_0x43cdc5,_0x30adbf){_0x43cdc5=_0x43cdc5-0x0;var _0x4b54d9=_0x0834[_0x43cdc5];return _0x4b54d9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4083('0x0'));var zipdir=require(_0x4083('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4083('0x2'));var Mustache=require(_0x4083('0x3'));var util=require('util');var path=require(_0x4083('0x4'));var sox=require(_0x4083('0x5'));var csv=require('to-csv');var ejs=require(_0x4083('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4083('0x7'));var crypto=require(_0x4083('0x8'));var jsforce=require(_0x4083('0x9'));var deskjs=require(_0x4083('0xa'));var toCsv=require(_0x4083('0xb'));var querystring=require(_0x4083('0xc'));var Papa=require(_0x4083('0xd'));var Redis=require(_0x4083('0xe'));var authService=require(_0x4083('0xf'));var qs=require(_0x4083('0x10'));var as=require(_0x4083('0x11'));var hardwareService=require(_0x4083('0x12'));var logger=require(_0x4083('0x13'))(_0x4083('0x14'));var utils=require(_0x4083('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4083('0x16'))['db'];function respondWithStatusCode(_0x3dfd39,_0x4e6fb2){_0x4e6fb2=_0x4e6fb2||0xcc;return function(_0x2a24ac){if(_0x2a24ac){return _0x3dfd39[_0x4083('0x17')](_0x4e6fb2);}return _0x3dfd39[_0x4083('0x18')](_0x4e6fb2)['end']();};}function respondWithResult(_0x4bef74,_0xb5badb){_0xb5badb=_0xb5badb||0xc8;return function(_0x392f82){if(_0x392f82){return _0x4bef74['status'](_0xb5badb)[_0x4083('0x19')](_0x392f82);}};}function respondWithFilteredResult(_0x316e54,_0xc7c267){return function(_0x146632){if(_0x146632){var _0x38757d=_0x146632[_0x4083('0x1a')],_0x4d59c7=_0xc7c267[_0x4083('0x1b')],_0x259b2b=_0xc7c267['offset']+_0xc7c267['limit'],_0x10cadd;if(_0x259b2b>=_0x38757d){_0x259b2b=_0x38757d;_0x10cadd=0xc8;}else{_0x10cadd=0xce;}_0x316e54['status'](_0x10cadd);return _0x316e54[_0x4083('0x1c')](_0x4083('0x1d'),_0x4d59c7+'-'+_0x259b2b+'/'+_0x38757d)['json'](_0x146632);}return null;};}function patchUpdates(_0x330c82){return function(_0x4a16dc){try{jsonpatch[_0x4083('0x1e')](_0x4a16dc,_0x330c82,!![]);}catch(_0x1c5987){return BPromise[_0x4083('0x1f')](_0x1c5987);}return _0x4a16dc[_0x4083('0x20')]();};}function saveUpdates(_0x4b32e9,_0x3b29b1){return function(_0x5b3662){if(_0x5b3662){return _0x5b3662[_0x4083('0x21')](_0x4b32e9)[_0x4083('0x22')](function(_0x14562f){return _0x14562f;});}return null;};}function removeEntity(_0x94d72c,_0x5d7461){return function(_0x328efe){if(_0x328efe){return _0x328efe['destroy']()[_0x4083('0x22')](function(){_0x94d72c[_0x4083('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a440,_0x3ce623){return function(_0x5b1f8a){if(!_0x5b1f8a){_0x52a440['sendStatus'](0x194);}return _0x5b1f8a;};}function handleError(_0x5f034c,_0x14e274){_0x14e274=_0x14e274||0x1f4;return function(_0xb2fbb5){logger[_0x4083('0x23')](_0xb2fbb5['stack']);if(_0xb2fbb5[_0x4083('0x24')]){delete _0xb2fbb5[_0x4083('0x24')];}_0x5f034c[_0x4083('0x18')](_0x14e274)['send'](_0xb2fbb5);};}exports[_0x4083('0x25')]=function(_0x323736,_0x5f5679){var _0x315458={},_0x467c01={},_0x2daca5={'count':0x0,'rows':[]};var _0xabc8c7=_[_0x4083('0x26')](db[_0x4083('0x27')][_0x4083('0x28')],function(_0x1534e9){return{'name':_0x1534e9[_0x4083('0x29')],'type':_0x1534e9['type']['key']};});_0x467c01[_0x4083('0x2a')]=_[_0x4083('0x26')](_0xabc8c7,_0x4083('0x24'));_0x467c01[_0x4083('0x2b')]=_[_0x4083('0x2c')](_0x323736[_0x4083('0x2b')]);_0x467c01['filters']=_[_0x4083('0x2d')](_0x467c01[_0x4083('0x2a')],_0x467c01[_0x4083('0x2b')]);_0x315458[_0x4083('0x2e')]=_[_0x4083('0x2d')](_0x467c01[_0x4083('0x2a')],qs['fields'](_0x323736[_0x4083('0x2b')][_0x4083('0x2f')]));_0x315458[_0x4083('0x2e')]=_0x315458[_0x4083('0x2e')][_0x4083('0x30')]?_0x315458[_0x4083('0x2e')]:_0x467c01['model'];if(!_0x323736[_0x4083('0x2b')]['hasOwnProperty'](_0x4083('0x31'))){_0x315458[_0x4083('0x32')]=qs['limit'](_0x323736[_0x4083('0x2b')][_0x4083('0x32')]);_0x315458[_0x4083('0x1b')]=qs[_0x4083('0x1b')](_0x323736['query']['offset']);}_0x315458[_0x4083('0x33')]=qs[_0x4083('0x34')](_0x323736['query'][_0x4083('0x34')]);_0x315458['where']=qs[_0x4083('0x35')](_['pick'](_0x323736['query'],_0x467c01['filters']),_0xabc8c7);if(_0x323736[_0x4083('0x2b')][_0x4083('0x36')]){_0x315458[_0x4083('0x37')]=_[_0x4083('0x38')](_0x315458[_0x4083('0x37')],{'$or':_['map'](_0xabc8c7,function(_0x533e0f){if(_0x533e0f[_0x4083('0x39')]!==_0x4083('0x3a')){var _0x573f4f={};_0x573f4f[_0x533e0f[_0x4083('0x24')]]={'$like':'%'+_0x323736['query']['filter']+'%'};return _0x573f4f;}})});}_0x315458=_['merge']({},_0x315458,_0x323736[_0x4083('0x3b')]);var _0x2fbe82={'where':_0x315458[_0x4083('0x37')]};return db['SmsTransferReport']['count'](_0x2fbe82)[_0x4083('0x22')](function(_0x4bdbee){_0x2daca5[_0x4083('0x1a')]=_0x4bdbee;if(_0x323736[_0x4083('0x2b')][_0x4083('0x3c')]){_0x315458[_0x4083('0x3d')]=[{'all':!![]}];}return db[_0x4083('0x27')][_0x4083('0x3e')](_0x315458);})['then'](function(_0x353196){_0x2daca5[_0x4083('0x3f')]=_0x353196;return _0x2daca5;})['then'](respondWithFilteredResult(_0x5f5679,_0x315458))['catch'](handleError(_0x5f5679,null));};exports[_0x4083('0x40')]=function(_0x55cd04,_0x25aded){var _0xd2321b={'raw':!![],'where':{'id':_0x55cd04['params']['id']}},_0x1b00a5={};_0x1b00a5[_0x4083('0x2a')]=_[_0x4083('0x2c')](db[_0x4083('0x27')]['rawAttributes']);_0x1b00a5[_0x4083('0x2b')]=_[_0x4083('0x2c')](_0x55cd04[_0x4083('0x2b')]);_0x1b00a5[_0x4083('0x35')]=_[_0x4083('0x2d')](_0x1b00a5[_0x4083('0x2a')],_0x1b00a5[_0x4083('0x2b')]);_0xd2321b[_0x4083('0x2e')]=_['intersection'](_0x1b00a5['model'],qs[_0x4083('0x2f')](_0x55cd04[_0x4083('0x2b')][_0x4083('0x2f')]));_0xd2321b[_0x4083('0x2e')]=_0xd2321b[_0x4083('0x2e')][_0x4083('0x30')]?_0xd2321b[_0x4083('0x2e')]:_0x1b00a5['model'];if(_0x55cd04[_0x4083('0x2b')][_0x4083('0x3c')]){_0xd2321b[_0x4083('0x3d')]=[{'all':!![]}];}_0xd2321b=_[_0x4083('0x38')]({},_0xd2321b,_0x55cd04[_0x4083('0x3b')]);return db['SmsTransferReport'][_0x4083('0x41')](_0xd2321b)['then'](handleEntityNotFound(_0x25aded,null))['then'](respondWithResult(_0x25aded,null))[_0x4083('0x42')](handleError(_0x25aded,null));};exports[_0x4083('0x43')]=function(_0x279a4e,_0x2c81bb){return db['SmsTransferReport'][_0x4083('0x43')](_0x279a4e['body'],{})[_0x4083('0x22')](respondWithResult(_0x2c81bb,0xc9))[_0x4083('0x42')](handleError(_0x2c81bb,null));};exports[_0x4083('0x21')]=function(_0x4d9220,_0x3448f7){if(_0x4d9220[_0x4083('0x44')]['id']){delete _0x4d9220[_0x4083('0x44')]['id'];}return db['SmsTransferReport'][_0x4083('0x41')]({'where':{'id':_0x4d9220[_0x4083('0x45')]['id']}})[_0x4083('0x22')](handleEntityNotFound(_0x3448f7,null))[_0x4083('0x22')](saveUpdates(_0x4d9220[_0x4083('0x44')],null))[_0x4083('0x22')](respondWithResult(_0x3448f7,null))[_0x4083('0x42')](handleError(_0x3448f7,null));};exports['destroy']=function(_0x607d65,_0xeecb9e){return db[_0x4083('0x27')][_0x4083('0x41')]({'where':{'id':_0x607d65['params']['id']}})[_0x4083('0x22')](handleEntityNotFound(_0xeecb9e,null))['then'](removeEntity(_0xeecb9e,null))[_0x4083('0x42')](handleError(_0xeecb9e,null));};exports[_0x4083('0x46')]=function(_0x49f9f9,_0x16b9c7){return db[_0x4083('0x27')][_0x4083('0x46')]()[_0x4083('0x22')](respondWithResult(_0x16b9c7,null))[_0x4083('0x42')](handleError(_0x16b9c7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 416687c..cd4b77f 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 _0x6b8f=['exports','define','SmsTransferReport','report_sms_transfer','util','api','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x4a6807,_0x3e9898){var _0x31083a=function(_0x7801f0){while(--_0x7801f0){_0x4a6807['push'](_0x4a6807['shift']());}};_0x31083a(++_0x3e9898);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x40385a,_0x4627ec){_0x40385a=_0x40385a-0x0;var _0x3813f4=_0x6b8f[_0x40385a];return _0x3813f4;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2a8460,_0x4d8c58){var _0x2f0928=function(_0x31a872){while(--_0x31a872){_0x2a8460['push'](_0x2a8460['shift']());}};_0x2f0928(++_0x4d8c58);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fd59eb3..0e67e95 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 _0x79ec=['code','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x79ec,0x147));var _0xc79e=function(_0x1a6399,_0x437d38){_0x1a6399=_0x1a6399-0x0;var _0x3a42d1=_0x79ec[_0x1a6399];return _0x3a42d1;};'use strict';var _=require(_0xc79e('0x0'));var util=require('util');var moment=require(_0xc79e('0x1'));var BPromise=require(_0xc79e('0x2'));var rs=require(_0xc79e('0x3'));var fs=require('fs');var Redis=require(_0xc79e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc79e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc79e('0x6'));var client=jayson[_0xc79e('0x7')][_0xc79e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44d564,_0x81586f,_0x4c6038){return new BPromise(function(_0x4ecab7,_0x7e79a){return client[_0xc79e('0x9')](_0x44d564,_0x4c6038)['then'](function(_0xddd9fe){logger[_0xc79e('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x81586f,_0xc79e('0xb'));logger[_0xc79e('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x81586f,_0xc79e('0xb'),JSON[_0xc79e('0xd')](_0xddd9fe));if(_0xddd9fe[_0xc79e('0xe')]){if(_0xddd9fe[_0xc79e('0xe')][_0xc79e('0xf')]===0x1f4){logger[_0xc79e('0xe')](_0xc79e('0x10'),_0x81586f,_0xddd9fe['error'][_0xc79e('0x11')]);return _0x7e79a(_0xddd9fe[_0xc79e('0xe')]['message']);}logger[_0xc79e('0xe')](_0xc79e('0x10'),_0x81586f,_0xddd9fe[_0xc79e('0xe')][_0xc79e('0x11')]);return _0x4ecab7(_0xddd9fe['error'][_0xc79e('0x11')]);}else{logger[_0xc79e('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x81586f,_0xc79e('0xb'));_0x4ecab7(_0xddd9fe[_0xc79e('0x12')]['message']);}})['catch'](function(_0x1c357d){logger[_0xc79e('0xe')](_0xc79e('0x10'),_0x81586f,_0x1c357d);_0x7e79a(_0x1c357d);});});} \ No newline at end of file +var _0xcf81=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xcf81,0x15b));var _0x1cf8=function(_0x3d00a8,_0x2bdeb4){_0x3d00a8=_0x3d00a8-0x0;var _0x16d393=_0xcf81[_0x3d00a8];return _0x16d393;};'use strict';var _=require(_0x1cf8('0x0'));var util=require(_0x1cf8('0x1'));var moment=require(_0x1cf8('0x2'));var BPromise=require(_0x1cf8('0x3'));var rs=require(_0x1cf8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cf8('0x5'))['db'];var utils=require(_0x1cf8('0x6'));var logger=require(_0x1cf8('0x7'))(_0x1cf8('0x8'));var config=require(_0x1cf8('0x9'));var jayson=require(_0x1cf8('0xa'));var client=jayson[_0x1cf8('0xb')][_0x1cf8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1618c2,_0x1160a9,_0xd27cb){return new BPromise(function(_0xaf6fe9,_0x29f9f7){return client[_0x1cf8('0xd')](_0x1618c2,_0xd27cb)[_0x1cf8('0xe')](function(_0x25b716){logger[_0x1cf8('0xf')](_0x1cf8('0x10'),_0x1160a9,_0x1cf8('0x11'));logger['debug'](_0x1cf8('0x12'),_0x1160a9,_0x1cf8('0x11'),JSON['stringify'](_0x25b716));if(_0x25b716[_0x1cf8('0x13')]){if(_0x25b716['error'][_0x1cf8('0x14')]===0x1f4){logger['error'](_0x1cf8('0x10'),_0x1160a9,_0x25b716['error'][_0x1cf8('0x15')]);return _0x29f9f7(_0x25b716[_0x1cf8('0x13')][_0x1cf8('0x15')]);}logger[_0x1cf8('0x13')](_0x1cf8('0x10'),_0x1160a9,_0x25b716['error'][_0x1cf8('0x15')]);return _0xaf6fe9(_0x25b716['error']['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x1160a9,_0x1cf8('0x11'));_0xaf6fe9(_0x25b716[_0x1cf8('0x16')]['message']);}})[_0x1cf8('0x17')](function(_0x418128){logger[_0x1cf8('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x1160a9,_0x418128);_0x29f9f7(_0x418128);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1a6c0f4..b11edb2 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 _0x3319=['../../config/environment','./sound.controller','get','isAuthenticated','/:id/download','download','join','originalname','replace','%s-%s%s','extname','now','post','file','create','put','update','delete','/:id','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26c7a7,_0x58d0de){var _0x34549c=function(_0x45a0c7){while(--_0x45a0c7){_0x26c7a7['push'](_0x26c7a7['shift']());}};_0x34549c(++_0x58d0de);}(_0x3319,0x1b4));var _0x9331=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3319[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x9331('0x0'));var util=require(_0x9331('0x1'));var path=require(_0x9331('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9331('0x3')]();var auth=require(_0x9331('0x4'));var interaction=require(_0x9331('0x5'));var config=require(_0x9331('0x6'));var controller=require(_0x9331('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9331('0x8')]('/:id',auth[_0x9331('0x9')](),controller['show']);router['get'](_0x9331('0xa'),auth[_0x9331('0x9')](),controller[_0x9331('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46d787,_0x280ba2,_0x1319d4){_0x1319d4(null,path[_0x9331('0xc')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x3ffbb5,_0x5332ad,_0x47e40d){_0x5332ad[_0x9331('0xd')]=_0x5332ad[_0x9331('0xd')][_0x9331('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47e40d(null,util['format'](_0x9331('0xf'),path['basename'](_0x5332ad[_0x9331('0xd')],path[_0x9331('0x10')](_0x5332ad[_0x9331('0xd')])),Date[_0x9331('0x11')](),path['extname'](_0x5332ad[_0x9331('0xd')])));}})});router[_0x9331('0x12')]('/',upload['single'](_0x9331('0x13')),controller[_0x9331('0x14')]);router[_0x9331('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9331('0x16')]);router[_0x9331('0x17')](_0x9331('0x18'),auth[_0x9331('0x9')](),controller[_0x9331('0x17')]);module[_0x9331('0x19')]=router; \ No newline at end of file +var _0xd872=['originalname','replace','extname','now','post','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','get','/:id/download','download','diskStorage','root','server/files/sounds/original/'];(function(_0x13cc6d,_0x445ee0){var _0x31460e=function(_0x1bbe32){while(--_0x1bbe32){_0x13cc6d['push'](_0x13cc6d['shift']());}};_0x31460e(++_0x445ee0);}(_0xd872,0x108));var _0x2d87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd872[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2d87('0x0'));var util=require('util');var path=require(_0x2d87('0x1'));var timeout=require(_0x2d87('0x2'));var express=require(_0x2d87('0x3'));var router=express[_0x2d87('0x4')]();var auth=require(_0x2d87('0x5'));var interaction=require(_0x2d87('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0x2d87('0x7')](),controller[_0x2d87('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2d87('0x9')]);router[_0x2d87('0xa')](_0x2d87('0xb'),auth[_0x2d87('0x7')](),controller[_0x2d87('0xc')]);var upload=multer({'storage':multer[_0x2d87('0xd')]({'destination':function(_0x3a001f,_0x57b6a1,_0x1886fb){_0x1886fb(null,path['join'](config[_0x2d87('0xe')],_0x2d87('0xf')));},'filename':function(_0x164069,_0x1f8398,_0x1e8244){_0x1f8398[_0x2d87('0x10')]=_0x1f8398[_0x2d87('0x10')][_0x2d87('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e8244(null,util['format']('%s-%s%s',path['basename'](_0x1f8398['originalname'],path[_0x2d87('0x12')](_0x1f8398[_0x2d87('0x10')])),Date[_0x2d87('0x13')](),path[_0x2d87('0x12')](_0x1f8398[_0x2d87('0x10')])));}})});router[_0x2d87('0x14')]('/',upload['single'](_0x2d87('0x15')),controller[_0x2d87('0x16')]);router[_0x2d87('0x17')](_0x2d87('0x18'),auth[_0x2d87('0x7')](),controller[_0x2d87('0x19')]);router[_0x2d87('0x1a')]('/:id',auth[_0x2d87('0x7')](),controller[_0x2d87('0x1a')]);module[_0x2d87('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index abc4134..536bc36 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 _0x00dc=['STRING','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x2a3257,_0x170ea2){var _0x1f9128=function(_0x2ebc37){while(--_0x2ebc37){_0x2a3257['push'](_0x2a3257['shift']());}};_0x1f9128(++_0x170ea2);}(_0x00dc,0xbe));var _0xc00d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00dc[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xc00d('0x0'));module[_0xc00d('0x1')]={'name':{'type':Sequelize[_0xc00d('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xc00d('0x2')]},'display_name':{'type':Sequelize[_0xc00d('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xc00d('0x2')]},'original_duration':{'type':Sequelize[_0xc00d('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xc00d('0x4')]},'original_bitRate':{'type':Sequelize[_0xc00d('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc00d('0x2')]},'converted_duration':{'type':Sequelize[_0xc00d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc00d('0x5')]},'converted_channelCount':{'type':Sequelize[_0xc00d('0x4')]},'converted_bitRate':{'type':Sequelize[_0xc00d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xc00d('0x4')]}}; \ No newline at end of file +var _0x4834=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x470b90,_0x5f3062){var _0x40f241=function(_0x38fd43){while(--_0x38fd43){_0x470b90['push'](_0x470b90['shift']());}};_0x40f241(++_0x5f3062);}(_0x4834,0x13d));var _0x4483=function(_0x13dbe9,_0x34f037){_0x13dbe9=_0x13dbe9-0x0;var _0x4c8d02=_0x4834[_0x13dbe9];return _0x4c8d02;};'use strict';var Sequelize=require(_0x4483('0x0'));module[_0x4483('0x1')]={'name':{'type':Sequelize[_0x4483('0x2')],'unique':_0x4483('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4483('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x4483('0x2')]},'original_format':{'type':Sequelize[_0x4483('0x2')]},'original_duration':{'type':Sequelize[_0x4483('0x4')]},'original_sampleCount':{'type':Sequelize[_0x4483('0x5')]},'original_channelCount':{'type':Sequelize[_0x4483('0x6')]},'original_bitRate':{'type':Sequelize[_0x4483('0x5')]},'original_sampleRate':{'type':Sequelize[_0x4483('0x6')]},'converted_format':{'type':Sequelize[_0x4483('0x2')]},'converted_duration':{'type':Sequelize[_0x4483('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x4483('0x5')]},'converted_channelCount':{'type':Sequelize[_0x4483('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x4483('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5e3c676..c28214f 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 _0xdc0e=['limit','set','apply','reject','save','then','get','Sounds','UserProfileResource','destroy','name','send','index','map','Sound','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','download','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','originalname','extname','filename','file','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','error','unlinkSync','src','original_duration','original_sampleCount','sampleCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','chmodSync','role','body','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x1eaf3a,_0x2f9cbc){var _0x2152f8=function(_0x48fd0e){while(--_0x48fd0e){_0x1eaf3a['push'](_0x1eaf3a['shift']());}};_0x2152f8(++_0x2f9cbc);}(_0xdc0e,0x1d6));var _0xedc0=function(_0x342548,_0x31c72e){_0x342548=_0x342548-0x0;var _0x107140=_0xdc0e[_0x342548];return _0x107140;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedc0('0x0'));var rimraf=require(_0xedc0('0x1'));var zipdir=require(_0xedc0('0x2'));var jsonpatch=require(_0xedc0('0x3'));var rp=require(_0xedc0('0x4'));var moment=require(_0xedc0('0x5'));var BPromise=require(_0xedc0('0x6'));var Mustache=require('mustache');var util=require(_0xedc0('0x7'));var path=require(_0xedc0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xedc0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedc0('0xa'));var crypto=require(_0xedc0('0xb'));var jsforce=require(_0xedc0('0xc'));var deskjs=require(_0xedc0('0xd'));var toCsv=require(_0xedc0('0xe'));var querystring=require(_0xedc0('0xf'));var Papa=require(_0xedc0('0x10'));var Redis=require(_0xedc0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xedc0('0x12'));var as=require(_0xedc0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedc0('0x14'))(_0xedc0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedc0('0x16'));var db=require(_0xedc0('0x17'))['db'];function respondWithStatusCode(_0x901402,_0x1e7e6d){_0x1e7e6d=_0x1e7e6d||0xcc;return function(_0x312428){if(_0x312428){return _0x901402[_0xedc0('0x18')](_0x1e7e6d);}return _0x901402['status'](_0x1e7e6d)[_0xedc0('0x19')]();};}function respondWithResult(_0x36cecc,_0x4b91f3){_0x4b91f3=_0x4b91f3||0xc8;return function(_0x24d7b1){if(_0x24d7b1){return _0x36cecc[_0xedc0('0x1a')](_0x4b91f3)[_0xedc0('0x1b')](_0x24d7b1);}};}function respondWithFilteredResult(_0xc1e7bd,_0x41f34d){return function(_0x3aed25){if(_0x3aed25){var _0x18d472=_0x3aed25[_0xedc0('0x1c')],_0x35ffa7=_0x41f34d[_0xedc0('0x1d')],_0xc1e73b=_0x41f34d[_0xedc0('0x1d')]+_0x41f34d[_0xedc0('0x1e')],_0xa31547;if(_0xc1e73b>=_0x18d472){_0xc1e73b=_0x18d472;_0xa31547=0xc8;}else{_0xa31547=0xce;}_0xc1e7bd[_0xedc0('0x1a')](_0xa31547);return _0xc1e7bd[_0xedc0('0x1f')]('Content-Range',_0x35ffa7+'-'+_0xc1e73b+'/'+_0x18d472)[_0xedc0('0x1b')](_0x3aed25);}return null;};}function patchUpdates(_0xf10e44){return function(_0xfe829e){try{jsonpatch[_0xedc0('0x20')](_0xfe829e,_0xf10e44,!![]);}catch(_0x4e0543){return BPromise[_0xedc0('0x21')](_0x4e0543);}return _0xfe829e[_0xedc0('0x22')]();};}function saveUpdates(_0x195075,_0x2acab3){return function(_0x1608a6){if(_0x1608a6){return _0x1608a6['update'](_0x195075)[_0xedc0('0x23')](function(_0x447dba){return _0x447dba;});}return null;};}function removeEntity(_0x417147,_0xd36411){return function(_0x7d9031){if(_0x7d9031){return _0x7d9031['destroy']()['then'](function(){var _0x10c6e3=_0x7d9031[_0xedc0('0x24')]({'plain':!![]});var _0x1aa697=_0xedc0('0x25');return db[_0xedc0('0x26')][_0xedc0('0x27')]({'where':{'type':_0x1aa697,'resourceId':_0x10c6e3['id']}})[_0xedc0('0x23')](function(){return _0x7d9031;});})['then'](function(){_0x417147[_0xedc0('0x1a')](0xcc)[_0xedc0('0x19')]();});}};}function handleEntityNotFound(_0x149b15,_0x4b28c5){return function(_0x4959d5){if(!_0x4959d5){_0x149b15[_0xedc0('0x18')](0x194);}return _0x4959d5;};}function handleError(_0xff41f2,_0x5397d8){_0x5397d8=_0x5397d8||0x1f4;return function(_0x39be0b){logger['error'](_0x39be0b['stack']);if(_0x39be0b[_0xedc0('0x28')]){delete _0x39be0b[_0xedc0('0x28')];}_0xff41f2[_0xedc0('0x1a')](_0x5397d8)[_0xedc0('0x29')](_0x39be0b);};}exports[_0xedc0('0x2a')]=function(_0x51ff71,_0x4f7a84){var _0xd72216={},_0xf6e59e={},_0x3e1c5e={'count':0x0,'rows':[]};var _0x2d37fb=_[_0xedc0('0x2b')](db[_0xedc0('0x2c')]['rawAttributes'],function(_0x1b2f44){return{'name':_0x1b2f44[_0xedc0('0x2d')],'type':_0x1b2f44[_0xedc0('0x2e')][_0xedc0('0x2f')]};});_0xf6e59e[_0xedc0('0x30')]=_['map'](_0x2d37fb,_0xedc0('0x28'));_0xf6e59e['query']=_[_0xedc0('0x31')](_0x51ff71[_0xedc0('0x32')]);_0xf6e59e[_0xedc0('0x33')]=_[_0xedc0('0x34')](_0xf6e59e[_0xedc0('0x30')],_0xf6e59e[_0xedc0('0x32')]);_0xd72216[_0xedc0('0x35')]=_[_0xedc0('0x34')](_0xf6e59e[_0xedc0('0x30')],qs[_0xedc0('0x36')](_0x51ff71[_0xedc0('0x32')][_0xedc0('0x36')]));_0xd72216['attributes']=_0xd72216[_0xedc0('0x35')]['length']?_0xd72216[_0xedc0('0x35')]:_0xf6e59e[_0xedc0('0x30')];if(!_0x51ff71[_0xedc0('0x32')]['hasOwnProperty'](_0xedc0('0x37'))){_0xd72216['limit']=qs['limit'](_0x51ff71[_0xedc0('0x32')]['limit']);_0xd72216[_0xedc0('0x1d')]=qs[_0xedc0('0x1d')](_0x51ff71[_0xedc0('0x32')][_0xedc0('0x1d')]);}_0xd72216[_0xedc0('0x38')]=qs[_0xedc0('0x39')](_0x51ff71[_0xedc0('0x32')][_0xedc0('0x39')]);_0xd72216[_0xedc0('0x3a')]=qs['filters'](_[_0xedc0('0x3b')](_0x51ff71['query'],_0xf6e59e[_0xedc0('0x33')]),_0x2d37fb);if(_0x51ff71['query'][_0xedc0('0x3c')]){_0xd72216[_0xedc0('0x3a')]=_[_0xedc0('0x3d')](_0xd72216[_0xedc0('0x3a')],{'$or':_[_0xedc0('0x2b')](_0x2d37fb,function(_0x322f89){if(_0x322f89[_0xedc0('0x2e')]!==_0xedc0('0x3e')){var _0x4dee19={};_0x4dee19[_0x322f89['name']]={'$like':'%'+_0x51ff71[_0xedc0('0x32')][_0xedc0('0x3c')]+'%'};return _0x4dee19;}})});}_0xd72216=_[_0xedc0('0x3d')]({},_0xd72216,_0x51ff71[_0xedc0('0x3f')]);var _0x22cd84={'where':_0xd72216['where']};return db[_0xedc0('0x2c')]['count'](_0x22cd84)['then'](function(_0x34f851){_0x3e1c5e[_0xedc0('0x1c')]=_0x34f851;if(_0x51ff71[_0xedc0('0x32')][_0xedc0('0x40')]){_0xd72216[_0xedc0('0x41')]=[{'all':!![]}];}return db[_0xedc0('0x2c')][_0xedc0('0x42')](_0xd72216);})[_0xedc0('0x23')](function(_0x1ade7e){_0x3e1c5e[_0xedc0('0x43')]=_0x1ade7e;return _0x3e1c5e;})['then'](respondWithFilteredResult(_0x4f7a84,_0xd72216))['catch'](handleError(_0x4f7a84,null));};exports[_0xedc0('0x44')]=function(_0x20fbbf,_0xf9d9e){var _0x74d5d4={'raw':!![],'where':{'id':_0x20fbbf[_0xedc0('0x45')]['id']}},_0x57296e={};_0x57296e[_0xedc0('0x30')]=_[_0xedc0('0x31')](db['Sound'][_0xedc0('0x46')]);_0x57296e[_0xedc0('0x32')]=_[_0xedc0('0x31')](_0x20fbbf['query']);_0x57296e[_0xedc0('0x33')]=_['intersection'](_0x57296e[_0xedc0('0x30')],_0x57296e[_0xedc0('0x32')]);_0x74d5d4['attributes']=_[_0xedc0('0x34')](_0x57296e['model'],qs[_0xedc0('0x36')](_0x20fbbf[_0xedc0('0x32')]['fields']));_0x74d5d4['attributes']=_0x74d5d4[_0xedc0('0x35')][_0xedc0('0x47')]?_0x74d5d4[_0xedc0('0x35')]:_0x57296e[_0xedc0('0x30')];if(_0x20fbbf[_0xedc0('0x32')]['includeAll']){_0x74d5d4[_0xedc0('0x41')]=[{'all':!![]}];}_0x74d5d4=_[_0xedc0('0x3d')]({},_0x74d5d4,_0x20fbbf[_0xedc0('0x3f')]);return db[_0xedc0('0x2c')]['find'](_0x74d5d4)[_0xedc0('0x23')](handleEntityNotFound(_0xf9d9e,null))[_0xedc0('0x23')](respondWithResult(_0xf9d9e,null))[_0xedc0('0x48')](handleError(_0xf9d9e,null));};exports[_0xedc0('0x49')]=function(_0x2f09aa,_0x3d9551,_0x3a028c){return db[_0xedc0('0x2c')][_0xedc0('0x4a')]({'where':{'id':_0x2f09aa['params']['id']},'attributes':[_0xedc0('0x28'),_0xedc0('0x4b'),_0xedc0('0x4c')],'raw':!![]})[_0xedc0('0x23')](handleEntityNotFound(_0x3d9551,null))[_0xedc0('0x23')](function(_0x20c591){if(_0x20c591){if(!fs[_0xedc0('0x4d')](path[_0xedc0('0x4e')](config['root'],_0xedc0('0x4f'),_0x20c591[_0xedc0('0x4b')]+'.'+_0x20c591[_0xedc0('0x4c')]))){throw new db['Sequelize'][(_0xedc0('0x50'))](_0xedc0('0x51'));}return _0x3d9551[_0xedc0('0x49')](path['join'](config[_0xedc0('0x52')],_0xedc0('0x4f'),util[_0xedc0('0x53')](_0xedc0('0x54'),_0x20c591[_0xedc0('0x4b')],_0x20c591[_0xedc0('0x4c')])),util[_0xedc0('0x53')](_0xedc0('0x54'),_0x20c591[_0xedc0('0x28')],_0x20c591[_0xedc0('0x4c')]));}return null;})[_0xedc0('0x48')](handleError(_0x3d9551,null));};exports[_0xedc0('0x55')]=function(_0x2da062,_0x2f174c,_0x453764){var _0x3e5bbc={'name':path[_0xedc0('0x56')](_0x2da062['file'][_0xedc0('0x57')],path[_0xedc0('0x58')](_0x2da062['file']['originalname'])),'save_name':path['basename'](_0x2da062['file'][_0xedc0('0x59')],path['extname'](_0x2da062[_0xedc0('0x5a')][_0xedc0('0x59')])),'original_format':path['extname'](_0x2da062[_0xedc0('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0xedc0('0x5b')};var _0xce3d6=path['join'](config[_0xedc0('0x52')],_0xedc0('0x5c'),_0x2da062[_0xedc0('0x5a')][_0xedc0('0x59')]);var _0x121275=path[_0xedc0('0x4e')](config[_0xedc0('0x52')],'server/files/sounds/converted',util[_0xedc0('0x53')](_0xedc0('0x54'),path[_0xedc0('0x56')](_0x2da062[_0xedc0('0x5a')][_0xedc0('0x59')],path['extname'](_0x2da062[_0xedc0('0x5a')][_0xedc0('0x59')])),_0x3e5bbc['converted_format']));logger[_0xedc0('0x5d')](_0xedc0('0x5e'),_0xce3d6);logger[_0xedc0('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0x121275);try{fs['chmodSync'](_0xce3d6,parseInt(_0xedc0('0x5f'),0x8));var _0x105ae3=sox[_0xedc0('0x60')](_0xce3d6,_0x121275,{'sampleRate':0x1f40,'format':_0xedc0('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x105ae3['on'](_0xedc0('0x61'),function(_0x49c400){fs[_0xedc0('0x62')](_0xce3d6);_0x2f174c[_0xedc0('0x1a')](0x1f4)[_0xedc0('0x29')](_0x49c400);});_0x105ae3['on'](_0xedc0('0x63'),function(_0x44ff9f){_0x3e5bbc[_0xedc0('0x64')]=isNaN(_0x44ff9f['duration'])?null:_0x44ff9f['duration']*0x3e8;_0x3e5bbc[_0xedc0('0x65')]=isNaN(_0x44ff9f[_0xedc0('0x66')])?null:_0x44ff9f['sampleCount'];_0x3e5bbc['original_channelCount']=isNaN(_0x44ff9f['channelCount'])?null:_0x44ff9f['channelCount'];_0x3e5bbc[_0xedc0('0x67')]=isNaN(_0x44ff9f['bitRate'])?null:_0x44ff9f[_0xedc0('0x68')];_0x3e5bbc[_0xedc0('0x69')]=isNaN(_0x44ff9f['sampleRate'])?null:_0x44ff9f[_0xedc0('0x6a')];});_0x105ae3['on'](_0xedc0('0x6b'),function(_0x22917b){_0x3e5bbc[_0xedc0('0x6c')]=isNaN(_0x22917b[_0xedc0('0x6d')])?null:_0x22917b[_0xedc0('0x6d')]*0x3e8;_0x3e5bbc[_0xedc0('0x6e')]=isNaN(_0x22917b[_0xedc0('0x66')])?null:_0x22917b[_0xedc0('0x66')];_0x3e5bbc[_0xedc0('0x6f')]=isNaN(_0x22917b['channelCount'])?null:_0x22917b[_0xedc0('0x70')];_0x3e5bbc[_0xedc0('0x71')]=isNaN(_0x22917b[_0xedc0('0x68')])?null:_0x22917b[_0xedc0('0x68')];_0x3e5bbc[_0xedc0('0x72')]=isNaN(_0x22917b[_0xedc0('0x6a')])?null:_0x22917b[_0xedc0('0x6a')];});_0x105ae3['on']('end',function(){fs[_0xedc0('0x73')](_0x121275,parseInt(_0xedc0('0x5f'),0x8));return db[_0xedc0('0x2c')][_0xedc0('0x55')](_0x3e5bbc)[_0xedc0('0x23')](function(_0x9b1c98){var _0x3a2829={'role':_0x2da062['body'][_0xedc0('0x74')],'userProfileId':_0x2da062[_0xedc0('0x75')][_0xedc0('0x76')]};if(!_0x3a2829)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a2829[_0xedc0('0x74')]==='user'){var _0x1b3d96=_0x9b1c98[_0xedc0('0x24')]({'plain':!![]});return db[_0xedc0('0x77')]['find']({'where':{'name':_0xedc0('0x25'),'userProfileId':_0x3a2829[_0xedc0('0x76')]},'raw':!![]})[_0xedc0('0x23')](function(_0x5ef313){if(_0x5ef313&&_0x5ef313[_0xedc0('0x78')]===0x0){return db['UserProfileResource'][_0xedc0('0x55')]({'name':_0x1b3d96['name'],'resourceId':_0x1b3d96['id'],'type':_0x5ef313['name'],'sectionId':_0x5ef313['id']},{})[_0xedc0('0x23')](function(){return _0x9b1c98;});}else{return _0x9b1c98;}})['catch'](function(_0x385484){logger[_0xedc0('0x61')](_0xedc0('0x79'),_0x385484);throw _0x385484;});}return _0x9b1c98;})[_0xedc0('0x23')](respondWithResult(_0x2f174c,null))[_0xedc0('0x48')](handleError(_0x2f174c,null));});_0x105ae3['start']();}catch(_0xa3b01d){_0x2f174c[_0xedc0('0x1a')](0x1f4)[_0xedc0('0x29')](_0xa3b01d);}};exports['update']=function(_0xecf22e,_0x53a976,_0x5201e8){return db[_0xedc0('0x2c')]['find']({'where':{'id':_0xecf22e[_0xedc0('0x45')]['id']}})[_0xedc0('0x23')](handleEntityNotFound(_0x53a976,null))[_0xedc0('0x23')](saveUpdates(_[_0xedc0('0x3b')](_0xecf22e['body'],['name',_0xedc0('0x7a')]),null))[_0xedc0('0x23')](respondWithResult(_0x53a976,null))[_0xedc0('0x48')](handleError(_0x53a976,null));};exports[_0xedc0('0x7b')]=function(_0x85ab9a,_0x4c46fb,_0x22ae66){return db[_0xedc0('0x2c')][_0xedc0('0x4a')]({'where':{'id':_0x85ab9a[_0xedc0('0x45')]['id']}})[_0xedc0('0x23')](function(_0x500ddd){if(_0x500ddd){return _0x500ddd[_0xedc0('0x27')]();}})[_0xedc0('0x23')](function(_0x4154ef){var _0x1fdbd6=path['join'](config[_0xedc0('0x52')],_0xedc0('0x5c'),util[_0xedc0('0x53')](_0xedc0('0x54'),_0x4154ef[_0xedc0('0x4b')],_0x4154ef[_0xedc0('0x7c')]));var _0x45fdd9=path[_0xedc0('0x4e')](config[_0xedc0('0x52')],'server/files/sounds/converted',util[_0xedc0('0x53')](_0xedc0('0x54'),_0x4154ef[_0xedc0('0x4b')],_0x4154ef[_0xedc0('0x4c')]));fs[_0xedc0('0x62')](_0x1fdbd6);fs['unlinkSync'](_0x45fdd9);return _0x4154ef;})[_0xedc0('0x23')](function(_0x14cc7d){if(_0x14cc7d){return _0x4c46fb['status'](0xcc)['end']();}})[_0xedc0('0x23')](handleEntityNotFound(_0x4c46fb,null))[_0xedc0('0x48')](handleError(_0x4c46fb,null));}; \ No newline at end of file +var _0xdb93=['UserProfileSection','Sounds','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','delete','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','get','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','download','find','save_name','existsSync','join','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x26db36,_0x455ded){var _0x1c80b9=function(_0x2b9e6a){while(--_0x2b9e6a){_0x26db36['push'](_0x26db36['shift']());}};_0x1c80b9(++_0x455ded);}(_0xdb93,0x179));var _0x3db9=function(_0x32e33a,_0x4f0946){_0x32e33a=_0x32e33a-0x0;var _0x3cdeeb=_0xdb93[_0x32e33a];return _0x3cdeeb;};'use strict';var pdf=require(_0x3db9('0x0'));var emlformat=require(_0x3db9('0x1'));var rimraf=require(_0x3db9('0x2'));var zipdir=require(_0x3db9('0x3'));var jsonpatch=require(_0x3db9('0x4'));var rp=require(_0x3db9('0x5'));var moment=require(_0x3db9('0x6'));var BPromise=require(_0x3db9('0x7'));var Mustache=require(_0x3db9('0x8'));var util=require('util');var path=require(_0x3db9('0x9'));var sox=require(_0x3db9('0xa'));var csv=require(_0x3db9('0xb'));var ejs=require(_0x3db9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3db9('0xd'));var crypto=require('crypto');var jsforce=require(_0x3db9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3db9('0xb'));var querystring=require('querystring');var Papa=require(_0x3db9('0xf'));var Redis=require(_0x3db9('0x10'));var authService=require(_0x3db9('0x11'));var qs=require(_0x3db9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3db9('0x13'));var logger=require(_0x3db9('0x14'))(_0x3db9('0x15'));var utils=require(_0x3db9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x92a9c6,_0x3a39d0){_0x3a39d0=_0x3a39d0||0xcc;return function(_0xf19d74){if(_0xf19d74){return _0x92a9c6[_0x3db9('0x17')](_0x3a39d0);}return _0x92a9c6[_0x3db9('0x18')](_0x3a39d0)['end']();};}function respondWithResult(_0x4480ab,_0x4e4f03){_0x4e4f03=_0x4e4f03||0xc8;return function(_0x5f4215){if(_0x5f4215){return _0x4480ab[_0x3db9('0x18')](_0x4e4f03)[_0x3db9('0x19')](_0x5f4215);}};}function respondWithFilteredResult(_0x3ed60c,_0x516eef){return function(_0x1dd219){if(_0x1dd219){var _0x4b8f8a=_0x1dd219[_0x3db9('0x1a')],_0x4b6706=_0x516eef['offset'],_0x984881=_0x516eef[_0x3db9('0x1b')]+_0x516eef[_0x3db9('0x1c')],_0x24b65b;if(_0x984881>=_0x4b8f8a){_0x984881=_0x4b8f8a;_0x24b65b=0xc8;}else{_0x24b65b=0xce;}_0x3ed60c[_0x3db9('0x18')](_0x24b65b);return _0x3ed60c['set'](_0x3db9('0x1d'),_0x4b6706+'-'+_0x984881+'/'+_0x4b8f8a)[_0x3db9('0x19')](_0x1dd219);}return null;};}function patchUpdates(_0x17a001){return function(_0x3ee33b){try{jsonpatch['apply'](_0x3ee33b,_0x17a001,!![]);}catch(_0x46b70d){return BPromise['reject'](_0x46b70d);}return _0x3ee33b[_0x3db9('0x1e')]();};}function saveUpdates(_0x481e9e,_0x58ec71){return function(_0xe2917f){if(_0xe2917f){return _0xe2917f[_0x3db9('0x1f')](_0x481e9e)[_0x3db9('0x20')](function(_0x3abfb4){return _0x3abfb4;});}return null;};}function removeEntity(_0x55bef5,_0x4a18bb){return function(_0x45926e){if(_0x45926e){return _0x45926e[_0x3db9('0x21')]()[_0x3db9('0x20')](function(){var _0x11ff77=_0x45926e[_0x3db9('0x22')]({'plain':!![]});var _0x2c1006='Sounds';return db['UserProfileResource'][_0x3db9('0x21')]({'where':{'type':_0x2c1006,'resourceId':_0x11ff77['id']}})[_0x3db9('0x20')](function(){return _0x45926e;});})[_0x3db9('0x20')](function(){_0x55bef5[_0x3db9('0x18')](0xcc)[_0x3db9('0x23')]();});}};}function handleEntityNotFound(_0x267cd4,_0x58ed1b){return function(_0x40379b){if(!_0x40379b){_0x267cd4['sendStatus'](0x194);}return _0x40379b;};}function handleError(_0x347889,_0x2da0db){_0x2da0db=_0x2da0db||0x1f4;return function(_0x4f96da){logger[_0x3db9('0x24')](_0x4f96da[_0x3db9('0x25')]);if(_0x4f96da[_0x3db9('0x26')]){delete _0x4f96da[_0x3db9('0x26')];}_0x347889[_0x3db9('0x18')](_0x2da0db)[_0x3db9('0x27')](_0x4f96da);};}exports[_0x3db9('0x28')]=function(_0x2ed16a,_0x1622a6){var _0x19068a={},_0x439764={},_0x54ec5c={'count':0x0,'rows':[]};var _0x2a0eed=_[_0x3db9('0x29')](db[_0x3db9('0x2a')][_0x3db9('0x2b')],function(_0x19e2d1){return{'name':_0x19e2d1[_0x3db9('0x2c')],'type':_0x19e2d1[_0x3db9('0x2d')][_0x3db9('0x2e')]};});_0x439764[_0x3db9('0x2f')]=_[_0x3db9('0x29')](_0x2a0eed,_0x3db9('0x26'));_0x439764[_0x3db9('0x30')]=_['keys'](_0x2ed16a[_0x3db9('0x30')]);_0x439764['filters']=_[_0x3db9('0x31')](_0x439764[_0x3db9('0x2f')],_0x439764['query']);_0x19068a['attributes']=_[_0x3db9('0x31')](_0x439764['model'],qs[_0x3db9('0x32')](_0x2ed16a[_0x3db9('0x30')][_0x3db9('0x32')]));_0x19068a['attributes']=_0x19068a[_0x3db9('0x33')][_0x3db9('0x34')]?_0x19068a['attributes']:_0x439764[_0x3db9('0x2f')];if(!_0x2ed16a[_0x3db9('0x30')][_0x3db9('0x35')](_0x3db9('0x36'))){_0x19068a[_0x3db9('0x1c')]=qs[_0x3db9('0x1c')](_0x2ed16a['query']['limit']);_0x19068a[_0x3db9('0x1b')]=qs['offset'](_0x2ed16a[_0x3db9('0x30')][_0x3db9('0x1b')]);}_0x19068a[_0x3db9('0x37')]=qs[_0x3db9('0x38')](_0x2ed16a[_0x3db9('0x30')]['sort']);_0x19068a[_0x3db9('0x39')]=qs['filters'](_[_0x3db9('0x3a')](_0x2ed16a[_0x3db9('0x30')],_0x439764[_0x3db9('0x3b')]),_0x2a0eed);if(_0x2ed16a[_0x3db9('0x30')][_0x3db9('0x3c')]){_0x19068a[_0x3db9('0x39')]=_[_0x3db9('0x3d')](_0x19068a[_0x3db9('0x39')],{'$or':_[_0x3db9('0x29')](_0x2a0eed,function(_0x2a8f5d){if(_0x2a8f5d[_0x3db9('0x2d')]!==_0x3db9('0x3e')){var _0x338de3={};_0x338de3[_0x2a8f5d[_0x3db9('0x26')]]={'$like':'%'+_0x2ed16a[_0x3db9('0x30')][_0x3db9('0x3c')]+'%'};return _0x338de3;}})});}_0x19068a=_[_0x3db9('0x3d')]({},_0x19068a,_0x2ed16a['options']);var _0x2556c5={'where':_0x19068a[_0x3db9('0x39')]};return db['Sound']['count'](_0x2556c5)[_0x3db9('0x20')](function(_0x354b6c){_0x54ec5c[_0x3db9('0x1a')]=_0x354b6c;if(_0x2ed16a['query'][_0x3db9('0x3f')]){_0x19068a[_0x3db9('0x40')]=[{'all':!![]}];}return db[_0x3db9('0x2a')][_0x3db9('0x41')](_0x19068a);})[_0x3db9('0x20')](function(_0xe2e39f){_0x54ec5c[_0x3db9('0x42')]=_0xe2e39f;return _0x54ec5c;})[_0x3db9('0x20')](respondWithFilteredResult(_0x1622a6,_0x19068a))[_0x3db9('0x43')](handleError(_0x1622a6,null));};exports[_0x3db9('0x44')]=function(_0x4d0f03,_0x39f2d7){var _0x1930e7={'raw':!![],'where':{'id':_0x4d0f03[_0x3db9('0x45')]['id']}},_0x4619d0={};_0x4619d0[_0x3db9('0x2f')]=_['keys'](db[_0x3db9('0x2a')][_0x3db9('0x2b')]);_0x4619d0[_0x3db9('0x30')]=_['keys'](_0x4d0f03['query']);_0x4619d0[_0x3db9('0x3b')]=_[_0x3db9('0x31')](_0x4619d0[_0x3db9('0x2f')],_0x4619d0[_0x3db9('0x30')]);_0x1930e7[_0x3db9('0x33')]=_[_0x3db9('0x31')](_0x4619d0[_0x3db9('0x2f')],qs[_0x3db9('0x32')](_0x4d0f03['query'][_0x3db9('0x32')]));_0x1930e7[_0x3db9('0x33')]=_0x1930e7[_0x3db9('0x33')][_0x3db9('0x34')]?_0x1930e7[_0x3db9('0x33')]:_0x4619d0['model'];if(_0x4d0f03[_0x3db9('0x30')][_0x3db9('0x3f')]){_0x1930e7[_0x3db9('0x40')]=[{'all':!![]}];}_0x1930e7=_['merge']({},_0x1930e7,_0x4d0f03[_0x3db9('0x46')]);return db[_0x3db9('0x2a')]['find'](_0x1930e7)[_0x3db9('0x20')](handleEntityNotFound(_0x39f2d7,null))[_0x3db9('0x20')](respondWithResult(_0x39f2d7,null))[_0x3db9('0x43')](handleError(_0x39f2d7,null));};exports[_0x3db9('0x47')]=function(_0x183781,_0x5a5256,_0x5ea8ef){return db[_0x3db9('0x2a')][_0x3db9('0x48')]({'where':{'id':_0x183781[_0x3db9('0x45')]['id']},'attributes':['name',_0x3db9('0x49'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x5a5256,null))[_0x3db9('0x20')](function(_0x3326e8){if(_0x3326e8){if(!fs[_0x3db9('0x4a')](path[_0x3db9('0x4b')](config['root'],_0x3db9('0x4c'),_0x3326e8[_0x3db9('0x49')]+'.'+_0x3326e8[_0x3db9('0x4d')]))){throw new db['Sequelize'][(_0x3db9('0x4e'))](_0x3db9('0x4f'));}return _0x5a5256[_0x3db9('0x47')](path['join'](config['root'],_0x3db9('0x4c'),util[_0x3db9('0x50')](_0x3db9('0x51'),_0x3326e8[_0x3db9('0x49')],_0x3326e8['converted_format'])),util[_0x3db9('0x50')](_0x3db9('0x51'),_0x3326e8[_0x3db9('0x26')],_0x3326e8[_0x3db9('0x4d')]));}return null;})[_0x3db9('0x43')](handleError(_0x5a5256,null));};exports[_0x3db9('0x52')]=function(_0x2a1ecc,_0x475e8c,_0x430982){var _0x233eb7={'name':path[_0x3db9('0x53')](_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x55')],path['extname'](_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x55')])),'save_name':path[_0x3db9('0x53')](_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x56')],path[_0x3db9('0x57')](_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x56')])),'original_format':path[_0x3db9('0x57')](_0x2a1ecc['file']['originalname'])[_0x3db9('0x58')](0x1),'converted_format':_0x3db9('0x59')};var _0x490863=path[_0x3db9('0x4b')](config[_0x3db9('0x5a')],_0x3db9('0x5b'),_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x56')]);var _0x30c6a8=path['join'](config[_0x3db9('0x5a')],'server/files/sounds/converted',util[_0x3db9('0x50')](_0x3db9('0x51'),path[_0x3db9('0x53')](_0x2a1ecc[_0x3db9('0x54')][_0x3db9('0x56')],path[_0x3db9('0x57')](_0x2a1ecc['file'][_0x3db9('0x56')])),_0x233eb7[_0x3db9('0x4d')]));logger[_0x3db9('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x490863);logger['info'](_0x3db9('0x5d'),_0x30c6a8);try{fs[_0x3db9('0x5e')](_0x490863,parseInt(_0x3db9('0x5f'),0x8));var _0x27f2a7=sox['transcode'](_0x490863,_0x30c6a8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27f2a7['on'](_0x3db9('0x24'),function(_0x39e304){fs['unlinkSync'](_0x490863);_0x475e8c[_0x3db9('0x18')](0x1f4)['send'](_0x39e304);});_0x27f2a7['on'](_0x3db9('0x60'),function(_0x4e0830){_0x233eb7[_0x3db9('0x61')]=isNaN(_0x4e0830[_0x3db9('0x62')])?null:_0x4e0830['duration']*0x3e8;_0x233eb7[_0x3db9('0x63')]=isNaN(_0x4e0830[_0x3db9('0x64')])?null:_0x4e0830[_0x3db9('0x64')];_0x233eb7['original_channelCount']=isNaN(_0x4e0830[_0x3db9('0x65')])?null:_0x4e0830['channelCount'];_0x233eb7[_0x3db9('0x66')]=isNaN(_0x4e0830[_0x3db9('0x67')])?null:_0x4e0830[_0x3db9('0x67')];_0x233eb7[_0x3db9('0x68')]=isNaN(_0x4e0830['sampleRate'])?null:_0x4e0830['sampleRate'];});_0x27f2a7['on'](_0x3db9('0x69'),function(_0x1488a0){_0x233eb7[_0x3db9('0x6a')]=isNaN(_0x1488a0[_0x3db9('0x62')])?null:_0x1488a0[_0x3db9('0x62')]*0x3e8;_0x233eb7[_0x3db9('0x6b')]=isNaN(_0x1488a0['sampleCount'])?null:_0x1488a0[_0x3db9('0x64')];_0x233eb7[_0x3db9('0x6c')]=isNaN(_0x1488a0[_0x3db9('0x65')])?null:_0x1488a0[_0x3db9('0x65')];_0x233eb7[_0x3db9('0x6d')]=isNaN(_0x1488a0[_0x3db9('0x67')])?null:_0x1488a0[_0x3db9('0x67')];_0x233eb7['converted_sampleRate']=isNaN(_0x1488a0[_0x3db9('0x6e')])?null:_0x1488a0[_0x3db9('0x6e')];});_0x27f2a7['on'](_0x3db9('0x23'),function(){fs[_0x3db9('0x5e')](_0x30c6a8,parseInt('0777',0x8));return db['Sound'][_0x3db9('0x52')](_0x233eb7)[_0x3db9('0x20')](function(_0x49b071){var _0x2be77f={'role':_0x2a1ecc['body'][_0x3db9('0x6f')],'userProfileId':_0x2a1ecc['body'][_0x3db9('0x70')]};if(!_0x2be77f)throw new Error(_0x3db9('0x71'));if(_0x2be77f[_0x3db9('0x6f')]===_0x3db9('0x72')){var _0x4d3cd5=_0x49b071[_0x3db9('0x22')]({'plain':!![]});return db[_0x3db9('0x73')][_0x3db9('0x48')]({'where':{'name':_0x3db9('0x74'),'userProfileId':_0x2be77f[_0x3db9('0x70')]},'raw':!![]})['then'](function(_0x2e1093){if(_0x2e1093&&_0x2e1093['autoAssociation']===0x0){return db[_0x3db9('0x75')][_0x3db9('0x52')]({'name':_0x4d3cd5[_0x3db9('0x26')],'resourceId':_0x4d3cd5['id'],'type':_0x2e1093[_0x3db9('0x26')],'sectionId':_0x2e1093['id']},{})[_0x3db9('0x20')](function(){return _0x49b071;});}else{return _0x49b071;}})[_0x3db9('0x43')](function(_0x5e271a){logger[_0x3db9('0x24')](_0x3db9('0x76'),_0x5e271a);throw _0x5e271a;});}return _0x49b071;})['then'](respondWithResult(_0x475e8c,null))[_0x3db9('0x43')](handleError(_0x475e8c,null));});_0x27f2a7[_0x3db9('0x77')]();}catch(_0x2ffca5){_0x475e8c['status'](0x1f4)[_0x3db9('0x27')](_0x2ffca5);}};exports[_0x3db9('0x1f')]=function(_0x5810cc,_0x4bad7e,_0x4fab8d){return db[_0x3db9('0x2a')][_0x3db9('0x48')]({'where':{'id':_0x5810cc[_0x3db9('0x45')]['id']}})[_0x3db9('0x20')](handleEntityNotFound(_0x4bad7e,null))['then'](saveUpdates(_[_0x3db9('0x3a')](_0x5810cc[_0x3db9('0x78')],['name','description']),null))[_0x3db9('0x20')](respondWithResult(_0x4bad7e,null))['catch'](handleError(_0x4bad7e,null));};exports[_0x3db9('0x79')]=function(_0x4363a7,_0x54e990,_0x418214){return db[_0x3db9('0x2a')][_0x3db9('0x48')]({'where':{'id':_0x4363a7[_0x3db9('0x45')]['id']}})[_0x3db9('0x20')](function(_0x381908){if(_0x381908){return _0x381908[_0x3db9('0x21')]();}})['then'](function(_0x25869f){var _0x3c0ed4=path[_0x3db9('0x4b')](config[_0x3db9('0x5a')],_0x3db9('0x5b'),util[_0x3db9('0x50')](_0x3db9('0x51'),_0x25869f[_0x3db9('0x49')],_0x25869f['original_format']));var _0xa013e0=path['join'](config[_0x3db9('0x5a')],_0x3db9('0x4c'),util[_0x3db9('0x50')](_0x3db9('0x51'),_0x25869f[_0x3db9('0x49')],_0x25869f['converted_format']));fs[_0x3db9('0x7a')](_0x3c0ed4);fs[_0x3db9('0x7a')](_0xa013e0);return _0x25869f;})[_0x3db9('0x20')](function(_0x38501c){if(_0x38501c){return _0x54e990['status'](0xcc)[_0x3db9('0x23')]();}})[_0x3db9('0x20')](handleEntityNotFound(_0x54e990,null))[_0x3db9('0x43')](handleError(_0x54e990,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 36a6e29..992ec31 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 _0xfa53=['rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x30c133,_0x20e3bd){var _0x38a446=function(_0x279454){while(--_0x279454){_0x30c133['push'](_0x30c133['shift']());}};_0x38a446(++_0x20e3bd);}(_0xfa53,0x192));var _0x3fa5=function(_0x50685f,_0x45dbce){_0x50685f=_0x50685f-0x0;var _0x2bfccc=_0xfa53[_0x50685f];return _0x2bfccc;};'use strict';var _=require(_0x3fa5('0x0'));var util=require(_0x3fa5('0x1'));var logger=require(_0x3fa5('0x2'))(_0x3fa5('0x3'));var moment=require(_0x3fa5('0x4'));var BPromise=require(_0x3fa5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa5('0x6'));var config=require(_0x3fa5('0x7'));var attributes=require(_0x3fa5('0x8'));module[_0x3fa5('0x9')]=function(_0x1a9801,_0x406d75){return _0x1a9801[_0x3fa5('0xa')]('Sound',attributes,{'tableName':_0x3fa5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x31bcd7,_0x53e9c6){var _0x1b7ce5=function(_0xbd7bf2){while(--_0xbd7bf2){_0x31bcd7['push'](_0x31bcd7['shift']());}};_0x1b7ce5(++_0x53e9c6);}(_0x11b7,0x1a4));var _0x711b=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0x11b7[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require(_0x711b('0x0'));var util=require(_0x711b('0x1'));var logger=require(_0x711b('0x2'))(_0x711b('0x3'));var moment=require(_0x711b('0x4'));var BPromise=require(_0x711b('0x5'));var rp=require(_0x711b('0x6'));var fs=require('fs');var path=require(_0x711b('0x7'));var rimraf=require(_0x711b('0x8'));var config=require(_0x711b('0x9'));var attributes=require(_0x711b('0xa'));module[_0x711b('0xb')]=function(_0x58596a,_0x4cd777){return _0x58596a[_0x711b('0xc')](_0x711b('0xd'),attributes,{'tableName':_0x711b('0xe'),'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 69eb529..534fe2f 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 _0x276e=['client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Sound','find','options','raw','where','attributes','include','map','model','info','ShowSound','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x276e,0x107));var _0xe276=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x276e[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xe276('0x0'));var util=require(_0xe276('0x1'));var moment=require('moment');var BPromise=require(_0xe276('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe276('0x3'));var db=require(_0xe276('0x4'))['db'];var utils=require(_0xe276('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe276('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe276('0x7')][_0xe276('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14aec4,_0x370f18,_0x2fecc8){return new BPromise(function(_0x3c847e,_0x10251e){return client[_0xe276('0x9')](_0x14aec4,_0x2fecc8)[_0xe276('0xa')](function(_0x81a1da){logger['info'](_0xe276('0xb'),_0x370f18,_0xe276('0xc'));logger[_0xe276('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x370f18,_0xe276('0xc'),JSON[_0xe276('0xe')](_0x81a1da));if(_0x81a1da[_0xe276('0xf')]){if(_0x81a1da[_0xe276('0xf')][_0xe276('0x10')]===0x1f4){logger[_0xe276('0xf')](_0xe276('0xb'),_0x370f18,_0x81a1da['error'][_0xe276('0x11')]);return _0x10251e(_0x81a1da['error'][_0xe276('0x11')]);}logger[_0xe276('0xf')]('Sound,\x20%s,\x20%s',_0x370f18,_0x81a1da[_0xe276('0xf')]['message']);return _0x3c847e(_0x81a1da[_0xe276('0xf')][_0xe276('0x11')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x370f18,_0xe276('0xc'));_0x3c847e(_0x81a1da[_0xe276('0x12')][_0xe276('0x11')]);}})['catch'](function(_0xac92b8){logger['error'](_0xe276('0xb'),_0x370f18,_0xac92b8);_0x10251e(_0xac92b8);});});}exports['ShowSound']=function(_0x75ca74){var _0x570d80=this;return new Promise(function(_0x13e9a9,_0x26d122){return db[_0xe276('0x13')][_0xe276('0x14')]({'raw':_0x75ca74[_0xe276('0x15')]?_0x75ca74[_0xe276('0x15')][_0xe276('0x16')]===undefined?!![]:![]:!![],'where':_0x75ca74['options']?_0x75ca74[_0xe276('0x15')][_0xe276('0x17')]||null:null,'attributes':_0x75ca74[_0xe276('0x15')]?_0x75ca74['options'][_0xe276('0x18')]||null:null,'include':_0x75ca74[_0xe276('0x15')]?_0x75ca74[_0xe276('0x15')][_0xe276('0x19')]?_[_0xe276('0x1a')](_0x75ca74[_0xe276('0x15')][_0xe276('0x19')],function(_0x3d48fc){return{'model':db[_0x3d48fc[_0xe276('0x1b')]],'as':_0x3d48fc['as'],'attributes':_0x3d48fc['attributes'],'include':_0x3d48fc[_0xe276('0x19')]?_[_0xe276('0x1a')](_0x3d48fc[_0xe276('0x19')],function(_0x30ce73){return{'model':db[_0x30ce73[_0xe276('0x1b')]],'as':_0x30ce73['as'],'attributes':_0x30ce73[_0xe276('0x18')],'include':_0x30ce73[_0xe276('0x19')]?_[_0xe276('0x1a')](_0x30ce73[_0xe276('0x19')],function(_0x59c293){return{'model':db[_0x59c293[_0xe276('0x1b')]],'as':_0x59c293['as'],'attributes':_0x59c293[_0xe276('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe276('0xa')](function(_0x537d5f){logger[_0xe276('0x1c')](_0xe276('0x1d'),_0x75ca74);logger[_0xe276('0xd')](_0xe276('0x1d'),_0x75ca74,JSON['stringify'](_0x537d5f));_0x13e9a9(_0x537d5f);})['catch'](function(_0x2a84c4){logger[_0xe276('0xf')](_0xe276('0x1d'),_0x2a84c4['message'],_0x75ca74);_0x26d122(_0x570d80[_0xe276('0xf')](0x1f4,_0x2a84c4['message']));});});}; \ No newline at end of file +var _0xd8de=['result','ShowSound','find','options','raw','attributes','include','map','model','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x12d08a,_0x3aed39){var _0x43a24d=function(_0x56b8f7){while(--_0x56b8f7){_0x12d08a['push'](_0x12d08a['shift']());}};_0x43a24d(++_0x3aed39);}(_0xd8de,0x133));var _0xed8d=function(_0x2865c8,_0x3bee47){_0x2865c8=_0x2865c8-0x0;var _0x3d6666=_0xd8de[_0x2865c8];return _0x3d6666;};'use strict';var _=require(_0xed8d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed8d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed8d('0x2'));var logger=require(_0xed8d('0x3'))(_0xed8d('0x4'));var config=require(_0xed8d('0x5'));var jayson=require(_0xed8d('0x6'));var client=jayson[_0xed8d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x231b10,_0x5777c9,_0x1264d3){return new BPromise(function(_0x259aca,_0x4a64f2){return client[_0xed8d('0x8')](_0x231b10,_0x1264d3)[_0xed8d('0x9')](function(_0xc42c7f){logger[_0xed8d('0xa')](_0xed8d('0xb'),_0x5777c9,_0xed8d('0xc'));logger[_0xed8d('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x5777c9,_0xed8d('0xc'),JSON[_0xed8d('0xe')](_0xc42c7f));if(_0xc42c7f[_0xed8d('0xf')]){if(_0xc42c7f[_0xed8d('0xf')]['code']===0x1f4){logger[_0xed8d('0xf')](_0xed8d('0xb'),_0x5777c9,_0xc42c7f[_0xed8d('0xf')]['message']);return _0x4a64f2(_0xc42c7f[_0xed8d('0xf')][_0xed8d('0x10')]);}logger[_0xed8d('0xf')](_0xed8d('0xb'),_0x5777c9,_0xc42c7f[_0xed8d('0xf')]['message']);return _0x259aca(_0xc42c7f[_0xed8d('0xf')][_0xed8d('0x10')]);}else{logger['info'](_0xed8d('0xb'),_0x5777c9,_0xed8d('0xc'));_0x259aca(_0xc42c7f[_0xed8d('0x11')][_0xed8d('0x10')]);}})['catch'](function(_0x4ebea6){logger[_0xed8d('0xf')](_0xed8d('0xb'),_0x5777c9,_0x4ebea6);_0x4a64f2(_0x4ebea6);});});}exports[_0xed8d('0x12')]=function(_0x5bcf95){var _0x473a68=this;return new Promise(function(_0x23593b,_0x367447){return db['Sound'][_0xed8d('0x13')]({'raw':_0x5bcf95[_0xed8d('0x14')]?_0x5bcf95['options'][_0xed8d('0x15')]===undefined?!![]:![]:!![],'where':_0x5bcf95['options']?_0x5bcf95[_0xed8d('0x14')]['where']||null:null,'attributes':_0x5bcf95['options']?_0x5bcf95[_0xed8d('0x14')][_0xed8d('0x16')]||null:null,'include':_0x5bcf95[_0xed8d('0x14')]?_0x5bcf95['options'][_0xed8d('0x17')]?_[_0xed8d('0x18')](_0x5bcf95[_0xed8d('0x14')][_0xed8d('0x17')],function(_0x159529){return{'model':db[_0x159529[_0xed8d('0x19')]],'as':_0x159529['as'],'attributes':_0x159529['attributes'],'include':_0x159529['include']?_[_0xed8d('0x18')](_0x159529['include'],function(_0x13ff22){return{'model':db[_0x13ff22['model']],'as':_0x13ff22['as'],'attributes':_0x13ff22['attributes'],'include':_0x13ff22[_0xed8d('0x17')]?_[_0xed8d('0x18')](_0x13ff22[_0xed8d('0x17')],function(_0x5acad0){return{'model':db[_0x5acad0[_0xed8d('0x19')]],'as':_0x5acad0['as'],'attributes':_0x5acad0[_0xed8d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xed8d('0x9')](function(_0x4e69bb){logger[_0xed8d('0xa')](_0xed8d('0x12'),_0x5bcf95);logger[_0xed8d('0xd')](_0xed8d('0x12'),_0x5bcf95,JSON[_0xed8d('0xe')](_0x4e69bb));_0x23593b(_0x4e69bb);})[_0xed8d('0x1a')](function(_0x249dad){logger['error'](_0xed8d('0x12'),_0x249dad[_0xed8d('0x10')],_0x5bcf95);_0x367447(_0x473a68[_0xed8d('0xf')](0x1f4,_0x249dad[_0xed8d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 701041f..9e13468 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 _0xfd4d=['get','index','/:id','show','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./squareMessage.controller'];(function(_0x41fe33,_0x5d9119){var _0x21b66e=function(_0x24ae72){while(--_0x24ae72){_0x41fe33['push'](_0x41fe33['shift']());}};_0x21b66e(++_0x5d9119);}(_0xfd4d,0x1e9));var _0xdfd4=function(_0x382d46,_0x42b7e9){_0x382d46=_0x382d46-0x0;var _0x28f657=_0xfd4d[_0x382d46];return _0x28f657;};'use strict';var multer=require(_0xdfd4('0x0'));var util=require(_0xdfd4('0x1'));var path=require('path');var timeout=require(_0xdfd4('0x2'));var express=require(_0xdfd4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdfd4('0x4'));var config=require('../../config/environment');var controller=require(_0xdfd4('0x5'));router[_0xdfd4('0x6')]('/',auth['isAuthenticated'](),controller[_0xdfd4('0x7')]);router[_0xdfd4('0x6')](_0xdfd4('0x8'),auth['isAuthenticated'](),controller[_0xdfd4('0x9')]);router['post']('/',auth[_0xdfd4('0xa')](),controller['create']);router['put'](_0xdfd4('0x8'),auth[_0xdfd4('0xa')](),controller[_0xdfd4('0xb')]);router[_0xdfd4('0xc')]('/:id',auth[_0xdfd4('0xa')](),controller[_0xdfd4('0xd')]);module[_0xdfd4('0xe')]=router; \ No newline at end of file +var _0x5e00=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','/:id','isAuthenticated','create','delete','exports'];(function(_0x403ff8,_0x459e58){var _0xfdee81=function(_0x2f65f8){while(--_0x2f65f8){_0x403ff8['push'](_0x403ff8['shift']());}};_0xfdee81(++_0x459e58);}(_0x5e00,0x70));var _0x05e0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5e00[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x05e0('0x0'));var util=require(_0x05e0('0x1'));var path=require('path');var timeout=require(_0x05e0('0x2'));var express=require(_0x05e0('0x3'));var router=express[_0x05e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x05e0('0x5'));var config=require(_0x05e0('0x6'));var controller=require(_0x05e0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x05e0('0x8')]);router['get'](_0x05e0('0x9'),auth[_0x05e0('0xa')](),controller['show']);router['post']('/',auth[_0x05e0('0xa')](),controller[_0x05e0('0xb')]);router['put'](_0x05e0('0x9'),auth[_0x05e0('0xa')](),controller['update']);router[_0x05e0('0xc')]('/:id',auth[_0x05e0('0xa')](),controller['destroy']);module[_0x05e0('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 2d33827..d4e3fe1 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 _0x7217=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'body':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7721('0x4')]('in',_0x7721('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7721('0x2')]}}; \ No newline at end of file +var _0xe0ae=['out','STRING','TEXT','ENUM'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0xe0ae,0xa1));var _0xee0a=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xe0ae[_0x216799];return _0x3661c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xee0a('0x0')]},'body':{'type':Sequelize[_0xee0a('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xee0a('0x2')]('in','out'),'defaultValue':_0xee0a('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xee0a('0x0')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ffceab1..f34dccd 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 _0x218d=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count'];(function(_0x485081,_0x21baa1){var _0xc755cf=function(_0x6a4191){while(--_0x6a4191){_0x485081['push'](_0x485081['shift']());}};_0xc755cf(++_0x21baa1);}(_0x218d,0x1a6));var _0xd218=function(_0x50a23f,_0x173857){_0x50a23f=_0x50a23f-0x0;var _0x4dc1be=_0x218d[_0x50a23f];return _0x4dc1be;};'use strict';var pdf=require(_0xd218('0x0'));var emlformat=require(_0xd218('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd218('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd218('0x3'));var moment=require('moment');var BPromise=require(_0xd218('0x4'));var Mustache=require('mustache');var util=require(_0xd218('0x5'));var path=require(_0xd218('0x6'));var sox=require(_0xd218('0x7'));var csv=require(_0xd218('0x8'));var ejs=require(_0xd218('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd218('0xa'));var crypto=require(_0xd218('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd218('0xc'));var toCsv=require(_0xd218('0x8'));var querystring=require(_0xd218('0xd'));var Papa=require(_0xd218('0xe'));var Redis=require(_0xd218('0xf'));var authService=require(_0xd218('0x10'));var qs=require(_0xd218('0x11'));var as=require(_0xd218('0x12'));var hardwareService=require(_0xd218('0x13'));var logger=require('../../config/logger')(_0xd218('0x14'));var utils=require(_0xd218('0x15'));var config=require(_0xd218('0x16'));var licenseUtil=require(_0xd218('0x17'));var db=require(_0xd218('0x18'))['db'];function respondWithStatusCode(_0x425e57,_0x2f4cfb){_0x2f4cfb=_0x2f4cfb||0xcc;return function(_0x287243){if(_0x287243){return _0x425e57['sendStatus'](_0x2f4cfb);}return _0x425e57[_0xd218('0x19')](_0x2f4cfb)['end']();};}function respondWithResult(_0x315486,_0x5a1f78){_0x5a1f78=_0x5a1f78||0xc8;return function(_0x2374e0){if(_0x2374e0){return _0x315486['status'](_0x5a1f78)[_0xd218('0x1a')](_0x2374e0);}};}function respondWithFilteredResult(_0x12cf89,_0x145db7){return function(_0x37a41d){if(_0x37a41d){var _0x119e75=_0x37a41d[_0xd218('0x1b')],_0x382211=_0x145db7[_0xd218('0x1c')],_0x344f02=_0x145db7[_0xd218('0x1c')]+_0x145db7[_0xd218('0x1d')],_0x1d9ab8;if(_0x344f02>=_0x119e75){_0x344f02=_0x119e75;_0x1d9ab8=0xc8;}else{_0x1d9ab8=0xce;}_0x12cf89[_0xd218('0x19')](_0x1d9ab8);return _0x12cf89[_0xd218('0x1e')](_0xd218('0x1f'),_0x382211+'-'+_0x344f02+'/'+_0x119e75)[_0xd218('0x1a')](_0x37a41d);}return null;};}function patchUpdates(_0x135942){return function(_0x4f81e3){try{jsonpatch[_0xd218('0x20')](_0x4f81e3,_0x135942,!![]);}catch(_0x4f4ea7){return BPromise[_0xd218('0x21')](_0x4f4ea7);}return _0x4f81e3[_0xd218('0x22')]();};}function saveUpdates(_0x5aea12,_0x65c6ac){return function(_0x1bf210){if(_0x1bf210){return _0x1bf210[_0xd218('0x23')](_0x5aea12)[_0xd218('0x24')](function(_0x135bec){return _0x135bec;});}return null;};}function removeEntity(_0x27a3b5,_0x178639){return function(_0x8edf35){if(_0x8edf35){return _0x8edf35[_0xd218('0x25')]()['then'](function(){_0x27a3b5[_0xd218('0x19')](0xcc)[_0xd218('0x26')]();});}};}function handleEntityNotFound(_0xf68183,_0xb62029){return function(_0x2293f0){if(!_0x2293f0){_0xf68183[_0xd218('0x27')](0x194);}return _0x2293f0;};}function handleError(_0x570e5b,_0x4d772a){_0x4d772a=_0x4d772a||0x1f4;return function(_0x3a6f27){logger[_0xd218('0x28')](_0x3a6f27['stack']);if(_0x3a6f27[_0xd218('0x29')]){delete _0x3a6f27[_0xd218('0x29')];}_0x570e5b[_0xd218('0x19')](_0x4d772a)[_0xd218('0x2a')](_0x3a6f27);};}exports[_0xd218('0x2b')]=function(_0x6594b8,_0x568a7d){var _0x5a1a4f={},_0x50ddd3={},_0x1d0d5b={'count':0x0,'rows':[]};var _0x2a4c6c=_[_0xd218('0x2c')](db['SquareMessage'][_0xd218('0x2d')],function(_0x2990ae){return{'name':_0x2990ae[_0xd218('0x2e')],'type':_0x2990ae[_0xd218('0x2f')][_0xd218('0x30')]};});_0x50ddd3[_0xd218('0x31')]=_[_0xd218('0x2c')](_0x2a4c6c,_0xd218('0x29'));_0x50ddd3[_0xd218('0x32')]=_[_0xd218('0x33')](_0x6594b8['query']);_0x50ddd3[_0xd218('0x34')]=_[_0xd218('0x35')](_0x50ddd3['model'],_0x50ddd3[_0xd218('0x32')]);_0x5a1a4f[_0xd218('0x36')]=_[_0xd218('0x35')](_0x50ddd3[_0xd218('0x31')],qs[_0xd218('0x37')](_0x6594b8[_0xd218('0x32')]['fields']));_0x5a1a4f[_0xd218('0x36')]=_0x5a1a4f[_0xd218('0x36')][_0xd218('0x38')]?_0x5a1a4f['attributes']:_0x50ddd3[_0xd218('0x31')];if(!_0x6594b8[_0xd218('0x32')][_0xd218('0x39')](_0xd218('0x3a'))){_0x5a1a4f[_0xd218('0x1d')]=qs[_0xd218('0x1d')](_0x6594b8[_0xd218('0x32')][_0xd218('0x1d')]);_0x5a1a4f[_0xd218('0x1c')]=qs[_0xd218('0x1c')](_0x6594b8[_0xd218('0x32')][_0xd218('0x1c')]);}_0x5a1a4f['order']=qs['sort'](_0x6594b8['query']['sort']);_0x5a1a4f['where']=qs[_0xd218('0x34')](_[_0xd218('0x3b')](_0x6594b8['query'],_0x50ddd3[_0xd218('0x34')]),_0x2a4c6c);if(_0x6594b8['query'][_0xd218('0x3c')]){_0x5a1a4f[_0xd218('0x3d')]=_[_0xd218('0x3e')](_0x5a1a4f['where'],{'$or':_['map'](_0x2a4c6c,function(_0x2326b7){if(_0x2326b7[_0xd218('0x2f')]!=='VIRTUAL'){var _0x3e4728={};_0x3e4728[_0x2326b7[_0xd218('0x29')]]={'$like':'%'+_0x6594b8[_0xd218('0x32')][_0xd218('0x3c')]+'%'};return _0x3e4728;}})});}_0x5a1a4f=_[_0xd218('0x3e')]({},_0x5a1a4f,_0x6594b8[_0xd218('0x3f')]);var _0x2c3621={'where':_0x5a1a4f['where']};return db[_0xd218('0x40')][_0xd218('0x1b')](_0x2c3621)[_0xd218('0x24')](function(_0x5254d9){_0x1d0d5b[_0xd218('0x1b')]=_0x5254d9;if(_0x6594b8[_0xd218('0x32')][_0xd218('0x41')]){_0x5a1a4f[_0xd218('0x42')]=[{'all':!![]}];}return db[_0xd218('0x40')][_0xd218('0x43')](_0x5a1a4f);})[_0xd218('0x24')](function(_0x3e9d39){_0x1d0d5b[_0xd218('0x44')]=_0x3e9d39;return _0x1d0d5b;})['then'](respondWithFilteredResult(_0x568a7d,_0x5a1a4f))[_0xd218('0x45')](handleError(_0x568a7d,null));};exports[_0xd218('0x46')]=function(_0x4026dd,_0x1c27b6){var _0x2dcfb6={'raw':!![],'where':{'id':_0x4026dd[_0xd218('0x47')]['id']}},_0x185295={};_0x185295['model']=_['keys'](db[_0xd218('0x40')]['rawAttributes']);_0x185295['query']=_[_0xd218('0x33')](_0x4026dd[_0xd218('0x32')]);_0x185295[_0xd218('0x34')]=_[_0xd218('0x35')](_0x185295[_0xd218('0x31')],_0x185295['query']);_0x2dcfb6[_0xd218('0x36')]=_[_0xd218('0x35')](_0x185295['model'],qs['fields'](_0x4026dd[_0xd218('0x32')][_0xd218('0x37')]));_0x2dcfb6[_0xd218('0x36')]=_0x2dcfb6[_0xd218('0x36')]['length']?_0x2dcfb6['attributes']:_0x185295[_0xd218('0x31')];if(_0x4026dd[_0xd218('0x32')][_0xd218('0x41')]){_0x2dcfb6[_0xd218('0x42')]=[{'all':!![]}];}_0x2dcfb6=_['merge']({},_0x2dcfb6,_0x4026dd[_0xd218('0x3f')]);return db[_0xd218('0x40')][_0xd218('0x48')](_0x2dcfb6)[_0xd218('0x24')](handleEntityNotFound(_0x1c27b6,null))[_0xd218('0x24')](respondWithResult(_0x1c27b6,null))[_0xd218('0x45')](handleError(_0x1c27b6,null));};exports[_0xd218('0x49')]=function(_0x26a745,_0x516c08){return db[_0xd218('0x40')][_0xd218('0x49')](_0x26a745[_0xd218('0x4a')],{})[_0xd218('0x24')](respondWithResult(_0x516c08,0xc9))[_0xd218('0x45')](handleError(_0x516c08,null));};exports[_0xd218('0x23')]=function(_0xf73a3b,_0x9356f9){if(_0xf73a3b[_0xd218('0x4a')]['id']){delete _0xf73a3b[_0xd218('0x4a')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0xf73a3b[_0xd218('0x47')]['id']}})[_0xd218('0x24')](handleEntityNotFound(_0x9356f9,null))['then'](saveUpdates(_0xf73a3b['body'],null))[_0xd218('0x24')](respondWithResult(_0x9356f9,null))['catch'](handleError(_0x9356f9,null));};exports['destroy']=function(_0x3f953d,_0x19ab21){return db['SquareMessage'][_0xd218('0x48')]({'where':{'id':_0x3f953d[_0xd218('0x47')]['id']}})[_0xd218('0x24')](handleEntityNotFound(_0x19ab21,null))['then'](removeEntity(_0x19ab21,null))[_0xd218('0x45')](handleError(_0x19ab21,null));}; \ No newline at end of file +var _0x98e5=['send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','include','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','destroy','error','stack','name'];(function(_0x5bb9a6,_0x5739c0){var _0x359917=function(_0x232a29){while(--_0x232a29){_0x5bb9a6['push'](_0x5bb9a6['shift']());}};_0x359917(++_0x5739c0);}(_0x98e5,0x1b1));var _0x598e=function(_0x2ef8c5,_0xb2b90b){_0x2ef8c5=_0x2ef8c5-0x0;var _0x4e59b4=_0x98e5[_0x2ef8c5];return _0x4e59b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x598e('0x0'));var rimraf=require(_0x598e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x598e('0x2'));var rp=require(_0x598e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x598e('0x4'));var util=require(_0x598e('0x5'));var path=require('path');var sox=require(_0x598e('0x6'));var csv=require(_0x598e('0x7'));var ejs=require(_0x598e('0x8'));var fs=require('fs');var _=require(_0x598e('0x9'));var squel=require(_0x598e('0xa'));var crypto=require('crypto');var jsforce=require(_0x598e('0xb'));var deskjs=require(_0x598e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x598e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x598e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x598e('0xf'));var logger=require(_0x598e('0x10'))('api');var utils=require(_0x598e('0x11'));var config=require(_0x598e('0x12'));var licenseUtil=require(_0x598e('0x13'));var db=require(_0x598e('0x14'))['db'];function respondWithStatusCode(_0x59498a,_0x34aef9){_0x34aef9=_0x34aef9||0xcc;return function(_0x263d48){if(_0x263d48){return _0x59498a[_0x598e('0x15')](_0x34aef9);}return _0x59498a['status'](_0x34aef9)[_0x598e('0x16')]();};}function respondWithResult(_0x5d5c4e,_0x431b62){_0x431b62=_0x431b62||0xc8;return function(_0x369009){if(_0x369009){return _0x5d5c4e[_0x598e('0x17')](_0x431b62)[_0x598e('0x18')](_0x369009);}};}function respondWithFilteredResult(_0x503686,_0x2492d5){return function(_0x22f0a7){if(_0x22f0a7){var _0x34fd97=_0x22f0a7[_0x598e('0x19')],_0x2ac6c1=_0x2492d5[_0x598e('0x1a')],_0x4973bb=_0x2492d5[_0x598e('0x1a')]+_0x2492d5[_0x598e('0x1b')],_0x49df8d;if(_0x4973bb>=_0x34fd97){_0x4973bb=_0x34fd97;_0x49df8d=0xc8;}else{_0x49df8d=0xce;}_0x503686[_0x598e('0x17')](_0x49df8d);return _0x503686[_0x598e('0x1c')]('Content-Range',_0x2ac6c1+'-'+_0x4973bb+'/'+_0x34fd97)[_0x598e('0x18')](_0x22f0a7);}return null;};}function patchUpdates(_0x1dc62e){return function(_0x2702b1){try{jsonpatch[_0x598e('0x1d')](_0x2702b1,_0x1dc62e,!![]);}catch(_0x476f50){return BPromise[_0x598e('0x1e')](_0x476f50);}return _0x2702b1[_0x598e('0x1f')]();};}function saveUpdates(_0x3c507f,_0x109b7f){return function(_0x173ce3){if(_0x173ce3){return _0x173ce3['update'](_0x3c507f)['then'](function(_0x20cb24){return _0x20cb24;});}return null;};}function removeEntity(_0x37b7f7,_0x4dbec9){return function(_0x327a22){if(_0x327a22){return _0x327a22[_0x598e('0x20')]()['then'](function(){_0x37b7f7[_0x598e('0x17')](0xcc)[_0x598e('0x16')]();});}};}function handleEntityNotFound(_0x31d3f0,_0x15922a){return function(_0x30ce0c){if(!_0x30ce0c){_0x31d3f0[_0x598e('0x15')](0x194);}return _0x30ce0c;};}function handleError(_0x1fe7c8,_0x5672a4){_0x5672a4=_0x5672a4||0x1f4;return function(_0x47879c){logger[_0x598e('0x21')](_0x47879c[_0x598e('0x22')]);if(_0x47879c['name']){delete _0x47879c[_0x598e('0x23')];}_0x1fe7c8['status'](_0x5672a4)[_0x598e('0x24')](_0x47879c);};}exports[_0x598e('0x25')]=function(_0x5ccf47,_0x3e4728){var _0x4cc0d8={},_0x1e93dd={},_0x2edb6f={'count':0x0,'rows':[]};var _0x21524a=_[_0x598e('0x26')](db[_0x598e('0x27')][_0x598e('0x28')],function(_0x5ddab0){return{'name':_0x5ddab0[_0x598e('0x29')],'type':_0x5ddab0[_0x598e('0x2a')][_0x598e('0x2b')]};});_0x1e93dd[_0x598e('0x2c')]=_[_0x598e('0x26')](_0x21524a,'name');_0x1e93dd[_0x598e('0x2d')]=_[_0x598e('0x2e')](_0x5ccf47[_0x598e('0x2d')]);_0x1e93dd['filters']=_[_0x598e('0x2f')](_0x1e93dd['model'],_0x1e93dd['query']);_0x4cc0d8[_0x598e('0x30')]=_[_0x598e('0x2f')](_0x1e93dd[_0x598e('0x2c')],qs[_0x598e('0x31')](_0x5ccf47[_0x598e('0x2d')][_0x598e('0x31')]));_0x4cc0d8[_0x598e('0x30')]=_0x4cc0d8['attributes'][_0x598e('0x32')]?_0x4cc0d8[_0x598e('0x30')]:_0x1e93dd[_0x598e('0x2c')];if(!_0x5ccf47[_0x598e('0x2d')][_0x598e('0x33')]('nolimit')){_0x4cc0d8[_0x598e('0x1b')]=qs['limit'](_0x5ccf47[_0x598e('0x2d')][_0x598e('0x1b')]);_0x4cc0d8[_0x598e('0x1a')]=qs[_0x598e('0x1a')](_0x5ccf47[_0x598e('0x2d')][_0x598e('0x1a')]);}_0x4cc0d8[_0x598e('0x34')]=qs[_0x598e('0x35')](_0x5ccf47[_0x598e('0x2d')][_0x598e('0x35')]);_0x4cc0d8[_0x598e('0x36')]=qs[_0x598e('0x37')](_['pick'](_0x5ccf47[_0x598e('0x2d')],_0x1e93dd[_0x598e('0x37')]),_0x21524a);if(_0x5ccf47[_0x598e('0x2d')][_0x598e('0x38')]){_0x4cc0d8[_0x598e('0x36')]=_['merge'](_0x4cc0d8[_0x598e('0x36')],{'$or':_[_0x598e('0x26')](_0x21524a,function(_0xb0d5e5){if(_0xb0d5e5[_0x598e('0x2a')]!==_0x598e('0x39')){var _0x159499={};_0x159499[_0xb0d5e5[_0x598e('0x23')]]={'$like':'%'+_0x5ccf47[_0x598e('0x2d')][_0x598e('0x38')]+'%'};return _0x159499;}})});}_0x4cc0d8=_[_0x598e('0x3a')]({},_0x4cc0d8,_0x5ccf47[_0x598e('0x3b')]);var _0x288720={'where':_0x4cc0d8[_0x598e('0x36')]};return db[_0x598e('0x27')][_0x598e('0x19')](_0x288720)[_0x598e('0x3c')](function(_0x2bed45){_0x2edb6f[_0x598e('0x19')]=_0x2bed45;if(_0x5ccf47[_0x598e('0x2d')][_0x598e('0x3d')]){_0x4cc0d8[_0x598e('0x3e')]=[{'all':!![]}];}return db[_0x598e('0x27')]['findAll'](_0x4cc0d8);})['then'](function(_0x44c97f){_0x2edb6f['rows']=_0x44c97f;return _0x2edb6f;})[_0x598e('0x3c')](respondWithFilteredResult(_0x3e4728,_0x4cc0d8))[_0x598e('0x3f')](handleError(_0x3e4728,null));};exports['show']=function(_0x298033,_0x30dea6){var _0x269f9a={'raw':!![],'where':{'id':_0x298033['params']['id']}},_0x67ff06={};_0x67ff06[_0x598e('0x2c')]=_['keys'](db[_0x598e('0x27')]['rawAttributes']);_0x67ff06['query']=_[_0x598e('0x2e')](_0x298033[_0x598e('0x2d')]);_0x67ff06['filters']=_[_0x598e('0x2f')](_0x67ff06['model'],_0x67ff06[_0x598e('0x2d')]);_0x269f9a[_0x598e('0x30')]=_['intersection'](_0x67ff06[_0x598e('0x2c')],qs['fields'](_0x298033[_0x598e('0x2d')][_0x598e('0x31')]));_0x269f9a[_0x598e('0x30')]=_0x269f9a[_0x598e('0x30')][_0x598e('0x32')]?_0x269f9a[_0x598e('0x30')]:_0x67ff06['model'];if(_0x298033[_0x598e('0x2d')][_0x598e('0x3d')]){_0x269f9a[_0x598e('0x3e')]=[{'all':!![]}];}_0x269f9a=_[_0x598e('0x3a')]({},_0x269f9a,_0x298033[_0x598e('0x3b')]);return db['SquareMessage']['find'](_0x269f9a)['then'](handleEntityNotFound(_0x30dea6,null))['then'](respondWithResult(_0x30dea6,null))[_0x598e('0x3f')](handleError(_0x30dea6,null));};exports[_0x598e('0x40')]=function(_0x20b259,_0x25d576){return db[_0x598e('0x27')]['create'](_0x20b259[_0x598e('0x41')],{})[_0x598e('0x3c')](respondWithResult(_0x25d576,0xc9))[_0x598e('0x3f')](handleError(_0x25d576,null));};exports['update']=function(_0x585db8,_0x21568f){if(_0x585db8[_0x598e('0x41')]['id']){delete _0x585db8[_0x598e('0x41')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x585db8[_0x598e('0x42')]['id']}})[_0x598e('0x3c')](handleEntityNotFound(_0x21568f,null))[_0x598e('0x3c')](saveUpdates(_0x585db8[_0x598e('0x41')],null))[_0x598e('0x3c')](respondWithResult(_0x21568f,null))[_0x598e('0x3f')](handleError(_0x21568f,null));};exports[_0x598e('0x20')]=function(_0x498976,_0x1f7a1d){return db[_0x598e('0x27')]['find']({'where':{'id':_0x498976['params']['id']}})[_0x598e('0x3c')](handleEntityNotFound(_0x1f7a1d,null))[_0x598e('0x3c')](removeEntity(_0x1f7a1d,null))[_0x598e('0x3f')](handleError(_0x1f7a1d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ceffd9d..c1d3bb1 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 _0xe18f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x7b627,_0x16ff83){var _0x2758b7=function(_0x375dfb){while(--_0x375dfb){_0x7b627['push'](_0x7b627['shift']());}};_0x2758b7(++_0x16ff83);}(_0xe18f,0xa6));var _0xfe18=function(_0x4ec046,_0x25230f){_0x4ec046=_0x4ec046-0x0;var _0x44fd55=_0xe18f[_0x4ec046];return _0x44fd55;};'use strict';var _=require(_0xfe18('0x0'));var util=require(_0xfe18('0x1'));var logger=require(_0xfe18('0x2'))(_0xfe18('0x3'));var moment=require('moment');var BPromise=require(_0xfe18('0x4'));var rp=require(_0xfe18('0x5'));var fs=require('fs');var path=require(_0xfe18('0x6'));var rimraf=require(_0xfe18('0x7'));var config=require(_0xfe18('0x8'));var attributes=require(_0xfe18('0x9'));module['exports']=function(_0x6e2575,_0x530d33){return _0x6e2575[_0xfe18('0xa')](_0xfe18('0xb'),attributes,{'tableName':_0xfe18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a4=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4edab5,_0x88c491){var _0x179478=function(_0x11fa0c){while(--_0x11fa0c){_0x4edab5['push'](_0x4edab5['shift']());}};_0x179478(++_0x88c491);}(_0xe7a4,0x185));var _0x4e7a=function(_0x16f466,_0x42d716){_0x16f466=_0x16f466-0x0;var _0x35b587=_0xe7a4[_0x16f466];return _0x35b587;};'use strict';var _=require(_0x4e7a('0x0'));var util=require(_0x4e7a('0x1'));var logger=require(_0x4e7a('0x2'))('api');var moment=require(_0x4e7a('0x3'));var BPromise=require(_0x4e7a('0x4'));var rp=require(_0x4e7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e7a('0x7'));module[_0x4e7a('0x8')]=function(_0x24ec58,_0x52a9b3){return _0x24ec58[_0x4e7a('0x9')](_0x4e7a('0xa'),attributes,{'tableName':_0x4e7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index debca11..833172b 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2056bc,_0x77e2e){var _0xa3d03=function(_0x35eae6){while(--_0x35eae6){_0x2056bc['push'](_0x2056bc['shift']());}};_0xa3d03(++_0x77e2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x516488,_0x4791fb){var _0x3dfb8d=function(_0x1d65f1){while(--_0x1d65f1){_0x516488['push'](_0x516488['shift']());}};_0x3dfb8d(++_0x4791fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9ecec1d..b3731f1 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 _0x6ac3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','test','post','create','put','update','delete','/:id','destroy','exports','util','path','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ac3,0x153));var _0x36ac=function(_0x235f85,_0x99e25f){_0x235f85=_0x235f85-0x0;var _0x53f0cc=_0x6ac3[_0x235f85];return _0x53f0cc;};'use strict';var multer=require('multer');var util=require(_0x36ac('0x0'));var path=require(_0x36ac('0x1'));var timeout=require('connect-timeout');var express=require(_0x36ac('0x2'));var router=express[_0x36ac('0x3')]();var auth=require(_0x36ac('0x4'));var interaction=require(_0x36ac('0x5'));var config=require(_0x36ac('0x6'));var controller=require('./squareOdbc.controller');router[_0x36ac('0x7')]('/',auth[_0x36ac('0x8')](),controller['index']);router[_0x36ac('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x36ac('0x9')]);router[_0x36ac('0x7')]('/:id/test',auth[_0x36ac('0x8')](),timeout('15s'),controller[_0x36ac('0xa')]);router[_0x36ac('0xb')]('/',auth[_0x36ac('0x8')](),controller[_0x36ac('0xc')]);router[_0x36ac('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x36ac('0xe')]);router[_0x36ac('0xf')](_0x36ac('0x10'),auth[_0x36ac('0x8')](),controller[_0x36ac('0x11')]);module[_0x36ac('0x12')]=router; \ No newline at end of file +var _0x72eb=['show','/:id/test','test','post','create','put','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','index','get','/:id','isAuthenticated'];(function(_0x1af420,_0x379678){var _0x1ea424=function(_0x2531f8){while(--_0x2531f8){_0x1af420['push'](_0x1af420['shift']());}};_0x1ea424(++_0x379678);}(_0x72eb,0x16f));var _0xb72e=function(_0x1e88db,_0x16e089){_0x1e88db=_0x1e88db-0x0;var _0x39bbd2=_0x72eb[_0x1e88db];return _0x39bbd2;};'use strict';var multer=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb72e('0x2'));var router=express[_0xb72e('0x3')]();var auth=require(_0xb72e('0x4'));var interaction=require(_0xb72e('0x5'));var config=require('../../config/environment');var controller=require(_0xb72e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb72e('0x7')]);router[_0xb72e('0x8')](_0xb72e('0x9'),auth[_0xb72e('0xa')](),controller[_0xb72e('0xb')]);router[_0xb72e('0x8')](_0xb72e('0xc'),auth[_0xb72e('0xa')](),timeout('15s'),controller[_0xb72e('0xd')]);router[_0xb72e('0xe')]('/',auth[_0xb72e('0xa')](),controller[_0xb72e('0xf')]);router[_0xb72e('0x10')](_0xb72e('0x9'),auth[_0xb72e('0xa')](),controller['update']);router[_0xb72e('0x11')](_0xb72e('0x9'),auth[_0xb72e('0xa')](),controller['destroy']);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 a0bfc69..4483a84 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 _0x63ab=['STRING','name','sequelize'];(function(_0x4a3941,_0x136835){var _0x29bbe7=function(_0x47a7a1){while(--_0x47a7a1){_0x4a3941['push'](_0x4a3941['shift']());}};_0x29bbe7(++_0x136835);}(_0x63ab,0x10d));var _0xb63a=function(_0x859765,_0x3e5999){_0x859765=_0x859765-0x0;var _0x186d6a=_0x63ab[_0x859765];return _0x186d6a;};'use strict';var Sequelize=require(_0xb63a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb63a('0x1')],'unique':_0xb63a('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd660=['STRING','name','exports'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0xd660,0x1eb));var _0x0d66=function(_0x38ff73,_0x2ff998){_0x38ff73=_0x38ff73-0x0;var _0x3d3901=_0xd660[_0x38ff73];return _0x3d3901;};'use strict';var Sequelize=require('sequelize');module[_0x0d66('0x0')]={'name':{'type':Sequelize[_0x0d66('0x1')],'unique':_0x0d66('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0d66('0x1')]},'description':{'type':Sequelize[_0x0d66('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 00aa741..eeb9dc9 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 _0xbafa=['dsn','odbc','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','save','destroy','then','ODBC','UserProfileResource','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xe17a98,_0x38abca){var _0x401e65=function(_0x23ad29){while(--_0x23ad29){_0xe17a98['push'](_0xe17a98['shift']());}};_0x401e65(++_0x38abca);}(_0xbafa,0x1a7));var _0xabaf=function(_0x3c5e7f,_0x3cc943){_0x3c5e7f=_0x3c5e7f-0x0;var _0x216e6e=_0xbafa[_0x3c5e7f];return _0x216e6e;};'use strict';var pdf=require(_0xabaf('0x0'));var emlformat=require(_0xabaf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xabaf('0x2'));var jsonpatch=require(_0xabaf('0x3'));var rp=require('request-promise');var moment=require(_0xabaf('0x4'));var BPromise=require(_0xabaf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xabaf('0x6'));var sox=require(_0xabaf('0x7'));var csv=require(_0xabaf('0x8'));var ejs=require(_0xabaf('0x9'));var fs=require('fs');var _=require(_0xabaf('0xa'));var squel=require(_0xabaf('0xb'));var crypto=require(_0xabaf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabaf('0x8'));var querystring=require('querystring');var Papa=require(_0xabaf('0xd'));var Redis=require(_0xabaf('0xe'));var authService=require(_0xabaf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xabaf('0x10'));var hardwareService=require(_0xabaf('0x11'));var logger=require(_0xabaf('0x12'))('api');var utils=require(_0xabaf('0x13'));var config=require(_0xabaf('0x14'));var licenseUtil=require(_0xabaf('0x15'));var db=require(_0xabaf('0x16'))['db'];function respondWithStatusCode(_0x56c573,_0x3be570){_0x3be570=_0x3be570||0xcc;return function(_0x47728e){if(_0x47728e){return _0x56c573[_0xabaf('0x17')](_0x3be570);}return _0x56c573[_0xabaf('0x18')](_0x3be570)[_0xabaf('0x19')]();};}function respondWithResult(_0x1b9b5b,_0x2ab8e2){_0x2ab8e2=_0x2ab8e2||0xc8;return function(_0x36035e){if(_0x36035e){return _0x1b9b5b['status'](_0x2ab8e2)[_0xabaf('0x1a')](_0x36035e);}};}function respondWithFilteredResult(_0x18b2ff,_0x5d2af5){return function(_0x3898a2){if(_0x3898a2){var _0x589847=_0x3898a2[_0xabaf('0x1b')],_0x4e436c=_0x5d2af5[_0xabaf('0x1c')],_0x292630=_0x5d2af5[_0xabaf('0x1c')]+_0x5d2af5['limit'],_0x10d2e0;if(_0x292630>=_0x589847){_0x292630=_0x589847;_0x10d2e0=0xc8;}else{_0x10d2e0=0xce;}_0x18b2ff[_0xabaf('0x18')](_0x10d2e0);return _0x18b2ff['set']('Content-Range',_0x4e436c+'-'+_0x292630+'/'+_0x589847)['json'](_0x3898a2);}return null;};}function patchUpdates(_0x3e9915){return function(_0x3207d2){try{jsonpatch[_0xabaf('0x1d')](_0x3207d2,_0x3e9915,!![]);}catch(_0x595270){return BPromise[_0xabaf('0x1e')](_0x595270);}return _0x3207d2[_0xabaf('0x1f')]();};}function saveUpdates(_0x1033a4,_0x4279c2){return function(_0x1e2fa2){if(_0x1e2fa2){return _0x1e2fa2['update'](_0x1033a4)['then'](function(_0x44d728){return _0x44d728;});}return null;};}function removeEntity(_0x5e967c,_0x17b740){return function(_0x2f0535){if(_0x2f0535){return _0x2f0535[_0xabaf('0x20')]()[_0xabaf('0x21')](function(){var _0x4ffd13=_0x2f0535['get']({'plain':!![]});var _0x161bf1=_0xabaf('0x22');return db[_0xabaf('0x23')][_0xabaf('0x20')]({'where':{'type':_0x161bf1,'resourceId':_0x4ffd13['id']}})[_0xabaf('0x21')](function(){return _0x2f0535;});})[_0xabaf('0x21')](function(){_0x5e967c[_0xabaf('0x18')](0xcc)[_0xabaf('0x19')]();});}};}function handleEntityNotFound(_0x6e4eb,_0x4d7170){return function(_0x2b226e){if(!_0x2b226e){_0x6e4eb[_0xabaf('0x17')](0x194);}return _0x2b226e;};}function handleError(_0x52b1a1,_0x2a832d){_0x2a832d=_0x2a832d||0x1f4;return function(_0x5005b9){logger['error'](_0x5005b9['stack']);if(_0x5005b9[_0xabaf('0x24')]){delete _0x5005b9['name'];}_0x52b1a1[_0xabaf('0x18')](_0x2a832d)[_0xabaf('0x25')](_0x5005b9);};}exports[_0xabaf('0x26')]=function(_0x53b6c8,_0x3213f8){var _0x164d57={},_0x56bbd7={},_0x2fdc98={'count':0x0,'rows':[]};var _0x50e013=_[_0xabaf('0x27')](db[_0xabaf('0x28')][_0xabaf('0x29')],function(_0x32db95){return{'name':_0x32db95[_0xabaf('0x2a')],'type':_0x32db95[_0xabaf('0x2b')][_0xabaf('0x2c')]};});_0x56bbd7[_0xabaf('0x2d')]=_[_0xabaf('0x27')](_0x50e013,_0xabaf('0x24'));_0x56bbd7['query']=_['keys'](_0x53b6c8[_0xabaf('0x2e')]);_0x56bbd7[_0xabaf('0x2f')]=_[_0xabaf('0x30')](_0x56bbd7[_0xabaf('0x2d')],_0x56bbd7['query']);_0x164d57[_0xabaf('0x31')]=_[_0xabaf('0x30')](_0x56bbd7[_0xabaf('0x2d')],qs[_0xabaf('0x32')](_0x53b6c8[_0xabaf('0x2e')]['fields']));_0x164d57['attributes']=_0x164d57[_0xabaf('0x31')][_0xabaf('0x33')]?_0x164d57[_0xabaf('0x31')]:_0x56bbd7['model'];if(!_0x53b6c8['query']['hasOwnProperty'](_0xabaf('0x34'))){_0x164d57[_0xabaf('0x35')]=qs[_0xabaf('0x35')](_0x53b6c8[_0xabaf('0x2e')][_0xabaf('0x35')]);_0x164d57[_0xabaf('0x1c')]=qs[_0xabaf('0x1c')](_0x53b6c8[_0xabaf('0x2e')][_0xabaf('0x1c')]);}_0x164d57[_0xabaf('0x36')]=qs[_0xabaf('0x37')](_0x53b6c8['query']['sort']);_0x164d57[_0xabaf('0x38')]=qs[_0xabaf('0x2f')](_[_0xabaf('0x39')](_0x53b6c8[_0xabaf('0x2e')],_0x56bbd7[_0xabaf('0x2f')]),_0x50e013);if(_0x53b6c8[_0xabaf('0x2e')][_0xabaf('0x3a')]){_0x164d57[_0xabaf('0x38')]=_['merge'](_0x164d57['where'],{'$or':_['map'](_0x50e013,function(_0x54866b){if(_0x54866b[_0xabaf('0x2b')]!==_0xabaf('0x3b')){var _0x5b73dd={};_0x5b73dd[_0x54866b[_0xabaf('0x24')]]={'$like':'%'+_0x53b6c8['query'][_0xabaf('0x3a')]+'%'};return _0x5b73dd;}})});}_0x164d57=_['merge']({},_0x164d57,_0x53b6c8[_0xabaf('0x3c')]);var _0x1c327a={'where':_0x164d57[_0xabaf('0x38')]};return db[_0xabaf('0x28')][_0xabaf('0x1b')](_0x1c327a)[_0xabaf('0x21')](function(_0x18652c){_0x2fdc98['count']=_0x18652c;if(_0x53b6c8[_0xabaf('0x2e')][_0xabaf('0x3d')]){_0x164d57['include']=[{'all':!![]}];}return db[_0xabaf('0x28')][_0xabaf('0x3e')](_0x164d57);})[_0xabaf('0x21')](function(_0x46773b){_0x2fdc98[_0xabaf('0x3f')]=_0x46773b;return _0x2fdc98;})[_0xabaf('0x21')](respondWithFilteredResult(_0x3213f8,_0x164d57))[_0xabaf('0x40')](handleError(_0x3213f8,null));};exports[_0xabaf('0x41')]=function(_0x56a6a2,_0x4c3cfc){var _0x42878d={'raw':!![],'where':{'id':_0x56a6a2[_0xabaf('0x42')]['id']}},_0x1ace58={};_0x1ace58['model']=_['keys'](db[_0xabaf('0x28')][_0xabaf('0x29')]);_0x1ace58[_0xabaf('0x2e')]=_[_0xabaf('0x43')](_0x56a6a2[_0xabaf('0x2e')]);_0x1ace58[_0xabaf('0x2f')]=_['intersection'](_0x1ace58[_0xabaf('0x2d')],_0x1ace58[_0xabaf('0x2e')]);_0x42878d['attributes']=_[_0xabaf('0x30')](_0x1ace58[_0xabaf('0x2d')],qs[_0xabaf('0x32')](_0x56a6a2[_0xabaf('0x2e')][_0xabaf('0x32')]));_0x42878d['attributes']=_0x42878d['attributes'][_0xabaf('0x33')]?_0x42878d['attributes']:_0x1ace58[_0xabaf('0x2d')];if(_0x56a6a2[_0xabaf('0x2e')][_0xabaf('0x3d')]){_0x42878d[_0xabaf('0x44')]=[{'all':!![]}];}_0x42878d=_[_0xabaf('0x45')]({},_0x42878d,_0x56a6a2[_0xabaf('0x3c')]);return db[_0xabaf('0x28')][_0xabaf('0x46')](_0x42878d)[_0xabaf('0x21')](handleEntityNotFound(_0x4c3cfc,null))['then'](respondWithResult(_0x4c3cfc,null))[_0xabaf('0x40')](handleError(_0x4c3cfc,null));};exports[_0xabaf('0x47')]=function(_0x899830,_0x18e35f){return db[_0xabaf('0x28')][_0xabaf('0x47')](_0x899830[_0xabaf('0x48')],{})['then'](function(_0x51927f){var _0x2ddab5=_0x899830[_0xabaf('0x49')][_0xabaf('0x4a')]({'plain':!![]});if(!_0x2ddab5)throw new Error(_0xabaf('0x4b'));if(_0x2ddab5[_0xabaf('0x4c')]===_0xabaf('0x49')){var _0xf07970=_0x51927f['get']({'plain':!![]});var _0x49cee8=_0xabaf('0x22');return db[_0xabaf('0x4d')][_0xabaf('0x46')]({'where':{'name':_0x49cee8,'userProfileId':_0x2ddab5[_0xabaf('0x4e')]},'raw':!![]})['then'](function(_0x3d1fa7){if(_0x3d1fa7&&_0x3d1fa7['autoAssociation']===0x0){return db['UserProfileResource'][_0xabaf('0x47')]({'name':_0xf07970[_0xabaf('0x24')],'resourceId':_0xf07970['id'],'type':_0x3d1fa7[_0xabaf('0x24')],'sectionId':_0x3d1fa7['id']},{})[_0xabaf('0x21')](function(){return _0x51927f;});}else{return _0x51927f;}})[_0xabaf('0x40')](function(_0x4da7a6){logger[_0xabaf('0x4f')](_0xabaf('0x50'),_0x4da7a6);throw _0x4da7a6;});}return _0x51927f;})[_0xabaf('0x21')](respondWithResult(_0x18e35f,0xc9))[_0xabaf('0x40')](handleError(_0x18e35f,null));};exports['update']=function(_0x8743cc,_0x3214d5){if(_0x8743cc[_0xabaf('0x48')]['id']){delete _0x8743cc[_0xabaf('0x48')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x8743cc[_0xabaf('0x42')]['id']}})[_0xabaf('0x21')](handleEntityNotFound(_0x3214d5,null))[_0xabaf('0x21')](saveUpdates(_0x8743cc[_0xabaf('0x48')],null))[_0xabaf('0x21')](respondWithResult(_0x3214d5,null))['catch'](handleError(_0x3214d5,null));};exports[_0xabaf('0x20')]=function(_0x3ab99c,_0x235695){return db[_0xabaf('0x28')]['find']({'where':{'id':_0x3ab99c[_0xabaf('0x42')]['id']}})[_0xabaf('0x21')](handleEntityNotFound(_0x235695,null))[_0xabaf('0x21')](removeEntity(_0x235695,null))[_0xabaf('0x40')](handleError(_0x235695,null));};exports['test']=function(_0x54c513,_0x53f50a,_0x3e7a0f){var _0x4ebb73;return db[_0xabaf('0x28')][_0xabaf('0x46')]({'where':{'id':_0x54c513[_0xabaf('0x42')]['id']},'attributes':['id',_0xabaf('0x51')]})['then'](handleEntityNotFound(_0x53f50a,null))[_0xabaf('0x21')](function(_0x546d8e){if(_0x546d8e){var _0x1ce552=require(_0xabaf('0x52'))();_0x1ce552['openSync'](_0x546d8e[_0xabaf('0x51')]);_0x1ce552[_0xabaf('0x53')]();return _0x546d8e;}})[_0xabaf('0x21')](respondWithResult(_0x53f50a,null))['catch'](handleError(_0x53f50a,null));}; \ No newline at end of file +var _0x355c=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','type','query','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','user','role','UserProfileSection','userProfileId'];(function(_0x631b39,_0x44f140){var _0x48f582=function(_0x19d4ef){while(--_0x19d4ef){_0x631b39['push'](_0x631b39['shift']());}};_0x48f582(++_0x44f140);}(_0x355c,0x1b0));var _0xc355=function(_0xbfc4e,_0x13bc54){_0xbfc4e=_0xbfc4e-0x0;var _0x5631ce=_0x355c[_0xbfc4e];return _0x5631ce;};'use strict';var pdf=require(_0xc355('0x0'));var emlformat=require(_0xc355('0x1'));var rimraf=require(_0xc355('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc355('0x3'));var rp=require(_0xc355('0x4'));var moment=require(_0xc355('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc355('0x6'));var util=require('util');var path=require(_0xc355('0x7'));var sox=require(_0xc355('0x8'));var csv=require(_0xc355('0x9'));var ejs=require(_0xc355('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc355('0xb'));var jsforce=require(_0xc355('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc355('0x9'));var querystring=require(_0xc355('0xd'));var Papa=require(_0xc355('0xe'));var Redis=require(_0xc355('0xf'));var authService=require(_0xc355('0x10'));var qs=require(_0xc355('0x11'));var as=require(_0xc355('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc355('0x13'))(_0xc355('0x14'));var utils=require(_0xc355('0x15'));var config=require(_0xc355('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc355('0x17'))['db'];function respondWithStatusCode(_0x1a4611,_0x213a4f){_0x213a4f=_0x213a4f||0xcc;return function(_0x43d6e4){if(_0x43d6e4){return _0x1a4611[_0xc355('0x18')](_0x213a4f);}return _0x1a4611[_0xc355('0x19')](_0x213a4f)[_0xc355('0x1a')]();};}function respondWithResult(_0x4ccb9f,_0xfeff7e){_0xfeff7e=_0xfeff7e||0xc8;return function(_0x478f13){if(_0x478f13){return _0x4ccb9f[_0xc355('0x19')](_0xfeff7e)[_0xc355('0x1b')](_0x478f13);}};}function respondWithFilteredResult(_0x3562e8,_0x1d7537){return function(_0x467bfd){if(_0x467bfd){var _0x1a3e92=_0x467bfd[_0xc355('0x1c')],_0x43ce92=_0x1d7537[_0xc355('0x1d')],_0x345db=_0x1d7537[_0xc355('0x1d')]+_0x1d7537['limit'],_0x57ffb1;if(_0x345db>=_0x1a3e92){_0x345db=_0x1a3e92;_0x57ffb1=0xc8;}else{_0x57ffb1=0xce;}_0x3562e8['status'](_0x57ffb1);return _0x3562e8['set'](_0xc355('0x1e'),_0x43ce92+'-'+_0x345db+'/'+_0x1a3e92)[_0xc355('0x1b')](_0x467bfd);}return null;};}function patchUpdates(_0x5accd8){return function(_0x47f149){try{jsonpatch[_0xc355('0x1f')](_0x47f149,_0x5accd8,!![]);}catch(_0x47991d){return BPromise[_0xc355('0x20')](_0x47991d);}return _0x47f149[_0xc355('0x21')]();};}function saveUpdates(_0x4ed7f4,_0x896ce6){return function(_0x21a314){if(_0x21a314){return _0x21a314[_0xc355('0x22')](_0x4ed7f4)[_0xc355('0x23')](function(_0x46f765){return _0x46f765;});}return null;};}function removeEntity(_0x53ea59,_0x2a7c4d){return function(_0x128f56){if(_0x128f56){return _0x128f56[_0xc355('0x24')]()['then'](function(){var _0xd5d634=_0x128f56[_0xc355('0x25')]({'plain':!![]});var _0x2e6399=_0xc355('0x26');return db[_0xc355('0x27')][_0xc355('0x24')]({'where':{'type':_0x2e6399,'resourceId':_0xd5d634['id']}})[_0xc355('0x23')](function(){return _0x128f56;});})['then'](function(){_0x53ea59[_0xc355('0x19')](0xcc)[_0xc355('0x1a')]();});}};}function handleEntityNotFound(_0x3d62fd,_0x45c62c){return function(_0x39d5ea){if(!_0x39d5ea){_0x3d62fd[_0xc355('0x18')](0x194);}return _0x39d5ea;};}function handleError(_0x2884a5,_0x5b7d46){_0x5b7d46=_0x5b7d46||0x1f4;return function(_0x340e88){logger['error'](_0x340e88[_0xc355('0x28')]);if(_0x340e88[_0xc355('0x29')]){delete _0x340e88['name'];}_0x2884a5['status'](_0x5b7d46)[_0xc355('0x2a')](_0x340e88);};}exports[_0xc355('0x2b')]=function(_0xb77eb1,_0x23b48f){var _0x356205={},_0x19ab97={},_0xcb6c0c={'count':0x0,'rows':[]};var _0x4baa95=_[_0xc355('0x2c')](db[_0xc355('0x2d')][_0xc355('0x2e')],function(_0x6dd16){return{'name':_0x6dd16['fieldName'],'type':_0x6dd16[_0xc355('0x2f')]['key']};});_0x19ab97['model']=_[_0xc355('0x2c')](_0x4baa95,_0xc355('0x29'));_0x19ab97['query']=_['keys'](_0xb77eb1[_0xc355('0x30')]);_0x19ab97['filters']=_[_0xc355('0x31')](_0x19ab97[_0xc355('0x32')],_0x19ab97['query']);_0x356205[_0xc355('0x33')]=_[_0xc355('0x31')](_0x19ab97[_0xc355('0x32')],qs['fields'](_0xb77eb1[_0xc355('0x30')]['fields']));_0x356205['attributes']=_0x356205['attributes'][_0xc355('0x34')]?_0x356205[_0xc355('0x33')]:_0x19ab97[_0xc355('0x32')];if(!_0xb77eb1[_0xc355('0x30')][_0xc355('0x35')](_0xc355('0x36'))){_0x356205[_0xc355('0x37')]=qs[_0xc355('0x37')](_0xb77eb1[_0xc355('0x30')]['limit']);_0x356205[_0xc355('0x1d')]=qs[_0xc355('0x1d')](_0xb77eb1[_0xc355('0x30')][_0xc355('0x1d')]);}_0x356205[_0xc355('0x38')]=qs[_0xc355('0x39')](_0xb77eb1[_0xc355('0x30')]['sort']);_0x356205[_0xc355('0x3a')]=qs[_0xc355('0x3b')](_[_0xc355('0x3c')](_0xb77eb1[_0xc355('0x30')],_0x19ab97[_0xc355('0x3b')]),_0x4baa95);if(_0xb77eb1[_0xc355('0x30')]['filter']){_0x356205[_0xc355('0x3a')]=_['merge'](_0x356205[_0xc355('0x3a')],{'$or':_[_0xc355('0x2c')](_0x4baa95,function(_0x3d6aee){if(_0x3d6aee[_0xc355('0x2f')]!==_0xc355('0x3d')){var _0x566435={};_0x566435[_0x3d6aee['name']]={'$like':'%'+_0xb77eb1[_0xc355('0x30')]['filter']+'%'};return _0x566435;}})});}_0x356205=_[_0xc355('0x3e')]({},_0x356205,_0xb77eb1[_0xc355('0x3f')]);var _0x224631={'where':_0x356205[_0xc355('0x3a')]};return db[_0xc355('0x2d')][_0xc355('0x1c')](_0x224631)[_0xc355('0x23')](function(_0x43d1e0){_0xcb6c0c[_0xc355('0x1c')]=_0x43d1e0;if(_0xb77eb1[_0xc355('0x30')][_0xc355('0x40')]){_0x356205[_0xc355('0x41')]=[{'all':!![]}];}return db[_0xc355('0x2d')][_0xc355('0x42')](_0x356205);})[_0xc355('0x23')](function(_0x1a130c){_0xcb6c0c[_0xc355('0x43')]=_0x1a130c;return _0xcb6c0c;})['then'](respondWithFilteredResult(_0x23b48f,_0x356205))[_0xc355('0x44')](handleError(_0x23b48f,null));};exports['show']=function(_0x4ee49b,_0x100919){var _0x3c7294={'raw':!![],'where':{'id':_0x4ee49b[_0xc355('0x45')]['id']}},_0x203c8f={};_0x203c8f['model']=_[_0xc355('0x46')](db[_0xc355('0x2d')][_0xc355('0x2e')]);_0x203c8f[_0xc355('0x30')]=_[_0xc355('0x46')](_0x4ee49b[_0xc355('0x30')]);_0x203c8f[_0xc355('0x3b')]=_['intersection'](_0x203c8f[_0xc355('0x32')],_0x203c8f[_0xc355('0x30')]);_0x3c7294[_0xc355('0x33')]=_['intersection'](_0x203c8f[_0xc355('0x32')],qs[_0xc355('0x47')](_0x4ee49b[_0xc355('0x30')][_0xc355('0x47')]));_0x3c7294[_0xc355('0x33')]=_0x3c7294[_0xc355('0x33')]['length']?_0x3c7294[_0xc355('0x33')]:_0x203c8f[_0xc355('0x32')];if(_0x4ee49b[_0xc355('0x30')]['includeAll']){_0x3c7294[_0xc355('0x41')]=[{'all':!![]}];}_0x3c7294=_[_0xc355('0x3e')]({},_0x3c7294,_0x4ee49b[_0xc355('0x3f')]);return db[_0xc355('0x2d')][_0xc355('0x48')](_0x3c7294)[_0xc355('0x23')](handleEntityNotFound(_0x100919,null))[_0xc355('0x23')](respondWithResult(_0x100919,null))['catch'](handleError(_0x100919,null));};exports[_0xc355('0x49')]=function(_0x538e31,_0x10afda){return db[_0xc355('0x2d')][_0xc355('0x49')](_0x538e31['body'],{})[_0xc355('0x23')](function(_0x31d431){var _0x18ee08=_0x538e31[_0xc355('0x4a')][_0xc355('0x25')]({'plain':!![]});if(!_0x18ee08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18ee08[_0xc355('0x4b')]==='user'){var _0x2f9947=_0x31d431[_0xc355('0x25')]({'plain':!![]});var _0xa42e4f='ODBC';return db[_0xc355('0x4c')][_0xc355('0x48')]({'where':{'name':_0xa42e4f,'userProfileId':_0x18ee08[_0xc355('0x4d')]},'raw':!![]})[_0xc355('0x23')](function(_0x19558c){if(_0x19558c&&_0x19558c['autoAssociation']===0x0){return db[_0xc355('0x27')]['create']({'name':_0x2f9947['name'],'resourceId':_0x2f9947['id'],'type':_0x19558c[_0xc355('0x29')],'sectionId':_0x19558c['id']},{})['then'](function(){return _0x31d431;});}else{return _0x31d431;}})[_0xc355('0x44')](function(_0x3c47f7){logger[_0xc355('0x4e')](_0xc355('0x4f'),_0x3c47f7);throw _0x3c47f7;});}return _0x31d431;})[_0xc355('0x23')](respondWithResult(_0x10afda,0xc9))[_0xc355('0x44')](handleError(_0x10afda,null));};exports[_0xc355('0x22')]=function(_0x235e01,_0x38e1c9){if(_0x235e01[_0xc355('0x50')]['id']){delete _0x235e01[_0xc355('0x50')]['id'];}return db[_0xc355('0x2d')][_0xc355('0x48')]({'where':{'id':_0x235e01[_0xc355('0x45')]['id']}})[_0xc355('0x23')](handleEntityNotFound(_0x38e1c9,null))[_0xc355('0x23')](saveUpdates(_0x235e01[_0xc355('0x50')],null))[_0xc355('0x23')](respondWithResult(_0x38e1c9,null))[_0xc355('0x44')](handleError(_0x38e1c9,null));};exports['destroy']=function(_0x2ef64c,_0x3f3eff){return db[_0xc355('0x2d')][_0xc355('0x48')]({'where':{'id':_0x2ef64c[_0xc355('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f3eff,null))[_0xc355('0x23')](removeEntity(_0x3f3eff,null))[_0xc355('0x44')](handleError(_0x3f3eff,null));};exports['test']=function(_0x26e1e9,_0x30e083,_0x4cfda8){var _0x531b08;return db[_0xc355('0x2d')][_0xc355('0x48')]({'where':{'id':_0x26e1e9[_0xc355('0x45')]['id']},'attributes':['id',_0xc355('0x51')]})['then'](handleEntityNotFound(_0x30e083,null))[_0xc355('0x23')](function(_0xfac48a){if(_0xfac48a){var _0x49e822=require(_0xc355('0x52'))();_0x49e822[_0xc355('0x53')](_0xfac48a[_0xc355('0x51')]);_0x49e822[_0xc355('0x54')]();return _0xfac48a;}})['then'](respondWithResult(_0x30e083,null))[_0xc355('0x44')](handleError(_0x30e083,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9963136..7e5a604 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 _0x2489=['square_odbc','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x2489,0xf1));var _0x9248=function(_0x419980,_0x1e0684){_0x419980=_0x419980-0x0;var _0x1002bd=_0x2489[_0x419980];return _0x1002bd;};'use strict';var _=require(_0x9248('0x0'));var util=require('util');var logger=require(_0x9248('0x1'))('api');var moment=require(_0x9248('0x2'));var BPromise=require(_0x9248('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9248('0x4'));var rimraf=require(_0x9248('0x5'));var config=require(_0x9248('0x6'));var attributes=require(_0x9248('0x7'));module['exports']=function(_0x3d2811,_0x4a2146){return _0x3d2811['define'](_0x9248('0x8'),attributes,{'tableName':_0x9248('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90f8=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x90f8,0x151));var _0x890f=function(_0x59a05e,_0x4e84a4){_0x59a05e=_0x59a05e-0x0;var _0x490198=_0x90f8[_0x59a05e];return _0x490198;};'use strict';var _=require(_0x890f('0x0'));var util=require(_0x890f('0x1'));var logger=require(_0x890f('0x2'))(_0x890f('0x3'));var moment=require(_0x890f('0x4'));var BPromise=require(_0x890f('0x5'));var rp=require(_0x890f('0x6'));var fs=require('fs');var path=require(_0x890f('0x7'));var rimraf=require('rimraf');var config=require(_0x890f('0x8'));var attributes=require(_0x890f('0x9'));module[_0x890f('0xa')]=function(_0x1f7655,_0x21836f){return _0x1f7655[_0x890f('0xb')](_0x890f('0xc'),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 2729db3..51e8ba9 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x7eaa31,_0x247a55){var _0x3b5d2e=function(_0x1ebdcc){while(--_0x1ebdcc){_0x7eaa31['push'](_0x7eaa31['shift']());}};_0x3b5d2e(++_0x247a55);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['SquareOdbc'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x520cb2,_0xdab1aa){var _0x307bd9=function(_0x3b2ba1){while(--_0x3b2ba1){_0x520cb2['push'](_0x520cb2['shift']());}};_0x307bd9(++_0xdab1aa);}(_0x008c,0x188));var _0xc008=function(_0x26c26c,_0x39f9cf){_0x26c26c=_0x26c26c-0x0;var _0x153b04=_0x008c[_0x26c26c];return _0x153b04;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 00f07a5..b18eb95 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 _0x2f4f=['isAuthenticated','index','/:id','show','/:id/users','create','post','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x191dff,_0xb60d16){var _0x410a43=function(_0x25ccdc){while(--_0x25ccdc){_0x191dff['push'](_0x191dff['shift']());}};_0x410a43(++_0xb60d16);}(_0x2f4f,0x1db));var _0xf2f4=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0x2f4f[_0x5a5276];return _0x3e8ee2;};'use strict';var multer=require(_0xf2f4('0x0'));var util=require(_0xf2f4('0x1'));var path=require(_0xf2f4('0x2'));var timeout=require(_0xf2f4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf2f4('0x4'));var config=require(_0xf2f4('0x5'));var controller=require(_0xf2f4('0x6'));router[_0xf2f4('0x7')]('/',auth[_0xf2f4('0x8')](),controller[_0xf2f4('0x9')]);router[_0xf2f4('0x7')](_0xf2f4('0xa'),auth[_0xf2f4('0x8')](),controller[_0xf2f4('0xb')]);router[_0xf2f4('0x7')](_0xf2f4('0xc'),auth[_0xf2f4('0x8')](),controller['getUsers']);router['post']('/',auth[_0xf2f4('0x8')](),controller[_0xf2f4('0xd')]);router[_0xf2f4('0xe')](_0xf2f4('0xc'),auth['isAuthenticated'](),controller[_0xf2f4('0xf')]);router[_0xf2f4('0x10')](_0xf2f4('0xa'),auth[_0xf2f4('0x8')](),controller['update']);router[_0xf2f4('0x11')]('/:id',auth[_0xf2f4('0x8')](),controller[_0xf2f4('0x12')]);router[_0xf2f4('0x11')](_0xf2f4('0xc'),auth['isAuthenticated'](),controller[_0xf2f4('0x13')]);module[_0xf2f4('0x14')]=router; \ No newline at end of file +var _0x4cac=['create','addUsers','update','delete','destroy','removeUsers','exports','express','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/users','getUsers'];(function(_0x520ad5,_0x5a0899){var _0x2bd5e1=function(_0x30d953){while(--_0x30d953){_0x520ad5['push'](_0x520ad5['shift']());}};_0x2bd5e1(++_0x5a0899);}(_0x4cac,0x9d));var _0xc4ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4cac[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4ca('0x0'));var router=express['Router']();var auth=require(_0xc4ca('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xc4ca('0x2')]('/',auth[_0xc4ca('0x3')](),controller['index']);router[_0xc4ca('0x2')](_0xc4ca('0x4'),auth['isAuthenticated'](),controller[_0xc4ca('0x5')]);router['get'](_0xc4ca('0x6'),auth[_0xc4ca('0x3')](),controller[_0xc4ca('0x7')]);router['post']('/',auth[_0xc4ca('0x3')](),controller[_0xc4ca('0x8')]);router['post'](_0xc4ca('0x6'),auth[_0xc4ca('0x3')](),controller[_0xc4ca('0x9')]);router['put'](_0xc4ca('0x4'),auth[_0xc4ca('0x3')](),controller[_0xc4ca('0xa')]);router[_0xc4ca('0xb')](_0xc4ca('0x4'),auth[_0xc4ca('0x3')](),controller[_0xc4ca('0xc')]);router['delete'](_0xc4ca('0x6'),auth[_0xc4ca('0x3')](),controller[_0xc4ca('0xd')]);module[_0xc4ca('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d53ae6a..bfdcb43 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 _0x858c=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','STRING','name','TEXT','BLOB','long'];(function(_0x42172e,_0x110926){var _0x5e3344=function(_0x1b904f){while(--_0x1b904f){_0x42172e['push'](_0x42172e['shift']());}};_0x5e3344(++_0x110926);}(_0x858c,0x96));var _0xc858=function(_0x14839d,_0x59a232){_0x14839d=_0x14839d-0x0;var _0x250b77=_0x858c[_0x14839d];return _0x250b77;};'use strict';var Sequelize=require(_0xc858('0x0'));module['exports']={'name':{'type':Sequelize[_0xc858('0x1')],'unique':_0xc858('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc858('0x1')]},'notes':{'type':Sequelize[_0xc858('0x3')]},'preproduction':{'type':Sequelize[_0xc858('0x4')](_0xc858('0x5')),'get':function(){if(this[_0xc858('0x6')](_0xc858('0x7'))){return this['getDataValue']('preproduction')[_0xc858('0x8')](_0xc858('0x9'));}}},'production':{'type':Sequelize[_0xc858('0x4')](_0xc858('0x5')),'get':function(){if(this['getDataValue'](_0xc858('0xa'))){return this[_0xc858('0x6')](_0xc858('0xa'))[_0xc858('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0xc858('0xb')]},'publishedAt':{'type':Sequelize[_0xc858('0xb')]}}; \ No newline at end of file +var _0x9b37=['BLOB','production','DATE','sequelize','exports','STRING','long','getDataValue','preproduction','toString','utf8'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9b37,0x184));var _0x79b3=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x9b37[_0x548627];return _0x844a84;};'use strict';var Sequelize=require(_0x79b3('0x0'));module[_0x79b3('0x1')]={'name':{'type':Sequelize[_0x79b3('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x79b3('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x79b3('0x3')),'get':function(){if(this[_0x79b3('0x4')](_0x79b3('0x5'))){return this[_0x79b3('0x4')](_0x79b3('0x5'))[_0x79b3('0x6')](_0x79b3('0x7'));}}},'production':{'type':Sequelize[_0x79b3('0x8')]('long'),'get':function(){if(this[_0x79b3('0x4')]('production')){return this[_0x79b3('0x4')](_0x79b3('0x9'))['toString'](_0x79b3('0x7'));}}},'savedAt':{'type':Sequelize[_0x79b3('0xa')]},'publishedAt':{'type':Sequelize[_0x79b3('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 873db53..6e96e0c 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 _0x3cc1=['UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','where','getUsers','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','sendStatus','name','send','index','map','SquareProject','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x3cc1,0x199));var _0x13cc=function(_0x137f49,_0xb32f69){_0x137f49=_0x137f49-0x0;var _0x37e612=_0x3cc1[_0x137f49];return _0x37e612;};'use strict';var pdf=require(_0x13cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x13cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13cc('0x2'));var rp=require(_0x13cc('0x3'));var moment=require(_0x13cc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x13cc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x13cc('0x6'));var ejs=require(_0x13cc('0x7'));var fs=require('fs');var _=require(_0x13cc('0x8'));var squel=require(_0x13cc('0x9'));var crypto=require(_0x13cc('0xa'));var jsforce=require(_0x13cc('0xb'));var deskjs=require(_0x13cc('0xc'));var toCsv=require(_0x13cc('0x6'));var querystring=require('querystring');var Papa=require(_0x13cc('0xd'));var Redis=require(_0x13cc('0xe'));var authService=require(_0x13cc('0xf'));var qs=require(_0x13cc('0x10'));var as=require(_0x13cc('0x11'));var hardwareService=require(_0x13cc('0x12'));var logger=require(_0x13cc('0x13'))(_0x13cc('0x14'));var utils=require(_0x13cc('0x15'));var config=require(_0x13cc('0x16'));var licenseUtil=require(_0x13cc('0x17'));var db=require(_0x13cc('0x18'))['db'];config[_0x13cc('0x19')]=_[_0x13cc('0x1a')](config[_0x13cc('0x19')],{'host':_0x13cc('0x1b'),'port':0x18eb});var socket=require(_0x13cc('0x1c'))(new Redis(config[_0x13cc('0x19')]));require(_0x13cc('0x1d'))['register'](socket);function respondWithStatusCode(_0x1cb804,_0x41c83d){_0x41c83d=_0x41c83d||0xcc;return function(_0x419828){if(_0x419828){return _0x1cb804['sendStatus'](_0x41c83d);}return _0x1cb804['status'](_0x41c83d)[_0x13cc('0x1e')]();};}function respondWithResult(_0x43910c,_0x1a0844){_0x1a0844=_0x1a0844||0xc8;return function(_0x33e2ec){if(_0x33e2ec){return _0x43910c[_0x13cc('0x1f')](_0x1a0844)[_0x13cc('0x20')](_0x33e2ec);}};}function respondWithFilteredResult(_0x4c660d,_0x4db160){return function(_0x2c33f0){if(_0x2c33f0){var _0x17ec01=_0x2c33f0[_0x13cc('0x21')],_0x1f4bc6=_0x4db160['offset'],_0x35cb28=_0x4db160[_0x13cc('0x22')]+_0x4db160['limit'],_0x26c270;if(_0x35cb28>=_0x17ec01){_0x35cb28=_0x17ec01;_0x26c270=0xc8;}else{_0x26c270=0xce;}_0x4c660d[_0x13cc('0x1f')](_0x26c270);return _0x4c660d[_0x13cc('0x23')](_0x13cc('0x24'),_0x1f4bc6+'-'+_0x35cb28+'/'+_0x17ec01)['json'](_0x2c33f0);}return null;};}function patchUpdates(_0x3de62b){return function(_0x3c8d78){try{jsonpatch[_0x13cc('0x25')](_0x3c8d78,_0x3de62b,!![]);}catch(_0x371f6b){return BPromise[_0x13cc('0x26')](_0x371f6b);}return _0x3c8d78[_0x13cc('0x27')]();};}function saveUpdates(_0x40d861,_0x11b62c){return function(_0x2dc10c){if(_0x2dc10c){return _0x2dc10c[_0x13cc('0x28')](_0x40d861)['then'](function(_0xd806a0){return _0xd806a0;});}return null;};}function removeEntity(_0x104ed7,_0x1014e3){return function(_0x23d6a6){if(_0x23d6a6){return _0x23d6a6[_0x13cc('0x29')]()['then'](function(){var _0x274091=_0x23d6a6['get']({'plain':!![]});var _0x5ecf6b='SquareProjects';return db[_0x13cc('0x2a')][_0x13cc('0x29')]({'where':{'type':_0x5ecf6b,'resourceId':_0x274091['id']}})[_0x13cc('0x2b')](function(){return _0x23d6a6;});})[_0x13cc('0x2b')](function(){_0x104ed7[_0x13cc('0x1f')](0xcc)[_0x13cc('0x1e')]();});}};}function handleEntityNotFound(_0x15a5f8,_0x476ff9){return function(_0x2fac62){if(!_0x2fac62){_0x15a5f8[_0x13cc('0x2c')](0x194);}return _0x2fac62;};}function handleError(_0x12585e,_0x27d23e){_0x27d23e=_0x27d23e||0x1f4;return function(_0x5c9f08){logger['error'](_0x5c9f08['stack']);if(_0x5c9f08[_0x13cc('0x2d')]){delete _0x5c9f08[_0x13cc('0x2d')];}_0x12585e[_0x13cc('0x1f')](_0x27d23e)[_0x13cc('0x2e')](_0x5c9f08);};}exports[_0x13cc('0x2f')]=function(_0x556553,_0x400719){var _0x47c4cb={},_0x313843={},_0x1dbccf={'count':0x0,'rows':[]};var _0x287964=_[_0x13cc('0x30')](db[_0x13cc('0x31')][_0x13cc('0x32')],function(_0x3a008b){return{'name':_0x3a008b['fieldName'],'type':_0x3a008b[_0x13cc('0x33')][_0x13cc('0x34')]};});_0x313843[_0x13cc('0x35')]=_[_0x13cc('0x30')](_0x287964,_0x13cc('0x2d'));_0x313843['query']=_[_0x13cc('0x36')](_0x556553[_0x13cc('0x37')]);_0x313843['filters']=_[_0x13cc('0x38')](_0x313843[_0x13cc('0x35')],_0x313843[_0x13cc('0x37')]);_0x47c4cb[_0x13cc('0x39')]=_['intersection'](_0x313843[_0x13cc('0x35')],qs[_0x13cc('0x3a')](_0x556553[_0x13cc('0x37')]['fields']));_0x47c4cb[_0x13cc('0x39')]=_0x47c4cb['attributes'][_0x13cc('0x3b')]?_0x47c4cb['attributes']:_0x313843[_0x13cc('0x35')];if(!_0x556553['query'][_0x13cc('0x3c')]('nolimit')){_0x47c4cb['limit']=qs[_0x13cc('0x3d')](_0x556553['query']['limit']);_0x47c4cb[_0x13cc('0x22')]=qs['offset'](_0x556553['query']['offset']);}_0x47c4cb[_0x13cc('0x3e')]=qs['sort'](_0x556553[_0x13cc('0x37')][_0x13cc('0x3f')]);_0x47c4cb['where']=qs[_0x13cc('0x40')](_[_0x13cc('0x41')](_0x556553[_0x13cc('0x37')],_0x313843[_0x13cc('0x40')]),_0x287964);if(_0x556553[_0x13cc('0x37')][_0x13cc('0x42')]){_0x47c4cb['where']=_[_0x13cc('0x43')](_0x47c4cb['where'],{'$or':_[_0x13cc('0x30')](_0x287964,function(_0x5d5871){if(_0x5d5871['type']!=='VIRTUAL'){var _0x4093f0={};_0x4093f0[_0x5d5871[_0x13cc('0x2d')]]={'$like':'%'+_0x556553[_0x13cc('0x37')]['filter']+'%'};return _0x4093f0;}})});}_0x47c4cb=_[_0x13cc('0x43')]({},_0x47c4cb,_0x556553[_0x13cc('0x44')]);var _0x2b60fd={'where':_0x47c4cb['where']};return db[_0x13cc('0x31')][_0x13cc('0x21')](_0x2b60fd)[_0x13cc('0x2b')](function(_0x50c9f9){_0x1dbccf[_0x13cc('0x21')]=_0x50c9f9;if(_0x556553['query'][_0x13cc('0x45')]){_0x47c4cb[_0x13cc('0x46')]=[{'all':!![]}];}return db[_0x13cc('0x31')]['findAll'](_0x47c4cb);})[_0x13cc('0x2b')](function(_0x535708){_0x1dbccf[_0x13cc('0x47')]=_0x535708;return _0x1dbccf;})[_0x13cc('0x2b')](respondWithFilteredResult(_0x400719,_0x47c4cb))[_0x13cc('0x48')](handleError(_0x400719,null));};exports[_0x13cc('0x49')]=function(_0x57eda9,_0x5a2a1d){var _0x45664c={'raw':![],'where':{'id':_0x57eda9[_0x13cc('0x4a')]['id']}},_0x5e843f={};_0x5e843f[_0x13cc('0x35')]=_['keys'](db[_0x13cc('0x31')][_0x13cc('0x32')]);_0x5e843f[_0x13cc('0x37')]=_[_0x13cc('0x36')](_0x57eda9[_0x13cc('0x37')]);_0x5e843f['filters']=_['intersection'](_0x5e843f[_0x13cc('0x35')],_0x5e843f['query']);_0x45664c[_0x13cc('0x39')]=_['intersection'](_0x5e843f[_0x13cc('0x35')],qs['fields'](_0x57eda9['query']['fields']));_0x45664c[_0x13cc('0x39')]=_0x45664c[_0x13cc('0x39')][_0x13cc('0x3b')]?_0x45664c[_0x13cc('0x39')]:_0x5e843f[_0x13cc('0x35')];if(_0x57eda9[_0x13cc('0x37')][_0x13cc('0x45')]){_0x45664c[_0x13cc('0x46')]=[{'all':!![]}];}_0x45664c=_[_0x13cc('0x43')]({},_0x45664c,_0x57eda9[_0x13cc('0x44')]);return db[_0x13cc('0x31')][_0x13cc('0x4b')](_0x45664c)[_0x13cc('0x2b')](handleEntityNotFound(_0x5a2a1d,null))[_0x13cc('0x2b')](respondWithResult(_0x5a2a1d,null))[_0x13cc('0x48')](handleError(_0x5a2a1d,null));};exports['create']=function(_0x2b6902,_0x59a92d){return db[_0x13cc('0x31')][_0x13cc('0x4c')](_0x2b6902[_0x13cc('0x4d')],{})[_0x13cc('0x2b')](function(_0x5112b8){var _0x15c0f1=_0x2b6902[_0x13cc('0x4e')][_0x13cc('0x4f')]({'plain':!![]});if(!_0x15c0f1)throw new Error(_0x13cc('0x50'));if(_0x15c0f1['role']===_0x13cc('0x4e')){var _0x44c238=_0x5112b8[_0x13cc('0x4f')]({'plain':!![]});var _0x309449='SquareProjects';return db[_0x13cc('0x51')]['find']({'where':{'name':_0x309449,'userProfileId':_0x15c0f1[_0x13cc('0x52')]},'raw':!![]})[_0x13cc('0x2b')](function(_0x5288b2){if(_0x5288b2&&_0x5288b2[_0x13cc('0x53')]===0x0){return db[_0x13cc('0x2a')][_0x13cc('0x4c')]({'name':_0x44c238['name'],'resourceId':_0x44c238['id'],'type':_0x5288b2['name'],'sectionId':_0x5288b2['id']},{})[_0x13cc('0x2b')](function(){return _0x5112b8;});}else{return _0x5112b8;}})[_0x13cc('0x48')](function(_0x2afa34){logger[_0x13cc('0x54')](_0x13cc('0x55'),_0x2afa34);throw _0x2afa34;});}return _0x5112b8;})['then'](respondWithResult(_0x59a92d,0xc9))['catch'](handleError(_0x59a92d,null));};exports[_0x13cc('0x28')]=function(_0x3d260d,_0x1389c7){if(_0x3d260d[_0x13cc('0x4d')]['id']){delete _0x3d260d[_0x13cc('0x4d')]['id'];}return db['SquareProject'][_0x13cc('0x4b')]({'where':{'id':_0x3d260d[_0x13cc('0x4a')]['id']}})[_0x13cc('0x2b')](handleEntityNotFound(_0x1389c7,null))[_0x13cc('0x2b')](saveUpdates(_0x3d260d[_0x13cc('0x4d')],null))[_0x13cc('0x2b')](respondWithResult(_0x1389c7,null))[_0x13cc('0x48')](handleError(_0x1389c7,null));};exports['destroy']=function(_0x3ef8a0,_0x59d053){return db[_0x13cc('0x31')]['find']({'where':{'id':_0x3ef8a0[_0x13cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x59d053,null))[_0x13cc('0x2b')](removeEntity(_0x59d053,null))[_0x13cc('0x48')](handleError(_0x59d053,null));};exports['addUsers']=function(_0x11e8cb,_0x1c046d,_0xb7811f){return db[_0x13cc('0x31')]['find']({'where':{'id':_0x11e8cb[_0x13cc('0x4a')]['id']}})[_0x13cc('0x2b')](handleEntityNotFound(_0x1c046d,null))[_0x13cc('0x2b')](function(_0x2541a0){if(_0x2541a0){return _0x2541a0[_0x13cc('0x56')](_0x11e8cb[_0x13cc('0x4d')][_0x13cc('0x57')],_[_0x13cc('0x58')](_0x11e8cb[_0x13cc('0x4d')],['ids','id'])||{});}})[_0x13cc('0x2b')](respondWithResult(_0x1c046d,null))[_0x13cc('0x48')](handleError(_0x1c046d,null));};exports[_0x13cc('0x59')]=function(_0x105333,_0x3d564f,_0x144fe6){return db[_0x13cc('0x31')][_0x13cc('0x4b')]({'where':{'id':_0x105333[_0x13cc('0x4a')]['id']}})[_0x13cc('0x2b')](handleEntityNotFound(_0x3d564f,null))[_0x13cc('0x2b')](function(_0x15dd4e){if(_0x15dd4e){return _0x15dd4e[_0x13cc('0x59')](_0x105333[_0x13cc('0x37')][_0x13cc('0x57')])[_0x13cc('0x2b')](function(){if(_[_0x13cc('0x5a')](_0x105333['query'][_0x13cc('0x57')])){for(var _0x289965=0x0;_0x289965<_0x105333['query'][_0x13cc('0x57')][_0x13cc('0x3b')];_0x289965+=0x1){socket[_0x13cc('0x5b')](_0x13cc('0x5c'),{'UserId':Number(_0x105333['query']['ids'][_0x289965]),'SquareProjectId':Number(_0x105333[_0x13cc('0x4a')]['id'])});}}else{socket[_0x13cc('0x5b')](_0x13cc('0x5c'),{'UserId':Number(_0x105333[_0x13cc('0x37')][_0x13cc('0x57')]),'SquareProjectId':Number(_0x105333[_0x13cc('0x4a')]['id'])});}});}})[_0x13cc('0x2b')](respondWithStatusCode(_0x3d564f,null))[_0x13cc('0x48')](handleError(_0x3d564f,null));};exports['getUsers']=function(_0x380a7a,_0x44a1b3,_0xa476ae){var _0x1da23a={};var _0x1f27ae={};var _0x30df75;var _0x21ffc2;return db[_0x13cc('0x31')][_0x13cc('0x5d')]({'where':{'id':_0x380a7a['params']['id']}})[_0x13cc('0x2b')](handleEntityNotFound(_0x44a1b3,null))[_0x13cc('0x2b')](function(_0x4b8143){if(_0x4b8143){_0x30df75=_0x4b8143;_0x1f27ae[_0x13cc('0x35')]=_[_0x13cc('0x36')](db[_0x13cc('0x5e')][_0x13cc('0x32')]);_0x1f27ae[_0x13cc('0x37')]=_[_0x13cc('0x36')](_0x380a7a[_0x13cc('0x37')]);_0x1f27ae[_0x13cc('0x40')]=_[_0x13cc('0x38')](_0x1f27ae[_0x13cc('0x35')],_0x1f27ae[_0x13cc('0x37')]);_0x1da23a[_0x13cc('0x39')]=_[_0x13cc('0x38')](_0x1f27ae[_0x13cc('0x35')],qs[_0x13cc('0x3a')](_0x380a7a[_0x13cc('0x37')]['fields']));_0x1da23a['attributes']=_0x1da23a[_0x13cc('0x39')][_0x13cc('0x3b')]?_0x1da23a[_0x13cc('0x39')]:_0x1f27ae['model'];_0x1da23a['order']=qs['sort'](_0x380a7a['query'][_0x13cc('0x3f')]);_0x1da23a[_0x13cc('0x5f')]=qs['filters'](_['pick'](_0x380a7a['query'],_0x1f27ae[_0x13cc('0x40')]));if(_0x380a7a['query'][_0x13cc('0x42')]){_0x1da23a[_0x13cc('0x5f')]=_[_0x13cc('0x43')](_0x1da23a[_0x13cc('0x5f')],{'$or':_[_0x13cc('0x30')](_0x1da23a['attributes'],function(_0x4250c3){var _0x2be939={};_0x2be939[_0x4250c3]={'$like':'%'+_0x380a7a[_0x13cc('0x37')][_0x13cc('0x42')]+'%'};return _0x2be939;})});}_0x1da23a=_[_0x13cc('0x43')]({},_0x1da23a,_0x380a7a[_0x13cc('0x44')]);return _0x30df75[_0x13cc('0x60')](_0x1da23a);}})[_0x13cc('0x2b')](function(_0x32ae2e){if(_0x32ae2e){_0x21ffc2=_0x32ae2e[_0x13cc('0x3b')];if(!_0x380a7a[_0x13cc('0x37')][_0x13cc('0x3c')](_0x13cc('0x61'))){_0x1da23a['limit']=qs[_0x13cc('0x3d')](_0x380a7a[_0x13cc('0x37')][_0x13cc('0x3d')]);_0x1da23a[_0x13cc('0x22')]=qs[_0x13cc('0x22')](_0x380a7a[_0x13cc('0x37')][_0x13cc('0x22')]);}return _0x30df75[_0x13cc('0x60')](_0x1da23a);}})[_0x13cc('0x2b')](function(_0x535360){if(_0x535360){return _0x535360?{'count':_0x21ffc2,'rows':_0x535360}:null;}})[_0x13cc('0x2b')](respondWithResult(_0x44a1b3,null))[_0x13cc('0x48')](handleError(_0x44a1b3,null));}; \ No newline at end of file +var _0xdd87=['attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','body','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rawAttributes','rimraf','request-promise','moment','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','error','map','SquareProject','fieldName','type','key','model','name','query','keys','filters'];(function(_0xca9b83,_0x3fe0b6){var _0xd4c5a0=function(_0x49d53b){while(--_0x49d53b){_0xca9b83['push'](_0xca9b83['shift']());}};_0xd4c5a0(++_0x3fe0b6);}(_0xdd87,0x7f));var _0x7dd8=function(_0x128244,_0x11274f){_0x128244=_0x128244-0x0;var _0x5d8477=_0xdd87[_0x128244];return _0x5d8477;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7dd8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7dd8('0x1'));var moment=require(_0x7dd8('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7dd8('0x3'));var sox=require(_0x7dd8('0x4'));var csv=require('to-csv');var ejs=require(_0x7dd8('0x5'));var fs=require('fs');var _=require(_0x7dd8('0x6'));var squel=require(_0x7dd8('0x7'));var crypto=require(_0x7dd8('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7dd8('0x9'));var toCsv=require(_0x7dd8('0xa'));var querystring=require('querystring');var Papa=require(_0x7dd8('0xb'));var Redis=require('ioredis');var authService=require(_0x7dd8('0xc'));var qs=require(_0x7dd8('0xd'));var as=require(_0x7dd8('0xe'));var hardwareService=require(_0x7dd8('0xf'));var logger=require(_0x7dd8('0x10'))('api');var utils=require(_0x7dd8('0x11'));var config=require(_0x7dd8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7dd8('0x13'))['db'];config['redis']=_[_0x7dd8('0x14')](config[_0x7dd8('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dd8('0x16'))(new Redis(config[_0x7dd8('0x15')]));require(_0x7dd8('0x17'))[_0x7dd8('0x18')](socket);function respondWithStatusCode(_0x1c48fc,_0x105325){_0x105325=_0x105325||0xcc;return function(_0x2a3f54){if(_0x2a3f54){return _0x1c48fc[_0x7dd8('0x19')](_0x105325);}return _0x1c48fc[_0x7dd8('0x1a')](_0x105325)[_0x7dd8('0x1b')]();};}function respondWithResult(_0x5c299f,_0x2fedb3){_0x2fedb3=_0x2fedb3||0xc8;return function(_0x260454){if(_0x260454){return _0x5c299f[_0x7dd8('0x1a')](_0x2fedb3)[_0x7dd8('0x1c')](_0x260454);}};}function respondWithFilteredResult(_0x24f2e6,_0x54df1f){return function(_0x80ef39){if(_0x80ef39){var _0x492f84=_0x80ef39[_0x7dd8('0x1d')],_0x53a17e=_0x54df1f[_0x7dd8('0x1e')],_0x1b6354=_0x54df1f[_0x7dd8('0x1e')]+_0x54df1f[_0x7dd8('0x1f')],_0x460db1;if(_0x1b6354>=_0x492f84){_0x1b6354=_0x492f84;_0x460db1=0xc8;}else{_0x460db1=0xce;}_0x24f2e6[_0x7dd8('0x1a')](_0x460db1);return _0x24f2e6[_0x7dd8('0x20')]('Content-Range',_0x53a17e+'-'+_0x1b6354+'/'+_0x492f84)['json'](_0x80ef39);}return null;};}function patchUpdates(_0x3be3df){return function(_0x5060c4){try{jsonpatch[_0x7dd8('0x21')](_0x5060c4,_0x3be3df,!![]);}catch(_0x3a24f7){return BPromise[_0x7dd8('0x22')](_0x3a24f7);}return _0x5060c4[_0x7dd8('0x23')]();};}function saveUpdates(_0x580b72,_0x3d0f0f){return function(_0x17908c){if(_0x17908c){return _0x17908c[_0x7dd8('0x24')](_0x580b72)[_0x7dd8('0x25')](function(_0x5df1e8){return _0x5df1e8;});}return null;};}function removeEntity(_0x5741a8,_0x9afea3){return function(_0x28af74){if(_0x28af74){return _0x28af74['destroy']()[_0x7dd8('0x25')](function(){var _0x276dc1=_0x28af74[_0x7dd8('0x26')]({'plain':!![]});var _0x3e0f20=_0x7dd8('0x27');return db[_0x7dd8('0x28')][_0x7dd8('0x29')]({'where':{'type':_0x3e0f20,'resourceId':_0x276dc1['id']}})[_0x7dd8('0x25')](function(){return _0x28af74;});})[_0x7dd8('0x25')](function(){_0x5741a8[_0x7dd8('0x1a')](0xcc)[_0x7dd8('0x1b')]();});}};}function handleEntityNotFound(_0x2156d8,_0x46fc16){return function(_0x54287b){if(!_0x54287b){_0x2156d8[_0x7dd8('0x19')](0x194);}return _0x54287b;};}function handleError(_0x37bc86,_0x568fc0){_0x568fc0=_0x568fc0||0x1f4;return function(_0x575802){logger[_0x7dd8('0x2a')](_0x575802['stack']);if(_0x575802['name']){delete _0x575802['name'];}_0x37bc86[_0x7dd8('0x1a')](_0x568fc0)['send'](_0x575802);};}exports['index']=function(_0x1af73e,_0x5d4297){var _0x486383={},_0x15aa32={},_0xd01f29={'count':0x0,'rows':[]};var _0x516c00=_[_0x7dd8('0x2b')](db[_0x7dd8('0x2c')]['rawAttributes'],function(_0x53c1bf){return{'name':_0x53c1bf[_0x7dd8('0x2d')],'type':_0x53c1bf[_0x7dd8('0x2e')][_0x7dd8('0x2f')]};});_0x15aa32[_0x7dd8('0x30')]=_[_0x7dd8('0x2b')](_0x516c00,_0x7dd8('0x31'));_0x15aa32[_0x7dd8('0x32')]=_[_0x7dd8('0x33')](_0x1af73e[_0x7dd8('0x32')]);_0x15aa32[_0x7dd8('0x34')]=_['intersection'](_0x15aa32['model'],_0x15aa32['query']);_0x486383[_0x7dd8('0x35')]=_[_0x7dd8('0x36')](_0x15aa32['model'],qs['fields'](_0x1af73e['query']['fields']));_0x486383['attributes']=_0x486383[_0x7dd8('0x35')][_0x7dd8('0x37')]?_0x486383[_0x7dd8('0x35')]:_0x15aa32['model'];if(!_0x1af73e[_0x7dd8('0x32')][_0x7dd8('0x38')](_0x7dd8('0x39'))){_0x486383['limit']=qs[_0x7dd8('0x1f')](_0x1af73e[_0x7dd8('0x32')][_0x7dd8('0x1f')]);_0x486383[_0x7dd8('0x1e')]=qs[_0x7dd8('0x1e')](_0x1af73e[_0x7dd8('0x32')][_0x7dd8('0x1e')]);}_0x486383[_0x7dd8('0x3a')]=qs[_0x7dd8('0x3b')](_0x1af73e['query'][_0x7dd8('0x3b')]);_0x486383[_0x7dd8('0x3c')]=qs[_0x7dd8('0x34')](_[_0x7dd8('0x3d')](_0x1af73e[_0x7dd8('0x32')],_0x15aa32[_0x7dd8('0x34')]),_0x516c00);if(_0x1af73e[_0x7dd8('0x32')][_0x7dd8('0x3e')]){_0x486383[_0x7dd8('0x3c')]=_[_0x7dd8('0x3f')](_0x486383['where'],{'$or':_[_0x7dd8('0x2b')](_0x516c00,function(_0x3b4c42){if(_0x3b4c42[_0x7dd8('0x2e')]!=='VIRTUAL'){var _0x7a946e={};_0x7a946e[_0x3b4c42[_0x7dd8('0x31')]]={'$like':'%'+_0x1af73e['query'][_0x7dd8('0x3e')]+'%'};return _0x7a946e;}})});}_0x486383=_[_0x7dd8('0x3f')]({},_0x486383,_0x1af73e[_0x7dd8('0x40')]);var _0x177017={'where':_0x486383['where']};return db[_0x7dd8('0x2c')][_0x7dd8('0x1d')](_0x177017)[_0x7dd8('0x25')](function(_0x2d6915){_0xd01f29[_0x7dd8('0x1d')]=_0x2d6915;if(_0x1af73e[_0x7dd8('0x32')][_0x7dd8('0x41')]){_0x486383[_0x7dd8('0x42')]=[{'all':!![]}];}return db['SquareProject'][_0x7dd8('0x43')](_0x486383);})[_0x7dd8('0x25')](function(_0x5bded8){_0xd01f29[_0x7dd8('0x44')]=_0x5bded8;return _0xd01f29;})['then'](respondWithFilteredResult(_0x5d4297,_0x486383))[_0x7dd8('0x45')](handleError(_0x5d4297,null));};exports[_0x7dd8('0x46')]=function(_0x2e5ea0,_0x519a02){var _0x41b525={'raw':![],'where':{'id':_0x2e5ea0[_0x7dd8('0x47')]['id']}},_0x482a7f={};_0x482a7f[_0x7dd8('0x30')]=_['keys'](db[_0x7dd8('0x2c')]['rawAttributes']);_0x482a7f[_0x7dd8('0x32')]=_[_0x7dd8('0x33')](_0x2e5ea0[_0x7dd8('0x32')]);_0x482a7f['filters']=_['intersection'](_0x482a7f['model'],_0x482a7f['query']);_0x41b525[_0x7dd8('0x35')]=_[_0x7dd8('0x36')](_0x482a7f[_0x7dd8('0x30')],qs[_0x7dd8('0x48')](_0x2e5ea0[_0x7dd8('0x32')][_0x7dd8('0x48')]));_0x41b525[_0x7dd8('0x35')]=_0x41b525[_0x7dd8('0x35')][_0x7dd8('0x37')]?_0x41b525[_0x7dd8('0x35')]:_0x482a7f[_0x7dd8('0x30')];if(_0x2e5ea0[_0x7dd8('0x32')]['includeAll']){_0x41b525['include']=[{'all':!![]}];}_0x41b525=_[_0x7dd8('0x3f')]({},_0x41b525,_0x2e5ea0['options']);return db[_0x7dd8('0x2c')]['find'](_0x41b525)['then'](handleEntityNotFound(_0x519a02,null))[_0x7dd8('0x25')](respondWithResult(_0x519a02,null))[_0x7dd8('0x45')](handleError(_0x519a02,null));};exports[_0x7dd8('0x49')]=function(_0x5a6922,_0x37f9a0){return db['SquareProject']['create'](_0x5a6922['body'],{})[_0x7dd8('0x25')](function(_0x2f0a40){var _0x310a91=_0x5a6922[_0x7dd8('0x4a')][_0x7dd8('0x26')]({'plain':!![]});if(!_0x310a91)throw new Error(_0x7dd8('0x4b'));if(_0x310a91[_0x7dd8('0x4c')]===_0x7dd8('0x4a')){var _0x3a5bef=_0x2f0a40[_0x7dd8('0x26')]({'plain':!![]});var _0x59efc5=_0x7dd8('0x27');return db['UserProfileSection'][_0x7dd8('0x4d')]({'where':{'name':_0x59efc5,'userProfileId':_0x310a91[_0x7dd8('0x4e')]},'raw':!![]})[_0x7dd8('0x25')](function(_0xc25794){if(_0xc25794&&_0xc25794[_0x7dd8('0x4f')]===0x0){return db['UserProfileResource'][_0x7dd8('0x49')]({'name':_0x3a5bef[_0x7dd8('0x31')],'resourceId':_0x3a5bef['id'],'type':_0xc25794[_0x7dd8('0x31')],'sectionId':_0xc25794['id']},{})[_0x7dd8('0x25')](function(){return _0x2f0a40;});}else{return _0x2f0a40;}})[_0x7dd8('0x45')](function(_0xd5dee1){logger[_0x7dd8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd5dee1);throw _0xd5dee1;});}return _0x2f0a40;})[_0x7dd8('0x25')](respondWithResult(_0x37f9a0,0xc9))[_0x7dd8('0x45')](handleError(_0x37f9a0,null));};exports[_0x7dd8('0x24')]=function(_0x5438ed,_0x3c4d75){if(_0x5438ed[_0x7dd8('0x50')]['id']){delete _0x5438ed['body']['id'];}return db[_0x7dd8('0x2c')][_0x7dd8('0x4d')]({'where':{'id':_0x5438ed[_0x7dd8('0x47')]['id']}})[_0x7dd8('0x25')](handleEntityNotFound(_0x3c4d75,null))[_0x7dd8('0x25')](saveUpdates(_0x5438ed[_0x7dd8('0x50')],null))[_0x7dd8('0x25')](respondWithResult(_0x3c4d75,null))[_0x7dd8('0x45')](handleError(_0x3c4d75,null));};exports[_0x7dd8('0x29')]=function(_0x4d0a7a,_0x1759cd){return db[_0x7dd8('0x2c')]['find']({'where':{'id':_0x4d0a7a['params']['id']}})['then'](handleEntityNotFound(_0x1759cd,null))[_0x7dd8('0x25')](removeEntity(_0x1759cd,null))[_0x7dd8('0x45')](handleError(_0x1759cd,null));};exports[_0x7dd8('0x51')]=function(_0x58b781,_0x2572ad,_0x2e8acd){return db[_0x7dd8('0x2c')][_0x7dd8('0x4d')]({'where':{'id':_0x58b781[_0x7dd8('0x47')]['id']}})[_0x7dd8('0x25')](handleEntityNotFound(_0x2572ad,null))[_0x7dd8('0x25')](function(_0x5d5863){if(_0x5d5863){return _0x5d5863[_0x7dd8('0x51')](_0x58b781[_0x7dd8('0x50')][_0x7dd8('0x52')],_['omit'](_0x58b781[_0x7dd8('0x50')],['ids','id'])||{});}})[_0x7dd8('0x25')](respondWithResult(_0x2572ad,null))['catch'](handleError(_0x2572ad,null));};exports['removeUsers']=function(_0x4e37db,_0x1a113d,_0x3f4f28){return db[_0x7dd8('0x2c')][_0x7dd8('0x4d')]({'where':{'id':_0x4e37db[_0x7dd8('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a113d,null))[_0x7dd8('0x25')](function(_0x1b4f21){if(_0x1b4f21){return _0x1b4f21[_0x7dd8('0x53')](_0x4e37db[_0x7dd8('0x32')]['ids'])[_0x7dd8('0x25')](function(){if(_[_0x7dd8('0x54')](_0x4e37db['query'][_0x7dd8('0x52')])){for(var _0x1c37ee=0x0;_0x1c37ee<_0x4e37db[_0x7dd8('0x32')]['ids'][_0x7dd8('0x37')];_0x1c37ee+=0x1){socket[_0x7dd8('0x55')](_0x7dd8('0x56'),{'UserId':Number(_0x4e37db[_0x7dd8('0x32')][_0x7dd8('0x52')][_0x1c37ee]),'SquareProjectId':Number(_0x4e37db[_0x7dd8('0x47')]['id'])});}}else{socket[_0x7dd8('0x55')](_0x7dd8('0x56'),{'UserId':Number(_0x4e37db['query'][_0x7dd8('0x52')]),'SquareProjectId':Number(_0x4e37db[_0x7dd8('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a113d,null))['catch'](handleError(_0x1a113d,null));};exports[_0x7dd8('0x57')]=function(_0x149bfb,_0x3b9555,_0x5594f6){var _0x53b3d5={};var _0x25fc17={};var _0x200809;var _0x4b3701;return db[_0x7dd8('0x2c')]['findOne']({'where':{'id':_0x149bfb['params']['id']}})['then'](handleEntityNotFound(_0x3b9555,null))[_0x7dd8('0x25')](function(_0x99aac9){if(_0x99aac9){_0x200809=_0x99aac9;_0x25fc17['model']=_[_0x7dd8('0x33')](db[_0x7dd8('0x58')][_0x7dd8('0x59')]);_0x25fc17[_0x7dd8('0x32')]=_[_0x7dd8('0x33')](_0x149bfb[_0x7dd8('0x32')]);_0x25fc17[_0x7dd8('0x34')]=_[_0x7dd8('0x36')](_0x25fc17[_0x7dd8('0x30')],_0x25fc17[_0x7dd8('0x32')]);_0x53b3d5[_0x7dd8('0x35')]=_['intersection'](_0x25fc17['model'],qs[_0x7dd8('0x48')](_0x149bfb[_0x7dd8('0x32')][_0x7dd8('0x48')]));_0x53b3d5['attributes']=_0x53b3d5[_0x7dd8('0x35')][_0x7dd8('0x37')]?_0x53b3d5[_0x7dd8('0x35')]:_0x25fc17['model'];_0x53b3d5[_0x7dd8('0x3a')]=qs[_0x7dd8('0x3b')](_0x149bfb[_0x7dd8('0x32')][_0x7dd8('0x3b')]);_0x53b3d5[_0x7dd8('0x3c')]=qs[_0x7dd8('0x34')](_[_0x7dd8('0x3d')](_0x149bfb[_0x7dd8('0x32')],_0x25fc17[_0x7dd8('0x34')]));if(_0x149bfb[_0x7dd8('0x32')]['filter']){_0x53b3d5[_0x7dd8('0x3c')]=_[_0x7dd8('0x3f')](_0x53b3d5[_0x7dd8('0x3c')],{'$or':_[_0x7dd8('0x2b')](_0x53b3d5[_0x7dd8('0x35')],function(_0x3db5cc){var _0x5032d4={};_0x5032d4[_0x3db5cc]={'$like':'%'+_0x149bfb['query'][_0x7dd8('0x3e')]+'%'};return _0x5032d4;})});}_0x53b3d5=_[_0x7dd8('0x3f')]({},_0x53b3d5,_0x149bfb['options']);return _0x200809['getUsers'](_0x53b3d5);}})['then'](function(_0x399ee4){if(_0x399ee4){_0x4b3701=_0x399ee4[_0x7dd8('0x37')];if(!_0x149bfb[_0x7dd8('0x32')][_0x7dd8('0x38')](_0x7dd8('0x39'))){_0x53b3d5['limit']=qs[_0x7dd8('0x1f')](_0x149bfb['query'][_0x7dd8('0x1f')]);_0x53b3d5[_0x7dd8('0x1e')]=qs[_0x7dd8('0x1e')](_0x149bfb[_0x7dd8('0x32')][_0x7dd8('0x1e')]);}return _0x200809[_0x7dd8('0x57')](_0x53b3d5);}})[_0x7dd8('0x25')](function(_0x19791c){if(_0x19791c){return _0x19791c?{'count':_0x4b3701,'rows':_0x19791c}:null;}})[_0x7dd8('0x25')](respondWithResult(_0x3b9555,null))['catch'](handleError(_0x3b9555,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7b7d527..5c60fc6 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 _0x0879=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x0879,0x1e9));var _0x9087=function(_0x5bd445,_0x5e846d){_0x5bd445=_0x5bd445-0x0;var _0x3ac5ab=_0x0879[_0x5bd445];return _0x3ac5ab;};'use strict';var EventEmitter=require(_0x9087('0x0'));var SquareProject=require(_0x9087('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9087('0x2')](0x0);var events={'afterCreate':_0x9087('0x3'),'afterUpdate':_0x9087('0x4'),'afterDestroy':'remove'};function emitEvent(_0x712373){return function(_0x389bc2,_0x440d77,_0x13da60){SquareProjectEvents['emit'](_0x712373+':'+_0x389bc2['id'],_0x389bc2);SquareProjectEvents[_0x9087('0x5')](_0x712373,_0x389bc2);_0x13da60(null);};}for(var e in events){if(events[_0x9087('0x6')](e)){var event=events[e];SquareProject[_0x9087('0x7')](e,emitEvent(event));}}module[_0x9087('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xf7df=['save','update','emit','exports','events','SquareProject','setMaxListeners'];(function(_0x21847a,_0x557e68){var _0x2ba843=function(_0x32c8e1){while(--_0x32c8e1){_0x21847a['push'](_0x21847a['shift']());}};_0x2ba843(++_0x557e68);}(_0xf7df,0x10e));var _0xff7d=function(_0x41173b,_0x5f1f23){_0x41173b=_0x41173b-0x0;var _0x4af7d6=_0xf7df[_0x41173b];return _0x4af7d6;};'use strict';var EventEmitter=require(_0xff7d('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xff7d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xff7d('0x2')](0x0);var events={'afterCreate':_0xff7d('0x3'),'afterUpdate':_0xff7d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4498e7){return function(_0x4ddbe0,_0x3d8604,_0x264a71){SquareProjectEvents['emit'](_0x4498e7+':'+_0x4ddbe0['id'],_0x4ddbe0);SquareProjectEvents[_0xff7d('0x5')](_0x4498e7,_0x4ddbe0);_0x264a71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xff7d('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 282a6f0..2edf18d 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 _0x106f=['production','publishedAt','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x123441,_0xd417ba){var _0x5cd849=function(_0x32832a){while(--_0x32832a){_0x123441['push'](_0x123441['shift']());}};_0x5cd849(++_0xd417ba);}(_0x106f,0x162));var _0xf106=function(_0x4f3472,_0x3deacb){_0x4f3472=_0x4f3472-0x0;var _0x4829a4=_0x106f[_0x4f3472];return _0x4829a4;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var logger=require('../../config/logger')(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require('bluebird');var rp=require(_0xf106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var attributes=require(_0xf106('0x7'));module[_0xf106('0x8')]=function(_0x253f6d,_0x282fd4){return _0x253f6d[_0xf106('0x9')]('SquareProject',attributes,{'tableName':_0xf106('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ac1bd,_0x5ea4f0,_0x4a35bc){if(_0x3ac1bd['changed']('preproduction')){_0x3ac1bd['savedAt']=moment()[_0xf106('0xb')](_0xf106('0xc'));}if(_0x3ac1bd[_0xf106('0xd')](_0xf106('0xe'))){_0x3ac1bd[_0xf106('0xf')]=moment()[_0xf106('0xb')](_0xf106('0xc'));}_0x4a35bc(null,_0x3ac1bd);}}});}; \ No newline at end of file +var _0x61df=['path','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','api','moment','request-promise'];(function(_0x333b6a,_0x4a43a9){var _0x4dde7e=function(_0x462fee){while(--_0x462fee){_0x333b6a['push'](_0x333b6a['shift']());}};_0x4dde7e(++_0x4a43a9);}(_0x61df,0xbd));var _0xf61d=function(_0x46a3b9,_0x82932a){_0x46a3b9=_0x46a3b9-0x0;var _0x42accc=_0x61df[_0x46a3b9];return _0x42accc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf61d('0x0'));var moment=require(_0xf61d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x2'));var fs=require('fs');var path=require(_0xf61d('0x3'));var rimraf=require('rimraf');var config=require(_0xf61d('0x4'));var attributes=require(_0xf61d('0x5'));module[_0xf61d('0x6')]=function(_0x458eb9,_0x2d0791){return _0x458eb9[_0xf61d('0x7')]('SquareProject',attributes,{'tableName':_0xf61d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49523e,_0x32ad93,_0x2a07c5){if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xa'))){_0x49523e[_0xf61d('0xb')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xe'))){_0x49523e[_0xf61d('0xf')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}_0x2a07c5(null,_0x49523e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4d0f981..3edc8fb 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 _0xda28=['SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','find','options','raw','where','attributes','include','map','model','ShowSquareProject','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info'];(function(_0x843880,_0x1516d1){var _0x49943f=function(_0x4fc04b){while(--_0x4fc04b){_0x843880['push'](_0x843880['shift']());}};_0x49943f(++_0x1516d1);}(_0xda28,0x1a8));var _0x8da2=function(_0x4544a9,_0xc907ba){_0x4544a9=_0x4544a9-0x0;var _0x1aab9f=_0xda28[_0x4544a9];return _0x1aab9f;};'use strict';var _=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var moment=require(_0x8da2('0x2'));var BPromise=require('bluebird');var rs=require(_0x8da2('0x3'));var fs=require('fs');var Redis=require(_0x8da2('0x4'));var db=require(_0x8da2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8da2('0x6'))(_0x8da2('0x7'));var config=require(_0x8da2('0x8'));var jayson=require(_0x8da2('0x9'));var client=jayson[_0x8da2('0xa')][_0x8da2('0xb')]({'port':0x232a});config[_0x8da2('0xc')]=_[_0x8da2('0xd')](config['redis'],{'host':_0x8da2('0xe'),'port':0x18eb});var socket=require(_0x8da2('0xf'))(new Redis(config['redis']));require(_0x8da2('0x10'))['register'](socket);function respondWithRpcPromise(_0x4fa6ac,_0x3bc37e,_0x4e9463){return new BPromise(function(_0x335b91,_0x41ecb9){return client[_0x8da2('0x11')](_0x4fa6ac,_0x4e9463)[_0x8da2('0x12')](function(_0x221401){logger[_0x8da2('0x13')](_0x8da2('0x14'),_0x3bc37e,'request\x20sent');logger[_0x8da2('0x15')](_0x8da2('0x16'),_0x3bc37e,'request\x20sent',JSON['stringify'](_0x221401));if(_0x221401[_0x8da2('0x17')]){if(_0x221401[_0x8da2('0x17')][_0x8da2('0x18')]===0x1f4){logger[_0x8da2('0x17')](_0x8da2('0x14'),_0x3bc37e,_0x221401[_0x8da2('0x17')][_0x8da2('0x19')]);return _0x41ecb9(_0x221401[_0x8da2('0x17')][_0x8da2('0x19')]);}logger['error'](_0x8da2('0x14'),_0x3bc37e,_0x221401[_0x8da2('0x17')]['message']);return _0x335b91(_0x221401[_0x8da2('0x17')][_0x8da2('0x19')]);}else{logger[_0x8da2('0x13')](_0x8da2('0x14'),_0x3bc37e,_0x8da2('0x1a'));_0x335b91(_0x221401['result'][_0x8da2('0x19')]);}})[_0x8da2('0x1b')](function(_0x52009c){logger[_0x8da2('0x17')](_0x8da2('0x14'),_0x3bc37e,_0x52009c);_0x41ecb9(_0x52009c);});});}exports['ShowSquareProject']=function(_0x4df988){var _0x59c9c2=this;return new Promise(function(_0x57f8a0,_0x28029a){return db['SquareProject'][_0x8da2('0x1c')]({'raw':_0x4df988[_0x8da2('0x1d')]?_0x4df988[_0x8da2('0x1d')][_0x8da2('0x1e')]===undefined?!![]:![]:!![],'where':_0x4df988[_0x8da2('0x1d')]?_0x4df988[_0x8da2('0x1d')][_0x8da2('0x1f')]||null:null,'attributes':_0x4df988[_0x8da2('0x1d')]?_0x4df988[_0x8da2('0x1d')][_0x8da2('0x20')]||null:null,'include':_0x4df988[_0x8da2('0x1d')]?_0x4df988[_0x8da2('0x1d')][_0x8da2('0x21')]?_[_0x8da2('0x22')](_0x4df988[_0x8da2('0x1d')]['include'],function(_0x2ac581){return{'model':db[_0x2ac581['model']],'as':_0x2ac581['as'],'attributes':_0x2ac581[_0x8da2('0x20')],'include':_0x2ac581[_0x8da2('0x21')]?_[_0x8da2('0x22')](_0x2ac581['include'],function(_0x393cb1){return{'model':db[_0x393cb1[_0x8da2('0x23')]],'as':_0x393cb1['as'],'attributes':_0x393cb1[_0x8da2('0x20')],'include':_0x393cb1['include']?_[_0x8da2('0x22')](_0x393cb1[_0x8da2('0x21')],function(_0x34d60f){return{'model':db[_0x34d60f[_0x8da2('0x23')]],'as':_0x34d60f['as'],'attributes':_0x34d60f[_0x8da2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8da2('0x12')](function(_0x49ff11){logger[_0x8da2('0x13')](_0x8da2('0x24'),_0x4df988);logger[_0x8da2('0x15')](_0x8da2('0x24'),_0x4df988,JSON['stringify'](_0x49ff11));_0x57f8a0(_0x49ff11);})[_0x8da2('0x1b')](function(_0x4c58c4){logger[_0x8da2('0x17')](_0x8da2('0x24'),_0x4c58c4[_0x8da2('0x19')],_0x4df988);_0x28029a(_0x59c9c2['error'](0x1f4,_0x4c58c4[_0x8da2('0x19')]));});});}; \ No newline at end of file +var _0x612b=['../../config/environment','http','redis','defaults','localhost','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','SquareProject','find','options','raw','where','attributes','include','map','model','ShowSquareProject','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2e9c0c,_0x1d0495){var _0xd90c8=function(_0x488a26){while(--_0x488a26){_0x2e9c0c['push'](_0x2e9c0c['shift']());}};_0xd90c8(++_0x1d0495);}(_0x612b,0xc6));var _0xb612=function(_0x55134e,_0x227d60){_0x55134e=_0x55134e-0x0;var _0x1942f1=_0x612b[_0x55134e];return _0x1942f1;};'use strict';var _=require('lodash');var util=require(_0xb612('0x0'));var moment=require(_0xb612('0x1'));var BPromise=require(_0xb612('0x2'));var rs=require(_0xb612('0x3'));var fs=require('fs');var Redis=require(_0xb612('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb612('0x5'))('rpc');var config=require(_0xb612('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb612('0x7')]({'port':0x232a});config[_0xb612('0x8')]=_[_0xb612('0x9')](config[_0xb612('0x8')],{'host':_0xb612('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb612('0xb'))[_0xb612('0xc')](socket);function respondWithRpcPromise(_0xbddfd2,_0x31d320,_0x452f6f){return new BPromise(function(_0x29059c,_0x2ace55){return client['request'](_0xbddfd2,_0x452f6f)[_0xb612('0xd')](function(_0x363a96){logger[_0xb612('0xe')](_0xb612('0xf'),_0x31d320,_0xb612('0x10'));logger['debug'](_0xb612('0x11'),_0x31d320,_0xb612('0x10'),JSON['stringify'](_0x363a96));if(_0x363a96[_0xb612('0x12')]){if(_0x363a96[_0xb612('0x12')][_0xb612('0x13')]===0x1f4){logger[_0xb612('0x12')]('SquareProject,\x20%s,\x20%s',_0x31d320,_0x363a96[_0xb612('0x12')][_0xb612('0x14')]);return _0x2ace55(_0x363a96['error'][_0xb612('0x14')]);}logger[_0xb612('0x12')](_0xb612('0xf'),_0x31d320,_0x363a96['error'][_0xb612('0x14')]);return _0x29059c(_0x363a96['error'][_0xb612('0x14')]);}else{logger[_0xb612('0xe')](_0xb612('0xf'),_0x31d320,'request\x20sent');_0x29059c(_0x363a96[_0xb612('0x15')][_0xb612('0x14')]);}})['catch'](function(_0x5dd271){logger[_0xb612('0x12')]('SquareProject,\x20%s,\x20%s',_0x31d320,_0x5dd271);_0x2ace55(_0x5dd271);});});}exports['ShowSquareProject']=function(_0x4a3018){var _0x7fcd2b=this;return new Promise(function(_0x474468,_0x6f7d7){return db[_0xb612('0x16')][_0xb612('0x17')]({'raw':_0x4a3018[_0xb612('0x18')]?_0x4a3018[_0xb612('0x18')][_0xb612('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3018[_0xb612('0x18')]?_0x4a3018['options'][_0xb612('0x1a')]||null:null,'attributes':_0x4a3018[_0xb612('0x18')]?_0x4a3018[_0xb612('0x18')][_0xb612('0x1b')]||null:null,'include':_0x4a3018[_0xb612('0x18')]?_0x4a3018['options'][_0xb612('0x1c')]?_[_0xb612('0x1d')](_0x4a3018[_0xb612('0x18')][_0xb612('0x1c')],function(_0x1b33b9){return{'model':db[_0x1b33b9[_0xb612('0x1e')]],'as':_0x1b33b9['as'],'attributes':_0x1b33b9[_0xb612('0x1b')],'include':_0x1b33b9[_0xb612('0x1c')]?_[_0xb612('0x1d')](_0x1b33b9['include'],function(_0x21fe3a){return{'model':db[_0x21fe3a['model']],'as':_0x21fe3a['as'],'attributes':_0x21fe3a[_0xb612('0x1b')],'include':_0x21fe3a['include']?_[_0xb612('0x1d')](_0x21fe3a[_0xb612('0x1c')],function(_0x43551d){return{'model':db[_0x43551d[_0xb612('0x1e')]],'as':_0x43551d['as'],'attributes':_0x43551d[_0xb612('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x138557){logger[_0xb612('0xe')](_0xb612('0x1f'),_0x4a3018);logger[_0xb612('0x20')](_0xb612('0x1f'),_0x4a3018,JSON[_0xb612('0x21')](_0x138557));_0x474468(_0x138557);})['catch'](function(_0x46ca63){logger[_0xb612('0x12')]('ShowSquareProject',_0x46ca63[_0xb612('0x14')],_0x4a3018);_0x6f7d7(_0x7fcd2b['error'](0x1f4,_0x46ca63[_0xb612('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 12c2744..6912871 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 _0xc1c6=['length','squareProject:','./squareProject.events','save','remove','emit','register'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5c92a0,_0x499c31){_0x5c92a0=_0x5c92a0-0x0;var _0x25ccbe=_0xc1c6[_0x5c92a0];return _0x25ccbe;};'use strict';var SquareProjectEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){SquareProjectEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);SquareProjectEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file +var _0x4819=['length','squareProject:','save','remove','update','emit','removeListener'];(function(_0x19cca5,_0x42531a){var _0x30a72d=function(_0x6ee03){while(--_0x6ee03){_0x19cca5['push'](_0x19cca5['shift']());}};_0x30a72d(++_0x42531a);}(_0x4819,0xcd));var _0x9481=function(_0x583c95,_0x2caa4d){_0x583c95=_0x583c95-0x0;var _0x1cb317=_0x4819[_0x583c95];return _0x1cb317;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9481('0x0'),_0x9481('0x1'),_0x9481('0x2')];function createListener(_0x12a70c,_0x273a32){return function(_0xfb4034){_0x273a32[_0x9481('0x3')](_0x12a70c,_0xfb4034);};}function removeListener(_0x14dc10,_0xc39edf){return function(){SquareProjectEvents[_0x9481('0x4')](_0x14dc10,_0xc39edf);};}exports['register']=function(_0x4d9e3a){for(var _0x5def07=0x0,_0x54cc78=events[_0x9481('0x5')];_0x5def07<_0x54cc78;_0x5def07++){var _0x6c6a08=events[_0x5def07];var _0x27c033=createListener(_0x9481('0x6')+_0x6c6a08,_0x4d9e3a);SquareProjectEvents['on'](_0x6c6a08,_0x27c033);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0300827..08d2ae4 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 _0x6f51=['../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x184e9a,_0x5e1e34){var _0x3af201=function(_0x4ea25c){while(--_0x4ea25c){_0x184e9a['push'](_0x184e9a['shift']());}};_0x3af201(++_0x5e1e34);}(_0x6f51,0x123));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x16f5('0x0'));var util=require(_0x16f5('0x1'));var path=require(_0x16f5('0x2'));var timeout=require(_0x16f5('0x3'));var express=require(_0x16f5('0x4'));var router=express[_0x16f5('0x5')]();var auth=require(_0x16f5('0x6'));var interaction=require(_0x16f5('0x7'));var config=require(_0x16f5('0x8'));var controller=require('./squareRecording.controller');router[_0x16f5('0x9')]('/',auth[_0x16f5('0xa')](),controller[_0x16f5('0xb')]);router[_0x16f5('0x9')](_0x16f5('0xc'),auth[_0x16f5('0xa')](),controller['show']);router['get'](_0x16f5('0xd'),auth['isAuthenticated'](),controller[_0x16f5('0xe')]);router[_0x16f5('0xf')]('/',auth[_0x16f5('0xa')](),controller[_0x16f5('0x10')]);router[_0x16f5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x16f5('0x12')]);router[_0x16f5('0x13')](_0x16f5('0x14'),auth[_0x16f5('0xa')](),controller[_0x16f5('0x15')]);module[_0x16f5('0x16')]=router; \ No newline at end of file +var _0xf409=['put','/:id','update','/:id/delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/download','download','post'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xf409,0x16a));var _0x9f40=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xf409[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x9f40('0x0'));var util=require(_0x9f40('0x1'));var path=require(_0x9f40('0x2'));var timeout=require(_0x9f40('0x3'));var express=require(_0x9f40('0x4'));var router=express[_0x9f40('0x5')]();var auth=require(_0x9f40('0x6'));var interaction=require(_0x9f40('0x7'));var config=require(_0x9f40('0x8'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0x9f40('0x9')](),controller[_0x9f40('0xa')]);router[_0x9f40('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9f40('0xc')]);router['get'](_0x9f40('0xd'),auth[_0x9f40('0x9')](),controller[_0x9f40('0xe')]);router[_0x9f40('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f40('0x10')](_0x9f40('0x11'),auth[_0x9f40('0x9')](),controller[_0x9f40('0x12')]);router['delete'](_0x9f40('0x13'),auth['isAuthenticated'](),controller[_0x9f40('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index baf2f40..e05b778 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 _0x7212=['STRING','getDataValue','savePath','sequelize'];(function(_0x3839c7,_0x345279){var _0x115117=function(_0x23a829){while(--_0x23a829){_0x3839c7['push'](_0x3839c7['shift']());}};_0x115117(++_0x345279);}(_0x7212,0x1e3));var _0x2721=function(_0x43d21f,_0x4ed851){_0x43d21f=_0x43d21f-0x0;var _0x5770f9=_0x7212[_0x43d21f];return _0x5770f9;};'use strict';var Sequelize=require(_0x2721('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2721('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2721('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2721('0x1')]},'filename':{'type':Sequelize[_0x2721('0x1')]},'savePath':{'type':Sequelize[_0x2721('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xa78461='';var _0x16bf0d=this[_0x2721('0x2')](_0x2721('0x3'));if(_0x16bf0d){_0xa78461=_0x16bf0d['substring'](_0x16bf0d['lastIndexOf']('.'));}return _0xa78461;}}}; \ No newline at end of file +var _0x6cb2=['lastIndexOf','exports','STRING','getDataValue','substring'];(function(_0x205c4c,_0x398dee){var _0xfbe111=function(_0x51aad5){while(--_0x51aad5){_0x205c4c['push'](_0x205c4c['shift']());}};_0xfbe111(++_0x398dee);}(_0x6cb2,0x6a));var _0x26cb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6cb2[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x26cb('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x26cb('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x26cb('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x26cb('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x26cb('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x9b13ce='';var _0x281b34=this[_0x26cb('0x2')]('savePath');if(_0x281b34){_0x9b13ce=_0x281b34[_0x26cb('0x3')](_0x281b34[_0x26cb('0x4')]('.'));}return _0x9b13ce;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 42da429..40f75aa 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 _0xc64d=['isNil','html-pdf','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','SquareRecording','rows','show','params','length','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc64d,0x1d2));var _0xdc64=function(_0x4c57bc,_0x548f9e){_0x4c57bc=_0x4c57bc-0x0;var _0x4b816b=_0xc64d[_0x4c57bc];return _0x4b816b;};'use strict';var pdf=require(_0xdc64('0x0'));var emlformat=require(_0xdc64('0x1'));var rimraf=require(_0xdc64('0x2'));var zipdir=require(_0xdc64('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc64('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc64('0x5'));var path=require('path');var sox=require(_0xdc64('0x6'));var csv=require(_0xdc64('0x7'));var ejs=require(_0xdc64('0x8'));var fs=require('fs');var _=require(_0xdc64('0x9'));var squel=require(_0xdc64('0xa'));var crypto=require(_0xdc64('0xb'));var jsforce=require(_0xdc64('0xc'));var deskjs=require(_0xdc64('0xd'));var toCsv=require(_0xdc64('0x7'));var querystring=require(_0xdc64('0xe'));var Papa=require(_0xdc64('0xf'));var Redis=require('ioredis');var authService=require(_0xdc64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdc64('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc64('0x12'))(_0xdc64('0x13'));var utils=require(_0xdc64('0x14'));var config=require(_0xdc64('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339e4d,_0xd2d8e4){_0xd2d8e4=_0xd2d8e4||0xcc;return function(_0x454505){if(_0x454505){return _0x339e4d['sendStatus'](_0xd2d8e4);}return _0x339e4d[_0xdc64('0x16')](_0xd2d8e4)[_0xdc64('0x17')]();};}function respondWithResult(_0x4f9aa8,_0x50d323){_0x50d323=_0x50d323||0xc8;return function(_0x3a961e){if(_0x3a961e){return _0x4f9aa8[_0xdc64('0x16')](_0x50d323)[_0xdc64('0x18')](_0x3a961e);}};}function respondWithFilteredResult(_0x162b36,_0x51fb81){return function(_0x4424e8){if(_0x4424e8){var _0x202d4c=_0x4424e8[_0xdc64('0x19')],_0x51b660=_0x51fb81[_0xdc64('0x1a')],_0x1689aa=_0x51fb81['offset']+_0x51fb81['limit'],_0x31cc15;if(_0x1689aa>=_0x202d4c){_0x1689aa=_0x202d4c;_0x31cc15=0xc8;}else{_0x31cc15=0xce;}_0x162b36[_0xdc64('0x16')](_0x31cc15);return _0x162b36['set'](_0xdc64('0x1b'),_0x51b660+'-'+_0x1689aa+'/'+_0x202d4c)[_0xdc64('0x18')](_0x4424e8);}return null;};}function patchUpdates(_0x564460){return function(_0x2478d8){try{jsonpatch[_0xdc64('0x1c')](_0x2478d8,_0x564460,!![]);}catch(_0x4a336f){return BPromise[_0xdc64('0x1d')](_0x4a336f);}return _0x2478d8['save']();};}function saveUpdates(_0x17f3d1,_0x596307){return function(_0x1a31db){if(_0x1a31db){return _0x1a31db[_0xdc64('0x1e')](_0x17f3d1)[_0xdc64('0x1f')](function(_0x127072){return _0x127072;});}return null;};}function removeEntity(_0x5709e8,_0xfa3fc1){return function(_0x41d417){if(_0x41d417){return _0x41d417['destroy']()[_0xdc64('0x1f')](function(){_0x5709e8[_0xdc64('0x16')](0xcc)[_0xdc64('0x17')]();});}};}function handleEntityNotFound(_0x540b8e,_0x41574a){return function(_0x1a7ce0){if(!_0x1a7ce0){_0x540b8e['sendStatus'](0x194);}return _0x1a7ce0;};}function handleError(_0x5af9f5,_0x258050){_0x258050=_0x258050||0x1f4;return function(_0x380c8f){logger[_0xdc64('0x20')](_0x380c8f[_0xdc64('0x21')]);if(_0x380c8f['name']){delete _0x380c8f[_0xdc64('0x22')];}_0x5af9f5[_0xdc64('0x16')](_0x258050)['send'](_0x380c8f);};}exports[_0xdc64('0x23')]=function(_0x12c839,_0x98d17c){var _0x4a9ea2={},_0x14d617={},_0x1fa877={'count':0x0,'rows':[]};var _0x33aff1=_[_0xdc64('0x24')](db['SquareRecording'][_0xdc64('0x25')],function(_0x21266d){return{'name':_0x21266d[_0xdc64('0x26')],'type':_0x21266d[_0xdc64('0x27')][_0xdc64('0x28')]};});_0x14d617['model']=_[_0xdc64('0x24')](_0x33aff1,_0xdc64('0x22'));_0x14d617[_0xdc64('0x29')]=_[_0xdc64('0x2a')](_0x12c839[_0xdc64('0x29')]);_0x14d617[_0xdc64('0x2b')]=_[_0xdc64('0x2c')](_0x14d617[_0xdc64('0x2d')],_0x14d617[_0xdc64('0x29')]);_0x4a9ea2[_0xdc64('0x2e')]=_['intersection'](_0x14d617[_0xdc64('0x2d')],qs[_0xdc64('0x2f')](_0x12c839[_0xdc64('0x29')][_0xdc64('0x2f')]));_0x4a9ea2[_0xdc64('0x2e')]=_0x4a9ea2[_0xdc64('0x2e')]['length']?_0x4a9ea2['attributes']:_0x14d617['model'];if(!_0x12c839[_0xdc64('0x29')][_0xdc64('0x30')](_0xdc64('0x31'))){_0x4a9ea2[_0xdc64('0x32')]=qs[_0xdc64('0x32')](_0x12c839['query'][_0xdc64('0x32')]);_0x4a9ea2['offset']=qs[_0xdc64('0x1a')](_0x12c839[_0xdc64('0x29')]['offset']);}_0x4a9ea2[_0xdc64('0x33')]=qs[_0xdc64('0x34')](_0x12c839['query'][_0xdc64('0x34')]);_0x4a9ea2['where']=qs[_0xdc64('0x2b')](_['pick'](_0x12c839[_0xdc64('0x29')],_0x14d617[_0xdc64('0x2b')]),_0x33aff1);if(_0x12c839[_0xdc64('0x29')]['filter']){_0x4a9ea2[_0xdc64('0x35')]=_[_0xdc64('0x36')](_0x4a9ea2['where'],{'$or':_[_0xdc64('0x24')](_0x33aff1,function(_0x5d576c){if(_0x5d576c[_0xdc64('0x27')]!==_0xdc64('0x37')){var _0x148c62={};_0x148c62[_0x5d576c['name']]={'$like':'%'+_0x12c839[_0xdc64('0x29')][_0xdc64('0x38')]+'%'};return _0x148c62;}})});}_0x4a9ea2=_[_0xdc64('0x36')]({},_0x4a9ea2,_0x12c839[_0xdc64('0x39')]);var _0x1abee9={'where':_0x4a9ea2[_0xdc64('0x35')]};return db['SquareRecording'][_0xdc64('0x19')](_0x1abee9)[_0xdc64('0x1f')](function(_0x4d6886){_0x1fa877['count']=_0x4d6886;if(_0x12c839[_0xdc64('0x29')][_0xdc64('0x3a')]){_0x4a9ea2[_0xdc64('0x3b')]=[{'all':!![]}];}return db[_0xdc64('0x3c')]['findAll'](_0x4a9ea2);})[_0xdc64('0x1f')](function(_0x12aac4){_0x1fa877[_0xdc64('0x3d')]=_0x12aac4;return _0x1fa877;})['then'](respondWithFilteredResult(_0x98d17c,_0x4a9ea2))['catch'](handleError(_0x98d17c,null));};exports[_0xdc64('0x3e')]=function(_0x2b7878,_0x3bc7f7){var _0x1a4126={'raw':!![],'where':{'id':_0x2b7878[_0xdc64('0x3f')]['id']}},_0x3c1788={};_0x3c1788[_0xdc64('0x2d')]=_[_0xdc64('0x2a')](db[_0xdc64('0x3c')][_0xdc64('0x25')]);_0x3c1788['query']=_[_0xdc64('0x2a')](_0x2b7878[_0xdc64('0x29')]);_0x3c1788['filters']=_[_0xdc64('0x2c')](_0x3c1788[_0xdc64('0x2d')],_0x3c1788[_0xdc64('0x29')]);_0x1a4126['attributes']=_[_0xdc64('0x2c')](_0x3c1788['model'],qs['fields'](_0x2b7878['query'][_0xdc64('0x2f')]));_0x1a4126[_0xdc64('0x2e')]=_0x1a4126[_0xdc64('0x2e')][_0xdc64('0x40')]?_0x1a4126[_0xdc64('0x2e')]:_0x3c1788[_0xdc64('0x2d')];if(_0x2b7878[_0xdc64('0x29')]['includeAll']){_0x1a4126[_0xdc64('0x3b')]=[{'all':!![]}];}_0x1a4126=_[_0xdc64('0x36')]({},_0x1a4126,_0x2b7878['options']);return db[_0xdc64('0x3c')][_0xdc64('0x41')](_0x1a4126)[_0xdc64('0x1f')](handleEntityNotFound(_0x3bc7f7,null))[_0xdc64('0x1f')](respondWithResult(_0x3bc7f7,null))[_0xdc64('0x42')](handleError(_0x3bc7f7,null));};exports[_0xdc64('0x43')]=function(_0x58b65f,_0x403d1a){return db['SquareRecording'][_0xdc64('0x43')](_0x58b65f[_0xdc64('0x44')],{})[_0xdc64('0x1f')](respondWithResult(_0x403d1a,0xc9))[_0xdc64('0x42')](handleError(_0x403d1a,null));};exports['update']=function(_0x5a6fda,_0x321ddf){if(_0x5a6fda[_0xdc64('0x44')]['id']){delete _0x5a6fda[_0xdc64('0x44')]['id'];}return db[_0xdc64('0x3c')]['find']({'where':{'id':_0x5a6fda['params']['id']}})[_0xdc64('0x1f')](handleEntityNotFound(_0x321ddf,null))[_0xdc64('0x1f')](saveUpdates(_0x5a6fda[_0xdc64('0x44')],null))[_0xdc64('0x1f')](respondWithResult(_0x321ddf,null))[_0xdc64('0x42')](handleError(_0x321ddf,null));};exports[_0xdc64('0x45')]=function(_0x229809,_0x5ce15e,_0x3f3b16){var _0x22e8a3=require(_0xdc64('0x46'));var _0x41a3e2=![];var _0x5da4da={};if(_0x229809[_0xdc64('0x29')][_0xdc64('0x27')]&&_0x229809[_0xdc64('0x29')]['type']==='uniqueid'){_0x5da4da[_0xdc64('0x47')]=_0x229809[_0xdc64('0x3f')]['id'];}else{_0x5da4da['id']=_0x229809[_0xdc64('0x3f')]['id'];}return db['SquareRecording'][_0xdc64('0x41')]({'where':_0x5da4da,'attributes':['id',_0xdc64('0x48'),_0xdc64('0x49')],'raw':!![]})[_0xdc64('0x1f')](handleEntityNotFound(_0x5ce15e,null))[_0xdc64('0x1f')](function(_0x3822f1){if(_0x3822f1){var _0x159086=_0x3822f1[_0xdc64('0x48')];var _0x3240f5=util['format'](_0xdc64('0x4a'),_0x159086);if(fs[_0xdc64('0x4b')](_0x3240f5)){_0x41a3e2=!![];return _0x22e8a3[_0xdc64('0x4c')](_0x3240f5,_0x159086,config[_0xdc64('0x4d')][_0xdc64('0x4e')])[_0xdc64('0x1f')](function(){return _0x3822f1;});}return _0x3822f1;}})['then'](function(_0x4863fd){if(_0x4863fd){var _0xa20086=_0x4863fd[_0xdc64('0x48')];if(!fs[_0xdc64('0x4b')](_0xa20086)){throw new db[(_0xdc64('0x4f'))]['ValidationError'](_0xdc64('0x50'));}if(_0x4863fd[_0xdc64('0x49')]){return _0x5ce15e['download'](_0xa20086,_0x4863fd[_0xdc64('0x49')]+path[_0xdc64('0x51')](_0xa20086),function(){if(_0x41a3e2){fs[_0xdc64('0x52')](_0xa20086);}});}else{return _0x5ce15e['download'](_0xa20086,function(_0x56d8e8){if(_0x41a3e2){fs[_0xdc64('0x52')](_0xa20086);}});}}})[_0xdc64('0x42')](function(_0x73e1e1){if(_0x73e1e1[_0xdc64('0x53')]===_0xdc64('0x50')){_0x5ce15e['status'](0x194)['send'](_0xdc64('0x54'));}else{return handleError(_0x5ce15e,null);}});};exports[_0xdc64('0x55')]=function(_0x4f790e,_0x42b658){return db[_0xdc64('0x3c')][_0xdc64('0x41')]({'where':{'id':_0x4f790e['params']['id']}})[_0xdc64('0x1f')](function(_0xad6168){if(!_0xad6168)throw new ReferenceError(_0xdc64('0x56'));return _0xad6168;})['then'](function(_0x4bf1e2){var _0x1fcfa2=_0x4bf1e2[_0xdc64('0x48')];logger[_0xdc64('0x57')](_0xdc64('0x58'),_0x1fcfa2);if(!_['isNil'](_0x4bf1e2[_0xdc64('0x48')])&&fs[_0xdc64('0x4b')](_0x1fcfa2)){logger['info'](_0xdc64('0x59')+_0x1fcfa2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdc64('0x5a')](_0x1fcfa2);}_0x1fcfa2=_0x1fcfa2+_0xdc64('0x5b');if(!_[_0xdc64('0x5c')](_0x4bf1e2[_0xdc64('0x48')])&&fs[_0xdc64('0x4b')](_0x1fcfa2)){logger[_0xdc64('0x57')](_0xdc64('0x59')+_0x1fcfa2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdc64('0x5a')](_0x1fcfa2);}return _0x4bf1e2;})[_0xdc64('0x1f')](function(_0x232629){if(!_0x232629)throw new InternalError();return _0x232629['destroy']();})['then'](function(){_0x42b658[_0xdc64('0x16')](0xcc)['end']();})['catch'](handleError(_0x42b658,null));}; \ No newline at end of file +var _0x25cb=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x25cb,0xaa));var _0xb25c=function(_0x1bd498,_0x14b925){_0x1bd498=_0x1bd498-0x0;var _0xb4473e=_0x25cb[_0x1bd498];return _0xb4473e;};'use strict';var pdf=require(_0xb25c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb25c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb25c('0x2'));var moment=require(_0xb25c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb25c('0x4'));var util=require(_0xb25c('0x5'));var path=require(_0xb25c('0x6'));var sox=require(_0xb25c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb25c('0x8'));var squel=require(_0xb25c('0x9'));var crypto=require(_0xb25c('0xa'));var jsforce=require(_0xb25c('0xb'));var deskjs=require(_0xb25c('0xc'));var toCsv=require(_0xb25c('0xd'));var querystring=require(_0xb25c('0xe'));var Papa=require(_0xb25c('0xf'));var Redis=require(_0xb25c('0x10'));var authService=require(_0xb25c('0x11'));var qs=require(_0xb25c('0x12'));var as=require(_0xb25c('0x13'));var hardwareService=require(_0xb25c('0x14'));var logger=require(_0xb25c('0x15'))('api');var utils=require(_0xb25c('0x16'));var config=require(_0xb25c('0x17'));var licenseUtil=require(_0xb25c('0x18'));var db=require(_0xb25c('0x19'))['db'];function respondWithStatusCode(_0x312820,_0x244b8e){_0x244b8e=_0x244b8e||0xcc;return function(_0x25696d){if(_0x25696d){return _0x312820[_0xb25c('0x1a')](_0x244b8e);}return _0x312820[_0xb25c('0x1b')](_0x244b8e)[_0xb25c('0x1c')]();};}function respondWithResult(_0xc231be,_0x1f7b96){_0x1f7b96=_0x1f7b96||0xc8;return function(_0x4a5e43){if(_0x4a5e43){return _0xc231be[_0xb25c('0x1b')](_0x1f7b96)[_0xb25c('0x1d')](_0x4a5e43);}};}function respondWithFilteredResult(_0x54a8fe,_0x4c0523){return function(_0x55d295){if(_0x55d295){var _0x575439=_0x55d295[_0xb25c('0x1e')],_0x1fc770=_0x4c0523[_0xb25c('0x1f')],_0x38e0a5=_0x4c0523[_0xb25c('0x1f')]+_0x4c0523[_0xb25c('0x20')],_0x25cfea;if(_0x38e0a5>=_0x575439){_0x38e0a5=_0x575439;_0x25cfea=0xc8;}else{_0x25cfea=0xce;}_0x54a8fe['status'](_0x25cfea);return _0x54a8fe[_0xb25c('0x21')](_0xb25c('0x22'),_0x1fc770+'-'+_0x38e0a5+'/'+_0x575439)[_0xb25c('0x1d')](_0x55d295);}return null;};}function patchUpdates(_0x251bce){return function(_0x958d5c){try{jsonpatch[_0xb25c('0x23')](_0x958d5c,_0x251bce,!![]);}catch(_0x31db67){return BPromise[_0xb25c('0x24')](_0x31db67);}return _0x958d5c[_0xb25c('0x25')]();};}function saveUpdates(_0x5d4589,_0x4c81ba){return function(_0x2c349f){if(_0x2c349f){return _0x2c349f[_0xb25c('0x26')](_0x5d4589)[_0xb25c('0x27')](function(_0x284c14){return _0x284c14;});}return null;};}function removeEntity(_0x3e7f93,_0x46f34a){return function(_0x51f845){if(_0x51f845){return _0x51f845[_0xb25c('0x28')]()[_0xb25c('0x27')](function(){_0x3e7f93['status'](0xcc)[_0xb25c('0x1c')]();});}};}function handleEntityNotFound(_0x475fce,_0x4673a4){return function(_0x13c34d){if(!_0x13c34d){_0x475fce['sendStatus'](0x194);}return _0x13c34d;};}function handleError(_0xabb969,_0x13edf5){_0x13edf5=_0x13edf5||0x1f4;return function(_0x801d33){logger[_0xb25c('0x29')](_0x801d33[_0xb25c('0x2a')]);if(_0x801d33['name']){delete _0x801d33[_0xb25c('0x2b')];}_0xabb969['status'](_0x13edf5)[_0xb25c('0x2c')](_0x801d33);};}exports['index']=function(_0x21a669,_0x5345a2){var _0x417ebe={},_0x9a7a2e={},_0x2238eb={'count':0x0,'rows':[]};var _0x299915=_[_0xb25c('0x2d')](db['SquareRecording'][_0xb25c('0x2e')],function(_0x2c6566){return{'name':_0x2c6566[_0xb25c('0x2f')],'type':_0x2c6566['type'][_0xb25c('0x30')]};});_0x9a7a2e[_0xb25c('0x31')]=_[_0xb25c('0x2d')](_0x299915,_0xb25c('0x2b'));_0x9a7a2e[_0xb25c('0x32')]=_[_0xb25c('0x33')](_0x21a669[_0xb25c('0x32')]);_0x9a7a2e[_0xb25c('0x34')]=_['intersection'](_0x9a7a2e[_0xb25c('0x31')],_0x9a7a2e[_0xb25c('0x32')]);_0x417ebe[_0xb25c('0x35')]=_[_0xb25c('0x36')](_0x9a7a2e[_0xb25c('0x31')],qs[_0xb25c('0x37')](_0x21a669['query'][_0xb25c('0x37')]));_0x417ebe[_0xb25c('0x35')]=_0x417ebe[_0xb25c('0x35')][_0xb25c('0x38')]?_0x417ebe[_0xb25c('0x35')]:_0x9a7a2e[_0xb25c('0x31')];if(!_0x21a669['query']['hasOwnProperty'](_0xb25c('0x39'))){_0x417ebe[_0xb25c('0x20')]=qs[_0xb25c('0x20')](_0x21a669[_0xb25c('0x32')][_0xb25c('0x20')]);_0x417ebe[_0xb25c('0x1f')]=qs[_0xb25c('0x1f')](_0x21a669[_0xb25c('0x32')]['offset']);}_0x417ebe[_0xb25c('0x3a')]=qs['sort'](_0x21a669['query'][_0xb25c('0x3b')]);_0x417ebe[_0xb25c('0x3c')]=qs[_0xb25c('0x34')](_[_0xb25c('0x3d')](_0x21a669[_0xb25c('0x32')],_0x9a7a2e[_0xb25c('0x34')]),_0x299915);if(_0x21a669[_0xb25c('0x32')][_0xb25c('0x3e')]){_0x417ebe['where']=_['merge'](_0x417ebe[_0xb25c('0x3c')],{'$or':_[_0xb25c('0x2d')](_0x299915,function(_0x58d906){if(_0x58d906[_0xb25c('0x3f')]!=='VIRTUAL'){var _0x5d5599={};_0x5d5599[_0x58d906[_0xb25c('0x2b')]]={'$like':'%'+_0x21a669[_0xb25c('0x32')]['filter']+'%'};return _0x5d5599;}})});}_0x417ebe=_[_0xb25c('0x40')]({},_0x417ebe,_0x21a669[_0xb25c('0x41')]);var _0x5e4132={'where':_0x417ebe[_0xb25c('0x3c')]};return db[_0xb25c('0x42')][_0xb25c('0x1e')](_0x5e4132)[_0xb25c('0x27')](function(_0x3766f4){_0x2238eb['count']=_0x3766f4;if(_0x21a669[_0xb25c('0x32')][_0xb25c('0x43')]){_0x417ebe[_0xb25c('0x44')]=[{'all':!![]}];}return db[_0xb25c('0x42')][_0xb25c('0x45')](_0x417ebe);})[_0xb25c('0x27')](function(_0x3ce2cd){_0x2238eb[_0xb25c('0x46')]=_0x3ce2cd;return _0x2238eb;})[_0xb25c('0x27')](respondWithFilteredResult(_0x5345a2,_0x417ebe))[_0xb25c('0x47')](handleError(_0x5345a2,null));};exports[_0xb25c('0x48')]=function(_0x20831c,_0x45bdb3){var _0x3aa68f={'raw':!![],'where':{'id':_0x20831c[_0xb25c('0x49')]['id']}},_0x2210cb={};_0x2210cb[_0xb25c('0x31')]=_[_0xb25c('0x33')](db[_0xb25c('0x42')][_0xb25c('0x2e')]);_0x2210cb[_0xb25c('0x32')]=_['keys'](_0x20831c[_0xb25c('0x32')]);_0x2210cb[_0xb25c('0x34')]=_[_0xb25c('0x36')](_0x2210cb[_0xb25c('0x31')],_0x2210cb['query']);_0x3aa68f[_0xb25c('0x35')]=_[_0xb25c('0x36')](_0x2210cb[_0xb25c('0x31')],qs['fields'](_0x20831c[_0xb25c('0x32')][_0xb25c('0x37')]));_0x3aa68f['attributes']=_0x3aa68f[_0xb25c('0x35')][_0xb25c('0x38')]?_0x3aa68f[_0xb25c('0x35')]:_0x2210cb['model'];if(_0x20831c[_0xb25c('0x32')]['includeAll']){_0x3aa68f[_0xb25c('0x44')]=[{'all':!![]}];}_0x3aa68f=_[_0xb25c('0x40')]({},_0x3aa68f,_0x20831c['options']);return db['SquareRecording'][_0xb25c('0x4a')](_0x3aa68f)[_0xb25c('0x27')](handleEntityNotFound(_0x45bdb3,null))['then'](respondWithResult(_0x45bdb3,null))['catch'](handleError(_0x45bdb3,null));};exports['create']=function(_0x1a06be,_0x2b9c31){return db[_0xb25c('0x42')]['create'](_0x1a06be[_0xb25c('0x4b')],{})['then'](respondWithResult(_0x2b9c31,0xc9))[_0xb25c('0x47')](handleError(_0x2b9c31,null));};exports['update']=function(_0x3e964b,_0x17750f){if(_0x3e964b[_0xb25c('0x4b')]['id']){delete _0x3e964b[_0xb25c('0x4b')]['id'];}return db['SquareRecording'][_0xb25c('0x4a')]({'where':{'id':_0x3e964b[_0xb25c('0x49')]['id']}})['then'](handleEntityNotFound(_0x17750f,null))[_0xb25c('0x27')](saveUpdates(_0x3e964b[_0xb25c('0x4b')],null))[_0xb25c('0x27')](respondWithResult(_0x17750f,null))[_0xb25c('0x47')](handleError(_0x17750f,null));};exports[_0xb25c('0x4c')]=function(_0x22b59c,_0xb555ae,_0x4ff6cf){var _0x4aab2a=require(_0xb25c('0x4d'));var _0x58b433=![];var _0x327aac={};if(_0x22b59c['query'][_0xb25c('0x3f')]&&_0x22b59c[_0xb25c('0x32')][_0xb25c('0x3f')]==='uniqueid'){_0x327aac[_0xb25c('0x4e')]=_0x22b59c[_0xb25c('0x49')]['id'];}else{_0x327aac['id']=_0x22b59c[_0xb25c('0x49')]['id'];}return db[_0xb25c('0x42')]['find']({'where':_0x327aac,'attributes':['id',_0xb25c('0x4f'),_0xb25c('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0xb555ae,null))[_0xb25c('0x27')](function(_0x3b752f){if(_0x3b752f){var _0x1e7208=_0x3b752f[_0xb25c('0x4f')];var _0x28dccd=util[_0xb25c('0x51')](_0xb25c('0x52'),_0x1e7208);if(fs[_0xb25c('0x53')](_0x28dccd)){_0x58b433=!![];return _0x4aab2a[_0xb25c('0x54')](_0x28dccd,_0x1e7208,config[_0xb25c('0x55')][_0xb25c('0x56')])[_0xb25c('0x27')](function(){return _0x3b752f;});}return _0x3b752f;}})[_0xb25c('0x27')](function(_0x2170b0){if(_0x2170b0){var _0x29670e=_0x2170b0[_0xb25c('0x4f')];if(!fs[_0xb25c('0x53')](_0x29670e)){throw new db[(_0xb25c('0x57'))][(_0xb25c('0x58'))](_0xb25c('0x59'));}if(_0x2170b0[_0xb25c('0x50')]){return _0xb555ae['download'](_0x29670e,_0x2170b0[_0xb25c('0x50')]+path[_0xb25c('0x5a')](_0x29670e),function(){if(_0x58b433){fs[_0xb25c('0x5b')](_0x29670e);}});}else{return _0xb555ae['download'](_0x29670e,function(_0x3f89bf){if(_0x58b433){fs[_0xb25c('0x5b')](_0x29670e);}});}}})[_0xb25c('0x47')](function(_0x4bd1fd){if(_0x4bd1fd['message']===_0xb25c('0x59')){_0xb555ae['status'](0x194)[_0xb25c('0x2c')]('Not\x20found');}else{return handleError(_0xb555ae,null);}});};exports[_0xb25c('0x28')]=function(_0x383d0e,_0x2410d0){return db['SquareRecording'][_0xb25c('0x4a')]({'where':{'id':_0x383d0e[_0xb25c('0x49')]['id']}})[_0xb25c('0x27')](function(_0x531898){if(!_0x531898)throw new ReferenceError(_0xb25c('0x5c'));return _0x531898;})[_0xb25c('0x27')](function(_0xbbfa80){var _0x3eeed7=_0xbbfa80[_0xb25c('0x4f')];logger[_0xb25c('0x5d')](_0xb25c('0x5e'),_0x3eeed7);if(!_[_0xb25c('0x5f')](_0xbbfa80[_0xb25c('0x4f')])&&fs[_0xb25c('0x53')](_0x3eeed7)){logger[_0xb25c('0x5d')](_0xb25c('0x60')+_0x3eeed7+_0xb25c('0x61'));fs[_0xb25c('0x62')](_0x3eeed7);}_0x3eeed7=_0x3eeed7+_0xb25c('0x63');if(!_[_0xb25c('0x5f')](_0xbbfa80[_0xb25c('0x4f')])&&fs[_0xb25c('0x53')](_0x3eeed7)){logger[_0xb25c('0x5d')]('File:\x20\x22'+_0x3eeed7+_0xb25c('0x61'));fs[_0xb25c('0x62')](_0x3eeed7);}return _0xbbfa80;})[_0xb25c('0x27')](function(_0x563bcb){if(!_0x563bcb)throw new InternalError();return _0x563bcb['destroy']();})[_0xb25c('0x27')](function(){_0x2410d0[_0xb25c('0x1b')](0xcc)[_0xb25c('0x1c')]();})[_0xb25c('0x47')](handleError(_0x2410d0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6fd3b58..5da4a5d 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 _0xdaa8=['api','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger'];(function(_0x2e81f4,_0x44f46a){var _0x198f70=function(_0x3d41b4){while(--_0x3d41b4){_0x2e81f4['push'](_0x2e81f4['shift']());}};_0x198f70(++_0x44f46a);}(_0xdaa8,0xe4));var _0x8daa=function(_0x402495,_0x4325d3){_0x402495=_0x402495-0x0;var _0x4dde60=_0xdaa8[_0x402495];return _0x4dde60;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var logger=require(_0x8daa('0x2'))(_0x8daa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8daa('0x4'));module[_0x8daa('0x5')]=function(_0x46f753,_0x4d2392){return _0x46f753['define'](_0x8daa('0x6'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa149=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x2c3a17,_0x2f8c63){var _0x131911=function(_0x6fc3d1){while(--_0x6fc3d1){_0x2c3a17['push'](_0x2c3a17['shift']());}};_0x131911(++_0x2f8c63);}(_0xa149,0x18c));var _0x9a14=function(_0x39426b,_0x4aaff1){_0x39426b=_0x39426b-0x0;var _0x25aee0=_0xa149[_0x39426b];return _0x25aee0;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require(_0x9a14('0x7'));var rimraf=require(_0x9a14('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a14('0x9'));module[_0x9a14('0xa')]=function(_0x5abb12,_0x417648){return _0x5abb12[_0x9a14('0xb')](_0x9a14('0xc'),attributes,{'tableName':_0x9a14('0xd'),'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 512d2c4..a20347f 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 _0x8e7a=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','info','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b4b8e,_0x1498b5){var _0x52c671=function(_0x47f2fe){while(--_0x47f2fe){_0x5b4b8e['push'](_0x5b4b8e['shift']());}};_0x52c671(++_0x1498b5);}(_0x8e7a,0x11a));var _0xa8e7=function(_0x2796d7,_0x41d689){_0x2796d7=_0x2796d7-0x0;var _0x2c1203=_0x8e7a[_0x2796d7];return _0x2c1203;};'use strict';var _=require(_0xa8e7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8e7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa8e7('0x2'))(_0xa8e7('0x3'));var config=require(_0xa8e7('0x4'));var jayson=require(_0xa8e7('0x5'));var client=jayson[_0xa8e7('0x6')][_0xa8e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b1b1e,_0x1d7773,_0x595981){return new BPromise(function(_0x2dbd05,_0x3543c9){return client[_0xa8e7('0x8')](_0x2b1b1e,_0x595981)['then'](function(_0x3c58f8){logger['info'](_0xa8e7('0x9'),_0x1d7773,_0xa8e7('0xa'));logger[_0xa8e7('0xb')](_0xa8e7('0xc'),_0x1d7773,_0xa8e7('0xa'),JSON[_0xa8e7('0xd')](_0x3c58f8));if(_0x3c58f8[_0xa8e7('0xe')]){if(_0x3c58f8[_0xa8e7('0xe')][_0xa8e7('0xf')]===0x1f4){logger[_0xa8e7('0xe')](_0xa8e7('0x9'),_0x1d7773,_0x3c58f8[_0xa8e7('0xe')][_0xa8e7('0x10')]);return _0x3543c9(_0x3c58f8[_0xa8e7('0xe')]['message']);}logger[_0xa8e7('0xe')](_0xa8e7('0x9'),_0x1d7773,_0x3c58f8[_0xa8e7('0xe')][_0xa8e7('0x10')]);return _0x2dbd05(_0x3c58f8[_0xa8e7('0xe')][_0xa8e7('0x10')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x1d7773,'request\x20sent');_0x2dbd05(_0x3c58f8[_0xa8e7('0x11')]['message']);}})[_0xa8e7('0x12')](function(_0x10eb64){logger[_0xa8e7('0xe')](_0xa8e7('0x9'),_0x1d7773,_0x10eb64);_0x3543c9(_0x10eb64);});});}exports[_0xa8e7('0x13')]=function(_0x8210f3){var _0x346af3=this;return new Promise(function(_0x2da8d5,_0x350b08){return db[_0xa8e7('0x14')][_0xa8e7('0x15')](_0x8210f3[_0xa8e7('0x16')],{'raw':_0x8210f3[_0xa8e7('0x17')]?_0x8210f3[_0xa8e7('0x17')][_0xa8e7('0x18')]===undefined?!![]:![]:!![]})[_0xa8e7('0x19')](function(_0x4cb8f3){logger[_0xa8e7('0x1a')](_0xa8e7('0x13'),_0x8210f3);logger[_0xa8e7('0xb')](_0xa8e7('0x13'),_0x8210f3,JSON[_0xa8e7('0xd')](_0x4cb8f3));_0x2da8d5(_0x4cb8f3);})['catch'](function(_0xb652f9){logger[_0xa8e7('0xe')](_0xa8e7('0x13'),_0xb652f9[_0xa8e7('0x10')],_0x8210f3);_0x350b08(_0x346af3[_0xa8e7('0xe')](0x1f4,_0xb652f9['message']));});});}; \ No newline at end of file +var _0xec6a=['error','code','message','SquareRecording','create','options','then','CreateSquareRecording','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec6a,0xe1));var _0xaec6=function(_0x9a8aa2,_0x489b68){_0x9a8aa2=_0x9a8aa2-0x0;var _0x45df86=_0xec6a[_0x9a8aa2];return _0x45df86;};'use strict';var _=require(_0xaec6('0x0'));var util=require(_0xaec6('0x1'));var moment=require(_0xaec6('0x2'));var BPromise=require(_0xaec6('0x3'));var rs=require(_0xaec6('0x4'));var fs=require('fs');var Redis=require(_0xaec6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaec6('0x6'));var logger=require('../../config/logger')(_0xaec6('0x7'));var config=require(_0xaec6('0x8'));var jayson=require(_0xaec6('0x9'));var client=jayson[_0xaec6('0xa')][_0xaec6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59ec06,_0x2ad401,_0x2dee5e){return new BPromise(function(_0x19c421,_0x2b341f){return client[_0xaec6('0xc')](_0x59ec06,_0x2dee5e)['then'](function(_0x52d107){logger[_0xaec6('0xd')](_0xaec6('0xe'),_0x2ad401,_0xaec6('0xf'));logger[_0xaec6('0x10')](_0xaec6('0x11'),_0x2ad401,_0xaec6('0xf'),JSON['stringify'](_0x52d107));if(_0x52d107['error']){if(_0x52d107[_0xaec6('0x12')][_0xaec6('0x13')]===0x1f4){logger['error'](_0xaec6('0xe'),_0x2ad401,_0x52d107['error'][_0xaec6('0x14')]);return _0x2b341f(_0x52d107[_0xaec6('0x12')][_0xaec6('0x14')]);}logger['error'](_0xaec6('0xe'),_0x2ad401,_0x52d107[_0xaec6('0x12')]['message']);return _0x19c421(_0x52d107[_0xaec6('0x12')][_0xaec6('0x14')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x2ad401,_0xaec6('0xf'));_0x19c421(_0x52d107['result']['message']);}})['catch'](function(_0x4432cd){logger[_0xaec6('0x12')](_0xaec6('0xe'),_0x2ad401,_0x4432cd);_0x2b341f(_0x4432cd);});});}exports['CreateSquareRecording']=function(_0x772c43){var _0x54c9c5=this;return new Promise(function(_0xc67d69,_0x19b698){return db[_0xaec6('0x15')][_0xaec6('0x16')](_0x772c43['body'],{'raw':_0x772c43[_0xaec6('0x17')]?_0x772c43['options']['raw']===undefined?!![]:![]:!![]})[_0xaec6('0x18')](function(_0x9b773a){logger[_0xaec6('0xd')]('CreateSquareRecording',_0x772c43);logger['debug'](_0xaec6('0x19'),_0x772c43,JSON[_0xaec6('0x1a')](_0x9b773a));_0xc67d69(_0x9b773a);})['catch'](function(_0x5ec4fa){logger[_0xaec6('0x12')](_0xaec6('0x19'),_0x5ec4fa[_0xaec6('0x14')],_0x772c43);_0x19b698(_0x54c9c5['error'](0x1f4,_0x5ec4fa[_0xaec6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 78cb326..af33c49 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 _0x871b=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x871b,0x108));var _0xb871=function(_0xf13915,_0x4e633){_0xf13915=_0xf13915-0x0;var _0x387bbd=_0x871b[_0xf13915];return _0x387bbd;};'use strict';var multer=require(_0xb871('0x0'));var util=require(_0xb871('0x1'));var path=require(_0xb871('0x2'));var timeout=require(_0xb871('0x3'));var express=require(_0xb871('0x4'));var router=express[_0xb871('0x5')]();var auth=require(_0xb871('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb871('0x7'));var controller=require(_0xb871('0x8'));router[_0xb871('0x9')]('/',auth[_0xb871('0xa')](),controller[_0xb871('0xb')]);router[_0xb871('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb871('0xc')]);router[_0xb871('0x9')](_0xb871('0xd'),auth[_0xb871('0xa')](),controller[_0xb871('0xe')]);router['post']('/',auth[_0xb871('0xa')](),controller[_0xb871('0xf')]);router[_0xb871('0x10')](_0xb871('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb871('0x11')](_0xb871('0xd'),auth[_0xb871('0xa')](),controller[_0xb871('0x12')]);module[_0xb871('0x13')]=router; \ No newline at end of file +var _0x802f=['../../config/environment','isAuthenticated','/describe','describe','get','show','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1cc846,_0x4e2462){var _0x39f701=function(_0x4a2b43){while(--_0x4a2b43){_0x1cc846['push'](_0x1cc846['shift']());}};_0x39f701(++_0x4e2462);}(_0x802f,0x11b));var _0xf802=function(_0x24c38e,_0x512304){_0x24c38e=_0x24c38e-0x0;var _0x5070ed=_0x802f[_0x24c38e];return _0x5070ed;};'use strict';var multer=require('multer');var util=require(_0xf802('0x0'));var path=require(_0xf802('0x1'));var timeout=require(_0xf802('0x2'));var express=require(_0xf802('0x3'));var router=express[_0xf802('0x4')]();var auth=require(_0xf802('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf802('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0xf802('0x7')](),controller['index']);router['get'](_0xf802('0x8'),auth['isAuthenticated'](),controller[_0xf802('0x9')]);router[_0xf802('0xa')]('/:id',auth[_0xf802('0x7')](),controller[_0xf802('0xb')]);router['post']('/',auth[_0xf802('0x7')](),controller['create']);router['put']('/:id',auth[_0xf802('0x7')](),controller[_0xf802('0xc')]);router[_0xf802('0xd')](_0xf802('0xe'),auth['isAuthenticated'](),controller[_0xf802('0xf')]);module[_0xf802('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4418732..e337b76 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 _0x77bb=['STRING','BOOLEAN'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x77bb,0x162));var _0xb77b=function(_0x87d520,_0x3e34a5){_0x87d520=_0x87d520-0x0;var _0x1c5c4f=_0x77bb[_0x87d520];return _0x1c5c4f;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb77b('0x0')]},'request':{'type':Sequelize[_0xb77b('0x0')]},'channel':{'type':Sequelize[_0xb77b('0x0')]},'language':{'type':Sequelize[_0xb77b('0x0')]},'type':{'type':Sequelize[_0xb77b('0x0')]},'uniqueid':{'type':Sequelize[_0xb77b('0x0')]},'version':{'type':Sequelize[_0xb77b('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb77b('0x0')]},'callingpres':{'type':Sequelize[_0xb77b('0x0')]},'callingani2':{'type':Sequelize[_0xb77b('0x0')]},'callington':{'type':Sequelize[_0xb77b('0x0')]},'callingtns':{'type':Sequelize[_0xb77b('0x0')]},'dnid':{'type':Sequelize[_0xb77b('0x0')]},'rdnis':{'type':Sequelize[_0xb77b('0x0')]},'context':{'type':Sequelize[_0xb77b('0x0')]},'extension':{'type':Sequelize[_0xb77b('0x0')]},'priority':{'type':Sequelize[_0xb77b('0x0')]},'enhanced':{'type':Sequelize[_0xb77b('0x0')]},'accountcode':{'type':Sequelize[_0xb77b('0x0')]},'threadid':{'type':Sequelize[_0xb77b('0x0')]},'project_name':{'type':Sequelize[_0xb77b('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb77b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x163e=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0x163e,0x194));var _0xe163=function(_0x277c19,_0x22f714){_0x277c19=_0x277c19-0x0;var _0x3281e5=_0x163e[_0x277c19];return _0x3281e5;};'use strict';var Sequelize=require(_0xe163('0x0'));module[_0xe163('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe163('0x2')]},'request':{'type':Sequelize[_0xe163('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe163('0x2')]},'uniqueid':{'type':Sequelize[_0xe163('0x2')]},'version':{'type':Sequelize[_0xe163('0x2')]},'callerid':{'type':Sequelize[_0xe163('0x2')]},'calleridname':{'type':Sequelize[_0xe163('0x2')]},'callingpres':{'type':Sequelize[_0xe163('0x2')]},'callingani2':{'type':Sequelize[_0xe163('0x2')]},'callington':{'type':Sequelize[_0xe163('0x2')]},'callingtns':{'type':Sequelize[_0xe163('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xe163('0x2')]},'context':{'type':Sequelize[_0xe163('0x2')]},'extension':{'type':Sequelize[_0xe163('0x2')]},'priority':{'type':Sequelize[_0xe163('0x2')]},'enhanced':{'type':Sequelize[_0xe163('0x2')]},'accountcode':{'type':Sequelize[_0xe163('0x2')]},'threadid':{'type':Sequelize[_0xe163('0x2')]},'project_name':{'type':Sequelize[_0xe163('0x2')]},'joinAt':{'type':Sequelize[_0xe163('0x3')]},'leaveAt':{'type':Sequelize[_0xe163('0x3')]},'bot':{'type':Sequelize[_0xe163('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 2c2374d..31514e8 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 _0xdb8b=['save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','includeAll','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','count','offset','set','apply','reject'];(function(_0x5ccd11,_0x153a11){var _0xed493=function(_0x70a950){while(--_0x70a950){_0x5ccd11['push'](_0x5ccd11['shift']());}};_0xed493(++_0x153a11);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4e6107,_0x432765){_0x4e6107=_0x4e6107-0x0;var _0x5af117=_0xdb8b[_0x4e6107];return _0x5af117;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdb8('0x0'));var rimraf=require(_0xbdb8('0x1'));var zipdir=require(_0xbdb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbdb8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbdb8('0x4'));var util=require(_0xbdb8('0x5'));var path=require(_0xbdb8('0x6'));var sox=require(_0xbdb8('0x7'));var csv=require('to-csv');var ejs=require(_0xbdb8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbdb8('0x9'));var crypto=require(_0xbdb8('0xa'));var jsforce=require(_0xbdb8('0xb'));var deskjs=require(_0xbdb8('0xc'));var toCsv=require(_0xbdb8('0xd'));var querystring=require(_0xbdb8('0xe'));var Papa=require('papaparse');var Redis=require(_0xbdb8('0xf'));var authService=require(_0xbdb8('0x10'));var qs=require(_0xbdb8('0x11'));var as=require(_0xbdb8('0x12'));var hardwareService=require(_0xbdb8('0x13'));var logger=require(_0xbdb8('0x14'))(_0xbdb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdb8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x74d1a,_0x5ad84f){_0x5ad84f=_0x5ad84f||0xcc;return function(_0x3c520b){if(_0x3c520b){return _0x74d1a['sendStatus'](_0x5ad84f);}return _0x74d1a[_0xbdb8('0x17')](_0x5ad84f)[_0xbdb8('0x18')]();};}function respondWithResult(_0x1e8888,_0x407bd0){_0x407bd0=_0x407bd0||0xc8;return function(_0x20984d){if(_0x20984d){return _0x1e8888[_0xbdb8('0x17')](_0x407bd0)[_0xbdb8('0x19')](_0x20984d);}};}function respondWithFilteredResult(_0x207187,_0x149568){return function(_0xcf6e71){if(_0xcf6e71){var _0x3d583b=_0xcf6e71[_0xbdb8('0x1a')],_0x1985cb=_0x149568[_0xbdb8('0x1b')],_0x29b2f7=_0x149568[_0xbdb8('0x1b')]+_0x149568['limit'],_0x5438df;if(_0x29b2f7>=_0x3d583b){_0x29b2f7=_0x3d583b;_0x5438df=0xc8;}else{_0x5438df=0xce;}_0x207187['status'](_0x5438df);return _0x207187[_0xbdb8('0x1c')]('Content-Range',_0x1985cb+'-'+_0x29b2f7+'/'+_0x3d583b)[_0xbdb8('0x19')](_0xcf6e71);}return null;};}function patchUpdates(_0x303557){return function(_0xb496f8){try{jsonpatch[_0xbdb8('0x1d')](_0xb496f8,_0x303557,!![]);}catch(_0x3a177d){return BPromise[_0xbdb8('0x1e')](_0x3a177d);}return _0xb496f8[_0xbdb8('0x1f')]();};}function saveUpdates(_0x437095,_0x3cc214){return function(_0x131adc){if(_0x131adc){return _0x131adc[_0xbdb8('0x20')](_0x437095)[_0xbdb8('0x21')](function(_0x51c4c3){return _0x51c4c3;});}return null;};}function removeEntity(_0x25b131,_0x2074e0){return function(_0x3588ee){if(_0x3588ee){return _0x3588ee[_0xbdb8('0x22')]()[_0xbdb8('0x21')](function(){_0x25b131[_0xbdb8('0x17')](0xcc)[_0xbdb8('0x18')]();});}};}function handleEntityNotFound(_0x2a31e6,_0x50c6db){return function(_0x1b99df){if(!_0x1b99df){_0x2a31e6['sendStatus'](0x194);}return _0x1b99df;};}function handleError(_0x167edd,_0x2b3d5e){_0x2b3d5e=_0x2b3d5e||0x1f4;return function(_0x4e9e42){logger[_0xbdb8('0x23')](_0x4e9e42[_0xbdb8('0x24')]);if(_0x4e9e42['name']){delete _0x4e9e42[_0xbdb8('0x25')];}_0x167edd[_0xbdb8('0x17')](_0x2b3d5e)[_0xbdb8('0x26')](_0x4e9e42);};}exports[_0xbdb8('0x27')]=function(_0x3dedcb,_0x2fe157){var _0x325233={},_0x593db0={},_0x3c3138={'count':0x0,'rows':[]};var _0x5d0fd7=_['map'](db[_0xbdb8('0x28')][_0xbdb8('0x29')],function(_0x459231){return{'name':_0x459231[_0xbdb8('0x2a')],'type':_0x459231['type'][_0xbdb8('0x2b')]};});_0x593db0[_0xbdb8('0x2c')]=_[_0xbdb8('0x2d')](_0x5d0fd7,_0xbdb8('0x25'));_0x593db0['query']=_[_0xbdb8('0x2e')](_0x3dedcb[_0xbdb8('0x2f')]);_0x593db0[_0xbdb8('0x30')]=_[_0xbdb8('0x31')](_0x593db0[_0xbdb8('0x2c')],_0x593db0[_0xbdb8('0x2f')]);_0x325233[_0xbdb8('0x32')]=_['intersection'](_0x593db0[_0xbdb8('0x2c')],qs[_0xbdb8('0x33')](_0x3dedcb['query']['fields']));_0x325233[_0xbdb8('0x32')]=_0x325233[_0xbdb8('0x32')][_0xbdb8('0x34')]?_0x325233['attributes']:_0x593db0[_0xbdb8('0x2c')];if(!_0x3dedcb[_0xbdb8('0x2f')][_0xbdb8('0x35')](_0xbdb8('0x36'))){_0x325233['limit']=qs[_0xbdb8('0x37')](_0x3dedcb['query']['limit']);_0x325233[_0xbdb8('0x1b')]=qs[_0xbdb8('0x1b')](_0x3dedcb['query'][_0xbdb8('0x1b')]);}_0x325233['order']=qs[_0xbdb8('0x38')](_0x3dedcb[_0xbdb8('0x2f')]['sort']);_0x325233[_0xbdb8('0x39')]=qs[_0xbdb8('0x30')](_[_0xbdb8('0x3a')](_0x3dedcb[_0xbdb8('0x2f')],_0x593db0['filters']),_0x5d0fd7);if(_0x3dedcb[_0xbdb8('0x2f')][_0xbdb8('0x3b')]){_0x325233[_0xbdb8('0x39')]=_['merge'](_0x325233['where'],{'$or':_[_0xbdb8('0x2d')](_0x5d0fd7,function(_0x2f1c79){if(_0x2f1c79['type']!=='VIRTUAL'){var _0x4a7660={};_0x4a7660[_0x2f1c79[_0xbdb8('0x25')]]={'$like':'%'+_0x3dedcb[_0xbdb8('0x2f')][_0xbdb8('0x3b')]+'%'};return _0x4a7660;}})});}_0x325233=_['merge']({},_0x325233,_0x3dedcb[_0xbdb8('0x3c')]);var _0x89b5cf={'where':_0x325233['where']};return db['SquareReport'][_0xbdb8('0x1a')](_0x89b5cf)[_0xbdb8('0x21')](function(_0x30acc5){_0x3c3138[_0xbdb8('0x1a')]=_0x30acc5;if(_0x3dedcb['query'][_0xbdb8('0x3d')]){_0x325233['include']=[{'all':!![]}];}return db[_0xbdb8('0x28')]['findAll'](_0x325233);})[_0xbdb8('0x21')](function(_0x325a28){_0x3c3138['rows']=_0x325a28;return _0x3c3138;})['then'](respondWithFilteredResult(_0x2fe157,_0x325233))[_0xbdb8('0x3e')](handleError(_0x2fe157,null));};exports['show']=function(_0x7c9cf6,_0x3006a1){var _0x5705bf={'raw':!![],'where':{'id':_0x7c9cf6[_0xbdb8('0x3f')]['id']}},_0x33a1aa={};_0x33a1aa[_0xbdb8('0x2c')]=_[_0xbdb8('0x2e')](db[_0xbdb8('0x28')][_0xbdb8('0x29')]);_0x33a1aa[_0xbdb8('0x2f')]=_['keys'](_0x7c9cf6['query']);_0x33a1aa[_0xbdb8('0x30')]=_[_0xbdb8('0x31')](_0x33a1aa[_0xbdb8('0x2c')],_0x33a1aa['query']);_0x5705bf[_0xbdb8('0x32')]=_[_0xbdb8('0x31')](_0x33a1aa[_0xbdb8('0x2c')],qs[_0xbdb8('0x33')](_0x7c9cf6[_0xbdb8('0x2f')][_0xbdb8('0x33')]));_0x5705bf[_0xbdb8('0x32')]=_0x5705bf[_0xbdb8('0x32')]['length']?_0x5705bf[_0xbdb8('0x32')]:_0x33a1aa[_0xbdb8('0x2c')];if(_0x7c9cf6[_0xbdb8('0x2f')][_0xbdb8('0x3d')]){_0x5705bf[_0xbdb8('0x40')]=[{'all':!![]}];}_0x5705bf=_['merge']({},_0x5705bf,_0x7c9cf6[_0xbdb8('0x3c')]);return db[_0xbdb8('0x28')][_0xbdb8('0x41')](_0x5705bf)['then'](handleEntityNotFound(_0x3006a1,null))[_0xbdb8('0x21')](respondWithResult(_0x3006a1,null))[_0xbdb8('0x3e')](handleError(_0x3006a1,null));};exports[_0xbdb8('0x42')]=function(_0x517070,_0x46ed4d){return db[_0xbdb8('0x28')][_0xbdb8('0x42')](_0x517070[_0xbdb8('0x43')],{})['then'](respondWithResult(_0x46ed4d,0xc9))[_0xbdb8('0x3e')](handleError(_0x46ed4d,null));};exports['update']=function(_0x36da0f,_0x50acf1){if(_0x36da0f[_0xbdb8('0x43')]['id']){delete _0x36da0f[_0xbdb8('0x43')]['id'];}return db[_0xbdb8('0x28')][_0xbdb8('0x41')]({'where':{'id':_0x36da0f['params']['id']}})[_0xbdb8('0x21')](handleEntityNotFound(_0x50acf1,null))[_0xbdb8('0x21')](saveUpdates(_0x36da0f[_0xbdb8('0x43')],null))[_0xbdb8('0x21')](respondWithResult(_0x50acf1,null))[_0xbdb8('0x3e')](handleError(_0x50acf1,null));};exports['destroy']=function(_0x1881cf,_0x1fc910){return db['SquareReport'][_0xbdb8('0x41')]({'where':{'id':_0x1881cf[_0xbdb8('0x3f')]['id']}})[_0xbdb8('0x21')](handleEntityNotFound(_0x1fc910,null))['then'](removeEntity(_0x1fc910,null))['catch'](handleError(_0x1fc910,null));};exports[_0xbdb8('0x44')]=function(_0x32680a,_0x1b5030){return db[_0xbdb8('0x28')][_0xbdb8('0x44')]()['then'](respondWithResult(_0x1b5030,null))[_0xbdb8('0x3e')](handleError(_0x1b5030,null));}; \ No newline at end of file +var _0x7e4b=['../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x533a5b,_0x426d5a){var _0x511ba7=function(_0x1ca179){while(--_0x1ca179){_0x533a5b['push'](_0x533a5b['shift']());}};_0x511ba7(++_0x426d5a);}(_0x7e4b,0x84));var _0xb7e4=function(_0x530603,_0x17e001){_0x530603=_0x530603-0x0;var _0xcbe0d2=_0x7e4b[_0x530603];return _0xcbe0d2;};'use strict';var pdf=require(_0xb7e4('0x0'));var emlformat=require(_0xb7e4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb7e4('0x2'));var jsonpatch=require(_0xb7e4('0x3'));var rp=require('request-promise');var moment=require(_0xb7e4('0x4'));var BPromise=require(_0xb7e4('0x5'));var Mustache=require(_0xb7e4('0x6'));var util=require(_0xb7e4('0x7'));var path=require(_0xb7e4('0x8'));var sox=require(_0xb7e4('0x9'));var csv=require(_0xb7e4('0xa'));var ejs=require(_0xb7e4('0xb'));var fs=require('fs');var _=require(_0xb7e4('0xc'));var squel=require('squel');var crypto=require(_0xb7e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7e4('0xe'));var toCsv=require(_0xb7e4('0xa'));var querystring=require(_0xb7e4('0xf'));var Papa=require(_0xb7e4('0x10'));var Redis=require(_0xb7e4('0x11'));var authService=require(_0xb7e4('0x12'));var qs=require(_0xb7e4('0x13'));var as=require(_0xb7e4('0x14'));var hardwareService=require(_0xb7e4('0x15'));var logger=require(_0xb7e4('0x16'))(_0xb7e4('0x17'));var utils=require(_0xb7e4('0x18'));var config=require(_0xb7e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb7fe30,_0x1b80aa){_0x1b80aa=_0x1b80aa||0xcc;return function(_0x526944){if(_0x526944){return _0xb7fe30[_0xb7e4('0x1a')](_0x1b80aa);}return _0xb7fe30[_0xb7e4('0x1b')](_0x1b80aa)[_0xb7e4('0x1c')]();};}function respondWithResult(_0xc2be7d,_0x2acf77){_0x2acf77=_0x2acf77||0xc8;return function(_0x1b9a09){if(_0x1b9a09){return _0xc2be7d[_0xb7e4('0x1b')](_0x2acf77)[_0xb7e4('0x1d')](_0x1b9a09);}};}function respondWithFilteredResult(_0x18938c,_0x3600be){return function(_0x15653d){if(_0x15653d){var _0x983d60=_0x15653d[_0xb7e4('0x1e')],_0x70481a=_0x3600be[_0xb7e4('0x1f')],_0x3a08f1=_0x3600be[_0xb7e4('0x1f')]+_0x3600be[_0xb7e4('0x20')],_0x4d4220;if(_0x3a08f1>=_0x983d60){_0x3a08f1=_0x983d60;_0x4d4220=0xc8;}else{_0x4d4220=0xce;}_0x18938c[_0xb7e4('0x1b')](_0x4d4220);return _0x18938c[_0xb7e4('0x21')](_0xb7e4('0x22'),_0x70481a+'-'+_0x3a08f1+'/'+_0x983d60)[_0xb7e4('0x1d')](_0x15653d);}return null;};}function patchUpdates(_0x48aaaf){return function(_0x393ffe){try{jsonpatch['apply'](_0x393ffe,_0x48aaaf,!![]);}catch(_0x3385de){return BPromise[_0xb7e4('0x23')](_0x3385de);}return _0x393ffe[_0xb7e4('0x24')]();};}function saveUpdates(_0x59044f,_0x37c71a){return function(_0x517165){if(_0x517165){return _0x517165[_0xb7e4('0x25')](_0x59044f)[_0xb7e4('0x26')](function(_0x3d4172){return _0x3d4172;});}return null;};}function removeEntity(_0x391114,_0x18e4fb){return function(_0xba07f){if(_0xba07f){return _0xba07f['destroy']()[_0xb7e4('0x26')](function(){_0x391114[_0xb7e4('0x1b')](0xcc)[_0xb7e4('0x1c')]();});}};}function handleEntityNotFound(_0x2eec58,_0x56e2e6){return function(_0x10bf2b){if(!_0x10bf2b){_0x2eec58[_0xb7e4('0x1a')](0x194);}return _0x10bf2b;};}function handleError(_0x56d9cc,_0x435816){_0x435816=_0x435816||0x1f4;return function(_0xedb514){logger[_0xb7e4('0x27')](_0xedb514['stack']);if(_0xedb514[_0xb7e4('0x28')]){delete _0xedb514[_0xb7e4('0x28')];}_0x56d9cc['status'](_0x435816)[_0xb7e4('0x29')](_0xedb514);};}exports[_0xb7e4('0x2a')]=function(_0x4f260f,_0x1a9d1c){var _0xd0b54c={},_0x33a80e={},_0x5a2782={'count':0x0,'rows':[]};var _0x14d9b9=_[_0xb7e4('0x2b')](db[_0xb7e4('0x2c')][_0xb7e4('0x2d')],function(_0x41011d){return{'name':_0x41011d[_0xb7e4('0x2e')],'type':_0x41011d[_0xb7e4('0x2f')][_0xb7e4('0x30')]};});_0x33a80e[_0xb7e4('0x31')]=_[_0xb7e4('0x2b')](_0x14d9b9,_0xb7e4('0x28'));_0x33a80e[_0xb7e4('0x32')]=_[_0xb7e4('0x33')](_0x4f260f['query']);_0x33a80e[_0xb7e4('0x34')]=_[_0xb7e4('0x35')](_0x33a80e[_0xb7e4('0x31')],_0x33a80e[_0xb7e4('0x32')]);_0xd0b54c['attributes']=_[_0xb7e4('0x35')](_0x33a80e[_0xb7e4('0x31')],qs[_0xb7e4('0x36')](_0x4f260f[_0xb7e4('0x32')][_0xb7e4('0x36')]));_0xd0b54c['attributes']=_0xd0b54c[_0xb7e4('0x37')]['length']?_0xd0b54c[_0xb7e4('0x37')]:_0x33a80e[_0xb7e4('0x31')];if(!_0x4f260f[_0xb7e4('0x32')][_0xb7e4('0x38')](_0xb7e4('0x39'))){_0xd0b54c[_0xb7e4('0x20')]=qs[_0xb7e4('0x20')](_0x4f260f[_0xb7e4('0x32')][_0xb7e4('0x20')]);_0xd0b54c['offset']=qs[_0xb7e4('0x1f')](_0x4f260f[_0xb7e4('0x32')][_0xb7e4('0x1f')]);}_0xd0b54c[_0xb7e4('0x3a')]=qs[_0xb7e4('0x3b')](_0x4f260f['query'][_0xb7e4('0x3b')]);_0xd0b54c[_0xb7e4('0x3c')]=qs['filters'](_[_0xb7e4('0x3d')](_0x4f260f['query'],_0x33a80e['filters']),_0x14d9b9);if(_0x4f260f[_0xb7e4('0x32')][_0xb7e4('0x3e')]){_0xd0b54c['where']=_[_0xb7e4('0x3f')](_0xd0b54c[_0xb7e4('0x3c')],{'$or':_[_0xb7e4('0x2b')](_0x14d9b9,function(_0x2365f1){if(_0x2365f1[_0xb7e4('0x2f')]!==_0xb7e4('0x40')){var _0x333398={};_0x333398[_0x2365f1[_0xb7e4('0x28')]]={'$like':'%'+_0x4f260f['query']['filter']+'%'};return _0x333398;}})});}_0xd0b54c=_[_0xb7e4('0x3f')]({},_0xd0b54c,_0x4f260f[_0xb7e4('0x41')]);var _0x2b2514={'where':_0xd0b54c['where']};return db[_0xb7e4('0x2c')][_0xb7e4('0x1e')](_0x2b2514)['then'](function(_0x46099b){_0x5a2782['count']=_0x46099b;if(_0x4f260f[_0xb7e4('0x32')]['includeAll']){_0xd0b54c[_0xb7e4('0x42')]=[{'all':!![]}];}return db[_0xb7e4('0x2c')][_0xb7e4('0x43')](_0xd0b54c);})[_0xb7e4('0x26')](function(_0x54e526){_0x5a2782[_0xb7e4('0x44')]=_0x54e526;return _0x5a2782;})['then'](respondWithFilteredResult(_0x1a9d1c,_0xd0b54c))[_0xb7e4('0x45')](handleError(_0x1a9d1c,null));};exports[_0xb7e4('0x46')]=function(_0x50478e,_0x27115e){var _0x3d3bdb={'raw':!![],'where':{'id':_0x50478e['params']['id']}},_0x389fb7={};_0x389fb7[_0xb7e4('0x31')]=_[_0xb7e4('0x33')](db['SquareReport'][_0xb7e4('0x2d')]);_0x389fb7[_0xb7e4('0x32')]=_['keys'](_0x50478e[_0xb7e4('0x32')]);_0x389fb7['filters']=_['intersection'](_0x389fb7[_0xb7e4('0x31')],_0x389fb7[_0xb7e4('0x32')]);_0x3d3bdb['attributes']=_[_0xb7e4('0x35')](_0x389fb7[_0xb7e4('0x31')],qs[_0xb7e4('0x36')](_0x50478e[_0xb7e4('0x32')][_0xb7e4('0x36')]));_0x3d3bdb[_0xb7e4('0x37')]=_0x3d3bdb[_0xb7e4('0x37')]['length']?_0x3d3bdb[_0xb7e4('0x37')]:_0x389fb7[_0xb7e4('0x31')];if(_0x50478e[_0xb7e4('0x32')][_0xb7e4('0x47')]){_0x3d3bdb['include']=[{'all':!![]}];}_0x3d3bdb=_[_0xb7e4('0x3f')]({},_0x3d3bdb,_0x50478e[_0xb7e4('0x41')]);return db[_0xb7e4('0x2c')][_0xb7e4('0x48')](_0x3d3bdb)[_0xb7e4('0x26')](handleEntityNotFound(_0x27115e,null))[_0xb7e4('0x26')](respondWithResult(_0x27115e,null))[_0xb7e4('0x45')](handleError(_0x27115e,null));};exports[_0xb7e4('0x49')]=function(_0x1d3cbd,_0x1870c5){return db[_0xb7e4('0x2c')][_0xb7e4('0x49')](_0x1d3cbd[_0xb7e4('0x4a')],{})[_0xb7e4('0x26')](respondWithResult(_0x1870c5,0xc9))[_0xb7e4('0x45')](handleError(_0x1870c5,null));};exports['update']=function(_0x10b657,_0x11df2b){if(_0x10b657[_0xb7e4('0x4a')]['id']){delete _0x10b657[_0xb7e4('0x4a')]['id'];}return db[_0xb7e4('0x2c')][_0xb7e4('0x48')]({'where':{'id':_0x10b657[_0xb7e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11df2b,null))[_0xb7e4('0x26')](saveUpdates(_0x10b657['body'],null))[_0xb7e4('0x26')](respondWithResult(_0x11df2b,null))[_0xb7e4('0x45')](handleError(_0x11df2b,null));};exports[_0xb7e4('0x4c')]=function(_0x1f324d,_0x48b5bc){return db[_0xb7e4('0x2c')][_0xb7e4('0x48')]({'where':{'id':_0x1f324d[_0xb7e4('0x4b')]['id']}})[_0xb7e4('0x26')](handleEntityNotFound(_0x48b5bc,null))[_0xb7e4('0x26')](removeEntity(_0x48b5bc,null))[_0xb7e4('0x45')](handleError(_0x48b5bc,null));};exports['describe']=function(_0x276e52,_0x10744b){return db[_0xb7e4('0x2c')][_0xb7e4('0x4d')]()[_0xb7e4('0x26')](respondWithResult(_0x10744b,null))[_0xb7e4('0x45')](handleError(_0x10744b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 198bc89..07a81b8 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 _0xc47e=['api','moment','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','util','../../config/logger'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xc47e,0x194));var _0xec47=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0xc47e[_0x4ded65];return _0x5864fb;};'use strict';var _=require('lodash');var util=require(_0xec47('0x0'));var logger=require(_0xec47('0x1'))(_0xec47('0x2'));var moment=require(_0xec47('0x3'));var BPromise=require('bluebird');var rp=require(_0xec47('0x4'));var fs=require('fs');var path=require(_0xec47('0x5'));var rimraf=require(_0xec47('0x6'));var config=require('../../config/environment');var attributes=require(_0xec47('0x7'));module[_0xec47('0x8')]=function(_0xb32c4c,_0x2589a7){return _0xb32c4c['define'](_0xec47('0x9'),attributes,{'tableName':_0xec47('0xa'),'paranoid':![],'indexes':[{'name':_0xec47('0xb'),'fields':[_0xec47('0xc'),_0xec47('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x28b2=['uniqueid','project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_square'];(function(_0x179535,_0x494780){var _0x11ef66=function(_0x5d924f){while(--_0x5d924f){_0x179535['push'](_0x179535['shift']());}};_0x11ef66(++_0x494780);}(_0x28b2,0x65));var _0x228b=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x28b2[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x228b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x228b('0x1'));var moment=require(_0x228b('0x2'));var BPromise=require(_0x228b('0x3'));var rp=require(_0x228b('0x4'));var fs=require('fs');var path=require(_0x228b('0x5'));var rimraf=require(_0x228b('0x6'));var config=require(_0x228b('0x7'));var attributes=require('./squareReport.attributes');module[_0x228b('0x8')]=function(_0x34847c,_0x268f3e){return _0x34847c[_0x228b('0x9')]('SquareReport',attributes,{'tableName':_0x228b('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x228b('0xb'),_0x228b('0xc')]},{'name':_0x228b('0xd'),'fields':[_0x228b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6fccf5b..01e4347 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 _0x31f0=['attributes','limit','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport'];(function(_0x419b51,_0xec84a7){var _0x111509=function(_0x30879d){while(--_0x30879d){_0x419b51['push'](_0x419b51['shift']());}};_0x111509(++_0xec84a7);}(_0x31f0,0xb7));var _0x031f=function(_0x391c6d,_0x1c8757){_0x391c6d=_0x391c6d-0x0;var _0x1a08ff=_0x31f0[_0x391c6d];return _0x1a08ff;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('SquareReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});}exports[_0x031f('0x13')]=function(_0x535e70){var _0x421f75=this;return new Promise(function(_0x5f2199,_0x563bc8){return db[_0x031f('0x14')][_0x031f('0x15')](_0x535e70[_0x031f('0x16')],{'raw':_0x535e70[_0x031f('0x17')]?_0x535e70[_0x031f('0x17')][_0x031f('0x18')]===undefined?!![]:![]:!![]})[_0x031f('0x19')](function(_0x29dd6e){logger['info'](_0x031f('0x13'),_0x535e70);logger[_0x031f('0xc')](_0x031f('0x13'),_0x535e70,JSON['stringify'](_0x29dd6e));_0x5f2199(_0x29dd6e);})['catch'](function(_0xa11a2b){logger['error'](_0x031f('0x13'),_0xa11a2b['message'],_0x535e70);_0x563bc8(_0x421f75['error'](0x1f4,_0xa11a2b['message']));});});};exports[_0x031f('0x1a')]=function(_0x12c406){var _0x2920cd=this;return new Promise(function(_0x4c8126,_0x494568){return db[_0x031f('0x14')]['update'](_0x12c406[_0x031f('0x16')],{'raw':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['where']||null:null,'attributes':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')][_0x031f('0x1b')]||null:null,'limit':_0x12c406['options']?_0x12c406[_0x031f('0x17')][_0x031f('0x1c')]||null:null})[_0x031f('0x19')](function(_0xaf5bea){logger[_0x031f('0x9')](_0x031f('0x1a'),_0x12c406);logger['debug'](_0x031f('0x1a'),_0x12c406,JSON[_0x031f('0xe')](_0xaf5bea));_0x4c8126(_0xaf5bea);})[_0x031f('0x1d')](function(_0x2ea861){logger[_0x031f('0xf')](_0x031f('0x1a'),_0x2ea861[_0x031f('0x11')],_0x12c406);_0x494568(_0x2920cd[_0x031f('0xf')](0x1f4,_0x2ea861[_0x031f('0x11')]));});});}; \ No newline at end of file +var _0x81bd=['error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1769e5,_0x449f13){var _0x153de8=function(_0x4ca2c2){while(--_0x4ca2c2){_0x1769e5['push'](_0x1769e5['shift']());}};_0x153de8(++_0x449f13);}(_0x81bd,0x7c));var _0xd81b=function(_0x35cc24,_0x299db6){_0x35cc24=_0x35cc24-0x0;var _0x137359=_0x81bd[_0x35cc24];return _0x137359;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('SquareReport,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('SquareReport,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});}exports[_0xd81b('0x19')]=function(_0xc49b8d){var _0x6746f0=this;return new Promise(function(_0x3d4d34,_0x1c34c5){return db[_0xd81b('0x1a')][_0xd81b('0x1b')](_0xc49b8d[_0xd81b('0x1c')],{'raw':_0xc49b8d[_0xd81b('0x1d')]?_0xc49b8d[_0xd81b('0x1d')][_0xd81b('0x1e')]===undefined?!![]:![]:!![]})[_0xd81b('0xd')](function(_0x5f101a){logger['info'](_0xd81b('0x19'),_0xc49b8d);logger[_0xd81b('0x11')](_0xd81b('0x19'),_0xc49b8d,JSON['stringify'](_0x5f101a));_0x3d4d34(_0x5f101a);})[_0xd81b('0x18')](function(_0x6571a6){logger['error'](_0xd81b('0x19'),_0x6571a6[_0xd81b('0x16')],_0xc49b8d);_0x1c34c5(_0x6746f0[_0xd81b('0x14')](0x1f4,_0x6571a6[_0xd81b('0x16')]));});});};exports[_0xd81b('0x1f')]=function(_0xcb4f91){var _0x255011=this;return new Promise(function(_0x5ecba9,_0x341aec){return db[_0xd81b('0x1a')][_0xd81b('0x20')](_0xcb4f91[_0xd81b('0x1c')],{'raw':_0xcb4f91['options']?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x21')]||null:null,'attributes':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x22')]||null:null,'limit':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91['options'][_0xd81b('0x23')]||null:null})['then'](function(_0x5c8aee){logger[_0xd81b('0xe')](_0xd81b('0x1f'),_0xcb4f91);logger['debug']('UpdateSquareReport',_0xcb4f91,JSON[_0xd81b('0x13')](_0x5c8aee));_0x5ecba9(_0x5c8aee);})[_0xd81b('0x18')](function(_0x1b1434){logger[_0xd81b('0x14')](_0xd81b('0x1f'),_0x1b1434[_0xd81b('0x16')],_0xcb4f91);_0x341aec(_0x255011['error'](0x1f4,_0x1b1434[_0xd81b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 02b05b0..e596d48 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(_0x202b53,_0x23f2a4){var _0x29e4fd=function(_0xa9264f){while(--_0xa9264f){_0x202b53['push'](_0x202b53['shift']());}};_0x29e4fd(++_0x23f2a4);}(_0x7a54,0x106));var _0x47a5=function(_0x1d53fc,_0x17bb73){_0x1d53fc=_0x1d53fc-0x0;var _0x1d1c57=_0x7a54[_0x1d53fc];return _0x1d1c57;};'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(_0x14a6ec,_0x8a537e){var _0x1ef5f6=function(_0x3b5a1c){while(--_0x3b5a1c){_0x14a6ec['push'](_0x14a6ec['shift']());}};_0x1ef5f6(++_0x8a537e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1dc8fa,_0x48a6a1){_0x1dc8fa=_0x1dc8fa-0x0;var _0x373234=_0x5f2f[_0x1dc8fa];return _0x373234;};'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 36b60bd..0346760 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 _0xaa2a=['TEXT','sequelize','STRING'];(function(_0x3805a7,_0x17fbed){var _0x2f2fe8=function(_0x2e1598){while(--_0x2e1598){_0x3805a7['push'](_0x3805a7['shift']());}};_0x2f2fe8(++_0x17fbed);}(_0xaa2a,0x190));var _0xaaa2=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xaa2a[_0x45313f];return _0x402910;};'use strict';var Sequelize=require(_0xaaa2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xaaa2('0x1')]},'node':{'type':Sequelize[_0xaaa2('0x1')]},'application':{'type':Sequelize[_0xaaa2('0x1')]},'data':{'type':Sequelize[_0xaaa2('0x2')]},'project_name':{'type':Sequelize[_0xaaa2('0x1')]},'callerid':{'type':Sequelize[_0xaaa2('0x1')]}}; \ No newline at end of file +var _0xe593=['STRING','sequelize','exports'];(function(_0x2d6f5d,_0x3e855b){var _0x5e3f03=function(_0x141a9b){while(--_0x141a9b){_0x2d6f5d['push'](_0x2d6f5d['shift']());}};_0x5e3f03(++_0x3e855b);}(_0xe593,0x124));var _0x3e59=function(_0x27d25c,_0x16faa3){_0x27d25c=_0x27d25c-0x0;var _0x4615ed=_0xe593[_0x27d25c];return _0x4615ed;};'use strict';var Sequelize=require(_0x3e59('0x0'));module[_0x3e59('0x1')]={'uniqueid':{'type':Sequelize[_0x3e59('0x2')]},'node':{'type':Sequelize[_0x3e59('0x2')]},'application':{'type':Sequelize[_0x3e59('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3e59('0x2')]},'callerid':{'type':Sequelize[_0x3e59('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5cd1803..171c013 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 _0x0f6c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','SquareDetailsReport','includeAll','findAll','rows','catch','show','keys','merge','options','create','body','params','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x5704f4,_0x1df296){var _0x3880d7=function(_0x24631b){while(--_0x24631b){_0x5704f4['push'](_0x5704f4['shift']());}};_0x3880d7(++_0x1df296);}(_0x0f6c,0x1d4));var _0xc0f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0f6c[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xc0f6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc0f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0f6('0x2'));var rp=require(_0xc0f6('0x3'));var moment=require('moment');var BPromise=require(_0xc0f6('0x4'));var Mustache=require('mustache');var util=require(_0xc0f6('0x5'));var path=require(_0xc0f6('0x6'));var sox=require(_0xc0f6('0x7'));var csv=require('to-csv');var ejs=require(_0xc0f6('0x8'));var fs=require('fs');var _=require(_0xc0f6('0x9'));var squel=require('squel');var crypto=require(_0xc0f6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0f6('0xb'));var querystring=require(_0xc0f6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc0f6('0xd'));var authService=require(_0xc0f6('0xe'));var qs=require(_0xc0f6('0xf'));var as=require(_0xc0f6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc0f6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0f6('0x12'))['db'];function respondWithStatusCode(_0x33aed2,_0x30ea32){_0x30ea32=_0x30ea32||0xcc;return function(_0x1ff540){if(_0x1ff540){return _0x33aed2[_0xc0f6('0x13')](_0x30ea32);}return _0x33aed2[_0xc0f6('0x14')](_0x30ea32)[_0xc0f6('0x15')]();};}function respondWithResult(_0x281145,_0x4727d8){_0x4727d8=_0x4727d8||0xc8;return function(_0x1f3283){if(_0x1f3283){return _0x281145[_0xc0f6('0x14')](_0x4727d8)[_0xc0f6('0x16')](_0x1f3283);}};}function respondWithFilteredResult(_0x48ad03,_0x4a482b){return function(_0x1bd7ce){if(_0x1bd7ce){var _0x2b3132=_0x1bd7ce[_0xc0f6('0x17')],_0x591c65=_0x4a482b[_0xc0f6('0x18')],_0xacfe72=_0x4a482b[_0xc0f6('0x18')]+_0x4a482b[_0xc0f6('0x19')],_0x37d08e;if(_0xacfe72>=_0x2b3132){_0xacfe72=_0x2b3132;_0x37d08e=0xc8;}else{_0x37d08e=0xce;}_0x48ad03[_0xc0f6('0x14')](_0x37d08e);return _0x48ad03['set'](_0xc0f6('0x1a'),_0x591c65+'-'+_0xacfe72+'/'+_0x2b3132)[_0xc0f6('0x16')](_0x1bd7ce);}return null;};}function patchUpdates(_0x29e5aa){return function(_0x4953ed){try{jsonpatch[_0xc0f6('0x1b')](_0x4953ed,_0x29e5aa,!![]);}catch(_0x510ec4){return BPromise['reject'](_0x510ec4);}return _0x4953ed['save']();};}function saveUpdates(_0x3a2315,_0x3377e2){return function(_0x326335){if(_0x326335){return _0x326335[_0xc0f6('0x1c')](_0x3a2315)[_0xc0f6('0x1d')](function(_0x575671){return _0x575671;});}return null;};}function removeEntity(_0x136871,_0x25342d){return function(_0x4db19d){if(_0x4db19d){return _0x4db19d[_0xc0f6('0x1e')]()[_0xc0f6('0x1d')](function(){_0x136871['status'](0xcc)[_0xc0f6('0x15')]();});}};}function handleEntityNotFound(_0x271ef8,_0x5ee087){return function(_0x55e4c7){if(!_0x55e4c7){_0x271ef8[_0xc0f6('0x13')](0x194);}return _0x55e4c7;};}function handleError(_0x5804c9,_0x3e7d3c){_0x3e7d3c=_0x3e7d3c||0x1f4;return function(_0x2356de){logger[_0xc0f6('0x1f')](_0x2356de[_0xc0f6('0x20')]);if(_0x2356de[_0xc0f6('0x21')]){delete _0x2356de['name'];}_0x5804c9['status'](_0x3e7d3c)[_0xc0f6('0x22')](_0x2356de);};}exports[_0xc0f6('0x23')]=function(_0x14d1e3,_0x545d3e){var _0x4cb1d7={},_0x1e0bf1={},_0x366978={'count':0x0,'rows':[]};var _0x1c4375=_[_0xc0f6('0x24')](db['SquareDetailsReport'][_0xc0f6('0x25')],function(_0x267c02){return{'name':_0x267c02[_0xc0f6('0x26')],'type':_0x267c02[_0xc0f6('0x27')][_0xc0f6('0x28')]};});_0x1e0bf1[_0xc0f6('0x29')]=_[_0xc0f6('0x24')](_0x1c4375,_0xc0f6('0x21'));_0x1e0bf1['query']=_['keys'](_0x14d1e3[_0xc0f6('0x2a')]);_0x1e0bf1['filters']=_[_0xc0f6('0x2b')](_0x1e0bf1['model'],_0x1e0bf1[_0xc0f6('0x2a')]);_0x4cb1d7[_0xc0f6('0x2c')]=_['intersection'](_0x1e0bf1[_0xc0f6('0x29')],qs[_0xc0f6('0x2d')](_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x2d')]));_0x4cb1d7[_0xc0f6('0x2c')]=_0x4cb1d7[_0xc0f6('0x2c')][_0xc0f6('0x2e')]?_0x4cb1d7[_0xc0f6('0x2c')]:_0x1e0bf1[_0xc0f6('0x29')];if(!_0x14d1e3[_0xc0f6('0x2a')]['hasOwnProperty'](_0xc0f6('0x2f'))){_0x4cb1d7['limit']=qs[_0xc0f6('0x19')](_0x14d1e3['query'][_0xc0f6('0x19')]);_0x4cb1d7['offset']=qs['offset'](_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x18')]);}_0x4cb1d7[_0xc0f6('0x30')]=qs[_0xc0f6('0x31')](_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x31')]);_0x4cb1d7[_0xc0f6('0x32')]=qs['filters'](_[_0xc0f6('0x33')](_0x14d1e3['query'],_0x1e0bf1[_0xc0f6('0x34')]),_0x1c4375);if(_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x35')]){_0x4cb1d7[_0xc0f6('0x32')]=_['merge'](_0x4cb1d7['where'],{'$or':_[_0xc0f6('0x24')](_0x1c4375,function(_0x256931){if(_0x256931[_0xc0f6('0x27')]!==_0xc0f6('0x36')){var _0x4f45b4={};_0x4f45b4[_0x256931[_0xc0f6('0x21')]]={'$like':'%'+_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x35')]+'%'};return _0x4f45b4;}})});}_0x4cb1d7=_['merge']({},_0x4cb1d7,_0x14d1e3['options']);var _0x11cb6a={'where':_0x4cb1d7[_0xc0f6('0x32')]};return db[_0xc0f6('0x37')][_0xc0f6('0x17')](_0x11cb6a)[_0xc0f6('0x1d')](function(_0x296d82){_0x366978['count']=_0x296d82;if(_0x14d1e3[_0xc0f6('0x2a')][_0xc0f6('0x38')]){_0x4cb1d7['include']=[{'all':!![]}];}return db[_0xc0f6('0x37')][_0xc0f6('0x39')](_0x4cb1d7);})['then'](function(_0xfd3a94){_0x366978[_0xc0f6('0x3a')]=_0xfd3a94;return _0x366978;})[_0xc0f6('0x1d')](respondWithFilteredResult(_0x545d3e,_0x4cb1d7))[_0xc0f6('0x3b')](handleError(_0x545d3e,null));};exports[_0xc0f6('0x3c')]=function(_0x51e693,_0x372ddb){var _0x30ac30={'raw':!![],'where':{'id':_0x51e693['params']['id']}},_0x3176e4={};_0x3176e4[_0xc0f6('0x29')]=_[_0xc0f6('0x3d')](db['SquareDetailsReport'][_0xc0f6('0x25')]);_0x3176e4[_0xc0f6('0x2a')]=_[_0xc0f6('0x3d')](_0x51e693[_0xc0f6('0x2a')]);_0x3176e4[_0xc0f6('0x34')]=_[_0xc0f6('0x2b')](_0x3176e4[_0xc0f6('0x29')],_0x3176e4[_0xc0f6('0x2a')]);_0x30ac30[_0xc0f6('0x2c')]=_[_0xc0f6('0x2b')](_0x3176e4[_0xc0f6('0x29')],qs['fields'](_0x51e693['query']['fields']));_0x30ac30[_0xc0f6('0x2c')]=_0x30ac30['attributes'][_0xc0f6('0x2e')]?_0x30ac30[_0xc0f6('0x2c')]:_0x3176e4['model'];if(_0x51e693['query'][_0xc0f6('0x38')]){_0x30ac30['include']=[{'all':!![]}];}_0x30ac30=_[_0xc0f6('0x3e')]({},_0x30ac30,_0x51e693[_0xc0f6('0x3f')]);return db[_0xc0f6('0x37')]['find'](_0x30ac30)['then'](handleEntityNotFound(_0x372ddb,null))[_0xc0f6('0x1d')](respondWithResult(_0x372ddb,null))['catch'](handleError(_0x372ddb,null));};exports[_0xc0f6('0x40')]=function(_0x25d3f5,_0x4d8a9b){return db['SquareDetailsReport']['create'](_0x25d3f5['body'],{})[_0xc0f6('0x1d')](respondWithResult(_0x4d8a9b,0xc9))[_0xc0f6('0x3b')](handleError(_0x4d8a9b,null));};exports['update']=function(_0x56f96b,_0x329dc9){if(_0x56f96b['body']['id']){delete _0x56f96b[_0xc0f6('0x41')]['id'];}return db[_0xc0f6('0x37')]['find']({'where':{'id':_0x56f96b[_0xc0f6('0x42')]['id']}})['then'](handleEntityNotFound(_0x329dc9,null))[_0xc0f6('0x1d')](saveUpdates(_0x56f96b[_0xc0f6('0x41')],null))['then'](respondWithResult(_0x329dc9,null))[_0xc0f6('0x3b')](handleError(_0x329dc9,null));};exports[_0xc0f6('0x1e')]=function(_0x732ef9,_0x1b1b17){return db[_0xc0f6('0x37')][_0xc0f6('0x43')]({'where':{'id':_0x732ef9[_0xc0f6('0x42')]['id']}})[_0xc0f6('0x1d')](handleEntityNotFound(_0x1b1b17,null))[_0xc0f6('0x1d')](removeEntity(_0x1b1b17,null))[_0xc0f6('0x3b')](handleError(_0x1b1b17,null));};exports[_0xc0f6('0x44')]=function(_0x29a78c,_0x555174){return db[_0xc0f6('0x37')][_0xc0f6('0x44')]()[_0xc0f6('0x1d')](respondWithResult(_0x555174,null))[_0xc0f6('0x3b')](handleError(_0x555174,null));}; \ No newline at end of file +var _0xd481=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','intersection','length','find','create','body','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xd481,0x1e4));var _0x1d48=function(_0xb92d19,_0x58bc18){_0xb92d19=_0xb92d19-0x0;var _0x4e6b22=_0xd481[_0xb92d19];return _0x4e6b22;};'use strict';var pdf=require(_0x1d48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1d48('0x1'));var zipdir=require(_0x1d48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d48('0x3'));var moment=require(_0x1d48('0x4'));var BPromise=require(_0x1d48('0x5'));var Mustache=require('mustache');var util=require(_0x1d48('0x6'));var path=require('path');var sox=require(_0x1d48('0x7'));var csv=require(_0x1d48('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d48('0x9'));var squel=require(_0x1d48('0xa'));var crypto=require(_0x1d48('0xb'));var jsforce=require(_0x1d48('0xc'));var deskjs=require(_0x1d48('0xd'));var toCsv=require(_0x1d48('0x8'));var querystring=require(_0x1d48('0xe'));var Papa=require(_0x1d48('0xf'));var Redis=require(_0x1d48('0x10'));var authService=require(_0x1d48('0x11'));var qs=require(_0x1d48('0x12'));var as=require(_0x1d48('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d48('0x14'))(_0x1d48('0x15'));var utils=require(_0x1d48('0x16'));var config=require(_0x1d48('0x17'));var licenseUtil=require(_0x1d48('0x18'));var db=require(_0x1d48('0x19'))['db'];function respondWithStatusCode(_0xa1246f,_0x33b907){_0x33b907=_0x33b907||0xcc;return function(_0x2ac3e9){if(_0x2ac3e9){return _0xa1246f[_0x1d48('0x1a')](_0x33b907);}return _0xa1246f['status'](_0x33b907)[_0x1d48('0x1b')]();};}function respondWithResult(_0x5f1ad8,_0x1c7f51){_0x1c7f51=_0x1c7f51||0xc8;return function(_0x2ccc5e){if(_0x2ccc5e){return _0x5f1ad8[_0x1d48('0x1c')](_0x1c7f51)[_0x1d48('0x1d')](_0x2ccc5e);}};}function respondWithFilteredResult(_0x4f9f04,_0x1845bd){return function(_0x2e2748){if(_0x2e2748){var _0x27fd35=_0x2e2748[_0x1d48('0x1e')],_0x4d6bd0=_0x1845bd[_0x1d48('0x1f')],_0x1789af=_0x1845bd[_0x1d48('0x1f')]+_0x1845bd[_0x1d48('0x20')],_0x433c92;if(_0x1789af>=_0x27fd35){_0x1789af=_0x27fd35;_0x433c92=0xc8;}else{_0x433c92=0xce;}_0x4f9f04[_0x1d48('0x1c')](_0x433c92);return _0x4f9f04[_0x1d48('0x21')](_0x1d48('0x22'),_0x4d6bd0+'-'+_0x1789af+'/'+_0x27fd35)['json'](_0x2e2748);}return null;};}function patchUpdates(_0x5173a3){return function(_0xb5f9d2){try{jsonpatch[_0x1d48('0x23')](_0xb5f9d2,_0x5173a3,!![]);}catch(_0x37340c){return BPromise[_0x1d48('0x24')](_0x37340c);}return _0xb5f9d2[_0x1d48('0x25')]();};}function saveUpdates(_0x93521d,_0x341cdf){return function(_0x1b0520){if(_0x1b0520){return _0x1b0520['update'](_0x93521d)[_0x1d48('0x26')](function(_0x2242fd){return _0x2242fd;});}return null;};}function removeEntity(_0x5a6035,_0x559d7a){return function(_0x1bb115){if(_0x1bb115){return _0x1bb115[_0x1d48('0x27')]()[_0x1d48('0x26')](function(){_0x5a6035[_0x1d48('0x1c')](0xcc)[_0x1d48('0x1b')]();});}};}function handleEntityNotFound(_0x20a9ba,_0xef15b5){return function(_0x15fca5){if(!_0x15fca5){_0x20a9ba[_0x1d48('0x1a')](0x194);}return _0x15fca5;};}function handleError(_0x1382d8,_0x4be71e){_0x4be71e=_0x4be71e||0x1f4;return function(_0x4e44eb){logger[_0x1d48('0x28')](_0x4e44eb[_0x1d48('0x29')]);if(_0x4e44eb[_0x1d48('0x2a')]){delete _0x4e44eb[_0x1d48('0x2a')];}_0x1382d8[_0x1d48('0x1c')](_0x4be71e)[_0x1d48('0x2b')](_0x4e44eb);};}exports['index']=function(_0x5bb03a,_0x187b34){var _0x280505={},_0x4d3f91={},_0x33f9dd={'count':0x0,'rows':[]};var _0x368c5f=_[_0x1d48('0x2c')](db[_0x1d48('0x2d')]['rawAttributes'],function(_0x4cac26){return{'name':_0x4cac26[_0x1d48('0x2e')],'type':_0x4cac26[_0x1d48('0x2f')][_0x1d48('0x30')]};});_0x4d3f91[_0x1d48('0x31')]=_['map'](_0x368c5f,_0x1d48('0x2a'));_0x4d3f91[_0x1d48('0x32')]=_[_0x1d48('0x33')](_0x5bb03a[_0x1d48('0x32')]);_0x4d3f91[_0x1d48('0x34')]=_['intersection'](_0x4d3f91[_0x1d48('0x31')],_0x4d3f91[_0x1d48('0x32')]);_0x280505[_0x1d48('0x35')]=_['intersection'](_0x4d3f91[_0x1d48('0x31')],qs['fields'](_0x5bb03a['query'][_0x1d48('0x36')]));_0x280505[_0x1d48('0x35')]=_0x280505[_0x1d48('0x35')]['length']?_0x280505[_0x1d48('0x35')]:_0x4d3f91[_0x1d48('0x31')];if(!_0x5bb03a['query'][_0x1d48('0x37')](_0x1d48('0x38'))){_0x280505[_0x1d48('0x20')]=qs['limit'](_0x5bb03a[_0x1d48('0x32')]['limit']);_0x280505[_0x1d48('0x1f')]=qs[_0x1d48('0x1f')](_0x5bb03a[_0x1d48('0x32')]['offset']);}_0x280505['order']=qs[_0x1d48('0x39')](_0x5bb03a[_0x1d48('0x32')][_0x1d48('0x39')]);_0x280505[_0x1d48('0x3a')]=qs[_0x1d48('0x34')](_[_0x1d48('0x3b')](_0x5bb03a[_0x1d48('0x32')],_0x4d3f91[_0x1d48('0x34')]),_0x368c5f);if(_0x5bb03a[_0x1d48('0x32')][_0x1d48('0x3c')]){_0x280505[_0x1d48('0x3a')]=_[_0x1d48('0x3d')](_0x280505[_0x1d48('0x3a')],{'$or':_[_0x1d48('0x2c')](_0x368c5f,function(_0x458ec3){if(_0x458ec3[_0x1d48('0x2f')]!==_0x1d48('0x3e')){var _0xb3c168={};_0xb3c168[_0x458ec3[_0x1d48('0x2a')]]={'$like':'%'+_0x5bb03a[_0x1d48('0x32')][_0x1d48('0x3c')]+'%'};return _0xb3c168;}})});}_0x280505=_[_0x1d48('0x3d')]({},_0x280505,_0x5bb03a[_0x1d48('0x3f')]);var _0x78ca07={'where':_0x280505[_0x1d48('0x3a')]};return db[_0x1d48('0x2d')][_0x1d48('0x1e')](_0x78ca07)[_0x1d48('0x26')](function(_0x5574ff){_0x33f9dd[_0x1d48('0x1e')]=_0x5574ff;if(_0x5bb03a['query'][_0x1d48('0x40')]){_0x280505[_0x1d48('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x1d48('0x42')](_0x280505);})[_0x1d48('0x26')](function(_0x4470f6){_0x33f9dd[_0x1d48('0x43')]=_0x4470f6;return _0x33f9dd;})[_0x1d48('0x26')](respondWithFilteredResult(_0x187b34,_0x280505))[_0x1d48('0x44')](handleError(_0x187b34,null));};exports['show']=function(_0x4cbb43,_0x49beaf){var _0x33021e={'raw':!![],'where':{'id':_0x4cbb43['params']['id']}},_0x44edbe={};_0x44edbe[_0x1d48('0x31')]=_[_0x1d48('0x33')](db['SquareDetailsReport'][_0x1d48('0x45')]);_0x44edbe[_0x1d48('0x32')]=_[_0x1d48('0x33')](_0x4cbb43['query']);_0x44edbe['filters']=_[_0x1d48('0x46')](_0x44edbe[_0x1d48('0x31')],_0x44edbe[_0x1d48('0x32')]);_0x33021e['attributes']=_[_0x1d48('0x46')](_0x44edbe['model'],qs[_0x1d48('0x36')](_0x4cbb43[_0x1d48('0x32')][_0x1d48('0x36')]));_0x33021e[_0x1d48('0x35')]=_0x33021e[_0x1d48('0x35')][_0x1d48('0x47')]?_0x33021e['attributes']:_0x44edbe[_0x1d48('0x31')];if(_0x4cbb43[_0x1d48('0x32')][_0x1d48('0x40')]){_0x33021e[_0x1d48('0x41')]=[{'all':!![]}];}_0x33021e=_[_0x1d48('0x3d')]({},_0x33021e,_0x4cbb43[_0x1d48('0x3f')]);return db[_0x1d48('0x2d')][_0x1d48('0x48')](_0x33021e)[_0x1d48('0x26')](handleEntityNotFound(_0x49beaf,null))[_0x1d48('0x26')](respondWithResult(_0x49beaf,null))[_0x1d48('0x44')](handleError(_0x49beaf,null));};exports[_0x1d48('0x49')]=function(_0x5405b5,_0x1e97c0){return db['SquareDetailsReport'][_0x1d48('0x49')](_0x5405b5[_0x1d48('0x4a')],{})[_0x1d48('0x26')](respondWithResult(_0x1e97c0,0xc9))['catch'](handleError(_0x1e97c0,null));};exports['update']=function(_0xf50046,_0x3e2420){if(_0xf50046['body']['id']){delete _0xf50046[_0x1d48('0x4a')]['id'];}return db[_0x1d48('0x2d')][_0x1d48('0x48')]({'where':{'id':_0xf50046[_0x1d48('0x4b')]['id']}})[_0x1d48('0x26')](handleEntityNotFound(_0x3e2420,null))[_0x1d48('0x26')](saveUpdates(_0xf50046['body'],null))[_0x1d48('0x26')](respondWithResult(_0x3e2420,null))[_0x1d48('0x44')](handleError(_0x3e2420,null));};exports[_0x1d48('0x27')]=function(_0x4a4fb0,_0x2f2a0f){return db[_0x1d48('0x2d')][_0x1d48('0x48')]({'where':{'id':_0x4a4fb0[_0x1d48('0x4b')]['id']}})[_0x1d48('0x26')](handleEntityNotFound(_0x2f2a0f,null))[_0x1d48('0x26')](removeEntity(_0x2f2a0f,null))[_0x1d48('0x44')](handleError(_0x2f2a0f,null));};exports['describe']=function(_0x5b25df,_0x8977c9){return db[_0x1d48('0x2d')][_0x1d48('0x4c')]()['then'](respondWithResult(_0x8977c9,null))['catch'](handleError(_0x8977c9,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index beb064a..3c0ef19 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 _0x2c5e=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xec05a,_0xae2200){var _0x5911e2=function(_0x45d43d){while(--_0x45d43d){_0xec05a['push'](_0xec05a['shift']());}};_0x5911e2(++_0xae2200);}(_0x2c5e,0x139));var _0xe2c5=function(_0x3c0b53,_0x34cdd3){_0x3c0b53=_0x3c0b53-0x0;var _0x48246a=_0x2c5e[_0x3c0b53];return _0x48246a;};'use strict';var _=require(_0xe2c5('0x0'));var util=require(_0xe2c5('0x1'));var logger=require(_0xe2c5('0x2'))(_0xe2c5('0x3'));var moment=require(_0xe2c5('0x4'));var BPromise=require(_0xe2c5('0x5'));var rp=require(_0xe2c5('0x6'));var fs=require('fs');var path=require(_0xe2c5('0x7'));var rimraf=require('rimraf');var config=require(_0xe2c5('0x8'));var attributes=require(_0xe2c5('0x9'));module[_0xe2c5('0xa')]=function(_0x1994ff,_0xfd433){return _0x1994ff[_0xe2c5('0xb')](_0xe2c5('0xc'),attributes,{'tableName':_0xe2c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dcd=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x7dcd,0x1eb));var _0xd7dc=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x7dcd[_0x5755bf];return _0x156408;};'use strict';var _=require(_0xd7dc('0x0'));var util=require(_0xd7dc('0x1'));var logger=require(_0xd7dc('0x2'))(_0xd7dc('0x3'));var moment=require(_0xd7dc('0x4'));var BPromise=require(_0xd7dc('0x5'));var rp=require(_0xd7dc('0x6'));var fs=require('fs');var path=require(_0xd7dc('0x7'));var rimraf=require('rimraf');var config=require(_0xd7dc('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xd7dc('0x9')]=function(_0x1061d2,_0x3201da){return _0x1061d2[_0xd7dc('0xa')](_0xd7dc('0xb'),attributes,{'tableName':_0xd7dc('0xc'),'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 843edbc..ca6d12f 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 _0x1eb9=['moment','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','debug','lodash','util'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x1eb9,0x19e));var _0x91eb=function(_0x2b4d02,_0x54d4f9){_0x2b4d02=_0x2b4d02-0x0;var _0x19a9c2=_0x1eb9[_0x2b4d02];return _0x19a9c2;};'use strict';var _=require(_0x91eb('0x0'));var util=require(_0x91eb('0x1'));var moment=require(_0x91eb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91eb('0x3'))['db'];var utils=require(_0x91eb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x91eb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x91eb('0x6')][_0x91eb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a7f45,_0x167717,_0x21f1fb){return new BPromise(function(_0x4a2af0,_0x524605){return client[_0x91eb('0x8')](_0x4a7f45,_0x21f1fb)['then'](function(_0x108a00){logger[_0x91eb('0x9')](_0x91eb('0xa'),_0x167717,_0x91eb('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x167717,_0x91eb('0xb'),JSON[_0x91eb('0xc')](_0x108a00));if(_0x108a00[_0x91eb('0xd')]){if(_0x108a00['error'][_0x91eb('0xe')]===0x1f4){logger[_0x91eb('0xd')](_0x91eb('0xa'),_0x167717,_0x108a00[_0x91eb('0xd')][_0x91eb('0xf')]);return _0x524605(_0x108a00[_0x91eb('0xd')][_0x91eb('0xf')]);}logger[_0x91eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x167717,_0x108a00[_0x91eb('0xd')]['message']);return _0x4a2af0(_0x108a00[_0x91eb('0xd')][_0x91eb('0xf')]);}else{logger[_0x91eb('0x9')](_0x91eb('0xa'),_0x167717,_0x91eb('0xb'));_0x4a2af0(_0x108a00[_0x91eb('0x10')][_0x91eb('0xf')]);}})[_0x91eb('0x11')](function(_0x481f87){logger['error'](_0x91eb('0xa'),_0x167717,_0x481f87);_0x524605(_0x481f87);});});}exports[_0x91eb('0x12')]=function(_0x4b01e){var _0x4d3391=this;return new Promise(function(_0x3c42a6,_0x2b0dee){return db[_0x91eb('0x13')][_0x91eb('0x14')](_0x4b01e[_0x91eb('0x15')],{'raw':_0x4b01e[_0x91eb('0x16')]?_0x4b01e[_0x91eb('0x16')][_0x91eb('0x17')]===undefined?!![]:![]:!![]})[_0x91eb('0x18')](function(_0x42e205){logger['info'](_0x91eb('0x12'),_0x4b01e);logger[_0x91eb('0x19')](_0x91eb('0x12'),_0x4b01e,JSON[_0x91eb('0xc')](_0x42e205));_0x3c42a6(_0x42e205);})[_0x91eb('0x11')](function(_0x5869a4){logger['error'](_0x91eb('0x12'),_0x5869a4[_0x91eb('0xf')],_0x4b01e);_0x2b0dee(_0x4d3391['error'](0x1f4,_0x5869a4[_0x91eb('0xf')]));});});}; \ No newline at end of file +var _0x7c19=['../../config/logger','rpc','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x448fb5,_0x27259c){var _0x3deb69=function(_0x2bea15){while(--_0x2bea15){_0x448fb5['push'](_0x448fb5['shift']());}};_0x3deb69(++_0x27259c);}(_0x7c19,0x1f3));var _0x97c1=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7c19[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x97c1('0x0'));var util=require(_0x97c1('0x1'));var moment=require(_0x97c1('0x2'));var BPromise=require(_0x97c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97c1('0x5'))(_0x97c1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97c1('0x7')][_0x97c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4907b7,_0x483ad2,_0x2f5ebd){return new BPromise(function(_0x5f1ecb,_0xd0e000){return client['request'](_0x4907b7,_0x2f5ebd)[_0x97c1('0x9')](function(_0x3c560c){logger[_0x97c1('0xa')](_0x97c1('0xb'),_0x483ad2,_0x97c1('0xc'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x483ad2,'request\x20sent',JSON[_0x97c1('0xd')](_0x3c560c));if(_0x3c560c[_0x97c1('0xe')]){if(_0x3c560c[_0x97c1('0xe')][_0x97c1('0xf')]===0x1f4){logger[_0x97c1('0xe')](_0x97c1('0xb'),_0x483ad2,_0x3c560c['error'][_0x97c1('0x10')]);return _0xd0e000(_0x3c560c[_0x97c1('0xe')]['message']);}logger[_0x97c1('0xe')](_0x97c1('0xb'),_0x483ad2,_0x3c560c[_0x97c1('0xe')]['message']);return _0x5f1ecb(_0x3c560c[_0x97c1('0xe')]['message']);}else{logger[_0x97c1('0xa')](_0x97c1('0xb'),_0x483ad2,_0x97c1('0xc'));_0x5f1ecb(_0x3c560c[_0x97c1('0x11')]['message']);}})[_0x97c1('0x12')](function(_0x15b7ad){logger[_0x97c1('0xe')](_0x97c1('0xb'),_0x483ad2,_0x15b7ad);_0xd0e000(_0x15b7ad);});});}exports['CreateSquareDetailsReport']=function(_0x5f0bb0){var _0x25eaaa=this;return new Promise(function(_0xdfafe4,_0x42b81a){return db[_0x97c1('0x13')][_0x97c1('0x14')](_0x5f0bb0[_0x97c1('0x15')],{'raw':_0x5f0bb0['options']?_0x5f0bb0[_0x97c1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x97c1('0x9')](function(_0x2cd20b){logger['info']('CreateSquareDetailsReport',_0x5f0bb0);logger['debug'](_0x97c1('0x17'),_0x5f0bb0,JSON[_0x97c1('0xd')](_0x2cd20b));_0xdfafe4(_0x2cd20b);})[_0x97c1('0x12')](function(_0x439fff){logger[_0x97c1('0xe')](_0x97c1('0x17'),_0x439fff[_0x97c1('0x10')],_0x5f0bb0);_0x42b81a(_0x25eaaa[_0x97c1('0xe')](0x1f4,_0x439fff[_0x97c1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 2843a51..959ed80 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 _0xbef1=['/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x20d72e,_0x534501){var _0x2580d6=function(_0x361b60){while(--_0x361b60){_0x20d72e['push'](_0x20d72e['shift']());}};_0x2580d6(++_0x534501);}(_0xbef1,0x78));var _0x1bef=function(_0xaeef7d,_0x1d0a68){_0xaeef7d=_0xaeef7d-0x0;var _0x173fb2=_0xbef1[_0xaeef7d];return _0x173fb2;};'use strict';var express=require(_0x1bef('0x0'));var router=express['Router']();var auth=require(_0x1bef('0x1'));var controller=require(_0x1bef('0x2'));router[_0x1bef('0x3')]('/',auth[_0x1bef('0x4')](),controller[_0x1bef('0x5')]);router[_0x1bef('0x3')](_0x1bef('0x6'),auth[_0x1bef('0x4')](),controller[_0x1bef('0x7')]);module[_0x1bef('0x8')]=router; \ No newline at end of file +var _0x85da=['exports','express','./system.controller','get','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x132e18,_0x16af4f){var _0x38ab54=function(_0x1475e1){while(--_0x1475e1){_0x132e18['push'](_0x132e18['shift']());}};_0x38ab54(++_0x16af4f);}(_0x85da,0x8d));var _0xa85d=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x85da[_0x1fcaf1];return _0x55f464;};'use strict';var express=require(_0xa85d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xa85d('0x1'));router[_0xa85d('0x2')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa85d('0x3'),auth[_0xa85d('0x4')](),controller[_0xa85d('0x5')]);module[_0xa85d('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e6c90b1..6b4c4e6 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 _0x4351=['Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','getAllData','then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf'];(function(_0x78ad0e,_0x5161a9){var _0x27d6bb=function(_0x572208){while(--_0x572208){_0x78ad0e['push'](_0x78ad0e['shift']());}};_0x27d6bb(++_0x5161a9);}(_0x4351,0x1b5));var _0x1435=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4351[_0x334841];return _0x5beb4b;};'use strict';var info=require(_0x1435('0x0'));var exec=require(_0x1435('0x1'))[_0x1435('0x2')];var logger=require(_0x1435('0x3'))(_0x1435('0x4'));var util=require(_0x1435('0x5'));var BPromise=require(_0x1435('0x6'));var _=require(_0x1435('0x7'));function handleError(_0x2fc1f2,_0x2fa227,_0x111bc6){_0x2fa227=_0x2fa227||0x1f4;return function(_0x4287ff){logger[_0x1435('0x8')](_0x1435('0x9'),_0x111bc6,_0x2fa227,util[_0x1435('0xa')](_0x4287ff,{'showHidden':![],'depth':null}));delete _0x4287ff['name'];_0x2fc1f2[_0x1435('0xb')](_0x2fa227)['send'](_0x4287ff);};}exports['index']=function(_0x3d0e0b,_0x22a221){return info[_0x1435('0xc')]()[_0x1435('0xd')](function(_0xade491){return _0x22a221['status'](0xc8)[_0x1435('0xe')](_0xade491);})[_0x1435('0xf')](function(_0x5a64a4){return _0x22a221['status'](0x1f4)[_0x1435('0xe')](_0x5a64a4);});};exports['killProcess']=function(_0x33a987,_0x4ef2ee){var _0x1632ac=['components/import/cm'];return new BPromise(function(_0x47daf0,_0x4bd76b){return exec(util[_0x1435('0x10')](_0x1435('0x11'),_0x33a987[_0x1435('0x12')]['pid']),function(_0x4a52ba,_0x103ba3,_0x49fb9c){if(_0x4a52ba){return _0x4bd76b(_0x4a52ba);}return _0x47daf0(_0x103ba3);});})[_0x1435('0xd')](function(_0x3f0b08){var _0x1f5fc3=![];var _0x202744=_0x3f0b08[_0x1435('0x13')](/\n/);for(var _0x1cc531=0x0,_0x5ecd=_0x1632ac[_0x1435('0x14')];_0x1cc531<_0x5ecd,_0x1f5fc3===![];_0x1cc531+=0x1){if(_0x3f0b08[_0x1435('0x15')](_0x1632ac[_0x1cc531])>=0x0){_0x1f5fc3=!![];}}if(!_0x1f5fc3){throw new Error(util[_0x1435('0x10')](_0x1435('0x16'),_0x33a987[_0x1435('0x12')][_0x1435('0x17')]));}process[_0x1435('0x18')](_0x33a987[_0x1435('0x12')]['pid'],_0x1435('0x19'));return _0x4ef2ee[_0x1435('0xb')](0xc8)['json']({'message':util[_0x1435('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x33a987[_0x1435('0x12')][_0x1435('0x17')])});})[_0x1435('0xf')](handleError(_0x4ef2ee,null,_0x1435('0x1a')));}; \ No newline at end of file +var _0x6893=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','getAllData','then','json','catch','killProcess','params','pid','split','length','indexOf','SIGINT','format','child_process','../../config/logger','api','util','bluebird','lodash'];(function(_0x345307,_0x11b6f3){var _0x1e07a7=function(_0x76bed3){while(--_0x76bed3){_0x345307['push'](_0x345307['shift']());}};_0x1e07a7(++_0x11b6f3);}(_0x6893,0x16a));var _0x3689=function(_0x268cbc,_0x2bece3){_0x268cbc=_0x268cbc-0x0;var _0x2f3302=_0x6893[_0x268cbc];return _0x2f3302;};'use strict';var info=require('systeminformation');var exec=require(_0x3689('0x0'))['exec'];var logger=require(_0x3689('0x1'))(_0x3689('0x2'));var util=require(_0x3689('0x3'));var BPromise=require(_0x3689('0x4'));var _=require(_0x3689('0x5'));function handleError(_0xbc688,_0x21b19e,_0x31ddb2){_0x21b19e=_0x21b19e||0x1f4;return function(_0x214ffc){logger[_0x3689('0x6')](_0x3689('0x7'),_0x31ddb2,_0x21b19e,util['inspect'](_0x214ffc,{'showHidden':![],'depth':null}));delete _0x214ffc[_0x3689('0x8')];_0xbc688[_0x3689('0x9')](_0x21b19e)[_0x3689('0xa')](_0x214ffc);};}exports['index']=function(_0x3c46a,_0x6e03ed){return info[_0x3689('0xb')]()[_0x3689('0xc')](function(_0x18d237){return _0x6e03ed[_0x3689('0x9')](0xc8)[_0x3689('0xd')](_0x18d237);})[_0x3689('0xe')](function(_0xf3c620){return _0x6e03ed[_0x3689('0x9')](0x1f4)[_0x3689('0xd')](_0xf3c620);});};exports[_0x3689('0xf')]=function(_0x1476ec,_0x5f828e){var _0x72f5e3=['components/import/cm'];return new BPromise(function(_0x50370e,_0x589666){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1476ec[_0x3689('0x10')][_0x3689('0x11')]),function(_0x18e5dc,_0x5557cf,_0x249b28){if(_0x18e5dc){return _0x589666(_0x18e5dc);}return _0x50370e(_0x5557cf);});})[_0x3689('0xc')](function(_0x50c70a){var _0x344ab4=![];var _0xe465a2=_0x50c70a[_0x3689('0x12')](/\n/);for(var _0x23bf88=0x0,_0x2b40e3=_0x72f5e3[_0x3689('0x13')];_0x23bf88<_0x2b40e3,_0x344ab4===![];_0x23bf88+=0x1){if(_0x50c70a[_0x3689('0x14')](_0x72f5e3[_0x23bf88])>=0x0){_0x344ab4=!![];}}if(!_0x344ab4){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1476ec[_0x3689('0x10')][_0x3689('0x11')]));}process['kill'](_0x1476ec['params'][_0x3689('0x11')],_0x3689('0x15'));return _0x5f828e[_0x3689('0x9')](0xc8)[_0x3689('0xd')]({'message':util[_0x3689('0x16')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1476ec[_0x3689('0x10')]['pid'])});})[_0x3689('0xe')](handleError(_0x5f828e,null,_0x3689('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7062d3f..4cf36ce 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 _0x17ba=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2d3196,_0x3231ca){var _0x7a8270=function(_0x246b63){while(--_0x246b63){_0x2d3196['push'](_0x2d3196['shift']());}};_0x7a8270(++_0x3231ca);}(_0x17ba,0xab));var _0xa17b=function(_0x2c6914,_0x4f5d8d){_0x2c6914=_0x2c6914-0x0;var _0x26eb5b=_0x17ba[_0x2c6914];return _0x26eb5b;};'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('0xe')]('/',auth[_0xa17b('0xa')](),controller[_0xa17b('0xf')]);router[_0xa17b('0x10')](_0xa17b('0xc'),auth['isAuthenticated'](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xc'),auth[_0xa17b('0xa')](),controller[_0xa17b('0x13')]);module[_0xa17b('0x14')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x21afd5,_0x57b9ba){var _0x59b71d=function(_0x4e4a15){while(--_0x4e4a15){_0x21afd5['push'](_0x21afd5['shift']());}};_0x59b71d(++_0x57b9ba);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('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 bf84ab6..dd3eb3f 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x4fc2,0x111));var _0x24fc=function(_0x373ce6,_0x1a0131){_0x373ce6=_0x373ce6-0x0;var _0x49c3b3=_0x4fc2[_0x373ce6];return _0x49c3b3;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +var _0x0713=['#0091EA','STRING','name'];(function(_0x52c1fa,_0xdd9e87){var _0x454e64=function(_0x394056){while(--_0x394056){_0x52c1fa['push'](_0x52c1fa['shift']());}};_0x454e64(++_0xdd9e87);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 00a4d0a..43f3f2e 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 _0x0e26=['set','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x0e26,0x195));var _0x60e2=function(_0x2741e7,_0x1fba22){_0x2741e7=_0x2741e7-0x0;var _0x31711=_0x0e26[_0x2741e7];return _0x31711;};'use strict';var pdf=require(_0x60e2('0x0'));var emlformat=require(_0x60e2('0x1'));var rimraf=require(_0x60e2('0x2'));var zipdir=require(_0x60e2('0x3'));var jsonpatch=require(_0x60e2('0x4'));var rp=require(_0x60e2('0x5'));var moment=require(_0x60e2('0x6'));var BPromise=require(_0x60e2('0x7'));var Mustache=require(_0x60e2('0x8'));var util=require(_0x60e2('0x9'));var path=require(_0x60e2('0xa'));var sox=require(_0x60e2('0xb'));var csv=require(_0x60e2('0xc'));var ejs=require(_0x60e2('0xd'));var fs=require('fs');var _=require(_0x60e2('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x60e2('0xf'));var deskjs=require(_0x60e2('0x10'));var toCsv=require(_0x60e2('0xc'));var querystring=require(_0x60e2('0x11'));var Papa=require(_0x60e2('0x12'));var Redis=require('ioredis');var authService=require(_0x60e2('0x13'));var qs=require(_0x60e2('0x14'));var as=require(_0x60e2('0x15'));var hardwareService=require(_0x60e2('0x16'));var logger=require(_0x60e2('0x17'))(_0x60e2('0x18'));var utils=require('../../config/utils');var config=require(_0x60e2('0x19'));var licenseUtil=require(_0x60e2('0x1a'));var db=require(_0x60e2('0x1b'))['db'];function respondWithStatusCode(_0x3d5968,_0x5dd696){_0x5dd696=_0x5dd696||0xcc;return function(_0x2f86eb){if(_0x2f86eb){return _0x3d5968[_0x60e2('0x1c')](_0x5dd696);}return _0x3d5968['status'](_0x5dd696)[_0x60e2('0x1d')]();};}function respondWithResult(_0x14c63f,_0x1399be){_0x1399be=_0x1399be||0xc8;return function(_0x319234){if(_0x319234){return _0x14c63f[_0x60e2('0x1e')](_0x1399be)[_0x60e2('0x1f')](_0x319234);}};}function respondWithFilteredResult(_0xd75b4a,_0x5d2677){return function(_0x4a65f4){if(_0x4a65f4){var _0x1f7c6b=_0x4a65f4[_0x60e2('0x20')],_0x48f350=_0x5d2677[_0x60e2('0x21')],_0x476d23=_0x5d2677[_0x60e2('0x21')]+_0x5d2677[_0x60e2('0x22')],_0x306c65;if(_0x476d23>=_0x1f7c6b){_0x476d23=_0x1f7c6b;_0x306c65=0xc8;}else{_0x306c65=0xce;}_0xd75b4a[_0x60e2('0x1e')](_0x306c65);return _0xd75b4a[_0x60e2('0x23')]('Content-Range',_0x48f350+'-'+_0x476d23+'/'+_0x1f7c6b)[_0x60e2('0x1f')](_0x4a65f4);}return null;};}function patchUpdates(_0x1113af){return function(_0x204525){try{jsonpatch['apply'](_0x204525,_0x1113af,!![]);}catch(_0x10b59e){return BPromise[_0x60e2('0x24')](_0x10b59e);}return _0x204525[_0x60e2('0x25')]();};}function saveUpdates(_0x490a39,_0x23d627){return function(_0x4ed74e){if(_0x4ed74e){return _0x4ed74e[_0x60e2('0x26')](_0x490a39)[_0x60e2('0x27')](function(_0x496ca2){return _0x496ca2;});}return null;};}function removeEntity(_0x2b2269,_0x5cea61){return function(_0x242de2){if(_0x242de2){return _0x242de2[_0x60e2('0x28')]()[_0x60e2('0x27')](function(){var _0xc492ab=_0x242de2[_0x60e2('0x29')]({'plain':!![]});var _0x2522c7=_0x60e2('0x2a');return db[_0x60e2('0x2b')][_0x60e2('0x28')]({'where':{'type':_0x2522c7,'resourceId':_0xc492ab['id']}})['then'](function(){return _0x242de2;});})['then'](function(){_0x2b2269[_0x60e2('0x1e')](0xcc)[_0x60e2('0x1d')]();});}};}function handleEntityNotFound(_0x901e19,_0x2e375a){return function(_0x3032fe){if(!_0x3032fe){_0x901e19[_0x60e2('0x1c')](0x194);}return _0x3032fe;};}function handleError(_0x115436,_0x4b72c7){_0x4b72c7=_0x4b72c7||0x1f4;return function(_0x3f66bb){logger[_0x60e2('0x2c')](_0x3f66bb[_0x60e2('0x2d')]);if(_0x3f66bb[_0x60e2('0x2e')]){delete _0x3f66bb[_0x60e2('0x2e')];}_0x115436[_0x60e2('0x1e')](_0x4b72c7)[_0x60e2('0x2f')](_0x3f66bb);};}exports[_0x60e2('0x30')]=function(_0x14c7e7,_0x395fa0){var _0x2bc8f2={},_0x1aadf3={},_0xaa98e1={'count':0x0,'rows':[]};var _0x372ed3=_[_0x60e2('0x31')](db[_0x60e2('0x32')]['rawAttributes'],function(_0x40e96d){return{'name':_0x40e96d[_0x60e2('0x33')],'type':_0x40e96d[_0x60e2('0x34')]['key']};});_0x1aadf3[_0x60e2('0x35')]=_[_0x60e2('0x31')](_0x372ed3,_0x60e2('0x2e'));_0x1aadf3[_0x60e2('0x36')]=_[_0x60e2('0x37')](_0x14c7e7[_0x60e2('0x36')]);_0x1aadf3[_0x60e2('0x38')]=_[_0x60e2('0x39')](_0x1aadf3[_0x60e2('0x35')],_0x1aadf3[_0x60e2('0x36')]);_0x2bc8f2['attributes']=_[_0x60e2('0x39')](_0x1aadf3[_0x60e2('0x35')],qs[_0x60e2('0x3a')](_0x14c7e7['query'][_0x60e2('0x3a')]));_0x2bc8f2[_0x60e2('0x3b')]=_0x2bc8f2['attributes']['length']?_0x2bc8f2['attributes']:_0x1aadf3[_0x60e2('0x35')];if(!_0x14c7e7['query'][_0x60e2('0x3c')](_0x60e2('0x3d'))){_0x2bc8f2['limit']=qs['limit'](_0x14c7e7['query'][_0x60e2('0x22')]);_0x2bc8f2[_0x60e2('0x21')]=qs['offset'](_0x14c7e7[_0x60e2('0x36')][_0x60e2('0x21')]);}_0x2bc8f2[_0x60e2('0x3e')]=qs[_0x60e2('0x3f')](_0x14c7e7[_0x60e2('0x36')][_0x60e2('0x3f')]);_0x2bc8f2[_0x60e2('0x40')]=qs['filters'](_[_0x60e2('0x41')](_0x14c7e7[_0x60e2('0x36')],_0x1aadf3[_0x60e2('0x38')]),_0x372ed3);if(_0x14c7e7[_0x60e2('0x36')][_0x60e2('0x42')]){_0x2bc8f2['where']=_[_0x60e2('0x43')](_0x2bc8f2[_0x60e2('0x40')],{'$or':_['map'](_0x372ed3,function(_0x394bce){if(_0x394bce[_0x60e2('0x34')]!==_0x60e2('0x44')){var _0x573fa7={};_0x573fa7[_0x394bce['name']]={'$like':'%'+_0x14c7e7['query'][_0x60e2('0x42')]+'%'};return _0x573fa7;}})});}_0x2bc8f2=_[_0x60e2('0x43')]({},_0x2bc8f2,_0x14c7e7[_0x60e2('0x45')]);var _0x309ad7={'where':_0x2bc8f2[_0x60e2('0x40')]};return db[_0x60e2('0x32')][_0x60e2('0x20')](_0x309ad7)['then'](function(_0x49f7e4){_0xaa98e1[_0x60e2('0x20')]=_0x49f7e4;if(_0x14c7e7['query']['includeAll']){_0x2bc8f2[_0x60e2('0x46')]=[{'all':!![]}];}return db[_0x60e2('0x32')][_0x60e2('0x47')](_0x2bc8f2);})[_0x60e2('0x27')](function(_0x4f6379){_0xaa98e1[_0x60e2('0x48')]=_0x4f6379;return _0xaa98e1;})['then'](respondWithFilteredResult(_0x395fa0,_0x2bc8f2))[_0x60e2('0x49')](handleError(_0x395fa0,null));};exports[_0x60e2('0x4a')]=function(_0x5341e8,_0x420333){var _0x3ca7b5={'raw':!![],'where':{'id':_0x5341e8['params']['id']}},_0x2132e4={};_0x2132e4[_0x60e2('0x35')]=_['keys'](db['Tag'][_0x60e2('0x4b')]);_0x2132e4['query']=_[_0x60e2('0x37')](_0x5341e8['query']);_0x2132e4['filters']=_['intersection'](_0x2132e4[_0x60e2('0x35')],_0x2132e4['query']);_0x3ca7b5['attributes']=_[_0x60e2('0x39')](_0x2132e4[_0x60e2('0x35')],qs[_0x60e2('0x3a')](_0x5341e8[_0x60e2('0x36')]['fields']));_0x3ca7b5[_0x60e2('0x3b')]=_0x3ca7b5[_0x60e2('0x3b')][_0x60e2('0x4c')]?_0x3ca7b5[_0x60e2('0x3b')]:_0x2132e4[_0x60e2('0x35')];if(_0x5341e8['query'][_0x60e2('0x4d')]){_0x3ca7b5[_0x60e2('0x46')]=[{'all':!![]}];}_0x3ca7b5=_[_0x60e2('0x43')]({},_0x3ca7b5,_0x5341e8[_0x60e2('0x45')]);return db[_0x60e2('0x32')][_0x60e2('0x4e')](_0x3ca7b5)[_0x60e2('0x27')](handleEntityNotFound(_0x420333,null))[_0x60e2('0x27')](respondWithResult(_0x420333,null))['catch'](handleError(_0x420333,null));};exports[_0x60e2('0x4f')]=function(_0x8a37ea,_0x500312){return db[_0x60e2('0x32')][_0x60e2('0x4f')](_0x8a37ea[_0x60e2('0x50')],{})[_0x60e2('0x27')](function(_0x4a3043){var _0x2163f2=_0x8a37ea[_0x60e2('0x51')][_0x60e2('0x29')]({'plain':!![]});if(!_0x2163f2)throw new Error(_0x60e2('0x52'));if(_0x2163f2[_0x60e2('0x53')]===_0x60e2('0x51')){var _0x446240=_0x4a3043[_0x60e2('0x29')]({'plain':!![]});var _0x28dcc4=_0x60e2('0x2a');return db[_0x60e2('0x54')][_0x60e2('0x4e')]({'where':{'name':_0x28dcc4,'userProfileId':_0x2163f2[_0x60e2('0x55')]},'raw':!![]})['then'](function(_0x1e6307){if(_0x1e6307&&_0x1e6307['autoAssociation']===0x0){return db['UserProfileResource'][_0x60e2('0x4f')]({'name':_0x446240[_0x60e2('0x2e')],'resourceId':_0x446240['id'],'type':_0x1e6307[_0x60e2('0x2e')],'sectionId':_0x1e6307['id']},{})[_0x60e2('0x27')](function(){return _0x4a3043;});}else{return _0x4a3043;}})[_0x60e2('0x49')](function(_0x33e77b){logger['error'](_0x60e2('0x56'),_0x33e77b);throw _0x33e77b;});}return _0x4a3043;})['then'](respondWithResult(_0x500312,0xc9))[_0x60e2('0x49')](handleError(_0x500312,null));};exports[_0x60e2('0x26')]=function(_0xbf6e04,_0x11a5a5){if(_0xbf6e04['body']['id']){delete _0xbf6e04[_0x60e2('0x50')]['id'];}return db[_0x60e2('0x32')]['find']({'where':{'id':_0xbf6e04[_0x60e2('0x57')]['id']}})['then'](handleEntityNotFound(_0x11a5a5,null))['then'](saveUpdates(_0xbf6e04[_0x60e2('0x50')],null))['then'](respondWithResult(_0x11a5a5,null))[_0x60e2('0x49')](handleError(_0x11a5a5,null));};exports[_0x60e2('0x28')]=function(_0x1aab96,_0xefcfaf){return db['Tag'][_0x60e2('0x4e')]({'where':{'id':_0x1aab96[_0x60e2('0x57')]['id']}})[_0x60e2('0x27')](handleEntityNotFound(_0xefcfaf,null))['then'](removeEntity(_0xefcfaf,null))['catch'](handleError(_0xefcfaf,null));}; \ No newline at end of file +var _0xba26=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','set','json','apply','reject','save','update','then','get','Tags','UserProfileResource','error','send','index','map','Tag','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0xba26,0x96));var _0x6ba2=function(_0x5c5032,_0x5f5180){_0x5c5032=_0x5c5032-0x0;var _0x59f8dd=_0xba26[_0x5c5032];return _0x59f8dd;};'use strict';var pdf=require(_0x6ba2('0x0'));var emlformat=require(_0x6ba2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ba2('0x2'));var jsonpatch=require(_0x6ba2('0x3'));var rp=require(_0x6ba2('0x4'));var moment=require(_0x6ba2('0x5'));var BPromise=require(_0x6ba2('0x6'));var Mustache=require(_0x6ba2('0x7'));var util=require(_0x6ba2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6ba2('0x9'));var ejs=require(_0x6ba2('0xa'));var fs=require('fs');var _=require(_0x6ba2('0xb'));var squel=require(_0x6ba2('0xc'));var crypto=require(_0x6ba2('0xd'));var jsforce=require(_0x6ba2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6ba2('0x9'));var querystring=require(_0x6ba2('0xf'));var Papa=require(_0x6ba2('0x10'));var Redis=require(_0x6ba2('0x11'));var authService=require(_0x6ba2('0x12'));var qs=require(_0x6ba2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ba2('0x14'));var logger=require('../../config/logger')(_0x6ba2('0x15'));var utils=require('../../config/utils');var config=require(_0x6ba2('0x16'));var licenseUtil=require(_0x6ba2('0x17'));var db=require(_0x6ba2('0x18'))['db'];function respondWithStatusCode(_0x413617,_0xab1d4d){_0xab1d4d=_0xab1d4d||0xcc;return function(_0x281996){if(_0x281996){return _0x413617['sendStatus'](_0xab1d4d);}return _0x413617[_0x6ba2('0x19')](_0xab1d4d)['end']();};}function respondWithResult(_0x533ebd,_0x53797c){_0x53797c=_0x53797c||0xc8;return function(_0xbfbbea){if(_0xbfbbea){return _0x533ebd[_0x6ba2('0x19')](_0x53797c)['json'](_0xbfbbea);}};}function respondWithFilteredResult(_0x357837,_0xaed0ff){return function(_0x35f116){if(_0x35f116){var _0x217e8f=_0x35f116[_0x6ba2('0x1a')],_0x2d1b0c=_0xaed0ff[_0x6ba2('0x1b')],_0x1a3799=_0xaed0ff[_0x6ba2('0x1b')]+_0xaed0ff['limit'],_0x566717;if(_0x1a3799>=_0x217e8f){_0x1a3799=_0x217e8f;_0x566717=0xc8;}else{_0x566717=0xce;}_0x357837['status'](_0x566717);return _0x357837[_0x6ba2('0x1c')]('Content-Range',_0x2d1b0c+'-'+_0x1a3799+'/'+_0x217e8f)[_0x6ba2('0x1d')](_0x35f116);}return null;};}function patchUpdates(_0x4bd375){return function(_0x96a5f1){try{jsonpatch[_0x6ba2('0x1e')](_0x96a5f1,_0x4bd375,!![]);}catch(_0xf815ef){return BPromise[_0x6ba2('0x1f')](_0xf815ef);}return _0x96a5f1[_0x6ba2('0x20')]();};}function saveUpdates(_0x185bac,_0x2e90da){return function(_0x599dbc){if(_0x599dbc){return _0x599dbc[_0x6ba2('0x21')](_0x185bac)[_0x6ba2('0x22')](function(_0x2f2991){return _0x2f2991;});}return null;};}function removeEntity(_0x5cc111,_0x4719df){return function(_0x3a7fde){if(_0x3a7fde){return _0x3a7fde['destroy']()[_0x6ba2('0x22')](function(){var _0x1ed8aa=_0x3a7fde[_0x6ba2('0x23')]({'plain':!![]});var _0x41f0f7=_0x6ba2('0x24');return db[_0x6ba2('0x25')]['destroy']({'where':{'type':_0x41f0f7,'resourceId':_0x1ed8aa['id']}})[_0x6ba2('0x22')](function(){return _0x3a7fde;});})[_0x6ba2('0x22')](function(){_0x5cc111[_0x6ba2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9118be,_0x5baeeb){return function(_0x5cd3b6){if(!_0x5cd3b6){_0x9118be['sendStatus'](0x194);}return _0x5cd3b6;};}function handleError(_0x54a1ad,_0x3a324a){_0x3a324a=_0x3a324a||0x1f4;return function(_0x466af8){logger[_0x6ba2('0x26')](_0x466af8['stack']);if(_0x466af8['name']){delete _0x466af8['name'];}_0x54a1ad[_0x6ba2('0x19')](_0x3a324a)[_0x6ba2('0x27')](_0x466af8);};}exports[_0x6ba2('0x28')]=function(_0x3747c5,_0x29a4c9){var _0x5208dc={},_0x14f758={},_0xa5160b={'count':0x0,'rows':[]};var _0x305632=_[_0x6ba2('0x29')](db[_0x6ba2('0x2a')][_0x6ba2('0x2b')],function(_0x13a099){return{'name':_0x13a099[_0x6ba2('0x2c')],'type':_0x13a099[_0x6ba2('0x2d')][_0x6ba2('0x2e')]};});_0x14f758[_0x6ba2('0x2f')]=_[_0x6ba2('0x29')](_0x305632,_0x6ba2('0x30'));_0x14f758[_0x6ba2('0x31')]=_['keys'](_0x3747c5[_0x6ba2('0x31')]);_0x14f758[_0x6ba2('0x32')]=_[_0x6ba2('0x33')](_0x14f758['model'],_0x14f758[_0x6ba2('0x31')]);_0x5208dc[_0x6ba2('0x34')]=_[_0x6ba2('0x33')](_0x14f758['model'],qs[_0x6ba2('0x35')](_0x3747c5[_0x6ba2('0x31')][_0x6ba2('0x35')]));_0x5208dc[_0x6ba2('0x34')]=_0x5208dc[_0x6ba2('0x34')][_0x6ba2('0x36')]?_0x5208dc[_0x6ba2('0x34')]:_0x14f758[_0x6ba2('0x2f')];if(!_0x3747c5['query'][_0x6ba2('0x37')](_0x6ba2('0x38'))){_0x5208dc[_0x6ba2('0x39')]=qs['limit'](_0x3747c5[_0x6ba2('0x31')]['limit']);_0x5208dc['offset']=qs[_0x6ba2('0x1b')](_0x3747c5['query'][_0x6ba2('0x1b')]);}_0x5208dc[_0x6ba2('0x3a')]=qs[_0x6ba2('0x3b')](_0x3747c5[_0x6ba2('0x31')]['sort']);_0x5208dc[_0x6ba2('0x3c')]=qs[_0x6ba2('0x32')](_[_0x6ba2('0x3d')](_0x3747c5[_0x6ba2('0x31')],_0x14f758[_0x6ba2('0x32')]),_0x305632);if(_0x3747c5['query'][_0x6ba2('0x3e')]){_0x5208dc['where']=_[_0x6ba2('0x3f')](_0x5208dc[_0x6ba2('0x3c')],{'$or':_['map'](_0x305632,function(_0x25b5b8){if(_0x25b5b8[_0x6ba2('0x2d')]!==_0x6ba2('0x40')){var _0x4ed179={};_0x4ed179[_0x25b5b8[_0x6ba2('0x30')]]={'$like':'%'+_0x3747c5['query'][_0x6ba2('0x3e')]+'%'};return _0x4ed179;}})});}_0x5208dc=_[_0x6ba2('0x3f')]({},_0x5208dc,_0x3747c5[_0x6ba2('0x41')]);var _0x95541b={'where':_0x5208dc[_0x6ba2('0x3c')]};return db[_0x6ba2('0x2a')][_0x6ba2('0x1a')](_0x95541b)['then'](function(_0x3849f4){_0xa5160b[_0x6ba2('0x1a')]=_0x3849f4;if(_0x3747c5[_0x6ba2('0x31')][_0x6ba2('0x42')]){_0x5208dc[_0x6ba2('0x43')]=[{'all':!![]}];}return db[_0x6ba2('0x2a')][_0x6ba2('0x44')](_0x5208dc);})[_0x6ba2('0x22')](function(_0xf1c307){_0xa5160b[_0x6ba2('0x45')]=_0xf1c307;return _0xa5160b;})[_0x6ba2('0x22')](respondWithFilteredResult(_0x29a4c9,_0x5208dc))[_0x6ba2('0x46')](handleError(_0x29a4c9,null));};exports['show']=function(_0x13e51a,_0x4bfa67){var _0x500b30={'raw':!![],'where':{'id':_0x13e51a['params']['id']}},_0x42153e={};_0x42153e[_0x6ba2('0x2f')]=_[_0x6ba2('0x47')](db[_0x6ba2('0x2a')][_0x6ba2('0x2b')]);_0x42153e[_0x6ba2('0x31')]=_['keys'](_0x13e51a[_0x6ba2('0x31')]);_0x42153e['filters']=_['intersection'](_0x42153e[_0x6ba2('0x2f')],_0x42153e[_0x6ba2('0x31')]);_0x500b30['attributes']=_[_0x6ba2('0x33')](_0x42153e[_0x6ba2('0x2f')],qs[_0x6ba2('0x35')](_0x13e51a[_0x6ba2('0x31')]['fields']));_0x500b30[_0x6ba2('0x34')]=_0x500b30[_0x6ba2('0x34')][_0x6ba2('0x36')]?_0x500b30[_0x6ba2('0x34')]:_0x42153e['model'];if(_0x13e51a[_0x6ba2('0x31')]['includeAll']){_0x500b30['include']=[{'all':!![]}];}_0x500b30=_[_0x6ba2('0x3f')]({},_0x500b30,_0x13e51a[_0x6ba2('0x41')]);return db[_0x6ba2('0x2a')][_0x6ba2('0x48')](_0x500b30)[_0x6ba2('0x22')](handleEntityNotFound(_0x4bfa67,null))['then'](respondWithResult(_0x4bfa67,null))[_0x6ba2('0x46')](handleError(_0x4bfa67,null));};exports[_0x6ba2('0x49')]=function(_0x690019,_0x10ebba){return db[_0x6ba2('0x2a')][_0x6ba2('0x49')](_0x690019[_0x6ba2('0x4a')],{})[_0x6ba2('0x22')](function(_0x49c8a2){var _0x33fdc6=_0x690019[_0x6ba2('0x4b')]['get']({'plain':!![]});if(!_0x33fdc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fdc6[_0x6ba2('0x4c')]===_0x6ba2('0x4b')){var _0x9fee7=_0x49c8a2['get']({'plain':!![]});var _0x2c552f=_0x6ba2('0x24');return db[_0x6ba2('0x4d')]['find']({'where':{'name':_0x2c552f,'userProfileId':_0x33fdc6[_0x6ba2('0x4e')]},'raw':!![]})[_0x6ba2('0x22')](function(_0x561cf8){if(_0x561cf8&&_0x561cf8[_0x6ba2('0x4f')]===0x0){return db[_0x6ba2('0x25')]['create']({'name':_0x9fee7[_0x6ba2('0x30')],'resourceId':_0x9fee7['id'],'type':_0x561cf8['name'],'sectionId':_0x561cf8['id']},{})[_0x6ba2('0x22')](function(){return _0x49c8a2;});}else{return _0x49c8a2;}})[_0x6ba2('0x46')](function(_0x4349a6){logger[_0x6ba2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4349a6);throw _0x4349a6;});}return _0x49c8a2;})[_0x6ba2('0x22')](respondWithResult(_0x10ebba,0xc9))[_0x6ba2('0x46')](handleError(_0x10ebba,null));};exports['update']=function(_0x291de7,_0x3ed1fa){if(_0x291de7[_0x6ba2('0x4a')]['id']){delete _0x291de7[_0x6ba2('0x4a')]['id'];}return db[_0x6ba2('0x2a')][_0x6ba2('0x48')]({'where':{'id':_0x291de7[_0x6ba2('0x50')]['id']}})[_0x6ba2('0x22')](handleEntityNotFound(_0x3ed1fa,null))[_0x6ba2('0x22')](saveUpdates(_0x291de7['body'],null))[_0x6ba2('0x22')](respondWithResult(_0x3ed1fa,null))['catch'](handleError(_0x3ed1fa,null));};exports['destroy']=function(_0x940e27,_0x66ead3){return db[_0x6ba2('0x2a')][_0x6ba2('0x48')]({'where':{'id':_0x940e27[_0x6ba2('0x50')]['id']}})['then'](handleEntityNotFound(_0x66ead3,null))['then'](removeEntity(_0x66ead3,null))[_0x6ba2('0x46')](handleError(_0x66ead3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b050e4d..3b6b7a2 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 _0xfd7b=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags'];(function(_0x5d7903,_0xf98b9e){var _0x546767=function(_0x437340){while(--_0x437340){_0x5d7903['push'](_0x5d7903['shift']());}};_0x546767(++_0xf98b9e);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xfd7b[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var logger=require(_0xbfd7('0x2'))('api');var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var attributes=require(_0xbfd7('0x8'));module['exports']=function(_0x134ee5,_0x3d054f){return _0x134ee5['define'](_0xbfd7('0x9'),attributes,{'tableName':_0xbfd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1295=['./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x407817,_0x1dafad){var _0x47cd3e=function(_0x135932){while(--_0x135932){_0x407817['push'](_0x407817['shift']());}};_0x47cd3e(++_0x1dafad);}(_0x1295,0x191));var _0x5129=function(_0x4b0aac,_0x2b62e3){_0x4b0aac=_0x4b0aac-0x0;var _0x34c256=_0x1295[_0x4b0aac];return _0x34c256;};'use strict';var _=require(_0x5129('0x0'));var util=require('util');var logger=require(_0x5129('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5129('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5129('0x3'));var rimraf=require(_0x5129('0x4'));var config=require(_0x5129('0x5'));var attributes=require(_0x5129('0x6'));module[_0x5129('0x7')]=function(_0xab9d18,_0x49a7cd){return _0xab9d18[_0x5129('0x8')](_0x5129('0x9'),attributes,{'tableName':_0x5129('0xa'),'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 aef5346..bdde9a3 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 _0xa5fa=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment'];(function(_0x44abbe,_0x4894ed){var _0x3872e8=function(_0x459405){while(--_0x459405){_0x44abbe['push'](_0x44abbe['shift']());}};_0x3872e8(++_0x4894ed);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x33df33,_0x1477b6){_0x33df33=_0x33df33-0x0;var _0x521172=_0xa5fa[_0x33df33];return _0x521172;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('Tag,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});} \ No newline at end of file +var _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xa902,0x8d));var _0x2a90=function(_0x2f0195,_0x185bbb){_0x2f0195=_0x2f0195-0x0;var _0x3a43ec=_0xa902[_0x2f0195];return _0x3a43ec;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('Tag,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('Tag,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index af3ffef..54206e1 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 _0x2ce1=['get','isAuthenticated','index','/:id','show','/:id/queues','/:id/users','getAgents','create','post','addQueues','addAgents','put','update','destroy','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24ba0c,_0x12454c){var _0x523d10=function(_0x3f1667){while(--_0x3f1667){_0x24ba0c['push'](_0x24ba0c['shift']());}};_0x523d10(++_0x12454c);}(_0x2ce1,0x118));var _0x12ce=function(_0x2fb010,_0x3f1a1f){_0x2fb010=_0x2fb010-0x0;var _0x57c3c7=_0x2ce1[_0x2fb010];return _0x57c3c7;};'use strict';var multer=require(_0x12ce('0x0'));var util=require(_0x12ce('0x1'));var path=require(_0x12ce('0x2'));var timeout=require('connect-timeout');var express=require(_0x12ce('0x3'));var router=express[_0x12ce('0x4')]();var auth=require(_0x12ce('0x5'));var interaction=require(_0x12ce('0x6'));var config=require(_0x12ce('0x7'));var controller=require('./team.controller');router[_0x12ce('0x8')]('/',auth[_0x12ce('0x9')](),controller[_0x12ce('0xa')]);router[_0x12ce('0x8')](_0x12ce('0xb'),auth[_0x12ce('0x9')](),controller[_0x12ce('0xc')]);router[_0x12ce('0x8')](_0x12ce('0xd'),auth[_0x12ce('0x9')](),controller['getQueues']);router[_0x12ce('0x8')](_0x12ce('0xe'),auth[_0x12ce('0x9')](),controller[_0x12ce('0xf')]);router['post']('/',auth[_0x12ce('0x9')](),controller[_0x12ce('0x10')]);router[_0x12ce('0x11')](_0x12ce('0xd'),auth[_0x12ce('0x9')](),controller[_0x12ce('0x12')]);router[_0x12ce('0x11')](_0x12ce('0xe'),auth[_0x12ce('0x9')](),controller[_0x12ce('0x13')]);router[_0x12ce('0x14')](_0x12ce('0xb'),auth[_0x12ce('0x9')](),controller[_0x12ce('0x15')]);router['delete'](_0x12ce('0xb'),auth['isAuthenticated'](),controller[_0x12ce('0x16')]);router[_0x12ce('0x17')](_0x12ce('0xd'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x12ce('0x17')](_0x12ce('0xe'),auth[_0x12ce('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd9d8=['express','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','getQueues','/:id/users','getAgents','create','addQueues','post','put','/:id','update','delete','destroy','removeQueues','removeAgents','exports','util','path','connect-timeout'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd9d8,0x1d1));var _0x8d9d=function(_0x17af33,_0xbd7fd7){_0x17af33=_0x17af33-0x0;var _0xccb817=_0xd9d8[_0x17af33];return _0xccb817;};'use strict';var multer=require('multer');var util=require(_0x8d9d('0x0'));var path=require(_0x8d9d('0x1'));var timeout=require(_0x8d9d('0x2'));var express=require(_0x8d9d('0x3'));var router=express['Router']();var auth=require(_0x8d9d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d9d('0x5'));var controller=require(_0x8d9d('0x6'));router[_0x8d9d('0x7')]('/',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d9d('0xa')]);router['get'](_0x8d9d('0xb'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0xc')]);router[_0x8d9d('0x7')](_0x8d9d('0xd'),auth['isAuthenticated'](),controller[_0x8d9d('0xe')]);router['post']('/',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0xf')]);router['post'](_0x8d9d('0xb'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x10')]);router[_0x8d9d('0x11')](_0x8d9d('0xd'),auth[_0x8d9d('0x8')](),controller['addAgents']);router[_0x8d9d('0x12')](_0x8d9d('0x13'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x14')]);router[_0x8d9d('0x15')]('/:id',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x16')]);router['delete']('/:id/queues',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x17')]);router['delete'](_0x8d9d('0xd'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x18')]);module[_0x8d9d('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index a919234..18c73a8 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 _0x9e97=['sequelize','STRING','name'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x9e97,0x156));var _0x79e9=function(_0x4d457d,_0xebda3b){_0x4d457d=_0x4d457d-0x0;var _0x2ed171=_0x9e97[_0x4d457d];return _0x2ed171;};'use strict';var Sequelize=require(_0x79e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x79e9('0x1')],'allowNull':![],'unique':_0x79e9('0x2')},'description':{'type':Sequelize[_0x79e9('0x1')]}}; \ No newline at end of file +var _0x1a71=['name','sequelize','STRING'];(function(_0x46203d,_0x16f203){var _0x46998c=function(_0x2fe9d0){while(--_0x2fe9d0){_0x46203d['push'](_0x46203d['shift']());}};_0x46998c(++_0x16f203);}(_0x1a71,0x184));var _0x11a7=function(_0x27ea81,_0x12a73f){_0x27ea81=_0x27ea81-0x0;var _0x57ccc0=_0x1a71[_0x27ea81];return _0x57ccc0;};'use strict';var Sequelize=require(_0x11a7('0x0'));module['exports']={'name':{'type':Sequelize[_0x11a7('0x1')],'allowNull':![],'unique':_0x11a7('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 c6fcb74..199c38c 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 _0xdab3=['count','offset','set','Content-Range','apply','reject','update','then','Teams','UserProfileResource','destroy','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','keys','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','removeQueues','remove','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','addAgents','spread','removeAgents','Queue:remove','getAgents','order','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json'];(function(_0x89f393,_0x3d3313){var _0x3db04a=function(_0x45a379){while(--_0x45a379){_0x89f393['push'](_0x89f393['shift']());}};_0x3db04a(++_0x3d3313);}(_0xdab3,0xeb));var _0x3dab=function(_0x1eee68,_0x467bbd){_0x1eee68=_0x1eee68-0x0;var _0x58360c=_0xdab3[_0x1eee68];return _0x58360c;};'use strict';var pdf=require(_0x3dab('0x0'));var emlformat=require(_0x3dab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dab('0x2'));var jsonpatch=require(_0x3dab('0x3'));var rp=require(_0x3dab('0x4'));var moment=require(_0x3dab('0x5'));var BPromise=require(_0x3dab('0x6'));var Mustache=require(_0x3dab('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3dab('0x8'));var csv=require(_0x3dab('0x9'));var ejs=require(_0x3dab('0xa'));var fs=require('fs');var _=require(_0x3dab('0xb'));var squel=require(_0x3dab('0xc'));var crypto=require(_0x3dab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dab('0xe'));var toCsv=require(_0x3dab('0x9'));var querystring=require(_0x3dab('0xf'));var Papa=require(_0x3dab('0x10'));var Redis=require(_0x3dab('0x11'));var authService=require(_0x3dab('0x12'));var qs=require(_0x3dab('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dab('0x14'));var logger=require(_0x3dab('0x15'))(_0x3dab('0x16'));var utils=require(_0x3dab('0x17'));var config=require(_0x3dab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3dab('0x19')]=_[_0x3dab('0x1a')](config[_0x3dab('0x19')],{'host':_0x3dab('0x1b'),'port':0x18eb});var socket=require(_0x3dab('0x1c'))(new Redis(config[_0x3dab('0x19')]));require(_0x3dab('0x1d'))[_0x3dab('0x1e')](socket);function respondWithStatusCode(_0x54bf6e,_0x2b5aa8){_0x2b5aa8=_0x2b5aa8||0xcc;return function(_0x1cd8d1){if(_0x1cd8d1){return _0x54bf6e[_0x3dab('0x1f')](_0x2b5aa8);}return _0x54bf6e[_0x3dab('0x20')](_0x2b5aa8)[_0x3dab('0x21')]();};}function respondWithResult(_0x55cb0a,_0x4bd3f1){_0x4bd3f1=_0x4bd3f1||0xc8;return function(_0xbeeee2){if(_0xbeeee2){return _0x55cb0a[_0x3dab('0x20')](_0x4bd3f1)[_0x3dab('0x22')](_0xbeeee2);}};}function respondWithFilteredResult(_0x367942,_0xd70f9a){return function(_0x4f71e1){if(_0x4f71e1){var _0x83a01c=_0x4f71e1[_0x3dab('0x23')],_0x2cca19=_0xd70f9a[_0x3dab('0x24')],_0x578c5e=_0xd70f9a[_0x3dab('0x24')]+_0xd70f9a['limit'],_0x38337d;if(_0x578c5e>=_0x83a01c){_0x578c5e=_0x83a01c;_0x38337d=0xc8;}else{_0x38337d=0xce;}_0x367942[_0x3dab('0x20')](_0x38337d);return _0x367942[_0x3dab('0x25')](_0x3dab('0x26'),_0x2cca19+'-'+_0x578c5e+'/'+_0x83a01c)[_0x3dab('0x22')](_0x4f71e1);}return null;};}function patchUpdates(_0x2e4b09){return function(_0x220247){try{jsonpatch[_0x3dab('0x27')](_0x220247,_0x2e4b09,!![]);}catch(_0x1402f6){return BPromise[_0x3dab('0x28')](_0x1402f6);}return _0x220247['save']();};}function saveUpdates(_0x29d21a,_0x558467){return function(_0x1ea5a0){if(_0x1ea5a0){return _0x1ea5a0[_0x3dab('0x29')](_0x29d21a)[_0x3dab('0x2a')](function(_0x227c86){return _0x227c86;});}return null;};}function removeEntity(_0x39b741,_0x1cf209){return function(_0x57c3fc){if(_0x57c3fc){return _0x57c3fc['destroy']()[_0x3dab('0x2a')](function(){var _0x10f848=_0x57c3fc['get']({'plain':!![]});var _0x21880a=_0x3dab('0x2b');return db[_0x3dab('0x2c')][_0x3dab('0x2d')]({'where':{'type':_0x21880a,'resourceId':_0x10f848['id']}})['then'](function(){return _0x57c3fc;});})[_0x3dab('0x2a')](function(){_0x39b741['status'](0xcc)[_0x3dab('0x21')]();});}};}function handleEntityNotFound(_0x1ed38d,_0x233800){return function(_0x464d84){if(!_0x464d84){_0x1ed38d['sendStatus'](0x194);}return _0x464d84;};}function handleError(_0x4e562c,_0x36f834){_0x36f834=_0x36f834||0x1f4;return function(_0x5bfe9e){logger['error'](_0x5bfe9e['stack']);if(_0x5bfe9e['name']){delete _0x5bfe9e[_0x3dab('0x2e')];}_0x4e562c[_0x3dab('0x20')](_0x36f834)[_0x3dab('0x2f')](_0x5bfe9e);};}exports[_0x3dab('0x30')]=function(_0x2088cc,_0x3f612a){var _0xf2c487={},_0x9d2420={},_0x2e67cb={'count':0x0,'rows':[]};var _0x235922=_[_0x3dab('0x31')](db[_0x3dab('0x32')][_0x3dab('0x33')],function(_0x477f9f){return{'name':_0x477f9f[_0x3dab('0x34')],'type':_0x477f9f[_0x3dab('0x35')][_0x3dab('0x36')]};});_0x9d2420[_0x3dab('0x37')]=_[_0x3dab('0x31')](_0x235922,_0x3dab('0x2e'));_0x9d2420['query']=_['keys'](_0x2088cc[_0x3dab('0x38')]);_0x9d2420['filters']=_[_0x3dab('0x39')](_0x9d2420[_0x3dab('0x37')],_0x9d2420['query']);_0xf2c487[_0x3dab('0x3a')]=_[_0x3dab('0x39')](_0x9d2420[_0x3dab('0x37')],qs[_0x3dab('0x3b')](_0x2088cc['query']['fields']));_0xf2c487[_0x3dab('0x3a')]=_0xf2c487['attributes'][_0x3dab('0x3c')]?_0xf2c487[_0x3dab('0x3a')]:_0x9d2420[_0x3dab('0x37')];if(!_0x2088cc['query']['hasOwnProperty'](_0x3dab('0x3d'))){_0xf2c487[_0x3dab('0x3e')]=qs[_0x3dab('0x3e')](_0x2088cc['query'][_0x3dab('0x3e')]);_0xf2c487[_0x3dab('0x24')]=qs[_0x3dab('0x24')](_0x2088cc[_0x3dab('0x38')][_0x3dab('0x24')]);}_0xf2c487['order']=qs[_0x3dab('0x3f')](_0x2088cc[_0x3dab('0x38')][_0x3dab('0x3f')]);_0xf2c487[_0x3dab('0x40')]=qs[_0x3dab('0x41')](_[_0x3dab('0x42')](_0x2088cc[_0x3dab('0x38')],_0x9d2420['filters']),_0x235922);if(_0x2088cc[_0x3dab('0x38')][_0x3dab('0x43')]){_0xf2c487[_0x3dab('0x40')]=_['merge'](_0xf2c487['where'],{'$or':_[_0x3dab('0x31')](_0x235922,function(_0x1fdf6c){if(_0x1fdf6c[_0x3dab('0x35')]!==_0x3dab('0x44')){var _0x5a201a={};_0x5a201a[_0x1fdf6c[_0x3dab('0x2e')]]={'$like':'%'+_0x2088cc[_0x3dab('0x38')][_0x3dab('0x43')]+'%'};return _0x5a201a;}})});}_0xf2c487=_[_0x3dab('0x45')]({},_0xf2c487,_0x2088cc[_0x3dab('0x46')]);var _0x2f64e8={'where':_0xf2c487['where']};return db[_0x3dab('0x32')]['count'](_0x2f64e8)['then'](function(_0xca04d4){_0x2e67cb['count']=_0xca04d4;if(_0x2088cc[_0x3dab('0x38')][_0x3dab('0x47')]){_0xf2c487[_0x3dab('0x48')]=[{'all':!![]}];}return db['Team'][_0x3dab('0x49')](_0xf2c487);})[_0x3dab('0x2a')](function(_0x407998){_0x2e67cb[_0x3dab('0x4a')]=_0x407998;return _0x2e67cb;})[_0x3dab('0x2a')](respondWithFilteredResult(_0x3f612a,_0xf2c487))[_0x3dab('0x4b')](handleError(_0x3f612a,null));};exports[_0x3dab('0x4c')]=function(_0x57d974,_0x20fcd6){var _0x483989={'raw':![],'where':{'id':_0x57d974[_0x3dab('0x4d')]['id']}},_0x15ae25={};_0x15ae25[_0x3dab('0x37')]=_['keys'](db[_0x3dab('0x32')][_0x3dab('0x33')]);_0x15ae25['query']=_['keys'](_0x57d974[_0x3dab('0x38')]);_0x15ae25[_0x3dab('0x41')]=_[_0x3dab('0x39')](_0x15ae25[_0x3dab('0x37')],_0x15ae25[_0x3dab('0x38')]);_0x483989[_0x3dab('0x3a')]=_[_0x3dab('0x39')](_0x15ae25[_0x3dab('0x37')],qs[_0x3dab('0x3b')](_0x57d974['query']['fields']));_0x483989['attributes']=_0x483989[_0x3dab('0x3a')][_0x3dab('0x3c')]?_0x483989['attributes']:_0x15ae25[_0x3dab('0x37')];if(_0x57d974[_0x3dab('0x38')][_0x3dab('0x47')]){_0x483989[_0x3dab('0x48')]=[{'all':!![]}];}_0x483989=_[_0x3dab('0x45')]({},_0x483989,_0x57d974[_0x3dab('0x46')]);return db['Team'][_0x3dab('0x4e')](_0x483989)['then'](handleEntityNotFound(_0x20fcd6,null))[_0x3dab('0x2a')](respondWithResult(_0x20fcd6,null))[_0x3dab('0x4b')](handleError(_0x20fcd6,null));};exports[_0x3dab('0x4f')]=function(_0x3d6844,_0x5afba8){return db[_0x3dab('0x32')][_0x3dab('0x4f')](_0x3d6844[_0x3dab('0x50')],{})[_0x3dab('0x2a')](function(_0x5b7425){var _0x3f2cf1=_0x3d6844[_0x3dab('0x51')][_0x3dab('0x52')]({'plain':!![]});if(!_0x3f2cf1)throw new Error(_0x3dab('0x53'));if(_0x3f2cf1[_0x3dab('0x54')]==='user'){var _0x37dddd=_0x5b7425['get']({'plain':!![]});var _0xb0657d=_0x3dab('0x2b');return db[_0x3dab('0x55')]['find']({'where':{'name':_0xb0657d,'userProfileId':_0x3f2cf1['userProfileId']},'raw':!![]})[_0x3dab('0x2a')](function(_0x12b421){if(_0x12b421&&_0x12b421[_0x3dab('0x56')]===0x0){return db[_0x3dab('0x2c')]['create']({'name':_0x37dddd[_0x3dab('0x2e')],'resourceId':_0x37dddd['id'],'type':_0x12b421[_0x3dab('0x2e')],'sectionId':_0x12b421['id']},{})[_0x3dab('0x2a')](function(){return _0x5b7425;});}else{return _0x5b7425;}})[_0x3dab('0x4b')](function(_0x5a14cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a14cf);throw _0x5a14cf;});}return _0x5b7425;})[_0x3dab('0x2a')](respondWithResult(_0x5afba8,0xc9))[_0x3dab('0x4b')](handleError(_0x5afba8,null));};exports[_0x3dab('0x29')]=function(_0x3956a5,_0x38fbbe){if(_0x3956a5['body']['id']){delete _0x3956a5[_0x3dab('0x50')]['id'];}return db[_0x3dab('0x32')][_0x3dab('0x4e')]({'where':{'id':_0x3956a5[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](handleEntityNotFound(_0x38fbbe,null))['then'](saveUpdates(_0x3956a5['body'],null))['then'](respondWithResult(_0x38fbbe,null))[_0x3dab('0x4b')](handleError(_0x38fbbe,null));};exports[_0x3dab('0x2d')]=function(_0x1f5fe6,_0x4e4c55){return db[_0x3dab('0x32')][_0x3dab('0x4e')]({'where':{'id':_0x1f5fe6[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](handleEntityNotFound(_0x4e4c55,null))[_0x3dab('0x2a')](removeEntity(_0x4e4c55,null))['catch'](handleError(_0x4e4c55,null));};exports[_0x3dab('0x57')]=function(_0x47d734,_0x5aa4b7,_0x2e468b){return db['Team'][_0x3dab('0x58')]({'where':{'id':_0x47d734[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](handleEntityNotFound(_0x5aa4b7,null))[_0x3dab('0x2a')](function(_0x27387c){if(!_0x47d734[_0x3dab('0x38')][_0x3dab('0x59')]||!utils[_0x3dab('0x5a')](_0x47d734['query'][_0x3dab('0x59')])){throw new db[(_0x3dab('0x5b'))][(_0x3dab('0x5c'))](_0x3dab('0x5d'));}var _0x2d8760={};var _0x155af1={};_0x155af1[_0x3dab('0x37')]=_[_0x3dab('0x5e')](db[_[_0x3dab('0x5f')](_0x47d734[_0x3dab('0x38')][_0x3dab('0x59')][_0x3dab('0x60')]())+_0x3dab('0x61')][_0x3dab('0x33')]);_0x155af1[_0x3dab('0x38')]=_[_0x3dab('0x5e')](_0x47d734[_0x3dab('0x38')]);_0x155af1['filters']=_[_0x3dab('0x39')](_0x155af1[_0x3dab('0x37')],_0x155af1[_0x3dab('0x38')]);_0x2d8760['attributes']=_['intersection'](_0x155af1[_0x3dab('0x37')],qs[_0x3dab('0x3b')](_0x47d734[_0x3dab('0x38')][_0x3dab('0x3b')]));_0x2d8760[_0x3dab('0x3a')]=_0x2d8760[_0x3dab('0x3a')][_0x3dab('0x3c')]?_0x2d8760[_0x3dab('0x3a')]:_0x155af1[_0x3dab('0x37')];_0x2d8760[_0x3dab('0x3e')]=qs[_0x3dab('0x3e')](_0x47d734[_0x3dab('0x38')][_0x3dab('0x3e')]);_0x2d8760[_0x3dab('0x24')]=qs[_0x3dab('0x24')](_0x47d734[_0x3dab('0x38')][_0x3dab('0x24')]);_0x2d8760['order']=qs['sort'](_0x47d734[_0x3dab('0x38')]['sort']);_0x2d8760[_0x3dab('0x40')]=qs[_0x3dab('0x41')](_['pick'](_0x47d734[_0x3dab('0x38')],_0x155af1[_0x3dab('0x41')]));_0x2d8760=_[_0x3dab('0x45')]({},_0x2d8760,_0x47d734['options']);return _0x27387c[_0x3dab('0x52')+_[_0x3dab('0x5f')](_0x47d734['query'][_0x3dab('0x59')][_0x3dab('0x60')]())+'Queues'](_0x2d8760);})[_0x3dab('0x2a')](respondWithResult(_0x5aa4b7,null))[_0x3dab('0x4b')](handleError(_0x5aa4b7,null));};exports[_0x3dab('0x62')]=function(_0x5655b9,_0x480102,_0x39a06f){return db[_0x3dab('0x32')][_0x3dab('0x58')]({'where':{'id':_0x5655b9[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](function(_0x248439){if(_0x248439){if(!_0x5655b9[_0x3dab('0x50')][_0x3dab('0x59')]||!utils['isValidChannel'](_0x5655b9['body']['channel'])){throw new db[(_0x3dab('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x248439[_0x3dab('0x63')+_[_0x3dab('0x5f')](_0x5655b9[_0x3dab('0x50')][_0x3dab('0x59')][_0x3dab('0x60')]())+_0x3dab('0x64')](_0x5655b9[_0x3dab('0x50')][_0x3dab('0x65')]);}return null;})[_0x3dab('0x2a')](handleEntityNotFound(_0x480102,null))['then'](respondWithStatusCode(_0x480102,null))['catch'](handleError(_0x480102,null));};exports[_0x3dab('0x66')]=function(_0x2da619,_0x43d796,_0x341c9f){return db[_0x3dab('0x32')][_0x3dab('0x58')]({'where':{'id':_0x2da619[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](function(_0x15a847){if(_0x15a847){if(!_0x2da619[_0x3dab('0x38')][_0x3dab('0x59')]||!utils[_0x3dab('0x5a')](_0x2da619[_0x3dab('0x38')]['channel'])){throw new db[(_0x3dab('0x5b'))][(_0x3dab('0x5c'))]('Unknown\x20channel');}return _0x15a847[_0x3dab('0x67')+_[_0x3dab('0x5f')](_0x2da619['query']['channel'][_0x3dab('0x60')]())+'Queues'](_0x2da619[_0x3dab('0x38')][_0x3dab('0x65')]);}return null;})['then'](handleEntityNotFound(_0x43d796,null))[_0x3dab('0x2a')](respondWithStatusCode(_0x43d796,null))[_0x3dab('0x4b')](handleError(_0x43d796,null));};exports['addAgents']=function(_0x4cfd59,_0x9b7dd2){return db[_0x3dab('0x32')][_0x3dab('0x4e')]({'where':{'id':_0x4cfd59[_0x3dab('0x4d')]['id']}})['then'](handleEntityNotFound(_0x9b7dd2,null))[_0x3dab('0x2a')](function(_0xf96874){if(_0xf96874){var _0x5cdf37=['Voice',_0x3dab('0x68'),_0x3dab('0x69'),_0x3dab('0x6a'),_0x3dab('0x6b'),_0x3dab('0x6c'),_0x3dab('0x6d')];return db[_0x3dab('0x6e')][_0x3dab('0x6f')](function(_0x2555c9){var _0x9e50d1=_[_0x3dab('0x31')](_0x5cdf37,function(_0x59d35d){var _0x46e0da={'attributes':['id','name']};if(_0x59d35d===_0x3dab('0x70')){_0x46e0da[_0x3dab('0x71')]={'attributes':[_0x3dab('0x72')]};}return _0xf96874['get'+_0x59d35d+'Queues'](_0x46e0da)[_0x3dab('0x2a')](function(_0xfabfd0){var _0xd2a7b5=_['map'](_0xfabfd0,function(_0x45d770){var _0x3d133f=_[_0x3dab('0x31')](_0x4cfd59[_0x3dab('0x50')][_0x3dab('0x65')],function(_0x5b022d){var _0x343b7c={'where':{'UserId':_0x5b022d,[_0x59d35d+_0x3dab('0x73')]:_0x45d770['id']},'transaction':_0x2555c9};if(_0x59d35d==='Voice'){_0x343b7c['defaults']={'penalty':_0x45d770[_0x3dab('0x74')]['penalty']};}return db[_0x3dab('0x75')+_0x59d35d+'Queue'][_0x3dab('0x76')](_0x343b7c)['then'](function(){socket[_0x3dab('0x77')](_0x3dab('0x51')+_0x59d35d+_0x3dab('0x78'),{'UserId':_0x5b022d,[_0x59d35d+_0x3dab('0x73')]:_0x45d770['id']});if(_0x59d35d!==_0x3dab('0x70'))return;return db['User'][_0x3dab('0x49')]({'where':{'id':_0x4cfd59[_0x3dab('0x50')]['ids'],'online':0x1},'attributes':['id','name',_0x3dab('0x79'),'voicePause',_0x3dab('0x7a')],'raw':!![]})[_0x3dab('0x2a')](function(_0x3be989){var _0x1a5c41=_[_0x3dab('0x31')](_0x3be989,function(_0x2854d2){return db[_0x3dab('0x7b')][_0x3dab('0x7c')]({'membername':_0x2854d2[_0x3dab('0x2e')],'UserId':_0x2854d2['id'],'queue_name':_0x45d770['name'],'VoiceQueueId':_0x45d770['id'],'interface':_['isNil'](_0x2854d2[_0x3dab('0x7a')])?util[_0x3dab('0x7d')](_0x3dab('0x7e'),_0x2854d2[_0x3dab('0x2e')]):_0x2854d2[_0x3dab('0x7a')],'paused':_0x2854d2['voicePause']||![],'penalty':_0x45d770['TeamVoiceQueue'][_0x3dab('0x72')]},{'transaction':_0x2555c9});});return Promise['all'](_0x1a5c41);});});});return Promise[_0x3dab('0x7f')](_0x3d133f);});return Promise['all'](_0xd2a7b5);});});return Promise[_0x3dab('0x7f')](_0x9e50d1)[_0x3dab('0x2a')](function(){return _0xf96874[_0x3dab('0x80')](_0x4cfd59['body'][_0x3dab('0x65')],{'transaction':_0x2555c9})[_0x3dab('0x81')](function(_0x10ee70){return _0x10ee70;});});});}})[_0x3dab('0x2a')](respondWithResult(_0x9b7dd2,null))['catch'](handleError(_0x9b7dd2,null));};exports[_0x3dab('0x82')]=function(_0x30826d,_0x5be801){return db[_0x3dab('0x32')][_0x3dab('0x4e')]({'where':{'id':_0x30826d[_0x3dab('0x4d')]['id']}})[_0x3dab('0x2a')](handleEntityNotFound(_0x5be801,null))[_0x3dab('0x2a')](function(_0x410174){if(_0x410174){var _0x52214f=[_0x3dab('0x70'),_0x3dab('0x68'),_0x3dab('0x69'),_0x3dab('0x6a'),_0x3dab('0x6b'),'Openchannel',_0x3dab('0x6d')];return db[_0x3dab('0x6e')][_0x3dab('0x6f')](function(_0x35c9ef){var _0x77779b=_['map'](_0x52214f,function(_0x45cef8){var _0x4fe71c={'attributes':['id',_0x3dab('0x2e')]};return _0x410174['get'+_0x45cef8+_0x3dab('0x64')](_0x4fe71c)['then'](function(_0x622f3a){var _0x4ad625=_['map'](_0x622f3a,function(_0x89d08f){return _0x89d08f[_0x3dab('0x82')](_0x30826d[_0x3dab('0x38')][_0x3dab('0x65')],{'transaction':_0x35c9ef})[_0x3dab('0x2a')](function(){var _0x5ae403=JSON['parse']('['+_0x30826d[_0x3dab('0x38')][_0x3dab('0x65')]+']');var _0xfa662=_[_0x3dab('0x31')](_0x5ae403,function(_0x3d2b5a){socket[_0x3dab('0x77')](_0x3dab('0x51')+_0x45cef8+_0x3dab('0x83'),{'UserId':Number(_0x3d2b5a),[_0x45cef8+_0x3dab('0x73')]:_0x89d08f['id']});if(_0x45cef8!==_0x3dab('0x70'))return;return db[_0x3dab('0x7b')][_0x3dab('0x2d')]({'where':{'VoiceQueueId':_0x89d08f['id'],'UserId':_0x3d2b5a},'transaction':_0x35c9ef});});return Promise[_0x3dab('0x7f')](_0xfa662);});});return Promise['all'](_0x4ad625);});});return Promise[_0x3dab('0x7f')](_0x77779b)[_0x3dab('0x2a')](function(){return _0x410174[_0x3dab('0x82')](_0x30826d['query'][_0x3dab('0x65')],{'transaction':_0x35c9ef});});});}})['then'](respondWithStatusCode(_0x5be801,null))[_0x3dab('0x4b')](handleError(_0x5be801,null));};exports[_0x3dab('0x84')]=function(_0x58213e,_0x8a0788,_0x177863){var _0x25d501={};var _0xb312c1={};var _0x21cdfd;var _0x3b7edf;return db['Team'][_0x3dab('0x58')]({'where':{'id':_0x58213e['params']['id']}})[_0x3dab('0x2a')](handleEntityNotFound(_0x8a0788,null))[_0x3dab('0x2a')](function(_0x23a896){if(_0x23a896){_0x21cdfd=_0x23a896;_0xb312c1[_0x3dab('0x37')]=_[_0x3dab('0x5e')](db[_0x3dab('0x75')]['rawAttributes']);_0xb312c1[_0x3dab('0x38')]=_[_0x3dab('0x5e')](_0x58213e[_0x3dab('0x38')]);_0xb312c1[_0x3dab('0x41')]=_[_0x3dab('0x39')](_0xb312c1[_0x3dab('0x37')],_0xb312c1[_0x3dab('0x38')]);_0x25d501[_0x3dab('0x3a')]=_[_0x3dab('0x39')](_0xb312c1[_0x3dab('0x37')],qs[_0x3dab('0x3b')](_0x58213e[_0x3dab('0x38')][_0x3dab('0x3b')]));_0x25d501[_0x3dab('0x3a')]=_0x25d501[_0x3dab('0x3a')][_0x3dab('0x3c')]?_0x25d501[_0x3dab('0x3a')]:_0xb312c1['model'];_0x25d501[_0x3dab('0x85')]=qs['sort'](_0x58213e[_0x3dab('0x38')]['sort']);_0x25d501['where']=qs[_0x3dab('0x41')](_[_0x3dab('0x42')](_0x58213e[_0x3dab('0x38')],_0xb312c1['filters']));if(_0x58213e[_0x3dab('0x38')][_0x3dab('0x43')]){_0x25d501[_0x3dab('0x40')]=_['merge'](_0x25d501['where'],{'$or':_['map'](_0x25d501[_0x3dab('0x3a')],function(_0x471cdb){var _0x45bf7e={};_0x45bf7e[_0x471cdb]={'$like':'%'+_0x58213e[_0x3dab('0x38')][_0x3dab('0x43')]+'%'};return _0x45bf7e;})});}_0x25d501=_[_0x3dab('0x45')]({},_0x25d501,_0x58213e['options']);return _0x21cdfd['getAgents'](_0x25d501);}})[_0x3dab('0x2a')](function(_0x5d5beb){if(_0x5d5beb){_0x3b7edf=_0x5d5beb[_0x3dab('0x3c')];if(!_0x58213e[_0x3dab('0x38')][_0x3dab('0x86')](_0x3dab('0x3d'))){_0x25d501[_0x3dab('0x3e')]=qs['limit'](_0x58213e[_0x3dab('0x38')]['limit']);_0x25d501[_0x3dab('0x24')]=qs['offset'](_0x58213e['query'][_0x3dab('0x24')]);}return _0x21cdfd['getAgents'](_0x25d501);}})[_0x3dab('0x2a')](function(_0x12934c){if(_0x12934c){return _0x12934c?{'count':_0x3b7edf,'rows':_0x12934c}:null;}})[_0x3dab('0x2a')](respondWithResult(_0x8a0788,null))[_0x3dab('0x4b')](handleError(_0x8a0788,null));}; \ No newline at end of file +var _0x1a37=['get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','Queue','addQueues','add','toLowerCase','Queues','ids','removeQueues','ValidationError','remove','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','TeamVoiceQueue','penalty','User','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','format','all','spread','removeAgents','parse','emit','Queue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Teams','end','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','find','create','body','user'];(function(_0x302485,_0x3d7744){var _0x372e41=function(_0x1900c6){while(--_0x1900c6){_0x302485['push'](_0x302485['shift']());}};_0x372e41(++_0x3d7744);}(_0x1a37,0xb4));var _0x71a3=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x1a37[_0x1969a7];return _0x3d665f;};'use strict';var pdf=require(_0x71a3('0x0'));var emlformat=require(_0x71a3('0x1'));var rimraf=require(_0x71a3('0x2'));var zipdir=require(_0x71a3('0x3'));var jsonpatch=require(_0x71a3('0x4'));var rp=require(_0x71a3('0x5'));var moment=require(_0x71a3('0x6'));var BPromise=require(_0x71a3('0x7'));var Mustache=require(_0x71a3('0x8'));var util=require(_0x71a3('0x9'));var path=require('path');var sox=require(_0x71a3('0xa'));var csv=require('to-csv');var ejs=require(_0x71a3('0xb'));var fs=require('fs');var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];config[_0x71a3('0x18')]=_[_0x71a3('0x19')](config[_0x71a3('0x18')],{'host':_0x71a3('0x1a'),'port':0x18eb});var socket=require(_0x71a3('0x1b'))(new Redis(config[_0x71a3('0x18')]));require(_0x71a3('0x1c'))[_0x71a3('0x1d')](socket);function respondWithStatusCode(_0x203ee1,_0x21a34d){_0x21a34d=_0x21a34d||0xcc;return function(_0x5a40c3){if(_0x5a40c3){return _0x203ee1[_0x71a3('0x1e')](_0x21a34d);}return _0x203ee1[_0x71a3('0x1f')](_0x21a34d)['end']();};}function respondWithResult(_0x4aa918,_0x41fe1c){_0x41fe1c=_0x41fe1c||0xc8;return function(_0x3a1c81){if(_0x3a1c81){return _0x4aa918[_0x71a3('0x1f')](_0x41fe1c)[_0x71a3('0x20')](_0x3a1c81);}};}function respondWithFilteredResult(_0x1af1bc,_0x318ff6){return function(_0x5d4dee){if(_0x5d4dee){var _0x656cd2=_0x5d4dee[_0x71a3('0x21')],_0x27bfb4=_0x318ff6[_0x71a3('0x22')],_0x5b955a=_0x318ff6[_0x71a3('0x22')]+_0x318ff6[_0x71a3('0x23')],_0x5f4562;if(_0x5b955a>=_0x656cd2){_0x5b955a=_0x656cd2;_0x5f4562=0xc8;}else{_0x5f4562=0xce;}_0x1af1bc[_0x71a3('0x1f')](_0x5f4562);return _0x1af1bc['set'](_0x71a3('0x24'),_0x27bfb4+'-'+_0x5b955a+'/'+_0x656cd2)[_0x71a3('0x20')](_0x5d4dee);}return null;};}function patchUpdates(_0x28535b){return function(_0x3ea036){try{jsonpatch[_0x71a3('0x25')](_0x3ea036,_0x28535b,!![]);}catch(_0x50ab3a){return BPromise[_0x71a3('0x26')](_0x50ab3a);}return _0x3ea036['save']();};}function saveUpdates(_0x3bf78e,_0x35d1d4){return function(_0x2982b9){if(_0x2982b9){return _0x2982b9[_0x71a3('0x27')](_0x3bf78e)[_0x71a3('0x28')](function(_0x2847b4){return _0x2847b4;});}return null;};}function removeEntity(_0x5f33c5,_0x26e6e7){return function(_0x299d1d){if(_0x299d1d){return _0x299d1d[_0x71a3('0x29')]()[_0x71a3('0x28')](function(){var _0xb0f3aa=_0x299d1d['get']({'plain':!![]});var _0x107fbd=_0x71a3('0x2a');return db['UserProfileResource'][_0x71a3('0x29')]({'where':{'type':_0x107fbd,'resourceId':_0xb0f3aa['id']}})['then'](function(){return _0x299d1d;});})[_0x71a3('0x28')](function(){_0x5f33c5[_0x71a3('0x1f')](0xcc)[_0x71a3('0x2b')]();});}};}function handleEntityNotFound(_0x35b5c7,_0x25f351){return function(_0x314439){if(!_0x314439){_0x35b5c7[_0x71a3('0x1e')](0x194);}return _0x314439;};}function handleError(_0x242b85,_0x305eb1){_0x305eb1=_0x305eb1||0x1f4;return function(_0x3fc578){logger[_0x71a3('0x2c')](_0x3fc578[_0x71a3('0x2d')]);if(_0x3fc578['name']){delete _0x3fc578[_0x71a3('0x2e')];}_0x242b85[_0x71a3('0x1f')](_0x305eb1)[_0x71a3('0x2f')](_0x3fc578);};}exports[_0x71a3('0x30')]=function(_0x4a750c,_0x18a8fe){var _0x216d84={},_0x45d13d={},_0x114032={'count':0x0,'rows':[]};var _0x39734f=_[_0x71a3('0x31')](db[_0x71a3('0x32')]['rawAttributes'],function(_0x2ccd54){return{'name':_0x2ccd54[_0x71a3('0x33')],'type':_0x2ccd54[_0x71a3('0x34')][_0x71a3('0x35')]};});_0x45d13d[_0x71a3('0x36')]=_[_0x71a3('0x31')](_0x39734f,_0x71a3('0x2e'));_0x45d13d[_0x71a3('0x37')]=_[_0x71a3('0x38')](_0x4a750c[_0x71a3('0x37')]);_0x45d13d[_0x71a3('0x39')]=_[_0x71a3('0x3a')](_0x45d13d[_0x71a3('0x36')],_0x45d13d['query']);_0x216d84['attributes']=_[_0x71a3('0x3a')](_0x45d13d[_0x71a3('0x36')],qs['fields'](_0x4a750c[_0x71a3('0x37')][_0x71a3('0x3b')]));_0x216d84['attributes']=_0x216d84[_0x71a3('0x3c')][_0x71a3('0x3d')]?_0x216d84[_0x71a3('0x3c')]:_0x45d13d[_0x71a3('0x36')];if(!_0x4a750c[_0x71a3('0x37')][_0x71a3('0x3e')](_0x71a3('0x3f'))){_0x216d84['limit']=qs[_0x71a3('0x23')](_0x4a750c[_0x71a3('0x37')][_0x71a3('0x23')]);_0x216d84['offset']=qs[_0x71a3('0x22')](_0x4a750c[_0x71a3('0x37')][_0x71a3('0x22')]);}_0x216d84[_0x71a3('0x40')]=qs[_0x71a3('0x41')](_0x4a750c['query']['sort']);_0x216d84[_0x71a3('0x42')]=qs[_0x71a3('0x39')](_[_0x71a3('0x43')](_0x4a750c[_0x71a3('0x37')],_0x45d13d[_0x71a3('0x39')]),_0x39734f);if(_0x4a750c['query'][_0x71a3('0x44')]){_0x216d84[_0x71a3('0x42')]=_[_0x71a3('0x45')](_0x216d84['where'],{'$or':_[_0x71a3('0x31')](_0x39734f,function(_0x5bf66c){if(_0x5bf66c[_0x71a3('0x34')]!==_0x71a3('0x46')){var _0x46e6ce={};_0x46e6ce[_0x5bf66c[_0x71a3('0x2e')]]={'$like':'%'+_0x4a750c[_0x71a3('0x37')][_0x71a3('0x44')]+'%'};return _0x46e6ce;}})});}_0x216d84=_[_0x71a3('0x45')]({},_0x216d84,_0x4a750c[_0x71a3('0x47')]);var _0x31ba66={'where':_0x216d84[_0x71a3('0x42')]};return db['Team'][_0x71a3('0x21')](_0x31ba66)['then'](function(_0x4472dd){_0x114032[_0x71a3('0x21')]=_0x4472dd;if(_0x4a750c[_0x71a3('0x37')][_0x71a3('0x48')]){_0x216d84['include']=[{'all':!![]}];}return db[_0x71a3('0x32')][_0x71a3('0x49')](_0x216d84);})['then'](function(_0x3abfe7){_0x114032[_0x71a3('0x4a')]=_0x3abfe7;return _0x114032;})[_0x71a3('0x28')](respondWithFilteredResult(_0x18a8fe,_0x216d84))[_0x71a3('0x4b')](handleError(_0x18a8fe,null));};exports['show']=function(_0x248a04,_0x615c6f){var _0x36a950={'raw':![],'where':{'id':_0x248a04[_0x71a3('0x4c')]['id']}},_0x34bc7f={};_0x34bc7f[_0x71a3('0x36')]=_[_0x71a3('0x38')](db[_0x71a3('0x32')][_0x71a3('0x4d')]);_0x34bc7f[_0x71a3('0x37')]=_[_0x71a3('0x38')](_0x248a04[_0x71a3('0x37')]);_0x34bc7f[_0x71a3('0x39')]=_[_0x71a3('0x3a')](_0x34bc7f[_0x71a3('0x36')],_0x34bc7f[_0x71a3('0x37')]);_0x36a950['attributes']=_[_0x71a3('0x3a')](_0x34bc7f[_0x71a3('0x36')],qs['fields'](_0x248a04[_0x71a3('0x37')][_0x71a3('0x3b')]));_0x36a950[_0x71a3('0x3c')]=_0x36a950[_0x71a3('0x3c')][_0x71a3('0x3d')]?_0x36a950['attributes']:_0x34bc7f['model'];if(_0x248a04[_0x71a3('0x37')][_0x71a3('0x48')]){_0x36a950['include']=[{'all':!![]}];}_0x36a950=_[_0x71a3('0x45')]({},_0x36a950,_0x248a04[_0x71a3('0x47')]);return db[_0x71a3('0x32')][_0x71a3('0x4e')](_0x36a950)[_0x71a3('0x28')](handleEntityNotFound(_0x615c6f,null))[_0x71a3('0x28')](respondWithResult(_0x615c6f,null))['catch'](handleError(_0x615c6f,null));};exports[_0x71a3('0x4f')]=function(_0x584e7a,_0x48ff9d){return db[_0x71a3('0x32')][_0x71a3('0x4f')](_0x584e7a[_0x71a3('0x50')],{})[_0x71a3('0x28')](function(_0x48fcd7){var _0x263706=_0x584e7a[_0x71a3('0x51')][_0x71a3('0x52')]({'plain':!![]});if(!_0x263706)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x263706[_0x71a3('0x53')]==='user'){var _0x278e11=_0x48fcd7[_0x71a3('0x52')]({'plain':!![]});var _0x5c6450=_0x71a3('0x2a');return db[_0x71a3('0x54')][_0x71a3('0x4e')]({'where':{'name':_0x5c6450,'userProfileId':_0x263706[_0x71a3('0x55')]},'raw':!![]})[_0x71a3('0x28')](function(_0x3952c0){if(_0x3952c0&&_0x3952c0[_0x71a3('0x56')]===0x0){return db['UserProfileResource'][_0x71a3('0x4f')]({'name':_0x278e11['name'],'resourceId':_0x278e11['id'],'type':_0x3952c0[_0x71a3('0x2e')],'sectionId':_0x3952c0['id']},{})['then'](function(){return _0x48fcd7;});}else{return _0x48fcd7;}})[_0x71a3('0x4b')](function(_0xa09676){logger[_0x71a3('0x2c')](_0x71a3('0x57'),_0xa09676);throw _0xa09676;});}return _0x48fcd7;})['then'](respondWithResult(_0x48ff9d,0xc9))['catch'](handleError(_0x48ff9d,null));};exports[_0x71a3('0x27')]=function(_0x2a4e29,_0x3b82f7){if(_0x2a4e29[_0x71a3('0x50')]['id']){delete _0x2a4e29['body']['id'];}return db['Team'][_0x71a3('0x4e')]({'where':{'id':_0x2a4e29[_0x71a3('0x4c')]['id']}})[_0x71a3('0x28')](handleEntityNotFound(_0x3b82f7,null))[_0x71a3('0x28')](saveUpdates(_0x2a4e29[_0x71a3('0x50')],null))['then'](respondWithResult(_0x3b82f7,null))[_0x71a3('0x4b')](handleError(_0x3b82f7,null));};exports[_0x71a3('0x29')]=function(_0x70defc,_0xef4e53){return db[_0x71a3('0x32')][_0x71a3('0x4e')]({'where':{'id':_0x70defc[_0x71a3('0x4c')]['id']}})[_0x71a3('0x28')](handleEntityNotFound(_0xef4e53,null))['then'](removeEntity(_0xef4e53,null))[_0x71a3('0x4b')](handleError(_0xef4e53,null));};exports[_0x71a3('0x58')]=function(_0x563270,_0x56dea4,_0xc21b6f){return db[_0x71a3('0x32')][_0x71a3('0x59')]({'where':{'id':_0x563270[_0x71a3('0x4c')]['id']}})[_0x71a3('0x28')](handleEntityNotFound(_0x56dea4,null))[_0x71a3('0x28')](function(_0x453b78){if(!_0x563270[_0x71a3('0x37')][_0x71a3('0x5a')]||!utils[_0x71a3('0x5b')](_0x563270['query'][_0x71a3('0x5a')])){throw new db[(_0x71a3('0x5c'))]['ValidationError'](_0x71a3('0x5d'));}var _0x59bf1b={};var _0x566bc5={};_0x566bc5[_0x71a3('0x36')]=_[_0x71a3('0x38')](db[_[_0x71a3('0x5e')](_0x563270[_0x71a3('0x37')][_0x71a3('0x5a')]['toLowerCase']())+_0x71a3('0x5f')][_0x71a3('0x4d')]);_0x566bc5['query']=_[_0x71a3('0x38')](_0x563270['query']);_0x566bc5[_0x71a3('0x39')]=_[_0x71a3('0x3a')](_0x566bc5['model'],_0x566bc5['query']);_0x59bf1b[_0x71a3('0x3c')]=_[_0x71a3('0x3a')](_0x566bc5['model'],qs[_0x71a3('0x3b')](_0x563270[_0x71a3('0x37')][_0x71a3('0x3b')]));_0x59bf1b['attributes']=_0x59bf1b[_0x71a3('0x3c')][_0x71a3('0x3d')]?_0x59bf1b[_0x71a3('0x3c')]:_0x566bc5[_0x71a3('0x36')];_0x59bf1b[_0x71a3('0x23')]=qs[_0x71a3('0x23')](_0x563270[_0x71a3('0x37')][_0x71a3('0x23')]);_0x59bf1b[_0x71a3('0x22')]=qs['offset'](_0x563270[_0x71a3('0x37')][_0x71a3('0x22')]);_0x59bf1b[_0x71a3('0x40')]=qs['sort'](_0x563270[_0x71a3('0x37')][_0x71a3('0x41')]);_0x59bf1b[_0x71a3('0x42')]=qs[_0x71a3('0x39')](_[_0x71a3('0x43')](_0x563270[_0x71a3('0x37')],_0x566bc5[_0x71a3('0x39')]));_0x59bf1b=_[_0x71a3('0x45')]({},_0x59bf1b,_0x563270[_0x71a3('0x47')]);return _0x453b78['get'+_[_0x71a3('0x5e')](_0x563270['query'][_0x71a3('0x5a')]['toLowerCase']())+'Queues'](_0x59bf1b);})[_0x71a3('0x28')](respondWithResult(_0x56dea4,null))['catch'](handleError(_0x56dea4,null));};exports[_0x71a3('0x60')]=function(_0x271e37,_0x239d18,_0x4aa296){return db[_0x71a3('0x32')][_0x71a3('0x59')]({'where':{'id':_0x271e37['params']['id']}})[_0x71a3('0x28')](function(_0x189320){if(_0x189320){if(!_0x271e37[_0x71a3('0x50')][_0x71a3('0x5a')]||!utils[_0x71a3('0x5b')](_0x271e37[_0x71a3('0x50')][_0x71a3('0x5a')])){throw new db[(_0x71a3('0x5c'))]['ValidationError']('Unknown\x20channel');}return _0x189320[_0x71a3('0x61')+_[_0x71a3('0x5e')](_0x271e37[_0x71a3('0x50')]['channel'][_0x71a3('0x62')]())+_0x71a3('0x63')](_0x271e37['body'][_0x71a3('0x64')]);}return null;})['then'](handleEntityNotFound(_0x239d18,null))[_0x71a3('0x28')](respondWithStatusCode(_0x239d18,null))[_0x71a3('0x4b')](handleError(_0x239d18,null));};exports[_0x71a3('0x65')]=function(_0x184389,_0x528c4b,_0x7c9e78){return db[_0x71a3('0x32')]['findOne']({'where':{'id':_0x184389[_0x71a3('0x4c')]['id']}})[_0x71a3('0x28')](function(_0x2bad2e){if(_0x2bad2e){if(!_0x184389[_0x71a3('0x37')][_0x71a3('0x5a')]||!utils[_0x71a3('0x5b')](_0x184389[_0x71a3('0x37')][_0x71a3('0x5a')])){throw new db[(_0x71a3('0x5c'))][(_0x71a3('0x66'))](_0x71a3('0x5d'));}return _0x2bad2e[_0x71a3('0x67')+_['capitalize'](_0x184389[_0x71a3('0x37')]['channel'][_0x71a3('0x62')]())+_0x71a3('0x63')](_0x184389[_0x71a3('0x37')][_0x71a3('0x64')]);}return null;})[_0x71a3('0x28')](handleEntityNotFound(_0x528c4b,null))[_0x71a3('0x28')](respondWithStatusCode(_0x528c4b,null))[_0x71a3('0x4b')](handleError(_0x528c4b,null));};exports[_0x71a3('0x68')]=function(_0x291e47,_0x290abb){return db[_0x71a3('0x32')][_0x71a3('0x4e')]({'where':{'id':_0x291e47[_0x71a3('0x4c')]['id']}})[_0x71a3('0x28')](handleEntityNotFound(_0x290abb,null))[_0x71a3('0x28')](function(_0x1227a9){if(_0x1227a9){var _0x3b14e0=[_0x71a3('0x69'),_0x71a3('0x6a'),'Mail',_0x71a3('0x6b'),_0x71a3('0x6c'),_0x71a3('0x6d'),_0x71a3('0x6e')];return db[_0x71a3('0x6f')][_0x71a3('0x70')](function(_0x35e802){var _0x5a5f84=_[_0x71a3('0x31')](_0x3b14e0,function(_0x49dda8){var _0x552ff7={'attributes':['id','name']};if(_0x49dda8==='Voice'){_0x552ff7['through']={'attributes':['penalty']};}return _0x1227a9[_0x71a3('0x52')+_0x49dda8+_0x71a3('0x63')](_0x552ff7)[_0x71a3('0x28')](function(_0x248521){var _0x17e205=_[_0x71a3('0x31')](_0x248521,function(_0x236db9){var _0x16d74c=_[_0x71a3('0x31')](_0x291e47[_0x71a3('0x50')][_0x71a3('0x64')],function(_0x2eb25c){var _0x26fa56={'where':{'UserId':_0x2eb25c,[_0x49dda8+'QueueId']:_0x236db9['id']},'transaction':_0x35e802};if(_0x49dda8===_0x71a3('0x69')){_0x26fa56[_0x71a3('0x19')]={'penalty':_0x236db9[_0x71a3('0x71')][_0x71a3('0x72')]};}return db[_0x71a3('0x73')+_0x49dda8+_0x71a3('0x5f')]['findOrCreate'](_0x26fa56)['then'](function(){socket['emit'](_0x71a3('0x51')+_0x49dda8+_0x71a3('0x74'),{'UserId':_0x2eb25c,[_0x49dda8+_0x71a3('0x75')]:_0x236db9['id']});if(_0x49dda8!=='Voice')return;return db[_0x71a3('0x73')][_0x71a3('0x49')]({'where':{'id':_0x291e47[_0x71a3('0x50')][_0x71a3('0x64')],'online':0x1},'attributes':['id',_0x71a3('0x2e'),_0x71a3('0x76'),_0x71a3('0x77'),_0x71a3('0x78')],'raw':!![]})[_0x71a3('0x28')](function(_0x583029){var _0x442eef=_[_0x71a3('0x31')](_0x583029,function(_0x48b3fc){return db[_0x71a3('0x79')]['upsert']({'membername':_0x48b3fc[_0x71a3('0x2e')],'UserId':_0x48b3fc['id'],'queue_name':_0x236db9[_0x71a3('0x2e')],'VoiceQueueId':_0x236db9['id'],'interface':_[_0x71a3('0x7a')](_0x48b3fc[_0x71a3('0x78')])?util[_0x71a3('0x7b')]('SIP/%s',_0x48b3fc[_0x71a3('0x2e')]):_0x48b3fc[_0x71a3('0x78')],'paused':_0x48b3fc['voicePause']||![],'penalty':_0x236db9[_0x71a3('0x71')][_0x71a3('0x72')]},{'transaction':_0x35e802});});return Promise[_0x71a3('0x7c')](_0x442eef);});});});return Promise['all'](_0x16d74c);});return Promise[_0x71a3('0x7c')](_0x17e205);});});return Promise[_0x71a3('0x7c')](_0x5a5f84)[_0x71a3('0x28')](function(){return _0x1227a9['addAgents'](_0x291e47['body'][_0x71a3('0x64')],{'transaction':_0x35e802})[_0x71a3('0x7d')](function(_0xf2266e){return _0xf2266e;});});});}})['then'](respondWithResult(_0x290abb,null))[_0x71a3('0x4b')](handleError(_0x290abb,null));};exports['removeAgents']=function(_0x158136,_0x405040){return db[_0x71a3('0x32')]['find']({'where':{'id':_0x158136[_0x71a3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x405040,null))[_0x71a3('0x28')](function(_0x3c86ed){if(_0x3c86ed){var _0x333ab6=[_0x71a3('0x69'),_0x71a3('0x6a'),'Mail',_0x71a3('0x6b'),_0x71a3('0x6c'),'Openchannel','Whatsapp'];return db[_0x71a3('0x6f')][_0x71a3('0x70')](function(_0x444ef8){var _0x48079f=_[_0x71a3('0x31')](_0x333ab6,function(_0x936f33){var _0xabeb9d={'attributes':['id',_0x71a3('0x2e')]};return _0x3c86ed[_0x71a3('0x52')+_0x936f33+_0x71a3('0x63')](_0xabeb9d)[_0x71a3('0x28')](function(_0x4ca034){var _0x1b3b05=_[_0x71a3('0x31')](_0x4ca034,function(_0x3e8cce){return _0x3e8cce[_0x71a3('0x7e')](_0x158136['query'][_0x71a3('0x64')],{'transaction':_0x444ef8})[_0x71a3('0x28')](function(){var _0x3181e8=JSON[_0x71a3('0x7f')]('['+_0x158136[_0x71a3('0x37')][_0x71a3('0x64')]+']');var _0x12a46c=_[_0x71a3('0x31')](_0x3181e8,function(_0x590627){socket[_0x71a3('0x80')]('user'+_0x936f33+_0x71a3('0x81'),{'UserId':Number(_0x590627),[_0x936f33+_0x71a3('0x75')]:_0x3e8cce['id']});if(_0x936f33!==_0x71a3('0x69'))return;return db[_0x71a3('0x79')]['destroy']({'where':{'VoiceQueueId':_0x3e8cce['id'],'UserId':_0x590627},'transaction':_0x444ef8});});return Promise['all'](_0x12a46c);});});return Promise['all'](_0x1b3b05);});});return Promise[_0x71a3('0x7c')](_0x48079f)[_0x71a3('0x28')](function(){return _0x3c86ed[_0x71a3('0x7e')](_0x158136[_0x71a3('0x37')][_0x71a3('0x64')],{'transaction':_0x444ef8});});});}})[_0x71a3('0x28')](respondWithStatusCode(_0x405040,null))[_0x71a3('0x4b')](handleError(_0x405040,null));};exports[_0x71a3('0x82')]=function(_0x5b116b,_0x253a0c,_0x588956){var _0x841d6={};var _0x209406={};var _0x21d6cb;var _0xa8cf0c;return db[_0x71a3('0x32')][_0x71a3('0x59')]({'where':{'id':_0x5b116b['params']['id']}})[_0x71a3('0x28')](handleEntityNotFound(_0x253a0c,null))['then'](function(_0x21cfb6){if(_0x21cfb6){_0x21d6cb=_0x21cfb6;_0x209406['model']=_[_0x71a3('0x38')](db[_0x71a3('0x73')]['rawAttributes']);_0x209406[_0x71a3('0x37')]=_['keys'](_0x5b116b[_0x71a3('0x37')]);_0x209406['filters']=_[_0x71a3('0x3a')](_0x209406[_0x71a3('0x36')],_0x209406['query']);_0x841d6[_0x71a3('0x3c')]=_[_0x71a3('0x3a')](_0x209406[_0x71a3('0x36')],qs[_0x71a3('0x3b')](_0x5b116b[_0x71a3('0x37')][_0x71a3('0x3b')]));_0x841d6[_0x71a3('0x3c')]=_0x841d6[_0x71a3('0x3c')]['length']?_0x841d6[_0x71a3('0x3c')]:_0x209406[_0x71a3('0x36')];_0x841d6[_0x71a3('0x40')]=qs['sort'](_0x5b116b[_0x71a3('0x37')][_0x71a3('0x41')]);_0x841d6[_0x71a3('0x42')]=qs['filters'](_['pick'](_0x5b116b[_0x71a3('0x37')],_0x209406[_0x71a3('0x39')]));if(_0x5b116b['query'][_0x71a3('0x44')]){_0x841d6[_0x71a3('0x42')]=_[_0x71a3('0x45')](_0x841d6[_0x71a3('0x42')],{'$or':_[_0x71a3('0x31')](_0x841d6[_0x71a3('0x3c')],function(_0x346b4e){var _0x5709ba={};_0x5709ba[_0x346b4e]={'$like':'%'+_0x5b116b[_0x71a3('0x37')][_0x71a3('0x44')]+'%'};return _0x5709ba;})});}_0x841d6=_['merge']({},_0x841d6,_0x5b116b['options']);return _0x21d6cb[_0x71a3('0x82')](_0x841d6);}})[_0x71a3('0x28')](function(_0x4b609e){if(_0x4b609e){_0xa8cf0c=_0x4b609e[_0x71a3('0x3d')];if(!_0x5b116b[_0x71a3('0x37')][_0x71a3('0x3e')]('nolimit')){_0x841d6['limit']=qs[_0x71a3('0x23')](_0x5b116b[_0x71a3('0x37')][_0x71a3('0x23')]);_0x841d6[_0x71a3('0x22')]=qs[_0x71a3('0x22')](_0x5b116b[_0x71a3('0x37')][_0x71a3('0x22')]);}return _0x21d6cb[_0x71a3('0x82')](_0x841d6);}})[_0x71a3('0x28')](function(_0x5cc525){if(_0x5cc525){return _0x5cc525?{'count':_0xa8cf0c,'rows':_0x5cc525}:null;}})[_0x71a3('0x28')](respondWithResult(_0x253a0c,null))['catch'](handleError(_0x253a0c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c22e9fb..5898521 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 _0xe1a2=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0xe1a2,0x66));var _0x2e1a=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0xe1a2[_0x578275];return _0xf78041;};'use strict';var EventEmitter=require(_0x2e1a('0x0'));var Team=require(_0x2e1a('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x2e1a('0x2')](0x0);var events={'afterCreate':_0x2e1a('0x3'),'afterUpdate':_0x2e1a('0x4'),'afterDestroy':_0x2e1a('0x5')};function emitEvent(_0x4b136b){return function(_0x1b3c2c,_0xcb6c76,_0x43de1e){TeamEvents[_0x2e1a('0x6')](_0x4b136b+':'+_0x1b3c2c['id'],_0x1b3c2c);TeamEvents[_0x2e1a('0x6')](_0x4b136b,_0x1b3c2c);_0x43de1e(null);};}for(var e in events){if(events[_0x2e1a('0x7')](e)){var event=events[e];Team[_0x2e1a('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x26e6=['exports','../../mysqldb','Team','update','remove','emit','hasOwnProperty'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x26e6,0x15f));var _0x626e=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x26e6[_0x5ca3d6];return _0x3a1032;};'use strict';var EventEmitter=require('events');var Team=require(_0x626e('0x0'))['db'][_0x626e('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x626e('0x2'),'afterDestroy':_0x626e('0x3')};function emitEvent(_0x1372a1){return function(_0x520fcb,_0x5784ad,_0x25feb6){TeamEvents['emit'](_0x1372a1+':'+_0x520fcb['id'],_0x520fcb);TeamEvents[_0x626e('0x4')](_0x1372a1,_0x520fcb);_0x25feb6(null);};}for(var e in events){if(events[_0x626e('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x626e('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1d4d035..75f6ebf 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 _0x6cd2=['path','../../config/environment','exports','Team','teams','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1f5fc7,_0x13fedd){var _0x100c63=function(_0xfa3e21){while(--_0xfa3e21){_0x1f5fc7['push'](_0x1f5fc7['shift']());}};_0x100c63(++_0x13fedd);}(_0x6cd2,0x118));var _0x26cd=function(_0x2349ff,_0x3b6f32){_0x2349ff=_0x2349ff-0x0;var _0x2f2d95=_0x6cd2[_0x2349ff];return _0x2f2d95;};'use strict';var _=require(_0x26cd('0x0'));var util=require(_0x26cd('0x1'));var logger=require(_0x26cd('0x2'))(_0x26cd('0x3'));var moment=require('moment');var BPromise=require(_0x26cd('0x4'));var rp=require(_0x26cd('0x5'));var fs=require('fs');var path=require(_0x26cd('0x6'));var rimraf=require('rimraf');var config=require(_0x26cd('0x7'));var attributes=require('./team.attributes');module[_0x26cd('0x8')]=function(_0x483f8b,_0x27383a){return _0x483f8b['define'](_0x26cd('0x9'),attributes,{'tableName':_0x26cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f85=['exports','define','Team','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./team.attributes'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x9f85,0x179));var _0x59f8=function(_0x51ba15,_0x5141be){_0x51ba15=_0x51ba15-0x0;var _0x2b9220=_0x9f85[_0x51ba15];return _0x2b9220;};'use strict';var _=require(_0x59f8('0x0'));var util=require('util');var logger=require(_0x59f8('0x1'))('api');var moment=require(_0x59f8('0x2'));var BPromise=require(_0x59f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59f8('0x4'));var rimraf=require(_0x59f8('0x5'));var config=require(_0x59f8('0x6'));var attributes=require(_0x59f8('0x7'));module[_0x59f8('0x8')]=function(_0xc45579,_0x28890b){return _0xc45579[_0x59f8('0x9')](_0x59f8('0xa'),attributes,{'tableName':'teams','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 935dd80..387f9e2 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 _0x4b74=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x121832,_0x341fb7){var _0x43d0c1=function(_0x541d54){while(--_0x541d54){_0x121832['push'](_0x121832['shift']());}};_0x43d0c1(++_0x341fb7);}(_0x4b74,0x130));var _0x44b7=function(_0x29ad72,_0x3018bb){_0x29ad72=_0x29ad72-0x0;var _0x279afe=_0x4b74[_0x29ad72];return _0x279afe;};'use strict';var _=require('lodash');var util=require(_0x44b7('0x0'));var moment=require(_0x44b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x44b7('0x2'));var fs=require('fs');var Redis=require(_0x44b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x44b7('0x4'));var logger=require(_0x44b7('0x5'))(_0x44b7('0x6'));var config=require(_0x44b7('0x7'));var jayson=require(_0x44b7('0x8'));var client=jayson[_0x44b7('0x9')]['http']({'port':0x232a});config[_0x44b7('0xa')]=_[_0x44b7('0xb')](config[_0x44b7('0xa')],{'host':_0x44b7('0xc'),'port':0x18eb});var socket=require(_0x44b7('0xd'))(new Redis(config[_0x44b7('0xa')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x5a7a57,_0x527b6d,_0x58e0e2){return new BPromise(function(_0x1ac410,_0x5a7ac4){return client['request'](_0x5a7a57,_0x58e0e2)['then'](function(_0x409622){logger[_0x44b7('0xe')]('Team,\x20%s,\x20%s',_0x527b6d,_0x44b7('0xf'));logger[_0x44b7('0x10')](_0x44b7('0x11'),_0x527b6d,_0x44b7('0xf'),JSON[_0x44b7('0x12')](_0x409622));if(_0x409622[_0x44b7('0x13')]){if(_0x409622['error'][_0x44b7('0x14')]===0x1f4){logger['error'](_0x44b7('0x15'),_0x527b6d,_0x409622[_0x44b7('0x13')][_0x44b7('0x16')]);return _0x5a7ac4(_0x409622[_0x44b7('0x13')][_0x44b7('0x16')]);}logger[_0x44b7('0x13')](_0x44b7('0x15'),_0x527b6d,_0x409622['error']['message']);return _0x1ac410(_0x409622[_0x44b7('0x13')]['message']);}else{logger[_0x44b7('0xe')]('Team,\x20%s,\x20%s',_0x527b6d,'request\x20sent');_0x1ac410(_0x409622[_0x44b7('0x17')][_0x44b7('0x16')]);}})['catch'](function(_0x4254ba){logger['error'](_0x44b7('0x15'),_0x527b6d,_0x4254ba);_0x5a7ac4(_0x4254ba);});});} \ No newline at end of file +var _0x58a0=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0x58a0,0xcc));var _0x058a=function(_0x205b46,_0x3ca65b){_0x205b46=_0x205b46-0x0;var _0x2b6ae8=_0x58a0[_0x205b46];return _0x2b6ae8;};'use strict';var _=require(_0x058a('0x0'));var util=require(_0x058a('0x1'));var moment=require(_0x058a('0x2'));var BPromise=require(_0x058a('0x3'));var rs=require(_0x058a('0x4'));var fs=require('fs');var Redis=require(_0x058a('0x5'));var db=require(_0x058a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x058a('0x7'))('rpc');var config=require(_0x058a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x058a('0x9')][_0x058a('0xa')]({'port':0x232a});config[_0x058a('0xb')]=_[_0x058a('0xc')](config[_0x058a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x058a('0xd'))(new Redis(config[_0x058a('0xb')]));require(_0x058a('0xe'))[_0x058a('0xf')](socket);function respondWithRpcPromise(_0x473ad7,_0x3e7ba9,_0x14d358){return new BPromise(function(_0x2f2c51,_0x2fee5d){return client[_0x058a('0x10')](_0x473ad7,_0x14d358)[_0x058a('0x11')](function(_0x473b2a){logger[_0x058a('0x12')](_0x058a('0x13'),_0x3e7ba9,_0x058a('0x14'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x3e7ba9,'request\x20sent',JSON[_0x058a('0x15')](_0x473b2a));if(_0x473b2a[_0x058a('0x16')]){if(_0x473b2a[_0x058a('0x16')][_0x058a('0x17')]===0x1f4){logger[_0x058a('0x16')]('Team,\x20%s,\x20%s',_0x3e7ba9,_0x473b2a[_0x058a('0x16')][_0x058a('0x18')]);return _0x2fee5d(_0x473b2a['error'][_0x058a('0x18')]);}logger[_0x058a('0x16')](_0x058a('0x13'),_0x3e7ba9,_0x473b2a[_0x058a('0x16')]['message']);return _0x2f2c51(_0x473b2a['error'][_0x058a('0x18')]);}else{logger[_0x058a('0x12')](_0x058a('0x13'),_0x3e7ba9,_0x058a('0x14'));_0x2f2c51(_0x473b2a[_0x058a('0x19')][_0x058a('0x18')]);}})['catch'](function(_0x3b04b1){logger[_0x058a('0x16')]('Team,\x20%s,\x20%s',_0x3e7ba9,_0x3b04b1);_0x2fee5d(_0x3b04b1);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 33663f4..4e02723 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 _0x677a=['update','removeListener','register','length','./team.events','remove'];(function(_0x3c2668,_0x2ecd19){var _0x21aadd=function(_0x4955e8){while(--_0x4955e8){_0x3c2668['push'](_0x3c2668['shift']());}};_0x21aadd(++_0x2ecd19);}(_0x677a,0xd6));var _0xa677=function(_0x3fd928,_0x58fd13){_0x3fd928=_0x3fd928-0x0;var _0x2cd537=_0x677a[_0x3fd928];return _0x2cd537;};'use strict';var TeamEvents=require(_0xa677('0x0'));var events=['save',_0xa677('0x1'),_0xa677('0x2')];function createListener(_0x256447,_0x2a8a03){return function(_0x699895){_0x2a8a03['emit'](_0x256447,_0x699895);};}function removeListener(_0x1ca988,_0x2e46f8){return function(){TeamEvents[_0xa677('0x3')](_0x1ca988,_0x2e46f8);};}exports[_0xa677('0x4')]=function(_0x24576c){for(var _0x5127c1=0x0,_0x303092=events[_0xa677('0x5')];_0x5127c1<_0x303092;_0x5127c1++){var _0x130b66=events[_0x5127c1];var _0x10fb5e=createListener('team:'+_0x130b66,_0x24576c);TeamEvents['on'](_0x130b66,_0x10fb5e);}}; \ No newline at end of file +var _0xd0c9=['team:','./team.events','save','emit','length'];(function(_0x2b6a8f,_0x294599){var _0x2d2036=function(_0x1ea077){while(--_0x1ea077){_0x2b6a8f['push'](_0x2b6a8f['shift']());}};_0x2d2036(++_0x294599);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd0c9[_0x1928c9];return _0x51b5fb;};'use strict';var TeamEvents=require(_0x9d0c('0x0'));var events=[_0x9d0c('0x1'),'remove','update'];function createListener(_0x5d3eb1,_0x154c38){return function(_0x2eff0e){_0x154c38[_0x9d0c('0x2')](_0x5d3eb1,_0x2eff0e);};}function removeListener(_0x5922f1,_0x3b4b50){return function(){TeamEvents['removeListener'](_0x5922f1,_0x3b4b50);};}exports['register']=function(_0x6749){for(var _0x5bcaf9=0x0,_0x3eec5f=events[_0x9d0c('0x3')];_0x5bcaf9<_0x3eec5f;_0x5bcaf9++){var _0x308d9e=events[_0x5bcaf9];var _0x413a70=createListener(_0x9d0c('0x4')+_0x308d9e,_0x6749);TeamEvents['on'](_0x308d9e,_0x413a70);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 501082f..99c1c1d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79cc=['multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x22c5b9,_0x1b0314){var _0xdd49bd=function(_0x366897){while(--_0x366897){_0x22c5b9['push'](_0x22c5b9['shift']());}};_0xdd49bd(++_0x1b0314);}(_0x79cc,0xee));var _0xc79c=function(_0x4f636c,_0x3a91ac){_0x4f636c=_0x4f636c-0x0;var _0x30f9c0=_0x79cc[_0x4f636c];return _0x30f9c0;};'use strict';var multer=require(_0xc79c('0x0'));var util=require('util');var path=require(_0xc79c('0x1'));var timeout=require(_0xc79c('0x2'));var express=require('express');var router=express[_0xc79c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc79c('0x4'));var config=require(_0xc79c('0x5'));module[_0xc79c('0x6')]=router; \ No newline at end of file +var _0x84e1=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x142364,_0x2ac0df){var _0x25e2a4=function(_0xe52168){while(--_0xe52168){_0x142364['push'](_0x142364['shift']());}};_0x25e2a4(++_0x2ac0df);}(_0x84e1,0x171));var _0x184e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x84e1[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x184e('0x0'));var util=require(_0x184e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x184e('0x2'));var router=express[_0x184e('0x3')]();var auth=require(_0x184e('0x4'));var interaction=require(_0x184e('0x5'));var config=require(_0x184e('0x6'));module[_0x184e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 738cd23..81229a2 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0xf8f5e1,_0x3b8cfd){var _0x8aaf7b=function(_0x3d6830){while(--_0x3d6830){_0xf8f5e1['push'](_0xf8f5e1['shift']());}};_0x8aaf7b(++_0x3b8cfd);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cb9d5,_0x187d5a){_0x4cb9d5=_0x4cb9d5-0x0;var _0x444523=_0xb10b[_0x4cb9d5];return _0x444523;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index c10b80b..059b54b 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x882c=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x18b6fd,_0x4aaaa7){var _0x2e9c69=function(_0xeed9d9){while(--_0xeed9d9){_0x18b6fd['push'](_0x18b6fd['shift']());}};_0x2e9c69(++_0x4aaaa7);}(_0x882c,0x1c6));var _0xc882=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x882c[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0xc882('0x0'));var util=require('util');var logger=require(_0xc882('0x1'))(_0xc882('0x2'));var moment=require('moment');var BPromise=require(_0xc882('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc882('0x4'));var rimraf=require(_0xc882('0x5'));var config=require(_0xc882('0x6'));var attributes=require(_0xc882('0x7'));module['exports']=function(_0x1f842c,_0x32c377){return _0x1f842c[_0xc882('0x8')](_0xc882('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6542=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x462fbd,_0x33cbfe){var _0xfb9ff0=function(_0x5755d2){while(--_0x5755d2){_0x462fbd['push'](_0x462fbd['shift']());}};_0xfb9ff0(++_0x33cbfe);}(_0x6542,0xa9));var _0x2654=function(_0x20ca1e,_0x1c13fc){_0x20ca1e=_0x20ca1e-0x0;var _0x57e1b4=_0x6542[_0x20ca1e];return _0x57e1b4;};'use strict';var _=require(_0x2654('0x0'));var util=require(_0x2654('0x1'));var logger=require(_0x2654('0x2'))('api');var moment=require(_0x2654('0x3'));var BPromise=require(_0x2654('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2654('0x5'));var rimraf=require(_0x2654('0x6'));var config=require(_0x2654('0x7'));var attributes=require(_0x2654('0x8'));module[_0x2654('0x9')]=function(_0x5bfe26,_0xb73bc){return _0x5bfe26[_0x2654('0xa')](_0x2654('0xb'),attributes,{'tableName':_0x2654('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index beb4496..31567f8 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf58a=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x10d1c4,_0x17befb){var _0x508ada=function(_0x108764){while(--_0x108764){_0x10d1c4['push'](_0x10d1c4['shift']());}};_0x508ada(++_0x17befb);}(_0xf58a,0xf5));var _0xaf58=function(_0xb43ffc,_0x184028){_0xb43ffc=_0xb43ffc-0x0;var _0x2d9add=_0xf58a[_0xb43ffc];return _0x2d9add;};'use strict';var _=require(_0xaf58('0x0'));var util=require(_0xaf58('0x1'));var moment=require(_0xaf58('0x2'));var BPromise=require(_0xaf58('0x3'));var rs=require(_0xaf58('0x4'));var fs=require('fs');var Redis=require(_0xaf58('0x5'));var db=require(_0xaf58('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf58('0x7'))(_0xaf58('0x8'));var config=require(_0xaf58('0x9'));var jayson=require(_0xaf58('0xa'));var client=jayson[_0xaf58('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2b58,_0xbbd031,_0x56eb3d){return new BPromise(function(_0x6d4dec,_0x28f6ce){return client['request'](_0x1c2b58,_0x56eb3d)[_0xaf58('0xc')](function(_0x15394b){logger[_0xaf58('0xd')](_0xaf58('0xe'),_0xbbd031,_0xaf58('0xf'));logger[_0xaf58('0x10')](_0xaf58('0x11'),_0xbbd031,_0xaf58('0xf'),JSON[_0xaf58('0x12')](_0x15394b));if(_0x15394b[_0xaf58('0x13')]){if(_0x15394b[_0xaf58('0x13')][_0xaf58('0x14')]===0x1f4){logger[_0xaf58('0x13')](_0xaf58('0xe'),_0xbbd031,_0x15394b[_0xaf58('0x13')][_0xaf58('0x15')]);return _0x28f6ce(_0x15394b['error']['message']);}logger[_0xaf58('0x13')](_0xaf58('0xe'),_0xbbd031,_0x15394b[_0xaf58('0x13')][_0xaf58('0x15')]);return _0x6d4dec(_0x15394b[_0xaf58('0x13')]['message']);}else{logger[_0xaf58('0xd')](_0xaf58('0xe'),_0xbbd031,'request\x20sent');_0x6d4dec(_0x15394b['result'][_0xaf58('0x15')]);}})['catch'](function(_0x380882){logger[_0xaf58('0x13')](_0xaf58('0xe'),_0xbbd031,_0x380882);_0x28f6ce(_0x380882);});});} \ No newline at end of file +var _0x22f9=['http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x26aaab,_0x4d4dbb){var _0x436026=function(_0xae3ae3){while(--_0xae3ae3){_0x26aaab['push'](_0x26aaab['shift']());}};_0x436026(++_0x4d4dbb);}(_0x22f9,0x1cc));var _0x922f=function(_0xe861dc,_0xb5aef8){_0xe861dc=_0xe861dc-0x0;var _0x448273=_0x22f9[_0xe861dc];return _0x448273;};'use strict';var _=require(_0x922f('0x0'));var util=require(_0x922f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x922f('0x2'));var fs=require('fs');var Redis=require(_0x922f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x922f('0x4'));var logger=require(_0x922f('0x5'))(_0x922f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x922f('0x7')][_0x922f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4295f4,_0x3158e2,_0x40b9ed){return new BPromise(function(_0x4a41fc,_0x468bc0){return client[_0x922f('0x9')](_0x4295f4,_0x40b9ed)[_0x922f('0xa')](function(_0x9f9e89){logger[_0x922f('0xb')](_0x922f('0xc'),_0x3158e2,_0x922f('0xd'));logger['debug'](_0x922f('0xe'),_0x3158e2,_0x922f('0xd'),JSON['stringify'](_0x9f9e89));if(_0x9f9e89['error']){if(_0x9f9e89['error'][_0x922f('0xf')]===0x1f4){logger[_0x922f('0x10')](_0x922f('0xc'),_0x3158e2,_0x9f9e89['error'][_0x922f('0x11')]);return _0x468bc0(_0x9f9e89['error'][_0x922f('0x11')]);}logger[_0x922f('0x10')](_0x922f('0xc'),_0x3158e2,_0x9f9e89[_0x922f('0x10')][_0x922f('0x11')]);return _0x4a41fc(_0x9f9e89[_0x922f('0x10')][_0x922f('0x11')]);}else{logger[_0x922f('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3158e2,_0x922f('0xd'));_0x4a41fc(_0x9f9e89['result'][_0x922f('0x11')]);}})['catch'](function(_0x5994e3){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3158e2,_0x5994e3);_0x468bc0(_0x5994e3);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e27c257..9ad61a7 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 _0x0769=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0769,0x196));var _0x9076=function(_0x8c6bae,_0x4e3693){_0x8c6bae=_0x8c6bae-0x0;var _0x499566=_0x0769[_0x8c6bae];return _0x499566;};'use strict';var multer=require(_0x9076('0x0'));var util=require(_0x9076('0x1'));var path=require(_0x9076('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9076('0x3')]();var auth=require(_0x9076('0x4'));var interaction=require(_0x9076('0x5'));var config=require(_0x9076('0x6'));var controller=require(_0x9076('0x7'));router['get']('/',auth[_0x9076('0x8')](),controller[_0x9076('0x9')]);router['get'](_0x9076('0xa'),auth[_0x9076('0x8')](),controller[_0x9076('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9076('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9076('0xd')]);router[_0x9076('0xe')](_0x9076('0xa'),auth[_0x9076('0x8')](),controller[_0x9076('0xf')]);module[_0x9076('0x10')]=router; \ No newline at end of file +var _0xd83c=['destroy','exports','multer','path','express','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xd83c,0x102));var _0xcd83=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd83c[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xcd83('0x0'));var util=require('util');var path=require(_0xcd83('0x1'));var timeout=require('connect-timeout');var express=require(_0xcd83('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd83('0x3'));var controller=require(_0xcd83('0x4'));router[_0xcd83('0x5')]('/',auth[_0xcd83('0x6')](),controller[_0xcd83('0x7')]);router[_0xcd83('0x5')](_0xcd83('0x8'),auth[_0xcd83('0x6')](),controller['show']);router[_0xcd83('0x9')]('/',auth[_0xcd83('0x6')](),controller[_0xcd83('0xa')]);router[_0xcd83('0xb')](_0xcd83('0x8'),auth[_0xcd83('0x6')](),controller[_0xcd83('0xc')]);router[_0xcd83('0xd')](_0xcd83('0x8'),auth[_0xcd83('0x6')](),controller[_0xcd83('0xe')]);module[_0xcd83('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 14fbe81..f6b5bb8 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 _0x2d88=['STRING','sequelize'];(function(_0x2a08ce,_0x306b7a){var _0x178d86=function(_0x4f9eaa){while(--_0x4f9eaa){_0x2a08ce['push'](_0x2a08ce['shift']());}};_0x178d86(++_0x306b7a);}(_0x2d88,0xe5));var _0x82d8=function(_0x16c657,_0x2e175b){_0x16c657=_0x16c657-0x0;var _0x39e722=_0x2d88[_0x16c657];return _0x39e722;};'use strict';var Sequelize=require(_0x82d8('0x0'));module['exports']={'name':{'type':Sequelize[_0x82d8('0x1')]},'description':{'type':Sequelize[_0x82d8('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x97c0=['sequelize','STRING','TEXT'];(function(_0x3c9ebc,_0x159c4c){var _0x5ba293=function(_0x45d1d8){while(--_0x45d1d8){_0x3c9ebc['push'](_0x3c9ebc['shift']());}};_0x5ba293(++_0x159c4c);}(_0x97c0,0xd2));var _0x097c=function(_0xdb5299,_0x31ff9b){_0xdb5299=_0xdb5299-0x0;var _0x258556=_0x97c0[_0xdb5299];return _0x258556;};'use strict';var Sequelize=require(_0x097c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x097c('0x1')]},'html':{'type':Sequelize[_0x097c('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d3b0970..4934038 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 _0x5fc3=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','Template','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','count','include','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection'];(function(_0x27f84d,_0x4160a6){var _0x5ac013=function(_0x2e49d3){while(--_0x2e49d3){_0x27f84d['push'](_0x27f84d['shift']());}};_0x5ac013(++_0x4160a6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x5fc3[_0x1895b7];return _0x1aecdc;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x18')](_0x409357);}return _0x4cbe74[_0x35fc('0x19')](_0x409357)[_0x35fc('0x1a')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=_0x229d56['count'],_0x154958=_0x398b67[_0x35fc('0x1b')],_0x227a49=_0x398b67[_0x35fc('0x1b')]+_0x398b67['limit'],_0x1121fa;if(_0x227a49>=_0x53b898){_0x227a49=_0x53b898;_0x1121fa=0xc8;}else{_0x1121fa=0xce;}_0x558364[_0x35fc('0x19')](_0x1121fa);return _0x558364[_0x35fc('0x1c')](_0x35fc('0x1d'),_0x154958+'-'+_0x227a49+'/'+_0x53b898)['json'](_0x229d56);}return null;};}function patchUpdates(_0x1a86e9){return function(_0x3c58ea){try{jsonpatch[_0x35fc('0x1e')](_0x3c58ea,_0x1a86e9,!![]);}catch(_0x488234){return BPromise[_0x35fc('0x1f')](_0x488234);}return _0x3c58ea[_0x35fc('0x20')]();};}function saveUpdates(_0x3229d1,_0x251a1f){return function(_0x20ffde){if(_0x20ffde){return _0x20ffde[_0x35fc('0x21')](_0x3229d1)[_0x35fc('0x22')](function(_0x3b05b0){return _0x3b05b0;});}return null;};}function removeEntity(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')]()[_0x35fc('0x22')](function(){var _0x257719=_0x5bd2b8[_0x35fc('0x24')]({'plain':!![]});var _0x3b4743='Templates';return db[_0x35fc('0x25')][_0x35fc('0x23')]({'where':{'type':_0x3b4743,'resourceId':_0x257719['id']}})['then'](function(){return _0x5bd2b8;});})[_0x35fc('0x22')](function(){_0x2405e8[_0x35fc('0x19')](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x51cfec,_0x4086e9){return function(_0x598d7a){if(!_0x598d7a){_0x51cfec[_0x35fc('0x18')](0x194);}return _0x598d7a;};}function handleError(_0xdfab9f,_0x5cb986){_0x5cb986=_0x5cb986||0x1f4;return function(_0x519264){logger[_0x35fc('0x26')](_0x519264['stack']);if(_0x519264[_0x35fc('0x27')]){delete _0x519264[_0x35fc('0x27')];}_0xdfab9f['status'](_0x5cb986)[_0x35fc('0x28')](_0x519264);};}exports[_0x35fc('0x29')]=function(_0x383837,_0x9f3c8a){var _0x3735da={},_0x134dfa={},_0x11ccdb={'count':0x0,'rows':[]};var _0x451f0c=_['map'](db[_0x35fc('0x2a')][_0x35fc('0x2b')],function(_0x22af18){return{'name':_0x22af18['fieldName'],'type':_0x22af18[_0x35fc('0x2c')][_0x35fc('0x2d')]};});_0x134dfa[_0x35fc('0x2e')]=_[_0x35fc('0x2f')](_0x451f0c,_0x35fc('0x27'));_0x134dfa[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x383837[_0x35fc('0x30')]);_0x134dfa[_0x35fc('0x32')]=_[_0x35fc('0x33')](_0x134dfa['model'],_0x134dfa['query']);_0x3735da[_0x35fc('0x34')]=_['intersection'](_0x134dfa[_0x35fc('0x2e')],qs[_0x35fc('0x35')](_0x383837[_0x35fc('0x30')][_0x35fc('0x35')]));_0x3735da[_0x35fc('0x34')]=_0x3735da[_0x35fc('0x34')]['length']?_0x3735da[_0x35fc('0x34')]:_0x134dfa[_0x35fc('0x2e')];if(!_0x383837[_0x35fc('0x30')][_0x35fc('0x36')](_0x35fc('0x37'))){_0x3735da[_0x35fc('0x38')]=qs['limit'](_0x383837[_0x35fc('0x30')][_0x35fc('0x38')]);_0x3735da[_0x35fc('0x1b')]=qs['offset'](_0x383837[_0x35fc('0x30')]['offset']);}_0x3735da[_0x35fc('0x39')]=qs[_0x35fc('0x3a')](_0x383837[_0x35fc('0x30')][_0x35fc('0x3a')]);_0x3735da['where']=qs['filters'](_['pick'](_0x383837[_0x35fc('0x30')],_0x134dfa['filters']),_0x451f0c);if(_0x383837[_0x35fc('0x30')]['filter']){_0x3735da[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x3735da[_0x35fc('0x3b')],{'$or':_[_0x35fc('0x2f')](_0x451f0c,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2c')]!==_0x35fc('0x3d')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x27')]]={'$like':'%'+_0x383837[_0x35fc('0x30')]['filter']+'%'};return _0x4ec0dc;}})});}_0x3735da=_[_0x35fc('0x3c')]({},_0x3735da,_0x383837[_0x35fc('0x3e')]);var _0x1aac67={'where':_0x3735da[_0x35fc('0x3b')]};return db[_0x35fc('0x2a')][_0x35fc('0x3f')](_0x1aac67)['then'](function(_0x3f6480){_0x11ccdb[_0x35fc('0x3f')]=_0x3f6480;if(_0x383837[_0x35fc('0x30')]['includeAll']){_0x3735da[_0x35fc('0x40')]=[{'all':!![]}];}return db[_0x35fc('0x2a')]['findAll'](_0x3735da);})[_0x35fc('0x22')](function(_0x280af1){_0x11ccdb[_0x35fc('0x41')]=_0x280af1;return _0x11ccdb;})[_0x35fc('0x22')](respondWithFilteredResult(_0x9f3c8a,_0x3735da))[_0x35fc('0x42')](handleError(_0x9f3c8a,null));};exports[_0x35fc('0x43')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':!![],'where':{'id':_0x211b70[_0x35fc('0x44')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2e')]=_['keys'](db['Template']['rawAttributes']);_0x596e83[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x211b70['query']);_0x596e83[_0x35fc('0x32')]=_[_0x35fc('0x33')](_0x596e83[_0x35fc('0x2e')],_0x596e83[_0x35fc('0x30')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x35')]));_0x5a7e9e[_0x35fc('0x34')]=_0x5a7e9e['attributes'][_0x35fc('0x45')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2e')];if(_0x211b70[_0x35fc('0x30')][_0x35fc('0x46')]){_0x5a7e9e[_0x35fc('0x40')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3c')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x2a')][_0x35fc('0x47')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x22')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x42')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x48')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x2a')]['create'](_0x211746['body'],{})[_0x35fc('0x22')](function(_0x9db7e8){var _0x18dc78=_0x211746[_0x35fc('0x49')][_0x35fc('0x24')]({'plain':!![]});if(!_0x18dc78)throw new Error(_0x35fc('0x4a'));if(_0x18dc78[_0x35fc('0x4b')]===_0x35fc('0x49')){var _0x4f555f=_0x9db7e8[_0x35fc('0x24')]({'plain':!![]});var _0x91d7c0=_0x35fc('0x4c');return db[_0x35fc('0x4d')][_0x35fc('0x47')]({'where':{'name':_0x91d7c0,'userProfileId':_0x18dc78[_0x35fc('0x4e')]},'raw':!![]})[_0x35fc('0x22')](function(_0x347a4a){if(_0x347a4a&&_0x347a4a[_0x35fc('0x4f')]===0x0){return db[_0x35fc('0x25')][_0x35fc('0x48')]({'name':_0x4f555f[_0x35fc('0x27')],'resourceId':_0x4f555f['id'],'type':_0x347a4a[_0x35fc('0x27')],'sectionId':_0x347a4a['id']},{})[_0x35fc('0x22')](function(){return _0x9db7e8;});}else{return _0x9db7e8;}})['catch'](function(_0x553ed6){logger[_0x35fc('0x26')](_0x35fc('0x50'),_0x553ed6);throw _0x553ed6;});}return _0x9db7e8;})[_0x35fc('0x22')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x42')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x21')]=function(_0x3e6494,_0x4a4798){if(_0x3e6494['body']['id']){delete _0x3e6494[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x2a')][_0x35fc('0x47')]({'where':{'id':_0x3e6494[_0x35fc('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a4798,null))[_0x35fc('0x22')](saveUpdates(_0x3e6494[_0x35fc('0x51')],null))['then'](respondWithResult(_0x4a4798,null))[_0x35fc('0x42')](handleError(_0x4a4798,null));};exports[_0x35fc('0x23')]=function(_0x590faa,_0x3e12e4){return db[_0x35fc('0x2a')][_0x35fc('0x47')]({'where':{'id':_0x590faa[_0x35fc('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e12e4,null))['then'](removeEntity(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));}; \ No newline at end of file +var _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x18c923,_0x446ce7){var _0x209f1f=function(_0x9f42a4){while(--_0x9f42a4){_0x18c923['push'](_0x18c923['shift']());}};_0x209f1f(++_0x446ce7);}(_0xe14b,0x93));var _0xbe14=function(_0x3300d2,_0x109746){_0x3300d2=_0x3300d2-0x0;var _0x368318=_0xe14b[_0x3300d2];return _0x368318;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 50d30d8..5227f80 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 _0xf9fb=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','moment','path','rimraf'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0xf9fb,0x196));var _0xbf9f=function(_0x59c57a,_0x3b6dfd){_0x59c57a=_0x59c57a-0x0;var _0x4b0d82=_0xf9fb[_0x59c57a];return _0x4b0d82;};'use strict';var _=require('lodash');var util=require(_0xbf9f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbf9f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf9f('0x2'));var rimraf=require(_0xbf9f('0x3'));var config=require(_0xbf9f('0x4'));var attributes=require(_0xbf9f('0x5'));module[_0xbf9f('0x6')]=function(_0x28acbd,_0x2aaa52){return _0x28acbd[_0xbf9f('0x7')](_0xbf9f('0x8'),attributes,{'tableName':_0xbf9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f0a=['Template','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x315276,_0x5db7ea){var _0x5207f0=function(_0x9dc5e8){while(--_0x9dc5e8){_0x315276['push'](_0x315276['shift']());}};_0x5207f0(++_0x5db7ea);}(_0x8f0a,0x77));var _0xa8f0=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x8f0a[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require(_0xa8f0('0x0'));var logger=require(_0xa8f0('0x1'))(_0xa8f0('0x2'));var moment=require(_0xa8f0('0x3'));var BPromise=require(_0xa8f0('0x4'));var rp=require(_0xa8f0('0x5'));var fs=require('fs');var path=require(_0xa8f0('0x6'));var rimraf=require(_0xa8f0('0x7'));var config=require(_0xa8f0('0x8'));var attributes=require('./template.attributes');module[_0xa8f0('0x9')]=function(_0x3daa9b,_0x1654c1){return _0x3daa9b[_0xa8f0('0xa')](_0xa8f0('0xb'),attributes,{'tableName':_0xa8f0('0xc'),'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 a85756c..531b907 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 _0xfb90=['client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0xfb90,0xc9));var _0x0fb9=function(_0x24cf7f,_0xcda231){_0x24cf7f=_0x24cf7f-0x0;var _0x4c6742=_0xfb90[_0x24cf7f];return _0x4c6742;};'use strict';var _=require(_0x0fb9('0x0'));var util=require('util');var moment=require(_0x0fb9('0x1'));var BPromise=require(_0x0fb9('0x2'));var rs=require(_0x0fb9('0x3'));var fs=require('fs');var Redis=require(_0x0fb9('0x4'));var db=require(_0x0fb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fb9('0x6'))(_0x0fb9('0x7'));var config=require(_0x0fb9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fb9('0x9')][_0x0fb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f015,_0x1b8592,_0x4be4eb){return new BPromise(function(_0x28cb49,_0x5c1ada){return client['request'](_0x41f015,_0x4be4eb)[_0x0fb9('0xb')](function(_0x2bfaf8){logger[_0x0fb9('0xc')](_0x0fb9('0xd'),_0x1b8592,_0x0fb9('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1b8592,'request\x20sent',JSON['stringify'](_0x2bfaf8));if(_0x2bfaf8[_0x0fb9('0xf')]){if(_0x2bfaf8['error'][_0x0fb9('0x10')]===0x1f4){logger[_0x0fb9('0xf')](_0x0fb9('0xd'),_0x1b8592,_0x2bfaf8['error'][_0x0fb9('0x11')]);return _0x5c1ada(_0x2bfaf8[_0x0fb9('0xf')]['message']);}logger[_0x0fb9('0xf')]('Template,\x20%s,\x20%s',_0x1b8592,_0x2bfaf8[_0x0fb9('0xf')][_0x0fb9('0x11')]);return _0x28cb49(_0x2bfaf8[_0x0fb9('0xf')][_0x0fb9('0x11')]);}else{logger[_0x0fb9('0xc')](_0x0fb9('0xd'),_0x1b8592,_0x0fb9('0xe'));_0x28cb49(_0x2bfaf8[_0x0fb9('0x12')][_0x0fb9('0x11')]);}})[_0x0fb9('0x13')](function(_0x6d4460){logger[_0x0fb9('0xf')]('Template,\x20%s,\x20%s',_0x1b8592,_0x6d4460);_0x5c1ada(_0x6d4460);});});}exports[_0x0fb9('0x14')]=function(_0x1e0ce0){var _0x484bf4=this;return new Promise(function(_0x59fef1,_0x9706f7){return db[_0x0fb9('0x15')]['findAll']({'raw':_0x1e0ce0[_0x0fb9('0x16')]?_0x1e0ce0[_0x0fb9('0x16')][_0x0fb9('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0ce0[_0x0fb9('0x16')]?_0x1e0ce0['options'][_0x0fb9('0x18')]||null:null,'attributes':_0x1e0ce0['options']?_0x1e0ce0[_0x0fb9('0x16')][_0x0fb9('0x19')]||null:null,'limit':_0x1e0ce0[_0x0fb9('0x16')]?_0x1e0ce0[_0x0fb9('0x16')][_0x0fb9('0x1a')]||null:null,'include':_0x1e0ce0[_0x0fb9('0x16')]?_0x1e0ce0[_0x0fb9('0x16')][_0x0fb9('0x1b')]?_[_0x0fb9('0x1c')](_0x1e0ce0['options'][_0x0fb9('0x1b')],function(_0x3d292a){return{'model':db[_0x3d292a[_0x0fb9('0x1d')]],'as':_0x3d292a['as'],'attributes':_0x3d292a['attributes'],'include':_0x3d292a['include']?_[_0x0fb9('0x1c')](_0x3d292a[_0x0fb9('0x1b')],function(_0x3a7a62){return{'model':db[_0x3a7a62['model']],'as':_0x3a7a62['as'],'attributes':_0x3a7a62[_0x0fb9('0x19')],'include':_0x3a7a62['include']?_[_0x0fb9('0x1c')](_0x3a7a62[_0x0fb9('0x1b')],function(_0x1ef0ac){return{'model':db[_0x1ef0ac['model']],'as':_0x1ef0ac['as'],'attributes':_0x1ef0ac[_0x0fb9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29973a){logger[_0x0fb9('0xc')](_0x0fb9('0x14'),_0x1e0ce0);logger['debug']('GetTemplate',_0x1e0ce0,JSON['stringify'](_0x29973a));_0x59fef1(_0x29973a);})[_0x0fb9('0x13')](function(_0x4e3370){logger[_0x0fb9('0xf')](_0x0fb9('0x14'),_0x4e3370[_0x0fb9('0x11')],_0x1e0ce0);_0x9706f7(_0x484bf4['error'](0x1f4,_0x4e3370[_0x0fb9('0x11')]));});});}; \ No newline at end of file +var _0x9755=['map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0x9755,0x1b5));var _0x5975=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x9755[_0x234ce7];return _0x57c561;};'use strict';var _=require(_0x5975('0x0'));var util=require(_0x5975('0x1'));var moment=require('moment');var BPromise=require(_0x5975('0x2'));var rs=require(_0x5975('0x3'));var fs=require('fs');var Redis=require(_0x5975('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5975('0x5'))(_0x5975('0x6'));var config=require(_0x5975('0x7'));var jayson=require(_0x5975('0x8'));var client=jayson['client'][_0x5975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8b5d92,_0x30e821,_0xfd9581){return new BPromise(function(_0x1da7c8,_0x19c0aa){return client[_0x5975('0xa')](_0x8b5d92,_0xfd9581)['then'](function(_0x4d4246){logger[_0x5975('0xb')](_0x5975('0xc'),_0x30e821,_0x5975('0xd'));logger['debug'](_0x5975('0xe'),_0x30e821,_0x5975('0xd'),JSON['stringify'](_0x4d4246));if(_0x4d4246['error']){if(_0x4d4246['error'][_0x5975('0xf')]===0x1f4){logger[_0x5975('0x10')](_0x5975('0xc'),_0x30e821,_0x4d4246[_0x5975('0x10')][_0x5975('0x11')]);return _0x19c0aa(_0x4d4246['error'][_0x5975('0x11')]);}logger['error'](_0x5975('0xc'),_0x30e821,_0x4d4246[_0x5975('0x10')][_0x5975('0x11')]);return _0x1da7c8(_0x4d4246['error'][_0x5975('0x11')]);}else{logger[_0x5975('0xb')]('Template,\x20%s,\x20%s',_0x30e821,_0x5975('0xd'));_0x1da7c8(_0x4d4246[_0x5975('0x12')][_0x5975('0x11')]);}})[_0x5975('0x13')](function(_0x194e9a){logger['error'](_0x5975('0xc'),_0x30e821,_0x194e9a);_0x19c0aa(_0x194e9a);});});}exports[_0x5975('0x14')]=function(_0x481c79){var _0x524f60=this;return new Promise(function(_0x185192,_0x1cdac4){return db['Template'][_0x5975('0x15')]({'raw':_0x481c79[_0x5975('0x16')]?_0x481c79[_0x5975('0x16')][_0x5975('0x17')]===undefined?!![]:![]:!![],'where':_0x481c79[_0x5975('0x16')]?_0x481c79['options'][_0x5975('0x18')]||null:null,'attributes':_0x481c79[_0x5975('0x16')]?_0x481c79[_0x5975('0x16')][_0x5975('0x19')]||null:null,'limit':_0x481c79[_0x5975('0x16')]?_0x481c79['options'][_0x5975('0x1a')]||null:null,'include':_0x481c79['options']?_0x481c79['options'][_0x5975('0x1b')]?_[_0x5975('0x1c')](_0x481c79[_0x5975('0x16')][_0x5975('0x1b')],function(_0x4b9022){return{'model':db[_0x4b9022['model']],'as':_0x4b9022['as'],'attributes':_0x4b9022[_0x5975('0x19')],'include':_0x4b9022[_0x5975('0x1b')]?_['map'](_0x4b9022[_0x5975('0x1b')],function(_0x423087){return{'model':db[_0x423087[_0x5975('0x1d')]],'as':_0x423087['as'],'attributes':_0x423087['attributes'],'include':_0x423087['include']?_[_0x5975('0x1c')](_0x423087[_0x5975('0x1b')],function(_0x597abf){return{'model':db[_0x597abf['model']],'as':_0x597abf['as'],'attributes':_0x597abf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x499b64){logger[_0x5975('0xb')](_0x5975('0x14'),_0x481c79);logger[_0x5975('0x1e')](_0x5975('0x14'),_0x481c79,JSON['stringify'](_0x499b64));_0x185192(_0x499b64);})[_0x5975('0x13')](function(_0x512207){logger[_0x5975('0x10')](_0x5975('0x14'),_0x512207[_0x5975('0x11')],_0x481c79);_0x1cdac4(_0x524f60[_0x5975('0x10')](0x1f4,_0x512207['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 948b863..af834de 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 _0x4fcf=['get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4fcf,0x6a));var _0xf4fc=function(_0x4ede7f,_0x669555){_0x4ede7f=_0x4ede7f-0x0;var _0x2877d1=_0x4fcf[_0x4ede7f];return _0x2877d1;};'use strict';var multer=require(_0xf4fc('0x0'));var util=require(_0xf4fc('0x1'));var path=require(_0xf4fc('0x2'));var timeout=require(_0xf4fc('0x3'));var express=require(_0xf4fc('0x4'));var router=express[_0xf4fc('0x5')]();var auth=require(_0xf4fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf4fc('0x7'));var controller=require(_0xf4fc('0x8'));router[_0xf4fc('0x9')]('/',auth[_0xf4fc('0xa')](),controller[_0xf4fc('0xb')]);router[_0xf4fc('0x9')](_0xf4fc('0xc'),auth[_0xf4fc('0xa')](),controller[_0xf4fc('0xd')]);router[_0xf4fc('0x9')](_0xf4fc('0xe'),auth[_0xf4fc('0xa')](),controller['getAllConditions']);router[_0xf4fc('0x9')](_0xf4fc('0xf'),auth[_0xf4fc('0xa')](),controller[_0xf4fc('0x10')]);router['get']('/:id/actions',auth[_0xf4fc('0xa')](),controller['getActions']);router[_0xf4fc('0x11')]('/',auth[_0xf4fc('0xa')](),controller[_0xf4fc('0x12')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0xf4fc('0x11')](_0xf4fc('0xf'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post']('/:id/actions',auth[_0xf4fc('0xa')](),controller['addAction']);router[_0xf4fc('0x13')](_0xf4fc('0xc'),auth['isAuthenticated'](),controller[_0xf4fc('0x14')]);router['delete'](_0xf4fc('0xc'),auth[_0xf4fc('0xa')](),controller[_0xf4fc('0x15')]);module[_0xf4fc('0x16')]=router; \ No newline at end of file +var _0x96ce=['delete','destroy','multer','util','path','connect-timeout','express','Router','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAnyCondition','/:id/actions','addAction','put','update'];(function(_0x2dbc9a,_0x2f6fea){var _0x508a2b=function(_0x47663f){while(--_0x47663f){_0x2dbc9a['push'](_0x2dbc9a['shift']());}};_0x508a2b(++_0x2f6fea);}(_0x96ce,0x13a));var _0xe96c=function(_0x3d3531,_0x1e4748){_0x3d3531=_0x3d3531-0x0;var _0x299781=_0x96ce[_0x3d3531];return _0x299781;};'use strict';var multer=require(_0xe96c('0x0'));var util=require(_0xe96c('0x1'));var path=require(_0xe96c('0x2'));var timeout=require(_0xe96c('0x3'));var express=require(_0xe96c('0x4'));var router=express[_0xe96c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe96c('0x6'));router[_0xe96c('0x7')]('/',auth[_0xe96c('0x8')](),controller[_0xe96c('0x9')]);router[_0xe96c('0x7')](_0xe96c('0xa'),auth['isAuthenticated'](),controller[_0xe96c('0xb')]);router[_0xe96c('0x7')](_0xe96c('0xc'),auth['isAuthenticated'](),controller[_0xe96c('0xd')]);router[_0xe96c('0x7')](_0xe96c('0xe'),auth[_0xe96c('0x8')](),controller[_0xe96c('0xf')]);router[_0xe96c('0x7')]('/:id/actions',auth[_0xe96c('0x8')](),controller[_0xe96c('0x10')]);router[_0xe96c('0x11')]('/',auth[_0xe96c('0x8')](),controller[_0xe96c('0x12')]);router[_0xe96c('0x11')](_0xe96c('0xc'),auth[_0xe96c('0x8')](),controller['addAllCondition']);router[_0xe96c('0x11')](_0xe96c('0xe'),auth[_0xe96c('0x8')](),controller[_0xe96c('0x13')]);router[_0xe96c('0x11')](_0xe96c('0x14'),auth[_0xe96c('0x8')](),controller[_0xe96c('0x15')]);router[_0xe96c('0x16')](_0xe96c('0xa'),auth['isAuthenticated'](),controller[_0xe96c('0x17')]);router[_0xe96c('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe96c('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0c87852..9896051 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 _0x4c27=['BOOLEAN','sequelize','STRING'];(function(_0x4b848c,_0x4856e3){var _0x2c1187=function(_0x462423){while(--_0x462423){_0x4b848c['push'](_0x4b848c['shift']());}};_0x2c1187(++_0x4856e3);}(_0x4c27,0xd6));var _0x74c2=function(_0x606851,_0x3689dc){_0x606851=_0x606851-0x0;var _0x2850b6=_0x4c27[_0x606851];return _0x2850b6;};'use strict';var Sequelize=require(_0x74c2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x74c2('0x1')]},'description':{'type':Sequelize[_0x74c2('0x1')]},'status':{'type':Sequelize[_0x74c2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xdd19=['sequelize','STRING','BOOLEAN'];(function(_0x38fa00,_0x53fd8f){var _0xa55aad=function(_0x4a7ccf){while(--_0x4a7ccf){_0x38fa00['push'](_0x38fa00['shift']());}};_0xa55aad(++_0x53fd8f);}(_0xdd19,0x14d));var _0x9dd1=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xdd19[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x9dd1('0x0'));module['exports']={'name':{'type':Sequelize[_0x9dd1('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9dd1('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 99649d0..8a4a61e 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 _0x00b3=['then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','include','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','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/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update'];(function(_0xd216e8,_0x9eb78){var _0x268f9c=function(_0x581622){while(--_0x581622){_0xd216e8['push'](_0xd216e8['shift']());}};_0x268f9c(++_0x9eb78);}(_0x00b3,0x97));var _0x300b=function(_0x58be33,_0x6a7173){_0x58be33=_0x58be33-0x0;var _0x47d112=_0x00b3[_0x58be33];return _0x47d112;};'use strict';var pdf=require(_0x300b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x300b('0x1'));var jsonpatch=require(_0x300b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x300b('0x3'));var Mustache=require(_0x300b('0x4'));var util=require(_0x300b('0x5'));var path=require('path');var sox=require(_0x300b('0x6'));var csv=require(_0x300b('0x7'));var ejs=require(_0x300b('0x8'));var fs=require('fs');var _=require(_0x300b('0x9'));var squel=require(_0x300b('0xa'));var crypto=require(_0x300b('0xb'));var jsforce=require(_0x300b('0xc'));var deskjs=require(_0x300b('0xd'));var toCsv=require(_0x300b('0x7'));var querystring=require(_0x300b('0xe'));var Papa=require(_0x300b('0xf'));var Redis=require(_0x300b('0x10'));var authService=require(_0x300b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x300b('0x12'));var hardwareService=require(_0x300b('0x13'));var logger=require(_0x300b('0x14'))('api');var utils=require(_0x300b('0x15'));var config=require(_0x300b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12da4c,_0x51b8fc){_0x51b8fc=_0x51b8fc||0xcc;return function(_0x12b3b0){if(_0x12b3b0){return _0x12da4c[_0x300b('0x17')](_0x51b8fc);}return _0x12da4c[_0x300b('0x18')](_0x51b8fc)[_0x300b('0x19')]();};}function respondWithResult(_0x3c9f85,_0x1edb37){_0x1edb37=_0x1edb37||0xc8;return function(_0x5c507b){if(_0x5c507b){return _0x3c9f85['status'](_0x1edb37)[_0x300b('0x1a')](_0x5c507b);}};}function respondWithFilteredResult(_0x29f231,_0x14cba0){return function(_0x19ac43){if(_0x19ac43){var _0x349a29=_0x19ac43['count'],_0x34dd89=_0x14cba0[_0x300b('0x1b')],_0x35b137=_0x14cba0[_0x300b('0x1b')]+_0x14cba0['limit'],_0x3e1dbd;if(_0x35b137>=_0x349a29){_0x35b137=_0x349a29;_0x3e1dbd=0xc8;}else{_0x3e1dbd=0xce;}_0x29f231[_0x300b('0x18')](_0x3e1dbd);return _0x29f231[_0x300b('0x1c')](_0x300b('0x1d'),_0x34dd89+'-'+_0x35b137+'/'+_0x349a29)[_0x300b('0x1a')](_0x19ac43);}return null;};}function patchUpdates(_0x5547ef){return function(_0x1c79d7){try{jsonpatch[_0x300b('0x1e')](_0x1c79d7,_0x5547ef,!![]);}catch(_0x21436e){return BPromise[_0x300b('0x1f')](_0x21436e);}return _0x1c79d7['save']();};}function saveUpdates(_0x57f111,_0x5d60c0){return function(_0x5e6874){if(_0x5e6874){return _0x5e6874[_0x300b('0x20')](_0x57f111)[_0x300b('0x21')](function(_0x29b725){return _0x29b725;});}return null;};}function removeEntity(_0x466d2e,_0x5e7937){return function(_0x2724de){if(_0x2724de){return _0x2724de[_0x300b('0x22')]()[_0x300b('0x21')](function(){var _0x3b4eee=_0x2724de[_0x300b('0x23')]({'plain':!![]});var _0x5e4093=_0x300b('0x24');return db[_0x300b('0x25')][_0x300b('0x22')]({'where':{'type':_0x5e4093,'resourceId':_0x3b4eee['id']}})[_0x300b('0x21')](function(){return _0x2724de;});})[_0x300b('0x21')](function(){_0x466d2e[_0x300b('0x18')](0xcc)[_0x300b('0x19')]();});}};}function handleEntityNotFound(_0xa913e8,_0x3d0775){return function(_0x59cecc){if(!_0x59cecc){_0xa913e8['sendStatus'](0x194);}return _0x59cecc;};}function handleError(_0xaa84aa,_0x499499){_0x499499=_0x499499||0x1f4;return function(_0x175a67){logger[_0x300b('0x26')](_0x175a67[_0x300b('0x27')]);if(_0x175a67[_0x300b('0x28')]){delete _0x175a67['name'];}_0xaa84aa[_0x300b('0x18')](_0x499499)[_0x300b('0x29')](_0x175a67);};}exports['index']=function(_0x9eb721,_0x1cff38){var _0x9ba13a={},_0x150ebe={},_0x555a21={'count':0x0,'rows':[]};var _0x51bf7c=_[_0x300b('0x2a')](db[_0x300b('0x2b')][_0x300b('0x2c')],function(_0x4ee951){return{'name':_0x4ee951['fieldName'],'type':_0x4ee951[_0x300b('0x2d')][_0x300b('0x2e')]};});_0x150ebe[_0x300b('0x2f')]=_[_0x300b('0x2a')](_0x51bf7c,_0x300b('0x28'));_0x150ebe[_0x300b('0x30')]=_['keys'](_0x9eb721[_0x300b('0x30')]);_0x150ebe[_0x300b('0x31')]=_[_0x300b('0x32')](_0x150ebe[_0x300b('0x2f')],_0x150ebe[_0x300b('0x30')]);_0x9ba13a['attributes']=_['intersection'](_0x150ebe[_0x300b('0x2f')],qs[_0x300b('0x33')](_0x9eb721['query'][_0x300b('0x33')]));_0x9ba13a[_0x300b('0x34')]=_0x9ba13a['attributes'][_0x300b('0x35')]?_0x9ba13a['attributes']:_0x150ebe[_0x300b('0x2f')];if(!_0x9eb721[_0x300b('0x30')]['hasOwnProperty'](_0x300b('0x36'))){_0x9ba13a[_0x300b('0x37')]=qs[_0x300b('0x37')](_0x9eb721[_0x300b('0x30')][_0x300b('0x37')]);_0x9ba13a[_0x300b('0x1b')]=qs[_0x300b('0x1b')](_0x9eb721[_0x300b('0x30')][_0x300b('0x1b')]);}_0x9ba13a[_0x300b('0x38')]=qs[_0x300b('0x39')](_0x9eb721[_0x300b('0x30')]['sort']);_0x9ba13a[_0x300b('0x3a')]=qs['filters'](_['pick'](_0x9eb721[_0x300b('0x30')],_0x150ebe[_0x300b('0x31')]),_0x51bf7c);if(_0x9eb721['query'][_0x300b('0x3b')]){_0x9ba13a['where']=_[_0x300b('0x3c')](_0x9ba13a[_0x300b('0x3a')],{'$or':_['map'](_0x51bf7c,function(_0x1ba2e6){if(_0x1ba2e6[_0x300b('0x2d')]!==_0x300b('0x3d')){var _0x3f5901={};_0x3f5901[_0x1ba2e6[_0x300b('0x28')]]={'$like':'%'+_0x9eb721[_0x300b('0x30')]['filter']+'%'};return _0x3f5901;}})});}_0x9ba13a=_[_0x300b('0x3c')]({},_0x9ba13a,_0x9eb721[_0x300b('0x3e')]);var _0x3d821a={'where':_0x9ba13a['where']};return db['Trigger'][_0x300b('0x3f')](_0x3d821a)[_0x300b('0x21')](function(_0x1ee763){_0x555a21['count']=_0x1ee763;if(_0x9eb721[_0x300b('0x30')]['includeAll']){_0x9ba13a[_0x300b('0x40')]=[{'all':!![]}];}return db[_0x300b('0x2b')]['findAll'](_0x9ba13a);})[_0x300b('0x21')](function(_0x2151c1){_0x555a21['rows']=_0x2151c1;return _0x555a21;})['then'](respondWithFilteredResult(_0x1cff38,_0x9ba13a))[_0x300b('0x41')](handleError(_0x1cff38,null));};exports[_0x300b('0x42')]=function(_0x5b0c07,_0x49fe13){var _0x50bd5a={'raw':![],'where':{'id':_0x5b0c07[_0x300b('0x43')]['id']}},_0xd57219={};_0xd57219[_0x300b('0x2f')]=_[_0x300b('0x44')](db[_0x300b('0x2b')][_0x300b('0x2c')]);_0xd57219['query']=_[_0x300b('0x44')](_0x5b0c07[_0x300b('0x30')]);_0xd57219[_0x300b('0x31')]=_[_0x300b('0x32')](_0xd57219[_0x300b('0x2f')],_0xd57219[_0x300b('0x30')]);_0x50bd5a[_0x300b('0x34')]=_['intersection'](_0xd57219[_0x300b('0x2f')],qs[_0x300b('0x33')](_0x5b0c07[_0x300b('0x30')][_0x300b('0x33')]));_0x50bd5a['attributes']=_0x50bd5a[_0x300b('0x34')][_0x300b('0x35')]?_0x50bd5a[_0x300b('0x34')]:_0xd57219[_0x300b('0x2f')];if(_0x5b0c07['query'][_0x300b('0x45')]){_0x50bd5a['include']=[{'all':!![]}];}_0x50bd5a=_['merge']({},_0x50bd5a,_0x5b0c07['options']);return db[_0x300b('0x2b')][_0x300b('0x46')](_0x50bd5a)['then'](handleEntityNotFound(_0x49fe13,null))[_0x300b('0x21')](respondWithResult(_0x49fe13,null))[_0x300b('0x41')](handleError(_0x49fe13,null));};exports['create']=function(_0x588416,_0x2a0408){return db[_0x300b('0x2b')][_0x300b('0x47')](_0x588416[_0x300b('0x48')],{})['then'](function(_0x4aa017){var _0x58a114=_0x588416['user'][_0x300b('0x23')]({'plain':!![]});if(!_0x58a114)throw new Error(_0x300b('0x49'));if(_0x58a114[_0x300b('0x4a')]===_0x300b('0x4b')){var _0x427bef=_0x4aa017[_0x300b('0x23')]({'plain':!![]});var _0x1f0f60=_0x300b('0x24');return db['UserProfileSection'][_0x300b('0x46')]({'where':{'name':_0x1f0f60,'userProfileId':_0x58a114[_0x300b('0x4c')]},'raw':!![]})['then'](function(_0x1ba443){if(_0x1ba443&&_0x1ba443['autoAssociation']===0x0){return db['UserProfileResource'][_0x300b('0x47')]({'name':_0x427bef[_0x300b('0x28')],'resourceId':_0x427bef['id'],'type':_0x1ba443['name'],'sectionId':_0x1ba443['id']},{})[_0x300b('0x21')](function(){return _0x4aa017;});}else{return _0x4aa017;}})[_0x300b('0x41')](function(_0x1215a9){logger['error'](_0x300b('0x4d'),_0x1215a9);throw _0x1215a9;});}return _0x4aa017;})[_0x300b('0x21')](respondWithResult(_0x2a0408,0xc9))['catch'](handleError(_0x2a0408,null));};exports[_0x300b('0x20')]=function(_0x4cfad6,_0x41bf4a){if(_0x4cfad6[_0x300b('0x48')]['id']){delete _0x4cfad6[_0x300b('0x48')]['id'];}return db[_0x300b('0x2b')]['find']({'where':{'id':_0x4cfad6[_0x300b('0x43')]['id']}})['then'](handleEntityNotFound(_0x41bf4a,null))['then'](saveUpdates(_0x4cfad6[_0x300b('0x48')],null))[_0x300b('0x21')](respondWithResult(_0x41bf4a,null))[_0x300b('0x41')](handleError(_0x41bf4a,null));};exports[_0x300b('0x22')]=function(_0x5b39c4,_0x5780c1){return db[_0x300b('0x2b')]['find']({'where':{'id':_0x5b39c4[_0x300b('0x43')]['id']}})[_0x300b('0x21')](handleEntityNotFound(_0x5780c1,null))[_0x300b('0x21')](removeEntity(_0x5780c1,null))['catch'](handleError(_0x5780c1,null));};exports[_0x300b('0x4e')]=function(_0x3ce55f,_0x2c3388,_0x5377b5){if(_0x3ce55f[_0x300b('0x48')]['id']){delete _0x3ce55f[_0x300b('0x48')]['id'];}return db[_0x300b('0x2b')][_0x300b('0x46')]({'where':{'id':_0x3ce55f['params']['id']}})['then'](handleEntityNotFound(_0x2c3388,null))['then'](function(_0xa6b888){if(_0xa6b888){_0x3ce55f['body'][_0x300b('0x4f')]=_0xa6b888['id'];return db['Condition'][_0x300b('0x47')](_0x3ce55f[_0x300b('0x48')]);}})['then'](respondWithResult(_0x2c3388,null))[_0x300b('0x41')](handleError(_0x2c3388,null));};exports[_0x300b('0x50')]=function(_0xd4c64b,_0x3f3fc9,_0x30ec9c){if(_0xd4c64b[_0x300b('0x48')]['id']){delete _0xd4c64b[_0x300b('0x48')]['id'];}return db['Trigger'][_0x300b('0x46')]({'where':{'id':_0xd4c64b[_0x300b('0x43')]['id']}})[_0x300b('0x21')](handleEntityNotFound(_0x3f3fc9,null))[_0x300b('0x21')](function(_0x5cb206){if(_0x5cb206){_0xd4c64b[_0x300b('0x48')][_0x300b('0x51')]=_0x5cb206['id'];return db[_0x300b('0x52')][_0x300b('0x47')](_0xd4c64b[_0x300b('0x48')]);}})[_0x300b('0x21')](respondWithResult(_0x3f3fc9,null))[_0x300b('0x41')](handleError(_0x3f3fc9,null));};exports[_0x300b('0x53')]=function(_0x370e35,_0x2a8a49,_0x50f0f2){var _0x28bd34={};var _0x289658={};var _0x4a8c31;var _0x5bfeb0;return db['Trigger'][_0x300b('0x54')]({'where':{'id':_0x370e35[_0x300b('0x43')]['id']}})[_0x300b('0x21')](handleEntityNotFound(_0x2a8a49,null))['then'](function(_0x96585f){if(_0x96585f){_0x4a8c31=_0x96585f;_0x289658['model']=_[_0x300b('0x44')](db['Condition']['rawAttributes']);_0x289658['query']=_[_0x300b('0x44')](_0x370e35[_0x300b('0x30')]);_0x289658['filters']=_[_0x300b('0x32')](_0x289658['model'],_0x289658['query']);_0x28bd34['attributes']=_['intersection'](_0x289658[_0x300b('0x2f')],qs[_0x300b('0x33')](_0x370e35[_0x300b('0x30')][_0x300b('0x33')]));_0x28bd34['attributes']=_0x28bd34[_0x300b('0x34')][_0x300b('0x35')]?_0x28bd34[_0x300b('0x34')]:_0x289658[_0x300b('0x2f')];_0x28bd34['order']=qs[_0x300b('0x39')](_0x370e35['query']['sort']);_0x28bd34[_0x300b('0x3a')]=qs['filters'](_[_0x300b('0x55')](_0x370e35[_0x300b('0x30')],_0x289658[_0x300b('0x31')]));if(_0x370e35['query'][_0x300b('0x3b')]){_0x28bd34[_0x300b('0x3a')]=_[_0x300b('0x3c')](_0x28bd34[_0x300b('0x3a')],{'$or':_['map'](_0x28bd34[_0x300b('0x34')],function(_0x1c252c){var _0x2b1cca={};_0x2b1cca[_0x1c252c]={'$like':'%'+_0x370e35[_0x300b('0x30')][_0x300b('0x3b')]+'%'};return _0x2b1cca;})});}_0x28bd34=_[_0x300b('0x3c')]({},_0x28bd34,_0x370e35[_0x300b('0x3e')]);return _0x4a8c31[_0x300b('0x53')](_0x28bd34);}})[_0x300b('0x21')](function(_0x11d840){if(_0x11d840){_0x5bfeb0=_0x11d840['length'];if(!_0x370e35[_0x300b('0x30')][_0x300b('0x56')](_0x300b('0x36'))){_0x28bd34[_0x300b('0x37')]=qs['limit'](_0x370e35[_0x300b('0x30')][_0x300b('0x37')]);_0x28bd34[_0x300b('0x1b')]=qs[_0x300b('0x1b')](_0x370e35[_0x300b('0x30')][_0x300b('0x1b')]);}return _0x4a8c31[_0x300b('0x53')](_0x28bd34);}})[_0x300b('0x21')](function(_0x24d05c){if(_0x24d05c){return _0x24d05c?{'count':_0x5bfeb0,'rows':_0x24d05c}:null;}})[_0x300b('0x21')](respondWithResult(_0x2a8a49,null))[_0x300b('0x41')](handleError(_0x2a8a49,null));};exports['getAnyConditions']=function(_0xb42fc9,_0x19078a,_0x5b04ab){var _0x3b3a4d={};var _0x274bba={};var _0x16e6e6;var _0x46fba0;return db[_0x300b('0x2b')][_0x300b('0x54')]({'where':{'id':_0xb42fc9[_0x300b('0x43')]['id']}})[_0x300b('0x21')](handleEntityNotFound(_0x19078a,null))[_0x300b('0x21')](function(_0x514d5d){if(_0x514d5d){_0x16e6e6=_0x514d5d;_0x274bba[_0x300b('0x2f')]=_[_0x300b('0x44')](db[_0x300b('0x52')][_0x300b('0x2c')]);_0x274bba[_0x300b('0x30')]=_['keys'](_0xb42fc9[_0x300b('0x30')]);_0x274bba[_0x300b('0x31')]=_[_0x300b('0x32')](_0x274bba['model'],_0x274bba['query']);_0x3b3a4d[_0x300b('0x34')]=_[_0x300b('0x32')](_0x274bba['model'],qs[_0x300b('0x33')](_0xb42fc9[_0x300b('0x30')]['fields']));_0x3b3a4d['attributes']=_0x3b3a4d[_0x300b('0x34')][_0x300b('0x35')]?_0x3b3a4d[_0x300b('0x34')]:_0x274bba[_0x300b('0x2f')];_0x3b3a4d['order']=qs['sort'](_0xb42fc9[_0x300b('0x30')][_0x300b('0x39')]);_0x3b3a4d[_0x300b('0x3a')]=qs[_0x300b('0x31')](_[_0x300b('0x55')](_0xb42fc9['query'],_0x274bba[_0x300b('0x31')]));if(_0xb42fc9[_0x300b('0x30')]['filter']){_0x3b3a4d[_0x300b('0x3a')]=_[_0x300b('0x3c')](_0x3b3a4d[_0x300b('0x3a')],{'$or':_[_0x300b('0x2a')](_0x3b3a4d[_0x300b('0x34')],function(_0xaa94e2){var _0x5b2927={};_0x5b2927[_0xaa94e2]={'$like':'%'+_0xb42fc9[_0x300b('0x30')][_0x300b('0x3b')]+'%'};return _0x5b2927;})});}_0x3b3a4d=_[_0x300b('0x3c')]({},_0x3b3a4d,_0xb42fc9[_0x300b('0x3e')]);return _0x16e6e6[_0x300b('0x57')](_0x3b3a4d);}})[_0x300b('0x21')](function(_0x68cf72){if(_0x68cf72){_0x46fba0=_0x68cf72[_0x300b('0x35')];if(!_0xb42fc9[_0x300b('0x30')]['hasOwnProperty'](_0x300b('0x36'))){_0x3b3a4d[_0x300b('0x37')]=qs['limit'](_0xb42fc9['query'][_0x300b('0x37')]);_0x3b3a4d[_0x300b('0x1b')]=qs['offset'](_0xb42fc9[_0x300b('0x30')][_0x300b('0x1b')]);}return _0x16e6e6[_0x300b('0x57')](_0x3b3a4d);}})['then'](function(_0x17c7c6){if(_0x17c7c6){return _0x17c7c6?{'count':_0x46fba0,'rows':_0x17c7c6}:null;}})[_0x300b('0x21')](respondWithResult(_0x19078a,null))[_0x300b('0x41')](handleError(_0x19078a,null));};exports[_0x300b('0x58')]=function(_0x5dbb2a,_0x4ba4c3,_0x86d08d){if(_0x5dbb2a[_0x300b('0x48')]['id']){delete _0x5dbb2a[_0x300b('0x48')]['id'];}return db[_0x300b('0x2b')][_0x300b('0x46')]({'where':{'id':_0x5dbb2a[_0x300b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ba4c3,null))[_0x300b('0x21')](function(_0x5bc44b){if(_0x5bc44b){_0x5dbb2a[_0x300b('0x48')][_0x300b('0x59')]=_0x5bc44b['id'];return db[_0x300b('0x5a')][_0x300b('0x47')](_0x5dbb2a[_0x300b('0x48')]);}})[_0x300b('0x21')](respondWithResult(_0x4ba4c3,null))[_0x300b('0x41')](handleError(_0x4ba4c3,null));};exports['getActions']=function(_0xe05d44,_0x39657b,_0x40f55f){var _0x46c1a1={};var _0x25fca5={};var _0x2945fb;var _0x51f1a7;return db[_0x300b('0x2b')][_0x300b('0x54')]({'where':{'id':_0xe05d44[_0x300b('0x43')]['id']}})[_0x300b('0x21')](handleEntityNotFound(_0x39657b,null))['then'](function(_0x3f9221){if(_0x3f9221){_0x2945fb=_0x3f9221;_0x25fca5[_0x300b('0x2f')]=_[_0x300b('0x44')](db['Action'][_0x300b('0x2c')]);_0x25fca5[_0x300b('0x30')]=_[_0x300b('0x44')](_0xe05d44[_0x300b('0x30')]);_0x25fca5['filters']=_[_0x300b('0x32')](_0x25fca5[_0x300b('0x2f')],_0x25fca5[_0x300b('0x30')]);_0x46c1a1[_0x300b('0x34')]=_[_0x300b('0x32')](_0x25fca5[_0x300b('0x2f')],qs[_0x300b('0x33')](_0xe05d44[_0x300b('0x30')][_0x300b('0x33')]));_0x46c1a1[_0x300b('0x34')]=_0x46c1a1[_0x300b('0x34')][_0x300b('0x35')]?_0x46c1a1[_0x300b('0x34')]:_0x25fca5[_0x300b('0x2f')];_0x46c1a1[_0x300b('0x38')]=qs[_0x300b('0x39')](_0xe05d44[_0x300b('0x30')][_0x300b('0x39')]);_0x46c1a1[_0x300b('0x3a')]=qs[_0x300b('0x31')](_[_0x300b('0x55')](_0xe05d44[_0x300b('0x30')],_0x25fca5[_0x300b('0x31')]));if(_0xe05d44[_0x300b('0x30')][_0x300b('0x3b')]){_0x46c1a1[_0x300b('0x3a')]=_[_0x300b('0x3c')](_0x46c1a1[_0x300b('0x3a')],{'$or':_[_0x300b('0x2a')](_0x46c1a1[_0x300b('0x34')],function(_0x4ca5a6){var _0x51d225={};_0x51d225[_0x4ca5a6]={'$like':'%'+_0xe05d44[_0x300b('0x30')]['filter']+'%'};return _0x51d225;})});}_0x46c1a1=_[_0x300b('0x3c')]({},_0x46c1a1,_0xe05d44[_0x300b('0x3e')]);return _0x2945fb[_0x300b('0x5b')](_0x46c1a1);}})[_0x300b('0x21')](function(_0x153a1a){if(_0x153a1a){_0x51f1a7=_0x153a1a[_0x300b('0x35')];if(!_0xe05d44[_0x300b('0x30')]['hasOwnProperty'](_0x300b('0x36'))){_0x46c1a1[_0x300b('0x37')]=qs['limit'](_0xe05d44['query']['limit']);_0x46c1a1[_0x300b('0x1b')]=qs[_0x300b('0x1b')](_0xe05d44['query']['offset']);}return _0x2945fb[_0x300b('0x5b')](_0x46c1a1);}})[_0x300b('0x21')](function(_0x48fe54){if(_0x48fe54){return _0x48fe54?{'count':_0x51f1a7,'rows':_0x48fe54}:null;}})['then'](respondWithResult(_0x39657b,null))[_0x300b('0x41')](handleError(_0x39657b,null));}; \ No newline at end of file +var _0x3074=['autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','status','error','stack','name','send','Trigger','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x56201b,_0x438daa){var _0x2f65d6=function(_0x34734a){while(--_0x34734a){_0x56201b['push'](_0x56201b['shift']());}};_0x2f65d6(++_0x438daa);}(_0x3074,0x1dd));var _0x4307=function(_0x4162ec,_0x476606){_0x4162ec=_0x4162ec-0x0;var _0x130fa9=_0x3074[_0x4162ec];return _0x130fa9;};'use strict';var pdf=require(_0x4307('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4307('0x1'));var zipdir=require(_0x4307('0x2'));var jsonpatch=require(_0x4307('0x3'));var rp=require('request-promise');var moment=require(_0x4307('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4307('0x5'));var util=require(_0x4307('0x6'));var path=require('path');var sox=require(_0x4307('0x7'));var csv=require(_0x4307('0x8'));var ejs=require(_0x4307('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4307('0xa'));var crypto=require(_0x4307('0xb'));var jsforce=require(_0x4307('0xc'));var deskjs=require(_0x4307('0xd'));var toCsv=require(_0x4307('0x8'));var querystring=require(_0x4307('0xe'));var Papa=require(_0x4307('0xf'));var Redis=require(_0x4307('0x10'));var authService=require(_0x4307('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4307('0x12'))('api');var utils=require(_0x4307('0x13'));var config=require(_0x4307('0x14'));var licenseUtil=require(_0x4307('0x15'));var db=require(_0x4307('0x16'))['db'];function respondWithStatusCode(_0x333167,_0x232cfd){_0x232cfd=_0x232cfd||0xcc;return function(_0xbd3609){if(_0xbd3609){return _0x333167[_0x4307('0x17')](_0x232cfd);}return _0x333167['status'](_0x232cfd)[_0x4307('0x18')]();};}function respondWithResult(_0x529a61,_0x4b567e){_0x4b567e=_0x4b567e||0xc8;return function(_0x29bdee){if(_0x29bdee){return _0x529a61['status'](_0x4b567e)[_0x4307('0x19')](_0x29bdee);}};}function respondWithFilteredResult(_0x4f32f7,_0x3dc471){return function(_0x4fca1e){if(_0x4fca1e){var _0x1e93e8=_0x4fca1e[_0x4307('0x1a')],_0x2141da=_0x3dc471[_0x4307('0x1b')],_0x148dc6=_0x3dc471[_0x4307('0x1b')]+_0x3dc471['limit'],_0x2686ee;if(_0x148dc6>=_0x1e93e8){_0x148dc6=_0x1e93e8;_0x2686ee=0xc8;}else{_0x2686ee=0xce;}_0x4f32f7['status'](_0x2686ee);return _0x4f32f7[_0x4307('0x1c')](_0x4307('0x1d'),_0x2141da+'-'+_0x148dc6+'/'+_0x1e93e8)[_0x4307('0x19')](_0x4fca1e);}return null;};}function patchUpdates(_0x282afc){return function(_0x32cec4){try{jsonpatch[_0x4307('0x1e')](_0x32cec4,_0x282afc,!![]);}catch(_0x299b62){return BPromise[_0x4307('0x1f')](_0x299b62);}return _0x32cec4[_0x4307('0x20')]();};}function saveUpdates(_0x567902,_0x383308){return function(_0x486f52){if(_0x486f52){return _0x486f52[_0x4307('0x21')](_0x567902)['then'](function(_0x4fc5da){return _0x4fc5da;});}return null;};}function removeEntity(_0xfa028b,_0x49a828){return function(_0x30b174){if(_0x30b174){return _0x30b174['destroy']()[_0x4307('0x22')](function(){var _0x45c7e8=_0x30b174[_0x4307('0x23')]({'plain':!![]});var _0x20909b=_0x4307('0x24');return db[_0x4307('0x25')][_0x4307('0x26')]({'where':{'type':_0x20909b,'resourceId':_0x45c7e8['id']}})['then'](function(){return _0x30b174;});})[_0x4307('0x22')](function(){_0xfa028b[_0x4307('0x27')](0xcc)[_0x4307('0x18')]();});}};}function handleEntityNotFound(_0x337d85,_0x435a59){return function(_0x35ede4){if(!_0x35ede4){_0x337d85[_0x4307('0x17')](0x194);}return _0x35ede4;};}function handleError(_0x2fbe7e,_0x46f5f0){_0x46f5f0=_0x46f5f0||0x1f4;return function(_0x30d7da){logger[_0x4307('0x28')](_0x30d7da[_0x4307('0x29')]);if(_0x30d7da[_0x4307('0x2a')]){delete _0x30d7da[_0x4307('0x2a')];}_0x2fbe7e[_0x4307('0x27')](_0x46f5f0)[_0x4307('0x2b')](_0x30d7da);};}exports['index']=function(_0x4c96c0,_0x552955){var _0x1839a1={},_0x4862f4={},_0x1421d6={'count':0x0,'rows':[]};var _0x3587c6=_['map'](db[_0x4307('0x2c')][_0x4307('0x2d')],function(_0x565bd5){return{'name':_0x565bd5[_0x4307('0x2e')],'type':_0x565bd5['type'][_0x4307('0x2f')]};});_0x4862f4[_0x4307('0x30')]=_[_0x4307('0x31')](_0x3587c6,_0x4307('0x2a'));_0x4862f4[_0x4307('0x32')]=_[_0x4307('0x33')](_0x4c96c0[_0x4307('0x32')]);_0x4862f4[_0x4307('0x34')]=_[_0x4307('0x35')](_0x4862f4['model'],_0x4862f4[_0x4307('0x32')]);_0x1839a1[_0x4307('0x36')]=_[_0x4307('0x35')](_0x4862f4['model'],qs['fields'](_0x4c96c0[_0x4307('0x32')]['fields']));_0x1839a1[_0x4307('0x36')]=_0x1839a1[_0x4307('0x36')][_0x4307('0x37')]?_0x1839a1[_0x4307('0x36')]:_0x4862f4[_0x4307('0x30')];if(!_0x4c96c0[_0x4307('0x32')][_0x4307('0x38')](_0x4307('0x39'))){_0x1839a1[_0x4307('0x3a')]=qs['limit'](_0x4c96c0[_0x4307('0x32')][_0x4307('0x3a')]);_0x1839a1['offset']=qs[_0x4307('0x1b')](_0x4c96c0[_0x4307('0x32')][_0x4307('0x1b')]);}_0x1839a1[_0x4307('0x3b')]=qs['sort'](_0x4c96c0[_0x4307('0x32')][_0x4307('0x3c')]);_0x1839a1['where']=qs[_0x4307('0x34')](_[_0x4307('0x3d')](_0x4c96c0['query'],_0x4862f4[_0x4307('0x34')]),_0x3587c6);if(_0x4c96c0[_0x4307('0x32')][_0x4307('0x3e')]){_0x1839a1[_0x4307('0x3f')]=_[_0x4307('0x40')](_0x1839a1['where'],{'$or':_[_0x4307('0x31')](_0x3587c6,function(_0xbc0a2c){if(_0xbc0a2c['type']!==_0x4307('0x41')){var _0x3d4e46={};_0x3d4e46[_0xbc0a2c['name']]={'$like':'%'+_0x4c96c0['query']['filter']+'%'};return _0x3d4e46;}})});}_0x1839a1=_[_0x4307('0x40')]({},_0x1839a1,_0x4c96c0[_0x4307('0x42')]);var _0x219c9e={'where':_0x1839a1[_0x4307('0x3f')]};return db[_0x4307('0x2c')]['count'](_0x219c9e)['then'](function(_0x479999){_0x1421d6['count']=_0x479999;if(_0x4c96c0[_0x4307('0x32')][_0x4307('0x43')]){_0x1839a1['include']=[{'all':!![]}];}return db['Trigger'][_0x4307('0x44')](_0x1839a1);})[_0x4307('0x22')](function(_0x343f77){_0x1421d6['rows']=_0x343f77;return _0x1421d6;})[_0x4307('0x22')](respondWithFilteredResult(_0x552955,_0x1839a1))[_0x4307('0x45')](handleError(_0x552955,null));};exports[_0x4307('0x46')]=function(_0x5f347b,_0x17a025){var _0x4bbd0d={'raw':![],'where':{'id':_0x5f347b[_0x4307('0x47')]['id']}},_0x3f55dc={};_0x3f55dc['model']=_[_0x4307('0x33')](db[_0x4307('0x2c')]['rawAttributes']);_0x3f55dc[_0x4307('0x32')]=_[_0x4307('0x33')](_0x5f347b[_0x4307('0x32')]);_0x3f55dc[_0x4307('0x34')]=_[_0x4307('0x35')](_0x3f55dc[_0x4307('0x30')],_0x3f55dc['query']);_0x4bbd0d[_0x4307('0x36')]=_['intersection'](_0x3f55dc['model'],qs[_0x4307('0x48')](_0x5f347b['query'][_0x4307('0x48')]));_0x4bbd0d[_0x4307('0x36')]=_0x4bbd0d[_0x4307('0x36')][_0x4307('0x37')]?_0x4bbd0d[_0x4307('0x36')]:_0x3f55dc[_0x4307('0x30')];if(_0x5f347b['query']['includeAll']){_0x4bbd0d[_0x4307('0x49')]=[{'all':!![]}];}_0x4bbd0d=_[_0x4307('0x40')]({},_0x4bbd0d,_0x5f347b['options']);return db[_0x4307('0x2c')][_0x4307('0x4a')](_0x4bbd0d)[_0x4307('0x22')](handleEntityNotFound(_0x17a025,null))[_0x4307('0x22')](respondWithResult(_0x17a025,null))[_0x4307('0x45')](handleError(_0x17a025,null));};exports['create']=function(_0x446841,_0x1ca57f){return db[_0x4307('0x2c')][_0x4307('0x4b')](_0x446841[_0x4307('0x4c')],{})[_0x4307('0x22')](function(_0x208907){var _0x51e64c=_0x446841[_0x4307('0x4d')]['get']({'plain':!![]});if(!_0x51e64c)throw new Error(_0x4307('0x4e'));if(_0x51e64c['role']===_0x4307('0x4d')){var _0x4bd2d7=_0x208907['get']({'plain':!![]});var _0x38a5bf=_0x4307('0x24');return db[_0x4307('0x4f')][_0x4307('0x4a')]({'where':{'name':_0x38a5bf,'userProfileId':_0x51e64c[_0x4307('0x50')]},'raw':!![]})[_0x4307('0x22')](function(_0x1f1486){if(_0x1f1486&&_0x1f1486[_0x4307('0x51')]===0x0){return db[_0x4307('0x25')][_0x4307('0x4b')]({'name':_0x4bd2d7[_0x4307('0x2a')],'resourceId':_0x4bd2d7['id'],'type':_0x1f1486[_0x4307('0x2a')],'sectionId':_0x1f1486['id']},{})[_0x4307('0x22')](function(){return _0x208907;});}else{return _0x208907;}})[_0x4307('0x45')](function(_0x194819){logger[_0x4307('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x194819);throw _0x194819;});}return _0x208907;})['then'](respondWithResult(_0x1ca57f,0xc9))[_0x4307('0x45')](handleError(_0x1ca57f,null));};exports['update']=function(_0x2960df,_0x7044dd){if(_0x2960df[_0x4307('0x4c')]['id']){delete _0x2960df[_0x4307('0x4c')]['id'];}return db[_0x4307('0x2c')][_0x4307('0x4a')]({'where':{'id':_0x2960df[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x7044dd,null))['then'](saveUpdates(_0x2960df[_0x4307('0x4c')],null))['then'](respondWithResult(_0x7044dd,null))[_0x4307('0x45')](handleError(_0x7044dd,null));};exports['destroy']=function(_0x37a1fa,_0x934c7f){return db[_0x4307('0x2c')][_0x4307('0x4a')]({'where':{'id':_0x37a1fa[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x934c7f,null))[_0x4307('0x22')](removeEntity(_0x934c7f,null))[_0x4307('0x45')](handleError(_0x934c7f,null));};exports[_0x4307('0x52')]=function(_0x3f608f,_0x477253,_0x473754){if(_0x3f608f['body']['id']){delete _0x3f608f['body']['id'];}return db[_0x4307('0x2c')][_0x4307('0x4a')]({'where':{'id':_0x3f608f[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x477253,null))[_0x4307('0x22')](function(_0x401ba5){if(_0x401ba5){_0x3f608f[_0x4307('0x4c')][_0x4307('0x53')]=_0x401ba5['id'];return db[_0x4307('0x54')][_0x4307('0x4b')](_0x3f608f[_0x4307('0x4c')]);}})[_0x4307('0x22')](respondWithResult(_0x477253,null))[_0x4307('0x45')](handleError(_0x477253,null));};exports[_0x4307('0x55')]=function(_0x29e04c,_0x4839a7,_0x4e38e4){if(_0x29e04c['body']['id']){delete _0x29e04c['body']['id'];}return db[_0x4307('0x2c')]['find']({'where':{'id':_0x29e04c[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x4839a7,null))[_0x4307('0x22')](function(_0x343608){if(_0x343608){_0x29e04c[_0x4307('0x4c')][_0x4307('0x56')]=_0x343608['id'];return db[_0x4307('0x54')]['create'](_0x29e04c[_0x4307('0x4c')]);}})[_0x4307('0x22')](respondWithResult(_0x4839a7,null))['catch'](handleError(_0x4839a7,null));};exports[_0x4307('0x57')]=function(_0x557b30,_0x5c0234,_0x57e366){var _0x298ef5={};var _0x53938e={};var _0x7401f0;var _0x2f4b90;return db[_0x4307('0x2c')][_0x4307('0x58')]({'where':{'id':_0x557b30[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x5c0234,null))[_0x4307('0x22')](function(_0xb5e0df){if(_0xb5e0df){_0x7401f0=_0xb5e0df;_0x53938e['model']=_[_0x4307('0x33')](db[_0x4307('0x54')][_0x4307('0x2d')]);_0x53938e[_0x4307('0x32')]=_[_0x4307('0x33')](_0x557b30[_0x4307('0x32')]);_0x53938e[_0x4307('0x34')]=_['intersection'](_0x53938e[_0x4307('0x30')],_0x53938e['query']);_0x298ef5[_0x4307('0x36')]=_[_0x4307('0x35')](_0x53938e['model'],qs[_0x4307('0x48')](_0x557b30[_0x4307('0x32')][_0x4307('0x48')]));_0x298ef5['attributes']=_0x298ef5[_0x4307('0x36')][_0x4307('0x37')]?_0x298ef5[_0x4307('0x36')]:_0x53938e['model'];_0x298ef5[_0x4307('0x3b')]=qs[_0x4307('0x3c')](_0x557b30[_0x4307('0x32')][_0x4307('0x3c')]);_0x298ef5[_0x4307('0x3f')]=qs['filters'](_['pick'](_0x557b30[_0x4307('0x32')],_0x53938e[_0x4307('0x34')]));if(_0x557b30[_0x4307('0x32')]['filter']){_0x298ef5[_0x4307('0x3f')]=_[_0x4307('0x40')](_0x298ef5[_0x4307('0x3f')],{'$or':_['map'](_0x298ef5[_0x4307('0x36')],function(_0x5d4782){var _0x34572b={};_0x34572b[_0x5d4782]={'$like':'%'+_0x557b30[_0x4307('0x32')][_0x4307('0x3e')]+'%'};return _0x34572b;})});}_0x298ef5=_[_0x4307('0x40')]({},_0x298ef5,_0x557b30[_0x4307('0x42')]);return _0x7401f0['getAllConditions'](_0x298ef5);}})[_0x4307('0x22')](function(_0xd03d61){if(_0xd03d61){_0x2f4b90=_0xd03d61[_0x4307('0x37')];if(!_0x557b30['query'][_0x4307('0x38')](_0x4307('0x39'))){_0x298ef5[_0x4307('0x3a')]=qs['limit'](_0x557b30[_0x4307('0x32')]['limit']);_0x298ef5['offset']=qs[_0x4307('0x1b')](_0x557b30[_0x4307('0x32')][_0x4307('0x1b')]);}return _0x7401f0[_0x4307('0x57')](_0x298ef5);}})[_0x4307('0x22')](function(_0x259542){if(_0x259542){return _0x259542?{'count':_0x2f4b90,'rows':_0x259542}:null;}})['then'](respondWithResult(_0x5c0234,null))[_0x4307('0x45')](handleError(_0x5c0234,null));};exports[_0x4307('0x59')]=function(_0x2b91b1,_0x247311,_0x45740f){var _0x3e0c8a={};var _0x3f4cbe={};var _0x34aa42;var _0x52d60e;return db[_0x4307('0x2c')][_0x4307('0x58')]({'where':{'id':_0x2b91b1[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x247311,null))[_0x4307('0x22')](function(_0x15bb53){if(_0x15bb53){_0x34aa42=_0x15bb53;_0x3f4cbe[_0x4307('0x30')]=_[_0x4307('0x33')](db[_0x4307('0x54')][_0x4307('0x2d')]);_0x3f4cbe[_0x4307('0x32')]=_[_0x4307('0x33')](_0x2b91b1[_0x4307('0x32')]);_0x3f4cbe[_0x4307('0x34')]=_[_0x4307('0x35')](_0x3f4cbe[_0x4307('0x30')],_0x3f4cbe[_0x4307('0x32')]);_0x3e0c8a[_0x4307('0x36')]=_['intersection'](_0x3f4cbe[_0x4307('0x30')],qs[_0x4307('0x48')](_0x2b91b1[_0x4307('0x32')][_0x4307('0x48')]));_0x3e0c8a['attributes']=_0x3e0c8a[_0x4307('0x36')][_0x4307('0x37')]?_0x3e0c8a[_0x4307('0x36')]:_0x3f4cbe[_0x4307('0x30')];_0x3e0c8a[_0x4307('0x3b')]=qs['sort'](_0x2b91b1['query'][_0x4307('0x3c')]);_0x3e0c8a[_0x4307('0x3f')]=qs[_0x4307('0x34')](_['pick'](_0x2b91b1[_0x4307('0x32')],_0x3f4cbe[_0x4307('0x34')]));if(_0x2b91b1[_0x4307('0x32')][_0x4307('0x3e')]){_0x3e0c8a[_0x4307('0x3f')]=_['merge'](_0x3e0c8a[_0x4307('0x3f')],{'$or':_[_0x4307('0x31')](_0x3e0c8a[_0x4307('0x36')],function(_0x4ed7d0){var _0x1fcbf6={};_0x1fcbf6[_0x4ed7d0]={'$like':'%'+_0x2b91b1[_0x4307('0x32')][_0x4307('0x3e')]+'%'};return _0x1fcbf6;})});}_0x3e0c8a=_['merge']({},_0x3e0c8a,_0x2b91b1[_0x4307('0x42')]);return _0x34aa42[_0x4307('0x59')](_0x3e0c8a);}})[_0x4307('0x22')](function(_0x5a1c1f){if(_0x5a1c1f){_0x52d60e=_0x5a1c1f['length'];if(!_0x2b91b1[_0x4307('0x32')]['hasOwnProperty'](_0x4307('0x39'))){_0x3e0c8a[_0x4307('0x3a')]=qs['limit'](_0x2b91b1[_0x4307('0x32')][_0x4307('0x3a')]);_0x3e0c8a[_0x4307('0x1b')]=qs[_0x4307('0x1b')](_0x2b91b1[_0x4307('0x32')][_0x4307('0x1b')]);}return _0x34aa42[_0x4307('0x59')](_0x3e0c8a);}})[_0x4307('0x22')](function(_0x1d8bdc){if(_0x1d8bdc){return _0x1d8bdc?{'count':_0x52d60e,'rows':_0x1d8bdc}:null;}})[_0x4307('0x22')](respondWithResult(_0x247311,null))[_0x4307('0x45')](handleError(_0x247311,null));};exports[_0x4307('0x5a')]=function(_0x33486e,_0x58bc74,_0xdadc5a){if(_0x33486e[_0x4307('0x4c')]['id']){delete _0x33486e[_0x4307('0x4c')]['id'];}return db[_0x4307('0x2c')][_0x4307('0x4a')]({'where':{'id':_0x33486e[_0x4307('0x47')]['id']}})['then'](handleEntityNotFound(_0x58bc74,null))['then'](function(_0x557d70){if(_0x557d70){_0x33486e[_0x4307('0x4c')]['TriggerId']=_0x557d70['id'];return db[_0x4307('0x5b')][_0x4307('0x4b')](_0x33486e[_0x4307('0x4c')]);}})[_0x4307('0x22')](respondWithResult(_0x58bc74,null))[_0x4307('0x45')](handleError(_0x58bc74,null));};exports[_0x4307('0x5c')]=function(_0x126491,_0x2e6127,_0x272d4e){var _0x272f1d={};var _0x34c90e={};var _0x3cb8bd;var _0x582836;return db['Trigger'][_0x4307('0x58')]({'where':{'id':_0x126491[_0x4307('0x47')]['id']}})[_0x4307('0x22')](handleEntityNotFound(_0x2e6127,null))[_0x4307('0x22')](function(_0x266d8f){if(_0x266d8f){_0x3cb8bd=_0x266d8f;_0x34c90e['model']=_[_0x4307('0x33')](db[_0x4307('0x5b')][_0x4307('0x2d')]);_0x34c90e[_0x4307('0x32')]=_[_0x4307('0x33')](_0x126491[_0x4307('0x32')]);_0x34c90e['filters']=_[_0x4307('0x35')](_0x34c90e['model'],_0x34c90e[_0x4307('0x32')]);_0x272f1d[_0x4307('0x36')]=_['intersection'](_0x34c90e[_0x4307('0x30')],qs[_0x4307('0x48')](_0x126491[_0x4307('0x32')]['fields']));_0x272f1d[_0x4307('0x36')]=_0x272f1d[_0x4307('0x36')]['length']?_0x272f1d['attributes']:_0x34c90e[_0x4307('0x30')];_0x272f1d[_0x4307('0x3b')]=qs[_0x4307('0x3c')](_0x126491['query'][_0x4307('0x3c')]);_0x272f1d['where']=qs[_0x4307('0x34')](_[_0x4307('0x3d')](_0x126491[_0x4307('0x32')],_0x34c90e[_0x4307('0x34')]));if(_0x126491[_0x4307('0x32')]['filter']){_0x272f1d['where']=_[_0x4307('0x40')](_0x272f1d['where'],{'$or':_[_0x4307('0x31')](_0x272f1d['attributes'],function(_0x54c5cb){var _0x29cf35={};_0x29cf35[_0x54c5cb]={'$like':'%'+_0x126491[_0x4307('0x32')][_0x4307('0x3e')]+'%'};return _0x29cf35;})});}_0x272f1d=_['merge']({},_0x272f1d,_0x126491['options']);return _0x3cb8bd[_0x4307('0x5c')](_0x272f1d);}})[_0x4307('0x22')](function(_0x4307f2){if(_0x4307f2){_0x582836=_0x4307f2[_0x4307('0x37')];if(!_0x126491[_0x4307('0x32')][_0x4307('0x38')]('nolimit')){_0x272f1d[_0x4307('0x3a')]=qs[_0x4307('0x3a')](_0x126491[_0x4307('0x32')]['limit']);_0x272f1d[_0x4307('0x1b')]=qs[_0x4307('0x1b')](_0x126491[_0x4307('0x32')][_0x4307('0x1b')]);}return _0x3cb8bd[_0x4307('0x5c')](_0x272f1d);}})['then'](function(_0x2b75ae){if(_0x2b75ae){return _0x2b75ae?{'count':_0x582836,'rows':_0x2b75ae}:null;}})[_0x4307('0x22')](respondWithResult(_0x2e6127,null))[_0x4307('0x45')](handleError(_0x2e6127,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 871216a..17ef65c 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 _0xd1e9=['path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x96b993,_0xd06a20){var _0x1cba29=function(_0x50919f){while(--_0x50919f){_0x96b993['push'](_0x96b993['shift']());}};_0x1cba29(++_0xd06a20);}(_0xd1e9,0xf7));var _0x9d1e=function(_0x8d2a71,_0x13618e){_0x8d2a71=_0x8d2a71-0x0;var _0x36ba8c=_0xd1e9[_0x8d2a71];return _0x36ba8c;};'use strict';var _=require(_0x9d1e('0x0'));var util=require(_0x9d1e('0x1'));var logger=require(_0x9d1e('0x2'))('api');var moment=require(_0x9d1e('0x3'));var BPromise=require(_0x9d1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d1e('0x5'));var rimraf=require(_0x9d1e('0x6'));var config=require(_0x9d1e('0x7'));var attributes=require('./trigger.attributes');module[_0x9d1e('0x8')]=function(_0x220887,_0x211b06){return _0x220887[_0x9d1e('0x9')](_0x9d1e('0xa'),attributes,{'tableName':_0x9d1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x357c=['path','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise'];(function(_0x3ec320,_0x322a91){var _0x33bd76=function(_0x24fe70){while(--_0x24fe70){_0x3ec320['push'](_0x3ec320['shift']());}};_0x33bd76(++_0x322a91);}(_0x357c,0x150));var _0xc357=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x357c[_0x496333];return _0x44256e;};'use strict';var _=require(_0xc357('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc357('0x1'));var moment=require(_0xc357('0x2'));var BPromise=require(_0xc357('0x3'));var rp=require(_0xc357('0x4'));var fs=require('fs');var path=require(_0xc357('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc357('0x6'));module[_0xc357('0x7')]=function(_0x57cec3,_0x3e4ed9){return _0x57cec3[_0xc357('0x8')](_0xc357('0x9'),attributes,{'tableName':_0xc357('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f9c4426..d9b4acd 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetTrigger','catch','ShowTrigger'];(function(_0x8956db,_0x565a5f){var _0x175a41=function(_0x51a8d0){while(--_0x51a8d0){_0x8956db['push'](_0x8956db['shift']());}};_0x175a41(++_0x565a5f);}(_0x087b,0x11a));var _0xb087=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x087b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('Trigger,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetTrigger']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['Trigger'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['Trigger'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowTrigger',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0x1d2d=['error','code','message','result','catch','Trigger','findAll','raw','where','options','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4b2097,_0x42910b){_0x4b2097=_0x4b2097-0x0;var _0xfb8a33=_0x1d2d[_0x4b2097];return _0xfb8a33;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Trigger,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetTrigger']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowTrigger',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ddea60a..75de5df 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 _0x425d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x339974,_0x318f2f){var _0x56dc65=function(_0x30fe5a){while(--_0x30fe5a){_0x339974['push'](_0x339974['shift']());}};_0x56dc65(++_0x318f2f);}(_0x425d,0x1e0));var _0xd425=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0x425d[_0x246f92];return _0x2b8e7d;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./trunk.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['show']);router[_0xd425('0xc')](_0xd425('0xd'),auth[_0xd425('0x9')](),controller[_0xd425('0xe')]);router[_0xd425('0xc')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller[_0xd425('0x13')]);module[_0xd425('0x14')]=router; \ No newline at end of file +var _0x24ca=['put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ca,0x1bc));var _0xa24c=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x24ca[_0xc77819];return _0x1c9434;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['post'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller['destroy']);module[_0xa24c('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index a492b68..332d624 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 _0xc923=['INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','setDataValue','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x587bdb,_0xffed85){var _0x3e292c=function(_0xc1bb6b){while(--_0xc1bb6b){_0x587bdb['push'](_0x587bdb['shift']());}};_0x3e292c(++_0xffed85);}(_0xc923,0x112));var _0x3c92=function(_0x283d4a,_0x169014){_0x283d4a=_0x283d4a-0x0;var _0x83a896=_0xc923[_0x283d4a];return _0x83a896;};'use strict';var Sequelize=require(_0x3c92('0x0'));module[_0x3c92('0x1')]={'name':{'type':Sequelize[_0x3c92('0x2')],'allowNull':![],'unique':_0x3c92('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3c92('0x4')]('friend',_0x3c92('0x5'),_0x3c92('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3c92('0x2')],'allowNull':![],'defaultValue':_0x3c92('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x3c92('0x8'),'ALLOWED_PASSED_SCREEN',_0x3c92('0x9'),'ALLOWED',_0x3c92('0xa'),_0x3c92('0xb'),_0x3c92('0xc'),_0x3c92('0xd'))},'deny':{'type':Sequelize[_0x3c92('0x2')]},'permit':{'type':Sequelize[_0x3c92('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3c92('0x2')]},'remotesecret':{'type':Sequelize[_0x3c92('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x20d3fd){this['setDataValue'](_0x3c92('0xe'),_0x20d3fd?_0x20d3fd['join'](','):null);},'get':function(){return this[_0x3c92('0xf')](_0x3c92('0xe'))?this['getDataValue']('transport')[_0x3c92('0x10')](','):null;},'comment':_0x3c92('0x11')},'dtmfmode':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x12'),_0x3c92('0x13'),_0x3c92('0x14'),_0x3c92('0x15'),_0x3c92('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no','nonat',_0x3c92('0x18'),_0x3c92('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3c92('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3c92('0x2')],'defaultValue':_0x3c92('0x1a'),'set':function(_0x260c1e){this['setDataValue'](_0x3c92('0x1b'),_0x260c1e?_0x260c1e['join'](','):null);},'get':function(){return this[_0x3c92('0xf')]('nat')?this['getDataValue'](_0x3c92('0x1b'))[_0x3c92('0x10')](','):null;},'comment':_0x3c92('0x1c')},'callgroup':{'type':Sequelize[_0x3c92('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3c92('0x2')]},'pickupgroup':{'type':Sequelize[_0x3c92('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3c92('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3c92('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3c92('0x2')],'allowNull':![],'defaultValue':_0x3c92('0x1d'),'set':function(_0x4e298e){this[_0x3c92('0x1e')](_0x3c92('0x1f'),_0x4e298e?_0x4e298e[_0x3c92('0x20')](';'):_0x3c92('0x1d'));},'get':function(){return this[_0x3c92('0xf')](_0x3c92('0x1f'))?this[_0x3c92('0xf')](_0x3c92('0x1f'))['split'](';'):null;},'comment':_0x3c92('0x21')},'autoframing':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'insecure':{'type':Sequelize[_0x3c92('0x2')],'defaultValue':_0x3c92('0x22'),'set':function(_0x4be3f9){this[_0x3c92('0x1e')](_0x3c92('0x23'),_0x4be3f9?_0x4be3f9[_0x3c92('0x20')](','):null);},'get':function(){return this[_0x3c92('0xf')](_0x3c92('0x23'))?this['getDataValue']('insecure')[_0x3c92('0x10')](','):null;},'comment':_0x3c92('0x24')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no',_0x3c92('0x25'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'accountcode':{'type':Sequelize[_0x3c92('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3c92('0x27')},'amaflags':{'type':Sequelize[_0x3c92('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no'),'defaultValue':_0x3c92('0x17')},'busylevel':{'type':Sequelize[_0x3c92('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x3c92('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x3c92('0x2')]},'template':{'type':Sequelize[_0x3c92('0x2')]},'videosupport':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no',_0x3c92('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3c92('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'mailbox':{'type':Sequelize[_0x3c92('0x2')]},'session_timers':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x29'),_0x3c92('0x2a'),_0x3c92('0x2b'))},'session_expires':{'type':Sequelize[_0x3c92('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x3c92('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x2c'),_0x3c92('0x2d')),'defaultValue':_0x3c92('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x3c92('0x2')]},'regexten':{'type':Sequelize[_0x3c92('0x2')]},'fromdomain':{'type':Sequelize[_0x3c92('0x2')]},'fromuser':{'type':Sequelize[_0x3c92('0x2')]},'port':{'type':Sequelize[_0x3c92('0x26')](0x5)},'qualify':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no'),'defaultValue':_0x3c92('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3c92('0x2')]},'defaultuser':{'type':Sequelize[_0x3c92('0x2')]},'rtptimeout':{'type':Sequelize[_0x3c92('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3c92('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3c92('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x3c92('0x4')]('yes','no',_0x3c92('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3c92('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3c92('0x26')](0xb)},'timerb':{'type':Sequelize[_0x3c92('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x3c92('0x2')]},'contactdeny':{'type':Sequelize[_0x3c92('0x2')]},'contactacl':{'type':Sequelize[_0x3c92('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3c92('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3c92('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'force_avp':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'icesupport':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x3c92('0x4')](_0x3c92('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no',_0x3c92('0x2f'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3c92('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3c92('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3c92('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3c92('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3c92('0x30'),_0x3c92('0x31'),_0x3c92('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3c92('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3c92('0x2')]},'recordofffeature':{'type':Sequelize[_0x3c92('0x2')]},'call_limit':{'type':Sequelize[_0x3c92('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x3c92('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x3c92('0x2')]},'parkinglot':{'type':Sequelize[_0x3c92('0x2')]},'description':{'type':Sequelize[_0x3c92('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x3c92('0x33')},'canreinvite':{'type':Sequelize[_0x3c92('0x4')]('yes','no','nonat',_0x3c92('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3c92('0x2')]},'otherFields':{'type':Sequelize[_0x3c92('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3c92('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2f86=['PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x2f86,0x1c7));var _0x62f8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2f86[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x62f8('0x0'));module[_0x62f8('0x1')]={'name':{'type':Sequelize[_0x62f8('0x2')],'allowNull':![],'unique':_0x62f8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x5'),'user',_0x62f8('0x6')),'allowNull':![],'defaultValue':_0x62f8('0x5')},'context':{'type':Sequelize[_0x62f8('0x2')],'allowNull':![],'defaultValue':_0x62f8('0x7')},'callingpres':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x8'),_0x62f8('0x9'),_0x62f8('0xa'),_0x62f8('0xb'),_0x62f8('0xc'),'PROHIB_PASSED_SCREEN',_0x62f8('0xd'),_0x62f8('0xe'))},'deny':{'type':Sequelize[_0x62f8('0x2')]},'permit':{'type':Sequelize[_0x62f8('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x62f8('0x2')]},'remotesecret':{'type':Sequelize[_0x62f8('0x2')]},'transport':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':_0x62f8('0xf'),'set':function(_0x327a18){this[_0x62f8('0x10')]('transport',_0x327a18?_0x327a18[_0x62f8('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x62f8('0x12'))?this['getDataValue']('transport')[_0x62f8('0x13')](','):null;},'comment':_0x62f8('0x14')},'dtmfmode':{'type':Sequelize[_0x62f8('0x4')]('rfc2833','info',_0x62f8('0x15'),_0x62f8('0x16'),_0x62f8('0x17')),'defaultValue':_0x62f8('0x18')},'directmedia':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no',_0x62f8('0x1a'),_0x62f8('0x1b'),_0x62f8('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x62f8('0x2')]},'directmediadeny':{'type':Sequelize[_0x62f8('0x2')]},'nat':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x566b82){this['setDataValue'](_0x62f8('0x1d'),_0x566b82?_0x566b82['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x62f8('0x1e')](_0x62f8('0x1d'))[_0x62f8('0x13')](','):null;},'comment':_0x62f8('0x1f')},'callgroup':{'type':Sequelize[_0x62f8('0x2')]},'namedcallgroup':{'type':Sequelize[_0x62f8('0x2')]},'pickupgroup':{'type':Sequelize[_0x62f8('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x62f8('0x2')]},'language':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x62f8('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':_0x62f8('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62f8('0x21'),'set':function(_0x2119cc){this[_0x62f8('0x10')]('allow',_0x2119cc?_0x2119cc[_0x62f8('0x11')](';'):_0x62f8('0x21'));},'get':function(){return this[_0x62f8('0x1e')]('allow')?this[_0x62f8('0x1e')](_0x62f8('0x22'))[_0x62f8('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'insecure':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':_0x62f8('0x23'),'set':function(_0x2b4381){this[_0x62f8('0x10')](_0x62f8('0x24'),_0x2b4381?_0x2b4381[_0x62f8('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x62f8('0x24'))?this[_0x62f8('0x1e')]('insecure')['split'](','):null;},'comment':_0x62f8('0x25')},'trustrpid':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x62f8('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no',_0x62f8('0x26'))},'promiscredir':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'accountcode':{'type':Sequelize[_0x62f8('0x27')](0xb)},'setvar':{'type':Sequelize[_0x62f8('0x2')]},'callerid':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':_0x62f8('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x62f8('0x4')]('yes','no'),'defaultValue':_0x62f8('0x19')},'busylevel':{'type':Sequelize[_0x62f8('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x62f8('0x19'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x62f8('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x62f8('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x62f8('0x2')]},'videosupport':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x62f8('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'mailbox':{'type':Sequelize[_0x62f8('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x62f8('0x29'),_0x62f8('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x62f8('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x62f8('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x62f8('0x4')]('uac',_0x62f8('0x2b')),'defaultValue':_0x62f8('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x62f8('0x2')]},'regexten':{'type':Sequelize[_0x62f8('0x2')]},'fromdomain':{'type':Sequelize[_0x62f8('0x2')]},'fromuser':{'type':Sequelize[_0x62f8('0x2')]},'port':{'type':Sequelize[_0x62f8('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x62f8('0x19'),'no'),'defaultValue':_0x62f8('0x19')},'keepalive':{'type':Sequelize[_0x62f8('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x62f8('0x2')]},'rtptimeout':{'type':Sequelize[_0x62f8('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x62f8('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x62f8('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no',_0x62f8('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x62f8('0x2')]},'callbackextension':{'type':Sequelize[_0x62f8('0x2')]},'timert1':{'type':Sequelize[_0x62f8('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x62f8('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x62f8('0x2')]},'contactdeny':{'type':Sequelize[_0x62f8('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x62f8('0x2')]},'use_q850_reason':{'type':Sequelize[_0x62f8('0x2')]},'maxforwards':{'type':Sequelize[_0x62f8('0x27')](0xb)},'encryption':{'type':Sequelize[_0x62f8('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x62f8('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x62f8('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x62f8('0x4')]('yes','no',_0x62f8('0x2d'),_0x62f8('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x62f8('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x62f8('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x62f8('0x2')]},'dtlscapath':{'type':Sequelize[_0x62f8('0x2')]},'dtlssetup':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x2f'),'passive',_0x62f8('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x62f8('0x2')]},'usereqphone':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x62f8('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x62f8('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no')},'vmexten':{'type':Sequelize[_0x62f8('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x62f8('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':_0x62f8('0x31')},'canreinvite':{'type':Sequelize[_0x62f8('0x4')](_0x62f8('0x19'),'no',_0x62f8('0x1a'),_0x62f8('0x1b'),_0x62f8('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x62f8('0x2')]},'otherFields':{'type':Sequelize[_0x62f8('0x2')]},'active':{'type':Sequelize[_0x62f8('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x62f8('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 06215c0..2b1f398 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 _0x59e0=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','clone','body','omit','createdAt','updatedAt','create','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','end','stack','name','send','Trunk','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','order','sort','where','pick','filter'];(function(_0x21e6da,_0x53320c){var _0x5ccd75=function(_0x387325){while(--_0x387325){_0x21e6da['push'](_0x21e6da['shift']());}};_0x5ccd75(++_0x53320c);}(_0x59e0,0x1e2));var _0x059e=function(_0x1309e1,_0xdb884e){_0x1309e1=_0x1309e1-0x0;var _0x45e90c=_0x59e0[_0x1309e1];return _0x45e90c;};'use strict';var pdf=require(_0x059e('0x0'));var emlformat=require(_0x059e('0x1'));var rimraf=require(_0x059e('0x2'));var zipdir=require(_0x059e('0x3'));var jsonpatch=require(_0x059e('0x4'));var rp=require(_0x059e('0x5'));var moment=require(_0x059e('0x6'));var BPromise=require(_0x059e('0x7'));var Mustache=require('mustache');var util=require(_0x059e('0x8'));var path=require(_0x059e('0x9'));var sox=require('sox');var csv=require(_0x059e('0xa'));var ejs=require(_0x059e('0xb'));var fs=require('fs');var _=require(_0x059e('0xc'));var squel=require(_0x059e('0xd'));var crypto=require(_0x059e('0xe'));var jsforce=require(_0x059e('0xf'));var deskjs=require(_0x059e('0x10'));var toCsv=require(_0x059e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x059e('0x11'));var authService=require(_0x059e('0x12'));var qs=require(_0x059e('0x13'));var as=require(_0x059e('0x14'));var hardwareService=require(_0x059e('0x15'));var logger=require(_0x059e('0x16'))(_0x059e('0x17'));var utils=require(_0x059e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x059e('0x19'));var db=require(_0x059e('0x1a'))['db'];var jayson=require(_0x059e('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1619b8,_0x1d563f,_0x56f62c,_0x1db5df){return new BPromise(function(_0xf61cf1,_0x240b10){var _0x9cdc4a=_0x1db5df||client;return _0x9cdc4a['request'](_0x1619b8,_0x56f62c)[_0x059e('0x1c')](function(_0x55298b){logger['info'](_0x059e('0x1d'),_0x1d563f,_0x059e('0x1e'));logger[_0x059e('0x1f')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1d563f,'request\x20sent',JSON[_0x059e('0x20')](_0x55298b));if(_0x55298b[_0x059e('0x21')]){if(_0x55298b[_0x059e('0x21')][_0x059e('0x22')]===0x1f4){logger[_0x059e('0x21')](_0x059e('0x1d'),_0x1d563f,_0x55298b['error'][_0x059e('0x23')]);return _0x240b10(_0x55298b[_0x059e('0x21')]['message']);}logger[_0x059e('0x21')](_0x059e('0x1d'),_0x1d563f,_0x55298b['error']['message']);return _0xf61cf1(_0x55298b[_0x059e('0x21')][_0x059e('0x23')]);}else{logger[_0x059e('0x24')](_0x059e('0x1d'),_0x1d563f,'request\x20sent');_0xf61cf1(_0x55298b[_0x059e('0x25')][_0x059e('0x23')]);}})[_0x059e('0x26')](function(_0x1cb0ce){logger['error']('Trunk,\x20%s,\x20%s',_0x1d563f,_0x1cb0ce);_0x240b10(_0x1cb0ce);});});}function respondWithStatusCode(_0x46cd3a,_0x292726){_0x292726=_0x292726||0xcc;return function(_0x2adf45){if(_0x2adf45){return _0x46cd3a[_0x059e('0x27')](_0x292726);}return _0x46cd3a['status'](_0x292726)['end']();};}function respondWithResult(_0x4cd547,_0x1b1933){_0x1b1933=_0x1b1933||0xc8;return function(_0x911c14){if(_0x911c14){return _0x4cd547[_0x059e('0x28')](_0x1b1933)['json'](_0x911c14);}};}function respondWithFilteredResult(_0x782a1f,_0x870df8){return function(_0x5850dc){if(_0x5850dc){var _0x421a7a=_0x5850dc[_0x059e('0x29')],_0x5993a5=_0x870df8['offset'],_0xd3e9ee=_0x870df8[_0x059e('0x2a')]+_0x870df8[_0x059e('0x2b')],_0x47d10c;if(_0xd3e9ee>=_0x421a7a){_0xd3e9ee=_0x421a7a;_0x47d10c=0xc8;}else{_0x47d10c=0xce;}_0x782a1f[_0x059e('0x28')](_0x47d10c);return _0x782a1f[_0x059e('0x2c')](_0x059e('0x2d'),_0x5993a5+'-'+_0xd3e9ee+'/'+_0x421a7a)[_0x059e('0x2e')](_0x5850dc);}return null;};}function patchUpdates(_0x12fbb6){return function(_0xdc6f78){try{jsonpatch[_0x059e('0x2f')](_0xdc6f78,_0x12fbb6,!![]);}catch(_0xb93e4d){return BPromise[_0x059e('0x30')](_0xb93e4d);}return _0xdc6f78[_0x059e('0x31')]();};}function saveUpdates(_0x174725,_0x218d9b){return function(_0x465ba5){if(_0x465ba5){return _0x465ba5[_0x059e('0x32')](_0x174725)['then'](function(_0x160814){return _0x160814;});}return null;};}function removeEntity(_0x587bf1,_0x441268){return function(_0x34d554){if(_0x34d554){return _0x34d554[_0x059e('0x33')]()[_0x059e('0x1c')](function(){var _0x325a5b=_0x34d554['get']({'plain':!![]});var _0x320f60=_0x059e('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x320f60,'resourceId':_0x325a5b['id']}})[_0x059e('0x1c')](function(){return _0x34d554;});})['then'](function(){_0x587bf1[_0x059e('0x28')](0xcc)[_0x059e('0x35')]();});}};}function handleEntityNotFound(_0x5e9337,_0x582a52){return function(_0x24c905){if(!_0x24c905){_0x5e9337['sendStatus'](0x194);}return _0x24c905;};}function handleError(_0x39e54a,_0x3c22e2){_0x3c22e2=_0x3c22e2||0x1f4;return function(_0x11361d){logger[_0x059e('0x21')](_0x11361d[_0x059e('0x36')]);if(_0x11361d[_0x059e('0x37')]){delete _0x11361d['name'];}_0x39e54a[_0x059e('0x28')](_0x3c22e2)[_0x059e('0x38')](_0x11361d);};}exports['index']=function(_0x374381,_0x155f14){var _0x154fb8={},_0x6aa63b={},_0x5de021={'count':0x0,'rows':[]};var _0x5706a0=_['map'](db[_0x059e('0x39')][_0x059e('0x3a')],function(_0x349a07){return{'name':_0x349a07['fieldName'],'type':_0x349a07[_0x059e('0x3b')][_0x059e('0x3c')]};});_0x6aa63b[_0x059e('0x3d')]=_['map'](_0x5706a0,_0x059e('0x37'));_0x6aa63b['query']=_[_0x059e('0x3e')](_0x374381[_0x059e('0x3f')]);_0x6aa63b[_0x059e('0x40')]=_['intersection'](_0x6aa63b['model'],_0x6aa63b['query']);_0x154fb8['attributes']=_[_0x059e('0x41')](_0x6aa63b[_0x059e('0x3d')],qs['fields'](_0x374381['query']['fields']));_0x154fb8[_0x059e('0x42')]=_0x154fb8[_0x059e('0x42')][_0x059e('0x43')]?_0x154fb8[_0x059e('0x42')]:_0x6aa63b[_0x059e('0x3d')];if(!_0x374381['query']['hasOwnProperty']('nolimit')){_0x154fb8['limit']=qs[_0x059e('0x2b')](_0x374381[_0x059e('0x3f')][_0x059e('0x2b')]);_0x154fb8['offset']=qs[_0x059e('0x2a')](_0x374381[_0x059e('0x3f')]['offset']);}_0x154fb8[_0x059e('0x44')]=qs[_0x059e('0x45')](_0x374381[_0x059e('0x3f')][_0x059e('0x45')]);_0x154fb8[_0x059e('0x46')]=qs['filters'](_[_0x059e('0x47')](_0x374381[_0x059e('0x3f')],_0x6aa63b[_0x059e('0x40')]),_0x5706a0);if(_0x374381[_0x059e('0x3f')][_0x059e('0x48')]){_0x154fb8[_0x059e('0x46')]=_[_0x059e('0x49')](_0x154fb8['where'],{'$or':_[_0x059e('0x4a')](_0x5706a0,function(_0x486079){if(_0x486079['type']!==_0x059e('0x4b')){var _0x1bde31={};_0x1bde31[_0x486079[_0x059e('0x37')]]={'$like':'%'+_0x374381[_0x059e('0x3f')]['filter']+'%'};return _0x1bde31;}})});}_0x154fb8=_['merge']({},_0x154fb8,_0x374381[_0x059e('0x4c')]);var _0x5756bd={'where':_0x154fb8[_0x059e('0x46')]};return db[_0x059e('0x39')][_0x059e('0x29')](_0x5756bd)[_0x059e('0x1c')](function(_0x3cf751){_0x5de021[_0x059e('0x29')]=_0x3cf751;if(_0x374381[_0x059e('0x3f')][_0x059e('0x4d')]){_0x154fb8[_0x059e('0x4e')]=[{'all':!![]}];}return db[_0x059e('0x39')][_0x059e('0x4f')](_0x154fb8);})[_0x059e('0x1c')](function(_0x1ecdfa){_0x5de021[_0x059e('0x50')]=_0x1ecdfa;return _0x5de021;})[_0x059e('0x1c')](respondWithFilteredResult(_0x155f14,_0x154fb8))[_0x059e('0x26')](handleError(_0x155f14,null));};exports[_0x059e('0x51')]=function(_0x3190dc,_0x5786af){var _0x1598f1={'raw':![],'where':{'id':_0x3190dc[_0x059e('0x52')]['id']}},_0x2fa101={};_0x2fa101[_0x059e('0x3d')]=_[_0x059e('0x3e')](db['Trunk']['rawAttributes']);_0x2fa101[_0x059e('0x3f')]=_[_0x059e('0x3e')](_0x3190dc[_0x059e('0x3f')]);_0x2fa101[_0x059e('0x40')]=_['intersection'](_0x2fa101['model'],_0x2fa101[_0x059e('0x3f')]);_0x1598f1['attributes']=_['intersection'](_0x2fa101[_0x059e('0x3d')],qs[_0x059e('0x53')](_0x3190dc[_0x059e('0x3f')][_0x059e('0x53')]));_0x1598f1[_0x059e('0x42')]=_0x1598f1[_0x059e('0x42')]['length']?_0x1598f1['attributes']:_0x2fa101['model'];if(_0x3190dc[_0x059e('0x3f')][_0x059e('0x4d')]){_0x1598f1[_0x059e('0x4e')]=[{'all':!![]}];}_0x1598f1=_[_0x059e('0x49')]({},_0x1598f1,_0x3190dc[_0x059e('0x4c')]);return db[_0x059e('0x39')][_0x059e('0x54')](_0x1598f1)['then'](handleEntityNotFound(_0x5786af,null))[_0x059e('0x1c')](respondWithResult(_0x5786af,null))[_0x059e('0x26')](handleError(_0x5786af,null));};exports[_0x059e('0x55')]=function(_0xdd8a89,_0x473da1){var _0x5f1df8={'where':{'id':_0xdd8a89[_0x059e('0x52')]['id']}},_0x55f44e={};_0x55f44e[_0x059e('0x3d')]=_['keys'](db[_0x059e('0x39')][_0x059e('0x3a')]);_0x5f1df8[_0x059e('0x42')]=_['intersection'](_0x55f44e[_0x059e('0x3d')],qs[_0x059e('0x53')](_0xdd8a89[_0x059e('0x3f')][_0x059e('0x53')]));_0x5f1df8[_0x059e('0x42')]=_0x5f1df8['attributes'][_0x059e('0x43')]?_0x5f1df8[_0x059e('0x42')]:_0x55f44e[_0x059e('0x3d')];if(_0xdd8a89['query'][_0x059e('0x4d')]){_0x5f1df8[_0x059e('0x4e')]=[{'all':!![]}];}_0x5f1df8=_[_0x059e('0x49')]({},_0x5f1df8,_0xdd8a89[_0x059e('0x4c')]);return db[_0x059e('0x39')][_0x059e('0x54')](_0x5f1df8)[_0x059e('0x1c')](handleEntityNotFound(_0x473da1,null))[_0x059e('0x1c')](function(_0x34b18b){if(_0x34b18b){var _0x4d2632=_0x34b18b['get']({'plain':!![]});_0x4d2632=qs['omit'](_0x4d2632,['id','createdAt','updatedAt']);_0xdd8a89[_0x059e('0x56')]=_[_0x059e('0x57')](_0xdd8a89['body'],['id',_0x059e('0x58'),_0x059e('0x59')]);return db[_0x059e('0x39')][_0x059e('0x5a')](_[_0x059e('0x49')](_0x4d2632,_0xdd8a89[_0x059e('0x56')]),{'include':_0xdd8a89[_0x059e('0x3f')][_0x059e('0x4d')]?[{'all':!![]}]:undefined})[_0x059e('0x1c')](function(_0x5700ca){var _0x200c30=_0xdd8a89['user']['get']({'plain':!![]});if(!_0x200c30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200c30[_0x059e('0x5b')]===_0x059e('0x5c')){var _0x2c6c45=_0x5700ca[_0x059e('0x5d')]({'plain':!![]});var _0x5cdaa9=_0x059e('0x34');return db[_0x059e('0x5e')][_0x059e('0x54')]({'where':{'name':_0x5cdaa9,'userProfileId':_0x200c30[_0x059e('0x5f')]},'raw':!![]})['then'](function(_0x4adab7){if(_0x4adab7&&_0x4adab7[_0x059e('0x60')]===0x0){return db[_0x059e('0x61')][_0x059e('0x5a')]({'name':_0x2c6c45['name'],'resourceId':_0x2c6c45['id'],'type':_0x4adab7['name'],'sectionId':_0x4adab7['id']},{})[_0x059e('0x1c')](function(){return _0x5700ca;});}else{return _0x5700ca;}})[_0x059e('0x26')](function(_0x469fa1){logger[_0x059e('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x469fa1);throw _0x469fa1;});}return _0x5700ca;});}})[_0x059e('0x1c')](respondWithResult(_0x473da1,0xc9))['catch'](handleError(_0x473da1,null));};exports['create']=function(_0x61a6a3,_0x15db52,_0x32640a){var _0x270db4;return db['Trunk'][_0x059e('0x5a')](_0x61a6a3[_0x059e('0x56')],{'raw':!![]})[_0x059e('0x1c')](function(_0x6b8fb4){_0x270db4=_0x6b8fb4;return db[_0x059e('0x39')][_0x059e('0x4f')]({'raw':!![]});})['then'](function(_0x5a9eac){var _0x5e51c4=fs[_0x059e('0x62')](path[_0x059e('0x63')](config[_0x059e('0x64')],_0x059e('0x65')),_0x059e('0x66'));var _0x47b1d2=fs[_0x059e('0x62')](path['join'](config[_0x059e('0x64')],_0x059e('0x67')),'utf8');var _0x3d97df=ejs[_0x059e('0x68')](_0x5e51c4,{'trunks':_0x5a9eac||[]});fs[_0x059e('0x69')](_0x059e('0x6a'),_0x3d97df);if(_0x270db4[_0x059e('0x6b')]){var _0x47cc8e=ejs[_0x059e('0x68')](_0x47b1d2,{'trunks':_0x5a9eac||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x47cc8e);}})[_0x059e('0x1c')](function(){return respondWithRpcPromise(_0x059e('0x6c'),_0x059e('0x5a'),{'module':_0x059e('0x6d')});})['then'](function(){var _0x363b50=_0x61a6a3[_0x059e('0x5c')][_0x059e('0x5d')]({'plain':!![]});if(!_0x363b50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x363b50[_0x059e('0x5b')]==='user'){var _0x13f70e=_0x270db4['get']({'plain':!![]});return db[_0x059e('0x5e')][_0x059e('0x54')]({'where':{'name':_0x059e('0x34'),'userProfileId':_0x363b50[_0x059e('0x5f')]},'raw':!![]})[_0x059e('0x1c')](function(_0x1b404d){if(_0x1b404d&&_0x1b404d[_0x059e('0x60')]===0x0){return db['UserProfileResource'][_0x059e('0x5a')]({'name':_0x13f70e[_0x059e('0x37')],'resourceId':_0x13f70e['id'],'type':_0x1b404d[_0x059e('0x37')],'sectionId':_0x1b404d['id']},{})['then'](function(){return _0x270db4;});}else{return _0x270db4;}})['catch'](function(_0x1d161b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d161b);throw _0x1d161b;});}return _0x270db4;})[_0x059e('0x1c')](respondWithResult(_0x15db52,0xc9))[_0x059e('0x26')](handleError(_0x15db52,null));};exports[_0x059e('0x32')]=function(_0x384a3a,_0x4cb55a,_0x5bb58f){var _0x595d36;return db[_0x059e('0x39')][_0x059e('0x54')]({'where':{'id':_0x384a3a[_0x059e('0x52')]['id']}})[_0x059e('0x1c')](handleEntityNotFound(_0x4cb55a,null))[_0x059e('0x1c')](saveUpdates(_0x384a3a[_0x059e('0x56')],null))['then'](function(_0x1560a0){if(_0x1560a0){_0x595d36=_0x1560a0;return db[_0x059e('0x39')][_0x059e('0x4f')]({'raw':!![]});}})['then'](function(_0x3e30b4){if(_0x3e30b4){var _0x50fd63=fs[_0x059e('0x62')](path['join'](config[_0x059e('0x64')],_0x059e('0x65')),_0x059e('0x66'));var _0x5da7d3=fs[_0x059e('0x62')](path[_0x059e('0x63')](config[_0x059e('0x64')],_0x059e('0x67')),_0x059e('0x66'));var _0x3932e9=ejs[_0x059e('0x68')](_0x50fd63,{'trunks':_0x3e30b4||[]});fs[_0x059e('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3932e9);var _0x37c468=ejs['render'](_0x5da7d3,{'trunks':_0x3e30b4||[]});fs[_0x059e('0x69')](_0x059e('0x6e'),_0x37c468);return respondWithRpcPromise('Reload',_0x059e('0x32'),{'module':_0x059e('0x6d')});}return null;})[_0x059e('0x1c')](function(_0x46ed06){if(_0x46ed06){return _0x595d36;}})[_0x059e('0x1c')](respondWithResult(_0x4cb55a,null))[_0x059e('0x26')](handleError(_0x4cb55a,null));};exports[_0x059e('0x33')]=function(_0x3028a2,_0x287f2b,_0x28d918){var _0xce09b9;return db['Trunk']['find']({'where':{'id':_0x3028a2[_0x059e('0x52')]['id']}})['then'](handleEntityNotFound(_0x287f2b,null))['then'](removeEntity(_0x287f2b,null))[_0x059e('0x1c')](function(){return db[_0x059e('0x39')][_0x059e('0x4f')]({'raw':!![]});})[_0x059e('0x1c')](function(_0x1bebe3){var _0x272fc5=fs[_0x059e('0x62')](path[_0x059e('0x63')](config[_0x059e('0x64')],_0x059e('0x65')),'utf8');var _0x7a437e=fs['readFileSync'](path['join'](config[_0x059e('0x64')],_0x059e('0x67')),_0x059e('0x66'));var _0x53a988=ejs[_0x059e('0x68')](_0x272fc5,{'trunks':_0x1bebe3});var _0x52a45b=ejs[_0x059e('0x68')](_0x7a437e,{'trunks':_0x1bebe3});fs[_0x059e('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x53a988);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x52a45b);return respondWithRpcPromise(_0x059e('0x6c'),_0x059e('0x33'),{'module':_0x059e('0x6d')});})[_0x059e('0x26')](handleError(_0x287f2b,null));}; \ No newline at end of file +var _0x21ae=['userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','user','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Trunk','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','rawAttributes','find','clone','includeAll','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection'];(function(_0x1d17de,_0x11d049){var _0x58667d=function(_0x26aa43){while(--_0x26aa43){_0x1d17de['push'](_0x1d17de['shift']());}};_0x58667d(++_0x11d049);}(_0x21ae,0x1ca));var _0xe21a=function(_0x4ccc77,_0x28dde1){_0x4ccc77=_0x4ccc77-0x0;var _0x2db81c=_0x21ae[_0x4ccc77];return _0x2db81c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe21a('0x0'));var rimraf=require(_0xe21a('0x1'));var zipdir=require(_0xe21a('0x2'));var jsonpatch=require(_0xe21a('0x3'));var rp=require(_0xe21a('0x4'));var moment=require('moment');var BPromise=require(_0xe21a('0x5'));var Mustache=require(_0xe21a('0x6'));var util=require(_0xe21a('0x7'));var path=require(_0xe21a('0x8'));var sox=require(_0xe21a('0x9'));var csv=require('to-csv');var ejs=require(_0xe21a('0xa'));var fs=require('fs');var _=require(_0xe21a('0xb'));var squel=require(_0xe21a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe21a('0xd'));var Papa=require(_0xe21a('0xe'));var Redis=require(_0xe21a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe21a('0x10'));var logger=require(_0xe21a('0x11'))(_0xe21a('0x12'));var utils=require(_0xe21a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe21a('0x14'));var db=require(_0xe21a('0x15'))['db'];var jayson=require(_0xe21a('0x16'));var client=jayson[_0xe21a('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52a523,_0x1129f6,_0x1a741d,_0x1c31eb){return new BPromise(function(_0x50cd59,_0x40bd07){var _0x2a7b4a=_0x1c31eb||client;return _0x2a7b4a['request'](_0x52a523,_0x1a741d)['then'](function(_0x2c365a){logger[_0xe21a('0x18')](_0xe21a('0x19'),_0x1129f6,_0xe21a('0x1a'));logger[_0xe21a('0x1b')](_0xe21a('0x1c'),_0x1129f6,_0xe21a('0x1a'),JSON[_0xe21a('0x1d')](_0x2c365a));if(_0x2c365a[_0xe21a('0x1e')]){if(_0x2c365a['error'][_0xe21a('0x1f')]===0x1f4){logger[_0xe21a('0x1e')](_0xe21a('0x19'),_0x1129f6,_0x2c365a[_0xe21a('0x1e')][_0xe21a('0x20')]);return _0x40bd07(_0x2c365a[_0xe21a('0x1e')][_0xe21a('0x20')]);}logger[_0xe21a('0x1e')](_0xe21a('0x19'),_0x1129f6,_0x2c365a[_0xe21a('0x1e')]['message']);return _0x50cd59(_0x2c365a[_0xe21a('0x1e')][_0xe21a('0x20')]);}else{logger[_0xe21a('0x18')](_0xe21a('0x19'),_0x1129f6,_0xe21a('0x1a'));_0x50cd59(_0x2c365a[_0xe21a('0x21')][_0xe21a('0x20')]);}})[_0xe21a('0x22')](function(_0x109f8b){logger[_0xe21a('0x1e')](_0xe21a('0x19'),_0x1129f6,_0x109f8b);_0x40bd07(_0x109f8b);});});}function respondWithStatusCode(_0x4187e2,_0x17f6ee){_0x17f6ee=_0x17f6ee||0xcc;return function(_0x284994){if(_0x284994){return _0x4187e2[_0xe21a('0x23')](_0x17f6ee);}return _0x4187e2['status'](_0x17f6ee)[_0xe21a('0x24')]();};}function respondWithResult(_0x4b07da,_0xde8ecf){_0xde8ecf=_0xde8ecf||0xc8;return function(_0x1092f){if(_0x1092f){return _0x4b07da[_0xe21a('0x25')](_0xde8ecf)[_0xe21a('0x26')](_0x1092f);}};}function respondWithFilteredResult(_0x121356,_0x46f426){return function(_0x55b07b){if(_0x55b07b){var _0x3757b0=_0x55b07b['count'],_0x29fb77=_0x46f426[_0xe21a('0x27')],_0x35051b=_0x46f426['offset']+_0x46f426[_0xe21a('0x28')],_0xdb3795;if(_0x35051b>=_0x3757b0){_0x35051b=_0x3757b0;_0xdb3795=0xc8;}else{_0xdb3795=0xce;}_0x121356[_0xe21a('0x25')](_0xdb3795);return _0x121356[_0xe21a('0x29')](_0xe21a('0x2a'),_0x29fb77+'-'+_0x35051b+'/'+_0x3757b0)[_0xe21a('0x26')](_0x55b07b);}return null;};}function patchUpdates(_0x1856f1){return function(_0x3d3aed){try{jsonpatch['apply'](_0x3d3aed,_0x1856f1,!![]);}catch(_0x1c6b0f){return BPromise[_0xe21a('0x2b')](_0x1c6b0f);}return _0x3d3aed['save']();};}function saveUpdates(_0x5e4dd1,_0x2600c0){return function(_0x5b7d69){if(_0x5b7d69){return _0x5b7d69[_0xe21a('0x2c')](_0x5e4dd1)[_0xe21a('0x2d')](function(_0x77e8c5){return _0x77e8c5;});}return null;};}function removeEntity(_0x4b9a80,_0x32d752){return function(_0x4b1695){if(_0x4b1695){return _0x4b1695[_0xe21a('0x2e')]()[_0xe21a('0x2d')](function(){var _0x10a601=_0x4b1695[_0xe21a('0x2f')]({'plain':!![]});var _0x4d872f='Trunks';return db[_0xe21a('0x30')][_0xe21a('0x2e')]({'where':{'type':_0x4d872f,'resourceId':_0x10a601['id']}})[_0xe21a('0x2d')](function(){return _0x4b1695;});})[_0xe21a('0x2d')](function(){_0x4b9a80[_0xe21a('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dae0,_0x2a7ccc){return function(_0x4eac71){if(!_0x4eac71){_0x40dae0['sendStatus'](0x194);}return _0x4eac71;};}function handleError(_0x4a9979,_0x524c90){_0x524c90=_0x524c90||0x1f4;return function(_0x4fd491){logger['error'](_0x4fd491[_0xe21a('0x31')]);if(_0x4fd491[_0xe21a('0x32')]){delete _0x4fd491[_0xe21a('0x32')];}_0x4a9979[_0xe21a('0x25')](_0x524c90)[_0xe21a('0x33')](_0x4fd491);};}exports[_0xe21a('0x34')]=function(_0x4a7725,_0x433e85){var _0x43f724={},_0x195ee5={},_0x3309e4={'count':0x0,'rows':[]};var _0x28b648=_[_0xe21a('0x35')](db[_0xe21a('0x36')]['rawAttributes'],function(_0x3d2616){return{'name':_0x3d2616[_0xe21a('0x37')],'type':_0x3d2616['type'][_0xe21a('0x38')]};});_0x195ee5[_0xe21a('0x39')]=_[_0xe21a('0x35')](_0x28b648,_0xe21a('0x32'));_0x195ee5[_0xe21a('0x3a')]=_[_0xe21a('0x3b')](_0x4a7725['query']);_0x195ee5[_0xe21a('0x3c')]=_[_0xe21a('0x3d')](_0x195ee5[_0xe21a('0x39')],_0x195ee5[_0xe21a('0x3a')]);_0x43f724[_0xe21a('0x3e')]=_[_0xe21a('0x3d')](_0x195ee5[_0xe21a('0x39')],qs[_0xe21a('0x3f')](_0x4a7725[_0xe21a('0x3a')]['fields']));_0x43f724['attributes']=_0x43f724[_0xe21a('0x3e')][_0xe21a('0x40')]?_0x43f724[_0xe21a('0x3e')]:_0x195ee5[_0xe21a('0x39')];if(!_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x41')](_0xe21a('0x42'))){_0x43f724['limit']=qs[_0xe21a('0x28')](_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x28')]);_0x43f724[_0xe21a('0x27')]=qs[_0xe21a('0x27')](_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x27')]);}_0x43f724[_0xe21a('0x43')]=qs['sort'](_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x44')]);_0x43f724[_0xe21a('0x45')]=qs[_0xe21a('0x3c')](_[_0xe21a('0x46')](_0x4a7725[_0xe21a('0x3a')],_0x195ee5[_0xe21a('0x3c')]),_0x28b648);if(_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x47')]){_0x43f724[_0xe21a('0x45')]=_[_0xe21a('0x48')](_0x43f724[_0xe21a('0x45')],{'$or':_[_0xe21a('0x35')](_0x28b648,function(_0x564ae9){if(_0x564ae9['type']!==_0xe21a('0x49')){var _0x30e06a={};_0x30e06a[_0x564ae9['name']]={'$like':'%'+_0x4a7725[_0xe21a('0x3a')][_0xe21a('0x47')]+'%'};return _0x30e06a;}})});}_0x43f724=_[_0xe21a('0x48')]({},_0x43f724,_0x4a7725[_0xe21a('0x4a')]);var _0x9b43a={'where':_0x43f724[_0xe21a('0x45')]};return db[_0xe21a('0x36')][_0xe21a('0x4b')](_0x9b43a)['then'](function(_0x54b319){_0x3309e4[_0xe21a('0x4b')]=_0x54b319;if(_0x4a7725[_0xe21a('0x3a')]['includeAll']){_0x43f724[_0xe21a('0x4c')]=[{'all':!![]}];}return db[_0xe21a('0x36')][_0xe21a('0x4d')](_0x43f724);})[_0xe21a('0x2d')](function(_0x4d689a){_0x3309e4[_0xe21a('0x4e')]=_0x4d689a;return _0x3309e4;})[_0xe21a('0x2d')](respondWithFilteredResult(_0x433e85,_0x43f724))[_0xe21a('0x22')](handleError(_0x433e85,null));};exports['show']=function(_0xb30089,_0x55d9aa){var _0x3bb92a={'raw':![],'where':{'id':_0xb30089[_0xe21a('0x4f')]['id']}},_0x3e4e1b={};_0x3e4e1b['model']=_['keys'](db[_0xe21a('0x36')][_0xe21a('0x50')]);_0x3e4e1b[_0xe21a('0x3a')]=_[_0xe21a('0x3b')](_0xb30089[_0xe21a('0x3a')]);_0x3e4e1b['filters']=_[_0xe21a('0x3d')](_0x3e4e1b[_0xe21a('0x39')],_0x3e4e1b[_0xe21a('0x3a')]);_0x3bb92a['attributes']=_[_0xe21a('0x3d')](_0x3e4e1b['model'],qs[_0xe21a('0x3f')](_0xb30089[_0xe21a('0x3a')][_0xe21a('0x3f')]));_0x3bb92a[_0xe21a('0x3e')]=_0x3bb92a['attributes'][_0xe21a('0x40')]?_0x3bb92a[_0xe21a('0x3e')]:_0x3e4e1b[_0xe21a('0x39')];if(_0xb30089[_0xe21a('0x3a')]['includeAll']){_0x3bb92a[_0xe21a('0x4c')]=[{'all':!![]}];}_0x3bb92a=_[_0xe21a('0x48')]({},_0x3bb92a,_0xb30089[_0xe21a('0x4a')]);return db[_0xe21a('0x36')][_0xe21a('0x51')](_0x3bb92a)['then'](handleEntityNotFound(_0x55d9aa,null))[_0xe21a('0x2d')](respondWithResult(_0x55d9aa,null))[_0xe21a('0x22')](handleError(_0x55d9aa,null));};exports[_0xe21a('0x52')]=function(_0xe73205,_0x4096af){var _0x12bb29={'where':{'id':_0xe73205[_0xe21a('0x4f')]['id']}},_0x8baca5={};_0x8baca5['model']=_[_0xe21a('0x3b')](db[_0xe21a('0x36')][_0xe21a('0x50')]);_0x12bb29['attributes']=_['intersection'](_0x8baca5[_0xe21a('0x39')],qs[_0xe21a('0x3f')](_0xe73205['query']['fields']));_0x12bb29[_0xe21a('0x3e')]=_0x12bb29[_0xe21a('0x3e')][_0xe21a('0x40')]?_0x12bb29[_0xe21a('0x3e')]:_0x8baca5[_0xe21a('0x39')];if(_0xe73205[_0xe21a('0x3a')][_0xe21a('0x53')]){_0x12bb29['include']=[{'all':!![]}];}_0x12bb29=_[_0xe21a('0x48')]({},_0x12bb29,_0xe73205['options']);return db['Trunk']['find'](_0x12bb29)[_0xe21a('0x2d')](handleEntityNotFound(_0x4096af,null))[_0xe21a('0x2d')](function(_0xe7fae4){if(_0xe7fae4){var _0xb517f0=_0xe7fae4[_0xe21a('0x2f')]({'plain':!![]});_0xb517f0=qs[_0xe21a('0x54')](_0xb517f0,['id',_0xe21a('0x55'),_0xe21a('0x56')]);_0xe73205[_0xe21a('0x57')]=_[_0xe21a('0x54')](_0xe73205[_0xe21a('0x57')],['id',_0xe21a('0x55'),_0xe21a('0x56')]);return db[_0xe21a('0x36')]['create'](_[_0xe21a('0x48')](_0xb517f0,_0xe73205[_0xe21a('0x57')]),{'include':_0xe73205[_0xe21a('0x3a')][_0xe21a('0x53')]?[{'all':!![]}]:undefined})[_0xe21a('0x2d')](function(_0x161f1a){var _0x2c66f8=_0xe73205['user'][_0xe21a('0x2f')]({'plain':!![]});if(!_0x2c66f8)throw new Error(_0xe21a('0x58'));if(_0x2c66f8[_0xe21a('0x59')]==='user'){var _0x55c457=_0x161f1a[_0xe21a('0x2f')]({'plain':!![]});var _0x11913a=_0xe21a('0x5a');return db[_0xe21a('0x5b')]['find']({'where':{'name':_0x11913a,'userProfileId':_0x2c66f8[_0xe21a('0x5c')]},'raw':!![]})['then'](function(_0x30db50){if(_0x30db50&&_0x30db50[_0xe21a('0x5d')]===0x0){return db['UserProfileResource'][_0xe21a('0x5e')]({'name':_0x55c457['name'],'resourceId':_0x55c457['id'],'type':_0x30db50[_0xe21a('0x32')],'sectionId':_0x30db50['id']},{})[_0xe21a('0x2d')](function(){return _0x161f1a;});}else{return _0x161f1a;}})['catch'](function(_0x59231b){logger[_0xe21a('0x1e')](_0xe21a('0x5f'),_0x59231b);throw _0x59231b;});}return _0x161f1a;});}})[_0xe21a('0x2d')](respondWithResult(_0x4096af,0xc9))[_0xe21a('0x22')](handleError(_0x4096af,null));};exports[_0xe21a('0x5e')]=function(_0x1a42a1,_0xab13df,_0x8ac769){var _0x249194;return db[_0xe21a('0x36')]['create'](_0x1a42a1[_0xe21a('0x57')],{'raw':!![]})['then'](function(_0x214c85){_0x249194=_0x214c85;return db[_0xe21a('0x36')][_0xe21a('0x4d')]({'raw':!![]});})['then'](function(_0x4d185b){var _0x4fac6d=fs[_0xe21a('0x60')](path[_0xe21a('0x61')](config[_0xe21a('0x62')],_0xe21a('0x63')),_0xe21a('0x64'));var _0x37295e=fs[_0xe21a('0x60')](path['join'](config[_0xe21a('0x62')],_0xe21a('0x65')),_0xe21a('0x64'));var _0x16f9a0=ejs['render'](_0x4fac6d,{'trunks':_0x4d185b||[]});fs[_0xe21a('0x66')](_0xe21a('0x67'),_0x16f9a0);if(_0x249194[_0xe21a('0x68')]){var _0x523dc3=ejs[_0xe21a('0x69')](_0x37295e,{'trunks':_0x4d185b||[]});fs[_0xe21a('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x523dc3);}})[_0xe21a('0x2d')](function(){return respondWithRpcPromise(_0xe21a('0x6a'),'create',{'module':_0xe21a('0x6b')});})['then'](function(){var _0x548404=_0x1a42a1[_0xe21a('0x6c')][_0xe21a('0x2f')]({'plain':!![]});if(!_0x548404)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548404[_0xe21a('0x59')]===_0xe21a('0x6c')){var _0x4ee626=_0x249194[_0xe21a('0x2f')]({'plain':!![]});return db[_0xe21a('0x5b')][_0xe21a('0x51')]({'where':{'name':'Trunks','userProfileId':_0x548404['userProfileId']},'raw':!![]})[_0xe21a('0x2d')](function(_0x55e320){if(_0x55e320&&_0x55e320['autoAssociation']===0x0){return db[_0xe21a('0x30')][_0xe21a('0x5e')]({'name':_0x4ee626[_0xe21a('0x32')],'resourceId':_0x4ee626['id'],'type':_0x55e320[_0xe21a('0x32')],'sectionId':_0x55e320['id']},{})[_0xe21a('0x2d')](function(){return _0x249194;});}else{return _0x249194;}})[_0xe21a('0x22')](function(_0x297332){logger[_0xe21a('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x297332);throw _0x297332;});}return _0x249194;})[_0xe21a('0x2d')](respondWithResult(_0xab13df,0xc9))[_0xe21a('0x22')](handleError(_0xab13df,null));};exports[_0xe21a('0x2c')]=function(_0xd66430,_0x245618,_0xa4a776){var _0x37bd34;return db[_0xe21a('0x36')][_0xe21a('0x51')]({'where':{'id':_0xd66430['params']['id']}})['then'](handleEntityNotFound(_0x245618,null))['then'](saveUpdates(_0xd66430[_0xe21a('0x57')],null))[_0xe21a('0x2d')](function(_0x36b6d8){if(_0x36b6d8){_0x37bd34=_0x36b6d8;return db[_0xe21a('0x36')][_0xe21a('0x4d')]({'raw':!![]});}})[_0xe21a('0x2d')](function(_0x47bb37){if(_0x47bb37){var _0x19833d=fs[_0xe21a('0x60')](path[_0xe21a('0x61')](config['root'],_0xe21a('0x63')),_0xe21a('0x64'));var _0x12362a=fs[_0xe21a('0x60')](path[_0xe21a('0x61')](config[_0xe21a('0x62')],'server/files/templates/registry.ejs'),_0xe21a('0x64'));var _0x3f008d=ejs[_0xe21a('0x69')](_0x19833d,{'trunks':_0x47bb37||[]});fs[_0xe21a('0x66')](_0xe21a('0x67'),_0x3f008d);var _0x5931d4=ejs[_0xe21a('0x69')](_0x12362a,{'trunks':_0x47bb37||[]});fs[_0xe21a('0x66')](_0xe21a('0x6d'),_0x5931d4);return respondWithRpcPromise(_0xe21a('0x6a'),'update',{'module':_0xe21a('0x6b')});}return null;})[_0xe21a('0x2d')](function(_0x3cb448){if(_0x3cb448){return _0x37bd34;}})[_0xe21a('0x2d')](respondWithResult(_0x245618,null))[_0xe21a('0x22')](handleError(_0x245618,null));};exports[_0xe21a('0x2e')]=function(_0x12daa4,_0xc0811c,_0x30081f){var _0x38421a;return db[_0xe21a('0x36')][_0xe21a('0x51')]({'where':{'id':_0x12daa4[_0xe21a('0x4f')]['id']}})[_0xe21a('0x2d')](handleEntityNotFound(_0xc0811c,null))[_0xe21a('0x2d')](removeEntity(_0xc0811c,null))['then'](function(){return db[_0xe21a('0x36')][_0xe21a('0x4d')]({'raw':!![]});})[_0xe21a('0x2d')](function(_0x1839c8){var _0x298b5d=fs[_0xe21a('0x60')](path[_0xe21a('0x61')](config[_0xe21a('0x62')],_0xe21a('0x63')),_0xe21a('0x64'));var _0x80d55d=fs[_0xe21a('0x60')](path[_0xe21a('0x61')](config['root'],_0xe21a('0x65')),_0xe21a('0x64'));var _0x4980b5=ejs[_0xe21a('0x69')](_0x298b5d,{'trunks':_0x1839c8});var _0x201dcf=ejs[_0xe21a('0x69')](_0x80d55d,{'trunks':_0x1839c8});fs[_0xe21a('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4980b5);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x201dcf);return respondWithRpcPromise(_0xe21a('0x6a'),_0xe21a('0x2e'),{'module':_0xe21a('0x6b')});})[_0xe21a('0x22')](handleError(_0xc0811c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2551bd7..52e5395 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 _0x1d56=['define','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./trunk.attributes','exports'];(function(_0x5f36df,_0x2ee1a7){var _0x4f233d=function(_0x30d08c){while(--_0x30d08c){_0x5f36df['push'](_0x5f36df['shift']());}};_0x4f233d(++_0x2ee1a7);}(_0x1d56,0x15e));var _0x61d5=function(_0x2101f6,_0x4489de){_0x2101f6=_0x2101f6-0x0;var _0x5a8319=_0x1d56[_0x2101f6];return _0x5a8319;};'use strict';var _=require(_0x61d5('0x0'));var util=require(_0x61d5('0x1'));var logger=require(_0x61d5('0x2'))(_0x61d5('0x3'));var moment=require(_0x61d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x61d5('0x5'));var fs=require('fs');var path=require(_0x61d5('0x6'));var rimraf=require(_0x61d5('0x7'));var config=require('../../config/environment');var attributes=require(_0x61d5('0x8'));module[_0x61d5('0x9')]=function(_0x20b7c6,_0x36b134){return _0x20b7c6[_0x61d5('0xa')]('Trunk',attributes,{'tableName':_0x61d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x422b=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x422b,0x8c));var _0xb422=function(_0x4aa8a8,_0x2e43c6){_0x4aa8a8=_0x4aa8a8-0x0;var _0x57f0eb=_0x422b[_0x4aa8a8];return _0x57f0eb;};'use strict';var _=require(_0xb422('0x0'));var util=require(_0xb422('0x1'));var logger=require(_0xb422('0x2'))(_0xb422('0x3'));var moment=require('moment');var BPromise=require(_0xb422('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb422('0x5'));var rimraf=require(_0xb422('0x6'));var config=require(_0xb422('0x7'));var attributes=require(_0xb422('0x8'));module['exports']=function(_0xb71a20,_0x4aa0a3){return _0xb71a20[_0xb422('0x9')](_0xb422('0xa'),attributes,{'tableName':_0xb422('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 93dba16..c7ee0cc 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(_0x127a7c,_0x439ba0){var _0x4ee734=function(_0xc12b34){while(--_0xc12b34){_0x127a7c['push'](_0x127a7c['shift']());}};_0x4ee734(++_0x439ba0);}(_0x2032,0xd9));var _0x2203=function(_0x4ddbe2,_0x3e1599){_0x4ddbe2=_0x4ddbe2-0x0;var _0x44fd77=_0x2032[_0x4ddbe2];return _0x44fd77;};'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 _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x41d3df,_0x5aae97){var _0x4a8684=function(_0x56b24b){while(--_0x56b24b){_0x41d3df['push'](_0x41d3df['shift']());}};_0x4a8684(++_0x5aae97);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'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')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cadb1d3..185e5e2 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 _0x0632=['put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','root','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','update'];(function(_0x2ba4ed,_0x3fd1ed){var _0x5b27fc=function(_0xa2b1c){while(--_0xa2b1c){_0x2ba4ed['push'](_0x2ba4ed['shift']());}};_0x5b27fc(++_0x3fd1ed);}(_0x0632,0x7f));var _0x2063=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x0632[_0x46cf00];return _0x3974dc;};'use strict';var multer=require(_0x2063('0x0'));var util=require('util');var path=require(_0x2063('0x1'));var timeout=require(_0x2063('0x2'));var express=require(_0x2063('0x3'));var router=express[_0x2063('0x4')]();var auth=require(_0x2063('0x5'));var interaction=require(_0x2063('0x6'));var config=require(_0x2063('0x7'));var controller=require(_0x2063('0x8'));router[_0x2063('0x9')]('/',auth[_0x2063('0xa')](),controller['index']);router[_0x2063('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x2063('0xb')]);router[_0x2063('0x9')](_0x2063('0xc'),auth[_0x2063('0xa')](),controller['whoami']);router[_0x2063('0x9')]('/presence',auth[_0x2063('0xa')](),controller[_0x2063('0xd')]);router[_0x2063('0x9')](_0x2063('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2063('0x9')](_0x2063('0xf'),controller[_0x2063('0x10')]);router['get'](_0x2063('0x11'),auth[_0x2063('0xa')](),controller['getContacts']);router[_0x2063('0x9')](_0x2063('0x12'),auth[_0x2063('0xa')](),controller[_0x2063('0x13')]);router[_0x2063('0x9')](_0x2063('0x14'),auth[_0x2063('0xa')](),controller['getVoiceQueuesRt']);router[_0x2063('0x9')]('/:id/groups',auth[_0x2063('0xa')](),controller['getGroups']);router[_0x2063('0x9')]('/:id/recordings',auth[_0x2063('0xa')](),controller[_0x2063('0x15')]);router['get'](_0x2063('0x16'),auth[_0x2063('0xa')](),controller[_0x2063('0x17')]);router['get']('/:id/chat/interactions',auth[_0x2063('0xa')](),controller['getChatInteractions']);router[_0x2063('0x9')](_0x2063('0x18'),auth[_0x2063('0xa')](),controller[_0x2063('0x19')]);router['get'](_0x2063('0x1a'),auth[_0x2063('0xa')](),controller['getMailInteractions']);router[_0x2063('0x9')]('/:id/sms/interactions',auth[_0x2063('0xa')](),controller[_0x2063('0x1b')]);router[_0x2063('0x9')](_0x2063('0x1c'),auth[_0x2063('0xa')](),controller[_0x2063('0x1d')]);router[_0x2063('0x9')](_0x2063('0x1e'),auth[_0x2063('0xa')](),controller['getWhatsappInteractions']);router[_0x2063('0x9')](_0x2063('0x1f'),auth[_0x2063('0xa')](),controller['getTeams']);router[_0x2063('0x9')](_0x2063('0x20'),auth[_0x2063('0xa')](),controller[_0x2063('0x21')]);router[_0x2063('0x9')]('/:id/agents',auth[_0x2063('0xa')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0x2063('0xa')](),controller[_0x2063('0x22')]);router[_0x2063('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2063('0x23')]);router['get'](_0x2063('0x24'),auth[_0x2063('0xa')](),controller[_0x2063('0x25')]);router['get']('/:id/openchannel_accounts',auth[_0x2063('0xa')](),controller[_0x2063('0x26')]);router['get']('/:id/sms_accounts',auth[_0x2063('0xa')](),controller[_0x2063('0x27')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x2063('0x9')]('/:id/whatsapp_accounts',auth[_0x2063('0xa')](),controller[_0x2063('0x28')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x2063('0x29')]);router[_0x2063('0x9')](_0x2063('0x2a'),auth[_0x2063('0xa')](),controller[_0x2063('0x2b')]);router[_0x2063('0x9')](_0x2063('0x2c'),auth['isAuthenticated'](),controller[_0x2063('0x2d')]);router[_0x2063('0x2e')]('/:id/contacts',auth[_0x2063('0xa')](),controller[_0x2063('0x2f')]);router[_0x2063('0x2e')]('/',auth[_0x2063('0xa')](),controller['create']);router['post'](_0x2063('0x30'),auth['isAuthenticated'](),controller[_0x2063('0x31')]);router[_0x2063('0x2e')](_0x2063('0x12'),auth[_0x2063('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2063('0x32')]({'destination':function(_0x4a34f9,_0x224104,_0x555163){_0x555163(null,path['join'](config[_0x2063('0x33')],'server/files/images/'));},'filename':function(_0x386a16,_0x371a96,_0x438771){_0x438771(null,util['format'](_0x2063('0x34'),Date[_0x2063('0x35')](),_0x371a96[_0x2063('0x36')]));}})});router[_0x2063('0x2e')](_0x2063('0xf'),upload[_0x2063('0x37')](_0x2063('0x38')),controller[_0x2063('0x39')]);router[_0x2063('0x2e')](_0x2063('0x3a'),auth[_0x2063('0xa')](),controller['login']);router[_0x2063('0x2e')](_0x2063('0x3b'),auth[_0x2063('0xa')](),controller[_0x2063('0x3c')]);router[_0x2063('0x2e')](_0x2063('0x3d'),auth[_0x2063('0xa')](),controller[_0x2063('0x3e')]);router[_0x2063('0x2e')](_0x2063('0x3f'),auth['isAuthenticated'](),controller[_0x2063('0x40')]);router[_0x2063('0x2e')](_0x2063('0x1f'),auth[_0x2063('0xa')](),controller['addTeams']);router['post'](_0x2063('0x41'),auth[_0x2063('0xa')](),controller[_0x2063('0x42')]);router[_0x2063('0x2e')](_0x2063('0x43'),auth[_0x2063('0xa')](),controller[_0x2063('0x44')]);router[_0x2063('0x2e')](_0x2063('0x45'),auth[_0x2063('0xa')](),controller[_0x2063('0x46')]);router[_0x2063('0x2e')](_0x2063('0x47'),auth[_0x2063('0xa')](),controller[_0x2063('0x48')]);router[_0x2063('0x2e')](_0x2063('0x49'),auth[_0x2063('0xa')](),controller[_0x2063('0x4a')]);router[_0x2063('0x2e')](_0x2063('0x4b'),auth[_0x2063('0xa')](),controller[_0x2063('0x4c')]);router['post'](_0x2063('0x4d'),auth[_0x2063('0xa')](),controller[_0x2063('0x4e')]);router[_0x2063('0x2e')](_0x2063('0x24'),auth[_0x2063('0xa')](),controller[_0x2063('0x4f')]);router['post'](_0x2063('0x50'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x2063('0x2e')](_0x2063('0x51'),auth[_0x2063('0xa')](),controller[_0x2063('0x52')]);router[_0x2063('0x2e')](_0x2063('0x53'),auth[_0x2063('0xa')](),controller[_0x2063('0x54')]);router['post'](_0x2063('0x55'),auth['isAuthenticated'](),controller[_0x2063('0x56')]);router[_0x2063('0x2e')](_0x2063('0x57'),auth[_0x2063('0xa')](),controller[_0x2063('0x58')]);router[_0x2063('0x2e')](_0x2063('0x2c'),auth[_0x2063('0xa')](),controller[_0x2063('0x59')]);router['put'](_0x2063('0xe'),auth[_0x2063('0xa')](),controller[_0x2063('0x5a')]);router[_0x2063('0x5b')](_0x2063('0x5c'),auth[_0x2063('0xa')](),controller[_0x2063('0x5d')]);router[_0x2063('0x5e')]('/:id/queues',auth[_0x2063('0xa')](),controller[_0x2063('0x5f')]);router[_0x2063('0x5e')](_0x2063('0x1f'),auth['isAuthenticated'](),controller[_0x2063('0x60')]);router['delete'](_0x2063('0xe'),auth[_0x2063('0xa')](),controller[_0x2063('0x61')]);router[_0x2063('0x5e')](_0x2063('0x41'),auth['isAuthenticated'](),controller[_0x2063('0x62')]);router['delete'](_0x2063('0x43'),auth[_0x2063('0xa')](),controller[_0x2063('0x63')]);router[_0x2063('0x5e')](_0x2063('0x45'),auth[_0x2063('0xa')](),controller[_0x2063('0x64')]);router[_0x2063('0x5e')](_0x2063('0x47'),auth[_0x2063('0xa')](),controller[_0x2063('0x65')]);router[_0x2063('0x5e')](_0x2063('0x49'),auth['isAuthenticated'](),controller[_0x2063('0x66')]);router[_0x2063('0x5e')](_0x2063('0x4b'),auth[_0x2063('0xa')](),controller[_0x2063('0x67')]);router[_0x2063('0x5e')](_0x2063('0x4d'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x2063('0x5e')](_0x2063('0x24'),auth[_0x2063('0xa')](),controller['removeMailAccounts']);router[_0x2063('0x5e')]('/:id/openchannel_accounts',auth[_0x2063('0xa')](),controller[_0x2063('0x68')]);router[_0x2063('0x5e')](_0x2063('0x51'),auth[_0x2063('0xa')](),controller[_0x2063('0x69')]);router['delete'](_0x2063('0x53'),auth[_0x2063('0xa')](),controller[_0x2063('0x6a')]);router[_0x2063('0x5e')](_0x2063('0x55'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x2063('0x5e')](_0x2063('0x57'),auth[_0x2063('0xa')](),controller['removeSquareProjects']);router[_0x2063('0x5e')](_0x2063('0x2c'),auth[_0x2063('0xa')](),controller[_0x2063('0x6b')]);module[_0x2063('0x6c')]=router; \ No newline at end of file +var _0x4b10=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','format','now','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','util'];(function(_0xa49674,_0x538aa4){var _0x3587c8=function(_0x49c3e8){while(--_0x49c3e8){_0xa49674['push'](_0xa49674['shift']());}};_0x3587c8(++_0x538aa4);}(_0x4b10,0xdd));var _0x04b1=function(_0xb8a14f,_0x442a67){_0xb8a14f=_0xb8a14f-0x0;var _0x5ca578=_0x4b10[_0xb8a14f];return _0x5ca578;};'use strict';var multer=require('multer');var util=require(_0x04b1('0x0'));var path=require(_0x04b1('0x1'));var timeout=require(_0x04b1('0x2'));var express=require(_0x04b1('0x3'));var router=express[_0x04b1('0x4')]();var auth=require(_0x04b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x04b1('0x6'));var controller=require(_0x04b1('0x7'));router['get']('/',auth[_0x04b1('0x8')](),controller[_0x04b1('0x9')]);router[_0x04b1('0xa')](_0x04b1('0xb'),auth['isAuthenticated'](),controller[_0x04b1('0xc')]);router[_0x04b1('0xa')](_0x04b1('0xd'),auth[_0x04b1('0x8')](),controller[_0x04b1('0xe')]);router['get'](_0x04b1('0xf'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x10')]);router['get']('/:id',auth[_0x04b1('0x8')](),controller['show']);router['get'](_0x04b1('0x11'),controller[_0x04b1('0x12')]);router[_0x04b1('0xa')](_0x04b1('0x13'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x14')]);router[_0x04b1('0xa')]('/:id/queues',auth[_0x04b1('0x8')](),controller[_0x04b1('0x15')]);router[_0x04b1('0xa')](_0x04b1('0x16'),auth[_0x04b1('0x8')](),controller['getVoiceQueuesRt']);router[_0x04b1('0xa')](_0x04b1('0x17'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x18')]);router[_0x04b1('0xa')]('/:id/recordings',auth[_0x04b1('0x8')](),controller[_0x04b1('0x19')]);router['get'](_0x04b1('0x1a'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x1b')]);router[_0x04b1('0xa')](_0x04b1('0x1c'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x1d')]);router[_0x04b1('0xa')]('/:id/openchannel/interactions',auth[_0x04b1('0x8')](),controller[_0x04b1('0x1e')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x04b1('0x1f')]);router[_0x04b1('0xa')](_0x04b1('0x20'),auth['isAuthenticated'](),controller[_0x04b1('0x21')]);router['get'](_0x04b1('0x22'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x23')]);router[_0x04b1('0xa')](_0x04b1('0x24'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x25')]);router[_0x04b1('0xa')]('/:id/teams',auth[_0x04b1('0x8')](),controller[_0x04b1('0x26')]);router[_0x04b1('0xa')](_0x04b1('0x27'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x28')]);router[_0x04b1('0xa')]('/:id/agents',auth[_0x04b1('0x8')](),controller[_0x04b1('0x29')]);router[_0x04b1('0xa')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x04b1('0x2a')]);router[_0x04b1('0xa')](_0x04b1('0x2b'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x2c')]);router['get'](_0x04b1('0x2d'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x2e')]);router[_0x04b1('0xa')](_0x04b1('0x2f'),auth[_0x04b1('0x8')](),controller['getOpenchannelAccounts']);router[_0x04b1('0xa')](_0x04b1('0x30'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x31')]);router[_0x04b1('0xa')]('/:id/chat_websites',auth[_0x04b1('0x8')](),controller[_0x04b1('0x32')]);router[_0x04b1('0xa')](_0x04b1('0x33'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x04b1('0xa')]('/:id/square_projects',auth[_0x04b1('0x8')](),controller[_0x04b1('0x34')]);router['get'](_0x04b1('0x35'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x36')]);router[_0x04b1('0xa')](_0x04b1('0x37'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x04b1('0x38')]('/:id/contacts',auth[_0x04b1('0x8')](),controller[_0x04b1('0x39')]);router[_0x04b1('0x38')]('/',auth[_0x04b1('0x8')](),controller['create']);router['post'](_0x04b1('0x3a'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x3b')]);router[_0x04b1('0x38')](_0x04b1('0x3c'),auth['isAuthenticated'](),controller[_0x04b1('0x3d')]);var upload=multer({'storage':multer[_0x04b1('0x3e')]({'destination':function(_0x535cf3,_0xeeeac1,_0x3cf797){_0x3cf797(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x2b6b7c,_0x5e8e88,_0x17ee2b){_0x17ee2b(null,util[_0x04b1('0x3f')]('%s-%s',Date[_0x04b1('0x40')](),_0x5e8e88['originalname']));}})});router[_0x04b1('0x38')](_0x04b1('0x11'),upload[_0x04b1('0x41')](_0x04b1('0x42')),controller['addAvatar']);router[_0x04b1('0x38')](_0x04b1('0x43'),auth['isAuthenticated'](),controller[_0x04b1('0x44')]);router[_0x04b1('0x38')](_0x04b1('0x45'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x46')]);router['post'](_0x04b1('0x47'),auth['isAuthenticated'](),controller['pause']);router['post']('/:id/unpause',auth[_0x04b1('0x8')](),controller['unpause']);router['post']('/:id/teams',auth[_0x04b1('0x8')](),controller[_0x04b1('0x48')]);router['post']('/:id/chat_interactions',auth[_0x04b1('0x8')](),controller[_0x04b1('0x49')]);router['post'](_0x04b1('0x4a'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x4b')]);router[_0x04b1('0x38')](_0x04b1('0x4c'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x4d')]);router[_0x04b1('0x38')](_0x04b1('0x4e'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x4f')]);router[_0x04b1('0x38')](_0x04b1('0x50'),auth['isAuthenticated'](),controller[_0x04b1('0x51')]);router[_0x04b1('0x38')]('/:id/whatsapp_interactions',auth[_0x04b1('0x8')](),controller[_0x04b1('0x52')]);router[_0x04b1('0x38')](_0x04b1('0x2b'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x53')]);router['post'](_0x04b1('0x2d'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x54')]);router[_0x04b1('0x38')](_0x04b1('0x2f'),auth[_0x04b1('0x8')](),controller['addOpenchannelAccounts']);router[_0x04b1('0x38')]('/:id/sms_accounts',auth[_0x04b1('0x8')](),controller[_0x04b1('0x55')]);router[_0x04b1('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x04b1('0x56')]);router[_0x04b1('0x38')](_0x04b1('0x33'),auth['isAuthenticated'](),controller[_0x04b1('0x57')]);router['post'](_0x04b1('0x58'),auth['isAuthenticated'](),controller[_0x04b1('0x59')]);router[_0x04b1('0x38')](_0x04b1('0x37'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x5a')]);router[_0x04b1('0x5b')](_0x04b1('0x5c'),auth['isAuthenticated'](),controller[_0x04b1('0x5d')]);router[_0x04b1('0x5b')](_0x04b1('0x5e'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x5f')]);router[_0x04b1('0x60')](_0x04b1('0x3c'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x61')]);router[_0x04b1('0x60')]('/:id/teams',auth[_0x04b1('0x8')](),controller['removeTeams']);router[_0x04b1('0x60')]('/:id',auth['isAuthenticated'](),controller[_0x04b1('0x62')]);router[_0x04b1('0x60')](_0x04b1('0x63'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x64')]);router[_0x04b1('0x60')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x04b1('0x65')]);router[_0x04b1('0x60')]('/:id/sms_interactions',auth[_0x04b1('0x8')](),controller[_0x04b1('0x66')]);router['delete'](_0x04b1('0x50'),auth['isAuthenticated'](),controller[_0x04b1('0x67')]);router[_0x04b1('0x60')](_0x04b1('0x68'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x69')]);router[_0x04b1('0x60')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x04b1('0x6a')]);router['delete'](_0x04b1('0x2d'),auth[_0x04b1('0x8')](),controller['removeMailAccounts']);router[_0x04b1('0x60')](_0x04b1('0x2f'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x6b')]);router[_0x04b1('0x60')](_0x04b1('0x30'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x6c')]);router[_0x04b1('0x60')](_0x04b1('0x6d'),auth[_0x04b1('0x8')](),controller[_0x04b1('0x6e')]);router[_0x04b1('0x60')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0x04b1('0x58'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x04b1('0x60')]('/:id/api_key',auth[_0x04b1('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5ba116b..c085fa7 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 _0xfd2e=['inband','nonat','update','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','active','passive','actpass','update,nonat','get','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','telephone','local','accountcode','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x271dc9,_0x5c1711){var _0x4019de=function(_0x142a25){while(--_0x142a25){_0x271dc9['push'](_0x271dc9['shift']());}};_0x4019de(++_0x5c1711);}(_0xfd2e,0x8b));var _0xefd2=function(_0x54bbd0,_0x4cc8a8){_0x54bbd0=_0x54bbd0-0x0;var _0x1b9a03=_0xfd2e[_0x54bbd0];return _0x1b9a03;};'use strict';var Sequelize=require(_0xefd2('0x0'));var moment=require('moment');var util=require(_0xefd2('0x1'));var _=require('lodash');module[_0xefd2('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xefd2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2cbc93){this[_0xefd2('0x4')](_0xefd2('0x3'),_0x2cbc93);this['setDataValue'](_0xefd2('0x5'),_0x2cbc93);},'comment':_0xefd2('0x6')},'fullname':{'type':Sequelize[_0xefd2('0x7')],'allowNull':![],'set':function(_0x5455a9){this['setDataValue'](_0xefd2('0x8'),_0x5455a9);this[_0xefd2('0x4')]('callerid',util[_0xefd2('0x9')](_0xefd2('0xa'),_0x5455a9,this['getDataValue'](_0xefd2('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xefd2('0x7')],'allowNull':![],'unique':_0xefd2('0xc'),'validate':{'isEmail':!![]},'set':function(_0x513b79){if(_0x513b79){this[_0xefd2('0x4')](_0xefd2('0xc'),_0x513b79['toLowerCase']());}}},'role':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0xe'),_0xefd2('0xf'),'agent',_0xefd2('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xefd2('0x7')],'defaultValue':_0xefd2('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xefd2('0xb'),'set':function(_0x28f168){this['setDataValue']('internal',_0x28f168);this[_0xefd2('0x4')](_0xefd2('0x12'),_0x28f168);this[_0xefd2('0x4')](_0xefd2('0x13'),util[_0xefd2('0x9')](_0xefd2('0xa'),this[_0xefd2('0x14')](_0xefd2('0x8')),_0x28f168));}},'salt':{'type':Sequelize[_0xefd2('0x7')]},'phone':{'type':Sequelize[_0xefd2('0x7')]},'mobile':{'type':Sequelize[_0xefd2('0x7')]},'address':{'type':Sequelize[_0xefd2('0x7')]},'zipcode':{'type':Sequelize[_0xefd2('0x7')]},'userpic':{'type':Sequelize[_0xefd2('0x7')]},'city':{'type':Sequelize[_0xefd2('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xefd2('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xefd2('0x7')],'defaultValue':_0xefd2('0x17')},'lastPauseAt':{'type':Sequelize[_0xefd2('0x16')]},'chatCapacity':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xefd2('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![],'defaultValue':_0xefd2('0x19')},'ipaddr':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xefd2('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x1a'),_0xefd2('0xf'),'peer'),'allowNull':!![],'defaultValue':_0xefd2('0x1a')},'context':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![],'defaultValue':_0xefd2('0x1b')},'callingpres':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x1c'),_0xefd2('0x1d'),_0xefd2('0x1e'),_0xefd2('0x1f'),_0xefd2('0x20'),_0xefd2('0x21'),_0xefd2('0x22'),_0xefd2('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xefd2('0x24'),'set':function(_0x51f093){this[_0xefd2('0x4')](_0xefd2('0x25'),_0x51f093?_0x51f093[_0xefd2('0x26')](','):null);},'get':function(){return this[_0xefd2('0x14')]('transport')?this[_0xefd2('0x14')](_0xefd2('0x25'))['split'](','):null;},'comment':_0xefd2('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xefd2('0x28'),'info','shortinfo',_0xefd2('0x29'),'auto'),'allowNull':!![],'defaultValue':_0xefd2('0x28')},'directmedia':{'type':Sequelize[_0xefd2('0xd')]('yes','no',_0xefd2('0x2a'),_0xefd2('0x2b'),_0xefd2('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![],'defaultValue':_0xefd2('0x2e'),'set':function(_0x2b5dd1){this[_0xefd2('0x4')](_0xefd2('0x2f'),_0x2b5dd1?_0x2b5dd1['join'](','):null);},'get':function(){return this[_0xefd2('0x14')](_0xefd2('0x2f'))?this[_0xefd2('0x14')]('nat')[_0xefd2('0x30')](','):null;},'comment':_0xefd2('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xefd2('0x7')]},'pickupgroup':{'type':Sequelize[_0xefd2('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xefd2('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xefd2('0x7')]},'disallow':{'type':Sequelize[_0xefd2('0x7')],'allowNull':![],'defaultValue':_0xefd2('0x32')},'allow':{'type':Sequelize[_0xefd2('0x7')],'allowNull':![],'defaultValue':_0xefd2('0x33'),'set':function(_0x75250b){this[_0xefd2('0x4')](_0xefd2('0x34'),_0x75250b?_0x75250b['join'](';'):_0xefd2('0x33'));},'get':function(){return this['getDataValue'](_0xefd2('0x34'))?this[_0xefd2('0x14')](_0xefd2('0x34'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2f6f1b){this[_0xefd2('0x4')]('insecure',_0x2f6f1b?_0x2f6f1b[_0xefd2('0x26')](','):null);},'get':function(){return this[_0xefd2('0x14')](_0xefd2('0x35'))?this['getDataValue'](_0xefd2('0x35'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xefd2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![],'defaultValue':_0xefd2('0x36')},'amaflags':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xefd2('0x2d')},'busylevel':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xefd2('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xefd2('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xefd2('0x2d'),'no',_0xefd2('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x38'),_0xefd2('0x39'),_0xefd2('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xefd2('0xd')]('uac',_0xefd2('0x3b')),'allowNull':!![],'defaultValue':_0xefd2('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xefd2('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xefd2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xefd2('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xefd2('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no',_0xefd2('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xefd2('0x3d'),_0xefd2('0x3e'),_0xefd2('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xefd2('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xefd2('0xd')](_0xefd2('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xefd2('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xefd2('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xefd2('0x2a'),_0xefd2('0x2b'),_0xefd2('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xefd2('0x16')]},'passwordResetAt':{'type':Sequelize[_0xefd2('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x17403e){this[_0xefd2('0x4')]('showWebBar',_0x17403e);var _0x27249c=this[_0xefd2('0x41')]({'plain':!![]});switch(_0x17403e){case 0x0:case 0x1:var _0x5c28ab=_0x27249c[_0xefd2('0x25')]?_['isArray'](_0x27249c['transport'])?_0x27249c[_0xefd2('0x25')][_0xefd2('0x26')]():_0x27249c[_0xefd2('0x25')]:'udp';if(_0x5c28ab==='wss'){_0x5c28ab=_0xefd2('0x24');}this['setDataValue'](_0xefd2('0x25'),_0x5c28ab);this[_0xefd2('0x4')](_0xefd2('0x42'),'no');this[_0xefd2('0x4')](_0xefd2('0x43'),null);this[_0xefd2('0x4')](_0xefd2('0x44'),null);this[_0xefd2('0x4')](_0xefd2('0x45'),null);this[_0xefd2('0x4')]('dtlsenable',null);this['setDataValue'](_0xefd2('0x46'),null);this['setDataValue'](_0xefd2('0x47'),null);this[_0xefd2('0x4')](_0xefd2('0x48'),null);this[_0xefd2('0x4')](_0xefd2('0x49'),null);this['setDataValue'](_0xefd2('0x4a'),'no');break;case 0x2:this[_0xefd2('0x4')](_0xefd2('0x25'),_0xefd2('0x4b'));this[_0xefd2('0x4')](_0xefd2('0x42'),'yes');this[_0xefd2('0x4')](_0xefd2('0x43'),'yes');this[_0xefd2('0x4')]('force_avp',_0xefd2('0x2d'));this[_0xefd2('0x4')](_0xefd2('0x45'),_0xefd2('0x2d'));this[_0xefd2('0x4')](_0xefd2('0x4c'),_0xefd2('0x2d'));this[_0xefd2('0x4')](_0xefd2('0x46'),'no');this[_0xefd2('0x4')](_0xefd2('0x47'),_0xefd2('0x3f'));this[_0xefd2('0x4')]('dtlscertfile',_0x27249c['dtlscertfile']||_0xefd2('0x4d'));this[_0xefd2('0x4')]('dtlsprivatekey',_0x27249c[_0xefd2('0x49')]||_0xefd2('0x4e'));this[_0xefd2('0x4')](_0xefd2('0x4a'),_0xefd2('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xefd2('0x4f')],'set':function(_0x5a5c87){this[_0xefd2('0x4')]('permissions',_0x5a5c87?_0x5a5c87[_0xefd2('0x26')](','):[]);},'get':function(){return this[_0xefd2('0x14')](_0xefd2('0x50'))?_[_0xefd2('0x51')](this[_0xefd2('0x14')]('permissions')[_0xefd2('0x30')](','),function(_0x315a69){return parseInt(_0x315a69,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xefd2('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xefd2('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0xefd2('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xefd2('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xefd2('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xefd2('0x7')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xefd2('0x52')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xefd2('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xefd2('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![],'set':function(_0x3a4e64){if(typeof _0x3a4e64===_0xefd2('0x53')){var _0xfca5c2=_0x3a4e64==='1'?!![]:_0x3a4e64==='0'?![]:_0x3a4e64===_0xefd2('0x54')?!![]:_0x3a4e64===_0xefd2('0x55')?![]:![];this[_0xefd2('0x4')]('screenrecording',_0xfca5c2);}else{this['setDataValue'](_0xefd2('0x56'),_0x3a4e64);}}},'blocked':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![],'set':function(_0xd0785){this[_0xefd2('0x4')](_0xefd2('0x57'),_0xd0785);if(_0xd0785===!![]){this[_0xefd2('0x4')]('blockedAt',moment());this[_0xefd2('0x4')](_0xefd2('0x58'),0x0);}else{this[_0xefd2('0x4')](_0xefd2('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xefd2('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xefd2('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xefd2('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0xadae=['TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','callerid','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','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]','never','always','fingerprint','certificate','passive','actpass','nonat','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','/etc/pki/tls/private/motion.key','rtcp_mux'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0xadae,0x68));var _0xeada=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xadae[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xeada('0x0'));var moment=require(_0xeada('0x1'));var util=require('util');var _=require(_0xeada('0x2'));module[_0xeada('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeada('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xc37274){this['setDataValue']('name',_0xc37274);this[_0xeada('0x5')](_0xeada('0x6'),_0xc37274);},'comment':_0xeada('0x7')},'fullname':{'type':Sequelize[_0xeada('0x8')],'allowNull':![],'set':function(_0x272666){this['setDataValue'](_0xeada('0x9'),_0x272666);this[_0xeada('0x5')]('callerid',util['format'](_0xeada('0xa'),_0x272666,this[_0xeada('0xb')](_0xeada('0xc'))));}},'alias':{'type':Sequelize[_0xeada('0x8')]},'email':{'type':Sequelize[_0xeada('0x8')],'allowNull':![],'unique':_0xeada('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1661a4){if(_0x1661a4){this[_0xeada('0x5')](_0xeada('0xd'),_0x1661a4[_0xeada('0xe')]());}}},'role':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x10'),_0xeada('0x11'),_0xeada('0x12'),_0xeada('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xeada('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xeada('0x8')],'defaultValue':_0xeada('0x14')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xeada('0xc'),'set':function(_0x3ab5da){this['setDataValue'](_0xeada('0xc'),_0x3ab5da);this[_0xeada('0x5')]('accountcode',_0x3ab5da);this[_0xeada('0x5')](_0xeada('0x15'),util[_0xeada('0x16')](_0xeada('0xa'),this[_0xeada('0xb')](_0xeada('0x9')),_0x3ab5da));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xeada('0x8')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xeada('0x8')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xeada('0x8')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xeada('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xeada('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xeada('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xeada('0x1a')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xeada('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'defaultValue':_0xeada('0x1b')},'ipaddr':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x1c'),_0xeada('0x11'),_0xeada('0x1d')),'allowNull':!![],'defaultValue':_0xeada('0x1c')},'context':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xeada('0xf')]('ALLOWED_NOT_SCREENED',_0xeada('0x1e'),_0xeada('0x1f'),_0xeada('0x20'),_0xeada('0x21'),_0xeada('0x22'),_0xeada('0x23'),_0xeada('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'defaultValue':_0xeada('0x25'),'set':function(_0x25bda0){this[_0xeada('0x5')](_0xeada('0x26'),_0x25bda0?_0x25bda0[_0xeada('0x27')](','):null);},'get':function(){return this[_0xeada('0xb')](_0xeada('0x26'))?this[_0xeada('0xb')](_0xeada('0x26'))[_0xeada('0x28')](','):null;},'comment':_0xeada('0x29')},'dtmfmode':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2a'),_0xeada('0x2b'),_0xeada('0x2c'),_0xeada('0x2d'),_0xeada('0x2e')),'allowNull':!![],'defaultValue':_0xeada('0x2a')},'directmedia':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no','nonat',_0xeada('0x30'),_0xeada('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'defaultValue':_0xeada('0x32'),'set':function(_0x469aed){this[_0xeada('0x5')]('nat',_0x469aed?_0x469aed[_0xeada('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xeada('0x33'))?this[_0xeada('0xb')]('nat')[_0xeada('0x28')](','):null;},'comment':_0xeada('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xeada('0x8')]},'pickupgroup':{'type':Sequelize[_0xeada('0x8')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeada('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xeada('0x8')]},'disallow':{'type':Sequelize[_0xeada('0x8')],'allowNull':![],'defaultValue':_0xeada('0x35')},'allow':{'type':Sequelize[_0xeada('0x8')],'allowNull':![],'defaultValue':_0xeada('0x36'),'set':function(_0x414d75){this[_0xeada('0x5')]('allow',_0x414d75?_0x414d75['join'](';'):_0xeada('0x36'));},'get':function(){return this[_0xeada('0xb')](_0xeada('0x37'))?this[_0xeada('0xb')](_0xeada('0x37'))['split'](';'):null;},'comment':_0xeada('0x38')},'autoframing':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'set':function(_0x1989f0){this[_0xeada('0x5')](_0xeada('0x39'),_0x1989f0?_0x1989f0[_0xeada('0x27')](','):null);},'get':function(){return this[_0xeada('0xb')](_0xeada('0x39'))?this['getDataValue'](_0xeada('0x39'))['split'](','):null;},'comment':_0xeada('0x3a')},'trustrpid':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no',_0xeada('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':_0xeada('0x2f')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xeada('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no',_0xeada('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xeada('0xf')]('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xeada('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xeada('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no',_0xeada('0x3d'),_0xeada('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xeada('0xf')]('active',_0xeada('0x3f'),_0xeada('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xeada('0x1a')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xeada('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xeada('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xeada('0xf')]('yes','no',_0xeada('0x41'),_0xeada('0x30'),_0xeada('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xeada('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xeada('0x18')]},'passwordResetAt':{'type':Sequelize[_0xeada('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xeada('0x8')]},'showWebBar':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0,'set':function(_0x535db2){this['setDataValue'](_0xeada('0x43'),_0x535db2);var _0x21d6aa=this[_0xeada('0x44')]({'plain':!![]});switch(_0x535db2){case 0x0:case 0x1:var _0x39ca8c=_0x21d6aa[_0xeada('0x26')]?_[_0xeada('0x45')](_0x21d6aa[_0xeada('0x26')])?_0x21d6aa[_0xeada('0x26')][_0xeada('0x27')]():_0x21d6aa[_0xeada('0x26')]:'udp';if(_0x39ca8c===_0xeada('0x46')){_0x39ca8c=_0xeada('0x25');}this[_0xeada('0x5')](_0xeada('0x26'),_0x39ca8c);this[_0xeada('0x5')](_0xeada('0x47'),'no');this[_0xeada('0x5')](_0xeada('0x48'),null);this['setDataValue'](_0xeada('0x49'),null);this[_0xeada('0x5')](_0xeada('0x4a'),null);this['setDataValue']('dtlsenable',null);this[_0xeada('0x5')](_0xeada('0x4b'),null);this['setDataValue'](_0xeada('0x4c'),null);this[_0xeada('0x5')](_0xeada('0x4d'),null);this[_0xeada('0x5')](_0xeada('0x4e'),null);this[_0xeada('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xeada('0x5')]('transport',_0xeada('0x46'));this[_0xeada('0x5')](_0xeada('0x47'),_0xeada('0x2f'));this['setDataValue'](_0xeada('0x48'),'yes');this[_0xeada('0x5')](_0xeada('0x49'),_0xeada('0x2f'));this[_0xeada('0x5')]('icesupport',_0xeada('0x2f'));this['setDataValue'](_0xeada('0x4f'),_0xeada('0x2f'));this[_0xeada('0x5')]('dtlsverify','no');this['setDataValue'](_0xeada('0x4c'),_0xeada('0x40'));this['setDataValue'](_0xeada('0x4d'),_0x21d6aa['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xeada('0x5')](_0xeada('0x4e'),_0x21d6aa[_0xeada('0x4e')]||_0xeada('0x50'));this[_0xeada('0x5')](_0xeada('0x51'),_0xeada('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0xeada('0x52')],'set':function(_0x51c07a){this['setDataValue'](_0xeada('0x53'),_0x51c07a?_0x51c07a[_0xeada('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0xeada('0x53'))?_[_0xeada('0x54')](this[_0xeada('0xb')](_0xeada('0x53'))[_0xeada('0x28')](','),function(_0x3c6243){return parseInt(_0x3c6243,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xeada('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xeada('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0xeada('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xeada('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xeada('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xeada('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xeada('0xf')](_0xeada('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xeada('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xeada('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xeada('0x55')],'get':function(){return this[_0xeada('0xb')](_0xeada('0x56'))?this[_0xeada('0xb')](_0xeada('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xeada('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xeada('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x297b1f){if(typeof _0x297b1f===_0xeada('0x57')){var _0x2d246e=_0x297b1f==='1'?!![]:_0x297b1f==='0'?![]:_0x297b1f===_0xeada('0x58')?!![]:_0x297b1f===_0xeada('0x59')?![]:![];this[_0xeada('0x5')](_0xeada('0x5a'),_0x2d246e);}else{this[_0xeada('0x5')](_0xeada('0x5a'),_0x297b1f);}}},'blocked':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![],'set':function(_0x27d126){this[_0xeada('0x5')](_0xeada('0x5b'),_0x27d126);if(_0x27d126===!![]){this[_0xeada('0x5')]('blockedAt',moment());this[_0xeada('0x5')](_0xeada('0x5c'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xeada('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xeada('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xeada('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xeada('0x17')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7888f85..951bac2 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 _0xdcbb=['whoami','teams','queues','inbound','toString','asc','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','result','offline','idle','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','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','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','destroy','get','role','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','lower','sequelize','col','count','include','findAll','catch','params','model','options','update','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','permissions','101','103','113','110','104','105','106','107','108','109','100','111','114','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','checkUserLimits','settingsEnabled','userProfileId','create','bulkCreate','Unauthorized','some','push','all','each','UserProfileSection','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','penalty','spread','toLowerCase','emit','voice','VoiceQueue','interface','format','upsert','removeQueues','remove','UserVoiceQueueRt','addAvatar','userpic','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','root','getContacts','includeAll','CmList','Tags','color','tag','nolimit','getQueues','Queues','Unknown\x20role','Queue','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','rows','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','UserId','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','SIP/%s','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','fax','sms','whatsapp','%s%s','Pause','getTeams','addTeams','Team','Voice','getChatQueues','setDataValue','getMailQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','Queue:save','removeTeams','Mail','getSmsQueues','Sms','getWhatsappQueues','transaction','removeAgent','Queue:remove','getLists','getAgents','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','isArray','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$contains','$contained','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','createApiKey','generateApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available'];(function(_0x34e481,_0x1f0d05){var _0x195d01=function(_0x4e3fae){while(--_0x4e3fae){_0x34e481['push'](_0x34e481['shift']());}};_0x195d01(++_0x1f0d05);}(_0xdcbb,0x18c));var _0xbdcb=function(_0x44a92e,_0x508c0b){_0x44a92e=_0x44a92e-0x0;var _0x46fd9c=_0xdcbb[_0x44a92e];return _0x46fd9c;};'use strict';var pdf=require(_0xbdcb('0x0'));var emlformat=require(_0xbdcb('0x1'));var rimraf=require(_0xbdcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdcb('0x3'));var rp=require('request-promise');var moment=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbdcb('0x6'));var sox=require('sox');var csv=require(_0xbdcb('0x7'));var ejs=require(_0xbdcb('0x8'));var fs=require('fs');var _=require(_0xbdcb('0x9'));var squel=require(_0xbdcb('0xa'));var crypto=require(_0xbdcb('0xb'));var jsforce=require(_0xbdcb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbdcb('0x7'));var querystring=require(_0xbdcb('0xd'));var Papa=require(_0xbdcb('0xe'));var Redis=require(_0xbdcb('0xf'));var authService=require(_0xbdcb('0x10'));var qs=require(_0xbdcb('0x11'));var as=require(_0xbdcb('0x12'));var hardwareService=require(_0xbdcb('0x13'));var logger=require(_0xbdcb('0x14'))(_0xbdcb('0x15'));var utils=require(_0xbdcb('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbdcb('0x17'))['db'];config['redis']=_[_0xbdcb('0x18')](config[_0xbdcb('0x19')],{'host':_0xbdcb('0x1a'),'port':0x18eb});var socket=require(_0xbdcb('0x1b'))(new Redis(config[_0xbdcb('0x19')]));require('./user.socket')[_0xbdcb('0x1c')](socket);var jayson=require(_0xbdcb('0x1d'));var client=jayson['client'][_0xbdcb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x8827c2,_0xc2602c,_0x52cc5d,_0x5e1717){return new BPromise(function(_0x2d340c,_0x1b3e89){var _0x3b876b=_0x5e1717||client;return _0x3b876b[_0xbdcb('0x1f')](_0x8827c2,_0x52cc5d)[_0xbdcb('0x20')](function(_0x58389c){logger[_0xbdcb('0x21')](_0xbdcb('0x22'),_0xc2602c,_0xbdcb('0x23'));logger[_0xbdcb('0x24')](_0xbdcb('0x25'),_0xc2602c,_0xbdcb('0x23'),JSON[_0xbdcb('0x26')](_0x58389c));if(_0x58389c['error']){if(_0x58389c['error'][_0xbdcb('0x27')]===0x1f4){logger[_0xbdcb('0x28')](_0xbdcb('0x22'),_0xc2602c,_0x58389c['error'][_0xbdcb('0x29')]);return _0x1b3e89(_0x58389c['error'][_0xbdcb('0x29')]);}logger['error'](_0xbdcb('0x22'),_0xc2602c,_0x58389c[_0xbdcb('0x28')]['message']);return _0x2d340c(_0x58389c['error']['message']);}else{logger[_0xbdcb('0x21')]('User,\x20%s,\x20%s',_0xc2602c,_0xbdcb('0x23'));_0x2d340c(_0x58389c['result'][_0xbdcb('0x29')]);}})['catch'](function(_0x118b46){logger[_0xbdcb('0x28')](_0xbdcb('0x22'),_0xc2602c,_0x118b46);_0x1b3e89(_0x118b46);});});}function respondWithStatusCode(_0x232695,_0x10463f){_0x10463f=_0x10463f||0xcc;return function(_0x5d05dd){if(_0x5d05dd){return _0x232695[_0xbdcb('0x2a')](_0x10463f);}return _0x232695[_0xbdcb('0x2b')](_0x10463f)[_0xbdcb('0x2c')]();};}function respondWithResult(_0x16fea9,_0x2d42ae){_0x2d42ae=_0x2d42ae||0xc8;return function(_0x17471a){if(_0x17471a){return _0x16fea9[_0xbdcb('0x2b')](_0x2d42ae)['json'](_0x17471a);}};}function respondWithFilteredResult(_0x3cad7a,_0x2df571){return function(_0x8e02f3){if(_0x8e02f3){var _0x43a890=_0x8e02f3['count'],_0x3901ff=_0x2df571[_0xbdcb('0x2d')],_0x333b3f=_0x2df571[_0xbdcb('0x2d')]+_0x2df571[_0xbdcb('0x2e')],_0x46c047;if(_0x333b3f>=_0x43a890){_0x333b3f=_0x43a890;_0x46c047=0xc8;}else{_0x46c047=0xce;}_0x3cad7a[_0xbdcb('0x2b')](_0x46c047);return _0x3cad7a[_0xbdcb('0x2f')](_0xbdcb('0x30'),_0x3901ff+'-'+_0x333b3f+'/'+_0x43a890)[_0xbdcb('0x31')](_0x8e02f3);}return null;};}function patchUpdates(_0x7cdc44){return function(_0x121c34){try{jsonpatch[_0xbdcb('0x32')](_0x121c34,_0x7cdc44,!![]);}catch(_0x26832d){return BPromise['reject'](_0x26832d);}return _0x121c34[_0xbdcb('0x33')]();};}function saveUpdates(_0x250af1,_0x583662){return function(_0x3db0a2){if(_0x3db0a2){return _0x3db0a2['update'](_0x250af1)[_0xbdcb('0x20')](function(_0x2d151f){return _0x2d151f;});}return null;};}function removeEntity(_0x3296bb,_0x409b54){return function(_0x5d94dd){if(_0x5d94dd){return _0x5d94dd[_0xbdcb('0x34')]()[_0xbdcb('0x20')](function(){var _0x5135c0=_0x5d94dd[_0xbdcb('0x35')]({'plain':!![]});if(_0x5135c0[_0xbdcb('0x36')]==='admin')return;var _0x4cb878=[{'name':_0xbdcb('0x37'),'value':_0xbdcb('0x38'),'ignore':!![]},{'name':_0xbdcb('0x39'),'value':_0xbdcb('0x3a'),'ignore':![]},{'name':_0xbdcb('0x3b'),'value':_0xbdcb('0x3c'),'ignore':![]}];var _0x4fcef9=_(_0x4cb878)['filter'](_0xbdcb('0x3d'))[_0xbdcb('0x3e')]('value')[_0xbdcb('0x3f')]();if(_[_0xbdcb('0x40')](_0x4fcef9,_0x5135c0[_0xbdcb('0x36')])){return;}var _0x22e942=_[_0xbdcb('0x41')](_0x4cb878,[_0xbdcb('0x3f'),_0x5135c0[_0xbdcb('0x36')]])[_0xbdcb('0x42')];return db[_0xbdcb('0x43')][_0xbdcb('0x34')]({'where':{'type':_0x22e942,'resourceId':_0x5135c0['id']}})[_0xbdcb('0x20')](function(){return _0x5d94dd;});})['then'](function(){_0x3296bb[_0xbdcb('0x2b')](0xcc)[_0xbdcb('0x2c')]();});}};}function handleEntityNotFound(_0x1d8152,_0x3dd66d){return function(_0x2b4d20){if(!_0x2b4d20){_0x1d8152[_0xbdcb('0x2a')](0x194);}return _0x2b4d20;};}function handleError(_0x4b5cd6,_0x27d35c){_0x27d35c=_0x27d35c||0x1f4;return function(_0xc77d7a){logger[_0xbdcb('0x28')](_0xc77d7a[_0xbdcb('0x44')]);if(_0xc77d7a[_0xbdcb('0x42')]){delete _0xc77d7a[_0xbdcb('0x42')];}_0x4b5cd6[_0xbdcb('0x2b')](_0x27d35c)[_0xbdcb('0x45')](_0xc77d7a);};}exports[_0xbdcb('0x46')]=function(_0x556247,_0x342057){var _0x2a0037={},_0x5f16ef={},_0x5dbda1={'count':0x0,'rows':[]};var _0x29a707=_[_0xbdcb('0x3e')](db[_0xbdcb('0x47')][_0xbdcb('0x48')],function(_0x45ca92){return{'name':_0x45ca92[_0xbdcb('0x49')],'type':_0x45ca92['type']['key']};});_0x5f16ef['model']=_[_0xbdcb('0x4a')](_[_0xbdcb('0x3e')](_0x29a707,_0xbdcb('0x42')),[_0xbdcb('0x4b'),_0xbdcb('0x4c')]);_0x5f16ef[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x556247[_0xbdcb('0x4d')]);_0x5f16ef[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x5f16ef['model'],_0x5f16ef[_0xbdcb('0x4d')]);_0x2a0037['attributes']=_['intersection'](_0x5f16ef['model'],qs[_0xbdcb('0x51')](_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x2a0037[_0xbdcb('0x52')]=_0x2a0037[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x2a0037['attributes']:_0x5f16ef['model'];if(!_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x54')]('nolimit')){_0x2a0037['limit']=qs[_0xbdcb('0x2e')](_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x2a0037['offset']=qs['offset'](_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}_0x2a0037[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x2a0037[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x556247['query'],_0x5f16ef[_0xbdcb('0x4f')]),_0x29a707);if(_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x2a0037[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x2a0037[_0xbdcb('0x57')],{'$or':_['map'](_0x29a707,function(_0x157f71){if(_0x157f71[_0xbdcb('0x5b')]!==_0xbdcb('0x5c')){return db['sequelize'][_0xbdcb('0x57')](db['sequelize']['fn'](_0xbdcb('0x5d'),db[_0xbdcb('0x5e')][_0xbdcb('0x5f')](_0x157f71[_0xbdcb('0x42')])),{'$like':db['sequelize']['fn']('lower','%'+_0x556247[_0xbdcb('0x4d')][_0xbdcb('0x59')]+'%')});}})});}_0x2a0037=_[_0xbdcb('0x5a')]({},_0x2a0037,_0x556247['options']);var _0x2c9254={'where':_0x2a0037['where']};return db[_0xbdcb('0x47')][_0xbdcb('0x60')](_0x2c9254)[_0xbdcb('0x20')](function(_0x25df6d){_0x5dbda1[_0xbdcb('0x60')]=_0x25df6d;if(_0x556247[_0xbdcb('0x4d')]['includeAll']){_0x2a0037[_0xbdcb('0x61')]=[{'all':!![]}];}return db[_0xbdcb('0x47')][_0xbdcb('0x62')](_0x2a0037);})[_0xbdcb('0x20')](function(_0x5a4283){_0x5dbda1['rows']=_0x5a4283;return _0x5dbda1;})[_0xbdcb('0x20')](respondWithFilteredResult(_0x342057,_0x2a0037))[_0xbdcb('0x63')](handleError(_0x342057,null));};exports['show']=function(_0x583459,_0x5ae779){var _0x2a1d53={'raw':![],'where':{'id':_0x583459[_0xbdcb('0x64')]['id']}},_0x136537={};_0x136537[_0xbdcb('0x65')]=_[_0xbdcb('0x4a')](_[_0xbdcb('0x4e')](db['User'][_0xbdcb('0x48')]),[_0xbdcb('0x4b'),_0xbdcb('0x4c')]);_0x136537[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x583459[_0xbdcb('0x4d')]);_0x136537[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x136537['model'],_0x136537[_0xbdcb('0x4d')]);_0x2a1d53[_0xbdcb('0x52')]=_['intersection'](_0x136537['model'],qs['fields'](_0x583459[_0xbdcb('0x4d')]['fields']));_0x2a1d53[_0xbdcb('0x52')]=_0x2a1d53[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x2a1d53[_0xbdcb('0x52')]:_0x136537[_0xbdcb('0x65')];if(_0x583459[_0xbdcb('0x4d')]['includeAll']){_0x2a1d53[_0xbdcb('0x61')]=[{'all':!![]}];}_0x2a1d53=_[_0xbdcb('0x5a')]({},_0x2a1d53,_0x583459[_0xbdcb('0x66')]);return db['User'][_0xbdcb('0x41')](_0x2a1d53)[_0xbdcb('0x20')](handleEntityNotFound(_0x5ae779,null))[_0xbdcb('0x20')](respondWithResult(_0x5ae779,null))['catch'](handleError(_0x5ae779,null));};exports[_0xbdcb('0x67')]=function(_0x52596b,_0xf955eb){if(_0x52596b[_0xbdcb('0x68')]['id']){delete _0x52596b['body']['id'];}delete _0x52596b[_0xbdcb('0x68')]['role'];return db[_0xbdcb('0x47')]['find']({'where':{'id':_0x52596b['params']['id']}})['then'](handleEntityNotFound(_0xf955eb,null))[_0xbdcb('0x20')](saveUpdates(_0x52596b[_0xbdcb('0x68')],null))['then'](respondWithResult(_0xf955eb,null))[_0xbdcb('0x63')](handleError(_0xf955eb,null));};exports[_0xbdcb('0x69')]=function(_0x4f8b5e,_0x54a128){return db['User']['describe']()['then'](respondWithResult(_0x54a128,null))[_0xbdcb('0x63')](handleError(_0x54a128,null));};exports[_0xbdcb('0x6a')]=function(_0x2f4b4c,_0x1e84f6,_0x38c993){return db[_0xbdcb('0x47')]['find']({'where':{'id':_0x2f4b4c['params']['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x1e84f6,null))[_0xbdcb('0x20')](function(_0x3e42e5){if(_0x3e42e5){return _0x3e42e5[_0xbdcb('0x6a')](_0x2f4b4c[_0xbdcb('0x68')]['ids'],_[_0xbdcb('0x6b')](_0x2f4b4c['body'],[_0xbdcb('0x6c'),'id'])||{});}})[_0xbdcb('0x20')](respondWithResult(_0x1e84f6,null))[_0xbdcb('0x63')](handleError(_0x1e84f6,null));};function validateUser(_0x266ee4){return new BPromise(function(_0x11fa01,_0xcb3cf4){if(_0x266ee4[_0xbdcb('0x6d')])return _0x11fa01(_0x266ee4);return db[_0xbdcb('0x6e')][_0xbdcb('0x6f')](0x1)[_0xbdcb('0x20')](function(_0x591ca4){if(_0x591ca4[_0xbdcb('0x70')])authService[_0xbdcb('0x71')](_0x266ee4[_0xbdcb('0x4b')]);db[_0xbdcb('0x47')][_0xbdcb('0x72')](_0xbdcb('0x6d'))[_0xbdcb('0x20')](function(_0xd51099){if(_[_0xbdcb('0x73')](_0xd51099)){_0x266ee4[_0xbdcb('0x6d')]=_0x591ca4['min_internal']||0x1;return;}if(_[_0xbdcb('0x73')](_0x591ca4['min_internal'])||_0x591ca4[_0xbdcb('0x74')]===_0xd51099){_0x266ee4[_0xbdcb('0x6d')]=_0xd51099+0x1;return;}if(_0x591ca4[_0xbdcb('0x74')]>_0xd51099){_0x266ee4['internal']=_0x591ca4[_0xbdcb('0x74')];return;}return db[_0xbdcb('0x5e')]['query'](_0xbdcb('0x75'),{'type':db[_0xbdcb('0x5e')][_0xbdcb('0x76')][_0xbdcb('0x77')]})[_0xbdcb('0x20')](function(_0x34693e){if(_0x34693e&&_0x34693e[_0xbdcb('0x53')]){for(var _0x25c16f=0x0,_0x524230=_0x34693e[_0xbdcb('0x53')];_0x25c16f<_0x524230&&_[_0xbdcb('0x73')](_0x266ee4['internal']);_0x25c16f++){if(_0x591ca4[_0xbdcb('0x74')]<=_0x34693e[_0x25c16f][_0xbdcb('0x78')]){_0x266ee4[_0xbdcb('0x6d')]=_0x34693e[_0x25c16f][_0xbdcb('0x78')];}else if(_0x591ca4[_0xbdcb('0x74')]>_0x34693e[_0x25c16f][_0xbdcb('0x78')]&&_0x591ca4[_0xbdcb('0x74')]<=_0x34693e[_0x25c16f]['to']){_0x266ee4[_0xbdcb('0x6d')]=_0x591ca4[_0xbdcb('0x74')];}}}if(_[_0xbdcb('0x73')](_0x266ee4['internal'])){_0x266ee4[_0xbdcb('0x6d')]=_0xd51099+0x1;}return _0x11fa01(_0x266ee4);});});})[_0xbdcb('0x63')](function(_0x3230c0){_0xcb3cf4(_0x3230c0);});});}function updateUser(_0x176f6c){return new BPromise(function(_0x53e7d6,_0x164ec6){try{if(_0x176f6c[_0xbdcb('0x79')]){_0x176f6c['mailbox']=_0x176f6c[_0xbdcb('0x6d')];_0x176f6c[_0xbdcb('0x7a')]={'mailbox':_0x176f6c[_0xbdcb('0x6d')],'password':_0x176f6c['password'],'fullname':_0x176f6c[_0xbdcb('0x7b')],'email':_0x176f6c['email']};}if(_0x176f6c[_0xbdcb('0x36')]==='agent'){if(!_0x176f6c[_0xbdcb('0x7c')])_0x176f6c[_0xbdcb('0x7c')]=[_0xbdcb('0x7d'),'102',_0xbdcb('0x7e'),_0xbdcb('0x7f'),_0xbdcb('0x80'),_0xbdcb('0x81'),_0xbdcb('0x82'),_0xbdcb('0x83'),_0xbdcb('0x84'),_0xbdcb('0x85'),_0xbdcb('0x86'),_0xbdcb('0x87'),_0xbdcb('0x88'),_0xbdcb('0x89'),'115'];}_0x53e7d6(_0x176f6c);}catch(_0x82ea04){_0x164ec6(_0x82ea04);}});}exports['create']=function(_0x1b7110,_0x21fdd6){if(_0x1b7110['user'][_0xbdcb('0x36')]==='agent')throw new Error('Unauthorized');if(_0x1b7110['body'][_0xbdcb('0x36')]===_0xbdcb('0x38')&&_0x1b7110[_0xbdcb('0x38')][_0xbdcb('0x36')]!=='admin'){throw new Error(_0xbdcb('0x8a'));}if(_0x1b7110[_0xbdcb('0x68')][_0xbdcb('0x36')]===_0xbdcb('0x8b')&&_0x1b7110['user'][_0xbdcb('0x36')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xbdcb('0x8c')]([_0x1b7110[_0xbdcb('0x68')]])[_0xbdcb('0x20')](function(){return validateUser(_0x1b7110[_0xbdcb('0x68')]);})['then'](function(_0x44d9f7){return updateUser(_0x44d9f7)[_0xbdcb('0x20')](function(_0x54e8b9){if(_0x54e8b9[_0xbdcb('0x36')]==='admin'){_0x54e8b9[_0xbdcb('0x8d')]=_0x1b7110['user'][_0xbdcb('0x8d')];delete _0x54e8b9[_0xbdcb('0x8e')];}return _0x54e8b9;});})[_0xbdcb('0x20')](function(_0x2e8755){return db['User'][_0xbdcb('0x8f')](_0x2e8755,{'include':[{'model':db[_0xbdcb('0x7a')],'as':_0xbdcb('0x7a')}]});})[_0xbdcb('0x20')](function(_0x1e7df1){if(_0x1b7110[_0xbdcb('0x68')]['role']===_0xbdcb('0x38'))return _0x1e7df1;if(_0x1b7110[_0xbdcb('0x38')]['role']!=='user')return _0x1e7df1;return db['UserProfileSection'][_0xbdcb('0x41')]({'where':{'name':_0x1e7df1[_0xbdcb('0x36')]==='agent'?_0xbdcb('0x39'):_0xbdcb('0x3b'),'userProfileId':_0x1b7110['user'][_0xbdcb('0x8e')]},'raw':!![]})['then'](function(_0x296c4a){if(!_0x296c4a||_0x296c4a['autoAssociation']!=0x0)return _0x1e7df1;return db[_0xbdcb('0x43')][_0xbdcb('0x8f')]({'name':_0x1e7df1[_0xbdcb('0x42')],'resourceId':_0x1e7df1['id'],'type':_0x296c4a[_0xbdcb('0x42')],'sectionId':_0x296c4a['id']},{})[_0xbdcb('0x20')](function(){return _0x1e7df1;});})[_0xbdcb('0x63')](function(_0xbbc657){logger[_0xbdcb('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbbc657);throw _0xbbc657;});})[_0xbdcb('0x20')](respondWithResult(_0x21fdd6,0xc9))[_0xbdcb('0x63')](handleError(_0x21fdd6,null));};exports[_0xbdcb('0x90')]=function(_0x5a3a58,_0x2b1892){var _0x20fc90=_0x5a3a58[_0xbdcb('0x68')];var _0x5ad58a=[];if(_0x5a3a58[_0xbdcb('0x38')][_0xbdcb('0x36')]===_0xbdcb('0x3a'))throw new Error(_0xbdcb('0x91'));if(_['some'](_0x20fc90,[_0xbdcb('0x36'),_0xbdcb('0x38')])&&_0x5a3a58[_0xbdcb('0x38')][_0xbdcb('0x36')]!=='admin'){throw new Error(_0xbdcb('0x8a'));}if(_[_0xbdcb('0x92')](_0x20fc90,[_0xbdcb('0x36'),_0xbdcb('0x8b')])&&_0x5a3a58[_0xbdcb('0x38')][_0xbdcb('0x36')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x20fc90)['then'](function(){return validateUser(_0x20fc90[0x0]);})[_0xbdcb('0x20')](function(){for(var _0x3b3f15=0x1;_0x3b3f15<_0x20fc90['length'];_0x3b3f15++){var _0x3cc2a5=_0x20fc90[_0x3b3f15-0x1][_0xbdcb('0x6d')];if(!_0x20fc90[_0x3b3f15]['internal'])_0x20fc90[_0x3b3f15][_0xbdcb('0x6d')]=_0x3cc2a5+0x1;_0x5ad58a[_0xbdcb('0x93')](validateUser(_0x20fc90[_0x3b3f15]));}return BPromise[_0xbdcb('0x94')](_0x5ad58a);})[_0xbdcb('0x20')](function(){_0x5ad58a=[];for(var _0x354aca=0x0;_0x354aca<_0x20fc90['length'];_0x354aca++){_0x5ad58a['push'](updateUser(_0x20fc90[_0x354aca]));}return BPromise[_0xbdcb('0x94')](_0x5ad58a);})['then'](function(){return BPromise[_0xbdcb('0x95')](_0x20fc90,function(_0xfd38b3){return db[_0xbdcb('0x47')]['create'](_0xfd38b3,{'include':[{'model':db[_0xbdcb('0x7a')],'as':_0xbdcb('0x7a')}]})[_0xbdcb('0x20')](function(_0x456ca3){_0xfd38b3['id']=_0x456ca3['id'];return _0xfd38b3;});});})['then'](function(_0xc33a20){if(_0x5a3a58['body'][_0xbdcb('0x36')]===_0xbdcb('0x38'))return _0xc33a20;if(_0x5a3a58[_0xbdcb('0x38')][_0xbdcb('0x36')]!==_0xbdcb('0x38'))return _0xc33a20;var _0x2b123c=_[_0xbdcb('0x92')](_0xc33a20,function(_0x53e881){return _0x53e881[_0xbdcb('0x36')]==='agent'||_0x53e881['role']===_0xbdcb('0x3c');});if(!_0x2b123c)return _0xc33a20;return db[_0xbdcb('0x96')]['findAll']({'where':{'name':{'$or':['Agents',_0xbdcb('0x3b')]},'userProfileId':_0x5a3a58[_0xbdcb('0x38')][_0xbdcb('0x8e')]},'raw':!![]})['then'](function(_0x11067e){if(_[_0xbdcb('0x97')](_0x11067e)||!_[_0xbdcb('0x92')](_0x11067e,[_0xbdcb('0x98'),0x0]))return _0xc33a20;_0x5ad58a=[];var _0x444acd=_(_0x11067e)['map'](function(_0x78e77b){if(_0x78e77b[_0xbdcb('0x98')]===0x1)return;return _0x78e77b['name']===_0xbdcb('0x39')?_0xbdcb('0x3a'):_0xbdcb('0x3c');})[_0xbdcb('0x99')]()[_0xbdcb('0x3f')]();for(var _0x1af263=0x0;_0x1af263<_0xc33a20[_0xbdcb('0x53')];_0x1af263++){if(!_[_0xbdcb('0x40')](_0x444acd,_0xc33a20[_0x1af263][_0xbdcb('0x36')]))return;var _0x25fd13=_0xc33a20[_0x1af263][_0xbdcb('0x36')]===_0xbdcb('0x3a')?_0xbdcb('0x39'):'Telephones';_0x5ad58a[_0xbdcb('0x93')](db[_0xbdcb('0x43')][_0xbdcb('0x8f')]({'name':_0xc33a20[_0x1af263]['name'],'resourceId':_0xc33a20[_0x1af263]['id'],'type':_0x25fd13,'sectionId':_[_0xbdcb('0x41')](_0x11067e,[_0xbdcb('0x42'),_0x25fd13])['id']},{}));}return BPromise[_0xbdcb('0x94')](_0x5ad58a);});})[_0xbdcb('0x20')](respondWithResult(_0x2b1892,0xc9))['catch'](handleError(_0x2b1892,null));};exports[_0xbdcb('0x9a')]=function(_0xd3065d,_0x113497,_0x4da0c2){if(_0xd3065d[_0xbdcb('0x68')]['id']){delete _0xd3065d[_0xbdcb('0x68')]['id'];}return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0xd3065d[_0xbdcb('0x64')]['id']}})['then'](function(_0x229d12){if(!_0x229d12)return null;if(_0x229d12['id']===_0xd3065d[_0xbdcb('0x38')]['id']){if(!_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9b')]||!_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')]){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x229d12[_0xbdcb('0x9f')](_0xd3065d[_0xbdcb('0x68')]['oldPassword'])){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))]('Wrong\x20credentials');}if(_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9b')]===_0xd3065d['body'][_0xbdcb('0x9c')]){throw new db['Sequelize']['ValidationError'](_0xbdcb('0xa0'));}}else if(_0xd3065d[_0xbdcb('0x38')][_0xbdcb('0x36')]===_0xbdcb('0x8b')){if(!_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')]){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xd3065d['user'][_0xbdcb('0x36')]===_0xbdcb('0x38')){if(!_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')]){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))](_0xbdcb('0xa1'));}if(_0x229d12[_0xbdcb('0x36')]!=='agent'){throw new db['Sequelize']['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xbdcb('0x9e'))]('Unauthorized');}return _0x229d12;})[_0xbdcb('0x20')](handleEntityNotFound(_0x113497,null))['then'](function(_0x5f39a0){return db[_0xbdcb('0x6e')][_0xbdcb('0xa2')]({'attributes':['id',_0xbdcb('0x70'),_0xbdcb('0xa3'),'passwordHistoryLimit']})[_0xbdcb('0x20')](function(_0x23442d){if(_0x23442d[_0xbdcb('0x70')])authService[_0xbdcb('0x71')](_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')]);if(!_0x23442d[_0xbdcb('0xa3')]||!_0x5f39a0[_0xbdcb('0xa4')])return _0x5f39a0;authService[_0xbdcb('0xa5')](_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')],_0x5f39a0[_0xbdcb('0xa4')],_0x23442d['passwordHistoryLimit']);return _0x5f39a0;})[_0xbdcb('0x20')](saveUpdates({'password':_0xd3065d[_0xbdcb('0x68')][_0xbdcb('0x9c')],'passwordResetAt':_0xd3065d[_0xbdcb('0x38')]['id']==_0xd3065d[_0xbdcb('0x64')]['id']?moment():null,'previousPasswords':authService[_0xbdcb('0xa6')](_0xd3065d[_0xbdcb('0x68')]['newPassword'],_0x5f39a0['previousPasswords'])},null));})[_0xbdcb('0x20')](respondWithResult(_0x113497,null))[_0xbdcb('0x63')](handleError(_0x113497,null));};exports[_0xbdcb('0xa7')]=function(_0x441deb,_0x1bd7be,_0x430e3e){var _0x18c3a6=_0x441deb[_0xbdcb('0x68')][_0xbdcb('0xa8')];return db['User'][_0xbdcb('0x41')]({'where':{'id':_0x441deb[_0xbdcb('0x64')]['id']},'attributes':['id','name',_0xbdcb('0x36'),_0xbdcb('0xa9'),_0xbdcb('0xaa'),_0xbdcb('0xab'),'interface']})[_0xbdcb('0x20')](handleEntityNotFound(_0x1bd7be,null))[_0xbdcb('0x20')](function(_0x54803a){if(_0x54803a){if(!utils[_0xbdcb('0xac')](_0x18c3a6)){throw new db['Sequelize'][(_0xbdcb('0x9e'))](_0xbdcb('0xad'));}return _0x54803a[_0xbdcb('0xae')+_[_0xbdcb('0xaf')](_0x18c3a6['toLowerCase']())+'Queues'](_0x441deb[_0xbdcb('0x68')]['ids'],{'penalty':_0x441deb[_0xbdcb('0x68')][_0xbdcb('0xb0')]||0x0})[_0xbdcb('0xb1')](function(_0x299425){for(var _0x401127=0x0;_0x401127<_0x441deb[_0xbdcb('0x68')][_0xbdcb('0x6c')]['length'];_0x401127+=0x1){var _0x150712={'UserId':_0x441deb[_0xbdcb('0x64')]['id']};_0x150712[_[_0xbdcb('0xaf')](_0x18c3a6[_0xbdcb('0xb2')]())+'QueueId']=_0x441deb[_0xbdcb('0x68')][_0xbdcb('0x6c')][_0x401127];socket[_0xbdcb('0xb3')](_0xbdcb('0x38')+_[_0xbdcb('0xaf')](_0x18c3a6[_0xbdcb('0xb2')]())+'Queue:save',_0x150712);}return _0x299425;})[_0xbdcb('0x20')](function(){if(_0x18c3a6===_0xbdcb('0xb4')){return db[_0xbdcb('0xb5')]['findAll']({'where':{'id':_0x441deb['body'][_0xbdcb('0x6c')]||[]},'raw':!![],'attributes':['id',_0xbdcb('0x42')]});}})[_0xbdcb('0x20')](function(_0x462c7d){var _0x482b2b=_0x54803a[_0xbdcb('0x35')]({'plain':!![]});var _0x3302ee=[];if(_0x18c3a6===_0xbdcb('0xb4')&&_0x482b2b['role']==='agent'&&_0x482b2b[_0xbdcb('0xa9')]){for(var _0x4ff4df=0x0;_0x4ff4df<_0x462c7d[_0xbdcb('0x53')];_0x4ff4df+=0x1){_0x3302ee[_0xbdcb('0x93')]({'membername':_0x482b2b[_0xbdcb('0x42')],'UserId':_0x482b2b['id'],'queue_name':_0x462c7d[_0x4ff4df][_0xbdcb('0x42')],'VoiceQueueId':_0x462c7d[_0x4ff4df]['id'],'interface':_[_0xbdcb('0x73')](_0x482b2b[_0xbdcb('0xb6')])?util[_0xbdcb('0xb7')]('SIP/%s',_0x482b2b[_0xbdcb('0x42')]):_0x482b2b[_0xbdcb('0xb6')],'paused':_0x482b2b['voicePause']||![],'penalty':_0x441deb[_0xbdcb('0x68')]['penalty']||0x0});}return BPromise[_0xbdcb('0x95')](_0x3302ee,function(_0x330dea){return db['UserVoiceQueueRt'][_0xbdcb('0xb8')](_0x330dea);});}return _0x54803a;});}})[_0xbdcb('0x20')](respondWithStatusCode(_0x1bd7be,null))['catch'](handleError(_0x1bd7be,null));};exports[_0xbdcb('0xb9')]=function(_0x5bdfe7,_0x4d8585,_0x5803b9){var _0xcfeeea;return db[_0xbdcb('0x47')]['find']({'where':{'id':_0x5bdfe7[_0xbdcb('0x64')]['id']},'attributes':['id',_0xbdcb('0x42'),'role']})[_0xbdcb('0x20')](handleEntityNotFound(_0x4d8585,null))[_0xbdcb('0x20')](function(_0x3c7929){if(_0x3c7929){_0xcfeeea=_0x3c7929;if(!_0x5bdfe7['query'][_0xbdcb('0xa8')]||!utils[_0xbdcb('0xac')](_0x5bdfe7['query']['channel'])){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))](_0xbdcb('0xad'));}return _0x3c7929[_0xbdcb('0xba')+_[_0xbdcb('0xaf')](_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0xa8')][_0xbdcb('0xb2')]())+'Queues'](_0x5bdfe7[_0xbdcb('0x4d')]['ids']);}})['then'](function(_0x41e6d5){for(var _0x4cc76e=0x0;_0x4cc76e<_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0x6c')][_0xbdcb('0x53')];_0x4cc76e+=0x1){var _0xa98140={'UserId':_0x5bdfe7[_0xbdcb('0x64')]['id']};_0xa98140[_['capitalize'](_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0xa8')]['toLowerCase']())+'QueueId']=_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0x6c')][_0x4cc76e];socket[_0xbdcb('0xb3')]('user'+_[_0xbdcb('0xaf')](_0x5bdfe7['query'][_0xbdcb('0xa8')]['toLowerCase']())+'Queue:remove',_0xa98140);}return _0x41e6d5;})[_0xbdcb('0x20')](function(){if(_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0xa8')]===_0xbdcb('0xb4')){return db[_0xbdcb('0xbb')][_0xbdcb('0x34')]({'where':{'UserId':_0x5bdfe7[_0xbdcb('0x64')]['id'],'VoiceQueueId':_0x5bdfe7[_0xbdcb('0x4d')][_0xbdcb('0x6c')]},'individualHooks':!![]})[_0xbdcb('0x20')](function(){return _0xcfeeea;});}return _0xcfeeea;})[_0xbdcb('0x20')](respondWithStatusCode(_0x4d8585,null))['catch'](handleError(_0x4d8585,null));};exports[_0xbdcb('0xbc')]=function(_0x87ea59,_0xf16c8e,_0x4db5bd){_0x87ea59['body'][_0xbdcb('0xbd')]=_0x87ea59['file'][_0xbdcb('0xbe')];return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0x87ea59['params']['id']}})['then'](handleEntityNotFound(_0xf16c8e,null))[_0xbdcb('0x20')](saveUpdates(_0x87ea59[_0xbdcb('0x68')],null))['then'](respondWithResult(_0xf16c8e,null))['catch'](handleError(_0xf16c8e,null));};exports[_0xbdcb('0xbf')]=function(_0x10c89e,_0x40d7eb,_0x5662cb){var _0x3b2b60=path[_0xbdcb('0xc0')](config['root'],_0xbdcb('0xc1'));return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0x10c89e[_0xbdcb('0x64')]['id']},'attributes':['id',_0xbdcb('0xbd')],'raw':!![]})[_0xbdcb('0x20')](handleEntityNotFound(_0x40d7eb,null))[_0xbdcb('0x20')](function(_0x4c11d4){if(_0x4c11d4){if(_['isNil'](_0x4c11d4['userpic'])){return _0x40d7eb[_0xbdcb('0xc2')](_0x3b2b60);}else{if(!fs[_0xbdcb('0xc3')](path['join'](config['root'],_0xbdcb('0xc4'),_0x4c11d4['userpic']))){return _0x40d7eb[_0xbdcb('0xc2')](_0x3b2b60);}return _0x40d7eb[_0xbdcb('0xc2')](path[_0xbdcb('0xc0')](config[_0xbdcb('0xc5')],_0xbdcb('0xc4'),_0x4c11d4['userpic']));}}})['catch'](handleError(_0x40d7eb,null));};exports[_0xbdcb('0xc6')]=function(_0x5ebe63,_0x2ecd13,_0x2773a6){var _0x3f5cbf={};var _0x168927={};var _0xa1db93;var _0x4408e2;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x5ebe63[_0xbdcb('0x64')]['id']}})['then'](handleEntityNotFound(_0x2ecd13,null))[_0xbdcb('0x20')](function(_0x5f23c0){if(_0x5f23c0){_0xa1db93=_0x5f23c0;_0x168927[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db['CmContact'][_0xbdcb('0x48')]);_0x168927['query']=_['keys'](_0x5ebe63[_0xbdcb('0x4d')]);_0x168927[_0xbdcb('0x4f')]=_['intersection'](_0x168927['model'],_0x168927[_0xbdcb('0x4d')]);_0x3f5cbf[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x168927[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x5ebe63[_0xbdcb('0x4d')]['fields']));_0x3f5cbf['attributes']=_0x3f5cbf[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x3f5cbf[_0xbdcb('0x52')]:_0x168927[_0xbdcb('0x65')];_0x3f5cbf[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x5ebe63[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x3f5cbf[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x5ebe63['query'],_0x168927['filters']));if(_0x5ebe63[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x3f5cbf[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x3f5cbf[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x3f5cbf[_0xbdcb('0x52')],function(_0x307273){var _0x522b14={};_0x522b14[_0x307273]={'$like':'%'+_0x5ebe63['query'][_0xbdcb('0x59')]+'%'};return _0x522b14;})});}_0x3f5cbf=_['merge']({},_0x3f5cbf,_0x5ebe63[_0xbdcb('0x66')]);return _0xa1db93['getContacts'](_0x3f5cbf);}})[_0xbdcb('0x20')](function(_0xf0668e){if(_0xf0668e){_0x4408e2=_0xf0668e[_0xbdcb('0x53')];if(_0x5ebe63['query'][_0xbdcb('0x54')](_0xbdcb('0xc7'))){_0x3f5cbf[_0xbdcb('0x61')]=[{'model':db[_0xbdcb('0xc8')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xbdcb('0xc9'),'attributes':['id','name',_0xbdcb('0xca')],'where':_0x5ebe63[_0xbdcb('0x4d')]['tag']?{'id':_0x5ebe63[_0xbdcb('0x4d')]['tag']}:undefined,'required':_0x5ebe63[_0xbdcb('0x4d')][_0xbdcb('0xcb')]?!![]:![]}];}if(!_0x5ebe63[_0xbdcb('0x4d')]['hasOwnProperty'](_0xbdcb('0xcc'))){_0x3f5cbf[_0xbdcb('0x2e')]=qs['limit'](_0x5ebe63[_0xbdcb('0x4d')]['limit']);_0x3f5cbf[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x5ebe63[_0xbdcb('0x4d')]['offset']);}return _0xa1db93[_0xbdcb('0xc6')](_0x3f5cbf);}})[_0xbdcb('0x20')](function(_0x17129d){if(_0x17129d){return _0x17129d?{'count':_0x4408e2,'rows':_0x17129d}:null;}})[_0xbdcb('0x20')](respondWithResult(_0x2ecd13,null))[_0xbdcb('0x63')](handleError(_0x2ecd13,null));};exports[_0xbdcb('0xcd')]=function(_0x173dc7,_0x39310f,_0x25055e){var _0x4a3f1d;var _0x3e6efb;var _0x30631e={};var _0x321151;return db['User'][_0xbdcb('0xa2')]({'where':{'id':_0x173dc7[_0xbdcb('0x64')]['id']},'attributes':['id',_0xbdcb('0x42'),_0xbdcb('0x36')]})[_0xbdcb('0x20')](handleEntityNotFound(_0x39310f,null))[_0xbdcb('0x20')](function(_0x1f78ac){if(!utils[_0xbdcb('0xac')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0xa8')])){throw new db[(_0xbdcb('0x9d'))][(_0xbdcb('0x9e'))](_0xbdcb('0xad'));}_0x4a3f1d=_0x1f78ac;var _0x2ab3ec={};_0x2ab3ec[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db[_[_0xbdcb('0xaf')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0xa8')])+'Queue'][_0xbdcb('0x48')]);_0x2ab3ec[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x173dc7[_0xbdcb('0x4d')]);_0x2ab3ec[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x2ab3ec[_0xbdcb('0x65')],_0x2ab3ec[_0xbdcb('0x4d')]);_0x30631e[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x2ab3ec[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x173dc7[_0xbdcb('0x4d')]['fields']));_0x30631e['attributes']=_0x30631e['attributes'][_0xbdcb('0x53')]?_0x30631e[_0xbdcb('0x52')]:_0x2ab3ec[_0xbdcb('0x65')];_0x30631e[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x30631e[_0xbdcb('0x57')]=qs['filters'](_['pick'](_0x173dc7['query'],_0x2ab3ec['filters']));if(_0x173dc7[_0xbdcb('0x4d')]['filter']){_0x30631e[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x30631e[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x30631e[_0xbdcb('0x52')],function(_0x492562){var _0x158112={};_0x158112[_0x492562]={'$like':'%'+_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0x59')]+'%'};return _0x158112;})});}_0x30631e=_[_0xbdcb('0x5a')]({},_0x30631e,_0x173dc7[_0xbdcb('0x66')]);switch(_0x4a3f1d['role']){case _0xbdcb('0x8b'):return db[_[_0xbdcb('0xaf')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0xa8')])+'Queue'][_0xbdcb('0x62')](_0x30631e);case'user':case _0xbdcb('0x3a'):return _0x4a3f1d[_0xbdcb('0x35')+_['capitalize'](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0xa8')])+_0xbdcb('0xce')](_0x30631e);default:throw new db[(_0xbdcb('0x9d'))]['ValidationError'](_0xbdcb('0xcf'));}})[_0xbdcb('0x20')](function(_0x2b9327){_0x321151=_0x2b9327['length'];if(!_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x30631e['limit']=qs[_0xbdcb('0x2e')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x30631e[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}switch(_0x4a3f1d[_0xbdcb('0x36')]){case'admin':return db[_[_0xbdcb('0xaf')](_0x173dc7[_0xbdcb('0x4d')][_0xbdcb('0xa8')])+_0xbdcb('0xd0')]['findAll'](_0x30631e);case _0xbdcb('0x38'):case _0xbdcb('0x3a'):return _0x4a3f1d[_0xbdcb('0x35')+_[_0xbdcb('0xaf')](_0x173dc7['query'][_0xbdcb('0xa8')])+_0xbdcb('0xce')](_0x30631e);}})[_0xbdcb('0x20')](function(_0x57fcd8){return{'count':_0x321151,'rows':_0x57fcd8};})[_0xbdcb('0x20')](respondWithResult(_0x39310f,null))['catch'](handleError(_0x39310f,null));};exports[_0xbdcb('0xd1')]=function(_0x4d1700,_0xdd9ea1,_0x26c2eb){var _0x1131dd={};var _0x58b260={};var _0x5bacee;var _0x1d2c92;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x4d1700['params']['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0xdd9ea1,null))[_0xbdcb('0x20')](function(_0x2b6320){if(_0x2b6320){_0x5bacee=_0x2b6320;_0x58b260[_0xbdcb('0x65')]=_['keys'](db[_0xbdcb('0xbb')][_0xbdcb('0x48')]);_0x58b260['query']=_[_0xbdcb('0x4e')](_0x4d1700[_0xbdcb('0x4d')]);_0x58b260[_0xbdcb('0x4f')]=_['intersection'](_0x58b260['model'],_0x58b260['query']);_0x1131dd[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x58b260[_0xbdcb('0x65')],qs['fields'](_0x4d1700[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x1131dd[_0xbdcb('0x52')]=_0x1131dd[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x1131dd[_0xbdcb('0x52')]:_0x58b260['model'];_0x1131dd[_0xbdcb('0x55')]=qs['sort'](_0x4d1700['query']['sort']);_0x1131dd[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x4d1700[_0xbdcb('0x4d')],_0x58b260[_0xbdcb('0x4f')]));if(_0x4d1700[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x1131dd[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x1131dd[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x1131dd['attributes'],function(_0x4876bc){var _0x10f336={};_0x10f336[_0x4876bc]={'$like':'%'+_0x4d1700['query'][_0xbdcb('0x59')]+'%'};return _0x10f336;})});}_0x1131dd=_['merge']({},_0x1131dd,_0x4d1700[_0xbdcb('0x66')]);return _0x5bacee['getVoiceQueuesRt'](_0x1131dd);}})[_0xbdcb('0x20')](function(_0x4d7e70){if(_0x4d7e70){_0x1d2c92=_0x4d7e70[_0xbdcb('0x53')];if(!_0x4d1700[_0xbdcb('0x4d')][_0xbdcb('0x54')]('nolimit')){_0x1131dd[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x4d1700['query'][_0xbdcb('0x2e')]);_0x1131dd[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x4d1700[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}return _0x5bacee['getVoiceQueuesRt'](_0x1131dd);}})['then'](function(_0x9899f3){if(_0x9899f3){return _0x9899f3?{'count':_0x1d2c92,'rows':_0x9899f3}:null;}})[_0xbdcb('0x20')](respondWithResult(_0xdd9ea1,null))[_0xbdcb('0x63')](handleError(_0xdd9ea1,null));};exports[_0xbdcb('0xd2')]=function(_0x406b8a,_0x2460a0,_0x594fae){var _0x4fea86={};var _0x3ec187={};var _0x160eaf;var _0x14a826;return db['User'][_0xbdcb('0xa2')]({'where':{'id':_0x406b8a[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x2460a0,null))[_0xbdcb('0x20')](function(_0x45e276){if(_0x45e276){_0x160eaf=_0x45e276;_0x3ec187[_0xbdcb('0x65')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x3ec187[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x406b8a[_0xbdcb('0x4d')]);_0x3ec187['filters']=_[_0xbdcb('0x50')](_0x3ec187['model'],_0x3ec187[_0xbdcb('0x4d')]);_0x4fea86['attributes']=_[_0xbdcb('0x50')](_0x3ec187[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x406b8a[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x4fea86[_0xbdcb('0x52')]=_0x4fea86['attributes'][_0xbdcb('0x53')]?_0x4fea86['attributes']:_0x3ec187[_0xbdcb('0x65')];_0x4fea86[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x406b8a['query'][_0xbdcb('0x56')]);_0x4fea86['where']=qs['filters'](_[_0xbdcb('0x58')](_0x406b8a['query'],_0x3ec187['filters']));if(_0x406b8a['query'][_0xbdcb('0x59')]){_0x4fea86[_0xbdcb('0x57')]=_['merge'](_0x4fea86['where'],{'$or':_[_0xbdcb('0x3e')](_0x4fea86[_0xbdcb('0x52')],function(_0x479f57){var _0x254b9a={};_0x254b9a[_0x479f57]={'$like':'%'+_0x406b8a['query'][_0xbdcb('0x59')]+'%'};return _0x254b9a;})});}_0x4fea86=_[_0xbdcb('0x5a')]({},_0x4fea86,_0x406b8a[_0xbdcb('0x66')]);return _0x160eaf[_0xbdcb('0xd2')](_0x4fea86);}})[_0xbdcb('0x20')](function(_0x20325a){if(_0x20325a){_0x14a826=_0x20325a['length'];if(!_0x406b8a[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x4fea86[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x406b8a[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x4fea86[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x406b8a[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}return _0x160eaf[_0xbdcb('0xd2')](_0x4fea86);}})[_0xbdcb('0x20')](function(_0x367422){if(_0x367422){return _0x367422?{'count':_0x14a826,'rows':_0x367422}:null;}})[_0xbdcb('0x20')](respondWithResult(_0x2460a0,null))[_0xbdcb('0x63')](handleError(_0x2460a0,null));};exports[_0xbdcb('0xd3')]=function(_0x15e9f5,_0x459f85,_0x1a6df4){var _0x3de16d={'raw':!![],'where':{}};var _0x164789={};var _0x208547={'count':0x0,'rows':[]};return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x15e9f5['params']['id']}})['then'](handleEntityNotFound(_0x459f85,null))[_0xbdcb('0x20')](function(_0xdc366){if(_0xdc366){_0x164789[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db[_0xbdcb('0xd4')]['rawAttributes']);_0x164789[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x15e9f5[_0xbdcb('0x4d')]);_0x164789[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x164789[_0xbdcb('0x65')],_0x164789[_0xbdcb('0x4d')]);_0x3de16d[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x164789[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x15e9f5[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x3de16d[_0xbdcb('0x52')]=_0x3de16d[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x3de16d['attributes']:_0x164789['model'];if(!_0x15e9f5[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x3de16d[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x15e9f5[_0xbdcb('0x4d')]['limit']);_0x3de16d[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x15e9f5['query'][_0xbdcb('0x2d')]);}_0x3de16d[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x15e9f5['query']['sort']);_0x3de16d[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_['pick'](_0x15e9f5[_0xbdcb('0x4d')],_0x164789[_0xbdcb('0x4f')]));_0x3de16d['where']['UserId']=_0xdc366['id'];if(_0x15e9f5[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x3de16d['where']=_[_0xbdcb('0x5a')](_0x3de16d['where'],{'$or':_['map'](_0x3de16d[_0xbdcb('0x52')],function(_0x3f6aaf){var _0x4859ad={};_0x4859ad[_0x3f6aaf]={'$like':'%'+_0x15e9f5[_0xbdcb('0x4d')][_0xbdcb('0x59')]+'%'};return _0x4859ad;})});}_0x3de16d=_[_0xbdcb('0x5a')]({},_0x3de16d,_0x15e9f5[_0xbdcb('0x66')]);return db['VoiceRecording']['count']({'where':_0x3de16d[_0xbdcb('0x57')]})['then'](function(_0x4a39d9){_0x208547['count']=_0x4a39d9;if(_0x15e9f5[_0xbdcb('0x4d')][_0xbdcb('0xc7')]){_0x3de16d[_0xbdcb('0x61')]=[{'all':!![]}];}return db[_0xbdcb('0xd4')][_0xbdcb('0x62')](_0x3de16d);})[_0xbdcb('0x20')](function(_0x4c92fc){_0x208547[_0xbdcb('0xd5')]=_0x4c92fc;return _0x208547;});}})[_0xbdcb('0x20')](respondWithFilteredResult(_0x459f85,_0x3de16d))[_0xbdcb('0x63')](handleError(_0x459f85,null));};exports[_0xbdcb('0xd6')]=function(_0x1e8e0c,_0x26c454,_0xda1356){var _0x90d5f={'raw':!![],'where':{}};var _0x52395d={};var _0x1bf110={'count':0x0,'rows':[]};return db[_0xbdcb('0x47')]['findOne']({'where':{'id':_0x1e8e0c[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x26c454,null))[_0xbdcb('0x20')](function(_0x22cc4f){if(_0x22cc4f){_0x52395d[_0xbdcb('0x65')]=_['keys'](db[_0xbdcb('0xd7')][_0xbdcb('0x48')]);_0x52395d[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x1e8e0c['query']);_0x52395d['filters']=_[_0xbdcb('0x50')](_0x52395d[_0xbdcb('0x65')],_0x52395d[_0xbdcb('0x4d')]);_0x90d5f['attributes']=_[_0xbdcb('0x50')](_0x52395d[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x1e8e0c['query'][_0xbdcb('0x51')]));_0x90d5f[_0xbdcb('0x52')]=_0x90d5f[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x90d5f[_0xbdcb('0x52')]:_0x52395d['model'];if(!_0x1e8e0c[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x90d5f[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x1e8e0c['query']['limit']);_0x90d5f[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x1e8e0c[_0xbdcb('0x4d')]['offset']);}_0x90d5f[_0xbdcb('0x55')]=qs['sort'](_0x1e8e0c['query'][_0xbdcb('0x56')]);_0x90d5f[_0xbdcb('0x57')]=qs['filters'](_['pick'](_0x1e8e0c[_0xbdcb('0x4d')],_0x52395d[_0xbdcb('0x4f')]));_0x90d5f[_0xbdcb('0x57')]['UserId']=_0x22cc4f['id'];if(_0x1e8e0c[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x90d5f['where']=_[_0xbdcb('0x5a')](_0x90d5f[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x90d5f['attributes'],function(_0xd07e2a){var _0x244d53={};_0x244d53[_0xd07e2a]={'$like':'%'+_0x1e8e0c[_0xbdcb('0x4d')]['filter']+'%'};return _0x244d53;})});}_0x90d5f=_[_0xbdcb('0x5a')]({},_0x90d5f,_0x1e8e0c[_0xbdcb('0x66')]);return db[_0xbdcb('0xd7')][_0xbdcb('0x60')]({'where':_0x90d5f[_0xbdcb('0x57')]})[_0xbdcb('0x20')](function(_0x2ead0e){_0x1bf110[_0xbdcb('0x60')]=_0x2ead0e;if(_0x1e8e0c[_0xbdcb('0x4d')][_0xbdcb('0xc7')]){_0x90d5f[_0xbdcb('0x61')]=[{'all':!![]}];}return db[_0xbdcb('0xd7')][_0xbdcb('0x62')](_0x90d5f);})[_0xbdcb('0x20')](function(_0x23b138){_0x1bf110['rows']=_0x23b138;return _0x1bf110;});}})[_0xbdcb('0x20')](respondWithFilteredResult(_0x26c454,_0x90d5f))['catch'](handleError(_0x26c454,null));};exports[_0xbdcb('0xd8')]=function(_0x53338f,_0x5040e3,_0x17d821){var _0x2fbb62={};var _0x45d4e9={};var _0x4628e4;var _0x4ef167;return db['User'][_0xbdcb('0xa2')]({'where':{'id':_0x53338f[_0xbdcb('0x64')]['id']}})['then'](handleEntityNotFound(_0x5040e3,null))[_0xbdcb('0x20')](function(_0x339a7d){if(_0x339a7d){_0x4628e4=_0x339a7d;_0x45d4e9[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db[_0xbdcb('0xd9')][_0xbdcb('0x48')]);_0x45d4e9['query']=_['keys'](_0x53338f['query']);_0x45d4e9['filters']=_[_0xbdcb('0x50')](_0x45d4e9[_0xbdcb('0x65')],_0x45d4e9[_0xbdcb('0x4d')]);_0x2fbb62[_0xbdcb('0x52')]=_['intersection'](_0x45d4e9[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x53338f[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x2fbb62[_0xbdcb('0x52')]=_0x2fbb62[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x2fbb62[_0xbdcb('0x52')]:_0x45d4e9[_0xbdcb('0x65')];_0x2fbb62[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x53338f[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x2fbb62[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x53338f[_0xbdcb('0x4d')],_0x45d4e9[_0xbdcb('0x4f')]));if(_0x53338f[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x2fbb62[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x2fbb62[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x2fbb62['attributes'],function(_0x4a17c7){var _0x219500={};_0x219500[_0x4a17c7]={'$like':'%'+_0x53338f[_0xbdcb('0x4d')][_0xbdcb('0x59')]+'%'};return _0x219500;})});}_0x2fbb62=_[_0xbdcb('0x5a')]({},_0x2fbb62,_0x53338f['options']);return _0x4628e4[_0xbdcb('0xd8')](_0x2fbb62);}})[_0xbdcb('0x20')](function(_0x5da8f3){if(_0x5da8f3){_0x4ef167=_0x5da8f3[_0xbdcb('0x53')];if(!_0x53338f['query'][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x2fbb62[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x53338f[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x2fbb62[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x53338f[_0xbdcb('0x4d')]['offset']);}return _0x4628e4[_0xbdcb('0xd8')](_0x2fbb62);}})[_0xbdcb('0x20')](function(_0x4a9346){if(_0x4a9346){return _0x4a9346?{'count':_0x4ef167,'rows':_0x4a9346}:null;}})['then'](respondWithResult(_0x5040e3,null))[_0xbdcb('0x63')](handleError(_0x5040e3,null));};exports['getOpenchannelInteractions']=function(_0x217b85,_0x5d4663,_0xe9005c){var _0x5cc6ce={};var _0x2e6e92={};var _0x1d719d;var _0x430170;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x217b85[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x5d4663,null))[_0xbdcb('0x20')](function(_0x97cbd8){if(_0x97cbd8){_0x1d719d=_0x97cbd8;_0x2e6e92[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db['OpenchannelInteraction'][_0xbdcb('0x48')]);_0x2e6e92[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x217b85[_0xbdcb('0x4d')]);_0x2e6e92['filters']=_[_0xbdcb('0x50')](_0x2e6e92[_0xbdcb('0x65')],_0x2e6e92[_0xbdcb('0x4d')]);_0x5cc6ce[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x2e6e92['model'],qs['fields'](_0x217b85['query']['fields']));_0x5cc6ce[_0xbdcb('0x52')]=_0x5cc6ce[_0xbdcb('0x52')]['length']?_0x5cc6ce[_0xbdcb('0x52')]:_0x2e6e92['model'];_0x5cc6ce[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x217b85[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x5cc6ce[_0xbdcb('0x57')]=qs['filters'](_[_0xbdcb('0x58')](_0x217b85[_0xbdcb('0x4d')],_0x2e6e92['filters']));if(_0x217b85['query'][_0xbdcb('0x59')]){_0x5cc6ce['where']=_[_0xbdcb('0x5a')](_0x5cc6ce[_0xbdcb('0x57')],{'$or':_['map'](_0x5cc6ce[_0xbdcb('0x52')],function(_0x409ca8){var _0x3a0b0e={};_0x3a0b0e[_0x409ca8]={'$like':'%'+_0x217b85[_0xbdcb('0x4d')]['filter']+'%'};return _0x3a0b0e;})});}_0x5cc6ce=_[_0xbdcb('0x5a')]({},_0x5cc6ce,_0x217b85[_0xbdcb('0x66')]);return _0x1d719d[_0xbdcb('0xda')](_0x5cc6ce);}})[_0xbdcb('0x20')](function(_0x5ff19d){if(_0x5ff19d){_0x430170=_0x5ff19d['length'];if(!_0x217b85[_0xbdcb('0x4d')][_0xbdcb('0x54')]('nolimit')){_0x5cc6ce[_0xbdcb('0x2e')]=qs['limit'](_0x217b85[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x5cc6ce[_0xbdcb('0x2d')]=qs['offset'](_0x217b85[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}return _0x1d719d[_0xbdcb('0xda')](_0x5cc6ce);}})[_0xbdcb('0x20')](function(_0xa8b701){if(_0xa8b701){return _0xa8b701?{'count':_0x430170,'rows':_0xa8b701}:null;}})['then'](respondWithResult(_0x5d4663,null))[_0xbdcb('0x63')](handleError(_0x5d4663,null));};exports[_0xbdcb('0xdb')]=function(_0x1f79d7,_0x41432e,_0x427306){var _0x393a13={'raw':!![],'where':{}};var _0xb2ca36={};var _0x43d1db={'count':0x0,'rows':[]};return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x1f79d7[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x41432e,null))['then'](function(_0x8c1c40){if(_0x8c1c40){_0xb2ca36[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db['MailInteraction'][_0xbdcb('0x48')]);_0xb2ca36['query']=_[_0xbdcb('0x4e')](_0x1f79d7[_0xbdcb('0x4d')]);_0xb2ca36[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0xb2ca36[_0xbdcb('0x65')],_0xb2ca36['query']);_0x393a13[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0xb2ca36['model'],qs[_0xbdcb('0x51')](_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x393a13[_0xbdcb('0x52')]=_0x393a13[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x393a13[_0xbdcb('0x52')]:_0xb2ca36[_0xbdcb('0x65')];if(!_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x393a13[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x1f79d7['query'][_0xbdcb('0x2e')]);_0x393a13[_0xbdcb('0x2d')]=qs['offset'](_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}_0x393a13[_0xbdcb('0x55')]=qs['sort'](_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x393a13[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_['pick'](_0x1f79d7['query'],_0xb2ca36[_0xbdcb('0x4f')]));_0x393a13[_0xbdcb('0x57')][_0xbdcb('0xdc')]=_0x8c1c40['id'];if(_0x1f79d7['query'][_0xbdcb('0x59')]){_0x393a13[_0xbdcb('0x57')]=_['merge'](_0x393a13[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x393a13['attributes'],function(_0x23db65){var _0x52c8ed={};_0x52c8ed[_0x23db65]={'$like':'%'+_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0x59')]+'%'};return _0x52c8ed;})});}_0x393a13=_['merge']({},_0x393a13,_0x1f79d7[_0xbdcb('0x66')]);return db['MailInteraction']['count']({'where':_0x393a13['where']})[_0xbdcb('0x20')](function(_0x47d3e1){_0x43d1db[_0xbdcb('0x60')]=_0x47d3e1;if(_0x1f79d7[_0xbdcb('0x4d')][_0xbdcb('0xc7')]){_0x393a13[_0xbdcb('0x61')]=[{'all':!![]}];}return db['MailInteraction'][_0xbdcb('0x62')](_0x393a13);})[_0xbdcb('0x20')](function(_0x235873){_0x43d1db[_0xbdcb('0xd5')]=_0x235873;return _0x43d1db;});}})[_0xbdcb('0x20')](respondWithFilteredResult(_0x41432e,_0x393a13))[_0xbdcb('0x63')](handleError(_0x41432e,null));};exports[_0xbdcb('0xdd')]=function(_0x5829dd,_0x2d4da7,_0x496531){var _0x2d1292={};var _0x4b5488={};var _0x5730bf;var _0x2b08b0;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x5829dd[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x2d4da7,null))[_0xbdcb('0x20')](function(_0x153a84){if(_0x153a84){_0x5730bf=_0x153a84;_0x4b5488['model']=_[_0xbdcb('0x4e')](db[_0xbdcb('0xde')][_0xbdcb('0x48')]);_0x4b5488[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x5829dd[_0xbdcb('0x4d')]);_0x4b5488[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x4b5488['model'],_0x4b5488[_0xbdcb('0x4d')]);_0x2d1292['attributes']=_[_0xbdcb('0x50')](_0x4b5488[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x5829dd[_0xbdcb('0x4d')]['fields']));_0x2d1292['attributes']=_0x2d1292[_0xbdcb('0x52')]['length']?_0x2d1292[_0xbdcb('0x52')]:_0x4b5488[_0xbdcb('0x65')];_0x2d1292[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x5829dd[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x2d1292[_0xbdcb('0x57')]=qs['filters'](_[_0xbdcb('0x58')](_0x5829dd[_0xbdcb('0x4d')],_0x4b5488['filters']));if(_0x5829dd[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x2d1292[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x2d1292[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x2d1292['attributes'],function(_0xab64d7){var _0x2f7d0d={};_0x2f7d0d[_0xab64d7]={'$like':'%'+_0x5829dd['query'][_0xbdcb('0x59')]+'%'};return _0x2f7d0d;})});}_0x2d1292=_['merge']({},_0x2d1292,_0x5829dd[_0xbdcb('0x66')]);return _0x5730bf[_0xbdcb('0xdd')](_0x2d1292);}})[_0xbdcb('0x20')](function(_0xb84d04){if(_0xb84d04){_0x2b08b0=_0xb84d04[_0xbdcb('0x53')];if(!_0x5829dd[_0xbdcb('0x4d')][_0xbdcb('0x54')]('nolimit')){_0x2d1292[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x5829dd['query'][_0xbdcb('0x2e')]);_0x2d1292[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x5829dd[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);}return _0x5730bf[_0xbdcb('0xdd')](_0x2d1292);}})[_0xbdcb('0x20')](function(_0x42bd61){if(_0x42bd61){return _0x42bd61?{'count':_0x2b08b0,'rows':_0x42bd61}:null;}})[_0xbdcb('0x20')](respondWithResult(_0x2d4da7,null))[_0xbdcb('0x63')](handleError(_0x2d4da7,null));};exports['getFaxInteractions']=function(_0x40c0ce,_0x43f341,_0x54a01b){var _0x7265f7={};var _0x4bf3c0={};var _0x3402ba;var _0x50d902;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x40c0ce[_0xbdcb('0x64')]['id']}})['then'](handleEntityNotFound(_0x43f341,null))['then'](function(_0x37958a){if(_0x37958a){_0x3402ba=_0x37958a;_0x4bf3c0['model']=_[_0xbdcb('0x4e')](db['FaxInteraction']['rawAttributes']);_0x4bf3c0['query']=_['keys'](_0x40c0ce['query']);_0x4bf3c0['filters']=_[_0xbdcb('0x50')](_0x4bf3c0[_0xbdcb('0x65')],_0x4bf3c0[_0xbdcb('0x4d')]);_0x7265f7['attributes']=_[_0xbdcb('0x50')](_0x4bf3c0[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x40c0ce['query']['fields']));_0x7265f7[_0xbdcb('0x52')]=_0x7265f7[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x7265f7['attributes']:_0x4bf3c0['model'];_0x7265f7[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x40c0ce[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x7265f7[_0xbdcb('0x57')]=qs['filters'](_[_0xbdcb('0x58')](_0x40c0ce[_0xbdcb('0x4d')],_0x4bf3c0['filters']));if(_0x40c0ce[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x7265f7[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x7265f7[_0xbdcb('0x57')],{'$or':_['map'](_0x7265f7['attributes'],function(_0x4c976e){var _0x49abcc={};_0x49abcc[_0x4c976e]={'$like':'%'+_0x40c0ce[_0xbdcb('0x4d')]['filter']+'%'};return _0x49abcc;})});}_0x7265f7=_['merge']({},_0x7265f7,_0x40c0ce[_0xbdcb('0x66')]);return _0x3402ba[_0xbdcb('0xdf')](_0x7265f7);}})[_0xbdcb('0x20')](function(_0x3c574d){if(_0x3c574d){_0x50d902=_0x3c574d[_0xbdcb('0x53')];if(!_0x40c0ce['query']['hasOwnProperty']('nolimit')){_0x7265f7[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x40c0ce[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x7265f7[_0xbdcb('0x2d')]=qs['offset'](_0x40c0ce['query'][_0xbdcb('0x2d')]);}return _0x3402ba['getFaxInteractions'](_0x7265f7);}})[_0xbdcb('0x20')](function(_0x4af9ce){if(_0x4af9ce){return _0x4af9ce?{'count':_0x50d902,'rows':_0x4af9ce}:null;}})[_0xbdcb('0x20')](respondWithResult(_0x43f341,null))[_0xbdcb('0x63')](handleError(_0x43f341,null));};exports[_0xbdcb('0xe0')]=function(_0x32fbe1,_0xa8fa8d,_0x3ed012){var _0x42f859={};var _0x470b76={};var _0x2a2f96;var _0x312be6;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x32fbe1[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0xa8fa8d,null))[_0xbdcb('0x20')](function(_0x3ddbb1){if(_0x3ddbb1){_0x2a2f96=_0x3ddbb1;_0x470b76['model']=_['keys'](db[_0xbdcb('0xe1')][_0xbdcb('0x48')]);_0x470b76[_0xbdcb('0x4d')]=_[_0xbdcb('0x4e')](_0x32fbe1[_0xbdcb('0x4d')]);_0x470b76[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x470b76['model'],_0x470b76[_0xbdcb('0x4d')]);_0x42f859[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x470b76[_0xbdcb('0x65')],qs['fields'](_0x32fbe1[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x42f859[_0xbdcb('0x52')]=_0x42f859[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x42f859[_0xbdcb('0x52')]:_0x470b76[_0xbdcb('0x65')];_0x42f859[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x32fbe1[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x42f859['where']=qs['filters'](_[_0xbdcb('0x58')](_0x32fbe1[_0xbdcb('0x4d')],_0x470b76[_0xbdcb('0x4f')]));if(_0x32fbe1[_0xbdcb('0x4d')][_0xbdcb('0x59')]){_0x42f859[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x42f859['where'],{'$or':_[_0xbdcb('0x3e')](_0x42f859[_0xbdcb('0x52')],function(_0x1fcd56){var _0x4b2ddf={};_0x4b2ddf[_0x1fcd56]={'$like':'%'+_0x32fbe1[_0xbdcb('0x4d')]['filter']+'%'};return _0x4b2ddf;})});}_0x42f859=_[_0xbdcb('0x5a')]({},_0x42f859,_0x32fbe1[_0xbdcb('0x66')]);return _0x2a2f96['getWhatsappInteractions'](_0x42f859);}})[_0xbdcb('0x20')](function(_0x406d0a){if(_0x406d0a){_0x312be6=_0x406d0a['length'];if(!_0x32fbe1[_0xbdcb('0x4d')][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x42f859['limit']=qs[_0xbdcb('0x2e')](_0x32fbe1['query'][_0xbdcb('0x2e')]);_0x42f859[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x32fbe1[_0xbdcb('0x4d')]['offset']);}return _0x2a2f96[_0xbdcb('0xe0')](_0x42f859);}})[_0xbdcb('0x20')](function(_0x3a19d6){if(_0x3a19d6){return _0x3a19d6?{'count':_0x312be6,'rows':_0x3a19d6}:null;}})[_0xbdcb('0x20')](respondWithResult(_0xa8fa8d,null))[_0xbdcb('0x63')](handleError(_0xa8fa8d,null));};exports[_0xbdcb('0xe2')]=function(_0x37eb17,_0x24c547,_0x5836e0){var _0x18ceac;var _0x15f20a;var _0x2302ab;var _0x426422=!_[_0xbdcb('0x73')](_0x37eb17[_0xbdcb('0x64')]['id'])?_0x37eb17[_0xbdcb('0x64')]['id']:!_[_0xbdcb('0x73')](_0x37eb17[_0xbdcb('0x38')]['id'])?_0x37eb17[_0xbdcb('0x38')]['id']:null;return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0x426422,'role':{'$or':[_0xbdcb('0x8b'),'user',_0xbdcb('0x3a')]}},'attributes':['id','name',_0xbdcb('0xe3'),'mobile',_0xbdcb('0x36'),'internal',_0xbdcb('0xaa')]})[_0xbdcb('0x20')](function(_0x520b1f){if(_0x520b1f){if(_0x520b1f[_0xbdcb('0x36')]===_0xbdcb('0x3a')){_0x18ceac=_0x520b1f;if(_0x37eb17[_0xbdcb('0x68')][_0xbdcb('0xb6')]){_0x2302ab=util['format'](_0xbdcb('0xe4'),_0x18ceac[_0x37eb17[_0xbdcb('0x68')]['interface']]);}else if(_0x37eb17[_0xbdcb('0x68')][_0xbdcb('0xe5')]){_0x2302ab=util[_0xbdcb('0xb7')]('SIP/%s',_0x37eb17[_0xbdcb('0x68')]['intrf']);}else{_0x2302ab=util[_0xbdcb('0xb7')](_0xbdcb('0xe6'),_0x18ceac['name']);}socket['to'](util[_0xbdcb('0xb7')]('user:%s',_0x18ceac[_0xbdcb('0x42')]))[_0xbdcb('0xb3')]('user:forcelogout',{'user':{'id':_0x18ceac['id'],'name':_0x18ceac[_0xbdcb('0x42')]},'ip':_0x37eb17['headers']['x-forwarded-for']||_0x37eb17[_0xbdcb('0xe7')][_0xbdcb('0xe8')]||_0x37eb17[_0xbdcb('0xe9')][_0xbdcb('0xe8')]||_0x37eb17[_0xbdcb('0xe7')][_0xbdcb('0xe9')][_0xbdcb('0xe8')]});return db[_0xbdcb('0xbb')][_0xbdcb('0x34')]({'where':{'membername':_0x18ceac[_0xbdcb('0x42')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xbdcb('0x9e'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xbdcb('0x20')](function(){if(_0x18ceac){return _0x18ceac[_0xbdcb('0xea')]({'raw':!![]});}})[_0xbdcb('0x20')](function(_0x3e6092){if(_0x18ceac){var _0x425b23=[];if(_0x3e6092){_0x15f20a=_0x3e6092;if(_0x15f20a[_0xbdcb('0x53')]){for(var _0x301d52=0x0;_0x301d52<_0x15f20a['length'];_0x301d52++){_0x425b23[_0xbdcb('0x93')]({'membername':_0x18ceac[_0xbdcb('0x42')],'UserId':_0x18ceac['id'],'queue_name':_0x15f20a[_0x301d52][_0xbdcb('0x42')],'VoiceQueueId':_0x15f20a[_0x301d52]['id'],'interface':_0x2302ab,'paused':_0x18ceac[_0xbdcb('0xaa')]||![],'penalty':_0x15f20a[_0x301d52][_0xbdcb('0xeb')]||0x0});}return BPromise[_0xbdcb('0x95')](_0x425b23,function(_0x508679){return db[_0xbdcb('0xbb')]['upsert'](_0x508679);});}}}})[_0xbdcb('0x20')](function(){if(_0x18ceac){return db[_0xbdcb('0xec')][_0xbdcb('0x62')]({'where':{'membername':_0x18ceac[_0xbdcb('0x42')],'exitAt':null}});}})['then'](function(_0x39f90c){if(_0x18ceac){var _0x38e8c9=[];_0x39f90c['forEach'](function(_0x38965c){_0x38e8c9['push'](_0x38965c[_0xbdcb('0x67')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbdcb('0x94')](_0x38e8c9);}})[_0xbdcb('0x20')](function(){if(_0x18ceac){var _0x29c972=[];var _0x367ad1=[];var _0x2e0e65=utils[_0xbdcb('0xed')]();var _0x5acf7a={'membername':_0x18ceac[_0xbdcb('0x42')],'interface':_0x2302ab,'enterAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee')),'role':_0x18ceac[_0xbdcb('0x36')],'internal':_0x18ceac[_0xbdcb('0x6d')]};_0x2e0e65[_0xbdcb('0xef')](function(_0x1686b5){_0x29c972['push'](_[_0xbdcb('0x5a')]({'channel':_0x1686b5,'type':_0xbdcb('0xf0'),'data1':_0x37eb17['body'][_0xbdcb('0xf1')],'data2':_0x2302ab},_0x5acf7a));if(_0x18ceac['loginInPause']){_0x367ad1[_0xbdcb('0x93')](_['merge']({'channel':_0x1686b5,'type':_0xbdcb('0xf2'),'data1':_0xbdcb('0xf3')},_0x5acf7a));}});return db[_0xbdcb('0xec')][_0xbdcb('0x90')](_0x29c972[_0xbdcb('0xf4')](_0x367ad1),{'individualHooks':!![]});}})[_0xbdcb('0x20')](function(){if(_0x18ceac){return _0x18ceac['update']({'online':!![],'lastLoginAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee')),'voicePause':_0x18ceac[_0xbdcb('0xaa')]||![],'mailPause':_0x18ceac[_0xbdcb('0xaa')]||![],'chatPause':_0x18ceac[_0xbdcb('0xaa')]||![],'faxPause':_0x18ceac['loginInPause']||![],'smsPause':_0x18ceac[_0xbdcb('0xaa')]||![],'openchannelPause':_0x18ceac['loginInPause']||![],'whatsappPause':_0x18ceac[_0xbdcb('0xaa')]||![],'pauseType':_0x18ceac[_0xbdcb('0xaa')]?_0xbdcb('0xf3'):null,'interface':_0x2302ab,'lastPauseAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee'))});}})[_0xbdcb('0x20')](function(_0x52ef75){if(_0x37eb17[_0xbdcb('0xf5')]){return _0x5836e0();}else{return BPromise[_0xbdcb('0xf6')](_0x52ef75)[_0xbdcb('0x20')](respondWithResult(_0x24c547,null));}})[_0xbdcb('0x63')](handleError(_0x24c547,null));};exports[_0xbdcb('0xf7')]=function(_0x34e09e,_0xb5908d,_0x20f18f){var _0x58ad02;return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0x34e09e['params']['id'],'role':_0xbdcb('0x3a')},'attributes':['id',_0xbdcb('0x42'),_0xbdcb('0x36')]})[_0xbdcb('0x20')](handleEntityNotFound(_0xb5908d,null))['then'](function(_0x398730){if(_0x398730){_0x58ad02=_0x398730;return db[_0xbdcb('0xbb')][_0xbdcb('0x34')]({'where':{'membername':_0x58ad02[_0xbdcb('0x42')]},'individualHooks':!![]});}})[_0xbdcb('0x20')](function(){return db[_0xbdcb('0xec')][_0xbdcb('0x62')]({'where':{'membername':_0x58ad02[_0xbdcb('0x42')],'exitAt':null}});})[_0xbdcb('0x20')](function(_0x1793da){var _0x3d356a=[];_0x1793da[_0xbdcb('0xef')](function(_0x1296d7){_0x3d356a[_0xbdcb('0x93')](_0x1296d7[_0xbdcb('0x67')]({'exitAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee'))}));});return BPromise[_0xbdcb('0x94')](_0x3d356a);})['then'](function(){return _0x58ad02['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xb5908d,null))[_0xbdcb('0x63')](handleError(_0xb5908d,null));};exports['pause']=function(_0x2da5eb,_0x581a10,_0x5221d9){var _0x33a348;return db[_0xbdcb('0xbb')]['update']({'paused':0x1},{'where':{'UserId':_0x2da5eb[_0xbdcb('0x64')]['id']},'individualHooks':!![]})[_0xbdcb('0x20')](function(){return db[_0xbdcb('0x47')]['find']({'where':{'id':_0x2da5eb[_0xbdcb('0x64')]['id'],'role':_0xbdcb('0x3a')},'attributes':['id',_0xbdcb('0x42'),_0xbdcb('0x36'),_0xbdcb('0x6d'),_0xbdcb('0xb6')]});})[_0xbdcb('0x20')](handleEntityNotFound(_0x581a10,null))[_0xbdcb('0x20')](function(_0x5a40b1){if(_0x5a40b1){_0x33a348=_0x5a40b1;return respondWithRpcPromise(_0xbdcb('0xf8'),_0xbdcb('0xf9'),{'id':_0x33a348['id'],'name':_0x33a348[_0xbdcb('0x42')],'pause':!![]});}})[_0xbdcb('0x20')](function(){if(_0x33a348){return db['MemberReport'][_0xbdcb('0x62')]({'where':{'membername':_0x33a348[_0xbdcb('0x42')],'type':'PAUSE','exitAt':null}});}})[_0xbdcb('0x20')](function(_0x18ffca){if(_0x18ffca[_0xbdcb('0x53')]){var _0x8818ca=moment()[_0xbdcb('0xb7')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4e501c=0x0,_0x6b0ce6=_0x18ffca[_0xbdcb('0x53')];_0x4e501c<_0x6b0ce6;_0x4e501c++){_0x18ffca[_0x4e501c][_0xbdcb('0xfa')]({'exitAt':_0x8818ca});}}})['then'](function(){var _0x2cbc46=[];var _0x23e0a1=utils['getChannels']();_0x23e0a1['forEach'](function(_0x14ee40){_0x2cbc46['push']({'channel':_0x14ee40,'membername':_0x33a348[_0xbdcb('0x42')],'interface':_[_0xbdcb('0x73')](_0x33a348[_0xbdcb('0xb6')])?util[_0xbdcb('0xb7')](_0xbdcb('0xe6'),_0x33a348['name']):_0x33a348[_0xbdcb('0xb6')],'type':'PAUSE','enterAt':moment()[_0xbdcb('0xb7')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2da5eb[_0xbdcb('0x68')][_0xbdcb('0x5b')]||_0xbdcb('0xfb'),'role':_0x33a348['role'],'internal':_0x33a348[_0xbdcb('0x6d')]});});return db[_0xbdcb('0xec')]['bulkCreate'](_0x2cbc46,{'individualHooks':!![]});})[_0xbdcb('0x20')](function(){return _0x33a348['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2da5eb[_0xbdcb('0x68')][_0xbdcb('0x5b')]||_0xbdcb('0xfb'),'lastPauseAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee'))});})[_0xbdcb('0x20')](respondWithResult(_0x581a10,null))[_0xbdcb('0x63')](handleError(_0x581a10,null));};exports[_0xbdcb('0xfc')]=function(_0x2058d9,_0x2dbb45,_0x43edf1){var _0x4d291d;return db[_0xbdcb('0x47')]['find']({'where':{'id':_0x2058d9[_0xbdcb('0x64')]['id']},'attributes':['id',_0xbdcb('0x42'),_0xbdcb('0x36'),_0xbdcb('0xab'),_0xbdcb('0xfd'),_0xbdcb('0xfe'),_0xbdcb('0xff'),_0xbdcb('0x100'),_0xbdcb('0x101'),_0xbdcb('0x102'),_0xbdcb('0x103'),_0xbdcb('0x104')]})[_0xbdcb('0x20')](handleEntityNotFound(_0x2dbb45,null))[_0xbdcb('0x20')](function(_0x20a547){if(_0x20a547){_0x4d291d=_0x20a547;if(_0x2058d9['body'][_0xbdcb('0xa8')]&&!utils['isValidChannel'](_0x2058d9[_0xbdcb('0x68')][_0xbdcb('0xa8')])){throw new db[(_0xbdcb('0x9d'))]['ValidationError'](_0xbdcb('0xad'));}switch(_0x2058d9[_0xbdcb('0x68')][_0xbdcb('0xa8')]){case'voice':return respondWithRpcPromise(_0xbdcb('0xf8'),_0xbdcb('0xfc'),{'id':_0x4d291d['id'],'name':_0x4d291d[_0xbdcb('0x42')],'pause':![]})[_0xbdcb('0x20')](function(){return db[_0xbdcb('0xbb')][_0xbdcb('0x67')]({'paused':0x0},{'where':{'UserId':_0x4d291d['id']},'individualHooks':!![]});})[_0xbdcb('0x20')](function(){return db['MemberReport'][_0xbdcb('0x41')]({'where':{'channel':_0x2058d9['body'][_0xbdcb('0xa8')],'membername':_0x4d291d[_0xbdcb('0x42')],'type':_0xbdcb('0xf2'),'exitAt':null}});})[_0xbdcb('0x20')](function(_0x333520){if(_0x333520){return _0x333520[_0xbdcb('0x67')]({'exitAt':moment()[_0xbdcb('0xb7')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbdcb('0x105')},{'individualHooks':!![]});}return null;})[_0xbdcb('0x20')](function(){return _0x4d291d[_0xbdcb('0x67')]({'voicePause':![]});});case'mail':case'chat':case _0xbdcb('0x106'):case _0xbdcb('0x107'):case _0xbdcb('0x108'):case'openchannel':return db[_0xbdcb('0xec')][_0xbdcb('0x41')]({'where':{'channel':_0x2058d9[_0xbdcb('0x68')][_0xbdcb('0xa8')],'membername':_0x4d291d['name'],'type':_0xbdcb('0xf2'),'exitAt':null}})['then'](function(_0x3b7d55){if(_0x3b7d55){return _0x3b7d55[_0xbdcb('0x67')]({'exitAt':moment()[_0xbdcb('0xb7')](_0xbdcb('0xee')),'data2':_0xbdcb('0x105')},{'individualHooks':!![]});}return null;})[_0xbdcb('0x20')](function(){var _0x1e1b32={};_[_0xbdcb('0x2f')](_0x1e1b32,util[_0xbdcb('0xb7')](_0xbdcb('0x109'),_0x2058d9[_0xbdcb('0x68')][_0xbdcb('0xa8')],_0xbdcb('0x10a')),![]);return _0x4d291d['update'](_0x1e1b32);});default:return respondWithRpcPromise(_0xbdcb('0xf8'),_0xbdcb('0xfc'),{'id':_0x4d291d['id'],'name':_0x4d291d[_0xbdcb('0x42')],'pause':![]})[_0xbdcb('0x20')](function(){return db[_0xbdcb('0xbb')]['update']({'paused':0x0},{'where':{'UserId':_0x4d291d['id']}});})[_0xbdcb('0x20')](function(){return db[_0xbdcb('0xec')]['findAll']({'where':{'membername':_0x4d291d[_0xbdcb('0x42')],'type':'PAUSE','exitAt':null}});})[_0xbdcb('0x20')](function(_0x54f6ef){var _0x10c6df=[];_0x54f6ef[_0xbdcb('0xef')](function(_0x9106b4){_0x10c6df[_0xbdcb('0x93')](_0x9106b4[_0xbdcb('0x67')]({'exitAt':moment()['format'](_0xbdcb('0xee')),'data2':_0xbdcb('0x105')}));});return BPromise[_0xbdcb('0x94')](_0x10c6df);})[_0xbdcb('0x20')](function(){return _0x4d291d[_0xbdcb('0x67')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xbdcb('0x20')](respondWithResult(_0x2dbb45,null))[_0xbdcb('0x63')](handleError(_0x2dbb45,null));};exports[_0xbdcb('0x10b')]=function(_0x69929e,_0x516fcf,_0x331721){var _0x553714={};var _0x56fdc1={};var _0x25944b;var _0x4505ba;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x69929e[_0xbdcb('0x64')]['id']}})['then'](handleEntityNotFound(_0x516fcf,null))[_0xbdcb('0x20')](function(_0x68ea1f){if(_0x68ea1f){_0x25944b=_0x68ea1f;_0x56fdc1[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db['Team']['rawAttributes']);_0x56fdc1['query']=_[_0xbdcb('0x4e')](_0x69929e[_0xbdcb('0x4d')]);_0x56fdc1[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x56fdc1[_0xbdcb('0x65')],_0x56fdc1[_0xbdcb('0x4d')]);_0x553714[_0xbdcb('0x52')]=_[_0xbdcb('0x50')](_0x56fdc1['model'],qs[_0xbdcb('0x51')](_0x69929e[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x553714[_0xbdcb('0x52')]=_0x553714[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x553714[_0xbdcb('0x52')]:_0x56fdc1[_0xbdcb('0x65')];_0x553714[_0xbdcb('0x55')]=qs[_0xbdcb('0x56')](_0x69929e[_0xbdcb('0x4d')]['sort']);_0x553714[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_['pick'](_0x69929e[_0xbdcb('0x4d')],_0x56fdc1[_0xbdcb('0x4f')]));if(_0x69929e['query']['filter']){_0x553714[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x553714[_0xbdcb('0x57')],{'$or':_['map'](_0x553714[_0xbdcb('0x52')],function(_0x25d421){var _0xb63e87={};_0xb63e87[_0x25d421]={'$like':'%'+_0x69929e['query']['filter']+'%'};return _0xb63e87;})});}_0x553714=_['merge']({},_0x553714,_0x69929e[_0xbdcb('0x66')]);return _0x25944b[_0xbdcb('0x10b')](_0x553714);}})[_0xbdcb('0x20')](function(_0x389220){if(_0x389220){_0x4505ba=_0x389220['length'];if(!_0x69929e[_0xbdcb('0x4d')]['hasOwnProperty']('nolimit')){_0x553714[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x69929e[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x553714[_0xbdcb('0x2d')]=qs['offset'](_0x69929e['query'][_0xbdcb('0x2d')]);}return _0x25944b[_0xbdcb('0x10b')](_0x553714);}})[_0xbdcb('0x20')](function(_0x450f3e){if(_0x450f3e){return _0x450f3e?{'count':_0x4505ba,'rows':_0x450f3e}:null;}})[_0xbdcb('0x20')](respondWithResult(_0x516fcf,null))[_0xbdcb('0x63')](handleError(_0x516fcf,null));};exports['addTeams']=function(_0x39f821,_0xf79de){return db[_0xbdcb('0x47')][_0xbdcb('0x41')]({'where':{'id':_0x39f821[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0xf79de,null))['then'](function(_0x391e93){if(_0x391e93){var _0x20a16e=_0x391e93[_0xbdcb('0x35')]({'plain':!![]});return _0x391e93[_0xbdcb('0x10c')](_0x39f821[_0xbdcb('0x68')][_0xbdcb('0x6c')],_['omit'](_0x39f821[_0xbdcb('0x68')],[_0xbdcb('0x6c'),'id'])||{})[_0xbdcb('0x20')](function(){for(var _0x5ce1b2=0x0;_0x5ce1b2<_0x39f821[_0xbdcb('0x68')]['ids'][_0xbdcb('0x53')];_0x5ce1b2++){var _0x185a59=[];db[_0xbdcb('0x10d')][_0xbdcb('0xa2')]({'where':{'id':_0x39f821['body']['ids'][_0x5ce1b2]}})[_0xbdcb('0x20')](function(_0x1c9b54){_0x185a59['push'](_0x1c9b54[_0xbdcb('0xea')]()[_0xbdcb('0x20')](function(_0x764cbe){for(var _0x273c22=0x0;_0x273c22<_0x764cbe[_0xbdcb('0x53')];_0x273c22++){_0x764cbe[_0x273c22]['setDataValue'](_0xbdcb('0xa8'),_0xbdcb('0x10e'));}return _0x764cbe;}));_0x185a59[_0xbdcb('0x93')](_0x1c9b54[_0xbdcb('0x10f')]()[_0xbdcb('0x20')](function(_0x12d56d){for(var _0x3f4969=0x0;_0x3f4969<_0x12d56d['length'];_0x3f4969++){_0x12d56d[_0x3f4969][_0xbdcb('0x110')](_0xbdcb('0xa8'),'Chat');}return _0x12d56d;}));_0x185a59['push'](_0x1c9b54[_0xbdcb('0x111')]()['then'](function(_0x43f432){for(var _0x4fa706=0x0;_0x4fa706<_0x43f432[_0xbdcb('0x53')];_0x4fa706++){_0x43f432[_0x4fa706]['setDataValue']('channel','Mail');}return _0x43f432;}));_0x185a59[_0xbdcb('0x93')](_0x1c9b54['getSmsQueues']()[_0xbdcb('0x20')](function(_0x14212c){for(var _0xfff7bb=0x0;_0xfff7bb<_0x14212c[_0xbdcb('0x53')];_0xfff7bb++){_0x14212c[_0xfff7bb][_0xbdcb('0x110')](_0xbdcb('0xa8'),'Sms');}return _0x14212c;}));_0x185a59[_0xbdcb('0x93')](_0x1c9b54['getWhatsappQueues']()['then'](function(_0x244808){for(var _0x14f94a=0x0;_0x14f94a<_0x244808[_0xbdcb('0x53')];_0x14f94a++){_0x244808[_0x14f94a]['setDataValue'](_0xbdcb('0xa8'),_0xbdcb('0x112'));}return _0x244808;}));_0x185a59[_0xbdcb('0x93')](_0x1c9b54[_0xbdcb('0x113')]()['then'](function(_0x96638a){for(var _0x33921d=0x0;_0x33921d<_0x96638a['length'];_0x33921d++){_0x96638a[_0x33921d][_0xbdcb('0x110')]('channel',_0xbdcb('0x114'));}return _0x96638a;}));_0x185a59[_0xbdcb('0x93')](_0x1c9b54[_0xbdcb('0x115')]()['then'](function(_0x1b375c){for(var _0x5b633e=0x0;_0x5b633e<_0x1b375c['length'];_0x5b633e++){_0x1b375c[_0x5b633e][_0xbdcb('0x110')](_0xbdcb('0xa8'),_0xbdcb('0x116'));}return _0x1b375c;}));return BPromise['all'](_0x185a59);})['then'](function(_0x38f83f){var _0x570521=_[_0xbdcb('0x117')](_0x38f83f);_0x185a59=[];return db[_0xbdcb('0x5e')]['transaction'](function(_0x35a093){for(var _0x51db97=0x0;_0x51db97<_0x570521[_0xbdcb('0x53')];_0x51db97++){_0x185a59[_0xbdcb('0x93')](_0x570521[_0x51db97][_0xbdcb('0x118')](_0x20a16e['id']),{'transaction':_0x35a093});}return BPromise[_0xbdcb('0x94')](_0x185a59)[_0xbdcb('0x20')](function(){if(_0x20a16e['online']){return BPromise['each'](_[_0xbdcb('0x59')](_0x570521,function(_0x60f805){return _0x60f805['getDataValue'](_0xbdcb('0xa8'))===_0xbdcb('0x10e');}),function(_0x2e38ad){return db['UserVoiceQueueRt']['upsert']({'membername':_0x20a16e[_0xbdcb('0x42')],'UserId':_0x20a16e['id'],'queue_name':_0x2e38ad[_0xbdcb('0x42')],'VoiceQueueId':_0x2e38ad['id'],'interface':_[_0xbdcb('0x73')](_0x20a16e[_0xbdcb('0xb6')])?util['format'](_0xbdcb('0xe6'),_0x20a16e[_0xbdcb('0x42')]):_0x20a16e[_0xbdcb('0xb6')],'paused':_0x20a16e[_0xbdcb('0xab')]||![],'penalty':_0x20a16e[_0xbdcb('0xb0')]},{'transaction':_0x35a093});});}else{return;}})[_0xbdcb('0x20')](function(){for(var _0x4b7f2f=0x0;_0x4b7f2f<_0x570521[_0xbdcb('0x53')];_0x4b7f2f++){var _0x3b1fc5=_0x570521[_0x4b7f2f][_0xbdcb('0x119')](_0xbdcb('0xa8'));var _0x506937=_0x3b1fc5+'QueueId';socket[_0xbdcb('0xb3')](_0xbdcb('0x38')+_0x3b1fc5+_0xbdcb('0x11a'),{'UserId':_0x20a16e['id'],['queueField']:_0x570521[_0x4b7f2f]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xf79de,null))[_0xbdcb('0x63')](handleError(_0xf79de,null));};exports[_0xbdcb('0x11b')]=function(_0x2ce7ec,_0x593cc9){return db[_0xbdcb('0x47')]['findOne']({'where':{'id':_0x2ce7ec[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x593cc9,null))['then'](function(_0xbf48cf){if(_0xbf48cf){var _0x42c5a2=_0xbf48cf['get']({'plain':!![]});var _0x24b5a6=_0x2ce7ec[_0xbdcb('0x4d')][_0xbdcb('0x6c')];return _0xbf48cf['removeTeams'](_0x24b5a6)[_0xbdcb('0x20')](function(){for(var _0x4364e3=0x0;_0x4364e3<_0x24b5a6[_0xbdcb('0x53')];_0x4364e3++){var _0x67be03=[];db[_0xbdcb('0x10d')][_0xbdcb('0xa2')]({'where':{'id':_0x24b5a6[_0x4364e3]}})[_0xbdcb('0x20')](function(_0x242dfd){_0x67be03[_0xbdcb('0x93')](_0x242dfd[_0xbdcb('0xea')]()[_0xbdcb('0x20')](function(_0x278e6b){for(var _0x41da62=0x0;_0x41da62<_0x278e6b[_0xbdcb('0x53')];_0x41da62++){_0x278e6b[_0x41da62][_0xbdcb('0x110')](_0xbdcb('0xa8'),'Voice');}return _0x278e6b;}));_0x67be03['push'](_0x242dfd[_0xbdcb('0x10f')]()['then'](function(_0x2407d8){for(var _0x15edc3=0x0;_0x15edc3<_0x2407d8[_0xbdcb('0x53')];_0x15edc3++){_0x2407d8[_0x15edc3][_0xbdcb('0x110')](_0xbdcb('0xa8'),'Chat');}return _0x2407d8;}));_0x67be03[_0xbdcb('0x93')](_0x242dfd[_0xbdcb('0x111')]()[_0xbdcb('0x20')](function(_0x2ab0a0){for(var _0x38af03=0x0;_0x38af03<_0x2ab0a0[_0xbdcb('0x53')];_0x38af03++){_0x2ab0a0[_0x38af03]['setDataValue'](_0xbdcb('0xa8'),_0xbdcb('0x11c'));}return _0x2ab0a0;}));_0x67be03[_0xbdcb('0x93')](_0x242dfd[_0xbdcb('0x11d')]()['then'](function(_0x59852f){for(var _0x5705e4=0x0;_0x5705e4<_0x59852f[_0xbdcb('0x53')];_0x5705e4++){_0x59852f[_0x5705e4]['setDataValue'](_0xbdcb('0xa8'),_0xbdcb('0x11e'));}return _0x59852f;}));_0x67be03[_0xbdcb('0x93')](_0x242dfd[_0xbdcb('0x11f')]()[_0xbdcb('0x20')](function(_0x4683e9){for(var _0x105563=0x0;_0x105563<_0x4683e9[_0xbdcb('0x53')];_0x105563++){_0x4683e9[_0x105563][_0xbdcb('0x110')](_0xbdcb('0xa8'),_0xbdcb('0x112'));}return _0x4683e9;}));_0x67be03[_0xbdcb('0x93')](_0x242dfd[_0xbdcb('0x113')]()[_0xbdcb('0x20')](function(_0x5290fa){for(var _0xe3ce16=0x0;_0xe3ce16<_0x5290fa['length'];_0xe3ce16++){_0x5290fa[_0xe3ce16][_0xbdcb('0x110')]('channel','Fax');}return _0x5290fa;}));_0x67be03[_0xbdcb('0x93')](_0x242dfd['getOpenchannelQueues']()[_0xbdcb('0x20')](function(_0x3f8b81){for(var _0x1443b2=0x0;_0x1443b2<_0x3f8b81['length'];_0x1443b2++){_0x3f8b81[_0x1443b2][_0xbdcb('0x110')]('channel',_0xbdcb('0x116'));}return _0x3f8b81;}));return BPromise[_0xbdcb('0x94')](_0x67be03);})[_0xbdcb('0x20')](function(_0x1a0f63){var _0x18f216=_[_0xbdcb('0x117')](_0x1a0f63);_0x67be03=[];return db[_0xbdcb('0x5e')][_0xbdcb('0x120')](function(_0x3f75b8){for(var _0x103596=0x0;_0x103596<_0x18f216[_0xbdcb('0x53')];_0x103596++){_0x67be03[_0xbdcb('0x93')](_0x18f216[_0x103596][_0xbdcb('0x121')](_0x42c5a2['id']),{'transaction':_0x3f75b8});}return BPromise[_0xbdcb('0x94')](_0x67be03)[_0xbdcb('0x20')](function(){if(_0x42c5a2[_0xbdcb('0xa9')]){return BPromise[_0xbdcb('0x95')](_[_0xbdcb('0x59')](_0x18f216,function(_0x21be1c){return _0x21be1c[_0xbdcb('0x119')]('channel')===_0xbdcb('0x10e');}),function(_0x1c141d){return db[_0xbdcb('0xbb')][_0xbdcb('0x34')]({'where':{'VoiceQueueId':_0x1c141d['id'],'UserId':_0x42c5a2['id']},'transaction':_0x3f75b8});});}else{return;}})[_0xbdcb('0x20')](function(){for(var _0x129166=0x0;_0x129166<_0x18f216[_0xbdcb('0x53')];_0x129166++){var _0x9ccced=_0x18f216[_0x129166][_0xbdcb('0x119')](_0xbdcb('0xa8'));var _0x5d98cd=_0x9ccced+'QueueId';socket['emit']('user'+_0x9ccced+_0xbdcb('0x122'),{'UserId':_0x42c5a2['id'],['queueField']:_0x18f216[_0x129166]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x593cc9,null))[_0xbdcb('0x63')](handleError(_0x593cc9,null));};exports['getLists']=function(_0x15772f,_0x55829c,_0x201f58){var _0x4c0011={};var _0x49ea77={};var _0xc176a;var _0x2aa29b;return db[_0xbdcb('0x47')]['findOne']({'where':{'id':_0x15772f[_0xbdcb('0x64')]['id']}})['then'](handleEntityNotFound(_0x55829c,null))[_0xbdcb('0x20')](function(_0x2463b6){if(_0x2463b6){_0xc176a=_0x2463b6;_0x49ea77['model']=_['keys'](db[_0xbdcb('0xc8')][_0xbdcb('0x48')]);_0x49ea77['query']=_['keys'](_0x15772f['query']);_0x49ea77['filters']=_[_0xbdcb('0x50')](_0x49ea77[_0xbdcb('0x65')],_0x49ea77[_0xbdcb('0x4d')]);_0x4c0011['attributes']=_['intersection'](_0x49ea77[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x15772f[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x4c0011[_0xbdcb('0x52')]=_0x4c0011[_0xbdcb('0x52')][_0xbdcb('0x53')]?_0x4c0011[_0xbdcb('0x52')]:_0x49ea77[_0xbdcb('0x65')];_0x4c0011['order']=qs['sort'](_0x15772f['query'][_0xbdcb('0x56')]);_0x4c0011[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x15772f['query'],_0x49ea77[_0xbdcb('0x4f')]));if(_0x15772f[_0xbdcb('0x4d')]['filter']){_0x4c0011[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x4c0011[_0xbdcb('0x57')],{'$or':_['map'](_0x4c0011['attributes'],function(_0x383246){var _0xefa349={};_0xefa349[_0x383246]={'$like':'%'+_0x15772f[_0xbdcb('0x4d')]['filter']+'%'};return _0xefa349;})});}_0x4c0011=_[_0xbdcb('0x5a')]({},_0x4c0011,_0x15772f[_0xbdcb('0x66')]);return _0xc176a[_0xbdcb('0x123')](_0x4c0011);}})[_0xbdcb('0x20')](function(_0x5e6f6e){if(_0x5e6f6e){_0x2aa29b=_0x5e6f6e['length'];if(!_0x15772f['query'][_0xbdcb('0x54')](_0xbdcb('0xcc'))){_0x4c0011[_0xbdcb('0x2e')]=qs[_0xbdcb('0x2e')](_0x15772f[_0xbdcb('0x4d')][_0xbdcb('0x2e')]);_0x4c0011[_0xbdcb('0x2d')]=qs[_0xbdcb('0x2d')](_0x15772f[_0xbdcb('0x4d')]['offset']);}return _0xc176a[_0xbdcb('0x123')](_0x4c0011);}})[_0xbdcb('0x20')](function(_0x1d6650){if(_0x1d6650){return _0x1d6650?{'count':_0x2aa29b,'rows':_0x1d6650}:null;}})['then'](respondWithResult(_0x55829c,null))[_0xbdcb('0x63')](handleError(_0x55829c,null));};exports[_0xbdcb('0x124')]=function(_0x57a972,_0x216eb,_0x10a74e){var _0x4e54ae={};var _0x3042e9={};var _0x310ad4;var _0x40943d;return db[_0xbdcb('0x47')][_0xbdcb('0xa2')]({'where':{'id':_0x57a972[_0xbdcb('0x64')]['id']}})[_0xbdcb('0x20')](handleEntityNotFound(_0x216eb,null))['then'](function(_0x495c6c){if(_0x495c6c){_0x310ad4=_0x495c6c;_0x3042e9[_0xbdcb('0x65')]=_[_0xbdcb('0x4e')](db[_0xbdcb('0x47')][_0xbdcb('0x48')]);_0x3042e9[_0xbdcb('0x4d')]=_['keys'](_0x57a972[_0xbdcb('0x4d')]);_0x3042e9[_0xbdcb('0x4f')]=_[_0xbdcb('0x50')](_0x3042e9[_0xbdcb('0x65')],_0x3042e9['query']);_0x4e54ae[_0xbdcb('0x52')]=_['intersection'](_0x3042e9[_0xbdcb('0x65')],qs[_0xbdcb('0x51')](_0x57a972[_0xbdcb('0x4d')][_0xbdcb('0x51')]));_0x4e54ae[_0xbdcb('0x52')]=_0x4e54ae['attributes']['length']?_0x4e54ae['attributes']:_0x3042e9[_0xbdcb('0x65')];_0x4e54ae[_0xbdcb('0x55')]=qs['sort'](_0x57a972[_0xbdcb('0x4d')][_0xbdcb('0x56')]);_0x4e54ae[_0xbdcb('0x57')]=qs[_0xbdcb('0x4f')](_[_0xbdcb('0x58')](_0x57a972['query'],_0x3042e9[_0xbdcb('0x4f')]));if(_0x57a972['query'][_0xbdcb('0x59')]){_0x4e54ae[_0xbdcb('0x57')]=_[_0xbdcb('0x5a')](_0x4e54ae[_0xbdcb('0x57')],{'$or':_[_0xbdcb('0x3e')](_0x4e54ae[_0xbdcb('0x52')],function(_0x3b7fc7){var _0x4ca161={};_0x4ca161[_0x3b7fc7]={'$like':'%'+_0x57a972['query'][_0xbdcb('0x59')]+'%'};return _0x4ca161;})});}_0x4e54ae[_0xbdcb('0x65')]=db[_0xbdcb('0x47')];_0x4e54ae['as']='Agents';_0x4e54ae=_[_0xbdcb('0x5a')]({},_0x4e54ae,_0x57a972['options']);return _0x310ad4[_0xbdcb('0xea')]({'include':[_0x4e54ae]});}})[_0xbdcb('0x20')](function(_0x1b1d00){if(_0x1b1d00){var _0x2fd04e={},_0x347471=[],_0x29147c=0x0;for(var _0x113509=0x0;_0x113509<_0x1b1d00[_0xbdcb('0x53')];_0x113509+=0x1){for(var _0x4d53fc=0x0,_0x4fcede;_0x4d53fc<_0x1b1d00[_0x113509][_0xbdcb('0x39')]['length'];_0x4d53fc+=0x1){_0x4fcede=_0x1b1d00[_0x113509]['Agents'][_0x4d53fc][_0xbdcb('0x35')]({'plain':!![]});_0x2fd04e[_0x4fcede['id']]=_0x4fcede;}}_0x2fd04e=_['values'](_0x2fd04e);for(var _0x10e84a=qs['offset'](_0x57a972[_0xbdcb('0x4d')][_0xbdcb('0x2d')]);_0x10e84a<_0x2fd04e['length']&&_0x347471[_0xbdcb('0x53')]=_0x4df83b){_0x37957f=_0x4df83b;_0x443e9b=0xc8;}else{_0x443e9b=0xce;}_0x5b9f30[_0x0537('0x27')](_0x443e9b);return _0x5b9f30[_0x0537('0x2c')]('Content-Range',_0x48a466+'-'+_0x37957f+'/'+_0x4df83b)[_0x0537('0x29')](_0x1f98f5);}return null;};}function patchUpdates(_0x199d4f){return function(_0x410849){try{jsonpatch[_0x0537('0x2d')](_0x410849,_0x199d4f,!![]);}catch(_0x19ebe3){return BPromise[_0x0537('0x2e')](_0x19ebe3);}return _0x410849['save']();};}function saveUpdates(_0x4dc16a,_0x57a408){return function(_0x38e60a){if(_0x38e60a){return _0x38e60a[_0x0537('0x2f')](_0x4dc16a)[_0x0537('0x30')](function(_0x38ec41){return _0x38ec41;});}return null;};}function removeEntity(_0x45cf3e,_0x3a9dfe){return function(_0x42b7b9){if(_0x42b7b9){return _0x42b7b9[_0x0537('0x31')]()[_0x0537('0x30')](function(){var _0x5ce168=_0x42b7b9[_0x0537('0x32')]({'plain':!![]});if(_0x5ce168[_0x0537('0x33')]===_0x0537('0x34'))return;var _0x24cf31=[{'name':_0x0537('0x35'),'value':_0x0537('0x36'),'ignore':!![]},{'name':_0x0537('0x37'),'value':'agent','ignore':![]},{'name':_0x0537('0x38'),'value':_0x0537('0x39'),'ignore':![]}];var _0x1c2374=_(_0x24cf31)['filter'](_0x0537('0x3a'))[_0x0537('0x3b')]('value')['value']();if(_[_0x0537('0x3c')](_0x1c2374,_0x5ce168[_0x0537('0x33')])){return;}var _0x48db79=_[_0x0537('0x3d')](_0x24cf31,[_0x0537('0x3e'),_0x5ce168[_0x0537('0x33')]])[_0x0537('0x3f')];return db[_0x0537('0x40')]['destroy']({'where':{'type':_0x48db79,'resourceId':_0x5ce168['id']}})[_0x0537('0x30')](function(){return _0x42b7b9;});})[_0x0537('0x30')](function(){_0x45cf3e[_0x0537('0x27')](0xcc)[_0x0537('0x28')]();});}};}function handleEntityNotFound(_0x363d46,_0x3a899f){return function(_0x18709e){if(!_0x18709e){_0x363d46[_0x0537('0x26')](0x194);}return _0x18709e;};}function handleError(_0x5c9591,_0x2703cd){_0x2703cd=_0x2703cd||0x1f4;return function(_0x471203){logger[_0x0537('0x23')](_0x471203[_0x0537('0x41')]);if(_0x471203[_0x0537('0x3f')]){delete _0x471203[_0x0537('0x3f')];}_0x5c9591[_0x0537('0x27')](_0x2703cd)[_0x0537('0x42')](_0x471203);};}exports[_0x0537('0x43')]=function(_0x20531a,_0x9f9192){var _0x3b04fc={},_0x4559d9={},_0x5f1fbe={'count':0x0,'rows':[]};var _0x4a8c92=_['map'](db[_0x0537('0x44')][_0x0537('0x45')],function(_0x148181){return{'name':_0x148181[_0x0537('0x46')],'type':_0x148181[_0x0537('0x47')]['key']};});_0x4559d9[_0x0537('0x48')]=_[_0x0537('0x49')](_['map'](_0x4a8c92,_0x0537('0x3f')),['password',_0x0537('0x4a')]);_0x4559d9[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x20531a[_0x0537('0x4b')]);_0x4559d9[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x4559d9[_0x0537('0x48')],_0x4559d9[_0x0537('0x4b')]);_0x3b04fc[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x4559d9[_0x0537('0x48')],qs[_0x0537('0x50')](_0x20531a['query'][_0x0537('0x50')]));_0x3b04fc['attributes']=_0x3b04fc['attributes']['length']?_0x3b04fc[_0x0537('0x4f')]:_0x4559d9[_0x0537('0x48')];if(!_0x20531a['query'][_0x0537('0x51')](_0x0537('0x52'))){_0x3b04fc['limit']=qs[_0x0537('0x2b')](_0x20531a[_0x0537('0x4b')][_0x0537('0x2b')]);_0x3b04fc[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x20531a[_0x0537('0x4b')]['offset']);}_0x3b04fc[_0x0537('0x54')]=qs['sort'](_0x20531a[_0x0537('0x4b')][_0x0537('0x55')]);_0x3b04fc[_0x0537('0x56')]=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x20531a[_0x0537('0x4b')],_0x4559d9['filters']),_0x4a8c92);if(_0x20531a['query']['filter']){_0x3b04fc[_0x0537('0x56')]=_['merge'](_0x3b04fc['where'],{'$or':_[_0x0537('0x3b')](_0x4a8c92,function(_0x1fbf03){if(_0x1fbf03[_0x0537('0x47')]!==_0x0537('0x58')){return db[_0x0537('0x59')]['where'](db['sequelize']['fn']('lower',db[_0x0537('0x59')][_0x0537('0x5a')](_0x1fbf03[_0x0537('0x3f')])),{'$like':db[_0x0537('0x59')]['fn']('lower','%'+_0x20531a[_0x0537('0x4b')][_0x0537('0x5b')]+'%')});}})});}_0x3b04fc=_[_0x0537('0x5c')]({},_0x3b04fc,_0x20531a[_0x0537('0x5d')]);var _0x56c7a2={'where':_0x3b04fc['where']};return db[_0x0537('0x44')][_0x0537('0x2a')](_0x56c7a2)[_0x0537('0x30')](function(_0x16c3b1){_0x5f1fbe[_0x0537('0x2a')]=_0x16c3b1;if(_0x20531a[_0x0537('0x4b')][_0x0537('0x5e')]){_0x3b04fc[_0x0537('0x5f')]=[{'all':!![]}];}return db[_0x0537('0x44')][_0x0537('0x60')](_0x3b04fc);})['then'](function(_0x30c600){_0x5f1fbe[_0x0537('0x61')]=_0x30c600;return _0x5f1fbe;})[_0x0537('0x30')](respondWithFilteredResult(_0x9f9192,_0x3b04fc))[_0x0537('0x62')](handleError(_0x9f9192,null));};exports[_0x0537('0x63')]=function(_0x1cb1d4,_0xca941a){var _0x267cde={'raw':![],'where':{'id':_0x1cb1d4[_0x0537('0x64')]['id']}},_0x303cd1={};_0x303cd1[_0x0537('0x48')]=_[_0x0537('0x49')](_[_0x0537('0x4c')](db[_0x0537('0x44')]['rawAttributes']),['password',_0x0537('0x4a')]);_0x303cd1[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x1cb1d4[_0x0537('0x4b')]);_0x303cd1[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x303cd1[_0x0537('0x48')],_0x303cd1[_0x0537('0x4b')]);_0x267cde[_0x0537('0x4f')]=_['intersection'](_0x303cd1[_0x0537('0x48')],qs[_0x0537('0x50')](_0x1cb1d4[_0x0537('0x4b')][_0x0537('0x50')]));_0x267cde[_0x0537('0x4f')]=_0x267cde[_0x0537('0x4f')][_0x0537('0x65')]?_0x267cde[_0x0537('0x4f')]:_0x303cd1[_0x0537('0x48')];if(_0x1cb1d4[_0x0537('0x4b')][_0x0537('0x5e')]){_0x267cde[_0x0537('0x5f')]=[{'all':!![]}];}_0x267cde=_[_0x0537('0x5c')]({},_0x267cde,_0x1cb1d4[_0x0537('0x5d')]);return db[_0x0537('0x44')][_0x0537('0x3d')](_0x267cde)[_0x0537('0x30')](handleEntityNotFound(_0xca941a,null))[_0x0537('0x30')](respondWithResult(_0xca941a,null))['catch'](handleError(_0xca941a,null));};exports[_0x0537('0x2f')]=function(_0x4c6262,_0x4a4a16){if(_0x4c6262[_0x0537('0x66')]['id']){delete _0x4c6262['body']['id'];}delete _0x4c6262[_0x0537('0x66')][_0x0537('0x33')];return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x4c6262['params']['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x4a4a16,null))['then'](saveUpdates(_0x4c6262[_0x0537('0x66')],null))['then'](respondWithResult(_0x4a4a16,null))[_0x0537('0x62')](handleError(_0x4a4a16,null));};exports[_0x0537('0x67')]=function(_0x2997d8,_0x27c0a2){return db[_0x0537('0x44')][_0x0537('0x67')]()[_0x0537('0x30')](respondWithResult(_0x27c0a2,null))['catch'](handleError(_0x27c0a2,null));};exports[_0x0537('0x68')]=function(_0x52cd46,_0x43cff0,_0x143188){return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x52cd46[_0x0537('0x64')]['id']}})['then'](handleEntityNotFound(_0x43cff0,null))[_0x0537('0x30')](function(_0x28cc9d){if(_0x28cc9d){return _0x28cc9d[_0x0537('0x68')](_0x52cd46['body'][_0x0537('0x69')],_[_0x0537('0x6a')](_0x52cd46[_0x0537('0x66')],['ids','id'])||{});}})[_0x0537('0x30')](respondWithResult(_0x43cff0,null))[_0x0537('0x62')](handleError(_0x43cff0,null));};function validateUser(_0x5b422a){return new BPromise(function(_0x36534d,_0x27acd5){if(_0x5b422a[_0x0537('0x6b')])return _0x36534d(_0x5b422a);return db['Setting']['findById'](0x1)[_0x0537('0x30')](function(_0x16c101){if(_0x16c101[_0x0537('0x6c')])authService[_0x0537('0x6d')](_0x5b422a[_0x0537('0x6e')]);db[_0x0537('0x44')][_0x0537('0x6f')](_0x0537('0x6b'))['then'](function(_0x434f6d){if(_['isNil'](_0x434f6d)){_0x5b422a[_0x0537('0x6b')]=_0x16c101['min_internal']||0x1;return;}if(_['isNil'](_0x16c101[_0x0537('0x70')])||_0x16c101[_0x0537('0x70')]===_0x434f6d){_0x5b422a[_0x0537('0x6b')]=_0x434f6d+0x1;return;}if(_0x16c101['min_internal']>_0x434f6d){_0x5b422a['internal']=_0x16c101[_0x0537('0x70')];return;}return db[_0x0537('0x59')][_0x0537('0x4b')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0537('0x59')]['QueryTypes']['SELECT']})['then'](function(_0x4d5f48){if(_0x4d5f48&&_0x4d5f48[_0x0537('0x65')]){for(var _0x10c950=0x0,_0x1627c7=_0x4d5f48[_0x0537('0x65')];_0x10c950<_0x1627c7&&_[_0x0537('0x71')](_0x5b422a[_0x0537('0x6b')]);_0x10c950++){if(_0x16c101[_0x0537('0x70')]<=_0x4d5f48[_0x10c950][_0x0537('0x72')]){_0x5b422a['internal']=_0x4d5f48[_0x10c950][_0x0537('0x72')];}else if(_0x16c101[_0x0537('0x70')]>_0x4d5f48[_0x10c950][_0x0537('0x72')]&&_0x16c101['min_internal']<=_0x4d5f48[_0x10c950]['to']){_0x5b422a[_0x0537('0x6b')]=_0x16c101['min_internal'];}}}if(_['isNil'](_0x5b422a[_0x0537('0x6b')])){_0x5b422a[_0x0537('0x6b')]=_0x434f6d+0x1;}return _0x36534d(_0x5b422a);});});})[_0x0537('0x62')](function(_0x583fe1){_0x27acd5(_0x583fe1);});});}function updateUser(_0x6bc74d){return new BPromise(function(_0x4eb2cc,_0x3043f6){try{if(_0x6bc74d[_0x0537('0x73')]){_0x6bc74d[_0x0537('0x74')]=_0x6bc74d['internal'];_0x6bc74d['VoiceMail']={'mailbox':_0x6bc74d['internal'],'password':_0x6bc74d[_0x0537('0x6e')],'fullname':_0x6bc74d[_0x0537('0x75')],'email':_0x6bc74d[_0x0537('0x76')]};}if(_0x6bc74d[_0x0537('0x33')]==='agent'){if(!_0x6bc74d[_0x0537('0x77')])_0x6bc74d[_0x0537('0x77')]=[_0x0537('0x78'),_0x0537('0x79'),_0x0537('0x7a'),_0x0537('0x7b'),_0x0537('0x7c'),_0x0537('0x7d'),_0x0537('0x7e'),_0x0537('0x7f'),_0x0537('0x80'),'108',_0x0537('0x81'),_0x0537('0x82'),_0x0537('0x83'),_0x0537('0x84'),_0x0537('0x85')];}_0x4eb2cc(_0x6bc74d);}catch(_0x40a73d){_0x3043f6(_0x40a73d);}});}exports[_0x0537('0x86')]=function(_0x5d0071,_0x5b0102){if(_0x5d0071[_0x0537('0x36')]['role']===_0x0537('0x87'))throw new Error(_0x0537('0x88'));if(_0x5d0071[_0x0537('0x66')][_0x0537('0x33')]==='user'&&_0x5d0071[_0x0537('0x36')][_0x0537('0x33')]!==_0x0537('0x34')){throw new Error(_0x0537('0x89'));}if(_0x5d0071[_0x0537('0x66')][_0x0537('0x33')]===_0x0537('0x34')&&_0x5d0071[_0x0537('0x36')][_0x0537('0x33')]!==_0x0537('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x5d0071[_0x0537('0x66')]])[_0x0537('0x30')](function(){return validateUser(_0x5d0071[_0x0537('0x66')]);})[_0x0537('0x30')](function(_0x8f1968){return updateUser(_0x8f1968)[_0x0537('0x30')](function(_0x527874){if(_0x527874['role']==='admin'){_0x527874[_0x0537('0x8a')]=_0x5d0071[_0x0537('0x36')]['settingsEnabled'];delete _0x527874['userProfileId'];}return _0x527874;});})[_0x0537('0x30')](function(_0x6e5db4){return db[_0x0537('0x44')][_0x0537('0x86')](_0x6e5db4,{'include':[{'model':db[_0x0537('0x8b')],'as':_0x0537('0x8b')}]});})[_0x0537('0x30')](function(_0x34a921){if(_0x5d0071[_0x0537('0x66')][_0x0537('0x33')]==='user')return _0x34a921;if(_0x5d0071[_0x0537('0x36')]['role']!==_0x0537('0x36'))return _0x34a921;return db[_0x0537('0x8c')]['find']({'where':{'name':_0x34a921['role']==='agent'?_0x0537('0x37'):_0x0537('0x38'),'userProfileId':_0x5d0071[_0x0537('0x36')][_0x0537('0x8d')]},'raw':!![]})[_0x0537('0x30')](function(_0x18afea){if(!_0x18afea||_0x18afea[_0x0537('0x8e')]!=0x0)return _0x34a921;return db['UserProfileResource'][_0x0537('0x86')]({'name':_0x34a921[_0x0537('0x3f')],'resourceId':_0x34a921['id'],'type':_0x18afea[_0x0537('0x3f')],'sectionId':_0x18afea['id']},{})['then'](function(){return _0x34a921;});})[_0x0537('0x62')](function(_0x3ce0c4){logger[_0x0537('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ce0c4);throw _0x3ce0c4;});})[_0x0537('0x30')](respondWithResult(_0x5b0102,0xc9))[_0x0537('0x62')](handleError(_0x5b0102,null));};exports['bulkCreate']=function(_0x5aea0e,_0x2bd0a1){var _0x14981e=_0x5aea0e[_0x0537('0x66')];var _0x2ccda3=[];if(_0x5aea0e[_0x0537('0x36')]['role']==='agent')throw new Error(_0x0537('0x88'));if(_[_0x0537('0x8f')](_0x14981e,['role',_0x0537('0x36')])&&_0x5aea0e['user']['role']!==_0x0537('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x0537('0x8f')](_0x14981e,[_0x0537('0x33'),_0x0537('0x34')])&&_0x5aea0e[_0x0537('0x36')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x0537('0x90')](_0x14981e)['then'](function(){return validateUser(_0x14981e[0x0]);})[_0x0537('0x30')](function(){for(var _0x327f87=0x1;_0x327f87<_0x14981e[_0x0537('0x65')];_0x327f87++){var _0x29b491=_0x14981e[_0x327f87-0x1][_0x0537('0x6b')];if(!_0x14981e[_0x327f87]['internal'])_0x14981e[_0x327f87][_0x0537('0x6b')]=_0x29b491+0x1;_0x2ccda3[_0x0537('0x91')](validateUser(_0x14981e[_0x327f87]));}return BPromise[_0x0537('0x92')](_0x2ccda3);})[_0x0537('0x30')](function(){_0x2ccda3=[];for(var _0x69d4e7=0x0;_0x69d4e7<_0x14981e['length'];_0x69d4e7++){_0x2ccda3[_0x0537('0x91')](updateUser(_0x14981e[_0x69d4e7]));}return BPromise['all'](_0x2ccda3);})[_0x0537('0x30')](function(){return BPromise[_0x0537('0x93')](_0x14981e,function(_0x3ef41b){return db[_0x0537('0x44')]['create'](_0x3ef41b,{'include':[{'model':db[_0x0537('0x8b')],'as':_0x0537('0x8b')}]})[_0x0537('0x30')](function(_0x2cc10c){_0x3ef41b['id']=_0x2cc10c['id'];return _0x3ef41b;});});})[_0x0537('0x30')](function(_0x49f248){if(_0x5aea0e['body']['role']==='user')return _0x49f248;if(_0x5aea0e[_0x0537('0x36')][_0x0537('0x33')]!==_0x0537('0x36'))return _0x49f248;var _0x1c6b4a=_['some'](_0x49f248,function(_0x502e39){return _0x502e39[_0x0537('0x33')]==='agent'||_0x502e39[_0x0537('0x33')]==='telephone';});if(!_0x1c6b4a)return _0x49f248;return db[_0x0537('0x8c')][_0x0537('0x60')]({'where':{'name':{'$or':[_0x0537('0x37'),_0x0537('0x38')]},'userProfileId':_0x5aea0e[_0x0537('0x36')]['userProfileId']},'raw':!![]})['then'](function(_0x342f47){if(_[_0x0537('0x94')](_0x342f47)||!_[_0x0537('0x8f')](_0x342f47,[_0x0537('0x8e'),0x0]))return _0x49f248;_0x2ccda3=[];var _0x21ba16=_(_0x342f47)[_0x0537('0x3b')](function(_0x350bc6){if(_0x350bc6['autoAssociation']===0x1)return;return _0x350bc6['name']===_0x0537('0x37')?_0x0537('0x87'):_0x0537('0x39');})[_0x0537('0x95')]()['value']();for(var _0x522dc2=0x0;_0x522dc2<_0x49f248[_0x0537('0x65')];_0x522dc2++){if(!_[_0x0537('0x3c')](_0x21ba16,_0x49f248[_0x522dc2][_0x0537('0x33')]))return;var _0x33ddf7=_0x49f248[_0x522dc2][_0x0537('0x33')]===_0x0537('0x87')?_0x0537('0x37'):_0x0537('0x38');_0x2ccda3['push'](db[_0x0537('0x40')]['create']({'name':_0x49f248[_0x522dc2][_0x0537('0x3f')],'resourceId':_0x49f248[_0x522dc2]['id'],'type':_0x33ddf7,'sectionId':_[_0x0537('0x3d')](_0x342f47,[_0x0537('0x3f'),_0x33ddf7])['id']},{}));}return BPromise[_0x0537('0x92')](_0x2ccda3);});})[_0x0537('0x30')](respondWithResult(_0x2bd0a1,0xc9))[_0x0537('0x62')](handleError(_0x2bd0a1,null));};exports[_0x0537('0x96')]=function(_0x310879,_0x495270,_0x29269b){if(_0x310879['body']['id']){delete _0x310879[_0x0537('0x66')]['id'];}return db['User'][_0x0537('0x3d')]({'where':{'id':_0x310879[_0x0537('0x64')]['id']}})['then'](function(_0x12fd9c){if(!_0x12fd9c)return null;if(_0x12fd9c['id']===_0x310879[_0x0537('0x36')]['id']){if(!_0x310879[_0x0537('0x66')]['oldPassword']||!_0x310879[_0x0537('0x66')]['newPassword']){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0x99'));}if(!_0x12fd9c['authenticate'](_0x310879[_0x0537('0x66')][_0x0537('0x9a')])){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0x9b'));}if(_0x310879[_0x0537('0x66')][_0x0537('0x9a')]===_0x310879[_0x0537('0x66')]['newPassword']){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0x9c'));}}else if(_0x310879[_0x0537('0x36')]['role']===_0x0537('0x34')){if(!_0x310879[_0x0537('0x66')][_0x0537('0x9d')]){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0x9e'));}}else if(_0x310879[_0x0537('0x36')]['role']==='user'){if(!_0x310879[_0x0537('0x66')][_0x0537('0x9d')]){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x12fd9c[_0x0537('0x33')]!=='agent'){throw new db['Sequelize'][(_0x0537('0x98'))](_0x0537('0x88'));}}else{throw new db[(_0x0537('0x97'))]['ValidationError']('Unauthorized');}return _0x12fd9c;})[_0x0537('0x30')](handleEntityNotFound(_0x495270,null))[_0x0537('0x30')](function(_0x42c92d){return db[_0x0537('0x9f')][_0x0537('0xa0')]({'attributes':['id',_0x0537('0x6c'),_0x0537('0xa1'),_0x0537('0xa2')]})[_0x0537('0x30')](function(_0x454173){if(_0x454173[_0x0537('0x6c')])authService['validatePasswordPattern'](_0x310879[_0x0537('0x66')]['newPassword']);if(!_0x454173['enforcePasswordHistory']||!_0x42c92d[_0x0537('0xa3')])return _0x42c92d;authService[_0x0537('0xa4')](_0x310879[_0x0537('0x66')]['newPassword'],_0x42c92d[_0x0537('0xa3')],_0x454173[_0x0537('0xa2')]);return _0x42c92d;})[_0x0537('0x30')](saveUpdates({'password':_0x310879[_0x0537('0x66')]['newPassword'],'passwordResetAt':_0x310879['user']['id']==_0x310879[_0x0537('0x64')]['id']?moment():null,'previousPasswords':authService[_0x0537('0xa5')](_0x310879[_0x0537('0x66')]['newPassword'],_0x42c92d[_0x0537('0xa3')])},null));})[_0x0537('0x30')](respondWithResult(_0x495270,null))[_0x0537('0x62')](handleError(_0x495270,null));};exports['addQueues']=function(_0x26cadf,_0xb65bf8,_0x50a5d8){var _0x1ed66e=_0x26cadf['body'][_0x0537('0xa6')];return db['User'][_0x0537('0x3d')]({'where':{'id':_0x26cadf[_0x0537('0x64')]['id']},'attributes':['id',_0x0537('0x3f'),_0x0537('0x33'),_0x0537('0xa7'),_0x0537('0xa8'),_0x0537('0xa9'),_0x0537('0xaa')]})['then'](handleEntityNotFound(_0xb65bf8,null))[_0x0537('0x30')](function(_0x45fe0c){if(_0x45fe0c){if(!utils[_0x0537('0xab')](_0x1ed66e)){throw new db[(_0x0537('0x97'))]['ValidationError'](_0x0537('0xac'));}return _0x45fe0c['add'+_[_0x0537('0xad')](_0x1ed66e[_0x0537('0xae')]())+'Queues'](_0x26cadf[_0x0537('0x66')][_0x0537('0x69')],{'penalty':_0x26cadf['body']['penalty']||0x0})[_0x0537('0xaf')](function(_0x116322){for(var _0x2673ab=0x0;_0x2673ab<_0x26cadf[_0x0537('0x66')][_0x0537('0x69')]['length'];_0x2673ab+=0x1){var _0x169b8e={'UserId':_0x26cadf[_0x0537('0x64')]['id']};_0x169b8e[_['capitalize'](_0x1ed66e['toLowerCase']())+_0x0537('0xb0')]=_0x26cadf[_0x0537('0x66')][_0x0537('0x69')][_0x2673ab];socket[_0x0537('0xb1')](_0x0537('0x36')+_['capitalize'](_0x1ed66e[_0x0537('0xae')]())+_0x0537('0xb2'),_0x169b8e);}return _0x116322;})[_0x0537('0x30')](function(){if(_0x1ed66e===_0x0537('0xb3')){return db[_0x0537('0xb4')][_0x0537('0x60')]({'where':{'id':_0x26cadf['body'][_0x0537('0x69')]||[]},'raw':!![],'attributes':['id',_0x0537('0x3f')]});}})[_0x0537('0x30')](function(_0x5b2412){var _0x52d6c4=_0x45fe0c[_0x0537('0x32')]({'plain':!![]});var _0x3be2b8=[];if(_0x1ed66e===_0x0537('0xb3')&&_0x52d6c4[_0x0537('0x33')]===_0x0537('0x87')&&_0x52d6c4[_0x0537('0xa7')]){for(var _0x48e444=0x0;_0x48e444<_0x5b2412[_0x0537('0x65')];_0x48e444+=0x1){_0x3be2b8[_0x0537('0x91')]({'membername':_0x52d6c4[_0x0537('0x3f')],'UserId':_0x52d6c4['id'],'queue_name':_0x5b2412[_0x48e444][_0x0537('0x3f')],'VoiceQueueId':_0x5b2412[_0x48e444]['id'],'interface':_['isNil'](_0x52d6c4[_0x0537('0xaa')])?util['format'](_0x0537('0xb5'),_0x52d6c4[_0x0537('0x3f')]):_0x52d6c4[_0x0537('0xaa')],'paused':_0x52d6c4['voicePause']||![],'penalty':_0x26cadf[_0x0537('0x66')][_0x0537('0xb6')]||0x0});}return BPromise['each'](_0x3be2b8,function(_0x348e84){return db[_0x0537('0xb7')][_0x0537('0xb8')](_0x348e84);});}return _0x45fe0c;});}})[_0x0537('0x30')](respondWithStatusCode(_0xb65bf8,null))[_0x0537('0x62')](handleError(_0xb65bf8,null));};exports[_0x0537('0xb9')]=function(_0x348b7e,_0x35416d,_0x39950e){var _0x3e7cb2;return db[_0x0537('0x44')]['find']({'where':{'id':_0x348b7e[_0x0537('0x64')]['id']},'attributes':['id','name','role']})[_0x0537('0x30')](handleEntityNotFound(_0x35416d,null))[_0x0537('0x30')](function(_0x2875ca){if(_0x2875ca){_0x3e7cb2=_0x2875ca;if(!_0x348b7e['query'][_0x0537('0xa6')]||!utils[_0x0537('0xab')](_0x348b7e[_0x0537('0x4b')]['channel'])){throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0xac'));}return _0x2875ca['remove'+_[_0x0537('0xad')](_0x348b7e[_0x0537('0x4b')][_0x0537('0xa6')][_0x0537('0xae')]())+_0x0537('0xba')](_0x348b7e[_0x0537('0x4b')][_0x0537('0x69')]);}})[_0x0537('0x30')](function(_0x493c05){for(var _0x322bdd=0x0;_0x322bdd<_0x348b7e[_0x0537('0x4b')][_0x0537('0x69')]['length'];_0x322bdd+=0x1){var _0xfa7b2b={'UserId':_0x348b7e[_0x0537('0x64')]['id']};_0xfa7b2b[_[_0x0537('0xad')](_0x348b7e[_0x0537('0x4b')]['channel'][_0x0537('0xae')]())+_0x0537('0xb0')]=_0x348b7e[_0x0537('0x4b')][_0x0537('0x69')][_0x322bdd];socket[_0x0537('0xb1')](_0x0537('0x36')+_[_0x0537('0xad')](_0x348b7e[_0x0537('0x4b')][_0x0537('0xa6')][_0x0537('0xae')]())+_0x0537('0xbb'),_0xfa7b2b);}return _0x493c05;})[_0x0537('0x30')](function(){if(_0x348b7e['query'][_0x0537('0xa6')]===_0x0537('0xb3')){return db[_0x0537('0xb7')]['destroy']({'where':{'UserId':_0x348b7e[_0x0537('0x64')]['id'],'VoiceQueueId':_0x348b7e[_0x0537('0x4b')][_0x0537('0x69')]},'individualHooks':!![]})['then'](function(){return _0x3e7cb2;});}return _0x3e7cb2;})['then'](respondWithStatusCode(_0x35416d,null))[_0x0537('0x62')](handleError(_0x35416d,null));};exports[_0x0537('0xbc')]=function(_0x5b0f38,_0x1b24f7,_0x4a3e35){_0x5b0f38[_0x0537('0x66')][_0x0537('0xbd')]=_0x5b0f38[_0x0537('0xbe')]['filename'];return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x5b0f38['params']['id']}})['then'](handleEntityNotFound(_0x1b24f7,null))[_0x0537('0x30')](saveUpdates(_0x5b0f38[_0x0537('0x66')],null))['then'](respondWithResult(_0x1b24f7,null))[_0x0537('0x62')](handleError(_0x1b24f7,null));};exports[_0x0537('0xbf')]=function(_0x319732,_0x2531aa,_0x424c8b){var _0x12d8a9=path[_0x0537('0xc0')](config[_0x0537('0xc1')],_0x0537('0xc2'));return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x319732[_0x0537('0x64')]['id']},'attributes':['id',_0x0537('0xbd')],'raw':!![]})[_0x0537('0x30')](handleEntityNotFound(_0x2531aa,null))['then'](function(_0x4257e5){if(_0x4257e5){if(_[_0x0537('0x71')](_0x4257e5[_0x0537('0xbd')])){return _0x2531aa[_0x0537('0xc3')](_0x12d8a9);}else{if(!fs[_0x0537('0xc4')](path['join'](config[_0x0537('0xc1')],_0x0537('0xc5'),_0x4257e5[_0x0537('0xbd')]))){return _0x2531aa[_0x0537('0xc3')](_0x12d8a9);}return _0x2531aa['download'](path['join'](config['root'],'server/files/images/',_0x4257e5[_0x0537('0xbd')]));}}})[_0x0537('0x62')](handleError(_0x2531aa,null));};exports[_0x0537('0xc6')]=function(_0x6f7edb,_0x4227ca,_0x422674){var _0x4dc25c={};var _0x1875d3={};var _0x5e0505;var _0x17a432;return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x6f7edb[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x4227ca,null))['then'](function(_0x27c17e){if(_0x27c17e){_0x5e0505=_0x27c17e;_0x1875d3[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xc7')][_0x0537('0x45')]);_0x1875d3[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x6f7edb[_0x0537('0x4b')]);_0x1875d3[_0x0537('0x4d')]=_['intersection'](_0x1875d3[_0x0537('0x48')],_0x1875d3[_0x0537('0x4b')]);_0x4dc25c[_0x0537('0x4f')]=_['intersection'](_0x1875d3[_0x0537('0x48')],qs['fields'](_0x6f7edb['query']['fields']));_0x4dc25c[_0x0537('0x4f')]=_0x4dc25c[_0x0537('0x4f')][_0x0537('0x65')]?_0x4dc25c[_0x0537('0x4f')]:_0x1875d3[_0x0537('0x48')];_0x4dc25c[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x6f7edb[_0x0537('0x4b')][_0x0537('0x55')]);_0x4dc25c[_0x0537('0x56')]=qs[_0x0537('0x4d')](_['pick'](_0x6f7edb[_0x0537('0x4b')],_0x1875d3['filters']));if(_0x6f7edb['query'][_0x0537('0x5b')]){_0x4dc25c['where']=_[_0x0537('0x5c')](_0x4dc25c[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x4dc25c['attributes'],function(_0x5bfcbb){var _0x10c04d={};_0x10c04d[_0x5bfcbb]={'$like':'%'+_0x6f7edb[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x10c04d;})});}_0x4dc25c=_[_0x0537('0x5c')]({},_0x4dc25c,_0x6f7edb['options']);return _0x5e0505['getContacts'](_0x4dc25c);}})[_0x0537('0x30')](function(_0x26bfc0){if(_0x26bfc0){_0x17a432=_0x26bfc0[_0x0537('0x65')];if(_0x6f7edb[_0x0537('0x4b')][_0x0537('0x51')](_0x0537('0x5e'))){_0x4dc25c[_0x0537('0x5f')]=[{'model':db[_0x0537('0xc8')],'as':_0x0537('0xc9'),'required':![]},{'model':db['Tag'],'as':_0x0537('0xca'),'attributes':['id','name',_0x0537('0xcb')],'where':_0x6f7edb[_0x0537('0x4b')][_0x0537('0xcc')]?{'id':_0x6f7edb[_0x0537('0x4b')]['tag']}:undefined,'required':_0x6f7edb[_0x0537('0x4b')]['tag']?!![]:![]}];}if(!_0x6f7edb['query']['hasOwnProperty']('nolimit')){_0x4dc25c['limit']=qs[_0x0537('0x2b')](_0x6f7edb[_0x0537('0x4b')]['limit']);_0x4dc25c['offset']=qs['offset'](_0x6f7edb[_0x0537('0x4b')]['offset']);}return _0x5e0505['getContacts'](_0x4dc25c);}})['then'](function(_0xb54003){if(_0xb54003){return _0xb54003?{'count':_0x17a432,'rows':_0xb54003}:null;}})[_0x0537('0x30')](respondWithResult(_0x4227ca,null))['catch'](handleError(_0x4227ca,null));};exports[_0x0537('0xcd')]=function(_0x4a9cbb,_0x55d884,_0x42f937){var _0x120d8c;var _0x488b58;var _0x5cbff0={};var _0x55552e;return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x4a9cbb[_0x0537('0x64')]['id']},'attributes':['id','name',_0x0537('0x33')]})[_0x0537('0x30')](handleEntityNotFound(_0x55d884,null))[_0x0537('0x30')](function(_0x1a1553){if(!utils[_0x0537('0xab')](_0x4a9cbb[_0x0537('0x4b')][_0x0537('0xa6')])){throw new db['Sequelize'][(_0x0537('0x98'))](_0x0537('0xac'));}_0x120d8c=_0x1a1553;var _0x5d9bc8={};_0x5d9bc8[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_[_0x0537('0xad')](_0x4a9cbb['query'][_0x0537('0xa6')])+_0x0537('0xce')][_0x0537('0x45')]);_0x5d9bc8[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x4a9cbb[_0x0537('0x4b')]);_0x5d9bc8[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x5d9bc8['model'],_0x5d9bc8[_0x0537('0x4b')]);_0x5cbff0[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x5d9bc8['model'],qs[_0x0537('0x50')](_0x4a9cbb['query'][_0x0537('0x50')]));_0x5cbff0['attributes']=_0x5cbff0[_0x0537('0x4f')][_0x0537('0x65')]?_0x5cbff0[_0x0537('0x4f')]:_0x5d9bc8[_0x0537('0x48')];_0x5cbff0[_0x0537('0x54')]=qs['sort'](_0x4a9cbb[_0x0537('0x4b')]['sort']);_0x5cbff0[_0x0537('0x56')]=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x4a9cbb[_0x0537('0x4b')],_0x5d9bc8['filters']));if(_0x4a9cbb['query'][_0x0537('0x5b')]){_0x5cbff0[_0x0537('0x56')]=_['merge'](_0x5cbff0[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x5cbff0['attributes'],function(_0x1227c2){var _0x4c2969={};_0x4c2969[_0x1227c2]={'$like':'%'+_0x4a9cbb[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x4c2969;})});}_0x5cbff0=_[_0x0537('0x5c')]({},_0x5cbff0,_0x4a9cbb[_0x0537('0x5d')]);switch(_0x120d8c[_0x0537('0x33')]){case _0x0537('0x34'):return db[_[_0x0537('0xad')](_0x4a9cbb['query']['channel'])+'Queue'][_0x0537('0x60')](_0x5cbff0);case _0x0537('0x36'):case'agent':return _0x120d8c['get'+_['capitalize'](_0x4a9cbb[_0x0537('0x4b')]['channel'])+_0x0537('0xba')](_0x5cbff0);default:throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))](_0x0537('0xcf'));}})[_0x0537('0x30')](function(_0x1e1638){_0x55552e=_0x1e1638[_0x0537('0x65')];if(!_0x4a9cbb[_0x0537('0x4b')][_0x0537('0x51')](_0x0537('0x52'))){_0x5cbff0[_0x0537('0x2b')]=qs['limit'](_0x4a9cbb[_0x0537('0x4b')][_0x0537('0x2b')]);_0x5cbff0['offset']=qs[_0x0537('0x53')](_0x4a9cbb['query']['offset']);}switch(_0x120d8c[_0x0537('0x33')]){case _0x0537('0x34'):return db[_[_0x0537('0xad')](_0x4a9cbb[_0x0537('0x4b')][_0x0537('0xa6')])+'Queue'][_0x0537('0x60')](_0x5cbff0);case _0x0537('0x36'):case _0x0537('0x87'):return _0x120d8c[_0x0537('0x32')+_[_0x0537('0xad')](_0x4a9cbb[_0x0537('0x4b')]['channel'])+'Queues'](_0x5cbff0);}})[_0x0537('0x30')](function(_0x4deeec){return{'count':_0x55552e,'rows':_0x4deeec};})['then'](respondWithResult(_0x55d884,null))[_0x0537('0x62')](handleError(_0x55d884,null));};exports[_0x0537('0xd0')]=function(_0x5cfc1b,_0x3e8004,_0x290b4e){var _0xcd8d37={};var _0x167a68={};var _0x3ba1d5;var _0x25f6db;return db['User'][_0x0537('0xa0')]({'where':{'id':_0x5cfc1b[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x3e8004,null))[_0x0537('0x30')](function(_0x3f2413){if(_0x3f2413){_0x3ba1d5=_0x3f2413;_0x167a68[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xb7')][_0x0537('0x45')]);_0x167a68[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x5cfc1b[_0x0537('0x4b')]);_0x167a68[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x167a68[_0x0537('0x48')],_0x167a68[_0x0537('0x4b')]);_0xcd8d37[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x167a68[_0x0537('0x48')],qs[_0x0537('0x50')](_0x5cfc1b[_0x0537('0x4b')][_0x0537('0x50')]));_0xcd8d37['attributes']=_0xcd8d37[_0x0537('0x4f')][_0x0537('0x65')]?_0xcd8d37[_0x0537('0x4f')]:_0x167a68[_0x0537('0x48')];_0xcd8d37[_0x0537('0x54')]=qs['sort'](_0x5cfc1b[_0x0537('0x4b')][_0x0537('0x55')]);_0xcd8d37[_0x0537('0x56')]=qs[_0x0537('0x4d')](_['pick'](_0x5cfc1b[_0x0537('0x4b')],_0x167a68[_0x0537('0x4d')]));if(_0x5cfc1b['query'][_0x0537('0x5b')]){_0xcd8d37[_0x0537('0x56')]=_[_0x0537('0x5c')](_0xcd8d37['where'],{'$or':_[_0x0537('0x3b')](_0xcd8d37[_0x0537('0x4f')],function(_0x2f124f){var _0x58bd83={};_0x58bd83[_0x2f124f]={'$like':'%'+_0x5cfc1b[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x58bd83;})});}_0xcd8d37=_['merge']({},_0xcd8d37,_0x5cfc1b[_0x0537('0x5d')]);return _0x3ba1d5[_0x0537('0xd0')](_0xcd8d37);}})[_0x0537('0x30')](function(_0x2a942b){if(_0x2a942b){_0x25f6db=_0x2a942b[_0x0537('0x65')];if(!_0x5cfc1b['query'][_0x0537('0x51')](_0x0537('0x52'))){_0xcd8d37[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x5cfc1b['query'][_0x0537('0x2b')]);_0xcd8d37[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x5cfc1b[_0x0537('0x4b')][_0x0537('0x53')]);}return _0x3ba1d5[_0x0537('0xd0')](_0xcd8d37);}})[_0x0537('0x30')](function(_0x114c35){if(_0x114c35){return _0x114c35?{'count':_0x25f6db,'rows':_0x114c35}:null;}})['then'](respondWithResult(_0x3e8004,null))['catch'](handleError(_0x3e8004,null));};exports['getGroups']=function(_0x1381af,_0x5b2818,_0x5a3ab1){var _0x485add={};var _0x49c828={};var _0x32e25a;var _0xbeeb2e;return db[_0x0537('0x44')]['findOne']({'where':{'id':_0x1381af[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x5b2818,null))['then'](function(_0x85e303){if(_0x85e303){_0x32e25a=_0x85e303;_0x49c828[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xd1')][_0x0537('0x45')]);_0x49c828[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x1381af['query']);_0x49c828[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x49c828[_0x0537('0x48')],_0x49c828[_0x0537('0x4b')]);_0x485add[_0x0537('0x4f')]=_['intersection'](_0x49c828[_0x0537('0x48')],qs[_0x0537('0x50')](_0x1381af['query'][_0x0537('0x50')]));_0x485add[_0x0537('0x4f')]=_0x485add[_0x0537('0x4f')]['length']?_0x485add[_0x0537('0x4f')]:_0x49c828[_0x0537('0x48')];_0x485add[_0x0537('0x54')]=qs['sort'](_0x1381af[_0x0537('0x4b')][_0x0537('0x55')]);_0x485add['where']=qs[_0x0537('0x4d')](_['pick'](_0x1381af[_0x0537('0x4b')],_0x49c828[_0x0537('0x4d')]));if(_0x1381af['query'][_0x0537('0x5b')]){_0x485add[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x485add[_0x0537('0x56')],{'$or':_['map'](_0x485add[_0x0537('0x4f')],function(_0xb5d4a9){var _0x5166de={};_0x5166de[_0xb5d4a9]={'$like':'%'+_0x1381af['query']['filter']+'%'};return _0x5166de;})});}_0x485add=_[_0x0537('0x5c')]({},_0x485add,_0x1381af[_0x0537('0x5d')]);return _0x32e25a[_0x0537('0xd2')](_0x485add);}})[_0x0537('0x30')](function(_0x4e9dfc){if(_0x4e9dfc){_0xbeeb2e=_0x4e9dfc['length'];if(!_0x1381af['query'][_0x0537('0x51')]('nolimit')){_0x485add[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x1381af[_0x0537('0x4b')]['limit']);_0x485add[_0x0537('0x53')]=qs['offset'](_0x1381af[_0x0537('0x4b')]['offset']);}return _0x32e25a['getGroups'](_0x485add);}})[_0x0537('0x30')](function(_0xf9348b){if(_0xf9348b){return _0xf9348b?{'count':_0xbeeb2e,'rows':_0xf9348b}:null;}})[_0x0537('0x30')](respondWithResult(_0x5b2818,null))['catch'](handleError(_0x5b2818,null));};exports[_0x0537('0xd3')]=function(_0x19f4a0,_0x13e031,_0x4fa767){var _0x28cc64={'raw':!![],'where':{}};var _0x2e383d={};var _0x5d5220={'count':0x0,'rows':[]};return db['User'][_0x0537('0xa0')]({'where':{'id':_0x19f4a0[_0x0537('0x64')]['id']}})['then'](handleEntityNotFound(_0x13e031,null))[_0x0537('0x30')](function(_0x144b1c){if(_0x144b1c){_0x2e383d[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xd4')][_0x0537('0x45')]);_0x2e383d[_0x0537('0x4b')]=_['keys'](_0x19f4a0[_0x0537('0x4b')]);_0x2e383d[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x2e383d[_0x0537('0x48')],_0x2e383d[_0x0537('0x4b')]);_0x28cc64['attributes']=_[_0x0537('0x4e')](_0x2e383d[_0x0537('0x48')],qs[_0x0537('0x50')](_0x19f4a0[_0x0537('0x4b')]['fields']));_0x28cc64[_0x0537('0x4f')]=_0x28cc64[_0x0537('0x4f')][_0x0537('0x65')]?_0x28cc64[_0x0537('0x4f')]:_0x2e383d[_0x0537('0x48')];if(!_0x19f4a0[_0x0537('0x4b')]['hasOwnProperty']('nolimit')){_0x28cc64['limit']=qs['limit'](_0x19f4a0['query']['limit']);_0x28cc64[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x19f4a0[_0x0537('0x4b')][_0x0537('0x53')]);}_0x28cc64[_0x0537('0x54')]=qs['sort'](_0x19f4a0[_0x0537('0x4b')][_0x0537('0x55')]);_0x28cc64[_0x0537('0x56')]=qs['filters'](_['pick'](_0x19f4a0['query'],_0x2e383d[_0x0537('0x4d')]));_0x28cc64['where'][_0x0537('0xd5')]=_0x144b1c['id'];if(_0x19f4a0[_0x0537('0x4b')]['filter']){_0x28cc64['where']=_[_0x0537('0x5c')](_0x28cc64['where'],{'$or':_[_0x0537('0x3b')](_0x28cc64[_0x0537('0x4f')],function(_0x553f7f){var _0x2cf943={};_0x2cf943[_0x553f7f]={'$like':'%'+_0x19f4a0[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x2cf943;})});}_0x28cc64=_[_0x0537('0x5c')]({},_0x28cc64,_0x19f4a0['options']);return db['VoiceRecording']['count']({'where':_0x28cc64[_0x0537('0x56')]})[_0x0537('0x30')](function(_0x676045){_0x5d5220[_0x0537('0x2a')]=_0x676045;if(_0x19f4a0['query'][_0x0537('0x5e')]){_0x28cc64[_0x0537('0x5f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x0537('0x60')](_0x28cc64);})[_0x0537('0x30')](function(_0x543801){_0x5d5220['rows']=_0x543801;return _0x5d5220;});}})[_0x0537('0x30')](respondWithFilteredResult(_0x13e031,_0x28cc64))['catch'](handleError(_0x13e031,null));};exports[_0x0537('0xd6')]=function(_0x3e7e8e,_0x4605c6,_0xc69eb7){var _0x585387={'raw':!![],'where':{}};var _0x2e0920={};var _0x52e177={'count':0x0,'rows':[]};return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x3e7e8e[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x4605c6,null))[_0x0537('0x30')](function(_0x4c5aa7){if(_0x4c5aa7){_0x2e0920[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xd7')][_0x0537('0x45')]);_0x2e0920[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x3e7e8e[_0x0537('0x4b')]);_0x2e0920[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x2e0920[_0x0537('0x48')],_0x2e0920[_0x0537('0x4b')]);_0x585387[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x2e0920[_0x0537('0x48')],qs['fields'](_0x3e7e8e[_0x0537('0x4b')][_0x0537('0x50')]));_0x585387[_0x0537('0x4f')]=_0x585387[_0x0537('0x4f')]['length']?_0x585387[_0x0537('0x4f')]:_0x2e0920[_0x0537('0x48')];if(!_0x3e7e8e[_0x0537('0x4b')]['hasOwnProperty'](_0x0537('0x52'))){_0x585387[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x3e7e8e[_0x0537('0x4b')][_0x0537('0x2b')]);_0x585387[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x3e7e8e['query'][_0x0537('0x53')]);}_0x585387[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x3e7e8e['query'][_0x0537('0x55')]);_0x585387[_0x0537('0x56')]=qs['filters'](_['pick'](_0x3e7e8e[_0x0537('0x4b')],_0x2e0920[_0x0537('0x4d')]));_0x585387[_0x0537('0x56')][_0x0537('0xd5')]=_0x4c5aa7['id'];if(_0x3e7e8e['query'][_0x0537('0x5b')]){_0x585387['where']=_['merge'](_0x585387[_0x0537('0x56')],{'$or':_['map'](_0x585387['attributes'],function(_0xe2204d){var _0x10b15f={};_0x10b15f[_0xe2204d]={'$like':'%'+_0x3e7e8e[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x10b15f;})});}_0x585387=_['merge']({},_0x585387,_0x3e7e8e['options']);return db[_0x0537('0xd7')][_0x0537('0x2a')]({'where':_0x585387['where']})['then'](function(_0x4742f4){_0x52e177['count']=_0x4742f4;if(_0x3e7e8e[_0x0537('0x4b')][_0x0537('0x5e')]){_0x585387[_0x0537('0x5f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x0537('0x60')](_0x585387);})[_0x0537('0x30')](function(_0x5b33cd){_0x52e177[_0x0537('0x61')]=_0x5b33cd;return _0x52e177;});}})['then'](respondWithFilteredResult(_0x4605c6,_0x585387))[_0x0537('0x62')](handleError(_0x4605c6,null));};exports[_0x0537('0xd8')]=function(_0x533e9b,_0x33b779,_0x38d3de){var _0xbeb10f={};var _0x32e661={};var _0x4a8f78;var _0x34eda2;return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x533e9b['params']['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x33b779,null))['then'](function(_0x75a95b){if(_0x75a95b){_0x4a8f78=_0x75a95b;_0x32e661[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xd9')][_0x0537('0x45')]);_0x32e661[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x533e9b[_0x0537('0x4b')]);_0x32e661[_0x0537('0x4d')]=_['intersection'](_0x32e661[_0x0537('0x48')],_0x32e661[_0x0537('0x4b')]);_0xbeb10f[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x32e661[_0x0537('0x48')],qs[_0x0537('0x50')](_0x533e9b[_0x0537('0x4b')][_0x0537('0x50')]));_0xbeb10f[_0x0537('0x4f')]=_0xbeb10f[_0x0537('0x4f')][_0x0537('0x65')]?_0xbeb10f['attributes']:_0x32e661[_0x0537('0x48')];_0xbeb10f[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x533e9b[_0x0537('0x4b')][_0x0537('0x55')]);_0xbeb10f['where']=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x533e9b[_0x0537('0x4b')],_0x32e661[_0x0537('0x4d')]));if(_0x533e9b[_0x0537('0x4b')][_0x0537('0x5b')]){_0xbeb10f['where']=_[_0x0537('0x5c')](_0xbeb10f['where'],{'$or':_[_0x0537('0x3b')](_0xbeb10f['attributes'],function(_0x2fd00b){var _0x1aeb7c={};_0x1aeb7c[_0x2fd00b]={'$like':'%'+_0x533e9b[_0x0537('0x4b')]['filter']+'%'};return _0x1aeb7c;})});}_0xbeb10f=_[_0x0537('0x5c')]({},_0xbeb10f,_0x533e9b[_0x0537('0x5d')]);return _0x4a8f78['getChatInteractions'](_0xbeb10f);}})[_0x0537('0x30')](function(_0x5e44fe){if(_0x5e44fe){_0x34eda2=_0x5e44fe[_0x0537('0x65')];if(!_0x533e9b[_0x0537('0x4b')][_0x0537('0x51')](_0x0537('0x52'))){_0xbeb10f[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x533e9b[_0x0537('0x4b')][_0x0537('0x2b')]);_0xbeb10f['offset']=qs[_0x0537('0x53')](_0x533e9b[_0x0537('0x4b')]['offset']);}return _0x4a8f78[_0x0537('0xd8')](_0xbeb10f);}})[_0x0537('0x30')](function(_0x370859){if(_0x370859){return _0x370859?{'count':_0x34eda2,'rows':_0x370859}:null;}})['then'](respondWithResult(_0x33b779,null))[_0x0537('0x62')](handleError(_0x33b779,null));};exports[_0x0537('0xda')]=function(_0x16326c,_0x2ca1c3,_0x1b141e){var _0x201aa1={};var _0x35ff1={};var _0x5a41c3;var _0x365e9f;return db['User'][_0x0537('0xa0')]({'where':{'id':_0x16326c[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x2ca1c3,null))[_0x0537('0x30')](function(_0x2a04bb){if(_0x2a04bb){_0x5a41c3=_0x2a04bb;_0x35ff1[_0x0537('0x48')]=_[_0x0537('0x4c')](db['OpenchannelInteraction'][_0x0537('0x45')]);_0x35ff1[_0x0537('0x4b')]=_['keys'](_0x16326c['query']);_0x35ff1['filters']=_[_0x0537('0x4e')](_0x35ff1[_0x0537('0x48')],_0x35ff1[_0x0537('0x4b')]);_0x201aa1[_0x0537('0x4f')]=_['intersection'](_0x35ff1[_0x0537('0x48')],qs[_0x0537('0x50')](_0x16326c[_0x0537('0x4b')]['fields']));_0x201aa1[_0x0537('0x4f')]=_0x201aa1[_0x0537('0x4f')]['length']?_0x201aa1[_0x0537('0x4f')]:_0x35ff1[_0x0537('0x48')];_0x201aa1[_0x0537('0x54')]=qs['sort'](_0x16326c[_0x0537('0x4b')][_0x0537('0x55')]);_0x201aa1[_0x0537('0x56')]=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x16326c['query'],_0x35ff1['filters']));if(_0x16326c[_0x0537('0x4b')][_0x0537('0x5b')]){_0x201aa1[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x201aa1[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x201aa1[_0x0537('0x4f')],function(_0x4d44f2){var _0x2e0d41={};_0x2e0d41[_0x4d44f2]={'$like':'%'+_0x16326c[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x2e0d41;})});}_0x201aa1=_[_0x0537('0x5c')]({},_0x201aa1,_0x16326c[_0x0537('0x5d')]);return _0x5a41c3[_0x0537('0xda')](_0x201aa1);}})[_0x0537('0x30')](function(_0x398d3b){if(_0x398d3b){_0x365e9f=_0x398d3b[_0x0537('0x65')];if(!_0x16326c[_0x0537('0x4b')][_0x0537('0x51')](_0x0537('0x52'))){_0x201aa1[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x16326c[_0x0537('0x4b')][_0x0537('0x2b')]);_0x201aa1[_0x0537('0x53')]=qs['offset'](_0x16326c[_0x0537('0x4b')]['offset']);}return _0x5a41c3[_0x0537('0xda')](_0x201aa1);}})[_0x0537('0x30')](function(_0xacad74){if(_0xacad74){return _0xacad74?{'count':_0x365e9f,'rows':_0xacad74}:null;}})[_0x0537('0x30')](respondWithResult(_0x2ca1c3,null))['catch'](handleError(_0x2ca1c3,null));};exports[_0x0537('0xdb')]=function(_0x8724c2,_0x7fe3c2,_0x2d3f8f){var _0x465128={'raw':!![],'where':{}};var _0x1995e1={};var _0x59aa9b={'count':0x0,'rows':[]};return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x8724c2['params']['id']}})['then'](handleEntityNotFound(_0x7fe3c2,null))['then'](function(_0x1e2f59){if(_0x1e2f59){_0x1995e1[_0x0537('0x48')]=_['keys'](db[_0x0537('0xdc')]['rawAttributes']);_0x1995e1[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x8724c2[_0x0537('0x4b')]);_0x1995e1[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x1995e1[_0x0537('0x48')],_0x1995e1['query']);_0x465128[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x1995e1[_0x0537('0x48')],qs[_0x0537('0x50')](_0x8724c2['query'][_0x0537('0x50')]));_0x465128[_0x0537('0x4f')]=_0x465128[_0x0537('0x4f')][_0x0537('0x65')]?_0x465128['attributes']:_0x1995e1[_0x0537('0x48')];if(!_0x8724c2[_0x0537('0x4b')]['hasOwnProperty'](_0x0537('0x52'))){_0x465128[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x8724c2['query'][_0x0537('0x2b')]);_0x465128[_0x0537('0x53')]=qs['offset'](_0x8724c2[_0x0537('0x4b')][_0x0537('0x53')]);}_0x465128[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x8724c2['query'][_0x0537('0x55')]);_0x465128[_0x0537('0x56')]=qs[_0x0537('0x4d')](_['pick'](_0x8724c2[_0x0537('0x4b')],_0x1995e1[_0x0537('0x4d')]));_0x465128[_0x0537('0x56')][_0x0537('0xd5')]=_0x1e2f59['id'];if(_0x8724c2[_0x0537('0x4b')][_0x0537('0x5b')]){_0x465128[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x465128['where'],{'$or':_[_0x0537('0x3b')](_0x465128[_0x0537('0x4f')],function(_0xbb9ff5){var _0x10be7c={};_0x10be7c[_0xbb9ff5]={'$like':'%'+_0x8724c2[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x10be7c;})});}_0x465128=_[_0x0537('0x5c')]({},_0x465128,_0x8724c2[_0x0537('0x5d')]);return db[_0x0537('0xdc')][_0x0537('0x2a')]({'where':_0x465128[_0x0537('0x56')]})[_0x0537('0x30')](function(_0x4b28c6){_0x59aa9b[_0x0537('0x2a')]=_0x4b28c6;if(_0x8724c2[_0x0537('0x4b')][_0x0537('0x5e')]){_0x465128[_0x0537('0x5f')]=[{'all':!![]}];}return db['MailInteraction'][_0x0537('0x60')](_0x465128);})[_0x0537('0x30')](function(_0x35f8d0){_0x59aa9b[_0x0537('0x61')]=_0x35f8d0;return _0x59aa9b;});}})['then'](respondWithFilteredResult(_0x7fe3c2,_0x465128))[_0x0537('0x62')](handleError(_0x7fe3c2,null));};exports['getSmsInteractions']=function(_0x54c44d,_0x201e8c,_0x538f87){var _0x20ae38={};var _0x3a7886={};var _0x4d763a;var _0x3fce8f;return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x54c44d['params']['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x201e8c,null))['then'](function(_0x367225){if(_0x367225){_0x4d763a=_0x367225;_0x3a7886[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xdd')]['rawAttributes']);_0x3a7886['query']=_[_0x0537('0x4c')](_0x54c44d['query']);_0x3a7886[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x3a7886['model'],_0x3a7886['query']);_0x20ae38[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x3a7886[_0x0537('0x48')],qs[_0x0537('0x50')](_0x54c44d[_0x0537('0x4b')][_0x0537('0x50')]));_0x20ae38['attributes']=_0x20ae38[_0x0537('0x4f')][_0x0537('0x65')]?_0x20ae38[_0x0537('0x4f')]:_0x3a7886['model'];_0x20ae38['order']=qs[_0x0537('0x55')](_0x54c44d[_0x0537('0x4b')][_0x0537('0x55')]);_0x20ae38['where']=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x54c44d['query'],_0x3a7886[_0x0537('0x4d')]));if(_0x54c44d[_0x0537('0x4b')][_0x0537('0x5b')]){_0x20ae38[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x20ae38[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x20ae38[_0x0537('0x4f')],function(_0x3b8385){var _0x5e1e0d={};_0x5e1e0d[_0x3b8385]={'$like':'%'+_0x54c44d[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x5e1e0d;})});}_0x20ae38=_[_0x0537('0x5c')]({},_0x20ae38,_0x54c44d['options']);return _0x4d763a[_0x0537('0xde')](_0x20ae38);}})[_0x0537('0x30')](function(_0x8f6291){if(_0x8f6291){_0x3fce8f=_0x8f6291[_0x0537('0x65')];if(!_0x54c44d[_0x0537('0x4b')][_0x0537('0x51')](_0x0537('0x52'))){_0x20ae38[_0x0537('0x2b')]=qs['limit'](_0x54c44d[_0x0537('0x4b')][_0x0537('0x2b')]);_0x20ae38[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x54c44d[_0x0537('0x4b')][_0x0537('0x53')]);}return _0x4d763a[_0x0537('0xde')](_0x20ae38);}})[_0x0537('0x30')](function(_0x32c9a4){if(_0x32c9a4){return _0x32c9a4?{'count':_0x3fce8f,'rows':_0x32c9a4}:null;}})[_0x0537('0x30')](respondWithResult(_0x201e8c,null))['catch'](handleError(_0x201e8c,null));};exports['getFaxInteractions']=function(_0x93cc29,_0xdf7538,_0xeabeae){var _0x52e3b4={};var _0x2497c8={};var _0x2adcd2;var _0x3410b9;return db[_0x0537('0x44')]['findOne']({'where':{'id':_0x93cc29[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0xdf7538,null))[_0x0537('0x30')](function(_0x5c0382){if(_0x5c0382){_0x2adcd2=_0x5c0382;_0x2497c8[_0x0537('0x48')]=_['keys'](db[_0x0537('0xdf')]['rawAttributes']);_0x2497c8[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x93cc29['query']);_0x2497c8[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0x2497c8[_0x0537('0x48')],_0x2497c8[_0x0537('0x4b')]);_0x52e3b4[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x2497c8[_0x0537('0x48')],qs['fields'](_0x93cc29[_0x0537('0x4b')][_0x0537('0x50')]));_0x52e3b4[_0x0537('0x4f')]=_0x52e3b4['attributes'][_0x0537('0x65')]?_0x52e3b4[_0x0537('0x4f')]:_0x2497c8[_0x0537('0x48')];_0x52e3b4['order']=qs[_0x0537('0x55')](_0x93cc29[_0x0537('0x4b')][_0x0537('0x55')]);_0x52e3b4['where']=qs['filters'](_[_0x0537('0x57')](_0x93cc29['query'],_0x2497c8[_0x0537('0x4d')]));if(_0x93cc29[_0x0537('0x4b')]['filter']){_0x52e3b4[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x52e3b4['where'],{'$or':_['map'](_0x52e3b4[_0x0537('0x4f')],function(_0x246f25){var _0x3e7757={};_0x3e7757[_0x246f25]={'$like':'%'+_0x93cc29[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x3e7757;})});}_0x52e3b4=_['merge']({},_0x52e3b4,_0x93cc29[_0x0537('0x5d')]);return _0x2adcd2['getFaxInteractions'](_0x52e3b4);}})[_0x0537('0x30')](function(_0xcda6a2){if(_0xcda6a2){_0x3410b9=_0xcda6a2[_0x0537('0x65')];if(!_0x93cc29[_0x0537('0x4b')]['hasOwnProperty'](_0x0537('0x52'))){_0x52e3b4[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x93cc29[_0x0537('0x4b')][_0x0537('0x2b')]);_0x52e3b4['offset']=qs[_0x0537('0x53')](_0x93cc29['query'][_0x0537('0x53')]);}return _0x2adcd2[_0x0537('0xe0')](_0x52e3b4);}})[_0x0537('0x30')](function(_0x2c71f2){if(_0x2c71f2){return _0x2c71f2?{'count':_0x3410b9,'rows':_0x2c71f2}:null;}})[_0x0537('0x30')](respondWithResult(_0xdf7538,null))[_0x0537('0x62')](handleError(_0xdf7538,null));};exports[_0x0537('0xe1')]=function(_0x1f56f7,_0x2fc114,_0x18638a){var _0x31ab33={};var _0xd455c1={};var _0x5d80a3;var _0x5cd7be;return db['User'][_0x0537('0xa0')]({'where':{'id':_0x1f56f7[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x2fc114,null))['then'](function(_0x438599){if(_0x438599){_0x5d80a3=_0x438599;_0xd455c1[_0x0537('0x48')]=_['keys'](db[_0x0537('0xe2')][_0x0537('0x45')]);_0xd455c1[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x1f56f7['query']);_0xd455c1[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0xd455c1['model'],_0xd455c1[_0x0537('0x4b')]);_0x31ab33[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0xd455c1[_0x0537('0x48')],qs[_0x0537('0x50')](_0x1f56f7['query'][_0x0537('0x50')]));_0x31ab33[_0x0537('0x4f')]=_0x31ab33[_0x0537('0x4f')][_0x0537('0x65')]?_0x31ab33[_0x0537('0x4f')]:_0xd455c1[_0x0537('0x48')];_0x31ab33[_0x0537('0x54')]=qs['sort'](_0x1f56f7[_0x0537('0x4b')][_0x0537('0x55')]);_0x31ab33['where']=qs[_0x0537('0x4d')](_['pick'](_0x1f56f7[_0x0537('0x4b')],_0xd455c1[_0x0537('0x4d')]));if(_0x1f56f7[_0x0537('0x4b')]['filter']){_0x31ab33[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x31ab33[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x31ab33[_0x0537('0x4f')],function(_0x3d9c0b){var _0x17784f={};_0x17784f[_0x3d9c0b]={'$like':'%'+_0x1f56f7['query'][_0x0537('0x5b')]+'%'};return _0x17784f;})});}_0x31ab33=_[_0x0537('0x5c')]({},_0x31ab33,_0x1f56f7[_0x0537('0x5d')]);return _0x5d80a3['getWhatsappInteractions'](_0x31ab33);}})[_0x0537('0x30')](function(_0x66e59a){if(_0x66e59a){_0x5cd7be=_0x66e59a[_0x0537('0x65')];if(!_0x1f56f7['query']['hasOwnProperty'](_0x0537('0x52'))){_0x31ab33[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x1f56f7[_0x0537('0x4b')][_0x0537('0x2b')]);_0x31ab33[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x1f56f7[_0x0537('0x4b')][_0x0537('0x53')]);}return _0x5d80a3['getWhatsappInteractions'](_0x31ab33);}})['then'](function(_0x4f0761){if(_0x4f0761){return _0x4f0761?{'count':_0x5cd7be,'rows':_0x4f0761}:null;}})[_0x0537('0x30')](respondWithResult(_0x2fc114,null))[_0x0537('0x62')](handleError(_0x2fc114,null));};exports[_0x0537('0xe3')]=function(_0x4e05f7,_0x3ce7e0,_0x516e89){var _0x481e9a;var _0x1d2871;var _0x4d48ee;var _0x4be02e=!_[_0x0537('0x71')](_0x4e05f7[_0x0537('0x64')]['id'])?_0x4e05f7[_0x0537('0x64')]['id']:!_[_0x0537('0x71')](_0x4e05f7['user']['id'])?_0x4e05f7[_0x0537('0x36')]['id']:null;return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x4be02e,'role':{'$or':[_0x0537('0x34'),_0x0537('0x36'),_0x0537('0x87')]}},'attributes':['id',_0x0537('0x3f'),_0x0537('0xe4'),_0x0537('0xe5'),'role',_0x0537('0x6b'),_0x0537('0xa8')]})[_0x0537('0x30')](function(_0x363d60){if(_0x363d60){if(_0x363d60[_0x0537('0x33')]===_0x0537('0x87')){_0x481e9a=_0x363d60;if(_0x4e05f7['body'][_0x0537('0xaa')]){_0x4d48ee=util[_0x0537('0xe6')](_0x0537('0xe7'),_0x481e9a[_0x4e05f7['body'][_0x0537('0xaa')]]);}else if(_0x4e05f7['body'][_0x0537('0xe8')]){_0x4d48ee=util['format'](_0x0537('0xb5'),_0x4e05f7['body']['intrf']);}else{_0x4d48ee=util[_0x0537('0xe6')](_0x0537('0xb5'),_0x481e9a[_0x0537('0x3f')]);}socket['to'](util[_0x0537('0xe6')]('user:%s',_0x481e9a[_0x0537('0x3f')]))[_0x0537('0xb1')](_0x0537('0xe9'),{'user':{'id':_0x481e9a['id'],'name':_0x481e9a['name']},'ip':_0x4e05f7[_0x0537('0xea')][_0x0537('0xeb')]||_0x4e05f7[_0x0537('0xec')]['remoteAddress']||_0x4e05f7[_0x0537('0xed')][_0x0537('0xee')]||_0x4e05f7[_0x0537('0xec')][_0x0537('0xed')][_0x0537('0xee')]});return db['UserVoiceQueueRt'][_0x0537('0x31')]({'where':{'membername':_0x481e9a[_0x0537('0x3f')]},'individualHooks':!![]});}}else{throw new db[(_0x0537('0x97'))][(_0x0537('0x98'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x0537('0x30')](function(){if(_0x481e9a){return _0x481e9a[_0x0537('0xef')]({'raw':!![]});}})[_0x0537('0x30')](function(_0x108599){if(_0x481e9a){var _0x279ff5=[];if(_0x108599){_0x1d2871=_0x108599;if(_0x1d2871['length']){for(var _0x5441d8=0x0;_0x5441d8<_0x1d2871[_0x0537('0x65')];_0x5441d8++){_0x279ff5[_0x0537('0x91')]({'membername':_0x481e9a[_0x0537('0x3f')],'UserId':_0x481e9a['id'],'queue_name':_0x1d2871[_0x5441d8]['name'],'VoiceQueueId':_0x1d2871[_0x5441d8]['id'],'interface':_0x4d48ee,'paused':_0x481e9a[_0x0537('0xa8')]||![],'penalty':_0x1d2871[_0x5441d8][_0x0537('0xf0')]||0x0});}return BPromise[_0x0537('0x93')](_0x279ff5,function(_0x577f0a){return db[_0x0537('0xb7')][_0x0537('0xb8')](_0x577f0a);});}}}})['then'](function(){if(_0x481e9a){return db['MemberReport']['findAll']({'where':{'membername':_0x481e9a['name'],'exitAt':null}});}})[_0x0537('0x30')](function(_0x18f80c){if(_0x481e9a){var _0x22918d=[];_0x18f80c[_0x0537('0xf1')](function(_0x2fd4ed){_0x22918d[_0x0537('0x91')](_0x2fd4ed[_0x0537('0x2f')]({'exitAt':moment()['format'](_0x0537('0xf2'))}));});return BPromise[_0x0537('0x92')](_0x22918d);}})['then'](function(){if(_0x481e9a){var _0x5dfda0=[];var _0x40fc8d=[];var _0x4a7407=utils[_0x0537('0xf3')]();var _0x3d0746={'membername':_0x481e9a['name'],'interface':_0x4d48ee,'enterAt':moment()['format'](_0x0537('0xf2')),'role':_0x481e9a[_0x0537('0x33')],'internal':_0x481e9a[_0x0537('0x6b')]};_0x4a7407[_0x0537('0xf1')](function(_0x5001ed){_0x5dfda0['push'](_[_0x0537('0x5c')]({'channel':_0x5001ed,'type':_0x0537('0xf4'),'data1':_0x4e05f7[_0x0537('0x66')][_0x0537('0xf5')],'data2':_0x4d48ee},_0x3d0746));if(_0x481e9a['loginInPause']){_0x40fc8d[_0x0537('0x91')](_[_0x0537('0x5c')]({'channel':_0x5001ed,'type':_0x0537('0xf6'),'data1':_0x0537('0xf7')},_0x3d0746));}});return db[_0x0537('0xf8')][_0x0537('0xf9')](_0x5dfda0['concat'](_0x40fc8d),{'individualHooks':!![]});}})[_0x0537('0x30')](function(){if(_0x481e9a){return _0x481e9a['update']({'online':!![],'lastLoginAt':moment()[_0x0537('0xe6')](_0x0537('0xf2')),'voicePause':_0x481e9a[_0x0537('0xa8')]||![],'mailPause':_0x481e9a['loginInPause']||![],'chatPause':_0x481e9a['loginInPause']||![],'faxPause':_0x481e9a[_0x0537('0xa8')]||![],'smsPause':_0x481e9a[_0x0537('0xa8')]||![],'openchannelPause':_0x481e9a[_0x0537('0xa8')]||![],'whatsappPause':_0x481e9a[_0x0537('0xa8')]||![],'pauseType':_0x481e9a[_0x0537('0xa8')]?_0x0537('0xf7'):null,'interface':_0x4d48ee,'lastPauseAt':moment()[_0x0537('0xe6')](_0x0537('0xf2'))});}})[_0x0537('0x30')](function(_0x442af7){if(_0x4e05f7[_0x0537('0xfa')]){return _0x516e89();}else{return BPromise[_0x0537('0xfb')](_0x442af7)[_0x0537('0x30')](respondWithResult(_0x3ce7e0,null));}})[_0x0537('0x62')](handleError(_0x3ce7e0,null));};exports['logout']=function(_0x2e427a,_0x4ee622,_0x439ef3){var _0x20ea77;return db[_0x0537('0x44')]['find']({'where':{'id':_0x2e427a[_0x0537('0x64')]['id'],'role':'agent'},'attributes':['id',_0x0537('0x3f'),'role']})[_0x0537('0x30')](handleEntityNotFound(_0x4ee622,null))[_0x0537('0x30')](function(_0x557934){if(_0x557934){_0x20ea77=_0x557934;return db[_0x0537('0xb7')][_0x0537('0x31')]({'where':{'membername':_0x20ea77['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x0537('0xf8')]['findAll']({'where':{'membername':_0x20ea77[_0x0537('0x3f')],'exitAt':null}});})[_0x0537('0x30')](function(_0x3cbbcd){var _0x1f9a3a=[];_0x3cbbcd[_0x0537('0xf1')](function(_0x3dd806){_0x1f9a3a[_0x0537('0x91')](_0x3dd806[_0x0537('0x2f')]({'exitAt':moment()[_0x0537('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0537('0x92')](_0x1f9a3a);})[_0x0537('0x30')](function(){return _0x20ea77[_0x0537('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0537('0x30')](respondWithResult(_0x4ee622,null))[_0x0537('0x62')](handleError(_0x4ee622,null));};exports[_0x0537('0xfc')]=function(_0x4a5b4b,_0x2c567b,_0x3ace5e){var _0x40a9f4;return db[_0x0537('0xb7')][_0x0537('0x2f')]({'paused':0x1},{'where':{'UserId':_0x4a5b4b['params']['id']},'individualHooks':!![]})[_0x0537('0x30')](function(){return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x4a5b4b['params']['id'],'role':_0x0537('0x87')},'attributes':['id',_0x0537('0x3f'),_0x0537('0x33'),_0x0537('0x6b'),'interface']});})[_0x0537('0x30')](handleEntityNotFound(_0x2c567b,null))[_0x0537('0x30')](function(_0x30d66a){if(_0x30d66a){_0x40a9f4=_0x30d66a;return respondWithRpcPromise(_0x0537('0xfd'),'pause',{'id':_0x40a9f4['id'],'name':_0x40a9f4['name'],'pause':!![]});}})['then'](function(){if(_0x40a9f4){return db[_0x0537('0xf8')][_0x0537('0x60')]({'where':{'membername':_0x40a9f4[_0x0537('0x3f')],'type':_0x0537('0xf6'),'exitAt':null}});}})[_0x0537('0x30')](function(_0x5c0448){if(_0x5c0448[_0x0537('0x65')]){var _0x171ffa=moment()[_0x0537('0xe6')](_0x0537('0xf2'));for(var _0x30e9d8=0x0,_0x3e18f6=_0x5c0448[_0x0537('0x65')];_0x30e9d8<_0x3e18f6;_0x30e9d8++){_0x5c0448[_0x30e9d8]['updateAttributes']({'exitAt':_0x171ffa});}}})['then'](function(){var _0x1f6a84=[];var _0x5d2b36=utils[_0x0537('0xf3')]();_0x5d2b36[_0x0537('0xf1')](function(_0xaee44e){_0x1f6a84[_0x0537('0x91')]({'channel':_0xaee44e,'membername':_0x40a9f4['name'],'interface':_[_0x0537('0x71')](_0x40a9f4[_0x0537('0xaa')])?util[_0x0537('0xe6')]('SIP/%s',_0x40a9f4[_0x0537('0x3f')]):_0x40a9f4['interface'],'type':_0x0537('0xf6'),'enterAt':moment()[_0x0537('0xe6')](_0x0537('0xf2')),'data1':_0x4a5b4b[_0x0537('0x66')]['type']||_0x0537('0xfe'),'role':_0x40a9f4[_0x0537('0x33')],'internal':_0x40a9f4[_0x0537('0x6b')]});});return db['MemberReport'][_0x0537('0xf9')](_0x1f6a84,{'individualHooks':!![]});})['then'](function(){return _0x40a9f4[_0x0537('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4a5b4b[_0x0537('0x66')][_0x0537('0x47')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0537('0xe6')](_0x0537('0xf2'))});})[_0x0537('0x30')](respondWithResult(_0x2c567b,null))['catch'](handleError(_0x2c567b,null));};exports[_0x0537('0xff')]=function(_0x59c207,_0x8e52e0,_0x566ae1){var _0x280c42;return db['User'][_0x0537('0x3d')]({'where':{'id':_0x59c207[_0x0537('0x64')]['id']},'attributes':['id',_0x0537('0x3f'),_0x0537('0x33'),_0x0537('0xa9'),_0x0537('0x100'),_0x0537('0x101'),_0x0537('0x102'),'openchannelPause','smsPause',_0x0537('0x103'),_0x0537('0x104'),_0x0537('0x105')]})[_0x0537('0x30')](handleEntityNotFound(_0x8e52e0,null))[_0x0537('0x30')](function(_0x8e606b){if(_0x8e606b){_0x280c42=_0x8e606b;if(_0x59c207[_0x0537('0x66')][_0x0537('0xa6')]&&!utils['isValidChannel'](_0x59c207[_0x0537('0x66')][_0x0537('0xa6')])){throw new db['Sequelize'][(_0x0537('0x98'))](_0x0537('0xac'));}switch(_0x59c207[_0x0537('0x66')][_0x0537('0xa6')]){case _0x0537('0xb3'):return respondWithRpcPromise(_0x0537('0xfd'),_0x0537('0xff'),{'id':_0x280c42['id'],'name':_0x280c42['name'],'pause':![]})[_0x0537('0x30')](function(){return db['UserVoiceQueueRt'][_0x0537('0x2f')]({'paused':0x0},{'where':{'UserId':_0x280c42['id']},'individualHooks':!![]});})['then'](function(){return db[_0x0537('0xf8')][_0x0537('0x3d')]({'where':{'channel':_0x59c207[_0x0537('0x66')][_0x0537('0xa6')],'membername':_0x280c42['name'],'type':_0x0537('0xf6'),'exitAt':null}});})['then'](function(_0x596264){if(_0x596264){return _0x596264[_0x0537('0x2f')]({'exitAt':moment()[_0x0537('0xe6')](_0x0537('0xf2')),'data2':_0x0537('0x106')},{'individualHooks':!![]});}return null;})[_0x0537('0x30')](function(){return _0x280c42['update']({'voicePause':![]});});case _0x0537('0x107'):case _0x0537('0x108'):case'fax':case _0x0537('0x109'):case _0x0537('0x10a'):case _0x0537('0x10b'):return db['MemberReport']['find']({'where':{'channel':_0x59c207[_0x0537('0x66')][_0x0537('0xa6')],'membername':_0x280c42['name'],'type':_0x0537('0xf6'),'exitAt':null}})[_0x0537('0x30')](function(_0x5e22c6){if(_0x5e22c6){return _0x5e22c6[_0x0537('0x2f')]({'exitAt':moment()['format'](_0x0537('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0537('0x30')](function(){var _0x23c508={};_[_0x0537('0x2c')](_0x23c508,util[_0x0537('0xe6')](_0x0537('0x10c'),_0x59c207[_0x0537('0x66')][_0x0537('0xa6')],_0x0537('0x10d')),![]);return _0x280c42['update'](_0x23c508);});default:return respondWithRpcPromise('QueuePause',_0x0537('0xff'),{'id':_0x280c42['id'],'name':_0x280c42['name'],'pause':![]})[_0x0537('0x30')](function(){return db['UserVoiceQueueRt'][_0x0537('0x2f')]({'paused':0x0},{'where':{'UserId':_0x280c42['id']}});})[_0x0537('0x30')](function(){return db[_0x0537('0xf8')][_0x0537('0x60')]({'where':{'membername':_0x280c42[_0x0537('0x3f')],'type':_0x0537('0xf6'),'exitAt':null}});})[_0x0537('0x30')](function(_0x49a3b9){var _0x357661=[];_0x49a3b9[_0x0537('0xf1')](function(_0xfba82a){_0x357661['push'](_0xfba82a[_0x0537('0x2f')]({'exitAt':moment()[_0x0537('0xe6')](_0x0537('0xf2')),'data2':'manual'}));});return BPromise[_0x0537('0x92')](_0x357661);})[_0x0537('0x30')](function(){return _0x280c42[_0x0537('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0537('0x30')](respondWithResult(_0x8e52e0,null))[_0x0537('0x62')](handleError(_0x8e52e0,null));};exports[_0x0537('0x10e')]=function(_0x4757ec,_0x48488f,_0x1ed515){var _0x1ceb51={};var _0x23815b={};var _0x12378b;var _0x1a09f3;return db['User'][_0x0537('0xa0')]({'where':{'id':_0x4757ec[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x48488f,null))['then'](function(_0x5fae51){if(_0x5fae51){_0x12378b=_0x5fae51;_0x23815b[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0x10f')]['rawAttributes']);_0x23815b[_0x0537('0x4b')]=_['keys'](_0x4757ec[_0x0537('0x4b')]);_0x23815b['filters']=_[_0x0537('0x4e')](_0x23815b[_0x0537('0x48')],_0x23815b[_0x0537('0x4b')]);_0x1ceb51['attributes']=_[_0x0537('0x4e')](_0x23815b[_0x0537('0x48')],qs[_0x0537('0x50')](_0x4757ec[_0x0537('0x4b')][_0x0537('0x50')]));_0x1ceb51[_0x0537('0x4f')]=_0x1ceb51[_0x0537('0x4f')]['length']?_0x1ceb51[_0x0537('0x4f')]:_0x23815b[_0x0537('0x48')];_0x1ceb51[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x4757ec[_0x0537('0x4b')][_0x0537('0x55')]);_0x1ceb51[_0x0537('0x56')]=qs['filters'](_['pick'](_0x4757ec[_0x0537('0x4b')],_0x23815b['filters']));if(_0x4757ec[_0x0537('0x4b')][_0x0537('0x5b')]){_0x1ceb51[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x1ceb51[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x1ceb51[_0x0537('0x4f')],function(_0x4a3e95){var _0x3ac1c2={};_0x3ac1c2[_0x4a3e95]={'$like':'%'+_0x4757ec[_0x0537('0x4b')][_0x0537('0x5b')]+'%'};return _0x3ac1c2;})});}_0x1ceb51=_[_0x0537('0x5c')]({},_0x1ceb51,_0x4757ec['options']);return _0x12378b[_0x0537('0x10e')](_0x1ceb51);}})[_0x0537('0x30')](function(_0x357b2e){if(_0x357b2e){_0x1a09f3=_0x357b2e[_0x0537('0x65')];if(!_0x4757ec[_0x0537('0x4b')][_0x0537('0x51')]('nolimit')){_0x1ceb51[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x4757ec['query'][_0x0537('0x2b')]);_0x1ceb51[_0x0537('0x53')]=qs['offset'](_0x4757ec[_0x0537('0x4b')][_0x0537('0x53')]);}return _0x12378b[_0x0537('0x10e')](_0x1ceb51);}})[_0x0537('0x30')](function(_0x49c277){if(_0x49c277){return _0x49c277?{'count':_0x1a09f3,'rows':_0x49c277}:null;}})[_0x0537('0x30')](respondWithResult(_0x48488f,null))['catch'](handleError(_0x48488f,null));};exports['addTeams']=function(_0x3fefee,_0x876158){return db[_0x0537('0x44')][_0x0537('0x3d')]({'where':{'id':_0x3fefee[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x876158,null))[_0x0537('0x30')](function(_0x30ee73){if(_0x30ee73){var _0x5d62a2=_0x30ee73[_0x0537('0x32')]({'plain':!![]});return _0x30ee73[_0x0537('0x110')](_0x3fefee[_0x0537('0x66')]['ids'],_[_0x0537('0x6a')](_0x3fefee[_0x0537('0x66')],[_0x0537('0x69'),'id'])||{})[_0x0537('0x30')](function(){for(var _0x551a8b=0x0;_0x551a8b<_0x3fefee[_0x0537('0x66')][_0x0537('0x69')][_0x0537('0x65')];_0x551a8b++){var _0x5a2ae1=[];db[_0x0537('0x10f')][_0x0537('0xa0')]({'where':{'id':_0x3fefee[_0x0537('0x66')][_0x0537('0x69')][_0x551a8b]}})[_0x0537('0x30')](function(_0x105e07){_0x5a2ae1[_0x0537('0x91')](_0x105e07[_0x0537('0xef')]()['then'](function(_0x313a8e){for(var _0xf7cfa7=0x0;_0xf7cfa7<_0x313a8e['length'];_0xf7cfa7++){_0x313a8e[_0xf7cfa7][_0x0537('0x111')](_0x0537('0xa6'),_0x0537('0x112'));}return _0x313a8e;}));_0x5a2ae1[_0x0537('0x91')](_0x105e07['getChatQueues']()[_0x0537('0x30')](function(_0x181f68){for(var _0x4ffad5=0x0;_0x4ffad5<_0x181f68['length'];_0x4ffad5++){_0x181f68[_0x4ffad5]['setDataValue'](_0x0537('0xa6'),'Chat');}return _0x181f68;}));_0x5a2ae1['push'](_0x105e07['getMailQueues']()[_0x0537('0x30')](function(_0x5e0576){for(var _0xdc70de=0x0;_0xdc70de<_0x5e0576['length'];_0xdc70de++){_0x5e0576[_0xdc70de][_0x0537('0x111')]('channel',_0x0537('0x113'));}return _0x5e0576;}));_0x5a2ae1[_0x0537('0x91')](_0x105e07['getSmsQueues']()[_0x0537('0x30')](function(_0xede357){for(var _0x593390=0x0;_0x593390<_0xede357[_0x0537('0x65')];_0x593390++){_0xede357[_0x593390][_0x0537('0x111')](_0x0537('0xa6'),'Sms');}return _0xede357;}));_0x5a2ae1[_0x0537('0x91')](_0x105e07[_0x0537('0x114')]()['then'](function(_0x18bb2f){for(var _0x478f55=0x0;_0x478f55<_0x18bb2f[_0x0537('0x65')];_0x478f55++){_0x18bb2f[_0x478f55][_0x0537('0x111')](_0x0537('0xa6'),_0x0537('0x115'));}return _0x18bb2f;}));_0x5a2ae1[_0x0537('0x91')](_0x105e07['getFaxQueues']()['then'](function(_0x5ad6b0){for(var _0x2a9c9c=0x0;_0x2a9c9c<_0x5ad6b0[_0x0537('0x65')];_0x2a9c9c++){_0x5ad6b0[_0x2a9c9c][_0x0537('0x111')](_0x0537('0xa6'),'Fax');}return _0x5ad6b0;}));_0x5a2ae1[_0x0537('0x91')](_0x105e07['getOpenchannelQueues']()['then'](function(_0x323259){for(var _0xa5e06=0x0;_0xa5e06<_0x323259['length'];_0xa5e06++){_0x323259[_0xa5e06][_0x0537('0x111')]('channel','Openchannel');}return _0x323259;}));return BPromise[_0x0537('0x92')](_0x5a2ae1);})[_0x0537('0x30')](function(_0x43ab22){var _0x19ef0f=_[_0x0537('0x116')](_0x43ab22);_0x5a2ae1=[];return db['sequelize'][_0x0537('0x117')](function(_0x523a14){for(var _0x532e50=0x0;_0x532e50<_0x19ef0f[_0x0537('0x65')];_0x532e50++){_0x5a2ae1['push'](_0x19ef0f[_0x532e50][_0x0537('0x118')](_0x5d62a2['id']),{'transaction':_0x523a14});}return BPromise[_0x0537('0x92')](_0x5a2ae1)['then'](function(){if(_0x5d62a2[_0x0537('0xa7')]){return BPromise[_0x0537('0x93')](_[_0x0537('0x5b')](_0x19ef0f,function(_0xe948ae){return _0xe948ae[_0x0537('0x119')](_0x0537('0xa6'))===_0x0537('0x112');}),function(_0x1df4bb){return db[_0x0537('0xb7')]['upsert']({'membername':_0x5d62a2[_0x0537('0x3f')],'UserId':_0x5d62a2['id'],'queue_name':_0x1df4bb[_0x0537('0x3f')],'VoiceQueueId':_0x1df4bb['id'],'interface':_['isNil'](_0x5d62a2[_0x0537('0xaa')])?util['format'](_0x0537('0xb5'),_0x5d62a2[_0x0537('0x3f')]):_0x5d62a2[_0x0537('0xaa')],'paused':_0x5d62a2['voicePause']||![],'penalty':_0x5d62a2['penalty']},{'transaction':_0x523a14});});}else{return;}})['then'](function(){for(var _0x5c1bd3=0x0;_0x5c1bd3<_0x19ef0f[_0x0537('0x65')];_0x5c1bd3++){var _0x39bf29=_0x19ef0f[_0x5c1bd3][_0x0537('0x119')](_0x0537('0xa6'));var _0x22bf29=_0x39bf29+_0x0537('0xb0');socket[_0x0537('0xb1')](_0x0537('0x36')+_0x39bf29+'Queue:save',{'UserId':_0x5d62a2['id'],['queueField']:_0x19ef0f[_0x5c1bd3]['id']});}});});});}});}})[_0x0537('0x30')](respondWithStatusCode(_0x876158,null))[_0x0537('0x62')](handleError(_0x876158,null));};exports[_0x0537('0x11a')]=function(_0x4c1f9a,_0x4cc5ec){return db['User'][_0x0537('0xa0')]({'where':{'id':_0x4c1f9a[_0x0537('0x64')]['id']}})['then'](handleEntityNotFound(_0x4cc5ec,null))[_0x0537('0x30')](function(_0x15d88c){if(_0x15d88c){var _0x4a409a=_0x15d88c[_0x0537('0x32')]({'plain':!![]});var _0x195192=_0x4c1f9a[_0x0537('0x4b')][_0x0537('0x69')];return _0x15d88c['removeTeams'](_0x195192)['then'](function(){for(var _0x5e5649=0x0;_0x5e5649<_0x195192[_0x0537('0x65')];_0x5e5649++){var _0x2b818b=[];db['Team'][_0x0537('0xa0')]({'where':{'id':_0x195192[_0x5e5649]}})[_0x0537('0x30')](function(_0x59d70b){_0x2b818b[_0x0537('0x91')](_0x59d70b[_0x0537('0xef')]()[_0x0537('0x30')](function(_0x420e76){for(var _0x229d1d=0x0;_0x229d1d<_0x420e76[_0x0537('0x65')];_0x229d1d++){_0x420e76[_0x229d1d][_0x0537('0x111')]('channel',_0x0537('0x112'));}return _0x420e76;}));_0x2b818b['push'](_0x59d70b[_0x0537('0x11b')]()[_0x0537('0x30')](function(_0x5b22d3){for(var _0x2574df=0x0;_0x2574df<_0x5b22d3[_0x0537('0x65')];_0x2574df++){_0x5b22d3[_0x2574df][_0x0537('0x111')](_0x0537('0xa6'),'Chat');}return _0x5b22d3;}));_0x2b818b[_0x0537('0x91')](_0x59d70b[_0x0537('0x11c')]()['then'](function(_0x590146){for(var _0xafdfc9=0x0;_0xafdfc9<_0x590146[_0x0537('0x65')];_0xafdfc9++){_0x590146[_0xafdfc9]['setDataValue']('channel',_0x0537('0x113'));}return _0x590146;}));_0x2b818b[_0x0537('0x91')](_0x59d70b[_0x0537('0x11d')]()[_0x0537('0x30')](function(_0x1e024d){for(var _0x179154=0x0;_0x179154<_0x1e024d[_0x0537('0x65')];_0x179154++){_0x1e024d[_0x179154][_0x0537('0x111')](_0x0537('0xa6'),_0x0537('0x11e'));}return _0x1e024d;}));_0x2b818b['push'](_0x59d70b['getWhatsappQueues']()[_0x0537('0x30')](function(_0x542c4f){for(var _0x1d7e06=0x0;_0x1d7e06<_0x542c4f['length'];_0x1d7e06++){_0x542c4f[_0x1d7e06]['setDataValue'](_0x0537('0xa6'),'Whatsapp');}return _0x542c4f;}));_0x2b818b[_0x0537('0x91')](_0x59d70b[_0x0537('0x11f')]()[_0x0537('0x30')](function(_0x414881){for(var _0x2cc483=0x0;_0x2cc483<_0x414881[_0x0537('0x65')];_0x2cc483++){_0x414881[_0x2cc483]['setDataValue']('channel',_0x0537('0x120'));}return _0x414881;}));_0x2b818b[_0x0537('0x91')](_0x59d70b['getOpenchannelQueues']()['then'](function(_0x263732){for(var _0x232661=0x0;_0x232661<_0x263732[_0x0537('0x65')];_0x232661++){_0x263732[_0x232661][_0x0537('0x111')](_0x0537('0xa6'),_0x0537('0x121'));}return _0x263732;}));return BPromise[_0x0537('0x92')](_0x2b818b);})[_0x0537('0x30')](function(_0x3236bf){var _0x4f643a=_[_0x0537('0x116')](_0x3236bf);_0x2b818b=[];return db['sequelize'][_0x0537('0x117')](function(_0x258e9e){for(var _0x379865=0x0;_0x379865<_0x4f643a[_0x0537('0x65')];_0x379865++){_0x2b818b[_0x0537('0x91')](_0x4f643a[_0x379865]['removeAgent'](_0x4a409a['id']),{'transaction':_0x258e9e});}return BPromise[_0x0537('0x92')](_0x2b818b)['then'](function(){if(_0x4a409a['online']){return BPromise[_0x0537('0x93')](_[_0x0537('0x5b')](_0x4f643a,function(_0x215e86){return _0x215e86[_0x0537('0x119')](_0x0537('0xa6'))==='Voice';}),function(_0x2503f4){return db['UserVoiceQueueRt'][_0x0537('0x31')]({'where':{'VoiceQueueId':_0x2503f4['id'],'UserId':_0x4a409a['id']},'transaction':_0x258e9e});});}else{return;}})[_0x0537('0x30')](function(){for(var _0x27ebf0=0x0;_0x27ebf0<_0x4f643a[_0x0537('0x65')];_0x27ebf0++){var _0x170ff4=_0x4f643a[_0x27ebf0][_0x0537('0x119')](_0x0537('0xa6'));var _0x3cd141=_0x170ff4+_0x0537('0xb0');socket['emit'](_0x0537('0x36')+_0x170ff4+_0x0537('0xbb'),{'UserId':_0x4a409a['id'],['queueField']:_0x4f643a[_0x27ebf0]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4cc5ec,null))[_0x0537('0x62')](handleError(_0x4cc5ec,null));};exports[_0x0537('0x122')]=function(_0x20a0fa,_0x45961f,_0x3f1fc6){var _0x3c3f00={};var _0xcf2151={};var _0x2a97d2;var _0x2bad48;return db[_0x0537('0x44')]['findOne']({'where':{'id':_0x20a0fa[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x45961f,null))[_0x0537('0x30')](function(_0x185129){if(_0x185129){_0x2a97d2=_0x185129;_0xcf2151[_0x0537('0x48')]=_[_0x0537('0x4c')](db[_0x0537('0xc8')][_0x0537('0x45')]);_0xcf2151[_0x0537('0x4b')]=_[_0x0537('0x4c')](_0x20a0fa['query']);_0xcf2151[_0x0537('0x4d')]=_[_0x0537('0x4e')](_0xcf2151[_0x0537('0x48')],_0xcf2151[_0x0537('0x4b')]);_0x3c3f00[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0xcf2151[_0x0537('0x48')],qs[_0x0537('0x50')](_0x20a0fa[_0x0537('0x4b')]['fields']));_0x3c3f00[_0x0537('0x4f')]=_0x3c3f00[_0x0537('0x4f')][_0x0537('0x65')]?_0x3c3f00[_0x0537('0x4f')]:_0xcf2151[_0x0537('0x48')];_0x3c3f00[_0x0537('0x54')]=qs[_0x0537('0x55')](_0x20a0fa['query'][_0x0537('0x55')]);_0x3c3f00['where']=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x20a0fa['query'],_0xcf2151['filters']));if(_0x20a0fa[_0x0537('0x4b')][_0x0537('0x5b')]){_0x3c3f00[_0x0537('0x56')]=_[_0x0537('0x5c')](_0x3c3f00[_0x0537('0x56')],{'$or':_['map'](_0x3c3f00['attributes'],function(_0x58f22c){var _0xc4b6bd={};_0xc4b6bd[_0x58f22c]={'$like':'%'+_0x20a0fa[_0x0537('0x4b')]['filter']+'%'};return _0xc4b6bd;})});}_0x3c3f00=_[_0x0537('0x5c')]({},_0x3c3f00,_0x20a0fa[_0x0537('0x5d')]);return _0x2a97d2['getLists'](_0x3c3f00);}})['then'](function(_0x486cfd){if(_0x486cfd){_0x2bad48=_0x486cfd[_0x0537('0x65')];if(!_0x20a0fa['query'][_0x0537('0x51')](_0x0537('0x52'))){_0x3c3f00[_0x0537('0x2b')]=qs[_0x0537('0x2b')](_0x20a0fa['query']['limit']);_0x3c3f00[_0x0537('0x53')]=qs[_0x0537('0x53')](_0x20a0fa[_0x0537('0x4b')][_0x0537('0x53')]);}return _0x2a97d2[_0x0537('0x122')](_0x3c3f00);}})[_0x0537('0x30')](function(_0x5176f1){if(_0x5176f1){return _0x5176f1?{'count':_0x2bad48,'rows':_0x5176f1}:null;}})[_0x0537('0x30')](respondWithResult(_0x45961f,null))[_0x0537('0x62')](handleError(_0x45961f,null));};exports[_0x0537('0x123')]=function(_0x2b55a2,_0x3abaa2,_0x2e2615){var _0x567f6f={};var _0x332c10={};var _0x1f74f0;var _0x300b87;return db[_0x0537('0x44')][_0x0537('0xa0')]({'where':{'id':_0x2b55a2[_0x0537('0x64')]['id']}})[_0x0537('0x30')](handleEntityNotFound(_0x3abaa2,null))[_0x0537('0x30')](function(_0x2ba1b1){if(_0x2ba1b1){_0x1f74f0=_0x2ba1b1;_0x332c10['model']=_[_0x0537('0x4c')](db[_0x0537('0x44')][_0x0537('0x45')]);_0x332c10['query']=_[_0x0537('0x4c')](_0x2b55a2[_0x0537('0x4b')]);_0x332c10[_0x0537('0x4d')]=_['intersection'](_0x332c10[_0x0537('0x48')],_0x332c10['query']);_0x567f6f[_0x0537('0x4f')]=_[_0x0537('0x4e')](_0x332c10[_0x0537('0x48')],qs[_0x0537('0x50')](_0x2b55a2[_0x0537('0x4b')]['fields']));_0x567f6f[_0x0537('0x4f')]=_0x567f6f[_0x0537('0x4f')]['length']?_0x567f6f[_0x0537('0x4f')]:_0x332c10[_0x0537('0x48')];_0x567f6f['order']=qs[_0x0537('0x55')](_0x2b55a2['query'][_0x0537('0x55')]);_0x567f6f[_0x0537('0x56')]=qs[_0x0537('0x4d')](_[_0x0537('0x57')](_0x2b55a2['query'],_0x332c10['filters']));if(_0x2b55a2[_0x0537('0x4b')][_0x0537('0x5b')]){_0x567f6f[_0x0537('0x56')]=_['merge'](_0x567f6f[_0x0537('0x56')],{'$or':_[_0x0537('0x3b')](_0x567f6f['attributes'],function(_0x112a35){var _0x139f6a={};_0x139f6a[_0x112a35]={'$like':'%'+_0x2b55a2['query'][_0x0537('0x5b')]+'%'};return _0x139f6a;})});}_0x567f6f[_0x0537('0x48')]=db[_0x0537('0x44')];_0x567f6f['as']='Agents';_0x567f6f=_[_0x0537('0x5c')]({},_0x567f6f,_0x2b55a2['options']);return _0x1f74f0[_0x0537('0xef')]({'include':[_0x567f6f]});}})[_0x0537('0x30')](function(_0x2d7c8e){if(_0x2d7c8e){var _0x46b268={},_0x280d06=[],_0x29da10=0x0;for(var _0x415b53=0x0;_0x415b53<_0x2d7c8e['length'];_0x415b53+=0x1){for(var _0x3fb1b9=0x0,_0x52629a;_0x3fb1b9<_0x2d7c8e[_0x415b53]['Agents'][_0x0537('0x65')];_0x3fb1b9+=0x1){_0x52629a=_0x2d7c8e[_0x415b53][_0x0537('0x37')][_0x3fb1b9][_0x0537('0x32')]({'plain':!![]});_0x46b268[_0x52629a['id']]=_0x52629a;}}_0x46b268=_[_0x0537('0x124')](_0x46b268);for(var _0x4daaef=qs[_0x0537('0x53')](_0x2b55a2[_0x0537('0x4b')][_0x0537('0x53')]);_0x4daaef<_0x46b268['length']&&_0x280d06[_0x0537('0x65')]=_0x59a1ef[_0x469d('0x53')]){throw new Error(_0x469d('0x54'));}})['then'](function(){if(_0x367869){return db[_0x469d('0x3e')][_0x469d('0x4c')]({'where':{'membername':_0x367869[_0x469d('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x367869){return _0x367869[_0x469d('0x55')]({'raw':!![]});}})['then'](function(_0x2d20f4){if(_0x367869){if(_0x2d20f4){var _0x3460fd=[];_0x4d9c14=_0x2d20f4;if(_0x4d9c14[_0x469d('0x2e')]){for(var _0x45fd5a=0x0;_0x45fd5a<_0x4d9c14[_0x469d('0x2e')];_0x45fd5a++){_0x3460fd[_0x469d('0x48')](db['UserVoiceQueueRt']['upsert']({'membername':_0x367869['name'],'UserId':_0x367869['id'],'queue_name':_0x4d9c14[_0x45fd5a][_0x469d('0x27')],'VoiceQueueId':_0x4d9c14[_0x45fd5a]['id'],'interface':_0x179fd4,'paused':_0x367869['loginInPause']||![],'penalty':_0x4d9c14[_0x45fd5a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x469d('0x49')](_0x3460fd);}}}})[_0x469d('0xf')](function(){if(_0x367869){return db[_0x469d('0x2c')][_0x469d('0x19')]({'where':{'membername':_0x367869[_0x469d('0x27')],'exitAt':null}});}})[_0x469d('0xf')](function(_0x4f7b12){if(_0x367869){if(_0x4f7b12&&_0x4f7b12[_0x469d('0x2e')]){var _0x35e7f2=[];_0x4f7b12[_0x469d('0x33')](function(_0x29d11f){_0x35e7f2[_0x469d('0x48')](_0x29d11f[_0x469d('0x2b')]({'exitAt':moment()[_0x469d('0x2f')](_0x469d('0x30'))}));});return BPromise[_0x469d('0x49')](_0x35e7f2);}}})[_0x469d('0xf')](function(_0x204f5e){if(_0x367869){var _0x3d385c=[];var _0x5ea50d=[];var _0xdec76e=utils[_0x469d('0x32')]();var _0x22a418={'membername':_0x367869[_0x469d('0x27')],'interface':_0x179fd4,'enterAt':moment()[_0x469d('0x2f')](_0x469d('0x30')),'role':_0x367869['role'],'internal':_0x367869[_0x469d('0x29')]};_0xdec76e['forEach'](function(_0x5816d3){_0x3d385c[_0x469d('0x48')](_[_0x469d('0x56')]({'channel':_0x5816d3,'type':_0x469d('0x57'),'data1':_0x469d('0x58'),'data2':_0x179fd4},_0x22a418));if(_0x367869[_0x469d('0x4f')]){_0x5ea50d[_0x469d('0x48')](_['merge']({'channel':_0x5816d3,'type':_0x469d('0x2d'),'data1':_0x469d('0x59')},_0x22a418));}});return db[_0x469d('0x2c')][_0x469d('0x39')](_0x3d385c[_0x469d('0x5a')](_0x5ea50d),{'individualHooks':!![]});}})['then'](function(){if(_0x367869){return _0x367869['update']({'online':!![],'lastLoginAt':moment()[_0x469d('0x2f')](_0x469d('0x30')),'voicePause':_0x367869[_0x469d('0x4f')]||![],'mailPause':_0x367869['loginInPause']||![],'chatPause':_0x367869[_0x469d('0x4f')]||![],'faxPause':_0x367869[_0x469d('0x4f')]||![],'smsPause':_0x367869[_0x469d('0x4f')]||![],'openchannelPause':_0x367869[_0x469d('0x4f')]||![],'pauseType':_0x367869[_0x469d('0x4f')]?_0x469d('0x59'):null,'lastPauseAt':moment()[_0x469d('0x2f')](_0x469d('0x30')),'interface':_0x179fd4});}})[_0x469d('0xf')](function(_0x47df41){_0x3d3e33(_0x47df41);})[_0x469d('0x21')](function(_0x29771c){_0x6dd059(_0x1b092a[_0x469d('0x14')](0x1f4,_0x29771c[_0x469d('0x17')]));});});}; \ No newline at end of file +var _0x7980=['callysquare','concat','LOGININPAUSE','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./user.socket','register','request','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','raw','where','limit','map','include','model','attributes','debug','ShowUser','find','PauseUser','name','role','internal','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','channel','voice','UserVoiceQueueRt','system','mail','chat','fax','sms','openchannel','set','%s%s','all','LogoutUser','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN'];(function(_0x42b4a2,_0x4a942f){var _0xf1c833=function(_0x4cc98f){while(--_0x4cc98f){_0x42b4a2['push'](_0x42b4a2['shift']());}};_0xf1c833(++_0x4a942f);}(_0x7980,0x123));var _0x0798=function(_0x320335,_0x3f5d2e){_0x320335=_0x320335-0x0;var _0x2b63b0=_0x7980[_0x320335];return _0x2b63b0;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require('moment');var BPromise=require(_0x0798('0x2'));var rs=require(_0x0798('0x3'));var fs=require('fs');var Redis=require(_0x0798('0x4'));var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')][_0x0798('0xb')]({'port':0x232a});config[_0x0798('0xc')]=_[_0x0798('0xd')](config[_0x0798('0xc')],{'host':_0x0798('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0798('0xc')]));require(_0x0798('0xf'))[_0x0798('0x10')](socket);function respondWithRpcPromise(_0x2524a4,_0xf2c8dc,_0x393e71){return new BPromise(function(_0x329189,_0x218b3f){return client[_0x0798('0x11')](_0x2524a4,_0x393e71)[_0x0798('0x12')](function(_0xbbb97e){logger[_0x0798('0x13')]('User,\x20%s,\x20%s',_0xf2c8dc,_0x0798('0x14'));logger['debug'](_0x0798('0x15'),_0xf2c8dc,'request\x20sent',JSON[_0x0798('0x16')](_0xbbb97e));if(_0xbbb97e['error']){if(_0xbbb97e[_0x0798('0x17')][_0x0798('0x18')]===0x1f4){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x218b3f(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x329189(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}else{logger[_0x0798('0x13')](_0x0798('0x19'),_0xf2c8dc,_0x0798('0x14'));_0x329189(_0xbbb97e[_0x0798('0x1b')]['message']);}})[_0x0798('0x1c')](function(_0x101221){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0x101221);_0x218b3f(_0x101221);});});}exports[_0x0798('0x1d')]=function(_0x233855){var _0x583549=this;return new Promise(function(_0x17202c,_0x58e55c){return db[_0x0798('0x1e')]['findAll']({'raw':_0x233855['options']?_0x233855[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x233855['options']?_0x233855[_0x0798('0x1f')]['attributes']||null:null,'limit':_0x233855[_0x0798('0x1f')]?_0x233855['options'][_0x0798('0x22')]||null:null,'include':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')]['include']?_[_0x0798('0x23')](_0x233855['options'][_0x0798('0x24')],function(_0x1ced2f){return{'model':db[_0x1ced2f[_0x0798('0x25')]],'as':_0x1ced2f['as'],'attributes':_0x1ced2f[_0x0798('0x26')],'include':_0x1ced2f['include']?_[_0x0798('0x23')](_0x1ced2f['include'],function(_0x1467db){return{'model':db[_0x1467db[_0x0798('0x25')]],'as':_0x1467db['as'],'attributes':_0x1467db[_0x0798('0x26')],'include':_0x1467db['include']?_[_0x0798('0x23')](_0x1467db['include'],function(_0x12c9b0){return{'model':db[_0x12c9b0[_0x0798('0x25')]],'as':_0x12c9b0['as'],'attributes':_0x12c9b0[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50446d){logger[_0x0798('0x13')](_0x0798('0x1d'),_0x233855);logger[_0x0798('0x27')](_0x0798('0x1d'),_0x233855,JSON['stringify'](_0x50446d));_0x17202c(_0x50446d);})[_0x0798('0x1c')](function(_0x265fc1){logger[_0x0798('0x17')](_0x0798('0x1d'),_0x265fc1[_0x0798('0x1a')],_0x233855);_0x58e55c(_0x583549[_0x0798('0x17')](0x1f4,_0x265fc1[_0x0798('0x1a')]));});});};exports[_0x0798('0x28')]=function(_0x16a974){var _0x1dab74=this;return new Promise(function(_0x535a50,_0x45becc){return db[_0x0798('0x1e')][_0x0798('0x29')]({'raw':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x26')]||null:null,'include':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x24')]?_[_0x0798('0x23')](_0x16a974[_0x0798('0x1f')]['include'],function(_0x77cac1){return{'model':db[_0x77cac1['model']],'as':_0x77cac1['as'],'attributes':_0x77cac1[_0x0798('0x26')],'include':_0x77cac1['include']?_['map'](_0x77cac1[_0x0798('0x24')],function(_0x4109cd){return{'model':db[_0x4109cd[_0x0798('0x25')]],'as':_0x4109cd['as'],'attributes':_0x4109cd[_0x0798('0x26')],'include':_0x4109cd[_0x0798('0x24')]?_[_0x0798('0x23')](_0x4109cd['include'],function(_0x1dac1e){return{'model':db[_0x1dac1e['model']],'as':_0x1dac1e['as'],'attributes':_0x1dac1e[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})[_0x0798('0x12')](function(_0x4b0337){logger[_0x0798('0x13')](_0x0798('0x28'),_0x16a974);logger[_0x0798('0x27')](_0x0798('0x28'),_0x16a974,JSON['stringify'](_0x4b0337));_0x535a50(_0x4b0337);})['catch'](function(_0x5a877e){logger[_0x0798('0x17')](_0x0798('0x28'),_0x5a877e[_0x0798('0x1a')],_0x16a974);_0x45becc(_0x1dab74[_0x0798('0x17')](0x1f4,_0x5a877e[_0x0798('0x1a')]));});});};exports[_0x0798('0x2a')]=function(_0x2e5265){var _0x56d0c0=this;return new Promise(function(_0x13fad0,_0x36cc9a){var _0x50e2da;return db[_0x0798('0x1e')][_0x0798('0x29')]({'where':_0x2e5265['options'][_0x0798('0x21')]||{},'attributes':['id',_0x0798('0x2b'),_0x0798('0x2c'),_0x0798('0x2d'),'interface']})[_0x0798('0x12')](function(_0x1f8cc3){if(_0x1f8cc3){_0x50e2da=_0x1f8cc3;return db['UserVoiceQueueRt'][_0x0798('0x2e')]({'paused':0x1},{'where':{'UserId':_0x50e2da['id']},'individualHooks':!![]});}})['then'](function(){if(_0x50e2da){return db[_0x0798('0x2f')][_0x0798('0x30')]({'where':{'membername':_0x50e2da[_0x0798('0x2b')],'type':_0x0798('0x31'),'exitAt':null}});}})[_0x0798('0x12')](function(_0x4a2b05){if(_0x50e2da){if(_0x4a2b05&&_0x4a2b05[_0x0798('0x32')]){var _0x19a401=moment()[_0x0798('0x33')](_0x0798('0x34'));for(var _0x3aa9ed=0x0,_0xc20b3d=_0x4a2b05[_0x0798('0x32')];_0x3aa9ed<_0xc20b3d;_0x3aa9ed++){_0x4a2b05[_0x3aa9ed]['updateAttributes']({'exitAt':_0x19a401});}}}})['then'](function(){if(_0x50e2da){var _0x410676=[];var _0x1a614f=utils[_0x0798('0x35')]();_0x1a614f[_0x0798('0x36')](function(_0x122d0a){_0x410676[_0x0798('0x37')]({'channel':_0x122d0a,'membername':_0x50e2da[_0x0798('0x2b')],'interface':_[_0x0798('0x38')](_0x50e2da[_0x0798('0x39')])?util[_0x0798('0x33')](_0x0798('0x3a'),_0x50e2da[_0x0798('0x2b')]):_0x50e2da['interface'],'type':_0x0798('0x31'),'enterAt':moment()[_0x0798('0x33')](_0x0798('0x34')),'data1':_0x2e5265[_0x0798('0x3b')][_0x0798('0x3c')]||_0x0798('0x3d'),'role':_0x50e2da['role'],'internal':_0x50e2da[_0x0798('0x2d')],'uniqueid':_0x2e5265[_0x0798('0x3b')][_0x0798('0x3e')]||null});});return db[_0x0798('0x2f')][_0x0798('0x3f')](_0x410676,{'individualHooks':!![]});}})['then'](function(){if(_0x50e2da){return _0x50e2da[_0x0798('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2e5265[_0x0798('0x3b')][_0x0798('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0798('0x33')](_0x0798('0x34'))});}})['then'](function(_0x467bba){_0x13fad0(_0x467bba);})[_0x0798('0x1c')](function(_0x19a3fa){_0x36cc9a(_0x56d0c0[_0x0798('0x17')](0x1f4,_0x19a3fa['message']));});});};exports[_0x0798('0x40')]=function(_0x5d440e){var _0x4ed1ff=this;return new Promise(function(_0x961a9b,_0x362c1e){var _0x311337;return db[_0x0798('0x1e')]['findOne']({'where':_0x5d440e[_0x0798('0x1f')][_0x0798('0x21')]||{},'attributes':['id','name']})['then'](function(_0x11c1a5){if(_0x11c1a5){_0x311337=_0x11c1a5;if(_0x5d440e[_0x0798('0x3b')]['channel']&&!utils['isValidChannel'](_0x5d440e[_0x0798('0x3b')][_0x0798('0x41')])){throw new Error('Unknown\x20channel');}switch(_0x5d440e[_0x0798('0x3b')][_0x0798('0x41')]){case _0x0798('0x42'):return db[_0x0798('0x43')][_0x0798('0x2e')]({'paused':0x0},{'where':{'UserId':_0x311337['id']}})['then'](function(){return db['MemberReport'][_0x0798('0x29')]({'where':{'channel':_0x5d440e[_0x0798('0x3b')][_0x0798('0x41')],'membername':_0x311337['name'],'type':_0x0798('0x31'),'exitAt':null}});})[_0x0798('0x12')](function(_0x58d7a3){if(_0x58d7a3){return _0x58d7a3[_0x0798('0x2e')]({'exitAt':moment()['format'](_0x0798('0x34')),'data2':_0x0798('0x44')},{'individualHooks':!![]});}return null;})[_0x0798('0x12')](function(){return _0x311337[_0x0798('0x2e')]({'voicePause':![]});});case _0x0798('0x45'):case _0x0798('0x46'):case _0x0798('0x47'):case _0x0798('0x48'):case _0x0798('0x49'):case'whatsapp':return db[_0x0798('0x2f')][_0x0798('0x29')]({'where':{'channel':_0x5d440e[_0x0798('0x3b')][_0x0798('0x41')],'membername':_0x311337[_0x0798('0x2b')],'type':_0x0798('0x31'),'exitAt':null}})[_0x0798('0x12')](function(_0x1d60ee){return _0x1d60ee[_0x0798('0x2e')]({'exitAt':moment()[_0x0798('0x33')](_0x0798('0x34')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x2507e2={};_[_0x0798('0x4a')](_0x2507e2,util['format'](_0x0798('0x4b'),_0x5d440e[_0x0798('0x3b')]['channel'],'Pause'),![]);return _0x311337['update'](_0x2507e2);});default:return db['UserVoiceQueueRt'][_0x0798('0x2e')]({'paused':0x0},{'where':{'UserId':_0x311337['id']}})[_0x0798('0x12')](function(){return db[_0x0798('0x2f')][_0x0798('0x30')]({'where':{'membername':_0x311337[_0x0798('0x2b')],'type':_0x0798('0x31'),'exitAt':null}});})['then'](function(_0x48c73d){var _0x32a9e0=[];_0x48c73d[_0x0798('0x36')](function(_0x245f9c){_0x32a9e0[_0x0798('0x37')](_0x245f9c['update']({'exitAt':moment()[_0x0798('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0798('0x44')}));});return BPromise[_0x0798('0x4c')](_0x32a9e0);})[_0x0798('0x12')](function(){return _0x311337[_0x0798('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0798('0x12')](function(_0x40675a){_0x961a9b(_0x40675a);})[_0x0798('0x1c')](function(_0x22053c){_0x362c1e(_0x4ed1ff['error'](0x1f4,_0x22053c['message']));});});};exports[_0x0798('0x4d')]=function(_0x4f3b22){var _0x4ab948=this;return new Promise(function(_0xd25157,_0x159145){var _0x5e8f63;return db[_0x0798('0x1e')]['findOne']({'where':_0x4f3b22['options'][_0x0798('0x21')]||{},'attributes':['id',_0x0798('0x2b')]})[_0x0798('0x12')](function(_0x1e3a65){if(_0x1e3a65){_0x5e8f63=_0x1e3a65;return db[_0x0798('0x43')]['destroy']({'where':{'membername':_0x5e8f63['name']},'individualHooks':!![]});}})['then'](function(){if(_0x5e8f63){return db[_0x0798('0x2f')]['findAll']({'where':{'membername':_0x5e8f63['name'],'exitAt':null}});}})[_0x0798('0x12')](function(_0x5d8b92){if(_0x5e8f63){if(_0x5d8b92&&_0x5d8b92[_0x0798('0x32')]){var _0x3add29=[];_0x5d8b92[_0x0798('0x36')](function(_0x563dba){_0x3add29[_0x0798('0x37')](_0x563dba['update']({'exitAt':moment()[_0x0798('0x33')](_0x0798('0x34'))}));});return BPromise[_0x0798('0x4c')](_0x3add29);}}})['then'](function(){if(_0x5e8f63){return _0x5e8f63[_0x0798('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x434506){_0xd25157(_0x434506);})[_0x0798('0x1c')](function(_0x1218b4){_0x159145(_0x4ab948[_0x0798('0x17')](0x1f4,_0x1218b4['message']));});});};exports[_0x0798('0x4e')]=function(_0x1c7065){var _0x586b68=this;return new Promise(function(_0x59c2d8,_0x9e3361){var _0x2526f1;var _0x21d9f6;var _0x3f5bcc;var _0x44bcb6;return db[_0x0798('0x1e')]['findOne']({'where':_0x1c7065[_0x0798('0x1f')][_0x0798('0x21')]||{},'attributes':['id',_0x0798('0x2b'),_0x0798('0x2c'),_0x0798('0x4f'),_0x0798('0x50'),_0x0798('0x2d'),_0x0798('0x51'),_0x0798('0x39')]})[_0x0798('0x12')](function(_0x4bc7f4){if(_0x4bc7f4){_0x2526f1=_0x4bc7f4;_0x44bcb6=_0x1c7065[_0x0798('0x3b')][_0x0798('0x39')]?_0x1c7065[_0x0798('0x3b')][_0x0798('0x39')]:util['format'](_0x0798('0x3a'),_0x2526f1[_0x0798('0x2b')]);return db[_0x0798('0x1e')][_0x0798('0x52')]({'where':{'role':_0x0798('0x53'),'online':!![],'id':{'$ne':_0x2526f1['id']}}});}})[_0x0798('0x12')](function(_0x377fc2){if(_0x377fc2){_0x3f5bcc=_0x377fc2;return require(_0x0798('0x54'))[_0x0798('0x55')]();}})[_0x0798('0x12')](function(_0x2756f7){if(_0x2756f7&&_0x2756f7[_0x0798('0x56')]&&_0x3f5bcc>=_0x2756f7[_0x0798('0x56')]){throw new Error(_0x0798('0x57'));}})[_0x0798('0x12')](function(){if(_0x2526f1){return db['UserVoiceQueueRt'][_0x0798('0x58')]({'where':{'membername':_0x2526f1['name']},'individualHooks':!![]});}})[_0x0798('0x12')](function(){if(_0x2526f1){return _0x2526f1[_0x0798('0x59')]({'raw':!![]});}})[_0x0798('0x12')](function(_0x5883cd){if(_0x2526f1){if(_0x5883cd){var _0x1c5665=[];_0x21d9f6=_0x5883cd;if(_0x21d9f6[_0x0798('0x32')]){for(var _0x283b67=0x0;_0x283b67<_0x21d9f6[_0x0798('0x32')];_0x283b67++){_0x1c5665[_0x0798('0x37')](db[_0x0798('0x43')][_0x0798('0x5a')]({'membername':_0x2526f1[_0x0798('0x2b')],'UserId':_0x2526f1['id'],'queue_name':_0x21d9f6[_0x283b67][_0x0798('0x2b')],'VoiceQueueId':_0x21d9f6[_0x283b67]['id'],'interface':_0x44bcb6,'paused':_0x2526f1[_0x0798('0x51')]||![],'penalty':_0x21d9f6[_0x283b67][_0x0798('0x5b')]||0x0}));}return BPromise[_0x0798('0x4c')](_0x1c5665);}}}})[_0x0798('0x12')](function(){if(_0x2526f1){return db[_0x0798('0x2f')][_0x0798('0x30')]({'where':{'membername':_0x2526f1[_0x0798('0x2b')],'exitAt':null}});}})[_0x0798('0x12')](function(_0x33869c){if(_0x2526f1){if(_0x33869c&&_0x33869c[_0x0798('0x32')]){var _0x462c92=[];_0x33869c['forEach'](function(_0x254fe7){_0x462c92[_0x0798('0x37')](_0x254fe7[_0x0798('0x2e')]({'exitAt':moment()[_0x0798('0x33')](_0x0798('0x34'))}));});return BPromise['all'](_0x462c92);}}})['then'](function(_0x1a308c){if(_0x2526f1){var _0x3f2d0a=[];var _0x1c33f2=[];var _0x2476a6=utils['getChannels']();var _0x3b7a13={'membername':_0x2526f1[_0x0798('0x2b')],'interface':_0x44bcb6,'enterAt':moment()[_0x0798('0x33')](_0x0798('0x34')),'role':_0x2526f1[_0x0798('0x2c')],'internal':_0x2526f1[_0x0798('0x2d')]};_0x2476a6['forEach'](function(_0x55f5bf){_0x3f2d0a[_0x0798('0x37')](_['merge']({'channel':_0x55f5bf,'type':_0x0798('0x5c'),'data1':_0x0798('0x5d'),'data2':_0x44bcb6},_0x3b7a13));if(_0x2526f1['loginInPause']){_0x1c33f2[_0x0798('0x37')](_['merge']({'channel':_0x55f5bf,'type':_0x0798('0x31'),'data1':'LOGININPAUSE'},_0x3b7a13));}});return db[_0x0798('0x2f')][_0x0798('0x3f')](_0x3f2d0a[_0x0798('0x5e')](_0x1c33f2),{'individualHooks':!![]});}})['then'](function(){if(_0x2526f1){return _0x2526f1['update']({'online':!![],'lastLoginAt':moment()[_0x0798('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2526f1[_0x0798('0x51')]||![],'mailPause':_0x2526f1['loginInPause']||![],'chatPause':_0x2526f1[_0x0798('0x51')]||![],'faxPause':_0x2526f1[_0x0798('0x51')]||![],'smsPause':_0x2526f1['loginInPause']||![],'openchannelPause':_0x2526f1[_0x0798('0x51')]||![],'pauseType':_0x2526f1[_0x0798('0x51')]?_0x0798('0x5f'):null,'lastPauseAt':moment()[_0x0798('0x33')](_0x0798('0x34')),'interface':_0x44bcb6});}})[_0x0798('0x12')](function(_0x144927){_0x59c2d8(_0x144927);})[_0x0798('0x1c')](function(_0x1d37a4){_0x9e3361(_0x586b68[_0x0798('0x17')](0x1f4,_0x1d37a4[_0x0798('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ebd81fb..1d7743d 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 _0x906c=['length','save','remove','update','register'];(function(_0xb3787b,_0x5ed1a6){var _0x364bbe=function(_0x5b4190){while(--_0x5b4190){_0xb3787b['push'](_0xb3787b['shift']());}};_0x364bbe(++_0x5ed1a6);}(_0x906c,0xfb));var _0xc906=function(_0x195380,_0x6791f){_0x195380=_0x195380-0x0;var _0x17d8da=_0x906c[_0x195380];return _0x17d8da;};'use strict';var UserEvents=require('./user.events');var events=[_0xc906('0x0'),_0xc906('0x1'),_0xc906('0x2')];function createListener(_0x15f04f,_0x29bf21){return function(_0x1c9253){_0x29bf21['emit'](_0x15f04f,_0x1c9253);};}function removeListener(_0x4c32a5,_0x1e3b05){return function(){UserEvents['removeListener'](_0x4c32a5,_0x1e3b05);};}exports[_0xc906('0x3')]=function(_0x5d17ff){for(var _0x41815a=0x0,_0x33eba8=events[_0xc906('0x4')];_0x41815a<_0x33eba8;_0x41815a++){var _0x545e8b=events[_0x41815a];var _0x1f6b8c=createListener('user:'+_0x545e8b,_0x5d17ff);UserEvents['on'](_0x545e8b,_0x1f6b8c);}}; \ No newline at end of file +var _0xd1b8=['emit','length','./user.events','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd1b8,0x1bf));var _0x8d1b=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xd1b8[_0x133277];return _0x5b4a22;};'use strict';var UserEvents=require(_0x8d1b('0x0'));var events=['save',_0x8d1b('0x1'),_0x8d1b('0x2')];function createListener(_0x428993,_0x5f3b61){return function(_0x48122b){_0x5f3b61[_0x8d1b('0x3')](_0x428993,_0x48122b);};}function removeListener(_0x43a1f5,_0x16605b){return function(){UserEvents['removeListener'](_0x43a1f5,_0x16605b);};}exports['register']=function(_0x51e769){for(var _0x48a09f=0x0,_0x262288=events[_0x8d1b('0x4')];_0x48a09f<_0x262288;_0x48a09f++){var _0x28a77c=events[_0x48a09f];var _0xdf640=createListener('user:'+_0x28a77c,_0x51e769);UserEvents['on'](_0x28a77c,_0xdf640);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 821d670..12e1c18 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 _0x4b0f=['../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0x41f45c,_0x51ce23){var _0x442100=function(_0x4752b9){while(--_0x4752b9){_0x41f45c['push'](_0x41f45c['shift']());}};_0x442100(++_0x51ce23);}(_0x4b0f,0xc0));var _0xf4b0=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x4b0f[_0x22d7bb];return _0x40a737;};'use strict';var multer=require(_0xf4b0('0x0'));var util=require(_0xf4b0('0x1'));var path=require('path');var timeout=require(_0xf4b0('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf4b0('0x3'));var config=require(_0xf4b0('0x4'));module['exports']=router; \ No newline at end of file +var _0x9f00=['multer','util','connect-timeout','express','Router'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9f00,0x18b));var _0x09f0=function(_0x5f4a33,_0x5a9b58){_0x5f4a33=_0x5f4a33-0x0;var _0x3f19b6=_0x9f00[_0x5f4a33];return _0x3f19b6;};'use strict';var multer=require(_0x09f0('0x0'));var util=require(_0x09f0('0x1'));var path=require('path');var timeout=require(_0x09f0('0x2'));var express=require(_0x09f0('0x3'));var router=express[_0x09f0('0x4')]();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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 73d58d9..bbc6f43 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 _0xbaf0=['exports','INTEGER'];(function(_0x419560,_0x16a92c){var _0x52a0a9=function(_0x1cdc67){while(--_0x1cdc67){_0x419560['push'](_0x419560['shift']());}};_0x52a0a9(++_0x16a92c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 4274e63..3333764 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 _0xf11e=['define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','path','./userChatQueue.attributes','exports'];(function(_0x575dc5,_0x49bff9){var _0x2a09cb=function(_0x22058c){while(--_0x22058c){_0x575dc5['push'](_0x575dc5['shift']());}};_0x2a09cb(++_0x49bff9);}(_0xf11e,0x11b));var _0xef11=function(_0x5e81d8,_0x438bde){_0x5e81d8=_0x5e81d8-0x0;var _0x15727d=_0xf11e[_0x5e81d8];return _0x15727d;};'use strict';var _=require(_0xef11('0x0'));var util=require('util');var logger=require(_0xef11('0x1'))(_0xef11('0x2'));var moment=require(_0xef11('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xef11('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef11('0x5'));module[_0xef11('0x6')]=function(_0x245f2b,_0x22078c){return _0x245f2b[_0xef11('0x7')](_0xef11('0x8'),attributes,{'tableName':_0xef11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11a2=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x13fae8,_0x31de3f){var _0x2dd149=function(_0x23ceb3){while(--_0x23ceb3){_0x13fae8['push'](_0x13fae8['shift']());}};_0x2dd149(++_0x31de3f);}(_0x11a2,0x10c));var _0x211a=function(_0x21d0b4,_0x14d090){_0x21d0b4=_0x21d0b4-0x0;var _0x88a056=_0x11a2[_0x21d0b4];return _0x88a056;};'use strict';var _=require(_0x211a('0x0'));var util=require(_0x211a('0x1'));var logger=require(_0x211a('0x2'))(_0x211a('0x3'));var moment=require(_0x211a('0x4'));var BPromise=require(_0x211a('0x5'));var rp=require(_0x211a('0x6'));var fs=require('fs');var path=require(_0x211a('0x7'));var rimraf=require(_0x211a('0x8'));var config=require(_0x211a('0x9'));var attributes=require(_0x211a('0xa'));module[_0x211a('0xb')]=function(_0x2d55fb,_0x31bb50){return _0x2d55fb['define']('UserChatQueue',attributes,{'tableName':_0x211a('0xc'),'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 6071dff..fe7304d 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 _0xbd6b=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x136a23,_0x507cda){var _0x48e69b=function(_0x4aefdb){while(--_0x4aefdb){_0x136a23['push'](_0x136a23['shift']());}};_0x48e69b(++_0x507cda);}(_0xbd6b,0x17c));var _0xbbd6=function(_0x46094e,_0x4396c1){_0x46094e=_0x46094e-0x0;var _0x4ee7c7=_0xbd6b[_0x46094e];return _0x4ee7c7;};'use strict';var _=require(_0xbbd6('0x0'));var util=require(_0xbbd6('0x1'));var moment=require('moment');var BPromise=require(_0xbbd6('0x2'));var rs=require(_0xbbd6('0x3'));var fs=require('fs');var Redis=require(_0xbbd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbd6('0x5'));var logger=require(_0xbbd6('0x6'))(_0xbbd6('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbd6('0x8'));var client=jayson[_0xbbd6('0x9')][_0xbbd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30fc6a,_0x3d3747,_0x8120a3){return new BPromise(function(_0x2b3f51,_0x1dfff0){return client[_0xbbd6('0xb')](_0x30fc6a,_0x8120a3)[_0xbbd6('0xc')](function(_0x4c1729){logger[_0xbbd6('0xd')](_0xbbd6('0xe'),_0x3d3747,_0xbbd6('0xf'));logger[_0xbbd6('0x10')](_0xbbd6('0x11'),_0x3d3747,_0xbbd6('0xf'),JSON[_0xbbd6('0x12')](_0x4c1729));if(_0x4c1729[_0xbbd6('0x13')]){if(_0x4c1729[_0xbbd6('0x13')][_0xbbd6('0x14')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3d3747,_0x4c1729['error']['message']);return _0x1dfff0(_0x4c1729[_0xbbd6('0x13')][_0xbbd6('0x15')]);}logger[_0xbbd6('0x13')](_0xbbd6('0xe'),_0x3d3747,_0x4c1729[_0xbbd6('0x13')][_0xbbd6('0x15')]);return _0x2b3f51(_0x4c1729['error'][_0xbbd6('0x15')]);}else{logger[_0xbbd6('0xd')](_0xbbd6('0xe'),_0x3d3747,_0xbbd6('0xf'));_0x2b3f51(_0x4c1729[_0xbbd6('0x16')][_0xbbd6('0x15')]);}})[_0xbbd6('0x17')](function(_0x3958c8){logger['error'](_0xbbd6('0xe'),_0x3d3747,_0x3958c8);_0x1dfff0(_0x3958c8);});});} \ No newline at end of file +var _0x86da=['client','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x86da,0x13d));var _0xa86d=function(_0x2c6ca7,_0x58d9fe){_0x2c6ca7=_0x2c6ca7-0x0;var _0x37e6d5=_0x86da[_0x2c6ca7];return _0x37e6d5;};'use strict';var _=require(_0xa86d('0x0'));var util=require(_0xa86d('0x1'));var moment=require(_0xa86d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa86d('0x3'))['db'];var utils=require(_0xa86d('0x4'));var logger=require(_0xa86d('0x5'))(_0xa86d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa86d('0x7')][_0xa86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2608cf,_0x575630,_0x1a4be6){return new BPromise(function(_0x9110ea,_0x13a6cd){return client['request'](_0x2608cf,_0x1a4be6)[_0xa86d('0x9')](function(_0x267db3){logger[_0xa86d('0xa')](_0xa86d('0xb'),_0x575630,'request\x20sent');logger[_0xa86d('0xc')](_0xa86d('0xd'),_0x575630,_0xa86d('0xe'),JSON['stringify'](_0x267db3));if(_0x267db3[_0xa86d('0xf')]){if(_0x267db3['error']['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x575630,_0x267db3['error'][_0xa86d('0x10')]);return _0x13a6cd(_0x267db3[_0xa86d('0xf')][_0xa86d('0x10')]);}logger[_0xa86d('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x575630,_0x267db3[_0xa86d('0xf')]['message']);return _0x9110ea(_0x267db3[_0xa86d('0xf')][_0xa86d('0x10')]);}else{logger[_0xa86d('0xa')](_0xa86d('0xb'),_0x575630,_0xa86d('0xe'));_0x9110ea(_0x267db3['result'][_0xa86d('0x10')]);}})[_0xa86d('0x11')](function(_0x17664b){logger[_0xa86d('0xf')](_0xa86d('0xb'),_0x575630,_0x17664b);_0x13a6cd(_0x17664b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5fc74dc..38d4737 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 _0x320f=['express','Router','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0xd6ab42,_0x4a76f8){var _0x445960=function(_0x16ca59){while(--_0x16ca59){_0xd6ab42['push'](_0xd6ab42['shift']());}};_0x445960(++_0x4a76f8);}(_0x320f,0x12d));var _0xf320=function(_0x26fcb7,_0x3d3fd1){_0x26fcb7=_0x26fcb7-0x0;var _0x31dbfe=_0x320f[_0x26fcb7];return _0x31dbfe;};'use strict';var multer=require('multer');var util=require(_0xf320('0x0'));var path=require(_0xf320('0x1'));var timeout=require(_0xf320('0x2'));var express=require(_0xf320('0x3'));var router=express[_0xf320('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf320('0x5'));var config=require(_0xf320('0x6'));module[_0xf320('0x7')]=router; \ No newline at end of file +var _0xd2e9=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbd8bfc,_0xe4b986){var _0x9ddf90=function(_0x37af5b){while(--_0x37af5b){_0xbd8bfc['push'](_0xbd8bfc['shift']());}};_0x9ddf90(++_0xe4b986);}(_0xd2e9,0xb7));var _0x9d2e=function(_0x498ba0,_0x2e64ad){_0x498ba0=_0x498ba0-0x0;var _0xb10e19=_0xd2e9[_0x498ba0];return _0xb10e19;};'use strict';var multer=require(_0x9d2e('0x0'));var util=require('util');var path=require(_0x9d2e('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d2e('0x2'));var router=express['Router']();var auth=require(_0x9d2e('0x3'));var interaction=require(_0x9d2e('0x4'));var config=require(_0x9d2e('0x5'));module[_0x9d2e('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index bb519ac..71be041 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 _0x2032=['INTEGER','exports'];(function(_0x333837,_0x53b561){var _0x1cf1a6=function(_0x25c048){while(--_0x25c048){_0x333837['push'](_0x333837['shift']());}};_0x1cf1a6(++_0x53b561);}(_0x2032,0xd9));var _0x2203=function(_0x24033c,_0x383541){_0x24033c=_0x24033c-0x0;var _0x4133b1=_0x2032[_0x24033c];return _0x4133b1;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'penalty':{'type':Sequelize[_0x2203('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2203('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','INTEGER'];(function(_0x51ce95,_0x234bbe){var _0x14a697=function(_0x26896c){while(--_0x26896c){_0x51ce95['push'](_0x51ce95['shift']());}};_0x14a697(++_0x234bbe);}(_0x757a,0xde));var _0xa757=function(_0x371655,_0x5a5af7){_0x371655=_0x371655-0x0;var _0x41729e=_0x757a[_0x371655];return _0x41729e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'penalty':{'type':Sequelize[_0xa757('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4c981df..17f0060 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 _0x711f=['define','user_has_fax_queues','api','moment','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x711f,0x17a));var _0xf711=function(_0x12130b,_0x1e5d98){_0x12130b=_0x12130b-0x0;var _0x398370=_0x711f[_0x12130b];return _0x398370;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf711('0x0'));var moment=require(_0xf711('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf711('0x2'));var rimraf=require(_0xf711('0x3'));var config=require(_0xf711('0x4'));var attributes=require(_0xf711('0x5'));module['exports']=function(_0x1ba574,_0x548c6f){return _0x1ba574[_0xf711('0x6')]('UserFaxQueue',attributes,{'tableName':_0xf711('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1fb=['request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xd1fb,0xa2));var _0xbd1f=function(_0x1365f7,_0x2142ab){_0x1365f7=_0x1365f7-0x0;var _0x83204e=_0xd1fb[_0x1365f7];return _0x83204e;};'use strict';var _=require(_0xbd1f('0x0'));var util=require(_0xbd1f('0x1'));var logger=require(_0xbd1f('0x2'))(_0xbd1f('0x3'));var moment=require(_0xbd1f('0x4'));var BPromise=require(_0xbd1f('0x5'));var rp=require(_0xbd1f('0x6'));var fs=require('fs');var path=require(_0xbd1f('0x7'));var rimraf=require(_0xbd1f('0x8'));var config=require(_0xbd1f('0x9'));var attributes=require('./userFaxQueue.attributes');module[_0xbd1f('0xa')]=function(_0x3ae613,_0x1a84d9){return _0x3ae613[_0xbd1f('0xb')](_0xbd1f('0xc'),attributes,{'tableName':_0xbd1f('0xd'),'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 cda1912..cc91193 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 _0xa965=['UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info'];(function(_0x3d76c4,_0x6c0f2){var _0x57c688=function(_0x14519d){while(--_0x14519d){_0x3d76c4['push'](_0x3d76c4['shift']());}};_0x57c688(++_0x6c0f2);}(_0xa965,0x172));var _0x5a96=function(_0x251170,_0x32fb45){_0x251170=_0x251170-0x0;var _0x32583d=_0xa965[_0x251170];return _0x32583d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5a96('0x0'));var rs=require(_0x5a96('0x1'));var fs=require('fs');var Redis=require(_0x5a96('0x2'));var db=require(_0x5a96('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5a96('0x4'));var config=require('../../config/environment');var jayson=require(_0x5a96('0x5'));var client=jayson[_0x5a96('0x6')][_0x5a96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a55b9,_0x560592,_0x10d530){return new BPromise(function(_0x390d98,_0x20a968){return client[_0x5a96('0x8')](_0x1a55b9,_0x10d530)['then'](function(_0x3db79f){logger[_0x5a96('0x9')](_0x5a96('0xa'),_0x560592,'request\x20sent');logger[_0x5a96('0xb')](_0x5a96('0xc'),_0x560592,_0x5a96('0xd'),JSON[_0x5a96('0xe')](_0x3db79f));if(_0x3db79f[_0x5a96('0xf')]){if(_0x3db79f[_0x5a96('0xf')][_0x5a96('0x10')]===0x1f4){logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);return _0x20a968(_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);}logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);return _0x390d98(_0x3db79f[_0x5a96('0xf')]['message']);}else{logger[_0x5a96('0x9')](_0x5a96('0xa'),_0x560592,'request\x20sent');_0x390d98(_0x3db79f[_0x5a96('0x12')][_0x5a96('0x11')]);}})[_0x5a96('0x13')](function(_0x75cb1a){logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x75cb1a);_0x20a968(_0x75cb1a);});});} \ No newline at end of file +var _0x0de8=['../../config/logger','rpc','jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','../../config/utils'];(function(_0x1a167a,_0x322931){var _0x571aef=function(_0x574bca){while(--_0x574bca){_0x1a167a['push'](_0x1a167a['shift']());}};_0x571aef(++_0x322931);}(_0x0de8,0x1db));var _0x80de=function(_0x3d18af,_0x5b4fa0){_0x3d18af=_0x3d18af-0x0;var _0x2ef919=_0x0de8[_0x3d18af];return _0x2ef919;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var moment=require(_0x80de('0x2'));var BPromise=require(_0x80de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x80de('0x4'));var logger=require(_0x80de('0x5'))(_0x80de('0x6'));var config=require('../../config/environment');var jayson=require(_0x80de('0x7'));var client=jayson[_0x80de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc1372b,_0x5ed63f,_0x1504bc){return new BPromise(function(_0x2a0305,_0x1dcafc){return client[_0x80de('0x9')](_0xc1372b,_0x1504bc)[_0x80de('0xa')](function(_0x338a3a){logger['info'](_0x80de('0xb'),_0x5ed63f,_0x80de('0xc'));logger[_0x80de('0xd')](_0x80de('0xe'),_0x5ed63f,_0x80de('0xc'),JSON[_0x80de('0xf')](_0x338a3a));if(_0x338a3a[_0x80de('0x10')]){if(_0x338a3a['error'][_0x80de('0x11')]===0x1f4){logger[_0x80de('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x5ed63f,_0x338a3a[_0x80de('0x10')][_0x80de('0x12')]);return _0x1dcafc(_0x338a3a['error'][_0x80de('0x12')]);}logger[_0x80de('0x10')](_0x80de('0xb'),_0x5ed63f,_0x338a3a[_0x80de('0x10')][_0x80de('0x12')]);return _0x2a0305(_0x338a3a['error'][_0x80de('0x12')]);}else{logger[_0x80de('0x13')](_0x80de('0xb'),_0x5ed63f,'request\x20sent');_0x2a0305(_0x338a3a['result'][_0x80de('0x12')]);}})['catch'](function(_0x267db1){logger[_0x80de('0x10')](_0x80de('0xb'),_0x5ed63f,_0x267db1);_0x1dcafc(_0x267db1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 9b9b4c7..d235057 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 _0xffe6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x1fd347,_0x1b1f4b){var _0x301186=function(_0x584454){while(--_0x584454){_0x1fd347['push'](_0x1fd347['shift']());}};_0x301186(++_0x1b1f4b);}(_0xffe6,0x9e));var _0x6ffe=function(_0x577403,_0x4fbd00){_0x577403=_0x577403-0x0;var _0x26d38b=_0xffe6[_0x577403];return _0x26d38b;};'use strict';var multer=require(_0x6ffe('0x0'));var util=require(_0x6ffe('0x1'));var path=require(_0x6ffe('0x2'));var timeout=require(_0x6ffe('0x3'));var express=require(_0x6ffe('0x4'));var router=express[_0x6ffe('0x5')]();var auth=require(_0x6ffe('0x6'));var interaction=require(_0x6ffe('0x7'));var config=require(_0x6ffe('0x8'));module[_0x6ffe('0x9')]=router; \ No newline at end of file +var _0x345d=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3f9119,_0x3a00b7){var _0x2fff51=function(_0x448d97){while(--_0x448d97){_0x3f9119['push'](_0x3f9119['shift']());}};_0x2fff51(++_0x3a00b7);}(_0x345d,0x69));var _0xd345=function(_0x31f2a4,_0x4bd829){_0x31f2a4=_0x31f2a4-0x0;var _0x4020f5=_0x345d[_0x31f2a4];return _0x4020f5;};'use strict';var multer=require('multer');var util=require(_0xd345('0x0'));var path=require(_0xd345('0x1'));var timeout=require(_0xd345('0x2'));var express=require(_0xd345('0x3'));var router=express[_0xd345('0x4')]();var auth=require(_0xd345('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd345('0x6'));module[_0xd345('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3ae408e..81829ac 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 _0xbaf0=['exports','INTEGER'];(function(_0x3c424f,_0x1c61c2){var _0x3fee82=function(_0xc78512){while(--_0xc78512){_0x3c424f['push'](_0x3c424f['shift']());}};_0x3fee82(++_0x1c61c2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index fe9bd98..8f8d8e5 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xb10b,0x12a));var _0xbb10=function(_0x516510,_0x48f18a){_0x516510=_0x516510-0x0;var _0x5c5246=_0xb10b[_0x516510];return _0x5c5246;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x113b8f,_0x1670b4){var _0xbd493d=function(_0x109d38){while(--_0x109d38){_0x113b8f['push'](_0x113b8f['shift']());}};_0xbd493d(++_0x1670b4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ee76d3d..4631847 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 _0xfc65=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ab73d,_0x271e18){var _0x291f69=function(_0x5f2fdf){while(--_0x5f2fdf){_0x4ab73d['push'](_0x4ab73d['shift']());}};_0x291f69(++_0x271e18);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x2422ab,_0x32abdf){_0x2422ab=_0x2422ab-0x0;var _0x440d48=_0xfc65[_0x2422ab];return _0x440d48;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409c5f,_0x1a9600,_0x572941){return new BPromise(function(_0x3921c5,_0x1f1409){return client[_0x5fc6('0xc')](_0x409c5f,_0x572941)[_0x5fc6('0xd')](function(_0x16c285){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1a9600,_0x5fc6('0x10'));logger[_0x5fc6('0x11')](_0x5fc6('0x12'),_0x1a9600,'request\x20sent',JSON[_0x5fc6('0x13')](_0x16c285));if(_0x16c285['error']){if(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x15')]===0x1f4){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285['error'][_0x5fc6('0x16')]);return _0x1f1409(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);return _0x3921c5(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}else{logger[_0x5fc6('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x1a9600,'request\x20sent');_0x3921c5(_0x16c285[_0x5fc6('0x17')][_0x5fc6('0x16')]);}})['catch'](function(_0x26d2ba){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x26d2ba);_0x1f1409(_0x26d2ba);});});} \ No newline at end of file +var _0x2e8a=['client','http','request','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x51dbba,_0x817f0d){_0x51dbba=_0x51dbba-0x0;var _0x34906d=_0x2e8a[_0x51dbba];return _0x34906d;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var moment=require(_0xa2e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2e8('0x2'));var fs=require('fs');var Redis=require(_0xa2e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2e8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2e8('0x5')][_0xa2e8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4d31a8,_0x5dffa2,_0x99f433){return new BPromise(function(_0x3b6834,_0x314adf){return client[_0xa2e8('0x7')](_0x4d31a8,_0x99f433)['then'](function(_0x22e15e){logger['info'](_0xa2e8('0x8'),_0x5dffa2,_0xa2e8('0x9'));logger[_0xa2e8('0xa')](_0xa2e8('0xb'),_0x5dffa2,_0xa2e8('0x9'),JSON['stringify'](_0x22e15e));if(_0x22e15e[_0xa2e8('0xc')]){if(_0x22e15e[_0xa2e8('0xc')]['code']===0x1f4){logger[_0xa2e8('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x5dffa2,_0x22e15e[_0xa2e8('0xc')][_0xa2e8('0xd')]);return _0x314adf(_0x22e15e[_0xa2e8('0xc')]['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x5dffa2,_0x22e15e[_0xa2e8('0xc')]['message']);return _0x3b6834(_0x22e15e[_0xa2e8('0xc')]['message']);}else{logger[_0xa2e8('0xe')](_0xa2e8('0x8'),_0x5dffa2,_0xa2e8('0x9'));_0x3b6834(_0x22e15e[_0xa2e8('0xf')][_0xa2e8('0xd')]);}})[_0xa2e8('0x10')](function(_0x4c216b){logger[_0xa2e8('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x5dffa2,_0x4c216b);_0x314adf(_0x4c216b);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6313ba4..922b009 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf230=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf230,0xf6));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var path=require(_0x0f23('0x2'));var timeout=require(_0x0f23('0x3'));var express=require('express');var router=express[_0x0f23('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0f23('0x5'));var config=require(_0x0f23('0x6'));var controller=require('./userNotification.controller');router[_0x0f23('0x7')]('/',auth[_0x0f23('0x8')](),controller[_0x0f23('0x9')]);module[_0x0f23('0xa')]=router; \ No newline at end of file +var _0x9c8a=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0xcf15e3,_0x195c90){var _0x35de3c=function(_0x1ce523){while(--_0x1ce523){_0xcf15e3['push'](_0xcf15e3['shift']());}};_0x35de3c(++_0x195c90);}(_0x9c8a,0x113));var _0xa9c8=function(_0x119aff,_0x265663){_0x119aff=_0x119aff-0x0;var _0x1a40f9=_0x9c8a[_0x119aff];return _0x1a40f9;};'use strict';var multer=require(_0xa9c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa9c8('0x1'));var express=require(_0xa9c8('0x2'));var router=express[_0xa9c8('0x3')]();var auth=require(_0xa9c8('0x4'));var interaction=require(_0xa9c8('0x5'));var config=require(_0xa9c8('0x6'));var controller=require(_0xa9c8('0x7'));router[_0xa9c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c8('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 07d219c..bf6ac3d 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3e0=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3f02cb,_0x2dc795){var _0x4a5236=function(_0x3d5774){while(--_0x3d5774){_0x3f02cb['push'](_0x3f02cb['shift']());}};_0x4a5236(++_0x2dc795);}(_0xe3e0,0x158));var _0x0e3e=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xe3e0[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x0e3e('0x0'));module[_0x0e3e('0x1')]={'body':{'type':Sequelize[_0x0e3e('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0e3e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0e3e('0x3')]},'beep':{'type':Sequelize[_0x0e3e('0x4')]}}; \ No newline at end of file +var _0xc527=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5a0a9b,_0x14d233){var _0x1fa0ca=function(_0x8c436b){while(--_0x8c436b){_0x5a0a9b['push'](_0x5a0a9b['shift']());}};_0x1fa0ca(++_0x14d233);}(_0xc527,0x1ae));var _0x7c52=function(_0xf9993c,_0x30cc32){_0xf9993c=_0xf9993c-0x0;var _0x284703=_0xc527[_0xf9993c];return _0x284703;};'use strict';var Sequelize=require(_0x7c52('0x0'));module[_0x7c52('0x1')]={'body':{'type':Sequelize[_0x7c52('0x2')]},'senderName':{'type':Sequelize[_0x7c52('0x3')]},'recipientsId':{'type':Sequelize[_0x7c52('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x7c52('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a15202b..77e3dd4 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccf7=['transaction','create','userNotification:send','catch','findOne','html','render','forEach','startCase','includes','replace','queue','Queue','ids','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','recipientsId','sortBy','sequelize'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xccf7,0x72));var _0x7ccf=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xccf7[_0x55fa03];return _0x2cd7cd;};'use strict';var pdf=require(_0x7ccf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ccf('0x1'));var zipdir=require(_0x7ccf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ccf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7ccf('0x4'));var path=require(_0x7ccf('0x5'));var sox=require(_0x7ccf('0x6'));var csv=require(_0x7ccf('0x7'));var ejs=require(_0x7ccf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ccf('0x9'));var jsforce=require(_0x7ccf('0xa'));var deskjs=require(_0x7ccf('0xb'));var toCsv=require(_0x7ccf('0x7'));var querystring=require(_0x7ccf('0xc'));var Papa=require(_0x7ccf('0xd'));var Redis=require(_0x7ccf('0xe'));var authService=require(_0x7ccf('0xf'));var qs=require(_0x7ccf('0x10'));var as=require(_0x7ccf('0x11'));var hardwareService=require(_0x7ccf('0x12'));var logger=require(_0x7ccf('0x13'))(_0x7ccf('0x14'));var utils=require(_0x7ccf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7ccf('0x16'));var db=require(_0x7ccf('0x17'))['db'];config[_0x7ccf('0x18')]=_[_0x7ccf('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7ccf('0x1a'))(new Redis(config[_0x7ccf('0x18')]));require(_0x7ccf('0x1b'))[_0x7ccf('0x1c')](socket);function respondWithStatusCode(_0x96395,_0x466fe1){_0x466fe1=_0x466fe1||0xcc;return function(_0x57a5a3){if(_0x57a5a3){return _0x96395[_0x7ccf('0x1d')](_0x466fe1);}return _0x96395[_0x7ccf('0x1e')](_0x466fe1)[_0x7ccf('0x1f')]();};}function respondWithResult(_0x242b2d,_0x17f60c){_0x17f60c=_0x17f60c||0xc8;return function(_0x337c2e){if(_0x337c2e){return _0x242b2d[_0x7ccf('0x1e')](_0x17f60c)['json'](_0x337c2e);}};}function respondWithFilteredResult(_0x51c5ad,_0x4ef320){return function(_0x1070b8){if(_0x1070b8){var _0x50c7a6=_0x1070b8['count'],_0x479df0=_0x4ef320[_0x7ccf('0x20')],_0x477f4a=_0x4ef320['offset']+_0x4ef320[_0x7ccf('0x21')],_0x4725d1;if(_0x477f4a>=_0x50c7a6){_0x477f4a=_0x50c7a6;_0x4725d1=0xc8;}else{_0x4725d1=0xce;}_0x51c5ad[_0x7ccf('0x1e')](_0x4725d1);return _0x51c5ad[_0x7ccf('0x22')](_0x7ccf('0x23'),_0x479df0+'-'+_0x477f4a+'/'+_0x50c7a6)['json'](_0x1070b8);}return null;};}function patchUpdates(_0x193203){return function(_0x583b9d){try{jsonpatch[_0x7ccf('0x24')](_0x583b9d,_0x193203,!![]);}catch(_0x508d53){return BPromise[_0x7ccf('0x25')](_0x508d53);}return _0x583b9d['save']();};}function saveUpdates(_0x1a1371,_0x5a9f96){return function(_0xcb9470){if(_0xcb9470){return _0xcb9470[_0x7ccf('0x26')](_0x1a1371)[_0x7ccf('0x27')](function(_0x20e7ad){return _0x20e7ad;});}return null;};}function removeEntity(_0x4849c2,_0x404849){return function(_0x2092da){if(_0x2092da){return _0x2092da['destroy']()[_0x7ccf('0x27')](function(){_0x4849c2[_0x7ccf('0x1e')](0xcc)[_0x7ccf('0x1f')]();});}};}function handleEntityNotFound(_0xe14285,_0x46a99d){return function(_0x236fc3){if(!_0x236fc3){_0xe14285[_0x7ccf('0x1d')](0x194);}return _0x236fc3;};}function handleError(_0x3d5454,_0x42bdcc){_0x42bdcc=_0x42bdcc||0x1f4;return function(_0x455754){logger[_0x7ccf('0x28')](_0x455754['stack']);if(_0x455754[_0x7ccf('0x29')]){delete _0x455754[_0x7ccf('0x29')];}_0x3d5454[_0x7ccf('0x1e')](_0x42bdcc)[_0x7ccf('0x2a')](_0x455754);};}exports[_0x7ccf('0x2b')]=function(_0xb316b7,_0x2c12f7,_0x5d3f8a){if(!_0xb316b7[_0x7ccf('0x2c')][_0x7ccf('0x2d')](_0x7ccf('0x2e'))&&!_0xb316b7[_0x7ccf('0x2c')]['hasOwnProperty'](_0x7ccf('0x2f'))){throw new db['Sequelize'][(_0x7ccf('0x30'))](_0x7ccf('0x31'));}else{if(_0xb316b7[_0x7ccf('0x2c')][_0x7ccf('0x2d')](_0x7ccf('0x2f'))&&!_0xb316b7[_0x7ccf('0x2c')]['hasOwnProperty'](_0x7ccf('0x32'))){throw new db[(_0x7ccf('0x33'))][(_0x7ccf('0x30'))](_0x7ccf('0x34'));}if(!_0xb316b7[_0x7ccf('0x2c')][_0x7ccf('0x2d')]('recipients')){throw new db[(_0x7ccf('0x33'))][(_0x7ccf('0x30'))](_0x7ccf('0x35'));}else{try{var _0x4c2404=JSON[_0x7ccf('0x36')](_0xb316b7[_0x7ccf('0x2c')][_0x7ccf('0x37')]);}catch(_0x34e5d0){logger[_0x7ccf('0x28')](_0x34e5d0);throw new db['Sequelize'][(_0x7ccf('0x30'))](_0x7ccf('0x38'));}var _0x18495e=[_0x7ccf('0x39'),_0x7ccf('0x3a'),_0x7ccf('0x3b'),_0x7ccf('0x3c'),_0x7ccf('0x3d'),_0x7ccf('0x3e'),_0x7ccf('0x3f'),'team',_0x7ccf('0x40')];if(_[_0x7ccf('0x41')](_0x4c2404,function(_0x33c314){return!_['includes'](_0x18495e,_0x33c314[_0x7ccf('0x42')][_0x7ccf('0x43')]());})){throw new db['Sequelize'][(_0x7ccf('0x30'))](_0x7ccf('0x44'));}}}var _0x1bb355={};_0x1bb355[_0x7ccf('0x45')]=_0xb316b7['body'][_0x7ccf('0x2d')](_0x7ccf('0x45'))?_0xb316b7['body']['senderName']:_0xb316b7[_0x7ccf('0x40')][_0x7ccf('0x46')];_0x1bb355[_0x7ccf('0x47')]=_[_0x7ccf('0x48')](_0xb316b7[_0x7ccf('0x2c')][_0x7ccf('0x47')])?null:_0xb316b7[_0x7ccf('0x2c')]['recipientsDescription'];_0x1bb355['beep']=_0xb316b7[_0x7ccf('0x2c')]['beep']||![];_0x1bb355['SenderId']=_0xb316b7['user']['id'];return getContent(_0xb316b7['body'])[_0x7ccf('0x27')](function(_0x12f8d1){_0x1bb355[_0x7ccf('0x2c')]=_0x12f8d1;return getRecipients(_0x4c2404);})[_0x7ccf('0x27')](function(_0xed10b9){_0x1bb355[_0x7ccf('0x49')]=_[_0x7ccf('0x4a')](_0xed10b9)['join'](',');return db[_0x7ccf('0x4b')][_0x7ccf('0x4c')](function(_0x17b76a){return db['UserNotification'][_0x7ccf('0x4d')](_0x1bb355,{'raw':!![],'transaction':_0x17b76a})['then'](function(_0x11fdc5){var _0xa26f3c={'sender':_0x1bb355[_0x7ccf('0x45')],'description':_0x1bb355[_0x7ccf('0x47')],'content':_0x1bb355[_0x7ccf('0x2c')],'beep':_0x1bb355['beep']};_0xed10b9['forEach'](function(_0x4cfdcb){_0xa26f3c['recipient']=_0x4cfdcb;socket['emit'](_0x7ccf('0x4e'),_0xa26f3c);});return _0x11fdc5;});});})[_0x7ccf('0x27')](respondWithResult(_0x2c12f7,0xc9))[_0x7ccf('0x4f')](handleError(_0x2c12f7,null));};function getContent(_0x4d89d7){return new BPromise(function(_0xe2284c,_0x183bd7){if(_0x4d89d7[_0x7ccf('0x2e')]){_0xe2284c(_0x4d89d7[_0x7ccf('0x2e')]);return;}return db['Template'][_0x7ccf('0x50')]({'attributes':[_0x7ccf('0x51')],'where':{'id':_0x4d89d7['TemplateId']},'raw':!![]})[_0x7ccf('0x27')](function(_0xfac5a1){if(!_0xfac5a1)throw new db[(_0x7ccf('0x33'))][(_0x7ccf('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x24c13b=Mustache[_0x7ccf('0x52')](_0xfac5a1[_0x7ccf('0x51')],_0x4d89d7['view']);_0xe2284c(_0x24c13b);})['catch'](function(_0x5d887c){_0x183bd7(_0x5d887c);});});}function getRecipients(_0xaf04bf){return new BPromise(function(_0x35a91f,_0x4c2a22){var _0x5044d1=[];var _0x5ae299=[];_0xaf04bf[_0x7ccf('0x53')](function(_0x1a4c12){var _0x2ed1ae=_[_0x7ccf('0x54')](_0x1a4c12[_0x7ccf('0x42')]['toLowerCase']());if(_0x2ed1ae==='User'){_0x5044d1=_['union'](_0x5044d1,_0x1a4c12['ids']);}else{if(_[_0x7ccf('0x55')](_0x2ed1ae,'queue'))_0x2ed1ae=_0x2ed1ae[_0x7ccf('0x56')](_0x7ccf('0x57'),_0x7ccf('0x58'));_0x1a4c12[_0x7ccf('0x59')]['forEach'](function(_0x5b866a){_0x5ae299[_0x7ccf('0x5a')](getAgents(_0x2ed1ae,_0x5b866a));});}});return BPromise[_0x7ccf('0x5b')](_0x5ae299)[_0x7ccf('0x27')](function(_0x10a48b){_0x5044d1=_['union'](_0x5044d1,_[_0x7ccf('0x5c')](_0x10a48b));_0x35a91f(_0x5044d1);})[_0x7ccf('0x4f')](function(_0x5041b1){_0x4c2a22(_0x5041b1);});});}function getAgents(_0x234f4e,_0x15ce81){return new BPromise(function(_0x1a202b,_0x4cd896){return db[_0x234f4e][_0x7ccf('0x50')]({'where':{'id':_0x15ce81}})[_0x7ccf('0x27')](function(_0x50c5d5){return _0x50c5d5[_0x7ccf('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0xce800c){var _0x311deb=_[_0x7ccf('0x5e')](_0xce800c,'id');_0x1a202b(_0x311deb);});})[_0x7ccf('0x4f')](function(_0x2c9c1d){_0x4cd896(_0x2c9c1d);});});} \ No newline at end of file +var _0x291f=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','sendUserNotification','hasOwnProperty','body','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','userNotification:send','catch','text','Template','findOne','render','html','startCase','User','union','ids','replace','queue','Queue','push','all','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x436850,_0x1ad07d){var _0x3a6a2b=function(_0x476cbb){while(--_0x476cbb){_0x436850['push'](_0x436850['shift']());}};_0x3a6a2b(++_0x1ad07d);}(_0x291f,0x182));var _0xf291=function(_0x405a5d,_0xa1433b){_0x405a5d=_0x405a5d-0x0;var _0x4a51cd=_0x291f[_0x405a5d];return _0x4a51cd;};'use strict';var pdf=require(_0xf291('0x0'));var emlformat=require(_0xf291('0x1'));var rimraf=require(_0xf291('0x2'));var zipdir=require(_0xf291('0x3'));var jsonpatch=require(_0xf291('0x4'));var rp=require(_0xf291('0x5'));var moment=require(_0xf291('0x6'));var BPromise=require(_0xf291('0x7'));var Mustache=require(_0xf291('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf291('0x9'));var ejs=require(_0xf291('0xa'));var fs=require('fs');var _=require(_0xf291('0xb'));var squel=require(_0xf291('0xc'));var crypto=require(_0xf291('0xd'));var jsforce=require(_0xf291('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf291('0xf'));var Papa=require(_0xf291('0x10'));var Redis=require(_0xf291('0x11'));var authService=require(_0xf291('0x12'));var qs=require(_0xf291('0x13'));var as=require(_0xf291('0x14'));var hardwareService=require(_0xf291('0x15'));var logger=require(_0xf291('0x16'))(_0xf291('0x17'));var utils=require(_0xf291('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf291('0x19'));var db=require(_0xf291('0x1a'))['db'];config['redis']=_[_0xf291('0x1b')](config[_0xf291('0x1c')],{'host':_0xf291('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf291('0x1c')]));require(_0xf291('0x1e'))[_0xf291('0x1f')](socket);function respondWithStatusCode(_0x3373f0,_0x5cb55e){_0x5cb55e=_0x5cb55e||0xcc;return function(_0x2749e3){if(_0x2749e3){return _0x3373f0[_0xf291('0x20')](_0x5cb55e);}return _0x3373f0[_0xf291('0x21')](_0x5cb55e)[_0xf291('0x22')]();};}function respondWithResult(_0x199b83,_0x272b92){_0x272b92=_0x272b92||0xc8;return function(_0x59dfb7){if(_0x59dfb7){return _0x199b83[_0xf291('0x21')](_0x272b92)[_0xf291('0x23')](_0x59dfb7);}};}function respondWithFilteredResult(_0x4bedba,_0x28c695){return function(_0x43f81d){if(_0x43f81d){var _0x2b138b=_0x43f81d['count'],_0xe87061=_0x28c695[_0xf291('0x24')],_0x2ab697=_0x28c695['offset']+_0x28c695[_0xf291('0x25')],_0x53ea31;if(_0x2ab697>=_0x2b138b){_0x2ab697=_0x2b138b;_0x53ea31=0xc8;}else{_0x53ea31=0xce;}_0x4bedba['status'](_0x53ea31);return _0x4bedba[_0xf291('0x26')]('Content-Range',_0xe87061+'-'+_0x2ab697+'/'+_0x2b138b)[_0xf291('0x23')](_0x43f81d);}return null;};}function patchUpdates(_0x5323cd){return function(_0x3a8f3a){try{jsonpatch[_0xf291('0x27')](_0x3a8f3a,_0x5323cd,!![]);}catch(_0x12df5e){return BPromise[_0xf291('0x28')](_0x12df5e);}return _0x3a8f3a[_0xf291('0x29')]();};}function saveUpdates(_0x261bb2,_0x19f92f){return function(_0x4990f3){if(_0x4990f3){return _0x4990f3[_0xf291('0x2a')](_0x261bb2)['then'](function(_0x17a889){return _0x17a889;});}return null;};}function removeEntity(_0x487fe1,_0x5eaf05){return function(_0x13647d){if(_0x13647d){return _0x13647d[_0xf291('0x2b')]()[_0xf291('0x2c')](function(){_0x487fe1[_0xf291('0x21')](0xcc)[_0xf291('0x22')]();});}};}function handleEntityNotFound(_0x13044a,_0x349cef){return function(_0x160250){if(!_0x160250){_0x13044a[_0xf291('0x20')](0x194);}return _0x160250;};}function handleError(_0x1f43c4,_0x2e0497){_0x2e0497=_0x2e0497||0x1f4;return function(_0x2e2343){logger['error'](_0x2e2343[_0xf291('0x2d')]);if(_0x2e2343[_0xf291('0x2e')]){delete _0x2e2343['name'];}_0x1f43c4[_0xf291('0x21')](_0x2e0497)[_0xf291('0x2f')](_0x2e2343);};}exports[_0xf291('0x30')]=function(_0x355121,_0x563c78,_0x25d12a){if(!_0x355121['body'][_0xf291('0x31')]('text')&&!_0x355121[_0xf291('0x32')]['hasOwnProperty']('TemplateId')){throw new db[(_0xf291('0x33'))][(_0xf291('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x355121['body'][_0xf291('0x31')](_0xf291('0x35'))&&!_0x355121['body'][_0xf291('0x31')](_0xf291('0x36'))){throw new db[(_0xf291('0x33'))][(_0xf291('0x34'))](_0xf291('0x37'));}if(!_0x355121['body'][_0xf291('0x31')](_0xf291('0x38'))){throw new db['Sequelize'][(_0xf291('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x25cfe9=JSON[_0xf291('0x39')](_0x355121[_0xf291('0x32')][_0xf291('0x38')]);}catch(_0x215c22){logger[_0xf291('0x3a')](_0x215c22);throw new db[(_0xf291('0x33'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x441a7b=[_0xf291('0x3b'),_0xf291('0x3c'),_0xf291('0x3d'),_0xf291('0x3e'),_0xf291('0x3f'),_0xf291('0x40'),_0xf291('0x41'),_0xf291('0x42'),_0xf291('0x43')];if(_[_0xf291('0x44')](_0x25cfe9,function(_0x8ea4fb){return!_[_0xf291('0x45')](_0x441a7b,_0x8ea4fb[_0xf291('0x46')][_0xf291('0x47')]());})){throw new db[(_0xf291('0x33'))][(_0xf291('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3b139e={};_0x3b139e[_0xf291('0x48')]=_0x355121[_0xf291('0x32')][_0xf291('0x31')](_0xf291('0x48'))?_0x355121[_0xf291('0x32')][_0xf291('0x48')]:_0x355121[_0xf291('0x43')][_0xf291('0x49')];_0x3b139e[_0xf291('0x4a')]=_[_0xf291('0x4b')](_0x355121[_0xf291('0x32')][_0xf291('0x4a')])?null:_0x355121[_0xf291('0x32')][_0xf291('0x4a')];_0x3b139e[_0xf291('0x4c')]=_0x355121[_0xf291('0x32')][_0xf291('0x4c')]||![];_0x3b139e[_0xf291('0x4d')]=_0x355121[_0xf291('0x43')]['id'];return getContent(_0x355121[_0xf291('0x32')])[_0xf291('0x2c')](function(_0x3e0cde){_0x3b139e[_0xf291('0x32')]=_0x3e0cde;return getRecipients(_0x25cfe9);})[_0xf291('0x2c')](function(_0x491b99){_0x3b139e['recipientsId']=_[_0xf291('0x4e')](_0x491b99)[_0xf291('0x4f')](',');return db[_0xf291('0x50')][_0xf291('0x51')](function(_0x4d1e1a){return db[_0xf291('0x52')][_0xf291('0x53')](_0x3b139e,{'raw':!![],'transaction':_0x4d1e1a})[_0xf291('0x2c')](function(_0x264176){var _0x10d460={'sender':_0x3b139e[_0xf291('0x48')],'description':_0x3b139e['recipientsDescription'],'content':_0x3b139e[_0xf291('0x32')],'beep':_0x3b139e[_0xf291('0x4c')]};_0x491b99[_0xf291('0x54')](function(_0x4d9d42){_0x10d460['recipient']=_0x4d9d42;socket['emit'](_0xf291('0x55'),_0x10d460);});return _0x264176;});});})[_0xf291('0x2c')](respondWithResult(_0x563c78,0xc9))[_0xf291('0x56')](handleError(_0x563c78,null));};function getContent(_0x51d6bc){return new BPromise(function(_0x25bc8f,_0x21257a){if(_0x51d6bc[_0xf291('0x57')]){_0x25bc8f(_0x51d6bc[_0xf291('0x57')]);return;}return db[_0xf291('0x58')][_0xf291('0x59')]({'attributes':['html'],'where':{'id':_0x51d6bc['TemplateId']},'raw':!![]})[_0xf291('0x2c')](function(_0x3b6671){if(!_0x3b6671)throw new db[(_0xf291('0x33'))][(_0xf291('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1b1f49=Mustache[_0xf291('0x5a')](_0x3b6671[_0xf291('0x5b')],_0x51d6bc[_0xf291('0x36')]);_0x25bc8f(_0x1b1f49);})['catch'](function(_0x23124b){_0x21257a(_0x23124b);});});}function getRecipients(_0x4d4371){return new BPromise(function(_0x1c3cca,_0x1e872b){var _0x475591=[];var _0x4b414c=[];_0x4d4371['forEach'](function(_0x3c4096){var _0x5c4dce=_[_0xf291('0x5c')](_0x3c4096[_0xf291('0x46')]['toLowerCase']());if(_0x5c4dce===_0xf291('0x5d')){_0x475591=_[_0xf291('0x5e')](_0x475591,_0x3c4096[_0xf291('0x5f')]);}else{if(_[_0xf291('0x45')](_0x5c4dce,'queue'))_0x5c4dce=_0x5c4dce[_0xf291('0x60')](_0xf291('0x61'),_0xf291('0x62'));_0x3c4096['ids'][_0xf291('0x54')](function(_0x20ea04){_0x4b414c[_0xf291('0x63')](getAgents(_0x5c4dce,_0x20ea04));});}});return BPromise[_0xf291('0x64')](_0x4b414c)[_0xf291('0x2c')](function(_0x3bb1f0){_0x475591=_[_0xf291('0x5e')](_0x475591,_['flatten'](_0x3bb1f0));_0x1c3cca(_0x475591);})['catch'](function(_0x566cd3){_0x1e872b(_0x566cd3);});});}function getAgents(_0x352022,_0x133226){return new BPromise(function(_0x5cc1dc,_0x5eeb43){return db[_0x352022][_0xf291('0x59')]({'where':{'id':_0x133226}})[_0xf291('0x2c')](function(_0x26552c){return _0x26552c['getAgents']({'attributes':['id'],'raw':!![]})[_0xf291('0x2c')](function(_0x1c1946){var _0x39feeb=_[_0xf291('0x65')](_0x1c1946,'id');_0x5cc1dc(_0x39feeb);});})[_0xf291('0x56')](function(_0x794da){_0x5eeb43(_0x794da);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5c240e1..ebbdeb4 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fda=['hook','exports','events','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x28a7b6,_0x3eca2e){_0x28a7b6=_0x28a7b6-0x0;var _0x52b5d3=_0x0fda[_0x28a7b6];return _0x52b5d3;};'use strict';var EventEmitter=require(_0xa0fd('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xa0fd('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa0fd('0x2')](0x0);var events={'afterCreate':_0xa0fd('0x3'),'afterUpdate':_0xa0fd('0x4'),'afterDestroy':_0xa0fd('0x5')};function emitEvent(_0xd8e73a){return function(_0x13c734,_0x574fca,_0x4978fa){UserNotificationEvents[_0xa0fd('0x6')](_0xd8e73a+':'+_0x13c734['id'],_0x13c734);UserNotificationEvents['emit'](_0xd8e73a,_0x13c734);_0x4978fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xa0fd('0x7')](e,emitEvent(event));}}module[_0xa0fd('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xd67b=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3aaaef,_0x1a9930){var _0x4f93cc=function(_0x56564f){while(--_0x56564f){_0x3aaaef['push'](_0x3aaaef['shift']());}};_0x4f93cc(++_0x1a9930);}(_0xd67b,0x133));var _0xbd67=function(_0x1fb9e5,_0x54d2ee){_0x1fb9e5=_0x1fb9e5-0x0;var _0x1eea3f=_0xd67b[_0x1fb9e5];return _0x1eea3f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xbd67('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbd67('0x1')](0x0);var events={'afterCreate':_0xbd67('0x2'),'afterUpdate':_0xbd67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40e384){return function(_0x50da5a,_0x1bf96,_0x5a827b){UserNotificationEvents[_0xbd67('0x4')](_0x40e384+':'+_0x50da5a['id'],_0x50da5a);UserNotificationEvents[_0xbd67('0x4')](_0x40e384,_0x50da5a);_0x5a827b(null);};}for(var e in events){if(events[_0xbd67('0x5')](e)){var event=events[e];UserNotification[_0xbd67('0x6')](e,emitEvent(event));}}module[_0xbd67('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index bbd3fc6..4f1701b 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe13=['api','moment','bluebird','request-promise','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x4a6717,_0x2b9993){var _0x53ac68=function(_0x410e22){while(--_0x410e22){_0x4a6717['push'](_0x4a6717['shift']());}};_0x53ac68(++_0x2b9993);}(_0xfe13,0x178));var _0x3fe1=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xfe13[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0x3fe1('0x0'));var util=require('util');var logger=require(_0x3fe1('0x1'))(_0x3fe1('0x2'));var moment=require(_0x3fe1('0x3'));var BPromise=require(_0x3fe1('0x4'));var rp=require(_0x3fe1('0x5'));var fs=require('fs');var path=require(_0x3fe1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fe1('0x7'));module[_0x3fe1('0x8')]=function(_0x2c5ed2,_0x5caa2e){return _0x2c5ed2[_0x3fe1('0x9')](_0x3fe1('0xa'),attributes,{'tableName':_0x3fe1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3fe1('0xc'),'collate':_0x3fe1('0xd')});}; \ No newline at end of file +var _0x6d2d=['path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','../../config/logger','api','moment','request-promise'];(function(_0x477e4d,_0x49841c){var _0x2c8292=function(_0x5c5163){while(--_0x5c5163){_0x477e4d['push'](_0x477e4d['shift']());}};_0x2c8292(++_0x49841c);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x2ee973,_0x43b41c){_0x2ee973=_0x2ee973-0x0;var _0x3ef582=_0x6d2d[_0x2ee973];return _0x3ef582;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6d2('0x0'))(_0xd6d2('0x1'));var moment=require(_0xd6d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6d2('0x3'));var fs=require('fs');var path=require(_0xd6d2('0x4'));var rimraf=require(_0xd6d2('0x5'));var config=require(_0xd6d2('0x6'));var attributes=require(_0xd6d2('0x7'));module[_0xd6d2('0x8')]=function(_0x32ebf,_0x2265d5){return _0x32ebf['define'](_0xd6d2('0x9'),attributes,{'tableName':_0xd6d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6d2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 55095bd..8fe7e66 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd44=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xcd44,0xf8));var _0x4cd4=function(_0x24d21d,_0x51d937){_0x24d21d=_0x24d21d-0x0;var _0x43159d=_0xcd44[_0x24d21d];return _0x43159d;};'use strict';var _=require(_0x4cd4('0x0'));var util=require('util');var moment=require(_0x4cd4('0x1'));var BPromise=require(_0x4cd4('0x2'));var rs=require(_0x4cd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4cd4('0x4'));var logger=require(_0x4cd4('0x5'))(_0x4cd4('0x6'));var config=require(_0x4cd4('0x7'));var jayson=require(_0x4cd4('0x8'));var client=jayson[_0x4cd4('0x9')][_0x4cd4('0xa')]({'port':0x232a});config['redis']=_[_0x4cd4('0xb')](config[_0x4cd4('0xc')],{'host':_0x4cd4('0xd'),'port':0x18eb});var socket=require(_0x4cd4('0xe'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x2c8f30,_0x2068e7,_0x558ad3){return new BPromise(function(_0x832302,_0x3c9d35){return client[_0x4cd4('0xf')](_0x2c8f30,_0x558ad3)[_0x4cd4('0x10')](function(_0x528f1b){logger['info'](_0x4cd4('0x11'),_0x2068e7,_0x4cd4('0x12'));logger[_0x4cd4('0x13')](_0x4cd4('0x14'),_0x2068e7,_0x4cd4('0x12'),JSON[_0x4cd4('0x15')](_0x528f1b));if(_0x528f1b['error']){if(_0x528f1b[_0x4cd4('0x16')][_0x4cd4('0x17')]===0x1f4){logger['error'](_0x4cd4('0x11'),_0x2068e7,_0x528f1b[_0x4cd4('0x16')]['message']);return _0x3c9d35(_0x528f1b[_0x4cd4('0x16')][_0x4cd4('0x18')]);}logger[_0x4cd4('0x16')](_0x4cd4('0x11'),_0x2068e7,_0x528f1b[_0x4cd4('0x16')][_0x4cd4('0x18')]);return _0x832302(_0x528f1b['error'][_0x4cd4('0x18')]);}else{logger[_0x4cd4('0x19')](_0x4cd4('0x11'),_0x2068e7,_0x4cd4('0x12'));_0x832302(_0x528f1b['result'][_0x4cd4('0x18')]);}})[_0x4cd4('0x1a')](function(_0x5318d9){logger[_0x4cd4('0x16')](_0x4cd4('0x11'),_0x2068e7,_0x5318d9);_0x3c9d35(_0x5318d9);});});} \ No newline at end of file +var _0xc639=['defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x2d2201,_0x3cfe3d){var _0x12e6cd=function(_0x5e4cf6){while(--_0x5e4cf6){_0x2d2201['push'](_0x2d2201['shift']());}};_0x12e6cd(++_0x3cfe3d);}(_0xc639,0x89));var _0x9c63=function(_0x2fc8bc,_0x3f8147){_0x2fc8bc=_0x2fc8bc-0x0;var _0xeb6205=_0xc639[_0x2fc8bc];return _0xeb6205;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9c63('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9c63('0x1'));var logger=require(_0x9c63('0x2'))(_0x9c63('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9c63('0x4')][_0x9c63('0x5')]({'port':0x232a});config[_0x9c63('0x6')]=_[_0x9c63('0x7')](config[_0x9c63('0x6')],{'host':_0x9c63('0x8'),'port':0x18eb});var socket=require(_0x9c63('0x9'))(new Redis(config[_0x9c63('0x6')]));require('./userNotification.socket')[_0x9c63('0xa')](socket);function respondWithRpcPromise(_0x23171a,_0x58c5c1,_0x49229c){return new BPromise(function(_0x2036fa,_0x1b43e6){return client[_0x9c63('0xb')](_0x23171a,_0x49229c)[_0x9c63('0xc')](function(_0x11ff35){logger[_0x9c63('0xd')](_0x9c63('0xe'),_0x58c5c1,_0x9c63('0xf'));logger[_0x9c63('0x10')](_0x9c63('0x11'),_0x58c5c1,_0x9c63('0xf'),JSON[_0x9c63('0x12')](_0x11ff35));if(_0x11ff35[_0x9c63('0x13')]){if(_0x11ff35[_0x9c63('0x13')][_0x9c63('0x14')]===0x1f4){logger[_0x9c63('0x13')](_0x9c63('0xe'),_0x58c5c1,_0x11ff35['error'][_0x9c63('0x15')]);return _0x1b43e6(_0x11ff35[_0x9c63('0x13')][_0x9c63('0x15')]);}logger[_0x9c63('0x13')]('UserNotification,\x20%s,\x20%s',_0x58c5c1,_0x11ff35['error'][_0x9c63('0x15')]);return _0x2036fa(_0x11ff35[_0x9c63('0x13')][_0x9c63('0x15')]);}else{logger[_0x9c63('0xd')](_0x9c63('0xe'),_0x58c5c1,_0x9c63('0xf'));_0x2036fa(_0x11ff35[_0x9c63('0x16')][_0x9c63('0x15')]);}})[_0x9c63('0x17')](function(_0x5615fd){logger[_0x9c63('0x13')](_0x9c63('0xe'),_0x58c5c1,_0x5615fd);_0x1b43e6(_0x5615fd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6a9811f..8a779ea 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e7=['remove','emit','removeListener','userNotification:','./userNotification.events','save'];(function(_0x21be32,_0x1cc151){var _0x22df9b=function(_0x57e4e6){while(--_0x57e4e6){_0x21be32['push'](_0x21be32['shift']());}};_0x22df9b(++_0x1cc151);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x873511,_0x38c02c){_0x873511=_0x873511-0x0;var _0x5860ec=_0xe9e7[_0x873511];return _0x5860ec;};'use strict';var UserNotificationEvents=require(_0x7e9e('0x0'));var events=[_0x7e9e('0x1'),_0x7e9e('0x2'),'update'];function createListener(_0x1fd5fc,_0x99030){return function(_0x108c11){_0x99030[_0x7e9e('0x3')](_0x1fd5fc,_0x108c11);};}function removeListener(_0x410b21,_0x18bf13){return function(){UserNotificationEvents[_0x7e9e('0x4')](_0x410b21,_0x18bf13);};}exports['register']=function(_0x319f70){for(var _0x134fac=0x0,_0xba25=events['length'];_0x134fac<_0xba25;_0x134fac++){var _0x366350=events[_0x134fac];var _0x4d9f9a=createListener(_0x7e9e('0x5')+_0x366350,_0x319f70);UserNotificationEvents['on'](_0x366350,_0x4d9f9a);}}; \ No newline at end of file +var _0xb2f1=['update','emit','removeListener','register','./userNotification.events','save'];(function(_0x215b8a,_0x1f964b){var _0x148734=function(_0x5015e1){while(--_0x5015e1){_0x215b8a['push'](_0x215b8a['shift']());}};_0x148734(++_0x1f964b);}(_0xb2f1,0xee));var _0x1b2f=function(_0x53710d,_0x44f987){_0x53710d=_0x53710d-0x0;var _0x34a2fc=_0xb2f1[_0x53710d];return _0x34a2fc;};'use strict';var UserNotificationEvents=require(_0x1b2f('0x0'));var events=[_0x1b2f('0x1'),'remove',_0x1b2f('0x2')];function createListener(_0x421e82,_0x52184d){return function(_0x23a24a){_0x52184d[_0x1b2f('0x3')](_0x421e82,_0x23a24a);};}function removeListener(_0x501165,_0x47a72f){return function(){UserNotificationEvents[_0x1b2f('0x4')](_0x501165,_0x47a72f);};}exports[_0x1b2f('0x5')]=function(_0xad728b){for(var _0x4326ba=0x0,_0x57eed1=events['length'];_0x4326ba<_0x57eed1;_0x4326ba++){var _0x12a0bf=events[_0x4326ba];var _0x28a081=createListener('userNotification:'+_0x12a0bf,_0xad728b);UserNotificationEvents['on'](_0x12a0bf,_0x28a081);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d32fba0..926f0f2 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 _0x8e29=['../../components/interaction/service','../../config/environment','connect-timeout'];(function(_0x3b7d50,_0xf3c7a3){var _0x726dcd=function(_0x4084c8){while(--_0x4084c8){_0x3b7d50['push'](_0x3b7d50['shift']());}};_0x726dcd(++_0xf3c7a3);}(_0x8e29,0x1c1));var _0x98e2=function(_0x34bb9e,_0x478e2a){_0x34bb9e=_0x34bb9e-0x0;var _0x517e4f=_0x8e29[_0x34bb9e];return _0x517e4f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x98e2('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x98e2('0x1'));var config=require(_0x98e2('0x2'));module['exports']=router; \ No newline at end of file +var _0xeb80=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x49b6fa,_0x1213b8){var _0x134f4b=function(_0x288eae){while(--_0x288eae){_0x49b6fa['push'](_0x49b6fa['shift']());}};_0x134f4b(++_0x1213b8);}(_0xeb80,0x9b));var _0x0eb8=function(_0x269613,_0x51aae4){_0x269613=_0x269613-0x0;var _0x37f623=_0xeb80[_0x269613];return _0x37f623;};'use strict';var multer=require(_0x0eb8('0x0'));var util=require(_0x0eb8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0eb8('0x2'));var router=express[_0x0eb8('0x3')]();var auth=require(_0x0eb8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb8('0x5'));module[_0x0eb8('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fcec4e0..3f92ca9 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 _0xd8b0=['exports','sequelize'];(function(_0x1e2772,_0x5713f1){var _0x356a55=function(_0x3a37b0){while(--_0x3a37b0){_0x1e2772['push'](_0x1e2772['shift']());}};_0x356a55(++_0x5713f1);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x32b2d1,_0xa0b952){var _0x32a019=function(_0x3b2600){while(--_0x3b2600){_0x32b2d1['push'](_0x32b2d1['shift']());}};_0x32a019(++_0xa0b952);}(_0xe706,0xa3));var _0x6e70=function(_0x86a8fa,_0x323e96){_0x86a8fa=_0x86a8fa-0x0;var _0x551384=_0xe706[_0x86a8fa];return _0x551384;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 070c198..9adb7da 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 _0x9c77=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','user_has_openchannel_queues','lodash'];(function(_0x5a0ab3,_0x19b2ce){var _0xae9d94=function(_0x28ef74){while(--_0x28ef74){_0x5a0ab3['push'](_0x5a0ab3['shift']());}};_0xae9d94(++_0x19b2ce);}(_0x9c77,0xfc));var _0x79c7=function(_0x290444,_0x58005d){_0x290444=_0x290444-0x0;var _0x3e1555=_0x9c77[_0x290444];return _0x3e1555;};'use strict';var _=require(_0x79c7('0x0'));var util=require(_0x79c7('0x1'));var logger=require(_0x79c7('0x2'))(_0x79c7('0x3'));var moment=require(_0x79c7('0x4'));var BPromise=require(_0x79c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79c7('0x6'));var rimraf=require(_0x79c7('0x7'));var config=require(_0x79c7('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x79c7('0x9')]=function(_0x3b154b,_0x3d9067){return _0x3b154b['define']('UserOpenchannelQueue',attributes,{'tableName':_0x79c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47ff=['request-promise','path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','util','../../config/logger','api','moment','bluebird'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x47ff,0x10f));var _0xf47f=function(_0x7260d7,_0x505c4c){_0x7260d7=_0x7260d7-0x0;var _0x37caa0=_0x47ff[_0x7260d7];return _0x37caa0;};'use strict';var _=require('lodash');var util=require(_0xf47f('0x0'));var logger=require(_0xf47f('0x1'))(_0xf47f('0x2'));var moment=require(_0xf47f('0x3'));var BPromise=require(_0xf47f('0x4'));var rp=require(_0xf47f('0x5'));var fs=require('fs');var path=require(_0xf47f('0x6'));var rimraf=require(_0xf47f('0x7'));var config=require(_0xf47f('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xf47f('0x9')]=function(_0x4e0cc2,_0x4c8a7f){return _0x4e0cc2[_0xf47f('0xa')](_0xf47f('0xb'),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 633870a..7754870 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 _0xab0a=['message','util','moment','bluebird','randomstring','../../mysqldb','rpc','request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dae0a,_0x58fa6f){var _0x3a1d79=function(_0x2bf4e9){while(--_0x2bf4e9){_0x2dae0a['push'](_0x2dae0a['shift']());}};_0x3a1d79(++_0x58fa6f);}(_0xab0a,0x12d));var _0xaab0=function(_0xc61ce,_0x233652){_0xc61ce=_0xc61ce-0x0;var _0x45d783=_0xab0a[_0xc61ce];return _0x45d783;};'use strict';var _=require('lodash');var util=require(_0xaab0('0x0'));var moment=require(_0xaab0('0x1'));var BPromise=require(_0xaab0('0x2'));var rs=require(_0xaab0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaab0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaab0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8d65,_0x507e57,_0x401b57){return new BPromise(function(_0x2a3928,_0x42d10d){return client[_0xaab0('0x6')](_0x1b8d65,_0x401b57)['then'](function(_0x2dba78){logger['info'](_0xaab0('0x7'),_0x507e57,_0xaab0('0x8'));logger[_0xaab0('0x9')](_0xaab0('0xa'),_0x507e57,_0xaab0('0x8'),JSON[_0xaab0('0xb')](_0x2dba78));if(_0x2dba78[_0xaab0('0xc')]){if(_0x2dba78[_0xaab0('0xc')][_0xaab0('0xd')]===0x1f4){logger[_0xaab0('0xc')](_0xaab0('0x7'),_0x507e57,_0x2dba78[_0xaab0('0xc')][_0xaab0('0xe')]);return _0x42d10d(_0x2dba78[_0xaab0('0xc')][_0xaab0('0xe')]);}logger['error'](_0xaab0('0x7'),_0x507e57,_0x2dba78['error'][_0xaab0('0xe')]);return _0x2a3928(_0x2dba78[_0xaab0('0xc')]['message']);}else{logger['info'](_0xaab0('0x7'),_0x507e57,_0xaab0('0x8'));_0x2a3928(_0x2dba78['result'][_0xaab0('0xe')]);}})['catch'](function(_0xc0d599){logger['error'](_0xaab0('0x7'),_0x507e57,_0xc0d599);_0x42d10d(_0xc0d599);});});} \ No newline at end of file +var _0x4ad9=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x4ad9,0x14f));var _0x94ad=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ad9[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x94ad('0x0'));var rs=require(_0x94ad('0x1'));var fs=require('fs');var Redis=require(_0x94ad('0x2'));var db=require(_0x94ad('0x3'))['db'];var utils=require(_0x94ad('0x4'));var logger=require(_0x94ad('0x5'))(_0x94ad('0x6'));var config=require(_0x94ad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94ad('0x8')][_0x94ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x356262,_0x322014,_0x57253f){return new BPromise(function(_0x381e15,_0x12f257){return client[_0x94ad('0xa')](_0x356262,_0x57253f)[_0x94ad('0xb')](function(_0x36b0e3){logger[_0x94ad('0xc')](_0x94ad('0xd'),_0x322014,_0x94ad('0xe'));logger[_0x94ad('0xf')](_0x94ad('0x10'),_0x322014,_0x94ad('0xe'),JSON[_0x94ad('0x11')](_0x36b0e3));if(_0x36b0e3[_0x94ad('0x12')]){if(_0x36b0e3[_0x94ad('0x12')][_0x94ad('0x13')]===0x1f4){logger[_0x94ad('0x12')](_0x94ad('0xd'),_0x322014,_0x36b0e3[_0x94ad('0x12')][_0x94ad('0x14')]);return _0x12f257(_0x36b0e3[_0x94ad('0x12')][_0x94ad('0x14')]);}logger[_0x94ad('0x12')](_0x94ad('0xd'),_0x322014,_0x36b0e3['error'][_0x94ad('0x14')]);return _0x381e15(_0x36b0e3['error']['message']);}else{logger[_0x94ad('0xc')](_0x94ad('0xd'),_0x322014,_0x94ad('0xe'));_0x381e15(_0x36b0e3[_0x94ad('0x15')][_0x94ad('0x14')]);}})[_0x94ad('0x16')](function(_0x27f5b4){logger[_0x94ad('0x12')](_0x94ad('0xd'),_0x322014,_0x27f5b4);_0x12f257(_0x27f5b4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e426d8a..f58806f 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 _0x3435=['describe','get','/:id','getSections','/:id/resources','post','create','/:id/clone','clone','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x520e2e,_0x5c6ad3){var _0x36b433=function(_0x4e5fe5){while(--_0x4e5fe5){_0x520e2e['push'](_0x520e2e['shift']());}};_0x36b433(++_0x5c6ad3);}(_0x3435,0xfa));var _0x5343=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x3435[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var path=require(_0x5343('0x2'));var timeout=require(_0x5343('0x3'));var express=require(_0x5343('0x4'));var router=express[_0x5343('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5343('0x6'));var config=require(_0x5343('0x7'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x5343('0x8')](),controller[_0x5343('0x9')]);router['get']('/describe',auth[_0x5343('0x8')](),controller[_0x5343('0xa')]);router[_0x5343('0xb')](_0x5343('0xc'),auth[_0x5343('0x8')](),controller['show']);router[_0x5343('0xb')]('/:id/sections',auth[_0x5343('0x8')](),controller[_0x5343('0xd')]);router[_0x5343('0xb')](_0x5343('0xe'),auth[_0x5343('0x8')](),controller['getResources']);router[_0x5343('0xf')]('/',auth[_0x5343('0x8')](),controller[_0x5343('0x10')]);router['post'](_0x5343('0x11'),auth['isAuthenticated'](),controller[_0x5343('0x12')]);router[_0x5343('0xf')]('/:id/sections',auth[_0x5343('0x8')](),controller['addSections']);router[_0x5343('0xf')](_0x5343('0xe'),auth[_0x5343('0x8')](),controller[_0x5343('0x13')]);router['put'](_0x5343('0xc'),auth[_0x5343('0x8')](),controller[_0x5343('0x14')]);router[_0x5343('0x15')](_0x5343('0xc'),auth[_0x5343('0x8')](),controller[_0x5343('0x16')]);router[_0x5343('0x15')]('/:id/sections',auth[_0x5343('0x8')](),controller[_0x5343('0x17')]);router[_0x5343('0x15')]('/:id/resources',auth[_0x5343('0x8')](),controller[_0x5343('0x18')]);module[_0x5343('0x19')]=router; \ No newline at end of file +var _0xcd59=['Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','/:id/clone','clone','/:id/resources','update','destroy','removeSections','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x34fdc2,_0x529910){var _0x2445ff=function(_0x4176c9){while(--_0x4176c9){_0x34fdc2['push'](_0x34fdc2['shift']());}};_0x2445ff(++_0x529910);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5e95c,_0x5d0943){_0x5e95c=_0x5e95c-0x0;var _0x3ff5b8=_0xcd59[_0x5e95c];return _0x3ff5b8;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var controller=require(_0x9cd5('0x8'));router[_0x9cd5('0x9')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xb')]);router[_0x9cd5('0x9')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xd')]);router['get'](_0x9cd5('0xe'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0x9')](_0x9cd5('0x10'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x11')]);router[_0x9cd5('0x9')]('/:id/resources',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x12')]);router[_0x9cd5('0x13')]('/',auth[_0x9cd5('0xa')](),controller['create']);router['post'](_0x9cd5('0x14'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x13')](_0x9cd5('0x10'),auth[_0x9cd5('0xa')](),controller['addSections']);router[_0x9cd5('0x13')](_0x9cd5('0x16'),auth[_0x9cd5('0xa')](),controller['addResources']);router['put']('/:id',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x17')]);router['delete'](_0x9cd5('0xe'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x18')]);router['delete'](_0x9cd5('0x10'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x19')]);router[_0x9cd5('0x1a')](_0x9cd5('0x16'),auth[_0x9cd5('0xa')](),controller['removeResources']);module[_0x9cd5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e4b59cd..53bab17 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 _0x6c76=['STRING','join','getDataValue','crudPermissions','sequelize','exports'];(function(_0x5e92c6,_0x5512ba){var _0x4afe51=function(_0x3d71ca){while(--_0x3d71ca){_0x5e92c6['push'](_0x5e92c6['shift']());}};_0x4afe51(++_0x5512ba);}(_0x6c76,0x184));var _0x66c7=function(_0x5deb8b,_0x1f4125){_0x5deb8b=_0x5deb8b-0x0;var _0x208e3a=_0x6c76[_0x5deb8b];return _0x208e3a;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'name':{'type':Sequelize[_0x66c7('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x66c7('0x2')],'set':function(_0xd49f21){this['setDataValue']('crudPermissions',_0xd49f21?_0xd49f21[_0x66c7('0x3')](''):[]);},'get':function(){return this[_0x66c7('0x4')]('crudPermissions')?this[_0x66c7('0x4')](_0x66c7('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x66c7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x153f=['setDataValue','join','crudPermissions','getDataValue','split','sequelize','exports','STRING','name'];(function(_0x15f086,_0xc31be2){var _0x1218ca=function(_0x4a3263){while(--_0x4a3263){_0x15f086['push'](_0x15f086['shift']());}};_0x1218ca(++_0xc31be2);}(_0x153f,0x15b));var _0xf153=function(_0x587a8d,_0x191046){_0x587a8d=_0x587a8d-0x0;var _0x535b3b=_0x153f[_0x587a8d];return _0x535b3b;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')],'allowNull':![],'unique':_0xf153('0x3')},'crudPermissions':{'type':Sequelize[_0xf153('0x2')],'set':function(_0x1ccc1c){this[_0xf153('0x4')]('crudPermissions',_0x1ccc1c?_0x1ccc1c[_0xf153('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xf153('0x6'))?this[_0xf153('0x7')](_0xf153('0x6'))[_0xf153('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf153('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 55dd7a6..936f6e4 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 _0xdcab=['Telephones','zendeskaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','UserProfile','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','clone','rawAttributes','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','sequelize','each','push','removeSections','ids','includes','subsections','enabled','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','field','foreignKey','associatedResources','AnalyticExtractedReport','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','projects','JscriptyProject','Lists','ListId','lists','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicerecordings','VoiceRecording','Agents','membername','role','User','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdcab,0x1e9));var _0xbdca=function(_0x2f5e6d,_0x474f80){_0x2f5e6d=_0x2f5e6d-0x0;var _0x139540=_0xdcab[_0x2f5e6d];return _0x139540;};'use strict';var pdf=require(_0xbdca('0x0'));var emlformat=require(_0xbdca('0x1'));var rimraf=require(_0xbdca('0x2'));var zipdir=require(_0xbdca('0x3'));var jsonpatch=require(_0xbdca('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdca('0x5'));var Mustache=require(_0xbdca('0x6'));var util=require(_0xbdca('0x7'));var path=require(_0xbdca('0x8'));var sox=require(_0xbdca('0x9'));var csv=require(_0xbdca('0xa'));var ejs=require(_0xbdca('0xb'));var fs=require('fs');var _=require(_0xbdca('0xc'));var squel=require(_0xbdca('0xd'));var crypto=require(_0xbdca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbdca('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdca('0x10'));var Papa=require(_0xbdca('0x11'));var Redis=require(_0xbdca('0x12'));var authService=require(_0xbdca('0x13'));var qs=require(_0xbdca('0x14'));var as=require(_0xbdca('0x15'));var hardwareService=require(_0xbdca('0x16'));var logger=require(_0xbdca('0x17'))(_0xbdca('0x18'));var utils=require('../../config/utils');var config=require(_0xbdca('0x19'));var licenseUtil=require(_0xbdca('0x1a'));var db=require(_0xbdca('0x1b'))['db'];config[_0xbdca('0x1c')]=_['defaults'](config[_0xbdca('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdca('0x1d'))(new Redis(config[_0xbdca('0x1c')]));require(_0xbdca('0x1e'))['register'](socket);function respondWithStatusCode(_0x5775ef,_0x18c27a){_0x18c27a=_0x18c27a||0xcc;return function(_0x183db1){if(_0x183db1){return _0x5775ef[_0xbdca('0x1f')](_0x18c27a);}return _0x5775ef[_0xbdca('0x20')](_0x18c27a)[_0xbdca('0x21')]();};}function respondWithResult(_0x133d8d,_0x5f54f5){_0x5f54f5=_0x5f54f5||0xc8;return function(_0x113a82){if(_0x113a82){return _0x133d8d[_0xbdca('0x20')](_0x5f54f5)[_0xbdca('0x22')](_0x113a82);}};}function respondWithFilteredResult(_0x3272ac,_0x5d3623){return function(_0xa813fc){if(_0xa813fc){var _0x90d3d=_0xa813fc[_0xbdca('0x23')],_0x1b98cc=_0x5d3623[_0xbdca('0x24')],_0xb19a6=_0x5d3623['offset']+_0x5d3623[_0xbdca('0x25')],_0x525fea;if(_0xb19a6>=_0x90d3d){_0xb19a6=_0x90d3d;_0x525fea=0xc8;}else{_0x525fea=0xce;}_0x3272ac[_0xbdca('0x20')](_0x525fea);return _0x3272ac['set'](_0xbdca('0x26'),_0x1b98cc+'-'+_0xb19a6+'/'+_0x90d3d)[_0xbdca('0x22')](_0xa813fc);}return null;};}function patchUpdates(_0x1f2e00){return function(_0x3a8e5a){try{jsonpatch[_0xbdca('0x27')](_0x3a8e5a,_0x1f2e00,!![]);}catch(_0x928f64){return BPromise['reject'](_0x928f64);}return _0x3a8e5a[_0xbdca('0x28')]();};}function saveUpdates(_0x3a870a,_0x4b73b1){return function(_0x592f70){if(_0x592f70){return _0x592f70[_0xbdca('0x29')](_0x3a870a)[_0xbdca('0x2a')](function(_0x3fb260){return _0x3fb260;});}return null;};}function removeEntity(_0x27299c,_0x423b42){return function(_0x3f42bc){if(_0x3f42bc){return _0x3f42bc[_0xbdca('0x2b')]()[_0xbdca('0x2a')](function(){_0x27299c[_0xbdca('0x20')](0xcc)[_0xbdca('0x21')]();});}};}function handleEntityNotFound(_0x309987,_0x5b3a00){return function(_0x5ebea6){if(!_0x5ebea6){_0x309987['sendStatus'](0x194);}return _0x5ebea6;};}function handleError(_0x4cdc60,_0x5d6cb8){_0x5d6cb8=_0x5d6cb8||0x1f4;return function(_0x3ddf81){logger[_0xbdca('0x2c')](_0x3ddf81[_0xbdca('0x2d')]);if(_0x3ddf81[_0xbdca('0x2e')]){delete _0x3ddf81[_0xbdca('0x2e')];}_0x4cdc60[_0xbdca('0x20')](_0x5d6cb8)['send'](_0x3ddf81);};}exports[_0xbdca('0x2f')]=function(_0x170948,_0x4cc9c6){var _0x284124={},_0x58b4a7={},_0x3b6675={'count':0x0,'rows':[]};var _0xee59ac=_[_0xbdca('0x30')](db[_0xbdca('0x31')]['rawAttributes'],function(_0x230f32){return{'name':_0x230f32[_0xbdca('0x32')],'type':_0x230f32[_0xbdca('0x33')][_0xbdca('0x34')]};});_0x58b4a7[_0xbdca('0x35')]=_[_0xbdca('0x30')](_0xee59ac,'name');_0x58b4a7[_0xbdca('0x36')]=_['keys'](_0x170948[_0xbdca('0x36')]);_0x58b4a7[_0xbdca('0x37')]=_[_0xbdca('0x38')](_0x58b4a7[_0xbdca('0x35')],_0x58b4a7[_0xbdca('0x36')]);_0x284124[_0xbdca('0x39')]=_[_0xbdca('0x38')](_0x58b4a7[_0xbdca('0x35')],qs['fields'](_0x170948['query'][_0xbdca('0x3a')]));_0x284124[_0xbdca('0x39')]=_0x284124[_0xbdca('0x39')]['length']?_0x284124[_0xbdca('0x39')]:_0x58b4a7[_0xbdca('0x35')];if(!_0x170948['query']['hasOwnProperty'](_0xbdca('0x3b'))){_0x284124[_0xbdca('0x25')]=qs['limit'](_0x170948[_0xbdca('0x36')][_0xbdca('0x25')]);_0x284124['offset']=qs[_0xbdca('0x24')](_0x170948[_0xbdca('0x36')][_0xbdca('0x24')]);}_0x284124[_0xbdca('0x3c')]=qs[_0xbdca('0x3d')](_0x170948[_0xbdca('0x36')]['sort']);_0x284124[_0xbdca('0x3e')]=qs[_0xbdca('0x37')](_[_0xbdca('0x3f')](_0x170948[_0xbdca('0x36')],_0x58b4a7[_0xbdca('0x37')]),_0xee59ac);if(_0x170948['query'][_0xbdca('0x40')]){_0x284124[_0xbdca('0x3e')]=_[_0xbdca('0x41')](_0x284124['where'],{'$or':_[_0xbdca('0x30')](_0xee59ac,function(_0x7586f6){if(_0x7586f6[_0xbdca('0x33')]!==_0xbdca('0x42')){var _0x2319d2={};_0x2319d2[_0x7586f6[_0xbdca('0x2e')]]={'$like':'%'+_0x170948[_0xbdca('0x36')][_0xbdca('0x40')]+'%'};return _0x2319d2;}})});}_0x284124=_[_0xbdca('0x41')]({},_0x284124,_0x170948[_0xbdca('0x43')]);var _0x24af0a={'where':_0x284124['where']};return db[_0xbdca('0x31')][_0xbdca('0x23')](_0x24af0a)[_0xbdca('0x2a')](function(_0xa1db3d){_0x3b6675[_0xbdca('0x23')]=_0xa1db3d;if(_0x170948[_0xbdca('0x36')][_0xbdca('0x44')]){_0x284124[_0xbdca('0x45')]=[{'all':!![]}];}return db[_0xbdca('0x31')][_0xbdca('0x46')](_0x284124);})[_0xbdca('0x2a')](function(_0xd21276){_0x3b6675[_0xbdca('0x47')]=_0xd21276;return _0x3b6675;})[_0xbdca('0x2a')](respondWithFilteredResult(_0x4cc9c6,_0x284124))[_0xbdca('0x48')](handleError(_0x4cc9c6,null));};exports[_0xbdca('0x49')]=function(_0x3de505,_0x50c528){var _0xcdcba6={'raw':![],'where':{'id':_0x3de505[_0xbdca('0x4a')]['id']}},_0x4ace3a={};_0x4ace3a[_0xbdca('0x35')]=_[_0xbdca('0x4b')](db[_0xbdca('0x31')]['rawAttributes']);_0x4ace3a['query']=_['keys'](_0x3de505[_0xbdca('0x36')]);_0x4ace3a[_0xbdca('0x37')]=_['intersection'](_0x4ace3a['model'],_0x4ace3a[_0xbdca('0x36')]);_0xcdcba6[_0xbdca('0x39')]=_[_0xbdca('0x38')](_0x4ace3a[_0xbdca('0x35')],qs[_0xbdca('0x3a')](_0x3de505['query'][_0xbdca('0x3a')]));_0xcdcba6[_0xbdca('0x39')]=_0xcdcba6[_0xbdca('0x39')][_0xbdca('0x4c')]?_0xcdcba6[_0xbdca('0x39')]:_0x4ace3a[_0xbdca('0x35')];if(_0x3de505[_0xbdca('0x36')][_0xbdca('0x44')]){_0xcdcba6[_0xbdca('0x45')]=[{'all':!![]}];}_0xcdcba6=_[_0xbdca('0x41')]({},_0xcdcba6,_0x3de505[_0xbdca('0x43')]);return db[_0xbdca('0x31')][_0xbdca('0x4d')](_0xcdcba6)[_0xbdca('0x2a')](handleEntityNotFound(_0x50c528,null))[_0xbdca('0x2a')](respondWithResult(_0x50c528,null))[_0xbdca('0x48')](handleError(_0x50c528,null));};exports[_0xbdca('0x4e')]=function(_0x2a1209,_0x2139ff){return db[_0xbdca('0x31')][_0xbdca('0x4e')](_0x2a1209[_0xbdca('0x4f')],{})[_0xbdca('0x2a')](respondWithResult(_0x2139ff,0xc9))[_0xbdca('0x48')](handleError(_0x2139ff,null));};exports[_0xbdca('0x50')]=function(_0x13d84d,_0x5a0081){var _0x49791f={'where':{'id':_0x13d84d[_0xbdca('0x4a')]['id']}},_0x46c685={};_0x46c685[_0xbdca('0x35')]=_[_0xbdca('0x4b')](db[_0xbdca('0x31')][_0xbdca('0x51')]);_0x49791f[_0xbdca('0x39')]=_[_0xbdca('0x38')](_0x46c685[_0xbdca('0x35')],qs[_0xbdca('0x3a')](_0x13d84d[_0xbdca('0x36')][_0xbdca('0x3a')]));_0x49791f[_0xbdca('0x39')]=_0x49791f[_0xbdca('0x39')][_0xbdca('0x4c')]?_0x49791f[_0xbdca('0x39')]:_0x46c685[_0xbdca('0x35')];if(_0x13d84d[_0xbdca('0x36')]['includeAll']){_0x49791f['include']=[{'all':!![]}];}_0x49791f=_[_0xbdca('0x41')]({},_0x49791f,_0x13d84d[_0xbdca('0x43')]);return db[_0xbdca('0x31')][_0xbdca('0x4d')](_0x49791f)[_0xbdca('0x2a')](handleEntityNotFound(_0x5a0081,null))[_0xbdca('0x2a')](function(_0x151917){if(_0x151917){var _0x4b971d=_0x151917[_0xbdca('0x52')]({'plain':!![]});_0x4b971d=qs[_0xbdca('0x53')](_0x4b971d,['id',_0xbdca('0x54'),_0xbdca('0x55'),_0xbdca('0x56')]);_0x13d84d[_0xbdca('0x4f')]=_['omit'](_0x13d84d[_0xbdca('0x4f')],['id',_0xbdca('0x54'),_0xbdca('0x55')]);return db['sequelize'][_0xbdca('0x57')](function(_0x522647){return db[_0xbdca('0x31')][_0xbdca('0x4e')](_[_0xbdca('0x41')](_0x4b971d,_0x13d84d[_0xbdca('0x4f')]),{'include':_0x13d84d[_0xbdca('0x36')][_0xbdca('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x522647})[_0xbdca('0x2a')](function(_0x4b93ca){var _0x25bba4=_0x4b93ca[_0xbdca('0x52')]({'plain':!![]});return db[_0xbdca('0x58')][_0xbdca('0x46')]({'where':{'userProfileId':_0x13d84d[_0xbdca('0x4a')]['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x288d4d){if(_0x288d4d){return BPromise['each'](_0x288d4d,function(_0x4b41a3){return new BPromise(function(_0xae5748,_0x17552b){if(_0x4b41a3[_0xbdca('0x59')]===null||_0x4b41a3['autoAssociation']===0x1)_0xae5748(null);return db[_0xbdca('0x5a')]['findAll']({'where':{'sectionId':_0x4b41a3['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x12527f){var _0x5b3f9a=_[_0xbdca('0x30')](_0x12527f,function(_0x465f99){return qs[_0xbdca('0x53')](_0x465f99,['id',_0xbdca('0x54'),_0xbdca('0x55'),_0xbdca('0x5b')]);});_0xae5748(_0x5b3f9a);})[_0xbdca('0x48')](function(_0x5e145b){_0x17552b(_0x5e145b);});})[_0xbdca('0x2a')](function(_0x44e548){var _0x25906b=qs[_0xbdca('0x53')](_0x4b41a3,['id',_0xbdca('0x54'),_0xbdca('0x55')]);_0x25906b[_0xbdca('0x5c')]=_0x25bba4['id'];if(_0x44e548)_0x25906b['Resources']=_0x44e548;return _0x25906b;})[_0xbdca('0x2a')](function(_0x128872){return db['UserProfileSection']['create'](_0x128872,{'include':[{'model':db['UserProfileResource'],'as':_0xbdca('0x5d')}],'raw':!![],'transaction':_0x522647});});})[_0xbdca('0x2a')](function(){return _0x25bba4;});}});});});}})[_0xbdca('0x2a')](respondWithResult(_0x5a0081,0xc9))[_0xbdca('0x48')](handleError(_0x5a0081,null));};exports['update']=function(_0x1adb2e,_0x28b201){if(_0x1adb2e[_0xbdca('0x4f')]['id']){delete _0x1adb2e[_0xbdca('0x4f')]['id'];}return db[_0xbdca('0x31')][_0xbdca('0x4d')]({'where':{'id':_0x1adb2e[_0xbdca('0x4a')]['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x28b201,null))[_0xbdca('0x2a')](saveUpdates(_0x1adb2e[_0xbdca('0x4f')],null))[_0xbdca('0x2a')](respondWithResult(_0x28b201,null))[_0xbdca('0x48')](handleError(_0x28b201,null));};exports['destroy']=function(_0x3967d8,_0x33d464){return db['UserProfile'][_0xbdca('0x4d')]({'where':{'id':_0x3967d8[_0xbdca('0x4a')]['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x33d464,null))[_0xbdca('0x2a')](removeEntity(_0x33d464,null))[_0xbdca('0x48')](handleError(_0x33d464,null));};exports[_0xbdca('0x5e')]=function(_0x45d264,_0x60c1e9){return db[_0xbdca('0x31')][_0xbdca('0x5e')]()['then'](respondWithResult(_0x60c1e9,null))['catch'](handleError(_0x60c1e9,null));};exports['addSections']=function(_0x3921ce,_0x39a352){var _0x24d3e1=_0x3921ce[_0xbdca('0x4f')];return db['UserProfile'][_0xbdca('0x4d')]({'where':{'id':_0x3921ce['params']['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x39a352,null))[_0xbdca('0x2a')](function(_0x283ad5){if(_0x283ad5){return db[_0xbdca('0x5f')]['transaction'](function(_0x3aae68){return db[_0xbdca('0x58')][_0xbdca('0x2b')]({'where':{'userProfileId':_0x3921ce[_0xbdca('0x4a')]['id'],'sectionId':_[_0xbdca('0x30')](_0x24d3e1,function(_0x332c8e){return _0x332c8e['sectionId'];})},'transaction':_0x3aae68})[_0xbdca('0x2a')](function(){var _0x114258=_[_0xbdca('0x30')](_0x24d3e1,function(_0x59f53b){_0x59f53b[_0xbdca('0x5c')]=_0x3921ce[_0xbdca('0x4a')]['id'];return _0x59f53b;});var _0x50af8b=[];return BPromise[_0xbdca('0x60')](_0x114258,function(_0x44e642){return db[_0xbdca('0x58')][_0xbdca('0x4e')](_0x44e642,{'include':[{'model':db[_0xbdca('0x5a')],'as':_0xbdca('0x5d')}],'raw':!![],'transaction':_0x3aae68})[_0xbdca('0x2a')](function(_0x3f062b){_0x50af8b[_0xbdca('0x61')](_0x3f062b[_0xbdca('0x52')]({'plain':!![]}));});})[_0xbdca('0x2a')](function(){return _0x50af8b;});});});}})['then'](function(_0x25250c){return _0x25250c;})[_0xbdca('0x2a')](respondWithResult(_0x39a352,null))['catch'](handleError(_0x39a352,null));};exports[_0xbdca('0x62')]=function(_0x5b8d15,_0x57ed81){var _0x3c798a;return db[_0xbdca('0x31')][_0xbdca('0x4d')]({'where':{'id':_0x5b8d15[_0xbdca('0x4a')]['id']},'attributes':['id','name']})[_0xbdca('0x2a')](handleEntityNotFound(_0x57ed81,null))['then'](function(_0x28f26a){if(_0x28f26a){_0x3c798a=_0x28f26a;return db[_0xbdca('0x58')]['destroy']({'where':{'userProfileId':_0x5b8d15[_0xbdca('0x4a')]['id'],'sectionId':_0x5b8d15['query'][_0xbdca('0x63')]}});}})[_0xbdca('0x2a')](function(){return _0x3c798a;})[_0xbdca('0x2a')](respondWithStatusCode(_0x57ed81,null))[_0xbdca('0x48')](handleError(_0x57ed81,null));};exports['getSections']=function(_0x2ead9d,_0x7e4c23){var _0x22f36=[];var _0x42f80a=[];return db[_0xbdca('0x58')]['findAll']({'where':{'userProfileId':_0x2ead9d[_0xbdca('0x4a')]['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x1705e5){_0x22f36=_[_0xbdca('0x40')](_0x1705e5,function(_0x2e5116){return _0x2e5116['enabled']===0x1||_[_0xbdca('0x64')]([0x3eb,0x709],_0x2e5116[_0xbdca('0x5b')]);});if(!_['isEmpty'](_0x22f36)){return _['map'](_0x22f36,function(_0xbcef8e){return _0xbcef8e[_0xbdca('0x5b')];});}else{return;}})[_0xbdca('0x2a')](function(_0x595cf8){if(_0x595cf8)_0x42f80a=_0x595cf8;if(_[_0xbdca('0x64')](_0x42f80a,0x64)){var _0x1bf02d=_[_0xbdca('0x4d')](_0x22f36,{'sectionId':0x64});return hasDefaultDashboard(_0x1bf02d)[_0xbdca('0x2a')](function(_0x2d49e5){return _[_0xbdca('0x30')](_0x22f36,function(_0x2f6924){if(_0x2f6924[_0xbdca('0x5b')]===0x64){_0x2f6924[_0xbdca('0x65')]=_0x2d49e5;}return _0x2f6924;});});}else{return;}})[_0xbdca('0x2a')](function(_0x270dab){if(_0x270dab)_0x22f36=_0x270dab;if(_[_0xbdca('0x64')](_0x42f80a,0x3eb)){var _0x39222f=_[_0xbdca('0x4d')](_0x22f36,{'sectionId':0x3eb});return getCustomDashboards(_0x39222f)[_0xbdca('0x2a')](function(_0x499f48){return _[_0xbdca('0x30')](_0x22f36,function(_0x2aba71){if(_0x39222f[_0xbdca('0x66')]){if(_0x2aba71[_0xbdca('0x5b')]===0x3eb){_0x2aba71[_0xbdca('0x65')]=_0x499f48;}}else{if(_0x2aba71[_0xbdca('0x5b')]===0x64){_0x2aba71['subsections']=_0x499f48;}}return _0x2aba71;});});}else{return;}})[_0xbdca('0x2a')](function(_0x3149d5){if(_0x3149d5)_0x22f36=_0x3149d5;if(_[_0xbdca('0x64')](_0x42f80a,0x709)){var _0x5da135=_[_0xbdca('0x4d')](_0x22f36,{'sectionId':0x709});return getPlugins(_0x5da135)[_0xbdca('0x2a')](function(_0x1588d0){if(_0x5da135['enabled']){return _['map'](_0x22f36,function(_0x2b5239){if(_0x2b5239[_0xbdca('0x5b')]===0x709){_0x2b5239[_0xbdca('0x65')]=_0x1588d0;}return _0x2b5239;});}else{var _0x5e993d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1588d0};var _0x21f95b=_[_0xbdca('0x30')](_0x22f36);_0x21f95b['push'](_0x5e993d);return _0x21f95b;}});}else{return;}})[_0xbdca('0x2a')](function(_0x30016a){if(_0x30016a)_0x22f36=_0x30016a;return _[_0xbdca('0x40')](_0x22f36,[_0xbdca('0x66'),0x1]);})[_0xbdca('0x2a')](respondWithResult(_0x7e4c23,null))[_0xbdca('0x48')](handleError(_0x7e4c23,null));};function hasDefaultDashboard(_0x18f635){var _0x28a6dc=[0x65];return new BPromise(function(_0x1c9cb7,_0x2de859){try{if(_0x18f635[_0xbdca('0x59')]){_0x1c9cb7(_0x28a6dc);}else{return db[_0xbdca('0x5a')]['findOne']({'where':{'sectionId':_0x18f635['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x5f019c){_0x5f019c?_0x1c9cb7(_0x28a6dc):_0x1c9cb7();});}}catch(_0x298057){_0x2de859(_0x298057);}});}function getCustomDashboards(_0x3960e0){var _0x442369=[];return new BPromise(function(_0x30b7ca,_0x5528cb){try{if(_0x3960e0['autoAssociation']){return db[_0xbdca('0x67')][_0xbdca('0x46')]({'raw':!![]})[_0xbdca('0x2a')](function(_0x4216e3){_0x4216e3[_0xbdca('0x68')](function(_0x468b33){_0x442369[_0xbdca('0x61')](_0x468b33['id']+0x1869f);});_0x30b7ca(_0x442369);});}else{return db[_0xbdca('0x5a')][_0xbdca('0x46')]({'where':{'sectionId':_0x3960e0['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x157ae4){_0x157ae4[_0xbdca('0x68')](function(_0x43db3c){_0x442369['push'](_0x43db3c[_0xbdca('0x69')]+0x1869f);});_0x30b7ca(_0x442369);});}}catch(_0x14751b){_0x5528cb(_0x14751b);}});}function getPlugins(_0x48e9de){var _0x2ad9d0=[];return new BPromise(function(_0xc9ff01,_0x353b04){try{if(_0x48e9de[_0xbdca('0x59')]){return db[_0xbdca('0x6a')]['findAll']({'raw':!![]})[_0xbdca('0x2a')](function(_0x85e3d4){_0x85e3d4['forEach'](function(_0x15616f){_0x2ad9d0[_0xbdca('0x61')](_0x15616f['id']+0x15b38);});_0xc9ff01(_0x2ad9d0);});}else{return db[_0xbdca('0x5a')][_0xbdca('0x46')]({'where':{'sectionId':_0x48e9de['id']},'raw':!![]})[_0xbdca('0x2a')](function(_0x5c0d9b){_0x5c0d9b[_0xbdca('0x68')](function(_0x3b1d33){_0x2ad9d0[_0xbdca('0x61')](_0x3b1d33[_0xbdca('0x69')]+0x15b38);});_0xc9ff01(_0x2ad9d0);});}}catch(_0x57072e){_0x353b04(_0x57072e);}});}exports[_0xbdca('0x6b')]=function(_0x3b584d,_0x10883a){return db[_0xbdca('0x31')]['find']({'where':{'id':_0x3b584d[_0xbdca('0x4a')]['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x10883a,null))[_0xbdca('0x2a')](function(_0x2e8f3e){if(_0x2e8f3e){return db['sequelize'][_0xbdca('0x57')](function(_0x14feca){return db['UserProfileSection'][_0xbdca('0x46')]({'where':{'userProfileId':_0x3b584d[_0xbdca('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3b9a31){if(_0x3b9a31){return db[_0xbdca('0x58')][_0xbdca('0x2b')]({'where':{'userProfileId':_0x3b584d[_0xbdca('0x4a')]['id'],'id':_['map'](_0x3b9a31,function(_0x7f8428){return _0x7f8428['id'];})},'transaction':_0x14feca});}})[_0xbdca('0x2a')](function(_0x8a9853){var _0x54dc84=_['map'](_0x3b584d[_0xbdca('0x4f')],function(_0x5809ae){_0x5809ae[_0xbdca('0x5c')]=_0x3b584d[_0xbdca('0x4a')]['id'];return _0x5809ae;});return db[_0xbdca('0x58')]['bulkCreate'](_0x54dc84,{'raw':!![],'transaction':_0x14feca});})[_0xbdca('0x2a')](function(_0x3b40f1){var _0xceab58=_[_0xbdca('0x40')](_[_0xbdca('0x30')](_0x3b40f1,function(_0x3d6396){return _0x3d6396['get']({'plain':!![]});}),{'includeAll':![]});if(_0xceab58){return db[_0xbdca('0x58')]['findAll']({'where':{'userProfileId':_0x3b584d[_0xbdca('0x4a')]['id'],'sectionId':_[_0xbdca('0x30')](_0xceab58,function(_0x4a5d21){return _0x4a5d21[_0xbdca('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x97da07){var _0xcfb5a2=_['map'](_0x3b584d[_0xbdca('0x4f')],function(_0x18fa7b){_0x18fa7b[_0xbdca('0x5c')]=_0x3b584d[_0xbdca('0x4a')]['id'];return _0x18fa7b;});return db[_0xbdca('0x5a')][_0xbdca('0x6c')](_0xcfb5a2,{'raw':!![],'transaction':_0x14feca});});}})[_0xbdca('0x48')](handleError(_0x10883a,null));});}})[_0xbdca('0x2a')](function(_0x3fa5c1){var _0x48eb9d=_[_0xbdca('0x30')](_0x3fa5c1,function(_0x5b28f3){return _0x5b28f3['get']({'plain':!![]});});})[_0xbdca('0x2a')](respondWithResult(_0x10883a,null))[_0xbdca('0x48')](handleError(_0x10883a,null));};exports[_0xbdca('0x6d')]=function(_0x1b75bd,_0x41790e,_0x215f34){return db[_0xbdca('0x31')][_0xbdca('0x4d')]({'where':{'id':_0x1b75bd['params']['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x41790e,null))[_0xbdca('0x2a')](function(_0x33cdd6){if(_0x33cdd6){return _0x33cdd6[_0xbdca('0x6d')](_0x1b75bd[_0xbdca('0x36')]['ids']);}})[_0xbdca('0x2a')](respondWithStatusCode(_0x41790e,null))[_0xbdca('0x48')](handleError(_0x41790e,null));};exports[_0xbdca('0x6e')]=function(_0x48c7fb,_0x320b98){var _0x4752e5={'raw':![],'where':{}};var _0x279e02={};var _0x3f737e={'count':0x0,'rows':[]};var _0x3278b8=_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x6f')];if(typeof _0x3278b8===_0xbdca('0x70')){throw new db[(_0xbdca('0x71'))][(_0xbdca('0x72'))]('Unknown\x20section');}var _0x5e9ba4=_0x48c7fb['query'][_0xbdca('0x73')]||![];var _0x320e51=getQueryModels(_0x3278b8,_0x5e9ba4);if(typeof _0x320e51[_0xbdca('0x74')]===_0xbdca('0x70')){throw new db['Sequelize']['ValidationError'](_0xbdca('0x75')+_0x3278b8+'\x27');}var _0x1544c7=[];if(!_[_0xbdca('0x76')](_0x320e51[_0xbdca('0x77')])){_0x1544c7=_0x320e51[_0xbdca('0x77')];}else{_0x1544c7=[{'name':_0x3278b8}];}return db['UserProfile']['findOne']({'where':{'id':_0x48c7fb['params']['id']}})[_0xbdca('0x2a')](handleEntityNotFound(_0x320b98,null))[_0xbdca('0x2a')](function(_0x20498f){if(_0x20498f){var _0x3d06d1=[];for(var _0x286deb=0x0;_0x286deb<_0x1544c7[_0xbdca('0x4c')];_0x286deb++){_0x3d06d1[_0xbdca('0x61')](db[_0xbdca('0x58')][_0xbdca('0x78')]({'where':{'userProfileId':_0x20498f['id'],'name':_0x1544c7[_0x286deb][_0xbdca('0x2e')]},'raw':!![]}));}return BPromise[_0xbdca('0x79')](_0x3d06d1);}})['then'](function(_0x4df62c){var _0x1583ce=_[_0xbdca('0x40')](_0x4df62c,function(_0x25c3d3){return _0x25c3d3?_0x25c3d3:undefined;});var _0x30236e=_[_0xbdca('0x40')](_0x1544c7,[_0xbdca('0x7a'),!![]]);var _0x167617=_[_0xbdca('0x76')](_0x1583ce)&&_[_0xbdca('0x76')](_0x30236e)?null:_['union'](_0x30236e,_0x1583ce);if(_0x167617){var _0x1aa9b6=[];for(var _0x115a1d=0x0;_0x115a1d<_0x167617[_0xbdca('0x4c')];_0x115a1d++){var _0xe10649=_['find'](_0x1544c7,function(_0x5e4db8){return _0x167617[_0x115a1d]?_0x5e4db8[_0xbdca('0x2e')]===_0x167617[_0x115a1d][_0xbdca('0x2e')]:null;});if(_0xe10649){if(_0x167617[_0x115a1d]['ignore']){_0x1aa9b6[_0xbdca('0x61')](getAllResources(_0x320e51[_0xbdca('0x74')],_0x167617[_0x115a1d]));}else{if(!_0x167617[_0x115a1d][_0xbdca('0x59')]){_0x1aa9b6[_0xbdca('0x61')](getAllowedResources(_0xe10649,_0x167617[_0x115a1d],_0x320e51[_0xbdca('0x74')]));}else{if(_0xe10649['model']){_0x1aa9b6['push'](getAllFilteredResources(_0xe10649,_0x167617[_0x115a1d]));}}}}}return BPromise[_0xbdca('0x79')](_0x1aa9b6);}else{return null;}})[_0xbdca('0x2a')](function(_0xd2c40c){var _0x72f849=_0xd2c40c;var _0x2ea900=null;if(_0x72f849){_0x2ea900=_0x72f849['length']===0x1?_0x72f849[0x0]:null;}if(_0x2ea900||_0x72f849){var _0x21b0ce=db[_0x320e51[_0xbdca('0x74')]][_0xbdca('0x51')];_0x279e02[_0xbdca('0x35')]=_[_0xbdca('0x4b')](_0x21b0ce);_0x279e02[_0xbdca('0x36')]=_[_0xbdca('0x4b')](_0x48c7fb[_0xbdca('0x36')]);_0x279e02['filters']=_[_0xbdca('0x38')](_0x279e02[_0xbdca('0x35')],_0x279e02['query']);_0x4752e5[_0xbdca('0x39')]=_[_0xbdca('0x38')](_0x279e02[_0xbdca('0x35')],qs[_0xbdca('0x3a')](_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x3a')]));_0x4752e5['attributes']=_0x4752e5['attributes'][_0xbdca('0x4c')]?_0x4752e5[_0xbdca('0x39')]:_0x279e02[_0xbdca('0x35')];if(!_0x48c7fb[_0xbdca('0x36')]['hasOwnProperty']('nolimit')){_0x4752e5[_0xbdca('0x25')]=qs[_0xbdca('0x25')](_0x48c7fb[_0xbdca('0x36')]['limit']);_0x4752e5[_0xbdca('0x24')]=qs[_0xbdca('0x24')](_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x24')]);}_0x4752e5[_0xbdca('0x3c')]=qs[_0xbdca('0x3d')](_0x48c7fb['query'][_0xbdca('0x3d')]);_0x4752e5[_0xbdca('0x3e')]=qs[_0xbdca('0x37')](_['pick'](_0x48c7fb[_0xbdca('0x36')],_0x279e02['filters']));if(_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x40')]){_0x4752e5[_0xbdca('0x3e')]=_[_0xbdca('0x41')](_0x4752e5[_0xbdca('0x3e')],{'$or':_['map'](_0x21b0ce,function(_0x4efd1a){if(_0x4efd1a[_0xbdca('0x33')][_0xbdca('0x34')]!==_0xbdca('0x42')){var _0x34c367={};_0x34c367[_0x4efd1a['field']]={'$like':'%'+_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x40')]+'%'};return _0x34c367;}})});}var _0x1182e4=[];if(_0x2ea900){var _0x3abff1=_['find'](_0x1544c7,[_0xbdca('0x2e'),_0x2ea900[_0xbdca('0x2e')]]);if(_0x3abff1[_0xbdca('0x7b')]){var _0x47b9b9={};if(_0x320e51['childModel']==='AnalyticExtractedReport'){_0x47b9b9[_0x3abff1[_0xbdca('0x7c')]]=_[_0xbdca('0x30')](_0x2ea900[_0xbdca('0x7d')],'id');}else{_0x47b9b9[_0x3abff1[_0xbdca('0x7c')]]=_0x2ea900[_0xbdca('0x7d')];}_0x1182e4['push'](_0x47b9b9);}else{_0x4752e5['where']['id']=_0x2ea900[_0xbdca('0x7d')];}}else{for(var _0x9b5ee8=0x0;_0x9b5ee8<_0x72f849[_0xbdca('0x4c')];_0x9b5ee8++){var _0x3abff1=_['find'](_0x1544c7,[_0xbdca('0x2e'),_0x72f849[_0x9b5ee8][_0xbdca('0x2e')]]);if(_0x3abff1[_0xbdca('0x7b')]){var _0x47b9b9={};_0x47b9b9[_0x3abff1[_0xbdca('0x7c')]]=_0x72f849[_0x9b5ee8][_0xbdca('0x7d')];_0x1182e4[_0xbdca('0x61')](_0x47b9b9);}else{if(!_0x4752e5[_0xbdca('0x3e')]['id'])_0x4752e5[_0xbdca('0x3e')]['id']=[];_0x72f849[_0x9b5ee8][_0xbdca('0x7d')][_0xbdca('0x68')](function(_0x3cf987){_0x4752e5[_0xbdca('0x3e')]['id']['push'](_0x3cf987);});}}}if(!_[_0xbdca('0x76')](_0x1182e4)){_0x4752e5['where']=_['merge'](_0x4752e5[_0xbdca('0x3e')],{'$and':{'$or':_0x1182e4}});}_0x4752e5=_['merge']({},_0x4752e5,_0x48c7fb[_0xbdca('0x43')]);if(_0x2ea900&&!_0x2ea900[_0xbdca('0x59')]&&_0x320e51['childModel']===_0xbdca('0x7e')){if(_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x44')]){_0x4752e5[_0xbdca('0x45')]=[{'all':!![]}];}return db[_0x320e51[_0xbdca('0x74')]][_0xbdca('0x46')](_0x4752e5)[_0xbdca('0x2a')](function(_0x53fb7f){var _0x3e40aa=[];_0x53fb7f[_0xbdca('0x68')](function(_0xf5a352){var _0xd4f31a;switch(_0xf5a352['reportType']){case _0xbdca('0x7f'):_0xd4f31a=_['find'](_0x2ea900['associatedResources'],function(_0x59ccb6){return _0x59ccb6['id']===_0xf5a352[_0xbdca('0x80')]&&_0x59ccb6[_0xbdca('0x33')]===_0xbdca('0x81');});break;case'custom':_0xd4f31a=_[_0xbdca('0x4d')](_0x2ea900[_0xbdca('0x7d')],function(_0x302345){return _0x302345['id']===_0xf5a352[_0xbdca('0x80')]&&_0x302345[_0xbdca('0x33')]===_0xbdca('0x82');});break;}if(_0xd4f31a)_0x3e40aa['push'](_0xf5a352);});_0x3f737e[_0xbdca('0x23')]=_0x3e40aa[_0xbdca('0x4c')];_0x3f737e[_0xbdca('0x47')]=_0x3e40aa;return _0x3f737e;});}else{return db[_0x320e51['childModel']]['count']({'where':_0x4752e5[_0xbdca('0x3e')]})[_0xbdca('0x2a')](function(_0x51f22e){_0x3f737e[_0xbdca('0x23')]=_0x51f22e;if(_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x44')]){if(_0x320e51[_0xbdca('0x74')]===_0xbdca('0x83')){_0x4752e5[_0xbdca('0x45')]=[{'model':db[_0xbdca('0x84')],'as':_0xbdca('0x85'),'attributes':['id',_0xbdca('0x2e'),_0xbdca('0x86')],'required':_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x87')]?!![]:![]},{'model':db[_0xbdca('0x84')],'as':_0xbdca('0x88'),'attributes':['id','name',_0xbdca('0x86')],'through':_0x48c7fb[_0xbdca('0x36')]['tag']?{'attributes':[],'where':{'TagId':_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x87')]||undefined}}:{},'required':_0x48c7fb[_0xbdca('0x36')][_0xbdca('0x87')]?!![]:![]}];}else{_0x4752e5['include']=[{'all':!![]}];}}return db[_0x320e51[_0xbdca('0x74')]][_0xbdca('0x46')](_0x4752e5);})[_0xbdca('0x2a')](function(_0x54de06){_0x3f737e[_0xbdca('0x47')]=_0x54de06;return _0x3f737e;});}}else{return _0x3f737e;}})[_0xbdca('0x2a')](respondWithFilteredResult(_0x320b98,_0x4752e5))[_0xbdca('0x48')](handleError(_0x320b98,null));};function getAllResources(_0x58bb86,_0x1f1531){return new BPromise(function(_0x2a86a6,_0x3d22e3){if(_0x1f1531){var _0x1ea146=_0x1f1531['filter']?{[_0x1f1531[_0xbdca('0x40')][_0xbdca('0x7b')]]:_0x1f1531[_0xbdca('0x40')]['value']}:undefined;return db[_0x58bb86][_0xbdca('0x46')]({'where':_0x1ea146,'raw':!![]})[_0xbdca('0x2a')](function(_0x41ebad){_0x1f1531['associatedResources']=_[_0xbdca('0x30')](_0x41ebad,'id');_0x2a86a6(_0x1f1531);})['catch'](function(_0x1bcd38){_0x3d22e3(_0x1bcd38);});}else{_0x2a86a6(null);}});}function getAllFilteredResources(_0x47892c,_0x44c17f){return new BPromise(function(_0x2345bc,_0x307c34){var _0x191d4c=_0x47892c['filter']?{[_0x47892c[_0xbdca('0x40')][_0xbdca('0x7b')]]:_0x47892c['filter']['value']}:undefined;return db[_0x47892c[_0xbdca('0x35')]][_0xbdca('0x46')]({'where':_0x191d4c,'raw':!![]})[_0xbdca('0x2a')](function(_0x5a6de7){_0x44c17f[_0xbdca('0x7d')]=_['map'](_0x5a6de7,function(_0x2d24d2){return _0x2d24d2[_0xbdca('0x2e')];});_0x2345bc(_0x44c17f);})[_0xbdca('0x48')](function(_0x4c305a){_0x307c34(_0x4c305a);});});}function getAllowedResources(_0x627b67,_0xce46e8,_0x10f556){return new BPromise(function(_0x234fd9,_0x313e79){if(_0xce46e8){return db[_0xbdca('0x5a')][_0xbdca('0x46')]({'where':{'sectionId':_0xce46e8['id']},'raw':!![]})['then'](function(_0x58daa7){if(_0x627b67[_0xbdca('0x7b')]&&_0x627b67[_0xbdca('0x7b')]!=='id'){_0xce46e8[_0xbdca('0x7d')]=_[_0xbdca('0x30')](_0x58daa7,function(_0x40e8af){return _0x40e8af[_0x627b67['field']];});}else{if(_0x10f556===_0xbdca('0x7e')){_0xce46e8[_0xbdca('0x7d')]=_[_0xbdca('0x30')](_0x58daa7,function(_0x2d0e88){return{'id':_0x2d0e88['resourceId'],'type':_0x2d0e88['type']};});}else{_0xce46e8['associatedResources']=_[_0xbdca('0x30')](_0x58daa7,function(_0xdf7adf){return _0xdf7adf[_0xbdca('0x69')];});}}_0x234fd9(_0xce46e8);})[_0xbdca('0x48')](function(_0x178668){_0x313e79(_0x178668);});}else{_0x234fd9(null);}});}function getQueryModels(_0x5c05ee,_0x4406bd){var _0x223378=_0x5c05ee[_0xbdca('0x89')]();var _0x5c3072={'childModel':undefined,'parentSections':[]};switch(_0x223378){case _0xbdca('0x8a'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x8b');break;case _0xbdca('0x8c'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x8d');break;case _0xbdca('0x8e'):_0x5c3072[_0xbdca('0x74')]='SquareRecording';_0x5c3072[_0xbdca('0x77')]=[{'name':'SquareProjects','field':_0xbdca('0x2e'),'foreignKey':'projectName'}];break;case _0xbdca('0x8f'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x90');break;case'contacts':_0x5c3072['childModel']=_0xbdca('0x83');_0x5c3072['parentSections']=[{'name':_0xbdca('0x91'),'field':'id','foreignKey':_0xbdca('0x92')}];break;case _0xbdca('0x93'):_0x5c3072['childModel']='CmList';break;case _0xbdca('0x94'):_0x5c3072[_0xbdca('0x74')]='CmCompany';break;case'globalcustomfields':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x95');break;case _0xbdca('0x96'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x97');break;case _0xbdca('0x98'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x99');break;case'faxqueues':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x9a');break;case'faxaccounts':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x9b');break;case _0xbdca('0x9c'):case _0xbdca('0x9d'):case'outboundroutes':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x9e');break;case _0xbdca('0x9f'):_0x5c3072[_0xbdca('0x74')]='VoiceContext';break;case'voicemails':_0x5c3072[_0xbdca('0x74')]='VoiceMail';break;case _0xbdca('0xa0'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xa1');_0x5c3072[_0xbdca('0x77')]=[{'name':_0xbdca('0xa2'),'field':_0xbdca('0x2e'),'foreignKey':_0xbdca('0xa3'),'model':'User','filter':{'field':_0xbdca('0xa4'),'value':['agent']}},{'name':'Telephones','field':_0xbdca('0x2e'),'foreignKey':_0xbdca('0xa3'),'model':_0xbdca('0xa5'),'filter':{'field':'role','value':[_0xbdca('0xa6')]}},{'name':_0xbdca('0xa7'),'field':_0xbdca('0x2e'),'foreignKey':'queue','model':_0xbdca('0xa8'),'filter':{'field':_0xbdca('0x33'),'value':['inbound']}},{'name':_0xbdca('0xa9'),'field':_0xbdca('0x2e'),'foreignKey':_0xbdca('0xaa'),'model':'VoiceQueue','filter':{'field':_0xbdca('0x33'),'value':[_0xbdca('0xab')]}}];break;case _0xbdca('0xac'):_0x5c3072[_0xbdca('0x74')]='VoiceMusicOnHold';break;case _0xbdca('0xad'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xae');break;case _0xbdca('0xaf'):_0x5c3072['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb0');break;case _0xbdca('0xb1'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb2');break;case _0xbdca('0xb3'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb4');break;case _0xbdca('0xb5'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb6');break;case _0xbdca('0xb7'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb8');break;case'openchannelaccounts':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xb9');break;case _0xbdca('0xba'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xbb');break;case'smsaccounts':_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xbc');break;case _0xbdca('0xbd'):_0x5c3072['childModel']=_0xbdca('0xbe');break;case'whatsappaccounts':_0x5c3072['childModel']='WhatsappAccount';break;case _0xbdca('0xbf'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xc0');break;case _0xbdca('0xc1'):case _0xbdca('0xc2'):_0x5c3072[_0xbdca('0x74')]='VoiceQueue';if(_0x4406bd){_0x5c3072[_0xbdca('0x77')]=[{'name':_0xbdca('0xa7')},{'name':_0xbdca('0xa9')}];}break;case _0xbdca('0xc3'):case _0xbdca('0xc4'):case _0xbdca('0xc5'):_0x5c3072['childModel']='User';if(_0x4406bd){_0x5c3072[_0xbdca('0x77')]=[{'name':_0xbdca('0xc6'),'filter':{'field':_0xbdca('0xa4'),'value':[_0xbdca('0xc7'),_0xbdca('0xc8')]},'ignore':!![]},{'name':_0xbdca('0xa2')},{'name':_0xbdca('0xc9')}];}break;case _0xbdca('0xca'):_0x5c3072[_0xbdca('0x74')]='ZendeskAccount';break;case'salesforceaccounts':_0x5c3072['childModel']=_0xbdca('0xcb');break;case _0xbdca('0xcc'):_0x5c3072[_0xbdca('0x74')]='FreshdeskAccount';break;case _0xbdca('0xcd'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xce');break;case _0xbdca('0xcf'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xd0');break;case'zohoaccounts':_0x5c3072[_0xbdca('0x74')]='ZohoAccount';break;case _0xbdca('0xd1'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xa5');break;case'cannedanswers':_0x5c3072['childModel']=_0xbdca('0xd2');break;case _0xbdca('0xd3'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xd4');break;case'customdashboards':_0x5c3072[_0xbdca('0x74')]='Dashboard';break;case _0xbdca('0xd5'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xd6');break;case _0xbdca('0xd7'):_0x5c3072[_0xbdca('0x74')]='Pause';break;case'scheduler':_0x5c3072['childModel']='Schedule';break;case _0xbdca('0xd8'):_0x5c3072[_0xbdca('0x74')]='Sound';break;case _0xbdca('0xd9'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x84');break;case _0xbdca('0xda'):_0x5c3072[_0xbdca('0x74')]='Template';break;case _0xbdca('0xdb'):_0x5c3072['childModel']=_0xbdca('0xdc');break;case _0xbdca('0xdd'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xde');break;case _0xbdca('0xdf'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xe0');break;case _0xbdca('0xe1'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x6a');break;case _0xbdca('0xe2'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0x7e');_0x5c3072[_0xbdca('0x77')]=[{'name':_0xbdca('0xe3'),'field':'id','foreignKey':'reportId'}];break;case _0xbdca('0xe4'):_0x5c3072[_0xbdca('0x74')]=_0xbdca('0xe5');break;case'whatsappaccounts':_0x5c3072[_0xbdca('0x74')]='WhatsappAccount';break;default:return _0x5c3072;}return _0x5c3072;} \ No newline at end of file +var _0xbb7c=['union','ignore','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','include','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','findAll','sectionId','userProfileId','UserProfileResource','describe','addSections','each','Resources','push','removeSections','ids','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','isEmpty','parentSections','all'];(function(_0x24c564,_0x49afff){var _0x3a5538=function(_0x3cbaa1){while(--_0x3cbaa1){_0x24c564['push'](_0x24c564['shift']());}};_0x3a5538(++_0x49afff);}(_0xbb7c,0x17a));var _0xcbb7=function(_0x13c9d8,_0x2aad06){_0x13c9d8=_0x13c9d8-0x0;var _0x57a665=_0xbb7c[_0x13c9d8];return _0x57a665;};'use strict';var pdf=require(_0xcbb7('0x0'));var emlformat=require(_0xcbb7('0x1'));var rimraf=require(_0xcbb7('0x2'));var zipdir=require(_0xcbb7('0x3'));var jsonpatch=require(_0xcbb7('0x4'));var rp=require(_0xcbb7('0x5'));var moment=require(_0xcbb7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcbb7('0x7'));var util=require(_0xcbb7('0x8'));var path=require(_0xcbb7('0x9'));var sox=require(_0xcbb7('0xa'));var csv=require(_0xcbb7('0xb'));var ejs=require(_0xcbb7('0xc'));var fs=require('fs');var _=require(_0xcbb7('0xd'));var squel=require(_0xcbb7('0xe'));var crypto=require('crypto');var jsforce=require(_0xcbb7('0xf'));var deskjs=require(_0xcbb7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcbb7('0x11'));var Redis=require(_0xcbb7('0x12'));var authService=require(_0xcbb7('0x13'));var qs=require(_0xcbb7('0x14'));var as=require(_0xcbb7('0x15'));var hardwareService=require(_0xcbb7('0x16'));var logger=require(_0xcbb7('0x17'))(_0xcbb7('0x18'));var utils=require(_0xcbb7('0x19'));var config=require(_0xcbb7('0x1a'));var licenseUtil=require(_0xcbb7('0x1b'));var db=require(_0xcbb7('0x1c'))['db'];config[_0xcbb7('0x1d')]=_['defaults'](config['redis'],{'host':_0xcbb7('0x1e'),'port':0x18eb});var socket=require(_0xcbb7('0x1f'))(new Redis(config[_0xcbb7('0x1d')]));require(_0xcbb7('0x20'))[_0xcbb7('0x21')](socket);function respondWithStatusCode(_0x9f4e68,_0x5282d7){_0x5282d7=_0x5282d7||0xcc;return function(_0x1e1c56){if(_0x1e1c56){return _0x9f4e68[_0xcbb7('0x22')](_0x5282d7);}return _0x9f4e68['status'](_0x5282d7)[_0xcbb7('0x23')]();};}function respondWithResult(_0x3b5a46,_0x384df6){_0x384df6=_0x384df6||0xc8;return function(_0xecda81){if(_0xecda81){return _0x3b5a46[_0xcbb7('0x24')](_0x384df6)[_0xcbb7('0x25')](_0xecda81);}};}function respondWithFilteredResult(_0x4a0142,_0x10449a){return function(_0x4afcd8){if(_0x4afcd8){var _0x63833=_0x4afcd8['count'],_0xd059f1=_0x10449a[_0xcbb7('0x26')],_0xfc6d3d=_0x10449a['offset']+_0x10449a[_0xcbb7('0x27')],_0x5d69ef;if(_0xfc6d3d>=_0x63833){_0xfc6d3d=_0x63833;_0x5d69ef=0xc8;}else{_0x5d69ef=0xce;}_0x4a0142[_0xcbb7('0x24')](_0x5d69ef);return _0x4a0142[_0xcbb7('0x28')]('Content-Range',_0xd059f1+'-'+_0xfc6d3d+'/'+_0x63833)[_0xcbb7('0x25')](_0x4afcd8);}return null;};}function patchUpdates(_0x591efb){return function(_0x3c9f4d){try{jsonpatch[_0xcbb7('0x29')](_0x3c9f4d,_0x591efb,!![]);}catch(_0x54bb65){return BPromise[_0xcbb7('0x2a')](_0x54bb65);}return _0x3c9f4d[_0xcbb7('0x2b')]();};}function saveUpdates(_0x4fdd60,_0x52b689){return function(_0x32a503){if(_0x32a503){return _0x32a503['update'](_0x4fdd60)[_0xcbb7('0x2c')](function(_0xa062a5){return _0xa062a5;});}return null;};}function removeEntity(_0x1e7202,_0x14657c){return function(_0x5b34f9){if(_0x5b34f9){return _0x5b34f9[_0xcbb7('0x2d')]()[_0xcbb7('0x2c')](function(){_0x1e7202[_0xcbb7('0x24')](0xcc)[_0xcbb7('0x23')]();});}};}function handleEntityNotFound(_0x84dfe9,_0x2f986e){return function(_0x5477cb){if(!_0x5477cb){_0x84dfe9[_0xcbb7('0x22')](0x194);}return _0x5477cb;};}function handleError(_0x3b414c,_0x1cb528){_0x1cb528=_0x1cb528||0x1f4;return function(_0x3a5f50){logger[_0xcbb7('0x2e')](_0x3a5f50[_0xcbb7('0x2f')]);if(_0x3a5f50[_0xcbb7('0x30')]){delete _0x3a5f50['name'];}_0x3b414c[_0xcbb7('0x24')](_0x1cb528)[_0xcbb7('0x31')](_0x3a5f50);};}exports[_0xcbb7('0x32')]=function(_0x274479,_0x3a39d3){var _0x156a00={},_0x9e55bd={},_0x3d6459={'count':0x0,'rows':[]};var _0x5e2c33=_[_0xcbb7('0x33')](db[_0xcbb7('0x34')][_0xcbb7('0x35')],function(_0x5c02bb){return{'name':_0x5c02bb[_0xcbb7('0x36')],'type':_0x5c02bb[_0xcbb7('0x37')][_0xcbb7('0x38')]};});_0x9e55bd[_0xcbb7('0x39')]=_[_0xcbb7('0x33')](_0x5e2c33,_0xcbb7('0x30'));_0x9e55bd['query']=_[_0xcbb7('0x3a')](_0x274479['query']);_0x9e55bd['filters']=_[_0xcbb7('0x3b')](_0x9e55bd[_0xcbb7('0x39')],_0x9e55bd['query']);_0x156a00[_0xcbb7('0x3c')]=_[_0xcbb7('0x3b')](_0x9e55bd[_0xcbb7('0x39')],qs[_0xcbb7('0x3d')](_0x274479[_0xcbb7('0x3e')][_0xcbb7('0x3d')]));_0x156a00['attributes']=_0x156a00[_0xcbb7('0x3c')][_0xcbb7('0x3f')]?_0x156a00[_0xcbb7('0x3c')]:_0x9e55bd[_0xcbb7('0x39')];if(!_0x274479['query'][_0xcbb7('0x40')](_0xcbb7('0x41'))){_0x156a00[_0xcbb7('0x27')]=qs[_0xcbb7('0x27')](_0x274479[_0xcbb7('0x3e')][_0xcbb7('0x27')]);_0x156a00[_0xcbb7('0x26')]=qs[_0xcbb7('0x26')](_0x274479[_0xcbb7('0x3e')]['offset']);}_0x156a00[_0xcbb7('0x42')]=qs[_0xcbb7('0x43')](_0x274479[_0xcbb7('0x3e')][_0xcbb7('0x43')]);_0x156a00['where']=qs[_0xcbb7('0x44')](_[_0xcbb7('0x45')](_0x274479[_0xcbb7('0x3e')],_0x9e55bd['filters']),_0x5e2c33);if(_0x274479[_0xcbb7('0x3e')]['filter']){_0x156a00[_0xcbb7('0x46')]=_[_0xcbb7('0x47')](_0x156a00[_0xcbb7('0x46')],{'$or':_[_0xcbb7('0x33')](_0x5e2c33,function(_0x10cf72){if(_0x10cf72['type']!==_0xcbb7('0x48')){var _0x442dfa={};_0x442dfa[_0x10cf72[_0xcbb7('0x30')]]={'$like':'%'+_0x274479[_0xcbb7('0x3e')][_0xcbb7('0x49')]+'%'};return _0x442dfa;}})});}_0x156a00=_['merge']({},_0x156a00,_0x274479[_0xcbb7('0x4a')]);var _0x24af79={'where':_0x156a00[_0xcbb7('0x46')]};return db[_0xcbb7('0x34')][_0xcbb7('0x4b')](_0x24af79)['then'](function(_0x23f625){_0x3d6459[_0xcbb7('0x4b')]=_0x23f625;if(_0x274479[_0xcbb7('0x3e')][_0xcbb7('0x4c')]){_0x156a00['include']=[{'all':!![]}];}return db[_0xcbb7('0x34')]['findAll'](_0x156a00);})[_0xcbb7('0x2c')](function(_0x5bdf86){_0x3d6459[_0xcbb7('0x4d')]=_0x5bdf86;return _0x3d6459;})[_0xcbb7('0x2c')](respondWithFilteredResult(_0x3a39d3,_0x156a00))[_0xcbb7('0x4e')](handleError(_0x3a39d3,null));};exports[_0xcbb7('0x4f')]=function(_0x33bd59,_0x31c07d){var _0x543d79={'raw':![],'where':{'id':_0x33bd59[_0xcbb7('0x50')]['id']}},_0xffcc05={};_0xffcc05[_0xcbb7('0x39')]=_['keys'](db[_0xcbb7('0x34')][_0xcbb7('0x35')]);_0xffcc05[_0xcbb7('0x3e')]=_[_0xcbb7('0x3a')](_0x33bd59['query']);_0xffcc05[_0xcbb7('0x44')]=_[_0xcbb7('0x3b')](_0xffcc05[_0xcbb7('0x39')],_0xffcc05[_0xcbb7('0x3e')]);_0x543d79[_0xcbb7('0x3c')]=_['intersection'](_0xffcc05[_0xcbb7('0x39')],qs[_0xcbb7('0x3d')](_0x33bd59['query'][_0xcbb7('0x3d')]));_0x543d79[_0xcbb7('0x3c')]=_0x543d79['attributes'][_0xcbb7('0x3f')]?_0x543d79[_0xcbb7('0x3c')]:_0xffcc05['model'];if(_0x33bd59[_0xcbb7('0x3e')]['includeAll']){_0x543d79[_0xcbb7('0x51')]=[{'all':!![]}];}_0x543d79=_[_0xcbb7('0x47')]({},_0x543d79,_0x33bd59['options']);return db[_0xcbb7('0x34')][_0xcbb7('0x52')](_0x543d79)['then'](handleEntityNotFound(_0x31c07d,null))[_0xcbb7('0x2c')](respondWithResult(_0x31c07d,null))[_0xcbb7('0x4e')](handleError(_0x31c07d,null));};exports[_0xcbb7('0x53')]=function(_0xabd6ca,_0x509ac4){return db[_0xcbb7('0x34')][_0xcbb7('0x53')](_0xabd6ca[_0xcbb7('0x54')],{})['then'](respondWithResult(_0x509ac4,0xc9))[_0xcbb7('0x4e')](handleError(_0x509ac4,null));};exports[_0xcbb7('0x55')]=function(_0x2d9971,_0xc9995f){var _0x21a5d5={'where':{'id':_0x2d9971[_0xcbb7('0x50')]['id']}},_0xfa49fd={};_0xfa49fd[_0xcbb7('0x39')]=_[_0xcbb7('0x3a')](db[_0xcbb7('0x34')][_0xcbb7('0x35')]);_0x21a5d5[_0xcbb7('0x3c')]=_['intersection'](_0xfa49fd[_0xcbb7('0x39')],qs[_0xcbb7('0x3d')](_0x2d9971[_0xcbb7('0x3e')][_0xcbb7('0x3d')]));_0x21a5d5[_0xcbb7('0x3c')]=_0x21a5d5[_0xcbb7('0x3c')][_0xcbb7('0x3f')]?_0x21a5d5[_0xcbb7('0x3c')]:_0xfa49fd[_0xcbb7('0x39')];if(_0x2d9971[_0xcbb7('0x3e')]['includeAll']){_0x21a5d5[_0xcbb7('0x51')]=[{'all':!![]}];}_0x21a5d5=_[_0xcbb7('0x47')]({},_0x21a5d5,_0x2d9971[_0xcbb7('0x4a')]);return db[_0xcbb7('0x34')][_0xcbb7('0x52')](_0x21a5d5)['then'](handleEntityNotFound(_0xc9995f,null))['then'](function(_0x50bb64){if(_0x50bb64){var _0x5b9d7e=_0x50bb64[_0xcbb7('0x56')]({'plain':!![]});_0x5b9d7e=qs[_0xcbb7('0x57')](_0x5b9d7e,['id',_0xcbb7('0x58'),_0xcbb7('0x59'),_0xcbb7('0x5a')]);_0x2d9971['body']=_[_0xcbb7('0x57')](_0x2d9971[_0xcbb7('0x54')],['id',_0xcbb7('0x58'),_0xcbb7('0x59')]);return db[_0xcbb7('0x5b')][_0xcbb7('0x5c')](function(_0x329551){return db['UserProfile']['create'](_[_0xcbb7('0x47')](_0x5b9d7e,_0x2d9971[_0xcbb7('0x54')]),{'include':_0x2d9971['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x329551})[_0xcbb7('0x2c')](function(_0x161a46){var _0x578f3f=_0x161a46[_0xcbb7('0x56')]({'plain':!![]});return db[_0xcbb7('0x5d')]['findAll']({'where':{'userProfileId':_0x2d9971['params']['id']},'raw':!![]})['then'](function(_0x1d5320){if(_0x1d5320){return BPromise['each'](_0x1d5320,function(_0x1a0096){return new BPromise(function(_0xcd2a36,_0x20ecf4){if(_0x1a0096[_0xcbb7('0x5e')]===null||_0x1a0096[_0xcbb7('0x5e')]===0x1)_0xcd2a36(null);return db['UserProfileResource'][_0xcbb7('0x5f')]({'where':{'sectionId':_0x1a0096['id']},'raw':!![]})['then'](function(_0x309c46){var _0x357816=_[_0xcbb7('0x33')](_0x309c46,function(_0x2f6e15){return qs[_0xcbb7('0x57')](_0x2f6e15,['id',_0xcbb7('0x58'),'updatedAt',_0xcbb7('0x60')]);});_0xcd2a36(_0x357816);})[_0xcbb7('0x4e')](function(_0x2c70d0){_0x20ecf4(_0x2c70d0);});})[_0xcbb7('0x2c')](function(_0x4f1c5f){var _0x5ee0a5=qs[_0xcbb7('0x57')](_0x1a0096,['id','createdAt',_0xcbb7('0x59')]);_0x5ee0a5[_0xcbb7('0x61')]=_0x578f3f['id'];if(_0x4f1c5f)_0x5ee0a5['Resources']=_0x4f1c5f;return _0x5ee0a5;})[_0xcbb7('0x2c')](function(_0x2fb112){return db[_0xcbb7('0x5d')][_0xcbb7('0x53')](_0x2fb112,{'include':[{'model':db[_0xcbb7('0x62')],'as':'Resources'}],'raw':!![],'transaction':_0x329551});});})[_0xcbb7('0x2c')](function(){return _0x578f3f;});}});});});}})[_0xcbb7('0x2c')](respondWithResult(_0xc9995f,0xc9))[_0xcbb7('0x4e')](handleError(_0xc9995f,null));};exports['update']=function(_0x2d536c,_0x3835db){if(_0x2d536c[_0xcbb7('0x54')]['id']){delete _0x2d536c[_0xcbb7('0x54')]['id'];}return db[_0xcbb7('0x34')]['find']({'where':{'id':_0x2d536c[_0xcbb7('0x50')]['id']}})[_0xcbb7('0x2c')](handleEntityNotFound(_0x3835db,null))[_0xcbb7('0x2c')](saveUpdates(_0x2d536c['body'],null))[_0xcbb7('0x2c')](respondWithResult(_0x3835db,null))['catch'](handleError(_0x3835db,null));};exports[_0xcbb7('0x2d')]=function(_0x11c73c,_0x33f5b9){return db[_0xcbb7('0x34')][_0xcbb7('0x52')]({'where':{'id':_0x11c73c[_0xcbb7('0x50')]['id']}})[_0xcbb7('0x2c')](handleEntityNotFound(_0x33f5b9,null))[_0xcbb7('0x2c')](removeEntity(_0x33f5b9,null))[_0xcbb7('0x4e')](handleError(_0x33f5b9,null));};exports[_0xcbb7('0x63')]=function(_0x215a6a,_0x197b5e){return db[_0xcbb7('0x34')]['describe']()[_0xcbb7('0x2c')](respondWithResult(_0x197b5e,null))['catch'](handleError(_0x197b5e,null));};exports[_0xcbb7('0x64')]=function(_0x3a5315,_0x2448ff){var _0x7ac8a0=_0x3a5315[_0xcbb7('0x54')];return db[_0xcbb7('0x34')][_0xcbb7('0x52')]({'where':{'id':_0x3a5315[_0xcbb7('0x50')]['id']}})['then'](handleEntityNotFound(_0x2448ff,null))[_0xcbb7('0x2c')](function(_0x138eec){if(_0x138eec){return db['sequelize'][_0xcbb7('0x5c')](function(_0x96161f){return db['UserProfileSection'][_0xcbb7('0x2d')]({'where':{'userProfileId':_0x3a5315[_0xcbb7('0x50')]['id'],'sectionId':_[_0xcbb7('0x33')](_0x7ac8a0,function(_0x45cbde){return _0x45cbde['sectionId'];})},'transaction':_0x96161f})[_0xcbb7('0x2c')](function(){var _0x28811e=_[_0xcbb7('0x33')](_0x7ac8a0,function(_0x112565){_0x112565[_0xcbb7('0x61')]=_0x3a5315[_0xcbb7('0x50')]['id'];return _0x112565;});var _0x22f658=[];return BPromise[_0xcbb7('0x65')](_0x28811e,function(_0x9b20ad){return db[_0xcbb7('0x5d')][_0xcbb7('0x53')](_0x9b20ad,{'include':[{'model':db[_0xcbb7('0x62')],'as':_0xcbb7('0x66')}],'raw':!![],'transaction':_0x96161f})[_0xcbb7('0x2c')](function(_0x1b2d07){_0x22f658[_0xcbb7('0x67')](_0x1b2d07[_0xcbb7('0x56')]({'plain':!![]}));});})[_0xcbb7('0x2c')](function(){return _0x22f658;});});});}})[_0xcbb7('0x2c')](function(_0xf7336c){return _0xf7336c;})[_0xcbb7('0x2c')](respondWithResult(_0x2448ff,null))[_0xcbb7('0x4e')](handleError(_0x2448ff,null));};exports[_0xcbb7('0x68')]=function(_0x3ac937,_0x1fc890){var _0x4cdd1e;return db['UserProfile'][_0xcbb7('0x52')]({'where':{'id':_0x3ac937[_0xcbb7('0x50')]['id']},'attributes':['id',_0xcbb7('0x30')]})[_0xcbb7('0x2c')](handleEntityNotFound(_0x1fc890,null))[_0xcbb7('0x2c')](function(_0x5d1425){if(_0x5d1425){_0x4cdd1e=_0x5d1425;return db[_0xcbb7('0x5d')][_0xcbb7('0x2d')]({'where':{'userProfileId':_0x3ac937['params']['id'],'sectionId':_0x3ac937[_0xcbb7('0x3e')][_0xcbb7('0x69')]}});}})[_0xcbb7('0x2c')](function(){return _0x4cdd1e;})['then'](respondWithStatusCode(_0x1fc890,null))[_0xcbb7('0x4e')](handleError(_0x1fc890,null));};exports['getSections']=function(_0x2ab5d9,_0x54a5a0){var _0x5ebcd2=[];var _0x161d9c=[];return db['UserProfileSection'][_0xcbb7('0x5f')]({'where':{'userProfileId':_0x2ab5d9[_0xcbb7('0x50')]['id']},'raw':!![]})[_0xcbb7('0x2c')](function(_0x14edea){_0x5ebcd2=_['filter'](_0x14edea,function(_0x44bda9){return _0x44bda9['enabled']===0x1||_[_0xcbb7('0x6a')]([0x3eb,0x709],_0x44bda9[_0xcbb7('0x60')]);});if(!_['isEmpty'](_0x5ebcd2)){return _[_0xcbb7('0x33')](_0x5ebcd2,function(_0x26866d){return _0x26866d['sectionId'];});}else{return;}})['then'](function(_0x2f73e8){if(_0x2f73e8)_0x161d9c=_0x2f73e8;if(_['includes'](_0x161d9c,0x64)){var _0x5d6e1c=_[_0xcbb7('0x52')](_0x5ebcd2,{'sectionId':0x64});return hasDefaultDashboard(_0x5d6e1c)[_0xcbb7('0x2c')](function(_0x3ce17f){return _[_0xcbb7('0x33')](_0x5ebcd2,function(_0x3d8fea){if(_0x3d8fea[_0xcbb7('0x60')]===0x64){_0x3d8fea[_0xcbb7('0x6b')]=_0x3ce17f;}return _0x3d8fea;});});}else{return;}})[_0xcbb7('0x2c')](function(_0xbb2cdb){if(_0xbb2cdb)_0x5ebcd2=_0xbb2cdb;if(_[_0xcbb7('0x6a')](_0x161d9c,0x3eb)){var _0x270197=_[_0xcbb7('0x52')](_0x5ebcd2,{'sectionId':0x3eb});return getCustomDashboards(_0x270197)['then'](function(_0x1a8aef){return _[_0xcbb7('0x33')](_0x5ebcd2,function(_0x25276b){if(_0x270197['enabled']){if(_0x25276b[_0xcbb7('0x60')]===0x3eb){_0x25276b[_0xcbb7('0x6b')]=_0x1a8aef;}}else{if(_0x25276b[_0xcbb7('0x60')]===0x64){_0x25276b[_0xcbb7('0x6b')]=_0x1a8aef;}}return _0x25276b;});});}else{return;}})[_0xcbb7('0x2c')](function(_0x29e63d){if(_0x29e63d)_0x5ebcd2=_0x29e63d;if(_[_0xcbb7('0x6a')](_0x161d9c,0x709)){var _0x10ba4f=_[_0xcbb7('0x52')](_0x5ebcd2,{'sectionId':0x709});return getPlugins(_0x10ba4f)[_0xcbb7('0x2c')](function(_0x2ffe31){if(_0x10ba4f[_0xcbb7('0x6c')]){return _[_0xcbb7('0x33')](_0x5ebcd2,function(_0x382df5){if(_0x382df5[_0xcbb7('0x60')]===0x709){_0x382df5[_0xcbb7('0x6b')]=_0x2ffe31;}return _0x382df5;});}else{var _0x1ce616={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ffe31};var _0x205f38=_[_0xcbb7('0x33')](_0x5ebcd2);_0x205f38[_0xcbb7('0x67')](_0x1ce616);return _0x205f38;}});}else{return;}})[_0xcbb7('0x2c')](function(_0x243d69){if(_0x243d69)_0x5ebcd2=_0x243d69;return _[_0xcbb7('0x49')](_0x5ebcd2,[_0xcbb7('0x6c'),0x1]);})[_0xcbb7('0x2c')](respondWithResult(_0x54a5a0,null))[_0xcbb7('0x4e')](handleError(_0x54a5a0,null));};function hasDefaultDashboard(_0x801243){var _0x3f674c=[0x65];return new BPromise(function(_0x12a27e,_0x512054){try{if(_0x801243[_0xcbb7('0x5e')]){_0x12a27e(_0x3f674c);}else{return db['UserProfileResource'][_0xcbb7('0x6d')]({'where':{'sectionId':_0x801243['id']},'raw':!![]})[_0xcbb7('0x2c')](function(_0x45486b){_0x45486b?_0x12a27e(_0x3f674c):_0x12a27e();});}}catch(_0x51ad72){_0x512054(_0x51ad72);}});}function getCustomDashboards(_0x456752){var _0x56f862=[];return new BPromise(function(_0x159414,_0x153c5d){try{if(_0x456752[_0xcbb7('0x5e')]){return db[_0xcbb7('0x6e')][_0xcbb7('0x5f')]({'raw':!![]})[_0xcbb7('0x2c')](function(_0x1a0fc7){_0x1a0fc7[_0xcbb7('0x6f')](function(_0x117006){_0x56f862[_0xcbb7('0x67')](_0x117006['id']+0x1869f);});_0x159414(_0x56f862);});}else{return db[_0xcbb7('0x62')]['findAll']({'where':{'sectionId':_0x456752['id']},'raw':!![]})[_0xcbb7('0x2c')](function(_0x2ca944){_0x2ca944[_0xcbb7('0x6f')](function(_0x316251){_0x56f862[_0xcbb7('0x67')](_0x316251[_0xcbb7('0x70')]+0x1869f);});_0x159414(_0x56f862);});}}catch(_0x428522){_0x153c5d(_0x428522);}});}function getPlugins(_0x3a56a2){var _0x4bb7a8=[];return new BPromise(function(_0x2ea615,_0x32638){try{if(_0x3a56a2['autoAssociation']){return db[_0xcbb7('0x71')]['findAll']({'raw':!![]})[_0xcbb7('0x2c')](function(_0x21075b){_0x21075b['forEach'](function(_0x404fb8){_0x4bb7a8[_0xcbb7('0x67')](_0x404fb8['id']+0x15b38);});_0x2ea615(_0x4bb7a8);});}else{return db['UserProfileResource'][_0xcbb7('0x5f')]({'where':{'sectionId':_0x3a56a2['id']},'raw':!![]})[_0xcbb7('0x2c')](function(_0x3cecb0){_0x3cecb0['forEach'](function(_0x1743e1){_0x4bb7a8['push'](_0x1743e1['resourceId']+0x15b38);});_0x2ea615(_0x4bb7a8);});}}catch(_0x1e8bd4){_0x32638(_0x1e8bd4);}});}exports[_0xcbb7('0x72')]=function(_0x2a7f47,_0x18034b){return db[_0xcbb7('0x34')][_0xcbb7('0x52')]({'where':{'id':_0x2a7f47[_0xcbb7('0x50')]['id']}})[_0xcbb7('0x2c')](handleEntityNotFound(_0x18034b,null))[_0xcbb7('0x2c')](function(_0x7aa371){if(_0x7aa371){return db[_0xcbb7('0x5b')]['transaction'](function(_0x38d3a6){return db['UserProfileSection'][_0xcbb7('0x5f')]({'where':{'userProfileId':_0x2a7f47[_0xcbb7('0x50')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x400f37){if(_0x400f37){return db[_0xcbb7('0x5d')][_0xcbb7('0x2d')]({'where':{'userProfileId':_0x2a7f47['params']['id'],'id':_[_0xcbb7('0x33')](_0x400f37,function(_0x38d084){return _0x38d084['id'];})},'transaction':_0x38d3a6});}})[_0xcbb7('0x2c')](function(_0x7726a4){var _0x31ce75=_[_0xcbb7('0x33')](_0x2a7f47[_0xcbb7('0x54')],function(_0x3c4395){_0x3c4395[_0xcbb7('0x61')]=_0x2a7f47['params']['id'];return _0x3c4395;});return db[_0xcbb7('0x5d')][_0xcbb7('0x73')](_0x31ce75,{'raw':!![],'transaction':_0x38d3a6});})[_0xcbb7('0x2c')](function(_0x1c0843){var _0x295834=_[_0xcbb7('0x49')](_['map'](_0x1c0843,function(_0x3aaad8){return _0x3aaad8['get']({'plain':!![]});}),{'includeAll':![]});if(_0x295834){return db[_0xcbb7('0x5d')][_0xcbb7('0x5f')]({'where':{'userProfileId':_0x2a7f47[_0xcbb7('0x50')]['id'],'sectionId':_['map'](_0x295834,function(_0x3e29ed){return _0x3e29ed[_0xcbb7('0x60')];})},'attributes':['id',_0xcbb7('0x60')],'raw':!![]})[_0xcbb7('0x2c')](function(_0x636efb){var _0x2343ab=_[_0xcbb7('0x33')](_0x2a7f47['body'],function(_0x7db1e4){_0x7db1e4[_0xcbb7('0x61')]=_0x2a7f47[_0xcbb7('0x50')]['id'];return _0x7db1e4;});return db[_0xcbb7('0x62')][_0xcbb7('0x73')](_0x2343ab,{'raw':!![],'transaction':_0x38d3a6});});}})[_0xcbb7('0x4e')](handleError(_0x18034b,null));});}})['then'](function(_0x3805f2){var _0x8343f5=_['map'](_0x3805f2,function(_0xfd007a){return _0xfd007a[_0xcbb7('0x56')]({'plain':!![]});});})[_0xcbb7('0x2c')](respondWithResult(_0x18034b,null))[_0xcbb7('0x4e')](handleError(_0x18034b,null));};exports[_0xcbb7('0x74')]=function(_0x568507,_0x64d54a,_0x29e46e){return db[_0xcbb7('0x34')][_0xcbb7('0x52')]({'where':{'id':_0x568507[_0xcbb7('0x50')]['id']}})[_0xcbb7('0x2c')](handleEntityNotFound(_0x64d54a,null))[_0xcbb7('0x2c')](function(_0x428452){if(_0x428452){return _0x428452[_0xcbb7('0x74')](_0x568507['query'][_0xcbb7('0x69')]);}})[_0xcbb7('0x2c')](respondWithStatusCode(_0x64d54a,null))[_0xcbb7('0x4e')](handleError(_0x64d54a,null));};exports[_0xcbb7('0x75')]=function(_0x1da04a,_0x3f6614){var _0x4f6f6f={'raw':![],'where':{}};var _0x13cec8={};var _0x2ec614={'count':0x0,'rows':[]};var _0x1a1011=_0x1da04a['query'][_0xcbb7('0x76')];if(typeof _0x1a1011===_0xcbb7('0x77')){throw new db[(_0xcbb7('0x78'))][(_0xcbb7('0x79'))](_0xcbb7('0x7a'));}var _0x192a20=_0x1da04a['query'][_0xcbb7('0x7b')]||![];var _0x1b7867=getQueryModels(_0x1a1011,_0x192a20);if(typeof _0x1b7867[_0xcbb7('0x7c')]===_0xcbb7('0x77')){throw new db[(_0xcbb7('0x78'))][(_0xcbb7('0x79'))]('Invalid\x20section\x20\x27'+_0x1a1011+'\x27');}var _0x42cb29=[];if(!_[_0xcbb7('0x7d')](_0x1b7867[_0xcbb7('0x7e')])){_0x42cb29=_0x1b7867['parentSections'];}else{_0x42cb29=[{'name':_0x1a1011}];}return db[_0xcbb7('0x34')][_0xcbb7('0x6d')]({'where':{'id':_0x1da04a[_0xcbb7('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f6614,null))['then'](function(_0x229ff9){if(_0x229ff9){var _0x3c2580=[];for(var _0xf0ceb0=0x0;_0xf0ceb0<_0x42cb29[_0xcbb7('0x3f')];_0xf0ceb0++){_0x3c2580[_0xcbb7('0x67')](db['UserProfileSection'][_0xcbb7('0x6d')]({'where':{'userProfileId':_0x229ff9['id'],'name':_0x42cb29[_0xf0ceb0][_0xcbb7('0x30')]},'raw':!![]}));}return BPromise[_0xcbb7('0x7f')](_0x3c2580);}})[_0xcbb7('0x2c')](function(_0x45bcca){var _0x1e5442=_[_0xcbb7('0x49')](_0x45bcca,function(_0x15a028){return _0x15a028?_0x15a028:undefined;});var _0x467821=_[_0xcbb7('0x49')](_0x42cb29,['ignore',!![]]);var _0x58620b=_['isEmpty'](_0x1e5442)&&_[_0xcbb7('0x7d')](_0x467821)?null:_[_0xcbb7('0x80')](_0x467821,_0x1e5442);if(_0x58620b){var _0x1f4cf7=[];for(var _0x4e4404=0x0;_0x4e4404<_0x58620b[_0xcbb7('0x3f')];_0x4e4404++){var _0x52e2b2=_[_0xcbb7('0x52')](_0x42cb29,function(_0x519c68){return _0x58620b[_0x4e4404]?_0x519c68[_0xcbb7('0x30')]===_0x58620b[_0x4e4404][_0xcbb7('0x30')]:null;});if(_0x52e2b2){if(_0x58620b[_0x4e4404][_0xcbb7('0x81')]){_0x1f4cf7[_0xcbb7('0x67')](getAllResources(_0x1b7867[_0xcbb7('0x7c')],_0x58620b[_0x4e4404]));}else{if(!_0x58620b[_0x4e4404][_0xcbb7('0x5e')]){_0x1f4cf7[_0xcbb7('0x67')](getAllowedResources(_0x52e2b2,_0x58620b[_0x4e4404],_0x1b7867[_0xcbb7('0x7c')]));}else{if(_0x52e2b2[_0xcbb7('0x39')]){_0x1f4cf7[_0xcbb7('0x67')](getAllFilteredResources(_0x52e2b2,_0x58620b[_0x4e4404]));}}}}}return BPromise[_0xcbb7('0x7f')](_0x1f4cf7);}else{return null;}})['then'](function(_0x415dfb){var _0x4687ad=_0x415dfb;var _0x4a1d83=null;if(_0x4687ad){_0x4a1d83=_0x4687ad[_0xcbb7('0x3f')]===0x1?_0x4687ad[0x0]:null;}if(_0x4a1d83||_0x4687ad){var _0x40058b=db[_0x1b7867[_0xcbb7('0x7c')]][_0xcbb7('0x35')];_0x13cec8[_0xcbb7('0x39')]=_['keys'](_0x40058b);_0x13cec8[_0xcbb7('0x3e')]=_[_0xcbb7('0x3a')](_0x1da04a['query']);_0x13cec8[_0xcbb7('0x44')]=_[_0xcbb7('0x3b')](_0x13cec8[_0xcbb7('0x39')],_0x13cec8[_0xcbb7('0x3e')]);_0x4f6f6f[_0xcbb7('0x3c')]=_[_0xcbb7('0x3b')](_0x13cec8['model'],qs['fields'](_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x3d')]));_0x4f6f6f[_0xcbb7('0x3c')]=_0x4f6f6f[_0xcbb7('0x3c')][_0xcbb7('0x3f')]?_0x4f6f6f[_0xcbb7('0x3c')]:_0x13cec8[_0xcbb7('0x39')];if(!_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x40')](_0xcbb7('0x41'))){_0x4f6f6f[_0xcbb7('0x27')]=qs[_0xcbb7('0x27')](_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x27')]);_0x4f6f6f[_0xcbb7('0x26')]=qs[_0xcbb7('0x26')](_0x1da04a[_0xcbb7('0x3e')]['offset']);}_0x4f6f6f[_0xcbb7('0x42')]=qs['sort'](_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x43')]);_0x4f6f6f[_0xcbb7('0x46')]=qs['filters'](_['pick'](_0x1da04a[_0xcbb7('0x3e')],_0x13cec8[_0xcbb7('0x44')]));if(_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x49')]){_0x4f6f6f[_0xcbb7('0x46')]=_[_0xcbb7('0x47')](_0x4f6f6f[_0xcbb7('0x46')],{'$or':_['map'](_0x40058b,function(_0x3ff645){if(_0x3ff645[_0xcbb7('0x37')][_0xcbb7('0x38')]!=='VIRTUAL'){var _0x4726dd={};_0x4726dd[_0x3ff645[_0xcbb7('0x82')]]={'$like':'%'+_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x49')]+'%'};return _0x4726dd;}})});}var _0x2330fa=[];if(_0x4a1d83){var _0x3e7b7d=_[_0xcbb7('0x52')](_0x42cb29,['name',_0x4a1d83[_0xcbb7('0x30')]]);if(_0x3e7b7d[_0xcbb7('0x82')]){var _0x52adf8={};if(_0x1b7867['childModel']===_0xcbb7('0x83')){_0x52adf8[_0x3e7b7d[_0xcbb7('0x84')]]=_[_0xcbb7('0x33')](_0x4a1d83[_0xcbb7('0x85')],'id');}else{_0x52adf8[_0x3e7b7d['foreignKey']]=_0x4a1d83[_0xcbb7('0x85')];}_0x2330fa[_0xcbb7('0x67')](_0x52adf8);}else{_0x4f6f6f['where']['id']=_0x4a1d83[_0xcbb7('0x85')];}}else{for(var _0x217fc5=0x0;_0x217fc5<_0x4687ad[_0xcbb7('0x3f')];_0x217fc5++){var _0x3e7b7d=_[_0xcbb7('0x52')](_0x42cb29,[_0xcbb7('0x30'),_0x4687ad[_0x217fc5][_0xcbb7('0x30')]]);if(_0x3e7b7d[_0xcbb7('0x82')]){var _0x52adf8={};_0x52adf8[_0x3e7b7d[_0xcbb7('0x84')]]=_0x4687ad[_0x217fc5][_0xcbb7('0x85')];_0x2330fa[_0xcbb7('0x67')](_0x52adf8);}else{if(!_0x4f6f6f['where']['id'])_0x4f6f6f[_0xcbb7('0x46')]['id']=[];_0x4687ad[_0x217fc5][_0xcbb7('0x85')][_0xcbb7('0x6f')](function(_0x3bd36c){_0x4f6f6f[_0xcbb7('0x46')]['id'][_0xcbb7('0x67')](_0x3bd36c);});}}}if(!_[_0xcbb7('0x7d')](_0x2330fa)){_0x4f6f6f[_0xcbb7('0x46')]=_['merge'](_0x4f6f6f[_0xcbb7('0x46')],{'$and':{'$or':_0x2330fa}});}_0x4f6f6f=_[_0xcbb7('0x47')]({},_0x4f6f6f,_0x1da04a[_0xcbb7('0x4a')]);if(_0x4a1d83&&!_0x4a1d83[_0xcbb7('0x5e')]&&_0x1b7867['childModel']===_0xcbb7('0x83')){if(_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x4c')]){_0x4f6f6f[_0xcbb7('0x51')]=[{'all':!![]}];}return db[_0x1b7867[_0xcbb7('0x7c')]]['findAll'](_0x4f6f6f)['then'](function(_0x3325ef){var _0x24f2a4=[];_0x3325ef[_0xcbb7('0x6f')](function(_0x59393e){var _0x325ba2;switch(_0x59393e[_0xcbb7('0x86')]){case _0xcbb7('0x87'):_0x325ba2=_[_0xcbb7('0x52')](_0x4a1d83['associatedResources'],function(_0x40a29d){return _0x40a29d['id']===_0x59393e[_0xcbb7('0x88')]&&_0x40a29d[_0xcbb7('0x37')]===_0xcbb7('0x89');});break;case'custom':_0x325ba2=_[_0xcbb7('0x52')](_0x4a1d83[_0xcbb7('0x85')],function(_0x404368){return _0x404368['id']===_0x59393e[_0xcbb7('0x88')]&&_0x404368[_0xcbb7('0x37')]===_0xcbb7('0x8a');});break;}if(_0x325ba2)_0x24f2a4['push'](_0x59393e);});_0x2ec614[_0xcbb7('0x4b')]=_0x24f2a4[_0xcbb7('0x3f')];_0x2ec614[_0xcbb7('0x4d')]=_0x24f2a4;return _0x2ec614;});}else{return db[_0x1b7867[_0xcbb7('0x7c')]]['count']({'where':_0x4f6f6f[_0xcbb7('0x46')]})[_0xcbb7('0x2c')](function(_0x597024){_0x2ec614[_0xcbb7('0x4b')]=_0x597024;if(_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x4c')]){if(_0x1b7867['childModel']===_0xcbb7('0x8b')){_0x4f6f6f[_0xcbb7('0x51')]=[{'model':db[_0xcbb7('0x8c')],'as':_0xcbb7('0x8d'),'attributes':['id',_0xcbb7('0x30'),_0xcbb7('0x8e')],'required':_0x1da04a['query'][_0xcbb7('0x8f')]?!![]:![]},{'model':db['Tag'],'as':_0xcbb7('0x90'),'attributes':['id','name','color'],'through':_0x1da04a[_0xcbb7('0x3e')][_0xcbb7('0x8f')]?{'attributes':[],'where':{'TagId':_0x1da04a[_0xcbb7('0x3e')]['tag']||undefined}}:{},'required':_0x1da04a['query'][_0xcbb7('0x8f')]?!![]:![]}];}else{_0x4f6f6f['include']=[{'all':!![]}];}}return db[_0x1b7867[_0xcbb7('0x7c')]][_0xcbb7('0x5f')](_0x4f6f6f);})[_0xcbb7('0x2c')](function(_0x1469af){_0x2ec614[_0xcbb7('0x4d')]=_0x1469af;return _0x2ec614;});}}else{return _0x2ec614;}})[_0xcbb7('0x2c')](respondWithFilteredResult(_0x3f6614,_0x4f6f6f))[_0xcbb7('0x4e')](handleError(_0x3f6614,null));};function getAllResources(_0x56c631,_0x5e7813){return new BPromise(function(_0x736cda,_0x8abcab){if(_0x5e7813){var _0x47f4ae=_0x5e7813['filter']?{[_0x5e7813[_0xcbb7('0x49')]['field']]:_0x5e7813[_0xcbb7('0x49')]['value']}:undefined;return db[_0x56c631]['findAll']({'where':_0x47f4ae,'raw':!![]})[_0xcbb7('0x2c')](function(_0x6411cf){_0x5e7813[_0xcbb7('0x85')]=_[_0xcbb7('0x33')](_0x6411cf,'id');_0x736cda(_0x5e7813);})['catch'](function(_0x563a57){_0x8abcab(_0x563a57);});}else{_0x736cda(null);}});}function getAllFilteredResources(_0x49abc6,_0x189ece){return new BPromise(function(_0x18e854,_0x50c312){var _0x4c27e4=_0x49abc6[_0xcbb7('0x49')]?{[_0x49abc6[_0xcbb7('0x49')][_0xcbb7('0x82')]]:_0x49abc6[_0xcbb7('0x49')][_0xcbb7('0x91')]}:undefined;return db[_0x49abc6[_0xcbb7('0x39')]][_0xcbb7('0x5f')]({'where':_0x4c27e4,'raw':!![]})['then'](function(_0x81451e){_0x189ece[_0xcbb7('0x85')]=_[_0xcbb7('0x33')](_0x81451e,function(_0x2e4f07){return _0x2e4f07[_0xcbb7('0x30')];});_0x18e854(_0x189ece);})['catch'](function(_0x556eba){_0x50c312(_0x556eba);});});}function getAllowedResources(_0x160cc5,_0x20ee0d,_0x550e1d){return new BPromise(function(_0x280882,_0x2c7da8){if(_0x20ee0d){return db[_0xcbb7('0x62')]['findAll']({'where':{'sectionId':_0x20ee0d['id']},'raw':!![]})['then'](function(_0x8f9cb0){if(_0x160cc5['field']&&_0x160cc5['field']!=='id'){_0x20ee0d['associatedResources']=_[_0xcbb7('0x33')](_0x8f9cb0,function(_0x418a25){return _0x418a25[_0x160cc5[_0xcbb7('0x82')]];});}else{if(_0x550e1d===_0xcbb7('0x83')){_0x20ee0d[_0xcbb7('0x85')]=_[_0xcbb7('0x33')](_0x8f9cb0,function(_0x3b743f){return{'id':_0x3b743f[_0xcbb7('0x70')],'type':_0x3b743f[_0xcbb7('0x37')]};});}else{_0x20ee0d[_0xcbb7('0x85')]=_['map'](_0x8f9cb0,function(_0x1c01bb){return _0x1c01bb[_0xcbb7('0x70')];});}}_0x280882(_0x20ee0d);})[_0xcbb7('0x4e')](function(_0x5b07a4){_0x2c7da8(_0x5b07a4);});}else{_0x280882(null);}});}function getQueryModels(_0x599490,_0x5d8e0d){var _0x35cec4=_0x599490[_0xcbb7('0x92')]();var _0x151fae={'childModel':undefined,'parentSections':[]};switch(_0x35cec4){case'squareprojects':_0x151fae[_0xcbb7('0x7c')]='SquareProject';break;case _0xcbb7('0x93'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0x94');break;case _0xcbb7('0x95'):_0x151fae[_0xcbb7('0x7c')]='SquareRecording';_0x151fae[_0xcbb7('0x7e')]=[{'name':_0xcbb7('0x96'),'field':_0xcbb7('0x30'),'foreignKey':_0xcbb7('0x97')}];break;case'projects':_0x151fae[_0xcbb7('0x7c')]='JscriptyProject';break;case _0xcbb7('0x98'):_0x151fae['childModel']=_0xcbb7('0x8b');_0x151fae[_0xcbb7('0x7e')]=[{'name':_0xcbb7('0x99'),'field':'id','foreignKey':_0xcbb7('0x9a')}];break;case _0xcbb7('0x9b'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0x9c');break;case _0xcbb7('0x9d'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0x9e');break;case _0xcbb7('0x9f'):_0x151fae['childModel']=_0xcbb7('0xa0');break;case'chatqueues':_0x151fae[_0xcbb7('0x7c')]='ChatQueue';break;case _0xcbb7('0xa1'):_0x151fae['childModel']=_0xcbb7('0xa2');break;case _0xcbb7('0xa3'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xa4');break;case _0xcbb7('0xa5'):_0x151fae['childModel']='FaxAccount';break;case _0xcbb7('0xa6'):case _0xcbb7('0xa7'):case'outboundroutes':_0x151fae[_0xcbb7('0x7c')]='VoiceExtension';break;case _0xcbb7('0xa8'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xa9');break;case _0xcbb7('0xaa'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xab');break;case'voicerecordings':_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xac');_0x151fae[_0xcbb7('0x7e')]=[{'name':_0xcbb7('0xad'),'field':'name','foreignKey':'membername','model':_0xcbb7('0xae'),'filter':{'field':_0xcbb7('0xaf'),'value':[_0xcbb7('0xb0')]}},{'name':_0xcbb7('0xb1'),'field':'name','foreignKey':_0xcbb7('0xb2'),'model':_0xcbb7('0xae'),'filter':{'field':'role','value':[_0xcbb7('0xb3')]}},{'name':_0xcbb7('0xb4'),'field':'name','foreignKey':_0xcbb7('0xb5'),'model':_0xcbb7('0xb6'),'filter':{'field':'type','value':['inbound']}},{'name':_0xcbb7('0xb7'),'field':'name','foreignKey':_0xcbb7('0xb5'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xcbb7('0xb8')]}}];break;case _0xcbb7('0xb9'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xba');break;case _0xcbb7('0xbb'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xbc');break;case'voiceprefixes':_0x151fae[_0xcbb7('0x7c')]='VoicePrefix';break;case _0xcbb7('0xbd'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xbe');break;case _0xcbb7('0xbf'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xc0');break;case _0xcbb7('0xc1'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xc2');break;case _0xcbb7('0xc3'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xc4');break;case _0xcbb7('0xc5'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xc6');break;case _0xcbb7('0xc7'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xc8');break;case _0xcbb7('0xc9'):_0x151fae['childModel']=_0xcbb7('0xca');break;case _0xcbb7('0xcb'):_0x151fae[_0xcbb7('0x7c')]='SmsAccount';break;case _0xcbb7('0xcc'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xcd');break;case _0xcbb7('0xce'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xcf');break;case _0xcbb7('0xd0'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xd1');break;case _0xcbb7('0xd2'):case _0xcbb7('0xd3'):_0x151fae[_0xcbb7('0x7c')]='VoiceQueue';if(_0x5d8e0d){_0x151fae[_0xcbb7('0x7e')]=[{'name':'VoiceQueues'},{'name':_0xcbb7('0xb7')}];}break;case'users':case _0xcbb7('0xd4'):case _0xcbb7('0xd5'):_0x151fae[_0xcbb7('0x7c')]='User';if(_0x5d8e0d){_0x151fae['parentSections']=[{'name':_0xcbb7('0xd6'),'filter':{'field':'role','value':[_0xcbb7('0xd7'),_0xcbb7('0xd8')]},'ignore':!![]},{'name':_0xcbb7('0xad')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x151fae['childModel']=_0xcbb7('0xd9');break;case _0xcbb7('0xda'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xdb');break;case _0xcbb7('0xdc'):_0x151fae[_0xcbb7('0x7c')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xdd');break;case _0xcbb7('0xde'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xdf');break;case _0xcbb7('0xe0'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xe1');break;case _0xcbb7('0xe2'):_0x151fae[_0xcbb7('0x7c')]='User';break;case _0xcbb7('0xe3'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xe4');break;case _0xcbb7('0xe5'):_0x151fae['childModel']='Disposition';break;case _0xcbb7('0xe6'):_0x151fae['childModel']=_0xcbb7('0x6e');break;case _0xcbb7('0xe7'):_0x151fae['childModel']=_0xcbb7('0xe8');break;case _0xcbb7('0xe9'):_0x151fae['childModel']=_0xcbb7('0xea');break;case _0xcbb7('0xeb'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xec');break;case _0xcbb7('0xed'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xee');break;case _0xcbb7('0xef'):_0x151fae[_0xcbb7('0x7c')]='Tag';break;case _0xcbb7('0xf0'):_0x151fae['childModel']=_0xcbb7('0xf1');break;case _0xcbb7('0xf2'):_0x151fae['childModel']=_0xcbb7('0xf3');break;case _0xcbb7('0xf4'):_0x151fae['childModel']=_0xcbb7('0xf5');break;case _0xcbb7('0xf6'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xf7');break;case _0xcbb7('0xf8'):_0x151fae[_0xcbb7('0x7c')]='Plugin';break;case _0xcbb7('0xf9'):_0x151fae[_0xcbb7('0x7c')]='AnalyticExtractedReport';_0x151fae[_0xcbb7('0x7e')]=[{'name':_0xcbb7('0xfa'),'field':'id','foreignKey':'reportId'}];break;case _0xcbb7('0xfb'):_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xfc');break;case'whatsappaccounts':_0x151fae[_0xcbb7('0x7c')]=_0xcbb7('0xcf');break;default:return _0x151fae;}return _0x151fae;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e78a209..088bc2b 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 _0xd153=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5bde38,_0x27e5ff){var _0x3d4243=function(_0x7f648b){while(--_0x7f648b){_0x5bde38['push'](_0x5bde38['shift']());}};_0x3d4243(++_0x27e5ff);}(_0xd153,0x1d6));var _0x3d15=function(_0xbc0577,_0x2f2200){_0xbc0577=_0xbc0577-0x0;var _0x450f4b=_0xd153[_0xbc0577];return _0x450f4b;};'use strict';var EventEmitter=require(_0x3d15('0x0'));var UserProfile=require(_0x3d15('0x1'))['db'][_0x3d15('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3d15('0x3')](0x0);var events={'afterCreate':_0x3d15('0x4'),'afterUpdate':_0x3d15('0x5'),'afterDestroy':_0x3d15('0x6')};function emitEvent(_0x468481){return function(_0x4a092e,_0x41b3b5,_0x266303){UserProfileEvents[_0x3d15('0x7')](_0x468481+':'+_0x4a092e['id'],_0x4a092e);UserProfileEvents[_0x3d15('0x7')](_0x468481,_0x4a092e);_0x266303(null);};}for(var e in events){if(events[_0x3d15('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3d15('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x8417=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners'];(function(_0x19ca83,_0x4db78e){var _0x2952e4=function(_0x18cdd1){while(--_0x18cdd1){_0x19ca83['push'](_0x19ca83['shift']());}};_0x2952e4(++_0x4db78e);}(_0x8417,0x9d));var _0x7841=function(_0x2c1f3b,_0x1295c6){_0x2c1f3b=_0x2c1f3b-0x0;var _0x447355=_0x8417[_0x2c1f3b];return _0x447355;};'use strict';var EventEmitter=require(_0x7841('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x7841('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7841('0x2')](0x0);var events={'afterCreate':_0x7841('0x3'),'afterUpdate':_0x7841('0x4'),'afterDestroy':_0x7841('0x5')};function emitEvent(_0x1582af){return function(_0x53074f,_0x48a0b1,_0x2a8a57){UserProfileEvents[_0x7841('0x6')](_0x1582af+':'+_0x53074f['id'],_0x53074f);UserProfileEvents[_0x7841('0x6')](_0x1582af,_0x53074f);_0x2a8a57(null);};}for(var e in events){if(events[_0x7841('0x7')](e)){var event=events[e];UserProfile[_0x7841('0x8')](e,emitEvent(event));}}module[_0x7841('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 160bf3d..8205746 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 _0xefe3=['User','update','privacyEnabled','then','catch','lodash','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserProfile','user_profiles'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3efe('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3efe('0x1'));var BPromise=require(_0x3efe('0x2'));var rp=require(_0x3efe('0x3'));var fs=require('fs');var path=require(_0x3efe('0x4'));var rimraf=require('rimraf');var config=require(_0x3efe('0x5'));var attributes=require('./userProfile.attributes');module[_0x3efe('0x6')]=function(_0x4b5006,_0x3a1c0a){return _0x4b5006[_0x3efe('0x7')](_0x3efe('0x8'),attributes,{'tableName':_0x3efe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x30d2e8,_0x474c9a,_0x4b9766){var _0x3fecac=_0x4b5006['models'];_0x3fecac[_0x3efe('0xa')][_0x3efe('0xb')]({'privacyEnabled':_0x30d2e8[_0x3efe('0xc')]},{'where':{'UserProfileId':_0x30d2e8['id']}})[_0x3efe('0xd')](function(){_0x4b9766();})[_0x3efe('0xe')](function(_0x471ea1){_0x4b9766(_0x471ea1);});}}});}; \ No newline at end of file +var _0xe706=['privacyEnabled','then','catch','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','models','User','update'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xe706,0xa3));var _0x6e70=function(_0xbed8a2,_0x578ae3){_0xbed8a2=_0xbed8a2-0x0;var _0x11d4f2=_0xe706[_0xbed8a2];return _0x11d4f2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x188ed3,_0x3c4843,_0x449b48){var _0x954545=_0x1b0389[_0x6e70('0xe')];_0x954545[_0x6e70('0xf')][_0x6e70('0x10')]({'privacyEnabled':_0x188ed3[_0x6e70('0x11')]},{'where':{'UserProfileId':_0x188ed3['id']}})[_0x6e70('0x12')](function(){_0x449b48();})[_0x6e70('0x13')](function(_0x4600f9){_0x449b48(_0x4600f9);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f718f14..41de483 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 _0xdc97=['redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfile,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x516b62,_0x224b1e){var _0x1bb03f=function(_0x4ee1af){while(--_0x4ee1af){_0x516b62['push'](_0x516b62['shift']());}};_0x1bb03f(++_0x224b1e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x596b6a,_0x59500b){_0x596b6a=_0x596b6a-0x0;var _0x1755a5=_0xdc97[_0x596b6a];return _0x1755a5;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});config[_0x7dc9('0xa')]=_['defaults'](config['redis'],{'host':_0x7dc9('0xb'),'port':0x18eb});var socket=require(_0x7dc9('0xc'))(new Redis(config[_0x7dc9('0xa')]));require(_0x7dc9('0xd'))[_0x7dc9('0xe')](socket);function respondWithRpcPromise(_0x5ca05b,_0xb2fa2a,_0x44fe24){return new BPromise(function(_0x37dfc,_0x1dc3f7){return client[_0x7dc9('0xf')](_0x5ca05b,_0x44fe24)[_0x7dc9('0x10')](function(_0x1e336a){logger['info']('UserProfile,\x20%s,\x20%s',_0xb2fa2a,'request\x20sent');logger['debug'](_0x7dc9('0x11'),_0xb2fa2a,_0x7dc9('0x12'),JSON['stringify'](_0x1e336a));if(_0x1e336a[_0x7dc9('0x13')]){if(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x14')]===0x1f4){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')]['message']);return _0x1dc3f7(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);return _0x37dfc(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}else{logger[_0x7dc9('0x17')]('UserProfile,\x20%s,\x20%s',_0xb2fa2a,_0x7dc9('0x12'));_0x37dfc(_0x1e336a['result'][_0x7dc9('0x16')]);}})[_0x7dc9('0x18')](function(_0x5d61d7){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x5d61d7);_0x1dc3f7(_0x5d61d7);});});} \ No newline at end of file +var _0xf2ca=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0xf2ca[_0x14c00f];return _0x19fbda;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});config[_0xaf2c('0xc')]=_['defaults'](config[_0xaf2c('0xc')],{'host':_0xaf2c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf2c('0xc')]));require('./userProfile.socket')[_0xaf2c('0xe')](socket);function respondWithRpcPromise(_0x4a0064,_0x2f5099,_0x144a7a){return new BPromise(function(_0x2e04e5,_0xd891e9){return client['request'](_0x4a0064,_0x144a7a)['then'](function(_0x2c0d88){logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x2f5099,_0xaf2c('0x11'));logger[_0xaf2c('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2f5099,'request\x20sent',JSON[_0xaf2c('0x13')](_0x2c0d88));if(_0x2c0d88[_0xaf2c('0x14')]){if(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x15')]===0x1f4){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0xd891e9(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);}logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0x2e04e5(_0x2c0d88[_0xaf2c('0x14')]['message']);}else{logger[_0xaf2c('0xf')]('UserProfile,\x20%s,\x20%s',_0x2f5099,_0xaf2c('0x11'));_0x2e04e5(_0x2c0d88[_0xaf2c('0x17')][_0xaf2c('0x16')]);}})['catch'](function(_0x28ae7b){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x28ae7b);_0xd891e9(_0x28ae7b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fbfa2c5..8c67986 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 _0x6afe=['length','userProfile:','remove','update','emit','removeListener','register'];(function(_0x1a0bb9,_0x4121b1){var _0x52ff56=function(_0x846db9){while(--_0x846db9){_0x1a0bb9['push'](_0x1a0bb9['shift']());}};_0x52ff56(++_0x4121b1);}(_0x6afe,0x1d7));var _0xe6af=function(_0x372ee1,_0x45c637){_0x372ee1=_0x372ee1-0x0;var _0x31ea06=_0x6afe[_0x372ee1];return _0x31ea06;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xe6af('0x0'),_0xe6af('0x1')];function createListener(_0x175ccd,_0x1735f1){return function(_0x5cef24){_0x1735f1[_0xe6af('0x2')](_0x175ccd,_0x5cef24);};}function removeListener(_0x508db9,_0x529bf1){return function(){UserProfileEvents[_0xe6af('0x3')](_0x508db9,_0x529bf1);};}exports[_0xe6af('0x4')]=function(_0x1ab56d){for(var _0x26d16d=0x0,_0x125a52=events[_0xe6af('0x5')];_0x26d16d<_0x125a52;_0x26d16d++){var _0x21a279=events[_0x26d16d];var _0x1a724a=createListener(_0xe6af('0x6')+_0x21a279,_0x1ab56d);UserProfileEvents['on'](_0x21a279,_0x1a724a);}}; \ No newline at end of file +var _0x3d7c=['length','./userProfile.events','save','update','emit','removeListener','register'];(function(_0x343063,_0x2edc69){var _0x53ee4f=function(_0xd3c220){while(--_0xd3c220){_0x343063['push'](_0x343063['shift']());}};_0x53ee4f(++_0x2edc69);}(_0x3d7c,0xa2));var _0xc3d7=function(_0x4592bf,_0x4e7c98){_0x4592bf=_0x4592bf-0x0;var _0x1ba53b=_0x3d7c[_0x4592bf];return _0x1ba53b;};'use strict';var UserProfileEvents=require(_0xc3d7('0x0'));var events=[_0xc3d7('0x1'),'remove',_0xc3d7('0x2')];function createListener(_0x9681fe,_0x11f98f){return function(_0xb78d){_0x11f98f[_0xc3d7('0x3')](_0x9681fe,_0xb78d);};}function removeListener(_0x2ff1b6,_0x3806cc){return function(){UserProfileEvents[_0xc3d7('0x4')](_0x2ff1b6,_0x3806cc);};}exports[_0xc3d7('0x5')]=function(_0x14ba08){for(var _0x5d3aff=0x0,_0x3bb2ad=events[_0xc3d7('0x6')];_0x5d3aff<_0x3bb2ad;_0x5d3aff++){var _0x4a835e=events[_0x5d3aff];var _0x4a6d25=createListener('userProfile:'+_0x4a835e,_0x14ba08);UserProfileEvents['on'](_0x4a835e,_0x4a6d25);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6524abc..2b4736a 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 _0x0918=['../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0918,0x1b4));var _0x8091=function(_0x5c5eb8,_0x53e878){_0x5c5eb8=_0x5c5eb8-0x0;var _0x3bf307=_0x0918[_0x5c5eb8];return _0x3bf307;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8091('0x0'));var timeout=require(_0x8091('0x1'));var express=require(_0x8091('0x2'));var router=express[_0x8091('0x3')]();var auth=require(_0x8091('0x4'));var interaction=require(_0x8091('0x5'));var config=require(_0x8091('0x6'));var controller=require('./userProfileResource.controller');router[_0x8091('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8091('0x7')](_0x8091('0x8'),auth[_0x8091('0x9')](),controller[_0x8091('0xa')]);router[_0x8091('0x7')](_0x8091('0xb'),auth[_0x8091('0x9')](),controller['show']);router[_0x8091('0xc')]('/',auth[_0x8091('0x9')](),controller[_0x8091('0xd')]);router['put']('/:id',auth[_0x8091('0x9')](),controller['update']);router[_0x8091('0xe')](_0x8091('0xb'),auth[_0x8091('0x9')](),controller[_0x8091('0xf')]);module[_0x8091('0x10')]=router; \ No newline at end of file +var _0x70a8=['put','/:id','delete','exports','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','post','create'];(function(_0x8bfdd2,_0x4912b0){var _0x1a5a23=function(_0x1693e2){while(--_0x1693e2){_0x8bfdd2['push'](_0x8bfdd2['shift']());}};_0x1a5a23(++_0x4912b0);}(_0x70a8,0x1f4));var _0x870a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x70a8[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x870a('0x0'));var timeout=require(_0x870a('0x1'));var express=require('express');var router=express[_0x870a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x870a('0x3'));var config=require('../../config/environment');var controller=require(_0x870a('0x4'));router[_0x870a('0x5')]('/',auth[_0x870a('0x6')](),controller[_0x870a('0x7')]);router[_0x870a('0x5')](_0x870a('0x8'),auth['isAuthenticated'](),controller[_0x870a('0x9')]);router[_0x870a('0x5')]('/:id',auth[_0x870a('0x6')](),controller['show']);router[_0x870a('0xa')]('/',auth['isAuthenticated'](),controller[_0x870a('0xb')]);router[_0x870a('0xc')](_0x870a('0xd'),auth[_0x870a('0x6')](),controller['update']);router[_0x870a('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x870a('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4127901..2fcf955 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 _0x4d58=['exports','STRING','INTEGER','sequelize'];(function(_0x550138,_0x107a81){var _0x24e900=function(_0x5d764c){while(--_0x5d764c){_0x550138['push'](_0x550138['shift']());}};_0x24e900(++_0x107a81);}(_0x4d58,0xc7));var _0x84d5=function(_0x23e306,_0x33dfd0){_0x23e306=_0x23e306-0x0;var _0x361735=_0x4d58[_0x23e306];return _0x361735;};'use strict';var Sequelize=require(_0x84d5('0x0'));module[_0x84d5('0x1')]={'name':{'type':Sequelize[_0x84d5('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x84d5('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x94c4=['sequelize','exports','STRING','INTEGER'];(function(_0x2a1be5,_0x1727d2){var _0x15db9c=function(_0x3768f4){while(--_0x3768f4){_0x2a1be5['push'](_0x2a1be5['shift']());}};_0x15db9c(++_0x1727d2);}(_0x94c4,0x1c4));var _0x494c=function(_0x4ad255,_0x30fb06){_0x4ad255=_0x4ad255-0x0;var _0x3986e4=_0x94c4[_0x4ad255];return _0x3986e4;};'use strict';var Sequelize=require(_0x494c('0x0'));module[_0x494c('0x1')]={'name':{'type':Sequelize[_0x494c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x494c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x494c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 26f8695..df25c80 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 _0x5fc3=['filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x1f109c,_0xd9952e){var _0x3984e8=function(_0x40b60b){while(--_0x40b60b){_0x1f109c['push'](_0x1f109c['shift']());}};_0x3984e8(++_0xd9952e);}(_0x5fc3,0xa8));var _0x35fc=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x5fc3[_0xb1174e];return _0x285bac;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x18')](_0x409357);}return _0x4cbe74[_0x35fc('0x19')](_0x409357)[_0x35fc('0x1a')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=_0x229d56['count'],_0x154958=_0x398b67[_0x35fc('0x1b')],_0x227a49=_0x398b67[_0x35fc('0x1b')]+_0x398b67['limit'],_0x1121fa;if(_0x227a49>=_0x53b898){_0x227a49=_0x53b898;_0x1121fa=0xc8;}else{_0x1121fa=0xce;}_0x558364[_0x35fc('0x19')](_0x1121fa);return _0x558364[_0x35fc('0x1c')](_0x35fc('0x1d'),_0x154958+'-'+_0x227a49+'/'+_0x53b898)['json'](_0x229d56);}return null;};}function patchUpdates(_0x1a86e9){return function(_0x3c58ea){try{jsonpatch[_0x35fc('0x1e')](_0x3c58ea,_0x1a86e9,!![]);}catch(_0x488234){return BPromise[_0x35fc('0x1f')](_0x488234);}return _0x3c58ea[_0x35fc('0x20')]();};}function saveUpdates(_0x3229d1,_0x251a1f){return function(_0x20ffde){if(_0x20ffde){return _0x20ffde[_0x35fc('0x21')](_0x3229d1)[_0x35fc('0x22')](function(_0x3b05b0){return _0x3b05b0;});}return null;};}function removeEntity(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')]()[_0x35fc('0x22')](function(){_0x2405e8[_0x35fc('0x19')](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x3b4743,_0x55e9e7){return function(_0x33f5e8){if(!_0x33f5e8){_0x3b4743[_0x35fc('0x18')](0x194);}return _0x33f5e8;};}function handleError(_0x561bf8,_0x265324){_0x265324=_0x265324||0x1f4;return function(_0x5a93df){logger[_0x35fc('0x24')](_0x5a93df['stack']);if(_0x5a93df[_0x35fc('0x25')]){delete _0x5a93df['name'];}_0x561bf8[_0x35fc('0x19')](_0x265324)[_0x35fc('0x26')](_0x5a93df);};}exports['index']=function(_0x519264,_0x47774c){var _0x58edb6={},_0x274208={},_0x1a5d92={'count':0x0,'rows':[]};var _0x57001c=_[_0x35fc('0x27')](db[_0x35fc('0x28')][_0x35fc('0x29')],function(_0x9f3c8a){return{'name':_0x9f3c8a[_0x35fc('0x2a')],'type':_0x9f3c8a[_0x35fc('0x2b')][_0x35fc('0x2c')]};});_0x274208[_0x35fc('0x2d')]=_['map'](_0x57001c,_0x35fc('0x25'));_0x274208[_0x35fc('0x2e')]=_[_0x35fc('0x2f')](_0x519264['query']);_0x274208[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x274208[_0x35fc('0x2d')],_0x274208[_0x35fc('0x2e')]);_0x58edb6[_0x35fc('0x32')]=_[_0x35fc('0x31')](_0x274208[_0x35fc('0x2d')],qs[_0x35fc('0x33')](_0x519264[_0x35fc('0x2e')][_0x35fc('0x33')]));_0x58edb6['attributes']=_0x58edb6['attributes'][_0x35fc('0x34')]?_0x58edb6['attributes']:_0x274208[_0x35fc('0x2d')];if(!_0x519264[_0x35fc('0x2e')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x58edb6[_0x35fc('0x37')]=qs[_0x35fc('0x37')](_0x519264['query'][_0x35fc('0x37')]);_0x58edb6[_0x35fc('0x1b')]=qs[_0x35fc('0x1b')](_0x519264[_0x35fc('0x2e')][_0x35fc('0x1b')]);}_0x58edb6[_0x35fc('0x38')]=qs['sort'](_0x519264[_0x35fc('0x2e')][_0x35fc('0x39')]);_0x58edb6[_0x35fc('0x3a')]=qs['filters'](_[_0x35fc('0x3b')](_0x519264['query'],_0x274208[_0x35fc('0x30')]),_0x57001c);if(_0x519264[_0x35fc('0x2e')][_0x35fc('0x3c')]){_0x58edb6[_0x35fc('0x3a')]=_['merge'](_0x58edb6['where'],{'$or':_['map'](_0x57001c,function(_0x20f5fe){if(_0x20f5fe['type']!==_0x35fc('0x3d')){var _0x4b4d4a={};_0x4b4d4a[_0x20f5fe[_0x35fc('0x25')]]={'$like':'%'+_0x519264[_0x35fc('0x2e')][_0x35fc('0x3c')]+'%'};return _0x4b4d4a;}})});}_0x58edb6=_[_0x35fc('0x3e')]({},_0x58edb6,_0x519264[_0x35fc('0x3f')]);var _0x3313fa={'where':_0x58edb6[_0x35fc('0x3a')]};return db['UserProfileResource'][_0x35fc('0x40')](_0x3313fa)[_0x35fc('0x22')](function(_0x4e0ce3){_0x1a5d92[_0x35fc('0x40')]=_0x4e0ce3;if(_0x519264[_0x35fc('0x2e')][_0x35fc('0x41')]){_0x58edb6[_0x35fc('0x42')]=[{'all':!![]}];}return db[_0x35fc('0x28')][_0x35fc('0x43')](_0x58edb6);})['then'](function(_0x3f6480){_0x1a5d92[_0x35fc('0x44')]=_0x3f6480;return _0x1a5d92;})[_0x35fc('0x22')](respondWithFilteredResult(_0x47774c,_0x58edb6))['catch'](handleError(_0x47774c,null));};exports[_0x35fc('0x45')]=function(_0x350a96,_0x596919){var _0x237548={'raw':![],'where':{'id':_0x350a96[_0x35fc('0x46')]['id']}},_0x280af1={};_0x280af1[_0x35fc('0x2d')]=_[_0x35fc('0x2f')](db[_0x35fc('0x28')][_0x35fc('0x29')]);_0x280af1[_0x35fc('0x2e')]=_['keys'](_0x350a96['query']);_0x280af1[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x280af1['model'],_0x280af1['query']);_0x237548['attributes']=_[_0x35fc('0x31')](_0x280af1[_0x35fc('0x2d')],qs['fields'](_0x350a96[_0x35fc('0x2e')][_0x35fc('0x33')]));_0x237548[_0x35fc('0x32')]=_0x237548[_0x35fc('0x32')]['length']?_0x237548['attributes']:_0x280af1['model'];if(_0x350a96['query']['includeAll']){_0x237548[_0x35fc('0x42')]=[{'all':!![]}];}_0x237548=_[_0x35fc('0x3e')]({},_0x237548,_0x350a96['options']);return db[_0x35fc('0x28')]['find'](_0x237548)[_0x35fc('0x22')](handleEntityNotFound(_0x596919,null))[_0x35fc('0x22')](respondWithResult(_0x596919,null))[_0x35fc('0x47')](handleError(_0x596919,null));};exports[_0x35fc('0x48')]=function(_0x16f7c8,_0x5d3d0f){return db[_0x35fc('0x28')][_0x35fc('0x48')](_0x16f7c8['body'],{})[_0x35fc('0x22')](respondWithResult(_0x5d3d0f,0xc9))[_0x35fc('0x47')](handleError(_0x5d3d0f,null));};exports[_0x35fc('0x21')]=function(_0x211746,_0x5bc8c3){if(_0x211746[_0x35fc('0x49')]['id']){delete _0x211746['body']['id'];}return db['UserProfileResource'][_0x35fc('0x4a')]({'where':{'id':_0x211746[_0x35fc('0x46')]['id']}})[_0x35fc('0x22')](handleEntityNotFound(_0x5bc8c3,null))[_0x35fc('0x22')](saveUpdates(_0x211746[_0x35fc('0x49')],null))[_0x35fc('0x22')](respondWithResult(_0x5bc8c3,null))[_0x35fc('0x47')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0x4f555f,_0x3e2961){return db[_0x35fc('0x28')][_0x35fc('0x4a')]({'where':{'id':_0x4f555f[_0x35fc('0x46')]['id']}})[_0x35fc('0x22')](handleEntityNotFound(_0x3e2961,null))[_0x35fc('0x22')](removeEntity(_0x3e2961,null))[_0x35fc('0x47')](handleError(_0x3e2961,null));};exports[_0x35fc('0x4b')]=function(_0x35fb53,_0xe6eb6a){return db[_0x35fc('0x28')][_0x35fc('0x4b')]()[_0x35fc('0x22')](respondWithResult(_0xe6eb6a,null))[_0x35fc('0x47')](handleError(_0xe6eb6a,null));}; \ No newline at end of file +var _0x6aa7=['key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','UserProfileResource','findAll','catch','show','includeAll','find','create','update','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x4ed045,_0x5dcef3){var _0x3bc841=function(_0x176f68){while(--_0x176f68){_0x4ed045['push'](_0x4ed045['shift']());}};_0x3bc841(++_0x5dcef3);}(_0x6aa7,0x178));var _0x76aa=function(_0x4b58ce,_0x4fb5f1){_0x4b58ce=_0x4b58ce-0x0;var _0x1452a9=_0x6aa7[_0x4b58ce];return _0x1452a9;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var licenseUtil=require(_0x76aa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x18')](_0x5df49c);}return _0x112c39[_0x76aa('0x19')](_0x5df49c)[_0x76aa('0x1a')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x19')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=_0x5cf594[_0x76aa('0x1b')],_0x550d9a=_0x319bf1[_0x76aa('0x1c')],_0x328381=_0x319bf1[_0x76aa('0x1c')]+_0x319bf1[_0x76aa('0x1d')],_0x5181d2;if(_0x328381>=_0x2111c7){_0x328381=_0x2111c7;_0x5181d2=0xc8;}else{_0x5181d2=0xce;}_0x180d92[_0x76aa('0x19')](_0x5181d2);return _0x180d92[_0x76aa('0x1e')]('Content-Range',_0x550d9a+'-'+_0x328381+'/'+_0x2111c7)['json'](_0x5cf594);}return null;};}function patchUpdates(_0x256636){return function(_0x454dd3){try{jsonpatch[_0x76aa('0x1f')](_0x454dd3,_0x256636,!![]);}catch(_0x15b931){return BPromise[_0x76aa('0x20')](_0x15b931);}return _0x454dd3[_0x76aa('0x21')]();};}function saveUpdates(_0x19af92,_0x2eaf48){return function(_0x385157){if(_0x385157){return _0x385157['update'](_0x19af92)[_0x76aa('0x22')](function(_0x21064c){return _0x21064c;});}return null;};}function removeEntity(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x23')]()[_0x76aa('0x22')](function(){_0x338a6b[_0x76aa('0x19')](0xcc)[_0x76aa('0x1a')]();});}};}function handleEntityNotFound(_0xc1044c,_0x3cd039){return function(_0x3363b3){if(!_0x3363b3){_0xc1044c[_0x76aa('0x18')](0x194);}return _0x3363b3;};}function handleError(_0x2cba6d,_0x37f1ab){_0x37f1ab=_0x37f1ab||0x1f4;return function(_0x26b75e){logger[_0x76aa('0x24')](_0x26b75e['stack']);if(_0x26b75e[_0x76aa('0x25')]){delete _0x26b75e[_0x76aa('0x25')];}_0x2cba6d[_0x76aa('0x19')](_0x37f1ab)[_0x76aa('0x26')](_0x26b75e);};}exports[_0x76aa('0x27')]=function(_0x2f9316,_0x25a803){var _0x282d0a={},_0xd12a99={},_0x1bdc3d={'count':0x0,'rows':[]};var _0x545b06=_[_0x76aa('0x28')](db['UserProfileResource'][_0x76aa('0x29')],function(_0x365ff8){return{'name':_0x365ff8[_0x76aa('0x2a')],'type':_0x365ff8[_0x76aa('0x2b')][_0x76aa('0x2c')]};});_0xd12a99[_0x76aa('0x2d')]=_[_0x76aa('0x28')](_0x545b06,_0x76aa('0x25'));_0xd12a99[_0x76aa('0x2e')]=_[_0x76aa('0x2f')](_0x2f9316['query']);_0xd12a99[_0x76aa('0x30')]=_[_0x76aa('0x31')](_0xd12a99[_0x76aa('0x2d')],_0xd12a99[_0x76aa('0x2e')]);_0x282d0a[_0x76aa('0x32')]=_[_0x76aa('0x31')](_0xd12a99[_0x76aa('0x2d')],qs['fields'](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x33')]));_0x282d0a['attributes']=_0x282d0a[_0x76aa('0x32')]['length']?_0x282d0a[_0x76aa('0x32')]:_0xd12a99['model'];if(!_0x2f9316[_0x76aa('0x2e')]['hasOwnProperty']('nolimit')){_0x282d0a[_0x76aa('0x1d')]=qs[_0x76aa('0x1d')](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x1d')]);_0x282d0a['offset']=qs['offset'](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x1c')]);}_0x282d0a[_0x76aa('0x34')]=qs[_0x76aa('0x35')](_0x2f9316[_0x76aa('0x2e')]['sort']);_0x282d0a[_0x76aa('0x36')]=qs['filters'](_['pick'](_0x2f9316[_0x76aa('0x2e')],_0xd12a99[_0x76aa('0x30')]),_0x545b06);if(_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x37')]){_0x282d0a['where']=_[_0x76aa('0x38')](_0x282d0a[_0x76aa('0x36')],{'$or':_[_0x76aa('0x28')](_0x545b06,function(_0x4e131a){if(_0x4e131a[_0x76aa('0x2b')]!==_0x76aa('0x39')){var _0x2f7726={};_0x2f7726[_0x4e131a[_0x76aa('0x25')]]={'$like':'%'+_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x37')]+'%'};return _0x2f7726;}})});}_0x282d0a=_[_0x76aa('0x38')]({},_0x282d0a,_0x2f9316[_0x76aa('0x3a')]);var _0x283179={'where':_0x282d0a['where']};return db[_0x76aa('0x3b')][_0x76aa('0x1b')](_0x283179)[_0x76aa('0x22')](function(_0xa824e8){_0x1bdc3d[_0x76aa('0x1b')]=_0xa824e8;if(_0x2f9316[_0x76aa('0x2e')]['includeAll']){_0x282d0a['include']=[{'all':!![]}];}return db[_0x76aa('0x3b')][_0x76aa('0x3c')](_0x282d0a);})[_0x76aa('0x22')](function(_0x365612){_0x1bdc3d['rows']=_0x365612;return _0x1bdc3d;})[_0x76aa('0x22')](respondWithFilteredResult(_0x25a803,_0x282d0a))[_0x76aa('0x3d')](handleError(_0x25a803,null));};exports[_0x76aa('0x3e')]=function(_0x30cdcb,_0x1138b5){var _0x4aa2f3={'raw':![],'where':{'id':_0x30cdcb['params']['id']}},_0x13dafe={};_0x13dafe[_0x76aa('0x2d')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x13dafe[_0x76aa('0x2e')]=_['keys'](_0x30cdcb['query']);_0x13dafe['filters']=_[_0x76aa('0x31')](_0x13dafe[_0x76aa('0x2d')],_0x13dafe[_0x76aa('0x2e')]);_0x4aa2f3[_0x76aa('0x32')]=_[_0x76aa('0x31')](_0x13dafe['model'],qs[_0x76aa('0x33')](_0x30cdcb[_0x76aa('0x2e')][_0x76aa('0x33')]));_0x4aa2f3[_0x76aa('0x32')]=_0x4aa2f3[_0x76aa('0x32')]['length']?_0x4aa2f3[_0x76aa('0x32')]:_0x13dafe[_0x76aa('0x2d')];if(_0x30cdcb['query'][_0x76aa('0x3f')]){_0x4aa2f3['include']=[{'all':!![]}];}_0x4aa2f3=_[_0x76aa('0x38')]({},_0x4aa2f3,_0x30cdcb[_0x76aa('0x3a')]);return db[_0x76aa('0x3b')][_0x76aa('0x40')](_0x4aa2f3)[_0x76aa('0x22')](handleEntityNotFound(_0x1138b5,null))[_0x76aa('0x22')](respondWithResult(_0x1138b5,null))[_0x76aa('0x3d')](handleError(_0x1138b5,null));};exports[_0x76aa('0x41')]=function(_0xb8d052,_0x3946bd){return db['UserProfileResource'][_0x76aa('0x41')](_0xb8d052['body'],{})[_0x76aa('0x22')](respondWithResult(_0x3946bd,0xc9))[_0x76aa('0x3d')](handleError(_0x3946bd,null));};exports[_0x76aa('0x42')]=function(_0x156d4e,_0x5ca721){if(_0x156d4e['body']['id']){delete _0x156d4e[_0x76aa('0x43')]['id'];}return db['UserProfileResource'][_0x76aa('0x40')]({'where':{'id':_0x156d4e[_0x76aa('0x44')]['id']}})[_0x76aa('0x22')](handleEntityNotFound(_0x5ca721,null))[_0x76aa('0x22')](saveUpdates(_0x156d4e[_0x76aa('0x43')],null))[_0x76aa('0x22')](respondWithResult(_0x5ca721,null))['catch'](handleError(_0x5ca721,null));};exports['destroy']=function(_0x2fcf8f,_0x1eafb2){return db[_0x76aa('0x3b')][_0x76aa('0x40')]({'where':{'id':_0x2fcf8f[_0x76aa('0x44')]['id']}})[_0x76aa('0x22')](handleEntityNotFound(_0x1eafb2,null))['then'](removeEntity(_0x1eafb2,null))[_0x76aa('0x3d')](handleError(_0x1eafb2,null));};exports[_0x76aa('0x45')]=function(_0x26db69,_0x4b3d2a){return db[_0x76aa('0x3b')]['describe']()[_0x76aa('0x22')](respondWithResult(_0x4b3d2a,null))['catch'](handleError(_0x4b3d2a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7491884..e956c76 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 _0x4a9f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger'];(function(_0xda60af,_0x56e8bc){var _0xf269e8=function(_0x51d812){while(--_0x51d812){_0xda60af['push'](_0xda60af['shift']());}};_0xf269e8(++_0x56e8bc);}(_0x4a9f,0x184));var _0xf4a9=function(_0x3c0240,_0x658aa1){_0x3c0240=_0x3c0240-0x0;var _0x2ccd01=_0x4a9f[_0x3c0240];return _0x2ccd01;};'use strict';var _=require('lodash');var util=require(_0xf4a9('0x0'));var logger=require(_0xf4a9('0x1'))(_0xf4a9('0x2'));var moment=require('moment');var BPromise=require(_0xf4a9('0x3'));var rp=require(_0xf4a9('0x4'));var fs=require('fs');var path=require(_0xf4a9('0x5'));var rimraf=require(_0xf4a9('0x6'));var config=require(_0xf4a9('0x7'));var attributes=require(_0xf4a9('0x8'));module['exports']=function(_0xf00a99,_0x5b0ad3){return _0xf00a99[_0xf4a9('0x9')](_0xf4a9('0xa'),attributes,{'tableName':_0xf4a9('0xb'),'paranoid':![],'indexes':[{'name':_0xf4a9('0xc'),'fields':[_0xf4a9('0xd'),_0xf4a9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x024d=['path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x024d,0x105));var _0xd024=function(_0x493fb2,_0x316bb5){_0x493fb2=_0x493fb2-0x0;var _0x2fd145=_0x024d[_0x493fb2];return _0x2fd145;};'use strict';var _=require(_0xd024('0x0'));var util=require('util');var logger=require(_0xd024('0x1'))(_0xd024('0x2'));var moment=require('moment');var BPromise=require(_0xd024('0x3'));var rp=require(_0xd024('0x4'));var fs=require('fs');var path=require(_0xd024('0x5'));var rimraf=require(_0xd024('0x6'));var config=require('../../config/environment');var attributes=require(_0xd024('0x7'));module[_0xd024('0x8')]=function(_0x3b4f22,_0x1ace9c){return _0x3b4f22[_0xd024('0x9')](_0xd024('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd024('0xb'),'fields':[_0xd024('0xc'),_0xd024('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 64c6acd..090be06 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 _0xc61e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc61e,0x152));var _0xec61=function(_0x1ecb04,_0x1e13ed){_0x1ecb04=_0x1ecb04-0x0;var _0x22d53f=_0xc61e[_0x1ecb04];return _0x22d53f;};'use strict';var _=require(_0xec61('0x0'));var util=require(_0xec61('0x1'));var moment=require(_0xec61('0x2'));var BPromise=require(_0xec61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec61('0x4'));var db=require(_0xec61('0x5'))['db'];var utils=require(_0xec61('0x6'));var logger=require(_0xec61('0x7'))(_0xec61('0x8'));var config=require(_0xec61('0x9'));var jayson=require(_0xec61('0xa'));var client=jayson[_0xec61('0xb')][_0xec61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x396c43,_0x11b340,_0x11f848){return new BPromise(function(_0x149caf,_0x391398){return client[_0xec61('0xd')](_0x396c43,_0x11f848)[_0xec61('0xe')](function(_0x44fa73){logger[_0xec61('0xf')](_0xec61('0x10'),_0x11b340,'request\x20sent');logger[_0xec61('0x11')](_0xec61('0x12'),_0x11b340,_0xec61('0x13'),JSON[_0xec61('0x14')](_0x44fa73));if(_0x44fa73['error']){if(_0x44fa73[_0xec61('0x15')][_0xec61('0x16')]===0x1f4){logger[_0xec61('0x15')](_0xec61('0x10'),_0x11b340,_0x44fa73['error'][_0xec61('0x17')]);return _0x391398(_0x44fa73[_0xec61('0x15')][_0xec61('0x17')]);}logger['error'](_0xec61('0x10'),_0x11b340,_0x44fa73[_0xec61('0x15')][_0xec61('0x17')]);return _0x149caf(_0x44fa73['error'][_0xec61('0x17')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x11b340,_0xec61('0x13'));_0x149caf(_0x44fa73[_0xec61('0x18')]['message']);}})[_0xec61('0x19')](function(_0x41ac8b){logger[_0xec61('0x15')](_0xec61('0x10'),_0x11b340,_0x41ac8b);_0x391398(_0x41ac8b);});});} \ No newline at end of file +var _0x0ad0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3b67b4,_0x4a46bf){var _0x42d279=function(_0x4d4c6a){while(--_0x4d4c6a){_0x3b67b4['push'](_0x3b67b4['shift']());}};_0x42d279(++_0x4a46bf);}(_0x0ad0,0x1a6));var _0x00ad=function(_0x485789,_0x1a9188){_0x485789=_0x485789-0x0;var _0x5454f2=_0x0ad0[_0x485789];return _0x5454f2;};'use strict';var _=require(_0x00ad('0x0'));var util=require(_0x00ad('0x1'));var moment=require(_0x00ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x00ad('0x3'));var fs=require('fs');var Redis=require(_0x00ad('0x4'));var db=require(_0x00ad('0x5'))['db'];var utils=require(_0x00ad('0x6'));var logger=require(_0x00ad('0x7'))(_0x00ad('0x8'));var config=require(_0x00ad('0x9'));var jayson=require(_0x00ad('0xa'));var client=jayson[_0x00ad('0xb')][_0x00ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19ee0d,_0x2dd464,_0x444d55){return new BPromise(function(_0x2ceb53,_0x33735b){return client['request'](_0x19ee0d,_0x444d55)[_0x00ad('0xd')](function(_0x2ee6db){logger[_0x00ad('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x2dd464,_0x00ad('0xf'));logger[_0x00ad('0x10')](_0x00ad('0x11'),_0x2dd464,_0x00ad('0xf'),JSON[_0x00ad('0x12')](_0x2ee6db));if(_0x2ee6db[_0x00ad('0x13')]){if(_0x2ee6db[_0x00ad('0x13')][_0x00ad('0x14')]===0x1f4){logger[_0x00ad('0x13')](_0x00ad('0x15'),_0x2dd464,_0x2ee6db['error']['message']);return _0x33735b(_0x2ee6db[_0x00ad('0x13')][_0x00ad('0x16')]);}logger[_0x00ad('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x2dd464,_0x2ee6db[_0x00ad('0x13')]['message']);return _0x2ceb53(_0x2ee6db[_0x00ad('0x13')]['message']);}else{logger[_0x00ad('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x2dd464,_0x00ad('0xf'));_0x2ceb53(_0x2ee6db[_0x00ad('0x17')][_0x00ad('0x16')]);}})[_0x00ad('0x18')](function(_0x5ed786){logger[_0x00ad('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x2dd464,_0x5ed786);_0x33735b(_0x5ed786);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9e0ef9c..5d4828e 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 _0x5d3c=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show','post','put','/:id'];(function(_0x2e5717,_0x1b9b84){var _0x5240d4=function(_0x219d26){while(--_0x219d26){_0x2e5717['push'](_0x2e5717['shift']());}};_0x5240d4(++_0x1b9b84);}(_0x5d3c,0x159));var _0xc5d3=function(_0x2f4f08,_0x3ac575){_0x2f4f08=_0x2f4f08-0x0;var _0x3be5d1=_0x5d3c[_0x2f4f08];return _0x3be5d1;};'use strict';var multer=require(_0xc5d3('0x0'));var util=require(_0xc5d3('0x1'));var path=require(_0xc5d3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5d3('0x3'));var router=express['Router']();var auth=require(_0xc5d3('0x4'));var interaction=require(_0xc5d3('0x5'));var config=require(_0xc5d3('0x6'));var controller=require(_0xc5d3('0x7'));router[_0xc5d3('0x8')]('/',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xa')]);router['get']('/describe',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xb')]);router['get']('/:id',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xc')]);router[_0xc5d3('0xd')]('/',auth[_0xc5d3('0x9')](),controller['create']);router[_0xc5d3('0xe')](_0xc5d3('0xf'),auth[_0xc5d3('0x9')](),controller['update']);router[_0xc5d3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc5d3('0x11')]);module[_0xc5d3('0x12')]=router; \ No newline at end of file +var _0x7216=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','show','post','put','/:id','destroy'];(function(_0x5ee391,_0x2d6117){var _0x3fa437=function(_0x24eaf3){while(--_0x24eaf3){_0x5ee391['push'](_0x5ee391['shift']());}};_0x3fa437(++_0x2d6117);}(_0x7216,0xa3));var _0x6721=function(_0x48daf6,_0x5accd8){_0x48daf6=_0x48daf6-0x0;var _0x27732c=_0x7216[_0x48daf6];return _0x27732c;};'use strict';var multer=require(_0x6721('0x0'));var util=require(_0x6721('0x1'));var path=require(_0x6721('0x2'));var timeout=require(_0x6721('0x3'));var express=require(_0x6721('0x4'));var router=express[_0x6721('0x5')]();var auth=require(_0x6721('0x6'));var interaction=require(_0x6721('0x7'));var config=require('../../config/environment');var controller=require(_0x6721('0x8'));router[_0x6721('0x9')]('/',auth[_0x6721('0xa')](),controller[_0x6721('0xb')]);router[_0x6721('0x9')]('/describe',auth[_0x6721('0xa')](),controller['describe']);router[_0x6721('0x9')]('/:id',auth[_0x6721('0xa')](),controller[_0x6721('0xc')]);router[_0x6721('0xd')]('/',auth[_0x6721('0xa')](),controller['create']);router[_0x6721('0xe')]('/:id',auth[_0x6721('0xa')](),controller['update']);router['delete'](_0x6721('0xf'),auth[_0x6721('0xa')](),controller[_0x6721('0x10')]);module[_0x6721('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index aae588d..9ca2b56 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 _0xd745=['setDataValue','crudPermissions','join','getDataValue','split','exports','INTEGER','BOOLEAN','STRING'];(function(_0x334e39,_0x16f47f){var _0x158b6c=function(_0x20d713){while(--_0x20d713){_0x334e39['push'](_0x334e39['shift']());}};_0x158b6c(++_0x16f47f);}(_0xd745,0x9e));var _0x5d74=function(_0x1884f7,_0x9a4e77){_0x1884f7=_0x1884f7-0x0;var _0x4c890a=_0xd745[_0x1884f7];return _0x4c890a;};'use strict';var Sequelize=require('sequelize');module[_0x5d74('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5d74('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5d74('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5d74('0x3')],'set':function(_0x499a23){this[_0x5d74('0x4')](_0x5d74('0x5'),_0x499a23?_0x499a23[_0x5d74('0x6')](''):[]);},'get':function(){return this[_0x5d74('0x7')](_0x5d74('0x5'))?this['getDataValue']('crudPermissions')[_0x5d74('0x8')](''):[];}}}; \ No newline at end of file +var _0x1f10=['INTEGER','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0xfbcfc2,_0x5d4126){var _0x3bdee7=function(_0x495981){while(--_0x495981){_0xfbcfc2['push'](_0xfbcfc2['shift']());}};_0x3bdee7(++_0x5d4126);}(_0x1f10,0x69));var _0x01f1=function(_0x5545ae,_0x2a9adc){_0x5545ae=_0x5545ae-0x0;var _0x566b8b=_0x1f10[_0x5545ae];return _0x566b8b;};'use strict';var Sequelize=require(_0x01f1('0x0'));module[_0x01f1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x01f1('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x01f1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x01f1('0x2')],'set':function(_0x5effc5){this[_0x01f1('0x4')](_0x01f1('0x5'),_0x5effc5?_0x5effc5[_0x01f1('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x01f1('0x5'))?this[_0x01f1('0x7')](_0x01f1('0x5'))[_0x01f1('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9a37031..96c8a83 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 _0x992b=['fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','then','includeAll','include','findAll','catch','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x992b,0x15f));var _0xb992=function(_0x24c08f,_0x405e5e){_0x24c08f=_0x24c08f-0x0;var _0x2dc8c5=_0x992b[_0x24c08f];return _0x2dc8c5;};'use strict';var pdf=require(_0xb992('0x0'));var emlformat=require(_0xb992('0x1'));var rimraf=require(_0xb992('0x2'));var zipdir=require(_0xb992('0x3'));var jsonpatch=require(_0xb992('0x4'));var rp=require('request-promise');var moment=require(_0xb992('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb992('0x6'));var util=require('util');var path=require(_0xb992('0x7'));var sox=require(_0xb992('0x8'));var csv=require(_0xb992('0x9'));var ejs=require(_0xb992('0xa'));var fs=require('fs');var _=require(_0xb992('0xb'));var squel=require('squel');var crypto=require(_0xb992('0xc'));var jsforce=require(_0xb992('0xd'));var deskjs=require(_0xb992('0xe'));var toCsv=require(_0xb992('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb992('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb992('0x10'));var hardwareService=require(_0xb992('0x11'));var logger=require(_0xb992('0x12'))('api');var utils=require(_0xb992('0x13'));var config=require(_0xb992('0x14'));var licenseUtil=require(_0xb992('0x15'));var db=require(_0xb992('0x16'))['db'];function respondWithStatusCode(_0x145717,_0x5b81da){_0x5b81da=_0x5b81da||0xcc;return function(_0x54ff53){if(_0x54ff53){return _0x145717[_0xb992('0x17')](_0x5b81da);}return _0x145717[_0xb992('0x18')](_0x5b81da)[_0xb992('0x19')]();};}function respondWithResult(_0x49758e,_0x407127){_0x407127=_0x407127||0xc8;return function(_0x453633){if(_0x453633){return _0x49758e[_0xb992('0x18')](_0x407127)['json'](_0x453633);}};}function respondWithFilteredResult(_0x48d119,_0x90c459){return function(_0x25c4d3){if(_0x25c4d3){var _0xc160f9=_0x25c4d3['count'],_0x3119a5=_0x90c459[_0xb992('0x1a')],_0x59ac94=_0x90c459['offset']+_0x90c459[_0xb992('0x1b')],_0x4f0890;if(_0x59ac94>=_0xc160f9){_0x59ac94=_0xc160f9;_0x4f0890=0xc8;}else{_0x4f0890=0xce;}_0x48d119[_0xb992('0x18')](_0x4f0890);return _0x48d119[_0xb992('0x1c')](_0xb992('0x1d'),_0x3119a5+'-'+_0x59ac94+'/'+_0xc160f9)[_0xb992('0x1e')](_0x25c4d3);}return null;};}function patchUpdates(_0x1e9517){return function(_0x617a40){try{jsonpatch[_0xb992('0x1f')](_0x617a40,_0x1e9517,!![]);}catch(_0x4afd61){return BPromise[_0xb992('0x20')](_0x4afd61);}return _0x617a40[_0xb992('0x21')]();};}function saveUpdates(_0x17b1bf,_0x5126c3){return function(_0x4ca637){if(_0x4ca637){return _0x4ca637[_0xb992('0x22')](_0x17b1bf)['then'](function(_0x1d87cc){return _0x1d87cc;});}return null;};}function removeEntity(_0x112e6c,_0x55d626){return function(_0x1f4dbc){if(_0x1f4dbc){return _0x1f4dbc[_0xb992('0x23')]()['then'](function(){_0x112e6c['status'](0xcc)[_0xb992('0x19')]();});}};}function handleEntityNotFound(_0x391027,_0x207150){return function(_0x676716){if(!_0x676716){_0x391027['sendStatus'](0x194);}return _0x676716;};}function handleError(_0x5d79f4,_0x13711f){_0x13711f=_0x13711f||0x1f4;return function(_0xb2d92b){logger['error'](_0xb2d92b[_0xb992('0x24')]);if(_0xb2d92b[_0xb992('0x25')]){delete _0xb2d92b[_0xb992('0x25')];}_0x5d79f4[_0xb992('0x18')](_0x13711f)[_0xb992('0x26')](_0xb2d92b);};}exports[_0xb992('0x27')]=function(_0x2edcde,_0x4da76c){var _0x2e32d1={},_0x5d70fb={},_0x21d860={'count':0x0,'rows':[]};var _0x4aea6c=_[_0xb992('0x28')](db[_0xb992('0x29')][_0xb992('0x2a')],function(_0x176517){return{'name':_0x176517['fieldName'],'type':_0x176517['type']['key']};});_0x5d70fb[_0xb992('0x2b')]=_[_0xb992('0x28')](_0x4aea6c,_0xb992('0x25'));_0x5d70fb[_0xb992('0x2c')]=_['keys'](_0x2edcde[_0xb992('0x2c')]);_0x5d70fb[_0xb992('0x2d')]=_[_0xb992('0x2e')](_0x5d70fb[_0xb992('0x2b')],_0x5d70fb[_0xb992('0x2c')]);_0x2e32d1[_0xb992('0x2f')]=_[_0xb992('0x2e')](_0x5d70fb['model'],qs['fields'](_0x2edcde[_0xb992('0x2c')][_0xb992('0x30')]));_0x2e32d1[_0xb992('0x2f')]=_0x2e32d1[_0xb992('0x2f')][_0xb992('0x31')]?_0x2e32d1['attributes']:_0x5d70fb['model'];if(!_0x2edcde[_0xb992('0x2c')][_0xb992('0x32')](_0xb992('0x33'))){_0x2e32d1[_0xb992('0x1b')]=qs['limit'](_0x2edcde[_0xb992('0x2c')]['limit']);_0x2e32d1[_0xb992('0x1a')]=qs['offset'](_0x2edcde[_0xb992('0x2c')][_0xb992('0x1a')]);}_0x2e32d1[_0xb992('0x34')]=qs[_0xb992('0x35')](_0x2edcde[_0xb992('0x2c')][_0xb992('0x35')]);_0x2e32d1[_0xb992('0x36')]=qs[_0xb992('0x2d')](_[_0xb992('0x37')](_0x2edcde[_0xb992('0x2c')],_0x5d70fb[_0xb992('0x2d')]),_0x4aea6c);if(_0x2edcde[_0xb992('0x2c')][_0xb992('0x38')]){_0x2e32d1[_0xb992('0x36')]=_[_0xb992('0x39')](_0x2e32d1[_0xb992('0x36')],{'$or':_[_0xb992('0x28')](_0x4aea6c,function(_0x5b7659){if(_0x5b7659['type']!=='VIRTUAL'){var _0x3d68d1={};_0x3d68d1[_0x5b7659['name']]={'$like':'%'+_0x2edcde[_0xb992('0x2c')][_0xb992('0x38')]+'%'};return _0x3d68d1;}})});}_0x2e32d1=_[_0xb992('0x39')]({},_0x2e32d1,_0x2edcde[_0xb992('0x3a')]);var _0x4711ec={'where':_0x2e32d1[_0xb992('0x36')]};return db[_0xb992('0x29')][_0xb992('0x3b')](_0x4711ec)[_0xb992('0x3c')](function(_0x4bdceb){_0x21d860[_0xb992('0x3b')]=_0x4bdceb;if(_0x2edcde[_0xb992('0x2c')][_0xb992('0x3d')]){_0x2e32d1[_0xb992('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0xb992('0x3f')](_0x2e32d1);})[_0xb992('0x3c')](function(_0x489bbf){_0x21d860['rows']=_0x489bbf;return _0x21d860;})['then'](respondWithFilteredResult(_0x4da76c,_0x2e32d1))[_0xb992('0x40')](handleError(_0x4da76c,null));};exports['show']=function(_0x16f54c,_0x1ac198){var _0x19efc6={'raw':![],'where':{'id':_0x16f54c[_0xb992('0x41')]['id']}},_0x24ba23={};_0x24ba23[_0xb992('0x2b')]=_[_0xb992('0x42')](db[_0xb992('0x29')][_0xb992('0x2a')]);_0x24ba23['query']=_[_0xb992('0x42')](_0x16f54c[_0xb992('0x2c')]);_0x24ba23[_0xb992('0x2d')]=_[_0xb992('0x2e')](_0x24ba23[_0xb992('0x2b')],_0x24ba23[_0xb992('0x2c')]);_0x19efc6['attributes']=_[_0xb992('0x2e')](_0x24ba23[_0xb992('0x2b')],qs[_0xb992('0x30')](_0x16f54c[_0xb992('0x2c')]['fields']));_0x19efc6[_0xb992('0x2f')]=_0x19efc6['attributes']['length']?_0x19efc6[_0xb992('0x2f')]:_0x24ba23[_0xb992('0x2b')];if(_0x16f54c[_0xb992('0x2c')][_0xb992('0x3d')]){_0x19efc6[_0xb992('0x3e')]=[{'all':!![]}];}_0x19efc6=_['merge']({},_0x19efc6,_0x16f54c['options']);return db[_0xb992('0x29')][_0xb992('0x43')](_0x19efc6)['then'](handleEntityNotFound(_0x1ac198,null))[_0xb992('0x3c')](respondWithResult(_0x1ac198,null))['catch'](handleError(_0x1ac198,null));};exports[_0xb992('0x44')]=function(_0x325585,_0x414f98){return db[_0xb992('0x29')][_0xb992('0x44')](_0x325585[_0xb992('0x45')],{})[_0xb992('0x3c')](respondWithResult(_0x414f98,0xc9))[_0xb992('0x40')](handleError(_0x414f98,null));};exports[_0xb992('0x22')]=function(_0x54dcff,_0x180b8b){if(_0x54dcff[_0xb992('0x45')]['id']){delete _0x54dcff[_0xb992('0x45')]['id'];}return db['UserProfileSection'][_0xb992('0x43')]({'where':{'id':_0x54dcff[_0xb992('0x41')]['id']}})[_0xb992('0x3c')](handleEntityNotFound(_0x180b8b,null))['then'](saveUpdates(_0x54dcff[_0xb992('0x45')],null))[_0xb992('0x3c')](respondWithResult(_0x180b8b,null))['catch'](handleError(_0x180b8b,null));};exports[_0xb992('0x23')]=function(_0x319b43,_0xeb7420){return db[_0xb992('0x29')][_0xb992('0x43')]({'where':{'id':_0x319b43[_0xb992('0x41')]['id']}})[_0xb992('0x3c')](handleEntityNotFound(_0xeb7420,null))['then'](removeEntity(_0xeb7420,null))['catch'](handleError(_0xeb7420,null));};exports[_0xb992('0x46')]=function(_0x459f9a,_0xb13385){return db[_0xb992('0x29')][_0xb992('0x46')]()[_0xb992('0x3c')](respondWithResult(_0xb13385,null))[_0xb992('0x40')](handleError(_0xb13385,null));}; \ No newline at end of file +var _0x7719=['reject','update','then','error','name','map','UserProfileSection','rawAttributes','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','include','rows','catch','show','includeAll','options','find','create','body','params','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x34588c,_0xcc2f9){var _0x4a02c2=function(_0x1f51a5){while(--_0x1f51a5){_0x34588c['push'](_0x34588c['shift']());}};_0x4a02c2(++_0xcc2f9);}(_0x7719,0x188));var _0x9771=function(_0x2cb9d3,_0x49c4d4){_0x2cb9d3=_0x2cb9d3-0x0;var _0x1eebce=_0x7719[_0x2cb9d3];return _0x1eebce;};'use strict';var pdf=require(_0x9771('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9771('0x1'));var zipdir=require(_0x9771('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9771('0x3'));var moment=require('moment');var BPromise=require(_0x9771('0x4'));var Mustache=require(_0x9771('0x5'));var util=require(_0x9771('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9771('0x7'));var ejs=require(_0x9771('0x8'));var fs=require('fs');var _=require(_0x9771('0x9'));var squel=require(_0x9771('0xa'));var crypto=require(_0x9771('0xb'));var jsforce=require(_0x9771('0xc'));var deskjs=require(_0x9771('0xd'));var toCsv=require(_0x9771('0x7'));var querystring=require(_0x9771('0xe'));var Papa=require(_0x9771('0xf'));var Redis=require(_0x9771('0x10'));var authService=require(_0x9771('0x11'));var qs=require(_0x9771('0x12'));var as=require(_0x9771('0x13'));var hardwareService=require(_0x9771('0x14'));var logger=require('../../config/logger')(_0x9771('0x15'));var utils=require(_0x9771('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9771('0x17'))['db'];function respondWithStatusCode(_0x3401f1,_0x232889){_0x232889=_0x232889||0xcc;return function(_0x2ae241){if(_0x2ae241){return _0x3401f1[_0x9771('0x18')](_0x232889);}return _0x3401f1[_0x9771('0x19')](_0x232889)[_0x9771('0x1a')]();};}function respondWithResult(_0x3c4563,_0x10ccda){_0x10ccda=_0x10ccda||0xc8;return function(_0x1281f9){if(_0x1281f9){return _0x3c4563[_0x9771('0x19')](_0x10ccda)[_0x9771('0x1b')](_0x1281f9);}};}function respondWithFilteredResult(_0xae0d1,_0x591997){return function(_0x3e7d70){if(_0x3e7d70){var _0x514c18=_0x3e7d70[_0x9771('0x1c')],_0x506f36=_0x591997[_0x9771('0x1d')],_0xd96517=_0x591997[_0x9771('0x1d')]+_0x591997[_0x9771('0x1e')],_0x314694;if(_0xd96517>=_0x514c18){_0xd96517=_0x514c18;_0x314694=0xc8;}else{_0x314694=0xce;}_0xae0d1[_0x9771('0x19')](_0x314694);return _0xae0d1[_0x9771('0x1f')](_0x9771('0x20'),_0x506f36+'-'+_0xd96517+'/'+_0x514c18)[_0x9771('0x1b')](_0x3e7d70);}return null;};}function patchUpdates(_0x1fc43a){return function(_0x1da0c1){try{jsonpatch[_0x9771('0x21')](_0x1da0c1,_0x1fc43a,!![]);}catch(_0x45360c){return BPromise[_0x9771('0x22')](_0x45360c);}return _0x1da0c1['save']();};}function saveUpdates(_0x49d40f,_0x1db875){return function(_0x263ef2){if(_0x263ef2){return _0x263ef2[_0x9771('0x23')](_0x49d40f)[_0x9771('0x24')](function(_0x2c445f){return _0x2c445f;});}return null;};}function removeEntity(_0xf469fa,_0x396bc7){return function(_0x5e7c1e){if(_0x5e7c1e){return _0x5e7c1e['destroy']()[_0x9771('0x24')](function(){_0xf469fa['status'](0xcc)[_0x9771('0x1a')]();});}};}function handleEntityNotFound(_0x55995d,_0x56fd08){return function(_0x1e7ef5){if(!_0x1e7ef5){_0x55995d[_0x9771('0x18')](0x194);}return _0x1e7ef5;};}function handleError(_0x18a204,_0x1b9c3c){_0x1b9c3c=_0x1b9c3c||0x1f4;return function(_0x3654e0){logger[_0x9771('0x25')](_0x3654e0['stack']);if(_0x3654e0[_0x9771('0x26')]){delete _0x3654e0[_0x9771('0x26')];}_0x18a204[_0x9771('0x19')](_0x1b9c3c)['send'](_0x3654e0);};}exports['index']=function(_0x46ef3f,_0x49be2d){var _0x2a2e35={},_0x17b2b3={},_0x179105={'count':0x0,'rows':[]};var _0xf8b8c4=_[_0x9771('0x27')](db[_0x9771('0x28')][_0x9771('0x29')],function(_0x45a008){return{'name':_0x45a008['fieldName'],'type':_0x45a008[_0x9771('0x2a')]['key']};});_0x17b2b3[_0x9771('0x2b')]=_['map'](_0xf8b8c4,_0x9771('0x26'));_0x17b2b3['query']=_[_0x9771('0x2c')](_0x46ef3f['query']);_0x17b2b3[_0x9771('0x2d')]=_['intersection'](_0x17b2b3['model'],_0x17b2b3[_0x9771('0x2e')]);_0x2a2e35[_0x9771('0x2f')]=_[_0x9771('0x30')](_0x17b2b3[_0x9771('0x2b')],qs['fields'](_0x46ef3f[_0x9771('0x2e')][_0x9771('0x31')]));_0x2a2e35[_0x9771('0x2f')]=_0x2a2e35[_0x9771('0x2f')][_0x9771('0x32')]?_0x2a2e35[_0x9771('0x2f')]:_0x17b2b3[_0x9771('0x2b')];if(!_0x46ef3f['query'][_0x9771('0x33')](_0x9771('0x34'))){_0x2a2e35['limit']=qs['limit'](_0x46ef3f[_0x9771('0x2e')][_0x9771('0x1e')]);_0x2a2e35['offset']=qs[_0x9771('0x1d')](_0x46ef3f[_0x9771('0x2e')][_0x9771('0x1d')]);}_0x2a2e35['order']=qs[_0x9771('0x35')](_0x46ef3f[_0x9771('0x2e')][_0x9771('0x35')]);_0x2a2e35['where']=qs[_0x9771('0x2d')](_[_0x9771('0x36')](_0x46ef3f[_0x9771('0x2e')],_0x17b2b3['filters']),_0xf8b8c4);if(_0x46ef3f[_0x9771('0x2e')]['filter']){_0x2a2e35[_0x9771('0x37')]=_[_0x9771('0x38')](_0x2a2e35[_0x9771('0x37')],{'$or':_['map'](_0xf8b8c4,function(_0x4fd0db){if(_0x4fd0db[_0x9771('0x2a')]!==_0x9771('0x39')){var _0x5c680f={};_0x5c680f[_0x4fd0db[_0x9771('0x26')]]={'$like':'%'+_0x46ef3f[_0x9771('0x2e')][_0x9771('0x3a')]+'%'};return _0x5c680f;}})});}_0x2a2e35=_[_0x9771('0x38')]({},_0x2a2e35,_0x46ef3f['options']);var _0x542a4d={'where':_0x2a2e35[_0x9771('0x37')]};return db[_0x9771('0x28')][_0x9771('0x1c')](_0x542a4d)[_0x9771('0x24')](function(_0x236df7){_0x179105[_0x9771('0x1c')]=_0x236df7;if(_0x46ef3f[_0x9771('0x2e')]['includeAll']){_0x2a2e35[_0x9771('0x3b')]=[{'all':!![]}];}return db[_0x9771('0x28')]['findAll'](_0x2a2e35);})[_0x9771('0x24')](function(_0x1f7c96){_0x179105[_0x9771('0x3c')]=_0x1f7c96;return _0x179105;})[_0x9771('0x24')](respondWithFilteredResult(_0x49be2d,_0x2a2e35))[_0x9771('0x3d')](handleError(_0x49be2d,null));};exports[_0x9771('0x3e')]=function(_0x512447,_0x3cb0ad){var _0x54163d={'raw':![],'where':{'id':_0x512447['params']['id']}},_0x1cec55={};_0x1cec55['model']=_[_0x9771('0x2c')](db[_0x9771('0x28')][_0x9771('0x29')]);_0x1cec55['query']=_['keys'](_0x512447[_0x9771('0x2e')]);_0x1cec55[_0x9771('0x2d')]=_[_0x9771('0x30')](_0x1cec55[_0x9771('0x2b')],_0x1cec55[_0x9771('0x2e')]);_0x54163d[_0x9771('0x2f')]=_[_0x9771('0x30')](_0x1cec55[_0x9771('0x2b')],qs[_0x9771('0x31')](_0x512447[_0x9771('0x2e')][_0x9771('0x31')]));_0x54163d[_0x9771('0x2f')]=_0x54163d[_0x9771('0x2f')][_0x9771('0x32')]?_0x54163d[_0x9771('0x2f')]:_0x1cec55[_0x9771('0x2b')];if(_0x512447[_0x9771('0x2e')][_0x9771('0x3f')]){_0x54163d['include']=[{'all':!![]}];}_0x54163d=_[_0x9771('0x38')]({},_0x54163d,_0x512447[_0x9771('0x40')]);return db[_0x9771('0x28')][_0x9771('0x41')](_0x54163d)[_0x9771('0x24')](handleEntityNotFound(_0x3cb0ad,null))[_0x9771('0x24')](respondWithResult(_0x3cb0ad,null))[_0x9771('0x3d')](handleError(_0x3cb0ad,null));};exports['create']=function(_0xbdeea4,_0xdb58b7){return db['UserProfileSection'][_0x9771('0x42')](_0xbdeea4[_0x9771('0x43')],{})[_0x9771('0x24')](respondWithResult(_0xdb58b7,0xc9))['catch'](handleError(_0xdb58b7,null));};exports[_0x9771('0x23')]=function(_0x40b563,_0x2eb2b6){if(_0x40b563['body']['id']){delete _0x40b563[_0x9771('0x43')]['id'];}return db[_0x9771('0x28')][_0x9771('0x41')]({'where':{'id':_0x40b563[_0x9771('0x44')]['id']}})[_0x9771('0x24')](handleEntityNotFound(_0x2eb2b6,null))['then'](saveUpdates(_0x40b563[_0x9771('0x43')],null))[_0x9771('0x24')](respondWithResult(_0x2eb2b6,null))['catch'](handleError(_0x2eb2b6,null));};exports[_0x9771('0x45')]=function(_0x110494,_0x578e66){return db[_0x9771('0x28')][_0x9771('0x41')]({'where':{'id':_0x110494['params']['id']}})[_0x9771('0x24')](handleEntityNotFound(_0x578e66,null))['then'](removeEntity(_0x578e66,null))[_0x9771('0x3d')](handleError(_0x578e66,null));};exports[_0x9771('0x46')]=function(_0x2a5393,_0x1fdb1a){return db[_0x9771('0x28')][_0x9771('0x46')]()[_0x9771('0x24')](respondWithResult(_0x1fdb1a,null))[_0x9771('0x3d')](handleError(_0x1fdb1a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 82c906d..764aa05 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 _0xad00=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x56ad22,_0x309ea1){var _0x1ae59d=function(_0x1b0e01){while(--_0x1b0e01){_0x56ad22['push'](_0x56ad22['shift']());}};_0x1ae59d(++_0x309ea1);}(_0xad00,0x195));var _0x0ad0=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xad00[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var logger=require(_0x0ad0('0x2'))(_0x0ad0('0x3'));var moment=require(_0x0ad0('0x4'));var BPromise=require(_0x0ad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ad0('0x6'));var rimraf=require(_0x0ad0('0x7'));var config=require(_0x0ad0('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x0ad0('0x9')]=function(_0x4165e6,_0x1f33d8){return _0x4165e6[_0x0ad0('0xa')](_0x0ad0('0xb'),attributes,{'tableName':_0x0ad0('0xc'),'paranoid':![],'indexes':[{'name':_0x0ad0('0xd'),'fields':[_0x0ad0('0xe'),_0x0ad0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14e0=['./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x20e959,_0x5a5d31){var _0x163d64=function(_0x196844){while(--_0x196844){_0x20e959['push'](_0x20e959['shift']());}};_0x163d64(++_0x5a5d31);}(_0x14e0,0x6e));var _0x014e=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x14e0[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x014e('0x0'));var util=require(_0x014e('0x1'));var logger=require(_0x014e('0x2'))(_0x014e('0x3'));var moment=require('moment');var BPromise=require(_0x014e('0x4'));var rp=require(_0x014e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x014e('0x6'));var attributes=require(_0x014e('0x7'));module['exports']=function(_0x58cdc6,_0x5f12e5){return _0x58cdc6[_0x014e('0x8')]('UserProfileSection',attributes,{'tableName':_0x014e('0x9'),'paranoid':![],'indexes':[{'name':_0x014e('0xa'),'fields':[_0x014e('0xb'),_0x014e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index eb13dfa..a287e93 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 _0x92a1=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x29e487,_0x1c9153){var _0x55c12a=function(_0x21ee88){while(--_0x21ee88){_0x29e487['push'](_0x29e487['shift']());}};_0x55c12a(++_0x1c9153);}(_0x92a1,0x1ea));var _0x192a=function(_0x3aa5ac,_0x259464){_0x3aa5ac=_0x3aa5ac-0x0;var _0x33053e=_0x92a1[_0x3aa5ac];return _0x33053e;};'use strict';var _=require('lodash');var util=require(_0x192a('0x0'));var moment=require(_0x192a('0x1'));var BPromise=require(_0x192a('0x2'));var rs=require(_0x192a('0x3'));var fs=require('fs');var Redis=require(_0x192a('0x4'));var db=require(_0x192a('0x5'))['db'];var utils=require(_0x192a('0x6'));var logger=require(_0x192a('0x7'))(_0x192a('0x8'));var config=require(_0x192a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x192a('0xa')][_0x192a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a176c,_0x1a6f09,_0x1b34d4){return new BPromise(function(_0x2bf56b,_0x1d12ec){return client[_0x192a('0xc')](_0x2a176c,_0x1b34d4)['then'](function(_0x4c34df){logger[_0x192a('0xd')](_0x192a('0xe'),_0x1a6f09,_0x192a('0xf'));logger[_0x192a('0x10')](_0x192a('0x11'),_0x1a6f09,_0x192a('0xf'),JSON['stringify'](_0x4c34df));if(_0x4c34df[_0x192a('0x12')]){if(_0x4c34df['error'][_0x192a('0x13')]===0x1f4){logger[_0x192a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x1a6f09,_0x4c34df[_0x192a('0x12')][_0x192a('0x14')]);return _0x1d12ec(_0x4c34df[_0x192a('0x12')][_0x192a('0x14')]);}logger[_0x192a('0x12')](_0x192a('0xe'),_0x1a6f09,_0x4c34df[_0x192a('0x12')][_0x192a('0x14')]);return _0x2bf56b(_0x4c34df[_0x192a('0x12')]['message']);}else{logger['info'](_0x192a('0xe'),_0x1a6f09,_0x192a('0xf'));_0x2bf56b(_0x4c34df[_0x192a('0x15')]['message']);}})[_0x192a('0x16')](function(_0x4c1df1){logger[_0x192a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x1a6f09,_0x4c1df1);_0x1d12ec(_0x4c1df1);});});} \ No newline at end of file +var _0x2f41=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x2f41,0x94));var _0x12f4=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x2f41[_0x369a98];return _0x29565c;};'use strict';var _=require(_0x12f4('0x0'));var util=require(_0x12f4('0x1'));var moment=require('moment');var BPromise=require(_0x12f4('0x2'));var rs=require(_0x12f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12f4('0x4'))['db'];var utils=require(_0x12f4('0x5'));var logger=require(_0x12f4('0x6'))(_0x12f4('0x7'));var config=require('../../config/environment');var jayson=require(_0x12f4('0x8'));var client=jayson['client'][_0x12f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x295b3f,_0x32ad05,_0x22ba47){return new BPromise(function(_0x4282a5,_0x15a4a0){return client[_0x12f4('0xa')](_0x295b3f,_0x22ba47)['then'](function(_0x2fb13e){logger[_0x12f4('0xb')](_0x12f4('0xc'),_0x32ad05,_0x12f4('0xd'));logger[_0x12f4('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x32ad05,'request\x20sent',JSON[_0x12f4('0xf')](_0x2fb13e));if(_0x2fb13e['error']){if(_0x2fb13e[_0x12f4('0x10')][_0x12f4('0x11')]===0x1f4){logger[_0x12f4('0x10')](_0x12f4('0xc'),_0x32ad05,_0x2fb13e[_0x12f4('0x10')]['message']);return _0x15a4a0(_0x2fb13e[_0x12f4('0x10')][_0x12f4('0x12')]);}logger[_0x12f4('0x10')](_0x12f4('0xc'),_0x32ad05,_0x2fb13e[_0x12f4('0x10')][_0x12f4('0x12')]);return _0x4282a5(_0x2fb13e[_0x12f4('0x10')][_0x12f4('0x12')]);}else{logger[_0x12f4('0xb')](_0x12f4('0xc'),_0x32ad05,_0x12f4('0xd'));_0x4282a5(_0x2fb13e[_0x12f4('0x13')][_0x12f4('0x12')]);}})['catch'](function(_0x5e1de7){logger[_0x12f4('0x10')](_0x12f4('0xc'),_0x32ad05,_0x5e1de7);_0x15a4a0(_0x5e1de7);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 72a5571..c196109 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 _0x7f3f=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','multer','util'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0x7f3f,0x1e8));var _0xf7f3=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0x7f3f[_0x3ff0f0];return _0x5dc82a;};'use strict';var multer=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var path=require(_0xf7f3('0x2'));var timeout=require(_0xf7f3('0x3'));var express=require(_0xf7f3('0x4'));var router=express['Router']();var auth=require(_0xf7f3('0x5'));var interaction=require(_0xf7f3('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x10e3=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x10e3,0x1e8));var _0x310e=function(_0x7f8b61,_0x4fa837){_0x7f8b61=_0x7f8b61-0x0;var _0x16e761=_0x10e3[_0x7f8b61];return _0x16e761;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x310e('0x0'));var timeout=require(_0x310e('0x1'));var express=require(_0x310e('0x2'));var router=express[_0x310e('0x3')]();var auth=require(_0x310e('0x4'));var interaction=require(_0x310e('0x5'));var config=require('../../config/environment');module[_0x310e('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e520c8e..50096ea 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_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 8a9ccae..c1ef241 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 _0xd9f3=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x45943a,_0x594756){var _0x96f728=function(_0x3de100){while(--_0x3de100){_0x45943a['push'](_0x45943a['shift']());}};_0x96f728(++_0x594756);}(_0xd9f3,0x70));var _0x3d9f=function(_0x1a607b,_0x396185){_0x1a607b=_0x1a607b-0x0;var _0x46362a=_0xd9f3[_0x1a607b];return _0x46362a;};'use strict';var _=require(_0x3d9f('0x0'));var util=require(_0x3d9f('0x1'));var logger=require(_0x3d9f('0x2'))(_0x3d9f('0x3'));var moment=require(_0x3d9f('0x4'));var BPromise=require(_0x3d9f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d9f('0x6'));var rimraf=require(_0x3d9f('0x7'));var config=require(_0x3d9f('0x8'));var attributes=require(_0x3d9f('0x9'));module[_0x3d9f('0xa')]=function(_0x4f811a,_0xec880){return _0x4f811a[_0x3d9f('0xb')](_0x3d9f('0xc'),attributes,{'tableName':_0x3d9f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd607=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x44ace6,_0x448496){var _0x1b5359=function(_0x149c04){while(--_0x149c04){_0x44ace6['push'](_0x44ace6['shift']());}};_0x1b5359(++_0x448496);}(_0xd607,0xf3));var _0x7d60=function(_0x36d2e9,_0x2770ef){_0x36d2e9=_0x36d2e9-0x0;var _0x2bd199=_0xd607[_0x36d2e9];return _0x2bd199;};'use strict';var _=require(_0x7d60('0x0'));var util=require(_0x7d60('0x1'));var logger=require(_0x7d60('0x2'))(_0x7d60('0x3'));var moment=require(_0x7d60('0x4'));var BPromise=require(_0x7d60('0x5'));var rp=require(_0x7d60('0x6'));var fs=require('fs');var path=require(_0x7d60('0x7'));var rimraf=require(_0x7d60('0x8'));var config=require(_0x7d60('0x9'));var attributes=require(_0x7d60('0xa'));module[_0x7d60('0xb')]=function(_0x1ef8e9,_0xade2fe){return _0x1ef8e9[_0x7d60('0xc')](_0x7d60('0xd'),attributes,{'tableName':_0x7d60('0xe'),'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 919ef82..8202d74 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 _0x82c9=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3a1b4d,_0x2f9faa){var _0x5345ce=function(_0x33d10d){while(--_0x33d10d){_0x3a1b4d['push'](_0x3a1b4d['shift']());}};_0x5345ce(++_0x2f9faa);}(_0x82c9,0xcf));var _0x982c=function(_0x1ef437,_0x3468a3){_0x1ef437=_0x1ef437-0x0;var _0x214c8b=_0x82c9[_0x1ef437];return _0x214c8b;};'use strict';var _=require(_0x982c('0x0'));var util=require(_0x982c('0x1'));var moment=require('moment');var BPromise=require(_0x982c('0x2'));var rs=require(_0x982c('0x3'));var fs=require('fs');var Redis=require(_0x982c('0x4'));var db=require(_0x982c('0x5'))['db'];var utils=require(_0x982c('0x6'));var logger=require(_0x982c('0x7'))(_0x982c('0x8'));var config=require(_0x982c('0x9'));var jayson=require(_0x982c('0xa'));var client=jayson[_0x982c('0xb')][_0x982c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a7f71,_0x4751c4,_0x55b0f7){return new BPromise(function(_0x12f8de,_0x189e75){return client[_0x982c('0xd')](_0x1a7f71,_0x55b0f7)[_0x982c('0xe')](function(_0x1c751e){logger[_0x982c('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x4751c4,_0x982c('0x10'));logger[_0x982c('0x11')](_0x982c('0x12'),_0x4751c4,'request\x20sent',JSON['stringify'](_0x1c751e));if(_0x1c751e[_0x982c('0x13')]){if(_0x1c751e[_0x982c('0x13')][_0x982c('0x14')]===0x1f4){logger[_0x982c('0x13')](_0x982c('0x15'),_0x4751c4,_0x1c751e[_0x982c('0x13')][_0x982c('0x16')]);return _0x189e75(_0x1c751e['error'][_0x982c('0x16')]);}logger[_0x982c('0x13')](_0x982c('0x15'),_0x4751c4,_0x1c751e['error'][_0x982c('0x16')]);return _0x12f8de(_0x1c751e['error'][_0x982c('0x16')]);}else{logger[_0x982c('0xf')](_0x982c('0x15'),_0x4751c4,_0x982c('0x10'));_0x12f8de(_0x1c751e[_0x982c('0x17')][_0x982c('0x16')]);}})['catch'](function(_0x31bba8){logger[_0x982c('0x13')](_0x982c('0x15'),_0x4751c4,_0x31bba8);_0x189e75(_0x31bba8);});});} \ No newline at end of file +var _0xbe22=['randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbe22,0x1e4));var _0x2be2=function(_0x212a68,_0x1f0bd4){_0x212a68=_0x212a68-0x0;var _0x5dac80=_0xbe22[_0x212a68];return _0x5dac80;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2be2('0x2'));var fs=require('fs');var Redis=require(_0x2be2('0x3'));var db=require(_0x2be2('0x4'))['db'];var utils=require(_0x2be2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2be2('0x6')][_0x2be2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x780213,_0x4eb367,_0x41e50f){return new BPromise(function(_0x1d67ce,_0x334c03){return client[_0x2be2('0x8')](_0x780213,_0x41e50f)[_0x2be2('0x9')](function(_0x4b4632){logger[_0x2be2('0xa')](_0x2be2('0xb'),_0x4eb367,_0x2be2('0xc'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4eb367,'request\x20sent',JSON[_0x2be2('0xd')](_0x4b4632));if(_0x4b4632[_0x2be2('0xe')]){if(_0x4b4632[_0x2be2('0xe')][_0x2be2('0xf')]===0x1f4){logger['error'](_0x2be2('0xb'),_0x4eb367,_0x4b4632[_0x2be2('0xe')][_0x2be2('0x10')]);return _0x334c03(_0x4b4632['error'][_0x2be2('0x10')]);}logger['error'](_0x2be2('0xb'),_0x4eb367,_0x4b4632[_0x2be2('0xe')][_0x2be2('0x10')]);return _0x1d67ce(_0x4b4632[_0x2be2('0xe')][_0x2be2('0x10')]);}else{logger[_0x2be2('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x4eb367,_0x2be2('0xc'));_0x1d67ce(_0x4b4632['result'][_0x2be2('0x10')]);}})[_0x2be2('0x11')](function(_0x45618f){logger[_0x2be2('0xe')](_0x2be2('0xb'),_0x4eb367,_0x45618f);_0x334c03(_0x45618f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9191946..1a97591 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 _0x2124=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x11f5cd,_0x204c80){var _0x58dcfe=function(_0x2bd2e2){while(--_0x2bd2e2){_0x11f5cd['push'](_0x11f5cd['shift']());}};_0x58dcfe(++_0x204c80);}(_0x2124,0x127));var _0x4212=function(_0x3a9eab,_0x523d9c){_0x3a9eab=_0x3a9eab-0x0;var _0x153ffd=_0x2124[_0x3a9eab];return _0x153ffd;};'use strict';var multer=require(_0x4212('0x0'));var util=require(_0x4212('0x1'));var path=require(_0x4212('0x2'));var timeout=require(_0x4212('0x3'));var express=require(_0x4212('0x4'));var router=express['Router']();var auth=require(_0x4212('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4212('0x6'));module[_0x4212('0x7')]=router; \ No newline at end of file +var _0x29d4=['../../components/auth/service','../../config/environment','multer','util','Router'];(function(_0x4fc95c,_0x3796c1){var _0x1d0498=function(_0x42c72e){while(--_0x42c72e){_0x4fc95c['push'](_0x4fc95c['shift']());}};_0x1d0498(++_0x3796c1);}(_0x29d4,0xe3));var _0x429d=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x29d4[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x429d('0x0'));var util=require(_0x429d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x429d('0x2')]();var auth=require(_0x429d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x429d('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 765ad6d..a52f755 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 _0xd8b0=['exports','sequelize'];(function(_0x4ca88f,_0xbd5b23){var _0x4bd853=function(_0xac771f){while(--_0xac771f){_0x4ca88f['push'](_0x4ca88f['shift']());}};_0x4bd853(++_0xbd5b23);}(_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 _0xb10b=['sequelize','INTEGER'];(function(_0x3b0cd6,_0x49f5a6){var _0x17c772=function(_0x5e0ad5){while(--_0x5e0ad5){_0x3b0cd6['push'](_0x3b0cd6['shift']());}};_0x17c772(++_0x49f5a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0xb10b[_0x27fedb];return _0x58ab78;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index aafd9dc..e3209c8 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 _0xb903=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5499d9,_0x1abd4f){var _0x52054c=function(_0x2205bc){while(--_0x2205bc){_0x5499d9['push'](_0x5499d9['shift']());}};_0x52054c(++_0x1abd4f);}(_0xb903,0x185));var _0x3b90=function(_0x21c360,_0xabc5c6){_0x21c360=_0x21c360-0x0;var _0x184764=_0xb903[_0x21c360];return _0x184764;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('UserVoiceQueue',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ca=['UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x3424fe,_0x408a30){var _0xc5fbfe=function(_0x5add98){while(--_0x5add98){_0x3424fe['push'](_0x3424fe['shift']());}};_0xc5fbfe(++_0x408a30);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x24ca[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c96c84e..1748331 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 _0xce30=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http'];(function(_0x1b9ca1,_0x37fd1d){var _0x1d8a80=function(_0x27450e){while(--_0x27450e){_0x1b9ca1['push'](_0x1b9ca1['shift']());}};_0x1d8a80(++_0x37fd1d);}(_0xce30,0x160));var _0x0ce3=function(_0x369551,_0x4b95aa){_0x369551=_0x369551-0x0;var _0x2bc0a7=_0xce30[_0x369551];return _0x2bc0a7;};'use strict';var _=require('lodash');var util=require(_0x0ce3('0x0'));var moment=require('moment');var BPromise=require(_0x0ce3('0x1'));var rs=require(_0x0ce3('0x2'));var fs=require('fs');var Redis=require(_0x0ce3('0x3'));var db=require(_0x0ce3('0x4'))['db'];var utils=require(_0x0ce3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ce3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ce3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ac91a,_0x5d32f0,_0x1d0221){return new BPromise(function(_0x3d067c,_0x1dc620){return client[_0x0ce3('0x8')](_0x5ac91a,_0x1d0221)[_0x0ce3('0x9')](function(_0x1f1bbb){logger[_0x0ce3('0xa')](_0x0ce3('0xb'),_0x5d32f0,_0x0ce3('0xc'));logger['debug'](_0x0ce3('0xd'),_0x5d32f0,_0x0ce3('0xc'),JSON['stringify'](_0x1f1bbb));if(_0x1f1bbb[_0x0ce3('0xe')]){if(_0x1f1bbb['error']['code']===0x1f4){logger[_0x0ce3('0xe')](_0x0ce3('0xb'),_0x5d32f0,_0x1f1bbb['error'][_0x0ce3('0xf')]);return _0x1dc620(_0x1f1bbb['error'][_0x0ce3('0xf')]);}logger[_0x0ce3('0xe')](_0x0ce3('0xb'),_0x5d32f0,_0x1f1bbb[_0x0ce3('0xe')][_0x0ce3('0xf')]);return _0x3d067c(_0x1f1bbb[_0x0ce3('0xe')][_0x0ce3('0xf')]);}else{logger[_0x0ce3('0xa')](_0x0ce3('0xb'),_0x5d32f0,_0x0ce3('0xc'));_0x3d067c(_0x1f1bbb[_0x0ce3('0x10')][_0x0ce3('0xf')]);}})[_0x0ce3('0x11')](function(_0x144a94){logger[_0x0ce3('0xe')](_0x0ce3('0xb'),_0x5d32f0,_0x144a94);_0x1dc620(_0x144a94);});});} \ No newline at end of file +var _0x9829=['stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2ae2f5,_0x3b709a){var _0xc604fc=function(_0x455ab5){while(--_0x455ab5){_0x2ae2f5['push'](_0x2ae2f5['shift']());}};_0xc604fc(++_0x3b709a);}(_0x9829,0x89));var _0x9982=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x9829[_0x256b72];return _0x2183e3;};'use strict';var _=require('lodash');var util=require(_0x9982('0x0'));var moment=require(_0x9982('0x1'));var BPromise=require(_0x9982('0x2'));var rs=require(_0x9982('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x4'))['db'];var utils=require(_0x9982('0x5'));var logger=require(_0x9982('0x6'))(_0x9982('0x7'));var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson[_0x9982('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x185589,_0xda49dc,_0x1a29f9){return new BPromise(function(_0x5e2f22,_0x38aa61){return client['request'](_0x185589,_0x1a29f9)[_0x9982('0xb')](function(_0x58a141){logger[_0x9982('0xc')](_0x9982('0xd'),_0xda49dc,'request\x20sent');logger[_0x9982('0xe')](_0x9982('0xf'),_0xda49dc,_0x9982('0x10'),JSON[_0x9982('0x11')](_0x58a141));if(_0x58a141[_0x9982('0x12')]){if(_0x58a141[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0xda49dc,_0x58a141['error'][_0x9982('0x14')]);return _0x38aa61(_0x58a141[_0x9982('0x12')][_0x9982('0x14')]);}logger[_0x9982('0x12')](_0x9982('0xd'),_0xda49dc,_0x58a141[_0x9982('0x12')][_0x9982('0x14')]);return _0x5e2f22(_0x58a141[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0xda49dc,_0x9982('0x10'));_0x5e2f22(_0x58a141[_0x9982('0x15')]['message']);}})['catch'](function(_0x1288b1){logger[_0x9982('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0xda49dc,_0x1288b1);_0x38aa61(_0x1288b1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 921932f..d89ebfd 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 _0xe0b3=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe0b3,0x1cd));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3e0b('0x0'));var util=require(_0x3e0b('0x1'));var path=require('path');var timeout=require(_0x3e0b('0x2'));var express=require(_0x3e0b('0x3'));var router=express[_0x3e0b('0x4')]();var auth=require(_0x3e0b('0x5'));var interaction=require(_0x3e0b('0x6'));var config=require(_0x3e0b('0x7'));module[_0x3e0b('0x8')]=router; \ No newline at end of file +var _0x8d24=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x351024,_0x448c04){var _0x58de06=function(_0x44a210){while(--_0x44a210){_0x351024['push'](_0x351024['shift']());}};_0x58de06(++_0x448c04);}(_0x8d24,0x18e));var _0x48d2=function(_0x5cbab1,_0x32afac){_0x5cbab1=_0x5cbab1-0x0;var _0x2637f4=_0x8d24[_0x5cbab1];return _0x2637f4;};'use strict';var multer=require('multer');var util=require(_0x48d2('0x0'));var path=require(_0x48d2('0x1'));var timeout=require(_0x48d2('0x2'));var express=require(_0x48d2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x48d2('0x4'));var config=require(_0x48d2('0x5'));module[_0x48d2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index aeb1188..76cc9c5 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 _0x7282=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x7282,0x1a8));var _0x2728=function(_0x4c11fb,_0x32dbc0){_0x4c11fb=_0x4c11fb-0x0;var _0x4caf73=_0x7282[_0x4c11fb];return _0x4caf73;};'use strict';var Sequelize=require(_0x2728('0x0'));module[_0x2728('0x1')]={'uniqueid':{'type':Sequelize[_0x2728('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2728('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x2728('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x2728('0x3')},'penalty':{'type':Sequelize[_0x2728('0x2')](0xb),'defaultValue':0x0,'comment':_0x2728('0x3')},'paused':{'type':Sequelize[_0x2728('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xc3d0=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x291548,_0xb2843d){var _0x3247d3=function(_0x5369de){while(--_0x5369de){_0x291548['push'](_0x291548['shift']());}};_0x3247d3(++_0xb2843d);}(_0xc3d0,0xce));var _0x0c3d=function(_0x411663,_0x54f4cf){_0x411663=_0x411663-0x0;var _0x344154=_0xc3d0[_0x411663];return _0x344154;};'use strict';var Sequelize=require('sequelize');module[_0x0c3d('0x0')]={'uniqueid':{'type':Sequelize[_0x0c3d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0c3d('0x2')},'membername':{'type':Sequelize[_0x0c3d('0x3')],'allowNull':![],'comment':_0x0c3d('0x2')},'UserId':{'type':Sequelize[_0x0c3d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0c3d('0x4'),'comment':_0x0c3d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0c3d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0c3d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0c3d('0x2')},'penalty':{'type':Sequelize[_0x0c3d('0x1')](0xb),'defaultValue':0x0,'comment':_0x0c3d('0x2')},'paused':{'type':Sequelize[_0x0c3d('0x1')](0xb),'defaultValue':0x0,'comment':_0x0c3d('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7d052b0..3a5e55f 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 _0x0523=['update','emit','hook','exports','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x5bd30e,_0x1cf617){var _0x52f137=function(_0x4ff05b){while(--_0x4ff05b){_0x5bd30e['push'](_0x5bd30e['shift']());}};_0x52f137(++_0x1cf617);}(_0x0523,0xeb));var _0x3052=function(_0x13f3c0,_0x1f4383){_0x13f3c0=_0x13f3c0-0x0;var _0x5c3227=_0x0523[_0x13f3c0];return _0x5c3227;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x3052('0x0'))['db'][_0x3052('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3052('0x2'),'afterUpdate':_0x3052('0x3'),'afterDestroy':'remove'};function emitEvent(_0x338973){return function(_0x1a94da,_0x412f15,_0x4c4959){UserVoiceQueueRtEvents['emit'](_0x338973+':'+_0x1a94da['id'],_0x1a94da);UserVoiceQueueRtEvents[_0x3052('0x4')](_0x338973,_0x1a94da);_0x4c4959(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3052('0x5')](e,emitEvent(event));}}module[_0x3052('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3109=['exports','events','setMaxListeners','update','remove','emit','hook'];(function(_0x5f34d6,_0x4523dd){var _0x28def7=function(_0x1d7931){while(--_0x1d7931){_0x5f34d6['push'](_0x5f34d6['shift']());}};_0x28def7(++_0x4523dd);}(_0x3109,0x189));var _0x9310=function(_0x57cea3,_0x167642){_0x57cea3=_0x57cea3-0x0;var _0x8c1581=_0x3109[_0x57cea3];return _0x8c1581;};'use strict';var EventEmitter=require(_0x9310('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9310('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9310('0x2'),'afterDestroy':_0x9310('0x3')};function emitEvent(_0x40f3bc){return function(_0x38f334,_0x251c01,_0x553e46){UserVoiceQueueRtEvents[_0x9310('0x4')](_0x40f3bc+':'+_0x38f334['id'],_0x38f334);UserVoiceQueueRtEvents[_0x9310('0x4')](_0x40f3bc,_0x38f334);_0x553e46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x9310('0x5')](e,emitEvent(event));}}module[_0x9310('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5e00032..ca57a01 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 _0x08ca=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4cc7ac,_0x21f28b){var _0x23b9ff=function(_0x2fcbac){while(--_0x2fcbac){_0x4cc7ac['push'](_0x4cc7ac['shift']());}};_0x23b9ff(++_0x21f28b);}(_0x08ca,0xdf));var _0xa08c=function(_0x5c8b3f,_0x19ed9e){_0x5c8b3f=_0x5c8b3f-0x0;var _0x527ded=_0x08ca[_0x5c8b3f];return _0x527ded;};'use strict';var _=require(_0xa08c('0x0'));var util=require(_0xa08c('0x1'));var logger=require(_0xa08c('0x2'))(_0xa08c('0x3'));var moment=require(_0xa08c('0x4'));var BPromise=require(_0xa08c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa08c('0x6'));var rimraf=require(_0xa08c('0x7'));var config=require('../../config/environment');var attributes=require(_0xa08c('0x8'));module[_0xa08c('0x9')]=function(_0xac8d4a,_0x49b257){return _0xac8d4a['define'](_0xa08c('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d82=['api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x4e0245,_0x343bab){var _0x2fbfd7=function(_0x18a7a0){while(--_0x18a7a0){_0x4e0245['push'](_0x4e0245['shift']());}};_0x2fbfd7(++_0x343bab);}(_0x2d82,0x1de));var _0x22d8=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x2d82[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x22d8('0x0'));var util=require('util');var logger=require(_0x22d8('0x1'))(_0x22d8('0x2'));var moment=require(_0x22d8('0x3'));var BPromise=require(_0x22d8('0x4'));var rp=require(_0x22d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x22d8('0x6'));var attributes=require(_0x22d8('0x7'));module[_0x22d8('0x8')]=function(_0x365a60,_0x1054bb){return _0x365a60[_0x22d8('0x9')](_0x22d8('0xa'),attributes,{'tableName':_0x22d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 15b8b16..1b3283c 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 _0xbba3=['GetVoiceQueueRtPauses','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','sequelize','literal','outboundQueuePauses'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0xbba3,0x11a));var _0x3bba=function(_0x26d59f,_0x252fb5){_0x26d59f=_0x26d59f-0x0;var _0x48a594=_0xbba3[_0x26d59f];return _0x48a594;};'use strict';var _=require('lodash');var util=require(_0x3bba('0x0'));var moment=require(_0x3bba('0x1'));var BPromise=require(_0x3bba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bba('0x3'));var db=require(_0x3bba('0x4'))['db'];var utils=require(_0x3bba('0x5'));var logger=require(_0x3bba('0x6'))('rpc');var config=require(_0x3bba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3bba('0x8')][_0x3bba('0x9')]({'port':0x232a});config[_0x3bba('0xa')]=_[_0x3bba('0xb')](config['redis'],{'host':_0x3bba('0xc'),'port':0x18eb});var socket=require(_0x3bba('0xd'))(new Redis(config[_0x3bba('0xa')]));require('./userVoiceQueueRt.socket')[_0x3bba('0xe')](socket);function respondWithRpcPromise(_0x185db3,_0x5a8122,_0x2a631f){return new BPromise(function(_0x33d747,_0x50c3d7){return client[_0x3bba('0xf')](_0x185db3,_0x2a631f)[_0x3bba('0x10')](function(_0x53b648){logger[_0x3bba('0x11')](_0x3bba('0x12'),_0x5a8122,'request\x20sent');logger[_0x3bba('0x13')](_0x3bba('0x14'),_0x5a8122,_0x3bba('0x15'),JSON['stringify'](_0x53b648));if(_0x53b648['error']){if(_0x53b648[_0x3bba('0x16')][_0x3bba('0x17')]===0x1f4){logger['error'](_0x3bba('0x12'),_0x5a8122,_0x53b648['error'][_0x3bba('0x18')]);return _0x50c3d7(_0x53b648['error'][_0x3bba('0x18')]);}logger['error'](_0x3bba('0x12'),_0x5a8122,_0x53b648[_0x3bba('0x16')][_0x3bba('0x18')]);return _0x33d747(_0x53b648[_0x3bba('0x16')][_0x3bba('0x18')]);}else{logger[_0x3bba('0x11')](_0x3bba('0x12'),_0x5a8122,_0x3bba('0x15'));_0x33d747(_0x53b648[_0x3bba('0x19')]['message']);}})[_0x3bba('0x1a')](function(_0x5e2ce4){logger[_0x3bba('0x16')](_0x3bba('0x12'),_0x5a8122,_0x5e2ce4);_0x50c3d7(_0x5e2ce4);});});}exports['GetVoiceQueueRtPauses']=function(_0x1f85b1){var _0x219d84=this;return new Promise(function(_0x5b7423,_0x3d74cb){return db[_0x3bba('0x1b')][_0x3bba('0x1c')]({'raw':_0x1f85b1[_0x3bba('0x1d')]?_0x1f85b1[_0x3bba('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1f85b1[_0x3bba('0x1d')]?_0x1f85b1[_0x3bba('0x1d')]['where']||null:null,'attributes':[[db[_0x3bba('0x1e')]['fn']('COUNT',db[_0x3bba('0x1e')]['fn']('IF',db[_0x3bba('0x1e')][_0x3bba('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0x3bba('0x20')]]})[_0x3bba('0x10')](function(_0xe0e920){logger['info']('GetVoiceQueueRtPauses',_0x1f85b1);logger['debug'](_0x3bba('0x21'),_0x1f85b1,JSON[_0x3bba('0x22')](_0xe0e920));_0x5b7423(_0xe0e920);})[_0x3bba('0x1a')](function(_0x1cf3f0){logger[_0x3bba('0x16')](_0x3bba('0x21'),_0x1cf3f0['message'],_0x1f85b1);_0x3d74cb(_0x219d84[_0x3bba('0x16')](0x1f4,_0x1cf3f0[_0x3bba('0x18')]));});});}; \ No newline at end of file +var _0xfc93=['options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x5f8bb6,_0x38a5b4){var _0xb2f6b1=function(_0x45c2ad){while(--_0x45c2ad){_0x5f8bb6['push'](_0x5f8bb6['shift']());}};_0xb2f6b1(++_0x38a5b4);}(_0xfc93,0x1dd));var _0x3fc9=function(_0xd65923,_0x1f2633){_0xd65923=_0xd65923-0x0;var _0xdd1150=_0xfc93[_0xd65923];return _0xdd1150;};'use strict';var _=require('lodash');var util=require(_0x3fc9('0x0'));var moment=require(_0x3fc9('0x1'));var BPromise=require(_0x3fc9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc9('0x3'));var db=require(_0x3fc9('0x4'))['db'];var utils=require(_0x3fc9('0x5'));var logger=require(_0x3fc9('0x6'))('rpc');var config=require(_0x3fc9('0x7'));var jayson=require(_0x3fc9('0x8'));var client=jayson[_0x3fc9('0x9')][_0x3fc9('0xa')]({'port':0x232a});config[_0x3fc9('0xb')]=_['defaults'](config[_0x3fc9('0xb')],{'host':_0x3fc9('0xc'),'port':0x18eb});var socket=require(_0x3fc9('0xd'))(new Redis(config[_0x3fc9('0xb')]));require(_0x3fc9('0xe'))['register'](socket);function respondWithRpcPromise(_0x1bc3a0,_0x4ab266,_0x50ccf8){return new BPromise(function(_0x89b8d1,_0xda6429){return client['request'](_0x1bc3a0,_0x50ccf8)['then'](function(_0x1850ed){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ab266,_0x3fc9('0xf'));logger[_0x3fc9('0x10')](_0x3fc9('0x11'),_0x4ab266,'request\x20sent',JSON['stringify'](_0x1850ed));if(_0x1850ed[_0x3fc9('0x12')]){if(_0x1850ed[_0x3fc9('0x12')][_0x3fc9('0x13')]===0x1f4){logger[_0x3fc9('0x12')](_0x3fc9('0x14'),_0x4ab266,_0x1850ed[_0x3fc9('0x12')][_0x3fc9('0x15')]);return _0xda6429(_0x1850ed[_0x3fc9('0x12')][_0x3fc9('0x15')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ab266,_0x1850ed[_0x3fc9('0x12')][_0x3fc9('0x15')]);return _0x89b8d1(_0x1850ed[_0x3fc9('0x12')][_0x3fc9('0x15')]);}else{logger[_0x3fc9('0x16')](_0x3fc9('0x14'),_0x4ab266,_0x3fc9('0xf'));_0x89b8d1(_0x1850ed['result'][_0x3fc9('0x15')]);}})[_0x3fc9('0x17')](function(_0xfbca89){logger[_0x3fc9('0x12')](_0x3fc9('0x14'),_0x4ab266,_0xfbca89);_0xda6429(_0xfbca89);});});}exports[_0x3fc9('0x18')]=function(_0x21e9dd){var _0x300e79=this;return new Promise(function(_0x57dc4f,_0x335c57){return db[_0x3fc9('0x19')][_0x3fc9('0x1a')]({'raw':_0x21e9dd[_0x3fc9('0x1b')]?_0x21e9dd[_0x3fc9('0x1b')][_0x3fc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x21e9dd['options']?_0x21e9dd[_0x3fc9('0x1b')][_0x3fc9('0x1d')]||null:null,'attributes':[[db[_0x3fc9('0x1e')]['fn']('COUNT',db[_0x3fc9('0x1e')]['fn']('IF',db[_0x3fc9('0x1e')][_0x3fc9('0x1f')](_0x3fc9('0x20')))),_0x3fc9('0x21')]]})[_0x3fc9('0x22')](function(_0x3c2bfc){logger['info'](_0x3fc9('0x18'),_0x21e9dd);logger[_0x3fc9('0x10')](_0x3fc9('0x18'),_0x21e9dd,JSON[_0x3fc9('0x23')](_0x3c2bfc));_0x57dc4f(_0x3c2bfc);})[_0x3fc9('0x17')](function(_0x121c1d){logger[_0x3fc9('0x12')](_0x3fc9('0x18'),_0x121c1d[_0x3fc9('0x15')],_0x21e9dd);_0x335c57(_0x300e79[_0x3fc9('0x12')](0x1f4,_0x121c1d[_0x3fc9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c453c87..751a657 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 _0xce11=['remove','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x57d54f,_0x137354){var _0x582c9f=function(_0x44b882){while(--_0x44b882){_0x57d54f['push'](_0x57d54f['shift']());}};_0x582c9f(++_0x137354);}(_0xce11,0x140));var _0x1ce1=function(_0x1bee4e,_0x56251a){_0x1bee4e=_0x1bee4e-0x0;var _0x50823a=_0xce11[_0x1bee4e];return _0x50823a;};'use strict';var UserVoiceQueueRtEvents=require(_0x1ce1('0x0'));var events=[_0x1ce1('0x1'),_0x1ce1('0x2'),'update'];function createListener(_0xaedbfd,_0x23ccb6){return function(_0x232970){_0x23ccb6[_0x1ce1('0x3')](_0xaedbfd,_0x232970);};}function removeListener(_0x1465a8,_0x5d8390){return function(){UserVoiceQueueRtEvents[_0x1ce1('0x4')](_0x1465a8,_0x5d8390);};}exports[_0x1ce1('0x5')]=function(_0x380db9){for(var _0x24a81f=0x0,_0x1e8697=events['length'];_0x24a81f<_0x1e8697;_0x24a81f++){var _0x5c56cc=events[_0x24a81f];var _0x54ddaf=createListener(_0x1ce1('0x6')+_0x5c56cc,_0x380db9);UserVoiceQueueRtEvents['on'](_0x5c56cc,_0x54ddaf);}}; \ No newline at end of file +var _0x1770=['remove','update','emit','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x29db71,_0x306de1){var _0x2c8a07=function(_0x38f0f9){while(--_0x38f0f9){_0x29db71['push'](_0x29db71['shift']());}};_0x2c8a07(++_0x306de1);}(_0x1770,0xad));var _0x0177=function(_0x484c37,_0x1abc7f){_0x484c37=_0x484c37-0x0;var _0x39b822=_0x1770[_0x484c37];return _0x39b822;};'use strict';var UserVoiceQueueRtEvents=require(_0x0177('0x0'));var events=[_0x0177('0x1'),_0x0177('0x2'),_0x0177('0x3')];function createListener(_0x18df91,_0x2cfc71){return function(_0x538b75){_0x2cfc71[_0x0177('0x4')](_0x18df91,_0x538b75);};}function removeListener(_0x247543,_0x539e8a){return function(){UserVoiceQueueRtEvents['removeListener'](_0x247543,_0x539e8a);};}exports[_0x0177('0x5')]=function(_0x5e3d50){for(var _0x5c2f4a=0x0,_0x1ebed7=events['length'];_0x5c2f4a<_0x1ebed7;_0x5c2f4a++){var _0x53d529=events[_0x5c2f4a];var _0x5a429e=createListener(_0x0177('0x6')+_0x53d529,_0x5e3d50);UserVoiceQueueRtEvents['on'](_0x53d529,_0x5a429e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2ac920b..2905591 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 _0x8562=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','exports'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x8562,0x1d4));var _0x2856=function(_0x11b538,_0x3d8dbb){_0x11b538=_0x11b538-0x0;var _0x56f750=_0x8562[_0x11b538];return _0x56f750;};'use strict';var multer=require('multer');var util=require(_0x2856('0x0'));var path=require('path');var timeout=require(_0x2856('0x1'));var express=require(_0x2856('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2856('0x3'));var config=require(_0x2856('0x4'));module[_0x2856('0x5')]=router; \ No newline at end of file +var _0x967c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x967c,0x1da));var _0xc967=function(_0x586549,_0x14a76c){_0x586549=_0x586549-0x0;var _0x563c8d=_0x967c[_0x586549];return _0x563c8d;};'use strict';var multer=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var path=require(_0xc967('0x2'));var timeout=require(_0xc967('0x3'));var express=require(_0xc967('0x4'));var router=express[_0xc967('0x5')]();var auth=require(_0xc967('0x6'));var interaction=require(_0xc967('0x7'));var config=require(_0xc967('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e700d52..7ae5e9f 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 _0xd8b0=['exports','sequelize'];(function(_0xde12cd,_0x269a1f){var _0x93a6e2=function(_0x4b5236){while(--_0x4b5236){_0xde12cd['push'](_0xde12cd['shift']());}};_0x93a6e2(++_0x269a1f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5158ef,_0x5033fa){var _0x459bed=function(_0x1534f8){while(--_0x1534f8){_0x5158ef['push'](_0x5158ef['shift']());}};_0x459bed(++_0x5033fa);}(_0xe706,0xa3));var _0x6e70=function(_0x480c83,_0x1f8665){_0x480c83=_0x480c83-0x0;var _0x3368e0=_0xe706[_0x480c83];return _0x3368e0;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index bce93eb..47038f0 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 _0x757a=['define','user_has_whatsapp_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x46e1b0,_0x145a6d){var _0x31520a=function(_0x12b7bd){while(--_0x12b7bd){_0x46e1b0['push'](_0x46e1b0['shift']());}};_0x31520a(++_0x145a6d);}(_0x757a,0xde));var _0xa757=function(_0x54ace8,_0x12d866){_0x54ace8=_0x54ace8-0x0;var _0x766c77=_0x757a[_0x54ace8];return _0x766c77;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373d=['define','UserWhatsappQueue','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x373d,0x1e2));var _0xd373=function(_0x2a37a4,_0x464b98){_0x2a37a4=_0x2a37a4-0x0;var _0x29d935=_0x373d[_0x2a37a4];return _0x29d935;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 974851d..b24c87e 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(_0xbf844b,_0x5f58ca){var _0x4169b3=function(_0x125844){while(--_0x125844){_0xbf844b['push'](_0xbf844b['shift']());}};_0x4169b3(++_0x5f58ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x25cb6f,_0x22b4d6){var _0x5144e6=function(_0x13cfe8){while(--_0x13cfe8){_0x25cb6f['push'](_0x25cb6f['shift']());}};_0x5144e6(++_0x22b4d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 ca9eb63..c997651 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 _0xef0a=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xef0a,0x132));var _0xaef0=function(_0x1a2781,_0x313a6c){_0x1a2781=_0x1a2781-0x0;var _0x18c449=_0xef0a[_0x1a2781];return _0x18c449;};'use strict';var multer=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaef0('0x2')]();var auth=require(_0xaef0('0x3'));var interaction=require(_0xaef0('0x4'));var config=require(_0xaef0('0x5'));var controller=require(_0xaef0('0x6'));router[_0xaef0('0x7')]('/',auth[_0xaef0('0x8')](),controller['index']);router[_0xaef0('0x7')](_0xaef0('0x9'),auth[_0xaef0('0x8')](),controller[_0xaef0('0xa')]);router[_0xaef0('0xb')]('/',auth[_0xaef0('0x8')](),controller['create']);router[_0xaef0('0xc')](_0xaef0('0x9'),auth[_0xaef0('0x8')](),controller[_0xaef0('0xd')]);router[_0xaef0('0xe')](_0xaef0('0x9'),auth['isAuthenticated'](),controller[_0xaef0('0xf')]);module[_0xaef0('0x10')]=router; \ No newline at end of file +var _0xd51d=['put','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post'];(function(_0x33e89b,_0xeca411){var _0x125649=function(_0x1e614b){while(--_0x1e614b){_0x33e89b['push'](_0x33e89b['shift']());}};_0x125649(++_0xeca411);}(_0xd51d,0x16c));var _0xdd51=function(_0x26b23c,_0x5ed2e3){_0x26b23c=_0x26b23c-0x0;var _0x12fcb3=_0xd51d[_0x26b23c];return _0x12fcb3;};'use strict';var multer=require(_0xdd51('0x0'));var util=require(_0xdd51('0x1'));var path=require(_0xdd51('0x2'));var timeout=require(_0xdd51('0x3'));var express=require(_0xdd51('0x4'));var router=express['Router']();var auth=require(_0xdd51('0x5'));var interaction=require(_0xdd51('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xdd51('0x7')]('/',auth[_0xdd51('0x8')](),controller[_0xdd51('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdd51('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd51('0xb')](_0xdd51('0xc'),auth[_0xdd51('0x8')](),controller['update']);router['delete'](_0xdd51('0xc'),auth[_0xdd51('0x8')](),controller[_0xdd51('0xd')]);module[_0xdd51('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f13f553..d39a3d3 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 _0xe5eb=['name','exports','STRING'];(function(_0x419373,_0x36b4e8){var _0x56bdd9=function(_0x1a6ab7){while(--_0x1a6ab7){_0x419373['push'](_0x419373['shift']());}};_0x56bdd9(++_0x36b4e8);}(_0xe5eb,0x1ae));var _0xbe5e=function(_0x4a40f6,_0x6b2919){_0x4a40f6=_0x4a40f6-0x0;var _0x227af5=_0xe5eb[_0x4a40f6];return _0x227af5;};'use strict';var Sequelize=require('sequelize');module[_0xbe5e('0x0')]={'name':{'type':Sequelize[_0xbe5e('0x1')],'unique':_0xbe5e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9a9=['name','exports','STRING'];(function(_0x129959,_0x33083d){var _0x2279f5=function(_0x46cefa){while(--_0x46cefa){_0x129959['push'](_0x129959['shift']());}};_0x2279f5(++_0x33083d);}(_0xa9a9,0x1a5));var _0x9a9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa9a9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x9a9a('0x0')]={'name':{'type':Sequelize[_0x9a9a('0x1')],'unique':_0x9a9a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9a9a('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cc19c50..26e1117 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 _0x7999=['util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','include','catch','show','params','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x41d8f,_0x24ae01){var _0x19d1ee=function(_0x145cb4){while(--_0x145cb4){_0x41d8f['push'](_0x41d8f['shift']());}};_0x19d1ee(++_0x24ae01);}(_0x7999,0x9a));var _0x9799=function(_0x500861,_0x488886){_0x500861=_0x500861-0x0;var _0x3919fd=_0x7999[_0x500861];return _0x3919fd;};'use strict';var pdf=require(_0x9799('0x0'));var emlformat=require(_0x9799('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9799('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9799('0x3'));var BPromise=require(_0x9799('0x4'));var Mustache=require(_0x9799('0x5'));var util=require(_0x9799('0x6'));var path=require(_0x9799('0x7'));var sox=require('sox');var csv=require(_0x9799('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9799('0x9'));var squel=require(_0x9799('0xa'));var crypto=require(_0x9799('0xb'));var jsforce=require(_0x9799('0xc'));var deskjs=require(_0x9799('0xd'));var toCsv=require(_0x9799('0x8'));var querystring=require(_0x9799('0xe'));var Papa=require(_0x9799('0xf'));var Redis=require(_0x9799('0x10'));var authService=require(_0x9799('0x11'));var qs=require(_0x9799('0x12'));var as=require(_0x9799('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9799('0x14'))(_0x9799('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9799('0x16'))['db'];function respondWithStatusCode(_0x3d2602,_0x2cda35){_0x2cda35=_0x2cda35||0xcc;return function(_0x5556ee){if(_0x5556ee){return _0x3d2602[_0x9799('0x17')](_0x2cda35);}return _0x3d2602[_0x9799('0x18')](_0x2cda35)[_0x9799('0x19')]();};}function respondWithResult(_0x52c1e1,_0x2af4fd){_0x2af4fd=_0x2af4fd||0xc8;return function(_0x345267){if(_0x345267){return _0x52c1e1[_0x9799('0x18')](_0x2af4fd)[_0x9799('0x1a')](_0x345267);}};}function respondWithFilteredResult(_0x5a651f,_0x389406){return function(_0x4c5560){if(_0x4c5560){var _0x2e949c=_0x4c5560[_0x9799('0x1b')],_0x3ffb05=_0x389406[_0x9799('0x1c')],_0x4ef7fd=_0x389406[_0x9799('0x1c')]+_0x389406[_0x9799('0x1d')],_0x4fde4e;if(_0x4ef7fd>=_0x2e949c){_0x4ef7fd=_0x2e949c;_0x4fde4e=0xc8;}else{_0x4fde4e=0xce;}_0x5a651f['status'](_0x4fde4e);return _0x5a651f['set']('Content-Range',_0x3ffb05+'-'+_0x4ef7fd+'/'+_0x2e949c)[_0x9799('0x1a')](_0x4c5560);}return null;};}function patchUpdates(_0x599cfc){return function(_0x419f45){try{jsonpatch[_0x9799('0x1e')](_0x419f45,_0x599cfc,!![]);}catch(_0x28af34){return BPromise[_0x9799('0x1f')](_0x28af34);}return _0x419f45[_0x9799('0x20')]();};}function saveUpdates(_0x5048aa,_0x252039){return function(_0xdf34b1){if(_0xdf34b1){return _0xdf34b1['update'](_0x5048aa)[_0x9799('0x21')](function(_0x206081){return _0x206081;});}return null;};}function removeEntity(_0x51e9ce,_0x4eee48){return function(_0x4f7c1f){if(_0x4f7c1f){return _0x4f7c1f[_0x9799('0x22')]()[_0x9799('0x21')](function(){var _0x214843=_0x4f7c1f[_0x9799('0x23')]({'plain':!![]});var _0x2ee4dd='Variables';return db[_0x9799('0x24')]['destroy']({'where':{'type':_0x2ee4dd,'resourceId':_0x214843['id']}})[_0x9799('0x21')](function(){return _0x4f7c1f;});})['then'](function(){_0x51e9ce['status'](0xcc)[_0x9799('0x19')]();});}};}function handleEntityNotFound(_0x4307a8,_0x5a3914){return function(_0x33aab6){if(!_0x33aab6){_0x4307a8[_0x9799('0x17')](0x194);}return _0x33aab6;};}function handleError(_0x3d1619,_0x213c79){_0x213c79=_0x213c79||0x1f4;return function(_0x14ab76){logger[_0x9799('0x25')](_0x14ab76[_0x9799('0x26')]);if(_0x14ab76['name']){delete _0x14ab76[_0x9799('0x27')];}_0x3d1619['status'](_0x213c79)[_0x9799('0x28')](_0x14ab76);};}exports['index']=function(_0x4b6e1f,_0x5dde57){var _0x1d361a={},_0x2b3e50={},_0x58ecf6={'count':0x0,'rows':[]};var _0x5cb609=_['map'](db['Variable'][_0x9799('0x29')],function(_0x433046){return{'name':_0x433046['fieldName'],'type':_0x433046[_0x9799('0x2a')][_0x9799('0x2b')]};});_0x2b3e50[_0x9799('0x2c')]=_[_0x9799('0x2d')](_0x5cb609,_0x9799('0x27'));_0x2b3e50[_0x9799('0x2e')]=_['keys'](_0x4b6e1f[_0x9799('0x2e')]);_0x2b3e50[_0x9799('0x2f')]=_[_0x9799('0x30')](_0x2b3e50['model'],_0x2b3e50[_0x9799('0x2e')]);_0x1d361a['attributes']=_['intersection'](_0x2b3e50['model'],qs['fields'](_0x4b6e1f[_0x9799('0x2e')][_0x9799('0x31')]));_0x1d361a[_0x9799('0x32')]=_0x1d361a[_0x9799('0x32')]['length']?_0x1d361a[_0x9799('0x32')]:_0x2b3e50[_0x9799('0x2c')];if(!_0x4b6e1f[_0x9799('0x2e')][_0x9799('0x33')](_0x9799('0x34'))){_0x1d361a[_0x9799('0x1d')]=qs[_0x9799('0x1d')](_0x4b6e1f[_0x9799('0x2e')][_0x9799('0x1d')]);_0x1d361a[_0x9799('0x1c')]=qs[_0x9799('0x1c')](_0x4b6e1f[_0x9799('0x2e')][_0x9799('0x1c')]);}_0x1d361a[_0x9799('0x35')]=qs[_0x9799('0x36')](_0x4b6e1f['query']['sort']);_0x1d361a[_0x9799('0x37')]=qs['filters'](_[_0x9799('0x38')](_0x4b6e1f[_0x9799('0x2e')],_0x2b3e50['filters']),_0x5cb609);if(_0x4b6e1f[_0x9799('0x2e')][_0x9799('0x39')]){_0x1d361a[_0x9799('0x37')]=_[_0x9799('0x3a')](_0x1d361a['where'],{'$or':_['map'](_0x5cb609,function(_0x525784){if(_0x525784[_0x9799('0x2a')]!==_0x9799('0x3b')){var _0x168143={};_0x168143[_0x525784[_0x9799('0x27')]]={'$like':'%'+_0x4b6e1f[_0x9799('0x2e')]['filter']+'%'};return _0x168143;}})});}_0x1d361a=_[_0x9799('0x3a')]({},_0x1d361a,_0x4b6e1f[_0x9799('0x3c')]);var _0xe68c35={'where':_0x1d361a['where']};return db[_0x9799('0x3d')][_0x9799('0x1b')](_0xe68c35)[_0x9799('0x21')](function(_0x2885ac){_0x58ecf6['count']=_0x2885ac;if(_0x4b6e1f[_0x9799('0x2e')]['includeAll']){_0x1d361a[_0x9799('0x3e')]=[{'all':!![]}];}return db[_0x9799('0x3d')]['findAll'](_0x1d361a);})[_0x9799('0x21')](function(_0x38e370){_0x58ecf6['rows']=_0x38e370;return _0x58ecf6;})[_0x9799('0x21')](respondWithFilteredResult(_0x5dde57,_0x1d361a))[_0x9799('0x3f')](handleError(_0x5dde57,null));};exports[_0x9799('0x40')]=function(_0xfa1cb1,_0x2acad9){var _0x12c295={'raw':!![],'where':{'id':_0xfa1cb1[_0x9799('0x41')]['id']}},_0x5f1cae={};_0x5f1cae[_0x9799('0x2c')]=_[_0x9799('0x42')](db[_0x9799('0x3d')][_0x9799('0x29')]);_0x5f1cae[_0x9799('0x2e')]=_[_0x9799('0x42')](_0xfa1cb1[_0x9799('0x2e')]);_0x5f1cae[_0x9799('0x2f')]=_[_0x9799('0x30')](_0x5f1cae[_0x9799('0x2c')],_0x5f1cae[_0x9799('0x2e')]);_0x12c295[_0x9799('0x32')]=_['intersection'](_0x5f1cae[_0x9799('0x2c')],qs['fields'](_0xfa1cb1[_0x9799('0x2e')][_0x9799('0x31')]));_0x12c295[_0x9799('0x32')]=_0x12c295['attributes'][_0x9799('0x43')]?_0x12c295[_0x9799('0x32')]:_0x5f1cae[_0x9799('0x2c')];if(_0xfa1cb1[_0x9799('0x2e')][_0x9799('0x44')]){_0x12c295[_0x9799('0x3e')]=[{'all':!![]}];}_0x12c295=_['merge']({},_0x12c295,_0xfa1cb1[_0x9799('0x3c')]);return db[_0x9799('0x3d')][_0x9799('0x45')](_0x12c295)[_0x9799('0x21')](handleEntityNotFound(_0x2acad9,null))[_0x9799('0x21')](respondWithResult(_0x2acad9,null))['catch'](handleError(_0x2acad9,null));};exports[_0x9799('0x46')]=function(_0x2cf015,_0x173cfd){return db[_0x9799('0x3d')]['create'](_0x2cf015[_0x9799('0x47')],{})[_0x9799('0x21')](function(_0x20a5a8){var _0xc84c95=_0x2cf015[_0x9799('0x48')][_0x9799('0x23')]({'plain':!![]});if(!_0xc84c95)throw new Error(_0x9799('0x49'));if(_0xc84c95[_0x9799('0x4a')]==='user'){var _0xe31c2f=_0x20a5a8[_0x9799('0x23')]({'plain':!![]});var _0x35001d=_0x9799('0x4b');return db['UserProfileSection'][_0x9799('0x45')]({'where':{'name':_0x35001d,'userProfileId':_0xc84c95[_0x9799('0x4c')]},'raw':!![]})[_0x9799('0x21')](function(_0x39b9eb){if(_0x39b9eb&&_0x39b9eb[_0x9799('0x4d')]===0x0){return db[_0x9799('0x24')][_0x9799('0x46')]({'name':_0xe31c2f[_0x9799('0x27')],'resourceId':_0xe31c2f['id'],'type':_0x39b9eb[_0x9799('0x27')],'sectionId':_0x39b9eb['id']},{})[_0x9799('0x21')](function(){return _0x20a5a8;});}else{return _0x20a5a8;}})[_0x9799('0x3f')](function(_0x3e7d3c){logger[_0x9799('0x25')](_0x9799('0x4e'),_0x3e7d3c);throw _0x3e7d3c;});}return _0x20a5a8;})['then'](respondWithResult(_0x173cfd,0xc9))[_0x9799('0x3f')](handleError(_0x173cfd,null));};exports[_0x9799('0x4f')]=function(_0x3d71f3,_0x3c8ce7){if(_0x3d71f3[_0x9799('0x47')]['id']){delete _0x3d71f3['body']['id'];}return db['Variable'][_0x9799('0x45')]({'where':{'id':_0x3d71f3[_0x9799('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c8ce7,null))[_0x9799('0x21')](saveUpdates(_0x3d71f3['body'],null))[_0x9799('0x21')](respondWithResult(_0x3c8ce7,null))[_0x9799('0x3f')](handleError(_0x3c8ce7,null));};exports[_0x9799('0x22')]=function(_0x25a868,_0x391df8){return db[_0x9799('0x3d')][_0x9799('0x45')]({'where':{'id':_0x25a868[_0x9799('0x41')]['id']}})[_0x9799('0x21')](handleEntityNotFound(_0x391df8,null))[_0x9799('0x21')](removeEntity(_0x391df8,null))[_0x9799('0x3f')](handleError(_0x391df8,null));}; \ No newline at end of file +var _0x9987=['rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','then','destroy','get','Variables','error','stack','name','send','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9987,0x1a1));var _0x7998=function(_0x52404c,_0xd02c10){_0x52404c=_0x52404c-0x0;var _0x3b47bb=_0x9987[_0x52404c];return _0x3b47bb;};'use strict';var pdf=require(_0x7998('0x0'));var emlformat=require(_0x7998('0x1'));var rimraf=require(_0x7998('0x2'));var zipdir=require(_0x7998('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7998('0x4'));var moment=require(_0x7998('0x5'));var BPromise=require(_0x7998('0x6'));var Mustache=require('mustache');var util=require(_0x7998('0x7'));var path=require(_0x7998('0x8'));var sox=require(_0x7998('0x9'));var csv=require(_0x7998('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7998('0xb'));var squel=require(_0x7998('0xc'));var crypto=require(_0x7998('0xd'));var jsforce=require(_0x7998('0xe'));var deskjs=require(_0x7998('0xf'));var toCsv=require(_0x7998('0xa'));var querystring=require(_0x7998('0x10'));var Papa=require(_0x7998('0x11'));var Redis=require(_0x7998('0x12'));var authService=require(_0x7998('0x13'));var qs=require(_0x7998('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7998('0x15'));var logger=require(_0x7998('0x16'))(_0x7998('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7998('0x18'));var db=require(_0x7998('0x19'))['db'];function respondWithStatusCode(_0x10f390,_0x19d393){_0x19d393=_0x19d393||0xcc;return function(_0x207570){if(_0x207570){return _0x10f390[_0x7998('0x1a')](_0x19d393);}return _0x10f390[_0x7998('0x1b')](_0x19d393)[_0x7998('0x1c')]();};}function respondWithResult(_0x28dd33,_0x76b1d){_0x76b1d=_0x76b1d||0xc8;return function(_0x22e216){if(_0x22e216){return _0x28dd33[_0x7998('0x1b')](_0x76b1d)[_0x7998('0x1d')](_0x22e216);}};}function respondWithFilteredResult(_0x18d3b9,_0x3d77cc){return function(_0x4e54b7){if(_0x4e54b7){var _0x522cfa=_0x4e54b7[_0x7998('0x1e')],_0x1975b5=_0x3d77cc['offset'],_0x5ee704=_0x3d77cc['offset']+_0x3d77cc[_0x7998('0x1f')],_0x42a098;if(_0x5ee704>=_0x522cfa){_0x5ee704=_0x522cfa;_0x42a098=0xc8;}else{_0x42a098=0xce;}_0x18d3b9['status'](_0x42a098);return _0x18d3b9[_0x7998('0x20')]('Content-Range',_0x1975b5+'-'+_0x5ee704+'/'+_0x522cfa)[_0x7998('0x1d')](_0x4e54b7);}return null;};}function patchUpdates(_0xe592e0){return function(_0x168f0f){try{jsonpatch['apply'](_0x168f0f,_0xe592e0,!![]);}catch(_0x4edfbb){return BPromise['reject'](_0x4edfbb);}return _0x168f0f['save']();};}function saveUpdates(_0x48eed8,_0x173694){return function(_0x4872b6){if(_0x4872b6){return _0x4872b6['update'](_0x48eed8)[_0x7998('0x21')](function(_0x37eedb){return _0x37eedb;});}return null;};}function removeEntity(_0x3a44b5,_0x38adfc){return function(_0x5e47f2){if(_0x5e47f2){return _0x5e47f2[_0x7998('0x22')]()[_0x7998('0x21')](function(){var _0x2f2234=_0x5e47f2[_0x7998('0x23')]({'plain':!![]});var _0x1e258e=_0x7998('0x24');return db['UserProfileResource'][_0x7998('0x22')]({'where':{'type':_0x1e258e,'resourceId':_0x2f2234['id']}})[_0x7998('0x21')](function(){return _0x5e47f2;});})[_0x7998('0x21')](function(){_0x3a44b5[_0x7998('0x1b')](0xcc)[_0x7998('0x1c')]();});}};}function handleEntityNotFound(_0x4ebfd5,_0x10c72a){return function(_0x500748){if(!_0x500748){_0x4ebfd5[_0x7998('0x1a')](0x194);}return _0x500748;};}function handleError(_0xdcbdea,_0x45c4d6){_0x45c4d6=_0x45c4d6||0x1f4;return function(_0x5ddb73){logger[_0x7998('0x25')](_0x5ddb73[_0x7998('0x26')]);if(_0x5ddb73[_0x7998('0x27')]){delete _0x5ddb73[_0x7998('0x27')];}_0xdcbdea[_0x7998('0x1b')](_0x45c4d6)[_0x7998('0x28')](_0x5ddb73);};}exports['index']=function(_0x3d90f8,_0x4e1031){var _0x18b489={},_0x3ccb1e={},_0x3bdcad={'count':0x0,'rows':[]};var _0x231bbb=_['map'](db[_0x7998('0x29')]['rawAttributes'],function(_0x3e33e2){return{'name':_0x3e33e2[_0x7998('0x2a')],'type':_0x3e33e2[_0x7998('0x2b')][_0x7998('0x2c')]};});_0x3ccb1e[_0x7998('0x2d')]=_['map'](_0x231bbb,_0x7998('0x27'));_0x3ccb1e[_0x7998('0x2e')]=_[_0x7998('0x2f')](_0x3d90f8[_0x7998('0x2e')]);_0x3ccb1e[_0x7998('0x30')]=_[_0x7998('0x31')](_0x3ccb1e[_0x7998('0x2d')],_0x3ccb1e['query']);_0x18b489[_0x7998('0x32')]=_[_0x7998('0x31')](_0x3ccb1e[_0x7998('0x2d')],qs[_0x7998('0x33')](_0x3d90f8[_0x7998('0x2e')][_0x7998('0x33')]));_0x18b489['attributes']=_0x18b489['attributes'][_0x7998('0x34')]?_0x18b489[_0x7998('0x32')]:_0x3ccb1e[_0x7998('0x2d')];if(!_0x3d90f8[_0x7998('0x2e')][_0x7998('0x35')](_0x7998('0x36'))){_0x18b489['limit']=qs[_0x7998('0x1f')](_0x3d90f8[_0x7998('0x2e')]['limit']);_0x18b489[_0x7998('0x37')]=qs['offset'](_0x3d90f8[_0x7998('0x2e')][_0x7998('0x37')]);}_0x18b489['order']=qs[_0x7998('0x38')](_0x3d90f8['query']['sort']);_0x18b489[_0x7998('0x39')]=qs['filters'](_[_0x7998('0x3a')](_0x3d90f8[_0x7998('0x2e')],_0x3ccb1e[_0x7998('0x30')]),_0x231bbb);if(_0x3d90f8[_0x7998('0x2e')][_0x7998('0x3b')]){_0x18b489['where']=_[_0x7998('0x3c')](_0x18b489[_0x7998('0x39')],{'$or':_[_0x7998('0x3d')](_0x231bbb,function(_0x2d40df){if(_0x2d40df[_0x7998('0x2b')]!==_0x7998('0x3e')){var _0x3ba077={};_0x3ba077[_0x2d40df[_0x7998('0x27')]]={'$like':'%'+_0x3d90f8['query']['filter']+'%'};return _0x3ba077;}})});}_0x18b489=_[_0x7998('0x3c')]({},_0x18b489,_0x3d90f8[_0x7998('0x3f')]);var _0x577131={'where':_0x18b489[_0x7998('0x39')]};return db['Variable'][_0x7998('0x1e')](_0x577131)[_0x7998('0x21')](function(_0x8a835f){_0x3bdcad['count']=_0x8a835f;if(_0x3d90f8[_0x7998('0x2e')][_0x7998('0x40')]){_0x18b489[_0x7998('0x41')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x18b489);})[_0x7998('0x21')](function(_0xccbd8c){_0x3bdcad[_0x7998('0x42')]=_0xccbd8c;return _0x3bdcad;})[_0x7998('0x21')](respondWithFilteredResult(_0x4e1031,_0x18b489))[_0x7998('0x43')](handleError(_0x4e1031,null));};exports['show']=function(_0x431e65,_0x11f9cb){var _0xb90af3={'raw':!![],'where':{'id':_0x431e65[_0x7998('0x44')]['id']}},_0x53e66e={};_0x53e66e[_0x7998('0x2d')]=_[_0x7998('0x2f')](db['Variable'][_0x7998('0x45')]);_0x53e66e[_0x7998('0x2e')]=_['keys'](_0x431e65[_0x7998('0x2e')]);_0x53e66e[_0x7998('0x30')]=_['intersection'](_0x53e66e[_0x7998('0x2d')],_0x53e66e[_0x7998('0x2e')]);_0xb90af3[_0x7998('0x32')]=_[_0x7998('0x31')](_0x53e66e[_0x7998('0x2d')],qs[_0x7998('0x33')](_0x431e65[_0x7998('0x2e')][_0x7998('0x33')]));_0xb90af3[_0x7998('0x32')]=_0xb90af3[_0x7998('0x32')][_0x7998('0x34')]?_0xb90af3['attributes']:_0x53e66e[_0x7998('0x2d')];if(_0x431e65[_0x7998('0x2e')][_0x7998('0x40')]){_0xb90af3['include']=[{'all':!![]}];}_0xb90af3=_['merge']({},_0xb90af3,_0x431e65[_0x7998('0x3f')]);return db[_0x7998('0x29')]['find'](_0xb90af3)[_0x7998('0x21')](handleEntityNotFound(_0x11f9cb,null))[_0x7998('0x21')](respondWithResult(_0x11f9cb,null))[_0x7998('0x43')](handleError(_0x11f9cb,null));};exports[_0x7998('0x46')]=function(_0x31cff5,_0x3b5058){return db[_0x7998('0x29')][_0x7998('0x46')](_0x31cff5[_0x7998('0x47')],{})[_0x7998('0x21')](function(_0x15959d){var _0x13338f=_0x31cff5[_0x7998('0x48')]['get']({'plain':!![]});if(!_0x13338f)throw new Error(_0x7998('0x49'));if(_0x13338f[_0x7998('0x4a')]===_0x7998('0x48')){var _0x3131d5=_0x15959d['get']({'plain':!![]});var _0x3040b4=_0x7998('0x24');return db[_0x7998('0x4b')][_0x7998('0x4c')]({'where':{'name':_0x3040b4,'userProfileId':_0x13338f['userProfileId']},'raw':!![]})[_0x7998('0x21')](function(_0x3810dd){if(_0x3810dd&&_0x3810dd[_0x7998('0x4d')]===0x0){return db[_0x7998('0x4e')][_0x7998('0x46')]({'name':_0x3131d5[_0x7998('0x27')],'resourceId':_0x3131d5['id'],'type':_0x3810dd[_0x7998('0x27')],'sectionId':_0x3810dd['id']},{})[_0x7998('0x21')](function(){return _0x15959d;});}else{return _0x15959d;}})['catch'](function(_0x15b02a){logger[_0x7998('0x25')](_0x7998('0x4f'),_0x15b02a);throw _0x15b02a;});}return _0x15959d;})[_0x7998('0x21')](respondWithResult(_0x3b5058,0xc9))[_0x7998('0x43')](handleError(_0x3b5058,null));};exports[_0x7998('0x50')]=function(_0x36ac07,_0xa6268c){if(_0x36ac07[_0x7998('0x47')]['id']){delete _0x36ac07[_0x7998('0x47')]['id'];}return db[_0x7998('0x29')][_0x7998('0x4c')]({'where':{'id':_0x36ac07[_0x7998('0x44')]['id']}})['then'](handleEntityNotFound(_0xa6268c,null))['then'](saveUpdates(_0x36ac07['body'],null))[_0x7998('0x21')](respondWithResult(_0xa6268c,null))[_0x7998('0x43')](handleError(_0xa6268c,null));};exports[_0x7998('0x22')]=function(_0x403e84,_0x444a86){return db[_0x7998('0x29')]['find']({'where':{'id':_0x403e84[_0x7998('0x44')]['id']}})[_0x7998('0x21')](handleEntityNotFound(_0x444a86,null))['then'](removeEntity(_0x444a86,null))[_0x7998('0x43')](handleError(_0x444a86,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 616b10f..cf3383f 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 _0x8c38=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x8c38,0x83));var _0x88c3=function(_0x15f51f,_0x5aafa9){_0x15f51f=_0x15f51f-0x0;var _0x1a22f4=_0x8c38[_0x15f51f];return _0x1a22f4;};'use strict';var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var logger=require('../../config/logger')(_0x88c3('0x2'));var moment=require(_0x88c3('0x3'));var BPromise=require(_0x88c3('0x4'));var rp=require(_0x88c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88c3('0x6'));var config=require(_0x88c3('0x7'));var attributes=require(_0x88c3('0x8'));module[_0x88c3('0x9')]=function(_0x2c413c,_0x6b76d7){return _0x2c413c[_0x88c3('0xa')](_0x88c3('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0911=['moment','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0911,0x1a9));var _0x1091=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x0911[_0x28fe94];return _0x3560da;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var logger=require(_0x1091('0x2'))(_0x1091('0x3'));var moment=require(_0x1091('0x4'));var BPromise=require('bluebird');var rp=require(_0x1091('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var attributes=require(_0x1091('0x8'));module[_0x1091('0x9')]=function(_0x3e3868,_0x28747){return _0x3e3868[_0x1091('0xa')](_0x1091('0xb'),attributes,{'tableName':_0x1091('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 dc318b6..dfc1c71 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 _0x2e03=['../../config/logger','rpc','../../config/environment','client','http','info','Variable,\x20%s,\x20%s','debug','request\x20sent','error','code','message','Variable','find','options','raw','where','attributes','include','map','model','then','stringify','catch','ShowVariable','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x188b19,_0x44c96a){var _0x34fbf8=function(_0x2856bc){while(--_0x2856bc){_0x188b19['push'](_0x188b19['shift']());}};_0x34fbf8(++_0x44c96a);}(_0x2e03,0x159));var _0x32e0=function(_0x7d19b2,_0x5da283){_0x7d19b2=_0x7d19b2-0x0;var _0x2d434b=_0x2e03[_0x7d19b2];return _0x2d434b;};'use strict';var _=require(_0x32e0('0x0'));var util=require(_0x32e0('0x1'));var moment=require('moment');var BPromise=require(_0x32e0('0x2'));var rs=require(_0x32e0('0x3'));var fs=require('fs');var Redis=require(_0x32e0('0x4'));var db=require(_0x32e0('0x5'))['db'];var utils=require(_0x32e0('0x6'));var logger=require(_0x32e0('0x7'))(_0x32e0('0x8'));var config=require(_0x32e0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x32e0('0xa')][_0x32e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d2b80,_0x1ee9a8,_0x46a8b8){return new BPromise(function(_0x41adb3,_0x1a4741){return client['request'](_0x3d2b80,_0x46a8b8)['then'](function(_0x19edd1){logger[_0x32e0('0xc')](_0x32e0('0xd'),_0x1ee9a8,'request\x20sent');logger[_0x32e0('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x1ee9a8,_0x32e0('0xf'),JSON['stringify'](_0x19edd1));if(_0x19edd1[_0x32e0('0x10')]){if(_0x19edd1[_0x32e0('0x10')][_0x32e0('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x1ee9a8,_0x19edd1[_0x32e0('0x10')][_0x32e0('0x12')]);return _0x1a4741(_0x19edd1[_0x32e0('0x10')][_0x32e0('0x12')]);}logger[_0x32e0('0x10')](_0x32e0('0xd'),_0x1ee9a8,_0x19edd1[_0x32e0('0x10')][_0x32e0('0x12')]);return _0x41adb3(_0x19edd1[_0x32e0('0x10')][_0x32e0('0x12')]);}else{logger['info'](_0x32e0('0xd'),_0x1ee9a8,_0x32e0('0xf'));_0x41adb3(_0x19edd1['result'][_0x32e0('0x12')]);}})['catch'](function(_0x210aec){logger['error'](_0x32e0('0xd'),_0x1ee9a8,_0x210aec);_0x1a4741(_0x210aec);});});}exports['ShowVariable']=function(_0x1e96d8){var _0x54c626=this;return new Promise(function(_0x58d454,_0x4b9a13){return db[_0x32e0('0x13')][_0x32e0('0x14')]({'raw':_0x1e96d8[_0x32e0('0x15')]?_0x1e96d8[_0x32e0('0x15')][_0x32e0('0x16')]===undefined?!![]:![]:!![],'where':_0x1e96d8[_0x32e0('0x15')]?_0x1e96d8[_0x32e0('0x15')][_0x32e0('0x17')]||null:null,'attributes':_0x1e96d8['options']?_0x1e96d8[_0x32e0('0x15')][_0x32e0('0x18')]||null:null,'include':_0x1e96d8[_0x32e0('0x15')]?_0x1e96d8[_0x32e0('0x15')][_0x32e0('0x19')]?_[_0x32e0('0x1a')](_0x1e96d8[_0x32e0('0x15')][_0x32e0('0x19')],function(_0x3b289b){return{'model':db[_0x3b289b[_0x32e0('0x1b')]],'as':_0x3b289b['as'],'attributes':_0x3b289b[_0x32e0('0x18')],'include':_0x3b289b[_0x32e0('0x19')]?_[_0x32e0('0x1a')](_0x3b289b[_0x32e0('0x19')],function(_0x53614b){return{'model':db[_0x53614b[_0x32e0('0x1b')]],'as':_0x53614b['as'],'attributes':_0x53614b[_0x32e0('0x18')],'include':_0x53614b[_0x32e0('0x19')]?_['map'](_0x53614b['include'],function(_0x27d663){return{'model':db[_0x27d663[_0x32e0('0x1b')]],'as':_0x27d663['as'],'attributes':_0x27d663[_0x32e0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x32e0('0x1c')](function(_0xedb83d){logger[_0x32e0('0xc')]('ShowVariable',_0x1e96d8);logger[_0x32e0('0xe')]('ShowVariable',_0x1e96d8,JSON[_0x32e0('0x1d')](_0xedb83d));_0x58d454(_0xedb83d);})[_0x32e0('0x1e')](function(_0x432e77){logger[_0x32e0('0x10')](_0x32e0('0x1f'),_0x432e77['message'],_0x1e96d8);_0x4b9a13(_0x54c626[_0x32e0('0x10')](0x1f4,_0x432e77[_0x32e0('0x12')]));});});}; \ No newline at end of file +var _0xc603=['catch','ShowVariable','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xc603,0x166));var _0x3c60=function(_0x264f67,_0x4cc986){_0x264f67=_0x264f67-0x0;var _0x2d1972=_0xc603[_0x264f67];return _0x2d1972;};'use strict';var _=require(_0x3c60('0x0'));var util=require(_0x3c60('0x1'));var moment=require('moment');var BPromise=require(_0x3c60('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c60('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c60('0x4'));var logger=require(_0x3c60('0x5'))(_0x3c60('0x6'));var config=require(_0x3c60('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c60('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c83cf,_0xb9efaa,_0x518ccd){return new BPromise(function(_0x397e96,_0x189463){return client['request'](_0x4c83cf,_0x518ccd)[_0x3c60('0x9')](function(_0x434de8){logger[_0x3c60('0xa')](_0x3c60('0xb'),_0xb9efaa,_0x3c60('0xc'));logger[_0x3c60('0xd')](_0x3c60('0xe'),_0xb9efaa,_0x3c60('0xc'),JSON[_0x3c60('0xf')](_0x434de8));if(_0x434de8[_0x3c60('0x10')]){if(_0x434de8[_0x3c60('0x10')]['code']===0x1f4){logger[_0x3c60('0x10')]('Variable,\x20%s,\x20%s',_0xb9efaa,_0x434de8[_0x3c60('0x10')][_0x3c60('0x11')]);return _0x189463(_0x434de8['error'][_0x3c60('0x11')]);}logger[_0x3c60('0x10')](_0x3c60('0xb'),_0xb9efaa,_0x434de8[_0x3c60('0x10')]['message']);return _0x397e96(_0x434de8[_0x3c60('0x10')][_0x3c60('0x11')]);}else{logger[_0x3c60('0xa')](_0x3c60('0xb'),_0xb9efaa,_0x3c60('0xc'));_0x397e96(_0x434de8[_0x3c60('0x12')][_0x3c60('0x11')]);}})[_0x3c60('0x13')](function(_0x41f605){logger['error']('Variable,\x20%s,\x20%s',_0xb9efaa,_0x41f605);_0x189463(_0x41f605);});});}exports[_0x3c60('0x14')]=function(_0x329e97){var _0x3f8705=this;return new Promise(function(_0x2cdf24,_0x11336c){return db['Variable'][_0x3c60('0x15')]({'raw':_0x329e97[_0x3c60('0x16')]?_0x329e97[_0x3c60('0x16')][_0x3c60('0x17')]===undefined?!![]:![]:!![],'where':_0x329e97[_0x3c60('0x16')]?_0x329e97[_0x3c60('0x16')][_0x3c60('0x18')]||null:null,'attributes':_0x329e97[_0x3c60('0x16')]?_0x329e97[_0x3c60('0x16')][_0x3c60('0x19')]||null:null,'include':_0x329e97[_0x3c60('0x16')]?_0x329e97[_0x3c60('0x16')][_0x3c60('0x1a')]?_[_0x3c60('0x1b')](_0x329e97['options'][_0x3c60('0x1a')],function(_0x5c2b82){return{'model':db[_0x5c2b82[_0x3c60('0x1c')]],'as':_0x5c2b82['as'],'attributes':_0x5c2b82[_0x3c60('0x19')],'include':_0x5c2b82[_0x3c60('0x1a')]?_['map'](_0x5c2b82[_0x3c60('0x1a')],function(_0xa889c9){return{'model':db[_0xa889c9[_0x3c60('0x1c')]],'as':_0xa889c9['as'],'attributes':_0xa889c9[_0x3c60('0x19')],'include':_0xa889c9['include']?_['map'](_0xa889c9[_0x3c60('0x1a')],function(_0x287f64){return{'model':db[_0x287f64[_0x3c60('0x1c')]],'as':_0x287f64['as'],'attributes':_0x287f64['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c60('0x9')](function(_0x4b70e4){logger[_0x3c60('0xa')](_0x3c60('0x14'),_0x329e97);logger['debug']('ShowVariable',_0x329e97,JSON[_0x3c60('0xf')](_0x4b70e4));_0x2cdf24(_0x4b70e4);})['catch'](function(_0x540053){logger[_0x3c60('0x10')](_0x3c60('0x14'),_0x540053[_0x3c60('0x11')],_0x329e97);_0x11336c(_0x3f8705['error'](0x1f4,_0x540053[_0x3c60('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b437713..bfb6965 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 _0x492a=['express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','/migrations','migrations','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x492a,0x150));var _0xa492=function(_0x263a16,_0x489c01){_0x263a16=_0x263a16-0x0;var _0x251824=_0x492a[_0x263a16];return _0x251824;};'use strict';var express=require(_0xa492('0x0'));var router=express[_0xa492('0x1')]();var auth=require(_0xa492('0x2'));var controller=require(_0xa492('0x3'));router[_0xa492('0x4')]('/',controller['index']);router[_0xa492('0x4')](_0xa492('0x5'),auth[_0xa492('0x6')](),auth[_0xa492('0x7')](),controller[_0xa492('0x8')]);router[_0xa492('0x4')]('/reset',auth[_0xa492('0x6')](),auth[_0xa492('0x7')](),controller[_0xa492('0x9')]);router['get'](_0xa492('0xa'),auth['isAuthenticated'](),auth[_0xa492('0x7')](),controller[_0xa492('0xb')]);router[_0xa492('0x4')](_0xa492('0xc'),auth[_0xa492('0x6')](),controller['restart']);router[_0xa492('0x4')](_0xa492('0xd'),controller[_0xa492('0xe')]);module[_0xa492('0xf')]=router; \ No newline at end of file +var _0xfe3f=['get','/fetch','isAuthenticated','canUpdate','fetch','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xfe3f,0x193));var _0xffe3=function(_0x189942,_0x808691){_0x189942=_0x189942-0x0;var _0x19aa4d=_0xfe3f[_0x189942];return _0x19aa4d;};'use strict';var express=require(_0xffe3('0x0'));var router=express[_0xffe3('0x1')]();var auth=require(_0xffe3('0x2'));var controller=require('./version.controller');router[_0xffe3('0x3')]('/',controller['index']);router['get'](_0xffe3('0x4'),auth[_0xffe3('0x5')](),auth[_0xffe3('0x6')](),controller[_0xffe3('0x7')]);router[_0xffe3('0x3')]('/reset',auth['isAuthenticated'](),auth[_0xffe3('0x6')](),controller['reset']);router[_0xffe3('0x3')](_0xffe3('0x8'),auth[_0xffe3('0x5')](),auth[_0xffe3('0x6')](),controller[_0xffe3('0x9')]);router[_0xffe3('0x3')](_0xffe3('0xa'),auth[_0xffe3('0x5')](),controller[_0xffe3('0xb')]);router[_0xffe3('0x3')](_0xffe3('0xc'),controller['migrations']);module[_0xffe3('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 834cb4c..c5d45a4 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 _0x39d2=['json','origin','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','join','server','migrations','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','status'];(function(_0x49cfd7,_0x22cf58){var _0x41c3db=function(_0x135ec9){while(--_0x135ec9){_0x49cfd7['push'](_0x49cfd7['shift']());}};_0x41c3db(++_0x22cf58);}(_0x39d2,0xf5));var _0x239d=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x39d2[_0x43d11d];return _0x38cd08;};'use strict';var Umzug=require(_0x239d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x239d('0x1'));var pkginfo=require(_0x239d('0x2'))(module,_0x239d('0x3'));var compareVersions=require(_0x239d('0x4'));var exec=require(_0x239d('0x5'))[_0x239d('0x6')];var db=require(_0x239d('0x7'))['db'];var config=require(_0x239d('0x8'));var pm2=require(_0x239d('0x9'));var logger=require(_0x239d('0xa'))(_0x239d('0xb'));var git=require(_0x239d('0xc'))(config[_0x239d('0xd')]);exports['index']=function(_0x262efe,_0x2a6811){var _0x3f9948={'current':module[_0x239d('0xe')][_0x239d('0x3')],'phonebar':0x2};if(_0x262efe[_0x239d('0xf')]&&_0x262efe[_0x239d('0xf')][_0x239d('0x10')]){return git[_0x239d('0x11')]()[_0x239d('0x12')](function(_0x4d5406,_0x41699a){_0x3f9948[_0x239d('0x10')]=(_0x4d5406?module[_0x239d('0xe')][_0x239d('0x3')]:_0x41699a['latest'])||'2.0.0';return _0x2a6811[_0x239d('0x13')](0xc8)[_0x239d('0x14')](_0x3f9948);});}else{return _0x2a6811[_0x239d('0x13')](0xc8)[_0x239d('0x14')](_0x3f9948);}};exports[_0x239d('0x11')]=function(_0xda3f86,_0x138c4a){return git[_0x239d('0x11')]([_0x239d('0x15'),'master'],function(_0x27303b){if(_0x27303b){logger[_0x239d('0x16')](_0x27303b);return _0x138c4a[_0x239d('0x13')](0x1f4)[_0x239d('0x14')](_0x27303b);}logger[_0x239d('0x17')]('git\x20fetch');return _0x138c4a['status'](0xc8)[_0x239d('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x239d('0x18')]=function(_0x47bec3,_0x33f01d){return git[_0x239d('0x18')]([_0x239d('0x19'),_0x239d('0x1a')],function(_0x3b1f15){if(_0x3b1f15){logger[_0x239d('0x16')](_0x3b1f15);return _0x33f01d[_0x239d('0x13')](0x1f4)[_0x239d('0x14')](_0x3b1f15);}logger['info'](_0x239d('0x1b'));return _0x33f01d['status'](0xc8)[_0x239d('0x14')]({'output':_0x239d('0x1c')});});};exports[_0x239d('0x1d')]=function(_0x5abe81,_0xdacbd2){exec(_0x239d('0x1e'),function(_0x1e8f55,_0x344fab,_0xb77bfe){logger[_0x239d('0x17')](_0x344fab);logger[_0x239d('0x17')](_0xb77bfe);if(_0x1e8f55){logger[_0x239d('0x16')](_0x1e8f55);return _0xdacbd2[_0x239d('0x13')](0x1f4)['json'](_0x1e8f55);}return _0xdacbd2[_0x239d('0x13')](0xc8)[_0x239d('0x14')]({'output':_0x344fab});});};exports[_0x239d('0x1f')]=function(_0x197043,_0x5541e3){return pm2[_0x239d('0x1f')](_0x239d('0x20'))[_0x239d('0x21')](function(_0x44947c){logger['info'](_0x239d('0x22'),_0x44947c);return _0x5541e3[_0x239d('0x13')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x239d('0x23')](function(_0x47ade8){logger['error'](_0x47ade8);return _0x5541e3[_0x239d('0x13')](0x1f4)[_0x239d('0x14')](_0x47ade8);});};exports['migrations']=function(_0x3dba9e,_0x4f779e){var _0x5de926=fs['readdirSync'](path[_0x239d('0x24')](config[_0x239d('0xd')],_0x239d('0x25'),_0x239d('0x26')));var _0x5cc2d2=[];for(var _0x571197=0x0;_0x571197<_0x5de926['length'];_0x571197++){var _0x334869=_0x5de926[_0x571197][_0x239d('0x27')](_0x239d('0x28'),'');if(compareVersions(module[_0x239d('0xe')]['version'],_0x334869)===-0x1){_0x5cc2d2[_0x239d('0x29')](_0x334869);}}if(_0x5cc2d2[_0x239d('0x2a')]){var _0x384469=_0x5cc2d2[_0x239d('0x2b')](compareVersions);var _0x6756a4=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x239d('0x2c')],'modelName':_0x239d('0x2c'),'columnName':_0x239d('0x3')},'migrations':{'params':[db[_0x239d('0x2d')][_0x239d('0x2e')](),db[_0x239d('0x2d')][_0x239d('0x2f')],function(){throw new Error(_0x239d('0x30'));}],'path':path[_0x239d('0x24')](config[_0x239d('0xd')],_0x239d('0x25'),_0x239d('0x26')),'pattern':/\.js$/}});_0x6756a4['up']({'migrations':_['map'](_0x384469,function(_0x162048){return _0x162048+_0x239d('0x28');})})[_0x239d('0x21')](function(){return _0x4f779e[_0x239d('0x13')](0xc8)[_0x239d('0x14')]({'output':_0x239d('0x31')+module['exports'][_0x239d('0x3')]+'\x20to\x20'+_[_0x239d('0x32')](_0x384469),'migrations':_[_0x239d('0x24')](_0x384469)});})['catch'](function(_0x3ea320){if(_0x3ea320 instanceof db[_0x239d('0x2d')][_0x239d('0x33')]){return _0x4f779e[_0x239d('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x4f779e[_0x239d('0x13')](0x1f4)[_0x239d('0x14')](_0x3ea320);}});}else{return _0x4f779e[_0x239d('0x13')](0xc8)[_0x239d('0x14')]({'output':_0x239d('0x34')});}}; \ No newline at end of file +var _0x4975=['reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','length','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x4e8f77,_0x3abc6b){var _0x2cbeec=function(_0x4b9608){while(--_0x4b9608){_0x4e8f77['push'](_0x4e8f77['shift']());}};_0x2cbeec(++_0x3abc6b);}(_0x4975,0x86));var _0x5497=function(_0x4246a3,_0x3e2c69){_0x4246a3=_0x4246a3-0x0;var _0x139f07=_0x4975[_0x4246a3];return _0x139f07;};'use strict';var Umzug=require(_0x5497('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x5497('0x1'));var pkginfo=require(_0x5497('0x2'))(module,_0x5497('0x3'));var compareVersions=require(_0x5497('0x4'));var exec=require(_0x5497('0x5'))[_0x5497('0x6')];var db=require(_0x5497('0x7'))['db'];var config=require(_0x5497('0x8'));var pm2=require(_0x5497('0x9'));var logger=require(_0x5497('0xa'))('update');var git=require(_0x5497('0xb'))(config['root']);exports[_0x5497('0xc')]=function(_0x674a2a,_0x368e8b){var _0x57f930={'current':module[_0x5497('0xd')]['version'],'phonebar':0x2};if(_0x674a2a[_0x5497('0xe')]&&_0x674a2a[_0x5497('0xe')][_0x5497('0xf')]){return git[_0x5497('0x10')]()[_0x5497('0x11')](function(_0x425288,_0x3e7886){_0x57f930[_0x5497('0xf')]=(_0x425288?module['exports']['version']:_0x3e7886['latest'])||_0x5497('0x12');return _0x368e8b[_0x5497('0x13')](0xc8)[_0x5497('0x14')](_0x57f930);});}else{return _0x368e8b[_0x5497('0x13')](0xc8)[_0x5497('0x14')](_0x57f930);}};exports[_0x5497('0x10')]=function(_0x1f7169,_0xaca97d){return git[_0x5497('0x10')]([_0x5497('0x15'),'master'],function(_0x11b0a9){if(_0x11b0a9){logger['error'](_0x11b0a9);return _0xaca97d[_0x5497('0x13')](0x1f4)[_0x5497('0x14')](_0x11b0a9);}logger[_0x5497('0x16')](_0x5497('0x17'));return _0xaca97d[_0x5497('0x13')](0xc8)[_0x5497('0x14')]({'output':_0x5497('0x18')});});};exports['reset']=function(_0x56a788,_0x3f4d20){return git[_0x5497('0x19')]([_0x5497('0x1a'),'FETCH_HEAD'],function(_0xbf1ba7){if(_0xbf1ba7){logger[_0x5497('0x1b')](_0xbf1ba7);return _0x3f4d20[_0x5497('0x13')](0x1f4)[_0x5497('0x14')](_0xbf1ba7);}logger[_0x5497('0x16')](_0x5497('0x1c'));return _0x3f4d20[_0x5497('0x13')](0xc8)[_0x5497('0x14')]({'output':_0x5497('0x1d')});});};exports[_0x5497('0x1e')]=function(_0x186065,_0x52c049){exec(_0x5497('0x1f'),function(_0x4d1b27,_0x19200a,_0xd0868d){logger[_0x5497('0x16')](_0x19200a);logger[_0x5497('0x16')](_0xd0868d);if(_0x4d1b27){logger[_0x5497('0x1b')](_0x4d1b27);return _0x52c049[_0x5497('0x13')](0x1f4)['json'](_0x4d1b27);}return _0x52c049['status'](0xc8)[_0x5497('0x14')]({'output':_0x19200a});});};exports[_0x5497('0x20')]=function(_0x24482a,_0x281155){return pm2['restart'](_0x5497('0x21'))['then'](function(_0x1f3198){logger[_0x5497('0x16')](_0x5497('0x22'),_0x1f3198);return _0x281155[_0x5497('0x13')](0xc8)[_0x5497('0x14')]({'output':_0x5497('0x23')});})['catch'](function(_0x4af5f4){logger['error'](_0x4af5f4);return _0x281155['status'](0x1f4)['json'](_0x4af5f4);});};exports[_0x5497('0x24')]=function(_0x48d146,_0x5e9356){var _0xc3465=fs[_0x5497('0x25')](path[_0x5497('0x26')](config['root'],'server','migrations'));var _0x371874=[];for(var _0x471e0b=0x0;_0x471e0b<_0xc3465[_0x5497('0x27')];_0x471e0b++){var _0x5b8f79=_0xc3465[_0x471e0b]['replace']('.js','');if(compareVersions(module[_0x5497('0xd')]['version'],_0x5b8f79)===-0x1){_0x371874[_0x5497('0x28')](_0x5b8f79);}}if(_0x371874[_0x5497('0x27')]){var _0x77c575=_0x371874['sort'](compareVersions);var _0x1d208f=new Umzug({'storage':_0x5497('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x5497('0x2a'),'columnName':_0x5497('0x3')},'migrations':{'params':[db[_0x5497('0x29')]['getQueryInterface'](),db[_0x5497('0x29')][_0x5497('0x2b')],function(){throw new Error(_0x5497('0x2c'));}],'path':path[_0x5497('0x26')](config[_0x5497('0x2d')],'server',_0x5497('0x24')),'pattern':/\.js$/}});_0x1d208f['up']({'migrations':_[_0x5497('0x2e')](_0x77c575,function(_0x558a70){return _0x558a70+_0x5497('0x2f');})})[_0x5497('0x30')](function(){return _0x5e9356[_0x5497('0x13')](0xc8)[_0x5497('0x14')]({'output':_0x5497('0x31')+module[_0x5497('0xd')]['version']+_0x5497('0x32')+_['last'](_0x77c575),'migrations':_[_0x5497('0x26')](_0x77c575)});})[_0x5497('0x33')](function(_0x2751f5){if(_0x2751f5 instanceof db['sequelize']['UniqueConstraintError']){return _0x5e9356[_0x5497('0x13')](0xc8)[_0x5497('0x14')]({'output':_0x5497('0x34')});}else{return _0x5e9356[_0x5497('0x13')](0x1f4)[_0x5497('0x14')](_0x2751f5);}});}else{return _0x5e9356[_0x5497('0x13')](0xc8)['json']({'output':_0x5497('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index cdee410..47d66da 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 _0x3ac8=['index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x3ac8,0x10e));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x83ac('0x0'));var util=require('util');var path=require(_0x83ac('0x1'));var timeout=require(_0x83ac('0x2'));var express=require(_0x83ac('0x3'));var router=express['Router']();var auth=require(_0x83ac('0x4'));var interaction=require(_0x83ac('0x5'));var config=require(_0x83ac('0x6'));var controller=require(_0x83ac('0x7'));router[_0x83ac('0x8')]('/',auth[_0x83ac('0x9')](),controller[_0x83ac('0xa')]);router[_0x83ac('0x8')](_0x83ac('0xb'),auth['isAuthenticated'](),controller[_0x83ac('0xc')]);router[_0x83ac('0x8')](_0x83ac('0xd'),auth[_0x83ac('0x9')](),controller[_0x83ac('0xe')]);router[_0x83ac('0xf')]('/',auth[_0x83ac('0x9')](),controller['create']);router['put'](_0x83ac('0xd'),auth['isAuthenticated'](),controller[_0x83ac('0x10')]);router[_0x83ac('0x11')](_0x83ac('0xd'),auth[_0x83ac('0x9')](),controller[_0x83ac('0x12')]);module[_0x83ac('0x13')]=router; \ No newline at end of file +var _0x6103=['get','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x559f6a,_0x14330a){var _0x20f2fa=function(_0x40d012){while(--_0x40d012){_0x559f6a['push'](_0x559f6a['shift']());}};_0x20f2fa(++_0x14330a);}(_0x6103,0x1ec));var _0x3610=function(_0x19be31,_0x51d229){_0x19be31=_0x19be31-0x0;var _0x3355e7=_0x6103[_0x19be31];return _0x3355e7;};'use strict';var multer=require(_0x3610('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3610('0x1'));var express=require(_0x3610('0x2'));var router=express[_0x3610('0x3')]();var auth=require(_0x3610('0x4'));var interaction=require(_0x3610('0x5'));var config=require(_0x3610('0x6'));var controller=require(_0x3610('0x7'));router[_0x3610('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3610('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3610('0x9')]);router[_0x3610('0x8')](_0x3610('0xa'),auth[_0x3610('0xb')](),controller[_0x3610('0xc')]);router[_0x3610('0xd')]('/',auth[_0x3610('0xb')](),controller[_0x3610('0xe')]);router[_0x3610('0xf')](_0x3610('0xa'),auth[_0x3610('0xb')](),controller[_0x3610('0x10')]);router[_0x3610('0x11')](_0x3610('0xa'),auth[_0x3610('0xb')](),controller[_0x3610('0x12')]);module[_0x3610('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6a110a1..f31c0d2 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 _0x4819=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4819,0xcd));var _0x9481=function(_0x20a1b0,_0x18fe84){_0x20a1b0=_0x20a1b0-0x0;var _0x321e14=_0x4819[_0x20a1b0];return _0x321e14;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'type':{'type':Sequelize[_0x9481('0x1')]},'uniqueid':{'type':Sequelize[_0x9481('0x1')]},'calleridnum':{'type':Sequelize[_0x9481('0x1')]},'calleridname':{'type':Sequelize[_0x9481('0x1')]},'queue':{'type':Sequelize[_0x9481('0x1')]},'interface':{'type':Sequelize[_0x9481('0x1')]},'membername':{'type':Sequelize[_0x9481('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9481('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9481('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x9481('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9481('0x4')]},'agentacw':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9481('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9481('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9481('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'connectedlinename':{'type':Sequelize[_0x9481('0x1')]},'language':{'type':Sequelize[_0x9481('0x1')]},'accountcode':{'type':Sequelize[_0x9481('0x1')]},'context':{'type':Sequelize[_0x9481('0x1')]},'exten':{'type':Sequelize[_0x9481('0x1')]},'priority':{'type':Sequelize[_0x9481('0x1')]},'destchannel':{'type':Sequelize[_0x9481('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9481('0x1')]},'destcalleridname':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9481('0x1')]},'destlanguage':{'type':Sequelize[_0x9481('0x1')]},'destaccountcode':{'type':Sequelize[_0x9481('0x1')]},'destcontext':{'type':Sequelize[_0x9481('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9481('0x1')]},'destuniqueid':{'type':Sequelize[_0x9481('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9481('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9481('0x1')],'comment':_0x9481('0x5')},'transferexten':{'type':Sequelize[_0x9481('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9481('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2be2b8,_0x51b38a){var _0x4c02e1=function(_0x28db39){while(--_0x28db39){_0x2be2b8['push'](_0x2be2b8['shift']());}};_0x4c02e1(++_0x51b38a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x5fc3[_0x39cd3c];return _0x47a0ae;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35fc('0x2')]},'calleridnum':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'queue':{'type':Sequelize[_0x35fc('0x2')]},'interface':{'type':Sequelize[_0x35fc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x35fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x35fc('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x35fc('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x35fc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x35fc('0x4')]},'agentacw':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x35fc('0x4')]},'reason':{'type':Sequelize[_0x35fc('0x2')]},'lastevent':{'type':Sequelize[_0x35fc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x35fc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x35fc('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x35fc('0x2')]},'language':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x35fc('0x2')]},'exten':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x35fc('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x35fc('0x2')]},'destcalleridname':{'type':Sequelize[_0x35fc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x35fc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x35fc('0x2')]},'destlanguage':{'type':Sequelize[_0x35fc('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x35fc('0x2')]},'transfer':{'type':Sequelize[_0x35fc('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x35fc('0x2')],'comment':_0x35fc('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x35fc('0x2')]},'agententerreason':{'type':Sequelize[_0x35fc('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b8a3e70..740478b 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 _0xb7cc=['api','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','index','map','VoiceAgentReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xb7cc,0x1a7));var _0xcb7c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb7cc[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xcb7c('0x0'));var emlformat=require(_0xcb7c('0x1'));var rimraf=require(_0xcb7c('0x2'));var zipdir=require(_0xcb7c('0x3'));var jsonpatch=require(_0xcb7c('0x4'));var rp=require(_0xcb7c('0x5'));var moment=require(_0xcb7c('0x6'));var BPromise=require(_0xcb7c('0x7'));var Mustache=require('mustache');var util=require(_0xcb7c('0x8'));var path=require('path');var sox=require(_0xcb7c('0x9'));var csv=require(_0xcb7c('0xa'));var ejs=require(_0xcb7c('0xb'));var fs=require('fs');var _=require(_0xcb7c('0xc'));var squel=require('squel');var crypto=require(_0xcb7c('0xd'));var jsforce=require(_0xcb7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcb7c('0xa'));var querystring=require(_0xcb7c('0xf'));var Papa=require('papaparse');var Redis=require(_0xcb7c('0x10'));var authService=require(_0xcb7c('0x11'));var qs=require(_0xcb7c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7c('0x13'));var logger=require(_0xcb7c('0x14'))(_0xcb7c('0x15'));var utils=require('../../config/utils');var config=require(_0xcb7c('0x16'));var licenseUtil=require(_0xcb7c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d8b5a,_0x1fa8c4){_0x1fa8c4=_0x1fa8c4||0xcc;return function(_0x1f3f67){if(_0x1f3f67){return _0x1d8b5a['sendStatus'](_0x1fa8c4);}return _0x1d8b5a[_0xcb7c('0x18')](_0x1fa8c4)[_0xcb7c('0x19')]();};}function respondWithResult(_0x1453b8,_0x254d45){_0x254d45=_0x254d45||0xc8;return function(_0x1f7531){if(_0x1f7531){return _0x1453b8['status'](_0x254d45)[_0xcb7c('0x1a')](_0x1f7531);}};}function respondWithFilteredResult(_0x538103,_0x45eb6a){return function(_0x1f8c09){if(_0x1f8c09){var _0x501ea4=_0x1f8c09['count'],_0x211154=_0x45eb6a[_0xcb7c('0x1b')],_0x583d67=_0x45eb6a[_0xcb7c('0x1b')]+_0x45eb6a[_0xcb7c('0x1c')],_0x5866d6;if(_0x583d67>=_0x501ea4){_0x583d67=_0x501ea4;_0x5866d6=0xc8;}else{_0x5866d6=0xce;}_0x538103[_0xcb7c('0x18')](_0x5866d6);return _0x538103[_0xcb7c('0x1d')](_0xcb7c('0x1e'),_0x211154+'-'+_0x583d67+'/'+_0x501ea4)[_0xcb7c('0x1a')](_0x1f8c09);}return null;};}function patchUpdates(_0x5d048a){return function(_0x1a9fe0){try{jsonpatch[_0xcb7c('0x1f')](_0x1a9fe0,_0x5d048a,!![]);}catch(_0x44de12){return BPromise['reject'](_0x44de12);}return _0x1a9fe0[_0xcb7c('0x20')]();};}function saveUpdates(_0x144167,_0x4e57ca){return function(_0x5e4723){if(_0x5e4723){return _0x5e4723[_0xcb7c('0x21')](_0x144167)[_0xcb7c('0x22')](function(_0x353a02){return _0x353a02;});}return null;};}function removeEntity(_0x2c8b24,_0x3d51a1){return function(_0x21b661){if(_0x21b661){return _0x21b661['destroy']()[_0xcb7c('0x22')](function(){_0x2c8b24[_0xcb7c('0x18')](0xcc)[_0xcb7c('0x19')]();});}};}function handleEntityNotFound(_0x430ef1,_0x34f1ea){return function(_0x591806){if(!_0x591806){_0x430ef1[_0xcb7c('0x23')](0x194);}return _0x591806;};}function handleError(_0x4df931,_0x525ea3){_0x525ea3=_0x525ea3||0x1f4;return function(_0x26288e){logger['error'](_0x26288e[_0xcb7c('0x24')]);if(_0x26288e[_0xcb7c('0x25')]){delete _0x26288e['name'];}_0x4df931[_0xcb7c('0x18')](_0x525ea3)[_0xcb7c('0x26')](_0x26288e);};}exports[_0xcb7c('0x27')]=function(_0x42a33a,_0x421ec5){var _0x4f2bb0={},_0x5b627d={},_0xff852d={'count':0x0,'rows':[]};var _0x3b68f7=_[_0xcb7c('0x28')](db[_0xcb7c('0x29')]['rawAttributes'],function(_0x391e23){return{'name':_0x391e23[_0xcb7c('0x2a')],'type':_0x391e23[_0xcb7c('0x2b')]['key']};});_0x5b627d[_0xcb7c('0x2c')]=_['map'](_0x3b68f7,_0xcb7c('0x25'));_0x5b627d[_0xcb7c('0x2d')]=_[_0xcb7c('0x2e')](_0x42a33a[_0xcb7c('0x2d')]);_0x5b627d[_0xcb7c('0x2f')]=_[_0xcb7c('0x30')](_0x5b627d[_0xcb7c('0x2c')],_0x5b627d['query']);_0x4f2bb0[_0xcb7c('0x31')]=_[_0xcb7c('0x30')](_0x5b627d[_0xcb7c('0x2c')],qs['fields'](_0x42a33a['query'][_0xcb7c('0x32')]));_0x4f2bb0[_0xcb7c('0x31')]=_0x4f2bb0[_0xcb7c('0x31')][_0xcb7c('0x33')]?_0x4f2bb0['attributes']:_0x5b627d[_0xcb7c('0x2c')];if(!_0x42a33a[_0xcb7c('0x2d')][_0xcb7c('0x34')](_0xcb7c('0x35'))){_0x4f2bb0[_0xcb7c('0x1c')]=qs[_0xcb7c('0x1c')](_0x42a33a[_0xcb7c('0x2d')][_0xcb7c('0x1c')]);_0x4f2bb0['offset']=qs[_0xcb7c('0x1b')](_0x42a33a['query'][_0xcb7c('0x1b')]);}_0x4f2bb0[_0xcb7c('0x36')]=qs['sort'](_0x42a33a['query'][_0xcb7c('0x37')]);_0x4f2bb0['where']=qs[_0xcb7c('0x2f')](_[_0xcb7c('0x38')](_0x42a33a[_0xcb7c('0x2d')],_0x5b627d[_0xcb7c('0x2f')]),_0x3b68f7);if(_0x42a33a[_0xcb7c('0x2d')][_0xcb7c('0x39')]){_0x4f2bb0['where']=_[_0xcb7c('0x3a')](_0x4f2bb0[_0xcb7c('0x3b')],{'$or':_[_0xcb7c('0x28')](_0x3b68f7,function(_0x5568df){if(_0x5568df['type']!==_0xcb7c('0x3c')){var _0x4e4198={};_0x4e4198[_0x5568df['name']]={'$like':'%'+_0x42a33a[_0xcb7c('0x2d')][_0xcb7c('0x39')]+'%'};return _0x4e4198;}})});}_0x4f2bb0=_[_0xcb7c('0x3a')]({},_0x4f2bb0,_0x42a33a[_0xcb7c('0x3d')]);var _0x48dbcb={'where':_0x4f2bb0['where']};return db[_0xcb7c('0x29')][_0xcb7c('0x3e')](_0x48dbcb)[_0xcb7c('0x22')](function(_0x43a94a){_0xff852d[_0xcb7c('0x3e')]=_0x43a94a;if(_0x42a33a['query'][_0xcb7c('0x3f')]){_0x4f2bb0[_0xcb7c('0x40')]=[{'all':!![]}];}return db[_0xcb7c('0x29')][_0xcb7c('0x41')](_0x4f2bb0);})[_0xcb7c('0x22')](function(_0x392ae1){_0xff852d['rows']=_0x392ae1;return _0xff852d;})[_0xcb7c('0x22')](respondWithFilteredResult(_0x421ec5,_0x4f2bb0))[_0xcb7c('0x42')](handleError(_0x421ec5,null));};exports[_0xcb7c('0x43')]=function(_0x4d5795,_0x4be974){var _0x46ad0b={'raw':![],'where':{'id':_0x4d5795[_0xcb7c('0x44')]['id']}},_0x4c129d={};_0x4c129d[_0xcb7c('0x2c')]=_[_0xcb7c('0x2e')](db['VoiceAgentReport'][_0xcb7c('0x45')]);_0x4c129d[_0xcb7c('0x2d')]=_['keys'](_0x4d5795[_0xcb7c('0x2d')]);_0x4c129d[_0xcb7c('0x2f')]=_['intersection'](_0x4c129d[_0xcb7c('0x2c')],_0x4c129d[_0xcb7c('0x2d')]);_0x46ad0b['attributes']=_[_0xcb7c('0x30')](_0x4c129d[_0xcb7c('0x2c')],qs[_0xcb7c('0x32')](_0x4d5795[_0xcb7c('0x2d')][_0xcb7c('0x32')]));_0x46ad0b[_0xcb7c('0x31')]=_0x46ad0b['attributes']['length']?_0x46ad0b[_0xcb7c('0x31')]:_0x4c129d[_0xcb7c('0x2c')];if(_0x4d5795[_0xcb7c('0x2d')][_0xcb7c('0x3f')]){_0x46ad0b[_0xcb7c('0x40')]=[{'all':!![]}];}_0x46ad0b=_[_0xcb7c('0x3a')]({},_0x46ad0b,_0x4d5795[_0xcb7c('0x3d')]);return db[_0xcb7c('0x29')][_0xcb7c('0x46')](_0x46ad0b)['then'](handleEntityNotFound(_0x4be974,null))[_0xcb7c('0x22')](respondWithResult(_0x4be974,null))[_0xcb7c('0x42')](handleError(_0x4be974,null));};exports[_0xcb7c('0x47')]=function(_0xd8df03,_0x567bd3){return db['VoiceAgentReport'][_0xcb7c('0x47')](_0xd8df03[_0xcb7c('0x48')],{})['then'](respondWithResult(_0x567bd3,0xc9))[_0xcb7c('0x42')](handleError(_0x567bd3,null));};exports[_0xcb7c('0x21')]=function(_0x19941e,_0x4f9262){if(_0x19941e[_0xcb7c('0x48')]['id']){delete _0x19941e[_0xcb7c('0x48')]['id'];}return db[_0xcb7c('0x29')][_0xcb7c('0x46')]({'where':{'id':_0x19941e['params']['id']}})['then'](handleEntityNotFound(_0x4f9262,null))[_0xcb7c('0x22')](saveUpdates(_0x19941e[_0xcb7c('0x48')],null))[_0xcb7c('0x22')](respondWithResult(_0x4f9262,null))[_0xcb7c('0x42')](handleError(_0x4f9262,null));};exports['destroy']=function(_0x5e77b3,_0x3cbf47){return db[_0xcb7c('0x29')]['find']({'where':{'id':_0x5e77b3['params']['id']}})[_0xcb7c('0x22')](handleEntityNotFound(_0x3cbf47,null))[_0xcb7c('0x22')](removeEntity(_0x3cbf47,null))['catch'](handleError(_0x3cbf47,null));};exports[_0xcb7c('0x49')]=function(_0x1ef9cd,_0x4d2aec){return db[_0xcb7c('0x29')][_0xcb7c('0x49')]()[_0xcb7c('0x22')](respondWithResult(_0x4d2aec,null))[_0xcb7c('0x42')](handleError(_0x4d2aec,null));}; \ No newline at end of file +var _0x3f98=['count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceAgentReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x2feed3,_0x26dbe9){var _0xa0e7e0=function(_0x327336){while(--_0x327336){_0x2feed3['push'](_0x2feed3['shift']());}};_0xa0e7e0(++_0x26dbe9);}(_0x3f98,0x109));var _0x83f9=function(_0x1bf0e6,_0x2c60c8){_0x1bf0e6=_0x1bf0e6-0x0;var _0x3c086c=_0x3f98[_0x1bf0e6];return _0x3c086c;};'use strict';var pdf=require(_0x83f9('0x0'));var emlformat=require(_0x83f9('0x1'));var rimraf=require(_0x83f9('0x2'));var zipdir=require(_0x83f9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83f9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x83f9('0x5'));var util=require(_0x83f9('0x6'));var path=require('path');var sox=require(_0x83f9('0x7'));var csv=require(_0x83f9('0x8'));var ejs=require(_0x83f9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x83f9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x83f9('0x8'));var querystring=require('querystring');var Papa=require(_0x83f9('0xb'));var Redis=require(_0x83f9('0xc'));var authService=require(_0x83f9('0xd'));var qs=require(_0x83f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x83f9('0xf'));var config=require(_0x83f9('0x10'));var licenseUtil=require(_0x83f9('0x11'));var db=require(_0x83f9('0x12'))['db'];function respondWithStatusCode(_0x4c7c3c,_0x307aee){_0x307aee=_0x307aee||0xcc;return function(_0x39679c){if(_0x39679c){return _0x4c7c3c[_0x83f9('0x13')](_0x307aee);}return _0x4c7c3c['status'](_0x307aee)[_0x83f9('0x14')]();};}function respondWithResult(_0x18333f,_0x387675){_0x387675=_0x387675||0xc8;return function(_0x9bd155){if(_0x9bd155){return _0x18333f[_0x83f9('0x15')](_0x387675)[_0x83f9('0x16')](_0x9bd155);}};}function respondWithFilteredResult(_0x543af7,_0x7d3eb3){return function(_0x4223e0){if(_0x4223e0){var _0x2271ee=_0x4223e0[_0x83f9('0x17')],_0x2eb310=_0x7d3eb3['offset'],_0x135dbb=_0x7d3eb3[_0x83f9('0x18')]+_0x7d3eb3[_0x83f9('0x19')],_0x3f9789;if(_0x135dbb>=_0x2271ee){_0x135dbb=_0x2271ee;_0x3f9789=0xc8;}else{_0x3f9789=0xce;}_0x543af7[_0x83f9('0x15')](_0x3f9789);return _0x543af7[_0x83f9('0x1a')](_0x83f9('0x1b'),_0x2eb310+'-'+_0x135dbb+'/'+_0x2271ee)[_0x83f9('0x16')](_0x4223e0);}return null;};}function patchUpdates(_0x320da7){return function(_0xc310f7){try{jsonpatch[_0x83f9('0x1c')](_0xc310f7,_0x320da7,!![]);}catch(_0x4f5862){return BPromise['reject'](_0x4f5862);}return _0xc310f7[_0x83f9('0x1d')]();};}function saveUpdates(_0x5743ff,_0x42bb30){return function(_0x2a9e13){if(_0x2a9e13){return _0x2a9e13[_0x83f9('0x1e')](_0x5743ff)['then'](function(_0x2d5f51){return _0x2d5f51;});}return null;};}function removeEntity(_0x5bf233,_0x48a312){return function(_0x11e7cd){if(_0x11e7cd){return _0x11e7cd[_0x83f9('0x1f')]()[_0x83f9('0x20')](function(){_0x5bf233[_0x83f9('0x15')](0xcc)[_0x83f9('0x14')]();});}};}function handleEntityNotFound(_0x2ee3b0,_0x4bcb28){return function(_0x253198){if(!_0x253198){_0x2ee3b0[_0x83f9('0x13')](0x194);}return _0x253198;};}function handleError(_0x1fac34,_0x641baf){_0x641baf=_0x641baf||0x1f4;return function(_0x1c5b23){logger[_0x83f9('0x21')](_0x1c5b23[_0x83f9('0x22')]);if(_0x1c5b23[_0x83f9('0x23')]){delete _0x1c5b23['name'];}_0x1fac34['status'](_0x641baf)[_0x83f9('0x24')](_0x1c5b23);};}exports[_0x83f9('0x25')]=function(_0x16f94c,_0x1f6ed2){var _0x4a2f97={},_0x11c7d7={},_0x20c7fc={'count':0x0,'rows':[]};var _0x5389dd=_[_0x83f9('0x26')](db[_0x83f9('0x27')]['rawAttributes'],function(_0x5aa23d){return{'name':_0x5aa23d[_0x83f9('0x28')],'type':_0x5aa23d[_0x83f9('0x29')][_0x83f9('0x2a')]};});_0x11c7d7[_0x83f9('0x2b')]=_[_0x83f9('0x26')](_0x5389dd,_0x83f9('0x23'));_0x11c7d7[_0x83f9('0x2c')]=_[_0x83f9('0x2d')](_0x16f94c[_0x83f9('0x2c')]);_0x11c7d7[_0x83f9('0x2e')]=_[_0x83f9('0x2f')](_0x11c7d7[_0x83f9('0x2b')],_0x11c7d7[_0x83f9('0x2c')]);_0x4a2f97['attributes']=_[_0x83f9('0x2f')](_0x11c7d7[_0x83f9('0x2b')],qs[_0x83f9('0x30')](_0x16f94c[_0x83f9('0x2c')][_0x83f9('0x30')]));_0x4a2f97[_0x83f9('0x31')]=_0x4a2f97[_0x83f9('0x31')][_0x83f9('0x32')]?_0x4a2f97[_0x83f9('0x31')]:_0x11c7d7[_0x83f9('0x2b')];if(!_0x16f94c[_0x83f9('0x2c')][_0x83f9('0x33')](_0x83f9('0x34'))){_0x4a2f97['limit']=qs['limit'](_0x16f94c[_0x83f9('0x2c')][_0x83f9('0x19')]);_0x4a2f97[_0x83f9('0x18')]=qs[_0x83f9('0x18')](_0x16f94c['query'][_0x83f9('0x18')]);}_0x4a2f97[_0x83f9('0x35')]=qs['sort'](_0x16f94c[_0x83f9('0x2c')][_0x83f9('0x36')]);_0x4a2f97[_0x83f9('0x37')]=qs[_0x83f9('0x2e')](_[_0x83f9('0x38')](_0x16f94c['query'],_0x11c7d7[_0x83f9('0x2e')]),_0x5389dd);if(_0x16f94c['query']['filter']){_0x4a2f97[_0x83f9('0x37')]=_['merge'](_0x4a2f97['where'],{'$or':_[_0x83f9('0x26')](_0x5389dd,function(_0x608a6e){if(_0x608a6e[_0x83f9('0x29')]!=='VIRTUAL'){var _0x53fb8a={};_0x53fb8a[_0x608a6e['name']]={'$like':'%'+_0x16f94c['query'][_0x83f9('0x39')]+'%'};return _0x53fb8a;}})});}_0x4a2f97=_['merge']({},_0x4a2f97,_0x16f94c['options']);var _0x209535={'where':_0x4a2f97[_0x83f9('0x37')]};return db[_0x83f9('0x27')][_0x83f9('0x17')](_0x209535)[_0x83f9('0x20')](function(_0x518925){_0x20c7fc[_0x83f9('0x17')]=_0x518925;if(_0x16f94c[_0x83f9('0x2c')][_0x83f9('0x3a')]){_0x4a2f97['include']=[{'all':!![]}];}return db[_0x83f9('0x27')][_0x83f9('0x3b')](_0x4a2f97);})[_0x83f9('0x20')](function(_0x340dfa){_0x20c7fc[_0x83f9('0x3c')]=_0x340dfa;return _0x20c7fc;})[_0x83f9('0x20')](respondWithFilteredResult(_0x1f6ed2,_0x4a2f97))[_0x83f9('0x3d')](handleError(_0x1f6ed2,null));};exports[_0x83f9('0x3e')]=function(_0x53af16,_0x310570){var _0x359118={'raw':![],'where':{'id':_0x53af16[_0x83f9('0x3f')]['id']}},_0xb66c53={};_0xb66c53['model']=_[_0x83f9('0x2d')](db[_0x83f9('0x27')][_0x83f9('0x40')]);_0xb66c53['query']=_[_0x83f9('0x2d')](_0x53af16[_0x83f9('0x2c')]);_0xb66c53[_0x83f9('0x2e')]=_[_0x83f9('0x2f')](_0xb66c53[_0x83f9('0x2b')],_0xb66c53[_0x83f9('0x2c')]);_0x359118[_0x83f9('0x31')]=_[_0x83f9('0x2f')](_0xb66c53[_0x83f9('0x2b')],qs[_0x83f9('0x30')](_0x53af16[_0x83f9('0x2c')]['fields']));_0x359118['attributes']=_0x359118[_0x83f9('0x31')][_0x83f9('0x32')]?_0x359118[_0x83f9('0x31')]:_0xb66c53[_0x83f9('0x2b')];if(_0x53af16[_0x83f9('0x2c')][_0x83f9('0x3a')]){_0x359118[_0x83f9('0x41')]=[{'all':!![]}];}_0x359118=_[_0x83f9('0x42')]({},_0x359118,_0x53af16[_0x83f9('0x43')]);return db['VoiceAgentReport']['find'](_0x359118)['then'](handleEntityNotFound(_0x310570,null))['then'](respondWithResult(_0x310570,null))[_0x83f9('0x3d')](handleError(_0x310570,null));};exports[_0x83f9('0x44')]=function(_0x2273ca,_0x38baed){return db['VoiceAgentReport'][_0x83f9('0x44')](_0x2273ca[_0x83f9('0x45')],{})[_0x83f9('0x20')](respondWithResult(_0x38baed,0xc9))['catch'](handleError(_0x38baed,null));};exports[_0x83f9('0x1e')]=function(_0x3ae40a,_0x4e7075){if(_0x3ae40a['body']['id']){delete _0x3ae40a['body']['id'];}return db['VoiceAgentReport'][_0x83f9('0x46')]({'where':{'id':_0x3ae40a[_0x83f9('0x3f')]['id']}})[_0x83f9('0x20')](handleEntityNotFound(_0x4e7075,null))[_0x83f9('0x20')](saveUpdates(_0x3ae40a[_0x83f9('0x45')],null))['then'](respondWithResult(_0x4e7075,null))[_0x83f9('0x3d')](handleError(_0x4e7075,null));};exports[_0x83f9('0x1f')]=function(_0x4e7fca,_0x397795){return db[_0x83f9('0x27')][_0x83f9('0x46')]({'where':{'id':_0x4e7fca[_0x83f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x397795,null))[_0x83f9('0x20')](removeEntity(_0x397795,null))[_0x83f9('0x3d')](handleError(_0x397795,null));};exports['describe']=function(_0x50df97,_0x2bf401){return db[_0x83f9('0x27')][_0x83f9('0x47')]()[_0x83f9('0x20')](respondWithResult(_0x2bf401,null))[_0x83f9('0x3d')](handleError(_0x2bf401,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 5c1c6ca..1a6a389 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 _0xf078=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','lodash','../../config/logger','api'];(function(_0x3ffc78,_0x351dca){var _0x24e1fd=function(_0x1cc49f){while(--_0x1cc49f){_0x3ffc78['push'](_0x3ffc78['shift']());}};_0x24e1fd(++_0x351dca);}(_0xf078,0xda));var _0x8f07=function(_0x4520c9,_0xa9e124){_0x4520c9=_0x4520c9-0x0;var _0x250fc1=_0xf078[_0x4520c9];return _0x250fc1;};'use strict';var _=require(_0x8f07('0x0'));var util=require('util');var logger=require(_0x8f07('0x1'))(_0x8f07('0x2'));var moment=require(_0x8f07('0x3'));var BPromise=require(_0x8f07('0x4'));var rp=require(_0x8f07('0x5'));var fs=require('fs');var path=require(_0x8f07('0x6'));var rimraf=require(_0x8f07('0x7'));var config=require(_0x8f07('0x8'));var attributes=require(_0x8f07('0x9'));module[_0x8f07('0xa')]=function(_0x10932a,_0x9c45bb){return _0x10932a[_0x8f07('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x8f07('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e89=['moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0x5e89,0x1af));var _0x95e8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5e89[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x95e8('0x0'));var util=require(_0x95e8('0x1'));var logger=require(_0x95e8('0x2'))('api');var moment=require(_0x95e8('0x3'));var BPromise=require(_0x95e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95e8('0x5'));var rimraf=require(_0x95e8('0x6'));var config=require(_0x95e8('0x7'));var attributes=require(_0x95e8('0x8'));module[_0x95e8('0x9')]=function(_0x4fc9c3,_0x2cb3aa){return _0x4fc9c3[_0x95e8('0xa')](_0x95e8('0xb'),attributes,{'tableName':_0x95e8('0xc'),'paranoid':![],'indexes':[{'fields':[_0x95e8('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 07de8d4..dc92d31 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 _0x625a=['message','result','catch','CreateVoiceAgentReport','body','options','raw','then','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x55c8e3,_0x4addd4){var _0x7e6c2c=function(_0x8a08f2){while(--_0x8a08f2){_0x55c8e3['push'](_0x55c8e3['shift']());}};_0x7e6c2c(++_0x4addd4);}(_0x625a,0xc3));var _0xa625=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x625a[_0x175a55];return _0x167adf;};'use strict';var _=require(_0xa625('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa625('0x1'));var fs=require('fs');var Redis=require(_0xa625('0x2'));var db=require(_0xa625('0x3'))['db'];var utils=require(_0xa625('0x4'));var logger=require(_0xa625('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa625('0x6')][_0xa625('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31061e,_0x45d233,_0x1b8fcf){return new BPromise(function(_0x47617a,_0x5c0d10){return client[_0xa625('0x8')](_0x31061e,_0x1b8fcf)['then'](function(_0x5332eb){logger[_0xa625('0x9')](_0xa625('0xa'),_0x45d233,_0xa625('0xb'));logger['debug'](_0xa625('0xc'),_0x45d233,'request\x20sent',JSON['stringify'](_0x5332eb));if(_0x5332eb['error']){if(_0x5332eb['error'][_0xa625('0xd')]===0x1f4){logger[_0xa625('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x45d233,_0x5332eb['error']['message']);return _0x5c0d10(_0x5332eb[_0xa625('0xe')][_0xa625('0xf')]);}logger[_0xa625('0xe')](_0xa625('0xa'),_0x45d233,_0x5332eb[_0xa625('0xe')][_0xa625('0xf')]);return _0x47617a(_0x5332eb[_0xa625('0xe')][_0xa625('0xf')]);}else{logger['info'](_0xa625('0xa'),_0x45d233,_0xa625('0xb'));_0x47617a(_0x5332eb[_0xa625('0x10')][_0xa625('0xf')]);}})[_0xa625('0x11')](function(_0x4e201b){logger[_0xa625('0xe')](_0xa625('0xa'),_0x45d233,_0x4e201b);_0x5c0d10(_0x4e201b);});});}exports[_0xa625('0x12')]=function(_0x3364ce){var _0x5ac426=this;return new Promise(function(_0x5b19b4,_0x574d2f){return db['VoiceAgentReport']['create'](_0x3364ce[_0xa625('0x13')],{'raw':_0x3364ce[_0xa625('0x14')]?_0x3364ce['options'][_0xa625('0x15')]===undefined?!![]:![]:!![]})[_0xa625('0x16')](function(_0x513e4a){logger[_0xa625('0x9')](_0xa625('0x12'),_0x3364ce);logger['debug'](_0xa625('0x12'),_0x3364ce,JSON[_0xa625('0x17')](_0x513e4a));_0x5b19b4(_0x513e4a);})[_0xa625('0x11')](function(_0x5ba127){logger[_0xa625('0xe')]('CreateVoiceAgentReport',_0x5ba127[_0xa625('0xf')],_0x3364ce);_0x574d2f(_0x5ac426['error'](0x1f4,_0x5ba127[_0xa625('0xf')]));});});};exports[_0xa625('0x18')]=function(_0x27c0cb){var _0x5e1b14=this;return new Promise(function(_0x5c4b9a,_0x4ae26a){return db[_0xa625('0x19')][_0xa625('0x1a')](_0x27c0cb[_0xa625('0x13')],{'raw':_0x27c0cb[_0xa625('0x14')]?_0x27c0cb['options'][_0xa625('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27c0cb['options']?_0x27c0cb[_0xa625('0x14')]['where']||null:null,'attributes':_0x27c0cb[_0xa625('0x14')]?_0x27c0cb[_0xa625('0x14')][_0xa625('0x1b')]||null:null,'limit':_0x27c0cb[_0xa625('0x14')]?_0x27c0cb[_0xa625('0x14')][_0xa625('0x1c')]||null:null})[_0xa625('0x16')](function(_0xfab870){logger[_0xa625('0x9')](_0xa625('0x18'),_0x27c0cb);logger[_0xa625('0x1d')](_0xa625('0x18'),_0x27c0cb,JSON[_0xa625('0x17')](_0xfab870));_0x5c4b9a(_0xfab870);})[_0xa625('0x11')](function(_0x4318af){logger[_0xa625('0xe')](_0xa625('0x18'),_0x4318af['message'],_0x27c0cb);_0x4ae26a(_0x5e1b14['error'](0x1f4,_0x4318af['message']));});});}; \ No newline at end of file +var _0x6020=['catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x340fc7,_0x12a901){var _0x586c93=function(_0xc3a679){while(--_0xc3a679){_0x340fc7['push'](_0x340fc7['shift']());}};_0x586c93(++_0x12a901);}(_0x6020,0xeb));var _0x0602=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0x6020[_0x867b0a];return _0x137438;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0602('0x0'));var rs=require(_0x0602('0x1'));var fs=require('fs');var Redis=require(_0x0602('0x2'));var db=require(_0x0602('0x3'))['db'];var utils=require(_0x0602('0x4'));var logger=require(_0x0602('0x5'))(_0x0602('0x6'));var config=require(_0x0602('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0602('0x8')][_0x0602('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x513385,_0x47badb,_0x3e6292){return new BPromise(function(_0x1739ba,_0x1b40b6){return client[_0x0602('0xa')](_0x513385,_0x3e6292)[_0x0602('0xb')](function(_0x32b166){logger[_0x0602('0xc')](_0x0602('0xd'),_0x47badb,_0x0602('0xe'));logger[_0x0602('0xf')](_0x0602('0x10'),_0x47badb,_0x0602('0xe'),JSON[_0x0602('0x11')](_0x32b166));if(_0x32b166[_0x0602('0x12')]){if(_0x32b166[_0x0602('0x12')][_0x0602('0x13')]===0x1f4){logger[_0x0602('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x47badb,_0x32b166['error']['message']);return _0x1b40b6(_0x32b166[_0x0602('0x12')]['message']);}logger[_0x0602('0x12')](_0x0602('0xd'),_0x47badb,_0x32b166[_0x0602('0x12')][_0x0602('0x14')]);return _0x1739ba(_0x32b166[_0x0602('0x12')][_0x0602('0x14')]);}else{logger[_0x0602('0xc')](_0x0602('0xd'),_0x47badb,_0x0602('0xe'));_0x1739ba(_0x32b166['result'][_0x0602('0x14')]);}})[_0x0602('0x15')](function(_0x344dad){logger[_0x0602('0x12')](_0x0602('0xd'),_0x47badb,_0x344dad);_0x1b40b6(_0x344dad);});});}exports['CreateVoiceAgentReport']=function(_0x1b6c3d){var _0x3fb3d2=this;return new Promise(function(_0x467e39,_0x137896){return db[_0x0602('0x16')][_0x0602('0x17')](_0x1b6c3d[_0x0602('0x18')],{'raw':_0x1b6c3d[_0x0602('0x19')]?_0x1b6c3d[_0x0602('0x19')][_0x0602('0x1a')]===undefined?!![]:![]:!![]})[_0x0602('0xb')](function(_0x1e520f){logger[_0x0602('0xc')](_0x0602('0x1b'),_0x1b6c3d);logger[_0x0602('0xf')]('CreateVoiceAgentReport',_0x1b6c3d,JSON[_0x0602('0x11')](_0x1e520f));_0x467e39(_0x1e520f);})[_0x0602('0x15')](function(_0x3ef2a8){logger[_0x0602('0x12')](_0x0602('0x1b'),_0x3ef2a8[_0x0602('0x14')],_0x1b6c3d);_0x137896(_0x3fb3d2[_0x0602('0x12')](0x1f4,_0x3ef2a8['message']));});});};exports[_0x0602('0x1c')]=function(_0xf9c5d1){var _0x4f2b30=this;return new Promise(function(_0x12143f,_0x831fd5){return db[_0x0602('0x16')][_0x0602('0x1d')](_0xf9c5d1['body'],{'raw':_0xf9c5d1[_0x0602('0x19')]?_0xf9c5d1[_0x0602('0x19')][_0x0602('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf9c5d1[_0x0602('0x19')]?_0xf9c5d1['options'][_0x0602('0x1e')]||null:null,'attributes':_0xf9c5d1[_0x0602('0x19')]?_0xf9c5d1[_0x0602('0x19')][_0x0602('0x1f')]||null:null,'limit':_0xf9c5d1[_0x0602('0x19')]?_0xf9c5d1[_0x0602('0x19')]['limit']||null:null})[_0x0602('0xb')](function(_0xd5db50){logger[_0x0602('0xc')](_0x0602('0x1c'),_0xf9c5d1);logger[_0x0602('0xf')](_0x0602('0x1c'),_0xf9c5d1,JSON[_0x0602('0x11')](_0xd5db50));_0x12143f(_0xd5db50);})[_0x0602('0x15')](function(_0x1daade){logger[_0x0602('0x12')](_0x0602('0x1c'),_0x1daade['message'],_0xf9c5d1);_0x831fd5(_0x4f2b30[_0x0602('0x12')](0x1f4,_0x1daade[_0x0602('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b567072..195a59e 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 _0x57bb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1a4e06,_0x442dcd){var _0x19c18f=function(_0x20984d){while(--_0x20984d){_0x1a4e06['push'](_0x1a4e06['shift']());}};_0x19c18f(++_0x442dcd);}(_0x57bb,0x9e));var _0xb57b=function(_0x20656f,_0x640262){_0x20656f=_0x20656f-0x0;var _0x51b7f0=_0x57bb[_0x20656f];return _0x51b7f0;};'use strict';var multer=require('multer');var util=require(_0xb57b('0x0'));var path=require('path');var timeout=require(_0xb57b('0x1'));var express=require(_0xb57b('0x2'));var router=express[_0xb57b('0x3')]();var auth=require(_0xb57b('0x4'));var interaction=require(_0xb57b('0x5'));var config=require(_0xb57b('0x6'));var controller=require(_0xb57b('0x7'));router[_0xb57b('0x8')]('/',auth[_0xb57b('0x9')](),controller[_0xb57b('0xa')]);router[_0xb57b('0x8')](_0xb57b('0xb'),auth[_0xb57b('0x9')](),controller['describe']);router['get'](_0xb57b('0xc'),auth[_0xb57b('0x9')](),controller[_0xb57b('0xd')]);router[_0xb57b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb57b('0xf')](_0xb57b('0xc'),auth['isAuthenticated'](),controller[_0xb57b('0x10')]);router[_0xb57b('0x11')](_0xb57b('0xc'),auth[_0xb57b('0x9')](),controller[_0xb57b('0x12')]);module[_0xb57b('0x13')]=router; \ No newline at end of file +var _0x675d=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x510639,_0xa5572){var _0x4cd834=function(_0x346c13){while(--_0x346c13){_0x510639['push'](_0x510639['shift']());}};_0x4cd834(++_0xa5572);}(_0x675d,0x168));var _0xd675=function(_0x46920a,_0x545790){_0x46920a=_0x46920a-0x0;var _0x2327b8=_0x675d[_0x46920a];return _0x2327b8;};'use strict';var multer=require(_0xd675('0x0'));var util=require(_0xd675('0x1'));var path=require(_0xd675('0x2'));var timeout=require('connect-timeout');var express=require(_0xd675('0x3'));var router=express[_0xd675('0x4')]();var auth=require(_0xd675('0x5'));var interaction=require(_0xd675('0x6'));var config=require('../../config/environment');var controller=require(_0xd675('0x7'));router[_0xd675('0x8')]('/',auth[_0xd675('0x9')](),controller[_0xd675('0xa')]);router[_0xd675('0x8')]('/describe',auth[_0xd675('0x9')](),controller['describe']);router['get'](_0xd675('0xb'),auth[_0xd675('0x9')](),controller[_0xd675('0xc')]);router[_0xd675('0xd')]('/',auth[_0xd675('0x9')](),controller[_0xd675('0xe')]);router[_0xd675('0xf')](_0xd675('0xb'),auth['isAuthenticated'](),controller[_0xd675('0x10')]);router[_0xd675('0x11')](_0xd675('0xb'),auth[_0xd675('0x9')](),controller[_0xd675('0x12')]);module[_0xd675('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 37be49d..e228b9a 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 _0x44e8=['outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound'];(function(_0xc60642,_0x3c9b87){var _0x4cb127=function(_0x110456){while(--_0x110456){_0xc60642['push'](_0xc60642['shift']());}};_0x4cb127(++_0x3c9b87);}(_0x44e8,0xd7));var _0x844e=function(_0x5eb6bb,_0x380b64){_0x5eb6bb=_0x5eb6bb-0x0;var _0x25a477=_0x44e8[_0x5eb6bb];return _0x25a477;};'use strict';var Sequelize=require(_0x844e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x844e('0x1')](_0x844e('0x2'),_0x844e('0x3'),_0x844e('0x4'),'inbound-fax',_0x844e('0x5'),_0x844e('0x6'))},'tag':{'type':Sequelize[_0x844e('0x7')]},'accountcode':{'type':Sequelize[_0x844e('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x844e('0x7')]},'destinationcontext':{'type':Sequelize[_0x844e('0x7')]},'callerid':{'type':Sequelize[_0x844e('0x7')]},'channel':{'type':Sequelize[_0x844e('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x844e('0x7')]},'lastdata':{'type':Sequelize[_0x844e('0x8')]},'starttime':{'type':Sequelize[_0x844e('0x9')]},'systemanswertime':{'type':Sequelize[_0x844e('0x9')]},'answertime':{'type':Sequelize[_0x844e('0x9')]},'endtime':{'type':Sequelize[_0x844e('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x844e('0xa')]},'mohtime':{'type':Sequelize[_0x844e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x844e('0x7')]},'amaflags':{'type':Sequelize[_0x844e('0x7')]},'userfield':{'type':Sequelize[_0x844e('0x7')]},'userDisposition':{'type':Sequelize[_0x844e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x844e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x844e('0x7')]},'prefix':{'type':Sequelize[_0x844e('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x844e('0x7')]}}; \ No newline at end of file +var _0xcb66=['inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM'];(function(_0x589d80,_0x2568eb){var _0x241bf1=function(_0x47437b){while(--_0x47437b){_0x589d80['push'](_0x589d80['shift']());}};_0x241bf1(++_0x2568eb);}(_0xcb66,0x19f));var _0x6cb6=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xcb66[_0x4de877];return _0xb2cfeb;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'uniqueid':{'type':Sequelize[_0x6cb6('0x1')]},'type':{'type':Sequelize[_0x6cb6('0x2')](_0x6cb6('0x3'),_0x6cb6('0x4'),'outbound',_0x6cb6('0x5'),_0x6cb6('0x6'),_0x6cb6('0x7'))},'tag':{'type':Sequelize[_0x6cb6('0x1')]},'accountcode':{'type':Sequelize[_0x6cb6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x6cb6('0x1')]},'callerid':{'type':Sequelize[_0x6cb6('0x1')]},'channel':{'type':Sequelize[_0x6cb6('0x1')]},'destinationchannel':{'type':Sequelize[_0x6cb6('0x1')]},'lastapplication':{'type':Sequelize[_0x6cb6('0x1')]},'lastdata':{'type':Sequelize[_0x6cb6('0x8')]},'starttime':{'type':Sequelize[_0x6cb6('0x9')]},'systemanswertime':{'type':Sequelize[_0x6cb6('0x9')]},'answertime':{'type':Sequelize[_0x6cb6('0x9')]},'endtime':{'type':Sequelize[_0x6cb6('0x9')]},'duration':{'type':Sequelize[_0x6cb6('0xa')]},'billableseconds':{'type':Sequelize[_0x6cb6('0xa')]},'mohtime':{'type':Sequelize[_0x6cb6('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x6cb6('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x6cb6('0x1')]},'note':{'type':Sequelize[_0x6cb6('0x1')]},'prefix':{'type':Sequelize[_0x6cb6('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6cb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4e04d43..fb70291 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 45842dd..3a91587 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 _0x4ccf=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment'];(function(_0x4d29eb,_0x5ba766){var _0x53cadb=function(_0x121326){while(--_0x121326){_0x4d29eb['push'](_0x4d29eb['shift']());}};_0x53cadb(++_0x5ba766);}(_0x4ccf,0x109));var _0xf4cc=function(_0x4d8eb0,_0x118f89){_0x4d8eb0=_0x4d8eb0-0x0;var _0x3ed5d6=_0x4ccf[_0x4d8eb0];return _0x3ed5d6;};'use strict';var _=require(_0xf4cc('0x0'));var util=require(_0xf4cc('0x1'));var logger=require(_0xf4cc('0x2'))(_0xf4cc('0x3'));var moment=require(_0xf4cc('0x4'));var BPromise=require(_0xf4cc('0x5'));var rp=require(_0xf4cc('0x6'));var fs=require('fs');var path=require(_0xf4cc('0x7'));var rimraf=require(_0xf4cc('0x8'));var config=require(_0xf4cc('0x9'));var attributes=require(_0xf4cc('0xa'));module[_0xf4cc('0xb')]=function(_0x429903,_0x330b7d){return _0x429903[_0xf4cc('0xc')](_0xf4cc('0xd'),attributes,{'tableName':_0xf4cc('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3672=['../../config/logger','api','moment','request-promise','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x3672,0xaf));var _0x2367=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0x3672[_0x51cc1d];return _0x2eb9f2;};'use strict';var _=require(_0x2367('0x0'));var util=require('util');var logger=require(_0x2367('0x1'))(_0x2367('0x2'));var moment=require(_0x2367('0x3'));var BPromise=require('bluebird');var rp=require(_0x2367('0x4'));var fs=require('fs');var path=require(_0x2367('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2367('0x6'));module[_0x2367('0x7')]=function(_0x742633,_0x5cb413){return _0x742633[_0x2367('0x8')](_0x2367('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2367('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b52d9a8..ebbecc1 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 _0x314d=['request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVoiceCallReport','options','where','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','VoiceCallReport,\x20%s,\x20%s'];(function(_0x1c14be,_0x433192){var _0x1f0fa7=function(_0xcecf72){while(--_0xcecf72){_0x1c14be['push'](_0x1c14be['shift']());}};_0x1f0fa7(++_0x433192);}(_0x314d,0x198));var _0xd314=function(_0x27f359,_0x45fce6){_0x27f359=_0x27f359-0x0;var _0x4044d4=_0x314d[_0x27f359];return _0x4044d4;};'use strict';var _=require(_0xd314('0x0'));var util=require(_0xd314('0x1'));var moment=require(_0xd314('0x2'));var BPromise=require(_0xd314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd314('0x4'));var db=require(_0xd314('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd314('0x6'));var config=require(_0xd314('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd314('0x8')][_0xd314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x440bd6,_0x25b363,_0x41c318){return new BPromise(function(_0x3df937,_0x36158f){return client['request'](_0x440bd6,_0x41c318)[_0xd314('0xa')](function(_0x2742da){logger['info'](_0xd314('0xb'),_0x25b363,_0xd314('0xc'));logger[_0xd314('0xd')](_0xd314('0xe'),_0x25b363,_0xd314('0xc'),JSON[_0xd314('0xf')](_0x2742da));if(_0x2742da['error']){if(_0x2742da['error']['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x25b363,_0x2742da[_0xd314('0x10')]['message']);return _0x36158f(_0x2742da[_0xd314('0x10')][_0xd314('0x11')]);}logger[_0xd314('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x25b363,_0x2742da[_0xd314('0x10')][_0xd314('0x11')]);return _0x3df937(_0x2742da[_0xd314('0x10')][_0xd314('0x11')]);}else{logger[_0xd314('0x12')](_0xd314('0xb'),_0x25b363,_0xd314('0xc'));_0x3df937(_0x2742da['result'][_0xd314('0x11')]);}})[_0xd314('0x13')](function(_0x5bb35d){logger[_0xd314('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x25b363,_0x5bb35d);_0x36158f(_0x5bb35d);});});}exports[_0xd314('0x14')]=function(_0x7e4ede){var _0x3f4d5c=this;return new Promise(function(_0x1a1599,_0x54cfea){return db['VoiceCallReport']['findAll']({'raw':_0x7e4ede['options']?_0x7e4ede[_0xd314('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x7e4ede[_0xd314('0x15')]?_0x7e4ede[_0xd314('0x15')][_0xd314('0x16')]||null:null,'attributes':_0x7e4ede[_0xd314('0x15')]?_0x7e4ede[_0xd314('0x15')][_0xd314('0x17')]||null:null,'limit':_0x7e4ede[_0xd314('0x15')]?_0x7e4ede[_0xd314('0x15')]['limit']||null:null,'include':_0x7e4ede[_0xd314('0x15')]?_0x7e4ede[_0xd314('0x15')][_0xd314('0x18')]?_[_0xd314('0x19')](_0x7e4ede[_0xd314('0x15')]['include'],function(_0x11cdb5){return{'model':db[_0x11cdb5['model']],'as':_0x11cdb5['as'],'attributes':_0x11cdb5[_0xd314('0x17')],'include':_0x11cdb5[_0xd314('0x18')]?_['map'](_0x11cdb5[_0xd314('0x18')],function(_0x11eafc){return{'model':db[_0x11eafc[_0xd314('0x1a')]],'as':_0x11eafc['as'],'attributes':_0x11eafc['attributes'],'include':_0x11eafc[_0xd314('0x18')]?_[_0xd314('0x19')](_0x11eafc[_0xd314('0x18')],function(_0x166963){return{'model':db[_0x166963[_0xd314('0x1a')]],'as':_0x166963['as'],'attributes':_0x166963[_0xd314('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd314('0xa')](function(_0x39b4e8){logger[_0xd314('0x12')](_0xd314('0x14'),_0x7e4ede);logger['debug'](_0xd314('0x14'),_0x7e4ede,JSON[_0xd314('0xf')](_0x39b4e8));_0x1a1599(_0x39b4e8);})[_0xd314('0x13')](function(_0x5c4791){logger['error'](_0xd314('0x14'),_0x5c4791['message'],_0x7e4ede);_0x54cfea(_0x3f4d5c[_0xd314('0x10')](0x1f4,_0x5c4791['message']));});});};exports[_0xd314('0x1b')]=function(_0x427eb8){var _0x1c9ff1=this;return new Promise(function(_0x3a8935,_0x436ec2){return db[_0xd314('0x1c')][_0xd314('0x1d')](_0x427eb8[_0xd314('0x1e')],{'raw':_0x427eb8['options']?_0x427eb8['options'][_0xd314('0x1f')]===undefined?!![]:![]:!![]})[_0xd314('0xa')](function(_0x325ea0){logger[_0xd314('0x12')](_0xd314('0x1b'),_0x427eb8);logger[_0xd314('0xd')]('CreateVoiceCallReport',_0x427eb8,JSON[_0xd314('0xf')](_0x325ea0));_0x3a8935(_0x325ea0);})[_0xd314('0x13')](function(_0x49ea5d){logger[_0xd314('0x10')](_0xd314('0x1b'),_0x49ea5d['message'],_0x427eb8);_0x436ec2(_0x1c9ff1['error'](0x1f4,_0x49ea5d['message']));});});};exports[_0xd314('0x20')]=function(_0x344c7d){var _0xaa2b19=this;return new Promise(function(_0x593feb,_0x548d90){return db[_0xd314('0x1c')][_0xd314('0x21')](_0x344c7d['body'],{'raw':_0x344c7d[_0xd314('0x15')]?_0x344c7d['options'][_0xd314('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344c7d[_0xd314('0x15')]?_0x344c7d[_0xd314('0x15')][_0xd314('0x16')]||null:null,'attributes':_0x344c7d[_0xd314('0x15')]?_0x344c7d['options'][_0xd314('0x17')]||null:null,'limit':_0x344c7d[_0xd314('0x15')]?_0x344c7d[_0xd314('0x15')][_0xd314('0x22')]||null:null})[_0xd314('0xa')](function(_0x411adb){logger[_0xd314('0x12')]('UpdateVoiceCallReport',_0x344c7d);logger['debug'](_0xd314('0x20'),_0x344c7d,JSON[_0xd314('0xf')](_0x411adb));_0x593feb(_0x411adb);})['catch'](function(_0x1ec873){logger[_0xd314('0x10')]('UpdateVoiceCallReport',_0x1ec873[_0xd314('0x11')],_0x344c7d);_0x548d90(_0xaa2b19[_0xd314('0x10')](0x1f4,_0x1ec873['message']));});});}; \ No newline at end of file +var _0xad2b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','where','include','map','model','attributes','catch','create','CreateVoiceCallReport','update','body','raw','limit','UpdateVoiceCallReport','util'];(function(_0x410d12,_0x92ed79){var _0x3eb9d1=function(_0x54bd00){while(--_0x54bd00){_0x410d12['push'](_0x410d12['shift']());}};_0x3eb9d1(++_0x92ed79);}(_0xad2b,0x9f));var _0xbad2=function(_0x2d6fa1,_0x4349fc){_0x2d6fa1=_0x2d6fa1-0x0;var _0x571ee8=_0xad2b[_0x2d6fa1];return _0x571ee8;};'use strict';var _=require('lodash');var util=require(_0xbad2('0x0'));var moment=require(_0xbad2('0x1'));var BPromise=require(_0xbad2('0x2'));var rs=require(_0xbad2('0x3'));var fs=require('fs');var Redis=require(_0xbad2('0x4'));var db=require(_0xbad2('0x5'))['db'];var utils=require(_0xbad2('0x6'));var logger=require(_0xbad2('0x7'))(_0xbad2('0x8'));var config=require('../../config/environment');var jayson=require(_0xbad2('0x9'));var client=jayson[_0xbad2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3ac8,_0x57812c,_0x4b111d){return new BPromise(function(_0x2a2f0b,_0x4795d9){return client[_0xbad2('0xb')](_0x4a3ac8,_0x4b111d)[_0xbad2('0xc')](function(_0x1573aa){logger[_0xbad2('0xd')](_0xbad2('0xe'),_0x57812c,_0xbad2('0xf'));logger[_0xbad2('0x10')](_0xbad2('0x11'),_0x57812c,_0xbad2('0xf'),JSON[_0xbad2('0x12')](_0x1573aa));if(_0x1573aa[_0xbad2('0x13')]){if(_0x1573aa['error'][_0xbad2('0x14')]===0x1f4){logger[_0xbad2('0x13')](_0xbad2('0xe'),_0x57812c,_0x1573aa[_0xbad2('0x13')][_0xbad2('0x15')]);return _0x4795d9(_0x1573aa[_0xbad2('0x13')][_0xbad2('0x15')]);}logger[_0xbad2('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x57812c,_0x1573aa[_0xbad2('0x13')][_0xbad2('0x15')]);return _0x2a2f0b(_0x1573aa[_0xbad2('0x13')][_0xbad2('0x15')]);}else{logger[_0xbad2('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x57812c,_0xbad2('0xf'));_0x2a2f0b(_0x1573aa[_0xbad2('0x16')][_0xbad2('0x15')]);}})['catch'](function(_0x29eb37){logger[_0xbad2('0x13')](_0xbad2('0xe'),_0x57812c,_0x29eb37);_0x4795d9(_0x29eb37);});});}exports[_0xbad2('0x17')]=function(_0x3818b1){var _0x2dcfea=this;return new Promise(function(_0x4a8a5a,_0x513d7c){return db[_0xbad2('0x18')][_0xbad2('0x19')]({'raw':_0x3818b1[_0xbad2('0x1a')]?_0x3818b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x3818b1[_0xbad2('0x1a')]?_0x3818b1[_0xbad2('0x1a')][_0xbad2('0x1b')]||null:null,'attributes':_0x3818b1['options']?_0x3818b1[_0xbad2('0x1a')]['attributes']||null:null,'limit':_0x3818b1[_0xbad2('0x1a')]?_0x3818b1[_0xbad2('0x1a')]['limit']||null:null,'include':_0x3818b1[_0xbad2('0x1a')]?_0x3818b1[_0xbad2('0x1a')][_0xbad2('0x1c')]?_[_0xbad2('0x1d')](_0x3818b1[_0xbad2('0x1a')][_0xbad2('0x1c')],function(_0x54957b){return{'model':db[_0x54957b['model']],'as':_0x54957b['as'],'attributes':_0x54957b['attributes'],'include':_0x54957b[_0xbad2('0x1c')]?_[_0xbad2('0x1d')](_0x54957b[_0xbad2('0x1c')],function(_0x4a652b){return{'model':db[_0x4a652b[_0xbad2('0x1e')]],'as':_0x4a652b['as'],'attributes':_0x4a652b[_0xbad2('0x1f')],'include':_0x4a652b[_0xbad2('0x1c')]?_[_0xbad2('0x1d')](_0x4a652b['include'],function(_0xa8b9dc){return{'model':db[_0xa8b9dc[_0xbad2('0x1e')]],'as':_0xa8b9dc['as'],'attributes':_0xa8b9dc[_0xbad2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbad2('0xc')](function(_0x4ff6b1){logger['info'](_0xbad2('0x17'),_0x3818b1);logger['debug']('GetVoiceCallReport',_0x3818b1,JSON['stringify'](_0x4ff6b1));_0x4a8a5a(_0x4ff6b1);})[_0xbad2('0x20')](function(_0x136ef9){logger[_0xbad2('0x13')]('GetVoiceCallReport',_0x136ef9['message'],_0x3818b1);_0x513d7c(_0x2dcfea['error'](0x1f4,_0x136ef9[_0xbad2('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0x40daed){var _0x53a4fb=this;return new Promise(function(_0x356a7e,_0x3f3e61){return db[_0xbad2('0x18')][_0xbad2('0x21')](_0x40daed['body'],{'raw':_0x40daed['options']?_0x40daed[_0xbad2('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x276a77){logger[_0xbad2('0xd')](_0xbad2('0x22'),_0x40daed);logger['debug'](_0xbad2('0x22'),_0x40daed,JSON[_0xbad2('0x12')](_0x276a77));_0x356a7e(_0x276a77);})['catch'](function(_0x19a915){logger[_0xbad2('0x13')]('CreateVoiceCallReport',_0x19a915['message'],_0x40daed);_0x3f3e61(_0x53a4fb[_0xbad2('0x13')](0x1f4,_0x19a915[_0xbad2('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3d4383){var _0x5797f5=this;return new Promise(function(_0x1c6f3d,_0xc93268){return db['VoiceCallReport'][_0xbad2('0x23')](_0x3d4383[_0xbad2('0x24')],{'raw':_0x3d4383[_0xbad2('0x1a')]?_0x3d4383[_0xbad2('0x1a')][_0xbad2('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d4383[_0xbad2('0x1a')]?_0x3d4383['options']['where']||null:null,'attributes':_0x3d4383[_0xbad2('0x1a')]?_0x3d4383[_0xbad2('0x1a')]['attributes']||null:null,'limit':_0x3d4383[_0xbad2('0x1a')]?_0x3d4383[_0xbad2('0x1a')][_0xbad2('0x26')]||null:null})[_0xbad2('0xc')](function(_0x180f4b){logger[_0xbad2('0xd')]('UpdateVoiceCallReport',_0x3d4383);logger[_0xbad2('0x10')](_0xbad2('0x27'),_0x3d4383,JSON[_0xbad2('0x12')](_0x180f4b));_0x1c6f3d(_0x180f4b);})[_0xbad2('0x20')](function(_0xb94303){logger[_0xbad2('0x13')](_0xbad2('0x27'),_0xb94303['message'],_0x3d4383);_0xc93268(_0x5797f5[_0xbad2('0x13')](0x1f4,_0xb94303[_0xbad2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 70a0567..9a6b5cc 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 _0x8463=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x44b50e,_0x33b6da){var _0x21a09b=function(_0x36429b){while(--_0x36429b){_0x44b50e['push'](_0x44b50e['shift']());}};_0x21a09b(++_0x33b6da);}(_0x8463,0x1b2));var _0x3846=function(_0x5eca75,_0x24425f){_0x5eca75=_0x5eca75-0x0;var _0x40b4ea=_0x8463[_0x5eca75];return _0x40b4ea;};'use strict';var multer=require(_0x3846('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3846('0x1'));var express=require(_0x3846('0x2'));var router=express[_0x3846('0x3')]();var auth=require(_0x3846('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3846('0x5'));router[_0x3846('0x6')]('/',auth[_0x3846('0x7')](),controller[_0x3846('0x8')]);router[_0x3846('0x6')](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xa')]);router[_0x3846('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xc')]);router[_0x3846('0xd')](_0x3846('0x9'),auth[_0x3846('0x7')](),controller[_0x3846('0xe')]);module[_0x3846('0xf')]=router; \ No newline at end of file +var _0x9664=['post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x46d372,_0x230bf6){var _0x2d9eac=function(_0x469432){while(--_0x469432){_0x46d372['push'](_0x46d372['shift']());}};_0x2d9eac(++_0x230bf6);}(_0x9664,0x126));var _0x4966=function(_0x169e07,_0x4250a0){_0x169e07=_0x169e07-0x0;var _0x58146e=_0x9664[_0x169e07];return _0x58146e;};'use strict';var multer=require(_0x4966('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4966('0x1'));var express=require(_0x4966('0x2'));var router=express[_0x4966('0x3')]();var auth=require(_0x4966('0x4'));var interaction=require(_0x4966('0x5'));var config=require(_0x4966('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x4966('0x7')]('/',auth['isAuthenticated'](),controller[_0x4966('0x8')]);router[_0x4966('0x7')](_0x4966('0x9'),auth[_0x4966('0xa')](),controller[_0x4966('0xb')]);router[_0x4966('0xc')]('/',auth[_0x4966('0xa')](),controller[_0x4966('0xd')]);router[_0x4966('0xe')](_0x4966('0x9'),auth['isAuthenticated'](),controller[_0x4966('0xf')]);router[_0x4966('0x10')](_0x4966('0x9'),auth['isAuthenticated'](),controller[_0x4966('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ca06795..70a4d4f 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 _0xb4b1=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x49ca2e,_0x251d13){var _0x202b97=function(_0x1edbf6){while(--_0x1edbf6){_0x49ca2e['push'](_0x49ca2e['shift']());}};_0x202b97(++_0x251d13);}(_0xb4b1,0x18a));var _0x1b4b=function(_0x2ed232,_0x38ddf4){_0x2ed232=_0x2ed232-0x0;var _0x2c8b78=_0xb4b1[_0x2ed232];return _0x2c8b78;};'use strict';var Sequelize=require(_0x1b4b('0x0'));module[_0x1b4b('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1b4b('0x2')],'unique':_0x1b4b('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1b4b('0x2')],'set':function(_0x413806){this[_0x1b4b('0x4')](_0x1b4b('0x5'),_0x413806?_0x413806[_0x1b4b('0x6')](''):[]);},'get':function(){return this[_0x1b4b('0x7')](_0x1b4b('0x5'))?this[_0x1b4b('0x7')](_0x1b4b('0x5'))[_0x1b4b('0x8')](''):[];}},'auth':{'type':Sequelize[_0x1b4b('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x1b4b('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1b4b('0x2')]},'description':{'type':Sequelize[_0x1b4b('0x2')]}}; \ No newline at end of file +var _0xd94f=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd94f,0x104));var _0xfd94=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xd94f[_0x258fb0];return _0x4d1afe;};'use strict';var Sequelize=require(_0xfd94('0x0'));module[_0xfd94('0x1')]={'name':{'type':Sequelize[_0xfd94('0x2')]},'prefix':{'type':Sequelize[_0xfd94('0x2')],'unique':_0xfd94('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xfd94('0x2')],'set':function(_0x55a19b){this[_0xfd94('0x4')]('options',_0x55a19b?_0x55a19b[_0xfd94('0x5')](''):[]);},'get':function(){return this[_0xfd94('0x6')](_0xfd94('0x7'))?this['getDataValue'](_0xfd94('0x7'))[_0xfd94('0x8')](''):[];}},'auth':{'type':Sequelize[_0xfd94('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xfd94('0x2')]},'record':{'type':Sequelize[_0xfd94('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xfd94('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c230e52..0798099 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 _0xd920=['request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','rows','show','params','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd920,0xe9));var _0x0d92=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0xd920[_0x5517c0];return _0x33803b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d92('0x0'));var rimraf=require(_0x0d92('0x1'));var zipdir=require(_0x0d92('0x2'));var jsonpatch=require(_0x0d92('0x3'));var rp=require(_0x0d92('0x4'));var moment=require('moment');var BPromise=require(_0x0d92('0x5'));var Mustache=require(_0x0d92('0x6'));var util=require(_0x0d92('0x7'));var path=require(_0x0d92('0x8'));var sox=require('sox');var csv=require(_0x0d92('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0d92('0xa'));var crypto=require(_0x0d92('0xb'));var jsforce=require(_0x0d92('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d92('0xd'));var authService=require(_0x0d92('0xe'));var qs=require(_0x0d92('0xf'));var as=require(_0x0d92('0x10'));var hardwareService=require(_0x0d92('0x11'));var logger=require(_0x0d92('0x12'))(_0x0d92('0x13'));var utils=require('../../config/utils');var config=require(_0x0d92('0x14'));var licenseUtil=require(_0x0d92('0x15'));var db=require(_0x0d92('0x16'))['db'];function respondWithStatusCode(_0x12e2be,_0x4e2df0){_0x4e2df0=_0x4e2df0||0xcc;return function(_0x15aa8d){if(_0x15aa8d){return _0x12e2be[_0x0d92('0x17')](_0x4e2df0);}return _0x12e2be[_0x0d92('0x18')](_0x4e2df0)['end']();};}function respondWithResult(_0x57257e,_0x2d127e){_0x2d127e=_0x2d127e||0xc8;return function(_0x456d5c){if(_0x456d5c){return _0x57257e[_0x0d92('0x18')](_0x2d127e)[_0x0d92('0x19')](_0x456d5c);}};}function respondWithFilteredResult(_0x9c6120,_0x1e798c){return function(_0x3083b1){if(_0x3083b1){var _0x364013=_0x3083b1['count'],_0x3f123c=_0x1e798c['offset'],_0x226590=_0x1e798c[_0x0d92('0x1a')]+_0x1e798c[_0x0d92('0x1b')],_0x7d1afc;if(_0x226590>=_0x364013){_0x226590=_0x364013;_0x7d1afc=0xc8;}else{_0x7d1afc=0xce;}_0x9c6120[_0x0d92('0x18')](_0x7d1afc);return _0x9c6120[_0x0d92('0x1c')](_0x0d92('0x1d'),_0x3f123c+'-'+_0x226590+'/'+_0x364013)[_0x0d92('0x19')](_0x3083b1);}return null;};}function patchUpdates(_0x1943ed){return function(_0x59dfbb){try{jsonpatch['apply'](_0x59dfbb,_0x1943ed,!![]);}catch(_0x118029){return BPromise[_0x0d92('0x1e')](_0x118029);}return _0x59dfbb[_0x0d92('0x1f')]();};}function saveUpdates(_0x1214af,_0x22c8b7){return function(_0x15b66a){if(_0x15b66a){return _0x15b66a[_0x0d92('0x20')](_0x1214af)[_0x0d92('0x21')](function(_0x59ea40){return _0x59ea40;});}return null;};}function removeEntity(_0x1ca224,_0x86eb57){return function(_0x159deb){if(_0x159deb){return _0x159deb['destroy']()[_0x0d92('0x21')](function(){var _0x4177f3=_0x159deb[_0x0d92('0x22')]({'plain':!![]});var _0xf823c='ChanSpies';return db[_0x0d92('0x23')][_0x0d92('0x24')]({'where':{'type':_0xf823c,'resourceId':_0x4177f3['id']}})['then'](function(){return _0x159deb;});})[_0x0d92('0x21')](function(){_0x1ca224[_0x0d92('0x18')](0xcc)[_0x0d92('0x25')]();});}};}function handleEntityNotFound(_0x16a9d4,_0x1d70c7){return function(_0x37d155){if(!_0x37d155){_0x16a9d4[_0x0d92('0x17')](0x194);}return _0x37d155;};}function handleError(_0x4e4f5d,_0x24322e){_0x24322e=_0x24322e||0x1f4;return function(_0x3d988b){logger[_0x0d92('0x26')](_0x3d988b[_0x0d92('0x27')]);if(_0x3d988b[_0x0d92('0x28')]){delete _0x3d988b[_0x0d92('0x28')];}_0x4e4f5d[_0x0d92('0x18')](_0x24322e)[_0x0d92('0x29')](_0x3d988b);};}exports[_0x0d92('0x2a')]=function(_0x5b8fe9,_0x3973f7){var _0x3a1f93={},_0x38050a={},_0x16a747={'count':0x0,'rows':[]};var _0x547d6a=_[_0x0d92('0x2b')](db[_0x0d92('0x2c')]['rawAttributes'],function(_0x371b5c){return{'name':_0x371b5c[_0x0d92('0x2d')],'type':_0x371b5c[_0x0d92('0x2e')]['key']};});_0x38050a[_0x0d92('0x2f')]=_[_0x0d92('0x2b')](_0x547d6a,_0x0d92('0x28'));_0x38050a[_0x0d92('0x30')]=_[_0x0d92('0x31')](_0x5b8fe9[_0x0d92('0x30')]);_0x38050a[_0x0d92('0x32')]=_[_0x0d92('0x33')](_0x38050a[_0x0d92('0x2f')],_0x38050a[_0x0d92('0x30')]);_0x3a1f93['attributes']=_[_0x0d92('0x33')](_0x38050a[_0x0d92('0x2f')],qs['fields'](_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x34')]));_0x3a1f93[_0x0d92('0x35')]=_0x3a1f93[_0x0d92('0x35')][_0x0d92('0x36')]?_0x3a1f93[_0x0d92('0x35')]:_0x38050a[_0x0d92('0x2f')];if(!_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x37')](_0x0d92('0x38'))){_0x3a1f93[_0x0d92('0x1b')]=qs[_0x0d92('0x1b')](_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x1b')]);_0x3a1f93[_0x0d92('0x1a')]=qs[_0x0d92('0x1a')](_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x1a')]);}_0x3a1f93[_0x0d92('0x39')]=qs['sort'](_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x3a')]);_0x3a1f93[_0x0d92('0x3b')]=qs[_0x0d92('0x32')](_[_0x0d92('0x3c')](_0x5b8fe9['query'],_0x38050a['filters']),_0x547d6a);if(_0x5b8fe9[_0x0d92('0x30')]['filter']){_0x3a1f93[_0x0d92('0x3b')]=_[_0x0d92('0x3d')](_0x3a1f93['where'],{'$or':_['map'](_0x547d6a,function(_0x5ae1c6){if(_0x5ae1c6[_0x0d92('0x2e')]!=='VIRTUAL'){var _0x2f8325={};_0x2f8325[_0x5ae1c6['name']]={'$like':'%'+_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x3e')]+'%'};return _0x2f8325;}})});}_0x3a1f93=_[_0x0d92('0x3d')]({},_0x3a1f93,_0x5b8fe9['options']);var _0x4f5db3={'where':_0x3a1f93['where']};return db[_0x0d92('0x2c')][_0x0d92('0x3f')](_0x4f5db3)[_0x0d92('0x21')](function(_0x1376a2){_0x16a747[_0x0d92('0x3f')]=_0x1376a2;if(_0x5b8fe9[_0x0d92('0x30')][_0x0d92('0x40')]){_0x3a1f93[_0x0d92('0x41')]=[{'all':!![]}];}return db[_0x0d92('0x2c')]['findAll'](_0x3a1f93);})[_0x0d92('0x21')](function(_0x2b3240){_0x16a747[_0x0d92('0x42')]=_0x2b3240;return _0x16a747;})[_0x0d92('0x21')](respondWithFilteredResult(_0x3973f7,_0x3a1f93))['catch'](handleError(_0x3973f7,null));};exports[_0x0d92('0x43')]=function(_0x5ec81f,_0x1a0909){var _0x1894a6={'raw':![],'where':{'id':_0x5ec81f[_0x0d92('0x44')]['id']}},_0x5b5ef8={};_0x5b5ef8[_0x0d92('0x2f')]=_[_0x0d92('0x31')](db['VoiceChanSpy']['rawAttributes']);_0x5b5ef8['query']=_[_0x0d92('0x31')](_0x5ec81f[_0x0d92('0x30')]);_0x5b5ef8[_0x0d92('0x32')]=_[_0x0d92('0x33')](_0x5b5ef8[_0x0d92('0x2f')],_0x5b5ef8[_0x0d92('0x30')]);_0x1894a6['attributes']=_[_0x0d92('0x33')](_0x5b5ef8[_0x0d92('0x2f')],qs['fields'](_0x5ec81f[_0x0d92('0x30')][_0x0d92('0x34')]));_0x1894a6[_0x0d92('0x35')]=_0x1894a6['attributes'][_0x0d92('0x36')]?_0x1894a6[_0x0d92('0x35')]:_0x5b5ef8[_0x0d92('0x2f')];if(_0x5ec81f[_0x0d92('0x30')][_0x0d92('0x40')]){_0x1894a6[_0x0d92('0x41')]=[{'all':!![]}];}_0x1894a6=_[_0x0d92('0x3d')]({},_0x1894a6,_0x5ec81f[_0x0d92('0x45')]);return db[_0x0d92('0x2c')][_0x0d92('0x46')](_0x1894a6)[_0x0d92('0x21')](handleEntityNotFound(_0x1a0909,null))[_0x0d92('0x21')](respondWithResult(_0x1a0909,null))[_0x0d92('0x47')](handleError(_0x1a0909,null));};exports[_0x0d92('0x48')]=function(_0x2b1cbe,_0x409bda){return db[_0x0d92('0x2c')][_0x0d92('0x48')](_0x2b1cbe[_0x0d92('0x49')],{})[_0x0d92('0x21')](function(_0x30ec68){var _0x29d061=_0x2b1cbe['user'][_0x0d92('0x22')]({'plain':!![]});if(!_0x29d061)throw new Error(_0x0d92('0x4a'));if(_0x29d061[_0x0d92('0x4b')]===_0x0d92('0x4c')){var _0x2ca2ff=_0x30ec68['get']({'plain':!![]});var _0x4e58ab=_0x0d92('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x4e58ab,'userProfileId':_0x29d061['userProfileId']},'raw':!![]})[_0x0d92('0x21')](function(_0x212dbb){if(_0x212dbb&&_0x212dbb['autoAssociation']===0x0){return db[_0x0d92('0x23')][_0x0d92('0x48')]({'name':_0x2ca2ff[_0x0d92('0x28')],'resourceId':_0x2ca2ff['id'],'type':_0x212dbb[_0x0d92('0x28')],'sectionId':_0x212dbb['id']},{})[_0x0d92('0x21')](function(){return _0x30ec68;});}else{return _0x30ec68;}})[_0x0d92('0x47')](function(_0x1839ee){logger[_0x0d92('0x26')](_0x0d92('0x4e'),_0x1839ee);throw _0x1839ee;});}return _0x30ec68;})['then'](respondWithResult(_0x409bda,0xc9))[_0x0d92('0x47')](handleError(_0x409bda,null));};exports[_0x0d92('0x20')]=function(_0x5dd03f,_0x1aaad8){if(_0x5dd03f[_0x0d92('0x49')]['id']){delete _0x5dd03f[_0x0d92('0x49')]['id'];}return db[_0x0d92('0x2c')][_0x0d92('0x46')]({'where':{'id':_0x5dd03f[_0x0d92('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aaad8,null))['then'](saveUpdates(_0x5dd03f[_0x0d92('0x49')],null))[_0x0d92('0x21')](respondWithResult(_0x1aaad8,null))[_0x0d92('0x47')](handleError(_0x1aaad8,null));};exports['destroy']=function(_0x1144c4,_0x33b264){return db[_0x0d92('0x2c')][_0x0d92('0x46')]({'where':{'id':_0x1144c4[_0x0d92('0x44')]['id']}})[_0x0d92('0x21')](handleEntityNotFound(_0x33b264,null))[_0x0d92('0x21')](removeEntity(_0x33b264,null))[_0x0d92('0x47')](handleError(_0x33b264,null));}; \ No newline at end of file +var _0xf02b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','findAll','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x293a6b,_0x3b9ede){var _0x2d371c=function(_0x2b115a){while(--_0x2b115a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x2d371c(++_0x3b9ede);}(_0xf02b,0xe4));var _0xbf02=function(_0x555164,_0x13e97c){_0x555164=_0x555164-0x0;var _0x541861=_0xf02b[_0x555164];return _0x541861;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf02('0x0'));var rimraf=require(_0xbf02('0x1'));var zipdir=require(_0xbf02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf02('0x3'));var moment=require(_0xbf02('0x4'));var BPromise=require(_0xbf02('0x5'));var Mustache=require(_0xbf02('0x6'));var util=require(_0xbf02('0x7'));var path=require(_0xbf02('0x8'));var sox=require(_0xbf02('0x9'));var csv=require(_0xbf02('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf02('0xb'));var squel=require(_0xbf02('0xc'));var crypto=require(_0xbf02('0xd'));var jsforce=require(_0xbf02('0xe'));var deskjs=require(_0xbf02('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf02('0x10'));var Redis=require(_0xbf02('0x11'));var authService=require(_0xbf02('0x12'));var qs=require(_0xbf02('0x13'));var as=require(_0xbf02('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf02('0x15'))(_0xbf02('0x16'));var utils=require(_0xbf02('0x17'));var config=require(_0xbf02('0x18'));var licenseUtil=require(_0xbf02('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc671,_0x385353){_0x385353=_0x385353||0xcc;return function(_0x25cea6){if(_0x25cea6){return _0x4fc671[_0xbf02('0x1a')](_0x385353);}return _0x4fc671['status'](_0x385353)[_0xbf02('0x1b')]();};}function respondWithResult(_0x1aeaa6,_0x44d1c7){_0x44d1c7=_0x44d1c7||0xc8;return function(_0x5d1747){if(_0x5d1747){return _0x1aeaa6['status'](_0x44d1c7)[_0xbf02('0x1c')](_0x5d1747);}};}function respondWithFilteredResult(_0x4370c9,_0x141ac0){return function(_0x932e1a){if(_0x932e1a){var _0x1a0944=_0x932e1a[_0xbf02('0x1d')],_0x20cf03=_0x141ac0[_0xbf02('0x1e')],_0x5a1727=_0x141ac0[_0xbf02('0x1e')]+_0x141ac0[_0xbf02('0x1f')],_0x7bdbe3;if(_0x5a1727>=_0x1a0944){_0x5a1727=_0x1a0944;_0x7bdbe3=0xc8;}else{_0x7bdbe3=0xce;}_0x4370c9[_0xbf02('0x20')](_0x7bdbe3);return _0x4370c9['set']('Content-Range',_0x20cf03+'-'+_0x5a1727+'/'+_0x1a0944)[_0xbf02('0x1c')](_0x932e1a);}return null;};}function patchUpdates(_0x51ea81){return function(_0x5eee29){try{jsonpatch[_0xbf02('0x21')](_0x5eee29,_0x51ea81,!![]);}catch(_0x11600d){return BPromise[_0xbf02('0x22')](_0x11600d);}return _0x5eee29[_0xbf02('0x23')]();};}function saveUpdates(_0x9726c,_0x5aaa31){return function(_0x4ae61d){if(_0x4ae61d){return _0x4ae61d[_0xbf02('0x24')](_0x9726c)[_0xbf02('0x25')](function(_0x3070e3){return _0x3070e3;});}return null;};}function removeEntity(_0x2f7be3,_0x10abf8){return function(_0x3fc5be){if(_0x3fc5be){return _0x3fc5be[_0xbf02('0x26')]()[_0xbf02('0x25')](function(){var _0x41310d=_0x3fc5be[_0xbf02('0x27')]({'plain':!![]});var _0x13439c=_0xbf02('0x28');return db[_0xbf02('0x29')][_0xbf02('0x26')]({'where':{'type':_0x13439c,'resourceId':_0x41310d['id']}})['then'](function(){return _0x3fc5be;});})['then'](function(){_0x2f7be3[_0xbf02('0x20')](0xcc)[_0xbf02('0x1b')]();});}};}function handleEntityNotFound(_0x88200c,_0x1cbcfa){return function(_0x2f472b){if(!_0x2f472b){_0x88200c[_0xbf02('0x1a')](0x194);}return _0x2f472b;};}function handleError(_0xea5e0c,_0x50ed64){_0x50ed64=_0x50ed64||0x1f4;return function(_0xcca945){logger[_0xbf02('0x2a')](_0xcca945[_0xbf02('0x2b')]);if(_0xcca945[_0xbf02('0x2c')]){delete _0xcca945[_0xbf02('0x2c')];}_0xea5e0c['status'](_0x50ed64)['send'](_0xcca945);};}exports[_0xbf02('0x2d')]=function(_0x26c4f4,_0x5e37c9){var _0x1970dc={},_0x5d244b={},_0x427814={'count':0x0,'rows':[]};var _0x3e66ea=_[_0xbf02('0x2e')](db['VoiceChanSpy'][_0xbf02('0x2f')],function(_0x34bdb3){return{'name':_0x34bdb3['fieldName'],'type':_0x34bdb3[_0xbf02('0x30')][_0xbf02('0x31')]};});_0x5d244b['model']=_[_0xbf02('0x2e')](_0x3e66ea,_0xbf02('0x2c'));_0x5d244b[_0xbf02('0x32')]=_[_0xbf02('0x33')](_0x26c4f4[_0xbf02('0x32')]);_0x5d244b[_0xbf02('0x34')]=_[_0xbf02('0x35')](_0x5d244b['model'],_0x5d244b[_0xbf02('0x32')]);_0x1970dc['attributes']=_['intersection'](_0x5d244b[_0xbf02('0x36')],qs[_0xbf02('0x37')](_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x37')]));_0x1970dc[_0xbf02('0x38')]=_0x1970dc[_0xbf02('0x38')]['length']?_0x1970dc['attributes']:_0x5d244b['model'];if(!_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x39')](_0xbf02('0x3a'))){_0x1970dc[_0xbf02('0x1f')]=qs[_0xbf02('0x1f')](_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x1f')]);_0x1970dc['offset']=qs[_0xbf02('0x1e')](_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x1e')]);}_0x1970dc[_0xbf02('0x3b')]=qs[_0xbf02('0x3c')](_0x26c4f4[_0xbf02('0x32')]['sort']);_0x1970dc[_0xbf02('0x3d')]=qs[_0xbf02('0x34')](_[_0xbf02('0x3e')](_0x26c4f4['query'],_0x5d244b[_0xbf02('0x34')]),_0x3e66ea);if(_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x3f')]){_0x1970dc['where']=_[_0xbf02('0x40')](_0x1970dc['where'],{'$or':_[_0xbf02('0x2e')](_0x3e66ea,function(_0xb2c7c9){if(_0xb2c7c9[_0xbf02('0x30')]!==_0xbf02('0x41')){var _0x25fdbe={};_0x25fdbe[_0xb2c7c9['name']]={'$like':'%'+_0x26c4f4[_0xbf02('0x32')][_0xbf02('0x3f')]+'%'};return _0x25fdbe;}})});}_0x1970dc=_[_0xbf02('0x40')]({},_0x1970dc,_0x26c4f4['options']);var _0x45846e={'where':_0x1970dc[_0xbf02('0x3d')]};return db[_0xbf02('0x42')][_0xbf02('0x1d')](_0x45846e)['then'](function(_0x426be8){_0x427814[_0xbf02('0x1d')]=_0x426be8;if(_0x26c4f4[_0xbf02('0x32')]['includeAll']){_0x1970dc['include']=[{'all':!![]}];}return db[_0xbf02('0x42')][_0xbf02('0x43')](_0x1970dc);})[_0xbf02('0x25')](function(_0x847b3d){_0x427814['rows']=_0x847b3d;return _0x427814;})['then'](respondWithFilteredResult(_0x5e37c9,_0x1970dc))[_0xbf02('0x44')](handleError(_0x5e37c9,null));};exports[_0xbf02('0x45')]=function(_0x35911e,_0x2da07e){var _0x1eae53={'raw':![],'where':{'id':_0x35911e[_0xbf02('0x46')]['id']}},_0x38c18e={};_0x38c18e[_0xbf02('0x36')]=_[_0xbf02('0x33')](db[_0xbf02('0x42')][_0xbf02('0x2f')]);_0x38c18e[_0xbf02('0x32')]=_[_0xbf02('0x33')](_0x35911e[_0xbf02('0x32')]);_0x38c18e['filters']=_[_0xbf02('0x35')](_0x38c18e['model'],_0x38c18e[_0xbf02('0x32')]);_0x1eae53[_0xbf02('0x38')]=_[_0xbf02('0x35')](_0x38c18e[_0xbf02('0x36')],qs['fields'](_0x35911e[_0xbf02('0x32')][_0xbf02('0x37')]));_0x1eae53[_0xbf02('0x38')]=_0x1eae53[_0xbf02('0x38')][_0xbf02('0x47')]?_0x1eae53[_0xbf02('0x38')]:_0x38c18e[_0xbf02('0x36')];if(_0x35911e[_0xbf02('0x32')]['includeAll']){_0x1eae53[_0xbf02('0x48')]=[{'all':!![]}];}_0x1eae53=_[_0xbf02('0x40')]({},_0x1eae53,_0x35911e['options']);return db[_0xbf02('0x42')][_0xbf02('0x49')](_0x1eae53)[_0xbf02('0x25')](handleEntityNotFound(_0x2da07e,null))['then'](respondWithResult(_0x2da07e,null))[_0xbf02('0x44')](handleError(_0x2da07e,null));};exports[_0xbf02('0x4a')]=function(_0x426596,_0x346ced){return db[_0xbf02('0x42')]['create'](_0x426596[_0xbf02('0x4b')],{})['then'](function(_0x31c789){var _0xcde09b=_0x426596[_0xbf02('0x4c')][_0xbf02('0x27')]({'plain':!![]});if(!_0xcde09b)throw new Error(_0xbf02('0x4d'));if(_0xcde09b[_0xbf02('0x4e')]===_0xbf02('0x4c')){var _0xd94090=_0x31c789[_0xbf02('0x27')]({'plain':!![]});var _0x5b9cc9=_0xbf02('0x28');return db[_0xbf02('0x4f')]['find']({'where':{'name':_0x5b9cc9,'userProfileId':_0xcde09b[_0xbf02('0x50')]},'raw':!![]})['then'](function(_0x4561c0){if(_0x4561c0&&_0x4561c0[_0xbf02('0x51')]===0x0){return db[_0xbf02('0x29')][_0xbf02('0x4a')]({'name':_0xd94090[_0xbf02('0x2c')],'resourceId':_0xd94090['id'],'type':_0x4561c0['name'],'sectionId':_0x4561c0['id']},{})['then'](function(){return _0x31c789;});}else{return _0x31c789;}})[_0xbf02('0x44')](function(_0x5f2272){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f2272);throw _0x5f2272;});}return _0x31c789;})[_0xbf02('0x25')](respondWithResult(_0x346ced,0xc9))[_0xbf02('0x44')](handleError(_0x346ced,null));};exports[_0xbf02('0x24')]=function(_0x41f363,_0x37176f){if(_0x41f363[_0xbf02('0x4b')]['id']){delete _0x41f363[_0xbf02('0x4b')]['id'];}return db[_0xbf02('0x42')][_0xbf02('0x49')]({'where':{'id':_0x41f363[_0xbf02('0x46')]['id']}})[_0xbf02('0x25')](handleEntityNotFound(_0x37176f,null))[_0xbf02('0x25')](saveUpdates(_0x41f363['body'],null))[_0xbf02('0x25')](respondWithResult(_0x37176f,null))[_0xbf02('0x44')](handleError(_0x37176f,null));};exports['destroy']=function(_0xc7bbac,_0x212b71){return db[_0xbf02('0x42')][_0xbf02('0x49')]({'where':{'id':_0xc7bbac[_0xbf02('0x46')]['id']}})[_0xbf02('0x25')](handleEntityNotFound(_0x212b71,null))[_0xbf02('0x25')](removeEntity(_0x212b71,null))[_0xbf02('0x44')](handleError(_0x212b71,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b91270f..96082b8 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 _0xf46a=['join','record','length','internal','concat','findAll','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46a,0xa4));var _0xaf46=function(_0x48c6f5,_0x142083){_0x48c6f5=_0x48c6f5-0x0;var _0x582d04=_0xf46a[_0x48c6f5];return _0x582d04;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var BPromise=require(_0xaf46('0x1'));var attributes=require(_0xaf46('0x2'));var getUserApplications=function(_0x571132,_0xf4ff9e,_0x3a7936){var _0x53059e=0x1;var _0x14a6b6=[];var _0x34c69d={'context':_0xf4ff9e[_0xaf46('0x3')]||_0xaf46('0x4'),'exten':util[_0xaf46('0x5')](_0xaf46('0x6'),_0x571132[_0xaf46('0x7')],_0x3a7936),'type':_0xaf46('0x8'),'isApp':![],'ChanSpyId':_0x571132['id'],'UserId':_0xf4ff9e['id']};_0x14a6b6[_0xaf46('0x9')](_[_0xaf46('0xa')]({'app':_0xaf46('0xb'),'appdata':util['format'](_0xaf46('0xc'),'chanspy'),'priority':_0x53059e++},_0x34c69d));if(_0x571132['record']){_0x14a6b6['push'](_[_0xaf46('0xa')]({'app':_0xaf46('0xd'),'appdata':util['format'](_0xaf46('0xe'),_0x571132[_0xaf46('0xf')]),'priority':_0x53059e++},_0x34c69d));}if(_0x571132[_0xaf46('0x10')]){_0x14a6b6['push'](_[_0xaf46('0xa')]({'app':'Authenticate','appdata':_0x571132[_0xaf46('0x11')],'priority':_0x53059e++},_0x34c69d));}_0x14a6b6['push'](_[_0xaf46('0xa')]({'app':'ChanSpy','appdata':util[_0xaf46('0x5')](_0xaf46('0x12'),_0xf4ff9e[_0xaf46('0x13')],_0x571132[_0xaf46('0x14')]?_0x571132[_0xaf46('0x14')][_0xaf46('0x15')](''):''),'priority':_0x53059e++},_0x34c69d));if(_0x571132[_0xaf46('0x16')]){_0x14a6b6[_0xaf46('0x9')](_['merge']({'app':'StopMixMonitor','priority':_0x53059e++},_0x34c69d));}return _0x14a6b6;};var getChanSpyApplications=function(_0x5819e3,_0x1693e4){var _0x5bccdf=[];for(var _0x498720=0x0,_0x1d91ca=0x1;_0x498720<_0x1693e4[_0xaf46('0x17')];_0x498720++,_0x1d91ca=0x1){_0x5bccdf=_0x5bccdf['concat'](getUserApplications(_0x5819e3,_0x1693e4[_0x498720],_0x1693e4[_0x498720][_0xaf46('0x18')]));if(_0x1693e4[_0x498720][_0xaf46('0x18')]!=_0x1693e4[_0x498720][_0xaf46('0x13')]){_0x5bccdf=_0x5bccdf[_0xaf46('0x19')](getUserApplications(_0x5819e3,_0x1693e4[_0x498720],_0x1693e4[_0x498720][_0xaf46('0x13')]));}}return _0x5bccdf;};var getChanSpyPromise=function(_0x682c8,_0x52e5c8){return new BPromise(function(_0x260a5e,_0x110d51){return _0x682c8['User'][_0xaf46('0x1a')]({'attributes':['id',_0xaf46('0x13'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x307386){if(_0x307386){return _0x260a5e(getChanSpyApplications(_0x52e5c8,_0x307386));}return _0x260a5e([]);})[_0xaf46('0x1b')](function(_0x4d1c36){_0x110d51(_0x4d1c36);});});};module[_0xaf46('0x1c')]=function(_0x539489,_0x2baa52){var _0x31915a=_0x539489[_0xaf46('0x1d')];return _0x539489[_0xaf46('0x1e')](_0xaf46('0x1f'),attributes,{'tableName':_0xaf46('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x166a0e,_0x119a98,_0xabed9f){return getChanSpyPromise(_0x31915a,_0x166a0e)[_0xaf46('0x21')](function(_0x4fa802){if(_0x4fa802&&_0x4fa802['length']){return _0x31915a[_0xaf46('0x22')][_0xaf46('0x23')](_0x4fa802);}})[_0xaf46('0x21')](function(){_0xabed9f();})[_0xaf46('0x1b')](function(_0x102c92){_0xabed9f(_0x102c92);});},'afterUpdate':function(_0x144238,_0x2b4c69,_0x2363c4){return _0x31915a['VoiceExtension'][_0xaf46('0x24')]({'where':{'ChanSpyId':_0x144238['id']}})[_0xaf46('0x21')](function(){return getChanSpyPromise(_0x31915a,_0x144238);})['then'](function(_0x1cee17){if(_0x1cee17&&_0x1cee17[_0xaf46('0x17')]){return _0x31915a[_0xaf46('0x22')][_0xaf46('0x23')](_0x1cee17);}})[_0xaf46('0x21')](function(){_0x2363c4();})[_0xaf46('0x1b')](function(_0x57246b){_0x2363c4(_0x57246b);});},'afterDestroy':function(_0x707155,_0x15cba5,_0x5eb4e1){return _0x31915a[_0xaf46('0x22')][_0xaf46('0x24')]({'where':{'ChanSpyId':_0x707155['id']}})[_0xaf46('0x21')](function(){_0x5eb4e1();})[_0xaf46('0x1b')](function(_0x19f29a){_0x5eb4e1(_0x19f29a);});}}});}; \ No newline at end of file +var _0xb16f=['recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','util','bluebird','prefix','push','Set','format','merge','MixMonitor','${UNIQUEID}.%s,a'];(function(_0x18063f,_0x3efbaf){var _0x116771=function(_0x366444){while(--_0x366444){_0x18063f['push'](_0x18063f['shift']());}};_0x116771(++_0x3efbaf);}(_0xb16f,0xf6));var _0xfb16=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0xb16f[_0xc8a11];return _0x55a500;};'use strict';var _=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var BPromise=require(_0xfb16('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x144a71,_0x4483aa,_0x402009){var _0x262e26=0x1;var _0x5caa17=[];var _0x21fee8={'context':_0x4483aa['context']||'from-sip','exten':util['format']('%s%s',_0x144a71[_0xfb16('0x3')],_0x402009),'type':'system','isApp':![],'ChanSpyId':_0x144a71['id'],'UserId':_0x4483aa['id']};_0x5caa17[_0xfb16('0x4')](_['merge']({'app':_0xfb16('0x5'),'appdata':util[_0xfb16('0x6')]('CDR(type)=%s','chanspy'),'priority':_0x262e26++},_0x21fee8));if(_0x144a71['record']){_0x5caa17[_0xfb16('0x4')](_[_0xfb16('0x7')]({'app':_0xfb16('0x8'),'appdata':util[_0xfb16('0x6')](_0xfb16('0x9'),_0x144a71[_0xfb16('0xa')]),'priority':_0x262e26++},_0x21fee8));}if(_0x144a71[_0xfb16('0xb')]){_0x5caa17[_0xfb16('0x4')](_[_0xfb16('0x7')]({'app':_0xfb16('0xc'),'appdata':_0x144a71[_0xfb16('0xd')],'priority':_0x262e26++},_0x21fee8));}_0x5caa17['push'](_[_0xfb16('0x7')]({'app':'ChanSpy','appdata':util['format'](_0xfb16('0xe'),_0x4483aa[_0xfb16('0xf')],_0x144a71[_0xfb16('0x10')]?_0x144a71['options'][_0xfb16('0x11')](''):''),'priority':_0x262e26++},_0x21fee8));if(_0x144a71[_0xfb16('0x12')]){_0x5caa17[_0xfb16('0x4')](_[_0xfb16('0x7')]({'app':_0xfb16('0x13'),'priority':_0x262e26++},_0x21fee8));}return _0x5caa17;};var getChanSpyApplications=function(_0xcf5a5,_0x11a5d0){var _0x111191=[];for(var _0x384f74=0x0,_0x161228=0x1;_0x384f74<_0x11a5d0[_0xfb16('0x14')];_0x384f74++,_0x161228=0x1){_0x111191=_0x111191[_0xfb16('0x15')](getUserApplications(_0xcf5a5,_0x11a5d0[_0x384f74],_0x11a5d0[_0x384f74][_0xfb16('0x16')]));if(_0x11a5d0[_0x384f74][_0xfb16('0x16')]!=_0x11a5d0[_0x384f74]['name']){_0x111191=_0x111191[_0xfb16('0x15')](getUserApplications(_0xcf5a5,_0x11a5d0[_0x384f74],_0x11a5d0[_0x384f74][_0xfb16('0xf')]));}}return _0x111191;};var getChanSpyPromise=function(_0x3d5899,_0x5af84a){return new BPromise(function(_0x5e1ffd,_0xcdb9de){return _0x3d5899[_0xfb16('0x17')][_0xfb16('0x18')]({'attributes':['id','name',_0xfb16('0x16')],'where':{'role':_0xfb16('0x19'),'chanspy':!![]},'raw':!![]})[_0xfb16('0x1a')](function(_0x509e70){if(_0x509e70){return _0x5e1ffd(getChanSpyApplications(_0x5af84a,_0x509e70));}return _0x5e1ffd([]);})['catch'](function(_0x544b4b){_0xcdb9de(_0x544b4b);});});};module[_0xfb16('0x1b')]=function(_0x354ef4,_0x39ec10){var _0x1b13ac=_0x354ef4['models'];return _0x354ef4['define'](_0xfb16('0x1c'),attributes,{'tableName':_0xfb16('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c1fa3,_0x294afe,_0xb4efe0){return getChanSpyPromise(_0x1b13ac,_0x2c1fa3)[_0xfb16('0x1a')](function(_0x15b3b8){if(_0x15b3b8&&_0x15b3b8[_0xfb16('0x14')]){return _0x1b13ac[_0xfb16('0x1e')][_0xfb16('0x1f')](_0x15b3b8);}})[_0xfb16('0x1a')](function(){_0xb4efe0();})['catch'](function(_0x1ca17b){_0xb4efe0(_0x1ca17b);});},'afterUpdate':function(_0x15f0e4,_0xbaed19,_0x1c2a40){return _0x1b13ac[_0xfb16('0x1e')]['destroy']({'where':{'ChanSpyId':_0x15f0e4['id']}})[_0xfb16('0x1a')](function(){return getChanSpyPromise(_0x1b13ac,_0x15f0e4);})['then'](function(_0x407379){if(_0x407379&&_0x407379[_0xfb16('0x14')]){return _0x1b13ac[_0xfb16('0x1e')][_0xfb16('0x1f')](_0x407379);}})[_0xfb16('0x1a')](function(){_0x1c2a40();})['catch'](function(_0x1386d2){_0x1c2a40(_0x1386d2);});},'afterDestroy':function(_0x5df5a4,_0x548f18,_0x4f40ce){return _0x1b13ac[_0xfb16('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5df5a4['id']}})['then'](function(){_0x4f40ce();})['catch'](function(_0x204c38){_0x4f40ce(_0x204c38);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 76570db..4634fee 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 _0xbfda=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xaf68a7,_0xf757bf){var _0x5dcb5e=function(_0x2f7ea1){while(--_0x2f7ea1){_0xaf68a7['push'](_0xaf68a7['shift']());}};_0x5dcb5e(++_0xf757bf);}(_0xbfda,0x119));var _0xabfd=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xbfda[_0x1ca890];return _0x3f8e01;};'use strict';var _=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var moment=require(_0xabfd('0x2'));var BPromise=require(_0xabfd('0x3'));var rs=require(_0xabfd('0x4'));var fs=require('fs');var Redis=require(_0xabfd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabfd('0x6'));var logger=require(_0xabfd('0x7'))(_0xabfd('0x8'));var config=require(_0xabfd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xabfd('0xa')][_0xabfd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f08f8,_0x4ba416,_0x44d8b6){return new BPromise(function(_0x466604,_0x24a5d3){return client['request'](_0x5f08f8,_0x44d8b6)[_0xabfd('0xc')](function(_0x218d75){logger[_0xabfd('0xd')](_0xabfd('0xe'),_0x4ba416,_0xabfd('0xf'));logger[_0xabfd('0x10')](_0xabfd('0x11'),_0x4ba416,_0xabfd('0xf'),JSON[_0xabfd('0x12')](_0x218d75));if(_0x218d75['error']){if(_0x218d75['error']['code']===0x1f4){logger[_0xabfd('0x13')](_0xabfd('0xe'),_0x4ba416,_0x218d75[_0xabfd('0x13')]['message']);return _0x24a5d3(_0x218d75[_0xabfd('0x13')]['message']);}logger[_0xabfd('0x13')](_0xabfd('0xe'),_0x4ba416,_0x218d75[_0xabfd('0x13')][_0xabfd('0x14')]);return _0x466604(_0x218d75[_0xabfd('0x13')][_0xabfd('0x14')]);}else{logger[_0xabfd('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ba416,'request\x20sent');_0x466604(_0x218d75[_0xabfd('0x15')]['message']);}})['catch'](function(_0xc8e8d7){logger[_0xabfd('0x13')](_0xabfd('0xe'),_0x4ba416,_0xc8e8d7);_0x24a5d3(_0xc8e8d7);});});} \ No newline at end of file +var _0x93e8=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5d2523,_0x23fda8){var _0x10872b=function(_0x1d1fca){while(--_0x1d1fca){_0x5d2523['push'](_0x5d2523['shift']());}};_0x10872b(++_0x23fda8);}(_0x93e8,0x151));var _0x893e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x93e8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x893e('0x0'));var util=require(_0x893e('0x1'));var moment=require(_0x893e('0x2'));var BPromise=require('bluebird');var rs=require(_0x893e('0x3'));var fs=require('fs');var Redis=require(_0x893e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x893e('0x5'));var logger=require(_0x893e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x893e('0x7'));var client=jayson[_0x893e('0x8')][_0x893e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25edf1,_0x496ac8,_0x552593){return new BPromise(function(_0x91aac5,_0x289870){return client[_0x893e('0xa')](_0x25edf1,_0x552593)['then'](function(_0x23e8d2){logger[_0x893e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x496ac8,'request\x20sent');logger[_0x893e('0xc')](_0x893e('0xd'),_0x496ac8,_0x893e('0xe'),JSON[_0x893e('0xf')](_0x23e8d2));if(_0x23e8d2[_0x893e('0x10')]){if(_0x23e8d2[_0x893e('0x10')][_0x893e('0x11')]===0x1f4){logger[_0x893e('0x10')](_0x893e('0x12'),_0x496ac8,_0x23e8d2[_0x893e('0x10')][_0x893e('0x13')]);return _0x289870(_0x23e8d2[_0x893e('0x10')][_0x893e('0x13')]);}logger[_0x893e('0x10')](_0x893e('0x12'),_0x496ac8,_0x23e8d2['error'][_0x893e('0x13')]);return _0x91aac5(_0x23e8d2[_0x893e('0x10')][_0x893e('0x13')]);}else{logger[_0x893e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x496ac8,_0x893e('0xe'));_0x91aac5(_0x23e8d2[_0x893e('0x14')][_0x893e('0x13')]);}})[_0x893e('0x15')](function(_0x722e29){logger[_0x893e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x496ac8,_0x722e29);_0x289870(_0x722e29);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ffc5ebd..6cb1f65 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 _0x6514=['index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6514,0x14a));var _0x4651=function(_0x536e39,_0x1a80db){_0x536e39=_0x536e39-0x0;var _0x1844a1=_0x6514[_0x536e39];return _0x1844a1;};'use strict';var multer=require(_0x4651('0x0'));var util=require(_0x4651('0x1'));var path=require(_0x4651('0x2'));var timeout=require(_0x4651('0x3'));var express=require(_0x4651('0x4'));var router=express[_0x4651('0x5')]();var auth=require(_0x4651('0x6'));var interaction=require(_0x4651('0x7'));var config=require('../../config/environment');var controller=require(_0x4651('0x8'));router[_0x4651('0x9')]('/',auth['isAuthenticated'](),controller[_0x4651('0xa')]);router[_0x4651('0x9')]('/:id',auth[_0x4651('0xb')](),controller[_0x4651('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4651('0xd')]);router[_0x4651('0xe')](_0x4651('0xf'),auth[_0x4651('0xb')](),controller[_0x4651('0x10')]);router[_0x4651('0x11')](_0x4651('0xf'),auth[_0x4651('0xb')](),controller[_0x4651('0x12')]);module[_0x4651('0x13')]=router; \ No newline at end of file +var _0x3a73=['multer','util','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','create','update','delete','exports'];(function(_0x13a98d,_0x88b4e9){var _0x10b759=function(_0x5c0eea){while(--_0x5c0eea){_0x13a98d['push'](_0x13a98d['shift']());}};_0x10b759(++_0x88b4e9);}(_0x3a73,0x9a));var _0x33a7=function(_0x1e9a53,_0xb2c87e){_0x1e9a53=_0x1e9a53-0x0;var _0x134768=_0x3a73[_0x1e9a53];return _0x134768;};'use strict';var multer=require(_0x33a7('0x0'));var util=require(_0x33a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x33a7('0x2'));var router=express[_0x33a7('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x33a7('0x4'));var controller=require('./voiceContext.controller');router[_0x33a7('0x5')]('/',auth['isAuthenticated'](),controller[_0x33a7('0x6')]);router[_0x33a7('0x5')](_0x33a7('0x7'),auth[_0x33a7('0x8')](),controller[_0x33a7('0x9')]);router['post']('/',auth[_0x33a7('0x8')](),controller[_0x33a7('0xa')]);router['put'](_0x33a7('0x7'),auth[_0x33a7('0x8')](),controller[_0x33a7('0xb')]);router[_0x33a7('0xc')](_0x33a7('0x7'),auth[_0x33a7('0x8')](),controller['destroy']);module[_0x33a7('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6a205d1..048ca37 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(_0x3c0e6b,_0x3e81ce){var _0xa68156=function(_0x113fc3){while(--_0x113fc3){_0x3c0e6b['push'](_0x3c0e6b['shift']());}};_0xa68156(++_0x3e81ce);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x50b896,_0x1733f4){var _0x572e9e=function(_0x16e126){while(--_0x16e126){_0x50b896['push'](_0x50b896['shift']());}};_0x572e9e(++_0x1733f4);}(_0x34e8,0x12c));var _0x834e=function(_0xfb40e3,_0x4d448c){_0xfb40e3=_0xfb40e3-0x0;var _0x3d4d73=_0x34e8[_0xfb40e3];return _0x3d4d73;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 253f986..4f6c38e 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 _0x3f59=['join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','server/files/templates/context.ejs','utf8','chan_sip.so','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','VoiceContext','count','include','rows','show','params','includeAll','find','create','readFileSync'];(function(_0x53c861,_0x140c9c){var _0x417b7b=function(_0x495754){while(--_0x495754){_0x53c861['push'](_0x53c861['shift']());}};_0x417b7b(++_0x140c9c);}(_0x3f59,0x1b0));var _0x93f5=function(_0x39c453,_0x51ae71){_0x39c453=_0x39c453-0x0;var _0x5b1016=_0x3f59[_0x39c453];return _0x5b1016;};'use strict';var pdf=require(_0x93f5('0x0'));var emlformat=require(_0x93f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x93f5('0x2'));var jsonpatch=require(_0x93f5('0x3'));var rp=require(_0x93f5('0x4'));var moment=require(_0x93f5('0x5'));var BPromise=require(_0x93f5('0x6'));var Mustache=require(_0x93f5('0x7'));var util=require(_0x93f5('0x8'));var path=require(_0x93f5('0x9'));var sox=require(_0x93f5('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x93f5('0xb'));var squel=require(_0x93f5('0xc'));var crypto=require(_0x93f5('0xd'));var jsforce=require(_0x93f5('0xe'));var deskjs=require(_0x93f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f5('0x14'));var config=require(_0x93f5('0x15'));var licenseUtil=require(_0x93f5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x93f5('0x17'));var client=jayson['client'][_0x93f5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x107b90,_0x1cb030,_0x161fe1,_0x3d85da){return new BPromise(function(_0x45a275,_0x5d6001){var _0x108b11=_0x3d85da||client;return _0x108b11[_0x93f5('0x19')](_0x107b90,_0x161fe1)[_0x93f5('0x1a')](function(_0x2ab5ce){logger[_0x93f5('0x1b')](_0x93f5('0x1c'),_0x1cb030,_0x93f5('0x1d'));logger[_0x93f5('0x1e')](_0x93f5('0x1f'),_0x1cb030,_0x93f5('0x1d'),JSON[_0x93f5('0x20')](_0x2ab5ce));if(_0x2ab5ce[_0x93f5('0x21')]){if(_0x2ab5ce['error'][_0x93f5('0x22')]===0x1f4){logger[_0x93f5('0x21')](_0x93f5('0x1c'),_0x1cb030,_0x2ab5ce[_0x93f5('0x21')][_0x93f5('0x23')]);return _0x5d6001(_0x2ab5ce['error'][_0x93f5('0x23')]);}logger[_0x93f5('0x21')](_0x93f5('0x1c'),_0x1cb030,_0x2ab5ce[_0x93f5('0x21')][_0x93f5('0x23')]);return _0x45a275(_0x2ab5ce[_0x93f5('0x21')][_0x93f5('0x23')]);}else{logger[_0x93f5('0x1b')](_0x93f5('0x1c'),_0x1cb030,_0x93f5('0x1d'));_0x45a275(_0x2ab5ce[_0x93f5('0x24')][_0x93f5('0x23')]);}})[_0x93f5('0x25')](function(_0x5b1a1f){logger[_0x93f5('0x21')](_0x93f5('0x1c'),_0x1cb030,_0x5b1a1f);_0x5d6001(_0x5b1a1f);});});}function respondWithStatusCode(_0x34f8ce,_0x3ffe51){_0x3ffe51=_0x3ffe51||0xcc;return function(_0x365afd){if(_0x365afd){return _0x34f8ce[_0x93f5('0x26')](_0x3ffe51);}return _0x34f8ce['status'](_0x3ffe51)[_0x93f5('0x27')]();};}function respondWithResult(_0x2e035f,_0x54955f){_0x54955f=_0x54955f||0xc8;return function(_0x107d91){if(_0x107d91){return _0x2e035f[_0x93f5('0x28')](_0x54955f)['json'](_0x107d91);}};}function respondWithFilteredResult(_0x5bb7d3,_0x403b45){return function(_0x11e86c){if(_0x11e86c){var _0x469968=_0x11e86c['count'],_0x2dd1a2=_0x403b45[_0x93f5('0x29')],_0x5d71d4=_0x403b45[_0x93f5('0x29')]+_0x403b45['limit'],_0x2bc6d1;if(_0x5d71d4>=_0x469968){_0x5d71d4=_0x469968;_0x2bc6d1=0xc8;}else{_0x2bc6d1=0xce;}_0x5bb7d3[_0x93f5('0x28')](_0x2bc6d1);return _0x5bb7d3[_0x93f5('0x2a')](_0x93f5('0x2b'),_0x2dd1a2+'-'+_0x5d71d4+'/'+_0x469968)['json'](_0x11e86c);}return null;};}function patchUpdates(_0x3090a9){return function(_0x4883c6){try{jsonpatch[_0x93f5('0x2c')](_0x4883c6,_0x3090a9,!![]);}catch(_0x5c2ede){return BPromise[_0x93f5('0x2d')](_0x5c2ede);}return _0x4883c6[_0x93f5('0x2e')]();};}function saveUpdates(_0x4a7784,_0x1ce4ba){return function(_0x1c0dcd){if(_0x1c0dcd){return _0x1c0dcd[_0x93f5('0x2f')](_0x4a7784)[_0x93f5('0x1a')](function(_0x4e5cce){return _0x4e5cce;});}return null;};}function removeEntity(_0x4438c3,_0x584c7f){return function(_0x385e24){if(_0x385e24){return _0x385e24['destroy']()[_0x93f5('0x1a')](function(){var _0x399aba=_0x385e24[_0x93f5('0x30')]({'plain':!![]});var _0x15525b='Contexts';return db[_0x93f5('0x31')][_0x93f5('0x32')]({'where':{'type':_0x15525b,'resourceId':_0x399aba['id']}})[_0x93f5('0x1a')](function(){return _0x385e24;});})[_0x93f5('0x1a')](function(){_0x4438c3['status'](0xcc)[_0x93f5('0x27')]();});}};}function handleEntityNotFound(_0x4c63b9,_0x2f869e){return function(_0xb81382){if(!_0xb81382){_0x4c63b9[_0x93f5('0x26')](0x194);}return _0xb81382;};}function handleError(_0x32272b,_0x4e8166){_0x4e8166=_0x4e8166||0x1f4;return function(_0x11ea13){logger['error'](_0x11ea13[_0x93f5('0x33')]);if(_0x11ea13['name']){delete _0x11ea13['name'];}_0x32272b[_0x93f5('0x28')](_0x4e8166)[_0x93f5('0x34')](_0x11ea13);};}exports[_0x93f5('0x35')]=function(_0x4d64aa,_0x126f38){var _0x1977b1={},_0x4c026c={},_0x314230={'count':0x0,'rows':[]};var _0x58b19f=_[_0x93f5('0x36')](db['VoiceContext'][_0x93f5('0x37')],function(_0x2a8483){return{'name':_0x2a8483[_0x93f5('0x38')],'type':_0x2a8483[_0x93f5('0x39')][_0x93f5('0x3a')]};});_0x4c026c['model']=_[_0x93f5('0x36')](_0x58b19f,_0x93f5('0x3b'));_0x4c026c[_0x93f5('0x3c')]=_[_0x93f5('0x3d')](_0x4d64aa[_0x93f5('0x3c')]);_0x4c026c[_0x93f5('0x3e')]=_['intersection'](_0x4c026c[_0x93f5('0x3f')],_0x4c026c[_0x93f5('0x3c')]);_0x1977b1[_0x93f5('0x40')]=_[_0x93f5('0x41')](_0x4c026c[_0x93f5('0x3f')],qs[_0x93f5('0x42')](_0x4d64aa['query'][_0x93f5('0x42')]));_0x1977b1['attributes']=_0x1977b1[_0x93f5('0x40')][_0x93f5('0x43')]?_0x1977b1['attributes']:_0x4c026c[_0x93f5('0x3f')];if(!_0x4d64aa[_0x93f5('0x3c')][_0x93f5('0x44')](_0x93f5('0x45'))){_0x1977b1['limit']=qs[_0x93f5('0x46')](_0x4d64aa['query'][_0x93f5('0x46')]);_0x1977b1[_0x93f5('0x29')]=qs[_0x93f5('0x29')](_0x4d64aa[_0x93f5('0x3c')][_0x93f5('0x29')]);}_0x1977b1[_0x93f5('0x47')]=qs[_0x93f5('0x48')](_0x4d64aa['query'][_0x93f5('0x48')]);_0x1977b1[_0x93f5('0x49')]=qs[_0x93f5('0x3e')](_[_0x93f5('0x4a')](_0x4d64aa[_0x93f5('0x3c')],_0x4c026c[_0x93f5('0x3e')]),_0x58b19f);if(_0x4d64aa[_0x93f5('0x3c')][_0x93f5('0x4b')]){_0x1977b1['where']=_['merge'](_0x1977b1[_0x93f5('0x49')],{'$or':_['map'](_0x58b19f,function(_0x18ce7e){if(_0x18ce7e['type']!==_0x93f5('0x4c')){var _0x41acbb={};_0x41acbb[_0x18ce7e['name']]={'$like':'%'+_0x4d64aa['query'][_0x93f5('0x4b')]+'%'};return _0x41acbb;}})});}_0x1977b1=_['merge']({},_0x1977b1,_0x4d64aa[_0x93f5('0x4d')]);var _0x417edc={'where':_0x1977b1['where']};return db[_0x93f5('0x4e')][_0x93f5('0x4f')](_0x417edc)[_0x93f5('0x1a')](function(_0x3f8e86){_0x314230['count']=_0x3f8e86;if(_0x4d64aa[_0x93f5('0x3c')]['includeAll']){_0x1977b1[_0x93f5('0x50')]=[{'all':!![]}];}return db[_0x93f5('0x4e')]['findAll'](_0x1977b1);})['then'](function(_0x56919d){_0x314230[_0x93f5('0x51')]=_0x56919d;return _0x314230;})['then'](respondWithFilteredResult(_0x126f38,_0x1977b1))[_0x93f5('0x25')](handleError(_0x126f38,null));};exports[_0x93f5('0x52')]=function(_0xad4687,_0x576500){var _0x544091={'raw':![],'where':{'id':_0xad4687[_0x93f5('0x53')]['id']}},_0x1fc050={};_0x1fc050['model']=_[_0x93f5('0x3d')](db['VoiceContext'][_0x93f5('0x37')]);_0x1fc050[_0x93f5('0x3c')]=_[_0x93f5('0x3d')](_0xad4687[_0x93f5('0x3c')]);_0x1fc050[_0x93f5('0x3e')]=_[_0x93f5('0x41')](_0x1fc050[_0x93f5('0x3f')],_0x1fc050[_0x93f5('0x3c')]);_0x544091[_0x93f5('0x40')]=_[_0x93f5('0x41')](_0x1fc050[_0x93f5('0x3f')],qs[_0x93f5('0x42')](_0xad4687[_0x93f5('0x3c')][_0x93f5('0x42')]));_0x544091[_0x93f5('0x40')]=_0x544091[_0x93f5('0x40')][_0x93f5('0x43')]?_0x544091[_0x93f5('0x40')]:_0x1fc050[_0x93f5('0x3f')];if(_0xad4687['query'][_0x93f5('0x54')]){_0x544091['include']=[{'all':!![]}];}_0x544091=_['merge']({},_0x544091,_0xad4687[_0x93f5('0x4d')]);return db['VoiceContext'][_0x93f5('0x55')](_0x544091)['then'](handleEntityNotFound(_0x576500,null))[_0x93f5('0x1a')](respondWithResult(_0x576500,null))[_0x93f5('0x25')](handleError(_0x576500,null));};exports['create']=function(_0x5c6f20,_0x40393f,_0x4ebd3e){var _0x2eb4bf;return db[_0x93f5('0x4e')][_0x93f5('0x56')](_0x5c6f20['body'],{'raw':!![]})['then'](function(_0x20a8b0){_0x2eb4bf=_0x20a8b0;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x52b1d2){var _0x20b3e0=fs[_0x93f5('0x57')](path[_0x93f5('0x58')](config[_0x93f5('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x4a30d0=ejs[_0x93f5('0x5a')](_0x20b3e0,{'contexts':_0x52b1d2||[]});fs[_0x93f5('0x5b')](_0x93f5('0x5c'),_0x4a30d0);})[_0x93f5('0x1a')](function(){return respondWithRpcPromise(_0x93f5('0x5d'),_0x93f5('0x56'),{'module':'chan_sip.so'});})['then'](function(){var _0x52c30e=_0x5c6f20[_0x93f5('0x5e')]['get']({'plain':!![]});if(!_0x52c30e)throw new Error(_0x93f5('0x5f'));if(_0x52c30e['role']===_0x93f5('0x5e')){var _0x5cf864=_0x2eb4bf[_0x93f5('0x30')]({'plain':!![]});return db[_0x93f5('0x60')]['find']({'where':{'name':'Contexts','userProfileId':_0x52c30e[_0x93f5('0x61')]},'raw':!![]})[_0x93f5('0x1a')](function(_0x3326bf){if(_0x3326bf&&_0x3326bf[_0x93f5('0x62')]===0x0){return db[_0x93f5('0x31')][_0x93f5('0x56')]({'name':_0x5cf864[_0x93f5('0x3b')],'resourceId':_0x5cf864['id'],'type':_0x3326bf[_0x93f5('0x3b')],'sectionId':_0x3326bf['id']},{})[_0x93f5('0x1a')](function(){return _0x2eb4bf;});}else{return _0x2eb4bf;}})[_0x93f5('0x25')](function(_0x23ec9f){logger[_0x93f5('0x21')](_0x93f5('0x63'),_0x23ec9f);throw _0x23ec9f;});}return _0x2eb4bf;})[_0x93f5('0x1a')](respondWithResult(_0x40393f,0xc9))[_0x93f5('0x25')](handleError(_0x40393f,null));};exports[_0x93f5('0x2f')]=function(_0x30cfdb,_0x2237cd,_0x1fcc3a){var _0x2db967;return db['VoiceContext']['find']({'where':{'id':_0x30cfdb['params']['id']}})[_0x93f5('0x1a')](handleEntityNotFound(_0x2237cd,null))[_0x93f5('0x1a')](saveUpdates(_0x30cfdb['body'],null))[_0x93f5('0x1a')](function(_0x124e3f){if(_0x124e3f){_0x2db967=_0x124e3f;return db[_0x93f5('0x4e')][_0x93f5('0x64')]({'raw':!![]});}})[_0x93f5('0x1a')](function(_0x59b02a){var _0x2a65b2=fs[_0x93f5('0x57')](path[_0x93f5('0x58')](config[_0x93f5('0x59')],_0x93f5('0x65')),_0x93f5('0x66'));var _0x3067c0=ejs[_0x93f5('0x5a')](_0x2a65b2,{'contexts':_0x59b02a||[]});fs['writeFileSync'](_0x93f5('0x5c'),_0x3067c0);})[_0x93f5('0x1a')](function(){return respondWithRpcPromise(_0x93f5('0x5d'),'update',{'module':_0x93f5('0x67')});})['then'](function(){return _0x2db967;})['then'](respondWithResult(_0x2237cd,null))[_0x93f5('0x25')](handleError(_0x2237cd,null));};exports[_0x93f5('0x32')]=function(_0x246cb9,_0x4f42a1,_0x15b9c4){var _0x3b7645;return db[_0x93f5('0x4e')]['find']({'where':{'id':_0x246cb9[_0x93f5('0x53')]['id']}})[_0x93f5('0x1a')](handleEntityNotFound(_0x4f42a1,null))[_0x93f5('0x1a')](removeEntity(_0x4f42a1,null))['then'](function(){return db[_0x93f5('0x4e')][_0x93f5('0x64')]({'raw':!![]});})[_0x93f5('0x1a')](function(_0x365520){var _0x28cff8=fs[_0x93f5('0x57')](path['join'](config[_0x93f5('0x59')],_0x93f5('0x65')),'utf8');var _0x292a63=ejs[_0x93f5('0x5a')](_0x28cff8,{'contexts':_0x365520});fs[_0x93f5('0x5b')](_0x93f5('0x5c'),_0x292a63);return respondWithRpcPromise(_0x93f5('0x5d'),_0x93f5('0x32'),{'module':_0x93f5('0x67')});})['catch'](handleError(_0x4f42a1,null));}; \ No newline at end of file +var _0x8388=['root','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','set','reject','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','VoiceContext','count','includeAll','rows','show','params','rawAttributes','include','find','create','body','findAll','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','autoAssociation','readFileSync','writeFileSync'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8388,0x18d));var _0x8838=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x8388[_0x15e6fe];return _0x34894d;};'use strict';var pdf=require(_0x8838('0x0'));var emlformat=require(_0x8838('0x1'));var rimraf=require(_0x8838('0x2'));var zipdir=require(_0x8838('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8838('0x4'));var moment=require(_0x8838('0x5'));var BPromise=require(_0x8838('0x6'));var Mustache=require(_0x8838('0x7'));var util=require(_0x8838('0x8'));var path=require('path');var sox=require(_0x8838('0x9'));var csv=require(_0x8838('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8838('0xb'));var squel=require(_0x8838('0xc'));var crypto=require(_0x8838('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8838('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8838('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8838('0x10'));var as=require(_0x8838('0x11'));var hardwareService=require(_0x8838('0x12'));var logger=require(_0x8838('0x13'))('api');var utils=require(_0x8838('0x14'));var config=require(_0x8838('0x15'));var licenseUtil=require(_0x8838('0x16'));var db=require(_0x8838('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8838('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x530bac,_0x369692,_0xb97252,_0x201ee5){return new BPromise(function(_0x43b446,_0x15936c){var _0x22b3d4=_0x201ee5||client;return _0x22b3d4[_0x8838('0x19')](_0x530bac,_0xb97252)[_0x8838('0x1a')](function(_0x486dae){logger[_0x8838('0x1b')](_0x8838('0x1c'),_0x369692,'request\x20sent');logger[_0x8838('0x1d')](_0x8838('0x1e'),_0x369692,_0x8838('0x1f'),JSON['stringify'](_0x486dae));if(_0x486dae[_0x8838('0x20')]){if(_0x486dae['error'][_0x8838('0x21')]===0x1f4){logger[_0x8838('0x20')](_0x8838('0x1c'),_0x369692,_0x486dae['error'][_0x8838('0x22')]);return _0x15936c(_0x486dae[_0x8838('0x20')]['message']);}logger[_0x8838('0x20')](_0x8838('0x1c'),_0x369692,_0x486dae['error'][_0x8838('0x22')]);return _0x43b446(_0x486dae[_0x8838('0x20')]['message']);}else{logger['info'](_0x8838('0x1c'),_0x369692,_0x8838('0x1f'));_0x43b446(_0x486dae[_0x8838('0x23')][_0x8838('0x22')]);}})[_0x8838('0x24')](function(_0xa008f2){logger[_0x8838('0x20')](_0x8838('0x1c'),_0x369692,_0xa008f2);_0x15936c(_0xa008f2);});});}function respondWithStatusCode(_0x46b603,_0x56a4de){_0x56a4de=_0x56a4de||0xcc;return function(_0x73d719){if(_0x73d719){return _0x46b603['sendStatus'](_0x56a4de);}return _0x46b603[_0x8838('0x25')](_0x56a4de)[_0x8838('0x26')]();};}function respondWithResult(_0x4c58a1,_0x50b05a){_0x50b05a=_0x50b05a||0xc8;return function(_0x256f42){if(_0x256f42){return _0x4c58a1[_0x8838('0x25')](_0x50b05a)[_0x8838('0x27')](_0x256f42);}};}function respondWithFilteredResult(_0x45e5bb,_0x1c611a){return function(_0x1b3153){if(_0x1b3153){var _0x1b7c30=_0x1b3153['count'],_0x1fe141=_0x1c611a['offset'],_0xaca1e7=_0x1c611a[_0x8838('0x28')]+_0x1c611a['limit'],_0x34ba38;if(_0xaca1e7>=_0x1b7c30){_0xaca1e7=_0x1b7c30;_0x34ba38=0xc8;}else{_0x34ba38=0xce;}_0x45e5bb[_0x8838('0x25')](_0x34ba38);return _0x45e5bb[_0x8838('0x29')]('Content-Range',_0x1fe141+'-'+_0xaca1e7+'/'+_0x1b7c30)['json'](_0x1b3153);}return null;};}function patchUpdates(_0x2ac2b1){return function(_0x5113f8){try{jsonpatch['apply'](_0x5113f8,_0x2ac2b1,!![]);}catch(_0x1b605d){return BPromise[_0x8838('0x2a')](_0x1b605d);}return _0x5113f8['save']();};}function saveUpdates(_0x3d1bbc,_0x296ba1){return function(_0x4d8007){if(_0x4d8007){return _0x4d8007[_0x8838('0x2b')](_0x3d1bbc)[_0x8838('0x1a')](function(_0x229aef){return _0x229aef;});}return null;};}function removeEntity(_0xdd28e2,_0x508ed4){return function(_0x1e8d12){if(_0x1e8d12){return _0x1e8d12[_0x8838('0x2c')]()['then'](function(){var _0x4d5c59=_0x1e8d12[_0x8838('0x2d')]({'plain':!![]});var _0x5f5890=_0x8838('0x2e');return db[_0x8838('0x2f')][_0x8838('0x2c')]({'where':{'type':_0x5f5890,'resourceId':_0x4d5c59['id']}})['then'](function(){return _0x1e8d12;});})[_0x8838('0x1a')](function(){_0xdd28e2[_0x8838('0x25')](0xcc)[_0x8838('0x26')]();});}};}function handleEntityNotFound(_0x5415b4,_0x31e2a3){return function(_0x22c790){if(!_0x22c790){_0x5415b4[_0x8838('0x30')](0x194);}return _0x22c790;};}function handleError(_0x5a6c83,_0x4c773e){_0x4c773e=_0x4c773e||0x1f4;return function(_0x46f1fb){logger[_0x8838('0x20')](_0x46f1fb[_0x8838('0x31')]);if(_0x46f1fb[_0x8838('0x32')]){delete _0x46f1fb['name'];}_0x5a6c83[_0x8838('0x25')](_0x4c773e)[_0x8838('0x33')](_0x46f1fb);};}exports[_0x8838('0x34')]=function(_0x2057e3,_0x44d406){var _0x19783f={},_0x2ca0a6={},_0x422474={'count':0x0,'rows':[]};var _0x53b47a=_[_0x8838('0x35')](db['VoiceContext']['rawAttributes'],function(_0x5af52e){return{'name':_0x5af52e['fieldName'],'type':_0x5af52e[_0x8838('0x36')][_0x8838('0x37')]};});_0x2ca0a6[_0x8838('0x38')]=_['map'](_0x53b47a,_0x8838('0x32'));_0x2ca0a6[_0x8838('0x39')]=_[_0x8838('0x3a')](_0x2057e3[_0x8838('0x39')]);_0x2ca0a6[_0x8838('0x3b')]=_[_0x8838('0x3c')](_0x2ca0a6[_0x8838('0x38')],_0x2ca0a6['query']);_0x19783f['attributes']=_['intersection'](_0x2ca0a6['model'],qs[_0x8838('0x3d')](_0x2057e3[_0x8838('0x39')]['fields']));_0x19783f[_0x8838('0x3e')]=_0x19783f[_0x8838('0x3e')][_0x8838('0x3f')]?_0x19783f['attributes']:_0x2ca0a6[_0x8838('0x38')];if(!_0x2057e3['query'][_0x8838('0x40')](_0x8838('0x41'))){_0x19783f[_0x8838('0x42')]=qs[_0x8838('0x42')](_0x2057e3[_0x8838('0x39')][_0x8838('0x42')]);_0x19783f['offset']=qs[_0x8838('0x28')](_0x2057e3[_0x8838('0x39')]['offset']);}_0x19783f['order']=qs[_0x8838('0x43')](_0x2057e3[_0x8838('0x39')][_0x8838('0x43')]);_0x19783f[_0x8838('0x44')]=qs[_0x8838('0x3b')](_['pick'](_0x2057e3[_0x8838('0x39')],_0x2ca0a6[_0x8838('0x3b')]),_0x53b47a);if(_0x2057e3[_0x8838('0x39')][_0x8838('0x45')]){_0x19783f[_0x8838('0x44')]=_['merge'](_0x19783f['where'],{'$or':_[_0x8838('0x35')](_0x53b47a,function(_0x526489){if(_0x526489[_0x8838('0x36')]!==_0x8838('0x46')){var _0x1ed364={};_0x1ed364[_0x526489['name']]={'$like':'%'+_0x2057e3['query'][_0x8838('0x45')]+'%'};return _0x1ed364;}})});}_0x19783f=_[_0x8838('0x47')]({},_0x19783f,_0x2057e3[_0x8838('0x48')]);var _0x29ed52={'where':_0x19783f[_0x8838('0x44')]};return db[_0x8838('0x49')][_0x8838('0x4a')](_0x29ed52)[_0x8838('0x1a')](function(_0x17aaf8){_0x422474[_0x8838('0x4a')]=_0x17aaf8;if(_0x2057e3[_0x8838('0x39')][_0x8838('0x4b')]){_0x19783f['include']=[{'all':!![]}];}return db[_0x8838('0x49')]['findAll'](_0x19783f);})[_0x8838('0x1a')](function(_0x5d498b){_0x422474[_0x8838('0x4c')]=_0x5d498b;return _0x422474;})[_0x8838('0x1a')](respondWithFilteredResult(_0x44d406,_0x19783f))[_0x8838('0x24')](handleError(_0x44d406,null));};exports[_0x8838('0x4d')]=function(_0x3c5b0e,_0x226f91){var _0x3a1b8a={'raw':![],'where':{'id':_0x3c5b0e[_0x8838('0x4e')]['id']}},_0x5cd7c9={};_0x5cd7c9['model']=_[_0x8838('0x3a')](db['VoiceContext'][_0x8838('0x4f')]);_0x5cd7c9[_0x8838('0x39')]=_['keys'](_0x3c5b0e[_0x8838('0x39')]);_0x5cd7c9[_0x8838('0x3b')]=_[_0x8838('0x3c')](_0x5cd7c9['model'],_0x5cd7c9[_0x8838('0x39')]);_0x3a1b8a[_0x8838('0x3e')]=_[_0x8838('0x3c')](_0x5cd7c9['model'],qs[_0x8838('0x3d')](_0x3c5b0e[_0x8838('0x39')][_0x8838('0x3d')]));_0x3a1b8a[_0x8838('0x3e')]=_0x3a1b8a[_0x8838('0x3e')][_0x8838('0x3f')]?_0x3a1b8a[_0x8838('0x3e')]:_0x5cd7c9[_0x8838('0x38')];if(_0x3c5b0e[_0x8838('0x39')][_0x8838('0x4b')]){_0x3a1b8a[_0x8838('0x50')]=[{'all':!![]}];}_0x3a1b8a=_[_0x8838('0x47')]({},_0x3a1b8a,_0x3c5b0e[_0x8838('0x48')]);return db['VoiceContext'][_0x8838('0x51')](_0x3a1b8a)['then'](handleEntityNotFound(_0x226f91,null))[_0x8838('0x1a')](respondWithResult(_0x226f91,null))[_0x8838('0x24')](handleError(_0x226f91,null));};exports[_0x8838('0x52')]=function(_0x2b226d,_0xad4fe2,_0x22bd35){var _0x35fbc4;return db['VoiceContext'][_0x8838('0x52')](_0x2b226d[_0x8838('0x53')],{'raw':!![]})[_0x8838('0x1a')](function(_0x29b6da){_0x35fbc4=_0x29b6da;return db[_0x8838('0x49')][_0x8838('0x54')]({'raw':!![]});})['then'](function(_0x29894e){var _0x24273f=fs['readFileSync'](path[_0x8838('0x55')](config['root'],_0x8838('0x56')),_0x8838('0x57'));var _0xa2a05f=ejs[_0x8838('0x58')](_0x24273f,{'contexts':_0x29894e||[]});fs['writeFileSync'](_0x8838('0x59'),_0xa2a05f);})[_0x8838('0x1a')](function(){return respondWithRpcPromise(_0x8838('0x5a'),'create',{'module':_0x8838('0x5b')});})[_0x8838('0x1a')](function(){var _0x53d17c=_0x2b226d[_0x8838('0x5c')]['get']({'plain':!![]});if(!_0x53d17c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d17c[_0x8838('0x5d')]===_0x8838('0x5c')){var _0x6c0bd7=_0x35fbc4[_0x8838('0x2d')]({'plain':!![]});return db[_0x8838('0x5e')]['find']({'where':{'name':_0x8838('0x2e'),'userProfileId':_0x53d17c['userProfileId']},'raw':!![]})[_0x8838('0x1a')](function(_0x5e584d){if(_0x5e584d&&_0x5e584d[_0x8838('0x5f')]===0x0){return db[_0x8838('0x2f')]['create']({'name':_0x6c0bd7['name'],'resourceId':_0x6c0bd7['id'],'type':_0x5e584d['name'],'sectionId':_0x5e584d['id']},{})[_0x8838('0x1a')](function(){return _0x35fbc4;});}else{return _0x35fbc4;}})['catch'](function(_0x287258){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x287258);throw _0x287258;});}return _0x35fbc4;})[_0x8838('0x1a')](respondWithResult(_0xad4fe2,0xc9))[_0x8838('0x24')](handleError(_0xad4fe2,null));};exports['update']=function(_0x433f95,_0x10d8a8,_0x304869){var _0x5dc758;return db[_0x8838('0x49')][_0x8838('0x51')]({'where':{'id':_0x433f95[_0x8838('0x4e')]['id']}})[_0x8838('0x1a')](handleEntityNotFound(_0x10d8a8,null))[_0x8838('0x1a')](saveUpdates(_0x433f95[_0x8838('0x53')],null))[_0x8838('0x1a')](function(_0x5aa054){if(_0x5aa054){_0x5dc758=_0x5aa054;return db[_0x8838('0x49')][_0x8838('0x54')]({'raw':!![]});}})[_0x8838('0x1a')](function(_0xe73cd4){var _0xad38a1=fs[_0x8838('0x60')](path[_0x8838('0x55')](config['root'],'server/files/templates/context.ejs'),_0x8838('0x57'));var _0x5ecef0=ejs[_0x8838('0x58')](_0xad38a1,{'contexts':_0xe73cd4||[]});fs[_0x8838('0x61')](_0x8838('0x59'),_0x5ecef0);})[_0x8838('0x1a')](function(){return respondWithRpcPromise(_0x8838('0x5a'),_0x8838('0x2b'),{'module':_0x8838('0x5b')});})[_0x8838('0x1a')](function(){return _0x5dc758;})[_0x8838('0x1a')](respondWithResult(_0x10d8a8,null))['catch'](handleError(_0x10d8a8,null));};exports[_0x8838('0x2c')]=function(_0x14fbe4,_0x3ca1ba,_0x44b5f7){var _0x376be6;return db['VoiceContext'][_0x8838('0x51')]({'where':{'id':_0x14fbe4[_0x8838('0x4e')]['id']}})[_0x8838('0x1a')](handleEntityNotFound(_0x3ca1ba,null))[_0x8838('0x1a')](removeEntity(_0x3ca1ba,null))['then'](function(){return db[_0x8838('0x49')][_0x8838('0x54')]({'raw':!![]});})[_0x8838('0x1a')](function(_0x5d585f){var _0x1efead=fs[_0x8838('0x60')](path['join'](config[_0x8838('0x62')],_0x8838('0x56')),_0x8838('0x57'));var _0x3d205a=ejs[_0x8838('0x58')](_0x1efead,{'contexts':_0x5d585f});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3d205a);return respondWithRpcPromise(_0x8838('0x5a'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x3ca1ba,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6dc0b6e..5aa8178 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 _0x403b=['exports','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x403b,0x137));var _0xb403=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x403b[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb403('0x0'));var util=require('util');var logger=require(_0xb403('0x1'))(_0xb403('0x2'));var moment=require(_0xb403('0x3'));var BPromise=require('bluebird');var rp=require(_0xb403('0x4'));var fs=require('fs');var path=require(_0xb403('0x5'));var rimraf=require('rimraf');var config=require(_0xb403('0x6'));var attributes=require(_0xb403('0x7'));module[_0xb403('0x8')]=function(_0x455ae1,_0x4dcfc7){return _0x455ae1['define'](_0xb403('0x9'),attributes,{'tableName':_0xb403('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x122d=['exports','define','VoiceContext','lodash','api','moment','bluebird','../../config/environment','./voiceContext.attributes'];(function(_0x3fbee4,_0x3a1fe8){var _0x5c627e=function(_0x3fcae1){while(--_0x3fcae1){_0x3fbee4['push'](_0x3fbee4['shift']());}};_0x5c627e(++_0x3a1fe8);}(_0x122d,0x16b));var _0xd122=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x122d[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0xd122('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd122('0x1'));var moment=require(_0xd122('0x2'));var BPromise=require(_0xd122('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd122('0x4'));var attributes=require(_0xd122('0x5'));module[_0xd122('0x6')]=function(_0x214304,_0x2ede5c){return _0x214304[_0xd122('0x7')](_0xd122('0x8'),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 41961f9..3318375 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 _0x20a3=['VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0x20a3,0x15b));var _0x320a=function(_0x5dd405,_0x10c9c2){_0x5dd405=_0x5dd405-0x0;var _0x147c59=_0x20a3[_0x5dd405];return _0x147c59;};'use strict';var _=require(_0x320a('0x0'));var util=require('util');var moment=require(_0x320a('0x1'));var BPromise=require(_0x320a('0x2'));var rs=require(_0x320a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x320a('0x4'))(_0x320a('0x5'));var config=require(_0x320a('0x6'));var jayson=require(_0x320a('0x7'));var client=jayson[_0x320a('0x8')][_0x320a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5284af,_0x4fd8f7,_0xe77a45){return new BPromise(function(_0x304ccc,_0x173ac1){return client['request'](_0x5284af,_0xe77a45)['then'](function(_0x2cab6b){logger['info'](_0x320a('0xa'),_0x4fd8f7,_0x320a('0xb'));logger['debug'](_0x320a('0xc'),_0x4fd8f7,_0x320a('0xb'),JSON['stringify'](_0x2cab6b));if(_0x2cab6b[_0x320a('0xd')]){if(_0x2cab6b[_0x320a('0xd')][_0x320a('0xe')]===0x1f4){logger[_0x320a('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4fd8f7,_0x2cab6b[_0x320a('0xd')][_0x320a('0xf')]);return _0x173ac1(_0x2cab6b[_0x320a('0xd')]['message']);}logger[_0x320a('0xd')](_0x320a('0xa'),_0x4fd8f7,_0x2cab6b['error'][_0x320a('0xf')]);return _0x304ccc(_0x2cab6b['error'][_0x320a('0xf')]);}else{logger[_0x320a('0x10')](_0x320a('0xa'),_0x4fd8f7,_0x320a('0xb'));_0x304ccc(_0x2cab6b['result'][_0x320a('0xf')]);}})['catch'](function(_0x51ae9d){logger[_0x320a('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4fd8f7,_0x51ae9d);_0x173ac1(_0x51ae9d);});});} \ No newline at end of file +var _0xfcc5=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','request','info','request\x20sent','debug'];(function(_0x1b1a6f,_0x51ff2c){var _0x20641b=function(_0x40b709){while(--_0x40b709){_0x1b1a6f['push'](_0x1b1a6f['shift']());}};_0x20641b(++_0x51ff2c);}(_0xfcc5,0x14a));var _0x5fcc=function(_0x118a4d,_0x1f8781){_0x118a4d=_0x118a4d-0x0;var _0x330686=_0xfcc5[_0x118a4d];return _0x330686;};'use strict';var _=require('lodash');var util=require(_0x5fcc('0x0'));var moment=require(_0x5fcc('0x1'));var BPromise=require(_0x5fcc('0x2'));var rs=require(_0x5fcc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fcc('0x5'));var config=require(_0x5fcc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5fcc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x389247,_0x2169c5,_0x2168c6){return new BPromise(function(_0x2a8198,_0x5dbae9){return client[_0x5fcc('0x8')](_0x389247,_0x2168c6)['then'](function(_0x39e818){logger[_0x5fcc('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2169c5,_0x5fcc('0xa'));logger[_0x5fcc('0xb')](_0x5fcc('0xc'),_0x2169c5,_0x5fcc('0xa'),JSON[_0x5fcc('0xd')](_0x39e818));if(_0x39e818[_0x5fcc('0xe')]){if(_0x39e818['error']['code']===0x1f4){logger[_0x5fcc('0xe')](_0x5fcc('0xf'),_0x2169c5,_0x39e818[_0x5fcc('0xe')][_0x5fcc('0x10')]);return _0x5dbae9(_0x39e818[_0x5fcc('0xe')][_0x5fcc('0x10')]);}logger[_0x5fcc('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2169c5,_0x39e818[_0x5fcc('0xe')]['message']);return _0x2a8198(_0x39e818[_0x5fcc('0xe')][_0x5fcc('0x10')]);}else{logger[_0x5fcc('0x9')](_0x5fcc('0xf'),_0x2169c5,'request\x20sent');_0x2a8198(_0x39e818[_0x5fcc('0x11')][_0x5fcc('0x10')]);}})[_0x5fcc('0x12')](function(_0xf07c55){logger[_0x5fcc('0xe')](_0x5fcc('0xf'),_0x2169c5,_0xf07c55);_0x5dbae9(_0xf07c55);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4ab7ef5..1cbafca 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 _0xa163=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3cf150,_0x178cb5){var _0x931f8b=function(_0x40a693){while(--_0x40a693){_0x3cf150['push'](_0x3cf150['shift']());}};_0x931f8b(++_0x178cb5);}(_0xa163,0x1d1));var _0x3a16=function(_0x51305d,_0x519fba){_0x51305d=_0x51305d-0x0;var _0x1efa1b=_0xa163[_0x51305d];return _0x1efa1b;};'use strict';var multer=require(_0x3a16('0x0'));var util=require(_0x3a16('0x1'));var path=require(_0x3a16('0x2'));var timeout=require(_0x3a16('0x3'));var express=require(_0x3a16('0x4'));var router=express[_0x3a16('0x5')]();var auth=require(_0x3a16('0x6'));var interaction=require(_0x3a16('0x7'));var config=require(_0x3a16('0x8'));var controller=require(_0x3a16('0x9'));router[_0x3a16('0xa')]('/',auth[_0x3a16('0xb')](),controller[_0x3a16('0xc')]);router[_0x3a16('0xa')](_0x3a16('0xd'),auth[_0x3a16('0xb')](),controller[_0x3a16('0xe')]);router[_0x3a16('0xa')](_0x3a16('0xf'),auth[_0x3a16('0xb')](),controller[_0x3a16('0x10')]);router[_0x3a16('0x11')]('/',auth['isAuthenticated'](),controller[_0x3a16('0x12')]);router[_0x3a16('0x13')](_0x3a16('0xf'),auth[_0x3a16('0xb')](),controller[_0x3a16('0x14')]);router[_0x3a16('0x15')]('/:id',auth[_0x3a16('0xb')](),controller[_0x3a16('0x16')]);module['exports']=router; \ No newline at end of file +var _0xed9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x1651b6,_0x14800f){var _0x1b64f5=function(_0x44341e){while(--_0x44341e){_0x1651b6['push'](_0x1651b6['shift']());}};_0x1b64f5(++_0x14800f);}(_0xed9d,0x13b));var _0xded9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xed9d[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xded9('0x0'));var util=require('util');var path=require(_0xded9('0x1'));var timeout=require(_0xded9('0x2'));var express=require(_0xded9('0x3'));var router=express[_0xded9('0x4')]();var auth=require(_0xded9('0x5'));var interaction=require(_0xded9('0x6'));var config=require(_0xded9('0x7'));var controller=require(_0xded9('0x8'));router[_0xded9('0x9')]('/',auth[_0xded9('0xa')](),controller[_0xded9('0xb')]);router[_0xded9('0x9')]('/describe',auth[_0xded9('0xa')](),controller[_0xded9('0xc')]);router[_0xded9('0x9')]('/:id',auth[_0xded9('0xa')](),controller[_0xded9('0xd')]);router['post']('/',auth[_0xded9('0xa')](),controller['create']);router[_0xded9('0xe')](_0xded9('0xf'),auth['isAuthenticated'](),controller[_0xded9('0x10')]);router[_0xded9('0x11')](_0xded9('0xf'),auth['isAuthenticated'](),controller[_0xded9('0x12')]);module[_0xded9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 555e052..c573cfd 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 _0xc8f7=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3ef1e4,_0x55c767){var _0x2886e2=function(_0x30cffe){while(--_0x30cffe){_0x3ef1e4['push'](_0x3ef1e4['shift']());}};_0x2886e2(++_0x55c767);}(_0xc8f7,0x12b));var _0x7c8f=function(_0x14465d,_0x5a7403){_0x14465d=_0x14465d-0x0;var _0x5be222=_0xc8f7[_0x14465d];return _0x5be222;};'use strict';var Sequelize=require(_0x7c8f('0x0'));module[_0x7c8f('0x1')]={'privilege':{'type':Sequelize[_0x7c8f('0x2')]},'channel':{'type':Sequelize[_0x7c8f('0x2')]},'channelstate':{'type':Sequelize[_0x7c8f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7c8f('0x2')]},'calleridnum':{'type':Sequelize[_0x7c8f('0x2')]},'calleridname':{'type':Sequelize[_0x7c8f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7c8f('0x2')]},'connectedlinename':{'type':Sequelize[_0x7c8f('0x2')]},'language':{'type':Sequelize[_0x7c8f('0x2')]},'accountcode':{'type':Sequelize[_0x7c8f('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7c8f('0x2')]},'priority':{'type':Sequelize[_0x7c8f('0x3')]},'uniqueid':{'type':Sequelize[_0x7c8f('0x2')]},'linkedid':{'type':Sequelize[_0x7c8f('0x2')]},'destchannel':{'type':Sequelize[_0x7c8f('0x2')]},'destchannelstate':{'type':Sequelize[_0x7c8f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7c8f('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7c8f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7c8f('0x2')]},'destlanguage':{'type':Sequelize[_0x7c8f('0x2')]},'destaccountcode':{'type':Sequelize[_0x7c8f('0x2')]},'destcontext':{'type':Sequelize[_0x7c8f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7c8f('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x7c8f('0x2')]},'dialstring':{'type':Sequelize[_0x7c8f('0x2')]},'dialstatus':{'type':Sequelize[_0x7c8f('0x2')]},'starttime':{'type':Sequelize[_0x7c8f('0x4')]},'answertime':{'type':Sequelize[_0x7c8f('0x4')]},'endtime':{'type':Sequelize[_0x7c8f('0x4')]},'lastevent':{'type':Sequelize[_0x7c8f('0x2')],'comment':_0x7c8f('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7c8f('0x3')]}}; \ No newline at end of file +var _0xd8ef=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x2569bc,_0x2562c4){var _0x1c7f4e=function(_0x46be3f){while(--_0x46be3f){_0x2569bc['push'](_0x2569bc['shift']());}};_0x1c7f4e(++_0x2562c4);}(_0xd8ef,0x132));var _0xfd8e=function(_0x3d0329,_0x2c1986){_0x3d0329=_0x3d0329-0x0;var _0x7e78e3=_0xd8ef[_0x3d0329];return _0x7e78e3;};'use strict';var Sequelize=require(_0xfd8e('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xfd8e('0x1')]},'channel':{'type':Sequelize[_0xfd8e('0x1')]},'channelstate':{'type':Sequelize[_0xfd8e('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfd8e('0x1')]},'calleridname':{'type':Sequelize[_0xfd8e('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfd8e('0x1')]},'connectedlinename':{'type':Sequelize[_0xfd8e('0x1')]},'language':{'type':Sequelize[_0xfd8e('0x1')]},'accountcode':{'type':Sequelize[_0xfd8e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfd8e('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xfd8e('0x1')]},'linkedid':{'type':Sequelize[_0xfd8e('0x1')]},'destchannel':{'type':Sequelize[_0xfd8e('0x1')]},'destchannelstate':{'type':Sequelize[_0xfd8e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xfd8e('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfd8e('0x1')]},'destcalleridname':{'type':Sequelize[_0xfd8e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfd8e('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xfd8e('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfd8e('0x1')]},'destpriority':{'type':Sequelize[_0xfd8e('0x2')]},'destuniqueid':{'type':Sequelize[_0xfd8e('0x1')]},'destlinkedid':{'type':Sequelize[_0xfd8e('0x1')]},'dialstring':{'type':Sequelize[_0xfd8e('0x1')]},'dialstatus':{'type':Sequelize[_0xfd8e('0x1')]},'starttime':{'type':Sequelize[_0xfd8e('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfd8e('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xfd8e('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xfd8e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xfd8e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 599faf4..06b824b 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 _0x43f2=['attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x3d8f2c,_0x4807db){var _0x4cf46e=function(_0x25af1f){while(--_0x25af1f){_0x3d8f2c['push'](_0x3d8f2c['shift']());}};_0x4cf46e(++_0x4807db);}(_0x43f2,0x147));var _0x243f=function(_0x4bc365,_0x34fbe2){_0x4bc365=_0x4bc365-0x0;var _0xe20a06=_0x43f2[_0x4bc365];return _0xe20a06;};'use strict';var pdf=require(_0x243f('0x0'));var emlformat=require(_0x243f('0x1'));var rimraf=require(_0x243f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x243f('0x3'));var rp=require(_0x243f('0x4'));var moment=require('moment');var BPromise=require(_0x243f('0x5'));var Mustache=require(_0x243f('0x6'));var util=require(_0x243f('0x7'));var path=require('path');var sox=require(_0x243f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x243f('0x9'));var squel=require(_0x243f('0xa'));var crypto=require(_0x243f('0xb'));var jsforce=require(_0x243f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x243f('0xd'));var querystring=require(_0x243f('0xe'));var Papa=require(_0x243f('0xf'));var Redis=require(_0x243f('0x10'));var authService=require(_0x243f('0x11'));var qs=require(_0x243f('0x12'));var as=require(_0x243f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x243f('0x14'))(_0x243f('0x15'));var utils=require(_0x243f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x243f('0x17'))['db'];function respondWithStatusCode(_0x51de95,_0x794dd6){_0x794dd6=_0x794dd6||0xcc;return function(_0x9c29){if(_0x9c29){return _0x51de95['sendStatus'](_0x794dd6);}return _0x51de95['status'](_0x794dd6)[_0x243f('0x18')]();};}function respondWithResult(_0x485aa0,_0x4ebfe1){_0x4ebfe1=_0x4ebfe1||0xc8;return function(_0x52d2d5){if(_0x52d2d5){return _0x485aa0['status'](_0x4ebfe1)[_0x243f('0x19')](_0x52d2d5);}};}function respondWithFilteredResult(_0x5ee051,_0x45562d){return function(_0x390e25){if(_0x390e25){var _0x55c904=_0x390e25[_0x243f('0x1a')],_0x283838=_0x45562d[_0x243f('0x1b')],_0x190b12=_0x45562d[_0x243f('0x1b')]+_0x45562d['limit'],_0x2ae331;if(_0x190b12>=_0x55c904){_0x190b12=_0x55c904;_0x2ae331=0xc8;}else{_0x2ae331=0xce;}_0x5ee051[_0x243f('0x1c')](_0x2ae331);return _0x5ee051[_0x243f('0x1d')](_0x243f('0x1e'),_0x283838+'-'+_0x190b12+'/'+_0x55c904)[_0x243f('0x19')](_0x390e25);}return null;};}function patchUpdates(_0x20ccd9){return function(_0x4d3048){try{jsonpatch[_0x243f('0x1f')](_0x4d3048,_0x20ccd9,!![]);}catch(_0x7677c){return BPromise[_0x243f('0x20')](_0x7677c);}return _0x4d3048[_0x243f('0x21')]();};}function saveUpdates(_0x4dbffe,_0x20c177){return function(_0x52c033){if(_0x52c033){return _0x52c033[_0x243f('0x22')](_0x4dbffe)[_0x243f('0x23')](function(_0x2d5700){return _0x2d5700;});}return null;};}function removeEntity(_0x267622,_0x44646a){return function(_0x14e2ae){if(_0x14e2ae){return _0x14e2ae[_0x243f('0x24')]()[_0x243f('0x23')](function(){_0x267622[_0x243f('0x1c')](0xcc)[_0x243f('0x18')]();});}};}function handleEntityNotFound(_0x3aa992,_0x114aef){return function(_0x43f0d8){if(!_0x43f0d8){_0x3aa992[_0x243f('0x25')](0x194);}return _0x43f0d8;};}function handleError(_0x5e0c21,_0x17a9f3){_0x17a9f3=_0x17a9f3||0x1f4;return function(_0xf46afb){logger[_0x243f('0x26')](_0xf46afb[_0x243f('0x27')]);if(_0xf46afb['name']){delete _0xf46afb['name'];}_0x5e0c21[_0x243f('0x1c')](_0x17a9f3)[_0x243f('0x28')](_0xf46afb);};}exports[_0x243f('0x29')]=function(_0x16cc5b,_0x1d3a94){var _0xfcda1d={},_0x36c88a={},_0x4f8a21={'count':0x0,'rows':[]};var _0xb9a1f4=_['map'](db[_0x243f('0x2a')][_0x243f('0x2b')],function(_0x2db7fe){return{'name':_0x2db7fe[_0x243f('0x2c')],'type':_0x2db7fe[_0x243f('0x2d')][_0x243f('0x2e')]};});_0x36c88a[_0x243f('0x2f')]=_[_0x243f('0x30')](_0xb9a1f4,'name');_0x36c88a[_0x243f('0x31')]=_[_0x243f('0x32')](_0x16cc5b[_0x243f('0x31')]);_0x36c88a[_0x243f('0x33')]=_[_0x243f('0x34')](_0x36c88a[_0x243f('0x2f')],_0x36c88a['query']);_0xfcda1d[_0x243f('0x35')]=_[_0x243f('0x34')](_0x36c88a[_0x243f('0x2f')],qs[_0x243f('0x36')](_0x16cc5b[_0x243f('0x31')][_0x243f('0x36')]));_0xfcda1d[_0x243f('0x35')]=_0xfcda1d[_0x243f('0x35')]['length']?_0xfcda1d['attributes']:_0x36c88a[_0x243f('0x2f')];if(!_0x16cc5b[_0x243f('0x31')][_0x243f('0x37')](_0x243f('0x38'))){_0xfcda1d[_0x243f('0x39')]=qs[_0x243f('0x39')](_0x16cc5b[_0x243f('0x31')][_0x243f('0x39')]);_0xfcda1d[_0x243f('0x1b')]=qs[_0x243f('0x1b')](_0x16cc5b[_0x243f('0x31')][_0x243f('0x1b')]);}_0xfcda1d[_0x243f('0x3a')]=qs[_0x243f('0x3b')](_0x16cc5b[_0x243f('0x31')]['sort']);_0xfcda1d['where']=qs['filters'](_[_0x243f('0x3c')](_0x16cc5b[_0x243f('0x31')],_0x36c88a[_0x243f('0x33')]),_0xb9a1f4);if(_0x16cc5b['query'][_0x243f('0x3d')]){_0xfcda1d[_0x243f('0x3e')]=_['merge'](_0xfcda1d[_0x243f('0x3e')],{'$or':_['map'](_0xb9a1f4,function(_0x2f95ea){if(_0x2f95ea['type']!=='VIRTUAL'){var _0x1991fd={};_0x1991fd[_0x2f95ea['name']]={'$like':'%'+_0x16cc5b[_0x243f('0x31')][_0x243f('0x3d')]+'%'};return _0x1991fd;}})});}_0xfcda1d=_[_0x243f('0x3f')]({},_0xfcda1d,_0x16cc5b[_0x243f('0x40')]);var _0x345e36={'where':_0xfcda1d['where']};return db[_0x243f('0x2a')][_0x243f('0x1a')](_0x345e36)[_0x243f('0x23')](function(_0x476af7){_0x4f8a21[_0x243f('0x1a')]=_0x476af7;if(_0x16cc5b[_0x243f('0x31')][_0x243f('0x41')]){_0xfcda1d[_0x243f('0x42')]=[{'all':!![]}];}return db[_0x243f('0x2a')][_0x243f('0x43')](_0xfcda1d);})['then'](function(_0x36fdbb){_0x4f8a21[_0x243f('0x44')]=_0x36fdbb;return _0x4f8a21;})[_0x243f('0x23')](respondWithFilteredResult(_0x1d3a94,_0xfcda1d))[_0x243f('0x45')](handleError(_0x1d3a94,null));};exports[_0x243f('0x46')]=function(_0x2cd646,_0x570b7e){var _0x421220={'raw':!![],'where':{'id':_0x2cd646[_0x243f('0x47')]['id']}},_0x356e7c={};_0x356e7c['model']=_[_0x243f('0x32')](db[_0x243f('0x2a')][_0x243f('0x2b')]);_0x356e7c['query']=_[_0x243f('0x32')](_0x2cd646['query']);_0x356e7c['filters']=_[_0x243f('0x34')](_0x356e7c[_0x243f('0x2f')],_0x356e7c[_0x243f('0x31')]);_0x421220['attributes']=_[_0x243f('0x34')](_0x356e7c[_0x243f('0x2f')],qs[_0x243f('0x36')](_0x2cd646[_0x243f('0x31')][_0x243f('0x36')]));_0x421220['attributes']=_0x421220[_0x243f('0x35')]['length']?_0x421220[_0x243f('0x35')]:_0x356e7c[_0x243f('0x2f')];if(_0x2cd646[_0x243f('0x31')]['includeAll']){_0x421220['include']=[{'all':!![]}];}_0x421220=_[_0x243f('0x3f')]({},_0x421220,_0x2cd646['options']);return db[_0x243f('0x2a')][_0x243f('0x48')](_0x421220)['then'](handleEntityNotFound(_0x570b7e,null))['then'](respondWithResult(_0x570b7e,null))[_0x243f('0x45')](handleError(_0x570b7e,null));};exports['create']=function(_0xf55971,_0x711efd){return db[_0x243f('0x2a')][_0x243f('0x49')](_0xf55971[_0x243f('0x4a')],{})[_0x243f('0x23')](respondWithResult(_0x711efd,0xc9))[_0x243f('0x45')](handleError(_0x711efd,null));};exports[_0x243f('0x22')]=function(_0x26e4ce,_0x16727f){if(_0x26e4ce[_0x243f('0x4a')]['id']){delete _0x26e4ce[_0x243f('0x4a')]['id'];}return db[_0x243f('0x2a')][_0x243f('0x48')]({'where':{'id':_0x26e4ce[_0x243f('0x47')]['id']}})['then'](handleEntityNotFound(_0x16727f,null))[_0x243f('0x23')](saveUpdates(_0x26e4ce[_0x243f('0x4a')],null))['then'](respondWithResult(_0x16727f,null))['catch'](handleError(_0x16727f,null));};exports[_0x243f('0x24')]=function(_0x3758d2,_0x3f6f8c){return db['VoiceDialReport'][_0x243f('0x48')]({'where':{'id':_0x3758d2['params']['id']}})['then'](handleEntityNotFound(_0x3f6f8c,null))[_0x243f('0x23')](removeEntity(_0x3f6f8c,null))[_0x243f('0x45')](handleError(_0x3f6f8c,null));};exports[_0x243f('0x4b')]=function(_0x37a58e,_0x577e32){return db[_0x243f('0x2a')][_0x243f('0x4b')]()[_0x243f('0x23')](respondWithResult(_0x577e32,null))[_0x243f('0x45')](handleError(_0x577e32,null));}; \ No newline at end of file +var _0x319c=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','length','model','limit','sort','pick','filter','where','merge','VIRTUAL','include','VoiceDialReport','findAll','rows','catch','params','fields','options','find','create','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3d20d1,_0x5bdb8a){var _0x4d28a0=function(_0x12a5d0){while(--_0x12a5d0){_0x3d20d1['push'](_0x3d20d1['shift']());}};_0x4d28a0(++_0x5bdb8a);}(_0x319c,0x150));var _0xc319=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x319c[_0x4c12ec];return _0x3ae42c;};'use strict';var pdf=require(_0xc319('0x0'));var emlformat=require(_0xc319('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc319('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc319('0x3'));var BPromise=require(_0xc319('0x4'));var Mustache=require(_0xc319('0x5'));var util=require(_0xc319('0x6'));var path=require(_0xc319('0x7'));var sox=require(_0xc319('0x8'));var csv=require(_0xc319('0x9'));var ejs=require(_0xc319('0xa'));var fs=require('fs');var _=require(_0xc319('0xb'));var squel=require(_0xc319('0xc'));var crypto=require(_0xc319('0xd'));var jsforce=require(_0xc319('0xe'));var deskjs=require(_0xc319('0xf'));var toCsv=require(_0xc319('0x9'));var querystring=require(_0xc319('0x10'));var Papa=require(_0xc319('0x11'));var Redis=require('ioredis');var authService=require(_0xc319('0x12'));var qs=require(_0xc319('0x13'));var as=require(_0xc319('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc319('0x15'))(_0xc319('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc319('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34fc7c,_0x57b9aa){_0x57b9aa=_0x57b9aa||0xcc;return function(_0x247172){if(_0x247172){return _0x34fc7c[_0xc319('0x18')](_0x57b9aa);}return _0x34fc7c['status'](_0x57b9aa)[_0xc319('0x19')]();};}function respondWithResult(_0x40d2f4,_0x2d377e){_0x2d377e=_0x2d377e||0xc8;return function(_0x53e077){if(_0x53e077){return _0x40d2f4[_0xc319('0x1a')](_0x2d377e)[_0xc319('0x1b')](_0x53e077);}};}function respondWithFilteredResult(_0x1e42aa,_0x3627c5){return function(_0x5b7f22){if(_0x5b7f22){var _0x3a3fa9=_0x5b7f22[_0xc319('0x1c')],_0x3d14d8=_0x3627c5[_0xc319('0x1d')],_0x21e8b7=_0x3627c5['offset']+_0x3627c5['limit'],_0x240cd4;if(_0x21e8b7>=_0x3a3fa9){_0x21e8b7=_0x3a3fa9;_0x240cd4=0xc8;}else{_0x240cd4=0xce;}_0x1e42aa[_0xc319('0x1a')](_0x240cd4);return _0x1e42aa[_0xc319('0x1e')](_0xc319('0x1f'),_0x3d14d8+'-'+_0x21e8b7+'/'+_0x3a3fa9)[_0xc319('0x1b')](_0x5b7f22);}return null;};}function patchUpdates(_0x376278){return function(_0x125a72){try{jsonpatch['apply'](_0x125a72,_0x376278,!![]);}catch(_0x12c92a){return BPromise[_0xc319('0x20')](_0x12c92a);}return _0x125a72['save']();};}function saveUpdates(_0x1b630f,_0x421dff){return function(_0x182d22){if(_0x182d22){return _0x182d22[_0xc319('0x21')](_0x1b630f)[_0xc319('0x22')](function(_0x240b26){return _0x240b26;});}return null;};}function removeEntity(_0x20f390,_0x54f81f){return function(_0x99e7bc){if(_0x99e7bc){return _0x99e7bc[_0xc319('0x23')]()['then'](function(){_0x20f390['status'](0xcc)[_0xc319('0x19')]();});}};}function handleEntityNotFound(_0x168c42,_0x17cab5){return function(_0x52874d){if(!_0x52874d){_0x168c42[_0xc319('0x18')](0x194);}return _0x52874d;};}function handleError(_0x4ae353,_0x26a938){_0x26a938=_0x26a938||0x1f4;return function(_0x1a3c1c){logger['error'](_0x1a3c1c[_0xc319('0x24')]);if(_0x1a3c1c[_0xc319('0x25')]){delete _0x1a3c1c[_0xc319('0x25')];}_0x4ae353['status'](_0x26a938)['send'](_0x1a3c1c);};}exports[_0xc319('0x26')]=function(_0x156d77,_0x2e34c4){var _0x13f16c={},_0x29936c={},_0x453c76={'count':0x0,'rows':[]};var _0x25856a=_[_0xc319('0x27')](db['VoiceDialReport'][_0xc319('0x28')],function(_0x5e9bed){return{'name':_0x5e9bed[_0xc319('0x29')],'type':_0x5e9bed[_0xc319('0x2a')][_0xc319('0x2b')]};});_0x29936c['model']=_['map'](_0x25856a,_0xc319('0x25'));_0x29936c[_0xc319('0x2c')]=_[_0xc319('0x2d')](_0x156d77['query']);_0x29936c[_0xc319('0x2e')]=_[_0xc319('0x2f')](_0x29936c['model'],_0x29936c[_0xc319('0x2c')]);_0x13f16c[_0xc319('0x30')]=_[_0xc319('0x2f')](_0x29936c['model'],qs['fields'](_0x156d77[_0xc319('0x2c')]['fields']));_0x13f16c['attributes']=_0x13f16c['attributes'][_0xc319('0x31')]?_0x13f16c[_0xc319('0x30')]:_0x29936c[_0xc319('0x32')];if(!_0x156d77[_0xc319('0x2c')]['hasOwnProperty']('nolimit')){_0x13f16c[_0xc319('0x33')]=qs[_0xc319('0x33')](_0x156d77[_0xc319('0x2c')][_0xc319('0x33')]);_0x13f16c['offset']=qs[_0xc319('0x1d')](_0x156d77[_0xc319('0x2c')]['offset']);}_0x13f16c['order']=qs[_0xc319('0x34')](_0x156d77[_0xc319('0x2c')][_0xc319('0x34')]);_0x13f16c['where']=qs[_0xc319('0x2e')](_[_0xc319('0x35')](_0x156d77[_0xc319('0x2c')],_0x29936c['filters']),_0x25856a);if(_0x156d77['query'][_0xc319('0x36')]){_0x13f16c[_0xc319('0x37')]=_[_0xc319('0x38')](_0x13f16c['where'],{'$or':_[_0xc319('0x27')](_0x25856a,function(_0x510156){if(_0x510156[_0xc319('0x2a')]!==_0xc319('0x39')){var _0x5acf78={};_0x5acf78[_0x510156[_0xc319('0x25')]]={'$like':'%'+_0x156d77[_0xc319('0x2c')][_0xc319('0x36')]+'%'};return _0x5acf78;}})});}_0x13f16c=_['merge']({},_0x13f16c,_0x156d77['options']);var _0x10ceae={'where':_0x13f16c['where']};return db['VoiceDialReport']['count'](_0x10ceae)['then'](function(_0x1031a0){_0x453c76[_0xc319('0x1c')]=_0x1031a0;if(_0x156d77['query']['includeAll']){_0x13f16c[_0xc319('0x3a')]=[{'all':!![]}];}return db[_0xc319('0x3b')][_0xc319('0x3c')](_0x13f16c);})[_0xc319('0x22')](function(_0x525ee8){_0x453c76[_0xc319('0x3d')]=_0x525ee8;return _0x453c76;})[_0xc319('0x22')](respondWithFilteredResult(_0x2e34c4,_0x13f16c))[_0xc319('0x3e')](handleError(_0x2e34c4,null));};exports['show']=function(_0x14967b,_0x962a19){var _0x17dcf8={'raw':!![],'where':{'id':_0x14967b[_0xc319('0x3f')]['id']}},_0x4b5d2e={};_0x4b5d2e[_0xc319('0x32')]=_[_0xc319('0x2d')](db['VoiceDialReport']['rawAttributes']);_0x4b5d2e['query']=_[_0xc319('0x2d')](_0x14967b[_0xc319('0x2c')]);_0x4b5d2e[_0xc319('0x2e')]=_[_0xc319('0x2f')](_0x4b5d2e['model'],_0x4b5d2e[_0xc319('0x2c')]);_0x17dcf8['attributes']=_['intersection'](_0x4b5d2e[_0xc319('0x32')],qs[_0xc319('0x40')](_0x14967b[_0xc319('0x2c')][_0xc319('0x40')]));_0x17dcf8[_0xc319('0x30')]=_0x17dcf8[_0xc319('0x30')][_0xc319('0x31')]?_0x17dcf8[_0xc319('0x30')]:_0x4b5d2e[_0xc319('0x32')];if(_0x14967b[_0xc319('0x2c')]['includeAll']){_0x17dcf8[_0xc319('0x3a')]=[{'all':!![]}];}_0x17dcf8=_[_0xc319('0x38')]({},_0x17dcf8,_0x14967b[_0xc319('0x41')]);return db[_0xc319('0x3b')][_0xc319('0x42')](_0x17dcf8)[_0xc319('0x22')](handleEntityNotFound(_0x962a19,null))['then'](respondWithResult(_0x962a19,null))['catch'](handleError(_0x962a19,null));};exports[_0xc319('0x43')]=function(_0xbfec31,_0x198c58){return db['VoiceDialReport']['create'](_0xbfec31['body'],{})[_0xc319('0x22')](respondWithResult(_0x198c58,0xc9))[_0xc319('0x3e')](handleError(_0x198c58,null));};exports[_0xc319('0x21')]=function(_0x100070,_0x1201f2){if(_0x100070[_0xc319('0x44')]['id']){delete _0x100070[_0xc319('0x44')]['id'];}return db[_0xc319('0x3b')][_0xc319('0x42')]({'where':{'id':_0x100070[_0xc319('0x3f')]['id']}})[_0xc319('0x22')](handleEntityNotFound(_0x1201f2,null))['then'](saveUpdates(_0x100070[_0xc319('0x44')],null))[_0xc319('0x22')](respondWithResult(_0x1201f2,null))[_0xc319('0x3e')](handleError(_0x1201f2,null));};exports['destroy']=function(_0x1e41f7,_0x24c961){return db[_0xc319('0x3b')][_0xc319('0x42')]({'where':{'id':_0x1e41f7[_0xc319('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24c961,null))[_0xc319('0x22')](removeEntity(_0x24c961,null))['catch'](handleError(_0x24c961,null));};exports[_0xc319('0x45')]=function(_0x1e9da6,_0x2f7d99){return db[_0xc319('0x3b')][_0xc319('0x45')]()[_0xc319('0x22')](respondWithResult(_0x2f7d99,null))[_0xc319('0x3e')](handleError(_0x2f7d99,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 94cadd7..ad0cb29 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 _0x6977=['rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x4de668,_0x31ec06){var _0x3d36dd=function(_0x5ce568){while(--_0x5ce568){_0x4de668['push'](_0x4de668['shift']());}};_0x3d36dd(++_0x31ec06);}(_0x6977,0x89));var _0x7697=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x6977[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7697('0x0'));var util=require(_0x7697('0x1'));var logger=require('../../config/logger')(_0x7697('0x2'));var moment=require('moment');var BPromise=require(_0x7697('0x3'));var rp=require(_0x7697('0x4'));var fs=require('fs');var path=require(_0x7697('0x5'));var rimraf=require(_0x7697('0x6'));var config=require('../../config/environment');var attributes=require(_0x7697('0x7'));module[_0x7697('0x8')]=function(_0x374505,_0x457c6c){return _0x374505[_0x7697('0x9')](_0x7697('0xa'),attributes,{'tableName':_0x7697('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7697('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf45e=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x33a96b,_0x573ab4){var _0x241264=function(_0x568a4a){while(--_0x568a4a){_0x33a96b['push'](_0x33a96b['shift']());}};_0x241264(++_0x573ab4);}(_0xf45e,0x162));var _0xef45=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0xf45e[_0x718f1f];return _0x48b289;};'use strict';var _=require('lodash');var util=require(_0xef45('0x0'));var logger=require(_0xef45('0x1'))(_0xef45('0x2'));var moment=require('moment');var BPromise=require(_0xef45('0x3'));var rp=require(_0xef45('0x4'));var fs=require('fs');var path=require(_0xef45('0x5'));var rimraf=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var attributes=require(_0xef45('0x8'));module[_0xef45('0x9')]=function(_0x4b5c72,_0x4c7745){return _0x4b5c72[_0xef45('0xa')](_0xef45('0xb'),attributes,{'tableName':_0xef45('0xc'),'paranoid':![],'indexes':[{'fields':[_0xef45('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 6661b43..83b7483 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 _0x6f2e=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','catch','UpdateVoiceDialReport','update','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x6cacf1,_0x467a2b){var _0x505e1f=function(_0x51c6eb){while(--_0x51c6eb){_0x6cacf1['push'](_0x6cacf1['shift']());}};_0x505e1f(++_0x467a2b);}(_0x6f2e,0x17f));var _0xe6f2=function(_0x4b184b,_0x1cf09d){_0x4b184b=_0x4b184b-0x0;var _0x3a8b22=_0x6f2e[_0x4b184b];return _0x3a8b22;};'use strict';var _=require('lodash');var util=require(_0xe6f2('0x0'));var moment=require(_0xe6f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xe6f2('0x2'));var fs=require('fs');var Redis=require(_0xe6f2('0x3'));var db=require(_0xe6f2('0x4'))['db'];var utils=require(_0xe6f2('0x5'));var logger=require(_0xe6f2('0x6'))(_0xe6f2('0x7'));var config=require('../../config/environment');var jayson=require(_0xe6f2('0x8'));var client=jayson[_0xe6f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f4d5,_0x565256,_0x70680b){return new BPromise(function(_0x2aa4e7,_0x41a9aa){return client[_0xe6f2('0xa')](_0x10f4d5,_0x70680b)[_0xe6f2('0xb')](function(_0x519e3f){logger[_0xe6f2('0xc')](_0xe6f2('0xd'),_0x565256,_0xe6f2('0xe'));logger[_0xe6f2('0xf')](_0xe6f2('0x10'),_0x565256,_0xe6f2('0xe'),JSON['stringify'](_0x519e3f));if(_0x519e3f[_0xe6f2('0x11')]){if(_0x519e3f[_0xe6f2('0x11')][_0xe6f2('0x12')]===0x1f4){logger['error'](_0xe6f2('0xd'),_0x565256,_0x519e3f['error']['message']);return _0x41a9aa(_0x519e3f[_0xe6f2('0x11')][_0xe6f2('0x13')]);}logger['error'](_0xe6f2('0xd'),_0x565256,_0x519e3f[_0xe6f2('0x11')][_0xe6f2('0x13')]);return _0x2aa4e7(_0x519e3f[_0xe6f2('0x11')][_0xe6f2('0x13')]);}else{logger[_0xe6f2('0xc')](_0xe6f2('0xd'),_0x565256,_0xe6f2('0xe'));_0x2aa4e7(_0x519e3f[_0xe6f2('0x14')][_0xe6f2('0x13')]);}})['catch'](function(_0x2627a0){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x565256,_0x2627a0);_0x41a9aa(_0x2627a0);});});}exports['CreateVoiceDialReport']=function(_0x4fb746){var _0x408575=this;return new Promise(function(_0x1a1b03,_0x20909d){return db[_0xe6f2('0x15')][_0xe6f2('0x16')](_0x4fb746[_0xe6f2('0x17')],{'raw':_0x4fb746[_0xe6f2('0x18')]?_0x4fb746['options'][_0xe6f2('0x19')]===undefined?!![]:![]:!![]})[_0xe6f2('0xb')](function(_0x131c06){logger[_0xe6f2('0xc')]('CreateVoiceDialReport',_0x4fb746);logger['debug'](_0xe6f2('0x1a'),_0x4fb746,JSON[_0xe6f2('0x1b')](_0x131c06));_0x1a1b03(_0x131c06);})[_0xe6f2('0x1c')](function(_0x2e7c90){logger[_0xe6f2('0x11')](_0xe6f2('0x1a'),_0x2e7c90[_0xe6f2('0x13')],_0x4fb746);_0x20909d(_0x408575[_0xe6f2('0x11')](0x1f4,_0x2e7c90['message']));});});};exports[_0xe6f2('0x1d')]=function(_0x325582){var _0x1ad435=this;return new Promise(function(_0x39911b,_0x394343){return db[_0xe6f2('0x15')][_0xe6f2('0x1e')](_0x325582[_0xe6f2('0x17')],{'raw':_0x325582['options']?_0x325582[_0xe6f2('0x18')][_0xe6f2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325582['options']?_0x325582[_0xe6f2('0x18')]['where']||null:null,'attributes':_0x325582[_0xe6f2('0x18')]?_0x325582[_0xe6f2('0x18')][_0xe6f2('0x1f')]||null:null,'limit':_0x325582[_0xe6f2('0x18')]?_0x325582['options'][_0xe6f2('0x20')]||null:null})[_0xe6f2('0xb')](function(_0x46d869){logger[_0xe6f2('0xc')](_0xe6f2('0x1d'),_0x325582);logger['debug'](_0xe6f2('0x1d'),_0x325582,JSON[_0xe6f2('0x1b')](_0x46d869));_0x39911b(_0x46d869);})[_0xe6f2('0x1c')](function(_0x29901f){logger[_0xe6f2('0x11')](_0xe6f2('0x1d'),_0x29901f[_0xe6f2('0x13')],_0x325582);_0x394343(_0x1ad435[_0xe6f2('0x11')](0x1f4,_0x29901f[_0xe6f2('0x13')]));});});}; \ No newline at end of file +var _0x9def=['rpc','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','body','options','raw','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x9def,0x110));var _0xf9de=function(_0x4a5fcb,_0x4d3471){_0x4a5fcb=_0x4a5fcb-0x0;var _0x4f037d=_0x9def[_0x4a5fcb];return _0x4f037d;};'use strict';var _=require(_0xf9de('0x0'));var util=require(_0xf9de('0x1'));var moment=require(_0xf9de('0x2'));var BPromise=require(_0xf9de('0x3'));var rs=require(_0xf9de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9de('0x5'))['db'];var utils=require(_0xf9de('0x6'));var logger=require('../../config/logger')(_0xf9de('0x7'));var config=require(_0xf9de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9de('0x9')][_0xf9de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165a5d,_0x39e46b,_0x5c4f7a){return new BPromise(function(_0x96714d,_0x565457){return client['request'](_0x165a5d,_0x5c4f7a)[_0xf9de('0xb')](function(_0xb448cb){logger[_0xf9de('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x39e46b,_0xf9de('0xd'));logger[_0xf9de('0xe')](_0xf9de('0xf'),_0x39e46b,_0xf9de('0xd'),JSON[_0xf9de('0x10')](_0xb448cb));if(_0xb448cb[_0xf9de('0x11')]){if(_0xb448cb[_0xf9de('0x11')]['code']===0x1f4){logger[_0xf9de('0x11')](_0xf9de('0x12'),_0x39e46b,_0xb448cb['error'][_0xf9de('0x13')]);return _0x565457(_0xb448cb[_0xf9de('0x11')][_0xf9de('0x13')]);}logger[_0xf9de('0x11')](_0xf9de('0x12'),_0x39e46b,_0xb448cb['error'][_0xf9de('0x13')]);return _0x96714d(_0xb448cb['error'][_0xf9de('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x39e46b,_0xf9de('0xd'));_0x96714d(_0xb448cb[_0xf9de('0x14')]['message']);}})['catch'](function(_0x4d0377){logger['error'](_0xf9de('0x12'),_0x39e46b,_0x4d0377);_0x565457(_0x4d0377);});});}exports[_0xf9de('0x15')]=function(_0x3608cf){var _0xd46397=this;return new Promise(function(_0x44d549,_0x4f8524){return db[_0xf9de('0x16')]['create'](_0x3608cf[_0xf9de('0x17')],{'raw':_0x3608cf[_0xf9de('0x18')]?_0x3608cf[_0xf9de('0x18')][_0xf9de('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x10e679){logger[_0xf9de('0xc')]('CreateVoiceDialReport',_0x3608cf);logger[_0xf9de('0xe')](_0xf9de('0x15'),_0x3608cf,JSON[_0xf9de('0x10')](_0x10e679));_0x44d549(_0x10e679);})[_0xf9de('0x1a')](function(_0xeca74e){logger[_0xf9de('0x11')](_0xf9de('0x15'),_0xeca74e[_0xf9de('0x13')],_0x3608cf);_0x4f8524(_0xd46397[_0xf9de('0x11')](0x1f4,_0xeca74e[_0xf9de('0x13')]));});});};exports[_0xf9de('0x1b')]=function(_0x21ce2d){var _0xc64fc7=this;return new Promise(function(_0x49ee33,_0x122a33){return db[_0xf9de('0x16')][_0xf9de('0x1c')](_0x21ce2d['body'],{'raw':_0x21ce2d[_0xf9de('0x18')]?_0x21ce2d[_0xf9de('0x18')][_0xf9de('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ce2d[_0xf9de('0x18')]?_0x21ce2d[_0xf9de('0x18')][_0xf9de('0x1d')]||null:null,'attributes':_0x21ce2d['options']?_0x21ce2d[_0xf9de('0x18')]['attributes']||null:null,'limit':_0x21ce2d[_0xf9de('0x18')]?_0x21ce2d[_0xf9de('0x18')][_0xf9de('0x1e')]||null:null})['then'](function(_0x55c294){logger[_0xf9de('0xc')](_0xf9de('0x1b'),_0x21ce2d);logger[_0xf9de('0xe')](_0xf9de('0x1b'),_0x21ce2d,JSON[_0xf9de('0x10')](_0x55c294));_0x49ee33(_0x55c294);})['catch'](function(_0xb23720){logger[_0xf9de('0x11')](_0xf9de('0x1b'),_0xb23720[_0xf9de('0x13')],_0x21ce2d);_0x122a33(_0xc64fc7[_0xf9de('0x11')](0x1f4,_0xb23720[_0xf9de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a726a94..96d883d 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 _0x75ac=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','create','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','path'];(function(_0x288d3b,_0x1460e0){var _0x2d98c8=function(_0x44893f){while(--_0x44893f){_0x288d3b['push'](_0x288d3b['shift']());}};_0x2d98c8(++_0x1460e0);}(_0x75ac,0x1b6));var _0xc75a=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x75ac[_0x311909];return _0x8d3163;};'use strict';var multer=require(_0xc75a('0x0'));var util=require('util');var path=require(_0xc75a('0x1'));var timeout=require(_0xc75a('0x2'));var express=require(_0xc75a('0x3'));var router=express[_0xc75a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc75a('0x5'));var config=require(_0xc75a('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc75a('0x7')]);router[_0xc75a('0x8')]('/:id',auth[_0xc75a('0x9')](),controller[_0xc75a('0xa')]);router['post']('/',auth[_0xc75a('0x9')](),controller[_0xc75a('0xb')]);router[_0xc75a('0xc')](_0xc75a('0xd'),auth['isAuthenticated'](),controller[_0xc75a('0xe')]);router[_0xc75a('0xf')]('/:id',auth[_0xc75a('0x9')](),controller[_0xc75a('0x10')]);router[_0xc75a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc75a('0x12')]);module[_0xc75a('0x13')]=router; \ No newline at end of file +var _0x7b90=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','show','post','isAuthenticated','create','/:id/applications','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b90,0x69));var _0x07b9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7b90[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x07b9('0x0'));var util=require(_0x07b9('0x1'));var path=require(_0x07b9('0x2'));var timeout=require(_0x07b9('0x3'));var express=require(_0x07b9('0x4'));var router=express[_0x07b9('0x5')]();var auth=require(_0x07b9('0x6'));var interaction=require(_0x07b9('0x7'));var config=require(_0x07b9('0x8'));var controller=require(_0x07b9('0x9'));router[_0x07b9('0xa')]('/',auth['isAuthenticated'](),controller[_0x07b9('0xb')]);router[_0x07b9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x07b9('0xc')]);router[_0x07b9('0xd')]('/',auth[_0x07b9('0xe')](),controller[_0x07b9('0xf')]);router[_0x07b9('0xd')](_0x07b9('0x10'),auth[_0x07b9('0xe')](),controller['addApplications']);router[_0x07b9('0x11')]('/:id',auth[_0x07b9('0xe')](),controller[_0x07b9('0x12')]);router[_0x07b9('0x13')](_0x07b9('0x14'),auth[_0x07b9('0xe')](),controller[_0x07b9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 018c260..0f2b890 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(_0x221538,_0x194f59){var _0x4dfeb4=function(_0x1191c2){while(--_0x1191c2){_0x221538['push'](_0x221538['shift']());}};_0x4dfeb4(++_0x194f59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x415e30,_0x33e944){var _0x401aaa=function(_0x2838fb){while(--_0x2838fb){_0x415e30['push'](_0x415e30['shift']());}};_0x401aaa(++_0x33e944);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 38454c7..26087b4 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 _0xca89=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','limit','set','Content-Range','reject','update','then','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','destroy','send','index','VoiceExtension','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','create','body','startsWith','exten','concat','user','get','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','pick','context','description','cutdigits','mandatoryDisposition','addApplications','sequelize','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf'];(function(_0x4e84eb,_0x1fc234){var _0x27e3be=function(_0x53902e){while(--_0x53902e){_0x4e84eb['push'](_0x4e84eb['shift']());}};_0x27e3be(++_0x1fc234);}(_0xca89,0xd9));var _0x9ca8=function(_0x1d5437,_0x2af975){_0x1d5437=_0x1d5437-0x0;var _0x112202=_0xca89[_0x1d5437];return _0x112202;};'use strict';var pdf=require(_0x9ca8('0x0'));var emlformat=require(_0x9ca8('0x1'));var rimraf=require(_0x9ca8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ca8('0x3'));var rp=require(_0x9ca8('0x4'));var moment=require(_0x9ca8('0x5'));var BPromise=require(_0x9ca8('0x6'));var Mustache=require(_0x9ca8('0x7'));var util=require(_0x9ca8('0x8'));var path=require(_0x9ca8('0x9'));var sox=require(_0x9ca8('0xa'));var csv=require(_0x9ca8('0xb'));var ejs=require(_0x9ca8('0xc'));var fs=require('fs');var _=require(_0x9ca8('0xd'));var squel=require('squel');var crypto=require(_0x9ca8('0xe'));var jsforce=require(_0x9ca8('0xf'));var deskjs=require(_0x9ca8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9ca8('0x11'));var Papa=require(_0x9ca8('0x12'));var Redis=require('ioredis');var authService=require(_0x9ca8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9ca8('0x14'));var hardwareService=require(_0x9ca8('0x15'));var logger=require(_0x9ca8('0x16'))(_0x9ca8('0x17'));var utils=require(_0x9ca8('0x18'));var config=require(_0x9ca8('0x19'));var licenseUtil=require(_0x9ca8('0x1a'));var db=require(_0x9ca8('0x1b'))['db'];config[_0x9ca8('0x1c')]=_[_0x9ca8('0x1d')](config[_0x9ca8('0x1c')],{'host':_0x9ca8('0x1e'),'port':0x18eb});var socket=require(_0x9ca8('0x1f'))(new Redis(config[_0x9ca8('0x1c')]));require(_0x9ca8('0x20'))[_0x9ca8('0x21')](socket);function respondWithStatusCode(_0x1507a7,_0x596d3d){_0x596d3d=_0x596d3d||0xcc;return function(_0x335a1b){if(_0x335a1b){return _0x1507a7[_0x9ca8('0x22')](_0x596d3d);}return _0x1507a7['status'](_0x596d3d)[_0x9ca8('0x23')]();};}function respondWithResult(_0x427233,_0x221781){_0x221781=_0x221781||0xc8;return function(_0xa5a0f9){if(_0xa5a0f9){return _0x427233[_0x9ca8('0x24')](_0x221781)[_0x9ca8('0x25')](_0xa5a0f9);}};}function respondWithFilteredResult(_0x1b96f6,_0x1ae484){return function(_0x42832e){if(_0x42832e){var _0x2ff736=_0x42832e[_0x9ca8('0x26')],_0x643c77=_0x1ae484['offset'],_0x547ced=_0x1ae484['offset']+_0x1ae484[_0x9ca8('0x27')],_0x7380e9;if(_0x547ced>=_0x2ff736){_0x547ced=_0x2ff736;_0x7380e9=0xc8;}else{_0x7380e9=0xce;}_0x1b96f6[_0x9ca8('0x24')](_0x7380e9);return _0x1b96f6[_0x9ca8('0x28')](_0x9ca8('0x29'),_0x643c77+'-'+_0x547ced+'/'+_0x2ff736)[_0x9ca8('0x25')](_0x42832e);}return null;};}function patchUpdates(_0xd5515b){return function(_0x21e9ff){try{jsonpatch['apply'](_0x21e9ff,_0xd5515b,!![]);}catch(_0x54417c){return BPromise[_0x9ca8('0x2a')](_0x54417c);}return _0x21e9ff['save']();};}function saveUpdates(_0x1ee00e,_0x833c0a){return function(_0x55bcb4){if(_0x55bcb4){return _0x55bcb4[_0x9ca8('0x2b')](_0x1ee00e)[_0x9ca8('0x2c')](function(_0x31c349){return _0x31c349;});}return null;};}function removeEntity(_0x58da83,_0x23987c){return function(_0x5e54b5){if(_0x5e54b5){return _0x5e54b5['destroy']()[_0x9ca8('0x2c')](function(){var _0x453058=_0x5e54b5['get']({'plain':!![]});var _0x59f087=[{'name':_0x9ca8('0x2d'),'value':_0x9ca8('0x2e'),'ignore':![]},{'name':'OutboundRoutes','value':_0x9ca8('0x2f'),'ignore':![]},{'name':_0x9ca8('0x30'),'value':_0x9ca8('0x31'),'ignore':![]}];var _0x4f931b=_(_0x59f087)[_0x9ca8('0x32')](_0x9ca8('0x33'))[_0x9ca8('0x34')](_0x9ca8('0x35'))[_0x9ca8('0x35')]();if(_[_0x9ca8('0x36')](_0x4f931b,_0x453058['type'])){return;}var _0x53038b=_[_0x9ca8('0x37')](_0x59f087,[_0x9ca8('0x35'),_0x453058[_0x9ca8('0x38')]])[_0x9ca8('0x39')];return db[_0x9ca8('0x3a')][_0x9ca8('0x3b')]({'where':{'type':_0x53038b,'resourceId':_0x453058['id']}})[_0x9ca8('0x2c')](function(){return _0x5e54b5;});})[_0x9ca8('0x2c')](function(){_0x58da83[_0x9ca8('0x24')](0xcc)[_0x9ca8('0x23')]();});}};}function handleEntityNotFound(_0x2486d6,_0x490d70){return function(_0x3ebe69){if(!_0x3ebe69){_0x2486d6[_0x9ca8('0x22')](0x194);}return _0x3ebe69;};}function handleError(_0x1ca389,_0x356fbe){_0x356fbe=_0x356fbe||0x1f4;return function(_0x4eedb1){logger['error'](_0x4eedb1['stack']);if(_0x4eedb1[_0x9ca8('0x39')]){delete _0x4eedb1[_0x9ca8('0x39')];}_0x1ca389[_0x9ca8('0x24')](_0x356fbe)[_0x9ca8('0x3c')](_0x4eedb1);};}exports[_0x9ca8('0x3d')]=function(_0x4dc0b2,_0x3aca08){var _0x1fad0e={},_0x22a72a={},_0x103f6b={'count':0x0,'rows':[]};var _0x297190=_['map'](db[_0x9ca8('0x3e')][_0x9ca8('0x3f')],function(_0x42afe9){return{'name':_0x42afe9[_0x9ca8('0x40')],'type':_0x42afe9[_0x9ca8('0x38')][_0x9ca8('0x41')]};});_0x22a72a['model']=_['map'](_0x297190,_0x9ca8('0x39'));_0x22a72a['query']=_[_0x9ca8('0x42')](_0x4dc0b2[_0x9ca8('0x43')]);_0x22a72a[_0x9ca8('0x44')]=_[_0x9ca8('0x45')](_0x22a72a[_0x9ca8('0x46')],_0x22a72a[_0x9ca8('0x43')]);_0x1fad0e['attributes']=_[_0x9ca8('0x45')](_0x22a72a[_0x9ca8('0x46')],qs['fields'](_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x47')]));_0x1fad0e[_0x9ca8('0x48')]=_0x1fad0e[_0x9ca8('0x48')][_0x9ca8('0x49')]?_0x1fad0e[_0x9ca8('0x48')]:_0x22a72a[_0x9ca8('0x46')];if(!_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x4a')]('nolimit')){_0x1fad0e[_0x9ca8('0x27')]=qs['limit'](_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x27')]);_0x1fad0e['offset']=qs[_0x9ca8('0x4b')](_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x4b')]);}_0x1fad0e['order']=qs[_0x9ca8('0x4c')](_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x4c')]);_0x1fad0e[_0x9ca8('0x4d')]=qs[_0x9ca8('0x44')](_['pick'](_0x4dc0b2[_0x9ca8('0x43')],_0x22a72a['filters']),_0x297190);if(_0x4dc0b2['query'][_0x9ca8('0x32')]){_0x1fad0e[_0x9ca8('0x4d')]=_[_0x9ca8('0x4e')](_0x1fad0e[_0x9ca8('0x4d')],{'$or':_[_0x9ca8('0x34')](_0x297190,function(_0x5c7488){if(_0x5c7488['type']!==_0x9ca8('0x4f')){var _0x44b938={};_0x44b938[_0x5c7488['name']]={'$like':'%'+_0x4dc0b2['query'][_0x9ca8('0x32')]+'%'};return _0x44b938;}})});}_0x1fad0e=_[_0x9ca8('0x4e')]({},_0x1fad0e,_0x4dc0b2['options']);var _0x5bba54={'where':_0x1fad0e[_0x9ca8('0x4d')]};return db[_0x9ca8('0x3e')][_0x9ca8('0x26')](_0x5bba54)[_0x9ca8('0x2c')](function(_0x3c2d1e){_0x103f6b[_0x9ca8('0x26')]=_0x3c2d1e;if(_0x4dc0b2[_0x9ca8('0x43')][_0x9ca8('0x50')]){_0x1fad0e[_0x9ca8('0x51')]=[{'all':!![]}];}return db[_0x9ca8('0x3e')][_0x9ca8('0x52')](_0x1fad0e);})['then'](function(_0x54a52c){_0x103f6b[_0x9ca8('0x53')]=_0x54a52c;return _0x103f6b;})[_0x9ca8('0x2c')](respondWithFilteredResult(_0x3aca08,_0x1fad0e))[_0x9ca8('0x54')](handleError(_0x3aca08,null));};exports[_0x9ca8('0x55')]=function(_0x60a930,_0x388ed9){var _0x4af7e1={'raw':![],'where':{'id':_0x60a930['params']['id']}},_0x31ee25={};_0x31ee25[_0x9ca8('0x46')]=_[_0x9ca8('0x42')](db['VoiceExtension'][_0x9ca8('0x3f')]);_0x31ee25[_0x9ca8('0x43')]=_[_0x9ca8('0x42')](_0x60a930['query']);_0x31ee25[_0x9ca8('0x44')]=_[_0x9ca8('0x45')](_0x31ee25[_0x9ca8('0x46')],_0x31ee25['query']);_0x4af7e1[_0x9ca8('0x48')]=_[_0x9ca8('0x45')](_0x31ee25[_0x9ca8('0x46')],qs['fields'](_0x60a930[_0x9ca8('0x43')][_0x9ca8('0x47')]));_0x4af7e1[_0x9ca8('0x48')]=_0x4af7e1[_0x9ca8('0x48')][_0x9ca8('0x49')]?_0x4af7e1[_0x9ca8('0x48')]:_0x31ee25[_0x9ca8('0x46')];if(_0x60a930[_0x9ca8('0x43')]['includeAll']){_0x4af7e1[_0x9ca8('0x51')]=[{'all':!![]}];}_0x4af7e1=_[_0x9ca8('0x4e')]({},_0x4af7e1,_0x60a930['options']);return db['VoiceExtension'][_0x9ca8('0x37')](_0x4af7e1)[_0x9ca8('0x2c')](handleEntityNotFound(_0x388ed9,null))['then'](respondWithResult(_0x388ed9,null))[_0x9ca8('0x54')](handleError(_0x388ed9,null));};exports[_0x9ca8('0x3b')]=function(_0x8021d8,_0x5c8206){return db['VoiceExtension'][_0x9ca8('0x37')]({'where':{'id':_0x8021d8['params']['id']}})['then'](handleEntityNotFound(_0x5c8206,null))['then'](removeEntity(_0x5c8206,null))[_0x9ca8('0x54')](handleError(_0x5c8206,null));};exports[_0x9ca8('0x56')]=function(_0x2d5037,_0x4a6138){if(_0x2d5037[_0x9ca8('0x57')][_0x9ca8('0x38')]===_0x9ca8('0x2f')&&!_[_0x9ca8('0x58')](_0x2d5037[_0x9ca8('0x57')][_0x9ca8('0x59')],'_')){_0x2d5037['body'][_0x9ca8('0x59')]='_'[_0x9ca8('0x5a')](_0x2d5037[_0x9ca8('0x57')][_0x9ca8('0x59')]);}return db[_0x9ca8('0x3e')][_0x9ca8('0x56')](_0x2d5037[_0x9ca8('0x57')],{'raw':![]})['then'](function(_0x2fb152){var _0x15ce34=_0x2d5037[_0x9ca8('0x5b')][_0x9ca8('0x5c')]({'plain':!![]});if(!_0x15ce34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15ce34[_0x9ca8('0x5d')]==='user'){var _0x212fd2=_0x2fb152[_0x9ca8('0x5c')]({'plain':!![]});var _0xd8689a=[{'name':_0x9ca8('0x2d'),'value':_0x9ca8('0x2e')},{'name':'OutboundRoutes','value':_0x9ca8('0x2f')},{'name':'InternalRoutes','value':'internal'}];var _0x37499c=_[_0x9ca8('0x37')](_0xd8689a,[_0x9ca8('0x35'),_0x212fd2[_0x9ca8('0x38')]])[_0x9ca8('0x39')];return db[_0x9ca8('0x5e')][_0x9ca8('0x37')]({'where':{'name':_0x37499c,'userProfileId':_0x15ce34['userProfileId']},'raw':!![]})[_0x9ca8('0x2c')](function(_0x2b9f45){if(_0x2b9f45&&_0x2b9f45[_0x9ca8('0x5f')]===0x0){return db['UserProfileResource'][_0x9ca8('0x56')]({'name':_0x212fd2['name'],'resourceId':_0x212fd2['id'],'type':_0x2b9f45[_0x9ca8('0x39')],'sectionId':_0x2b9f45['id']},{})[_0x9ca8('0x2c')](function(){return _0x2fb152;});}else{return _0x2fb152;}})[_0x9ca8('0x54')](function(_0x59f006){logger[_0x9ca8('0x60')](_0x9ca8('0x61'),_0x59f006);throw _0x59f006;});}return _0x2fb152;})[_0x9ca8('0x2c')](respondWithResult(_0x4a6138,0xc9))[_0x9ca8('0x54')](handleError(_0x4a6138,null));};exports[_0x9ca8('0x2b')]=function(_0x595722,_0xcc9c83){if(_0x595722[_0x9ca8('0x57')]['id']){delete _0x595722['body']['id'];}return db[_0x9ca8('0x3e')][_0x9ca8('0x37')]({'where':{'id':_0x595722[_0x9ca8('0x62')]['id']}})[_0x9ca8('0x2c')](handleEntityNotFound(_0xcc9c83,null))[_0x9ca8('0x2c')](function(_0x6844a6){if(_0x6844a6){return db['VoiceExtension']['update'](_[_0x9ca8('0x63')](_0x595722[_0x9ca8('0x57')],[_0x9ca8('0x59'),_0x9ca8('0x64'),_0x9ca8('0x65'),'recordingFormat',_0x9ca8('0x66'),_0x9ca8('0x67')]),{'where':{'context':_0x6844a6[_0x9ca8('0x64')],'exten':_0x6844a6[_0x9ca8('0x59')]},'individualHooks':!![]})['then'](function(_0x523fa9){return _0x523fa9;});}return null;})['then'](respondWithStatusCode(_0xcc9c83,null))[_0x9ca8('0x54')](handleError(_0xcc9c83,null));};exports[_0x9ca8('0x68')]=function(_0x192aa2,_0x322aa3,_0x1c8b95){return db['VoiceExtension']['findOne']({'where':{'id':_0x192aa2['params']['id']}})[_0x9ca8('0x2c')](handleEntityNotFound(_0x322aa3,null))[_0x9ca8('0x2c')](function(_0x43385e){if(_0x43385e){return db[_0x9ca8('0x69')]['transaction'](function(_0x345fdc){return db[_0x9ca8('0x3e')][_0x9ca8('0x3b')]({'where':{'VoiceExtensionId':_0x192aa2[_0x9ca8('0x62')]['id']},'transaction':_0x345fdc})[_0x9ca8('0x2c')](function(_0x58e98c){var _0x49d741=_[_0x9ca8('0x34')](_0x192aa2[_0x9ca8('0x57')],function(_0x5a1148){_0x5a1148['VoiceExtensionId']=_0x192aa2['params']['id'];return _0x5a1148;});return db[_0x9ca8('0x3e')][_0x9ca8('0x6a')](_0x49d741,{'transaction':_0x345fdc});});})[_0x9ca8('0x2c')](function(){return db[_0x9ca8('0x3e')][_0x9ca8('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x192aa2[_0x9ca8('0x62')]['id']},'order':_0x9ca8('0x6c')});});}})['then'](respondWithResult(_0x322aa3,null))[_0x9ca8('0x54')](handleError(_0x322aa3,null));}; \ No newline at end of file +var _0x308a=['pick','filter','includeAll','include','findAll','params','keys','rawAttributes','length','merge','options','catch','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','type','find','value','name','UserProfileResource','destroy','then','error','stack','send','index','VoiceExtension','fieldName','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5b8e5a,_0x2e339e){var _0x21bd97=function(_0x525533){while(--_0x525533){_0x5b8e5a['push'](_0x5b8e5a['shift']());}};_0x21bd97(++_0x2e339e);}(_0x308a,0x82));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xa308('0x0'));var emlformat=require(_0xa308('0x1'));var rimraf=require(_0xa308('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa308('0x3'));var rp=require('request-promise');var moment=require(_0xa308('0x4'));var BPromise=require(_0xa308('0x5'));var Mustache=require(_0xa308('0x6'));var util=require(_0xa308('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa308('0x8'));var ejs=require(_0xa308('0x9'));var fs=require('fs');var _=require(_0xa308('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa308('0xb'));var deskjs=require(_0xa308('0xc'));var toCsv=require(_0xa308('0x8'));var querystring=require(_0xa308('0xd'));var Papa=require('papaparse');var Redis=require(_0xa308('0xe'));var authService=require(_0xa308('0xf'));var qs=require(_0xa308('0x10'));var as=require(_0xa308('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa308('0x12'))(_0xa308('0x13'));var utils=require('../../config/utils');var config=require(_0xa308('0x14'));var licenseUtil=require(_0xa308('0x15'));var db=require(_0xa308('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa308('0x17'),'port':0x18eb});var socket=require(_0xa308('0x18'))(new Redis(config['redis']));require(_0xa308('0x19'))['register'](socket);function respondWithStatusCode(_0x423ac8,_0x53c179){_0x53c179=_0x53c179||0xcc;return function(_0x113490){if(_0x113490){return _0x423ac8[_0xa308('0x1a')](_0x53c179);}return _0x423ac8[_0xa308('0x1b')](_0x53c179)[_0xa308('0x1c')]();};}function respondWithResult(_0x4df4c9,_0x4af0eb){_0x4af0eb=_0x4af0eb||0xc8;return function(_0x4fa0fa){if(_0x4fa0fa){return _0x4df4c9[_0xa308('0x1b')](_0x4af0eb)[_0xa308('0x1d')](_0x4fa0fa);}};}function respondWithFilteredResult(_0x23e58d,_0x59d7c9){return function(_0x4b2443){if(_0x4b2443){var _0x23d255=_0x4b2443[_0xa308('0x1e')],_0x24d857=_0x59d7c9[_0xa308('0x1f')],_0x231670=_0x59d7c9[_0xa308('0x1f')]+_0x59d7c9[_0xa308('0x20')],_0xc6ea3;if(_0x231670>=_0x23d255){_0x231670=_0x23d255;_0xc6ea3=0xc8;}else{_0xc6ea3=0xce;}_0x23e58d['status'](_0xc6ea3);return _0x23e58d[_0xa308('0x21')](_0xa308('0x22'),_0x24d857+'-'+_0x231670+'/'+_0x23d255)[_0xa308('0x1d')](_0x4b2443);}return null;};}function patchUpdates(_0x1b1290){return function(_0x3202b1){try{jsonpatch['apply'](_0x3202b1,_0x1b1290,!![]);}catch(_0xf9fb06){return BPromise['reject'](_0xf9fb06);}return _0x3202b1[_0xa308('0x23')]();};}function saveUpdates(_0x14611c,_0x223f6a){return function(_0x290b54){if(_0x290b54){return _0x290b54[_0xa308('0x24')](_0x14611c)['then'](function(_0x5c57a9){return _0x5c57a9;});}return null;};}function removeEntity(_0x563601,_0x128224){return function(_0x75f0b){if(_0x75f0b){return _0x75f0b['destroy']()['then'](function(){var _0x205748=_0x75f0b['get']({'plain':!![]});var _0x2049b1=[{'name':_0xa308('0x25'),'value':_0xa308('0x26'),'ignore':![]},{'name':_0xa308('0x27'),'value':_0xa308('0x28'),'ignore':![]},{'name':_0xa308('0x29'),'value':_0xa308('0x2a'),'ignore':![]}];var _0x424834=_(_0x2049b1)['filter']('ignore')['map']('value')['value']();if(_['includes'](_0x424834,_0x205748[_0xa308('0x2b')])){return;}var _0x4544fc=_[_0xa308('0x2c')](_0x2049b1,[_0xa308('0x2d'),_0x205748[_0xa308('0x2b')]])[_0xa308('0x2e')];return db[_0xa308('0x2f')][_0xa308('0x30')]({'where':{'type':_0x4544fc,'resourceId':_0x205748['id']}})[_0xa308('0x31')](function(){return _0x75f0b;});})[_0xa308('0x31')](function(){_0x563601[_0xa308('0x1b')](0xcc)[_0xa308('0x1c')]();});}};}function handleEntityNotFound(_0x1af98f,_0x4e5229){return function(_0x5151f8){if(!_0x5151f8){_0x1af98f[_0xa308('0x1a')](0x194);}return _0x5151f8;};}function handleError(_0x1468df,_0x28e119){_0x28e119=_0x28e119||0x1f4;return function(_0x193aa3){logger[_0xa308('0x32')](_0x193aa3[_0xa308('0x33')]);if(_0x193aa3[_0xa308('0x2e')]){delete _0x193aa3[_0xa308('0x2e')];}_0x1468df[_0xa308('0x1b')](_0x28e119)[_0xa308('0x34')](_0x193aa3);};}exports[_0xa308('0x35')]=function(_0x5f1a0f,_0x5927a5){var _0x2da0fc={},_0x473a87={},_0x387772={'count':0x0,'rows':[]};var _0x252374=_['map'](db[_0xa308('0x36')]['rawAttributes'],function(_0x3aca93){return{'name':_0x3aca93[_0xa308('0x37')],'type':_0x3aca93[_0xa308('0x2b')][_0xa308('0x38')]};});_0x473a87[_0xa308('0x39')]=_[_0xa308('0x3a')](_0x252374,'name');_0x473a87[_0xa308('0x3b')]=_['keys'](_0x5f1a0f[_0xa308('0x3b')]);_0x473a87['filters']=_['intersection'](_0x473a87[_0xa308('0x39')],_0x473a87[_0xa308('0x3b')]);_0x2da0fc[_0xa308('0x3c')]=_[_0xa308('0x3d')](_0x473a87[_0xa308('0x39')],qs['fields'](_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x3e')]));_0x2da0fc['attributes']=_0x2da0fc[_0xa308('0x3c')]['length']?_0x2da0fc[_0xa308('0x3c')]:_0x473a87['model'];if(!_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x3f')](_0xa308('0x40'))){_0x2da0fc['limit']=qs['limit'](_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x20')]);_0x2da0fc[_0xa308('0x1f')]=qs[_0xa308('0x1f')](_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x1f')]);}_0x2da0fc['order']=qs[_0xa308('0x41')](_0x5f1a0f[_0xa308('0x3b')]['sort']);_0x2da0fc[_0xa308('0x42')]=qs[_0xa308('0x43')](_[_0xa308('0x44')](_0x5f1a0f[_0xa308('0x3b')],_0x473a87[_0xa308('0x43')]),_0x252374);if(_0x5f1a0f['query'][_0xa308('0x45')]){_0x2da0fc[_0xa308('0x42')]=_['merge'](_0x2da0fc[_0xa308('0x42')],{'$or':_['map'](_0x252374,function(_0x57c00c){if(_0x57c00c[_0xa308('0x2b')]!=='VIRTUAL'){var _0x5cb7a0={};_0x5cb7a0[_0x57c00c['name']]={'$like':'%'+_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x45')]+'%'};return _0x5cb7a0;}})});}_0x2da0fc=_['merge']({},_0x2da0fc,_0x5f1a0f['options']);var _0x3634ef={'where':_0x2da0fc[_0xa308('0x42')]};return db[_0xa308('0x36')][_0xa308('0x1e')](_0x3634ef)[_0xa308('0x31')](function(_0x560ccb){_0x387772[_0xa308('0x1e')]=_0x560ccb;if(_0x5f1a0f[_0xa308('0x3b')][_0xa308('0x46')]){_0x2da0fc[_0xa308('0x47')]=[{'all':!![]}];}return db[_0xa308('0x36')][_0xa308('0x48')](_0x2da0fc);})[_0xa308('0x31')](function(_0x2c3279){_0x387772['rows']=_0x2c3279;return _0x387772;})[_0xa308('0x31')](respondWithFilteredResult(_0x5927a5,_0x2da0fc))['catch'](handleError(_0x5927a5,null));};exports['show']=function(_0x24cfcb,_0x20f60d){var _0x4c05c3={'raw':![],'where':{'id':_0x24cfcb[_0xa308('0x49')]['id']}},_0x5bc6a6={};_0x5bc6a6['model']=_[_0xa308('0x4a')](db['VoiceExtension'][_0xa308('0x4b')]);_0x5bc6a6['query']=_[_0xa308('0x4a')](_0x24cfcb[_0xa308('0x3b')]);_0x5bc6a6[_0xa308('0x43')]=_['intersection'](_0x5bc6a6[_0xa308('0x39')],_0x5bc6a6[_0xa308('0x3b')]);_0x4c05c3['attributes']=_[_0xa308('0x3d')](_0x5bc6a6[_0xa308('0x39')],qs[_0xa308('0x3e')](_0x24cfcb[_0xa308('0x3b')][_0xa308('0x3e')]));_0x4c05c3[_0xa308('0x3c')]=_0x4c05c3[_0xa308('0x3c')][_0xa308('0x4c')]?_0x4c05c3[_0xa308('0x3c')]:_0x5bc6a6[_0xa308('0x39')];if(_0x24cfcb[_0xa308('0x3b')][_0xa308('0x46')]){_0x4c05c3[_0xa308('0x47')]=[{'all':!![]}];}_0x4c05c3=_[_0xa308('0x4d')]({},_0x4c05c3,_0x24cfcb[_0xa308('0x4e')]);return db[_0xa308('0x36')][_0xa308('0x2c')](_0x4c05c3)[_0xa308('0x31')](handleEntityNotFound(_0x20f60d,null))[_0xa308('0x31')](respondWithResult(_0x20f60d,null))[_0xa308('0x4f')](handleError(_0x20f60d,null));};exports[_0xa308('0x30')]=function(_0x285608,_0x2270d6){return db[_0xa308('0x36')]['find']({'where':{'id':_0x285608[_0xa308('0x49')]['id']}})[_0xa308('0x31')](handleEntityNotFound(_0x2270d6,null))['then'](removeEntity(_0x2270d6,null))[_0xa308('0x4f')](handleError(_0x2270d6,null));};exports[_0xa308('0x50')]=function(_0x508973,_0x23e599){if(_0x508973[_0xa308('0x51')][_0xa308('0x2b')]===_0xa308('0x28')&&!_['startsWith'](_0x508973[_0xa308('0x51')][_0xa308('0x52')],'_')){_0x508973[_0xa308('0x51')][_0xa308('0x52')]='_'[_0xa308('0x53')](_0x508973[_0xa308('0x51')]['exten']);}return db[_0xa308('0x36')][_0xa308('0x50')](_0x508973['body'],{'raw':![]})[_0xa308('0x31')](function(_0x43f7f8){var _0x299aae=_0x508973[_0xa308('0x54')][_0xa308('0x55')]({'plain':!![]});if(!_0x299aae)throw new Error(_0xa308('0x56'));if(_0x299aae['role']==='user'){var _0x2304e2=_0x43f7f8[_0xa308('0x55')]({'plain':!![]});var _0x3856b2=[{'name':_0xa308('0x25'),'value':'inbound'},{'name':_0xa308('0x27'),'value':_0xa308('0x28')},{'name':_0xa308('0x29'),'value':_0xa308('0x2a')}];var _0x199da9=_[_0xa308('0x2c')](_0x3856b2,['value',_0x2304e2[_0xa308('0x2b')]])[_0xa308('0x2e')];return db[_0xa308('0x57')][_0xa308('0x2c')]({'where':{'name':_0x199da9,'userProfileId':_0x299aae[_0xa308('0x58')]},'raw':!![]})['then'](function(_0x5dc3ea){if(_0x5dc3ea&&_0x5dc3ea[_0xa308('0x59')]===0x0){return db[_0xa308('0x2f')][_0xa308('0x50')]({'name':_0x2304e2[_0xa308('0x2e')],'resourceId':_0x2304e2['id'],'type':_0x5dc3ea[_0xa308('0x2e')],'sectionId':_0x5dc3ea['id']},{})['then'](function(){return _0x43f7f8;});}else{return _0x43f7f8;}})[_0xa308('0x4f')](function(_0x30d1ba){logger[_0xa308('0x32')](_0xa308('0x5a'),_0x30d1ba);throw _0x30d1ba;});}return _0x43f7f8;})[_0xa308('0x31')](respondWithResult(_0x23e599,0xc9))['catch'](handleError(_0x23e599,null));};exports[_0xa308('0x24')]=function(_0x31cfac,_0x36a6fd){if(_0x31cfac[_0xa308('0x51')]['id']){delete _0x31cfac[_0xa308('0x51')]['id'];}return db[_0xa308('0x36')]['find']({'where':{'id':_0x31cfac['params']['id']}})[_0xa308('0x31')](handleEntityNotFound(_0x36a6fd,null))[_0xa308('0x31')](function(_0x398256){if(_0x398256){return db[_0xa308('0x36')][_0xa308('0x24')](_['pick'](_0x31cfac[_0xa308('0x51')],[_0xa308('0x52'),_0xa308('0x5b'),_0xa308('0x5c'),_0xa308('0x5d'),_0xa308('0x5e'),'mandatoryDisposition']),{'where':{'context':_0x398256[_0xa308('0x5b')],'exten':_0x398256[_0xa308('0x52')]},'individualHooks':!![]})[_0xa308('0x31')](function(_0x2c3094){return _0x2c3094;});}return null;})[_0xa308('0x31')](respondWithStatusCode(_0x36a6fd,null))[_0xa308('0x4f')](handleError(_0x36a6fd,null));};exports['addApplications']=function(_0x4f3557,_0x7feb3e,_0x240b3c){return db[_0xa308('0x36')]['findOne']({'where':{'id':_0x4f3557['params']['id']}})[_0xa308('0x31')](handleEntityNotFound(_0x7feb3e,null))[_0xa308('0x31')](function(_0x32a7ac){if(_0x32a7ac){return db[_0xa308('0x5f')][_0xa308('0x60')](function(_0x3a8f29){return db[_0xa308('0x36')][_0xa308('0x30')]({'where':{'VoiceExtensionId':_0x4f3557[_0xa308('0x49')]['id']},'transaction':_0x3a8f29})[_0xa308('0x31')](function(_0x1e225f){var _0x431b7d=_[_0xa308('0x3a')](_0x4f3557[_0xa308('0x51')],function(_0x8f60b6){_0x8f60b6[_0xa308('0x61')]=_0x4f3557[_0xa308('0x49')]['id'];return _0x8f60b6;});return db[_0xa308('0x36')]['bulkCreate'](_0x431b7d,{'transaction':_0x3a8f29});});})[_0xa308('0x31')](function(){return db['VoiceExtension'][_0xa308('0x62')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4f3557[_0xa308('0x49')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xa308('0x31')](respondWithResult(_0x7feb3e,null))[_0xa308('0x4f')](handleError(_0x7feb3e,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 805bc87..e898796 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 _0x0da5=['events','save','remove','emit','hasOwnProperty','exports'];(function(_0x916ccc,_0x19734f){var _0xfd449b=function(_0xa31c4b){while(--_0xa31c4b){_0x916ccc['push'](_0x916ccc['shift']());}};_0xfd449b(++_0x19734f);}(_0x0da5,0xea));var _0x50da=function(_0x4469cf,_0x51942b){_0x4469cf=_0x4469cf-0x0;var _0x2bfba2=_0x0da5[_0x4469cf];return _0x2bfba2;};'use strict';var EventEmitter=require(_0x50da('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50da('0x1'),'afterUpdate':'update','afterDestroy':_0x50da('0x2')};function emitEvent(_0x299a47){return function(_0x531750,_0x1c41f3,_0x4c64f8){VoiceExtensionEvents[_0x50da('0x3')](_0x299a47+':'+_0x531750['id'],_0x531750);VoiceExtensionEvents[_0x50da('0x3')](_0x299a47,_0x531750);_0x4c64f8(null);};}for(var e in events){if(events[_0x50da('0x4')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x50da('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0805=['setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x0805,0x83));var _0x5080=function(_0x533352,_0x306702){_0x533352=_0x533352-0x0;var _0x486a6b=_0x0805[_0x533352];return _0x486a6b;};'use strict';var EventEmitter=require(_0x5080('0x0'));var VoiceExtension=require(_0x5080('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5080('0x2')](0x0);var events={'afterCreate':_0x5080('0x3'),'afterUpdate':_0x5080('0x4'),'afterDestroy':_0x5080('0x5')};function emitEvent(_0x4e6857){return function(_0x5cd615,_0x3c98a7,_0x5495b6){VoiceExtensionEvents['emit'](_0x4e6857+':'+_0x5cd615['id'],_0x5cd615);VoiceExtensionEvents[_0x5080('0x6')](_0x4e6857,_0x5cd615);_0x5495b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f22b521..033bc02 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 _0x0987=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceExtension','lodash','util'];(function(_0xab9e3,_0x2e15e2){var _0x551e11=function(_0x342b4d){while(--_0x342b4d){_0xab9e3['push'](_0xab9e3['shift']());}};_0x551e11(++_0x2e15e2);}(_0x0987,0x1d2));var _0x7098=function(_0x30cb50,_0x579ffc){_0x30cb50=_0x30cb50-0x0;var _0x32739b=_0x0987[_0x30cb50];return _0x32739b;};'use strict';var _=require(_0x7098('0x0'));var util=require(_0x7098('0x1'));var logger=require(_0x7098('0x2'))('api');var moment=require(_0x7098('0x3'));var BPromise=require(_0x7098('0x4'));var rp=require(_0x7098('0x5'));var fs=require('fs');var path=require(_0x7098('0x6'));var rimraf=require(_0x7098('0x7'));var config=require(_0x7098('0x8'));var attributes=require('./voiceExtension.attributes');module[_0x7098('0x9')]=function(_0x4383a0,_0x1c60bb){return _0x4383a0[_0x7098('0xa')](_0x7098('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0c9=['../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0xb0c9,0xad));var _0x9b0c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb0c9[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var logger=require(_0x9b0c('0x2'))(_0x9b0c('0x3'));var moment=require(_0x9b0c('0x4'));var BPromise=require(_0x9b0c('0x5'));var rp=require(_0x9b0c('0x6'));var fs=require('fs');var path=require(_0x9b0c('0x7'));var rimraf=require(_0x9b0c('0x8'));var config=require(_0x9b0c('0x9'));var attributes=require(_0x9b0c('0xa'));module[_0x9b0c('0xb')]=function(_0x1d4706,_0x5a994a){return _0x1d4706[_0x9b0c('0xc')](_0x9b0c('0xd'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 31cf760..3e9db41 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 _0x9769=['info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voiceExtension.socket','register','then'];(function(_0x3296a7,_0x42fa30){var _0x4e2010=function(_0x3854ad){while(--_0x3854ad){_0x3296a7['push'](_0x3296a7['shift']());}};_0x4e2010(++_0x42fa30);}(_0x9769,0x162));var _0x9976=function(_0x171791,_0x2ecb6a){_0x171791=_0x171791-0x0;var _0xfd9f08=_0x9769[_0x171791];return _0xfd9f08;};'use strict';var _=require(_0x9976('0x0'));var util=require(_0x9976('0x1'));var moment=require('moment');var BPromise=require(_0x9976('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9976('0x3'));var db=require(_0x9976('0x4'))['db'];var utils=require(_0x9976('0x5'));var logger=require(_0x9976('0x6'))(_0x9976('0x7'));var config=require(_0x9976('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9976('0x9')][_0x9976('0xa')]({'port':0x232a});config[_0x9976('0xb')]=_[_0x9976('0xc')](config[_0x9976('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9976('0xb')]));require(_0x9976('0xd'))[_0x9976('0xe')](socket);function respondWithRpcPromise(_0xfb872c,_0x59116b,_0x26dcc1){return new BPromise(function(_0x4b5005,_0xf737f2){return client['request'](_0xfb872c,_0x26dcc1)[_0x9976('0xf')](function(_0x34f6fd){logger[_0x9976('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x59116b,_0x9976('0x11'));logger[_0x9976('0x12')](_0x9976('0x13'),_0x59116b,_0x9976('0x11'),JSON[_0x9976('0x14')](_0x34f6fd));if(_0x34f6fd[_0x9976('0x15')]){if(_0x34f6fd[_0x9976('0x15')][_0x9976('0x16')]===0x1f4){logger['error'](_0x9976('0x17'),_0x59116b,_0x34f6fd['error'][_0x9976('0x18')]);return _0xf737f2(_0x34f6fd[_0x9976('0x15')]['message']);}logger[_0x9976('0x15')](_0x9976('0x17'),_0x59116b,_0x34f6fd[_0x9976('0x15')][_0x9976('0x18')]);return _0x4b5005(_0x34f6fd[_0x9976('0x15')][_0x9976('0x18')]);}else{logger[_0x9976('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x59116b,_0x9976('0x11'));_0x4b5005(_0x34f6fd[_0x9976('0x19')][_0x9976('0x18')]);}})[_0x9976('0x1a')](function(_0x1d8bf1){logger[_0x9976('0x15')](_0x9976('0x17'),_0x59116b,_0x1d8bf1);_0xf737f2(_0x1d8bf1);});});}exports[_0x9976('0x1b')]=function(_0x4b852c){var _0x55e906=this;return new Promise(function(_0x3fa44b,_0x3844b7){return db[_0x9976('0x1c')]['findAll']({'raw':_0x4b852c[_0x9976('0x1d')]?_0x4b852c['options'][_0x9976('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b852c[_0x9976('0x1d')]?_0x4b852c[_0x9976('0x1d')][_0x9976('0x1f')]||null:null,'attributes':_0x4b852c['options']?_0x4b852c[_0x9976('0x1d')][_0x9976('0x20')]||null:null,'limit':_0x4b852c[_0x9976('0x1d')]?_0x4b852c['options'][_0x9976('0x21')]||null:null,'include':_0x4b852c[_0x9976('0x1d')]?_0x4b852c[_0x9976('0x1d')][_0x9976('0x22')]?_[_0x9976('0x23')](_0x4b852c[_0x9976('0x1d')][_0x9976('0x22')],function(_0x2cad2c){return{'model':db[_0x2cad2c[_0x9976('0x24')]],'as':_0x2cad2c['as'],'attributes':_0x2cad2c[_0x9976('0x20')],'include':_0x2cad2c[_0x9976('0x22')]?_[_0x9976('0x23')](_0x2cad2c[_0x9976('0x22')],function(_0x3e20ed){return{'model':db[_0x3e20ed[_0x9976('0x24')]],'as':_0x3e20ed['as'],'attributes':_0x3e20ed[_0x9976('0x20')],'include':_0x3e20ed[_0x9976('0x22')]?_['map'](_0x3e20ed[_0x9976('0x22')],function(_0x4f3b2e){return{'model':db[_0x4f3b2e[_0x9976('0x24')]],'as':_0x4f3b2e['as'],'attributes':_0x4f3b2e[_0x9976('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9976('0xf')](function(_0x56df96){logger[_0x9976('0x10')](_0x9976('0x1b'),_0x4b852c);logger[_0x9976('0x12')](_0x9976('0x1b'),_0x4b852c,JSON[_0x9976('0x14')](_0x56df96));_0x3fa44b(_0x56df96);})['catch'](function(_0x182a53){logger[_0x9976('0x15')](_0x9976('0x1b'),_0x182a53[_0x9976('0x18')],_0x4b852c);_0x3844b7(_0x55e906[_0x9976('0x15')](0x1f4,_0x182a53[_0x9976('0x18')]));});});}; \ No newline at end of file +var _0x0d27=['stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x37e8e8,_0x1be63e){var _0x2c3c9e=function(_0x4e3a54){while(--_0x4e3a54){_0x37e8e8['push'](_0x37e8e8['shift']());}};_0x2c3c9e(++_0x1be63e);}(_0x0d27,0xd2));var _0x70d2=function(_0x272eb6,_0x48a803){_0x272eb6=_0x272eb6-0x0;var _0x49de9e=_0x0d27[_0x272eb6];return _0x49de9e;};'use strict';var _=require(_0x70d2('0x0'));var util=require(_0x70d2('0x1'));var moment=require(_0x70d2('0x2'));var BPromise=require(_0x70d2('0x3'));var rs=require(_0x70d2('0x4'));var fs=require('fs');var Redis=require(_0x70d2('0x5'));var db=require(_0x70d2('0x6'))['db'];var utils=require(_0x70d2('0x7'));var logger=require('../../config/logger')(_0x70d2('0x8'));var config=require(_0x70d2('0x9'));var jayson=require(_0x70d2('0xa'));var client=jayson[_0x70d2('0xb')]['http']({'port':0x232a});config['redis']=_[_0x70d2('0xc')](config[_0x70d2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x70d2('0xe'))(new Redis(config[_0x70d2('0xd')]));require(_0x70d2('0xf'))[_0x70d2('0x10')](socket);function respondWithRpcPromise(_0x47cbdc,_0x2aeb92,_0x5df847){return new BPromise(function(_0x3574d3,_0x2375bd){return client[_0x70d2('0x11')](_0x47cbdc,_0x5df847)[_0x70d2('0x12')](function(_0x4b3b5c){logger[_0x70d2('0x13')](_0x70d2('0x14'),_0x2aeb92,_0x70d2('0x15'));logger[_0x70d2('0x16')](_0x70d2('0x17'),_0x2aeb92,_0x70d2('0x15'),JSON[_0x70d2('0x18')](_0x4b3b5c));if(_0x4b3b5c[_0x70d2('0x19')]){if(_0x4b3b5c[_0x70d2('0x19')][_0x70d2('0x1a')]===0x1f4){logger[_0x70d2('0x19')](_0x70d2('0x14'),_0x2aeb92,_0x4b3b5c[_0x70d2('0x19')][_0x70d2('0x1b')]);return _0x2375bd(_0x4b3b5c[_0x70d2('0x19')][_0x70d2('0x1b')]);}logger[_0x70d2('0x19')](_0x70d2('0x14'),_0x2aeb92,_0x4b3b5c[_0x70d2('0x19')][_0x70d2('0x1b')]);return _0x3574d3(_0x4b3b5c[_0x70d2('0x19')][_0x70d2('0x1b')]);}else{logger[_0x70d2('0x13')](_0x70d2('0x14'),_0x2aeb92,'request\x20sent');_0x3574d3(_0x4b3b5c[_0x70d2('0x1c')][_0x70d2('0x1b')]);}})[_0x70d2('0x1d')](function(_0x5b1d5e){logger['error'](_0x70d2('0x14'),_0x2aeb92,_0x5b1d5e);_0x2375bd(_0x5b1d5e);});});}exports[_0x70d2('0x1e')]=function(_0x495cca){var _0x3f6439=this;return new Promise(function(_0xf9481f,_0x493903){return db['VoiceExtension'][_0x70d2('0x1f')]({'raw':_0x495cca[_0x70d2('0x20')]?_0x495cca[_0x70d2('0x20')][_0x70d2('0x21')]===undefined?!![]:![]:!![],'where':_0x495cca['options']?_0x495cca[_0x70d2('0x20')][_0x70d2('0x22')]||null:null,'attributes':_0x495cca[_0x70d2('0x20')]?_0x495cca[_0x70d2('0x20')][_0x70d2('0x23')]||null:null,'limit':_0x495cca['options']?_0x495cca[_0x70d2('0x20')]['limit']||null:null,'include':_0x495cca['options']?_0x495cca[_0x70d2('0x20')][_0x70d2('0x24')]?_[_0x70d2('0x25')](_0x495cca[_0x70d2('0x20')]['include'],function(_0x249dbc){return{'model':db[_0x249dbc['model']],'as':_0x249dbc['as'],'attributes':_0x249dbc[_0x70d2('0x23')],'include':_0x249dbc[_0x70d2('0x24')]?_[_0x70d2('0x25')](_0x249dbc['include'],function(_0x29a72d){return{'model':db[_0x29a72d[_0x70d2('0x26')]],'as':_0x29a72d['as'],'attributes':_0x29a72d['attributes'],'include':_0x29a72d['include']?_['map'](_0x29a72d['include'],function(_0x16057c){return{'model':db[_0x16057c[_0x70d2('0x26')]],'as':_0x16057c['as'],'attributes':_0x16057c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ac405){logger[_0x70d2('0x13')](_0x70d2('0x1e'),_0x495cca);logger['debug']('GetVoiceExtension',_0x495cca,JSON[_0x70d2('0x18')](_0x1ac405));_0xf9481f(_0x1ac405);})[_0x70d2('0x1d')](function(_0x32f0c8){logger[_0x70d2('0x19')](_0x70d2('0x1e'),_0x32f0c8[_0x70d2('0x1b')],_0x495cca);_0x493903(_0x3f6439[_0x70d2('0x19')](0x1f4,_0x32f0c8[_0x70d2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c5e4856..48fa3e3 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 _0xd44e=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x292893,_0x3cd21e){var _0x5a55ac=function(_0x420f8d){while(--_0x420f8d){_0x292893['push'](_0x292893['shift']());}};_0x5a55ac(++_0x3cd21e);}(_0xd44e,0xe4));var _0xed44=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd44e[_0x20a584];return _0x4b41a8;};'use strict';var VoiceExtensionEvents=require(_0xed44('0x0'));var events=[_0xed44('0x1'),_0xed44('0x2'),_0xed44('0x3')];function createListener(_0xe6a6f0,_0x895a62){return function(_0x5aa08d){_0x895a62[_0xed44('0x4')](_0xe6a6f0,_0x5aa08d);};}function removeListener(_0x122d14,_0x1d5c3b){return function(){VoiceExtensionEvents[_0xed44('0x5')](_0x122d14,_0x1d5c3b);};}exports[_0xed44('0x6')]=function(_0x50ef14){for(var _0x161289=0x0,_0x44b542=events[_0xed44('0x7')];_0x161289<_0x44b542;_0x161289++){var _0x48acc3=events[_0x161289];var _0x58d1f8=createListener(_0xed44('0x8')+_0x48acc3,_0x50ef14);VoiceExtensionEvents['on'](_0x48acc3,_0x58d1f8);}}; \ No newline at end of file +var _0x4242=['removeListener','register','length','./voiceExtension.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4242,0x123));var _0x2424=function(_0x53941f,_0x30627f){_0x53941f=_0x53941f-0x0;var _0x317a55=_0x4242[_0x53941f];return _0x317a55;};'use strict';var VoiceExtensionEvents=require(_0x2424('0x0'));var events=[_0x2424('0x1'),_0x2424('0x2'),'update'];function createListener(_0x281d1a,_0x414d4c){return function(_0x34d5ab){_0x414d4c['emit'](_0x281d1a,_0x34d5ab);};}function removeListener(_0x5c188f,_0xebdafa){return function(){VoiceExtensionEvents[_0x2424('0x3')](_0x5c188f,_0xebdafa);};}exports[_0x2424('0x4')]=function(_0x4d0ce0){for(var _0x1b3c5b=0x0,_0x3f7619=events[_0x2424('0x5')];_0x1b3c5b<_0x3f7619;_0x1b3c5b++){var _0x43683f=events[_0x1b3c5b];var _0x4f6d79=createListener('voiceExtension:'+_0x43683f,_0x4d0ce0);VoiceExtensionEvents['on'](_0x43683f,_0x4f6d79);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3445380..8b341b4 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 _0x9f2a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','Router'];(function(_0x52ef14,_0x458945){var _0x4a64da=function(_0x55234e){while(--_0x55234e){_0x52ef14['push'](_0x52ef14['shift']());}};_0x4a64da(++_0x458945);}(_0x9f2a,0x154));var _0xa9f2=function(_0x2aa088,_0x3a339d){_0x2aa088=_0x2aa088-0x0;var _0x1e58b3=_0x9f2a[_0x2aa088];return _0x1e58b3;};'use strict';var multer=require(_0xa9f2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9f2('0x1')]();var auth=require(_0xa9f2('0x2'));var interaction=require(_0xa9f2('0x3'));var config=require(_0xa9f2('0x4'));var controller=require(_0xa9f2('0x5'));router[_0xa9f2('0x6')]('/',auth[_0xa9f2('0x7')](),controller[_0xa9f2('0x8')]);router[_0xa9f2('0x6')](_0xa9f2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa9f2('0x6')](_0xa9f2('0xa'),auth[_0xa9f2('0x7')](),controller[_0xa9f2('0xb')]);router[_0xa9f2('0xc')]('/',auth[_0xa9f2('0x7')](),controller[_0xa9f2('0xd')]);router[_0xa9f2('0xe')](_0xa9f2('0x9'),auth[_0xa9f2('0x7')](),controller[_0xa9f2('0xf')]);router[_0xa9f2('0x10')](_0xa9f2('0x9'),auth['isAuthenticated'](),controller[_0xa9f2('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc2e3=['../../components/interaction/service','get','index','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc2e3,0xb6));var _0x3c2e=function(_0x395f24,_0x314737){_0x395f24=_0x395f24-0x0;var _0x592cd9=_0xc2e3[_0x395f24];return _0x592cd9;};'use strict';var multer=require(_0x3c2e('0x0'));var util=require(_0x3c2e('0x1'));var path=require(_0x3c2e('0x2'));var timeout=require(_0x3c2e('0x3'));var express=require(_0x3c2e('0x4'));var router=express[_0x3c2e('0x5')]();var auth=require(_0x3c2e('0x6'));var interaction=require(_0x3c2e('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x3c2e('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c2e('0x9')]);router[_0x3c2e('0x8')](_0x3c2e('0xa'),auth['isAuthenticated'](),controller[_0x3c2e('0xb')]);router[_0x3c2e('0x8')](_0x3c2e('0xc'),auth[_0x3c2e('0xd')](),controller[_0x3c2e('0xe')]);router[_0x3c2e('0xf')]('/',auth[_0x3c2e('0xd')](),controller[_0x3c2e('0x10')]);router[_0x3c2e('0x11')](_0x3c2e('0xa'),auth[_0x3c2e('0xd')](),controller[_0x3c2e('0x12')]);router[_0x3c2e('0x13')](_0x3c2e('0xa'),auth[_0x3c2e('0xd')](),controller[_0x3c2e('0x14')]);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 0755a1d..5ea4725 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 _0x80ed=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x59e096,_0x118c10){var _0x12982b=function(_0x47e074){while(--_0x47e074){_0x59e096['push'](_0x59e096['shift']());}};_0x12982b(++_0x118c10);}(_0x80ed,0x11c));var _0xd80e=function(_0x4f8a38,_0x29840f){_0x4f8a38=_0x4f8a38-0x0;var _0x4292dd=_0x80ed[_0x4f8a38];return _0x4292dd;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd80e('0x3')},'password':{'type':Sequelize[_0xd80e('0x1')]},'fullname':{'type':Sequelize[_0xd80e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x26e6ff){this[_0xd80e('0x4')](_0xd80e('0x5'),typeof _0x26e6ff==='string'&&_0x26e6ff[_0xd80e('0x6')]()?_0x26e6ff[_0xd80e('0x6')]():null);}},'pager':{'type':Sequelize[_0xd80e('0x1')]},'tz':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x7')},'attach':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xd80e('0x1')]},'callback':{'type':Sequelize[_0xd80e('0x1')]},'review':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd80e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'stamp':{'type':_0xd80e('0xa')},'emailsubject':{'type':Sequelize[_0xd80e('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd80e('0xc')],'get':function(){return this[_0xd80e('0xd')]('fullname')+_0xd80e('0xe')+this[_0xd80e('0xd')](_0xd80e('0xf'));}}}; \ No newline at end of file +var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x31b425,_0x35bda9){var _0xa8588e=function(_0x5c17bc){while(--_0x5c17bc){_0x31b425['push'](_0x31b425['shift']());}};_0xa8588e(++_0x35bda9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 79f481d..fe4aa38 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 _0xd232=['where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','keys','intersection','length','find','create','body','user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','nolimit','options','VoiceMailMessage','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','name','VoiceMail','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','hasOwnProperty','order','sort'];(function(_0x1fb6bc,_0x420b73){var _0x1389c5=function(_0x330250){while(--_0x330250){_0x1fb6bc['push'](_0x1fb6bc['shift']());}};_0x1389c5(++_0x420b73);}(_0xd232,0x74));var _0x2d23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd232[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2d23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d23('0x1'));var zipdir=require(_0x2d23('0x2'));var jsonpatch=require(_0x2d23('0x3'));var rp=require(_0x2d23('0x4'));var moment=require(_0x2d23('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d23('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2d23('0x7'));var ejs=require(_0x2d23('0x8'));var fs=require('fs');var _=require(_0x2d23('0x9'));var squel=require('squel');var crypto=require(_0x2d23('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2d23('0xb'));var toCsv=require(_0x2d23('0x7'));var querystring=require(_0x2d23('0xc'));var Papa=require(_0x2d23('0xd'));var Redis=require(_0x2d23('0xe'));var authService=require(_0x2d23('0xf'));var qs=require(_0x2d23('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d23('0x11'));var logger=require(_0x2d23('0x12'))(_0x2d23('0x13'));var utils=require(_0x2d23('0x14'));var config=require(_0x2d23('0x15'));var licenseUtil=require(_0x2d23('0x16'));var db=require(_0x2d23('0x17'))['db'];function respondWithStatusCode(_0xe816ba,_0x33da73){_0x33da73=_0x33da73||0xcc;return function(_0x344755){if(_0x344755){return _0xe816ba[_0x2d23('0x18')](_0x33da73);}return _0xe816ba[_0x2d23('0x19')](_0x33da73)['end']();};}function respondWithResult(_0x428a01,_0x28554a){_0x28554a=_0x28554a||0xc8;return function(_0x3cd5b2){if(_0x3cd5b2){return _0x428a01[_0x2d23('0x19')](_0x28554a)[_0x2d23('0x1a')](_0x3cd5b2);}};}function respondWithFilteredResult(_0x5557ed,_0x47233f){return function(_0x54051e){if(_0x54051e){var _0x1b8ac4=_0x54051e['count'],_0x4d0298=_0x47233f['offset'],_0x3ff03e=_0x47233f[_0x2d23('0x1b')]+_0x47233f[_0x2d23('0x1c')],_0x30b578;if(_0x3ff03e>=_0x1b8ac4){_0x3ff03e=_0x1b8ac4;_0x30b578=0xc8;}else{_0x30b578=0xce;}_0x5557ed[_0x2d23('0x19')](_0x30b578);return _0x5557ed[_0x2d23('0x1d')](_0x2d23('0x1e'),_0x4d0298+'-'+_0x3ff03e+'/'+_0x1b8ac4)[_0x2d23('0x1a')](_0x54051e);}return null;};}function patchUpdates(_0x54e0a2){return function(_0x5d73be){try{jsonpatch[_0x2d23('0x1f')](_0x5d73be,_0x54e0a2,!![]);}catch(_0x1c2b95){return BPromise[_0x2d23('0x20')](_0x1c2b95);}return _0x5d73be['save']();};}function saveUpdates(_0x512e4d,_0x44025e){return function(_0x3132eb){if(_0x3132eb){return _0x3132eb[_0x2d23('0x21')](_0x512e4d)[_0x2d23('0x22')](function(_0x57f8c7){return _0x57f8c7;});}return null;};}function removeEntity(_0x33c4fb,_0x42eb0d){return function(_0x4bc017){if(_0x4bc017){return _0x4bc017['destroy']()[_0x2d23('0x22')](function(){var _0x4bfa6c=_0x4bc017[_0x2d23('0x23')]({'plain':!![]});var _0x3b09e4='Voicemails';return db[_0x2d23('0x24')][_0x2d23('0x25')]({'where':{'type':_0x3b09e4,'resourceId':_0x4bfa6c['id']}})[_0x2d23('0x22')](function(){return _0x4bc017;});})['then'](function(){_0x33c4fb[_0x2d23('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x387504,_0x4e6c3b){return function(_0x2d262b){if(!_0x2d262b){_0x387504[_0x2d23('0x18')](0x194);}return _0x2d262b;};}function handleError(_0x5cd513,_0x4f223d){_0x4f223d=_0x4f223d||0x1f4;return function(_0x40bee3){logger[_0x2d23('0x26')](_0x40bee3['stack']);if(_0x40bee3[_0x2d23('0x27')]){delete _0x40bee3['name'];}_0x5cd513[_0x2d23('0x19')](_0x4f223d)['send'](_0x40bee3);};}exports['index']=function(_0x39c09c,_0x8ad129){var _0x38b76d={},_0x2b7c39={},_0x3b7479={'count':0x0,'rows':[]};var _0x196cde=_['map'](db[_0x2d23('0x28')][_0x2d23('0x29')],function(_0xfd6e32){return{'name':_0xfd6e32[_0x2d23('0x2a')],'type':_0xfd6e32[_0x2d23('0x2b')][_0x2d23('0x2c')]};});_0x2b7c39['model']=_[_0x2d23('0x2d')](_0x196cde,_0x2d23('0x27'));_0x2b7c39[_0x2d23('0x2e')]=_['keys'](_0x39c09c[_0x2d23('0x2e')]);_0x2b7c39[_0x2d23('0x2f')]=_['intersection'](_0x2b7c39[_0x2d23('0x30')],_0x2b7c39[_0x2d23('0x2e')]);_0x38b76d[_0x2d23('0x31')]=_['intersection'](_0x2b7c39[_0x2d23('0x30')],qs[_0x2d23('0x32')](_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x32')]));_0x38b76d['attributes']=_0x38b76d[_0x2d23('0x31')]['length']?_0x38b76d[_0x2d23('0x31')]:_0x2b7c39['model'];if(!_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x33')]('nolimit')){_0x38b76d[_0x2d23('0x1c')]=qs[_0x2d23('0x1c')](_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x1c')]);_0x38b76d['offset']=qs[_0x2d23('0x1b')](_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x1b')]);}_0x38b76d[_0x2d23('0x34')]=qs['sort'](_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x35')]);_0x38b76d[_0x2d23('0x36')]=qs[_0x2d23('0x2f')](_[_0x2d23('0x37')](_0x39c09c[_0x2d23('0x2e')],_0x2b7c39['filters']),_0x196cde);if(_0x39c09c['query'][_0x2d23('0x38')]){_0x38b76d['where']=_[_0x2d23('0x39')](_0x38b76d[_0x2d23('0x36')],{'$or':_[_0x2d23('0x2d')](_0x196cde,function(_0xdc6f03){if(_0xdc6f03[_0x2d23('0x2b')]!==_0x2d23('0x3a')){var _0xa1be00={};_0xa1be00[_0xdc6f03[_0x2d23('0x27')]]={'$like':'%'+_0x39c09c['query']['filter']+'%'};return _0xa1be00;}})});}_0x38b76d=_[_0x2d23('0x39')]({},_0x38b76d,_0x39c09c['options']);var _0x1f503c={'where':_0x38b76d[_0x2d23('0x36')]};return db[_0x2d23('0x28')][_0x2d23('0x3b')](_0x1f503c)['then'](function(_0x3366e6){_0x3b7479[_0x2d23('0x3b')]=_0x3366e6;if(_0x39c09c[_0x2d23('0x2e')][_0x2d23('0x3c')]){_0x38b76d[_0x2d23('0x3d')]=[{'all':!![]}];}return db[_0x2d23('0x28')][_0x2d23('0x3e')](_0x38b76d);})[_0x2d23('0x22')](function(_0x107447){_0x3b7479[_0x2d23('0x3f')]=_0x107447;return _0x3b7479;})[_0x2d23('0x22')](respondWithFilteredResult(_0x8ad129,_0x38b76d))[_0x2d23('0x40')](handleError(_0x8ad129,null));};exports['show']=function(_0x2f89b9,_0x5a40c4){var _0x5b8b52={'raw':!![],'where':{'id':_0x2f89b9['params']['id']}},_0x17ad01={};_0x17ad01[_0x2d23('0x30')]=_[_0x2d23('0x41')](db[_0x2d23('0x28')]['rawAttributes']);_0x17ad01[_0x2d23('0x2e')]=_['keys'](_0x2f89b9[_0x2d23('0x2e')]);_0x17ad01['filters']=_[_0x2d23('0x42')](_0x17ad01[_0x2d23('0x30')],_0x17ad01[_0x2d23('0x2e')]);_0x5b8b52[_0x2d23('0x31')]=_[_0x2d23('0x42')](_0x17ad01['model'],qs[_0x2d23('0x32')](_0x2f89b9[_0x2d23('0x2e')][_0x2d23('0x32')]));_0x5b8b52[_0x2d23('0x31')]=_0x5b8b52['attributes'][_0x2d23('0x43')]?_0x5b8b52['attributes']:_0x17ad01[_0x2d23('0x30')];if(_0x2f89b9[_0x2d23('0x2e')]['includeAll']){_0x5b8b52[_0x2d23('0x3d')]=[{'all':!![]}];}_0x5b8b52=_[_0x2d23('0x39')]({},_0x5b8b52,_0x2f89b9['options']);return db[_0x2d23('0x28')][_0x2d23('0x44')](_0x5b8b52)['then'](handleEntityNotFound(_0x5a40c4,null))[_0x2d23('0x22')](respondWithResult(_0x5a40c4,null))['catch'](handleError(_0x5a40c4,null));};exports[_0x2d23('0x45')]=function(_0x1ecc94,_0x322d2c){return db[_0x2d23('0x28')][_0x2d23('0x45')](_0x1ecc94[_0x2d23('0x46')],{})[_0x2d23('0x22')](function(_0xedfaef){var _0x1878d2=_0x1ecc94[_0x2d23('0x47')][_0x2d23('0x23')]({'plain':!![]});if(!_0x1878d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1878d2[_0x2d23('0x48')]===_0x2d23('0x47')){var _0x4130af=_0xedfaef['get']({'plain':!![]});var _0x12d068=_0x2d23('0x49');return db[_0x2d23('0x4a')]['find']({'where':{'name':_0x12d068,'userProfileId':_0x1878d2[_0x2d23('0x4b')]},'raw':!![]})[_0x2d23('0x22')](function(_0x4b5f9f){if(_0x4b5f9f&&_0x4b5f9f[_0x2d23('0x4c')]===0x0){return db[_0x2d23('0x24')][_0x2d23('0x45')]({'name':_0x4130af['name'],'resourceId':_0x4130af['id'],'type':_0x4b5f9f[_0x2d23('0x27')],'sectionId':_0x4b5f9f['id']},{})[_0x2d23('0x22')](function(){return _0xedfaef;});}else{return _0xedfaef;}})[_0x2d23('0x40')](function(_0x1073c4){logger[_0x2d23('0x26')](_0x2d23('0x4d'),_0x1073c4);throw _0x1073c4;});}return _0xedfaef;})['then'](respondWithResult(_0x322d2c,0xc9))[_0x2d23('0x40')](handleError(_0x322d2c,null));};exports[_0x2d23('0x21')]=function(_0x49d3aa,_0x5549b0){if(_0x49d3aa[_0x2d23('0x46')]['id']){delete _0x49d3aa['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x49d3aa[_0x2d23('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5549b0,null))['then'](saveUpdates(_0x49d3aa['body'],null))[_0x2d23('0x22')](respondWithResult(_0x5549b0,null))[_0x2d23('0x40')](handleError(_0x5549b0,null));};exports[_0x2d23('0x25')]=function(_0x1c40d2,_0x29180){return db[_0x2d23('0x28')]['find']({'where':{'id':_0x1c40d2[_0x2d23('0x4e')]['id']}})[_0x2d23('0x22')](handleEntityNotFound(_0x29180,null))[_0x2d23('0x22')](removeEntity(_0x29180,null))[_0x2d23('0x40')](handleError(_0x29180,null));};exports[_0x2d23('0x4f')]=function(_0x18508a,_0xdf2dcc,_0x4b0972){return db[_0x2d23('0x28')][_0x2d23('0x50')]({'where':{'id':_0x18508a[_0x2d23('0x4e')]['id']}})[_0x2d23('0x22')](handleEntityNotFound(_0xdf2dcc,null))['then'](function(_0x3c46bd){var _0x36d8ec;var _0x5bb76c={},_0x16b3cb={};_0x16b3cb[_0x2d23('0x30')]=_['keys'](db['VoiceMailMessage'][_0x2d23('0x29')]);_0x16b3cb['query']=_[_0x2d23('0x41')](_0x18508a[_0x2d23('0x2e')]);_0x16b3cb[_0x2d23('0x2f')]=_[_0x2d23('0x42')](_0x16b3cb['model'],_0x16b3cb[_0x2d23('0x2e')]);_0x5bb76c[_0x2d23('0x31')]=_[_0x2d23('0x42')](_0x16b3cb[_0x2d23('0x30')],qs[_0x2d23('0x32')](_0x18508a[_0x2d23('0x2e')]['fields']));_0x5bb76c[_0x2d23('0x31')]=_0x5bb76c['attributes'][_0x2d23('0x43')]?_0x5bb76c['attributes']:_0x16b3cb[_0x2d23('0x30')];if(!_0x18508a[_0x2d23('0x2e')]['hasOwnProperty'](_0x2d23('0x51'))){_0x5bb76c[_0x2d23('0x1c')]=qs[_0x2d23('0x1c')](_0x18508a[_0x2d23('0x2e')][_0x2d23('0x1c')]);_0x5bb76c[_0x2d23('0x1b')]=qs[_0x2d23('0x1b')](_0x18508a['query'][_0x2d23('0x1b')]);}_0x5bb76c[_0x2d23('0x34')]=qs['sort'](_0x18508a['query'][_0x2d23('0x35')]);_0x5bb76c[_0x2d23('0x36')]=qs[_0x2d23('0x2f')](_['pick'](_0x18508a[_0x2d23('0x2e')],_0x16b3cb[_0x2d23('0x2f')]));if(_0x18508a[_0x2d23('0x2e')][_0x2d23('0x38')]){_0x5bb76c['where']=_[_0x2d23('0x39')](_0x5bb76c[_0x2d23('0x36')],{'$or':_['map'](_0x5bb76c[_0x2d23('0x31')],function(_0x396f1c){var _0x16422d={};_0x16422d[_0x396f1c]={'$like':'%'+_0x18508a[_0x2d23('0x2e')][_0x2d23('0x38')]+'%'};return _0x16422d;})});}_0x5bb76c[_0x2d23('0x36')]=_['merge'](_0x5bb76c[_0x2d23('0x36')],{'mailboxuser':_0x3c46bd['mailbox']});_0x5bb76c=_['merge']({},_0x5bb76c,_0x18508a[_0x2d23('0x52')]);return db[_0x2d23('0x53')][_0x2d23('0x54')](_0x5bb76c)[_0x2d23('0x22')](respondWithFilteredResult(_0xdf2dcc,_0x5bb76c));})[_0x2d23('0x40')](handleError(_0xdf2dcc,null));}; \ No newline at end of file +var _0xfb11=['type','merge','options','count','includeAll','findAll','catch','show','params','keys','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','findOne','VoiceMailMessage','hasOwnProperty','order','mailbox','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xfb11[_0x2b7764];return _0x848dcb;};'use strict';var pdf=require(_0x1fb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1fb1('0x1'));var zipdir=require(_0x1fb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb1('0x3'));var moment=require('moment');var BPromise=require(_0x1fb1('0x4'));var Mustache=require('mustache');var util=require(_0x1fb1('0x5'));var path=require(_0x1fb1('0x6'));var sox=require('sox');var csv=require(_0x1fb1('0x7'));var ejs=require(_0x1fb1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0x7'));var querystring=require(_0x1fb1('0xd'));var Papa=require(_0x1fb1('0xe'));var Redis=require(_0x1fb1('0xf'));var authService=require(_0x1fb1('0x10'));var qs=require(_0x1fb1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x12'));var logger=require('../../config/logger')(_0x1fb1('0x13'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x14'));var licenseUtil=require(_0x1fb1('0x15'));var db=require(_0x1fb1('0x16'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x17')](_0x333229)[_0x1fb1('0x18')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x17')](_0x44f24c)[_0x1fb1('0x19')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=_0x4cbe42['count'],_0x34045e=_0x358b58[_0x1fb1('0x1a')],_0x113988=_0x358b58[_0x1fb1('0x1a')]+_0x358b58[_0x1fb1('0x1b')],_0x3924ab;if(_0x113988>=_0x5c8d23){_0x113988=_0x5c8d23;_0x3924ab=0xc8;}else{_0x3924ab=0xce;}_0x316fe5[_0x1fb1('0x17')](_0x3924ab);return _0x316fe5[_0x1fb1('0x1c')](_0x1fb1('0x1d'),_0x34045e+'-'+_0x113988+'/'+_0x5c8d23)[_0x1fb1('0x19')](_0x4cbe42);}return null;};}function patchUpdates(_0x373e3c){return function(_0x4041ea){try{jsonpatch['apply'](_0x4041ea,_0x373e3c,!![]);}catch(_0xa6d7b8){return BPromise['reject'](_0xa6d7b8);}return _0x4041ea['save']();};}function saveUpdates(_0xdf9c1b,_0x313d9a){return function(_0x1eaf9e){if(_0x1eaf9e){return _0x1eaf9e['update'](_0xdf9c1b)[_0x1fb1('0x1e')](function(_0x4ed51a){return _0x4ed51a;});}return null;};}function removeEntity(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x1f')]()[_0x1fb1('0x1e')](function(){var _0x10924f=_0x31178c[_0x1fb1('0x20')]({'plain':!![]});var _0x53b8af=_0x1fb1('0x21');return db[_0x1fb1('0x22')][_0x1fb1('0x1f')]({'where':{'type':_0x53b8af,'resourceId':_0x10924f['id']}})[_0x1fb1('0x1e')](function(){return _0x31178c;});})[_0x1fb1('0x1e')](function(){_0x5c76f5[_0x1fb1('0x17')](0xcc)[_0x1fb1('0x18')]();});}};}function handleEntityNotFound(_0x2de1d4,_0x530a5e){return function(_0x1b25b3){if(!_0x1b25b3){_0x2de1d4[_0x1fb1('0x23')](0x194);}return _0x1b25b3;};}function handleError(_0x46ff60,_0xc5188b){_0xc5188b=_0xc5188b||0x1f4;return function(_0x1898e7){logger[_0x1fb1('0x24')](_0x1898e7[_0x1fb1('0x25')]);if(_0x1898e7[_0x1fb1('0x26')]){delete _0x1898e7[_0x1fb1('0x26')];}_0x46ff60[_0x1fb1('0x17')](_0xc5188b)[_0x1fb1('0x27')](_0x1898e7);};}exports[_0x1fb1('0x28')]=function(_0x39fc43,_0xe8ec0a){var _0x2f6c88={},_0x520ee2={},_0x106134={'count':0x0,'rows':[]};var _0x316f7c=_[_0x1fb1('0x29')](db[_0x1fb1('0x2a')]['rawAttributes'],function(_0x245f84){return{'name':_0x245f84[_0x1fb1('0x2b')],'type':_0x245f84['type'][_0x1fb1('0x2c')]};});_0x520ee2['model']=_['map'](_0x316f7c,_0x1fb1('0x26'));_0x520ee2[_0x1fb1('0x2d')]=_['keys'](_0x39fc43[_0x1fb1('0x2d')]);_0x520ee2[_0x1fb1('0x2e')]=_[_0x1fb1('0x2f')](_0x520ee2[_0x1fb1('0x30')],_0x520ee2[_0x1fb1('0x2d')]);_0x2f6c88['attributes']=_[_0x1fb1('0x2f')](_0x520ee2[_0x1fb1('0x30')],qs[_0x1fb1('0x31')](_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x31')]));_0x2f6c88[_0x1fb1('0x32')]=_0x2f6c88[_0x1fb1('0x32')][_0x1fb1('0x33')]?_0x2f6c88[_0x1fb1('0x32')]:_0x520ee2['model'];if(!_0x39fc43[_0x1fb1('0x2d')]['hasOwnProperty'](_0x1fb1('0x34'))){_0x2f6c88['limit']=qs[_0x1fb1('0x1b')](_0x39fc43['query']['limit']);_0x2f6c88[_0x1fb1('0x1a')]=qs[_0x1fb1('0x1a')](_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x1a')]);}_0x2f6c88['order']=qs[_0x1fb1('0x35')](_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x35')]);_0x2f6c88['where']=qs[_0x1fb1('0x2e')](_[_0x1fb1('0x36')](_0x39fc43[_0x1fb1('0x2d')],_0x520ee2[_0x1fb1('0x2e')]),_0x316f7c);if(_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x37')]){_0x2f6c88[_0x1fb1('0x38')]=_['merge'](_0x2f6c88[_0x1fb1('0x38')],{'$or':_[_0x1fb1('0x29')](_0x316f7c,function(_0x55d7ea){if(_0x55d7ea[_0x1fb1('0x39')]!=='VIRTUAL'){var _0x369146={};_0x369146[_0x55d7ea[_0x1fb1('0x26')]]={'$like':'%'+_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x37')]+'%'};return _0x369146;}})});}_0x2f6c88=_[_0x1fb1('0x3a')]({},_0x2f6c88,_0x39fc43[_0x1fb1('0x3b')]);var _0x927301={'where':_0x2f6c88[_0x1fb1('0x38')]};return db[_0x1fb1('0x2a')][_0x1fb1('0x3c')](_0x927301)[_0x1fb1('0x1e')](function(_0x291f7f){_0x106134[_0x1fb1('0x3c')]=_0x291f7f;if(_0x39fc43[_0x1fb1('0x2d')][_0x1fb1('0x3d')]){_0x2f6c88['include']=[{'all':!![]}];}return db[_0x1fb1('0x2a')][_0x1fb1('0x3e')](_0x2f6c88);})[_0x1fb1('0x1e')](function(_0x19211f){_0x106134['rows']=_0x19211f;return _0x106134;})['then'](respondWithFilteredResult(_0xe8ec0a,_0x2f6c88))[_0x1fb1('0x3f')](handleError(_0xe8ec0a,null));};exports[_0x1fb1('0x40')]=function(_0x307faf,_0x3edc8a){var _0x66651e={'raw':!![],'where':{'id':_0x307faf[_0x1fb1('0x41')]['id']}},_0x116fe9={};_0x116fe9[_0x1fb1('0x30')]=_[_0x1fb1('0x42')](db[_0x1fb1('0x2a')]['rawAttributes']);_0x116fe9[_0x1fb1('0x2d')]=_['keys'](_0x307faf['query']);_0x116fe9[_0x1fb1('0x2e')]=_[_0x1fb1('0x2f')](_0x116fe9[_0x1fb1('0x30')],_0x116fe9[_0x1fb1('0x2d')]);_0x66651e['attributes']=_['intersection'](_0x116fe9[_0x1fb1('0x30')],qs[_0x1fb1('0x31')](_0x307faf[_0x1fb1('0x2d')][_0x1fb1('0x31')]));_0x66651e[_0x1fb1('0x32')]=_0x66651e[_0x1fb1('0x32')][_0x1fb1('0x33')]?_0x66651e[_0x1fb1('0x32')]:_0x116fe9[_0x1fb1('0x30')];if(_0x307faf['query']['includeAll']){_0x66651e[_0x1fb1('0x43')]=[{'all':!![]}];}_0x66651e=_['merge']({},_0x66651e,_0x307faf[_0x1fb1('0x3b')]);return db[_0x1fb1('0x2a')][_0x1fb1('0x44')](_0x66651e)[_0x1fb1('0x1e')](handleEntityNotFound(_0x3edc8a,null))[_0x1fb1('0x1e')](respondWithResult(_0x3edc8a,null))[_0x1fb1('0x3f')](handleError(_0x3edc8a,null));};exports['create']=function(_0x360a4e,_0x14db9e){return db[_0x1fb1('0x2a')]['create'](_0x360a4e[_0x1fb1('0x45')],{})['then'](function(_0x6e105b){var _0xba4fa7=_0x360a4e[_0x1fb1('0x46')]['get']({'plain':!![]});if(!_0xba4fa7)throw new Error(_0x1fb1('0x47'));if(_0xba4fa7[_0x1fb1('0x48')]==='user'){var _0xe492ab=_0x6e105b[_0x1fb1('0x20')]({'plain':!![]});var _0x31a4ef='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x31a4ef,'userProfileId':_0xba4fa7[_0x1fb1('0x49')]},'raw':!![]})[_0x1fb1('0x1e')](function(_0x1e2754){if(_0x1e2754&&_0x1e2754[_0x1fb1('0x4a')]===0x0){return db[_0x1fb1('0x22')][_0x1fb1('0x4b')]({'name':_0xe492ab['name'],'resourceId':_0xe492ab['id'],'type':_0x1e2754['name'],'sectionId':_0x1e2754['id']},{})[_0x1fb1('0x1e')](function(){return _0x6e105b;});}else{return _0x6e105b;}})[_0x1fb1('0x3f')](function(_0x2d03d2){logger[_0x1fb1('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d03d2);throw _0x2d03d2;});}return _0x6e105b;})['then'](respondWithResult(_0x14db9e,0xc9))[_0x1fb1('0x3f')](handleError(_0x14db9e,null));};exports['update']=function(_0x41fefb,_0x57baa6){if(_0x41fefb[_0x1fb1('0x45')]['id']){delete _0x41fefb['body']['id'];}return db[_0x1fb1('0x2a')][_0x1fb1('0x44')]({'where':{'id':_0x41fefb[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x1e')](handleEntityNotFound(_0x57baa6,null))[_0x1fb1('0x1e')](saveUpdates(_0x41fefb['body'],null))['then'](respondWithResult(_0x57baa6,null))[_0x1fb1('0x3f')](handleError(_0x57baa6,null));};exports[_0x1fb1('0x1f')]=function(_0x54c76e,_0x5c9695){return db[_0x1fb1('0x2a')][_0x1fb1('0x44')]({'where':{'id':_0x54c76e[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x1e')](handleEntityNotFound(_0x5c9695,null))[_0x1fb1('0x1e')](removeEntity(_0x5c9695,null))[_0x1fb1('0x3f')](handleError(_0x5c9695,null));};exports['getMessages']=function(_0x8c0b96,_0x2adb60,_0x52b057){return db[_0x1fb1('0x2a')][_0x1fb1('0x4c')]({'where':{'id':_0x8c0b96[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x1e')](handleEntityNotFound(_0x2adb60,null))['then'](function(_0x1fd9e1){var _0x2557a9;var _0x20f5f9={},_0x4e67f7={};_0x4e67f7[_0x1fb1('0x30')]=_[_0x1fb1('0x42')](db[_0x1fb1('0x4d')]['rawAttributes']);_0x4e67f7[_0x1fb1('0x2d')]=_[_0x1fb1('0x42')](_0x8c0b96[_0x1fb1('0x2d')]);_0x4e67f7[_0x1fb1('0x2e')]=_[_0x1fb1('0x2f')](_0x4e67f7[_0x1fb1('0x30')],_0x4e67f7['query']);_0x20f5f9['attributes']=_[_0x1fb1('0x2f')](_0x4e67f7[_0x1fb1('0x30')],qs[_0x1fb1('0x31')](_0x8c0b96[_0x1fb1('0x2d')][_0x1fb1('0x31')]));_0x20f5f9[_0x1fb1('0x32')]=_0x20f5f9[_0x1fb1('0x32')]['length']?_0x20f5f9[_0x1fb1('0x32')]:_0x4e67f7[_0x1fb1('0x30')];if(!_0x8c0b96[_0x1fb1('0x2d')][_0x1fb1('0x4e')](_0x1fb1('0x34'))){_0x20f5f9[_0x1fb1('0x1b')]=qs['limit'](_0x8c0b96[_0x1fb1('0x2d')][_0x1fb1('0x1b')]);_0x20f5f9[_0x1fb1('0x1a')]=qs[_0x1fb1('0x1a')](_0x8c0b96[_0x1fb1('0x2d')]['offset']);}_0x20f5f9[_0x1fb1('0x4f')]=qs[_0x1fb1('0x35')](_0x8c0b96['query'][_0x1fb1('0x35')]);_0x20f5f9['where']=qs[_0x1fb1('0x2e')](_[_0x1fb1('0x36')](_0x8c0b96[_0x1fb1('0x2d')],_0x4e67f7[_0x1fb1('0x2e')]));if(_0x8c0b96['query'][_0x1fb1('0x37')]){_0x20f5f9[_0x1fb1('0x38')]=_[_0x1fb1('0x3a')](_0x20f5f9[_0x1fb1('0x38')],{'$or':_['map'](_0x20f5f9[_0x1fb1('0x32')],function(_0x4874aa){var _0xe9aa33={};_0xe9aa33[_0x4874aa]={'$like':'%'+_0x8c0b96[_0x1fb1('0x2d')]['filter']+'%'};return _0xe9aa33;})});}_0x20f5f9[_0x1fb1('0x38')]=_[_0x1fb1('0x3a')](_0x20f5f9[_0x1fb1('0x38')],{'mailboxuser':_0x1fd9e1[_0x1fb1('0x50')]});_0x20f5f9=_[_0x1fb1('0x3a')]({},_0x20f5f9,_0x8c0b96[_0x1fb1('0x3b')]);return db[_0x1fb1('0x4d')]['findAndCountAll'](_0x20f5f9)[_0x1fb1('0x1e')](respondWithFilteredResult(_0x2adb60,_0x20f5f9));})[_0x1fb1('0x3f')](handleError(_0x2adb60,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4aeb91b..0621710 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 _0x819d=['../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','moment','path'];(function(_0x33064f,_0x5bf0e7){var _0x3f72d1=function(_0x465fa4){while(--_0x465fa4){_0x33064f['push'](_0x33064f['shift']());}};_0x3f72d1(++_0x5bf0e7);}(_0x819d,0x10f));var _0xd819=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x819d[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0xd819('0x0'));var logger=require(_0xd819('0x1'))('api');var moment=require(_0xd819('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd819('0x3'));var rimraf=require('rimraf');var config=require(_0xd819('0x4'));var attributes=require('./voiceMail.attributes');module[_0xd819('0x5')]=function(_0x5422e0,_0x4ca395){return _0x5422e0[_0xd819('0x6')](_0xd819('0x7'),attributes,{'tableName':_0xd819('0x8'),'paranoid':![],'indexes':[{'name':_0xd819('0x9'),'fields':[_0xd819('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eeb=['context','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox'];(function(_0x7d5fe7,_0x339ab7){var _0x480373=function(_0x39d7a0){while(--_0x39d7a0){_0x7d5fe7['push'](_0x7d5fe7['shift']());}};_0x480373(++_0x339ab7);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0eeb[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('VoiceMail',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xb0ee('0xc'),_0xb0ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b995895..df8fa5e 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 _0xaec0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0xaec0,0x1ca));var _0x0aec=function(_0x3e36ae,_0x59dac8){_0x3e36ae=_0x3e36ae-0x0;var _0x233c8e=_0xaec0[_0x3e36ae];return _0x233c8e;};'use strict';var _=require(_0x0aec('0x0'));var util=require(_0x0aec('0x1'));var moment=require(_0x0aec('0x2'));var BPromise=require(_0x0aec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0aec('0x4'))['db'];var utils=require(_0x0aec('0x5'));var logger=require(_0x0aec('0x6'))(_0x0aec('0x7'));var config=require(_0x0aec('0x8'));var jayson=require(_0x0aec('0x9'));var client=jayson[_0x0aec('0xa')][_0x0aec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x541a51,_0x53de7c,_0x598224){return new BPromise(function(_0x6bb57d,_0x26dd60){return client[_0x0aec('0xc')](_0x541a51,_0x598224)['then'](function(_0x47a95f){logger[_0x0aec('0xd')](_0x0aec('0xe'),_0x53de7c,_0x0aec('0xf'));logger['debug'](_0x0aec('0x10'),_0x53de7c,_0x0aec('0xf'),JSON[_0x0aec('0x11')](_0x47a95f));if(_0x47a95f['error']){if(_0x47a95f[_0x0aec('0x12')][_0x0aec('0x13')]===0x1f4){logger[_0x0aec('0x12')](_0x0aec('0xe'),_0x53de7c,_0x47a95f[_0x0aec('0x12')][_0x0aec('0x14')]);return _0x26dd60(_0x47a95f[_0x0aec('0x12')][_0x0aec('0x14')]);}logger[_0x0aec('0x12')](_0x0aec('0xe'),_0x53de7c,_0x47a95f[_0x0aec('0x12')]['message']);return _0x6bb57d(_0x47a95f[_0x0aec('0x12')][_0x0aec('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x53de7c,_0x0aec('0xf'));_0x6bb57d(_0x47a95f[_0x0aec('0x15')]['message']);}})['catch'](function(_0x3a9df4){logger[_0x0aec('0x12')](_0x0aec('0xe'),_0x53de7c,_0x3a9df4);_0x26dd60(_0x3a9df4);});});} \ No newline at end of file +var _0x68c8=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMail,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x1fdd70,_0x578685){var _0x951a7=function(_0x516386){while(--_0x516386){_0x1fdd70['push'](_0x1fdd70['shift']());}};_0x951a7(++_0x578685);}(_0x68c8,0x1d1));var _0x868c=function(_0x5120b8,_0xe3bf37){_0x5120b8=_0x5120b8-0x0;var _0x34e71f=_0x68c8[_0x5120b8];return _0x34e71f;};'use strict';var _=require(_0x868c('0x0'));var util=require(_0x868c('0x1'));var moment=require(_0x868c('0x2'));var BPromise=require(_0x868c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x868c('0x4'))['db'];var utils=require(_0x868c('0x5'));var logger=require(_0x868c('0x6'))(_0x868c('0x7'));var config=require(_0x868c('0x8'));var jayson=require(_0x868c('0x9'));var client=jayson[_0x868c('0xa')][_0x868c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x783265,_0x578ec5,_0x4dc109){return new BPromise(function(_0x3c3247,_0x3c2528){return client[_0x868c('0xc')](_0x783265,_0x4dc109)[_0x868c('0xd')](function(_0x5cdce2){logger['info']('VoiceMail,\x20%s,\x20%s',_0x578ec5,_0x868c('0xe'));logger[_0x868c('0xf')](_0x868c('0x10'),_0x578ec5,_0x868c('0xe'),JSON['stringify'](_0x5cdce2));if(_0x5cdce2[_0x868c('0x11')]){if(_0x5cdce2['error'][_0x868c('0x12')]===0x1f4){logger[_0x868c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x578ec5,_0x5cdce2['error']['message']);return _0x3c2528(_0x5cdce2[_0x868c('0x11')][_0x868c('0x13')]);}logger[_0x868c('0x11')](_0x868c('0x14'),_0x578ec5,_0x5cdce2[_0x868c('0x11')]['message']);return _0x3c3247(_0x5cdce2['error']['message']);}else{logger[_0x868c('0x15')]('VoiceMail,\x20%s,\x20%s',_0x578ec5,_0x868c('0xe'));_0x3c3247(_0x5cdce2[_0x868c('0x16')][_0x868c('0x13')]);}})[_0x868c('0x17')](function(_0x2ee014){logger[_0x868c('0x11')](_0x868c('0x14'),_0x578ec5,_0x2ee014);_0x3c2528(_0x2ee014);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9f34ba1..50e32ed 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 _0xf51a=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','download','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x215452,_0x303e48){var _0x52844a=function(_0x2e0f4d){while(--_0x2e0f4d){_0x215452['push'](_0x215452['shift']());}};_0x52844a(++_0x303e48);}(_0xf51a,0x1ed));var _0xaf51=function(_0x29ac95,_0x252d71){_0x29ac95=_0x29ac95-0x0;var _0x2fd044=_0xf51a[_0x29ac95];return _0x2fd044;};'use strict';var multer=require(_0xaf51('0x0'));var util=require(_0xaf51('0x1'));var path=require(_0xaf51('0x2'));var timeout=require(_0xaf51('0x3'));var express=require(_0xaf51('0x4'));var router=express[_0xaf51('0x5')]();var auth=require(_0xaf51('0x6'));var interaction=require(_0xaf51('0x7'));var config=require(_0xaf51('0x8'));var controller=require(_0xaf51('0x9'));router[_0xaf51('0xa')]('/',auth['isAuthenticated'](),controller[_0xaf51('0xb')]);router['get'](_0xaf51('0xc'),auth[_0xaf51('0xd')](),controller[_0xaf51('0xe')]);router[_0xaf51('0xa')]('/:id/download',auth[_0xaf51('0xd')](),controller[_0xaf51('0xf')]);router[_0xaf51('0x10')]('/',auth[_0xaf51('0xd')](),controller['create']);router[_0xaf51('0x11')](_0xaf51('0xc'),auth[_0xaf51('0xd')](),controller[_0xaf51('0x12')]);router[_0xaf51('0x13')](_0xaf51('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f61=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id/download','post','create','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9f61,0x1eb));var _0x19f6=function(_0x1e34d6,_0x9c5bb7){_0x1e34d6=_0x1e34d6-0x0;var _0x588e6b=_0x9f61[_0x1e34d6];return _0x588e6b;};'use strict';var multer=require(_0x19f6('0x0'));var util=require(_0x19f6('0x1'));var path=require(_0x19f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x19f6('0x3'));var router=express['Router']();var auth=require(_0x19f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x19f6('0x5'));var controller=require(_0x19f6('0x6'));router[_0x19f6('0x7')]('/',auth[_0x19f6('0x8')](),controller['index']);router[_0x19f6('0x7')]('/:id',auth[_0x19f6('0x8')](),controller['show']);router[_0x19f6('0x7')](_0x19f6('0x9'),auth['isAuthenticated'](),controller['download']);router[_0x19f6('0xa')]('/',auth['isAuthenticated'](),controller[_0x19f6('0xb')]);router[_0x19f6('0xc')](_0x19f6('0xd'),auth[_0x19f6('0x8')](),controller['update']);router['delete']('/:id',auth[_0x19f6('0x8')](),controller[_0x19f6('0xe')]);module[_0x19f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 935fa69..3038c74 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 _0x12d2=['long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x132cc8,_0x1b1c6d){var _0x414b34=function(_0x4e255a){while(--_0x4e255a){_0x132cc8['push'](_0x132cc8['shift']());}};_0x414b34(++_0x1b1c6d);}(_0x12d2,0x1ed));var _0x212d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x12d2[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x212d('0x0'));module[_0x212d('0x1')]={'name':{'type':Sequelize[_0x212d('0x2')],'get':function(_0x20d65a){return this[_0x212d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x212d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x212d('0x6')](_0x212d('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x212d('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x212d('0x8'),'defaultValue':Sequelize[_0x212d('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x6826=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','literal'];(function(_0x1846e9,_0x5e5b55){var _0x32ecd6=function(_0x101b35){while(--_0x101b35){_0x1846e9['push'](_0x1846e9['shift']());}};_0x32ecd6(++_0x5e5b55);}(_0x6826,0xc7));var _0x6682=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x6826[_0xe5b349];return _0x26b0ad;};'use strict';var Sequelize=require(_0x6682('0x0'));module[_0x6682('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x171c11){return this[_0x6682('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6682('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6682('0x5')](_0x6682('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6682('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x6682('0x7')](_0x6682('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f642c9a..910852d 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 _0x62fe=['apply','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','send','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x62fe,0x1bf));var _0xe62f=function(_0x5b627b,_0x215e08){_0x5b627b=_0x5b627b-0x0;var _0x5f2f69=_0x62fe[_0x5b627b];return _0x5f2f69;};'use strict';var pdf=require(_0xe62f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe62f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe62f('0x2'));var rp=require(_0xe62f('0x3'));var moment=require(_0xe62f('0x4'));var BPromise=require(_0xe62f('0x5'));var Mustache=require(_0xe62f('0x6'));var util=require(_0xe62f('0x7'));var path=require('path');var sox=require(_0xe62f('0x8'));var csv=require(_0xe62f('0x9'));var ejs=require(_0xe62f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe62f('0xb'));var toCsv=require(_0xe62f('0x9'));var querystring=require(_0xe62f('0xc'));var Papa=require(_0xe62f('0xd'));var Redis=require('ioredis');var authService=require(_0xe62f('0xe'));var qs=require(_0xe62f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe62f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe62f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe62f('0x12'));var db=require(_0xe62f('0x13'))['db'];function respondWithStatusCode(_0x8d0d60,_0x21be96){_0x21be96=_0x21be96||0xcc;return function(_0x7082f9){if(_0x7082f9){return _0x8d0d60[_0xe62f('0x14')](_0x21be96);}return _0x8d0d60[_0xe62f('0x15')](_0x21be96)['end']();};}function respondWithResult(_0x51c5d6,_0x37b9c8){_0x37b9c8=_0x37b9c8||0xc8;return function(_0x1b2a2a){if(_0x1b2a2a){return _0x51c5d6[_0xe62f('0x15')](_0x37b9c8)[_0xe62f('0x16')](_0x1b2a2a);}};}function respondWithFilteredResult(_0x28682b,_0x3f51c9){return function(_0x47a3aa){if(_0x47a3aa){var _0x43fa4e=_0x47a3aa[_0xe62f('0x17')],_0x2ebc86=_0x3f51c9[_0xe62f('0x18')],_0x732705=_0x3f51c9[_0xe62f('0x18')]+_0x3f51c9[_0xe62f('0x19')],_0x3a9922;if(_0x732705>=_0x43fa4e){_0x732705=_0x43fa4e;_0x3a9922=0xc8;}else{_0x3a9922=0xce;}_0x28682b[_0xe62f('0x15')](_0x3a9922);return _0x28682b['set'](_0xe62f('0x1a'),_0x2ebc86+'-'+_0x732705+'/'+_0x43fa4e)[_0xe62f('0x16')](_0x47a3aa);}return null;};}function patchUpdates(_0x393782){return function(_0x563150){try{jsonpatch[_0xe62f('0x1b')](_0x563150,_0x393782,!![]);}catch(_0x1b6bff){return BPromise[_0xe62f('0x1c')](_0x1b6bff);}return _0x563150[_0xe62f('0x1d')]();};}function saveUpdates(_0x481baa,_0x57930c){return function(_0x14b9e5){if(_0x14b9e5){return _0x14b9e5[_0xe62f('0x1e')](_0x481baa)[_0xe62f('0x1f')](function(_0x48ca65){return _0x48ca65;});}return null;};}function removeEntity(_0x53c379,_0x72ff85){return function(_0x5248f5){if(_0x5248f5){return _0x5248f5['destroy']()[_0xe62f('0x1f')](function(){_0x53c379[_0xe62f('0x15')](0xcc)[_0xe62f('0x20')]();});}};}function handleEntityNotFound(_0x13208f,_0x551255){return function(_0x569da5){if(!_0x569da5){_0x13208f[_0xe62f('0x14')](0x194);}return _0x569da5;};}function handleError(_0x282760,_0x1b08d8){_0x1b08d8=_0x1b08d8||0x1f4;return function(_0x4a51e5){logger[_0xe62f('0x21')](_0x4a51e5[_0xe62f('0x22')]);if(_0x4a51e5[_0xe62f('0x23')]){delete _0x4a51e5[_0xe62f('0x23')];}_0x282760[_0xe62f('0x15')](_0x1b08d8)['send'](_0x4a51e5);};}exports[_0xe62f('0x24')]=function(_0x24f85c,_0x1440a5){var _0x1c5c2d={},_0x3bbcaa={},_0x371691={'count':0x0,'rows':[]};var _0x247106=_[_0xe62f('0x25')](db['VoiceMailMessage'][_0xe62f('0x26')],function(_0x29fb3f){return{'name':_0x29fb3f['fieldName'],'type':_0x29fb3f[_0xe62f('0x27')][_0xe62f('0x28')]};});_0x3bbcaa['model']=_[_0xe62f('0x29')](_[_0xe62f('0x25')](_0x247106,_0xe62f('0x23')),[_0xe62f('0x23')]);_0x3bbcaa['query']=_[_0xe62f('0x2a')](_0x24f85c[_0xe62f('0x2b')]);_0x3bbcaa[_0xe62f('0x2c')]=_[_0xe62f('0x2d')](_0x3bbcaa[_0xe62f('0x2e')],_0x3bbcaa['query']);_0x1c5c2d[_0xe62f('0x2f')]=_[_0xe62f('0x2d')](_0x3bbcaa[_0xe62f('0x2e')],qs[_0xe62f('0x30')](_0x24f85c['query'][_0xe62f('0x30')]));_0x1c5c2d[_0xe62f('0x2f')]=_0x1c5c2d['attributes'][_0xe62f('0x31')]?_0x1c5c2d[_0xe62f('0x2f')]:_0x3bbcaa[_0xe62f('0x2e')];if(!_0x24f85c['query'][_0xe62f('0x32')](_0xe62f('0x33'))){_0x1c5c2d['limit']=qs[_0xe62f('0x19')](_0x24f85c['query']['limit']);_0x1c5c2d[_0xe62f('0x18')]=qs[_0xe62f('0x18')](_0x24f85c[_0xe62f('0x2b')]['offset']);}_0x1c5c2d[_0xe62f('0x34')]=qs['sort'](_0x24f85c[_0xe62f('0x2b')]['sort']);_0x1c5c2d['where']=qs[_0xe62f('0x2c')](_[_0xe62f('0x35')](_0x24f85c[_0xe62f('0x2b')],_0x3bbcaa[_0xe62f('0x2c')]),_0x247106);if(_0x24f85c['query'][_0xe62f('0x36')]){_0x1c5c2d[_0xe62f('0x37')]=_[_0xe62f('0x38')](_0x1c5c2d[_0xe62f('0x37')],{'$or':_[_0xe62f('0x25')](_0x247106,function(_0x3367e5){if(_0x3367e5[_0xe62f('0x27')]!==_0xe62f('0x39')){var _0x1b40ea={};_0x1b40ea[_0x3367e5[_0xe62f('0x23')]]={'$like':'%'+_0x24f85c[_0xe62f('0x2b')][_0xe62f('0x36')]+'%'};return _0x1b40ea;}})});}_0x1c5c2d=_[_0xe62f('0x38')]({},_0x1c5c2d,_0x24f85c[_0xe62f('0x3a')]);var _0xa00a4d={'where':_0x1c5c2d[_0xe62f('0x37')]};return db[_0xe62f('0x3b')][_0xe62f('0x17')](_0xa00a4d)[_0xe62f('0x1f')](function(_0xe6f86f){_0x371691[_0xe62f('0x17')]=_0xe6f86f;if(_0x24f85c[_0xe62f('0x2b')][_0xe62f('0x3c')]){_0x1c5c2d[_0xe62f('0x3d')]=[{'all':!![]}];}return db[_0xe62f('0x3b')][_0xe62f('0x3e')](_0x1c5c2d);})['then'](function(_0x3f581c){_0x371691[_0xe62f('0x3f')]=_0x3f581c;return _0x371691;})[_0xe62f('0x1f')](respondWithFilteredResult(_0x1440a5,_0x1c5c2d))[_0xe62f('0x40')](handleError(_0x1440a5,null));};exports[_0xe62f('0x41')]=function(_0x34f5ec,_0x3baa49){var _0x19eee6={'raw':!![],'where':{'id':_0x34f5ec[_0xe62f('0x42')]['id']}},_0xb96aec={};_0xb96aec[_0xe62f('0x2e')]=_[_0xe62f('0x2a')](db[_0xe62f('0x3b')][_0xe62f('0x26')]);_0xb96aec[_0xe62f('0x2b')]=_[_0xe62f('0x2a')](_0x34f5ec[_0xe62f('0x2b')]);_0xb96aec['filters']=_[_0xe62f('0x2d')](_0xb96aec['model'],_0xb96aec[_0xe62f('0x2b')]);_0x19eee6[_0xe62f('0x2f')]=_[_0xe62f('0x2d')](_0xb96aec[_0xe62f('0x2e')],qs[_0xe62f('0x30')](_0x34f5ec[_0xe62f('0x2b')][_0xe62f('0x30')]));_0x19eee6[_0xe62f('0x2f')]=_0x19eee6[_0xe62f('0x2f')][_0xe62f('0x31')]?_0x19eee6[_0xe62f('0x2f')]:_0xb96aec[_0xe62f('0x2e')];if(_0x34f5ec[_0xe62f('0x2b')][_0xe62f('0x3c')]){_0x19eee6[_0xe62f('0x3d')]=[{'all':!![]}];}_0x19eee6=_[_0xe62f('0x38')]({},_0x19eee6,_0x34f5ec[_0xe62f('0x3a')]);return db[_0xe62f('0x3b')][_0xe62f('0x43')](_0x19eee6)[_0xe62f('0x1f')](handleEntityNotFound(_0x3baa49,null))[_0xe62f('0x1f')](respondWithResult(_0x3baa49,null))[_0xe62f('0x40')](handleError(_0x3baa49,null));};exports[_0xe62f('0x44')]=function(_0x250af9,_0x4bdcbe){return db[_0xe62f('0x3b')][_0xe62f('0x44')](_0x250af9[_0xe62f('0x45')],{})[_0xe62f('0x1f')](respondWithResult(_0x4bdcbe,0xc9))[_0xe62f('0x40')](handleError(_0x4bdcbe,null));};exports['update']=function(_0x1a15b1,_0x260615){if(_0x1a15b1[_0xe62f('0x45')]['id']){delete _0x1a15b1[_0xe62f('0x45')]['id'];}return db[_0xe62f('0x3b')][_0xe62f('0x43')]({'where':{'id':_0x1a15b1[_0xe62f('0x42')]['id']}})[_0xe62f('0x1f')](handleEntityNotFound(_0x260615,null))[_0xe62f('0x1f')](saveUpdates(_0x1a15b1[_0xe62f('0x45')],null))[_0xe62f('0x1f')](respondWithResult(_0x260615,null))[_0xe62f('0x40')](handleError(_0x260615,null));};exports[_0xe62f('0x46')]=function(_0x14c85f,_0xee5bfc){return db[_0xe62f('0x3b')][_0xe62f('0x43')]({'where':{'id':_0x14c85f['params']['id']}})[_0xe62f('0x1f')](handleEntityNotFound(_0xee5bfc,null))['then'](removeEntity(_0xee5bfc,null))[_0xe62f('0x40')](handleError(_0xee5bfc,null));};exports[_0xe62f('0x47')]=function(_0xd69890,_0x2e10de,_0x3a060f){return db[_0xe62f('0x3b')]['find']({'where':{'id':_0xd69890['params']['id']},'attributes':['id',_0xe62f('0x48'),_0xe62f('0x49')]})[_0xe62f('0x1f')](handleEntityNotFound(_0x2e10de,null))[_0xe62f('0x1f')](function(_0x5dc429){if(_0x5dc429){if(!_0x5dc429[_0xe62f('0x48')]){throw new db[(_0xe62f('0x4a'))][(_0xe62f('0x4b'))](_0xe62f('0x4c'));}var _0x2b270f={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5dc429[_0xe62f('0x49')]){_0x2b270f[_0xe62f('0x4d')]='attachment;\x20filename=\x22'+_0x5dc429[_0xe62f('0x49')]+'.wav\x22';}_0x2e10de['set'](_0x2b270f);return _0x2e10de[_0xe62f('0x4e')](new Buffer(_0x5dc429['recording']));}})[_0xe62f('0x40')](handleError(_0x2e10de,null));}; \ No newline at end of file +var _0xd9d3=['set','Content-Range','apply','reject','save','update','then','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit'];(function(_0x26f1da,_0x48dc4e){var _0x48018c=function(_0x2f64a7){while(--_0x2f64a7){_0x26f1da['push'](_0x26f1da['shift']());}};_0x48018c(++_0x48dc4e);}(_0xd9d3,0x17d));var _0x3d9d=function(_0x302a36,_0x5db659){_0x302a36=_0x302a36-0x0;var _0x366138=_0xd9d3[_0x302a36];return _0x366138;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d9d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d9d('0x1'));var rp=require(_0x3d9d('0x2'));var moment=require('moment');var BPromise=require(_0x3d9d('0x3'));var Mustache=require('mustache');var util=require(_0x3d9d('0x4'));var path=require(_0x3d9d('0x5'));var sox=require(_0x3d9d('0x6'));var csv=require(_0x3d9d('0x7'));var ejs=require(_0x3d9d('0x8'));var fs=require('fs');var _=require(_0x3d9d('0x9'));var squel=require(_0x3d9d('0xa'));var crypto=require(_0x3d9d('0xb'));var jsforce=require(_0x3d9d('0xc'));var deskjs=require(_0x3d9d('0xd'));var toCsv=require(_0x3d9d('0x7'));var querystring=require(_0x3d9d('0xe'));var Papa=require(_0x3d9d('0xf'));var Redis=require(_0x3d9d('0x10'));var authService=require(_0x3d9d('0x11'));var qs=require(_0x3d9d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d9d('0x13'));var utils=require(_0x3d9d('0x14'));var config=require(_0x3d9d('0x15'));var licenseUtil=require(_0x3d9d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x654521,_0x388668){_0x388668=_0x388668||0xcc;return function(_0x16fb14){if(_0x16fb14){return _0x654521[_0x3d9d('0x17')](_0x388668);}return _0x654521['status'](_0x388668)[_0x3d9d('0x18')]();};}function respondWithResult(_0x5b8e01,_0x3357f1){_0x3357f1=_0x3357f1||0xc8;return function(_0x4d06cd){if(_0x4d06cd){return _0x5b8e01[_0x3d9d('0x19')](_0x3357f1)['json'](_0x4d06cd);}};}function respondWithFilteredResult(_0x22c8d3,_0x4ccb94){return function(_0x272afb){if(_0x272afb){var _0x1efc85=_0x272afb[_0x3d9d('0x1a')],_0x570bc0=_0x4ccb94[_0x3d9d('0x1b')],_0x505ffe=_0x4ccb94['offset']+_0x4ccb94[_0x3d9d('0x1c')],_0x25247c;if(_0x505ffe>=_0x1efc85){_0x505ffe=_0x1efc85;_0x25247c=0xc8;}else{_0x25247c=0xce;}_0x22c8d3[_0x3d9d('0x19')](_0x25247c);return _0x22c8d3[_0x3d9d('0x1d')](_0x3d9d('0x1e'),_0x570bc0+'-'+_0x505ffe+'/'+_0x1efc85)['json'](_0x272afb);}return null;};}function patchUpdates(_0x30cf36){return function(_0x47a26c){try{jsonpatch[_0x3d9d('0x1f')](_0x47a26c,_0x30cf36,!![]);}catch(_0x34cba3){return BPromise[_0x3d9d('0x20')](_0x34cba3);}return _0x47a26c[_0x3d9d('0x21')]();};}function saveUpdates(_0x46029e,_0x1f94e7){return function(_0x2aba87){if(_0x2aba87){return _0x2aba87[_0x3d9d('0x22')](_0x46029e)[_0x3d9d('0x23')](function(_0x3ebc13){return _0x3ebc13;});}return null;};}function removeEntity(_0x44fc4e,_0x406d4e){return function(_0x537ff4){if(_0x537ff4){return _0x537ff4['destroy']()[_0x3d9d('0x23')](function(){_0x44fc4e[_0x3d9d('0x19')](0xcc)[_0x3d9d('0x18')]();});}};}function handleEntityNotFound(_0x4a4acb,_0x3ee9a9){return function(_0x2ef92c){if(!_0x2ef92c){_0x4a4acb['sendStatus'](0x194);}return _0x2ef92c;};}function handleError(_0xadad81,_0x1316ef){_0x1316ef=_0x1316ef||0x1f4;return function(_0x584533){logger['error'](_0x584533['stack']);if(_0x584533[_0x3d9d('0x24')]){delete _0x584533[_0x3d9d('0x24')];}_0xadad81['status'](_0x1316ef)[_0x3d9d('0x25')](_0x584533);};}exports[_0x3d9d('0x26')]=function(_0x1dc2e3,_0x3fda3c){var _0x1b1ccd={},_0x4355d8={},_0x6e08f2={'count':0x0,'rows':[]};var _0x3305ee=_[_0x3d9d('0x27')](db[_0x3d9d('0x28')][_0x3d9d('0x29')],function(_0xc8928a){return{'name':_0xc8928a['fieldName'],'type':_0xc8928a[_0x3d9d('0x2a')][_0x3d9d('0x2b')]};});_0x4355d8[_0x3d9d('0x2c')]=_['differenceBy'](_[_0x3d9d('0x27')](_0x3305ee,_0x3d9d('0x24')),['name']);_0x4355d8['query']=_['keys'](_0x1dc2e3[_0x3d9d('0x2d')]);_0x4355d8[_0x3d9d('0x2e')]=_[_0x3d9d('0x2f')](_0x4355d8['model'],_0x4355d8[_0x3d9d('0x2d')]);_0x1b1ccd['attributes']=_[_0x3d9d('0x2f')](_0x4355d8[_0x3d9d('0x2c')],qs[_0x3d9d('0x30')](_0x1dc2e3[_0x3d9d('0x2d')]['fields']));_0x1b1ccd[_0x3d9d('0x31')]=_0x1b1ccd[_0x3d9d('0x31')][_0x3d9d('0x32')]?_0x1b1ccd[_0x3d9d('0x31')]:_0x4355d8[_0x3d9d('0x2c')];if(!_0x1dc2e3[_0x3d9d('0x2d')]['hasOwnProperty'](_0x3d9d('0x33'))){_0x1b1ccd['limit']=qs[_0x3d9d('0x1c')](_0x1dc2e3['query'][_0x3d9d('0x1c')]);_0x1b1ccd['offset']=qs['offset'](_0x1dc2e3[_0x3d9d('0x2d')][_0x3d9d('0x1b')]);}_0x1b1ccd[_0x3d9d('0x34')]=qs[_0x3d9d('0x35')](_0x1dc2e3[_0x3d9d('0x2d')][_0x3d9d('0x35')]);_0x1b1ccd['where']=qs['filters'](_[_0x3d9d('0x36')](_0x1dc2e3[_0x3d9d('0x2d')],_0x4355d8[_0x3d9d('0x2e')]),_0x3305ee);if(_0x1dc2e3[_0x3d9d('0x2d')][_0x3d9d('0x37')]){_0x1b1ccd[_0x3d9d('0x38')]=_['merge'](_0x1b1ccd[_0x3d9d('0x38')],{'$or':_[_0x3d9d('0x27')](_0x3305ee,function(_0x5b337f){if(_0x5b337f[_0x3d9d('0x2a')]!==_0x3d9d('0x39')){var _0x4009db={};_0x4009db[_0x5b337f['name']]={'$like':'%'+_0x1dc2e3['query']['filter']+'%'};return _0x4009db;}})});}_0x1b1ccd=_[_0x3d9d('0x3a')]({},_0x1b1ccd,_0x1dc2e3[_0x3d9d('0x3b')]);var _0x2719a8={'where':_0x1b1ccd[_0x3d9d('0x38')]};return db[_0x3d9d('0x28')][_0x3d9d('0x1a')](_0x2719a8)['then'](function(_0x15eaf4){_0x6e08f2[_0x3d9d('0x1a')]=_0x15eaf4;if(_0x1dc2e3[_0x3d9d('0x2d')][_0x3d9d('0x3c')]){_0x1b1ccd[_0x3d9d('0x3d')]=[{'all':!![]}];}return db[_0x3d9d('0x28')][_0x3d9d('0x3e')](_0x1b1ccd);})[_0x3d9d('0x23')](function(_0x5f0caf){_0x6e08f2[_0x3d9d('0x3f')]=_0x5f0caf;return _0x6e08f2;})[_0x3d9d('0x23')](respondWithFilteredResult(_0x3fda3c,_0x1b1ccd))[_0x3d9d('0x40')](handleError(_0x3fda3c,null));};exports[_0x3d9d('0x41')]=function(_0x2ff29e,_0x2975b2){var _0x5035c4={'raw':!![],'where':{'id':_0x2ff29e[_0x3d9d('0x42')]['id']}},_0x8acceb={};_0x8acceb[_0x3d9d('0x2c')]=_[_0x3d9d('0x43')](db[_0x3d9d('0x28')][_0x3d9d('0x29')]);_0x8acceb[_0x3d9d('0x2d')]=_['keys'](_0x2ff29e[_0x3d9d('0x2d')]);_0x8acceb[_0x3d9d('0x2e')]=_[_0x3d9d('0x2f')](_0x8acceb['model'],_0x8acceb[_0x3d9d('0x2d')]);_0x5035c4[_0x3d9d('0x31')]=_[_0x3d9d('0x2f')](_0x8acceb[_0x3d9d('0x2c')],qs[_0x3d9d('0x30')](_0x2ff29e[_0x3d9d('0x2d')][_0x3d9d('0x30')]));_0x5035c4['attributes']=_0x5035c4[_0x3d9d('0x31')]['length']?_0x5035c4['attributes']:_0x8acceb[_0x3d9d('0x2c')];if(_0x2ff29e[_0x3d9d('0x2d')]['includeAll']){_0x5035c4[_0x3d9d('0x3d')]=[{'all':!![]}];}_0x5035c4=_[_0x3d9d('0x3a')]({},_0x5035c4,_0x2ff29e[_0x3d9d('0x3b')]);return db[_0x3d9d('0x28')]['find'](_0x5035c4)['then'](handleEntityNotFound(_0x2975b2,null))[_0x3d9d('0x23')](respondWithResult(_0x2975b2,null))[_0x3d9d('0x40')](handleError(_0x2975b2,null));};exports[_0x3d9d('0x44')]=function(_0x12ec6c,_0x3352f8){return db[_0x3d9d('0x28')]['create'](_0x12ec6c[_0x3d9d('0x45')],{})['then'](respondWithResult(_0x3352f8,0xc9))[_0x3d9d('0x40')](handleError(_0x3352f8,null));};exports['update']=function(_0x1c8702,_0x957325){if(_0x1c8702['body']['id']){delete _0x1c8702[_0x3d9d('0x45')]['id'];}return db['VoiceMailMessage'][_0x3d9d('0x46')]({'where':{'id':_0x1c8702[_0x3d9d('0x42')]['id']}})[_0x3d9d('0x23')](handleEntityNotFound(_0x957325,null))[_0x3d9d('0x23')](saveUpdates(_0x1c8702[_0x3d9d('0x45')],null))['then'](respondWithResult(_0x957325,null))['catch'](handleError(_0x957325,null));};exports[_0x3d9d('0x47')]=function(_0x497f90,_0x252794){return db['VoiceMailMessage'][_0x3d9d('0x46')]({'where':{'id':_0x497f90['params']['id']}})[_0x3d9d('0x23')](handleEntityNotFound(_0x252794,null))[_0x3d9d('0x23')](removeEntity(_0x252794,null))[_0x3d9d('0x40')](handleError(_0x252794,null));};exports[_0x3d9d('0x48')]=function(_0x1b7197,_0x4680cd,_0x28495c){return db[_0x3d9d('0x28')][_0x3d9d('0x46')]({'where':{'id':_0x1b7197[_0x3d9d('0x42')]['id']},'attributes':['id',_0x3d9d('0x49'),'msg_id']})['then'](handleEntityNotFound(_0x4680cd,null))[_0x3d9d('0x23')](function(_0x247ebb){if(_0x247ebb){if(!_0x247ebb[_0x3d9d('0x49')]){throw new db[(_0x3d9d('0x4a'))]['ValidationError'](_0x3d9d('0x4b'));}var _0x5438c3={'Content-Type':_0x3d9d('0x4c'),'Content-Disposition':_0x3d9d('0x4d')};if(_0x247ebb[_0x3d9d('0x4e')]){_0x5438c3[_0x3d9d('0x4f')]=_0x3d9d('0x50')+_0x247ebb['msg_id']+_0x3d9d('0x51');}_0x4680cd[_0x3d9d('0x1d')](_0x5438c3);return _0x4680cd['send'](new Buffer(_0x247ebb['recording']));}})[_0x3d9d('0x40')](handleError(_0x4680cd,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0bd4682..334dcc5 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 _0x8e54=['dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x39166a,_0x443150){var _0xac6f7c=function(_0x5b6531){while(--_0x5b6531){_0x39166a['push'](_0x39166a['shift']());}};_0xac6f7c(++_0x443150);}(_0x8e54,0xd3));var _0x48e5=function(_0xdaf6f6,_0xd0fb00){_0xdaf6f6=_0xdaf6f6-0x0;var _0x338862=_0x8e54[_0xdaf6f6];return _0x338862;};'use strict';var _=require(_0x48e5('0x0'));var util=require(_0x48e5('0x1'));var logger=require(_0x48e5('0x2'))('api');var moment=require(_0x48e5('0x3'));var BPromise=require(_0x48e5('0x4'));var rp=require(_0x48e5('0x5'));var fs=require('fs');var path=require(_0x48e5('0x6'));var rimraf=require(_0x48e5('0x7'));var config=require(_0x48e5('0x8'));var attributes=require(_0x48e5('0x9'));module[_0x48e5('0xa')]=function(_0x13f0a5,_0x158d18){return _0x13f0a5[_0x48e5('0xb')](_0x48e5('0xc'),attributes,{'tableName':_0x48e5('0xd'),'paranoid':![],'indexes':[{'name':_0x48e5('0xe'),'fields':[_0x48e5('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x676e=['bluebird','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x676e,0x1f4));var _0xe676=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x676e[_0x4ca6a4];return _0x120555;};'use strict';var _=require(_0xe676('0x0'));var util=require(_0xe676('0x1'));var logger=require(_0xe676('0x2'))('api');var moment=require(_0xe676('0x3'));var BPromise=require(_0xe676('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe676('0x5')]=function(_0x5bda9e,_0x2a994f){return _0x5bda9e[_0xe676('0x6')]('VoiceMailMessage',attributes,{'tableName':_0xe676('0x7'),'paranoid':![],'indexes':[{'name':_0xe676('0x8'),'fields':[_0xe676('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index eb7cfbc..e9450df 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x119680,_0x1e6a47){var _0x21e81e=function(_0x313bd0){while(--_0x313bd0){_0x119680['push'](_0x119680['shift']());}};_0x21e81e(++_0x1e6a47);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f439b,_0x5d5de4){_0x5f439b=_0x5f439b-0x0;var _0x9aba61=_0x2ef3[_0x5f439b];return _0x9aba61;};'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')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x567ab7,_0x576471){var _0x177e77=function(_0x468e93){while(--_0x468e93){_0x567ab7['push'](_0x567ab7['shift']());}};_0x177e77(++_0x576471);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56baba,_0x22de9a){_0x56baba=_0x56baba-0x0;var _0x34f9ce=_0x5f2f[_0x56baba];return _0x34f9ce;};'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')]('VoiceMailMessage,\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);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 09f7d74..0605054 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 _0xd448=['removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','update','destroy','delete','/:id/sounds/:id2'];(function(_0xf01961,_0x17c74f){var _0xd983c4=function(_0x62a217){while(--_0x62a217){_0xf01961['push'](_0xf01961['shift']());}};_0xd983c4(++_0x17c74f);}(_0xd448,0xfc));var _0x8d44=function(_0x49988d,_0x15dae4){_0x49988d=_0x49988d-0x0;var _0x2259f7=_0xd448[_0x49988d];return _0x2259f7;};'use strict';var multer=require(_0x8d44('0x0'));var util=require(_0x8d44('0x1'));var path=require(_0x8d44('0x2'));var timeout=require(_0x8d44('0x3'));var express=require(_0x8d44('0x4'));var router=express[_0x8d44('0x5')]();var auth=require(_0x8d44('0x6'));var interaction=require(_0x8d44('0x7'));var config=require(_0x8d44('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x8d44('0x9')]('/',auth[_0x8d44('0xa')](),controller[_0x8d44('0xb')]);router[_0x8d44('0x9')](_0x8d44('0xc'),auth['isAuthenticated'](),controller[_0x8d44('0xd')]);router['get'](_0x8d44('0xe'),auth[_0x8d44('0xa')](),controller['getSounds']);router[_0x8d44('0xf')]('/',auth[_0x8d44('0xa')](),controller[_0x8d44('0x10')]);router[_0x8d44('0xf')](_0x8d44('0xe'),auth['isAuthenticated'](),controller[_0x8d44('0x11')]);router[_0x8d44('0x12')](_0x8d44('0xc'),auth[_0x8d44('0xa')](),controller[_0x8d44('0x13')]);router['delete'](_0x8d44('0xc'),auth[_0x8d44('0xa')](),controller[_0x8d44('0x14')]);router[_0x8d44('0x15')](_0x8d44('0x16'),auth[_0x8d44('0xa')](),controller[_0x8d44('0x17')]);module[_0x8d44('0x18')]=router; \ No newline at end of file +var _0xe37e=['destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','delete'];(function(_0x329188,_0x240592){var _0x2f8386=function(_0x1e2e42){while(--_0x1e2e42){_0x329188['push'](_0x329188['shift']());}};_0x2f8386(++_0x240592);}(_0xe37e,0x14d));var _0xee37=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xe37e[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0xee37('0x0'));var util=require(_0xee37('0x1'));var path=require(_0xee37('0x2'));var timeout=require(_0xee37('0x3'));var express=require(_0xee37('0x4'));var router=express[_0xee37('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xee37('0x6'));var config=require(_0xee37('0x7'));var controller=require(_0xee37('0x8'));router[_0xee37('0x9')]('/',auth[_0xee37('0xa')](),controller['index']);router[_0xee37('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xee37('0xb')]);router[_0xee37('0x9')](_0xee37('0xc'),auth[_0xee37('0xa')](),controller[_0xee37('0xd')]);router[_0xee37('0xe')]('/',auth[_0xee37('0xa')](),controller[_0xee37('0xf')]);router[_0xee37('0xe')]('/:id/sounds',auth[_0xee37('0xa')](),controller[_0xee37('0x10')]);router[_0xee37('0x11')]('/:id',auth[_0xee37('0xa')](),controller['update']);router[_0xee37('0x12')]('/:id',auth[_0xee37('0xa')](),controller[_0xee37('0x13')]);router[_0xee37('0x12')](_0xee37('0x14'),auth[_0xee37('0xa')](),controller['removeSound']);module[_0xee37('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 476ef0c..8c57477 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 _0x43b3=['files','alpha','TIMESTAMP','sequelize','STRING','name','ENUM','custom','mp3nb','quietmp3','mp3'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x43b3,0x12c));var _0x343b=function(_0x51ea72,_0x2f10c3){_0x51ea72=_0x51ea72-0x0;var _0x16f15d=_0x43b3[_0x51ea72];return _0x16f15d;};'use strict';var Sequelize=require(_0x343b('0x0'));module['exports']={'name':{'type':Sequelize[_0x343b('0x1')],'allowNull':![],'unique':_0x343b('0x2')},'mode':{'type':Sequelize[_0x343b('0x3')](_0x343b('0x4'),'files',_0x343b('0x5'),'quietmp3nb',_0x343b('0x6'),_0x343b('0x7')),'allowNull':!![],'defaultValue':_0x343b('0x8')},'directory':{'type':Sequelize[_0x343b('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x343b('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x343b('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x343b('0x1')],'allowNull':!![],'defaultValue':_0x343b('0x9')},'format':{'type':Sequelize[_0x343b('0x1')],'allowNull':!![]},'stamp':{'type':_0x343b('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x43bc=['ENUM','custom','mp3nb','quietmp3','mp3','files','STRING','BOOLEAN','sequelize','exports','name'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x43bc,0x1cb));var _0xc43b=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0x43bc[_0x51bb38];return _0x51c09b;};'use strict';var Sequelize=require(_0xc43b('0x0'));module[_0xc43b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc43b('0x2')},'mode':{'type':Sequelize[_0xc43b('0x3')](_0xc43b('0x4'),'files',_0xc43b('0x5'),'quietmp3nb',_0xc43b('0x6'),_0xc43b('0x7')),'allowNull':!![],'defaultValue':_0xc43b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xc43b('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc43b('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc43b('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xc43b('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xc43b('0xa')],'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 9de6307..a48a2b6 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 _0x939d=['symlinkSync','ValidationError','message','findOne','removeSound','id2','getSounds','options','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','keys','find','update','body','params','sequelize','transaction','mode','files','directory','join','root','create','user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','save_name','converted_format','createdAt','%s.%s','basename','extname','server/files/moh','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x939d,0x1b0));var _0xd939=function(_0x2fefe9,_0x2e3c9f){_0x2fefe9=_0x2fefe9-0x0;var _0x2f14a5=_0x939d[_0x2fefe9];return _0x2f14a5;};'use strict';var pdf=require(_0xd939('0x0'));var emlformat=require(_0xd939('0x1'));var rimraf=require(_0xd939('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd939('0x3'));var BPromise=require(_0xd939('0x4'));var Mustache=require(_0xd939('0x5'));var util=require(_0xd939('0x6'));var path=require(_0xd939('0x7'));var sox=require(_0xd939('0x8'));var csv=require('to-csv');var ejs=require(_0xd939('0x9'));var fs=require('fs');var _=require(_0xd939('0xa'));var squel=require(_0xd939('0xb'));var crypto=require(_0xd939('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd939('0xd'));var toCsv=require(_0xd939('0xe'));var querystring=require(_0xd939('0xf'));var Papa=require(_0xd939('0x10'));var Redis=require('ioredis');var authService=require(_0xd939('0x11'));var qs=require(_0xd939('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd939('0x13'));var logger=require(_0xd939('0x14'))(_0xd939('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3078d7,_0x1d3872){_0x1d3872=_0x1d3872||0xcc;return function(_0x2de03f){if(_0x2de03f){return _0x3078d7[_0xd939('0x16')](_0x1d3872);}return _0x3078d7[_0xd939('0x17')](_0x1d3872)[_0xd939('0x18')]();};}function respondWithResult(_0x47287c,_0x2ace80){_0x2ace80=_0x2ace80||0xc8;return function(_0x53edb7){if(_0x53edb7){return _0x47287c[_0xd939('0x17')](_0x2ace80)[_0xd939('0x19')](_0x53edb7);}};}function respondWithFilteredResult(_0x49a872,_0x24c791){return function(_0x4e1352){if(_0x4e1352){var _0x48e2c1=_0x4e1352[_0xd939('0x1a')],_0x379174=_0x24c791[_0xd939('0x1b')],_0x427cac=_0x24c791[_0xd939('0x1b')]+_0x24c791[_0xd939('0x1c')],_0x264ab2;if(_0x427cac>=_0x48e2c1){_0x427cac=_0x48e2c1;_0x264ab2=0xc8;}else{_0x264ab2=0xce;}_0x49a872['status'](_0x264ab2);return _0x49a872[_0xd939('0x1d')]('Content-Range',_0x379174+'-'+_0x427cac+'/'+_0x48e2c1)[_0xd939('0x19')](_0x4e1352);}return null;};}function patchUpdates(_0x362134){return function(_0x4e6500){try{jsonpatch[_0xd939('0x1e')](_0x4e6500,_0x362134,!![]);}catch(_0x133535){return BPromise[_0xd939('0x1f')](_0x133535);}return _0x4e6500[_0xd939('0x20')]();};}function saveUpdates(_0x3e6bc0,_0x6c2f49){return function(_0x5d6817){if(_0x5d6817){return _0x5d6817['update'](_0x3e6bc0)[_0xd939('0x21')](function(_0x1a2ba6){return _0x1a2ba6;});}return null;};}function removeEntity(_0xa36076,_0x5d2e06){return function(_0x3d67f3){if(_0x3d67f3){return _0x3d67f3[_0xd939('0x22')]()[_0xd939('0x21')](function(){var _0x39eb1d=_0x3d67f3['get']({'plain':!![]});var _0x10f335=_0xd939('0x23');return db[_0xd939('0x24')][_0xd939('0x22')]({'where':{'type':_0x10f335,'resourceId':_0x39eb1d['id']}})['then'](function(){return _0x3d67f3;});})[_0xd939('0x21')](function(){_0xa36076[_0xd939('0x17')](0xcc)[_0xd939('0x18')]();});}};}function handleEntityNotFound(_0x1aa7ec,_0x5198b2){return function(_0x11bc29){if(!_0x11bc29){_0x1aa7ec[_0xd939('0x16')](0x194);}return _0x11bc29;};}function handleError(_0x5a144f,_0x7b7e19){_0x7b7e19=_0x7b7e19||0x1f4;return function(_0x287062){logger[_0xd939('0x25')](_0x287062['stack']);if(_0x287062[_0xd939('0x26')]){delete _0x287062[_0xd939('0x26')];}_0x5a144f['status'](_0x7b7e19)[_0xd939('0x27')](_0x287062);};}exports[_0xd939('0x28')]=function(_0x1c3ec6,_0x54850d){var _0x3d2ca0={},_0x974579={},_0x59e2d0={'count':0x0,'rows':[]};var _0x3673d0=_[_0xd939('0x29')](db[_0xd939('0x2a')][_0xd939('0x2b')],function(_0x442250){return{'name':_0x442250['fieldName'],'type':_0x442250[_0xd939('0x2c')][_0xd939('0x2d')]};});_0x974579[_0xd939('0x2e')]=_[_0xd939('0x29')](_0x3673d0,'name');_0x974579[_0xd939('0x2f')]=_['keys'](_0x1c3ec6['query']);_0x974579[_0xd939('0x30')]=_[_0xd939('0x31')](_0x974579[_0xd939('0x2e')],_0x974579['query']);_0x3d2ca0[_0xd939('0x32')]=_[_0xd939('0x31')](_0x974579[_0xd939('0x2e')],qs[_0xd939('0x33')](_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x33')]));_0x3d2ca0[_0xd939('0x32')]=_0x3d2ca0[_0xd939('0x32')][_0xd939('0x34')]?_0x3d2ca0[_0xd939('0x32')]:_0x974579[_0xd939('0x2e')];if(!_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x35')](_0xd939('0x36'))){_0x3d2ca0[_0xd939('0x1c')]=qs[_0xd939('0x1c')](_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x1c')]);_0x3d2ca0[_0xd939('0x1b')]=qs[_0xd939('0x1b')](_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x1b')]);}_0x3d2ca0[_0xd939('0x37')]=qs['sort'](_0x1c3ec6['query'][_0xd939('0x38')]);_0x3d2ca0[_0xd939('0x39')]=qs['filters'](_[_0xd939('0x3a')](_0x1c3ec6[_0xd939('0x2f')],_0x974579[_0xd939('0x30')]),_0x3673d0);if(_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x3b')]){_0x3d2ca0[_0xd939('0x39')]=_[_0xd939('0x3c')](_0x3d2ca0['where'],{'$or':_[_0xd939('0x29')](_0x3673d0,function(_0x3802ee){if(_0x3802ee[_0xd939('0x2c')]!=='VIRTUAL'){var _0x34e142={};_0x34e142[_0x3802ee[_0xd939('0x26')]]={'$like':'%'+_0x1c3ec6[_0xd939('0x2f')][_0xd939('0x3b')]+'%'};return _0x34e142;}})});}_0x3d2ca0=_[_0xd939('0x3c')]({},_0x3d2ca0,_0x1c3ec6['options']);var _0x37feec={'where':_0x3d2ca0['where']};return db[_0xd939('0x2a')]['count'](_0x37feec)[_0xd939('0x21')](function(_0x4a3112){_0x59e2d0[_0xd939('0x1a')]=_0x4a3112;if(_0x1c3ec6[_0xd939('0x2f')]['includeAll']){_0x3d2ca0[_0xd939('0x3d')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd939('0x3e')](_0x3d2ca0);})[_0xd939('0x21')](function(_0x16357c){_0x59e2d0['rows']=_0x16357c;return _0x59e2d0;})[_0xd939('0x21')](respondWithFilteredResult(_0x54850d,_0x3d2ca0))[_0xd939('0x3f')](handleError(_0x54850d,null));};exports[_0xd939('0x40')]=function(_0x49e851,_0x5b7c59){var _0x2d18c3={'raw':![],'where':{'id':_0x49e851['params']['id']}},_0x5d0665={};_0x5d0665[_0xd939('0x2e')]=_[_0xd939('0x41')](db[_0xd939('0x2a')][_0xd939('0x2b')]);_0x5d0665[_0xd939('0x2f')]=_[_0xd939('0x41')](_0x49e851[_0xd939('0x2f')]);_0x5d0665['filters']=_[_0xd939('0x31')](_0x5d0665[_0xd939('0x2e')],_0x5d0665[_0xd939('0x2f')]);_0x2d18c3[_0xd939('0x32')]=_[_0xd939('0x31')](_0x5d0665[_0xd939('0x2e')],qs[_0xd939('0x33')](_0x49e851['query'][_0xd939('0x33')]));_0x2d18c3[_0xd939('0x32')]=_0x2d18c3[_0xd939('0x32')][_0xd939('0x34')]?_0x2d18c3[_0xd939('0x32')]:_0x5d0665[_0xd939('0x2e')];if(_0x49e851[_0xd939('0x2f')]['includeAll']){_0x2d18c3[_0xd939('0x3d')]=[{'all':!![]}];}_0x2d18c3=_['merge']({},_0x2d18c3,_0x49e851['options']);return db[_0xd939('0x2a')][_0xd939('0x42')](_0x2d18c3)[_0xd939('0x21')](handleEntityNotFound(_0x5b7c59,null))['then'](respondWithResult(_0x5b7c59,null))[_0xd939('0x3f')](handleError(_0x5b7c59,null));};exports[_0xd939('0x43')]=function(_0x81ef32,_0x229e40){if(_0x81ef32['body']['id']){delete _0x81ef32[_0xd939('0x44')]['id'];}return db[_0xd939('0x2a')][_0xd939('0x42')]({'where':{'id':_0x81ef32[_0xd939('0x45')]['id']}})['then'](handleEntityNotFound(_0x229e40,null))[_0xd939('0x21')](saveUpdates(_0x81ef32[_0xd939('0x44')],null))[_0xd939('0x21')](respondWithResult(_0x229e40,null))[_0xd939('0x3f')](handleError(_0x229e40,null));};exports['create']=function(_0xe12bcb,_0x212d66,_0x26bbab){return db[_0xd939('0x46')][_0xd939('0x47')](function(_0x41a834){if(_0xe12bcb[_0xd939('0x44')][_0xd939('0x48')]===_0xd939('0x49')){_0xe12bcb[_0xd939('0x44')][_0xd939('0x4a')]=path[_0xd939('0x4b')](config[_0xd939('0x4c')],'server/files/moh',_0xe12bcb[_0xd939('0x44')]['name']);}return db[_0xd939('0x2a')][_0xd939('0x4d')](_0xe12bcb[_0xd939('0x44')],{'transaction':_0x41a834})[_0xd939('0x21')](function(_0x5a54b8){if(_0xe12bcb[_0xd939('0x44')][_0xd939('0x48')]==='files'){fs['mkdirSync'](_0x5a54b8['directory'],parseInt('0777',0x8));}var _0x171a70=_0xe12bcb[_0xd939('0x4e')]['get']({'plain':!![]});if(!_0x171a70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x171a70[_0xd939('0x4f')]===_0xd939('0x4e')){var _0x40fe55=_0x5a54b8[_0xd939('0x50')]({'plain':!![]});return db[_0xd939('0x51')][_0xd939('0x42')]({'where':{'name':_0xd939('0x23'),'userProfileId':_0x171a70['userProfileId']},'raw':!![]})[_0xd939('0x21')](function(_0x36f46d){if(_0x36f46d&&_0x36f46d['autoAssociation']===0x0){return db[_0xd939('0x24')]['create']({'name':_0x40fe55[_0xd939('0x26')],'resourceId':_0x40fe55['id'],'type':_0x36f46d[_0xd939('0x26')],'sectionId':_0x36f46d['id']},{})[_0xd939('0x21')](function(){return _0x5a54b8;});}else{return _0x5a54b8;}})['catch'](function(_0x18b101){logger[_0xd939('0x25')](_0xd939('0x52'),_0x18b101);});}return _0x5a54b8;});})[_0xd939('0x21')](respondWithResult(_0x212d66,0xc9))[_0xd939('0x3f')](handleError(_0x212d66,null));};exports[_0xd939('0x22')]=function(_0x36257c,_0x2a3b28,_0x139519){var _0x3ea555;return db[_0xd939('0x2a')]['find']({'where':{'id':_0x36257c['params']['id']}})[_0xd939('0x21')](function(_0x1d18ac){if(_0x1d18ac){return db['sequelize'][_0xd939('0x47')](function(_0x983123){return _0x1d18ac[_0xd939('0x22')]({'transaction':_0x983123,'raw':!![]})['then'](function(_0x236f21){if(_0x236f21['directory']){fs[_0xd939('0x53')](_0x236f21[_0xd939('0x4a')])[_0xd939('0x54')](function(_0x466622){fs[_0xd939('0x55')](path[_0xd939('0x4b')](_0x236f21['directory'],_0x466622));});fs[_0xd939('0x56')](_0x236f21[_0xd939('0x4a')]);}return _0x236f21;});})['catch'](function(_0x32f98d){throw new db[(_0xd939('0x57'))]['ValidationError'](_0x32f98d['message']);});}})[_0xd939('0x21')](handleEntityNotFound(_0x2a3b28,null))[_0xd939('0x21')](removeEntity(_0x2a3b28,null))[_0xd939('0x3f')](handleError(_0x2a3b28,null));};exports[_0xd939('0x58')]=function(_0x4a10c3,_0x4c0d8e,_0x182368){return db['sequelize'][_0xd939('0x47')](function(_0xea38c7){var _0x303703;return db[_0xd939('0x2a')]['find']({'where':{'id':_0x4a10c3[_0xd939('0x45')]['id']}})[_0xd939('0x21')](function(_0x21a790){if(_0x21a790){_0x303703=_0x21a790;return _0x21a790[_0xd939('0x58')](_0x4a10c3[_0xd939('0x44')]['id'],{'transaction':_0xea38c7});}})[_0xd939('0x21')](function(_0x553ec6){if(_0x553ec6){return db[_0xd939('0x59')]['findOne']({'where':{'id':_0x4a10c3['body']['id']},'attributes':['id',_0xd939('0x26'),_0xd939('0x5a'),_0xd939('0x5b'),_0xd939('0x5c')],'raw':!![]});}})[_0xd939('0x21')](function(_0x2f950c){if(_0x2f950c){var _0x1a54da=path['join'](config['root'],'server/files/sounds/converted',util['format'](_0xd939('0x5d'),path[_0xd939('0x5e')](_0x2f950c[_0xd939('0x5a')],path[_0xd939('0x5f')](_0x2f950c[_0xd939('0x5a')])),_0x2f950c[_0xd939('0x5b')]));var _0x46f28a=path[_0xd939('0x4b')](config[_0xd939('0x4c')],_0xd939('0x60'),_0x303703['name'],util[_0xd939('0x61')](_0xd939('0x5d'),_0x2f950c[_0xd939('0x26')],_0x2f950c[_0xd939('0x5b')]));fs[_0xd939('0x62')](_0x1a54da,_0x46f28a);return _0x2f950c;}})[_0xd939('0x3f')](function(_0x13a2e2){throw new db['Sequelize'][(_0xd939('0x63'))](_0x13a2e2[_0xd939('0x64')]);});})['then'](handleEntityNotFound(_0x4c0d8e,null))[_0xd939('0x21')](respondWithResult(_0x4c0d8e,0xc9))['catch'](handleError(_0x4c0d8e,null));};exports['removeSound']=function(_0x187f95,_0x294394,_0x3a61bf){return db[_0xd939('0x46')][_0xd939('0x47')](function(_0x57902c){var _0x4a45bd;return db['VoiceMusicOnHold'][_0xd939('0x65')]({'where':{'id':_0x187f95[_0xd939('0x45')]['id']}})[_0xd939('0x21')](handleEntityNotFound(_0x294394,null))[_0xd939('0x21')](function(_0x9ff9c4){if(_0x9ff9c4){_0x4a45bd=_0x9ff9c4;return _0x9ff9c4[_0xd939('0x66')](_0x187f95[_0xd939('0x45')][_0xd939('0x67')]);}})[_0xd939('0x21')](function(_0x5c8754){if(_0x5c8754){return db[_0xd939('0x59')][_0xd939('0x65')]({'where':{'id':_0x187f95[_0xd939('0x45')][_0xd939('0x67')]},'attributes':['id',_0xd939('0x26'),'save_name',_0xd939('0x5b'),_0xd939('0x5c')],'raw':!![]});}})[_0xd939('0x21')](function(_0x5657a6){if(_0x5657a6){fs[_0xd939('0x55')](path[_0xd939('0x4b')](_0x4a45bd[_0xd939('0x4a')],util[_0xd939('0x61')](_0xd939('0x5d'),_0x5657a6[_0xd939('0x26')],_0x5657a6[_0xd939('0x5b')])));return _0x5657a6;}})[_0xd939('0x3f')](function(_0x2c8efb){throw new db[(_0xd939('0x57'))]['ValidationError'](_0x2c8efb[_0xd939('0x64')]);});})[_0xd939('0x21')](handleEntityNotFound(_0x294394,null))['then'](respondWithStatusCode(_0x294394,0xcc))[_0xd939('0x3f')](handleError(_0x294394,null));};exports[_0xd939('0x68')]=function(_0x5591f9,_0x633837,_0x50bd90){var _0x32dfde={};var _0x12cf4e={};var _0x4da188;var _0x3d8204;return db['VoiceMusicOnHold'][_0xd939('0x65')]({'where':{'id':_0x5591f9['params']['id']}})[_0xd939('0x21')](handleEntityNotFound(_0x633837,null))['then'](function(_0x5f353f){if(_0x5f353f){_0x4da188=_0x5f353f;_0x12cf4e[_0xd939('0x2e')]=_[_0xd939('0x41')](db[_0xd939('0x59')][_0xd939('0x2b')]);_0x12cf4e['query']=_[_0xd939('0x41')](_0x5591f9[_0xd939('0x2f')]);_0x12cf4e['filters']=_['intersection'](_0x12cf4e[_0xd939('0x2e')],_0x12cf4e['query']);_0x32dfde[_0xd939('0x32')]=_[_0xd939('0x31')](_0x12cf4e[_0xd939('0x2e')],qs['fields'](_0x5591f9['query'][_0xd939('0x33')]));_0x32dfde['attributes']=_0x32dfde[_0xd939('0x32')][_0xd939('0x34')]?_0x32dfde[_0xd939('0x32')]:_0x12cf4e[_0xd939('0x2e')];_0x32dfde[_0xd939('0x37')]=qs[_0xd939('0x38')](_0x5591f9[_0xd939('0x2f')][_0xd939('0x38')]);_0x32dfde[_0xd939('0x39')]=qs[_0xd939('0x30')](_['pick'](_0x5591f9[_0xd939('0x2f')],_0x12cf4e[_0xd939('0x30')]));if(_0x5591f9[_0xd939('0x2f')]['filter']){_0x32dfde[_0xd939('0x39')]=_[_0xd939('0x3c')](_0x32dfde[_0xd939('0x39')],{'$or':_[_0xd939('0x29')](_0x32dfde[_0xd939('0x32')],function(_0x38faa3){var _0x2546a1={};_0x2546a1[_0x38faa3]={'$like':'%'+_0x5591f9['query'][_0xd939('0x3b')]+'%'};return _0x2546a1;})});}_0x32dfde=_[_0xd939('0x3c')]({},_0x32dfde,_0x5591f9[_0xd939('0x69')]);return _0x4da188[_0xd939('0x68')](_0x32dfde);}})['then'](function(_0x33a0c7){if(_0x33a0c7){_0x3d8204=_0x33a0c7[_0xd939('0x34')];if(!_0x5591f9[_0xd939('0x2f')][_0xd939('0x35')]('nolimit')){_0x32dfde[_0xd939('0x1c')]=qs[_0xd939('0x1c')](_0x5591f9['query'][_0xd939('0x1c')]);_0x32dfde[_0xd939('0x1b')]=qs[_0xd939('0x1b')](_0x5591f9[_0xd939('0x2f')][_0xd939('0x1b')]);}return _0x4da188[_0xd939('0x68')](_0x32dfde);}})[_0xd939('0x21')](function(_0x4dd046){if(_0x4dd046){return _0x4dd046?{'count':_0x3d8204,'rows':_0x4dd046}:null;}})['then'](respondWithResult(_0x633837,null))['catch'](handleError(_0x633837,null));}; \ No newline at end of file +var _0xb954=['format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','body','find','create','sequelize','transaction','mode','files','join','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xb954,0x1d1));var _0x4b95=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0xb954[_0x187842];return _0x5dbcf3;};'use strict';var pdf=require(_0x4b95('0x0'));var emlformat=require(_0x4b95('0x1'));var rimraf=require(_0x4b95('0x2'));var zipdir=require(_0x4b95('0x3'));var jsonpatch=require(_0x4b95('0x4'));var rp=require(_0x4b95('0x5'));var moment=require('moment');var BPromise=require(_0x4b95('0x6'));var Mustache=require(_0x4b95('0x7'));var util=require(_0x4b95('0x8'));var path=require(_0x4b95('0x9'));var sox=require('sox');var csv=require(_0x4b95('0xa'));var ejs=require(_0x4b95('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b95('0xc'));var jsforce=require(_0x4b95('0xd'));var deskjs=require(_0x4b95('0xe'));var toCsv=require(_0x4b95('0xa'));var querystring=require(_0x4b95('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b95('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4b95('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b95('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b95('0x13'));var db=require(_0x4b95('0x14'))['db'];function respondWithStatusCode(_0x238d76,_0x40e3a5){_0x40e3a5=_0x40e3a5||0xcc;return function(_0x459034){if(_0x459034){return _0x238d76[_0x4b95('0x15')](_0x40e3a5);}return _0x238d76['status'](_0x40e3a5)[_0x4b95('0x16')]();};}function respondWithResult(_0xad6006,_0x26eac0){_0x26eac0=_0x26eac0||0xc8;return function(_0x36c2d5){if(_0x36c2d5){return _0xad6006[_0x4b95('0x17')](_0x26eac0)[_0x4b95('0x18')](_0x36c2d5);}};}function respondWithFilteredResult(_0x511d0f,_0x3a245f){return function(_0x5e5f2b){if(_0x5e5f2b){var _0x511f5f=_0x5e5f2b[_0x4b95('0x19')],_0x5d71d5=_0x3a245f[_0x4b95('0x1a')],_0x56f8b8=_0x3a245f['offset']+_0x3a245f[_0x4b95('0x1b')],_0xaaaba0;if(_0x56f8b8>=_0x511f5f){_0x56f8b8=_0x511f5f;_0xaaaba0=0xc8;}else{_0xaaaba0=0xce;}_0x511d0f[_0x4b95('0x17')](_0xaaaba0);return _0x511d0f[_0x4b95('0x1c')]('Content-Range',_0x5d71d5+'-'+_0x56f8b8+'/'+_0x511f5f)['json'](_0x5e5f2b);}return null;};}function patchUpdates(_0x4a5c37){return function(_0x272b75){try{jsonpatch[_0x4b95('0x1d')](_0x272b75,_0x4a5c37,!![]);}catch(_0x2c6197){return BPromise[_0x4b95('0x1e')](_0x2c6197);}return _0x272b75[_0x4b95('0x1f')]();};}function saveUpdates(_0x565a35,_0x295515){return function(_0x4a7018){if(_0x4a7018){return _0x4a7018[_0x4b95('0x20')](_0x565a35)[_0x4b95('0x21')](function(_0x4e63f0){return _0x4e63f0;});}return null;};}function removeEntity(_0x589426,_0x5a437f){return function(_0x15b5bf){if(_0x15b5bf){return _0x15b5bf['destroy']()[_0x4b95('0x21')](function(){var _0x17daa5=_0x15b5bf[_0x4b95('0x22')]({'plain':!![]});var _0x4772e4=_0x4b95('0x23');return db[_0x4b95('0x24')][_0x4b95('0x25')]({'where':{'type':_0x4772e4,'resourceId':_0x17daa5['id']}})[_0x4b95('0x21')](function(){return _0x15b5bf;});})['then'](function(){_0x589426[_0x4b95('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7e725,_0x247e1e){return function(_0xc05de1){if(!_0xc05de1){_0xd7e725[_0x4b95('0x15')](0x194);}return _0xc05de1;};}function handleError(_0x2f0e83,_0x26e361){_0x26e361=_0x26e361||0x1f4;return function(_0xb490d7){logger['error'](_0xb490d7[_0x4b95('0x26')]);if(_0xb490d7['name']){delete _0xb490d7[_0x4b95('0x27')];}_0x2f0e83[_0x4b95('0x17')](_0x26e361)[_0x4b95('0x28')](_0xb490d7);};}exports[_0x4b95('0x29')]=function(_0x1bda1c,_0xd0b79a){var _0x51b297={},_0x3d761c={},_0x1ff74b={'count':0x0,'rows':[]};var _0xbb398a=_[_0x4b95('0x2a')](db[_0x4b95('0x2b')]['rawAttributes'],function(_0x44fe4f){return{'name':_0x44fe4f[_0x4b95('0x2c')],'type':_0x44fe4f['type'][_0x4b95('0x2d')]};});_0x3d761c[_0x4b95('0x2e')]=_[_0x4b95('0x2a')](_0xbb398a,_0x4b95('0x27'));_0x3d761c[_0x4b95('0x2f')]=_['keys'](_0x1bda1c[_0x4b95('0x2f')]);_0x3d761c['filters']=_[_0x4b95('0x30')](_0x3d761c[_0x4b95('0x2e')],_0x3d761c[_0x4b95('0x2f')]);_0x51b297['attributes']=_['intersection'](_0x3d761c[_0x4b95('0x2e')],qs[_0x4b95('0x31')](_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x31')]));_0x51b297[_0x4b95('0x32')]=_0x51b297[_0x4b95('0x32')][_0x4b95('0x33')]?_0x51b297['attributes']:_0x3d761c[_0x4b95('0x2e')];if(!_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x34')](_0x4b95('0x35'))){_0x51b297[_0x4b95('0x1b')]=qs[_0x4b95('0x1b')](_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x1b')]);_0x51b297[_0x4b95('0x1a')]=qs[_0x4b95('0x1a')](_0x1bda1c['query'][_0x4b95('0x1a')]);}_0x51b297['order']=qs['sort'](_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x36')]);_0x51b297[_0x4b95('0x37')]=qs[_0x4b95('0x38')](_[_0x4b95('0x39')](_0x1bda1c[_0x4b95('0x2f')],_0x3d761c[_0x4b95('0x38')]),_0xbb398a);if(_0x1bda1c[_0x4b95('0x2f')]['filter']){_0x51b297[_0x4b95('0x37')]=_[_0x4b95('0x3a')](_0x51b297[_0x4b95('0x37')],{'$or':_[_0x4b95('0x2a')](_0xbb398a,function(_0x22e9b9){if(_0x22e9b9[_0x4b95('0x3b')]!==_0x4b95('0x3c')){var _0x29053a={};_0x29053a[_0x22e9b9[_0x4b95('0x27')]]={'$like':'%'+_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x3d')]+'%'};return _0x29053a;}})});}_0x51b297=_['merge']({},_0x51b297,_0x1bda1c[_0x4b95('0x3e')]);var _0x3199dd={'where':_0x51b297[_0x4b95('0x37')]};return db[_0x4b95('0x2b')][_0x4b95('0x19')](_0x3199dd)[_0x4b95('0x21')](function(_0x4fb593){_0x1ff74b[_0x4b95('0x19')]=_0x4fb593;if(_0x1bda1c[_0x4b95('0x2f')][_0x4b95('0x3f')]){_0x51b297[_0x4b95('0x40')]=[{'all':!![]}];}return db[_0x4b95('0x2b')][_0x4b95('0x41')](_0x51b297);})[_0x4b95('0x21')](function(_0x59cc59){_0x1ff74b[_0x4b95('0x42')]=_0x59cc59;return _0x1ff74b;})['then'](respondWithFilteredResult(_0xd0b79a,_0x51b297))[_0x4b95('0x43')](handleError(_0xd0b79a,null));};exports[_0x4b95('0x44')]=function(_0x178d04,_0x3bf0ea){var _0x5499e6={'raw':![],'where':{'id':_0x178d04[_0x4b95('0x45')]['id']}},_0x3b6c13={};_0x3b6c13[_0x4b95('0x2e')]=_['keys'](db[_0x4b95('0x2b')][_0x4b95('0x46')]);_0x3b6c13[_0x4b95('0x2f')]=_[_0x4b95('0x47')](_0x178d04[_0x4b95('0x2f')]);_0x3b6c13[_0x4b95('0x38')]=_[_0x4b95('0x30')](_0x3b6c13[_0x4b95('0x2e')],_0x3b6c13[_0x4b95('0x2f')]);_0x5499e6['attributes']=_[_0x4b95('0x30')](_0x3b6c13[_0x4b95('0x2e')],qs[_0x4b95('0x31')](_0x178d04['query']['fields']));_0x5499e6[_0x4b95('0x32')]=_0x5499e6['attributes'][_0x4b95('0x33')]?_0x5499e6[_0x4b95('0x32')]:_0x3b6c13['model'];if(_0x178d04['query'][_0x4b95('0x3f')]){_0x5499e6[_0x4b95('0x40')]=[{'all':!![]}];}_0x5499e6=_[_0x4b95('0x3a')]({},_0x5499e6,_0x178d04[_0x4b95('0x3e')]);return db['VoiceMusicOnHold']['find'](_0x5499e6)[_0x4b95('0x21')](handleEntityNotFound(_0x3bf0ea,null))[_0x4b95('0x21')](respondWithResult(_0x3bf0ea,null))[_0x4b95('0x43')](handleError(_0x3bf0ea,null));};exports['update']=function(_0x4d7dd9,_0x4e05b0){if(_0x4d7dd9[_0x4b95('0x48')]['id']){delete _0x4d7dd9['body']['id'];}return db[_0x4b95('0x2b')][_0x4b95('0x49')]({'where':{'id':_0x4d7dd9[_0x4b95('0x45')]['id']}})[_0x4b95('0x21')](handleEntityNotFound(_0x4e05b0,null))[_0x4b95('0x21')](saveUpdates(_0x4d7dd9[_0x4b95('0x48')],null))[_0x4b95('0x21')](respondWithResult(_0x4e05b0,null))[_0x4b95('0x43')](handleError(_0x4e05b0,null));};exports[_0x4b95('0x4a')]=function(_0x572852,_0x237cb5,_0x47980d){return db[_0x4b95('0x4b')][_0x4b95('0x4c')](function(_0xca5dcf){if(_0x572852['body'][_0x4b95('0x4d')]===_0x4b95('0x4e')){_0x572852[_0x4b95('0x48')]['directory']=path[_0x4b95('0x4f')](config['root'],_0x4b95('0x50'),_0x572852['body'][_0x4b95('0x27')]);}return db['VoiceMusicOnHold'][_0x4b95('0x4a')](_0x572852[_0x4b95('0x48')],{'transaction':_0xca5dcf})[_0x4b95('0x21')](function(_0x35f95b){if(_0x572852[_0x4b95('0x48')][_0x4b95('0x4d')]===_0x4b95('0x4e')){fs[_0x4b95('0x51')](_0x35f95b[_0x4b95('0x52')],parseInt(_0x4b95('0x53'),0x8));}var _0x17613f=_0x572852[_0x4b95('0x54')]['get']({'plain':!![]});if(!_0x17613f)throw new Error(_0x4b95('0x55'));if(_0x17613f['role']===_0x4b95('0x54')){var _0x442826=_0x35f95b[_0x4b95('0x22')]({'plain':!![]});return db[_0x4b95('0x56')][_0x4b95('0x49')]({'where':{'name':'MusicOnHolds','userProfileId':_0x17613f[_0x4b95('0x57')]},'raw':!![]})[_0x4b95('0x21')](function(_0x5d2550){if(_0x5d2550&&_0x5d2550[_0x4b95('0x58')]===0x0){return db[_0x4b95('0x24')]['create']({'name':_0x442826[_0x4b95('0x27')],'resourceId':_0x442826['id'],'type':_0x5d2550[_0x4b95('0x27')],'sectionId':_0x5d2550['id']},{})[_0x4b95('0x21')](function(){return _0x35f95b;});}else{return _0x35f95b;}})[_0x4b95('0x43')](function(_0x5996ea){logger[_0x4b95('0x59')](_0x4b95('0x5a'),_0x5996ea);});}return _0x35f95b;});})[_0x4b95('0x21')](respondWithResult(_0x237cb5,0xc9))['catch'](handleError(_0x237cb5,null));};exports['destroy']=function(_0x1fe230,_0x4ce165,_0x58257e){var _0x42f09d;return db['VoiceMusicOnHold'][_0x4b95('0x49')]({'where':{'id':_0x1fe230[_0x4b95('0x45')]['id']}})[_0x4b95('0x21')](function(_0x4502f6){if(_0x4502f6){return db['sequelize'][_0x4b95('0x4c')](function(_0x483ad3){return _0x4502f6[_0x4b95('0x25')]({'transaction':_0x483ad3,'raw':!![]})[_0x4b95('0x21')](function(_0x1843a5){if(_0x1843a5[_0x4b95('0x52')]){fs[_0x4b95('0x5b')](_0x1843a5[_0x4b95('0x52')])[_0x4b95('0x5c')](function(_0x5d8a1f){fs['unlinkSync'](path[_0x4b95('0x4f')](_0x1843a5[_0x4b95('0x52')],_0x5d8a1f));});fs[_0x4b95('0x5d')](_0x1843a5[_0x4b95('0x52')]);}return _0x1843a5;});})[_0x4b95('0x43')](function(_0x8e058c){throw new db[(_0x4b95('0x5e'))][(_0x4b95('0x5f'))](_0x8e058c[_0x4b95('0x60')]);});}})['then'](handleEntityNotFound(_0x4ce165,null))[_0x4b95('0x21')](removeEntity(_0x4ce165,null))['catch'](handleError(_0x4ce165,null));};exports[_0x4b95('0x61')]=function(_0x31787d,_0x26d6bf,_0x6e59db){return db[_0x4b95('0x4b')][_0x4b95('0x4c')](function(_0x3665c9){var _0xbef149;return db[_0x4b95('0x2b')][_0x4b95('0x49')]({'where':{'id':_0x31787d[_0x4b95('0x45')]['id']}})[_0x4b95('0x21')](function(_0x180f11){if(_0x180f11){_0xbef149=_0x180f11;return _0x180f11[_0x4b95('0x61')](_0x31787d[_0x4b95('0x48')]['id'],{'transaction':_0x3665c9});}})[_0x4b95('0x21')](function(_0x24bafd){if(_0x24bafd){return db[_0x4b95('0x62')][_0x4b95('0x63')]({'where':{'id':_0x31787d[_0x4b95('0x48')]['id']},'attributes':['id',_0x4b95('0x27'),_0x4b95('0x64'),_0x4b95('0x65'),_0x4b95('0x66')],'raw':!![]});}})[_0x4b95('0x21')](function(_0x166a7a){if(_0x166a7a){var _0x429627=path['join'](config[_0x4b95('0x67')],_0x4b95('0x68'),util[_0x4b95('0x69')](_0x4b95('0x6a'),path[_0x4b95('0x6b')](_0x166a7a['save_name'],path[_0x4b95('0x6c')](_0x166a7a[_0x4b95('0x64')])),_0x166a7a[_0x4b95('0x65')]));var _0x3a5539=path[_0x4b95('0x4f')](config[_0x4b95('0x67')],'server/files/moh',_0xbef149['name'],util[_0x4b95('0x69')](_0x4b95('0x6a'),_0x166a7a[_0x4b95('0x27')],_0x166a7a[_0x4b95('0x65')]));fs[_0x4b95('0x6d')](_0x429627,_0x3a5539);return _0x166a7a;}})['catch'](function(_0x3a62d3){throw new db['Sequelize'][(_0x4b95('0x5f'))](_0x3a62d3[_0x4b95('0x60')]);});})[_0x4b95('0x21')](handleEntityNotFound(_0x26d6bf,null))[_0x4b95('0x21')](respondWithResult(_0x26d6bf,0xc9))[_0x4b95('0x43')](handleError(_0x26d6bf,null));};exports[_0x4b95('0x6e')]=function(_0x593012,_0x1b9c42,_0x5953f5){return db['sequelize'][_0x4b95('0x4c')](function(_0x35e639){var _0x73bca2;return db[_0x4b95('0x2b')][_0x4b95('0x63')]({'where':{'id':_0x593012['params']['id']}})['then'](handleEntityNotFound(_0x1b9c42,null))[_0x4b95('0x21')](function(_0x474398){if(_0x474398){_0x73bca2=_0x474398;return _0x474398[_0x4b95('0x6e')](_0x593012[_0x4b95('0x45')]['id2']);}})['then'](function(_0x2593ff){if(_0x2593ff){return db['Sound'][_0x4b95('0x63')]({'where':{'id':_0x593012[_0x4b95('0x45')][_0x4b95('0x6f')]},'attributes':['id',_0x4b95('0x27'),_0x4b95('0x64'),_0x4b95('0x65'),_0x4b95('0x66')],'raw':!![]});}})[_0x4b95('0x21')](function(_0x559e1d){if(_0x559e1d){fs[_0x4b95('0x70')](path['join'](_0x73bca2[_0x4b95('0x52')],util[_0x4b95('0x69')]('%s.%s',_0x559e1d['name'],_0x559e1d[_0x4b95('0x65')])));return _0x559e1d;}})[_0x4b95('0x43')](function(_0x3dedc6){throw new db[(_0x4b95('0x5e'))]['ValidationError'](_0x3dedc6[_0x4b95('0x60')]);});})['then'](handleEntityNotFound(_0x1b9c42,null))[_0x4b95('0x21')](respondWithStatusCode(_0x1b9c42,0xcc))[_0x4b95('0x43')](handleError(_0x1b9c42,null));};exports[_0x4b95('0x71')]=function(_0xdbb0f1,_0x118674,_0x47d92c){var _0x17420f={};var _0xd1eb1c={};var _0x4b58ba;var _0x11fda8;return db[_0x4b95('0x2b')][_0x4b95('0x63')]({'where':{'id':_0xdbb0f1['params']['id']}})['then'](handleEntityNotFound(_0x118674,null))['then'](function(_0x5ebfee){if(_0x5ebfee){_0x4b58ba=_0x5ebfee;_0xd1eb1c[_0x4b95('0x2e')]=_[_0x4b95('0x47')](db[_0x4b95('0x62')]['rawAttributes']);_0xd1eb1c[_0x4b95('0x2f')]=_[_0x4b95('0x47')](_0xdbb0f1[_0x4b95('0x2f')]);_0xd1eb1c[_0x4b95('0x38')]=_[_0x4b95('0x30')](_0xd1eb1c[_0x4b95('0x2e')],_0xd1eb1c['query']);_0x17420f[_0x4b95('0x32')]=_[_0x4b95('0x30')](_0xd1eb1c[_0x4b95('0x2e')],qs[_0x4b95('0x31')](_0xdbb0f1[_0x4b95('0x2f')][_0x4b95('0x31')]));_0x17420f[_0x4b95('0x32')]=_0x17420f[_0x4b95('0x32')][_0x4b95('0x33')]?_0x17420f[_0x4b95('0x32')]:_0xd1eb1c[_0x4b95('0x2e')];_0x17420f['order']=qs[_0x4b95('0x36')](_0xdbb0f1['query']['sort']);_0x17420f[_0x4b95('0x37')]=qs[_0x4b95('0x38')](_[_0x4b95('0x39')](_0xdbb0f1[_0x4b95('0x2f')],_0xd1eb1c[_0x4b95('0x38')]));if(_0xdbb0f1[_0x4b95('0x2f')]['filter']){_0x17420f[_0x4b95('0x37')]=_['merge'](_0x17420f[_0x4b95('0x37')],{'$or':_[_0x4b95('0x2a')](_0x17420f['attributes'],function(_0x3b197c){var _0x4c1d05={};_0x4c1d05[_0x3b197c]={'$like':'%'+_0xdbb0f1['query'][_0x4b95('0x3d')]+'%'};return _0x4c1d05;})});}_0x17420f=_[_0x4b95('0x3a')]({},_0x17420f,_0xdbb0f1[_0x4b95('0x3e')]);return _0x4b58ba[_0x4b95('0x71')](_0x17420f);}})['then'](function(_0x33fc33){if(_0x33fc33){_0x11fda8=_0x33fc33[_0x4b95('0x33')];if(!_0xdbb0f1[_0x4b95('0x2f')]['hasOwnProperty']('nolimit')){_0x17420f['limit']=qs[_0x4b95('0x1b')](_0xdbb0f1['query'][_0x4b95('0x1b')]);_0x17420f[_0x4b95('0x1a')]=qs[_0x4b95('0x1a')](_0xdbb0f1['query']['offset']);}return _0x4b58ba[_0x4b95('0x71')](_0x17420f);}})['then'](function(_0x2a6047){if(_0x2a6047){return _0x2a6047?{'count':_0x11fda8,'rows':_0x2a6047}:null;}})[_0x4b95('0x21')](respondWithResult(_0x118674,null))[_0x4b95('0x43')](handleError(_0x118674,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 732db43..fb88fa1 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 _0x2a22=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','api','moment','path'];(function(_0x5e7f7c,_0x137dca){var _0x1592bb=function(_0x5752ab){while(--_0x5752ab){_0x5e7f7c['push'](_0x5e7f7c['shift']());}};_0x1592bb(++_0x137dca);}(_0x2a22,0xa0));var _0x22a2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2a22[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x22a2('0x0'));var util=require(_0x22a2('0x1'));var logger=require('../../config/logger')(_0x22a2('0x2'));var moment=require(_0x22a2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22a2('0x4'));var rimraf=require(_0x22a2('0x5'));var config=require(_0x22a2('0x6'));var attributes=require(_0x22a2('0x7'));module[_0x22a2('0x8')]=function(_0x848598,_0x1159d3){return _0x848598[_0x22a2('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x22a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c72=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x31b3fd,_0x45e185){var _0x1dbb64=function(_0x56fe9b){while(--_0x56fe9b){_0x31b3fd['push'](_0x31b3fd['shift']());}};_0x1dbb64(++_0x45e185);}(_0x7c72,0x1b0));var _0x27c7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x7c72[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x27c7('0x0'));var util=require(_0x27c7('0x1'));var logger=require(_0x27c7('0x2'))('api');var moment=require(_0x27c7('0x3'));var BPromise=require(_0x27c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27c7('0x5'));var rimraf=require(_0x27c7('0x6'));var config=require(_0x27c7('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x27c7('0x8')]=function(_0x238810,_0x539496){return _0x238810[_0x27c7('0x9')](_0x27c7('0xa'),attributes,{'tableName':_0x27c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 7c38b2d..f5a14f2 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 _0x5c5b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5c5b,0x1bd));var _0xb5c5=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x5c5b[_0x369a98];return _0x29565c;};'use strict';var _=require(_0xb5c5('0x0'));var util=require(_0xb5c5('0x1'));var moment=require(_0xb5c5('0x2'));var BPromise=require(_0xb5c5('0x3'));var rs=require(_0xb5c5('0x4'));var fs=require('fs');var Redis=require(_0xb5c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5c5('0x6'));var logger=require(_0xb5c5('0x7'))(_0xb5c5('0x8'));var config=require(_0xb5c5('0x9'));var jayson=require(_0xb5c5('0xa'));var client=jayson['client'][_0xb5c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47a879,_0x274cae,_0x22f9a9){return new BPromise(function(_0x164e37,_0x5c67d2){return client[_0xb5c5('0xc')](_0x47a879,_0x22f9a9)[_0xb5c5('0xd')](function(_0x410a99){logger[_0xb5c5('0xe')](_0xb5c5('0xf'),_0x274cae,_0xb5c5('0x10'));logger[_0xb5c5('0x11')](_0xb5c5('0x12'),_0x274cae,_0xb5c5('0x10'),JSON[_0xb5c5('0x13')](_0x410a99));if(_0x410a99[_0xb5c5('0x14')]){if(_0x410a99[_0xb5c5('0x14')][_0xb5c5('0x15')]===0x1f4){logger['error'](_0xb5c5('0xf'),_0x274cae,_0x410a99[_0xb5c5('0x14')][_0xb5c5('0x16')]);return _0x5c67d2(_0x410a99[_0xb5c5('0x14')][_0xb5c5('0x16')]);}logger[_0xb5c5('0x14')](_0xb5c5('0xf'),_0x274cae,_0x410a99[_0xb5c5('0x14')]['message']);return _0x164e37(_0x410a99[_0xb5c5('0x14')]['message']);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x274cae,_0xb5c5('0x10'));_0x164e37(_0x410a99[_0xb5c5('0x17')]['message']);}})[_0xb5c5('0x18')](function(_0x22423c){logger[_0xb5c5('0x14')](_0xb5c5('0xf'),_0x274cae,_0x22423c);_0x5c67d2(_0x22423c);});});} \ No newline at end of file +var _0xa165=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0xa08526,_0xd2a376){var _0x2684eb=function(_0x2bfe3a){while(--_0x2bfe3a){_0xa08526['push'](_0xa08526['shift']());}};_0x2684eb(++_0xd2a376);}(_0xa165,0x1d0));var _0x5a16=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa165[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x5a16('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5a16('0x1'));var rs=require(_0x5a16('0x2'));var fs=require('fs');var Redis=require(_0x5a16('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a16('0x4'));var logger=require('../../config/logger')(_0x5a16('0x5'));var config=require(_0x5a16('0x6'));var jayson=require(_0x5a16('0x7'));var client=jayson[_0x5a16('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f3a9,_0x5fbdf6,_0x7066){return new BPromise(function(_0xea6c2a,_0xc611d5){return client[_0x5a16('0x9')](_0x20f3a9,_0x7066)['then'](function(_0x2ca937){logger[_0x5a16('0xa')](_0x5a16('0xb'),_0x5fbdf6,_0x5a16('0xc'));logger[_0x5a16('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5fbdf6,_0x5a16('0xc'),JSON['stringify'](_0x2ca937));if(_0x2ca937[_0x5a16('0xe')]){if(_0x2ca937[_0x5a16('0xe')]['code']===0x1f4){logger[_0x5a16('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5fbdf6,_0x2ca937[_0x5a16('0xe')][_0x5a16('0xf')]);return _0xc611d5(_0x2ca937[_0x5a16('0xe')][_0x5a16('0xf')]);}logger[_0x5a16('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5fbdf6,_0x2ca937[_0x5a16('0xe')][_0x5a16('0xf')]);return _0xea6c2a(_0x2ca937['error']['message']);}else{logger[_0x5a16('0xa')](_0x5a16('0xb'),_0x5fbdf6,_0x5a16('0xc'));_0xea6c2a(_0x2ca937[_0x5a16('0x10')][_0x5a16('0xf')]);}})[_0x5a16('0x11')](function(_0x119991){logger[_0x5a16('0xe')](_0x5a16('0xb'),_0x5fbdf6,_0x119991);_0xc611d5(_0x119991);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 6edc275..b6af9b0 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 _0x6076=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','create','addAgents','update','delete','destroy','removeAgents','exports','multer','express','Router','../../components/auth/service'];(function(_0x3995dd,_0x24f96f){var _0x410f8a=function(_0xe2c273){while(--_0xe2c273){_0x3995dd['push'](_0x3995dd['shift']());}};_0x410f8a(++_0x24f96f);}(_0x6076,0x86));var _0x6607=function(_0x3e4add,_0x572450){_0x3e4add=_0x3e4add-0x0;var _0x3776d5=_0x6076[_0x3e4add];return _0x3776d5;};'use strict';var multer=require(_0x6607('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6607('0x1'));var router=express[_0x6607('0x2')]();var auth=require(_0x6607('0x3'));var interaction=require(_0x6607('0x4'));var config=require(_0x6607('0x5'));var controller=require(_0x6607('0x6'));router[_0x6607('0x7')]('/',auth[_0x6607('0x8')](),controller[_0x6607('0x9')]);router['get'](_0x6607('0xa'),auth[_0x6607('0x8')](),controller[_0x6607('0xb')]);router['get'](_0x6607('0xc'),auth[_0x6607('0x8')](),controller[_0x6607('0xd')]);router[_0x6607('0x7')](_0x6607('0xe'),auth[_0x6607('0x8')](),controller[_0x6607('0xf')]);router['post']('/',auth[_0x6607('0x8')](),controller[_0x6607('0x10')]);router['post'](_0x6607('0xe'),auth[_0x6607('0x8')](),controller[_0x6607('0x11')]);router['put'](_0x6607('0xc'),auth[_0x6607('0x8')](),controller[_0x6607('0x12')]);router[_0x6607('0x13')](_0x6607('0xc'),auth[_0x6607('0x8')](),controller[_0x6607('0x14')]);router['delete'](_0x6607('0xe'),auth[_0x6607('0x8')](),controller[_0x6607('0x15')]);module[_0x6607('0x16')]=router; \ No newline at end of file +var _0x7c5b=['show','/:id/users','post','create','put','/:id','update','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x72369d,_0x3da34c){var _0x62defb=function(_0x3843ec){while(--_0x3843ec){_0x72369d['push'](_0x72369d['shift']());}};_0x62defb(++_0x3da34c);}(_0x7c5b,0x11e));var _0xb7c5=function(_0x3d43ba,_0x5057c9){_0x3d43ba=_0x3d43ba-0x0;var _0x5ef9d2=_0x7c5b[_0x3d43ba];return _0x5ef9d2;};'use strict';var multer=require(_0xb7c5('0x0'));var util=require(_0xb7c5('0x1'));var path=require(_0xb7c5('0x2'));var timeout=require(_0xb7c5('0x3'));var express=require(_0xb7c5('0x4'));var router=express[_0xb7c5('0x5')]();var auth=require(_0xb7c5('0x6'));var interaction=require(_0xb7c5('0x7'));var config=require(_0xb7c5('0x8'));var controller=require('./voicePrefix.controller');router[_0xb7c5('0x9')]('/',auth[_0xb7c5('0xa')](),controller[_0xb7c5('0xb')]);router[_0xb7c5('0x9')]('/describe',auth[_0xb7c5('0xa')](),controller[_0xb7c5('0xc')]);router[_0xb7c5('0x9')]('/:id',auth[_0xb7c5('0xa')](),controller[_0xb7c5('0xd')]);router['get'](_0xb7c5('0xe'),auth[_0xb7c5('0xa')](),controller['getAgents']);router[_0xb7c5('0xf')]('/',auth[_0xb7c5('0xa')](),controller[_0xb7c5('0x10')]);router[_0xb7c5('0xf')](_0xb7c5('0xe'),auth[_0xb7c5('0xa')](),controller['addAgents']);router[_0xb7c5('0x11')](_0xb7c5('0x12'),auth[_0xb7c5('0xa')](),controller[_0xb7c5('0x13')]);router['delete']('/:id',auth[_0xb7c5('0xa')](),controller[_0xb7c5('0x14')]);router['delete'](_0xb7c5('0xe'),auth[_0xb7c5('0xa')](),controller[_0xb7c5('0x15')]);module[_0xb7c5('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 b5e8f6d..9cccc9f 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 _0xde2f=['exports','STRING','name','system-','getDataValue','INTEGER','sequelize'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xde2f,0xb5));var _0xfde2=function(_0x2b70be,_0x4a7536){_0x2b70be=_0x2b70be-0x0;var _0x425325=_0xde2f[_0x2b70be];return _0x425325;};'use strict';var Sequelize=require(_0xfde2('0x0'));module[_0xfde2('0x1')]={'name':{'type':Sequelize[_0xfde2('0x2')],'allowNull':![],'unique':_0xfde2('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3c843c){return _0xfde2('0x4')+this[_0xfde2('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xfde2('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xfde2('0x6')]}}; \ No newline at end of file +var _0x6511=['VIRTUAL','getDataValue','STRING','INTEGER','sequelize','name'];(function(_0x503ffc,_0x38c59b){var _0x4c4a56=function(_0x5acaad){while(--_0x5acaad){_0x503ffc['push'](_0x503ffc['shift']());}};_0x4c4a56(++_0x38c59b);}(_0x6511,0x160));var _0x1651=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0x6511[_0xb47dc0];return _0x57f0b0;};'use strict';var Sequelize=require(_0x1651('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1651('0x1')},'prefix':{'type':Sequelize[_0x1651('0x2')],'get':function(_0x439136){return'system-'+this[_0x1651('0x3')](_0x1651('0x1'))+'-';}},'description':{'type':Sequelize[_0x1651('0x4')]},'callerIdAll':{'type':Sequelize[_0x1651('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x1651('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1440a71..b2e16af 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 _0x8277=['get','VoicePrefixes','error','stack','name','send','index','VoicePrefix','rawAttributes','type','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','describe','create','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','Voice\x20Prefix','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','goto','${EXTEN:','charAt','body','sequelize','findById','addAgents','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','order','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x816ff6,_0x65b33f){var _0x4bd7d3=function(_0x12586b){while(--_0x12586b){_0x816ff6['push'](_0x816ff6['shift']());}};_0x4bd7d3(++_0x65b33f);}(_0x8277,0xcf));var _0x7827=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0x8277[_0x1c06f4];return _0x1a727e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7827('0x0'));var rimraf=require(_0x7827('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7827('0x2'));var rp=require(_0x7827('0x3'));var moment=require('moment');var BPromise=require(_0x7827('0x4'));var Mustache=require(_0x7827('0x5'));var util=require('util');var path=require(_0x7827('0x6'));var sox=require(_0x7827('0x7'));var csv=require(_0x7827('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7827('0x9'));var squel=require(_0x7827('0xa'));var crypto=require(_0x7827('0xb'));var jsforce=require(_0x7827('0xc'));var deskjs=require(_0x7827('0xd'));var toCsv=require(_0x7827('0x8'));var querystring=require(_0x7827('0xe'));var Papa=require(_0x7827('0xf'));var Redis=require(_0x7827('0x10'));var authService=require(_0x7827('0x11'));var qs=require(_0x7827('0x12'));var as=require(_0x7827('0x13'));var hardwareService=require(_0x7827('0x14'));var logger=require(_0x7827('0x15'))('api');var utils=require(_0x7827('0x16'));var config=require(_0x7827('0x17'));var licenseUtil=require(_0x7827('0x18'));var db=require(_0x7827('0x19'))['db'];config['redis']=_[_0x7827('0x1a')](config[_0x7827('0x1b')],{'host':_0x7827('0x1c'),'port':0x18eb});var socket=require(_0x7827('0x1d'))(new Redis(config[_0x7827('0x1b')]));require(_0x7827('0x1e'))[_0x7827('0x1f')](socket);function respondWithStatusCode(_0x453f04,_0xe28b8f){_0xe28b8f=_0xe28b8f||0xcc;return function(_0x32104a){if(_0x32104a){return _0x453f04[_0x7827('0x20')](_0xe28b8f);}return _0x453f04[_0x7827('0x21')](_0xe28b8f)[_0x7827('0x22')]();};}function respondWithResult(_0x85c389,_0x2055f6){_0x2055f6=_0x2055f6||0xc8;return function(_0x5143e4){if(_0x5143e4){return _0x85c389[_0x7827('0x21')](_0x2055f6)[_0x7827('0x23')](_0x5143e4);}};}function respondWithFilteredResult(_0x19be26,_0x104371){return function(_0x34a6b2){if(_0x34a6b2){var _0x2e001d=_0x34a6b2[_0x7827('0x24')],_0x18ca8f=_0x104371[_0x7827('0x25')],_0x1e5b9e=_0x104371[_0x7827('0x25')]+_0x104371[_0x7827('0x26')],_0x4f6500;if(_0x1e5b9e>=_0x2e001d){_0x1e5b9e=_0x2e001d;_0x4f6500=0xc8;}else{_0x4f6500=0xce;}_0x19be26[_0x7827('0x21')](_0x4f6500);return _0x19be26[_0x7827('0x27')](_0x7827('0x28'),_0x18ca8f+'-'+_0x1e5b9e+'/'+_0x2e001d)['json'](_0x34a6b2);}return null;};}function patchUpdates(_0x3ace2b){return function(_0x4a1dd1){try{jsonpatch[_0x7827('0x29')](_0x4a1dd1,_0x3ace2b,!![]);}catch(_0x1b7ef7){return BPromise[_0x7827('0x2a')](_0x1b7ef7);}return _0x4a1dd1[_0x7827('0x2b')]();};}function saveUpdates(_0x589d37,_0x8009e4){return function(_0x1459d9){if(_0x1459d9){return _0x1459d9[_0x7827('0x2c')](_0x589d37)['then'](function(_0x18dbc3){return _0x18dbc3;});}return null;};}function removeEntity(_0x55a4d4,_0x19e2ae){return function(_0x5e2f92){if(_0x5e2f92){return _0x5e2f92[_0x7827('0x2d')]()[_0x7827('0x2e')](function(){var _0x2745e4=_0x5e2f92[_0x7827('0x2f')]({'plain':!![]});var _0x4d1c18=_0x7827('0x30');return db['UserProfileResource'][_0x7827('0x2d')]({'where':{'type':_0x4d1c18,'resourceId':_0x2745e4['id']}})[_0x7827('0x2e')](function(){return _0x5e2f92;});})[_0x7827('0x2e')](function(){_0x55a4d4[_0x7827('0x21')](0xcc)[_0x7827('0x22')]();});}};}function handleEntityNotFound(_0x1dd67f,_0x32ba3c){return function(_0x3e90ef){if(!_0x3e90ef){_0x1dd67f[_0x7827('0x20')](0x194);}return _0x3e90ef;};}function handleError(_0x4b25ba,_0x21b502){_0x21b502=_0x21b502||0x1f4;return function(_0x301b31){logger[_0x7827('0x31')](_0x301b31[_0x7827('0x32')]);if(_0x301b31[_0x7827('0x33')]){delete _0x301b31[_0x7827('0x33')];}_0x4b25ba[_0x7827('0x21')](_0x21b502)[_0x7827('0x34')](_0x301b31);};}exports[_0x7827('0x35')]=function(_0x49cc2a,_0x516706){var _0xd88452={},_0x589d52={},_0x3a3078={'count':0x0,'rows':[]};var _0xc5768d=_['map'](db[_0x7827('0x36')][_0x7827('0x37')],function(_0x2ef72d){return{'name':_0x2ef72d['fieldName'],'type':_0x2ef72d[_0x7827('0x38')]['key']};});_0x589d52[_0x7827('0x39')]=_[_0x7827('0x3a')](_0xc5768d,'name');_0x589d52[_0x7827('0x3b')]=_['keys'](_0x49cc2a[_0x7827('0x3b')]);_0x589d52['filters']=_[_0x7827('0x3c')](_0x589d52[_0x7827('0x39')],_0x589d52[_0x7827('0x3b')]);_0xd88452[_0x7827('0x3d')]=_[_0x7827('0x3c')](_0x589d52['model'],qs['fields'](_0x49cc2a[_0x7827('0x3b')]['fields']));_0xd88452[_0x7827('0x3d')]=_0xd88452['attributes'][_0x7827('0x3e')]?_0xd88452[_0x7827('0x3d')]:_0x589d52['model'];if(!_0x49cc2a[_0x7827('0x3b')][_0x7827('0x3f')](_0x7827('0x40'))){_0xd88452['limit']=qs[_0x7827('0x26')](_0x49cc2a[_0x7827('0x3b')][_0x7827('0x26')]);_0xd88452[_0x7827('0x25')]=qs[_0x7827('0x25')](_0x49cc2a['query'][_0x7827('0x25')]);}_0xd88452['order']=qs[_0x7827('0x41')](_0x49cc2a[_0x7827('0x3b')][_0x7827('0x41')]);_0xd88452['where']=qs[_0x7827('0x42')](_[_0x7827('0x43')](_0x49cc2a[_0x7827('0x3b')],_0x589d52[_0x7827('0x42')]),_0xc5768d);if(_0x49cc2a['query'][_0x7827('0x44')]){_0xd88452[_0x7827('0x45')]=_[_0x7827('0x46')](_0xd88452['where'],{'$or':_['map'](_0xc5768d,function(_0x20a38d){if(_0x20a38d[_0x7827('0x38')]!=='VIRTUAL'){var _0x3bb84a={};_0x3bb84a[_0x20a38d['name']]={'$like':'%'+_0x49cc2a['query'][_0x7827('0x44')]+'%'};return _0x3bb84a;}})});}_0xd88452=_[_0x7827('0x46')]({},_0xd88452,_0x49cc2a[_0x7827('0x47')]);var _0x398120={'where':_0xd88452['where']};return db[_0x7827('0x36')][_0x7827('0x24')](_0x398120)[_0x7827('0x2e')](function(_0x1e4a66){_0x3a3078[_0x7827('0x24')]=_0x1e4a66;if(_0x49cc2a[_0x7827('0x3b')][_0x7827('0x48')]){_0xd88452[_0x7827('0x49')]=[{'all':!![]}];}return db['VoicePrefix'][_0x7827('0x4a')](_0xd88452);})['then'](function(_0x3661be){_0x3a3078[_0x7827('0x4b')]=_0x3661be;return _0x3a3078;})[_0x7827('0x2e')](respondWithFilteredResult(_0x516706,_0xd88452))[_0x7827('0x4c')](handleError(_0x516706,null));};exports[_0x7827('0x4d')]=function(_0x64f61d,_0x2b0f82){var _0x320e91={'raw':![],'where':{'id':_0x64f61d[_0x7827('0x4e')]['id']}},_0xa7aa13={};_0xa7aa13[_0x7827('0x39')]=_[_0x7827('0x4f')](db[_0x7827('0x36')][_0x7827('0x37')]);_0xa7aa13[_0x7827('0x3b')]=_[_0x7827('0x4f')](_0x64f61d[_0x7827('0x3b')]);_0xa7aa13[_0x7827('0x42')]=_[_0x7827('0x3c')](_0xa7aa13['model'],_0xa7aa13['query']);_0x320e91[_0x7827('0x3d')]=_['intersection'](_0xa7aa13[_0x7827('0x39')],qs[_0x7827('0x50')](_0x64f61d[_0x7827('0x3b')]['fields']));_0x320e91[_0x7827('0x3d')]=_0x320e91[_0x7827('0x3d')][_0x7827('0x3e')]?_0x320e91[_0x7827('0x3d')]:_0xa7aa13[_0x7827('0x39')];if(_0x64f61d[_0x7827('0x3b')][_0x7827('0x48')]){_0x320e91[_0x7827('0x49')]=[{'all':!![]}];}_0x320e91=_[_0x7827('0x46')]({},_0x320e91,_0x64f61d['options']);return db[_0x7827('0x36')][_0x7827('0x51')](_0x320e91)[_0x7827('0x2e')](handleEntityNotFound(_0x2b0f82,null))[_0x7827('0x2e')](respondWithResult(_0x2b0f82,null))[_0x7827('0x4c')](handleError(_0x2b0f82,null));};exports[_0x7827('0x2d')]=function(_0x1e73f7,_0x4afa51){return db[_0x7827('0x36')][_0x7827('0x51')]({'where':{'id':_0x1e73f7[_0x7827('0x4e')]['id']}})[_0x7827('0x2e')](handleEntityNotFound(_0x4afa51,null))[_0x7827('0x2e')](removeEntity(_0x4afa51,null))[_0x7827('0x4c')](handleError(_0x4afa51,null));};exports[_0x7827('0x52')]=function(_0x48ef30,_0x4c133c){return db['VoicePrefix'][_0x7827('0x52')]()[_0x7827('0x2e')](respondWithResult(_0x4c133c,null))['catch'](handleError(_0x4c133c,null));};exports[_0x7827('0x53')]=function(_0x5344c2,_0x5906ca){var _0xf40d70;return db['sequelize'][_0x7827('0x54')](function(_0x52aa85){return db[_0x7827('0x36')][_0x7827('0x53')](_0x5344c2['body'],{'transaction':_0x52aa85})[_0x7827('0x2e')](function(_0x12e1ec){_0xf40d70=_0x12e1ec[_0x7827('0x2f')]({'plain':!![]});return db[_0x7827('0x55')][_0x7827('0x51')]({'where':{'id':_0xf40d70[_0x7827('0x56')]},'raw':!![]})[_0x7827('0x2e')](function(_0x74cf13){return createVoicePrefixExtensions(_0xf40d70,_0x74cf13,_0x52aa85);});});})[_0x7827('0x2e')](function(){var _0x549ae9=_0x5344c2[_0x7827('0x57')]['get']({'plain':!![]});if(!_0x549ae9)throw new Error(_0x7827('0x58'));if(_0x549ae9[_0x7827('0x59')]==='user'){var _0x589d91=_0xf40d70;return db['UserProfileSection']['find']({'where':{'name':_0x7827('0x30'),'userProfileId':_0x549ae9[_0x7827('0x5a')]},'raw':!![]})[_0x7827('0x2e')](function(_0x2f480f){if(_0x2f480f&&_0x2f480f[_0x7827('0x5b')]===0x0){return db[_0x7827('0x5c')][_0x7827('0x53')]({'name':_0x589d91[_0x7827('0x33')],'resourceId':_0x589d91['id'],'type':_0x2f480f[_0x7827('0x33')],'sectionId':_0x2f480f['id']},{})[_0x7827('0x2e')](function(){return _0xf40d70;});}else{return _0xf40d70;}})[_0x7827('0x4c')](function(_0x44f36e){logger[_0x7827('0x31')](_0x7827('0x5d'),_0x44f36e);throw _0x44f36e;});}return _0xf40d70;})[_0x7827('0x2e')](respondWithResult(_0x5906ca,null))[_0x7827('0x4c')](handleError(_0x5906ca,null));};function Extension(_0x4f2974,_0x209e28,_0x1e815e,_0x44ece1){this[_0x7827('0x5e')]=_0x7827('0x5f');this[_0x7827('0x60')]=_0x4f2974;this[_0x7827('0x61')]=_0x1e815e;this['type']='system';this[_0x7827('0x62')]=_0x7827('0x63');this['priority']=_0x209e28;this[_0x7827('0x64')]=_0x44ece1;}function createVoicePrefixExtensions(_0x23c0a2,_0x2f4425,_0x736142){return new BPromise(function(_0x338ea8,_0xa34291){var _0x4e5285=new Extension(formatPrefixName(_0x23c0a2['prefix']),0x1,'NoOp',_0x7827('0x65'));_0x4e5285['VoicePrefixId']=_0x23c0a2['id'];return db['VoiceExtension'][_0x7827('0x53')](_0x4e5285,{'transaction':_0x736142})[_0x7827('0x2e')](function(_0x37835c){var _0x525e14=_0x37835c[_0x7827('0x2f')]({'plain':!![]});var _0x4d2715=_[_0x7827('0x3a')](addVoicePrefixExtensions(_0x23c0a2,_0x2f4425),function(_0x523f79){_0x523f79[_0x7827('0x56')]=_0x525e14['id'];_0x523f79['VoicePrefixId']=_0x23c0a2['id'];return _0x523f79;});return db[_0x7827('0x55')][_0x7827('0x66')](_0x4d2715,{'transaction':_0x736142})[_0x7827('0x2e')](function(_0x2b626c){if(!_0x2b626c){return _0xa34291(_0x7827('0x67'));}else{return _0x338ea8(_0x2b626c);}})[_0x7827('0x4c')](function(_0x36d089){return _0xa34291(_0x36d089);});});;});};function addVoicePrefixExtensions(_0x9700e8,_0x13603b){var _0x5af1bf=[];var _0x50697d=formatPrefixName(_0x9700e8[_0x7827('0x68')]);_0x5af1bf[_0x7827('0x69')](new Extension(_0x50697d,0x2,_0x7827('0x6a'),_0x7827('0x6b')+_0x9700e8[_0x7827('0x33')]));if(_0x9700e8[_0x7827('0x6c')]){_0x5af1bf[_0x7827('0x69')](new Extension(_0x50697d,0x3,_0x7827('0x6a'),_0x7827('0x6d')+_0x9700e8[_0x7827('0x6c')]));}else{_0x5af1bf[_0x7827('0x69')](new Extension(_0x50697d,0x3,_0x7827('0x6e'),'No\x20callerid\x20available'));}_0x5af1bf[_0x7827('0x69')](new Extension(_0x50697d,0x4,_0x7827('0x6f'),_0x13603b[_0x7827('0x5e')]+','+_0x7827('0x70')+(0x8+_0x9700e8[_0x7827('0x33')][_0x7827('0x3e')])+'}'+','+0x1));return _0x5af1bf;}function formatPrefixName(_0x55f2ad){var _0x56315e='_';for(var _0x561ed5=0x0;_0x561ed5<_0x55f2ad[_0x7827('0x3e')];_0x561ed5++){if(_0x55f2ad['charAt'](_0x561ed5)=='-'){_0x56315e+=_0x55f2ad[_0x7827('0x71')](_0x561ed5);}else{_0x56315e+='['+_0x55f2ad['charAt'](_0x561ed5)+']';}}_0x56315e+='.';return _0x56315e;}exports['update']=function(_0xa78a88,_0x108e25,_0x5948d0){var _0x5385e1=_0xa78a88[_0x7827('0x72')];_0x5385e1[_0x7827('0x68')]='system-'+_0x5385e1[_0x7827('0x33')]+'-';return db[_0x7827('0x73')][_0x7827('0x54')](function(_0x2e9af2){return db['VoicePrefix'][_0x7827('0x2c')](_0x5385e1,{'where':{'id':_0x5385e1['id']},'transaction':_0x2e9af2})['then'](function(){return db[_0x7827('0x55')][_0x7827('0x2d')]({'where':{'VoicePrefixId':_0x5385e1['id']},'transaction':_0x2e9af2})['then'](function(){return db[_0x7827('0x55')]['find']({'where':{'id':_0x5385e1[_0x7827('0x56')]},'raw':!![]})[_0x7827('0x2e')](function(_0x19f41a){return createVoicePrefixExtensions(_0x5385e1,_0x19f41a,_0x2e9af2);});});});})['then'](function(){return db[_0x7827('0x36')][_0x7827('0x74')](_0x5385e1['id']);})[_0x7827('0x2e')](respondWithResult(_0x108e25,null))[_0x7827('0x4c')](handleError(_0x108e25,null));};exports['addAgents']=function(_0x293169,_0x1295ec,_0x4c4c5c){return db[_0x7827('0x36')][_0x7827('0x51')]({'where':{'id':_0x293169[_0x7827('0x4e')]['id']}})[_0x7827('0x2e')](handleEntityNotFound(_0x1295ec,null))[_0x7827('0x2e')](function(_0x5c22e0){if(_0x5c22e0){return _0x5c22e0[_0x7827('0x75')](_0x293169[_0x7827('0x72')][_0x7827('0x76')],_['omit'](_0x293169[_0x7827('0x72')],['ids','id'])||{})['spread'](function(_0x5c92a9){for(var _0x222cd0=0x0;_0x222cd0<_0x293169[_0x7827('0x72')][_0x7827('0x76')][_0x7827('0x3e')];_0x222cd0+=0x1){socket[_0x7827('0x77')](_0x7827('0x78'),{'UserId':_0x293169['body'][_0x7827('0x76')][_0x222cd0],'VoicePrefixId':_0x293169[_0x7827('0x4e')]['id']});}return _0x5c92a9;});}})[_0x7827('0x2e')](respondWithResult(_0x1295ec,null))[_0x7827('0x4c')](handleError(_0x1295ec,null));};exports[_0x7827('0x79')]=function(_0xd26361,_0x138099,_0x525ee2){return db[_0x7827('0x36')][_0x7827('0x51')]({'where':{'id':_0xd26361['params']['id']}})['then'](handleEntityNotFound(_0x138099,null))[_0x7827('0x2e')](function(_0x3e3047){if(_0x3e3047){return _0x3e3047[_0x7827('0x79')](_0xd26361[_0x7827('0x3b')][_0x7827('0x76')])[_0x7827('0x2e')](function(){if(_['isArray'](_0xd26361[_0x7827('0x3b')][_0x7827('0x76')])){for(var _0xb659db=0x0;_0xb659db<_0xd26361[_0x7827('0x3b')][_0x7827('0x76')][_0x7827('0x3e')];_0xb659db+=0x1){socket[_0x7827('0x77')](_0x7827('0x7a'),{'UserId':Number(_0xd26361[_0x7827('0x3b')]['ids'][_0xb659db]),'VoicePrefixId':Number(_0xd26361[_0x7827('0x4e')]['id'])});}}else{socket['emit'](_0x7827('0x7a'),{'UserId':Number(_0xd26361[_0x7827('0x3b')]['ids']),'VoicePrefixId':Number(_0xd26361[_0x7827('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x138099,null))[_0x7827('0x4c')](handleError(_0x138099,null));};exports['getAgents']=function(_0x381fc0,_0x4b4770,_0x33425f){var _0xda7f47={};var _0x1c0b1f={};var _0x5e7f26;var _0x8c5fae;return db[_0x7827('0x36')][_0x7827('0x7b')]({'where':{'id':_0x381fc0[_0x7827('0x4e')]['id']}})[_0x7827('0x2e')](handleEntityNotFound(_0x4b4770,null))[_0x7827('0x2e')](function(_0x2197d3){if(_0x2197d3){_0x5e7f26=_0x2197d3;_0x1c0b1f[_0x7827('0x39')]=_['keys'](db[_0x7827('0x7c')][_0x7827('0x37')]);_0x1c0b1f[_0x7827('0x3b')]=_[_0x7827('0x4f')](_0x381fc0[_0x7827('0x3b')]);_0x1c0b1f[_0x7827('0x42')]=_[_0x7827('0x3c')](_0x1c0b1f['model'],_0x1c0b1f[_0x7827('0x3b')]);_0xda7f47[_0x7827('0x3d')]=_[_0x7827('0x3c')](_0x1c0b1f[_0x7827('0x39')],qs[_0x7827('0x50')](_0x381fc0[_0x7827('0x3b')]['fields']));_0xda7f47[_0x7827('0x3d')]=_0xda7f47[_0x7827('0x3d')][_0x7827('0x3e')]?_0xda7f47[_0x7827('0x3d')]:_0x1c0b1f[_0x7827('0x39')];_0xda7f47[_0x7827('0x7d')]=qs[_0x7827('0x41')](_0x381fc0[_0x7827('0x3b')][_0x7827('0x41')]);_0xda7f47[_0x7827('0x45')]=qs[_0x7827('0x42')](_[_0x7827('0x43')](_0x381fc0['query'],_0x1c0b1f[_0x7827('0x42')]));if(_0x381fc0[_0x7827('0x3b')][_0x7827('0x44')]){_0xda7f47[_0x7827('0x45')]=_['merge'](_0xda7f47[_0x7827('0x45')],{'$or':_[_0x7827('0x3a')](_0xda7f47['attributes'],function(_0x251755){var _0x27f030={};_0x27f030[_0x251755]={'$like':'%'+_0x381fc0[_0x7827('0x3b')][_0x7827('0x44')]+'%'};return _0x27f030;})});}_0xda7f47=_['merge']({},_0xda7f47,_0x381fc0[_0x7827('0x47')]);return _0x5e7f26[_0x7827('0x7e')](_0xda7f47);}})['then'](function(_0x2a1882){if(_0x2a1882){_0x8c5fae=_0x2a1882[_0x7827('0x3e')];if(!_0x381fc0['query'][_0x7827('0x3f')](_0x7827('0x40'))){_0xda7f47[_0x7827('0x26')]=qs[_0x7827('0x26')](_0x381fc0[_0x7827('0x3b')][_0x7827('0x26')]);_0xda7f47['offset']=qs['offset'](_0x381fc0[_0x7827('0x3b')][_0x7827('0x25')]);}return _0x5e7f26[_0x7827('0x7e')](_0xda7f47);}})[_0x7827('0x2e')](function(_0x1e09ba){if(_0x1e09ba){return _0x1e09ba?{'count':_0x8c5fae,'rows':_0x1e09ba}:null;}})[_0x7827('0x2e')](respondWithResult(_0x4b4770,null))['catch'](handleError(_0x4b4770,null));}; \ No newline at end of file +var _0x2581=['VoicePrefix','rawAttributes','fieldName','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','type','merge','options','includeAll','include','rows','catch','show','params','intersection','find','describe','sequelize','transaction','create','VoiceExtension','VoiceExtensionId','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map'];(function(_0x33af32,_0xa80853){var _0x19f4be=function(_0x5cd675){while(--_0x5cd675){_0x33af32['push'](_0x33af32['shift']());}};_0x19f4be(++_0xa80853);}(_0x2581,0xcb));var _0x1258=function(_0x456be1,_0x248c6e){_0x456be1=_0x456be1-0x0;var _0x43fa66=_0x2581[_0x456be1];return _0x43fa66;};'use strict';var pdf=require(_0x1258('0x0'));var emlformat=require(_0x1258('0x1'));var rimraf=require(_0x1258('0x2'));var zipdir=require(_0x1258('0x3'));var jsonpatch=require(_0x1258('0x4'));var rp=require('request-promise');var moment=require(_0x1258('0x5'));var BPromise=require(_0x1258('0x6'));var Mustache=require(_0x1258('0x7'));var util=require(_0x1258('0x8'));var path=require(_0x1258('0x9'));var sox=require(_0x1258('0xa'));var csv=require(_0x1258('0xb'));var ejs=require(_0x1258('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1258('0xd'));var crypto=require(_0x1258('0xe'));var jsforce=require(_0x1258('0xf'));var deskjs=require(_0x1258('0x10'));var toCsv=require(_0x1258('0xb'));var querystring=require(_0x1258('0x11'));var Papa=require(_0x1258('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1258('0x13'));var as=require(_0x1258('0x14'));var hardwareService=require(_0x1258('0x15'));var logger=require(_0x1258('0x16'))('api');var utils=require(_0x1258('0x17'));var config=require(_0x1258('0x18'));var licenseUtil=require(_0x1258('0x19'));var db=require(_0x1258('0x1a'))['db'];config['redis']=_[_0x1258('0x1b')](config[_0x1258('0x1c')],{'host':_0x1258('0x1d'),'port':0x18eb});var socket=require(_0x1258('0x1e'))(new Redis(config[_0x1258('0x1c')]));require(_0x1258('0x1f'))[_0x1258('0x20')](socket);function respondWithStatusCode(_0x562286,_0x77d12c){_0x77d12c=_0x77d12c||0xcc;return function(_0x56bd82){if(_0x56bd82){return _0x562286[_0x1258('0x21')](_0x77d12c);}return _0x562286[_0x1258('0x22')](_0x77d12c)[_0x1258('0x23')]();};}function respondWithResult(_0x26e676,_0x313717){_0x313717=_0x313717||0xc8;return function(_0x4a85e4){if(_0x4a85e4){return _0x26e676[_0x1258('0x22')](_0x313717)[_0x1258('0x24')](_0x4a85e4);}};}function respondWithFilteredResult(_0x38d6e9,_0x55f1dc){return function(_0x97c02e){if(_0x97c02e){var _0xf234e8=_0x97c02e[_0x1258('0x25')],_0x55c458=_0x55f1dc[_0x1258('0x26')],_0x2dd7fd=_0x55f1dc[_0x1258('0x26')]+_0x55f1dc[_0x1258('0x27')],_0x2432b2;if(_0x2dd7fd>=_0xf234e8){_0x2dd7fd=_0xf234e8;_0x2432b2=0xc8;}else{_0x2432b2=0xce;}_0x38d6e9[_0x1258('0x22')](_0x2432b2);return _0x38d6e9[_0x1258('0x28')](_0x1258('0x29'),_0x55c458+'-'+_0x2dd7fd+'/'+_0xf234e8)[_0x1258('0x24')](_0x97c02e);}return null;};}function patchUpdates(_0x181c8c){return function(_0x7ce367){try{jsonpatch[_0x1258('0x2a')](_0x7ce367,_0x181c8c,!![]);}catch(_0x1d270b){return BPromise[_0x1258('0x2b')](_0x1d270b);}return _0x7ce367['save']();};}function saveUpdates(_0x282ef1,_0x528a62){return function(_0x569f65){if(_0x569f65){return _0x569f65[_0x1258('0x2c')](_0x282ef1)[_0x1258('0x2d')](function(_0x3e3a57){return _0x3e3a57;});}return null;};}function removeEntity(_0x2a61f2,_0x437fce){return function(_0xdf6639){if(_0xdf6639){return _0xdf6639[_0x1258('0x2e')]()['then'](function(){var _0x3ec562=_0xdf6639[_0x1258('0x2f')]({'plain':!![]});var _0x1cbfd1=_0x1258('0x30');return db[_0x1258('0x31')][_0x1258('0x2e')]({'where':{'type':_0x1cbfd1,'resourceId':_0x3ec562['id']}})[_0x1258('0x2d')](function(){return _0xdf6639;});})[_0x1258('0x2d')](function(){_0x2a61f2[_0x1258('0x22')](0xcc)[_0x1258('0x23')]();});}};}function handleEntityNotFound(_0x2edb84,_0x42a3b4){return function(_0x17b6b2){if(!_0x17b6b2){_0x2edb84['sendStatus'](0x194);}return _0x17b6b2;};}function handleError(_0x5a6365,_0x18ab7a){_0x18ab7a=_0x18ab7a||0x1f4;return function(_0x4fa3cf){logger[_0x1258('0x32')](_0x4fa3cf[_0x1258('0x33')]);if(_0x4fa3cf['name']){delete _0x4fa3cf[_0x1258('0x34')];}_0x5a6365[_0x1258('0x22')](_0x18ab7a)[_0x1258('0x35')](_0x4fa3cf);};}exports['index']=function(_0x58e7be,_0x1b46bf){var _0x2598a6={},_0x4a9642={},_0xa93e0b={'count':0x0,'rows':[]};var _0x5d059f=_[_0x1258('0x36')](db[_0x1258('0x37')][_0x1258('0x38')],function(_0x3c384c){return{'name':_0x3c384c[_0x1258('0x39')],'type':_0x3c384c['type']['key']};});_0x4a9642[_0x1258('0x3a')]=_[_0x1258('0x36')](_0x5d059f,_0x1258('0x34'));_0x4a9642[_0x1258('0x3b')]=_[_0x1258('0x3c')](_0x58e7be[_0x1258('0x3b')]);_0x4a9642['filters']=_['intersection'](_0x4a9642[_0x1258('0x3a')],_0x4a9642[_0x1258('0x3b')]);_0x2598a6['attributes']=_['intersection'](_0x4a9642['model'],qs['fields'](_0x58e7be[_0x1258('0x3b')][_0x1258('0x3d')]));_0x2598a6[_0x1258('0x3e')]=_0x2598a6[_0x1258('0x3e')][_0x1258('0x3f')]?_0x2598a6[_0x1258('0x3e')]:_0x4a9642[_0x1258('0x3a')];if(!_0x58e7be[_0x1258('0x3b')][_0x1258('0x40')]('nolimit')){_0x2598a6['limit']=qs[_0x1258('0x27')](_0x58e7be['query'][_0x1258('0x27')]);_0x2598a6['offset']=qs[_0x1258('0x26')](_0x58e7be[_0x1258('0x3b')][_0x1258('0x26')]);}_0x2598a6[_0x1258('0x41')]=qs[_0x1258('0x42')](_0x58e7be[_0x1258('0x3b')][_0x1258('0x42')]);_0x2598a6[_0x1258('0x43')]=qs['filters'](_[_0x1258('0x44')](_0x58e7be[_0x1258('0x3b')],_0x4a9642[_0x1258('0x45')]),_0x5d059f);if(_0x58e7be[_0x1258('0x3b')][_0x1258('0x46')]){_0x2598a6[_0x1258('0x43')]=_['merge'](_0x2598a6['where'],{'$or':_[_0x1258('0x36')](_0x5d059f,function(_0x24851a){if(_0x24851a[_0x1258('0x47')]!=='VIRTUAL'){var _0x3e63d3={};_0x3e63d3[_0x24851a['name']]={'$like':'%'+_0x58e7be['query'][_0x1258('0x46')]+'%'};return _0x3e63d3;}})});}_0x2598a6=_[_0x1258('0x48')]({},_0x2598a6,_0x58e7be[_0x1258('0x49')]);var _0x3f8e87={'where':_0x2598a6[_0x1258('0x43')]};return db[_0x1258('0x37')][_0x1258('0x25')](_0x3f8e87)[_0x1258('0x2d')](function(_0x121f55){_0xa93e0b[_0x1258('0x25')]=_0x121f55;if(_0x58e7be[_0x1258('0x3b')][_0x1258('0x4a')]){_0x2598a6[_0x1258('0x4b')]=[{'all':!![]}];}return db[_0x1258('0x37')]['findAll'](_0x2598a6);})[_0x1258('0x2d')](function(_0x2d8111){_0xa93e0b[_0x1258('0x4c')]=_0x2d8111;return _0xa93e0b;})[_0x1258('0x2d')](respondWithFilteredResult(_0x1b46bf,_0x2598a6))[_0x1258('0x4d')](handleError(_0x1b46bf,null));};exports[_0x1258('0x4e')]=function(_0x1d11c5,_0x563484){var _0x237544={'raw':![],'where':{'id':_0x1d11c5[_0x1258('0x4f')]['id']}},_0x318563={};_0x318563[_0x1258('0x3a')]=_[_0x1258('0x3c')](db[_0x1258('0x37')][_0x1258('0x38')]);_0x318563[_0x1258('0x3b')]=_[_0x1258('0x3c')](_0x1d11c5[_0x1258('0x3b')]);_0x318563[_0x1258('0x45')]=_[_0x1258('0x50')](_0x318563[_0x1258('0x3a')],_0x318563[_0x1258('0x3b')]);_0x237544[_0x1258('0x3e')]=_[_0x1258('0x50')](_0x318563[_0x1258('0x3a')],qs[_0x1258('0x3d')](_0x1d11c5[_0x1258('0x3b')]['fields']));_0x237544[_0x1258('0x3e')]=_0x237544[_0x1258('0x3e')]['length']?_0x237544['attributes']:_0x318563[_0x1258('0x3a')];if(_0x1d11c5[_0x1258('0x3b')][_0x1258('0x4a')]){_0x237544['include']=[{'all':!![]}];}_0x237544=_[_0x1258('0x48')]({},_0x237544,_0x1d11c5[_0x1258('0x49')]);return db[_0x1258('0x37')]['find'](_0x237544)[_0x1258('0x2d')](handleEntityNotFound(_0x563484,null))[_0x1258('0x2d')](respondWithResult(_0x563484,null))[_0x1258('0x4d')](handleError(_0x563484,null));};exports[_0x1258('0x2e')]=function(_0x48789e,_0x579662){return db['VoicePrefix'][_0x1258('0x51')]({'where':{'id':_0x48789e[_0x1258('0x4f')]['id']}})['then'](handleEntityNotFound(_0x579662,null))[_0x1258('0x2d')](removeEntity(_0x579662,null))[_0x1258('0x4d')](handleError(_0x579662,null));};exports[_0x1258('0x52')]=function(_0x377152,_0x51e396){return db[_0x1258('0x37')][_0x1258('0x52')]()[_0x1258('0x2d')](respondWithResult(_0x51e396,null))[_0x1258('0x4d')](handleError(_0x51e396,null));};exports['create']=function(_0x404380,_0xb341ba){var _0x29f588;return db[_0x1258('0x53')][_0x1258('0x54')](function(_0x1bd016){return db[_0x1258('0x37')][_0x1258('0x55')](_0x404380['body'],{'transaction':_0x1bd016})['then'](function(_0x3d698b){_0x29f588=_0x3d698b[_0x1258('0x2f')]({'plain':!![]});return db[_0x1258('0x56')][_0x1258('0x51')]({'where':{'id':_0x29f588[_0x1258('0x57')]},'raw':!![]})['then'](function(_0x1ae8fc){return createVoicePrefixExtensions(_0x29f588,_0x1ae8fc,_0x1bd016);});});})[_0x1258('0x2d')](function(){var _0x2adc55=_0x404380['user']['get']({'plain':!![]});if(!_0x2adc55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adc55[_0x1258('0x58')]===_0x1258('0x59')){var _0x2de959=_0x29f588;return db[_0x1258('0x5a')][_0x1258('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x2adc55[_0x1258('0x5b')]},'raw':!![]})[_0x1258('0x2d')](function(_0x153d4f){if(_0x153d4f&&_0x153d4f[_0x1258('0x5c')]===0x0){return db[_0x1258('0x31')][_0x1258('0x55')]({'name':_0x2de959[_0x1258('0x34')],'resourceId':_0x2de959['id'],'type':_0x153d4f[_0x1258('0x34')],'sectionId':_0x153d4f['id']},{})[_0x1258('0x2d')](function(){return _0x29f588;});}else{return _0x29f588;}})['catch'](function(_0x10e186){logger[_0x1258('0x32')](_0x1258('0x5d'),_0x10e186);throw _0x10e186;});}return _0x29f588;})['then'](respondWithResult(_0xb341ba,null))[_0x1258('0x4d')](handleError(_0xb341ba,null));};function Extension(_0x25dee8,_0x661202,_0x43dd5b,_0x2744ef){this[_0x1258('0x5e')]=_0x1258('0x5f');this[_0x1258('0x60')]=_0x25dee8;this[_0x1258('0x61')]=_0x43dd5b;this[_0x1258('0x47')]=_0x1258('0x62');this[_0x1258('0x63')]=_0x1258('0x64');this['priority']=_0x661202;this[_0x1258('0x65')]=_0x2744ef;}function createVoicePrefixExtensions(_0xae040,_0x41be7d,_0x31bc30){return new BPromise(function(_0x11aa96,_0x37ac7b){var _0x5553b4=new Extension(formatPrefixName(_0xae040[_0x1258('0x66')]),0x1,_0x1258('0x67'),_0x1258('0x68'));_0x5553b4[_0x1258('0x69')]=_0xae040['id'];return db[_0x1258('0x56')][_0x1258('0x55')](_0x5553b4,{'transaction':_0x31bc30})['then'](function(_0x279eb5){var _0x584d15=_0x279eb5[_0x1258('0x2f')]({'plain':!![]});var _0x2dd4d7=_[_0x1258('0x36')](addVoicePrefixExtensions(_0xae040,_0x41be7d),function(_0x18bdeb){_0x18bdeb[_0x1258('0x57')]=_0x584d15['id'];_0x18bdeb[_0x1258('0x69')]=_0xae040['id'];return _0x18bdeb;});return db[_0x1258('0x56')][_0x1258('0x6a')](_0x2dd4d7,{'transaction':_0x31bc30})[_0x1258('0x2d')](function(_0x201b1f){if(!_0x201b1f){return _0x37ac7b('Extensions\x20creation\x20failed');}else{return _0x11aa96(_0x201b1f);}})[_0x1258('0x4d')](function(_0x38c9eb){return _0x37ac7b(_0x38c9eb);});});;});};function addVoicePrefixExtensions(_0x52f510,_0x146522){var _0x4905db=[];var _0x3fc8a4=formatPrefixName(_0x52f510['prefix']);_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x2,_0x1258('0x6c'),_0x1258('0x6d')+_0x52f510[_0x1258('0x34')]));if(_0x52f510[_0x1258('0x6e')]){_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x3,_0x1258('0x6c'),_0x1258('0x6f')+_0x52f510[_0x1258('0x6e')]));}else{_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x3,_0x1258('0x67'),_0x1258('0x70')));}_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x4,_0x1258('0x71'),_0x146522[_0x1258('0x5e')]+','+_0x1258('0x72')+(0x8+_0x52f510[_0x1258('0x34')][_0x1258('0x3f')])+'}'+','+0x1));return _0x4905db;}function formatPrefixName(_0x48c020){var _0x4b9b26='_';for(var _0x2940f5=0x0;_0x2940f5<_0x48c020[_0x1258('0x3f')];_0x2940f5++){if(_0x48c020[_0x1258('0x73')](_0x2940f5)=='-'){_0x4b9b26+=_0x48c020[_0x1258('0x73')](_0x2940f5);}else{_0x4b9b26+='['+_0x48c020[_0x1258('0x73')](_0x2940f5)+']';}}_0x4b9b26+='.';return _0x4b9b26;}exports[_0x1258('0x2c')]=function(_0x157b8e,_0x2279a1,_0x19ae08){var _0x2455f8=_0x157b8e[_0x1258('0x74')];_0x2455f8[_0x1258('0x66')]='system-'+_0x2455f8[_0x1258('0x34')]+'-';return db['sequelize'][_0x1258('0x54')](function(_0x16ae31){return db[_0x1258('0x37')][_0x1258('0x2c')](_0x2455f8,{'where':{'id':_0x2455f8['id']},'transaction':_0x16ae31})[_0x1258('0x2d')](function(){return db[_0x1258('0x56')][_0x1258('0x2e')]({'where':{'VoicePrefixId':_0x2455f8['id']},'transaction':_0x16ae31})[_0x1258('0x2d')](function(){return db['VoiceExtension'][_0x1258('0x51')]({'where':{'id':_0x2455f8['VoiceExtensionId']},'raw':!![]})[_0x1258('0x2d')](function(_0x1c8347){return createVoicePrefixExtensions(_0x2455f8,_0x1c8347,_0x16ae31);});});});})['then'](function(){return db['VoicePrefix'][_0x1258('0x75')](_0x2455f8['id']);})[_0x1258('0x2d')](respondWithResult(_0x2279a1,null))[_0x1258('0x4d')](handleError(_0x2279a1,null));};exports[_0x1258('0x76')]=function(_0x36619b,_0x3a96d0,_0x25e5f9){return db[_0x1258('0x37')][_0x1258('0x51')]({'where':{'id':_0x36619b[_0x1258('0x4f')]['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x3a96d0,null))[_0x1258('0x2d')](function(_0x5a13a8){if(_0x5a13a8){return _0x5a13a8[_0x1258('0x76')](_0x36619b[_0x1258('0x74')][_0x1258('0x77')],_[_0x1258('0x78')](_0x36619b[_0x1258('0x74')],[_0x1258('0x77'),'id'])||{})['spread'](function(_0x1214ac){for(var _0x4fa126=0x0;_0x4fa126<_0x36619b[_0x1258('0x74')][_0x1258('0x77')]['length'];_0x4fa126+=0x1){socket[_0x1258('0x79')](_0x1258('0x7a'),{'UserId':_0x36619b[_0x1258('0x74')][_0x1258('0x77')][_0x4fa126],'VoicePrefixId':_0x36619b[_0x1258('0x4f')]['id']});}return _0x1214ac;});}})[_0x1258('0x2d')](respondWithResult(_0x3a96d0,null))['catch'](handleError(_0x3a96d0,null));};exports['removeAgents']=function(_0x1278b1,_0x2b8a48,_0x3eecbb){return db['VoicePrefix'][_0x1258('0x51')]({'where':{'id':_0x1278b1['params']['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x2b8a48,null))['then'](function(_0xd0fea9){if(_0xd0fea9){return _0xd0fea9[_0x1258('0x7b')](_0x1278b1[_0x1258('0x3b')]['ids'])['then'](function(){if(_[_0x1258('0x7c')](_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')])){for(var _0x5ac9cf=0x0;_0x5ac9cf<_0x1278b1[_0x1258('0x3b')]['ids'][_0x1258('0x3f')];_0x5ac9cf+=0x1){socket[_0x1258('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')][_0x5ac9cf]),'VoicePrefixId':Number(_0x1278b1['params']['id'])});}}else{socket[_0x1258('0x79')](_0x1258('0x7d'),{'UserId':Number(_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')]),'VoicePrefixId':Number(_0x1278b1[_0x1258('0x4f')]['id'])});}});}})[_0x1258('0x2d')](respondWithStatusCode(_0x2b8a48,null))[_0x1258('0x4d')](handleError(_0x2b8a48,null));};exports['getAgents']=function(_0x67c5f8,_0x21b920,_0x452ad0){var _0xc8a3c8={};var _0x1b6316={};var _0x394c2a;var _0x2c044f;return db[_0x1258('0x37')]['findOne']({'where':{'id':_0x67c5f8['params']['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x21b920,null))[_0x1258('0x2d')](function(_0x419e66){if(_0x419e66){_0x394c2a=_0x419e66;_0x1b6316['model']=_['keys'](db[_0x1258('0x7e')][_0x1258('0x38')]);_0x1b6316['query']=_['keys'](_0x67c5f8['query']);_0x1b6316[_0x1258('0x45')]=_['intersection'](_0x1b6316[_0x1258('0x3a')],_0x1b6316[_0x1258('0x3b')]);_0xc8a3c8[_0x1258('0x3e')]=_[_0x1258('0x50')](_0x1b6316[_0x1258('0x3a')],qs[_0x1258('0x3d')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x3d')]));_0xc8a3c8[_0x1258('0x3e')]=_0xc8a3c8['attributes'][_0x1258('0x3f')]?_0xc8a3c8[_0x1258('0x3e')]:_0x1b6316[_0x1258('0x3a')];_0xc8a3c8[_0x1258('0x41')]=qs[_0x1258('0x42')](_0x67c5f8['query']['sort']);_0xc8a3c8[_0x1258('0x43')]=qs[_0x1258('0x45')](_[_0x1258('0x44')](_0x67c5f8[_0x1258('0x3b')],_0x1b6316[_0x1258('0x45')]));if(_0x67c5f8['query'][_0x1258('0x46')]){_0xc8a3c8[_0x1258('0x43')]=_['merge'](_0xc8a3c8[_0x1258('0x43')],{'$or':_[_0x1258('0x36')](_0xc8a3c8[_0x1258('0x3e')],function(_0x581231){var _0x5ac5c5={};_0x5ac5c5[_0x581231]={'$like':'%'+_0x67c5f8['query'][_0x1258('0x46')]+'%'};return _0x5ac5c5;})});}_0xc8a3c8=_[_0x1258('0x48')]({},_0xc8a3c8,_0x67c5f8[_0x1258('0x49')]);return _0x394c2a[_0x1258('0x7f')](_0xc8a3c8);}})[_0x1258('0x2d')](function(_0x326ffa){if(_0x326ffa){_0x2c044f=_0x326ffa[_0x1258('0x3f')];if(!_0x67c5f8[_0x1258('0x3b')][_0x1258('0x40')](_0x1258('0x80'))){_0xc8a3c8[_0x1258('0x27')]=qs[_0x1258('0x27')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x27')]);_0xc8a3c8[_0x1258('0x26')]=qs[_0x1258('0x26')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x26')]);}return _0x394c2a['getAgents'](_0xc8a3c8);}})[_0x1258('0x2d')](function(_0xf3ede5){if(_0xf3ede5){return _0xf3ede5?{'count':_0x2c044f,'rows':_0xf3ede5}:null;}})[_0x1258('0x2d')](respondWithResult(_0x21b920,null))[_0x1258('0x4d')](handleError(_0x21b920,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3a4164d..8e8cd85 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0xe0805c,_0x2ce656){var _0xc24bd0=function(_0xdf7ca9){while(--_0xdf7ca9){_0xe0805c['push'](_0xe0805c['shift']());}};_0xc24bd0(++_0x2ce656);}(_0x008c,0x188));var _0xc008=function(_0x6e5bf7,_0x2c5d6c){_0x6e5bf7=_0x6e5bf7-0x0;var _0x145f89=_0x008c[_0x6e5bf7];return _0x145f89;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xedd9,0xfc));var _0x9edd=function(_0x25bcf7,_0x283759){_0x25bcf7=_0x25bcf7-0x0;var _0x2ee920=_0xedd9[_0x25bcf7];return _0x2ee920;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 0b3b3ec..14075b0 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 _0x0362=['VoicePrefix','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x4fb96e,_0x430f2a){var _0x185fc4=function(_0x2f7b4c){while(--_0x2f7b4c){_0x4fb96e['push'](_0x4fb96e['shift']());}};_0x185fc4(++_0x430f2a);}(_0x0362,0xb1));var _0x2036=function(_0x132251,_0x28fe58){_0x132251=_0x132251-0x0;var _0xeed8f1=_0x0362[_0x132251];return _0xeed8f1;};'use strict';var _=require('lodash');var util=require(_0x2036('0x0'));var logger=require(_0x2036('0x1'))(_0x2036('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2036('0x3'));var fs=require('fs');var path=require(_0x2036('0x4'));var rimraf=require(_0x2036('0x5'));var config=require(_0x2036('0x6'));var attributes=require(_0x2036('0x7'));module[_0x2036('0x8')]=function(_0x1ed532,_0x3e8b78){return _0x1ed532[_0x2036('0x9')](_0x2036('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe857=['../../config/environment','define','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0xe857,0x193));var _0x7e85=function(_0x1e8221,_0x10abf3){_0x1e8221=_0x1e8221-0x0;var _0x5ee90b=_0xe857[_0x1e8221];return _0x5ee90b;};'use strict';var _=require(_0x7e85('0x0'));var util=require(_0x7e85('0x1'));var logger=require(_0x7e85('0x2'))(_0x7e85('0x3'));var moment=require(_0x7e85('0x4'));var BPromise=require('bluebird');var rp=require(_0x7e85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e85('0x6'));var config=require(_0x7e85('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x31f2b1,_0x4dc8e1){return _0x31f2b1[_0x7e85('0x8')]('VoicePrefix',attributes,{'tableName':_0x7e85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 7c364b8..300997e 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 _0xd680=['register','request','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./voicePrefix.socket'];(function(_0x16c66c,_0x239f3a){var _0x17e9d7=function(_0x268422){while(--_0x268422){_0x16c66c['push'](_0x16c66c['shift']());}};_0x17e9d7(++_0x239f3a);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d68('0x0'));var util=require('util');var moment=require(_0x0d68('0x1'));var BPromise=require(_0x0d68('0x2'));var rs=require(_0x0d68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d68('0x4'));var logger=require('../../config/logger')(_0x0d68('0x5'));var config=require(_0x0d68('0x6'));var jayson=require(_0x0d68('0x7'));var client=jayson[_0x0d68('0x8')][_0x0d68('0x9')]({'port':0x232a});config['redis']=_[_0x0d68('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d68('0xb'))(new Redis(config[_0x0d68('0xc')]));require(_0x0d68('0xd'))[_0x0d68('0xe')](socket);function respondWithRpcPromise(_0x44e1c4,_0x2e81a1,_0x29f44f){return new BPromise(function(_0x2884e3,_0x43cf62){return client[_0x0d68('0xf')](_0x44e1c4,_0x29f44f)['then'](function(_0x191d66){logger[_0x0d68('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x2e81a1,_0x0d68('0x11'));logger[_0x0d68('0x12')](_0x0d68('0x13'),_0x2e81a1,_0x0d68('0x11'),JSON[_0x0d68('0x14')](_0x191d66));if(_0x191d66[_0x0d68('0x15')]){if(_0x191d66[_0x0d68('0x15')][_0x0d68('0x16')]===0x1f4){logger[_0x0d68('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2e81a1,_0x191d66[_0x0d68('0x15')][_0x0d68('0x17')]);return _0x43cf62(_0x191d66['error'][_0x0d68('0x17')]);}logger[_0x0d68('0x15')](_0x0d68('0x18'),_0x2e81a1,_0x191d66[_0x0d68('0x15')][_0x0d68('0x17')]);return _0x2884e3(_0x191d66[_0x0d68('0x15')][_0x0d68('0x17')]);}else{logger['info'](_0x0d68('0x18'),_0x2e81a1,_0x0d68('0x11'));_0x2884e3(_0x191d66[_0x0d68('0x19')]['message']);}})[_0x0d68('0x1a')](function(_0x19da78){logger[_0x0d68('0x15')](_0x0d68('0x18'),_0x2e81a1,_0x19da78);_0x43cf62(_0x19da78);});});} \ No newline at end of file +var _0xa145=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xa145,0x1a5));var _0x5a14=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa145[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5a14('0x0'));var util=require(_0x5a14('0x1'));var moment=require(_0x5a14('0x2'));var BPromise=require(_0x5a14('0x3'));var rs=require(_0x5a14('0x4'));var fs=require('fs');var Redis=require(_0x5a14('0x5'));var db=require(_0x5a14('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a14('0x7'))(_0x5a14('0x8'));var config=require(_0x5a14('0x9'));var jayson=require(_0x5a14('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5a14('0xb')](config[_0x5a14('0xc')],{'host':_0x5a14('0xd'),'port':0x18eb});var socket=require(_0x5a14('0xe'))(new Redis(config['redis']));require(_0x5a14('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d7349,_0x58aca7,_0x285033){return new BPromise(function(_0x5dddd9,_0x137957){return client[_0x5a14('0x10')](_0x4d7349,_0x285033)[_0x5a14('0x11')](function(_0x484dee){logger['info'](_0x5a14('0x12'),_0x58aca7,_0x5a14('0x13'));logger[_0x5a14('0x14')](_0x5a14('0x15'),_0x58aca7,'request\x20sent',JSON[_0x5a14('0x16')](_0x484dee));if(_0x484dee[_0x5a14('0x17')]){if(_0x484dee[_0x5a14('0x17')]['code']===0x1f4){logger['error'](_0x5a14('0x12'),_0x58aca7,_0x484dee[_0x5a14('0x17')][_0x5a14('0x18')]);return _0x137957(_0x484dee['error']['message']);}logger[_0x5a14('0x17')](_0x5a14('0x12'),_0x58aca7,_0x484dee[_0x5a14('0x17')][_0x5a14('0x18')]);return _0x5dddd9(_0x484dee['error']['message']);}else{logger[_0x5a14('0x19')](_0x5a14('0x12'),_0x58aca7,'request\x20sent');_0x5dddd9(_0x484dee[_0x5a14('0x1a')][_0x5a14('0x18')]);}})[_0x5a14('0x1b')](function(_0x222580){logger[_0x5a14('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x58aca7,_0x222580);_0x137957(_0x222580);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 95019a2..e3bf62e 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 _0x60cd=['save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x60cd,0x140));var _0xd60c=function(_0x1118b2,_0x21baa2){_0x1118b2=_0x1118b2-0x0;var _0x68c2d1=_0x60cd[_0x1118b2];return _0x68c2d1;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd60c('0x0'),_0xd60c('0x1'),_0xd60c('0x2')];function createListener(_0x403acb,_0x294f76){return function(_0x18ad8b){_0x294f76[_0xd60c('0x3')](_0x403acb,_0x18ad8b);};}function removeListener(_0x1f20b2,_0x3fd0a7){return function(){VoicePrefixEvents[_0xd60c('0x4')](_0x1f20b2,_0x3fd0a7);};}exports[_0xd60c('0x5')]=function(_0x4042f3){for(var _0x4fcb1a=0x0,_0x2c1a4=events[_0xd60c('0x6')];_0x4fcb1a<_0x2c1a4;_0x4fcb1a++){var _0xcea05b=events[_0x4fcb1a];var _0x2be4da=createListener(_0xd60c('0x7')+_0xcea05b,_0x4042f3);VoicePrefixEvents['on'](_0xcea05b,_0x2be4da);}}; \ No newline at end of file +var _0x9b27=['remove','update','removeListener','register','voicePrefix:','save'];(function(_0x119711,_0x30eda2){var _0x30974a=function(_0x22508e){while(--_0x22508e){_0x119711['push'](_0x119711['shift']());}};_0x30974a(++_0x30eda2);}(_0x9b27,0x77));var _0x79b2=function(_0xf0e391,_0x5433d4){_0xf0e391=_0xf0e391-0x0;var _0x1c126d=_0x9b27[_0xf0e391];return _0x1c126d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x79b2('0x0'),_0x79b2('0x1'),_0x79b2('0x2')];function createListener(_0x53edbb,_0x34540f){return function(_0x599bea){_0x34540f['emit'](_0x53edbb,_0x599bea);};}function removeListener(_0x4cd792,_0x30f747){return function(){VoicePrefixEvents[_0x79b2('0x3')](_0x4cd792,_0x30f747);};}exports[_0x79b2('0x4')]=function(_0x569e1e){for(var _0x56d5b4=0x0,_0x9441be=events['length'];_0x56d5b4<_0x9441be;_0x56d5b4++){var _0x484cf4=events[_0x56d5b4];var _0x2408a4=createListener(_0x79b2('0x5')+_0x484cf4,_0x569e1e);VoicePrefixEvents['on'](_0x484cf4,_0x2408a4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d631006..5205d64 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 _0x03bd=['/:id/blacklists','getBlackLists','post','/:id/clone','addTeams','/:id/users','addAgents','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','util','path','connect-timeout','Router','../../components/auth/service','isAuthenticated','index','/:id','get','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/members','getMembers','/:id/lists'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03bd,0x16d));var _0xd03b=function(_0x3a93d5,_0x973f5d){_0x3a93d5=_0x3a93d5-0x0;var _0x3734d2=_0x03bd[_0x3a93d5];return _0x3734d2;};'use strict';var multer=require('multer');var util=require(_0xd03b('0x0'));var path=require(_0xd03b('0x1'));var timeout=require(_0xd03b('0x2'));var express=require('express');var router=express[_0xd03b('0x3')]();var auth=require(_0xd03b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xd03b('0x5')](),controller[_0xd03b('0x6')]);router['get'](_0xd03b('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xd03b('0x8')](_0xd03b('0x9'),auth[_0xd03b('0x5')](),controller[_0xd03b('0xa')]);router[_0xd03b('0x8')](_0xd03b('0xb'),auth[_0xd03b('0x5')](),controller['getHopperHistories']);router[_0xd03b('0x8')](_0xd03b('0xc'),auth[_0xd03b('0x5')](),controller[_0xd03b('0xd')]);router['get'](_0xd03b('0xe'),auth[_0xd03b('0x5')](),controller['getHopperBlacks']);router[_0xd03b('0x8')](_0xd03b('0xf'),auth['isAuthenticated'](),controller[_0xd03b('0x10')]);router[_0xd03b('0x8')]('/:id/users',auth[_0xd03b('0x5')](),controller['getAgents']);router[_0xd03b('0x8')](_0xd03b('0x11'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x12')]);router[_0xd03b('0x8')](_0xd03b('0x13'),auth[_0xd03b('0x5')](),controller['getLists']);router[_0xd03b('0x8')](_0xd03b('0x14'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x15')]);router['post']('/',auth[_0xd03b('0x5')](),controller['create']);router[_0xd03b('0x16')](_0xd03b('0x17'),auth['isAuthenticated'](),controller['clone']);router[_0xd03b('0x16')](_0xd03b('0xf'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x18')]);router[_0xd03b('0x16')](_0xd03b('0x19'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x1a')]);router[_0xd03b('0x16')](_0xd03b('0x13'),auth[_0xd03b('0x5')](),controller['addLists']);router['post'](_0xd03b('0x14'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x1b')]);router['put'](_0xd03b('0x7'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x1c')]);router[_0xd03b('0x1d')](_0xd03b('0x7'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x1e')]);router[_0xd03b('0x1d')](_0xd03b('0xf'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x1f')]);router[_0xd03b('0x1d')](_0xd03b('0x19'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x20')]);router['delete'](_0xd03b('0x13'),auth['isAuthenticated'](),controller[_0xd03b('0x21')]);router[_0xd03b('0x1d')](_0xd03b('0x14'),auth[_0xd03b('0x5')](),controller[_0xd03b('0x22')]);module['exports']=router; \ No newline at end of file +var _0x6bad=['isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addTeams','addLists','addBlackLists','put','/:id','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6bad,0xfb));var _0xd6ba=function(_0x5b0f11,_0x222af6){_0x5b0f11=_0x5b0f11-0x0;var _0x59d314=_0x6bad[_0x5b0f11];return _0x59d314;};'use strict';var multer=require(_0xd6ba('0x0'));var util=require('util');var path=require(_0xd6ba('0x1'));var timeout=require(_0xd6ba('0x2'));var express=require('express');var router=express[_0xd6ba('0x3')]();var auth=require(_0xd6ba('0x4'));var interaction=require(_0xd6ba('0x5'));var config=require(_0xd6ba('0x6'));var controller=require('./voiceQueue.controller');router[_0xd6ba('0x7')]('/',auth[_0xd6ba('0x8')](),controller['index']);router['get']('/:id',auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x9')]);router[_0xd6ba('0x7')](_0xd6ba('0xa'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xd6ba('0x7')]('/:id/hopper_histories',auth[_0xd6ba('0x8')](),controller[_0xd6ba('0xb')]);router[_0xd6ba('0x7')](_0xd6ba('0xc'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0xd')]);router[_0xd6ba('0x7')](_0xd6ba('0xe'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0xf')]);router[_0xd6ba('0x7')](_0xd6ba('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd6ba('0x7')](_0xd6ba('0x11'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x12')]);router[_0xd6ba('0x7')](_0xd6ba('0x13'),auth[_0xd6ba('0x8')](),controller['getMembers']);router[_0xd6ba('0x7')](_0xd6ba('0x14'),auth['isAuthenticated'](),controller[_0xd6ba('0x15')]);router[_0xd6ba('0x7')](_0xd6ba('0x16'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd6ba('0x18')]);router[_0xd6ba('0x19')](_0xd6ba('0x1a'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x1b')]);router[_0xd6ba('0x19')](_0xd6ba('0x10'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x1c')]);router[_0xd6ba('0x19')](_0xd6ba('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0xd6ba('0x19')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd6ba('0x1d')]);router[_0xd6ba('0x19')](_0xd6ba('0x16'),auth[_0xd6ba('0x8')](),controller[_0xd6ba('0x1e')]);router[_0xd6ba('0x1f')](_0xd6ba('0x20'),auth[_0xd6ba('0x8')](),controller['update']);router[_0xd6ba('0x21')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd6ba('0x21')](_0xd6ba('0x10'),auth['isAuthenticated'](),controller[_0xd6ba('0x22')]);router['delete'](_0xd6ba('0x11'),auth['isAuthenticated'](),controller[_0xd6ba('0x23')]);router['delete'](_0xd6ba('0x14'),auth[_0xd6ba('0x8')](),controller['removeLists']);router[_0xd6ba('0x21')](_0xd6ba('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xd6ba('0x24')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1d34c12..7de3053 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1afdfb,_0x56696d){var _0x4fe9a5=function(_0x4635ca){while(--_0x4635ca){_0x1afdfb['push'](_0x1afdfb['shift']());}};_0x4fe9a5(++_0x56696d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 75fa883..40048fc 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 _0x81a3=['sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','VoiceQueue','findAll','rows','catch','show','params','find','create','body','user','get','role','VoiceQueues','inbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','interface','format','emit','removeTeams','select','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','every','all','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','SIP/%s','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','spread','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','sox','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','QueueCampaigns','outbound','filter','ignore','map','value','includes','UserProfileResource','then'];(function(_0x170595,_0x3054f4){var _0xdaa565=function(_0xc3118d){while(--_0xc3118d){_0x170595['push'](_0x170595['shift']());}};_0xdaa565(++_0x3054f4);}(_0x81a3,0x13a));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x381a('0x0'));var rimraf=require(_0x381a('0x1'));var zipdir=require(_0x381a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x381a('0x3'));var BPromise=require(_0x381a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x381a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x381a('0x6'));var squel=require('squel');var crypto=require(_0x381a('0x7'));var jsforce=require(_0x381a('0x8'));var deskjs=require(_0x381a('0x9'));var toCsv=require(_0x381a('0xa'));var querystring=require(_0x381a('0xb'));var Papa=require(_0x381a('0xc'));var Redis=require('ioredis');var authService=require(_0x381a('0xd'));var qs=require(_0x381a('0xe'));var as=require(_0x381a('0xf'));var hardwareService=require(_0x381a('0x10'));var logger=require('../../config/logger')(_0x381a('0x11'));var utils=require(_0x381a('0x12'));var config=require(_0x381a('0x13'));var licenseUtil=require(_0x381a('0x14'));var db=require(_0x381a('0x15'))['db'];config['redis']=_['defaults'](config[_0x381a('0x16')],{'host':_0x381a('0x17'),'port':0x18eb});var socket=require(_0x381a('0x18'))(new Redis(config[_0x381a('0x16')]));require(_0x381a('0x19'))[_0x381a('0x1a')](socket);function respondWithStatusCode(_0x5bc9ff,_0xbf5d22){_0xbf5d22=_0xbf5d22||0xcc;return function(_0x597062){if(_0x597062){return _0x5bc9ff['sendStatus'](_0xbf5d22);}return _0x5bc9ff[_0x381a('0x1b')](_0xbf5d22)[_0x381a('0x1c')]();};}function respondWithResult(_0x2e2a67,_0xf1bc8){_0xf1bc8=_0xf1bc8||0xc8;return function(_0x1dae9c){if(_0x1dae9c){return _0x2e2a67[_0x381a('0x1b')](_0xf1bc8)[_0x381a('0x1d')](_0x1dae9c);}};}function respondWithFilteredResult(_0x3cfc0f,_0x211778){return function(_0x1a711a){if(_0x1a711a){var _0x72ae09=_0x1a711a[_0x381a('0x1e')],_0xebef70=_0x211778[_0x381a('0x1f')],_0x2d68fc=_0x211778[_0x381a('0x1f')]+_0x211778[_0x381a('0x20')],_0x244dc3;if(_0x2d68fc>=_0x72ae09){_0x2d68fc=_0x72ae09;_0x244dc3=0xc8;}else{_0x244dc3=0xce;}_0x3cfc0f['status'](_0x244dc3);return _0x3cfc0f[_0x381a('0x21')](_0x381a('0x22'),_0xebef70+'-'+_0x2d68fc+'/'+_0x72ae09)[_0x381a('0x1d')](_0x1a711a);}return null;};}function patchUpdates(_0x470fc4){return function(_0x25fd72){try{jsonpatch['apply'](_0x25fd72,_0x470fc4,!![]);}catch(_0x538152){return BPromise[_0x381a('0x23')](_0x538152);}return _0x25fd72[_0x381a('0x24')]();};}function saveUpdates(_0x415949,_0x33ca23){return function(_0x234c4a){if(_0x234c4a){return _0x234c4a[_0x381a('0x25')](_0x415949)['then'](function(_0x1a7e03){return _0x1a7e03;});}return null;};}function removeEntity(_0x487ae6,_0x1676e8){return function(_0x1de5a1){if(_0x1de5a1){return _0x1de5a1[_0x381a('0x26')]()['then'](function(){var _0x328562=_0x1de5a1['get']({'plain':!![]});var _0x258806=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x381a('0x27'),'value':_0x381a('0x28'),'ignore':![]}];var _0x48724e=_(_0x258806)[_0x381a('0x29')](_0x381a('0x2a'))[_0x381a('0x2b')](_0x381a('0x2c'))[_0x381a('0x2c')]();if(_[_0x381a('0x2d')](_0x48724e,_0x328562['type'])){return;}var _0x57f1a8=_['find'](_0x258806,[_0x381a('0x2c'),_0x328562['type']])['name'];return db[_0x381a('0x2e')][_0x381a('0x26')]({'where':{'type':_0x57f1a8,'resourceId':_0x328562['id']}})['then'](function(){return _0x1de5a1;});})[_0x381a('0x2f')](function(){_0x487ae6[_0x381a('0x1b')](0xcc)[_0x381a('0x1c')]();});}};}function handleEntityNotFound(_0xf0f1a1,_0x38baf0){return function(_0x10a564){if(!_0x10a564){_0xf0f1a1[_0x381a('0x30')](0x194);}return _0x10a564;};}function handleError(_0x516f4c,_0x49de7){_0x49de7=_0x49de7||0x1f4;return function(_0x341bf3){logger[_0x381a('0x31')](_0x341bf3[_0x381a('0x32')]);if(_0x341bf3[_0x381a('0x33')]){delete _0x341bf3[_0x381a('0x33')];}_0x516f4c['status'](_0x49de7)['send'](_0x341bf3);};}exports[_0x381a('0x34')]=function(_0x42c5be,_0x56c25f){var _0x45778b={},_0x59512c={},_0x2d62ea={'count':0x0,'rows':[]};var _0x5ec940=_[_0x381a('0x2b')](db['VoiceQueue'][_0x381a('0x35')],function(_0x727ac5){return{'name':_0x727ac5[_0x381a('0x36')],'type':_0x727ac5[_0x381a('0x37')][_0x381a('0x38')]};});_0x59512c[_0x381a('0x39')]=_[_0x381a('0x2b')](_0x5ec940,_0x381a('0x33'));_0x59512c[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x42c5be[_0x381a('0x3a')]);_0x59512c[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x59512c['model'],_0x59512c[_0x381a('0x3a')]);_0x45778b[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x59512c[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x42c5be[_0x381a('0x3a')][_0x381a('0x3f')]));_0x45778b[_0x381a('0x3e')]=_0x45778b[_0x381a('0x3e')][_0x381a('0x40')]?_0x45778b[_0x381a('0x3e')]:_0x59512c[_0x381a('0x39')];if(!_0x42c5be[_0x381a('0x3a')][_0x381a('0x41')](_0x381a('0x42'))){_0x45778b[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x42c5be[_0x381a('0x3a')][_0x381a('0x20')]);_0x45778b[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x42c5be[_0x381a('0x3a')]['offset']);}_0x45778b[_0x381a('0x43')]=qs['sort'](_0x42c5be[_0x381a('0x3a')][_0x381a('0x44')]);_0x45778b['where']=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x42c5be[_0x381a('0x3a')],_0x59512c[_0x381a('0x3c')]),_0x5ec940);if(_0x42c5be['query'][_0x381a('0x29')]){_0x45778b[_0x381a('0x46')]=_[_0x381a('0x47')](_0x45778b[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0x5ec940,function(_0x357ff8){if(_0x357ff8['type']!==_0x381a('0x48')){var _0x3d1615={};_0x3d1615[_0x357ff8[_0x381a('0x33')]]={'$like':'%'+_0x42c5be[_0x381a('0x3a')][_0x381a('0x29')]+'%'};return _0x3d1615;}})});}_0x45778b=_['merge']({},_0x45778b,_0x42c5be[_0x381a('0x49')]);var _0x438ee7={'where':_0x45778b[_0x381a('0x46')]};return db['VoiceQueue'][_0x381a('0x1e')](_0x438ee7)[_0x381a('0x2f')](function(_0x2763aa){_0x2d62ea[_0x381a('0x1e')]=_0x2763aa;if(_0x42c5be[_0x381a('0x3a')][_0x381a('0x4a')]){_0x45778b[_0x381a('0x4b')]=[{'all':!![]}];}return db[_0x381a('0x4c')][_0x381a('0x4d')](_0x45778b);})[_0x381a('0x2f')](function(_0x5aa9d8){_0x2d62ea[_0x381a('0x4e')]=_0x5aa9d8;return _0x2d62ea;})[_0x381a('0x2f')](respondWithFilteredResult(_0x56c25f,_0x45778b))[_0x381a('0x4f')](handleError(_0x56c25f,null));};exports[_0x381a('0x50')]=function(_0x22063a,_0x58a439){var _0x69a930={'raw':![],'where':{'id':_0x22063a[_0x381a('0x51')]['id']}},_0x309ae6={};_0x309ae6[_0x381a('0x39')]=_['keys'](db[_0x381a('0x4c')][_0x381a('0x35')]);_0x309ae6[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x22063a[_0x381a('0x3a')]);_0x309ae6[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x309ae6[_0x381a('0x39')],_0x309ae6['query']);_0x69a930[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x309ae6['model'],qs[_0x381a('0x3f')](_0x22063a['query'][_0x381a('0x3f')]));_0x69a930['attributes']=_0x69a930[_0x381a('0x3e')][_0x381a('0x40')]?_0x69a930[_0x381a('0x3e')]:_0x309ae6['model'];if(_0x22063a[_0x381a('0x3a')][_0x381a('0x4a')]){_0x69a930[_0x381a('0x4b')]=[{'all':!![]}];}_0x69a930=_[_0x381a('0x47')]({},_0x69a930,_0x22063a[_0x381a('0x49')]);return db[_0x381a('0x4c')][_0x381a('0x52')](_0x69a930)[_0x381a('0x2f')](handleEntityNotFound(_0x58a439,null))[_0x381a('0x2f')](respondWithResult(_0x58a439,null))[_0x381a('0x4f')](handleError(_0x58a439,null));};exports['create']=function(_0x321a5a,_0x5b0167){return db[_0x381a('0x4c')][_0x381a('0x53')](_0x321a5a[_0x381a('0x54')],{})[_0x381a('0x2f')](function(_0x3d47a8){var _0x206acd=_0x321a5a[_0x381a('0x55')][_0x381a('0x56')]({'plain':!![]});if(!_0x206acd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x206acd[_0x381a('0x57')]==='user'){var _0x52cf6b=_0x3d47a8[_0x381a('0x56')]({'plain':!![]});var _0xdfc369=[{'name':_0x381a('0x58'),'value':_0x381a('0x59')},{'name':_0x381a('0x27'),'value':_0x381a('0x28')}];var _0x26a2ed=_[_0x381a('0x52')](_0xdfc369,[_0x381a('0x2c'),_0x52cf6b[_0x381a('0x37')]])[_0x381a('0x33')];return db[_0x381a('0x5a')][_0x381a('0x52')]({'where':{'name':_0x26a2ed,'userProfileId':_0x206acd[_0x381a('0x5b')]},'raw':!![]})[_0x381a('0x2f')](function(_0x445612){if(_0x445612&&_0x445612['autoAssociation']===0x0){return db[_0x381a('0x2e')][_0x381a('0x53')]({'name':_0x52cf6b[_0x381a('0x33')],'resourceId':_0x52cf6b['id'],'type':_0x445612[_0x381a('0x33')],'sectionId':_0x445612['id']},{})[_0x381a('0x2f')](function(){return _0x3d47a8;});}else{return _0x3d47a8;}})[_0x381a('0x4f')](function(_0x4930b8){logger[_0x381a('0x31')](_0x381a('0x5c'),_0x4930b8);throw _0x4930b8;});}return _0x3d47a8;})[_0x381a('0x2f')](respondWithResult(_0x5b0167,0xc9))[_0x381a('0x4f')](handleError(_0x5b0167,null));};exports[_0x381a('0x5d')]=function(_0x5c9a19,_0x569c1b){var _0x33d53a={'where':{'id':_0x5c9a19[_0x381a('0x51')]['id']}},_0x59cdd7={};_0x59cdd7[_0x381a('0x39')]=_['keys'](db['VoiceQueue'][_0x381a('0x35')]);_0x33d53a[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x59cdd7[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x5c9a19[_0x381a('0x3a')][_0x381a('0x3f')]));_0x33d53a[_0x381a('0x3e')]=_0x33d53a[_0x381a('0x3e')][_0x381a('0x40')]?_0x33d53a['attributes']:_0x59cdd7['model'];if(_0x5c9a19['query'][_0x381a('0x4a')]){_0x33d53a[_0x381a('0x4b')]=[{'all':!![]}];}_0x33d53a=_[_0x381a('0x47')]({},_0x33d53a,_0x5c9a19[_0x381a('0x49')]);return db[_0x381a('0x4c')][_0x381a('0x52')](_0x33d53a)[_0x381a('0x2f')](handleEntityNotFound(_0x569c1b,null))['then'](function(_0x1f8458){if(_0x1f8458){var _0x7f9f98=_0x1f8458[_0x381a('0x56')]({'plain':!![]});_0x7f9f98=qs[_0x381a('0x5e')](_0x7f9f98,['id',_0x381a('0x5f'),'updatedAt']);_0x5c9a19['body']=_[_0x381a('0x5e')](_0x5c9a19['body'],['id',_0x381a('0x5f'),_0x381a('0x60')]);return db[_0x381a('0x4c')][_0x381a('0x53')](_[_0x381a('0x47')](_0x7f9f98,_0x5c9a19[_0x381a('0x54')]),{'include':_0x5c9a19[_0x381a('0x3a')][_0x381a('0x4a')]?[{'all':!![]}]:undefined})[_0x381a('0x2f')](function(_0x2c321b){var _0x5df941=_0x5c9a19[_0x381a('0x55')][_0x381a('0x56')]({'plain':!![]});if(!_0x5df941)throw new Error(_0x381a('0x61'));if(_0x5df941[_0x381a('0x57')]===_0x381a('0x55')){var _0x340994=_0x2c321b[_0x381a('0x56')]({'plain':!![]});var _0x268f68=[{'name':_0x381a('0x58'),'value':_0x381a('0x59')},{'name':_0x381a('0x27'),'value':'outbound'}];var _0x4f38ee=_['find'](_0x268f68,[_0x381a('0x2c'),_0x340994['type']])[_0x381a('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x4f38ee,'userProfileId':_0x5df941['userProfileId']},'raw':!![]})['then'](function(_0x14d361){if(_0x14d361&&_0x14d361[_0x381a('0x62')]===0x0){return db['UserProfileResource'][_0x381a('0x53')]({'name':_0x340994[_0x381a('0x33')],'resourceId':_0x340994['id'],'type':_0x14d361[_0x381a('0x33')],'sectionId':_0x14d361['id']},{})[_0x381a('0x2f')](function(){return _0x2c321b;});}else{return _0x2c321b;}})[_0x381a('0x4f')](function(_0xef1dde){logger[_0x381a('0x31')](_0x381a('0x5c'),_0xef1dde);throw _0xef1dde;});}return _0x2c321b;});}})[_0x381a('0x2f')](respondWithResult(_0x569c1b,0xc9))[_0x381a('0x4f')](handleError(_0x569c1b,null));};exports[_0x381a('0x25')]=function(_0x1a077a,_0x5e7863){if(_0x1a077a[_0x381a('0x54')]['id']){delete _0x1a077a[_0x381a('0x54')]['id'];}return db[_0x381a('0x4c')]['find']({'where':{'id':_0x1a077a[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x5e7863,null))[_0x381a('0x2f')](saveUpdates(_0x1a077a[_0x381a('0x54')],null))[_0x381a('0x2f')](respondWithResult(_0x5e7863,null))[_0x381a('0x4f')](handleError(_0x5e7863,null));};exports['destroy']=function(_0x173878,_0x30ecc4){return db[_0x381a('0x4c')]['find']({'where':{'id':_0x173878[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x30ecc4,null))[_0x381a('0x2f')](removeEntity(_0x30ecc4,null))[_0x381a('0x4f')](handleError(_0x30ecc4,null));};exports[_0x381a('0x63')]=function(_0x75a07c,_0x5b95fa,_0x37eb13){var _0xcde31e={'raw':![],'where':{}};var _0x2e11f0={};var _0x28bd1e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x381a('0x64')]({'where':{'id':_0x75a07c[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x5b95fa,null))[_0x381a('0x2f')](function(_0x3bd245){if(_0x3bd245){_0x2e11f0[_0x381a('0x39')]=_[_0x381a('0x3b')](db[_0x381a('0x65')][_0x381a('0x35')]);_0x2e11f0[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x75a07c['query']);_0x2e11f0['filters']=_[_0x381a('0x3d')](_0x2e11f0[_0x381a('0x39')],_0x2e11f0[_0x381a('0x3a')]);_0xcde31e[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x2e11f0[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x75a07c[_0x381a('0x3a')][_0x381a('0x3f')]));_0xcde31e['attributes']=_0xcde31e[_0x381a('0x3e')][_0x381a('0x40')]?_0xcde31e['attributes']:_0x2e11f0[_0x381a('0x39')];if(!_0x75a07c['query'][_0x381a('0x41')](_0x381a('0x42'))){_0xcde31e[_0x381a('0x20')]=qs['limit'](_0x75a07c[_0x381a('0x3a')][_0x381a('0x20')]);_0xcde31e[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x75a07c[_0x381a('0x3a')][_0x381a('0x1f')]);}_0xcde31e[_0x381a('0x43')]=qs['sort'](_0x75a07c[_0x381a('0x3a')][_0x381a('0x44')]);_0xcde31e['where']=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x75a07c[_0x381a('0x3a')],_0x2e11f0[_0x381a('0x3c')]));_0xcde31e['where'][_0x381a('0x66')]=_0x3bd245['id'];if(_0x75a07c[_0x381a('0x3a')][_0x381a('0x29')]){_0xcde31e[_0x381a('0x46')]=_[_0x381a('0x47')](_0xcde31e['where'],{'$or':_[_0x381a('0x2b')](_0xcde31e['attributes'],function(_0x58792e){var _0x286a49={};_0x286a49[_0x58792e]={'$like':'%'+_0x75a07c[_0x381a('0x3a')]['filter']+'%'};return _0x286a49;})});}_0xcde31e=_[_0x381a('0x47')]({},_0xcde31e,_0x75a07c[_0x381a('0x49')]);return db[_0x381a('0x65')]['count']({'where':_0xcde31e[_0x381a('0x46')]})[_0x381a('0x2f')](function(_0x49f365){_0x28bd1e[_0x381a('0x1e')]=_0x49f365;if(_0x75a07c[_0x381a('0x3a')][_0x381a('0x4a')]){_0xcde31e[_0x381a('0x4b')]=[{'all':!![]}];}return db[_0x381a('0x65')][_0x381a('0x4d')](_0xcde31e);})[_0x381a('0x2f')](function(_0x37a6b3){_0x28bd1e[_0x381a('0x4e')]=_0x37a6b3;return _0x28bd1e;});}})['then'](respondWithFilteredResult(_0x5b95fa,_0xcde31e))[_0x381a('0x4f')](handleError(_0x5b95fa,null));};exports[_0x381a('0x67')]=function(_0x1126fc,_0x40e872,_0x44fffe){var _0x402f62={'raw':!![],'where':{}};var _0x32b46={};var _0x16d9db={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x381a('0x64')]({'where':{'id':_0x1126fc[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x40e872,null))[_0x381a('0x2f')](function(_0x59db0c){if(_0x59db0c){_0x32b46[_0x381a('0x39')]=_[_0x381a('0x3b')](db[_0x381a('0x68')][_0x381a('0x35')]);_0x32b46['query']=_['keys'](_0x1126fc[_0x381a('0x3a')]);_0x32b46['filters']=_['intersection'](_0x32b46[_0x381a('0x39')],_0x32b46[_0x381a('0x3a')]);_0x402f62[_0x381a('0x3e')]=_['intersection'](_0x32b46[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x1126fc['query'][_0x381a('0x3f')]));_0x402f62[_0x381a('0x3e')]=_0x402f62[_0x381a('0x3e')][_0x381a('0x40')]?_0x402f62[_0x381a('0x3e')]:_0x32b46[_0x381a('0x39')];if(!_0x1126fc[_0x381a('0x3a')][_0x381a('0x41')]('nolimit')){_0x402f62['limit']=qs[_0x381a('0x20')](_0x1126fc[_0x381a('0x3a')][_0x381a('0x20')]);_0x402f62[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x1126fc[_0x381a('0x3a')][_0x381a('0x1f')]);}_0x402f62[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x1126fc[_0x381a('0x3a')][_0x381a('0x44')]);_0x402f62[_0x381a('0x46')]=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x1126fc['query'],_0x32b46[_0x381a('0x3c')]));_0x402f62['where'][_0x381a('0x66')]=_0x59db0c['id'];if(_0x1126fc[_0x381a('0x3a')][_0x381a('0x29')]){_0x402f62[_0x381a('0x46')]=_[_0x381a('0x47')](_0x402f62[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0x402f62[_0x381a('0x3e')],function(_0x4db72c){var _0x5a1ab9={};_0x5a1ab9[_0x4db72c]={'$like':'%'+_0x1126fc['query']['filter']+'%'};return _0x5a1ab9;})});}_0x402f62=_[_0x381a('0x47')]({},_0x402f62,_0x1126fc[_0x381a('0x49')]);return db[_0x381a('0x68')]['count']({'where':_0x402f62[_0x381a('0x46')]})[_0x381a('0x2f')](function(_0x298c83){_0x16d9db[_0x381a('0x1e')]=_0x298c83;if(_0x1126fc[_0x381a('0x3a')][_0x381a('0x4a')]){_0x402f62[_0x381a('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x381a('0x4d')](_0x402f62);})['then'](function(_0x51f36a){_0x16d9db[_0x381a('0x4e')]=_0x51f36a;return _0x16d9db;});}})['then'](respondWithFilteredResult(_0x40e872,_0x402f62))[_0x381a('0x4f')](handleError(_0x40e872,null));};exports[_0x381a('0x69')]=function(_0x236da0,_0xc2f471,_0x3b8a0a){var _0x328063={'raw':!![],'where':{}};var _0x2e8bdd={};var _0x28fd7b={'count':0x0,'rows':[]};return db[_0x381a('0x4c')]['findOne']({'where':{'id':_0x236da0[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0xc2f471,null))['then'](function(_0x145e3f){if(_0x145e3f){_0x2e8bdd[_0x381a('0x39')]=_['keys'](db[_0x381a('0x6a')]['rawAttributes']);_0x2e8bdd[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x236da0[_0x381a('0x3a')]);_0x2e8bdd[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x2e8bdd[_0x381a('0x39')],_0x2e8bdd[_0x381a('0x3a')]);_0x328063['attributes']=_[_0x381a('0x3d')](_0x2e8bdd[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x236da0[_0x381a('0x3a')][_0x381a('0x3f')]));_0x328063[_0x381a('0x3e')]=_0x328063['attributes'][_0x381a('0x40')]?_0x328063['attributes']:_0x2e8bdd[_0x381a('0x39')];if(!_0x236da0['query']['hasOwnProperty']('nolimit')){_0x328063[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x236da0['query'][_0x381a('0x20')]);_0x328063[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x236da0[_0x381a('0x3a')][_0x381a('0x1f')]);}_0x328063['order']=qs[_0x381a('0x44')](_0x236da0['query'][_0x381a('0x44')]);_0x328063[_0x381a('0x46')]=qs['filters'](_[_0x381a('0x45')](_0x236da0['query'],_0x2e8bdd['filters']));_0x328063[_0x381a('0x46')]['VoiceQueueId']=_0x145e3f['id'];if(_0x236da0[_0x381a('0x3a')][_0x381a('0x29')]){_0x328063[_0x381a('0x46')]=_[_0x381a('0x47')](_0x328063['where'],{'$or':_[_0x381a('0x2b')](_0x328063[_0x381a('0x3e')],function(_0x1ccf6c){var _0x183e9c={};_0x183e9c[_0x1ccf6c]={'$like':'%'+_0x236da0[_0x381a('0x3a')][_0x381a('0x29')]+'%'};return _0x183e9c;})});}_0x328063=_['merge']({},_0x328063,_0x236da0[_0x381a('0x49')]);return db['CmHopperFinal']['count']({'where':_0x328063['where']})[_0x381a('0x2f')](function(_0x5f29a8){_0x28fd7b[_0x381a('0x1e')]=_0x5f29a8;if(_0x236da0[_0x381a('0x3a')][_0x381a('0x4a')]){_0x328063[_0x381a('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x381a('0x4d')](_0x328063);})[_0x381a('0x2f')](function(_0x1cae22){_0x28fd7b['rows']=_0x1cae22;return _0x28fd7b;});}})[_0x381a('0x2f')](respondWithFilteredResult(_0xc2f471,_0x328063))[_0x381a('0x4f')](handleError(_0xc2f471,null));};exports[_0x381a('0x6b')]=function(_0x5c521d,_0x190c85,_0xafc9b2){var _0xbeeba2={'raw':!![],'where':{}};var _0x23d676={};var _0x2915cf={'count':0x0,'rows':[]};return db[_0x381a('0x4c')]['findOne']({'where':{'id':_0x5c521d['params']['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x190c85,null))['then'](function(_0x3db251){if(_0x3db251){_0x23d676[_0x381a('0x39')]=_[_0x381a('0x3b')](db['CmHopperBlack'][_0x381a('0x35')]);_0x23d676[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x5c521d[_0x381a('0x3a')]);_0x23d676[_0x381a('0x3c')]=_['intersection'](_0x23d676['model'],_0x23d676['query']);_0xbeeba2[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x23d676['model'],qs['fields'](_0x5c521d[_0x381a('0x3a')]['fields']));_0xbeeba2[_0x381a('0x3e')]=_0xbeeba2[_0x381a('0x3e')]['length']?_0xbeeba2[_0x381a('0x3e')]:_0x23d676[_0x381a('0x39')];if(!_0x5c521d[_0x381a('0x3a')][_0x381a('0x41')](_0x381a('0x42'))){_0xbeeba2[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x5c521d[_0x381a('0x3a')]['limit']);_0xbeeba2[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x5c521d[_0x381a('0x3a')][_0x381a('0x1f')]);}_0xbeeba2[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x5c521d['query'][_0x381a('0x44')]);_0xbeeba2[_0x381a('0x46')]=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x5c521d[_0x381a('0x3a')],_0x23d676[_0x381a('0x3c')]));_0xbeeba2[_0x381a('0x46')][_0x381a('0x66')]=_0x3db251['id'];if(_0x5c521d[_0x381a('0x3a')][_0x381a('0x29')]){_0xbeeba2[_0x381a('0x46')]=_[_0x381a('0x47')](_0xbeeba2[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0xbeeba2[_0x381a('0x3e')],function(_0x4baaad){var _0x45605e={};_0x45605e[_0x4baaad]={'$like':'%'+_0x5c521d['query']['filter']+'%'};return _0x45605e;})});}_0xbeeba2=_[_0x381a('0x47')]({},_0xbeeba2,_0x5c521d[_0x381a('0x49')]);return db[_0x381a('0x6c')][_0x381a('0x1e')]({'where':_0xbeeba2[_0x381a('0x46')]})['then'](function(_0x5133d3){_0x2915cf[_0x381a('0x1e')]=_0x5133d3;if(_0x5c521d['query'][_0x381a('0x4a')]){_0xbeeba2['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x381a('0x4d')](_0xbeeba2);})['then'](function(_0x2fa0ae){_0x2915cf[_0x381a('0x4e')]=_0x2fa0ae;return _0x2915cf;});}})[_0x381a('0x2f')](respondWithFilteredResult(_0x190c85,_0xbeeba2))['catch'](handleError(_0x190c85,null));};exports[_0x381a('0x6d')]=function(_0x43cf21,_0x1bf747,_0x42cfba){var _0x161ca5={};var _0x2cfa9f={};var _0x2f3c74;var _0x17403d;return db[_0x381a('0x4c')][_0x381a('0x64')]({'where':{'id':_0x43cf21['params']['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x1bf747,null))[_0x381a('0x2f')](function(_0x197c98){if(_0x197c98){_0x2f3c74=_0x197c98;_0x2cfa9f[_0x381a('0x39')]=_['keys'](db[_0x381a('0x6e')][_0x381a('0x35')]);_0x2cfa9f[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x43cf21[_0x381a('0x3a')]);_0x2cfa9f[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x2cfa9f[_0x381a('0x39')],_0x2cfa9f[_0x381a('0x3a')]);_0x161ca5[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x2cfa9f['model'],qs[_0x381a('0x3f')](_0x43cf21[_0x381a('0x3a')][_0x381a('0x3f')]));_0x161ca5['attributes']=_0x161ca5[_0x381a('0x3e')]['length']?_0x161ca5['attributes']:_0x2cfa9f[_0x381a('0x39')];_0x161ca5[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x43cf21[_0x381a('0x3a')]['sort']);_0x161ca5[_0x381a('0x46')]=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x43cf21[_0x381a('0x3a')],_0x2cfa9f['filters']));if(_0x43cf21[_0x381a('0x3a')][_0x381a('0x29')]){_0x161ca5[_0x381a('0x46')]=_[_0x381a('0x47')](_0x161ca5[_0x381a('0x46')],{'$or':_['map'](_0x161ca5['attributes'],function(_0x430993){var _0x9add80={};_0x9add80[_0x430993]={'$like':'%'+_0x43cf21[_0x381a('0x3a')][_0x381a('0x29')]+'%'};return _0x9add80;})});}_0x161ca5=_['merge']({},_0x161ca5,_0x43cf21[_0x381a('0x49')]);return _0x2f3c74['getTeams'](_0x161ca5);}})[_0x381a('0x2f')](function(_0x2d95a7){if(_0x2d95a7){_0x17403d=_0x2d95a7[_0x381a('0x40')];if(!_0x43cf21[_0x381a('0x3a')][_0x381a('0x41')](_0x381a('0x42'))){_0x161ca5[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x43cf21[_0x381a('0x3a')]['limit']);_0x161ca5[_0x381a('0x1f')]=qs['offset'](_0x43cf21[_0x381a('0x3a')][_0x381a('0x1f')]);}return _0x2f3c74[_0x381a('0x6d')](_0x161ca5);}})['then'](function(_0x32460d){if(_0x32460d){return _0x32460d?{'count':_0x17403d,'rows':_0x32460d}:null;}})[_0x381a('0x2f')](respondWithResult(_0x1bf747,null))['catch'](handleError(_0x1bf747,null));};exports[_0x381a('0x6f')]=function(_0x41199b,_0x1bafd,_0x11b990){var _0x54598d=_0x41199b[_0x381a('0x54')][_0x381a('0x70')];var _0x3f1266=_[_0x381a('0x2b')](_0x54598d,'id');return db[_0x381a('0x6e')]['findAll']({'where':{'id':_0x3f1266},'attributes':['id'],'include':[{'model':db[_0x381a('0x71')],'as':_0x381a('0x72'),'attributes':['id','name',_0x381a('0x73'),_0x381a('0x74'),'interface'],'raw':!![]}]})[_0x381a('0x2f')](function(_0x527662){if(_0x527662){var _0x25137d=_[_0x381a('0x75')](_0x527662,function(_0x5b0b07){var _0x15e315=_0x5b0b07['get']({'plain':!![]});_0x15e315[_0x381a('0x72')][_0x381a('0x76')](function(_0x23080f){_0x23080f[_0x381a('0x77')]=_[_0x381a('0x52')](_0x54598d,{'id':_0x15e315['id']})[_0x381a('0x77')];});return _0x15e315[_0x381a('0x72')];});return db['VoiceQueue'][_0x381a('0x52')]({'where':{'id':_0x41199b['params']['id']}})['then'](function(_0x5f5411){return db[_0x381a('0x78')]['transaction'](function(_0x54bcaf){return _0x5f5411[_0x381a('0x6f')](_0x3f1266,{'transaction':_0x54bcaf})['then'](function(){return BPromise[_0x381a('0x79')](_0x54598d,function(_0x310f10){return db[_0x381a('0x7a')][_0x381a('0x7b')]({'TeamId':_0x310f10['id'],'VoiceQueueId':_0x41199b[_0x381a('0x51')]['id'],'penalty':_0x310f10[_0x381a('0x77')]},{'transaction':_0x54bcaf});});})['then'](function(){return BPromise[_0x381a('0x79')](_0x25137d,function(_0x2156d4){return db[_0x381a('0x7c')][_0x381a('0x7d')]({'where':{'UserId':_0x2156d4['id'],'VoiceQueueId':_0x41199b['params']['id']},'defaults':{'penalty':_0x2156d4['penalty']},'transaction':_0x54bcaf});});})[_0x381a('0x2f')](function(){return BPromise[_0x381a('0x79')](_[_0x381a('0x29')](_0x25137d,{'online':!![]}),function(_0x2e996f){return db['UserVoiceQueueRt'][_0x381a('0x7b')]({'membername':_0x2e996f[_0x381a('0x33')],'UserId':_0x2e996f['id'],'queue_name':_0x5f5411[_0x381a('0x33')],'VoiceQueueId':_0x5f5411['id'],'interface':_[_0x381a('0x7e')](_0x2e996f[_0x381a('0x7f')])?util[_0x381a('0x80')]('SIP/%s',_0x2e996f['name']):_0x2e996f[_0x381a('0x7f')],'paused':_0x2e996f[_0x381a('0x74')]||![],'penalty':_0x2e996f[_0x381a('0x77')]},{'transaction':_0x54bcaf});});})[_0x381a('0x2f')](function(){_0x25137d[_0x381a('0x76')](function(_0x1cd140){socket[_0x381a('0x81')]('userVoiceQueue:save',{'UserId':_0x1cd140['id'],'VoiceQueueId':_0x5f5411['id']});});});});});}})['then'](respondWithStatusCode(_0x1bafd,null))['catch'](handleError(_0x1bafd,null));};exports[_0x381a('0x82')]=function(_0x373fb4,_0x363476,_0x3cc411){return db['Team'][_0x381a('0x4d')]({'where':{'id':_0x373fb4[_0x381a('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x381a('0x71')],'as':_0x381a('0x72'),'attributes':['id'],'raw':!![]}]})[_0x381a('0x2f')](handleEntityNotFound(_0x363476,null))['then'](function(_0x314d7a){var _0x1a3d05=_[_0x381a('0x2b')](_0x314d7a,'id');var _0x393c08=[];var _0x488a12=[];var _0x56d902=squel[_0x381a('0x83')]();_0x56d902['field']('tq.TeamId')[_0x381a('0x84')](_0x381a('0x85'),'tq')[_0x381a('0x86')](_0x381a('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x381a('0x46')]('VoiceQueueId\x20=\x20?',_0x373fb4[_0x381a('0x51')]['id']);for(var _0x254f39=0x0;_0x254f39<_0x314d7a[_0x381a('0x40')];_0x254f39+=0x1){let _0x30e29a=_0x314d7a[_0x254f39];for(var _0x26dc94=0x0;_0x26dc94<_0x30e29a[_0x381a('0x72')][_0x381a('0x40')];_0x26dc94+=0x1){let _0x574334=_0x30e29a[_0x381a('0x72')][_0x26dc94];var _0x120bb8=_0x56d902[_0x381a('0x5d')]();_0x120bb8[_0x381a('0x46')](_0x381a('0x88'),_0x574334['id']);_0x488a12[_0x381a('0x89')](db['sequelize']['query'](_0x120bb8[_0x381a('0x8a')](),{'type':db[_0x381a('0x78')]['QueryTypes']['SELECT']})[_0x381a('0x2f')](function(_0x342bdb){if(_0x342bdb[_0x381a('0x40')]===0x1){return _0x574334['id'];}else{var _0x2f994e=_[_0x381a('0x8b')](_[_0x381a('0x2b')](_0x342bdb,'TeamId'),function(_0x5dd732){return _[_0x381a('0x2d')](_0x1a3d05,_0x5dd732);});if(_0x2f994e){return _0x574334['id'];}}}));}}return BPromise[_0x381a('0x8c')](_0x488a12)[_0x381a('0x2f')](function(_0x14a98c){_0x393c08=_(_0x393c08)['union'](_0x14a98c)[_0x381a('0x8d')]()['value']();return db[_0x381a('0x4c')][_0x381a('0x52')]({'where':{'id':_0x373fb4['params']['id']}})['then'](function(_0x3ddd8b){return db['sequelize']['transaction'](function(_0x47c5e4){return _0x3ddd8b[_0x381a('0x82')](_0x373fb4[_0x381a('0x3a')][_0x381a('0x8e')],{'transaction':_0x47c5e4})['then'](function(){if(!_[_0x381a('0x8f')](_0x393c08)){return _0x3ddd8b[_0x381a('0x90')](_0x393c08,{'transaction':_0x47c5e4})[_0x381a('0x2f')](function(){return db['UserVoiceQueueRt'][_0x381a('0x26')]({'where':{'VoiceQueueId':_0x373fb4[_0x381a('0x51')]['id'],'UserId':_0x393c08},'transaction':_0x47c5e4});});}})[_0x381a('0x2f')](function(){_0x393c08['forEach'](function(_0x3b7f39){socket[_0x381a('0x81')](_0x381a('0x91'),{'UserId':_0x3b7f39,'VoiceQueueId':_0x3ddd8b['id']});});});});});});})['then'](respondWithStatusCode(_0x363476,null))[_0x381a('0x4f')](handleError(_0x363476,null));};exports[_0x381a('0x92')]=function(_0x2a87f6,_0x3460d7,_0x82945c){var _0x2444fd,_0x1bb3c6;return db[_0x381a('0x4c')]['find']({'where':{'id':_0x2a87f6['params']['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x3460d7,null))[_0x381a('0x2f')](function(_0x4c0253){if(_0x4c0253){_0x1bb3c6=_0x4c0253;return _0x4c0253[_0x381a('0x92')](_0x2a87f6['body']['ids'],_['omit'](_0x2a87f6['body'],[_0x381a('0x8e'),'id'])||{})['spread'](function(_0x24b4de){for(var _0x25ade1=0x0;_0x25ade1<_0x2a87f6[_0x381a('0x54')][_0x381a('0x8e')]['length'];_0x25ade1+=0x1){socket[_0x381a('0x81')](_0x381a('0x93'),{'UserId':_0x2a87f6['body']['ids'][_0x25ade1],'VoiceQueueId':_0x2a87f6[_0x381a('0x51')]['id']});}return _0x24b4de;});}})[_0x381a('0x2f')](function(_0x193eb8){_0x2444fd=_0x193eb8||[];if(_0x1bb3c6){return db[_0x381a('0x71')][_0x381a('0x4d')]({'where':{'id':_0x2a87f6[_0x381a('0x54')][_0x381a('0x8e')]},'attributes':['id',_0x381a('0x33'),_0x381a('0x73'),_0x381a('0x74'),'interface'],'raw':!![]});}})['then'](function(_0x2d9599){if(!_[_0x381a('0x8f')](_0x2d9599)){var _0x12faeb=[];for(var _0x4e444a=0x0;_0x4e444a<_0x2d9599[_0x381a('0x40')];_0x4e444a++){if(_0x2d9599[_0x4e444a][_0x381a('0x73')]){_0x12faeb['push'](db['UserVoiceQueueRt'][_0x381a('0x7b')]({'membername':_0x2d9599[_0x4e444a][_0x381a('0x33')],'UserId':_0x2d9599[_0x4e444a]['id'],'queue_name':_0x1bb3c6[_0x381a('0x33')],'VoiceQueueId':_0x1bb3c6['id'],'interface':_['isNil'](_0x2d9599[_0x4e444a][_0x381a('0x7f')])?util[_0x381a('0x80')](_0x381a('0x94'),_0x2d9599[_0x4e444a][_0x381a('0x33')]):_0x2d9599[_0x4e444a][_0x381a('0x7f')],'paused':_0x2d9599[_0x4e444a]['voicePause']||![],'penalty':_0x2a87f6[_0x381a('0x54')]['penalty']||0x0}));}}return BPromise[_0x381a('0x8c')](_0x12faeb);}})[_0x381a('0x2f')](function(){return _0x2444fd;})[_0x381a('0x2f')](respondWithResult(_0x3460d7,null))[_0x381a('0x4f')](handleError(_0x3460d7,null));};exports[_0x381a('0x90')]=function(_0x240ca9,_0xa07cbd,_0x548810){return db[_0x381a('0x4c')][_0x381a('0x52')]({'where':{'id':_0x240ca9[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0xa07cbd,null))[_0x381a('0x2f')](function(_0x4abb51){if(_0x4abb51){return _0x4abb51['removeAgents'](_0x240ca9[_0x381a('0x3a')]['ids'])['then'](function(){if(_['isArray'](_0x240ca9[_0x381a('0x3a')][_0x381a('0x8e')])){for(var _0x56fed7=0x0;_0x56fed7<_0x240ca9[_0x381a('0x3a')][_0x381a('0x8e')][_0x381a('0x40')];_0x56fed7+=0x1){socket['emit'](_0x381a('0x91'),{'UserId':Number(_0x240ca9['query'][_0x381a('0x8e')][_0x56fed7]),'VoiceQueueId':Number(_0x240ca9[_0x381a('0x51')]['id'])});}}else{socket[_0x381a('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x240ca9[_0x381a('0x3a')][_0x381a('0x8e')]),'VoiceQueueId':Number(_0x240ca9['params']['id'])});}});}})[_0x381a('0x2f')](function(_0x3cb5ba){return db[_0x381a('0x95')][_0x381a('0x26')]({'where':{'VoiceQueueId':_0x240ca9[_0x381a('0x51')]['id'],'UserId':_0x240ca9[_0x381a('0x3a')]['ids']}})['then'](function(){return _0x3cb5ba;});})['then'](respondWithStatusCode(_0xa07cbd,null))[_0x381a('0x4f')](handleError(_0xa07cbd,null));};exports['getAgents']=function(_0x355b2c,_0x3f8f20,_0x4de8f5){var _0x1db5f8={};var _0x14d3a5={};var _0x4120ee;var _0x5f92c7;return db[_0x381a('0x4c')]['findOne']({'where':{'id':_0x355b2c[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x3f8f20,null))[_0x381a('0x2f')](function(_0x1e4c0e){if(_0x1e4c0e){_0x4120ee=_0x1e4c0e;_0x14d3a5['model']=_[_0x381a('0x3b')](db['User'][_0x381a('0x35')]);_0x14d3a5['query']=_[_0x381a('0x3b')](_0x355b2c['query']);_0x14d3a5[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x14d3a5[_0x381a('0x39')],_0x14d3a5['query']);_0x1db5f8['attributes']=_[_0x381a('0x3d')](_0x14d3a5[_0x381a('0x39')],qs['fields'](_0x355b2c[_0x381a('0x3a')][_0x381a('0x3f')]));_0x1db5f8[_0x381a('0x3e')]=_0x1db5f8['attributes'][_0x381a('0x40')]?_0x1db5f8[_0x381a('0x3e')]:_0x14d3a5[_0x381a('0x39')];_0x1db5f8[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x355b2c[_0x381a('0x3a')][_0x381a('0x44')]);_0x1db5f8[_0x381a('0x46')]=qs[_0x381a('0x3c')](_['pick'](_0x355b2c['query'],_0x14d3a5[_0x381a('0x3c')]));if(_0x355b2c['query'][_0x381a('0x29')]){_0x1db5f8[_0x381a('0x46')]=_[_0x381a('0x47')](_0x1db5f8[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0x1db5f8[_0x381a('0x3e')],function(_0x2b3182){var _0x75a51f={};_0x75a51f[_0x2b3182]={'$like':'%'+_0x355b2c['query'][_0x381a('0x29')]+'%'};return _0x75a51f;})});}_0x1db5f8=_['merge']({},_0x1db5f8,_0x355b2c[_0x381a('0x49')]);return _0x4120ee[_0x381a('0x96')](_0x1db5f8);}})['then'](function(_0x23c2ec){if(_0x23c2ec){_0x5f92c7=_0x23c2ec['length'];if(!_0x355b2c[_0x381a('0x3a')]['hasOwnProperty'](_0x381a('0x42'))){_0x1db5f8[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x355b2c[_0x381a('0x3a')]['limit']);_0x1db5f8[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x355b2c[_0x381a('0x3a')][_0x381a('0x1f')]);}return _0x4120ee[_0x381a('0x96')](_0x1db5f8);}})[_0x381a('0x2f')](function(_0x2871be){if(_0x2871be){return _0x2871be?{'count':_0x5f92c7,'rows':_0x2871be}:null;}})[_0x381a('0x2f')](respondWithResult(_0x3f8f20,null))[_0x381a('0x4f')](handleError(_0x3f8f20,null));};exports[_0x381a('0x97')]=function(_0x90076e,_0x585346,_0x2850dc){var _0x47d86b={};var _0xe8d81b={};var _0x5c5896;var _0x319f1b;return db[_0x381a('0x4c')][_0x381a('0x64')]({'where':{'id':_0x90076e[_0x381a('0x51')]['id']}})['then'](handleEntityNotFound(_0x585346,null))[_0x381a('0x2f')](function(_0x4a68fa){if(_0x4a68fa){_0x5c5896=_0x4a68fa;_0xe8d81b[_0x381a('0x39')]=_[_0x381a('0x3b')](db[_0x381a('0x95')][_0x381a('0x35')]);_0xe8d81b['query']=_[_0x381a('0x3b')](_0x90076e[_0x381a('0x3a')]);_0xe8d81b['filters']=_[_0x381a('0x3d')](_0xe8d81b[_0x381a('0x39')],_0xe8d81b[_0x381a('0x3a')]);_0x47d86b[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0xe8d81b[_0x381a('0x39')],qs[_0x381a('0x3f')](_0x90076e[_0x381a('0x3a')][_0x381a('0x3f')]));_0x47d86b['attributes']=_0x47d86b[_0x381a('0x3e')]['length']?_0x47d86b[_0x381a('0x3e')]:_0xe8d81b[_0x381a('0x39')];_0x47d86b[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x90076e[_0x381a('0x3a')][_0x381a('0x44')]);_0x47d86b[_0x381a('0x46')]=qs['filters'](_[_0x381a('0x45')](_0x90076e['query'],_0xe8d81b[_0x381a('0x3c')]));if(_0x90076e[_0x381a('0x3a')][_0x381a('0x29')]){_0x47d86b[_0x381a('0x46')]=_['merge'](_0x47d86b[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0x47d86b[_0x381a('0x3e')],function(_0x45fc6c){var _0x202589={};_0x202589[_0x45fc6c]={'$like':'%'+_0x90076e[_0x381a('0x3a')]['filter']+'%'};return _0x202589;})});}_0x47d86b=_['merge']({},_0x47d86b,_0x90076e[_0x381a('0x49')]);return _0x5c5896[_0x381a('0x97')](_0x47d86b);}})[_0x381a('0x2f')](function(_0x1146b0){if(_0x1146b0){_0x319f1b=_0x1146b0[_0x381a('0x40')];if(!_0x90076e[_0x381a('0x3a')][_0x381a('0x41')](_0x381a('0x42'))){_0x47d86b[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x90076e[_0x381a('0x3a')][_0x381a('0x20')]);_0x47d86b[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x90076e[_0x381a('0x3a')][_0x381a('0x1f')]);}return _0x5c5896[_0x381a('0x97')](_0x47d86b);}})['then'](function(_0x27d936){return _0x27d936?{'count':_0x319f1b,'rows':_0x27d936}:null;})['then'](respondWithResult(_0x585346,null))[_0x381a('0x4f')](handleError(_0x585346,null));};exports[_0x381a('0x98')]=function(_0x33cf45,_0x156448,_0x19cc5a){var _0x547b09={};var _0x23f9eb={};var _0x20ac7c;var _0x4cf2c6;return db[_0x381a('0x4c')][_0x381a('0x64')]({'where':{'id':_0x33cf45[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x156448,null))[_0x381a('0x2f')](function(_0x5eef1c){if(_0x5eef1c){_0x20ac7c=_0x5eef1c;_0x23f9eb[_0x381a('0x39')]=_[_0x381a('0x3b')](db[_0x381a('0x99')]['rawAttributes']);_0x23f9eb[_0x381a('0x3a')]=_['keys'](_0x33cf45[_0x381a('0x3a')]);_0x23f9eb[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x23f9eb[_0x381a('0x39')],_0x23f9eb[_0x381a('0x3a')]);_0x547b09[_0x381a('0x3e')]=_[_0x381a('0x3d')](_0x23f9eb['model'],qs[_0x381a('0x3f')](_0x33cf45[_0x381a('0x3a')][_0x381a('0x3f')]));_0x547b09[_0x381a('0x3e')]=_0x547b09[_0x381a('0x3e')][_0x381a('0x40')]?_0x547b09['attributes']:_0x23f9eb[_0x381a('0x39')];_0x547b09['order']=qs['sort'](_0x33cf45[_0x381a('0x3a')]['sort']);_0x547b09[_0x381a('0x46')]=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x33cf45['query'],_0x23f9eb['filters']));if(_0x33cf45[_0x381a('0x3a')][_0x381a('0x29')]){_0x547b09[_0x381a('0x46')]=_[_0x381a('0x47')](_0x547b09[_0x381a('0x46')],{'$or':_[_0x381a('0x2b')](_0x547b09[_0x381a('0x3e')],function(_0x4bf4e5){var _0x42778c={};_0x42778c[_0x4bf4e5]={'$like':'%'+_0x33cf45[_0x381a('0x3a')][_0x381a('0x29')]+'%'};return _0x42778c;})});}_0x547b09=_[_0x381a('0x47')]({},_0x547b09,_0x33cf45[_0x381a('0x49')]);return _0x20ac7c['getLists'](_0x547b09);}})[_0x381a('0x2f')](function(_0x4294a3){if(_0x4294a3){_0x4cf2c6=_0x4294a3[_0x381a('0x40')];if(!_0x33cf45[_0x381a('0x3a')]['hasOwnProperty']('nolimit')){_0x547b09[_0x381a('0x20')]=qs[_0x381a('0x20')](_0x33cf45['query']['limit']);_0x547b09[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x33cf45['query'][_0x381a('0x1f')]);}return _0x20ac7c[_0x381a('0x98')](_0x547b09);}})[_0x381a('0x2f')](function(_0x5b9dad){if(_0x5b9dad){return _0x5b9dad?{'count':_0x4cf2c6,'rows':_0x5b9dad}:null;}})[_0x381a('0x2f')](respondWithResult(_0x156448,null))[_0x381a('0x4f')](handleError(_0x156448,null));};exports['addLists']=function(_0x3ebc0f,_0x13baec,_0x35d4a1){var _0xe9248b,_0xa734aa;return db['VoiceQueue'][_0x381a('0x52')]({'where':{'id':_0x3ebc0f['params']['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x13baec,null))[_0x381a('0x2f')](function(_0x3b96d7){if(_0x3b96d7){_0xa734aa=_0x3b96d7;return _0x3b96d7['addLists'](_0x3ebc0f[_0x381a('0x54')][_0x381a('0x8e')],_['omit'](_0x3ebc0f[_0x381a('0x54')],[_0x381a('0x8e'),'id'])||{});}return null;})[_0x381a('0x9a')](function(_0x26f019){var _0x130277;_0xe9248b=_0x26f019||[];var _0x1e8b01=[];if(_0x26f019){for(var _0x5c55dd=0x0;_0x5c55dd<_0x26f019[_0x381a('0x40')];_0x5c55dd+=0x1){var _0x3ede6a=_0x26f019[_0x5c55dd][_0x381a('0x56')]({'plain':!![]});_0xa734aa['dialCheckDuplicateType']=_0x3ebc0f[_0x381a('0x54')][_0x381a('0x9b')]?_0x3ebc0f[_0x381a('0x54')][_0x381a('0x9b')]:_0xa734aa['dialCheckDuplicateType'];switch(_0xa734aa[_0x381a('0x9b')]){case _0x381a('0x9c'):_0x130277=squel['insert']()[_0x381a('0x9d')]('cm_hopper')['fromQuery']([_0x381a('0x9e'),_0x381a('0x9f'),_0x381a('0xa0'),_0x381a('0xa1'),_0x381a('0x66'),_0x381a('0x5f'),'updatedAt'],squel[_0x381a('0x83')]()['field']('phone','phone')[_0x381a('0xa2')](_0x381a('0xa3'),_0x381a('0x9f'))[_0x381a('0xa2')]('id',_0x381a('0xa0'))[_0x381a('0xa2')](_0x3ede6a[_0x381a('0xa4')][_0x381a('0x8a')](),_0x381a('0xa1'))['field'](_0x3ebc0f[_0x381a('0x51')]['id']['toString'](),'VoiceQueueId')[_0x381a('0xa2')](_0x381a('0xa3'),'createdAt')[_0x381a('0xa2')]('NOW()',_0x381a('0x60'))['from'](_0x381a('0xa5'))['where'](_0x381a('0xa6'))[_0x381a('0x46')](_0x381a('0xa7'),_0x3ede6a[_0x381a('0xa4')][_0x381a('0x8a')]())[_0x381a('0x46')](_0x381a('0xa8'))['where'](_0x381a('0xa9'),squel[_0x381a('0x83')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x381a('0x84')](_0x381a('0xaa'))[_0x381a('0x46')]('VoiceQueueId\x20=\x20?',_0x3ebc0f[_0x381a('0x51')]['id'][_0x381a('0x8a')]()))[_0x381a('0x46')](_0x381a('0xa9'),squel['select']()[_0x381a('0xa2')](_0x381a('0xab'))[_0x381a('0x84')](_0x381a('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x3ebc0f['params']['id']['toString']())))[_0x381a('0x8a')]();break;case _0x381a('0xad'):_0x130277=squel[_0x381a('0xae')]()['into'](_0x381a('0xac'))[_0x381a('0xaf')](['phone','scheduledAt',_0x381a('0xa0'),'ListId',_0x381a('0x66'),_0x381a('0x5f'),'updatedAt'],squel['select']()[_0x381a('0xa2')](_0x381a('0x9e'),_0x381a('0x9e'))[_0x381a('0xa2')](_0x381a('0xa3'),_0x381a('0x9f'))[_0x381a('0xa2')]('id',_0x381a('0xa0'))[_0x381a('0xa2')](_0x3ede6a[_0x381a('0xa4')]['toString'](),_0x381a('0xa1'))['field'](_0x3ebc0f[_0x381a('0x51')]['id'][_0x381a('0x8a')](),_0x381a('0x66'))[_0x381a('0xa2')](_0x381a('0xa3'),_0x381a('0x5f'))['field'](_0x381a('0xa3'),_0x381a('0x60'))[_0x381a('0x84')](_0x381a('0xa5'))[_0x381a('0x46')]('deletedAt\x20IS\x20NULL')[_0x381a('0x46')](_0x381a('0xa7'),_0x3ede6a[_0x381a('0xa4')][_0x381a('0x8a')]())['where'](_0x381a('0xa8'))['where'](_0x381a('0xa9'),squel['select']()[_0x381a('0xa2')](_0x381a('0xab'))[_0x381a('0x84')](_0x381a('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x3ebc0f[_0x381a('0x51')]['id'][_0x381a('0x8a')]())))[_0x381a('0x8a')]();break;default:_0x130277=squel[_0x381a('0xae')]()['into'](_0x381a('0xac'))[_0x381a('0xaf')]([_0x381a('0x9e'),_0x381a('0x9f'),_0x381a('0xa0'),_0x381a('0xa1'),'VoiceQueueId',_0x381a('0x5f'),_0x381a('0x60')],squel['select']()['field'](_0x381a('0x9e'),_0x381a('0x9e'))['field']('NOW()',_0x381a('0x9f'))['field']('id','ContactId')[_0x381a('0xa2')](_0x3ede6a[_0x381a('0xa4')][_0x381a('0x8a')](),_0x381a('0xa1'))[_0x381a('0xa2')](_0x3ebc0f[_0x381a('0x51')]['id'][_0x381a('0x8a')](),_0x381a('0x66'))['field']('NOW()',_0x381a('0x5f'))[_0x381a('0xa2')](_0x381a('0xa3'),'updatedAt')['from'](_0x381a('0xa5'))[_0x381a('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x381a('0xa7'),_0x3ede6a[_0x381a('0xa4')][_0x381a('0x8a')]())[_0x381a('0x46')](_0x381a('0xa8')))[_0x381a('0x8a')]();}_0x1e8b01[_0x381a('0x89')](db[_0x381a('0x78')][_0x381a('0x3a')](_0x130277));}return BPromise[_0x381a('0x8c')](_0x1e8b01);}})[_0x381a('0x2f')](function(){return _0xe9248b;})[_0x381a('0x2f')](respondWithResult(_0x13baec,null))[_0x381a('0x4f')](handleError(_0x13baec,null));};exports[_0x381a('0xb0')]=function(_0x59dadc,_0x22f295,_0x4b1db3){return db[_0x381a('0x4c')][_0x381a('0x52')]({'where':{'id':_0x59dadc[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x22f295,null))[_0x381a('0x2f')](function(_0x1e9b82){if(_0x1e9b82){return _0x1e9b82[_0x381a('0xb0')](_0x59dadc[_0x381a('0x3a')][_0x381a('0x8e')]);}})[_0x381a('0x2f')](function(_0x5ba756){if(_0x5ba756){return db[_0x381a('0x65')][_0x381a('0x26')]({'where':{'ListId':_0x59dadc[_0x381a('0x3a')][_0x381a('0x8e')],'VoiceQueueId':_0x59dadc[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](function(){return _0x5ba756;});}})[_0x381a('0x2f')](respondWithStatusCode(_0x22f295,null))[_0x381a('0x4f')](handleError(_0x22f295,null));};exports['getBlackLists']=function(_0x14eee1,_0x14fcce,_0xdd6252){var _0x12ea66={};var _0x1753d8={};var _0x3b1b10;var _0x8dad12;return db[_0x381a('0x4c')][_0x381a('0x64')]({'where':{'id':_0x14eee1[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x14fcce,null))[_0x381a('0x2f')](function(_0x4210ff){if(_0x4210ff){_0x3b1b10=_0x4210ff;_0x1753d8[_0x381a('0x39')]=_['keys'](db[_0x381a('0x99')][_0x381a('0x35')]);_0x1753d8[_0x381a('0x3a')]=_[_0x381a('0x3b')](_0x14eee1[_0x381a('0x3a')]);_0x1753d8[_0x381a('0x3c')]=_[_0x381a('0x3d')](_0x1753d8[_0x381a('0x39')],_0x1753d8[_0x381a('0x3a')]);_0x12ea66['attributes']=_[_0x381a('0x3d')](_0x1753d8[_0x381a('0x39')],qs['fields'](_0x14eee1[_0x381a('0x3a')][_0x381a('0x3f')]));_0x12ea66[_0x381a('0x3e')]=_0x12ea66[_0x381a('0x3e')][_0x381a('0x40')]?_0x12ea66['attributes']:_0x1753d8['model'];_0x12ea66[_0x381a('0x43')]=qs[_0x381a('0x44')](_0x14eee1[_0x381a('0x3a')][_0x381a('0x44')]);_0x12ea66[_0x381a('0x46')]=qs[_0x381a('0x3c')](_[_0x381a('0x45')](_0x14eee1[_0x381a('0x3a')],_0x1753d8[_0x381a('0x3c')]));if(_0x14eee1[_0x381a('0x3a')][_0x381a('0x29')]){_0x12ea66[_0x381a('0x46')]=_[_0x381a('0x47')](_0x12ea66['where'],{'$or':_[_0x381a('0x2b')](_0x12ea66[_0x381a('0x3e')],function(_0x54c434){var _0x5769cb={};_0x5769cb[_0x54c434]={'$like':'%'+_0x14eee1[_0x381a('0x3a')][_0x381a('0x29')]+'%'};return _0x5769cb;})});}_0x12ea66=_['merge']({},_0x12ea66,_0x14eee1[_0x381a('0x49')]);return _0x3b1b10[_0x381a('0xb1')](_0x12ea66);}})[_0x381a('0x2f')](function(_0x58984d){if(_0x58984d){_0x8dad12=_0x58984d[_0x381a('0x40')];if(!_0x14eee1['query']['hasOwnProperty'](_0x381a('0x42'))){_0x12ea66['limit']=qs['limit'](_0x14eee1[_0x381a('0x3a')]['limit']);_0x12ea66[_0x381a('0x1f')]=qs[_0x381a('0x1f')](_0x14eee1['query'][_0x381a('0x1f')]);}return _0x3b1b10[_0x381a('0xb1')](_0x12ea66);}})[_0x381a('0x2f')](function(_0x43e048){if(_0x43e048){return _0x43e048?{'count':_0x8dad12,'rows':_0x43e048}:null;}})[_0x381a('0x2f')](respondWithResult(_0x14fcce,null))[_0x381a('0x4f')](handleError(_0x14fcce,null));};exports[_0x381a('0xb2')]=function(_0x9a49be,_0x1f9bce,_0x27246c){var _0x2eb78a,_0x1b080c;return db[_0x381a('0x4c')][_0x381a('0x52')]({'where':{'id':_0x9a49be[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x1f9bce,null))[_0x381a('0x2f')](function(_0x2a55a5){if(_0x2a55a5){_0x1b080c=_0x2a55a5;return _0x2a55a5[_0x381a('0xb2')](_0x9a49be[_0x381a('0x54')][_0x381a('0x8e')],_[_0x381a('0x5e')](_0x9a49be[_0x381a('0x54')],[_0x381a('0x8e'),'id'])||{});}return null;})['spread'](function(_0x30145a){var _0x5b522c;_0x2eb78a=_0x30145a||[];var _0x3cbcad=[];if(_0x30145a){for(var _0x5bd639=0x0;_0x5bd639<_0x30145a[_0x381a('0x40')];_0x5bd639+=0x1){var _0x5e3e95=_0x30145a[_0x5bd639][_0x381a('0x56')]({'plain':!![]});_0x5b522c=squel['insert']()[_0x381a('0x9d')](_0x381a('0xb3'))['fromQuery']([_0x381a('0x9e'),_0x381a('0xa0'),'ListId','VoiceQueueId','createdAt',_0x381a('0x60')],squel['select']()['field']('phone',_0x381a('0x9e'))[_0x381a('0xa2')]('id',_0x381a('0xa0'))['field'](_0x5e3e95[_0x381a('0xa4')][_0x381a('0x8a')](),_0x381a('0xa1'))[_0x381a('0xa2')](_0x9a49be[_0x381a('0x51')]['id'][_0x381a('0x8a')](),_0x381a('0x66'))[_0x381a('0xa2')]('NOW()',_0x381a('0x5f'))[_0x381a('0xa2')](_0x381a('0xa3'),_0x381a('0x60'))[_0x381a('0x84')](_0x381a('0xa5'))['where'](_0x381a('0xa6'))[_0x381a('0x46')](_0x381a('0xa7'),_0x5e3e95[_0x381a('0xa4')][_0x381a('0x8a')]())[_0x381a('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x381a('0x8a')]();_0x3cbcad[_0x381a('0x89')](db[_0x381a('0x78')]['query'](_0x5b522c));}return BPromise[_0x381a('0x8c')](_0x3cbcad);}})['then'](function(){return _0x2eb78a;})['then'](respondWithResult(_0x1f9bce,null))['catch'](handleError(_0x1f9bce,null));};exports['removeBlackLists']=function(_0x405afa,_0x488c64,_0x7c05e3){return db[_0x381a('0x4c')]['find']({'where':{'id':_0x405afa[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](handleEntityNotFound(_0x488c64,null))[_0x381a('0x2f')](function(_0x4f6ee4){if(_0x4f6ee4){return _0x4f6ee4[_0x381a('0xb4')](_0x405afa['query'][_0x381a('0x8e')]);}})[_0x381a('0x2f')](function(_0x353822){if(_0x353822){return db['CmHopperBlack'][_0x381a('0x26')]({'where':{'ListId':_0x405afa[_0x381a('0x3a')][_0x381a('0x8e')],'VoiceQueueId':_0x405afa[_0x381a('0x51')]['id']}})[_0x381a('0x2f')](function(){return _0x353822;});}})[_0x381a('0x2f')](respondWithStatusCode(_0x488c64,null))[_0x381a('0x4f')](handleError(_0x488c64,null));}; \ No newline at end of file +var _0x360e=['findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','isNil','format','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isEmpty','online','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','fromQuery','ContactId','ListId','updatedAt','phone','NOW()','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','limit','set','reject','save','update','destroy','then','get','VoiceQueues','inbound','ignore','map','value','includes','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','VoiceQueue','findAll','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','QueueCampaigns','getHoppers'];(function(_0x596de3,_0xf801c0){var _0xbf541f=function(_0x3b7460){while(--_0x3b7460){_0x596de3['push'](_0x596de3['shift']());}};_0xbf541f(++_0xf801c0);}(_0x360e,0x113));var _0xe360=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x360e[_0x82129b];return _0x2ae5dc;};'use strict';var pdf=require(_0xe360('0x0'));var emlformat=require(_0xe360('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe360('0x2'));var jsonpatch=require(_0xe360('0x3'));var rp=require(_0xe360('0x4'));var moment=require(_0xe360('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe360('0x6'));var util=require(_0xe360('0x7'));var path=require(_0xe360('0x8'));var sox=require(_0xe360('0x9'));var csv=require('to-csv');var ejs=require(_0xe360('0xa'));var fs=require('fs');var _=require(_0xe360('0xb'));var squel=require(_0xe360('0xc'));var crypto=require(_0xe360('0xd'));var jsforce=require(_0xe360('0xe'));var deskjs=require(_0xe360('0xf'));var toCsv=require(_0xe360('0x10'));var querystring=require('querystring');var Papa=require(_0xe360('0x11'));var Redis=require(_0xe360('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe360('0x13'));var as=require(_0xe360('0x14'));var hardwareService=require(_0xe360('0x15'));var logger=require(_0xe360('0x16'))(_0xe360('0x17'));var utils=require(_0xe360('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe360('0x19'));var db=require(_0xe360('0x1a'))['db'];config['redis']=_[_0xe360('0x1b')](config[_0xe360('0x1c')],{'host':_0xe360('0x1d'),'port':0x18eb});var socket=require(_0xe360('0x1e'))(new Redis(config[_0xe360('0x1c')]));require(_0xe360('0x1f'))[_0xe360('0x20')](socket);function respondWithStatusCode(_0x1012ee,_0xdca0db){_0xdca0db=_0xdca0db||0xcc;return function(_0x8c1e0b){if(_0x8c1e0b){return _0x1012ee[_0xe360('0x21')](_0xdca0db);}return _0x1012ee['status'](_0xdca0db)[_0xe360('0x22')]();};}function respondWithResult(_0x33cc2e,_0x17e9e6){_0x17e9e6=_0x17e9e6||0xc8;return function(_0x3d674e){if(_0x3d674e){return _0x33cc2e[_0xe360('0x23')](_0x17e9e6)[_0xe360('0x24')](_0x3d674e);}};}function respondWithFilteredResult(_0x4df0d2,_0x29355b){return function(_0xb0a56a){if(_0xb0a56a){var _0x4a738e=_0xb0a56a['count'],_0x11cdb7=_0x29355b[_0xe360('0x25')],_0x5e849b=_0x29355b[_0xe360('0x25')]+_0x29355b[_0xe360('0x26')],_0x36204f;if(_0x5e849b>=_0x4a738e){_0x5e849b=_0x4a738e;_0x36204f=0xc8;}else{_0x36204f=0xce;}_0x4df0d2['status'](_0x36204f);return _0x4df0d2[_0xe360('0x27')]('Content-Range',_0x11cdb7+'-'+_0x5e849b+'/'+_0x4a738e)['json'](_0xb0a56a);}return null;};}function patchUpdates(_0x511a25){return function(_0x5a05d9){try{jsonpatch['apply'](_0x5a05d9,_0x511a25,!![]);}catch(_0x251bb1){return BPromise[_0xe360('0x28')](_0x251bb1);}return _0x5a05d9[_0xe360('0x29')]();};}function saveUpdates(_0x57a827,_0x25d474){return function(_0x109e6b){if(_0x109e6b){return _0x109e6b[_0xe360('0x2a')](_0x57a827)['then'](function(_0x3662fb){return _0x3662fb;});}return null;};}function removeEntity(_0x5e7ae8,_0xdf6c1b){return function(_0x7ecdaa){if(_0x7ecdaa){return _0x7ecdaa[_0xe360('0x2b')]()[_0xe360('0x2c')](function(){var _0x253d71=_0x7ecdaa[_0xe360('0x2d')]({'plain':!![]});var _0xdc5c5c=[{'name':_0xe360('0x2e'),'value':_0xe360('0x2f'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x18e375=_(_0xdc5c5c)['filter'](_0xe360('0x30'))[_0xe360('0x31')](_0xe360('0x32'))[_0xe360('0x32')]();if(_[_0xe360('0x33')](_0x18e375,_0x253d71['type'])){return;}var _0xe5aa38=_[_0xe360('0x34')](_0xdc5c5c,['value',_0x253d71['type']])[_0xe360('0x35')];return db[_0xe360('0x36')][_0xe360('0x2b')]({'where':{'type':_0xe5aa38,'resourceId':_0x253d71['id']}})[_0xe360('0x2c')](function(){return _0x7ecdaa;});})[_0xe360('0x2c')](function(){_0x5e7ae8[_0xe360('0x23')](0xcc)[_0xe360('0x22')]();});}};}function handleEntityNotFound(_0x5038df,_0x58bf6b){return function(_0x5abe66){if(!_0x5abe66){_0x5038df[_0xe360('0x21')](0x194);}return _0x5abe66;};}function handleError(_0x2737af,_0x87a340){_0x87a340=_0x87a340||0x1f4;return function(_0x20a3bc){logger[_0xe360('0x37')](_0x20a3bc[_0xe360('0x38')]);if(_0x20a3bc[_0xe360('0x35')]){delete _0x20a3bc[_0xe360('0x35')];}_0x2737af['status'](_0x87a340)[_0xe360('0x39')](_0x20a3bc);};}exports[_0xe360('0x3a')]=function(_0x73b26b,_0x2805e0){var _0x35c1d4={},_0x34642c={},_0x3237fa={'count':0x0,'rows':[]};var _0x4f2f30=_[_0xe360('0x31')](db['VoiceQueue'][_0xe360('0x3b')],function(_0x23c09b){return{'name':_0x23c09b[_0xe360('0x3c')],'type':_0x23c09b[_0xe360('0x3d')]['key']};});_0x34642c[_0xe360('0x3e')]=_[_0xe360('0x31')](_0x4f2f30,_0xe360('0x35'));_0x34642c[_0xe360('0x3f')]=_[_0xe360('0x40')](_0x73b26b['query']);_0x34642c[_0xe360('0x41')]=_[_0xe360('0x42')](_0x34642c[_0xe360('0x3e')],_0x34642c['query']);_0x35c1d4[_0xe360('0x43')]=_[_0xe360('0x42')](_0x34642c[_0xe360('0x3e')],qs[_0xe360('0x44')](_0x73b26b[_0xe360('0x3f')][_0xe360('0x44')]));_0x35c1d4[_0xe360('0x43')]=_0x35c1d4['attributes'][_0xe360('0x45')]?_0x35c1d4[_0xe360('0x43')]:_0x34642c['model'];if(!_0x73b26b['query'][_0xe360('0x46')](_0xe360('0x47'))){_0x35c1d4[_0xe360('0x26')]=qs['limit'](_0x73b26b[_0xe360('0x3f')]['limit']);_0x35c1d4[_0xe360('0x25')]=qs[_0xe360('0x25')](_0x73b26b[_0xe360('0x3f')]['offset']);}_0x35c1d4[_0xe360('0x48')]=qs[_0xe360('0x49')](_0x73b26b['query'][_0xe360('0x49')]);_0x35c1d4[_0xe360('0x4a')]=qs['filters'](_[_0xe360('0x4b')](_0x73b26b[_0xe360('0x3f')],_0x34642c[_0xe360('0x41')]),_0x4f2f30);if(_0x73b26b[_0xe360('0x3f')][_0xe360('0x4c')]){_0x35c1d4[_0xe360('0x4a')]=_['merge'](_0x35c1d4['where'],{'$or':_['map'](_0x4f2f30,function(_0x211cfd){if(_0x211cfd[_0xe360('0x3d')]!=='VIRTUAL'){var _0x27fc91={};_0x27fc91[_0x211cfd[_0xe360('0x35')]]={'$like':'%'+_0x73b26b['query'][_0xe360('0x4c')]+'%'};return _0x27fc91;}})});}_0x35c1d4=_[_0xe360('0x4d')]({},_0x35c1d4,_0x73b26b[_0xe360('0x4e')]);var _0xaf0f4f={'where':_0x35c1d4[_0xe360('0x4a')]};return db['VoiceQueue'][_0xe360('0x4f')](_0xaf0f4f)[_0xe360('0x2c')](function(_0x19bdf9){_0x3237fa[_0xe360('0x4f')]=_0x19bdf9;if(_0x73b26b[_0xe360('0x3f')]['includeAll']){_0x35c1d4[_0xe360('0x50')]=[{'all':!![]}];}return db[_0xe360('0x51')][_0xe360('0x52')](_0x35c1d4);})[_0xe360('0x2c')](function(_0x5055d3){_0x3237fa['rows']=_0x5055d3;return _0x3237fa;})[_0xe360('0x2c')](respondWithFilteredResult(_0x2805e0,_0x35c1d4))['catch'](handleError(_0x2805e0,null));};exports[_0xe360('0x53')]=function(_0x3d6df5,_0x4a3e69){var _0x314724={'raw':![],'where':{'id':_0x3d6df5[_0xe360('0x54')]['id']}},_0x3e6413={};_0x3e6413[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x51')][_0xe360('0x3b')]);_0x3e6413[_0xe360('0x3f')]=_[_0xe360('0x40')](_0x3d6df5[_0xe360('0x3f')]);_0x3e6413[_0xe360('0x41')]=_[_0xe360('0x42')](_0x3e6413[_0xe360('0x3e')],_0x3e6413[_0xe360('0x3f')]);_0x314724[_0xe360('0x43')]=_[_0xe360('0x42')](_0x3e6413['model'],qs[_0xe360('0x44')](_0x3d6df5[_0xe360('0x3f')]['fields']));_0x314724[_0xe360('0x43')]=_0x314724['attributes'][_0xe360('0x45')]?_0x314724[_0xe360('0x43')]:_0x3e6413[_0xe360('0x3e')];if(_0x3d6df5[_0xe360('0x3f')]['includeAll']){_0x314724[_0xe360('0x50')]=[{'all':!![]}];}_0x314724=_['merge']({},_0x314724,_0x3d6df5[_0xe360('0x4e')]);return db[_0xe360('0x51')][_0xe360('0x34')](_0x314724)[_0xe360('0x2c')](handleEntityNotFound(_0x4a3e69,null))[_0xe360('0x2c')](respondWithResult(_0x4a3e69,null))[_0xe360('0x55')](handleError(_0x4a3e69,null));};exports[_0xe360('0x56')]=function(_0xdc6cf3,_0x4071c3){return db[_0xe360('0x51')][_0xe360('0x56')](_0xdc6cf3[_0xe360('0x57')],{})[_0xe360('0x2c')](function(_0x1208d5){var _0x2ea759=_0xdc6cf3[_0xe360('0x58')]['get']({'plain':!![]});if(!_0x2ea759)throw new Error(_0xe360('0x59'));if(_0x2ea759[_0xe360('0x5a')]===_0xe360('0x58')){var _0x464902=_0x1208d5[_0xe360('0x2d')]({'plain':!![]});var _0x2751dd=[{'name':_0xe360('0x2e'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x1ec48e=_[_0xe360('0x34')](_0x2751dd,[_0xe360('0x32'),_0x464902[_0xe360('0x3d')]])[_0xe360('0x35')];return db[_0xe360('0x5b')]['find']({'where':{'name':_0x1ec48e,'userProfileId':_0x2ea759[_0xe360('0x5c')]},'raw':!![]})[_0xe360('0x2c')](function(_0x5a4bb4){if(_0x5a4bb4&&_0x5a4bb4[_0xe360('0x5d')]===0x0){return db[_0xe360('0x36')][_0xe360('0x56')]({'name':_0x464902[_0xe360('0x35')],'resourceId':_0x464902['id'],'type':_0x5a4bb4[_0xe360('0x35')],'sectionId':_0x5a4bb4['id']},{})['then'](function(){return _0x1208d5;});}else{return _0x1208d5;}})[_0xe360('0x55')](function(_0x409eb1){logger[_0xe360('0x37')](_0xe360('0x5e'),_0x409eb1);throw _0x409eb1;});}return _0x1208d5;})[_0xe360('0x2c')](respondWithResult(_0x4071c3,0xc9))[_0xe360('0x55')](handleError(_0x4071c3,null));};exports[_0xe360('0x5f')]=function(_0x29913f,_0x35ab43){var _0x531049={'where':{'id':_0x29913f['params']['id']}},_0x415f83={};_0x415f83[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x51')][_0xe360('0x3b')]);_0x531049['attributes']=_['intersection'](_0x415f83[_0xe360('0x3e')],qs[_0xe360('0x44')](_0x29913f[_0xe360('0x3f')]['fields']));_0x531049['attributes']=_0x531049['attributes'][_0xe360('0x45')]?_0x531049['attributes']:_0x415f83[_0xe360('0x3e')];if(_0x29913f[_0xe360('0x3f')][_0xe360('0x60')]){_0x531049[_0xe360('0x50')]=[{'all':!![]}];}_0x531049=_['merge']({},_0x531049,_0x29913f[_0xe360('0x4e')]);return db[_0xe360('0x51')][_0xe360('0x34')](_0x531049)[_0xe360('0x2c')](handleEntityNotFound(_0x35ab43,null))[_0xe360('0x2c')](function(_0x1f84e4){if(_0x1f84e4){var _0x52007e=_0x1f84e4[_0xe360('0x2d')]({'plain':!![]});_0x52007e=qs[_0xe360('0x61')](_0x52007e,['id',_0xe360('0x62'),'updatedAt']);_0x29913f[_0xe360('0x57')]=_[_0xe360('0x61')](_0x29913f[_0xe360('0x57')],['id',_0xe360('0x62'),'updatedAt']);return db[_0xe360('0x51')]['create'](_[_0xe360('0x4d')](_0x52007e,_0x29913f['body']),{'include':_0x29913f[_0xe360('0x3f')][_0xe360('0x60')]?[{'all':!![]}]:undefined})[_0xe360('0x2c')](function(_0x141360){var _0x56aeb9=_0x29913f[_0xe360('0x58')][_0xe360('0x2d')]({'plain':!![]});if(!_0x56aeb9)throw new Error(_0xe360('0x59'));if(_0x56aeb9[_0xe360('0x5a')]==='user'){var _0x3e0647=_0x141360[_0xe360('0x2d')]({'plain':!![]});var _0x355233=[{'name':_0xe360('0x2e'),'value':_0xe360('0x2f')},{'name':_0xe360('0x63'),'value':'outbound'}];var _0x2c9ed5=_[_0xe360('0x34')](_0x355233,[_0xe360('0x32'),_0x3e0647[_0xe360('0x3d')]])[_0xe360('0x35')];return db[_0xe360('0x5b')][_0xe360('0x34')]({'where':{'name':_0x2c9ed5,'userProfileId':_0x56aeb9[_0xe360('0x5c')]},'raw':!![]})[_0xe360('0x2c')](function(_0x5b5290){if(_0x5b5290&&_0x5b5290[_0xe360('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e0647[_0xe360('0x35')],'resourceId':_0x3e0647['id'],'type':_0x5b5290[_0xe360('0x35')],'sectionId':_0x5b5290['id']},{})[_0xe360('0x2c')](function(){return _0x141360;});}else{return _0x141360;}})[_0xe360('0x55')](function(_0x24714d){logger['error'](_0xe360('0x5e'),_0x24714d);throw _0x24714d;});}return _0x141360;});}})['then'](respondWithResult(_0x35ab43,0xc9))[_0xe360('0x55')](handleError(_0x35ab43,null));};exports['update']=function(_0x320069,_0x37b679){if(_0x320069[_0xe360('0x57')]['id']){delete _0x320069[_0xe360('0x57')]['id'];}return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x320069[_0xe360('0x54')]['id']}})['then'](handleEntityNotFound(_0x37b679,null))[_0xe360('0x2c')](saveUpdates(_0x320069[_0xe360('0x57')],null))[_0xe360('0x2c')](respondWithResult(_0x37b679,null))[_0xe360('0x55')](handleError(_0x37b679,null));};exports[_0xe360('0x2b')]=function(_0x176fbc,_0x284b9a){return db[_0xe360('0x51')]['find']({'where':{'id':_0x176fbc['params']['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x284b9a,null))['then'](removeEntity(_0x284b9a,null))[_0xe360('0x55')](handleError(_0x284b9a,null));};exports[_0xe360('0x64')]=function(_0xc8bfd2,_0x16e56f,_0x164557){var _0x5f4c28={'raw':![],'where':{}};var _0x165001={};var _0x463243={'count':0x0,'rows':[]};return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0xc8bfd2[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x16e56f,null))[_0xe360('0x2c')](function(_0x3f9bda){if(_0x3f9bda){_0x165001[_0xe360('0x3e')]=_[_0xe360('0x40')](db['CmHopper']['rawAttributes']);_0x165001[_0xe360('0x3f')]=_[_0xe360('0x40')](_0xc8bfd2[_0xe360('0x3f')]);_0x165001[_0xe360('0x41')]=_[_0xe360('0x42')](_0x165001[_0xe360('0x3e')],_0x165001[_0xe360('0x3f')]);_0x5f4c28[_0xe360('0x43')]=_[_0xe360('0x42')](_0x165001[_0xe360('0x3e')],qs[_0xe360('0x44')](_0xc8bfd2[_0xe360('0x3f')][_0xe360('0x44')]));_0x5f4c28[_0xe360('0x43')]=_0x5f4c28[_0xe360('0x43')]['length']?_0x5f4c28[_0xe360('0x43')]:_0x165001[_0xe360('0x3e')];if(!_0xc8bfd2[_0xe360('0x3f')][_0xe360('0x46')]('nolimit')){_0x5f4c28[_0xe360('0x26')]=qs[_0xe360('0x26')](_0xc8bfd2[_0xe360('0x3f')][_0xe360('0x26')]);_0x5f4c28[_0xe360('0x25')]=qs[_0xe360('0x25')](_0xc8bfd2['query'][_0xe360('0x25')]);}_0x5f4c28['order']=qs['sort'](_0xc8bfd2[_0xe360('0x3f')]['sort']);_0x5f4c28[_0xe360('0x4a')]=qs[_0xe360('0x41')](_[_0xe360('0x4b')](_0xc8bfd2['query'],_0x165001['filters']));_0x5f4c28[_0xe360('0x4a')]['VoiceQueueId']=_0x3f9bda['id'];if(_0xc8bfd2[_0xe360('0x3f')][_0xe360('0x4c')]){_0x5f4c28['where']=_[_0xe360('0x4d')](_0x5f4c28[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x5f4c28[_0xe360('0x43')],function(_0x4190d3){var _0x34ff11={};_0x34ff11[_0x4190d3]={'$like':'%'+_0xc8bfd2['query']['filter']+'%'};return _0x34ff11;})});}_0x5f4c28=_[_0xe360('0x4d')]({},_0x5f4c28,_0xc8bfd2['options']);return db[_0xe360('0x66')][_0xe360('0x4f')]({'where':_0x5f4c28[_0xe360('0x4a')]})['then'](function(_0x28bdc1){_0x463243['count']=_0x28bdc1;if(_0xc8bfd2['query'][_0xe360('0x60')]){_0x5f4c28[_0xe360('0x50')]=[{'all':!![]}];}return db[_0xe360('0x66')][_0xe360('0x52')](_0x5f4c28);})['then'](function(_0x3b6599){_0x463243[_0xe360('0x67')]=_0x3b6599;return _0x463243;});}})[_0xe360('0x2c')](respondWithFilteredResult(_0x16e56f,_0x5f4c28))[_0xe360('0x55')](handleError(_0x16e56f,null));};exports[_0xe360('0x68')]=function(_0x3d6414,_0x47025b,_0x4ae47a){var _0x1b4c11={'raw':!![],'where':{}};var _0x2c59e5={};var _0x4161bf={'count':0x0,'rows':[]};return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0x3d6414[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x47025b,null))[_0xe360('0x2c')](function(_0x1e3cf1){if(_0x1e3cf1){_0x2c59e5[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x69')][_0xe360('0x3b')]);_0x2c59e5[_0xe360('0x3f')]=_['keys'](_0x3d6414[_0xe360('0x3f')]);_0x2c59e5[_0xe360('0x41')]=_[_0xe360('0x42')](_0x2c59e5[_0xe360('0x3e')],_0x2c59e5['query']);_0x1b4c11[_0xe360('0x43')]=_[_0xe360('0x42')](_0x2c59e5['model'],qs[_0xe360('0x44')](_0x3d6414[_0xe360('0x3f')]['fields']));_0x1b4c11[_0xe360('0x43')]=_0x1b4c11[_0xe360('0x43')][_0xe360('0x45')]?_0x1b4c11[_0xe360('0x43')]:_0x2c59e5[_0xe360('0x3e')];if(!_0x3d6414[_0xe360('0x3f')][_0xe360('0x46')](_0xe360('0x47'))){_0x1b4c11[_0xe360('0x26')]=qs[_0xe360('0x26')](_0x3d6414[_0xe360('0x3f')][_0xe360('0x26')]);_0x1b4c11[_0xe360('0x25')]=qs[_0xe360('0x25')](_0x3d6414[_0xe360('0x3f')][_0xe360('0x25')]);}_0x1b4c11[_0xe360('0x48')]=qs[_0xe360('0x49')](_0x3d6414[_0xe360('0x3f')][_0xe360('0x49')]);_0x1b4c11[_0xe360('0x4a')]=qs['filters'](_[_0xe360('0x4b')](_0x3d6414['query'],_0x2c59e5[_0xe360('0x41')]));_0x1b4c11[_0xe360('0x4a')][_0xe360('0x6a')]=_0x1e3cf1['id'];if(_0x3d6414[_0xe360('0x3f')][_0xe360('0x4c')]){_0x1b4c11[_0xe360('0x4a')]=_[_0xe360('0x4d')](_0x1b4c11['where'],{'$or':_[_0xe360('0x31')](_0x1b4c11[_0xe360('0x43')],function(_0x402158){var _0x399f5c={};_0x399f5c[_0x402158]={'$like':'%'+_0x3d6414['query'][_0xe360('0x4c')]+'%'};return _0x399f5c;})});}_0x1b4c11=_[_0xe360('0x4d')]({},_0x1b4c11,_0x3d6414[_0xe360('0x4e')]);return db[_0xe360('0x69')]['count']({'where':_0x1b4c11['where']})['then'](function(_0x2c105e){_0x4161bf[_0xe360('0x4f')]=_0x2c105e;if(_0x3d6414[_0xe360('0x3f')][_0xe360('0x60')]){_0x1b4c11['include']=[{'all':!![]}];}return db[_0xe360('0x69')]['findAll'](_0x1b4c11);})[_0xe360('0x2c')](function(_0x9d095e){_0x4161bf['rows']=_0x9d095e;return _0x4161bf;});}})[_0xe360('0x2c')](respondWithFilteredResult(_0x47025b,_0x1b4c11))[_0xe360('0x55')](handleError(_0x47025b,null));};exports['getHopperFinals']=function(_0x2c8149,_0xdf292e,_0x409bc3){var _0x4b1e7a={'raw':!![],'where':{}};var _0x4716c9={};var _0x43d635={'count':0x0,'rows':[]};return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0x2c8149[_0xe360('0x54')]['id']}})['then'](handleEntityNotFound(_0xdf292e,null))[_0xe360('0x2c')](function(_0x3d4e6f){if(_0x3d4e6f){_0x4716c9[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x6b')][_0xe360('0x3b')]);_0x4716c9[_0xe360('0x3f')]=_['keys'](_0x2c8149[_0xe360('0x3f')]);_0x4716c9[_0xe360('0x41')]=_[_0xe360('0x42')](_0x4716c9['model'],_0x4716c9[_0xe360('0x3f')]);_0x4b1e7a['attributes']=_[_0xe360('0x42')](_0x4716c9[_0xe360('0x3e')],qs[_0xe360('0x44')](_0x2c8149[_0xe360('0x3f')][_0xe360('0x44')]));_0x4b1e7a[_0xe360('0x43')]=_0x4b1e7a[_0xe360('0x43')][_0xe360('0x45')]?_0x4b1e7a[_0xe360('0x43')]:_0x4716c9['model'];if(!_0x2c8149[_0xe360('0x3f')][_0xe360('0x46')](_0xe360('0x47'))){_0x4b1e7a[_0xe360('0x26')]=qs[_0xe360('0x26')](_0x2c8149[_0xe360('0x3f')][_0xe360('0x26')]);_0x4b1e7a['offset']=qs[_0xe360('0x25')](_0x2c8149[_0xe360('0x3f')][_0xe360('0x25')]);}_0x4b1e7a[_0xe360('0x48')]=qs['sort'](_0x2c8149[_0xe360('0x3f')][_0xe360('0x49')]);_0x4b1e7a['where']=qs['filters'](_[_0xe360('0x4b')](_0x2c8149[_0xe360('0x3f')],_0x4716c9['filters']));_0x4b1e7a[_0xe360('0x4a')][_0xe360('0x6a')]=_0x3d4e6f['id'];if(_0x2c8149['query'][_0xe360('0x4c')]){_0x4b1e7a[_0xe360('0x4a')]=_[_0xe360('0x4d')](_0x4b1e7a[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x4b1e7a['attributes'],function(_0x404af2){var _0x558f71={};_0x558f71[_0x404af2]={'$like':'%'+_0x2c8149[_0xe360('0x3f')][_0xe360('0x4c')]+'%'};return _0x558f71;})});}_0x4b1e7a=_[_0xe360('0x4d')]({},_0x4b1e7a,_0x2c8149[_0xe360('0x4e')]);return db['CmHopperFinal'][_0xe360('0x4f')]({'where':_0x4b1e7a['where']})[_0xe360('0x2c')](function(_0xde5d0b){_0x43d635['count']=_0xde5d0b;if(_0x2c8149[_0xe360('0x3f')][_0xe360('0x60')]){_0x4b1e7a[_0xe360('0x50')]=[{'all':!![]}];}return db[_0xe360('0x6b')][_0xe360('0x52')](_0x4b1e7a);})[_0xe360('0x2c')](function(_0x4e5337){_0x43d635[_0xe360('0x67')]=_0x4e5337;return _0x43d635;});}})['then'](respondWithFilteredResult(_0xdf292e,_0x4b1e7a))[_0xe360('0x55')](handleError(_0xdf292e,null));};exports['getHopperBlacks']=function(_0x682642,_0x40ad92,_0x236d98){var _0x5c87ff={'raw':!![],'where':{}};var _0x57d787={};var _0x36ffe7={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x682642[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x40ad92,null))[_0xe360('0x2c')](function(_0x387a15){if(_0x387a15){_0x57d787[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x6c')][_0xe360('0x3b')]);_0x57d787[_0xe360('0x3f')]=_[_0xe360('0x40')](_0x682642['query']);_0x57d787[_0xe360('0x41')]=_[_0xe360('0x42')](_0x57d787[_0xe360('0x3e')],_0x57d787[_0xe360('0x3f')]);_0x5c87ff[_0xe360('0x43')]=_['intersection'](_0x57d787[_0xe360('0x3e')],qs[_0xe360('0x44')](_0x682642[_0xe360('0x3f')][_0xe360('0x44')]));_0x5c87ff['attributes']=_0x5c87ff['attributes'][_0xe360('0x45')]?_0x5c87ff[_0xe360('0x43')]:_0x57d787[_0xe360('0x3e')];if(!_0x682642['query'][_0xe360('0x46')]('nolimit')){_0x5c87ff[_0xe360('0x26')]=qs['limit'](_0x682642[_0xe360('0x3f')][_0xe360('0x26')]);_0x5c87ff[_0xe360('0x25')]=qs['offset'](_0x682642['query'][_0xe360('0x25')]);}_0x5c87ff[_0xe360('0x48')]=qs['sort'](_0x682642[_0xe360('0x3f')][_0xe360('0x49')]);_0x5c87ff[_0xe360('0x4a')]=qs['filters'](_[_0xe360('0x4b')](_0x682642[_0xe360('0x3f')],_0x57d787['filters']));_0x5c87ff[_0xe360('0x4a')]['VoiceQueueId']=_0x387a15['id'];if(_0x682642[_0xe360('0x3f')][_0xe360('0x4c')]){_0x5c87ff[_0xe360('0x4a')]=_[_0xe360('0x4d')](_0x5c87ff['where'],{'$or':_[_0xe360('0x31')](_0x5c87ff[_0xe360('0x43')],function(_0x7ea65f){var _0x31979e={};_0x31979e[_0x7ea65f]={'$like':'%'+_0x682642[_0xe360('0x3f')]['filter']+'%'};return _0x31979e;})});}_0x5c87ff=_['merge']({},_0x5c87ff,_0x682642['options']);return db[_0xe360('0x6c')][_0xe360('0x4f')]({'where':_0x5c87ff['where']})['then'](function(_0x40c0d2){_0x36ffe7['count']=_0x40c0d2;if(_0x682642[_0xe360('0x3f')][_0xe360('0x60')]){_0x5c87ff[_0xe360('0x50')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe360('0x52')](_0x5c87ff);})['then'](function(_0x20e678){_0x36ffe7[_0xe360('0x67')]=_0x20e678;return _0x36ffe7;});}})[_0xe360('0x2c')](respondWithFilteredResult(_0x40ad92,_0x5c87ff))[_0xe360('0x55')](handleError(_0x40ad92,null));};exports[_0xe360('0x6d')]=function(_0x2ea7d9,_0x3785a6,_0x2c3651){var _0x1e5aac={};var _0x9e12cd={};var _0x5a0372;var _0x3ac318;return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0x2ea7d9[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x3785a6,null))[_0xe360('0x2c')](function(_0x6741fc){if(_0x6741fc){_0x5a0372=_0x6741fc;_0x9e12cd['model']=_[_0xe360('0x40')](db['Team'][_0xe360('0x3b')]);_0x9e12cd[_0xe360('0x3f')]=_['keys'](_0x2ea7d9[_0xe360('0x3f')]);_0x9e12cd[_0xe360('0x41')]=_[_0xe360('0x42')](_0x9e12cd[_0xe360('0x3e')],_0x9e12cd['query']);_0x1e5aac[_0xe360('0x43')]=_['intersection'](_0x9e12cd['model'],qs[_0xe360('0x44')](_0x2ea7d9['query'][_0xe360('0x44')]));_0x1e5aac[_0xe360('0x43')]=_0x1e5aac[_0xe360('0x43')][_0xe360('0x45')]?_0x1e5aac['attributes']:_0x9e12cd['model'];_0x1e5aac['order']=qs['sort'](_0x2ea7d9['query']['sort']);_0x1e5aac[_0xe360('0x4a')]=qs[_0xe360('0x41')](_[_0xe360('0x4b')](_0x2ea7d9[_0xe360('0x3f')],_0x9e12cd[_0xe360('0x41')]));if(_0x2ea7d9['query'][_0xe360('0x4c')]){_0x1e5aac['where']=_[_0xe360('0x4d')](_0x1e5aac[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x1e5aac[_0xe360('0x43')],function(_0x5f2f09){var _0x1a5b3f={};_0x1a5b3f[_0x5f2f09]={'$like':'%'+_0x2ea7d9[_0xe360('0x3f')]['filter']+'%'};return _0x1a5b3f;})});}_0x1e5aac=_['merge']({},_0x1e5aac,_0x2ea7d9[_0xe360('0x4e')]);return _0x5a0372[_0xe360('0x6d')](_0x1e5aac);}})[_0xe360('0x2c')](function(_0x2e1597){if(_0x2e1597){_0x3ac318=_0x2e1597[_0xe360('0x45')];if(!_0x2ea7d9['query'][_0xe360('0x46')](_0xe360('0x47'))){_0x1e5aac[_0xe360('0x26')]=qs['limit'](_0x2ea7d9[_0xe360('0x3f')]['limit']);_0x1e5aac[_0xe360('0x25')]=qs[_0xe360('0x25')](_0x2ea7d9['query']['offset']);}return _0x5a0372[_0xe360('0x6d')](_0x1e5aac);}})[_0xe360('0x2c')](function(_0x482ce1){if(_0x482ce1){return _0x482ce1?{'count':_0x3ac318,'rows':_0x482ce1}:null;}})[_0xe360('0x2c')](respondWithResult(_0x3785a6,null))[_0xe360('0x55')](handleError(_0x3785a6,null));};exports[_0xe360('0x6e')]=function(_0x1f11b8,_0x56eecc,_0x63427c){var _0x132a1c=_0x1f11b8[_0xe360('0x57')][_0xe360('0x6f')];var _0x126f11=_[_0xe360('0x31')](_0x132a1c,'id');return db[_0xe360('0x70')][_0xe360('0x52')]({'where':{'id':_0x126f11},'attributes':['id'],'include':[{'model':db[_0xe360('0x71')],'as':_0xe360('0x72'),'attributes':['id',_0xe360('0x35'),'online',_0xe360('0x73'),_0xe360('0x74')],'raw':!![]}]})['then'](function(_0x2f275e){if(_0x2f275e){var _0x6301b0=_['flatMap'](_0x2f275e,function(_0x11b229){var _0x272ecc=_0x11b229[_0xe360('0x2d')]({'plain':!![]});_0x272ecc[_0xe360('0x72')]['forEach'](function(_0x3c3403){_0x3c3403['penalty']=_['find'](_0x132a1c,{'id':_0x272ecc['id']})[_0xe360('0x75')];});return _0x272ecc[_0xe360('0x72')];});return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x1f11b8[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](function(_0x1d111a){return db[_0xe360('0x76')]['transaction'](function(_0x4f81c5){return _0x1d111a['addTeams'](_0x126f11,{'transaction':_0x4f81c5})[_0xe360('0x2c')](function(){return BPromise[_0xe360('0x77')](_0x132a1c,function(_0x5167c4){return db[_0xe360('0x78')][_0xe360('0x79')]({'TeamId':_0x5167c4['id'],'VoiceQueueId':_0x1f11b8[_0xe360('0x54')]['id'],'penalty':_0x5167c4[_0xe360('0x75')]},{'transaction':_0x4f81c5});});})[_0xe360('0x2c')](function(){return BPromise[_0xe360('0x77')](_0x6301b0,function(_0x20dac0){return db[_0xe360('0x7a')]['findOrCreate']({'where':{'UserId':_0x20dac0['id'],'VoiceQueueId':_0x1f11b8[_0xe360('0x54')]['id']},'defaults':{'penalty':_0x20dac0[_0xe360('0x75')]},'transaction':_0x4f81c5});});})[_0xe360('0x2c')](function(){return BPromise[_0xe360('0x77')](_[_0xe360('0x4c')](_0x6301b0,{'online':!![]}),function(_0x182001){return db['UserVoiceQueueRt'][_0xe360('0x79')]({'membername':_0x182001[_0xe360('0x35')],'UserId':_0x182001['id'],'queue_name':_0x1d111a[_0xe360('0x35')],'VoiceQueueId':_0x1d111a['id'],'interface':_[_0xe360('0x7b')](_0x182001[_0xe360('0x74')])?util[_0xe360('0x7c')]('SIP/%s',_0x182001[_0xe360('0x35')]):_0x182001[_0xe360('0x74')],'paused':_0x182001['voicePause']||![],'penalty':_0x182001[_0xe360('0x75')]},{'transaction':_0x4f81c5});});})['then'](function(){_0x6301b0[_0xe360('0x7d')](function(_0x454978){socket[_0xe360('0x7e')]('userVoiceQueue:save',{'UserId':_0x454978['id'],'VoiceQueueId':_0x1d111a['id']});});});});});}})['then'](respondWithStatusCode(_0x56eecc,null))['catch'](handleError(_0x56eecc,null));};exports[_0xe360('0x7f')]=function(_0x54392a,_0x551c18,_0x372b64){return db[_0xe360('0x70')][_0xe360('0x52')]({'where':{'id':_0x54392a[_0xe360('0x3f')][_0xe360('0x80')]},'attributes':['id'],'include':[{'model':db[_0xe360('0x71')],'as':_0xe360('0x72'),'attributes':['id'],'raw':!![]}]})[_0xe360('0x2c')](handleEntityNotFound(_0x551c18,null))[_0xe360('0x2c')](function(_0x393da3){var _0x13506d=_[_0xe360('0x31')](_0x393da3,'id');var _0x49351f=[];var _0x2799d6=[];var _0x215a61=squel[_0xe360('0x81')]();_0x215a61[_0xe360('0x82')](_0xe360('0x83'))[_0xe360('0x84')](_0xe360('0x85'),'tq')[_0xe360('0x86')](_0xe360('0x87'),'ut',_0xe360('0x88'))[_0xe360('0x4a')](_0xe360('0x89'),_0x54392a[_0xe360('0x54')]['id']);for(var _0x496c3a=0x0;_0x496c3a<_0x393da3[_0xe360('0x45')];_0x496c3a+=0x1){let _0x1132de=_0x393da3[_0x496c3a];for(var _0x13e103=0x0;_0x13e103<_0x1132de[_0xe360('0x72')][_0xe360('0x45')];_0x13e103+=0x1){let _0x2091cb=_0x1132de[_0xe360('0x72')][_0x13e103];var _0x17f295=_0x215a61['clone']();_0x17f295[_0xe360('0x4a')](_0xe360('0x8a'),_0x2091cb['id']);_0x2799d6[_0xe360('0x8b')](db[_0xe360('0x76')][_0xe360('0x3f')](_0x17f295['toString'](),{'type':db[_0xe360('0x76')][_0xe360('0x8c')][_0xe360('0x8d')]})['then'](function(_0x3d7450){if(_0x3d7450[_0xe360('0x45')]===0x1){return _0x2091cb['id'];}else{var _0x494b8d=_[_0xe360('0x8e')](_['map'](_0x3d7450,_0xe360('0x8f')),function(_0x2d9b03){return _[_0xe360('0x33')](_0x13506d,_0x2d9b03);});if(_0x494b8d){return _0x2091cb['id'];}}}));}}return BPromise[_0xe360('0x90')](_0x2799d6)[_0xe360('0x2c')](function(_0x47e210){_0x49351f=_(_0x49351f)[_0xe360('0x91')](_0x47e210)[_0xe360('0x92')]()[_0xe360('0x32')]();return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x54392a[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](function(_0x211bbb){return db[_0xe360('0x76')][_0xe360('0x93')](function(_0x1bef55){return _0x211bbb[_0xe360('0x7f')](_0x54392a['query'][_0xe360('0x80')],{'transaction':_0x1bef55})[_0xe360('0x2c')](function(){if(!_['isEmpty'](_0x49351f)){return _0x211bbb['removeAgents'](_0x49351f,{'transaction':_0x1bef55})[_0xe360('0x2c')](function(){return db[_0xe360('0x94')][_0xe360('0x2b')]({'where':{'VoiceQueueId':_0x54392a[_0xe360('0x54')]['id'],'UserId':_0x49351f},'transaction':_0x1bef55});});}})['then'](function(){_0x49351f[_0xe360('0x7d')](function(_0x4c256f){socket['emit'](_0xe360('0x95'),{'UserId':_0x4c256f,'VoiceQueueId':_0x211bbb['id']});});});});});});})[_0xe360('0x2c')](respondWithStatusCode(_0x551c18,null))[_0xe360('0x55')](handleError(_0x551c18,null));};exports[_0xe360('0x96')]=function(_0x93c4cc,_0x3fa39f,_0x3daeda){var _0x2147dc,_0x172598;return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x93c4cc[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x3fa39f,null))[_0xe360('0x2c')](function(_0x481854){if(_0x481854){_0x172598=_0x481854;return _0x481854[_0xe360('0x96')](_0x93c4cc[_0xe360('0x57')][_0xe360('0x80')],_[_0xe360('0x61')](_0x93c4cc['body'],[_0xe360('0x80'),'id'])||{})[_0xe360('0x97')](function(_0x151027){for(var _0x45d386=0x0;_0x45d386<_0x93c4cc['body'][_0xe360('0x80')]['length'];_0x45d386+=0x1){socket['emit'](_0xe360('0x98'),{'UserId':_0x93c4cc[_0xe360('0x57')]['ids'][_0x45d386],'VoiceQueueId':_0x93c4cc[_0xe360('0x54')]['id']});}return _0x151027;});}})[_0xe360('0x2c')](function(_0x344e84){_0x2147dc=_0x344e84||[];if(_0x172598){return db['User'][_0xe360('0x52')]({'where':{'id':_0x93c4cc[_0xe360('0x57')][_0xe360('0x80')]},'attributes':['id','name','online',_0xe360('0x73'),_0xe360('0x74')],'raw':!![]});}})[_0xe360('0x2c')](function(_0x5f39ca){if(!_[_0xe360('0x99')](_0x5f39ca)){var _0x2fb657=[];for(var _0x28d8b8=0x0;_0x28d8b8<_0x5f39ca[_0xe360('0x45')];_0x28d8b8++){if(_0x5f39ca[_0x28d8b8][_0xe360('0x9a')]){_0x2fb657[_0xe360('0x8b')](db[_0xe360('0x94')]['upsert']({'membername':_0x5f39ca[_0x28d8b8]['name'],'UserId':_0x5f39ca[_0x28d8b8]['id'],'queue_name':_0x172598['name'],'VoiceQueueId':_0x172598['id'],'interface':_['isNil'](_0x5f39ca[_0x28d8b8][_0xe360('0x74')])?util[_0xe360('0x7c')]('SIP/%s',_0x5f39ca[_0x28d8b8]['name']):_0x5f39ca[_0x28d8b8][_0xe360('0x74')],'paused':_0x5f39ca[_0x28d8b8][_0xe360('0x73')]||![],'penalty':_0x93c4cc[_0xe360('0x57')][_0xe360('0x75')]||0x0}));}}return BPromise[_0xe360('0x90')](_0x2fb657);}})[_0xe360('0x2c')](function(){return _0x2147dc;})[_0xe360('0x2c')](respondWithResult(_0x3fa39f,null))['catch'](handleError(_0x3fa39f,null));};exports[_0xe360('0x9b')]=function(_0x409004,_0x2ecf44,_0x3cb879){return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x409004[_0xe360('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ecf44,null))[_0xe360('0x2c')](function(_0x766a7b){if(_0x766a7b){return _0x766a7b[_0xe360('0x9b')](_0x409004[_0xe360('0x3f')][_0xe360('0x80')])['then'](function(){if(_['isArray'](_0x409004[_0xe360('0x3f')][_0xe360('0x80')])){for(var _0x4380b2=0x0;_0x4380b2<_0x409004[_0xe360('0x3f')][_0xe360('0x80')]['length'];_0x4380b2+=0x1){socket[_0xe360('0x7e')](_0xe360('0x95'),{'UserId':Number(_0x409004['query'][_0xe360('0x80')][_0x4380b2]),'VoiceQueueId':Number(_0x409004[_0xe360('0x54')]['id'])});}}else{socket[_0xe360('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x409004['query'][_0xe360('0x80')]),'VoiceQueueId':Number(_0x409004[_0xe360('0x54')]['id'])});}});}})['then'](function(_0x13c506){return db[_0xe360('0x94')]['destroy']({'where':{'VoiceQueueId':_0x409004[_0xe360('0x54')]['id'],'UserId':_0x409004[_0xe360('0x3f')][_0xe360('0x80')]}})[_0xe360('0x2c')](function(){return _0x13c506;});})[_0xe360('0x2c')](respondWithStatusCode(_0x2ecf44,null))['catch'](handleError(_0x2ecf44,null));};exports[_0xe360('0x9c')]=function(_0x35abd5,_0x3f5f26,_0x1c590f){var _0x1c093b={};var _0x30f22a={};var _0x5467f2;var _0x46dec1;return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0x35abd5['params']['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x3f5f26,null))[_0xe360('0x2c')](function(_0xa249e){if(_0xa249e){_0x5467f2=_0xa249e;_0x30f22a[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x71')]['rawAttributes']);_0x30f22a[_0xe360('0x3f')]=_[_0xe360('0x40')](_0x35abd5[_0xe360('0x3f')]);_0x30f22a[_0xe360('0x41')]=_[_0xe360('0x42')](_0x30f22a[_0xe360('0x3e')],_0x30f22a[_0xe360('0x3f')]);_0x1c093b['attributes']=_[_0xe360('0x42')](_0x30f22a[_0xe360('0x3e')],qs[_0xe360('0x44')](_0x35abd5[_0xe360('0x3f')]['fields']));_0x1c093b['attributes']=_0x1c093b[_0xe360('0x43')][_0xe360('0x45')]?_0x1c093b[_0xe360('0x43')]:_0x30f22a[_0xe360('0x3e')];_0x1c093b[_0xe360('0x48')]=qs['sort'](_0x35abd5[_0xe360('0x3f')][_0xe360('0x49')]);_0x1c093b[_0xe360('0x4a')]=qs['filters'](_['pick'](_0x35abd5['query'],_0x30f22a[_0xe360('0x41')]));if(_0x35abd5[_0xe360('0x3f')][_0xe360('0x4c')]){_0x1c093b[_0xe360('0x4a')]=_[_0xe360('0x4d')](_0x1c093b[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x1c093b[_0xe360('0x43')],function(_0x53a1b5){var _0x1bcbd3={};_0x1bcbd3[_0x53a1b5]={'$like':'%'+_0x35abd5[_0xe360('0x3f')][_0xe360('0x4c')]+'%'};return _0x1bcbd3;})});}_0x1c093b=_[_0xe360('0x4d')]({},_0x1c093b,_0x35abd5[_0xe360('0x4e')]);return _0x5467f2[_0xe360('0x9c')](_0x1c093b);}})['then'](function(_0x1299ae){if(_0x1299ae){_0x46dec1=_0x1299ae[_0xe360('0x45')];if(!_0x35abd5[_0xe360('0x3f')][_0xe360('0x46')](_0xe360('0x47'))){_0x1c093b['limit']=qs[_0xe360('0x26')](_0x35abd5[_0xe360('0x3f')][_0xe360('0x26')]);_0x1c093b['offset']=qs[_0xe360('0x25')](_0x35abd5[_0xe360('0x3f')]['offset']);}return _0x5467f2[_0xe360('0x9c')](_0x1c093b);}})['then'](function(_0xd10957){if(_0xd10957){return _0xd10957?{'count':_0x46dec1,'rows':_0xd10957}:null;}})['then'](respondWithResult(_0x3f5f26,null))[_0xe360('0x55')](handleError(_0x3f5f26,null));};exports[_0xe360('0x9d')]=function(_0xbf8155,_0x3eb6ba,_0x1eca6e){var _0x11ac17={};var _0x5e0073={};var _0x18c37f;var _0x1b6ae6;return db['VoiceQueue'][_0xe360('0x65')]({'where':{'id':_0xbf8155[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x3eb6ba,null))[_0xe360('0x2c')](function(_0x43701c){if(_0x43701c){_0x18c37f=_0x43701c;_0x5e0073[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x94')]['rawAttributes']);_0x5e0073[_0xe360('0x3f')]=_[_0xe360('0x40')](_0xbf8155['query']);_0x5e0073[_0xe360('0x41')]=_[_0xe360('0x42')](_0x5e0073[_0xe360('0x3e')],_0x5e0073['query']);_0x11ac17[_0xe360('0x43')]=_[_0xe360('0x42')](_0x5e0073['model'],qs[_0xe360('0x44')](_0xbf8155['query']['fields']));_0x11ac17['attributes']=_0x11ac17[_0xe360('0x43')][_0xe360('0x45')]?_0x11ac17[_0xe360('0x43')]:_0x5e0073[_0xe360('0x3e')];_0x11ac17[_0xe360('0x48')]=qs[_0xe360('0x49')](_0xbf8155[_0xe360('0x3f')][_0xe360('0x49')]);_0x11ac17['where']=qs[_0xe360('0x41')](_[_0xe360('0x4b')](_0xbf8155[_0xe360('0x3f')],_0x5e0073['filters']));if(_0xbf8155['query'][_0xe360('0x4c')]){_0x11ac17[_0xe360('0x4a')]=_['merge'](_0x11ac17[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x11ac17[_0xe360('0x43')],function(_0xddac71){var _0x442ee2={};_0x442ee2[_0xddac71]={'$like':'%'+_0xbf8155[_0xe360('0x3f')][_0xe360('0x4c')]+'%'};return _0x442ee2;})});}_0x11ac17=_[_0xe360('0x4d')]({},_0x11ac17,_0xbf8155[_0xe360('0x4e')]);return _0x18c37f[_0xe360('0x9d')](_0x11ac17);}})['then'](function(_0x2f57d2){if(_0x2f57d2){_0x1b6ae6=_0x2f57d2[_0xe360('0x45')];if(!_0xbf8155['query'][_0xe360('0x46')](_0xe360('0x47'))){_0x11ac17[_0xe360('0x26')]=qs[_0xe360('0x26')](_0xbf8155[_0xe360('0x3f')][_0xe360('0x26')]);_0x11ac17[_0xe360('0x25')]=qs['offset'](_0xbf8155[_0xe360('0x3f')]['offset']);}return _0x18c37f[_0xe360('0x9d')](_0x11ac17);}})[_0xe360('0x2c')](function(_0x4184c7){return _0x4184c7?{'count':_0x1b6ae6,'rows':_0x4184c7}:null;})[_0xe360('0x2c')](respondWithResult(_0x3eb6ba,null))[_0xe360('0x55')](handleError(_0x3eb6ba,null));};exports[_0xe360('0x9e')]=function(_0xfa33ae,_0x6e779e,_0x4dfb4a){var _0x1642a4={};var _0x3df50f={};var _0x4589c3;var _0x2edbce;return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0xfa33ae[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x6e779e,null))[_0xe360('0x2c')](function(_0x5dd861){if(_0x5dd861){_0x4589c3=_0x5dd861;_0x3df50f[_0xe360('0x3e')]=_[_0xe360('0x40')](db[_0xe360('0x9f')]['rawAttributes']);_0x3df50f[_0xe360('0x3f')]=_[_0xe360('0x40')](_0xfa33ae['query']);_0x3df50f[_0xe360('0x41')]=_[_0xe360('0x42')](_0x3df50f[_0xe360('0x3e')],_0x3df50f[_0xe360('0x3f')]);_0x1642a4[_0xe360('0x43')]=_[_0xe360('0x42')](_0x3df50f['model'],qs['fields'](_0xfa33ae[_0xe360('0x3f')][_0xe360('0x44')]));_0x1642a4['attributes']=_0x1642a4[_0xe360('0x43')][_0xe360('0x45')]?_0x1642a4['attributes']:_0x3df50f[_0xe360('0x3e')];_0x1642a4[_0xe360('0x48')]=qs[_0xe360('0x49')](_0xfa33ae['query'][_0xe360('0x49')]);_0x1642a4[_0xe360('0x4a')]=qs['filters'](_['pick'](_0xfa33ae['query'],_0x3df50f[_0xe360('0x41')]));if(_0xfa33ae['query']['filter']){_0x1642a4[_0xe360('0x4a')]=_[_0xe360('0x4d')](_0x1642a4[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0x1642a4[_0xe360('0x43')],function(_0xfa0e9){var _0xeacdae={};_0xeacdae[_0xfa0e9]={'$like':'%'+_0xfa33ae[_0xe360('0x3f')][_0xe360('0x4c')]+'%'};return _0xeacdae;})});}_0x1642a4=_[_0xe360('0x4d')]({},_0x1642a4,_0xfa33ae[_0xe360('0x4e')]);return _0x4589c3[_0xe360('0x9e')](_0x1642a4);}})['then'](function(_0x332d33){if(_0x332d33){_0x2edbce=_0x332d33[_0xe360('0x45')];if(!_0xfa33ae[_0xe360('0x3f')][_0xe360('0x46')](_0xe360('0x47'))){_0x1642a4[_0xe360('0x26')]=qs[_0xe360('0x26')](_0xfa33ae[_0xe360('0x3f')][_0xe360('0x26')]);_0x1642a4[_0xe360('0x25')]=qs['offset'](_0xfa33ae[_0xe360('0x3f')][_0xe360('0x25')]);}return _0x4589c3[_0xe360('0x9e')](_0x1642a4);}})['then'](function(_0x14d35e){if(_0x14d35e){return _0x14d35e?{'count':_0x2edbce,'rows':_0x14d35e}:null;}})['then'](respondWithResult(_0x6e779e,null))[_0xe360('0x55')](handleError(_0x6e779e,null));};exports['addLists']=function(_0xac589c,_0xac3778,_0x492f8a){var _0x210869,_0xe435b4;return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0xac589c[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0xac3778,null))[_0xe360('0x2c')](function(_0xcb2e78){if(_0xcb2e78){_0xe435b4=_0xcb2e78;return _0xcb2e78[_0xe360('0xa0')](_0xac589c[_0xe360('0x57')][_0xe360('0x80')],_[_0xe360('0x61')](_0xac589c[_0xe360('0x57')],[_0xe360('0x80'),'id'])||{});}return null;})[_0xe360('0x97')](function(_0x123414){var _0x1e529d;_0x210869=_0x123414||[];var _0x360636=[];if(_0x123414){for(var _0x5c0a17=0x0;_0x5c0a17<_0x123414[_0xe360('0x45')];_0x5c0a17+=0x1){var _0x1da2ed=_0x123414[_0x5c0a17][_0xe360('0x2d')]({'plain':!![]});_0xe435b4[_0xe360('0xa1')]=_0xac589c['body'][_0xe360('0xa1')]?_0xac589c[_0xe360('0x57')][_0xe360('0xa1')]:_0xe435b4[_0xe360('0xa1')];switch(_0xe435b4[_0xe360('0xa1')]){case'always':_0x1e529d=squel[_0xe360('0xa2')]()[_0xe360('0xa3')]('cm_hopper')[_0xe360('0xa4')](['phone','scheduledAt',_0xe360('0xa5'),_0xe360('0xa6'),_0xe360('0x6a'),_0xe360('0x62'),_0xe360('0xa7')],squel['select']()[_0xe360('0x82')](_0xe360('0xa8'),_0xe360('0xa8'))[_0xe360('0x82')](_0xe360('0xa9'),_0xe360('0xaa'))['field']('id',_0xe360('0xa5'))[_0xe360('0x82')](_0x1da2ed[_0xe360('0xab')][_0xe360('0xac')](),_0xe360('0xa6'))[_0xe360('0x82')](_0xac589c['params']['id']['toString'](),_0xe360('0x6a'))[_0xe360('0x82')](_0xe360('0xa9'),_0xe360('0x62'))[_0xe360('0x82')]('NOW()',_0xe360('0xa7'))[_0xe360('0x84')](_0xe360('0xad'))['where'](_0xe360('0xae'))[_0xe360('0x4a')](_0xe360('0xaf'),_0x1da2ed[_0xe360('0xab')][_0xe360('0xac')]())[_0xe360('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0xe360('0x4a')](_0xe360('0xb0'),squel[_0xe360('0x81')]()[_0xe360('0x82')](_0xe360('0xb1'))[_0xe360('0x84')](_0xe360('0xb2'))[_0xe360('0x4a')](_0xe360('0x89'),_0xac589c[_0xe360('0x54')]['id']['toString']()))[_0xe360('0x4a')](_0xe360('0xb0'),squel[_0xe360('0x81')]()[_0xe360('0x82')](_0xe360('0xb3'))[_0xe360('0x84')](_0xe360('0xb4'))[_0xe360('0x4a')](_0xe360('0x89'),_0xac589c['params']['id'][_0xe360('0xac')]())))['toString']();break;case _0xe360('0xb5'):_0x1e529d=squel[_0xe360('0xa2')]()[_0xe360('0xa3')](_0xe360('0xb4'))['fromQuery']([_0xe360('0xa8'),_0xe360('0xaa'),_0xe360('0xa5'),_0xe360('0xa6'),'VoiceQueueId','createdAt',_0xe360('0xa7')],squel[_0xe360('0x81')]()['field']('phone',_0xe360('0xa8'))[_0xe360('0x82')]('NOW()',_0xe360('0xaa'))[_0xe360('0x82')]('id',_0xe360('0xa5'))[_0xe360('0x82')](_0x1da2ed[_0xe360('0xab')][_0xe360('0xac')](),'ListId')[_0xe360('0x82')](_0xac589c[_0xe360('0x54')]['id'][_0xe360('0xac')](),_0xe360('0x6a'))[_0xe360('0x82')]('NOW()','createdAt')[_0xe360('0x82')]('NOW()','updatedAt')[_0xe360('0x84')]('cm_contacts')[_0xe360('0x4a')](_0xe360('0xae'))[_0xe360('0x4a')](_0xe360('0xaf'),_0x1da2ed[_0xe360('0xab')][_0xe360('0xac')]())[_0xe360('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0xe360('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe360('0x81')]()[_0xe360('0x82')](_0xe360('0xb3'))[_0xe360('0x84')](_0xe360('0xb4'))[_0xe360('0x4a')]('VoiceQueueId\x20=\x20?',_0xac589c['params']['id'][_0xe360('0xac')]())))[_0xe360('0xac')]();break;default:_0x1e529d=squel[_0xe360('0xa2')]()[_0xe360('0xa3')](_0xe360('0xb4'))['fromQuery'](['phone',_0xe360('0xaa'),_0xe360('0xa5'),_0xe360('0xa6'),'VoiceQueueId','createdAt',_0xe360('0xa7')],squel['select']()[_0xe360('0x82')]('phone','phone')[_0xe360('0x82')]('NOW()','scheduledAt')[_0xe360('0x82')]('id',_0xe360('0xa5'))[_0xe360('0x82')](_0x1da2ed[_0xe360('0xab')]['toString'](),_0xe360('0xa6'))[_0xe360('0x82')](_0xac589c[_0xe360('0x54')]['id']['toString'](),_0xe360('0x6a'))[_0xe360('0x82')](_0xe360('0xa9'),_0xe360('0x62'))['field'](_0xe360('0xa9'),_0xe360('0xa7'))['from'](_0xe360('0xad'))['where'](_0xe360('0xae'))[_0xe360('0x4a')](_0xe360('0xaf'),_0x1da2ed[_0xe360('0xab')][_0xe360('0xac')]())['where'](_0xe360('0xb6')))[_0xe360('0xac')]();}_0x360636['push'](db[_0xe360('0x76')][_0xe360('0x3f')](_0x1e529d));}return BPromise['all'](_0x360636);}})[_0xe360('0x2c')](function(){return _0x210869;})[_0xe360('0x2c')](respondWithResult(_0xac3778,null))[_0xe360('0x55')](handleError(_0xac3778,null));};exports[_0xe360('0xb7')]=function(_0x50b9ac,_0x282bab,_0x1d4723){return db[_0xe360('0x51')][_0xe360('0x34')]({'where':{'id':_0x50b9ac[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x282bab,null))['then'](function(_0x51d4d5){if(_0x51d4d5){return _0x51d4d5[_0xe360('0xb7')](_0x50b9ac[_0xe360('0x3f')][_0xe360('0x80')]);}})['then'](function(_0x22b895){if(_0x22b895){return db['CmHopper'][_0xe360('0x2b')]({'where':{'ListId':_0x50b9ac[_0xe360('0x3f')][_0xe360('0x80')],'VoiceQueueId':_0x50b9ac[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](function(){return _0x22b895;});}})[_0xe360('0x2c')](respondWithStatusCode(_0x282bab,null))['catch'](handleError(_0x282bab,null));};exports['getBlackLists']=function(_0x34b851,_0x4e4294,_0x4ef31d){var _0xbca0c={};var _0x591111={};var _0x14d522;var _0x4d015f;return db[_0xe360('0x51')][_0xe360('0x65')]({'where':{'id':_0x34b851[_0xe360('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e4294,null))[_0xe360('0x2c')](function(_0x1dbe76){if(_0x1dbe76){_0x14d522=_0x1dbe76;_0x591111[_0xe360('0x3e')]=_[_0xe360('0x40')](db['CmList'][_0xe360('0x3b')]);_0x591111[_0xe360('0x3f')]=_[_0xe360('0x40')](_0x34b851[_0xe360('0x3f')]);_0x591111[_0xe360('0x41')]=_['intersection'](_0x591111[_0xe360('0x3e')],_0x591111[_0xe360('0x3f')]);_0xbca0c[_0xe360('0x43')]=_[_0xe360('0x42')](_0x591111[_0xe360('0x3e')],qs['fields'](_0x34b851['query']['fields']));_0xbca0c[_0xe360('0x43')]=_0xbca0c[_0xe360('0x43')][_0xe360('0x45')]?_0xbca0c['attributes']:_0x591111[_0xe360('0x3e')];_0xbca0c['order']=qs[_0xe360('0x49')](_0x34b851['query']['sort']);_0xbca0c[_0xe360('0x4a')]=qs[_0xe360('0x41')](_['pick'](_0x34b851[_0xe360('0x3f')],_0x591111[_0xe360('0x41')]));if(_0x34b851['query'][_0xe360('0x4c')]){_0xbca0c['where']=_[_0xe360('0x4d')](_0xbca0c[_0xe360('0x4a')],{'$or':_[_0xe360('0x31')](_0xbca0c[_0xe360('0x43')],function(_0xd4c243){var _0x174467={};_0x174467[_0xd4c243]={'$like':'%'+_0x34b851[_0xe360('0x3f')][_0xe360('0x4c')]+'%'};return _0x174467;})});}_0xbca0c=_[_0xe360('0x4d')]({},_0xbca0c,_0x34b851[_0xe360('0x4e')]);return _0x14d522['getBlackLists'](_0xbca0c);}})[_0xe360('0x2c')](function(_0x2a6810){if(_0x2a6810){_0x4d015f=_0x2a6810[_0xe360('0x45')];if(!_0x34b851['query']['hasOwnProperty'](_0xe360('0x47'))){_0xbca0c[_0xe360('0x26')]=qs[_0xe360('0x26')](_0x34b851['query']['limit']);_0xbca0c['offset']=qs['offset'](_0x34b851[_0xe360('0x3f')][_0xe360('0x25')]);}return _0x14d522[_0xe360('0xb8')](_0xbca0c);}})[_0xe360('0x2c')](function(_0xbf32c1){if(_0xbf32c1){return _0xbf32c1?{'count':_0x4d015f,'rows':_0xbf32c1}:null;}})['then'](respondWithResult(_0x4e4294,null))[_0xe360('0x55')](handleError(_0x4e4294,null));};exports[_0xe360('0xb9')]=function(_0x2679fb,_0x249c08,_0x5b1e43){var _0x23209d,_0x577260;return db['VoiceQueue']['find']({'where':{'id':_0x2679fb['params']['id']}})['then'](handleEntityNotFound(_0x249c08,null))[_0xe360('0x2c')](function(_0xc9812c){if(_0xc9812c){_0x577260=_0xc9812c;return _0xc9812c['addBlackLists'](_0x2679fb['body'][_0xe360('0x80')],_[_0xe360('0x61')](_0x2679fb['body'],[_0xe360('0x80'),'id'])||{});}return null;})[_0xe360('0x97')](function(_0x328d7d){var _0x44995d;_0x23209d=_0x328d7d||[];var _0xdc350a=[];if(_0x328d7d){for(var _0xc416b7=0x0;_0xc416b7<_0x328d7d['length'];_0xc416b7+=0x1){var _0x204c0d=_0x328d7d[_0xc416b7][_0xe360('0x2d')]({'plain':!![]});_0x44995d=squel[_0xe360('0xa2')]()['into'](_0xe360('0xba'))['fromQuery']([_0xe360('0xa8'),_0xe360('0xa5'),_0xe360('0xa6'),_0xe360('0x6a'),_0xe360('0x62'),_0xe360('0xa7')],squel[_0xe360('0x81')]()[_0xe360('0x82')](_0xe360('0xa8'),_0xe360('0xa8'))[_0xe360('0x82')]('id',_0xe360('0xa5'))['field'](_0x204c0d['CmListId'][_0xe360('0xac')](),_0xe360('0xa6'))[_0xe360('0x82')](_0x2679fb[_0xe360('0x54')]['id'][_0xe360('0xac')](),_0xe360('0x6a'))[_0xe360('0x82')](_0xe360('0xa9'),'createdAt')[_0xe360('0x82')](_0xe360('0xa9'),_0xe360('0xa7'))[_0xe360('0x84')](_0xe360('0xad'))[_0xe360('0x4a')](_0xe360('0xae'))['where'](_0xe360('0xaf'),_0x204c0d[_0xe360('0xab')][_0xe360('0xac')]())[_0xe360('0x4a')](_0xe360('0xb6')))[_0xe360('0xac')]();_0xdc350a[_0xe360('0x8b')](db['sequelize'][_0xe360('0x3f')](_0x44995d));}return BPromise[_0xe360('0x90')](_0xdc350a);}})['then'](function(){return _0x23209d;})[_0xe360('0x2c')](respondWithResult(_0x249c08,null))[_0xe360('0x55')](handleError(_0x249c08,null));};exports[_0xe360('0xbb')]=function(_0x503297,_0x4646e5,_0x148fb5){return db['VoiceQueue'][_0xe360('0x34')]({'where':{'id':_0x503297[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](handleEntityNotFound(_0x4646e5,null))['then'](function(_0x16fc2e){if(_0x16fc2e){return _0x16fc2e['removeBlackLists'](_0x503297[_0xe360('0x3f')]['ids']);}})[_0xe360('0x2c')](function(_0x47ab17){if(_0x47ab17){return db['CmHopperBlack'][_0xe360('0x2b')]({'where':{'ListId':_0x503297[_0xe360('0x3f')][_0xe360('0x80')],'VoiceQueueId':_0x503297[_0xe360('0x54')]['id']}})[_0xe360('0x2c')](function(){return _0x47ab17;});}})['then'](respondWithStatusCode(_0x4646e5,null))[_0xe360('0x55')](handleError(_0x4646e5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f8d7afc..6576866 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 _0xc186=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x433795,_0x253d09){var _0x27661e=function(_0x1c4870){while(--_0x1c4870){_0x433795['push'](_0x433795['shift']());}};_0x27661e(++_0x253d09);}(_0xc186,0x131));var _0x6c18=function(_0x113324,_0x205a4f){_0x113324=_0x113324-0x0;var _0x4b4c29=_0xc186[_0x113324];return _0x4b4c29;};'use strict';var EventEmitter=require(_0x6c18('0x0'));var VoiceQueue=require(_0x6c18('0x1'))['db'][_0x6c18('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6c18('0x3')](0x0);var events={'afterCreate':_0x6c18('0x4'),'afterUpdate':_0x6c18('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ba8be){return function(_0x2ebe6d,_0x4f4f17,_0xae8d7a){VoiceQueueEvents[_0x6c18('0x6')](_0x5ba8be+':'+_0x2ebe6d['id'],_0x2ebe6d);VoiceQueueEvents[_0x6c18('0x6')](_0x5ba8be,_0x2ebe6d);_0xae8d7a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x6c18('0x7')](e,emitEvent(event));}}module[_0x6c18('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xb98f=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb98f,0x1ee));var _0xfb98=function(_0xddc3f4,_0x32981f){_0xddc3f4=_0xddc3f4-0x0;var _0x15c119=_0xb98f[_0xddc3f4];return _0x15c119;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xfb98('0x0'))['db'][_0xfb98('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfb98('0x2')](0x0);var events={'afterCreate':_0xfb98('0x3'),'afterUpdate':_0xfb98('0x4'),'afterDestroy':_0xfb98('0x5')};function emitEvent(_0x498720){return function(_0x3e200f,_0x15d043,_0x2088a8){VoiceQueueEvents['emit'](_0x498720+':'+_0x3e200f['id'],_0x3e200f);VoiceQueueEvents[_0xfb98('0x6')](_0x498720,_0x3e200f);_0x2088a8(null);};}for(var e in events){if(events[_0xfb98('0x7')](e)){var event=events[e];VoiceQueue[_0xfb98('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1783bd5..b2a7c2e 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 _0xb4f6=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue','voice_queues'];(function(_0x57eba5,_0x2db42a){var _0x3a6b78=function(_0x5d8a55){while(--_0x5d8a55){_0x57eba5['push'](_0x57eba5['shift']());}};_0x3a6b78(++_0x2db42a);}(_0xb4f6,0x6e));var _0x6b4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4f6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b4f('0x0'));var util=require(_0x6b4f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b4f('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b4f('0x3'));var fs=require('fs');var path=require(_0x6b4f('0x4'));var rimraf=require(_0x6b4f('0x5'));var config=require(_0x6b4f('0x6'));var attributes=require(_0x6b4f('0x7'));module['exports']=function(_0x2033b2,_0x2c309c){return _0x2033b2[_0x6b4f('0x8')](_0x6b4f('0x9'),attributes,{'tableName':_0x6b4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4173=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueue','voice_queues'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x4173,0x15c));var _0x3417=function(_0x4fd329,_0x963811){_0x4fd329=_0x4fd329-0x0;var _0x2d3b85=_0x4173[_0x4fd329];return _0x2d3b85;};'use strict';var _=require(_0x3417('0x0'));var util=require(_0x3417('0x1'));var logger=require('../../config/logger')(_0x3417('0x2'));var moment=require(_0x3417('0x3'));var BPromise=require(_0x3417('0x4'));var rp=require(_0x3417('0x5'));var fs=require('fs');var path=require(_0x3417('0x6'));var rimraf=require(_0x3417('0x7'));var config=require(_0x3417('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x29a77a,_0x148a59){return _0x29a77a[_0x3417('0x9')](_0x3417('0xa'),attributes,{'tableName':_0x3417('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 ba38202..d43e70c 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 _0x2871=['localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','include','map','model','stringify','catch','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2871,0x15a));var _0x1287=function(_0x27b3a7,_0x3df7f4){_0x27b3a7=_0x27b3a7-0x0;var _0x36097f=_0x2871[_0x27b3a7];return _0x36097f;};'use strict';var _=require(_0x1287('0x0'));var util=require(_0x1287('0x1'));var moment=require(_0x1287('0x2'));var BPromise=require(_0x1287('0x3'));var rs=require(_0x1287('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1287('0x5'))['db'];var utils=require(_0x1287('0x6'));var logger=require(_0x1287('0x7'))(_0x1287('0x8'));var config=require(_0x1287('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1287('0xa')][_0x1287('0xb')]({'port':0x232a});config[_0x1287('0xc')]=_[_0x1287('0xd')](config['redis'],{'host':_0x1287('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1287('0xc')]));require(_0x1287('0xf'))['register'](socket);function respondWithRpcPromise(_0x988f47,_0x8dc92d,_0x543fee){return new BPromise(function(_0x1b7279,_0x53c7dd){return client[_0x1287('0x10')](_0x988f47,_0x543fee)[_0x1287('0x11')](function(_0x403cff){logger[_0x1287('0x12')](_0x1287('0x13'),_0x8dc92d,_0x1287('0x14'));logger[_0x1287('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x8dc92d,_0x1287('0x14'),JSON['stringify'](_0x403cff));if(_0x403cff['error']){if(_0x403cff[_0x1287('0x16')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x8dc92d,_0x403cff['error']['message']);return _0x53c7dd(_0x403cff[_0x1287('0x16')]['message']);}logger[_0x1287('0x16')](_0x1287('0x13'),_0x8dc92d,_0x403cff['error'][_0x1287('0x17')]);return _0x1b7279(_0x403cff[_0x1287('0x16')][_0x1287('0x17')]);}else{logger[_0x1287('0x12')](_0x1287('0x13'),_0x8dc92d,_0x1287('0x14'));_0x1b7279(_0x403cff['result'][_0x1287('0x17')]);}})['catch'](function(_0xb69356){logger[_0x1287('0x16')](_0x1287('0x13'),_0x8dc92d,_0xb69356);_0x53c7dd(_0xb69356);});});}exports[_0x1287('0x18')]=function(_0x464032){var _0x97fd46=this;return new Promise(function(_0x5ca910,_0x2d0b0a){return db[_0x1287('0x19')][_0x1287('0x1a')]({'raw':_0x464032[_0x1287('0x1b')]?_0x464032[_0x1287('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x464032[_0x1287('0x1b')]?_0x464032[_0x1287('0x1b')][_0x1287('0x1c')]||null:null,'attributes':_0x464032['options']?_0x464032[_0x1287('0x1b')][_0x1287('0x1d')]||null:null,'limit':_0x464032[_0x1287('0x1b')]?_0x464032[_0x1287('0x1b')]['limit']||null:null,'include':_0x464032['options']?_0x464032[_0x1287('0x1b')][_0x1287('0x1e')]?_[_0x1287('0x1f')](_0x464032['options']['include'],function(_0xb6f5fb){return{'model':db[_0xb6f5fb[_0x1287('0x20')]],'as':_0xb6f5fb['as'],'attributes':_0xb6f5fb[_0x1287('0x1d')],'include':_0xb6f5fb[_0x1287('0x1e')]?_[_0x1287('0x1f')](_0xb6f5fb[_0x1287('0x1e')],function(_0x52405e){return{'model':db[_0x52405e[_0x1287('0x20')]],'as':_0x52405e['as'],'attributes':_0x52405e['attributes'],'include':_0x52405e[_0x1287('0x1e')]?_[_0x1287('0x1f')](_0x52405e[_0x1287('0x1e')],function(_0xa9e479){return{'model':db[_0xa9e479[_0x1287('0x20')]],'as':_0xa9e479['as'],'attributes':_0xa9e479['attributes']};}):[]};}):[]};}):[]:[]})[_0x1287('0x11')](function(_0x354673){logger['info']('GetVoiceQueue',_0x464032);logger[_0x1287('0x15')]('GetVoiceQueue',_0x464032,JSON[_0x1287('0x21')](_0x354673));_0x5ca910(_0x354673);})[_0x1287('0x22')](function(_0x5f5a7b){logger[_0x1287('0x16')](_0x1287('0x18'),_0x5f5a7b[_0x1287('0x17')],_0x464032);_0x2d0b0a(_0x97fd46[_0x1287('0x16')](0x1f4,_0x5f5a7b[_0x1287('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x58c0a6){var _0x46fb4e=this;return new Promise(function(_0x1ccd11,_0x5139fb){return db['VoiceQueue']['find']({'raw':_0x58c0a6['options']?_0x58c0a6[_0x1287('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x58c0a6['options']?_0x58c0a6[_0x1287('0x1b')][_0x1287('0x1c')]||null:null,'attributes':_0x58c0a6[_0x1287('0x1b')]?_0x58c0a6[_0x1287('0x1b')][_0x1287('0x1d')]||null:null,'include':_0x58c0a6['options']?_0x58c0a6[_0x1287('0x1b')][_0x1287('0x1e')]?_[_0x1287('0x1f')](_0x58c0a6[_0x1287('0x1b')][_0x1287('0x1e')],function(_0x2322f8){return{'model':db[_0x2322f8['model']],'as':_0x2322f8['as'],'attributes':_0x2322f8[_0x1287('0x1d')],'include':_0x2322f8['include']?_[_0x1287('0x1f')](_0x2322f8[_0x1287('0x1e')],function(_0x51731a){return{'model':db[_0x51731a[_0x1287('0x20')]],'as':_0x51731a['as'],'attributes':_0x51731a[_0x1287('0x1d')],'include':_0x51731a[_0x1287('0x1e')]?_[_0x1287('0x1f')](_0x51731a[_0x1287('0x1e')],function(_0x5a30f8){return{'model':db[_0x5a30f8['model']],'as':_0x5a30f8['as'],'attributes':_0x5a30f8[_0x1287('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1287('0x11')](function(_0x1440bc){logger[_0x1287('0x12')](_0x1287('0x23'),_0x58c0a6);logger[_0x1287('0x15')](_0x1287('0x23'),_0x58c0a6,JSON[_0x1287('0x21')](_0x1440bc));_0x1ccd11(_0x1440bc);})[_0x1287('0x22')](function(_0x2f8ff2){logger[_0x1287('0x16')](_0x1287('0x23'),_0x2f8ff2[_0x1287('0x17')],_0x58c0a6);_0x5139fb(_0x46fb4e[_0x1287('0x16')](0x1f4,_0x2f8ff2[_0x1287('0x17')]));});});}; \ No newline at end of file +var _0x2d5a=['VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue'];(function(_0x572b72,_0x1ff899){var _0x50cce9=function(_0x2ff3bb){while(--_0x2ff3bb){_0x572b72['push'](_0x572b72['shift']());}};_0x50cce9(++_0x1ff899);}(_0x2d5a,0x155));var _0xa2d5=function(_0x46fddb,_0x1e47f3){_0x46fddb=_0x46fddb-0x0;var _0x48b75f=_0x2d5a[_0x46fddb];return _0x48b75f;};'use strict';var _=require(_0xa2d5('0x0'));var util=require(_0xa2d5('0x1'));var moment=require(_0xa2d5('0x2'));var BPromise=require(_0xa2d5('0x3'));var rs=require(_0xa2d5('0x4'));var fs=require('fs');var Redis=require(_0xa2d5('0x5'));var db=require(_0xa2d5('0x6'))['db'];var utils=require(_0xa2d5('0x7'));var logger=require(_0xa2d5('0x8'))(_0xa2d5('0x9'));var config=require(_0xa2d5('0xa'));var jayson=require(_0xa2d5('0xb'));var client=jayson[_0xa2d5('0xc')][_0xa2d5('0xd')]({'port':0x232a});config[_0xa2d5('0xe')]=_['defaults'](config[_0xa2d5('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2d5('0xe')]));require(_0xa2d5('0xf'))[_0xa2d5('0x10')](socket);function respondWithRpcPromise(_0x4e141a,_0xe989be,_0x14f21f){return new BPromise(function(_0x272a1,_0x2c688d){return client[_0xa2d5('0x11')](_0x4e141a,_0x14f21f)['then'](function(_0x143e0c){logger[_0xa2d5('0x12')](_0xa2d5('0x13'),_0xe989be,_0xa2d5('0x14'));logger[_0xa2d5('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xe989be,_0xa2d5('0x14'),JSON[_0xa2d5('0x16')](_0x143e0c));if(_0x143e0c['error']){if(_0x143e0c[_0xa2d5('0x17')][_0xa2d5('0x18')]===0x1f4){logger[_0xa2d5('0x17')](_0xa2d5('0x13'),_0xe989be,_0x143e0c[_0xa2d5('0x17')][_0xa2d5('0x19')]);return _0x2c688d(_0x143e0c[_0xa2d5('0x17')][_0xa2d5('0x19')]);}logger[_0xa2d5('0x17')](_0xa2d5('0x13'),_0xe989be,_0x143e0c[_0xa2d5('0x17')][_0xa2d5('0x19')]);return _0x272a1(_0x143e0c[_0xa2d5('0x17')]['message']);}else{logger[_0xa2d5('0x12')](_0xa2d5('0x13'),_0xe989be,'request\x20sent');_0x272a1(_0x143e0c['result'][_0xa2d5('0x19')]);}})[_0xa2d5('0x1a')](function(_0x59b2d8){logger[_0xa2d5('0x17')](_0xa2d5('0x13'),_0xe989be,_0x59b2d8);_0x2c688d(_0x59b2d8);});});}exports[_0xa2d5('0x1b')]=function(_0x26eb13){var _0x3f0e73=this;return new Promise(function(_0x17bb83,_0x3cc579){return db[_0xa2d5('0x1c')][_0xa2d5('0x1d')]({'raw':_0x26eb13[_0xa2d5('0x1e')]?_0x26eb13[_0xa2d5('0x1e')][_0xa2d5('0x1f')]===undefined?!![]:![]:!![],'where':_0x26eb13['options']?_0x26eb13['options'][_0xa2d5('0x20')]||null:null,'attributes':_0x26eb13['options']?_0x26eb13['options']['attributes']||null:null,'limit':_0x26eb13[_0xa2d5('0x1e')]?_0x26eb13[_0xa2d5('0x1e')][_0xa2d5('0x21')]||null:null,'include':_0x26eb13['options']?_0x26eb13[_0xa2d5('0x1e')][_0xa2d5('0x22')]?_[_0xa2d5('0x23')](_0x26eb13[_0xa2d5('0x1e')][_0xa2d5('0x22')],function(_0x1e4e6f){return{'model':db[_0x1e4e6f[_0xa2d5('0x24')]],'as':_0x1e4e6f['as'],'attributes':_0x1e4e6f[_0xa2d5('0x25')],'include':_0x1e4e6f['include']?_[_0xa2d5('0x23')](_0x1e4e6f[_0xa2d5('0x22')],function(_0x50d096){return{'model':db[_0x50d096[_0xa2d5('0x24')]],'as':_0x50d096['as'],'attributes':_0x50d096[_0xa2d5('0x25')],'include':_0x50d096[_0xa2d5('0x22')]?_['map'](_0x50d096[_0xa2d5('0x22')],function(_0x2ccda3){return{'model':db[_0x2ccda3[_0xa2d5('0x24')]],'as':_0x2ccda3['as'],'attributes':_0x2ccda3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2d5('0x26')](function(_0x1949cc){logger[_0xa2d5('0x12')](_0xa2d5('0x1b'),_0x26eb13);logger[_0xa2d5('0x15')](_0xa2d5('0x1b'),_0x26eb13,JSON[_0xa2d5('0x16')](_0x1949cc));_0x17bb83(_0x1949cc);})[_0xa2d5('0x1a')](function(_0x4c6728){logger[_0xa2d5('0x17')](_0xa2d5('0x1b'),_0x4c6728['message'],_0x26eb13);_0x3cc579(_0x3f0e73[_0xa2d5('0x17')](0x1f4,_0x4c6728[_0xa2d5('0x19')]));});});};exports[_0xa2d5('0x27')]=function(_0x26b63c){var _0x5355b9=this;return new Promise(function(_0x4ab699,_0x4eb08e){return db['VoiceQueue'][_0xa2d5('0x28')]({'raw':_0x26b63c['options']?_0x26b63c[_0xa2d5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x26b63c[_0xa2d5('0x1e')]?_0x26b63c[_0xa2d5('0x1e')][_0xa2d5('0x20')]||null:null,'attributes':_0x26b63c[_0xa2d5('0x1e')]?_0x26b63c[_0xa2d5('0x1e')][_0xa2d5('0x25')]||null:null,'include':_0x26b63c[_0xa2d5('0x1e')]?_0x26b63c[_0xa2d5('0x1e')][_0xa2d5('0x22')]?_[_0xa2d5('0x23')](_0x26b63c[_0xa2d5('0x1e')][_0xa2d5('0x22')],function(_0xd01d48){return{'model':db[_0xd01d48[_0xa2d5('0x24')]],'as':_0xd01d48['as'],'attributes':_0xd01d48[_0xa2d5('0x25')],'include':_0xd01d48[_0xa2d5('0x22')]?_[_0xa2d5('0x23')](_0xd01d48[_0xa2d5('0x22')],function(_0x68a523){return{'model':db[_0x68a523[_0xa2d5('0x24')]],'as':_0x68a523['as'],'attributes':_0x68a523[_0xa2d5('0x25')],'include':_0x68a523['include']?_[_0xa2d5('0x23')](_0x68a523[_0xa2d5('0x22')],function(_0x173c8e){return{'model':db[_0x173c8e['model']],'as':_0x173c8e['as'],'attributes':_0x173c8e[_0xa2d5('0x25')]};}):[]};}):[]};}):[]:[]})[_0xa2d5('0x26')](function(_0xe7912c){logger[_0xa2d5('0x12')](_0xa2d5('0x27'),_0x26b63c);logger['debug'](_0xa2d5('0x27'),_0x26b63c,JSON[_0xa2d5('0x16')](_0xe7912c));_0x4ab699(_0xe7912c);})[_0xa2d5('0x1a')](function(_0x597d44){logger[_0xa2d5('0x17')](_0xa2d5('0x27'),_0x597d44[_0xa2d5('0x19')],_0x26b63c);_0x4eb08e(_0x5355b9['error'](0x1f4,_0x597d44[_0xa2d5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8d2ebd6..5246e63 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 _0x6d2a=['./voiceQueue.events','save','remove','removeListener','length','voiceQueue:'];(function(_0x2e6e2c,_0x400041){var _0x3d5521=function(_0x3118fc){while(--_0x3118fc){_0x2e6e2c['push'](_0x2e6e2c['shift']());}};_0x3d5521(++_0x400041);}(_0x6d2a,0x10e));var _0xa6d2=function(_0x4539ca,_0x3a07cd){_0x4539ca=_0x4539ca-0x0;var _0x552d4a=_0x6d2a[_0x4539ca];return _0x552d4a;};'use strict';var VoiceQueueEvents=require(_0xa6d2('0x0'));var events=[_0xa6d2('0x1'),_0xa6d2('0x2'),'update'];function createListener(_0x49f61f,_0x447107){return function(_0x5a16e3){_0x447107['emit'](_0x49f61f,_0x5a16e3);};}function removeListener(_0x248159,_0x3ca59e){return function(){VoiceQueueEvents[_0xa6d2('0x3')](_0x248159,_0x3ca59e);};}exports['register']=function(_0x54fa5a){for(var _0x30d4f3=0x0,_0x19308b=events[_0xa6d2('0x4')];_0x30d4f3<_0x19308b;_0x30d4f3++){var _0x433289=events[_0x30d4f3];var _0x212681=createListener(_0xa6d2('0x5')+_0x433289,_0x54fa5a);VoiceQueueEvents['on'](_0x433289,_0x212681);}}; \ No newline at end of file +var _0x7df3=['update','emit','removeListener','register','voiceQueue:','./voiceQueue.events','save'];(function(_0xc2465a,_0x28ff1f){var _0xe936a=function(_0x5e740a){while(--_0x5e740a){_0xc2465a['push'](_0xc2465a['shift']());}};_0xe936a(++_0x28ff1f);}(_0x7df3,0x1cc));var _0x37df=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7df3[_0x5ddb1c];return _0x354adc;};'use strict';var VoiceQueueEvents=require(_0x37df('0x0'));var events=[_0x37df('0x1'),'remove',_0x37df('0x2')];function createListener(_0x546004,_0x89422a){return function(_0x547435){_0x89422a[_0x37df('0x3')](_0x546004,_0x547435);};}function removeListener(_0x501dc2,_0x2072a9){return function(){VoiceQueueEvents[_0x37df('0x4')](_0x501dc2,_0x2072a9);};}exports[_0x37df('0x5')]=function(_0x368888){for(var _0x194c89=0x0,_0x773cbe=events['length'];_0x194c89<_0x773cbe;_0x194c89++){var _0x56eca4=events[_0x194c89];var _0x559bb3=createListener(_0x37df('0x6')+_0x56eca4,_0x368888);VoiceQueueEvents['on'](_0x56eca4,_0x559bb3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b25af7c..71a26cb 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 _0xf69c=['Router','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x59ee58,_0x478012){var _0x9c675c=function(_0x4cf3cd){while(--_0x4cf3cd){_0x59ee58['push'](_0x59ee58['shift']());}};_0x9c675c(++_0x478012);}(_0xf69c,0x151));var _0xcf69=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xf69c[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0xcf69('0x0'));var util=require('util');var path=require(_0xcf69('0x1'));var timeout=require(_0xcf69('0x2'));var express=require('express');var router=express[_0xcf69('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf69('0x4'));var config=require('../../config/environment');var controller=require(_0xcf69('0x5'));router['get']('/',auth[_0xcf69('0x6')](),controller[_0xcf69('0x7')]);router[_0xcf69('0x8')](_0xcf69('0x9'),auth[_0xcf69('0x6')](),controller['describe']);router[_0xcf69('0x8')](_0xcf69('0xa'),auth[_0xcf69('0x6')](),controller[_0xcf69('0xb')]);router['get'](_0xcf69('0xc'),auth[_0xcf69('0x6')](),controller[_0xcf69('0xd')]);router[_0xcf69('0xe')]('/',auth[_0xcf69('0x6')](),controller[_0xcf69('0xf')]);router['put'](_0xcf69('0xc'),auth['isAuthenticated'](),controller[_0xcf69('0x10')]);router[_0xcf69('0x11')](_0xcf69('0xc'),auth[_0xcf69('0x6')](),controller[_0xcf69('0x12')]);module[_0xcf69('0x13')]=router; \ No newline at end of file +var _0x5430=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x12f15e,_0x3e79de){var _0x409797=function(_0x8e9b20){while(--_0x8e9b20){_0x12f15e['push'](_0x12f15e['shift']());}};_0x409797(++_0x3e79de);}(_0x5430,0x10c));var _0x0543=function(_0x1ed071,_0x93c7ab){_0x1ed071=_0x1ed071-0x0;var _0x3375bf=_0x5430[_0x1ed071];return _0x3375bf;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x0543('0x7')](),controller[_0x0543('0x8')]);router[_0x0543('0x9')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['describe']);router[_0x0543('0x9')](_0x0543('0xb'),auth[_0x0543('0x7')](),controller[_0x0543('0xc')]);router[_0x0543('0x9')](_0x0543('0xd'),auth['isAuthenticated'](),controller[_0x0543('0xe')]);router[_0x0543('0xf')]('/',auth['isAuthenticated'](),controller[_0x0543('0x10')]);router[_0x0543('0x11')](_0x0543('0xd'),auth[_0x0543('0x7')](),controller[_0x0543('0x12')]);router[_0x0543('0x13')](_0x0543('0xd'),auth[_0x0543('0x7')](),controller[_0x0543('0x14')]);module[_0x0543('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 6d63dd8..4b1ec59 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 _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0xa03923,_0x57c671){var _0x3a087b=function(_0x5aa2f1){while(--_0x5aa2f1){_0xa03923['push'](_0xa03923['shift']());}};_0x3a087b(++_0x57c671);}(_0x70e0,0x17b));var _0x070e=function(_0xf52f5,_0x5a2b9c){_0xf52f5=_0xf52f5-0x0;var _0x1f59b2=_0x70e0[_0xf52f5];return _0x1f59b2;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b15c62b..5b8c781 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x79aa6d,_0x2cab41){var _0x1a4935=function(_0x26ea89){while(--_0x26ea89){_0x79aa6d['push'](_0x79aa6d['shift']());}};_0x1a4935(++_0x2cab41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x314f3c,_0x2e7b9a){var _0x4cfac9=function(_0x351d9d){while(--_0x351d9d){_0x314f3c['push'](_0x314f3c['shift']());}};_0x4cfac9(++_0x2e7b9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f98deaf..8e77814 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 _0xbe8d=['hasOwnProperty','hook','exports','events','VoiceQueueReport','setMaxListeners','save','emit'];(function(_0x5a2358,_0x16bfff){var _0x2be9f1=function(_0x953797){while(--_0x953797){_0x5a2358['push'](_0x5a2358['shift']());}};_0x2be9f1(++_0x16bfff);}(_0xbe8d,0xd3));var _0xdbe8=function(_0x4bd795,_0x4b5438){_0x4bd795=_0x4bd795-0x0;var _0x5e37f8=_0xbe8d[_0x4bd795];return _0x5e37f8;};'use strict';var EventEmitter=require(_0xdbe8('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xdbe8('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xdbe8('0x2')](0x0);var events={'afterCreate':_0xdbe8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a66f1){return function(_0x25f952,_0x53c4a2,_0x544670){VoiceQueueReportEvents[_0xdbe8('0x4')](_0x1a66f1+':'+_0x25f952['id'],_0x25f952);VoiceQueueReportEvents[_0xdbe8('0x4')](_0x1a66f1,_0x25f952);_0x544670(null);};}for(var e in events){if(events[_0xdbe8('0x5')](e)){var event=events[e];VoiceQueueReport[_0xdbe8('0x6')](e,emitEvent(event));}}module[_0xdbe8('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe9bf=['save','update','emit','hook','exports','events','VoiceQueueReport','setMaxListeners'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xe9bf,0x85));var _0xfe9b=function(_0x2cff4b,_0x444cb3){_0x2cff4b=_0x2cff4b-0x0;var _0x573c41=_0xe9bf[_0x2cff4b];return _0x573c41;};'use strict';var EventEmitter=require(_0xfe9b('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xfe9b('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfe9b('0x2')](0x0);var events={'afterCreate':_0xfe9b('0x3'),'afterUpdate':_0xfe9b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x525c33){return function(_0x45d44f,_0x11ae18,_0x2c2be2){VoiceQueueReportEvents[_0xfe9b('0x5')](_0x525c33+':'+_0x45d44f['id'],_0x45d44f);VoiceQueueReportEvents[_0xfe9b('0x5')](_0x525c33,_0x45d44f);_0x2c2be2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xfe9b('0x6')](e,emitEvent(event));}}module[_0xfe9b('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ae80158..b812da2 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 _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3100a2,_0x1da58f){var _0x21223d=function(_0x2b4e12){while(--_0x2b4e12){_0x3100a2['push'](_0x3100a2['shift']());}};_0x21223d(++_0x1da58f);}(_0x757a,0xde));var _0xa757=function(_0xb195af,_0x2635b2){_0xb195af=_0xb195af-0x0;var _0x2f6061=_0x757a[_0xb195af];return _0x2f6061;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0xde612d,_0x3f5a92){var _0x112334=function(_0x397897){while(--_0x397897){_0xde612d['push'](_0xde612d['shift']());}};_0x112334(++_0x3f5a92);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 89a5e68..a8ea5cc 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 _0x6868=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','debug','lodash','util','moment'];(function(_0x3a902a,_0xca8442){var _0x24f2d5=function(_0xb6799a){while(--_0xb6799a){_0x3a902a['push'](_0x3a902a['shift']());}};_0x24f2d5(++_0xca8442);}(_0x6868,0x131));var _0x8686=function(_0x4ce37f,_0x5cffe2){_0x4ce37f=_0x4ce37f-0x0;var _0x5355b0=_0x6868[_0x4ce37f];return _0x5355b0;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var moment=require(_0x8686('0x2'));var BPromise=require(_0x8686('0x3'));var rs=require(_0x8686('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8686('0x5'))['db'];var utils=require(_0x8686('0x6'));var logger=require('../../config/logger')(_0x8686('0x7'));var config=require(_0x8686('0x8'));var jayson=require(_0x8686('0x9'));var client=jayson[_0x8686('0xa')][_0x8686('0xb')]({'port':0x232a});config[_0x8686('0xc')]=_[_0x8686('0xd')](config[_0x8686('0xc')],{'host':_0x8686('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8686('0xf'))[_0x8686('0x10')](socket);function respondWithRpcPromise(_0x145069,_0xe41b91,_0xe4670d){return new BPromise(function(_0x24feea,_0x580194){return client[_0x8686('0x11')](_0x145069,_0xe4670d)[_0x8686('0x12')](function(_0x4c0537){logger[_0x8686('0x13')](_0x8686('0x14'),_0xe41b91,_0x8686('0x15'));logger['debug'](_0x8686('0x16'),_0xe41b91,_0x8686('0x15'),JSON[_0x8686('0x17')](_0x4c0537));if(_0x4c0537[_0x8686('0x18')]){if(_0x4c0537['error']['code']===0x1f4){logger[_0x8686('0x18')](_0x8686('0x14'),_0xe41b91,_0x4c0537['error']['message']);return _0x580194(_0x4c0537[_0x8686('0x18')][_0x8686('0x19')]);}logger[_0x8686('0x18')](_0x8686('0x14'),_0xe41b91,_0x4c0537[_0x8686('0x18')][_0x8686('0x19')]);return _0x24feea(_0x4c0537[_0x8686('0x18')]['message']);}else{logger[_0x8686('0x13')](_0x8686('0x14'),_0xe41b91,'request\x20sent');_0x24feea(_0x4c0537[_0x8686('0x1a')]['message']);}})[_0x8686('0x1b')](function(_0x51a770){logger[_0x8686('0x18')](_0x8686('0x14'),_0xe41b91,_0x51a770);_0x580194(_0x51a770);});});}exports[_0x8686('0x1c')]=function(_0x47457b){var _0x16a9a1=this;return new Promise(function(_0x3ebdfd,_0x27906e){return db[_0x8686('0x1d')][_0x8686('0x1e')]({'raw':_0x47457b[_0x8686('0x1f')]?_0x47457b[_0x8686('0x1f')][_0x8686('0x20')]===undefined?!![]:![]:!![],'where':_0x47457b[_0x8686('0x1f')]?_0x47457b[_0x8686('0x1f')][_0x8686('0x21')]||null:null,'attributes':_0x47457b[_0x8686('0x1f')]?_0x47457b[_0x8686('0x1f')][_0x8686('0x22')]||null:null,'limit':_0x47457b[_0x8686('0x1f')]?_0x47457b[_0x8686('0x1f')][_0x8686('0x23')]||null:null,'include':_0x47457b[_0x8686('0x1f')]?_0x47457b[_0x8686('0x1f')][_0x8686('0x24')]?_[_0x8686('0x25')](_0x47457b[_0x8686('0x1f')]['include'],function(_0x26857a){return{'model':db[_0x26857a[_0x8686('0x26')]],'as':_0x26857a['as'],'attributes':_0x26857a[_0x8686('0x22')],'include':_0x26857a[_0x8686('0x24')]?_[_0x8686('0x25')](_0x26857a[_0x8686('0x24')],function(_0x5a0be8){return{'model':db[_0x5a0be8[_0x8686('0x26')]],'as':_0x5a0be8['as'],'attributes':_0x5a0be8[_0x8686('0x22')],'include':_0x5a0be8[_0x8686('0x24')]?_[_0x8686('0x25')](_0x5a0be8[_0x8686('0x24')],function(_0x4a50da){return{'model':db[_0x4a50da[_0x8686('0x26')]],'as':_0x4a50da['as'],'attributes':_0x4a50da['attributes']};}):[]};}):[]};}):[]:[]})[_0x8686('0x12')](function(_0x206abe){logger['info'](_0x8686('0x1c'),_0x47457b);logger['debug'](_0x8686('0x1c'),_0x47457b,JSON[_0x8686('0x17')](_0x206abe));_0x3ebdfd(_0x206abe);})[_0x8686('0x1b')](function(_0x295048){logger[_0x8686('0x18')]('GetVoiceQueueReport',_0x295048['message'],_0x47457b);_0x27906e(_0x16a9a1[_0x8686('0x18')](0x1f4,_0x295048['message']));});});};exports[_0x8686('0x27')]=function(_0x169202){var _0x158996=this;return new Promise(function(_0x44e40b,_0x1b34c8){return db[_0x8686('0x1d')]['create'](_0x169202[_0x8686('0x28')],{'raw':_0x169202[_0x8686('0x1f')]?_0x169202[_0x8686('0x1f')][_0x8686('0x20')]===undefined?!![]:![]:!![]})[_0x8686('0x12')](function(_0x4a3e81){logger[_0x8686('0x13')](_0x8686('0x27'),_0x169202);logger['debug'](_0x8686('0x27'),_0x169202,JSON[_0x8686('0x17')](_0x4a3e81));_0x44e40b(_0x4a3e81);})['catch'](function(_0x2e21e7){logger[_0x8686('0x18')](_0x8686('0x27'),_0x2e21e7[_0x8686('0x19')],_0x169202);_0x1b34c8(_0x158996[_0x8686('0x18')](0x1f4,_0x2e21e7['message']));});});};exports[_0x8686('0x29')]=function(_0x4f26e5){var _0x2aaf3a=this;return new Promise(function(_0x3b76bf,_0x2043a9){return db['VoiceQueueReport'][_0x8686('0x2a')](_0x4f26e5[_0x8686('0x28')],{'raw':_0x4f26e5[_0x8686('0x1f')]?_0x4f26e5[_0x8686('0x1f')][_0x8686('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f26e5['options']?_0x4f26e5[_0x8686('0x1f')]['where']||null:null,'attributes':_0x4f26e5['options']?_0x4f26e5[_0x8686('0x1f')][_0x8686('0x22')]||null:null,'limit':_0x4f26e5[_0x8686('0x1f')]?_0x4f26e5[_0x8686('0x1f')][_0x8686('0x23')]||null:null})[_0x8686('0x12')](function(_0x32664e){logger[_0x8686('0x13')](_0x8686('0x29'),_0x4f26e5);logger[_0x8686('0x2b')](_0x8686('0x29'),_0x4f26e5,JSON[_0x8686('0x17')](_0x32664e));_0x3b76bf(_0x32664e);})[_0x8686('0x1b')](function(_0xd79849){logger[_0x8686('0x18')](_0x8686('0x29'),_0xd79849[_0x8686('0x19')],_0x4f26e5);_0x2043a9(_0x2aaf3a[_0x8686('0x18')](0x1f4,_0xd79849['message']));});});}; \ No newline at end of file +var _0xe5c5=['http','defaults','redis','./voiceQueueReport.socket','request','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','request\x20sent','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x30c13c,_0x247f5d){var _0xfefe19=function(_0x1cae55){while(--_0x1cae55){_0x30c13c['push'](_0x30c13c['shift']());}};_0xfefe19(++_0x247f5d);}(_0xe5c5,0xc0));var _0x5e5c=function(_0x1a6577,_0x38e609){_0x1a6577=_0x1a6577-0x0;var _0x3fb84b=_0xe5c5[_0x1a6577];return _0x3fb84b;};'use strict';var _=require(_0x5e5c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e5c('0x1'));var fs=require('fs');var Redis=require(_0x5e5c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e5c('0x3'));var logger=require(_0x5e5c('0x4'))('rpc');var config=require(_0x5e5c('0x5'));var jayson=require(_0x5e5c('0x6'));var client=jayson[_0x5e5c('0x7')][_0x5e5c('0x8')]({'port':0x232a});config['redis']=_[_0x5e5c('0x9')](config[_0x5e5c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e5c('0xa')]));require(_0x5e5c('0xb'))['register'](socket);function respondWithRpcPromise(_0x2acf42,_0x427269,_0x3c090f){return new BPromise(function(_0x11851e,_0x5e6a92){return client[_0x5e5c('0xc')](_0x2acf42,_0x3c090f)['then'](function(_0x1e2da3){logger[_0x5e5c('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x427269,'request\x20sent');logger[_0x5e5c('0xe')](_0x5e5c('0xf'),_0x427269,'request\x20sent',JSON[_0x5e5c('0x10')](_0x1e2da3));if(_0x1e2da3[_0x5e5c('0x11')]){if(_0x1e2da3['error']['code']===0x1f4){logger[_0x5e5c('0x11')](_0x5e5c('0x12'),_0x427269,_0x1e2da3[_0x5e5c('0x11')][_0x5e5c('0x13')]);return _0x5e6a92(_0x1e2da3['error'][_0x5e5c('0x13')]);}logger[_0x5e5c('0x11')](_0x5e5c('0x12'),_0x427269,_0x1e2da3[_0x5e5c('0x11')][_0x5e5c('0x13')]);return _0x11851e(_0x1e2da3[_0x5e5c('0x11')][_0x5e5c('0x13')]);}else{logger[_0x5e5c('0xd')](_0x5e5c('0x12'),_0x427269,_0x5e5c('0x14'));_0x11851e(_0x1e2da3[_0x5e5c('0x15')][_0x5e5c('0x13')]);}})['catch'](function(_0x382d30){logger[_0x5e5c('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x427269,_0x382d30);_0x5e6a92(_0x382d30);});});}exports[_0x5e5c('0x16')]=function(_0x545b84){var _0x287911=this;return new Promise(function(_0x162980,_0x5574e0){return db[_0x5e5c('0x17')][_0x5e5c('0x18')]({'raw':_0x545b84['options']?_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x545b84[_0x5e5c('0x19')]?_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1b')]||null:null,'attributes':_0x545b84[_0x5e5c('0x19')]?_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1c')]||null:null,'limit':_0x545b84[_0x5e5c('0x19')]?_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1d')]||null:null,'include':_0x545b84[_0x5e5c('0x19')]?_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1e')]?_[_0x5e5c('0x1f')](_0x545b84[_0x5e5c('0x19')][_0x5e5c('0x1e')],function(_0x47cb98){return{'model':db[_0x47cb98['model']],'as':_0x47cb98['as'],'attributes':_0x47cb98[_0x5e5c('0x1c')],'include':_0x47cb98['include']?_[_0x5e5c('0x1f')](_0x47cb98['include'],function(_0x17ad1a){return{'model':db[_0x17ad1a[_0x5e5c('0x20')]],'as':_0x17ad1a['as'],'attributes':_0x17ad1a['attributes'],'include':_0x17ad1a[_0x5e5c('0x1e')]?_[_0x5e5c('0x1f')](_0x17ad1a[_0x5e5c('0x1e')],function(_0x934008){return{'model':db[_0x934008[_0x5e5c('0x20')]],'as':_0x934008['as'],'attributes':_0x934008[_0x5e5c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e5c('0x21')](function(_0x28e011){logger[_0x5e5c('0xd')](_0x5e5c('0x16'),_0x545b84);logger[_0x5e5c('0xe')](_0x5e5c('0x16'),_0x545b84,JSON[_0x5e5c('0x10')](_0x28e011));_0x162980(_0x28e011);})[_0x5e5c('0x22')](function(_0x81845b){logger[_0x5e5c('0x11')](_0x5e5c('0x16'),_0x81845b['message'],_0x545b84);_0x5574e0(_0x287911[_0x5e5c('0x11')](0x1f4,_0x81845b['message']));});});};exports[_0x5e5c('0x23')]=function(_0x2c07f5){var _0x4ce4d2=this;return new Promise(function(_0x2ab146,_0x436dc5){return db[_0x5e5c('0x17')][_0x5e5c('0x24')](_0x2c07f5[_0x5e5c('0x25')],{'raw':_0x2c07f5['options']?_0x2c07f5[_0x5e5c('0x19')][_0x5e5c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c3939){logger[_0x5e5c('0xd')](_0x5e5c('0x23'),_0x2c07f5);logger[_0x5e5c('0xe')](_0x5e5c('0x23'),_0x2c07f5,JSON[_0x5e5c('0x10')](_0x3c3939));_0x2ab146(_0x3c3939);})['catch'](function(_0x2f5862){logger[_0x5e5c('0x11')]('CreateVoiceQueueReport',_0x2f5862[_0x5e5c('0x13')],_0x2c07f5);_0x436dc5(_0x4ce4d2[_0x5e5c('0x11')](0x1f4,_0x2f5862['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x16d3b8){var _0x2454dc=this;return new Promise(function(_0x1e59f5,_0x1aa0b1){return db[_0x5e5c('0x17')][_0x5e5c('0x26')](_0x16d3b8[_0x5e5c('0x25')],{'raw':_0x16d3b8[_0x5e5c('0x19')]?_0x16d3b8[_0x5e5c('0x19')][_0x5e5c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16d3b8[_0x5e5c('0x19')]?_0x16d3b8[_0x5e5c('0x19')]['where']||null:null,'attributes':_0x16d3b8[_0x5e5c('0x19')]?_0x16d3b8[_0x5e5c('0x19')]['attributes']||null:null,'limit':_0x16d3b8[_0x5e5c('0x19')]?_0x16d3b8['options']['limit']||null:null})[_0x5e5c('0x21')](function(_0x54879f){logger[_0x5e5c('0xd')](_0x5e5c('0x27'),_0x16d3b8);logger['debug'](_0x5e5c('0x27'),_0x16d3b8,JSON[_0x5e5c('0x10')](_0x54879f));_0x1e59f5(_0x54879f);})[_0x5e5c('0x22')](function(_0x1c9618){logger['error'](_0x5e5c('0x27'),_0x1c9618[_0x5e5c('0x13')],_0x16d3b8);_0x1aa0b1(_0x2454dc['error'](0x1f4,_0x1c9618[_0x5e5c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fdbb631..7aaa356 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 _0x7e31=['length','save','remove','update','emit','register'];(function(_0x325f89,_0x210274){var _0x18e393=function(_0x52bcb4){while(--_0x52bcb4){_0x325f89['push'](_0x325f89['shift']());}};_0x18e393(++_0x210274);}(_0x7e31,0x1bd));var _0x17e3=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0x7e31[_0x249565];return _0x43dee8;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x17e3('0x0'),_0x17e3('0x1'),_0x17e3('0x2')];function createListener(_0x4aaba7,_0x1c0503){return function(_0x2a8b70){_0x1c0503[_0x17e3('0x3')](_0x4aaba7,_0x2a8b70);};}function removeListener(_0x5ae018,_0x2e070d){return function(){VoiceQueueReportEvents['removeListener'](_0x5ae018,_0x2e070d);};}exports[_0x17e3('0x4')]=function(_0x140e0e){for(var _0x11ab70=0x0,_0x46d80f=events[_0x17e3('0x5')];_0x11ab70<_0x46d80f;_0x11ab70++){var _0x43eb12=events[_0x11ab70];var _0xd7ae95=createListener('voiceQueueReport:'+_0x43eb12,_0x140e0e);VoiceQueueReportEvents['on'](_0x43eb12,_0xd7ae95);}}; \ No newline at end of file +var _0x56fd=['length','./voiceQueueReport.events','save','remove','emit','removeListener','register'];(function(_0x5b95ec,_0x16e0d0){var _0x2af647=function(_0x4f7a18){while(--_0x4f7a18){_0x5b95ec['push'](_0x5b95ec['shift']());}};_0x2af647(++_0x16e0d0);}(_0x56fd,0x15f));var _0xd56f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56fd[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require(_0xd56f('0x0'));var events=[_0xd56f('0x1'),_0xd56f('0x2'),'update'];function createListener(_0x31997d,_0x488cfb){return function(_0x12cf06){_0x488cfb[_0xd56f('0x3')](_0x31997d,_0x12cf06);};}function removeListener(_0x572e50,_0x30580f){return function(){VoiceQueueReportEvents[_0xd56f('0x4')](_0x572e50,_0x30580f);};}exports[_0xd56f('0x5')]=function(_0x2f898d){for(var _0x5eedea=0x0,_0x4c9bc7=events[_0xd56f('0x6')];_0x5eedea<_0x4c9bc7;_0x5eedea++){var _0x33e451=events[_0x5eedea];var _0xb00fdf=createListener('voiceQueueReport:'+_0x33e451,_0x2f898d);VoiceQueueReportEvents['on'](_0x33e451,_0xb00fdf);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5f6173d..c8372ed 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 _0x9373=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x26b345,_0x132eac){var _0x375338=function(_0x5cfbc9){while(--_0x5cfbc9){_0x26b345['push'](_0x26b345['shift']());}};_0x375338(++_0x132eac);}(_0x9373,0x1a7));var _0x3937=function(_0x208408,_0x5cea6b){_0x208408=_0x208408-0x0;var _0x45a4b5=_0x9373[_0x208408];return _0x45a4b5;};'use strict';var multer=require(_0x3937('0x0'));var util=require(_0x3937('0x1'));var path=require(_0x3937('0x2'));var timeout=require(_0x3937('0x3'));var express=require(_0x3937('0x4'));var router=express[_0x3937('0x5')]();var auth=require(_0x3937('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3937('0x7'));var controller=require(_0x3937('0x8'));router[_0x3937('0x9')]('/',auth[_0x3937('0xa')](),controller[_0x3937('0xb')]);router[_0x3937('0x9')](_0x3937('0xc'),auth[_0x3937('0xa')](),controller[_0x3937('0xd')]);router[_0x3937('0xe')]('/',auth['isAuthenticated'](),controller[_0x3937('0xf')]);router[_0x3937('0x10')](_0x3937('0xc'),auth[_0x3937('0xa')](),controller[_0x3937('0x11')]);router[_0x3937('0x12')](_0x3937('0xc'),auth[_0x3937('0xa')](),controller[_0x3937('0x13')]);module[_0x3937('0x14')]=router; \ No newline at end of file +var _0xb6b8=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','multer','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb6b8,0xb2));var _0x8b6b=function(_0xd44b16,_0x1c3b2c){_0xd44b16=_0xd44b16-0x0;var _0x42c9d3=_0xb6b8[_0xd44b16];return _0x42c9d3;};'use strict';var multer=require(_0x8b6b('0x0'));var util=require(_0x8b6b('0x1'));var path=require('path');var timeout=require(_0x8b6b('0x2'));var express=require(_0x8b6b('0x3'));var router=express['Router']();var auth=require(_0x8b6b('0x4'));var interaction=require(_0x8b6b('0x5'));var config=require(_0x8b6b('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x8b6b('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b6b('0x8')]);router[_0x8b6b('0x7')](_0x8b6b('0x9'),auth[_0x8b6b('0xa')](),controller[_0x8b6b('0xb')]);router[_0x8b6b('0xc')]('/',auth['isAuthenticated'](),controller[_0x8b6b('0xd')]);router[_0x8b6b('0xe')]('/:id',auth[_0x8b6b('0xa')](),controller['update']);router['delete'](_0x8b6b('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c780edd..9940ea2 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 _0x9d83=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9d83,0x12f));var _0x39d8=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x9d83[_0x3311ae];return _0x107949;};'use strict';var Sequelize=require(_0x39d8('0x0'));var moment=require(_0x39d8('0x1'));module[_0x39d8('0x2')]={'time':{'type':Sequelize[_0x39d8('0x3')]},'callid':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x39d8('0x4')],'allowNull':![],'defaultValue':moment()[_0x39d8('0x5')](_0x39d8('0x6'))}}; \ No newline at end of file +var _0xb096=['DATE','YYYY-MM-DD\x20HH:mm:ss','moment','STRING'];(function(_0x2fcb42,_0x1efdc1){var _0x4ba26b=function(_0x36c49e){while(--_0x36c49e){_0x2fcb42['push'](_0x2fcb42['shift']());}};_0x4ba26b(++_0x1efdc1);}(_0xb096,0xae));var _0x6b09=function(_0xba4b53,_0x4bddd6){_0xba4b53=_0xba4b53-0x0;var _0x4bcd8a=_0xb096[_0xba4b53];return _0x4bcd8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6b09('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6b09('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6b09('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6b09('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6b09('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6b09('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6b09('0x2')],'allowNull':![],'defaultValue':moment()['format'](_0x6b09('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 56f703a..ee6206d 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 _0xf5c8=['hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','rows','catch','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','update','then','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0xf5c8,0xcc));var _0x8f5c=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0xf5c8[_0x3bcf9e];return _0x1bb37c;};'use strict';var pdf=require(_0x8f5c('0x0'));var emlformat=require(_0x8f5c('0x1'));var rimraf=require(_0x8f5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8f5c('0x3'));var moment=require('moment');var BPromise=require(_0x8f5c('0x4'));var Mustache=require(_0x8f5c('0x5'));var util=require(_0x8f5c('0x6'));var path=require('path');var sox=require(_0x8f5c('0x7'));var csv=require(_0x8f5c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f5c('0x9'));var squel=require(_0x8f5c('0xa'));var crypto=require(_0x8f5c('0xb'));var jsforce=require(_0x8f5c('0xc'));var deskjs=require(_0x8f5c('0xd'));var toCsv=require(_0x8f5c('0x8'));var querystring=require(_0x8f5c('0xe'));var Papa=require('papaparse');var Redis=require(_0x8f5c('0xf'));var authService=require(_0x8f5c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f5c('0x11'));var logger=require(_0x8f5c('0x12'))(_0x8f5c('0x13'));var utils=require(_0x8f5c('0x14'));var config=require(_0x8f5c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f5c('0x16'))['db'];function respondWithStatusCode(_0xfaf294,_0x323988){_0x323988=_0x323988||0xcc;return function(_0x22a27c){if(_0x22a27c){return _0xfaf294[_0x8f5c('0x17')](_0x323988);}return _0xfaf294[_0x8f5c('0x18')](_0x323988)[_0x8f5c('0x19')]();};}function respondWithResult(_0x23a403,_0x16d26f){_0x16d26f=_0x16d26f||0xc8;return function(_0x4a982d){if(_0x4a982d){return _0x23a403[_0x8f5c('0x18')](_0x16d26f)[_0x8f5c('0x1a')](_0x4a982d);}};}function respondWithFilteredResult(_0x380ce0,_0x32d710){return function(_0x1b19e2){if(_0x1b19e2){var _0x503efe=_0x1b19e2[_0x8f5c('0x1b')],_0x552cb3=_0x32d710[_0x8f5c('0x1c')],_0x1eca95=_0x32d710[_0x8f5c('0x1c')]+_0x32d710[_0x8f5c('0x1d')],_0x355c32;if(_0x1eca95>=_0x503efe){_0x1eca95=_0x503efe;_0x355c32=0xc8;}else{_0x355c32=0xce;}_0x380ce0[_0x8f5c('0x18')](_0x355c32);return _0x380ce0['set']('Content-Range',_0x552cb3+'-'+_0x1eca95+'/'+_0x503efe)['json'](_0x1b19e2);}return null;};}function patchUpdates(_0x126a02){return function(_0x4026c2){try{jsonpatch['apply'](_0x4026c2,_0x126a02,!![]);}catch(_0x101c5c){return BPromise['reject'](_0x101c5c);}return _0x4026c2['save']();};}function saveUpdates(_0x12dd9e,_0x28db18){return function(_0x212112){if(_0x212112){return _0x212112[_0x8f5c('0x1e')](_0x12dd9e)[_0x8f5c('0x1f')](function(_0x336e2e){return _0x336e2e;});}return null;};}function removeEntity(_0x3d22b4,_0x3dd416){return function(_0x186690){if(_0x186690){return _0x186690['destroy']()[_0x8f5c('0x1f')](function(){_0x3d22b4['status'](0xcc)[_0x8f5c('0x19')]();});}};}function handleEntityNotFound(_0x4a1507,_0x5e1618){return function(_0x371141){if(!_0x371141){_0x4a1507['sendStatus'](0x194);}return _0x371141;};}function handleError(_0x2f1642,_0x520ae0){_0x520ae0=_0x520ae0||0x1f4;return function(_0xd2c7bf){logger[_0x8f5c('0x20')](_0xd2c7bf[_0x8f5c('0x21')]);if(_0xd2c7bf[_0x8f5c('0x22')]){delete _0xd2c7bf[_0x8f5c('0x22')];}_0x2f1642[_0x8f5c('0x18')](_0x520ae0)[_0x8f5c('0x23')](_0xd2c7bf);};}exports['index']=function(_0x5b2a4e,_0x3f9a45){var _0xad7918={},_0x57eb84={},_0xee690b={'count':0x0,'rows':[]};var _0x2dd105=_[_0x8f5c('0x24')](db[_0x8f5c('0x25')]['rawAttributes'],function(_0x3c0a5a){return{'name':_0x3c0a5a[_0x8f5c('0x26')],'type':_0x3c0a5a[_0x8f5c('0x27')][_0x8f5c('0x28')]};});_0x57eb84[_0x8f5c('0x29')]=_[_0x8f5c('0x24')](_0x2dd105,_0x8f5c('0x22'));_0x57eb84[_0x8f5c('0x2a')]=_[_0x8f5c('0x2b')](_0x5b2a4e[_0x8f5c('0x2a')]);_0x57eb84[_0x8f5c('0x2c')]=_[_0x8f5c('0x2d')](_0x57eb84[_0x8f5c('0x29')],_0x57eb84[_0x8f5c('0x2a')]);_0xad7918[_0x8f5c('0x2e')]=_['intersection'](_0x57eb84[_0x8f5c('0x29')],qs[_0x8f5c('0x2f')](_0x5b2a4e[_0x8f5c('0x2a')][_0x8f5c('0x2f')]));_0xad7918[_0x8f5c('0x2e')]=_0xad7918[_0x8f5c('0x2e')]['length']?_0xad7918[_0x8f5c('0x2e')]:_0x57eb84[_0x8f5c('0x29')];if(!_0x5b2a4e[_0x8f5c('0x2a')][_0x8f5c('0x30')](_0x8f5c('0x31'))){_0xad7918['limit']=qs[_0x8f5c('0x1d')](_0x5b2a4e[_0x8f5c('0x2a')][_0x8f5c('0x1d')]);_0xad7918[_0x8f5c('0x1c')]=qs[_0x8f5c('0x1c')](_0x5b2a4e['query'][_0x8f5c('0x1c')]);}_0xad7918['order']=qs[_0x8f5c('0x32')](_0x5b2a4e['query'][_0x8f5c('0x32')]);_0xad7918['where']=qs[_0x8f5c('0x2c')](_['pick'](_0x5b2a4e[_0x8f5c('0x2a')],_0x57eb84[_0x8f5c('0x2c')]),_0x2dd105);if(_0x5b2a4e[_0x8f5c('0x2a')][_0x8f5c('0x33')]){_0xad7918[_0x8f5c('0x34')]=_['merge'](_0xad7918['where'],{'$or':_['map'](_0x2dd105,function(_0x30f257){if(_0x30f257[_0x8f5c('0x27')]!==_0x8f5c('0x35')){var _0x4cab70={};_0x4cab70[_0x30f257[_0x8f5c('0x22')]]={'$like':'%'+_0x5b2a4e[_0x8f5c('0x2a')][_0x8f5c('0x33')]+'%'};return _0x4cab70;}})});}_0xad7918=_[_0x8f5c('0x36')]({},_0xad7918,_0x5b2a4e[_0x8f5c('0x37')]);var _0x5d78ee={'where':_0xad7918[_0x8f5c('0x34')]};return db['VoiceQueuesLog']['count'](_0x5d78ee)[_0x8f5c('0x1f')](function(_0x561555){_0xee690b[_0x8f5c('0x1b')]=_0x561555;if(_0x5b2a4e[_0x8f5c('0x2a')]['includeAll']){_0xad7918['include']=[{'all':!![]}];}return db[_0x8f5c('0x25')]['findAll'](_0xad7918);})['then'](function(_0x1a0302){_0xee690b[_0x8f5c('0x38')]=_0x1a0302;return _0xee690b;})[_0x8f5c('0x1f')](respondWithFilteredResult(_0x3f9a45,_0xad7918))[_0x8f5c('0x39')](handleError(_0x3f9a45,null));};exports['show']=function(_0x3e2e0f,_0x1ba9bb){var _0x635e16={'raw':!![],'where':{'id':_0x3e2e0f['params']['id']}},_0xe4b5c={};_0xe4b5c['model']=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0xe4b5c['query']=_[_0x8f5c('0x2b')](_0x3e2e0f[_0x8f5c('0x2a')]);_0xe4b5c[_0x8f5c('0x2c')]=_[_0x8f5c('0x2d')](_0xe4b5c['model'],_0xe4b5c[_0x8f5c('0x2a')]);_0x635e16[_0x8f5c('0x2e')]=_[_0x8f5c('0x2d')](_0xe4b5c[_0x8f5c('0x29')],qs[_0x8f5c('0x2f')](_0x3e2e0f[_0x8f5c('0x2a')][_0x8f5c('0x2f')]));_0x635e16[_0x8f5c('0x2e')]=_0x635e16[_0x8f5c('0x2e')]['length']?_0x635e16[_0x8f5c('0x2e')]:_0xe4b5c[_0x8f5c('0x29')];if(_0x3e2e0f[_0x8f5c('0x2a')][_0x8f5c('0x3a')]){_0x635e16['include']=[{'all':!![]}];}_0x635e16=_['merge']({},_0x635e16,_0x3e2e0f[_0x8f5c('0x37')]);return db[_0x8f5c('0x25')][_0x8f5c('0x3b')](_0x635e16)[_0x8f5c('0x1f')](handleEntityNotFound(_0x1ba9bb,null))[_0x8f5c('0x1f')](respondWithResult(_0x1ba9bb,null))[_0x8f5c('0x39')](handleError(_0x1ba9bb,null));};exports[_0x8f5c('0x3c')]=function(_0x148c73,_0x2a0199){return db['VoiceQueuesLog'][_0x8f5c('0x3c')](_0x148c73[_0x8f5c('0x3d')],{})[_0x8f5c('0x1f')](respondWithResult(_0x2a0199,0xc9))[_0x8f5c('0x39')](handleError(_0x2a0199,null));};exports[_0x8f5c('0x1e')]=function(_0x260069,_0x12913f){if(_0x260069[_0x8f5c('0x3d')]['id']){delete _0x260069[_0x8f5c('0x3d')]['id'];}return db[_0x8f5c('0x25')]['find']({'where':{'id':_0x260069[_0x8f5c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x12913f,null))[_0x8f5c('0x1f')](saveUpdates(_0x260069[_0x8f5c('0x3d')],null))[_0x8f5c('0x1f')](respondWithResult(_0x12913f,null))[_0x8f5c('0x39')](handleError(_0x12913f,null));};exports['destroy']=function(_0x259ff5,_0x22e669){return db[_0x8f5c('0x25')]['find']({'where':{'id':_0x259ff5['params']['id']}})[_0x8f5c('0x1f')](handleEntityNotFound(_0x22e669,null))[_0x8f5c('0x1f')](removeEntity(_0x22e669,null))[_0x8f5c('0x39')](handleError(_0x22e669,null));}; \ No newline at end of file +var _0xe87d=['../../mysqldb','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x203194,_0x546aa1){var _0x50307c=function(_0x15ee0d){while(--_0x15ee0d){_0x203194['push'](_0x203194['shift']());}};_0x50307c(++_0x546aa1);}(_0xe87d,0x16d));var _0xde87=function(_0x374f47,_0x100d6b){_0x374f47=_0x374f47-0x0;var _0x366b4f=_0xe87d[_0x374f47];return _0x366b4f;};'use strict';var pdf=require(_0xde87('0x0'));var emlformat=require(_0xde87('0x1'));var rimraf=require(_0xde87('0x2'));var zipdir=require(_0xde87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde87('0x4'));var moment=require(_0xde87('0x5'));var BPromise=require(_0xde87('0x6'));var Mustache=require('mustache');var util=require(_0xde87('0x7'));var path=require(_0xde87('0x8'));var sox=require(_0xde87('0x9'));var csv=require('to-csv');var ejs=require(_0xde87('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde87('0xb'));var crypto=require(_0xde87('0xc'));var jsforce=require(_0xde87('0xd'));var deskjs=require(_0xde87('0xe'));var toCsv=require(_0xde87('0xf'));var querystring=require(_0xde87('0x10'));var Papa=require('papaparse');var Redis=require(_0xde87('0x11'));var authService=require(_0xde87('0x12'));var qs=require(_0xde87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde87('0x14'));var logger=require(_0xde87('0x15'))(_0xde87('0x16'));var utils=require(_0xde87('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde87('0x18'));var db=require(_0xde87('0x19'))['db'];function respondWithStatusCode(_0x10a3bc,_0x216ba0){_0x216ba0=_0x216ba0||0xcc;return function(_0x1bb4ff){if(_0x1bb4ff){return _0x10a3bc['sendStatus'](_0x216ba0);}return _0x10a3bc[_0xde87('0x1a')](_0x216ba0)['end']();};}function respondWithResult(_0x41cfd6,_0xb71775){_0xb71775=_0xb71775||0xc8;return function(_0x2bbd40){if(_0x2bbd40){return _0x41cfd6['status'](_0xb71775)[_0xde87('0x1b')](_0x2bbd40);}};}function respondWithFilteredResult(_0xa36614,_0x471049){return function(_0x5a5cf5){if(_0x5a5cf5){var _0x2073d8=_0x5a5cf5[_0xde87('0x1c')],_0x7dfdb9=_0x471049[_0xde87('0x1d')],_0x16f1ef=_0x471049['offset']+_0x471049['limit'],_0x46c3e5;if(_0x16f1ef>=_0x2073d8){_0x16f1ef=_0x2073d8;_0x46c3e5=0xc8;}else{_0x46c3e5=0xce;}_0xa36614[_0xde87('0x1a')](_0x46c3e5);return _0xa36614['set'](_0xde87('0x1e'),_0x7dfdb9+'-'+_0x16f1ef+'/'+_0x2073d8)[_0xde87('0x1b')](_0x5a5cf5);}return null;};}function patchUpdates(_0x20e6fd){return function(_0x21c183){try{jsonpatch[_0xde87('0x1f')](_0x21c183,_0x20e6fd,!![]);}catch(_0x2b6824){return BPromise[_0xde87('0x20')](_0x2b6824);}return _0x21c183[_0xde87('0x21')]();};}function saveUpdates(_0x14d947,_0xde8a1a){return function(_0x7f4f0c){if(_0x7f4f0c){return _0x7f4f0c[_0xde87('0x22')](_0x14d947)[_0xde87('0x23')](function(_0x549d0c){return _0x549d0c;});}return null;};}function removeEntity(_0x1fe127,_0x365f5d){return function(_0x2e585a){if(_0x2e585a){return _0x2e585a[_0xde87('0x24')]()[_0xde87('0x23')](function(){_0x1fe127['status'](0xcc)[_0xde87('0x25')]();});}};}function handleEntityNotFound(_0x1171e8,_0x2ed2c){return function(_0x42e54e){if(!_0x42e54e){_0x1171e8['sendStatus'](0x194);}return _0x42e54e;};}function handleError(_0x11c3ee,_0x2f257a){_0x2f257a=_0x2f257a||0x1f4;return function(_0x1243c3){logger[_0xde87('0x26')](_0x1243c3[_0xde87('0x27')]);if(_0x1243c3[_0xde87('0x28')]){delete _0x1243c3['name'];}_0x11c3ee[_0xde87('0x1a')](_0x2f257a)[_0xde87('0x29')](_0x1243c3);};}exports[_0xde87('0x2a')]=function(_0x281c6f,_0x22db20){var _0x4f0950={},_0x2fe5b0={},_0x548612={'count':0x0,'rows':[]};var _0x8fa69b=_['map'](db[_0xde87('0x2b')][_0xde87('0x2c')],function(_0x402030){return{'name':_0x402030[_0xde87('0x2d')],'type':_0x402030[_0xde87('0x2e')][_0xde87('0x2f')]};});_0x2fe5b0[_0xde87('0x30')]=_[_0xde87('0x31')](_0x8fa69b,'name');_0x2fe5b0[_0xde87('0x32')]=_[_0xde87('0x33')](_0x281c6f['query']);_0x2fe5b0[_0xde87('0x34')]=_[_0xde87('0x35')](_0x2fe5b0[_0xde87('0x30')],_0x2fe5b0[_0xde87('0x32')]);_0x4f0950['attributes']=_[_0xde87('0x35')](_0x2fe5b0[_0xde87('0x30')],qs[_0xde87('0x36')](_0x281c6f[_0xde87('0x32')][_0xde87('0x36')]));_0x4f0950[_0xde87('0x37')]=_0x4f0950[_0xde87('0x37')][_0xde87('0x38')]?_0x4f0950['attributes']:_0x2fe5b0[_0xde87('0x30')];if(!_0x281c6f[_0xde87('0x32')][_0xde87('0x39')](_0xde87('0x3a'))){_0x4f0950['limit']=qs[_0xde87('0x3b')](_0x281c6f[_0xde87('0x32')][_0xde87('0x3b')]);_0x4f0950['offset']=qs[_0xde87('0x1d')](_0x281c6f[_0xde87('0x32')][_0xde87('0x1d')]);}_0x4f0950[_0xde87('0x3c')]=qs[_0xde87('0x3d')](_0x281c6f[_0xde87('0x32')][_0xde87('0x3d')]);_0x4f0950[_0xde87('0x3e')]=qs['filters'](_[_0xde87('0x3f')](_0x281c6f[_0xde87('0x32')],_0x2fe5b0[_0xde87('0x34')]),_0x8fa69b);if(_0x281c6f['query'][_0xde87('0x40')]){_0x4f0950[_0xde87('0x3e')]=_[_0xde87('0x41')](_0x4f0950['where'],{'$or':_[_0xde87('0x31')](_0x8fa69b,function(_0x209c40){if(_0x209c40['type']!==_0xde87('0x42')){var _0x2b714f={};_0x2b714f[_0x209c40[_0xde87('0x28')]]={'$like':'%'+_0x281c6f[_0xde87('0x32')][_0xde87('0x40')]+'%'};return _0x2b714f;}})});}_0x4f0950=_[_0xde87('0x41')]({},_0x4f0950,_0x281c6f[_0xde87('0x43')]);var _0x16519a={'where':_0x4f0950[_0xde87('0x3e')]};return db[_0xde87('0x2b')][_0xde87('0x1c')](_0x16519a)[_0xde87('0x23')](function(_0x216d66){_0x548612['count']=_0x216d66;if(_0x281c6f[_0xde87('0x32')][_0xde87('0x44')]){_0x4f0950[_0xde87('0x45')]=[{'all':!![]}];}return db[_0xde87('0x2b')][_0xde87('0x46')](_0x4f0950);})['then'](function(_0x62d41){_0x548612[_0xde87('0x47')]=_0x62d41;return _0x548612;})[_0xde87('0x23')](respondWithFilteredResult(_0x22db20,_0x4f0950))[_0xde87('0x48')](handleError(_0x22db20,null));};exports[_0xde87('0x49')]=function(_0x118195,_0x463538){var _0x464f53={'raw':!![],'where':{'id':_0x118195[_0xde87('0x4a')]['id']}},_0x3a5958={};_0x3a5958[_0xde87('0x30')]=_[_0xde87('0x33')](db['VoiceQueuesLog']['rawAttributes']);_0x3a5958[_0xde87('0x32')]=_[_0xde87('0x33')](_0x118195[_0xde87('0x32')]);_0x3a5958[_0xde87('0x34')]=_[_0xde87('0x35')](_0x3a5958[_0xde87('0x30')],_0x3a5958[_0xde87('0x32')]);_0x464f53[_0xde87('0x37')]=_[_0xde87('0x35')](_0x3a5958[_0xde87('0x30')],qs['fields'](_0x118195[_0xde87('0x32')][_0xde87('0x36')]));_0x464f53[_0xde87('0x37')]=_0x464f53[_0xde87('0x37')]['length']?_0x464f53[_0xde87('0x37')]:_0x3a5958['model'];if(_0x118195[_0xde87('0x32')][_0xde87('0x44')]){_0x464f53[_0xde87('0x45')]=[{'all':!![]}];}_0x464f53=_[_0xde87('0x41')]({},_0x464f53,_0x118195[_0xde87('0x43')]);return db[_0xde87('0x2b')][_0xde87('0x4b')](_0x464f53)[_0xde87('0x23')](handleEntityNotFound(_0x463538,null))[_0xde87('0x23')](respondWithResult(_0x463538,null))[_0xde87('0x48')](handleError(_0x463538,null));};exports[_0xde87('0x4c')]=function(_0x3c536f,_0x66e275){return db[_0xde87('0x2b')][_0xde87('0x4c')](_0x3c536f[_0xde87('0x4d')],{})[_0xde87('0x23')](respondWithResult(_0x66e275,0xc9))[_0xde87('0x48')](handleError(_0x66e275,null));};exports['update']=function(_0x5e137d,_0x594915){if(_0x5e137d['body']['id']){delete _0x5e137d[_0xde87('0x4d')]['id'];}return db['VoiceQueuesLog'][_0xde87('0x4b')]({'where':{'id':_0x5e137d[_0xde87('0x4a')]['id']}})[_0xde87('0x23')](handleEntityNotFound(_0x594915,null))[_0xde87('0x23')](saveUpdates(_0x5e137d[_0xde87('0x4d')],null))['then'](respondWithResult(_0x594915,null))[_0xde87('0x48')](handleError(_0x594915,null));};exports[_0xde87('0x24')]=function(_0x20b657,_0x2bb9e5){return db[_0xde87('0x2b')]['find']({'where':{'id':_0x20b657[_0xde87('0x4a')]['id']}})[_0xde87('0x23')](handleEntityNotFound(_0x2bb9e5,null))['then'](removeEntity(_0x2bb9e5,null))['catch'](handleError(_0x2bb9e5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3f3c020..86a1528 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 _0xc606=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','lodash','util','../../config/logger','request-promise'];(function(_0xa72d63,_0x544dbf){var _0x215317=function(_0x4c1f7a){while(--_0x4c1f7a){_0xa72d63['push'](_0xa72d63['shift']());}};_0x215317(++_0x544dbf);}(_0xc606,0x146));var _0x6c60=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xc606[_0x5c78d9];return _0x69ae1f;};'use strict';var _=require(_0x6c60('0x0'));var util=require(_0x6c60('0x1'));var logger=require(_0x6c60('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c60('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c60('0x4'));var config=require(_0x6c60('0x5'));var attributes=require(_0x6c60('0x6'));module[_0x6c60('0x7')]=function(_0x1a0a23,_0x964ba4){return _0x1a0a23[_0x6c60('0x8')](_0x6c60('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x6c60('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x2a12=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','event','dtm'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x2a12,0x1c7));var _0x22a1=function(_0x337537,_0x4ea7b8){_0x337537=_0x337537-0x0;var _0x4fdd67=_0x2a12[_0x337537];return _0x4fdd67;};'use strict';var _=require(_0x22a1('0x0'));var util=require('util');var logger=require(_0x22a1('0x1'))(_0x22a1('0x2'));var moment=require(_0x22a1('0x3'));var BPromise=require('bluebird');var rp=require(_0x22a1('0x4'));var fs=require('fs');var path=require(_0x22a1('0x5'));var rimraf=require('rimraf');var config=require(_0x22a1('0x6'));var attributes=require(_0x22a1('0x7'));module[_0x22a1('0x8')]=function(_0x14d8b7,_0x5dc72f){return _0x14d8b7['define']('VoiceQueuesLog',attributes,{'tableName':_0x22a1('0x9'),'paranoid':![],'indexes':[{'name':_0x22a1('0xa'),'fields':[_0x22a1('0xb'),_0x22a1('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b453f0e..8defb89 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 _0x373d=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x1d89f6,_0x41ffc2){var _0x519375=function(_0x864ba6){while(--_0x864ba6){_0x1d89f6['push'](_0x1d89f6['shift']());}};_0x519375(++_0x41ffc2);}(_0x373d,0x1e2));var _0xd373=function(_0x45eaaf,_0x615293){_0x45eaaf=_0x45eaaf-0x0;var _0x1d4947=_0x373d[_0x45eaaf];return _0x1d4947;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});} \ No newline at end of file +var _0x3c81=['VoiceQueuesLog,\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','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15f995,_0x4ec165){var _0x2f3d33=function(_0x1a4567){while(--_0x1a4567){_0x15f995['push'](_0x15f995['shift']());}};_0x2f3d33(++_0x4ec165);}(_0x3c81,0x102));var _0x13c8=function(_0x2f1fba,_0x5ce5ae){_0x2f1fba=_0x2f1fba-0x0;var _0x348618=_0x3c81[_0x2f1fba];return _0x348618;};'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')]('VoiceQueuesLog,\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/voiceRecording/index.js b/server/api/voiceRecording/index.js index ff15454..c3e277b 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 _0x8ae8=['downloadTranscribe','post','/:id/transcribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','download','downloads'];(function(_0x50214d,_0x1689bc){var _0x5ad036=function(_0x5cb66a){while(--_0x5cb66a){_0x50214d['push'](_0x50214d['shift']());}};_0x5ad036(++_0x1689bc);}(_0x8ae8,0xe9));var _0x88ae=function(_0x3b62b4,_0x2059ed){_0x3b62b4=_0x3b62b4-0x0;var _0x1b9f17=_0x8ae8[_0x3b62b4];return _0x1b9f17;};'use strict';var multer=require(_0x88ae('0x0'));var util=require(_0x88ae('0x1'));var path=require(_0x88ae('0x2'));var timeout=require(_0x88ae('0x3'));var express=require(_0x88ae('0x4'));var router=express[_0x88ae('0x5')]();var auth=require(_0x88ae('0x6'));var interaction=require(_0x88ae('0x7'));var config=require('../../config/environment');var controller=require(_0x88ae('0x8'));router[_0x88ae('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ae('0x9')](_0x88ae('0xa'),auth[_0x88ae('0xb')](),controller[_0x88ae('0xc')]);router[_0x88ae('0x9')](_0x88ae('0xd'),auth[_0x88ae('0xb')](),controller[_0x88ae('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x88ae('0xf')]);router['get']('/:id/downloads',controller[_0x88ae('0x10')]);router['get']('/:id/transcribe',auth[_0x88ae('0xb')](),controller[_0x88ae('0x11')]);router[_0x88ae('0x12')]('/',auth[_0x88ae('0xb')](),controller['create']);router[_0x88ae('0x12')](_0x88ae('0x13'),auth[_0x88ae('0xb')](),controller['runTranscribe']);router[_0x88ae('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x88ae('0x15')]);router[_0x88ae('0x16')]('/:id',auth[_0x88ae('0xb')](),controller[_0x88ae('0x17')]);module[_0x88ae('0x18')]=router; \ No newline at end of file +var _0x8efc=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/downloads','downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x4d169f,_0x33b96d){var _0x5c243b=function(_0x8e7ff1){while(--_0x8e7ff1){_0x4d169f['push'](_0x4d169f['shift']());}};_0x5c243b(++_0x33b96d);}(_0x8efc,0x14a));var _0xc8ef=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x8efc[_0x178668];return _0x26107d;};'use strict';var multer=require(_0xc8ef('0x0'));var util=require(_0xc8ef('0x1'));var path=require(_0xc8ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8ef('0x3'));var router=express[_0xc8ef('0x4')]();var auth=require(_0xc8ef('0x5'));var interaction=require(_0xc8ef('0x6'));var config=require(_0xc8ef('0x7'));var controller=require(_0xc8ef('0x8'));router[_0xc8ef('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8ef('0xa')]);router[_0xc8ef('0x9')](_0xc8ef('0xb'),auth[_0xc8ef('0xc')](),controller[_0xc8ef('0xd')]);router[_0xc8ef('0x9')](_0xc8ef('0xe'),auth[_0xc8ef('0xc')](),controller[_0xc8ef('0xf')]);router[_0xc8ef('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xc8ef('0x9')](_0xc8ef('0x10'),controller[_0xc8ef('0x11')]);router['get']('/:id/transcribe',auth[_0xc8ef('0xc')](),controller[_0xc8ef('0x12')]);router['post']('/',auth[_0xc8ef('0xc')](),controller[_0xc8ef('0x13')]);router[_0xc8ef('0x14')](_0xc8ef('0x15'),auth['isAuthenticated'](),controller[_0xc8ef('0x16')]);router[_0xc8ef('0x17')](_0xc8ef('0xe'),auth[_0xc8ef('0xc')](),controller[_0xc8ef('0x18')]);router[_0xc8ef('0x19')](_0xc8ef('0xe'),auth['isAuthenticated'](),controller[_0xc8ef('0x1a')]);module[_0xc8ef('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e1ced1a..6bab6f7 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 _0x717b=['channel','membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','setDataValue'];(function(_0x1eff3c,_0xc7808b){var _0x28f377=function(_0x478933){while(--_0x478933){_0x1eff3c['push'](_0x1eff3c['shift']());}};_0x28f377(++_0xc7808b);}(_0x717b,0x10a));var _0xb717=function(_0x7f153,_0x3e1c8b){_0x7f153=_0x7f153-0x0;var _0x5a2157=_0x717b[_0x7f153];return _0x5a2157;};'use strict';var Sequelize=require(_0xb717('0x0'));var moment=require(_0xb717('0x1'));var path=require(_0xb717('0x2'));module[_0xb717('0x3')]={'format':{'type':Sequelize[_0xb717('0x4')],'get':function(){return this[_0xb717('0x5')]('value')?path[_0xb717('0x6')](this[_0xb717('0x5')](_0xb717('0x7'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb717('0x8')]},'channel':{'type':Sequelize[_0xb717('0x8')],'set':function(_0x51445f){if(_0x51445f){this[_0xb717('0x9')](_0xb717('0xa'),_0x51445f);this[_0xb717('0x9')](_0xb717('0xb'),_0x51445f['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb717('0x8')]},'calleridnum':{'type':Sequelize[_0xb717('0x8')]},'calleridname':{'type':Sequelize[_0xb717('0x8')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb717('0x8')]},'accountcode':{'type':Sequelize[_0xb717('0x8')]},'context':{'type':Sequelize[_0xb717('0x8')]},'exten':{'type':Sequelize[_0xb717('0x8')]},'value':{'type':Sequelize[_0xb717('0x8')]},'type':{'type':Sequelize[_0xb717('0x8')]},'rating':{'type':Sequelize[_0xb717('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb717('0x8')]},'userDisposition':{'type':Sequelize[_0xb717('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xb717('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xb717('0xd')]},'transcribeName':{'type':Sequelize[_0xb717('0x8')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xb717('0xe')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xb717('0xd')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xb717('0xf')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0xb717('0xf')]},'sMixed':{'type':Sequelize[_0xb717('0xf')]},'tempSentiment':{'type':Sequelize[_0xb717('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xb717('0x11')],'get':function(){return moment(this[_0xb717('0x5')](_0xb717('0x12')))[_0xb717('0x13')](_0xb717('0x14'))[_0xb717('0x15')]();}},'updatedAt':{'type':Sequelize[_0xb717('0x11')],'get':function(){return moment(this['getDataValue'](_0xb717('0x16')))[_0xb717('0x13')](_0xb717('0x14'))[_0xb717('0x15')]();}}}; \ No newline at end of file +var _0xbe37=['MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','membername','split','TEXT','NEW','FLOAT','BOOLEAN','DATE','format'];(function(_0x2bfff1,_0xfd1139){var _0x35253c=function(_0x3ad3bd){while(--_0x3ad3bd){_0x2bfff1['push'](_0x2bfff1['shift']());}};_0x35253c(++_0xfd1139);}(_0xbe37,0x8f));var _0x7be3=function(_0x35da36,_0x3ca082){_0x35da36=_0x35da36-0x0;var _0x2b595e=_0xbe37[_0x35da36];return _0x2b595e;};'use strict';var Sequelize=require(_0x7be3('0x0'));var moment=require('moment');var path=require(_0x7be3('0x1'));module[_0x7be3('0x2')]={'format':{'type':Sequelize[_0x7be3('0x3')],'get':function(){return this[_0x7be3('0x4')](_0x7be3('0x5'))?path[_0x7be3('0x6')](this[_0x7be3('0x4')](_0x7be3('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x7be3('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x7f0aee){if(_0x7f0aee){this[_0x7be3('0x8')]('channel',_0x7f0aee);this[_0x7be3('0x8')](_0x7be3('0x9'),_0x7f0aee[_0x7be3('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7be3('0x7')]},'calleridnum':{'type':Sequelize[_0x7be3('0x7')]},'calleridname':{'type':Sequelize[_0x7be3('0x7')]},'connectedlinenum':{'type':Sequelize[_0x7be3('0x7')]},'connectedlinename':{'type':Sequelize[_0x7be3('0x7')]},'accountcode':{'type':Sequelize[_0x7be3('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7be3('0x7')]},'value':{'type':Sequelize[_0x7be3('0x7')]},'type':{'type':Sequelize[_0x7be3('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x7be3('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x7be3('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x7be3('0x7')]},'location':{'type':Sequelize[_0x7be3('0xb')]},'transcribeName':{'type':Sequelize[_0x7be3('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x7be3('0xc')},'fileUri':{'type':Sequelize[_0x7be3('0xb')]},'fileText':{'type':Sequelize[_0x7be3('0xb')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x7be3('0x7')]},'sPositive':{'type':Sequelize[_0x7be3('0xd')]},'sNegative':{'type':Sequelize[_0x7be3('0xd')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7be3('0xd')]},'tempSentiment':{'type':Sequelize[_0x7be3('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x7be3('0xf')],'get':function(){return moment(this[_0x7be3('0x4')]('createdAt'))[_0x7be3('0x10')](_0x7be3('0x11'))[_0x7be3('0x12')]();}},'updatedAt':{'type':Sequelize[_0x7be3('0xf')],'get':function(){return moment(this[_0x7be3('0x4')](_0x7be3('0x13')))[_0x7be3('0x10')](_0x7be3('0x11'))[_0x7be3('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 78c061b..3d0d77a 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 _0x843a=['show','intersection','find','catch','create','body','params','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','token','$and','push','secrets','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','format','[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','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Name','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','reject','save','update','then','destroy','sendStatus','error','stack','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x1f75b2,_0x565f63){var _0x4089a1=function(_0x15b0b9){while(--_0x15b0b9){_0x1f75b2['push'](_0x1f75b2['shift']());}};_0x4089a1(++_0x565f63);}(_0x843a,0x182));var _0xa843=function(_0x281ddd,_0x1fff43){_0x281ddd=_0x281ddd-0x0;var _0x148bde=_0x843a[_0x281ddd];return _0x148bde;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa843('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa843('0x1'));var rp=require(_0xa843('0x2'));var moment=require(_0xa843('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa843('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa843('0x5'));var csv=require(_0xa843('0x6'));var ejs=require(_0xa843('0x7'));var fs=require('fs');var _=require(_0xa843('0x8'));var squel=require(_0xa843('0x9'));var crypto=require(_0xa843('0xa'));var jsforce=require(_0xa843('0xb'));var deskjs=require(_0xa843('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa843('0xd'));var AWS=require(_0xa843('0xe'));var uuidv4=require(_0xa843('0xf'));var Redis=require(_0xa843('0x10'));var authService=require(_0xa843('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa843('0x12'));var hardwareService=require(_0xa843('0x13'));var logger=require(_0xa843('0x14'))(_0xa843('0x15'));var utils=require(_0xa843('0x16'));var config=require(_0xa843('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22e07a,_0x24f1e6){_0x24f1e6=_0x24f1e6||0xcc;return function(_0x5b8fe9){if(_0x5b8fe9){return _0x22e07a['sendStatus'](_0x24f1e6);}return _0x22e07a[_0xa843('0x18')](_0x24f1e6)[_0xa843('0x19')]();};}function respondWithResult(_0x457a32,_0x2de71f){_0x2de71f=_0x2de71f||0xc8;return function(_0x4acd22){if(_0x4acd22){return _0x457a32['status'](_0x2de71f)[_0xa843('0x1a')](_0x4acd22);}};}function respondWithFilteredResult(_0x5c36cd,_0x34f2fb){return function(_0x5c44a1){if(_0x5c44a1){var _0x284455=_0x5c44a1[_0xa843('0x1b')],_0x3db809=_0x34f2fb[_0xa843('0x1c')],_0x659fe3=_0x34f2fb[_0xa843('0x1c')]+_0x34f2fb['limit'],_0x49d254;if(_0x659fe3>=_0x284455){_0x659fe3=_0x284455;_0x49d254=0xc8;}else{_0x49d254=0xce;}_0x5c36cd[_0xa843('0x18')](_0x49d254);return _0x5c36cd[_0xa843('0x1d')]('Content-Range',_0x3db809+'-'+_0x659fe3+'/'+_0x284455)[_0xa843('0x1a')](_0x5c44a1);}return null;};}function patchUpdates(_0x17b0f0){return function(_0x54beef){try{jsonpatch['apply'](_0x54beef,_0x17b0f0,!![]);}catch(_0x3f0f0f){return BPromise[_0xa843('0x1e')](_0x3f0f0f);}return _0x54beef[_0xa843('0x1f')]();};}function saveUpdates(_0x3f725a,_0x19411b){return function(_0x486000){if(_0x486000){return _0x486000[_0xa843('0x20')](_0x3f725a)[_0xa843('0x21')](function(_0x18f45e){return _0x18f45e;});}return null;};}function removeEntity(_0x50d9da,_0x58d3e0){return function(_0x417cd0){if(_0x417cd0){return _0x417cd0[_0xa843('0x22')]()[_0xa843('0x21')](function(){_0x50d9da[_0xa843('0x18')](0xcc)[_0xa843('0x19')]();});}};}function handleEntityNotFound(_0x1821a1,_0x4fa8e4){return function(_0x42b449){if(!_0x42b449){_0x1821a1[_0xa843('0x23')](0x194);}return _0x42b449;};}function handleError(_0x2dfc97,_0x3eacbf){_0x3eacbf=_0x3eacbf||0x1f4;return function(_0xa23110){logger[_0xa843('0x24')](_0xa23110[_0xa843('0x25')]);if(_0xa23110['name']){delete _0xa23110['name'];}_0x2dfc97['status'](_0x3eacbf)['send'](_0xa23110);};}exports[_0xa843('0x26')]=function(_0x284b8c,_0x470c8a){var _0x510424={},_0x4ee201={},_0x6f56f9={'count':0x0,'rows':[]};var _0x4a79f7=_[_0xa843('0x27')](db[_0xa843('0x28')][_0xa843('0x29')],function(_0x41f7f5){return{'name':_0x41f7f5[_0xa843('0x2a')],'type':_0x41f7f5[_0xa843('0x2b')][_0xa843('0x2c')]};});_0x4ee201[_0xa843('0x2d')]=_['differenceBy'](_['map'](_0x4a79f7,_0xa843('0x2e')),['format']);_0x4ee201['query']=_[_0xa843('0x2f')](_0x284b8c[_0xa843('0x30')]);_0x4ee201['filters']=_['intersection'](_0x4ee201[_0xa843('0x2d')],_0x4ee201[_0xa843('0x30')]);_0x510424[_0xa843('0x31')]=_['intersection'](_0x4ee201[_0xa843('0x2d')],qs[_0xa843('0x32')](_0x284b8c['query']['fields']));_0x510424[_0xa843('0x31')]=_0x510424[_0xa843('0x31')][_0xa843('0x33')]?_0x510424[_0xa843('0x31')]:_0x4ee201[_0xa843('0x2d')];if(!_0x284b8c[_0xa843('0x30')][_0xa843('0x34')](_0xa843('0x35'))){_0x510424[_0xa843('0x36')]=qs[_0xa843('0x36')](_0x284b8c[_0xa843('0x30')][_0xa843('0x36')]);_0x510424[_0xa843('0x1c')]=qs[_0xa843('0x1c')](_0x284b8c[_0xa843('0x30')][_0xa843('0x1c')]);}_0x510424['order']=qs[_0xa843('0x37')](_0x284b8c[_0xa843('0x30')][_0xa843('0x37')]);_0x510424[_0xa843('0x38')]=qs['filters'](_[_0xa843('0x39')](_0x284b8c[_0xa843('0x30')],_0x4ee201[_0xa843('0x3a')]),_0x4a79f7);if(_0x284b8c['query'][_0xa843('0x3b')]){_0x510424[_0xa843('0x38')]=_[_0xa843('0x3c')](_0x510424[_0xa843('0x38')],{'$or':_[_0xa843('0x27')](_0x4a79f7,function(_0x1c7055){if(_0x1c7055[_0xa843('0x2b')]!==_0xa843('0x3d')){var _0x41d794={};_0x41d794[_0x1c7055[_0xa843('0x2e')]]={'$like':'%'+_0x284b8c[_0xa843('0x30')][_0xa843('0x3b')]+'%'};return _0x41d794;}})});}_0x510424=_[_0xa843('0x3c')]({},_0x510424,_0x284b8c[_0xa843('0x3e')]);var _0x27b294={'where':_0x510424[_0xa843('0x38')]};return db[_0xa843('0x28')]['count'](_0x27b294)['then'](function(_0x49b4f2){_0x6f56f9[_0xa843('0x1b')]=_0x49b4f2;if(_0x284b8c[_0xa843('0x30')][_0xa843('0x3f')]){_0x510424[_0xa843('0x40')]=[{'all':!![]}];}return db[_0xa843('0x28')][_0xa843('0x41')](_0x510424);})[_0xa843('0x21')](function(_0x51b702){_0x6f56f9[_0xa843('0x42')]=_0x51b702;return _0x6f56f9;})['then'](respondWithFilteredResult(_0x470c8a,_0x510424))['catch'](handleError(_0x470c8a,null));};exports[_0xa843('0x43')]=function(_0x3699bf,_0x3eb433){var _0x296d4d={'raw':![],'where':{'id':_0x3699bf['params']['id']}},_0x55fe22={};_0x55fe22[_0xa843('0x2d')]=_[_0xa843('0x2f')](db[_0xa843('0x28')][_0xa843('0x29')]);_0x55fe22[_0xa843('0x30')]=_[_0xa843('0x2f')](_0x3699bf[_0xa843('0x30')]);_0x55fe22[_0xa843('0x3a')]=_['intersection'](_0x55fe22[_0xa843('0x2d')],_0x55fe22[_0xa843('0x30')]);_0x296d4d[_0xa843('0x31')]=_[_0xa843('0x44')](_0x55fe22[_0xa843('0x2d')],qs['fields'](_0x3699bf['query']['fields']));_0x296d4d[_0xa843('0x31')]=_0x296d4d[_0xa843('0x31')][_0xa843('0x33')]?_0x296d4d['attributes']:_0x55fe22[_0xa843('0x2d')];if(_0x3699bf[_0xa843('0x30')][_0xa843('0x3f')]){_0x296d4d['include']=[{'all':!![]}];}_0x296d4d=_['merge']({},_0x296d4d,_0x3699bf[_0xa843('0x3e')]);return db[_0xa843('0x28')][_0xa843('0x45')](_0x296d4d)[_0xa843('0x21')](handleEntityNotFound(_0x3eb433,null))[_0xa843('0x21')](respondWithResult(_0x3eb433,null))[_0xa843('0x46')](handleError(_0x3eb433,null));};exports[_0xa843('0x47')]=function(_0x508d4a,_0x382e1c){return db[_0xa843('0x28')]['create'](_0x508d4a[_0xa843('0x48')],{})[_0xa843('0x21')](respondWithResult(_0x382e1c,0xc9))[_0xa843('0x46')](handleError(_0x382e1c,null));};exports['update']=function(_0x26fb50,_0x31d193){if(_0x26fb50[_0xa843('0x48')]['id']){delete _0x26fb50['body']['id'];}return db[_0xa843('0x28')]['find']({'where':{'id':_0x26fb50[_0xa843('0x49')]['id']}})[_0xa843('0x21')](handleEntityNotFound(_0x31d193,null))[_0xa843('0x21')](saveUpdates(_0x26fb50['body'],null))['then'](respondWithResult(_0x31d193,null))[_0xa843('0x46')](handleError(_0x31d193,null));};exports[_0xa843('0x4a')]=function(_0x56df69,_0x23d411){return db[_0xa843('0x28')][_0xa843('0x4a')]()[_0xa843('0x21')](respondWithResult(_0x23d411,null))['catch'](handleError(_0x23d411,null));};exports[_0xa843('0x4b')]=function(_0x4e907f,_0x4c0d24,_0x33b91b){var _0x290bd0=require('../../components/encryptor');var _0x49357a=![];var _0x1e8cb0={};if(_0x4e907f[_0xa843('0x30')][_0xa843('0x2b')]&&_0x4e907f[_0xa843('0x30')][_0xa843('0x2b')]==='uniqueid'){_0x1e8cb0[_0xa843('0x4c')]=_0x4e907f[_0xa843('0x49')]['id'];}else{_0x1e8cb0['id']=_0x4e907f[_0xa843('0x49')]['id'];}return db[_0xa843('0x28')][_0xa843('0x45')]({'where':_0x1e8cb0,'attributes':['id',_0xa843('0x4d')],'raw':!![]})[_0xa843('0x21')](handleEntityNotFound(_0x4c0d24,null))[_0xa843('0x21')](function(_0x57bdeb){if(_0x57bdeb){var _0x615c1a=_0x57bdeb[_0xa843('0x4d')];var _0x17acff=util['format'](_0xa843('0x4e'),_0x615c1a);if(fs[_0xa843('0x4f')](_0x17acff)){_0x49357a=!![];return _0x290bd0[_0xa843('0x50')](_0x17acff,_0x615c1a,config['secrets'][_0xa843('0x51')])[_0xa843('0x21')](function(){return _0x57bdeb;});}return _0x57bdeb;}})[_0xa843('0x21')](function(_0x36beb0){if(_0x36beb0){var _0x4f91d0=_0x36beb0['value'];if(!fs[_0xa843('0x4f')](_0x4f91d0)){throw new db[(_0xa843('0x52'))][(_0xa843('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x36beb0[_0xa843('0x54')]){return _0x4c0d24[_0xa843('0x4b')](_0x4f91d0,_0x36beb0[_0xa843('0x54')]+path[_0xa843('0x55')](_0x4f91d0),function(){if(_0x49357a){fs[_0xa843('0x56')](_0x4f91d0);}});}else{return _0x4c0d24['download'](_0x4f91d0,function(_0x570cf1){if(_0x49357a){fs[_0xa843('0x56')](_0x4f91d0);}});}}})['catch'](function(_0x13a983){if(_0x13a983[_0xa843('0x57')]===_0xa843('0x58')){_0x4c0d24[_0xa843('0x18')](0x194)[_0xa843('0x59')](_0xa843('0x5a'));}else{return handleError(_0x4c0d24,null);}});};exports[_0xa843('0x5b')]=function(_0x5bd4e9,_0xff75df,_0x2d2277){var _0x92d6b8=require('../../components/encryptor');var _0x383414=![];var _0x2047bf={'$and':[db[_0xa843('0x5c')][_0xa843('0x38')](db[_0xa843('0x5c')]['fn']('MD5',db['sequelize']['col'](_0xa843('0x4c'))),_0x5bd4e9['query'][_0xa843('0x5d')])]};if(_0x5bd4e9[_0xa843('0x30')][_0xa843('0x2b')]&&_0x5bd4e9[_0xa843('0x30')][_0xa843('0x2b')]==='uniqueid'){_0x2047bf[_0xa843('0x5e')][_0xa843('0x5f')]({'uniqueid':_0x5bd4e9[_0xa843('0x49')]['id']});}else{_0x2047bf[_0xa843('0x5e')][_0xa843('0x5f')]({'id':_0x5bd4e9[_0xa843('0x49')]['id']});}return db[_0xa843('0x28')][_0xa843('0x45')]({'where':_0x2047bf,'attributes':['id',_0xa843('0x4d')],'raw':!![]})[_0xa843('0x21')](handleEntityNotFound(_0xff75df,null))[_0xa843('0x21')](function(_0x2220b3){if(_0x2220b3){var _0x447cd6=util['format']('%s.cypher',_0x2220b3[_0xa843('0x4d')]);if(fs['existsSync'](_0x447cd6)){_0x383414=!![];return _0x92d6b8['decryptFile'](_0x447cd6,_0x2220b3[_0xa843('0x4d')],config[_0xa843('0x60')][_0xa843('0x51')])[_0xa843('0x21')](function(){return _0x2220b3;});}return _0x2220b3;}})[_0xa843('0x21')](function(_0x2df289){if(_0x2df289){if(!fs[_0xa843('0x4f')](_0x2df289[_0xa843('0x4d')])){throw new db[(_0xa843('0x52'))]['ValidationError'](_0xa843('0x58'));}if(_0x2df289[_0xa843('0x54')]){return _0xff75df[_0xa843('0x4b')](_0x2df289['value'],_0x2df289[_0xa843('0x54')]+path[_0xa843('0x55')](_0x2df289[_0xa843('0x4d')]),function(){if(_0x383414){fs[_0xa843('0x56')](_0x2df289[_0xa843('0x4d')]);}});}else{return _0xff75df[_0xa843('0x4b')](_0x2df289[_0xa843('0x4d')],function(_0x251b4f){if(_0x383414){fs[_0xa843('0x56')](_0x2df289[_0xa843('0x4d')]);}});}}})[_0xa843('0x46')](handleError(_0xff75df,null));};exports[_0xa843('0x22')]=function(_0x45c459,_0x4e6b82){return db[_0xa843('0x28')][_0xa843('0x45')]({'where':{'id':_0x45c459[_0xa843('0x49')]['id']}})['then'](function(_0x56b5a6){if(!_0x56b5a6)throw new ReferenceError(_0xa843('0x61'));return _0x56b5a6;})[_0xa843('0x21')](function(_0x24833e){var _0x453b63=_0x24833e[_0xa843('0x4d')];logger[_0xa843('0x62')](_0xa843('0x63'),_0x453b63);if(!_[_0xa843('0x64')](_0x24833e[_0xa843('0x4d')])&&fs[_0xa843('0x4f')](_0x453b63)){logger[_0xa843('0x62')](_0xa843('0x65')+_0x453b63+_0xa843('0x66'));fs[_0xa843('0x67')](_0x453b63);}_0x453b63=_0x453b63+_0xa843('0x68');if(!_[_0xa843('0x64')](_0x24833e['value'])&&fs[_0xa843('0x4f')](_0x453b63)){logger[_0xa843('0x62')](_0xa843('0x65')+_0x453b63+_0xa843('0x66'));fs['unlinkSync'](_0x453b63);}return _0x24833e;})[_0xa843('0x21')](function(_0x4b38a2){if(!_0x4b38a2)throw new InternalError();return _0x4b38a2[_0xa843('0x22')]();})['then'](function(){_0x4e6b82['status'](0xcc)[_0xa843('0x19')]();})['catch'](handleError(_0x4e6b82,null));};function getBucketslist(_0x228347,_0x2be219,_0x41ed25){return new Promise(function(_0x5e0b5f,_0x564da0){var _0xda2cb5=new AWS['S3']({'accessKeyId':_0x2be219,'secretAccessKey':_0x228347,'region':_0x41ed25});_0xda2cb5[_0xa843('0x69')]({},function(_0x41cbe2,_0x71ad7c){if(_0x41cbe2){return _0x564da0(_0x41cbe2);}else{return _0x5e0b5f(_0x71ad7c);}});});}function createBucket(_0x594f75,_0x5a5a73,_0x25d549,_0x4912ee){return new Promise(function(_0x5f5b19,_0x31f929){var _0x6200cc=new AWS['S3']({'accessKeyId':_0x5a5a73,'secretAccessKey':_0x594f75,'region':_0x25d549});_0x6200cc['createBucket']({'Bucket':_0x4912ee},function(_0x2483e4,_0x312ae3){if(_0x2483e4){return _0x31f929(_0x2483e4);}else{return _0x5f5b19(_0x312ae3);}});});}function uploadFile(_0x104513,_0x1b2a54,_0x3f52dd,_0x219942,_0x25a492,_0x134c7d){return new Promise(function(_0x188d47,_0x2f17ea){var _0xc47321=new AWS['S3']({'accessKeyId':_0x1b2a54,'secretAccessKey':_0x104513,'region':_0x3f52dd});_0xc47321[_0xa843('0x6a')]({'Bucket':_0x219942,'Key':_0x25a492,'Body':_0x134c7d},function(_0x28c0bd,_0x520b21){if(_0x28c0bd){return _0x2f17ea(_0x28c0bd);}else{return _0x188d47(_0x520b21);}});});}function startTranscribe(_0x5e6602,_0x478a2c,_0x2ec133,_0x64a87c,_0x1c881a,_0x5a3318){return new Promise(function(_0x7d7fe2,_0x5e3319){var _0x28bdec=new AWS[(_0xa843('0x6b'))]({'accessKeyId':_0x478a2c,'secretAccessKey':_0x5e6602,'region':_0x2ec133});_0x28bdec[_0xa843('0x6c')]({'TranscriptionJobName':_0x64a87c,'LanguageCode':_0x1c881a,'Media':{'MediaFileUri':_0x5a3318}},function(_0x547c44,_0x24c9c9){if(_0x547c44){return _0x5e3319(_0x547c44);}else{return _0x7d7fe2(_0x24c9c9);}});});}function transcribe(_0x243ee7,_0x2c9125,_0x31efd0,_0x2d9c78,_0x39932e,_0x1aaa75,_0x46cb1b){return new Promise(function(_0x5551bc,_0x5d6c9a){var _0x962c86={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x243ee7,_0x39932e));return uploadFile(_0x2c9125,_0x31efd0,_0x2d9c78,_0x39932e,path[_0xa843('0x6d')](_0x1aaa75),fs['readFileSync'](_0x1aaa75))[_0xa843('0x21')](function(_0x308c1f){logger[_0xa843('0x62')](util[_0xa843('0x6e')](_0xa843('0x6f'),_0x243ee7,_0x39932e,_0x308c1f[_0xa843('0x70')]));_0x962c86[_0xa843('0x71')]=_0x308c1f['Bucket'];_0x962c86[_0xa843('0x72')]=_0x308c1f[_0xa843('0x70')];logger[_0xa843('0x62')](util[_0xa843('0x6e')](_0xa843('0x73'),_0x243ee7));return startTranscribe(_0x2c9125,_0x31efd0,_0x2d9c78,uuidv4(),_0x46cb1b,_0x308c1f[_0xa843('0x70')]);})['then'](function(_0x2a544e){logger[_0xa843('0x62')](util[_0xa843('0x6e')](_0xa843('0x74'),_0x243ee7,_0x2a544e['TranscriptionJob']['TranscriptionJobName']));_0x962c86[_0xa843('0x75')]=_0x2a544e[_0xa843('0x76')][_0xa843('0x77')];_0x962c86[_0xa843('0x78')]=_0x2a544e[_0xa843('0x76')][_0xa843('0x79')];return _0x5551bc(_0x962c86);})[_0xa843('0x46')](function(_0x37fa4d){return _0x5d6c9a(_0x37fa4d);});});}exports[_0xa843('0x7a')]=function(_0x4df4d1,_0x3cfcaf,_0x203ef1){var _0x22682a;var _0x3cac24;var _0x56b292;var _0x5e10fc=require('../../components/encryptor');return db[_0xa843('0x28')]['findOne']({'where':{'id':_0x4df4d1[_0xa843('0x49')]['id']}})['then'](function(_0x235607){if(_0x235607){var _0x542f8c=util[_0xa843('0x6e')](_0xa843('0x4e'),_0x235607[_0xa843('0x4d')]);if(fs[_0xa843('0x4f')](_0x542f8c)){cypher=!![];return _0x5e10fc['decryptFile'](_0x542f8c,_0x235607[_0xa843('0x4d')],config[_0xa843('0x60')]['recording'])[_0xa843('0x21')](function(){return _0x235607;});}return _0x235607;}})[_0xa843('0x21')](function(_0x9e3d51){if(!_0x9e3d51){throw new db[(_0xa843('0x52'))][(_0xa843('0x53'))](_0xa843('0x7b'));}_0x3cac24=_0x9e3d51;return db[_0xa843('0x7c')][_0xa843('0x7d')]({'where':{'id':0x1}});})[_0xa843('0x21')](handleEntityNotFound(_0x3cfcaf,null))['then'](function(_0x3945fd){if(_0x3945fd){_0x22682a=_0x3945fd;if(!_0x22682a[_0xa843('0x7e')]||!_0x22682a[_0xa843('0x7f')]||!_0x22682a['transcribeRegion']||!_0x22682a[_0xa843('0x80')]||!_0x22682a[_0xa843('0x71')]){throw new db[(_0xa843('0x52'))]['ValidationError'](_0xa843('0x81'));}if(_0x4df4d1['body'][_0xa843('0x82')]&&(!_0x22682a[_0xa843('0x83')]||!_0x22682a['sentimentAccountId']||!_0x22682a[_0xa843('0x84')]||!_0x22682a[_0xa843('0x80')]||!_0x22682a[_0xa843('0x71')])){throw new db[(_0xa843('0x52'))][(_0xa843('0x53'))](_0xa843('0x85'));}return db['CloudProvider'][_0xa843('0x7d')]({'where':{'id':_0x22682a['transcribeAccountId']}});}})[_0xa843('0x21')](function(_0x13ba93){if(!_0x13ba93){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x13ba93['data1']||!_0x13ba93[_0xa843('0x86')]){throw new db['Sequelize'][(_0xa843('0x53'))](_0xa843('0x87'));}_0x56b292=_0x13ba93;return getBucketslist(_0x56b292['data1'],_0x56b292['data2'],_0x22682a[_0xa843('0x88')]);})[_0xa843('0x21')](function(_0x4c6818){if(_0x4c6818&&_0x4c6818['Buckets']){var _0x287909=_['find'](_0x4c6818['Buckets'],function(_0x23c3d4){return _0x23c3d4[_0xa843('0x89')]===_0x22682a[_0xa843('0x71')];});if(!_0x287909){logger[_0xa843('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4df4d1[_0xa843('0x49')]['id'],_0x22682a[_0xa843('0x71')]));return createBucket(_0x56b292[_0xa843('0x8a')],_0x56b292[_0xa843('0x86')],_0x22682a[_0xa843('0x88')],_0x22682a['bucket']);}logger[_0xa843('0x62')](util[_0xa843('0x6e')](_0xa843('0x8b'),_0x4df4d1[_0xa843('0x49')]['id'],_0x22682a[_0xa843('0x71')]));return;}})[_0xa843('0x21')](function(_0x66061e){if(_0x3cac24['transcribeStatus']===_0xa843('0x8c')){return transcribe(_0x4df4d1[_0xa843('0x49')]['id'],_0x56b292[_0xa843('0x8a')],_0x56b292['data2'],_0x22682a[_0xa843('0x88')],_0x22682a[_0xa843('0x71')],_0x3cac24['value'],_0x22682a['language']);}else{logger[_0xa843('0x62')](util[_0xa843('0x6e')](_0xa843('0x8d'),_0x4df4d1[_0xa843('0x49')]['id']));return{'transcribeStatus':_0xa843('0x8e')};}})[_0xa843('0x21')](function(_0x4b9aaf){if(_0x4b9aaf){_0x4b9aaf[_0xa843('0x8f')]=_0x4df4d1['body'][_0xa843('0x82')];return _0x3cac24[_0xa843('0x90')](_0x4b9aaf);}})[_0xa843('0x21')](respondWithResult(_0x3cfcaf,null))['catch'](handleError(_0x3cfcaf,null));};function writeFile(_0x2b8421,_0x112572){return new Promise(function(_0x214ca6,_0x287366){fs[_0xa843('0x91')](_0x112572,_0x2b8421,function(_0x189781,_0x571f9d){if(_0x189781){return _0x287366(_0x189781);}else{return _0x214ca6(_0x571f9d);}});});}exports[_0xa843('0x92')]=function(_0x289ce8,_0x102e72,_0x376d31){return db[_0xa843('0x28')][_0xa843('0x7d')]({'where':{'id':_0x289ce8[_0xa843('0x49')]['id']}})[_0xa843('0x21')](handleEntityNotFound(_0x102e72))['then'](function(_0x27fe5c){if(_0x27fe5c&&_0x27fe5c[_0xa843('0x93')]){var _0x42b73d=_0x27fe5c[_0xa843('0x93')];var _0x5f1af5=config['root']+_0xa843('0x94')+_0x27fe5c['id']+_0xa843('0x95');if(fs['existsSync'](_0x5f1af5)){return _0x5f1af5;}return writeFile(_0x42b73d,_0x5f1af5)['then'](function(){return _0x5f1af5;});}else{throw new db['Sequelize'][(_0xa843('0x53'))](_0xa843('0x96'));}})[_0xa843('0x21')](function(_0x2dfff2){return _0x102e72[_0xa843('0x4b')](_0x2dfff2);})[_0xa843('0x46')](handleError(_0x102e72));}; \ No newline at end of file +var _0x9b5d=['[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','transcribeName','runTranscribe','findOne','Setting','transcribeAccountId','transcribeRegion','language','runSentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','aws-sdk','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','find','catch','create','body','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','downloads','sequelize','MD5','push','$and','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync'];(function(_0x372d52,_0x5f723a){var _0x2dd986=function(_0x54fe46){while(--_0x54fe46){_0x372d52['push'](_0x372d52['shift']());}};_0x2dd986(++_0x5f723a);}(_0x9b5d,0x1c9));var _0xd9b5=function(_0x262234,_0x2daca7){_0x262234=_0x262234-0x0;var _0x4e2fc1=_0x9b5d[_0x262234];return _0x4e2fc1;};'use strict';var pdf=require(_0xd9b5('0x0'));var emlformat=require(_0xd9b5('0x1'));var rimraf=require(_0xd9b5('0x2'));var zipdir=require(_0xd9b5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9b5('0x4'));var moment=require(_0xd9b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9b5('0x6'));var util=require(_0xd9b5('0x7'));var path=require(_0xd9b5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9b5('0x9'));var fs=require('fs');var _=require(_0xd9b5('0xa'));var squel=require(_0xd9b5('0xb'));var crypto=require(_0xd9b5('0xc'));var jsforce=require(_0xd9b5('0xd'));var deskjs=require(_0xd9b5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xd9b5('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0xd9b5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd9b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9b5('0x12'));var logger=require(_0xd9b5('0x13'))(_0xd9b5('0x14'));var utils=require(_0xd9b5('0x15'));var config=require(_0xd9b5('0x16'));var licenseUtil=require(_0xd9b5('0x17'));var db=require(_0xd9b5('0x18'))['db'];function respondWithStatusCode(_0x1f8197,_0xc7653f){_0xc7653f=_0xc7653f||0xcc;return function(_0x394be2){if(_0x394be2){return _0x1f8197[_0xd9b5('0x19')](_0xc7653f);}return _0x1f8197[_0xd9b5('0x1a')](_0xc7653f)[_0xd9b5('0x1b')]();};}function respondWithResult(_0x1e7b3c,_0x1ad17b){_0x1ad17b=_0x1ad17b||0xc8;return function(_0x4c8fd3){if(_0x4c8fd3){return _0x1e7b3c['status'](_0x1ad17b)[_0xd9b5('0x1c')](_0x4c8fd3);}};}function respondWithFilteredResult(_0x1dc43c,_0x426699){return function(_0x2c35da){if(_0x2c35da){var _0x139413=_0x2c35da[_0xd9b5('0x1d')],_0x1b0707=_0x426699[_0xd9b5('0x1e')],_0x3e9e8f=_0x426699[_0xd9b5('0x1e')]+_0x426699['limit'],_0x5557d7;if(_0x3e9e8f>=_0x139413){_0x3e9e8f=_0x139413;_0x5557d7=0xc8;}else{_0x5557d7=0xce;}_0x1dc43c[_0xd9b5('0x1a')](_0x5557d7);return _0x1dc43c['set'](_0xd9b5('0x1f'),_0x1b0707+'-'+_0x3e9e8f+'/'+_0x139413)[_0xd9b5('0x1c')](_0x2c35da);}return null;};}function patchUpdates(_0x1ecb1e){return function(_0xba669f){try{jsonpatch['apply'](_0xba669f,_0x1ecb1e,!![]);}catch(_0x55706a){return BPromise[_0xd9b5('0x20')](_0x55706a);}return _0xba669f[_0xd9b5('0x21')]();};}function saveUpdates(_0x4984c5,_0x274d7f){return function(_0x591768){if(_0x591768){return _0x591768[_0xd9b5('0x22')](_0x4984c5)[_0xd9b5('0x23')](function(_0x4dca15){return _0x4dca15;});}return null;};}function removeEntity(_0x4281f6,_0x4a8436){return function(_0xf1e7e4){if(_0xf1e7e4){return _0xf1e7e4[_0xd9b5('0x24')]()[_0xd9b5('0x23')](function(){_0x4281f6[_0xd9b5('0x1a')](0xcc)[_0xd9b5('0x1b')]();});}};}function handleEntityNotFound(_0x5e8fd8,_0x3a6093){return function(_0x43b4e2){if(!_0x43b4e2){_0x5e8fd8[_0xd9b5('0x19')](0x194);}return _0x43b4e2;};}function handleError(_0x29f07d,_0x1d46e2){_0x1d46e2=_0x1d46e2||0x1f4;return function(_0x2f36eb){logger[_0xd9b5('0x25')](_0x2f36eb[_0xd9b5('0x26')]);if(_0x2f36eb['name']){delete _0x2f36eb[_0xd9b5('0x27')];}_0x29f07d['status'](_0x1d46e2)[_0xd9b5('0x28')](_0x2f36eb);};}exports[_0xd9b5('0x29')]=function(_0x171628,_0x5f2135){var _0x3bc66e={},_0x52dc0a={},_0x547a0e={'count':0x0,'rows':[]};var _0x5284cc=_[_0xd9b5('0x2a')](db[_0xd9b5('0x2b')][_0xd9b5('0x2c')],function(_0xdd3e2b){return{'name':_0xdd3e2b[_0xd9b5('0x2d')],'type':_0xdd3e2b[_0xd9b5('0x2e')][_0xd9b5('0x2f')]};});_0x52dc0a[_0xd9b5('0x30')]=_[_0xd9b5('0x31')](_['map'](_0x5284cc,_0xd9b5('0x27')),[_0xd9b5('0x32')]);_0x52dc0a['query']=_[_0xd9b5('0x33')](_0x171628[_0xd9b5('0x34')]);_0x52dc0a[_0xd9b5('0x35')]=_['intersection'](_0x52dc0a[_0xd9b5('0x30')],_0x52dc0a[_0xd9b5('0x34')]);_0x3bc66e['attributes']=_[_0xd9b5('0x36')](_0x52dc0a['model'],qs[_0xd9b5('0x37')](_0x171628[_0xd9b5('0x34')][_0xd9b5('0x37')]));_0x3bc66e[_0xd9b5('0x38')]=_0x3bc66e[_0xd9b5('0x38')]['length']?_0x3bc66e['attributes']:_0x52dc0a[_0xd9b5('0x30')];if(!_0x171628[_0xd9b5('0x34')][_0xd9b5('0x39')](_0xd9b5('0x3a'))){_0x3bc66e['limit']=qs[_0xd9b5('0x3b')](_0x171628[_0xd9b5('0x34')]['limit']);_0x3bc66e[_0xd9b5('0x1e')]=qs[_0xd9b5('0x1e')](_0x171628[_0xd9b5('0x34')][_0xd9b5('0x1e')]);}_0x3bc66e[_0xd9b5('0x3c')]=qs['sort'](_0x171628['query']['sort']);_0x3bc66e[_0xd9b5('0x3d')]=qs['filters'](_['pick'](_0x171628[_0xd9b5('0x34')],_0x52dc0a[_0xd9b5('0x35')]),_0x5284cc);if(_0x171628[_0xd9b5('0x34')][_0xd9b5('0x3e')]){_0x3bc66e[_0xd9b5('0x3d')]=_['merge'](_0x3bc66e[_0xd9b5('0x3d')],{'$or':_[_0xd9b5('0x2a')](_0x5284cc,function(_0x523a3b){if(_0x523a3b[_0xd9b5('0x2e')]!==_0xd9b5('0x3f')){var _0x4952ec={};_0x4952ec[_0x523a3b[_0xd9b5('0x27')]]={'$like':'%'+_0x171628[_0xd9b5('0x34')][_0xd9b5('0x3e')]+'%'};return _0x4952ec;}})});}_0x3bc66e=_[_0xd9b5('0x40')]({},_0x3bc66e,_0x171628[_0xd9b5('0x41')]);var _0x3b0335={'where':_0x3bc66e['where']};return db[_0xd9b5('0x2b')]['count'](_0x3b0335)[_0xd9b5('0x23')](function(_0x3b175d){_0x547a0e['count']=_0x3b175d;if(_0x171628['query'][_0xd9b5('0x42')]){_0x3bc66e[_0xd9b5('0x43')]=[{'all':!![]}];}return db[_0xd9b5('0x2b')][_0xd9b5('0x44')](_0x3bc66e);})[_0xd9b5('0x23')](function(_0x2c937c){_0x547a0e['rows']=_0x2c937c;return _0x547a0e;})[_0xd9b5('0x23')](respondWithFilteredResult(_0x5f2135,_0x3bc66e))['catch'](handleError(_0x5f2135,null));};exports['show']=function(_0x10aa4a,_0x28619c){var _0x27cb61={'raw':![],'where':{'id':_0x10aa4a[_0xd9b5('0x45')]['id']}},_0x338454={};_0x338454[_0xd9b5('0x30')]=_[_0xd9b5('0x33')](db[_0xd9b5('0x2b')][_0xd9b5('0x2c')]);_0x338454[_0xd9b5('0x34')]=_['keys'](_0x10aa4a[_0xd9b5('0x34')]);_0x338454[_0xd9b5('0x35')]=_['intersection'](_0x338454[_0xd9b5('0x30')],_0x338454['query']);_0x27cb61[_0xd9b5('0x38')]=_['intersection'](_0x338454[_0xd9b5('0x30')],qs[_0xd9b5('0x37')](_0x10aa4a[_0xd9b5('0x34')][_0xd9b5('0x37')]));_0x27cb61[_0xd9b5('0x38')]=_0x27cb61[_0xd9b5('0x38')][_0xd9b5('0x46')]?_0x27cb61[_0xd9b5('0x38')]:_0x338454[_0xd9b5('0x30')];if(_0x10aa4a['query'][_0xd9b5('0x42')]){_0x27cb61['include']=[{'all':!![]}];}_0x27cb61=_[_0xd9b5('0x40')]({},_0x27cb61,_0x10aa4a[_0xd9b5('0x41')]);return db[_0xd9b5('0x2b')][_0xd9b5('0x47')](_0x27cb61)['then'](handleEntityNotFound(_0x28619c,null))[_0xd9b5('0x23')](respondWithResult(_0x28619c,null))[_0xd9b5('0x48')](handleError(_0x28619c,null));};exports[_0xd9b5('0x49')]=function(_0x1a4919,_0x5d4de2){return db[_0xd9b5('0x2b')][_0xd9b5('0x49')](_0x1a4919[_0xd9b5('0x4a')],{})[_0xd9b5('0x23')](respondWithResult(_0x5d4de2,0xc9))[_0xd9b5('0x48')](handleError(_0x5d4de2,null));};exports['update']=function(_0x5215c7,_0x51f7dc){if(_0x5215c7[_0xd9b5('0x4a')]['id']){delete _0x5215c7[_0xd9b5('0x4a')]['id'];}return db[_0xd9b5('0x2b')][_0xd9b5('0x47')]({'where':{'id':_0x5215c7['params']['id']}})['then'](handleEntityNotFound(_0x51f7dc,null))[_0xd9b5('0x23')](saveUpdates(_0x5215c7[_0xd9b5('0x4a')],null))[_0xd9b5('0x23')](respondWithResult(_0x51f7dc,null))['catch'](handleError(_0x51f7dc,null));};exports['describe']=function(_0x410e27,_0x44fcc1){return db[_0xd9b5('0x2b')]['describe']()['then'](respondWithResult(_0x44fcc1,null))[_0xd9b5('0x48')](handleError(_0x44fcc1,null));};exports[_0xd9b5('0x4b')]=function(_0xcc0577,_0x273e0e,_0xd57066){var _0x1a1e90=require(_0xd9b5('0x4c'));var _0x4871a5=![];var _0x596dbe={};if(_0xcc0577[_0xd9b5('0x34')]['type']&&_0xcc0577[_0xd9b5('0x34')][_0xd9b5('0x2e')]===_0xd9b5('0x4d')){_0x596dbe['uniqueid']=_0xcc0577[_0xd9b5('0x45')]['id'];}else{_0x596dbe['id']=_0xcc0577[_0xd9b5('0x45')]['id'];}return db[_0xd9b5('0x2b')]['find']({'where':_0x596dbe,'attributes':['id',_0xd9b5('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x273e0e,null))[_0xd9b5('0x23')](function(_0xf2b56d){if(_0xf2b56d){var _0x475312=_0xf2b56d['value'];var _0x381afe=util[_0xd9b5('0x32')](_0xd9b5('0x4f'),_0x475312);if(fs[_0xd9b5('0x50')](_0x381afe)){_0x4871a5=!![];return _0x1a1e90[_0xd9b5('0x51')](_0x381afe,_0x475312,config[_0xd9b5('0x52')][_0xd9b5('0x53')])[_0xd9b5('0x23')](function(){return _0xf2b56d;});}return _0xf2b56d;}})[_0xd9b5('0x23')](function(_0x5d49f5){if(_0x5d49f5){var _0x2d91c7=_0x5d49f5[_0xd9b5('0x4e')];if(!fs[_0xd9b5('0x50')](_0x2d91c7)){throw new db[(_0xd9b5('0x54'))][(_0xd9b5('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x5d49f5[_0xd9b5('0x56')]){return _0x273e0e['download'](_0x2d91c7,_0x5d49f5[_0xd9b5('0x56')]+path[_0xd9b5('0x57')](_0x2d91c7),function(){if(_0x4871a5){fs[_0xd9b5('0x58')](_0x2d91c7);}});}else{return _0x273e0e[_0xd9b5('0x4b')](_0x2d91c7,function(_0x13065d){if(_0x4871a5){fs[_0xd9b5('0x58')](_0x2d91c7);}});}}})[_0xd9b5('0x48')](function(_0x106bef){if(_0x106bef[_0xd9b5('0x59')]==='VoiceRecording\x20not\x20found'){_0x273e0e['status'](0x194)[_0xd9b5('0x28')]('Not\x20found');}else{return handleError(_0x273e0e,null);}});};exports[_0xd9b5('0x5a')]=function(_0x12efaf,_0x2eedd7,_0x1b4805){var _0x2d2f34=require(_0xd9b5('0x4c'));var _0x356cbb=![];var _0x37de30={'$and':[db[_0xd9b5('0x5b')][_0xd9b5('0x3d')](db[_0xd9b5('0x5b')]['fn'](_0xd9b5('0x5c'),db['sequelize']['col']('uniqueid')),_0x12efaf[_0xd9b5('0x34')]['token'])]};if(_0x12efaf['query'][_0xd9b5('0x2e')]&&_0x12efaf[_0xd9b5('0x34')][_0xd9b5('0x2e')]===_0xd9b5('0x4d')){_0x37de30['$and'][_0xd9b5('0x5d')]({'uniqueid':_0x12efaf['params']['id']});}else{_0x37de30[_0xd9b5('0x5e')]['push']({'id':_0x12efaf[_0xd9b5('0x45')]['id']});}return db['VoiceRecording']['find']({'where':_0x37de30,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x2eedd7,null))[_0xd9b5('0x23')](function(_0x56e23b){if(_0x56e23b){var _0x102e29=util[_0xd9b5('0x32')](_0xd9b5('0x4f'),_0x56e23b[_0xd9b5('0x4e')]);if(fs['existsSync'](_0x102e29)){_0x356cbb=!![];return _0x2d2f34[_0xd9b5('0x51')](_0x102e29,_0x56e23b[_0xd9b5('0x4e')],config[_0xd9b5('0x52')][_0xd9b5('0x53')])[_0xd9b5('0x23')](function(){return _0x56e23b;});}return _0x56e23b;}})['then'](function(_0x2a0dda){if(_0x2a0dda){if(!fs['existsSync'](_0x2a0dda[_0xd9b5('0x4e')])){throw new db['Sequelize'][(_0xd9b5('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2a0dda[_0xd9b5('0x56')]){return _0x2eedd7[_0xd9b5('0x4b')](_0x2a0dda[_0xd9b5('0x4e')],_0x2a0dda[_0xd9b5('0x56')]+path['extname'](_0x2a0dda[_0xd9b5('0x4e')]),function(){if(_0x356cbb){fs['unlink'](_0x2a0dda[_0xd9b5('0x4e')]);}});}else{return _0x2eedd7['download'](_0x2a0dda['value'],function(_0x4ed048){if(_0x356cbb){fs[_0xd9b5('0x58')](_0x2a0dda[_0xd9b5('0x4e')]);}});}}})[_0xd9b5('0x48')](handleError(_0x2eedd7,null));};exports[_0xd9b5('0x24')]=function(_0x26817b,_0x4f3891){return db[_0xd9b5('0x2b')]['find']({'where':{'id':_0x26817b[_0xd9b5('0x45')]['id']}})['then'](function(_0x2edfd5){if(!_0x2edfd5)throw new ReferenceError('Entity\x20not\x20found');return _0x2edfd5;})['then'](function(_0x45b773){var _0x42b009=_0x45b773[_0xd9b5('0x4e')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x42b009);if(!_[_0xd9b5('0x5f')](_0x45b773['value'])&&fs['existsSync'](_0x42b009)){logger[_0xd9b5('0x60')](_0xd9b5('0x61')+_0x42b009+_0xd9b5('0x62'));fs[_0xd9b5('0x63')](_0x42b009);}_0x42b009=_0x42b009+_0xd9b5('0x64');if(!_[_0xd9b5('0x5f')](_0x45b773[_0xd9b5('0x4e')])&&fs[_0xd9b5('0x50')](_0x42b009)){logger[_0xd9b5('0x60')]('File:\x20\x22'+_0x42b009+_0xd9b5('0x62'));fs[_0xd9b5('0x63')](_0x42b009);}return _0x45b773;})[_0xd9b5('0x23')](function(_0x1fe9f5){if(!_0x1fe9f5)throw new InternalError();return _0x1fe9f5[_0xd9b5('0x24')]();})[_0xd9b5('0x23')](function(){_0x4f3891[_0xd9b5('0x1a')](0xcc)[_0xd9b5('0x1b')]();})[_0xd9b5('0x48')](handleError(_0x4f3891,null));};function getBucketslist(_0x3348e3,_0x332819,_0x1ff2a1){return new Promise(function(_0x4a3605,_0x1727a6){var _0x3fb009=new AWS['S3']({'accessKeyId':_0x332819,'secretAccessKey':_0x3348e3,'region':_0x1ff2a1});_0x3fb009[_0xd9b5('0x65')]({},function(_0x396686,_0x21833d){if(_0x396686){return _0x1727a6(_0x396686);}else{return _0x4a3605(_0x21833d);}});});}function createBucket(_0xbbc24c,_0x48776c,_0x24af87,_0x848971){return new Promise(function(_0x21b86c,_0x47d9f9){var _0x171b61=new AWS['S3']({'accessKeyId':_0x48776c,'secretAccessKey':_0xbbc24c,'region':_0x24af87});_0x171b61[_0xd9b5('0x66')]({'Bucket':_0x848971},function(_0x1a19c5,_0x4ac1e7){if(_0x1a19c5){return _0x47d9f9(_0x1a19c5);}else{return _0x21b86c(_0x4ac1e7);}});});}function uploadFile(_0x562e71,_0x42121e,_0x5a3915,_0x3bfb69,_0x211d10,_0x3260a4){return new Promise(function(_0x38102d,_0x198c2a){var _0x43ec54=new AWS['S3']({'accessKeyId':_0x42121e,'secretAccessKey':_0x562e71,'region':_0x5a3915});_0x43ec54['upload']({'Bucket':_0x3bfb69,'Key':_0x211d10,'Body':_0x3260a4},function(_0x57e31b,_0x280c92){if(_0x57e31b){return _0x198c2a(_0x57e31b);}else{return _0x38102d(_0x280c92);}});});}function startTranscribe(_0x379168,_0x307318,_0x560bd3,_0x194408,_0x4fc2ce,_0x93ca28){return new Promise(function(_0x2d63ff,_0xd6a063){var _0x471c06=new AWS[(_0xd9b5('0x67'))]({'accessKeyId':_0x307318,'secretAccessKey':_0x379168,'region':_0x560bd3});_0x471c06['startTranscriptionJob']({'TranscriptionJobName':_0x194408,'LanguageCode':_0x4fc2ce,'Media':{'MediaFileUri':_0x93ca28}},function(_0x3ee6dd,_0x40ef30){if(_0x3ee6dd){return _0xd6a063(_0x3ee6dd);}else{return _0x2d63ff(_0x40ef30);}});});}function transcribe(_0x3dfe73,_0x276595,_0x602236,_0xd32ab8,_0x35cc62,_0x3096db,_0x5ac8da){return new Promise(function(_0x3151ba,_0x44bef4){var _0x4a0bb8={};logger['info'](util['format'](_0xd9b5('0x68'),_0x3dfe73,_0x35cc62));return uploadFile(_0x276595,_0x602236,_0xd32ab8,_0x35cc62,path[_0xd9b5('0x69')](_0x3096db),fs[_0xd9b5('0x6a')](_0x3096db))[_0xd9b5('0x23')](function(_0x487416){logger[_0xd9b5('0x60')](util[_0xd9b5('0x32')](_0xd9b5('0x6b'),_0x3dfe73,_0x35cc62,_0x487416[_0xd9b5('0x6c')]));_0x4a0bb8['bucket']=_0x487416[_0xd9b5('0x6d')];_0x4a0bb8[_0xd9b5('0x6e')]=_0x487416[_0xd9b5('0x6c')];logger[_0xd9b5('0x60')](util[_0xd9b5('0x32')](_0xd9b5('0x6f'),_0x3dfe73));return startTranscribe(_0x276595,_0x602236,_0xd32ab8,uuidv4(),_0x5ac8da,_0x487416[_0xd9b5('0x6c')]);})['then'](function(_0x102fae){logger[_0xd9b5('0x60')](util[_0xd9b5('0x32')](_0xd9b5('0x70'),_0x3dfe73,_0x102fae[_0xd9b5('0x71')][_0xd9b5('0x72')]));_0x4a0bb8[_0xd9b5('0x73')]=_0x102fae['TranscriptionJob'][_0xd9b5('0x72')];_0x4a0bb8['transcribeStatus']=_0x102fae[_0xd9b5('0x71')]['TranscriptionJobStatus'];return _0x3151ba(_0x4a0bb8);})[_0xd9b5('0x48')](function(_0x33eb9f){return _0x44bef4(_0x33eb9f);});});}exports[_0xd9b5('0x74')]=function(_0x17338b,_0x2b14f8,_0x507ffd){var _0x1febca;var _0x47d3b5;var _0x53f9ce;var _0x139836=require(_0xd9b5('0x4c'));return db[_0xd9b5('0x2b')][_0xd9b5('0x75')]({'where':{'id':_0x17338b[_0xd9b5('0x45')]['id']}})['then'](function(_0x3febee){if(_0x3febee){var _0x2e2cd7=util[_0xd9b5('0x32')](_0xd9b5('0x4f'),_0x3febee[_0xd9b5('0x4e')]);if(fs['existsSync'](_0x2e2cd7)){cypher=!![];return _0x139836[_0xd9b5('0x51')](_0x2e2cd7,_0x3febee['value'],config[_0xd9b5('0x52')][_0xd9b5('0x53')])[_0xd9b5('0x23')](function(){return _0x3febee;});}return _0x3febee;}})[_0xd9b5('0x23')](function(_0x541d23){if(!_0x541d23){throw new db[(_0xd9b5('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x47d3b5=_0x541d23;return db[_0xd9b5('0x76')][_0xd9b5('0x75')]({'where':{'id':0x1}});})[_0xd9b5('0x23')](handleEntityNotFound(_0x2b14f8,null))[_0xd9b5('0x23')](function(_0x67eaa0){if(_0x67eaa0){_0x1febca=_0x67eaa0;if(!_0x1febca['transcribe']||!_0x1febca[_0xd9b5('0x77')]||!_0x1febca[_0xd9b5('0x78')]||!_0x1febca[_0xd9b5('0x79')]||!_0x1febca['bucket']){throw new db['Sequelize'][(_0xd9b5('0x55'))]('Transcribe\x20not\x20configured');}if(_0x17338b[_0xd9b5('0x4a')][_0xd9b5('0x7a')]&&(!_0x1febca['sentiment']||!_0x1febca['sentimentAccountId']||!_0x1febca['sentimentRegion']||!_0x1febca[_0xd9b5('0x79')]||!_0x1febca[_0xd9b5('0x7b')])){throw new db[(_0xd9b5('0x54'))][(_0xd9b5('0x55'))](_0xd9b5('0x7c'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1febca[_0xd9b5('0x77')]}});}})[_0xd9b5('0x23')](function(_0x32694c){if(!_0x32694c){throw new db[(_0xd9b5('0x54'))][(_0xd9b5('0x55'))](_0xd9b5('0x7d'));}if(!_0x32694c[_0xd9b5('0x7e')]||!_0x32694c['data2']){throw new db[(_0xd9b5('0x54'))][(_0xd9b5('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x53f9ce=_0x32694c;return getBucketslist(_0x53f9ce[_0xd9b5('0x7e')],_0x53f9ce[_0xd9b5('0x7f')],_0x1febca['transcribeRegion']);})[_0xd9b5('0x23')](function(_0x11038e){if(_0x11038e&&_0x11038e[_0xd9b5('0x80')]){var _0xc92874=_[_0xd9b5('0x47')](_0x11038e[_0xd9b5('0x80')],function(_0x1e0e09){return _0x1e0e09[_0xd9b5('0x81')]===_0x1febca['bucket'];});if(!_0xc92874){logger[_0xd9b5('0x60')](util[_0xd9b5('0x32')](_0xd9b5('0x82'),_0x17338b[_0xd9b5('0x45')]['id'],_0x1febca[_0xd9b5('0x7b')]));return createBucket(_0x53f9ce[_0xd9b5('0x7e')],_0x53f9ce[_0xd9b5('0x7f')],_0x1febca['transcribeRegion'],_0x1febca[_0xd9b5('0x7b')]);}logger[_0xd9b5('0x60')](util['format'](_0xd9b5('0x83'),_0x17338b[_0xd9b5('0x45')]['id'],_0x1febca[_0xd9b5('0x7b')]));return;}})[_0xd9b5('0x23')](function(_0x1a5f95){if(_0x47d3b5['transcribeStatus']===_0xd9b5('0x84')){return transcribe(_0x17338b[_0xd9b5('0x45')]['id'],_0x53f9ce[_0xd9b5('0x7e')],_0x53f9ce[_0xd9b5('0x7f')],_0x1febca[_0xd9b5('0x78')],_0x1febca[_0xd9b5('0x7b')],_0x47d3b5[_0xd9b5('0x4e')],_0x1febca[_0xd9b5('0x79')]);}else{logger[_0xd9b5('0x60')](util['format'](_0xd9b5('0x85'),_0x17338b['params']['id']));return{'transcribeStatus':_0xd9b5('0x86')};}})[_0xd9b5('0x23')](function(_0x13beee){if(_0x13beee){_0x13beee[_0xd9b5('0x87')]=_0x17338b[_0xd9b5('0x4a')][_0xd9b5('0x7a')];return _0x47d3b5['updateAttributes'](_0x13beee);}})[_0xd9b5('0x23')](respondWithResult(_0x2b14f8,null))[_0xd9b5('0x48')](handleError(_0x2b14f8,null));};function writeFile(_0x635824,_0x183864){return new Promise(function(_0x37c515,_0x450827){fs['writeFile'](_0x183864,_0x635824,function(_0x2ae2c4,_0x4a37c4){if(_0x2ae2c4){return _0x450827(_0x2ae2c4);}else{return _0x37c515(_0x4a37c4);}});});}exports[_0xd9b5('0x88')]=function(_0x117d4f,_0x478981,_0x222317){return db[_0xd9b5('0x2b')]['findOne']({'where':{'id':_0x117d4f['params']['id']}})[_0xd9b5('0x23')](handleEntityNotFound(_0x478981))['then'](function(_0x1ccf7d){if(_0x1ccf7d&&_0x1ccf7d[_0xd9b5('0x89')]){var _0x1c97e2=_0x1ccf7d[_0xd9b5('0x89')];var _0x2fc666=config[_0xd9b5('0x8a')]+'/server/files/transcribes/transcribe_'+_0x1ccf7d['id']+_0xd9b5('0x8b');if(fs[_0xd9b5('0x50')](_0x2fc666)){return _0x2fc666;}return writeFile(_0x1c97e2,_0x2fc666)[_0xd9b5('0x23')](function(){return _0x2fc666;});}else{throw new db['Sequelize'][(_0xd9b5('0x55'))](_0xd9b5('0x8c'));}})[_0xd9b5('0x23')](function(_0x250d4d){return _0x478981['download'](_0x250d4d);})[_0xd9b5('0x48')](handleError(_0x478981));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5bfc0cf..7f1fe79 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 _0x558c=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x1f36e0,_0x220b31){var _0x165902=function(_0x574e30){while(--_0x574e30){_0x1f36e0['push'](_0x1f36e0['shift']());}};_0x165902(++_0x220b31);}(_0x558c,0x137));var _0xc558=function(_0x9de5af,_0x3bddec){_0x9de5af=_0x9de5af-0x0;var _0x4c32f4=_0x558c[_0x9de5af];return _0x4c32f4;};'use strict';var _=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var logger=require(_0xc558('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc558('0x3'));var rp=require(_0xc558('0x4'));var fs=require('fs');var path=require(_0xc558('0x5'));var rimraf=require(_0xc558('0x6'));var config=require(_0xc558('0x7'));var attributes=require(_0xc558('0x8'));module['exports']=function(_0x5ac26b,_0x2d4ac2){return _0x5ac26b['define'](_0xc558('0x9'),attributes,{'tableName':_0xc558('0xa'),'paranoid':![],'indexes':[{'name':_0xc558('0xb'),'fields':[_0xc558('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84b7=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x25aa19,_0x2e9456){var _0xe1bd34=function(_0x11dd38){while(--_0x11dd38){_0x25aa19['push'](_0x25aa19['shift']());}};_0xe1bd34(++_0x2e9456);}(_0x84b7,0x1c6));var _0x784b=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x84b7[_0x3a9635];return _0x10d08c;};'use strict';var _=require(_0x784b('0x0'));var util=require('util');var logger=require(_0x784b('0x1'))(_0x784b('0x2'));var moment=require('moment');var BPromise=require(_0x784b('0x3'));var rp=require(_0x784b('0x4'));var fs=require('fs');var path=require(_0x784b('0x5'));var rimraf=require('rimraf');var config=require(_0x784b('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x784b('0x7')]=function(_0x568db5,_0x1c5cf0){return _0x568db5['define'](_0x784b('0x8'),attributes,{'tableName':_0x784b('0x9'),'paranoid':![],'indexes':[{'name':_0x784b('0xa'),'fields':[_0x784b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9060246..521320b 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(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x17516a,_0x2824c1){var _0x22e61f=function(_0x5f0226){while(--_0x5f0226){_0x17516a['push'](_0x17516a['shift']());}};_0x22e61f(++_0x2824c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 00f9342..d6c7849 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 _0xd786=['put','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd786,0xa4));var _0x6d78=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd786[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x6d78('0x0'));var util=require('util');var path=require(_0x6d78('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d78('0x2'));var router=express[_0x6d78('0x3')]();var auth=require(_0x6d78('0x4'));var interaction=require(_0x6d78('0x5'));var config=require(_0x6d78('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x6d78('0x7')]('/',auth['isAuthenticated'](),controller[_0x6d78('0x8')]);router[_0x6d78('0x7')](_0x6d78('0x9'),auth['isAuthenticated'](),controller[_0x6d78('0xa')]);router[_0x6d78('0x7')](_0x6d78('0xb'),auth[_0x6d78('0xc')](),controller[_0x6d78('0xd')]);router[_0x6d78('0xe')]('/',auth[_0x6d78('0xc')](),controller[_0x6d78('0xf')]);router[_0x6d78('0x10')](_0x6d78('0xb'),auth[_0x6d78('0xc')](),controller['update']);router[_0x6d78('0x11')](_0x6d78('0xb'),auth[_0x6d78('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf5e4=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2b8946,_0x475daf){var _0x5591aa=function(_0x3ce703){while(--_0x3ce703){_0x2b8946['push'](_0x2b8946['shift']());}};_0x5591aa(++_0x475daf);}(_0xf5e4,0xa6));var _0x4f5e=function(_0x2cf673,_0x2e9fd9){_0x2cf673=_0x2cf673-0x0;var _0x2da5cc=_0xf5e4[_0x2cf673];return _0x2da5cc;};'use strict';var multer=require(_0x4f5e('0x0'));var util=require(_0x4f5e('0x1'));var path=require(_0x4f5e('0x2'));var timeout=require(_0x4f5e('0x3'));var express=require(_0x4f5e('0x4'));var router=express[_0x4f5e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f5e('0x6'));var config=require(_0x4f5e('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x4f5e('0x8')]('/',auth[_0x4f5e('0x9')](),controller[_0x4f5e('0xa')]);router['get']('/describe',auth[_0x4f5e('0x9')](),controller[_0x4f5e('0xb')]);router['get'](_0x4f5e('0xc'),auth[_0x4f5e('0x9')](),controller['show']);router['post']('/',auth[_0x4f5e('0x9')](),controller[_0x4f5e('0xd')]);router[_0x4f5e('0xe')](_0x4f5e('0xc'),auth['isAuthenticated'](),controller[_0x4f5e('0xf')]);router[_0x4f5e('0x10')](_0x4f5e('0xc'),auth[_0x4f5e('0x9')](),controller[_0x4f5e('0x11')]);module[_0x4f5e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index df1a2e8..2805c49 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 _0x37cc=['attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x37cc,0xdb));var _0xc37c=function(_0x5b0071,_0x335e42){_0x5b0071=_0x5b0071-0x0;var _0x5a4d0a=_0x37cc[_0x5b0071];return _0x5a4d0a;};'use strict';var Sequelize=require(_0xc37c('0x0'));var moment=require('moment');module[_0xc37c('0x1')]={'type':{'type':Sequelize[_0xc37c('0x2')]('blind',_0xc37c('0x3'))},'result':{'type':Sequelize[_0xc37c('0x4')]},'transfererchannel':{'type':Sequelize[_0xc37c('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xc37c('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xc37c('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xc37c('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xc37c('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc37c('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc37c('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xc37c('0x4')]},'transfereecontext':{'type':Sequelize[_0xc37c('0x4')]},'transfereeexten':{'type':Sequelize[_0xc37c('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xc37c('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xc37c('0x5'),'No')},'context':{'type':Sequelize[_0xc37c('0x4')]},'extension':{'type':Sequelize[_0xc37c('0x4')]}}; \ No newline at end of file +var _0xfa16=['attended','STRING','sequelize','moment','exports','ENUM','blind'];(function(_0x10a32f,_0x195b16){var _0x39aaa0=function(_0x1eb3b3){while(--_0x1eb3b3){_0x10a32f['push'](_0x10a32f['shift']());}};_0x39aaa0(++_0x195b16);}(_0xfa16,0x8e));var _0x6fa1=function(_0x15eebd,_0x6fd883){_0x15eebd=_0x15eebd-0x0;var _0xbfb558=_0xfa16[_0x15eebd];return _0xbfb558;};'use strict';var Sequelize=require(_0x6fa1('0x0'));var moment=require(_0x6fa1('0x1'));module[_0x6fa1('0x2')]={'type':{'type':Sequelize[_0x6fa1('0x3')](_0x6fa1('0x4'),_0x6fa1('0x5'))},'result':{'type':Sequelize[_0x6fa1('0x6')]},'transfererchannel':{'type':Sequelize[_0x6fa1('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x6fa1('0x6')]},'transferercalleridname':{'type':Sequelize[_0x6fa1('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6fa1('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x6fa1('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x6fa1('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x6fa1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x6fa1('0x6')]},'transfereechannel':{'type':Sequelize[_0x6fa1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x6fa1('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x6fa1('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x6fa1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x6fa1('0x6')]},'transfereecontext':{'type':Sequelize[_0x6fa1('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x6fa1('0x6')]},'isexternal':{'type':Sequelize[_0x6fa1('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x6fa1('0x6')]},'extension':{'type':Sequelize[_0x6fa1('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7002469..2daa74b 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 _0x1b42=['then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x1b42,0x1c2));var _0x21b4=function(_0x95452a,_0x2de7e6){_0x95452a=_0x95452a-0x0;var _0xfa6961=_0x1b42[_0x95452a];return _0xfa6961;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x21b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21b4('0x1'));var rp=require(_0x21b4('0x2'));var moment=require(_0x21b4('0x3'));var BPromise=require(_0x21b4('0x4'));var Mustache=require('mustache');var util=require(_0x21b4('0x5'));var path=require(_0x21b4('0x6'));var sox=require(_0x21b4('0x7'));var csv=require(_0x21b4('0x8'));var ejs=require(_0x21b4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21b4('0xa'));var crypto=require(_0x21b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21b4('0xc'));var toCsv=require(_0x21b4('0x8'));var querystring=require(_0x21b4('0xd'));var Papa=require(_0x21b4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21b4('0xf'));var as=require(_0x21b4('0x10'));var hardwareService=require(_0x21b4('0x11'));var logger=require(_0x21b4('0x12'))(_0x21b4('0x13'));var utils=require('../../config/utils');var config=require(_0x21b4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x21b4('0x15'))['db'];function respondWithStatusCode(_0x2466ed,_0x1eff38){_0x1eff38=_0x1eff38||0xcc;return function(_0x2df18b){if(_0x2df18b){return _0x2466ed[_0x21b4('0x16')](_0x1eff38);}return _0x2466ed[_0x21b4('0x17')](_0x1eff38)[_0x21b4('0x18')]();};}function respondWithResult(_0x1deab3,_0x3f1bc7){_0x3f1bc7=_0x3f1bc7||0xc8;return function(_0x1e9eb0){if(_0x1e9eb0){return _0x1deab3[_0x21b4('0x17')](_0x3f1bc7)[_0x21b4('0x19')](_0x1e9eb0);}};}function respondWithFilteredResult(_0x462fc6,_0x545670){return function(_0x1aa22a){if(_0x1aa22a){var _0x3660e9=_0x1aa22a['count'],_0x3958f8=_0x545670[_0x21b4('0x1a')],_0x59177d=_0x545670[_0x21b4('0x1a')]+_0x545670[_0x21b4('0x1b')],_0x471321;if(_0x59177d>=_0x3660e9){_0x59177d=_0x3660e9;_0x471321=0xc8;}else{_0x471321=0xce;}_0x462fc6[_0x21b4('0x17')](_0x471321);return _0x462fc6[_0x21b4('0x1c')](_0x21b4('0x1d'),_0x3958f8+'-'+_0x59177d+'/'+_0x3660e9)[_0x21b4('0x19')](_0x1aa22a);}return null;};}function patchUpdates(_0x126c08){return function(_0xae1b19){try{jsonpatch['apply'](_0xae1b19,_0x126c08,!![]);}catch(_0x5ce058){return BPromise[_0x21b4('0x1e')](_0x5ce058);}return _0xae1b19['save']();};}function saveUpdates(_0x2406fe,_0x34d534){return function(_0x3fb363){if(_0x3fb363){return _0x3fb363[_0x21b4('0x1f')](_0x2406fe)['then'](function(_0x36f15b){return _0x36f15b;});}return null;};}function removeEntity(_0x25dc5e,_0x15dea9){return function(_0x2ee115){if(_0x2ee115){return _0x2ee115[_0x21b4('0x20')]()['then'](function(){_0x25dc5e[_0x21b4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a9f34,_0x3663ec){return function(_0x3c7511){if(!_0x3c7511){_0x2a9f34['sendStatus'](0x194);}return _0x3c7511;};}function handleError(_0x4c36a0,_0x257cf4){_0x257cf4=_0x257cf4||0x1f4;return function(_0x5a6176){logger[_0x21b4('0x21')](_0x5a6176[_0x21b4('0x22')]);if(_0x5a6176[_0x21b4('0x23')]){delete _0x5a6176[_0x21b4('0x23')];}_0x4c36a0[_0x21b4('0x17')](_0x257cf4)[_0x21b4('0x24')](_0x5a6176);};}exports['index']=function(_0x369e1b,_0x3b90d2){var _0x7c223e={},_0x10c0d6={},_0x3d72e6={'count':0x0,'rows':[]};var _0x45a3da=_[_0x21b4('0x25')](db[_0x21b4('0x26')][_0x21b4('0x27')],function(_0x16db19){return{'name':_0x16db19[_0x21b4('0x28')],'type':_0x16db19[_0x21b4('0x29')][_0x21b4('0x2a')]};});_0x10c0d6[_0x21b4('0x2b')]=_[_0x21b4('0x25')](_0x45a3da,_0x21b4('0x23'));_0x10c0d6[_0x21b4('0x2c')]=_[_0x21b4('0x2d')](_0x369e1b[_0x21b4('0x2c')]);_0x10c0d6[_0x21b4('0x2e')]=_[_0x21b4('0x2f')](_0x10c0d6[_0x21b4('0x2b')],_0x10c0d6['query']);_0x7c223e[_0x21b4('0x30')]=_['intersection'](_0x10c0d6[_0x21b4('0x2b')],qs[_0x21b4('0x31')](_0x369e1b['query'][_0x21b4('0x31')]));_0x7c223e[_0x21b4('0x30')]=_0x7c223e['attributes'][_0x21b4('0x32')]?_0x7c223e[_0x21b4('0x30')]:_0x10c0d6[_0x21b4('0x2b')];if(!_0x369e1b['query'][_0x21b4('0x33')](_0x21b4('0x34'))){_0x7c223e[_0x21b4('0x1b')]=qs['limit'](_0x369e1b['query'][_0x21b4('0x1b')]);_0x7c223e[_0x21b4('0x1a')]=qs['offset'](_0x369e1b[_0x21b4('0x2c')][_0x21b4('0x1a')]);}_0x7c223e[_0x21b4('0x35')]=qs[_0x21b4('0x36')](_0x369e1b[_0x21b4('0x2c')][_0x21b4('0x36')]);_0x7c223e[_0x21b4('0x37')]=qs[_0x21b4('0x2e')](_[_0x21b4('0x38')](_0x369e1b['query'],_0x10c0d6[_0x21b4('0x2e')]),_0x45a3da);if(_0x369e1b['query'][_0x21b4('0x39')]){_0x7c223e[_0x21b4('0x37')]=_[_0x21b4('0x3a')](_0x7c223e['where'],{'$or':_[_0x21b4('0x25')](_0x45a3da,function(_0xdb0b5){if(_0xdb0b5[_0x21b4('0x29')]!=='VIRTUAL'){var _0x1b9907={};_0x1b9907[_0xdb0b5['name']]={'$like':'%'+_0x369e1b[_0x21b4('0x2c')]['filter']+'%'};return _0x1b9907;}})});}_0x7c223e=_[_0x21b4('0x3a')]({},_0x7c223e,_0x369e1b[_0x21b4('0x3b')]);var _0x3350cd={'where':_0x7c223e[_0x21b4('0x37')]};return db['VoiceTransferReport'][_0x21b4('0x3c')](_0x3350cd)[_0x21b4('0x3d')](function(_0x522494){_0x3d72e6['count']=_0x522494;if(_0x369e1b[_0x21b4('0x2c')][_0x21b4('0x3e')]){_0x7c223e[_0x21b4('0x3f')]=[{'all':!![]}];}return db[_0x21b4('0x26')][_0x21b4('0x40')](_0x7c223e);})[_0x21b4('0x3d')](function(_0x335e92){_0x3d72e6[_0x21b4('0x41')]=_0x335e92;return _0x3d72e6;})[_0x21b4('0x3d')](respondWithFilteredResult(_0x3b90d2,_0x7c223e))[_0x21b4('0x42')](handleError(_0x3b90d2,null));};exports[_0x21b4('0x43')]=function(_0x2e807a,_0x1c7874){var _0x4f9ee9={'raw':!![],'where':{'id':_0x2e807a[_0x21b4('0x44')]['id']}},_0x2b1c76={};_0x2b1c76[_0x21b4('0x2b')]=_['keys'](db[_0x21b4('0x26')][_0x21b4('0x27')]);_0x2b1c76[_0x21b4('0x2c')]=_[_0x21b4('0x2d')](_0x2e807a['query']);_0x2b1c76['filters']=_['intersection'](_0x2b1c76[_0x21b4('0x2b')],_0x2b1c76['query']);_0x4f9ee9[_0x21b4('0x30')]=_[_0x21b4('0x2f')](_0x2b1c76[_0x21b4('0x2b')],qs['fields'](_0x2e807a[_0x21b4('0x2c')][_0x21b4('0x31')]));_0x4f9ee9[_0x21b4('0x30')]=_0x4f9ee9[_0x21b4('0x30')][_0x21b4('0x32')]?_0x4f9ee9['attributes']:_0x2b1c76[_0x21b4('0x2b')];if(_0x2e807a[_0x21b4('0x2c')][_0x21b4('0x3e')]){_0x4f9ee9[_0x21b4('0x3f')]=[{'all':!![]}];}_0x4f9ee9=_[_0x21b4('0x3a')]({},_0x4f9ee9,_0x2e807a[_0x21b4('0x3b')]);return db['VoiceTransferReport'][_0x21b4('0x45')](_0x4f9ee9)[_0x21b4('0x3d')](handleEntityNotFound(_0x1c7874,null))['then'](respondWithResult(_0x1c7874,null))[_0x21b4('0x42')](handleError(_0x1c7874,null));};exports[_0x21b4('0x46')]=function(_0x39879e,_0x1d43a0){return db[_0x21b4('0x26')][_0x21b4('0x46')](_0x39879e[_0x21b4('0x47')],{})[_0x21b4('0x3d')](respondWithResult(_0x1d43a0,0xc9))[_0x21b4('0x42')](handleError(_0x1d43a0,null));};exports['update']=function(_0x50490e,_0x199d98){if(_0x50490e[_0x21b4('0x47')]['id']){delete _0x50490e[_0x21b4('0x47')]['id'];}return db[_0x21b4('0x26')][_0x21b4('0x45')]({'where':{'id':_0x50490e[_0x21b4('0x44')]['id']}})[_0x21b4('0x3d')](handleEntityNotFound(_0x199d98,null))['then'](saveUpdates(_0x50490e['body'],null))[_0x21b4('0x3d')](respondWithResult(_0x199d98,null))['catch'](handleError(_0x199d98,null));};exports[_0x21b4('0x20')]=function(_0x22fe8d,_0x448249){return db[_0x21b4('0x26')][_0x21b4('0x45')]({'where':{'id':_0x22fe8d[_0x21b4('0x44')]['id']}})['then'](handleEntityNotFound(_0x448249,null))[_0x21b4('0x3d')](removeEntity(_0x448249,null))['catch'](handleError(_0x448249,null));};exports[_0x21b4('0x48')]=function(_0x3d5530,_0xe6bc74){return db[_0x21b4('0x26')][_0x21b4('0x48')]()[_0x21b4('0x3d')](respondWithResult(_0xe6bc74,null))[_0x21b4('0x42')](handleError(_0xe6bc74,null));}; \ No newline at end of file +var _0x8c73=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','end','status','offset','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','name','send','map','VoiceTransferReport','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','count','includeAll','rows','catch','keys','rawAttributes','length','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x8c73,0x183));var _0x38c7=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0x8c73[_0x40bdbc];return _0xc603a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x38c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38c7('0x1'));var jsonpatch=require(_0x38c7('0x2'));var rp=require(_0x38c7('0x3'));var moment=require(_0x38c7('0x4'));var BPromise=require(_0x38c7('0x5'));var Mustache=require(_0x38c7('0x6'));var util=require(_0x38c7('0x7'));var path=require(_0x38c7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x38c7('0x9'));var squel=require(_0x38c7('0xa'));var crypto=require(_0x38c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x38c7('0xc'));var toCsv=require(_0x38c7('0xd'));var querystring=require(_0x38c7('0xe'));var Papa=require(_0x38c7('0xf'));var Redis=require(_0x38c7('0x10'));var authService=require(_0x38c7('0x11'));var qs=require(_0x38c7('0x12'));var as=require(_0x38c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x38c7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38c7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0a99,_0x4809f5){_0x4809f5=_0x4809f5||0xcc;return function(_0x3e9be8){if(_0x3e9be8){return _0x4e0a99['sendStatus'](_0x4809f5);}return _0x4e0a99['status'](_0x4809f5)[_0x38c7('0x16')]();};}function respondWithResult(_0x2a1267,_0x2b413b){_0x2b413b=_0x2b413b||0xc8;return function(_0x24a468){if(_0x24a468){return _0x2a1267[_0x38c7('0x17')](_0x2b413b)['json'](_0x24a468);}};}function respondWithFilteredResult(_0x1fb720,_0xa09773){return function(_0x34ca5d){if(_0x34ca5d){var _0x1e9354=_0x34ca5d['count'],_0xbc06bb=_0xa09773[_0x38c7('0x18')],_0x15b120=_0xa09773[_0x38c7('0x18')]+_0xa09773[_0x38c7('0x19')],_0x53755e;if(_0x15b120>=_0x1e9354){_0x15b120=_0x1e9354;_0x53755e=0xc8;}else{_0x53755e=0xce;}_0x1fb720['status'](_0x53755e);return _0x1fb720['set'](_0x38c7('0x1a'),_0xbc06bb+'-'+_0x15b120+'/'+_0x1e9354)[_0x38c7('0x1b')](_0x34ca5d);}return null;};}function patchUpdates(_0x3309b7){return function(_0x331a36){try{jsonpatch[_0x38c7('0x1c')](_0x331a36,_0x3309b7,!![]);}catch(_0x569243){return BPromise['reject'](_0x569243);}return _0x331a36[_0x38c7('0x1d')]();};}function saveUpdates(_0x539499,_0xb2c20f){return function(_0x6fe226){if(_0x6fe226){return _0x6fe226[_0x38c7('0x1e')](_0x539499)[_0x38c7('0x1f')](function(_0x192ea0){return _0x192ea0;});}return null;};}function removeEntity(_0x41ef90,_0xcc467a){return function(_0x3a5f42){if(_0x3a5f42){return _0x3a5f42[_0x38c7('0x20')]()[_0x38c7('0x1f')](function(){_0x41ef90['status'](0xcc)[_0x38c7('0x16')]();});}};}function handleEntityNotFound(_0x446897,_0x46f298){return function(_0x4d5da2){if(!_0x4d5da2){_0x446897[_0x38c7('0x21')](0x194);}return _0x4d5da2;};}function handleError(_0x2eb864,_0x4955ac){_0x4955ac=_0x4955ac||0x1f4;return function(_0x4f8652){logger['error'](_0x4f8652['stack']);if(_0x4f8652[_0x38c7('0x22')]){delete _0x4f8652[_0x38c7('0x22')];}_0x2eb864['status'](_0x4955ac)[_0x38c7('0x23')](_0x4f8652);};}exports['index']=function(_0x3657df,_0x10146c){var _0x48d809={},_0x16bb74={},_0x44578c={'count':0x0,'rows':[]};var _0x38d77e=_[_0x38c7('0x24')](db[_0x38c7('0x25')]['rawAttributes'],function(_0x5b4160){return{'name':_0x5b4160[_0x38c7('0x26')],'type':_0x5b4160['type'][_0x38c7('0x27')]};});_0x16bb74[_0x38c7('0x28')]=_['map'](_0x38d77e,_0x38c7('0x22'));_0x16bb74[_0x38c7('0x29')]=_['keys'](_0x3657df[_0x38c7('0x29')]);_0x16bb74[_0x38c7('0x2a')]=_[_0x38c7('0x2b')](_0x16bb74[_0x38c7('0x28')],_0x16bb74['query']);_0x48d809[_0x38c7('0x2c')]=_[_0x38c7('0x2b')](_0x16bb74[_0x38c7('0x28')],qs[_0x38c7('0x2d')](_0x3657df[_0x38c7('0x29')]['fields']));_0x48d809['attributes']=_0x48d809[_0x38c7('0x2c')]['length']?_0x48d809[_0x38c7('0x2c')]:_0x16bb74['model'];if(!_0x3657df[_0x38c7('0x29')]['hasOwnProperty'](_0x38c7('0x2e'))){_0x48d809['limit']=qs['limit'](_0x3657df[_0x38c7('0x29')]['limit']);_0x48d809[_0x38c7('0x18')]=qs[_0x38c7('0x18')](_0x3657df[_0x38c7('0x29')][_0x38c7('0x18')]);}_0x48d809['order']=qs[_0x38c7('0x2f')](_0x3657df[_0x38c7('0x29')][_0x38c7('0x2f')]);_0x48d809[_0x38c7('0x30')]=qs['filters'](_[_0x38c7('0x31')](_0x3657df[_0x38c7('0x29')],_0x16bb74[_0x38c7('0x2a')]),_0x38d77e);if(_0x3657df['query'][_0x38c7('0x32')]){_0x48d809[_0x38c7('0x30')]=_[_0x38c7('0x33')](_0x48d809['where'],{'$or':_['map'](_0x38d77e,function(_0x990207){if(_0x990207['type']!=='VIRTUAL'){var _0x4f7325={};_0x4f7325[_0x990207[_0x38c7('0x22')]]={'$like':'%'+_0x3657df[_0x38c7('0x29')][_0x38c7('0x32')]+'%'};return _0x4f7325;}})});}_0x48d809=_[_0x38c7('0x33')]({},_0x48d809,_0x3657df[_0x38c7('0x34')]);var _0x2bb7e1={'where':_0x48d809[_0x38c7('0x30')]};return db[_0x38c7('0x25')][_0x38c7('0x35')](_0x2bb7e1)[_0x38c7('0x1f')](function(_0x4d467a){_0x44578c['count']=_0x4d467a;if(_0x3657df[_0x38c7('0x29')][_0x38c7('0x36')]){_0x48d809['include']=[{'all':!![]}];}return db[_0x38c7('0x25')]['findAll'](_0x48d809);})[_0x38c7('0x1f')](function(_0x24e6c6){_0x44578c[_0x38c7('0x37')]=_0x24e6c6;return _0x44578c;})[_0x38c7('0x1f')](respondWithFilteredResult(_0x10146c,_0x48d809))[_0x38c7('0x38')](handleError(_0x10146c,null));};exports['show']=function(_0x1ed184,_0x222782){var _0x53abfe={'raw':!![],'where':{'id':_0x1ed184['params']['id']}},_0x15291c={};_0x15291c['model']=_[_0x38c7('0x39')](db[_0x38c7('0x25')][_0x38c7('0x3a')]);_0x15291c[_0x38c7('0x29')]=_[_0x38c7('0x39')](_0x1ed184[_0x38c7('0x29')]);_0x15291c[_0x38c7('0x2a')]=_[_0x38c7('0x2b')](_0x15291c['model'],_0x15291c[_0x38c7('0x29')]);_0x53abfe[_0x38c7('0x2c')]=_[_0x38c7('0x2b')](_0x15291c[_0x38c7('0x28')],qs[_0x38c7('0x2d')](_0x1ed184[_0x38c7('0x29')]['fields']));_0x53abfe[_0x38c7('0x2c')]=_0x53abfe['attributes'][_0x38c7('0x3b')]?_0x53abfe[_0x38c7('0x2c')]:_0x15291c[_0x38c7('0x28')];if(_0x1ed184['query'][_0x38c7('0x36')]){_0x53abfe[_0x38c7('0x3c')]=[{'all':!![]}];}_0x53abfe=_[_0x38c7('0x33')]({},_0x53abfe,_0x1ed184[_0x38c7('0x34')]);return db[_0x38c7('0x25')][_0x38c7('0x3d')](_0x53abfe)['then'](handleEntityNotFound(_0x222782,null))[_0x38c7('0x1f')](respondWithResult(_0x222782,null))[_0x38c7('0x38')](handleError(_0x222782,null));};exports[_0x38c7('0x3e')]=function(_0x186a80,_0x1aefcc){return db[_0x38c7('0x25')][_0x38c7('0x3e')](_0x186a80[_0x38c7('0x3f')],{})['then'](respondWithResult(_0x1aefcc,0xc9))['catch'](handleError(_0x1aefcc,null));};exports[_0x38c7('0x1e')]=function(_0x4286e7,_0x2c1e2b){if(_0x4286e7[_0x38c7('0x3f')]['id']){delete _0x4286e7[_0x38c7('0x3f')]['id'];}return db['VoiceTransferReport'][_0x38c7('0x3d')]({'where':{'id':_0x4286e7[_0x38c7('0x40')]['id']}})[_0x38c7('0x1f')](handleEntityNotFound(_0x2c1e2b,null))[_0x38c7('0x1f')](saveUpdates(_0x4286e7[_0x38c7('0x3f')],null))[_0x38c7('0x1f')](respondWithResult(_0x2c1e2b,null))[_0x38c7('0x38')](handleError(_0x2c1e2b,null));};exports[_0x38c7('0x20')]=function(_0x63308a,_0x5cc666){return db[_0x38c7('0x25')][_0x38c7('0x3d')]({'where':{'id':_0x63308a[_0x38c7('0x40')]['id']}})[_0x38c7('0x1f')](handleEntityNotFound(_0x5cc666,null))[_0x38c7('0x1f')](removeEntity(_0x5cc666,null))[_0x38c7('0x38')](handleError(_0x5cc666,null));};exports[_0x38c7('0x41')]=function(_0x3e123b,_0x1b38a1){return db['VoiceTransferReport'][_0x38c7('0x41')]()[_0x38c7('0x1f')](respondWithResult(_0x1b38a1,null))[_0x38c7('0x38')](handleError(_0x1b38a1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c4909e7..58668b2 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 _0xa0d5=['util','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa0d5,0xab));var _0x5a0d=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa0d5[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x5a0d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a0d('0x1'));var fs=require('fs');var path=require(_0x5a0d('0x2'));var rimraf=require(_0x5a0d('0x3'));var config=require(_0x5a0d('0x4'));var attributes=require(_0x5a0d('0x5'));module[_0x5a0d('0x6')]=function(_0x4b2028,_0x23cd70){return _0x4b2028['define'](_0x5a0d('0x7'),attributes,{'tableName':_0x5a0d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2458=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','lodash'];(function(_0x45d7f8,_0x3807d1){var _0x104c4=function(_0x5ba4e0){while(--_0x5ba4e0){_0x45d7f8['push'](_0x45d7f8['shift']());}};_0x104c4(++_0x3807d1);}(_0x2458,0x167));var _0x8245=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2458[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x8245('0x0'));var util=require(_0x8245('0x1'));var logger=require(_0x8245('0x2'))(_0x8245('0x3'));var moment=require(_0x8245('0x4'));var BPromise=require(_0x8245('0x5'));var rp=require(_0x8245('0x6'));var fs=require('fs');var path=require(_0x8245('0x7'));var rimraf=require(_0x8245('0x8'));var config=require(_0x8245('0x9'));var attributes=require(_0x8245('0xa'));module[_0x8245('0xb')]=function(_0xd7f101,_0x2b9d09){return _0xd7f101['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 529e010..b50797b 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 _0x884d=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','then','lodash'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x884d,0x1b2));var _0xd884=function(_0x5f2d9d,_0x354c13){_0x5f2d9d=_0x5f2d9d-0x0;var _0x2f39da=_0x884d[_0x5f2d9d];return _0x2f39da;};'use strict';var _=require(_0xd884('0x0'));var util=require(_0xd884('0x1'));var moment=require(_0xd884('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd884('0x3'));var db=require(_0xd884('0x4'))['db'];var utils=require(_0xd884('0x5'));var logger=require(_0xd884('0x6'))(_0xd884('0x7'));var config=require(_0xd884('0x8'));var jayson=require(_0xd884('0x9'));var client=jayson[_0xd884('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c795,_0x1cfc46,_0x231066){return new BPromise(function(_0x10c8e8,_0x5a3781){return client[_0xd884('0xb')](_0x27c795,_0x231066)['then'](function(_0x4ef145){logger[_0xd884('0xc')](_0xd884('0xd'),_0x1cfc46,'request\x20sent');logger[_0xd884('0xe')](_0xd884('0xf'),_0x1cfc46,_0xd884('0x10'),JSON[_0xd884('0x11')](_0x4ef145));if(_0x4ef145[_0xd884('0x12')]){if(_0x4ef145[_0xd884('0x12')][_0xd884('0x13')]===0x1f4){logger[_0xd884('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x1cfc46,_0x4ef145[_0xd884('0x12')][_0xd884('0x14')]);return _0x5a3781(_0x4ef145[_0xd884('0x12')]['message']);}logger['error'](_0xd884('0xd'),_0x1cfc46,_0x4ef145[_0xd884('0x12')]['message']);return _0x10c8e8(_0x4ef145[_0xd884('0x12')][_0xd884('0x14')]);}else{logger[_0xd884('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x1cfc46,'request\x20sent');_0x10c8e8(_0x4ef145[_0xd884('0x15')][_0xd884('0x14')]);}})[_0xd884('0x16')](function(_0x4f7dcb){logger[_0xd884('0x12')](_0xd884('0xd'),_0x1cfc46,_0x4f7dcb);_0x5a3781(_0x4f7dcb);});});}exports[_0xd884('0x17')]=function(_0x55e29f){var _0x1066a4=this;return new Promise(function(_0x8a05be,_0x476f9c){return db[_0xd884('0x18')][_0xd884('0x19')](_0x55e29f[_0xd884('0x1a')],{'raw':_0x55e29f[_0xd884('0x1b')]?_0x55e29f[_0xd884('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd884('0x1c')](function(_0xeb7353){logger[_0xd884('0xc')]('CreateVoiceTransferReport',_0x55e29f);logger['debug']('CreateVoiceTransferReport',_0x55e29f,JSON[_0xd884('0x11')](_0xeb7353));_0x8a05be(_0xeb7353);})['catch'](function(_0x30f912){logger[_0xd884('0x12')]('CreateVoiceTransferReport',_0x30f912[_0xd884('0x14')],_0x55e29f);_0x476f9c(_0x1066a4[_0xd884('0x12')](0x1f4,_0x30f912[_0xd884('0x14')]));});});}; \ No newline at end of file +var _0x1a6b=['CreateVoiceTransferReport','create','body','options','raw','debug','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x488ec5,_0x3cb226){var _0x116660=function(_0x204212){while(--_0x204212){_0x488ec5['push'](_0x488ec5['shift']());}};_0x116660(++_0x3cb226);}(_0x1a6b,0x114));var _0xb1a6=function(_0x3e90a7,_0x3443fc){_0x3e90a7=_0x3e90a7-0x0;var _0x2d4721=_0x1a6b[_0x3e90a7];return _0x2d4721;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1a6('0x3'));var logger=require(_0xb1a6('0x4'))(_0xb1a6('0x5'));var config=require(_0xb1a6('0x6'));var jayson=require(_0xb1a6('0x7'));var client=jayson[_0xb1a6('0x8')][_0xb1a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287d5e,_0x403541,_0x1ab310){return new BPromise(function(_0xaf767f,_0x2a1952){return client[_0xb1a6('0xa')](_0x287d5e,_0x1ab310)[_0xb1a6('0xb')](function(_0x317df2){logger[_0xb1a6('0xc')](_0xb1a6('0xd'),_0x403541,_0xb1a6('0xe'));logger['debug'](_0xb1a6('0xf'),_0x403541,_0xb1a6('0xe'),JSON[_0xb1a6('0x10')](_0x317df2));if(_0x317df2[_0xb1a6('0x11')]){if(_0x317df2['error'][_0xb1a6('0x12')]===0x1f4){logger[_0xb1a6('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x403541,_0x317df2['error'][_0xb1a6('0x13')]);return _0x2a1952(_0x317df2[_0xb1a6('0x11')]['message']);}logger[_0xb1a6('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x403541,_0x317df2['error'][_0xb1a6('0x13')]);return _0xaf767f(_0x317df2[_0xb1a6('0x11')][_0xb1a6('0x13')]);}else{logger[_0xb1a6('0xc')](_0xb1a6('0xd'),_0x403541,'request\x20sent');_0xaf767f(_0x317df2['result'][_0xb1a6('0x13')]);}})[_0xb1a6('0x14')](function(_0x34a3ab){logger[_0xb1a6('0x11')](_0xb1a6('0xd'),_0x403541,_0x34a3ab);_0x2a1952(_0x34a3ab);});});}exports[_0xb1a6('0x15')]=function(_0x102e52){var _0x18e90d=this;return new Promise(function(_0x189c0d,_0x385c17){return db['VoiceTransferReport'][_0xb1a6('0x16')](_0x102e52[_0xb1a6('0x17')],{'raw':_0x102e52[_0xb1a6('0x18')]?_0x102e52[_0xb1a6('0x18')][_0xb1a6('0x19')]===undefined?!![]:![]:!![]})[_0xb1a6('0xb')](function(_0x11fc19){logger['info'](_0xb1a6('0x15'),_0x102e52);logger[_0xb1a6('0x1a')](_0xb1a6('0x15'),_0x102e52,JSON[_0xb1a6('0x10')](_0x11fc19));_0x189c0d(_0x11fc19);})['catch'](function(_0x42f635){logger[_0xb1a6('0x11')](_0xb1a6('0x15'),_0x42f635[_0xb1a6('0x13')],_0x102e52);_0x385c17(_0x18e90d[_0xb1a6('0x11')](0x1f4,_0x42f635[_0xb1a6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 34e7d44..fce8cc2 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 _0x9649=['post','/answer','answer','/unhold','unhold','calls','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup'];(function(_0x334f6e,_0x1719fd){var _0x1e78e6=function(_0xfb34f7){while(--_0xfb34f7){_0x334f6e['push'](_0x334f6e['shift']());}};_0x1e78e6(++_0x1719fd);}(_0x9649,0x19f));var _0x9964=function(_0x33f40a,_0x3e902c){_0x33f40a=_0x33f40a-0x0;var _0x292241=_0x9649[_0x33f40a];return _0x292241;};'use strict';var express=require(_0x9964('0x0'));var router=express[_0x9964('0x1')]();var auth=require(_0x9964('0x2'));var controller=require(_0x9964('0x3'));router['post'](_0x9964('0x4'),auth[_0x9964('0x5')](),auth['canUpdate'](),controller[_0x9964('0x6')]);router['post'](_0x9964('0x7'),auth[_0x9964('0x5')](),auth[_0x9964('0x8')](),controller[_0x9964('0x9')]);router[_0x9964('0xa')](_0x9964('0xb'),auth[_0x9964('0x5')](),auth['canUpdate'](),controller[_0x9964('0xc')]);router[_0x9964('0xa')]('/hold',auth[_0x9964('0x5')](),auth[_0x9964('0x8')](),controller['hold']);router['post'](_0x9964('0xd'),auth[_0x9964('0x5')](),auth[_0x9964('0x8')](),controller[_0x9964('0xe')]);router[_0x9964('0xa')]('/calls',auth[_0x9964('0x5')](),auth['canUpdate'](),controller[_0x9964('0xf')]);router[_0x9964('0xa')]('/transfer',auth[_0x9964('0x5')](),auth[_0x9964('0x8')](),controller['transfer']);module[_0x9964('0x10')]=router; \ No newline at end of file +var _0x202c=['post','/originate','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','isAuthenticated','hold','/unhold','unhold','calls','/transfer','exports','express','./webbar.controller'];(function(_0x3a441a,_0x43eb56){var _0x3128a2=function(_0x5d5a17){while(--_0x5d5a17){_0x3a441a['push'](_0x3a441a['shift']());}};_0x3128a2(++_0x43eb56);}(_0x202c,0x178));var _0xc202=function(_0x381e4e,_0x4d46c6){_0x381e4e=_0x381e4e-0x0;var _0x52fc95=_0x202c[_0x381e4e];return _0x52fc95;};'use strict';var express=require(_0xc202('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc202('0x1'));router[_0xc202('0x2')](_0xc202('0x3'),auth['isAuthenticated'](),auth[_0xc202('0x4')](),controller[_0xc202('0x5')]);router[_0xc202('0x2')](_0xc202('0x6'),auth['isAuthenticated'](),auth[_0xc202('0x4')](),controller[_0xc202('0x7')]);router['post'](_0xc202('0x8'),auth['isAuthenticated'](),auth[_0xc202('0x4')](),controller[_0xc202('0x9')]);router[_0xc202('0x2')](_0xc202('0xa'),auth[_0xc202('0xb')](),auth[_0xc202('0x4')](),controller[_0xc202('0xc')]);router[_0xc202('0x2')](_0xc202('0xd'),auth[_0xc202('0xb')](),auth[_0xc202('0x4')](),controller[_0xc202('0xe')]);router[_0xc202('0x2')]('/calls',auth[_0xc202('0xb')](),auth[_0xc202('0x4')](),controller[_0xc202('0xf')]);router[_0xc202('0x2')](_0xc202('0x10'),auth[_0xc202('0xb')](),auth[_0xc202('0x4')](),controller['transfer']);module[_0xc202('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b8b0888..1be4d7d 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 _0xf9bc=['findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','answer','answer\x20fired:','format','hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','send','status','NotFound','request','then','code','message','result','catch','User'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x52676c,_0x562806){_0x52676c=_0x52676c-0x0;var _0x5481be=_0xf9bc[_0x52676c];return _0x5481be;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xcf9b('0x0'));var db=require(_0xcf9b('0x1'))['db'];var config=require(_0xcf9b('0x2'));var util=require(_0xcf9b('0x3'));var BPromise=require(_0xcf9b('0x4'));var jayson=require(_0xcf9b('0x5'));var amiClient=jayson[_0xcf9b('0x6')][_0xcf9b('0x7')]({'port':0x232a});var logger=require(_0xcf9b('0x8'))(_0xcf9b('0x9'));var Redis=require('ioredis');config['redis']=_[_0xcf9b('0xa')](config[_0xcf9b('0xb')],{'host':_0xcf9b('0xc'),'port':0x18eb});var io=require(_0xcf9b('0xd'))(new Redis(config[_0xcf9b('0xb')]));var Schema=require(_0xcf9b('0xe'));var originateValidation=new Schema({'userId':{'type':_0xcf9b('0xf'),'required':[!![],_0xcf9b('0x10')]},'callNumber':{'type':_0xcf9b('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xcf9b('0x11')},'callbackUrl':{'type':_0xcf9b('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcf9b('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcf9b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcf9b('0x10')]},'sessionId':{'type':_0xcf9b('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xcf9b('0x11'),'required':[!![],_0xcf9b('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xcf9b('0xf'),'required':[!![],_0xcf9b('0x10')]},'sessionId':{'type':_0xcf9b('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcf9b('0x10')]},'sessionId':{'type':_0xcf9b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xcf9b('0xf'),'required':[!![],_0xcf9b('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x1cb45f,_0x82a0fc,_0x71109d){logger[_0xcf9b('0x13')](_0x1cb45f,_0x82a0fc,JSON[_0xcf9b('0x14')](_0x71109d));io['to'](_0x1cb45f)[_0xcf9b('0x15')](_0x82a0fc,_0x71109d);}function handleError(_0x539d14){return function(_0x1e4017){console[_0xcf9b('0x16')](_0xcf9b('0x17'),_0x1e4017,_0x1e4017 instanceof RangeError);logger[_0xcf9b('0x18')](_0x1e4017['stack']);if(_0x1e4017 instanceof RangeError){if(_0x1e4017[_0xcf9b('0x19')]){delete _0x1e4017[_0xcf9b('0x19')];}_0x539d14['status'](0x194)[_0xcf9b('0x1a')](_0x1e4017);}else{if(_0x1e4017['name']){delete _0x1e4017[_0xcf9b('0x19')];}_0x539d14[_0xcf9b('0x1b')](0x1f4)[_0xcf9b('0x1a')](_0x1e4017);}};}function checkError(){return function(_0x40b1e9){if(!_0x40b1e9){throw new RangeError(_0xcf9b('0x1c'));}return _0x40b1e9;};}function respondWithRpcPromise(_0x40414a,_0x3674dc){return new BPromise(function(_0x44802a,_0x2a20c5){var _0x285c99=amiClient;return _0x285c99[_0xcf9b('0x1d')](_0x40414a,_0x3674dc)[_0xcf9b('0x1e')](function(_0x455b5a){if(_0x455b5a['error']){if(_0x455b5a[_0xcf9b('0x18')][_0xcf9b('0x1f')]===0x1f4){return _0x2a20c5(_0x455b5a[_0xcf9b('0x18')][_0xcf9b('0x20')]);}return _0x44802a(_0x455b5a[_0xcf9b('0x18')]['message']);}else{_0x44802a(_0x455b5a[_0xcf9b('0x21')]);}})[_0xcf9b('0x22')](function(_0x13ff2a){_0x2a20c5(_0x13ff2a);});});}function getAgent(_0x595355){return db[_0xcf9b('0x23')][_0xcf9b('0x24')]({'where':{'id':_0x595355,'role':_0xcf9b('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x240569,_0x3dd36b){return new BPromise(function(_0x40dd75,_0x5c021f){var _0x38cbba=respondWithRpcPromise('VoiceChannels');var _0xab8e7f=getAgent(_0x240569);Promise[_0xcf9b('0x26')]([_0x38cbba,_0xab8e7f])[_0xcf9b('0x1e')](function(_0x341f8c){var _0x30c6dc=_0x341f8c[0x0];var _0x18b408=_0x341f8c[0x1];var _0x5d269e=_[_0xcf9b('0x27')](_0x30c6dc[_0xcf9b('0x28')],function(_0xb2bd13){return _0xb2bd13[_0xcf9b('0x29')]==_0x18b408['id']&&_0xb2bd13[_0xcf9b('0x2a')]==_0x3dd36b;});if(_0x5d269e[_0xcf9b('0x2b')]==0x1){_0x40dd75(_0x18b408);}else{_0x5c021f(new RangeError(_0xcf9b('0x2c')+_0x3dd36b+_0xcf9b('0x2d')));}});});}exports[_0xcf9b('0x2e')]=function(_0x5ac385,_0x34d6a5){logger['info'](_0xcf9b('0x2f'),_0x5ac385[_0xcf9b('0x30')]);var _0x5ab0c0=originateValidation[_0xcf9b('0xe')](_0x5ac385[_0xcf9b('0x30')]);if(_0x5ab0c0[_0xcf9b('0x2b')]>0x0){return _0x34d6a5[_0xcf9b('0x1b')](0x190)[_0xcf9b('0x31')](_0x5ab0c0);}var _0x41ef71=_0x5ac385[_0xcf9b('0x30')]['userId'];var _0x60576d=_0x5ac385[_0xcf9b('0x30')][_0xcf9b('0x32')];var _0x2ef24c=_0x5ac385['body'][_0xcf9b('0x33')];var _0x5f3501=_0x5ac385[_0xcf9b('0x30')][_0xcf9b('0x34')];return getAgent(_0x41ef71)[_0xcf9b('0x1e')](function(_0x594b28){logger[_0xcf9b('0x13')]('entityFound:',_0x594b28[_0xcf9b('0x19')]);emit(util['format'](_0xcf9b('0x35'),_0x594b28[_0xcf9b('0x19')]),_0xcf9b('0x36'),{'callNumber':_0x60576d,'callerId':_0x2ef24c,'callbackUrl':_0x5f3501});return _0x34d6a5[_0xcf9b('0x1b')](0xc8)[_0xcf9b('0x31')]({'error':![],'message':_0xcf9b('0x37')});})[_0xcf9b('0x22')](handleError(_0x34d6a5));};exports[_0xcf9b('0x38')]=function(_0x12f25e,_0x9250b){logger[_0xcf9b('0x13')](_0xcf9b('0x39'),_0x12f25e['body']);var _0x32f319=hangupValidation[_0xcf9b('0xe')](_0x12f25e[_0xcf9b('0x30')]);if(_0x32f319[_0xcf9b('0x2b')]>0x0){return _0x9250b['status'](0x190)[_0xcf9b('0x31')](_0x32f319);}var _0x310b0c=_0x12f25e[_0xcf9b('0x30')][_0xcf9b('0x3a')];var _0x11fdd7=_0x12f25e['body'][_0xcf9b('0x2a')];return getAgent(_0x310b0c)[_0xcf9b('0x1e')](function(_0x1e9f85){logger['info'](_0xcf9b('0x3b'),_0x1e9f85[_0xcf9b('0x19')]);emit(util['format']('user:%s',_0x1e9f85['name']),_0xcf9b('0x3c'),{'sessionId':_0x11fdd7});return _0x9250b[_0xcf9b('0x1b')](0xc8)[_0xcf9b('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0xcf9b('0x22')](handleError(_0x9250b));};exports[_0xcf9b('0x3d')]=function(_0x3b518c,_0x1ed4bf){logger[_0xcf9b('0x13')](_0xcf9b('0x3e'),_0x3b518c[_0xcf9b('0x30')]);var _0x4290f6=answerValidation[_0xcf9b('0xe')](_0x3b518c[_0xcf9b('0x30')]);if(_0x4290f6[_0xcf9b('0x2b')]>0x0){return _0x1ed4bf[_0xcf9b('0x1b')](0x190)[_0xcf9b('0x31')](_0x4290f6);}var _0xc80f2e=_0x3b518c[_0xcf9b('0x30')][_0xcf9b('0x3a')];var _0x29d946=_0x3b518c[_0xcf9b('0x30')][_0xcf9b('0x2a')];return getAgent(_0xc80f2e)[_0xcf9b('0x1e')](function(_0x48b2b1){logger['info'](_0xcf9b('0x3b'),_0x48b2b1[_0xcf9b('0x19')]);emit(util[_0xcf9b('0x3f')](_0xcf9b('0x35'),_0x48b2b1[_0xcf9b('0x19')]),'webbar:answer',{'sessionId':_0x29d946});return _0x1ed4bf[_0xcf9b('0x1b')](0xc8)[_0xcf9b('0x31')]({'error':![],'message':'answer\x20executed!'});})[_0xcf9b('0x22')](handleError(_0x1ed4bf));};exports[_0xcf9b('0x40')]=function(_0x41ecdc,_0xedfa65){logger[_0xcf9b('0x13')]('hold\x20fired:',_0x41ecdc[_0xcf9b('0x30')]);var _0x51eb8d=holdValidation[_0xcf9b('0xe')](_0x41ecdc[_0xcf9b('0x30')]);if(_0x51eb8d['length']>0x0){return _0xedfa65[_0xcf9b('0x1b')](0x190)['json'](_0x51eb8d);}var _0x3442a9=_0x41ecdc[_0xcf9b('0x30')][_0xcf9b('0x3a')];var _0x33bbcd=_0x41ecdc[_0xcf9b('0x30')][_0xcf9b('0x2a')];return getAgent(_0x3442a9)[_0xcf9b('0x1e')](function(_0x658ed4){logger[_0xcf9b('0x13')](_0xcf9b('0x3b'),_0x658ed4[_0xcf9b('0x19')]);emit(util['format']('user:%s',_0x658ed4['name']),'webbar:hold',{'sessionId':_0x33bbcd});return _0xedfa65[_0xcf9b('0x1b')](0xc8)[_0xcf9b('0x31')]({'error':![],'message':_0xcf9b('0x41')});})[_0xcf9b('0x22')](handleError(_0xedfa65));};exports[_0xcf9b('0x42')]=function(_0x554230,_0x5875b8){logger[_0xcf9b('0x13')](_0xcf9b('0x43'),_0x554230[_0xcf9b('0x30')]);var _0x1e5910=unholdValidation[_0xcf9b('0xe')](_0x554230['body']);if(_0x1e5910[_0xcf9b('0x2b')]>0x0){return _0x5875b8[_0xcf9b('0x1b')](0x190)[_0xcf9b('0x31')](_0x1e5910);}var _0x51e31a=_0x554230['body'][_0xcf9b('0x3a')];var _0x265c8c=_0x554230[_0xcf9b('0x30')]['sessionId'];return getAgent(_0x51e31a)['then'](function(_0x53b344){logger['info'](_0xcf9b('0x3b'),_0x53b344['name']);emit(util[_0xcf9b('0x3f')](_0xcf9b('0x35'),_0x53b344[_0xcf9b('0x19')]),_0xcf9b('0x44'),{'sessionId':_0x265c8c});return _0x5875b8[_0xcf9b('0x1b')](0xc8)['json']({'error':![],'message':_0xcf9b('0x45')});})[_0xcf9b('0x22')](handleError(_0x5875b8));};exports[_0xcf9b('0x46')]=function(_0x2b5e31,_0x497d6e){logger[_0xcf9b('0x13')](_0xcf9b('0x47'),_0x497d6e[_0xcf9b('0x30')]);var _0xcf77c4=callsValidation[_0xcf9b('0xe')](_0x2b5e31[_0xcf9b('0x30')]);if(_0xcf77c4[_0xcf9b('0x2b')]>0x0){return _0x497d6e[_0xcf9b('0x1b')](0x190)['json'](_0xcf77c4);}var _0x3c0be0=_0x2b5e31[_0xcf9b('0x30')][_0xcf9b('0x3a')];var _0x1db7ac=respondWithRpcPromise(_0xcf9b('0x48'));var _0x5d2c58=getAgent(_0x3c0be0);return Promise[_0xcf9b('0x26')]([_0x1db7ac,_0x5d2c58])[_0xcf9b('0x1e')](function(_0xab8455){var _0x4eb087=_0xab8455[0x0];var _0x4d772f=_0xab8455[0x1];var _0x383d6b=_[_0xcf9b('0x27')](_0x4eb087[_0xcf9b('0x28')],function(_0x3fb5b1){return _0x3fb5b1['UserId']==_0x4d772f['id'];});return _0x497d6e[_0xcf9b('0x1b')](0xc8)[_0xcf9b('0x31')]({'count':_0x383d6b[_0xcf9b('0x2b')],'rows':_0x383d6b});})[_0xcf9b('0x22')](handleError(_0x497d6e));};exports[_0xcf9b('0x49')]=function(_0xa64306,_0x268a8b){logger[_0xcf9b('0x13')](_0xcf9b('0x4a'),_0xa64306['body']);var _0x56948f=conferenceValidation[_0xcf9b('0xe')](_0xa64306['body']);if(_0x56948f[_0xcf9b('0x2b')]>0x0){return _0x268a8b[_0xcf9b('0x1b')](0x190)[_0xcf9b('0x31')](_0x56948f);}var _0x52e3df=_0xa64306[_0xcf9b('0x30')][_0xcf9b('0x3a')];return getAgent(_0x52e3df)['then'](function(_0x1caf34){logger[_0xcf9b('0x13')](_0xcf9b('0x3b'),_0x1caf34[_0xcf9b('0x19')]);emit(util[_0xcf9b('0x3f')](_0xcf9b('0x35'),_0x1caf34[_0xcf9b('0x19')]),_0xcf9b('0x4b'));return _0x268a8b['status'](0xc8)[_0xcf9b('0x31')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x268a8b));};exports[_0xcf9b('0x4c')]=function(_0x2aad80,_0x12987a){logger['info'](_0xcf9b('0x4d'),_0x2aad80['body']);var _0x460a97=transferValidation[_0xcf9b('0xe')](_0x2aad80[_0xcf9b('0x30')]);if(_0x460a97[_0xcf9b('0x2b')]>0x0){return _0x12987a['status'](0x190)[_0xcf9b('0x31')](_0x460a97);}var _0x303cc7=_0x2aad80['body'][_0xcf9b('0x3a')];var _0xabcbb9=_0x2aad80['body'][_0xcf9b('0x2a')];var _0x2c5838=_0x2aad80['body'][_0xcf9b('0x4e')];return getAgent(_0x303cc7)[_0xcf9b('0x1e')](function(_0x36101c){logger[_0xcf9b('0x13')](_0xcf9b('0x3b'),_0x36101c[_0xcf9b('0x19')]);emit(util[_0xcf9b('0x3f')]('user:%s',_0x36101c[_0xcf9b('0x19')]),_0xcf9b('0x4f'),{'sessionId':_0xabcbb9,'transferNumber':_0x2c5838});return _0x12987a[_0xcf9b('0x1b')](0xc8)['json']({'error':![],'message':_0xcf9b('0x50')});})['catch'](handleError(_0x12987a));}; \ No newline at end of file +var _0xfc65=['http','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','name','send','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','info','body','status','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client'];(function(_0xff1c66,_0x52537f){var _0x5773d6=function(_0x4e3c14){while(--_0x4e3c14){_0xff1c66['push'](_0xff1c66['shift']());}};_0x5773d6(++_0x52537f);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x477553,_0x21befe){_0x477553=_0x477553-0x0;var _0x19b7e7=_0xfc65[_0x477553];return _0x19b7e7;};'use strict';var path=require(_0x5fc6('0x0'));var fs=require('fs');var _=require(_0x5fc6('0x1'));var db=require(_0x5fc6('0x2'))['db'];var config=require(_0x5fc6('0x3'));var util=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var jayson=require(_0x5fc6('0x6'));var amiClient=jayson[_0x5fc6('0x7')][_0x5fc6('0x8')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x5fc6('0x9'));config[_0x5fc6('0xa')]=_[_0x5fc6('0xb')](config[_0x5fc6('0xa')],{'host':_0x5fc6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x5fc6('0xd'));var originateValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],_0x5fc6('0xf')]},'callNumber':{'type':'string','required':[!![],_0x5fc6('0x10')]},'callerId':{'type':_0x5fc6('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],_0x5fc6('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5fc6('0xf')]},'sessionId':{'type':_0x5fc6('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5fc6('0x11'),'required':[!![],_0x5fc6('0x12')]},'transferNumber':{'type':_0x5fc6('0x11'),'required':[!![],_0x5fc6('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],_0x5fc6('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5fc6('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],_0x5fc6('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5fc6('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x390af9,_0x4b0d32,_0x9289ed){logger['info'](_0x390af9,_0x4b0d32,JSON['stringify'](_0x9289ed));io['to'](_0x390af9)[_0x5fc6('0x14')](_0x4b0d32,_0x9289ed);}function handleError(_0x247200){return function(_0x1f6a14){console[_0x5fc6('0x15')](_0x5fc6('0x16'),_0x1f6a14,_0x1f6a14 instanceof RangeError);logger[_0x5fc6('0x17')](_0x1f6a14['stack']);if(_0x1f6a14 instanceof RangeError){if(_0x1f6a14[_0x5fc6('0x18')]){delete _0x1f6a14[_0x5fc6('0x18')];}_0x247200['status'](0x194)['send'](_0x1f6a14);}else{if(_0x1f6a14[_0x5fc6('0x18')]){delete _0x1f6a14[_0x5fc6('0x18')];}_0x247200['status'](0x1f4)[_0x5fc6('0x19')](_0x1f6a14);}};}function checkError(){return function(_0x381f4d){if(!_0x381f4d){throw new RangeError(_0x5fc6('0x1a'));}return _0x381f4d;};}function respondWithRpcPromise(_0x3dd0dc,_0x41f5f0){return new BPromise(function(_0x378fbe,_0x5d382d){var _0x5c89cf=amiClient;return _0x5c89cf['request'](_0x3dd0dc,_0x41f5f0)[_0x5fc6('0x1b')](function(_0x535c43){if(_0x535c43['error']){if(_0x535c43[_0x5fc6('0x17')][_0x5fc6('0x1c')]===0x1f4){return _0x5d382d(_0x535c43[_0x5fc6('0x17')]['message']);}return _0x378fbe(_0x535c43['error'][_0x5fc6('0x1d')]);}else{_0x378fbe(_0x535c43[_0x5fc6('0x1e')]);}})[_0x5fc6('0x1f')](function(_0x102d47){_0x5d382d(_0x102d47);});});}function getAgent(_0x28a11a){return db[_0x5fc6('0x20')][_0x5fc6('0x21')]({'where':{'id':_0x28a11a,'role':_0x5fc6('0x22')}})[_0x5fc6('0x1b')](checkError());}function getAgentCheckSession(_0x5029c6,_0x289211){return new BPromise(function(_0x57d023,_0x294aad){var _0x440e07=respondWithRpcPromise(_0x5fc6('0x23'));var _0xec58dc=getAgent(_0x5029c6);Promise[_0x5fc6('0x24')]([_0x440e07,_0xec58dc])[_0x5fc6('0x1b')](function(_0x6dc1da){var _0x2bef8b=_0x6dc1da[0x0];var _0x29bd80=_0x6dc1da[0x1];var _0x1e6fee=_[_0x5fc6('0x25')](_0x2bef8b['rows'],function(_0x4576ed){return _0x4576ed[_0x5fc6('0x26')]==_0x29bd80['id']&&_0x4576ed[_0x5fc6('0x27')]==_0x289211;});if(_0x1e6fee[_0x5fc6('0x28')]==0x1){_0x57d023(_0x29bd80);}else{_0x294aad(new RangeError('sessionId\x20'+_0x289211+_0x5fc6('0x29')));}});});}exports[_0x5fc6('0x2a')]=function(_0x469e96,_0x4b8ecf){logger[_0x5fc6('0x2b')]('originate\x20fired:',_0x469e96[_0x5fc6('0x2c')]);var _0x2e1212=originateValidation[_0x5fc6('0xd')](_0x469e96[_0x5fc6('0x2c')]);if(_0x2e1212[_0x5fc6('0x28')]>0x0){return _0x4b8ecf[_0x5fc6('0x2d')](0x190)['json'](_0x2e1212);}var _0x32e4ca=_0x469e96['body'][_0x5fc6('0x2e')];var _0x488600=_0x469e96[_0x5fc6('0x2c')][_0x5fc6('0x2f')];var _0x1244ec=_0x469e96['body'][_0x5fc6('0x30')];var _0xdbbea3=_0x469e96[_0x5fc6('0x2c')][_0x5fc6('0x31')];return getAgent(_0x32e4ca)[_0x5fc6('0x1b')](function(_0x1346e5){logger[_0x5fc6('0x2b')](_0x5fc6('0x32'),_0x1346e5[_0x5fc6('0x18')]);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x1346e5['name']),'webbar:originate',{'callNumber':_0x488600,'callerId':_0x1244ec,'callbackUrl':_0xdbbea3});return _0x4b8ecf[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'error':![],'message':_0x5fc6('0x36')});})['catch'](handleError(_0x4b8ecf));};exports[_0x5fc6('0x37')]=function(_0x5bd83e,_0x6b40ad){logger[_0x5fc6('0x2b')](_0x5fc6('0x38'),_0x5bd83e[_0x5fc6('0x2c')]);var _0x433cd4=hangupValidation['validate'](_0x5bd83e[_0x5fc6('0x2c')]);if(_0x433cd4['length']>0x0){return _0x6b40ad[_0x5fc6('0x2d')](0x190)[_0x5fc6('0x35')](_0x433cd4);}var _0x5bef6b=_0x5bd83e[_0x5fc6('0x2c')][_0x5fc6('0x2e')];var _0x4ffc14=_0x5bd83e[_0x5fc6('0x2c')][_0x5fc6('0x27')];return getAgent(_0x5bef6b)[_0x5fc6('0x1b')](function(_0x5ea30f){logger[_0x5fc6('0x2b')](_0x5fc6('0x32'),_0x5ea30f[_0x5fc6('0x18')]);emit(util['format'](_0x5fc6('0x34'),_0x5ea30f['name']),'webbar:hangup',{'sessionId':_0x4ffc14});return _0x6b40ad['status'](0xc8)[_0x5fc6('0x35')]({'error':![],'message':_0x5fc6('0x39')});})[_0x5fc6('0x1f')](handleError(_0x6b40ad));};exports[_0x5fc6('0x3a')]=function(_0x4638b2,_0x942444){logger['info']('answer\x20fired:',_0x4638b2['body']);var _0x589232=answerValidation[_0x5fc6('0xd')](_0x4638b2['body']);if(_0x589232[_0x5fc6('0x28')]>0x0){return _0x942444[_0x5fc6('0x2d')](0x190)[_0x5fc6('0x35')](_0x589232);}var _0x4f38e5=_0x4638b2[_0x5fc6('0x2c')][_0x5fc6('0x2e')];var _0x210b76=_0x4638b2[_0x5fc6('0x2c')][_0x5fc6('0x27')];return getAgent(_0x4f38e5)[_0x5fc6('0x1b')](function(_0x463694){logger[_0x5fc6('0x2b')](_0x5fc6('0x32'),_0x463694['name']);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x463694[_0x5fc6('0x18')]),_0x5fc6('0x3b'),{'sessionId':_0x210b76});return _0x942444[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'error':![],'message':_0x5fc6('0x3c')});})[_0x5fc6('0x1f')](handleError(_0x942444));};exports['hold']=function(_0x50c42e,_0x506bcb){logger[_0x5fc6('0x2b')](_0x5fc6('0x3d'),_0x50c42e[_0x5fc6('0x2c')]);var _0x3802f6=holdValidation['validate'](_0x50c42e['body']);if(_0x3802f6[_0x5fc6('0x28')]>0x0){return _0x506bcb[_0x5fc6('0x2d')](0x190)['json'](_0x3802f6);}var _0x435e41=_0x50c42e[_0x5fc6('0x2c')][_0x5fc6('0x2e')];var _0x434618=_0x50c42e['body'][_0x5fc6('0x27')];return getAgent(_0x435e41)[_0x5fc6('0x1b')](function(_0x1916e3){logger['info']('entityFound:',_0x1916e3['name']);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x1916e3['name']),_0x5fc6('0x3e'),{'sessionId':_0x434618});return _0x506bcb[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'error':![],'message':'hold\x20executed!'});})[_0x5fc6('0x1f')](handleError(_0x506bcb));};exports['unhold']=function(_0x3f0e7d,_0x4b950c){logger[_0x5fc6('0x2b')](_0x5fc6('0x3f'),_0x3f0e7d[_0x5fc6('0x2c')]);var _0x32098e=unholdValidation['validate'](_0x3f0e7d[_0x5fc6('0x2c')]);if(_0x32098e[_0x5fc6('0x28')]>0x0){return _0x4b950c[_0x5fc6('0x2d')](0x190)['json'](_0x32098e);}var _0x20d6ae=_0x3f0e7d[_0x5fc6('0x2c')][_0x5fc6('0x2e')];var _0x48c810=_0x3f0e7d['body']['sessionId'];return getAgent(_0x20d6ae)[_0x5fc6('0x1b')](function(_0x3c92b0){logger[_0x5fc6('0x2b')]('entityFound:',_0x3c92b0[_0x5fc6('0x18')]);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x3c92b0[_0x5fc6('0x18')]),_0x5fc6('0x40'),{'sessionId':_0x48c810});return _0x4b950c[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'error':![],'message':_0x5fc6('0x41')});})[_0x5fc6('0x1f')](handleError(_0x4b950c));};exports[_0x5fc6('0x42')]=function(_0x1f004a,_0x3656c8){logger[_0x5fc6('0x2b')](_0x5fc6('0x43'),_0x3656c8[_0x5fc6('0x2c')]);var _0x1c967b=callsValidation[_0x5fc6('0xd')](_0x1f004a[_0x5fc6('0x2c')]);if(_0x1c967b[_0x5fc6('0x28')]>0x0){return _0x3656c8['status'](0x190)['json'](_0x1c967b);}var _0x4a32cf=_0x1f004a[_0x5fc6('0x2c')][_0x5fc6('0x2e')];var _0xf795da=respondWithRpcPromise(_0x5fc6('0x23'));var _0x16af86=getAgent(_0x4a32cf);return Promise[_0x5fc6('0x24')]([_0xf795da,_0x16af86])['then'](function(_0x120954){var _0x3f7165=_0x120954[0x0];var _0x3e21e4=_0x120954[0x1];var _0x3889b0=_[_0x5fc6('0x25')](_0x3f7165['rows'],function(_0x2ba191){return _0x2ba191['UserId']==_0x3e21e4['id'];});return _0x3656c8[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'count':_0x3889b0[_0x5fc6('0x28')],'rows':_0x3889b0});})[_0x5fc6('0x1f')](handleError(_0x3656c8));};exports[_0x5fc6('0x44')]=function(_0x20fc95,_0x3c159c){logger[_0x5fc6('0x2b')]('conference\x20fired:',_0x20fc95[_0x5fc6('0x2c')]);var _0x8c865f=conferenceValidation[_0x5fc6('0xd')](_0x20fc95[_0x5fc6('0x2c')]);if(_0x8c865f[_0x5fc6('0x28')]>0x0){return _0x3c159c['status'](0x190)['json'](_0x8c865f);}var _0x2e4281=_0x20fc95['body'][_0x5fc6('0x2e')];return getAgent(_0x2e4281)[_0x5fc6('0x1b')](function(_0x1870ac){logger[_0x5fc6('0x2b')](_0x5fc6('0x32'),_0x1870ac[_0x5fc6('0x18')]);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x1870ac[_0x5fc6('0x18')]),_0x5fc6('0x45'));return _0x3c159c[_0x5fc6('0x2d')](0xc8)[_0x5fc6('0x35')]({'error':![],'message':_0x5fc6('0x46')});})[_0x5fc6('0x1f')](handleError(_0x3c159c));};exports[_0x5fc6('0x47')]=function(_0x4fd6c5,_0x481a49){logger[_0x5fc6('0x2b')](_0x5fc6('0x48'),_0x4fd6c5['body']);var _0x183a2f=transferValidation['validate'](_0x4fd6c5[_0x5fc6('0x2c')]);if(_0x183a2f[_0x5fc6('0x28')]>0x0){return _0x481a49[_0x5fc6('0x2d')](0x190)['json'](_0x183a2f);}var _0x1a6226=_0x4fd6c5['body'][_0x5fc6('0x2e')];var _0xce9de2=_0x4fd6c5['body'][_0x5fc6('0x27')];var _0x5b0cd3=_0x4fd6c5[_0x5fc6('0x2c')][_0x5fc6('0x49')];return getAgent(_0x1a6226)[_0x5fc6('0x1b')](function(_0x2b90d6){logger[_0x5fc6('0x2b')](_0x5fc6('0x32'),_0x2b90d6[_0x5fc6('0x18')]);emit(util[_0x5fc6('0x33')](_0x5fc6('0x34'),_0x2b90d6[_0x5fc6('0x18')]),'webbar:transfer',{'sessionId':_0xce9de2,'transferNumber':_0x5b0cd3});return _0x481a49[_0x5fc6('0x2d')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x481a49));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7e83922..ebc228e 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 _0x5f2f=['put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getAnswers','getAgents','/:id/applications','getApplications','create','post','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b3ef1,_0x1dad38){_0x4b3ef1=_0x4b3ef1-0x0;var _0x34d3b4=_0x5f2f[_0x4b3ef1];return _0x34d3b4;};'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('./whatsappAccount.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getDispositions']);router[_0xf5f2('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router['post']('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['addDisposition']);router[_0xf5f2('0x13')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x13')](_0xf5f2('0x16'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x13')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x18')]);router[_0xf5f2('0x13')](_0xf5f2('0x19'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x13')](_0xf5f2('0x1b'),auth['isAuthenticated'](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x1e')]);router[_0xf5f2('0x1f')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x20')]);router[_0xf5f2('0x1f')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['removeDispositions']);router[_0xf5f2('0x1f')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0xf5f2('0x22')]);module[_0xf5f2('0x23')]=router; \ No newline at end of file +var _0xd4f4=['removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','create','post','addDisposition','/:id/applications','/:id/send','send','delete','destroy','removeDispositions'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x439953,_0x105d8a){_0x439953=_0x439953-0x0;var _0x768231=_0xd4f4[_0x439953];return _0x768231;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require(_0x4d4f('0x9'));router[_0x4d4f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d4f('0xb'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xd')]);router[_0x4d4f('0xa')](_0x4d4f('0xe'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xf')]);router[_0x4d4f('0xa')](_0x4d4f('0x10'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x11')]);router[_0x4d4f('0xa')](_0x4d4f('0x12'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x13')]);router[_0x4d4f('0xa')](_0x4d4f('0x14'),auth[_0x4d4f('0xc')](),controller['getAgents']);router['get']('/:id/applications',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x15')]);router['post']('/',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x16')]);router[_0x4d4f('0x17')]('/:id/dispositions',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x18')]);router[_0x4d4f('0x17')]('/:id/canned_answers',auth[_0x4d4f('0xc')](),controller['addAnswer']);router[_0x4d4f('0x17')](_0x4d4f('0x14'),auth[_0x4d4f('0xc')](),controller['addAgents']);router[_0x4d4f('0x17')](_0x4d4f('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/notify',controller['notify']);router[_0x4d4f('0x17')](_0x4d4f('0x1a'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x1b')]);router['put']('/:id',auth[_0x4d4f('0xc')](),controller['update']);router[_0x4d4f('0x1c')](_0x4d4f('0xe'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x1d')]);router[_0x4d4f('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4d4f('0x1e')]);router['delete'](_0x4d4f('0x12'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x1f')]);router[_0x4d4f('0x1c')](_0x4d4f('0x14'),auth['isAuthenticated'](),controller[_0x4d4f('0x20')]);module[_0x4d4f('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 23ee37c..8392c86 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 _0xb9ab=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x284538,_0x3787f7){var _0x3d55bf=function(_0x52f004){while(--_0x52f004){_0x284538['push'](_0x284538['shift']());}};_0x3d55bf(++_0x3787f7);}(_0xb9ab,0x92));var _0xbb9a=function(_0x2ea952,_0x1a626e){_0x2ea952=_0x2ea952-0x0;var _0x51c766=_0xb9ab[_0x2ea952];return _0x51c766;};'use strict';var Sequelize=require(_0xbb9a('0x0'));var rs=require(_0xbb9a('0x1'));module[_0xbb9a('0x2')]={'name':{'type':Sequelize[_0xbb9a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbb9a('0x3')],'defaultValue':function(){return rs[_0xbb9a('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbb9a('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0xbb9a('0x3')]},'authToken':{'type':Sequelize[_0xbb9a('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbb9a('0x6')],'defaultValue':function(){return _0xbb9a('0x7');}},'notificationSound':{'type':Sequelize[_0xbb9a('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbb9a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb9a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb9a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb9a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb9a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb9a('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbb9a('0x8')],'defaultValue':![],'comment':_0xbb9a('0xa'),'set':function(_0x5a7890){if(!_0x5a7890){this[_0xbb9a('0xb')]('mandatoryDispositionPauseId',null);}this[_0xbb9a('0xb')](_0xbb9a('0xc'),_0x5a7890);}},'description':{'type':Sequelize[_0xbb9a('0x3')]}}; \ No newline at end of file +var _0x40c3=['generate','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING'];(function(_0x187660,_0x52b9c5){var _0x5c4dbd=function(_0x57a41f){while(--_0x57a41f){_0x187660['push'](_0x187660['shift']());}};_0x5c4dbd(++_0x52b9c5);}(_0x40c3,0xe0));var _0x340c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x40c3[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x340c('0x0'));var rs=require(_0x340c('0x1'));module[_0x340c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x340c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x340c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x340c('0x3')],'defaultValue':function(){return rs[_0x340c('0x4')]();}},'phone':{'type':Sequelize[_0x340c('0x3')]},'type':{'type':Sequelize['ENUM'](_0x340c('0x5'))},'accountSid':{'type':Sequelize[_0x340c('0x3')]},'authToken':{'type':Sequelize[_0x340c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x340c('0x6');}},'notificationSound':{'type':Sequelize[_0x340c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x340c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x340c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x340c('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x340c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x340c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x340c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x340c('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x18fd03){if(!_0x18fd03){this[_0x340c('0xa')](_0x340c('0xb'),null);}this['setDataValue']('mandatoryDisposition',_0x18fd03);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2e832e3..15342f8 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 _0xcab5=['pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','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','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xcab5,0x6b));var _0x5cab=function(_0xa75c92,_0x5cfa4f){_0xa75c92=_0xa75c92-0x0;var _0x63ea18=_0xcab5[_0xa75c92];return _0x63ea18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cab('0x0'));var rimraf=require(_0x5cab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cab('0x2'));var rp=require(_0x5cab('0x3'));var moment=require(_0x5cab('0x4'));var BPromise=require(_0x5cab('0x5'));var Mustache=require(_0x5cab('0x6'));var util=require(_0x5cab('0x7'));var path=require(_0x5cab('0x8'));var sox=require(_0x5cab('0x9'));var csv=require(_0x5cab('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5cab('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5cab('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5cab('0xd'));var authService=require(_0x5cab('0xe'));var qs=require(_0x5cab('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cab('0x10'));var logger=require(_0x5cab('0x11'))(_0x5cab('0x12'));var utils=require(_0x5cab('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5cab('0x14'));var db=require('../../mysqldb')['db'];config[_0x5cab('0x15')]=_[_0x5cab('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5cab('0x17'))(new Redis(config[_0x5cab('0x15')]));require(_0x5cab('0x18'))[_0x5cab('0x19')](socket);var jayson=require(_0x5cab('0x1a'));var client=jayson[_0x5cab('0x1b')][_0x5cab('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x67afc2,_0x226af5,_0x178bb9,_0x58fd79){return new BPromise(function(_0x54fc33,_0x274d59){var _0xf940a7=_0x58fd79||client;return _0xf940a7['request'](_0x67afc2,_0x178bb9)['then'](function(_0x5f50a0){logger[_0x5cab('0x1d')](_0x5cab('0x1e'),_0x226af5,_0x5cab('0x1f'));logger['debug'](_0x5cab('0x20'),_0x226af5,_0x5cab('0x1f'),JSON['stringify'](_0x5f50a0));if(_0x5f50a0[_0x5cab('0x21')]){if(_0x5f50a0[_0x5cab('0x21')][_0x5cab('0x22')]===0x1f4){logger[_0x5cab('0x21')](_0x5cab('0x1e'),_0x226af5,_0x5f50a0['error'][_0x5cab('0x23')]);return _0x274d59(_0x5f50a0[_0x5cab('0x21')][_0x5cab('0x23')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x226af5,_0x5f50a0[_0x5cab('0x21')]['message']);return _0x54fc33(_0x5f50a0[_0x5cab('0x21')]['message']);}else{logger['info'](_0x5cab('0x1e'),_0x226af5,_0x5cab('0x1f'));_0x54fc33(_0x5f50a0[_0x5cab('0x24')][_0x5cab('0x23')]);}})[_0x5cab('0x25')](function(_0xcb85c4){logger[_0x5cab('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x226af5,_0xcb85c4);_0x274d59(_0xcb85c4);});});}function respondWithStatusCode(_0x3ebdad,_0x362d62){_0x362d62=_0x362d62||0xcc;return function(_0x23fde0){if(_0x23fde0){return _0x3ebdad[_0x5cab('0x26')](_0x362d62);}return _0x3ebdad['status'](_0x362d62)[_0x5cab('0x27')]();};}function respondWithResult(_0x3c7bd0,_0x9a8421){_0x9a8421=_0x9a8421||0xc8;return function(_0x1f305f){if(_0x1f305f){return _0x3c7bd0['status'](_0x9a8421)[_0x5cab('0x28')](_0x1f305f);}};}function respondWithFilteredResult(_0x28707d,_0x10d000){return function(_0x167425){if(_0x167425){var _0x5d7e59=_0x167425[_0x5cab('0x29')],_0x1cd53c=_0x10d000['offset'],_0x17af0b=_0x10d000['offset']+_0x10d000[_0x5cab('0x2a')],_0x4dca06;if(_0x17af0b>=_0x5d7e59){_0x17af0b=_0x5d7e59;_0x4dca06=0xc8;}else{_0x4dca06=0xce;}_0x28707d[_0x5cab('0x2b')](_0x4dca06);return _0x28707d[_0x5cab('0x2c')](_0x5cab('0x2d'),_0x1cd53c+'-'+_0x17af0b+'/'+_0x5d7e59)[_0x5cab('0x28')](_0x167425);}return null;};}function patchUpdates(_0x1ae051){return function(_0x3bea06){try{jsonpatch[_0x5cab('0x2e')](_0x3bea06,_0x1ae051,!![]);}catch(_0xb3809f){return BPromise[_0x5cab('0x2f')](_0xb3809f);}return _0x3bea06[_0x5cab('0x30')]();};}function saveUpdates(_0x8e34c9,_0x426dac){return function(_0x469fea){if(_0x469fea){return _0x469fea[_0x5cab('0x31')](_0x8e34c9)[_0x5cab('0x32')](function(_0x2782c8){return _0x2782c8;});}return null;};}function removeEntity(_0x1ed6c4,_0x19767b){return function(_0x5c9370){if(_0x5c9370){return _0x5c9370[_0x5cab('0x33')]()['then'](function(){var _0x465883=_0x5c9370['get']({'plain':!![]});var _0x28d5b2=_0x5cab('0x34');return db[_0x5cab('0x35')]['destroy']({'where':{'type':_0x28d5b2,'resourceId':_0x465883['id']}})['then'](function(){return _0x5c9370;});})['then'](function(){_0x1ed6c4[_0x5cab('0x2b')](0xcc)[_0x5cab('0x27')]();});}};}function handleEntityNotFound(_0x148e4d,_0xe92dce){return function(_0x5a8559){if(!_0x5a8559){_0x148e4d[_0x5cab('0x26')](0x194);}return _0x5a8559;};}function handleError(_0x308323,_0x51744c){_0x51744c=_0x51744c||0x1f4;return function(_0x41139f){logger[_0x5cab('0x21')](_0x41139f['stack']);if(_0x41139f[_0x5cab('0x36')]){delete _0x41139f['name'];}_0x308323[_0x5cab('0x2b')](_0x51744c)[_0x5cab('0x37')](_0x41139f);};}exports[_0x5cab('0x38')]=function(_0x509ce4,_0x2d1434){var _0x4d81af={'include':[{'model':db[_0x5cab('0x39')],'as':_0x5cab('0x3a')}]},_0x4419d8={},_0x5d1e28={'count':0x0,'rows':[]};var _0x278f65=_['map'](db[_0x5cab('0x3b')][_0x5cab('0x3c')],function(_0x40c89e){return{'name':_0x40c89e[_0x5cab('0x3d')],'type':_0x40c89e[_0x5cab('0x3e')]['key']};});_0x4419d8[_0x5cab('0x3f')]=_[_0x5cab('0x40')](_0x278f65,'name');_0x4419d8[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x509ce4['query']);_0x4419d8[_0x5cab('0x43')]=_[_0x5cab('0x44')](_0x4419d8['model'],_0x4419d8[_0x5cab('0x41')]);_0x4d81af[_0x5cab('0x45')]=_[_0x5cab('0x44')](_0x4419d8[_0x5cab('0x3f')],qs[_0x5cab('0x46')](_0x509ce4[_0x5cab('0x41')]['fields']));_0x4d81af[_0x5cab('0x45')]=_0x4d81af['attributes'][_0x5cab('0x47')]?_0x4d81af[_0x5cab('0x45')]:_0x4419d8[_0x5cab('0x3f')];if(!_0x509ce4[_0x5cab('0x41')][_0x5cab('0x48')]('nolimit')){_0x4d81af[_0x5cab('0x2a')]=qs[_0x5cab('0x2a')](_0x509ce4[_0x5cab('0x41')][_0x5cab('0x2a')]);_0x4d81af[_0x5cab('0x49')]=qs[_0x5cab('0x49')](_0x509ce4[_0x5cab('0x41')][_0x5cab('0x49')]);}_0x4d81af[_0x5cab('0x4a')]=qs[_0x5cab('0x4b')](_0x509ce4[_0x5cab('0x41')][_0x5cab('0x4b')]);_0x4d81af[_0x5cab('0x4c')]=qs[_0x5cab('0x43')](_[_0x5cab('0x4d')](_0x509ce4[_0x5cab('0x41')],_0x4419d8['filters']),_0x278f65);if(_0x509ce4[_0x5cab('0x41')][_0x5cab('0x4e')]){_0x4d81af['where']=_[_0x5cab('0x4f')](_0x4d81af['where'],{'$or':_['map'](_0x278f65,function(_0x5770bf){if(_0x5770bf[_0x5cab('0x3e')]!==_0x5cab('0x50')){var _0x199128={};_0x199128[_0x5770bf[_0x5cab('0x36')]]={'$like':'%'+_0x509ce4[_0x5cab('0x41')]['filter']+'%'};return _0x199128;}})});}_0x4d81af=_[_0x5cab('0x4f')]({},_0x4d81af,_0x509ce4[_0x5cab('0x51')]);var _0x5f16ff={'where':_0x4d81af[_0x5cab('0x4c')]};return db[_0x5cab('0x3b')]['count'](_0x5f16ff)[_0x5cab('0x32')](function(_0x35b4bf){_0x5d1e28[_0x5cab('0x29')]=_0x35b4bf;if(_0x509ce4[_0x5cab('0x41')]['includeAll']){_0x4d81af[_0x5cab('0x52')]=[{'all':!![]}];}return db[_0x5cab('0x3b')][_0x5cab('0x53')](_0x4d81af);})[_0x5cab('0x32')](function(_0xb714c6){_0x5d1e28['rows']=_0xb714c6;return _0x5d1e28;})[_0x5cab('0x32')](respondWithFilteredResult(_0x2d1434,_0x4d81af))[_0x5cab('0x25')](handleError(_0x2d1434,null));};exports[_0x5cab('0x54')]=function(_0x5699e6,_0x499303){var _0xd956ef={'raw':![],'where':{'id':_0x5699e6[_0x5cab('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x438d1d={};_0x438d1d[_0x5cab('0x3f')]=_[_0x5cab('0x42')](db['WhatsappAccount'][_0x5cab('0x3c')]);_0x438d1d[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x5699e6[_0x5cab('0x41')]);_0x438d1d[_0x5cab('0x43')]=_[_0x5cab('0x44')](_0x438d1d[_0x5cab('0x3f')],_0x438d1d[_0x5cab('0x41')]);_0xd956ef[_0x5cab('0x45')]=_[_0x5cab('0x44')](_0x438d1d[_0x5cab('0x3f')],qs[_0x5cab('0x46')](_0x5699e6['query'][_0x5cab('0x46')]));_0xd956ef[_0x5cab('0x45')]=_0xd956ef[_0x5cab('0x45')][_0x5cab('0x47')]?_0xd956ef[_0x5cab('0x45')]:_0x438d1d[_0x5cab('0x3f')];if(_0x5699e6['query'][_0x5cab('0x56')]){_0xd956ef[_0x5cab('0x52')]=[{'all':!![]}];}_0xd956ef=_['merge']({},_0xd956ef,_0x5699e6[_0x5cab('0x51')]);return db[_0x5cab('0x3b')][_0x5cab('0x57')](_0xd956ef)[_0x5cab('0x32')](handleEntityNotFound(_0x499303,null))['then'](respondWithResult(_0x499303,null))[_0x5cab('0x25')](handleError(_0x499303,null));};exports['create']=function(_0x2450dc,_0x498ba9){return db[_0x5cab('0x3b')]['create'](_0x2450dc[_0x5cab('0x58')],{})[_0x5cab('0x32')](function(_0x1f0898){var _0x38e0e6=_0x2450dc[_0x5cab('0x59')]['get']({'plain':!![]});if(!_0x38e0e6)throw new Error(_0x5cab('0x5a'));if(_0x38e0e6['role']===_0x5cab('0x59')){var _0x46e7d1=_0x1f0898[_0x5cab('0x5b')]({'plain':!![]});var _0x5eb99e=_0x5cab('0x34');return db[_0x5cab('0x5c')][_0x5cab('0x57')]({'where':{'name':_0x5eb99e,'userProfileId':_0x38e0e6[_0x5cab('0x5d')]},'raw':!![]})[_0x5cab('0x32')](function(_0x501985){if(_0x501985&&_0x501985[_0x5cab('0x5e')]===0x0){return db[_0x5cab('0x35')][_0x5cab('0x5f')]({'name':_0x46e7d1[_0x5cab('0x36')],'resourceId':_0x46e7d1['id'],'type':_0x501985['name'],'sectionId':_0x501985['id']},{})['then'](function(){return _0x1f0898;});}else{return _0x1f0898;}})[_0x5cab('0x25')](function(_0x289d60){logger['error'](_0x5cab('0x60'),_0x289d60);throw _0x289d60;});}return _0x1f0898;})[_0x5cab('0x32')](respondWithResult(_0x498ba9,0xc9))[_0x5cab('0x25')](handleError(_0x498ba9,null));};exports[_0x5cab('0x31')]=function(_0x41ec17,_0x492fdf){if(_0x41ec17['body']['id']){delete _0x41ec17[_0x5cab('0x58')]['id'];}return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x41ec17[_0x5cab('0x55')]['id']},'include':[{'model':db[_0x5cab('0x39')],'as':_0x5cab('0x3a')}]})[_0x5cab('0x32')](handleEntityNotFound(_0x492fdf,null))[_0x5cab('0x32')](saveUpdates(_0x41ec17[_0x5cab('0x58')],null))['then'](respondWithResult(_0x492fdf,null))[_0x5cab('0x25')](handleError(_0x492fdf,null));};exports[_0x5cab('0x33')]=function(_0x407266,_0x154328){return db['WhatsappAccount'][_0x5cab('0x57')]({'where':{'id':_0x407266['params']['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x154328,null))[_0x5cab('0x32')](removeEntity(_0x154328,null))[_0x5cab('0x25')](handleError(_0x154328,null));};exports[_0x5cab('0x61')]=function(_0x3e4385,_0x29953c){return db['WhatsappAccount'][_0x5cab('0x61')]()[_0x5cab('0x32')](respondWithResult(_0x29953c,null))[_0x5cab('0x25')](handleError(_0x29953c,null));};exports[_0x5cab('0x62')]=function(_0x5463b9,_0x49a6fd,_0x18b5c2){if(_0x5463b9[_0x5cab('0x58')]['id']){delete _0x5463b9[_0x5cab('0x58')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5463b9[_0x5cab('0x55')]['id']}})['then'](handleEntityNotFound(_0x49a6fd,null))[_0x5cab('0x32')](function(_0x1c34c5){if(_0x1c34c5){_0x5463b9[_0x5cab('0x58')][_0x5cab('0x63')]=_0x1c34c5['id'];return db[_0x5cab('0x64')][_0x5cab('0x5f')](_0x5463b9['body']);}})[_0x5cab('0x32')](respondWithResult(_0x49a6fd,null))[_0x5cab('0x25')](handleError(_0x49a6fd,null));};exports['getDispositions']=function(_0x309de0,_0x10d5c5,_0x27600f){var _0x2515c2={'raw':![],'where':{}};var _0x64e2e2={};var _0x572559={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5cab('0x65')]({'where':{'id':_0x309de0['params']['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x10d5c5,null))[_0x5cab('0x32')](function(_0x9de97a){if(_0x9de97a){_0x64e2e2[_0x5cab('0x3f')]=_[_0x5cab('0x42')](db[_0x5cab('0x64')][_0x5cab('0x3c')]);_0x64e2e2[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x309de0[_0x5cab('0x41')]);_0x64e2e2['filters']=_[_0x5cab('0x44')](_0x64e2e2[_0x5cab('0x3f')],_0x64e2e2[_0x5cab('0x41')]);_0x2515c2[_0x5cab('0x45')]=_[_0x5cab('0x44')](_0x64e2e2[_0x5cab('0x3f')],qs[_0x5cab('0x46')](_0x309de0[_0x5cab('0x41')][_0x5cab('0x46')]));_0x2515c2['attributes']=_0x2515c2[_0x5cab('0x45')][_0x5cab('0x47')]?_0x2515c2[_0x5cab('0x45')]:_0x64e2e2[_0x5cab('0x3f')];if(!_0x309de0[_0x5cab('0x41')]['hasOwnProperty'](_0x5cab('0x66'))){_0x2515c2[_0x5cab('0x2a')]=qs[_0x5cab('0x2a')](_0x309de0[_0x5cab('0x41')][_0x5cab('0x2a')]);_0x2515c2[_0x5cab('0x49')]=qs[_0x5cab('0x49')](_0x309de0[_0x5cab('0x41')][_0x5cab('0x49')]);}_0x2515c2[_0x5cab('0x4a')]=qs['sort'](_0x309de0[_0x5cab('0x41')][_0x5cab('0x4b')]);_0x2515c2[_0x5cab('0x4c')]=qs['filters'](_[_0x5cab('0x4d')](_0x309de0[_0x5cab('0x41')],_0x64e2e2[_0x5cab('0x43')]));_0x2515c2[_0x5cab('0x4c')][_0x5cab('0x63')]=_0x9de97a['id'];if(_0x309de0['query']['filter']){_0x2515c2[_0x5cab('0x4c')]=_['merge'](_0x2515c2[_0x5cab('0x4c')],{'$or':_['map'](_0x2515c2['attributes'],function(_0x2c1ffc){var _0x2b4dd1={};_0x2b4dd1[_0x2c1ffc]={'$like':'%'+_0x309de0['query'][_0x5cab('0x4e')]+'%'};return _0x2b4dd1;})});}_0x2515c2=_[_0x5cab('0x4f')]({},_0x2515c2,_0x309de0[_0x5cab('0x51')]);return db[_0x5cab('0x64')]['count']({'where':_0x2515c2[_0x5cab('0x4c')]})['then'](function(_0x503ff0){_0x572559[_0x5cab('0x29')]=_0x503ff0;if(_0x309de0['query'][_0x5cab('0x56')]){_0x2515c2[_0x5cab('0x52')]=[{'all':!![]}];}return db[_0x5cab('0x64')][_0x5cab('0x53')](_0x2515c2);})[_0x5cab('0x32')](function(_0x45ebb9){_0x572559['rows']=_0x45ebb9;return _0x572559;});}})['then'](respondWithFilteredResult(_0x10d5c5,_0x2515c2))[_0x5cab('0x25')](handleError(_0x10d5c5,null));};exports[_0x5cab('0x67')]=function(_0x37edb0,_0x6d6913,_0x2d4307){return db[_0x5cab('0x3b')]['find']({'where':{'id':_0x37edb0[_0x5cab('0x55')]['id']}})['then'](handleEntityNotFound(_0x6d6913,null))['then'](function(_0x1daddc){if(_0x1daddc){return _0x1daddc[_0x5cab('0x67')](_0x37edb0[_0x5cab('0x41')][_0x5cab('0x68')]);}})[_0x5cab('0x32')](respondWithStatusCode(_0x6d6913,null))[_0x5cab('0x25')](handleError(_0x6d6913,null));};exports[_0x5cab('0x69')]=function(_0x50191b,_0x169ceb,_0x2551ac){if(_0x50191b['body']['id']){delete _0x50191b['body']['id'];}return db[_0x5cab('0x3b')]['find']({'where':{'id':_0x50191b[_0x5cab('0x55')]['id']}})['then'](handleEntityNotFound(_0x169ceb,null))[_0x5cab('0x32')](function(_0x1a68f4){if(_0x1a68f4){_0x50191b[_0x5cab('0x58')]['WhatsappAccountId']=_0x1a68f4['id'];return db[_0x5cab('0x6a')][_0x5cab('0x5f')](_0x50191b[_0x5cab('0x58')]);}})[_0x5cab('0x32')](respondWithResult(_0x169ceb,null))[_0x5cab('0x25')](handleError(_0x169ceb,null));};exports[_0x5cab('0x6b')]=function(_0x341fbf,_0x2fa63f,_0x40d9d0){var _0x2dfbfb={'raw':![],'where':{}};var _0x27c9a2={};var _0x5aa5e5={'count':0x0,'rows':[]};return db[_0x5cab('0x3b')]['findOne']({'where':{'id':_0x341fbf['params']['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x2fa63f,null))[_0x5cab('0x32')](function(_0x523145){if(_0x523145){_0x27c9a2['model']=_['keys'](db[_0x5cab('0x6a')]['rawAttributes']);_0x27c9a2[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x341fbf[_0x5cab('0x41')]);_0x27c9a2[_0x5cab('0x43')]=_[_0x5cab('0x44')](_0x27c9a2[_0x5cab('0x3f')],_0x27c9a2[_0x5cab('0x41')]);_0x2dfbfb['attributes']=_[_0x5cab('0x44')](_0x27c9a2['model'],qs[_0x5cab('0x46')](_0x341fbf[_0x5cab('0x41')][_0x5cab('0x46')]));_0x2dfbfb[_0x5cab('0x45')]=_0x2dfbfb[_0x5cab('0x45')]['length']?_0x2dfbfb[_0x5cab('0x45')]:_0x27c9a2[_0x5cab('0x3f')];if(!_0x341fbf[_0x5cab('0x41')][_0x5cab('0x48')](_0x5cab('0x66'))){_0x2dfbfb['limit']=qs[_0x5cab('0x2a')](_0x341fbf[_0x5cab('0x41')]['limit']);_0x2dfbfb[_0x5cab('0x49')]=qs['offset'](_0x341fbf[_0x5cab('0x41')][_0x5cab('0x49')]);}_0x2dfbfb['order']=qs[_0x5cab('0x4b')](_0x341fbf['query'][_0x5cab('0x4b')]);_0x2dfbfb[_0x5cab('0x4c')]=qs[_0x5cab('0x43')](_[_0x5cab('0x4d')](_0x341fbf[_0x5cab('0x41')],_0x27c9a2['filters']));_0x2dfbfb[_0x5cab('0x4c')]['WhatsappAccountId']=_0x523145['id'];if(_0x341fbf[_0x5cab('0x41')][_0x5cab('0x4e')]){_0x2dfbfb[_0x5cab('0x4c')]=_['merge'](_0x2dfbfb[_0x5cab('0x4c')],{'$or':_[_0x5cab('0x40')](_0x2dfbfb[_0x5cab('0x45')],function(_0x4969a6){var _0x59062e={};_0x59062e[_0x4969a6]={'$like':'%'+_0x341fbf[_0x5cab('0x41')]['filter']+'%'};return _0x59062e;})});}_0x2dfbfb=_[_0x5cab('0x4f')]({},_0x2dfbfb,_0x341fbf['options']);return db[_0x5cab('0x6a')][_0x5cab('0x29')]({'where':_0x2dfbfb[_0x5cab('0x4c')]})['then'](function(_0x4e6b64){_0x5aa5e5[_0x5cab('0x29')]=_0x4e6b64;if(_0x341fbf[_0x5cab('0x41')][_0x5cab('0x56')]){_0x2dfbfb['include']=[{'all':!![]}];}return db[_0x5cab('0x6a')][_0x5cab('0x53')](_0x2dfbfb);})['then'](function(_0x587a2d){_0x5aa5e5[_0x5cab('0x6c')]=_0x587a2d;return _0x5aa5e5;});}})[_0x5cab('0x32')](respondWithFilteredResult(_0x2fa63f,_0x2dfbfb))['catch'](handleError(_0x2fa63f,null));};exports[_0x5cab('0x6d')]=function(_0x15302c,_0x2d6c2e,_0x446f9a){return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x15302c[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x2d6c2e,null))[_0x5cab('0x32')](function(_0x460dc6){if(_0x460dc6){return _0x460dc6[_0x5cab('0x6d')](_0x15302c['query'][_0x5cab('0x68')]);}})[_0x5cab('0x32')](respondWithStatusCode(_0x2d6c2e,null))['catch'](handleError(_0x2d6c2e,null));};exports[_0x5cab('0x6e')]=function(_0x23b02e,_0x1ffcd9,_0x8987b5){return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x23b02e[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x1ffcd9,null))[_0x5cab('0x32')](function(_0x5256f0){if(_0x5256f0){return _0x5256f0['addAgents'](_0x23b02e['body'][_0x5cab('0x68')],_[_0x5cab('0x6f')](_0x23b02e[_0x5cab('0x58')],[_0x5cab('0x68'),'id'])||{})[_0x5cab('0x70')](function(_0x399f4e){for(var _0x32a5d0=0x0;_0x32a5d0<_0x23b02e['body'][_0x5cab('0x68')][_0x5cab('0x47')];_0x32a5d0+=0x1){socket[_0x5cab('0x71')](_0x5cab('0x72'),{'UserId':_0x23b02e[_0x5cab('0x58')][_0x5cab('0x68')][_0x32a5d0],'WhatsappAccountId':_0x23b02e[_0x5cab('0x55')]['id']});}return _0x399f4e;});}})[_0x5cab('0x32')](respondWithResult(_0x1ffcd9,null))['catch'](handleError(_0x1ffcd9,null));};exports[_0x5cab('0x73')]=function(_0x3b4edd,_0x343d83,_0x324b87){return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x3b4edd[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x343d83,null))['then'](function(_0x2062d7){if(_0x2062d7){return _0x2062d7[_0x5cab('0x73')](_0x3b4edd[_0x5cab('0x41')][_0x5cab('0x68')])['then'](function(){if(_[_0x5cab('0x74')](_0x3b4edd[_0x5cab('0x41')][_0x5cab('0x68')])){for(var _0x4cbe95=0x0;_0x4cbe95<_0x3b4edd[_0x5cab('0x41')][_0x5cab('0x68')][_0x5cab('0x47')];_0x4cbe95+=0x1){socket[_0x5cab('0x71')](_0x5cab('0x75'),{'UserId':Number(_0x3b4edd[_0x5cab('0x41')][_0x5cab('0x68')][_0x4cbe95]),'WhatsappAccountId':Number(_0x3b4edd[_0x5cab('0x55')]['id'])});}}else{socket['emit'](_0x5cab('0x75'),{'UserId':Number(_0x3b4edd[_0x5cab('0x41')][_0x5cab('0x68')]),'WhatsappAccountId':Number(_0x3b4edd[_0x5cab('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x343d83,null))[_0x5cab('0x25')](handleError(_0x343d83,null));};exports[_0x5cab('0x76')]=function(_0x4ac8d4,_0x18b2a9,_0x5606b8){var _0x1b9c26={};var _0x4bb846={};var _0x15dcfa;var _0xd80d36;return db[_0x5cab('0x3b')][_0x5cab('0x65')]({'where':{'id':_0x4ac8d4[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x18b2a9,null))[_0x5cab('0x32')](function(_0x250585){if(_0x250585){_0x15dcfa=_0x250585;_0x4bb846[_0x5cab('0x3f')]=_[_0x5cab('0x42')](db[_0x5cab('0x77')][_0x5cab('0x3c')]);_0x4bb846[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x4ac8d4[_0x5cab('0x41')]);_0x4bb846['filters']=_[_0x5cab('0x44')](_0x4bb846['model'],_0x4bb846[_0x5cab('0x41')]);_0x1b9c26['attributes']=_[_0x5cab('0x44')](_0x4bb846[_0x5cab('0x3f')],qs[_0x5cab('0x46')](_0x4ac8d4['query'][_0x5cab('0x46')]));_0x1b9c26[_0x5cab('0x45')]=_0x1b9c26[_0x5cab('0x45')]['length']?_0x1b9c26[_0x5cab('0x45')]:_0x4bb846[_0x5cab('0x3f')];_0x1b9c26[_0x5cab('0x4a')]=qs[_0x5cab('0x4b')](_0x4ac8d4[_0x5cab('0x41')][_0x5cab('0x4b')]);_0x1b9c26['where']=qs[_0x5cab('0x43')](_[_0x5cab('0x4d')](_0x4ac8d4[_0x5cab('0x41')],_0x4bb846[_0x5cab('0x43')]));if(_0x4ac8d4[_0x5cab('0x41')]['filter']){_0x1b9c26[_0x5cab('0x4c')]=_[_0x5cab('0x4f')](_0x1b9c26['where'],{'$or':_[_0x5cab('0x40')](_0x1b9c26[_0x5cab('0x45')],function(_0x280298){var _0x2c133d={};_0x2c133d[_0x280298]={'$like':'%'+_0x4ac8d4[_0x5cab('0x41')][_0x5cab('0x4e')]+'%'};return _0x2c133d;})});}_0x1b9c26=_['merge']({},_0x1b9c26,_0x4ac8d4[_0x5cab('0x51')]);return _0x15dcfa[_0x5cab('0x76')](_0x1b9c26);}})['then'](function(_0x287427){if(_0x287427){_0xd80d36=_0x287427[_0x5cab('0x47')];if(!_0x4ac8d4[_0x5cab('0x41')]['hasOwnProperty'](_0x5cab('0x66'))){_0x1b9c26['limit']=qs[_0x5cab('0x2a')](_0x4ac8d4['query'][_0x5cab('0x2a')]);_0x1b9c26[_0x5cab('0x49')]=qs[_0x5cab('0x49')](_0x4ac8d4[_0x5cab('0x41')][_0x5cab('0x49')]);}return _0x15dcfa[_0x5cab('0x76')](_0x1b9c26);}})[_0x5cab('0x32')](function(_0x18ec42){if(_0x18ec42){return _0x18ec42?{'count':_0xd80d36,'rows':_0x18ec42}:null;}})[_0x5cab('0x32')](respondWithResult(_0x18b2a9,null))[_0x5cab('0x25')](handleError(_0x18b2a9,null));};exports['addApplications']=function(_0x45bf02,_0x7f31d7,_0x1bcf68){return db[_0x5cab('0x3b')][_0x5cab('0x65')]({'where':{'id':_0x45bf02[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x7f31d7,null))[_0x5cab('0x32')](function(_0x43384e){if(_0x43384e){return db[_0x5cab('0x78')][_0x5cab('0x79')](function(_0x1243d2){return db['WhatsappApplication'][_0x5cab('0x33')]({'where':{'WhatsappAccountId':_0x45bf02[_0x5cab('0x55')]['id']},'transaction':_0x1243d2})[_0x5cab('0x32')](function(_0x278f30){var _0xc4e032=_[_0x5cab('0x40')](_0x45bf02['body'],function(_0x40e856){_0x40e856[_0x5cab('0x63')]=_0x45bf02[_0x5cab('0x55')]['id'];return _0x40e856;});return db[_0x5cab('0x7a')][_0x5cab('0x7b')](_0xc4e032,{'transaction':_0x1243d2});});})[_0x5cab('0x32')](function(){return db[_0x5cab('0x7a')][_0x5cab('0x7c')]({'where':{'WhatsappAccountId':_0x45bf02['params']['id']},'order':'priority'});});}})[_0x5cab('0x32')](respondWithResult(_0x7f31d7,null))[_0x5cab('0x25')](handleError(_0x7f31d7,null));};exports[_0x5cab('0x7d')]=function(_0x132537,_0x4c61f9,_0x2acffe){var _0x327b89={};var _0x1bfb85={};var _0x17fc29;var _0x4988be;return db['WhatsappAccount']['findOne']({'where':{'id':_0x132537[_0x5cab('0x55')]['id']}})[_0x5cab('0x32')](handleEntityNotFound(_0x4c61f9,null))[_0x5cab('0x32')](function(_0x3338eb){if(_0x3338eb){_0x17fc29=_0x3338eb;_0x1bfb85[_0x5cab('0x3f')]=_[_0x5cab('0x42')](db[_0x5cab('0x7a')]['rawAttributes']);_0x1bfb85[_0x5cab('0x41')]=_[_0x5cab('0x42')](_0x132537[_0x5cab('0x41')]);_0x1bfb85[_0x5cab('0x43')]=_['intersection'](_0x1bfb85[_0x5cab('0x3f')],_0x1bfb85['query']);_0x327b89['attributes']=_['intersection'](_0x1bfb85[_0x5cab('0x3f')],qs[_0x5cab('0x46')](_0x132537['query']['fields']));_0x327b89[_0x5cab('0x45')]=_0x327b89[_0x5cab('0x45')][_0x5cab('0x47')]?_0x327b89[_0x5cab('0x45')]:_0x1bfb85['model'];_0x327b89[_0x5cab('0x4a')]=qs[_0x5cab('0x4b')](_0x132537['query']['sort']);_0x327b89['where']=qs[_0x5cab('0x43')](_[_0x5cab('0x4d')](_0x132537[_0x5cab('0x41')],_0x1bfb85[_0x5cab('0x43')]));if(_0x132537[_0x5cab('0x41')]['filter']){_0x327b89[_0x5cab('0x4c')]=_[_0x5cab('0x4f')](_0x327b89[_0x5cab('0x4c')],{'$or':_[_0x5cab('0x40')](_0x327b89['attributes'],function(_0x2ca1d1){var _0x509e8a={};_0x509e8a[_0x2ca1d1]={'$like':'%'+_0x132537[_0x5cab('0x41')][_0x5cab('0x4e')]+'%'};return _0x509e8a;})});}_0x327b89=_[_0x5cab('0x4f')]({},_0x327b89,_0x132537[_0x5cab('0x51')]);return _0x17fc29[_0x5cab('0x7d')](_0x327b89);}})[_0x5cab('0x32')](function(_0x5b9eb7){if(_0x5b9eb7){_0x4988be=_0x5b9eb7[_0x5cab('0x47')];if(!_0x132537['query']['hasOwnProperty'](_0x5cab('0x66'))){_0x327b89[_0x5cab('0x2a')]=qs[_0x5cab('0x2a')](_0x132537['query'][_0x5cab('0x2a')]);_0x327b89[_0x5cab('0x49')]=qs[_0x5cab('0x49')](_0x132537[_0x5cab('0x41')][_0x5cab('0x49')]);}return _0x17fc29[_0x5cab('0x7d')](_0x327b89);}})[_0x5cab('0x32')](function(_0x328a26){if(_0x328a26){return _0x328a26?{'count':_0x4988be,'rows':_0x328a26}:null;}})['then'](respondWithResult(_0x4c61f9,null))[_0x5cab('0x25')](handleError(_0x4c61f9,null));};exports['notify']=function(_0x15813e,_0x40a17b,_0x4e6b77){var _0x2f39b1={'channel':_0x5cab('0x7e')};var _0x352e22=[];var _0x4566d9=[];var _0x192733={};return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x15813e[_0x5cab('0x55')]['id']},'include':[{'model':db[_0x5cab('0x7a')],'as':_0x5cab('0x7f')}]})[_0x5cab('0x32')](handleEntityNotFound(_0x40a17b,null))[_0x5cab('0x32')](function(_0x1b45f0){_0x2f39b1[_0x5cab('0x80')]=_0x1b45f0;_0x2f39b1[_0x5cab('0x81')]=_[_0x5cab('0x82')](_0x1b45f0['Applications'],[_0x5cab('0x83')],['asc']);if(_0x2f39b1[_0x5cab('0x80')][_0x5cab('0x7f')]){delete _0x2f39b1[_0x5cab('0x80')][_0x5cab('0x7f')];}return db[_0x5cab('0x84')][_0x5cab('0x61')]();})[_0x5cab('0x32')](function(_0x30e3c){if(!_0x30e3c){throw new db[(_0x5cab('0x85'))][(_0x5cab('0x86'))](_0x5cab('0x87'));}_0x352e22=_['difference'](_['keys'](_0x30e3c),[_0x5cab('0x88'),_0x5cab('0x89')]);_0x4566d9=_[_0x5cab('0x8a')](_[_0x5cab('0x42')](_0x30e3c),[_0x5cab('0x88'),_0x5cab('0x89'),'CompanyId',_0x5cab('0x8b')]);_0x2f39b1[_0x5cab('0x58')]={'mapKey':'mobile'};if(_0x2f39b1['account'][_0x5cab('0x3e')]&&_0x2f39b1[_0x5cab('0x80')]['type']===_0x5cab('0x8c')){_0x2f39b1['body'][_0x5cab('0x8d')]=_0x15813e[_0x5cab('0x58')][_0x5cab('0x8e')][_0x5cab('0x8f')](_0x5cab('0x90'),'');_0x2f39b1[_0x5cab('0x58')]['body']=_0x15813e[_0x5cab('0x58')]['Body'];_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x91')]=_0x15813e[_0x5cab('0x58')][_0x5cab('0x92')];}if(_0x2f39b1[_0x5cab('0x58')]['id']){delete _0x2f39b1[_0x5cab('0x58')]['id'];}if(_[_0x5cab('0x93')](_0x2f39b1[_0x5cab('0x58')]['from'])){throw new db['Sequelize'][(_0x5cab('0x86'))](_0x5cab('0x94'));}if(_[_0x5cab('0x93')](_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x58')])||_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x58')]===''){throw new db['Sequelize'][(_0x5cab('0x86'))](_0x5cab('0x95'));}if(_[_0x5cab('0x93')](_0x2f39b1[_0x5cab('0x58')]['mapKey'])){throw new db[(_0x5cab('0x85'))]['ValidationError'](_0x5cab('0x96')+_0x4566d9);}if(!_['includes'](_0x4566d9,_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x97')])){throw new db[(_0x5cab('0x85'))][(_0x5cab('0x86'))](_0x5cab('0x98')+_0x4566d9);}_0x192733[_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x97')]]=_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x8d')];return db['CmList'][_0x5cab('0x57')]({'where':{'id':_0x2f39b1['account']['ListId']},'include':[{'model':db[_0x5cab('0x84')],'as':_0x5cab('0x99'),'where':_0x192733,'limit':0x1,'order':[[_0x5cab('0x89'),_0x5cab('0x9a')]]}]});})[_0x5cab('0x32')](handleEntityNotFound(_0x40a17b,null))[_0x5cab('0x32')](function(_0x400d5a){if(_0x400d5a){_0x2f39b1[_0x5cab('0x9b')]=_[_0x5cab('0x6f')](_0x400d5a,['Contacts']);if(_0x400d5a[_0x5cab('0x99')]['length']){return _0x400d5a['Contacts'][0x0];}var _0x56865b=_[_0x5cab('0x16')](_0x2f39b1[_0x5cab('0x58')],{'firstName':_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x8d')],'ListId':_0x400d5a['id']});_0x56865b[_0x2f39b1['body']['mapKey']]=_0x2f39b1[_0x5cab('0x58')]['from'];return db[_0x5cab('0x84')][_0x5cab('0x5f')](_0x56865b,{'fields':_0x352e22,'raw':!![]});}})[_0x5cab('0x32')](handleEntityNotFound(_0x40a17b,null))[_0x5cab('0x32')](function(_0x52d3f5){if(_0x52d3f5){_0x2f39b1[_0x5cab('0x9c')]=_0x52d3f5;var _0x37bbb3={'ContactId':_0x52d3f5['id'],'phone':_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x8d')],'WhatsappAccountId':_0x15813e['params']['id']};var _0x1dd014={'ContactId':_0x52d3f5['id'],'WhatsappAccountId':_0x15813e[_0x5cab('0x55')]['id'],'closed':![]};return db[_0x5cab('0x9d')][_0x5cab('0x57')]({'where':_0x1dd014})[_0x5cab('0x32')](function(_0x233fdb){if(_0x233fdb){return[_0x233fdb,![]];}return db['WhatsappInteraction'][_0x5cab('0x5f')](_0x37bbb3)[_0x5cab('0x32')](function(_0x1f9477){return[_0x1f9477,!![]];});});}})[_0x5cab('0x70')](function(_0x217f02,_0x94ca82){_0x2f39b1[_0x5cab('0x9e')]=_0x217f02[_0x5cab('0x5b')]({'plain':!![]});_0x2f39b1['interaction']['created']=![];if(_0x94ca82){if(_0x2f39b1[_0x5cab('0x80')][_0x5cab('0x9f')]){_0x2f39b1[_0x5cab('0x81')][_0x5cab('0xa0')]({'id':0x0,'priority':_0x2f39b1['applications'][_0x5cab('0x47')]+0x1,'app':'close','appdata':_0x5cab('0xa1'),'interval':_0x5cab('0xa2')});}_0x2f39b1['interaction'][_0x5cab('0xa3')]=!![];}return db[_0x5cab('0xa4')][_0x5cab('0x5f')]({'phone':_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x8d')],'messageId':_0x2f39b1[_0x5cab('0x58')]['messageId'],'body':_0x2f39b1[_0x5cab('0x58')][_0x5cab('0x58')],'WhatsappAccountId':_0x15813e[_0x5cab('0x55')]['id'],'WhatsappInteractionId':_0x217f02['id'],'direction':'in','ContactId':_0x217f02[_0x5cab('0xa5')],'AttachmentId':_0x2f39b1[_0x5cab('0x58')]['AttachmentId']});})['then'](function(_0x7e56be){_0x2f39b1['message']=_0x7e56be;if(_0x2f39b1[_0x5cab('0x9e')][_0x5cab('0xa6')]){return db[_0x5cab('0x77')][_0x5cab('0x57')]({'attributes':['id',_0x5cab('0x36')],'where':{'id':_0x2f39b1[_0x5cab('0x9e')]['UserId']}})[_0x5cab('0x32')](function(_0xb2dbb0){if(_0xb2dbb0){_0x2f39b1['applications'][_0x5cab('0xa7')]({'id':0x0,'priority':0x0,'app':_0x5cab('0xa8'),'appdata':_0xb2dbb0['name']+','+(_0x2f39b1[_0x5cab('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x5cab('0xa2')});}return respondWithRpcPromise(_0x5cab('0xa9'),_0x5cab('0xaa'),_0x2f39b1);});}return respondWithRpcPromise('Start',_0x5cab('0xaa'),_0x2f39b1);})['then'](function(_0x312c98){if(_0x312c98){var _0x31ad30=0xc8;var _0x4b16c9=_0x5cab('0xab');logger[_0x5cab('0x1d')](_0x5cab('0x20'),_0x4b16c9,_0x31ad30,_0x5cab('0xac'));logger[_0x5cab('0xad')](_0x5cab('0xae'),_0x4b16c9,_0x31ad30,_0x5cab('0xac'),JSON[_0x5cab('0xaf')](_0x312c98));if(_0x2f39b1['account'][_0x5cab('0x3e')]===_0x5cab('0x8c')){return _0x40a17b[_0x5cab('0x2b')](_0x31ad30)[_0x5cab('0x2c')](_0x5cab('0xb0'),_0x5cab('0xb1'))[_0x5cab('0x37')](_0x5cab('0xb2'));}else{return _0x40a17b[_0x5cab('0x2b')](_0x31ad30)['json'](_0x312c98);}}})[_0x5cab('0x25')](handleError(_0x40a17b,null));};exports[_0x5cab('0x37')]=function(_0x549be3,_0x125489,_0x267008){var _0x37b0c7,_0x4ff79d,_0xb7e5c0;if(_[_0x5cab('0x93')](_0x549be3[_0x5cab('0x58')]['body'])||_0x549be3[_0x5cab('0x58')][_0x5cab('0x58')]===''){throw new db[(_0x5cab('0x85'))][(_0x5cab('0x86'))](_0x5cab('0x95'));}if(_[_0x5cab('0x93')](_0x549be3[_0x5cab('0x58')]['to'])){throw new db[(_0x5cab('0x85'))]['ValidationError'](_0x5cab('0xb3'));}_0x37b0c7=_0x549be3[_0x5cab('0x58')]['to'];return db[_0x5cab('0x3b')][_0x5cab('0x57')]({'where':{'id':_0x549be3[_0x5cab('0x55')]['id']},'include':[{'model':db[_0x5cab('0xb4')],'as':_0x5cab('0xb5'),'include':[{'model':db[_0x5cab('0x84')],'as':_0x5cab('0x99'),'where':{'mobile':_0x37b0c7},'limit':0x1,'order':[[_0x5cab('0x89'),_0x5cab('0x9a')]]}]}]})[_0x5cab('0x32')](handleEntityNotFound(_0x125489,null))['then'](function(_0x590cd6){if(_0x590cd6&&_0x590cd6[_0x5cab('0xb5')]){_0x4ff79d=_0x590cd6[_0x5cab('0x5b')]({'plain':!![]});if(_0x4ff79d[_0x5cab('0xb5')]&&_0x4ff79d[_0x5cab('0xb5')][_0x5cab('0x99')][_0x5cab('0x47')]){return _0x4ff79d[_0x5cab('0xb5')][_0x5cab('0x99')][0x0];}return db['CmContact']['create'](_['defaults'](_0x549be3[_0x5cab('0x58')],{'firstName':_0x37b0c7,'mobile':_0x37b0c7,'phone':_0x37b0c7,'ListId':_0x4ff79d[_0x5cab('0x8b')]}));}})[_0x5cab('0x32')](handleEntityNotFound(_0x125489,null))['then'](function(_0x54fdde){if(_0x54fdde){_0xb7e5c0=_0x54fdde;return db[_0x5cab('0x9d')]['find']({'where':{'ContactId':_0xb7e5c0['id'],'closed':![],'WhatsappAccountId':_0x4ff79d['id']}})[_0x5cab('0x32')](function(_0x5456f4){if(_0x5456f4){return[_0x5456f4,![]];}return db[_0x5cab('0x9d')][_0x5cab('0x5f')]({'UserId':_0x549be3[_0x5cab('0x59')]['id'],'ContactId':_0xb7e5c0['id'],'WhatsappAccountId':_0x4ff79d['id'],'phone':_0x37b0c7,'firstMsgDirection':_0x5cab('0xb6'),'Messages':[_[_0x5cab('0x4f')](_0x549be3['body'],{'read':![],'body':_0x549be3[_0x5cab('0x58')][_0x5cab('0x58')],'phone':_0x37b0c7,'WhatsappAccountId':_0x4ff79d['id'],'UserId':_0x549be3[_0x5cab('0x59')]['id'],'ContactId':_0xb7e5c0['id']})]},{'include':[{'model':db[_0x5cab('0xa4')],'as':_0x5cab('0xb7')}]})[_0x5cab('0x32')](function(_0x4c6614){return[_0x4c6614,!![]];});});}})[_0x5cab('0x70')](function(_0x4c811c,_0x42b2cb){if(_0x42b2cb){return _0x4c811c;}return db[_0x5cab('0xa4')][_0x5cab('0x5f')](_[_0x5cab('0x4f')](_0x549be3[_0x5cab('0x58')],{'read':![],'body':_0x549be3[_0x5cab('0x58')][_0x5cab('0x58')],'phone':_0x37b0c7,'WhatsappAccountId':_0x4ff79d['id'],'WhatsappInteractionId':_0x4c811c['id'],'UserId':_0x549be3[_0x5cab('0x59')]['id'],'ContactId':_0xb7e5c0['id']}))['then'](function(_0x5260eb){_0x4c811c['dataValues'][_0x5cab('0xb7')]=[];_0x4c811c['dataValues'][_0x5cab('0xb7')]['push'](_0x5260eb['dataValues']);return _0x4c811c;});})[_0x5cab('0x32')](respondWithResult(_0x125489,null))['catch'](handleError(_0x125489,null));}; \ No newline at end of file +var _0xc9f3=['result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','WhatsappAccounts','end','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','type','key','map','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','account','applications','orderBy','asc','Applications','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x531b44,_0x11c960){var _0x5efd34=function(_0xe4f59b){while(--_0xe4f59b){_0x531b44['push'](_0x531b44['shift']());}};_0x5efd34(++_0x11c960);}(_0xc9f3,0x90));var _0x3c9f=function(_0x225248,_0x3e5fb7){_0x225248=_0x225248-0x0;var _0x12605b=_0xc9f3[_0x225248];return _0x12605b;};'use strict';var pdf=require(_0x3c9f('0x0'));var emlformat=require(_0x3c9f('0x1'));var rimraf=require(_0x3c9f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c9f('0x3'));var rp=require(_0x3c9f('0x4'));var moment=require(_0x3c9f('0x5'));var BPromise=require(_0x3c9f('0x6'));var Mustache=require(_0x3c9f('0x7'));var util=require(_0x3c9f('0x8'));var path=require('path');var sox=require(_0x3c9f('0x9'));var csv=require(_0x3c9f('0xa'));var ejs=require(_0x3c9f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c9f('0xc'));var crypto=require(_0x3c9f('0xd'));var jsforce=require(_0x3c9f('0xe'));var deskjs=require(_0x3c9f('0xf'));var toCsv=require(_0x3c9f('0xa'));var querystring=require(_0x3c9f('0x10'));var Papa=require(_0x3c9f('0x11'));var Redis=require(_0x3c9f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3c9f('0x13'));var as=require(_0x3c9f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c9f('0x15'))(_0x3c9f('0x16'));var utils=require(_0x3c9f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3c9f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3c9f('0x19')](config[_0x3c9f('0x1a')],{'host':_0x3c9f('0x1b'),'port':0x18eb});var socket=require(_0x3c9f('0x1c'))(new Redis(config[_0x3c9f('0x1a')]));require(_0x3c9f('0x1d'))[_0x3c9f('0x1e')](socket);var jayson=require(_0x3c9f('0x1f'));var client=jayson[_0x3c9f('0x20')][_0x3c9f('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x189a1b,_0x2919a6,_0xdd73a,_0x4cb52e){return new BPromise(function(_0x322e98,_0x26f6d5){var _0x272fa4=_0x4cb52e||client;return _0x272fa4[_0x3c9f('0x22')](_0x189a1b,_0xdd73a)[_0x3c9f('0x23')](function(_0x1c65f7){logger['info'](_0x3c9f('0x24'),_0x2919a6,'request\x20sent');logger[_0x3c9f('0x25')](_0x3c9f('0x26'),_0x2919a6,_0x3c9f('0x27'),JSON[_0x3c9f('0x28')](_0x1c65f7));if(_0x1c65f7[_0x3c9f('0x29')]){if(_0x1c65f7['error'][_0x3c9f('0x2a')]===0x1f4){logger[_0x3c9f('0x29')](_0x3c9f('0x24'),_0x2919a6,_0x1c65f7[_0x3c9f('0x29')]['message']);return _0x26f6d5(_0x1c65f7[_0x3c9f('0x29')]['message']);}logger[_0x3c9f('0x29')](_0x3c9f('0x24'),_0x2919a6,_0x1c65f7[_0x3c9f('0x29')][_0x3c9f('0x2b')]);return _0x322e98(_0x1c65f7[_0x3c9f('0x29')][_0x3c9f('0x2b')]);}else{logger[_0x3c9f('0x2c')](_0x3c9f('0x24'),_0x2919a6,'request\x20sent');_0x322e98(_0x1c65f7[_0x3c9f('0x2d')][_0x3c9f('0x2b')]);}})[_0x3c9f('0x2e')](function(_0x416b74){logger[_0x3c9f('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x2919a6,_0x416b74);_0x26f6d5(_0x416b74);});});}function respondWithStatusCode(_0x1b382a,_0x1fd631){_0x1fd631=_0x1fd631||0xcc;return function(_0x2423a8){if(_0x2423a8){return _0x1b382a[_0x3c9f('0x2f')](_0x1fd631);}return _0x1b382a['status'](_0x1fd631)['end']();};}function respondWithResult(_0x38c0bf,_0x3e1e8c){_0x3e1e8c=_0x3e1e8c||0xc8;return function(_0xd8c55e){if(_0xd8c55e){return _0x38c0bf[_0x3c9f('0x30')](_0x3e1e8c)['json'](_0xd8c55e);}};}function respondWithFilteredResult(_0x31d25d,_0x3de397){return function(_0x1511c5){if(_0x1511c5){var _0xfc80ec=_0x1511c5[_0x3c9f('0x31')],_0x1e5521=_0x3de397[_0x3c9f('0x32')],_0x2ce4fa=_0x3de397['offset']+_0x3de397[_0x3c9f('0x33')],_0x34ba32;if(_0x2ce4fa>=_0xfc80ec){_0x2ce4fa=_0xfc80ec;_0x34ba32=0xc8;}else{_0x34ba32=0xce;}_0x31d25d['status'](_0x34ba32);return _0x31d25d[_0x3c9f('0x34')](_0x3c9f('0x35'),_0x1e5521+'-'+_0x2ce4fa+'/'+_0xfc80ec)[_0x3c9f('0x36')](_0x1511c5);}return null;};}function patchUpdates(_0xb6eab1){return function(_0x1fe222){try{jsonpatch['apply'](_0x1fe222,_0xb6eab1,!![]);}catch(_0x1c9314){return BPromise[_0x3c9f('0x37')](_0x1c9314);}return _0x1fe222[_0x3c9f('0x38')]();};}function saveUpdates(_0xf904c2,_0x3d3262){return function(_0x194455){if(_0x194455){return _0x194455[_0x3c9f('0x39')](_0xf904c2)[_0x3c9f('0x23')](function(_0x4cac16){return _0x4cac16;});}return null;};}function removeEntity(_0x25c8f6,_0x5f1cab){return function(_0x2ca8b6){if(_0x2ca8b6){return _0x2ca8b6[_0x3c9f('0x3a')]()[_0x3c9f('0x23')](function(){var _0x4b20f5=_0x2ca8b6['get']({'plain':!![]});var _0x315c9f=_0x3c9f('0x3b');return db['UserProfileResource'][_0x3c9f('0x3a')]({'where':{'type':_0x315c9f,'resourceId':_0x4b20f5['id']}})['then'](function(){return _0x2ca8b6;});})[_0x3c9f('0x23')](function(){_0x25c8f6[_0x3c9f('0x30')](0xcc)[_0x3c9f('0x3c')]();});}};}function handleEntityNotFound(_0x321a60,_0x362664){return function(_0xb4cff){if(!_0xb4cff){_0x321a60[_0x3c9f('0x2f')](0x194);}return _0xb4cff;};}function handleError(_0x4ceae7,_0x3fa4d0){_0x3fa4d0=_0x3fa4d0||0x1f4;return function(_0xa860c3){logger[_0x3c9f('0x29')](_0xa860c3[_0x3c9f('0x3d')]);if(_0xa860c3[_0x3c9f('0x3e')]){delete _0xa860c3[_0x3c9f('0x3e')];}_0x4ceae7[_0x3c9f('0x30')](_0x3fa4d0)[_0x3c9f('0x3f')](_0xa860c3);};}exports[_0x3c9f('0x40')]=function(_0x1d82c3,_0x1fac51){var _0x1b4bd5={'include':[{'model':db[_0x3c9f('0x41')],'as':'mandatoryDispositionPause'}]},_0x331121={},_0x4ae0a2={'count':0x0,'rows':[]};var _0x53f02d=_['map'](db[_0x3c9f('0x42')][_0x3c9f('0x43')],function(_0x242c96){return{'name':_0x242c96['fieldName'],'type':_0x242c96[_0x3c9f('0x44')][_0x3c9f('0x45')]};});_0x331121['model']=_[_0x3c9f('0x46')](_0x53f02d,_0x3c9f('0x3e'));_0x331121['query']=_[_0x3c9f('0x47')](_0x1d82c3['query']);_0x331121['filters']=_['intersection'](_0x331121['model'],_0x331121[_0x3c9f('0x48')]);_0x1b4bd5[_0x3c9f('0x49')]=_[_0x3c9f('0x4a')](_0x331121[_0x3c9f('0x4b')],qs[_0x3c9f('0x4c')](_0x1d82c3[_0x3c9f('0x48')]['fields']));_0x1b4bd5[_0x3c9f('0x49')]=_0x1b4bd5[_0x3c9f('0x49')][_0x3c9f('0x4d')]?_0x1b4bd5[_0x3c9f('0x49')]:_0x331121[_0x3c9f('0x4b')];if(!_0x1d82c3[_0x3c9f('0x48')][_0x3c9f('0x4e')]('nolimit')){_0x1b4bd5[_0x3c9f('0x33')]=qs[_0x3c9f('0x33')](_0x1d82c3[_0x3c9f('0x48')][_0x3c9f('0x33')]);_0x1b4bd5[_0x3c9f('0x32')]=qs[_0x3c9f('0x32')](_0x1d82c3[_0x3c9f('0x48')][_0x3c9f('0x32')]);}_0x1b4bd5[_0x3c9f('0x4f')]=qs['sort'](_0x1d82c3['query'][_0x3c9f('0x50')]);_0x1b4bd5[_0x3c9f('0x51')]=qs['filters'](_[_0x3c9f('0x52')](_0x1d82c3['query'],_0x331121[_0x3c9f('0x53')]),_0x53f02d);if(_0x1d82c3[_0x3c9f('0x48')][_0x3c9f('0x54')]){_0x1b4bd5['where']=_['merge'](_0x1b4bd5[_0x3c9f('0x51')],{'$or':_[_0x3c9f('0x46')](_0x53f02d,function(_0x4d52bc){if(_0x4d52bc['type']!==_0x3c9f('0x55')){var _0x255fa2={};_0x255fa2[_0x4d52bc[_0x3c9f('0x3e')]]={'$like':'%'+_0x1d82c3['query'][_0x3c9f('0x54')]+'%'};return _0x255fa2;}})});}_0x1b4bd5=_[_0x3c9f('0x56')]({},_0x1b4bd5,_0x1d82c3[_0x3c9f('0x57')]);var _0x18dc4e={'where':_0x1b4bd5[_0x3c9f('0x51')]};return db['WhatsappAccount'][_0x3c9f('0x31')](_0x18dc4e)[_0x3c9f('0x23')](function(_0x2e48ed){_0x4ae0a2['count']=_0x2e48ed;if(_0x1d82c3[_0x3c9f('0x48')][_0x3c9f('0x58')]){_0x1b4bd5[_0x3c9f('0x59')]=[{'all':!![]}];}return db[_0x3c9f('0x42')][_0x3c9f('0x5a')](_0x1b4bd5);})['then'](function(_0x59d7e5){_0x4ae0a2[_0x3c9f('0x5b')]=_0x59d7e5;return _0x4ae0a2;})[_0x3c9f('0x23')](respondWithFilteredResult(_0x1fac51,_0x1b4bd5))[_0x3c9f('0x2e')](handleError(_0x1fac51,null));};exports[_0x3c9f('0x5c')]=function(_0x5e3ba2,_0x9bcb92){var _0x2be376={'raw':![],'where':{'id':_0x5e3ba2[_0x3c9f('0x5d')]['id']},'include':[{'model':db[_0x3c9f('0x41')],'as':_0x3c9f('0x5e')}]},_0x24a3eb={};_0x24a3eb[_0x3c9f('0x4b')]=_[_0x3c9f('0x47')](db['WhatsappAccount'][_0x3c9f('0x43')]);_0x24a3eb[_0x3c9f('0x48')]=_[_0x3c9f('0x47')](_0x5e3ba2[_0x3c9f('0x48')]);_0x24a3eb['filters']=_[_0x3c9f('0x4a')](_0x24a3eb['model'],_0x24a3eb[_0x3c9f('0x48')]);_0x2be376[_0x3c9f('0x49')]=_[_0x3c9f('0x4a')](_0x24a3eb[_0x3c9f('0x4b')],qs[_0x3c9f('0x4c')](_0x5e3ba2[_0x3c9f('0x48')]['fields']));_0x2be376['attributes']=_0x2be376[_0x3c9f('0x49')]['length']?_0x2be376[_0x3c9f('0x49')]:_0x24a3eb['model'];if(_0x5e3ba2[_0x3c9f('0x48')]['includeAll']){_0x2be376['include']=[{'all':!![]}];}_0x2be376=_['merge']({},_0x2be376,_0x5e3ba2['options']);return db[_0x3c9f('0x42')][_0x3c9f('0x5f')](_0x2be376)[_0x3c9f('0x23')](handleEntityNotFound(_0x9bcb92,null))[_0x3c9f('0x23')](respondWithResult(_0x9bcb92,null))['catch'](handleError(_0x9bcb92,null));};exports[_0x3c9f('0x60')]=function(_0x56ba71,_0x26eaf2){return db['WhatsappAccount'][_0x3c9f('0x60')](_0x56ba71['body'],{})[_0x3c9f('0x23')](function(_0x20e371){var _0x309f8d=_0x56ba71[_0x3c9f('0x61')][_0x3c9f('0x62')]({'plain':!![]});if(!_0x309f8d)throw new Error(_0x3c9f('0x63'));if(_0x309f8d[_0x3c9f('0x64')]===_0x3c9f('0x61')){var _0x11dba4=_0x20e371[_0x3c9f('0x62')]({'plain':!![]});var _0x2a1e4e='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x2a1e4e,'userProfileId':_0x309f8d[_0x3c9f('0x65')]},'raw':!![]})['then'](function(_0x5ce23b){if(_0x5ce23b&&_0x5ce23b[_0x3c9f('0x66')]===0x0){return db[_0x3c9f('0x67')]['create']({'name':_0x11dba4[_0x3c9f('0x3e')],'resourceId':_0x11dba4['id'],'type':_0x5ce23b[_0x3c9f('0x3e')],'sectionId':_0x5ce23b['id']},{})[_0x3c9f('0x23')](function(){return _0x20e371;});}else{return _0x20e371;}})['catch'](function(_0x3d5634){logger[_0x3c9f('0x29')](_0x3c9f('0x68'),_0x3d5634);throw _0x3d5634;});}return _0x20e371;})[_0x3c9f('0x23')](respondWithResult(_0x26eaf2,0xc9))[_0x3c9f('0x2e')](handleError(_0x26eaf2,null));};exports[_0x3c9f('0x39')]=function(_0x36bf15,_0x19634a){if(_0x36bf15[_0x3c9f('0x69')]['id']){delete _0x36bf15['body']['id'];}return db[_0x3c9f('0x42')]['find']({'where':{'id':_0x36bf15[_0x3c9f('0x5d')]['id']},'include':[{'model':db[_0x3c9f('0x41')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x19634a,null))[_0x3c9f('0x23')](saveUpdates(_0x36bf15[_0x3c9f('0x69')],null))[_0x3c9f('0x23')](respondWithResult(_0x19634a,null))[_0x3c9f('0x2e')](handleError(_0x19634a,null));};exports['destroy']=function(_0xffaf88,_0x19d607){return db['WhatsappAccount']['find']({'where':{'id':_0xffaf88[_0x3c9f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19d607,null))['then'](removeEntity(_0x19d607,null))[_0x3c9f('0x2e')](handleError(_0x19d607,null));};exports[_0x3c9f('0x6a')]=function(_0x4a0d84,_0x19b8a6){return db['WhatsappAccount'][_0x3c9f('0x6a')]()[_0x3c9f('0x23')](respondWithResult(_0x19b8a6,null))[_0x3c9f('0x2e')](handleError(_0x19b8a6,null));};exports[_0x3c9f('0x6b')]=function(_0x478064,_0x2b36a6,_0x2183b0){if(_0x478064[_0x3c9f('0x69')]['id']){delete _0x478064[_0x3c9f('0x69')]['id'];}return db[_0x3c9f('0x42')][_0x3c9f('0x5f')]({'where':{'id':_0x478064['params']['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x2b36a6,null))[_0x3c9f('0x23')](function(_0x4abe40){if(_0x4abe40){_0x478064[_0x3c9f('0x69')][_0x3c9f('0x6c')]=_0x4abe40['id'];return db[_0x3c9f('0x6d')][_0x3c9f('0x60')](_0x478064[_0x3c9f('0x69')]);}})[_0x3c9f('0x23')](respondWithResult(_0x2b36a6,null))['catch'](handleError(_0x2b36a6,null));};exports['getDispositions']=function(_0x232192,_0x4f68c7,_0x59547a){var _0x5e6cec={'raw':![],'where':{}};var _0x223414={};var _0x2ab063={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3c9f('0x6e')]({'where':{'id':_0x232192[_0x3c9f('0x5d')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x4f68c7,null))[_0x3c9f('0x23')](function(_0x25c482){if(_0x25c482){_0x223414[_0x3c9f('0x4b')]=_['keys'](db[_0x3c9f('0x6d')][_0x3c9f('0x43')]);_0x223414[_0x3c9f('0x48')]=_['keys'](_0x232192[_0x3c9f('0x48')]);_0x223414[_0x3c9f('0x53')]=_[_0x3c9f('0x4a')](_0x223414[_0x3c9f('0x4b')],_0x223414[_0x3c9f('0x48')]);_0x5e6cec['attributes']=_[_0x3c9f('0x4a')](_0x223414[_0x3c9f('0x4b')],qs['fields'](_0x232192['query']['fields']));_0x5e6cec['attributes']=_0x5e6cec['attributes'][_0x3c9f('0x4d')]?_0x5e6cec['attributes']:_0x223414['model'];if(!_0x232192[_0x3c9f('0x48')][_0x3c9f('0x4e')](_0x3c9f('0x6f'))){_0x5e6cec[_0x3c9f('0x33')]=qs[_0x3c9f('0x33')](_0x232192['query'][_0x3c9f('0x33')]);_0x5e6cec[_0x3c9f('0x32')]=qs[_0x3c9f('0x32')](_0x232192['query'][_0x3c9f('0x32')]);}_0x5e6cec[_0x3c9f('0x4f')]=qs[_0x3c9f('0x50')](_0x232192[_0x3c9f('0x48')][_0x3c9f('0x50')]);_0x5e6cec['where']=qs[_0x3c9f('0x53')](_[_0x3c9f('0x52')](_0x232192['query'],_0x223414[_0x3c9f('0x53')]));_0x5e6cec[_0x3c9f('0x51')][_0x3c9f('0x6c')]=_0x25c482['id'];if(_0x232192['query'][_0x3c9f('0x54')]){_0x5e6cec[_0x3c9f('0x51')]=_['merge'](_0x5e6cec[_0x3c9f('0x51')],{'$or':_[_0x3c9f('0x46')](_0x5e6cec['attributes'],function(_0x50ec18){var _0x114fcb={};_0x114fcb[_0x50ec18]={'$like':'%'+_0x232192[_0x3c9f('0x48')][_0x3c9f('0x54')]+'%'};return _0x114fcb;})});}_0x5e6cec=_['merge']({},_0x5e6cec,_0x232192[_0x3c9f('0x57')]);return db['Disposition']['count']({'where':_0x5e6cec[_0x3c9f('0x51')]})[_0x3c9f('0x23')](function(_0x785a22){_0x2ab063[_0x3c9f('0x31')]=_0x785a22;if(_0x232192[_0x3c9f('0x48')][_0x3c9f('0x58')]){_0x5e6cec[_0x3c9f('0x59')]=[{'all':!![]}];}return db[_0x3c9f('0x6d')]['findAll'](_0x5e6cec);})[_0x3c9f('0x23')](function(_0x2ef4b2){_0x2ab063[_0x3c9f('0x5b')]=_0x2ef4b2;return _0x2ab063;});}})[_0x3c9f('0x23')](respondWithFilteredResult(_0x4f68c7,_0x5e6cec))['catch'](handleError(_0x4f68c7,null));};exports['removeDispositions']=function(_0x396c51,_0x325236,_0x554e3b){return db['WhatsappAccount']['find']({'where':{'id':_0x396c51['params']['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x325236,null))[_0x3c9f('0x23')](function(_0x60d6f7){if(_0x60d6f7){return _0x60d6f7['removeDispositions'](_0x396c51[_0x3c9f('0x48')][_0x3c9f('0x70')]);}})[_0x3c9f('0x23')](respondWithStatusCode(_0x325236,null))[_0x3c9f('0x2e')](handleError(_0x325236,null));};exports['addAnswer']=function(_0x30d69e,_0x429244,_0x1fc6c3){if(_0x30d69e[_0x3c9f('0x69')]['id']){delete _0x30d69e[_0x3c9f('0x69')]['id'];}return db[_0x3c9f('0x42')]['find']({'where':{'id':_0x30d69e[_0x3c9f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x429244,null))[_0x3c9f('0x23')](function(_0x2f7158){if(_0x2f7158){_0x30d69e['body'][_0x3c9f('0x6c')]=_0x2f7158['id'];return db[_0x3c9f('0x71')][_0x3c9f('0x60')](_0x30d69e[_0x3c9f('0x69')]);}})[_0x3c9f('0x23')](respondWithResult(_0x429244,null))['catch'](handleError(_0x429244,null));};exports[_0x3c9f('0x72')]=function(_0x4b57d2,_0x9c212d,_0x45da5c){var _0x570fc3={'raw':![],'where':{}};var _0x1c597b={};var _0x2b0f4e={'count':0x0,'rows':[]};return db[_0x3c9f('0x42')]['findOne']({'where':{'id':_0x4b57d2[_0x3c9f('0x5d')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x9c212d,null))[_0x3c9f('0x23')](function(_0x448bf2){if(_0x448bf2){_0x1c597b[_0x3c9f('0x4b')]=_[_0x3c9f('0x47')](db['CannedAnswer']['rawAttributes']);_0x1c597b[_0x3c9f('0x48')]=_[_0x3c9f('0x47')](_0x4b57d2['query']);_0x1c597b[_0x3c9f('0x53')]=_[_0x3c9f('0x4a')](_0x1c597b[_0x3c9f('0x4b')],_0x1c597b[_0x3c9f('0x48')]);_0x570fc3[_0x3c9f('0x49')]=_['intersection'](_0x1c597b[_0x3c9f('0x4b')],qs[_0x3c9f('0x4c')](_0x4b57d2[_0x3c9f('0x48')][_0x3c9f('0x4c')]));_0x570fc3[_0x3c9f('0x49')]=_0x570fc3[_0x3c9f('0x49')]['length']?_0x570fc3[_0x3c9f('0x49')]:_0x1c597b[_0x3c9f('0x4b')];if(!_0x4b57d2[_0x3c9f('0x48')][_0x3c9f('0x4e')](_0x3c9f('0x6f'))){_0x570fc3['limit']=qs[_0x3c9f('0x33')](_0x4b57d2[_0x3c9f('0x48')]['limit']);_0x570fc3[_0x3c9f('0x32')]=qs['offset'](_0x4b57d2[_0x3c9f('0x48')]['offset']);}_0x570fc3[_0x3c9f('0x4f')]=qs[_0x3c9f('0x50')](_0x4b57d2['query'][_0x3c9f('0x50')]);_0x570fc3[_0x3c9f('0x51')]=qs['filters'](_[_0x3c9f('0x52')](_0x4b57d2[_0x3c9f('0x48')],_0x1c597b[_0x3c9f('0x53')]));_0x570fc3[_0x3c9f('0x51')][_0x3c9f('0x6c')]=_0x448bf2['id'];if(_0x4b57d2[_0x3c9f('0x48')][_0x3c9f('0x54')]){_0x570fc3[_0x3c9f('0x51')]=_[_0x3c9f('0x56')](_0x570fc3['where'],{'$or':_[_0x3c9f('0x46')](_0x570fc3[_0x3c9f('0x49')],function(_0x207435){var _0x7981b8={};_0x7981b8[_0x207435]={'$like':'%'+_0x4b57d2[_0x3c9f('0x48')][_0x3c9f('0x54')]+'%'};return _0x7981b8;})});}_0x570fc3=_[_0x3c9f('0x56')]({},_0x570fc3,_0x4b57d2[_0x3c9f('0x57')]);return db[_0x3c9f('0x71')][_0x3c9f('0x31')]({'where':_0x570fc3[_0x3c9f('0x51')]})['then'](function(_0x381f6f){_0x2b0f4e['count']=_0x381f6f;if(_0x4b57d2[_0x3c9f('0x48')][_0x3c9f('0x58')]){_0x570fc3['include']=[{'all':!![]}];}return db[_0x3c9f('0x71')][_0x3c9f('0x5a')](_0x570fc3);})[_0x3c9f('0x23')](function(_0x4bd57f){_0x2b0f4e[_0x3c9f('0x5b')]=_0x4bd57f;return _0x2b0f4e;});}})[_0x3c9f('0x23')](respondWithFilteredResult(_0x9c212d,_0x570fc3))[_0x3c9f('0x2e')](handleError(_0x9c212d,null));};exports[_0x3c9f('0x73')]=function(_0x4b48b4,_0x552fb6,_0x48c3ef){return db[_0x3c9f('0x42')][_0x3c9f('0x5f')]({'where':{'id':_0x4b48b4[_0x3c9f('0x5d')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x552fb6,null))[_0x3c9f('0x23')](function(_0x2cb3f5){if(_0x2cb3f5){return _0x2cb3f5[_0x3c9f('0x73')](_0x4b48b4[_0x3c9f('0x48')]['ids']);}})[_0x3c9f('0x23')](respondWithStatusCode(_0x552fb6,null))[_0x3c9f('0x2e')](handleError(_0x552fb6,null));};exports[_0x3c9f('0x74')]=function(_0x3ee35d,_0x31ed29,_0x232ef7){return db[_0x3c9f('0x42')][_0x3c9f('0x5f')]({'where':{'id':_0x3ee35d[_0x3c9f('0x5d')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x31ed29,null))['then'](function(_0x411918){if(_0x411918){return _0x411918[_0x3c9f('0x74')](_0x3ee35d['body'][_0x3c9f('0x70')],_[_0x3c9f('0x75')](_0x3ee35d[_0x3c9f('0x69')],['ids','id'])||{})[_0x3c9f('0x76')](function(_0xf1a1f1){for(var _0x181c07=0x0;_0x181c07<_0x3ee35d[_0x3c9f('0x69')][_0x3c9f('0x70')][_0x3c9f('0x4d')];_0x181c07+=0x1){socket['emit'](_0x3c9f('0x77'),{'UserId':_0x3ee35d[_0x3c9f('0x69')][_0x3c9f('0x70')][_0x181c07],'WhatsappAccountId':_0x3ee35d[_0x3c9f('0x5d')]['id']});}return _0xf1a1f1;});}})[_0x3c9f('0x23')](respondWithResult(_0x31ed29,null))[_0x3c9f('0x2e')](handleError(_0x31ed29,null));};exports['removeAgents']=function(_0x142842,_0x58c738,_0x331d56){return db[_0x3c9f('0x42')][_0x3c9f('0x5f')]({'where':{'id':_0x142842['params']['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x58c738,null))['then'](function(_0x7f3b3c){if(_0x7f3b3c){return _0x7f3b3c[_0x3c9f('0x78')](_0x142842[_0x3c9f('0x48')][_0x3c9f('0x70')])['then'](function(){if(_[_0x3c9f('0x79')](_0x142842[_0x3c9f('0x48')]['ids'])){for(var _0x18cdf5=0x0;_0x18cdf5<_0x142842[_0x3c9f('0x48')]['ids'][_0x3c9f('0x4d')];_0x18cdf5+=0x1){socket[_0x3c9f('0x7a')](_0x3c9f('0x7b'),{'UserId':Number(_0x142842[_0x3c9f('0x48')][_0x3c9f('0x70')][_0x18cdf5]),'WhatsappAccountId':Number(_0x142842[_0x3c9f('0x5d')]['id'])});}}else{socket[_0x3c9f('0x7a')]('userWhatsappAccount:remove',{'UserId':Number(_0x142842['query'][_0x3c9f('0x70')]),'WhatsappAccountId':Number(_0x142842[_0x3c9f('0x5d')]['id'])});}});}})[_0x3c9f('0x23')](respondWithStatusCode(_0x58c738,null))[_0x3c9f('0x2e')](handleError(_0x58c738,null));};exports[_0x3c9f('0x7c')]=function(_0x41fb43,_0x509035,_0x3e8d65){var _0x1a609a={};var _0xd2f843={};var _0x2fc271;var _0x4b6958;return db['WhatsappAccount'][_0x3c9f('0x6e')]({'where':{'id':_0x41fb43['params']['id']}})['then'](handleEntityNotFound(_0x509035,null))[_0x3c9f('0x23')](function(_0x66115e){if(_0x66115e){_0x2fc271=_0x66115e;_0xd2f843[_0x3c9f('0x4b')]=_['keys'](db[_0x3c9f('0x7d')]['rawAttributes']);_0xd2f843[_0x3c9f('0x48')]=_[_0x3c9f('0x47')](_0x41fb43['query']);_0xd2f843[_0x3c9f('0x53')]=_[_0x3c9f('0x4a')](_0xd2f843[_0x3c9f('0x4b')],_0xd2f843[_0x3c9f('0x48')]);_0x1a609a[_0x3c9f('0x49')]=_[_0x3c9f('0x4a')](_0xd2f843[_0x3c9f('0x4b')],qs[_0x3c9f('0x4c')](_0x41fb43[_0x3c9f('0x48')][_0x3c9f('0x4c')]));_0x1a609a['attributes']=_0x1a609a['attributes'][_0x3c9f('0x4d')]?_0x1a609a['attributes']:_0xd2f843[_0x3c9f('0x4b')];_0x1a609a[_0x3c9f('0x4f')]=qs['sort'](_0x41fb43[_0x3c9f('0x48')][_0x3c9f('0x50')]);_0x1a609a[_0x3c9f('0x51')]=qs[_0x3c9f('0x53')](_[_0x3c9f('0x52')](_0x41fb43[_0x3c9f('0x48')],_0xd2f843[_0x3c9f('0x53')]));if(_0x41fb43[_0x3c9f('0x48')][_0x3c9f('0x54')]){_0x1a609a[_0x3c9f('0x51')]=_[_0x3c9f('0x56')](_0x1a609a[_0x3c9f('0x51')],{'$or':_[_0x3c9f('0x46')](_0x1a609a[_0x3c9f('0x49')],function(_0x1c35fc){var _0xad04a0={};_0xad04a0[_0x1c35fc]={'$like':'%'+_0x41fb43[_0x3c9f('0x48')]['filter']+'%'};return _0xad04a0;})});}_0x1a609a=_[_0x3c9f('0x56')]({},_0x1a609a,_0x41fb43[_0x3c9f('0x57')]);return _0x2fc271[_0x3c9f('0x7c')](_0x1a609a);}})[_0x3c9f('0x23')](function(_0x2f81ef){if(_0x2f81ef){_0x4b6958=_0x2f81ef[_0x3c9f('0x4d')];if(!_0x41fb43[_0x3c9f('0x48')][_0x3c9f('0x4e')](_0x3c9f('0x6f'))){_0x1a609a[_0x3c9f('0x33')]=qs[_0x3c9f('0x33')](_0x41fb43[_0x3c9f('0x48')]['limit']);_0x1a609a[_0x3c9f('0x32')]=qs[_0x3c9f('0x32')](_0x41fb43[_0x3c9f('0x48')]['offset']);}return _0x2fc271[_0x3c9f('0x7c')](_0x1a609a);}})['then'](function(_0x4f9894){if(_0x4f9894){return _0x4f9894?{'count':_0x4b6958,'rows':_0x4f9894}:null;}})['then'](respondWithResult(_0x509035,null))[_0x3c9f('0x2e')](handleError(_0x509035,null));};exports[_0x3c9f('0x7e')]=function(_0xdca267,_0x3307db,_0x594646){return db[_0x3c9f('0x42')][_0x3c9f('0x6e')]({'where':{'id':_0xdca267[_0x3c9f('0x5d')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x3307db,null))[_0x3c9f('0x23')](function(_0x1ec6be){if(_0x1ec6be){return db[_0x3c9f('0x7f')]['transaction'](function(_0x506bc3){return db[_0x3c9f('0x80')][_0x3c9f('0x3a')]({'where':{'WhatsappAccountId':_0xdca267[_0x3c9f('0x5d')]['id']},'transaction':_0x506bc3})['then'](function(_0x141b21){var _0x3ef737=_[_0x3c9f('0x46')](_0xdca267['body'],function(_0x4e2221){_0x4e2221[_0x3c9f('0x6c')]=_0xdca267['params']['id'];return _0x4e2221;});return db['WhatsappApplication'][_0x3c9f('0x81')](_0x3ef737,{'transaction':_0x506bc3});});})[_0x3c9f('0x23')](function(){return db[_0x3c9f('0x80')][_0x3c9f('0x82')]({'where':{'WhatsappAccountId':_0xdca267[_0x3c9f('0x5d')]['id']},'order':_0x3c9f('0x83')});});}})['then'](respondWithResult(_0x3307db,null))[_0x3c9f('0x2e')](handleError(_0x3307db,null));};exports[_0x3c9f('0x84')]=function(_0x1418ac,_0x3ef15d,_0x166a4c){var _0x1f642d={};var _0x3c5a8a={};var _0x3ce6ac;var _0x67a7ae;return db[_0x3c9f('0x42')]['findOne']({'where':{'id':_0x1418ac['params']['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x3ef15d,null))[_0x3c9f('0x23')](function(_0x1df986){if(_0x1df986){_0x3ce6ac=_0x1df986;_0x3c5a8a[_0x3c9f('0x4b')]=_[_0x3c9f('0x47')](db[_0x3c9f('0x80')][_0x3c9f('0x43')]);_0x3c5a8a['query']=_['keys'](_0x1418ac[_0x3c9f('0x48')]);_0x3c5a8a[_0x3c9f('0x53')]=_[_0x3c9f('0x4a')](_0x3c5a8a[_0x3c9f('0x4b')],_0x3c5a8a[_0x3c9f('0x48')]);_0x1f642d[_0x3c9f('0x49')]=_[_0x3c9f('0x4a')](_0x3c5a8a['model'],qs[_0x3c9f('0x4c')](_0x1418ac['query'][_0x3c9f('0x4c')]));_0x1f642d['attributes']=_0x1f642d[_0x3c9f('0x49')][_0x3c9f('0x4d')]?_0x1f642d[_0x3c9f('0x49')]:_0x3c5a8a[_0x3c9f('0x4b')];_0x1f642d[_0x3c9f('0x4f')]=qs['sort'](_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x50')]);_0x1f642d[_0x3c9f('0x51')]=qs[_0x3c9f('0x53')](_[_0x3c9f('0x52')](_0x1418ac['query'],_0x3c5a8a[_0x3c9f('0x53')]));if(_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x54')]){_0x1f642d['where']=_[_0x3c9f('0x56')](_0x1f642d['where'],{'$or':_[_0x3c9f('0x46')](_0x1f642d[_0x3c9f('0x49')],function(_0x3e4f2f){var _0x290917={};_0x290917[_0x3e4f2f]={'$like':'%'+_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x54')]+'%'};return _0x290917;})});}_0x1f642d=_[_0x3c9f('0x56')]({},_0x1f642d,_0x1418ac[_0x3c9f('0x57')]);return _0x3ce6ac[_0x3c9f('0x84')](_0x1f642d);}})[_0x3c9f('0x23')](function(_0x408461){if(_0x408461){_0x67a7ae=_0x408461[_0x3c9f('0x4d')];if(!_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x4e')](_0x3c9f('0x6f'))){_0x1f642d['limit']=qs[_0x3c9f('0x33')](_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x33')]);_0x1f642d[_0x3c9f('0x32')]=qs[_0x3c9f('0x32')](_0x1418ac[_0x3c9f('0x48')][_0x3c9f('0x32')]);}return _0x3ce6ac[_0x3c9f('0x84')](_0x1f642d);}})['then'](function(_0x3e6d4a){if(_0x3e6d4a){return _0x3e6d4a?{'count':_0x67a7ae,'rows':_0x3e6d4a}:null;}})[_0x3c9f('0x23')](respondWithResult(_0x3ef15d,null))[_0x3c9f('0x2e')](handleError(_0x3ef15d,null));};exports['notify']=function(_0x586c00,_0x376cef,_0x450c09){var _0x21b23f={'channel':'whatsapp'};var _0x4aca28=[];var _0xd968b4=[];var _0x3e32d1={};return db[_0x3c9f('0x42')][_0x3c9f('0x5f')]({'where':{'id':_0x586c00[_0x3c9f('0x5d')]['id']},'include':[{'model':db[_0x3c9f('0x80')],'as':'Applications'}]})[_0x3c9f('0x23')](handleEntityNotFound(_0x376cef,null))['then'](function(_0x27e5bc){_0x21b23f[_0x3c9f('0x85')]=_0x27e5bc;_0x21b23f[_0x3c9f('0x86')]=_[_0x3c9f('0x87')](_0x27e5bc['Applications'],[_0x3c9f('0x83')],[_0x3c9f('0x88')]);if(_0x21b23f[_0x3c9f('0x85')]['Applications']){delete _0x21b23f[_0x3c9f('0x85')][_0x3c9f('0x89')];}return db[_0x3c9f('0x8a')]['describe']();})[_0x3c9f('0x23')](function(_0x307b1c){if(!_0x307b1c){throw new db['Sequelize'][(_0x3c9f('0x8b'))](_0x3c9f('0x8c'));}_0x4aca28=_['difference'](_[_0x3c9f('0x47')](_0x307b1c),['createdAt',_0x3c9f('0x8d')]);_0xd968b4=_[_0x3c9f('0x8e')](_[_0x3c9f('0x47')](_0x307b1c),[_0x3c9f('0x8f'),'updatedAt','CompanyId',_0x3c9f('0x90')]);_0x21b23f[_0x3c9f('0x69')]={'mapKey':_0x3c9f('0x91')};if(_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0x44')]&&_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0x44')]===_0x3c9f('0x92')){_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x93')]=_0x586c00[_0x3c9f('0x69')][_0x3c9f('0x94')][_0x3c9f('0x95')](_0x3c9f('0x96'),'');_0x21b23f['body'][_0x3c9f('0x69')]=_0x586c00[_0x3c9f('0x69')][_0x3c9f('0x97')];_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x98')]=_0x586c00[_0x3c9f('0x69')][_0x3c9f('0x99')];}if(_0x21b23f[_0x3c9f('0x69')]['id']){delete _0x21b23f['body']['id'];}if(_[_0x3c9f('0x9a')](_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x93')])){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))](_0x3c9f('0x9c'));}if(_['isNil'](_0x21b23f[_0x3c9f('0x69')]['body'])||_0x21b23f[_0x3c9f('0x69')]['body']===''){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))](_0x3c9f('0x9d'));}if(_[_0x3c9f('0x9a')](_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x9e')])){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd968b4);}if(!_[_0x3c9f('0x9f')](_0xd968b4,_0x21b23f[_0x3c9f('0x69')]['mapKey'])){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))](_0x3c9f('0xa0')+_0xd968b4);}_0x3e32d1[_0x21b23f[_0x3c9f('0x69')]['mapKey']]=_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x93')];return db[_0x3c9f('0xa1')]['find']({'where':{'id':_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0x90')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e32d1,'limit':0x1,'order':[[_0x3c9f('0x8d'),_0x3c9f('0xa2')]]}]});})[_0x3c9f('0x23')](handleEntityNotFound(_0x376cef,null))[_0x3c9f('0x23')](function(_0x421bf9){if(_0x421bf9){_0x21b23f[_0x3c9f('0xa3')]=_[_0x3c9f('0x75')](_0x421bf9,['Contacts']);if(_0x421bf9[_0x3c9f('0xa4')][_0x3c9f('0x4d')]){return _0x421bf9[_0x3c9f('0xa4')][0x0];}var _0x237b64=_['defaults'](_0x21b23f[_0x3c9f('0x69')],{'firstName':_0x21b23f['body'][_0x3c9f('0x93')],'ListId':_0x421bf9['id']});_0x237b64[_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x9e')]]=_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x93')];return db['CmContact'][_0x3c9f('0x60')](_0x237b64,{'fields':_0x4aca28,'raw':!![]});}})[_0x3c9f('0x23')](handleEntityNotFound(_0x376cef,null))[_0x3c9f('0x23')](function(_0x3a59f2){if(_0x3a59f2){_0x21b23f['contact']=_0x3a59f2;var _0x56e919={'ContactId':_0x3a59f2['id'],'phone':_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0x93')],'WhatsappAccountId':_0x586c00[_0x3c9f('0x5d')]['id']};var _0x59356e={'ContactId':_0x3a59f2['id'],'WhatsappAccountId':_0x586c00[_0x3c9f('0x5d')]['id'],'closed':![]};return db[_0x3c9f('0xa5')][_0x3c9f('0x5f')]({'where':_0x59356e})[_0x3c9f('0x23')](function(_0x32f70b){if(_0x32f70b){return[_0x32f70b,![]];}return db[_0x3c9f('0xa5')]['create'](_0x56e919)[_0x3c9f('0x23')](function(_0x57b7a2){return[_0x57b7a2,!![]];});});}})['spread'](function(_0x37a9eb,_0x2d04df){_0x21b23f['interaction']=_0x37a9eb['get']({'plain':!![]});_0x21b23f[_0x3c9f('0xa6')][_0x3c9f('0xa7')]=![];if(_0x2d04df){if(_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0xa8')]){_0x21b23f[_0x3c9f('0x86')][_0x3c9f('0xa9')]({'id':0x0,'priority':_0x21b23f[_0x3c9f('0x86')][_0x3c9f('0x4d')]+0x1,'app':'close','appdata':_0x3c9f('0xaa'),'interval':_0x3c9f('0xab')});}_0x21b23f[_0x3c9f('0xa6')]['created']=!![];}return db[_0x3c9f('0xac')]['create']({'phone':_0x21b23f[_0x3c9f('0x69')]['from'],'messageId':_0x21b23f[_0x3c9f('0x69')]['messageId'],'body':_0x21b23f[_0x3c9f('0x69')]['body'],'WhatsappAccountId':_0x586c00[_0x3c9f('0x5d')]['id'],'WhatsappInteractionId':_0x37a9eb['id'],'direction':'in','ContactId':_0x37a9eb[_0x3c9f('0xad')],'AttachmentId':_0x21b23f[_0x3c9f('0x69')][_0x3c9f('0xae')]});})[_0x3c9f('0x23')](function(_0x3828de){_0x21b23f['message']=_0x3828de;if(_0x21b23f[_0x3c9f('0xa6')][_0x3c9f('0xaf')]){return db[_0x3c9f('0x7d')][_0x3c9f('0x5f')]({'attributes':['id',_0x3c9f('0x3e')],'where':{'id':_0x21b23f['interaction'][_0x3c9f('0xaf')]}})['then'](function(_0xa904ba){if(_0xa904ba){_0x21b23f[_0x3c9f('0x86')][_0x3c9f('0xb0')]({'id':0x0,'priority':0x0,'app':_0x3c9f('0xb1'),'appdata':_0xa904ba[_0x3c9f('0x3e')]+','+(_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3c9f('0xb3'),_0x3c9f('0xb4'),_0x21b23f);});}return respondWithRpcPromise(_0x3c9f('0xb3'),_0x3c9f('0xb4'),_0x21b23f);})[_0x3c9f('0x23')](function(_0x514607){if(_0x514607){var _0x3a6a05=0xc8;var _0x23e972='receiveMessage';logger[_0x3c9f('0x2c')](_0x3c9f('0x26'),_0x23e972,_0x3a6a05,'entity\x20found');logger[_0x3c9f('0x25')](_0x3c9f('0xb5'),_0x23e972,_0x3a6a05,'entity\x20found',JSON[_0x3c9f('0x28')](_0x514607));if(_0x21b23f[_0x3c9f('0x85')][_0x3c9f('0x44')]===_0x3c9f('0x92')){return _0x376cef[_0x3c9f('0x30')](_0x3a6a05)[_0x3c9f('0x34')](_0x3c9f('0xb6'),_0x3c9f('0xb7'))[_0x3c9f('0x3f')](_0x3c9f('0xb8'));}else{return _0x376cef[_0x3c9f('0x30')](_0x3a6a05)[_0x3c9f('0x36')](_0x514607);}}})[_0x3c9f('0x2e')](handleError(_0x376cef,null));};exports['send']=function(_0x6df811,_0x572fb5,_0x45b64d){var _0x27bf2c,_0x4ff6b6,_0x43b291;if(_['isNil'](_0x6df811[_0x3c9f('0x69')]['body'])||_0x6df811[_0x3c9f('0x69')][_0x3c9f('0x69')]===''){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x6df811[_0x3c9f('0x69')]['to'])){throw new db[(_0x3c9f('0x9b'))][(_0x3c9f('0x8b'))](_0x3c9f('0xb9'));}_0x27bf2c=_0x6df811[_0x3c9f('0x69')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x6df811[_0x3c9f('0x5d')]['id']},'include':[{'model':db[_0x3c9f('0xa1')],'as':_0x3c9f('0xba'),'include':[{'model':db['CmContact'],'as':_0x3c9f('0xa4'),'where':{'mobile':_0x27bf2c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x3c9f('0x23')](handleEntityNotFound(_0x572fb5,null))[_0x3c9f('0x23')](function(_0x1c0c56){if(_0x1c0c56&&_0x1c0c56[_0x3c9f('0xba')]){_0x4ff6b6=_0x1c0c56[_0x3c9f('0x62')]({'plain':!![]});if(_0x4ff6b6[_0x3c9f('0xba')]&&_0x4ff6b6[_0x3c9f('0xba')]['Contacts']['length']){return _0x4ff6b6[_0x3c9f('0xba')][_0x3c9f('0xa4')][0x0];}return db[_0x3c9f('0x8a')][_0x3c9f('0x60')](_[_0x3c9f('0x19')](_0x6df811[_0x3c9f('0x69')],{'firstName':_0x27bf2c,'mobile':_0x27bf2c,'phone':_0x27bf2c,'ListId':_0x4ff6b6[_0x3c9f('0x90')]}));}})[_0x3c9f('0x23')](handleEntityNotFound(_0x572fb5,null))[_0x3c9f('0x23')](function(_0x1c0334){if(_0x1c0334){_0x43b291=_0x1c0334;return db[_0x3c9f('0xa5')][_0x3c9f('0x5f')]({'where':{'ContactId':_0x43b291['id'],'closed':![],'WhatsappAccountId':_0x4ff6b6['id']}})['then'](function(_0x1d41d0){if(_0x1d41d0){return[_0x1d41d0,![]];}return db['WhatsappInteraction'][_0x3c9f('0x60')]({'UserId':_0x6df811[_0x3c9f('0x61')]['id'],'ContactId':_0x43b291['id'],'WhatsappAccountId':_0x4ff6b6['id'],'phone':_0x27bf2c,'firstMsgDirection':'out','Messages':[_[_0x3c9f('0x56')](_0x6df811[_0x3c9f('0x69')],{'read':![],'body':_0x6df811[_0x3c9f('0x69')][_0x3c9f('0x69')],'phone':_0x27bf2c,'WhatsappAccountId':_0x4ff6b6['id'],'UserId':_0x6df811['user']['id'],'ContactId':_0x43b291['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3c9f('0xbb')}]})[_0x3c9f('0x23')](function(_0x5ec2f7){return[_0x5ec2f7,!![]];});});}})[_0x3c9f('0x76')](function(_0x1fc2c3,_0x4c908d){if(_0x4c908d){return _0x1fc2c3;}return db[_0x3c9f('0xac')][_0x3c9f('0x60')](_['merge'](_0x6df811[_0x3c9f('0x69')],{'read':![],'body':_0x6df811['body'][_0x3c9f('0x69')],'phone':_0x27bf2c,'WhatsappAccountId':_0x4ff6b6['id'],'WhatsappInteractionId':_0x1fc2c3['id'],'UserId':_0x6df811[_0x3c9f('0x61')]['id'],'ContactId':_0x43b291['id']}))['then'](function(_0x21cff6){_0x1fc2c3[_0x3c9f('0xbc')][_0x3c9f('0xbb')]=[];_0x1fc2c3['dataValues'][_0x3c9f('0xbb')][_0x3c9f('0xa9')](_0x21cff6[_0x3c9f('0xbc')]);return _0x1fc2c3;});})[_0x3c9f('0x23')](respondWithResult(_0x572fb5,null))[_0x3c9f('0x2e')](handleError(_0x572fb5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2f061e2..060d5eb 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 _0x50a5=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d81db,_0x1d8ce8){var _0x166076=function(_0x567076){while(--_0x567076){_0x4d81db['push'](_0x4d81db['shift']());}};_0x166076(++_0x1d8ce8);}(_0x50a5,0xd1));var _0x550a=function(_0x240e8e,_0x5921a4){_0x240e8e=_0x240e8e-0x0;var _0x12c497=_0x50a5[_0x240e8e];return _0x12c497;};'use strict';var EventEmitter=require(_0x550a('0x0'));var WhatsappAccount=require(_0x550a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x550a('0x2')};function emitEvent(_0x4827e0){return function(_0x357485,_0x2038f7,_0x45ca06){WhatsappAccountEvents[_0x550a('0x3')](_0x4827e0+':'+_0x357485['id'],_0x357485);WhatsappAccountEvents[_0x550a('0x3')](_0x4827e0,_0x357485);_0x45ca06(null);};}for(var e in events){if(events[_0x550a('0x4')](e)){var event=events[e];WhatsappAccount[_0x550a('0x5')](e,emitEvent(event));}}module[_0x550a('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc0d7=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x3dd7fc,_0x53ff0e){var _0x79bf7f=function(_0xb0ebe2){while(--_0xb0ebe2){_0x3dd7fc['push'](_0x3dd7fc['shift']());}};_0x79bf7f(++_0x53ff0e);}(_0xc0d7,0x7f));var _0x7c0d=function(_0xa38764,_0xfe21b1){_0xa38764=_0xa38764-0x0;var _0x5d8b4f=_0xc0d7[_0xa38764];return _0x5d8b4f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7c0d('0x0')](0x0);var events={'afterCreate':_0x7c0d('0x1'),'afterUpdate':_0x7c0d('0x2'),'afterDestroy':_0x7c0d('0x3')};function emitEvent(_0x2c03ef){return function(_0x2e1cc8,_0xfbd3c8,_0x276b49){WhatsappAccountEvents[_0x7c0d('0x4')](_0x2c03ef+':'+_0x2e1cc8['id'],_0x2e1cc8);WhatsappAccountEvents['emit'](_0x2c03ef,_0x2e1cc8);_0x276b49(null);};}for(var e in events){if(events[_0x7c0d('0x5')](e)){var event=events[e];WhatsappAccount[_0x7c0d('0x6')](e,emitEvent(event));}}module[_0x7c0d('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1801efc..dc49b8a 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 _0x961a=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x961a,0x1a4));var _0xa961=function(_0x2cb980,_0x391491){_0x2cb980=_0x2cb980-0x0;var _0x1fb14d=_0x961a[_0x2cb980];return _0x1fb14d;};'use strict';var _=require(_0xa961('0x0'));var util=require(_0xa961('0x1'));var logger=require('../../config/logger')(_0xa961('0x2'));var moment=require(_0xa961('0x3'));var BPromise=require(_0xa961('0x4'));var rp=require(_0xa961('0x5'));var fs=require('fs');var path=require(_0xa961('0x6'));var rimraf=require(_0xa961('0x7'));var config=require('../../config/environment');var attributes=require(_0xa961('0x8'));module[_0xa961('0x9')]=function(_0x411a67,_0x203582){return _0x411a67[_0xa961('0xa')](_0xa961('0xb'),attributes,{'tableName':_0xa961('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cf5=['exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x53985e,_0x2e775f){var _0x461c1d=function(_0x437835){while(--_0x437835){_0x53985e['push'](_0x53985e['shift']());}};_0x461c1d(++_0x2e775f);}(_0x0cf5,0xd2));var _0x50cf=function(_0x524e1c,_0x27af86){_0x524e1c=_0x524e1c-0x0;var _0x54ccb2=_0x0cf5[_0x524e1c];return _0x54ccb2;};'use strict';var _=require(_0x50cf('0x0'));var util=require(_0x50cf('0x1'));var logger=require(_0x50cf('0x2'))(_0x50cf('0x3'));var moment=require(_0x50cf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50cf('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x50cf('0x6')]=function(_0x27a722,_0x31d0a3){return _0x27a722['define'](_0x50cf('0x7'),attributes,{'tableName':_0x50cf('0x8'),'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 52edaa9..d2d8600 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 _0x9265=['ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x155297,_0x3daf81){var _0x3c8d2d=function(_0x5d2e09){while(--_0x5d2e09){_0x155297['push'](_0x155297['shift']());}};_0x3c8d2d(++_0x3daf81);}(_0x9265,0x1dd));var _0x5926=function(_0x1348e5,_0x32ea98){_0x1348e5=_0x1348e5-0x0;var _0x4e8440=_0x9265[_0x1348e5];return _0x4e8440;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5926('0x1'));var rs=require(_0x5926('0x2'));var fs=require('fs');var Redis=require(_0x5926('0x3'));var db=require(_0x5926('0x4'))['db'];var utils=require(_0x5926('0x5'));var logger=require(_0x5926('0x6'))(_0x5926('0x7'));var config=require(_0x5926('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5926('0x9')][_0x5926('0xa')]({'port':0x232a});config[_0x5926('0xb')]=_['defaults'](config[_0x5926('0xb')],{'host':_0x5926('0xc'),'port':0x18eb});var socket=require(_0x5926('0xd'))(new Redis(config[_0x5926('0xb')]));require(_0x5926('0xe'))[_0x5926('0xf')](socket);function respondWithRpcPromise(_0x1bb852,_0x2414ed,_0x1fa7e8){return new BPromise(function(_0x1a85be,_0x40864f){return client['request'](_0x1bb852,_0x1fa7e8)[_0x5926('0x10')](function(_0x4b707d){logger[_0x5926('0x11')](_0x5926('0x12'),_0x2414ed,'request\x20sent');logger[_0x5926('0x13')](_0x5926('0x14'),_0x2414ed,_0x5926('0x15'),JSON[_0x5926('0x16')](_0x4b707d));if(_0x4b707d[_0x5926('0x17')]){if(_0x4b707d[_0x5926('0x17')][_0x5926('0x18')]===0x1f4){logger[_0x5926('0x17')](_0x5926('0x12'),_0x2414ed,_0x4b707d['error'][_0x5926('0x19')]);return _0x40864f(_0x4b707d[_0x5926('0x17')][_0x5926('0x19')]);}logger[_0x5926('0x17')](_0x5926('0x12'),_0x2414ed,_0x4b707d['error'][_0x5926('0x19')]);return _0x1a85be(_0x4b707d[_0x5926('0x17')][_0x5926('0x19')]);}else{logger[_0x5926('0x11')](_0x5926('0x12'),_0x2414ed,_0x5926('0x15'));_0x1a85be(_0x4b707d[_0x5926('0x1a')][_0x5926('0x19')]);}})['catch'](function(_0x3cfe17){logger[_0x5926('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2414ed,_0x3cfe17);_0x40864f(_0x3cfe17);});});}exports[_0x5926('0x1b')]=function(_0x1c9d5a){var _0x266dcb=this;return new Promise(function(_0xd867a,_0xef9f12){return db[_0x5926('0x1c')]['find']({'raw':_0x1c9d5a[_0x5926('0x1d')]?_0x1c9d5a[_0x5926('0x1d')][_0x5926('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c9d5a[_0x5926('0x1d')]?_0x1c9d5a[_0x5926('0x1d')][_0x5926('0x1f')]||null:null,'attributes':_0x1c9d5a[_0x5926('0x1d')]?_0x1c9d5a[_0x5926('0x1d')][_0x5926('0x20')]||null:null,'include':_0x1c9d5a[_0x5926('0x1d')]?_0x1c9d5a[_0x5926('0x1d')][_0x5926('0x21')]?_[_0x5926('0x22')](_0x1c9d5a[_0x5926('0x1d')][_0x5926('0x21')],function(_0x34c8a6){return{'model':db[_0x34c8a6['model']],'as':_0x34c8a6['as'],'attributes':_0x34c8a6[_0x5926('0x20')],'include':_0x34c8a6[_0x5926('0x21')]?_['map'](_0x34c8a6['include'],function(_0x2d49dd){return{'model':db[_0x2d49dd[_0x5926('0x23')]],'as':_0x2d49dd['as'],'attributes':_0x2d49dd['attributes'],'include':_0x2d49dd['include']?_[_0x5926('0x22')](_0x2d49dd[_0x5926('0x21')],function(_0x5d3baa){return{'model':db[_0x5d3baa['model']],'as':_0x5d3baa['as'],'attributes':_0x5d3baa['attributes']};}):[]};}):[]};}):[]:[]})[_0x5926('0x10')](function(_0x13d64d){logger[_0x5926('0x11')]('ShowWhatsappAccount',_0x1c9d5a);logger['debug'](_0x5926('0x1b'),_0x1c9d5a,JSON['stringify'](_0x13d64d));_0xd867a(_0x13d64d);})['catch'](function(_0x5a4a80){logger['error'](_0x5926('0x1b'),_0x5a4a80[_0x5926('0x19')],_0x1c9d5a);_0xef9f12(_0x266dcb[_0x5926('0x17')](0x1f4,_0x5a4a80[_0x5926('0x19')]));});});}; \ No newline at end of file +var _0xa0ad=['map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','info','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','include'];(function(_0xfaeb48,_0x35e639){var _0x2a6290=function(_0x49e1f6){while(--_0x49e1f6){_0xfaeb48['push'](_0xfaeb48['shift']());}};_0x2a6290(++_0x35e639);}(_0xa0ad,0x14d));var _0xda0a=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xa0ad[_0x2405bc];return _0x5272d4;};'use strict';var _=require(_0xda0a('0x0'));var util=require(_0xda0a('0x1'));var moment=require(_0xda0a('0x2'));var BPromise=require('bluebird');var rs=require(_0xda0a('0x3'));var fs=require('fs');var Redis=require(_0xda0a('0x4'));var db=require(_0xda0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda0a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda0a('0x7')][_0xda0a('0x8')]({'port':0x232a});config[_0xda0a('0x9')]=_[_0xda0a('0xa')](config[_0xda0a('0x9')],{'host':_0xda0a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda0a('0x9')]));require(_0xda0a('0xc'))[_0xda0a('0xd')](socket);function respondWithRpcPromise(_0x478257,_0x3850fa,_0x1c1da0){return new BPromise(function(_0xaabaf6,_0x5a4a36){return client['request'](_0x478257,_0x1c1da0)['then'](function(_0x8c8229){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3850fa,_0xda0a('0xe'));logger[_0xda0a('0xf')](_0xda0a('0x10'),_0x3850fa,_0xda0a('0xe'),JSON[_0xda0a('0x11')](_0x8c8229));if(_0x8c8229[_0xda0a('0x12')]){if(_0x8c8229[_0xda0a('0x12')][_0xda0a('0x13')]===0x1f4){logger[_0xda0a('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3850fa,_0x8c8229[_0xda0a('0x12')][_0xda0a('0x14')]);return _0x5a4a36(_0x8c8229[_0xda0a('0x12')][_0xda0a('0x14')]);}logger[_0xda0a('0x12')](_0xda0a('0x15'),_0x3850fa,_0x8c8229['error'][_0xda0a('0x14')]);return _0xaabaf6(_0x8c8229['error'][_0xda0a('0x14')]);}else{logger[_0xda0a('0x16')](_0xda0a('0x15'),_0x3850fa,'request\x20sent');_0xaabaf6(_0x8c8229['result'][_0xda0a('0x14')]);}})[_0xda0a('0x17')](function(_0x449294){logger[_0xda0a('0x12')](_0xda0a('0x15'),_0x3850fa,_0x449294);_0x5a4a36(_0x449294);});});}exports[_0xda0a('0x18')]=function(_0x4adfec){var _0x38ef95=this;return new Promise(function(_0x134c19,_0x50d32a){return db[_0xda0a('0x19')][_0xda0a('0x1a')]({'raw':_0x4adfec['options']?_0x4adfec['options'][_0xda0a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4adfec[_0xda0a('0x1c')]?_0x4adfec[_0xda0a('0x1c')]['where']||null:null,'attributes':_0x4adfec[_0xda0a('0x1c')]?_0x4adfec[_0xda0a('0x1c')]['attributes']||null:null,'include':_0x4adfec[_0xda0a('0x1c')]?_0x4adfec['options'][_0xda0a('0x1d')]?_[_0xda0a('0x1e')](_0x4adfec[_0xda0a('0x1c')][_0xda0a('0x1d')],function(_0x5def8f){return{'model':db[_0x5def8f[_0xda0a('0x1f')]],'as':_0x5def8f['as'],'attributes':_0x5def8f[_0xda0a('0x20')],'include':_0x5def8f[_0xda0a('0x1d')]?_[_0xda0a('0x1e')](_0x5def8f[_0xda0a('0x1d')],function(_0x3ac09b){return{'model':db[_0x3ac09b[_0xda0a('0x1f')]],'as':_0x3ac09b['as'],'attributes':_0x3ac09b[_0xda0a('0x20')],'include':_0x3ac09b['include']?_[_0xda0a('0x1e')](_0x3ac09b['include'],function(_0x2e04ee){return{'model':db[_0x2e04ee['model']],'as':_0x2e04ee['as'],'attributes':_0x2e04ee[_0xda0a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fcc04){logger['info'](_0xda0a('0x18'),_0x4adfec);logger['debug'](_0xda0a('0x18'),_0x4adfec,JSON[_0xda0a('0x11')](_0x1fcc04));_0x134c19(_0x1fcc04);})[_0xda0a('0x17')](function(_0xb414fa){logger['error'](_0xda0a('0x18'),_0xb414fa[_0xda0a('0x14')],_0x4adfec);_0x50d32a(_0x38ef95[_0xda0a('0x12')](0x1f4,_0xb414fa['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7c5a38a..0e17b9f 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 _0x2517=['length','./whatsappAccount.events','save','update','register'];(function(_0x5e2931,_0x35830){var _0x14ed67=function(_0x2d724e){while(--_0x2d724e){_0x5e2931['push'](_0x5e2931['shift']());}};_0x14ed67(++_0x35830);}(_0x2517,0xc4));var _0x7251=function(_0x3acfde,_0x2f5c64){_0x3acfde=_0x3acfde-0x0;var _0x3f2c92=_0x2517[_0x3acfde];return _0x3f2c92;};'use strict';var WhatsappAccountEvents=require(_0x7251('0x0'));var events=[_0x7251('0x1'),'remove',_0x7251('0x2')];function createListener(_0xda1df5,_0x309115){return function(_0x1b65b7){_0x309115['emit'](_0xda1df5,_0x1b65b7);};}function removeListener(_0x11d058,_0x9319ed){return function(){WhatsappAccountEvents['removeListener'](_0x11d058,_0x9319ed);};}exports[_0x7251('0x3')]=function(_0x4d96f4){for(var _0x4e6120=0x0,_0x537974=events[_0x7251('0x4')];_0x4e6120<_0x537974;_0x4e6120++){var _0x31fb54=events[_0x4e6120];var _0x399096=createListener('whatsappAccount:'+_0x31fb54,_0x4d96f4);WhatsappAccountEvents['on'](_0x31fb54,_0x399096);}}; \ No newline at end of file +var _0x6b85=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6b85,0x1b6));var _0x56b8=function(_0x70300f,_0x17aac7){_0x70300f=_0x70300f-0x0;var _0x2e24d4=_0x6b85[_0x70300f];return _0x2e24d4;};'use strict';var WhatsappAccountEvents=require(_0x56b8('0x0'));var events=['save',_0x56b8('0x1'),_0x56b8('0x2')];function createListener(_0x59f093,_0x4571ea){return function(_0x4004b7){_0x4571ea[_0x56b8('0x3')](_0x59f093,_0x4004b7);};}function removeListener(_0x13a433,_0x5f1ccb){return function(){WhatsappAccountEvents[_0x56b8('0x4')](_0x13a433,_0x5f1ccb);};}exports['register']=function(_0x2509fa){for(var _0x310cc3=0x0,_0x4cc8f7=events[_0x56b8('0x5')];_0x310cc3<_0x4cc8f7;_0x310cc3++){var _0x10e66e=events[_0x310cc3];var _0x495449=createListener(_0x56b8('0x6')+_0x10e66e,_0x2509fa);WhatsappAccountEvents['on'](_0x10e66e,_0x495449);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8ef65b6..ab39c3a 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 _0x8c66=['connect-timeout','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2215ed,_0x85bd3a){var _0x5d7e25=function(_0x5673be){while(--_0x5673be){_0x2215ed['push'](_0x2215ed['shift']());}};_0x5d7e25(++_0x85bd3a);}(_0x8c66,0x173));var _0x68c6=function(_0x2b59e5,_0x104bf9){_0x2b59e5=_0x2b59e5-0x0;var _0x41aab2=_0x8c66[_0x2b59e5];return _0x41aab2;};'use strict';var multer=require(_0x68c6('0x0'));var util=require(_0x68c6('0x1'));var path=require(_0x68c6('0x2'));var timeout=require(_0x68c6('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x68c6('0x4'));var config=require('../../config/environment');var controller=require(_0x68c6('0x5'));router[_0x68c6('0x6')]('/',auth[_0x68c6('0x7')](),controller[_0x68c6('0x8')]);router[_0x68c6('0x6')](_0x68c6('0x9'),auth['isAuthenticated'](),controller[_0x68c6('0xa')]);router[_0x68c6('0xb')]('/',auth[_0x68c6('0x7')](),controller['create']);router[_0x68c6('0xc')](_0x68c6('0x9'),auth['isAuthenticated'](),controller[_0x68c6('0xd')]);router[_0x68c6('0xe')]('/:id',auth[_0x68c6('0x7')](),controller[_0x68c6('0xf')]);module[_0x68c6('0x10')]=router; \ No newline at end of file +var _0x95dc=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x47a8c2,_0x194066){var _0xcfb263=function(_0x307544){while(--_0x307544){_0x47a8c2['push'](_0x47a8c2['shift']());}};_0xcfb263(++_0x194066);}(_0x95dc,0x1a4));var _0xc95d=function(_0x11859e,_0x3ed5bd){_0x11859e=_0x11859e-0x0;var _0x153628=_0x95dc[_0x11859e];return _0x153628;};'use strict';var multer=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var path=require(_0xc95d('0x2'));var timeout=require(_0xc95d('0x3'));var express=require(_0xc95d('0x4'));var router=express[_0xc95d('0x5')]();var auth=require(_0xc95d('0x6'));var interaction=require(_0xc95d('0x7'));var config=require(_0xc95d('0x8'));var controller=require('./whatsappApplication.controller');router[_0xc95d('0x9')]('/',auth[_0xc95d('0xa')](),controller[_0xc95d('0xb')]);router['get'](_0xc95d('0xc'),auth['isAuthenticated'](),controller[_0xc95d('0xd')]);router[_0xc95d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc95d('0xc'),auth[_0xc95d('0xa')](),controller[_0xc95d('0xf')]);router[_0xc95d('0x10')](_0xc95d('0xc'),auth[_0xc95d('0xa')](),controller[_0xc95d('0x11')]);module[_0xc95d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f3edbeb..ae581ff 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 _0xdd8f=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdd8f,0x6b));var _0xfdd8=function(_0x520f45,_0x5beae2){_0x520f45=_0x520f45-0x0;var _0x25097a=_0xdd8f[_0x520f45];return _0x25097a;};'use strict';var Sequelize=require('sequelize');module[_0xfdd8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfdd8('0x1')],'allowNull':![],'defaultValue':_0xfdd8('0x2')},'appdata':{'type':Sequelize[_0xfdd8('0x3')]()},'description':{'type':Sequelize[_0xfdd8('0x1')]},'interval':{'type':Sequelize[_0xfdd8('0x1')],'defaultValue':_0xfdd8('0x4')}}; \ No newline at end of file +var _0xd6c6=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6c6,0x136));var _0x6d6c=function(_0x256bed,_0x397ee0){_0x256bed=_0x256bed-0x0;var _0x526dd7=_0xd6c6[_0x256bed];return _0x526dd7;};'use strict';var Sequelize=require(_0x6d6c('0x0'));module[_0x6d6c('0x1')]={'priority':{'type':Sequelize[_0x6d6c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d6c('0x3')],'allowNull':![],'defaultValue':_0x6d6c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6d6c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6d6c('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index cc54b1e..5398657 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 _0xec14=['findAll','rows','catch','show','params','includeAll','find','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include'];(function(_0x32d330,_0x50f46a){var _0x549100=function(_0x30eebd){while(--_0x30eebd){_0x32d330['push'](_0x32d330['shift']());}};_0x549100(++_0x50f46a);}(_0xec14,0x8f));var _0x4ec1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xec14[_0x433a86];return _0x23000c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ec1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ec1('0x1'));var moment=require(_0x4ec1('0x2'));var BPromise=require(_0x4ec1('0x3'));var Mustache=require(_0x4ec1('0x4'));var util=require(_0x4ec1('0x5'));var path=require('path');var sox=require(_0x4ec1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ec1('0x7'));var squel=require(_0x4ec1('0x8'));var crypto=require(_0x4ec1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4ec1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4ec1('0xb'));var Papa=require(_0x4ec1('0xc'));var Redis=require(_0x4ec1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ec1('0xe'));var as=require(_0x4ec1('0xf'));var hardwareService=require(_0x4ec1('0x10'));var logger=require(_0x4ec1('0x11'))('api');var utils=require(_0x4ec1('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cccd0,_0x476da8){_0x476da8=_0x476da8||0xcc;return function(_0x368988){if(_0x368988){return _0x4cccd0[_0x4ec1('0x13')](_0x476da8);}return _0x4cccd0[_0x4ec1('0x14')](_0x476da8)[_0x4ec1('0x15')]();};}function respondWithResult(_0x46bba1,_0x46f4b2){_0x46f4b2=_0x46f4b2||0xc8;return function(_0x9124fc){if(_0x9124fc){return _0x46bba1['status'](_0x46f4b2)[_0x4ec1('0x16')](_0x9124fc);}};}function respondWithFilteredResult(_0x528810,_0x557928){return function(_0x1048ca){if(_0x1048ca){var _0xb2f6be=_0x1048ca[_0x4ec1('0x17')],_0x3c3396=_0x557928[_0x4ec1('0x18')],_0xbfb37f=_0x557928[_0x4ec1('0x18')]+_0x557928[_0x4ec1('0x19')],_0x3beca4;if(_0xbfb37f>=_0xb2f6be){_0xbfb37f=_0xb2f6be;_0x3beca4=0xc8;}else{_0x3beca4=0xce;}_0x528810[_0x4ec1('0x14')](_0x3beca4);return _0x528810[_0x4ec1('0x1a')](_0x4ec1('0x1b'),_0x3c3396+'-'+_0xbfb37f+'/'+_0xb2f6be)[_0x4ec1('0x16')](_0x1048ca);}return null;};}function patchUpdates(_0x42470d){return function(_0x8264f2){try{jsonpatch['apply'](_0x8264f2,_0x42470d,!![]);}catch(_0x436697){return BPromise[_0x4ec1('0x1c')](_0x436697);}return _0x8264f2[_0x4ec1('0x1d')]();};}function saveUpdates(_0x5dbf13,_0x490c88){return function(_0x57c315){if(_0x57c315){return _0x57c315[_0x4ec1('0x1e')](_0x5dbf13)['then'](function(_0x30ddd5){return _0x30ddd5;});}return null;};}function removeEntity(_0x4235d3,_0x3d49c4){return function(_0x332e0f){if(_0x332e0f){return _0x332e0f[_0x4ec1('0x1f')]()['then'](function(){_0x4235d3[_0x4ec1('0x14')](0xcc)[_0x4ec1('0x15')]();});}};}function handleEntityNotFound(_0x3b45cf,_0x342fbf){return function(_0xd30af7){if(!_0xd30af7){_0x3b45cf[_0x4ec1('0x13')](0x194);}return _0xd30af7;};}function handleError(_0x42c97a,_0x2b860f){_0x2b860f=_0x2b860f||0x1f4;return function(_0x57f4d9){logger['error'](_0x57f4d9[_0x4ec1('0x20')]);if(_0x57f4d9[_0x4ec1('0x21')]){delete _0x57f4d9[_0x4ec1('0x21')];}_0x42c97a[_0x4ec1('0x14')](_0x2b860f)[_0x4ec1('0x22')](_0x57f4d9);};}exports[_0x4ec1('0x23')]=function(_0xb7a854,_0xbfd782){var _0x17d53a={},_0x14657b={},_0x1c0eb5={'count':0x0,'rows':[]};var _0xf46cf8=_[_0x4ec1('0x24')](db[_0x4ec1('0x25')][_0x4ec1('0x26')],function(_0x36018f){return{'name':_0x36018f[_0x4ec1('0x27')],'type':_0x36018f[_0x4ec1('0x28')][_0x4ec1('0x29')]};});_0x14657b[_0x4ec1('0x2a')]=_[_0x4ec1('0x24')](_0xf46cf8,_0x4ec1('0x21'));_0x14657b['query']=_[_0x4ec1('0x2b')](_0xb7a854[_0x4ec1('0x2c')]);_0x14657b[_0x4ec1('0x2d')]=_['intersection'](_0x14657b[_0x4ec1('0x2a')],_0x14657b[_0x4ec1('0x2c')]);_0x17d53a['attributes']=_[_0x4ec1('0x2e')](_0x14657b['model'],qs[_0x4ec1('0x2f')](_0xb7a854[_0x4ec1('0x2c')][_0x4ec1('0x2f')]));_0x17d53a['attributes']=_0x17d53a['attributes'][_0x4ec1('0x30')]?_0x17d53a[_0x4ec1('0x31')]:_0x14657b[_0x4ec1('0x2a')];if(!_0xb7a854[_0x4ec1('0x2c')]['hasOwnProperty'](_0x4ec1('0x32'))){_0x17d53a['limit']=qs[_0x4ec1('0x19')](_0xb7a854[_0x4ec1('0x2c')][_0x4ec1('0x19')]);_0x17d53a[_0x4ec1('0x18')]=qs[_0x4ec1('0x18')](_0xb7a854[_0x4ec1('0x2c')][_0x4ec1('0x18')]);}_0x17d53a[_0x4ec1('0x33')]=qs['sort'](_0xb7a854[_0x4ec1('0x2c')][_0x4ec1('0x34')]);_0x17d53a[_0x4ec1('0x35')]=qs['filters'](_[_0x4ec1('0x36')](_0xb7a854[_0x4ec1('0x2c')],_0x14657b[_0x4ec1('0x2d')]),_0xf46cf8);if(_0xb7a854[_0x4ec1('0x2c')][_0x4ec1('0x37')]){_0x17d53a[_0x4ec1('0x35')]=_[_0x4ec1('0x38')](_0x17d53a[_0x4ec1('0x35')],{'$or':_['map'](_0xf46cf8,function(_0x46d041){if(_0x46d041['type']!==_0x4ec1('0x39')){var _0x411c73={};_0x411c73[_0x46d041[_0x4ec1('0x21')]]={'$like':'%'+_0xb7a854[_0x4ec1('0x2c')]['filter']+'%'};return _0x411c73;}})});}_0x17d53a=_['merge']({},_0x17d53a,_0xb7a854[_0x4ec1('0x3a')]);var _0x3c2881={'where':_0x17d53a['where']};return db[_0x4ec1('0x25')]['count'](_0x3c2881)[_0x4ec1('0x3b')](function(_0x313190){_0x1c0eb5[_0x4ec1('0x17')]=_0x313190;if(_0xb7a854[_0x4ec1('0x2c')]['includeAll']){_0x17d53a[_0x4ec1('0x3c')]=[{'all':!![]}];}return db[_0x4ec1('0x25')][_0x4ec1('0x3d')](_0x17d53a);})['then'](function(_0x1f017c){_0x1c0eb5[_0x4ec1('0x3e')]=_0x1f017c;return _0x1c0eb5;})[_0x4ec1('0x3b')](respondWithFilteredResult(_0xbfd782,_0x17d53a))[_0x4ec1('0x3f')](handleError(_0xbfd782,null));};exports[_0x4ec1('0x40')]=function(_0x1ddaa9,_0x286593){var _0x403e90={'raw':!![],'where':{'id':_0x1ddaa9[_0x4ec1('0x41')]['id']}},_0x4a9be7={};_0x4a9be7[_0x4ec1('0x2a')]=_[_0x4ec1('0x2b')](db['WhatsappApplication'][_0x4ec1('0x26')]);_0x4a9be7[_0x4ec1('0x2c')]=_[_0x4ec1('0x2b')](_0x1ddaa9[_0x4ec1('0x2c')]);_0x4a9be7[_0x4ec1('0x2d')]=_[_0x4ec1('0x2e')](_0x4a9be7[_0x4ec1('0x2a')],_0x4a9be7[_0x4ec1('0x2c')]);_0x403e90[_0x4ec1('0x31')]=_[_0x4ec1('0x2e')](_0x4a9be7['model'],qs['fields'](_0x1ddaa9['query'][_0x4ec1('0x2f')]));_0x403e90['attributes']=_0x403e90[_0x4ec1('0x31')][_0x4ec1('0x30')]?_0x403e90[_0x4ec1('0x31')]:_0x4a9be7[_0x4ec1('0x2a')];if(_0x1ddaa9[_0x4ec1('0x2c')][_0x4ec1('0x42')]){_0x403e90['include']=[{'all':!![]}];}_0x403e90=_[_0x4ec1('0x38')]({},_0x403e90,_0x1ddaa9[_0x4ec1('0x3a')]);return db[_0x4ec1('0x25')][_0x4ec1('0x43')](_0x403e90)[_0x4ec1('0x3b')](handleEntityNotFound(_0x286593,null))[_0x4ec1('0x3b')](respondWithResult(_0x286593,null))[_0x4ec1('0x3f')](handleError(_0x286593,null));};exports['create']=function(_0x528065,_0x29d0b8){return db[_0x4ec1('0x25')]['create'](_0x528065['body'],{})[_0x4ec1('0x3b')](respondWithResult(_0x29d0b8,0xc9))['catch'](handleError(_0x29d0b8,null));};exports['update']=function(_0x1e026d,_0x21b261){if(_0x1e026d['body']['id']){delete _0x1e026d['body']['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x1e026d[_0x4ec1('0x41')]['id']}})[_0x4ec1('0x3b')](handleEntityNotFound(_0x21b261,null))['then'](saveUpdates(_0x1e026d['body'],null))['then'](respondWithResult(_0x21b261,null))[_0x4ec1('0x3f')](handleError(_0x21b261,null));};exports[_0x4ec1('0x1f')]=function(_0x59bda4,_0x28025c){return db[_0x4ec1('0x25')][_0x4ec1('0x43')]({'where':{'id':_0x59bda4[_0x4ec1('0x41')]['id']}})[_0x4ec1('0x3b')](handleEntityNotFound(_0x28025c,null))[_0x4ec1('0x3b')](removeEntity(_0x28025c,null))[_0x4ec1('0x3f')](handleError(_0x28025c,null));}; \ No newline at end of file +var _0x28ba=['params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','status','error','name','send','WhatsappApplication','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','fields','length','includeAll','include','options','find','catch','create','body','update'];(function(_0x1f1a63,_0x3b5924){var _0x21492a=function(_0x56c789){while(--_0x56c789){_0x1f1a63['push'](_0x1f1a63['shift']());}};_0x21492a(++_0x3b5924);}(_0x28ba,0x115));var _0xa28b=function(_0x4a7e1a,_0x3eb44d){_0x4a7e1a=_0x4a7e1a-0x0;var _0x4cd5bc=_0x28ba[_0x4a7e1a];return _0x4cd5bc;};'use strict';var pdf=require(_0xa28b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa28b('0x1'));var zipdir=require(_0xa28b('0x2'));var jsonpatch=require(_0xa28b('0x3'));var rp=require(_0xa28b('0x4'));var moment=require('moment');var BPromise=require(_0xa28b('0x5'));var Mustache=require(_0xa28b('0x6'));var util=require(_0xa28b('0x7'));var path=require(_0xa28b('0x8'));var sox=require(_0xa28b('0x9'));var csv=require('to-csv');var ejs=require(_0xa28b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa28b('0xb'));var crypto=require(_0xa28b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa28b('0xd'));var Redis=require(_0xa28b('0xe'));var authService=require(_0xa28b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa28b('0x10'))(_0xa28b('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa28b('0x12'))['db'];function respondWithStatusCode(_0x52bd43,_0x3e5712){_0x3e5712=_0x3e5712||0xcc;return function(_0x1d8cd0){if(_0x1d8cd0){return _0x52bd43[_0xa28b('0x13')](_0x3e5712);}return _0x52bd43['status'](_0x3e5712)[_0xa28b('0x14')]();};}function respondWithResult(_0x4a4478,_0x82b166){_0x82b166=_0x82b166||0xc8;return function(_0x366203){if(_0x366203){return _0x4a4478['status'](_0x82b166)[_0xa28b('0x15')](_0x366203);}};}function respondWithFilteredResult(_0x27b633,_0x394417){return function(_0x158f2e){if(_0x158f2e){var _0x383a2e=_0x158f2e[_0xa28b('0x16')],_0x538623=_0x394417[_0xa28b('0x17')],_0x300ba8=_0x394417[_0xa28b('0x17')]+_0x394417[_0xa28b('0x18')],_0xe90663;if(_0x300ba8>=_0x383a2e){_0x300ba8=_0x383a2e;_0xe90663=0xc8;}else{_0xe90663=0xce;}_0x27b633['status'](_0xe90663);return _0x27b633[_0xa28b('0x19')](_0xa28b('0x1a'),_0x538623+'-'+_0x300ba8+'/'+_0x383a2e)[_0xa28b('0x15')](_0x158f2e);}return null;};}function patchUpdates(_0x2666ee){return function(_0x407969){try{jsonpatch[_0xa28b('0x1b')](_0x407969,_0x2666ee,!![]);}catch(_0x5f0a9a){return BPromise[_0xa28b('0x1c')](_0x5f0a9a);}return _0x407969['save']();};}function saveUpdates(_0x36b189,_0x17885c){return function(_0x259779){if(_0x259779){return _0x259779['update'](_0x36b189)[_0xa28b('0x1d')](function(_0x9ff1f){return _0x9ff1f;});}return null;};}function removeEntity(_0x3de9e3,_0x1ecc94){return function(_0x38cb0c){if(_0x38cb0c){return _0x38cb0c[_0xa28b('0x1e')]()[_0xa28b('0x1d')](function(){_0x3de9e3[_0xa28b('0x1f')](0xcc)[_0xa28b('0x14')]();});}};}function handleEntityNotFound(_0x167a7c,_0x7c711d){return function(_0x16e122){if(!_0x16e122){_0x167a7c[_0xa28b('0x13')](0x194);}return _0x16e122;};}function handleError(_0x5a8053,_0x6b3251){_0x6b3251=_0x6b3251||0x1f4;return function(_0x42bacb){logger[_0xa28b('0x20')](_0x42bacb['stack']);if(_0x42bacb[_0xa28b('0x21')]){delete _0x42bacb[_0xa28b('0x21')];}_0x5a8053['status'](_0x6b3251)[_0xa28b('0x22')](_0x42bacb);};}exports['index']=function(_0x420b8a,_0x40d58c){var _0xd54d1d={},_0x222e96={},_0x353b23={'count':0x0,'rows':[]};var _0x365c5e=_['map'](db[_0xa28b('0x23')][_0xa28b('0x24')],function(_0x3e655b){return{'name':_0x3e655b[_0xa28b('0x25')],'type':_0x3e655b['type'][_0xa28b('0x26')]};});_0x222e96[_0xa28b('0x27')]=_[_0xa28b('0x28')](_0x365c5e,_0xa28b('0x21'));_0x222e96[_0xa28b('0x29')]=_[_0xa28b('0x2a')](_0x420b8a['query']);_0x222e96[_0xa28b('0x2b')]=_[_0xa28b('0x2c')](_0x222e96[_0xa28b('0x27')],_0x222e96[_0xa28b('0x29')]);_0xd54d1d[_0xa28b('0x2d')]=_[_0xa28b('0x2c')](_0x222e96[_0xa28b('0x27')],qs['fields'](_0x420b8a[_0xa28b('0x29')]['fields']));_0xd54d1d[_0xa28b('0x2d')]=_0xd54d1d[_0xa28b('0x2d')]['length']?_0xd54d1d[_0xa28b('0x2d')]:_0x222e96[_0xa28b('0x27')];if(!_0x420b8a['query'][_0xa28b('0x2e')](_0xa28b('0x2f'))){_0xd54d1d[_0xa28b('0x18')]=qs[_0xa28b('0x18')](_0x420b8a[_0xa28b('0x29')][_0xa28b('0x18')]);_0xd54d1d[_0xa28b('0x17')]=qs[_0xa28b('0x17')](_0x420b8a['query'][_0xa28b('0x17')]);}_0xd54d1d[_0xa28b('0x30')]=qs[_0xa28b('0x31')](_0x420b8a['query'][_0xa28b('0x31')]);_0xd54d1d[_0xa28b('0x32')]=qs[_0xa28b('0x2b')](_[_0xa28b('0x33')](_0x420b8a[_0xa28b('0x29')],_0x222e96['filters']),_0x365c5e);if(_0x420b8a['query'][_0xa28b('0x34')]){_0xd54d1d['where']=_[_0xa28b('0x35')](_0xd54d1d[_0xa28b('0x32')],{'$or':_[_0xa28b('0x28')](_0x365c5e,function(_0x320838){if(_0x320838[_0xa28b('0x36')]!==_0xa28b('0x37')){var _0x5e15e7={};_0x5e15e7[_0x320838[_0xa28b('0x21')]]={'$like':'%'+_0x420b8a[_0xa28b('0x29')][_0xa28b('0x34')]+'%'};return _0x5e15e7;}})});}_0xd54d1d=_[_0xa28b('0x35')]({},_0xd54d1d,_0x420b8a['options']);var _0xa81675={'where':_0xd54d1d[_0xa28b('0x32')]};return db[_0xa28b('0x23')][_0xa28b('0x16')](_0xa81675)[_0xa28b('0x1d')](function(_0x3bb94b){_0x353b23['count']=_0x3bb94b;if(_0x420b8a[_0xa28b('0x29')]['includeAll']){_0xd54d1d['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xa28b('0x38')](_0xd54d1d);})['then'](function(_0x38242a){_0x353b23[_0xa28b('0x39')]=_0x38242a;return _0x353b23;})['then'](respondWithFilteredResult(_0x40d58c,_0xd54d1d))['catch'](handleError(_0x40d58c,null));};exports['show']=function(_0x2877d,_0x41042d){var _0x1d9183={'raw':!![],'where':{'id':_0x2877d['params']['id']}},_0x377c7d={};_0x377c7d[_0xa28b('0x27')]=_[_0xa28b('0x2a')](db['WhatsappApplication'][_0xa28b('0x24')]);_0x377c7d['query']=_[_0xa28b('0x2a')](_0x2877d['query']);_0x377c7d[_0xa28b('0x2b')]=_[_0xa28b('0x2c')](_0x377c7d[_0xa28b('0x27')],_0x377c7d['query']);_0x1d9183[_0xa28b('0x2d')]=_[_0xa28b('0x2c')](_0x377c7d[_0xa28b('0x27')],qs[_0xa28b('0x3a')](_0x2877d[_0xa28b('0x29')][_0xa28b('0x3a')]));_0x1d9183[_0xa28b('0x2d')]=_0x1d9183['attributes'][_0xa28b('0x3b')]?_0x1d9183[_0xa28b('0x2d')]:_0x377c7d[_0xa28b('0x27')];if(_0x2877d[_0xa28b('0x29')][_0xa28b('0x3c')]){_0x1d9183[_0xa28b('0x3d')]=[{'all':!![]}];}_0x1d9183=_[_0xa28b('0x35')]({},_0x1d9183,_0x2877d[_0xa28b('0x3e')]);return db[_0xa28b('0x23')][_0xa28b('0x3f')](_0x1d9183)[_0xa28b('0x1d')](handleEntityNotFound(_0x41042d,null))['then'](respondWithResult(_0x41042d,null))[_0xa28b('0x40')](handleError(_0x41042d,null));};exports[_0xa28b('0x41')]=function(_0x46593a,_0x4bae94){return db[_0xa28b('0x23')][_0xa28b('0x41')](_0x46593a[_0xa28b('0x42')],{})[_0xa28b('0x1d')](respondWithResult(_0x4bae94,0xc9))[_0xa28b('0x40')](handleError(_0x4bae94,null));};exports[_0xa28b('0x43')]=function(_0x311fd9,_0x2f2ab7){if(_0x311fd9[_0xa28b('0x42')]['id']){delete _0x311fd9[_0xa28b('0x42')]['id'];}return db[_0xa28b('0x23')][_0xa28b('0x3f')]({'where':{'id':_0x311fd9[_0xa28b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f2ab7,null))['then'](saveUpdates(_0x311fd9[_0xa28b('0x42')],null))[_0xa28b('0x1d')](respondWithResult(_0x2f2ab7,null))[_0xa28b('0x40')](handleError(_0x2f2ab7,null));};exports[_0xa28b('0x1e')]=function(_0x300c3f,_0x5417e3){return db[_0xa28b('0x23')][_0xa28b('0x3f')]({'where':{'id':_0x300c3f['params']['id']}})[_0xa28b('0x1d')](handleEntityNotFound(_0x5417e3,null))[_0xa28b('0x1d')](removeEntity(_0x5417e3,null))[_0xa28b('0x40')](handleError(_0x5417e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 00c4ff6..e28ad8f 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 _0x7270=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x7270,0x1a3));var _0x0727=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x7270[_0x5f50b5];return _0x54c383;};'use strict';var _=require('lodash');var util=require(_0x0727('0x0'));var logger=require(_0x0727('0x1'))(_0x0727('0x2'));var moment=require(_0x0727('0x3'));var BPromise=require(_0x0727('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0727('0x5'));var rimraf=require(_0x0727('0x6'));var config=require(_0x0727('0x7'));var attributes=require(_0x0727('0x8'));module[_0x0727('0x9')]=function(_0x2a52cb,_0x2e1c61){return _0x2a52cb[_0x0727('0xa')](_0x0727('0xb'),attributes,{'tableName':_0x0727('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0727('0xd'),'collate':_0x0727('0xe')});}; \ No newline at end of file +var _0xb914=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','./whatsappApplication.attributes'];(function(_0xa887ad,_0x556244){var _0x100667=function(_0x3cedd1){while(--_0x3cedd1){_0xa887ad['push'](_0xa887ad['shift']());}};_0x100667(++_0x556244);}(_0xb914,0xa0));var _0x4b91=function(_0x397dab,_0x20ded8){_0x397dab=_0x397dab-0x0;var _0x3a61aa=_0xb914[_0x397dab];return _0x3a61aa;};'use strict';var _=require(_0x4b91('0x0'));var util=require(_0x4b91('0x1'));var logger=require('../../config/logger')(_0x4b91('0x2'));var moment=require(_0x4b91('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b91('0x4'));var fs=require('fs');var path=require(_0x4b91('0x5'));var rimraf=require(_0x4b91('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b91('0x7'));module[_0x4b91('0x8')]=function(_0x7c5c9c,_0x57d041){return _0x7c5c9c[_0x4b91('0x9')](_0x4b91('0xa'),attributes,{'tableName':_0x4b91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b91('0xc'),'collate':_0x4b91('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f9b1768..0fabadd 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 _0xb934=['request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x330e98,_0x4ff61a){var _0x43baf7=function(_0x27d7cd){while(--_0x27d7cd){_0x330e98['push'](_0x330e98['shift']());}};_0x43baf7(++_0x4ff61a);}(_0xb934,0x92));var _0x4b93=function(_0x221d3f,_0x10d0be){_0x221d3f=_0x221d3f-0x0;var _0x3aa19f=_0xb934[_0x221d3f];return _0x3aa19f;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var moment=require(_0x4b93('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b93('0x3'));var fs=require('fs');var Redis=require(_0x4b93('0x4'));var db=require(_0x4b93('0x5'))['db'];var utils=require(_0x4b93('0x6'));var logger=require(_0x4b93('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b93('0x8'));var client=jayson[_0x4b93('0x9')][_0x4b93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x403554,_0x47ceac,_0x3ee934){return new BPromise(function(_0x20d624,_0x36cdc8){return client[_0x4b93('0xb')](_0x403554,_0x3ee934)[_0x4b93('0xc')](function(_0x40bf7d){logger[_0x4b93('0xd')](_0x4b93('0xe'),_0x47ceac,_0x4b93('0xf'));logger['debug'](_0x4b93('0x10'),_0x47ceac,_0x4b93('0xf'),JSON[_0x4b93('0x11')](_0x40bf7d));if(_0x40bf7d[_0x4b93('0x12')]){if(_0x40bf7d[_0x4b93('0x12')][_0x4b93('0x13')]===0x1f4){logger[_0x4b93('0x12')](_0x4b93('0xe'),_0x47ceac,_0x40bf7d[_0x4b93('0x12')][_0x4b93('0x14')]);return _0x36cdc8(_0x40bf7d[_0x4b93('0x12')][_0x4b93('0x14')]);}logger[_0x4b93('0x12')](_0x4b93('0xe'),_0x47ceac,_0x40bf7d[_0x4b93('0x12')]['message']);return _0x20d624(_0x40bf7d[_0x4b93('0x12')][_0x4b93('0x14')]);}else{logger[_0x4b93('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x47ceac,_0x4b93('0xf'));_0x20d624(_0x40bf7d[_0x4b93('0x15')][_0x4b93('0x14')]);}})[_0x4b93('0x16')](function(_0x183fb3){logger['error'](_0x4b93('0xe'),_0x47ceac,_0x183fb3);_0x36cdc8(_0x183fb3);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5cf4a4,_0xbb03a1){var _0x3dcc02=function(_0x528905){while(--_0x528905){_0x5cf4a4['push'](_0x5cf4a4['shift']());}};_0x3dcc02(++_0xbb03a1);}(_0x31f0,0xb7));var _0x031f=function(_0x31a8f5,_0xce8610){_0x31a8f5=_0x31a8f5-0x0;var _0x50ecb1=_0x31f0[_0x31a8f5];return _0x50ecb1;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1ac0672..2e878c3 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 _0x60d6=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp','put','tracked','whatsappinteraction:update','update'];(function(_0x4bbaba,_0x15097c){var _0x34ff2b=function(_0x190d49){while(--_0x190d49){_0x4bbaba['push'](_0x4bbaba['shift']());}};_0x34ff2b(++_0x15097c);}(_0x60d6,0x1a7));var _0x660d=function(_0x387ff7,_0x44a39d){_0x387ff7=_0x387ff7-0x0;var _0x15439e=_0x60d6[_0x387ff7];return _0x15439e;};'use strict';var multer=require('multer');var util=require(_0x660d('0x0'));var path=require('path');var timeout=require(_0x660d('0x1'));var express=require(_0x660d('0x2'));var router=express[_0x660d('0x3')]();var auth=require(_0x660d('0x4'));var interaction=require(_0x660d('0x5'));var config=require(_0x660d('0x6'));var controller=require(_0x660d('0x7'));router[_0x660d('0x8')]('/',auth[_0x660d('0x9')](),controller[_0x660d('0xa')]);router[_0x660d('0x8')](_0x660d('0xb'),auth[_0x660d('0x9')](),controller['describe']);router[_0x660d('0x8')](_0x660d('0xc'),auth[_0x660d('0x9')](),controller['show']);router[_0x660d('0x8')]('/:id/messages',auth[_0x660d('0x9')](),controller[_0x660d('0xd')]);router[_0x660d('0x8')]('/:id/download',auth[_0x660d('0x9')](),controller[_0x660d('0xe')]);router[_0x660d('0xf')]('/',auth[_0x660d('0x9')](),controller[_0x660d('0x10')]);router[_0x660d('0xf')](_0x660d('0x11'),auth[_0x660d('0x9')](),controller[_0x660d('0x12')]);router[_0x660d('0xf')](_0x660d('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x660d('0x14'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x660d('0x15')](_0x660d('0xc'),auth[_0x660d('0x9')](),interaction[_0x660d('0x16')](_0x660d('0x14'),_0x660d('0x17')),controller[_0x660d('0x18')]);router[_0x660d('0x19')](_0x660d('0xc'),auth[_0x660d('0x9')](),interaction[_0x660d('0x16')](_0x660d('0x14'),'whatsappinteraction:destroy'),controller[_0x660d('0x1a')]);router[_0x660d('0x19')](_0x660d('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x660d('0x1b')]=router; \ No newline at end of file +var _0x4cb6=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','multer'];(function(_0x241846,_0x17d261){var _0xa940de=function(_0xc68639){while(--_0xc68639){_0x241846['push'](_0x241846['shift']());}};_0xa940de(++_0x17d261);}(_0x4cb6,0xb3));var _0x64cb=function(_0x55f112,_0x51dd9e){_0x55f112=_0x55f112-0x0;var _0x183f62=_0x4cb6[_0x55f112];return _0x183f62;};'use strict';var multer=require(_0x64cb('0x0'));var util=require(_0x64cb('0x1'));var path=require('path');var timeout=require(_0x64cb('0x2'));var express=require(_0x64cb('0x3'));var router=express[_0x64cb('0x4')]();var auth=require(_0x64cb('0x5'));var interaction=require(_0x64cb('0x6'));var config=require(_0x64cb('0x7'));var controller=require(_0x64cb('0x8'));router[_0x64cb('0x9')]('/',auth[_0x64cb('0xa')](),controller[_0x64cb('0xb')]);router[_0x64cb('0x9')](_0x64cb('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x64cb('0x9')](_0x64cb('0xd'),auth[_0x64cb('0xa')](),controller[_0x64cb('0xe')]);router[_0x64cb('0x9')](_0x64cb('0xf'),auth[_0x64cb('0xa')](),controller[_0x64cb('0x10')]);router[_0x64cb('0x9')]('/:id/download',auth[_0x64cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x64cb('0x11')](_0x64cb('0xf'),auth['isAuthenticated'](),controller[_0x64cb('0x12')]);router[_0x64cb('0x11')](_0x64cb('0x13'),auth[_0x64cb('0xa')](),interaction[_0x64cb('0x14')](_0x64cb('0x15'),_0x64cb('0x16')),controller[_0x64cb('0x17')]);router[_0x64cb('0x18')](_0x64cb('0xd'),auth[_0x64cb('0xa')](),interaction[_0x64cb('0x14')](_0x64cb('0x15'),_0x64cb('0x19')),controller['update']);router[_0x64cb('0x1a')](_0x64cb('0xd'),auth[_0x64cb('0xa')](),interaction[_0x64cb('0x14')](_0x64cb('0x15'),_0x64cb('0x1b')),controller[_0x64cb('0x1c')]);router[_0x64cb('0x1a')](_0x64cb('0x13'),auth[_0x64cb('0xa')](),controller[_0x64cb('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d1f4828..a8f9c33 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 _0xdb2b=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x35f313,_0x406d0f){var _0x253b1a=function(_0x1433c9){while(--_0x1433c9){_0x35f313['push'](_0x35f313['shift']());}};_0x253b1a(++_0x406d0f);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x5bccbf,_0x547e42){_0x5bccbf=_0x5bccbf-0x0;var _0x2158c6=_0xdb2b[_0x5bccbf];return _0x2158c6;};'use strict';var Sequelize=require(_0xbdb2('0x0'));var moment=require('moment');module[_0xbdb2('0x1')]={'closed':{'type':Sequelize[_0xbdb2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbdb2('0x3')]},'disposition':{'type':Sequelize[_0xbdb2('0x4')]},'secondDisposition':{'type':Sequelize[_0xbdb2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbdb2('0x4')]},'note':{'type':Sequelize[_0xbdb2('0x4')]},'phone':{'type':Sequelize[_0xbdb2('0x4')]},'read1stAt':{'type':Sequelize[_0xbdb2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbdb2('0x5')]('in',_0xbdb2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdb2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa953=['sequelize','moment','exports','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x10d270,_0x4c2599){var _0x3ee5de=function(_0x19975b){while(--_0x19975b){_0x10d270['push'](_0x10d270['shift']());}};_0x3ee5de(++_0x4c2599);}(_0xa953,0x1d0));var _0x3a95=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0xa953[_0x231a42];return _0x3c2a56;};'use strict';var Sequelize=require(_0x3a95('0x0'));var moment=require(_0x3a95('0x1'));module[_0x3a95('0x2')]={'closed':{'type':Sequelize[_0x3a95('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3a95('0x4')]},'secondDisposition':{'type':Sequelize[_0x3a95('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3a95('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3a95('0x5')]('in',_0x3a95('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3a95('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x3a95('0x5')]('in',_0x3a95('0x6')),'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 3231be9..9b1c2c1 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 _0xd7d1=['register','sendStatus','end','status','json','count','offset','limit','set','reject','update','then','error','name','fullname','TagIds','Tags','split','forEach','catch','index','map','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','field','color','from','tools_tags','select','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','start','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','compact','WhatsappAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','params','rawAttributes','intersection','include','options','create','destroy','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','ids','spread','findAll','emit','whatsappInteractionTags:save','root','server','files','tmp','join','transcript-%d-%s.zip','push','CmContact','firstName','lastName','attachments','Attachment','direction','secret','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\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','YYYY-MM-DD','Whatsapp','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter'];(function(_0x2b13ad,_0x1f9288){var _0x1524fe=function(_0x3b0837){while(--_0x3b0837){_0x2b13ad['push'](_0x2b13ad['shift']());}};_0x1524fe(++_0x1f9288);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1451c5,_0x2c184a){_0x1451c5=_0x1451c5-0x0;var _0x4d0917=_0xd7d1[_0x1451c5];return _0x4d0917;};'use strict';var pdf=require(_0x1d7d('0x0'));var emlformat=require(_0x1d7d('0x1'));var rimraf=require(_0x1d7d('0x2'));var zipdir=require(_0x1d7d('0x3'));var jsonpatch=require(_0x1d7d('0x4'));var rp=require(_0x1d7d('0x5'));var moment=require(_0x1d7d('0x6'));var BPromise=require(_0x1d7d('0x7'));var Mustache=require(_0x1d7d('0x8'));var util=require(_0x1d7d('0x9'));var path=require(_0x1d7d('0xa'));var sox=require(_0x1d7d('0xb'));var csv=require(_0x1d7d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xc'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x1d7d('0x1c')]=_['defaults'](config['redis'],{'host':_0x1d7d('0x1d'),'port':0x18eb});var socket=require(_0x1d7d('0x1e'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x1d7d('0x1f')](socket);function respondWithStatusCode(_0x334e78,_0xe10fdd){_0xe10fdd=_0xe10fdd||0xcc;return function(_0x183fc6){if(_0x183fc6){return _0x334e78[_0x1d7d('0x20')](_0xe10fdd);}return _0x334e78['status'](_0xe10fdd)[_0x1d7d('0x21')]();};}function respondWithResult(_0x1de6cc,_0x51cbca){_0x51cbca=_0x51cbca||0xc8;return function(_0xb90a8c){if(_0xb90a8c){return _0x1de6cc[_0x1d7d('0x22')](_0x51cbca)[_0x1d7d('0x23')](_0xb90a8c);}};}function respondWithFilteredResult(_0x47826a,_0x40db4d){return function(_0x4db4f2){if(_0x4db4f2){var _0x664e3f=_0x4db4f2[_0x1d7d('0x24')],_0x191024=_0x40db4d[_0x1d7d('0x25')],_0x5cbb8f=_0x40db4d[_0x1d7d('0x25')]+_0x40db4d[_0x1d7d('0x26')],_0x495212;if(_0x5cbb8f>=_0x664e3f){_0x5cbb8f=_0x664e3f;_0x495212=0xc8;}else{_0x495212=0xce;}_0x47826a[_0x1d7d('0x22')](_0x495212);return _0x47826a[_0x1d7d('0x27')]('Content-Range',_0x191024+'-'+_0x5cbb8f+'/'+_0x664e3f)[_0x1d7d('0x23')](_0x4db4f2);}return null;};}function patchUpdates(_0x40c27f){return function(_0x3a93d0){try{jsonpatch['apply'](_0x3a93d0,_0x40c27f,!![]);}catch(_0x29caf4){return BPromise[_0x1d7d('0x28')](_0x29caf4);}return _0x3a93d0['save']();};}function saveUpdates(_0x5950bd,_0x1dcaf2){return function(_0x264a4e){if(_0x264a4e){return _0x264a4e[_0x1d7d('0x29')](_0x5950bd)['then'](function(_0x377653){return _0x377653;});}return null;};}function removeEntity(_0x106376,_0x2d4c0c){return function(_0x21e59){if(_0x21e59){return _0x21e59['destroy']()[_0x1d7d('0x2a')](function(){_0x106376[_0x1d7d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57bbd8,_0x301e5c){return function(_0x52c618){if(!_0x52c618){_0x57bbd8[_0x1d7d('0x20')](0x194);}return _0x52c618;};}function handleError(_0x2d4de4,_0x3bc6e8){_0x3bc6e8=_0x3bc6e8||0x1f4;return function(_0x22c40d){logger[_0x1d7d('0x2b')](_0x22c40d['stack']);if(_0x22c40d[_0x1d7d('0x2c')]){delete _0x22c40d[_0x1d7d('0x2c')];}_0x2d4de4[_0x1d7d('0x22')](_0x3bc6e8)['send'](_0x22c40d);};}function getInteractionUsers(_0x78adbe,_0x1a935a){return new BPromise(function(_0x23ad85,_0x482367){try{if(_0x1a935a[_0x78adbe['id']]){_0x78adbe['Users']=_['map'](_0x1a935a[_0x78adbe['id']],function(_0x189a6a){return{'id':_0x189a6a['id'],'fullname':_0x189a6a[_0x1d7d('0x2d')]};});}}catch(_0x559f19){_0x482367(_0x559f19);}_0x23ad85(_0x78adbe);});}function getInteractionTags(_0x1ebcbc,_0x3e4136){return new BPromise(function(_0x16a81d,_0x3336ab){try{if(_0x1ebcbc[_0x1d7d('0x2e')]){_0x1ebcbc[_0x1d7d('0x2f')]=[];_0x1ebcbc[_0x1d7d('0x2e')][_0x1d7d('0x30')](',')[_0x1d7d('0x31')](function(_0x456b56){_0x1ebcbc['Tags']['push'](_0x3e4136[_0x456b56]);});}delete _0x1ebcbc[_0x1d7d('0x2e')];}catch(_0x2266a6){_0x3336ab(_0x2266a6);}_0x16a81d(_0x1ebcbc);});}function updateWhatsappInteraction(_0x90e852,_0x40318f,_0x1d5dc5){return new BPromise(function(_0x16d652,_0x1aee3c){return getInteractionUsers(_0x90e852,_0x1d5dc5)[_0x1d7d('0x2a')](function(_0x2fa3f4){return getInteractionTags(_0x2fa3f4,_0x40318f);})['then'](function(_0x2ac533){_0x16d652(_0x2ac533);})[_0x1d7d('0x32')](function(_0x13a974){_0x1aee3c(_0x13a974);});});}exports[_0x1d7d('0x33')]=function(_0x4cc364,_0x4ee17f){var _0x472fd9={},_0x198a06={},_0x520b56={'count':0x0,'rows':[]};var _0x103c77=_[_0x1d7d('0x34')](db['WhatsappInteraction']['rawAttributes'],function(_0x26f81c){return{'name':_0x26f81c[_0x1d7d('0x35')],'type':_0x26f81c[_0x1d7d('0x36')][_0x1d7d('0x37')]};});_0x198a06[_0x1d7d('0x38')]=_[_0x1d7d('0x34')](_0x103c77,_0x1d7d('0x2c'));_0x198a06[_0x1d7d('0x39')]=_[_0x1d7d('0x3a')](_0x4cc364[_0x1d7d('0x39')]);_0x198a06['filters']=_['intersection'](_0x198a06['model'],_0x198a06['query']);_0x472fd9[_0x1d7d('0x3b')]=_['intersection'](_0x198a06[_0x1d7d('0x38')],qs[_0x1d7d('0x3c')](_0x4cc364[_0x1d7d('0x39')]['fields']));_0x472fd9[_0x1d7d('0x3b')]=_0x472fd9[_0x1d7d('0x3b')][_0x1d7d('0x3d')]?_0x472fd9['attributes']:_0x198a06[_0x1d7d('0x38')];if(!_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x3e')](_0x1d7d('0x3f'))){_0x472fd9['limit']=qs[_0x1d7d('0x26')](_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x26')]);_0x472fd9[_0x1d7d('0x25')]=qs['offset'](_0x4cc364[_0x1d7d('0x39')]['offset']);}_0x472fd9[_0x1d7d('0x40')]=qs[_0x1d7d('0x41')](_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x41')]);_0x472fd9[_0x1d7d('0x42')]=qs['filters'](_['pick'](_0x4cc364[_0x1d7d('0x39')],_0x198a06[_0x1d7d('0x43')]),_0x103c77);var _0x1637fc=[];var _0x4bed84=squel['select']()[_0x1d7d('0x44')]('id')['field'](_0x1d7d('0x2c'))[_0x1d7d('0x44')](_0x1d7d('0x45'))[_0x1d7d('0x46')](_0x1d7d('0x47'));var _0x370e8d=squel[_0x1d7d('0x48')]()['field'](_0x1d7d('0x49'))[_0x1d7d('0x44')]('u.fullname')[_0x1d7d('0x44')](_0x1d7d('0x4a'))[_0x1d7d('0x46')](_0x1d7d('0x4b'),'ui')[_0x1d7d('0x4c')](_0x1d7d('0x4d'),'u',_0x1d7d('0x4e'));var _0x1f7066=squel[_0x1d7d('0x48')]()[_0x1d7d('0x46')](_0x1d7d('0x4f'),'i')[_0x1d7d('0x4c')]('cm_contacts','c',_0x1d7d('0x50'))['left_join'](_0x1d7d('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x1d7d('0x4c')](_0x1d7d('0x51'),'a',_0x1d7d('0x52'))[_0x1d7d('0x4c')]('whatsapp_messages','me',_0x1d7d('0x53'))['left_join']('whatsapp_interaction_has_tags','it',_0x1d7d('0x54'))['left_join']('tools_tags','t',_0x1d7d('0x55'));var _0xf9b677=squel['expr']();var _0x101abf=[];var _0x1383f9=squel['expr']();var _0x1f3a63;if(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x56')]){_0x1f3a63=as[_0x1d7d('0x57')](_0x4cc364['query']['search']);var _0x3f73eb=_0x1f3a63[_0x1d7d('0x58')];for(var _0x35ff5d=0x0;_0x35ff5d<_0x1f3a63[_0x1d7d('0x59')][_0x1d7d('0x3d')];_0x35ff5d++){var _0x550c9f=_0x1f3a63[_0x1d7d('0x59')][_0x35ff5d];var _0x24e0b7='i';var _0x344b66=_[_0x1d7d('0x5a')](_0x103c77,[_0x1d7d('0x2c'),_0x550c9f[_0x1d7d('0x44')]]);if(!_0x344b66){switch(_0x550c9f[_0x1d7d('0x44')]){case _0x1d7d('0x5b'):if(_0x550c9f[_0x1d7d('0x5c')]==0x1){_0x1f7066['having']('`'+_0x550c9f[_0x1d7d('0x44')]+_0x1d7d('0x5d'));}else{_0x1f7066[_0x1d7d('0x5e')]('`'+_0x550c9f['field']+'`\x20>\x200');}break;case _0x1d7d('0x5f'):if(_0x550c9f[_0x1d7d('0x60')]===_0x1d7d('0x61')){if(_0x550c9f['value'][_0x1d7d('0x30')]('\x20')[_0x1d7d('0x3d')]>0x1){_0xf9b677[_0x3f73eb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1d7d('0x62')](_0x550c9f[_0x1d7d('0x5c')]),null);}else{var _0x3fc216='%'+_0x550c9f[_0x1d7d('0x5c')]+'%';_0xf9b677[_0x3f73eb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3fc216,_0x3fc216,_0x3fc216);}}else{_0x344b66=_[_0x1d7d('0x5a')](_0x103c77,[_0x1d7d('0x2c'),'ContactId']);_0x550c9f['field']=_0x1d7d('0x63');_0x7877e1=as[_0x1d7d('0x64')](_0x24e0b7,_0x344b66['type'],_0x550c9f);_0xf9b677[_0x3f73eb](_0x7877e1['text'],_0x7877e1[_0x1d7d('0x5c')][_0x1d7d('0x65')],_0x7877e1[_0x1d7d('0x5c')][_0x1d7d('0x21')]);}break;case'Tag':var _0x311ec2=_0x550c9f['value'][_0x1d7d('0x30')](',')[_0x1d7d('0x34')](function(_0x14078d){return Number(_0x14078d);});_0x311ec2[_0x1d7d('0x31')](function(_0x5a4bd7){_0x1383f9['or'](_0x1d7d('0x66'),'%,'+_0x5a4bd7+',%');});_0x101abf=_[_0x1d7d('0x67')](_0x101abf,_0x311ec2);break;case _0x1d7d('0x68'):if(_0x550c9f[_0x1d7d('0x60')]===_0x1d7d('0x61')){_0xf9b677[_0x3f73eb](_0x1d7d('0x69'),'%'+_0x550c9f[_0x1d7d('0x5c')]+'%',null);}else{_0x344b66=_[_0x1d7d('0x5a')](_0x103c77,[_0x1d7d('0x2c'),_0x1d7d('0x6a')]);_0x550c9f[_0x1d7d('0x44')]=_0x1d7d('0x6a');_0x7877e1=as[_0x1d7d('0x64')](_0x24e0b7,_0x344b66[_0x1d7d('0x36')],_0x550c9f);_0xf9b677[_0x3f73eb](_0x7877e1[_0x1d7d('0x6b')],_0x7877e1['value'][_0x1d7d('0x65')],_0x7877e1['value'][_0x1d7d('0x21')]);}break;case _0x1d7d('0x6c'):_0x7877e1=as[_0x1d7d('0x64')]('me',null,_0x550c9f);_0xf9b677[_0x3f73eb](_0x7877e1[_0x1d7d('0x6b')],_0x7877e1[_0x1d7d('0x5c')][_0x1d7d('0x65')],_0x7877e1['value'][_0x1d7d('0x21')]);break;}}else{var _0x7877e1=as['buildExpression'](_0x24e0b7,_0x344b66[_0x1d7d('0x36')],_0x550c9f);_0xf9b677[_0x3f73eb](_0x7877e1['text'],_0x7877e1[_0x1d7d('0x5c')][_0x1d7d('0x65')],_0x7877e1[_0x1d7d('0x5c')][_0x1d7d('0x21')]);}}}else{var _0x95ae40=_(_0x4cc364[_0x1d7d('0x39')])['keys']()[_0x1d7d('0x34')](function(_0x35a44b){return _['some'](_0x103c77,[_0x1d7d('0x2c'),_0x35a44b])?_0x35a44b:undefined;})[_0x1d7d('0x6d')]()[_0x1d7d('0x5c')]();if(!_['isEmpty'](_0x95ae40)){_0x95ae40[_0x1d7d('0x31')](function(_0xe5c3ba){if(_0xe5c3ba===_0x1d7d('0x6e')){_0x1f7066[_0x1d7d('0x42')]('i.WhatsappAccountId\x20IN\x20?',[][_0x1d7d('0x6f')](_0x4cc364[_0x1d7d('0x39')][_0xe5c3ba]));}else if(_0xe5c3ba===_0x1d7d('0x70')){var _0x18dac4=JSON[_0x1d7d('0x71')](_0x4cc364['query'][_0xe5c3ba])[_0x1d7d('0x72')];var _0x10dea3=JSON['parse'](_0x4cc364[_0x1d7d('0x39')][_0xe5c3ba])[_0x1d7d('0x73')];_0x1f7066[_0x1d7d('0x42')](_0x1d7d('0x74'),_0x18dac4,_0x10dea3);}else{if(_0x4cc364['query'][_0xe5c3ba]===_0x1d7d('0x75')){_0x1f7066['where']('i.'+_0xe5c3ba+_0x1d7d('0x76'));}else{_0x1f7066[_0x1d7d('0x42')]('i.'+_0xe5c3ba+_0x1d7d('0x77'),_0x4cc364['query'][_0xe5c3ba]);}}});}if(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x78')]){if(_0x4cc364[_0x1d7d('0x39')]['read']==0x1){_0x1f7066[_0x1d7d('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x1f7066[_0x1d7d('0x5e')](_0x1d7d('0x79'));}}if(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x7a')]){_0x101abf=_[_0x1d7d('0x7b')](_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x7a')])?_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x7a')]:new Array(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x7a')]);_0x101abf['forEach'](function(_0x549ec0){_0x1383f9['or'](_0x1d7d('0x66'),'%,'+_0x549ec0+',%');});}if(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x7c')]){var _0x5f3406=_0x4cc364[_0x1d7d('0x39')]['filter'][_0x1d7d('0x7d')]('\x5c','\x5c\x5c')[_0x1d7d('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5f3406)){_0xf9b677['or'](_0x1d7d('0x7e'),_0x5f3406+'%')['or'](_0x1d7d('0x7f'),_0x5f3406+'%');}else{_0xf9b677['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1d7d('0x62')](_0x5f3406))['or'](_0x1d7d('0x80'),_0x5f3406+'%');}}}_0x1f7066[_0x1d7d('0x42')](_0xf9b677);_0x1f7066['group']('i.id');var _0x2f774f={'type':db[_0x1d7d('0x81')]['QueryTypes'][_0x1d7d('0x82')],'raw':!![]};var _0xf2f87d=_0x1f7066[_0x1d7d('0x83')]();_0xf2f87d[_0x1d7d('0x44')]('i.id');_0xf2f87d[_0x1d7d('0x44')](_0x1d7d('0x84'),_0x1d7d('0x5b'));if(_0x472fd9[_0x1d7d('0x40')]){_0x472fd9[_0x1d7d('0x40')][_0x1d7d('0x31')](function(_0x42a83c){var _0xa4985d=_0x42a83c[0x0]===_0x1d7d('0x85')?_0x42a83c[0x0]:'i.'+_0x42a83c[0x0];_0x1f7066[_0x1d7d('0x40')](_0xa4985d,_0x42a83c[0x1]===_0x1d7d('0x86')?![]:!![]);});}if(!_[_0x1d7d('0x87')](_0x101abf)){_0x1f7066[_0x1d7d('0x5e')](_0x1383f9);_0xf2f87d['where'](_0x1d7d('0x88'),_0x101abf);}BPromise[_0x1d7d('0x89')]()['then'](function(){if(!_0x1f3a63){if(_0x4cc364[_0x1d7d('0x39')][_0x1d7d('0x6e')])return;_0xf2f87d['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x1f7066['where'](_0x1d7d('0x8a'));return;}if(_0x4cc364[_0x1d7d('0x8b')][_0x1d7d('0x8c')]!==_0x1d7d('0x8d'))return;return _0x4cc364['user'][_0x1d7d('0x8e')]({'attributes':['id'],'raw':!![]})[_0x1d7d('0x2a')](function(_0x351807){if(_[_0x1d7d('0x87')](_0x351807)){_0xf2f87d['where'](_0x1d7d('0x8f'));_0x1f7066[_0x1d7d('0x42')](_0x1d7d('0x8f'));}else{_0xf2f87d[_0x1d7d('0x42')](_0x1d7d('0x90'),_[_0x1d7d('0x34')](_0x351807,'id'));_0x1f7066['where'](_0x1d7d('0x90'),_[_0x1d7d('0x34')](_0x351807,'id'));}});})['then'](function(){if(_0x4cc364[_0x1d7d('0x8b')][_0x1d7d('0x8c')]===_0x1d7d('0x8d')&&!_0x1f3a63&&!_0x4cc364['query'][_0x1d7d('0x6e')])return[];return db['sequelize'][_0x1d7d('0x39')](_0xf2f87d[_0x1d7d('0x91')](),_0x2f774f);})['then'](function(_0x122483){_0x520b56[_0x1d7d('0x24')]=_0x122483[_0x1d7d('0x3d')];if(_0x520b56[_0x1d7d('0x24')]===0x0)return[];return db[_0x1d7d('0x92')][_0x1d7d('0x39')](_0x4bed84[_0x1d7d('0x91')](),_0x2f774f)[_0x1d7d('0x2a')](function(_0x35eab1){_0x1637fc=_[_0x1d7d('0x93')](_0x35eab1,'id');_0x2f774f=_[_0x1d7d('0x94')](_0x2f774f,{'model':db[_0x1d7d('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cc364['query']['fields']){_0x472fd9[_0x1d7d('0x3b')][_0x1d7d('0x31')](function(_0x25ec1c){_0x1f7066[_0x1d7d('0x44')]('i.'+_0x25ec1c);});}else{_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x84'),_0x1d7d('0x5b'));_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x96'),_0x1d7d('0x97'));_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x98'),'Account.mandatoryDisposition');_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x99'),_0x1d7d('0x85'));_0x1f7066[_0x1d7d('0x44')]('i.*');_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x9a'),_0x1d7d('0x9b'));_0x1f7066[_0x1d7d('0x44')]('c.lastName','Contact.lastName');_0x1f7066['field']('c.email',_0x1d7d('0x9c'));_0x1f7066[_0x1d7d('0x44')]('c.phone','Contact.phone');_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x9d'),_0x1d7d('0x9e'));_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0x9f'),_0x1d7d('0xa0'));_0x1f7066[_0x1d7d('0x44')](_0x1d7d('0xa1'),_0x1d7d('0xa2'));_0x1f7066[_0x1d7d('0x44')]('o.internal',_0x1d7d('0xa3'));_0x1f7066['field'](_0x1d7d('0xa4'),_0x1d7d('0x2e'));}if(_0x472fd9[_0x1d7d('0x26')])_0x1f7066['limit'](_0x472fd9[_0x1d7d('0x26')]);if(_0x472fd9[_0x1d7d('0x25')])_0x1f7066[_0x1d7d('0x25')](_0x472fd9[_0x1d7d('0x25')]);return db[_0x1d7d('0x92')][_0x1d7d('0x39')](_0x1f7066[_0x1d7d('0x91')](),_0x2f774f);})[_0x1d7d('0x2a')](function(_0x421db8){_0x370e8d[_0x1d7d('0x42')](_0x1d7d('0xa5'),_[_0x1d7d('0x34')](_0x421db8,'id'));return db[_0x1d7d('0x92')][_0x1d7d('0x39')](_0x370e8d[_0x1d7d('0x91')](),_0x2f774f)[_0x1d7d('0x2a')](function(_0x134f71){var _0x2aac19=_[_0x1d7d('0xa6')](_0x134f71,_0x1d7d('0xa7'));var _0x689a17=[];_0x421db8[_0x1d7d('0x31')](function(_0xecfc39){_0x689a17['push'](updateWhatsappInteraction(_0xecfc39,_0x1637fc,_0x2aac19));});return BPromise[_0x1d7d('0xa8')](_0x689a17);});});})[_0x1d7d('0x2a')](function(_0x8e32e9){_0x520b56['rows']=_0x8e32e9;return _0x520b56;})[_0x1d7d('0x2a')](respondWithFilteredResult(_0x4ee17f,_0x472fd9))['catch'](handleError(_0x4ee17f,null));};exports['show']=function(_0x4ff12a,_0x4e94a1){var _0x93ef2d={'raw':![],'where':{'id':_0x4ff12a[_0x1d7d('0xa9')]['id']}},_0x854785={};_0x854785['model']=_[_0x1d7d('0x3a')](db['WhatsappInteraction'][_0x1d7d('0xaa')]);_0x854785[_0x1d7d('0x39')]=_[_0x1d7d('0x3a')](_0x4ff12a[_0x1d7d('0x39')]);_0x854785[_0x1d7d('0x43')]=_[_0x1d7d('0xab')](_0x854785[_0x1d7d('0x38')],_0x854785[_0x1d7d('0x39')]);_0x93ef2d[_0x1d7d('0x3b')]=_[_0x1d7d('0xab')](_0x854785[_0x1d7d('0x38')],qs['fields'](_0x4ff12a[_0x1d7d('0x39')][_0x1d7d('0x3c')]));_0x93ef2d[_0x1d7d('0x3b')]=_0x93ef2d['attributes'][_0x1d7d('0x3d')]?_0x93ef2d[_0x1d7d('0x3b')]:_0x854785[_0x1d7d('0x38')];if(_0x4ff12a['query']['includeAll']){_0x93ef2d[_0x1d7d('0xac')]=[{'all':!![]}];}_0x93ef2d=_['merge']({},_0x93ef2d,_0x4ff12a[_0x1d7d('0xad')]);return db[_0x1d7d('0x95')]['find'](_0x93ef2d)[_0x1d7d('0x2a')](handleEntityNotFound(_0x4e94a1,null))[_0x1d7d('0x2a')](respondWithResult(_0x4e94a1,null))['catch'](handleError(_0x4e94a1,null));};exports[_0x1d7d('0xae')]=function(_0xd0d1b5,_0x45b5e2){return db[_0x1d7d('0x95')]['create'](_0xd0d1b5['body'],{})[_0x1d7d('0x2a')](respondWithResult(_0x45b5e2,0xc9))[_0x1d7d('0x32')](handleError(_0x45b5e2,null));};exports[_0x1d7d('0x29')]=function(_0xb61186,_0x16337c){if(_0xb61186[_0x1d7d('0x6c')]['id']){delete _0xb61186[_0x1d7d('0x6c')]['id'];}return db[_0x1d7d('0x95')][_0x1d7d('0x5a')]({'where':{'id':_0xb61186[_0x1d7d('0xa9')]['id']}})[_0x1d7d('0x2a')](handleEntityNotFound(_0x16337c,null))[_0x1d7d('0x2a')](saveUpdates(_0xb61186[_0x1d7d('0x6c')],null))[_0x1d7d('0x2a')](respondWithResult(_0x16337c,null))[_0x1d7d('0x32')](handleError(_0x16337c,null));};exports[_0x1d7d('0xaf')]=function(_0x101068,_0x1c1ace){return db['WhatsappInteraction'][_0x1d7d('0x5a')]({'where':{'id':_0x101068[_0x1d7d('0xa9')]['id']}})[_0x1d7d('0x2a')](handleEntityNotFound(_0x1c1ace,null))[_0x1d7d('0x2a')](removeEntity(_0x1c1ace,null))['catch'](handleError(_0x1c1ace,null));};exports[_0x1d7d('0xb0')]=function(_0xc79a8b,_0x4094ff){return db[_0x1d7d('0x95')]['describe']()[_0x1d7d('0x2a')](respondWithResult(_0x4094ff,null))['catch'](handleError(_0x4094ff,null));};exports[_0x1d7d('0xb1')]=function(_0x6fa616,_0x166e45,_0x4f02a2){return db[_0x1d7d('0xb2')]['find']({'where':{'id':_0x6fa616[_0x1d7d('0xa9')]['id']}})[_0x1d7d('0x2a')](handleEntityNotFound(_0x166e45,null))[_0x1d7d('0x2a')](function(_0x466208){if(_0x466208){return _0x466208['addMessage'](_0x6fa616[_0x1d7d('0x6c')]['ids'],_[_0x1d7d('0xb3')](_0x6fa616[_0x1d7d('0x6c')],['ids','id'])||{});}})[_0x1d7d('0x2a')](respondWithResult(_0x166e45,null))[_0x1d7d('0x32')](handleError(_0x166e45,null));};exports[_0x1d7d('0xb4')]=function(_0x3d22b4,_0x4dca1d,_0x5c3420){var _0x54729b={'raw':![],'where':{}};var _0x3fa54d={};var _0x3ae715={'count':0x0,'rows':[]};return db[_0x1d7d('0x95')][_0x1d7d('0xb5')]({'where':{'id':_0x3d22b4[_0x1d7d('0xa9')]['id']}})['then'](handleEntityNotFound(_0x4dca1d,null))[_0x1d7d('0x2a')](function(_0x41874){if(_0x41874){_0x3fa54d[_0x1d7d('0x38')]=_[_0x1d7d('0x3a')](db['WhatsappMessage']['rawAttributes']);_0x3fa54d[_0x1d7d('0x39')]=_[_0x1d7d('0x3a')](_0x3d22b4[_0x1d7d('0x39')]);_0x3fa54d[_0x1d7d('0x43')]=_[_0x1d7d('0xab')](_0x3fa54d[_0x1d7d('0x38')],_0x3fa54d['query']);_0x54729b[_0x1d7d('0x3b')]=_['intersection'](_0x3fa54d[_0x1d7d('0x38')],qs[_0x1d7d('0x3c')](_0x3d22b4['query'][_0x1d7d('0x3c')]));_0x54729b['attributes']=_0x54729b[_0x1d7d('0x3b')][_0x1d7d('0x3d')]?_0x54729b[_0x1d7d('0x3b')]:_0x3fa54d[_0x1d7d('0x38')];if(!_0x3d22b4[_0x1d7d('0x39')]['hasOwnProperty'](_0x1d7d('0x3f'))){_0x54729b['limit']=qs[_0x1d7d('0x26')](_0x3d22b4['query']['limit']);_0x54729b[_0x1d7d('0x25')]=qs[_0x1d7d('0x25')](_0x3d22b4[_0x1d7d('0x39')][_0x1d7d('0x25')]);}_0x54729b[_0x1d7d('0x40')]=qs[_0x1d7d('0x41')](_0x3d22b4[_0x1d7d('0x39')][_0x1d7d('0x41')]);_0x54729b[_0x1d7d('0x42')]=qs[_0x1d7d('0x43')](_[_0x1d7d('0xb6')](_0x3d22b4[_0x1d7d('0x39')],_0x3fa54d['filters']));_0x54729b['where'][_0x1d7d('0xa7')]=_0x41874['id'];if(_0x3d22b4['query'][_0x1d7d('0x7c')]){_0x54729b['where']=_['merge'](_0x54729b[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x34')](_0x54729b[_0x1d7d('0x3b')],function(_0x34a7c5){var _0x7c1279={};_0x7c1279[_0x34a7c5]={'$like':'%'+_0x3d22b4[_0x1d7d('0x39')][_0x1d7d('0x7c')]+'%'};return _0x7c1279;})});}if(_0x3d22b4[_0x1d7d('0x39')][_0x1d7d('0x72')]){var _0x4840c3=_0x3d22b4['query'][_0x1d7d('0x72')]['split'](',');var _0x3d863b={};_0x3d863b[_0x4840c3[0x0]]={'$gte':moment(_0x4840c3[0x1])[_0x1d7d('0xb7')](_0x1d7d('0xb8'))};_0x54729b[_0x1d7d('0x42')]=_[_0x1d7d('0x94')](_0x54729b[_0x1d7d('0x42')],_0x3d863b);}_0x54729b=_[_0x1d7d('0x94')]({},_0x54729b,_0x3d22b4[_0x1d7d('0xad')]);return db[_0x1d7d('0xb2')][_0x1d7d('0x24')]({'where':_0x54729b[_0x1d7d('0x42')]})[_0x1d7d('0x2a')](function(_0x59b1fc){_0x3ae715['count']=_0x59b1fc;if(_0x3d22b4[_0x1d7d('0x39')][_0x1d7d('0xb9')]){_0x54729b[_0x1d7d('0xac')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x54729b);})[_0x1d7d('0x2a')](function(_0x470f5e){_0x3ae715['rows']=_0x470f5e;return _0x3ae715;});}})[_0x1d7d('0x2a')](respondWithFilteredResult(_0x4dca1d,_0x54729b))['catch'](handleError(_0x4dca1d,null));};exports[_0x1d7d('0xba')]=function(_0x50ec9f,_0x1f50d4,_0x2e8769){return db[_0x1d7d('0x95')][_0x1d7d('0x5a')]({'where':{'id':_0x50ec9f[_0x1d7d('0xa9')]['id']}})[_0x1d7d('0x2a')](handleEntityNotFound(_0x1f50d4,null))[_0x1d7d('0x2a')](function(_0x398188){if(_0x398188){return _0x398188['setTags'](_0x50ec9f[_0x1d7d('0x6c')][_0x1d7d('0xbb')],_[_0x1d7d('0xb3')](_0x50ec9f[_0x1d7d('0x6c')],[_0x1d7d('0xbb'),'id'])||{})[_0x1d7d('0xbc')](function(){return db['Tag'][_0x1d7d('0xbd')]({'attributes':['id','name',_0x1d7d('0x45')],'where':{'id':_0x50ec9f[_0x1d7d('0x6c')]['ids']}});})[_0x1d7d('0x2a')](function(_0x1ec4fe){socket[_0x1d7d('0xbe')](_0x1d7d('0xbf'),{'id':Number(_0x50ec9f['params']['id']),'tags':_0x1ec4fe||[]});return{'id':Number(_0x50ec9f[_0x1d7d('0xa9')]['id']),'tags':_0x1ec4fe||[]};});}})[_0x1d7d('0x2a')](respondWithResult(_0x1f50d4,null))['catch'](handleError(_0x1f50d4,null));};exports['removeTags']=function(_0x35ae9b,_0x513afd,_0x5ed799){return db['WhatsappInteraction'][_0x1d7d('0x5a')]({'where':{'id':_0x35ae9b['params']['id']}})[_0x1d7d('0x2a')](handleEntityNotFound(_0x513afd,null))[_0x1d7d('0x2a')](function(_0x4abfb1){if(_0x4abfb1){return _0x4abfb1['removeTags'](_0x35ae9b['query'][_0x1d7d('0xbb')]);}})[_0x1d7d('0x2a')](respondWithStatusCode(_0x513afd,null))[_0x1d7d('0x32')](handleError(_0x513afd,null));};exports['download']=function(_0x22334d,_0x459ef8){var _0x54616b=moment()['unix']()[_0x1d7d('0x91')]();var _0x4cf575=path['join'](config[_0x1d7d('0xc0')],_0x1d7d('0xc1'),_0x1d7d('0xc2'),_0x1d7d('0xc3'));var _0xf63e32=path[_0x1d7d('0xc4')](config[_0x1d7d('0xc0')],_0x1d7d('0xc1'),'files','attachments');var _0x283399=path[_0x1d7d('0xc4')](_0x4cf575,_0x54616b);var _0x35e7f2=util['format'](_0x1d7d('0xc5'),_0x22334d[_0x1d7d('0xa9')]['id'],_0x54616b);var _0x50fc9b=path[_0x1d7d('0xc4')](_0x4cf575,_0x35e7f2);var _0x39d67f=[];_0x39d67f[_0x1d7d('0xc6')]({'model':db['User'],'as':'User','attributes':['id',_0x1d7d('0x2d')],'raw':!![]});_0x39d67f[_0x1d7d('0xc6')]({'model':db[_0x1d7d('0xc7')],'as':_0x1d7d('0x5f'),'attributes':['id',_0x1d7d('0xc8'),_0x1d7d('0xc9')],'raw':!![]});if(_0x22334d['query'][_0x1d7d('0xca')]){_0x39d67f[_0x1d7d('0xc6')]({'model':db['Attachment'],'as':_0x1d7d('0xcb'),'raw':!![]});}var _0x4059a1=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0x1d7d('0x70'),_0x1d7d('0xcc'),_0x1d7d('0xcd'),_0x1d7d('0x78')],'include':_0x39d67f}];_0x4059a1[_0x1d7d('0xc6')]({'model':db[_0x1d7d('0xce')],'as':_0x1d7d('0xcf'),'attributes':['id',_0x1d7d('0x2c')]});_0x4059a1[_0x1d7d('0xc6')]({'model':db[_0x1d7d('0x68')],'as':_0x1d7d('0xd0'),'attributes':['id',_0x1d7d('0x2d')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x22334d['params']['id']},'include':_0x4059a1})[_0x1d7d('0x2a')](handleEntityNotFound(_0x459ef8,null))[_0x1d7d('0x2a')](function(_0x42217f){if(_0x42217f){var _0x385140=_0x42217f[_0x1d7d('0xd1')]({'plain':!![]});fs[_0x1d7d('0xd2')](_0x283399);var _0x19ee22={'format':'A4','border':_0x1d7d('0xd3'),'header':{'height':'40px','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[_0x1d7d('0xb7')](_0x1d7d('0xd4'),util[_0x1d7d('0xb7')](_0x1d7d('0xd5'),'Whatsapp',_0x385140['id']),moment()[_0x1d7d('0xb7')](_0x1d7d('0xd6'))[_0x1d7d('0x91')]())}}};var _0x37eb97={'channel':_0x1d7d('0xd7'),'account':_0x385140[_0x1d7d('0xcf')]['name'],'agent':_0x385140[_0x1d7d('0xd0')]?_0x385140[_0x1d7d('0xd0')][_0x1d7d('0x2d')]:'N.A.','createdAt':moment(_0x385140['createdAt'])[_0x1d7d('0xb7')](_0x1d7d('0xb8'))[_0x1d7d('0x91')](),'closedAt':_0x385140['closed']?moment(_0x385140[_0x1d7d('0xd8')])['format'](_0x1d7d('0xb8'))[_0x1d7d('0x91')]():'','disposition':_0x385140[_0x1d7d('0xd9')],'messages':_(_0x385140['Messages'])['filter']({'secret':![]})[_0x1d7d('0x34')](function(_0x1af723){if(_0x1af723[_0x1d7d('0xcb')]){var _0x184452=path[_0x1d7d('0xc4')](_0xf63e32,_0x1af723[_0x1d7d('0xcb')][_0x1d7d('0xda')]);if(fs[_0x1d7d('0xdb')](_0x184452)){fs[_0x1d7d('0xdc')](_0x184452)[_0x1d7d('0xdd')](fs[_0x1d7d('0xde')](path['join'](_0x283399,_0x1af723[_0x1d7d('0xcb')][_0x1d7d('0xda')])));}}return{'date':moment(_0x1af723[_0x1d7d('0x70')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1d7d('0x91')](),'sender':_0x1af723['direction']===_0x1d7d('0xdf')?_0x1af723[_0x1d7d('0x68')]?_0x1af723[_0x1d7d('0x68')]['fullname']:_0x1d7d('0xe0'):_0x1af723['Contact']['firstName']+(_0x1af723[_0x1d7d('0x5f')][_0x1d7d('0xc9')]?'\x20'+_0x1af723['Contact'][_0x1d7d('0xc9')]:''),'body':_0x1af723[_0x1d7d('0xcb')]?_0x1af723[_0x1d7d('0xcb')][_0x1d7d('0xda')]:_0x1af723[_0x1d7d('0x6c')],'direction':_0x1af723['direction']===_0x1d7d('0xdf')?'A':'C','secret':_0x1af723['secret'],'read':_0x1af723[_0x1d7d('0x78')],'attachment':_0x1af723[_0x1d7d('0xcb')]};})['value']()};return ejs[_0x1d7d('0xe1')](path[_0x1d7d('0xc4')](config[_0x1d7d('0xc0')],_0x1d7d('0xc1'),_0x1d7d('0xe2'),_0x1d7d('0xe3')),{'interaction':_0x37eb97})[_0x1d7d('0x2a')](function(_0x3739f5){return new BPromise(function(_0xc04751,_0x10b482){pdf[_0x1d7d('0xae')](_0x3739f5,_0x19ee22)[_0x1d7d('0xe4')](path[_0x1d7d('0xc4')](_0x283399,'transcript-'+_0x385140['id']+'-'+_0x54616b+'.pdf'),function(_0xf4edd7,_0x5907db){if(_0xf4edd7)return _0x10b482(_0xf4edd7);_0xc04751(_0x5907db);});});})['then'](function(){return new BPromise(function(_0x234336,_0x4f5aef){zipdir(_0x283399,{'saveTo':_0x50fc9b},function(_0x227066,_0x470991){if(_0x227066)return _0x4f5aef(_0x227066);return _0x234336(_0x470991);});})[_0x1d7d('0x2a')](function(){return new BPromise(function(_0x53f017,_0xefc2d2){rimraf(_0x283399,function(_0x338fa8){if(_0x338fa8)_0xefc2d2(_0x338fa8);return _0x53f017();});});})[_0x1d7d('0x2a')](function(){return _0x459ef8[_0x1d7d('0xe5')](_0x50fc9b,_0x35e7f2,function(_0x39278a){if(_0x39278a){console[_0x1d7d('0xe6')](_0x1d7d('0xe7'),_0x39278a);}else{fs[_0x1d7d('0xe8')](_0x50fc9b);}});});});}else{return _0x459ef8[_0x1d7d('0x20')](0xc8);}})['catch'](handleError(_0x459ef8,null));}; \ No newline at end of file +var _0x14a0=['t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','Contact','operator','$substring','length','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','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','WhatsappInteractionId','push','rows','show','params','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','removeTags','download','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','10px','30px','%s\x20#%d','Whatsapp','N.A.','closed','disposition','Messages','basename','existsSync','pipe','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','select','u.id','u.fullname','ui.WhatsappInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id'];(function(_0x17cebb,_0x39b50c){var _0x1936fe=function(_0x4e3e6a){while(--_0x4e3e6a){_0x17cebb['push'](_0x17cebb['shift']());}};_0x1936fe(++_0x39b50c);}(_0x14a0,0x8e));var _0x014a=function(_0x2009ec,_0x15fc89){_0x2009ec=_0x2009ec-0x0;var _0xf983df=_0x14a0[_0x2009ec];return _0xf983df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);function respondWithStatusCode(_0x3c54c8,_0x4fe87c){_0x4fe87c=_0x4fe87c||0xcc;return function(_0x130d13){if(_0x130d13){return _0x3c54c8[_0x014a('0x1a')](_0x4fe87c);}return _0x3c54c8['status'](_0x4fe87c)[_0x014a('0x1b')]();};}function respondWithResult(_0x128c46,_0x59a4ea){_0x59a4ea=_0x59a4ea||0xc8;return function(_0x16e6fc){if(_0x16e6fc){return _0x128c46[_0x014a('0x1c')](_0x59a4ea)[_0x014a('0x1d')](_0x16e6fc);}};}function respondWithFilteredResult(_0x12da95,_0x2c26ac){return function(_0x12d339){if(_0x12d339){var _0x61ec9f=_0x12d339[_0x014a('0x1e')],_0x263b07=_0x2c26ac[_0x014a('0x1f')],_0x16490a=_0x2c26ac[_0x014a('0x1f')]+_0x2c26ac[_0x014a('0x20')],_0x3b9341;if(_0x16490a>=_0x61ec9f){_0x16490a=_0x61ec9f;_0x3b9341=0xc8;}else{_0x3b9341=0xce;}_0x12da95['status'](_0x3b9341);return _0x12da95[_0x014a('0x21')](_0x014a('0x22'),_0x263b07+'-'+_0x16490a+'/'+_0x61ec9f)[_0x014a('0x1d')](_0x12d339);}return null;};}function patchUpdates(_0x1897c7){return function(_0xc9a563){try{jsonpatch[_0x014a('0x23')](_0xc9a563,_0x1897c7,!![]);}catch(_0x37c3d1){return BPromise[_0x014a('0x24')](_0x37c3d1);}return _0xc9a563[_0x014a('0x25')]();};}function saveUpdates(_0x486e66,_0x3679ed){return function(_0x5f556e){if(_0x5f556e){return _0x5f556e[_0x014a('0x26')](_0x486e66)[_0x014a('0x27')](function(_0x44d921){return _0x44d921;});}return null;};}function removeEntity(_0x36d52b,_0x2b3c10){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0x014a('0x28')]()[_0x014a('0x27')](function(){_0x36d52b[_0x014a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4b92,_0x5358e9){return function(_0x39a432){if(!_0x39a432){_0x3b4b92[_0x014a('0x1a')](0x194);}return _0x39a432;};}function handleError(_0x4f1c44,_0x4ee195){_0x4ee195=_0x4ee195||0x1f4;return function(_0x9a901f){logger[_0x014a('0x29')](_0x9a901f[_0x014a('0x2a')]);if(_0x9a901f['name']){delete _0x9a901f[_0x014a('0x2b')];}_0x4f1c44[_0x014a('0x1c')](_0x4ee195)['send'](_0x9a901f);};}function getInteractionUsers(_0x31dc95,_0x2560a6){return new BPromise(function(_0x496040,_0x4f9c1c){try{if(_0x2560a6[_0x31dc95['id']]){_0x31dc95[_0x014a('0x2c')]=_[_0x014a('0x2d')](_0x2560a6[_0x31dc95['id']],function(_0xe70dfa){return{'id':_0xe70dfa['id'],'fullname':_0xe70dfa[_0x014a('0x2e')]};});}}catch(_0x4ea00c){_0x4f9c1c(_0x4ea00c);}_0x496040(_0x31dc95);});}function getInteractionTags(_0x434038,_0x147e7e){return new BPromise(function(_0x15af07,_0x402d3b){try{if(_0x434038[_0x014a('0x2f')]){_0x434038[_0x014a('0x30')]=[];_0x434038[_0x014a('0x2f')][_0x014a('0x31')](',')[_0x014a('0x32')](function(_0x3c8755){_0x434038[_0x014a('0x30')]['push'](_0x147e7e[_0x3c8755]);});}delete _0x434038[_0x014a('0x2f')];}catch(_0x41ead8){_0x402d3b(_0x41ead8);}_0x15af07(_0x434038);});}function updateWhatsappInteraction(_0x1f7a3b,_0x457883,_0x5f1022){return new BPromise(function(_0x39b3b8,_0x211d18){return getInteractionUsers(_0x1f7a3b,_0x5f1022)['then'](function(_0x116a24){return getInteractionTags(_0x116a24,_0x457883);})[_0x014a('0x27')](function(_0x5610cb){_0x39b3b8(_0x5610cb);})[_0x014a('0x33')](function(_0x12de94){_0x211d18(_0x12de94);});});}exports[_0x014a('0x34')]=function(_0x467032,_0x329136){var _0xa8fcfb={},_0x26a5e8={},_0x1cff0f={'count':0x0,'rows':[]};var _0x5e37e4=_[_0x014a('0x2d')](db[_0x014a('0x35')][_0x014a('0x36')],function(_0x1f31c8){return{'name':_0x1f31c8['fieldName'],'type':_0x1f31c8[_0x014a('0x37')][_0x014a('0x38')]};});_0x26a5e8[_0x014a('0x39')]=_[_0x014a('0x2d')](_0x5e37e4,_0x014a('0x2b'));_0x26a5e8[_0x014a('0x3a')]=_[_0x014a('0x3b')](_0x467032[_0x014a('0x3a')]);_0x26a5e8[_0x014a('0x3c')]=_['intersection'](_0x26a5e8[_0x014a('0x39')],_0x26a5e8['query']);_0xa8fcfb[_0x014a('0x3d')]=_[_0x014a('0x3e')](_0x26a5e8[_0x014a('0x39')],qs[_0x014a('0x3f')](_0x467032[_0x014a('0x3a')]['fields']));_0xa8fcfb[_0x014a('0x3d')]=_0xa8fcfb[_0x014a('0x3d')]['length']?_0xa8fcfb[_0x014a('0x3d')]:_0x26a5e8[_0x014a('0x39')];if(!_0x467032[_0x014a('0x3a')][_0x014a('0x40')](_0x014a('0x41'))){_0xa8fcfb[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x467032[_0x014a('0x3a')][_0x014a('0x20')]);_0xa8fcfb['offset']=qs[_0x014a('0x1f')](_0x467032[_0x014a('0x3a')][_0x014a('0x1f')]);}_0xa8fcfb[_0x014a('0x42')]=qs['sort'](_0x467032[_0x014a('0x3a')][_0x014a('0x43')]);_0xa8fcfb[_0x014a('0x44')]=qs[_0x014a('0x3c')](_[_0x014a('0x45')](_0x467032[_0x014a('0x3a')],_0x26a5e8['filters']),_0x5e37e4);var _0x361866=[];var _0x2830e1=squel['select']()[_0x014a('0x46')]('id')[_0x014a('0x46')](_0x014a('0x2b'))['field'](_0x014a('0x47'))['from']('tools_tags');var _0x67b30f=squel[_0x014a('0x48')]()['field'](_0x014a('0x49'))[_0x014a('0x46')](_0x014a('0x4a'))[_0x014a('0x46')](_0x014a('0x4b'))[_0x014a('0x4c')]('user_has_whatsapp_interactions','ui')[_0x014a('0x4d')](_0x014a('0x4e'),'u',_0x014a('0x4f'));var _0x52677e=squel['select']()[_0x014a('0x4c')]('whatsapp_interactions','i')['left_join'](_0x014a('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x014a('0x4d')](_0x014a('0x4e'),'o',_0x014a('0x51'))['left_join'](_0x014a('0x52'),'a',_0x014a('0x53'))[_0x014a('0x4d')](_0x014a('0x54'),'me',_0x014a('0x55'))[_0x014a('0x4d')]('whatsapp_interaction_has_tags','it',_0x014a('0x56'))[_0x014a('0x4d')]('tools_tags','t',_0x014a('0x57'));var _0x29345b=squel[_0x014a('0x58')]();var _0x324df7=[];var _0x40a9c1=squel[_0x014a('0x58')]();var _0x437f23;if(_0x467032[_0x014a('0x3a')]['search']){_0x437f23=as[_0x014a('0x59')](_0x467032[_0x014a('0x3a')][_0x014a('0x5a')]);var _0x135e7e=_0x437f23[_0x014a('0x5b')];for(var _0x4b2fdb=0x0;_0x4b2fdb<_0x437f23[_0x014a('0x5c')]['length'];_0x4b2fdb++){var _0x2da804=_0x437f23[_0x014a('0x5c')][_0x4b2fdb];var _0x40e02b='i';var _0x479dc0=_[_0x014a('0x5d')](_0x5e37e4,['name',_0x2da804['field']]);if(!_0x479dc0){switch(_0x2da804['field']){case'unreadMessages':if(_0x2da804[_0x014a('0x5e')]==0x1){_0x52677e['having']('`'+_0x2da804[_0x014a('0x46')]+'`\x20=\x200');}else{_0x52677e['having']('`'+_0x2da804[_0x014a('0x46')]+'`\x20>\x200');}break;case _0x014a('0x5f'):if(_0x2da804[_0x014a('0x60')]===_0x014a('0x61')){if(_0x2da804[_0x014a('0x5e')][_0x014a('0x31')]('\x20')[_0x014a('0x62')]>0x1){_0x29345b[_0x135e7e](_0x014a('0x63'),qs[_0x014a('0x64')](_0x2da804[_0x014a('0x5e')]),null);}else{var _0x3fc9ab='%'+_0x2da804['value']+'%';_0x29345b[_0x135e7e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3fc9ab,_0x3fc9ab,_0x3fc9ab);}}else{_0x479dc0=_[_0x014a('0x5d')](_0x5e37e4,[_0x014a('0x2b'),_0x014a('0x65')]);_0x2da804['field']='ContactId';_0x2d3efb=as[_0x014a('0x66')](_0x40e02b,_0x479dc0['type'],_0x2da804);_0x29345b[_0x135e7e](_0x2d3efb[_0x014a('0x67')],_0x2d3efb[_0x014a('0x5e')][_0x014a('0x68')],_0x2d3efb[_0x014a('0x5e')]['end']);}break;case _0x014a('0x69'):var _0x2ccc2f=_0x2da804[_0x014a('0x5e')]['split'](',')[_0x014a('0x2d')](function(_0x57e179){return Number(_0x57e179);});_0x2ccc2f[_0x014a('0x32')](function(_0x47074f){_0x40a9c1['or'](_0x014a('0x6a'),'%,'+_0x47074f+',%');});_0x324df7=_[_0x014a('0x6b')](_0x324df7,_0x2ccc2f);break;case _0x014a('0x6c'):if(_0x2da804[_0x014a('0x60')]==='$substring'){_0x29345b[_0x135e7e](_0x014a('0x6d'),'%'+_0x2da804[_0x014a('0x5e')]+'%',null);}else{_0x479dc0=_[_0x014a('0x5d')](_0x5e37e4,['name',_0x014a('0x6e')]);_0x2da804[_0x014a('0x46')]=_0x014a('0x6e');_0x2d3efb=as[_0x014a('0x66')](_0x40e02b,_0x479dc0[_0x014a('0x37')],_0x2da804);_0x29345b[_0x135e7e](_0x2d3efb['text'],_0x2d3efb[_0x014a('0x5e')][_0x014a('0x68')],_0x2d3efb[_0x014a('0x5e')][_0x014a('0x1b')]);}break;case _0x014a('0x6f'):_0x2d3efb=as[_0x014a('0x66')]('me',null,_0x2da804);_0x29345b[_0x135e7e](_0x2d3efb[_0x014a('0x67')],_0x2d3efb[_0x014a('0x5e')][_0x014a('0x68')],_0x2d3efb[_0x014a('0x5e')][_0x014a('0x1b')]);break;}}else{var _0x2d3efb=as['buildExpression'](_0x40e02b,_0x479dc0[_0x014a('0x37')],_0x2da804);_0x29345b[_0x135e7e](_0x2d3efb['text'],_0x2d3efb['value']['start'],_0x2d3efb['value']['end']);}}}else{var _0x1716d3=_(_0x467032[_0x014a('0x3a')])[_0x014a('0x3b')]()['map'](function(_0x3c6fc0){return _[_0x014a('0x70')](_0x5e37e4,[_0x014a('0x2b'),_0x3c6fc0])?_0x3c6fc0:undefined;})[_0x014a('0x71')]()['value']();if(!_['isEmpty'](_0x1716d3)){_0x1716d3[_0x014a('0x32')](function(_0x39154c){if(_0x39154c===_0x014a('0x72')){_0x52677e[_0x014a('0x44')](_0x014a('0x73'),[][_0x014a('0x74')](_0x467032[_0x014a('0x3a')][_0x39154c]));}else if(_0x39154c===_0x014a('0x75')){var _0x387d12=JSON[_0x014a('0x76')](_0x467032[_0x014a('0x3a')][_0x39154c])['$gte'];var _0x2d87e3=JSON[_0x014a('0x76')](_0x467032['query'][_0x39154c])[_0x014a('0x77')];_0x52677e[_0x014a('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x387d12,_0x2d87e3);}else{if(_0x467032[_0x014a('0x3a')][_0x39154c]==='null'){_0x52677e[_0x014a('0x44')]('i.'+_0x39154c+_0x014a('0x78'));}else{_0x52677e[_0x014a('0x44')]('i.'+_0x39154c+_0x014a('0x79'),_0x467032[_0x014a('0x3a')][_0x39154c]);}}});}if(_0x467032['query'][_0x014a('0x7a')]){if(_0x467032[_0x014a('0x3a')][_0x014a('0x7a')]==0x1){_0x52677e[_0x014a('0x7b')](_0x014a('0x7c'));}else{_0x52677e['having'](_0x014a('0x7d'));}}if(_0x467032[_0x014a('0x3a')][_0x014a('0x7e')]){_0x324df7=_['isArray'](_0x467032[_0x014a('0x3a')]['tag'])?_0x467032[_0x014a('0x3a')][_0x014a('0x7e')]:new Array(_0x467032[_0x014a('0x3a')][_0x014a('0x7e')]);_0x324df7[_0x014a('0x32')](function(_0x465a8e){_0x40a9c1['or'](_0x014a('0x6a'),'%,'+_0x465a8e+',%');});}if(_0x467032['query']['filter']){var _0x148fb0=_0x467032['query'][_0x014a('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x014a('0x80')](/'/g,'\x27\x27');if(qs[_0x014a('0x81')](_0x148fb0)){_0x29345b['or']('i.id\x20LIKE\x20?',_0x148fb0+'%')['or']('i.phone\x20LIKE\x20?',_0x148fb0+'%');}else{_0x29345b['or'](_0x014a('0x82'),qs[_0x014a('0x64')](_0x148fb0))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x148fb0+'%');}}}_0x52677e[_0x014a('0x44')](_0x29345b);_0x52677e[_0x014a('0x83')]('i.id');var _0x4a1b65={'type':db[_0x014a('0x84')][_0x014a('0x85')][_0x014a('0x86')],'raw':!![]};var _0x33e383=_0x52677e[_0x014a('0x87')]();_0x33e383[_0x014a('0x46')]('i.id');_0x33e383[_0x014a('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xa8fcfb[_0x014a('0x42')]){_0xa8fcfb[_0x014a('0x42')]['forEach'](function(_0x27e363){var _0x43165e=_0x27e363[0x0]===_0x014a('0x88')?_0x27e363[0x0]:'i.'+_0x27e363[0x0];_0x52677e[_0x014a('0x42')](_0x43165e,_0x27e363[0x1]===_0x014a('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x324df7)){_0x52677e[_0x014a('0x7b')](_0x40a9c1);_0x33e383[_0x014a('0x44')](_0x014a('0x8a'),_0x324df7);}BPromise[_0x014a('0x8b')]()['then'](function(){if(!_0x437f23){if(_0x467032[_0x014a('0x3a')]['WhatsappAccountId'])return;_0x33e383[_0x014a('0x44')](_0x014a('0x8c'));_0x52677e[_0x014a('0x44')](_0x014a('0x8c'));return;}if(_0x467032[_0x014a('0x8d')][_0x014a('0x8e')]!=='agent')return;return _0x467032[_0x014a('0x8d')][_0x014a('0x8f')]({'attributes':['id'],'raw':!![]})[_0x014a('0x27')](function(_0x1a6049){if(_[_0x014a('0x90')](_0x1a6049)){_0x33e383[_0x014a('0x44')](_0x014a('0x91'));_0x52677e[_0x014a('0x44')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x33e383[_0x014a('0x44')](_0x014a('0x73'),_[_0x014a('0x2d')](_0x1a6049,'id'));_0x52677e['where'](_0x014a('0x73'),_[_0x014a('0x2d')](_0x1a6049,'id'));}});})[_0x014a('0x27')](function(){if(_0x467032[_0x014a('0x8d')][_0x014a('0x8e')]===_0x014a('0x92')&&!_0x437f23&&!_0x467032[_0x014a('0x3a')]['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x33e383['toString'](),_0x4a1b65);})[_0x014a('0x27')](function(_0x32683c){_0x1cff0f[_0x014a('0x1e')]=_0x32683c[_0x014a('0x62')];if(_0x1cff0f[_0x014a('0x1e')]===0x0)return[];return db[_0x014a('0x93')][_0x014a('0x3a')](_0x2830e1['toString'](),_0x4a1b65)[_0x014a('0x27')](function(_0x2e3ccd){_0x361866=_[_0x014a('0x94')](_0x2e3ccd,'id');_0x4a1b65=_[_0x014a('0x95')](_0x4a1b65,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x467032['query'][_0x014a('0x3f')]){_0xa8fcfb[_0x014a('0x3d')]['forEach'](function(_0x4aea1d){_0x52677e[_0x014a('0x46')]('i.'+_0x4aea1d);});}else{_0x52677e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x014a('0x96'));_0x52677e[_0x014a('0x46')]('a.key',_0x014a('0x97'));_0x52677e[_0x014a('0x46')](_0x014a('0x98'),_0x014a('0x99'));_0x52677e[_0x014a('0x46')](_0x014a('0x9a'),_0x014a('0x88'));_0x52677e[_0x014a('0x46')]('i.*');_0x52677e['field'](_0x014a('0x9b'),'Contact.firstName');_0x52677e['field']('c.lastName',_0x014a('0x9c'));_0x52677e[_0x014a('0x46')](_0x014a('0x9d'),'Contact.email');_0x52677e[_0x014a('0x46')](_0x014a('0x9e'),_0x014a('0x9f'));_0x52677e[_0x014a('0x46')]('c.mobile',_0x014a('0xa0'));_0x52677e[_0x014a('0x46')](_0x014a('0xa1'),'Contact.fax');_0x52677e[_0x014a('0x46')](_0x014a('0xa2'),'Owner.fullname');_0x52677e[_0x014a('0x46')](_0x014a('0xa3'),_0x014a('0xa4'));_0x52677e['field'](_0x014a('0xa5'),_0x014a('0x2f'));}if(_0xa8fcfb['limit'])_0x52677e[_0x014a('0x20')](_0xa8fcfb[_0x014a('0x20')]);if(_0xa8fcfb[_0x014a('0x1f')])_0x52677e[_0x014a('0x1f')](_0xa8fcfb[_0x014a('0x1f')]);return db[_0x014a('0x93')][_0x014a('0x3a')](_0x52677e[_0x014a('0xa6')](),_0x4a1b65);})['then'](function(_0x38917d){_0x67b30f[_0x014a('0x44')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x38917d,'id'));return db[_0x014a('0x93')][_0x014a('0x3a')](_0x67b30f['toString'](),_0x4a1b65)[_0x014a('0x27')](function(_0x440b9b){var _0x216b27=_['groupBy'](_0x440b9b,_0x014a('0xa7'));var _0x2c320f=[];_0x38917d['forEach'](function(_0x5baf80){_0x2c320f[_0x014a('0xa8')](updateWhatsappInteraction(_0x5baf80,_0x361866,_0x216b27));});return BPromise['all'](_0x2c320f);});});})[_0x014a('0x27')](function(_0x4f0929){_0x1cff0f[_0x014a('0xa9')]=_0x4f0929;return _0x1cff0f;})[_0x014a('0x27')](respondWithFilteredResult(_0x329136,_0xa8fcfb))[_0x014a('0x33')](handleError(_0x329136,null));};exports[_0x014a('0xaa')]=function(_0x20b182,_0x56cf6f){var _0x11335f={'raw':![],'where':{'id':_0x20b182[_0x014a('0xab')]['id']}},_0xc07c07={};_0xc07c07[_0x014a('0x39')]=_[_0x014a('0x3b')](db[_0x014a('0x35')][_0x014a('0x36')]);_0xc07c07[_0x014a('0x3a')]=_['keys'](_0x20b182[_0x014a('0x3a')]);_0xc07c07['filters']=_[_0x014a('0x3e')](_0xc07c07['model'],_0xc07c07['query']);_0x11335f['attributes']=_['intersection'](_0xc07c07[_0x014a('0x39')],qs[_0x014a('0x3f')](_0x20b182[_0x014a('0x3a')][_0x014a('0x3f')]));_0x11335f[_0x014a('0x3d')]=_0x11335f[_0x014a('0x3d')][_0x014a('0x62')]?_0x11335f[_0x014a('0x3d')]:_0xc07c07['model'];if(_0x20b182['query'][_0x014a('0xac')]){_0x11335f[_0x014a('0xad')]=[{'all':!![]}];}_0x11335f=_[_0x014a('0x95')]({},_0x11335f,_0x20b182[_0x014a('0xae')]);return db[_0x014a('0x35')][_0x014a('0x5d')](_0x11335f)[_0x014a('0x27')](handleEntityNotFound(_0x56cf6f,null))[_0x014a('0x27')](respondWithResult(_0x56cf6f,null))['catch'](handleError(_0x56cf6f,null));};exports[_0x014a('0xaf')]=function(_0x3cfcc7,_0x3a2752){return db[_0x014a('0x35')][_0x014a('0xaf')](_0x3cfcc7['body'],{})[_0x014a('0x27')](respondWithResult(_0x3a2752,0xc9))[_0x014a('0x33')](handleError(_0x3a2752,null));};exports[_0x014a('0x26')]=function(_0xf508bb,_0x3171d3){if(_0xf508bb[_0x014a('0x6f')]['id']){delete _0xf508bb[_0x014a('0x6f')]['id'];}return db['WhatsappInteraction'][_0x014a('0x5d')]({'where':{'id':_0xf508bb['params']['id']}})['then'](handleEntityNotFound(_0x3171d3,null))[_0x014a('0x27')](saveUpdates(_0xf508bb[_0x014a('0x6f')],null))['then'](respondWithResult(_0x3171d3,null))[_0x014a('0x33')](handleError(_0x3171d3,null));};exports[_0x014a('0x28')]=function(_0x10ceb0,_0x5e116d){return db[_0x014a('0x35')][_0x014a('0x5d')]({'where':{'id':_0x10ceb0[_0x014a('0xab')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x5e116d,null))[_0x014a('0x27')](removeEntity(_0x5e116d,null))[_0x014a('0x33')](handleError(_0x5e116d,null));};exports[_0x014a('0xb0')]=function(_0x327b07,_0xc964a1){return db['WhatsappInteraction']['describe']()[_0x014a('0x27')](respondWithResult(_0xc964a1,null))[_0x014a('0x33')](handleError(_0xc964a1,null));};exports[_0x014a('0xb1')]=function(_0x54de82,_0x350a39,_0x255871){return db[_0x014a('0xb2')][_0x014a('0x5d')]({'where':{'id':_0x54de82[_0x014a('0xab')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x350a39,null))['then'](function(_0x1c8cba){if(_0x1c8cba){return _0x1c8cba[_0x014a('0xb1')](_0x54de82[_0x014a('0x6f')][_0x014a('0xb3')],_['omit'](_0x54de82[_0x014a('0x6f')],[_0x014a('0xb3'),'id'])||{});}})[_0x014a('0x27')](respondWithResult(_0x350a39,null))[_0x014a('0x33')](handleError(_0x350a39,null));};exports[_0x014a('0xb4')]=function(_0x4f53b4,_0xcf0aee,_0x543bd6){var _0x57f33e={'raw':![],'where':{}};var _0x417b45={};var _0x369fbd={'count':0x0,'rows':[]};return db[_0x014a('0x35')][_0x014a('0xb5')]({'where':{'id':_0x4f53b4[_0x014a('0xab')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0xcf0aee,null))[_0x014a('0x27')](function(_0x3a9352){if(_0x3a9352){_0x417b45[_0x014a('0x39')]=_[_0x014a('0x3b')](db[_0x014a('0xb2')][_0x014a('0x36')]);_0x417b45[_0x014a('0x3a')]=_[_0x014a('0x3b')](_0x4f53b4[_0x014a('0x3a')]);_0x417b45[_0x014a('0x3c')]=_['intersection'](_0x417b45[_0x014a('0x39')],_0x417b45[_0x014a('0x3a')]);_0x57f33e[_0x014a('0x3d')]=_['intersection'](_0x417b45[_0x014a('0x39')],qs[_0x014a('0x3f')](_0x4f53b4[_0x014a('0x3a')][_0x014a('0x3f')]));_0x57f33e[_0x014a('0x3d')]=_0x57f33e[_0x014a('0x3d')][_0x014a('0x62')]?_0x57f33e[_0x014a('0x3d')]:_0x417b45[_0x014a('0x39')];if(!_0x4f53b4['query'][_0x014a('0x40')](_0x014a('0x41'))){_0x57f33e[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x4f53b4['query'][_0x014a('0x20')]);_0x57f33e['offset']=qs['offset'](_0x4f53b4[_0x014a('0x3a')]['offset']);}_0x57f33e[_0x014a('0x42')]=qs[_0x014a('0x43')](_0x4f53b4['query'][_0x014a('0x43')]);_0x57f33e['where']=qs[_0x014a('0x3c')](_[_0x014a('0x45')](_0x4f53b4['query'],_0x417b45[_0x014a('0x3c')]));_0x57f33e[_0x014a('0x44')]['WhatsappInteractionId']=_0x3a9352['id'];if(_0x4f53b4[_0x014a('0x3a')][_0x014a('0x7f')]){_0x57f33e[_0x014a('0x44')]=_[_0x014a('0x95')](_0x57f33e[_0x014a('0x44')],{'$or':_[_0x014a('0x2d')](_0x57f33e[_0x014a('0x3d')],function(_0x2ed2cf){var _0x10ecf3={};_0x10ecf3[_0x2ed2cf]={'$like':'%'+_0x4f53b4[_0x014a('0x3a')][_0x014a('0x7f')]+'%'};return _0x10ecf3;})});}if(_0x4f53b4[_0x014a('0x3a')]['$gte']){var _0x307aad=_0x4f53b4[_0x014a('0x3a')][_0x014a('0xb6')][_0x014a('0x31')](',');var _0x3cf20e={};_0x3cf20e[_0x307aad[0x0]]={'$gte':moment(_0x307aad[0x1])[_0x014a('0xb7')](_0x014a('0xb8'))};_0x57f33e[_0x014a('0x44')]=_['merge'](_0x57f33e[_0x014a('0x44')],_0x3cf20e);}_0x57f33e=_[_0x014a('0x95')]({},_0x57f33e,_0x4f53b4[_0x014a('0xae')]);return db[_0x014a('0xb2')][_0x014a('0x1e')]({'where':_0x57f33e[_0x014a('0x44')]})['then'](function(_0x20427f){_0x369fbd[_0x014a('0x1e')]=_0x20427f;if(_0x4f53b4[_0x014a('0x3a')]['includeAll']){_0x57f33e['include']=[{'all':!![]}];}return db[_0x014a('0xb2')][_0x014a('0xb9')](_0x57f33e);})[_0x014a('0x27')](function(_0x31e65e){_0x369fbd[_0x014a('0xa9')]=_0x31e65e;return _0x369fbd;});}})['then'](respondWithFilteredResult(_0xcf0aee,_0x57f33e))[_0x014a('0x33')](handleError(_0xcf0aee,null));};exports[_0x014a('0xba')]=function(_0x41c88c,_0x5dd7a5,_0x185609){return db[_0x014a('0x35')]['find']({'where':{'id':_0x41c88c[_0x014a('0xab')]['id']}})['then'](handleEntityNotFound(_0x5dd7a5,null))[_0x014a('0x27')](function(_0x503374){if(_0x503374){return _0x503374['setTags'](_0x41c88c['body'][_0x014a('0xb3')],_['omit'](_0x41c88c[_0x014a('0x6f')],['ids','id'])||{})[_0x014a('0xbb')](function(){return db[_0x014a('0x69')][_0x014a('0xb9')]({'attributes':['id','name',_0x014a('0x47')],'where':{'id':_0x41c88c['body'][_0x014a('0xb3')]}});})[_0x014a('0x27')](function(_0x240713){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x41c88c[_0x014a('0xab')]['id']),'tags':_0x240713||[]});return{'id':Number(_0x41c88c[_0x014a('0xab')]['id']),'tags':_0x240713||[]};});}})[_0x014a('0x27')](respondWithResult(_0x5dd7a5,null))[_0x014a('0x33')](handleError(_0x5dd7a5,null));};exports[_0x014a('0xbc')]=function(_0x19a022,_0x46f652,_0x191b21){return db[_0x014a('0x35')][_0x014a('0x5d')]({'where':{'id':_0x19a022[_0x014a('0xab')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x46f652,null))[_0x014a('0x27')](function(_0x4adbd2){if(_0x4adbd2){return _0x4adbd2['removeTags'](_0x19a022[_0x014a('0x3a')][_0x014a('0xb3')]);}})['then'](respondWithStatusCode(_0x46f652,null))[_0x014a('0x33')](handleError(_0x46f652,null));};exports[_0x014a('0xbd')]=function(_0x4e50b7,_0x4cf944){var _0xf01aa6=moment()[_0x014a('0xbe')]()['toString']();var _0xbfc324=path['join'](config[_0x014a('0xbf')],_0x014a('0xc0'),_0x014a('0xc1'),_0x014a('0xc2'));var _0x5a3c54=path['join'](config['root'],'server',_0x014a('0xc1'),_0x014a('0xc3'));var _0xdb519a=path[_0x014a('0xc4')](_0xbfc324,_0xf01aa6);var _0x17ce73=util[_0x014a('0xb7')](_0x014a('0xc5'),_0x4e50b7[_0x014a('0xab')]['id'],_0xf01aa6);var _0x44fea4=path[_0x014a('0xc4')](_0xbfc324,_0x17ce73);var _0x2b172f=[];_0x2b172f['push']({'model':db['User'],'as':'User','attributes':['id',_0x014a('0x2e')],'raw':!![]});_0x2b172f[_0x014a('0xa8')]({'model':db['CmContact'],'as':_0x014a('0x5f'),'attributes':['id',_0x014a('0xc6'),_0x014a('0xc7')],'raw':!![]});if(_0x4e50b7[_0x014a('0x3a')]['attachments']){_0x2b172f[_0x014a('0xa8')]({'model':db[_0x014a('0xc8')],'as':'Attachment','raw':!![]});}var _0x1a6804=[{'model':db[_0x014a('0xb2')],'as':'Messages','attributes':['id',_0x014a('0x6f'),_0x014a('0x75'),_0x014a('0xc9'),_0x014a('0xca'),_0x014a('0x7a')],'include':_0x2b172f}];_0x1a6804[_0x014a('0xa8')]({'model':db[_0x014a('0xcb')],'as':_0x014a('0xcc'),'attributes':['id','name']});_0x1a6804[_0x014a('0xa8')]({'model':db[_0x014a('0x6c')],'as':_0x014a('0xcd'),'attributes':['id',_0x014a('0x2e')]});return db[_0x014a('0x35')][_0x014a('0x5d')]({'where':{'id':_0x4e50b7[_0x014a('0xab')]['id']},'include':_0x1a6804})[_0x014a('0x27')](handleEntityNotFound(_0x4cf944,null))[_0x014a('0x27')](function(_0x5d3145){if(_0x5d3145){var _0x11dec4=_0x5d3145['get']({'plain':!![]});fs[_0x014a('0xce')](_0xdb519a);var _0x3ad3e2={'format':'A4','border':_0x014a('0xcf'),'header':{'height':'40px','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':_0x014a('0xd0'),'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['format'](_0x014a('0xd1'),_0x014a('0xd2'),_0x11dec4['id']),moment()[_0x014a('0xb7')]('YYYY-MM-DD')[_0x014a('0xa6')]())}}};var _0x19a2ed={'channel':'Whatsapp','account':_0x11dec4[_0x014a('0xcc')][_0x014a('0x2b')],'agent':_0x11dec4[_0x014a('0xcd')]?_0x11dec4['Owner']['fullname']:_0x014a('0xd3'),'createdAt':moment(_0x11dec4[_0x014a('0x75')])[_0x014a('0xb7')](_0x014a('0xb8'))[_0x014a('0xa6')](),'closedAt':_0x11dec4[_0x014a('0xd4')]?moment(_0x11dec4['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x014a('0xa6')]():'','disposition':_0x11dec4[_0x014a('0xd5')],'messages':_(_0x11dec4[_0x014a('0xd6')])['filter']({'secret':![]})[_0x014a('0x2d')](function(_0x1f2ced){if(_0x1f2ced[_0x014a('0xc8')]){var _0x5f00e7=path[_0x014a('0xc4')](_0x5a3c54,_0x1f2ced[_0x014a('0xc8')][_0x014a('0xd7')]);if(fs[_0x014a('0xd8')](_0x5f00e7)){fs['createReadStream'](_0x5f00e7)[_0x014a('0xd9')](fs['createWriteStream'](path[_0x014a('0xc4')](_0xdb519a,_0x1f2ced[_0x014a('0xc8')][_0x014a('0xd7')])));}}return{'date':moment(_0x1f2ced['createdAt'])[_0x014a('0xb7')](_0x014a('0xb8'))[_0x014a('0xa6')](),'sender':_0x1f2ced[_0x014a('0xc9')]===_0x014a('0xda')?_0x1f2ced['User']?_0x1f2ced[_0x014a('0x6c')][_0x014a('0x2e')]:_0x014a('0xdb'):_0x1f2ced[_0x014a('0x5f')][_0x014a('0xc6')]+(_0x1f2ced[_0x014a('0x5f')]['lastName']?'\x20'+_0x1f2ced[_0x014a('0x5f')][_0x014a('0xc7')]:''),'body':_0x1f2ced['Attachment']?_0x1f2ced[_0x014a('0xc8')]['basename']:_0x1f2ced[_0x014a('0x6f')],'direction':_0x1f2ced['direction']===_0x014a('0xda')?'A':'C','secret':_0x1f2ced[_0x014a('0xca')],'read':_0x1f2ced[_0x014a('0x7a')],'attachment':_0x1f2ced[_0x014a('0xc8')]};})[_0x014a('0x5e')]()};return ejs[_0x014a('0xdc')](path[_0x014a('0xc4')](config['root'],'server',_0x014a('0xdd'),_0x014a('0xde')),{'interaction':_0x19a2ed})['then'](function(_0x3f18ac){return new BPromise(function(_0x3381f4,_0x19e4e2){pdf[_0x014a('0xaf')](_0x3f18ac,_0x3ad3e2)[_0x014a('0xdf')](path['join'](_0xdb519a,_0x014a('0xe0')+_0x11dec4['id']+'-'+_0xf01aa6+_0x014a('0xe1')),function(_0x1536d8,_0x1d0e69){if(_0x1536d8)return _0x19e4e2(_0x1536d8);_0x3381f4(_0x1d0e69);});});})['then'](function(){return new BPromise(function(_0x17f906,_0x573727){zipdir(_0xdb519a,{'saveTo':_0x44fea4},function(_0x454e7d,_0x132cf3){if(_0x454e7d)return _0x573727(_0x454e7d);return _0x17f906(_0x132cf3);});})[_0x014a('0x27')](function(){return new BPromise(function(_0x1e18d2,_0x177171){rimraf(_0xdb519a,function(_0x152d33){if(_0x152d33)_0x177171(_0x152d33);return _0x1e18d2();});});})[_0x014a('0x27')](function(){return _0x4cf944['download'](_0x44fea4,_0x17ce73,function(_0xcbafc3){if(_0xcbafc3){console[_0x014a('0xe2')](_0x014a('0xe3'),_0xcbafc3);}else{fs[_0x014a('0xe4')](_0x44fea4);}});});});}else{return _0x4cf944['sendStatus'](0xc8);}})['catch'](handleError(_0x4cf944,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4e93ae0..a421b3f 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 _0xbac6=['exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x41da37,_0x38121f){var _0x416d8a=function(_0x4514a5){while(--_0x4514a5){_0x41da37['push'](_0x41da37['shift']());}};_0x416d8a(++_0x38121f);}(_0xbac6,0xbc));var _0x6bac=function(_0x2d310a,_0x489040){_0x2d310a=_0x2d310a-0x0;var _0x2f9a4a=_0xbac6[_0x2d310a];return _0x2f9a4a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x6bac('0x0'))['db'][_0x6bac('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6bac('0x2')](0x0);var events={'afterCreate':_0x6bac('0x3'),'afterUpdate':_0x6bac('0x4'),'afterDestroy':_0x6bac('0x5')};function emitEvent(_0x8ceca4){return function(_0x122120,_0x56dbf3,_0x25e784){_0x122120[_0x6bac('0x6')]({'attributes':['id'],'raw':!![]})[_0x6bac('0x7')](function(_0xf4a411){_0x122120[_0x6bac('0x8')]('Users',_0xf4a411['map'](function(_0x3afaf0){return{'id':_0x3afaf0['id']};}));return WhatsappMessage[_0x6bac('0x9')]({'where':{'WhatsappInteractionId':_0x122120['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6bac('0x7')](function(_0x34abf1){_0x122120[_0x6bac('0x8')](_0x6bac('0xa'),_0x34abf1[_0x6bac('0xb')]);WhatsappInteractionEvents[_0x6bac('0xc')](_0x8ceca4+':'+_0x122120['id'],_0x122120);WhatsappInteractionEvents[_0x6bac('0xc')](_0x8ceca4,_0x122120);_0x25e784(null);})[_0x6bac('0xd')](_0x25e784(null));};}for(var e in events){if(events[_0x6bac('0xe')](e)){var event=events[e];WhatsappInteraction[_0x6bac('0xf')](e,emitEvent(event));}}module[_0x6bac('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd15f=['save','update','remove','getUsers','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x475701,_0x3d41bc){var _0x15db33=function(_0x1bfdd4){while(--_0x1bfdd4){_0x475701['push'](_0x475701['shift']());}};_0x15db33(++_0x3d41bc);}(_0xd15f,0x1a1));var _0xfd15=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0xd15f[_0x5465e6];return _0x10044e;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xfd15('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xfd15('0x0'))['db'][_0xfd15('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xfd15('0x2')](0x0);var events={'afterCreate':_0xfd15('0x3'),'afterUpdate':_0xfd15('0x4'),'afterDestroy':_0xfd15('0x5')};function emitEvent(_0x3deb2e){return function(_0xe0002b,_0x4f2f61,_0x106864){_0xe0002b[_0xfd15('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f8740){_0xe0002b[_0xfd15('0x7')](_0xfd15('0x8'),_0x2f8740['map'](function(_0x565192){return{'id':_0x565192['id']};}));return WhatsappMessage[_0xfd15('0x9')]({'where':{'WhatsappInteractionId':_0xe0002b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xc84d49){_0xe0002b[_0xfd15('0x7')](_0xfd15('0xa'),_0xc84d49['length']);WhatsappInteractionEvents['emit'](_0x3deb2e+':'+_0xe0002b['id'],_0xe0002b);WhatsappInteractionEvents[_0xfd15('0xb')](_0x3deb2e,_0xe0002b);_0x106864(null);})[_0xfd15('0xc')](_0x106864(null));};}for(var e in events){if(events[_0xfd15('0xd')](e)){var event=events[e];WhatsappInteraction[_0xfd15('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index abfbf28..15fb90b 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 _0x3243=['WhatsappInteraction','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x2e1047,_0x546d79){var _0x1aba6d=function(_0x21ea19){while(--_0x21ea19){_0x2e1047['push'](_0x2e1047['shift']());}};_0x1aba6d(++_0x546d79);}(_0x3243,0x1f4));var _0x3324=function(_0x426a21,_0x3db5b2){_0x426a21=_0x426a21-0x0;var _0x27fb45=_0x3243[_0x426a21];return _0x27fb45;};'use strict';var _=require(_0x3324('0x0'));var util=require(_0x3324('0x1'));var logger=require(_0x3324('0x2'))('api');var moment=require(_0x3324('0x3'));var BPromise=require('bluebird');var rp=require(_0x3324('0x4'));var fs=require('fs');var path=require(_0x3324('0x5'));var rimraf=require('rimraf');var config=require(_0x3324('0x6'));var attributes=require(_0x3324('0x7'));module[_0x3324('0x8')]=function(_0x392b57,_0x4ab10c){return _0x392b57[_0x3324('0x9')](_0x3324('0xa'),attributes,{'tableName':_0x3324('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a1ffd,_0x164123,_0x5462ac){if(_0x1a1ffd['changed'](_0x3324('0xc'))){_0x1a1ffd[_0x3324('0xd')]=moment()['format'](_0x3324('0xe'));}_0x5462ac(null,_0x1a1ffd);}}});}; \ No newline at end of file +var _0x388a=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x53dfdd,_0x26adf8){var _0x4f73f5=function(_0x52b7e0){while(--_0x52b7e0){_0x53dfdd['push'](_0x53dfdd['shift']());}};_0x4f73f5(++_0x26adf8);}(_0x388a,0x94));var _0xa388=function(_0x12830a,_0x394fe6){_0x12830a=_0x12830a-0x0;var _0x376af7=_0x388a[_0x12830a];return _0x376af7;};'use strict';var _=require(_0xa388('0x0'));var util=require(_0xa388('0x1'));var logger=require('../../config/logger')(_0xa388('0x2'));var moment=require('moment');var BPromise=require(_0xa388('0x3'));var rp=require(_0xa388('0x4'));var fs=require('fs');var path=require(_0xa388('0x5'));var rimraf=require(_0xa388('0x6'));var config=require(_0xa388('0x7'));var attributes=require(_0xa388('0x8'));module[_0xa388('0x9')]=function(_0x34a661,_0x55f6a7){return _0x34a661[_0xa388('0xa')](_0xa388('0xb'),attributes,{'tableName':_0xa388('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5605b7,_0x29bb56,_0x123d8b){if(_0x5605b7[_0xa388('0xd')](_0xa388('0xe'))){_0x5605b7[_0xa388('0xf')]=moment()['format'](_0xa388('0x10'));}_0x123d8b(null,_0x5605b7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 942d505..45ca112 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 _0xa1d8=['body','options','raw','where','limit','then','debug','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','WhatsappInteraction','update'];(function(_0x1cd633,_0x21c3db){var _0x5bf6d8=function(_0x19de57){while(--_0x19de57){_0x1cd633['push'](_0x1cd633['shift']());}};_0x5bf6d8(++_0x21c3db);}(_0xa1d8,0x67));var _0x8a1d=function(_0x3ac2d6,_0x155247){_0x3ac2d6=_0x3ac2d6-0x0;var _0x4e632e=_0xa1d8[_0x3ac2d6];return _0x4e632e;};'use strict';var _=require(_0x8a1d('0x0'));var util=require(_0x8a1d('0x1'));var moment=require(_0x8a1d('0x2'));var BPromise=require(_0x8a1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a1d('0x4'));var db=require(_0x8a1d('0x5'))['db'];var utils=require(_0x8a1d('0x6'));var logger=require('../../config/logger')(_0x8a1d('0x7'));var config=require(_0x8a1d('0x8'));var jayson=require(_0x8a1d('0x9'));var client=jayson[_0x8a1d('0xa')][_0x8a1d('0xb')]({'port':0x232a});config[_0x8a1d('0xc')]=_[_0x8a1d('0xd')](config[_0x8a1d('0xc')],{'host':_0x8a1d('0xe'),'port':0x18eb});var socket=require(_0x8a1d('0xf'))(new Redis(config['redis']));require(_0x8a1d('0x10'))[_0x8a1d('0x11')](socket);function respondWithRpcPromise(_0x56b69a,_0x319291,_0x38973a){return new BPromise(function(_0x540a55,_0x428f62){return client[_0x8a1d('0x12')](_0x56b69a,_0x38973a)['then'](function(_0x29f347){logger[_0x8a1d('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x319291,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x319291,_0x8a1d('0x14'),JSON[_0x8a1d('0x15')](_0x29f347));if(_0x29f347[_0x8a1d('0x16')]){if(_0x29f347[_0x8a1d('0x16')]['code']===0x1f4){logger[_0x8a1d('0x16')](_0x8a1d('0x17'),_0x319291,_0x29f347[_0x8a1d('0x16')]['message']);return _0x428f62(_0x29f347[_0x8a1d('0x16')]['message']);}logger['error'](_0x8a1d('0x17'),_0x319291,_0x29f347[_0x8a1d('0x16')][_0x8a1d('0x18')]);return _0x540a55(_0x29f347[_0x8a1d('0x16')]['message']);}else{logger[_0x8a1d('0x13')](_0x8a1d('0x17'),_0x319291,_0x8a1d('0x14'));_0x540a55(_0x29f347[_0x8a1d('0x19')][_0x8a1d('0x18')]);}})[_0x8a1d('0x1a')](function(_0x468a32){logger[_0x8a1d('0x16')](_0x8a1d('0x17'),_0x319291,_0x468a32);_0x428f62(_0x468a32);});});}exports['UpdateWhatsappInteraction']=function(_0x37d339){var _0xbb1615=this;return new Promise(function(_0x12cd3c,_0x22112e){return db[_0x8a1d('0x1b')][_0x8a1d('0x1c')](_0x37d339[_0x8a1d('0x1d')],{'raw':_0x37d339['options']?_0x37d339[_0x8a1d('0x1e')][_0x8a1d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d339['options']?_0x37d339['options'][_0x8a1d('0x20')]||null:null,'attributes':_0x37d339[_0x8a1d('0x1e')]?_0x37d339[_0x8a1d('0x1e')]['attributes']||null:null,'limit':_0x37d339[_0x8a1d('0x1e')]?_0x37d339[_0x8a1d('0x1e')][_0x8a1d('0x21')]||null:null})[_0x8a1d('0x22')](function(_0x285cde){logger[_0x8a1d('0x13')]('UpdateWhatsappInteraction',_0x37d339);logger[_0x8a1d('0x23')](_0x8a1d('0x24'),_0x37d339,JSON[_0x8a1d('0x15')](_0x285cde));_0x12cd3c(_0x285cde);})[_0x8a1d('0x1a')](function(_0xf15799){logger[_0x8a1d('0x16')](_0x8a1d('0x24'),_0xf15799[_0x8a1d('0x18')],_0x37d339);_0x22112e(_0xbb1615[_0x8a1d('0x16')](0x1f4,_0xf15799[_0x8a1d('0x18')]));});});};exports[_0x8a1d('0x25')]=function(_0x21e306){return new Promise(function(_0x5fd09d,_0x263f21){return db['WhatsappInteraction'][_0x8a1d('0x26')]({'where':_0x21e306[_0x8a1d('0x1e')]?_0x21e306[_0x8a1d('0x1e')][_0x8a1d('0x20')]||null:null})[_0x8a1d('0x22')](function(_0x30d8d5){if(_0x30d8d5){return _0x30d8d5[_0x8a1d('0x27')](_0x21e306[_0x8a1d('0x1d')]['ids'],_[_0x8a1d('0x28')](_0x21e306[_0x8a1d('0x1d')],[_0x8a1d('0x29'),'id'])||{});}})[_0x8a1d('0x2a')](function(_0x76c01d){logger[_0x8a1d('0x13')](_0x8a1d('0x2b'),_0x21e306);logger[_0x8a1d('0x23')](_0x8a1d('0x2b'),_0x21e306,JSON[_0x8a1d('0x15')](_0x76c01d));_0x5fd09d(_0x76c01d);})['catch'](function(_0x16037e){logger[_0x8a1d('0x16')](_0x8a1d('0x2b'),_0x16037e[_0x8a1d('0x18')],_0x21e306);_0x263f21(_this['error'](0x1f4,_0x16037e[_0x8a1d('0x18')]));});});}; \ No newline at end of file +var _0xf203=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','catch','find','ids','spread','AddTags','lodash','util'];(function(_0x22c5df,_0x445b1a){var _0x193166=function(_0x43ef54){while(--_0x43ef54){_0x22c5df['push'](_0x22c5df['shift']());}};_0x193166(++_0x445b1a);}(_0xf203,0x79));var _0x3f20=function(_0x344b27,_0x7da121){_0x344b27=_0x344b27-0x0;var _0x440fb7=_0xf203[_0x344b27];return _0x440fb7;};'use strict';var _=require(_0x3f20('0x0'));var util=require(_0x3f20('0x1'));var moment=require(_0x3f20('0x2'));var BPromise=require(_0x3f20('0x3'));var rs=require(_0x3f20('0x4'));var fs=require('fs');var Redis=require(_0x3f20('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f20('0x6'));var logger=require(_0x3f20('0x7'))(_0x3f20('0x8'));var config=require(_0x3f20('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f20('0xa')]({'port':0x232a});config['redis']=_[_0x3f20('0xb')](config[_0x3f20('0xc')],{'host':_0x3f20('0xd'),'port':0x18eb});var socket=require(_0x3f20('0xe'))(new Redis(config['redis']));require(_0x3f20('0xf'))[_0x3f20('0x10')](socket);function respondWithRpcPromise(_0x37711b,_0x444147,_0x27d374){return new BPromise(function(_0x5a8a9c,_0x4b7b74){return client['request'](_0x37711b,_0x27d374)[_0x3f20('0x11')](function(_0x3f9673){logger[_0x3f20('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x444147,'request\x20sent');logger[_0x3f20('0x13')](_0x3f20('0x14'),_0x444147,_0x3f20('0x15'),JSON['stringify'](_0x3f9673));if(_0x3f9673[_0x3f20('0x16')]){if(_0x3f9673[_0x3f20('0x16')][_0x3f20('0x17')]===0x1f4){logger['error'](_0x3f20('0x18'),_0x444147,_0x3f9673[_0x3f20('0x16')][_0x3f20('0x19')]);return _0x4b7b74(_0x3f9673[_0x3f20('0x16')][_0x3f20('0x19')]);}logger[_0x3f20('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x444147,_0x3f9673[_0x3f20('0x16')][_0x3f20('0x19')]);return _0x5a8a9c(_0x3f9673[_0x3f20('0x16')]['message']);}else{logger[_0x3f20('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x444147,_0x3f20('0x15'));_0x5a8a9c(_0x3f9673[_0x3f20('0x1a')][_0x3f20('0x19')]);}})['catch'](function(_0x5aa878){logger['error'](_0x3f20('0x18'),_0x444147,_0x5aa878);_0x4b7b74(_0x5aa878);});});}exports[_0x3f20('0x1b')]=function(_0x3bac1c){var _0x5764ef=this;return new Promise(function(_0xac8834,_0x189b33){return db[_0x3f20('0x1c')][_0x3f20('0x1d')](_0x3bac1c[_0x3f20('0x1e')],{'raw':_0x3bac1c[_0x3f20('0x1f')]?_0x3bac1c[_0x3f20('0x1f')][_0x3f20('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bac1c[_0x3f20('0x1f')]?_0x3bac1c['options'][_0x3f20('0x21')]||null:null,'attributes':_0x3bac1c[_0x3f20('0x1f')]?_0x3bac1c[_0x3f20('0x1f')]['attributes']||null:null,'limit':_0x3bac1c[_0x3f20('0x1f')]?_0x3bac1c[_0x3f20('0x1f')][_0x3f20('0x22')]||null:null})[_0x3f20('0x11')](function(_0x1a6c1f){logger['info'](_0x3f20('0x1b'),_0x3bac1c);logger[_0x3f20('0x13')](_0x3f20('0x1b'),_0x3bac1c,JSON[_0x3f20('0x23')](_0x1a6c1f));_0xac8834(_0x1a6c1f);})[_0x3f20('0x24')](function(_0x547420){logger[_0x3f20('0x16')](_0x3f20('0x1b'),_0x547420[_0x3f20('0x19')],_0x3bac1c);_0x189b33(_0x5764ef[_0x3f20('0x16')](0x1f4,_0x547420[_0x3f20('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1d59d5){return new Promise(function(_0xcddb82,_0x1c9a2d){return db[_0x3f20('0x1c')][_0x3f20('0x25')]({'where':_0x1d59d5[_0x3f20('0x1f')]?_0x1d59d5['options'][_0x3f20('0x21')]||null:null})[_0x3f20('0x11')](function(_0x3d0c1a){if(_0x3d0c1a){return _0x3d0c1a['addTags'](_0x1d59d5[_0x3f20('0x1e')][_0x3f20('0x26')],_['omit'](_0x1d59d5['body'],[_0x3f20('0x26'),'id'])||{});}})[_0x3f20('0x27')](function(_0x171e41){logger[_0x3f20('0x12')](_0x3f20('0x28'),_0x1d59d5);logger[_0x3f20('0x13')](_0x3f20('0x28'),_0x1d59d5,JSON[_0x3f20('0x23')](_0x171e41));_0xcddb82(_0x171e41);})['catch'](function(_0x4fe332){logger[_0x3f20('0x16')](_0x3f20('0x28'),_0x4fe332[_0x3f20('0x19')],_0x1d59d5);_0x1c9a2d(_this[_0x3f20('0x16')](0x1f4,_0x4fe332[_0x3f20('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e7a648d..2a8b86b 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 _0xe609=['update','length','whatsappInteraction:','save'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0xe609,0x123));var _0x9e60=function(_0x380d90,_0x4f711d){_0x380d90=_0x380d90-0x0;var _0x1ff262=_0xe609[_0x380d90];return _0x1ff262;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x9e60('0x0'),'remove',_0x9e60('0x1')];function createListener(_0xf85e3b,_0x2effbc){return function(_0x162056){_0x2effbc['emit'](_0xf85e3b,_0x162056);};}function removeListener(_0x458dd4,_0x2580d3){return function(){WhatsappInteractionEvents['removeListener'](_0x458dd4,_0x2580d3);};}exports['register']=function(_0x560b15){for(var _0x3c3e58=0x0,_0x3d7acb=events[_0x9e60('0x2')];_0x3c3e58<_0x3d7acb;_0x3c3e58++){var _0x37bb10=events[_0x3c3e58];var _0x4f90ff=createListener(_0x9e60('0x3')+_0x37bb10,_0x560b15);WhatsappInteractionEvents['on'](_0x37bb10,_0x4f90ff);}}; \ No newline at end of file +var _0xbabc=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xbabc,0x83));var _0xcbab=function(_0x18a378,_0x46dc75){_0x18a378=_0x18a378-0x0;var _0x23760a=_0xbabc[_0x18a378];return _0x23760a;};'use strict';var WhatsappInteractionEvents=require(_0xcbab('0x0'));var events=[_0xcbab('0x1'),_0xcbab('0x2'),_0xcbab('0x3')];function createListener(_0x365197,_0x2c2a0){return function(_0x310bb8){_0x2c2a0[_0xcbab('0x4')](_0x365197,_0x310bb8);};}function removeListener(_0xa5b56e,_0x523f9c){return function(){WhatsappInteractionEvents['removeListener'](_0xa5b56e,_0x523f9c);};}exports[_0xcbab('0x5')]=function(_0x287adf){for(var _0x79b1ee=0x0,_0x17ce0d=events[_0xcbab('0x6')];_0x79b1ee<_0x17ce0d;_0x79b1ee++){var _0x4f498c=events[_0x79b1ee];var _0x56ed32=createListener(_0xcbab('0x7')+_0x4f498c,_0x287adf);WhatsappInteractionEvents['on'](_0x4f498c,_0x56ed32);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2481cfb..fca9aee 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 _0xee72=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','accept'];(function(_0x1b4488,_0x35a266){var _0x28c9f5=function(_0x2242d6){while(--_0x2242d6){_0x1b4488['push'](_0x1b4488['shift']());}};_0x28c9f5(++_0x35a266);}(_0xee72,0x130));var _0x2ee7=function(_0x2340fd,_0x29b751){_0x2340fd=_0x2340fd-0x0;var _0x2af49e=_0xee72[_0x2340fd];return _0x2af49e;};'use strict';var multer=require(_0x2ee7('0x0'));var util=require(_0x2ee7('0x1'));var path=require(_0x2ee7('0x2'));var timeout=require(_0x2ee7('0x3'));var express=require(_0x2ee7('0x4'));var router=express[_0x2ee7('0x5')]();var auth=require(_0x2ee7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2ee7('0x7'));router[_0x2ee7('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ee7('0x9')]);router[_0x2ee7('0x8')](_0x2ee7('0xa'),auth[_0x2ee7('0xb')](),controller[_0x2ee7('0xc')]);router[_0x2ee7('0x8')](_0x2ee7('0xd'),auth[_0x2ee7('0xb')](),controller[_0x2ee7('0xe')]);router[_0x2ee7('0xf')]('/',auth[_0x2ee7('0xb')](),interaction[_0x2ee7('0x10')](_0x2ee7('0x11'),_0x2ee7('0x12')),controller['create']);router[_0x2ee7('0xf')](_0x2ee7('0x13'),controller['status']);router['put'](_0x2ee7('0xd'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x2ee7('0x14')]);router[_0x2ee7('0x15')]('/:id/reject',auth[_0x2ee7('0xb')](),controller['reject']);router[_0x2ee7('0x16')](_0x2ee7('0xd'),auth['isAuthenticated'](),controller[_0x2ee7('0x17')]);module[_0x2ee7('0x18')]=router; \ No newline at end of file +var _0x4372=['post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','/:id','update','put','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','/describe'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0x4372,0x12e));var _0x2437=function(_0x466aeb,_0x3a35bf){_0x466aeb=_0x466aeb-0x0;var _0x57818e=_0x4372[_0x466aeb];return _0x57818e;};'use strict';var multer=require(_0x2437('0x0'));var util=require(_0x2437('0x1'));var path=require(_0x2437('0x2'));var timeout=require(_0x2437('0x3'));var express=require('express');var router=express[_0x2437('0x4')]();var auth=require(_0x2437('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2437('0x6'));var controller=require(_0x2437('0x7'));router['get']('/',auth[_0x2437('0x8')](),controller['index']);router['get'](_0x2437('0x9'),auth[_0x2437('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2437('0xa')]('/',auth[_0x2437('0x8')](),interaction[_0x2437('0xb')](_0x2437('0xc'),_0x2437('0xd')),controller[_0x2437('0xe')]);router[_0x2437('0xa')](_0x2437('0xf'),controller['status']);router['put'](_0x2437('0x10'),auth['isAuthenticated'](),controller[_0x2437('0x11')]);router[_0x2437('0x12')](_0x2437('0x13'),auth['isAuthenticated'](),controller[_0x2437('0x14')]);router[_0x2437('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x2437('0x15')]);router[_0x2437('0x16')](_0x2437('0x10'),auth['isAuthenticated'](),controller[_0x2437('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 010461f..363f58a 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 _0x7bb9=['sequelize','exports','medium','ENUM','out','DATE','BOOLEAN','TEXT'];(function(_0x44f0a1,_0x457d11){var _0x4af42e=function(_0x15fcbf){while(--_0x15fcbf){_0x44f0a1['push'](_0x44f0a1['shift']());}};_0x4af42e(++_0x457d11);}(_0x7bb9,0xd0));var _0x97bb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7bb9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x97bb('0x0'));module[_0x97bb('0x1')]={'body':{'type':Sequelize['TEXT'](_0x97bb('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x97bb('0x3')]('in',_0x97bb('0x4')),'defaultValue':_0x97bb('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x97bb('0x5')]},'secret':{'type':Sequelize[_0x97bb('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x97bb('0x7')]}}; \ No newline at end of file +var _0x2a1a=['exports','TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x2a1a,0x19f));var _0xa2a1=function(_0x811e8c,_0x13ff50){_0x811e8c=_0x811e8c-0x0;var _0x1f0138=_0x2a1a[_0x811e8c];return _0x1f0138;};'use strict';var Sequelize=require(_0xa2a1('0x0'));module[_0xa2a1('0x1')]={'body':{'type':Sequelize[_0xa2a1('0x2')](_0xa2a1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa2a1('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa2a1('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa2a1('0x5')]},'readAt':{'type':Sequelize[_0xa2a1('0x6')]},'secret':{'type':Sequelize[_0xa2a1('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6a0f0c1..edd013c 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 _0xe820=['json','count','offset','set','apply','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappMessage','rows','show','params','find','create','body','describe','accept','whatsapp','format','UserId','user','agent','Contact','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','html-pdf','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status'];(function(_0x48ac40,_0x1e3beb){var _0x55df02=function(_0x5e27d6){while(--_0x5e27d6){_0x48ac40['push'](_0x48ac40['shift']());}};_0x55df02(++_0x1e3beb);}(_0xe820,0xd2));var _0x0e82=function(_0x24c474,_0x276b93){_0x24c474=_0x24c474-0x0;var _0x2004e7=_0xe820[_0x24c474];return _0x2004e7;};'use strict';var pdf=require(_0x0e82('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e82('0x2'));var moment=require(_0x0e82('0x3'));var BPromise=require(_0x0e82('0x4'));var Mustache=require('mustache');var util=require(_0x0e82('0x5'));var path=require('path');var sox=require(_0x0e82('0x6'));var csv=require(_0x0e82('0x7'));var ejs=require(_0x0e82('0x8'));var fs=require('fs');var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x7'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];config[_0x0e82('0x18')]=_[_0x0e82('0x19')](config[_0x0e82('0x18')],{'host':_0x0e82('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e82('0x18')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x0e82('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x0e82('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4d1aa0,_0x585b9b,_0x1149b1,_0x582f45){return new BPromise(function(_0x319303,_0x39cf23){var _0x233c6d=_0x582f45||client;return _0x233c6d[_0x0e82('0x1d')](_0x4d1aa0,_0x1149b1)['then'](function(_0x25ac21){logger[_0x0e82('0x1e')](_0x0e82('0x1f'),_0x585b9b,_0x0e82('0x20'));logger[_0x0e82('0x21')](_0x0e82('0x22'),_0x585b9b,_0x0e82('0x20'),JSON[_0x0e82('0x23')](_0x25ac21));if(_0x25ac21[_0x0e82('0x24')]){if(_0x25ac21[_0x0e82('0x24')][_0x0e82('0x25')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x585b9b,_0x25ac21[_0x0e82('0x24')][_0x0e82('0x26')]);return _0x39cf23(_0x25ac21[_0x0e82('0x24')][_0x0e82('0x26')]);}logger[_0x0e82('0x24')](_0x0e82('0x1f'),_0x585b9b,_0x25ac21[_0x0e82('0x24')][_0x0e82('0x26')]);return _0x319303(_0x25ac21['error'][_0x0e82('0x26')]);}else{logger[_0x0e82('0x1e')](_0x0e82('0x1f'),_0x585b9b,_0x0e82('0x20'));_0x319303(_0x25ac21['result'][_0x0e82('0x26')]);}})[_0x0e82('0x27')](function(_0x7a9399){logger[_0x0e82('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x585b9b,_0x7a9399);_0x39cf23(_0x7a9399);});});}function respondWithStatusCode(_0x1ef751,_0x51dbcd){_0x51dbcd=_0x51dbcd||0xcc;return function(_0x595319){if(_0x595319){return _0x1ef751[_0x0e82('0x28')](_0x51dbcd);}return _0x1ef751[_0x0e82('0x29')](_0x51dbcd)['end']();};}function respondWithResult(_0x19b96d,_0xe3c530){_0xe3c530=_0xe3c530||0xc8;return function(_0x149e7e){if(_0x149e7e){return _0x19b96d['status'](_0xe3c530)[_0x0e82('0x2a')](_0x149e7e);}};}function respondWithFilteredResult(_0x25fa4e,_0x4ee65a){return function(_0xabc536){if(_0xabc536){var _0x59a5b6=_0xabc536[_0x0e82('0x2b')],_0x4300f9=_0x4ee65a[_0x0e82('0x2c')],_0x3ec302=_0x4ee65a[_0x0e82('0x2c')]+_0x4ee65a['limit'],_0x551f96;if(_0x3ec302>=_0x59a5b6){_0x3ec302=_0x59a5b6;_0x551f96=0xc8;}else{_0x551f96=0xce;}_0x25fa4e['status'](_0x551f96);return _0x25fa4e[_0x0e82('0x2d')]('Content-Range',_0x4300f9+'-'+_0x3ec302+'/'+_0x59a5b6)[_0x0e82('0x2a')](_0xabc536);}return null;};}function patchUpdates(_0x581fe3){return function(_0x1a3b2e){try{jsonpatch[_0x0e82('0x2e')](_0x1a3b2e,_0x581fe3,!![]);}catch(_0x44e177){return BPromise['reject'](_0x44e177);}return _0x1a3b2e[_0x0e82('0x2f')]();};}function saveUpdates(_0x59d2f8,_0x3bf19c){return function(_0x2228a1){if(_0x2228a1){return _0x2228a1[_0x0e82('0x30')](_0x59d2f8)[_0x0e82('0x31')](function(_0x44eefb){return _0x44eefb;});}return null;};}function removeEntity(_0x53ce82,_0x524276){return function(_0x433fc4){if(_0x433fc4){return _0x433fc4[_0x0e82('0x32')]()[_0x0e82('0x31')](function(){_0x53ce82[_0x0e82('0x29')](0xcc)[_0x0e82('0x33')]();});}};}function handleEntityNotFound(_0x2a80e2,_0x399f16){return function(_0x4bf80){if(!_0x4bf80){_0x2a80e2[_0x0e82('0x28')](0x194);}return _0x4bf80;};}function handleError(_0x193d03,_0x3ac1a5){_0x3ac1a5=_0x3ac1a5||0x1f4;return function(_0x1a77a3){logger[_0x0e82('0x24')](_0x1a77a3[_0x0e82('0x34')]);if(_0x1a77a3[_0x0e82('0x35')]){delete _0x1a77a3['name'];}_0x193d03[_0x0e82('0x29')](_0x3ac1a5)[_0x0e82('0x36')](_0x1a77a3);};}exports[_0x0e82('0x37')]=function(_0xf89a19,_0x5c9a44){var _0x21cc1b={},_0x23c08f={},_0x513515={'count':0x0,'rows':[]};var _0xd7ad2f=_['map'](db['WhatsappMessage'][_0x0e82('0x38')],function(_0x1a77c3){return{'name':_0x1a77c3[_0x0e82('0x39')],'type':_0x1a77c3[_0x0e82('0x3a')][_0x0e82('0x3b')]};});_0x23c08f[_0x0e82('0x3c')]=_[_0x0e82('0x3d')](_0xd7ad2f,'name');_0x23c08f['query']=_[_0x0e82('0x3e')](_0xf89a19[_0x0e82('0x3f')]);_0x23c08f[_0x0e82('0x40')]=_[_0x0e82('0x41')](_0x23c08f[_0x0e82('0x3c')],_0x23c08f[_0x0e82('0x3f')]);_0x21cc1b[_0x0e82('0x42')]=_[_0x0e82('0x41')](_0x23c08f['model'],qs[_0x0e82('0x43')](_0xf89a19[_0x0e82('0x3f')][_0x0e82('0x43')]));_0x21cc1b[_0x0e82('0x42')]=_0x21cc1b[_0x0e82('0x42')][_0x0e82('0x44')]?_0x21cc1b[_0x0e82('0x42')]:_0x23c08f['model'];if(!_0xf89a19[_0x0e82('0x3f')][_0x0e82('0x45')](_0x0e82('0x46'))){_0x21cc1b[_0x0e82('0x47')]=qs[_0x0e82('0x47')](_0xf89a19[_0x0e82('0x3f')][_0x0e82('0x47')]);_0x21cc1b['offset']=qs['offset'](_0xf89a19['query']['offset']);}_0x21cc1b['order']=qs['sort'](_0xf89a19[_0x0e82('0x3f')][_0x0e82('0x48')]);_0x21cc1b[_0x0e82('0x49')]=qs[_0x0e82('0x40')](_[_0x0e82('0x4a')](_0xf89a19[_0x0e82('0x3f')],_0x23c08f[_0x0e82('0x40')]),_0xd7ad2f);if(_0xf89a19[_0x0e82('0x3f')]['filter']){_0x21cc1b['where']=_[_0x0e82('0x4b')](_0x21cc1b[_0x0e82('0x49')],{'$or':_[_0x0e82('0x3d')](_0xd7ad2f,function(_0xffce81){if(_0xffce81[_0x0e82('0x3a')]!==_0x0e82('0x4c')){var _0x92f666={};_0x92f666[_0xffce81[_0x0e82('0x35')]]={'$like':'%'+_0xf89a19['query'][_0x0e82('0x4d')]+'%'};return _0x92f666;}})});}_0x21cc1b=_['merge']({},_0x21cc1b,_0xf89a19[_0x0e82('0x4e')]);var _0x47f955={'where':_0x21cc1b[_0x0e82('0x49')]};return db['WhatsappMessage'][_0x0e82('0x2b')](_0x47f955)[_0x0e82('0x31')](function(_0x1cf031){_0x513515['count']=_0x1cf031;if(_0xf89a19['query'][_0x0e82('0x4f')]){_0x21cc1b[_0x0e82('0x50')]=[{'all':!![]}];}return db[_0x0e82('0x51')]['findAll'](_0x21cc1b);})[_0x0e82('0x31')](function(_0x508981){_0x513515[_0x0e82('0x52')]=_0x508981;return _0x513515;})[_0x0e82('0x31')](respondWithFilteredResult(_0x5c9a44,_0x21cc1b))[_0x0e82('0x27')](handleError(_0x5c9a44,null));};exports[_0x0e82('0x53')]=function(_0x392608,_0x2f22b7){var _0x27f59f={'raw':!![],'where':{'id':_0x392608[_0x0e82('0x54')]['id']}},_0x43df7d={};_0x43df7d[_0x0e82('0x3c')]=_[_0x0e82('0x3e')](db[_0x0e82('0x51')]['rawAttributes']);_0x43df7d[_0x0e82('0x3f')]=_[_0x0e82('0x3e')](_0x392608['query']);_0x43df7d[_0x0e82('0x40')]=_['intersection'](_0x43df7d['model'],_0x43df7d[_0x0e82('0x3f')]);_0x27f59f['attributes']=_[_0x0e82('0x41')](_0x43df7d[_0x0e82('0x3c')],qs[_0x0e82('0x43')](_0x392608[_0x0e82('0x3f')][_0x0e82('0x43')]));_0x27f59f['attributes']=_0x27f59f[_0x0e82('0x42')]['length']?_0x27f59f[_0x0e82('0x42')]:_0x43df7d[_0x0e82('0x3c')];if(_0x392608[_0x0e82('0x3f')][_0x0e82('0x4f')]){_0x27f59f[_0x0e82('0x50')]=[{'all':!![]}];}_0x27f59f=_['merge']({},_0x27f59f,_0x392608[_0x0e82('0x4e')]);return db[_0x0e82('0x51')][_0x0e82('0x55')](_0x27f59f)[_0x0e82('0x31')](handleEntityNotFound(_0x2f22b7,null))[_0x0e82('0x31')](respondWithResult(_0x2f22b7,null))['catch'](handleError(_0x2f22b7,null));};exports[_0x0e82('0x56')]=function(_0x348b00,_0x2cb523){return db[_0x0e82('0x51')][_0x0e82('0x56')](_0x348b00[_0x0e82('0x57')],{})[_0x0e82('0x31')](respondWithResult(_0x2cb523,0xc9))[_0x0e82('0x27')](handleError(_0x2cb523,null));};exports[_0x0e82('0x30')]=function(_0x2852d4,_0x4cc3fd){if(_0x2852d4['body']['id']){delete _0x2852d4['body']['id'];}return db[_0x0e82('0x51')]['find']({'where':{'id':_0x2852d4[_0x0e82('0x54')]['id']}})[_0x0e82('0x31')](handleEntityNotFound(_0x4cc3fd,null))['then'](saveUpdates(_0x2852d4['body'],null))[_0x0e82('0x31')](respondWithResult(_0x4cc3fd,null))[_0x0e82('0x27')](handleError(_0x4cc3fd,null));};exports[_0x0e82('0x32')]=function(_0x1678a6,_0x174da5){return db[_0x0e82('0x51')][_0x0e82('0x55')]({'where':{'id':_0x1678a6[_0x0e82('0x54')]['id']}})[_0x0e82('0x31')](handleEntityNotFound(_0x174da5,null))[_0x0e82('0x31')](removeEntity(_0x174da5,null))['catch'](handleError(_0x174da5,null));};exports[_0x0e82('0x58')]=function(_0x21aaac,_0x391303){return db[_0x0e82('0x51')][_0x0e82('0x58')]()[_0x0e82('0x31')](respondWithResult(_0x391303,null))[_0x0e82('0x27')](handleError(_0x391303,null));};var interaction_log=require(_0x0e82('0x13'))('whatsapp-interactions');exports[_0x0e82('0x59')]=function(_0x3c7e1a,_0x31c66e,_0x1ea2fc){var _0x21c870={'agent':{},'channel':_0x0e82('0x5a')};if(_0x3c7e1a[_0x0e82('0x57')]['id']){delete _0x3c7e1a[_0x0e82('0x57')]['id'];}_0x3c7e1a[_0x0e82('0x57')]['read']=!![];_0x3c7e1a[_0x0e82('0x57')]['readAt']=moment()[_0x0e82('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c7e1a[_0x0e82('0x57')][_0x0e82('0x5c')]=_0x3c7e1a['body'][_0x0e82('0x5c')]||_0x3c7e1a[_0x0e82('0x5d')]['id'];_0x21c870[_0x0e82('0x5e')]['id']=_0x3c7e1a[_0x0e82('0x57')][_0x0e82('0x5c')];return db['WhatsappMessage'][_0x0e82('0x55')]({'where':{'id':_0x3c7e1a['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0e82('0x5f')}]})[_0x0e82('0x31')](handleEntityNotFound(_0x31c66e,null))[_0x0e82('0x31')](saveUpdates(_0x3c7e1a[_0x0e82('0x57')],null))[_0x0e82('0x31')](function(_0xa4fe1f){if(_0xa4fe1f){_0x21c870[_0x0e82('0x26')]=_0xa4fe1f[_0x0e82('0x60')]({'plain':!![]});return db[_0x0e82('0x61')][_0x0e82('0x55')]({'where':{'id':_0xa4fe1f['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x31c66e,null))[_0x0e82('0x31')](function(_0x5c461b){if(_0x5c461b){return _0x5c461b[_0x0e82('0x30')]({'UserId':_0x3c7e1a[_0x0e82('0x57')]['UserId'],'read1stAt':_[_0x0e82('0x62')](_0x5c461b[_0x0e82('0x63')])?moment()['format'](_0x0e82('0x64')):undefined});}return null;})[_0x0e82('0x31')](function(_0x4c7d71){if(_0x4c7d71){_0x21c870[_0x0e82('0x65')]=_0x4c7d71['get']({'plain':!![]});interaction_log[_0x0e82('0x1e')](_0x0e82('0x66'),_0x3c7e1a[_0x0e82('0x5d')]['id'],_0x3c7e1a[_0x0e82('0x5d')][_0x0e82('0x35')],_0x3c7e1a[_0x0e82('0x5d')][_0x0e82('0x67')],_0x21c870[_0x0e82('0x65')]['id'],_0x3c7e1a[_0x0e82('0x57')]?JSON[_0x0e82('0x23')](_0x3c7e1a['body']):_0x0e82('0x68'));return respondWithRpcPromise('AcceptMessage',_0x0e82('0x69'),_0x21c870);}return null;})[_0x0e82('0x31')](function(_0x1c8282){if(_0x1c8282){if(_0x3c7e1a['body'][_0x0e82('0x6a')]){_0x21c870[_0x0e82('0x26')][_0x0e82('0x6b')]=util[_0x0e82('0x5b')](_0x0e82('0x6c'),_0x3c7e1a['user'][_0x0e82('0x35')]);_0x21c870['message'][_0x0e82('0x6d')]=_0x21c870[_0x0e82('0x6d')];_0x21c870['message']['event']=_0x0e82('0x59');return respondWithRpcPromise(_0x0e82('0x6e'),_0x0e82('0x6e'),{'event':_0x0e82('0x6f'),'message':_0x21c870[_0x0e82('0x26')]},client9002)[_0x0e82('0x31')](function(){return _0x21c870;});}return _0x21c870;}return null;})[_0x0e82('0x31')](respondWithResult(_0x31c66e,null))[_0x0e82('0x27')](handleError(_0x31c66e,null));};var interaction_log=require(_0x0e82('0x13'))('whatsapp-interactions');exports[_0x0e82('0x70')]=function(_0x328d74,_0x480d15,_0x4e34ba){var _0x5519e6={'agent':{},'channel':_0x0e82('0x5a')};if(_0x328d74[_0x0e82('0x57')]['id']){delete _0x328d74[_0x0e82('0x57')]['id'];}_0x328d74['body'][_0x0e82('0x5c')]=_0x328d74['body'][_0x0e82('0x5c')]||_0x328d74[_0x0e82('0x5d')]['id'];_0x5519e6[_0x0e82('0x5e')]['id']=_0x328d74[_0x0e82('0x57')][_0x0e82('0x5c')];return db['WhatsappMessage'][_0x0e82('0x55')]({'where':{'id':_0x328d74[_0x0e82('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x480d15,null))[_0x0e82('0x31')](function(_0x193b05){if(_0x193b05){_0x5519e6[_0x0e82('0x26')]=_0x193b05['get']({'plain':!![]});return db[_0x0e82('0x61')]['find']({'where':{'id':_0x193b05[_0x0e82('0x71')]}});}return null;})[_0x0e82('0x31')](handleEntityNotFound(_0x480d15,null))[_0x0e82('0x31')](function(_0x5ca20d){if(_0x5ca20d){_0x5519e6[_0x0e82('0x65')]=_0x5ca20d[_0x0e82('0x60')]({'plain':!![]});interaction_log[_0x0e82('0x1e')](_0x0e82('0x72'),_0x328d74['user']['id'],_0x328d74[_0x0e82('0x5d')][_0x0e82('0x35')],_0x328d74[_0x0e82('0x5d')][_0x0e82('0x67')],_0x5519e6[_0x0e82('0x65')]['id'],_0x328d74['body']?JSON[_0x0e82('0x23')](_0x328d74['body']):_0x0e82('0x68'));return respondWithRpcPromise('RejectMessage',_0x0e82('0x73'),_0x5519e6);}return null;})[_0x0e82('0x31')](function(_0x5d8c32){if(_0x5d8c32){_0x5d8c32[_0x0e82('0x26')][_0x0e82('0x6b')]=util[_0x0e82('0x5b')]('SIP/%s',_0x328d74['user']['name']);_0x5d8c32[_0x0e82('0x26')][_0x0e82('0x6d')]=_0x5519e6[_0x0e82('0x6d')];_0x5d8c32['message'][_0x0e82('0x74')]=_0x0e82('0x70');respondWithRpcPromise(_0x0e82('0x6e'),_0x0e82('0x6e'),{'event':_0x0e82('0x75'),'message':_0x5d8c32[_0x0e82('0x26')]},client9002);return _0x5519e6;}return null;})[_0x0e82('0x31')](respondWithResult(_0x480d15,null))[_0x0e82('0x27')](handleError(_0x480d15,null));};exports['status']=function(_0x445d82,_0x384428,_0x2ffc69){if(_0x445d82[_0x0e82('0x57')]['id']){delete _0x445d82[_0x0e82('0x57')]['id'];}var _0x36b423;return db[_0x0e82('0x51')][_0x0e82('0x55')]({'where':{'id':_0x445d82['params']['id']}})[_0x0e82('0x31')](handleEntityNotFound(_0x384428,null))['then'](function(_0x4a9876){if(_0x4a9876){_0x36b423=_0x4a9876;return db['WhatsappAccount'][_0x0e82('0x55')]({'where':{'id':_0x4a9876[_0x0e82('0x76')]}});}})[_0x0e82('0x31')](handleEntityNotFound(_0x384428,null))[_0x0e82('0x31')](function(_0x578457){if(_0x578457){logger[_0x0e82('0x21')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x0e82('0x29'),_0x0e82('0x77'),_0x578457['type'],util[_0x0e82('0x78')](_0x445d82['body'],{'showHidden':![],'depth':null}));switch(_0x578457['type']){case _0x0e82('0x79'):if(_0x445d82[_0x0e82('0x57')]['MessageSid']&&_0x445d82['body'][_0x0e82('0x7a')]===_0x36b423[_0x0e82('0x7b')]&&_0x445d82[_0x0e82('0x57')][_0x0e82('0x7c')]&&_0x445d82[_0x0e82('0x57')][_0x0e82('0x7c')]===_0x0e82('0x7d')){return _0x36b423[_0x0e82('0x30')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x0e82('0x29'),_0x0e82('0x79'),util[_0x0e82('0x78')](_0x445d82[_0x0e82('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x36b423;}})[_0x0e82('0x31')](respondWithResult(_0x384428,null))[_0x0e82('0x27')](handleError(_0x384428,null));}; \ No newline at end of file +var _0xd1ca=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','WhatsappMessage','includeAll','include','findAll','catch','show','model','fields','merge','find','create','body','params','destroy','describe','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','WhatsappInteractionId','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes'];(function(_0x6b0977,_0x5d0abb){var _0x23fa86=function(_0x4e9d23){while(--_0x4e9d23){_0x6b0977['push'](_0x6b0977['shift']());}};_0x23fa86(++_0x5d0abb);}(_0xd1ca,0x140));var _0xad1c=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd1ca[_0x21549c];return _0x426cbd;};'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 licenseUtil=require('../../config/license/util');var db=require(_0xad1c('0x15'))['db'];config[_0xad1c('0x16')]=_[_0xad1c('0x17')](config[_0xad1c('0x16')],{'host':_0xad1c('0x18'),'port':0x18eb});var socket=require(_0xad1c('0x19'))(new Redis(config[_0xad1c('0x16')]));require('./whatsappMessage.socket')[_0xad1c('0x1a')](socket);var jayson=require(_0xad1c('0x1b'));var client=jayson[_0xad1c('0x1c')][_0xad1c('0x1d')]({'port':0x232c});var client9002=jayson[_0xad1c('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4194c0,_0x48c651,_0x2173e5,_0x8420de){return new BPromise(function(_0x4aa785,_0x3b4eef){var _0x5d188a=_0x8420de||client;return _0x5d188a[_0xad1c('0x1e')](_0x4194c0,_0x2173e5)[_0xad1c('0x1f')](function(_0x536fc9){logger['info'](_0xad1c('0x20'),_0x48c651,_0xad1c('0x21'));logger[_0xad1c('0x22')](_0xad1c('0x23'),_0x48c651,'request\x20sent',JSON[_0xad1c('0x24')](_0x536fc9));if(_0x536fc9[_0xad1c('0x25')]){if(_0x536fc9[_0xad1c('0x25')]['code']===0x1f4){logger['error'](_0xad1c('0x20'),_0x48c651,_0x536fc9[_0xad1c('0x25')][_0xad1c('0x26')]);return _0x3b4eef(_0x536fc9[_0xad1c('0x25')][_0xad1c('0x26')]);}logger[_0xad1c('0x25')](_0xad1c('0x20'),_0x48c651,_0x536fc9['error'][_0xad1c('0x26')]);return _0x4aa785(_0x536fc9[_0xad1c('0x25')][_0xad1c('0x26')]);}else{logger[_0xad1c('0x27')](_0xad1c('0x20'),_0x48c651,_0xad1c('0x21'));_0x4aa785(_0x536fc9['result'][_0xad1c('0x26')]);}})['catch'](function(_0x3893a3){logger[_0xad1c('0x25')](_0xad1c('0x20'),_0x48c651,_0x3893a3);_0x3b4eef(_0x3893a3);});});}function respondWithStatusCode(_0x156d04,_0x5951b2){_0x5951b2=_0x5951b2||0xcc;return function(_0x233061){if(_0x233061){return _0x156d04[_0xad1c('0x28')](_0x5951b2);}return _0x156d04[_0xad1c('0x29')](_0x5951b2)[_0xad1c('0x2a')]();};}function respondWithResult(_0x30abaa,_0x5c1203){_0x5c1203=_0x5c1203||0xc8;return function(_0x2a26c0){if(_0x2a26c0){return _0x30abaa['status'](_0x5c1203)[_0xad1c('0x2b')](_0x2a26c0);}};}function respondWithFilteredResult(_0x2a70f9,_0x537965){return function(_0x35406d){if(_0x35406d){var _0x8e1238=_0x35406d[_0xad1c('0x2c')],_0x474f6f=_0x537965['offset'],_0x49c827=_0x537965[_0xad1c('0x2d')]+_0x537965['limit'],_0x5e3bea;if(_0x49c827>=_0x8e1238){_0x49c827=_0x8e1238;_0x5e3bea=0xc8;}else{_0x5e3bea=0xce;}_0x2a70f9[_0xad1c('0x29')](_0x5e3bea);return _0x2a70f9['set'](_0xad1c('0x2e'),_0x474f6f+'-'+_0x49c827+'/'+_0x8e1238)[_0xad1c('0x2b')](_0x35406d);}return null;};}function patchUpdates(_0x322c83){return function(_0x16d271){try{jsonpatch[_0xad1c('0x2f')](_0x16d271,_0x322c83,!![]);}catch(_0xf02aed){return BPromise[_0xad1c('0x30')](_0xf02aed);}return _0x16d271[_0xad1c('0x31')]();};}function saveUpdates(_0x213dcb,_0x2262dc){return function(_0x4bcd3d){if(_0x4bcd3d){return _0x4bcd3d[_0xad1c('0x32')](_0x213dcb)[_0xad1c('0x1f')](function(_0x5484d7){return _0x5484d7;});}return null;};}function removeEntity(_0x1ab428,_0x183e36){return function(_0x320c7c){if(_0x320c7c){return _0x320c7c['destroy']()['then'](function(){_0x1ab428[_0xad1c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c411c,_0x2cc3a){return function(_0x2867d5){if(!_0x2867d5){_0x3c411c[_0xad1c('0x28')](0x194);}return _0x2867d5;};}function handleError(_0x3c51c9,_0x597183){_0x597183=_0x597183||0x1f4;return function(_0x121246){logger[_0xad1c('0x25')](_0x121246[_0xad1c('0x33')]);if(_0x121246[_0xad1c('0x34')]){delete _0x121246[_0xad1c('0x34')];}_0x3c51c9['status'](_0x597183)[_0xad1c('0x35')](_0x121246);};}exports[_0xad1c('0x36')]=function(_0x10aa4b,_0x45969c){var _0x3aa491={},_0x1ff329={},_0x163dd0={'count':0x0,'rows':[]};var _0x28c80e=_[_0xad1c('0x37')](db['WhatsappMessage'][_0xad1c('0x38')],function(_0xae3947){return{'name':_0xae3947[_0xad1c('0x39')],'type':_0xae3947['type'][_0xad1c('0x3a')]};});_0x1ff329['model']=_['map'](_0x28c80e,_0xad1c('0x34'));_0x1ff329[_0xad1c('0x3b')]=_[_0xad1c('0x3c')](_0x10aa4b[_0xad1c('0x3b')]);_0x1ff329[_0xad1c('0x3d')]=_[_0xad1c('0x3e')](_0x1ff329['model'],_0x1ff329[_0xad1c('0x3b')]);_0x3aa491[_0xad1c('0x3f')]=_[_0xad1c('0x3e')](_0x1ff329['model'],qs['fields'](_0x10aa4b[_0xad1c('0x3b')]['fields']));_0x3aa491[_0xad1c('0x3f')]=_0x3aa491[_0xad1c('0x3f')][_0xad1c('0x40')]?_0x3aa491[_0xad1c('0x3f')]:_0x1ff329['model'];if(!_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x41')](_0xad1c('0x42'))){_0x3aa491[_0xad1c('0x43')]=qs[_0xad1c('0x43')](_0x10aa4b['query']['limit']);_0x3aa491['offset']=qs[_0xad1c('0x2d')](_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x2d')]);}_0x3aa491[_0xad1c('0x44')]=qs[_0xad1c('0x45')](_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x45')]);_0x3aa491[_0xad1c('0x46')]=qs[_0xad1c('0x3d')](_[_0xad1c('0x47')](_0x10aa4b[_0xad1c('0x3b')],_0x1ff329[_0xad1c('0x3d')]),_0x28c80e);if(_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x48')]){_0x3aa491[_0xad1c('0x46')]=_['merge'](_0x3aa491[_0xad1c('0x46')],{'$or':_['map'](_0x28c80e,function(_0x2ad411){if(_0x2ad411[_0xad1c('0x49')]!==_0xad1c('0x4a')){var _0x411c15={};_0x411c15[_0x2ad411[_0xad1c('0x34')]]={'$like':'%'+_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x48')]+'%'};return _0x411c15;}})});}_0x3aa491=_['merge']({},_0x3aa491,_0x10aa4b['options']);var _0x163d3b={'where':_0x3aa491[_0xad1c('0x46')]};return db[_0xad1c('0x4b')]['count'](_0x163d3b)[_0xad1c('0x1f')](function(_0x5690e0){_0x163dd0['count']=_0x5690e0;if(_0x10aa4b[_0xad1c('0x3b')][_0xad1c('0x4c')]){_0x3aa491[_0xad1c('0x4d')]=[{'all':!![]}];}return db[_0xad1c('0x4b')][_0xad1c('0x4e')](_0x3aa491);})[_0xad1c('0x1f')](function(_0x3bc23f){_0x163dd0['rows']=_0x3bc23f;return _0x163dd0;})['then'](respondWithFilteredResult(_0x45969c,_0x3aa491))[_0xad1c('0x4f')](handleError(_0x45969c,null));};exports[_0xad1c('0x50')]=function(_0x15b55a,_0x81f42c){var _0x2450d1={'raw':!![],'where':{'id':_0x15b55a['params']['id']}},_0x2c8ac8={};_0x2c8ac8[_0xad1c('0x51')]=_[_0xad1c('0x3c')](db[_0xad1c('0x4b')][_0xad1c('0x38')]);_0x2c8ac8[_0xad1c('0x3b')]=_[_0xad1c('0x3c')](_0x15b55a[_0xad1c('0x3b')]);_0x2c8ac8[_0xad1c('0x3d')]=_['intersection'](_0x2c8ac8[_0xad1c('0x51')],_0x2c8ac8['query']);_0x2450d1['attributes']=_[_0xad1c('0x3e')](_0x2c8ac8['model'],qs[_0xad1c('0x52')](_0x15b55a[_0xad1c('0x3b')][_0xad1c('0x52')]));_0x2450d1[_0xad1c('0x3f')]=_0x2450d1[_0xad1c('0x3f')][_0xad1c('0x40')]?_0x2450d1[_0xad1c('0x3f')]:_0x2c8ac8[_0xad1c('0x51')];if(_0x15b55a[_0xad1c('0x3b')][_0xad1c('0x4c')]){_0x2450d1[_0xad1c('0x4d')]=[{'all':!![]}];}_0x2450d1=_[_0xad1c('0x53')]({},_0x2450d1,_0x15b55a['options']);return db['WhatsappMessage'][_0xad1c('0x54')](_0x2450d1)[_0xad1c('0x1f')](handleEntityNotFound(_0x81f42c,null))[_0xad1c('0x1f')](respondWithResult(_0x81f42c,null))[_0xad1c('0x4f')](handleError(_0x81f42c,null));};exports[_0xad1c('0x55')]=function(_0x40c3cb,_0x4648c2){return db[_0xad1c('0x4b')][_0xad1c('0x55')](_0x40c3cb[_0xad1c('0x56')],{})['then'](respondWithResult(_0x4648c2,0xc9))[_0xad1c('0x4f')](handleError(_0x4648c2,null));};exports[_0xad1c('0x32')]=function(_0x597df9,_0x1fd99d){if(_0x597df9[_0xad1c('0x56')]['id']){delete _0x597df9['body']['id'];}return db[_0xad1c('0x4b')][_0xad1c('0x54')]({'where':{'id':_0x597df9[_0xad1c('0x57')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x1fd99d,null))['then'](saveUpdates(_0x597df9[_0xad1c('0x56')],null))[_0xad1c('0x1f')](respondWithResult(_0x1fd99d,null))[_0xad1c('0x4f')](handleError(_0x1fd99d,null));};exports[_0xad1c('0x58')]=function(_0x5ed918,_0x33655d){return db[_0xad1c('0x4b')][_0xad1c('0x54')]({'where':{'id':_0x5ed918[_0xad1c('0x57')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x33655d,null))[_0xad1c('0x1f')](removeEntity(_0x33655d,null))['catch'](handleError(_0x33655d,null));};exports['describe']=function(_0x160ef8,_0x15265f){return db[_0xad1c('0x4b')][_0xad1c('0x59')]()[_0xad1c('0x1f')](respondWithResult(_0x15265f,null))[_0xad1c('0x4f')](handleError(_0x15265f,null));};var interaction_log=require(_0xad1c('0x12'))('whatsapp-interactions');exports['accept']=function(_0x5b37e5,_0x12906a,_0xc1127){var _0x4bc163={'agent':{},'channel':'whatsapp'};if(_0x5b37e5[_0xad1c('0x56')]['id']){delete _0x5b37e5[_0xad1c('0x56')]['id'];}_0x5b37e5[_0xad1c('0x56')]['read']=!![];_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x5a')]=moment()[_0xad1c('0x5b')](_0xad1c('0x5c'));_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x5d')]=_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x5d')]||_0x5b37e5[_0xad1c('0x5e')]['id'];_0x4bc163[_0xad1c('0x5f')]['id']=_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x5d')];return db[_0xad1c('0x4b')][_0xad1c('0x54')]({'where':{'id':_0x5b37e5[_0xad1c('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xad1c('0x60')}]})[_0xad1c('0x1f')](handleEntityNotFound(_0x12906a,null))[_0xad1c('0x1f')](saveUpdates(_0x5b37e5['body'],null))['then'](function(_0x40a77b){if(_0x40a77b){_0x4bc163[_0xad1c('0x26')]=_0x40a77b['get']({'plain':!![]});return db['WhatsappInteraction'][_0xad1c('0x54')]({'where':{'id':_0x40a77b[_0xad1c('0x61')]}});}return null;})[_0xad1c('0x1f')](handleEntityNotFound(_0x12906a,null))['then'](function(_0x11ec79){if(_0x11ec79){return _0x11ec79[_0xad1c('0x32')]({'UserId':_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x5d')],'read1stAt':_[_0xad1c('0x62')](_0x11ec79['read1stAt'])?moment()[_0xad1c('0x5b')](_0xad1c('0x5c')):undefined});}return null;})[_0xad1c('0x1f')](function(_0x1c7ade){if(_0x1c7ade){_0x4bc163[_0xad1c('0x63')]=_0x1c7ade[_0xad1c('0x64')]({'plain':!![]});interaction_log[_0xad1c('0x27')](_0xad1c('0x65'),_0x5b37e5[_0xad1c('0x5e')]['id'],_0x5b37e5['user'][_0xad1c('0x34')],_0x5b37e5[_0xad1c('0x5e')][_0xad1c('0x66')],_0x4bc163[_0xad1c('0x63')]['id'],_0x5b37e5['body']?JSON['stringify'](_0x5b37e5[_0xad1c('0x56')]):_0xad1c('0x67'));return respondWithRpcPromise('AcceptMessage',_0xad1c('0x68'),_0x4bc163);}return null;})['then'](function(_0x244511){if(_0x244511){if(_0x5b37e5[_0xad1c('0x56')][_0xad1c('0x69')]){_0x4bc163[_0xad1c('0x26')][_0xad1c('0x6a')]=util[_0xad1c('0x5b')](_0xad1c('0x6b'),_0x5b37e5[_0xad1c('0x5e')][_0xad1c('0x34')]);_0x4bc163[_0xad1c('0x26')][_0xad1c('0x6c')]=_0x4bc163[_0xad1c('0x6c')];_0x4bc163[_0xad1c('0x26')][_0xad1c('0x6d')]=_0xad1c('0x6e');return respondWithRpcPromise(_0xad1c('0x6f'),_0xad1c('0x6f'),{'event':_0xad1c('0x70'),'message':_0x4bc163[_0xad1c('0x26')]},client9002)[_0xad1c('0x1f')](function(){return _0x4bc163;});}return _0x4bc163;}return null;})[_0xad1c('0x1f')](respondWithResult(_0x12906a,null))['catch'](handleError(_0x12906a,null));};var interaction_log=require(_0xad1c('0x12'))('whatsapp-interactions');exports['reject']=function(_0x463101,_0x27b404,_0x5afebd){var _0x46cce5={'agent':{},'channel':_0xad1c('0x71')};if(_0x463101['body']['id']){delete _0x463101[_0xad1c('0x56')]['id'];}_0x463101['body']['UserId']=_0x463101[_0xad1c('0x56')]['UserId']||_0x463101[_0xad1c('0x5e')]['id'];_0x46cce5[_0xad1c('0x5f')]['id']=_0x463101[_0xad1c('0x56')][_0xad1c('0x5d')];return db[_0xad1c('0x4b')]['find']({'where':{'id':_0x463101['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27b404,null))[_0xad1c('0x1f')](function(_0x218f1c){if(_0x218f1c){_0x46cce5['message']=_0x218f1c['get']({'plain':!![]});return db[_0xad1c('0x72')][_0xad1c('0x54')]({'where':{'id':_0x218f1c['WhatsappInteractionId']}});}return null;})[_0xad1c('0x1f')](handleEntityNotFound(_0x27b404,null))[_0xad1c('0x1f')](function(_0x43170a){if(_0x43170a){_0x46cce5[_0xad1c('0x63')]=_0x43170a[_0xad1c('0x64')]({'plain':!![]});interaction_log[_0xad1c('0x27')](_0xad1c('0x73'),_0x463101[_0xad1c('0x5e')]['id'],_0x463101[_0xad1c('0x5e')][_0xad1c('0x34')],_0x463101['user'][_0xad1c('0x66')],_0x46cce5['interaction']['id'],_0x463101['body']?JSON['stringify'](_0x463101['body']):_0xad1c('0x67'));return respondWithRpcPromise(_0xad1c('0x74'),_0xad1c('0x75'),_0x46cce5);}return null;})[_0xad1c('0x1f')](function(_0x572869){if(_0x572869){_0x572869[_0xad1c('0x26')][_0xad1c('0x6a')]=util[_0xad1c('0x5b')](_0xad1c('0x6b'),_0x463101['user']['name']);_0x572869[_0xad1c('0x26')][_0xad1c('0x6c')]=_0x46cce5['channel'];_0x572869[_0xad1c('0x26')][_0xad1c('0x6d')]=_0xad1c('0x30');respondWithRpcPromise(_0xad1c('0x6f'),_0xad1c('0x6f'),{'event':_0xad1c('0x76'),'message':_0x572869[_0xad1c('0x26')]},client9002);return _0x46cce5;}return null;})[_0xad1c('0x1f')](respondWithResult(_0x27b404,null))[_0xad1c('0x4f')](handleError(_0x27b404,null));};exports[_0xad1c('0x29')]=function(_0x565a15,_0x39911f,_0x16034d){if(_0x565a15[_0xad1c('0x56')]['id']){delete _0x565a15['body']['id'];}var _0x4b9b25;return db[_0xad1c('0x4b')]['find']({'where':{'id':_0x565a15[_0xad1c('0x57')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x39911f,null))['then'](function(_0xf05993){if(_0xf05993){_0x4b9b25=_0xf05993;return db[_0xad1c('0x77')][_0xad1c('0x54')]({'where':{'id':_0xf05993[_0xad1c('0x78')]}});}})['then'](handleEntityNotFound(_0x39911f,null))[_0xad1c('0x1f')](function(_0x17d055){if(_0x17d055){logger[_0xad1c('0x22')](_0xad1c('0x79'),_0xad1c('0x29'),'received\x20delivery\x20report\x20from',_0x17d055[_0xad1c('0x49')],util[_0xad1c('0x7a')](_0x565a15[_0xad1c('0x56')],{'showHidden':![],'depth':null}));switch(_0x17d055[_0xad1c('0x49')]){case'twilio':if(_0x565a15[_0xad1c('0x56')][_0xad1c('0x7b')]&&_0x565a15['body']['MessageSid']===_0x4b9b25[_0xad1c('0x7c')]&&_0x565a15['body'][_0xad1c('0x7d')]&&_0x565a15[_0xad1c('0x56')][_0xad1c('0x7d')]===_0xad1c('0x7e')){return _0x4b9b25[_0xad1c('0x32')]({'read':!![]});}else{logger['error'](_0xad1c('0x7f'),_0xad1c('0x29'),'twilio',util['inspect'](_0x565a15['body'],{'showHidden':![],'depth':null}));}break;}return _0x4b9b25;}})[_0xad1c('0x1f')](respondWithResult(_0x39911f,null))[_0xad1c('0x4f')](handleError(_0x39911f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 31bc6d6..2b11222 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(_0x20df63,_0xabaf1f){var _0x449bcc=function(_0x46da6a){while(--_0x46da6a){_0x20df63['push'](_0x20df63['shift']());}};_0x449bcc(++_0xabaf1f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ebcdd,_0xe7253d){_0x4ebcdd=_0x4ebcdd-0x0;var _0x4e6f65=_0x5f2f[_0x4ebcdd];return _0x4e6f65;};'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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4058ce,_0x4ff401){var _0x3aa30e=function(_0x5ed456){while(--_0x5ed456){_0x4058ce['push'](_0x4058ce['shift']());}};_0x3aa30e(++_0x4ff401);}(_0x7a54,0x106));var _0x47a5=function(_0x59af0f,_0x3bc64e){_0x59af0f=_0x59af0f-0x0;var _0x44888f=_0x7a54[_0x59af0f];return _0x44888f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 70f938c..4a7bcf5 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 _0x89d3=['/status?token=','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','find','type','twilio','accountSid','phone','authToken','whatsapp:','remote','/api/whatsapp/messages/'];(function(_0x48e6ae,_0xfc5987){var _0x2543f4=function(_0xb24826){while(--_0xb24826){_0x48e6ae['push'](_0x48e6ae['shift']());}};_0x2543f4(++_0xfc5987);}(_0x89d3,0x13f));var _0x389d=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x89d3[_0x507403];return _0x1327c;};'use strict';var _=require(_0x389d('0x0'));var util=require(_0x389d('0x1'));var logger=require(_0x389d('0x2'))(_0x389d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x389d('0x4'));var rimraf=require(_0x389d('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x389d('0x6')]=function(_0x2c37ee,_0x615a13){return _0x2c37ee['define'](_0x389d('0x7'),attributes,{'tableName':_0x389d('0x8'),'paranoid':![],'indexes':[{'name':_0x389d('0x9'),'fields':['messageId']},{'name':_0x389d('0xa'),'fields':[_0x389d('0xb')],'type':_0x389d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2699d8,_0x3229f7,_0x49c942){var _0x4f3324=_0x2c37ee['models'];var _0x7caaec=_0x2699d8[_0x389d('0xd')]({'plain':!![]});if(_0x7caaec['direction'][_0x389d('0xe')]()==='in'||_0x7caaec[_0x389d('0xf')][_0x389d('0xe')]()===_0x389d('0x10')&&!_0x7caaec[_0x389d('0x11')]&&!_['isNil'](_0x7caaec[_0x389d('0x12')])){_0x4f3324[_0x389d('0x13')]['findOne']({'where':{'id':_0x7caaec[_0x389d('0x14')]}})[_0x389d('0x15')](function(_0x1a47b5){if(_0x1a47b5){_0x1a47b5[_0x389d('0x16')]({'lastMsgAt':_0x7caaec['createdAt'],'lastMsgDirection':_0x7caaec[_0x389d('0xf')]['toLowerCase']()});}})[_0x389d('0x17')](function(_0x3438ea){console['error'](_0x3438ea);});}if(_0x7caaec['direction']===_0x389d('0x10')&&!_0x7caaec[_0x389d('0x11')]){var _0x33e708;_0x4f3324['WhatsappAccount'][_0x389d('0x18')]({'where':{'id':_0x7caaec['WhatsappAccountId']},'raw':!![]})[_0x389d('0x15')](function(_0x530816){_0x33e708=_0x530816;if(_0x33e708&&_0x33e708[_0x389d('0x19')]){switch(_0x33e708[_0x389d('0x19')]){case _0x389d('0x1a'):var _0x5c7e43=require(_0x389d('0x1a'));if(_0x33e708[_0x389d('0x1b')]&&_0x33e708['authToken']&&_0x33e708[_0x389d('0x1c')]){var _0x36d4f7=new _0x5c7e43(_0x33e708[_0x389d('0x1b')],_0x33e708[_0x389d('0x1d')]);_0x36d4f7['messages']['create']({'body':_0x7caaec['body'],'to':_0x389d('0x1e')+_0x7caaec[_0x389d('0x1c')],'from':'whatsapp:'+_0x33e708[_0x389d('0x1c')],'statusCallback':_0x33e708[_0x389d('0x1f')]+_0x389d('0x20')+_0x7caaec['id']+_0x389d('0x21')+_0x33e708[_0x389d('0x22')]})[_0x389d('0x15')](function(_0x25e0df){if(_0x25e0df[_0x389d('0x23')]){return _0x2699d8['update']({'messageId':_0x25e0df[_0x389d('0x23')]});}})[_0x389d('0x17')](function(_0x3ed8b7){logger[_0x389d('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x389d('0x25'),_0x389d('0x1a'),util[_0x389d('0x26')](_0x3ed8b7,{'showHidden':![],'depth':null}));});}else{logger[_0x389d('0x24')](_0x389d('0x27'),_0x389d('0x25'),_0x389d('0x1a'),_0x389d('0x28'));}break;}}})[_0x389d('0x29')](function(){_0x49c942();});}else{_0x49c942();}}},'charset':_0x389d('0x2a'),'collate':_0x389d('0x2b')});}; \ No newline at end of file +var _0x2a84=['find','WhatsappAccountId','twilio','accountSid','authToken','phone','whatsapp:','remote','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','toLowerCase','catch','error','out','WhatsappAccount'];(function(_0x431970,_0x3d390b){var _0x3a347a=function(_0x44cb66){while(--_0x44cb66){_0x431970['push'](_0x431970['shift']());}};_0x3a347a(++_0x3d390b);}(_0x2a84,0x170));var _0x42a8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2a84[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var logger=require('../../config/logger')(_0x42a8('0x2'));var moment=require(_0x42a8('0x3'));var BPromise=require(_0x42a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42a8('0x5'));var rimraf=require('rimraf');var config=require(_0x42a8('0x6'));var attributes=require(_0x42a8('0x7'));module[_0x42a8('0x8')]=function(_0x59505e,_0x593b3a){return _0x59505e['define'](_0x42a8('0x9'),attributes,{'tableName':_0x42a8('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x42a8('0xb')]},{'name':_0x42a8('0xc'),'fields':['body'],'type':_0x42a8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29fc29,_0x53048e,_0x127d12){var _0x3467d4=_0x59505e[_0x42a8('0xe')];var _0x51c539=_0x29fc29['get']({'plain':!![]});if(_0x51c539[_0x42a8('0xf')]['toLowerCase']()==='in'||_0x51c539[_0x42a8('0xf')]['toLowerCase']()==='out'&&!_0x51c539[_0x42a8('0x10')]&&!_[_0x42a8('0x11')](_0x51c539[_0x42a8('0x12')])){_0x3467d4[_0x42a8('0x13')][_0x42a8('0x14')]({'where':{'id':_0x51c539[_0x42a8('0x15')]}})[_0x42a8('0x16')](function(_0x156205){if(_0x156205){_0x156205['update']({'lastMsgAt':_0x51c539['createdAt'],'lastMsgDirection':_0x51c539[_0x42a8('0xf')][_0x42a8('0x17')]()});}})[_0x42a8('0x18')](function(_0x542543){console[_0x42a8('0x19')](_0x542543);});}if(_0x51c539[_0x42a8('0xf')]===_0x42a8('0x1a')&&!_0x51c539[_0x42a8('0x10')]){var _0x3a8f0c;_0x3467d4[_0x42a8('0x1b')][_0x42a8('0x1c')]({'where':{'id':_0x51c539[_0x42a8('0x1d')]},'raw':!![]})[_0x42a8('0x16')](function(_0x5b6241){_0x3a8f0c=_0x5b6241;if(_0x3a8f0c&&_0x3a8f0c['type']){switch(_0x3a8f0c['type']){case _0x42a8('0x1e'):var _0x3133c9=require(_0x42a8('0x1e'));if(_0x3a8f0c[_0x42a8('0x1f')]&&_0x3a8f0c[_0x42a8('0x20')]&&_0x3a8f0c[_0x42a8('0x21')]){var _0x178019=new _0x3133c9(_0x3a8f0c['accountSid'],_0x3a8f0c[_0x42a8('0x20')]);_0x178019['messages']['create']({'body':_0x51c539['body'],'to':_0x42a8('0x22')+_0x51c539[_0x42a8('0x21')],'from':_0x42a8('0x22')+_0x3a8f0c['phone'],'statusCallback':_0x3a8f0c[_0x42a8('0x23')]+'/api/whatsapp/messages/'+_0x51c539['id']+'/status?token='+_0x3a8f0c[_0x42a8('0x24')]})[_0x42a8('0x16')](function(_0x38947e){if(_0x38947e[_0x42a8('0x25')]){return _0x29fc29['update']({'messageId':_0x38947e[_0x42a8('0x25')]});}})['catch'](function(_0x44576f){logger[_0x42a8('0x19')](_0x42a8('0x26'),_0x42a8('0x27'),_0x42a8('0x1e'),util[_0x42a8('0x28')](_0x44576f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x42a8('0x26'),'afterCreate',_0x42a8('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x42a8('0x29')](function(){_0x127d12();});}else{_0x127d12();}}},'charset':_0x42a8('0x2a'),'collate':_0x42a8('0x2b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ca7e657..955e52a 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 _0xc188=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','lodash','moment','randomstring'];(function(_0x3b493b,_0x1d26db){var _0x5276dd=function(_0x328c26){while(--_0x328c26){_0x3b493b['push'](_0x3b493b['shift']());}};_0x5276dd(++_0x1d26db);}(_0xc188,0x6d));var _0x8c18=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xc188[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x8c18('0x0'));var util=require('util');var moment=require(_0x8c18('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c18('0x2'));var fs=require('fs');var Redis=require(_0x8c18('0x3'));var db=require(_0x8c18('0x4'))['db'];var utils=require(_0x8c18('0x5'));var logger=require('../../config/logger')(_0x8c18('0x6'));var config=require(_0x8c18('0x7'));var jayson=require(_0x8c18('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x8c18('0x9')]=_['defaults'](config['redis'],{'host':_0x8c18('0xa'),'port':0x18eb});var socket=require(_0x8c18('0xb'))(new Redis(config['redis']));require(_0x8c18('0xc'))[_0x8c18('0xd')](socket);function respondWithRpcPromise(_0x326822,_0x563985,_0x332139){return new BPromise(function(_0x2e89b9,_0x4123f8){return client['request'](_0x326822,_0x332139)[_0x8c18('0xe')](function(_0x10e15a){logger[_0x8c18('0xf')](_0x8c18('0x10'),_0x563985,_0x8c18('0x11'));logger[_0x8c18('0x12')](_0x8c18('0x13'),_0x563985,_0x8c18('0x11'),JSON[_0x8c18('0x14')](_0x10e15a));if(_0x10e15a['error']){if(_0x10e15a[_0x8c18('0x15')]['code']===0x1f4){logger[_0x8c18('0x15')](_0x8c18('0x10'),_0x563985,_0x10e15a[_0x8c18('0x15')][_0x8c18('0x16')]);return _0x4123f8(_0x10e15a[_0x8c18('0x15')]['message']);}logger[_0x8c18('0x15')](_0x8c18('0x10'),_0x563985,_0x10e15a[_0x8c18('0x15')][_0x8c18('0x16')]);return _0x2e89b9(_0x10e15a['error'][_0x8c18('0x16')]);}else{logger[_0x8c18('0xf')](_0x8c18('0x10'),_0x563985,_0x8c18('0x11'));_0x2e89b9(_0x10e15a['result'][_0x8c18('0x16')]);}})[_0x8c18('0x17')](function(_0x4a03e9){logger[_0x8c18('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x563985,_0x4a03e9);_0x4123f8(_0x4a03e9);});});}exports[_0x8c18('0x18')]=function(_0x582234){var _0x5e6270=this;return new Promise(function(_0x1647ad,_0x257186){return db[_0x8c18('0x19')][_0x8c18('0x1a')](_0x582234[_0x8c18('0x1b')],{'raw':_0x582234['options']?_0x582234['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x228a43){logger[_0x8c18('0xf')](_0x8c18('0x18'),_0x582234);logger['debug'](_0x8c18('0x18'),_0x582234,JSON[_0x8c18('0x14')](_0x228a43));_0x1647ad(_0x228a43);})[_0x8c18('0x17')](function(_0xbd6c13){logger['error'](_0x8c18('0x18'),_0xbd6c13['message'],_0x582234);_0x257186(_0x5e6270[_0x8c18('0x15')](0x1f4,_0xbd6c13[_0x8c18('0x16')]));});});}; \ No newline at end of file +var _0x8f5a=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappMessage','body','options','raw','CreateWhatsappMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost'];(function(_0x18b1ee,_0x3b2390){var _0x3d054e=function(_0x1e0005){while(--_0x1e0005){_0x18b1ee['push'](_0x18b1ee['shift']());}};_0x3d054e(++_0x3b2390);}(_0x8f5a,0x121));var _0xa8f5=function(_0x237ae2,_0x2db7b2){_0x237ae2=_0x237ae2-0x0;var _0x17f458=_0x8f5a[_0x237ae2];return _0x17f458;};'use strict';var _=require(_0xa8f5('0x0'));var util=require(_0xa8f5('0x1'));var moment=require(_0xa8f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8f5('0x4'))['db'];var utils=require(_0xa8f5('0x5'));var logger=require(_0xa8f5('0x6'))('rpc');var config=require(_0xa8f5('0x7'));var jayson=require(_0xa8f5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa8f5('0x9')]=_['defaults'](config['redis'],{'host':_0xa8f5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8f5('0x9')]));require(_0xa8f5('0xb'))[_0xa8f5('0xc')](socket);function respondWithRpcPromise(_0x1075ba,_0xae86a,_0x25a87c){return new BPromise(function(_0x2ff014,_0x31f90b){return client[_0xa8f5('0xd')](_0x1075ba,_0x25a87c)[_0xa8f5('0xe')](function(_0x4ac326){logger[_0xa8f5('0xf')](_0xa8f5('0x10'),_0xae86a,_0xa8f5('0x11'));logger[_0xa8f5('0x12')](_0xa8f5('0x13'),_0xae86a,_0xa8f5('0x11'),JSON[_0xa8f5('0x14')](_0x4ac326));if(_0x4ac326['error']){if(_0x4ac326[_0xa8f5('0x15')][_0xa8f5('0x16')]===0x1f4){logger[_0xa8f5('0x15')](_0xa8f5('0x10'),_0xae86a,_0x4ac326[_0xa8f5('0x15')]['message']);return _0x31f90b(_0x4ac326[_0xa8f5('0x15')]['message']);}logger[_0xa8f5('0x15')](_0xa8f5('0x10'),_0xae86a,_0x4ac326[_0xa8f5('0x15')][_0xa8f5('0x17')]);return _0x2ff014(_0x4ac326['error']['message']);}else{logger[_0xa8f5('0xf')](_0xa8f5('0x10'),_0xae86a,'request\x20sent');_0x2ff014(_0x4ac326['result']['message']);}})[_0xa8f5('0x18')](function(_0x235235){logger[_0xa8f5('0x15')](_0xa8f5('0x10'),_0xae86a,_0x235235);_0x31f90b(_0x235235);});});}exports['CreateWhatsappMessage']=function(_0x47a120){var _0x5ef94f=this;return new Promise(function(_0x2f4976,_0x475749){return db[_0xa8f5('0x19')]['create'](_0x47a120[_0xa8f5('0x1a')],{'raw':_0x47a120[_0xa8f5('0x1b')]?_0x47a120['options'][_0xa8f5('0x1c')]===undefined?!![]:![]:!![]})[_0xa8f5('0xe')](function(_0x20e334){logger['info']('CreateWhatsappMessage',_0x47a120);logger['debug'](_0xa8f5('0x1d'),_0x47a120,JSON[_0xa8f5('0x14')](_0x20e334));_0x2f4976(_0x20e334);})[_0xa8f5('0x18')](function(_0x3c7083){logger[_0xa8f5('0x15')](_0xa8f5('0x1d'),_0x3c7083[_0xa8f5('0x17')],_0x47a120);_0x475749(_0x5ef94f['error'](0x1f4,_0x3c7083[_0xa8f5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e673974..2932461 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 _0xefdf=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update','emit'];(function(_0xf231d0,_0x13c159){var _0x472a9d=function(_0x18802d){while(--_0x18802d){_0xf231d0['push'](_0xf231d0['shift']());}};_0x472a9d(++_0x13c159);}(_0xefdf,0x15c));var _0xfefd=function(_0x50c754,_0x44c558){_0x50c754=_0x50c754-0x0;var _0x4fc8b4=_0xefdf[_0x50c754];return _0x4fc8b4;};'use strict';var WhatsappMessageEvents=require(_0xfefd('0x0'));var events=['save',_0xfefd('0x1'),_0xfefd('0x2')];function createListener(_0x53e4a1,_0x1ff0b3){return function(_0x2d4d7c){_0x1ff0b3[_0xfefd('0x3')](_0x53e4a1,_0x2d4d7c);};}function removeListener(_0x26c0d1,_0x38cf7c){return function(){WhatsappMessageEvents[_0xfefd('0x4')](_0x26c0d1,_0x38cf7c);};}exports[_0xfefd('0x5')]=function(_0x3f5320){for(var _0x2db864=0x0,_0x1c835e=events[_0xfefd('0x6')];_0x2db864<_0x1c835e;_0x2db864++){var _0x34a91c=events[_0x2db864];var _0x1bab66=createListener(_0xfefd('0x7')+_0x34a91c,_0x3f5320);WhatsappMessageEvents['on'](_0x34a91c,_0x1bab66);}}; \ No newline at end of file +var _0x26aa=['save','remove','update','emit','length','whatsappMessage:'];(function(_0x392523,_0x36f49b){var _0x283d59=function(_0x19b29a){while(--_0x19b29a){_0x392523['push'](_0x392523['shift']());}};_0x283d59(++_0x36f49b);}(_0x26aa,0xa2));var _0xa26a=function(_0x2ab40b,_0x3f5ee5){_0x2ab40b=_0x2ab40b-0x0;var _0x2ed46a=_0x26aa[_0x2ab40b];return _0x2ed46a;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa26a('0x0'),_0xa26a('0x1'),_0xa26a('0x2')];function createListener(_0x13361b,_0x47c5d0){return function(_0x30eb7e){_0x47c5d0[_0xa26a('0x3')](_0x13361b,_0x30eb7e);};}function removeListener(_0x3cf2f5,_0x4b1992){return function(){WhatsappMessageEvents['removeListener'](_0x3cf2f5,_0x4b1992);};}exports['register']=function(_0x3d146d){for(var _0x2ea383=0x0,_0x1eb8bc=events[_0xa26a('0x4')];_0x2ea383<_0x1eb8bc;_0x2ea383++){var _0x45584e=events[_0x2ea383];var _0x47801f=createListener(_0xa26a('0x5')+_0x45584e,_0x3d146d);WhatsappMessageEvents['on'](_0x45584e,_0x47801f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 05d0993..9da0c08 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 _0x32cd=['delete','removeTeams','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x486e7f,_0x751051){var _0x36bd55=function(_0x59de86){while(--_0x59de86){_0x486e7f['push'](_0x486e7f['shift']());}};_0x36bd55(++_0x751051);}(_0x32cd,0x108));var _0xd32c=function(_0x58d786,_0x20ad6b){_0x58d786=_0x58d786-0x0;var _0x400652=_0x32cd[_0x58d786];return _0x400652;};'use strict';var multer=require('multer');var util=require(_0xd32c('0x0'));var path=require(_0xd32c('0x1'));var timeout=require(_0xd32c('0x2'));var express=require(_0xd32c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd32c('0x4'));var config=require(_0xd32c('0x5'));var controller=require(_0xd32c('0x6'));router['get']('/',auth[_0xd32c('0x7')](),controller[_0xd32c('0x8')]);router[_0xd32c('0x9')](_0xd32c('0xa'),auth[_0xd32c('0x7')](),controller[_0xd32c('0xb')]);router[_0xd32c('0x9')](_0xd32c('0xc'),auth[_0xd32c('0x7')](),controller[_0xd32c('0xd')]);router[_0xd32c('0x9')](_0xd32c('0xe'),auth['isAuthenticated'](),controller[_0xd32c('0xf')]);router['get'](_0xd32c('0x10'),auth[_0xd32c('0x7')](),controller[_0xd32c('0x11')]);router[_0xd32c('0x9')](_0xd32c('0x12'),auth[_0xd32c('0x7')](),controller[_0xd32c('0x13')]);router[_0xd32c('0x14')]('/',auth[_0xd32c('0x7')](),controller[_0xd32c('0x15')]);router[_0xd32c('0x14')](_0xd32c('0x10'),auth[_0xd32c('0x7')](),controller[_0xd32c('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xd32c('0x17')]);router[_0xd32c('0x18')]('/:id',auth[_0xd32c('0x7')](),controller[_0xd32c('0x19')]);router['delete'](_0xd32c('0xc'),auth[_0xd32c('0x7')](),controller['destroy']);router[_0xd32c('0x1a')]('/:id/teams',auth[_0xd32c('0x7')](),controller[_0xd32c('0x1b')]);router[_0xd32c('0x1a')](_0xd32c('0x12'),auth[_0xd32c('0x7')](),controller['removeAgents']);module[_0xd32c('0x1c')]=router; \ No newline at end of file +var _0x9164=['create','put','update','destroy','delete','/:id/teams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x9164,0x10d));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4916('0x0'));var util=require(_0x4916('0x1'));var path=require(_0x4916('0x2'));var timeout=require('connect-timeout');var express=require(_0x4916('0x3'));var router=express[_0x4916('0x4')]();var auth=require(_0x4916('0x5'));var interaction=require(_0x4916('0x6'));var config=require(_0x4916('0x7'));var controller=require(_0x4916('0x8'));router[_0x4916('0x9')]('/',auth[_0x4916('0xa')](),controller[_0x4916('0xb')]);router['get'](_0x4916('0xc'),auth[_0x4916('0xa')](),controller[_0x4916('0xd')]);router['get'](_0x4916('0xe'),auth['isAuthenticated'](),controller[_0x4916('0xf')]);router[_0x4916('0x9')](_0x4916('0x10'),auth[_0x4916('0xa')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x4916('0xa')](),controller[_0x4916('0x11')]);router['get'](_0x4916('0x12'),auth[_0x4916('0xa')](),controller[_0x4916('0x13')]);router[_0x4916('0x14')]('/',auth[_0x4916('0xa')](),controller[_0x4916('0x15')]);router[_0x4916('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x4916('0x14')](_0x4916('0x12'),auth[_0x4916('0xa')](),controller['addAgents']);router[_0x4916('0x16')]('/:id',auth[_0x4916('0xa')](),controller[_0x4916('0x17')]);router['delete'](_0x4916('0xe'),auth[_0x4916('0xa')](),controller[_0x4916('0x18')]);router[_0x4916('0x19')](_0x4916('0x1a'),auth[_0x4916('0xa')](),controller['removeTeams']);router[_0x4916('0x19')](_0x4916('0x12'),auth[_0x4916('0xa')](),controller[_0x4916('0x1b')]);module[_0x4916('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 18b82d7..a30c0f3 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 _0xb09d=['name','INTEGER','ENUM','rrmemory','roundrobin','exports','STRING'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xb09d,0x171));var _0xdb09=function(_0x20687a,_0x686093){_0x20687a=_0x20687a-0x0;var _0x38ea4f=_0xb09d[_0x20687a];return _0x38ea4f;};'use strict';var Sequelize=require('sequelize');module[_0xdb09('0x0')]={'name':{'type':Sequelize[_0xdb09('0x1')],'unique':_0xdb09('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb09('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb09('0x4')](_0xdb09('0x5'),'beepall',_0xdb09('0x6'))},'description':{'type':Sequelize[_0xdb09('0x1')]}}; \ No newline at end of file +var _0x371c=['INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3f3825,_0xc1fa97){var _0x59d8be=function(_0x2ee1d1){while(--_0x2ee1d1){_0x3f3825['push'](_0x3f3825['shift']());}};_0x59d8be(++_0xc1fa97);}(_0x371c,0xe1));var _0xc371=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x371c[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xc371('0x0'));module[_0xc371('0x1')]={'name':{'type':Sequelize[_0xc371('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc371('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xc371('0x4'),_0xc371('0x5'))},'description':{'type':Sequelize[_0xc371('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5983310..cb8b322 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 _0xaa36=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','zip-dir','moment','mustache','path','sox','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','sendStatus','name','send','index','map','WhatsappQueue','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','params','keys','rawAttributes','find','catch','create','body','user','role','get','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','userWhatsappQueue:save','removeTeams','field'];(function(_0x28d052,_0x2f72c7){var _0x305abf=function(_0x4bbf8e){while(--_0x4bbf8e){_0x28d052['push'](_0x28d052['shift']());}};_0x305abf(++_0x2f72c7);}(_0xaa36,0x125));var _0x6aa3=function(_0x148f88,_0x318266){_0x148f88=_0x148f88-0x0;var _0x112d20=_0xaa36[_0x148f88];return _0x112d20;};'use strict';var pdf=require(_0x6aa3('0x0'));var emlformat=require(_0x6aa3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6aa3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6aa3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6aa3('0x4'));var util=require('util');var path=require(_0x6aa3('0x5'));var sox=require(_0x6aa3('0x6'));var csv=require('to-csv');var ejs=require(_0x6aa3('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6aa3('0x8'));var crypto=require(_0x6aa3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6aa3('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6aa3('0xb'));var Papa=require('papaparse');var Redis=require(_0x6aa3('0xc'));var authService=require(_0x6aa3('0xd'));var qs=require(_0x6aa3('0xe'));var as=require(_0x6aa3('0xf'));var hardwareService=require(_0x6aa3('0x10'));var logger=require(_0x6aa3('0x11'))(_0x6aa3('0x12'));var utils=require(_0x6aa3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6aa3('0x14'));var db=require(_0x6aa3('0x15'))['db'];config[_0x6aa3('0x16')]=_['defaults'](config['redis'],{'host':_0x6aa3('0x17'),'port':0x18eb});var socket=require(_0x6aa3('0x18'))(new Redis(config['redis']));require(_0x6aa3('0x19'))['register'](socket);function respondWithStatusCode(_0x4e3596,_0x14def3){_0x14def3=_0x14def3||0xcc;return function(_0x119453){if(_0x119453){return _0x4e3596['sendStatus'](_0x14def3);}return _0x4e3596['status'](_0x14def3)['end']();};}function respondWithResult(_0x13aed6,_0x52c0d1){_0x52c0d1=_0x52c0d1||0xc8;return function(_0x1c3d94){if(_0x1c3d94){return _0x13aed6[_0x6aa3('0x1a')](_0x52c0d1)[_0x6aa3('0x1b')](_0x1c3d94);}};}function respondWithFilteredResult(_0x41cd65,_0x3a2764){return function(_0x28bf08){if(_0x28bf08){var _0x4622ba=_0x28bf08['count'],_0x485f83=_0x3a2764['offset'],_0x42bc21=_0x3a2764[_0x6aa3('0x1c')]+_0x3a2764[_0x6aa3('0x1d')],_0x2c3085;if(_0x42bc21>=_0x4622ba){_0x42bc21=_0x4622ba;_0x2c3085=0xc8;}else{_0x2c3085=0xce;}_0x41cd65[_0x6aa3('0x1a')](_0x2c3085);return _0x41cd65[_0x6aa3('0x1e')](_0x6aa3('0x1f'),_0x485f83+'-'+_0x42bc21+'/'+_0x4622ba)[_0x6aa3('0x1b')](_0x28bf08);}return null;};}function patchUpdates(_0x57cec8){return function(_0x69ea7b){try{jsonpatch[_0x6aa3('0x20')](_0x69ea7b,_0x57cec8,!![]);}catch(_0x175610){return BPromise[_0x6aa3('0x21')](_0x175610);}return _0x69ea7b[_0x6aa3('0x22')]();};}function saveUpdates(_0x1dca47,_0x443ef0){return function(_0x2fad46){if(_0x2fad46){return _0x2fad46[_0x6aa3('0x23')](_0x1dca47)[_0x6aa3('0x24')](function(_0x2f8865){return _0x2f8865;});}return null;};}function removeEntity(_0x889b0e,_0x4c0193){return function(_0x4b89ff){if(_0x4b89ff){return _0x4b89ff[_0x6aa3('0x25')]()[_0x6aa3('0x24')](function(){var _0x3a8388=_0x4b89ff['get']({'plain':!![]});var _0x546fd3='WhatsappQueues';return db[_0x6aa3('0x26')][_0x6aa3('0x25')]({'where':{'type':_0x546fd3,'resourceId':_0x3a8388['id']}})[_0x6aa3('0x24')](function(){return _0x4b89ff;});})[_0x6aa3('0x24')](function(){_0x889b0e[_0x6aa3('0x1a')](0xcc)[_0x6aa3('0x27')]();});}};}function handleEntityNotFound(_0xc95161,_0x49ca9d){return function(_0x1b84e7){if(!_0x1b84e7){_0xc95161[_0x6aa3('0x28')](0x194);}return _0x1b84e7;};}function handleError(_0x43adec,_0x295d22){_0x295d22=_0x295d22||0x1f4;return function(_0x570d02){logger['error'](_0x570d02['stack']);if(_0x570d02['name']){delete _0x570d02[_0x6aa3('0x29')];}_0x43adec[_0x6aa3('0x1a')](_0x295d22)[_0x6aa3('0x2a')](_0x570d02);};}exports[_0x6aa3('0x2b')]=function(_0x51788d,_0x52c1f1){var _0xfc953={},_0x560767={},_0x337d76={'count':0x0,'rows':[]};var _0xfdd242=_[_0x6aa3('0x2c')](db[_0x6aa3('0x2d')]['rawAttributes'],function(_0x48eadb){return{'name':_0x48eadb['fieldName'],'type':_0x48eadb['type'][_0x6aa3('0x2e')]};});_0x560767['model']=_['map'](_0xfdd242,_0x6aa3('0x29'));_0x560767[_0x6aa3('0x2f')]=_['keys'](_0x51788d[_0x6aa3('0x2f')]);_0x560767[_0x6aa3('0x30')]=_[_0x6aa3('0x31')](_0x560767[_0x6aa3('0x32')],_0x560767['query']);_0xfc953[_0x6aa3('0x33')]=_[_0x6aa3('0x31')](_0x560767['model'],qs[_0x6aa3('0x34')](_0x51788d[_0x6aa3('0x2f')][_0x6aa3('0x34')]));_0xfc953['attributes']=_0xfc953[_0x6aa3('0x33')][_0x6aa3('0x35')]?_0xfc953['attributes']:_0x560767[_0x6aa3('0x32')];if(!_0x51788d['query'][_0x6aa3('0x36')](_0x6aa3('0x37'))){_0xfc953[_0x6aa3('0x1d')]=qs[_0x6aa3('0x1d')](_0x51788d[_0x6aa3('0x2f')]['limit']);_0xfc953['offset']=qs[_0x6aa3('0x1c')](_0x51788d['query'][_0x6aa3('0x1c')]);}_0xfc953['order']=qs[_0x6aa3('0x38')](_0x51788d[_0x6aa3('0x2f')][_0x6aa3('0x38')]);_0xfc953['where']=qs[_0x6aa3('0x30')](_[_0x6aa3('0x39')](_0x51788d[_0x6aa3('0x2f')],_0x560767[_0x6aa3('0x30')]),_0xfdd242);if(_0x51788d[_0x6aa3('0x2f')][_0x6aa3('0x3a')]){_0xfc953[_0x6aa3('0x3b')]=_[_0x6aa3('0x3c')](_0xfc953[_0x6aa3('0x3b')],{'$or':_[_0x6aa3('0x2c')](_0xfdd242,function(_0x2b100e){if(_0x2b100e[_0x6aa3('0x3d')]!==_0x6aa3('0x3e')){var _0x133912={};_0x133912[_0x2b100e[_0x6aa3('0x29')]]={'$like':'%'+_0x51788d['query']['filter']+'%'};return _0x133912;}})});}_0xfc953=_['merge']({},_0xfc953,_0x51788d[_0x6aa3('0x3f')]);var _0x32ecde={'where':_0xfc953[_0x6aa3('0x3b')]};return db[_0x6aa3('0x2d')]['count'](_0x32ecde)[_0x6aa3('0x24')](function(_0x9c5504){_0x337d76[_0x6aa3('0x40')]=_0x9c5504;if(_0x51788d['query'][_0x6aa3('0x41')]){_0xfc953[_0x6aa3('0x42')]=[{'all':!![]}];}return db[_0x6aa3('0x2d')][_0x6aa3('0x43')](_0xfc953);})['then'](function(_0x4ce2d4){_0x337d76['rows']=_0x4ce2d4;return _0x337d76;})['then'](respondWithFilteredResult(_0x52c1f1,_0xfc953))['catch'](handleError(_0x52c1f1,null));};exports['show']=function(_0x511de0,_0x4717fe){var _0x542e13={'raw':!![],'where':{'id':_0x511de0[_0x6aa3('0x44')]['id']}},_0x511342={};_0x511342[_0x6aa3('0x32')]=_[_0x6aa3('0x45')](db[_0x6aa3('0x2d')][_0x6aa3('0x46')]);_0x511342[_0x6aa3('0x2f')]=_[_0x6aa3('0x45')](_0x511de0[_0x6aa3('0x2f')]);_0x511342['filters']=_[_0x6aa3('0x31')](_0x511342[_0x6aa3('0x32')],_0x511342['query']);_0x542e13[_0x6aa3('0x33')]=_[_0x6aa3('0x31')](_0x511342[_0x6aa3('0x32')],qs[_0x6aa3('0x34')](_0x511de0[_0x6aa3('0x2f')][_0x6aa3('0x34')]));_0x542e13[_0x6aa3('0x33')]=_0x542e13['attributes'][_0x6aa3('0x35')]?_0x542e13[_0x6aa3('0x33')]:_0x511342[_0x6aa3('0x32')];if(_0x511de0[_0x6aa3('0x2f')][_0x6aa3('0x41')]){_0x542e13[_0x6aa3('0x42')]=[{'all':!![]}];}_0x542e13=_[_0x6aa3('0x3c')]({},_0x542e13,_0x511de0[_0x6aa3('0x3f')]);return db['WhatsappQueue'][_0x6aa3('0x47')](_0x542e13)[_0x6aa3('0x24')](handleEntityNotFound(_0x4717fe,null))[_0x6aa3('0x24')](respondWithResult(_0x4717fe,null))[_0x6aa3('0x48')](handleError(_0x4717fe,null));};exports[_0x6aa3('0x49')]=function(_0x19f9d1,_0x36594b){return db['WhatsappQueue']['create'](_0x19f9d1[_0x6aa3('0x4a')],{})[_0x6aa3('0x24')](function(_0x2036e0){var _0x401c54=_0x19f9d1[_0x6aa3('0x4b')]['get']({'plain':!![]});if(!_0x401c54)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x401c54[_0x6aa3('0x4c')]===_0x6aa3('0x4b')){var _0x4846a7=_0x2036e0[_0x6aa3('0x4d')]({'plain':!![]});var _0x2165bd=_0x6aa3('0x4e');return db[_0x6aa3('0x4f')][_0x6aa3('0x47')]({'where':{'name':_0x2165bd,'userProfileId':_0x401c54[_0x6aa3('0x50')]},'raw':!![]})[_0x6aa3('0x24')](function(_0x385b89){if(_0x385b89&&_0x385b89[_0x6aa3('0x51')]===0x0){return db[_0x6aa3('0x26')][_0x6aa3('0x49')]({'name':_0x4846a7[_0x6aa3('0x29')],'resourceId':_0x4846a7['id'],'type':_0x385b89[_0x6aa3('0x29')],'sectionId':_0x385b89['id']},{})['then'](function(){return _0x2036e0;});}else{return _0x2036e0;}})[_0x6aa3('0x48')](function(_0x4eeffe){logger[_0x6aa3('0x52')](_0x6aa3('0x53'),_0x4eeffe);throw _0x4eeffe;});}return _0x2036e0;})[_0x6aa3('0x24')](respondWithResult(_0x36594b,0xc9))[_0x6aa3('0x48')](handleError(_0x36594b,null));};exports[_0x6aa3('0x23')]=function(_0x4b0953,_0x3c1547){if(_0x4b0953[_0x6aa3('0x4a')]['id']){delete _0x4b0953[_0x6aa3('0x4a')]['id'];}return db[_0x6aa3('0x2d')][_0x6aa3('0x47')]({'where':{'id':_0x4b0953[_0x6aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c1547,null))['then'](saveUpdates(_0x4b0953[_0x6aa3('0x4a')],null))[_0x6aa3('0x24')](respondWithResult(_0x3c1547,null))[_0x6aa3('0x48')](handleError(_0x3c1547,null));};exports[_0x6aa3('0x25')]=function(_0xb41db,_0x476f79){return db[_0x6aa3('0x2d')][_0x6aa3('0x47')]({'where':{'id':_0xb41db[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x476f79,null))['then'](removeEntity(_0x476f79,null))['catch'](handleError(_0x476f79,null));};exports[_0x6aa3('0x54')]=function(_0x1a0410,_0x3085fe){return db[_0x6aa3('0x2d')][_0x6aa3('0x54')]()[_0x6aa3('0x24')](respondWithResult(_0x3085fe,null))[_0x6aa3('0x48')](handleError(_0x3085fe,null));};exports['getMembers']=function(_0x513620,_0x1accdf,_0xa217b){var _0x38cdac={'raw':!![],'where':{}},_0x3e0e66={},_0x25b5cb;return db[_0x6aa3('0x2d')][_0x6aa3('0x55')]({'where':{'id':_0x513620[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x1accdf,null))[_0x6aa3('0x24')](function(_0x470443){if(_0x470443){_0x25b5cb=_0x470443[_0x6aa3('0x4d')]({'plain':!![]});_0x3e0e66[_0x6aa3('0x32')]=_[_0x6aa3('0x45')](db[_0x6aa3('0x56')][_0x6aa3('0x46')]);_0x3e0e66[_0x6aa3('0x2f')]=_[_0x6aa3('0x45')](_0x513620[_0x6aa3('0x2f')]);_0x3e0e66['filters']=_['intersection'](_0x3e0e66[_0x6aa3('0x32')],_0x3e0e66[_0x6aa3('0x2f')]);_0x38cdac[_0x6aa3('0x33')]=_[_0x6aa3('0x31')](_0x3e0e66[_0x6aa3('0x32')],qs[_0x6aa3('0x34')](_0x513620[_0x6aa3('0x2f')]['fields']));_0x38cdac[_0x6aa3('0x33')]=_0x38cdac[_0x6aa3('0x33')]['length']?_0x38cdac['attributes']:_0x3e0e66[_0x6aa3('0x32')];if(!_0x513620[_0x6aa3('0x2f')]['hasOwnProperty'](_0x6aa3('0x37'))){_0x38cdac[_0x6aa3('0x1d')]=qs[_0x6aa3('0x1d')](_0x513620['query'][_0x6aa3('0x1d')]);_0x38cdac['offset']=qs[_0x6aa3('0x1c')](_0x513620[_0x6aa3('0x2f')][_0x6aa3('0x1c')]);}_0x38cdac[_0x6aa3('0x57')]=qs[_0x6aa3('0x38')](_0x513620[_0x6aa3('0x2f')][_0x6aa3('0x38')]);_0x38cdac[_0x6aa3('0x3b')]=qs[_0x6aa3('0x30')](_[_0x6aa3('0x39')](_0x513620[_0x6aa3('0x2f')],_0x3e0e66['filters']));_0x38cdac[_0x6aa3('0x3b')][_0x6aa3('0x58')]=_0x470443['id'];if(_0x513620[_0x6aa3('0x2f')][_0x6aa3('0x3a')]){_0x38cdac['where']=_[_0x6aa3('0x3c')](_0x38cdac[_0x6aa3('0x3b')],{'$or':_[_0x6aa3('0x2c')](_0x38cdac[_0x6aa3('0x33')],function(_0x2e6440){var _0x5d14f5={};_0x5d14f5[_0x2e6440]={'$like':'%'+_0x513620[_0x6aa3('0x2f')][_0x6aa3('0x3a')]+'%'};return _0x5d14f5;})});}_0x38cdac=_['merge']({},_0x38cdac,_0x513620[_0x6aa3('0x3f')]);return db[_0x6aa3('0x56')]['findAll'](_0x38cdac);}})[_0x6aa3('0x24')](function(_0x69949d){if(_0x69949d){return db[_0x6aa3('0x59')][_0x6aa3('0x5a')]({'where':{'id':_['map'](_0x69949d,_0x6aa3('0x5b')),'role':'agent'},'attributes':['id',_0x6aa3('0x29'),_0x6aa3('0x5c'),_0x6aa3('0x5d'),'createdAt']});}})[_0x6aa3('0x24')](function(_0x373b43){if(_0x373b43){return{'count':_0x373b43['count'],'rows':_[_0x6aa3('0x2c')](_0x373b43['rows'],function(_0x3f3a63){return{'membername':_0x3f3a63[_0x6aa3('0x29')],'UserId':_0x3f3a63['id'],'queue_name':_0x25b5cb[_0x6aa3('0x29')],'WhatsappQueueId':_0x25b5cb['id'],'interface':util[_0x6aa3('0x5e')](_0x6aa3('0x5f'),'SIP',_0x3f3a63[_0x6aa3('0x29')]),'penalty':0x0,'paused':_0x3f3a63[_0x6aa3('0x5c')],'createdAt':_0x3f3a63[_0x6aa3('0x60')],'updatedAt':_0x3f3a63[_0x6aa3('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6aa3('0x24')](respondWithFilteredResult(_0x1accdf,_0x38cdac))[_0x6aa3('0x48')](handleError(_0x1accdf,null));};exports[_0x6aa3('0x61')]=function(_0x507505,_0x26f90e,_0x551e62){var _0xeb8880={};var _0x3a8307={};var _0x507adf;var _0xc874a4;return db[_0x6aa3('0x2d')][_0x6aa3('0x55')]({'where':{'id':_0x507505[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x26f90e,null))[_0x6aa3('0x24')](function(_0x12437c){if(_0x12437c){_0x507adf=_0x12437c;_0x3a8307[_0x6aa3('0x32')]=_[_0x6aa3('0x45')](db[_0x6aa3('0x62')][_0x6aa3('0x46')]);_0x3a8307[_0x6aa3('0x2f')]=_['keys'](_0x507505[_0x6aa3('0x2f')]);_0x3a8307['filters']=_[_0x6aa3('0x31')](_0x3a8307[_0x6aa3('0x32')],_0x3a8307[_0x6aa3('0x2f')]);_0xeb8880[_0x6aa3('0x33')]=_[_0x6aa3('0x31')](_0x3a8307['model'],qs['fields'](_0x507505[_0x6aa3('0x2f')][_0x6aa3('0x34')]));_0xeb8880['attributes']=_0xeb8880[_0x6aa3('0x33')][_0x6aa3('0x35')]?_0xeb8880[_0x6aa3('0x33')]:_0x3a8307[_0x6aa3('0x32')];_0xeb8880[_0x6aa3('0x57')]=qs[_0x6aa3('0x38')](_0x507505[_0x6aa3('0x2f')][_0x6aa3('0x38')]);_0xeb8880['where']=qs[_0x6aa3('0x30')](_[_0x6aa3('0x39')](_0x507505[_0x6aa3('0x2f')],_0x3a8307['filters']));if(_0x507505['query'][_0x6aa3('0x3a')]){_0xeb8880[_0x6aa3('0x3b')]=_[_0x6aa3('0x3c')](_0xeb8880[_0x6aa3('0x3b')],{'$or':_[_0x6aa3('0x2c')](_0xeb8880[_0x6aa3('0x33')],function(_0x130974){var _0x4c2a78={};_0x4c2a78[_0x130974]={'$like':'%'+_0x507505[_0x6aa3('0x2f')][_0x6aa3('0x3a')]+'%'};return _0x4c2a78;})});}_0xeb8880=_[_0x6aa3('0x3c')]({},_0xeb8880,_0x507505[_0x6aa3('0x3f')]);return _0x507adf[_0x6aa3('0x61')](_0xeb8880);}})[_0x6aa3('0x24')](function(_0x4406a4){if(_0x4406a4){_0xc874a4=_0x4406a4[_0x6aa3('0x35')];if(!_0x507505[_0x6aa3('0x2f')][_0x6aa3('0x36')](_0x6aa3('0x37'))){_0xeb8880['limit']=qs[_0x6aa3('0x1d')](_0x507505[_0x6aa3('0x2f')][_0x6aa3('0x1d')]);_0xeb8880['offset']=qs[_0x6aa3('0x1c')](_0x507505[_0x6aa3('0x2f')]['offset']);}return _0x507adf[_0x6aa3('0x61')](_0xeb8880);}})[_0x6aa3('0x24')](function(_0x131a4e){if(_0x131a4e){return _0x131a4e?{'count':_0xc874a4,'rows':_0x131a4e}:null;}})['then'](respondWithResult(_0x26f90e,null))[_0x6aa3('0x48')](handleError(_0x26f90e,null));};exports[_0x6aa3('0x63')]=function(_0x464836,_0x7b2d70,_0x46fc78){var _0x5a0344=_0x464836[_0x6aa3('0x4a')][_0x6aa3('0x64')];return db[_0x6aa3('0x62')][_0x6aa3('0x43')]({'where':{'id':_0x5a0344},'attributes':['id'],'include':[{'model':db[_0x6aa3('0x59')],'as':_0x6aa3('0x65'),'attributes':['id',_0x6aa3('0x29'),_0x6aa3('0x66'),_0x6aa3('0x67'),_0x6aa3('0x68')],'raw':!![]}]})[_0x6aa3('0x24')](function(_0x3502e1){if(_0x3502e1){var _0x340ae3=_[_0x6aa3('0x69')](_0x3502e1,function(_0x3ee6d8){var _0x34e737=_0x3ee6d8[_0x6aa3('0x4d')]({'plain':!![]});return _0x34e737[_0x6aa3('0x65')];});return db['WhatsappQueue']['find']({'where':{'id':_0x464836[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](function(_0x424195){return db[_0x6aa3('0x6a')][_0x6aa3('0x6b')](function(_0x2bba9c){return _0x424195[_0x6aa3('0x63')](_0x5a0344,{'transaction':_0x2bba9c})[_0x6aa3('0x24')](function(){return BPromise[_0x6aa3('0x6c')](_0x340ae3,function(_0x251331){return db[_0x6aa3('0x56')]['findOrCreate']({'where':{'UserId':_0x251331['id'],'WhatsappQueueId':_0x464836[_0x6aa3('0x44')]['id']},'transaction':_0x2bba9c});});})[_0x6aa3('0x24')](function(){_0x340ae3['forEach'](function(_0x5e5913){socket['emit'](_0x6aa3('0x6d'),{'UserId':_0x5e5913['id'],'WhatsappQueueId':_0x424195['id']});});});});});}})[_0x6aa3('0x24')](respondWithStatusCode(_0x7b2d70,null))['catch'](handleError(_0x7b2d70,null));};exports[_0x6aa3('0x6e')]=function(_0x3e679d,_0x589f7c,_0x53554f){return db[_0x6aa3('0x62')][_0x6aa3('0x43')]({'where':{'id':_0x3e679d['query'][_0x6aa3('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6aa3('0x59')],'as':_0x6aa3('0x65'),'attributes':['id'],'raw':!![]}]})[_0x6aa3('0x24')](handleEntityNotFound(_0x589f7c,null))['then'](function(_0x389d44){var _0x48c834=_[_0x6aa3('0x2c')](_0x389d44,'id');var _0x43a52f=[];var _0x39c51d=[];var _0x22970f=squel['select']();_0x22970f[_0x6aa3('0x6f')]('tq.TeamId')[_0x6aa3('0x70')](_0x6aa3('0x71'),'tq')[_0x6aa3('0x72')](_0x6aa3('0x73'),'ut',_0x6aa3('0x74'))['where'](_0x6aa3('0x75'),_0x3e679d[_0x6aa3('0x44')]['id']);for(var _0x4c4f6c=0x0;_0x4c4f6c<_0x389d44[_0x6aa3('0x35')];_0x4c4f6c+=0x1){let _0x522a58=_0x389d44[_0x4c4f6c];for(var _0x498e8c=0x0;_0x498e8c<_0x522a58[_0x6aa3('0x65')]['length'];_0x498e8c+=0x1){let _0x32d670=_0x522a58['Agents'][_0x498e8c];var _0x3d7902=_0x22970f[_0x6aa3('0x76')]();_0x3d7902[_0x6aa3('0x3b')](_0x6aa3('0x77'),_0x32d670['id']);_0x39c51d[_0x6aa3('0x78')](db[_0x6aa3('0x6a')][_0x6aa3('0x2f')](_0x3d7902[_0x6aa3('0x79')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x6aa3('0x24')](function(_0x1a6c63){if(_0x1a6c63[_0x6aa3('0x35')]===0x1){return _0x32d670['id'];}else{var _0x3da121=_[_0x6aa3('0x7a')](_[_0x6aa3('0x2c')](_0x1a6c63,_0x6aa3('0x7b')),function(_0xcffb1d){return _[_0x6aa3('0x7c')](_0x48c834,_0xcffb1d);});if(_0x3da121){return _0x32d670['id'];}}}));}}return BPromise['all'](_0x39c51d)['then'](function(_0xc53237){_0x43a52f=_(_0x43a52f)[_0x6aa3('0x7d')](_0xc53237)['compact']()[_0x6aa3('0x7e')]();return db[_0x6aa3('0x2d')][_0x6aa3('0x47')]({'where':{'id':_0x3e679d[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](function(_0x4e6768){return db[_0x6aa3('0x6a')]['transaction'](function(_0x1d5ebf){return _0x4e6768[_0x6aa3('0x6e')](_0x3e679d['query']['ids'],{'transaction':_0x1d5ebf})['then'](function(){if(!_[_0x6aa3('0x7f')](_0x43a52f)){return _0x4e6768[_0x6aa3('0x80')](_0x43a52f,{'transaction':_0x1d5ebf});}})[_0x6aa3('0x24')](function(){_0x43a52f['forEach'](function(_0x1fbb8d){socket[_0x6aa3('0x81')](_0x6aa3('0x82'),{'UserId':_0x1fbb8d,'WhatsappQueueId':_0x4e6768['id']});});});});});});})[_0x6aa3('0x24')](respondWithStatusCode(_0x589f7c,null))[_0x6aa3('0x48')](handleError(_0x589f7c,null));};exports[_0x6aa3('0x83')]=function(_0x3576e9,_0x36c859,_0x9a2364){return db[_0x6aa3('0x2d')][_0x6aa3('0x47')]({'where':{'id':_0x3576e9[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x36c859,null))['then'](function(_0x261a3c){if(_0x261a3c){return _0x261a3c[_0x6aa3('0x83')](_0x3576e9[_0x6aa3('0x4a')][_0x6aa3('0x64')],_[_0x6aa3('0x84')](_0x3576e9['body'],['ids','id'])||{})['spread'](function(_0x10037b){for(var _0x475f72=0x0;_0x475f72<_0x3576e9['body'][_0x6aa3('0x64')][_0x6aa3('0x35')];_0x475f72+=0x1){socket[_0x6aa3('0x81')]('userWhatsappQueue:save',{'UserId':_0x3576e9[_0x6aa3('0x4a')][_0x6aa3('0x64')][_0x475f72],'WhatsappQueueId':_0x3576e9['params']['id']});}return _0x10037b;});}})[_0x6aa3('0x24')](respondWithResult(_0x36c859,null))['catch'](handleError(_0x36c859,null));};exports[_0x6aa3('0x80')]=function(_0x4ce676,_0x2be0d3,_0x2e8cb6){return db['WhatsappQueue'][_0x6aa3('0x47')]({'where':{'id':_0x4ce676[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x2be0d3,null))[_0x6aa3('0x24')](function(_0x567d44){if(_0x567d44){return _0x567d44['removeAgents'](_0x4ce676[_0x6aa3('0x2f')][_0x6aa3('0x64')])[_0x6aa3('0x24')](function(){if(_[_0x6aa3('0x85')](_0x4ce676[_0x6aa3('0x2f')][_0x6aa3('0x64')])){for(var _0x232010=0x0;_0x232010<_0x4ce676[_0x6aa3('0x2f')][_0x6aa3('0x64')][_0x6aa3('0x35')];_0x232010+=0x1){socket[_0x6aa3('0x81')](_0x6aa3('0x82'),{'UserId':Number(_0x4ce676['query']['ids'][_0x232010]),'WhatsappQueueId':Number(_0x4ce676[_0x6aa3('0x44')]['id'])});}}else{socket[_0x6aa3('0x81')](_0x6aa3('0x82'),{'UserId':Number(_0x4ce676[_0x6aa3('0x2f')][_0x6aa3('0x64')]),'WhatsappQueueId':Number(_0x4ce676[_0x6aa3('0x44')]['id'])});}});}})[_0x6aa3('0x24')](respondWithStatusCode(_0x2be0d3,null))[_0x6aa3('0x48')](handleError(_0x2be0d3,null));};exports[_0x6aa3('0x86')]=function(_0x4cc956,_0x3b2ae3,_0x8bad5){var _0x1864f3={};var _0x5f21a1={};var _0x1938f2;var _0x5927de;return db[_0x6aa3('0x2d')][_0x6aa3('0x55')]({'where':{'id':_0x4cc956[_0x6aa3('0x44')]['id']}})[_0x6aa3('0x24')](handleEntityNotFound(_0x3b2ae3,null))[_0x6aa3('0x24')](function(_0x509ed8){if(_0x509ed8){_0x1938f2=_0x509ed8;_0x5f21a1[_0x6aa3('0x32')]=_[_0x6aa3('0x45')](db[_0x6aa3('0x59')][_0x6aa3('0x46')]);_0x5f21a1[_0x6aa3('0x2f')]=_[_0x6aa3('0x45')](_0x4cc956[_0x6aa3('0x2f')]);_0x5f21a1[_0x6aa3('0x30')]=_[_0x6aa3('0x31')](_0x5f21a1[_0x6aa3('0x32')],_0x5f21a1['query']);_0x1864f3[_0x6aa3('0x33')]=_[_0x6aa3('0x31')](_0x5f21a1[_0x6aa3('0x32')],qs[_0x6aa3('0x34')](_0x4cc956[_0x6aa3('0x2f')][_0x6aa3('0x34')]));_0x1864f3[_0x6aa3('0x33')]=_0x1864f3[_0x6aa3('0x33')]['length']?_0x1864f3['attributes']:_0x5f21a1[_0x6aa3('0x32')];_0x1864f3['order']=qs[_0x6aa3('0x38')](_0x4cc956[_0x6aa3('0x2f')][_0x6aa3('0x38')]);_0x1864f3[_0x6aa3('0x3b')]=qs[_0x6aa3('0x30')](_[_0x6aa3('0x39')](_0x4cc956[_0x6aa3('0x2f')],_0x5f21a1[_0x6aa3('0x30')]));if(_0x4cc956[_0x6aa3('0x2f')][_0x6aa3('0x3a')]){_0x1864f3[_0x6aa3('0x3b')]=_[_0x6aa3('0x3c')](_0x1864f3[_0x6aa3('0x3b')],{'$or':_['map'](_0x1864f3[_0x6aa3('0x33')],function(_0x2ecb8a){var _0x2e945b={};_0x2e945b[_0x2ecb8a]={'$like':'%'+_0x4cc956[_0x6aa3('0x2f')][_0x6aa3('0x3a')]+'%'};return _0x2e945b;})});}_0x1864f3=_[_0x6aa3('0x3c')]({},_0x1864f3,_0x4cc956['options']);return _0x1938f2[_0x6aa3('0x86')](_0x1864f3);}})[_0x6aa3('0x24')](function(_0x48266f){if(_0x48266f){_0x5927de=_0x48266f[_0x6aa3('0x35')];if(!_0x4cc956['query']['hasOwnProperty'](_0x6aa3('0x37'))){_0x1864f3[_0x6aa3('0x1d')]=qs['limit'](_0x4cc956['query'][_0x6aa3('0x1d')]);_0x1864f3[_0x6aa3('0x1c')]=qs[_0x6aa3('0x1c')](_0x4cc956['query'][_0x6aa3('0x1c')]);}return _0x1938f2[_0x6aa3('0x86')](_0x1864f3);}})[_0x6aa3('0x24')](function(_0x4b7712){if(_0x4b7712){return _0x4b7712?{'count':_0x5927de,'rows':_0x4b7712}:null;}})[_0x6aa3('0x24')](respondWithResult(_0x3b2ae3,null))[_0x6aa3('0x48')](handleError(_0x3b2ae3,null));}; \ No newline at end of file +var _0x26d7=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team','nolimit','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','findOne','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','count','offset','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','error','stack','send','WhatsappQueue','rawAttributes','type','key','map','name','query','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x26d7,0x1d7));var _0x726d=function(_0x571082,_0x290e0f){_0x571082=_0x571082-0x0;var _0x334f30=_0x26d7[_0x571082];return _0x334f30;};'use strict';var pdf=require(_0x726d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x726d('0x1'));var zipdir=require(_0x726d('0x2'));var jsonpatch=require(_0x726d('0x3'));var rp=require(_0x726d('0x4'));var moment=require('moment');var BPromise=require(_0x726d('0x5'));var Mustache=require('mustache');var util=require(_0x726d('0x6'));var path=require(_0x726d('0x7'));var sox=require(_0x726d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x726d('0x9'));var crypto=require('crypto');var jsforce=require(_0x726d('0xa'));var deskjs=require(_0x726d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x726d('0xc'));var Papa=require(_0x726d('0xd'));var Redis=require(_0x726d('0xe'));var authService=require(_0x726d('0xf'));var qs=require(_0x726d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x726d('0x11'));var logger=require(_0x726d('0x12'))(_0x726d('0x13'));var utils=require(_0x726d('0x14'));var config=require(_0x726d('0x15'));var licenseUtil=require(_0x726d('0x16'));var db=require(_0x726d('0x17'))['db'];config[_0x726d('0x18')]=_['defaults'](config[_0x726d('0x18')],{'host':_0x726d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x726d('0x1a')](socket);function respondWithStatusCode(_0x9b47e0,_0x532960){_0x532960=_0x532960||0xcc;return function(_0x48b32e){if(_0x48b32e){return _0x9b47e0[_0x726d('0x1b')](_0x532960);}return _0x9b47e0[_0x726d('0x1c')](_0x532960)['end']();};}function respondWithResult(_0x48ffb3,_0x3055e8){_0x3055e8=_0x3055e8||0xc8;return function(_0x59f052){if(_0x59f052){return _0x48ffb3['status'](_0x3055e8)[_0x726d('0x1d')](_0x59f052);}};}function respondWithFilteredResult(_0x4f735d,_0x38f7ca){return function(_0x17c40f){if(_0x17c40f){var _0x47e8b7=_0x17c40f[_0x726d('0x1e')],_0x59a3d5=_0x38f7ca[_0x726d('0x1f')],_0x2ce51a=_0x38f7ca[_0x726d('0x1f')]+_0x38f7ca['limit'],_0x35615f;if(_0x2ce51a>=_0x47e8b7){_0x2ce51a=_0x47e8b7;_0x35615f=0xc8;}else{_0x35615f=0xce;}_0x4f735d[_0x726d('0x1c')](_0x35615f);return _0x4f735d['set']('Content-Range',_0x59a3d5+'-'+_0x2ce51a+'/'+_0x47e8b7)['json'](_0x17c40f);}return null;};}function patchUpdates(_0x470638){return function(_0x4ee3ea){try{jsonpatch[_0x726d('0x20')](_0x4ee3ea,_0x470638,!![]);}catch(_0x3de84a){return BPromise[_0x726d('0x21')](_0x3de84a);}return _0x4ee3ea[_0x726d('0x22')]();};}function saveUpdates(_0x4f4eb3,_0x520c79){return function(_0x46a7f3){if(_0x46a7f3){return _0x46a7f3[_0x726d('0x23')](_0x4f4eb3)[_0x726d('0x24')](function(_0x5c8261){return _0x5c8261;});}return null;};}function removeEntity(_0x5cc229,_0x3b73e7){return function(_0x45a702){if(_0x45a702){return _0x45a702[_0x726d('0x25')]()['then'](function(){var _0x334ac5=_0x45a702['get']({'plain':!![]});var _0x4e0f0c=_0x726d('0x26');return db[_0x726d('0x27')][_0x726d('0x25')]({'where':{'type':_0x4e0f0c,'resourceId':_0x334ac5['id']}})[_0x726d('0x24')](function(){return _0x45a702;});})[_0x726d('0x24')](function(){_0x5cc229[_0x726d('0x1c')](0xcc)[_0x726d('0x28')]();});}};}function handleEntityNotFound(_0x23b787,_0x3f9679){return function(_0x30f5f2){if(!_0x30f5f2){_0x23b787['sendStatus'](0x194);}return _0x30f5f2;};}function handleError(_0x314a1f,_0xf62f53){_0xf62f53=_0xf62f53||0x1f4;return function(_0x4e1dd6){logger[_0x726d('0x29')](_0x4e1dd6[_0x726d('0x2a')]);if(_0x4e1dd6['name']){delete _0x4e1dd6['name'];}_0x314a1f[_0x726d('0x1c')](_0xf62f53)[_0x726d('0x2b')](_0x4e1dd6);};}exports['index']=function(_0x516f47,_0x451461){var _0x2566bb={},_0x9fcc08={},_0x1e0bc4={'count':0x0,'rows':[]};var _0x2329e8=_['map'](db[_0x726d('0x2c')][_0x726d('0x2d')],function(_0xc4594f){return{'name':_0xc4594f['fieldName'],'type':_0xc4594f[_0x726d('0x2e')][_0x726d('0x2f')]};});_0x9fcc08['model']=_[_0x726d('0x30')](_0x2329e8,_0x726d('0x31'));_0x9fcc08[_0x726d('0x32')]=_['keys'](_0x516f47[_0x726d('0x32')]);_0x9fcc08[_0x726d('0x33')]=_[_0x726d('0x34')](_0x9fcc08[_0x726d('0x35')],_0x9fcc08[_0x726d('0x32')]);_0x2566bb[_0x726d('0x36')]=_[_0x726d('0x34')](_0x9fcc08[_0x726d('0x35')],qs[_0x726d('0x37')](_0x516f47[_0x726d('0x32')][_0x726d('0x37')]));_0x2566bb[_0x726d('0x36')]=_0x2566bb[_0x726d('0x36')][_0x726d('0x38')]?_0x2566bb[_0x726d('0x36')]:_0x9fcc08[_0x726d('0x35')];if(!_0x516f47[_0x726d('0x32')]['hasOwnProperty']('nolimit')){_0x2566bb[_0x726d('0x39')]=qs[_0x726d('0x39')](_0x516f47['query']['limit']);_0x2566bb[_0x726d('0x1f')]=qs[_0x726d('0x1f')](_0x516f47[_0x726d('0x32')]['offset']);}_0x2566bb[_0x726d('0x3a')]=qs['sort'](_0x516f47['query'][_0x726d('0x3b')]);_0x2566bb[_0x726d('0x3c')]=qs[_0x726d('0x33')](_[_0x726d('0x3d')](_0x516f47[_0x726d('0x32')],_0x9fcc08[_0x726d('0x33')]),_0x2329e8);if(_0x516f47[_0x726d('0x32')]['filter']){_0x2566bb['where']=_[_0x726d('0x3e')](_0x2566bb[_0x726d('0x3c')],{'$or':_[_0x726d('0x30')](_0x2329e8,function(_0x311922){if(_0x311922[_0x726d('0x2e')]!==_0x726d('0x3f')){var _0x2976a5={};_0x2976a5[_0x311922[_0x726d('0x31')]]={'$like':'%'+_0x516f47['query'][_0x726d('0x40')]+'%'};return _0x2976a5;}})});}_0x2566bb=_[_0x726d('0x3e')]({},_0x2566bb,_0x516f47[_0x726d('0x41')]);var _0x546375={'where':_0x2566bb[_0x726d('0x3c')]};return db[_0x726d('0x2c')][_0x726d('0x1e')](_0x546375)[_0x726d('0x24')](function(_0x1018c6){_0x1e0bc4[_0x726d('0x1e')]=_0x1018c6;if(_0x516f47[_0x726d('0x32')]['includeAll']){_0x2566bb[_0x726d('0x42')]=[{'all':!![]}];}return db[_0x726d('0x2c')][_0x726d('0x43')](_0x2566bb);})[_0x726d('0x24')](function(_0x39e27f){_0x1e0bc4[_0x726d('0x44')]=_0x39e27f;return _0x1e0bc4;})[_0x726d('0x24')](respondWithFilteredResult(_0x451461,_0x2566bb))['catch'](handleError(_0x451461,null));};exports[_0x726d('0x45')]=function(_0x5052d7,_0x1ea99b){var _0x3bfb0a={'raw':!![],'where':{'id':_0x5052d7[_0x726d('0x46')]['id']}},_0x5d8a74={};_0x5d8a74[_0x726d('0x35')]=_[_0x726d('0x47')](db[_0x726d('0x2c')][_0x726d('0x2d')]);_0x5d8a74[_0x726d('0x32')]=_['keys'](_0x5052d7[_0x726d('0x32')]);_0x5d8a74[_0x726d('0x33')]=_[_0x726d('0x34')](_0x5d8a74['model'],_0x5d8a74[_0x726d('0x32')]);_0x3bfb0a['attributes']=_['intersection'](_0x5d8a74['model'],qs[_0x726d('0x37')](_0x5052d7['query'][_0x726d('0x37')]));_0x3bfb0a[_0x726d('0x36')]=_0x3bfb0a[_0x726d('0x36')]['length']?_0x3bfb0a['attributes']:_0x5d8a74[_0x726d('0x35')];if(_0x5052d7['query'][_0x726d('0x48')]){_0x3bfb0a[_0x726d('0x42')]=[{'all':!![]}];}_0x3bfb0a=_[_0x726d('0x3e')]({},_0x3bfb0a,_0x5052d7['options']);return db['WhatsappQueue']['find'](_0x3bfb0a)[_0x726d('0x24')](handleEntityNotFound(_0x1ea99b,null))[_0x726d('0x24')](respondWithResult(_0x1ea99b,null))['catch'](handleError(_0x1ea99b,null));};exports[_0x726d('0x49')]=function(_0x27a359,_0x401b37){return db[_0x726d('0x2c')]['create'](_0x27a359[_0x726d('0x4a')],{})['then'](function(_0x533ace){var _0x509c81=_0x27a359[_0x726d('0x4b')][_0x726d('0x4c')]({'plain':!![]});if(!_0x509c81)throw new Error(_0x726d('0x4d'));if(_0x509c81[_0x726d('0x4e')]==='user'){var _0x2d87e4=_0x533ace[_0x726d('0x4c')]({'plain':!![]});var _0x1eb0ab='WhatsappQueues';return db[_0x726d('0x4f')][_0x726d('0x50')]({'where':{'name':_0x1eb0ab,'userProfileId':_0x509c81[_0x726d('0x51')]},'raw':!![]})[_0x726d('0x24')](function(_0x3d5b52){if(_0x3d5b52&&_0x3d5b52['autoAssociation']===0x0){return db[_0x726d('0x27')][_0x726d('0x49')]({'name':_0x2d87e4['name'],'resourceId':_0x2d87e4['id'],'type':_0x3d5b52[_0x726d('0x31')],'sectionId':_0x3d5b52['id']},{})['then'](function(){return _0x533ace;});}else{return _0x533ace;}})['catch'](function(_0x583c22){logger[_0x726d('0x29')](_0x726d('0x52'),_0x583c22);throw _0x583c22;});}return _0x533ace;})[_0x726d('0x24')](respondWithResult(_0x401b37,0xc9))[_0x726d('0x53')](handleError(_0x401b37,null));};exports[_0x726d('0x23')]=function(_0x4ec870,_0x1df25a){if(_0x4ec870[_0x726d('0x4a')]['id']){delete _0x4ec870['body']['id'];}return db['WhatsappQueue'][_0x726d('0x50')]({'where':{'id':_0x4ec870[_0x726d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1df25a,null))[_0x726d('0x24')](saveUpdates(_0x4ec870['body'],null))[_0x726d('0x24')](respondWithResult(_0x1df25a,null))['catch'](handleError(_0x1df25a,null));};exports[_0x726d('0x25')]=function(_0x3ca006,_0x6beceb){return db['WhatsappQueue'][_0x726d('0x50')]({'where':{'id':_0x3ca006[_0x726d('0x46')]['id']}})['then'](handleEntityNotFound(_0x6beceb,null))[_0x726d('0x24')](removeEntity(_0x6beceb,null))['catch'](handleError(_0x6beceb,null));};exports['describe']=function(_0x8c4e14,_0xf62996){return db['WhatsappQueue'][_0x726d('0x54')]()[_0x726d('0x24')](respondWithResult(_0xf62996,null))[_0x726d('0x53')](handleError(_0xf62996,null));};exports[_0x726d('0x55')]=function(_0x1c1736,_0x435276,_0x2a6f26){var _0x9a73c3={'raw':!![],'where':{}},_0x3d26a9={},_0x3bc796;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1c1736[_0x726d('0x46')]['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x435276,null))[_0x726d('0x24')](function(_0x302a02){if(_0x302a02){_0x3bc796=_0x302a02[_0x726d('0x4c')]({'plain':!![]});_0x3d26a9[_0x726d('0x35')]=_[_0x726d('0x47')](db[_0x726d('0x56')][_0x726d('0x2d')]);_0x3d26a9[_0x726d('0x32')]=_['keys'](_0x1c1736[_0x726d('0x32')]);_0x3d26a9[_0x726d('0x33')]=_[_0x726d('0x34')](_0x3d26a9['model'],_0x3d26a9[_0x726d('0x32')]);_0x9a73c3[_0x726d('0x36')]=_[_0x726d('0x34')](_0x3d26a9[_0x726d('0x35')],qs['fields'](_0x1c1736[_0x726d('0x32')][_0x726d('0x37')]));_0x9a73c3[_0x726d('0x36')]=_0x9a73c3[_0x726d('0x36')][_0x726d('0x38')]?_0x9a73c3[_0x726d('0x36')]:_0x3d26a9[_0x726d('0x35')];if(!_0x1c1736[_0x726d('0x32')][_0x726d('0x57')]('nolimit')){_0x9a73c3['limit']=qs[_0x726d('0x39')](_0x1c1736['query']['limit']);_0x9a73c3[_0x726d('0x1f')]=qs[_0x726d('0x1f')](_0x1c1736[_0x726d('0x32')]['offset']);}_0x9a73c3[_0x726d('0x3a')]=qs['sort'](_0x1c1736['query'][_0x726d('0x3b')]);_0x9a73c3['where']=qs[_0x726d('0x33')](_[_0x726d('0x3d')](_0x1c1736[_0x726d('0x32')],_0x3d26a9[_0x726d('0x33')]));_0x9a73c3[_0x726d('0x3c')][_0x726d('0x58')]=_0x302a02['id'];if(_0x1c1736[_0x726d('0x32')]['filter']){_0x9a73c3['where']=_['merge'](_0x9a73c3[_0x726d('0x3c')],{'$or':_[_0x726d('0x30')](_0x9a73c3[_0x726d('0x36')],function(_0x1183ed){var _0xadb77e={};_0xadb77e[_0x1183ed]={'$like':'%'+_0x1c1736[_0x726d('0x32')][_0x726d('0x40')]+'%'};return _0xadb77e;})});}_0x9a73c3=_[_0x726d('0x3e')]({},_0x9a73c3,_0x1c1736[_0x726d('0x41')]);return db[_0x726d('0x56')][_0x726d('0x43')](_0x9a73c3);}})[_0x726d('0x24')](function(_0xbe478e){if(_0xbe478e){return db[_0x726d('0x59')][_0x726d('0x5a')]({'where':{'id':_[_0x726d('0x30')](_0xbe478e,'UserId'),'role':_0x726d('0x5b')},'attributes':['id',_0x726d('0x31'),_0x726d('0x5c'),_0x726d('0x5d'),_0x726d('0x5e')]});}})['then'](function(_0x20fbe8){if(_0x20fbe8){return{'count':_0x20fbe8['count'],'rows':_[_0x726d('0x30')](_0x20fbe8[_0x726d('0x44')],function(_0x33a61){return{'membername':_0x33a61[_0x726d('0x31')],'UserId':_0x33a61['id'],'queue_name':_0x3bc796[_0x726d('0x31')],'WhatsappQueueId':_0x3bc796['id'],'interface':util[_0x726d('0x5f')]('%s/%s','SIP',_0x33a61[_0x726d('0x31')]),'penalty':0x0,'paused':_0x33a61[_0x726d('0x5c')],'createdAt':_0x33a61[_0x726d('0x5e')],'updatedAt':_0x33a61[_0x726d('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x726d('0x24')](respondWithFilteredResult(_0x435276,_0x9a73c3))[_0x726d('0x53')](handleError(_0x435276,null));};exports[_0x726d('0x60')]=function(_0x41039d,_0x441c99,_0x990a5f){var _0x3d4fee={};var _0x505307={};var _0x307188;var _0xa13373;return db['WhatsappQueue']['findOne']({'where':{'id':_0x41039d['params']['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x441c99,null))[_0x726d('0x24')](function(_0x16adc2){if(_0x16adc2){_0x307188=_0x16adc2;_0x505307[_0x726d('0x35')]=_[_0x726d('0x47')](db[_0x726d('0x61')]['rawAttributes']);_0x505307[_0x726d('0x32')]=_[_0x726d('0x47')](_0x41039d[_0x726d('0x32')]);_0x505307[_0x726d('0x33')]=_[_0x726d('0x34')](_0x505307[_0x726d('0x35')],_0x505307['query']);_0x3d4fee[_0x726d('0x36')]=_['intersection'](_0x505307[_0x726d('0x35')],qs[_0x726d('0x37')](_0x41039d[_0x726d('0x32')][_0x726d('0x37')]));_0x3d4fee['attributes']=_0x3d4fee[_0x726d('0x36')][_0x726d('0x38')]?_0x3d4fee[_0x726d('0x36')]:_0x505307[_0x726d('0x35')];_0x3d4fee['order']=qs[_0x726d('0x3b')](_0x41039d['query'][_0x726d('0x3b')]);_0x3d4fee[_0x726d('0x3c')]=qs[_0x726d('0x33')](_[_0x726d('0x3d')](_0x41039d[_0x726d('0x32')],_0x505307[_0x726d('0x33')]));if(_0x41039d['query'][_0x726d('0x40')]){_0x3d4fee['where']=_[_0x726d('0x3e')](_0x3d4fee[_0x726d('0x3c')],{'$or':_['map'](_0x3d4fee[_0x726d('0x36')],function(_0xb6d8c6){var _0x1db5fb={};_0x1db5fb[_0xb6d8c6]={'$like':'%'+_0x41039d[_0x726d('0x32')][_0x726d('0x40')]+'%'};return _0x1db5fb;})});}_0x3d4fee=_[_0x726d('0x3e')]({},_0x3d4fee,_0x41039d[_0x726d('0x41')]);return _0x307188[_0x726d('0x60')](_0x3d4fee);}})[_0x726d('0x24')](function(_0x477242){if(_0x477242){_0xa13373=_0x477242[_0x726d('0x38')];if(!_0x41039d[_0x726d('0x32')][_0x726d('0x57')](_0x726d('0x62'))){_0x3d4fee[_0x726d('0x39')]=qs[_0x726d('0x39')](_0x41039d[_0x726d('0x32')]['limit']);_0x3d4fee[_0x726d('0x1f')]=qs[_0x726d('0x1f')](_0x41039d[_0x726d('0x32')][_0x726d('0x1f')]);}return _0x307188[_0x726d('0x60')](_0x3d4fee);}})[_0x726d('0x24')](function(_0x23b70e){if(_0x23b70e){return _0x23b70e?{'count':_0xa13373,'rows':_0x23b70e}:null;}})[_0x726d('0x24')](respondWithResult(_0x441c99,null))[_0x726d('0x53')](handleError(_0x441c99,null));};exports[_0x726d('0x63')]=function(_0x3eea2d,_0x272376,_0x3152f3){var _0x1137ac=_0x3eea2d[_0x726d('0x4a')][_0x726d('0x64')];return db[_0x726d('0x61')][_0x726d('0x43')]({'where':{'id':_0x1137ac},'attributes':['id'],'include':[{'model':db[_0x726d('0x59')],'as':_0x726d('0x65'),'attributes':['id',_0x726d('0x31'),_0x726d('0x66'),'voicePause',_0x726d('0x67')],'raw':!![]}]})[_0x726d('0x24')](function(_0x4c2d92){if(_0x4c2d92){var _0x51d636=_[_0x726d('0x68')](_0x4c2d92,function(_0x550eb6){var _0x4759c8=_0x550eb6['get']({'plain':!![]});return _0x4759c8[_0x726d('0x65')];});return db[_0x726d('0x2c')][_0x726d('0x50')]({'where':{'id':_0x3eea2d[_0x726d('0x46')]['id']}})[_0x726d('0x24')](function(_0x38a789){return db[_0x726d('0x69')][_0x726d('0x6a')](function(_0x11a491){return _0x38a789[_0x726d('0x63')](_0x1137ac,{'transaction':_0x11a491})[_0x726d('0x24')](function(){return BPromise[_0x726d('0x6b')](_0x51d636,function(_0x713a9){return db[_0x726d('0x56')][_0x726d('0x6c')]({'where':{'UserId':_0x713a9['id'],'WhatsappQueueId':_0x3eea2d[_0x726d('0x46')]['id']},'transaction':_0x11a491});});})[_0x726d('0x24')](function(){_0x51d636[_0x726d('0x6d')](function(_0x4a5e37){socket[_0x726d('0x6e')](_0x726d('0x6f'),{'UserId':_0x4a5e37['id'],'WhatsappQueueId':_0x38a789['id']});});});});});}})[_0x726d('0x24')](respondWithStatusCode(_0x272376,null))['catch'](handleError(_0x272376,null));};exports[_0x726d('0x70')]=function(_0x23fff7,_0x31b73c,_0x143cb2){return db[_0x726d('0x61')]['findAll']({'where':{'id':_0x23fff7['query'][_0x726d('0x64')]},'attributes':['id'],'include':[{'model':db[_0x726d('0x59')],'as':_0x726d('0x65'),'attributes':['id'],'raw':!![]}]})[_0x726d('0x24')](handleEntityNotFound(_0x31b73c,null))[_0x726d('0x24')](function(_0x5e1848){var _0x2355a1=_[_0x726d('0x30')](_0x5e1848,'id');var _0x2deae3=[];var _0x577eba=[];var _0x4cf909=squel[_0x726d('0x71')]();_0x4cf909['field']('tq.TeamId')[_0x726d('0x72')](_0x726d('0x73'),'tq')['join'](_0x726d('0x74'),'ut',_0x726d('0x75'))[_0x726d('0x3c')](_0x726d('0x76'),_0x23fff7[_0x726d('0x46')]['id']);for(var _0x4348ad=0x0;_0x4348ad<_0x5e1848[_0x726d('0x38')];_0x4348ad+=0x1){let _0x3be25e=_0x5e1848[_0x4348ad];for(var _0x5ef839=0x0;_0x5ef839<_0x3be25e[_0x726d('0x65')]['length'];_0x5ef839+=0x1){let _0x57d051=_0x3be25e['Agents'][_0x5ef839];var _0x69657c=_0x4cf909[_0x726d('0x77')]();_0x69657c[_0x726d('0x3c')](_0x726d('0x78'),_0x57d051['id']);_0x577eba[_0x726d('0x79')](db[_0x726d('0x69')][_0x726d('0x32')](_0x69657c[_0x726d('0x7a')](),{'type':db['sequelize'][_0x726d('0x7b')][_0x726d('0x7c')]})['then'](function(_0x9426d9){if(_0x9426d9[_0x726d('0x38')]===0x1){return _0x57d051['id'];}else{var _0x1eee12=_['every'](_['map'](_0x9426d9,'TeamId'),function(_0x4e1c11){return _[_0x726d('0x7d')](_0x2355a1,_0x4e1c11);});if(_0x1eee12){return _0x57d051['id'];}}}));}}return BPromise['all'](_0x577eba)[_0x726d('0x24')](function(_0x397ae7){_0x2deae3=_(_0x2deae3)[_0x726d('0x7e')](_0x397ae7)[_0x726d('0x7f')]()[_0x726d('0x80')]();return db[_0x726d('0x2c')][_0x726d('0x50')]({'where':{'id':_0x23fff7['params']['id']}})['then'](function(_0x5d9972){return db[_0x726d('0x69')][_0x726d('0x6a')](function(_0x121894){return _0x5d9972[_0x726d('0x70')](_0x23fff7[_0x726d('0x32')]['ids'],{'transaction':_0x121894})[_0x726d('0x24')](function(){if(!_[_0x726d('0x81')](_0x2deae3)){return _0x5d9972[_0x726d('0x82')](_0x2deae3,{'transaction':_0x121894});}})[_0x726d('0x24')](function(){_0x2deae3['forEach'](function(_0x1f2f58){socket[_0x726d('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x1f2f58,'WhatsappQueueId':_0x5d9972['id']});});});});});});})['then'](respondWithStatusCode(_0x31b73c,null))[_0x726d('0x53')](handleError(_0x31b73c,null));};exports[_0x726d('0x83')]=function(_0x44a558,_0x5ea767,_0x1b7370){return db['WhatsappQueue'][_0x726d('0x50')]({'where':{'id':_0x44a558[_0x726d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ea767,null))['then'](function(_0x21659f){if(_0x21659f){return _0x21659f[_0x726d('0x83')](_0x44a558[_0x726d('0x4a')][_0x726d('0x64')],_[_0x726d('0x84')](_0x44a558[_0x726d('0x4a')],['ids','id'])||{})[_0x726d('0x85')](function(_0x567eec){for(var _0x124cab=0x0;_0x124cab<_0x44a558[_0x726d('0x4a')]['ids']['length'];_0x124cab+=0x1){socket[_0x726d('0x6e')](_0x726d('0x6f'),{'UserId':_0x44a558[_0x726d('0x4a')][_0x726d('0x64')][_0x124cab],'WhatsappQueueId':_0x44a558[_0x726d('0x46')]['id']});}return _0x567eec;});}})[_0x726d('0x24')](respondWithResult(_0x5ea767,null))[_0x726d('0x53')](handleError(_0x5ea767,null));};exports[_0x726d('0x82')]=function(_0x1b71df,_0x2e5c55,_0x578cca){return db[_0x726d('0x2c')][_0x726d('0x50')]({'where':{'id':_0x1b71df[_0x726d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e5c55,null))['then'](function(_0x10c940){if(_0x10c940){return _0x10c940[_0x726d('0x82')](_0x1b71df['query'][_0x726d('0x64')])['then'](function(){if(_[_0x726d('0x86')](_0x1b71df[_0x726d('0x32')][_0x726d('0x64')])){for(var _0x366018=0x0;_0x366018<_0x1b71df[_0x726d('0x32')][_0x726d('0x64')]['length'];_0x366018+=0x1){socket[_0x726d('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0x1b71df[_0x726d('0x32')][_0x726d('0x64')][_0x366018]),'WhatsappQueueId':Number(_0x1b71df[_0x726d('0x46')]['id'])});}}else{socket[_0x726d('0x6e')](_0x726d('0x87'),{'UserId':Number(_0x1b71df[_0x726d('0x32')]['ids']),'WhatsappQueueId':Number(_0x1b71df[_0x726d('0x46')]['id'])});}});}})[_0x726d('0x24')](respondWithStatusCode(_0x2e5c55,null))[_0x726d('0x53')](handleError(_0x2e5c55,null));};exports['getAgents']=function(_0x47119c,_0x1e00f4,_0x49e011){var _0x8aba8c={};var _0xc31d3e={};var _0x1310ff;var _0x3ab507;return db[_0x726d('0x2c')][_0x726d('0x88')]({'where':{'id':_0x47119c[_0x726d('0x46')]['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x1e00f4,null))[_0x726d('0x24')](function(_0xb29e69){if(_0xb29e69){_0x1310ff=_0xb29e69;_0xc31d3e[_0x726d('0x35')]=_['keys'](db[_0x726d('0x59')]['rawAttributes']);_0xc31d3e[_0x726d('0x32')]=_['keys'](_0x47119c[_0x726d('0x32')]);_0xc31d3e['filters']=_[_0x726d('0x34')](_0xc31d3e[_0x726d('0x35')],_0xc31d3e[_0x726d('0x32')]);_0x8aba8c['attributes']=_[_0x726d('0x34')](_0xc31d3e[_0x726d('0x35')],qs['fields'](_0x47119c[_0x726d('0x32')][_0x726d('0x37')]));_0x8aba8c[_0x726d('0x36')]=_0x8aba8c[_0x726d('0x36')][_0x726d('0x38')]?_0x8aba8c[_0x726d('0x36')]:_0xc31d3e[_0x726d('0x35')];_0x8aba8c[_0x726d('0x3a')]=qs['sort'](_0x47119c['query'][_0x726d('0x3b')]);_0x8aba8c[_0x726d('0x3c')]=qs['filters'](_['pick'](_0x47119c[_0x726d('0x32')],_0xc31d3e[_0x726d('0x33')]));if(_0x47119c[_0x726d('0x32')][_0x726d('0x40')]){_0x8aba8c[_0x726d('0x3c')]=_[_0x726d('0x3e')](_0x8aba8c['where'],{'$or':_[_0x726d('0x30')](_0x8aba8c['attributes'],function(_0x56448c){var _0x46b195={};_0x46b195[_0x56448c]={'$like':'%'+_0x47119c['query']['filter']+'%'};return _0x46b195;})});}_0x8aba8c=_['merge']({},_0x8aba8c,_0x47119c[_0x726d('0x41')]);return _0x1310ff[_0x726d('0x89')](_0x8aba8c);}})[_0x726d('0x24')](function(_0x8ae2b){if(_0x8ae2b){_0x3ab507=_0x8ae2b['length'];if(!_0x47119c[_0x726d('0x32')][_0x726d('0x57')](_0x726d('0x62'))){_0x8aba8c['limit']=qs[_0x726d('0x39')](_0x47119c[_0x726d('0x32')][_0x726d('0x39')]);_0x8aba8c['offset']=qs['offset'](_0x47119c['query'][_0x726d('0x1f')]);}return _0x1310ff[_0x726d('0x89')](_0x8aba8c);}})[_0x726d('0x24')](function(_0x748b7d){if(_0x748b7d){return _0x748b7d?{'count':_0x3ab507,'rows':_0x748b7d}:null;}})['then'](respondWithResult(_0x1e00f4,null))[_0x726d('0x53')](handleError(_0x1e00f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index facd350..725b32f 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 _0xd3ff=['hook','WhatsappQueue','save','update','emit','hasOwnProperty'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd3ff,0x127));var _0xfd3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3ff[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xfd3f('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd3f('0x1'),'afterUpdate':_0xfd3f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1390b1){return function(_0x3ba506,_0x1f0591,_0x22acf4){WhatsappQueueEvents[_0xfd3f('0x3')](_0x1390b1+':'+_0x3ba506['id'],_0x3ba506);WhatsappQueueEvents[_0xfd3f('0x3')](_0x1390b1,_0x3ba506);_0x22acf4(null);};}for(var e in events){if(events[_0xfd3f('0x4')](e)){var event=events[e];WhatsappQueue[_0xfd3f('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x58d8=['emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4aa3ac,_0x1dc5ea){var _0x24c9e6=function(_0x57226d){while(--_0x57226d){_0x4aa3ac['push'](_0x4aa3ac['shift']());}};_0x24c9e6(++_0x1dc5ea);}(_0x58d8,0x1e9));var _0x858d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x58d8[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x858d('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x858d('0x1')](0x0);var events={'afterCreate':_0x858d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e4308){return function(_0x3d27bb,_0x18cb2a,_0x56b783){WhatsappQueueEvents[_0x858d('0x3')](_0x3e4308+':'+_0x3d27bb['id'],_0x3d27bb);WhatsappQueueEvents['emit'](_0x3e4308,_0x3d27bb);_0x56b783(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x858d('0x4')](e,emitEvent(event));}}module[_0x858d('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 51b1434..5ea1c01 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 _0xe2b8=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment'];(function(_0x1c4d83,_0x336130){var _0x3adc5e=function(_0x4f0c9a){while(--_0x4f0c9a){_0x1c4d83['push'](_0x1c4d83['shift']());}};_0x3adc5e(++_0x336130);}(_0xe2b8,0x1c3));var _0x8e2b=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xe2b8[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0x8e2b('0x0'));var util=require('util');var logger=require(_0x8e2b('0x1'))(_0x8e2b('0x2'));var moment=require(_0x8e2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e2b('0x4'));var fs=require('fs');var path=require(_0x8e2b('0x5'));var rimraf=require(_0x8e2b('0x6'));var config=require(_0x8e2b('0x7'));var attributes=require(_0x8e2b('0x8'));module[_0x8e2b('0x9')]=function(_0x17ace0,_0x1a80a6){return _0x17ace0[_0x8e2b('0xa')](_0x8e2b('0xb'),attributes,{'tableName':_0x8e2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c2=['whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x56e9aa,_0x866efb){var _0x9aff13=function(_0x2b49ff){while(--_0x2b49ff){_0x56e9aa['push'](_0x56e9aa['shift']());}};_0x9aff13(++_0x866efb);}(_0x81c2,0xb5));var _0x281c=function(_0x1c5037,_0x52e4d0){_0x1c5037=_0x1c5037-0x0;var _0x1e6ead=_0x81c2[_0x1c5037];return _0x1e6ead;};'use strict';var _=require(_0x281c('0x0'));var util=require(_0x281c('0x1'));var logger=require(_0x281c('0x2'))(_0x281c('0x3'));var moment=require(_0x281c('0x4'));var BPromise=require(_0x281c('0x5'));var rp=require(_0x281c('0x6'));var fs=require('fs');var path=require(_0x281c('0x7'));var rimraf=require(_0x281c('0x8'));var config=require(_0x281c('0x9'));var attributes=require(_0x281c('0xa'));module[_0x281c('0xb')]=function(_0x555f04,_0x3d04e5){return _0x555f04[_0x281c('0xc')](_0x281c('0xd'),attributes,{'tableName':_0x281c('0xe'),'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 0704f9f..b36db20 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 _0x27b2=['stringify','error','code','message','info','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4b38c3,_0xdae9f3){var _0x2a4618=function(_0x4951b7){while(--_0x4951b7){_0x4b38c3['push'](_0x4b38c3['shift']());}};_0x2a4618(++_0xdae9f3);}(_0x27b2,0x18f));var _0x227b=function(_0x1489d8,_0x296033){_0x1489d8=_0x1489d8-0x0;var _0x49cfef=_0x27b2[_0x1489d8];return _0x49cfef;};'use strict';var _=require(_0x227b('0x0'));var util=require(_0x227b('0x1'));var moment=require(_0x227b('0x2'));var BPromise=require(_0x227b('0x3'));var rs=require(_0x227b('0x4'));var fs=require('fs');var Redis=require(_0x227b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x227b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x227b('0x7'));var jayson=require(_0x227b('0x8'));var client=jayson[_0x227b('0x9')][_0x227b('0xa')]({'port':0x232a});config[_0x227b('0xb')]=_[_0x227b('0xc')](config[_0x227b('0xb')],{'host':_0x227b('0xd'),'port':0x18eb});var socket=require(_0x227b('0xe'))(new Redis(config[_0x227b('0xb')]));require(_0x227b('0xf'))['register'](socket);function respondWithRpcPromise(_0x569bf5,_0x14c01e,_0x42833e){return new BPromise(function(_0x2c66f3,_0x4e6103){return client['request'](_0x569bf5,_0x42833e)[_0x227b('0x10')](function(_0x265ee7){logger['info'](_0x227b('0x11'),_0x14c01e,_0x227b('0x12'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x14c01e,_0x227b('0x12'),JSON[_0x227b('0x13')](_0x265ee7));if(_0x265ee7[_0x227b('0x14')]){if(_0x265ee7[_0x227b('0x14')][_0x227b('0x15')]===0x1f4){logger[_0x227b('0x14')](_0x227b('0x11'),_0x14c01e,_0x265ee7['error'][_0x227b('0x16')]);return _0x4e6103(_0x265ee7[_0x227b('0x14')][_0x227b('0x16')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x14c01e,_0x265ee7['error'][_0x227b('0x16')]);return _0x2c66f3(_0x265ee7['error']['message']);}else{logger[_0x227b('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x14c01e,_0x227b('0x12'));_0x2c66f3(_0x265ee7[_0x227b('0x18')][_0x227b('0x16')]);}})[_0x227b('0x19')](function(_0x40b064){logger[_0x227b('0x14')](_0x227b('0x11'),_0x14c01e,_0x40b064);_0x4e6103(_0x40b064);});});}exports[_0x227b('0x1a')]=function(_0x4ae630){var _0x4e11dc=this;return new Promise(function(_0x314380,_0x2793ae){return db['WhatsappQueue']['findAll']({'raw':_0x4ae630[_0x227b('0x1b')]?_0x4ae630[_0x227b('0x1b')][_0x227b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ae630[_0x227b('0x1b')]?_0x4ae630[_0x227b('0x1b')][_0x227b('0x1d')]||null:null,'attributes':_0x4ae630[_0x227b('0x1b')]?_0x4ae630['options'][_0x227b('0x1e')]||null:null,'limit':_0x4ae630[_0x227b('0x1b')]?_0x4ae630['options'][_0x227b('0x1f')]||null:null,'include':_0x4ae630[_0x227b('0x1b')]?_0x4ae630[_0x227b('0x1b')][_0x227b('0x20')]?_[_0x227b('0x21')](_0x4ae630[_0x227b('0x1b')][_0x227b('0x20')],function(_0xe5e2c4){return{'model':db[_0xe5e2c4[_0x227b('0x22')]],'as':_0xe5e2c4['as'],'attributes':_0xe5e2c4[_0x227b('0x1e')],'include':_0xe5e2c4[_0x227b('0x20')]?_[_0x227b('0x21')](_0xe5e2c4[_0x227b('0x20')],function(_0x41ba09){return{'model':db[_0x41ba09[_0x227b('0x22')]],'as':_0x41ba09['as'],'attributes':_0x41ba09[_0x227b('0x1e')],'include':_0x41ba09[_0x227b('0x20')]?_[_0x227b('0x21')](_0x41ba09[_0x227b('0x20')],function(_0x4f884f){return{'model':db[_0x4f884f[_0x227b('0x22')]],'as':_0x4f884f['as'],'attributes':_0x4f884f[_0x227b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x227b('0x10')](function(_0x144021){logger['info'](_0x227b('0x1a'),_0x4ae630);logger[_0x227b('0x23')](_0x227b('0x1a'),_0x4ae630,JSON[_0x227b('0x13')](_0x144021));_0x314380(_0x144021);})['catch'](function(_0x1ae5a9){logger[_0x227b('0x14')](_0x227b('0x1a'),_0x1ae5a9['message'],_0x4ae630);_0x2793ae(_0x4e11dc[_0x227b('0x14')](0x1f4,_0x1ae5a9[_0x227b('0x16')]));});});};exports[_0x227b('0x24')]=function(_0x2debb7){var _0x560af6=this;return new Promise(function(_0x5400b2,_0x556121){return db['WhatsappQueue'][_0x227b('0x25')]({'raw':_0x2debb7[_0x227b('0x1b')]?_0x2debb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2debb7['options']?_0x2debb7[_0x227b('0x1b')][_0x227b('0x1d')]||null:null,'attributes':_0x2debb7['options']?_0x2debb7[_0x227b('0x1b')]['attributes']||null:null,'include':_0x2debb7[_0x227b('0x1b')]?_0x2debb7[_0x227b('0x1b')][_0x227b('0x20')]?_[_0x227b('0x21')](_0x2debb7[_0x227b('0x1b')][_0x227b('0x20')],function(_0x28c92f){return{'model':db[_0x28c92f['model']],'as':_0x28c92f['as'],'attributes':_0x28c92f[_0x227b('0x1e')],'include':_0x28c92f['include']?_['map'](_0x28c92f[_0x227b('0x20')],function(_0xb89727){return{'model':db[_0xb89727[_0x227b('0x22')]],'as':_0xb89727['as'],'attributes':_0xb89727[_0x227b('0x1e')],'include':_0xb89727[_0x227b('0x20')]?_[_0x227b('0x21')](_0xb89727[_0x227b('0x20')],function(_0x449a1e){return{'model':db[_0x449a1e[_0x227b('0x22')]],'as':_0x449a1e['as'],'attributes':_0x449a1e[_0x227b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398645){logger[_0x227b('0x17')](_0x227b('0x24'),_0x2debb7);logger['debug'](_0x227b('0x24'),_0x2debb7,JSON[_0x227b('0x13')](_0x398645));_0x5400b2(_0x398645);})[_0x227b('0x19')](function(_0x39d28b){logger[_0x227b('0x14')](_0x227b('0x24'),_0x39d28b[_0x227b('0x16')],_0x2debb7);_0x556121(_0x560af6[_0x227b('0x14')](0x1f4,_0x39d28b['message']));});});}; \ No newline at end of file +var _0x9f66=['localhost','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x368310,_0x305aae){var _0x483657=function(_0x800c3a){while(--_0x800c3a){_0x368310['push'](_0x368310['shift']());}};_0x483657(++_0x305aae);}(_0x9f66,0xfc));var _0x69f6=function(_0x23cd61,_0x3f51f6){_0x23cd61=_0x23cd61-0x0;var _0x3f087c=_0x9f66[_0x23cd61];return _0x3f087c;};'use strict';var _=require(_0x69f6('0x0'));var util=require(_0x69f6('0x1'));var moment=require(_0x69f6('0x2'));var BPromise=require(_0x69f6('0x3'));var rs=require(_0x69f6('0x4'));var fs=require('fs');var Redis=require(_0x69f6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x69f6('0x6'));var logger=require(_0x69f6('0x7'))('rpc');var config=require(_0x69f6('0x8'));var jayson=require(_0x69f6('0x9'));var client=jayson[_0x69f6('0xa')][_0x69f6('0xb')]({'port':0x232a});config[_0x69f6('0xc')]=_[_0x69f6('0xd')](config[_0x69f6('0xc')],{'host':_0x69f6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x69f6('0xf')](socket);function respondWithRpcPromise(_0x54aca6,_0x1f8317,_0x11204f){return new BPromise(function(_0x5a0203,_0x2ad258){return client['request'](_0x54aca6,_0x11204f)[_0x69f6('0x10')](function(_0x11d7ac){logger[_0x69f6('0x11')](_0x69f6('0x12'),_0x1f8317,_0x69f6('0x13'));logger[_0x69f6('0x14')](_0x69f6('0x15'),_0x1f8317,'request\x20sent',JSON[_0x69f6('0x16')](_0x11d7ac));if(_0x11d7ac['error']){if(_0x11d7ac[_0x69f6('0x17')][_0x69f6('0x18')]===0x1f4){logger[_0x69f6('0x17')](_0x69f6('0x12'),_0x1f8317,_0x11d7ac[_0x69f6('0x17')][_0x69f6('0x19')]);return _0x2ad258(_0x11d7ac[_0x69f6('0x17')][_0x69f6('0x19')]);}logger[_0x69f6('0x17')](_0x69f6('0x12'),_0x1f8317,_0x11d7ac[_0x69f6('0x17')][_0x69f6('0x19')]);return _0x5a0203(_0x11d7ac[_0x69f6('0x17')][_0x69f6('0x19')]);}else{logger[_0x69f6('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x1f8317,_0x69f6('0x13'));_0x5a0203(_0x11d7ac[_0x69f6('0x1a')][_0x69f6('0x19')]);}})[_0x69f6('0x1b')](function(_0x194a93){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1f8317,_0x194a93);_0x2ad258(_0x194a93);});});}exports[_0x69f6('0x1c')]=function(_0x227de3){var _0x1be9db=this;return new Promise(function(_0x158eb0,_0x5f0cbb){return db['WhatsappQueue'][_0x69f6('0x1d')]({'raw':_0x227de3['options']?_0x227de3[_0x69f6('0x1e')][_0x69f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x227de3[_0x69f6('0x1e')]?_0x227de3[_0x69f6('0x1e')]['where']||null:null,'attributes':_0x227de3['options']?_0x227de3[_0x69f6('0x1e')][_0x69f6('0x20')]||null:null,'limit':_0x227de3[_0x69f6('0x1e')]?_0x227de3[_0x69f6('0x1e')][_0x69f6('0x21')]||null:null,'include':_0x227de3[_0x69f6('0x1e')]?_0x227de3[_0x69f6('0x1e')][_0x69f6('0x22')]?_[_0x69f6('0x23')](_0x227de3[_0x69f6('0x1e')][_0x69f6('0x22')],function(_0x2f6b57){return{'model':db[_0x2f6b57[_0x69f6('0x24')]],'as':_0x2f6b57['as'],'attributes':_0x2f6b57[_0x69f6('0x20')],'include':_0x2f6b57[_0x69f6('0x22')]?_['map'](_0x2f6b57[_0x69f6('0x22')],function(_0x154fa7){return{'model':db[_0x154fa7['model']],'as':_0x154fa7['as'],'attributes':_0x154fa7[_0x69f6('0x20')],'include':_0x154fa7[_0x69f6('0x22')]?_[_0x69f6('0x23')](_0x154fa7['include'],function(_0x2ba97c){return{'model':db[_0x2ba97c['model']],'as':_0x2ba97c['as'],'attributes':_0x2ba97c['attributes']};}):[]};}):[]};}):[]:[]})[_0x69f6('0x10')](function(_0x21214){logger['info'](_0x69f6('0x1c'),_0x227de3);logger[_0x69f6('0x14')](_0x69f6('0x1c'),_0x227de3,JSON[_0x69f6('0x16')](_0x21214));_0x158eb0(_0x21214);})[_0x69f6('0x1b')](function(_0x151ccf){logger[_0x69f6('0x17')](_0x69f6('0x1c'),_0x151ccf[_0x69f6('0x19')],_0x227de3);_0x5f0cbb(_0x1be9db[_0x69f6('0x17')](0x1f4,_0x151ccf[_0x69f6('0x19')]));});});};exports[_0x69f6('0x25')]=function(_0x402a48){var _0x1eab10=this;return new Promise(function(_0x6e7758,_0x3c013c){return db['WhatsappQueue']['find']({'raw':_0x402a48[_0x69f6('0x1e')]?_0x402a48[_0x69f6('0x1e')][_0x69f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x402a48['options']?_0x402a48[_0x69f6('0x1e')]['where']||null:null,'attributes':_0x402a48[_0x69f6('0x1e')]?_0x402a48['options'][_0x69f6('0x20')]||null:null,'include':_0x402a48[_0x69f6('0x1e')]?_0x402a48[_0x69f6('0x1e')][_0x69f6('0x22')]?_['map'](_0x402a48[_0x69f6('0x1e')][_0x69f6('0x22')],function(_0x4ceff4){return{'model':db[_0x4ceff4[_0x69f6('0x24')]],'as':_0x4ceff4['as'],'attributes':_0x4ceff4[_0x69f6('0x20')],'include':_0x4ceff4[_0x69f6('0x22')]?_[_0x69f6('0x23')](_0x4ceff4[_0x69f6('0x22')],function(_0x460469){return{'model':db[_0x460469['model']],'as':_0x460469['as'],'attributes':_0x460469[_0x69f6('0x20')],'include':_0x460469['include']?_['map'](_0x460469['include'],function(_0x256639){return{'model':db[_0x256639[_0x69f6('0x24')]],'as':_0x256639['as'],'attributes':_0x256639[_0x69f6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x69f6('0x10')](function(_0x4457e8){logger[_0x69f6('0x11')](_0x69f6('0x25'),_0x402a48);logger[_0x69f6('0x14')]('ShowWhatsappQueue',_0x402a48,JSON[_0x69f6('0x16')](_0x4457e8));_0x6e7758(_0x4457e8);})['catch'](function(_0x4328ca){logger[_0x69f6('0x17')](_0x69f6('0x25'),_0x4328ca[_0x69f6('0x19')],_0x402a48);_0x3c013c(_0x1eab10['error'](0x1f4,_0x4328ca[_0x69f6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 934cc76..f35de95 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 _0xc6a2=['emit','removeListener','register','length','whatsappQueue:','save','remove','update'];(function(_0x5bed5e,_0x27d338){var _0x8020e7=function(_0x57fc8c){while(--_0x57fc8c){_0x5bed5e['push'](_0x5bed5e['shift']());}};_0x8020e7(++_0x27d338);}(_0xc6a2,0x17d));var _0x2c6a=function(_0x56ca2d,_0x11f2cf){_0x56ca2d=_0x56ca2d-0x0;var _0x516cd1=_0xc6a2[_0x56ca2d];return _0x516cd1;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x2c6a('0x0'),_0x2c6a('0x1'),_0x2c6a('0x2')];function createListener(_0x6c9aa0,_0x150f1b){return function(_0x4f4865){_0x150f1b[_0x2c6a('0x3')](_0x6c9aa0,_0x4f4865);};}function removeListener(_0x8b3f7f,_0x47d6b3){return function(){WhatsappQueueEvents[_0x2c6a('0x4')](_0x8b3f7f,_0x47d6b3);};}exports[_0x2c6a('0x5')]=function(_0x15da35){for(var _0x1f9db9=0x0,_0x2ef97f=events[_0x2c6a('0x6')];_0x1f9db9<_0x2ef97f;_0x1f9db9++){var _0x21525d=events[_0x1f9db9];var _0x369952=createListener(_0x2c6a('0x7')+_0x21525d,_0x15da35);WhatsappQueueEvents['on'](_0x21525d,_0x369952);}}; \ No newline at end of file +var _0xd22b=['remove','emit','removeListener','register','./whatsappQueue.events','save'];(function(_0x36c400,_0x1d9609){var _0xc117d3=function(_0x1d2276){while(--_0x1d2276){_0x36c400['push'](_0x36c400['shift']());}};_0xc117d3(++_0x1d9609);}(_0xd22b,0x1ea));var _0xbd22=function(_0x1feb96,_0xe073f1){_0x1feb96=_0x1feb96-0x0;var _0x1fc186=_0xd22b[_0x1feb96];return _0x1fc186;};'use strict';var WhatsappQueueEvents=require(_0xbd22('0x0'));var events=[_0xbd22('0x1'),_0xbd22('0x2'),'update'];function createListener(_0x1530a7,_0x55fb7a){return function(_0x3fa5d0){_0x55fb7a[_0xbd22('0x3')](_0x1530a7,_0x3fa5d0);};}function removeListener(_0x596464,_0x47c68a){return function(){WhatsappQueueEvents[_0xbd22('0x4')](_0x596464,_0x47c68a);};}exports[_0xbd22('0x5')]=function(_0x362387){for(var _0x1130a5=0x0,_0x2e21af=events['length'];_0x1130a5<_0x2e21af;_0x1130a5++){var _0x3cd26e=events[_0x1130a5];var _0x516ca8=createListener('whatsappQueue:'+_0x3cd26e,_0x362387);WhatsappQueueEvents['on'](_0x3cd26e,_0x516ca8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3efb082..b0c08f8 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 _0x9143=['isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','/describe'];(function(_0x3185ad,_0x5e5ca2){var _0x4f77fb=function(_0x435aca){while(--_0x435aca){_0x3185ad['push'](_0x3185ad['shift']());}};_0x4f77fb(++_0x5e5ca2);}(_0x9143,0x1a9));var _0x3914=function(_0x144038,_0x36aadb){_0x144038=_0x144038-0x0;var _0x80fd69=_0x9143[_0x144038];return _0x80fd69;};'use strict';var multer=require(_0x3914('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3914('0x1'));var router=express['Router']();var auth=require(_0x3914('0x2'));var interaction=require(_0x3914('0x3'));var config=require('../../config/environment');var controller=require(_0x3914('0x4'));router[_0x3914('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3914('0x5')](_0x3914('0x6'),auth[_0x3914('0x7')](),controller[_0x3914('0x8')]);router[_0x3914('0x5')](_0x3914('0x9'),auth[_0x3914('0x7')](),controller[_0x3914('0xa')]);router[_0x3914('0xb')]('/',auth[_0x3914('0x7')](),controller[_0x3914('0xc')]);router[_0x3914('0xd')](_0x3914('0x9'),auth[_0x3914('0x7')](),controller[_0x3914('0xe')]);router[_0x3914('0xf')](_0x3914('0x9'),auth[_0x3914('0x7')](),controller[_0x3914('0x10')]);module[_0x3914('0x11')]=router; \ No newline at end of file +var _0x1015=['update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','post','create','/:id'];(function(_0x378bab,_0x2714cd){var _0x5cda01=function(_0x1f4b4f){while(--_0x1f4b4f){_0x378bab['push'](_0x378bab['shift']());}};_0x5cda01(++_0x2714cd);}(_0x1015,0xca));var _0x5101=function(_0x362454,_0x164fea){_0x362454=_0x362454-0x0;var _0x2d4798=_0x1015[_0x362454];return _0x2d4798;};'use strict';var multer=require(_0x5101('0x0'));var util=require(_0x5101('0x1'));var path=require(_0x5101('0x2'));var timeout=require('connect-timeout');var express=require(_0x5101('0x3'));var router=express['Router']();var auth=require(_0x5101('0x4'));var interaction=require(_0x5101('0x5'));var config=require(_0x5101('0x6'));var controller=require(_0x5101('0x7'));router[_0x5101('0x8')]('/',auth[_0x5101('0x9')](),controller[_0x5101('0xa')]);router[_0x5101('0x8')]('/describe',auth[_0x5101('0x9')](),controller['describe']);router[_0x5101('0x8')]('/:id',auth[_0x5101('0x9')](),controller['show']);router[_0x5101('0xb')]('/',auth['isAuthenticated'](),controller[_0x5101('0xc')]);router['put'](_0x5101('0xd'),auth[_0x5101('0x9')](),controller[_0x5101('0xe')]);router[_0x5101('0xf')](_0x5101('0xd'),auth[_0x5101('0x9')](),controller[_0x5101('0x10')]);module[_0x5101('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 245ad0b..3d37c75 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 _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x49a306,_0x4c9a24){var _0x1c7fca=function(_0x4d0d72){while(--_0x4d0d72){_0x49a306['push'](_0x49a306['shift']());}};_0x1c7fca(++_0x4c9a24);}(_0x34e8,0x12c));var _0x834e=function(_0x5242bd,_0x528140){_0x5242bd=_0x5242bd-0x0;var _0x4bce11=_0x34e8[_0x5242bd];return _0x4bce11;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x12b07f,_0x216fc2){var _0x3233f8=function(_0x37165f){while(--_0x37165f){_0x12b07f['push'](_0x12b07f['shift']());}};_0x3233f8(++_0x216fc2);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 527f583..5f9801f 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 _0x3c7f=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','html-pdf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x56d6b6,_0x12f19f){var _0x236039=function(_0x4a61c6){while(--_0x4a61c6){_0x56d6b6['push'](_0x56d6b6['shift']());}};_0x236039(++_0x12f19f);}(_0x3c7f,0x154));var _0xf3c7=function(_0x1e3fac,_0xa43e1d){_0x1e3fac=_0x1e3fac-0x0;var _0x596d94=_0x3c7f[_0x1e3fac];return _0x596d94;};'use strict';var pdf=require(_0xf3c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3c7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf3c7('0x2'));var Mustache=require(_0xf3c7('0x3'));var util=require('util');var path=require(_0xf3c7('0x4'));var sox=require(_0xf3c7('0x5'));var csv=require(_0xf3c7('0x6'));var ejs=require(_0xf3c7('0x7'));var fs=require('fs');var _=require(_0xf3c7('0x8'));var squel=require(_0xf3c7('0x9'));var crypto=require(_0xf3c7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf3c7('0xb'));var Papa=require('papaparse');var Redis=require(_0xf3c7('0xc'));var authService=require(_0xf3c7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf3c7('0xe'));var hardwareService=require(_0xf3c7('0xf'));var logger=require('../../config/logger')(_0xf3c7('0x10'));var utils=require('../../config/utils');var config=require(_0xf3c7('0x11'));var licenseUtil=require(_0xf3c7('0x12'));var db=require(_0xf3c7('0x13'))['db'];function respondWithStatusCode(_0x559563,_0x205fff){_0x205fff=_0x205fff||0xcc;return function(_0x4dfc33){if(_0x4dfc33){return _0x559563[_0xf3c7('0x14')](_0x205fff);}return _0x559563[_0xf3c7('0x15')](_0x205fff)[_0xf3c7('0x16')]();};}function respondWithResult(_0x27f293,_0x1b7ac4){_0x1b7ac4=_0x1b7ac4||0xc8;return function(_0x50e062){if(_0x50e062){return _0x27f293[_0xf3c7('0x15')](_0x1b7ac4)[_0xf3c7('0x17')](_0x50e062);}};}function respondWithFilteredResult(_0x450169,_0x25df90){return function(_0x5f2372){if(_0x5f2372){var _0xedd919=_0x5f2372['count'],_0x300130=_0x25df90[_0xf3c7('0x18')],_0x4b98b2=_0x25df90[_0xf3c7('0x18')]+_0x25df90[_0xf3c7('0x19')],_0x51bcda;if(_0x4b98b2>=_0xedd919){_0x4b98b2=_0xedd919;_0x51bcda=0xc8;}else{_0x51bcda=0xce;}_0x450169[_0xf3c7('0x15')](_0x51bcda);return _0x450169[_0xf3c7('0x1a')](_0xf3c7('0x1b'),_0x300130+'-'+_0x4b98b2+'/'+_0xedd919)['json'](_0x5f2372);}return null;};}function patchUpdates(_0x1da014){return function(_0x8549a7){try{jsonpatch[_0xf3c7('0x1c')](_0x8549a7,_0x1da014,!![]);}catch(_0x65e244){return BPromise[_0xf3c7('0x1d')](_0x65e244);}return _0x8549a7['save']();};}function saveUpdates(_0x1cb3b8,_0x30e6b0){return function(_0x1e51cb){if(_0x1e51cb){return _0x1e51cb[_0xf3c7('0x1e')](_0x1cb3b8)[_0xf3c7('0x1f')](function(_0xb525cc){return _0xb525cc;});}return null;};}function removeEntity(_0x13bf11,_0x3265fb){return function(_0x64c1dc){if(_0x64c1dc){return _0x64c1dc[_0xf3c7('0x20')]()['then'](function(){_0x13bf11[_0xf3c7('0x15')](0xcc)[_0xf3c7('0x16')]();});}};}function handleEntityNotFound(_0x45a87d,_0x1bc020){return function(_0x31fbce){if(!_0x31fbce){_0x45a87d[_0xf3c7('0x14')](0x194);}return _0x31fbce;};}function handleError(_0x578428,_0x46dd16){_0x46dd16=_0x46dd16||0x1f4;return function(_0x1d23e9){logger[_0xf3c7('0x21')](_0x1d23e9[_0xf3c7('0x22')]);if(_0x1d23e9[_0xf3c7('0x23')]){delete _0x1d23e9[_0xf3c7('0x23')];}_0x578428[_0xf3c7('0x15')](_0x46dd16)[_0xf3c7('0x24')](_0x1d23e9);};}exports[_0xf3c7('0x25')]=function(_0x4cc94c,_0x10c6e9){var _0x2fbc94={},_0x2e59e3={},_0x13c137={'count':0x0,'rows':[]};var _0x1e9c28=_[_0xf3c7('0x26')](db[_0xf3c7('0x27')]['rawAttributes'],function(_0xf32f84){return{'name':_0xf32f84['fieldName'],'type':_0xf32f84[_0xf3c7('0x28')][_0xf3c7('0x29')]};});_0x2e59e3[_0xf3c7('0x2a')]=_[_0xf3c7('0x26')](_0x1e9c28,_0xf3c7('0x23'));_0x2e59e3[_0xf3c7('0x2b')]=_['keys'](_0x4cc94c[_0xf3c7('0x2b')]);_0x2e59e3['filters']=_['intersection'](_0x2e59e3[_0xf3c7('0x2a')],_0x2e59e3['query']);_0x2fbc94[_0xf3c7('0x2c')]=_[_0xf3c7('0x2d')](_0x2e59e3[_0xf3c7('0x2a')],qs['fields'](_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x2e')]));_0x2fbc94[_0xf3c7('0x2c')]=_0x2fbc94[_0xf3c7('0x2c')][_0xf3c7('0x2f')]?_0x2fbc94['attributes']:_0x2e59e3[_0xf3c7('0x2a')];if(!_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x30')](_0xf3c7('0x31'))){_0x2fbc94['limit']=qs[_0xf3c7('0x19')](_0x4cc94c['query'][_0xf3c7('0x19')]);_0x2fbc94[_0xf3c7('0x18')]=qs[_0xf3c7('0x18')](_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x18')]);}_0x2fbc94[_0xf3c7('0x32')]=qs[_0xf3c7('0x33')](_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x33')]);_0x2fbc94[_0xf3c7('0x34')]=qs[_0xf3c7('0x35')](_['pick'](_0x4cc94c[_0xf3c7('0x2b')],_0x2e59e3['filters']),_0x1e9c28);if(_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x36')]){_0x2fbc94['where']=_[_0xf3c7('0x37')](_0x2fbc94[_0xf3c7('0x34')],{'$or':_[_0xf3c7('0x26')](_0x1e9c28,function(_0x544b0b){if(_0x544b0b[_0xf3c7('0x28')]!=='VIRTUAL'){var _0x38a457={};_0x38a457[_0x544b0b[_0xf3c7('0x23')]]={'$like':'%'+_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x36')]+'%'};return _0x38a457;}})});}_0x2fbc94=_[_0xf3c7('0x37')]({},_0x2fbc94,_0x4cc94c[_0xf3c7('0x38')]);var _0x5ac52b={'where':_0x2fbc94[_0xf3c7('0x34')]};return db[_0xf3c7('0x27')][_0xf3c7('0x39')](_0x5ac52b)[_0xf3c7('0x1f')](function(_0x22ff82){_0x13c137[_0xf3c7('0x39')]=_0x22ff82;if(_0x4cc94c[_0xf3c7('0x2b')][_0xf3c7('0x3a')]){_0x2fbc94[_0xf3c7('0x3b')]=[{'all':!![]}];}return db[_0xf3c7('0x27')][_0xf3c7('0x3c')](_0x2fbc94);})[_0xf3c7('0x1f')](function(_0x32ba9b){_0x13c137[_0xf3c7('0x3d')]=_0x32ba9b;return _0x13c137;})['then'](respondWithFilteredResult(_0x10c6e9,_0x2fbc94))[_0xf3c7('0x3e')](handleError(_0x10c6e9,null));};exports[_0xf3c7('0x3f')]=function(_0x2c667b,_0x45cc8a){var _0x529fbc={'raw':!![],'where':{'id':_0x2c667b[_0xf3c7('0x40')]['id']}},_0x4cf1a3={};_0x4cf1a3[_0xf3c7('0x2a')]=_[_0xf3c7('0x41')](db['WhatsappQueueReport'][_0xf3c7('0x42')]);_0x4cf1a3[_0xf3c7('0x2b')]=_['keys'](_0x2c667b[_0xf3c7('0x2b')]);_0x4cf1a3['filters']=_['intersection'](_0x4cf1a3[_0xf3c7('0x2a')],_0x4cf1a3[_0xf3c7('0x2b')]);_0x529fbc[_0xf3c7('0x2c')]=_[_0xf3c7('0x2d')](_0x4cf1a3['model'],qs['fields'](_0x2c667b[_0xf3c7('0x2b')][_0xf3c7('0x2e')]));_0x529fbc[_0xf3c7('0x2c')]=_0x529fbc['attributes']['length']?_0x529fbc[_0xf3c7('0x2c')]:_0x4cf1a3['model'];if(_0x2c667b[_0xf3c7('0x2b')]['includeAll']){_0x529fbc[_0xf3c7('0x3b')]=[{'all':!![]}];}_0x529fbc=_[_0xf3c7('0x37')]({},_0x529fbc,_0x2c667b[_0xf3c7('0x38')]);return db['WhatsappQueueReport'][_0xf3c7('0x43')](_0x529fbc)[_0xf3c7('0x1f')](handleEntityNotFound(_0x45cc8a,null))['then'](respondWithResult(_0x45cc8a,null))[_0xf3c7('0x3e')](handleError(_0x45cc8a,null));};exports['create']=function(_0x498884,_0x578252){return db[_0xf3c7('0x27')][_0xf3c7('0x44')](_0x498884[_0xf3c7('0x45')],{})[_0xf3c7('0x1f')](respondWithResult(_0x578252,0xc9))[_0xf3c7('0x3e')](handleError(_0x578252,null));};exports[_0xf3c7('0x1e')]=function(_0x553343,_0x123ae6){if(_0x553343[_0xf3c7('0x45')]['id']){delete _0x553343[_0xf3c7('0x45')]['id'];}return db[_0xf3c7('0x27')][_0xf3c7('0x43')]({'where':{'id':_0x553343['params']['id']}})[_0xf3c7('0x1f')](handleEntityNotFound(_0x123ae6,null))[_0xf3c7('0x1f')](saveUpdates(_0x553343['body'],null))['then'](respondWithResult(_0x123ae6,null))[_0xf3c7('0x3e')](handleError(_0x123ae6,null));};exports['destroy']=function(_0x1363b9,_0x52a18e){return db[_0xf3c7('0x27')][_0xf3c7('0x43')]({'where':{'id':_0x1363b9[_0xf3c7('0x40')]['id']}})[_0xf3c7('0x1f')](handleEntityNotFound(_0x52a18e,null))[_0xf3c7('0x1f')](removeEntity(_0x52a18e,null))[_0xf3c7('0x3e')](handleError(_0x52a18e,null));};exports[_0xf3c7('0x46')]=function(_0x2e4f18,_0x4e269f){return db['WhatsappQueueReport'][_0xf3c7('0x46')]()[_0xf3c7('0x1f')](respondWithResult(_0x4e269f,null))[_0xf3c7('0x3e')](handleError(_0x4e269f,null));}; \ No newline at end of file +var _0xf691=['nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','html-pdf','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x56673b,_0x4c94e5){var _0x3f360e=function(_0x542803){while(--_0x542803){_0x56673b['push'](_0x56673b['shift']());}};_0x3f360e(++_0x4c94e5);}(_0xf691,0xe4));var _0x1f69=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xf691[_0x2bbc07];return _0x6879e4;};'use strict';var pdf=require(_0x1f69('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1f69('0x2'));var moment=require(_0x1f69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f69('0x4'));var util=require(_0x1f69('0x5'));var path=require('path');var sox=require(_0x1f69('0x6'));var csv=require(_0x1f69('0x7'));var ejs=require(_0x1f69('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f69('0x9'));var crypto=require(_0x1f69('0xa'));var jsforce=require(_0x1f69('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f69('0x7'));var querystring=require(_0x1f69('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f69('0xd'));var qs=require(_0x1f69('0xe'));var as=require(_0x1f69('0xf'));var hardwareService=require(_0x1f69('0x10'));var logger=require(_0x1f69('0x11'))('api');var utils=require(_0x1f69('0x12'));var config=require(_0x1f69('0x13'));var licenseUtil=require(_0x1f69('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6af09,_0x334c4c){_0x334c4c=_0x334c4c||0xcc;return function(_0x44a3eb){if(_0x44a3eb){return _0xe6af09['sendStatus'](_0x334c4c);}return _0xe6af09[_0x1f69('0x15')](_0x334c4c)[_0x1f69('0x16')]();};}function respondWithResult(_0xbe2a52,_0x4f3c86){_0x4f3c86=_0x4f3c86||0xc8;return function(_0xbdb97){if(_0xbdb97){return _0xbe2a52[_0x1f69('0x15')](_0x4f3c86)['json'](_0xbdb97);}};}function respondWithFilteredResult(_0x3ac178,_0x3f7c99){return function(_0x2b8f69){if(_0x2b8f69){var _0x56c852=_0x2b8f69[_0x1f69('0x17')],_0x3ac976=_0x3f7c99['offset'],_0x422ec9=_0x3f7c99[_0x1f69('0x18')]+_0x3f7c99[_0x1f69('0x19')],_0x21ce94;if(_0x422ec9>=_0x56c852){_0x422ec9=_0x56c852;_0x21ce94=0xc8;}else{_0x21ce94=0xce;}_0x3ac178['status'](_0x21ce94);return _0x3ac178['set'](_0x1f69('0x1a'),_0x3ac976+'-'+_0x422ec9+'/'+_0x56c852)[_0x1f69('0x1b')](_0x2b8f69);}return null;};}function patchUpdates(_0x17e65c){return function(_0x66f6ac){try{jsonpatch[_0x1f69('0x1c')](_0x66f6ac,_0x17e65c,!![]);}catch(_0x4ce2df){return BPromise['reject'](_0x4ce2df);}return _0x66f6ac[_0x1f69('0x1d')]();};}function saveUpdates(_0x264f9c,_0x3b11c2){return function(_0x1809ef){if(_0x1809ef){return _0x1809ef[_0x1f69('0x1e')](_0x264f9c)[_0x1f69('0x1f')](function(_0x185514){return _0x185514;});}return null;};}function removeEntity(_0x4191d9,_0x2a26d2){return function(_0x1f9182){if(_0x1f9182){return _0x1f9182[_0x1f69('0x20')]()['then'](function(){_0x4191d9[_0x1f69('0x15')](0xcc)[_0x1f69('0x16')]();});}};}function handleEntityNotFound(_0x4996c2,_0x373d77){return function(_0x33fff4){if(!_0x33fff4){_0x4996c2[_0x1f69('0x21')](0x194);}return _0x33fff4;};}function handleError(_0x57a2ed,_0x29f951){_0x29f951=_0x29f951||0x1f4;return function(_0x3807b4){logger['error'](_0x3807b4[_0x1f69('0x22')]);if(_0x3807b4[_0x1f69('0x23')]){delete _0x3807b4[_0x1f69('0x23')];}_0x57a2ed['status'](_0x29f951)[_0x1f69('0x24')](_0x3807b4);};}exports[_0x1f69('0x25')]=function(_0x355a35,_0x3c144b){var _0x5ea9d1={},_0x301523={},_0x4f139c={'count':0x0,'rows':[]};var _0x38ecad=_[_0x1f69('0x26')](db[_0x1f69('0x27')][_0x1f69('0x28')],function(_0x258bc1){return{'name':_0x258bc1[_0x1f69('0x29')],'type':_0x258bc1[_0x1f69('0x2a')][_0x1f69('0x2b')]};});_0x301523['model']=_['map'](_0x38ecad,'name');_0x301523[_0x1f69('0x2c')]=_[_0x1f69('0x2d')](_0x355a35['query']);_0x301523[_0x1f69('0x2e')]=_[_0x1f69('0x2f')](_0x301523[_0x1f69('0x30')],_0x301523[_0x1f69('0x2c')]);_0x5ea9d1[_0x1f69('0x31')]=_[_0x1f69('0x2f')](_0x301523[_0x1f69('0x30')],qs[_0x1f69('0x32')](_0x355a35[_0x1f69('0x2c')][_0x1f69('0x32')]));_0x5ea9d1['attributes']=_0x5ea9d1[_0x1f69('0x31')][_0x1f69('0x33')]?_0x5ea9d1[_0x1f69('0x31')]:_0x301523[_0x1f69('0x30')];if(!_0x355a35[_0x1f69('0x2c')]['hasOwnProperty'](_0x1f69('0x34'))){_0x5ea9d1['limit']=qs[_0x1f69('0x19')](_0x355a35[_0x1f69('0x2c')][_0x1f69('0x19')]);_0x5ea9d1[_0x1f69('0x18')]=qs[_0x1f69('0x18')](_0x355a35['query'][_0x1f69('0x18')]);}_0x5ea9d1[_0x1f69('0x35')]=qs[_0x1f69('0x36')](_0x355a35['query'][_0x1f69('0x36')]);_0x5ea9d1[_0x1f69('0x37')]=qs[_0x1f69('0x2e')](_[_0x1f69('0x38')](_0x355a35[_0x1f69('0x2c')],_0x301523['filters']),_0x38ecad);if(_0x355a35[_0x1f69('0x2c')]['filter']){_0x5ea9d1[_0x1f69('0x37')]=_['merge'](_0x5ea9d1[_0x1f69('0x37')],{'$or':_['map'](_0x38ecad,function(_0x2a03e){if(_0x2a03e['type']!==_0x1f69('0x39')){var _0x27afee={};_0x27afee[_0x2a03e['name']]={'$like':'%'+_0x355a35[_0x1f69('0x2c')]['filter']+'%'};return _0x27afee;}})});}_0x5ea9d1=_[_0x1f69('0x3a')]({},_0x5ea9d1,_0x355a35[_0x1f69('0x3b')]);var _0x3668ab={'where':_0x5ea9d1[_0x1f69('0x37')]};return db['WhatsappQueueReport'][_0x1f69('0x17')](_0x3668ab)[_0x1f69('0x1f')](function(_0x386b10){_0x4f139c[_0x1f69('0x17')]=_0x386b10;if(_0x355a35['query'][_0x1f69('0x3c')]){_0x5ea9d1[_0x1f69('0x3d')]=[{'all':!![]}];}return db[_0x1f69('0x27')][_0x1f69('0x3e')](_0x5ea9d1);})[_0x1f69('0x1f')](function(_0x3880e6){_0x4f139c[_0x1f69('0x3f')]=_0x3880e6;return _0x4f139c;})[_0x1f69('0x1f')](respondWithFilteredResult(_0x3c144b,_0x5ea9d1))[_0x1f69('0x40')](handleError(_0x3c144b,null));};exports[_0x1f69('0x41')]=function(_0x2db954,_0x1db0ff){var _0x462c32={'raw':!![],'where':{'id':_0x2db954['params']['id']}},_0x752a17={};_0x752a17[_0x1f69('0x30')]=_['keys'](db['WhatsappQueueReport'][_0x1f69('0x28')]);_0x752a17[_0x1f69('0x2c')]=_[_0x1f69('0x2d')](_0x2db954[_0x1f69('0x2c')]);_0x752a17[_0x1f69('0x2e')]=_[_0x1f69('0x2f')](_0x752a17['model'],_0x752a17[_0x1f69('0x2c')]);_0x462c32['attributes']=_[_0x1f69('0x2f')](_0x752a17[_0x1f69('0x30')],qs[_0x1f69('0x32')](_0x2db954[_0x1f69('0x2c')]['fields']));_0x462c32[_0x1f69('0x31')]=_0x462c32[_0x1f69('0x31')]['length']?_0x462c32[_0x1f69('0x31')]:_0x752a17['model'];if(_0x2db954[_0x1f69('0x2c')][_0x1f69('0x3c')]){_0x462c32[_0x1f69('0x3d')]=[{'all':!![]}];}_0x462c32=_[_0x1f69('0x3a')]({},_0x462c32,_0x2db954[_0x1f69('0x3b')]);return db[_0x1f69('0x27')][_0x1f69('0x42')](_0x462c32)['then'](handleEntityNotFound(_0x1db0ff,null))[_0x1f69('0x1f')](respondWithResult(_0x1db0ff,null))['catch'](handleError(_0x1db0ff,null));};exports[_0x1f69('0x43')]=function(_0x59b486,_0x413e14){return db[_0x1f69('0x27')][_0x1f69('0x43')](_0x59b486['body'],{})[_0x1f69('0x1f')](respondWithResult(_0x413e14,0xc9))[_0x1f69('0x40')](handleError(_0x413e14,null));};exports['update']=function(_0x26ec25,_0x26f135){if(_0x26ec25[_0x1f69('0x44')]['id']){delete _0x26ec25[_0x1f69('0x44')]['id'];}return db['WhatsappQueueReport'][_0x1f69('0x42')]({'where':{'id':_0x26ec25['params']['id']}})[_0x1f69('0x1f')](handleEntityNotFound(_0x26f135,null))[_0x1f69('0x1f')](saveUpdates(_0x26ec25[_0x1f69('0x44')],null))[_0x1f69('0x1f')](respondWithResult(_0x26f135,null))['catch'](handleError(_0x26f135,null));};exports['destroy']=function(_0xdb3367,_0x3ae10a){return db[_0x1f69('0x27')][_0x1f69('0x42')]({'where':{'id':_0xdb3367['params']['id']}})[_0x1f69('0x1f')](handleEntityNotFound(_0x3ae10a,null))[_0x1f69('0x1f')](removeEntity(_0x3ae10a,null))[_0x1f69('0x40')](handleError(_0x3ae10a,null));};exports[_0x1f69('0x45')]=function(_0x3c3d5e,_0x5abf1c){return db[_0x1f69('0x27')][_0x1f69('0x45')]()[_0x1f69('0x1f')](respondWithResult(_0x5abf1c,null))[_0x1f69('0x40')](handleError(_0x5abf1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index faae731..e1355e1 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 _0xf70f=['bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api'];(function(_0xf1ed7,_0x455796){var _0x22e0bc=function(_0xb7bd78){while(--_0xb7bd78){_0xf1ed7['push'](_0xf1ed7['shift']());}};_0x22e0bc(++_0x455796);}(_0xf70f,0x76));var _0xff70=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0xf70f[_0x4a3acd];return _0x3efdaa;};'use strict';var _=require(_0xff70('0x0'));var util=require('util');var logger=require(_0xff70('0x1'))(_0xff70('0x2'));var moment=require('moment');var BPromise=require(_0xff70('0x3'));var rp=require(_0xff70('0x4'));var fs=require('fs');var path=require(_0xff70('0x5'));var rimraf=require(_0xff70('0x6'));var config=require('../../config/environment');var attributes=require(_0xff70('0x7'));module['exports']=function(_0x3ae4c8,_0x477ed4){return _0x3ae4c8[_0xff70('0x8')](_0xff70('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xff70('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaad=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x55d070,_0x285ac0){var _0x27b422=function(_0x3a2fa7){while(--_0x3a2fa7){_0x55d070['push'](_0x55d070['shift']());}};_0x27b422(++_0x285ac0);}(_0xbaad,0x155));var _0xdbaa=function(_0x119f2f,_0xc7aed){_0x119f2f=_0x119f2f-0x0;var _0x28e31d=_0xbaad[_0x119f2f];return _0x28e31d;};'use strict';var _=require(_0xdbaa('0x0'));var util=require(_0xdbaa('0x1'));var logger=require(_0xdbaa('0x2'))(_0xdbaa('0x3'));var moment=require(_0xdbaa('0x4'));var BPromise=require(_0xdbaa('0x5'));var rp=require(_0xdbaa('0x6'));var fs=require('fs');var path=require(_0xdbaa('0x7'));var rimraf=require(_0xdbaa('0x8'));var config=require(_0xdbaa('0x9'));var attributes=require('./whatsappQueueReport.attributes');module[_0xdbaa('0xa')]=function(_0x17f669,_0x30a22e){return _0x17f669[_0xdbaa('0xb')](_0xdbaa('0xc'),attributes,{'tableName':_0xdbaa('0xd'),'paranoid':![],'indexes':[{'name':_0xdbaa('0xe'),'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 4a23df7..6cf0072 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 _0xd696=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','create','body','options','raw','WhatsappQueueReport','limit','UpdateWhatsappQueueReport','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e0863,_0x5e7b9a){var _0x5cf89=function(_0x5a42cb){while(--_0x5a42cb){_0x3e0863['push'](_0x3e0863['shift']());}};_0x5cf89(++_0x5e7b9a);}(_0xd696,0x126));var _0x6d69=function(_0x58f555,_0x552ef2){_0x58f555=_0x58f555-0x0;var _0x4eb99b=_0xd696[_0x58f555];return _0x4eb99b;};'use strict';var _=require(_0x6d69('0x0'));var util=require(_0x6d69('0x1'));var moment=require(_0x6d69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d69('0x3'))['db'];var utils=require(_0x6d69('0x4'));var logger=require('../../config/logger')(_0x6d69('0x5'));var config=require(_0x6d69('0x6'));var jayson=require(_0x6d69('0x7'));var client=jayson[_0x6d69('0x8')][_0x6d69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x304556,_0x32c6a3,_0xe64f1){return new BPromise(function(_0x587e07,_0x23ffcd){return client[_0x6d69('0xa')](_0x304556,_0xe64f1)[_0x6d69('0xb')](function(_0x486001){logger[_0x6d69('0xc')](_0x6d69('0xd'),_0x32c6a3,_0x6d69('0xe'));logger[_0x6d69('0xf')](_0x6d69('0x10'),_0x32c6a3,_0x6d69('0xe'),JSON[_0x6d69('0x11')](_0x486001));if(_0x486001[_0x6d69('0x12')]){if(_0x486001[_0x6d69('0x12')][_0x6d69('0x13')]===0x1f4){logger[_0x6d69('0x12')](_0x6d69('0xd'),_0x32c6a3,_0x486001['error'][_0x6d69('0x14')]);return _0x23ffcd(_0x486001[_0x6d69('0x12')][_0x6d69('0x14')]);}logger[_0x6d69('0x12')](_0x6d69('0xd'),_0x32c6a3,_0x486001[_0x6d69('0x12')][_0x6d69('0x14')]);return _0x587e07(_0x486001[_0x6d69('0x12')][_0x6d69('0x14')]);}else{logger[_0x6d69('0xc')](_0x6d69('0xd'),_0x32c6a3,'request\x20sent');_0x587e07(_0x486001[_0x6d69('0x15')]['message']);}})['catch'](function(_0x3e1ac7){logger[_0x6d69('0x12')](_0x6d69('0xd'),_0x32c6a3,_0x3e1ac7);_0x23ffcd(_0x3e1ac7);});});}exports[_0x6d69('0x16')]=function(_0x32e6fc){var _0x4f15ad=this;return new Promise(function(_0x4e6c26,_0x470b0a){return db['WhatsappQueueReport'][_0x6d69('0x17')](_0x32e6fc[_0x6d69('0x18')],{'raw':_0x32e6fc['options']?_0x32e6fc[_0x6d69('0x19')][_0x6d69('0x1a')]===undefined?!![]:![]:!![]})[_0x6d69('0xb')](function(_0x157dd0){logger[_0x6d69('0xc')](_0x6d69('0x16'),_0x32e6fc);logger['debug'](_0x6d69('0x16'),_0x32e6fc,JSON[_0x6d69('0x11')](_0x157dd0));_0x4e6c26(_0x157dd0);})['catch'](function(_0x5076c5){logger[_0x6d69('0x12')](_0x6d69('0x16'),_0x5076c5[_0x6d69('0x14')],_0x32e6fc);_0x470b0a(_0x4f15ad[_0x6d69('0x12')](0x1f4,_0x5076c5[_0x6d69('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4cf689){var _0x291c3f=this;return new Promise(function(_0xe861d7,_0x4db46a){return db[_0x6d69('0x1b')]['update'](_0x4cf689[_0x6d69('0x18')],{'raw':_0x4cf689[_0x6d69('0x19')]?_0x4cf689['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf689['options']?_0x4cf689['options']['where']||null:null,'attributes':_0x4cf689[_0x6d69('0x19')]?_0x4cf689[_0x6d69('0x19')]['attributes']||null:null,'limit':_0x4cf689[_0x6d69('0x19')]?_0x4cf689[_0x6d69('0x19')][_0x6d69('0x1c')]||null:null})[_0x6d69('0xb')](function(_0x1eeacf){logger[_0x6d69('0xc')](_0x6d69('0x1d'),_0x4cf689);logger[_0x6d69('0xf')](_0x6d69('0x1d'),_0x4cf689,JSON['stringify'](_0x1eeacf));_0xe861d7(_0x1eeacf);})[_0x6d69('0x1e')](function(_0x522322){logger[_0x6d69('0x12')](_0x6d69('0x1d'),_0x522322[_0x6d69('0x14')],_0x4cf689);_0x4db46a(_0x291c3f['error'](0x1f4,_0x522322[_0x6d69('0x14')]));});});}; \ No newline at end of file +var _0x542a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','WhatsappQueueReport','create','body','options','stringify','catch','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','where','limit','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0x542a,0xa0));var _0xa542=function(_0x41d2b4,_0xffaf){_0x41d2b4=_0x41d2b4-0x0;var _0x35c32e=_0x542a[_0x41d2b4];return _0x35c32e;};'use strict';var _=require('lodash');var util=require(_0xa542('0x0'));var moment=require('moment');var BPromise=require(_0xa542('0x1'));var rs=require(_0xa542('0x2'));var fs=require('fs');var Redis=require(_0xa542('0x3'));var db=require(_0xa542('0x4'))['db'];var utils=require(_0xa542('0x5'));var logger=require(_0xa542('0x6'))('rpc');var config=require(_0xa542('0x7'));var jayson=require(_0xa542('0x8'));var client=jayson[_0xa542('0x9')][_0xa542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48a5d3,_0x3542fc,_0x2209be){return new BPromise(function(_0x537704,_0x275b9f){return client[_0xa542('0xb')](_0x48a5d3,_0x2209be)[_0xa542('0xc')](function(_0x449490){logger['info'](_0xa542('0xd'),_0x3542fc,_0xa542('0xe'));logger['debug'](_0xa542('0xf'),_0x3542fc,_0xa542('0xe'),JSON['stringify'](_0x449490));if(_0x449490[_0xa542('0x10')]){if(_0x449490[_0xa542('0x10')][_0xa542('0x11')]===0x1f4){logger['error'](_0xa542('0xd'),_0x3542fc,_0x449490[_0xa542('0x10')][_0xa542('0x12')]);return _0x275b9f(_0x449490[_0xa542('0x10')][_0xa542('0x12')]);}logger[_0xa542('0x10')](_0xa542('0xd'),_0x3542fc,_0x449490[_0xa542('0x10')]['message']);return _0x537704(_0x449490[_0xa542('0x10')][_0xa542('0x12')]);}else{logger[_0xa542('0x13')](_0xa542('0xd'),_0x3542fc,'request\x20sent');_0x537704(_0x449490[_0xa542('0x14')][_0xa542('0x12')]);}})['catch'](function(_0x3ad7d5){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3542fc,_0x3ad7d5);_0x275b9f(_0x3ad7d5);});});}exports['CreateWhatsappQueueReport']=function(_0xa4a090){var _0x3772b5=this;return new Promise(function(_0x27c8b3,_0x423a4b){return db[_0xa542('0x15')][_0xa542('0x16')](_0xa4a090[_0xa542('0x17')],{'raw':_0xa4a090[_0xa542('0x18')]?_0xa4a090['options']['raw']===undefined?!![]:![]:!![]})[_0xa542('0xc')](function(_0x17cc8e){logger['info']('CreateWhatsappQueueReport',_0xa4a090);logger['debug']('CreateWhatsappQueueReport',_0xa4a090,JSON[_0xa542('0x19')](_0x17cc8e));_0x27c8b3(_0x17cc8e);})[_0xa542('0x1a')](function(_0x8c5311){logger['error'](_0xa542('0x1b'),_0x8c5311[_0xa542('0x12')],_0xa4a090);_0x423a4b(_0x3772b5[_0xa542('0x10')](0x1f4,_0x8c5311[_0xa542('0x12')]));});});};exports[_0xa542('0x1c')]=function(_0x23c297){var _0x3db89c=this;return new Promise(function(_0x54199e,_0x422aa0){return db['WhatsappQueueReport'][_0xa542('0x1d')](_0x23c297[_0xa542('0x17')],{'raw':_0x23c297[_0xa542('0x18')]?_0x23c297[_0xa542('0x18')][_0xa542('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c297[_0xa542('0x18')]?_0x23c297[_0xa542('0x18')][_0xa542('0x1f')]||null:null,'attributes':_0x23c297['options']?_0x23c297[_0xa542('0x18')]['attributes']||null:null,'limit':_0x23c297['options']?_0x23c297[_0xa542('0x18')][_0xa542('0x20')]||null:null})['then'](function(_0x2f02b1){logger[_0xa542('0x13')](_0xa542('0x1c'),_0x23c297);logger['debug'](_0xa542('0x1c'),_0x23c297,JSON[_0xa542('0x19')](_0x2f02b1));_0x54199e(_0x2f02b1);})[_0xa542('0x1a')](function(_0x1edb52){logger[_0xa542('0x10')]('UpdateWhatsappQueueReport',_0x1edb52['message'],_0x23c297);_0x422aa0(_0x3db89c[_0xa542('0x10')](0x1f4,_0x1edb52[_0xa542('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 66d7a54..269b4b2 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 _0xd73e=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12d985,_0x200da7){var _0x5687ee=function(_0x5927e3){while(--_0x5927e3){_0x12d985['push'](_0x12d985['shift']());}};_0x5687ee(++_0x200da7);}(_0xd73e,0x1c4));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xed73('0x0'));var util=require(_0xed73('0x1'));var path=require(_0xed73('0x2'));var timeout=require('connect-timeout');var express=require(_0xed73('0x3'));var router=express[_0xed73('0x4')]();var auth=require(_0xed73('0x5'));var interaction=require(_0xed73('0x6'));var config=require(_0xed73('0x7'));var controller=require(_0xed73('0x8'));router[_0xed73('0x9')]('/',auth[_0xed73('0xa')](),controller[_0xed73('0xb')]);router['get'](_0xed73('0xc'),auth[_0xed73('0xa')](),controller[_0xed73('0xd')]);router[_0xed73('0x9')]('/:id',auth[_0xed73('0xa')](),controller['show']);router['post']('/',auth[_0xed73('0xa')](),controller[_0xed73('0xe')]);router[_0xed73('0xf')](_0xed73('0x10'),auth['isAuthenticated'](),controller[_0xed73('0x11')]);router['delete'](_0xed73('0x10'),auth[_0xed73('0xa')](),controller[_0xed73('0x12')]);module[_0xed73('0x13')]=router; \ No newline at end of file +var _0x684b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1690f9,_0x2a9858){var _0x460e19=function(_0xe37ed3){while(--_0xe37ed3){_0x1690f9['push'](_0x1690f9['shift']());}};_0x460e19(++_0x2a9858);}(_0x684b,0x1a5));var _0xb684=function(_0x52273d,_0x14efac){_0x52273d=_0x52273d-0x0;var _0x5497fe=_0x684b[_0x52273d];return _0x5497fe;};'use strict';var multer=require(_0xb684('0x0'));var util=require('util');var path=require(_0xb684('0x1'));var timeout=require(_0xb684('0x2'));var express=require('express');var router=express[_0xb684('0x3')]();var auth=require(_0xb684('0x4'));var interaction=require(_0xb684('0x5'));var config=require(_0xb684('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xb684('0x7')]('/',auth['isAuthenticated'](),controller[_0xb684('0x8')]);router[_0xb684('0x7')](_0xb684('0x9'),auth[_0xb684('0xa')](),controller[_0xb684('0xb')]);router[_0xb684('0x7')](_0xb684('0xc'),auth[_0xb684('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb684('0xc'),auth[_0xb684('0xa')](),controller[_0xb684('0xd')]);router[_0xb684('0xe')](_0xb684('0xc'),auth[_0xb684('0xa')](),controller[_0xb684('0xf')]);module[_0xb684('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 32c3332..abbd2fa 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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb10b,0x12a));var _0xbb10=function(_0x378529,_0x7e6ce3){_0x378529=_0x378529-0x0;var _0x161c6b=_0xb10b[_0x378529];return _0x161c6b;};'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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x3d9b23,_0x52894d){var _0xf22517=function(_0x1933d0){while(--_0x1933d0){_0x3d9b23['push'](_0x3d9b23['shift']());}};_0xf22517(++_0x52894d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'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 39a7c99..8b88a6a 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 _0x409d=['name','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappTransferReport','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0x409d,0x195));var _0xd409=function(_0x5832cc,_0x35923d){_0x5832cc=_0x5832cc-0x0;var _0xcce46d=_0x409d[_0x5832cc];return _0xcce46d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd409('0x0'));var rimraf=require(_0xd409('0x1'));var zipdir=require(_0xd409('0x2'));var jsonpatch=require(_0xd409('0x3'));var rp=require(_0xd409('0x4'));var moment=require(_0xd409('0x5'));var BPromise=require(_0xd409('0x6'));var Mustache=require(_0xd409('0x7'));var util=require(_0xd409('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd409('0x9'));var ejs=require(_0xd409('0xa'));var fs=require('fs');var _=require(_0xd409('0xb'));var squel=require(_0xd409('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd409('0x9'));var querystring=require(_0xd409('0xd'));var Papa=require(_0xd409('0xe'));var Redis=require(_0xd409('0xf'));var authService=require(_0xd409('0x10'));var qs=require(_0xd409('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd409('0x12'));var logger=require(_0xd409('0x13'))(_0xd409('0x14'));var utils=require(_0xd409('0x15'));var config=require(_0xd409('0x16'));var licenseUtil=require(_0xd409('0x17'));var db=require(_0xd409('0x18'))['db'];function respondWithStatusCode(_0x1a8098,_0x44dc57){_0x44dc57=_0x44dc57||0xcc;return function(_0x5a1f61){if(_0x5a1f61){return _0x1a8098[_0xd409('0x19')](_0x44dc57);}return _0x1a8098[_0xd409('0x1a')](_0x44dc57)['end']();};}function respondWithResult(_0x34a23f,_0x397ce0){_0x397ce0=_0x397ce0||0xc8;return function(_0x26e4a9){if(_0x26e4a9){return _0x34a23f[_0xd409('0x1a')](_0x397ce0)[_0xd409('0x1b')](_0x26e4a9);}};}function respondWithFilteredResult(_0x4558e2,_0x1e4d14){return function(_0x567a28){if(_0x567a28){var _0x13ae22=_0x567a28[_0xd409('0x1c')],_0x2ae87a=_0x1e4d14['offset'],_0x11d627=_0x1e4d14[_0xd409('0x1d')]+_0x1e4d14[_0xd409('0x1e')],_0x411f54;if(_0x11d627>=_0x13ae22){_0x11d627=_0x13ae22;_0x411f54=0xc8;}else{_0x411f54=0xce;}_0x4558e2['status'](_0x411f54);return _0x4558e2[_0xd409('0x1f')]('Content-Range',_0x2ae87a+'-'+_0x11d627+'/'+_0x13ae22)[_0xd409('0x1b')](_0x567a28);}return null;};}function patchUpdates(_0x178483){return function(_0x24b07a){try{jsonpatch[_0xd409('0x20')](_0x24b07a,_0x178483,!![]);}catch(_0x21fc85){return BPromise[_0xd409('0x21')](_0x21fc85);}return _0x24b07a['save']();};}function saveUpdates(_0x2afae8,_0x18139e){return function(_0x31da7d){if(_0x31da7d){return _0x31da7d[_0xd409('0x22')](_0x2afae8)[_0xd409('0x23')](function(_0x33ff43){return _0x33ff43;});}return null;};}function removeEntity(_0x2d457c,_0x3fc2f5){return function(_0x2081d9){if(_0x2081d9){return _0x2081d9[_0xd409('0x24')]()[_0xd409('0x23')](function(){_0x2d457c[_0xd409('0x1a')](0xcc)[_0xd409('0x25')]();});}};}function handleEntityNotFound(_0x74b1f5,_0x290298){return function(_0x106005){if(!_0x106005){_0x74b1f5[_0xd409('0x19')](0x194);}return _0x106005;};}function handleError(_0x18f705,_0x3f8f14){_0x3f8f14=_0x3f8f14||0x1f4;return function(_0x37e0af){logger[_0xd409('0x26')](_0x37e0af['stack']);if(_0x37e0af[_0xd409('0x27')]){delete _0x37e0af[_0xd409('0x27')];}_0x18f705[_0xd409('0x1a')](_0x3f8f14)['send'](_0x37e0af);};}exports[_0xd409('0x28')]=function(_0x1bfab1,_0x55a319){var _0x358de7={},_0x1b180c={},_0x15406b={'count':0x0,'rows':[]};var _0x3ddd2e=_[_0xd409('0x29')](db['WhatsappTransferReport'][_0xd409('0x2a')],function(_0x3697e4){return{'name':_0x3697e4['fieldName'],'type':_0x3697e4[_0xd409('0x2b')][_0xd409('0x2c')]};});_0x1b180c[_0xd409('0x2d')]=_[_0xd409('0x29')](_0x3ddd2e,_0xd409('0x27'));_0x1b180c[_0xd409('0x2e')]=_['keys'](_0x1bfab1['query']);_0x1b180c[_0xd409('0x2f')]=_['intersection'](_0x1b180c[_0xd409('0x2d')],_0x1b180c[_0xd409('0x2e')]);_0x358de7[_0xd409('0x30')]=_[_0xd409('0x31')](_0x1b180c[_0xd409('0x2d')],qs['fields'](_0x1bfab1[_0xd409('0x2e')][_0xd409('0x32')]));_0x358de7[_0xd409('0x30')]=_0x358de7[_0xd409('0x30')]['length']?_0x358de7[_0xd409('0x30')]:_0x1b180c[_0xd409('0x2d')];if(!_0x1bfab1[_0xd409('0x2e')]['hasOwnProperty'](_0xd409('0x33'))){_0x358de7['limit']=qs['limit'](_0x1bfab1['query']['limit']);_0x358de7[_0xd409('0x1d')]=qs[_0xd409('0x1d')](_0x1bfab1[_0xd409('0x2e')][_0xd409('0x1d')]);}_0x358de7[_0xd409('0x34')]=qs[_0xd409('0x35')](_0x1bfab1['query'][_0xd409('0x35')]);_0x358de7[_0xd409('0x36')]=qs[_0xd409('0x2f')](_[_0xd409('0x37')](_0x1bfab1[_0xd409('0x2e')],_0x1b180c[_0xd409('0x2f')]),_0x3ddd2e);if(_0x1bfab1[_0xd409('0x2e')]['filter']){_0x358de7[_0xd409('0x36')]=_[_0xd409('0x38')](_0x358de7[_0xd409('0x36')],{'$or':_[_0xd409('0x29')](_0x3ddd2e,function(_0x2cbad1){if(_0x2cbad1[_0xd409('0x2b')]!==_0xd409('0x39')){var _0x2b7778={};_0x2b7778[_0x2cbad1[_0xd409('0x27')]]={'$like':'%'+_0x1bfab1['query'][_0xd409('0x3a')]+'%'};return _0x2b7778;}})});}_0x358de7=_[_0xd409('0x38')]({},_0x358de7,_0x1bfab1[_0xd409('0x3b')]);var _0x5662da={'where':_0x358de7[_0xd409('0x36')]};return db[_0xd409('0x3c')]['count'](_0x5662da)[_0xd409('0x23')](function(_0x46553c){_0x15406b[_0xd409('0x1c')]=_0x46553c;if(_0x1bfab1[_0xd409('0x2e')][_0xd409('0x3d')]){_0x358de7['include']=[{'all':!![]}];}return db[_0xd409('0x3c')][_0xd409('0x3e')](_0x358de7);})[_0xd409('0x23')](function(_0x9747d1){_0x15406b[_0xd409('0x3f')]=_0x9747d1;return _0x15406b;})['then'](respondWithFilteredResult(_0x55a319,_0x358de7))[_0xd409('0x40')](handleError(_0x55a319,null));};exports[_0xd409('0x41')]=function(_0x194576,_0x20290c){var _0x453eef={'raw':!![],'where':{'id':_0x194576[_0xd409('0x42')]['id']}},_0x45b37e={};_0x45b37e[_0xd409('0x2d')]=_[_0xd409('0x43')](db[_0xd409('0x3c')]['rawAttributes']);_0x45b37e['query']=_['keys'](_0x194576[_0xd409('0x2e')]);_0x45b37e[_0xd409('0x2f')]=_[_0xd409('0x31')](_0x45b37e[_0xd409('0x2d')],_0x45b37e['query']);_0x453eef[_0xd409('0x30')]=_[_0xd409('0x31')](_0x45b37e[_0xd409('0x2d')],qs[_0xd409('0x32')](_0x194576[_0xd409('0x2e')]['fields']));_0x453eef[_0xd409('0x30')]=_0x453eef['attributes'][_0xd409('0x44')]?_0x453eef['attributes']:_0x45b37e[_0xd409('0x2d')];if(_0x194576[_0xd409('0x2e')][_0xd409('0x3d')]){_0x453eef[_0xd409('0x45')]=[{'all':!![]}];}_0x453eef=_[_0xd409('0x38')]({},_0x453eef,_0x194576[_0xd409('0x3b')]);return db[_0xd409('0x3c')][_0xd409('0x46')](_0x453eef)['then'](handleEntityNotFound(_0x20290c,null))[_0xd409('0x23')](respondWithResult(_0x20290c,null))[_0xd409('0x40')](handleError(_0x20290c,null));};exports[_0xd409('0x47')]=function(_0x2650c0,_0x26c67a){return db['WhatsappTransferReport'][_0xd409('0x47')](_0x2650c0[_0xd409('0x48')],{})[_0xd409('0x23')](respondWithResult(_0x26c67a,0xc9))[_0xd409('0x40')](handleError(_0x26c67a,null));};exports[_0xd409('0x22')]=function(_0xf84b64,_0x2cc7ab){if(_0xf84b64[_0xd409('0x48')]['id']){delete _0xf84b64[_0xd409('0x48')]['id'];}return db['WhatsappTransferReport'][_0xd409('0x46')]({'where':{'id':_0xf84b64[_0xd409('0x42')]['id']}})['then'](handleEntityNotFound(_0x2cc7ab,null))[_0xd409('0x23')](saveUpdates(_0xf84b64[_0xd409('0x48')],null))[_0xd409('0x23')](respondWithResult(_0x2cc7ab,null))[_0xd409('0x40')](handleError(_0x2cc7ab,null));};exports[_0xd409('0x24')]=function(_0x5ec8d9,_0x454a03){return db[_0xd409('0x3c')][_0xd409('0x46')]({'where':{'id':_0x5ec8d9['params']['id']}})[_0xd409('0x23')](handleEntityNotFound(_0x454a03,null))['then'](removeEntity(_0x454a03,null))[_0xd409('0x40')](handleError(_0x454a03,null));};exports[_0xd409('0x49')]=function(_0x5f1e85,_0x2eb87e){return db[_0xd409('0x3c')]['describe']()[_0xd409('0x23')](respondWithResult(_0x2eb87e,null))[_0xd409('0x40')](handleError(_0x2eb87e,null));}; \ No newline at end of file +var _0x5d21=['request-promise','moment','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0x5d21,0x178));var _0x15d2=function(_0x338b47,_0x362687){_0x338b47=_0x338b47-0x0;var _0x5b7e6d=_0x5d21[_0x338b47];return _0x5b7e6d;};'use strict';var pdf=require(_0x15d2('0x0'));var emlformat=require(_0x15d2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x15d2('0x2'));var jsonpatch=require(_0x15d2('0x3'));var rp=require(_0x15d2('0x4'));var moment=require(_0x15d2('0x5'));var BPromise=require(_0x15d2('0x6'));var Mustache=require(_0x15d2('0x7'));var util=require('util');var path=require(_0x15d2('0x8'));var sox=require(_0x15d2('0x9'));var csv=require('to-csv');var ejs=require(_0x15d2('0xa'));var fs=require('fs');var _=require(_0x15d2('0xb'));var squel=require(_0x15d2('0xc'));var crypto=require(_0x15d2('0xd'));var jsforce=require(_0x15d2('0xe'));var deskjs=require(_0x15d2('0xf'));var toCsv=require(_0x15d2('0x10'));var querystring=require(_0x15d2('0x11'));var Papa=require(_0x15d2('0x12'));var Redis=require(_0x15d2('0x13'));var authService=require(_0x15d2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x15d2('0x15'));var hardwareService=require(_0x15d2('0x16'));var logger=require(_0x15d2('0x17'))(_0x15d2('0x18'));var utils=require('../../config/utils');var config=require(_0x15d2('0x19'));var licenseUtil=require(_0x15d2('0x1a'));var db=require(_0x15d2('0x1b'))['db'];function respondWithStatusCode(_0x1461ec,_0x5ec2ff){_0x5ec2ff=_0x5ec2ff||0xcc;return function(_0x4c33d4){if(_0x4c33d4){return _0x1461ec[_0x15d2('0x1c')](_0x5ec2ff);}return _0x1461ec['status'](_0x5ec2ff)[_0x15d2('0x1d')]();};}function respondWithResult(_0x53c8ae,_0x1cbc48){_0x1cbc48=_0x1cbc48||0xc8;return function(_0x24e817){if(_0x24e817){return _0x53c8ae['status'](_0x1cbc48)[_0x15d2('0x1e')](_0x24e817);}};}function respondWithFilteredResult(_0x4d2fe9,_0x5362e4){return function(_0x580335){if(_0x580335){var _0x274c5e=_0x580335[_0x15d2('0x1f')],_0x1f93ec=_0x5362e4[_0x15d2('0x20')],_0x36115f=_0x5362e4[_0x15d2('0x20')]+_0x5362e4[_0x15d2('0x21')],_0x371798;if(_0x36115f>=_0x274c5e){_0x36115f=_0x274c5e;_0x371798=0xc8;}else{_0x371798=0xce;}_0x4d2fe9[_0x15d2('0x22')](_0x371798);return _0x4d2fe9[_0x15d2('0x23')](_0x15d2('0x24'),_0x1f93ec+'-'+_0x36115f+'/'+_0x274c5e)[_0x15d2('0x1e')](_0x580335);}return null;};}function patchUpdates(_0x537bed){return function(_0x368c63){try{jsonpatch[_0x15d2('0x25')](_0x368c63,_0x537bed,!![]);}catch(_0x5ec5fe){return BPromise['reject'](_0x5ec5fe);}return _0x368c63[_0x15d2('0x26')]();};}function saveUpdates(_0x363321,_0x28387c){return function(_0x103a86){if(_0x103a86){return _0x103a86[_0x15d2('0x27')](_0x363321)[_0x15d2('0x28')](function(_0x1032af){return _0x1032af;});}return null;};}function removeEntity(_0x131da3,_0x184b48){return function(_0xd6d54c){if(_0xd6d54c){return _0xd6d54c[_0x15d2('0x29')]()[_0x15d2('0x28')](function(){_0x131da3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e67e7,_0x558601){return function(_0x1d2841){if(!_0x1d2841){_0x3e67e7[_0x15d2('0x1c')](0x194);}return _0x1d2841;};}function handleError(_0x840c83,_0x249428){_0x249428=_0x249428||0x1f4;return function(_0xdd608c){logger['error'](_0xdd608c[_0x15d2('0x2a')]);if(_0xdd608c[_0x15d2('0x2b')]){delete _0xdd608c[_0x15d2('0x2b')];}_0x840c83[_0x15d2('0x22')](_0x249428)[_0x15d2('0x2c')](_0xdd608c);};}exports[_0x15d2('0x2d')]=function(_0x7d16d0,_0x575d82){var _0x3234e9={},_0x1d3660={},_0x3891e2={'count':0x0,'rows':[]};var _0x3f9b04=_['map'](db[_0x15d2('0x2e')]['rawAttributes'],function(_0x40b5a8){return{'name':_0x40b5a8[_0x15d2('0x2f')],'type':_0x40b5a8[_0x15d2('0x30')][_0x15d2('0x31')]};});_0x1d3660[_0x15d2('0x32')]=_[_0x15d2('0x33')](_0x3f9b04,_0x15d2('0x2b'));_0x1d3660['query']=_[_0x15d2('0x34')](_0x7d16d0[_0x15d2('0x35')]);_0x1d3660['filters']=_['intersection'](_0x1d3660[_0x15d2('0x32')],_0x1d3660[_0x15d2('0x35')]);_0x3234e9['attributes']=_[_0x15d2('0x36')](_0x1d3660[_0x15d2('0x32')],qs['fields'](_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x37')]));_0x3234e9['attributes']=_0x3234e9[_0x15d2('0x38')][_0x15d2('0x39')]?_0x3234e9[_0x15d2('0x38')]:_0x1d3660[_0x15d2('0x32')];if(!_0x7d16d0['query'][_0x15d2('0x3a')](_0x15d2('0x3b'))){_0x3234e9['limit']=qs[_0x15d2('0x21')](_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x21')]);_0x3234e9[_0x15d2('0x20')]=qs['offset'](_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x20')]);}_0x3234e9[_0x15d2('0x3c')]=qs[_0x15d2('0x3d')](_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x3d')]);_0x3234e9[_0x15d2('0x3e')]=qs[_0x15d2('0x3f')](_[_0x15d2('0x40')](_0x7d16d0['query'],_0x1d3660[_0x15d2('0x3f')]),_0x3f9b04);if(_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x41')]){_0x3234e9['where']=_[_0x15d2('0x42')](_0x3234e9['where'],{'$or':_['map'](_0x3f9b04,function(_0x49debb){if(_0x49debb['type']!=='VIRTUAL'){var _0x5e6ce8={};_0x5e6ce8[_0x49debb[_0x15d2('0x2b')]]={'$like':'%'+_0x7d16d0[_0x15d2('0x35')][_0x15d2('0x41')]+'%'};return _0x5e6ce8;}})});}_0x3234e9=_[_0x15d2('0x42')]({},_0x3234e9,_0x7d16d0[_0x15d2('0x43')]);var _0x2f6ece={'where':_0x3234e9[_0x15d2('0x3e')]};return db['WhatsappTransferReport'][_0x15d2('0x1f')](_0x2f6ece)[_0x15d2('0x28')](function(_0x2b4f89){_0x3891e2[_0x15d2('0x1f')]=_0x2b4f89;if(_0x7d16d0[_0x15d2('0x35')]['includeAll']){_0x3234e9['include']=[{'all':!![]}];}return db[_0x15d2('0x2e')][_0x15d2('0x44')](_0x3234e9);})['then'](function(_0x15e612){_0x3891e2['rows']=_0x15e612;return _0x3891e2;})['then'](respondWithFilteredResult(_0x575d82,_0x3234e9))[_0x15d2('0x45')](handleError(_0x575d82,null));};exports[_0x15d2('0x46')]=function(_0x18319e,_0x38e226){var _0x16b671={'raw':!![],'where':{'id':_0x18319e[_0x15d2('0x47')]['id']}},_0x2c31dc={};_0x2c31dc[_0x15d2('0x32')]=_[_0x15d2('0x34')](db[_0x15d2('0x2e')]['rawAttributes']);_0x2c31dc[_0x15d2('0x35')]=_['keys'](_0x18319e[_0x15d2('0x35')]);_0x2c31dc[_0x15d2('0x3f')]=_[_0x15d2('0x36')](_0x2c31dc['model'],_0x2c31dc[_0x15d2('0x35')]);_0x16b671[_0x15d2('0x38')]=_[_0x15d2('0x36')](_0x2c31dc['model'],qs['fields'](_0x18319e['query'][_0x15d2('0x37')]));_0x16b671[_0x15d2('0x38')]=_0x16b671[_0x15d2('0x38')]['length']?_0x16b671[_0x15d2('0x38')]:_0x2c31dc[_0x15d2('0x32')];if(_0x18319e[_0x15d2('0x35')]['includeAll']){_0x16b671['include']=[{'all':!![]}];}_0x16b671=_[_0x15d2('0x42')]({},_0x16b671,_0x18319e['options']);return db['WhatsappTransferReport'][_0x15d2('0x48')](_0x16b671)[_0x15d2('0x28')](handleEntityNotFound(_0x38e226,null))[_0x15d2('0x28')](respondWithResult(_0x38e226,null))[_0x15d2('0x45')](handleError(_0x38e226,null));};exports[_0x15d2('0x49')]=function(_0x44acef,_0x5d40e7){return db['WhatsappTransferReport'][_0x15d2('0x49')](_0x44acef[_0x15d2('0x4a')],{})[_0x15d2('0x28')](respondWithResult(_0x5d40e7,0xc9))[_0x15d2('0x45')](handleError(_0x5d40e7,null));};exports[_0x15d2('0x27')]=function(_0x320ed3,_0x32af83){if(_0x320ed3[_0x15d2('0x4a')]['id']){delete _0x320ed3[_0x15d2('0x4a')]['id'];}return db[_0x15d2('0x2e')][_0x15d2('0x48')]({'where':{'id':_0x320ed3[_0x15d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x32af83,null))[_0x15d2('0x28')](saveUpdates(_0x320ed3[_0x15d2('0x4a')],null))[_0x15d2('0x28')](respondWithResult(_0x32af83,null))[_0x15d2('0x45')](handleError(_0x32af83,null));};exports[_0x15d2('0x29')]=function(_0x256b42,_0x3948bc){return db[_0x15d2('0x2e')][_0x15d2('0x48')]({'where':{'id':_0x256b42['params']['id']}})[_0x15d2('0x28')](handleEntityNotFound(_0x3948bc,null))[_0x15d2('0x28')](removeEntity(_0x3948bc,null))[_0x15d2('0x45')](handleError(_0x3948bc,null));};exports[_0x15d2('0x4b')]=function(_0x2c03a2,_0x3a29ff){return db['WhatsappTransferReport']['describe']()[_0x15d2('0x28')](respondWithResult(_0x3a29ff,null))[_0x15d2('0x45')](handleError(_0x3a29ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4dc8b8a..84b8109 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 _0x968a=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x968a,0x1c6));var _0xa968=function(_0x2b71fa,_0x9f05b5){_0x2b71fa=_0x2b71fa-0x0;var _0x374c5a=_0x968a[_0x2b71fa];return _0x374c5a;};'use strict';var _=require('lodash');var util=require(_0xa968('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa968('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa968('0x2'));var config=require(_0xa968('0x3'));var attributes=require(_0xa968('0x4'));module[_0xa968('0x5')]=function(_0x3fdc00,_0xcd00d1){return _0x3fdc00['define'](_0xa968('0x6'),attributes,{'tableName':_0xa968('0x7'),'paranoid':![],'indexes':[{'name':_0xa968('0x8'),'fields':[_0xa968('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x520d=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x89ce15,_0x4a64f7){var _0x2a1c8b=function(_0x5d8148){while(--_0x5d8148){_0x89ce15['push'](_0x89ce15['shift']());}};_0x2a1c8b(++_0x4a64f7);}(_0x520d,0x1c8));var _0xd520=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x520d[_0x5cc3d4];return _0x17ca31;};'use strict';var _=require(_0xd520('0x0'));var util=require('util');var logger=require(_0xd520('0x1'))('api');var moment=require(_0xd520('0x2'));var BPromise=require('bluebird');var rp=require(_0xd520('0x3'));var fs=require('fs');var path=require(_0xd520('0x4'));var rimraf=require(_0xd520('0x5'));var config=require(_0xd520('0x6'));var attributes=require(_0xd520('0x7'));module['exports']=function(_0x3775c8,_0x3ad380){return _0x3775c8[_0xd520('0x8')](_0xd520('0x9'),attributes,{'tableName':_0xd520('0xa'),'paranoid':![],'indexes':[{'name':_0xd520('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6e149e5..eedef4b 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(_0x27acba,_0x28f65a){var _0x5e7f8a=function(_0x4c2378){while(--_0x4c2378){_0x27acba['push'](_0x27acba['shift']());}};_0x5e7f8a(++_0x28f65a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x185bdc,_0x39fba9){var _0x3b1b84=function(_0x1e689d){while(--_0x1e689d){_0x185bdc['push'](_0x185bdc['shift']());}};_0x3b1b84(++_0x39fba9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 988ebba..660a55d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8561=['./config/schedule/transcribe','then','start','info','Online\x20apps:','filter','online','name','Offline\x20apps:','map','status','join','None','seedDB','./config/license','error','./mysqldb','./rpc','./config/logger','./config/pm2','./config/schedule','./config/schedule/whatsapp'];(function(_0x65c769,_0x110974){var _0x1976d8=function(_0x1bea31){while(--_0x1bea31){_0x65c769['push'](_0x65c769['shift']());}};_0x1976d8(++_0x110974);}(_0x8561,0x1b2));var _0x1856=function(_0x32f250,_0x1fbca3){_0x32f250=_0x32f250-0x0;var _0x39ead3=_0x8561[_0x32f250];return _0x39ead3;};'use strict';var _=require('lodash');var mysqldb=require(_0x1856('0x0'));var rpc=require(_0x1856('0x1'));var config=require('./config/environment');var logger=require(_0x1856('0x2'))('app');var pm2=require(_0x1856('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x1856('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x1856('0x5'));var transcribe=require(_0x1856('0x6'));function main(){return mysqldb['db']['sequelize']['sync']()[_0x1856('0x7')](function(){return rpc['listen']();})['then'](function(_0x1c79b0){logger['info'](_0x1c79b0);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0x1856('0x7')](function(){return schedule[_0x1856('0x8')]();})['then'](function(){return transcribe['start']();})[_0x1856('0x7')](function(_0x5a16bb){logger[_0x1856('0x9')](_0x5a16bb);return pm2[_0x1856('0x8')](pm2Config);})[_0x1856('0x7')](function(_0x5bae90){logger[_0x1856('0x9')](_0x1856('0xa'),_['map'](_[_0x1856('0xb')](_0x5bae90,{'status':_0x1856('0xc')}),_0x1856('0xd'))['join']());logger[_0x1856('0x9')](_0x1856('0xe'),_[_0x1856('0xf')](_['filter'](_0x5bae90,function(_0xf3d2d2){return _0xf3d2d2[_0x1856('0x10')]!==_0x1856('0xc');}),_0x1856('0xd'))[_0x1856('0x11')]()||_0x1856('0x12'));config[_0x1856('0x13')]&&require('./config/seedDB')['default']();require(_0x1856('0x14'))['default']();})['catch'](function(_0x1de74a){logger[_0x1856('0x15')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1de74a);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xa908=['./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','name','join','status','online','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x13b64d,_0x527a1d){var _0x4292d8=function(_0x21bada){while(--_0x21bada){_0x13b64d['push'](_0x13b64d['shift']());}};_0x4292d8(++_0x527a1d);}(_0xa908,0x1c3));var _0x8a90=function(_0x1e0ca5,_0x57fd4f){_0x1e0ca5=_0x1e0ca5-0x0;var _0x410923=_0xa908[_0x1e0ca5];return _0x410923;};'use strict';var _=require(_0x8a90('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x8a90('0x1'));var config=require('./config/environment');var logger=require(_0x8a90('0x2'))(_0x8a90('0x3'));var pm2=require(_0x8a90('0x4'));var pm2Config=require(_0x8a90('0x5'));var schedule=require(_0x8a90('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x8a90('0x7'));var transcribe=require(_0x8a90('0x8'));function main(){return mysqldb['db']['sequelize'][_0x8a90('0x9')]()[_0x8a90('0xa')](function(){return rpc[_0x8a90('0xb')]();})[_0x8a90('0xa')](function(_0x20f8bf){logger[_0x8a90('0xc')](_0x20f8bf);return chat['start']();})[_0x8a90('0xa')](function(){return whatsapp['start']();})[_0x8a90('0xa')](function(){return schedule['start']();})[_0x8a90('0xa')](function(){return transcribe[_0x8a90('0xd')]();})[_0x8a90('0xa')](function(_0xd174f3){logger[_0x8a90('0xc')](_0xd174f3);return pm2[_0x8a90('0xd')](pm2Config);})[_0x8a90('0xa')](function(_0x5df598){logger['info'](_0x8a90('0xe'),_[_0x8a90('0xf')](_[_0x8a90('0x10')](_0x5df598,{'status':'online'}),_0x8a90('0x11'))[_0x8a90('0x12')]());logger[_0x8a90('0xc')]('Offline\x20apps:',_[_0x8a90('0xf')](_[_0x8a90('0x10')](_0x5df598,function(_0x4b2067){return _0x4b2067[_0x8a90('0x13')]!==_0x8a90('0x14');}),_0x8a90('0x11'))[_0x8a90('0x12')]()||'None');config['seedDB']&&require(_0x8a90('0x15'))[_0x8a90('0x16')]();require(_0x8a90('0x17'))[_0x8a90('0x16')]();})[_0x8a90('0x18')](function(_0x2f8c34){logger[_0x8a90('0x19')](_0x8a90('0x1a'),_0x2f8c34);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e9a4827..b80fb77 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 _0xbe51=['hex','now','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','name','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','user','startsWith','Bearer','query','apikey','getUuid','Setting','allowedLoginAttempts','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','unshift','encryptString','promisify','sign','secret','options','verify','randomBytes','toString'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xbe51,0x1e2));var _0x1be5=function(_0x4d6601,_0x4b0b22){_0x4d6601=_0x4d6601-0x0;var _0x2d0e52=_0xbe51[_0x4d6601];return _0x2d0e52;};'use strict';var db=require(_0x1be5('0x0'))['db'];var config=require(_0x1be5('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1be5('0x2'));var encryptor=require('../encryptor');var _=require(_0x1be5('0x3'));var jwt=require(_0x1be5('0x4'));var expressJwt=require(_0x1be5('0x5'));var compose=require(_0x1be5('0x6'));var basicAuth=require(_0x1be5('0x7'));var crypto=require(_0x1be5('0x8'));var BPromise=require(_0x1be5('0x9'));var util=require(_0x1be5('0xa'));var moment=require(_0x1be5('0xb'));var validateJwt=expressJwt({'secret':config[_0x1be5('0xc')][_0x1be5('0xd')]});var userAttributes=['id','role','fullname',_0x1be5('0xe'),'internal',_0x1be5('0xf'),_0x1be5('0x10'),'permissions',_0x1be5('0x11'),_0x1be5('0x12'),_0x1be5('0x13'),_0x1be5('0x14'),_0x1be5('0x15'),_0x1be5('0x16'),_0x1be5('0x17'),'pauseType',_0x1be5('0x18'),'lastLoginAt',_0x1be5('0x19'),_0x1be5('0x1a'),_0x1be5('0x1b'),'passwordResetAt',_0x1be5('0x1c'),'phoneBarAutoAnswer',_0x1be5('0x1d'),_0x1be5('0x1e'),_0x1be5('0x1f'),_0x1be5('0x20'),_0x1be5('0x21'),_0x1be5('0x22'),_0x1be5('0x23'),'phoneBarRemoteControl',_0x1be5('0x24'),_0x1be5('0x25'),_0x1be5('0x26'),_0x1be5('0x27'),_0x1be5('0x28'),_0x1be5('0x29')];exports[_0x1be5('0x2a')]=function(){return this[_0x1be5('0x2b')](!![])['use'](function(_0x3020fc,_0x33cf5d,_0x4f37aa){if(_0x3020fc['user']){_0x4f37aa();}else{return db['ChatInteraction'][_0x1be5('0x2c')]({'where':{'id':_0x3020fc[_0x1be5('0x2d')]['id']},'attributes':['id',_0x1be5('0x2e'),_0x1be5('0x2f')],'raw':!![]})[_0x1be5('0x30')](function(_0x4df38d){if(_0x4df38d&&_0x4df38d[_0x1be5('0x2e')]){return _0x33cf5d['status'](_0x4df38d['disposition']===_0x1be5('0x31')?0x195:0x193)[_0x1be5('0x32')]({'message':_0x4df38d[_0x1be5('0x2f')]===_0x1be5('0x31')?_0x1be5('0x33'):_0x1be5('0x34')});}else{_0x4f37aa();}})[_0x1be5('0x35')](function(_0x1efcbb){_0x4f37aa(_0x1efcbb);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1e7b4e){return compose()[_0x1be5('0x36')](function(_0x139988,_0x2e9317,_0xa88e1a){var _0x162e7c;if(_0x139988[_0x1be5('0x37')][_0x1be5('0x38')]){if(_['startsWith'](_0x139988[_0x1be5('0x37')]['authorization'],_0x1be5('0x39'))){var _0x3d9ff2=basicAuth(_0x139988);db[_0x1be5('0x3a')][_0x1be5('0x3b')]({'where':{'name':_0x3d9ff2['name']}})[_0x1be5('0x30')](function(_0xadf381){if(!_0xadf381||!_0xadf381[_0x1be5('0x3c')](_0x3d9ff2[_0x1be5('0x3d')])){return _0x2e9317[_0x1be5('0x3e')](0x191)['json']({'message':_0x1be5('0x3f')});}_0x139988[_0x1be5('0x40')]={'id':_0xadf381['id']};_0xa88e1a();})[_0x1be5('0x35')](function(_0x1ec64b){_0xa88e1a(_0x1ec64b);});}else if(_[_0x1be5('0x41')](_0x139988['headers'][_0x1be5('0x38')],_0x1be5('0x42'))){validateJwt(_0x139988,_0x2e9317,_0xa88e1a);}else{if(_0x1e7b4e){_0xa88e1a();}else{return _0x2e9317[_0x1be5('0x3e')](0x193)[_0x1be5('0x32')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x139988[_0x1be5('0x43')][_0x1be5('0x44')]){try{var _0x51e6bb={'audience':hardwareConf[_0x1be5('0x45')](),'issuer':hardwareConf[_0x1be5('0x45')]()};verifyJwt(_0x139988['query']['apikey'],_0x51e6bb)[_0x1be5('0x30')](function(_0x440072){return db[_0x1be5('0x3a')][_0x1be5('0x3b')]({'where':{'id':_0x440072['sub']}})[_0x1be5('0x30')](function(_0x19d32c){_0x162e7c=_0x19d32c;return db[_0x1be5('0x46')][_0x1be5('0x2c')]({'where':{'id':0x1},'attributes':[_0x1be5('0x47'),'blockDuration'],'raw':!![]});})[_0x1be5('0x30')](function(_0x371b87){if(!_0x162e7c||!_['isEqual'](_0x162e7c[_0x1be5('0x48')],_0x440072['nonce'])){return _0x2e9317['status'](0x191)[_0x1be5('0x32')]({'message':_0x1be5('0x49')});}if(_0x162e7c[_0x1be5('0x4a')]){return _0x2e9317['status'](0x191)[_0x1be5('0x32')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x162e7c[_0x1be5('0x4b')]){if(_0x371b87[_0x1be5('0x4c')]>0x0){if(moment(_0x162e7c[_0x1be5('0x4d')])[_0x1be5('0x4e')](_0x371b87['blockDuration'],_0x1be5('0x4f'))>moment()){return _0x2e9317[_0x1be5('0x3e')](0x191)[_0x1be5('0x32')]({'message':_0x1be5('0x50')});}}else{return _0x2e9317[_0x1be5('0x3e')](0x191)[_0x1be5('0x32')]({'message':_0x1be5('0x50')});}}_0x139988[_0x1be5('0x40')]={'id':_0x162e7c['id']};_0xa88e1a();});})[_0x1be5('0x35')](function(){return _0x2e9317['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1261a9){_0xa88e1a(_0x1261a9);}}else if(_0x1e7b4e){_0xa88e1a();}else{return _0x2e9317[_0x1be5('0x3e')](0x193)[_0x1be5('0x32')]({'message':'Unknown\x20authorization\x20format'});}})[_0x1be5('0x36')](function(_0x5c373c,_0x2c0d5d,_0x21df7c){if(_0x5c373c[_0x1be5('0x40')]){db[_0x1be5('0x3a')][_0x1be5('0x3b')]({'where':{'id':_0x5c373c[_0x1be5('0x40')]['id']},'attributes':userAttributes})[_0x1be5('0x30')](function(_0x454bf7){if(!_0x454bf7){return _0x2c0d5d[_0x1be5('0x3e')](0x194)['json']({'message':_0x1be5('0x51')});}_0x5c373c['user']=_0x454bf7;_0x21df7c();})[_0x1be5('0x35')](function(_0x338359){_0x21df7c(_0x338359);});}else if(_0x1e7b4e){_0x21df7c();}else{return _0x2c0d5d[_0x1be5('0x3e')](0x194)[_0x1be5('0x32')]({'message':_0x1be5('0x52')});}});};exports[_0x1be5('0x53')]=function canUpdate(){return compose()['use'](function(_0x46bce0,_0x6c26b1,_0x26dd0f){return licenseUtil[_0x1be5('0x54')]()[_0x1be5('0x30')](function(_0x21c32d){if(_0x21c32d['update']){_0x26dd0f();}else{return _0x6c26b1[_0x1be5('0x3e')](0x193)[_0x1be5('0x32')]({'message':'Forbidden'});}})[_0x1be5('0x35')](function(_0x46707c){_0x26dd0f(_0x46707c);});});};exports[_0x1be5('0x55')]=function(_0x40391d,_0xcff211,_0x72d23a){_0x40391d[_0x1be5('0x55')]=!![];return _0x72d23a();};exports[_0x1be5('0x56')]=function signToken(_0x16da66){return signJwt(_0x16da66);};exports[_0x1be5('0x57')]=function(_0x4f1a1d,_0x57bd4a){if(!_0x4f1a1d['user']){return _0x57bd4a[_0x1be5('0x3e')](0x194)[_0x1be5('0x32')]({'message':_0x1be5('0x58')});}var _0x33d84e={'payload':{'id':_0x4f1a1d['user']['id'],'role':_0x4f1a1d[_0x1be5('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x33d84e)[_0x1be5('0x30')](function(_0x30a0fc){_0x57bd4a[_0x1be5('0x59')]('motion.token',_0x30a0fc);_0x57bd4a['redirect'](_0x1be5('0x5a'));})['catch'](function(_0xd54d7){return _0x57bd4a[_0x1be5('0x3e')](0x1f4)[_0x1be5('0x5b')](_0xd54d7);});};exports[_0x1be5('0x5c')]=function(_0x598783){if(_['isNil'](_0x598783['apiKeyNonce'])||_[_0x1be5('0x5d')](_0x598783['apiKeyIat'])){return null;}else{return createJwt(_0x598783);}};exports[_0x1be5('0x5e')]=function(_0x4fb89e){_0x4fb89e[_0x1be5('0x48')]=generateNonce();_0x4fb89e['apiKeyIat']=generateIssuedAt();return createJwt(_0x4fb89e);};exports['regenerateApiKey']=function(_0x5b3db2,_0x288963){var _0x1b0170=_0x5b3db2[_0x1be5('0x43')]['apikey'];if(_0x1b0170){var _0x1e7a12={'nonce':_0x288963['apiKeyNonce'],'iat':_0x288963[_0x1be5('0x5f')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1be5('0x45')]()};return verifyJwt(_0x1b0170,_0x1e7a12)[_0x1be5('0x30')](function(){return generateApiKey(_0x288963);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x1be5('0x60')]=function(_0x31ba22){var _0x1f358e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1f358e[_0x1be5('0x61')](_0x31ba22))throw new db['Sequelize']['ValidationError'](_0x1be5('0x62'));return;};exports[_0x1be5('0x63')]=function(_0x4203bc,_0x3a83c3,_0x1faf1e){var _0x1f866e=encryptor[_0x1be5('0x64')](_0x3a83c3)[_0x1be5('0x65')](',');for(var _0x5e89f2=0x0;_0x5e89f2<_0x1faf1e;_0x5e89f2++){if(!_0x1f866e[_0x5e89f2])break;if(_0x4203bc[_0x1be5('0x66')]()===_0x1f866e[_0x5e89f2][_0x1be5('0x66')]()){var _0x3c6a17=util[_0x1be5('0x67')](_0x1be5('0x68'),_0x1faf1e);if(_0x1faf1e===0x1){_0x3c6a17=_0x1be5('0x69');}throw new db[(_0x1be5('0x6a'))]['ValidationError'](_0x3c6a17);}}return;};exports[_0x1be5('0x6b')]=function(_0x22f6ba,_0xaf3153){var _0x41bf7a=_0xaf3153?encryptor[_0x1be5('0x64')](_0xaf3153)[_0x1be5('0x65')](','):[];if(_0x41bf7a['length']===0x5){_0x41bf7a[_0x1be5('0x6c')](-0x1,0x1);}_0x41bf7a[_0x1be5('0x6d')](_0x22f6ba);return encryptor[_0x1be5('0x6e')](_0x41bf7a['join'](','));};function signJwt(_0x23fb4d){var _0xf9a7c3=BPromise[_0x1be5('0x6f')](jwt[_0x1be5('0x70')],{'context':jwt});var _0x5487a0=_0x23fb4d[_0x1be5('0x71')]||config[_0x1be5('0xc')][_0x1be5('0xd')];return new BPromise(function(_0x47d2af,_0x512b52){_0xf9a7c3(_0x23fb4d['payload'],_0x5487a0,_0x23fb4d[_0x1be5('0x72')])[_0x1be5('0x30')](function(_0x409e58){_0x47d2af(_0x409e58);})[_0x1be5('0x35')](function(_0x2d4b6a){_0x512b52(_0x2d4b6a);});});}function verifyJwt(_0x17b295,_0x5f2a40,_0x12f033){var _0x324346=BPromise[_0x1be5('0x6f')](jwt[_0x1be5('0x73')],{'context':jwt});var _0x4b3e93=_0x12f033||config['secrets'][_0x1be5('0xd')];return new BPromise(function(_0x2c8462,_0x15c330){_0x324346(_0x17b295,_0x4b3e93,_0x5f2a40)['then'](function(_0x3dac1d){_0x2c8462(_0x3dac1d);})['catch'](function(_0x546752){_0x15c330(_0x546752);});});}function generateNonce(){return crypto[_0x1be5('0x74')](0x10)[_0x1be5('0x75')](_0x1be5('0x76'));}function generateIssuedAt(){return Math['floor'](Date[_0x1be5('0x77')]()/0x3e8)[_0x1be5('0x75')]();}function createJwt(_0xa04881){var _0xb7857d={'payload':{'iat':_0xa04881[_0x1be5('0x5f')],'nonce':_0xa04881[_0x1be5('0x48')]},'options':{'algorithm':'HS512','subject':_0xa04881['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xb7857d)[_0x1be5('0x30')](function(_0x29db34){return{'iat':_0xa04881[_0x1be5('0x5f')],'nonce':_0xa04881['apiKeyNonce'],'token':_0x29db34};});} \ No newline at end of file +var _0xa9c7=['hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','authenticate','pass','status','Wrong\x20credentials.','user','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','encryptString','join','sign','secret','payload','promisify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/util','lodash','express-jwt','bluebird','util','moment','secrets','session','role','fullname','name','internal','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort'];(function(_0x34eddf,_0x3431b3){var _0x27317d=function(_0x4fe4f5){while(--_0x4fe4f5){_0x34eddf['push'](_0x34eddf['shift']());}};_0x27317d(++_0x3431b3);}(_0xa9c7,0x148));var _0x7a9c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa9c7[_0x599f41];return _0x2e4d58;};'use strict';var db=require(_0x7a9c('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x7a9c('0x1'));var encryptor=require('../encryptor');var _=require(_0x7a9c('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x7a9c('0x3'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x7a9c('0x4'));var util=require(_0x7a9c('0x5'));var moment=require(_0x7a9c('0x6'));var validateJwt=expressJwt({'secret':config[_0x7a9c('0x7')][_0x7a9c('0x8')]});var userAttributes=['id',_0x7a9c('0x9'),_0x7a9c('0xa'),_0x7a9c('0xb'),_0x7a9c('0xc'),'email','userpic',_0x7a9c('0xd'),_0x7a9c('0xe'),'voicePause',_0x7a9c('0xf'),_0x7a9c('0x10'),_0x7a9c('0x11'),_0x7a9c('0x12'),_0x7a9c('0x13'),'pauseType',_0x7a9c('0x14'),_0x7a9c('0x15'),_0x7a9c('0x16'),_0x7a9c('0x17'),_0x7a9c('0x18'),_0x7a9c('0x19'),_0x7a9c('0x1a'),_0x7a9c('0x1b'),'phoneBarAutoAnswerDelay',_0x7a9c('0x1c'),_0x7a9c('0x1d'),_0x7a9c('0x1e'),'phoneBarEnableSettings',_0x7a9c('0x1f'),_0x7a9c('0x20'),_0x7a9c('0x21'),_0x7a9c('0x22'),_0x7a9c('0x23'),_0x7a9c('0x24'),_0x7a9c('0x25'),_0x7a9c('0x26'),_0x7a9c('0x27')];exports[_0x7a9c('0x28')]=function(){return this[_0x7a9c('0x29')](!![])[_0x7a9c('0x2a')](function(_0x2a9199,_0x3215c6,_0x177fae){if(_0x2a9199['user']){_0x177fae();}else{return db[_0x7a9c('0x2b')][_0x7a9c('0x2c')]({'where':{'id':_0x2a9199[_0x7a9c('0x2d')]['id']},'attributes':['id',_0x7a9c('0x2e'),_0x7a9c('0x2f')],'raw':!![]})['then'](function(_0x340327){if(_0x340327&&_0x340327[_0x7a9c('0x2e')]){return _0x3215c6['status'](_0x340327[_0x7a9c('0x2f')]===_0x7a9c('0x30')?0x195:0x193)[_0x7a9c('0x31')]({'message':_0x340327[_0x7a9c('0x2f')]==='unmanaged'?_0x7a9c('0x32'):_0x7a9c('0x33')});}else{_0x177fae();}})[_0x7a9c('0x34')](function(_0x3c47b5){_0x177fae(_0x3c47b5);});}});};exports[_0x7a9c('0x29')]=function isAuthenticated(_0x139a21){return compose()[_0x7a9c('0x2a')](function(_0x71c9e0,_0xfc3345,_0x25bd77){var _0x3f1e5c;if(_0x71c9e0[_0x7a9c('0x35')][_0x7a9c('0x36')]){if(_['startsWith'](_0x71c9e0[_0x7a9c('0x35')][_0x7a9c('0x36')],'Basic')){var _0x144f70=basicAuth(_0x71c9e0);db[_0x7a9c('0x37')][_0x7a9c('0x38')]({'where':{'name':_0x144f70['name']}})['then'](function(_0xa12b9a){if(!_0xa12b9a||!_0xa12b9a[_0x7a9c('0x39')](_0x144f70[_0x7a9c('0x3a')])){return _0xfc3345[_0x7a9c('0x3b')](0x191)['json']({'message':_0x7a9c('0x3c')});}_0x71c9e0[_0x7a9c('0x3d')]={'id':_0xa12b9a['id']};_0x25bd77();})[_0x7a9c('0x34')](function(_0x419c09){_0x25bd77(_0x419c09);});}else if(_[_0x7a9c('0x3e')](_0x71c9e0[_0x7a9c('0x35')][_0x7a9c('0x36')],_0x7a9c('0x3f'))){validateJwt(_0x71c9e0,_0xfc3345,_0x25bd77);}else{if(_0x139a21){_0x25bd77();}else{return _0xfc3345[_0x7a9c('0x3b')](0x193)['json']({'message':_0x7a9c('0x40')});}}}else if(_0x71c9e0[_0x7a9c('0x41')][_0x7a9c('0x42')]){try{var _0x449223={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7a9c('0x43')]()};verifyJwt(_0x71c9e0[_0x7a9c('0x41')][_0x7a9c('0x42')],_0x449223)[_0x7a9c('0x44')](function(_0x1c1a9c){return db['User']['find']({'where':{'id':_0x1c1a9c[_0x7a9c('0x45')]}})[_0x7a9c('0x44')](function(_0x2cfd0b){_0x3f1e5c=_0x2cfd0b;return db[_0x7a9c('0x46')]['findOne']({'where':{'id':0x1},'attributes':[_0x7a9c('0x47'),_0x7a9c('0x48')],'raw':!![]});})[_0x7a9c('0x44')](function(_0x1145c9){if(!_0x3f1e5c||!_['isEqual'](_0x3f1e5c[_0x7a9c('0x49')],_0x1c1a9c[_0x7a9c('0x4a')])){return _0xfc3345[_0x7a9c('0x3b')](0x191)[_0x7a9c('0x31')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3f1e5c[_0x7a9c('0x4b')]){return _0xfc3345[_0x7a9c('0x3b')](0x191)[_0x7a9c('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3f1e5c[_0x7a9c('0x4c')]){if(_0x1145c9[_0x7a9c('0x48')]>0x0){if(moment(_0x3f1e5c[_0x7a9c('0x4d')])[_0x7a9c('0x4e')](_0x1145c9[_0x7a9c('0x48')],_0x7a9c('0x4f'))>moment()){return _0xfc3345[_0x7a9c('0x3b')](0x191)[_0x7a9c('0x31')]({'message':_0x7a9c('0x50')});}}else{return _0xfc3345[_0x7a9c('0x3b')](0x191)[_0x7a9c('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x71c9e0['user']={'id':_0x3f1e5c['id']};_0x25bd77();});})['catch'](function(){return _0xfc3345[_0x7a9c('0x3b')](0x191)[_0x7a9c('0x31')]({'message':_0x7a9c('0x50')});});}catch(_0x1a989c){_0x25bd77(_0x1a989c);}}else if(_0x139a21){_0x25bd77();}else{return _0xfc3345[_0x7a9c('0x3b')](0x193)[_0x7a9c('0x31')]({'message':_0x7a9c('0x40')});}})['use'](function(_0x242f0f,_0x32fecd,_0x3e8d5d){if(_0x242f0f[_0x7a9c('0x3d')]){db[_0x7a9c('0x37')]['find']({'where':{'id':_0x242f0f[_0x7a9c('0x3d')]['id']},'attributes':userAttributes})['then'](function(_0x5d5160){if(!_0x5d5160){return _0x32fecd[_0x7a9c('0x3b')](0x194)[_0x7a9c('0x31')]({'message':_0x7a9c('0x51')});}_0x242f0f['user']=_0x5d5160;_0x3e8d5d();})[_0x7a9c('0x34')](function(_0xe54310){_0x3e8d5d(_0xe54310);});}else if(_0x139a21){_0x3e8d5d();}else{return _0x32fecd[_0x7a9c('0x3b')](0x194)[_0x7a9c('0x31')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x7a9c('0x52')]=function canUpdate(){return compose()[_0x7a9c('0x2a')](function(_0x39a936,_0x152ea6,_0x2c241b){return licenseUtil[_0x7a9c('0x53')]()[_0x7a9c('0x44')](function(_0x1ffd2b){if(_0x1ffd2b[_0x7a9c('0x54')]){_0x2c241b();}else{return _0x152ea6[_0x7a9c('0x3b')](0x193)['json']({'message':_0x7a9c('0x55')});}})[_0x7a9c('0x34')](function(_0x487006){_0x2c241b(_0x487006);});});};exports[_0x7a9c('0x56')]=function(_0x4998fa,_0x2c62ae,_0x2a7e7f){_0x4998fa[_0x7a9c('0x56')]=!![];return _0x2a7e7f();};exports[_0x7a9c('0x57')]=function signToken(_0x48a54f){return signJwt(_0x48a54f);};exports['setTokenCookie']=function(_0x5b2e5c,_0x591538){if(!_0x5b2e5c[_0x7a9c('0x3d')]){return _0x591538[_0x7a9c('0x3b')](0x194)[_0x7a9c('0x31')]({'message':_0x7a9c('0x58')});}var _0x420137={'payload':{'id':_0x5b2e5c[_0x7a9c('0x3d')]['id'],'role':_0x5b2e5c[_0x7a9c('0x3d')][_0x7a9c('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x420137)[_0x7a9c('0x44')](function(_0x16a483){_0x591538[_0x7a9c('0x59')](_0x7a9c('0x5a'),_0x16a483);_0x591538['redirect']('/dashboards/general');})[_0x7a9c('0x34')](function(_0x168ad5){return _0x591538[_0x7a9c('0x3b')](0x1f4)[_0x7a9c('0x5b')](_0x168ad5);});};exports['retrieveApiKey']=function(_0x41bc4c){if(_['isNil'](_0x41bc4c['apiKeyNonce'])||_[_0x7a9c('0x5c')](_0x41bc4c[_0x7a9c('0x5d')])){return null;}else{return createJwt(_0x41bc4c);}};exports[_0x7a9c('0x5e')]=function(_0xda8f62){_0xda8f62['apiKeyNonce']=generateNonce();_0xda8f62[_0x7a9c('0x5d')]=generateIssuedAt();return createJwt(_0xda8f62);};exports[_0x7a9c('0x5f')]=function(_0x146595,_0x465a93){var _0x4d3c3a=_0x146595[_0x7a9c('0x41')][_0x7a9c('0x42')];if(_0x4d3c3a){var _0x5a1dc3={'nonce':_0x465a93[_0x7a9c('0x49')],'iat':_0x465a93[_0x7a9c('0x5d')],'audience':hardwareConf[_0x7a9c('0x43')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4d3c3a,_0x5a1dc3)['then'](function(){return generateApiKey(_0x465a93);});}else{throw{'message':_0x7a9c('0x60')};}};exports[_0x7a9c('0x61')]=function(_0x4eb98f){var _0x2bd5c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2bd5c7[_0x7a9c('0x62')](_0x4eb98f))throw new db[(_0x7a9c('0x63'))][(_0x7a9c('0x64'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x7a9c('0x65')]=function(_0x37efe1,_0x82875b,_0xe1659e){var _0x15d603=encryptor['decryptString'](_0x82875b)[_0x7a9c('0x66')](',');for(var _0x2bf0a2=0x0;_0x2bf0a2<_0xe1659e;_0x2bf0a2++){if(!_0x15d603[_0x2bf0a2])break;if(_0x37efe1[_0x7a9c('0x67')]()===_0x15d603[_0x2bf0a2][_0x7a9c('0x67')]()){var _0x3067b0=util[_0x7a9c('0x68')](_0x7a9c('0x69'),_0xe1659e);if(_0xe1659e===0x1){_0x3067b0='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x7a9c('0x63'))][(_0x7a9c('0x64'))](_0x3067b0);}}return;};exports[_0x7a9c('0x6a')]=function(_0x1b33e1,_0x96eca3){var _0x12eb2b=_0x96eca3?encryptor[_0x7a9c('0x6b')](_0x96eca3)[_0x7a9c('0x66')](','):[];if(_0x12eb2b[_0x7a9c('0x6c')]===0x5){_0x12eb2b['splice'](-0x1,0x1);}_0x12eb2b['unshift'](_0x1b33e1);return encryptor[_0x7a9c('0x6d')](_0x12eb2b[_0x7a9c('0x6e')](','));};function signJwt(_0x55d3ce){var _0x42965f=BPromise['promisify'](jwt[_0x7a9c('0x6f')],{'context':jwt});var _0x6375ba=_0x55d3ce[_0x7a9c('0x70')]||config[_0x7a9c('0x7')][_0x7a9c('0x8')];return new BPromise(function(_0x53ad6f,_0x344f51){_0x42965f(_0x55d3ce[_0x7a9c('0x71')],_0x6375ba,_0x55d3ce['options'])['then'](function(_0x3e02db){_0x53ad6f(_0x3e02db);})[_0x7a9c('0x34')](function(_0x5b3c56){_0x344f51(_0x5b3c56);});});}function verifyJwt(_0x365d1a,_0x253305,_0x20a88b){var _0x19dd0c=BPromise[_0x7a9c('0x72')](jwt['verify'],{'context':jwt});var _0x37a7ed=_0x20a88b||config[_0x7a9c('0x7')][_0x7a9c('0x8')];return new BPromise(function(_0x377046,_0x549b32){_0x19dd0c(_0x365d1a,_0x37a7ed,_0x253305)[_0x7a9c('0x44')](function(_0x5925db){_0x377046(_0x5925db);})[_0x7a9c('0x34')](function(_0x367dc6){_0x549b32(_0x367dc6);});});}function generateNonce(){return crypto[_0x7a9c('0x73')](0x10)[_0x7a9c('0x74')](_0x7a9c('0x75'));}function generateIssuedAt(){return Math[_0x7a9c('0x76')](Date[_0x7a9c('0x77')]()/0x3e8)[_0x7a9c('0x74')]();}function createJwt(_0x283377){var _0x4da3db={'payload':{'iat':_0x283377[_0x7a9c('0x5d')],'nonce':_0x283377[_0x7a9c('0x49')]},'options':{'algorithm':_0x7a9c('0x78'),'subject':_0x283377['id'][_0x7a9c('0x74')](),'issuer':hardwareConf[_0x7a9c('0x43')](),'audience':hardwareConf[_0x7a9c('0x43')]()}};return signJwt(_0x4da3db)[_0x7a9c('0x44')](function(_0x25e843){return{'iat':_0x283377[_0x7a9c('0x5d')],'nonce':_0x283377[_0x7a9c('0x49')],'token':_0x25e843};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 76a2e2b..1298b50 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 _0x7ee1=['secret','utf8','base64','crypto','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm','data','update','write','end','final','binary','close','unlink','createReadStream','createDecipher','encryptString'];(function(_0x49e27c,_0xdec955){var _0xc3af34=function(_0x2548ab){while(--_0x2548ab){_0x49e27c['push'](_0x49e27c['shift']());}};_0xc3af34(++_0xdec955);}(_0x7ee1,0x8d));var _0x17ee=function(_0x101223,_0x3d1838){_0x101223=_0x101223-0x0;var _0x37fb6b=_0x7ee1[_0x101223];return _0x37fb6b;};'use strict';var crypto=require(_0x17ee('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config['secrets'][_0x17ee('0x1')],'algorithm':_0x17ee('0x2')};const fileOptions={'algorithm':_0x17ee('0x3')};function combineOptions(_0x59716b){var _0x1602fd={};for(var _0x1811e4 in fileOptions){if(fileOptions[_0x17ee('0x4')](_0x1811e4)){_0x1602fd[_0x1811e4]=fileOptions[_0x1811e4];}}if(_0x59716b){for(var _0x2f9ebc in _0x59716b){if(_0x59716b['hasOwnProperty'](_0x2f9ebc)){_0x1602fd[_0x2f9ebc]=_0x59716b[_0x2f9ebc];}}}return _0x1602fd;}exports[_0x17ee('0x5')]=function(_0x29b9eb,_0x54b4f6,_0x3f61af,_0x57e1d1){return new BPromise(function(_0x3d767b,_0xfa5096){_0x57e1d1=combineOptions(_0x57e1d1);var _0x2c961f=new Buffer(_0x3f61af);var _0x4af369=fs['createReadStream'](_0x29b9eb);var _0x4d6bb5=fs[_0x17ee('0x6')](_0x54b4f6);var _0x4ee1e0=crypto[_0x17ee('0x7')](_0x57e1d1[_0x17ee('0x8')],_0x2c961f);_0x4af369['on'](_0x17ee('0x9'),function(_0x3d4f0f){var _0x57fae0=new Buffer(_0x4ee1e0[_0x17ee('0xa')](_0x3d4f0f),'binary');_0x4d6bb5[_0x17ee('0xb')](_0x57fae0);});_0x4af369['on'](_0x17ee('0xc'),function(){try{var _0x358514=new Buffer(_0x4ee1e0[_0x17ee('0xd')](_0x17ee('0xe')),_0x17ee('0xe'));_0x4d6bb5[_0x17ee('0xb')](_0x358514);_0x4d6bb5[_0x17ee('0xc')]();_0x4d6bb5['on'](_0x17ee('0xf'),function(){return _0x3d767b(_0x54b4f6);});}catch(_0x31c62b){fs[_0x17ee('0x10')](_0x54b4f6);return _0xfa5096(_0x31c62b);}});});};exports['decryptFile']=function(_0x4b66be,_0x551c5f,_0x4d4593,_0x2fe0ac){return new BPromise(function(_0x2382ce,_0x1b87c3){_0x2fe0ac=combineOptions(_0x2fe0ac);var _0x2e2287=new Buffer(_0x4d4593);var _0x443f81=fs[_0x17ee('0x11')](_0x4b66be);var _0x63d27f=fs['createWriteStream'](_0x551c5f);var _0x44fe58=crypto[_0x17ee('0x12')](_0x2fe0ac[_0x17ee('0x8')],_0x2e2287);_0x443f81['on'](_0x17ee('0x9'),function(_0x31c0bd){var _0x57925d=new Buffer(_0x44fe58[_0x17ee('0xa')](_0x31c0bd),'binary');_0x63d27f[_0x17ee('0xb')](_0x57925d);});_0x443f81['on']('end',function(){try{var _0x1f4956=new Buffer(_0x44fe58[_0x17ee('0xd')](_0x17ee('0xe')),_0x17ee('0xe'));_0x63d27f[_0x17ee('0xb')](_0x1f4956);_0x63d27f[_0x17ee('0xc')]();_0x63d27f['on'](_0x17ee('0xf'),function(){return _0x2382ce(_0x551c5f);});}catch(_0x14295f){fs[_0x17ee('0x10')](_0x551c5f);return _0x1b87c3(_0x14295f);}});});};exports[_0x17ee('0x13')]=function(_0x37fe4e,_0x4d2d91,_0x4b7bfe){var _0x2118a6=_0x4b7bfe||stringOptions[_0x17ee('0x8')];var _0xcf49aa=_0x4d2d91||stringOptions[_0x17ee('0x14')];var _0x3bbddf=crypto[_0x17ee('0x7')](_0x2118a6,_0xcf49aa);var _0x2f6e84=_0x3bbddf[_0x17ee('0xa')](_0x37fe4e,_0x17ee('0x15'),_0x17ee('0x16'));_0x2f6e84+=_0x3bbddf[_0x17ee('0xd')](_0x17ee('0x16'));return _0x2f6e84;};exports['decryptString']=function(_0x3634c9,_0xbc0aed,_0x11ce7e){var _0x258018=_0x11ce7e||stringOptions[_0x17ee('0x8')];var _0x51a561=_0xbc0aed||stringOptions[_0x17ee('0x14')];var _0x2cb62c=crypto[_0x17ee('0x12')](_0x258018,_0x51a561);var _0x4c461b=_0x2cb62c[_0x17ee('0xa')](_0x3634c9,_0x17ee('0x16'),'utf8');_0x4c461b+=_0x2cb62c[_0x17ee('0xd')]('utf8');return _0x4c461b;}; \ No newline at end of file +var _0x8ca9=['update','encryptString','secret','utf8','base64','final','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','close','unlink','createDecipher'];(function(_0x589185,_0x3a98eb){var _0x59feef=function(_0x24e5f2){while(--_0x24e5f2){_0x589185['push'](_0x589185['shift']());}};_0x59feef(++_0x3a98eb);}(_0x8ca9,0x9c));var _0x98ca=function(_0x3f2668,_0x156268){_0x3f2668=_0x3f2668-0x0;var _0x1da0b7=_0x8ca9[_0x3f2668];return _0x1da0b7;};'use strict';var crypto=require(_0x98ca('0x0'));var fs=require('fs');var BPromise=require(_0x98ca('0x1'));var config=require(_0x98ca('0x2'));const stringOptions={'secret':config[_0x98ca('0x3')][_0x98ca('0x4')],'algorithm':_0x98ca('0x5')};const fileOptions={'algorithm':_0x98ca('0x6')};function combineOptions(_0x4af83a){var _0x4c230f={};for(var _0x142793 in fileOptions){if(fileOptions['hasOwnProperty'](_0x142793)){_0x4c230f[_0x142793]=fileOptions[_0x142793];}}if(_0x4af83a){for(var _0x442519 in _0x4af83a){if(_0x4af83a['hasOwnProperty'](_0x442519)){_0x4c230f[_0x442519]=_0x4af83a[_0x442519];}}}return _0x4c230f;}exports[_0x98ca('0x7')]=function(_0xca4097,_0x18c349,_0x2852a0,_0x323c95){return new BPromise(function(_0x28a37a,_0x162bd0){_0x323c95=combineOptions(_0x323c95);var _0x210234=new Buffer(_0x2852a0);var _0x277c29=fs[_0x98ca('0x8')](_0xca4097);var _0x572858=fs[_0x98ca('0x9')](_0x18c349);var _0x25b06a=crypto[_0x98ca('0xa')](_0x323c95[_0x98ca('0xb')],_0x210234);_0x277c29['on'](_0x98ca('0xc'),function(_0x276213){var _0x17ee87=new Buffer(_0x25b06a['update'](_0x276213),_0x98ca('0xd'));_0x572858[_0x98ca('0xe')](_0x17ee87);});_0x277c29['on'](_0x98ca('0xf'),function(){try{var _0x472e13=new Buffer(_0x25b06a['final'](_0x98ca('0xd')),_0x98ca('0xd'));_0x572858[_0x98ca('0xe')](_0x472e13);_0x572858[_0x98ca('0xf')]();_0x572858['on'](_0x98ca('0x10'),function(){return _0x28a37a(_0x18c349);});}catch(_0x1f7590){fs[_0x98ca('0x11')](_0x18c349);return _0x162bd0(_0x1f7590);}});});};exports['decryptFile']=function(_0x330713,_0x29df1b,_0x29f46b,_0x398171){return new BPromise(function(_0x52e9c8,_0x238c1a){_0x398171=combineOptions(_0x398171);var _0x3c2f65=new Buffer(_0x29f46b);var _0xe9f8ad=fs[_0x98ca('0x8')](_0x330713);var _0x4523bb=fs[_0x98ca('0x9')](_0x29df1b);var _0x28c8a6=crypto[_0x98ca('0x12')](_0x398171[_0x98ca('0xb')],_0x3c2f65);_0xe9f8ad['on'](_0x98ca('0xc'),function(_0x1b2c69){var _0x4806a3=new Buffer(_0x28c8a6[_0x98ca('0x13')](_0x1b2c69),'binary');_0x4523bb[_0x98ca('0xe')](_0x4806a3);});_0xe9f8ad['on'](_0x98ca('0xf'),function(){try{var _0x50f8b4=new Buffer(_0x28c8a6['final'](_0x98ca('0xd')),_0x98ca('0xd'));_0x4523bb[_0x98ca('0xe')](_0x50f8b4);_0x4523bb['end']();_0x4523bb['on'](_0x98ca('0x10'),function(){return _0x52e9c8(_0x29df1b);});}catch(_0xc23332){fs['unlink'](_0x29df1b);return _0x238c1a(_0xc23332);}});});};exports[_0x98ca('0x14')]=function(_0x5dc400,_0x3fd0bd,_0x323cdb){var _0x430d16=_0x323cdb||stringOptions[_0x98ca('0xb')];var _0x8d669d=_0x3fd0bd||stringOptions[_0x98ca('0x15')];var _0x2a59e3=crypto['createCipher'](_0x430d16,_0x8d669d);var _0x2029cb=_0x2a59e3['update'](_0x5dc400,_0x98ca('0x16'),_0x98ca('0x17'));_0x2029cb+=_0x2a59e3['final'](_0x98ca('0x17'));return _0x2029cb;};exports['decryptString']=function(_0x214649,_0x4f48db,_0x5bf77d){var _0x14bfb4=_0x5bf77d||stringOptions['algorithm'];var _0x342a83=_0x4f48db||stringOptions[_0x98ca('0x15')];var _0x13f766=crypto[_0x98ca('0x12')](_0x14bfb4,_0x342a83);var _0x3b3e60=_0x13f766[_0x98ca('0x13')](_0x214649,_0x98ca('0x17'),_0x98ca('0x16'));_0x3b3e60+=_0x13f766[_0x98ca('0x18')]('utf8');return _0x3b3e60;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8291d47..6b98c84 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 _0x668b=['SELECT','num','Empty','push','dirname','.csv','existsSync','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x40d969,_0x463357){var _0x1f12b4=function(_0x3dbc57){while(--_0x3dbc57){_0x40d969['push'](_0x40d969['shift']());}};_0x1f12b4(++_0x463357);}(_0x668b,0x140));var _0xb668=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x668b[_0x29ce14];return _0x48f289;};'use strict';var util=require(_0xb668('0x0'));var path=require(_0xb668('0x1'));var _=require('lodash');var csv=require(_0xb668('0x2'));var fs=require('fs');var BPromise=require(_0xb668('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xb668('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb668('0x5'))[_0xb668('0x6')];var logger=require(_0xb668('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb668('0x8')][0x2]);var QUERY=process[_0xb668('0x8')][0x3];var PATH=process[_0xb668('0x8')][0x4];function analyticExtractedReport(_0x2778e9,_0x20b749){var _0x3f01bc={'status':_0x2778e9};var _0x517fc5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20b749){_0x3f01bc[_0xb668('0x9')]=_0x20b749;}return db[_0xb668('0xa')][_0xb668('0xb')](_0x3f01bc,_0x517fc5);}function main(){var _0x16d50d=0x1388;var _0x39b79c;logger[_0xb668('0xc')](util[_0xb668('0xd')](_0xb668('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xb668('0xf')][_0xb668('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb668('0x11'),_0xb668('0x12')]})[_0xb668('0x13')](function(_0x167057){if(_0x167057){_0x39b79c=_0x167057;_0x16d50d=_0x39b79c[_0xb668('0x12')]||0x1388;}})[_0xb668('0x13')](function(){return dbH[_0xb668('0x14')][_0xb668('0x15')](util[_0xb668('0xd')](_0xb668('0x16'),QUERY),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]});})[_0xb668('0x13')](function(_0x1ca6e7){if(!_0x1ca6e7[0x0][_0xb668('0x19')]){return analyticExtractedReport(_0xb668('0x1a'));}var _0x4a755b=[];var _0xd3e39f=0x0;var _0x27bbfa=!![];if(_0x1ca6e7&&_0x1ca6e7['length']){var _0x13ee71=_0x1ca6e7[0x0]['num']%(_0xd3e39f+_0x16d50d);if(_0x39b79c[_0xb668('0x11')]){for(;_0x27bbfa;_0xd3e39f+=_0x16d50d,_0x13ee71=_0x1ca6e7[0x0][_0xb668('0x19')]%(_0xd3e39f+_0x16d50d)){if(_0x13ee71==0x0||_0x13ee71==_0x1ca6e7[0x0]['num']){_0x27bbfa=![];}_0x4a755b[_0xb668('0x1b')](dbH[_0xb668('0x14')]['query'](util[_0xb668('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16d50d,_0xd3e39f),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]}));}}else{_0x4a755b[_0xb668('0x1b')](dbH['sequelize'][_0xb668('0x15')](QUERY,{'type':dbH[_0xb668('0x14')][_0xb668('0x17')]['SELECT']}));}}var _0x5a2f74=path[_0xb668('0x1c')](PATH);var _0x1e5620=path['basename'](PATH,_0xb668('0x1d'));var _0x4bf863=_0x39b79c[_0xb668('0x11')]&&_0x4a755b['length']>0x1;var _0x3f4745=[];if(!fs[_0xb668('0x1e')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620))&&_0x4bf863){fs[_0xb668('0x20')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620));}return BPromise[_0xb668('0x21')](_0x4a755b,function(_0x4d4bf8){_0x3f4745[_0xb668('0x1b')](_0x4d4bf8);})[_0xb668('0x13')](function(){for(var _0x2ab8c2=0x0;_0x2ab8c2<_0x3f4745['length'];_0x2ab8c2+=0x1){var _0x5e0cee;var _0xe62fce=_0x3f4745[_0x2ab8c2];if(_0x4bf863){_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620,util[_0xb668('0xd')]('%s%d.%s',_0x1e5620,_0x2ab8c2,_0xb668('0x22')));}else{_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')]('%s.%s',_0x1e5620,'csv'));}fs[_0xb668('0x23')](_0x5e0cee,csv(_0xe62fce));}})[_0xb668('0x13')](function(){if(_0x4bf863){zipdir(path['join'](_0x5a2f74,_0x1e5620),{'saveTo':path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0xb668('0x25')))},function(_0x256a8,_0x5f36b5){});rimraf(path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620),function(){});}})[_0xb668('0x13')](function(){logger['info'](util[_0xb668('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb668('0x26')));return analyticExtractedReport(_0xb668('0x27'),_0x4bf863?util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0x4bf863?_0xb668('0x25'):_0xb668('0x22')):null);});})[_0xb668('0x28')](function(_0x3d4bd8){logger[_0xb668('0xc')](util['format'](_0xb668('0x29'),EXTRACTED_REPORT_ID,_0xb668('0x26')),util[_0xb668('0x2a')](_0x3d4bd8,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xee5b=['rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','csv','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','zip-dir'];(function(_0x3c957d,_0x40d8f3){var _0x46ab64=function(_0x470663){while(--_0x470663){_0x3c957d['push'](_0x3c957d['shift']());}};_0x46ab64(++_0x40d8f3);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2bbfde,_0x26c652){_0x2bbfde=_0x2bbfde-0x0;var _0x3b5a49=_0xee5b[_0x2bbfde];return _0x3b5a49;};'use strict';var util=require(_0xbee5('0x0'));var path=require('path');var _=require(_0xbee5('0x1'));var csv=require(_0xbee5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbee5('0x3'));var rimraf=require(_0xbee5('0x4'));var db=require(_0xbee5('0x5'))['db'];var dbH=require(_0xbee5('0x5'))['dbH'];var logger=require('../../config/logger')(_0xbee5('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbee5('0x7')][0x2]);var QUERY=process[_0xbee5('0x7')][0x3];var PATH=process[_0xbee5('0x7')][0x4];function analyticExtractedReport(_0x4f5065,_0x5505e3){var _0x53d5b9={'status':_0x4f5065};var _0x5baf5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5505e3){_0x53d5b9['savename']=_0x5505e3;}return db[_0xbee5('0x8')][_0xbee5('0x9')](_0x53d5b9,_0x5baf5c);}function main(){var _0x45c2c7=0x1388;var _0x20f717;logger['info'](util[_0xbee5('0xa')](_0xbee5('0xb'),EXTRACTED_REPORT_ID,_0xbee5('0xc')));return db[_0xbee5('0xd')][_0xbee5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbee5('0xf'),_0xbee5('0x10')]})[_0xbee5('0x11')](function(_0xcef158){if(_0xcef158){_0x20f717=_0xcef158;_0x45c2c7=_0x20f717['splitSizeCsv']||0x1388;}})[_0xbee5('0x11')](function(){return dbH['sequelize'][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xbee5('0x14')]});})['then'](function(_0x40afcb){if(!_0x40afcb[0x0]['num']){return analyticExtractedReport(_0xbee5('0x15'));}var _0x141878=[];var _0xf676b1=0x0;var _0x53b269=!![];if(_0x40afcb&&_0x40afcb[_0xbee5('0x16')]){var _0x662d2c=_0x40afcb[0x0]['num']%(_0xf676b1+_0x45c2c7);if(_0x20f717[_0xbee5('0xf')]){for(;_0x53b269;_0xf676b1+=_0x45c2c7,_0x662d2c=_0x40afcb[0x0][_0xbee5('0x17')]%(_0xf676b1+_0x45c2c7)){if(_0x662d2c==0x0||_0x662d2c==_0x40afcb[0x0][_0xbee5('0x17')]){_0x53b269=![];}_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x1a'),QUERY,_0x45c2c7,_0xf676b1),{'type':dbH[_0xbee5('0x19')][_0xbee5('0x1b')][_0xbee5('0x14')]}));}}else{_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](QUERY,{'type':dbH[_0xbee5('0x19')]['QueryTypes']['SELECT']}));}}var _0x469a7a=path['dirname'](PATH);var _0x205491=path[_0xbee5('0x1c')](PATH,_0xbee5('0x1d'));var _0x2bfb0f=_0x20f717[_0xbee5('0xf')]&&_0x141878[_0xbee5('0x16')]>0x1;var _0x359ccf=[];if(!fs[_0xbee5('0x1e')](path[_0xbee5('0x1f')](_0x469a7a,_0x205491))&&_0x2bfb0f){fs['mkdirSync'](path['join'](_0x469a7a,_0x205491));}return BPromise['each'](_0x141878,function(_0x519473){_0x359ccf['push'](_0x519473);})[_0xbee5('0x11')](function(){for(var _0x18d7f4=0x0;_0x18d7f4<_0x359ccf[_0xbee5('0x16')];_0x18d7f4+=0x1){var _0x28c74d;var _0x169042=_0x359ccf[_0x18d7f4];if(_0x2bfb0f){_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,_0x205491,util[_0xbee5('0xa')]('%s%d.%s',_0x205491,_0x18d7f4,_0xbee5('0x20')));}else{_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x20')));}fs['writeFileSync'](_0x28c74d,csv(_0x169042));}})[_0xbee5('0x11')](function(){if(_0x2bfb0f){zipdir(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),{'saveTo':path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x22')))},function(_0x34b7df,_0x36e8bb){});rimraf(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),function(){});}})['then'](function(){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbee5('0x25'),_0x2bfb0f?util['format'](_0xbee5('0x21'),_0x205491,_0x2bfb0f?'zip':_0xbee5('0x20')):null);});})[_0xbee5('0x26')](function(_0x36eb70){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x27'),EXTRACTED_REPORT_ID,_0xbee5('0xc')),util[_0xbee5('0x28')](_0x36eb70,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbee5('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1dc0527..e28dd71 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 _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(_0x170b09,_0x131fbe){var _0x3ff583=function(_0x1eff7d){while(--_0x1eff7d){_0x170b09['push'](_0x170b09['shift']());}};_0x3ff583(++_0x131fbe);}(_0xb10b,0x12a));var _0xbb10=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb10b[_0x44a64f];return _0x52024b;};'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 +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(_0xc02c34,_0x3315ca){var _0x8175c2=function(_0x223051){while(--_0x223051){_0xc02c34['push'](_0xc02c34['shift']());}};_0x8175c2(++_0x3315ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0xb10b[_0x18175b];return _0x210d45;};'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 8324311..374a7ec 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 _0xe6d9=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','then','query','QueryTypes','SELECT','split','length','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','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','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename'];(function(_0x31ab2e,_0x44ab86){var _0x297d3b=function(_0x3f8610){while(--_0x3f8610){_0x31ab2e['push'](_0x31ab2e['shift']());}};_0x297d3b(++_0x44ab86);}(_0xe6d9,0x1cf));var _0x9e6d=function(_0x2a2591,_0x958577){_0x2a2591=_0x2a2591-0x0;var _0x45bde5=_0xe6d9[_0x2a2591];return _0x45bde5;};'use strict';var util=require(_0x9e6d('0x0'));var path=require(_0x9e6d('0x1'));var _=require(_0x9e6d('0x2'));var fs=require('fs');var json2xls=require(_0x9e6d('0x3'));var BPromise=require(_0x9e6d('0x4'));var zipdir=require(_0x9e6d('0x5'));var rimraf=require(_0x9e6d('0x6'));var db=require(_0x9e6d('0x7'))['db'];var dbH=require(_0x9e6d('0x7'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9e6d('0x8')][0x2]);var QUERY=process[_0x9e6d('0x8')][0x3];var PATH=process[_0x9e6d('0x8')][0x4];function analyticExtractedReport(_0x47052d,_0x4b3ac5){var _0x15dd4c={'status':_0x47052d};var _0x3f7ed6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b3ac5){_0x15dd4c[_0x9e6d('0x9')]=_0x4b3ac5;}return db['AnalyticExtractedReport'][_0x9e6d('0xa')](_0x15dd4c,_0x3f7ed6);}function main(){var _0x503c3d=0x1388;var _0x29bb8b;logger[_0x9e6d('0xb')](util[_0x9e6d('0xc')](_0x9e6d('0xd'),EXTRACTED_REPORT_ID,_0x9e6d('0xe')));return db[_0x9e6d('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9e6d('0x10')]})[_0x9e6d('0x11')](function(_0x5366cd){if(_0x5366cd){_0x29bb8b=_0x5366cd;_0x503c3d=_0x29bb8b[_0x9e6d('0x10')]||0x1388;}})[_0x9e6d('0x11')](function(){return dbH['sequelize'][_0x9e6d('0x12')](util[_0x9e6d('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9e6d('0x13')][_0x9e6d('0x14')]});})[_0x9e6d('0x11')](function(_0x2c0d94){if(!_0x2c0d94[0x0]['num']){return analyticExtractedReport('Empty');}var _0x12e307=[];var _0x2d11a9=0x0;var _0x1d7fd9=!![];if(_0x29bb8b[_0x9e6d('0x15')]){if(_0x2c0d94&&_0x2c0d94[_0x9e6d('0x16')]){var _0x18c2f6=_0x2c0d94[0x0]['num']%(_0x2d11a9+_0x503c3d);for(;_0x1d7fd9;_0x2d11a9+=_0x503c3d,_0x18c2f6=_0x2c0d94[0x0][_0x9e6d('0x17')]%(_0x2d11a9+_0x503c3d)){if(_0x18c2f6==0x0||_0x18c2f6==_0x2c0d94[0x0][_0x9e6d('0x17')]){_0x1d7fd9=![];}_0x12e307[_0x9e6d('0x18')](dbH[_0x9e6d('0x19')]['query'](util['format'](_0x9e6d('0x1a'),QUERY,_0x503c3d,_0x2d11a9),{'type':dbH['sequelize'][_0x9e6d('0x13')][_0x9e6d('0x14')]}));}}}else{_0x12e307[_0x9e6d('0x18')](dbH[_0x9e6d('0x19')][_0x9e6d('0x12')](QUERY,{'type':dbH[_0x9e6d('0x19')]['QueryTypes']['SELECT']}));}var _0x5b0231=path[_0x9e6d('0x1b')](PATH);var _0x506b6e=path[_0x9e6d('0x1c')](PATH,_0x9e6d('0x1d'));var _0x1f81cc=_0x29bb8b[_0x9e6d('0x15')]&&_0x12e307[_0x9e6d('0x16')]>0x1;var _0x15fcab=[];if(!fs[_0x9e6d('0x1e')](path[_0x9e6d('0x1f')](_0x5b0231,_0x506b6e))&&_0x1f81cc){fs['mkdirSync'](path['join'](_0x5b0231,_0x506b6e));}return BPromise[_0x9e6d('0x20')](_0x12e307,function(_0x4b023){_0x15fcab[_0x9e6d('0x18')](_0x4b023);})[_0x9e6d('0x11')](function(){for(var _0x5aaad3=0x0;_0x5aaad3<_0x15fcab[_0x9e6d('0x16')];_0x5aaad3+=0x1){var _0x8f4c3b;var _0x5f55c9=_0x15fcab[_0x5aaad3];if(_0x1f81cc){_0x8f4c3b=path[_0x9e6d('0x1f')](_0x5b0231,_0x506b6e,util[_0x9e6d('0xc')](_0x9e6d('0x21'),_0x506b6e,_0x5aaad3,_0x9e6d('0x22')));}else{_0x8f4c3b=path['join'](_0x5b0231,util['format']('%s.%s',_0x506b6e,_0x9e6d('0x22')));}fs['writeFileSync'](_0x8f4c3b,json2xls(_0x5f55c9),_0x9e6d('0x23'));}})['then'](function(){if(_0x1f81cc){zipdir(path[_0x9e6d('0x1f')](_0x5b0231,_0x506b6e),{'saveTo':path[_0x9e6d('0x1f')](_0x5b0231,util[_0x9e6d('0xc')]('%s.%s',_0x506b6e,'zip'))},function(_0x16ed38,_0x2bbf6e){});rimraf(path[_0x9e6d('0x1f')](_0x5b0231,_0x506b6e),function(){});}})[_0x9e6d('0x11')](function(){logger[_0x9e6d('0xb')](util[_0x9e6d('0xc')](_0x9e6d('0x24'),EXTRACTED_REPORT_ID,_0x9e6d('0xe')));return analyticExtractedReport(_0x9e6d('0x25'),_0x1f81cc?util[_0x9e6d('0xc')]('%s.%s',_0x506b6e,_0x1f81cc?_0x9e6d('0x26'):_0x9e6d('0x22')):null);});})[_0x9e6d('0x27')](function(_0x2b8a1e){logger['info'](util[_0x9e6d('0xc')](_0x9e6d('0x28'),EXTRACTED_REPORT_ID,_0x9e6d('0xe')),util[_0x9e6d('0x29')](_0x2b8a1e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9e6d('0x2a'));});}main(); \ No newline at end of file +var _0xe3da=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx'];(function(_0x3a968c,_0x2cb691){var _0x1acf4a=function(_0x8aa22d){while(--_0x8aa22d){_0x3a968c['push'](_0x3a968c['shift']());}};_0x1acf4a(++_0x2cb691);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xae3d('0x0'));var path=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));var fs=require('fs');var json2xls=require(_0xae3d('0x3'));var BPromise=require(_0xae3d('0x4'));var zipdir=require(_0xae3d('0x5'));var rimraf=require(_0xae3d('0x6'));var db=require(_0xae3d('0x7'))['db'];var dbH=require(_0xae3d('0x7'))[_0xae3d('0x8')];var logger=require(_0xae3d('0x9'))(_0xae3d('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xae3d('0xb')][0x2]);var QUERY=process[_0xae3d('0xb')][0x3];var PATH=process[_0xae3d('0xb')][0x4];function analyticExtractedReport(_0x33c089,_0x583b98){var _0x2a5c45={'status':_0x33c089};var _0x3d6650={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x583b98){_0x2a5c45['savename']=_0x583b98;}return db['AnalyticExtractedReport'][_0xae3d('0xc')](_0x2a5c45,_0x3d6650);}function main(){var _0x157a3e=0x1388;var _0x420e28;logger[_0xae3d('0xd')](util[_0xae3d('0xe')](_0xae3d('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xae3d('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xae3d('0x11'),_0xae3d('0x12')]})[_0xae3d('0x13')](function(_0x172f7a){if(_0x172f7a){_0x420e28=_0x172f7a;_0x157a3e=_0x420e28['splitSizeXlsx']||0x1388;}})[_0xae3d('0x13')](function(){return dbH[_0xae3d('0x14')][_0xae3d('0x15')](util[_0xae3d('0xe')](_0xae3d('0x16'),QUERY),{'type':dbH[_0xae3d('0x14')][_0xae3d('0x17')]['SELECT']});})[_0xae3d('0x13')](function(_0x42f4b4){if(!_0x42f4b4[0x0][_0xae3d('0x18')]){return analyticExtractedReport(_0xae3d('0x19'));}var _0x192c13=[];var _0x2da957=0x0;var _0x585160=!![];if(_0x420e28[_0xae3d('0x11')]){if(_0x42f4b4&&_0x42f4b4[_0xae3d('0x1a')]){var _0x2e31f1=_0x42f4b4[0x0]['num']%(_0x2da957+_0x157a3e);for(;_0x585160;_0x2da957+=_0x157a3e,_0x2e31f1=_0x42f4b4[0x0][_0xae3d('0x18')]%(_0x2da957+_0x157a3e)){if(_0x2e31f1==0x0||_0x2e31f1==_0x42f4b4[0x0][_0xae3d('0x18')]){_0x585160=![];}_0x192c13['push'](dbH['sequelize'][_0xae3d('0x15')](util[_0xae3d('0xe')](_0xae3d('0x1b'),QUERY,_0x157a3e,_0x2da957),{'type':dbH[_0xae3d('0x14')][_0xae3d('0x17')]['SELECT']}));}}}else{_0x192c13[_0xae3d('0x1c')](dbH['sequelize'][_0xae3d('0x15')](QUERY,{'type':dbH[_0xae3d('0x14')][_0xae3d('0x17')][_0xae3d('0x1d')]}));}var _0x1facc1=path[_0xae3d('0x1e')](PATH);var _0x26c419=path[_0xae3d('0x1f')](PATH,_0xae3d('0x20'));var _0x11ecf7=_0x420e28[_0xae3d('0x11')]&&_0x192c13[_0xae3d('0x1a')]>0x1;var _0x37f5ff=[];if(!fs[_0xae3d('0x21')](path[_0xae3d('0x22')](_0x1facc1,_0x26c419))&&_0x11ecf7){fs[_0xae3d('0x23')](path[_0xae3d('0x22')](_0x1facc1,_0x26c419));}return BPromise[_0xae3d('0x24')](_0x192c13,function(_0x2131e9){_0x37f5ff[_0xae3d('0x1c')](_0x2131e9);})['then'](function(){for(var _0x16c014=0x0;_0x16c014<_0x37f5ff[_0xae3d('0x1a')];_0x16c014+=0x1){var _0xb5940;var _0x52df0f=_0x37f5ff[_0x16c014];if(_0x11ecf7){_0xb5940=path[_0xae3d('0x22')](_0x1facc1,_0x26c419,util[_0xae3d('0xe')](_0xae3d('0x25'),_0x26c419,_0x16c014,'xlsx'));}else{_0xb5940=path['join'](_0x1facc1,util[_0xae3d('0xe')](_0xae3d('0x26'),_0x26c419,_0xae3d('0x27')));}fs[_0xae3d('0x28')](_0xb5940,json2xls(_0x52df0f),_0xae3d('0x29'));}})['then'](function(){if(_0x11ecf7){zipdir(path[_0xae3d('0x22')](_0x1facc1,_0x26c419),{'saveTo':path[_0xae3d('0x22')](_0x1facc1,util['format'](_0xae3d('0x26'),_0x26c419,_0xae3d('0x2a')))},function(_0x2cf750,_0x46f484){});rimraf(path[_0xae3d('0x22')](_0x1facc1,_0x26c419),function(){});}})[_0xae3d('0x13')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xae3d('0x2b')));return analyticExtractedReport(_0xae3d('0x2c'),_0x11ecf7?util[_0xae3d('0xe')](_0xae3d('0x26'),_0x26c419,_0x11ecf7?'zip':_0xae3d('0x27')):null);});})[_0xae3d('0x2d')](function(_0x10ccd4){logger[_0xae3d('0xd')](util[_0xae3d('0xe')](_0xae3d('0x2e'),EXTRACTED_REPORT_ID,_0xae3d('0x2b')),util['inspect'](_0x10ccd4,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xae3d('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dd2d41d..d830d4f 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 _0xb088=['context','VoiceExtensionId','outbound','extension','push','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','then','intervals','models','findAll','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','type','CDR(type)=%s'];(function(_0x2526e3,_0x5f22f8){var _0xcf6f48=function(_0x284491){while(--_0x284491){_0x2526e3['push'](_0x2526e3['shift']());}};_0xcf6f48(++_0x5f22f8);}(_0xb088,0x7b));var _0x8b08=function(_0x568607,_0xc8a887){_0x568607=_0x568607-0x0;var _0x4afe00=_0xb088[_0x568607];return _0x4afe00;};'use strict';var _=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));function rewrite(_0x380eae,_0x4084d0){var _0x31b189=this;return _0x380eae['models'][_0x8b08('0x2')]['findAll']({'raw':!![]})[_0x8b08('0x3')](function(_0x1c8d3c){_0x31b189[_0x8b08('0x4')]=_0x1c8d3c;return _0x380eae[_0x8b08('0x5')]['VoiceExtension'][_0x8b08('0x6')]({'where':{'IntervalId':_0x4084d0[_0x8b08('0x7')]},'raw':!![]});})[_0x8b08('0x3')](function(_0x4ec834){return _0x380eae[_0x8b08('0x5')][_0x8b08('0x8')][_0x8b08('0x6')]({'where':{'exten':{'$in':_[_0x8b08('0x9')](_[_0x8b08('0xa')](_0x4ec834,_0x8b08('0xb')))}},'order':[{'raw':_0x8b08('0xc')}],'raw':!![]});})[_0x8b08('0x3')](function(_0x31bfac){var _0x292ef4=_['filter'](_0x31bfac,{'priority':'1'});var _0x2fbd8b=_[_0x8b08('0xd')](_0x31bfac,{'isApp':0x1});var _0x3f5e05=_[_0x8b08('0xe')](_0x2fbd8b,_0x8b08('0xb'));var _0x326377=[_0x8b08('0xf'),_0x8b08('0x10')];var _0x466d5f=[];var _0x3c26f8=[];for(var _0x308686 in _0x3f5e05){if(_0x3f5e05['hasOwnProperty'](_0x308686)){_0x31b189[_0x8b08('0x11')]=0x2;_0x31b189['extensions']=[];_0x31b189['extension']=_['find'](_0x292ef4,{'exten':_0x3f5e05[_0x308686][0x0]['exten']});_0x31b189[_0x8b08('0x12')]['push']({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':'Set','appdata':util['format'](_0x8b08('0x14'),_0x3f5e05[_0x308686][0x0]['type']),'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});if(_0x3f5e05[_0x308686][0x0]['type']===_0x8b08('0x17')){if(_0x31b189[_0x8b08('0x18')]){_0x31b189['extensions'][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0]['type'],'app':_0x8b08('0x1a'),'appdata':_0x8b08('0x1b')+(_0x31b189[_0x8b08('0x18')][_0x8b08('0x1c')]?_0x8b08('0x1d')+_0x31b189[_0x8b08('0x18')][_0x8b08('0x1c')]+'}':_0x8b08('0x1e')),'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});}_0x31b189[_0x8b08('0x12')][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':'Set','appdata':_0x8b08('0x1f')+_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')],'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189['priority']++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});var _0x180e96=_0x31b189['priority']++;_0x31b189[_0x8b08('0x12')][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':_0x8b08('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x180e96+0x2)+_0x8b08('0x21')+(_0x180e96+0x1)+')','context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x180e96,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});if(_0x31b189[_0x8b08('0x18')]){_0x31b189['extensions'][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':_0x8b08('0x1a'),'appdata':_0x31b189[_0x8b08('0x18')][_0x8b08('0x1c')]?_0x8b08('0x22')+_0x31b189[_0x8b08('0x18')][_0x8b08('0x1c')]+'}':_0x8b08('0x23'),'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189['priority']++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});}_0x31b189[_0x8b08('0x12')]['push']({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':'Set','appdata':_0x8b08('0x24')+_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')],'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0]['VoiceExtensionId']});if(_0x31b189[_0x8b08('0x18')]&&_0x31b189[_0x8b08('0x18')][_0x8b08('0x25')](_0x8b08('0x26'))&&_0x31b189[_0x8b08('0x18')]['recordingFormat']!==_0x8b08('0x27')){_0x31b189[_0x8b08('0x12')]['push']({'type':_0x3f5e05[_0x308686][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189['priority']++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});_0x31b189[_0x8b08('0x12')][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':'Set','appdata':_0x8b08('0x28')+_0x31b189['extension'][_0x8b08('0x26')]||_0x8b08('0x29'),'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0]['exten'],'priority':_0x31b189['priority']++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});}}_0x31b189[_0x8b08('0x12')]['push']({'type':_0x3f5e05[_0x308686][0x0]['type'],'app':_0x8b08('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0]['VoiceExtensionId']});_0x31b189[_0x8b08('0x12')][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':'Set','appdata':_0x8b08('0x2a'),'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});_0x31b189[_0x8b08('0x12')][_0x8b08('0x19')]({'type':_0x3f5e05[_0x308686][0x0][_0x8b08('0x13')],'app':_0x8b08('0x1a'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'priority':_0x31b189[_0x8b08('0x11')]++,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0]['VoiceExtensionId']});for(var _0x3802d3=0x0,_0x82f3b7=0x0;_0x3802d3<_0x3f5e05[_0x308686][_0x8b08('0x2b')];_0x3802d3+=0x1,_0x82f3b7=0x0){var _0x4dc88e=_0x3f5e05[_0x308686][_0x3802d3];if(_0x4dc88e[_0x8b08('0x13')]){_0x4dc88e['type']=_0x4dc88e['type'][_0x8b08('0x2c')]();}var _0x38b1fe=[];var _0x2986db=[];delete _0x4dc88e['id'];delete _0x4dc88e[_0x8b08('0x2d')];delete _0x4dc88e[_0x8b08('0x2e')];var _0x4c5f9f=_0x4dc88e['interval']!=='*,*,*,*'?[_0x4dc88e[_0x8b08('0x2f')]]:_0x4dc88e[_0x8b08('0x7')]?_[_0x8b08('0xa')](_[_0x8b08('0xd')](_0x31b189[_0x8b08('0x4')],{'IntervalId':_0x4dc88e[_0x8b08('0x7')]}),_0x8b08('0x2f')):[];if(_0x4dc88e[_0x8b08('0x25')](_0x8b08('0x30'))){if(_0x4dc88e[_0x8b08('0x30')]&&_0x4dc88e[_0x8b08('0x30')]!=='--'){_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e[_0x8b08('0x13')],'app':'Set','appdata':_0x8b08('0x31')+_0x4dc88e[_0x8b08('0x30')],'context':_0x4dc88e['context'],'exten':_0x4dc88e['exten'],'priority':_0x4c5f9f['length']+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e['VoiceExtensionId']});}}if(_0x4dc88e['type']===_0x8b08('0x17')&&_0x4dc88e[_0x8b08('0x25')](_0x8b08('0x32'))){if(_0x4dc88e[_0x8b08('0x32')]){_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e[_0x8b08('0x13')],'app':_0x8b08('0x20'),'appdata':_0x8b08('0x33')+_0x4dc88e[_0x8b08('0x32')]+')','context':_0x4dc88e[_0x8b08('0x15')],'exten':_0x4dc88e[_0x8b08('0xb')],'priority':_0x4c5f9f['length']+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e['VoiceExtensionId']});}else{_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e[_0x8b08('0x13')],'app':_0x8b08('0x20'),'appdata':_0x8b08('0x34'),'context':_0x4dc88e[_0x8b08('0x15')],'exten':_0x4dc88e[_0x8b08('0xb')],'priority':_0x4c5f9f[_0x8b08('0x2b')]+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e[_0x8b08('0x16')]});}}if(_0x4dc88e[_0x8b08('0x25')](_0x8b08('0x35'))){if(_0x326377[_0x8b08('0x36')](_0x4dc88e['app'][_0x8b08('0x2c')]())>=0x0&&_0x4dc88e[_0x8b08('0x37')]!=='custom'){if(_0x4dc88e[_0x8b08('0x35')]){_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e[_0x8b08('0x13')],'app':'ExecIf','appdata':_0x8b08('0x38'),'context':_0x4dc88e[_0x8b08('0x15')],'exten':_0x4dc88e['exten'],'priority':_0x4c5f9f[_0x8b08('0x2b')]+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e[_0x8b08('0x16')]});_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e[_0x8b08('0x13')],'app':_0x8b08('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4dc88e[_0x8b08('0x15')],'exten':_0x4dc88e['exten'],'priority':_0x4c5f9f[_0x8b08('0x2b')]+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e[_0x8b08('0x16')]});}else{_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e['type'],'app':_0x8b08('0x20'),'appdata':_0x8b08('0x39'),'context':_0x4dc88e['context'],'exten':_0x4dc88e[_0x8b08('0xb')],'priority':_0x4c5f9f[_0x8b08('0x2b')]+_0x31b189[_0x8b08('0x11')]+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e[_0x8b08('0x16')]});_0x38b1fe[_0x8b08('0x19')]({'type':_0x4dc88e['type'],'app':_0x8b08('0x1a'),'appdata':_0x8b08('0x3a'),'context':_0x4dc88e['context'],'exten':_0x4dc88e['exten'],'priority':_0x4c5f9f[_0x8b08('0x2b')]+_0x31b189['priority']+_0x82f3b7++,'VoiceExtensionId':_0x4dc88e['VoiceExtensionId']});}}}for(var _0x6dcb4=0x0;_0x6dcb4<_0x4c5f9f['length'];_0x6dcb4+=0x1){var _0x5763da=_0x31b189['priority']+_0x4c5f9f[_0x8b08('0x2b')];var _0x3de617=_0x6dcb4===_0x4c5f9f['length']-0x1?_0x31b189['priority']+_0x38b1fe[_0x8b08('0x2b')]+_0x2986db[_0x8b08('0x2b')]+0x2:_0x31b189[_0x8b08('0x11')]+_0x6dcb4+0x1;_0x38b1fe[_0x8b08('0x3b')](_0x6dcb4,0x0,{'type':_0x4dc88e[_0x8b08('0x13')],'app':_0x8b08('0x3c'),'appdata':_0x4c5f9f[_0x6dcb4]+'?'+_0x4dc88e[_0x8b08('0x15')]+_0x8b08('0x3d')+_0x5763da+':'+_0x4dc88e[_0x8b08('0x15')]+_0x8b08('0x3d')+_0x3de617,'exten':_0x4dc88e['exten'],'context':_0x4dc88e[_0x8b08('0x15')],'priority':_0x31b189['priority']+_0x6dcb4,'VoiceExtensionId':_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]});}_0x4dc88e[_0x8b08('0x11')]=_0x38b1fe['length']?_[_0x8b08('0x3e')](_0x38b1fe)['priority']+0x1:_0x31b189[_0x8b08('0x11')];_0x31b189[_0x8b08('0x11')]=(_0x2986db[_0x8b08('0x2b')]?_[_0x8b08('0x3e')](_0x2986db)['priority']:_0x4dc88e['priority'])+0x1;_0x31b189[_0x8b08('0x12')]=_[_0x8b08('0x3f')](_0x31b189[_0x8b08('0x12')],_0x38b1fe,[_0x4dc88e],_0x2986db);}_0x31b189['extensions']['push']({'type':_0x3f5e05[_0x308686][0x0]['type'],'app':_0x8b08('0x40'),'exten':_0x3f5e05[_0x308686][0x0][_0x8b08('0xb')],'context':_0x3f5e05[_0x308686][0x0][_0x8b08('0x15')],'priority':_0x31b189[_0x8b08('0x11')],'VoiceExtensionId':_0x3f5e05[_0x308686][0x0]['VoiceExtensionId']});_0x466d5f[_0x8b08('0x19')](_0x3f5e05[_0x308686][0x0][_0x8b08('0x16')]);_0x3c26f8=_[_0x8b08('0x3f')](_0x3c26f8,_0x31b189['extensions']);}}return _0x380eae[_0x8b08('0x41')](function(_0x40279e){return _0x380eae[_0x8b08('0x5')][_0x8b08('0x8')][_0x8b08('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x466d5f}},'transaction':_0x40279e})[_0x8b08('0x3')](function(_0x5c3656){return _0x380eae['models'][_0x8b08('0x8')][_0x8b08('0x43')](_[_0x8b08('0x44')](_0x3c26f8,_0x8b08('0x11')),{'transaction':_0x40279e});});});})[_0x8b08('0x45')](function(_0x5e615b){console[_0x8b08('0x46')](_0x5e615b);});}exports[_0x8b08('0x47')]=rewrite; \ No newline at end of file +var _0x1f8f=['VoiceExtensionId','type','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','context'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x1f8f,0x19c));var _0xf1f8=function(_0xbe6ce9,_0x232539){_0xbe6ce9=_0xbe6ce9-0x0;var _0x484977=_0x1f8f[_0xbe6ce9];return _0x484977;};'use strict';var _=require(_0xf1f8('0x0'));var util=require(_0xf1f8('0x1'));function rewrite(_0x4a06ae,_0x604825){var _0x42df90=this;return _0x4a06ae[_0xf1f8('0x2')][_0xf1f8('0x3')][_0xf1f8('0x4')]({'raw':!![]})[_0xf1f8('0x5')](function(_0x5dda04){_0x42df90[_0xf1f8('0x6')]=_0x5dda04;return _0x4a06ae['models'][_0xf1f8('0x7')][_0xf1f8('0x4')]({'where':{'IntervalId':_0x604825[_0xf1f8('0x8')]},'raw':!![]});})['then'](function(_0xee2940){return _0x4a06ae[_0xf1f8('0x2')][_0xf1f8('0x7')][_0xf1f8('0x4')]({'where':{'exten':{'$in':_[_0xf1f8('0x9')](_[_0xf1f8('0xa')](_0xee2940,_0xf1f8('0xb')))}},'order':[{'raw':_0xf1f8('0xc')}],'raw':!![]});})[_0xf1f8('0x5')](function(_0x4d7eba){var _0x45b3b3=_[_0xf1f8('0xd')](_0x4d7eba,{'priority':'1'});var _0x2183fe=_[_0xf1f8('0xd')](_0x4d7eba,{'isApp':0x1});var _0x32e675=_[_0xf1f8('0xe')](_0x2183fe,_0xf1f8('0xb'));var _0x379677=[_0xf1f8('0xf'),_0xf1f8('0x10')];var _0xbc3d19=[];var _0x57f353=[];for(var _0x347435 in _0x32e675){if(_0x32e675[_0xf1f8('0x11')](_0x347435)){_0x42df90[_0xf1f8('0x12')]=0x2;_0x42df90[_0xf1f8('0x13')]=[];_0x42df90[_0xf1f8('0x14')]=_[_0xf1f8('0x15')](_0x45b3b3,{'exten':_0x32e675[_0x347435][0x0]['exten']});_0x42df90['extensions'][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0]['type'],'app':_0xf1f8('0x17'),'appdata':util[_0xf1f8('0x18')]('CDR(type)=%s',_0x32e675[_0x347435][0x0]['type']),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0]['exten'],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});if(_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')]==='outbound'){if(_0x42df90[_0xf1f8('0x14')]){_0x42df90['extensions'][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x1c')+(_0x42df90[_0xf1f8('0x14')][_0xf1f8('0x1d')]?_0xf1f8('0x1e')+_0x42df90['extension'][_0xf1f8('0x1d')]+'}':'${EXTEN}'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});}_0x42df90[_0xf1f8('0x13')][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0]['type'],'app':_0xf1f8('0x17'),'appdata':'CDR(routeid)='+_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')],'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});var _0x195278=_0x42df90[_0xf1f8('0x12')]++;_0x42df90[_0xf1f8('0x13')]['push']({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x1f'),'appdata':_0xf1f8('0x20')+(_0x195278+0x2)+_0xf1f8('0x21')+(_0x195278+0x1)+')','context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x195278,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});if(_0x42df90['extension']){_0x42df90[_0xf1f8('0x13')]['push']({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0x42df90[_0xf1f8('0x14')][_0xf1f8('0x1d')]?_0xf1f8('0x22')+_0x42df90[_0xf1f8('0x14')][_0xf1f8('0x1d')]+'}':_0xf1f8('0x23'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0]['exten'],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});}_0x42df90[_0xf1f8('0x13')]['push']({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x24')+_0x32e675[_0x347435][0x0]['VoiceExtensionId'],'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});if(_0x42df90[_0xf1f8('0x14')]&&_0x42df90[_0xf1f8('0x14')][_0xf1f8('0x11')](_0xf1f8('0x25'))&&_0x42df90[_0xf1f8('0x14')][_0xf1f8('0x25')]!=='none'){_0x42df90[_0xf1f8('0x13')]['push']({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x26'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});_0x42df90[_0xf1f8('0x13')][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':'Set','appdata':_0xf1f8('0x27')+_0x42df90[_0xf1f8('0x14')]['recordingFormat']||_0xf1f8('0x28'),'context':_0x32e675[_0x347435][0x0]['context'],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90['priority']++,'VoiceExtensionId':_0x32e675[_0x347435][0x0]['VoiceExtensionId']});}}_0x42df90[_0xf1f8('0x13')][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0]['type'],'app':'Set','appdata':_0xf1f8('0x29'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});_0x42df90[_0xf1f8('0x13')][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x2a'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'priority':_0x42df90[_0xf1f8('0x12')]++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});_0x42df90['extensions']['push']({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x2b'),'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'exten':_0x32e675[_0x347435][0x0]['exten'],'priority':_0x42df90['priority']++,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});for(var _0x221b56=0x0,_0x1c1ad3=0x0;_0x221b56<_0x32e675[_0x347435][_0xf1f8('0x2c')];_0x221b56+=0x1,_0x1c1ad3=0x0){var _0x34a5e0=_0x32e675[_0x347435][_0x221b56];if(_0x34a5e0[_0xf1f8('0x1b')]){_0x34a5e0[_0xf1f8('0x1b')]=_0x34a5e0[_0xf1f8('0x1b')][_0xf1f8('0x2d')]();}var _0x26a033=[];var _0x32e85c=[];delete _0x34a5e0['id'];delete _0x34a5e0[_0xf1f8('0x2e')];delete _0x34a5e0[_0xf1f8('0x2f')];var _0x2811eb=_0x34a5e0[_0xf1f8('0x30')]!==_0xf1f8('0x31')?[_0x34a5e0['interval']]:_0x34a5e0['IntervalId']?_[_0xf1f8('0xa')](_[_0xf1f8('0xd')](_0x42df90['intervals'],{'IntervalId':_0x34a5e0['IntervalId']}),_0xf1f8('0x30')):[];if(_0x34a5e0[_0xf1f8('0x11')]('tag')){if(_0x34a5e0['tag']&&_0x34a5e0[_0xf1f8('0x32')]!=='--'){_0x26a033['push']({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':'Set','appdata':_0xf1f8('0x33')+_0x34a5e0['tag'],'context':_0x34a5e0['context'],'exten':_0x34a5e0['exten'],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90[_0xf1f8('0x12')]+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0['VoiceExtensionId']});}}if(_0x34a5e0[_0xf1f8('0x1b')]===_0xf1f8('0x34')&&_0x34a5e0[_0xf1f8('0x11')](_0xf1f8('0x35'))){if(_0x34a5e0[_0xf1f8('0x35')]){_0x26a033[_0xf1f8('0x16')]({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':_0xf1f8('0x1f'),'appdata':_0xf1f8('0x36')+_0x34a5e0[_0xf1f8('0x35')]+')','context':_0x34a5e0[_0xf1f8('0x19')],'exten':_0x34a5e0[_0xf1f8('0xb')],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90['priority']+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0[_0xf1f8('0x1a')]});}else{_0x26a033['push']({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':_0xf1f8('0x1f'),'appdata':_0xf1f8('0x37'),'context':_0x34a5e0[_0xf1f8('0x19')],'exten':_0x34a5e0[_0xf1f8('0xb')],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90[_0xf1f8('0x12')]+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0[_0xf1f8('0x1a')]});}}if(_0x34a5e0[_0xf1f8('0x11')]('answer')){if(_0x379677[_0xf1f8('0x38')](_0x34a5e0[_0xf1f8('0x39')][_0xf1f8('0x2d')]())>=0x0&&_0x34a5e0[_0xf1f8('0x3a')]!==_0xf1f8('0x3b')){if(_0x34a5e0[_0xf1f8('0x3c')]){_0x26a033[_0xf1f8('0x16')]({'type':_0x34a5e0['type'],'app':_0xf1f8('0x1f'),'appdata':_0xf1f8('0x3d'),'context':_0x34a5e0[_0xf1f8('0x19')],'exten':_0x34a5e0[_0xf1f8('0xb')],'priority':_0x2811eb['length']+_0x42df90[_0xf1f8('0x12')]+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0['VoiceExtensionId']});_0x26a033[_0xf1f8('0x16')]({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':_0xf1f8('0x3e'),'context':_0x34a5e0[_0xf1f8('0x19')],'exten':_0x34a5e0['exten'],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90[_0xf1f8('0x12')]+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0[_0xf1f8('0x1a')]});}else{_0x26a033['push']({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':_0xf1f8('0x1f'),'appdata':_0xf1f8('0x3f'),'context':_0x34a5e0['context'],'exten':_0x34a5e0[_0xf1f8('0xb')],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90['priority']+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0['VoiceExtensionId']});_0x26a033[_0xf1f8('0x16')]({'type':_0x34a5e0[_0xf1f8('0x1b')],'app':_0xf1f8('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x34a5e0[_0xf1f8('0x19')],'exten':_0x34a5e0[_0xf1f8('0xb')],'priority':_0x2811eb[_0xf1f8('0x2c')]+_0x42df90[_0xf1f8('0x12')]+_0x1c1ad3++,'VoiceExtensionId':_0x34a5e0[_0xf1f8('0x1a')]});}}}for(var _0x57c6ac=0x0;_0x57c6ac<_0x2811eb[_0xf1f8('0x2c')];_0x57c6ac+=0x1){var _0x5a0c6c=_0x42df90[_0xf1f8('0x12')]+_0x2811eb[_0xf1f8('0x2c')];var _0x120cb6=_0x57c6ac===_0x2811eb[_0xf1f8('0x2c')]-0x1?_0x42df90[_0xf1f8('0x12')]+_0x26a033['length']+_0x32e85c[_0xf1f8('0x2c')]+0x2:_0x42df90[_0xf1f8('0x12')]+_0x57c6ac+0x1;_0x26a033['splice'](_0x57c6ac,0x0,{'type':_0x34a5e0['type'],'app':'GotoIfTime','appdata':_0x2811eb[_0x57c6ac]+'?'+_0x34a5e0[_0xf1f8('0x19')]+_0xf1f8('0x40')+_0x5a0c6c+':'+_0x34a5e0[_0xf1f8('0x19')]+_0xf1f8('0x40')+_0x120cb6,'exten':_0x34a5e0[_0xf1f8('0xb')],'context':_0x34a5e0['context'],'priority':_0x42df90[_0xf1f8('0x12')]+_0x57c6ac,'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});}_0x34a5e0[_0xf1f8('0x12')]=_0x26a033[_0xf1f8('0x2c')]?_[_0xf1f8('0x41')](_0x26a033)[_0xf1f8('0x12')]+0x1:_0x42df90['priority'];_0x42df90[_0xf1f8('0x12')]=(_0x32e85c[_0xf1f8('0x2c')]?_['last'](_0x32e85c)[_0xf1f8('0x12')]:_0x34a5e0[_0xf1f8('0x12')])+0x1;_0x42df90[_0xf1f8('0x13')]=_[_0xf1f8('0x42')](_0x42df90[_0xf1f8('0x13')],_0x26a033,[_0x34a5e0],_0x32e85c);}_0x42df90['extensions'][_0xf1f8('0x16')]({'type':_0x32e675[_0x347435][0x0][_0xf1f8('0x1b')],'app':'Hangup','exten':_0x32e675[_0x347435][0x0][_0xf1f8('0xb')],'context':_0x32e675[_0x347435][0x0][_0xf1f8('0x19')],'priority':_0x42df90[_0xf1f8('0x12')],'VoiceExtensionId':_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]});_0xbc3d19[_0xf1f8('0x16')](_0x32e675[_0x347435][0x0][_0xf1f8('0x1a')]);_0x57f353=_[_0xf1f8('0x42')](_0x57f353,_0x42df90[_0xf1f8('0x13')]);}}return _0x4a06ae[_0xf1f8('0x43')](function(_0x4ee6fd){return _0x4a06ae['models'][_0xf1f8('0x7')][_0xf1f8('0x44')]({'where':{'VoiceExtensionId':{'$in':_0xbc3d19}},'transaction':_0x4ee6fd})[_0xf1f8('0x5')](function(_0x2f7511){return _0x4a06ae['models'][_0xf1f8('0x7')][_0xf1f8('0x45')](_['sortBy'](_0x57f353,_0xf1f8('0x12')),{'transaction':_0x4ee6fd});});});})[_0xf1f8('0x46')](function(_0xa492db){console[_0xf1f8('0x47')](_0xa492db);});}exports[_0xf1f8('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1dad0bb..1d01137 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 _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x59badd,_0x1f949b){var _0xd5d869=function(_0x1f392c){while(--_0x1f392c){_0x59badd['push'](_0x59badd['shift']());}};_0xd5d869(++_0x1f949b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x5a4e79,_0x481ac5){var _0x54ab66=function(_0x95ba92){while(--_0x95ba92){_0x5a4e79['push'](_0x5a4e79['shift']());}};_0x54ab66(++_0x481ac5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index eb8e40d..4244191 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 _0xb024=['UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','keys','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','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','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','ListId','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','moment','squel','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','createdAt','updatedAt'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xb024,0x182));var _0x4b02=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb024[_0x1cc8fe];return _0x230054;};'use strict';var fs=require('fs');var path=require(_0x4b02('0x0'));var _=require('lodash');var Papa=require(_0x4b02('0x1'));var util=require(_0x4b02('0x2'));var BPromise=require('bluebird');var moment=require(_0x4b02('0x3'));var squel=require(_0x4b02('0x4'));var Redis=require(_0x4b02('0x5'));var db=require(_0x4b02('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4b02('0x7'));config[_0x4b02('0x8')]=_[_0x4b02('0x9')](config[_0x4b02('0x8')],{'host':_0x4b02('0xa'),'port':0x18eb});var socket=require(_0x4b02('0xb'))(new Redis(config[_0x4b02('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4b02('0xc')](_0x4b02('0xd'));function isEmail(_0x4240c4){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))*$/[_0x4b02('0xe')](_0x4240c4);}function selectNotIn(_0x151992,_0x15cd75,_0x2d3bab,_0x2413db,_0x51dc40){return squel[_0x4b02('0xf')]()[_0x4b02('0x10')](_0x4b02('0x11'))[_0x4b02('0x12')](_0x2413db)[_0x4b02('0x13')](_0x15cd75,null,_0x15cd75+_0x4b02('0x14')+_0x2413db+'.'+_0x2d3bab)['where'](_0x2413db+'.'+_0x2d3bab+_0x4b02('0x15')+_0x151992+'.'+_0x2d3bab)[_0x4b02('0x16')](_0x15cd75+_0x4b02('0x17')+_0x51dc40[_0x4b02('0x13')]()+')');}function insertCmHopper(_0xc245bc,_0x1c01be,_0x31ee03,_0x17c203,_0x4e5faa){var _0x47fe5c=[_0x4b02('0x18'),_0x4b02('0x19'),'cm_contacts.id','cm_contacts.ListId',_0x1c01be+'.'+_0x17c203,'cm_contacts.createdAt',_0x4b02('0x1a'),'cm_contacts.priority',_0x4b02('0x1b'),'\x22'+_0x4e5faa+'\x22'];return squel[_0x4b02('0x1c')]()['into']('cm_hopper')[_0x4b02('0x1d')](['phone',_0x4b02('0x1e'),_0x4b02('0x1f'),'ListId',_0x17c203,_0x4b02('0x20'),_0x4b02('0x21'),'priority',_0x4b02('0x22'),_0x4b02('0x23')],squel['select']()['fields'](_0x47fe5c)[_0x4b02('0x12')](_0x1c01be)['join'](_0x4b02('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x1c01be+_0x4b02('0x25'))['join'](_0x31ee03,null,_0x31ee03+_0x4b02('0x14')+_0x1c01be+'.'+_0x17c203)[_0x4b02('0x16')](_0x1c01be+_0x4b02('0x26'),_0xc245bc)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1c01be,_0x31ee03,_0x17c203,_0x4b02('0x27'),['\x22always\x22',_0x4b02('0x28')]))[_0x4b02('0x16')](_0x4b02('0x29'),selectNotIn(_0x1c01be,_0x31ee03,_0x17c203,_0x4b02('0x27'),[_0x4b02('0x2a')])))[_0x4b02('0x2b')]();}function insertCmHopperBlack(_0x2a6f7e,_0x5edbc4,_0x3ba391,_0x399c77){var _0x38f037=['cm_contacts.phone',_0x4b02('0x2c'),_0x4b02('0x2d'),_0x5edbc4+'.'+_0x399c77,'cm_contacts.createdAt',_0x4b02('0x1a')];return squel[_0x4b02('0x1c')]()['into'](_0x4b02('0x2e'))[_0x4b02('0x1d')]([_0x4b02('0x11'),_0x4b02('0x1f'),'ListId',_0x399c77,_0x4b02('0x20'),_0x4b02('0x21')],squel[_0x4b02('0xf')]()[_0x4b02('0x2f')](_0x38f037)['from'](_0x5edbc4)['join'](_0x4b02('0x24'),null,_0x4b02('0x30')+_0x5edbc4+'.CmListId')[_0x4b02('0x13')](_0x3ba391,null,_0x3ba391+_0x4b02('0x14')+_0x5edbc4+'.'+_0x399c77)[_0x4b02('0x16')](_0x5edbc4+_0x4b02('0x26'),_0x2a6f7e)['where'](_0x4b02('0x31'),NOW)[_0x4b02('0x16')](_0x4b02('0x29'),squel['select']()[_0x4b02('0x10')](_0x4b02('0x11'))[_0x4b02('0x12')](_0x4b02('0x2e'))[_0x4b02('0x16')](_0x4b02('0x32'),_0x2a6f7e)[_0x4b02('0x16')](_0x399c77+_0x4b02('0x33'),_0x5edbc4+'.'+_0x399c77)))[_0x4b02('0x2b')]();}function insertCmContact(_0x1096af,_0x47b936,_0x2d35f0,_0x2f775d){var _0x1493c6=_[_0x4b02('0x34')](_[_0x4b02('0x35')](_0x2f775d),['ListId','CompanyId','createdAt',_0x4b02('0x21')]);return squel['insert']()[_0x4b02('0x36')]('cm_contacts')[_0x4b02('0x1d')](_0x1493c6,squel[_0x4b02('0xf')]()[_0x4b02('0x2f')](_0x1493c6)['from'](_0x47b936)[_0x4b02('0x16')]('('+_0x2d35f0['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x4b02('0x2f')](_0x2d35f0)[_0x4b02('0x12')]('cm_contacts')[_0x4b02('0x16')](_0x4b02('0x32'),_0x1096af)[_0x4b02('0x16')](_0x4b02('0x37')))[_0x4b02('0x16')](_0x4b02('0x38'),squel[_0x4b02('0xf')]()[_0x4b02('0x10')](_0x4b02('0x39'),_0x4b02('0x3a'))[_0x4b02('0x12')](_0x47b936)[_0x4b02('0x3b')](_0x2d35f0[_0x4b02('0x13')](','))))[_0x4b02('0x2b')]();}function handleStop(){logger[_0x4b02('0x3c')](_0x4b02('0x3d'));stopped=!![];}function handleUncaughtException(_0x2cb216){logger[_0x4b02('0x3e')](_0x2cb216[_0x4b02('0x3f')]);process[_0x4b02('0x40')](0x1);}function handleError(_0x594879,_0x983c0){stats[_0x4b02('0x41')][_0x4b02('0x42')]({'name':_0x983c0[_0x4b02('0x43')],'message':_0x983c0[_0x4b02('0x3f')],'row':_0x594879});}function handleQuery(_0x170a27){logger['info'](_0x170a27);return db[_0x4b02('0x44')][_0x4b02('0x45')](_0x170a27)[_0x4b02('0x46')](function(_0x333dc4){results[_0x4b02('0x42')](_0x333dc4);})[_0x4b02('0x47')](function(_0x1dd1a4){logger[_0x4b02('0x3e')](_0x1dd1a4[_0x4b02('0x3f')]);});}function main(_0x2cf78e,_0x3acd97,_0x26450e,_0x21f886){logger[_0x4b02('0x3c')](_0x4b02('0x48'),_0x2cf78e,JSON[_0x4b02('0x49')](_0x3acd97));process['send'](_0x4b02('0x4a'));var _0xcf862f=_0x3acd97[_0x4b02('0x4b')];var _0x26d18e=_0x3acd97[_0x4b02('0x4c')];var _0x355e55=path[_0x4b02('0x13')](config[_0x4b02('0x4d')],_0x4b02('0x4e'),_0x26d18e+_0x4b02('0x4f'));var _0x3d9aa1=_[_0x4b02('0x35')](_0xcf862f)[_0x4b02('0x13')]();logger[_0x4b02('0x3c')](_0x4b02('0x50'),_0x3d9aa1);fs[_0x4b02('0x51')](_0x355e55,_0x3d9aa1+'\x0a');Papa[_0x4b02('0x52')](fs[_0x4b02('0x53')](_0x2cf78e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b3fc3,_0x526ba0){try{for(var _0x54d040=0x0,_0x125823=[];_0x54d040<_0x5b3fc3[_0x4b02('0x54')][_0x4b02('0x55')];_0x54d040++){stats[_0x4b02('0x56')]+=0x1;if(_0x5b3fc3[_0x4b02('0x41')][_0x54d040]){handleError(_0x5b3fc3[_0x4b02('0x54')][_0x54d040],_0x5b3fc3[_0x4b02('0x41')][_0x54d040]);}else{var _0x3d355f=[];for(var _0x5013ef in _0xcf862f){if(_0xcf862f['hasOwnProperty'](_0x5013ef)){if(_0x5b3fc3[_0x4b02('0x54')][_0x54d040][_0xcf862f[_0x5013ef]]){var _0x3d7180=_[_0x4b02('0x57')](_0x5b3fc3[_0x4b02('0x54')][_0x54d040][_0xcf862f[_0x5013ef]][_0x4b02('0x58')](/"/g,'\x27'));switch(_0x5013ef){case _0x4b02('0x1e'):var _0x3e4c26=moment(_0x3d7180,_0x4b02('0xd'),!![]);if(_0x3e4c26[_0x4b02('0x59')]()){_0x125823[_0x4b02('0x42')]('\x22'+_0x3d7180+'\x22');}else{_0x3d355f[_0x4b02('0x42')](_0x4b02('0x5a'));}break;case'priority':var _0x3d7508=parseInt(_0x3d7180);_0x3d7180=_[_0x4b02('0x5b')](_0x3d7508)||_0x3d7508<0x0||_0x3d7508>0x4?_0x21f886?0x3:0x2:_0x3d7508;_0x125823['push']('\x22'+_0x3d7180+'\x22');break;case _0x4b02('0x22'):var _0x4b5454=parseInt(_0x3d7180);if(_[_0x4b02('0x5c')](_0x4b5454)&&_[_0x4b02('0x5d')](_0x26450e,_0x4b5454)){_0x125823[_0x4b02('0x42')]('\x22'+_0x4b5454+'\x22');}else{_0x3d355f[_0x4b02('0x42')]('agent\x20not\x20exists');}break;case _0x4b02('0x5e'):if(isEmail(_0x3d7180)){_0x125823[_0x4b02('0x42')]('\x22'+_0x3d7180+'\x22');}else{_0x3d355f['push'](_0x4b02('0x5f'));}break;case _0x4b02('0x60'):var _0x35ab21=moment(_0x3d7180,_0x4b02('0x61'),!![]);if(_0x35ab21[_0x4b02('0x59')]()){_0x125823['push']('\x22'+_0x3d7180+'\x22');}else{_0x3d355f['push'](_0x4b02('0x62'));}break;default:_0x125823[_0x4b02('0x42')]('\x22'+_0x3d7180+'\x22');}}else{switch(_0x5013ef){case'firstName':case _0x4b02('0x11'):_0x3d355f['push'](_0x5013ef+_0x4b02('0x63'));break;default:_0x125823[_0x4b02('0x42')]('\x22\x22');}}}}if(_0x3d355f[_0x4b02('0x55')]){handleError(_0x5b3fc3[_0x4b02('0x54')][_0x54d040],{'code':_0x4b02('0x64'),'message':_0x3d355f['join']()});}else{fs[_0x4b02('0x65')](_0x355e55,_0x125823[_0x4b02('0x13')]()+'\x0a');}_0x125823=[];}if(!(stats[_0x4b02('0x56')]%0xc8)){socket[_0x4b02('0x66')](_0x4b02('0x67')+_0x26d18e,stats);stats[_0x4b02('0x41')]=[];}}if(stopped){logger[_0x4b02('0x3c')](_0x4b02('0x68'));_0x526ba0[_0x4b02('0x69')]();}}catch(_0x1525f1){handleError(_0x5b3fc3[_0x4b02('0x54')][_0x54d040],{'code':_0x4b02('0x6a'),'message':_0x1525f1[_0x4b02('0x3f')]});logger[_0x4b02('0x3e')](_0x4b02('0x6b'),_0x1525f1[_0x4b02('0x3f')]);}},'complete':function(){try{var _0x3f59a2=[];var _0x2f2a44=_0x4b02('0x24');if(_0x3acd97[_0x4b02('0x6c')]&&_0x3acd97[_0x4b02('0x6c')][_0x4b02('0x55')]){_0x2f2a44='cm_contacts_'+_0x26d18e;_0x3f59a2['push'](_0x4b02('0x6d')+_0x2f2a44+_0x4b02('0x6e'));}var _0x3b4984=util['format'](_0x4b02('0x6f'),_0x355e55,_0x2f2a44,_0x3d9aa1,_0x3acd97['ListId'],_0x3acd97[_0x4b02('0x70')]||null,NOW,NOW);if(_[_0x4b02('0x71')](_0xcf862f['scheduledat'])){_0x3b4984+=_0x4b02('0x72');}_0x3f59a2[_0x4b02('0x42')](_0x3b4984);if(_0x3acd97[_0x4b02('0x6c')]&&_0x3acd97[_0x4b02('0x6c')][_0x4b02('0x55')]){_0x3f59a2['push'](insertCmContact(_0x3acd97[_0x4b02('0x73')],_0x2f2a44,_0x3acd97[_0x4b02('0x6c')],_0xcf862f));_0x3f59a2[_0x4b02('0x42')]('DROP\x20TABLE\x20'+_0x2f2a44+';');}_0x3f59a2[_0x4b02('0x42')](insertCmHopper(_0x3acd97[_0x4b02('0x73')],'voice_queues_has_cm_lists',_0x4b02('0x74'),_0x4b02('0x75'),_0x21f886));_0x3f59a2[_0x4b02('0x42')](insertCmHopperBlack(_0x3acd97['ListId'],_0x4b02('0x76'),_0x4b02('0x74'),'VoiceQueueId'));_0x3f59a2['push'](insertCmHopper(_0x3acd97[_0x4b02('0x73')],_0x4b02('0x77'),'campaigns',_0x4b02('0x78'),_0x21f886));_0x3f59a2[_0x4b02('0x42')](insertCmHopperBlack(_0x3acd97[_0x4b02('0x73')],_0x4b02('0x79'),'campaigns',_0x4b02('0x78')));BPromise[_0x4b02('0x7a')](_0x3f59a2,handleQuery)[_0x4b02('0x7b')](function(_0x34d58d){stats[_0x4b02('0x7c')]=!![];stats['affectedRows']=_0x3acd97[_0x4b02('0x6c')]&&_0x3acd97[_0x4b02('0x6c')][_0x4b02('0x55')]?results[0x2][_0x4b02('0x7d')]:results[0x0][_0x4b02('0x7d')];socket[_0x4b02('0x66')](_0x4b02('0x67')+_0x26d18e,stats);fs[_0x4b02('0x7e')](_0x2cf78e);fs[_0x4b02('0x7e')](_0x355e55);process['exit'](0x0);})['catch'](function(_0x2a3f1e){logger[_0x4b02('0x3e')](_0x2a3f1e[_0x4b02('0x3f')]);process[_0x4b02('0x40')](0x1);});}catch(_0x204782){logger[_0x4b02('0x3e')](_0x4b02('0x7f'),_0x204782[_0x4b02('0x3f')]);process[_0x4b02('0x40')](0x1);}},'error':function(_0x2eb428,_0x12c20e,_0x4d1128,_0x27da49){throw new Error(_0x27da49);}});}function validate(){if(process[_0x4b02('0x80')]&&process['argv'][_0x4b02('0x55')]<0x4){throw new Error(_0x4b02('0x81'));}var _0xa6a050=path[_0x4b02('0x13')](config[_0x4b02('0x4d')],_0x4b02('0x4e'),process[_0x4b02('0x80')][0x2]);if(!fs['existsSync'](_0xa6a050)){throw new Error(_0x4b02('0x82'));}var _0x3a55fa={};try{_0x3a55fa=JSON['parse'](process[_0x4b02('0x80')][0x3]);if(!_0x3a55fa['binding']){throw new Error(_0x4b02('0x83'));}if(!_0x3a55fa['binding']['phone']){throw new Error(_0x4b02('0x84'));}if(!_0x3a55fa[_0x4b02('0x4b')]['firstName']){throw new Error(_0x4b02('0x85'));}var _0x47e271=0x0;if(_0x3a55fa[_0x4b02('0x4b')][_0x4b02('0x22')]){_0x47e271=0x1;}if(!_0x3a55fa[_0x4b02('0x73')]){throw new Error(_0x4b02('0x86'));}}catch(_0x232a4b){throw new Error(_0x4b02('0x87'));}var _0x5ee79c=[];try{_0x5ee79c=_[_0x4b02('0x88')](JSON[_0x4b02('0x52')](process[_0x4b02('0x80')][0x4]),'id');}catch(_0x4817b4){logger[_0x4b02('0x3c')](_0x4b02('0x89'));}main(_0xa6a050,_0x3a55fa,_0x5ee79c,_0x47e271);}validate();process['on'](_0x4b02('0x8a'),handleStop);process['on'](_0x4b02('0x8b'),handleUncaughtException); \ No newline at end of file +var _0xe923=['isNil',',\x20scheduledAt\x20=\x20NOW()','length','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','squel','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','createdAt','ListId\x20=\x20?','\x20=\x20?','toString','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','query','spread','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','writeFileSync','createReadStream','data','rows','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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'];(function(_0x2206bf,_0xd409d9){var _0xe00e4d=function(_0x2f5991){while(--_0x2f5991){_0x2206bf['push'](_0x2206bf['shift']());}};_0xe00e4d(++_0xd409d9);}(_0xe923,0xa2));var _0x3e92=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0xe923[_0x3d90b4];return _0x4c65d3;};'use strict';var fs=require('fs');var path=require(_0x3e92('0x0'));var _=require('lodash');var Papa=require(_0x3e92('0x1'));var util=require(_0x3e92('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x3e92('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x3e92('0x4'));var logger=require(_0x3e92('0x5'))(_0x3e92('0x6'));config[_0x3e92('0x7')]=_[_0x3e92('0x8')](config[_0x3e92('0x7')],{'host':_0x3e92('0x9'),'port':0x18eb});var socket=require(_0x3e92('0xa'))(new Redis(config[_0x3e92('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x3e92('0xb'));function isEmail(_0x283199){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))*$/[_0x3e92('0xc')](_0x283199);}function selectNotIn(_0x17efae,_0x3a3849,_0x458c66,_0x239705,_0x40a3fa){return squel[_0x3e92('0xd')]()[_0x3e92('0xe')](_0x3e92('0xf'))['from'](_0x239705)[_0x3e92('0x10')](_0x3a3849,null,_0x3a3849+_0x3e92('0x11')+_0x239705+'.'+_0x458c66)['where'](_0x239705+'.'+_0x458c66+_0x3e92('0x12')+_0x17efae+'.'+_0x458c66)['where'](_0x3a3849+_0x3e92('0x13')+_0x40a3fa[_0x3e92('0x10')]()+')');}function insertCmHopper(_0x2b78cf,_0x5d4c37,_0x159e70,_0x28e2fc,_0x22731d){var _0x4320f4=[_0x3e92('0x14'),_0x3e92('0x15'),_0x3e92('0x16'),_0x3e92('0x17'),_0x5d4c37+'.'+_0x28e2fc,_0x3e92('0x18'),_0x3e92('0x19'),_0x3e92('0x1a'),_0x3e92('0x1b'),'\x22'+_0x22731d+'\x22'];return squel[_0x3e92('0x1c')]()[_0x3e92('0x1d')](_0x3e92('0x1e'))[_0x3e92('0x1f')](['phone',_0x3e92('0x20'),_0x3e92('0x21'),_0x3e92('0x22'),_0x28e2fc,'createdAt',_0x3e92('0x23'),'priority',_0x3e92('0x24'),_0x3e92('0x25')],squel['select']()[_0x3e92('0x26')](_0x4320f4)[_0x3e92('0x27')](_0x5d4c37)[_0x3e92('0x10')](_0x3e92('0x28'),null,_0x3e92('0x29')+_0x5d4c37+_0x3e92('0x2a'))[_0x3e92('0x10')](_0x159e70,null,_0x159e70+_0x3e92('0x11')+_0x5d4c37+'.'+_0x28e2fc)[_0x3e92('0x2b')](_0x5d4c37+'.CmListId\x20=\x20?',_0x2b78cf)['where'](_0x3e92('0x2c'),NOW)[_0x3e92('0x2b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d4c37,_0x159e70,_0x28e2fc,_0x3e92('0x1e'),[_0x3e92('0x2d'),_0x3e92('0x2e')]))[_0x3e92('0x2b')](_0x3e92('0x2f'),selectNotIn(_0x5d4c37,_0x159e70,_0x28e2fc,_0x3e92('0x1e'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x2468cb,_0x5ad0b5,_0x48af61,_0x2e9043){var _0x13201b=[_0x3e92('0x14'),_0x3e92('0x16'),_0x3e92('0x17'),_0x5ad0b5+'.'+_0x2e9043,_0x3e92('0x18'),_0x3e92('0x19')];return squel[_0x3e92('0x1c')]()[_0x3e92('0x1d')]('cm_hopper_black')[_0x3e92('0x1f')](['phone',_0x3e92('0x21'),'ListId',_0x2e9043,_0x3e92('0x30'),_0x3e92('0x23')],squel['select']()['fields'](_0x13201b)[_0x3e92('0x27')](_0x5ad0b5)['join'](_0x3e92('0x28'),null,_0x3e92('0x29')+_0x5ad0b5+_0x3e92('0x2a'))[_0x3e92('0x10')](_0x48af61,null,_0x48af61+'.id\x20=\x20'+_0x5ad0b5+'.'+_0x2e9043)['where'](_0x5ad0b5+'.CmListId\x20=\x20?',_0x2468cb)[_0x3e92('0x2b')](_0x3e92('0x2c'),NOW)[_0x3e92('0x2b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3e92('0xe')](_0x3e92('0xf'))[_0x3e92('0x27')]('cm_hopper_black')[_0x3e92('0x2b')](_0x3e92('0x31'),_0x2468cb)[_0x3e92('0x2b')](_0x2e9043+_0x3e92('0x32'),_0x5ad0b5+'.'+_0x2e9043)))[_0x3e92('0x33')]();}function insertCmContact(_0x5b48b9,_0x1004f5,_0x864faa,_0x1495f6){var _0x3e50fd=_['concat'](_[_0x3e92('0x34')](_0x1495f6),[_0x3e92('0x22'),'CompanyId',_0x3e92('0x30'),_0x3e92('0x23')]);return squel[_0x3e92('0x1c')]()[_0x3e92('0x1d')](_0x3e92('0x28'))[_0x3e92('0x1f')](_0x3e50fd,squel[_0x3e92('0xd')]()[_0x3e92('0x26')](_0x3e50fd)['from'](_0x1004f5)[_0x3e92('0x2b')]('('+_0x864faa[_0x3e92('0x10')](',')+_0x3e92('0x35'),squel[_0x3e92('0xd')]()[_0x3e92('0x26')](_0x864faa)[_0x3e92('0x27')](_0x3e92('0x28'))[_0x3e92('0x2b')](_0x3e92('0x31'),_0x5b48b9)[_0x3e92('0x2b')](_0x3e92('0x36')))[_0x3e92('0x2b')](_0x3e92('0x37'),squel['select']()[_0x3e92('0xe')](_0x3e92('0x38'),'min_id')[_0x3e92('0x27')](_0x1004f5)[_0x3e92('0x39')](_0x864faa[_0x3e92('0x10')](','))))[_0x3e92('0x33')]();}function handleStop(){logger[_0x3e92('0x3a')](_0x3e92('0x3b'));stopped=!![];}function handleUncaughtException(_0x5c3ecf){logger[_0x3e92('0x3c')](_0x5c3ecf[_0x3e92('0x3d')]);process[_0x3e92('0x3e')](0x1);}function handleError(_0x48dbec,_0x4f58f3){stats[_0x3e92('0x3f')][_0x3e92('0x40')]({'name':_0x4f58f3[_0x3e92('0x41')],'message':_0x4f58f3[_0x3e92('0x3d')],'row':_0x48dbec});}function handleQuery(_0x45f92b){logger['info'](_0x45f92b);return db['sequelize'][_0x3e92('0x42')](_0x45f92b)[_0x3e92('0x43')](function(_0x3cbb1f){results['push'](_0x3cbb1f);})[_0x3e92('0x44')](function(_0x3283e2){logger[_0x3e92('0x3c')](_0x3283e2[_0x3e92('0x3d')]);});}function main(_0x8c9240,_0x1d2d7f,_0x550483,_0x54b081){logger['info'](_0x3e92('0x45'),_0x8c9240,JSON['stringify'](_0x1d2d7f));process[_0x3e92('0x46')](_0x3e92('0x47'));var _0x4de1fb=_0x1d2d7f[_0x3e92('0x48')];var _0x54a8b6=_0x1d2d7f[_0x3e92('0x49')];var _0x1b92f1=path[_0x3e92('0x10')](config[_0x3e92('0x4a')],_0x3e92('0x4b'),_0x54a8b6+_0x3e92('0x4c'));var _0x2a8109=_[_0x3e92('0x34')](_0x4de1fb)['join']();logger[_0x3e92('0x3a')]('header',_0x2a8109);fs[_0x3e92('0x4d')](_0x1b92f1,_0x2a8109+'\x0a');Papa['parse'](fs[_0x3e92('0x4e')](_0x8c9240),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12ab12,_0x231c2a){try{for(var _0x21ed2d=0x0,_0x213fda=[];_0x21ed2d<_0x12ab12[_0x3e92('0x4f')]['length'];_0x21ed2d++){stats[_0x3e92('0x50')]+=0x1;if(_0x12ab12['errors'][_0x21ed2d]){handleError(_0x12ab12[_0x3e92('0x4f')][_0x21ed2d],_0x12ab12[_0x3e92('0x3f')][_0x21ed2d]);}else{var _0x227ae7=[];for(var _0x371c6d in _0x4de1fb){if(_0x4de1fb['hasOwnProperty'](_0x371c6d)){if(_0x12ab12['data'][_0x21ed2d][_0x4de1fb[_0x371c6d]]){var _0xe11db4=_['trim'](_0x12ab12[_0x3e92('0x4f')][_0x21ed2d][_0x4de1fb[_0x371c6d]][_0x3e92('0x51')](/"/g,'\x27'));switch(_0x371c6d){case _0x3e92('0x20'):var _0x4ac6c9=moment(_0xe11db4,_0x3e92('0xb'),!![]);if(_0x4ac6c9[_0x3e92('0x52')]()){_0x213fda['push']('\x22'+_0xe11db4+'\x22');}else{_0x227ae7[_0x3e92('0x40')](_0x3e92('0x53'));}break;case _0x3e92('0x54'):var _0x3eae29=parseInt(_0xe11db4);_0xe11db4=_[_0x3e92('0x55')](_0x3eae29)||_0x3eae29<0x0||_0x3eae29>0x4?_0x54b081?0x3:0x2:_0x3eae29;_0x213fda['push']('\x22'+_0xe11db4+'\x22');break;case _0x3e92('0x24'):var _0x4de4ad=parseInt(_0xe11db4);if(_[_0x3e92('0x56')](_0x4de4ad)&&_[_0x3e92('0x57')](_0x550483,_0x4de4ad)){_0x213fda[_0x3e92('0x40')]('\x22'+_0x4de4ad+'\x22');}else{_0x227ae7[_0x3e92('0x40')](_0x3e92('0x58'));}break;case'email':if(isEmail(_0xe11db4)){_0x213fda['push']('\x22'+_0xe11db4+'\x22');}else{_0x227ae7[_0x3e92('0x40')](_0x3e92('0x59'));}break;case'dateOfBirth':var _0x5c7918=moment(_0xe11db4,_0x3e92('0x5a'),!![]);if(_0x5c7918[_0x3e92('0x52')]()){_0x213fda[_0x3e92('0x40')]('\x22'+_0xe11db4+'\x22');}else{_0x227ae7[_0x3e92('0x40')](_0x3e92('0x5b'));}break;default:_0x213fda['push']('\x22'+_0xe11db4+'\x22');}}else{switch(_0x371c6d){case _0x3e92('0x5c'):case _0x3e92('0xf'):_0x227ae7[_0x3e92('0x40')](_0x371c6d+_0x3e92('0x5d'));break;default:_0x213fda[_0x3e92('0x40')]('\x22\x22');}}}}if(_0x227ae7['length']){handleError(_0x12ab12['data'][_0x21ed2d],{'code':_0x3e92('0x5e'),'message':_0x227ae7['join']()});}else{fs[_0x3e92('0x5f')](_0x1b92f1,_0x213fda['join']()+'\x0a');}_0x213fda=[];}if(!(stats[_0x3e92('0x50')]%0xc8)){socket[_0x3e92('0x60')](_0x3e92('0x61')+_0x54a8b6,stats);stats[_0x3e92('0x3f')]=[];}}if(stopped){logger[_0x3e92('0x3a')](_0x3e92('0x62'));_0x231c2a[_0x3e92('0x63')]();}}catch(_0x3dc5bf){handleError(_0x12ab12['data'][_0x21ed2d],{'code':'SystemError','message':_0x3dc5bf[_0x3e92('0x3d')]});logger[_0x3e92('0x3c')](_0x3e92('0x64'),_0x3dc5bf[_0x3e92('0x3d')]);}},'complete':function(){try{var _0xae937d=[];var _0x3f8e1f=_0x3e92('0x28');if(_0x1d2d7f[_0x3e92('0x65')]&&_0x1d2d7f[_0x3e92('0x65')]['length']){_0x3f8e1f=_0x3e92('0x66')+_0x54a8b6;_0xae937d[_0x3e92('0x40')](_0x3e92('0x67')+_0x3f8e1f+'\x20LIKE\x20cm_contacts;');}var _0x41132c=util[_0x3e92('0x68')](_0x3e92('0x69'),_0x1b92f1,_0x3f8e1f,_0x2a8109,_0x1d2d7f['ListId'],_0x1d2d7f['CompanyId']||null,NOW,NOW);if(_[_0x3e92('0x6a')](_0x4de1fb[_0x3e92('0x20')])){_0x41132c+=_0x3e92('0x6b');}_0xae937d[_0x3e92('0x40')](_0x41132c);if(_0x1d2d7f['duplicates']&&_0x1d2d7f[_0x3e92('0x65')][_0x3e92('0x6c')]){_0xae937d[_0x3e92('0x40')](insertCmContact(_0x1d2d7f[_0x3e92('0x22')],_0x3f8e1f,_0x1d2d7f[_0x3e92('0x65')],_0x4de1fb));_0xae937d[_0x3e92('0x40')]('DROP\x20TABLE\x20'+_0x3f8e1f+';');}_0xae937d['push'](insertCmHopper(_0x1d2d7f[_0x3e92('0x22')],_0x3e92('0x6d'),_0x3e92('0x6e'),_0x3e92('0x6f'),_0x54b081));_0xae937d['push'](insertCmHopperBlack(_0x1d2d7f[_0x3e92('0x22')],'voice_queues_has_cm_blacklists',_0x3e92('0x6e'),_0x3e92('0x6f')));_0xae937d[_0x3e92('0x40')](insertCmHopper(_0x1d2d7f['ListId'],_0x3e92('0x70'),_0x3e92('0x71'),_0x3e92('0x72'),_0x54b081));_0xae937d['push'](insertCmHopperBlack(_0x1d2d7f[_0x3e92('0x22')],_0x3e92('0x73'),_0x3e92('0x71'),_0x3e92('0x72')));BPromise[_0x3e92('0x74')](_0xae937d,handleQuery)[_0x3e92('0x75')](function(_0x216e75){stats[_0x3e92('0x76')]=!![];stats['affectedRows']=_0x1d2d7f['duplicates']&&_0x1d2d7f['duplicates'][_0x3e92('0x6c')]?results[0x2]['affectedRows']:results[0x0][_0x3e92('0x77')];socket[_0x3e92('0x60')](_0x3e92('0x61')+_0x54a8b6,stats);fs[_0x3e92('0x78')](_0x8c9240);fs[_0x3e92('0x78')](_0x1b92f1);process[_0x3e92('0x3e')](0x0);})[_0x3e92('0x44')](function(_0x30c78a){logger[_0x3e92('0x3c')](_0x30c78a[_0x3e92('0x3d')]);process['exit'](0x1);});}catch(_0x19512f){logger[_0x3e92('0x3c')](_0x3e92('0x79'),_0x19512f['message']);process[_0x3e92('0x3e')](0x1);}},'error':function(_0x55d98c,_0x5d1652,_0x8d69a9,_0x2f6b3e){throw new Error(_0x2f6b3e);}});}function validate(){if(process[_0x3e92('0x7a')]&&process['argv'][_0x3e92('0x6c')]<0x4){throw new Error(_0x3e92('0x7b'));}var _0x442af9=path[_0x3e92('0x10')](config[_0x3e92('0x4a')],_0x3e92('0x4b'),process[_0x3e92('0x7a')][0x2]);if(!fs[_0x3e92('0x7c')](_0x442af9)){throw new Error(_0x3e92('0x7d'));}var _0xa3a79d={};try{_0xa3a79d=JSON[_0x3e92('0x7e')](process[_0x3e92('0x7a')][0x3]);if(!_0xa3a79d[_0x3e92('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0xa3a79d[_0x3e92('0x48')]['phone']){throw new Error(_0x3e92('0x7f'));}if(!_0xa3a79d[_0x3e92('0x48')][_0x3e92('0x5c')]){throw new Error(_0x3e92('0x80'));}var _0x2b29ca=0x0;if(_0xa3a79d[_0x3e92('0x48')][_0x3e92('0x24')]){_0x2b29ca=0x1;}if(!_0xa3a79d['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x24076d){throw new Error(_0x3e92('0x81'));}var _0x54ceb5=[];try{_0x54ceb5=_[_0x3e92('0x82')](JSON[_0x3e92('0x7e')](process['argv'][0x4]),'id');}catch(_0x2f0038){logger[_0x3e92('0x3a')](_0x3e92('0x83'));}main(_0x442af9,_0xa3a79d,_0x54ceb5,_0x2b29ca);}validate();process['on'](_0x3e92('0x84'),handleStop);process['on'](_0x3e92('0x85'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0d0f253..eb1395e 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 _0x4fc2=['Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','Answer\x20Time','answertime','Complete\x20Time','Duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','variable','keyValue','Caller\x20Name','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x4fc2,0x111));var _0x24fc=function(_0x4471b3,_0x511a9f){_0x4471b3=_0x4471b3-0x0;var _0x386593=_0x4fc2[_0x4471b3];return _0x386593;};'use strict';exports[_0x24fc('0x0')]=function(_0x2b05a5,_0x1a4e51){var _0x4390a0=[{'type':'string','content':_0x24fc('0x1'),'variableName':null}];switch(_0x2b05a5[_0x24fc('0x2')]()){case _0x24fc('0x3'):switch(_0x1a4e51['toLowerCase']()){case _0x24fc('0x4'):_0x4390a0[_0x24fc('0x5')]({'type':'variable','content':'','variableName':_0x24fc('0x6')});_0x4390a0[_0x24fc('0x5')]({'type':'variable','content':'','variableName':_0x24fc('0x7')});break;case _0x24fc('0x8'):_0x4390a0[_0x24fc('0x5')]({'type':_0x24fc('0x9'),'content':_0x24fc('0xa'),'variableName':null});_0x4390a0[_0x24fc('0x5')]({'type':'variable','content':'','variableName':_0x24fc('0xb')});break;}}return _0x4390a0;};exports[_0x24fc('0xc')]=function(_0x1a4462,_0x133438){var _0x24998d=[];switch(_0x1a4462[_0x24fc('0x2')]()){case _0x24fc('0x3'):switch(_0x133438[_0x24fc('0x2')]()){case'inbound':_0x24998d=[{'type':_0x24fc('0x9'),'content':_0x24fc('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x24fc('0xe'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x7')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x11'),'keyType':_0x24fc('0xf'),'variableName':'calleridname'},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x12'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x13')},{'type':'keyValue','content':'','key':_0x24fc('0x14'),'keyType':'variable','variableName':_0x24fc('0x6')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x15'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x16')},{'type':'keyValue','content':'','key':_0x24fc('0x17'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x18')},{'type':_0x24fc('0x9'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x19'),'keyType':_0x24fc('0xf'),'variableName':'destcalleridname'},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x1a'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0xb')},{'type':'string','content':_0x24fc('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x24fc('0x1c'),'keyType':'variable','variableName':_0x24fc('0x18')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x1d'),'keyType':'variable','variableName':_0x24fc('0x1e')},{'type':'keyValue','content':'','key':_0x24fc('0x1f'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x20')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x21'),'keyType':_0x24fc('0xf'),'variableName':_0x24fc('0x22')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x23'),'keyType':_0x24fc('0xf'),'variableName':'talktime'}];break;case _0x24fc('0x8'):_0x24998d=[{'type':_0x24fc('0x9'),'content':_0x24fc('0xd'),'variableName':null},{'type':'keyValue','content':'','key':_0x24fc('0x24'),'keyType':_0x24fc('0xf'),'keyContent':'','variableName':_0x24fc('0xb')},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x25'),'keyType':_0x24fc('0xf'),'keyContent':'','variableName':'membername'},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x15'),'keyType':_0x24fc('0xf'),'keyContent':'','variableName':_0x24fc('0x16')},{'type':_0x24fc('0x10'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x24fc('0x9'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x26'),'keyType':_0x24fc('0xf'),'keyContent':'','variableName':_0x24fc('0x27')},{'type':'keyValue','content':'','key':_0x24fc('0x28'),'keyType':_0x24fc('0xf'),'keyContent':'','variableName':'endtime'},{'type':_0x24fc('0x10'),'content':'','key':_0x24fc('0x29'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x24fc('0x10'),'content':'','key':'Billable\x20Time','keyType':_0x24fc('0xf'),'keyContent':'','variableName':_0x24fc('0x2a')}];break;}}return _0x24998d;}; \ No newline at end of file +var _0x2b65=['Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','uniqueid','Answer\x20Time','endtime'];(function(_0x40a7c2,_0x1c6640){var _0xe8bbec=function(_0x186a8c){while(--_0x186a8c){_0x40a7c2['push'](_0x40a7c2['shift']());}};_0xe8bbec(++_0x1c6640);}(_0x2b65,0x131));var _0x52b6=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0x2b65[_0x36284b];return _0x23c34a;};'use strict';exports[_0x52b6('0x0')]=function(_0x265e81,_0x9b1a2c){var _0xc5814d=[{'type':_0x52b6('0x1'),'content':_0x52b6('0x2'),'variableName':null}];switch(_0x265e81[_0x52b6('0x3')]()){case _0x52b6('0x4'):switch(_0x9b1a2c['toLowerCase']()){case _0x52b6('0x5'):_0xc5814d[_0x52b6('0x6')]({'type':_0x52b6('0x7'),'content':'','variableName':_0x52b6('0x8')});_0xc5814d[_0x52b6('0x6')]({'type':_0x52b6('0x7'),'content':'','variableName':_0x52b6('0x9')});break;case _0x52b6('0xa'):_0xc5814d[_0x52b6('0x6')]({'type':_0x52b6('0x1'),'content':'Outbound\x20Call','variableName':null});_0xc5814d[_0x52b6('0x6')]({'type':_0x52b6('0x7'),'content':'','variableName':_0x52b6('0xb')});break;}}return _0xc5814d;};exports['getDescriptions']=function(_0x19d1d9,_0x2bb857){var _0x19f475=[];switch(_0x19d1d9[_0x52b6('0x3')]()){case'voice':switch(_0x2bb857[_0x52b6('0x3')]()){case _0x52b6('0x5'):_0x19f475=[{'type':_0x52b6('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0xd'),'keyType':'variable','variableName':_0x52b6('0x9')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x52b6('0x7'),'variableName':_0x52b6('0xe')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0xf'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x10')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x11'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x8')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x12'),'keyType':_0x52b6('0x7'),'variableName':'uniqueid'},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x13'),'keyType':_0x52b6('0x7'),'variableName':'agentcalledAt'},{'type':_0x52b6('0x1'),'content':_0x52b6('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x52b6('0x7'),'variableName':'destcalleridname'},{'type':_0x52b6('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x52b6('0x7'),'variableName':_0x52b6('0xb')},{'type':_0x52b6('0x1'),'content':_0x52b6('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x52b6('0x16'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x17')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x18'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x19')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x1a'),'keyType':'variable','variableName':_0x52b6('0x1b')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x1c'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x1d')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x1e'),'keyType':_0x52b6('0x7'),'variableName':_0x52b6('0x1f')}];break;case _0x52b6('0xa'):_0x19f475=[{'type':_0x52b6('0x1'),'content':_0x52b6('0x20'),'variableName':null},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x21'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0xb')},{'type':'keyValue','content':'','key':_0x52b6('0x22'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0x23')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x12'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0x24')},{'type':'keyValue','content':'','key':_0x52b6('0x13'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x52b6('0x1'),'content':_0x52b6('0x15')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x25'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x52b6('0xc'),'content':'','key':'Complete\x20Time','keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0x26')},{'type':_0x52b6('0xc'),'content':'','key':_0x52b6('0x27'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0x28')},{'type':'keyValue','content':'','key':_0x52b6('0x29'),'keyType':_0x52b6('0x7'),'keyContent':'','variableName':_0x52b6('0x2a')}];break;}}return _0x19f475;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 2d6c349..faff1de 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 _0x56db=['html','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','catch','tracked','user','body','omit'];(function(_0x102a99,_0x35b3fc){var _0x148b14=function(_0x1af610){while(--_0x1af610){_0x102a99['push'](_0x102a99['shift']());}};_0x148b14(++_0x35b3fc);}(_0x56db,0x92));var _0xb56d=function(_0x5c6bc9,_0x4276f7){_0x5c6bc9=_0x5c6bc9-0x0;var _0x5b1fa5=_0x56db[_0x5c6bc9];return _0x5b1fa5;};'use strict';var _=require(_0xb56d('0x0'));var db=require(_0xb56d('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xb56d('0x2'))(_0xb56d('0x3')),'fax':require('../../config/logger')(_0xb56d('0x4')),'sms':require(_0xb56d('0x2'))(_0xb56d('0x5')),'chat':require(_0xb56d('0x2'))('chat-interactions'),'whatsapp':require(_0xb56d('0x2'))(_0xb56d('0x6'))};function getInteractionId(_0x3d4dde,_0x242ec1,_0x606ec7){if(_0x3d4dde&&_0x3d4dde[_[_0xb56d('0x7')](_0x606ec7)+_0xb56d('0x8')]){return _0x3d4dde[_[_0xb56d('0x7')](_0x606ec7)+_0xb56d('0x8')];}else if(_0x3d4dde&&_0x3d4dde['id']){return _0x3d4dde['id'];}else if(_0x242ec1&&_0x242ec1['id']){return _0x242ec1['id'];}else{return'unknown';}}function log(_0xc98755,_0x5a1fe8,_0x30a77d,_0x4878b8,_0xbdfae0,_0x750a42){loggers[_0xbdfae0[_0xb56d('0x9')]()][_0xc98755](_0xb56d('0xa'),_0x750a42[_0xb56d('0xb')](),_0x5a1fe8?_0x5a1fe8['id']:null,_0x5a1fe8?_0x5a1fe8['name']:null,_0x5a1fe8?_0x5a1fe8['role']:null,getInteractionId(_0x30a77d,_0x4878b8,_0xbdfae0),_0x30a77d?JSON[_0xb56d('0xc')](_0x30a77d):_0xb56d('0xd'));}function updateUser(_0x5ccc5d,_0x12865e,_0xf0e1b3,_0x46b124,_0x5ff9c9){db[_[_0xb56d('0x7')](_0x46b124)+_0xb56d('0xe')][_0xb56d('0xf')]({'where':{'id':getInteractionId(_0x12865e,_0xf0e1b3,_0x46b124)}})[_0xb56d('0x10')](function(_0x421dd0){if(_0x421dd0){return _0x421dd0['update']({'UserId':_0x5ccc5d?_0x5ccc5d['id']:null});}})[_0xb56d('0x10')](function(_0x1e7511){if(_0x1e7511){log('info',_0x5ccc5d,_0x12865e,_0xf0e1b3,_0x46b124,_0x5ff9c9);}})[_0xb56d('0x11')](function(){log('error',_0x5ccc5d,_0x12865e,_0xf0e1b3,_0x46b124,_0x5ff9c9);});}exports[_0xb56d('0x12')]=function(_0x2b3d2c,_0x3ae501){return function(_0x3495b7,_0x1c9c43,_0x486d96){var _0x28c882=_0x3495b7[_0xb56d('0x13')];var _0x408ca7={};var _0x1839f0=_0x3495b7['query'];if(_0x408ca7){_0x408ca7=_['clone'](_0x3495b7[_0xb56d('0x14')]);_0x408ca7=_[_0xb56d('0x15')](_0x408ca7,[_0xb56d('0x14'),_0xb56d('0x16'),'phone','fax',_0xb56d('0x17')]);}updateUser(_0x28c882,_0x408ca7,_0x1839f0,_0x2b3d2c,_0x3ae501);_0x486d96(null);};}; \ No newline at end of file +var _0x98d5=['openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','catch','error','query','clone','body','omit','phone','fax','mobile','lodash'];(function(_0x55e3df,_0x6a4821){var _0x139edb=function(_0x188446){while(--_0x188446){_0x55e3df['push'](_0x55e3df['shift']());}};_0x139edb(++_0x6a4821);}(_0x98d5,0xfb));var _0x598d=function(_0xd67f27,_0x122439){_0xd67f27=_0xd67f27-0x0;var _0x59e4ab=_0x98d5[_0xd67f27];return _0x59e4ab;};'use strict';var _=require(_0x598d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x598d('0x1')),'mail':require(_0x598d('0x2'))(_0x598d('0x3')),'fax':require(_0x598d('0x2'))(_0x598d('0x4')),'sms':require(_0x598d('0x2'))(_0x598d('0x5')),'chat':require(_0x598d('0x2'))('chat-interactions'),'whatsapp':require(_0x598d('0x2'))('whatsapp-interactions')};function getInteractionId(_0x286d2a,_0x507285,_0x4de6f3){if(_0x286d2a&&_0x286d2a[_[_0x598d('0x6')](_0x4de6f3)+_0x598d('0x7')]){return _0x286d2a[_['upperFirst'](_0x4de6f3)+_0x598d('0x7')];}else if(_0x286d2a&&_0x286d2a['id']){return _0x286d2a['id'];}else if(_0x507285&&_0x507285['id']){return _0x507285['id'];}else{return _0x598d('0x8');}}function log(_0xbc77bd,_0x38dcb4,_0x25a910,_0x1e40e5,_0x53fb33,_0x5736a5){loggers[_0x53fb33[_0x598d('0x9')]()][_0xbc77bd](_0x598d('0xa'),_0x5736a5[_0x598d('0xb')](),_0x38dcb4?_0x38dcb4['id']:null,_0x38dcb4?_0x38dcb4[_0x598d('0xc')]:null,_0x38dcb4?_0x38dcb4[_0x598d('0xd')]:null,getInteractionId(_0x25a910,_0x1e40e5,_0x53fb33),_0x25a910?JSON[_0x598d('0xe')](_0x25a910):_0x598d('0xf'));}function updateUser(_0x3886df,_0x2a1d44,_0x125a84,_0xe83816,_0x3c4472){db[_['upperFirst'](_0xe83816)+_0x598d('0x10')]['findOne']({'where':{'id':getInteractionId(_0x2a1d44,_0x125a84,_0xe83816)}})[_0x598d('0x11')](function(_0x12807d){if(_0x12807d){return _0x12807d[_0x598d('0x12')]({'UserId':_0x3886df?_0x3886df['id']:null});}})[_0x598d('0x11')](function(_0x2032b9){if(_0x2032b9){log('info',_0x3886df,_0x2a1d44,_0x125a84,_0xe83816,_0x3c4472);}})[_0x598d('0x13')](function(){log(_0x598d('0x14'),_0x3886df,_0x2a1d44,_0x125a84,_0xe83816,_0x3c4472);});}exports['tracked']=function(_0x210037,_0x2e9bf6){return function(_0x51861e,_0x9128f7,_0x1223f6){var _0xc6a186=_0x51861e['user'];var _0x528531={};var _0x3d4612=_0x51861e[_0x598d('0x15')];if(_0x528531){_0x528531=_[_0x598d('0x16')](_0x51861e[_0x598d('0x17')]);_0x528531=_[_0x598d('0x18')](_0x528531,[_0x598d('0x17'),'html',_0x598d('0x19'),_0x598d('0x1a'),_0x598d('0x1b')]);}updateUser(_0xc6a186,_0x528531,_0x3d4612,_0x210037,_0x2e9bf6);_0x1223f6(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0704b08..d73c4fd 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 _0x56aa=['then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','aes-256-ctr','format','update','utf8','final','parse','License','findOne'];(function(_0x32f491,_0xb65c35){var _0x5679ee=function(_0x369a65){while(--_0x369a65){_0x32f491['push'](_0x32f491['shift']());}};_0x5679ee(++_0xb65c35);}(_0x56aa,0x156));var _0xa56a=function(_0x1391a8,_0x4e2f7f){_0x1391a8=_0x1391a8-0x0;var _0x1e3519=_0x56aa[_0x1391a8];return _0x1e3519;};'use strict';var crypto=require('crypto');var util=require(_0xa56a('0x0'));var compose=require(_0xa56a('0x1'));var db=require(_0xa56a('0x2'))['db'];var config=require(_0xa56a('0x3'));function getValueFromLicense(_0x4a7919,_0x3dd38c){if(_0x4a7919&&_0x3dd38c){if(_0x3dd38c['data1']&&_0x3dd38c[_0xa56a('0x4')]){var _0x12b256=_0x3dd38c[_0xa56a('0x5')];var _0x48600f=_0x3dd38c['license'];var _0x356e1e=_0x12b256[_0xa56a('0x6')]('-')[0x4];var _0x1009ba=_0x12b256[_0xa56a('0x6')]('-')[0x0];var _0x1934ae=crypto['createDecipher'](_0xa56a('0x7'),util[_0xa56a('0x8')]('%s:%s:%s',_0x356e1e,_0x12b256,_0x1009ba));var _0x5676ea=_0x1934ae[_0xa56a('0x9')](_0x48600f,'base64',_0xa56a('0xa'));_0x5676ea+=_0x1934ae[_0xa56a('0xb')](_0xa56a('0xa'));var _0x120422=JSON[_0xa56a('0xc')](_0x5676ea);return _0x120422['hasOwnProperty'](_0x4a7919)?_0x120422[_0x4a7919]:null;}}return null;}function isLimit(_0x5f5c9d,_0x361a76,_0x13079c,_0x173a93){var _0x12ee3b=_0x361a76;return compose()['use'](function(_0x18acf8,_0x12cda1,_0x4698db){return db[_0xa56a('0xd')][_0xa56a('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xa56a('0xf')](function(_0xd22441){var _0x403e20=getValueFromLicense(_0x5f5c9d,_0xd22441);return _0x403e20?_0x403e20:_0x12ee3b;})[_0xa56a('0xf')](function(_0x14429e){_0x12ee3b=_0x14429e;return _0x13079c['count'](_0x173a93);})[_0xa56a('0xf')](function(_0x10922f){if(_0x10922f>=_0x12ee3b){return _0x12cda1['status'](0x193)[_0xa56a('0x10')]({'message':util[_0xa56a('0x8')](_0xa56a('0x11'),_0x5f5c9d)});}_0x4698db();})['catch'](function(_0x4f9204){_0x4698db(_0x4f9204);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xa56a('0x12')],{'where':{'$or':[{'role':_0xa56a('0x13')},{'role':'user'}]}});}exports[_0xa56a('0x14')]=isUserLimit; \ No newline at end of file +var _0xe60d=['%s:%s:%s','update','final','utf8','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format'];(function(_0x36427f,_0xe96ae7){var _0x63526e=function(_0x49727a){while(--_0x49727a){_0x36427f['push'](_0x36427f['shift']());}};_0x63526e(++_0xe96ae7);}(_0xe60d,0x155));var _0xde60=function(_0x305393,_0x3906b6){_0x305393=_0x305393-0x0;var _0x56eb6b=_0xe60d[_0x305393];return _0x56eb6b;};'use strict';var crypto=require(_0xde60('0x0'));var util=require('util');var compose=require(_0xde60('0x1'));var db=require(_0xde60('0x2'))['db'];var config=require(_0xde60('0x3'));function getValueFromLicense(_0x6eace,_0x474df1){if(_0x6eace&&_0x474df1){if(_0x474df1[_0xde60('0x4')]&&_0x474df1[_0xde60('0x5')]){var _0x3e77eb=_0x474df1[_0xde60('0x4')];var _0x3b3e2a=_0x474df1['license'];var _0x5a8790=_0x3e77eb['split']('-')[0x4];var _0xad0ecb=_0x3e77eb['split']('-')[0x0];var _0x5bf247=crypto[_0xde60('0x6')](_0xde60('0x7'),util[_0xde60('0x8')](_0xde60('0x9'),_0x5a8790,_0x3e77eb,_0xad0ecb));var _0x2af8b2=_0x5bf247[_0xde60('0xa')](_0x3b3e2a,'base64','utf8');_0x2af8b2+=_0x5bf247[_0xde60('0xb')](_0xde60('0xc'));var _0x19b77f=JSON['parse'](_0x2af8b2);return _0x19b77f['hasOwnProperty'](_0x6eace)?_0x19b77f[_0x6eace]:null;}}return null;}function isLimit(_0x4eca0c,_0x4b08c4,_0x13b99c,_0x25d834){var _0x34d43f=_0x4b08c4;return compose()[_0xde60('0xd')](function(_0x549ce9,_0x182b38,_0x528c51){return db[_0xde60('0xe')][_0xde60('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xde60('0x10')](function(_0x1aeed6){var _0x8b3591=getValueFromLicense(_0x4eca0c,_0x1aeed6);return _0x8b3591?_0x8b3591:_0x34d43f;})[_0xde60('0x10')](function(_0x179262){_0x34d43f=_0x179262;return _0x13b99c['count'](_0x25d834);})[_0xde60('0x10')](function(_0x14f0f3){if(_0x14f0f3>=_0x34d43f){return _0x182b38[_0xde60('0x11')](0x193)[_0xde60('0x12')]({'message':util[_0xde60('0x8')](_0xde60('0x13'),_0x4eca0c)});}_0x528c51();})[_0xde60('0x14')](function(_0x5005cc){_0x528c51(_0x5005cc);});});}function isUserLimit(){return isLimit(_0xde60('0x15'),0x1,db[_0xde60('0x16')],{'where':{'$or':[{'role':_0xde60('0x17')},{'role':_0xde60('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 38d83f9..0dc481c 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 _0x29a3=['$eq','$between','value','includes','$lte','add','days','format','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','length','split','slice','forEach','shift','match','indexOf','conditions','push','buildExpression','DATE','operator'];(function(_0x23d3f2,_0x491db1){var _0xd895fd=function(_0x4c6340){while(--_0x4c6340){_0x23d3f2['push'](_0x23d3f2['shift']());}};_0xd895fd(++_0x491db1);}(_0x29a3,0x182));var _0x329a=function(_0x2d6330,_0x2e2ea0){_0x2d6330=_0x2d6330-0x0;var _0x202683=_0x29a3[_0x2d6330];return _0x202683;};'use strict';var _=require(_0x329a('0x0'));var moment=require(_0x329a('0x1'));exports[_0x329a('0x2')]=function(_0x405bf3){var _0x59df5e={'conditions':[]};_0x59df5e[_0x329a('0x3')]=_[_0x329a('0x4')](_0x405bf3,_0x329a('0x5'))?'or':_0x329a('0x6');var _0x4efb29=_0x405bf3[_0x329a('0x7')]('[$and]','')['replace'](_0x329a('0x5'),'')['split']('||');for(var _0x5790e8=0x0;_0x5790e8<_0x4efb29[_0x329a('0x8')];_0x5790e8++){var _0x16ac8d=_0x4efb29[_0x5790e8][_0x329a('0x9')](':=');var _0x36b725=_0x16ac8d[0x0];var _0x1242c8=_0x16ac8d[_0x329a('0xa')](0x1);_0x1242c8[_0x329a('0xb')](function(_0x1e61a5){var _0x4ecdaf=_0x1e61a5[_0x329a('0x9')]('[')[_0x329a('0xc')]();var _0x46b7ec=_0x1e61a5[_0x329a('0xd')](/\[(.*?)\]/g);_0x46b7ec['forEach'](function(_0x56e85d){var _0x59a9d6=_0x56e85d[_0x329a('0x9')]('[')['filter'](function(_0xa08d1e){return _0xa08d1e[_0x329a('0xe')](']')>-0x1;})['map'](function(_0xe5e0a9){return _0xe5e0a9[_0x329a('0x9')](']')[0x0];})[0x0];_0x59df5e[_0x329a('0xf')][_0x329a('0x10')]({'field':_0x36b725,'operator':_0x4ecdaf,'value':_0x59a9d6});});});}return _0x59df5e;};exports[_0x329a('0x11')]=function(_0x565606,_0x1afdde,_0x1dcd5f){var _0x4cc51c={};if(_0x1afdde===_0x329a('0x12')){if(_0x1dcd5f[_0x329a('0x13')]===_0x329a('0x14')){_0x1dcd5f[_0x329a('0x13')]=_0x329a('0x15');_0x1dcd5f[_0x329a('0x16')]+=','+_0x1dcd5f[_0x329a('0x16')];}else if(_[_0x329a('0x17')](['$gt',_0x329a('0x18')],_0x1dcd5f[_0x329a('0x13')])){_0x1dcd5f[_0x329a('0x16')]=moment(_0x1dcd5f[_0x329a('0x16')])[_0x329a('0x19')](0x1,_0x329a('0x1a'))[_0x329a('0x1b')]('YYYY-MM-DD');}}if(_0x1dcd5f[_0x329a('0x1c')]){_0x1afdde=_0x1dcd5f[_0x329a('0x1c')];_0x4cc51c[_0x329a('0x1d')]='CAST('+_0x565606+'.'+_0x1dcd5f[_0x329a('0x1e')]+_0x329a('0x1f')+_0x1dcd5f[_0x329a('0x1c')]+')\x20'+parseOperator(_0x1dcd5f['operator']);}else{_0x4cc51c['text']=_0x565606+'.'+_0x1dcd5f[_0x329a('0x1e')]+'\x20'+parseOperator(_0x1dcd5f[_0x329a('0x13')]);}if(_['includes']([_0x329a('0x20'),_0x329a('0x21')],_0x1dcd5f['operator']))_0x4cc51c[_0x329a('0x1d')]='('+_0x4cc51c[_0x329a('0x1d')]+_0x329a('0x22')+_0x565606+'.'+_0x1dcd5f[_0x329a('0x1e')]+_0x329a('0x23');_0x4cc51c[_0x329a('0x16')]=parseValue(_0x1afdde,_0x1dcd5f[_0x329a('0x13')],_0x1dcd5f[_0x329a('0x16')]);return _0x4cc51c;};function parseOperator(_0x286663){var _0x5d2784;switch(_0x286663){case _0x329a('0x24'):_0x5d2784=_0x329a('0x25');break;case _0x329a('0x21'):_0x5d2784=_0x329a('0x26');break;case _0x329a('0x14'):_0x5d2784=_0x329a('0x27');break;case _0x329a('0x20'):_0x5d2784=_0x329a('0x28');break;case _0x329a('0x29'):case _0x329a('0x2a'):case _0x329a('0x2b'):_0x5d2784=_0x329a('0x2c');break;case _0x329a('0x2d'):_0x5d2784='<\x20?';break;case _0x329a('0x2e'):_0x5d2784=_0x329a('0x2f');break;case _0x329a('0x18'):_0x5d2784=_0x329a('0x30');break;case _0x329a('0x31'):_0x5d2784=_0x329a('0x32');break;case _0x329a('0x15'):_0x5d2784=_0x329a('0x33');break;}return _0x5d2784;}function parseValue(_0x1da33c,_0x1be32f,_0x57fe99){var _0x46b9e5={'start':undefined,'end':undefined};switch(_0x1be32f){case _0x329a('0x24'):case'$notIn':_0x46b9e5[_0x329a('0x34')]=_0x57fe99[_0x329a('0x9')](',');break;case _0x329a('0x29'):_0x46b9e5[_0x329a('0x34')]='%'+_0x57fe99+'%';break;case _0x329a('0x2a'):_0x46b9e5['start']=_0x57fe99+'%';break;case _0x329a('0x2b'):_0x46b9e5[_0x329a('0x34')]='%'+_0x57fe99;break;case _0x329a('0x15'):var _0x102a4d=_0x57fe99[_0x329a('0x9')](',');var _0x57fe99=_0x102a4d[_0x329a('0xc')]();var _0x495eb7=_0x102a4d[_0x329a('0x35')]();if(_0x1da33c===_0x329a('0x12')){_0x57fe99=moment(_0x57fe99)[_0x329a('0x36')](0x0,!![])[_0x329a('0x1b')]();_0x495eb7=moment(_0x495eb7)[_0x329a('0x36')](0x0,!![])[_0x329a('0x19')](0x17,_0x329a('0x37'))[_0x329a('0x19')](0x3b,_0x329a('0x38'))[_0x329a('0x19')](0x3b,_0x329a('0x39'))[_0x329a('0x1b')]();}_0x46b9e5={'start':_0x57fe99,'end':_0x495eb7};break;default:_0x46b9e5[_0x329a('0x34')]=_0x57fe99;break;}return _0x46b9e5;} \ No newline at end of file +var _0x259a=['text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo'];(function(_0x4a3463,_0x5275de){var _0x4f8f99=function(_0x1b1290){while(--_0x1b1290){_0x4a3463['push'](_0x4a3463['shift']());}};_0x4f8f99(++_0x5275de);}(_0x259a,0x87));var _0xa259=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x259a[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0xa259('0x0'));var moment=require(_0xa259('0x1'));exports[_0xa259('0x2')]=function(_0x4bd034){var _0x1c4849={'conditions':[]};_0x1c4849['sqlOperator']=_['startsWith'](_0x4bd034,_0xa259('0x3'))?'or':_0xa259('0x4');var _0x19abf3=_0x4bd034[_0xa259('0x5')](_0xa259('0x6'),'')[_0xa259('0x5')]('[$or]','')[_0xa259('0x7')]('||');for(var _0x305dfc=0x0;_0x305dfc<_0x19abf3[_0xa259('0x8')];_0x305dfc++){var _0x28513b=_0x19abf3[_0x305dfc][_0xa259('0x7')](':=');var _0x685d81=_0x28513b[0x0];var _0x5f04a7=_0x28513b['slice'](0x1);_0x5f04a7[_0xa259('0x9')](function(_0x14ee03){var _0x8ebed0=_0x14ee03[_0xa259('0x7')]('[')[_0xa259('0xa')]();var _0xf9de43=_0x14ee03[_0xa259('0xb')](/\[(.*?)\]/g);_0xf9de43['forEach'](function(_0x22a2e7){var _0x7e3c24=_0x22a2e7[_0xa259('0x7')]('[')[_0xa259('0xc')](function(_0x1e4c7f){return _0x1e4c7f[_0xa259('0xd')](']')>-0x1;})[_0xa259('0xe')](function(_0x57bbad){return _0x57bbad['split'](']')[0x0];})[0x0];_0x1c4849[_0xa259('0xf')][_0xa259('0x10')]({'field':_0x685d81,'operator':_0x8ebed0,'value':_0x7e3c24});});});}return _0x1c4849;};exports[_0xa259('0x11')]=function(_0x15c4e6,_0x5302dc,_0x2c9379){var _0x590f68={};if(_0x5302dc===_0xa259('0x12')){if(_0x2c9379[_0xa259('0x13')]===_0xa259('0x14')){_0x2c9379[_0xa259('0x13')]=_0xa259('0x15');_0x2c9379['value']+=','+_0x2c9379[_0xa259('0x16')];}else if(_[_0xa259('0x17')]([_0xa259('0x18'),_0xa259('0x19')],_0x2c9379[_0xa259('0x13')])){_0x2c9379[_0xa259('0x16')]=moment(_0x2c9379[_0xa259('0x16')])['add'](0x1,_0xa259('0x1a'))[_0xa259('0x1b')](_0xa259('0x1c'));}}if(_0x2c9379[_0xa259('0x1d')]){_0x5302dc=_0x2c9379[_0xa259('0x1d')];_0x590f68[_0xa259('0x1e')]=_0xa259('0x1f')+_0x15c4e6+'.'+_0x2c9379[_0xa259('0x20')]+'\x20AS\x20'+_0x2c9379[_0xa259('0x1d')]+')\x20'+parseOperator(_0x2c9379['operator']);}else{_0x590f68[_0xa259('0x1e')]=_0x15c4e6+'.'+_0x2c9379['field']+'\x20'+parseOperator(_0x2c9379['operator']);}if(_[_0xa259('0x17')]([_0xa259('0x21'),_0xa259('0x22')],_0x2c9379[_0xa259('0x13')]))_0x590f68[_0xa259('0x1e')]='('+_0x590f68['text']+_0xa259('0x23')+_0x15c4e6+'.'+_0x2c9379[_0xa259('0x20')]+_0xa259('0x24');_0x590f68[_0xa259('0x16')]=parseValue(_0x5302dc,_0x2c9379[_0xa259('0x13')],_0x2c9379[_0xa259('0x16')]);return _0x590f68;};function parseOperator(_0x212d7d){var _0x351a19;switch(_0x212d7d){case _0xa259('0x25'):_0x351a19='IN\x20?';break;case _0xa259('0x22'):_0x351a19='NOT\x20IN\x20?';break;case'$eq':_0x351a19='=\x20?';break;case _0xa259('0x21'):_0x351a19=_0xa259('0x26');break;case _0xa259('0x27'):case'$startsWith':case _0xa259('0x28'):_0x351a19=_0xa259('0x29');break;case _0xa259('0x2a'):_0x351a19='<\x20?';break;case _0xa259('0x18'):_0x351a19=_0xa259('0x2b');break;case _0xa259('0x19'):_0x351a19=_0xa259('0x2c');break;case'$gte':_0x351a19=_0xa259('0x2d');break;case _0xa259('0x15'):_0x351a19=_0xa259('0x2e');break;}return _0x351a19;}function parseValue(_0xd1454b,_0x453fc5,_0x5134de){var _0x58bde8={'start':undefined,'end':undefined};switch(_0x453fc5){case _0xa259('0x25'):case _0xa259('0x22'):_0x58bde8['start']=_0x5134de[_0xa259('0x7')](',');break;case _0xa259('0x27'):_0x58bde8[_0xa259('0x2f')]='%'+_0x5134de+'%';break;case _0xa259('0x30'):_0x58bde8[_0xa259('0x2f')]=_0x5134de+'%';break;case _0xa259('0x28'):_0x58bde8[_0xa259('0x2f')]='%'+_0x5134de;break;case'$between':var _0x5a8470=_0x5134de[_0xa259('0x7')](',');var _0x5134de=_0x5a8470['shift']();var _0x2d2c85=_0x5a8470[_0xa259('0x31')]();if(_0xd1454b===_0xa259('0x12')){_0x5134de=moment(_0x5134de)[_0xa259('0x32')](0x0,!![])[_0xa259('0x1b')]();_0x2d2c85=moment(_0x2d2c85)[_0xa259('0x32')](0x0,!![])[_0xa259('0x33')](0x17,_0xa259('0x34'))['add'](0x3b,_0xa259('0x35'))['add'](0x3b,_0xa259('0x36'))[_0xa259('0x1b')]();}_0x58bde8={'start':_0x5134de,'end':_0x2d2c85};break;default:_0x58bde8[_0xa259('0x2f')]=_0x5134de;break;}return _0x58bde8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4617313..1c55039 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 _0xda60=['type','isPlainObject','parse','$gte','format','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','unsigned','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','join','lodash','sequelize','fields','split','filters','isEmpty','forOwn','find'];(function(_0x2109d5,_0x22d6d7){var _0x402ef8=function(_0x33405e){while(--_0x33405e){_0x2109d5['push'](_0x2109d5['shift']());}};_0x402ef8(++_0x22d6d7);}(_0xda60,0x73));var _0x0da6=function(_0x580d0e,_0x1e5f43){_0x580d0e=_0x580d0e-0x0;var _0xb51111=_0xda60[_0x580d0e];return _0xb51111;};'use strict';var _=require(_0x0da6('0x0'));var sequelize=require(_0x0da6('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x0da6('0x2')]=function(_0x1195fd){var _0xc92e95=null;if(_0x1195fd){_0xc92e95=_0x1195fd[_0x0da6('0x3')](',');}return _0xc92e95;};exports[_0x0da6('0x4')]=function(_0x171c16,_0x570eaf){var _0x20be8f={};if(!_[_0x0da6('0x5')](_0x171c16)){_[_0x0da6('0x6')](_0x171c16,function(_0x2e1cfd,_0x636777){try{if(_0x570eaf){var _0xf04484=_[_0x0da6('0x7')](_0x570eaf,{'name':_0x636777})||{};if(_0xf04484[_0x0da6('0x8')]==='DATE'&&_[_0x0da6('0x9')](_0x2e1cfd)){var _0x54dfe0=JSON[_0x0da6('0xa')](_0x2e1cfd);var _0xbbe993={'$gte':moment(moment(_0x54dfe0[_0x0da6('0xb')])[_0x0da6('0xc')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x54dfe0['$lte'])[_0x0da6('0xc')]('YYYY-MM-DD'))[_0x0da6('0xd')]()[_0x0da6('0xe')](0x1,'s')['format']()};_0x20be8f[_0x636777]=_0xbbe993;}else if(_0xf04484[_0x0da6('0xf')]===_0x0da6('0x10')){_0x20be8f[_0x636777]=_0x2e1cfd;}else{_0x20be8f[_0x636777]=_[_0x0da6('0x11')](_0x2e1cfd)?_0x2e1cfd:JSON['parse'](_0x2e1cfd);}}else{_0x20be8f[_0x636777]=_[_0x0da6('0x11')](_0x2e1cfd)?_0x2e1cfd:JSON[_0x0da6('0xa')](_0x2e1cfd);}}catch(_0x3bb98a){_0x20be8f[_0x636777]=_0x2e1cfd[_0x0da6('0x3')](',');}});}return _0x20be8f;};exports[_0x0da6('0x12')]=function(_0x2f6f15){_0x2f6f15=parseInt(_0x2f6f15,0xa);if(!_0x2f6f15||_0x2f6f15<0x0){_0x2f6f15=LIMIT_VALUE;}return _0x2f6f15;};exports[_0x0da6('0x13')]=function(_0x57e17a){_0x57e17a=parseInt(_0x57e17a,0xa);if(!_0x57e17a||_0x57e17a<0x0){_0x57e17a=0x0;}return _0x57e17a;};exports[_0x0da6('0x14')]=function(_0x23247e){var _0xbf0578,_0x10d74c=null;if(_0x23247e){_0xbf0578=_0x23247e[_0x0da6('0x3')](',');_0x10d74c=_[_0x0da6('0x15')](_0xbf0578,function(_0x1c1c86){if(_0x1c1c86['indexOf']('-')===0x0){return[_0x1c1c86===_0x0da6('0x16')?sequelize[_0x0da6('0x17')](sequelize['col'](_0x0da6('0x16')),'unsigned'):_0x1c1c86['substr'](0x1),'DESC'];}else{return[_0x1c1c86===_0x0da6('0x16')?sequelize[_0x0da6('0x17')](sequelize[_0x0da6('0x18')]('priority'),_0x0da6('0x19')):_0x1c1c86,_0x0da6('0x1a')];}});}return _0x10d74c;};exports[_0x0da6('0x1b')]=function(_0x1a8405,_0x4d9c99){if(_['isEmpty'](_0x1a8405)){return _0x1a8405;}if(_[_0x0da6('0x11')](_0x1a8405)){for(var _0x4caf8e=0x0;_0x4caf8e<_0x1a8405[_0x0da6('0x1c')];_0x4caf8e+=0x1){_0x1a8405[_0x4caf8e]=this[_0x0da6('0x1b')](_0x1a8405[_0x4caf8e],_0x4d9c99);}return _0x1a8405;}if(!_[_0x0da6('0x1d')](_0x1a8405)){return _0x1a8405;}if(_[_0x0da6('0x1e')](_0x4d9c99)){_0x4d9c99=[_0x4d9c99];}if(!_[_0x0da6('0x11')](_0x4d9c99)){return _0x1a8405;}for(var _0x576621=0x0;_0x576621<_0x4d9c99[_0x0da6('0x1c')];_0x576621+=0x1){_[_0x0da6('0x1f')](_0x1a8405,_0x4d9c99[_0x576621]);}for(var _0x395ad0 in _0x1a8405){if(_0x1a8405['hasOwnProperty'](_0x395ad0)){_0x1a8405[_0x395ad0]=this[_0x0da6('0x1b')](_0x1a8405[_0x395ad0],_0x4d9c99);}}return _0x1a8405;};exports[_0x0da6('0x20')]=function(_0x2071cf){return _0x2071cf[_0x0da6('0x21')](RegExp(_0x0da6('0x22')))?!![]:![];};exports[_0x0da6('0x23')]=function(_0x2cac0b){return _0x2cac0b['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x0da6('0x24')]=function(_0x3d4e81){var _0x33f47a=[];_0x3d4e81[_0x0da6('0x3')](/[ ,]+/)[_0x0da6('0x25')](function(_0x38d208){_0x38d208=_0x38d208[_0x0da6('0x26')](/([^:]")"+/g,'$1');_0x38d208='+'+_0x38d208+'*';if(_0x38d208[_0x0da6('0x27')]('@'))_0x38d208='\x22'+_0x38d208+'\x22';_0x33f47a['push'](_0x38d208);});return _0x33f47a[_0x0da6('0x28')]('\x20');}; \ No newline at end of file +var _0x25f6=['uniqueid','isArray','limit','offset','sort','map','col','priority','substr','cast','unsigned','ASC','length','omit','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','forEach','replace','push','lodash','fields','split','filters','isEmpty','forOwn','find','type','DATE','parse','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x25f6,0x17f));var _0x625f=function(_0x4aea3a,_0x3839f9){_0x4aea3a=_0x4aea3a-0x0;var _0x5a349e=_0x25f6[_0x4aea3a];return _0x5a349e;};'use strict';var _=require(_0x625f('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x625f('0x1')]=function(_0x544184){var _0x3403ae=null;if(_0x544184){_0x3403ae=_0x544184[_0x625f('0x2')](',');}return _0x3403ae;};exports[_0x625f('0x3')]=function(_0x40ff4a,_0x200f8d){var _0x59c286={};if(!_[_0x625f('0x4')](_0x40ff4a)){_[_0x625f('0x5')](_0x40ff4a,function(_0x557aba,_0x5c8b82){try{if(_0x200f8d){var _0x1f1b14=_[_0x625f('0x6')](_0x200f8d,{'name':_0x5c8b82})||{};if(_0x1f1b14[_0x625f('0x7')]===_0x625f('0x8')&&_['isPlainObject'](_0x557aba)){var _0x11e7ff=JSON[_0x625f('0x9')](_0x557aba);var _0x4d367a={'$gte':moment(moment(_0x11e7ff[_0x625f('0xa')])[_0x625f('0xb')]('YYYY-MM-DD'))[_0x625f('0xc')]()[_0x625f('0xb')](),'$lte':moment(moment(_0x11e7ff[_0x625f('0xd')])[_0x625f('0xb')](_0x625f('0xe')))['utc']()[_0x625f('0xf')](0x1,'s')['format']()};_0x59c286[_0x5c8b82]=_0x4d367a;}else if(_0x1f1b14[_0x625f('0x10')]===_0x625f('0x11')){_0x59c286[_0x5c8b82]=_0x557aba;}else{_0x59c286[_0x5c8b82]=_[_0x625f('0x12')](_0x557aba)?_0x557aba:JSON[_0x625f('0x9')](_0x557aba);}}else{_0x59c286[_0x5c8b82]=_[_0x625f('0x12')](_0x557aba)?_0x557aba:JSON[_0x625f('0x9')](_0x557aba);}}catch(_0x4eba7e){_0x59c286[_0x5c8b82]=_0x557aba['split'](',');}});}return _0x59c286;};exports[_0x625f('0x13')]=function(_0x58b88a){_0x58b88a=parseInt(_0x58b88a,0xa);if(!_0x58b88a||_0x58b88a<0x0){_0x58b88a=LIMIT_VALUE;}return _0x58b88a;};exports[_0x625f('0x14')]=function(_0x2deade){_0x2deade=parseInt(_0x2deade,0xa);if(!_0x2deade||_0x2deade<0x0){_0x2deade=0x0;}return _0x2deade;};exports[_0x625f('0x15')]=function(_0x192e9f){var _0x45d745,_0x264c23=null;if(_0x192e9f){_0x45d745=_0x192e9f[_0x625f('0x2')](',');_0x264c23=_[_0x625f('0x16')](_0x45d745,function(_0x396b0d){if(_0x396b0d['indexOf']('-')===0x0){return[_0x396b0d==='priority'?sequelize['cast'](sequelize[_0x625f('0x17')](_0x625f('0x18')),'unsigned'):_0x396b0d[_0x625f('0x19')](0x1),'DESC'];}else{return[_0x396b0d==='priority'?sequelize[_0x625f('0x1a')](sequelize['col']('priority'),_0x625f('0x1b')):_0x396b0d,_0x625f('0x1c')];}});}return _0x264c23;};exports['omit']=function(_0x1b7bc7,_0x2a836a){if(_[_0x625f('0x4')](_0x1b7bc7)){return _0x1b7bc7;}if(_['isArray'](_0x1b7bc7)){for(var _0x30d528=0x0;_0x30d528<_0x1b7bc7[_0x625f('0x1d')];_0x30d528+=0x1){_0x1b7bc7[_0x30d528]=this[_0x625f('0x1e')](_0x1b7bc7[_0x30d528],_0x2a836a);}return _0x1b7bc7;}if(!_[_0x625f('0x1f')](_0x1b7bc7)){return _0x1b7bc7;}if(_['isString'](_0x2a836a)){_0x2a836a=[_0x2a836a];}if(!_[_0x625f('0x12')](_0x2a836a)){return _0x1b7bc7;}for(var _0x48497f=0x0;_0x48497f<_0x2a836a['length'];_0x48497f+=0x1){_[_0x625f('0x20')](_0x1b7bc7,_0x2a836a[_0x48497f]);}for(var _0x37c91c in _0x1b7bc7){if(_0x1b7bc7[_0x625f('0x21')](_0x37c91c)){_0x1b7bc7[_0x37c91c]=this['omit'](_0x1b7bc7[_0x37c91c],_0x2a836a);}}return _0x1b7bc7;};exports['isNumeric']=function(_0x5b9c56){return _0x5b9c56[_0x625f('0x22')](RegExp(_0x625f('0x23')))?!![]:![];};exports[_0x625f('0x24')]=function(_0x48be38){return _0x48be38[_0x625f('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x318efb){var _0x553230=[];_0x318efb[_0x625f('0x2')](/[ ,]+/)[_0x625f('0x25')](function(_0x3edf92){_0x3edf92=_0x3edf92[_0x625f('0x26')](/([^:]")"+/g,'$1');_0x3edf92='+'+_0x3edf92+'*';if(_0x3edf92['includes']('@'))_0x3edf92='\x22'+_0x3edf92+'\x22';_0x553230[_0x625f('0x27')](_0x3edf92);});return _0x553230['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6ca3062..726a9a5 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95da=['/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','./environment','../mysqldb','get','env','set','appPath','join','root','public','development','test','json\x20replacer','toISOString','split','use','views'];(function(_0x3cf3b9,_0x5e326d){var _0x51cfc5=function(_0x35f3c6){while(--_0x35f3c6){_0x3cf3b9['push'](_0x3cf3b9['shift']());}};_0x51cfc5(++_0x5e326d);}(_0x95da,0x1f4));var _0xa95d=function(_0x48beb8,_0x43254a){_0x48beb8=_0x48beb8-0x0;var _0x378856=_0x95da[_0x48beb8];return _0x378856;};'use strict';var express=require(_0xa95d('0x0'));var favicon=require(_0xa95d('0x1'));var bodyParser=require(_0xa95d('0x2'));var methodOverride=require(_0xa95d('0x3'));var cookieParser=require(_0xa95d('0x4'));var errorHandler=require(_0xa95d('0x5'));var path=require(_0xa95d('0x6'));var passport=require(_0xa95d('0x7'));var cors=require(_0xa95d('0x8'));var moment=require('moment');var config=require(_0xa95d('0x9'));var db=require(_0xa95d('0xa'))['db'];exports['default']=function(_0xa5153d){var _0x187f12=_0xa5153d[_0xa95d('0xb')](_0xa95d('0xc'));if(_0x187f12==='production'){_0xa5153d[_0xa95d('0xd')](_0xa95d('0xe'),path[_0xa95d('0xf')](config[_0xa95d('0x10')],_0xa95d('0x11')));}if(_0x187f12===_0xa95d('0x12')||_0x187f12===_0xa95d('0x13')){_0xa5153d[_0xa95d('0xd')](_0xa95d('0xe'),path[_0xa95d('0xf')](config['root'],'client'));_0xa5153d['use'](errorHandler());}_0xa5153d[_0xa95d('0xd')](_0xa95d('0x14'),function(_0x2c7568,_0xcc9caa){if(this[_0x2c7568]instanceof Date){_0xcc9caa=this[_0x2c7568][_0xa95d('0x15')]()[_0xa95d('0x16')]('.')[0x0]+'Z';}return _0xcc9caa;});_0xa5153d[_0xa95d('0x17')](express['static'](_0xa5153d[_0xa95d('0xb')](_0xa95d('0xe'))));_0xa5153d[_0xa95d('0xd')](_0xa95d('0x18'),config[_0xa95d('0x10')]+_0xa95d('0x19'));_0xa5153d[_0xa95d('0x1a')](_0xa95d('0x1b'),require(_0xa95d('0x1c'))[_0xa95d('0x1d')]);_0xa5153d[_0xa95d('0xd')](_0xa95d('0x1e'),_0xa95d('0x1b'));_0xa5153d[_0xa95d('0x17')](bodyParser[_0xa95d('0x1f')]({'limit':_0xa95d('0x20'),'extended':!![]}));_0xa5153d[_0xa95d('0x17')](bodyParser[_0xa95d('0x21')]({'limit':'50mb'}));_0xa5153d[_0xa95d('0x17')](cors());_0xa5153d['use'](methodOverride());_0xa5153d[_0xa95d('0x17')](cookieParser());_0xa5153d['use'](passport[_0xa95d('0x22')]());}; \ No newline at end of file +var _0xc504=['html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','production','set','appPath','join','root','public','development','test','client','use','json\x20replacer','split','static','views','/server/views','engine'];(function(_0x55a43a,_0x2be520){var _0x4446c1=function(_0x3ecfd4){while(--_0x3ecfd4){_0x55a43a['push'](_0x55a43a['shift']());}};_0x4446c1(++_0x2be520);}(_0xc504,0x155));var _0x4c50=function(_0x4e0a13,_0x49ec9d){_0x4e0a13=_0x4e0a13-0x0;var _0x2e55ed=_0xc504[_0x4e0a13];return _0x2e55ed;};'use strict';var express=require(_0x4c50('0x0'));var favicon=require(_0x4c50('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x4c50('0x2'));var cookieParser=require(_0x4c50('0x3'));var errorHandler=require(_0x4c50('0x4'));var path=require(_0x4c50('0x5'));var passport=require(_0x4c50('0x6'));var cors=require(_0x4c50('0x7'));var moment=require(_0x4c50('0x8'));var config=require('./environment');var db=require(_0x4c50('0x9'))['db'];exports[_0x4c50('0xa')]=function(_0x4702b9){var _0x30dd4c=_0x4702b9[_0x4c50('0xb')](_0x4c50('0xc'));if(_0x30dd4c===_0x4c50('0xd')){_0x4702b9[_0x4c50('0xe')](_0x4c50('0xf'),path[_0x4c50('0x10')](config[_0x4c50('0x11')],_0x4c50('0x12')));}if(_0x30dd4c===_0x4c50('0x13')||_0x30dd4c===_0x4c50('0x14')){_0x4702b9[_0x4c50('0xe')](_0x4c50('0xf'),path['join'](config[_0x4c50('0x11')],_0x4c50('0x15')));_0x4702b9[_0x4c50('0x16')](errorHandler());}_0x4702b9['set'](_0x4c50('0x17'),function(_0xc2e1c5,_0x4cca46){if(this[_0xc2e1c5]instanceof Date){_0x4cca46=this[_0xc2e1c5]['toISOString']()[_0x4c50('0x18')]('.')[0x0]+'Z';}return _0x4cca46;});_0x4702b9[_0x4c50('0x16')](express[_0x4c50('0x19')](_0x4702b9[_0x4c50('0xb')]('appPath')));_0x4702b9['set'](_0x4c50('0x1a'),config[_0x4c50('0x11')]+_0x4c50('0x1b'));_0x4702b9[_0x4c50('0x1c')](_0x4c50('0x1d'),require(_0x4c50('0x1e'))[_0x4c50('0x1f')]);_0x4702b9[_0x4c50('0xe')](_0x4c50('0x20'),'html');_0x4702b9['use'](bodyParser[_0x4c50('0x21')]({'limit':'50mb','extended':!![]}));_0x4702b9[_0x4c50('0x16')](bodyParser[_0x4c50('0x22')]({'limit':_0x4c50('0x23')}));_0x4702b9['use'](cors());_0x4702b9[_0x4c50('0x16')](methodOverride());_0x4702b9[_0x4c50('0x16')](cookieParser());_0x4702b9[_0x4c50('0x16')](passport[_0x4c50('0x24')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 4598f76..3161efb 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 _0x1e88=['family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','md5','update','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','filter'];(function(_0x3efdd8,_0x3728e3){var _0x395759=function(_0x4adae5){while(--_0x4adae5){_0x3efdd8['push'](_0x3efdd8['shift']());}};_0x395759(++_0x3728e3);}(_0x1e88,0x1d3));var _0x81e8=function(_0x5d1de3,_0x28a876){_0x5d1de3=_0x5d1de3-0x0;var _0x3e528b=_0x1e88[_0x5d1de3];return _0x3e528b;};'use strict';var _=require(_0x81e8('0x0'));var os=require('os');var crypto=require(_0x81e8('0x1'));var machine=require(_0x81e8('0x2'));var exec=require(_0x81e8('0x3'))[_0x81e8('0x4')];var config=require('../environment');function getInterfaces(){var _0x5cbf5e=[];var _0x2e5ded=os[_0x81e8('0x5')]();var _0x423df2=_[_0x81e8('0x6')](_[_0x81e8('0x7')](_0x2e5ded));for(var _0xcbdfb7=0x0;_0xcbdfb7<_0x423df2['length'];_0xcbdfb7++){var _0xb3ed30=_0x2e5ded[_0x423df2[_0xcbdfb7]][_0x81e8('0x8')](function(_0x172cb2){return _0x172cb2[_0x81e8('0x9')]===_0x81e8('0xa')&&_0x172cb2[_0x81e8('0xb')]===![];});_0x5cbf5e=_0x5cbf5e[_0x81e8('0xc')](_0xb3ed30);}return _0x5cbf5e;}function getFirstInterface(){var _0x3db434=_[_0x81e8('0xd')](getInterfaces());return{'macAddress':_0x3db434&&_0x3db434[_0x81e8('0xe')]?_0x3db434['mac']:_0x81e8('0xf'),'ipAddress':_0x3db434&&_0x3db434[_0x81e8('0x10')]?_0x3db434['address']:_0x81e8('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x22f315=_[_0x81e8('0x6')](os[_0x81e8('0x12')]()[_0x81e8('0x13')](function(_0x3723de){return _0x3723de[_0x81e8('0x14')];}))['join'](':');return crypto[_0x81e8('0x15')](_0x81e8('0x16'))[_0x81e8('0x17')](_0x22f315)['digest'](_0x81e8('0x18'));}exports[_0x81e8('0x19')]=function(){var _0x2558b1=os[_0x81e8('0x1a')]();var _0x4812d5=/[0-9a-f-]{36}/;if(config[_0x81e8('0x1b')]&&_0x4812d5[_0x81e8('0x1c')](config['licenseToken'])){return config['licenseToken'];}else if(_0x2558b1==='win32'){return exec(_0x81e8('0x1d'),{'encoding':_0x81e8('0x1e')})[_0x81e8('0x1f')]('\x0d\x0a','');}else{var _0x5b9b37=getFirstInterface();var _0x17fe59=getCPUhash();var _0x378abf=_0x17fe59+'|'+os['hostname']()+'|'+_0x5b9b37['macAddress']+'|'+_0x5b9b37['ipAddress'];var _0x5dda05=crypto['createHash'](_0x81e8('0x16'))[_0x81e8('0x17')](_0x378abf)[_0x81e8('0x20')](_0x81e8('0x18'));return _0x5dda05[_0x81e8('0x21')](0x0,0x8)+'-'+_0x5dda05[_0x81e8('0x21')](0x8,0xc)+'-'+_0x5dda05[_0x81e8('0x21')](0xc,0x10)+'-'+_0x5dda05[_0x81e8('0x21')](0x10,0x14)+'-'+_0x5dda05['substring'](0x14);}}; \ No newline at end of file +var _0x5bb7=['127.0.0.1','getFirstInterface','map','model','join','createHash','md5','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x5bb7,0x1ee));var _0x75bb=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x5bb7[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x75bb('0x0'));var os=require('os');var crypto=require(_0x75bb('0x1'));var machine=require(_0x75bb('0x2'));var exec=require(_0x75bb('0x3'))[_0x75bb('0x4')];var config=require(_0x75bb('0x5'));function getInterfaces(){var _0x384031=[];var _0x32faba=os['networkInterfaces']();var _0xc37a01=_[_0x75bb('0x6')](_[_0x75bb('0x7')](_0x32faba));for(var _0x16d98f=0x0;_0x16d98f<_0xc37a01[_0x75bb('0x8')];_0x16d98f++){var _0x581208=_0x32faba[_0xc37a01[_0x16d98f]]['filter'](function(_0x4ce4af){return _0x4ce4af[_0x75bb('0x9')]==='IPv4'&&_0x4ce4af[_0x75bb('0xa')]===![];});_0x384031=_0x384031[_0x75bb('0xb')](_0x581208);}return _0x384031;}function getFirstInterface(){var _0x14ac96=_[_0x75bb('0xc')](getInterfaces());return{'macAddress':_0x14ac96&&_0x14ac96[_0x75bb('0xd')]?_0x14ac96['mac']:_0x75bb('0xe'),'ipAddress':_0x14ac96&&_0x14ac96[_0x75bb('0xf')]?_0x14ac96[_0x75bb('0xf')]:_0x75bb('0x10')};}exports[_0x75bb('0x11')]=getFirstInterface;function getCPUhash(){var _0x5a44aa=_['orderBy'](os['cpus']()[_0x75bb('0x12')](function(_0x4b3a64){return _0x4b3a64[_0x75bb('0x13')];}))[_0x75bb('0x14')](':');return crypto[_0x75bb('0x15')](_0x75bb('0x16'))['update'](_0x5a44aa)['digest'](_0x75bb('0x17'));}exports[_0x75bb('0x18')]=function(){var _0x334f0e=os[_0x75bb('0x19')]();var _0x3afbe3=/[0-9a-f-]{36}/;if(config[_0x75bb('0x1a')]&&_0x3afbe3['test'](config[_0x75bb('0x1a')])){return config[_0x75bb('0x1a')];}else if(_0x334f0e===_0x75bb('0x1b')){return exec(_0x75bb('0x1c'),{'encoding':'utf8'})[_0x75bb('0x1d')]('\x0d\x0a','');}else{var _0x6ea9f5=getFirstInterface();var _0x64c139=getCPUhash();var _0x531356=_0x64c139+'|'+os[_0x75bb('0x1e')]()+'|'+_0x6ea9f5['macAddress']+'|'+_0x6ea9f5[_0x75bb('0x1f')];var _0xbf3042=crypto['createHash'](_0x75bb('0x16'))[_0x75bb('0x20')](_0x531356)['digest'](_0x75bb('0x17'));return _0xbf3042[_0x75bb('0x21')](0x0,0x8)+'-'+_0xbf3042[_0x75bb('0x21')](0x8,0xc)+'-'+_0xbf3042['substring'](0xc,0x10)+'-'+_0xbf3042['substring'](0x10,0x14)+'-'+_0xbf3042[_0x75bb('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e4497e8..f6c464c 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 _0x545b=['message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x49a24c,_0x594a5e){var _0x190f1d=function(_0x2f8bc8){while(--_0x2f8bc8){_0x49a24c['push'](_0x49a24c['shift']());}};_0x190f1d(++_0x594a5e);}(_0x545b,0x16d));var _0xb545=function(_0x3b3fb2,_0x21a7a7){_0x3b3fb2=_0x3b3fb2-0x0;var _0x2c998a=_0x545b[_0x3b3fb2];return _0x2c998a;};'use strict';var util=require(_0xb545('0x0'));var moment=require('moment');var rp=require(_0xb545('0x1'));var BPromise=require(_0xb545('0x2'));var pkginfo=require('pkginfo')(module,_0xb545('0x3'));var db=require(_0xb545('0x4'))['db'];var encryptor=require(_0xb545('0x5'));var hardware=require(_0xb545('0x6'));var logger=require(_0xb545('0x7'))(_0xb545('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x223be5){return new BPromise(function(_0xa93bff,_0x1450c9){var _0x557fca=util['format'](_0xb545('0x9'),HOST,_0x223be5,module[_0xb545('0xa')][_0xb545('0x3')]);if(oldToken){_0x557fca=util[_0xb545('0xb')](_0xb545('0xc'),HOST,_0x223be5,module[_0xb545('0xa')]['version'],oldToken);}var _0x1f792f={'uri':_0x557fca,'method':_0xb545('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x1f792f)[_0xb545('0xe')](function(_0x36b2ef){_0xa93bff(_0x36b2ef);})[_0xb545('0xf')](function(_0xf254cc){_0x1450c9(_0xf254cc);});});}function manageLicense(_0x2ce202,_0xa2f339){var _0x21b29a=_0xa2f339[_0xb545('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x21b29a[_0xb545('0x11')]!==_0x2ce202&&!_0x21b29a[_0xb545('0x12')]){oldToken=_0x21b29a[_0xb545('0x11')];}httpRequest(_0x2ce202)[_0xb545('0xe')](function(_0x442d39){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x442d39[_0xb545('0x13')]){isOldTokenSent=![];if(!_0x21b29a[_0xb545('0x8')]&&_0x21b29a['license']!=_0x442d39['license']||_0x21b29a[_0xb545('0x8')]&&_0x21b29a[_0xb545('0x12')]){logger['info'](_0xb545('0x14'));}if(_0x21b29a[_0xb545('0x8')]&&!_0x21b29a[_0xb545('0x12')]&&_0x21b29a['license']!=_0x442d39[_0xb545('0x8')]){logger['info'](_0xb545('0x15'));}if(_0x21b29a[_0xb545('0x8')]&&!_0x21b29a[_0xb545('0x12')]&&_0x21b29a[_0xb545('0x8')]==_0x442d39[_0xb545('0x8')]){return _0xa2f339;}return _0xa2f339[_0xb545('0x16')]({'data1':_0x2ce202,'data2':null,'license':_0x442d39[_0xb545('0x8')]});}else{if(_0x442d39[_0xb545('0x8')]||_0x21b29a[_0xb545('0x8')]){if(!_0x21b29a[_0xb545('0x12')]){if(_0x21b29a[_0xb545('0x11')]==_0x2ce202){GRAY_PERIOD_REASON=_0xb545('0x17');logger['info'](_0xb545('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xb545('0x19')](_0xb545('0x1a'),_0x21b29a[_0xb545('0x11')],_0x2ce202);}logger[_0xb545('0x19')](_0xb545('0x1b'),GRAY_PERIOD_REASON[_0xb545('0x1c')](),moment()['format'](_0xb545('0x1d')));return _0xa2f339[_0xb545('0x16')]({'data2':encryptor['encryptString'](moment()[_0xb545('0xb')](_0xb545('0x1d')))});}else{if(moment()[_0xb545('0x1e')](encryptor[_0xb545('0x1f')](_0x21b29a[_0xb545('0x12')]),_0xb545('0x20'))>DAYS){logger['info'](_0xb545('0x21'),moment()[_0xb545('0xb')](_0xb545('0x1d')));isOldTokenSent=![];return _0xa2f339[_0xb545('0x16')]({'data1':_0x2ce202,'data2':null,'license':null});}}}else{if(_0x21b29a[_0xb545('0x11')]!=_0x2ce202){logger[_0xb545('0x19')](_0xb545('0x1a'),_0x21b29a[_0xb545('0x11')],_0x2ce202);return _0xa2f339['update']({'data1':_0x2ce202,'data2':null,'license':null});}}}return _0xa2f339;})[_0xb545('0xe')](function(_0x5513b8){_0xa2f339=_0x5513b8;})[_0xb545('0xf')](function(_0x5936df){logger[_0xb545('0x22')](_0x5936df[_0xb545('0x23')]);})[_0xb545('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xb545('0x25')](),_0xa2f339);},TIME);});}function defaultLicense(){var _0x188343=hardware[_0xb545('0x25')]();if(_0x188343){return db['License'][_0xb545('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x188343}})['spread'](function(_0x234ff6,_0x4f8873){logger['info'](_0xb545('0x27'),_0x188343);manageLicense(_0x188343,_0x234ff6);})['catch'](function(_0x1b7cfd){logger[_0xb545('0x22')](_0x1b7cfd[_0xb545('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x2e5b=['finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','encryptString','days','error','message'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0x2e5b,0xc4));var _0xb2e5=function(_0x492b19,_0x1167b7){_0x492b19=_0x492b19-0x0;var _0x40ac75=_0x2e5b[_0x492b19];return _0x40ac75;};'use strict';var util=require(_0xb2e5('0x0'));var moment=require(_0xb2e5('0x1'));var rp=require(_0xb2e5('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xb2e5('0x3'))(module,_0xb2e5('0x4'));var db=require(_0xb2e5('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb2e5('0x6'));var logger=require(_0xb2e5('0x7'))(_0xb2e5('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x27285e){return new BPromise(function(_0x2e3b2b,_0x539d17){var _0x545a13=util['format'](_0xb2e5('0x9'),HOST,_0x27285e,module[_0xb2e5('0xa')][_0xb2e5('0x4')]);if(oldToken){_0x545a13=util['format'](_0xb2e5('0xb'),HOST,_0x27285e,module[_0xb2e5('0xa')]['version'],oldToken);}var _0x397c16={'uri':_0x545a13,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x397c16)[_0xb2e5('0xc')](function(_0x507b43){_0x2e3b2b(_0x507b43);})[_0xb2e5('0xd')](function(_0x2d0590){_0x539d17(_0x2d0590);});});}function manageLicense(_0x32dd3b,_0x2a74ae){var _0x5c931e=_0x2a74ae[_0xb2e5('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x5c931e['data1']!==_0x32dd3b&&!_0x5c931e[_0xb2e5('0xf')]){oldToken=_0x5c931e[_0xb2e5('0x10')];}httpRequest(_0x32dd3b)[_0xb2e5('0xc')](function(_0x5b6528){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5b6528[_0xb2e5('0x11')]){isOldTokenSent=![];if(!_0x5c931e[_0xb2e5('0x8')]&&_0x5c931e[_0xb2e5('0x8')]!=_0x5b6528[_0xb2e5('0x8')]||_0x5c931e[_0xb2e5('0x8')]&&_0x5c931e[_0xb2e5('0xf')]){logger[_0xb2e5('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5c931e['license']&&!_0x5c931e[_0xb2e5('0xf')]&&_0x5c931e[_0xb2e5('0x8')]!=_0x5b6528[_0xb2e5('0x8')]){logger[_0xb2e5('0x12')](_0xb2e5('0x13'));}if(_0x5c931e[_0xb2e5('0x8')]&&!_0x5c931e[_0xb2e5('0xf')]&&_0x5c931e[_0xb2e5('0x8')]==_0x5b6528[_0xb2e5('0x8')]){return _0x2a74ae;}return _0x2a74ae[_0xb2e5('0x14')]({'data1':_0x32dd3b,'data2':null,'license':_0x5b6528[_0xb2e5('0x8')]});}else{if(_0x5b6528['license']||_0x5c931e[_0xb2e5('0x8')]){if(!_0x5c931e[_0xb2e5('0xf')]){if(_0x5c931e[_0xb2e5('0x10')]==_0x32dd3b){GRAY_PERIOD_REASON=_0xb2e5('0x15');logger['info'](_0xb2e5('0x16'));}else{GRAY_PERIOD_REASON=_0xb2e5('0x17');logger[_0xb2e5('0x12')](_0xb2e5('0x18'),_0x5c931e[_0xb2e5('0x10')],_0x32dd3b);}logger[_0xb2e5('0x12')](_0xb2e5('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xb2e5('0x1a')](_0xb2e5('0x1b')));return _0x2a74ae[_0xb2e5('0x14')]({'data2':encryptor[_0xb2e5('0x1c')](moment()[_0xb2e5('0x1a')](_0xb2e5('0x1b')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x5c931e[_0xb2e5('0xf')]),_0xb2e5('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xb2e5('0x1a')](_0xb2e5('0x1b')));isOldTokenSent=![];return _0x2a74ae['update']({'data1':_0x32dd3b,'data2':null,'license':null});}}}else{if(_0x5c931e[_0xb2e5('0x10')]!=_0x32dd3b){logger[_0xb2e5('0x12')](_0xb2e5('0x18'),_0x5c931e[_0xb2e5('0x10')],_0x32dd3b);return _0x2a74ae['update']({'data1':_0x32dd3b,'data2':null,'license':null});}}}return _0x2a74ae;})[_0xb2e5('0xc')](function(_0x115162){_0x2a74ae=_0x115162;})['catch'](function(_0x373d02){logger[_0xb2e5('0x1e')](_0x373d02[_0xb2e5('0x1f')]);})[_0xb2e5('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xb2e5('0x21')](),_0x2a74ae);},TIME);});}function defaultLicense(){var _0x3025f7=hardware[_0xb2e5('0x21')]();if(_0x3025f7){return db[_0xb2e5('0x22')][_0xb2e5('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3025f7}})['spread'](function(_0x2c4d37,_0x778845){logger[_0xb2e5('0x12')](_0xb2e5('0x24'),_0x3025f7);manageLicense(_0x3025f7,_0x2c4d37);})[_0xb2e5('0xd')](function(_0x500f03){logger[_0xb2e5('0x1e')](_0x500f03['message']);});}}exports[_0xb2e5('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9c92a1f..39c60f6 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 _0xe503=['users','telephones','count','pick','countBy','telephone','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','defaults','then','catch','uuid','data1','license','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','days','grayReason','machineUuid','changed','findAll','role','sequelize','COUNT','col','admin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe503,0x11e));var _0x3e50=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe503[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0x3e50('0x0'));var _=require(_0x3e50('0x1'));var moment=require(_0x3e50('0x2'));var BPromise=require(_0x3e50('0x3'));var hardware=require(_0x3e50('0x4'));var encryptor=require(_0x3e50('0x5'));var db=require(_0x3e50('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3e50('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3e50('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3e50('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3e50('0x9'),'machineUuid':hardware[_0x3e50('0xa')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x27f9a3){return new BPromise(function(_0xde8882,_0x13c318){return db['License'][_0x3e50('0xb')](_[_0x3e50('0xc')](_0x27f9a3,{'raw':!![],'where':{'id':0x1}}))[_0x3e50('0xd')](function(_0x49ae56){return checkLicense(_0x49ae56,null);})[_0x3e50('0xd')](function(_0x6ce175){_0xde8882(_0x6ce175);return;})[_0x3e50('0xe')](function(_0x4b0f03){_0x13c318(_0x4b0f03);});});}function checkLicense(_0x3cbc14,_0x282de9){if(!_0x3cbc14){demoLicense[_0x3e50('0xf')]=_0x3cbc14[_0x3e50('0x10')];return demoLicense;}try{var _0x3088a5=_0x282de9||_0x3cbc14[_0x3e50('0x11')];if(_['isEmpty'](_0x3088a5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x55e838=_0x3cbc14[_0x3e50('0x10')];var _0x6cbcb1=_0x3cbc14[_0x3e50('0x12')];var _0xbcdc85=_0x55e838[_0x3e50('0x13')]('-')[0x4];var _0x4ec2f8=_0x55e838[_0x3e50('0x13')]('-')[0x0];var _0x143616=encryptor[_0x3e50('0x14')](_0x3088a5,util[_0x3e50('0x15')](_0x3e50('0x16'),_0xbcdc85,_0x55e838,_0x4ec2f8));var _0xc7f79b=JSON[_0x3e50('0x17')](_0x143616);_0xc7f79b[_0x3e50('0x18')]=![];_0xc7f79b[_0x3e50('0xf')]=_0x55e838;_0xc7f79b['machineUuid']=hardware['getUuid']();if(_0x6cbcb1){var _0x558b94=encryptor['decryptString'](_0x6cbcb1);_0xc7f79b[_0x3e50('0x19')]=_0x558b94;_0xc7f79b['deadline']=moment(_0x558b94)['add'](0x7,_0x3e50('0x1a'))[_0x3e50('0x15')]();_0xc7f79b[_0x3e50('0x1b')]=_0xc7f79b[_0x3e50('0xf')]!=_0xc7f79b[_0x3e50('0x1c')]?_0x3e50('0x1d'):'disabled';}return _0xc7f79b;}catch(_0x4d4ef8){breakingLicense[_0x3e50('0xf')]=_0x3cbc14[_0x3e50('0x10')];breakingLicense['message']=_0x4d4ef8['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d49bd,_0xfdb81c){getLicense()[_0x3e50('0xd')](function(_0x41ccb2){return db['User'][_0x3e50('0x1e')]({'attributes':[_0x3e50('0x1f'),[db[_0x3e50('0x20')]['fn'](_0x3e50('0x21'),db['sequelize'][_0x3e50('0x22')](_0x3e50('0x1f'))),'count']],'group':_0x3e50('0x1f'),'where':{'role':{'$or':[_0x3e50('0x23'),'user','telephone']}},'raw':!![]})[_0x3e50('0xd')](function(_0x54f95d){var _0x59cbd6={'user':_0x41ccb2[_0x3e50('0x24')]||0x0,'telephone':_0x41ccb2[_0x3e50('0x25')]||0x0};_0x54f95d['forEach'](function(_0x55e4a7){var _0x4b0725=_0x55e4a7[_0x3e50('0x1f')]==='admin'?'user':_0x55e4a7[_0x3e50('0x1f')];_0x59cbd6[_0x4b0725]-=_0x55e4a7[_0x3e50('0x26')];if(_0x59cbd6[_0x4b0725]<0x0)_0x59cbd6[_0x4b0725]=0x0;});_0x3d49bd(_0x59cbd6);return;});})['catch'](function(_0x7cc016){_0xfdb81c(_0x7cc016);});});}function checkUserLimits(_0x361669){return new BPromise(function(_0x29c450,_0x1f3880){getLimits()[_0x3e50('0xd')](function(_0x3d8f90){var _0x5ad706=_[_0x3e50('0x27')](_[_0x3e50('0x28')](_0x361669,_0x3e50('0x1f')),[_0x3e50('0x23'),'user',_0x3e50('0x29')]);var _0x34e87b=(_0x5ad706[_0x3e50('0x23')]||0x0)+(_0x5ad706['user']||0x0);var _0x337af4=_0x5ad706[_0x3e50('0x29')]||0x0;if(_0x34e87b>_0x3d8f90[_0x3e50('0x2a')])return _0x1f3880(_0x3e50('0x2b'));if(_0x337af4>_0x3d8f90[_0x3e50('0x29')])return _0x1f3880(_0x3e50('0x2c'));return _0x29c450();})[_0x3e50('0xe')](function(_0x3a80b3){_0x1f3880(_0x3a80b3);});});}module[_0x3e50('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1a8a=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','uuid','License\x20key\x20value\x20not\x20found','data1','data2','split','format','parse','demo','machineUuid','decryptString','gray','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb'];(function(_0x523a67,_0x11ea07){var _0x3e5b9d=function(_0x4e3fd0){while(--_0x4e3fd0){_0x523a67['push'](_0x523a67['shift']());}};_0x3e5b9d(++_0x11ea07);}(_0x1a8a,0x1f2));var _0xa1a8=function(_0x50a732,_0x1eab82){_0x50a732=_0x50a732-0x0;var _0x2047a1=_0x1a8a[_0x50a732];return _0x2047a1;};'use strict';var util=require(_0xa1a8('0x0'));var _=require(_0xa1a8('0x1'));var moment=require(_0xa1a8('0x2'));var BPromise=require(_0xa1a8('0x3'));var hardware=require('./hardware');var encryptor=require(_0xa1a8('0x4'));var db=require(_0xa1a8('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa1a8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa1a8('0x7'),'machineUuid':hardware[_0xa1a8('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa1a8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa1a8('0x9'),'machineUuid':hardware[_0xa1a8('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5eabf2){return new BPromise(function(_0x38d5c7,_0x35f021){return db[_0xa1a8('0xa')]['find'](_['defaults'](_0x5eabf2,{'raw':!![],'where':{'id':0x1}}))[_0xa1a8('0xb')](function(_0x44835a){return checkLicense(_0x44835a,null);})[_0xa1a8('0xb')](function(_0x2ed6b7){_0x38d5c7(_0x2ed6b7);return;})[_0xa1a8('0xc')](function(_0x32af79){_0x35f021(_0x32af79);});});}function checkLicense(_0x2a7748,_0x3951e8){if(!_0x2a7748){demoLicense[_0xa1a8('0xd')]=_0x2a7748['data1'];return demoLicense;}try{var _0x36cf4d=_0x3951e8||_0x2a7748['license'];if(_['isEmpty'](_0x36cf4d)){throw new Error(_0xa1a8('0xe'));}var _0x7389ff=_0x2a7748[_0xa1a8('0xf')];var _0x4e699c=_0x2a7748[_0xa1a8('0x10')];var _0x43fb4e=_0x7389ff[_0xa1a8('0x11')]('-')[0x4];var _0x30d75e=_0x7389ff[_0xa1a8('0x11')]('-')[0x0];var _0x2ef4ef=encryptor['decryptString'](_0x36cf4d,util[_0xa1a8('0x12')]('%s:%s:%s',_0x43fb4e,_0x7389ff,_0x30d75e));var _0x5c55c1=JSON[_0xa1a8('0x13')](_0x2ef4ef);_0x5c55c1[_0xa1a8('0x14')]=![];_0x5c55c1[_0xa1a8('0xd')]=_0x7389ff;_0x5c55c1[_0xa1a8('0x15')]=hardware['getUuid']();if(_0x4e699c){var _0x57fffc=encryptor[_0xa1a8('0x16')](_0x4e699c);_0x5c55c1[_0xa1a8('0x17')]=_0x57fffc;_0x5c55c1['deadline']=moment(_0x57fffc)['add'](0x7,_0xa1a8('0x18'))[_0xa1a8('0x12')]();_0x5c55c1[_0xa1a8('0x19')]=_0x5c55c1[_0xa1a8('0xd')]!=_0x5c55c1[_0xa1a8('0x15')]?_0xa1a8('0x1a'):_0xa1a8('0x1b');}return _0x5c55c1;}catch(_0x324f89){breakingLicense[_0xa1a8('0xd')]=_0x2a7748[_0xa1a8('0xf')];breakingLicense[_0xa1a8('0x1c')]=_0x324f89['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x533318,_0x17489f){getLicense()[_0xa1a8('0xb')](function(_0x3210d6){return db[_0xa1a8('0x1d')][_0xa1a8('0x1e')]({'attributes':[_0xa1a8('0x1f'),[db[_0xa1a8('0x20')]['fn'](_0xa1a8('0x21'),db[_0xa1a8('0x20')][_0xa1a8('0x22')](_0xa1a8('0x1f'))),_0xa1a8('0x23')]],'group':'role','where':{'role':{'$or':[_0xa1a8('0x24'),_0xa1a8('0x25'),_0xa1a8('0x26')]}},'raw':!![]})[_0xa1a8('0xb')](function(_0x4cf3a5){var _0x3cb7b2={'user':_0x3210d6['users']||0x0,'telephone':_0x3210d6['telephones']||0x0};_0x4cf3a5['forEach'](function(_0x4837c4){var _0x49fd17=_0x4837c4['role']===_0xa1a8('0x24')?_0xa1a8('0x25'):_0x4837c4['role'];_0x3cb7b2[_0x49fd17]-=_0x4837c4[_0xa1a8('0x23')];if(_0x3cb7b2[_0x49fd17]<0x0)_0x3cb7b2[_0x49fd17]=0x0;});_0x533318(_0x3cb7b2);return;});})[_0xa1a8('0xc')](function(_0x156e5a){_0x17489f(_0x156e5a);});});}function checkUserLimits(_0x3e55c9){return new BPromise(function(_0x1036af,_0x279462){getLimits()['then'](function(_0x41b669){var _0x1768c0=_[_0xa1a8('0x27')](_['countBy'](_0x3e55c9,'role'),[_0xa1a8('0x24'),'user',_0xa1a8('0x26')]);var _0x385044=(_0x1768c0[_0xa1a8('0x24')]||0x0)+(_0x1768c0[_0xa1a8('0x25')]||0x0);var _0x14767a=_0x1768c0['telephone']||0x0;if(_0x385044>_0x41b669['user'])return _0x279462(_0xa1a8('0x28'));if(_0x14767a>_0x41b669[_0xa1a8('0x26')])return _0x279462(_0xa1a8('0x29'));return _0x1036af();})['catch'](function(_0x16602a){_0x279462(_0x16602a);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9758c68..58c999c 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 _0xfed7=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfed7,0x190));var _0x7fed=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xfed7[_0x1a0ef3];return _0x2b86da;};'use strict';module[_0x7fed('0x0')]={'DOMAIN':_0x7fed('0x1'),'SESSION_SECRET':_0x7fed('0x2'),'GOOGLE_ID':_0x7fed('0x3'),'GOOGLE_SECRET':_0x7fed('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x80bd=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x44669d,_0x528fe1){var _0x5ac197=function(_0x8c9d06){while(--_0x8c9d06){_0x44669d['push'](_0x44669d['shift']());}};_0x5ac197(++_0x528fe1);}(_0x80bd,0x16a));var _0xd80b=function(_0x1f76a3,_0x5ef163){_0x1f76a3=_0x1f76a3-0x0;var _0x4ac340=_0x80bd[_0x1f76a3];return _0x4ac340;};'use strict';module[_0xd80b('0x0')]={'DOMAIN':_0xd80b('0x1'),'SESSION_SECRET':_0xd80b('0x2'),'GOOGLE_ID':_0xd80b('0x3'),'GOOGLE_SECRET':_0xd80b('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cd0d1a4..891cadb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2651=['xcally','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','INFO','/var','log'];(function(_0x4917a0,_0x5eb9e3){var _0x154534=function(_0x27c17f){while(--_0x27c17f){_0x4917a0['push'](_0x4917a0['shift']());}};_0x154534(++_0x5eb9e3);}(_0x2651,0xf5));var _0x1265=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x2651[_0x13b8f3];return _0x1a6d06;};'use strict';var moment=require(_0x1265('0x0'));var winston=require('winston');var util=require(_0x1265('0x1'));var path=require('path');var debugLevel=_0x1265('0x2');function filename(_0x4ea8a4,_0xef90ee){return path['join'](_0x1265('0x3'),_0x1265('0x4'),_0x1265('0x5'),util['format'](_0x1265('0x6'),_0x4ea8a4,_0xef90ee));}function formatter(_0x359f28,_0x4738a0){_0x4738a0[_0x1265('0x7')]=_0x4738a0[_0x1265('0x7')][_0x1265('0x8')](/@@{/g,_0x1265('0x9'))[_0x1265('0x8')](/}@@/g,_0x1265('0xa'))[_0x1265('0x8')](/@{/g,'{{')[_0x1265('0x8')](/}@/g,'}}');return util[_0x1265('0xb')](_0x1265('0xc'),moment()[_0x1265('0xb')](_0x1265('0xd')),_0x4738a0[_0x1265('0xe')][_0x1265('0xf')](),_0x359f28,_0x4738a0[_0x1265('0x7')]);}module['exports']=function(_0xfb665){return new winston[(_0x1265('0x10'))]({'transports':[new winston[(_0x1265('0x11'))][(_0x1265('0x12'))]({'name':util[_0x1265('0xb')](_0x1265('0x13'),_0xfb665,_0x1265('0x14')),'filename':filename(_0xfb665,_0x1265('0x14')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49b812){return formatter(_0xfb665,_0x49b812);}}),new winston['transports'][(_0x1265('0x12'))]({'name':util[_0x1265('0xb')](_0x1265('0x13'),_0xfb665,_0x1265('0x15')),'filename':filename(_0xfb665,'info'),'level':_0x1265('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1bd21f){return formatter(_0xfb665,_0x1bd21f);}}),new winston[(_0x1265('0x11'))][(_0x1265('0x16'))]({'level':process[_0x1265('0x17')][_0x1265('0x18')]||debugLevel,'json':![],'formatter':function(_0x154b6c){return formatter(_0xfb665,_0x154b6c);}})]});}; \ No newline at end of file +var _0x7025=['Logger','File','error','%s-%s','transports','Console','env','debugLevel','moment','util','INFO','join','log','xcally','format','%s-%s.log','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports'];(function(_0x3db68f,_0x14d5ed){var _0x5caa5f=function(_0xcf3231){while(--_0xcf3231){_0x3db68f['push'](_0x3db68f['shift']());}};_0x5caa5f(++_0x14d5ed);}(_0x7025,0x1e8));var _0x5702=function(_0x36e968,_0x4002eb){_0x36e968=_0x36e968-0x0;var _0x47cdec=_0x7025[_0x36e968];return _0x47cdec;};'use strict';var moment=require(_0x5702('0x0'));var winston=require('winston');var util=require(_0x5702('0x1'));var path=require('path');var debugLevel=_0x5702('0x2');function filename(_0x6f152e,_0x1238b8){return path[_0x5702('0x3')]('/var',_0x5702('0x4'),_0x5702('0x5'),util[_0x5702('0x6')](_0x5702('0x7'),_0x6f152e,_0x1238b8));}function formatter(_0x1d04d2,_0x400afe){_0x400afe['message']=_0x400afe['message'][_0x5702('0x8')](/@@{/g,_0x5702('0x9'))[_0x5702('0x8')](/}@@/g,'}}}')[_0x5702('0x8')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x5702('0x6')](_0x5702('0xa'),moment()[_0x5702('0x6')](_0x5702('0xb')),_0x400afe[_0x5702('0xc')][_0x5702('0xd')](),_0x1d04d2,_0x400afe[_0x5702('0xe')]);}module[_0x5702('0xf')]=function(_0x4c73d4){return new winston[(_0x5702('0x10'))]({'transports':[new winston['transports'][(_0x5702('0x11'))]({'name':util[_0x5702('0x6')]('%s-%s',_0x4c73d4,_0x5702('0x12')),'filename':filename(_0x4c73d4,'error'),'level':_0x5702('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x204920){return formatter(_0x4c73d4,_0x204920);}}),new winston['transports'][(_0x5702('0x11'))]({'name':util['format'](_0x5702('0x13'),_0x4c73d4,'info'),'filename':filename(_0x4c73d4,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc399ef){return formatter(_0x4c73d4,_0xc399ef);}}),new winston[(_0x5702('0x14'))][(_0x5702('0x15'))]({'level':process[_0x5702('0x16')][_0x5702('0x17')]||debugLevel,'json':![],'formatter':function(_0x2733ee){return formatter(_0x4c73d4,_0x2733ee);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5c484da..434ee0e 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 _0x3731=['../../services/routing/index.js','../../services/xdr/index.js','path','join','agi','../../services/agi/index.js','email','routing'];(function(_0x9e6ba,_0x225452){var _0x3beadd=function(_0x216c2f){while(--_0x216c2f){_0x9e6ba['push'](_0x9e6ba['shift']());}};_0x3beadd(++_0x225452);}(_0x3731,0xba));var _0x1373=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3731[_0x3bf83f];return _0x22c4a9;};'use strict';var path=require(_0x1373('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x1373('0x1')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x1373('0x2'),'script':path[_0x1373('0x1')](__dirname,_0x1373('0x3'))},{'name':_0x1373('0x4'),'script':path[_0x1373('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x1373('0x5'),'script':path[_0x1373('0x1')](__dirname,_0x1373('0x6'))},{'name':'xdr','script':path['join'](__dirname,_0x1373('0x7'))}]};module['exports']=config; \ No newline at end of file +var _0xe614=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x34404c,_0x49b8d1){var _0x46d1f2=function(_0x2cb37b){while(--_0x2cb37b){_0x34404c['push'](_0x34404c['shift']());}};_0x46d1f2(++_0x49b8d1);}(_0xe614,0x1be));var _0x4e61=function(_0x14bb94,_0x896ad5){_0x14bb94=_0x14bb94-0x0;var _0x5eac82=_0xe614[_0x14bb94];return _0x5eac82;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x4e61('0x0'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0x2'))},{'name':_0x4e61('0x3'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0x4'))},{'name':_0x4e61('0x5'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0x6'))},{'name':_0x4e61('0x7'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0x8'))},{'name':_0x4e61('0x9'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0xa'))},{'name':_0x4e61('0xb'),'script':path[_0x4e61('0x1')](__dirname,_0x4e61('0xc'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2fcd3b0..8902919 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 _0x0560=['then','list','describe','delete','dump','saved','pm2','./config','start','disconnect','stop'];(function(_0x5b6eb4,_0x3f6fdb){var _0x41083b=function(_0x235e4e){while(--_0x235e4e){_0x5b6eb4['push'](_0x5b6eb4['shift']());}};_0x41083b(++_0x3f6fdb);}(_0x0560,0x95));var _0x0056=function(_0x45f9de,_0x24e7da){_0x45f9de=_0x45f9de-0x0;var _0x167058=_0x0560[_0x45f9de];return _0x167058;};'use strict';var pm2=require(_0x0056('0x0'));var BPromise=require('bluebird');var config=require(_0x0056('0x1'));function connect(){return new BPromise(function(_0x1aaf42,_0x5cbeb1){return pm2['connect'](function(_0x55bca8){if(_0x55bca8){return _0x5cbeb1(_0x55bca8);}return _0x1aaf42('connected');});});};exports[_0x0056('0x2')]=function(_0x59d979){return connect()['then'](function(){return new BPromise(function(_0x362bfb,_0x343739){return pm2[_0x0056('0x2')](_0x59d979,function(_0x59ae13,_0xfb0b6c){if(_0x59ae13){return _0x343739(_0x59ae13);}pm2[_0x0056('0x3')]();return _0x362bfb(_0xfb0b6c);});});});};exports[_0x0056('0x4')]=function(_0xd1dce){return connect()['then'](function(){return new BPromise(function(_0x2720e0,_0x3196ce){return pm2[_0x0056('0x4')](_0xd1dce,function(_0x40b2c0,_0x197d05){if(_0x40b2c0){return _0x3196ce(_0x40b2c0);}pm2[_0x0056('0x3')]();return _0x2720e0(_0x197d05);});});});};exports['restart']=function(_0x18b1ce){return connect()[_0x0056('0x5')](function(){return new BPromise(function(_0x2b9044,_0x1cac11){return pm2['restart'](_0x18b1ce,function(_0x1324e5,_0x4a4c4e){if(_0x1324e5){return _0x1cac11(_0x1324e5);}pm2[_0x0056('0x3')]();return _0x2b9044(_0x4a4c4e);});});});};exports[_0x0056('0x6')]=function(){return connect()[_0x0056('0x5')](function(){return new BPromise(function(_0x1b20b3,_0x1fa3cc){return pm2[_0x0056('0x6')](function(_0x5a6c6a,_0x530aa9){if(_0x5a6c6a){return _0x1fa3cc(_0x5a6c6a);}pm2['disconnect']();return _0x1b20b3(_0x530aa9);});});});};exports[_0x0056('0x7')]=function(_0x2d3421){return connect()[_0x0056('0x5')](function(){return new BPromise(function(_0x15dc77,_0x3317b8){return pm2[_0x0056('0x7')](_0x2d3421,function(_0x133c91,_0x16176d){if(_0x133c91){return _0x3317b8(_0x133c91);}pm2['disconnect']();return _0x15dc77(_0x16176d);});});});};exports[_0x0056('0x8')]=function(_0x7ff1a5){return connect()[_0x0056('0x5')](function(){return new BPromise(function(_0x194162,_0x210c49){return pm2[_0x0056('0x8')](_0x7ff1a5,function(_0x2959c4,_0xa04509){if(_0x2959c4){return _0x210c49(_0x2959c4);}pm2[_0x0056('0x3')]();return _0x194162(_0xa04509);});});});};exports[_0x0056('0x9')]=function(){return connect()[_0x0056('0x5')](function(){return new BPromise(function(_0x6b0270,_0x15e312){return pm2['dump'](function(_0x170961){if(_0x170961){return _0x15e312(_0x170961);}return _0x6b0270(_0x0056('0xa'));});});});}; \ No newline at end of file +var _0x9c48=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','then','start','disconnect'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9c48,0xa1));var _0x89c4=function(_0x2e3b3f,_0x5ce6b9){_0x2e3b3f=_0x2e3b3f-0x0;var _0x3ac0cb=_0x9c48[_0x2e3b3f];return _0x3ac0cb;};'use strict';var pm2=require(_0x89c4('0x0'));var BPromise=require(_0x89c4('0x1'));var config=require(_0x89c4('0x2'));function connect(){return new BPromise(function(_0x52d222,_0x1f19e7){return pm2[_0x89c4('0x3')](function(_0xa13da){if(_0xa13da){return _0x1f19e7(_0xa13da);}return _0x52d222('connected');});});};exports['start']=function(_0x3da4d5){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x4900e9,_0x8ada63){return pm2[_0x89c4('0x5')](_0x3da4d5,function(_0x1d0303,_0x213a86){if(_0x1d0303){return _0x8ada63(_0x1d0303);}pm2[_0x89c4('0x6')]();return _0x4900e9(_0x213a86);});});});};exports[_0x89c4('0x7')]=function(_0x26ab92){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x38c0d5,_0xad4f2c){return pm2[_0x89c4('0x7')](_0x26ab92,function(_0x417d40,_0x2e8dc4){if(_0x417d40){return _0xad4f2c(_0x417d40);}pm2[_0x89c4('0x6')]();return _0x38c0d5(_0x2e8dc4);});});});};exports[_0x89c4('0x8')]=function(_0x1f0f09){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x3b8322,_0x20611b){return pm2[_0x89c4('0x8')](_0x1f0f09,function(_0x5b98e4,_0x59516a){if(_0x5b98e4){return _0x20611b(_0x5b98e4);}pm2['disconnect']();return _0x3b8322(_0x59516a);});});});};exports[_0x89c4('0x9')]=function(){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x256a60,_0x259fcf){return pm2[_0x89c4('0x9')](function(_0x18d0bf,_0x84b446){if(_0x18d0bf){return _0x259fcf(_0x18d0bf);}pm2['disconnect']();return _0x256a60(_0x84b446);});});});};exports[_0x89c4('0xa')]=function(_0x2bd1d8){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x4207a5,_0x5cd765){return pm2[_0x89c4('0xa')](_0x2bd1d8,function(_0x2c9a85,_0xae1ed7){if(_0x2c9a85){return _0x5cd765(_0x2c9a85);}pm2['disconnect']();return _0x4207a5(_0xae1ed7);});});});};exports[_0x89c4('0xb')]=function(_0x4ddd24){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x477a19,_0x574f49){return pm2[_0x89c4('0xb')](_0x4ddd24,function(_0x4ca31e,_0x4a45c1){if(_0x4ca31e){return _0x574f49(_0x4ca31e);}pm2[_0x89c4('0x6')]();return _0x477a19(_0x4a45c1);});});});};exports[_0x89c4('0xc')]=function(){return connect()[_0x89c4('0x4')](function(){return new BPromise(function(_0x4accf6,_0x1303ca){return pm2['dump'](function(_0x38e347){if(_0x38e347){return _0x1303ca(_0x38e347);}return _0x4accf6(_0x89c4('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 930f96b..aef9064 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 _0x9df1=['join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x414476,_0x2bd3ec){var _0xd02ba4=function(_0x383df9){while(--_0x383df9){_0x414476['push'](_0x414476['shift']());}};_0xd02ba4(++_0x2bd3ec);}(_0x9df1,0x64));var _0x19df=function(_0x41b567,_0x53475b){_0x41b567=_0x41b567-0x0;var _0x1ac9b7=_0x9df1[_0x41b567];return _0x1ac9b7;};'use strict';var _=require(_0x19df('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x19df('0x1'));var db=require(_0x19df('0x2'))['db'];var logger=require(_0x19df('0x3'))(_0x19df('0x4'));config[_0x19df('0x5')]=_[_0x19df('0x6')](config[_0x19df('0x5')],{'host':_0x19df('0x7'),'port':0x18eb});var io=require(_0x19df('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x2ef46a=0x0;var _0x30bc35=[];return db[_0x19df('0x9')][_0x19df('0xa')]({'raw':!![],'attributes':['id',_0x19df('0xb')],'where':{'id':0x1}})[_0x19df('0xc')](function(_0x35f5f2){_0x2ef46a=_0x35f5f2[_0x19df('0xb')];if(_0x2ef46a){return db[_0x19df('0xd')][_0x19df('0xe')]({'raw':!![],'attributes':['id',_0x19df('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x19df('0x10')](_0x35f5f2[_0x19df('0xb')],'minutes')}}});}else{return[];}})['then'](function(_0x818872){if(_0x818872&&_0x818872[_0x19df('0x11')]){_0x30bc35=_['map'](_0x818872||[],'id');logger[_0x19df('0x12')](_0x19df('0x13'),_0x30bc35[_0x19df('0x14')]());return db[_0x19df('0xd')][_0x19df('0x15')]({'closeReason':_0x19df('0x16'),'disposition':_0x19df('0x17'),'closed':!![],'closedAt':moment()['format'](_0x19df('0x18'))},{'where':{'id':_0x30bc35}});}})['then'](function(){if(_0x30bc35&&_0x30bc35['length']){logger[_0x19df('0x12')](_0x19df('0x19'),_0x30bc35[_0x19df('0x14')]());for(var _0x411fd8=0x0;_0x411fd8<_0x30bc35[_0x19df('0x11')];_0x411fd8++){io['emit'](_0x19df('0x1a'),{'id':_0x30bc35[_0x411fd8],'closed':!![]});}}})[_0x19df('0x1b')](function(_0x162d3f){logger['error'](_0x19df('0x1c'),_0x162d3f?util['inspect'](_0x162d3f,{'showHidden':![],'depth':null}):'');});}exports[_0x19df('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb012=['moment','util','../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','then','length','info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect'];(function(_0x1a9bd2,_0x1ce637){var _0x16b89f=function(_0x53dd64){while(--_0x53dd64){_0x1a9bd2['push'](_0x1a9bd2['shift']());}};_0x16b89f(++_0x1ce637);}(_0xb012,0xea));var _0x2b01=function(_0xc4ebac,_0xcc4b91){_0xc4ebac=_0xc4ebac-0x0;var _0x17008f=_0xb012[_0xc4ebac];return _0x17008f;};'use strict';var _=require('lodash');var moment=require(_0x2b01('0x0'));var Redis=require('ioredis');var util=require(_0x2b01('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x2b01('0x2'))('schedule');config[_0x2b01('0x3')]=_[_0x2b01('0x4')](config['redis'],{'host':_0x2b01('0x5'),'port':0x18eb});var io=require(_0x2b01('0x6'))(new Redis(config[_0x2b01('0x3')]));function closeInteractions(){var _0x336ea7=0x0;var _0x55bf4b=[];return db[_0x2b01('0x7')][_0x2b01('0x8')]({'raw':!![],'attributes':['id',_0x2b01('0x9')],'where':{'id':0x1}})['then'](function(_0x427255){_0x336ea7=_0x427255[_0x2b01('0x9')];if(_0x336ea7){return db[_0x2b01('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x2b01('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2b01('0xc')](_0x427255[_0x2b01('0x9')],'minutes')}}});}else{return[];}})[_0x2b01('0xd')](function(_0x2a20db){if(_0x2a20db&&_0x2a20db[_0x2b01('0xe')]){_0x55bf4b=_['map'](_0x2a20db||[],'id');logger[_0x2b01('0xf')]('[CHAT]\x20Interactions\x20to\x20close:',_0x55bf4b[_0x2b01('0x10')]());return db[_0x2b01('0xa')][_0x2b01('0x11')]({'closeReason':'system','disposition':_0x2b01('0x12'),'closed':!![],'closedAt':moment()[_0x2b01('0x13')](_0x2b01('0x14'))},{'where':{'id':_0x55bf4b}});}})[_0x2b01('0xd')](function(){if(_0x55bf4b&&_0x55bf4b[_0x2b01('0xe')]){logger[_0x2b01('0xf')](_0x2b01('0x15'),_0x55bf4b[_0x2b01('0x10')]());for(var _0x27cc52=0x0;_0x27cc52<_0x55bf4b[_0x2b01('0xe')];_0x27cc52++){io[_0x2b01('0x16')](_0x2b01('0x17'),{'id':_0x55bf4b[_0x27cc52],'closed':!![]});}}})['catch'](function(_0x18ffdb){logger[_0x2b01('0x18')]('[CHAT]\x20Error\x20closing\x20interactions',_0x18ffdb?util[_0x2b01('0x19')](_0x18ffdb,{'showHidden':![],'depth':null}):'');});}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 5db56f2..a41ee96 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 _0xd471=['findAll','MailServerOut','keys','map','toString','keyBy','intersection','difference','exists','stop','deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','lodash','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','join','status','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','info','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule'];(function(_0x2ef849,_0xee4d08){var _0x31885c=function(_0x45ca21){while(--_0x45ca21){_0x2ef849['push'](_0x2ef849['shift']());}};_0x31885c(++_0xee4d08);}(_0xd471,0xc5));var _0x1d47=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd471[_0x2be8c2];return _0x97f531;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x1d47('0x0'));var moment=require('moment');var CronJobManager=require(_0x1d47('0x1'));var jayson=require(_0x1d47('0x2'));var BPromise=require(_0x1d47('0x3'));var logger=require('../logger')(_0x1d47('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1d47('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1d47('0x6')][_0x1d47('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x40d6b2,_0x54d8fc){return function(){logger['info'](_0x1d47('0x8'),_0x40d6b2[_0x1d47('0x9')]);var _0x1e595b=!![];var _0x4d9699={'tls':{'rejectUnauthorized':![]}};if(_0x40d6b2[_0x1d47('0xa')][_0x1d47('0xb')][_0x1d47('0xc')]){_0x4d9699[_0x1d47('0xc')]=_0x40d6b2[_0x1d47('0xa')][_0x1d47('0xb')]['service'];}else{_0x4d9699[_0x1d47('0xd')]=_0x40d6b2[_0x1d47('0xa')][_0x1d47('0xb')][_0x1d47('0xd')];_0x4d9699[_0x1d47('0xe')]=_0x40d6b2[_0x1d47('0xa')]['Smtp'][_0x1d47('0xe')];_0x4d9699[_0x1d47('0xf')]=_0x40d6b2['MailAccount'][_0x1d47('0xb')]['secure'];}if(_0x40d6b2[_0x1d47('0xa')][_0x1d47('0xb')][_0x1d47('0x10')]){_0x4d9699[_0x1d47('0x11')]={'user':_0x40d6b2[_0x1d47('0xa')]['Smtp']['user'],'pass':_0x40d6b2[_0x1d47('0xa')][_0x1d47('0xb')][_0x1d47('0x12')]};}var _0x29f641={'account':_0x4d9699,'message':{'from':util[_0x1d47('0x13')](_0x1d47('0x14'),_0x40d6b2[_0x1d47('0xa')]['name'],_0x40d6b2[_0x1d47('0xa')][_0x1d47('0x9')]||_0x40d6b2[_0x1d47('0xa')]['Smtp']['user']),'to':_0x40d6b2[_0x1d47('0x9')],'cc':_0x40d6b2['cc'],'bcc':_0x40d6b2[_0x1d47('0x15')],'subject':util['format'](_0x1d47('0x16'),_0x54d8fc[_0x1d47('0x17')],_0x40d6b2[_0x1d47('0x18')],_0x40d6b2[_0x1d47('0x19')])}};var _0x275df5=path['join'](__dirname,_0x1d47('0x1a'));var _0x464ea0=_0x54d8fc[_0x1d47('0x1b')];var _0x190795=util['format'](_0x1d47('0x1c'),path['basename'](_0x54d8fc['savename'],path[_0x1d47('0x1d')](_0x54d8fc[_0x1d47('0x1b')])),'zip');var _0x3161cd=path['join'](_0x275df5,_0x464ea0);var _0x46b80a=path[_0x1d47('0x1e')](_0x275df5,_0x190795);if(fs['existsSync'](_0x3161cd)){_0x54d8fc[_0x1d47('0x1f')]=_0x1d47('0x20');_0x29f641['message'][_0x1d47('0x21')]=[{'filename':_0x464ea0,'path':_0x3161cd}];_0x29f641[_0x1d47('0x22')]['text']=util[_0x1d47('0x13')](_0x1d47('0x23'),JSON['stringify'](_0x54d8fc,null,0x2));}else if(fs[_0x1d47('0x24')](_0x46b80a)){_0x54d8fc[_0x1d47('0x1f')]=_0x1d47('0x20');_0x29f641[_0x1d47('0x22')][_0x1d47('0x21')]=[{'filename':_0x190795,'path':_0x46b80a}];}else{_0x29f641['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x40d6b2[_0x1d47('0x25')]){_0x1e595b=![];logger['info'](_0x1d47('0x26'));}}if(_0x1e595b){return client['request'](_0x1d47('0x27'),_0x29f641)[_0x1d47('0x28')](function(_0x5b4c1c){if(_0x5b4c1c[_0x1d47('0x29')]){return logger[_0x1d47('0x29')](_0x1d47('0x2a'),JSON[_0x1d47('0x2b')](_0x5b4c1c));}return logger[_0x1d47('0x2c')]('email\x20sent');})['catch'](function(_0xd233cf){return logger[_0x1d47('0x29')](_0x1d47('0x2a'),JSON[_0x1d47('0x2b')](_0xd233cf));});}};}function handleError(){return function(_0x2cf7e3){return logger['error'](JSON[_0x1d47('0x2b')](_0x2cf7e3));};}function handleResult(_0x251adb){return function(_0x284a69){logger[_0x1d47('0x2c')](_0x1d47('0x2d'),JSON[_0x1d47('0x2b')](_0x284a69));if(_0x251adb[_0x1d47('0xa')]&&_0x251adb[_0x1d47('0xa')]['Smtp']&&!_[_0x1d47('0x2e')](_0x251adb[_0x1d47('0x9')])){setTimeout(handleSendEmail(_0x251adb,_0x284a69),0x3c*0x3e8);}};}function handleJob(_0x109682){return function(){try{if(_[_0x1d47('0x2e')](_0x109682[_0x1d47('0x18')])){return logger[_0x1d47('0x2c')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x1d47('0x2e')](_0x109682[_0x1d47('0x19')])){return logger[_0x1d47('0x2c')](_0x1d47('0x2f'));}var _0x4384ce={'startDate':moment()[_0x1d47('0x30')](_0x109682[_0x1d47('0x18')],_0x109682['subtractUnit'])[_0x1d47('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1d47('0x13')](_0x1d47('0x31')),'type':_0x1d47('0x32'),'output':_0x109682[_0x1d47('0x33')],'name':_0x109682[_0x1d47('0x17')]};if(!_[_0x1d47('0x2e')](_0x109682[_0x1d47('0x34')])){logger[_0x1d47('0x2c')]('exec\x20defaul\x20report\x20id:%s',_0x109682[_0x1d47('0x34')]);return analyticDefaultReportController['runReport']({'id':_0x109682[_0x1d47('0x34')]},_0x4384ce)[_0x1d47('0x28')](handleResult(_0x109682))[_0x1d47('0x35')](handleError());}if(!_[_0x1d47('0x2e')](_0x109682[_0x1d47('0x36')])){logger[_0x1d47('0x2c')](_0x1d47('0x37'),_0x109682[_0x1d47('0x36')]);return analyticCustomReportController[_0x1d47('0x38')]({'id':_0x109682['CustomReportId']},_0x4384ce)[_0x1d47('0x28')](handleResult(_0x109682))['catch'](handleError());}}catch(_0x919ea2){logger['error'](JSON[_0x1d47('0x2b')](_0x919ea2));}return logger[_0x1d47('0x2c')]('no\x20report\x20id');};}function getJobs(_0x320f5e){var _0x5cfefa={};if(_0x320f5e){_0x5cfefa['id']=_0x320f5e;}return db[_0x1d47('0x39')][_0x1d47('0x3a')]({'where':_0x5cfefa,'include':[{'model':db[_0x1d47('0xa')],'attributes':['id','name',_0x1d47('0x9')],'include':[{'model':db[_0x1d47('0x3b')],'as':_0x1d47('0xb')}]}]})[_0x1d47('0x28')](function(_0x4dbff1){var _0x4dc032=_[_0x1d47('0x3c')](manager['jobs']);var _0x51a7c2=_[_0x1d47('0x3d')](_0x4dbff1,function(_0x409b9f){return _0x409b9f['id'][_0x1d47('0x3e')]();});var _0x405fb9=_[_0x1d47('0x3f')](_0x4dbff1,function(_0x3c868a){return _0x3c868a['id'][_0x1d47('0x3e')]();});var _0x398623=_0x320f5e?_0x51a7c2:_['difference'](_0x51a7c2,_0x4dc032);var _0x3ff8be=_[_0x1d47('0x40')](_0x51a7c2,_0x4dc032);var _0x422275=_[_0x1d47('0x41')](_0x4dc032,_0x51a7c2);var _0x4c4f08;var _0x56bf6a;for(_0x4c4f08=0x0;_0x4c4f08<_0x422275['length']&&!_0x320f5e;_0x4c4f08+=0x1){_0x56bf6a=_0x422275[_0x4c4f08][_0x1d47('0x3e')]();if(manager[_0x1d47('0x42')](_0x56bf6a)){manager[_0x1d47('0x43')](_0x56bf6a);manager[_0x1d47('0x44')](_0x56bf6a);logger[_0x1d47('0x2c')](_0x1d47('0x45'),_0x56bf6a);}}logger[_0x1d47('0x2c')]('toRun',JSON[_0x1d47('0x2b')](_0x398623));for(_0x4c4f08=0x0;_0x4c4f08<_0x398623[_0x1d47('0x46')];_0x4c4f08+=0x1){_0x56bf6a=_0x398623[_0x4c4f08][_0x1d47('0x3e')]();logger['info']('index',_0x56bf6a);if(_0x320f5e){logger[_0x1d47('0x2c')](_0x1d47('0x47'),_0x320f5e);logger[_0x1d47('0x2c')](JSON[_0x1d47('0x2b')](_0x405fb9[_0x56bf6a]));BPromise[_0x1d47('0x48')]()[_0x1d47('0x28')](handleJob(_0x405fb9[_0x56bf6a]));logger[_0x1d47('0x2c')](_0x1d47('0x49'),_0x405fb9[_0x56bf6a][_0x1d47('0x17')],_0x405fb9[_0x56bf6a]['cron']);}else if(_0x405fb9[_0x56bf6a][_0x1d47('0x4a')]&&_0x405fb9[_0x56bf6a][_0x1d47('0x4b')]&&moment()[_0x1d47('0x4c')](_0x405fb9[_0x56bf6a][_0x1d47('0x4d')],_0x405fb9[_0x56bf6a][_0x1d47('0x4e')])){manager[_0x1d47('0x4f')](_0x56bf6a,_0x405fb9[_0x56bf6a][_0x1d47('0x4a')],handleJob(_0x405fb9[_0x56bf6a]));manager[_0x1d47('0x50')](_0x56bf6a);logger[_0x1d47('0x2c')](_0x1d47('0x51'),_0x405fb9[_0x56bf6a][_0x1d47('0x17')],_0x405fb9[_0x56bf6a]['cron']);}else if(manager[_0x1d47('0x42')](_0x56bf6a)){manager[_0x1d47('0x43')](_0x56bf6a);manager[_0x1d47('0x44')](_0x56bf6a);logger[_0x1d47('0x2c')](_0x1d47('0x52'),_0x405fb9[_0x56bf6a][_0x1d47('0x17')],_0x405fb9[_0x56bf6a][_0x1d47('0x4a')]);}}for(_0x4c4f08=0x0,_0x56bf6a;_0x4c4f08<_0x3ff8be['length']&&!_0x320f5e;_0x4c4f08+=0x1){_0x56bf6a=_0x3ff8be[_0x4c4f08][_0x1d47('0x3e')]();if(manager[_0x1d47('0x42')](_0x56bf6a)){if(_0x405fb9[_0x56bf6a][_0x1d47('0x4a')]&&_0x405fb9[_0x56bf6a][_0x1d47('0x4b')]&&moment()[_0x1d47('0x4c')](_0x405fb9[_0x56bf6a][_0x1d47('0x4d')],_0x405fb9[_0x56bf6a][_0x1d47('0x4e')])){manager[_0x1d47('0x53')](_0x56bf6a,_0x405fb9[_0x56bf6a]['cron'],handleJob(_0x405fb9[_0x56bf6a]));logger[_0x1d47('0x2c')]('update\x20cron',_0x405fb9[_0x56bf6a][_0x1d47('0x17')],_0x405fb9[_0x56bf6a][_0x1d47('0x4a')]);}else{manager['stop'](_0x56bf6a);manager['deleteJob'](_0x56bf6a);logger['info'](_0x1d47('0x52'),_0x405fb9[_0x56bf6a][_0x1d47('0x17')],_0x405fb9[_0x56bf6a][_0x1d47('0x4a')]);}}}})['catch'](function(_0x473a31){logger['error'](JSON['stringify'](_0x473a31));});}exports[_0x1d47('0x54')]=function(_0x3ccc77){return getJobs(_0x3ccc77);};exports[_0x1d47('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb852=['CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','keys','jobs','map','toString','difference','length','exists','stop','deleteJob','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','update','update\x20cron','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','catch','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','then'];(function(_0xd00789,_0x5444db){var _0x21df85=function(_0xd473d){while(--_0xd473d){_0xd00789['push'](_0xd00789['shift']());}};_0x21df85(++_0x5444db);}(_0xb852,0x175));var _0x2b85=function(_0x1cbb0c,_0x5bf085){_0x1cbb0c=_0x1cbb0c-0x0;var _0x2561be=_0xb852[_0x1cbb0c];return _0x2561be;};'use strict';var fs=require('fs');var util=require(_0x2b85('0x0'));var path=require(_0x2b85('0x1'));var _=require(_0x2b85('0x2'));var moment=require('moment');var CronJobManager=require(_0x2b85('0x3'));var jayson=require(_0x2b85('0x4'));var BPromise=require(_0x2b85('0x5'));var logger=require('../logger')(_0x2b85('0x6'));var db=require(_0x2b85('0x7'))['db'];var analyticCustomReportController=require(_0x2b85('0x8'));var analyticDefaultReportController=require(_0x2b85('0x9'));var client=jayson[_0x2b85('0xa')][_0x2b85('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x55ce89,_0x1cfcbf){return function(){logger['info'](_0x2b85('0xc'),_0x55ce89[_0x2b85('0xd')]);var _0x2b782a=!![];var _0x53eddb={'tls':{'rejectUnauthorized':![]}};if(_0x55ce89['MailAccount'][_0x2b85('0xe')][_0x2b85('0xf')]){_0x53eddb[_0x2b85('0xf')]=_0x55ce89[_0x2b85('0x10')]['Smtp'][_0x2b85('0xf')];}else{_0x53eddb[_0x2b85('0x11')]=_0x55ce89['MailAccount']['Smtp'][_0x2b85('0x11')];_0x53eddb['port']=_0x55ce89['MailAccount']['Smtp'][_0x2b85('0x12')];_0x53eddb[_0x2b85('0x13')]=_0x55ce89[_0x2b85('0x10')]['Smtp'][_0x2b85('0x13')];}if(_0x55ce89[_0x2b85('0x10')][_0x2b85('0xe')][_0x2b85('0x14')]){_0x53eddb[_0x2b85('0x15')]={'user':_0x55ce89[_0x2b85('0x10')][_0x2b85('0xe')][_0x2b85('0x16')],'pass':_0x55ce89[_0x2b85('0x10')][_0x2b85('0xe')][_0x2b85('0x17')]};}var _0x9fe81f={'account':_0x53eddb,'message':{'from':util['format'](_0x2b85('0x18'),_0x55ce89[_0x2b85('0x10')][_0x2b85('0x19')],_0x55ce89['MailAccount'][_0x2b85('0xd')]||_0x55ce89['MailAccount'][_0x2b85('0xe')][_0x2b85('0x16')]),'to':_0x55ce89['email'],'cc':_0x55ce89['cc'],'bcc':_0x55ce89[_0x2b85('0x1a')],'subject':util[_0x2b85('0x1b')](_0x2b85('0x1c'),_0x1cfcbf['name'],_0x55ce89[_0x2b85('0x1d')],_0x55ce89[_0x2b85('0x1e')])}};var _0x2c3a2c=path['join'](__dirname,_0x2b85('0x1f'));var _0x3b9902=_0x1cfcbf[_0x2b85('0x20')];var _0x35c098=util['format'](_0x2b85('0x21'),path[_0x2b85('0x22')](_0x1cfcbf[_0x2b85('0x20')],path[_0x2b85('0x23')](_0x1cfcbf[_0x2b85('0x20')])),_0x2b85('0x24'));var _0x3d3333=path[_0x2b85('0x25')](_0x2c3a2c,_0x3b9902);var _0x246c35=path['join'](_0x2c3a2c,_0x35c098);if(fs[_0x2b85('0x26')](_0x3d3333)){_0x1cfcbf[_0x2b85('0x27')]=_0x2b85('0x28');_0x9fe81f[_0x2b85('0x29')]['attachments']=[{'filename':_0x3b9902,'path':_0x3d3333}];_0x9fe81f[_0x2b85('0x29')][_0x2b85('0x2a')]=util[_0x2b85('0x1b')](_0x2b85('0x2b'),JSON[_0x2b85('0x2c')](_0x1cfcbf,null,0x2));}else if(fs[_0x2b85('0x26')](_0x246c35)){_0x1cfcbf[_0x2b85('0x27')]='Sent';_0x9fe81f[_0x2b85('0x29')]['attachments']=[{'filename':_0x35c098,'path':_0x246c35}];}else{_0x9fe81f[_0x2b85('0x29')]['text']=_0x2b85('0x2d');if(!_0x55ce89[_0x2b85('0x2e')]){_0x2b782a=![];logger[_0x2b85('0x2f')](_0x2b85('0x30'));}}if(_0x2b782a){return client[_0x2b85('0x31')](_0x2b85('0x32'),_0x9fe81f)['then'](function(_0x26d9da){if(_0x26d9da[_0x2b85('0x33')]){return logger[_0x2b85('0x33')](_0x2b85('0x34'),JSON[_0x2b85('0x2c')](_0x26d9da));}return logger[_0x2b85('0x2f')]('email\x20sent');})[_0x2b85('0x35')](function(_0x40e72d){return logger[_0x2b85('0x33')](_0x2b85('0x34'),JSON[_0x2b85('0x2c')](_0x40e72d));});}};}function handleError(){return function(_0x2abed9){return logger['error'](JSON[_0x2b85('0x2c')](_0x2abed9));};}function handleResult(_0x3862ca){return function(_0x2a1fa5){logger[_0x2b85('0x2f')]('data',JSON['stringify'](_0x2a1fa5));if(_0x3862ca[_0x2b85('0x10')]&&_0x3862ca['MailAccount'][_0x2b85('0xe')]&&!_[_0x2b85('0x36')](_0x3862ca['email'])){setTimeout(handleSendEmail(_0x3862ca,_0x2a1fa5),0x3c*0x3e8);}};}function handleJob(_0x15bac7){return function(){try{if(_[_0x2b85('0x36')](_0x15bac7['subtractNumber'])){return logger[_0x2b85('0x2f')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x2b85('0x36')](_0x15bac7[_0x2b85('0x1e')])){return logger['info'](_0x2b85('0x37'));}var _0x401f14={'startDate':moment()[_0x2b85('0x38')](_0x15bac7['subtractNumber'],_0x15bac7[_0x2b85('0x1e')])[_0x2b85('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2b85('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x2b85('0x39'),'output':_0x15bac7['output'],'name':_0x15bac7[_0x2b85('0x19')]};if(!_[_0x2b85('0x36')](_0x15bac7['DefaultReportId'])){logger[_0x2b85('0x2f')](_0x2b85('0x3a'),_0x15bac7['DefaultReportId']);return analyticDefaultReportController[_0x2b85('0x3b')]({'id':_0x15bac7[_0x2b85('0x3c')]},_0x401f14)[_0x2b85('0x3d')](handleResult(_0x15bac7))[_0x2b85('0x35')](handleError());}if(!_[_0x2b85('0x36')](_0x15bac7[_0x2b85('0x3e')])){logger[_0x2b85('0x2f')](_0x2b85('0x3f'),_0x15bac7['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x15bac7[_0x2b85('0x3e')]},_0x401f14)['then'](handleResult(_0x15bac7))[_0x2b85('0x35')](handleError());}}catch(_0x493357){logger[_0x2b85('0x33')](JSON[_0x2b85('0x2c')](_0x493357));}return logger[_0x2b85('0x2f')]('no\x20report\x20id');};}function getJobs(_0x47fdbe){var _0x3f0a2f={};if(_0x47fdbe){_0x3f0a2f['id']=_0x47fdbe;}return db['Schedule'][_0x2b85('0x40')]({'where':_0x3f0a2f,'include':[{'model':db[_0x2b85('0x10')],'attributes':['id',_0x2b85('0x19'),_0x2b85('0xd')],'include':[{'model':db[_0x2b85('0x41')],'as':_0x2b85('0xe')}]}]})[_0x2b85('0x3d')](function(_0x14692c){var _0x250874=_[_0x2b85('0x42')](manager[_0x2b85('0x43')]);var _0x54f09e=_[_0x2b85('0x44')](_0x14692c,function(_0x4cf739){return _0x4cf739['id'][_0x2b85('0x45')]();});var _0x1fe02d=_['keyBy'](_0x14692c,function(_0x57c5b6){return _0x57c5b6['id']['toString']();});var _0x397933=_0x47fdbe?_0x54f09e:_[_0x2b85('0x46')](_0x54f09e,_0x250874);var _0x134fa2=_['intersection'](_0x54f09e,_0x250874);var _0x4e1e37=_['difference'](_0x250874,_0x54f09e);var _0x49ddc9;var _0x2d52a7;for(_0x49ddc9=0x0;_0x49ddc9<_0x4e1e37[_0x2b85('0x47')]&&!_0x47fdbe;_0x49ddc9+=0x1){_0x2d52a7=_0x4e1e37[_0x49ddc9][_0x2b85('0x45')]();if(manager[_0x2b85('0x48')](_0x2d52a7)){manager[_0x2b85('0x49')](_0x2d52a7);manager[_0x2b85('0x4a')](_0x2d52a7);logger[_0x2b85('0x2f')]('delete\x20cron',_0x2d52a7);}}logger[_0x2b85('0x2f')]('toRun',JSON['stringify'](_0x397933));for(_0x49ddc9=0x0;_0x49ddc9<_0x397933['length'];_0x49ddc9+=0x1){_0x2d52a7=_0x397933[_0x49ddc9][_0x2b85('0x45')]();logger[_0x2b85('0x2f')](_0x2b85('0x4b'),_0x2d52a7);if(_0x47fdbe){logger[_0x2b85('0x2f')](_0x2b85('0x4c'),_0x47fdbe);logger[_0x2b85('0x2f')](JSON[_0x2b85('0x2c')](_0x1fe02d[_0x2d52a7]));BPromise[_0x2b85('0x4d')]()['then'](handleJob(_0x1fe02d[_0x2d52a7]));logger[_0x2b85('0x2f')](_0x2b85('0x4e'),_0x1fe02d[_0x2d52a7][_0x2b85('0x19')],_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]);}else if(_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]&&_0x1fe02d[_0x2d52a7][_0x2b85('0x50')]&&moment()[_0x2b85('0x51')](_0x1fe02d[_0x2d52a7][_0x2b85('0x52')],_0x1fe02d[_0x2d52a7]['endAt'])){manager['add'](_0x2d52a7,_0x1fe02d[_0x2d52a7]['cron'],handleJob(_0x1fe02d[_0x2d52a7]));manager['start'](_0x2d52a7);logger[_0x2b85('0x2f')]('add\x20cron',_0x1fe02d[_0x2d52a7][_0x2b85('0x19')],_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]);}else if(manager['exists'](_0x2d52a7)){manager['stop'](_0x2d52a7);manager['deleteJob'](_0x2d52a7);logger[_0x2b85('0x2f')]('stop\x20cron',_0x1fe02d[_0x2d52a7][_0x2b85('0x19')],_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]);}}for(_0x49ddc9=0x0,_0x2d52a7;_0x49ddc9<_0x134fa2[_0x2b85('0x47')]&&!_0x47fdbe;_0x49ddc9+=0x1){_0x2d52a7=_0x134fa2[_0x49ddc9][_0x2b85('0x45')]();if(manager[_0x2b85('0x48')](_0x2d52a7)){if(_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]&&_0x1fe02d[_0x2d52a7][_0x2b85('0x50')]&&moment()[_0x2b85('0x51')](_0x1fe02d[_0x2d52a7][_0x2b85('0x52')],_0x1fe02d[_0x2d52a7]['endAt'])){manager[_0x2b85('0x53')](_0x2d52a7,_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')],handleJob(_0x1fe02d[_0x2d52a7]));logger['info'](_0x2b85('0x54'),_0x1fe02d[_0x2d52a7][_0x2b85('0x19')],_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]);}else{manager[_0x2b85('0x49')](_0x2d52a7);manager[_0x2b85('0x4a')](_0x2d52a7);logger[_0x2b85('0x2f')](_0x2b85('0x55'),_0x1fe02d[_0x2d52a7][_0x2b85('0x19')],_0x1fe02d[_0x2d52a7][_0x2b85('0x4f')]);}}}})[_0x2b85('0x35')](function(_0x17f535){logger[_0x2b85('0x33')](JSON[_0x2b85('0x2c')](_0x17f535));});}exports[_0x2b85('0x56')]=function(_0x3ceadf){return getJobs(_0x3ceadf);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index dcc120c..4e8d590 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 _0x7ff9=['Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','catch','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment'];(function(_0x3e7300,_0x202005){var _0x177241=function(_0x494de3){while(--_0x494de3){_0x3e7300['push'](_0x3e7300['shift']());}};_0x177241(++_0x202005);}(_0x7ff9,0x1a5));var _0x97ff=function(_0x1fb8f9,_0x24f97f){_0x1fb8f9=_0x1fb8f9-0x0;var _0x1ec471=_0x7ff9[_0x1fb8f9];return _0x1ec471;};var _=require(_0x97ff('0x0'));var AWS=require(_0x97ff('0x1'));var rp=require('request-promise');var util=require(_0x97ff('0x2'));var BPromise=require(_0x97ff('0x3'));var db=require(_0x97ff('0x4'))['db'];var logger=require(_0x97ff('0x5'))(_0x97ff('0x6'));function getTranscriptionJob(_0x303089,_0x29830c,_0xd93cda,_0x17aeb1){return new Promise(function(_0x58bc49,_0xde9bc4){var _0x5caa83=new AWS[(_0x97ff('0x7'))]({'accessKeyId':_0x29830c,'secretAccessKey':_0x303089,'region':_0xd93cda});_0x5caa83[_0x97ff('0x8')]({'TranscriptionJobName':_0x17aeb1},function(_0x6362e6,_0x1593d0){if(_0x6362e6){return _0xde9bc4(_0x6362e6);}else{return _0x58bc49(_0x1593d0);}});});}function sentiment(_0x2cb739,_0x33fd3b,_0x30398e,_0x4cd7f2,_0x5be336){return new Promise(function(_0x45a289,_0x2bc9a4){var _0x5b3c59=new AWS[(_0x97ff('0x9'))]({'accessKeyId':_0x33fd3b,'secretAccessKey':_0x2cb739,'region':_0x30398e});_0x5b3c59[_0x97ff('0xa')]({'Text':_0x4cd7f2,'LanguageCode':_0x5be336[_0x97ff('0xb')](0x0,0x2)},function(_0xe569f3,_0x4d5359){if(_0xe569f3){return _0x2bc9a4(_0xe569f3);}else{return _0x45a289(_0x4d5359);}});});}function checkTranscribeJob(_0x4d5558,_0x353a3c,_0x892e55){var _0x4c5e44;return new BPromise(function(_0x4826d5,_0xa64bc2){logger['info'](util[_0x97ff('0xc')](_0x97ff('0xd'),_0x4d5558['id'],_0x4d5558[_0x97ff('0xe')]));return getTranscriptionJob(_0x892e55[_0x97ff('0xf')],_0x892e55[_0x97ff('0x10')],_0x353a3c['transcribeRegion'],_0x4d5558[_0x97ff('0xe')])[_0x97ff('0x11')](function(_0x71d2ab){logger['info'](util['format'](_0x97ff('0x12'),_0x4d5558['id'],_0x4d5558[_0x97ff('0xe')],_0x71d2ab[_0x97ff('0x13')][_0x97ff('0x14')]));if(!_0x4d5558[_0x97ff('0x15')]){switch(_0x71d2ab[_0x97ff('0x13')][_0x97ff('0x14')]){case _0x97ff('0x16'):var _0x1c9f3d={'transcribeStatus':_0x71d2ab[_0x97ff('0x13')][_0x97ff('0x14')],'fileUri':_0x71d2ab[_0x97ff('0x13')][_0x97ff('0x17')][_0x97ff('0x18')]};logger['info'](util[_0x97ff('0xc')](_0x97ff('0x19'),_0x4d5558['id']));return rp({'uri':_0x71d2ab[_0x97ff('0x13')]['Transcript'][_0x97ff('0x18')],'json':!![]})[_0x97ff('0x11')](function(_0x5774f4){logger[_0x97ff('0x1a')](util[_0x97ff('0xc')](_0x97ff('0x1b'),_0x4d5558['id']));if(_0x5774f4&&_0x5774f4[_0x97ff('0x1c')]&&_0x5774f4[_0x97ff('0x1c')]['transcripts']&&_0x5774f4[_0x97ff('0x1c')]['transcripts'][_0x97ff('0x1d')]){_0x1c9f3d['fileText']='';for(var _0x4c0ede=0x0;_0x4c0ede<_0x5774f4[_0x97ff('0x1c')][_0x97ff('0x1e')][_0x97ff('0x1d')];_0x4c0ede++){_0x1c9f3d['fileText']+=_0x5774f4[_0x97ff('0x1c')][_0x97ff('0x1e')][_0x4c0ede][_0x97ff('0x1f')]+'';}}return _0x4d5558[_0x97ff('0x20')](_0x1c9f3d);})[_0x97ff('0x11')](function(){logger[_0x97ff('0x1a')](util[_0x97ff('0xc')](_0x97ff('0x21'),_0x4d5558['id']));if(!_0x4d5558[_0x97ff('0x22')]){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x25'));}if(!_0x353a3c['sentiment']||!_0x353a3c['sentimentAccountId']||!_0x353a3c[_0x97ff('0x26')]||!_0x353a3c['language']||!_0x353a3c[_0x97ff('0x27')]){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x28'));}if(!_0x1c9f3d['fileText']){throw new Error(_0x97ff('0x29'));}if(_0x353a3c[_0x97ff('0x2a')]===_0x892e55['id']){return _0x892e55;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x97ff('0x2a')]}});}})[_0x97ff('0x11')](function(_0x2602c8){if(!_0x2602c8){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x2b'));}if(!_0x2602c8[_0x97ff('0xf')]||!_0x2602c8[_0x97ff('0x10')]){throw new db[(_0x97ff('0x23'))]['ValidationError'](_0x97ff('0x2c'));}_0x4c5e44=_0x2602c8;logger[_0x97ff('0x1a')](util[_0x97ff('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4d5558['id']));return sentiment(_0x4c5e44['data1'],_0x4c5e44[_0x97ff('0x10')],_0x353a3c['sentimentRegion'],_0x1c9f3d['fileText'],_0x353a3c[_0x97ff('0x2d')]);})[_0x97ff('0x11')](function(_0x35293a){logger[_0x97ff('0x1a')](util[_0x97ff('0xc')](_0x97ff('0x2e'),_0x4d5558['id']));return _0x4d5558['update']({'sentiment':_0x35293a['Sentiment'],'sPositive':_0x35293a[_0x97ff('0x2f')][_0x97ff('0x30')],'sNegative':_0x35293a['SentimentScore'][_0x97ff('0x31')],'sMixed':_0x35293a[_0x97ff('0x2f')]['Mixed'],'sNeutral':_0x35293a[_0x97ff('0x2f')][_0x97ff('0x32')]});})['then'](function(){logger['info'](util[_0x97ff('0xc')](_0x97ff('0x21'),_0x4d5558['id']));_0x4826d5();});case _0x97ff('0x33'):return _0x4d5558[_0x97ff('0x20')]({'transcribeStatus':_0x97ff('0x33'),'failureReason':_0x71d2ab['TranscriptionJob'][_0x97ff('0x34')]})['then'](function(){logger[_0x97ff('0x1a')](util[_0x97ff('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4d5558['id']));_0x4826d5();});default:logger[_0x97ff('0x1a')](util['format'](_0x97ff('0x35'),_0x4d5558['id']));break;}}else{return BPromise[_0x97ff('0x36')]()[_0x97ff('0x11')](function(){if(!_0x4d5558['tempSentiment']){throw new db['Sequelize'][(_0x97ff('0x24'))](_0x97ff('0x25'));}if(!_0x353a3c['sentiment']||!_0x353a3c[_0x97ff('0x2a')]||!_0x353a3c[_0x97ff('0x26')]||!_0x353a3c[_0x97ff('0x2d')]||!_0x353a3c[_0x97ff('0x27')]){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x28'));}if(!_0x4d5558[_0x97ff('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x353a3c[_0x97ff('0x2a')]===_0x892e55['id']){return _0x892e55;}else{return db[_0x97ff('0x37')][_0x97ff('0x38')]({'where':{'id':_settings[_0x97ff('0x2a')]}});}})['then'](function(_0x52863b){if(!_0x52863b){throw new db[(_0x97ff('0x23'))]['ValidationError'](_0x97ff('0x2b'));}if(!_0x52863b[_0x97ff('0xf')]||!_0x52863b[_0x97ff('0x10')]){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x2c'));}_0x4c5e44=_0x52863b;logger[_0x97ff('0x1a')](util[_0x97ff('0xc')](_0x97ff('0x39'),_0x4d5558['id']));return sentiment(_0x4c5e44[_0x97ff('0xf')],_0x4c5e44[_0x97ff('0x10')],_0x353a3c[_0x97ff('0x26')],_0x4d5558['fileText'],_0x353a3c[_0x97ff('0x2d')]);})[_0x97ff('0x11')](function(_0x359d8d){logger[_0x97ff('0x1a')](util['format'](_0x97ff('0x2e'),_0x4d5558['id']));return _0x4d5558[_0x97ff('0x20')]({'sentiment':_0x359d8d[_0x97ff('0x3a')],'sPositive':_0x359d8d[_0x97ff('0x2f')]['Positive'],'sNegative':_0x359d8d[_0x97ff('0x2f')][_0x97ff('0x31')],'sMixed':_0x359d8d[_0x97ff('0x2f')][_0x97ff('0x3b')],'sNeutral':_0x359d8d[_0x97ff('0x2f')]['Neutral'],'transcribeStatus':_0x97ff('0x16')});})[_0x97ff('0x11')](function(){logger[_0x97ff('0x1a')](util[_0x97ff('0xc')](_0x97ff('0x21'),_0x4d5558['id']));_0x4826d5();});}})['catch'](function(_0x3d5c44){if(_0x3d5c44){if(!_0x3d5c44[_0x97ff('0x3c')]||_0x3d5c44['name']!==_0x97ff('0x3d')){logger[_0x97ff('0x3e')](util[_0x97ff('0xc')](_0x97ff('0x3f'),_0x4d5558['id']),util[_0x97ff('0x40')](_0x3d5c44,{'showHidden':![],'depth':null}));}}_0x4826d5();});});}function checkTranscribe(){var _0x1d677d;var _0x27e178;var _0x2c6e1d;return db[_0x97ff('0x41')][_0x97ff('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x97ff('0x11')](function(_0x283d56){if(!_0x283d56||!_0x283d56['length']){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x43'));}_0x1d677d=_0x283d56;return db[_0x97ff('0x44')]['findOne']({'where':{'id':0x1}});})[_0x97ff('0x11')](function(_0x329322){if(!_0x329322){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x45'));}_0x27e178=_0x329322;if(!_0x27e178[_0x97ff('0x6')]||!_0x27e178[_0x97ff('0x46')]||!_0x27e178[_0x97ff('0x47')]||!_0x27e178[_0x97ff('0x2d')]||!_0x27e178[_0x97ff('0x27')]){throw new db[(_0x97ff('0x23'))][(_0x97ff('0x24'))](_0x97ff('0x48'));}return db[_0x97ff('0x37')][_0x97ff('0x38')]({'where':{'id':_0x27e178[_0x97ff('0x46')]}});})[_0x97ff('0x11')](function(_0x5a3cc8){if(!_0x5a3cc8){throw new db['Sequelize'][(_0x97ff('0x24'))](_0x97ff('0x2b'));}if(!_0x5a3cc8[_0x97ff('0xf')]||!_0x5a3cc8[_0x97ff('0x10')]){throw new db[(_0x97ff('0x23'))]['ValidationError'](_0x97ff('0x2c'));}_0x2c6e1d=_0x5a3cc8;var _0x5da71f=[];_0x1d677d[_0x97ff('0x49')](function(_0x4a22cb){_0x5da71f['push'](checkTranscribeJob(_0x4a22cb,_0x27e178,_0x2c6e1d));});return BPromise['all'](_0x5da71f);})[_0x97ff('0x4a')](function(_0x1588e3){if(_0x1588e3){if(!_0x1588e3[_0x97ff('0x3c')]||_0x1588e3[_0x97ff('0x3c')]!==_0x97ff('0x3d')){logger[_0x97ff('0x3e')](util[_0x97ff('0x40')](_0x1588e3,{'showHidden':![],'depth':null}));}}});}exports[_0x97ff('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x53f9=['TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','language','bucket','Sentiment','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','push','all','catch','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x53f9,0xcb));var _0x953f=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x53f9[_0x54f7c0];return _0x245d03;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x953f('0x0'));var util=require(_0x953f('0x1'));var BPromise=require(_0x953f('0x2'));var db=require(_0x953f('0x3'))['db'];var logger=require(_0x953f('0x4'))(_0x953f('0x5'));function getTranscriptionJob(_0x2edf06,_0x17441f,_0x2453e9,_0x11f640){return new Promise(function(_0x4b8a45,_0x1f5747){var _0xf47963=new AWS[(_0x953f('0x6'))]({'accessKeyId':_0x17441f,'secretAccessKey':_0x2edf06,'region':_0x2453e9});_0xf47963[_0x953f('0x7')]({'TranscriptionJobName':_0x11f640},function(_0x223931,_0x147be2){if(_0x223931){return _0x1f5747(_0x223931);}else{return _0x4b8a45(_0x147be2);}});});}function sentiment(_0x288e30,_0x4fb20e,_0x2b849b,_0x2c7c2e,_0x12fdd6){return new Promise(function(_0x41ce6b,_0x28f6f4){var _0x87f04b=new AWS[(_0x953f('0x8'))]({'accessKeyId':_0x4fb20e,'secretAccessKey':_0x288e30,'region':_0x2b849b});_0x87f04b[_0x953f('0x9')]({'Text':_0x2c7c2e,'LanguageCode':_0x12fdd6['substring'](0x0,0x2)},function(_0x2a3b3d,_0x591a90){if(_0x2a3b3d){return _0x28f6f4(_0x2a3b3d);}else{return _0x41ce6b(_0x591a90);}});});}function checkTranscribeJob(_0x49762d,_0x559a2c,_0x14e0fb){var _0x35432c;return new BPromise(function(_0x38c257,_0x141c97){logger[_0x953f('0xa')](util[_0x953f('0xb')](_0x953f('0xc'),_0x49762d['id'],_0x49762d['transcribeName']));return getTranscriptionJob(_0x14e0fb[_0x953f('0xd')],_0x14e0fb[_0x953f('0xe')],_0x559a2c['transcribeRegion'],_0x49762d['transcribeName'])['then'](function(_0x5499ac){logger[_0x953f('0xa')](util[_0x953f('0xb')](_0x953f('0xf'),_0x49762d['id'],_0x49762d['transcribeName'],_0x5499ac[_0x953f('0x10')]['TranscriptionJobStatus']));if(!_0x49762d[_0x953f('0x11')]){switch(_0x5499ac['TranscriptionJob'][_0x953f('0x12')]){case _0x953f('0x13'):var _0x107a2f={'transcribeStatus':_0x5499ac[_0x953f('0x10')][_0x953f('0x12')],'fileUri':_0x5499ac[_0x953f('0x10')][_0x953f('0x14')][_0x953f('0x15')]};logger['info'](util[_0x953f('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x49762d['id']));return rp({'uri':_0x5499ac[_0x953f('0x10')][_0x953f('0x14')][_0x953f('0x15')],'json':!![]})[_0x953f('0x16')](function(_0x4cda05){logger[_0x953f('0xa')](util[_0x953f('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x49762d['id']));if(_0x4cda05&&_0x4cda05[_0x953f('0x17')]&&_0x4cda05['results']['transcripts']&&_0x4cda05[_0x953f('0x17')][_0x953f('0x18')][_0x953f('0x19')]){_0x107a2f['fileText']='';for(var _0x4d9948=0x0;_0x4d9948<_0x4cda05[_0x953f('0x17')][_0x953f('0x18')][_0x953f('0x19')];_0x4d9948++){_0x107a2f[_0x953f('0x11')]+=_0x4cda05[_0x953f('0x17')][_0x953f('0x18')][_0x4d9948][_0x953f('0x1a')]+'';}}return _0x49762d['update'](_0x107a2f);})[_0x953f('0x16')](function(){logger['info'](util[_0x953f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x49762d['id']));if(!_0x49762d[_0x953f('0x1b')]){throw new db['Sequelize'][(_0x953f('0x1c'))](_0x953f('0x1d'));}if(!_0x559a2c[_0x953f('0x1e')]||!_0x559a2c[_0x953f('0x1f')]||!_0x559a2c[_0x953f('0x20')]||!_0x559a2c['language']||!_0x559a2c['bucket']){throw new db[(_0x953f('0x21'))]['ValidationError'](_0x953f('0x22'));}if(!_0x107a2f['fileText']){throw new Error(_0x953f('0x23'));}if(_0x559a2c['sentimentAccountId']===_0x14e0fb['id']){return _0x14e0fb;}else{return db[_0x953f('0x24')][_0x953f('0x25')]({'where':{'id':_settings[_0x953f('0x1f')]}});}})[_0x953f('0x16')](function(_0x12bbd4){if(!_0x12bbd4){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))](_0x953f('0x26'));}if(!_0x12bbd4['data1']||!_0x12bbd4[_0x953f('0xe')]){throw new db['Sequelize'][(_0x953f('0x1c'))](_0x953f('0x27'));}_0x35432c=_0x12bbd4;logger['info'](util['format'](_0x953f('0x28'),_0x49762d['id']));return sentiment(_0x35432c[_0x953f('0xd')],_0x35432c[_0x953f('0xe')],_0x559a2c[_0x953f('0x20')],_0x107a2f['fileText'],_0x559a2c['language']);})[_0x953f('0x16')](function(_0x404a72){logger[_0x953f('0xa')](util[_0x953f('0xb')](_0x953f('0x29'),_0x49762d['id']));return _0x49762d['update']({'sentiment':_0x404a72['Sentiment'],'sPositive':_0x404a72['SentimentScore'][_0x953f('0x2a')],'sNegative':_0x404a72['SentimentScore'][_0x953f('0x2b')],'sMixed':_0x404a72[_0x953f('0x2c')][_0x953f('0x2d')],'sNeutral':_0x404a72[_0x953f('0x2c')][_0x953f('0x2e')]});})['then'](function(){logger['info'](util[_0x953f('0xb')](_0x953f('0x2f'),_0x49762d['id']));_0x38c257();});case _0x953f('0x30'):return _0x49762d[_0x953f('0x31')]({'transcribeStatus':'FAILED','failureReason':_0x5499ac[_0x953f('0x10')][_0x953f('0x32')]})[_0x953f('0x16')](function(){logger[_0x953f('0xa')](util[_0x953f('0xb')](_0x953f('0x2f'),_0x49762d['id']));_0x38c257();});default:logger[_0x953f('0xa')](util[_0x953f('0xb')](_0x953f('0x33'),_0x49762d['id']));break;}}else{return BPromise[_0x953f('0x34')]()[_0x953f('0x16')](function(){if(!_0x49762d[_0x953f('0x1b')]){throw new db['Sequelize'][(_0x953f('0x1c'))](_0x953f('0x1d'));}if(!_0x559a2c[_0x953f('0x1e')]||!_0x559a2c[_0x953f('0x1f')]||!_0x559a2c['sentimentRegion']||!_0x559a2c[_0x953f('0x35')]||!_0x559a2c[_0x953f('0x36')]){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x49762d['fileText']){throw new Error(_0x953f('0x23'));}if(_0x559a2c[_0x953f('0x1f')]===_0x14e0fb['id']){return _0x14e0fb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x953f('0x1f')]}});}})[_0x953f('0x16')](function(_0x4bbebf){if(!_0x4bbebf){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))](_0x953f('0x26'));}if(!_0x4bbebf[_0x953f('0xd')]||!_0x4bbebf[_0x953f('0xe')]){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))](_0x953f('0x27'));}_0x35432c=_0x4bbebf;logger[_0x953f('0xa')](util['format'](_0x953f('0x28'),_0x49762d['id']));return sentiment(_0x35432c[_0x953f('0xd')],_0x35432c[_0x953f('0xe')],_0x559a2c[_0x953f('0x20')],_0x49762d[_0x953f('0x11')],_0x559a2c[_0x953f('0x35')]);})[_0x953f('0x16')](function(_0x56c357){logger[_0x953f('0xa')](util['format'](_0x953f('0x29'),_0x49762d['id']));return _0x49762d[_0x953f('0x31')]({'sentiment':_0x56c357[_0x953f('0x37')],'sPositive':_0x56c357['SentimentScore'][_0x953f('0x2a')],'sNegative':_0x56c357[_0x953f('0x2c')]['Negative'],'sMixed':_0x56c357[_0x953f('0x2c')][_0x953f('0x2d')],'sNeutral':_0x56c357[_0x953f('0x2c')][_0x953f('0x2e')],'transcribeStatus':_0x953f('0x13')});})[_0x953f('0x16')](function(){logger[_0x953f('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x49762d['id']));_0x38c257();});}})['catch'](function(_0x140c01){if(_0x140c01){if(!_0x140c01[_0x953f('0x38')]||_0x140c01['name']!==_0x953f('0x39')){logger['error'](util['format'](_0x953f('0x3a'),_0x49762d['id']),util[_0x953f('0x3b')](_0x140c01,{'showHidden':![],'depth':null}));}}_0x38c257();});});}function checkTranscribe(){var _0x226565;var _0x46aaea;var _0x57baf8;return db['VoiceRecording'][_0x953f('0x3c')]({'where':{'transcribeStatus':_0x953f('0x3d')}})['then'](function(_0x3df31a){if(!_0x3df31a||!_0x3df31a[_0x953f('0x19')]){throw new db['Sequelize'][(_0x953f('0x1c'))](_0x953f('0x3e'));}_0x226565=_0x3df31a;return db[_0x953f('0x3f')]['findOne']({'where':{'id':0x1}});})[_0x953f('0x16')](function(_0x62fb){if(!_0x62fb){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))](_0x953f('0x40'));}_0x46aaea=_0x62fb;if(!_0x46aaea[_0x953f('0x5')]||!_0x46aaea[_0x953f('0x41')]||!_0x46aaea[_0x953f('0x42')]||!_0x46aaea[_0x953f('0x35')]||!_0x46aaea['bucket']){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))]('Transcribe\x20not\x20configured');}return db[_0x953f('0x24')][_0x953f('0x25')]({'where':{'id':_0x46aaea[_0x953f('0x41')]}});})[_0x953f('0x16')](function(_0x51f54b){if(!_0x51f54b){throw new db['Sequelize'][(_0x953f('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x51f54b[_0x953f('0xd')]||!_0x51f54b[_0x953f('0xe')]){throw new db[(_0x953f('0x21'))][(_0x953f('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x57baf8=_0x51f54b;var _0x450700=[];_0x226565[_0x953f('0x43')](function(_0x9c9206){_0x450700[_0x953f('0x44')](checkTranscribeJob(_0x9c9206,_0x46aaea,_0x57baf8));});return BPromise[_0x953f('0x45')](_0x450700);})[_0x953f('0x46')](function(_0x7f6099){if(_0x7f6099){if(!_0x7f6099[_0x953f('0x38')]||_0x7f6099[_0x953f('0x38')]!==_0x953f('0x39')){logger[_0x953f('0x47')](util[_0x953f('0x3b')](_0x7f6099,{'showHidden':![],'depth':null}));}}});}exports[_0x953f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 69f5112..a9c7993 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe21c=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','subtract','hours','then','length','info','WhatsappInteraction','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe21c,0x13c));var _0xce21=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xe21c[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xce21('0x0'));var moment=require(_0xce21('0x1'));var Redis=require('ioredis');var util=require(_0xce21('0x2'));var config=require('../../config/environment');var db=require(_0xce21('0x3'))['db'];var logger=require(_0xce21('0x4'))(_0xce21('0x5'));config[_0xce21('0x6')]=_[_0xce21('0x7')](config[_0xce21('0x6')],{'host':_0xce21('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x5db2cf=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xce21('0x9')](0x18,_0xce21('0xa'))}}})[_0xce21('0xb')](function(_0x5b604b){if(_0x5b604b&&_0x5b604b[_0xce21('0xc')]){_0x5db2cf=_['map'](_0x5b604b||[],'id');logger[_0xce21('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x5db2cf['join']());return db[_0xce21('0xe')][_0xce21('0xf')]({'closeReason':_0xce21('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xce21('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5db2cf}});}})[_0xce21('0xb')](function(){if(_0x5db2cf&&_0x5db2cf[_0xce21('0xc')]){logger[_0xce21('0xd')](_0xce21('0x12'),_0x5db2cf['join']());for(var _0x39a667=0x0;_0x39a667<_0x5db2cf[_0xce21('0xc')];_0x39a667++){io[_0xce21('0x13')](_0xce21('0x14'),{'id':_0x5db2cf[_0x39a667],'closed':!![]});}}})[_0xce21('0x15')](function(_0xae3b2f){logger[_0xce21('0x16')](_0xce21('0x17'),_0xae3b2f?util[_0xce21('0x18')](_0xae3b2f,{'showHidden':![],'depth':null}):'');});}exports[_0xce21('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x31d4=['redis','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x31d4,0x1b8));var _0x431d=function(_0xbe41ba,_0x384563){_0xbe41ba=_0xbe41ba-0x0;var _0x2c2085=_0x31d4[_0xbe41ba];return _0x2c2085;};'use strict';var _=require(_0x431d('0x0'));var moment=require('moment');var Redis=require(_0x431d('0x1'));var util=require(_0x431d('0x2'));var config=require(_0x431d('0x3'));var db=require(_0x431d('0x4'))['db'];var logger=require(_0x431d('0x5'))(_0x431d('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x431d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x431d('0x8')]));function closeInteractions(){var _0x8d0232=[];return db[_0x431d('0x9')][_0x431d('0xa')]({'raw':!![],'attributes':['id',_0x431d('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x431d('0xc')](0x18,_0x431d('0xd'))}}})['then'](function(_0x543ea2){if(_0x543ea2&&_0x543ea2[_0x431d('0xe')]){_0x8d0232=_[_0x431d('0xf')](_0x543ea2||[],'id');logger[_0x431d('0x10')](_0x431d('0x11'),_0x8d0232[_0x431d('0x12')]());return db[_0x431d('0x9')][_0x431d('0x13')]({'closeReason':_0x431d('0x14'),'disposition':_0x431d('0x15'),'closed':!![],'closedAt':moment()[_0x431d('0x16')](_0x431d('0x17'))},{'where':{'id':_0x8d0232}});}})[_0x431d('0x18')](function(){if(_0x8d0232&&_0x8d0232[_0x431d('0xe')]){logger[_0x431d('0x10')](_0x431d('0x19'),_0x8d0232[_0x431d('0x12')]());for(var _0x4690ac=0x0;_0x4690ac<_0x8d0232[_0x431d('0xe')];_0x4690ac++){io[_0x431d('0x1a')](_0x431d('0x1b'),{'id':_0x8d0232[_0x4690ac],'closed':!![]});}}})['catch'](function(_0x2b89f4){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2b89f4?util['inspect'](_0x2b89f4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 171c6cb..12cf35b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x640e=['bulkCreate','hopper1','contacts2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','log','finished\x20populating','CmHopper','then'];(function(_0x4231c5,_0x29f229){var _0xb7fb9a=function(_0x3a6df6){while(--_0x3a6df6){_0x4231c5['push'](_0x4231c5['shift']());}};_0xb7fb9a(++_0x29f229);}(_0x640e,0x143));var _0xe640=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x640e[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var db=require(_0xe640('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe640('0x1')]({'id':i,'firstName':_0xe640('0x2')+i,'lastName':_0xe640('0x3')+i,'phone':0xf879fb460+i,'email':_0xe640('0x4')+i+_0xe640('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe640('0x6')](),'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[_0xe640('0x1')]({'id':i,'firstName':_0xe640('0x2')+i,'lastName':_0xe640('0x3')+i,'phone':0xf879fb460+i,'email':_0xe640('0x4')+i+_0xe640('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe640('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe640('0x6')](),'updatedAt':Date[_0xe640('0x6')]()});}db[_0xe640('0x7')][_0xe640('0x8')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xe640('0x9')](_0xe640('0xa'),'contacts1');return db[_0xe640('0xb')][_0xe640('0x8')]({'where':{}});})[_0xe640('0xc')](function(){return db[_0xe640('0xb')][_0xe640('0xd')](hopper);})[_0xe640('0xc')](function(){console[_0xe640('0x9')]('finished\x20populating',_0xe640('0xe'));return db[_0xe640('0x7')][_0xe640('0xd')](contacts2);})[_0xe640('0xc')](function(){console[_0xe640('0x9')](_0xe640('0xa'),_0xe640('0xf'));return db['CmHopper'][_0xe640('0xd')](hopper2);})['then'](function(){console[_0xe640('0x9')](_0xe640('0xa'),'hopper2');})['catch'](function(_0x439b01){console['log'](_0x439b01);}); \ No newline at end of file +var _0x0f6e=['CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','contacts1'];(function(_0x2a0f0f,_0x3d97f2){var _0x472f11=function(_0x24ba9d){while(--_0x24ba9d){_0x2a0f0f['push'](_0x2a0f0f['shift']());}};_0x472f11(++_0x3d97f2);}(_0x0f6e,0x1aa));var _0xe0f6=function(_0x568fc3,_0x56fedc){_0x568fc3=_0x568fc3-0x0;var _0x160dbe=_0x0f6e[_0x568fc3];return _0x160dbe;};'use strict';var util=require(_0xe0f6('0x0'));var db=require(_0xe0f6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe0f6('0x2')+i,'phone':0xf879fb460+i,'email':_0xe0f6('0x3')+i+_0xe0f6('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe0f6('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xe0f6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0f6('0x6')](),'updatedAt':Date[_0xe0f6('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe0f6('0x7')+i,'lastName':_0xe0f6('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe0f6('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe0f6('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xe0f6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0f6('0x6')](),'updatedAt':Date['now']()});}db[_0xe0f6('0x8')][_0xe0f6('0x9')]({'where':{}})[_0xe0f6('0xa')](function(){return db[_0xe0f6('0x8')][_0xe0f6('0xb')](contacts);})[_0xe0f6('0xa')](function(){console[_0xe0f6('0xc')]('finished\x20populating',_0xe0f6('0xd'));return db[_0xe0f6('0xe')][_0xe0f6('0x9')]({'where':{}});})['then'](function(){return db[_0xe0f6('0xe')][_0xe0f6('0xb')](hopper);})[_0xe0f6('0xa')](function(){console[_0xe0f6('0xc')](_0xe0f6('0xf'),_0xe0f6('0x10'));return db[_0xe0f6('0x8')][_0xe0f6('0xb')](contacts2);})[_0xe0f6('0xa')](function(){console[_0xe0f6('0xc')](_0xe0f6('0xf'),_0xe0f6('0x11'));return db['CmHopper'][_0xe0f6('0xb')](hopper2);})['then'](function(){console['log'](_0xe0f6('0xf'),_0xe0f6('0x12'));})[_0xe0f6('0x13')](function(_0x53c96a){console[_0xe0f6('0xc')](_0x53c96a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 538c64a..1492c50 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2492=['%s%s@xcally.com','friend','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','util','push','format','%s%s','agent'];(function(_0x4a3b23,_0x5bce0e){var _0x5c87f6=function(_0x490f83){while(--_0x490f83){_0x4a3b23['push'](_0x4a3b23['shift']());}};_0x5c87f6(++_0x5bce0e);}(_0x2492,0xdb));var _0x2249=function(_0x58feca,_0x19d618){_0x58feca=_0x58feca-0x0;var _0x14c616=_0x2492[_0x58feca];return _0x14c616;};'use strict';var util=require(_0x2249('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2249('0x1')]({'name':util[_0x2249('0x2')](_0x2249('0x3'),_0x2249('0x4'),i),'fullname':util[_0x2249('0x2')](_0x2249('0x3'),_0x2249('0x4'),i),'email':util[_0x2249('0x2')](_0x2249('0x5'),_0x2249('0x4'),i),'role':_0x2249('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2249('0x6'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0x2249('0x7')],'defaultuser':util['format'](_0x2249('0x3'),'agent',i),'encryption':_0x2249('0x8'),'avpf':_0x2249('0x8'),'force_avp':'yes','icesupport':_0x2249('0x8'),'dtlsenable':_0x2249('0x8'),'dtlsverify':'no','dtlscertfile':_0x2249('0x9'),'dtlsprivatekey':_0x2249('0xa'),'dtlssetup':_0x2249('0xb'),'callerid':util[_0x2249('0x2')](_0x2249('0xc'),util[_0x2249('0x2')](_0x2249('0x3'),'agent',i),0xfa0+i)});}db[_0x2249('0xd')]['bulkCreate'](users)[_0x2249('0xe')](function(){console['log']('add\x20user');})['catch'](function(_0x16200e){console[_0x2249('0xf')](_0x16200e);}); \ No newline at end of file +var _0x2414=['%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','format','%s%s','agent'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0x2414,0x153));var _0x4241=function(_0x1cccc3,_0x42251a){_0x1cccc3=_0x1cccc3-0x0;var _0xd9f4cf=_0x2414[_0x1cccc3];return _0xd9f4cf;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x4241('0x0')](_0x4241('0x1'),'agent',i),'fullname':util[_0x4241('0x0')](_0x4241('0x1'),_0x4241('0x2'),i),'email':util[_0x4241('0x0')](_0x4241('0x3'),_0x4241('0x2'),i),'role':_0x4241('0x2'),'password':_0x4241('0x4'),'internal':0xfa0+i,'type':_0x4241('0x5'),'transport':[_0x4241('0x6'),'ws',_0x4241('0x7')],'disallow':['all'],'allow':[_0x4241('0x8')],'defaultuser':util[_0x4241('0x0')](_0x4241('0x1'),_0x4241('0x2'),i),'encryption':_0x4241('0x9'),'avpf':_0x4241('0x9'),'force_avp':_0x4241('0x9'),'icesupport':_0x4241('0x9'),'dtlsenable':_0x4241('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x4241('0xa'),'callerid':util[_0x4241('0x0')](_0x4241('0xb'),util[_0x4241('0x0')](_0x4241('0x1'),'agent',i),0xfa0+i)});}db[_0x4241('0xc')][_0x4241('0xd')](users)[_0x4241('0xe')](function(){console[_0x4241('0xf')](_0x4241('0x10'));})[_0x4241('0x11')](function(_0x3abd0e){console['log'](_0x3abd0e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5a947d3..ca589c3 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19e7=['DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','UserProfileSection','then','ChatQueues','FaxQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','ivr','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Campaign','user','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueue','WhatsappQueues','Telephones','Trunk','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','sms','mail','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19e7,0xc8));var _0x719e=function(_0x436c16,_0x1fb41f){_0x436c16=_0x436c16-0x0;var _0x1d27c1=_0x19e7[_0x436c16];return _0x1d27c1;};'use strict';var _=require(_0x719e('0x0'));var util=require(_0x719e('0x1'));var BPromise=require(_0x719e('0x2'));var db=require(_0x719e('0x3'))['db'];var config=require(_0x719e('0x4'));var queryQueues={'attributes':['id',_0x719e('0x5')],'include':[{'as':_0x719e('0x6'),'model':db[_0x719e('0x7')],'attributes':['id',_0x719e('0x5'),_0x719e('0x8')],'raw':!![],'where':{'role':_0x719e('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x719e('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x719e('0x5')],'where':{'role':_0x719e('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x719e('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2cb52e,_0x22bebc,_0x2d8ff9){return db[_0x719e('0xb')]['findOne']({'where':{'name':_0x2cb52e,'userProfileId':_0x22bebc},'raw':!![]})[_0x719e('0xc')](function(_0x4897f4){if(_0x4897f4){if(_0x4897f4['autoAssociation']){switch(_0x2cb52e){case'VoiceQueues':case _0x719e('0xd'):case _0x719e('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2d8ff9][_0x719e('0xf')](queryQueues);case'Telephones':return db[_0x2d8ff9]['findAll'](queryTelephones);case _0x719e('0x10'):return db[_0x2d8ff9][_0x719e('0xf')](queryTrunks);case _0x719e('0x11'):return db[_0x2d8ff9][_0x719e('0xf')](queryCampaigns);}}else{return db[_0x719e('0x12')]['findAll']({'attributes':[_0x719e('0x13')],'where':{'sectionId':_0x4897f4['id']},'raw':!![]})['then'](function(_0x1ea489){if(_0x1ea489){var _0x1d2180={'where':{'id':_[_0x719e('0x14')](_0x1ea489,'resourceId')},'raw':!![]};switch(_0x2d8ff9){case _0x719e('0x7'):_0x1d2180['where']['role']='telephone';break;case'Campaign':_0x1d2180[_0x719e('0x15')]['type']=_0x719e('0x16');break;}return db[_0x2d8ff9][_0x719e('0xf')](_0x1d2180);}else{return[];}});}}else{return[];}})[_0x719e('0xc')](function(_0x1efea6){return _0x1efea6;});}function joinOrLeaveQueues(_0x566321,_0x48501e,_0x486c9e,_0x2bbd53){_0x566321[_0x48501e](util[_0x719e('0x17')](_0x719e('0x18'),_0x486c9e,_0x2bbd53[_0x719e('0x5')]));if(_0x2bbd53[_0x719e('0x6')]){for(var _0x4e9529=0x0;_0x4e9529<_0x2bbd53[_0x719e('0x6')][_0x719e('0x19')];_0x4e9529+=0x1){_0x566321[_0x48501e](util['format'](_0x719e('0x1a'),_0x2bbd53['Agents'][_0x4e9529][_0x719e('0x5')]));}}}function joinOrLeave(_0x437382,_0x5c75e8,_0x43c81){var _0x32e5a5;if(_0x437382[_0x719e('0x1b')][_0x719e('0x1c')]['id']){db[_0x719e('0x7')][_0x719e('0x1d')]({'attributes':['id','name',_0x719e('0x8'),_0x719e('0x1e')],'where':{'id':_0x437382[_0x719e('0x1b')][_0x719e('0x1c')]['id']},'include':[{'model':db[_0x719e('0x1f')],'as':_0x719e('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x719e('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x719e('0x22')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x719e('0x23')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x719e('0x24')],'as':_0x719e('0x25'),'attributes':['id'],'raw':!![]}]})[_0x719e('0xc')](function(_0x442e2d){if(_0x442e2d){_0x32e5a5=_0x442e2d;_0x437382[_0x5c75e8](util['format'](_0x719e('0x1a'),_0x442e2d[_0x719e('0x5')]));var _0x2a7628=[];switch(_0x442e2d['role']){case _0x719e('0x26'):_0x437382[_0x5c75e8](_0x719e('0x27'));_0x437382[_0x5c75e8](_0x719e('0x28'));if(queryQueues[_0x719e('0x29')]('include')){delete queryQueues['include'];}_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x2b')]['findAll'](queryQueues));_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x2c')][_0x719e('0xf')](queryQueues));_0x2a7628['push'](db[_0x719e('0x2d')]['findAll'](queryQueues));_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x2e')]['findAll'](queryQueues));_0x2a7628['push'](db[_0x719e('0x2f')][_0x719e('0xf')](queryQueues));_0x2a7628['push'](db['OpenchannelQueue']['findAll'](queryQueues));_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x30')]['findAll'](queryQueues));_0x2a7628[_0x719e('0x2a')](db['User'][_0x719e('0xf')](queryTelephones));_0x2a7628[_0x719e('0x2a')](db['Trunk'][_0x719e('0xf')](queryTrunks));_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x31')][_0x719e('0xf')](queryCampaigns));_0x2a7628[_0x719e('0x2a')](db['User']['findAll'](queryAgents));break;case _0x719e('0x32'):_0x437382[_0x5c75e8]('voice:inbound');_0x437382[_0x5c75e8](_0x719e('0x28'));_0x2a7628[_0x719e('0x2a')](getAssociatedResources(_0x719e('0x33'),_0x442e2d['userProfileId'],_0x719e('0x2b')));_0x2a7628[_0x719e('0x2a')](getAssociatedResources(_0x719e('0xd'),_0x442e2d[_0x719e('0x1e')],_0x719e('0x2c')));_0x2a7628['push'](getAssociatedResources(_0x719e('0xe'),_0x442e2d[_0x719e('0x1e')],_0x719e('0x2d')));_0x2a7628['push'](getAssociatedResources(_0x719e('0x34'),_0x442e2d[_0x719e('0x1e')],_0x719e('0x2e')));_0x2a7628[_0x719e('0x2a')](getAssociatedResources(_0x719e('0x35'),_0x442e2d['userProfileId'],'MailQueue'));_0x2a7628['push'](getAssociatedResources('OpenchannelQueues',_0x442e2d[_0x719e('0x1e')],_0x719e('0x36')));_0x2a7628['push'](getAssociatedResources(_0x719e('0x37'),_0x442e2d[_0x719e('0x1e')],_0x719e('0x30')));_0x2a7628['push'](getAssociatedResources(_0x719e('0x38'),_0x442e2d[_0x719e('0x1e')],_0x719e('0x7')));_0x2a7628['push'](getAssociatedResources('Trunks',_0x442e2d[_0x719e('0x1e')],_0x719e('0x39')));_0x2a7628[_0x719e('0x2a')](getAssociatedResources(_0x719e('0x11'),_0x442e2d['userProfileId'],'Campaign'));_0x2a7628[_0x719e('0x2a')](db[_0x719e('0x7')]['findAll'](queryAgents));break;case'agent':_0x437382[_0x5c75e8](_0x719e('0x27'));_0x437382[_0x5c75e8]('voice:outbound');_0x2a7628[_0x719e('0x2a')](_0x442e2d['getVoiceQueues']({'attributes':['id','name']}));_0x2a7628[_0x719e('0x2a')](_0x442e2d[_0x719e('0x3a')]({'attributes':['id','name']}));_0x2a7628[_0x719e('0x2a')](_0x442e2d[_0x719e('0x3b')]({'attributes':['id',_0x719e('0x5')]}));_0x2a7628[_0x719e('0x2a')](_0x442e2d['getSmsQueues']({'attributes':['id','name']}));_0x2a7628[_0x719e('0x2a')](_0x442e2d['getMailQueues']({'attributes':['id',_0x719e('0x5')]}));_0x2a7628[_0x719e('0x2a')](_0x442e2d[_0x719e('0x3c')]({'attributes':['id',_0x719e('0x5')]}));_0x2a7628[_0x719e('0x2a')](_0x442e2d[_0x719e('0x3d')]({'attributes':['id',_0x719e('0x5')]}));break;}return BPromise[_0x719e('0x3e')](_0x2a7628);}})['then'](function(_0x46b62f){if(_0x46b62f&&_0x46b62f[_0x719e('0x19')]){for(var _0x552c36=0x0;_0x552c36<_0x46b62f[_0x719e('0x19')];_0x552c36+=0x1){for(var _0x26fb94=0x0;_0x26fb94<_0x46b62f[_0x552c36][_0x719e('0x19')];_0x26fb94+=0x1){switch(_0x552c36){case 0x0:joinOrLeaveQueues(_0x437382,_0x5c75e8,_0x719e('0x3f'),_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x1:joinOrLeaveQueues(_0x437382,_0x5c75e8,'chat',_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x2:joinOrLeaveQueues(_0x437382,_0x5c75e8,'fax',_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x3:joinOrLeaveQueues(_0x437382,_0x5c75e8,_0x719e('0x40'),_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x4:joinOrLeaveQueues(_0x437382,_0x5c75e8,_0x719e('0x41'),_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x5:joinOrLeaveQueues(_0x437382,_0x5c75e8,_0x719e('0x42'),_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x6:joinOrLeaveQueues(_0x437382,_0x5c75e8,'whatsapp',_0x46b62f[_0x552c36][_0x26fb94]);break;case 0x7:if(_0x32e5a5[_0x719e('0x8')]!=='agent')_0x437382[_0x5c75e8](util[_0x719e('0x17')](_0x719e('0x43'),_0x46b62f[_0x552c36][_0x26fb94][_0x719e('0x5')]));break;case 0x8:if(_0x32e5a5[_0x719e('0x8')]!==_0x719e('0x9'))_0x437382[_0x5c75e8](util[_0x719e('0x17')](_0x719e('0x44'),_0x46b62f[_0x552c36][_0x26fb94][_0x719e('0x5')]));break;case 0x9:if(_0x32e5a5['role']!==_0x719e('0x9'))_0x437382[_0x5c75e8](util[_0x719e('0x17')]('campaign:%s:%s',_0x46b62f[_0x552c36][_0x26fb94][_0x719e('0xa')],_0x46b62f[_0x552c36][_0x26fb94]['name']));break;case 0xa:_0x437382[_0x5c75e8](util[_0x719e('0x17')](_0x719e('0x1a'),_0x46b62f[_0x552c36][_0x26fb94][_0x719e('0x5')]));break;}}}}})[_0x719e('0xc')](function(){if(_0x5c75e8===_0x719e('0x45')){var _0x1e87c9=_[_0x719e('0x14')](_0x32e5a5[_0x719e('0x20')],'id');return _0x32e5a5[_0x719e('0x46')](_0x1e87c9)[_0x719e('0xc')](function(){for(var _0x22a63e=0x0;_0x22a63e<_0x1e87c9[_0x719e('0x19')];_0x22a63e+=0x1){_0x43c81[_0x719e('0x47')](_0x719e('0x48'),{'ChatInteractionId':Number(_0x1e87c9[_0x22a63e]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0xc')](function(){if(_0x5c75e8==='leave'){var _0x501c9d=_[_0x719e('0x14')](_0x32e5a5['MailInteractions'],'id');return _0x32e5a5['removeMailInteractions'](_0x501c9d)[_0x719e('0xc')](function(){for(var _0x52f59d=0x0;_0x52f59d<_0x501c9d[_0x719e('0x19')];_0x52f59d+=0x1){_0x43c81['emit'](_0x719e('0x49'),{'MailInteractionId':Number(_0x501c9d[_0x52f59d]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0xc')](function(){if(_0x5c75e8==='leave'){var _0x2de5b1=_[_0x719e('0x14')](_0x32e5a5[_0x719e('0x4a')],'id');return _0x32e5a5['removeFaxInteractions'](_0x2de5b1)[_0x719e('0xc')](function(){for(var _0x43c06d=0x0;_0x43c06d<_0x2de5b1['length'];_0x43c06d+=0x1){_0x43c81[_0x719e('0x47')](_0x719e('0x4b'),{'FaxInteractionId':Number(_0x2de5b1[_0x43c06d]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0xc')](function(){if(_0x5c75e8==='leave'){var _0x19b374=_[_0x719e('0x14')](_0x32e5a5[_0x719e('0x4c')],'id');return _0x32e5a5[_0x719e('0x4d')](_0x19b374)[_0x719e('0xc')](function(){for(var _0x404d85=0x0;_0x404d85<_0x19b374['length'];_0x404d85+=0x1){_0x43c81[_0x719e('0x47')](_0x719e('0x4e'),{'SmsInteractionId':Number(_0x19b374[_0x404d85]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0xc')](function(){if(_0x5c75e8===_0x719e('0x45')){var _0xa39162=_[_0x719e('0x14')](_0x32e5a5['OpenchannelInteractions'],'id');return _0x32e5a5[_0x719e('0x4f')](_0xa39162)[_0x719e('0xc')](function(){for(var _0xc4ff88=0x0;_0xc4ff88<_0xa39162[_0x719e('0x19')];_0xc4ff88+=0x1){_0x43c81[_0x719e('0x47')](_0x719e('0x50'),{'OpenchannelInteractionId':Number(_0xa39162[_0xc4ff88]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0xc')](function(){if(_0x5c75e8===_0x719e('0x45')){var _0x1e9e5d=_[_0x719e('0x14')](_0x32e5a5[_0x719e('0x25')],'id');return _0x32e5a5[_0x719e('0x51')](_0x1e9e5d)[_0x719e('0xc')](function(){for(var _0x2ddd97=0x0;_0x2ddd97<_0x1e9e5d[_0x719e('0x19')];_0x2ddd97+=0x1){_0x43c81[_0x719e('0x47')](_0x719e('0x52'),{'WhatsappInteractionId':Number(_0x1e9e5d[_0x2ddd97]),'UserId':Number(_0x32e5a5['id'])});}});}})[_0x719e('0x53')](function(_0x111630){_0x437382[_0x719e('0x54')](_0x111630);});}}function onDisconnect(_0xee4f93,_0x1a583f){joinOrLeave(_0xee4f93,'leave',_0x1a583f);}function onConnect(_0x4f8691){joinOrLeave(_0x4f8691,_0x719e('0x55'));}exports[_0x719e('0x56')]=function(_0xb8870d){_0xb8870d['on'](_0x719e('0x57'),function(_0x32139b){_0x32139b[_0x719e('0x58')](0x0);_0x32139b['address']=_0x32139b[_0x719e('0x59')][_0x719e('0x57')][_0x719e('0x5a')]+':'+_0x32139b[_0x719e('0x59')][_0x719e('0x57')][_0x719e('0x5b')];_0x32139b[_0x719e('0x5c')]=new Date();_0x32139b[_0x719e('0x54')]=function(_0x1af3eb){console['log'](_0x719e('0x5d')+_0x32139b[_0x719e('0x5e')]['name']+'['+_0x32139b[_0x719e('0x5f')]+']',_0x1af3eb);};_0x32139b['on'](_0x719e('0x60'),function(){onDisconnect(_0x32139b,_0xb8870d);_0x32139b[_0x719e('0x54')](_0x719e('0x61'));});onConnect(_0x32139b);_0x32139b[_0x719e('0x54')](_0x719e('0x62'));});}; \ No newline at end of file +var _0xcf9a=['findAll','Trunks','resourceId','map','User','where','Campaign','type','%s:queue:%s','length','format','user:%s','handshake','query','find','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcf9a,0x122));var _0xacf9=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcf9a[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xacf9('0x0'));var util=require('util');var BPromise=require(_0xacf9('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xacf9('0x2')],'include':[{'as':_0xacf9('0x3'),'model':db['User'],'attributes':['id',_0xacf9('0x2'),_0xacf9('0x4')],'raw':!![],'where':{'role':_0xacf9('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xacf9('0x2')],'where':{'role':_0xacf9('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xacf9('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xacf9('0x2'),'type'],'where':{'type':_0xacf9('0x7')}};function getAssociatedResources(_0x205d7a,_0x460c79,_0x52573c){return db[_0xacf9('0x8')][_0xacf9('0x9')]({'where':{'name':_0x205d7a,'userProfileId':_0x460c79},'raw':!![]})[_0xacf9('0xa')](function(_0x18bf22){if(_0x18bf22){if(_0x18bf22[_0xacf9('0xb')]){switch(_0x205d7a){case _0xacf9('0xc'):case _0xacf9('0xd'):case _0xacf9('0xe'):case _0xacf9('0xf'):case _0xacf9('0x10'):case _0xacf9('0x11'):case'WhatsappQueues':return db[_0x52573c]['findAll'](queryQueues);case _0xacf9('0x12'):return db[_0x52573c][_0xacf9('0x13')](queryTelephones);case _0xacf9('0x14'):return db[_0x52573c]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x52573c][_0xacf9('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0xacf9('0x13')]({'attributes':[_0xacf9('0x15')],'where':{'sectionId':_0x18bf22['id']},'raw':!![]})[_0xacf9('0xa')](function(_0x26098f){if(_0x26098f){var _0x382064={'where':{'id':_[_0xacf9('0x16')](_0x26098f,_0xacf9('0x15'))},'raw':!![]};switch(_0x52573c){case _0xacf9('0x17'):_0x382064[_0xacf9('0x18')][_0xacf9('0x4')]=_0xacf9('0x6');break;case _0xacf9('0x19'):_0x382064[_0xacf9('0x18')][_0xacf9('0x1a')]=_0xacf9('0x7');break;}return db[_0x52573c]['findAll'](_0x382064);}else{return[];}});}}else{return[];}})[_0xacf9('0xa')](function(_0x2cefba){return _0x2cefba;});}function joinOrLeaveQueues(_0x52867e,_0x3f3461,_0x4add1e,_0x51796f){_0x52867e[_0x3f3461](util['format'](_0xacf9('0x1b'),_0x4add1e,_0x51796f[_0xacf9('0x2')]));if(_0x51796f['Agents']){for(var _0x21eccd=0x0;_0x21eccd<_0x51796f['Agents'][_0xacf9('0x1c')];_0x21eccd+=0x1){_0x52867e[_0x3f3461](util[_0xacf9('0x1d')](_0xacf9('0x1e'),_0x51796f['Agents'][_0x21eccd][_0xacf9('0x2')]));}}}function joinOrLeave(_0x484309,_0x5afdb4,_0x294dea){var _0x24fce1;if(_0x484309[_0xacf9('0x1f')][_0xacf9('0x20')]['id']){db[_0xacf9('0x17')][_0xacf9('0x21')]({'attributes':['id',_0xacf9('0x2'),_0xacf9('0x4'),'userProfileId'],'where':{'id':_0x484309[_0xacf9('0x1f')][_0xacf9('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xacf9('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xacf9('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xacf9('0x24')],'as':_0xacf9('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xacf9('0x26')],'as':_0xacf9('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xacf9('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xacf9('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xacf9('0xa')](function(_0x4c6db7){if(_0x4c6db7){_0x24fce1=_0x4c6db7;_0x484309[_0x5afdb4](util[_0xacf9('0x1d')](_0xacf9('0x1e'),_0x4c6db7['name']));var _0x440bda=[];switch(_0x4c6db7['role']){case _0xacf9('0x2a'):_0x484309[_0x5afdb4](_0xacf9('0x2b'));_0x484309[_0x5afdb4](_0xacf9('0x2c'));if(queryQueues[_0xacf9('0x2d')]('include')){delete queryQueues[_0xacf9('0x2e')];}_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x30')][_0xacf9('0x13')](queryQueues));_0x440bda['push'](db[_0xacf9('0x31')][_0xacf9('0x13')](queryQueues));_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x32')][_0xacf9('0x13')](queryQueues));_0x440bda[_0xacf9('0x2f')](db['SmsQueue'][_0xacf9('0x13')](queryQueues));_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x33')]['findAll'](queryQueues));_0x440bda['push'](db[_0xacf9('0x34')][_0xacf9('0x13')](queryQueues));_0x440bda['push'](db[_0xacf9('0x35')][_0xacf9('0x13')](queryQueues));_0x440bda['push'](db['User'][_0xacf9('0x13')](queryTelephones));_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x36')]['findAll'](queryTrunks));_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x19')][_0xacf9('0x13')](queryCampaigns));_0x440bda['push'](db[_0xacf9('0x17')][_0xacf9('0x13')](queryAgents));break;case _0xacf9('0x37'):_0x484309[_0x5afdb4](_0xacf9('0x2b'));_0x484309[_0x5afdb4](_0xacf9('0x2c'));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0xc'),_0x4c6db7[_0xacf9('0x38')],'VoiceQueue'));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0xd'),_0x4c6db7[_0xacf9('0x38')],_0xacf9('0x31')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0xe'),_0x4c6db7[_0xacf9('0x38')],_0xacf9('0x32')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources('SmsQueues',_0x4c6db7[_0xacf9('0x38')],'SmsQueue'));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0x10'),_0x4c6db7['userProfileId'],_0xacf9('0x33')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources('OpenchannelQueues',_0x4c6db7['userProfileId'],_0xacf9('0x34')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0x39'),_0x4c6db7[_0xacf9('0x38')],_0xacf9('0x35')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0x12'),_0x4c6db7[_0xacf9('0x38')],_0xacf9('0x17')));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0x14'),_0x4c6db7[_0xacf9('0x38')],'Trunk'));_0x440bda[_0xacf9('0x2f')](getAssociatedResources(_0xacf9('0x3a'),_0x4c6db7[_0xacf9('0x38')],_0xacf9('0x19')));_0x440bda[_0xacf9('0x2f')](db[_0xacf9('0x17')]['findAll'](queryAgents));break;case'agent':_0x484309[_0x5afdb4](_0xacf9('0x2b'));_0x484309[_0x5afdb4](_0xacf9('0x2c'));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x3b')]({'attributes':['id',_0xacf9('0x2')]}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x3c')]({'attributes':['id',_0xacf9('0x2')]}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x3d')]({'attributes':['id','name']}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x3e')]({'attributes':['id',_0xacf9('0x2')]}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x3f')]({'attributes':['id',_0xacf9('0x2')]}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7['getOpenchannelQueues']({'attributes':['id','name']}));_0x440bda[_0xacf9('0x2f')](_0x4c6db7[_0xacf9('0x40')]({'attributes':['id',_0xacf9('0x2')]}));break;}return BPromise['all'](_0x440bda);}})[_0xacf9('0xa')](function(_0x50b324){if(_0x50b324&&_0x50b324['length']){for(var _0x2c43fa=0x0;_0x2c43fa<_0x50b324[_0xacf9('0x1c')];_0x2c43fa+=0x1){for(var _0x132932=0x0;_0x132932<_0x50b324[_0x2c43fa][_0xacf9('0x1c')];_0x132932+=0x1){switch(_0x2c43fa){case 0x0:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x41'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x1:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x42'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x2:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x43'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x3:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x44'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x4:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x45'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x5:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x46'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x6:joinOrLeaveQueues(_0x484309,_0x5afdb4,_0xacf9('0x47'),_0x50b324[_0x2c43fa][_0x132932]);break;case 0x7:if(_0x24fce1[_0xacf9('0x4')]!==_0xacf9('0x5'))_0x484309[_0x5afdb4](util[_0xacf9('0x1d')](_0xacf9('0x48'),_0x50b324[_0x2c43fa][_0x132932]['name']));break;case 0x8:if(_0x24fce1['role']!=='agent')_0x484309[_0x5afdb4](util[_0xacf9('0x1d')]('trunk:%s',_0x50b324[_0x2c43fa][_0x132932][_0xacf9('0x2')]));break;case 0x9:if(_0x24fce1[_0xacf9('0x4')]!=='agent')_0x484309[_0x5afdb4](util[_0xacf9('0x1d')](_0xacf9('0x49'),_0x50b324[_0x2c43fa][_0x132932][_0xacf9('0x1a')],_0x50b324[_0x2c43fa][_0x132932]['name']));break;case 0xa:_0x484309[_0x5afdb4](util['format']('user:%s',_0x50b324[_0x2c43fa][_0x132932]['name']));break;}}}}})['then'](function(){if(_0x5afdb4===_0xacf9('0x4a')){var _0x19821e=_[_0xacf9('0x16')](_0x24fce1['ChatInteractions'],'id');return _0x24fce1[_0xacf9('0x4b')](_0x19821e)[_0xacf9('0xa')](function(){for(var _0x1d18c4=0x0;_0x1d18c4<_0x19821e[_0xacf9('0x1c')];_0x1d18c4+=0x1){_0x294dea[_0xacf9('0x4c')](_0xacf9('0x4d'),{'ChatInteractionId':Number(_0x19821e[_0x1d18c4]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0xa')](function(){if(_0x5afdb4===_0xacf9('0x4a')){var _0x5e37a9=_[_0xacf9('0x16')](_0x24fce1[_0xacf9('0x23')],'id');return _0x24fce1[_0xacf9('0x4e')](_0x5e37a9)['then'](function(){for(var _0x156bc1=0x0;_0x156bc1<_0x5e37a9[_0xacf9('0x1c')];_0x156bc1+=0x1){_0x294dea[_0xacf9('0x4c')](_0xacf9('0x4f'),{'MailInteractionId':Number(_0x5e37a9[_0x156bc1]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0xa')](function(){if(_0x5afdb4===_0xacf9('0x4a')){var _0x5ba9d7=_[_0xacf9('0x16')](_0x24fce1[_0xacf9('0x25')],'id');return _0x24fce1[_0xacf9('0x50')](_0x5ba9d7)[_0xacf9('0xa')](function(){for(var _0x189aa5=0x0;_0x189aa5<_0x5ba9d7[_0xacf9('0x1c')];_0x189aa5+=0x1){_0x294dea[_0xacf9('0x4c')](_0xacf9('0x51'),{'FaxInteractionId':Number(_0x5ba9d7[_0x189aa5]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0xa')](function(){if(_0x5afdb4===_0xacf9('0x4a')){var _0x227650=_[_0xacf9('0x16')](_0x24fce1[_0xacf9('0x27')],'id');return _0x24fce1[_0xacf9('0x52')](_0x227650)[_0xacf9('0xa')](function(){for(var _0x39c138=0x0;_0x39c138<_0x227650['length'];_0x39c138+=0x1){_0x294dea[_0xacf9('0x4c')](_0xacf9('0x53'),{'SmsInteractionId':Number(_0x227650[_0x39c138]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0xa')](function(){if(_0x5afdb4==='leave'){var _0x266d92=_['map'](_0x24fce1[_0xacf9('0x28')],'id');return _0x24fce1[_0xacf9('0x54')](_0x266d92)[_0xacf9('0xa')](function(){for(var _0x117cf7=0x0;_0x117cf7<_0x266d92['length'];_0x117cf7+=0x1){_0x294dea['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x266d92[_0x117cf7]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0xa')](function(){if(_0x5afdb4===_0xacf9('0x4a')){var _0x5d85dd=_['map'](_0x24fce1[_0xacf9('0x55')],'id');return _0x24fce1[_0xacf9('0x56')](_0x5d85dd)[_0xacf9('0xa')](function(){for(var _0x226c46=0x0;_0x226c46<_0x5d85dd[_0xacf9('0x1c')];_0x226c46+=0x1){_0x294dea['emit'](_0xacf9('0x57'),{'WhatsappInteractionId':Number(_0x5d85dd[_0x226c46]),'UserId':Number(_0x24fce1['id'])});}});}})[_0xacf9('0x58')](function(_0x4fd228){_0x484309[_0xacf9('0x59')](_0x4fd228);});}}function onDisconnect(_0x45c057,_0x3f2836){joinOrLeave(_0x45c057,'leave',_0x3f2836);}function onConnect(_0x2a2974){joinOrLeave(_0x2a2974,'join');}exports[_0xacf9('0x5a')]=function(_0x10785e){_0x10785e['on']('connection',function(_0x1e7959){_0x1e7959[_0xacf9('0x5b')](0x0);_0x1e7959[_0xacf9('0x5c')]=_0x1e7959[_0xacf9('0x5d')][_0xacf9('0x5e')][_0xacf9('0x5f')]+':'+_0x1e7959['request'][_0xacf9('0x5e')][_0xacf9('0x60')];_0x1e7959[_0xacf9('0x61')]=new Date();_0x1e7959['log']=function(_0x848f08){console['log'](_0xacf9('0x62')+_0x1e7959[_0xacf9('0x63')]['name']+'['+_0x1e7959[_0xacf9('0x5c')]+']',_0x848f08);};_0x1e7959['on'](_0xacf9('0x64'),function(){onDisconnect(_0x1e7959,_0x10785e);_0x1e7959[_0xacf9('0x59')](_0xacf9('0x65'));});onConnect(_0x1e7959);_0x1e7959['log'](_0xacf9('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a11964a..aca2a49 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 _0x0986=['event','direction','UserId','User','name','SIP/%s','incomingmessage','outgoingmessage','changed','closed','find','default','length','hasOwnProperty','hook','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','Whatsapp','Fax','FaxMessage','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','get','channel'];(function(_0x48f66b,_0x101788){var _0x5af045=function(_0x586662){while(--_0x586662){_0x48f66b['push'](_0x48f66b['shift']());}};_0x5af045(++_0x101788);}(_0x0986,0x75));var _0x6098=function(_0x100ded,_0x57203b){_0x100ded=_0x100ded-0x0;var _0x5bc03f=_0x0986[_0x100ded];return _0x5bc03f;};'use strict';var util=require('util');var db=require(_0x6098('0x0'))['db'];var jayson=require(_0x6098('0x1'));var logger=require(_0x6098('0x2'))(_0x6098('0x3'));var client=jayson['client'][_0x6098('0x4')]({'port':0x232a});var triggers=[{'channel':_0x6098('0x5'),'model':_0x6098('0x6'),'event':_0x6098('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6098('0x5'),'model':'ChatInteraction','event':_0x6098('0x8'),'condition':_0x6098('0x9'),'callback':afterUpdate},{'channel':_0x6098('0x5'),'model':_0x6098('0xa'),'event':'afterCreate','condition':_0x6098('0xb'),'callback':afterCreateMessage},{'channel':_0x6098('0xc'),'model':_0x6098('0xd'),'event':'afterCreate','condition':_0x6098('0xe'),'callback':afterCreate},{'channel':_0x6098('0xc'),'model':_0x6098('0xd'),'event':_0x6098('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6098('0xc'),'model':'SmsMessage','event':_0x6098('0x7'),'condition':_0x6098('0xb'),'callback':afterCreateMessage},{'channel':_0x6098('0xf'),'model':'WhatsappInteraction','event':_0x6098('0x7'),'condition':_0x6098('0xe'),'callback':afterCreate},{'channel':_0x6098('0xf'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x6098('0x9'),'callback':afterUpdate},{'channel':_0x6098('0xf'),'model':'WhatsappMessage','event':'afterCreate','condition':_0x6098('0xb'),'callback':afterCreateMessage},{'channel':_0x6098('0x10'),'model':'FaxInteraction','event':_0x6098('0x7'),'condition':_0x6098('0xe'),'callback':afterCreate},{'channel':_0x6098('0x10'),'model':'FaxInteraction','event':_0x6098('0x8'),'condition':_0x6098('0x9'),'callback':afterUpdate},{'channel':_0x6098('0x10'),'model':_0x6098('0x11'),'event':_0x6098('0x7'),'condition':_0x6098('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x6098('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x6098('0x12'),'event':_0x6098('0x8'),'condition':_0x6098('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x6098('0x13'),'event':'afterCreate','condition':_0x6098('0xb'),'callback':afterCreateMessage},{'channel':_0x6098('0x14'),'model':_0x6098('0x15'),'event':_0x6098('0x7'),'condition':_0x6098('0xe'),'callback':afterCreate},{'channel':_0x6098('0x14'),'model':_0x6098('0x15'),'event':_0x6098('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6098('0x14'),'model':_0x6098('0x16'),'event':_0x6098('0x7'),'condition':_0x6098('0xb'),'callback':afterCreateMessage}];function request(_0x3f7e55){return client[_0x6098('0x17')](_0x6098('0x18'),_0x3f7e55)[_0x6098('0x19')](function(_0x483a6c){logger[_0x6098('0x1a')]('Trigger,\x20%s',_0x6098('0x18'),_0x483a6c);if(_0x483a6c[_0x6098('0x1b')]){if(_0x483a6c[_0x6098('0x1b')][_0x6098('0x1c')]===0x1f4){logger[_0x6098('0x1b')]('Trigger,\x20%s',_0x6098('0x18'),_0x483a6c[_0x6098('0x1b')]);}}})[_0x6098('0x1d')](function(_0x2359fb){logger['error'](_0x6098('0x1e'),_0x6098('0x18'),_0x2359fb);});}function afterCreateMessage(_0x3a930d,_0x30c9ed){return function(_0x59884c,_0x1362a4){_0x59884c=_0x59884c[_0x6098('0x1f')]({'plain':!![]});_0x59884c[_0x6098('0x20')]=_0x3a930d;_0x59884c[_0x6098('0x21')]=_0x59884c[_0x6098('0x22')];if(_0x59884c[_0x6098('0x23')]){return db[_0x6098('0x24')]['find']({'where':{'id':_0x59884c[_0x6098('0x23')]},'attributes':['id',_0x6098('0x25')],'raw':!![]})[_0x6098('0x19')](function(_0x5ed306){_0x59884c['interface']=util['format'](_0x6098('0x26'),_0x5ed306[_0x6098('0x25')]);_0x59884c[_0x6098('0x20')]=_0x3a930d;return request({'event':_0x6098('0x27'),'message':_0x59884c});})[_0x6098('0x1d')](function(_0x1f8f6e){console[_0x6098('0x1b')](_0x1f8f6e);});}else{return request({'event':_0x6098('0x28'),'message':_0x59884c});}};}function afterCreate(_0xdf5dac,_0x4f8495){return function(_0x46dfb6,_0x479f39){_0x46dfb6=_0x46dfb6[_0x6098('0x1f')]({'plain':!![]});_0x46dfb6['channel']=_0xdf5dac;_0x46dfb6[_0x6098('0x21')]='opened';return request({'event':_0x4f8495,'message':_0x46dfb6});};}function afterUpdate(_0x5d71a5,_0xb63258){return function(_0x1d626e,_0x4e8c6b){if(_0x1d626e[_0x6098('0x29')](_0x6098('0x2a'))&&_0x1d626e['closed']){_0x1d626e=_0x1d626e[_0x6098('0x1f')]({'plain':!![]});_0x1d626e[_0x6098('0x20')]=_0x5d71a5;_0x1d626e[_0x6098('0x21')]='closed';if(_0x1d626e[_0x6098('0x23')]){return db[_0x6098('0x24')][_0x6098('0x2b')]({'where':{'id':_0x1d626e['UserId']},'attributes':['id',_0x6098('0x25')],'raw':!![]})['then'](function(_0x4d7b66){_0x1d626e['interface']=util['format'](_0x6098('0x26'),_0x4d7b66[_0x6098('0x25')]);return request({'event':_0xb63258,'message':_0x1d626e});})[_0x6098('0x1d')](function(_0x3b08a4){console[_0x6098('0x1b')](_0x3b08a4);});}else{return request({'event':_0xb63258,'message':_0x1d626e});}}};}exports[_0x6098('0x2c')]=function(){for(var _0x5a6a34=0x0;_0x5a6a34=_0x901080[_0x02db('0x12')]){throw Error(_0x02db('0x13'));}_0x371b7e(_0x205c16);})[_0x02db('0x14')](function(_0x41ca9a){_0x1f947a(_0x41ca9a);});});}; \ No newline at end of file +var _0xada7=['includes','blockedAt','updateAttributes','role','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','fax','sms','whatsapp','getChannels','isValidChannel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xada7,0x14d));var _0x7ada=function(_0x27fdc8,_0x37e0c3){_0x27fdc8=_0x27fdc8-0x0;var _0x46622e=_0xada7[_0x27fdc8];return _0x46622e;};'use strict';var _=require(_0x7ada('0x0'));var BPromise=require(_0x7ada('0x1'));var db=require(_0x7ada('0x2'))['db'];var util=require(_0x7ada('0x3'));var channels=['voice','mail','chat',_0x7ada('0x4'),_0x7ada('0x5'),_0x7ada('0x6'),'openchannel'];exports[_0x7ada('0x7')]=function(){return channels;};exports[_0x7ada('0x8')]=function(_0x27246f){_0x27246f=_0x27246f['toLowerCase']();return _[_0x7ada('0x9')](channels,_0x27246f);};exports['clearBlockUser']=function(_0x24fd5d,_0x506958,_0x10f5b4,_0x26ea21){var _0x1c631b={'loginAttempts':_0x506958,'blocked':_0x10f5b4};if(!_['isUndefined'](_0x26ea21)){_0x1c631b[_0x7ada('0xa')]=_0x26ea21;}return _0x24fd5d[_0x7ada('0xb')](_0x1c631b);};exports['getLicense']=function(_0x1fe863){return new BPromise(function(_0x28c1ee,_0x96105a){var _0xb382fa=0x0;if(_0x1fe863[_0x7ada('0xc')]!=='agent'){_0x28c1ee(_0x1fe863);}db[_0x7ada('0xd')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1fe863['id']}}})[_0x7ada('0xe')](function(_0x4c8a28){_0xb382fa=_0x4c8a28;return util[_0x7ada('0xf')]();})[_0x7ada('0xe')](function(_0x1ebbff){if(_0x1ebbff&&_0x1ebbff[_0x7ada('0x10')]&&_0xb382fa>=_0x1ebbff[_0x7ada('0x10')]){throw Error(_0x7ada('0x11'));}_0x28c1ee(_0x1fe863);})[_0x7ada('0x12')](function(_0x59a38b){_0x96105a(_0x59a38b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a5ac0eb..02a89cc 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b70=['status','json','send','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b70,0x8b));var _0x07b7=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x7b70[_0x17406a];return _0x1501ff;};'use strict';module[_0x07b7('0x0')][0x194]=function pageNotFound(_0x2b9271,_0xf93ea7){var _0x54ab97='404';var _0x2c9f1d=0x194;var _0x105d98={'status':_0x2c9f1d};_0xf93ea7[_0x07b7('0x1')](_0x105d98[_0x07b7('0x1')]);_0xf93ea7['render'](_0x54ab97,{},function(_0x1e6430,_0x1e9539){if(_0x1e6430){return _0xf93ea7[_0x07b7('0x1')](_0x105d98['status'])[_0x07b7('0x2')](_0x105d98);}_0xf93ea7[_0x07b7('0x3')](_0x1e9539);});}; \ No newline at end of file +var _0x2c73=['status','render','json','send','exports','404'];(function(_0x3a7553,_0x2c7660){var _0x4d912c=function(_0x5e8bc5){while(--_0x5e8bc5){_0x3a7553['push'](_0x3a7553['shift']());}};_0x4d912c(++_0x2c7660);}(_0x2c73,0x100));var _0x32c7=function(_0x4f4ca5,_0x4c02b8){_0x4f4ca5=_0x4f4ca5-0x0;var _0x4a2021=_0x2c73[_0x4f4ca5];return _0x4a2021;};'use strict';module[_0x32c7('0x0')][0x194]=function pageNotFound(_0x505a7f,_0xe9dca1){var _0x544ba2=_0x32c7('0x1');var _0x5a77a3=0x194;var _0x1e38ac={'status':_0x5a77a3};_0xe9dca1[_0x32c7('0x2')](_0x1e38ac[_0x32c7('0x2')]);_0xe9dca1[_0x32c7('0x3')](_0x544ba2,{},function(_0x2861fd,_0x228be2){if(_0x2861fd){return _0xe9dca1[_0x32c7('0x2')](_0x1e38ac[_0x32c7('0x2')])[_0x32c7('0x4')](_0x1e38ac);}_0xe9dca1[_0x32c7('0x5')](_0x228be2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0197514..3c05535 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0df=['defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Contacts','Lists','cm_user_has_lists','ChatInteractions','user_has_chat_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_square_projects','SpiedAgents','Applications','moh_has_sounds','VoiceQueueId','Hoppers','CmHopperBlack','JscriptySessions','TrunkBackupId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailServerIn','MailServerOut','MailAccountId','Imap','Smtp','Dispositions','List','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Attachments','MailMessage','ChatOfflineMessageId','restrict','ListId','FaxAccountId','Answers','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','TagId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','chat_group_has_users','CmCompany','CompanyId','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyConditions','TriggerId','AnalyticFieldReport','Fields','MetricId','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','VariableId','Configurations','Description','Subjects','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','ToId','SessionId','JscriptyProject','ProjectId','user_has_teams','team_has_whatsapp_queues','TrunkId','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromAccount','ChatTransferReport','ToAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','userProfileId','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0xa0df,0x1f1));var _0xfa0d=function(_0x4c8647,_0x59f24d){_0x4c8647=_0x4c8647-0x0;var _0x3f11a4=_0xa0df[_0x4c8647];return _0x3f11a4;};'use strict';var path=require(_0xfa0d('0x0'));var config=require(_0xfa0d('0x1'));var Sequelize=require(_0xfa0d('0x2'));var _=require(_0xfa0d('0x3'));var jstz=require(_0xfa0d('0x4'));var timezone=jstz[_0xfa0d('0x5')]();config[_0xfa0d('0x2')]=_[_0xfa0d('0x6')](config[_0xfa0d('0x2')],{'database':'motion2','username':_0xfa0d('0x7'),'password':_0xfa0d('0x8'),'options':{'host':_0xfa0d('0x9'),'port':0xcea,'dialect':_0xfa0d('0xa'),'dialectOptions':{'charset':_0xfa0d('0xb')},'logging':![],'timezone':timezone[_0xfa0d('0xc')](),'define':{'charset':_0xfa0d('0xd'),'collate':_0xfa0d('0xe')}}});config[_0xfa0d('0xf')]=_[_0xfa0d('0x6')](config[_0xfa0d('0xf')],{'database':_0xfa0d('0x10'),'username':'xcall','password':_0xfa0d('0x8'),'options':{'host':_0xfa0d('0x9'),'port':0xcea,'dialect':_0xfa0d('0xa'),'dialectOptions':{'charset':_0xfa0d('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xfa0d('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfa0d('0x2')][_0xfa0d('0x11')],config[_0xfa0d('0x2')][_0xfa0d('0x12')],config[_0xfa0d('0x2')][_0xfa0d('0x13')],config[_0xfa0d('0x2')][_0xfa0d('0x14')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfa0d('0xf')][_0xfa0d('0x11')],config['sequelizeHistory'][_0xfa0d('0x12')],config[_0xfa0d('0xf')][_0xfa0d('0x13')],config[_0xfa0d('0xf')][_0xfa0d('0x14')])};db[_0xfa0d('0x15')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x17'));db[_0xfa0d('0x18')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x19'));db[_0xfa0d('0x1a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x1b'));db[_0xfa0d('0x1c')]=db['sequelize']['import'](_0xfa0d('0x1d'));db[_0xfa0d('0x1e')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x1f'));db[_0xfa0d('0x20')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x21'));db[_0xfa0d('0x22')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x23'));db[_0xfa0d('0x24')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x25'));db['VoiceMail']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x26'));db[_0xfa0d('0x27')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x28'));db[_0xfa0d('0x29')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/voiceCallReport/voiceCallReport.model');db[_0xfa0d('0x2a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x2b'));db['VoiceAgentReport']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x2c'));db['VoiceQueueReport']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x2d'));db['MemberReport']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x2e'));db[_0xfa0d('0x2f')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x30'));db['VoiceTransferReport']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x31'));db[_0xfa0d('0x32')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x33'));db[_0xfa0d('0x34')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x35'));db[_0xfa0d('0x36')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x37'));db[_0xfa0d('0x38')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x39'));db[_0xfa0d('0x3a')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x3b'));db[_0xfa0d('0x3c')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x3d'));db[_0xfa0d('0x3e')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x3f'));db['UserWhatsappQueue']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x40'));db['MailServerOut']=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0xfa0d('0x41')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x42'));db['MailQueue']=db[_0xfa0d('0x2')]['import']('../api/mailQueue/mailQueue.model');db[_0xfa0d('0x43')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x44'));db[_0xfa0d('0x45')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x46'));db['MailMessage']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x47'));db[_0xfa0d('0x48')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x49'));db[_0xfa0d('0x4a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x4b'));db[_0xfa0d('0x4c')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x4d'));db[_0xfa0d('0x4e')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x4f'));db[_0xfa0d('0x50')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/faxAccount/faxAccount.model');db[_0xfa0d('0x51')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x52'));db['FaxInteraction']=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x53'));db[_0xfa0d('0x54')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x55'));db[_0xfa0d('0x56')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x57'));db[_0xfa0d('0x58')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x59'));db[_0xfa0d('0x5a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x5b'));db[_0xfa0d('0x5c')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x5d'));db[_0xfa0d('0x5e')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x5f'));db['SmsMessage']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x60'));db[_0xfa0d('0x61')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/smsQueue/smsQueue.model');db[_0xfa0d('0x62')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x63'));db[_0xfa0d('0x64')]=db['sequelize']['import'](_0xfa0d('0x65'));db[_0xfa0d('0x66')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x67'));db[_0xfa0d('0x68')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x69'));db['OpenchannelQueue']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x6a'));db[_0xfa0d('0x6b')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x6c'));db[_0xfa0d('0x6d')]=db['sequelize']['import'](_0xfa0d('0x6e'));db['ChatApplication']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x6f'));db['ChatInteraction']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0xfa0d('0x70')]=db['sequelize']['import'](_0xfa0d('0x71'));db[_0xfa0d('0x72')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x73'));db[_0xfa0d('0x74')]=db[_0xfa0d('0x2')]['import']('../api/chatQueue/chatQueue.model');db[_0xfa0d('0x75')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/chatGroup/chatGroup.model');db[_0xfa0d('0x76')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x77'));db['CmCompany']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/cmCompany/cmCompany.model');db[_0xfa0d('0x78')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x79'));db[_0xfa0d('0x7a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x7b'));db['CmHopperBlack']=db['sequelize']['import'](_0xfa0d('0x7c'));db[_0xfa0d('0x7d')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x7e'));db[_0xfa0d('0x7f')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x80'));db['ReportAgentPreview']=db['sequelize'][_0xfa0d('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xfa0d('0x81')]=db['sequelize'][_0xfa0d('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0xfa0d('0x82')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x83'));db[_0xfa0d('0x84')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x85'));db[_0xfa0d('0x86')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x87'));db[_0xfa0d('0x88')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x89'));db[_0xfa0d('0x8a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x8b'));db[_0xfa0d('0x8c')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x8d'));db[_0xfa0d('0x8e')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x8f'));db[_0xfa0d('0x90')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x91'));db[_0xfa0d('0x92')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x93'));db[_0xfa0d('0x94')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x95'));db[_0xfa0d('0x96')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x97'));db['Tag']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x98'));db[_0xfa0d('0x99')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x9a'));db[_0xfa0d('0x9b')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x9c'));db['Variable']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x9d'));db[_0xfa0d('0x9e')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x9f'));db[_0xfa0d('0xa0')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/integrationReport/integrationReport.model');db[_0xfa0d('0xa1')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xa2'));db[_0xfa0d('0xa3')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xa4'));db[_0xfa0d('0xa5')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xa6'));db['AnalyticFieldReport']=db['sequelize']['import'](_0xfa0d('0xa7'));db[_0xfa0d('0xa8')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xa9'));db[_0xfa0d('0xaa')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xab'));db[_0xfa0d('0xac')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xad'));db['SalesforceField']=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xfa0d('0xae')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xfa0d('0xaf')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xb0'));db[_0xfa0d('0xb1')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xb2'));db[_0xfa0d('0xb3')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/intDeskAccount/intDeskAccount.model');db[_0xfa0d('0xb4')]=db[_0xfa0d('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xfa0d('0xb5')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xb6'));db['ZohoAccount']=db[_0xfa0d('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xb7'));db['ZohoField']=db[_0xfa0d('0x2')]['import']('../api/intZohoField/intZohoField.model');db[_0xfa0d('0xb8')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xb9'));db[_0xfa0d('0xba')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xbb'));db['ZendeskField']=db[_0xfa0d('0x2')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xfa0d('0xbc')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xbd'));db[_0xfa0d('0xbe')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xbf'));db['FreshdeskField']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xc0'));db[_0xfa0d('0xc1')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xc2'));db[_0xfa0d('0xc3')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xc4'));db[_0xfa0d('0xc5')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xc6'));db[_0xfa0d('0xc7')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xc8'));db['ServicenowConfiguration']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xfa0d('0xc9')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xca'));db[_0xfa0d('0xcb')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xcc'));db['Dynamics365Configuration']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xcd'));db['Dynamics365Field']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xce'));db[_0xfa0d('0xcf')]=db['sequelize']['import'](_0xfa0d('0xd0'));db[_0xfa0d('0xd1')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xd2'));db[_0xfa0d('0xd3')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xfa0d('0x2')]['import'](_0xfa0d('0x9f'));db[_0xfa0d('0xd4')]=db['sequelize'][_0xfa0d('0x16')]('../api/network/network.model');db[_0xfa0d('0xd5')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xd6'));db['ChatInternalMessage']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xfa0d('0xd7')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xd8'));db[_0xfa0d('0xd9')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xda'));db[_0xfa0d('0xdb')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xfa0d('0xdc')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xdd'));db[_0xfa0d('0xde')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xdf'));db[_0xfa0d('0xe0')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xe1'));db['JscriptyProject']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xe2'));db[_0xfa0d('0xe3')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xe4'));db[_0xfa0d('0xe5')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xe6'));db[_0xfa0d('0xe7')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/squareProject/squareProject.model');db[_0xfa0d('0xe8')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xe9'));db['SquareMessage']=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/squareMessage/squareMessage.model');db[_0xfa0d('0xea')]=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xeb'));db[_0xfa0d('0xec')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xed'));db[_0xfa0d('0xee')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xef'));db[_0xfa0d('0xf0')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xf1'));db[_0xfa0d('0xf2')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xf3'));db['Plugin']=db['sequelize'][_0xfa0d('0x16')]('../api/plugin/plugin.model');db[_0xfa0d('0xf4')]=db['sequelize'][_0xfa0d('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xfa0d('0x2')]['import'](_0xfa0d('0xf5'));db['FaxTransferReport']=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0xf6'));db[_0xfa0d('0xf7')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xf8'));db[_0xfa0d('0xf9')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0xfa0d('0xfa')]=db['sequelize'][_0xfa0d('0x16')]('../api/cmList/cmList.model');db[_0xfa0d('0xfb')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xfc'));db[_0xfa0d('0xfd')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/userProfile/userProfile.model');db[_0xfa0d('0xfe')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0xff'));db[_0xfa0d('0x100')]=db['sequelize'][_0xfa0d('0x16')](_0xfa0d('0x101'));db[_0xfa0d('0x102')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x103'));db[_0xfa0d('0x104')]=db['sequelize']['import'](_0xfa0d('0x105'));db[_0xfa0d('0x106')]=db[_0xfa0d('0x2')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xfa0d('0x107')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x108'));db[_0xfa0d('0x109')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0xfa0d('0x10a')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xfa0d('0x10b')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x10c'));db[_0xfa0d('0x10d')]=db[_0xfa0d('0x2')][_0xfa0d('0x16')]('../api/whatsappQueue/whatsappQueue.model');db[_0xfa0d('0x10e')]=db['sequelize']['import'](_0xfa0d('0x10f'));db['TeamVoiceQueue']=db[_0xfa0d('0x2')][_0xfa0d('0x16')](_0xfa0d('0x110'));db[_0xfa0d('0x15')][_0xfa0d('0x111')](db[_0xfa0d('0x112')],{'as':_0xfa0d('0x112'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x15')][_0xfa0d('0x115')](db[_0xfa0d('0x22')],{'as':'Recordings','foreignKey':_0xfa0d('0x114')});db['User'][_0xfa0d('0x115')](db[_0xfa0d('0x32')],{'as':_0xfa0d('0x116'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x15')]['hasMany'](db[_0xfa0d('0x1c')],{'as':_0xfa0d('0x117'),'onDelete':_0xfa0d('0x113'),'hooks':!![]});db['User'][_0xfa0d('0x115')](db['CmHopperFinal'],{'as':_0xfa0d('0x118'),'foreignKey':'UserId'});db['User'][_0xfa0d('0x115')](db[_0xfa0d('0x7f')],{'as':_0xfa0d('0x119'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x15')][_0xfa0d('0x115')](db[_0xfa0d('0x11a')],{'as':_0xfa0d('0x11a'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xfa0d('0x66')],{'as':_0xfa0d('0x11b'),'foreignKey':_0xfa0d('0x114')});db['User'][_0xfa0d('0x115')](db[_0xfa0d('0x11c')],{'as':'ChatInteractions','foreignKey':_0xfa0d('0x114')});db['User'][_0xfa0d('0x115')](db[_0xfa0d('0x5e')],{'as':_0xfa0d('0x11d'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x15')]['hasMany'](db[_0xfa0d('0x11e')],{'as':_0xfa0d('0x11f'),'foreignKey':'UserId'});db[_0xfa0d('0x15')][_0xfa0d('0x115')](db[_0xfa0d('0x45')],{'as':_0xfa0d('0x120'),'foreignKey':_0xfa0d('0x114')});db['User'][_0xfa0d('0x115')](db[_0xfa0d('0x107')],{'as':_0xfa0d('0x121'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x15')][_0xfa0d('0x115')](db[_0xfa0d('0x102')],{'as':_0xfa0d('0x122'),'foreignKey':_0xfa0d('0x123')});db[_0xfa0d('0x15')][_0xfa0d('0x124')](db[_0xfa0d('0xfd')],{'as':_0xfa0d('0xfd'),'foreignKey':'userProfileId'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x75')],{'as':'Groups','through':'chat_group_has_users'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db['CmContact'],{'as':_0xfa0d('0x126'),'through':'cm_user_has_contacts'});db[_0xfa0d('0x15')]['belongsToMany'](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x127'),'through':_0xfa0d('0x128')});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'through':'user_has_teams'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x45')],{'as':_0xfa0d('0x120'),'through':'user_has_mail_interactions'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x11c')],{'as':_0xfa0d('0x129'),'through':_0xfa0d('0x12a')});db[_0xfa0d('0x15')]['belongsToMany'](db[_0xfa0d('0x11e')],{'as':_0xfa0d('0x11f'),'through':'user_has_fax_interactions'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db['SmsInteraction'],{'as':_0xfa0d('0x11d'),'through':'user_has_sms_interactions'});db['User'][_0xfa0d('0x125')](db[_0xfa0d('0x66')],{'as':_0xfa0d('0x11b'),'through':_0xfa0d('0x12b')});db['User'][_0xfa0d('0x125')](db[_0xfa0d('0x107')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db['VoiceQueue'],{'as':_0xfa0d('0x12c'),'through':_0xfa0d('0x34'),'required':![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x12d')],{'as':_0xfa0d('0x12e'),'through':_0xfa0d('0x38'),'required':![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x74')],{'as':_0xfa0d('0x12f'),'through':_0xfa0d('0x36'),'required':![],'hooks':!![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db['FaxQueue'],{'as':_0xfa0d('0x130'),'through':_0xfa0d('0x3a'),'required':![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x61')],{'as':_0xfa0d('0x131'),'through':_0xfa0d('0x3c'),'required':![]});db[_0xfa0d('0x15')]['belongsToMany'](db[_0xfa0d('0x132')],{'as':_0xfa0d('0x133'),'through':_0xfa0d('0x3e'),'required':![]});db['User']['belongsToMany'](db[_0xfa0d('0x10d')],{'as':_0xfa0d('0x134'),'through':_0xfa0d('0x135'),'required':![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db['CmList'],{'through':_0xfa0d('0x128')});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0xfb')],{'as':'VoicePrefixes','through':_0xfa0d('0x136'),'required':![]});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x6b')],{'as':_0xfa0d('0x137'),'through':_0xfa0d('0x138')});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x50')],{'as':_0xfa0d('0x139'),'through':_0xfa0d('0x13a')});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0x41')],{'as':_0xfa0d('0x13b'),'through':_0xfa0d('0x13c')});db[_0xfa0d('0x15')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0xfa0d('0x13d'),'through':_0xfa0d('0x13e')});db['User'][_0xfa0d('0x125')](db[_0xfa0d('0x5a')],{'as':_0xfa0d('0x13f'),'through':_0xfa0d('0x140')});db['User'][_0xfa0d('0x125')](db[_0xfa0d('0x104')],{'as':_0xfa0d('0x141'),'through':'user_has_whatsapp_accounts'});db[_0xfa0d('0x15')][_0xfa0d('0x125')](db[_0xfa0d('0xe7')],{'as':'SquareProjects','through':_0xfa0d('0x142')});db[_0xfa0d('0x18')]['hasMany'](db['VoiceExtension'],{'as':_0xfa0d('0x143'),'onDelete':_0xfa0d('0x113'),'foreignKey':'ChanSpyId'});db[_0xfa0d('0x1a')][_0xfa0d('0x115')](db[_0xfa0d('0x1c')],{'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x1c')][_0xfa0d('0x115')](db[_0xfa0d('0x1c')],{'as':_0xfa0d('0x144'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x1e')][_0xfa0d('0x125')](db[_0xfa0d('0x96')],{'as':'Sounds','through':_0xfa0d('0x145')});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db[_0xfa0d('0x32')],{'as':'Members','foreignKey':_0xfa0d('0x146')});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db[_0xfa0d('0x7a')],{'as':_0xfa0d('0x147'),'foreignKey':_0xfa0d('0x146')});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db[_0xfa0d('0x7d')],{'as':'HopperFinals','foreignKey':_0xfa0d('0x146')});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xfa0d('0x146')});db[_0xfa0d('0x20')][_0xfa0d('0x115')](db[_0xfa0d('0x148')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xfa0d('0xdb')],{'as':_0xfa0d('0x149'),'foreignKey':_0xfa0d('0x146')});db['VoiceQueue'][_0xfa0d('0x124')](db[_0xfa0d('0x2f')],{'as':_0xfa0d('0x2f'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0xfa0d('0x124')](db[_0xfa0d('0x2f')],{'as':'TrunkBackup','foreignKey':_0xfa0d('0x14a')});db[_0xfa0d('0x20')][_0xfa0d('0x124')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xfa0d('0x20')][_0xfa0d('0x124')](db[_0xfa0d('0x8e')],{'as':_0xfa0d('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xfa0d('0x20')]['belongsToMany'](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x127'),'through':_0xfa0d('0x14c')});db[_0xfa0d('0x20')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xfa0d('0x34')});db[_0xfa0d('0x20')][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'as':_0xfa0d('0x14d'),'through':_0xfa0d('0x14e')});db['VoiceQueue']['belongsToMany'](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x14f'),'through':_0xfa0d('0x150')});db[_0xfa0d('0x22')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':'User','foreignKey':'UserId'});db['ScreenRecording'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':'User','foreignKey':'UserId'});db[_0xfa0d('0x112')]['hasMany'](db[_0xfa0d('0x27')],{'as':_0xfa0d('0x151'),'onDelete':'cascade','foreignKey':_0xfa0d('0x152'),'sourceKey':'mailbox'});db[_0xfa0d('0x27')][_0xfa0d('0x124')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xfa0d('0x153')});db[_0xfa0d('0x29')]['hasMany'](db[_0xfa0d('0x154')],{'as':_0xfa0d('0x155'),'foreignKey':_0xfa0d('0x156'),'constraints':![]});db[_0xfa0d('0x29')][_0xfa0d('0x115')](db[_0xfa0d('0x157')],{'as':_0xfa0d('0x158'),'foreignKey':_0xfa0d('0x156'),'constraints':![]});db[_0xfa0d('0x29')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x15'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':'Contact','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x15a')][_0xfa0d('0x124')](db[_0xfa0d('0x41')],{'as':_0xfa0d('0x41'),'foreignKey':'MailAccountId'});db[_0xfa0d('0x15b')][_0xfa0d('0x124')](db[_0xfa0d('0x41')],{'as':_0xfa0d('0x41'),'foreignKey':_0xfa0d('0x15c')});db['MailAccount']['hasOne'](db[_0xfa0d('0x15a')],{'as':_0xfa0d('0x15d'),'onDelete':'cascade'});db[_0xfa0d('0x41')][_0xfa0d('0x111')](db[_0xfa0d('0x15b')],{'as':_0xfa0d('0x15e'),'onDelete':_0xfa0d('0x113')});db['MailAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x15c')});db[_0xfa0d('0x41')][_0xfa0d('0x115')](db[_0xfa0d('0x86')],{'as':'Answers','foreignKey':_0xfa0d('0x15c')});db[_0xfa0d('0x41')]['hasMany'](db['MailMessage'],{'as':_0xfa0d('0x151'),'foreignKey':_0xfa0d('0x15c')});db[_0xfa0d('0x41')][_0xfa0d('0x115')](db[_0xfa0d('0x45')],{'as':'Interactions'});db[_0xfa0d('0x41')][_0xfa0d('0x115')](db[_0xfa0d('0x48')],{'as':'Applications'});db[_0xfa0d('0x41')][_0xfa0d('0x124')](db['CmList'],{'as':_0xfa0d('0x160'),'foreignKey':'ListId'});db[_0xfa0d('0x41')][_0xfa0d('0x124')](db[_0xfa0d('0x99')],{'as':_0xfa0d('0x99'),'foreignKey':_0xfa0d('0x161')});db[_0xfa0d('0x41')][_0xfa0d('0x124')](db['Pause'],{'as':_0xfa0d('0x14b'),'foreignKey':_0xfa0d('0x162')});db[_0xfa0d('0x41')][_0xfa0d('0x125')](db['User'],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x13c')});db['MailQueue']['belongsToMany'](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x38')});db[_0xfa0d('0x12d')]['belongsToMany'](db[_0xfa0d('0xea')],{'through':_0xfa0d('0x164'),'as':_0xfa0d('0x14d')});db['MailInteraction'][_0xfa0d('0x115')](db['MailMessage'],{'as':_0xfa0d('0x151'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x165')});db[_0xfa0d('0x45')]['belongsTo'](db[_0xfa0d('0x41')],{'as':_0xfa0d('0x166'),'foreignKey':'MailAccountId'});db[_0xfa0d('0x45')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x45')]['belongsTo'](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x168'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x45')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x16a'),'as':_0xfa0d('0x16b')});db['MailInteraction'][_0xfa0d('0x125')](db['Tag'],{'through':_0xfa0d('0x16a'),'as':_0xfa0d('0x16c')});db[_0xfa0d('0x45')][_0xfa0d('0x125')](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xfa0d('0x165')});db['MailMessage']['hasMany'](db[_0xfa0d('0xf2')],{'as':_0xfa0d('0x16d'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x16e')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x15')});db[_0xfa0d('0x16e')]['belongsTo'](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':'Contact'});db[_0xfa0d('0x16e')][_0xfa0d('0x124')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xfa0d('0x165')});db[_0xfa0d('0x16e')][_0xfa0d('0x124')](db[_0xfa0d('0x41')],{'as':'Account','foreignKey':_0xfa0d('0x15c')});db[_0xfa0d('0x16e')][_0xfa0d('0x124')](db[_0xfa0d('0x6b')],{'as':_0xfa0d('0x6b'),'foreignKey':'ChatWebsiteId'});db[_0xfa0d('0x16e')][_0xfa0d('0x124')](db[_0xfa0d('0x72')],{'as':_0xfa0d('0x72'),'foreignKey':_0xfa0d('0x16f')});db[_0xfa0d('0x48')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x48')][_0xfa0d('0x124')](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db[_0xfa0d('0x48')][_0xfa0d('0x124')](db[_0xfa0d('0x8c')],{'onDelete':_0xfa0d('0x170'),'foreignKey':'IntervalId'});db['MailApplication'][_0xfa0d('0x124')](db[_0xfa0d('0x169')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db['MailAccount'],{});db['MailQueueReport'][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db[_0xfa0d('0x45')],{});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db['MailMessage'],{});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db['User'],{});db[_0xfa0d('0x4a')][_0xfa0d('0x124')](db[_0xfa0d('0x12d')],{});db[_0xfa0d('0x4c')][_0xfa0d('0x115')](db[_0xfa0d('0x4e')],{'as':'Items','onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x50')][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x172')});db['FaxAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x86')],{'as':_0xfa0d('0x173'),'foreignKey':'FaxAccountId'});db[_0xfa0d('0x50')][_0xfa0d('0x115')](db[_0xfa0d('0x11e')],{'as':'Interactions'});db['FaxAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x51')],{'as':_0xfa0d('0x144')});db[_0xfa0d('0x50')]['hasMany'](db[_0xfa0d('0x1c')],{'as':_0xfa0d('0x174'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x50')][_0xfa0d('0x115')](db['FaxMessage'],{'as':_0xfa0d('0x151')});db[_0xfa0d('0x50')][_0xfa0d('0x124')](db['Trunk'],{'as':'Trunk'});db[_0xfa0d('0x50')][_0xfa0d('0x124')](db['CmList'],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0x50')][_0xfa0d('0x124')](db[_0xfa0d('0x8e')],{'as':_0xfa0d('0x14b'),'foreignKey':_0xfa0d('0x162')});db[_0xfa0d('0x50')]['belongsToMany'](db['User'],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x13a')});db[_0xfa0d('0x51')]['belongsTo'](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x51')]['belongsTo'](db[_0xfa0d('0x56')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x51')]['belongsTo'](db[_0xfa0d('0x50')],{'onDelete':'restrict'});db[_0xfa0d('0x51')][_0xfa0d('0x124')](db[_0xfa0d('0x169')],{'onDelete':_0xfa0d('0x170'),'foreignKey':'TagId'});db[_0xfa0d('0x11e')][_0xfa0d('0x115')](db[_0xfa0d('0x54')],{'as':_0xfa0d('0x151'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x175')});db['FaxInteraction']['belongsTo'](db[_0xfa0d('0x50')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x172')});db[_0xfa0d('0x11e')][_0xfa0d('0x124')](db['CmContact'],{'as':'Contact','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x11e')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x168'),'foreignKey':'UserId'});db[_0xfa0d('0x11e')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x176'),'as':_0xfa0d('0x16b')});db[_0xfa0d('0x11e')][_0xfa0d('0x125')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xfa0d('0x16c')});db[_0xfa0d('0x11e')][_0xfa0d('0x125')](db['User'],{'as':_0xfa0d('0x177'),'through':_0xfa0d('0x178'),'foreignKey':'FaxInteractionId'});db[_0xfa0d('0x54')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x113'),'as':'User'});db[_0xfa0d('0x54')][_0xfa0d('0x124')](db[_0xfa0d('0x11e')],{'as':'Interaction','foreignKey':_0xfa0d('0x175')});db[_0xfa0d('0x54')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x167')});db[_0xfa0d('0x54')][_0xfa0d('0x124')](db[_0xfa0d('0xf2')],{'as':_0xfa0d('0xf2'),'foreignKey':_0xfa0d('0x179')});db[_0xfa0d('0x54')][_0xfa0d('0x124')](db[_0xfa0d('0x50')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x172')});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x3a')});db[_0xfa0d('0x56')][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'through':_0xfa0d('0x17a'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0xfa0d('0x50')],{});db[_0xfa0d('0x58')]['belongsTo'](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db['FaxQueueReport'][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':'Contact','foreignKey':'ContactId'});db[_0xfa0d('0x58')][_0xfa0d('0x124')](db[_0xfa0d('0x11e')],{});db['FaxQueueReport'][_0xfa0d('0x124')](db['FaxMessage'],{});db[_0xfa0d('0x58')][_0xfa0d('0x124')](db['User'],{});db[_0xfa0d('0x58')]['belongsTo'](db[_0xfa0d('0x56')],{});db['SmsAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x17b')});db[_0xfa0d('0x5a')][_0xfa0d('0x115')](db['CannedAnswer'],{'as':_0xfa0d('0x173'),'foreignKey':_0xfa0d('0x17b')});db['SmsAccount'][_0xfa0d('0x115')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xfa0d('0x17b')});db[_0xfa0d('0x5a')][_0xfa0d('0x115')](db[_0xfa0d('0x5e')],{'as':_0xfa0d('0x17c')});db['SmsAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x5c')],{'as':_0xfa0d('0x144')});db[_0xfa0d('0x5a')][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db['SmsAccount'][_0xfa0d('0x124')](db['Pause'],{'as':_0xfa0d('0x14b'),'foreignKey':_0xfa0d('0x162')});db['SmsAccount'][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x140')});db[_0xfa0d('0x5c')][_0xfa0d('0x124')](db['User'],{'onDelete':_0xfa0d('0x170')});db['SmsApplication']['belongsTo'](db[_0xfa0d('0x61')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x5c')][_0xfa0d('0x124')](db[_0xfa0d('0x5a')],{'onDelete':_0xfa0d('0x170')});db['SmsApplication']['belongsTo'](db[_0xfa0d('0x8c')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0xfa0d('0x124')](db['Tag'],{'onDelete':_0xfa0d('0x170'),'foreignKey':_0xfa0d('0x17d')});db[_0xfa0d('0x5e')][_0xfa0d('0x115')](db[_0xfa0d('0x17e')],{'as':_0xfa0d('0x151'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x17f')});db[_0xfa0d('0x5e')]['belongsTo'](db[_0xfa0d('0x5a')],{'as':'Account','foreignKey':_0xfa0d('0x17b')});db[_0xfa0d('0x5e')]['belongsTo'](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db['SmsInteraction'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':'Owner','foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x5e')]['belongsToMany'](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x180'),'as':_0xfa0d('0x16b')});db['SmsInteraction'][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xfa0d('0x5e')][_0xfa0d('0x125')](db['User'],{'as':_0xfa0d('0x177'),'through':_0xfa0d('0x181'),'foreignKey':_0xfa0d('0x17f')});db[_0xfa0d('0x17e')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x15')});db[_0xfa0d('0x17e')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x167')});db[_0xfa0d('0x17e')]['belongsTo'](db[_0xfa0d('0x5e')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x182'),'foreignKey':_0xfa0d('0x17f')});db[_0xfa0d('0x17e')]['belongsTo'](db[_0xfa0d('0x5a')],{'as':_0xfa0d('0x166'),'foreignKey':'SmsAccountId'});db[_0xfa0d('0x61')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':'UserSmsQueue','foreignKey':_0xfa0d('0x183')});db['SmsQueue'][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'through':_0xfa0d('0x184'),'as':'Teams'});db[_0xfa0d('0x62')][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x185')});db['OpenchannelAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x86')],{'as':_0xfa0d('0x173'),'foreignKey':_0xfa0d('0x185')});db['OpenchannelAccount']['hasMany'](db[_0xfa0d('0x66')],{'as':_0xfa0d('0x17c'),'foreignKey':_0xfa0d('0x185')});db[_0xfa0d('0x62')][_0xfa0d('0x115')](db[_0xfa0d('0x68')],{'as':_0xfa0d('0x151'),'foreignKey':_0xfa0d('0x185')});db[_0xfa0d('0x62')][_0xfa0d('0x115')](db[_0xfa0d('0x64')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0xfa0d('0xfa')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0xfa0d('0x124')](db[_0xfa0d('0x8e')],{'as':_0xfa0d('0x14b'),'foreignKey':_0xfa0d('0x162')});db[_0xfa0d('0x62')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x13e')});db['OpenchannelApplication'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':'restrict'});db[_0xfa0d('0x64')][_0xfa0d('0x124')](db[_0xfa0d('0x132')],{'onDelete':_0xfa0d('0x170'),'foreignKey':_0xfa0d('0x186')});db['OpenchannelApplication'][_0xfa0d('0x124')](db[_0xfa0d('0x62')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xfa0d('0x64')][_0xfa0d('0x124')](db[_0xfa0d('0x8c')],{'onDelete':'restrict','foreignKey':_0xfa0d('0x187')});db[_0xfa0d('0x64')][_0xfa0d('0x124')](db[_0xfa0d('0x169')],{'onDelete':_0xfa0d('0x170'),'foreignKey':'TagId'});db[_0xfa0d('0x66')]['hasMany'](db[_0xfa0d('0x68')],{'as':_0xfa0d('0x151'),'onDelete':'cascade','foreignKey':_0xfa0d('0x188')});db[_0xfa0d('0x66')][_0xfa0d('0x124')](db[_0xfa0d('0x62')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x185')});db['OpenchannelInteraction'][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':'ContactId'});db[_0xfa0d('0x66')][_0xfa0d('0x124')](db['User'],{'as':_0xfa0d('0x168'),'foreignKey':_0xfa0d('0x114')});db['OpenchannelInteraction']['belongsToMany'](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x189'),'as':_0xfa0d('0x16b')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0xfa0d('0x189'),'as':_0xfa0d('0x16c')});db[_0xfa0d('0x66')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x177'),'through':_0xfa0d('0x12b'),'foreignKey':_0xfa0d('0x188')});db[_0xfa0d('0x68')]['belongsTo'](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x15')});db[_0xfa0d('0x68')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x167')});db[_0xfa0d('0x68')][_0xfa0d('0x124')](db[_0xfa0d('0x66')],{'onDelete':'cascade','as':_0xfa0d('0x182'),'foreignKey':'OpenchannelInteractionId'});db[_0xfa0d('0x68')][_0xfa0d('0x124')](db[_0xfa0d('0xf2')],{'as':_0xfa0d('0xf2'),'foreignKey':_0xfa0d('0x179')});db[_0xfa0d('0x68')][_0xfa0d('0x124')](db[_0xfa0d('0x62')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x185')});db[_0xfa0d('0x132')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':'Agents','through':_0xfa0d('0x3e'),'foreignKey':_0xfa0d('0x186')});db[_0xfa0d('0x132')][_0xfa0d('0x125')](db['Team'],{'through':_0xfa0d('0x18a'),'as':_0xfa0d('0x14d')});db[_0xfa0d('0x6b')][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x18b')});db['ChatWebsite'][_0xfa0d('0x115')](db[_0xfa0d('0x86')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xfa0d('0x6b')][_0xfa0d('0x115')](db[_0xfa0d('0x76')],{'as':_0xfa0d('0x18c')});db[_0xfa0d('0x6b')][_0xfa0d('0x115')](db[_0xfa0d('0x11c')],{'as':_0xfa0d('0x17c')});db[_0xfa0d('0x6b')]['hasMany'](db['ChatApplication'],{'as':_0xfa0d('0x144')});db[_0xfa0d('0x6b')]['hasMany'](db[_0xfa0d('0x70')],{'as':_0xfa0d('0x151')});db[_0xfa0d('0x6b')][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0x6b')][_0xfa0d('0x124')](db[_0xfa0d('0x8c')],{'as':_0xfa0d('0x8c'),'foreignKey':_0xfa0d('0x187')});db['ChatWebsite'][_0xfa0d('0x124')](db[_0xfa0d('0x41')],{'as':_0xfa0d('0x41'),'foreignKey':_0xfa0d('0x15c')});db[_0xfa0d('0x6b')][_0xfa0d('0x124')](db[_0xfa0d('0x8e')],{'as':_0xfa0d('0x14b'),'foreignKey':_0xfa0d('0x162')});db[_0xfa0d('0x6b')]['belongsToMany'](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x138')});db[_0xfa0d('0x6d')]['belongsTo'](db[_0xfa0d('0x62')],{});db[_0xfa0d('0x6d')]['belongsTo'](db[_0xfa0d('0xfa')],{'as':'List','foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0x6d')]['belongsTo'](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x6d')]['belongsTo'](db[_0xfa0d('0x66')],{});db[_0xfa0d('0x6d')][_0xfa0d('0x124')](db[_0xfa0d('0x68')],{});db[_0xfa0d('0x6d')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xfa0d('0x132')],{});db[_0xfa0d('0x18d')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x18e'),'foreignKey':'UserId','onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x18d')][_0xfa0d('0x124')](db['ChatQueue'],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x18d')][_0xfa0d('0x124')](db['ChatWebsite'],{'as':_0xfa0d('0x18f'),'foreignKey':_0xfa0d('0x18b'),'onDelete':_0xfa0d('0x170')});db['ChatApplication'][_0xfa0d('0x124')](db[_0xfa0d('0x169')],{'onDelete':'restrict','foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db[_0xfa0d('0x70')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xfa0d('0x190')});db[_0xfa0d('0x11c')][_0xfa0d('0x124')](db[_0xfa0d('0x6b')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x18b')});db[_0xfa0d('0x11c')][_0xfa0d('0x124')](db['CmContact'],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x11c')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x168'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x11c')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x191'),'as':_0xfa0d('0x16b')});db[_0xfa0d('0x11c')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':'chat_interaction_has_tags','as':_0xfa0d('0x16c')});db[_0xfa0d('0x11c')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x177'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0xfa0d('0x70')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x15')});db[_0xfa0d('0x70')]['belongsTo'](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':'Contact','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x70')][_0xfa0d('0x124')](db[_0xfa0d('0x11c')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x182'),'foreignKey':_0xfa0d('0x190')});db[_0xfa0d('0x70')][_0xfa0d('0x124')](db[_0xfa0d('0xf2')],{'as':_0xfa0d('0xf2'),'foreignKey':_0xfa0d('0x179')});db[_0xfa0d('0x70')][_0xfa0d('0x124')](db[_0xfa0d('0x6b')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x18b')});db[_0xfa0d('0x72')]['belongsTo'](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x72')][_0xfa0d('0x124')](db['ChatWebsite'],{'as':_0xfa0d('0x166'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x36'),'hooks':!![]});db[_0xfa0d('0x74')][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'through':_0xfa0d('0x192'),'as':_0xfa0d('0x14d')});db[_0xfa0d('0x75')][_0xfa0d('0x115')](db[_0xfa0d('0x193')],{'as':_0xfa0d('0x151'),'foreignKey':_0xfa0d('0x194'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x75')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x195'),'through':_0xfa0d('0x196')});db['ChatProactiveAction'][_0xfa0d('0x124')](db[_0xfa0d('0x6b')],{'as':_0xfa0d('0x18f'),'foreignKey':_0xfa0d('0x18b')});db[_0xfa0d('0x197')]['hasMany'](db['CmContact'],{'as':_0xfa0d('0x126'),'foreignKey':_0xfa0d('0x198')});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0xfa0d('0x147'),'foreignKey':'ContactId'});db['CmContact'][_0xfa0d('0x115')](db['CmHopperFinal'],{'as':_0xfa0d('0x118'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db[_0xfa0d('0x11a')],{'as':_0xfa0d('0x11a'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db[_0xfa0d('0xdb')],{'as':_0xfa0d('0x149'),'foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db['OpenchannelInteraction'],{'as':_0xfa0d('0x11b'),'foreignKey':_0xfa0d('0x159'),'onDelete':'restrict'});db['CmContact'][_0xfa0d('0x115')](db[_0xfa0d('0x11c')],{'as':_0xfa0d('0x129'),'foreignKey':_0xfa0d('0x159'),'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db[_0xfa0d('0x5e')],{'as':'SmsInteractions','foreignKey':_0xfa0d('0x159'),'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x78')][_0xfa0d('0x115')](db[_0xfa0d('0x11e')],{'as':_0xfa0d('0x11f'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xfa0d('0x115')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xfa0d('0x159'),'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x78')][_0xfa0d('0x124')](db['CmCompany'],{'as':'Company','foreignKey':_0xfa0d('0x198')});db['CmContact'][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':'List','foreignKey':'ListId','onDelete':_0xfa0d('0x113')});db['CmContact'][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':'Users','through':_0xfa0d('0x199')});db[_0xfa0d('0x78')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'as':_0xfa0d('0x16b'),'through':_0xfa0d('0x19a')});db[_0xfa0d('0x78')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x19a'),'as':_0xfa0d('0x16c')});db[_0xfa0d('0x7a')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x7a')][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xfa0d('0x7a')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':'Agent','foreignKey':'UserId'});db[_0xfa0d('0x7a')][_0xfa0d('0x124')](db[_0xfa0d('0x20')],{'as':_0xfa0d('0x19b'),'foreignKey':_0xfa0d('0x146'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x7a')][_0xfa0d('0x124')](db[_0xfa0d('0xee')],{'as':_0xfa0d('0xee'),'foreignKey':_0xfa0d('0x19c'),'onDelete':_0xfa0d('0x113')});db['CmHopper'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':'Owner','foreignKey':_0xfa0d('0x19d')});db[_0xfa0d('0x148')][_0xfa0d('0x124')](db['CmContact'],{'as':_0xfa0d('0x167'),'foreignKey':_0xfa0d('0x159'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x148')]['belongsTo'](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x148')][_0xfa0d('0x124')](db[_0xfa0d('0x20')],{'as':_0xfa0d('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0xfa0d('0x113')});db['CmHopperBlack'][_0xfa0d('0x124')](db['Campaign'],{'as':_0xfa0d('0xee'),'foreignKey':_0xfa0d('0x19c'),'onDelete':_0xfa0d('0x113')});db['Automation'][_0xfa0d('0x115')](db[_0xfa0d('0x8a')],{'as':{'plural':'All','singular':_0xfa0d('0x19e')},'foreignKey':_0xfa0d('0x19f'),'onDelete':_0xfa0d('0x113'),'hooks':!![]});db[_0xfa0d('0x84')][_0xfa0d('0x115')](db[_0xfa0d('0x8a')],{'as':{'plural':_0xfa0d('0x1a0'),'singular':_0xfa0d('0x1a1')},'foreignKey':_0xfa0d('0x1a2'),'onDelete':_0xfa0d('0x113'),'hooks':!![]});db['Automation'][_0xfa0d('0x115')](db[_0xfa0d('0x82')],{'as':_0xfa0d('0x1a3'),'foreignKey':_0xfa0d('0x1a4'),'onDelete':_0xfa0d('0x113'),'hooks':!![]});db[_0xfa0d('0x88')][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x1a5'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x8c')][_0xfa0d('0x115')](db[_0xfa0d('0x8c')],{'as':_0xfa0d('0x1a6'),'foreignKey':'IntervalId','onDelete':_0xfa0d('0x113'),'hooks':!![],'required':![]});db[_0xfa0d('0x8c')][_0xfa0d('0x115')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xfa0d('0x187'),'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x8c')]['hasMany'](db[_0xfa0d('0x48')],{'as':_0xfa0d('0x1a7'),'foreignKey':_0xfa0d('0x187')});db[_0xfa0d('0x8c')][_0xfa0d('0x115')](db[_0xfa0d('0x18d')],{'as':_0xfa0d('0x1a8'),'foreignKey':'IntervalId'});db['Interval'][_0xfa0d('0x115')](db[_0xfa0d('0x51')],{'as':_0xfa0d('0x1a9'),'foreignKey':_0xfa0d('0x187')});db[_0xfa0d('0x8c')][_0xfa0d('0x115')](db[_0xfa0d('0x5c')],{'as':_0xfa0d('0x1aa'),'foreignKey':'IntervalId'});db[_0xfa0d('0x94')][_0xfa0d('0x124')](db[_0xfa0d('0x41')],{});db['Schedule'][_0xfa0d('0x124')](db[_0xfa0d('0xa3')],{'foreignKey':_0xfa0d('0x1ab')});db[_0xfa0d('0x94')][_0xfa0d('0x124')](db[_0xfa0d('0xa1')],{'foreignKey':_0xfa0d('0x1ac')});db[_0xfa0d('0x96')][_0xfa0d('0x125')](db[_0xfa0d('0x1e')],{'as':_0xfa0d('0x1ad'),'through':_0xfa0d('0x145'),'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x169')][_0xfa0d('0x125')](db[_0xfa0d('0x78')],{'through':_0xfa0d('0x19a')});db[_0xfa0d('0x169')]['belongsToMany'](db['ChatInteraction'],{'through':_0xfa0d('0x191')});db['Tag'][_0xfa0d('0x125')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0xfa0d('0x125')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xfa0d('0x169')][_0xfa0d('0x125')](db[_0xfa0d('0x11e')],{'through':_0xfa0d('0x176')});db[_0xfa0d('0x169')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xfa0d('0x189')});db[_0xfa0d('0x169')]['belongsToMany'](db[_0xfa0d('0x107')],{'through':_0xfa0d('0x1ae')});db[_0xfa0d('0x9b')][_0xfa0d('0x115')](db[_0xfa0d('0x8a')],{'as':{'plural':'AllConditions','singular':_0xfa0d('0x1af')},'foreignKey':'TriggerAllId','onDelete':_0xfa0d('0x113'),'hooks':!![]});db[_0xfa0d('0x9b')][_0xfa0d('0x115')](db['Condition'],{'as':{'plural':_0xfa0d('0x1b0'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0xfa0d('0x113'),'hooks':!![]});db['Trigger'][_0xfa0d('0x115')](db[_0xfa0d('0x82')],{'as':'Actions','foreignKey':_0xfa0d('0x1b1'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0xfa0d('0x115')](db[_0xfa0d('0x1b2')],{'as':'Fields','onDelete':_0xfa0d('0x113'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xfa0d('0xa3')][_0xfa0d('0x115')](db[_0xfa0d('0x1b2')],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ab')});db[_0xfa0d('0xa5')][_0xfa0d('0x115')](db['AnalyticFieldReport'],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b4')});db[_0xfa0d('0x1b2')][_0xfa0d('0x124')](db[_0xfa0d('0xa5')],{'foreignKey':_0xfa0d('0x1b4')});db[_0xfa0d('0xaa')][_0xfa0d('0x115')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xac')][_0xfa0d('0x115')](db[_0xfa0d('0x1b6')],{'as':'Subjects','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xac')][_0xfa0d('0x115')](db[_0xfa0d('0x1b6')],{'as':_0xfa0d('0x1b8'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xac')][_0xfa0d('0x115')](db['SalesforceField'],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xac')][_0xfa0d('0x124')](db[_0xfa0d('0xaa')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0x1b6')]['hasMany'](db[_0xfa0d('0x1b6')],{'as':_0xfa0d('0x1bb'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0x1b6')][_0xfa0d('0x115')](db[_0xfa0d('0x1b6')],{'as':'Description','foreignKey':_0xfa0d('0x1b9')});db['SalesforceField'][_0xfa0d('0x115')](db['SalesforceField'],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db['SalesforceField'][_0xfa0d('0x124')](db[_0xfa0d('0x1bd')],{'as':_0xfa0d('0x1bd'),'foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0xae')][_0xfa0d('0x115')](db[_0xfa0d('0xaf')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':'AccountId'});db[_0xfa0d('0xaf')][_0xfa0d('0x115')](db[_0xfa0d('0xb1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xaf')]['hasMany'](db[_0xfa0d('0xb1')],{'as':_0xfa0d('0x1b8'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xaf')][_0xfa0d('0x115')](db[_0xfa0d('0xb1')],{'as':'Fields','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ba')});db['SugarcrmConfiguration'][_0xfa0d('0x124')](db[_0xfa0d('0xae')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xb1')]['hasMany'](db[_0xfa0d('0xb1')],{'as':_0xfa0d('0x1bb'),'foreignKey':'SubjectId'});db[_0xfa0d('0xb1')]['hasMany'](db['SugarcrmField'],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xb1')][_0xfa0d('0x115')](db[_0xfa0d('0xb1')],{'as':_0xfa0d('0x1bc'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xfa0d('0x124')](db['Variable'],{'as':_0xfa0d('0x1bd'),'foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0xb3')][_0xfa0d('0x115')](db[_0xfa0d('0xb4')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xb4')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1c1'),'onDelete':'cascade','foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xb4')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1b8'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xb4')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xb4')][_0xfa0d('0x124')](db[_0xfa0d('0xb3')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xb4')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x1c2')});db[_0xfa0d('0xb5')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1bb'),'foreignKey':'SubjectId'});db[_0xfa0d('0xb5')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xb5')][_0xfa0d('0x115')](db[_0xfa0d('0xb5')],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xb5')][_0xfa0d('0x124')](db[_0xfa0d('0x1bd')],{'as':'Variable','foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0x1c3')][_0xfa0d('0x115')](db[_0xfa0d('0x1c4')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xfa0d('0x115')](db[_0xfa0d('0x1c5')],{'as':_0xfa0d('0x1c1'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0x1c4')][_0xfa0d('0x115')](db[_0xfa0d('0x1c5')],{'as':'Descriptions','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1c4')][_0xfa0d('0x115')](db['ZohoField'],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0x1c4')][_0xfa0d('0x124')](db[_0xfa0d('0x1c3')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0x1c5')]['hasMany'](db['ZohoField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfa0d('0x1c5')]['hasMany'](db[_0xfa0d('0x1c5')],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1c5')]['hasMany'](db['ZohoField'],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0x1c5')][_0xfa0d('0x124')](db['Variable'],{'as':_0xfa0d('0x1bd'),'foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0xb8')][_0xfa0d('0x115')](db[_0xfa0d('0xba')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xba')][_0xfa0d('0x115')](db[_0xfa0d('0x1c6')],{'as':_0xfa0d('0x1c1'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xba')][_0xfa0d('0x115')](db[_0xfa0d('0x1c6')],{'as':'Descriptions','foreignKey':_0xfa0d('0x1b9')});db['ZendeskConfiguration']['hasMany'](db[_0xfa0d('0x1c6')],{'as':'Fields','foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xba')][_0xfa0d('0x124')](db['ZendeskAccount'],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db['ZendeskConfiguration'][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x1c7')});db[_0xfa0d('0x1c6')][_0xfa0d('0x115')](db[_0xfa0d('0x1c6')],{'as':_0xfa0d('0x1bb'),'foreignKey':'SubjectId'});db[_0xfa0d('0x1c6')][_0xfa0d('0x115')](db['ZendeskField'],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1c6')][_0xfa0d('0x115')](db['ZendeskField'],{'as':'Field','foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0x1c6')]['belongsTo'](db[_0xfa0d('0x1bd')],{'as':'Variable','foreignKey':_0xfa0d('0x1be')});db['FreshdeskAccount'][_0xfa0d('0x115')](db['FreshdeskConfiguration'],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db['FreshdeskConfiguration']['hasMany'](db[_0xfa0d('0x1c8')],{'as':_0xfa0d('0x1c1'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b7')});db['FreshdeskConfiguration']['hasMany'](db[_0xfa0d('0x1c8')],{'as':_0xfa0d('0x1b8'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xbe')]['hasMany'](db[_0xfa0d('0x1c8')],{'as':'Fields','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xbe')]['belongsTo'](db[_0xfa0d('0xbc')],{'as':'Account','foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xbe')][_0xfa0d('0x125')](db['Tag'],{'through':_0xfa0d('0x1c9')});db[_0xfa0d('0x1c8')][_0xfa0d('0x115')](db[_0xfa0d('0x1c8')],{'as':_0xfa0d('0x1bb'),'foreignKey':'SubjectId'});db[_0xfa0d('0x1c8')][_0xfa0d('0x115')](db[_0xfa0d('0x1c8')],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1c8')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xfa0d('0x1c8')]['belongsTo'](db[_0xfa0d('0x1bd')],{'as':_0xfa0d('0x1bd'),'foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0xc1')][_0xfa0d('0x115')](db[_0xfa0d('0xc3')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db['VtigerConfiguration'][_0xfa0d('0x115')](db[_0xfa0d('0xc5')],{'as':_0xfa0d('0x1c1'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xc3')][_0xfa0d('0x115')](db[_0xfa0d('0xc5')],{'as':_0xfa0d('0x1b8'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xc3')][_0xfa0d('0x115')](db[_0xfa0d('0xc5')],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration'][_0xfa0d('0x124')](db['VtigerAccount'],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xc5')]['hasMany'](db[_0xfa0d('0xc5')],{'as':_0xfa0d('0x1bb'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xc5')]['hasMany'](db[_0xfa0d('0xc5')],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xc5')][_0xfa0d('0x115')](db['VtigerField'],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db['VtigerField'][_0xfa0d('0x124')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xfa0d('0xc7')][_0xfa0d('0x115')](db[_0xfa0d('0x1ca')],{'as':'Configurations','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0x1ca')]['hasMany'](db[_0xfa0d('0xc9')],{'as':_0xfa0d('0x1c1'),'foreignKey':'SubjectId'});db[_0xfa0d('0x1ca')][_0xfa0d('0x115')](db['ServicenowField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xfa0d('0x1ca')][_0xfa0d('0x115')](db['ServicenowField'],{'as':_0xfa0d('0x1b3'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0x1ca')]['belongsTo'](db[_0xfa0d('0xc7')],{'as':'Account','foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xc9')][_0xfa0d('0x115')](db[_0xfa0d('0xc9')],{'as':_0xfa0d('0x1bb'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0xc9')][_0xfa0d('0x115')](db[_0xfa0d('0xc9')],{'as':'Description','foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xc9')][_0xfa0d('0x115')](db[_0xfa0d('0xc9')],{'as':_0xfa0d('0x1bc'),'foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0xfa0d('0x1bd'),'foreignKey':_0xfa0d('0x1be')});db[_0xfa0d('0xcb')][_0xfa0d('0x115')](db[_0xfa0d('0x1cb')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':'AccountId'});db[_0xfa0d('0x1cb')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0x1cb')][_0xfa0d('0x115')](db[_0xfa0d('0x1cc')],{'as':_0xfa0d('0x1b8'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1cb')][_0xfa0d('0x115')](db['Dynamics365Field'],{'as':_0xfa0d('0x1b3'),'onDelete':_0xfa0d('0x113'),'foreignKey':'FieldId'});db[_0xfa0d('0x1cb')][_0xfa0d('0x124')](db['Dynamics365Account'],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0x1cc')][_0xfa0d('0x115')](db['Dynamics365Field'],{'as':_0xfa0d('0x1bb'),'foreignKey':_0xfa0d('0x1b7')});db[_0xfa0d('0x1cc')]['hasMany'](db['Dynamics365Field'],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0x1cc')][_0xfa0d('0x115')](db[_0xfa0d('0x1cc')],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0x1cc')][_0xfa0d('0x124')](db[_0xfa0d('0x1bd')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0xfa0d('0x115')](db[_0xfa0d('0xd1')],{'as':_0xfa0d('0x1bf'),'onDelete':_0xfa0d('0x113'),'foreignKey':'AccountId'});db[_0xfa0d('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0xfa0d('0x1c1'),'foreignKey':_0xfa0d('0x1b7')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xfa0d('0x1b8'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0xfa0d('0x1b3'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xd1')][_0xfa0d('0x124')](db[_0xfa0d('0xcf')],{'as':_0xfa0d('0x166'),'foreignKey':_0xfa0d('0x1b5')});db[_0xfa0d('0xd3')][_0xfa0d('0x115')](db['FreshsalesField'],{'as':_0xfa0d('0x1bb'),'foreignKey':'SubjectId'});db['FreshsalesField']['hasMany'](db[_0xfa0d('0xd3')],{'as':_0xfa0d('0x1c0'),'foreignKey':_0xfa0d('0x1b9')});db[_0xfa0d('0xd3')]['hasMany'](db['FreshsalesField'],{'as':_0xfa0d('0x1bc'),'foreignKey':_0xfa0d('0x1ba')});db[_0xfa0d('0xd3')][_0xfa0d('0x124')](db[_0xfa0d('0x1bd')],{'as':_0xfa0d('0x1bd'),'foreignKey':'VariableId'});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db['ChatWebsite'],{});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0xfa0d('0x78')],{'as':'Contact','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db[_0xfa0d('0x11c')],{});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db[_0xfa0d('0x70')],{});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{});db[_0xfa0d('0xd5')][_0xfa0d('0x124')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db[_0xfa0d('0x15')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xfa0d('0x193')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x1cd')});db['JscriptySessionReport']['hasMany'](db[_0xfa0d('0xd9')],{'foreignKey':_0xfa0d('0x1ce'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0xdb')]['hasMany'](db[_0xfa0d('0xd7')],{'foreignKey':_0xfa0d('0x1ce'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0xfa0d('0x5a')],{});db['SmsQueueReport'][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':'ListId'});db[_0xfa0d('0xdc')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xfa0d('0x159')});db['SmsQueueReport']['belongsTo'](db[_0xfa0d('0x5e')],{});db[_0xfa0d('0xdc')][_0xfa0d('0x124')](db['SmsMessage'],{});db['SmsQueueReport']['belongsTo'](db['User'],{});db[_0xfa0d('0xdc')][_0xfa0d('0x124')](db[_0xfa0d('0x61')],{});db[_0xfa0d('0x1cf')][_0xfa0d('0x115')](db[_0xfa0d('0xdb')],{'foreignKey':'ProjectId'});db[_0xfa0d('0x1cf')]['hasMany'](db[_0xfa0d('0xd9')],{'foreignKey':'ProjectId'});db[_0xfa0d('0x1cf')][_0xfa0d('0x115')](db[_0xfa0d('0xd7')],{'foreignKey':_0xfa0d('0x1d0')});db[_0xfa0d('0xe7')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x177'),'through':_0xfa0d('0x142')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x1d1')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x20')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x12d')],{'through':_0xfa0d('0x164'),'as':_0xfa0d('0x12e')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x74')],{'through':_0xfa0d('0x192'),'as':_0xfa0d('0x12f')});db['Team'][_0xfa0d('0x125')](db[_0xfa0d('0x56')],{'through':_0xfa0d('0x17a'),'as':_0xfa0d('0x130')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x61')],{'through':_0xfa0d('0x184'),'as':_0xfa0d('0x131')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x132')],{'through':_0xfa0d('0x18a'),'as':_0xfa0d('0x133')});db[_0xfa0d('0xea')][_0xfa0d('0x125')](db[_0xfa0d('0x10d')],{'through':_0xfa0d('0x1d2'),'as':_0xfa0d('0x134')});db[_0xfa0d('0xee')][_0xfa0d('0x115')](db[_0xfa0d('0x7a')],{'as':_0xfa0d('0x147'),'foreignKey':_0xfa0d('0x19c')});db[_0xfa0d('0xee')][_0xfa0d('0x115')](db[_0xfa0d('0x7d')],{'as':_0xfa0d('0x118'),'foreignKey':_0xfa0d('0x19c')});db[_0xfa0d('0xee')][_0xfa0d('0x115')](db[_0xfa0d('0x7f')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xfa0d('0xee')]['hasMany'](db[_0xfa0d('0x148')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xfa0d('0xee')][_0xfa0d('0x124')](db[_0xfa0d('0x2f')],{'as':_0xfa0d('0x2f'),'foreignKey':_0xfa0d('0x1d3')});db[_0xfa0d('0xee')]['belongsTo'](db[_0xfa0d('0x2f')],{'as':_0xfa0d('0x1d4'),'foreignKey':_0xfa0d('0x14a')});db['Campaign']['belongsTo'](db[_0xfa0d('0x8c')],{'as':_0xfa0d('0x8c'),'foreignKey':_0xfa0d('0x187')});db[_0xfa0d('0xee')][_0xfa0d('0x124')](db[_0xfa0d('0xe7')],{'as':_0xfa0d('0xe7'),'foreignKey':'SquareProjectId'});db['Campaign'][_0xfa0d('0x125')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x127'),'through':_0xfa0d('0x1d5')});db['Campaign'][_0xfa0d('0x125')](db['CmList'],{'as':_0xfa0d('0x14f'),'through':_0xfa0d('0x1d6')});db[_0xfa0d('0xf4')][_0xfa0d('0x124')](db[_0xfa0d('0x16e')],{});db[_0xfa0d('0xf4')]['belongsTo'](db[_0xfa0d('0x45')],{});db[_0xfa0d('0xf4')][_0xfa0d('0x124')](db['MailAccount'],{'foreignKey':_0xfa0d('0x1d7'),'as':'FromAccount'});db[_0xfa0d('0xf4')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1d8'),'as':_0xfa0d('0x1d9')});db[_0xfa0d('0xf4')]['belongsTo'](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1da'),'as':'ToAgent'});db[_0xfa0d('0xf4')][_0xfa0d('0x124')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xfa0d('0x1db')});db[_0xfa0d('0xf4')]['belongsTo'](db[_0xfa0d('0x41')],{'foreignKey':_0xfa0d('0x1dc'),'as':'ToAccount'});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x11c')],{});db['ChatTransferReport']['belongsTo'](db[_0xfa0d('0x6b')],{'foreignKey':_0xfa0d('0x1dd'),'as':_0xfa0d('0x1de')});db[_0xfa0d('0x1df')]['belongsTo'](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1d8'),'as':_0xfa0d('0x1d9')});db[_0xfa0d('0x1df')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1da'),'as':_0xfa0d('0x1e0')});db[_0xfa0d('0x1df')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0xfa0d('0x1e1'),'as':_0xfa0d('0x1db')});db['ChatTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x6b')],{'foreignKey':_0xfa0d('0x1e2'),'as':_0xfa0d('0x1e3')});db['FaxTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x54')],{});db[_0xfa0d('0x1e4')][_0xfa0d('0x124')](db[_0xfa0d('0x11e')],{});db[_0xfa0d('0x1e4')][_0xfa0d('0x124')](db[_0xfa0d('0x50')],{'foreignKey':_0xfa0d('0x1e5'),'as':_0xfa0d('0x1de')});db[_0xfa0d('0x1e4')][_0xfa0d('0x124')](db['User'],{'foreignKey':_0xfa0d('0x1d8'),'as':_0xfa0d('0x1d9')});db[_0xfa0d('0x1e4')]['belongsTo'](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1da'),'as':_0xfa0d('0x1e0')});db[_0xfa0d('0x1e4')][_0xfa0d('0x124')](db[_0xfa0d('0x56')],{'foreignKey':_0xfa0d('0x1e6'),'as':'ToQueue'});db[_0xfa0d('0x1e4')][_0xfa0d('0x124')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xfa0d('0x1e3')});db['OpenchannelTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x68')],{});db[_0xfa0d('0xf7')]['belongsTo'](db[_0xfa0d('0x66')],{});db[_0xfa0d('0xf7')]['belongsTo'](db[_0xfa0d('0x62')],{'foreignKey':_0xfa0d('0x1e7'),'as':_0xfa0d('0x1de')});db[_0xfa0d('0xf7')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1d8'),'as':'FromAgent'});db[_0xfa0d('0xf7')]['belongsTo'](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1da'),'as':'ToAgent'});db[_0xfa0d('0xf7')][_0xfa0d('0x124')](db['OpenchannelQueue'],{'foreignKey':_0xfa0d('0x1e8'),'as':'ToQueue'});db[_0xfa0d('0xf7')][_0xfa0d('0x124')](db[_0xfa0d('0x62')],{'foreignKey':_0xfa0d('0x1e9'),'as':_0xfa0d('0x1e3')});db[_0xfa0d('0xf9')]['belongsTo'](db['SmsMessage'],{});db[_0xfa0d('0xf9')][_0xfa0d('0x124')](db[_0xfa0d('0x5e')],{});db[_0xfa0d('0xf9')]['belongsTo'](db[_0xfa0d('0x5a')],{'foreignKey':_0xfa0d('0x1ea'),'as':_0xfa0d('0x1de')});db[_0xfa0d('0xf9')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1d8'),'as':_0xfa0d('0x1d9')});db['SmsTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':_0xfa0d('0x1da'),'as':_0xfa0d('0x1e0')});db[_0xfa0d('0xf9')][_0xfa0d('0x124')](db[_0xfa0d('0x61')],{'foreignKey':_0xfa0d('0x1eb'),'as':_0xfa0d('0x1db')});db[_0xfa0d('0xf9')]['belongsTo'](db[_0xfa0d('0x5a')],{'foreignKey':'ToSmsAccountId','as':_0xfa0d('0x1e3')});db[_0xfa0d('0xfa')][_0xfa0d('0x115')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0xfa')][_0xfa0d('0x115')](db[_0xfa0d('0x81')],{'as':'CustomFields','foreignKey':_0xfa0d('0x171')});db['CmList'][_0xfa0d('0x115')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x126'),'onDelete':_0xfa0d('0x113'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0xfa')][_0xfa0d('0x115')](db[_0xfa0d('0x7d')],{'as':_0xfa0d('0x118'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0xfa')][_0xfa0d('0x115')](db[_0xfa0d('0x7f')],{'as':_0xfa0d('0x119'),'foreignKey':_0xfa0d('0x171')});db['CmList'][_0xfa0d('0x115')](db[_0xfa0d('0x11a')],{'as':_0xfa0d('0x11a'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0xfa')]['belongsToMany'](db[_0xfa0d('0x20')],{'as':'Queues','through':_0xfa0d('0x14c')});db[_0xfa0d('0xfa')]['belongsToMany'](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x128')});db[_0xfa0d('0xfb')]['hasMany'](db[_0xfa0d('0x1c')],{'as':_0xfa0d('0x117'),'onDelete':_0xfa0d('0x113')});db['VoicePrefix'][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':'Agents','through':_0xfa0d('0x136')});db['UserProfile'][_0xfa0d('0x115')](db['User'],{'as':'Users','foreignKey':_0xfa0d('0x1ec')});db[_0xfa0d('0xfd')]['hasMany'](db[_0xfa0d('0xfe')],{'as':'UserProfileSections','foreignKey':_0xfa0d('0x1ec'),'onDelete':'cascade'});db[_0xfa0d('0xfe')][_0xfa0d('0x115')](db[_0xfa0d('0x100')],{'as':_0xfa0d('0x1ed'),'foreignKey':_0xfa0d('0x1ee'),'onDelete':_0xfa0d('0x113')});db[_0xfa0d('0x104')][_0xfa0d('0x115')](db[_0xfa0d('0x88')],{'as':_0xfa0d('0x15f'),'foreignKey':_0xfa0d('0x1ef')});db['WhatsappAccount'][_0xfa0d('0x115')](db[_0xfa0d('0x86')],{'as':_0xfa0d('0x173'),'foreignKey':_0xfa0d('0x1ef')});db[_0xfa0d('0x104')][_0xfa0d('0x115')](db['WhatsappMessage'],{'as':_0xfa0d('0x151'),'foreignKey':_0xfa0d('0x1ef')});db[_0xfa0d('0x104')][_0xfa0d('0x115')](db[_0xfa0d('0x107')],{'as':_0xfa0d('0x17c')});db[_0xfa0d('0x104')][_0xfa0d('0x115')](db[_0xfa0d('0x106')],{'as':_0xfa0d('0x144')});db['WhatsappAccount'][_0xfa0d('0x124')](db[_0xfa0d('0xfa')],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db[_0xfa0d('0x104')]['belongsTo'](db[_0xfa0d('0x8e')],{'as':'mandatoryDispositionPause','foreignKey':_0xfa0d('0x162')});db['WhatsappAccount'][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x1f0')});db[_0xfa0d('0x106')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x106')][_0xfa0d('0x124')](db[_0xfa0d('0x10d')],{'onDelete':_0xfa0d('0x170')});db[_0xfa0d('0x106')][_0xfa0d('0x124')](db[_0xfa0d('0x104')],{'onDelete':'restrict'});db[_0xfa0d('0x106')][_0xfa0d('0x124')](db['Interval'],{'onDelete':_0xfa0d('0x170'),'foreignKey':_0xfa0d('0x187')});db[_0xfa0d('0x106')][_0xfa0d('0x124')](db['Tag'],{'onDelete':_0xfa0d('0x170'),'foreignKey':'TagId'});db[_0xfa0d('0x107')][_0xfa0d('0x115')](db[_0xfa0d('0x109')],{'as':_0xfa0d('0x151'),'onDelete':'cascade','foreignKey':_0xfa0d('0x1f1')});db['WhatsappInteraction'][_0xfa0d('0x124')](db[_0xfa0d('0x104')],{'as':'Account','foreignKey':_0xfa0d('0x1ef')});db[_0xfa0d('0x107')][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':_0xfa0d('0x167'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x168'),'foreignKey':_0xfa0d('0x114')});db[_0xfa0d('0x107')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x1ae'),'as':_0xfa0d('0x16b')});db[_0xfa0d('0x107')][_0xfa0d('0x125')](db[_0xfa0d('0x169')],{'through':_0xfa0d('0x1ae'),'as':_0xfa0d('0x16c')});db[_0xfa0d('0x107')][_0xfa0d('0x125')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x177'),'through':'user_has_whatsapp_interactions','foreignKey':_0xfa0d('0x1f1')});db[_0xfa0d('0x109')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'as':_0xfa0d('0x15')});db[_0xfa0d('0x109')]['belongsTo'](db[_0xfa0d('0x78')],{'onDelete':_0xfa0d('0x113'),'as':_0xfa0d('0x167')});db[_0xfa0d('0x109')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xfa0d('0x182'),'foreignKey':_0xfa0d('0x1f1')});db[_0xfa0d('0x109')][_0xfa0d('0x124')](db[_0xfa0d('0x104')],{'as':_0xfa0d('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xfa0d('0x10a')]['belongsTo'](db['WhatsappAccount'],{});db[_0xfa0d('0x10a')]['belongsTo'](db['CmList'],{'as':_0xfa0d('0x160'),'foreignKey':_0xfa0d('0x171')});db['WhatsappQueueReport'][_0xfa0d('0x124')](db[_0xfa0d('0x78')],{'as':'Contact','foreignKey':_0xfa0d('0x159')});db[_0xfa0d('0x10a')][_0xfa0d('0x124')](db[_0xfa0d('0x107')],{});db[_0xfa0d('0x10a')][_0xfa0d('0x124')](db[_0xfa0d('0x10d')],{});db[_0xfa0d('0x10a')]['belongsTo'](db[_0xfa0d('0x109')],{});db[_0xfa0d('0x10a')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{});db['WhatsappTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x109')],{});db[_0xfa0d('0x10b')][_0xfa0d('0x124')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xfa0d('0x124')](db[_0xfa0d('0x104')],{'foreignKey':_0xfa0d('0x1f2'),'as':'FromAccount'});db[_0xfa0d('0x10b')]['belongsTo'](db[_0xfa0d('0x104')],{'foreignKey':_0xfa0d('0x1f3'),'as':_0xfa0d('0x1e3')});db[_0xfa0d('0x10b')][_0xfa0d('0x124')](db[_0xfa0d('0x10d')],{'foreignKey':_0xfa0d('0x1f4'),'as':_0xfa0d('0x1db')});db[_0xfa0d('0x10b')][_0xfa0d('0x124')](db[_0xfa0d('0x15')],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0xfa0d('0x124')](db['User'],{'foreignKey':_0xfa0d('0x1da'),'as':_0xfa0d('0x1e0')});db['WhatsappQueue'][_0xfa0d('0x125')](db['User'],{'as':_0xfa0d('0x163'),'through':_0xfa0d('0x135'),'foreignKey':_0xfa0d('0x1f5')});db[_0xfa0d('0x10d')][_0xfa0d('0x125')](db[_0xfa0d('0xea')],{'through':_0xfa0d('0x1d2'),'as':_0xfa0d('0x14d')});module[_0xfa0d('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x62d1=['OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ChatWebsiteId','ProactiveActions','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','chat_group_has_users','ChatProactiveAction','CompanyId','Company','cm_contact_has_tags','Campaign','CampaignId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','VariableId','SugarcrmConfiguration','Configurations','SugarcrmField','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','ZendeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowField','ToId','SessionId','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','voice_queues_has_cm_lists','user_has_voice_prefixes','UserProfileSections','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','name','utf8_general_ci','database','username','password','options','User','import','VoiceChanSpy','VoiceContext','VoiceExtension','../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','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../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','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefix','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','mailboxuser','mailbox','AgentReports','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','Agents','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Account','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','FaxApplication','Exntensions','mandatoryDispositionPauseId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId'];(function(_0x49a975,_0x1d28d6){var _0x410d19=function(_0x3b6f60){while(--_0x3b6f60){_0x49a975['push'](_0x49a975['shift']());}};_0x410d19(++_0x1d28d6);}(_0x62d1,0x75));var _0x162d=function(_0x57bfad,_0x5126cc){_0x57bfad=_0x57bfad-0x0;var _0x5d8e2f=_0x62d1[_0x57bfad];return _0x5d8e2f;};'use strict';var path=require('path');var config=require(_0x162d('0x0'));var Sequelize=require(_0x162d('0x1'));var _=require('lodash');var jstz=require(_0x162d('0x2'));var timezone=jstz[_0x162d('0x3')]();config['sequelize']=_[_0x162d('0x4')](config[_0x162d('0x1')],{'database':_0x162d('0x5'),'username':_0x162d('0x6'),'password':_0x162d('0x7'),'options':{'host':_0x162d('0x8'),'port':0xcea,'dialect':_0x162d('0x9'),'dialectOptions':{'charset':_0x162d('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x162d('0xb'),'collate':'utf8_general_ci'}}});config[_0x162d('0xc')]=_[_0x162d('0x4')](config['sequelizeHistory'],{'database':_0x162d('0x5'),'username':_0x162d('0x6'),'password':_0x162d('0x7'),'options':{'host':_0x162d('0x8'),'port':0xcea,'dialect':_0x162d('0x9'),'dialectOptions':{'charset':_0x162d('0xa')},'logging':![],'timezone':timezone[_0x162d('0xd')](),'define':{'charset':_0x162d('0xb'),'collate':_0x162d('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x162d('0x1')][_0x162d('0xf')],config[_0x162d('0x1')][_0x162d('0x10')],config[_0x162d('0x1')][_0x162d('0x11')],config[_0x162d('0x1')][_0x162d('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x162d('0xc')][_0x162d('0xf')],config[_0x162d('0xc')][_0x162d('0x10')],config['sequelizeHistory'][_0x162d('0x11')],config[_0x162d('0xc')][_0x162d('0x12')])};db[_0x162d('0x13')]=db['sequelize'][_0x162d('0x14')]('../api/user/user.model');db[_0x162d('0x15')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x162d('0x16')]=db['sequelize'][_0x162d('0x14')]('../api/voiceContext/voiceContext.model');db[_0x162d('0x17')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x18'));db[_0x162d('0x19')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x1a'));db[_0x162d('0x1b')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x1c'));db[_0x162d('0x1d')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x1e'));db[_0x162d('0x1f')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x20'));db[_0x162d('0x21')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x22'));db[_0x162d('0x23')]=db['sequelize']['import'](_0x162d('0x24'));db[_0x162d('0x25')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x26'));db['VoiceDialReport']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x27'));db[_0x162d('0x28')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x29'));db[_0x162d('0x2a')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x162d('0x14')]('../api/memberReport/memberReport.model');db[_0x162d('0x2b')]=db[_0x162d('0x1')]['import'](_0x162d('0x2c'));db[_0x162d('0x2d')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x162d('0x2e')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x2f'));db['UserVoiceQueue']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x30'));db[_0x162d('0x31')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x32'));db[_0x162d('0x33')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x34'));db[_0x162d('0x35')]=db[_0x162d('0x1')]['import'](_0x162d('0x36'));db[_0x162d('0x37')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x38'));db[_0x162d('0x39')]=db[_0x162d('0x1')]['import'](_0x162d('0x3a'));db[_0x162d('0x3b')]=db['sequelize'][_0x162d('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x162d('0x3c')]=db['sequelize'][_0x162d('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x162d('0x3d')]=db['sequelize'][_0x162d('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x162d('0x3e')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x3f'));db[_0x162d('0x40')]=db['sequelize']['import'](_0x162d('0x41'));db[_0x162d('0x42')]=db['sequelize']['import'](_0x162d('0x43'));db[_0x162d('0x44')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x45'));db[_0x162d('0x46')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x47'));db[_0x162d('0x48')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/mailApplication/mailApplication.model');db[_0x162d('0x49')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0x162d('0x4a')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x4b'));db[_0x162d('0x4c')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x4d'));db[_0x162d('0x4e')]=db['sequelize'][_0x162d('0x14')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x162d('0x1')][_0x162d('0x14')]('../api/faxApplication/faxApplication.model');db[_0x162d('0x4f')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x50'));db[_0x162d('0x51')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x52'));db[_0x162d('0x53')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x54'));db[_0x162d('0x55')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x56'));db[_0x162d('0x57')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x58'));db['SmsApplication']=db['sequelize'][_0x162d('0x14')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x59'));db[_0x162d('0x5a')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x162d('0x5b')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x5c'));db[_0x162d('0x5d')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x5e'));db[_0x162d('0x5f')]=db[_0x162d('0x1')]['import'](_0x162d('0x60'));db['OpenchannelInteraction']=db['sequelize'][_0x162d('0x14')](_0x162d('0x61'));db['OpenchannelMessage']=db[_0x162d('0x1')]['import'](_0x162d('0x62'));db[_0x162d('0x63')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x64'));db['ChatWebsite']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x65'));db[_0x162d('0x66')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x67'));db[_0x162d('0x68')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x69'));db[_0x162d('0x6a')]=db[_0x162d('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x162d('0x6b')]=db[_0x162d('0x1')]['import'](_0x162d('0x6c'));db[_0x162d('0x6d')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x6e'));db[_0x162d('0x6f')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x70'));db['ChatGroup']=db['sequelize']['import'](_0x162d('0x71'));db['ChatProactiveAction']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x72'));db[_0x162d('0x73')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x74'));db[_0x162d('0x75')]=db[_0x162d('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x76'));db[_0x162d('0x77')]=db[_0x162d('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x162d('0x78')]=db['sequelize'][_0x162d('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x162d('0x79')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x7a'));db[_0x162d('0x7b')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x7c'));db['CmCustomField']=db['sequelize'][_0x162d('0x14')](_0x162d('0x7d'));db[_0x162d('0x7e')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/action/action.model');db['Automation']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x7f'));db[_0x162d('0x80')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x162d('0x81')]=db[_0x162d('0x1')]['import'](_0x162d('0x82'));db[_0x162d('0x83')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x84'));db[_0x162d('0x85')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/interval/interval.model');db[_0x162d('0x86')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x87'));db['Cdr']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x88'));db['VoiceQueuesLog']=db['sequelize'][_0x162d('0x14')](_0x162d('0x89'));db[_0x162d('0x8a')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x8b'));db[_0x162d('0x8c')]=db[_0x162d('0x1')]['import'](_0x162d('0x8d'));db['Tag']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x8e'));db[_0x162d('0x8f')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x90'));db[_0x162d('0x91')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x92'));db['Variable']=db[_0x162d('0x1')][_0x162d('0x14')]('../api/variable/variable.model');db['Integration']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x93'));db['IntegrationReport']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x94'));db['AnalyticCustomReport']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x95'));db['AnalyticDefaultReport']=db[_0x162d('0x1')]['import'](_0x162d('0x96'));db[_0x162d('0x97')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x98'));db[_0x162d('0x99')]=db['sequelize'][_0x162d('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0x162d('0x9a')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x9b'));db['AnalyticTreeReport']=db[_0x162d('0x1')]['import'](_0x162d('0x9c'));db[_0x162d('0x9d')]=db[_0x162d('0x1')]['import'](_0x162d('0x9e'));db[_0x162d('0x9f')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xa0'));db['SalesforceField']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xa1'));db[_0x162d('0xa2')]=db[_0x162d('0x1')]['import'](_0x162d('0xa3'));db['SugarcrmConfiguration']=db[_0x162d('0x1')]['import'](_0x162d('0xa4'));db['SugarcrmField']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xa5'));db[_0x162d('0xa6')]=db['sequelize'][_0x162d('0x14')](_0x162d('0xa7'));db[_0x162d('0xa8')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xa9'));db['DeskField']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xaa'));db[_0x162d('0xab')]=db['sequelize'][_0x162d('0x14')](_0x162d('0xac'));db['ZohoConfiguration']=db[_0x162d('0x1')]['import'](_0x162d('0xad'));db['ZohoField']=db[_0x162d('0x1')][_0x162d('0x14')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xae'));db['ZendeskConfiguration']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xaf'));db[_0x162d('0xb0')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xb1'));db[_0x162d('0xb2')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xb3'));db['FreshdeskConfiguration']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xb4'));db[_0x162d('0xb5')]=db[_0x162d('0x1')]['import'](_0x162d('0xb6'));db['VtigerAccount']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xb7'));db[_0x162d('0xb8')]=db[_0x162d('0x1')]['import'](_0x162d('0xb9'));db['VtigerField']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xba'));db[_0x162d('0xbb')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xbc'));db[_0x162d('0xbd')]=db[_0x162d('0x1')]['import'](_0x162d('0xbe'));db['ServicenowField']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xbf'));db[_0x162d('0xc0')]=db[_0x162d('0x1')]['import'](_0x162d('0xc1'));db[_0x162d('0xc2')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xc3'));db[_0x162d('0xc4')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xc5'));db[_0x162d('0xc6')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xc7'));db[_0x162d('0xc8')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xc9'));db[_0x162d('0xca')]=db['sequelize']['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x162d('0xcb')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x93'));db[_0x162d('0xcc')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xcd'));db[_0x162d('0xce')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xcf'));db['ChatInternalMessage']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xd0'));db[_0x162d('0xd1')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xd2'));db[_0x162d('0xd3')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xd4'));db[_0x162d('0xd5')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xd6'));db[_0x162d('0xd7')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x162d('0xd8')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xd9'));db[_0x162d('0xda')]=db[_0x162d('0x1')]['import'](_0x162d('0xdb'));db[_0x162d('0xdc')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xdd'));db[_0x162d('0xde')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/setting/setting.model');db[_0x162d('0xdf')]=db[_0x162d('0x1')][_0x162d('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x162d('0xe0')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xe1'));db['SquareRecording']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xe2'));db[_0x162d('0xe3')]=db['sequelize']['import'](_0x162d('0xe4'));db[_0x162d('0xe5')]=db['sequelize'][_0x162d('0x14')](_0x162d('0xe6'));db['License']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xe7'));db['Campaign']=db[_0x162d('0x1')]['import'](_0x162d('0xe8'));db[_0x162d('0xe9')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xea'));db[_0x162d('0xeb')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xec'));db['Plugin']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xed'));db[_0x162d('0xee')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xef'));db[_0x162d('0xf0')]=db[_0x162d('0x1')]['import'](_0x162d('0xf1'));db[_0x162d('0xf2')]=db['sequelize'][_0x162d('0x14')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xf3'));db[_0x162d('0xf4')]=db['sequelize'][_0x162d('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0x162d('0xf5')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xf6'));db['VoicePrefix']=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0x162d('0xf7')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xf8'));db[_0x162d('0xf9')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xfa'));db[_0x162d('0xfb')]=db['sequelize'][_0x162d('0x14')](_0x162d('0xfc'));db[_0x162d('0xfd')]=db['sequelize'][_0x162d('0x14')](_0x162d('0xfe'));db['WhatsappAccount']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0xff'));db['WhatsappApplication']=db[_0x162d('0x1')]['import'](_0x162d('0x100'));db['WhatsappInteraction']=db[_0x162d('0x1')][_0x162d('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x162d('0x101')]=db[_0x162d('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x162d('0x102')]=db['sequelize'][_0x162d('0x14')](_0x162d('0x103'));db[_0x162d('0x104')]=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x105'));db['WhatsappQueue']=db[_0x162d('0x1')]['import'](_0x162d('0x106'));db['CloudProvider']=db[_0x162d('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x162d('0x1')][_0x162d('0x14')](_0x162d('0x107'));db[_0x162d('0x13')][_0x162d('0x108')](db[_0x162d('0x21')],{'as':'VoiceMail','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x1d')],{'as':_0x162d('0x10c'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x2e')],{'as':_0x162d('0x10d'),'foreignKey':'UserId'});db[_0x162d('0x13')]['hasMany'](db[_0x162d('0x17')],{'as':_0x162d('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0x162d('0x13')][_0x162d('0x10b')](db['CmHopperFinal'],{'as':_0x162d('0x10f'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x79')],{'as':_0x162d('0x110'),'foreignKey':'UserId'});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x7b')],{'as':_0x162d('0x7b'),'foreignKey':_0x162d('0x10a')});db['User'][_0x162d('0x10b')](db['OpenchannelInteraction'],{'as':_0x162d('0x111'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x6a')],{'as':'ChatInteractions','foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')]['hasMany'](db[_0x162d('0x112')],{'as':_0x162d('0x113'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x162d('0x10a')});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x44')],{'as':_0x162d('0x114'),'foreignKey':'UserId'});db[_0x162d('0x13')][_0x162d('0x10b')](db[_0x162d('0x115')],{'as':_0x162d('0x116'),'foreignKey':_0x162d('0x10a')});db['User']['hasMany'](db[_0x162d('0xfd')],{'as':'UserNotifications','foreignKey':_0x162d('0x117')});db[_0x162d('0x13')][_0x162d('0x118')](db[_0x162d('0xf7')],{'as':_0x162d('0xf7'),'foreignKey':_0x162d('0x119')});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x11b')],{'as':'Groups','through':'chat_group_has_users'});db[_0x162d('0x13')]['belongsToMany'](db['CmContact'],{'as':_0x162d('0x11c'),'through':_0x162d('0x11d')});db[_0x162d('0x13')]['belongsToMany'](db[_0x162d('0xf5')],{'as':_0x162d('0x11e'),'through':_0x162d('0x11f')});db[_0x162d('0x13')][_0x162d('0x11a')](db['Team'],{'through':_0x162d('0x120')});db[_0x162d('0x13')][_0x162d('0x11a')](db['MailInteraction'],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x162d('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':_0x162d('0x121'),'through':_0x162d('0x122')});db['User'][_0x162d('0x11a')](db[_0x162d('0x4f')],{'as':_0x162d('0x123'),'through':_0x162d('0x124')});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x112')],{'as':_0x162d('0x113'),'through':'user_has_sms_interactions'});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x125')],{'as':_0x162d('0x111'),'through':_0x162d('0x126')});db[_0x162d('0x13')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x162d('0x116'),'through':_0x162d('0x127')});db[_0x162d('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0x162d('0x128'),'through':_0x162d('0x129'),'required':![]});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x40')],{'as':_0x162d('0x12a'),'through':_0x162d('0x33'),'required':![]});db['User'][_0x162d('0x11a')](db[_0x162d('0x6f')],{'as':_0x162d('0x12b'),'through':_0x162d('0x31'),'required':![],'hooks':!![]});db[_0x162d('0x13')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x162d('0x35'),'required':![]});db[_0x162d('0x13')]['belongsToMany'](db[_0x162d('0x5b')],{'as':_0x162d('0x12c'),'through':_0x162d('0x37'),'required':![]});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x63')],{'as':_0x162d('0x12d'),'through':_0x162d('0x39'),'required':![]});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x12e')],{'as':_0x162d('0x12f'),'through':_0x162d('0x3b'),'required':![]});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0xf5')],{'through':_0x162d('0x11f')});db['User'][_0x162d('0x11a')](db[_0x162d('0x130')],{'as':_0x162d('0x131'),'through':'user_has_voice_prefixes','required':![]});db[_0x162d('0x13')]['belongsToMany'](db[_0x162d('0x132')],{'as':_0x162d('0x133'),'through':_0x162d('0x134')});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x4e')],{'as':_0x162d('0x135'),'through':_0x162d('0x136')});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x3e')],{'as':_0x162d('0x137'),'through':'user_has_mail_accounts'});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0x5d')],{'as':_0x162d('0x138'),'through':_0x162d('0x139')});db['User'][_0x162d('0x11a')](db[_0x162d('0x57')],{'as':'SmsAccounts','through':_0x162d('0x13a')});db[_0x162d('0x13')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x162d('0x13b'),'through':_0x162d('0x13c')});db[_0x162d('0x13')][_0x162d('0x11a')](db[_0x162d('0xe0')],{'as':_0x162d('0x13d'),'through':_0x162d('0x13e')});db[_0x162d('0x15')][_0x162d('0x10b')](db['VoiceExtension'],{'as':_0x162d('0x13f'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x140')});db[_0x162d('0x16')][_0x162d('0x10b')](db[_0x162d('0x17')],{'onDelete':'cascade'});db['VoiceExtension'][_0x162d('0x10b')](db['VoiceExtension'],{'as':_0x162d('0x141'),'onDelete':_0x162d('0x109')});db['VoiceMusicOnHold'][_0x162d('0x11a')](db[_0x162d('0x8c')],{'as':_0x162d('0x142'),'through':_0x162d('0x143')});db['VoiceQueue'][_0x162d('0x10b')](db[_0x162d('0x2e')],{'as':_0x162d('0x144'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')][_0x162d('0x10b')](db[_0x162d('0x146')],{'as':_0x162d('0x147'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')]['hasMany'](db[_0x162d('0x78')],{'as':_0x162d('0x10f'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')][_0x162d('0x10b')](db[_0x162d('0x79')],{'as':_0x162d('0x148'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')][_0x162d('0x10b')](db[_0x162d('0x7b')],{'as':_0x162d('0x7b'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')]['hasMany'](db[_0x162d('0x77')],{'as':_0x162d('0x149'),'foreignKey':'VoiceQueueId'});db[_0x162d('0x1b')]['hasMany'](db[_0x162d('0xd5')],{'as':_0x162d('0x14a'),'foreignKey':_0x162d('0x145')});db[_0x162d('0x1b')][_0x162d('0x118')](db[_0x162d('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x162d('0x1b')][_0x162d('0x118')](db[_0x162d('0x2b')],{'as':_0x162d('0x14b'),'foreignKey':_0x162d('0x14c')});db[_0x162d('0x1b')][_0x162d('0x118')](db[_0x162d('0x85')],{'as':'Interval','foreignKey':_0x162d('0x14d')});db[_0x162d('0x1b')][_0x162d('0x118')](db[_0x162d('0x86')],{'as':_0x162d('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x162d('0x1b')][_0x162d('0x11a')](db[_0x162d('0xf5')],{'as':_0x162d('0x11e'),'through':'voice_queues_has_cm_lists'});db[_0x162d('0x1b')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x162d('0x1b')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'as':_0x162d('0x14f'),'through':_0x162d('0x150')});db[_0x162d('0x1b')][_0x162d('0x11a')](db[_0x162d('0xf5')],{'as':'BlackLists','through':_0x162d('0x151')});db[_0x162d('0x1d')]['belongsTo'](db[_0x162d('0x13')],{'as':'User','foreignKey':_0x162d('0x10a')});db[_0x162d('0x1f')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':'User','foreignKey':_0x162d('0x10a')});db[_0x162d('0x21')][_0x162d('0x10b')](db[_0x162d('0x23')],{'as':'Messages','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x152'),'sourceKey':'mailbox'});db[_0x162d('0x23')][_0x162d('0x118')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x162d('0x153')});db[_0x162d('0x25')][_0x162d('0x10b')](db[_0x162d('0x2a')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x162d('0x25')][_0x162d('0x10b')](db['VoiceAgentReport'],{'as':_0x162d('0x154'),'foreignKey':_0x162d('0x155'),'constraints':![]});db['VoiceCallReport'][_0x162d('0x118')](db['User'],{'as':_0x162d('0x13'),'foreignKey':_0x162d('0x10a')});db['VoiceCallReport'][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db['MailServerIn'][_0x162d('0x118')](db[_0x162d('0x3e')],{'as':'MailAccount','foreignKey':_0x162d('0x158')});db['MailServerOut']['belongsTo'](db[_0x162d('0x3e')],{'as':_0x162d('0x3e'),'foreignKey':_0x162d('0x158')});db['MailAccount'][_0x162d('0x108')](db[_0x162d('0x3c')],{'as':_0x162d('0x159'),'onDelete':_0x162d('0x109')});db['MailAccount'][_0x162d('0x108')](db[_0x162d('0x3d')],{'as':_0x162d('0x15a'),'onDelete':_0x162d('0x109')});db[_0x162d('0x3e')]['hasMany'](db[_0x162d('0x81')],{'as':_0x162d('0x15b'),'foreignKey':_0x162d('0x158')});db[_0x162d('0x3e')][_0x162d('0x10b')](db[_0x162d('0x80')],{'as':_0x162d('0x15c'),'foreignKey':_0x162d('0x158')});db[_0x162d('0x3e')]['hasMany'](db['MailMessage'],{'as':_0x162d('0x15d'),'foreignKey':_0x162d('0x158')});db[_0x162d('0x3e')][_0x162d('0x10b')](db[_0x162d('0x44')],{'as':_0x162d('0x15e')});db[_0x162d('0x3e')]['hasMany'](db[_0x162d('0x48')],{'as':'Applications'});db[_0x162d('0x3e')][_0x162d('0x118')](db['CmList'],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0x3e')][_0x162d('0x118')](db[_0x162d('0x8f')],{'as':_0x162d('0x8f'),'foreignKey':_0x162d('0x161')});db[_0x162d('0x3e')]['belongsTo'](db[_0x162d('0x86')],{'as':_0x162d('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x162d('0x3e')][_0x162d('0x11a')](db['User'],{'as':_0x162d('0x162'),'through':_0x162d('0x163')});db[_0x162d('0x40')]['belongsToMany'](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':_0x162d('0x33')});db[_0x162d('0x40')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'through':_0x162d('0x164'),'as':_0x162d('0x14f')});db['MailInteraction'][_0x162d('0x10b')](db[_0x162d('0x46')],{'as':_0x162d('0x15d'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x165')});db[_0x162d('0x44')][_0x162d('0x118')](db['MailAccount'],{'as':'Account','foreignKey':_0x162d('0x158')});db[_0x162d('0x44')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x162d('0x44')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x166'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x44')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':_0x162d('0x168'),'as':_0x162d('0x169')});db['MailInteraction']['belongsToMany'](db[_0x162d('0x167')],{'through':_0x162d('0x168'),'as':_0x162d('0x16a')});db[_0x162d('0x44')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x16b'),'through':_0x162d('0x16c'),'foreignKey':_0x162d('0x165')});db[_0x162d('0x46')]['hasMany'](db['Attachment'],{'as':_0x162d('0x16d'),'onDelete':_0x162d('0x109')});db[_0x162d('0x46')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x13')});db['MailMessage'][_0x162d('0x118')](db['CmContact'],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156')});db[_0x162d('0x46')][_0x162d('0x118')](db[_0x162d('0x44')],{'as':'Interaction','foreignKey':_0x162d('0x165')});db[_0x162d('0x46')][_0x162d('0x118')](db[_0x162d('0x3e')],{'as':_0x162d('0x16e'),'foreignKey':'MailAccountId'});db[_0x162d('0x46')]['belongsTo'](db[_0x162d('0x132')],{'as':_0x162d('0x132'),'foreignKey':'ChatWebsiteId'});db[_0x162d('0x46')][_0x162d('0x118')](db[_0x162d('0x6d')],{'as':_0x162d('0x6d'),'foreignKey':_0x162d('0x16f')});db[_0x162d('0x48')][_0x162d('0x118')](db['User'],{'onDelete':_0x162d('0x170')});db[_0x162d('0x48')][_0x162d('0x118')](db['MailQueue'],{'onDelete':_0x162d('0x170')});db[_0x162d('0x48')][_0x162d('0x118')](db[_0x162d('0x3e')],{'onDelete':_0x162d('0x170')});db[_0x162d('0x48')][_0x162d('0x118')](db[_0x162d('0x85')],{'onDelete':'restrict','foreignKey':_0x162d('0x14d')});db[_0x162d('0x48')][_0x162d('0x118')](db['Tag'],{'onDelete':_0x162d('0x170'),'foreignKey':_0x162d('0x171')});db[_0x162d('0x49')]['belongsTo'](db[_0x162d('0x3e')],{});db['MailQueueReport'][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0x49')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x49')]['belongsTo'](db[_0x162d('0x44')],{});db[_0x162d('0x49')][_0x162d('0x118')](db['MailMessage'],{});db[_0x162d('0x49')][_0x162d('0x118')](db[_0x162d('0x13')],{});db[_0x162d('0x49')]['belongsTo'](db[_0x162d('0x40')],{});db[_0x162d('0x4a')][_0x162d('0x10b')](db['DashboardItem'],{'as':_0x162d('0x172'),'onDelete':_0x162d('0x109')});db['FaxAccount'][_0x162d('0x10b')](db['Disposition'],{'as':_0x162d('0x15b'),'foreignKey':_0x162d('0x173')});db[_0x162d('0x4e')][_0x162d('0x10b')](db[_0x162d('0x80')],{'as':_0x162d('0x15c'),'foreignKey':'FaxAccountId'});db[_0x162d('0x4e')][_0x162d('0x10b')](db[_0x162d('0x4f')],{'as':_0x162d('0x15e')});db[_0x162d('0x4e')][_0x162d('0x10b')](db[_0x162d('0x174')],{'as':_0x162d('0x141')});db[_0x162d('0x4e')]['hasMany'](db[_0x162d('0x17')],{'as':_0x162d('0x175'),'onDelete':'cascade'});db[_0x162d('0x4e')][_0x162d('0x10b')](db[_0x162d('0x51')],{'as':_0x162d('0x15d')});db[_0x162d('0x4e')][_0x162d('0x118')](db[_0x162d('0x2b')],{'as':_0x162d('0x2b')});db[_0x162d('0x4e')][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':'ListId'});db[_0x162d('0x4e')][_0x162d('0x118')](db[_0x162d('0x86')],{'as':_0x162d('0x14e'),'foreignKey':_0x162d('0x176')});db[_0x162d('0x4e')][_0x162d('0x11a')](db['User'],{'as':_0x162d('0x162'),'through':_0x162d('0x136')});db[_0x162d('0x174')][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':_0x162d('0x170')});db[_0x162d('0x174')][_0x162d('0x118')](db[_0x162d('0x53')],{'onDelete':_0x162d('0x170')});db[_0x162d('0x174')]['belongsTo'](db[_0x162d('0x4e')],{'onDelete':_0x162d('0x170')});db['FaxApplication'][_0x162d('0x118')](db['Tag'],{'onDelete':_0x162d('0x170'),'foreignKey':'TagId'});db[_0x162d('0x4f')][_0x162d('0x10b')](db[_0x162d('0x51')],{'as':_0x162d('0x15d'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x162d('0x118')](db[_0x162d('0x4e')],{'as':'Account','foreignKey':_0x162d('0x173')});db[_0x162d('0x4f')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x4f')]['belongsTo'](db[_0x162d('0x13')],{'as':_0x162d('0x166'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x4f')]['belongsToMany'](db[_0x162d('0x167')],{'through':_0x162d('0x177'),'as':'Tags'});db[_0x162d('0x4f')]['belongsToMany'](db[_0x162d('0x167')],{'through':_0x162d('0x177'),'as':_0x162d('0x16a')});db[_0x162d('0x4f')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x16b'),'through':'user_has_fax_interactions','foreignKey':_0x162d('0x178')});db[_0x162d('0x51')][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':'cascade','as':_0x162d('0x13')});db[_0x162d('0x51')][_0x162d('0x118')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x162d('0x178')});db[_0x162d('0x51')][_0x162d('0x118')](db[_0x162d('0x75')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156')});db[_0x162d('0x51')][_0x162d('0x118')](db[_0x162d('0xeb')],{'as':_0x162d('0xeb'),'foreignKey':'AttachmentId'});db[_0x162d('0x51')][_0x162d('0x118')](db[_0x162d('0x4e')],{'as':_0x162d('0x16e'),'foreignKey':'FaxAccountId'});db[_0x162d('0x53')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Agents','through':_0x162d('0x35')});db[_0x162d('0x53')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'through':_0x162d('0x179'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x162d('0x4e')],{});db[_0x162d('0x55')][_0x162d('0x118')](db['CmList'],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0x55')][_0x162d('0x118')](db['CmContact'],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db['FaxQueueReport']['belongsTo'](db[_0x162d('0x4f')],{});db[_0x162d('0x55')][_0x162d('0x118')](db[_0x162d('0x51')],{});db['FaxQueueReport'][_0x162d('0x118')](db[_0x162d('0x13')],{});db[_0x162d('0x55')][_0x162d('0x118')](db[_0x162d('0x53')],{});db[_0x162d('0x57')]['hasMany'](db['Disposition'],{'as':_0x162d('0x15b'),'foreignKey':_0x162d('0x17a')});db['SmsAccount'][_0x162d('0x10b')](db[_0x162d('0x80')],{'as':_0x162d('0x15c'),'foreignKey':_0x162d('0x17a')});db[_0x162d('0x57')][_0x162d('0x10b')](db[_0x162d('0x5a')],{'as':'Messages','foreignKey':_0x162d('0x17a')});db[_0x162d('0x57')][_0x162d('0x10b')](db['SmsInteraction'],{'as':_0x162d('0x15e')});db['SmsAccount'][_0x162d('0x10b')](db[_0x162d('0x17b')],{'as':'Applications'});db['SmsAccount'][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0x162d('0x57')]['belongsTo'](db[_0x162d('0x86')],{'as':_0x162d('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x162d('0x57')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x162d('0x17b')][_0x162d('0x118')](db['User'],{'onDelete':_0x162d('0x170')});db[_0x162d('0x17b')][_0x162d('0x118')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x162d('0x17b')][_0x162d('0x118')](db['SmsAccount'],{'onDelete':_0x162d('0x170')});db['SmsApplication'][_0x162d('0x118')](db['Interval'],{'onDelete':_0x162d('0x170'),'foreignKey':_0x162d('0x14d')});db[_0x162d('0x17b')][_0x162d('0x118')](db[_0x162d('0x167')],{'onDelete':_0x162d('0x170'),'foreignKey':_0x162d('0x171')});db[_0x162d('0x112')]['hasMany'](db[_0x162d('0x5a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x162d('0x17c')});db[_0x162d('0x112')][_0x162d('0x118')](db['SmsAccount'],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x17a')});db[_0x162d('0x112')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x112')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction'][_0x162d('0x11a')](db['Tag'],{'through':_0x162d('0x17d'),'as':_0x162d('0x169')});db[_0x162d('0x112')][_0x162d('0x11a')](db['Tag'],{'through':_0x162d('0x17d'),'as':_0x162d('0x16a')});db[_0x162d('0x112')][_0x162d('0x11a')](db['User'],{'as':_0x162d('0x16b'),'through':_0x162d('0x17e'),'foreignKey':_0x162d('0x17c')});db[_0x162d('0x5a')][_0x162d('0x118')](db['User'],{'as':_0x162d('0x13')});db[_0x162d('0x5a')][_0x162d('0x118')](db['CmContact'],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156')});db[_0x162d('0x5a')][_0x162d('0x118')](db[_0x162d('0x112')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x17f'),'foreignKey':_0x162d('0x17c')});db[_0x162d('0x5a')][_0x162d('0x118')](db['SmsAccount'],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x17a')});db[_0x162d('0x5b')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':'UserSmsQueue','foreignKey':_0x162d('0x180')});db[_0x162d('0x5b')]['belongsToMany'](db[_0x162d('0xe5')],{'through':_0x162d('0x181'),'as':'Teams'});db['OpenchannelAccount'][_0x162d('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x162d('0x182')});db[_0x162d('0x5d')][_0x162d('0x10b')](db[_0x162d('0x80')],{'as':_0x162d('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x162d('0x5d')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x162d('0x182')});db[_0x162d('0x5d')][_0x162d('0x10b')](db['OpenchannelMessage'],{'as':_0x162d('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x162d('0x5d')]['hasMany'](db[_0x162d('0x5f')],{'as':_0x162d('0x141'),'foreignKey':'OpenchannelAccountId'});db[_0x162d('0x5d')]['belongsTo'](db[_0x162d('0xf5')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x162d('0x118')](db[_0x162d('0x86')],{'as':_0x162d('0x14e'),'foreignKey':_0x162d('0x176')});db[_0x162d('0x5d')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Agents','through':_0x162d('0x139')});db[_0x162d('0x5f')][_0x162d('0x118')](db['User'],{'onDelete':_0x162d('0x170')});db[_0x162d('0x5f')][_0x162d('0x118')](db[_0x162d('0x63')],{'onDelete':'restrict','foreignKey':_0x162d('0x183')});db[_0x162d('0x5f')][_0x162d('0x118')](db[_0x162d('0x5d')],{'onDelete':'restrict','foreignKey':_0x162d('0x182')});db[_0x162d('0x5f')]['belongsTo'](db[_0x162d('0x85')],{'onDelete':'restrict','foreignKey':_0x162d('0x14d')});db[_0x162d('0x5f')][_0x162d('0x118')](db[_0x162d('0x167')],{'onDelete':'restrict','foreignKey':_0x162d('0x171')});db[_0x162d('0x125')]['hasMany'](db[_0x162d('0x184')],{'as':_0x162d('0x15d'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x185')});db[_0x162d('0x125')][_0x162d('0x118')](db[_0x162d('0x5d')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x162d('0x125')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x125')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x166'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x125')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':_0x162d('0x186'),'as':_0x162d('0x169')});db[_0x162d('0x125')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':_0x162d('0x186'),'as':'ThroughTags'});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0x162d('0x16b'),'through':_0x162d('0x126'),'foreignKey':_0x162d('0x185')});db[_0x162d('0x184')][_0x162d('0x118')](db['User'],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x13')});db[_0x162d('0x184')][_0x162d('0x118')](db[_0x162d('0x75')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156')});db[_0x162d('0x184')][_0x162d('0x118')](db[_0x162d('0x125')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x17f'),'foreignKey':_0x162d('0x185')});db['OpenchannelMessage'][_0x162d('0x118')](db['Attachment'],{'as':_0x162d('0xeb'),'foreignKey':_0x162d('0x187')});db[_0x162d('0x184')]['belongsTo'](db[_0x162d('0x5d')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x182')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x162d('0x162'),'through':_0x162d('0x39'),'foreignKey':_0x162d('0x183')});db[_0x162d('0x63')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'through':'team_has_openchannel_queues','as':_0x162d('0x14f')});db[_0x162d('0x132')][_0x162d('0x10b')](db[_0x162d('0x81')],{'as':_0x162d('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0x162d('0x132')][_0x162d('0x10b')](db[_0x162d('0x80')],{'as':_0x162d('0x15c'),'foreignKey':_0x162d('0x188')});db[_0x162d('0x132')][_0x162d('0x10b')](db['ChatProactiveAction'],{'as':_0x162d('0x189')});db[_0x162d('0x132')][_0x162d('0x10b')](db[_0x162d('0x6a')],{'as':'Interactions'});db[_0x162d('0x132')][_0x162d('0x10b')](db[_0x162d('0x68')],{'as':_0x162d('0x141')});db[_0x162d('0x132')][_0x162d('0x10b')](db[_0x162d('0x6b')],{'as':_0x162d('0x15d')});db['ChatWebsite'][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':'List','foreignKey':_0x162d('0x160')});db[_0x162d('0x132')][_0x162d('0x118')](db[_0x162d('0x85')],{'as':'Interval','foreignKey':_0x162d('0x14d')});db['ChatWebsite'][_0x162d('0x118')](db[_0x162d('0x3e')],{'as':'MailAccount','foreignKey':_0x162d('0x158')});db[_0x162d('0x132')][_0x162d('0x118')](db['Pause'],{'as':_0x162d('0x14e'),'foreignKey':_0x162d('0x176')});db[_0x162d('0x132')]['belongsToMany'](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':_0x162d('0x134')});db['OpenchannelQueueReport']['belongsTo'](db[_0x162d('0x5d')],{});db['OpenchannelQueueReport'][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':'List','foreignKey':_0x162d('0x160')});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x66')][_0x162d('0x118')](db['OpenchannelInteraction'],{});db[_0x162d('0x66')][_0x162d('0x118')](db['OpenchannelMessage'],{});db[_0x162d('0x66')][_0x162d('0x118')](db[_0x162d('0x13')],{});db[_0x162d('0x66')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x162d('0x68')]['belongsTo'](db[_0x162d('0x13')],{'as':_0x162d('0x18a'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x162d('0x6f')],{'as':_0x162d('0x18b'),'foreignKey':'ChatQueueId','onDelete':_0x162d('0x170')});db[_0x162d('0x68')][_0x162d('0x118')](db[_0x162d('0x132')],{'as':_0x162d('0x18c'),'foreignKey':_0x162d('0x188'),'onDelete':_0x162d('0x170')});db[_0x162d('0x68')][_0x162d('0x118')](db[_0x162d('0x167')],{'onDelete':_0x162d('0x170'),'foreignKey':'TagId'});db[_0x162d('0x6a')][_0x162d('0x10b')](db['ChatMessage'],{'as':_0x162d('0x15d'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x162d('0x6a')][_0x162d('0x118')](db[_0x162d('0x132')],{'as':_0x162d('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0x162d('0x6a')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x162d('0x118')](db['User'],{'as':_0x162d('0x166'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x6a')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x162d('0x6a')][_0x162d('0x11a')](db['Tag'],{'through':_0x162d('0x18d'),'as':'ThroughTags'});db[_0x162d('0x6a')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Users','through':_0x162d('0x122'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x13')});db['ChatMessage'][_0x162d('0x118')](db[_0x162d('0x75')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x6b')][_0x162d('0x118')](db[_0x162d('0x6a')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x17f'),'foreignKey':_0x162d('0x18e')});db[_0x162d('0x6b')][_0x162d('0x118')](db[_0x162d('0xeb')],{'as':_0x162d('0xeb'),'foreignKey':_0x162d('0x187')});db[_0x162d('0x6b')]['belongsTo'](db[_0x162d('0x132')],{'as':'Account','foreignKey':_0x162d('0x188')});db[_0x162d('0x6d')]['belongsTo'](db['CmContact'],{'onDelete':_0x162d('0x109'),'as':'Contact','foreignKey':_0x162d('0x157')});db[_0x162d('0x6d')][_0x162d('0x118')](db[_0x162d('0x132')],{'as':'Account','foreignKey':_0x162d('0x188')});db['ChatQueue'][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':_0x162d('0x31'),'hooks':!![]});db[_0x162d('0x6f')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'through':_0x162d('0x18f'),'as':_0x162d('0x14f')});db[_0x162d('0x11b')]['hasMany'](db[_0x162d('0x190')],{'as':_0x162d('0x15d'),'foreignKey':'ChatGroupId','onDelete':_0x162d('0x109')});db[_0x162d('0x11b')]['belongsToMany'](db[_0x162d('0x13')],{'as':'Members','through':_0x162d('0x191')});db[_0x162d('0x192')]['belongsTo'](db[_0x162d('0x132')],{'as':_0x162d('0x18c'),'foreignKey':_0x162d('0x188')});db[_0x162d('0x73')][_0x162d('0x10b')](db['CmContact'],{'as':_0x162d('0x11c'),'foreignKey':_0x162d('0x193')});db[_0x162d('0x75')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x162d('0x75')][_0x162d('0x10b')](db['CmHopperFinal'],{'as':_0x162d('0x10f'),'foreignKey':'ContactId'});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x79')],{'as':_0x162d('0x148'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x7b')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x162d('0x75')][_0x162d('0x10b')](db['JscriptySessionReport'],{'as':_0x162d('0x14a'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x125')],{'as':_0x162d('0x111'),'foreignKey':_0x162d('0x157'),'onDelete':_0x162d('0x170')});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x6a')],{'as':_0x162d('0x121'),'foreignKey':'ContactId','onDelete':_0x162d('0x170')});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x112')],{'as':_0x162d('0x113'),'foreignKey':_0x162d('0x157'),'onDelete':_0x162d('0x170')});db[_0x162d('0x75')]['hasMany'](db[_0x162d('0x4f')],{'as':_0x162d('0x123'),'foreignKey':_0x162d('0x157'),'onDelete':_0x162d('0x170')});db[_0x162d('0x75')][_0x162d('0x10b')](db[_0x162d('0x44')],{'as':_0x162d('0x114'),'foreignKey':_0x162d('0x157'),'onDelete':_0x162d('0x170')});db[_0x162d('0x75')][_0x162d('0x118')](db['CmCompany'],{'as':_0x162d('0x194'),'foreignKey':_0x162d('0x193')});db['CmContact']['belongsTo'](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':'ListId','onDelete':_0x162d('0x109')});db['CmContact']['belongsToMany'](db[_0x162d('0x13')],{'as':_0x162d('0x16b'),'through':'cm_user_has_contacts'});db['CmContact'][_0x162d('0x11a')](db[_0x162d('0x167')],{'as':_0x162d('0x169'),'through':_0x162d('0x195')});db[_0x162d('0x75')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':_0x162d('0x195'),'as':_0x162d('0x16a')});db[_0x162d('0x146')]['belongsTo'](db[_0x162d('0x75')],{'as':'Contact','foreignKey':_0x162d('0x157'),'onDelete':_0x162d('0x109')});db[_0x162d('0x146')]['belongsTo'](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160'),'onDelete':_0x162d('0x109')});db['CmHopper'][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x18a'),'foreignKey':_0x162d('0x10a')});db[_0x162d('0x146')][_0x162d('0x118')](db['VoiceQueue'],{'as':_0x162d('0x18b'),'foreignKey':_0x162d('0x145'),'onDelete':_0x162d('0x109')});db[_0x162d('0x146')][_0x162d('0x118')](db[_0x162d('0x196')],{'as':'Campaign','foreignKey':_0x162d('0x197'),'onDelete':_0x162d('0x109')});db[_0x162d('0x146')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x166'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':'ContactId','onDelete':_0x162d('0x109')});db[_0x162d('0x77')]['belongsTo'](db[_0x162d('0xf5')],{'as':'List','foreignKey':_0x162d('0x160'),'onDelete':_0x162d('0x109')});db[_0x162d('0x77')][_0x162d('0x118')](db[_0x162d('0x1b')],{'as':_0x162d('0x18b'),'foreignKey':_0x162d('0x145'),'onDelete':_0x162d('0x109')});db['CmHopperBlack']['belongsTo'](db[_0x162d('0x196')],{'as':_0x162d('0x196'),'foreignKey':'CampaignId','onDelete':_0x162d('0x109')});db[_0x162d('0x198')][_0x162d('0x10b')](db[_0x162d('0x83')],{'as':{'plural':_0x162d('0x199'),'singular':_0x162d('0x19a')},'foreignKey':_0x162d('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0x162d('0x198')]['hasMany'](db[_0x162d('0x83')],{'as':{'plural':_0x162d('0x19c'),'singular':_0x162d('0x19d')},'foreignKey':_0x162d('0x19e'),'onDelete':_0x162d('0x109'),'hooks':!![]});db[_0x162d('0x198')][_0x162d('0x10b')](db[_0x162d('0x7e')],{'as':_0x162d('0x19f'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x162d('0x81')]['hasMany'](db[_0x162d('0x81')],{'as':_0x162d('0x15b'),'foreignKey':_0x162d('0x1a0'),'onDelete':_0x162d('0x109')});db[_0x162d('0x85')][_0x162d('0x10b')](db[_0x162d('0x85')],{'as':_0x162d('0x1a1'),'foreignKey':'IntervalId','onDelete':_0x162d('0x109'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x162d('0x17')],{'as':_0x162d('0x10e'),'foreignKey':_0x162d('0x14d'),'onDelete':_0x162d('0x170')});db[_0x162d('0x85')]['hasMany'](db[_0x162d('0x48')],{'as':_0x162d('0x1a2'),'foreignKey':'IntervalId'});db['Interval'][_0x162d('0x10b')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x162d('0x14d')});db['Interval'][_0x162d('0x10b')](db[_0x162d('0x174')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x162d('0x17b')],{'as':_0x162d('0x1a3'),'foreignKey':'IntervalId'});db[_0x162d('0x8a')][_0x162d('0x118')](db[_0x162d('0x3e')],{});db[_0x162d('0x8a')]['belongsTo'](db[_0x162d('0x1a4')],{'foreignKey':_0x162d('0x1a5')});db[_0x162d('0x8a')]['belongsTo'](db[_0x162d('0x1a6')],{'foreignKey':_0x162d('0x1a7')});db[_0x162d('0x8c')][_0x162d('0x11a')](db[_0x162d('0x19')],{'as':_0x162d('0x1a8'),'through':'moh_has_sounds','onDelete':_0x162d('0x170')});db[_0x162d('0x167')][_0x162d('0x11a')](db[_0x162d('0x75')],{'through':'cm_contact_has_tags'});db[_0x162d('0x167')][_0x162d('0x11a')](db[_0x162d('0x6a')],{'through':_0x162d('0x18d')});db['Tag'][_0x162d('0x11a')](db[_0x162d('0x44')],{'through':_0x162d('0x168')});db[_0x162d('0x167')][_0x162d('0x11a')](db[_0x162d('0x112')],{'through':_0x162d('0x17d')});db[_0x162d('0x167')]['belongsToMany'](db[_0x162d('0x4f')],{'through':_0x162d('0x177')});db['Tag'][_0x162d('0x11a')](db['OpenchannelInteraction'],{'through':_0x162d('0x186')});db['Tag'][_0x162d('0x11a')](db[_0x162d('0x115')],{'through':_0x162d('0x1a9')});db[_0x162d('0x91')][_0x162d('0x10b')](db[_0x162d('0x83')],{'as':{'plural':_0x162d('0x1aa'),'singular':_0x162d('0x1ab')},'foreignKey':_0x162d('0x1ac'),'onDelete':_0x162d('0x109'),'hooks':!![]});db[_0x162d('0x91')][_0x162d('0x10b')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x162d('0x1ad')},'foreignKey':_0x162d('0x1ae'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x162d('0x10b')](db[_0x162d('0x7e')],{'as':_0x162d('0x19f'),'foreignKey':_0x162d('0x1af'),'onDelete':_0x162d('0x109'),'hooks':!![]});db[_0x162d('0x1a6')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1a7'),'hooks':!![]});db[_0x162d('0x1a4')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x162d('0x1b0'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1a5')});db['AnalyticMetric'][_0x162d('0x10b')](db[_0x162d('0x9a')],{'as':_0x162d('0x1b0'),'onDelete':_0x162d('0x109'),'foreignKey':'MetricId'});db[_0x162d('0x9a')][_0x162d('0x118')](db[_0x162d('0x99')],{'foreignKey':_0x162d('0x1b1')});db['SalesforceAccount'][_0x162d('0x10b')](db[_0x162d('0x9f')],{'as':'Configurations','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x9f')][_0x162d('0x10b')](db['SalesforceField'],{'as':_0x162d('0x1b3'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0x9f')]['hasMany'](db[_0x162d('0x1b5')],{'as':_0x162d('0x1b6'),'onDelete':_0x162d('0x109'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x162d('0x1b0'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b7')});db['SalesforceConfiguration'][_0x162d('0x118')](db[_0x162d('0x9d')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1b5')]['hasMany'](db[_0x162d('0x1b5')],{'as':_0x162d('0x1b8'),'foreignKey':'SubjectId'});db[_0x162d('0x1b5')]['hasMany'](db['SalesforceField'],{'as':_0x162d('0x1b9'),'foreignKey':_0x162d('0x1ba')});db[_0x162d('0x1b5')][_0x162d('0x10b')](db[_0x162d('0x1b5')],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1b5')][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':'Variable','foreignKey':_0x162d('0x1bd')});db[_0x162d('0xa2')]['hasMany'](db[_0x162d('0x1be')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':'AccountId'});db[_0x162d('0x1be')][_0x162d('0x10b')](db[_0x162d('0x1c0')],{'as':_0x162d('0x1b3'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0x1be')]['hasMany'](db[_0x162d('0x1c0')],{'as':_0x162d('0x1b6'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1ba')});db[_0x162d('0x1be')][_0x162d('0x10b')](db[_0x162d('0x1c0')],{'as':_0x162d('0x1b0'),'onDelete':_0x162d('0x109'),'foreignKey':'FieldId'});db[_0x162d('0x1be')][_0x162d('0x118')](db[_0x162d('0xa2')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c0')]['hasMany'](db[_0x162d('0x1c0')],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db['SugarcrmField'][_0x162d('0x10b')](db[_0x162d('0x1c0')],{'as':_0x162d('0x1b9'),'foreignKey':_0x162d('0x1ba')});db['SugarcrmField'][_0x162d('0x10b')](db[_0x162d('0x1c0')],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1c0')][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':'VariableId'});db[_0x162d('0xa6')]['hasMany'](db[_0x162d('0xa8')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0xa8')][_0x162d('0x10b')](db[_0x162d('0x1c1')],{'as':_0x162d('0x1b3'),'onDelete':'cascade','foreignKey':_0x162d('0x1b4')});db[_0x162d('0xa8')][_0x162d('0x10b')](db[_0x162d('0x1c1')],{'as':_0x162d('0x1b6'),'onDelete':'cascade','foreignKey':_0x162d('0x1ba')});db[_0x162d('0xa8')][_0x162d('0x10b')](db['DeskField'],{'as':_0x162d('0x1b0'),'onDelete':'cascade','foreignKey':_0x162d('0x1b7')});db[_0x162d('0xa8')][_0x162d('0x118')](db[_0x162d('0xa6')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db['DeskConfiguration'][_0x162d('0x11a')](db['Tag'],{'through':_0x162d('0x1c2')});db[_0x162d('0x1c1')][_0x162d('0x10b')](db[_0x162d('0x1c1')],{'as':_0x162d('0x1b8'),'foreignKey':'SubjectId'});db[_0x162d('0x1c1')]['hasMany'](db[_0x162d('0x1c1')],{'as':'Description','foreignKey':_0x162d('0x1ba')});db[_0x162d('0x1c1')][_0x162d('0x10b')](db[_0x162d('0x1c1')],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1c1')][_0x162d('0x118')](db['Variable'],{'as':_0x162d('0x1bc'),'foreignKey':'VariableId'});db[_0x162d('0xab')][_0x162d('0x10b')](db[_0x162d('0x1c3')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c3')]['hasMany'](db[_0x162d('0x1c4')],{'as':_0x162d('0x1b3'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0x1c3')][_0x162d('0x10b')](db[_0x162d('0x1c4')],{'as':_0x162d('0x1b6'),'onDelete':'cascade','foreignKey':_0x162d('0x1ba')});db[_0x162d('0x1c3')][_0x162d('0x10b')](db[_0x162d('0x1c4')],{'as':_0x162d('0x1b0'),'onDelete':'cascade','foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1c3')][_0x162d('0x118')](db[_0x162d('0xab')],{'as':'Account','foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c4')]['hasMany'](db[_0x162d('0x1c4')],{'as':_0x162d('0x1b8'),'foreignKey':'SubjectId'});db[_0x162d('0x1c4')][_0x162d('0x10b')](db[_0x162d('0x1c4')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0x162d('0x1c4')],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1c4')][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':'VariableId'});db[_0x162d('0x1c5')][_0x162d('0x10b')](db[_0x162d('0x1c6')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c6')][_0x162d('0x10b')](db['ZendeskField'],{'as':_0x162d('0x1b3'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0x1c6')][_0x162d('0x10b')](db[_0x162d('0xb0')],{'as':_0x162d('0x1b6'),'foreignKey':_0x162d('0x1ba')});db['ZendeskConfiguration']['hasMany'](db[_0x162d('0xb0')],{'as':_0x162d('0x1b0'),'foreignKey':_0x162d('0x1b7')});db['ZendeskConfiguration'][_0x162d('0x118')](db[_0x162d('0x1c5')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c6')][_0x162d('0x11a')](db[_0x162d('0x167')],{'through':_0x162d('0x1c7')});db['ZendeskField'][_0x162d('0x10b')](db[_0x162d('0xb0')],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0xb0')][_0x162d('0x10b')](db[_0x162d('0xb0')],{'as':_0x162d('0x1b9'),'foreignKey':_0x162d('0x1ba')});db[_0x162d('0xb0')][_0x162d('0x10b')](db['ZendeskField'],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0xb0')][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':_0x162d('0x1bd')});db[_0x162d('0xb2')][_0x162d('0x10b')](db[_0x162d('0x1c8')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1c8')]['hasMany'](db[_0x162d('0xb5')],{'as':_0x162d('0x1b3'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0x1c8')][_0x162d('0x10b')](db['FreshdeskField'],{'as':_0x162d('0x1b6'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1ba')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0x1c8')][_0x162d('0x118')](db['FreshdeskAccount'],{'as':_0x162d('0x16e'),'foreignKey':'AccountId'});db['FreshdeskConfiguration']['belongsToMany'](db[_0x162d('0x167')],{'through':_0x162d('0x1c9')});db['FreshdeskField'][_0x162d('0x10b')](db[_0x162d('0xb5')],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0xb5')][_0x162d('0x10b')](db[_0x162d('0xb5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x162d('0xb5')][_0x162d('0x10b')](db[_0x162d('0xb5')],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db['FreshdeskField'][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':_0x162d('0x1bd')});db[_0x162d('0x1ca')][_0x162d('0x10b')](db[_0x162d('0xb8')],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0xb8')][_0x162d('0x10b')](db[_0x162d('0x1cb')],{'as':_0x162d('0x1b3'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0xb8')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x162d('0x1ba')});db[_0x162d('0xb8')][_0x162d('0x10b')](db['VtigerField'],{'as':_0x162d('0x1b0'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0xb8')]['belongsTo'](db[_0x162d('0x1ca')],{'as':'Account','foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1cb')][_0x162d('0x10b')](db['VtigerField'],{'as':_0x162d('0x1b8'),'foreignKey':'SubjectId'});db[_0x162d('0x1cb')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x162d('0x1cb')]['hasMany'](db['VtigerField'],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db['VtigerField'][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':_0x162d('0x1bd')});db['ServicenowAccount'][_0x162d('0x10b')](db['ServicenowConfiguration'],{'as':_0x162d('0x1bf'),'onDelete':_0x162d('0x109'),'foreignKey':'AccountId'});db[_0x162d('0xbd')][_0x162d('0x10b')](db[_0x162d('0x1cc')],{'as':'Subjects','foreignKey':_0x162d('0x1b4')});db[_0x162d('0xbd')][_0x162d('0x10b')](db[_0x162d('0x1cc')],{'as':_0x162d('0x1b6'),'foreignKey':_0x162d('0x1ba')});db['ServicenowConfiguration']['hasMany'](db[_0x162d('0x1cc')],{'as':_0x162d('0x1b0'),'foreignKey':_0x162d('0x1b7')});db['ServicenowConfiguration'][_0x162d('0x118')](db[_0x162d('0xbb')],{'as':'Account','foreignKey':_0x162d('0x1b2')});db[_0x162d('0x1cc')][_0x162d('0x10b')](db['ServicenowField'],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db['ServicenowField'][_0x162d('0x10b')](db[_0x162d('0x1cc')],{'as':'Description','foreignKey':_0x162d('0x1ba')});db[_0x162d('0x1cc')][_0x162d('0x10b')](db['ServicenowField'],{'as':_0x162d('0x1bb'),'foreignKey':'FieldId'});db['ServicenowField'][_0x162d('0x118')](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':_0x162d('0x1bd')});db[_0x162d('0xc0')][_0x162d('0x10b')](db[_0x162d('0xc2')],{'as':'Configurations','onDelete':_0x162d('0x109'),'foreignKey':'AccountId'});db[_0x162d('0xc2')][_0x162d('0x10b')](db['Dynamics365Field'],{'as':_0x162d('0x1b3'),'onDelete':'cascade','foreignKey':_0x162d('0x1b4')});db[_0x162d('0xc2')]['hasMany'](db['Dynamics365Field'],{'as':_0x162d('0x1b6'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1ba')});db[_0x162d('0xc2')][_0x162d('0x10b')](db[_0x162d('0xc4')],{'as':_0x162d('0x1b0'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0xc2')]['belongsTo'](db['Dynamics365Account'],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0xc4')][_0x162d('0x10b')](db[_0x162d('0xc4')],{'as':_0x162d('0x1b9'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x162d('0x1bb'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0xc4')]['belongsTo'](db[_0x162d('0x1bc')],{'as':_0x162d('0x1bc'),'foreignKey':'VariableId'});db[_0x162d('0xc6')][_0x162d('0x10b')](db[_0x162d('0xc8')],{'as':_0x162d('0x1bf'),'onDelete':'cascade','foreignKey':_0x162d('0x1b2')});db[_0x162d('0xc8')][_0x162d('0x10b')](db[_0x162d('0xca')],{'as':_0x162d('0x1b3'),'foreignKey':_0x162d('0x1b4')});db['FreshsalesConfiguration'][_0x162d('0x10b')](db[_0x162d('0xca')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x162d('0xc8')][_0x162d('0x10b')](db['FreshsalesField'],{'as':_0x162d('0x1b0'),'foreignKey':_0x162d('0x1b7')});db[_0x162d('0xc8')][_0x162d('0x118')](db[_0x162d('0xc6')],{'as':_0x162d('0x16e'),'foreignKey':_0x162d('0x1b2')});db[_0x162d('0xca')][_0x162d('0x10b')](db[_0x162d('0xca')],{'as':_0x162d('0x1b8'),'foreignKey':_0x162d('0x1b4')});db[_0x162d('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x162d('0x1b9'),'foreignKey':_0x162d('0x1ba')});db[_0x162d('0xca')][_0x162d('0x10b')](db['FreshsalesField'],{'as':_0x162d('0x1bb'),'foreignKey':'FieldId'});db[_0x162d('0xca')][_0x162d('0x118')](db['Variable'],{'as':_0x162d('0x1bc'),'foreignKey':_0x162d('0x1bd')});db[_0x162d('0xce')][_0x162d('0x118')](db['ChatWebsite'],{});db[_0x162d('0xce')][_0x162d('0x118')](db['CmList'],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0xce')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0xce')][_0x162d('0x118')](db[_0x162d('0x6a')],{});db[_0x162d('0xce')]['belongsTo'](db[_0x162d('0x6b')],{});db['ChatQueueReport'][_0x162d('0x118')](db[_0x162d('0x13')],{});db[_0x162d('0xce')][_0x162d('0x118')](db[_0x162d('0x6f')],{});db[_0x162d('0x190')][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':_0x162d('0x109'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':'cascade','foreignKey':_0x162d('0x1cd')});db[_0x162d('0xd5')][_0x162d('0x10b')](db[_0x162d('0xd3')],{'foreignKey':_0x162d('0x1ce'),'onDelete':_0x162d('0x109')});db['JscriptySessionReport'][_0x162d('0x10b')](db[_0x162d('0xd1')],{'foreignKey':_0x162d('0x1ce'),'onDelete':_0x162d('0x109')});db[_0x162d('0xd7')][_0x162d('0x118')](db[_0x162d('0x57')],{});db[_0x162d('0xd7')][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0xd7')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':'Contact','foreignKey':_0x162d('0x157')});db[_0x162d('0xd7')]['belongsTo'](db[_0x162d('0x112')],{});db[_0x162d('0xd7')][_0x162d('0x118')](db[_0x162d('0x5a')],{});db['SmsQueueReport'][_0x162d('0x118')](db[_0x162d('0x13')],{});db[_0x162d('0xd7')]['belongsTo'](db['SmsQueue'],{});db[_0x162d('0xdc')][_0x162d('0x10b')](db[_0x162d('0xd5')],{'foreignKey':_0x162d('0x1cf')});db[_0x162d('0xdc')]['hasMany'](db[_0x162d('0xd3')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x162d('0x10b')](db[_0x162d('0xd1')],{'foreignKey':_0x162d('0x1cf')});db['SquareProject'][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x16b'),'through':'user_has_square_projects'});db[_0x162d('0xe5')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':'user_has_teams'});db[_0x162d('0xe5')][_0x162d('0x11a')](db[_0x162d('0x1b')],{'through':_0x162d('0x150'),'as':'VoiceQueues'});db[_0x162d('0xe5')]['belongsToMany'](db[_0x162d('0x40')],{'through':_0x162d('0x164'),'as':_0x162d('0x12a')});db[_0x162d('0xe5')][_0x162d('0x11a')](db[_0x162d('0x6f')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x162d('0xe5')][_0x162d('0x11a')](db[_0x162d('0x53')],{'through':_0x162d('0x179'),'as':_0x162d('0x1d0')});db['Team'][_0x162d('0x11a')](db['SmsQueue'],{'through':_0x162d('0x181'),'as':_0x162d('0x12c')});db['Team']['belongsToMany'](db[_0x162d('0x63')],{'through':_0x162d('0x1d1'),'as':_0x162d('0x12d')});db[_0x162d('0xe5')][_0x162d('0x11a')](db[_0x162d('0x12e')],{'through':_0x162d('0x1d2'),'as':_0x162d('0x12f')});db[_0x162d('0x196')][_0x162d('0x10b')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x162d('0x197')});db[_0x162d('0x196')][_0x162d('0x10b')](db[_0x162d('0x78')],{'as':_0x162d('0x10f'),'foreignKey':_0x162d('0x197')});db[_0x162d('0x196')]['hasMany'](db[_0x162d('0x79')],{'as':_0x162d('0x148'),'foreignKey':_0x162d('0x197')});db[_0x162d('0x196')][_0x162d('0x10b')](db[_0x162d('0x77')],{'as':_0x162d('0x149'),'foreignKey':_0x162d('0x197')});db[_0x162d('0x196')][_0x162d('0x118')](db['Trunk'],{'as':_0x162d('0x2b'),'foreignKey':'TrunkId'});db[_0x162d('0x196')][_0x162d('0x118')](db[_0x162d('0x2b')],{'as':_0x162d('0x14b'),'foreignKey':'TrunkBackupId'});db['Campaign']['belongsTo'](db[_0x162d('0x85')],{'as':_0x162d('0x85'),'foreignKey':'IntervalId'});db[_0x162d('0x196')][_0x162d('0x118')](db[_0x162d('0xe0')],{'as':'SquareProject','foreignKey':_0x162d('0x1d3')});db['Campaign'][_0x162d('0x11a')](db[_0x162d('0xf5')],{'as':'Lists','through':_0x162d('0x1d4')});db[_0x162d('0x196')]['belongsToMany'](db[_0x162d('0xf5')],{'as':_0x162d('0x1d5'),'through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x162d('0x118')](db['MailMessage'],{});db['MailTransferReport'][_0x162d('0x118')](db[_0x162d('0x44')],{});db[_0x162d('0xee')][_0x162d('0x118')](db[_0x162d('0x3e')],{'foreignKey':_0x162d('0x1d6'),'as':_0x162d('0x1d7')});db[_0x162d('0xee')]['belongsTo'](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1d8'),'as':_0x162d('0x1d9')});db[_0x162d('0xee')]['belongsTo'](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1da'),'as':'ToAgent'});db[_0x162d('0xee')]['belongsTo'](db[_0x162d('0x40')],{'foreignKey':_0x162d('0x1db'),'as':'ToQueue'});db[_0x162d('0xee')][_0x162d('0x118')](db[_0x162d('0x3e')],{'foreignKey':_0x162d('0x1dc'),'as':_0x162d('0x1dd')});db[_0x162d('0xf0')]['belongsTo'](db['ChatMessage'],{});db[_0x162d('0xf0')][_0x162d('0x118')](db[_0x162d('0x6a')],{});db['ChatTransferReport']['belongsTo'](db[_0x162d('0x132')],{'foreignKey':_0x162d('0x1de'),'as':_0x162d('0x1d7')});db[_0x162d('0xf0')][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1d8'),'as':_0x162d('0x1d9')});db[_0x162d('0xf0')][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1da'),'as':_0x162d('0x1df')});db[_0x162d('0xf0')]['belongsTo'](db[_0x162d('0x6f')],{'foreignKey':_0x162d('0x1e0'),'as':_0x162d('0x1e1')});db[_0x162d('0xf0')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x162d('0x1e2'),'as':_0x162d('0x1dd')});db[_0x162d('0xf2')][_0x162d('0x118')](db['FaxMessage'],{});db[_0x162d('0xf2')]['belongsTo'](db[_0x162d('0x4f')],{});db[_0x162d('0xf2')]['belongsTo'](db[_0x162d('0x4e')],{'foreignKey':'FromFaxAccountId','as':_0x162d('0x1d7')});db[_0x162d('0xf2')]['belongsTo'](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1d8'),'as':_0x162d('0x1d9')});db[_0x162d('0xf2')][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1da'),'as':_0x162d('0x1df')});db[_0x162d('0xf2')]['belongsTo'](db[_0x162d('0x53')],{'foreignKey':_0x162d('0x1e3'),'as':_0x162d('0x1e1')});db[_0x162d('0xf2')][_0x162d('0x118')](db[_0x162d('0x4e')],{'foreignKey':_0x162d('0x1e4'),'as':_0x162d('0x1dd')});db[_0x162d('0x1e5')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x162d('0x1e5')]['belongsTo'](db[_0x162d('0x125')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x162d('0x5d')],{'foreignKey':_0x162d('0x1e6'),'as':_0x162d('0x1d7')});db['OpenchannelTransferReport'][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1d8'),'as':'FromAgent'});db[_0x162d('0x1e5')][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1da'),'as':_0x162d('0x1df')});db[_0x162d('0x1e5')]['belongsTo'](db[_0x162d('0x63')],{'foreignKey':_0x162d('0x1e7'),'as':_0x162d('0x1e1')});db[_0x162d('0x1e5')][_0x162d('0x118')](db[_0x162d('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x162d('0x1dd')});db[_0x162d('0xf4')]['belongsTo'](db[_0x162d('0x5a')],{});db[_0x162d('0xf4')][_0x162d('0x118')](db[_0x162d('0x112')],{});db['SmsTransferReport'][_0x162d('0x118')](db[_0x162d('0x57')],{'foreignKey':_0x162d('0x1e8'),'as':_0x162d('0x1d7')});db[_0x162d('0xf4')][_0x162d('0x118')](db['User'],{'foreignKey':_0x162d('0x1d8'),'as':_0x162d('0x1d9')});db[_0x162d('0xf4')][_0x162d('0x118')](db[_0x162d('0x13')],{'foreignKey':'ToUserId','as':_0x162d('0x1df')});db['SmsTransferReport'][_0x162d('0x118')](db[_0x162d('0x5b')],{'foreignKey':_0x162d('0x1e9'),'as':'ToQueue'});db[_0x162d('0xf4')][_0x162d('0x118')](db[_0x162d('0x57')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x162d('0xf5')][_0x162d('0x10b')](db[_0x162d('0x81')],{'as':'Dispositions','foreignKey':'ListId'});db[_0x162d('0xf5')][_0x162d('0x10b')](db[_0x162d('0x1ea')],{'as':'CustomFields','foreignKey':_0x162d('0x160')});db[_0x162d('0xf5')][_0x162d('0x10b')](db[_0x162d('0x75')],{'as':_0x162d('0x11c'),'onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x160')});db[_0x162d('0xf5')]['hasMany'](db[_0x162d('0x78')],{'as':_0x162d('0x10f'),'foreignKey':_0x162d('0x160')});db['CmList'][_0x162d('0x10b')](db[_0x162d('0x79')],{'as':_0x162d('0x110'),'foreignKey':_0x162d('0x160')});db[_0x162d('0xf5')][_0x162d('0x10b')](db[_0x162d('0x7b')],{'as':_0x162d('0x7b'),'foreignKey':_0x162d('0x160')});db[_0x162d('0xf5')][_0x162d('0x11a')](db[_0x162d('0x1b')],{'as':_0x162d('0x1eb'),'through':_0x162d('0x1ec')});db[_0x162d('0xf5')][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x162d('0x10b')](db[_0x162d('0x17')],{'as':_0x162d('0x10e'),'onDelete':_0x162d('0x109')});db['VoicePrefix'][_0x162d('0x11a')](db['User'],{'as':'Agents','through':_0x162d('0x1ed')});db[_0x162d('0xf7')][_0x162d('0x10b')](db[_0x162d('0x13')],{'as':_0x162d('0x16b'),'foreignKey':_0x162d('0x119')});db[_0x162d('0xf7')][_0x162d('0x10b')](db[_0x162d('0xf9')],{'as':_0x162d('0x1ee'),'foreignKey':_0x162d('0x119'),'onDelete':'cascade'});db[_0x162d('0xf9')]['hasMany'](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x162d('0x1ef'),'onDelete':_0x162d('0x109')});db['WhatsappAccount'][_0x162d('0x10b')](db['Disposition'],{'as':_0x162d('0x15b'),'foreignKey':_0x162d('0x1f0')});db[_0x162d('0x1f1')][_0x162d('0x10b')](db['CannedAnswer'],{'as':_0x162d('0x15c'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x162d('0x10b')](db[_0x162d('0x101')],{'as':_0x162d('0x15d'),'foreignKey':_0x162d('0x1f0')});db[_0x162d('0x1f1')][_0x162d('0x10b')](db['WhatsappInteraction'],{'as':_0x162d('0x15e')});db['WhatsappAccount'][_0x162d('0x10b')](db['WhatsappApplication'],{'as':'Applications'});db[_0x162d('0x1f1')][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0x1f1')]['belongsTo'](db['Pause'],{'as':_0x162d('0x14e'),'foreignKey':_0x162d('0x176')});db[_0x162d('0x1f1')]['belongsToMany'](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':_0x162d('0x13c')});db[_0x162d('0x1f2')][_0x162d('0x118')](db[_0x162d('0x13')],{'onDelete':_0x162d('0x170')});db['WhatsappApplication'][_0x162d('0x118')](db[_0x162d('0x12e')],{'onDelete':_0x162d('0x170')});db[_0x162d('0x1f2')][_0x162d('0x118')](db[_0x162d('0x1f1')],{'onDelete':'restrict'});db[_0x162d('0x1f2')][_0x162d('0x118')](db[_0x162d('0x85')],{'onDelete':_0x162d('0x170'),'foreignKey':_0x162d('0x14d')});db['WhatsappApplication']['belongsTo'](db[_0x162d('0x167')],{'onDelete':_0x162d('0x170'),'foreignKey':_0x162d('0x171')});db[_0x162d('0x115')][_0x162d('0x10b')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x162d('0x109'),'foreignKey':_0x162d('0x1f3')});db[_0x162d('0x115')]['belongsTo'](db[_0x162d('0x1f1')],{'as':'Account','foreignKey':_0x162d('0x1f0')});db[_0x162d('0x115')][_0x162d('0x118')](db[_0x162d('0x75')],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x162d('0x10a')});db[_0x162d('0x115')][_0x162d('0x11a')](db['Tag'],{'through':_0x162d('0x1a9'),'as':_0x162d('0x169')});db[_0x162d('0x115')]['belongsToMany'](db[_0x162d('0x167')],{'through':'whatsapp_interaction_has_tags','as':_0x162d('0x16a')});db['WhatsappInteraction'][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':'Users','through':_0x162d('0x127'),'foreignKey':_0x162d('0x1f3')});db[_0x162d('0x101')][_0x162d('0x118')](db[_0x162d('0x13')],{'as':_0x162d('0x13')});db[_0x162d('0x101')][_0x162d('0x118')](db[_0x162d('0x75')],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x156')});db['WhatsappMessage'][_0x162d('0x118')](db['WhatsappInteraction'],{'onDelete':_0x162d('0x109'),'as':_0x162d('0x17f'),'foreignKey':_0x162d('0x1f3')});db['WhatsappMessage'][_0x162d('0x118')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x162d('0x1f0')});db[_0x162d('0x102')][_0x162d('0x118')](db[_0x162d('0x1f1')],{});db[_0x162d('0x102')][_0x162d('0x118')](db[_0x162d('0xf5')],{'as':_0x162d('0x15f'),'foreignKey':_0x162d('0x160')});db[_0x162d('0x102')]['belongsTo'](db['CmContact'],{'as':_0x162d('0x156'),'foreignKey':_0x162d('0x157')});db[_0x162d('0x102')][_0x162d('0x118')](db[_0x162d('0x115')],{});db[_0x162d('0x102')][_0x162d('0x118')](db[_0x162d('0x12e')],{});db[_0x162d('0x102')][_0x162d('0x118')](db[_0x162d('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x162d('0x13')],{});db[_0x162d('0x104')][_0x162d('0x118')](db[_0x162d('0x101')],{});db[_0x162d('0x104')][_0x162d('0x118')](db[_0x162d('0x115')],{});db[_0x162d('0x104')][_0x162d('0x118')](db['WhatsappAccount'],{'foreignKey':_0x162d('0x1f4'),'as':_0x162d('0x1d7')});db[_0x162d('0x104')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x162d('0x1f5'),'as':'ToAccount'});db[_0x162d('0x104')][_0x162d('0x118')](db['WhatsappQueue'],{'foreignKey':_0x162d('0x1f6'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x162d('0x13')],{'foreignKey':_0x162d('0x1d8'),'as':_0x162d('0x1d9')});db[_0x162d('0x104')][_0x162d('0x118')](db['User'],{'foreignKey':'ToUserId','as':_0x162d('0x1df')});db['WhatsappQueue'][_0x162d('0x11a')](db[_0x162d('0x13')],{'as':_0x162d('0x162'),'through':_0x162d('0x3b'),'foreignKey':_0x162d('0x1f7')});db[_0x162d('0x12e')][_0x162d('0x11a')](db[_0x162d('0xe5')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x162d('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 4d8c077..10a9a11 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c67=['/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/plugins','route','get','resolve','appPath','/index.html','username','newPassword','apiKey','firstName','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','}@@','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','name','other','agent_name','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/projects','./api/squareRecording','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira'];(function(_0x5f3ce3,_0x479a21){var _0x2e84ee=function(_0xcbc537){while(--_0xcbc537){_0x5f3ce3['push'](_0x5f3ce3['shift']());}};_0x2e84ee(++_0x479a21);}(_0x0c67,0x189));var _0x70c6=function(_0x40fe42,_0x5d8a5b){_0x40fe42=_0x40fe42-0x0;var _0x50ea68=_0x0c67[_0x40fe42];return _0x50ea68;};'use strict';var _=require('lodash');var path=require(_0x70c6('0x0'));var express=require('express');var ewinston=require(_0x70c6('0x1'));var util=require(_0x70c6('0x2'));var errors=require(_0x70c6('0x3'));var config=require(_0x70c6('0x4'));var logger=require(_0x70c6('0x5'))(_0x70c6('0x6'));var authLogger=require(_0x70c6('0x5'))(_0x70c6('0x7'));exports[_0x70c6('0x8')]=function(_0x218ed8){_0x218ed8[_0x70c6('0x9')](ewinston[_0x70c6('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x9abc47,_0x4a5ba6){var _0x30dd68=_0x70c6('0xb');if(!_[_0x70c6('0xc')](_0x9abc47[_0x70c6('0xd')])){_0x30dd68+=_0x70c6('0xe');var _0x3c741c=_0x9abc47[_0x70c6('0xd')];maskSensitiveData(_0x3c741c);}return util['format'](_0x30dd68,_0x9abc47[_0x70c6('0xf')],_0x9abc47[_0x70c6('0x10')]['x-forwarded-for']?_0x9abc47[_0x70c6('0x10')][_0x70c6('0x11')]:_0x9abc47[_0x70c6('0x12')]['remoteAddress']||_0x9abc47['ip'],_0x9abc47[_0x70c6('0x13')],_0x4a5ba6[_0x70c6('0x14')],_0x4a5ba6[_0x70c6('0x15')],_0x9abc47['user']?_0x9abc47[_0x70c6('0x16')]['id']:null,_0x9abc47[_0x70c6('0x16')]?_0x9abc47[_0x70c6('0x16')]['name']:null,_0x9abc47[_0x70c6('0x16')]?_0x9abc47[_0x70c6('0x16')][_0x70c6('0x17')]:null,_0x3c741c?util[_0x70c6('0x18')](_0x3c741c,![],null):'');}}));_0x218ed8[_0x70c6('0x9')](ewinston[_0x70c6('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x23c438,_0x4aea29){var _0x456ed1=_0x70c6('0x19');if(_0x23c438[_0x70c6('0xd')]&&_0x23c438[_0x70c6('0xd')][_0x70c6('0x1a')]&&_0x23c438[_0x70c6('0xd')][_0x70c6('0x1b')]){_0x456ed1=_0x70c6('0x1c');}return util[_0x70c6('0x1d')](_0x456ed1,_0x23c438[_0x70c6('0xf')],_0x23c438[_0x70c6('0x10')][_0x70c6('0x11')]?_0x23c438[_0x70c6('0x10')][_0x70c6('0x11')]:_0x23c438[_0x70c6('0x12')][_0x70c6('0x1e')]||_0x23c438['ip'],_0x23c438[_0x70c6('0x13')],_0x4aea29['statusCode'],_0x4aea29[_0x70c6('0x15')],_0x23c438[_0x70c6('0x16')]?_0x23c438[_0x70c6('0x16')]['id']:null,_0x23c438[_0x70c6('0x16')]?_0x23c438[_0x70c6('0x16')][_0x70c6('0x1f')]:null,_0x23c438[_0x70c6('0x16')]?_0x23c438[_0x70c6('0x16')][_0x70c6('0x17')]:null,_0x23c438[_0x70c6('0xd')]&&_0x23c438[_0x70c6('0xd')]['device']?_0x23c438[_0x70c6('0xd')]['device']:_0x70c6('0x20'),_0x23c438[_0x70c6('0xd')]&&_0x23c438[_0x70c6('0xd')][_0x70c6('0x1b')]?_0x23c438[_0x70c6('0xd')][_0x70c6('0x1b')]:'',_0x23c438[_0x70c6('0xd')]&&_0x23c438[_0x70c6('0xd')][_0x70c6('0x21')]?_0x23c438[_0x70c6('0xd')][_0x70c6('0x21')]:'');},'ignoreRoute':function(_0x243ae2){var _0x3f9d4b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3f9d4b['test'](_0x243ae2[_0x70c6('0x13')]);}}));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x22'),require(_0x70c6('0x23')));_0x218ed8[_0x70c6('0x9')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x24'),require(_0x70c6('0x25')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x26'),require(_0x70c6('0x27')));_0x218ed8[_0x70c6('0x9')]('/api/voice/mohs',require(_0x70c6('0x28')));_0x218ed8['use'](_0x70c6('0x29'),require('./api/voiceQueue'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x2a'),require(_0x70c6('0x2b')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x2c'),require(_0x70c6('0x2d')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x2e'),require(_0x70c6('0x2f')));_0x218ed8['use'](_0x70c6('0x30'),require(_0x70c6('0x31')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x32'),require(_0x70c6('0x33')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x34'),require(_0x70c6('0x35')));_0x218ed8[_0x70c6('0x9')]('/api/voice/agents/reports',require(_0x70c6('0x36')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x37'),require(_0x70c6('0x38')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x39'),require('./api/memberReport'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x3a'),require(_0x70c6('0x3b')));_0x218ed8['use'](_0x70c6('0x3c'),require('./api/voiceTransferReport'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x3d'),require('./api/mailServerOut'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x3e'),require(_0x70c6('0x3f')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x40'),require('./api/mailQueue'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x41'),require(_0x70c6('0x42')));_0x218ed8['use'](_0x70c6('0x43'),require(_0x70c6('0x44')));_0x218ed8[_0x70c6('0x9')]('/api/mail/messages',require(_0x70c6('0x45')));_0x218ed8['use'](_0x70c6('0x46'),require(_0x70c6('0x47')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x48'),require(_0x70c6('0x49')));_0x218ed8['use'](_0x70c6('0x4a'),require(_0x70c6('0x4b')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x4c'),require('./api/dashboardItem'));_0x218ed8['use'](_0x70c6('0x4d'),require('./api/faxAccount'));_0x218ed8[_0x70c6('0x9')]('/api/fax/applications',require(_0x70c6('0x4e')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x4f'),require(_0x70c6('0x50')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x51'),require(_0x70c6('0x52')));_0x218ed8['use'](_0x70c6('0x53'),require(_0x70c6('0x54')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x55'),require(_0x70c6('0x56')));_0x218ed8['use']('/api/sms/accounts',require(_0x70c6('0x57')));_0x218ed8['use'](_0x70c6('0x58'),require(_0x70c6('0x59')));_0x218ed8[_0x70c6('0x9')]('/api/sms/interactions',require(_0x70c6('0x5a')));_0x218ed8[_0x70c6('0x9')]('/api/sms/messages',require('./api/smsMessage'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x5b'),require(_0x70c6('0x5c')));_0x218ed8['use'](_0x70c6('0x5d'),require(_0x70c6('0x5e')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x5f'),require(_0x70c6('0x60')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x61'),require(_0x70c6('0x62')));_0x218ed8[_0x70c6('0x9')]('/api/openchannel/messages',require(_0x70c6('0x63')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x64'),require(_0x70c6('0x65')));_0x218ed8['use'](_0x70c6('0x66'),require(_0x70c6('0x67')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x68'),require(_0x70c6('0x69')));_0x218ed8[_0x70c6('0x9')]('/api/chat/applications',require(_0x70c6('0x6a')));_0x218ed8[_0x70c6('0x9')]('/api/chat/interactions',require(_0x70c6('0x6b')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x6c'),require(_0x70c6('0x6d')));_0x218ed8['use'](_0x70c6('0x6e'),require('./api/chatOfflineMessage'));_0x218ed8[_0x70c6('0x9')]('/api/chat/queues',require(_0x70c6('0x6f')));_0x218ed8[_0x70c6('0x9')]('/api/chat/groups',require(_0x70c6('0x70')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x71'),require('./api/chatProactiveAction'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x72'),require('./api/cmCompany'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x73'),require('./api/cmContact'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x74'),require(_0x70c6('0x75')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x76'),require(_0x70c6('0x77')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x78'),require(_0x70c6('0x79')));_0x218ed8[_0x70c6('0x9')]('/api/cm/hopper_history',require(_0x70c6('0x7a')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x7b'),require('./api/cmCustomField'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x7c'),require('./api/action'));_0x218ed8['use'](_0x70c6('0x7d'),require(_0x70c6('0x7e')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x7f'),require(_0x70c6('0x80')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x81'),require(_0x70c6('0x82')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x83'),require(_0x70c6('0x84')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x85'),require(_0x70c6('0x86')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x87'),require(_0x70c6('0x88')));_0x218ed8['use'](_0x70c6('0x89'),require(_0x70c6('0x8a')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x8b'),require(_0x70c6('0x8c')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x8d'),require(_0x70c6('0x8e')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x8f'),require(_0x70c6('0x90')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x91'),require(_0x70c6('0x92')));_0x218ed8['use'](_0x70c6('0x93'),require('./api/template'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x94'),require(_0x70c6('0x95')));_0x218ed8['use'](_0x70c6('0x96'),require(_0x70c6('0x97')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x98'),require(_0x70c6('0x99')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x9a'),require(_0x70c6('0x9b')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x9c'),require(_0x70c6('0x9d')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x9e'),require(_0x70c6('0x9f')));_0x218ed8['use'](_0x70c6('0xa0'),require(_0x70c6('0xa1')));_0x218ed8[_0x70c6('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xa2'),require(_0x70c6('0xa3')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xa4'),require(_0x70c6('0xa5')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xa6'),require(_0x70c6('0xa7')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xa8'),require(_0x70c6('0xa9')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/salesforce/fields',require(_0x70c6('0xaa')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xab'),require(_0x70c6('0xac')));_0x218ed8['use'](_0x70c6('0xad'),require(_0x70c6('0xae')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/sugarcrm/fields',require(_0x70c6('0xaf')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb0'),require(_0x70c6('0xb1')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/desk/configurations',require(_0x70c6('0xb2')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb3'),require('./api/intDeskField'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb4'),require(_0x70c6('0xb5')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb6'),require(_0x70c6('0xb7')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb8'),require('./api/intZohoField'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xb9'),require(_0x70c6('0xba')));_0x218ed8['use']('/api/integrations/zendesk/configurations',require(_0x70c6('0xbb')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xbc'),require(_0x70c6('0xbd')));_0x218ed8['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xbe'),require(_0x70c6('0xbf')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/freshdesk/fields',require(_0x70c6('0xc0')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xc1'),require(_0x70c6('0xc2')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xc3'),require(_0x70c6('0xc4')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xc5'),require(_0x70c6('0xc6')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xc7'),require(_0x70c6('0xc8')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xc9'),require(_0x70c6('0xca')));_0x218ed8['use']('/api/integrations/servicenow/fields',require(_0x70c6('0xcb')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xcc'),require(_0x70c6('0xcd')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xce'),require(_0x70c6('0xcf')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/dynamics365/fields',require(_0x70c6('0xd0')));_0x218ed8[_0x70c6('0x9')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xd1'),require(_0x70c6('0xd2')));_0x218ed8['use'](_0x70c6('0xd3'),require(_0x70c6('0xd4')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xd5'),require(_0x70c6('0xd6')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xd7'),require(_0x70c6('0xd8')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xd9'),require(_0x70c6('0xda')));_0x218ed8['use'](_0x70c6('0xdb'),require('./api/jscriptyAnswerReport'));_0x218ed8['use'](_0x70c6('0xdc'),require(_0x70c6('0xdd')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xde'),require(_0x70c6('0xdf')));_0x218ed8['use']('/api/sms/reports/queue',require(_0x70c6('0xe0')));_0x218ed8[_0x70c6('0x9')]('/api/square/reports',require(_0x70c6('0xe1')));_0x218ed8['use']('/api/square/details/reports',require(_0x70c6('0xe2')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xe3'),require('./api/jscriptyProject'));_0x218ed8['use'](_0x70c6('0xe4'),require(_0x70c6('0xe5')));_0x218ed8[_0x70c6('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xe6'),require('./api/squareProject'));_0x218ed8[_0x70c6('0x9')]('/api/square/recordings',require(_0x70c6('0xe7')));_0x218ed8[_0x70c6('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xe8'),require('./api/team'));_0x218ed8['use'](_0x70c6('0xe9'),require(_0x70c6('0xea')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xeb'),require(_0x70c6('0xec')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xed'),require(_0x70c6('0xee')));_0x218ed8['use'](_0x70c6('0xef'),require(_0x70c6('0xf0')));_0x218ed8[_0x70c6('0x9')]('/api/plugins',require('./api/plugin'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xf1'),require(_0x70c6('0xf2')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xf3'),require('./api/chatTransferReport'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xf4'),require(_0x70c6('0xf5')));_0x218ed8[_0x70c6('0x9')]('/api/openchannel/reports/transfer',require(_0x70c6('0xf6')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xf7'),require(_0x70c6('0xf8')));_0x218ed8['use'](_0x70c6('0xf9'),require(_0x70c6('0xfa')));_0x218ed8[_0x70c6('0x9')]('/api/voice/prefixes',require(_0x70c6('0xfb')));_0x218ed8['use']('/api/userProfiles',require(_0x70c6('0xfc')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xfd'),require(_0x70c6('0xfe')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0xff'),require(_0x70c6('0x100')));_0x218ed8['use'](_0x70c6('0x101'),require(_0x70c6('0x102')));_0x218ed8['use'](_0x70c6('0x103'),require(_0x70c6('0x104')));_0x218ed8[_0x70c6('0x9')]('/api/whatsapp/applications',require(_0x70c6('0x105')));_0x218ed8['use'](_0x70c6('0x106'),require(_0x70c6('0x107')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x108'),require(_0x70c6('0x109')));_0x218ed8[_0x70c6('0x9')]('/api/whatsapp/reports/queue',require(_0x70c6('0x10a')));_0x218ed8[_0x70c6('0x9')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x218ed8['use'](_0x70c6('0x10b'),require(_0x70c6('0x10c')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x10d'),require('./api/cloudProvider'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x10e'),require(_0x70c6('0x10f')));_0x218ed8['use'](_0x70c6('0x110'),require(_0x70c6('0x111')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x112'),require('./api/jira'));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x113'),require(_0x70c6('0x114')));_0x218ed8[_0x70c6('0x9')]('/api/version',require(_0x70c6('0x115')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x116'),require(_0x70c6('0x117')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x118'),require('./api/pm2'));_0x218ed8[_0x70c6('0x9')]('/api/webbar',require(_0x70c6('0x119')));_0x218ed8[_0x70c6('0x9')]('/apidoc',express[_0x70c6('0x11a')](path[_0x70c6('0x11b')](config[_0x70c6('0x11c')],_0x70c6('0x11d'))));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x11e'),express[_0x70c6('0x11a')](path[_0x70c6('0x11b')](config[_0x70c6('0x11c')],_0x70c6('0x11e'))));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x11f'),express['static'](path[_0x70c6('0x11b')](config[_0x70c6('0x11c')],_0x70c6('0x11f'))));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x120'),express[_0x70c6('0x11a')](path[_0x70c6('0x11b')](config['root'],_0x70c6('0x121'),'1.0.16')));_0x218ed8[_0x70c6('0x9')](_0x70c6('0x122'),express['static'](path[_0x70c6('0x11b')](config[_0x70c6('0x11c')],'/server/files/plugins')));_0x218ed8[_0x70c6('0x123')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x70c6('0x124')](errors[0x194]);_0x218ed8[_0x70c6('0x123')]('/*')[_0x70c6('0x124')](function(_0x45e651,_0x338736){_0x338736['sendFile'](path[_0x70c6('0x125')](_0x218ed8[_0x70c6('0x124')](_0x70c6('0x126'))+_0x70c6('0x127')));});};var sensitiveFields=[_0x70c6('0x128'),'password',_0x70c6('0x129'),_0x70c6('0x12a'),_0x70c6('0x12b'),'lastName','street',_0x70c6('0x12c'),_0x70c6('0x12d'),'fax',_0x70c6('0x12e'),_0x70c6('0x12f'),_0x70c6('0x130'),_0x70c6('0x131'),_0x70c6('0x132'),_0x70c6('0x133'),_0x70c6('0x134'),_0x70c6('0x135'),_0x70c6('0x136'),'accessToken',_0x70c6('0x137'),_0x70c6('0x138'),_0x70c6('0x139'),_0x70c6('0x13a'),_0x70c6('0x13b'),_0x70c6('0x13c'),_0x70c6('0x13d'),_0x70c6('0x13e'),_0x70c6('0x13f'),'clientEmail',_0x70c6('0x140'),_0x70c6('0x141'),_0x70c6('0x142'),'key',_0x70c6('0x16'),'pass','accountSid',_0x70c6('0x143'),_0x70c6('0x144'),_0x70c6('0x145'),_0x70c6('0x146'),_0x70c6('0x147')];function maskSensitiveData(_0x484129){var _0x4adfa2=/(?!^)[\s\S](?!$)/g;if(!_[_0x70c6('0x148')](_0x484129))return;for(var _0x3daf0b in _0x484129){if(_[_0x70c6('0x149')](_0x484129[_0x3daf0b])){for(var _0x5e789c=0x0;_0x5e789c<_0x484129[_0x3daf0b][_0x70c6('0x14a')];_0x5e789c++){maskSensitiveData(_0x484129[_0x3daf0b][_0x5e789c]);}}else if(_[_0x70c6('0x148')](_0x484129[_0x3daf0b])){maskSensitiveData(_0x484129[_0x3daf0b]);}else if(_[_0x70c6('0x14b')](_0x484129[_0x3daf0b])){_0x484129[_0x3daf0b]=_0x484129[_0x3daf0b][_0x70c6('0x14c')](/{{{/g,'@@{')[_0x70c6('0x14c')](/}}}/g,_0x70c6('0x14d'))['replace'](/{{/g,'@{')[_0x70c6('0x14c')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3daf0b)){_0x484129[_0x3daf0b]=_0x484129[_0x3daf0b][_0x70c6('0x14c')](_0x4adfa2,'*');}}}} \ No newline at end of file +var _0xe2db=['./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./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/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isArray','length','isString','@@{','}@@','replace','lodash','path','express','express-winston','util','./errors','api'];(function(_0x4117bd,_0x54c2b8){var _0x376d67=function(_0x48e8ea){while(--_0x48e8ea){_0x4117bd['push'](_0x4117bd['shift']());}};_0x376d67(++_0x54c2b8);}(_0xe2db,0x149));var _0xbe2d=function(_0x50ebc1,_0x1c0ce8){_0x50ebc1=_0x50ebc1-0x0;var _0x2c6b5c=_0xe2db[_0x50ebc1];return _0x2c6b5c;};'use strict';var _=require(_0xbe2d('0x0'));var path=require(_0xbe2d('0x1'));var express=require(_0xbe2d('0x2'));var ewinston=require(_0xbe2d('0x3'));var util=require(_0xbe2d('0x4'));var errors=require(_0xbe2d('0x5'));var config=require('./config/environment');var logger=require('./config/logger')(_0xbe2d('0x6'));var authLogger=require(_0xbe2d('0x7'))(_0xbe2d('0x8'));exports[_0xbe2d('0x9')]=function(_0x3aa3a6){_0x3aa3a6[_0xbe2d('0xa')](ewinston[_0xbe2d('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5f45b0,_0x56830d){var _0x192b86=_0xbe2d('0xc');if(!_[_0xbe2d('0xd')](_0x5f45b0[_0xbe2d('0xe')])){_0x192b86+=_0xbe2d('0xf');var _0x218203=_0x5f45b0[_0xbe2d('0xe')];maskSensitiveData(_0x218203);}return util[_0xbe2d('0x10')](_0x192b86,_0x5f45b0[_0xbe2d('0x11')],_0x5f45b0[_0xbe2d('0x12')]['x-forwarded-for']?_0x5f45b0[_0xbe2d('0x12')][_0xbe2d('0x13')]:_0x5f45b0[_0xbe2d('0x14')]['remoteAddress']||_0x5f45b0['ip'],_0x5f45b0[_0xbe2d('0x15')],_0x56830d[_0xbe2d('0x16')],_0x56830d[_0xbe2d('0x17')],_0x5f45b0[_0xbe2d('0x18')]?_0x5f45b0[_0xbe2d('0x18')]['id']:null,_0x5f45b0[_0xbe2d('0x18')]?_0x5f45b0[_0xbe2d('0x18')][_0xbe2d('0x19')]:null,_0x5f45b0['user']?_0x5f45b0[_0xbe2d('0x18')]['role']:null,_0x218203?util['inspect'](_0x218203,![],null):'');}}));_0x3aa3a6[_0xbe2d('0xa')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x36b544,_0x47e04e){var _0xa27e30='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x36b544['body']&&_0x36b544[_0xbe2d('0xe')][_0xbe2d('0x1a')]&&_0x36b544[_0xbe2d('0xe')][_0xbe2d('0x1b')]){_0xa27e30=_0xbe2d('0x1c');}return util[_0xbe2d('0x10')](_0xa27e30,_0x36b544[_0xbe2d('0x11')],_0x36b544[_0xbe2d('0x12')][_0xbe2d('0x13')]?_0x36b544['headers'][_0xbe2d('0x13')]:_0x36b544[_0xbe2d('0x14')][_0xbe2d('0x1d')]||_0x36b544['ip'],_0x36b544[_0xbe2d('0x15')],_0x47e04e[_0xbe2d('0x16')],_0x47e04e[_0xbe2d('0x17')],_0x36b544['user']?_0x36b544[_0xbe2d('0x18')]['id']:null,_0x36b544['user']?_0x36b544[_0xbe2d('0x18')][_0xbe2d('0x19')]:null,_0x36b544[_0xbe2d('0x18')]?_0x36b544[_0xbe2d('0x18')][_0xbe2d('0x1e')]:null,_0x36b544[_0xbe2d('0xe')]&&_0x36b544[_0xbe2d('0xe')][_0xbe2d('0x1a')]?_0x36b544['body'][_0xbe2d('0x1a')]:_0xbe2d('0x1f'),_0x36b544[_0xbe2d('0xe')]&&_0x36b544[_0xbe2d('0xe')][_0xbe2d('0x1b')]?_0x36b544[_0xbe2d('0xe')]['agent_id']:'',_0x36b544[_0xbe2d('0xe')]&&_0x36b544[_0xbe2d('0xe')][_0xbe2d('0x20')]?_0x36b544['body'][_0xbe2d('0x20')]:'');},'ignoreRoute':function(_0x552555){var _0x452739=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x452739[_0xbe2d('0x21')](_0x552555['url']);}}));_0x3aa3a6['use'](_0xbe2d('0x22'),require(_0xbe2d('0x23')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x24'),require(_0xbe2d('0x25')));_0x3aa3a6[_0xbe2d('0xa')]('/api/voice/contexts',require(_0xbe2d('0x26')));_0x3aa3a6['use'](_0xbe2d('0x27'),require('./api/voiceExtension'));_0x3aa3a6['use'](_0xbe2d('0x28'),require('./api/voiceMusicOnHold'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x29'),require(_0xbe2d('0x2a')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x2b'),require(_0xbe2d('0x2c')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x2d'),require(_0xbe2d('0x2e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x2f'),require(_0xbe2d('0x30')));_0x3aa3a6['use']('/api/voice/mails/messages',require(_0xbe2d('0x31')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x32'),require(_0xbe2d('0x33')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x34'),require('./api/voiceDialReport'));_0x3aa3a6[_0xbe2d('0xa')]('/api/voice/agents/reports',require(_0xbe2d('0x35')));_0x3aa3a6['use']('/api/voice/queues/reports',require(_0xbe2d('0x36')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x37'),require(_0xbe2d('0x38')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x39'),require('./api/trunk'));_0x3aa3a6['use']('/api/voice/transfers/reports',require(_0xbe2d('0x3a')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x3b'),require(_0xbe2d('0x3c')));_0x3aa3a6['use'](_0xbe2d('0x3d'),require(_0xbe2d('0x3e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x3f'),require(_0xbe2d('0x40')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x41'),require(_0xbe2d('0x42')));_0x3aa3a6[_0xbe2d('0xa')]('/api/mail/interactions',require(_0xbe2d('0x43')));_0x3aa3a6[_0xbe2d('0xa')]('/api/mail/messages',require('./api/mailMessage'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x44'),require(_0xbe2d('0x45')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x46'),require(_0xbe2d('0x47')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x48'),require(_0xbe2d('0x49')));_0x3aa3a6[_0xbe2d('0xa')]('/api/dashboards/items',require(_0xbe2d('0x4a')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x4b'),require('./api/faxAccount'));_0x3aa3a6['use']('/api/fax/applications',require('./api/faxApplication'));_0x3aa3a6[_0xbe2d('0xa')]('/api/fax/interactions',require(_0xbe2d('0x4c')));_0x3aa3a6[_0xbe2d('0xa')]('/api/fax/messages',require(_0xbe2d('0x4d')));_0x3aa3a6['use'](_0xbe2d('0x4e'),require(_0xbe2d('0x4f')));_0x3aa3a6['use'](_0xbe2d('0x50'),require(_0xbe2d('0x51')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x52'),require(_0xbe2d('0x53')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x54'),require(_0xbe2d('0x55')));_0x3aa3a6['use'](_0xbe2d('0x56'),require(_0xbe2d('0x57')));_0x3aa3a6[_0xbe2d('0xa')]('/api/sms/messages',require(_0xbe2d('0x58')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x59'),require('./api/smsQueue'));_0x3aa3a6['use'](_0xbe2d('0x5a'),require('./api/openchannelAccount'));_0x3aa3a6[_0xbe2d('0xa')]('/api/openchannel/applications',require(_0xbe2d('0x5b')));_0x3aa3a6['use'](_0xbe2d('0x5c'),require('./api/openchannelInteraction'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x5d'),require(_0xbe2d('0x5e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x5f'),require(_0xbe2d('0x60')));_0x3aa3a6['use']('/api/chat/websites',require(_0xbe2d('0x61')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x62'),require(_0xbe2d('0x63')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x64'),require(_0xbe2d('0x65')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x66'),require(_0xbe2d('0x67')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x68'),require(_0xbe2d('0x69')));_0x3aa3a6[_0xbe2d('0xa')]('/api/chat/offline_messages',require(_0xbe2d('0x6a')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x6b'),require(_0xbe2d('0x6c')));_0x3aa3a6['use'](_0xbe2d('0x6d'),require(_0xbe2d('0x6e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x6f'),require(_0xbe2d('0x70')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x71'),require(_0xbe2d('0x72')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x73'),require(_0xbe2d('0x74')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x75'),require('./api/cmHopper'));_0x3aa3a6['use'](_0xbe2d('0x76'),require('./api/cmHopperBlack'));_0x3aa3a6['use'](_0xbe2d('0x77'),require('./api/cmHopperFinal'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x78'),require(_0xbe2d('0x79')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x7a'),require(_0xbe2d('0x7b')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x7c'),require('./api/action'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x7d'),require(_0xbe2d('0x7e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x7f'),require(_0xbe2d('0x80')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x81'),require('./api/disposition'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x82'),require(_0xbe2d('0x83')));_0x3aa3a6[_0xbe2d('0xa')]('/api/intervals',require(_0xbe2d('0x84')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x85'),require(_0xbe2d('0x86')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x87'),require(_0xbe2d('0x88')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x89'),require(_0xbe2d('0x8a')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x8b'),require('./api/schedule'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x8c'),require('./api/sound'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x8d'),require(_0xbe2d('0x8e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x8f'),require(_0xbe2d('0x90')));_0x3aa3a6['use'](_0xbe2d('0x91'),require(_0xbe2d('0x92')));_0x3aa3a6[_0xbe2d('0xa')]('/api/variables',require(_0xbe2d('0x93')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x94'),require(_0xbe2d('0x95')));_0x3aa3a6['use'](_0xbe2d('0x96'),require(_0xbe2d('0x97')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x98'),require('./api/analyticCustomReport'));_0x3aa3a6[_0xbe2d('0xa')]('/api/analytics/default_reports',require(_0xbe2d('0x99')));_0x3aa3a6['use'](_0xbe2d('0x9a'),require(_0xbe2d('0x9b')));_0x3aa3a6[_0xbe2d('0xa')]('/api/analytics/metrics',require(_0xbe2d('0x9c')));_0x3aa3a6['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x3aa3a6[_0xbe2d('0xa')]('/api/analytics/tree_reports',require(_0xbe2d('0x9d')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x9e'),require(_0xbe2d('0x9f')));_0x3aa3a6['use'](_0xbe2d('0xa0'),require(_0xbe2d('0xa1')));_0x3aa3a6[_0xbe2d('0xa')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x3aa3a6[_0xbe2d('0xa')]('/api/integrations/sugarcrm/accounts',require(_0xbe2d('0xa2')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xa3'),require(_0xbe2d('0xa4')));_0x3aa3a6['use'](_0xbe2d('0xa5'),require(_0xbe2d('0xa6')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xa7'),require(_0xbe2d('0xa8')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xa9'),require('./api/intDeskConfiguration'));_0x3aa3a6['use'](_0xbe2d('0xaa'),require(_0xbe2d('0xab')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xac'),require(_0xbe2d('0xad')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xae'),require(_0xbe2d('0xaf')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xb0'),require(_0xbe2d('0xb1')));_0x3aa3a6[_0xbe2d('0xa')]('/api/integrations/zendesk/accounts',require(_0xbe2d('0xb2')));_0x3aa3a6[_0xbe2d('0xa')]('/api/integrations/zendesk/configurations',require(_0xbe2d('0xb3')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xb4'),require(_0xbe2d('0xb5')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xb6'),require(_0xbe2d('0xb7')));_0x3aa3a6['use'](_0xbe2d('0xb8'),require(_0xbe2d('0xb9')));_0x3aa3a6['use'](_0xbe2d('0xba'),require(_0xbe2d('0xbb')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xbc'),require(_0xbe2d('0xbd')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xbe'),require(_0xbe2d('0xbf')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc0'),require(_0xbe2d('0xc1')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc2'),require(_0xbe2d('0xc3')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc4'),require('./api/intServicenowConfiguration'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc5'),require(_0xbe2d('0xc6')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc7'),require(_0xbe2d('0xc8')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xc9'),require(_0xbe2d('0xca')));_0x3aa3a6['use']('/api/integrations/dynamics365/fields',require(_0xbe2d('0xcb')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xcc'),require(_0xbe2d('0xcd')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xce'),require(_0xbe2d('0xcf')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xd0'),require(_0xbe2d('0xd1')));_0x3aa3a6[_0xbe2d('0xa')]('/api/networks',require(_0xbe2d('0xd2')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xd3'),require(_0xbe2d('0xd4')));_0x3aa3a6['use']('/api/chat/internal/messages',require(_0xbe2d('0xd5')));_0x3aa3a6[_0xbe2d('0xa')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xd6'),require(_0xbe2d('0xd7')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xd8'),require('./api/jscriptySessionReport'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xd9'),require(_0xbe2d('0xda')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xdb'),require('./api/squareReport'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xdc'),require(_0xbe2d('0xdd')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xde'),require('./api/jscriptyProject'));_0x3aa3a6[_0xbe2d('0xa')]('/api/settings',require(_0xbe2d('0xdf')));_0x3aa3a6['use']('/api/square/odbc',require(_0xbe2d('0xe0')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xe1'),require(_0xbe2d('0xe2')));_0x3aa3a6['use']('/api/square/recordings',require('./api/squareRecording'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xe3'),require('./api/squareMessage'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xe4'),require(_0xbe2d('0xe5')));_0x3aa3a6[_0xbe2d('0xa')]('/api/license',require('./api/license'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xe6'),require(_0xbe2d('0xe7')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xe8'),require('./api/migration'));_0x3aa3a6['use'](_0xbe2d('0xe9'),require('./api/attachment'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xea'),require('./api/plugin'));_0x3aa3a6['use'](_0xbe2d('0xeb'),require(_0xbe2d('0xec')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xed'),require(_0xbe2d('0xee')));_0x3aa3a6[_0xbe2d('0xa')]('/api/fax/reports/transfer',require(_0xbe2d('0xef')));_0x3aa3a6['use'](_0xbe2d('0xf0'),require(_0xbe2d('0xf1')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xf2'),require(_0xbe2d('0xf3')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xf4'),require('./api/cmList'));_0x3aa3a6[_0xbe2d('0xa')]('/api/voice/prefixes',require(_0xbe2d('0xf5')));_0x3aa3a6['use'](_0xbe2d('0xf6'),require(_0xbe2d('0xf7')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xf8'),require(_0xbe2d('0xf9')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xfa'),require(_0xbe2d('0xfb')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xfc'),require(_0xbe2d('0xfd')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0xfe'),require(_0xbe2d('0xff')));_0x3aa3a6[_0xbe2d('0xa')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x3aa3a6[_0xbe2d('0xa')]('/api/whatsapp/interactions',require(_0xbe2d('0x100')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x101'),require('./api/whatsappMessage'));_0x3aa3a6['use'](_0xbe2d('0x102'),require(_0xbe2d('0x103')));_0x3aa3a6['use'](_0xbe2d('0x104'),require(_0xbe2d('0x105')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x106'),require(_0xbe2d('0x107')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x108'),require(_0xbe2d('0x109')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x10a'),require(_0xbe2d('0x10b')));_0x3aa3a6['use'](_0xbe2d('0x10c'),require('./api/authGoogle'));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x10d'),require(_0xbe2d('0x10e')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x10f'),require(_0xbe2d('0x110')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x111'),require(_0xbe2d('0x112')));_0x3aa3a6['use'](_0xbe2d('0x113'),require(_0xbe2d('0x114')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x115'),require(_0xbe2d('0x116')));_0x3aa3a6[_0xbe2d('0xa')]('/api/webbar',require('./api/webbar'));_0x3aa3a6['use'](_0xbe2d('0x117'),express['static'](path[_0xbe2d('0x118')](config[_0xbe2d('0x119')],_0xbe2d('0x117'))));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x11a'),express[_0xbe2d('0x11b')](path['join'](config[_0xbe2d('0x119')],'/www')));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x11c'),express[_0xbe2d('0x11b')](path['join'](config['root'],_0xbe2d('0x11c'))));_0x3aa3a6[_0xbe2d('0xa')](_0xbe2d('0x11d'),express[_0xbe2d('0x11b')](path[_0xbe2d('0x118')](config[_0xbe2d('0x119')],_0xbe2d('0x11e'),_0xbe2d('0x11f'))));_0x3aa3a6['use'](_0xbe2d('0x120'),express[_0xbe2d('0x11b')](path['join'](config['root'],'/server/files/plugins')));_0x3aa3a6[_0xbe2d('0x121')](_0xbe2d('0x122'))['get'](errors[0x194]);_0x3aa3a6[_0xbe2d('0x121')]('/*')[_0xbe2d('0x123')](function(_0x4a7059,_0x4727ae){_0x4727ae[_0xbe2d('0x124')](path[_0xbe2d('0x125')](_0x3aa3a6['get'](_0xbe2d('0x126'))+_0xbe2d('0x127')));});};var sensitiveFields=['username',_0xbe2d('0x128'),_0xbe2d('0x129'),_0xbe2d('0x12a'),_0xbe2d('0x12b'),_0xbe2d('0x12c'),_0xbe2d('0x12d'),_0xbe2d('0x12e'),_0xbe2d('0x12f'),_0xbe2d('0x130'),_0xbe2d('0x131'),_0xbe2d('0x132'),_0xbe2d('0x133'),_0xbe2d('0x134'),'code',_0xbe2d('0x135'),_0xbe2d('0x136'),_0xbe2d('0x137'),'channelSecret',_0xbe2d('0x138'),_0xbe2d('0x139'),_0xbe2d('0x13a'),_0xbe2d('0x13b'),_0xbe2d('0x13c'),_0xbe2d('0x13d'),_0xbe2d('0x13e'),'calleridnum','exten',_0xbe2d('0x13f'),'clientEmail',_0xbe2d('0x140'),_0xbe2d('0x141'),_0xbe2d('0x142'),_0xbe2d('0x143'),_0xbe2d('0x18'),_0xbe2d('0x144'),_0xbe2d('0x145'),_0xbe2d('0x146'),_0xbe2d('0x147'),'secret',_0xbe2d('0x148'),_0xbe2d('0x149')];function maskSensitiveData(_0x24fe5d){var _0x303b57=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x24fe5d))return;for(var _0x3ee311 in _0x24fe5d){if(_[_0xbe2d('0x14a')](_0x24fe5d[_0x3ee311])){for(var _0x5b9a0b=0x0;_0x5b9a0b<_0x24fe5d[_0x3ee311][_0xbe2d('0x14b')];_0x5b9a0b++){maskSensitiveData(_0x24fe5d[_0x3ee311][_0x5b9a0b]);}}else if(_['isPlainObject'](_0x24fe5d[_0x3ee311])){maskSensitiveData(_0x24fe5d[_0x3ee311]);}else if(_[_0xbe2d('0x14c')](_0x24fe5d[_0x3ee311])){_0x24fe5d[_0x3ee311]=_0x24fe5d[_0x3ee311]['replace'](/{{{/g,_0xbe2d('0x14d'))['replace'](/}}}/g,_0xbe2d('0x14e'))[_0xbe2d('0x14f')](/{{/g,'@{')[_0xbe2d('0x14f')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3ee311)){_0x24fe5d[_0x3ee311]=_0x24fe5d[_0x3ee311][_0xbe2d('0x14f')](_0x303b57,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2e517d5..7fd284f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae45=['../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0x32153d,_0xb35650){var _0x1c442d=function(_0x536e81){while(--_0x536e81){_0x32153d['push'](_0x32153d['shift']());}};_0x1c442d(++_0xb35650);}(_0xae45,0x1ea));var _0x5ae4=function(_0x347a25,_0x2c2625){_0x347a25=_0x347a25-0x0;var _0x1b135d=_0xae45[_0x347a25];return _0x1b135d;};'use strict';var jayson=require(_0x5ae4('0x0'));var BPromise=require(_0x5ae4('0x1'));var _=require(_0x5ae4('0x2'));var config=require('../config/environment');exports[_0x5ae4('0x3')]=function(){return new BPromise(function(_0x5bff29,_0x371277){var _0x1beaed={};_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/user/user.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x5')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x6')));_0x1beaed=_['merge'](_0x1beaed,require('../api/voiceRecording/voiceRecording.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x7')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x8')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x9')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0xa')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0xb')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0xc')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0xd')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0xe')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0xf')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/mailQueue/mailQueue.rpc'));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x10')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x11')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x12')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x13')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/faxAccount/faxAccount.rpc'));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x14')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x15')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x16')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x17')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x18')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x19')));_0x1beaed=_['merge'](_0x1beaed,require('../api/smsInteraction/smsInteraction.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x1a')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x1b')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x1c')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x1d')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x1e')));_0x1beaed=_['merge'](_0x1beaed,require('../api/chatInteraction/chatInteraction.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x1f')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x20')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x21')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x22')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x23')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x24')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x25')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x26')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x27')));_0x1beaed=_['merge'](_0x1beaed,require('../api/pause/pause.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x28')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/template/template.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/trigger/trigger.rpc'));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x29')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2a')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2b')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2c')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2d')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2e')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x2f')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x30')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x31')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x32')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x33')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x34')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/squareOdbc/squareOdbc.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x35')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/squareRecording/squareRecording.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x36')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x37')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/attachment/attachment.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x38')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x39')));_0x1beaed=_['merge'](_0x1beaed,require(_0x5ae4('0x3a')));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1beaed=_[_0x5ae4('0x4')](_0x1beaed,require(_0x5ae4('0x3b')));_0x1beaed=_['merge'](_0x1beaed,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2ad96b=jayson[_0x5ae4('0x3c')](_0x1beaed)[_0x5ae4('0x3d')]();var _0xb6a121=config[_0x5ae4('0x3e')][_0x5ae4('0x3f')]||config['port']+0x1;var _0x2b4531=config[_0x5ae4('0x3e')]['ip']||_0x5ae4('0x40');_0x2ad96b['on'](_0x5ae4('0x41'),function(_0x4f5339){return _0x371277(_0x4f5339);});_0x2ad96b[_0x5ae4('0x3')](_0xb6a121,_0x2b4531,function(){console[_0x5ae4('0x42')](_0x5ae4('0x43'),_0x2b4531,_0xb6a121);require(_0x5ae4('0x44'))[_0x5ae4('0x45')]();return _0x5bff29(_0x5ae4('0x46')+_0x2b4531+':'+_0xb6a121);});});}; \ No newline at end of file +var _0xe27b=['../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc'];(function(_0x375233,_0x165da0){var _0xb1fac5=function(_0x535787){while(--_0x535787){_0x375233['push'](_0x375233['shift']());}};_0xb1fac5(++_0x165da0);}(_0xe27b,0x65));var _0xbe27=function(_0x4f91d5,_0x379ec7){_0x4f91d5=_0x4f91d5-0x0;var _0x2e4ede=_0xe27b[_0x4f91d5];return _0x2e4ede;};'use strict';var jayson=require(_0xbe27('0x0'));var BPromise=require(_0xbe27('0x1'));var _=require(_0xbe27('0x2'));var config=require(_0xbe27('0x3'));exports[_0xbe27('0x4')]=function(){return new BPromise(function(_0xed7a7a,_0x3ff054){var _0x305d68={};_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/user/user.rpc'));_0x305d68=_['merge'](_0x305d68,require('../api/voiceExtension/voiceExtension.rpc'));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x6')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x7')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x8')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x9')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0xa')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0xb')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0xc')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0xd')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0xe')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0xf')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x10')));_0x305d68=_['merge'](_0x305d68,require('../api/mailAccount/mailAccount.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x11')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x12')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x13')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/mailApplication/mailApplication.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x14')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x15')));_0x305d68=_['merge'](_0x305d68,require('../api/faxApplication/faxApplication.rpc'));_0x305d68=_['merge'](_0x305d68,require('../api/faxInteraction/faxInteraction.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x16')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x17')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x18')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x19')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/smsMessage/smsMessage.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x1a')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x1b')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x1c')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x1d')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x1e')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x1f')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x20')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x21')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x22')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x23')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x24')));_0x305d68=_['merge'](_0x305d68,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x25')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x26')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x27')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/template/template.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x28')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/variable/variable.rpc'));_0x305d68=_['merge'](_0x305d68,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x29')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x2a')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x2b')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x2c')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x2d')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x2e')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x2f')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x30')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x31')));_0x305d68=_['merge'](_0x305d68,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x32')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x33')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x34')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/squareRecording/squareRecording.rpc'));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x35')));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x36')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x37')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x38')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x39')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x3a')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x305d68=_['merge'](_0x305d68,require(_0xbe27('0x3b')));_0x305d68=_[_0xbe27('0x5')](_0x305d68,require(_0xbe27('0x3c')));var _0x128437=jayson['server'](_0x305d68)[_0xbe27('0x3d')]();var _0x364dab=config[_0xbe27('0x3e')][_0xbe27('0x3f')]||config[_0xbe27('0x3f')]+0x1;var _0x4f7285=config[_0xbe27('0x3e')]['ip']||_0xbe27('0x40');_0x128437['on'](_0xbe27('0x41'),function(_0x2cc0ad){return _0x3ff054(_0x2cc0ad);});_0x128437[_0xbe27('0x4')](_0x364dab,_0x4f7285,function(){console[_0xbe27('0x42')](_0xbe27('0x43'),_0x4f7285,_0x364dab);require('../config/triggers')[_0xbe27('0x44')]();return _0xed7a7a(_0xbe27('0x45')+_0x4f7285+':'+_0x364dab);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 863f9ff..c36a86a 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(_0x209c06,_0x4bde21){var _0x32b060=function(_0x589239){while(--_0x589239){_0x209c06['push'](_0x209c06['shift']());}};_0x32b060(++_0x4bde21);}(_0x70e0,0x17b));var _0x070e=function(_0x5caa5e,_0x4ee147){_0x5caa5e=_0x5caa5e-0x0;var _0x76b9b2=_0x70e0[_0x5caa5e];return _0x76b9b2;};'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 _0x0713=['noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x267737,_0x246601){var _0x56ae3d=function(_0x2556a8){while(--_0x2556a8){_0x267737['push'](_0x267737['shift']());}};_0x56ae3d(++_0x246601);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3071('0x0'))[_0x3071('0x1')];var AGIReply=require(_0x3071('0x2'));var AGIError=require(_0x3071('0x3'));function AGIChannel(_0x864539){var _0x52b5fb=this,_0x2c547f=new AGIReply(),_0x7b18a4=![],_0x33a70c={};EventEmitter[_0x3071('0x4')](_0x52b5fb);_0x864539[_0x3071('0x5')](_0x3071('0x6'));_0x864539[_0x3071('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c547f[_0x3071('0x5')](_0x3071('0x6'));_0x2c547f['on'](_0x3071('0x8'),function(_0x3e9a5e){for(var _0x2fce7a in _0x3e9a5e){_0x52b5fb[_0x2fce7a]=_0x3e9a5e[_0x2fce7a];}_0x52b5fb[_0x3071('0x9')]('ready');});_0x2c547f['on'](_0x3071('0xa'),function(_0x2610b4){if(_0x2610b4[_0x3071('0xb')]()==_0x3071('0xc')){_0x52b5fb[_0x3071('0x9')]('hangup');return;}if(_0x2610b4[_0x3071('0xd')](0x0,0xb)==_0x3071('0xe')){_0x7b18a4=!![];}if(_0x7b18a4){_0x33a70c['rx']+=_0x2610b4+'\x0a';if(_0x2610b4[_0x3071('0xf')](_0x3071('0x10'))!=-0x1){_0x7b18a4=![];}}else{_0x33a70c['rx']=_0x2610b4;}if(_0x7b18a4){return;}if(typeof _0x33a70c['cb']==_0x3071('0x11')){var _0x4a8cc7=_0x33a70c['rx']['substring'](0x0,0x3),_0x5330a8=null,_0x1826ca=null;_0x4a8cc7=parseInt(_0x4a8cc7);if(isNaN(_0x4a8cc7)){_0x33a70c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3071('0x12')});return;}if(_0x4a8cc7!=0xc8){_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':-0x1,'extra':'KO'});return;}_0x5330a8=_0x33a70c['rx'][_0x3071('0xd')](0x4)['replace'](_0x3071('0x13'),'');if(_0x5330a8['indexOf']('\x20')!=-0x1){_0x5330a8=_0x5330a8[_0x3071('0x14')](0x0,_0x5330a8[_0x3071('0x15')]('\x20'));}if(_[_0x3071('0x16')](_0x5330a8,'-1')){_0x5330a8=parseInt(_0x5330a8);}_0x1826ca=_0x33a70c['rx'][_0x3071('0x17')]('\x20');if(_0x1826ca[_0x3071('0x18')]==0x3){_0x1826ca=_0x1826ca[0x2][_0x3071('0xd')](0x1,_0x1826ca[0x2][_0x3071('0x18')]-0x1);}else if(_0x1826ca[_0x3071('0x18')]>0x3){var _0x21aad3=/\((.+)\)/;var _0x344ea6=_0x33a70c['rx']['match'](_0x21aad3);if(_0x344ea6){_0x1826ca=_0x344ea6[0x1];}else{_0x1826ca=null;}}else{_0x1826ca=null;}_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':_0x5330a8,'extra':_0x1826ca});}});_0x864539['on'](_0x3071('0x19'),function(_0x17dbda){_0x52b5fb[_0x3071('0x9')](_0x3071('0x19'),new AGIError(_0x3071('0x1a'),_0x17dbda[_0x3071('0x1b')]));});_0x864539['on'](_0x3071('0x1c'),function(){_0x52b5fb[_0x3071('0x9')]('close',new AGIError(_0x3071('0x1d')));});_0x864539['on'](_0x3071('0x1e'),function(){_0x52b5fb[_0x3071('0x9')]('timeout',new AGIError(_0x3071('0x1f')));_0x864539['destroy']();});_0x864539[_0x3071('0x20')](_0x2c547f);this[_0x3071('0x21')]=function(_0x3762d8,_0x457b57){var _0x3762d8=_0x3762d8||'',_0x457b57=typeof _0x457b57==_0x3071('0x11')?_0x457b57:new Function();_0x33a70c={'tx':_0x3762d8,'rx':'','cb':_0x457b57};_0x864539[_0x3071('0x22')](_0x3762d8+'\x0a');},this['close']=function(){_0x864539['destroy']();};}util[_0x3071('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3071('0x24')][_0x3071('0x25')]=function(_0x13df9f){return this[_0x3071('0x21')][_0x3071('0x26')](this,_0x13df9f);};AGIChannel[_0x3071('0x24')][_0x3071('0x27')]=function(){return this[_0x3071('0x25')]('ANSWER');};AGIChannel[_0x3071('0x24')][_0x3071('0x28')]=function(_0x177138,_0x4d5c4b,_0x4fb1ca){_0x177138=_0x177138===undefined?_0x3071('0x29'):_0x177138;_0x4d5c4b=_0x4d5c4b===undefined?'5':_0x4d5c4b;_0x4fb1ca=_0x4fb1ca===undefined?'1':_0x4fb1ca;return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x2b'),_0x177138,_0x4d5c4b*0x3e8,_0x4fb1ca));};AGIChannel[_0x3071('0x24')][_0x3071('0x2c')]=function(_0x3921a1){_0x3921a1=_0x3921a1||_0x3071('0x2d');return this[_0x3071('0x25')](util[_0x3071('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3921a1));};AGIChannel['prototype'][_0x3071('0x2e')]=function(_0x149e0d,_0x6ddf96){if(_[_0x3071('0x2f')](_0x6ddf96)){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x30'),_0x149e0d,_0x6ddf96[_0x3071('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x149e0d,_0x6ddf96));};AGIChannel[_0x3071('0x24')][_0x3071('0x32')]=function(_0x5b5bf1){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x33'),_0x5b5bf1));};AGIChannel[_0x3071('0x24')]['setExtension']=function(_0x218a82){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x34'),_0x218a82));};AGIChannel[_0x3071('0x24')][_0x3071('0x35')]=function(_0x3c55c){return this[_0x3071('0x25')](util['format'](_0x3071('0x36'),_0x3c55c));};AGIChannel['prototype']['hangup']=function(){return this[_0x3071('0x25')](_0x3071('0x37'));};AGIChannel['prototype'][_0x3071('0x38')]=function(_0x46e94e,_0x265d76){var _0x14ac42=_[_0x3071('0x39')](_0x265d76)||_[_0x3071('0x3a')](_0x265d76)?_0x265d76['toString']():_0x265d76;return this[_0x3071('0x25')](util[_0x3071('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46e94e,_0x14ac42?_0x14ac42[_0x3071('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3071('0x24')][_0x3071('0x3c')]=function(_0x5733e9,_0x593c99){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x3d'),_0x5733e9,_0x593c99));};AGIChannel['prototype'][_0x3071('0x3e')]=function(_0x534a77,_0x1ac90a){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x3f'),_0x534a77,_0x1ac90a));};AGIChannel[_0x3071('0x24')][_0x3071('0x40')]=function(_0x30ab68,_0x593c9c){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x41'),_0x30ab68,_0x593c9c));};AGIChannel[_0x3071('0x24')][_0x3071('0x42')]=function(_0x525389,_0x3cfc05,_0x60549a){_0x3cfc05=_0x3cfc05||this[_0x3071('0x43')];_0x60549a=_0x60549a||0x1;this[_0x3071('0x32')](_0x525389);this[_0x3071('0x44')](_0x3cfc05);this[_0x3071('0x35')](_0x60549a);return this['noop'](util[_0x3071('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x525389,_0x3cfc05,_0x60549a));};AGIChannel['prototype']['getVariable']=function(_0x47ceaf){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x45'),_0x47ceaf));};AGIChannel[_0x3071('0x24')][_0x3071('0x46')]=function(_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1e8222,_0x1641d9){_0xa711b5=_0xa711b5||_0x3071('0x47');_0x2e6c70=_0x2e6c70||'';_0x56589e=_0x56589e===undefined?-0x1:_0x56589e==='-1'?-0x1:_0x56589e*0x3e8;_0x1e8222=_0x1e8222===undefined?'':'s='+_0x1e8222;_0x1641d9=_0x1641d9?_0x3071('0x48'):'';return this[_0x3071('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1641d9,_0x1e8222));};AGIChannel[_0x3071('0x24')][_0x3071('0x49')]=function(_0x1fe5e0,_0x5c5865){_0x5c5865=_0x5c5865||'';return this[_0x3071('0x25')](util['format'](_0x3071('0x4a'),_0x1fe5e0,_0x5c5865));};AGIChannel['prototype'][_0x3071('0x4b')]=function(_0x509178){return this['exec'](_0x3071('0x4c'),_0x509178);};AGIChannel['prototype'][_0x3071('0x4d')]=function(_0x5a0a69){return this[_0x3071('0x2e')](_0x3071('0x4e'),_0x5a0a69);};AGIChannel[_0x3071('0x24')][_0x3071('0x19')]=function(_0x554047,_0x2d70bf){this['noop'](util[_0x3071('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x554047['id'],_0x554047[_0x3071('0x4f')],_0x2d70bf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3071('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1bb5672..cfb5663 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 _0x95f4=['name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply'];(function(_0x269bd2,_0x22c283){var _0x7952ef=function(_0x3b17bd){while(--_0x3b17bd){_0x269bd2['push'](_0x269bd2['shift']());}};_0x7952ef(++_0x22c283);}(_0x95f4,0xf1));var _0x495f=function(_0x1b25f0,_0x29cb88){_0x1b25f0=_0x1b25f0-0x0;var _0x56e7b8=_0x95f4[_0x1b25f0];return _0x56e7b8;};'use strict';var util=require(_0x495f('0x0'));var error={'E_AGI_UNDEFINED':_0x495f('0x1'),'E_AGI_ARGUMENT_PORT':_0x495f('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x495f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x495f('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x495f('0x5'),'E_AGI_COMMAND_EMPTY':_0x495f('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x495f('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x704a46){var _0x704a46=_0x704a46||null,_0x304274=_0x304274||[],_0x4c17af=0x1,_0x2103a4='';if(!error[_0x704a46]){_0x704a46=_0x495f('0x8');}_0x304274[_0x495f('0x9')](error[_0x704a46]);while(arguments[_0x4c17af]){_0x304274['push'](arguments[_0x4c17af]);_0x4c17af++;}_0x2103a4=util['format'][_0x495f('0xa')](util,_0x304274);this['message']=_0x2103a4;this[_0x495f('0xb')]=_0x704a46;}module['exports']=AGIError; \ No newline at end of file +var _0xb73c=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb73c,0x1cd));var _0xcb73=function(_0x409fbc,_0xb47255){_0x409fbc=_0x409fbc-0x0;var _0x5cfba9=_0xb73c[_0x409fbc];return _0x5cfba9;};'use strict';var util=require(_0xcb73('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xcb73('0x1'),'E_AGI_SERVER_ERROR':_0xcb73('0x2'),'E_AGI_SERVER_CLOSE':_0xcb73('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xcb73('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xcb73('0x5'),'E_AGI_SOCKET_ERROR':_0xcb73('0x6'),'E_AGI_SOCKET_CLOSE':_0xcb73('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xcb73('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcb73('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5a230f){var _0x5a230f=_0x5a230f||null,_0x2e2a91=_0x2e2a91||[],_0x3b21e7=0x1,_0x392028='';if(!error[_0x5a230f]){_0x5a230f=_0xcb73('0xa');}_0x2e2a91[_0xcb73('0xb')](error[_0x5a230f]);while(arguments[_0x3b21e7]){_0x2e2a91[_0xcb73('0xb')](arguments[_0x3b21e7]);_0x3b21e7++;}_0x392028=util['format'][_0xcb73('0xc')](util,_0x2e2a91);this['message']=_0x392028;this[_0xcb73('0xd')]=_0x5a230f;}module[_0xcb73('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2a8a6f8..0eb7d59 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 _0x793b=['push','numberOfEdges','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','target','default','invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','addVertex','prototype','addEdge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x793b,0x189));var _0xb793=function(_0x23996d,_0x1d1c93){_0x23996d=_0x23996d-0x0;var _0x56e0ee=_0x793b[_0x23996d];return _0x56e0ee;};'use strict';var _=require(_0xb793('0x0'));var logger=require(_0xb793('0x1'))(_0xb793('0x2'));var verticesWithRetry=[_0xb793('0x3'),_0xb793('0x4'),'getsecretdigits'];var Graph=function(){this[_0xb793('0x5')]={};this[_0xb793('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xb793('0x7')]=function(_0x3cb1c8){this[_0xb793('0x5')][_0x3cb1c8['id']]=_0x3cb1c8;this[_0xb793('0x6')][_0x3cb1c8['id']]=[];};Graph[_0xb793('0x8')][_0xb793('0x9')]=function(_0x134ac4,_0x23a718,_0x149720){this[_0xb793('0x6')][_0x134ac4][_0xb793('0xa')]({'target':_0x23a718,'condition':_0x149720});this[_0xb793('0xb')]+=0x1;};Graph[_0xb793('0x8')][_0xb793('0xc')]=function(){return _['size'](this[_0xb793('0x5')]);};Graph[_0xb793('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xb793('0x8')][_0xb793('0xd')]=function(_0x56d568){return this[_0xb793('0x5')][_0x56d568];};Graph[_0xb793('0x8')]['traverseBFS']=function(_0x13d536,_0x164088){if(!this[_0xb793('0x5')][_0x13d536]){return logger[_0xb793('0xe')](_0xb793('0xf'));}var _0x1823ff=_0x164088(this[_0xb793('0x5')][_0x13d536]);if(!_0x1823ff){return logger['info'](_0xb793('0x10'));}if(this['edges'][_0x13d536]['length']===0x0){return logger[_0xb793('0xe')](_0xb793('0x11'));}for(var _0x115165=0x0,_0x1ff6cb=[],_0x38d9f2=![];_0x115165\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','mxGraphModel','root','retry','omit','length','source','target','value','getSquareProject','then','createSquareReport','catch','hasOwnProperty','indexOf','substring','inspect','debug','variables','stringify','close','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','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','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./vertices','defaults'];(function(_0x21b9f9,_0x4881b9){var _0x3f9a9b=function(_0x392939){while(--_0x392939){_0x21b9f9['push'](_0x21b9f9['shift']());}};_0x3f9a9b(++_0x4881b9);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1ad1bc,_0x19a702){_0x1ad1bc=_0x1ad1bc-0x0;var _0x336a96=_0x4c4e[_0x1ad1bc];return _0x336a96;};'use strict';var parser=require(_0xe4c4('0x0'));var _=require('lodash');var syncho=require(_0xe4c4('0x1'));var util=require(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var config=require('../../config/environment');var logger=require(_0xe4c4('0x4'))(_0xe4c4('0x5'));var utilLicense=require(_0xe4c4('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xe4c4('0x7'));var Graph=require('./graph');var Vertices=require(_0xe4c4('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe4c4('0x5')]=_[_0xe4c4('0x9')](config[_0xe4c4('0x5')],{'ip':_0xe4c4('0xa'),'port':0x11dd});function connectionHandler(_0x329d29){process[_0xe4c4('0xb')](function(){syncho(function(){try{setChannelVariables(_0x329d29);agiHandler(_0x329d29);}catch(_0x4c185c){logger['error'](_0x4c185c['stack']);}});});}function listeningHandler(){console[_0xe4c4('0xc')](_0xe4c4('0xd'),config[_0xe4c4('0x5')][_0xe4c4('0xe')]);logger[_0xe4c4('0xf')](util[_0xe4c4('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe4c4('0x5')]['ip'],config[_0xe4c4('0x5')][_0xe4c4('0xe')]));}function errorHandler(_0x2483d0){if(_0x2483d0&&_0x2483d0['name']&&_0x2483d0[_0xe4c4('0x11')]){logger[_0xe4c4('0x12')](util['format'](_0xe4c4('0x13'),_0x2483d0[_0xe4c4('0x14')],_0x2483d0['message']));}else{logger[_0xe4c4('0x12')](util[_0xe4c4('0x10')]('[ERROR]\x20%s',_0x2483d0[_0xe4c4('0x15')]));}}function closeHandler(){logger[_0xe4c4('0xf')](util[_0xe4c4('0x10')](_0xe4c4('0x16'),this[_0xe4c4('0x17')],this[_0xe4c4('0x18')],this[_0xe4c4('0x19')],this[_0xe4c4('0x1a')],this[_0xe4c4('0x1b')]));try{createSquareReport(this);}catch(_0x36b10c){logger[_0xe4c4('0x12')](_0x36b10c[_0xe4c4('0x15')]);}}function timeoutHandler(){logger[_0xe4c4('0xf')](util[_0xe4c4('0x10')](_0xe4c4('0x1c'),this['arg_1'],this[_0xe4c4('0x18')],this[_0xe4c4('0x19')],this[_0xe4c4('0x1a')],this[_0xe4c4('0x1b')]));}function hangupHandler(){logger['info'](util[_0xe4c4('0x10')](_0xe4c4('0x1d'),this[_0xe4c4('0x17')],this[_0xe4c4('0x18')],this[_0xe4c4('0x19')],this[_0xe4c4('0x1a')],this[_0xe4c4('0x1b')]));this[_0xe4c4('0x1e')]=!![];}function getRoot(_0x21bbb1){return parser[_0xe4c4('0x1f')](_0x21bbb1,{'object':!![]})[_0xe4c4('0x20')][_0xe4c4('0x21')];}function addVertex(_0x138ead,_0x1db719,_0x15873e){_0x1db719['agicommand']=_0x15873e;if(_0x1db719['hasOwnProperty'](_0xe4c4('0x22'))){_0x1db719['maxRetry']=parseInt(_0x1db719[_0xe4c4('0x22')],0xa);}_0x138ead['addVertex'](_[_0xe4c4('0x23')](_0x1db719,'mxCell'));}function initGraph(_0x34d667,_0x583393){var _0xba53ef=new Graph();for(var _0x4a0199 in _0x34d667){if(_0x34d667['hasOwnProperty'](_0x4a0199)){if(_['isArray'](_0x34d667[_0x4a0199])){for(var _0x5d66ab=0x0;_0x5d66ab<_0x34d667[_0x4a0199][_0xe4c4('0x24')];_0x5d66ab+=0x1){addVertex(_0xba53ef,_0x34d667[_0x4a0199][_0x5d66ab],_0x4a0199);}}else{addVertex(_0xba53ef,_0x34d667[_0x4a0199],_0x4a0199);}}}for(var _0x48cfe0=0x0;_0x48cfe0<_0x583393['length'];_0x48cfe0+=0x1){if(_0x583393[_0x48cfe0][_0xe4c4('0x25')]&&_0x583393[_0x48cfe0][_0xe4c4('0x26')]){_0xba53ef['addEdge'](_0x583393[_0x48cfe0]['source'],_0x583393[_0x48cfe0][_0xe4c4('0x26')],_0x583393[_0x48cfe0][_0xe4c4('0x27')]);}}return _0xba53ef;}function getSquareProject(_0x4aa6c1,_0x158432){rpc[_0xe4c4('0x28')](_0x4aa6c1)[_0xe4c4('0x29')](function(_0x48060e){_0x158432(null,_0x48060e);})['catch'](function(_0x46db7e){_0x158432(null,_0x46db7e);});}function createSquareReport(_0x2c5652,_0x12bde8){rpc[_0xe4c4('0x2a')](_0x2c5652)['then'](function(_0x49c913){if(_0x12bde8){_0x12bde8(null,_0x49c913);}})[_0xe4c4('0x2b')](function(_0x2e4282){if(_0x12bde8){_0x12bde8(null,_0x2e4282);}});}function setChannelVariables(_0x5d0ba5){for(var _0x3e18e1 in _0x5d0ba5){if(_0x5d0ba5[_0xe4c4('0x2c')](_0x3e18e1)){if(_0x3e18e1[_0xe4c4('0x2d')]('agi_')===0x0){_0x5d0ba5[_0x3e18e1[_0xe4c4('0x2e')](0x4)]=_0x5d0ba5[_0x3e18e1];delete _0x5d0ba5[_0x3e18e1];}}}}function getLogFromObject(_0x5976bc){return util[_0xe4c4('0x2f')](_0x5976bc,{'showHidden':![],'depth':null});}function agiHandler(_0x4239ba){var _0x3bb6cf,_0x35717a,_0x2bd5c1,_0x43c1ec,_0xb801c8;logger[_0xe4c4('0x30')](_0xe4c4('0x31'),JSON[_0xe4c4('0x32')](_0x4239ba,null,0x2));logger[_0xe4c4('0xf')](util[_0xe4c4('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4239ba[_0xe4c4('0x17')],_0x4239ba[_0xe4c4('0x18')],_0x4239ba[_0xe4c4('0x19')],_0x4239ba['dnid'],_0x4239ba[_0xe4c4('0x1b')]));_0x4239ba['on'](_0xe4c4('0x12'),errorHandler);_0x4239ba['on'](_0xe4c4('0x33'),closeHandler);_0x4239ba['on']('timeout',timeoutHandler);_0x4239ba[_0xe4c4('0x1e')]=![];_0x4239ba['on'](_0xe4c4('0x34'),hangupHandler);var _0x4a3644=getSquareProject[_0xe4c4('0x35')](null,_0x4239ba[_0xe4c4('0x17')]);if(_0x4a3644){if(_0x4a3644[_0xe4c4('0x36')]){_0x3bb6cf=getRoot(_0x4a3644[_0xe4c4('0x36')]);if(_0x3bb6cf&&_0x3bb6cf[_0xe4c4('0x37')]){logger[_0xe4c4('0x30')](_0xe4c4('0x21'),JSON['stringify'](_0x3bb6cf,null,0x2));_0x4239ba[_0xe4c4('0x38')]=moment()[_0xe4c4('0x10')](_0xe4c4('0x39'));_0x35717a=initGraph(_[_0xe4c4('0x23')](_0x3bb6cf,'mxCell'),_0x3bb6cf[_0xe4c4('0x3a')]);_0x2bd5c1=new Vertices(_0x4239ba,rpc,mailRpc);logger[_0xe4c4('0xf')](util['format'](_0xe4c4('0x3b'),_0x4239ba[_0xe4c4('0x17')],_0x4239ba['calleridname'],_0x4239ba[_0xe4c4('0x19')],_0x4239ba[_0xe4c4('0x1a')],_0x4239ba[_0xe4c4('0x1b')]));_0x35717a[_0xe4c4('0x3c')](_0x3bb6cf[_0xe4c4('0x37')]['id'],function(_0xe7a882){try{_0xe7a882=_0x2bd5c1[_0xe4c4('0x3d')](_0xe7a882);logger[_0xe4c4('0x30')](_0xe4c4('0x3e'),JSON[_0xe4c4('0x32')](_0xe7a882,null,0x2));if(_0xe7a882[_0xe4c4('0x3f')]===_0xe4c4('0x40')){logger['info'](_0xe4c4('0x41'));_0x4239ba[_0xe4c4('0x42')]=_0xe7a882[_0xe4c4('0x42')]||_0x4239ba[_0xe4c4('0x42')];_0x4239ba[_0xe4c4('0x43')]=_0xe7a882[_0xe4c4('0x43')];_0x4239ba['priority']=_0xe7a882[_0xe4c4('0x44')]?_0xe7a882['priority']-0x1:0x1;return null;}else if(_0xe7a882&&_0x2bd5c1[_0xe7a882[_0xe4c4('0x3f')]]){_0xb801c8=_0x2bd5c1[_0xe7a882[_0xe4c4('0x3f')]](_0xe7a882);logger[_0xe4c4('0xf')](_0xe4c4('0x45'),JSON[_0xe4c4('0x32')](_0xb801c8,null,0x2));if(_0xb801c8&&_0xb801c8['code']===AGI_CODE_SUCCESS&&_0xb801c8['result']!==AGI_RESULT_ERROR&&!_0x4239ba[_0xe4c4('0x1e')]){logger[_0xe4c4('0x30')](_0xe4c4('0x45'),getLogFromObject(_0xb801c8));return _['isUndefined'](_0xb801c8[_0xe4c4('0x46')])?null:_0xb801c8[_0xe4c4('0x46')][_0xe4c4('0x47')]();}else{logger[_0xe4c4('0x12')]('response',getLogFromObject(_0xb801c8));return null;}}else{logger[_0xe4c4('0x12')](_0xe4c4('0x48'));return null;}}catch(_0x9b049d){logger[_0xe4c4('0x12')](_0x9b049d[_0xe4c4('0x15')]);return null;}});if(_0x3bb6cf[_0xe4c4('0x49')]){logger[_0xe4c4('0xf')](util[_0xe4c4('0x10')](_0xe4c4('0x4a'),_0x4239ba['arg_1'],_0x4239ba[_0xe4c4('0x18')],_0x4239ba['callerid'],_0x4239ba[_0xe4c4('0x1a')],_0x4239ba[_0xe4c4('0x1b')]));_0x35717a[_0xe4c4('0x3c')](_0x3bb6cf[_0xe4c4('0x49')]['id'],function(_0x2b9f7b){try{_0x2b9f7b=_0x2bd5c1[_0xe4c4('0x3d')](_0x2b9f7b);logger[_0xe4c4('0x30')](_0xe4c4('0x3e'),JSON[_0xe4c4('0x32')](_0x2b9f7b,null,0x2));if(_0x2b9f7b&&_0x2bd5c1[_0x2b9f7b[_0xe4c4('0x3f')]]){_0xb801c8=_0x2bd5c1[_0x2b9f7b[_0xe4c4('0x3f')]](_0x2b9f7b);if(_0xb801c8){logger[_0xe4c4('0x30')](_0xe4c4('0x45'),getLogFromObject(_0xb801c8));return _[_0xe4c4('0x4b')](_0xb801c8['result'])?null:_0xb801c8['result'][_0xe4c4('0x47')]();}else{logger[_0xe4c4('0x12')]('response',getLogFromObject(_0xb801c8));return null;}}else{logger[_0xe4c4('0x12')](_0xe4c4('0x48'));return null;}}catch(_0x1211f9){logger[_0xe4c4('0x12')](_0x1211f9[_0xe4c4('0x15')]);return null;}});}logger['info'](util[_0xe4c4('0x10')](_0xe4c4('0x4c'),_0x4239ba['arg_1'],_0x4239ba[_0xe4c4('0x18')],_0x4239ba[_0xe4c4('0x19')],_0x4239ba['dnid'],_0x4239ba[_0xe4c4('0x1b')]));logger['info'](util[_0xe4c4('0x10')](_0xe4c4('0x4d'),_0x4239ba[_0xe4c4('0x42')],_0x4239ba[_0xe4c4('0x43')],parseInt(_0x4239ba[_0xe4c4('0x44')],0xa)+0x1));_0x4239ba['continueAt'](_0x4239ba[_0xe4c4('0x42')],_0x4239ba[_0xe4c4('0x43')],parseInt(_0x4239ba[_0xe4c4('0x44')],0xa)+0x1);_0x4239ba[_0xe4c4('0x33')]();}}else{logger[_0xe4c4('0x12')](util[_0xe4c4('0x10')](_0xe4c4('0x4e'),_0x4239ba[_0xe4c4('0x17')]));_0x4239ba[_0xe4c4('0x4f')](_0x4239ba[_0xe4c4('0x42')],_0x4239ba[_0xe4c4('0x43')],parseInt(_0x4239ba[_0xe4c4('0x44')],0xa)+0x1);_0x4239ba[_0xe4c4('0x33')]();}}else{logger[_0xe4c4('0x12')](util[_0xe4c4('0x10')](_0xe4c4('0x50'),_0x4239ba['arg_1']));_0x4239ba[_0xe4c4('0x4f')](_0x4239ba[_0xe4c4('0x42')],_0x4239ba[_0xe4c4('0x43')],parseInt(_0x4239ba['priority'],0xa)+0x1);_0x4239ba[_0xe4c4('0x33')]();}}function main(){var _0xb7e4da;return utilLicense[_0xe4c4('0x51')]()['then'](function(_0x45f959){if(_0x45f959){if(_0x45f959['voice']){if(_0x45f959[_0xe4c4('0x52')]&&_0x45f959[_0xe4c4('0x52')]>0x0){logger[_0xe4c4('0xf')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x45f959[_0xe4c4('0x52')]));_0xb7e4da=_0x45f959[_0xe4c4('0x52')];}else{logger[_0xe4c4('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe4c4('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xb7e4da=-0x1;}}})['catch'](function(_0x5a6176){logger['error'](_0xe4c4('0x53'),_0x5a6176[_0xe4c4('0x15')]);})[_0xe4c4('0x49')](function(){var _0x2ea066=require(_0xe4c4('0x54'))(config[_0xe4c4('0x5')]['port'],config[_0xe4c4('0x5')]['ip'],_0xb7e4da);_0x2ea066['on'](_0xe4c4('0x12'),errorHandler);_0x2ea066['on'](_0xe4c4('0x55'),listeningHandler);_0x2ea066['on'](_0xe4c4('0x56'),connectionHandler);_0x2ea066['on'](_0xe4c4('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0xf120=['length','source','target','addEdge','then','catch','createSquareReport','agi_','substring','inspect','debug','variables','close','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','stringify','agicommand','gotoc','context','extension','priority','response','code','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','evtHangup','mxGraphModel','root','hasOwnProperty','addVertex','omit','mxCell'];(function(_0x187ef4,_0x2fb8b4){var _0x592053=function(_0x53cb63){while(--_0x53cb63){_0x187ef4['push'](_0x187ef4['shift']());}};_0x592053(++_0x2fb8b4);}(_0xf120,0x179));var _0x0f12=function(_0x1c9c45,_0x20dee7){_0x1c9c45=_0x1c9c45-0x0;var _0x168e54=_0xf120[_0x1c9c45];return _0x168e54;};'use strict';var parser=require('xml2json');var _=require(_0x0f12('0x0'));var syncho=require(_0x0f12('0x1'));var util=require(_0x0f12('0x2'));var moment=require('moment');var config=require(_0x0f12('0x3'));var logger=require(_0x0f12('0x4'))(_0x0f12('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x0f12('0x6'));var mailRpc=require(_0x0f12('0x7'));var Graph=require(_0x0f12('0x8'));var Vertices=require(_0x0f12('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0f12('0x5')]=_[_0x0f12('0xa')](config[_0x0f12('0x5')],{'ip':_0x0f12('0xb'),'port':0x11dd});function connectionHandler(_0x5bb901){process[_0x0f12('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5bb901);agiHandler(_0x5bb901);}catch(_0x4bbb62){logger[_0x0f12('0xd')](_0x4bbb62[_0x0f12('0xe')]);}});});}function listeningHandler(){console[_0x0f12('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x0f12('0x10')]);logger[_0x0f12('0x11')](util[_0x0f12('0x12')](_0x0f12('0x13'),config[_0x0f12('0x5')]['ip'],config[_0x0f12('0x5')][_0x0f12('0x10')]));}function errorHandler(_0x4f0eda){if(_0x4f0eda&&_0x4f0eda[_0x0f12('0x14')]&&_0x4f0eda[_0x0f12('0x15')]){logger[_0x0f12('0xd')](util[_0x0f12('0x12')](_0x0f12('0x16'),_0x4f0eda[_0x0f12('0x14')],_0x4f0eda[_0x0f12('0x15')]));}else{logger[_0x0f12('0xd')](util[_0x0f12('0x12')](_0x0f12('0x17'),_0x4f0eda[_0x0f12('0xe')]));}}function closeHandler(){logger[_0x0f12('0x11')](util[_0x0f12('0x12')](_0x0f12('0x18'),this[_0x0f12('0x19')],this['calleridname'],this[_0x0f12('0x1a')],this['dnid'],this[_0x0f12('0x1b')]));try{createSquareReport(this);}catch(_0x3a7041){logger[_0x0f12('0xd')](_0x3a7041[_0x0f12('0xe')]);}}function timeoutHandler(){logger[_0x0f12('0x11')](util[_0x0f12('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0f12('0x19')],this['calleridname'],this[_0x0f12('0x1a')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x0f12('0x11')](util[_0x0f12('0x12')](_0x0f12('0x1c'),this['arg_1'],this[_0x0f12('0x1d')],this['callerid'],this[_0x0f12('0x1e')],this['uniqueid']));this[_0x0f12('0x1f')]=!![];}function getRoot(_0x379851){return parser['toJson'](_0x379851,{'object':!![]})[_0x0f12('0x20')][_0x0f12('0x21')];}function addVertex(_0x3a28ae,_0x3821dd,_0x44f3b1){_0x3821dd['agicommand']=_0x44f3b1;if(_0x3821dd[_0x0f12('0x22')]('retry')){_0x3821dd['maxRetry']=parseInt(_0x3821dd['retry'],0xa);}_0x3a28ae[_0x0f12('0x23')](_[_0x0f12('0x24')](_0x3821dd,_0x0f12('0x25')));}function initGraph(_0x13e737,_0x4aff64){var _0x310c03=new Graph();for(var _0x8917eb in _0x13e737){if(_0x13e737[_0x0f12('0x22')](_0x8917eb)){if(_['isArray'](_0x13e737[_0x8917eb])){for(var _0x13baa0=0x0;_0x13baa0<_0x13e737[_0x8917eb][_0x0f12('0x26')];_0x13baa0+=0x1){addVertex(_0x310c03,_0x13e737[_0x8917eb][_0x13baa0],_0x8917eb);}}else{addVertex(_0x310c03,_0x13e737[_0x8917eb],_0x8917eb);}}}for(var _0x8f43f9=0x0;_0x8f43f9<_0x4aff64['length'];_0x8f43f9+=0x1){if(_0x4aff64[_0x8f43f9][_0x0f12('0x27')]&&_0x4aff64[_0x8f43f9][_0x0f12('0x28')]){_0x310c03[_0x0f12('0x29')](_0x4aff64[_0x8f43f9][_0x0f12('0x27')],_0x4aff64[_0x8f43f9][_0x0f12('0x28')],_0x4aff64[_0x8f43f9]['value']);}}return _0x310c03;}function getSquareProject(_0x5531ed,_0x343ae0){rpc['getSquareProject'](_0x5531ed)[_0x0f12('0x2a')](function(_0x3c6ce5){_0x343ae0(null,_0x3c6ce5);})[_0x0f12('0x2b')](function(_0x52fc14){_0x343ae0(null,_0x52fc14);});}function createSquareReport(_0x12a575,_0x45a39a){rpc[_0x0f12('0x2c')](_0x12a575)[_0x0f12('0x2a')](function(_0x1672da){if(_0x45a39a){_0x45a39a(null,_0x1672da);}})[_0x0f12('0x2b')](function(_0x521ce1){if(_0x45a39a){_0x45a39a(null,_0x521ce1);}});}function setChannelVariables(_0x2c28e5){for(var _0x3310c4 in _0x2c28e5){if(_0x2c28e5[_0x0f12('0x22')](_0x3310c4)){if(_0x3310c4['indexOf'](_0x0f12('0x2d'))===0x0){_0x2c28e5[_0x3310c4[_0x0f12('0x2e')](0x4)]=_0x2c28e5[_0x3310c4];delete _0x2c28e5[_0x3310c4];}}}}function getLogFromObject(_0x214e11){return util[_0x0f12('0x2f')](_0x214e11,{'showHidden':![],'depth':null});}function agiHandler(_0x5a7d94){var _0x41d780,_0x8b2afc,_0x3d0a71,_0x15a629,_0xc7a1f6;logger[_0x0f12('0x30')](_0x0f12('0x31'),JSON['stringify'](_0x5a7d94,null,0x2));logger[_0x0f12('0x11')](util[_0x0f12('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5a7d94[_0x0f12('0x19')],_0x5a7d94[_0x0f12('0x1d')],_0x5a7d94['callerid'],_0x5a7d94[_0x0f12('0x1e')],_0x5a7d94[_0x0f12('0x1b')]));_0x5a7d94['on']('error',errorHandler);_0x5a7d94['on'](_0x0f12('0x32'),closeHandler);_0x5a7d94['on']('timeout',timeoutHandler);_0x5a7d94[_0x0f12('0x1f')]=![];_0x5a7d94['on'](_0x0f12('0x33'),hangupHandler);var _0x2ed69c=getSquareProject[_0x0f12('0x34')](null,_0x5a7d94[_0x0f12('0x19')]);if(_0x2ed69c){if(_0x2ed69c[_0x0f12('0x35')]){_0x41d780=getRoot(_0x2ed69c[_0x0f12('0x35')]);if(_0x41d780&&_0x41d780[_0x0f12('0x36')]){logger[_0x0f12('0x30')](_0x0f12('0x21'),JSON['stringify'](_0x41d780,null,0x2));_0x5a7d94[_0x0f12('0x37')]=moment()[_0x0f12('0x12')](_0x0f12('0x38'));_0x8b2afc=initGraph(_['omit'](_0x41d780,'mxCell'),_0x41d780['mxCell']);_0x3d0a71=new Vertices(_0x5a7d94,rpc,mailRpc);logger[_0x0f12('0x11')](util[_0x0f12('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5a7d94['arg_1'],_0x5a7d94[_0x0f12('0x1d')],_0x5a7d94[_0x0f12('0x1a')],_0x5a7d94[_0x0f12('0x1e')],_0x5a7d94['uniqueid']));_0x8b2afc[_0x0f12('0x39')](_0x41d780[_0x0f12('0x36')]['id'],function(_0x5a3b99){try{_0x5a3b99=_0x3d0a71[_0x0f12('0x3a')](_0x5a3b99);logger[_0x0f12('0x30')](_0x0f12('0x3b'),JSON[_0x0f12('0x3c')](_0x5a3b99,null,0x2));if(_0x5a3b99[_0x0f12('0x3d')]===_0x0f12('0x3e')){logger[_0x0f12('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5a7d94[_0x0f12('0x3f')]=_0x5a3b99['context']||_0x5a7d94[_0x0f12('0x3f')];_0x5a7d94[_0x0f12('0x40')]=_0x5a3b99['extension'];_0x5a7d94[_0x0f12('0x41')]=_0x5a3b99[_0x0f12('0x41')]?_0x5a3b99[_0x0f12('0x41')]-0x1:0x1;return null;}else if(_0x5a3b99&&_0x3d0a71[_0x5a3b99['agicommand']]){_0xc7a1f6=_0x3d0a71[_0x5a3b99['agicommand']](_0x5a3b99);logger[_0x0f12('0x11')](_0x0f12('0x42'),JSON[_0x0f12('0x3c')](_0xc7a1f6,null,0x2));if(_0xc7a1f6&&_0xc7a1f6[_0x0f12('0x43')]===AGI_CODE_SUCCESS&&_0xc7a1f6['result']!==AGI_RESULT_ERROR&&!_0x5a7d94[_0x0f12('0x1f')]){logger[_0x0f12('0x30')](_0x0f12('0x42'),getLogFromObject(_0xc7a1f6));return _[_0x0f12('0x44')](_0xc7a1f6['result'])?null:_0xc7a1f6[_0x0f12('0x45')][_0x0f12('0x46')]();}else{logger['error']('response',getLogFromObject(_0xc7a1f6));return null;}}else{logger[_0x0f12('0xd')](_0x0f12('0x47'));return null;}}catch(_0x212cc6){logger['error'](_0x212cc6['stack']);return null;}});if(_0x41d780[_0x0f12('0x48')]){logger[_0x0f12('0x11')](util['format'](_0x0f12('0x49'),_0x5a7d94['arg_1'],_0x5a7d94[_0x0f12('0x1d')],_0x5a7d94[_0x0f12('0x1a')],_0x5a7d94['dnid'],_0x5a7d94['uniqueid']));_0x8b2afc[_0x0f12('0x39')](_0x41d780[_0x0f12('0x48')]['id'],function(_0x3783a9){try{_0x3783a9=_0x3d0a71[_0x0f12('0x3a')](_0x3783a9);logger[_0x0f12('0x30')](_0x0f12('0x3b'),JSON[_0x0f12('0x3c')](_0x3783a9,null,0x2));if(_0x3783a9&&_0x3d0a71[_0x3783a9[_0x0f12('0x3d')]]){_0xc7a1f6=_0x3d0a71[_0x3783a9['agicommand']](_0x3783a9);if(_0xc7a1f6){logger[_0x0f12('0x30')]('response',getLogFromObject(_0xc7a1f6));return _[_0x0f12('0x44')](_0xc7a1f6['result'])?null:_0xc7a1f6['result'][_0x0f12('0x46')]();}else{logger['error'](_0x0f12('0x42'),getLogFromObject(_0xc7a1f6));return null;}}else{logger[_0x0f12('0xd')](_0x0f12('0x47'));return null;}}catch(_0x284422){logger['error'](_0x284422[_0x0f12('0xe')]);return null;}});}logger[_0x0f12('0x11')](util[_0x0f12('0x12')](_0x0f12('0x4a'),_0x5a7d94['arg_1'],_0x5a7d94['calleridname'],_0x5a7d94[_0x0f12('0x1a')],_0x5a7d94[_0x0f12('0x1e')],_0x5a7d94[_0x0f12('0x1b')]));logger[_0x0f12('0x11')](util[_0x0f12('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5a7d94['context'],_0x5a7d94['extension'],parseInt(_0x5a7d94[_0x0f12('0x41')],0xa)+0x1));_0x5a7d94[_0x0f12('0x4b')](_0x5a7d94[_0x0f12('0x3f')],_0x5a7d94[_0x0f12('0x40')],parseInt(_0x5a7d94[_0x0f12('0x41')],0xa)+0x1);_0x5a7d94[_0x0f12('0x32')]();}}else{logger[_0x0f12('0xd')](util[_0x0f12('0x12')](_0x0f12('0x4c'),_0x5a7d94[_0x0f12('0x19')]));_0x5a7d94[_0x0f12('0x4b')](_0x5a7d94['context'],_0x5a7d94[_0x0f12('0x40')],parseInt(_0x5a7d94[_0x0f12('0x41')],0xa)+0x1);_0x5a7d94[_0x0f12('0x32')]();}}else{logger[_0x0f12('0xd')](util['format']('Project\x20%s\x20not\x20found',_0x5a7d94[_0x0f12('0x19')]));_0x5a7d94[_0x0f12('0x4b')](_0x5a7d94[_0x0f12('0x3f')],_0x5a7d94[_0x0f12('0x40')],parseInt(_0x5a7d94[_0x0f12('0x41')],0xa)+0x1);_0x5a7d94[_0x0f12('0x32')]();}}function main(){var _0x395a6a;return utilLicense[_0x0f12('0x4d')]()['then'](function(_0x204728){if(_0x204728){if(_0x204728[_0x0f12('0x4e')]){if(_0x204728['callysquare']&&_0x204728[_0x0f12('0x4f')]>0x0){logger[_0x0f12('0x11')](util[_0x0f12('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x204728[_0x0f12('0x4f')]));_0x395a6a=_0x204728[_0x0f12('0x4f')];}else{logger[_0x0f12('0x11')](_0x0f12('0x50'));}}else{logger[_0x0f12('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x395a6a=-0x1;}}})[_0x0f12('0x2b')](function(_0x51040a){logger[_0x0f12('0xd')]('[LICENSE]',_0x51040a[_0x0f12('0xe')]);})[_0x0f12('0x48')](function(){var _0x53bc13=require(_0x0f12('0x51'))(config[_0x0f12('0x5')]['port'],config[_0x0f12('0x5')]['ip'],_0x395a6a);_0x53bc13['on']('error',errorHandler);_0x53bc13['on'](_0x0f12('0x52'),listeningHandler);_0x53bc13['on']('connection',connectionHandler);_0x53bc13['on'](_0x0f12('0x32'),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 99f08fe..1c904c6 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(_0x233251,_0x1a7fee){var _0x27f240=function(_0x42696c){while(--_0x42696c){_0x233251['push'](_0x233251['shift']());}};_0x27f240(++_0x1a7fee);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x543226,_0x564632){var _0x4e9588=function(_0x14b6f6){while(--_0x14b6f6){_0x543226['push'](_0x543226['shift']());}};_0x4e9588(++_0x564632);}(_0x34e8,0x12c));var _0x834e=function(_0x3fc1ec,_0x3b2535){_0x3fc1ec=_0x3fc1ec-0x0;var _0x55400c=_0x34e8[_0x3fc1ec];return _0x55400c;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b1d6ae6..69db7f5 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1675fc,_0x24d17a){var _0x5247ce=function(_0x498b17){while(--_0x498b17){_0x1675fc['push'](_0x1675fc['shift']());}};_0x5247ce(++_0x24d17a);}(_0x7a54,0x106));var _0x47a5=function(_0x2224a5,_0x5525b6){_0x2224a5=_0x2224a5-0x0;var _0x39a9f8=_0x7a54[_0x2224a5];return _0x39a9f8;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=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(_0x194494,_0x57c76e){var _0x45acaf=function(_0x37e62f){while(--_0x37e62f){_0x194494['push'](_0x194494['shift']());}};_0x45acaf(++_0x57c76e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x8a2e04,_0x2ec12d){_0x8a2e04=_0x8a2e04-0x0;var _0x8688e8=_0x5f2f[_0x8a2e04];return _0x8688e8;};'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 6b8caf1..4a497b6 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 _0x19bf=['moment','lodash','util','jayson/promise','client','http','request','then','error','result','catch','ShowSquareProject','production','ShowMailAccount','name','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','phone','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0x19bf,0x18f));var _0xf19b=function(_0x268194,_0x2d38c6){_0x268194=_0x268194-0x0;var _0x519f46=_0x19bf[_0x268194];return _0x519f46;};'use strict';var BPromise=require(_0xf19b('0x0'));var moment=require(_0xf19b('0x1'));var _=require(_0xf19b('0x2'));var util=require(_0xf19b('0x3'));var jayson=require(_0xf19b('0x4'));var client=jayson[_0xf19b('0x5')][_0xf19b('0x6')]({'port':0x2329});function request(_0x3d7f91,_0x7c175){return new BPromise(function(_0x76d694,_0x298e82){return client[_0xf19b('0x7')](_0x3d7f91,_0x7c175)[_0xf19b('0x8')](function(_0x4b31d7){if(_0x4b31d7[_0xf19b('0x9')]){return _0x298e82(_0x4b31d7[_0xf19b('0x9')]['message']);}else{return _0x76d694(_0x4b31d7[_0xf19b('0xa')]);}})[_0xf19b('0xb')](function(_0x31da4c){return _0x298e82(_0x31da4c);});});}exports['getSquareProject']=function(_0x4ee4b1){return request(_0xf19b('0xc'),{'options':{'raw':![],'where':{'name':_0x4ee4b1},'attributes':[_0xf19b('0xd')]}});};exports['getMailAccountById']=function(_0x327846){return request(_0xf19b('0xe'),{'options':{'raw':![],'where':{'id':_0x327846},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xf19b('0xf'),'email']}});};exports[_0xf19b('0x10')]=function(_0xf19628){return request('ShowSquareProject',{'options':{'where':{'id':_0xf19628},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x5aa237){return request(_0xf19b('0x11'),{'options':{'where':{'id':_0x5aa237},'attributes':[_0xf19b('0xf')]}});};exports['getVariableById']=function(_0x46dea7){return request(_0xf19b('0x12'),{'options':{'where':{'id':_0x46dea7},'attributes':[_0xf19b('0xf')]}});};exports[_0xf19b('0x13')]=function(_0x1e56b4){return request(_0xf19b('0x14'),{'options':{'where':{'id':_0x1e56b4},'attributes':['dsn']}});};exports[_0xf19b('0x15')]=function(_0xbc7621){return request('ShowUser',{'options':{'where':{'id':_0xbc7621},'attributes':[_0xf19b('0xf')]}});};exports[_0xf19b('0x16')]=function(_0x4e5c81){return request(_0xf19b('0x17'),{'options':{'where':{'id':_0x4e5c81},'attributes':[_0xf19b('0xf')]}});};exports[_0xf19b('0x18')]=function(_0x5b1fa4){return request(_0xf19b('0x19'),{'options':{'where':{'id':_0x5b1fa4},'attributes':[_0xf19b('0x1a')]}});};exports[_0xf19b('0x1b')]=function(_0x44929e){return request(_0xf19b('0x1c'),{'options':{'raw':![],'where':{'id':_0x44929e},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x1bdec){return request(_0xf19b('0x1d'),{'options':{'where':{'id':_0x1bdec},'attributes':['id',_0xf19b('0xf')]}});};exports['createSmsMessage']=function(_0x482bdd){return request(_0xf19b('0x1e'),{'body':_0x482bdd});};exports[_0xf19b('0x1f')]=function(_0x286338){return request(_0xf19b('0x20'),{'body':_0x286338});};exports[_0xf19b('0x21')]=function(_0x217702){return request(_0xf19b('0x22'),{'body':_[_0xf19b('0x23')](_0x217702,{'project_name':_0x217702['arg_1'],'prev_project_name':_0x217702[_0xf19b('0x24')]||'','is_subproject':_0x217702[_0xf19b('0x24')]?!![]:![],'leaveAt':moment()[_0xf19b('0x25')](_0xf19b('0x26'))})});};exports['createSquareRecording']=function(_0x35d795){return request('CreateSquareRecording',{'body':_0x35d795});};exports[_0xf19b('0x27')]=function(_0x5c16db){return request('CreateSquareMessage',{'body':_0x5c16db});};exports['createCmContact']=function(_0x9fcaa8){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x9fcaa8[_0xf19b('0x28')],'ListId':_0x9fcaa8['ListId']}}})[_0xf19b('0x8')](function(_0x55b6ad){if(_0x55b6ad){return _0x55b6ad;}return request('CreateCmContact',{'body':_0x9fcaa8});});};exports[_0xf19b('0x29')]=function(_0xd0baf6){return request(_0xf19b('0x2a'),{'options':{'where':{'id':_0xd0baf6},'attributes':[_0xf19b('0xf')]}});};exports[_0xf19b('0x2b')]=function(_0x26b606,_0x49fff2){return request(_0xf19b('0x2c'),{'body':{'interface':_0x49fff2},'options':{'where':_0x26b606}});};exports[_0xf19b('0x2d')]=function(_0x53d7f8,_0x4fb768,_0x512d88){return request(_0xf19b('0x2e'),{'body':{'type':_0x4fb768,'uniqueid':_0x512d88},'options':{'where':_0x53d7f8}});};exports[_0xf19b('0x2f')]=function(_0xcd07e5){return request(_0xf19b('0x30'),{'body':{},'options':{'where':_0xcd07e5}});};exports['agentLogout']=function(_0x885647){return request(_0xf19b('0x31'),{'body':{},'options':{'where':_0x885647}});}; \ No newline at end of file +var _0x43f7=['ShowVoiceQueue','getVariableById','ShowVariable','getUserById','ShowUser','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById'];(function(_0x1a0c0d,_0x5ae95e){var _0x2a1e9b=function(_0x164724){while(--_0x164724){_0x1a0c0d['push'](_0x1a0c0d['shift']());}};_0x2a1e9b(++_0x5ae95e);}(_0x43f7,0x14d));var _0x743f=function(_0x592d64,_0x138b96){_0x592d64=_0x592d64-0x0;var _0x5eaea8=_0x43f7[_0x592d64];return _0x5eaea8;};'use strict';var BPromise=require(_0x743f('0x0'));var moment=require('moment');var _=require(_0x743f('0x1'));var util=require(_0x743f('0x2'));var jayson=require(_0x743f('0x3'));var client=jayson['client'][_0x743f('0x4')]({'port':0x2329});function request(_0x387b6b,_0xe6f79c){return new BPromise(function(_0x462879,_0x4fa984){return client[_0x743f('0x5')](_0x387b6b,_0xe6f79c)[_0x743f('0x6')](function(_0x1a987b){if(_0x1a987b['error']){return _0x4fa984(_0x1a987b[_0x743f('0x7')][_0x743f('0x8')]);}else{return _0x462879(_0x1a987b[_0x743f('0x9')]);}})[_0x743f('0xa')](function(_0x172151){return _0x4fa984(_0x172151);});});}exports[_0x743f('0xb')]=function(_0x405b0a){return request(_0x743f('0xc'),{'options':{'raw':![],'where':{'name':_0x405b0a},'attributes':[_0x743f('0xd')]}});};exports[_0x743f('0xe')]=function(_0x37a56e){return request(_0x743f('0xf'),{'options':{'raw':![],'where':{'id':_0x37a56e},'include':[{'model':'MailServerOut','as':_0x743f('0x10')}],'attributes':['id',_0x743f('0x11'),_0x743f('0x12')]}});};exports[_0x743f('0x13')]=function(_0x15bf25){return request(_0x743f('0xc'),{'options':{'where':{'id':_0x15bf25},'attributes':[_0x743f('0x11')]}});};exports[_0x743f('0x14')]=function(_0x40ad68){return request(_0x743f('0x15'),{'options':{'where':{'id':_0x40ad68},'attributes':[_0x743f('0x11')]}});};exports[_0x743f('0x16')]=function(_0x2f1ef7){return request(_0x743f('0x17'),{'options':{'where':{'id':_0x2f1ef7},'attributes':[_0x743f('0x11')]}});};exports['getSquareOdbcById']=function(_0x2f1c0e){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2f1c0e},'attributes':['dsn']}});};exports[_0x743f('0x18')]=function(_0x3cdf19){return request(_0x743f('0x19'),{'options':{'where':{'id':_0x3cdf19},'attributes':['name']}});};exports['getTrunkById']=function(_0x432175){return request('ShowTrunk',{'options':{'where':{'id':_0x432175},'attributes':[_0x743f('0x11')]}});};exports['getSoundById']=function(_0x2791da){return request(_0x743f('0x1a'),{'options':{'where':{'id':_0x2791da},'attributes':[_0x743f('0x1b')]}});};exports[_0x743f('0x1c')]=function(_0x3ae29e){return request(_0x743f('0x1d'),{'options':{'raw':![],'where':{'id':_0x3ae29e},'include':[{'model':_0x743f('0x1e'),'as':'Intervals'}]}});};exports[_0x743f('0x1f')]=function(_0x5c1f6c){return request(_0x743f('0x20'),{'options':{'where':{'id':_0x5c1f6c},'attributes':['id',_0x743f('0x11')]}});};exports[_0x743f('0x21')]=function(_0x4f917f){return request(_0x743f('0x22'),{'body':_0x4f917f});};exports[_0x743f('0x23')]=function(_0x7d31f4){return request(_0x743f('0x24'),{'body':_0x7d31f4});};exports[_0x743f('0x25')]=function(_0x3e53b3){return request(_0x743f('0x26'),{'body':_[_0x743f('0x27')](_0x3e53b3,{'project_name':_0x3e53b3['arg_1'],'prev_project_name':_0x3e53b3[_0x743f('0x28')]||'','is_subproject':_0x3e53b3[_0x743f('0x28')]?!![]:![],'leaveAt':moment()[_0x743f('0x29')](_0x743f('0x2a'))})});};exports[_0x743f('0x2b')]=function(_0xc2d982){return request(_0x743f('0x2c'),{'body':_0xc2d982});};exports[_0x743f('0x2d')]=function(_0x4b994f){return request(_0x743f('0x2e'),{'body':_0x4b994f});};exports[_0x743f('0x2f')]=function(_0x488aaa){return request(_0x743f('0x30'),{'options':{'raw':![],'where':{'phone':_0x488aaa[_0x743f('0x31')],'ListId':_0x488aaa[_0x743f('0x32')]}}})[_0x743f('0x6')](function(_0x4881e1){if(_0x4881e1){return _0x4881e1;}return request(_0x743f('0x33'),{'body':_0x488aaa});});};exports['getPauseById']=function(_0x13fea2){return request('ShowPause',{'options':{'where':{'id':_0x13fea2},'attributes':[_0x743f('0x11')]}});};exports[_0x743f('0x34')]=function(_0x51d91f,_0x416c0d){return request(_0x743f('0x35'),{'body':{'interface':_0x416c0d},'options':{'where':_0x51d91f}});};exports[_0x743f('0x36')]=function(_0x2dab98,_0x1ae752,_0x47fb60){return request(_0x743f('0x37'),{'body':{'type':_0x1ae752,'uniqueid':_0x47fb60},'options':{'where':_0x2dab98}});};exports[_0x743f('0x38')]=function(_0x14e769){return request('UnpauseUser',{'body':{},'options':{'where':_0x14e769}});};exports[_0x743f('0x39')]=function(_0x5508b7){return request(_0x743f('0x3a'),{'body':{},'options':{'where':_0x5508b7}});}; \ 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 e975e0c..c67feef 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 _0x4b84=['./polly','./lex'];(function(_0x54f695,_0x17e578){var _0x5d8f73=function(_0x19fdb2){while(--_0x19fdb2){_0x54f695['push'](_0x54f695['shift']());}};_0x5d8f73(++_0x17e578);}(_0x4b84,0x1cc));var _0x44b8=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x4b84[_0x8c8176];return _0x4dc47b;};var polly=require(_0x44b8('0x0'));var lex=require(_0x44b8('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x008c=['./lex','exports','./polly'];(function(_0x34df53,_0x2c138a){var _0x577fcc=function(_0x1e26f8){while(--_0x1e26f8){_0x34df53['push'](_0x34df53['shift']());}};_0x577fcc(++_0x2c138a);}(_0x008c,0x188));var _0xc008=function(_0x448c09,_0x40cacc){_0x448c09=_0x448c09-0x0;var _0x3825cd=_0x008c[_0x448c09];return _0x3825cd;};var polly=require(_0xc008('0x0'));var lex=require(_0xc008('0x1'));module[_0xc008('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 ced9851..fd5c22c 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 _0xe739=['./lib/api'];(function(_0x5b3720,_0x865da5){var _0x5310ed=function(_0x1338f0){while(--_0x1338f0){_0x5b3720['push'](_0x5b3720['shift']());}};_0x5310ed(++_0x865da5);}(_0xe739,0x105));var _0x9e73=function(_0x2501d0,_0x31765b){_0x2501d0=_0x2501d0-0x0;var _0x5f070e=_0xe739[_0x2501d0];return _0x5f070e;};'use strict';var lex=require(_0x9e73('0x0'));module['exports']=function(_0x43bd09,_0x1620a4,_0x2dc1a9,_0x508042,_0x54a986,_0x594f94){return lex(_0x43bd09,_0x1620a4,_0x2dc1a9,_0x508042,_0x54a986,_0x594f94);}; \ No newline at end of file +var _0x8db0=['exports','./lib/api'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8db0,0x65));var _0x08db=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x8db0[_0x386c3e];return _0x4b8e13;};'use strict';var lex=require(_0x08db('0x0'));module[_0x08db('0x1')]=function(_0x50fae4,_0x6e32bb,_0x2ac694,_0x17ccf3,_0x5eb423,_0x3b5170){return lex(_0x50fae4,_0x6e32bb,_0x2ac694,_0x17ccf3,_0x5eb423,_0x3b5170);}; \ 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 5592857..5d09487 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 _0xc348=['postText','slots','hasOwnProperty','slot_','LexRuntime','$LATEST','bluebird','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc348,0x7e));var _0x8c34=function(_0x24ce00,_0x241efe){_0x24ce00=_0x24ce00-0x0;var _0x107835=_0xc348[_0x24ce00];return _0x107835;};'use strict';var BPromise=require(_0x8c34('0x0'));var AWS=require(_0x8c34('0x1'));function lexResult(_0x40d431,_0x25486a){return new BPromise(function(_0x1dcebb,_0xa7b274){_0x40d431[_0x8c34('0x2')](_0x25486a,function(_0x2a7fa0,_0x3ec0cb){if(_0x2a7fa0){_0xa7b274(_0x2a7fa0);}if(_0x3ec0cb[_0x8c34('0x3')]){for(const _0x5a78f3 in _0x3ec0cb[_0x8c34('0x3')]){if(_0x3ec0cb[_0x8c34('0x3')][_0x8c34('0x4')](_0x5a78f3)){var _0x367733=_0x3ec0cb[_0x8c34('0x3')][_0x5a78f3];_0x3ec0cb[_0x8c34('0x5')+_0x5a78f3]=_0x367733;}}}_0x1dcebb(_0x3ec0cb);});});}module['exports']=function(_0x35bce8,_0x33119d,_0x5c125d,_0x33208a,_0x49a147,_0xbda3c2){var _0x4429ce=new AWS[(_0x8c34('0x6'))]({'accessKeyId':_0x33119d,'secretAccessKey':_0x5c125d,'region':_0x33208a});var _0x47ea49={'botAlias':_0x8c34('0x7'),'botName':_0xbda3c2,'inputText':_0x49a147,'userId':_0x35bce8};return lexResult(_0x4429ce,_0x47ea49);}; \ No newline at end of file +var _0xdffa=['$LATEST','bluebird','postText','slots','exports','LexRuntime'];(function(_0x322d37,_0x125ca2){var _0x181ed4=function(_0x64040c){while(--_0x64040c){_0x322d37['push'](_0x322d37['shift']());}};_0x181ed4(++_0x125ca2);}(_0xdffa,0x1c3));var _0xadff=function(_0x67d63d,_0x2bd527){_0x67d63d=_0x67d63d-0x0;var _0x59c32f=_0xdffa[_0x67d63d];return _0x59c32f;};'use strict';var BPromise=require(_0xadff('0x0'));var AWS=require('aws-sdk');function lexResult(_0x455d98,_0x56d4ee){return new BPromise(function(_0x2b0756,_0x185a97){_0x455d98[_0xadff('0x1')](_0x56d4ee,function(_0x23817d,_0x4e6025){if(_0x23817d){_0x185a97(_0x23817d);}if(_0x4e6025[_0xadff('0x2')]){for(const _0x54aac3 in _0x4e6025[_0xadff('0x2')]){if(_0x4e6025[_0xadff('0x2')]['hasOwnProperty'](_0x54aac3)){var _0x56c0d2=_0x4e6025[_0xadff('0x2')][_0x54aac3];_0x4e6025['slot_'+_0x54aac3]=_0x56c0d2;}}}_0x2b0756(_0x4e6025);});});}module[_0xadff('0x3')]=function(_0x2dd7d8,_0x58db04,_0x2b86aa,_0x3b2557,_0x3fea35,_0x531e69){var _0x5f5b4c=new AWS[(_0xadff('0x4'))]({'accessKeyId':_0x58db04,'secretAccessKey':_0x2b86aa,'region':_0x3b2557});var _0x412da1={'botAlias':_0xadff('0x5'),'botName':_0x531e69,'inputText':_0x3fea35,'userId':_0x2dd7d8};return lexResult(_0x5f5b4c,_0x412da1);}; \ 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 a0058e8..62b59ce 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 _0x0d41=['./lib/api'];(function(_0x227672,_0x1f2922){var _0x40bae1=function(_0x3d2fb6){while(--_0x3d2fb6){_0x227672['push'](_0x227672['shift']());}};_0x40bae1(++_0x1f2922);}(_0x0d41,0x150));var _0x10d4=function(_0x380b12,_0x3dd065){_0x380b12=_0x380b12-0x0;var _0x4fb247=_0x0d41[_0x380b12];return _0x4fb247;};'use strict';var polly=require(_0x10d4('0x0'));module['exports']=function(_0xebe434,_0x5f1079,_0x521a47,_0x1c824a,_0x411cd8,_0x28b01c,_0x21bd2e){return polly(_0xebe434,_0x5f1079,_0x521a47,_0x1c824a,_0x411cd8,_0x28b01c,_0x21bd2e);}; \ No newline at end of file +var _0xfb72=['./lib/api','exports'];(function(_0x3d7ef5,_0x1bee5f){var _0x3e7827=function(_0x519f44){while(--_0x519f44){_0x3d7ef5['push'](_0x3d7ef5['shift']());}};_0x3e7827(++_0x1bee5f);}(_0xfb72,0x1ba));var _0x2fb7=function(_0x2475fb,_0x238ba5){_0x2475fb=_0x2475fb-0x0;var _0x5a879a=_0xfb72[_0x2475fb];return _0x5a879a;};'use strict';var polly=require(_0x2fb7('0x0'));module[_0x2fb7('0x1')]=function(_0x29d7f1,_0x531103,_0x31be5a,_0x453968,_0x3a52c2,_0x2e9f7f,_0x3d472d){return polly(_0x29d7f1,_0x531103,_0x31be5a,_0x453968,_0x3a52c2,_0x2e9f7f,_0x3d472d);}; \ 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 1c2241b..4c969a0 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 _0xd756=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x20c92c,_0x26cedc){var _0x49e173=function(_0x12d3fe){while(--_0x12d3fe){_0x20c92c['push'](_0x20c92c['shift']());}};_0x49e173(++_0x26cedc);}(_0xd756,0x1ec));var _0x6d75=function(_0x14bb5b,_0x5db398){_0x14bb5b=_0x14bb5b-0x0;var _0x12364a=_0xd756[_0x14bb5b];return _0x12364a;};'use strict';var fs=require('fs');var path=require(_0x6d75('0x0'));var BPromise=require(_0x6d75('0x1'));var rs=require(_0x6d75('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3e653d,_0x290fa8,_0x3c7029){return new BPromise(function(_0x47c67d,_0x1d13ca){_0x3e653d['synthesizeSpeech'](_0x290fa8,function(_0x144071,_0x2fe0ef){if(_0x144071){_0x1d13ca(_0x144071);}else if(_0x2fe0ef){if(_0x2fe0ef[_0x6d75('0x3')]instanceof Buffer){fs[_0x6d75('0x4')](_0x3c7029,_0x2fe0ef[_0x6d75('0x3')],function(_0x53c4f4){if(_0x53c4f4){_0x1d13ca(_0x53c4f4);}else{_0x47c67d();}});}else{_0x1d13ca(new Error(_0x6d75('0x5')));}}else{_0x1d13ca(new Error(_0x6d75('0x6')));}});});}module[_0x6d75('0x7')]=function(_0x1de50f,_0x428afa,_0x771e08,_0x615c3b,_0x50e90d,_0x5156bf,_0x1ac6c9){var _0x566dea=new AWS[(_0x6d75('0x8'))]({'accessKeyId':_0x1de50f,'secretAccessKey':_0x428afa,'region':_0x771e08});var _0x1a6b47={'Text':_0x50e90d,'TextType':_0x5156bf||_0x6d75('0x9'),'OutputFormat':_0x6d75('0xa'),'VoiceId':_0x615c3b};return pollyResult(_0x566dea,_0x1a6b47,_0x1ac6c9);}; \ No newline at end of file +var _0x1840=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x556fd4,_0x5c3c83){var _0x4f063e=function(_0x35daf5){while(--_0x35daf5){_0x556fd4['push'](_0x556fd4['shift']());}};_0x4f063e(++_0x5c3c83);}(_0x1840,0x196));var _0x0184=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1840[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require(_0x0184('0x0'));var BPromise=require('bluebird');var rs=require(_0x0184('0x1'));var AWS=require(_0x0184('0x2'));function pollyResult(_0x3a9b9b,_0x1be209,_0xb6c991){return new BPromise(function(_0x4efae0,_0x2faf21){_0x3a9b9b[_0x0184('0x3')](_0x1be209,function(_0x21e99a,_0x3a3743){if(_0x21e99a){_0x2faf21(_0x21e99a);}else if(_0x3a3743){if(_0x3a3743[_0x0184('0x4')]instanceof Buffer){fs[_0x0184('0x5')](_0xb6c991,_0x3a3743['AudioStream'],function(_0x18ffaf){if(_0x18ffaf){_0x2faf21(_0x18ffaf);}else{_0x4efae0();}});}else{_0x2faf21(new Error(_0x0184('0x6')));}}else{_0x2faf21(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x0184('0x7')]=function(_0x5f1445,_0x7201b6,_0x344136,_0x344792,_0x146bc9,_0x421c19,_0x5a80b9){var _0x47f7ad=new AWS[(_0x0184('0x8'))]({'accessKeyId':_0x5f1445,'secretAccessKey':_0x7201b6,'region':_0x344136});var _0x165a72={'Text':_0x146bc9,'TextType':_0x421c19||_0x0184('0x9'),'OutputFormat':_0x0184('0xa'),'VoiceId':_0x344792};return pollyResult(_0x47f7ad,_0x165a72,_0x5a80b9);}; \ 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 20f1e12..1e4e2f9 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 _0xf211=['./lib/api','exports'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xf211,0xa4));var _0x1f21=function(_0x2b778d,_0x5dd9e4){_0x2b778d=_0x2b778d-0x0;var _0x46a581=_0xf211[_0x2b778d];return _0x46a581;};'use strict';var asr=require(_0x1f21('0x0'));module[_0x1f21('0x1')]=function(_0x84f9e0,_0x2d581c,_0x57f156,_0x108441){return asr(_0x84f9e0,_0x2d581c,_0x57f156);}; \ No newline at end of file +var _0x5a29=['exports','./lib/api'];(function(_0x579e75,_0x40fe61){var _0x53a03f=function(_0x10d79e){while(--_0x10d79e){_0x579e75['push'](_0x579e75['shift']());}};_0x53a03f(++_0x40fe61);}(_0x5a29,0xdf));var _0x95a2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5a29[_0x4565bf];return _0x5610ba;};'use strict';var asr=require(_0x95a2('0x0'));module[_0x95a2('0x1')]=function(_0x42d5ff,_0xdeb4aa,_0x56e4ca,_0x5f2c8e){return asr(_0x42d5ff,_0xdeb4aa,_0x56e4ca);}; \ 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 e5e03f6..778bdfd 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 _0xc170=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x161bf6,_0x318082){var _0x13a921=function(_0x51c542){while(--_0x51c542){_0x161bf6['push'](_0x161bf6['shift']());}};_0x13a921(++_0x318082);}(_0xc170,0x174));var _0x0c17=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc170[_0x29b609];return _0x54c952;};'use strict';var url=require('url');var BPromise=require(_0x0c17('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x251a0d,_0x4225da,_0x23f528){return new BPromise(function(_0x1af67c,_0x48ef8d){var _0xfb01e3;if(typeof _0x251a0d!==_0x0c17('0x1')||_0x251a0d[_0x0c17('0x2')]===0x0){return _0x48ef8d(_0x0c17('0x3'));}if(typeof _0x4225da!=='string'||_0x4225da['length']===0x0){return _0x48ef8d(_0x0c17('0x4'));}if(typeof _0x23f528!==_0x0c17('0x5')&&(typeof _0x23f528!==_0x0c17('0x1')||_0x23f528['length']===0x0)){return _0x48ef8d(_0x0c17('0x6'));}try{_0xfb01e3=fs[_0x0c17('0x7')](_0x251a0d)[_0x0c17('0x8')](_0x0c17('0x9'));}catch(_0x154d60){return _0x48ef8d(_0x154d60);}return _0x1af67c({'method':_0x0c17('0xa'),'uri':host+_0x0c17('0xb')+_0x4225da,'body':{'config':{'encoding':_0x0c17('0xc'),'sampleRateHertz':_0x0c17('0xd'),'languageCode':_0x23f528},'audio':{'content':_0xfb01e3}},'json':!![]});});}; \ No newline at end of file +var _0x66f1=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','base64','POST','LINEAR16','8000','url','bluebird','string','length'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x66f1,0x1e8));var _0x166f=function(_0x56bbf6,_0x2ff73d){_0x56bbf6=_0x56bbf6-0x0;var _0x399d68=_0x66f1[_0x56bbf6];return _0x399d68;};'use strict';var url=require(_0x166f('0x0'));var BPromise=require(_0x166f('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x4058c1,_0x40fd63,_0x362ef5){return new BPromise(function(_0x5f5b20,_0x1794b7){var _0x3a7d21;if(typeof _0x4058c1!==_0x166f('0x2')||_0x4058c1[_0x166f('0x3')]===0x0){return _0x1794b7(_0x166f('0x4'));}if(typeof _0x40fd63!==_0x166f('0x2')||_0x40fd63[_0x166f('0x3')]===0x0){return _0x1794b7(_0x166f('0x5'));}if(typeof _0x362ef5!==_0x166f('0x6')&&(typeof _0x362ef5!==_0x166f('0x2')||_0x362ef5['length']===0x0)){return _0x1794b7('lang\x20should\x20be\x20a\x20string');}try{_0x3a7d21=fs[_0x166f('0x7')](_0x4058c1)['toString'](_0x166f('0x8'));}catch(_0x1b2c4a){return _0x1794b7(_0x1b2c4a);}return _0x5f5b20({'method':_0x166f('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x40fd63,'body':{'config':{'encoding':_0x166f('0xa'),'sampleRateHertz':_0x166f('0xb'),'languageCode':_0x362ef5},'audio':{'content':_0x3a7d21}},'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 fedf8c4..b4f6ffd 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 _0xfece=['./asr','exports'];(function(_0x1ec4eb,_0x14467b){var _0x4696eb=function(_0x266f18){while(--_0x266f18){_0x1ec4eb['push'](_0x1ec4eb['shift']());}};_0x4696eb(++_0x14467b);}(_0xfece,0x19e));var _0xefec=function(_0x3641c6,_0xf2ecd9){_0x3641c6=_0x3641c6-0x0;var _0x5cfa32=_0xfece[_0x3641c6];return _0x5cfa32;};var asr=require(_0xefec('0x0'));module[_0xefec('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2d20=['exports','./asr'];(function(_0x2b2caa,_0x427c14){var _0x45c60c=function(_0x22fb5b){while(--_0x22fb5b){_0x2b2caa['push'](_0x2b2caa['shift']());}};_0x45c60c(++_0x427c14);}(_0x2d20,0x1d1));var _0x02d2=function(_0x2e4483,_0x4848ab){_0x2e4483=_0x2e4483-0x0;var _0x3c3106=_0x2d20[_0x2e4483];return _0x3c3106;};var asr=require(_0x02d2('0x0'));module[_0x02d2('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 66c50be..598c1d0 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 _0x4101=['pipe','end','WHAT_EVER','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','then','unlink','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','.wav','googleCloudTTS\x20path','utf8','stringify','jQ1olc','null','generic','slice','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','displayName','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','google-tts-api','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','download\x20error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4101,0x189));var _0x1410=function(_0x4d6453,_0x4dfc5a){_0x4d6453=_0x4d6453-0x0;var _0x14d362=_0x4101[_0x4d6453];return _0x14d362;};'use strict';var apiai=require(_0x1410('0x0'));var BPromise=require(_0x1410('0x1'));var dialogflow=require(_0x1410('0x2'));var fs=require('fs');var http=require(_0x1410('0x3'));var https=require(_0x1410('0x4'));var md5=require(_0x1410('0x5'));var path=require('path');var querystring=require(_0x1410('0x6'));var rp=require(_0x1410('0x7'));var rs=require(_0x1410('0x8'));var sox=require('sox');var tts=require(_0x1410('0x9'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x1410('0xa'));var google=require(_0x1410('0xb'));var sestek=require(_0x1410('0xc'));var tilde=require(_0x1410('0xd'));var logger=require('../../../config/logger')(_0x1410('0xe'));var ISPEECH_API=_0x1410('0xf');function downloadFile(_0x19e274,_0x3969a9){return new BPromise(function(_0x3fb583,_0x30449a){var _0x21783b=urlParse(_0x19e274);var _0x472313=_0x21783b[_0x1410('0x10')]===_0x1410('0x11')?https:http;var _0x154575={'host':_0x21783b[_0x1410('0x12')],'path':_0x21783b[_0x1410('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x472313['get'](_0x154575,function(_0x277e57){if(_0x277e57[_0x1410('0x14')]!==0xc8){logger[_0x1410('0x15')](_0x1410('0x16')+_0x19e274+_0x1410('0x17')+_0x277e57[_0x1410('0x14')]+'\x20('+_0x277e57[_0x1410('0x18')]+')');_0x30449a(new Error(_0x1410('0x16')+_0x19e274+_0x1410('0x17')+_0x277e57[_0x1410('0x14')]+'\x20('+_0x277e57[_0x1410('0x18')]+')'));return;}var _0x3a285a=fs['createWriteStream'](_0x3969a9);_0x3a285a['on'](_0x1410('0x19'),function(){logger[_0x1410('0x1a')](_0x1410('0x1b'));_0x3a285a[_0x1410('0x1c')](_0x3fb583);});_0x3a285a['on'](_0x1410('0x15'),function(_0x420af8){fs['unlink'](_0x3969a9);logger['error'](_0x1410('0x1d'),_0x420af8);_0x30449a(_0x420af8);});_0x277e57[_0x1410('0x1e')](_0x3a285a);})['on'](_0x1410('0x15'),function(_0x67081c){logger[_0x1410('0x15')](_0x67081c);_0x30449a(_0x67081c);})[_0x1410('0x1f')]();});}function uploadFile(_0x200274){return new BPromise(function(_0x4ecd13,_0x528188){var _0xea7e87=urlParse(_0x200274);var _0x2ebecc=_0xea7e87[_0x1410('0x10')]===_0x1410('0x11')?https:http;var _0xac6899={'host':_0xea7e87['host'],'path':_0xea7e87[_0x1410('0x13')],'headers':{'user-agent':_0x1410('0x20')}};_0x2ebecc[_0x1410('0x21')](_0xac6899,function(_0x1c3b4b){if(_0x1c3b4b[_0x1410('0x14')]!==0xc8){_0x528188(new Error(_0x1410('0x16')+_0x200274+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c3b4b[_0x1410('0x14')]+'\x20('+_0x1c3b4b['statusMessage']+')'));return;}var _0x5b61f3='';_0x1c3b4b['on'](_0x1410('0x22'),function(_0x58cb69){_0x5b61f3+=_0x58cb69;});_0x1c3b4b['on'](_0x1410('0x1f'),function(){_0x4ecd13(_0x5b61f3);});})['on']('error',function(_0x4aa44b){_0x528188(_0x4aa44b);})[_0x1410('0x1f')]();});}function convertFile(_0x2a1e36,_0x28b8dd){return new BPromise(function(_0x17f063,_0x16fa4d){var _0x46f479=sox[_0x1410('0x23')](_0x2a1e36,_0x28b8dd,{'sampleRate':0x1f40,'format':_0x1410('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46f479['on'](_0x1410('0x15'),function(_0xcc62dc){logger[_0x1410('0x15')](_0x1410('0x25'),_0xcc62dc);_0x16fa4d(_0xcc62dc);});_0x46f479['on']('end',function(){logger[_0x1410('0x1a')](_0x1410('0x26'));_0x17f063();});_0x46f479['start']();});}function base64Decode(_0x54f61c,_0x2fc0c6){var _0x31522f=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+'.wav');fs[_0x1410('0x2a')](_0x31522f,_0x54f61c,'base64');return convertFile(_0x31522f,_0x2fc0c6)[_0x1410('0x2b')](function(){try{fs[_0x1410('0x2c')](_0x31522f);fs['chmodSync'](_0x2fc0c6,_0x1410('0x2d'));}catch(_0x316cc6){logger[_0x1410('0x15')](_0x316cc6);}return _0x2fc0c6[_0x1410('0x2e')]('.')[0x0];});}function base64Encode(_0x5baec1){var _0x22fc82=fs[_0x1410('0x2f')](_0x5baec1);return new Buffer(_0x22fc82)['toString'](_0x1410('0x30'));}exports[_0x1410('0x31')]=function(_0x4688a8,_0x13f6f3,_0x14a4bf,_0x3edc8b,_0x147f5e,_0x2fdd5e){var _0x2ce64c,_0x385895;var _0x4a45bb=_0x1410('0x32');var _0x2362ba=_0x1410('0x33')+_0x4688a8;var _0x2c7e98={};if(_0x13f6f3==='ssml'){_0x2c7e98['input']={'ssml':_0x14a4bf};}else{_0x2c7e98[_0x1410('0x34')]={'text':_0x14a4bf};};_0x2c7e98['voice']={'languageCode':_0x3edc8b,'ssmlGender':_0x147f5e};_0x2c7e98['audioConfig']={'audioEncoding':_0x1410('0x35'),'sampleRateHertz':0x1f40};var _0x41c066={'url':_0x4a45bb+_0x1410('0x36')+_0x2362ba,'method':_0x1410('0x37'),'json':!![],'body':_0x2c7e98};return rp(_0x41c066)[_0x1410('0x2b')](function(_0x4d3eaf){return new BPromise(function(_0x2ec074,_0x4ca375){_0x2ce64c=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs['generate'](0x4)+_0x1410('0x38'));var _0x1d5fb4=Buffer[_0x1410('0x39')](_0x4d3eaf[_0x1410('0x3a')],_0x1410('0x30'));return fs[_0x1410('0x3b')](_0x2ce64c,_0x1d5fb4,function(_0x3ef1fd){_0x4ca375(_0x3ef1fd);},function(_0x3404b6){fs[_0x1410('0x3c')](_0x2ce64c,_0x1410('0x2d'));_0x2ec074(_0x3404b6);});});})[_0x1410('0x2b')](function(_0xe4d50a){_0x385895=path[_0x1410('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x1410('0x3d'));return convertFile(_0x2ce64c,_0x385895);})[_0x1410('0x2b')](function(){try{fs[_0x1410('0x2c')](_0x2ce64c);fs[_0x1410('0x3c')](_0x385895,'777');}catch(_0x8eb24e){logger[_0x1410('0x15')](_0x8eb24e);}logger['info'](_0x1410('0x3e'),_0x385895[_0x1410('0x2e')]('.')[0x0]);return _0x385895['split']('.')[0x0];});};exports['googleTTS']=function(_0x1df6fa,_0x5b92c8){var _0x219bbb='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x2c9248,_0x57fbcb;var _0x19cda2;var _0x4b5c98={'encoding':_0x1410('0x3f'),'method':_0x1410('0x37'),'timeout':0x2710,'url':_0x219bbb,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x1410('0x40')]([[[_0x1410('0x41'),JSON['stringify']([_0x1df6fa,_0x5b92c8||'en',![],_0x1410('0x42')]),null,_0x1410('0x43')]]]))};return rp(_0x4b5c98)[_0x1410('0x2b')](function(_0x1e0293){try{_0x19cda2=eval(_0x1e0293[_0x1410('0x44')](0x5))[0x0][0x2];}catch(_0x292d88){throw new Error('parse\x20response\x20failed:\x0a'+_0x1e0293[_0x1410('0x22')]);}if(!_0x19cda2){if(_0x1df6fa['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x1410('0x45')+_0x5b92c8+_0x1410('0x46'));}}try{_0x19cda2=eval(_0x19cda2)[0x0];}catch(_0x1eacac){throw new Error(_0x1410('0x47')+res[_0x1410('0x22')]);}const _0x39064e=_0x19cda2;_0x2c9248=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+'.mp3');fs[_0x1410('0x2a')](_0x2c9248,_0x19cda2,{'encoding':'base64'});_0x57fbcb=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+_0x1410('0x3d'));return convertFile(_0x2c9248,_0x57fbcb);})[_0x1410('0x2b')](function(){try{fs[_0x1410('0x2c')](_0x2c9248);fs[_0x1410('0x3c')](_0x57fbcb,_0x1410('0x2d'));}catch(_0x19b0cd){logger[_0x1410('0x15')](_0x19b0cd);}logger[_0x1410('0x1a')](_0x1410('0x48'),_0x57fbcb['split']('.')[0x0]);return _0x57fbcb[_0x1410('0x2e')]('.')[0x0];});};exports[_0x1410('0x49')]=function(_0x291576,_0x5ac26e,_0x4e095b){return google[_0x1410('0x4a')](_0x291576,_0x5ac26e,_0x4e095b)[_0x1410('0x2b')](function(_0x25289c){logger[_0x1410('0x1a')](_0x25289c[_0x1410('0x4b')]);return rp(_0x25289c);})[_0x1410('0x2b')](function(_0x13c45e){var _0x14e946='';var _0x5db126=0x0;try{fs['unlink'](_0x291576);}catch(_0x324b72){logger['error'](_0x324b72);}if(_0x13c45e&&_0x13c45e['results']){_0x14e946=_0x13c45e[_0x1410('0x4c')][_0x1410('0x4d')](function(_0x33768a){return _0x33768a&&_0x33768a[_0x1410('0x4e')][0x0]&&_0x33768a[_0x1410('0x4e')][0x0][_0x1410('0x4f')]?_0x33768a[_0x1410('0x4e')][0x0][_0x1410('0x4f')]:'';})[_0x1410('0x50')]('\x0a');_0x5db126=_0x13c45e[_0x1410('0x4c')]['map'](function(_0x156531){return _0x156531&&_0x156531[_0x1410('0x4e')][0x0]&&_0x156531['alternatives'][0x0][_0x1410('0x51')]?_0x156531[_0x1410('0x4e')][0x0][_0x1410('0x51')]:0x0;})[_0x1410('0x50')]('\x0a');}logger[_0x1410('0x1a')](_0x1410('0x52'),_0x14e946);logger[_0x1410('0x1a')](_0x1410('0x53'),_0x5db126);return{'transcript':_0x14e946,'confidence':_0x5db126};})['catch'](function(_0x1d4249){logger[_0x1410('0x15')]('[%s]\x20%s:%s',_0x1d4249[_0x1410('0x14')],_0x1d4249[_0x1410('0x54')],_0x1d4249[_0x1410('0x55')]);});};exports[_0x1410('0x56')]=function(_0x551eb8,_0x46a843,_0x5babf9,_0x39d616){var _0x48f050=apiai(_0x46a843,{'language':_0x39d616||'en'});return _0x48f050[_0x1410('0x57')](_0x5babf9,{'sessionId':md5(_0x551eb8)})['then'](function(_0x5650be){logger[_0x1410('0x1a')](JSON[_0x1410('0x40')](_0x5650be));return{'source':_0x5650be[_0x1410('0x58')][_0x1410('0x59')],'resolvedQuery':_0x5650be[_0x1410('0x58')]['resolvedQuery'],'action':_0x5650be[_0x1410('0x58')][_0x1410('0x5a')],'actionIncomplete':_0x5650be[_0x1410('0x58')][_0x1410('0x5b')],'speech':_0x5650be[_0x1410('0x58')][_0x1410('0x5c')][_0x1410('0x5d')],'score':_0x5650be[_0x1410('0x58')][_0x1410('0x5e')],'statusCode':_0x5650be[_0x1410('0x5f')][_0x1410('0x60')],'endConversation':_0x5650be[_0x1410('0x58')]['metadata'][_0x1410('0x61')]||![],'isFallbackIntent':_0x5650be[_0x1410('0x58')][_0x1410('0x62')][_0x1410('0x63')]};});};exports['googleDialogflowV2']=function(_0x187430,_0x5d4481,_0x7745f1,_0x2e876d,_0x578280,_0x1d5c5d){var _0xd513e7=_0x2e876d[_0x1410('0x64')](/\\n/g,'\x0a');var _0x266b38={'credentials':{'private_key':_0xd513e7,'client_email':_0x7745f1}};var _0x15969a=new dialogflow[(_0x1410('0x65'))](_0x266b38);var _0x1080fd=_0x15969a[_0x1410('0x66')](_0x5d4481,md5(_0x187430));var _0x5a63d3={'session':_0x1080fd,'queryInput':{'text':{'text':_0x578280,'languageCode':_0x1d5c5d}}};return _0x15969a[_0x1410('0x67')](_0x5a63d3)['then'](function(_0x5880f4){if(_0x5880f4&&_0x5880f4[_0x1410('0x68')]){logger[_0x1410('0x1a')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x5880f4));var _0x1e787f=_0x5880f4[0x0];if(_0x1e787f){var _0x92d9d5={'action':_0x1e787f[_0x1410('0x69')][_0x1410('0x5a')],'allRequiredParamsPresent':_0x1e787f[_0x1410('0x69')][_0x1410('0x6a')],'endConversation':_0x1e787f[_0x1410('0x69')]['diagnosticInfo']&&_0x1e787f[_0x1410('0x69')][_0x1410('0x6b')]['fields']?_0x1e787f['queryResult'][_0x1410('0x6b')][_0x1410('0x6c')][_0x1410('0x6d')][_0x1410('0x6e')]:![],'fulfillmentText':_0x1e787f['queryResult'][_0x1410('0x6f')],'intentName':_0x1e787f[_0x1410('0x69')]['intent'][_0x1410('0x54')],'intentDisplayName':_0x1e787f['queryResult']['intent'][_0x1410('0x70')],'isFallbackIntent':_0x1e787f[_0x1410('0x69')][_0x1410('0x71')][_0x1410('0x72')],'languageCode':_0x1e787f['queryResult'][_0x1410('0x73')],'queryText':_0x1e787f[_0x1410('0x69')][_0x1410('0x74')],'responseId':_0x1e787f[_0x1410('0x75')],'score':_0x1e787f[_0x1410('0x69')][_0x1410('0x76')],'speech':_0x1e787f[_0x1410('0x69')][_0x1410('0x6f')],'providerResponse':JSON['stringify'](_0x5880f4)};return _0x92d9d5;}}});};exports[_0x1410('0x77')]=function(_0x18489c,_0x14e0e2,_0x10d7f7,_0x2e1d5b){return tilde['asr'](_0x18489c,_0x14e0e2,_0x10d7f7,_0x2e1d5b)[_0x1410('0x2b')](function(_0x25e24b){try{fs[_0x1410('0x2c')](_0x18489c);}catch(_0x4e833d){logger[_0x1410('0x15')](_0x4e833d);}logger[_0x1410('0x1a')](_0x1410('0x78'),_0x25e24b[_0x1410('0x4f')]);logger[_0x1410('0x1a')]('Tilde\x20ASR\x20confidence',_0x25e24b[_0x1410('0x51')]);return _0x25e24b;});};exports[_0x1410('0x79')]=function(_0x13388f,_0x395a91,_0x1ad7fc,_0xe74449,_0x98d3b4,_0x5a3c59){var _0x36e8e4=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+_0x1410('0x38'));var _0x5ade06;return aws[_0x1410('0x7a')](_0x13388f,_0x395a91,_0x1ad7fc,_0xe74449,_0x98d3b4,_0x5a3c59,_0x36e8e4)[_0x1410('0x2b')](function(){_0x5ade06=path[_0x1410('0x27')](__dirname,'tmp',rs[_0x1410('0x29')](0x4)+_0x1410('0x3d'));return convertFile(_0x36e8e4,_0x5ade06);})[_0x1410('0x2b')](function(){try{fs[_0x1410('0x2c')](_0x36e8e4);fs[_0x1410('0x3c')](_0x5ade06,_0x1410('0x2d'));}catch(_0x40c836){logger[_0x1410('0x15')](_0x40c836);}return _0x5ade06[_0x1410('0x2e')]('.')[0x0];});};exports[_0x1410('0x7b')]=function(_0x57d5db,_0x53cc79,_0x1b152c,_0x47600f,_0x3a7c29,_0x3d5a37){return aws[_0x1410('0x7c')](_0x57d5db,_0x53cc79,_0x1b152c,_0x47600f,_0x3a7c29,_0x3d5a37)[_0x1410('0x2b')](function(_0x524c7f){logger[_0x1410('0x1a')](JSON[_0x1410('0x40')](_0x524c7f));return _0x524c7f;});};exports[_0x1410('0x7d')]=function(_0x1b6f84,_0x2651e1,_0x1f2078,_0x65cddb){var _0x204fe2=util[_0x1410('0x7e')](_0x1410('0x7f'),ISPEECH_API,_0x1b6f84,encodeURIComponent(_0x2651e1),_0x1f2078,_0x65cddb);var _0x2161b3=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+'.mp3');var _0x20ceb0;return downloadFile(_0x204fe2,_0x2161b3)[_0x1410('0x2b')](function(){_0x20ceb0=path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs['generate'](0x4)+_0x1410('0x3d'));return convertFile(_0x2161b3,_0x20ceb0);})['then'](function(){try{fs[_0x1410('0x2c')](_0x2161b3);fs[_0x1410('0x3c')](_0x20ceb0,_0x1410('0x2d'));}catch(_0x78b12c){logger[_0x1410('0x15')](_0x78b12c);}return _0x20ceb0[_0x1410('0x2e')]('.')[0x0];});};exports[_0x1410('0x80')]=function(_0x394f73,_0x1084c1,_0xad68e3,_0x511d9c){var _0x58fc49=util[_0x1410('0x7e')](_0x1410('0x81'),ISPEECH_API,_0x1084c1,_0xad68e3,base64Encode(_0x394f73),_0x511d9c?util[_0x1410('0x7e')](_0x1410('0x82'),encodeURIComponent(_0x511d9c)):'freeform=3');return uploadFile(_0x58fc49)[_0x1410('0x2b')](function(_0x3ef1ba){return querystring[_0x1410('0x83')](_0x3ef1ba);});};exports[_0x1410('0x84')]=function(_0x1b78c5,_0x440c19){return sestek[_0x1410('0x85')](_0x1b78c5,_0x440c19)[_0x1410('0x2b')](function(_0x240574){logger[_0x1410('0x1a')](JSON['stringify'](_0x240574));var _0x454312={'speech':_0x240574[_0x1410('0x86')],'action':_0x240574[_0x1410('0x87')]?_0x240574[_0x1410('0x87')]['CustomAction']:undefined,'actiondata':_0x240574['channelData']?_0x240574[_0x1410('0x87')][_0x1410('0x88')]:undefined};if(_0x240574[_0x1410('0x87')]&&_0x240574[_0x1410('0x87')][_0x1410('0x89')]){return base64Decode(_0x240574[_0x1410('0x87')][_0x1410('0x89')][_0x1410('0x8a')],path[_0x1410('0x27')](__dirname,_0x1410('0x28'),rs[_0x1410('0x29')](0x4)+_0x1410('0x3d')))[_0x1410('0x2b')](function(_0x14e581){_0x454312[_0x1410('0x8b')]=_0x14e581;return _0x454312;});}return _0x454312;});};exports[_0x1410('0x8c')]=function(){return __dirname;}; \ No newline at end of file +var _0xab88=['resolve','generate','.wav','base64','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','then','tmp','.mp3','from','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','data','length','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','WHAT_EVER','get','transcode','wav','error\x20convert','finish\x20to\x20convert'];(function(_0x595cb9,_0x47db3a){var _0x316de8=function(_0x992fe2){while(--_0x992fe2){_0x595cb9['push'](_0x595cb9['shift']());}};_0x316de8(++_0x47db3a);}(_0xab88,0xe7));var _0x8ab8=function(_0x486b00,_0x501df5){_0x486b00=_0x486b00-0x0;var _0x47ea82=_0xab88[_0x486b00];return _0x47ea82;};'use strict';var apiai=require(_0x8ab8('0x0'));var BPromise=require(_0x8ab8('0x1'));var dialogflow=require(_0x8ab8('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x8ab8('0x3'));var md5=require(_0x8ab8('0x4'));var path=require(_0x8ab8('0x5'));var querystring=require(_0x8ab8('0x6'));var rp=require(_0x8ab8('0x7'));var rs=require(_0x8ab8('0x8'));var sox=require(_0x8ab8('0x9'));var tts=require(_0x8ab8('0xa'));var urlParse=require(_0x8ab8('0xb'))['parse'];var util=require(_0x8ab8('0xc'));var aws=require(_0x8ab8('0xd'));var google=require(_0x8ab8('0xe'));var sestek=require(_0x8ab8('0xf'));var tilde=require('./tilde');var logger=require(_0x8ab8('0x10'))(_0x8ab8('0x11'));var ISPEECH_API=_0x8ab8('0x12');function downloadFile(_0x5cb17a,_0x9de90e){return new BPromise(function(_0x45986a,_0x2c7a2b){var _0x34cbc8=urlParse(_0x5cb17a);var _0x560165=_0x34cbc8[_0x8ab8('0x13')]===_0x8ab8('0x14')?https:http;var _0x3fccfc={'host':_0x34cbc8['host'],'path':_0x34cbc8[_0x8ab8('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x560165['get'](_0x3fccfc,function(_0x1027b9){if(_0x1027b9[_0x8ab8('0x15')]!==0xc8){logger[_0x8ab8('0x16')]('request\x20to\x20'+_0x5cb17a+_0x8ab8('0x17')+_0x1027b9[_0x8ab8('0x15')]+'\x20('+_0x1027b9[_0x8ab8('0x18')]+')');_0x2c7a2b(new Error(_0x8ab8('0x19')+_0x5cb17a+_0x8ab8('0x17')+_0x1027b9[_0x8ab8('0x15')]+'\x20('+_0x1027b9[_0x8ab8('0x18')]+')'));return;}var _0x640b53=fs[_0x8ab8('0x1a')](_0x9de90e);_0x640b53['on']('finish',function(){logger[_0x8ab8('0x1b')](_0x8ab8('0x1c'));_0x640b53[_0x8ab8('0x1d')](_0x45986a);});_0x640b53['on']('error',function(_0x168f99){fs[_0x8ab8('0x1e')](_0x9de90e);logger[_0x8ab8('0x16')](_0x8ab8('0x1f'),_0x168f99);_0x2c7a2b(_0x168f99);});_0x1027b9[_0x8ab8('0x20')](_0x640b53);})['on'](_0x8ab8('0x16'),function(_0x87cc0){logger[_0x8ab8('0x16')](_0x87cc0);_0x2c7a2b(_0x87cc0);})[_0x8ab8('0x21')]();});}function uploadFile(_0xb97913){return new BPromise(function(_0x4d1904,_0x155753){var _0x48f83f=urlParse(_0xb97913);var _0x2b08b9=_0x48f83f[_0x8ab8('0x13')]==='https:'?https:http;var _0x15661d={'host':_0x48f83f[_0x8ab8('0x22')],'path':_0x48f83f['path'],'headers':{'user-agent':_0x8ab8('0x23')}};_0x2b08b9[_0x8ab8('0x24')](_0x15661d,function(_0x164091){if(_0x164091[_0x8ab8('0x15')]!==0xc8){_0x155753(new Error('request\x20to\x20'+_0xb97913+'\x20failed,\x20status\x20code\x20=\x20'+_0x164091[_0x8ab8('0x15')]+'\x20('+_0x164091[_0x8ab8('0x18')]+')'));return;}var _0x1922d7='';_0x164091['on']('data',function(_0xa0200a){_0x1922d7+=_0xa0200a;});_0x164091['on'](_0x8ab8('0x21'),function(){_0x4d1904(_0x1922d7);});})['on'](_0x8ab8('0x16'),function(_0x56cbb6){_0x155753(_0x56cbb6);})['end']();});}function convertFile(_0x22e434,_0x5677a9){return new BPromise(function(_0x430493,_0x4f2df5){var _0x6a22cf=sox[_0x8ab8('0x25')](_0x22e434,_0x5677a9,{'sampleRate':0x1f40,'format':_0x8ab8('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6a22cf['on'](_0x8ab8('0x16'),function(_0x3b0a67){logger[_0x8ab8('0x16')](_0x8ab8('0x27'),_0x3b0a67);_0x4f2df5(_0x3b0a67);});_0x6a22cf['on'](_0x8ab8('0x21'),function(){logger[_0x8ab8('0x1b')](_0x8ab8('0x28'));_0x430493();});_0x6a22cf['start']();});}function base64Decode(_0x180d57,_0x454b3b){var _0x1c4ace=path[_0x8ab8('0x29')](__dirname,'tmp',rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x2b'));fs['writeFileSync'](_0x1c4ace,_0x180d57,_0x8ab8('0x2c'));return convertFile(_0x1c4ace,_0x454b3b)['then'](function(){try{fs[_0x8ab8('0x1e')](_0x1c4ace);fs[_0x8ab8('0x2d')](_0x454b3b,_0x8ab8('0x2e'));}catch(_0x5ab186){logger['error'](_0x5ab186);}return _0x454b3b[_0x8ab8('0x2f')]('.')[0x0];});}function base64Encode(_0xf13fa0){var _0x17ca8c=fs[_0x8ab8('0x30')](_0xf13fa0);return new Buffer(_0x17ca8c)['toString'](_0x8ab8('0x2c'));}exports[_0x8ab8('0x31')]=function(_0x3f3837,_0x4e175c,_0x5a82bc,_0x51c195,_0x145b37,_0x568448){var _0x16d9ff,_0x4c01d4;var _0xf0561c=_0x8ab8('0x32');var _0x4d9008=_0x8ab8('0x33')+_0x3f3837;var _0x19e6ed={};if(_0x4e175c==='ssml'){_0x19e6ed[_0x8ab8('0x34')]={'ssml':_0x5a82bc};}else{_0x19e6ed['input']={'text':_0x5a82bc};};_0x19e6ed[_0x8ab8('0x35')]={'languageCode':_0x51c195,'ssmlGender':_0x145b37};_0x19e6ed['audioConfig']={'audioEncoding':_0x8ab8('0x36'),'sampleRateHertz':0x1f40};var _0x23988a={'url':_0xf0561c+_0x8ab8('0x37')+_0x4d9008,'method':'POST','json':!![],'body':_0x19e6ed};return rp(_0x23988a)[_0x8ab8('0x38')](function(_0x59ea57){return new BPromise(function(_0x1dac10,_0x202293){_0x16d9ff=path['resolve'](__dirname,_0x8ab8('0x39'),rs['generate'](0x4)+_0x8ab8('0x3a'));var _0x5a2dd5=Buffer[_0x8ab8('0x3b')](_0x59ea57['audioContent'],_0x8ab8('0x2c'));return fs[_0x8ab8('0x3c')](_0x16d9ff,_0x5a2dd5,function(_0x1e1629){_0x202293(_0x1e1629);},function(_0x23b955){fs[_0x8ab8('0x2d')](_0x16d9ff,'777');_0x1dac10(_0x23b955);});});})[_0x8ab8('0x38')](function(_0x5e7b96){_0x4c01d4=path[_0x8ab8('0x29')](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x2b'));return convertFile(_0x16d9ff,_0x4c01d4);})[_0x8ab8('0x38')](function(){try{fs[_0x8ab8('0x1e')](_0x16d9ff);fs[_0x8ab8('0x2d')](_0x4c01d4,'777');}catch(_0x3b1c52){logger[_0x8ab8('0x16')](_0x3b1c52);}logger['info'](_0x8ab8('0x3d'),_0x4c01d4[_0x8ab8('0x2f')]('.')[0x0]);return _0x4c01d4[_0x8ab8('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x3a3cef,_0xbd9584){var _0x4e7035=_0x8ab8('0x3e');var _0x21a608,_0x4fa27e;var _0x41d0af;var _0x269ec1={'encoding':_0x8ab8('0x3f'),'method':'POST','timeout':0x2710,'url':_0x4e7035,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x8ab8('0x40')]([[[_0x8ab8('0x41'),JSON[_0x8ab8('0x40')]([_0x3a3cef,_0xbd9584||'en',![],_0x8ab8('0x42')]),null,'generic']]]))};return rp(_0x269ec1)[_0x8ab8('0x38')](function(_0x5da8f5){try{_0x41d0af=eval(_0x5da8f5[_0x8ab8('0x43')](0x5))[0x0][0x2];}catch(_0xf8de20){throw new Error(_0x8ab8('0x44')+_0x5da8f5[_0x8ab8('0x45')]);}if(!_0x41d0af){if(_0x3a3cef[_0x8ab8('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0xbd9584+_0x8ab8('0x47'));}}try{_0x41d0af=eval(_0x41d0af)[0x0];}catch(_0x447a92){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8ab8('0x45')]);}const _0x12fdce=_0x41d0af;_0x21a608=path[_0x8ab8('0x29')](__dirname,'tmp',rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x3a'));fs[_0x8ab8('0x48')](_0x21a608,_0x41d0af,{'encoding':'base64'});_0x4fa27e=path[_0x8ab8('0x29')](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x2b'));return convertFile(_0x21a608,_0x4fa27e);})['then'](function(){try{fs['unlink'](_0x21a608);fs['chmodSync'](_0x4fa27e,_0x8ab8('0x2e'));}catch(_0xaeeeb8){logger[_0x8ab8('0x16')](_0xaeeeb8);}logger[_0x8ab8('0x1b')](_0x8ab8('0x49'),_0x4fa27e[_0x8ab8('0x2f')]('.')[0x0]);return _0x4fa27e[_0x8ab8('0x2f')]('.')[0x0];});};exports[_0x8ab8('0x4a')]=function(_0x52c66f,_0x2dd0d1,_0x4c97d9){return google[_0x8ab8('0x4b')](_0x52c66f,_0x2dd0d1,_0x4c97d9)[_0x8ab8('0x38')](function(_0x272315){logger['info'](_0x272315[_0x8ab8('0x4c')]);return rp(_0x272315);})[_0x8ab8('0x38')](function(_0x2ae105){var _0x6da5b4='';var _0x4a778b=0x0;try{fs[_0x8ab8('0x1e')](_0x52c66f);}catch(_0x2df900){logger[_0x8ab8('0x16')](_0x2df900);}if(_0x2ae105&&_0x2ae105[_0x8ab8('0x4d')]){_0x6da5b4=_0x2ae105[_0x8ab8('0x4d')]['map'](function(_0x18ad35){return _0x18ad35&&_0x18ad35[_0x8ab8('0x4e')][0x0]&&_0x18ad35[_0x8ab8('0x4e')][0x0][_0x8ab8('0x4f')]?_0x18ad35[_0x8ab8('0x4e')][0x0][_0x8ab8('0x4f')]:'';})[_0x8ab8('0x50')]('\x0a');_0x4a778b=_0x2ae105[_0x8ab8('0x4d')][_0x8ab8('0x51')](function(_0x4f1289){return _0x4f1289&&_0x4f1289[_0x8ab8('0x4e')][0x0]&&_0x4f1289[_0x8ab8('0x4e')][0x0]['confidence']?_0x4f1289['alternatives'][0x0][_0x8ab8('0x52')]:0x0;})[_0x8ab8('0x50')]('\x0a');}logger['info'](_0x8ab8('0x53'),_0x6da5b4);logger['info'](_0x8ab8('0x54'),_0x4a778b);return{'transcript':_0x6da5b4,'confidence':_0x4a778b};})[_0x8ab8('0x55')](function(_0x7fa5e5){logger[_0x8ab8('0x16')](_0x8ab8('0x56'),_0x7fa5e5[_0x8ab8('0x15')],_0x7fa5e5['name'],_0x7fa5e5[_0x8ab8('0x57')]);});};exports[_0x8ab8('0x58')]=function(_0x307d4c,_0x2b941b,_0x4aa388,_0x105d9e){var _0x1cb4da=apiai(_0x2b941b,{'language':_0x105d9e||'en'});return _0x1cb4da[_0x8ab8('0x59')](_0x4aa388,{'sessionId':md5(_0x307d4c)})[_0x8ab8('0x38')](function(_0x525e94){logger[_0x8ab8('0x1b')](JSON['stringify'](_0x525e94));return{'source':_0x525e94[_0x8ab8('0x5a')][_0x8ab8('0x5b')],'resolvedQuery':_0x525e94['result'][_0x8ab8('0x5c')],'action':_0x525e94[_0x8ab8('0x5a')]['action'],'actionIncomplete':_0x525e94['result'][_0x8ab8('0x5d')],'speech':_0x525e94[_0x8ab8('0x5a')][_0x8ab8('0x5e')]['speech'],'score':_0x525e94['result'][_0x8ab8('0x5f')],'statusCode':_0x525e94[_0x8ab8('0x60')][_0x8ab8('0x61')],'endConversation':_0x525e94[_0x8ab8('0x5a')]['metadata'][_0x8ab8('0x62')]||![],'isFallbackIntent':_0x525e94[_0x8ab8('0x5a')]['metadata'][_0x8ab8('0x63')]};});};exports[_0x8ab8('0x64')]=function(_0x2f10dd,_0x571f44,_0xc1fc8b,_0xa505cf,_0x3dead9,_0x4f483d){var _0x5e7de1=_0xa505cf[_0x8ab8('0x65')](/\\n/g,'\x0a');var _0x109dbf={'credentials':{'private_key':_0x5e7de1,'client_email':_0xc1fc8b}};var _0x5b4b90=new dialogflow['SessionsClient'](_0x109dbf);var _0x3b365f=_0x5b4b90[_0x8ab8('0x66')](_0x571f44,md5(_0x2f10dd));var _0x3af7b4={'session':_0x3b365f,'queryInput':{'text':{'text':_0x3dead9,'languageCode':_0x4f483d}}};return _0x5b4b90[_0x8ab8('0x67')](_0x3af7b4)[_0x8ab8('0x38')](function(_0x4f43aa){if(_0x4f43aa&&_0x4f43aa[_0x8ab8('0x46')]){logger[_0x8ab8('0x1b')](_0x8ab8('0x68'),JSON[_0x8ab8('0x40')](_0x4f43aa));var _0x41bd58=_0x4f43aa[0x0];if(_0x41bd58){var _0x47e577={'action':_0x41bd58['queryResult'][_0x8ab8('0x69')],'allRequiredParamsPresent':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x6b')],'endConversation':_0x41bd58['queryResult'][_0x8ab8('0x6c')]&&_0x41bd58[_0x8ab8('0x6a')]['diagnosticInfo'][_0x8ab8('0x6d')]?_0x41bd58['queryResult'][_0x8ab8('0x6c')][_0x8ab8('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x6e')],'intentName':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x6f')]['name'],'intentDisplayName':_0x41bd58[_0x8ab8('0x6a')]['intent'][_0x8ab8('0x70')],'isFallbackIntent':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x6f')]['isFallback'],'languageCode':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x71')],'queryText':_0x41bd58['queryResult'][_0x8ab8('0x72')],'responseId':_0x41bd58[_0x8ab8('0x73')],'score':_0x41bd58[_0x8ab8('0x6a')][_0x8ab8('0x74')],'speech':_0x41bd58['queryResult'][_0x8ab8('0x6e')],'providerResponse':JSON[_0x8ab8('0x40')](_0x4f43aa)};return _0x47e577;}}});};exports[_0x8ab8('0x75')]=function(_0x362d81,_0x416116,_0x48ee0e,_0x14a0e4){return tilde['asr'](_0x362d81,_0x416116,_0x48ee0e,_0x14a0e4)[_0x8ab8('0x38')](function(_0x48842b){try{fs[_0x8ab8('0x1e')](_0x362d81);}catch(_0x505472){logger[_0x8ab8('0x16')](_0x505472);}logger[_0x8ab8('0x1b')](_0x8ab8('0x76'),_0x48842b[_0x8ab8('0x4f')]);logger['info'](_0x8ab8('0x77'),_0x48842b[_0x8ab8('0x52')]);return _0x48842b;});};exports[_0x8ab8('0x78')]=function(_0x5f0725,_0x6ea0e7,_0x23cf10,_0x2e76d2,_0x27b2c6,_0xfd72d2){var _0x402cbc=path['resolve'](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x3a'));var _0x2f6f37;return aws[_0x8ab8('0x79')](_0x5f0725,_0x6ea0e7,_0x23cf10,_0x2e76d2,_0x27b2c6,_0xfd72d2,_0x402cbc)['then'](function(){_0x2f6f37=path[_0x8ab8('0x29')](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+'.wav');return convertFile(_0x402cbc,_0x2f6f37);})[_0x8ab8('0x38')](function(){try{fs[_0x8ab8('0x1e')](_0x402cbc);fs[_0x8ab8('0x2d')](_0x2f6f37,_0x8ab8('0x2e'));}catch(_0x458304){logger['error'](_0x458304);}return _0x2f6f37[_0x8ab8('0x2f')]('.')[0x0];});};exports[_0x8ab8('0x7a')]=function(_0x5b8262,_0x24e4b7,_0x5429e9,_0x2adc5a,_0x14169b,_0xc1662c){return aws[_0x8ab8('0x7b')](_0x5b8262,_0x24e4b7,_0x5429e9,_0x2adc5a,_0x14169b,_0xc1662c)['then'](function(_0x24b261){logger[_0x8ab8('0x1b')](JSON[_0x8ab8('0x40')](_0x24b261));return _0x24b261;});};exports[_0x8ab8('0x7c')]=function(_0x4627af,_0x48b8c1,_0x123353,_0x343f89){var _0x5f441a=util[_0x8ab8('0x7d')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4627af,encodeURIComponent(_0x48b8c1),_0x123353,_0x343f89);var _0xcc2a4=path['resolve'](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+_0x8ab8('0x3a'));var _0x297fae;return downloadFile(_0x5f441a,_0xcc2a4)['then'](function(){_0x297fae=path[_0x8ab8('0x29')](__dirname,_0x8ab8('0x39'),rs[_0x8ab8('0x2a')](0x4)+'.wav');return convertFile(_0xcc2a4,_0x297fae);})[_0x8ab8('0x38')](function(){try{fs[_0x8ab8('0x1e')](_0xcc2a4);fs[_0x8ab8('0x2d')](_0x297fae,'777');}catch(_0x2db03b){logger[_0x8ab8('0x16')](_0x2db03b);}return _0x297fae[_0x8ab8('0x2f')]('.')[0x0];});};exports[_0x8ab8('0x7e')]=function(_0x4f87e1,_0xd074ff,_0x112f15,_0x3b2df4){var _0x5d4a06=util[_0x8ab8('0x7d')](_0x8ab8('0x7f'),ISPEECH_API,_0xd074ff,_0x112f15,base64Encode(_0x4f87e1),_0x3b2df4?util[_0x8ab8('0x7d')](_0x8ab8('0x80'),encodeURIComponent(_0x3b2df4)):_0x8ab8('0x81'));return uploadFile(_0x5d4a06)[_0x8ab8('0x38')](function(_0xb48648){return querystring['parse'](_0xb48648);});};exports[_0x8ab8('0x82')]=function(_0x59a9aa,_0x39ada8){return sestek['nda'](_0x59a9aa,_0x39ada8)['then'](function(_0x41a6b1){logger[_0x8ab8('0x1b')](JSON['stringify'](_0x41a6b1));var _0x30bdb7={'speech':_0x41a6b1[_0x8ab8('0x83')],'action':_0x41a6b1['channelData']?_0x41a6b1[_0x8ab8('0x84')]['CustomAction']:undefined,'actiondata':_0x41a6b1[_0x8ab8('0x84')]?_0x41a6b1[_0x8ab8('0x84')][_0x8ab8('0x85')]:undefined};if(_0x41a6b1[_0x8ab8('0x84')]&&_0x41a6b1[_0x8ab8('0x84')]['AudioFromTts']){return base64Decode(_0x41a6b1['channelData'][_0x8ab8('0x86')]['Data'],path[_0x8ab8('0x29')](__dirname,_0x8ab8('0x39'),rs['generate'](0x4)+'.wav'))[_0x8ab8('0x38')](function(_0x5dea96){_0x30bdb7[_0x8ab8('0x87')]=_0x5dea96;return _0x30bdb7;});}return _0x30bdb7;});};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 d22b91d..01ccd2f 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 _0x293b=['./nda','exports'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x293b,0xa4));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};var nda=require(_0xb293('0x0'));module[_0xb293('0x1')]={'nda':nda}; \ No newline at end of file +var _0x4e14=['exports'];(function(_0x1b9a9f,_0x482c35){var _0x2552fd=function(_0x48839e){while(--_0x48839e){_0x1b9a9f['push'](_0x1b9a9f['shift']());}};_0x2552fd(++_0x482c35);}(_0x4e14,0x1f4));var _0x44e1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4e14[_0x29d94e];return _0x106237;};var nda=require('./nda');module[_0x44e1('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 6c957a3..a57c297 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 _0x2841=['ProjectName','project','AudioOutputSettings','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0x2841,0xe8));var _0x1284=function(_0x2c1e7a,_0x155f86){_0x2c1e7a=_0x2c1e7a-0x0;var _0xcacb4f=_0x2841[_0x2c1e7a];return _0xcacb4f;};'use strict';var rp=require(_0x1284('0x0'));var url=require(_0x1284('0x1'));var logger=require(_0x1284('0x2'))(_0x1284('0x3'));module['exports']=function(_0x31ee37,_0x51323a){var _0x57c69c={'method':_0x1284('0x4'),'uri':url[_0x1284('0x5')](_0x51323a[_0x1284('0x6')],_0x1284('0x7')),'form':{'grant_type':_0x1284('0x8'),'username':_0x51323a[_0x1284('0x9')],'password':_0x51323a[_0x1284('0x8')]},'json':!![]};return rp(_0x57c69c)[_0x1284('0xa')](function(_0x5378a3){var _0x14084d={'method':_0x1284('0x4'),'uri':url[_0x1284('0x5')](_0x51323a[_0x1284('0xb')],_0x1284('0xc')),'body':{'type':_0x51323a[_0x1284('0xd')]||'message','channelId':_0x1284('0xe'),'conversation':{'id':_0x31ee37['uniqueid']},'from':{'id':_0x31ee37[_0x1284('0xf')],'name':_0x31ee37[_0x1284('0x10')]},'recipient':{'id':_0x31ee37[_0x1284('0x11')],'name':_0x31ee37[_0x1284('0x12')]},'text':_0x51323a[_0x1284('0x13')],'channelData':{}},'headers':{'Authorization':_0x1284('0x14')+_0x5378a3[_0x1284('0x15')]},'json':!![]};if(_0x51323a['project']){_0x14084d[_0x1284('0x16')][_0x1284('0x17')][_0x1284('0x18')]=_0x51323a[_0x1284('0x19')];}if(_0x51323a['ndagenerate_audio']=='1'){_0x14084d['body']['channelData'][_0x1284('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x51323a[_0x1284('0x1b')]){_0x14084d[_0x1284('0x16')][_0x1284('0x17')]['CustomAction']=_0x51323a['custom_action'];if(_0x51323a['custom_action_data']){_0x14084d[_0x1284('0x16')][_0x1284('0x17')][_0x1284('0x1c')]=_0x51323a[_0x1284('0x1d')];}}logger[_0x1284('0x1e')](JSON[_0x1284('0x1f')](_0x14084d));return rp(_0x14084d);});}; \ No newline at end of file +var _0xf7d3=['text','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','request-promise','url','agi','exports','password','username','then','POST','resolve','ndassistant_url','message','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x297220,_0x49bec5){var _0x532a3e=function(_0x117fd2){while(--_0x117fd2){_0x297220['push'](_0x297220['shift']());}};_0x532a3e(++_0x49bec5);}(_0xf7d3,0x1f1));var _0x3f7d=function(_0x4e9998,_0xf24fb){_0x4e9998=_0x4e9998-0x0;var _0xa515d6=_0xf7d3[_0x4e9998];return _0xa515d6;};'use strict';var rp=require(_0x3f7d('0x0'));var url=require(_0x3f7d('0x1'));var logger=require('../../../../../config/logger')(_0x3f7d('0x2'));module[_0x3f7d('0x3')]=function(_0x407b64,_0x4abd7b){var _0x28a532={'method':'POST','uri':url['resolve'](_0x4abd7b['ndauth_url'],'/token'),'form':{'grant_type':_0x3f7d('0x4'),'username':_0x4abd7b[_0x3f7d('0x5')],'password':_0x4abd7b[_0x3f7d('0x4')]},'json':!![]};return rp(_0x28a532)[_0x3f7d('0x6')](function(_0x2f802f){var _0x68cd87={'method':_0x3f7d('0x7'),'uri':url[_0x3f7d('0x8')](_0x4abd7b[_0x3f7d('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4abd7b['ndaactivity_type']||_0x3f7d('0xa'),'channelId':'Nda','conversation':{'id':_0x407b64[_0x3f7d('0xb')]},'from':{'id':_0x407b64[_0x3f7d('0xc')],'name':_0x407b64[_0x3f7d('0xd')]},'recipient':{'id':_0x407b64[_0x3f7d('0xe')],'name':_0x407b64[_0x3f7d('0xf')]},'text':_0x4abd7b[_0x3f7d('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2f802f['access_token']},'json':!![]};if(_0x4abd7b['project']){_0x68cd87[_0x3f7d('0x11')][_0x3f7d('0x12')][_0x3f7d('0x13')]=_0x4abd7b[_0x3f7d('0x14')];}if(_0x4abd7b['ndagenerate_audio']=='1'){_0x68cd87[_0x3f7d('0x11')][_0x3f7d('0x12')][_0x3f7d('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3f7d('0x16')};}if(_0x4abd7b[_0x3f7d('0x17')]){_0x68cd87['body']['channelData'][_0x3f7d('0x18')]=_0x4abd7b[_0x3f7d('0x17')];if(_0x4abd7b['custom_action_data']){_0x68cd87[_0x3f7d('0x11')][_0x3f7d('0x12')]['CustomActionData']=_0x4abd7b[_0x3f7d('0x19')];}}logger[_0x3f7d('0x1a')](JSON['stringify'](_0x68cd87));return rp(_0x68cd87);});}; \ 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 e32b309..998e690 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 _0x0229=['./lib/api','exports'];(function(_0x53abb9,_0xbf0a2a){var _0x3f5d5b=function(_0x11e618){while(--_0x11e618){_0x53abb9['push'](_0x53abb9['shift']());}};_0x3f5d5b(++_0xbf0a2a);}(_0x0229,0x1b2));var _0x9022=function(_0x54eb5b,_0x2950b3){_0x54eb5b=_0x54eb5b-0x0;var _0x166e76=_0x0229[_0x54eb5b];return _0x166e76;};'use strict';var asr=require(_0x9022('0x0'));module[_0x9022('0x1')]=function(_0x179ea5,_0x163fed,_0x101d89,_0x2a38d0){return asr(_0x179ea5,_0x163fed,_0x101d89,_0x2a38d0);}; \ No newline at end of file +var _0xf332=['./lib/api','exports'];(function(_0xacb9c8,_0x36ea2a){var _0x59f715=function(_0x36d39f){while(--_0x36d39f){_0xacb9c8['push'](_0xacb9c8['shift']());}};_0x59f715(++_0x36ea2a);}(_0xf332,0x1b6));var _0x2f33=function(_0x2bd00d,_0x151ef5){_0x2bd00d=_0x2bd00d-0x0;var _0x1f7f5f=_0xf332[_0x2bd00d];return _0x1f7f5f;};'use strict';var asr=require(_0x2f33('0x0'));module[_0x2f33('0x1')]=function(_0xaf3b18,_0x287d62,_0x4d0e2c,_0x159e27){return asr(_0xaf3b18,_0x287d62,_0x4d0e2c,_0x159e27);}; \ 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 e18c65e..6b7ecbf 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 _0x21a5=['Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','close','bluebird','crypto','../../../../../../config/logger','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','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.'];(function(_0x1e65ae,_0x5ee276){var _0x59ef7c=function(_0xc3f648){while(--_0xc3f648){_0x1e65ae['push'](_0x1e65ae['shift']());}};_0x59ef7c(++_0x5ee276);}(_0x21a5,0x16e));var _0x521a=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x21a5[_0x1d39f6];return _0x3dbd7a;};'use strict';var BPromise=require(_0x521a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x521a('0x1'));var logger=require(_0x521a('0x2'))('agi');module['exports']=function(_0x2a397b,_0x19897d,_0x418815,_0x1a213f){return new BPromise(function(_0x369671,_0x5d459f){logger[_0x521a('0x3')]('Tilde\x20URI',_0x1a213f||_0x521a('0x4'));var _0x3c0748=new WebSocket(_0x1a213f||_0x521a('0x4'),{'perMessageDeflate':![]});var _0x56c659='';var _0x233d3f='0';var _0x152b3d='1';var _0x4ee8f9=_0x521a('0x5');function _0x4b779c(_0x44f2f5){var _0xaf519b=crypto[_0x521a('0x6')]('sha1');_0xaf519b[_0x521a('0x7')](_0x44f2f5);return _0xaf519b[_0x521a('0x8')](_0x521a('0x9'));}function _0x1b20bf(){try{logger[_0x521a('0x3')](_0x521a('0xa'));var _0x17a096=moment()[_0x521a('0xb')]();var _0x4db028=_0x4b779c(_0x17a096+_0x19897d+_0x418815);_0x3c0748[_0x521a('0xc')](JSON[_0x521a('0xd')]({'appID':_0x19897d,'timestamp':_0x17a096,'appKey':_0x4db028}));var _0x5427e3=fs[_0x521a('0xe')](_0x2a397b);_0x5427e3['on'](_0x521a('0xf'),function(_0x336238){_0x3c0748['send'](_0x336238);});_0x5427e3['on']('close',function(){_0x3c0748[_0x521a('0xc')]('EOS');});}catch(_0x363bb9){logger[_0x521a('0x10')](_0x521a('0x11'),JSON[_0x521a('0xd')](_0x363bb9));_0x3c0748[_0x521a('0x12')]();}}function _0x583877(_0x24c845){try{if(_0x24c845){var _0x2ac934=JSON[_0x521a('0x13')](_0x24c845);switch(_0x2ac934[_0x521a('0x14')]){case 0x0:if(_0x2ac934['result']){if(_0x2ac934[_0x521a('0x15')][_0x521a('0x16')]){logger[_0x521a('0x3')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2ac934[_0x521a('0x15')][_0x521a('0x17')]));_0x56c659=_0x2ac934[_0x521a('0x15')]['hypotheses'][0x0]['transcript'];_0x233d3f=_0x2ac934['result'][_0x521a('0x17')][0x0][_0x521a('0x18')];_0x152b3d='0';_0x4ee8f9=_0x521a('0x19');_0x3c0748['terminate']();}}break;case 0x1:logger['info'](_0x521a('0x5'));_0x152b3d='1';_0x4ee8f9=_0x521a('0x5');break;case 0x2:logger[_0x521a('0x3')](_0x521a('0x1a'));_0x152b3d='2';_0x4ee8f9=_0x521a('0x1a');break;case 0x9:logger[_0x521a('0x3')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x152b3d='9';_0x4ee8f9=_0x521a('0x1b');break;case 0xa:logger[_0x521a('0x3')](_0x521a('0x1c'));_0x152b3d='10';_0x4ee8f9=_0x521a('0x1c');break;case 0xb:logger[_0x521a('0x3')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x152b3d='11';_0x4ee8f9=_0x521a('0x1d');}}}catch(_0x2c5cb6){logger['error'](_0x521a('0x1e'),JSON['stringify'](_0x2c5cb6));_0x3c0748[_0x521a('0x12')]();}}function _0x2923c4(){logger[_0x521a('0x3')](_0x521a('0x1f'));_0x369671({'transcript':_0x56c659,'confidence':_0x233d3f,'status':_0x152b3d,'status_message':_0x4ee8f9});}function _0x460941(_0x2d4e62){logger['error'](_0x521a('0x20'));if(!_[_0x521a('0x21')](_0x2d4e62)){logger[_0x521a('0x10')](_['isObject'](_0x2d4e62)?JSON['stringify'](_0x2d4e62):_0x2d4e62);}}_0x3c0748['on'](_0x521a('0x22'),_0x1b20bf);_0x3c0748['on']('message',_0x583877);_0x3c0748['on'](_0x521a('0x23'),_0x2923c4);_0x3c0748['on'](_0x521a('0x10'),_0x460941);});}; \ No newline at end of file +var _0x599e=['lodash','moment','../../../../../../config/logger','agi','exports','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','info','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isObject','open'];(function(_0x16bb02,_0x4cf0fa){var _0x390ea3=function(_0x3a9bd9){while(--_0x3a9bd9){_0x16bb02['push'](_0x16bb02['shift']());}};_0x390ea3(++_0x4cf0fa);}(_0x599e,0xd2));var _0xe599=function(_0x5493cd,_0x3ba1c9){_0x5493cd=_0x5493cd-0x0;var _0x4d4030=_0x599e[_0x5493cd];return _0x4d4030;};'use strict';var BPromise=require('bluebird');var _=require(_0xe599('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe599('0x1'));var crypto=require('crypto');var logger=require(_0xe599('0x2'))(_0xe599('0x3'));module[_0xe599('0x4')]=function(_0x4e300f,_0x4c2b6a,_0x187955,_0x4b0e20){return new BPromise(function(_0x165384,_0x2b57f6){logger['info']('Tilde\x20URI',_0x4b0e20||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x68e809=new WebSocket(_0x4b0e20||_0xe599('0x5'),{'perMessageDeflate':![]});var _0x593eeb='';var _0x1049d5='0';var _0x2181bb='1';var _0xfddfb2=_0xe599('0x6');function _0x276c76(_0x5d5f65){var _0x3e8970=crypto[_0xe599('0x7')](_0xe599('0x8'));_0x3e8970[_0xe599('0x9')](_0x5d5f65);return _0x3e8970[_0xe599('0xa')]('hex');}function _0x52b240(){try{logger[_0xe599('0xb')]('Open\x20Tilde\x20ASR\x20socket');var _0x4405ea=moment()[_0xe599('0xc')]();var _0x1fd762=_0x276c76(_0x4405ea+_0x4c2b6a+_0x187955);_0x68e809[_0xe599('0xd')](JSON[_0xe599('0xe')]({'appID':_0x4c2b6a,'timestamp':_0x4405ea,'appKey':_0x1fd762}));var _0x23e046=fs[_0xe599('0xf')](_0x4e300f);_0x23e046['on'](_0xe599('0x10'),function(_0x3e2230){_0x68e809['send'](_0x3e2230);});_0x23e046['on'](_0xe599('0x11'),function(){_0x68e809['send'](_0xe599('0x12'));});}catch(_0x5bb810){logger[_0xe599('0x13')](_0xe599('0x14'),JSON['stringify'](_0x5bb810));_0x68e809['terminate']();}}function _0x528d61(_0x6f407c){try{if(_0x6f407c){var _0x48c274=JSON['parse'](_0x6f407c);switch(_0x48c274['status']){case 0x0:if(_0x48c274['result']){if(_0x48c274[_0xe599('0x15')][_0xe599('0x16')]){logger['info'](_0xe599('0x17'),JSON[_0xe599('0xe')](_0x48c274['result'][_0xe599('0x18')]));_0x593eeb=_0x48c274[_0xe599('0x15')]['hypotheses'][0x0][_0xe599('0x19')];_0x1049d5=_0x48c274[_0xe599('0x15')]['hypotheses'][0x0][_0xe599('0x1a')];_0x2181bb='0';_0xfddfb2='Success.';_0x68e809[_0xe599('0x1b')]();}}break;case 0x1:logger[_0xe599('0xb')](_0xe599('0x6'));_0x2181bb='1';_0xfddfb2=_0xe599('0x6');break;case 0x2:logger[_0xe599('0xb')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2181bb='2';_0xfddfb2=_0xe599('0x1c');break;case 0x9:logger[_0xe599('0xb')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2181bb='9';_0xfddfb2=_0xe599('0x1d');break;case 0xa:logger[_0xe599('0xb')](_0xe599('0x1e'));_0x2181bb='10';_0xfddfb2=_0xe599('0x1e');break;case 0xb:logger[_0xe599('0xb')](_0xe599('0x1f'));_0x2181bb='11';_0xfddfb2='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x594f57){logger[_0xe599('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xe599('0xe')](_0x594f57));_0x68e809[_0xe599('0x1b')]();}}function _0xdd45a0(){logger[_0xe599('0xb')]('Close\x20Tilde\x20ASR\x20socket');_0x165384({'transcript':_0x593eeb,'confidence':_0x1049d5,'status':_0x2181bb,'status_message':_0xfddfb2});}function _0x207b31(_0x1c55e4){logger['error'](_0xe599('0x20'));if(!_['isNil'](_0x1c55e4)){logger[_0xe599('0x13')](_[_0xe599('0x21')](_0x1c55e4)?JSON[_0xe599('0xe')](_0x1c55e4):_0x1c55e4);}}_0x68e809['on'](_0xe599('0x22'),_0x52b240);_0x68e809['on']('message',_0x528d61);_0x68e809['on'](_0xe599('0x11'),_0xdd45a0);_0x68e809['on'](_0xe599('0x13'),_0x207b31);});}; \ 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 08f5be2..b076bc9 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 _0x513e=['./asr','exports'];(function(_0x11a0b0,_0x13077c){var _0x1382e6=function(_0x562ed0){while(--_0x562ed0){_0x11a0b0['push'](_0x11a0b0['shift']());}};_0x1382e6(++_0x13077c);}(_0x513e,0x138));var _0xe513=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x513e[_0x51fe5f];return _0x4abce9;};var asr=require(_0xe513('0x0'));module[_0xe513('0x1')]={'asr':asr}; \ No newline at end of file +var _0x41e0=['exports','./asr'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x41e0,0x18f));var _0x041e=function(_0x16b112,_0x5c1755){_0x16b112=_0x16b112-0x0;var _0x2ef68=_0x41e0[_0x16b112];return _0x2ef68;};var asr=require(_0x041e('0x0'));module[_0x041e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 4411e88..28480b2 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 _0x7bae=['emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','inherits','exports','events','EventEmitter','./channel','127.0.0.1','call'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x7bae,0x13b));var _0xe7ba=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7bae[_0x363ef8];return _0x148822;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xe7ba('0x0'))[_0xe7ba('0x1')];var AGIError=require('./error');var AGIChannel=require(_0xe7ba('0x2'));var AGIServer=function(_0x4f2e91,_0x120efa,_0x10908b){var _0x166acb=this,_0x4f2e91=_0x4f2e91||0x11dd,_0x120efa=_0x120efa||_0xe7ba('0x3'),_0xfd3a22=null,_0x2d31df=0x0;EventEmitter[_0xe7ba('0x4')](_0x166acb);function _0x34fb18(){if(!_0x4f2e91){_0x166acb[_0xe7ba('0x5')](_0xe7ba('0x6'),new AGIError(_0xe7ba('0x7')));return![];}_0xfd3a22=net[_0xe7ba('0x8')]();_0xfd3a22['listen'](_0x4f2e91,_0x120efa);_0xfd3a22['on'](_0xe7ba('0x9'),function(){_0x166acb[_0xe7ba('0x5')](_0xe7ba('0x9'));});_0xfd3a22['on'](_0xe7ba('0xa'),function(_0x15083a){_0xfd3a22[_0xe7ba('0xb')](function(_0x99a86f,_0x448bcc){if(_0x99a86f){_0x166acb[_0xe7ba('0x5')]('error',new AGIError(_0xe7ba('0xc'),_0x99a86f));}else if(_0x10908b&&_0x10908b<0x0){_0x166acb['emit'](_0xe7ba('0x6'),new AGIError(_0xe7ba('0xd')));_0x15083a[_0xe7ba('0xe')]();}else if(_0x10908b&&_0x10908b>0x0&&_0x10908b<_0x448bcc){_0x2d31df+=0x1;_0x166acb[_0xe7ba('0x5')](_0xe7ba('0x6'),new AGIError(_0xe7ba('0xf'),_0x2d31df));_0x15083a['destroy']();}else{var _0x561c48=new AGIChannel(_0x15083a);_0x561c48['on'](_0xe7ba('0x10'),function(){_0x166acb[_0xe7ba('0x5')](_0xe7ba('0xa'),_0x561c48);});}});});_0xfd3a22['on']('error',function(_0x4390e3){_0x166acb['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x4390e3[_0xe7ba('0x11')]));});_0xfd3a22['on']('close',function(){_0x166acb[_0xe7ba('0x5')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x34fb18();});};util[_0xe7ba('0x12')](AGIServer,EventEmitter);module[_0xe7ba('0x13')]=function(_0x39ca38,_0x3c06c3,_0x1c8b5b){return new AGIServer(_0x39ca38,_0x3c06c3,_0x1c8b5b);}; \ No newline at end of file +var _0x5bbd=['util','net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports'];(function(_0x3b1aec,_0x4a66ff){var _0x574c45=function(_0x4c5495){while(--_0x4c5495){_0x3b1aec['push'](_0x3b1aec['shift']());}};_0x574c45(++_0x4a66ff);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd5bb('0x0'));var net=require(_0xd5bb('0x1'));var EventEmitter=require(_0xd5bb('0x2'))[_0xd5bb('0x3')];var AGIError=require(_0xd5bb('0x4'));var AGIChannel=require(_0xd5bb('0x5'));var AGIServer=function(_0x179bab,_0x480517,_0x5db64a){var _0x4a4799=this,_0x179bab=_0x179bab||0x11dd,_0x480517=_0x480517||_0xd5bb('0x6'),_0x489e3d=null,_0x520c77=0x0;EventEmitter['call'](_0x4a4799);function _0x3878ba(){if(!_0x179bab){_0x4a4799[_0xd5bb('0x7')](_0xd5bb('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x489e3d=net['createServer']();_0x489e3d[_0xd5bb('0x9')](_0x179bab,_0x480517);_0x489e3d['on'](_0xd5bb('0xa'),function(){_0x4a4799[_0xd5bb('0x7')]('listening');});_0x489e3d['on'](_0xd5bb('0xb'),function(_0x43be0a){_0x489e3d[_0xd5bb('0xc')](function(_0x55a320,_0x51705b){if(_0x55a320){_0x4a4799[_0xd5bb('0x7')](_0xd5bb('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x55a320));}else if(_0x5db64a&&_0x5db64a<0x0){_0x4a4799[_0xd5bb('0x7')]('error',new AGIError(_0xd5bb('0xd')));_0x43be0a['destroy']();}else if(_0x5db64a&&_0x5db64a>0x0&&_0x5db64a<_0x51705b){_0x520c77+=0x1;_0x4a4799[_0xd5bb('0x7')](_0xd5bb('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x520c77));_0x43be0a[_0xd5bb('0xe')]();}else{var _0x1f54eb=new AGIChannel(_0x43be0a);_0x1f54eb['on'](_0xd5bb('0xf'),function(){_0x4a4799['emit']('connection',_0x1f54eb);});}});});_0x489e3d['on'](_0xd5bb('0x8'),function(_0xa014fe){_0x4a4799['emit'](_0xd5bb('0x8'),new AGIError(_0xd5bb('0x10'),_0xa014fe[_0xd5bb('0x11')]));});_0x489e3d['on'](_0xd5bb('0x12'),function(){_0x4a4799['emit'](_0xd5bb('0x12'),new AGIError(_0xd5bb('0x13')));});}process[_0xd5bb('0x14')](function(){_0x3878ba();});};util[_0xd5bb('0x15')](AGIServer,EventEmitter);module[_0xd5bb('0x16')]=function(_0x15e093,_0x5da03d,_0x3bb5ae){return new AGIServer(_0x15e093,_0x5da03d,_0x3bb5ae);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e612126..b6e5043 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 _0x9f2e=['Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','maxRetry','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','record','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','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','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','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','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','streamFile','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','split','join','exports','path','util','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','length','saveRestApiResult','%s.%s','isArray','setVariable','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','delay','scheduledAt','minutes','callback_priority','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s'];(function(_0x5806cf,_0x30f13d){var _0xf28d3f=function(_0x379d04){while(--_0x379d04){_0x5806cf['push'](_0x5806cf['shift']());}};_0xf28d3f(++_0x30f13d);}(_0x9f2e,0xa0));var _0xe9f2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9f2e[_0x18ab2a];return _0x16dcee;};'use strict';var fs=require('fs');var path=require(_0xe9f2('0x0'));var util=require(_0xe9f2('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xe9f2('0x2'))();var rs=require(_0xe9f2('0x3'));var moment=require(_0xe9f2('0x4'));var Mustache=require(_0xe9f2('0x5'));var rp=require(_0xe9f2('0x6'));var logger=require(_0xe9f2('0x7'))(_0xe9f2('0x8'));var config=require('../../config/environment');var scripts=require(_0xe9f2('0x9'));var FILES_PATH=_0xe9f2('0xa');var recursiveMapAttributes=[_0xe9f2('0xb'),_0xe9f2('0xc')];var verticesWithRetry=[_0xe9f2('0xd'),_0xe9f2('0xe'),_0xe9f2('0xf')];var AGIVertices=function(_0x3a217b,_0x457461,_0x1e76f3){this['channel']=_0x3a217b;this[_0xe9f2('0x10')]=_0x457461;this[_0xe9f2('0x11')]=_0x1e76f3;};AGIVertices[_0xe9f2('0x12')]['getVariable']=function(_0x10fad1,_0x53cbb0){this[_0xe9f2('0x10')]['getVariableById'](_0x10fad1)[_0xe9f2('0x13')](function(_0x24e9d0){_0x53cbb0(null,_0x24e9d0?_0x24e9d0[_0xe9f2('0x14')]:![]);})['catch'](function(_0x274a5e){_0x53cbb0(_0x274a5e);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x15')]=function(_0x564ae1,_0x2ec2e9){this[_0xe9f2('0x10')][_0xe9f2('0x16')](_0x564ae1)[_0xe9f2('0x13')](function(_0x3ca9e9){_0x2ec2e9(null,_0x3ca9e9?_0x3ca9e9[_0xe9f2('0x14')]:![]);})['catch'](function(_0x260665){_0x2ec2e9(_0x260665);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x17')]=function(_0x2f43e0,_0x4c8507){this[_0xe9f2('0x10')][_0xe9f2('0x18')](_0x2f43e0)[_0xe9f2('0x13')](function(_0x19f7a9){_0x4c8507(null,_0x19f7a9?_0x19f7a9['name']:![]);})[_0xe9f2('0x19')](function(_0x3a8eb9){_0x4c8507(_0x3a8eb9);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x1a')]=function(_0x1fda59,_0x341a74){this[_0xe9f2('0x10')][_0xe9f2('0x1b')](_0x1fda59)[_0xe9f2('0x13')](function(_0x2dddab){_0x341a74(null,_0x2dddab?_0x2dddab[_0xe9f2('0x1c')]:![]);})[_0xe9f2('0x19')](function(_0x4a13d0){_0x341a74(_0x4a13d0);});};AGIVertices['prototype'][_0xe9f2('0x1d')]=function(_0x5cf060,_0x633499){this[_0xe9f2('0x10')][_0xe9f2('0x1e')](_0x5cf060)[_0xe9f2('0x13')](function(_0x282356){_0x633499(null,_0x282356?_0x282356[_0xe9f2('0x14')]:![]);})[_0xe9f2('0x19')](function(_0x52e143){_0x633499(_0x52e143);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x1f')]=function(_0x12d408,_0x2402ff){this['rpc'][_0xe9f2('0x20')](_0x12d408)[_0xe9f2('0x13')](function(_0x40823b){_0x2402ff(null,_0x40823b?_0x40823b['name']:![]);})['catch'](function(_0xe6ddb7){_0x2402ff(_0xe6ddb7);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x21')]=function(_0x1f83b7,_0x4f2549){var _0x37613b=this;this['rpc'][_0xe9f2('0x22')](_0x1f83b7)[_0xe9f2('0x13')](function(_0x170d21){_0x4f2549(null,_0x170d21?_0x37613b[_0xe9f2('0x23')](_0x170d21['save_name']):![]);})[_0xe9f2('0x19')](function(_0x471178){_0x4f2549(_0x471178);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x24')]=function(_0x16661f,_0x3edfe0){this[_0xe9f2('0x10')]['getMailAccountById'](_0x16661f)[_0xe9f2('0x13')](function(_0x5b7f94){_0x3edfe0(null,_0x5b7f94?_0x5b7f94:![]);})[_0xe9f2('0x19')](function(_0x1e73ff){_0x3edfe0(_0x1e73ff);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x25')]=function(_0x302949,_0x1566f7,_0x536378){this['mailRpc'][_0xe9f2('0x25')](_0x302949,_0x1566f7)[_0xe9f2('0x13')](function(){_0x536378(null);})[_0xe9f2('0x19')](function(_0x2839c8){_0x536378(_0x2839c8);});};AGIVertices['prototype'][_0xe9f2('0x26')]=function(_0x28d712,_0x289507){this[_0xe9f2('0x10')][_0xe9f2('0x27')](_0x28d712)[_0xe9f2('0x13')](function(_0x275428){if(_0x275428){if(_0x275428[_0xe9f2('0x28')]){_0x289507(null,[_0x275428[_0xe9f2('0x29')]]);}else{_0x289507(null,_[_0xe9f2('0x2a')](_0x275428[_0xe9f2('0x2b')],'interval'));}}else{_0x289507(null,![]);}})[_0xe9f2('0x19')](function(_0xb6133b){_0x289507(_0xb6133b);});};AGIVertices['prototype'][_0xe9f2('0x23')]=function(_0x37ac69){return util[_0xe9f2('0x2c')](_0xe9f2('0x2d'),FILES_PATH,_0x37ac69);};AGIVertices['prototype'][_0xe9f2('0x2e')]=function(_0x298225,_0x3e9ca1,_0x22bc10){odbc['open'](_0x298225,function(_0x154b48){if(_0x154b48){logger[_0xe9f2('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x154b48);_0x22bc10(_0x154b48);}else{logger[_0xe9f2('0x30')](_0xe9f2('0x31'));odbc['query'](_0x3e9ca1,function(_0x40f50e,_0x25a1ae){if(_0x40f50e){logger[_0xe9f2('0x30')](_0xe9f2('0x32'),_0x3e9ca1);_0x22bc10(_0x40f50e);}else{logger[_0xe9f2('0x30')](_0xe9f2('0x33'),_0x3e9ca1);odbc['close'](function(_0x46a5d0){if(_0x46a5d0){logger['error'](_0xe9f2('0x34'),_0x46a5d0);}_0x22bc10(null,_0x25a1ae);});}});}});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x35')]=function(_0x58a502,_0xfda304){this[_0xe9f2('0x10')][_0xe9f2('0x36')](_0x58a502)[_0xe9f2('0x13')](function(_0x498ba6){_0xfda304(null,_0x498ba6?_0x498ba6:![]);})[_0xe9f2('0x19')](function(_0x426765){_0xfda304(_0x426765);});};AGIVertices['prototype'][_0xe9f2('0x37')]=function(_0x1a834f,_0x13dc85){this['rpc'][_0xe9f2('0x37')](_0x1a834f)[_0xe9f2('0x13')](function(_0x4f223b){_0x13dc85(null,_0x4f223b);})[_0xe9f2('0x19')](function(_0x86f45e){_0x13dc85(_0x86f45e);});};AGIVertices['prototype'][_0xe9f2('0x38')]=function(_0x7fdc8d,_0x50367f,_0x3abbd8){this[_0xe9f2('0x10')][_0xe9f2('0x38')]({'uniqueid':this[_0xe9f2('0x39')]['uniqueid'],'node':_0x7fdc8d[_0xe9f2('0x3a')],'application':_0x7fdc8d['agicommand'],'data':_0x50367f||null,'project_name':this[_0xe9f2('0x39')][_0xe9f2('0x3b')],'callerid':this[_0xe9f2('0x39')][_0xe9f2('0x3c')]})[_0xe9f2('0x13')](function(_0x350e09){if(_0x3abbd8){_0x3abbd8(null,_0x350e09);}})[_0xe9f2('0x19')](function(_0x180ffc){if(_0x3abbd8){_0x3abbd8(_0x180ffc);}});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x3d')]=function(_0x4205ba,_0x69d01c,_0x4483e7,_0x3d4977){this[_0xe9f2('0x10')][_0xe9f2('0x3d')]({'uniqueid':this[_0xe9f2('0x39')][_0xe9f2('0x3e')],'callerid':this[_0xe9f2('0x39')][_0xe9f2('0x3c')],'calleridname':this[_0xe9f2('0x39')][_0xe9f2('0x3f')],'context':this['channel'][_0xe9f2('0x40')],'extension':this[_0xe9f2('0x39')][_0xe9f2('0x41')],'priority':this['channel'][_0xe9f2('0x42')],'accountcode':this[_0xe9f2('0x39')]['accountcode'],'dnid':this[_0xe9f2('0x39')][_0xe9f2('0x43')],'projectName':this[_0xe9f2('0x39')][_0xe9f2('0x3b')],'saveName':_0x69d01c,'filename':_0x4205ba['file']||_0x69d01c,'savePath':_0x4483e7})[_0xe9f2('0x13')](function(_0x137ee1){_0x3d4977(null,_0x137ee1);})[_0xe9f2('0x19')](function(_0x3b5ca2){_0x3d4977(_0x3b5ca2);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x44')]=function(_0x3d3f18,_0x47cd85,_0x5af124,_0x52e7b0,_0x1c787a){this['rpc']['createSquareMessage']({'uniqueid':this['channel']['uniqueid'],'body':_0x3d3f18,'direction':_0x47cd85,'providerName':_0x5af124,'providerResponse':_0x52e7b0})[_0xe9f2('0x13')](function(_0x598f48){if(_0x1c787a){_0x1c787a(null,_0x598f48);}})[_0xe9f2('0x19')](function(_0x14b02f){if(_0x1c787a){_0x1c787a(_0x14b02f);}});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x45')]=function(_0x47a77d,_0x27cade){this[_0xe9f2('0x10')][_0xe9f2('0x45')]({'firstName':_[_0xe9f2('0x46')](_0x47a77d['name'])||_[_0xe9f2('0x47')](_0x47a77d[_0xe9f2('0x14')])?_0xe9f2('0x48')+Math['random']():_0x47a77d[_0xe9f2('0x14')],'lastName':_[_0xe9f2('0x46')](_0x47a77d['lastName'])||_[_0xe9f2('0x47')](_0x47a77d[_0xe9f2('0x49')])?null:_0x47a77d[_0xe9f2('0x49')],'phone':_0x47a77d['phone'],'ListId':_0x47a77d[_0xe9f2('0x4a')],'scheduledat':_0x47a77d['scheduledAt'],'callbackUniqueid':this[_0xe9f2('0x39')][_0xe9f2('0x3e')],'tags':_0xe9f2('0x4b'),'description':_0xe9f2('0x4c')+_0x47a77d['scheduledAt']['toString'](),'priority':_0x47a77d['callback_priority']})[_0xe9f2('0x13')](function(_0x3cfec5){_0x27cade(null,_0x3cfec5);})['catch'](function(_0x2b59dc){_0x27cade(_0x2b59dc);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x4d')]=function(_0x30ffc2,_0x16c360){this[_0xe9f2('0x10')]['getPauseById'](_0x30ffc2)[_0xe9f2('0x13')](function(_0x54f770){_0x16c360(null,_0x54f770?_0x54f770[_0xe9f2('0x14')]:![]);})[_0xe9f2('0x19')](function(_0x247be5){_0x16c360(_0x247be5);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x4e')]=function(_0x1a2b93,_0x5e794d,_0x1c8971){var _0x1a9366={'role':_0xe9f2('0x4f')};_0x1a9366[_0x1a2b93]=this[_0xe9f2('0x39')][_0xe9f2('0x3c')];this[_0xe9f2('0x10')][_0xe9f2('0x4e')](_0x1a9366,_0x5e794d,this[_0xe9f2('0x39')][_0xe9f2('0x3e')])[_0xe9f2('0x13')](function(_0x207217){_0x1c8971(null,_['isNil'](_0x207217)?![]:!![]);})[_0xe9f2('0x19')](function(_0x5a8d07){logger[_0xe9f2('0x2f')](_0x5a8d07);_0x1c8971(null,![]);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x50')]=function(_0x57190d,_0x3c3ad4){var _0x49d5b7={'role':'agent'};_0x49d5b7[_0x57190d]=this[_0xe9f2('0x39')][_0xe9f2('0x3c')];this['rpc'][_0xe9f2('0x50')](_0x49d5b7)[_0xe9f2('0x13')](function(_0x5f249f){_0x3c3ad4(null,_[_0xe9f2('0x47')](_0x5f249f)?![]:!![]);})[_0xe9f2('0x19')](function(_0x1ef66a){logger['error'](_0x1ef66a);_0x3c3ad4(null,![]);});};AGIVertices['prototype'][_0xe9f2('0x51')]=function(_0x51e670,_0x26dded){var _0x2c9d50={'role':_0xe9f2('0x4f')};_0x2c9d50[_0x51e670]=this[_0xe9f2('0x39')][_0xe9f2('0x3c')];this[_0xe9f2('0x10')][_0xe9f2('0x51')](_0x2c9d50)[_0xe9f2('0x13')](function(_0x5bd5ba){_0x26dded(null,_[_0xe9f2('0x47')](_0x5bd5ba)?![]:!![]);})[_0xe9f2('0x19')](function(_0x4e1645){logger[_0xe9f2('0x2f')](_0x4e1645);_0x26dded(null,![]);});};AGIVertices['prototype'][_0xe9f2('0x52')]=function(_0x417a06,_0x51c0aa){var _0x37eb4f={'role':_0xe9f2('0x4f')};_0x37eb4f[_0x417a06]=this[_0xe9f2('0x39')]['callerid'];var _0x499ae3=_0x417a06!='internal'?util[_0xe9f2('0x2c')]('%s/%s@from-sip/n',_0xe9f2('0x53'),this['channel'][_0xe9f2('0x3c')]):undefined;this[_0xe9f2('0x10')]['agentLogin'](_0x37eb4f,_0x499ae3)[_0xe9f2('0x13')](function(_0x5749ec){_0x51c0aa(null,_['isNil'](_0x5749ec)?![]:!![]);})[_0xe9f2('0x19')](function(_0x304091){logger[_0xe9f2('0x2f')](_0x304091);_0x51c0aa(null,![]);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x54')]=function(_0x198fac,_0x10bfa7){sh[_0xe9f2('0x55')](_['trim'](_0x198fac),function(_0x3a3602,_0x5357d3){var _0x830fad=_0x5357d3[_0xe9f2('0x56')](/(\r\n|\n|\r)/gm,'');_0x10bfa7(null,_0x830fad);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x57')]=function(_0x24e121,_0x4a9302){scripts['googleCloudTTS'](_0x24e121[_0xe9f2('0x58')],_0x24e121['google_cloud_tts_text_type']||_0xe9f2('0x59'),_0x24e121[_0xe9f2('0x59')],_0x24e121[_0xe9f2('0x5a')]||_0xe9f2('0x5b'),_0x24e121['ssmlGender']||_0xe9f2('0x5c'),_0x24e121[_0xe9f2('0x5d')]||_0xe9f2('0x5e'))[_0xe9f2('0x13')](function(_0x227727){_0x4a9302(null,_0x227727);})[_0xe9f2('0x19')](function(_0x225ba3){_0x4a9302(_0x225ba3);});};AGIVertices[_0xe9f2('0x12')]['googleTTS']=function(_0x51663c,_0xafd1f1){scripts[_0xe9f2('0x5f')](_0x51663c[_0xe9f2('0x59')],_0x51663c['google_tts_language']||'en',0x1)[_0xe9f2('0x13')](function(_0xa3189d){_0xafd1f1(null,_0xa3189d);})[_0xe9f2('0x19')](function(_0x31e53f){_0xafd1f1(_0x31e53f);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x60')]=function(_0x3f4ec6,_0x39f7e4){var _0x2f5a0a={'uri':_0x3f4ec6[_0xe9f2('0x61')],'method':_0x3f4ec6[_0xe9f2('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3f4ec6[_0xe9f2('0x63')])===_0xe9f2('0x64')&&parseInt(_0x3f4ec6[_0xe9f2('0x63')])>=0x1?parseInt(_0x3f4ec6[_0xe9f2('0x63')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xe9f2('0x65')],_0x2f5a0a['method'][_0xe9f2('0x66')]())){try{_0x2f5a0a[_0xe9f2('0x67')]=_0x3f4ec6[_0xe9f2('0xc')]?JSON[_0xe9f2('0x68')](_0x3f4ec6[_0xe9f2('0xc')]):{};}catch(_0x587e51){logger[_0xe9f2('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x587e51);}}try{_0x2f5a0a[_0xe9f2('0x69')]=_0x3f4ec6[_0xe9f2('0xb')]?JSON[_0xe9f2('0x68')](_0x3f4ec6[_0xe9f2('0xb')]):{};}catch(_0x2788d6){logger[_0xe9f2('0x2f')](_0xe9f2('0x6a'),_0x2788d6);}if(_0x3f4ec6['computedVariables']){try{var _0xfb904e=require(_0x3f4ec6['computedVariables'])[_0xe9f2('0x6b')](this,_0x2f5a0a);_0x2f5a0a[_0xe9f2('0x6c')]=Mustache['render'](_0x3f4ec6[_0xe9f2('0x61')],_0xfb904e,{},['$$','$$']);if(_0x2f5a0a[_0xe9f2('0x69')]){_0x2f5a0a[_0xe9f2('0x69')]=JSON[_0xe9f2('0x68')](Mustache['render'](JSON['stringify'](_0x2f5a0a[_0xe9f2('0x69')]),_0xfb904e,{},['$$','$$']));}if(_0x2f5a0a[_0xe9f2('0x67')]){_0x2f5a0a[_0xe9f2('0x67')]=JSON[_0xe9f2('0x68')](Mustache[_0xe9f2('0x6d')](JSON[_0xe9f2('0x6e')](_0x2f5a0a[_0xe9f2('0x67')]),_0xfb904e,{},['$$','$$']));}}catch(_0x1aca62){logger[_0xe9f2('0x2f')](_0xe9f2('0x6f'),_0x1aca62);}}rp(_0x2f5a0a)[_0xe9f2('0x13')](function(_0xe8398b){var _0x1c975a={'statusCode':_0xe8398b[_0xe9f2('0x70')]||0xc8,'statusMessage':_0xe8398b[_0xe9f2('0x71')]||'OK','headers':_0xe8398b[_0xe9f2('0x69')]||{},'body':_0xe8398b[_0xe9f2('0x67')]||{}};_0x39f7e4(null,_0x1c975a);})[_0xe9f2('0x19')](function(_0x261ac8){var _0x9cfd0c={'statusCode':_0x261ac8[_0xe9f2('0x70')]||0x1f4,'statusMessage':_0x261ac8[_0xe9f2('0x72')]||_0xe9f2('0x73'),'headers':_0x261ac8[_0xe9f2('0x74')][_0xe9f2('0x69')]||{},'body':_0x261ac8['options'][_0xe9f2('0x67')]||{}};_0x39f7e4(null,_0x9cfd0c);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x75')]=function(_0x204dda,_0x3e19ef){scripts['googleDialogflow'](this[_0xe9f2('0x39')]['uniqueid'],_0x204dda[_0xe9f2('0x76')],_0x204dda[_0xe9f2('0x59')],_0x204dda[_0xe9f2('0x77')]||'en')['then'](function(_0x3e95d5){_0x3e19ef(null,_0x3e95d5);})[_0xe9f2('0x19')](function(_0x5e97e8){_0x3e19ef(_0x5e97e8);});};AGIVertices['prototype'][_0xe9f2('0x78')]=function(_0x4e1d84,_0x148075){scripts[_0xe9f2('0x78')](this[_0xe9f2('0x39')][_0xe9f2('0x3e')],_0x4e1d84[_0xe9f2('0x79')],_0x4e1d84[_0xe9f2('0x7a')],_0x4e1d84[_0xe9f2('0x7b')],_0x4e1d84[_0xe9f2('0x59')],_0x4e1d84['dialogflowV2_language']||'en')[_0xe9f2('0x13')](function(_0x422416){_0x148075(null,_0x422416);})[_0xe9f2('0x19')](function(_0x48bbbb){_0x148075(_0x48bbbb);});};AGIVertices[_0xe9f2('0x12')]['sestekNDA']=function(_0xec8bae,_0x5e33a4){scripts[_0xe9f2('0x7c')](this[_0xe9f2('0x39')],_0xec8bae)[_0xe9f2('0x13')](function(_0x492d7c){_0x5e33a4(null,_0x492d7c);})[_0xe9f2('0x19')](function(_0x204e37){_0x5e33a4(_0x204e37);});};AGIVertices[_0xe9f2('0x12')]['ispeechTTS']=function(_0x126f88,_0x454ea5){scripts[_0xe9f2('0x7d')](_0x126f88[_0xe9f2('0x76')],_0x126f88[_0xe9f2('0x59')],_0x126f88['ispeech_tts_language']||'en-US',_0x126f88[_0xe9f2('0x7e')])['then'](function(_0x433a06){_0x454ea5(null,_0x433a06);})['catch'](function(_0x280dca){_0x454ea5(_0x280dca);});};AGIVertices['prototype']['ispeechASR']=function(_0x32596,_0x568a72,_0x18f1e6){scripts['ispeechASR'](_0x568a72,_0x32596[_0xe9f2('0x76')],_0x32596[_0xe9f2('0x7f')]||_0xe9f2('0x5b'),this[_0xe9f2('0x80')](_0x32596[_0xe9f2('0x81')])?_0x32596[_0xe9f2('0x81')]:undefined)[_0xe9f2('0x13')](function(_0x1907c9){_0x18f1e6(null,_0x1907c9);})[_0xe9f2('0x19')](function(_0x3fae92){_0x18f1e6(_0x3fae92);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x82')]=function(_0x49743a,_0x3d3257){scripts[_0xe9f2('0x82')](_0x49743a[_0xe9f2('0x83')],_0x49743a[_0xe9f2('0x84')],_0x49743a['aws_polly_region'],_0x49743a['aws_polly_voice']||_0xe9f2('0x85'),_0x49743a[_0xe9f2('0x59')],_0x49743a['aws_text_type']||'text')[_0xe9f2('0x13')](function(_0x3b2a78){_0x3d3257(null,_0x3b2a78);})[_0xe9f2('0x19')](function(_0x58c4d3){_0x3d3257(_0x58c4d3);});};AGIVertices['prototype']['awsLex']=function(_0x4af8dd,_0x59ea97){scripts[_0xe9f2('0x86')](this[_0xe9f2('0x39')]['uniqueid'],_0x4af8dd[_0xe9f2('0x83')],_0x4af8dd['aws_secret_access_key'],_0x4af8dd[_0xe9f2('0x87')],_0x4af8dd[_0xe9f2('0x59')],_0x4af8dd[_0xe9f2('0x88')])[_0xe9f2('0x13')](function(_0x16c0e8){_0x59ea97(null,_0x16c0e8);})['catch'](function(_0x1c21de){_0x59ea97(_0x1c21de);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x89')]=function(_0x3e5ac9,_0x103852,_0x28fd11){scripts['googleASR'](_0x103852,_0x3e5ac9['key'],_0x3e5ac9[_0xe9f2('0x8a')]||_0xe9f2('0x5b'))['then'](function(_0x31fb0a){_0x28fd11(null,_0x31fb0a);})['catch'](function(_0xaa270c){_0x28fd11(_0xaa270c);});};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x8b')]=function(_0x4d94d1,_0x5ab7de,_0x3d3cd4){scripts[_0xe9f2('0x8b')](_0x5ab7de,_0x4d94d1[_0xe9f2('0x8c')],_0x4d94d1['appsecret'],_0x4d94d1[_0xe9f2('0x6c')])['then'](function(_0x404a60){_0x3d3cd4(null,_0x404a60);})[_0xe9f2('0x19')](function(_0x1b4151){_0x3d3cd4(_0x1b4151);});};AGIVertices['prototype'][_0xe9f2('0x8d')]=function(_0x49d8eb){var _0xea34c1=_[_0xe9f2('0x8e')](verticesWithRetry,_0x49d8eb[_0xe9f2('0x8f')])?_0x49d8eb:_[_0xe9f2('0x90')](_0x49d8eb);for(var _0x232d79 in _0xea34c1){if(_0xea34c1['hasOwnProperty'](_0x232d79)){if(_0xea34c1[_0x232d79]&&_[_0xe9f2('0x91')](_0xea34c1[_0x232d79])){if(_[_0xe9f2('0x8e')](recursiveMapAttributes,_0x232d79)){_0xea34c1[_0x232d79]=this[_0xe9f2('0x92')](_0xea34c1[_0x232d79]);}else{_0xea34c1[_0x232d79]=this[_0xe9f2('0x93')](_0xea34c1[_0x232d79]);}}}}return _0xea34c1;};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x94')]=function(_0x5cd706){for(var _0x4a9b77 in _0x5cd706){if(_0x5cd706[_0xe9f2('0x95')](_0x4a9b77)){if(_['isPlainObject'](_0x5cd706[_0x4a9b77])){this['recursiveNodeIndex'](_0x5cd706[_0x4a9b77]);}else if(_['isArray'](_0x5cd706[_0x4a9b77])){for(var _0x29681f=0x0;_0x29681f<_0x5cd706[_0x4a9b77][_0xe9f2('0x96')];_0x29681f++){this[_0xe9f2('0x94')](_0x5cd706[_0x4a9b77][_0x29681f]);}}else if(_[_0xe9f2('0x91')](_0x5cd706[_0x4a9b77])){_0x5cd706[_0x4a9b77]=this[_0xe9f2('0x93')](_0x5cd706[_0x4a9b77]);}}}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x97')]=function(_0x5b6b00,_0x3af68d){for(var _0x16ad3a in _0x5b6b00){if(_0x5b6b00[_0xe9f2('0x95')](_0x16ad3a)){if(_['isPlainObject'](_0x5b6b00[_0x16ad3a])){if(!_[_0xe9f2('0x46')](_0x5b6b00[_0x16ad3a])){this['saveRestApiResult'](_0x5b6b00[_0x16ad3a],util['format'](_0xe9f2('0x98'),_0x3af68d,_0x16ad3a));}}else if(_[_0xe9f2('0x99')](_0x5b6b00[_0x16ad3a])){for(var _0x4a7421=0x0;_0x4a7421<_0x5b6b00[_0x16ad3a][_0xe9f2('0x96')];_0x4a7421++){this['saveRestApiResult'](_0x5b6b00[_0x16ad3a][_0x4a7421],util['format'](_0xe9f2('0x98'),_0x3af68d,_0x16ad3a+'['+_0x4a7421+']'));}}else{if(!_[_0xe9f2('0x47')](_0x5b6b00[_0x16ad3a])){this['channel'][_0xe9f2('0x9a')](util['format']('%s.%s',_0x3af68d,_0x16ad3a),_0x5b6b00[_0x16ad3a]);}}}}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x92')]=function(_0x43ec22){try{var _0x46547f=JSON[_0xe9f2('0x68')](_0x43ec22);this['recursiveNodeIndex'](_0x46547f);return JSON[_0xe9f2('0x6e')](_0x46547f);}catch(_0x5c340b){return this[_0xe9f2('0x93')](_0x43ec22);}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x93')]=function(_0x5709e6){var _0x24d5e1=_0x5709e6['split']('{');for(var _0x433706=0x1;_0x433706<_0x24d5e1[_0xe9f2('0x96')];_0x433706+=0x1){var _0x3107c4=_0x24d5e1[_0x433706]['split']('}');if(_0x3107c4[_0xe9f2('0x96')]>0x1){_0x5709e6=_0x5709e6['replaceAll']('{'+_0x3107c4[0x0]+'}',this[_0xe9f2('0x39')][_0xe9f2('0x9b')](_0x3107c4[0x0])[_0xe9f2('0x9c')]||_0x3107c4[0x0]);}}if(_0x24d5e1[_0xe9f2('0x96')]===0x1){return _0x5709e6['toString']();}return this[_0xe9f2('0x93')](_0x5709e6);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x9d')]=function(_0x49059f,_0x28e9f5){var _0x4b99f9=this[_0xe9f2('0x39')]['getVariable'](_0x49059f);if(_0x4b99f9['result']===-0x1){return _0x4b99f9;}logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x9e'),_0x28e9f5,_0x4b99f9[_0xe9f2('0x9c')]));return this[_0xe9f2('0x39')][_0xe9f2('0x9a')](_0x28e9f5,_0x4b99f9[_0xe9f2('0x9c')]);};AGIVertices[_0xe9f2('0x12')]['isConfigured']=function(_0x2f8efb){return _0x2f8efb&&_0x2f8efb!=='0'&&_0x2f8efb!=='-1'&&_0x2f8efb!=='';};AGIVertices['prototype']['maxRetry']=function(_0x46cb7f){this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x46cb7f,'-');_0x46cb7f[_0xe9f2('0x9f')]=_0x46cb7f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xa0')]=function(_0xe1b846){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xa1'),_0xe1b846[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0xe1b846['text'])){return this['channel'][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}var _0x347012='\x22'+_0xe1b846[_0xe9f2('0x59')]+'\x22';if(this[_0xe9f2('0x80')](_0xe1b846[_0xe9f2('0x74')])){_0x347012+=','+_0xe1b846[_0xe9f2('0x74')];}var _0x388a90=this[_0xe9f2('0x39')][_0xe9f2('0x55')](_0xe9f2('0xa4'),_0x347012);if(_0x388a90[_0xe9f2('0xa5')]===-0x1){return _0x388a90;}return this['channel'][_0xe9f2('0xa2')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x347012));};AGIVertices['prototype'][_0xe9f2('0xa6')]=function(_0x4014d0){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xa7'),_0x4014d0[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x4014d0[_0xe9f2('0xa8')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x590c79=_0x4014d0[_0xe9f2('0xa8')];if(this[_0xe9f2('0x80')](_0x4014d0[_0xe9f2('0x74')])){_0x590c79+=','+_0x4014d0[_0xe9f2('0x74')];}var _0xf5649d=this['channel']['exec'](_0xe9f2('0xa9'),_0x590c79);if(_0xf5649d['result']===-0x1){return _0xf5649d;}var _0xd6d2b5=this[_0xe9f2('0x9d')]('RECOG_CONFIDENCE()',_0xe9f2('0xaa'));if(_0xd6d2b5[_0xe9f2('0xa5')]===-0x1){return _0xd6d2b5;}var _0x3fe76c=this[_0xe9f2('0x9d')](_0xe9f2('0xab'),_0xe9f2('0xac'));if(_0x3fe76c['result']===-0x1){return _0x3fe76c;}var _0x4f7672=this[_0xe9f2('0x9d')](_0xe9f2('0xad'),_0xe9f2('0xae'));if(_0x4f7672[_0xe9f2('0xa5')]===-0x1){return _0x4f7672;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format'](_0xe9f2('0xaf'),_0x590c79));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x8')]=function(_0x5db4ae){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5db4ae[_0xe9f2('0x3a')]));return this['channel'][_0xe9f2('0x8')]([_0x5db4ae[_0xe9f2('0xb0')],_0x5db4ae['args']]);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xb1')]=function(_0x3e5751){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xb2'),_0x3e5751[_0xe9f2('0x3a')]));if(this[_0xe9f2('0x80')](_0x3e5751[_0xe9f2('0x63')])){logger['info'](util[_0xe9f2('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3e5751[_0xe9f2('0x63')]));var _0x4e070b=this['channel'][_0xe9f2('0xb3')](_0x3e5751[_0xe9f2('0x63')]);if(_0x4e070b['result']===-0x1){return _0x4e070b;}}return this[_0xe9f2('0x39')][_0xe9f2('0xb1')]();};AGIVertices[_0xe9f2('0x12')]['callback']=function(_0x110b89){logger[_0xe9f2('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x110b89[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x110b89[_0xe9f2('0x4a')])){return this[_0xe9f2('0x39')]['error'](_0x110b89,'no\x20list\x20selected');}_0x110b89['scheduledAt']=moment();if(this[_0xe9f2('0x80')](_0x110b89[_0xe9f2('0xb4')])){_0x110b89[_0xe9f2('0xb5')]=moment()['add'](_0x110b89[_0xe9f2('0xb4')],_0xe9f2('0xb6'));}if(!this['isConfigured'](_0x110b89[_0xe9f2('0xb7')])){_0x110b89['callback_priority']=0x2;}this['createCmContact'][_0xe9f2('0x6b')](this,_0x110b89);return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x110b89[_0xe9f2('0xb8')],_0x110b89['list_id'],_0x110b89[_0xe9f2('0xb5')]));};AGIVertices[_0xe9f2('0x12')]['custom_app']=function(_0x19d1b2){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xb9'),_0x19d1b2[_0xe9f2('0x3a')]));var _0x286913=this['channel']['exec'](_0x19d1b2[_0xe9f2('0xba')],_0x19d1b2[_0xe9f2('0x74')]);if(_0x286913[_0xe9f2('0xa5')]===-0x1){return _0x286913;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xbb'),_0x19d1b2[_0xe9f2('0xba')],_0x19d1b2['options']));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xbc')]=function(_0x2e2bcb){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2e2bcb[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x2e2bcb[_0xe9f2('0x59')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0xa3'));}var _0x1e08f9='\x22'+_0x2e2bcb[_0xe9f2('0x59')]+'\x22';if(this[_0xe9f2('0x80')](_0x2e2bcb['options'])){_0x1e08f9+=','+_0x2e2bcb[_0xe9f2('0x74')];}var _0x64f27b=this[_0xe9f2('0x39')][_0xe9f2('0x55')](_0xe9f2('0xa4'),_0x1e08f9);if(_0x64f27b[_0xe9f2('0xa5')]===-0x1){return _0x64f27b;}return this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1e08f9));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xbd')]=function(_0x2c2378){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2c2378[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x2c2378[_0xe9f2('0x59')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}var _0x2e47eb='\x22'+_0x2c2378[_0xe9f2('0x59')]+'\x22';if(this[_0xe9f2('0x80')](_0x2c2378['options'])){_0x2e47eb+=','+_0x2c2378[_0xe9f2('0x74')];}var _0x346624=this[_0xe9f2('0x39')][_0xe9f2('0x55')](_0xe9f2('0xa4'),_0x2e47eb);if(_0x346624[_0xe9f2('0xa5')]===-0x1){return _0x346624;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2e47eb));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xbe')]=function(_0x2be14c){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0xbf'),_0x2be14c[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x2be14c[_0xe9f2('0xa8')])){return this['channel'][_0xe9f2('0xa2')]('no\x20grammar\x20configured');}var _0x56f22b=_0x2be14c[_0xe9f2('0xa8')];if(this['isConfigured'](_0x2be14c['options'])){_0x56f22b+=','+_0x2be14c[_0xe9f2('0x74')];}var _0x1c84e7=this['channel'][_0xe9f2('0x55')]('MRCPRecog',_0x56f22b);if(_0x1c84e7['result']===-0x1){return _0x1c84e7;}var _0x5bd671=this[_0xe9f2('0x9d')](_0xe9f2('0xc0'),_0xe9f2('0xc1'));if(_0x5bd671['result']===-0x1){return _0x5bd671;}var _0x215064=this[_0xe9f2('0x9d')](_0xe9f2('0xab'),_0xe9f2('0xc2'));if(_0x215064[_0xe9f2('0xa5')]===-0x1){return _0x215064;}var _0x4b332f=this[_0xe9f2('0x9d')]('RECOG_INSTANCE()',_0xe9f2('0xc3'));if(_0x4b332f[_0xe9f2('0xa5')]===-0x1){return _0x4b332f;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xaf'),_0x56f22b));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xc4')]=function(_0x5f07e3){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5f07e3['label']));if(!this['isConfigured'](_0x5f07e3['grammar'])){return this['channel'][_0xe9f2('0xa2')]('no\x20grammar\x20configured');}var _0x58448a=_0x5f07e3[_0xe9f2('0xa8')];if(this[_0xe9f2('0x80')](_0x5f07e3[_0xe9f2('0x74')])){_0x58448a+=','+_0x5f07e3[_0xe9f2('0x74')];}var _0x564982=this[_0xe9f2('0x39')]['exec'](_0xe9f2('0xa9'),_0x58448a);if(_0x564982[_0xe9f2('0xa5')]===-0x1){return _0x564982;}var _0x1072c3=this[_0xe9f2('0x9d')](_0xe9f2('0xc0'),'SESTEK_ASR_CONFIDENCE');if(_0x1072c3[_0xe9f2('0xa5')]===-0x1){return _0x1072c3;}var _0x3339aa=this[_0xe9f2('0x9d')](_0xe9f2('0xab'),_0xe9f2('0xc5'));if(_0x3339aa[_0xe9f2('0xa5')]===-0x1){return _0x3339aa;}var _0x5ae792=this[_0xe9f2('0x9d')](_0xe9f2('0xad'),_0xe9f2('0xc6'));if(_0x5ae792[_0xe9f2('0xa5')]===-0x1){return _0x5ae792;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format'](_0xe9f2('0xaf'),_0x58448a));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xc7')]=function(_0x5ea825){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0xc8'),_0x5ea825[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x5ea825['odbc_id'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5ea825,_0xe9f2('0xc9'));}var _0x58afd8=this[_0xe9f2('0x1a')][_0xe9f2('0x6b')](this,_0x5ea825[_0xe9f2('0xca')]);if(!_0x58afd8){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5ea825,'no\x20odbc\x20database\x20found');}if(!this[_0xe9f2('0x80')](_0x5ea825['query'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5ea825,_0xe9f2('0xcb'));}var _0x56f75a=_0x5ea825[_0xe9f2('0xcc')][_0xe9f2('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xcd'),_0x56f75a));var _0x3e39a4=this['getQueryOdbc']['sync'](this,_0x58afd8,_0x56f75a);this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x5ea825,_0x56f75a);if(!this[_0xe9f2('0x80')](_0x5ea825[_0xe9f2('0xce')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0xcf'));}var _0x1f2f83=this[_0xe9f2('0x9b')][_0xe9f2('0x6b')](this,_0x5ea825[_0xe9f2('0xce')]);if(!_0x1f2f83){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5ea825,_0xe9f2('0xd0'));}var _0x1be08f=this;_0x3e39a4['forEach'](function(_0x45bbf8,_0x1582db){Object[_0xe9f2('0xd1')](_0x45bbf8)['forEach'](function(_0x539f4c){_0x1be08f['channel'][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')](_0xe9f2('0xd2'),_0x1f2f83,_0x1582db,_0x539f4c),_0x45bbf8[_0x539f4c]);});});this['channel']['setVariable'](util[_0xe9f2('0x2c')](_0xe9f2('0xd3'),_0x1f2f83),_0x3e39a4['length']);return this['channel'][_0xe9f2('0xa2')](util['format'](_0xe9f2('0xd4'),_0x1f2f83));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xd5')]=function(_0x4dcf82){logger[_0xe9f2('0xd6')](util[_0xe9f2('0x2c')](_0xe9f2('0xd7'),_0x4dcf82[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x4dcf82[_0xe9f2('0xd8')])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x4dcf82,'no\x20user\x20selected');}var _0x40baff=this['getUser'][_0xe9f2('0x6b')](this,_0x4dcf82[_0xe9f2('0xd8')]);if(!_0x40baff){return this['channel'][_0xe9f2('0x2f')](_0x4dcf82,_0xe9f2('0xd9'));}var _0x58bbc9=this[_0xe9f2('0x39')][_0xe9f2('0x55')]('DIAL',[util[_0xe9f2('0x2c')](_0xe9f2('0xda'),_0x40baff),_0x4dcf82['timeout'],_0x4dcf82[_0xe9f2('0xdb')],_0x4dcf82[_0xe9f2('0x61')]]);if(_0x58bbc9['result']===-0x1){return _0x58bbc9;}return this[_0xe9f2('0x39')]['noop'](util['format'](_0xe9f2('0xdc'),_0xe9f2('0xdd')));};AGIVertices[_0xe9f2('0x12')]['dialogflow']=function(_0x3487a7){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xde'),_0x3487a7['label']));if(!this[_0xe9f2('0x80')](_0x3487a7[_0xe9f2('0x76')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0xdf'));}if(!this[_0xe9f2('0x80')](_0x3487a7['text'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')][_0xe9f2('0xe0')]=!![];this[_0xe9f2('0x38')](_0x3487a7);this[_0xe9f2('0x44')](_0x3487a7[_0xe9f2('0x59')],'in','','');this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xe1'),_0x3487a7[_0xe9f2('0x59')]));var _0x207a2a=this[_0xe9f2('0x75')][_0xe9f2('0x6b')](this,_0x3487a7);if(_0x207a2a){for(var _0x1a017b in _0x207a2a){if(_0x207a2a[_0xe9f2('0x95')](_0x1a017b)){this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util['format']('DIALOGFLOW_%s',_0x1a017b['toUpperCase']()),_0x207a2a[_0x1a017b]);}}this[_0xe9f2('0x44')](_0x207a2a[_0xe9f2('0xe2')],_0xe9f2('0xe3'),_0xe9f2('0xe4'),'');return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xe5'),_0x207a2a[_0xe9f2('0xe2')]));}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x3487a7,_0xe9f2('0xe6'));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xe7')]=function(_0x5b086b){logger[_0xe9f2('0x30')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5b086b[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x5b086b[_0xe9f2('0x79')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xe8'));}if(!this[_0xe9f2('0x80')](_0x5b086b['client_email'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('no\x20client_email\x20configured');}if(!this[_0xe9f2('0x80')](_0x5b086b[_0xe9f2('0x7b')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xe9'));}if(!this[_0xe9f2('0x80')](_0x5b086b[_0xe9f2('0xea')])){return this['channel']['noop'](_0xe9f2('0xeb'));}if(!this['isConfigured'](_0x5b086b[_0xe9f2('0x59')])){return this['channel'][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')][_0xe9f2('0xe0')]=!![];this[_0xe9f2('0x38')](_0x5b086b);this[_0xe9f2('0x44')](_0x5b086b[_0xe9f2('0x59')],'in','','');this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('Trying\x20DialogflowV2:\x20%s',_0x5b086b['text']));var _0x4f2b5a=this[_0xe9f2('0x78')][_0xe9f2('0x6b')](this,_0x5b086b);if(_0x4f2b5a){for(var _0x40d04d in _0x4f2b5a){if(_0x4f2b5a[_0xe9f2('0x95')](_0x40d04d)){if(_0x40d04d!=='providerResponse'){this['channel'][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')](_0xe9f2('0xec'),_0x40d04d['toUpperCase']()),_0x4f2b5a[_0x40d04d]);}}}this['createSquareMessage'](_0x4f2b5a[_0xe9f2('0xe2')],'out',_0xe9f2('0xe7'),_0x4f2b5a['providerResponse']);return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xed'),_0x4f2b5a['speech']));}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5b086b,_0xe9f2('0xee'));};AGIVertices['prototype'][_0xe9f2('0xef')]=function(_0x42fb3b){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x42fb3b[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x42fb3b[_0xe9f2('0xf0')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xf1'));}if(!this[_0xe9f2('0x80')](_0x42fb3b[_0xe9f2('0xf2')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0xf3'));}if(!this['isConfigured'](_0x42fb3b['password'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('no\x20password\x20configured');}if(!this[_0xe9f2('0x80')](_0x42fb3b['ndassistant_url'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')][_0xe9f2('0xe0')]=!![];this[_0xe9f2('0x38')](_0x42fb3b);this[_0xe9f2('0x44')](_0x42fb3b['text'],'in','','');this['channel']['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0xf4'),_0x42fb3b['text']));var _0x9ecb24=this[_0xe9f2('0x7c')][_0xe9f2('0x6b')](this,_0x42fb3b);if(_0x9ecb24){for(var _0x25ca1c in _0x9ecb24){if(_0x9ecb24['hasOwnProperty'](_0x25ca1c)){this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')](_0xe9f2('0xf5'),_0x25ca1c[_0xe9f2('0x66')]()),_0x9ecb24[_0x25ca1c]);}}this[_0xe9f2('0x44')](_0x9ecb24[_0xe9f2('0xe2')],_0xe9f2('0xe3'),'sesteknda','');if(_0x9ecb24[_0xe9f2('0xf6')]){this['channel']['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0xf7'),_0x9ecb24[_0xe9f2('0xf6')]));var _0x235711=this['channel']['streamFile'](_0x9ecb24[_0xe9f2('0xf6')]);try{fs[_0xe9f2('0xf8')](_0x9ecb24['audiofile']+'.wav');}catch(_0x57b4b2){logger[_0xe9f2('0x2f')](_0x57b4b2);}return _0x235711;}else{return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xf9'),_0x9ecb24[_0xe9f2('0xe2')]));}}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x42fb3b,_0xe9f2('0xfa'));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xfb')]=function(_0x3bf363){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xfc'),_0x3bf363[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('end');};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xfd')]=function(_0x2aaef1){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0xfe'),_0x2aaef1['label']));var _0x1ab866='';if(_0x2aaef1[_0xe9f2('0xff')]){if(!this[_0xe9f2('0x80')](_0x2aaef1[_0xe9f2('0xff')])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x2aaef1,_0xe9f2('0x100'));}else{var _0x26cebf=parseInt(_0x2aaef1[_0xe9f2('0xff')],0xa);if(isNaN(_0x26cebf)){_0x1ab866=_0x2aaef1[_0xe9f2('0xff')];}else{_0x1ab866=this[_0xe9f2('0x1f')][_0xe9f2('0x6b')](this,_0x2aaef1['trunk_id']);if(!_0x1ab866){return this['channel']['error'](_0x2aaef1,_0xe9f2('0x101'));}}}}else if(_0x2aaef1[_0xe9f2('0x102')]){_0x1ab866=_0x2aaef1[_0xe9f2('0x102')];}else{return this['channel'][_0xe9f2('0x2f')](_0x2aaef1,_0xe9f2('0x100'));}var _0x277f89=this[_0xe9f2('0x39')][_0xe9f2('0x55')](_0xe9f2('0xdd'),[util[_0xe9f2('0x2c')](_0xe9f2('0x103'),_0x1ab866,_0x2aaef1['phone']),_0x2aaef1[_0xe9f2('0x63')],_0x2aaef1[_0xe9f2('0xdb')],_0x2aaef1[_0xe9f2('0x61')]]);if(_0x277f89['result']===-0x1){return _0x277f89;}return this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xdc'),_0xe9f2('0xdd')));};AGIVertices['prototype'][_0xe9f2('0x104')]=function(_0x2164c1){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x105'),_0x2164c1[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x104'));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xe')]=function(_0x322347){logger['info'](util['format'](_0xe9f2('0x106'),_0x322347[_0xe9f2('0x3a')]));if(_0x322347[_0xe9f2('0x9f')]===0x0){return this['maxRetry'](_0x322347);}_0x322347['retry']-=0x1;if(!this['isConfigured'](_0x322347[_0xe9f2('0x107')])){return this['channel'][_0xe9f2('0x2f')](_0x322347,_0xe9f2('0x108'));}var _0x391ed4=this['getSound']['sync'](this,_0x322347[_0xe9f2('0x107')]);if(!_0x391ed4){return this[_0xe9f2('0x39')]['error'](_0x322347,_0xe9f2('0x109'));}if(!this['isConfigured'](_0x322347['variable_id'])){return this[_0xe9f2('0x39')]['error'](_0xe9f2('0xcf'));}var _0x5b9762=this['channel'][_0xe9f2('0x10a')](_0x391ed4,_0x322347[_0xe9f2('0x10b')],_0x322347[_0xe9f2('0x10c')]);var _0x4d0c92=_0x5b9762[_0xe9f2('0xa5')]?_0x5b9762[_0xe9f2('0xa5')][_0xe9f2('0x10d')]():'';logger['info'](_0xe9f2('0x10e'),JSON[_0xe9f2('0x6e')](_0x5b9762));if(_0x5b9762[_0xe9f2('0xa5')]===-0x1){this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x322347,_0x4d0c92);return _0x5b9762;}else if(_0x5b9762[_0xe9f2('0x9c')]===_0xe9f2('0x63')){_0x5b9762[_0xe9f2('0xa5')]=_0x4d0c92['length']>=parseInt(_0x322347[_0xe9f2('0x10f')])?'x':'i';}else{_0x5b9762[_0xe9f2('0xa5')]=_0x4d0c92[_0xe9f2('0x96')]>=parseInt(_0x322347[_0xe9f2('0x10f')])&&_0x4d0c92[_0xe9f2('0x96')]<=parseInt(_0x322347[_0xe9f2('0x10c')])?'x':'i';}var _0x3f33e5=this['getVariable'][_0xe9f2('0x6b')](this,_0x322347[_0xe9f2('0xce')]);if(!_0x3f33e5){return this['channel'][_0xe9f2('0x2f')](_0x322347,_0xe9f2('0xd0'));}this['channel']['setVariable'](_0x3f33e5,_0x4d0c92);if(this[_0xe9f2('0x80')](_0x322347[_0xe9f2('0x110')])){var _0x2010db=parseInt(_0x322347[_0xe9f2('0x110')],0xa);var _0x522592=rs[_0xe9f2('0x111')]({'charset':'*','length':_0x2010db});var _0x4a3f79=_0x4d0c92[_0xe9f2('0x96')];if(_0x4a3f79>0x0){if(_0x4a3f79>_0x2010db){this[_0xe9f2('0x38')]['sync'](this,_0x322347,_0x322347[_0xe9f2('0x112')]===_0xe9f2('0x113')?_0x522592+_0x4d0c92[_0xe9f2('0x114')](_0x2010db):_0x4d0c92[_0xe9f2('0x114')](0x0,_0x4a3f79-_0x2010db)+_0x522592);}else{this[_0xe9f2('0x38')]['sync'](this,_0x322347,rs[_0xe9f2('0x111')]({'charset':'*','length':_0x4a3f79}));}}else{this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x322347,'');}}else{this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x322347,_0x4d0c92);}return _0x5b9762;};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xf')]=function(_0x471b5a){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x115'),_0x471b5a['label']));return this[_0xe9f2('0xe')](_0x471b5a);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x116')]=function(_0x5a86b3){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x117'),_0x5a86b3[_0xe9f2('0x3a')]));this[_0xe9f2('0x38')]['sync'](this,_0x5a86b3,_0x5a86b3[_0xe9f2('0x118')]);return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('GOAL\x20%s',_0x5a86b3[_0xe9f2('0x118')]));};AGIVertices['prototype'][_0xe9f2('0x119')]=function(_0x375732){logger['info'](util['format'](_0xe9f2('0x11a'),_0x375732['label']));if(!this['isConfigured'](_0x375732[_0xe9f2('0x83')])||!this['isConfigured'](_0x375732[_0xe9f2('0x84')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x11b'));}if(!this['isConfigured'](_0x375732[_0xe9f2('0x59')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x11c'),_0x375732[_0xe9f2('0x59')]));var _0x38cafe=this[_0xe9f2('0x82')]['sync'](this,_0x375732);if(_0x38cafe){this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x11d'),_0x38cafe));var _0x1d7a9d=this['channel']['streamFile'](_0x38cafe);try{fs[_0xe9f2('0xf8')](_0x38cafe+_0xe9f2('0x11e'));}catch(_0x49ced5){logger[_0xe9f2('0x2f')](_0x49ced5);}return _0x1d7a9d;}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x375732,_0xe9f2('0x11f'));};AGIVertices[_0xe9f2('0x12')]['awslex']=function(_0x482f97){logger[_0xe9f2('0x30')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x482f97[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x482f97[_0xe9f2('0x83')])||!this[_0xe9f2('0x80')](_0x482f97[_0xe9f2('0x84')])){return this['channel'][_0xe9f2('0xa2')](_0xe9f2('0x11b'));}if(!this[_0xe9f2('0x80')](_0x482f97[_0xe9f2('0x88')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x120'));}if(!this['isConfigured'](_0x482f97['text'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')][_0xe9f2('0xe0')]=!![];this[_0xe9f2('0x38')](_0x482f97);this[_0xe9f2('0x44')](_0x482f97[_0xe9f2('0x59')],'in','','');this['channel']['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x121'),_0x482f97[_0xe9f2('0x59')]));var _0x5e9d65=this[_0xe9f2('0x86')][_0xe9f2('0x6b')](this,_0x482f97);if(_0x5e9d65){for(var _0x88132 in _0x5e9d65){if(_0x5e9d65[_0xe9f2('0x95')](_0x88132)&&_['isString'](_0x5e9d65[_0x88132])){this['channel'][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')]('AWS_LEX_%s',_0x88132[_0xe9f2('0x66')]()),_0x5e9d65[_0x88132]);}}if(_['isNil'](_0x5e9d65['message'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x122'));}else{this[_0xe9f2('0x44')](_0x5e9d65[_0xe9f2('0x72')],_0xe9f2('0xe3'),_0xe9f2('0x123'),'');return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x124'),_0x5e9d65[_0xe9f2('0x72')]));}}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x482f97,_0xe9f2('0x125'));};AGIVertices['prototype']['googleasr']=function(_0x217625){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x126'),_0x217625['label'],_0x217625[_0xe9f2('0x63')]));if(!this[_0xe9f2('0x80')](_0x217625[_0xe9f2('0x76')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xdf'));}var _0x26529d=_0xe9f2('0x127');var _0x4a6132=util[_0xe9f2('0x2c')](_0xe9f2('0x128'),FILES_PATH,rs[_0xe9f2('0x111')](0x4));var _0x3021d8=util[_0xe9f2('0x2c')](_0xe9f2('0x98'),_0x4a6132,_0x26529d);var _0x29a4af=!![];if(_0x217625[_0xe9f2('0x129')]===_0xe9f2('0x12a')){_0x29a4af=![];}var _0x235d8a=this[_0xe9f2('0x39')][_0xe9f2('0x12b')](_0x4a6132,_0x26529d,_0x217625[_0xe9f2('0x12c')],_0x217625[_0xe9f2('0x63')],undefined,_0x29a4af);if(_0x235d8a[_0xe9f2('0xa5')]!==-0x1){this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')]('google\x20%s\x20file\x20created',_0x3021d8));var _0x1f172e=this['googleASR'][_0xe9f2('0x6b')](this,_0x217625,_0x3021d8);if(_0x1f172e){for(var _0x295bc7 in _0x1f172e){if(_0x1f172e[_0xe9f2('0x95')](_0x295bc7)){this[_0xe9f2('0x39')]['setVariable'](util[_0xe9f2('0x2c')]('GOOGLE_ASR_%s',_0x295bc7['toUpperCase']()),_0x1f172e[_0x295bc7]);}}return this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('GoogleASR\x20Result\x20%s',JSON[_0xe9f2('0x6e')](_0x1f172e)));}}return _0x235d8a;};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x12d')]=function(_0xcac1a6){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x12e'),_0xcac1a6[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0xcac1a6['appid'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x12f'));}if(!this['isConfigured'](_0xcac1a6[_0xe9f2('0x130')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0x131'));}var _0x3cc57a=_0xe9f2('0x127');var _0x1081c8=util[_0xe9f2('0x2c')](_0xe9f2('0x128'),FILES_PATH,rs[_0xe9f2('0x111')](0x4));var _0x3b4ff0=util['format'](_0xe9f2('0x98'),_0x1081c8,_0x3cc57a);var _0x2f7af6=!![];if(_0xcac1a6['beep']===_0xe9f2('0x12a')){_0x2f7af6=![];}var _0x1e38b1=this['channel'][_0xe9f2('0x12b')](_0x1081c8,_0x3cc57a,_0xcac1a6[_0xe9f2('0x12c')],_0xcac1a6[_0xe9f2('0x63')],undefined,_0x2f7af6);if(_0x1e38b1[_0xe9f2('0xa5')]!==-0x1){this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('tilde\x20%s\x20file\x20created',_0x3b4ff0));var _0x528028=this[_0xe9f2('0x8b')]['sync'](this,_0xcac1a6,_0x3b4ff0);if(_0x528028){for(var _0xbf8cc2 in _0x528028){if(_0x528028['hasOwnProperty'](_0xbf8cc2)){this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')](_0xe9f2('0x132'),_0xbf8cc2[_0xe9f2('0x66')]()),_0x528028[_0xbf8cc2]);}}return this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x133'),JSON[_0xe9f2('0x6e')](_0x528028)));}}return _0x1e38b1;};AGIVertices['prototype'][_0xe9f2('0x134')]=function(_0x8935c7){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x135'),_0x8935c7['label']));return this[_0xe9f2('0x39')][_0xe9f2('0x136')](_0x8935c7[_0xe9f2('0x40')],_0x8935c7['extension'],_0x8935c7[_0xe9f2('0x42')]);};AGIVertices['prototype'][_0xe9f2('0x137')]=function(_0x41a2d2){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x138'),_0x41a2d2[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x41a2d2[_0xe9f2('0x139')])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x41a2d2,_0xe9f2('0x13a'));}try{var _0x902edf=eval(_0x41a2d2['condition'])?_0xe9f2('0x13b'):'false';this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x41a2d2[_0xe9f2('0x139')],_0x902edf));return{'code':0xc8,'result':_0x902edf};}catch(_0x203eef){return{'code':0xc8,'result':_0xe9f2('0x13c')};}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x13d')]=function(_0x4b6807){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4b6807['label']));if(!this[_0xe9f2('0x80')](_0x4b6807[_0xe9f2('0x13e')])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x4b6807,_0xe9f2('0x13f'));}var _0x342ba0=this[_0xe9f2('0x26')][_0xe9f2('0x6b')](this,_0x4b6807[_0xe9f2('0x13e')]);if(!_0x342ba0){return this['channel'][_0xe9f2('0x2f')](_0x4b6807,'no\x20intervals\x20found');}for(var _0x1387c6=0x0;_0x1387c6<_0x342ba0['length'];_0x1387c6+=0x1){var _0x4fa56=this[_0xe9f2('0x39')]['getVariable'](util[_0xe9f2('0x2c')](_0xe9f2('0x140'),_0x342ba0[_0x1387c6]));if(_0x4fa56[_0xe9f2('0xa5')]===-0x1){return _0x4fa56;}logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x141'),_0x342ba0[_0x1387c6],_0x4fa56[_0xe9f2('0x9c')]));if(_0x4fa56['extra']===_0xe9f2('0x13b')){logger['info'](util['format'](_0xe9f2('0x141'),_0x342ba0[_0x1387c6],_0xe9f2('0x13b')));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x141'),_0x342ba0[_0x1387c6],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x141'),_0x342ba0[_0x1387c6],'false'));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format'](_0xe9f2('0x141'),_0x342ba0[_0x1387c6],_0xe9f2('0x13c')));}}return{'code':0xc8,'result':_0xe9f2('0x13c')};};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x142')]=function(_0x39ac69){logger['info'](util['format'](_0xe9f2('0x143'),_0x39ac69[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')]['hangup']();};AGIVertices[_0xe9f2('0x12')]['ispeechasr']=function(_0x48c347){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x144'),_0x48c347[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x48c347['key'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xdf'));}var _0x5497f5='wav';var _0x4d945a=util[_0xe9f2('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0xe9f2('0x111')](0x4));var _0x57be10=util[_0xe9f2('0x2c')](_0xe9f2('0x98'),_0x4d945a,_0x5497f5);var _0x1fcd3b=!![];if(_0x48c347[_0xe9f2('0x129')]===_0xe9f2('0x12a')){_0x1fcd3b=![];}var _0x5f2ce2=this[_0xe9f2('0x39')][_0xe9f2('0x12b')](_0x4d945a,_0x5497f5,_0x48c347[_0xe9f2('0x12c')],_0x48c347[_0xe9f2('0x63')],undefined,_0x1fcd3b);if(_0x5f2ce2[_0xe9f2('0xa5')]!==-0x1){this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x145'),_0x57be10));var _0x46d604=this[_0xe9f2('0x146')][_0xe9f2('0x6b')](this,_0x48c347,_0x57be10);if(_0x46d604){for(var _0x1b3b43 in _0x46d604){if(_0x46d604[_0xe9f2('0x95')](_0x1b3b43)){this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')](_0xe9f2('0x147'),_0x1b3b43['toUpperCase']()),_0x46d604[_0x1b3b43]);}}return this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x148'),JSON[_0xe9f2('0x6e')](_0x46d604)));}}return _0x5f2ce2;};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x149')]=function(_0xdf6839){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xdf6839[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0xdf6839[_0xe9f2('0x76')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xdf'));}if(!this['isConfigured'](_0xdf6839[_0xe9f2('0x59')])){return this['channel']['noop'](_0xe9f2('0xa3'));}this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x14a'),_0xdf6839['text']));var _0x2b735b=this[_0xe9f2('0x7d')][_0xe9f2('0x6b')](this,_0xdf6839);if(_0x2b735b){this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x145'),_0x2b735b));var _0x4f4d1e=this[_0xe9f2('0x39')]['streamFile'](_0x2b735b,_0xdf6839[_0xe9f2('0x12c')]);try{fs[_0xe9f2('0xf8')](_0x2b735b+_0xe9f2('0x11e'));}catch(_0x2c59de){logger[_0xe9f2('0x2f')](_0x2c59de);}return _0x4f4d1e;}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0xdf6839,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x14b')]=function(_0x50e1d4){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x14c'),_0x50e1d4[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x50e1d4[_0xe9f2('0x14d')])){return this['channel']['error'](_0x50e1d4,_0xe9f2('0x14e'));}logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe9f2('0x39')]['callerid'],_0x50e1d4[_0xe9f2('0x14d')]));var _0x8b25e3=this['agentLogin'][_0xe9f2('0x6b')](this,_0x50e1d4['findBy']);if(_0x8b25e3){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x50e1d4[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9f2('0x39')]['callerid'],_0x50e1d4[_0xe9f2('0x14d')]));return{'code':0xc8,'result':_0xe9f2('0x14f')};}else{logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x150'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x50e1d4[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x150'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x50e1d4['findBy']));return{'code':0xc8,'result':_0xe9f2('0x151')};}};AGIVertices['prototype']['logout']=function(_0x51cf83){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x152'),_0x51cf83[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x51cf83[_0xe9f2('0x14d')])){return this[_0xe9f2('0x39')]['error'](_0x51cf83,_0xe9f2('0x14e'));}logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x153'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x51cf83[_0xe9f2('0x14d')]));var _0x5adb10=this[_0xe9f2('0x51')][_0xe9f2('0x6b')](this,_0x51cf83[_0xe9f2('0x14d')]);if(_0x5adb10){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x154'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x51cf83[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x51cf83['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x150'),this[_0xe9f2('0x39')]['callerid'],_0x51cf83[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format'](_0xe9f2('0x150'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x51cf83[_0xe9f2('0x14d')]));return{'code':0xc8,'result':_0xe9f2('0x151')};}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x155')]=function(_0x58e1ce){logger[_0xe9f2('0x30')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x58e1ce[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x58e1ce[_0xe9f2('0x156')])){return this['channel']['error'](_0x58e1ce,_0xe9f2('0x157'));}this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x158'),_0x58e1ce[_0xe9f2('0x156')]));var _0x29c630=eval(_0x58e1ce[_0xe9f2('0x156')]);if(!this[_0xe9f2('0x80')](_0x58e1ce[_0xe9f2('0xce')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xcf'));}var _0x5bedb2=this[_0xe9f2('0x9b')][_0xe9f2('0x6b')](this,_0x58e1ce['variable_id']);if(!_0x5bedb2){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x58e1ce,_0xe9f2('0xd0'));}if(_[_0xe9f2('0x99')](_0x29c630)){var _0x5b09c2=this;_0x29c630[_0xe9f2('0x159')](function(_0x4f7bc8,_0x4b7dde){_0x5b09c2[_0xe9f2('0x39')]['setVariable'](util[_0xe9f2('0x2c')](_0xe9f2('0x15a'),_0x5bedb2,_0x4b7dde),_0x4f7bc8);});return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x15b'),_0x5bedb2));}else{return this[_0xe9f2('0x39')][_0xe9f2('0x9a')](_0x5bedb2,_0x29c630);}};AGIVertices[_0xe9f2('0x12')]['menu']=function(_0x182060){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x15c'),_0x182060[_0xe9f2('0x3a')]));if(_0x182060[_0xe9f2('0x9f')]===0x0){return this[_0xe9f2('0x15d')](_0x182060);}_0x182060[_0xe9f2('0x9f')]-=0x1;if(!this['isConfigured'](_0x182060['file_id'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x182060,_0xe9f2('0x108'));}var _0xc1d61d=this[_0xe9f2('0x21')][_0xe9f2('0x6b')](this,_0x182060[_0xe9f2('0x107')]);if(!_0xc1d61d){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x182060,'no\x20file\x20audio\x20found');}var _0x1c8f87=this[_0xe9f2('0x39')][_0xe9f2('0x10a')](_0xc1d61d,_0x182060[_0xe9f2('0x10b')],_0x182060[_0xe9f2('0x15e')]);var _0x21b759=_0x1c8f87[_0xe9f2('0xa5')];if(_0x1c8f87['result']===-0x1){this['createSquareDetailsReport'][_0xe9f2('0x6b')](this,_0x182060,'-1');return _0x1c8f87;}else if(_0x1c8f87[_0xe9f2('0x9c')]===_0xe9f2('0x63')){_0x1c8f87[_0xe9f2('0xa5')]=_0x1c8f87[_0xe9f2('0xa5')]['length']>0x0?_0x1c8f87[_0xe9f2('0xa5')]:'t';}else if(_[_0xe9f2('0x46')](_0x1c8f87[_0xe9f2('0xa5')])){_0x1c8f87[_0xe9f2('0xa5')]='#';_0x21b759='#';}if(!this['isConfigured'](_0x182060[_0xe9f2('0xce')])){this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xcf'));}else{var _0xb8633a=this[_0xe9f2('0x9b')]['sync'](this,_0x182060[_0xe9f2('0xce')]);if(!_0xb8633a){return this[_0xe9f2('0x39')]['error'](_0x182060,'no\x20variable\x20found');}this[_0xe9f2('0x39')]['setVariable'](_0xb8633a,_0x21b759);}this[_0xe9f2('0x38')]['sync'](this,_0x182060,_0x21b759);return _0x1c8f87;};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0xa2')]=function(_0x50d7c2){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x15f'),_0x50d7c2['label']));return this['channel']['noop'](_0x50d7c2[_0xe9f2('0x160')]||_0x50d7c2[_0xe9f2('0x3a')]);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x161')]=function(_0x1bd2fa){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1bd2fa[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x1bd2fa['findBy'])){return this[_0xe9f2('0x39')]['error'](_0x1bd2fa,_0xe9f2('0x14e'));}logger['info'](util['format'](_0xe9f2('0x153'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x1bd2fa[_0xe9f2('0x14d')]));var _0x4bcbab=this[_0xe9f2('0x4d')]['sync'](this,_0x1bd2fa[_0xe9f2('0x162')]);var _0x2b081e=this[_0xe9f2('0x4e')]['sync'](this,_0x1bd2fa['findBy'],_0x4bcbab);if(_0x2b081e){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x154'),this[_0xe9f2('0x39')]['callerid'],_0x1bd2fa[_0xe9f2('0x14d')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xe9f2('0x3c')],_0x1bd2fa[_0xe9f2('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x150'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x1bd2fa[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')]['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x154'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x1bd2fa[_0xe9f2('0x14d')]));return{'code':0xc8,'result':_0xe9f2('0x151')};}};AGIVertices['prototype'][_0xe9f2('0x163')]=function(_0x3976db){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x164'),_0x3976db[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x3976db['file_id'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x3976db,_0xe9f2('0x108'));}var _0x4b51e7=this[_0xe9f2('0x21')][_0xe9f2('0x6b')](this,_0x3976db[_0xe9f2('0x107')]);if(!_0x4b51e7){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x3976db,_0xe9f2('0x109'));}var _0xa625b6=this['channel']['exec'](_0xe9f2('0x165'),[_0x4b51e7,_0x3976db[_0xe9f2('0xdb')]]);if(_0xa625b6['result']===-0x1){return _0xa625b6;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xbb'),_0xe9f2('0x165'),_0x4b51e7));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x166')]=function(_0x50019f){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x167'),_0x50019f['label']));if(!this[_0xe9f2('0x80')](_0x50019f[_0xe9f2('0x168')])){return this[_0xe9f2('0x39')]['error'](_0x50019f,_0xe9f2('0x169'));}var _0x386578='';var _0x395c37=parseInt(_0x50019f[_0xe9f2('0x168')],0xa);if(isNaN(_0x395c37)){_0x386578=_0x50019f[_0xe9f2('0x168')];}else{_0x386578=this[_0xe9f2('0x15')]['sync'](this,_0x50019f['queue_id']);if(!_0x386578){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x50019f,_0xe9f2('0x16a'));}}var _0x2828d9='';if(this['isConfigured'](_0x50019f['file_id'])){var _0x11b910=this[_0xe9f2('0x21')][_0xe9f2('0x6b')](this,_0x50019f[_0xe9f2('0x107')]);if(_0x11b910){_0x2828d9=_0x11b910;}}this[_0xe9f2('0x38')]['sync'](this,_0x50019f,_0x386578);if(_0x50019f[_0xe9f2('0xdb')][_0xe9f2('0x16b')]('x')<0x0){_0x50019f[_0xe9f2('0xdb')]+='x';}if(_0x50019f['opts'][_0xe9f2('0x16b')]('X')<0x0){_0x50019f['opts']+='X';}this[_0xe9f2('0x39')][_0xe9f2('0x9a')](_0xe9f2('0x16c'),_0x386578?_0x386578['toLowerCase']():'');var _0x128bc3=this['channel']['exec'](_0xe9f2('0x16d'),[_0x386578,_0x50019f[_0xe9f2('0xdb')],_0x50019f['url'],_0x2828d9,_0x50019f[_0xe9f2('0x63')],_0x50019f[_0xe9f2('0x8')],_0x50019f[_0xe9f2('0x16e')],_0x50019f['gosub'],'',_0x50019f['position']]);if(_0x128bc3['result']===-0x1){return _0x128bc3;}return this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0xbb'),_0xe9f2('0x16d'),_0x386578));};AGIVertices['prototype'][_0xe9f2('0x16f')]=function(_0x48f5c2){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x48f5c2[_0xe9f2('0x3a')]));var _0x36b1b6=_0x48f5c2['recordingFormat']||'wav';var _0x59667b=util[_0xe9f2('0x2c')]('%s_%s',this[_0xe9f2('0x39')]['uniqueid'],rs[_0xe9f2('0x111')](0x5));var _0x133c1a=util['format'](_0xe9f2('0x170'),FILES_PATH,_0x59667b,_0x36b1b6);var _0x308632=util['format'](_0xe9f2('0x128'),FILES_PATH,_0x59667b);this['createSquareRecording'][_0xe9f2('0x6b')](this,_0x48f5c2,_0x59667b,_0x133c1a);this[_0xe9f2('0x39')]['setVariable'](_0xe9f2('0x171'),_0x59667b);logger[_0xe9f2('0x30')](_0xe9f2('0x172'),_0x308632,_0x36b1b6,_0x48f5c2[_0xe9f2('0x173')],_0x48f5c2['timeout']);return this[_0xe9f2('0x39')][_0xe9f2('0x12b')](_0x308632,_0x36b1b6,_0x48f5c2[_0xe9f2('0x173')],_0x48f5c2['timeout'],undefined,!![]);};AGIVertices[_0xe9f2('0x12')]['restapi']=function(_0x181c93){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x181c93[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x181c93[_0xe9f2('0x61')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0x174'));}var _0x484de9=this['restAPI'][_0xe9f2('0x6b')](this,_0x181c93);logger['info'](util['format'](_0xe9f2('0x175'),util[_0xe9f2('0x176')](_0x484de9,{'showHidden':![],'depth':null})));if(!this[_0xe9f2('0x80')](_0x181c93[_0xe9f2('0xce')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x21b6f5=this[_0xe9f2('0x9b')][_0xe9f2('0x6b')](this,_0x181c93[_0xe9f2('0xce')]);if(!_0x21b6f5){return this['channel']['error'](_0x181c93,'no\x20variable\x20found');}this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util[_0xe9f2('0x2c')]('%s_STATUS_CODE',_0x21b6f5),_0x484de9[_0xe9f2('0x70')]?_0x484de9[_0xe9f2('0x70')]:_0xe9f2('0x177'));this[_0xe9f2('0x39')][_0xe9f2('0x9a')](util['format'](_0xe9f2('0x178'),_0x21b6f5),_0x484de9['statusMessage']?_0x484de9[_0xe9f2('0x71')]:'OK');if(_0x484de9[_0xe9f2('0x67')]){try{this[_0xe9f2('0x97')](_0x484de9[_0xe9f2('0x67')],_0x21b6f5);}catch(_0x4652df){logger[_0xe9f2('0x2f')](util[_0xe9f2('0x2c')](_0xe9f2('0x179'),_0x21b6f5));}}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('variable\x20%s\x20set',_0x21b6f5));};AGIVertices[_0xe9f2('0x12')]['saydigits']=function(_0x217a80){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x217a80[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')][_0xe9f2('0x17a')](_0x217a80[_0xe9f2('0x17b')]['replace'](/\s+/g,''),_0x217a80[_0xe9f2('0x173')]);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x17c')]=function(_0x374bce){logger['info'](util['format'](_0xe9f2('0x17d'),_0x374bce['label']));return this[_0xe9f2('0x39')][_0xe9f2('0x17e')](_0x374bce['number']['replace'](/\s+/g,''),_0x374bce[_0xe9f2('0x173')]);};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x17f')]=function(_0x5a6fd0){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x180'),_0x5a6fd0[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')][_0xe9f2('0x181')](_0x5a6fd0[_0xe9f2('0x59')],_0x5a6fd0[_0xe9f2('0x173')]);};AGIVertices['prototype'][_0xe9f2('0x182')]=function(_0x4f74b4){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x183'),_0x4f74b4[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x4f74b4[_0xe9f2('0x184')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('no\x20mail\x20account\x20configured');}var _0x3ed582=this[_0xe9f2('0x24')][_0xe9f2('0x6b')](this,_0x4f74b4[_0xe9f2('0x184')]);if(!_0x3ed582||!_0x3ed582[_0xe9f2('0x185')]){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x4f74b4,_0xe9f2('0x186'));}var _0x42f439={'from':util[_0xe9f2('0x2c')](_0xe9f2('0x187'),_0x3ed582['name'],_0x3ed582[_0xe9f2('0x188')]||_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x189')]),'to':_0x4f74b4['to']||'','cc':_0x4f74b4['cc']||'','bcc':_0x4f74b4[_0xe9f2('0x18a')]||'','subject':_0x4f74b4[_0xe9f2('0x18b')],'html':_0x4f74b4['text'],'text':_0x4f74b4[_0xe9f2('0x59')]};var _0x3d6a17={'tls':{'rejectUnauthorized':![]}};if(_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x18c')]){_0x3d6a17['service']=_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x18c')];}else{_0x3d6a17[_0xe9f2('0x18d')]=_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x18d')];_0x3d6a17['port']=_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x18e')];_0x3d6a17['secure']=_0x3ed582['Smtp']['secure'];}if(_0x3ed582['Smtp']['authentication']){_0x3d6a17[_0xe9f2('0x18f')]={'user':_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x189')],'pass':_0x3ed582[_0xe9f2('0x185')][_0xe9f2('0x190')]};}if(this[_0xe9f2('0x80')](_0x4f74b4[_0xe9f2('0x191')])){}logger[_0xe9f2('0xd6')](_0xe9f2('0x192'),JSON[_0xe9f2('0x6e')](_0x42f439));this['createSquareDetailsReport']['sync'](this,_0x4f74b4,_0x4f74b4[_0xe9f2('0x184')]);this[_0xe9f2('0x39')]['noop'](util['format'](_0xe9f2('0x193'),_0x3ed582['name']));this[_0xe9f2('0x25')][_0xe9f2('0x6b')](this,_0x3d6a17,_0x42f439);return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x194'));};AGIVertices['prototype']['sendFax']=function(_0x57596f){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x195'),_0x57596f[_0xe9f2('0x3a')]));return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x196'));};AGIVertices[_0xe9f2('0x12')]['sendSMS']=function(_0x273ebd){logger['info'](util[_0xe9f2('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x273ebd[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x273ebd[_0xe9f2('0x197')])){return this['channel'][_0xe9f2('0xa2')]('no\x20sms\x20account\x20configured');}var _0x3d2306=this[_0xe9f2('0x35')][_0xe9f2('0x6b')](this,_0x273ebd[_0xe9f2('0x197')]);if(!_0x3d2306){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x273ebd,_0xe9f2('0x198'));}var _0x196960={'body':_0x273ebd[_0xe9f2('0x199')],'phone':_0x273ebd['to']||'','SmsAccountId':_0x3d2306['id']};logger[_0xe9f2('0xd6')](_0xe9f2('0x19a'),JSON[_0xe9f2('0x6e')](_0x196960));this['createSquareDetailsReport'][_0xe9f2('0x6b')](this,_0x273ebd,_0x273ebd[_0xe9f2('0x197')]);this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format'](_0xe9f2('0x19b'),_0x3d2306[_0xe9f2('0x14')]));this['createSmsMessage'][_0xe9f2('0x6b')](this,_0x196960);return this['channel'][_0xe9f2('0xa2')](_0xe9f2('0x19c'));};AGIVertices['prototype'][_0xe9f2('0x19d')]=function(_0x1dd2c6){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x19e'),_0x1dd2c6[_0xe9f2('0x3a')]));if(!this['isConfigured'](_0x1dd2c6['variable_id'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x1dd2c6,_0xe9f2('0x19f'));}var _0x343ee4=this['getVariable'][_0xe9f2('0x6b')](this,_0x1dd2c6[_0xe9f2('0xce')]);if(!_0x343ee4){return this['channel'][_0xe9f2('0x2f')](_0x1dd2c6,_0xe9f2('0xd0'));}return this[_0xe9f2('0x39')][_0xe9f2('0x9a')](_0x343ee4,_0x1dd2c6[_0xe9f2('0x1a0')]);};AGIVertices[_0xe9f2('0x12')]['start']=function(_0x33169b){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x33169b[_0xe9f2('0x3a')]));this[_0xe9f2('0x39')]['noop'](_0xe9f2('0x1a1'));if(_0x33169b[_0xe9f2('0xb1')]===_0xe9f2('0x1a2')){this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x1a3'));return this['channel'][_0xe9f2('0xb1')]();}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0x1a4'));};AGIVertices['prototype'][_0xe9f2('0x1a5')]=function(_0x51dd16){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x1a6'),_0x51dd16['label']));if(!this[_0xe9f2('0x80')](_0x51dd16[_0xe9f2('0x1a7')])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x51dd16,_0xe9f2('0x1a8'));}var _0x4fb486=this[_0xe9f2('0x17')][_0xe9f2('0x6b')](this,_0x51dd16[_0xe9f2('0x1a7')]);if(!this['isConfigured'](_0x4fb486)){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x51dd16,util[_0xe9f2('0x2c')](_0xe9f2('0x1a9'),_0x51dd16[_0xe9f2('0x1a7')]));}if(_0x4fb486===this[_0xe9f2('0x39')][_0xe9f2('0x3b')]){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x51dd16,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x51dd16,_0x4fb486);var _0x123aee=this['channel']['exec'](_0xe9f2('0x1aa'),util['format'](_0xe9f2('0x1ab'),config[_0xe9f2('0x8')][_0xe9f2('0x18d')]||_0xe9f2('0x1ac'),_0x4fb486,this['channel'][_0xe9f2('0x3b')]));if(_0x123aee[_0xe9f2('0xa5')]===-0x1){return _0x123aee;}return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('Executed\x20command\x20%s\x20%s','AGI',_0x4fb486));};AGIVertices[_0xe9f2('0x12')]['system']=function(_0x40d95d){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x1ad'),_0x40d95d[_0xe9f2('0x3a')]));var _0x4b4a6d=this[_0xe9f2('0x54')][_0xe9f2('0x6b')](this,_0x40d95d[_0xe9f2('0xb0')]);this[_0xe9f2('0x38')][_0xe9f2('0x6b')](this,_0x40d95d,_0x40d95d[_0xe9f2('0xb0')]);if(this[_0xe9f2('0x80')](_0x40d95d['variable_id'])){var _0x482e4f=this[_0xe9f2('0x9b')][_0xe9f2('0x6b')](this,_0x40d95d[_0xe9f2('0xce')]);if(_0x482e4f){this['channel'][_0xe9f2('0x9a')](_0x482e4f,_0x4b4a6d);return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x1ae'),_0x40d95d[_0xe9f2('0xb0')],_0x482e4f));}}return this[_0xe9f2('0x39')]['noop'](util['format'](_0xe9f2('0x1af'),_0x40d95d['command']));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x1b0')]=function(_0x3e0bf0){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x1b1'),_0x3e0bf0[_0xe9f2('0x3a')]));_0x3e0bf0[_0xe9f2('0x59')]=_0x3e0bf0[_0xe9f2('0x59')][_0xe9f2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe9f2('0x80')](_0x3e0bf0[_0xe9f2('0x58')])){return this[_0xe9f2('0x39')]['noop'](_0xe9f2('0x1b2'));}if(!this[_0xe9f2('0x80')](_0x3e0bf0['text'])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')](_0xe9f2('0xa3'));}this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')](_0xe9f2('0x1b3'),_0x3e0bf0[_0xe9f2('0x59')]));var _0x4887fa=this[_0xe9f2('0x57')]['sync'](this,_0x3e0bf0);if(_0x4887fa){this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4887fa));var _0x5172f1=this[_0xe9f2('0x39')][_0xe9f2('0x1b4')](_0x4887fa);try{fs[_0xe9f2('0xf8')](_0x4887fa+_0xe9f2('0x11e'));}catch(_0x2ffe39){logger[_0xe9f2('0x2f')](_0x2ffe39);}return _0x5172f1;}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x3e0bf0,_0xe9f2('0x1b5'));};AGIVertices[_0xe9f2('0x12')]['tts']=function(_0x5a2053){logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x1b6'),_0x5a2053[_0xe9f2('0x3a')]));_0x5a2053[_0xe9f2('0x59')]=_0x5a2053['text'][_0xe9f2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe9f2('0x80')](_0x5a2053[_0xe9f2('0x59')])){return this[_0xe9f2('0x39')][_0xe9f2('0xa2')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x1b7'),_0x5a2053[_0xe9f2('0x59')]));var _0x2f7128=this[_0xe9f2('0x5f')][_0xe9f2('0x6b')](this,_0x5a2053);if(_0x2f7128){this['channel']['noop'](util[_0xe9f2('0x2c')](_0xe9f2('0x1b8'),_0x2f7128));var _0x4e0122=this[_0xe9f2('0x39')]['streamFile'](_0x2f7128);try{fs[_0xe9f2('0xf8')](_0x2f7128+'.wav');}catch(_0x59e5bd){logger['error'](_0x59e5bd);}return _0x4e0122;}return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x5a2053,_0xe9f2('0x1b9'));};AGIVertices[_0xe9f2('0x12')]['unpause']=function(_0x16f2e4){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x1ba'),_0x16f2e4['label']));if(!this['isConfigured'](_0x16f2e4['findBy'])){return this[_0xe9f2('0x39')][_0xe9f2('0x2f')](_0x16f2e4,_0xe9f2('0x14e'));}logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x153'),this['channel']['callerid'],_0x16f2e4[_0xe9f2('0x14d')]));var _0x268094=this['agentUnpause'][_0xe9f2('0x6b')](this,_0x16f2e4[_0xe9f2('0x14d')]);if(_0x268094){logger[_0xe9f2('0x30')](util['format'](_0xe9f2('0x154'),this[_0xe9f2('0x39')]['callerid'],_0x16f2e4[_0xe9f2('0x14d')]));this['channel'][_0xe9f2('0xa2')](util[_0xe9f2('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9f2('0x39')]['callerid'],_0x16f2e4[_0xe9f2('0x14d')]));return{'code':0xc8,'result':_0xe9f2('0x14f')};}else{logger[_0xe9f2('0x30')](util[_0xe9f2('0x2c')](_0xe9f2('0x150'),this[_0xe9f2('0x39')][_0xe9f2('0x3c')],_0x16f2e4[_0xe9f2('0x14d')]));this[_0xe9f2('0x39')][_0xe9f2('0xa2')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe9f2('0x39')]['callerid'],_0x16f2e4['findBy']));return{'code':0xc8,'result':_0xe9f2('0x151')};}};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x1bb')]=function(_0x491088){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x1bc'),_0x491088[_0xe9f2('0x3a')]));var _0x546fc0=this[_0xe9f2('0x39')]['exec'](_0xe9f2('0x1bd'),[_0x491088['mailbox'],_0x491088[_0xe9f2('0x74')]]);if(_0x546fc0[_0xe9f2('0xa5')]===-0x1){return _0x546fc0;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xe9f2('0x1bd'),_0x491088[_0xe9f2('0x1be')]));};AGIVertices[_0xe9f2('0x12')][_0xe9f2('0x1bf')]=function(_0x44cbc6){logger['info'](util[_0xe9f2('0x2c')](_0xe9f2('0x1c0'),_0x44cbc6[_0xe9f2('0x3a')]));if(!this[_0xe9f2('0x80')](_0x44cbc6['variable_id'])){return this['channel'][_0xe9f2('0x2f')](_0x44cbc6,_0xe9f2('0x19f'));}var _0x23f45a=this[_0xe9f2('0x9b')][_0xe9f2('0x6b')](this,_0x44cbc6[_0xe9f2('0xce')]);if(!_0x23f45a){return this[_0xe9f2('0x39')]['error'](_0x44cbc6,_0xe9f2('0xd0'));}var _0x521844=this[_0xe9f2('0x39')][_0xe9f2('0x9b')](_0x23f45a);return{'code':0xc8,'result':_0x521844['extra']?_0x521844[_0xe9f2('0x9c')]:'-'};};String[_0xe9f2('0x12')][_0xe9f2('0x1c1')]=function(_0x738899,_0x26379b){return this[_0xe9f2('0x1c2')](_0x738899)[_0xe9f2('0x1c3')](_0x26379b);};module[_0xe9f2('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x5523=['isPlainObject','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','getAndSetVariable','extra','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','out','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','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','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','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','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','isEmpty','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','position','QUEUE','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','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','Smtp','no\x20mail\x20account\x20found','email','user','bcc','service','host','secure','authentication','pass','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','format','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','number','timeout','includes','POST','method','toUpperCase','body','rawBody','parse','headers','rawHeaders','computedVariables','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex'];(function(_0x431719,_0x608823){var _0x4f1df4=function(_0x172297){while(--_0x172297){_0x431719['push'](_0x431719['shift']());}};_0x4f1df4(++_0x608823);}(_0x5523,0x137));var _0x3552=function(_0x4d361f,_0x3e67bf){_0x4d361f=_0x4d361f-0x0;var _0x49d75a=_0x5523[_0x4d361f];return _0x49d75a;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x3552('0x0'));var sh=require(_0x3552('0x1'));var odbc=require(_0x3552('0x2'))();var rs=require(_0x3552('0x3'));var moment=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var rp=require(_0x3552('0x6'));var logger=require(_0x3552('0x7'))(_0x3552('0x8'));var config=require(_0x3552('0x9'));var scripts=require(_0x3552('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x3552('0xb'),'getdigits',_0x3552('0xc')];var AGIVertices=function(_0x2dee37,_0xefb0d8,_0x518eba){this['channel']=_0x2dee37;this[_0x3552('0xd')]=_0xefb0d8;this[_0x3552('0xe')]=_0x518eba;};AGIVertices[_0x3552('0xf')][_0x3552('0x10')]=function(_0x2cc8dc,_0x1b06c8){this[_0x3552('0xd')][_0x3552('0x11')](_0x2cc8dc)[_0x3552('0x12')](function(_0x8fc5be){_0x1b06c8(null,_0x8fc5be?_0x8fc5be[_0x3552('0x13')]:![]);})['catch'](function(_0x295d0d){_0x1b06c8(_0x295d0d);});};AGIVertices[_0x3552('0xf')][_0x3552('0x14')]=function(_0x504b80,_0x538549){this[_0x3552('0xd')][_0x3552('0x15')](_0x504b80)[_0x3552('0x12')](function(_0x273e61){_0x538549(null,_0x273e61?_0x273e61['name']:![]);})[_0x3552('0x16')](function(_0x268d39){_0x538549(_0x268d39);});};AGIVertices[_0x3552('0xf')][_0x3552('0x17')]=function(_0x4a8f95,_0x28dd81){this[_0x3552('0xd')][_0x3552('0x18')](_0x4a8f95)['then'](function(_0x2375c9){_0x28dd81(null,_0x2375c9?_0x2375c9[_0x3552('0x13')]:![]);})['catch'](function(_0x42261c){_0x28dd81(_0x42261c);});};AGIVertices[_0x3552('0xf')][_0x3552('0x19')]=function(_0x42fe33,_0x4d4a6d){this[_0x3552('0xd')][_0x3552('0x1a')](_0x42fe33)['then'](function(_0x26984c){_0x4d4a6d(null,_0x26984c?_0x26984c[_0x3552('0x1b')]:![]);})[_0x3552('0x16')](function(_0x404b40){_0x4d4a6d(_0x404b40);});};AGIVertices[_0x3552('0xf')]['getUser']=function(_0x2fe62c,_0x4ea201){this[_0x3552('0xd')]['getUserById'](_0x2fe62c)[_0x3552('0x12')](function(_0x3ddfb3){_0x4ea201(null,_0x3ddfb3?_0x3ddfb3['name']:![]);})[_0x3552('0x16')](function(_0x534c68){_0x4ea201(_0x534c68);});};AGIVertices[_0x3552('0xf')]['getTrunk']=function(_0x1972b7,_0x555c2d){this[_0x3552('0xd')][_0x3552('0x1c')](_0x1972b7)[_0x3552('0x12')](function(_0x2ae00a){_0x555c2d(null,_0x2ae00a?_0x2ae00a[_0x3552('0x13')]:![]);})[_0x3552('0x16')](function(_0x3818c5){_0x555c2d(_0x3818c5);});};AGIVertices[_0x3552('0xf')]['getSound']=function(_0x5d93f6,_0x7d75aa){var _0x581e41=this;this[_0x3552('0xd')][_0x3552('0x1d')](_0x5d93f6)[_0x3552('0x12')](function(_0x3200fc){_0x7d75aa(null,_0x3200fc?_0x581e41[_0x3552('0x1e')](_0x3200fc['save_name']):![]);})[_0x3552('0x16')](function(_0x478390){_0x7d75aa(_0x478390);});};AGIVertices[_0x3552('0xf')][_0x3552('0x1f')]=function(_0x212185,_0x52220d){this[_0x3552('0xd')][_0x3552('0x20')](_0x212185)['then'](function(_0xa8952e){_0x52220d(null,_0xa8952e?_0xa8952e:![]);})['catch'](function(_0x4dc7e9){_0x52220d(_0x4dc7e9);});};AGIVertices[_0x3552('0xf')][_0x3552('0x21')]=function(_0x118534,_0x268dc3,_0x43e19c){this[_0x3552('0xe')][_0x3552('0x21')](_0x118534,_0x268dc3)[_0x3552('0x12')](function(){_0x43e19c(null);})['catch'](function(_0x4dc77c){_0x43e19c(_0x4dc77c);});};AGIVertices['prototype'][_0x3552('0x22')]=function(_0x3f5d77,_0x5b9a73){this['rpc'][_0x3552('0x23')](_0x3f5d77)[_0x3552('0x12')](function(_0xc4a8ab){if(_0xc4a8ab){if(_0xc4a8ab[_0x3552('0x24')]){_0x5b9a73(null,[_0xc4a8ab[_0x3552('0x25')]]);}else{_0x5b9a73(null,_[_0x3552('0x26')](_0xc4a8ab[_0x3552('0x27')],'interval'));}}else{_0x5b9a73(null,![]);}})[_0x3552('0x16')](function(_0x390d39){_0x5b9a73(_0x390d39);});};AGIVertices[_0x3552('0xf')][_0x3552('0x1e')]=function(_0x19b87d){return util['format'](_0x3552('0x28'),FILES_PATH,_0x19b87d);};AGIVertices['prototype'][_0x3552('0x29')]=function(_0x55e65c,_0x3949c3,_0x354d78){odbc[_0x3552('0x2a')](_0x55e65c,function(_0xe9ed77){if(_0xe9ed77){logger[_0x3552('0x2b')](_0x3552('0x2c'),_0xe9ed77);_0x354d78(_0xe9ed77);}else{logger[_0x3552('0x2d')](_0x3552('0x2e'));odbc[_0x3552('0x2f')](_0x3949c3,function(_0x5d4e53,_0x148067){if(_0x5d4e53){logger[_0x3552('0x2d')]('Error\x20executing\x20query\x20%s',_0x3949c3);_0x354d78(_0x5d4e53);}else{logger[_0x3552('0x2d')](_0x3552('0x30'),_0x3949c3);odbc[_0x3552('0x31')](function(_0x1b6064){if(_0x1b6064){logger[_0x3552('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1b6064);}_0x354d78(null,_0x148067);});}});}});};AGIVertices[_0x3552('0xf')]['getSmsAccount']=function(_0x279bc0,_0x1e8d10){this['rpc'][_0x3552('0x32')](_0x279bc0)[_0x3552('0x12')](function(_0x45e746){_0x1e8d10(null,_0x45e746?_0x45e746:![]);})[_0x3552('0x16')](function(_0xaab25d){_0x1e8d10(_0xaab25d);});};AGIVertices[_0x3552('0xf')][_0x3552('0x33')]=function(_0x380c5c,_0x2912b3){this[_0x3552('0xd')][_0x3552('0x33')](_0x380c5c)[_0x3552('0x12')](function(_0x4fd496){_0x2912b3(null,_0x4fd496);})[_0x3552('0x16')](function(_0x513170){_0x2912b3(_0x513170);});};AGIVertices[_0x3552('0xf')][_0x3552('0x34')]=function(_0x45973b,_0x4238bd,_0x1849f9){this[_0x3552('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'node':_0x45973b[_0x3552('0x37')],'application':_0x45973b[_0x3552('0x38')],'data':_0x4238bd||null,'project_name':this[_0x3552('0x35')][_0x3552('0x39')],'callerid':this[_0x3552('0x35')]['callerid']})[_0x3552('0x12')](function(_0x3d51f5){if(_0x1849f9){_0x1849f9(null,_0x3d51f5);}})[_0x3552('0x16')](function(_0x915279){if(_0x1849f9){_0x1849f9(_0x915279);}});};AGIVertices[_0x3552('0xf')][_0x3552('0x3a')]=function(_0x25250a,_0x1802cd,_0x52bf34,_0x856032){this[_0x3552('0xd')][_0x3552('0x3a')]({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'callerid':this[_0x3552('0x35')][_0x3552('0x3b')],'calleridname':this[_0x3552('0x35')][_0x3552('0x3c')],'context':this['channel'][_0x3552('0x3d')],'extension':this['channel'][_0x3552('0x3e')],'priority':this[_0x3552('0x35')]['priority'],'accountcode':this['channel'][_0x3552('0x3f')],'dnid':this[_0x3552('0x35')]['dnid'],'projectName':this[_0x3552('0x35')][_0x3552('0x39')],'saveName':_0x1802cd,'filename':_0x25250a[_0x3552('0x40')]||_0x1802cd,'savePath':_0x52bf34})[_0x3552('0x12')](function(_0x382b04){_0x856032(null,_0x382b04);})['catch'](function(_0x1a9b1a){_0x856032(_0x1a9b1a);});};AGIVertices[_0x3552('0xf')][_0x3552('0x41')]=function(_0x4eff7a,_0x2a3f99,_0x343cd6,_0x3a2e89,_0x3204e6){this[_0x3552('0xd')][_0x3552('0x41')]({'uniqueid':this[_0x3552('0x35')][_0x3552('0x36')],'body':_0x4eff7a,'direction':_0x2a3f99,'providerName':_0x343cd6,'providerResponse':_0x3a2e89})[_0x3552('0x12')](function(_0x337e10){if(_0x3204e6){_0x3204e6(null,_0x337e10);}})[_0x3552('0x16')](function(_0x367daa){if(_0x3204e6){_0x3204e6(_0x367daa);}});};AGIVertices['prototype'][_0x3552('0x42')]=function(_0x10ddce,_0x3e74d9){this[_0x3552('0xd')][_0x3552('0x42')]({'firstName':_['isEmpty'](_0x10ddce['name'])||_[_0x3552('0x43')](_0x10ddce[_0x3552('0x13')])?_0x3552('0x44')+Math['random']():_0x10ddce['name'],'lastName':_['isEmpty'](_0x10ddce[_0x3552('0x45')])||_['isNil'](_0x10ddce['lastName'])?null:_0x10ddce[_0x3552('0x45')],'phone':_0x10ddce[_0x3552('0x46')],'ListId':_0x10ddce[_0x3552('0x47')],'scheduledat':_0x10ddce[_0x3552('0x48')],'callbackUniqueid':this['channel'][_0x3552('0x36')],'tags':_0x3552('0x49'),'description':_0x3552('0x4a')+_0x10ddce[_0x3552('0x48')][_0x3552('0x4b')](),'priority':_0x10ddce[_0x3552('0x4c')]})['then'](function(_0x148c57){_0x3e74d9(null,_0x148c57);})[_0x3552('0x16')](function(_0xff80d){_0x3e74d9(_0xff80d);});};AGIVertices[_0x3552('0xf')]['getPause']=function(_0x384057,_0x32e55c){this[_0x3552('0xd')][_0x3552('0x4d')](_0x384057)[_0x3552('0x12')](function(_0x139014){_0x32e55c(null,_0x139014?_0x139014['name']:![]);})[_0x3552('0x16')](function(_0x4bdea4){_0x32e55c(_0x4bdea4);});};AGIVertices['prototype'][_0x3552('0x4e')]=function(_0x306e98,_0xc8e208,_0x5016e5){var _0x520443={'role':'agent'};_0x520443[_0x306e98]=this['channel']['callerid'];this[_0x3552('0xd')][_0x3552('0x4e')](_0x520443,_0xc8e208,this[_0x3552('0x35')][_0x3552('0x36')])[_0x3552('0x12')](function(_0x79ac30){_0x5016e5(null,_['isNil'](_0x79ac30)?![]:!![]);})['catch'](function(_0x5b7876){logger[_0x3552('0x2b')](_0x5b7876);_0x5016e5(null,![]);});};AGIVertices[_0x3552('0xf')]['agentUnpause']=function(_0x4c43f3,_0x369717){var _0x42eaaf={'role':'agent'};_0x42eaaf[_0x4c43f3]=this['channel'][_0x3552('0x3b')];this[_0x3552('0xd')][_0x3552('0x4f')](_0x42eaaf)['then'](function(_0x279939){_0x369717(null,_[_0x3552('0x43')](_0x279939)?![]:!![]);})['catch'](function(_0x5c0246){logger['error'](_0x5c0246);_0x369717(null,![]);});};AGIVertices['prototype'][_0x3552('0x50')]=function(_0x2742e9,_0xf9cd58){var _0x28d0a1={'role':_0x3552('0x51')};_0x28d0a1[_0x2742e9]=this['channel']['callerid'];this['rpc'][_0x3552('0x50')](_0x28d0a1)['then'](function(_0x1abaec){_0xf9cd58(null,_[_0x3552('0x43')](_0x1abaec)?![]:!![]);})[_0x3552('0x16')](function(_0x4bf9ff){logger[_0x3552('0x2b')](_0x4bf9ff);_0xf9cd58(null,![]);});};AGIVertices[_0x3552('0xf')][_0x3552('0x52')]=function(_0x5db0e5,_0x3bcb14){var _0x168666={'role':_0x3552('0x51')};_0x168666[_0x5db0e5]=this['channel'][_0x3552('0x3b')];var _0x543b09=_0x5db0e5!=_0x3552('0x53')?util[_0x3552('0x54')]('%s/%s@from-sip/n',_0x3552('0x55'),this['channel']['callerid']):undefined;this[_0x3552('0xd')][_0x3552('0x52')](_0x168666,_0x543b09)[_0x3552('0x12')](function(_0x262055){_0x3bcb14(null,_[_0x3552('0x43')](_0x262055)?![]:!![]);})[_0x3552('0x16')](function(_0x1d345c){logger[_0x3552('0x2b')](_0x1d345c);_0x3bcb14(null,![]);});};AGIVertices[_0x3552('0xf')][_0x3552('0x56')]=function(_0xe85549,_0x3be557){sh['exec'](_[_0x3552('0x57')](_0xe85549),function(_0x422c62,_0x185a1a){var _0x2f16b6=_0x185a1a[_0x3552('0x58')](/(\r\n|\n|\r)/gm,'');_0x3be557(null,_0x2f16b6);});};AGIVertices[_0x3552('0xf')]['googleCloudTTS']=function(_0x5d1916,_0x4434a3){scripts[_0x3552('0x59')](_0x5d1916[_0x3552('0x5a')],_0x5d1916[_0x3552('0x5b')]||_0x3552('0x5c'),_0x5d1916['text'],_0x5d1916[_0x3552('0x5d')]||_0x3552('0x5e'),_0x5d1916[_0x3552('0x5f')]||_0x3552('0x60'),_0x5d1916[_0x3552('0x61')]||_0x3552('0x62'))[_0x3552('0x12')](function(_0x892e38){_0x4434a3(null,_0x892e38);})[_0x3552('0x16')](function(_0x13a74f){_0x4434a3(_0x13a74f);});};AGIVertices[_0x3552('0xf')][_0x3552('0x63')]=function(_0x50d985,_0x3b4370){scripts[_0x3552('0x63')](_0x50d985[_0x3552('0x5c')],_0x50d985[_0x3552('0x64')]||'en',0x1)['then'](function(_0x268d3e){_0x3b4370(null,_0x268d3e);})['catch'](function(_0x16694a){_0x3b4370(_0x16694a);});};AGIVertices[_0x3552('0xf')]['restAPI']=function(_0x4a8eab,_0x19d413){var _0x4e368={'uri':_0x4a8eab[_0x3552('0x65')],'method':_0x4a8eab['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a8eab['timeout'])===_0x3552('0x66')&&parseInt(_0x4a8eab[_0x3552('0x67')])>=0x1?parseInt(_0x4a8eab[_0x3552('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x3552('0x68')]([_0x3552('0x69'),'PUT'],_0x4e368[_0x3552('0x6a')][_0x3552('0x6b')]())){try{_0x4e368[_0x3552('0x6c')]=_0x4a8eab[_0x3552('0x6d')]?JSON[_0x3552('0x6e')](_0x4a8eab[_0x3552('0x6d')]):{};}catch(_0x49f6ba){logger[_0x3552('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x49f6ba);}}try{_0x4e368[_0x3552('0x6f')]=_0x4a8eab[_0x3552('0x70')]?JSON[_0x3552('0x6e')](_0x4a8eab['rawHeaders']):{};}catch(_0x1c2439){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c2439);}if(_0x4a8eab[_0x3552('0x71')]){try{var _0x290507=require(_0x4a8eab['computedVariables'])['sync'](this,_0x4e368);_0x4e368[_0x3552('0x72')]=Mustache['render'](_0x4a8eab['url'],_0x290507,{},['$$','$$']);if(_0x4e368[_0x3552('0x6f')]){_0x4e368['headers']=JSON[_0x3552('0x6e')](Mustache[_0x3552('0x73')](JSON['stringify'](_0x4e368[_0x3552('0x6f')]),_0x290507,{},['$$','$$']));}if(_0x4e368['body']){_0x4e368[_0x3552('0x6c')]=JSON[_0x3552('0x6e')](Mustache[_0x3552('0x73')](JSON[_0x3552('0x74')](_0x4e368[_0x3552('0x6c')]),_0x290507,{},['$$','$$']));}}catch(_0x201568){logger[_0x3552('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x201568);}}rp(_0x4e368)[_0x3552('0x12')](function(_0x336b58){var _0x4af7a5={'statusCode':_0x336b58['statusCode']||0xc8,'statusMessage':_0x336b58['statusMessage']||'OK','headers':_0x336b58[_0x3552('0x6f')]||{},'body':_0x336b58[_0x3552('0x6c')]||{}};_0x19d413(null,_0x4af7a5);})[_0x3552('0x16')](function(_0x130fc8){var _0x458087={'statusCode':_0x130fc8[_0x3552('0x75')]||0x1f4,'statusMessage':_0x130fc8[_0x3552('0x76')]||_0x3552('0x77'),'headers':_0x130fc8['options'][_0x3552('0x6f')]||{},'body':_0x130fc8[_0x3552('0x78')][_0x3552('0x6c')]||{}};_0x19d413(null,_0x458087);});};AGIVertices['prototype'][_0x3552('0x79')]=function(_0x462774,_0x2878dd){scripts[_0x3552('0x79')](this[_0x3552('0x35')]['uniqueid'],_0x462774['key'],_0x462774['text'],_0x462774[_0x3552('0x7a')]||'en')[_0x3552('0x12')](function(_0x24c62c){_0x2878dd(null,_0x24c62c);})[_0x3552('0x16')](function(_0x52f603){_0x2878dd(_0x52f603);});};AGIVertices[_0x3552('0xf')]['googleDialogflowV2']=function(_0x1d0357,_0x8e261b){scripts['googleDialogflowV2'](this[_0x3552('0x35')][_0x3552('0x36')],_0x1d0357['dialogflowV2_project_id'],_0x1d0357['client_email'],_0x1d0357[_0x3552('0x7b')],_0x1d0357[_0x3552('0x5c')],_0x1d0357['dialogflowV2_language']||'en')[_0x3552('0x12')](function(_0x23b7fa){_0x8e261b(null,_0x23b7fa);})[_0x3552('0x16')](function(_0x1c3943){_0x8e261b(_0x1c3943);});};AGIVertices[_0x3552('0xf')][_0x3552('0x7c')]=function(_0x50865f,_0x253ec1){scripts[_0x3552('0x7c')](this[_0x3552('0x35')],_0x50865f)[_0x3552('0x12')](function(_0x45f44a){_0x253ec1(null,_0x45f44a);})['catch'](function(_0x46f372){_0x253ec1(_0x46f372);});};AGIVertices[_0x3552('0xf')][_0x3552('0x7d')]=function(_0x20402e,_0x3dabcb){scripts[_0x3552('0x7d')](_0x20402e[_0x3552('0x7e')],_0x20402e[_0x3552('0x5c')],_0x20402e[_0x3552('0x7f')]||_0x3552('0x5e'),_0x20402e[_0x3552('0x80')])[_0x3552('0x12')](function(_0x54a71a){_0x3dabcb(null,_0x54a71a);})[_0x3552('0x16')](function(_0x636db){_0x3dabcb(_0x636db);});};AGIVertices[_0x3552('0xf')][_0x3552('0x81')]=function(_0x3ad608,_0x3f1df5,_0x373121){scripts[_0x3552('0x81')](_0x3f1df5,_0x3ad608[_0x3552('0x7e')],_0x3ad608[_0x3552('0x82')]||_0x3552('0x5e'),this[_0x3552('0x83')](_0x3ad608[_0x3552('0x84')])?_0x3ad608[_0x3552('0x84')]:undefined)[_0x3552('0x12')](function(_0x1904cc){_0x373121(null,_0x1904cc);})[_0x3552('0x16')](function(_0x4f8dc4){_0x373121(_0x4f8dc4);});};AGIVertices[_0x3552('0xf')][_0x3552('0x85')]=function(_0x46e1a5,_0x5b1502){scripts[_0x3552('0x85')](_0x46e1a5['aws_access_key_id'],_0x46e1a5[_0x3552('0x86')],_0x46e1a5[_0x3552('0x87')],_0x46e1a5[_0x3552('0x88')]||_0x3552('0x89'),_0x46e1a5['text'],_0x46e1a5[_0x3552('0x8a')]||'text')[_0x3552('0x12')](function(_0x579959){_0x5b1502(null,_0x579959);})[_0x3552('0x16')](function(_0xae3d5a){_0x5b1502(_0xae3d5a);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8b')]=function(_0x51a978,_0x35bbca){scripts[_0x3552('0x8b')](this[_0x3552('0x35')][_0x3552('0x36')],_0x51a978[_0x3552('0x8c')],_0x51a978[_0x3552('0x86')],_0x51a978[_0x3552('0x8d')],_0x51a978[_0x3552('0x5c')],_0x51a978['aws_bot_name'])[_0x3552('0x12')](function(_0x45b425){_0x35bbca(null,_0x45b425);})['catch'](function(_0x5d8b96){_0x35bbca(_0x5d8b96);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8e')]=function(_0x3541a5,_0x567cb6,_0x2708b6){scripts['googleASR'](_0x567cb6,_0x3541a5[_0x3552('0x7e')],_0x3541a5['google_asr_language']||_0x3552('0x5e'))[_0x3552('0x12')](function(_0x489050){_0x2708b6(null,_0x489050);})[_0x3552('0x16')](function(_0x21278b){_0x2708b6(_0x21278b);});};AGIVertices[_0x3552('0xf')][_0x3552('0x8f')]=function(_0x47ca2b,_0x34174f,_0xc6a064){scripts[_0x3552('0x8f')](_0x34174f,_0x47ca2b[_0x3552('0x90')],_0x47ca2b['appsecret'],_0x47ca2b[_0x3552('0x72')])[_0x3552('0x12')](function(_0x1a57ac){_0xc6a064(null,_0x1a57ac);})[_0x3552('0x16')](function(_0x195eba){_0xc6a064(_0x195eba);});};AGIVertices[_0x3552('0xf')][_0x3552('0x91')]=function(_0x57d87a){var _0x193c08=_[_0x3552('0x68')](verticesWithRetry,_0x57d87a['agicommand'])?_0x57d87a:_['clone'](_0x57d87a);for(var _0x53e9c9 in _0x193c08){if(_0x193c08[_0x3552('0x92')](_0x53e9c9)){if(_0x193c08[_0x53e9c9]&&_[_0x3552('0x93')](_0x193c08[_0x53e9c9])){if(_[_0x3552('0x68')](recursiveMapAttributes,_0x53e9c9)){_0x193c08[_0x53e9c9]=this[_0x3552('0x94')](_0x193c08[_0x53e9c9]);}else{_0x193c08[_0x53e9c9]=this[_0x3552('0x95')](_0x193c08[_0x53e9c9]);}}}}return _0x193c08;};AGIVertices[_0x3552('0xf')][_0x3552('0x96')]=function(_0x3d6b93){for(var _0x7f2bff in _0x3d6b93){if(_0x3d6b93[_0x3552('0x92')](_0x7f2bff)){if(_[_0x3552('0x97')](_0x3d6b93[_0x7f2bff])){this[_0x3552('0x96')](_0x3d6b93[_0x7f2bff]);}else if(_['isArray'](_0x3d6b93[_0x7f2bff])){for(var _0xfa805d=0x0;_0xfa805d<_0x3d6b93[_0x7f2bff][_0x3552('0x98')];_0xfa805d++){this['recursiveNodeIndex'](_0x3d6b93[_0x7f2bff][_0xfa805d]);}}else if(_['isString'](_0x3d6b93[_0x7f2bff])){_0x3d6b93[_0x7f2bff]=this[_0x3552('0x95')](_0x3d6b93[_0x7f2bff]);}}}};AGIVertices[_0x3552('0xf')]['saveRestApiResult']=function(_0x257175,_0x1a3965){for(var _0x2ed855 in _0x257175){if(_0x257175['hasOwnProperty'](_0x2ed855)){if(_[_0x3552('0x97')](_0x257175[_0x2ed855])){if(!_['isEmpty'](_0x257175[_0x2ed855])){this[_0x3552('0x99')](_0x257175[_0x2ed855],util['format'](_0x3552('0x9a'),_0x1a3965,_0x2ed855));}}else if(_[_0x3552('0x9b')](_0x257175[_0x2ed855])){for(var _0x6ed38a=0x0;_0x6ed38a<_0x257175[_0x2ed855][_0x3552('0x98')];_0x6ed38a++){this[_0x3552('0x99')](_0x257175[_0x2ed855][_0x6ed38a],util[_0x3552('0x54')](_0x3552('0x9a'),_0x1a3965,_0x2ed855+'['+_0x6ed38a+']'));}}else{if(!_[_0x3552('0x43')](_0x257175[_0x2ed855])){this['channel']['setVariable'](util[_0x3552('0x54')](_0x3552('0x9a'),_0x1a3965,_0x2ed855),_0x257175[_0x2ed855]);}}}}};AGIVertices[_0x3552('0xf')]['replaceObjectAllVariables']=function(_0x5a3694){try{var _0x5e46c6=JSON[_0x3552('0x6e')](_0x5a3694);this[_0x3552('0x96')](_0x5e46c6);return JSON[_0x3552('0x74')](_0x5e46c6);}catch(_0x467567){return this[_0x3552('0x95')](_0x5a3694);}};AGIVertices[_0x3552('0xf')]['replaceAllVariables']=function(_0x7e7723){var _0x570f03=_0x7e7723[_0x3552('0x9c')]('{');for(var _0xf06969=0x1;_0xf06969<_0x570f03[_0x3552('0x98')];_0xf06969+=0x1){var _0x8ae48a=_0x570f03[_0xf06969][_0x3552('0x9c')]('}');if(_0x8ae48a[_0x3552('0x98')]>0x1){_0x7e7723=_0x7e7723[_0x3552('0x9d')]('{'+_0x8ae48a[0x0]+'}',this[_0x3552('0x35')][_0x3552('0x10')](_0x8ae48a[0x0])['extra']||_0x8ae48a[0x0]);}}if(_0x570f03['length']===0x1){return _0x7e7723[_0x3552('0x4b')]();}return this[_0x3552('0x95')](_0x7e7723);};AGIVertices[_0x3552('0xf')][_0x3552('0x9e')]=function(_0x5c07f2,_0x355fa3){var _0x33fae8=this[_0x3552('0x35')]['getVariable'](_0x5c07f2);if(_0x33fae8['result']===-0x1){return _0x33fae8;}logger[_0x3552('0x2d')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x355fa3,_0x33fae8[_0x3552('0x9f')]));return this[_0x3552('0x35')][_0x3552('0xa0')](_0x355fa3,_0x33fae8[_0x3552('0x9f')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x83')]=function(_0x1877a4){return _0x1877a4&&_0x1877a4!=='0'&&_0x1877a4!=='-1'&&_0x1877a4!=='';};AGIVertices[_0x3552('0xf')][_0x3552('0xa1')]=function(_0x365bc1){this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x365bc1,'-');_0x365bc1[_0x3552('0xa3')]=_0x365bc1['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3552('0xf')][_0x3552('0xa4')]=function(_0xfff1c6){logger[_0x3552('0x2d')](util['format'](_0x3552('0xa5'),_0xfff1c6['label']));if(!this[_0x3552('0x83')](_0xfff1c6[_0x3552('0x5c')])){return this[_0x3552('0x35')]['noop'](_0x3552('0xa6'));}var _0x1c3598='\x22'+_0xfff1c6[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0xfff1c6[_0x3552('0x78')])){_0x1c3598+=','+_0xfff1c6[_0x3552('0x78')];}var _0x46b2a1=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xa8'),_0x1c3598);if(_0x46b2a1[_0x3552('0xa9')]===-0x1){return _0x46b2a1;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xab'),_0x1c3598));};AGIVertices[_0x3552('0xf')][_0x3552('0xac')]=function(_0x4a1b03){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xad'),_0x4a1b03[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x4a1b03[_0x3552('0xae')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xaf'));}var _0x52e2d3=_0x4a1b03[_0x3552('0xae')];if(this[_0x3552('0x83')](_0x4a1b03[_0x3552('0x78')])){_0x52e2d3+=','+_0x4a1b03[_0x3552('0x78')];}var _0x421df9=this[_0x3552('0x35')]['exec'](_0x3552('0xb0'),_0x52e2d3);if(_0x421df9[_0x3552('0xa9')]===-0x1){return _0x421df9;}var _0x367856=this['getAndSetVariable'](_0x3552('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0x367856['result']===-0x1){return _0x367856;}var _0x508fea=this['getAndSetVariable'](_0x3552('0xb2'),_0x3552('0xb3'));if(_0x508fea['result']===-0x1){return _0x508fea;}var _0x5a8316=this[_0x3552('0x9e')](_0x3552('0xb4'),_0x3552('0xb5'));if(_0x5a8316[_0x3552('0xa9')]===-0x1){return _0x5a8316;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xb6'),_0x52e2d3));};AGIVertices[_0x3552('0xf')][_0x3552('0x8')]=function(_0x57b8c9){logger[_0x3552('0x2d')](util['format'](_0x3552('0xb7'),_0x57b8c9[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x8')]([_0x57b8c9[_0x3552('0xb8')],_0x57b8c9[_0x3552('0xb9')]]);};AGIVertices[_0x3552('0xf')][_0x3552('0xba')]=function(_0x5e6ded){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5e6ded[_0x3552('0x37')]));if(this[_0x3552('0x83')](_0x5e6ded[_0x3552('0x67')])){logger['info'](util[_0x3552('0x54')](_0x3552('0xbb'),_0x5e6ded['timeout']));var _0x35a2b5=this[_0x3552('0x35')][_0x3552('0xbc')](_0x5e6ded['timeout']);if(_0x35a2b5[_0x3552('0xa9')]===-0x1){return _0x35a2b5;}}return this[_0x3552('0x35')][_0x3552('0xba')]();};AGIVertices[_0x3552('0xf')]['callback']=function(_0x397e39){logger['info'](util[_0x3552('0x54')](_0x3552('0xbd'),_0x397e39[_0x3552('0x37')]));if(!this['isConfigured'](_0x397e39[_0x3552('0x47')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x397e39,_0x3552('0xbe'));}_0x397e39[_0x3552('0x48')]=moment();if(this[_0x3552('0x83')](_0x397e39['delay'])){_0x397e39['scheduledAt']=moment()[_0x3552('0xbf')](_0x397e39['delay'],_0x3552('0xc0'));}if(!this[_0x3552('0x83')](_0x397e39[_0x3552('0x4c')])){_0x397e39['callback_priority']=0x2;}this[_0x3552('0x42')][_0x3552('0xa2')](this,_0x397e39);return this[_0x3552('0x35')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x397e39[_0x3552('0x46')],_0x397e39[_0x3552('0x47')],_0x397e39[_0x3552('0x48')]));};AGIVertices['prototype'][_0x3552('0xc1')]=function(_0x5c224c){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xc2'),_0x5c224c[_0x3552('0x37')]));var _0x597b3b=this['channel']['exec'](_0x5c224c[_0x3552('0xc3')],_0x5c224c['options']);if(_0x597b3b[_0x3552('0xa9')]===-0x1){return _0x597b3b;}return this['channel'][_0x3552('0xaa')](util['format'](_0x3552('0xc4'),_0x5c224c[_0x3552('0xc3')],_0x5c224c['options']));};AGIVertices[_0x3552('0xf')][_0x3552('0xc5')]=function(_0x13c498){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xc6'),_0x13c498[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x13c498['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}var _0x570c6f='\x22'+_0x13c498[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0x13c498[_0x3552('0x78')])){_0x570c6f+=','+_0x13c498[_0x3552('0x78')];}var _0x49c418=this[_0x3552('0x35')]['exec'](_0x3552('0xa8'),_0x570c6f);if(_0x49c418['result']===-0x1){return _0x49c418;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xab'),_0x570c6f));};AGIVertices[_0x3552('0xf')][_0x3552('0xc7')]=function(_0x247653){logger['info'](util[_0x3552('0x54')](_0x3552('0xc8'),_0x247653[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x247653[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}var _0x50ad47='\x22'+_0x247653[_0x3552('0x5c')]+'\x22';if(this[_0x3552('0x83')](_0x247653[_0x3552('0x78')])){_0x50ad47+=','+_0x247653['options'];}var _0x261185=this['channel']['exec'](_0x3552('0xa8'),_0x50ad47);if(_0x261185[_0x3552('0xa9')]===-0x1){return _0x261185;}return this['channel']['noop'](util[_0x3552('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x50ad47));};AGIVertices[_0x3552('0xf')]['lumenvoxasr']=function(_0x554c80){logger[_0x3552('0x2d')](util['format'](_0x3552('0xc9'),_0x554c80[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x554c80[_0x3552('0xae')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xaf'));}var _0x6adbf3=_0x554c80['grammar'];if(this[_0x3552('0x83')](_0x554c80[_0x3552('0x78')])){_0x6adbf3+=','+_0x554c80[_0x3552('0x78')];}var _0x47b5af=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xb0'),_0x6adbf3);if(_0x47b5af[_0x3552('0xa9')]===-0x1){return _0x47b5af;}var _0x1c5fb6=this[_0x3552('0x9e')](_0x3552('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1c5fb6[_0x3552('0xa9')]===-0x1){return _0x1c5fb6;}var _0x5a49d5=this[_0x3552('0x9e')](_0x3552('0xb2'),_0x3552('0xca'));if(_0x5a49d5[_0x3552('0xa9')]===-0x1){return _0x5a49d5;}var _0x2aa018=this[_0x3552('0x9e')]('RECOG_INSTANCE()',_0x3552('0xcb'));if(_0x2aa018[_0x3552('0xa9')]===-0x1){return _0x2aa018;}return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xb6'),_0x6adbf3));};AGIVertices[_0x3552('0xf')]['sestekasr']=function(_0x45ef35){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x45ef35[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x45ef35[_0x3552('0xae')])){return this[_0x3552('0x35')]['noop'](_0x3552('0xaf'));}var _0x108fde=_0x45ef35[_0x3552('0xae')];if(this['isConfigured'](_0x45ef35['options'])){_0x108fde+=','+_0x45ef35['options'];}var _0x3f785d=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xb0'),_0x108fde);if(_0x3f785d[_0x3552('0xa9')]===-0x1){return _0x3f785d;}var _0x2489a4=this[_0x3552('0x9e')](_0x3552('0xb1'),_0x3552('0xcc'));if(_0x2489a4[_0x3552('0xa9')]===-0x1){return _0x2489a4;}var _0x3e114a=this[_0x3552('0x9e')](_0x3552('0xb2'),_0x3552('0xcd'));if(_0x3e114a['result']===-0x1){return _0x3e114a;}var _0x13131b=this[_0x3552('0x9e')](_0x3552('0xb4'),'SESTEK_ASR_INSTANCE');if(_0x13131b[_0x3552('0xa9')]===-0x1){return _0x13131b;}return this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0xb6'),_0x108fde));};AGIVertices['prototype']['database']=function(_0xd8c41a){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xce'),_0xd8c41a['label']));if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0xcf')])){return this['channel'][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd0'));}var _0x90d599=this[_0x3552('0x19')]['sync'](this,_0xd8c41a[_0x3552('0xcf')]);if(!_0x90d599){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd1'));}if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0x2f')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xd8c41a,_0x3552('0xd2'));}var _0xe3aebf=_0xd8c41a[_0x3552('0x2f')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xd3'),_0xe3aebf));var _0x1036d8=this[_0x3552('0x29')][_0x3552('0xa2')](this,_0x90d599,_0xe3aebf);this[_0x3552('0x34')][_0x3552('0xa2')](this,_0xd8c41a,_0xe3aebf);if(!this[_0x3552('0x83')](_0xd8c41a[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xd5'));}var _0x5886db=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0xd8c41a[_0x3552('0xd4')]);if(!_0x5886db){return this[_0x3552('0x35')]['error'](_0xd8c41a,_0x3552('0xd6'));}var _0x481e70=this;_0x1036d8[_0x3552('0xd7')](function(_0x128862,_0xbbb66d){Object[_0x3552('0xd8')](_0x128862)['forEach'](function(_0x108a11){_0x481e70[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')]('%s[%s][%s]',_0x5886db,_0xbbb66d,_0x108a11),_0x128862[_0x108a11]);});});this[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')](_0x3552('0xd9'),_0x5886db),_0x1036d8[_0x3552('0x98')]);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xda'),_0x5886db));};AGIVertices[_0x3552('0xf')][_0x3552('0xdb')]=function(_0x5d05cb){logger['debug'](util['format'](_0x3552('0xdc'),_0x5d05cb[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x5d05cb[_0x3552('0xdd')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x5d05cb,_0x3552('0xde'));}var _0x3cca8e=this[_0x3552('0xdf')][_0x3552('0xa2')](this,_0x5d05cb['sip_id']);if(!_0x3cca8e){return this[_0x3552('0x35')]['error'](_0x5d05cb,_0x3552('0xe0'));}var _0x40eab6=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0xe1'),[util['format'](_0x3552('0xe2'),_0x3cca8e),_0x5d05cb[_0x3552('0x67')],_0x5d05cb['opts'],_0x5d05cb[_0x3552('0x65')]]);if(_0x40eab6[_0x3552('0xa9')]===-0x1){return _0x40eab6;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xe3'),_0x3552('0xe1')));};AGIVertices['prototype'][_0x3552('0xe4')]=function(_0x18bced){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x18bced['label']));if(!this[_0x3552('0x83')](_0x18bced['key'])){return this['channel'][_0x3552('0xaa')](_0x3552('0xe5'));}if(!this[_0x3552('0x83')](_0x18bced[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this[_0x3552('0x35')][_0x3552('0xe6')]=!![];this[_0x3552('0x34')](_0x18bced);this[_0x3552('0x41')](_0x18bced[_0x3552('0x5c')],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xe7'),_0x18bced[_0x3552('0x5c')]));var _0x1d949e=this[_0x3552('0x79')][_0x3552('0xa2')](this,_0x18bced);if(_0x1d949e){for(var _0x3111ed in _0x1d949e){if(_0x1d949e['hasOwnProperty'](_0x3111ed)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0xe8'),_0x3111ed[_0x3552('0x6b')]()),_0x1d949e[_0x3111ed]);}}this[_0x3552('0x41')](_0x1d949e[_0x3552('0xe9')],'out',_0x3552('0xe4'),'');return this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xea'),_0x1d949e[_0x3552('0xe9')]));}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18bced,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x3552('0xf')][_0x3552('0xeb')]=function(_0x776274){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0xec'),_0x776274[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x776274['dialogflowV2_project_id'])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20project_id\x20configured');}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0xed')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xee'));}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0x7b')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0xef')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xf0'));}if(!this[_0x3552('0x83')](_0x776274[_0x3552('0x5c')])){return this['channel']['noop'](_0x3552('0xa6'));}this[_0x3552('0x35')]['bot']=!![];this['createSquareDetailsReport'](_0x776274);this[_0x3552('0x41')](_0x776274[_0x3552('0x5c')],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xf1'),_0x776274['text']));var _0xa46f42=this[_0x3552('0xf2')]['sync'](this,_0x776274);if(_0xa46f42){for(var _0x4e6c8e in _0xa46f42){if(_0xa46f42[_0x3552('0x92')](_0x4e6c8e)){if(_0x4e6c8e!=='providerResponse'){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')]('DIALOGFLOW_%s',_0x4e6c8e[_0x3552('0x6b')]()),_0xa46f42[_0x4e6c8e]);}}}this[_0x3552('0x41')](_0xa46f42[_0x3552('0xe9')],_0x3552('0xf3'),_0x3552('0xeb'),_0xa46f42[_0x3552('0xf4')]);return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xf5'),_0xa46f42[_0x3552('0xe9')]));}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x776274,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3552('0xf')][_0x3552('0xf6')]=function(_0x2a2241){logger['info'](util['format'](_0x3552('0xf7'),_0x2a2241[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xf8')])){return this[_0x3552('0x35')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xf9')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20username\x20configured');}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xfa')])){return this['channel'][_0x3552('0xaa')](_0x3552('0xfb'));}if(!this[_0x3552('0x83')](_0x2a2241[_0x3552('0xfc')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}this[_0x3552('0x35')][_0x3552('0xe6')]=!![];this[_0x3552('0x34')](_0x2a2241);this[_0x3552('0x41')](_0x2a2241[_0x3552('0x5c')],'in','','');this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Trying\x20SestekNDA:\x20%s',_0x2a2241[_0x3552('0x5c')]));var _0x5ef2d3=this[_0x3552('0x7c')][_0x3552('0xa2')](this,_0x2a2241);if(_0x5ef2d3){for(var _0x4151a6 in _0x5ef2d3){if(_0x5ef2d3[_0x3552('0x92')](_0x4151a6)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')]('SESTEK_NDA_%s',_0x4151a6[_0x3552('0x6b')]()),_0x5ef2d3[_0x4151a6]);}}this['createSquareMessage'](_0x5ef2d3[_0x3552('0xe9')],_0x3552('0xf3'),_0x3552('0xf6'),'');if(_0x5ef2d3[_0x3552('0xfd')]){this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0xfe'),_0x5ef2d3[_0x3552('0xfd')]));var _0x4e30e6=this[_0x3552('0x35')][_0x3552('0xff')](_0x5ef2d3['audiofile']);try{fs[_0x3552('0x100')](_0x5ef2d3[_0x3552('0xfd')]+_0x3552('0x101'));}catch(_0x531f90){logger['error'](_0x531f90);}return _0x4e30e6;}else{return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x102'),_0x5ef2d3['speech']));}}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x2a2241,_0x3552('0x103'));};AGIVertices['prototype'][_0x3552('0x104')]=function(_0x55f869){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x105'),_0x55f869['label']));return this['channel'][_0x3552('0xaa')](_0x3552('0x104'));};AGIVertices['prototype']['ext_dial']=function(_0x111ba8){logger[_0x3552('0x2d')](util['format'](_0x3552('0x106'),_0x111ba8[_0x3552('0x37')]));var _0x19022a='';if(_0x111ba8[_0x3552('0x107')]){if(!this[_0x3552('0x83')](_0x111ba8['trunk_id'])){return this[_0x3552('0x35')]['error'](_0x111ba8,'no\x20trunk\x20selected');}else{var _0x24b1aa=parseInt(_0x111ba8[_0x3552('0x107')],0xa);if(isNaN(_0x24b1aa)){_0x19022a=_0x111ba8[_0x3552('0x107')];}else{_0x19022a=this[_0x3552('0x108')][_0x3552('0xa2')](this,_0x111ba8[_0x3552('0x107')]);if(!_0x19022a){return this[_0x3552('0x35')]['error'](_0x111ba8,'no\x20trunk\x20found');}}}}else if(_0x111ba8[_0x3552('0x109')]){_0x19022a=_0x111ba8[_0x3552('0x109')];}else{return this[_0x3552('0x35')][_0x3552('0x2b')](_0x111ba8,_0x3552('0x10a'));}var _0x4fc515=this['channel']['exec']('DIAL',[util['format'](_0x3552('0x10b'),_0x19022a,_0x111ba8[_0x3552('0x46')]),_0x111ba8[_0x3552('0x67')],_0x111ba8[_0x3552('0x10c')],_0x111ba8[_0x3552('0x65')]]);if(_0x4fc515[_0x3552('0xa9')]===-0x1){return _0x4fc515;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('Executed\x20command\x20%s',_0x3552('0xe1')));};AGIVertices[_0x3552('0xf')][_0x3552('0x10d')]=function(_0x361560){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x10e'),_0x361560[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x10d'));};AGIVertices[_0x3552('0xf')]['getdigits']=function(_0x1cf174){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1cf174[_0x3552('0x37')]));if(_0x1cf174[_0x3552('0xa3')]===0x0){return this[_0x3552('0xa1')](_0x1cf174);}_0x1cf174[_0x3552('0xa3')]-=0x1;if(!this[_0x3552('0x83')](_0x1cf174[_0x3552('0x10f')])){return this[_0x3552('0x35')]['error'](_0x1cf174,_0x3552('0x110'));}var _0x26b2c6=this[_0x3552('0x111')][_0x3552('0xa2')](this,_0x1cf174[_0x3552('0x10f')]);if(!_0x26b2c6){return this['channel'][_0x3552('0x2b')](_0x1cf174,_0x3552('0x112'));}if(!this['isConfigured'](_0x1cf174['variable_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3552('0xd5'));}var _0x5d0774=this[_0x3552('0x35')][_0x3552('0x113')](_0x26b2c6,_0x1cf174['response'],_0x1cf174[_0x3552('0x114')]);var _0x249eb1=_0x5d0774[_0x3552('0xa9')]?_0x5d0774[_0x3552('0xa9')][_0x3552('0x4b')]():'';logger[_0x3552('0x2d')](_0x3552('0x115'),JSON[_0x3552('0x74')](_0x5d0774));if(_0x5d0774[_0x3552('0xa9')]===-0x1){this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x1cf174,_0x249eb1);return _0x5d0774;}else if(_0x5d0774[_0x3552('0x9f')]===_0x3552('0x67')){_0x5d0774['result']=_0x249eb1[_0x3552('0x98')]>=parseInt(_0x1cf174[_0x3552('0x116')])?'x':'i';}else{_0x5d0774[_0x3552('0xa9')]=_0x249eb1['length']>=parseInt(_0x1cf174[_0x3552('0x116')])&&_0x249eb1[_0x3552('0x98')]<=parseInt(_0x1cf174[_0x3552('0x114')])?'x':'i';}var _0x3c71d8=this['getVariable'][_0x3552('0xa2')](this,_0x1cf174[_0x3552('0xd4')]);if(!_0x3c71d8){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x1cf174,_0x3552('0xd6'));}this['channel'][_0x3552('0xa0')](_0x3c71d8,_0x249eb1);if(this[_0x3552('0x83')](_0x1cf174[_0x3552('0x117')])){var _0xd9fade=parseInt(_0x1cf174[_0x3552('0x117')],0xa);var _0x588da1=rs[_0x3552('0x118')]({'charset':'*','length':_0xd9fade});var _0x2e765e=_0x249eb1['length'];if(_0x2e765e>0x0){if(_0x2e765e>_0xd9fade){this[_0x3552('0x34')]['sync'](this,_0x1cf174,_0x1cf174[_0x3552('0x119')]==='first'?_0x588da1+_0x249eb1['substr'](_0xd9fade):_0x249eb1[_0x3552('0x11a')](0x0,_0x2e765e-_0xd9fade)+_0x588da1);}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,rs[_0x3552('0x118')]({'charset':'*','length':_0x2e765e}));}}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,'');}}else{this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x1cf174,_0x249eb1);}return _0x5d0774;};AGIVertices['prototype'][_0x3552('0xc')]=function(_0xae3534){logger[_0x3552('0x2d')](util['format'](_0x3552('0x11b'),_0xae3534[_0x3552('0x37')]));return this[_0x3552('0x11c')](_0xae3534);};AGIVertices[_0x3552('0xf')][_0x3552('0x11d')]=function(_0x4b66b8){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4b66b8['label']));this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x4b66b8,_0x4b66b8['goalname']);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x11e'),_0x4b66b8[_0x3552('0x11f')]));};AGIVertices[_0x3552('0xf')]['awspolly']=function(_0x441227){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x120'),_0x441227[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x441227[_0x3552('0x8c')])||!this[_0x3552('0x83')](_0x441227[_0x3552('0x86')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x121'));}if(!this[_0x3552('0x83')](_0x441227['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x122'),_0x441227[_0x3552('0x5c')]));var _0x2966f0=this['awsPolly']['sync'](this,_0x441227);if(_0x2966f0){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x123'),_0x2966f0));var _0x39addb=this[_0x3552('0x35')][_0x3552('0xff')](_0x2966f0);try{fs[_0x3552('0x100')](_0x2966f0+_0x3552('0x101'));}catch(_0x1376b2){logger[_0x3552('0x2b')](_0x1376b2);}return _0x39addb;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x441227,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x10a48b){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x10a48b['label']));if(!this['isConfigured'](_0x10a48b[_0x3552('0x8c')])||!this[_0x3552('0x83')](_0x10a48b['aws_secret_access_key'])){return this['channel'][_0x3552('0xaa')](_0x3552('0x121'));}if(!this[_0x3552('0x83')](_0x10a48b[_0x3552('0x124')])){return this[_0x3552('0x35')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x3552('0x83')](_0x10a48b[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this['channel'][_0x3552('0xe6')]=!![];this['createSquareDetailsReport'](_0x10a48b);this[_0x3552('0x41')](_0x10a48b['text'],'in','','');this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x125'),_0x10a48b[_0x3552('0x5c')]));var _0x25b855=this[_0x3552('0x8b')][_0x3552('0xa2')](this,_0x10a48b);if(_0x25b855){for(var _0x1ad9ff in _0x25b855){if(_0x25b855[_0x3552('0x92')](_0x1ad9ff)&&_[_0x3552('0x93')](_0x25b855[_0x1ad9ff])){this[_0x3552('0x35')][_0x3552('0xa0')](util['format'](_0x3552('0x126'),_0x1ad9ff[_0x3552('0x6b')]()),_0x25b855[_0x1ad9ff]);}}if(_['isNil'](_0x25b855[_0x3552('0x76')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x127'));}else{this[_0x3552('0x41')](_0x25b855[_0x3552('0x76')],_0x3552('0xf3'),_0x3552('0x128'),'');return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Amazon\x20Lex\x20Result\x20%s',_0x25b855['message']));}}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x10a48b,_0x3552('0x129'));};AGIVertices['prototype'][_0x3552('0x12a')]=function(_0x1a5a79){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x12b'),_0x1a5a79[_0x3552('0x37')],_0x1a5a79[_0x3552('0x67')]));if(!this[_0x3552('0x83')](_0x1a5a79['key'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}var _0x1bd4e8=_0x3552('0x12c');var _0x380a8d=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x26b5c0=util[_0x3552('0x54')]('%s.%s',_0x380a8d,_0x1bd4e8);var _0x384e85=!![];if(_0x1a5a79[_0x3552('0x12e')]===_0x3552('0x12f')){_0x384e85=![];}var _0x2f1c6f=this[_0x3552('0x35')]['recordFile'](_0x380a8d,_0x1bd4e8,_0x1a5a79[_0x3552('0x130')],_0x1a5a79[_0x3552('0x67')],undefined,_0x384e85);if(_0x2f1c6f[_0x3552('0xa9')]!==-0x1){this['channel']['noop'](util[_0x3552('0x54')](_0x3552('0x131'),_0x26b5c0));var _0x42e59c=this[_0x3552('0x8e')][_0x3552('0xa2')](this,_0x1a5a79,_0x26b5c0);if(_0x42e59c){for(var _0x3a9a19 in _0x42e59c){if(_0x42e59c[_0x3552('0x92')](_0x3a9a19)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x132'),_0x3a9a19[_0x3552('0x6b')]()),_0x42e59c[_0x3a9a19]);}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('GoogleASR\x20Result\x20%s',JSON[_0x3552('0x74')](_0x42e59c)));}}return _0x2f1c6f;};AGIVertices[_0x3552('0xf')][_0x3552('0x133')]=function(_0x40df2a){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x134'),_0x40df2a[_0x3552('0x37')]));if(!this['isConfigured'](_0x40df2a[_0x3552('0x90')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20appid\x20configured');}if(!this[_0x3552('0x83')](_0x40df2a[_0x3552('0x135')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x136'));}var _0x16d465=_0x3552('0x12c');var _0x337ccf=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,rs[_0x3552('0x118')](0x4));var _0x53af38=util[_0x3552('0x54')](_0x3552('0x9a'),_0x337ccf,_0x16d465);var _0x3e6a11=!![];if(_0x40df2a[_0x3552('0x12e')]===_0x3552('0x12f')){_0x3e6a11=![];}var _0x51cb19=this[_0x3552('0x35')][_0x3552('0x137')](_0x337ccf,_0x16d465,_0x40df2a['intKey'],_0x40df2a[_0x3552('0x67')],undefined,_0x3e6a11);if(_0x51cb19[_0x3552('0xa9')]!==-0x1){this[_0x3552('0x35')]['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x53af38));var _0x592209=this[_0x3552('0x8f')][_0x3552('0xa2')](this,_0x40df2a,_0x53af38);if(_0x592209){for(var _0x49f7ff in _0x592209){if(_0x592209[_0x3552('0x92')](_0x49f7ff)){this[_0x3552('0x35')]['setVariable'](util[_0x3552('0x54')](_0x3552('0x138'),_0x49f7ff[_0x3552('0x6b')]()),_0x592209[_0x49f7ff]);}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x139'),JSON[_0x3552('0x74')](_0x592209)));}}return _0x51cb19;};AGIVertices[_0x3552('0xf')][_0x3552('0x13a')]=function(_0xd9c2ab){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x13b'),_0xd9c2ab[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x13c')](_0xd9c2ab[_0x3552('0x3d')],_0xd9c2ab[_0x3552('0x3e')],_0xd9c2ab['priority']);};AGIVertices[_0x3552('0xf')]['gotoif']=function(_0x148eca){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x13d'),_0x148eca[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x148eca[_0x3552('0x13e')])){return this[_0x3552('0x35')]['error'](_0x148eca,_0x3552('0x13f'));}try{var _0x595bc2=eval(_0x148eca[_0x3552('0x13e')])?_0x3552('0x140'):'false';this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x141'),_0x148eca['condition'],_0x595bc2));return{'code':0xc8,'result':_0x595bc2};}catch(_0x40e5a0){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x142')]=function(_0x465bd9){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x143'),_0x465bd9[_0x3552('0x37')]));if(!this['isConfigured'](_0x465bd9[_0x3552('0x144')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x465bd9,_0x3552('0x145'));}var _0x292a1e=this['getIntervals'][_0x3552('0xa2')](this,_0x465bd9['interval_id']);if(!_0x292a1e){return this[_0x3552('0x35')]['error'](_0x465bd9,_0x3552('0x146'));}for(var _0x26cb03=0x0;_0x26cb03<_0x292a1e[_0x3552('0x98')];_0x26cb03+=0x1){var _0x744a76=this[_0x3552('0x35')][_0x3552('0x10')](util['format']('IFTIME(%s?true:false)',_0x292a1e[_0x26cb03]));if(_0x744a76[_0x3552('0xa9')]===-0x1){return _0x744a76;}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],_0x744a76[_0x3552('0x9f')]));if(_0x744a76[_0x3552('0x9f')]===_0x3552('0x140')){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],_0x3552('0x140')));this['channel']['noop'](util[_0x3552('0x54')]('IFTIME\x20%s\x20%s',_0x292a1e[_0x26cb03],'true'));return{'code':0xc8,'result':_0x3552('0x140')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')]('IFTIME\x20%s\x20%s',_0x292a1e[_0x26cb03],_0x3552('0x148')));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x147'),_0x292a1e[_0x26cb03],'false'));}}return{'code':0xc8,'result':_0x3552('0x148')};};AGIVertices[_0x3552('0xf')][_0x3552('0x149')]=function(_0x3a6d0b){logger['info'](util[_0x3552('0x54')](_0x3552('0x14a'),_0x3a6d0b[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0x149')]();};AGIVertices['prototype'][_0x3552('0x14b')]=function(_0x113399){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x113399[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x113399['key'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}var _0x42cec5=_0x3552('0x12c');var _0xee71d7=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1edfec=util['format'](_0x3552('0x9a'),_0xee71d7,_0x42cec5);var _0x248f3e=!![];if(_0x113399[_0x3552('0x12e')]===_0x3552('0x12f')){_0x248f3e=![];}var _0x3e92b1=this[_0x3552('0x35')][_0x3552('0x137')](_0xee71d7,_0x42cec5,_0x113399['intKey'],_0x113399['timeout'],undefined,_0x248f3e);if(_0x3e92b1[_0x3552('0xa9')]!==-0x1){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x14c'),_0x1edfec));var _0xc286eb=this['ispeechASR'][_0x3552('0xa2')](this,_0x113399,_0x1edfec);if(_0xc286eb){for(var _0xe9feb3 in _0xc286eb){if(_0xc286eb[_0x3552('0x92')](_0xe9feb3)){this[_0x3552('0x35')][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x14d'),_0xe9feb3['toUpperCase']()),_0xc286eb[_0xe9feb3]);}}return this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x14e'),JSON[_0x3552('0x74')](_0xc286eb)));}}return _0x3e92b1;};AGIVertices['prototype'][_0x3552('0x14f')]=function(_0x1d86a7){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1d86a7[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x1d86a7[_0x3552('0x7e')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xe5'));}if(!this[_0x3552('0x83')](_0x1d86a7['text'])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xa6'));}this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')]('Trying\x20ispeech\x20TTS\x20%s',_0x1d86a7['text']));var _0x34ef65=this[_0x3552('0x7d')]['sync'](this,_0x1d86a7);if(_0x34ef65){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x14c'),_0x34ef65));var _0x509add=this[_0x3552('0x35')][_0x3552('0xff')](_0x34ef65,_0x1d86a7['intKey']);try{fs['unlink'](_0x34ef65+'.wav');}catch(_0x29ff54){logger[_0x3552('0x2b')](_0x29ff54);}return _0x509add;}return this['channel'][_0x3552('0x2b')](_0x1d86a7,_0x3552('0x150'));};AGIVertices[_0x3552('0xf')]['login']=function(_0x3e8287){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x151'),_0x3e8287['label']));if(!this[_0x3552('0x83')](_0x3e8287[_0x3552('0x152')])){return this['channel'][_0x3552('0x2b')](_0x3e8287,_0x3552('0x153'));}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));var _0x534b57=this[_0x3552('0x52')]['sync'](this,_0x3e8287[_0x3552('0x152')]);if(_0x534b57){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));this['channel'][_0x3552('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287['findBy']));return{'code':0xc8,'result':_0x3552('0x156')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x157'),this['channel'][_0x3552('0x3b')],_0x3e8287[_0x3552('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x158')]=function(_0x26b7c6){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x159'),_0x26b7c6['label']));if(!this[_0x3552('0x83')](_0x26b7c6['findBy'])){return this[_0x3552('0x35')]['error'](_0x26b7c6,'no\x20find\x20by\x20configured');}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x26b7c6['findBy']));var _0x94e580=this['agentLogout']['sync'](this,_0x26b7c6[_0x3552('0x152')]);if(_0x94e580){logger['info'](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')]['callerid'],_0x26b7c6[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this['channel'][_0x3552('0x3b')],_0x26b7c6[_0x3552('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this['channel']['callerid'],_0x26b7c6[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x157'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x26b7c6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3552('0xf')][_0x3552('0x15a')]=function(_0x56173e){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x15b'),_0x56173e[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x56173e[_0x3552('0x15c')])){return this['channel'][_0x3552('0x2b')](_0x56173e,_0x3552('0x15d'));}this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x15e'),_0x56173e[_0x3552('0x15c')]));var _0x520a47=eval(_0x56173e['operation']);if(!this[_0x3552('0x83')](_0x56173e['variable_id'])){return this['channel'][_0x3552('0xaa')](_0x3552('0xd5'));}var _0x53acba=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x56173e[_0x3552('0xd4')]);if(!_0x53acba){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x56173e,_0x3552('0xd6'));}if(_[_0x3552('0x9b')](_0x520a47)){var _0x20ee69=this;_0x520a47[_0x3552('0xd7')](function(_0x5abe54,_0x1d425c){_0x20ee69['channel'][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x15f'),_0x53acba,_0x1d425c),_0x5abe54);});return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x160'),_0x53acba));}else{return this['channel'][_0x3552('0xa0')](_0x53acba,_0x520a47);}};AGIVertices[_0x3552('0xf')][_0x3552('0xb')]=function(_0x45cc9d){logger['info'](util[_0x3552('0x54')](_0x3552('0x161'),_0x45cc9d[_0x3552('0x37')]));if(_0x45cc9d[_0x3552('0xa3')]===0x0){return this[_0x3552('0xa1')](_0x45cc9d);}_0x45cc9d[_0x3552('0xa3')]-=0x1;if(!this[_0x3552('0x83')](_0x45cc9d['file_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x45cc9d,'no\x20file\x20audio\x20selected');}var _0x380735=this[_0x3552('0x111')][_0x3552('0xa2')](this,_0x45cc9d[_0x3552('0x10f')]);if(!_0x380735){return this['channel'][_0x3552('0x2b')](_0x45cc9d,_0x3552('0x112'));}var _0x14068a=this[_0x3552('0x35')][_0x3552('0x113')](_0x380735,_0x45cc9d[_0x3552('0x162')],_0x45cc9d[_0x3552('0x163')]);var _0x48a5bf=_0x14068a['result'];if(_0x14068a[_0x3552('0xa9')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x45cc9d,'-1');return _0x14068a;}else if(_0x14068a[_0x3552('0x9f')]===_0x3552('0x67')){_0x14068a[_0x3552('0xa9')]=_0x14068a[_0x3552('0xa9')][_0x3552('0x98')]>0x0?_0x14068a[_0x3552('0xa9')]:'t';}else if(_[_0x3552('0x164')](_0x14068a[_0x3552('0xa9')])){_0x14068a[_0x3552('0xa9')]='#';_0x48a5bf='#';}if(!this['isConfigured'](_0x45cc9d['variable_id'])){this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0xd5'));}else{var _0x5017fb=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x45cc9d[_0x3552('0xd4')]);if(!_0x5017fb){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x45cc9d,_0x3552('0xd6'));}this[_0x3552('0x35')]['setVariable'](_0x5017fb,_0x48a5bf);}this['createSquareDetailsReport'][_0x3552('0xa2')](this,_0x45cc9d,_0x48a5bf);return _0x14068a;};AGIVertices['prototype']['noop']=function(_0x4c59d3){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x165'),_0x4c59d3[_0x3552('0x37')]));return this[_0x3552('0x35')][_0x3552('0xaa')](_0x4c59d3[_0x3552('0x166')]||_0x4c59d3[_0x3552('0x37')]);};AGIVertices['prototype'][_0x3552('0x167')]=function(_0x5cbdea){logger[_0x3552('0x2d')](util['format'](_0x3552('0x168'),_0x5cbdea[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x5cbdea[_0x3552('0x152')])){return this['channel'][_0x3552('0x2b')](_0x5cbdea,'no\x20find\x20by\x20configured');}logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x154'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));var _0x59cd40=this[_0x3552('0x169')][_0x3552('0xa2')](this,_0x5cbdea[_0x3552('0x16a')]);var _0x35adbf=this['agentPause'][_0x3552('0xa2')](this,_0x5cbdea[_0x3552('0x152')],_0x59cd40);if(_0x35adbf){logger[_0x3552('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')]['callerid'],_0x5cbdea[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this[_0x3552('0x35')][_0x3552('0x3b')],_0x5cbdea[_0x3552('0x152')]));return{'code':0xc8,'result':_0x3552('0x16b')};}};AGIVertices[_0x3552('0xf')][_0x3552('0x16c')]=function(_0x18aefc){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x16d'),_0x18aefc[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x18aefc[_0x3552('0x10f')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18aefc,_0x3552('0x110'));}var _0x5e3e1a=this[_0x3552('0x111')]['sync'](this,_0x18aefc[_0x3552('0x10f')]);if(!_0x5e3e1a){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x18aefc,'no\x20file\x20audio\x20found');}var _0x1b8ede=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x16e'),[_0x5e3e1a,_0x18aefc['opts']]);if(_0x1b8ede[_0x3552('0xa9')]===-0x1){return _0x1b8ede;}return this[_0x3552('0x35')]['noop'](util['format'](_0x3552('0xc4'),_0x3552('0x16e'),_0x5e3e1a));};AGIVertices[_0x3552('0xf')]['queue']=function(_0x3c02d9){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x16f'),_0x3c02d9[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x3c02d9[_0x3552('0x170')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3c02d9,'no\x20queue\x20selected');}var _0x1d0aca='';var _0x3cc596=parseInt(_0x3c02d9[_0x3552('0x170')],0xa);if(isNaN(_0x3cc596)){_0x1d0aca=_0x3c02d9[_0x3552('0x170')];}else{_0x1d0aca=this[_0x3552('0x14')]['sync'](this,_0x3c02d9[_0x3552('0x170')]);if(!_0x1d0aca){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3c02d9,_0x3552('0x171'));}}var _0x506dc2='';if(this[_0x3552('0x83')](_0x3c02d9[_0x3552('0x10f')])){var _0x2a32b2=this['getSound']['sync'](this,_0x3c02d9[_0x3552('0x10f')]);if(_0x2a32b2){_0x506dc2=_0x2a32b2;}}this[_0x3552('0x34')]['sync'](this,_0x3c02d9,_0x1d0aca);if(_0x3c02d9[_0x3552('0x10c')][_0x3552('0x172')]('x')<0x0){_0x3c02d9[_0x3552('0x10c')]+='x';}if(_0x3c02d9['opts'][_0x3552('0x172')]('X')<0x0){_0x3c02d9[_0x3552('0x10c')]+='X';}this[_0x3552('0x35')][_0x3552('0xa0')](_0x3552('0x173'),_0x1d0aca?_0x1d0aca['toLowerCase']():'');var _0x5059df=this[_0x3552('0x35')][_0x3552('0xa7')]('QUEUE',[_0x1d0aca,_0x3c02d9[_0x3552('0x10c')],_0x3c02d9['url'],_0x506dc2,_0x3c02d9[_0x3552('0x67')],_0x3c02d9[_0x3552('0x8')],_0x3c02d9[_0x3552('0x174')],_0x3c02d9['gosub'],'',_0x3c02d9[_0x3552('0x175')]]);if(_0x5059df[_0x3552('0xa9')]===-0x1){return _0x5059df;}return this['channel']['noop'](util['format'](_0x3552('0xc4'),_0x3552('0x176'),_0x1d0aca));};AGIVertices[_0x3552('0xf')][_0x3552('0x177')]=function(_0x307f8d){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x307f8d[_0x3552('0x37')]));var _0x353a8b=_0x307f8d[_0x3552('0x178')]||_0x3552('0x12c');var _0x4c0bf9=util[_0x3552('0x54')](_0x3552('0x179'),this[_0x3552('0x35')][_0x3552('0x36')],rs[_0x3552('0x118')](0x5));var _0x37ae9c=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x4c0bf9,_0x353a8b);var _0x50c30c=util[_0x3552('0x54')](_0x3552('0x12d'),FILES_PATH,_0x4c0bf9);this[_0x3552('0x3a')]['sync'](this,_0x307f8d,_0x4c0bf9,_0x37ae9c);this['channel'][_0x3552('0xa0')](_0x3552('0x17a'),_0x4c0bf9);logger[_0x3552('0x2d')](_0x3552('0x17b'),_0x50c30c,_0x353a8b,_0x307f8d[_0x3552('0x17c')],_0x307f8d['timeout']);return this[_0x3552('0x35')]['recordFile'](_0x50c30c,_0x353a8b,_0x307f8d['escape_digits'],_0x307f8d['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3552('0x17d')]=function(_0x10a2f4){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x17e'),_0x10a2f4[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x10a2f4[_0x3552('0x65')])){return this[_0x3552('0x35')]['noop']('no\x20url\x20configured');}var _0x4324b5=this[_0x3552('0x17f')]['sync'](this,_0x10a2f4);logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x180'),util[_0x3552('0x181')](_0x4324b5,{'showHidden':![],'depth':null})));if(!this[_0x3552('0x83')](_0x10a2f4[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x182'));}var _0x4c7b4e=this['getVariable']['sync'](this,_0x10a2f4[_0x3552('0xd4')]);if(!_0x4c7b4e){return this['channel']['error'](_0x10a2f4,_0x3552('0xd6'));}this['channel'][_0x3552('0xa0')](util[_0x3552('0x54')](_0x3552('0x183'),_0x4c7b4e),_0x4324b5[_0x3552('0x75')]?_0x4324b5[_0x3552('0x75')]:_0x3552('0x184'));this[_0x3552('0x35')][_0x3552('0xa0')](util['format'](_0x3552('0x185'),_0x4c7b4e),_0x4324b5[_0x3552('0x186')]?_0x4324b5[_0x3552('0x186')]:'OK');if(_0x4324b5[_0x3552('0x6c')]){try{this[_0x3552('0x99')](_0x4324b5[_0x3552('0x6c')],_0x4c7b4e);}catch(_0x2610f3){logger[_0x3552('0x2b')](util[_0x3552('0x54')](_0x3552('0x187'),_0x4c7b4e));}}return this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0xda'),_0x4c7b4e));};AGIVertices['prototype'][_0x3552('0x188')]=function(_0x448192){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x189'),_0x448192[_0x3552('0x37')]));return this['channel'][_0x3552('0x18a')](_0x448192[_0x3552('0x18b')]['replace'](/\s+/g,''),_0x448192[_0x3552('0x17c')]);};AGIVertices['prototype'][_0x3552('0x18c')]=function(_0x52cea5){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x18d'),_0x52cea5['label']));return this['channel'][_0x3552('0x18e')](_0x52cea5[_0x3552('0x66')]['replace'](/\s+/g,''),_0x52cea5[_0x3552('0x17c')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x18f')]=function(_0x3574b2){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x190'),_0x3574b2[_0x3552('0x37')]));return this['channel'][_0x3552('0x191')](_0x3574b2[_0x3552('0x5c')],_0x3574b2[_0x3552('0x17c')]);};AGIVertices[_0x3552('0xf')][_0x3552('0x192')]=function(_0x262c08){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x193'),_0x262c08['label']));if(!this[_0x3552('0x83')](_0x262c08[_0x3552('0x194')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20mail\x20account\x20configured');}var _0x52a473=this[_0x3552('0x1f')][_0x3552('0xa2')](this,_0x262c08[_0x3552('0x194')]);if(!_0x52a473||!_0x52a473[_0x3552('0x195')]){return this['channel']['error'](_0x262c08,_0x3552('0x196'));}var _0x428722={'from':util[_0x3552('0x54')]('\x22%s\x22\x20<%s>',_0x52a473['name'],_0x52a473[_0x3552('0x197')]||_0x52a473[_0x3552('0x195')][_0x3552('0x198')]),'to':_0x262c08['to']||'','cc':_0x262c08['cc']||'','bcc':_0x262c08[_0x3552('0x199')]||'','subject':_0x262c08['subject'],'html':_0x262c08['text'],'text':_0x262c08[_0x3552('0x5c')]};var _0x3995be={'tls':{'rejectUnauthorized':![]}};if(_0x52a473['Smtp'][_0x3552('0x19a')]){_0x3995be[_0x3552('0x19a')]=_0x52a473['Smtp']['service'];}else{_0x3995be[_0x3552('0x19b')]=_0x52a473[_0x3552('0x195')][_0x3552('0x19b')];_0x3995be['port']=_0x52a473[_0x3552('0x195')]['port'];_0x3995be[_0x3552('0x19c')]=_0x52a473[_0x3552('0x195')]['secure'];}if(_0x52a473[_0x3552('0x195')][_0x3552('0x19d')]){_0x3995be['auth']={'user':_0x52a473[_0x3552('0x195')][_0x3552('0x198')],'pass':_0x52a473[_0x3552('0x195')][_0x3552('0x19e')]};}if(this[_0x3552('0x83')](_0x262c08[_0x3552('0x19f')])){}logger[_0x3552('0x1a0')]('sendMail\x20message',JSON['stringify'](_0x428722));this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x262c08,_0x262c08['account_id']);this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x1a1'),_0x52a473[_0x3552('0x13')]));this['sendMailMessage']['sync'](this,_0x3995be,_0x428722);return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1a2'));};AGIVertices[_0x3552('0xf')][_0x3552('0x1a3')]=function(_0x43f822){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1a4'),_0x43f822[_0x3552('0x37')]));return this[_0x3552('0x35')]['noop'](_0x3552('0x1a5'));};AGIVertices[_0x3552('0xf')]['sendSMS']=function(_0x39ce96){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1a6'),_0x39ce96[_0x3552('0x37')]));if(!this[_0x3552('0x83')](_0x39ce96[_0x3552('0x1a7')])){return this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1a8'));}var _0x4f5a6f=this['getSmsAccount'][_0x3552('0xa2')](this,_0x39ce96[_0x3552('0x1a7')]);if(!_0x4f5a6f){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x39ce96,_0x3552('0x1a9'));}var _0xefbad9={'body':_0x39ce96[_0x3552('0x1aa')],'phone':_0x39ce96['to']||'','SmsAccountId':_0x4f5a6f['id']};logger[_0x3552('0x1a0')](_0x3552('0x1ab'),JSON[_0x3552('0x74')](_0xefbad9));this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x39ce96,_0x39ce96[_0x3552('0x1a7')]);this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x1ac'),_0x4f5a6f[_0x3552('0x13')]));this[_0x3552('0x33')][_0x3552('0xa2')](this,_0xefbad9);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3552('0xf')]['set']=function(_0x20a25c){logger[_0x3552('0x2d')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x20a25c['label']));if(!this['isConfigured'](_0x20a25c[_0x3552('0xd4')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x20a25c,_0x3552('0x1ad'));}var _0x2264aa=this['getVariable'][_0x3552('0xa2')](this,_0x20a25c['variable_id']);if(!_0x2264aa){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x20a25c,_0x3552('0xd6'));}return this[_0x3552('0x35')][_0x3552('0xa0')](_0x2264aa,_0x20a25c[_0x3552('0x1ae')]);};AGIVertices['prototype'][_0x3552('0x1af')]=function(_0x1192fc){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1192fc['label']));this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1b0'));if(_0x1192fc[_0x3552('0xba')]==='yes'){this[_0x3552('0x35')][_0x3552('0xaa')](_0x3552('0x1b1'));return this[_0x3552('0x35')][_0x3552('0xba')]();}return this[_0x3552('0x35')][_0x3552('0xaa')]('Skipped\x20Answer');};AGIVertices[_0x3552('0xf')][_0x3552('0x1b2')]=function(_0x39825e){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x39825e['label']));if(!this[_0x3552('0x83')](_0x39825e[_0x3552('0x1b3')])){return this['channel'][_0x3552('0x2b')](_0x39825e,_0x3552('0x1b4'));}var _0x413d79=this[_0x3552('0x17')][_0x3552('0xa2')](this,_0x39825e[_0x3552('0x1b3')]);if(!this[_0x3552('0x83')](_0x413d79)){return this[_0x3552('0x35')]['error'](_0x39825e,util[_0x3552('0x54')](_0x3552('0x1b5'),_0x39825e[_0x3552('0x1b3')]));}if(_0x413d79===this[_0x3552('0x35')]['arg_1']){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x39825e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x3552('0x34')]['sync'](this,_0x39825e,_0x413d79);var _0x1ba80f=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x1b6'),util[_0x3552('0x54')](_0x3552('0x1b7'),config[_0x3552('0x8')]['host']||_0x3552('0x1b8'),_0x413d79,this[_0x3552('0x35')][_0x3552('0x39')]));if(_0x1ba80f['result']===-0x1){return _0x1ba80f;}return this['channel']['noop'](util[_0x3552('0x54')]('Executed\x20command\x20%s\x20%s',_0x3552('0x1b6'),_0x413d79));};AGIVertices[_0x3552('0xf')][_0x3552('0x1b9')]=function(_0x307a3c){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x1ba'),_0x307a3c[_0x3552('0x37')]));var _0x4d2459=this[_0x3552('0x56')]['sync'](this,_0x307a3c[_0x3552('0xb8')]);this[_0x3552('0x34')][_0x3552('0xa2')](this,_0x307a3c,_0x307a3c[_0x3552('0xb8')]);if(this[_0x3552('0x83')](_0x307a3c[_0x3552('0xd4')])){var _0x5d9258=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0x307a3c[_0x3552('0xd4')]);if(_0x5d9258){this[_0x3552('0x35')][_0x3552('0xa0')](_0x5d9258,_0x4d2459);return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bb'),_0x307a3c[_0x3552('0xb8')],_0x5d9258));}}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bc'),_0x307a3c['command']));};AGIVertices[_0x3552('0xf')][_0x3552('0x1bd')]=function(_0x54f44a){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1be'),_0x54f44a[_0x3552('0x37')]));_0x54f44a['text']=_0x54f44a[_0x3552('0x5c')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x54f44a[_0x3552('0x5a')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20apiKey\x20configured');}if(!this[_0x3552('0x83')](_0x54f44a[_0x3552('0x5c')])){return this[_0x3552('0x35')][_0x3552('0xaa')]('no\x20text\x20configured');}this['channel'][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1bf'),_0x54f44a[_0x3552('0x5c')]));var _0x58c12c=this[_0x3552('0x59')][_0x3552('0xa2')](this,_0x54f44a);if(_0x58c12c){this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x1c0'),_0x58c12c));var _0x583b6f=this[_0x3552('0x35')]['streamFile'](_0x58c12c);try{fs['unlink'](_0x58c12c+'.wav');}catch(_0x942796){logger[_0x3552('0x2b')](_0x942796);}return _0x583b6f;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x54f44a,_0x3552('0x1c1'));};AGIVertices[_0x3552('0xf')][_0x3552('0x1c2')]=function(_0x3b5537){logger['info'](util[_0x3552('0x54')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3b5537[_0x3552('0x37')]));_0x3b5537[_0x3552('0x5c')]=_0x3b5537[_0x3552('0x5c')][_0x3552('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3552('0x83')](_0x3b5537[_0x3552('0x5c')])){return this['channel']['noop'](_0x3552('0xa6'));}this[_0x3552('0x35')]['noop'](util['format'](_0x3552('0x1c3'),_0x3b5537[_0x3552('0x5c')]));var _0x3412e9=this[_0x3552('0x63')]['sync'](this,_0x3b5537);if(_0x3412e9){this[_0x3552('0x35')]['noop'](util[_0x3552('0x54')](_0x3552('0x1c4'),_0x3412e9));var _0x282e0e=this[_0x3552('0x35')][_0x3552('0xff')](_0x3412e9);try{fs[_0x3552('0x100')](_0x3412e9+'.wav');}catch(_0x1539dc){logger[_0x3552('0x2b')](_0x1539dc);}return _0x282e0e;}return this[_0x3552('0x35')][_0x3552('0x2b')](_0x3b5537,_0x3552('0x1c5'));};AGIVertices[_0x3552('0xf')]['unpause']=function(_0x346028){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1c6'),_0x346028['label']));if(!this[_0x3552('0x83')](_0x346028[_0x3552('0x152')])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0x346028,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3552('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3552('0x35')][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));var _0x3a937=this[_0x3552('0x4f')][_0x3552('0xa2')](this,_0x346028[_0x3552('0x152')]);if(_0x3a937){logger[_0x3552('0x2d')](util[_0x3552('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3552('0x35')]['callerid'],_0x346028[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0x155'),this['channel'][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));return{'code':0xc8,'result':_0x3552('0x156')};}else{logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x157'),this['channel'][_0x3552('0x3b')],_0x346028[_0x3552('0x152')]));this[_0x3552('0x35')][_0x3552('0xaa')](util['format'](_0x3552('0x157'),this[_0x3552('0x35')]['callerid'],_0x346028[_0x3552('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x471edc){logger[_0x3552('0x2d')](util[_0x3552('0x54')](_0x3552('0x1c7'),_0x471edc[_0x3552('0x37')]));var _0x143e23=this[_0x3552('0x35')][_0x3552('0xa7')](_0x3552('0x1c8'),[_0x471edc[_0x3552('0x1c9')],_0x471edc[_0x3552('0x78')]]);if(_0x143e23[_0x3552('0xa9')]===-0x1){return _0x143e23;}return this[_0x3552('0x35')][_0x3552('0xaa')](util[_0x3552('0x54')](_0x3552('0xc4'),_0x3552('0x1c8'),_0x471edc[_0x3552('0x1c9')]));};AGIVertices[_0x3552('0xf')][_0x3552('0x1ca')]=function(_0xe7b23c){logger[_0x3552('0x2d')](util['format'](_0x3552('0x1cb'),_0xe7b23c['label']));if(!this['isConfigured'](_0xe7b23c['variable_id'])){return this[_0x3552('0x35')][_0x3552('0x2b')](_0xe7b23c,_0x3552('0x1ad'));}var _0x41038a=this[_0x3552('0x10')][_0x3552('0xa2')](this,_0xe7b23c[_0x3552('0xd4')]);if(!_0x41038a){return this[_0x3552('0x35')]['error'](_0xe7b23c,_0x3552('0xd6'));}var _0x512b7d=this[_0x3552('0x35')][_0x3552('0x10')](_0x41038a);return{'code':0xc8,'result':_0x512b7d['extra']?_0x512b7d[_0x3552('0x9f')]:'-'};};String['prototype'][_0x3552('0x9d')]=function(_0x57a054,_0x2982e8){return this[_0x3552('0x9c')](_0x57a054)[_0x3552('0x1cc')](_0x2982e8);};module[_0x3552('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 37cba4c..1c73551 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x25b30b,_0x88b892){var _0x2df252=function(_0x39a549){while(--_0x39a549){_0x25b30b['push'](_0x25b30b['shift']());}};_0x2df252(++_0x88b892);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x290b71,_0xb55d95){var _0x1e8747=function(_0x371910){while(--_0x371910){_0x290b71['push'](_0x290b71['shift']());}};_0x1e8747(++_0xb55d95);}(_0x7a54,0x106));var _0x47a5=function(_0x5c5334,_0x51fc69){_0x5c5334=_0x5c5334-0x0;var _0x4e4b9f=_0x7a54[_0x5c5334];return _0x4e4b9f;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 2a83ff9..cfa7877 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 _0x07dd=['actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','error','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','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'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x07dd,0x105));var _0xd07d=function(_0x3a593e,_0x49edac){_0x3a593e=_0x3a593e-0x0;var _0x44075c=_0x07dd[_0x3a593e];return _0x44075c;};'use strict';var Manager=require(_0xd07d('0x0'));var BPromise=require(_0xd07d('0x1'));var moment=require(_0xd07d('0x2'));var util=require(_0xd07d('0x3'));var _=require(_0xd07d('0x4'));var logger=require('../../config/logger')('ami');var config=require(_0xd07d('0x5'));var ami=new Manager(config[_0xd07d('0x6')][_0xd07d('0x7')],config['asterisk']['ip'],config['asterisk'][_0xd07d('0x8')],config['asterisk'][_0xd07d('0x9')],!![]);ami[_0xd07d('0xa')]();ami[_0xd07d('0xb')]=BPromise[_0xd07d('0xc')](ami['action']);function error(_0x4fcc41){logger['error'](util[_0xd07d('0xd')](_0xd07d('0xe'),config[_0xd07d('0x6')][_0xd07d('0x8')],config[_0xd07d('0x6')]['ip'],config[_0xd07d('0x6')][_0xd07d('0x7')],util[_0xd07d('0xf')](_0x4fcc41,![],null)));}function close(){logger['error'](util[_0xd07d('0xd')](_0xd07d('0x10'),config[_0xd07d('0x6')][_0xd07d('0x8')],config[_0xd07d('0x6')]['ip'],config[_0xd07d('0x6')][_0xd07d('0x7')]));}ami[_0xd07d('0x11')]=function(){return function(){return ami[_0xd07d('0xb')]({'action':_0xd07d('0x12')});};};ami[_0xd07d('0x13')]=function(){return function(){return ami[_0xd07d('0xb')]({'action':_0xd07d('0x14')});};};ami[_0xd07d('0x15')]=function(){return function(){return ami[_0xd07d('0xb')]({'action':_0xd07d('0x16')});};};ami[_0xd07d('0x17')]=function(){return function(){return ami[_0xd07d('0xb')]({'action':_0xd07d('0x18')});};};ami[_0xd07d('0x19')]=function(){return function(){return ami[_0xd07d('0xb')]({'action':_0xd07d('0x1a')});};};function connect(_0x16c416){logger[_0xd07d('0x1b')](util[_0xd07d('0xd')](_0xd07d('0x1c'),config['asterisk'][_0xd07d('0x8')],config['asterisk']['ip'],config[_0xd07d('0x6')][_0xd07d('0x7')]));ami[_0xd07d('0x1d')]('error',error);ami[_0xd07d('0x1d')](_0xd07d('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0xd07d('0x1f'),function(_0x249e85){logger[_0xd07d('0x1b')](util[_0xd07d('0xd')](_0xd07d('0x20'),config[_0xd07d('0x6')]['username'],config[_0xd07d('0x6')]['ip'],config[_0xd07d('0x6')][_0xd07d('0x7')],util[_0xd07d('0xf')](_0x249e85,![],null)));});ami['on'](_0xd07d('0x21'),function(_0x1496cb){logger[_0xd07d('0x1b')](util[_0xd07d('0xd')](_0xd07d('0x22'),config[_0xd07d('0x6')]['username'],config['asterisk']['ip'],config[_0xd07d('0x6')][_0xd07d('0x7')]));return BPromise[_0xd07d('0x23')]()[_0xd07d('0x24')](ami[_0xd07d('0x11')]())[_0xd07d('0x24')](ami[_0xd07d('0x13')]())[_0xd07d('0x24')](ami['actionSipPeerStatus']())[_0xd07d('0x24')](ami[_0xd07d('0x17')]())[_0xd07d('0x24')](ami[_0xd07d('0x19')]())['catch'](function(_0x1be170){console[_0xd07d('0x25')](_0x1be170);});});ami[_0xd07d('0x1d')](_0xd07d('0x26'),error);ami[_0xd07d('0x1d')]('close',close);module[_0xd07d('0x27')]=ami; \ No newline at end of file +var _0xd4e7=['actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels','catch','log','close','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0xd4e7,0x16b));var _0x7d4e=function(_0x2b72e4,_0x1b7d0b){_0x2b72e4=_0x2b72e4-0x0;var _0x356792=_0xd4e7[_0x2b72e4];return _0x356792;};'use strict';var Manager=require(_0x7d4e('0x0'));var BPromise=require(_0x7d4e('0x1'));var moment=require('moment');var util=require(_0x7d4e('0x2'));var _=require('lodash');var logger=require(_0x7d4e('0x3'))('ami');var config=require(_0x7d4e('0x4'));var ami=new Manager(config[_0x7d4e('0x5')][_0x7d4e('0x6')],config[_0x7d4e('0x5')]['ip'],config['asterisk'][_0x7d4e('0x7')],config[_0x7d4e('0x5')][_0x7d4e('0x8')],!![]);ami[_0x7d4e('0x9')]();ami[_0x7d4e('0xa')]=BPromise[_0x7d4e('0xb')](ami[_0x7d4e('0xc')]);function error(_0x17619f){logger[_0x7d4e('0xd')](util[_0x7d4e('0xe')](_0x7d4e('0xf'),config['asterisk'][_0x7d4e('0x7')],config['asterisk']['ip'],config[_0x7d4e('0x5')]['port'],util[_0x7d4e('0x10')](_0x17619f,![],null)));}function close(){logger['error'](util[_0x7d4e('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x7d4e('0x5')][_0x7d4e('0x7')],config['asterisk']['ip'],config['asterisk'][_0x7d4e('0x6')]));}ami[_0x7d4e('0x11')]=function(){return function(){return ami[_0x7d4e('0xa')]({'action':_0x7d4e('0x12')});};};ami[_0x7d4e('0x13')]=function(){return function(){return ami[_0x7d4e('0xa')]({'action':_0x7d4e('0x14')});};};ami[_0x7d4e('0x15')]=function(){return function(){return ami[_0x7d4e('0xa')]({'action':'sippeerstatus'});};};ami[_0x7d4e('0x16')]=function(){return function(){return ami[_0x7d4e('0xa')]({'action':_0x7d4e('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x7d4e('0xa')]({'action':_0x7d4e('0x18')});};};function connect(_0x28fb5b){logger[_0x7d4e('0x19')](util[_0x7d4e('0xe')](_0x7d4e('0x1a'),config[_0x7d4e('0x5')][_0x7d4e('0x7')],config[_0x7d4e('0x5')]['ip'],config[_0x7d4e('0x5')][_0x7d4e('0x6')]));ami[_0x7d4e('0x1b')](_0x7d4e('0xd'),error);ami['once']('close',close);}ami['on'](_0x7d4e('0x1c'),connect);ami['on'](_0x7d4e('0x1d'),function(_0x17071c){logger[_0x7d4e('0x19')](util[_0x7d4e('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7d4e('0x5')][_0x7d4e('0x7')],config['asterisk']['ip'],config[_0x7d4e('0x5')][_0x7d4e('0x6')],util['inspect'](_0x17071c,![],null)));});ami['on'](_0x7d4e('0x1e'),function(_0x2cafe1){logger[_0x7d4e('0x19')](util['format'](_0x7d4e('0x1f'),config[_0x7d4e('0x5')][_0x7d4e('0x7')],config[_0x7d4e('0x5')]['ip'],config[_0x7d4e('0x5')]['port']));return BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x7d4e('0x20')](ami[_0x7d4e('0x13')]())[_0x7d4e('0x20')](ami[_0x7d4e('0x15')]())['then'](ami['actionQueueSummary']())[_0x7d4e('0x20')](ami[_0x7d4e('0x21')]())[_0x7d4e('0x22')](function(_0x2506ef){console[_0x7d4e('0x23')](_0x2506ef);});});ami['once'](_0x7d4e('0xd'),error);ami[_0x7d4e('0x1b')](_0x7d4e('0x24'),close);module[_0x7d4e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c8f3145..a99e0d4 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 _0xc59c=['catch','exports','jayson/promise','ami','client','Request','request','rpc','memberReport','error','message','result'];(function(_0x7670a7,_0x5d628a){var _0xb6bb41=function(_0x11c7dc){while(--_0x11c7dc){_0x7670a7['push'](_0x7670a7['shift']());}};_0xb6bb41(++_0x5d628a);}(_0xc59c,0x9e));var _0xcc59=function(_0xb54b31,_0x4ac97c){_0xb54b31=_0xb54b31-0x0;var _0x49d88b=_0xc59c[_0xb54b31];return _0x49d88b;};'use strict';var jayson=require(_0xcc59('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xcc59('0x1'));var client=jayson[_0xcc59('0x2')]['http']({'port':0x2329});client[_0xcc59('0x3')]=function(_0x55d06b,_0x5c6f04){return new BPromise(function(_0x3f5a52,_0x3b91f8){return client[_0xcc59('0x4')](_0x55d06b,_0x5c6f04)['then'](function(_0x150bd0){logger['debug']('rpc','memberReport',_0x55d06b,_0x5c6f04,_0x150bd0);if(_0x150bd0['error']){logger['error'](_0xcc59('0x5'),_0xcc59('0x6'),_0x55d06b,_0x150bd0[_0xcc59('0x7')][_0xcc59('0x8')],_0x5c6f04);return _0x3b91f8(_0x150bd0[_0xcc59('0x7')][_0xcc59('0x8')]);}else{return _0x3f5a52(_0x150bd0[_0xcc59('0x9')]);}})[_0xcc59('0xa')](function(_0x1531e7){logger[_0xcc59('0x7')](_0xcc59('0x5'),'memberReport',_0x55d06b,_0x1531e7,_0x5c6f04);return _0x3b91f8(_0x1531e7);});});};module[_0xcc59('0xb')]=client; \ No newline at end of file +var _0xcf74=['rpc','memberReport','error','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client','Request','request','debug'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xcf74,0x1bf));var _0x4cf7=function(_0x52aefe,_0x5ae1e8){_0x52aefe=_0x52aefe-0x0;var _0xbf48c5=_0xcf74[_0x52aefe];return _0xbf48c5;};'use strict';var jayson=require(_0x4cf7('0x0'));var BPromise=require(_0x4cf7('0x1'));var logger=require(_0x4cf7('0x2'))(_0x4cf7('0x3'));var client=jayson[_0x4cf7('0x4')]['http']({'port':0x2329});client[_0x4cf7('0x5')]=function(_0x1d8381,_0x3e1a54){return new BPromise(function(_0x583e3e,_0x50e5a4){return client[_0x4cf7('0x6')](_0x1d8381,_0x3e1a54)['then'](function(_0x5a5389){logger[_0x4cf7('0x7')](_0x4cf7('0x8'),_0x4cf7('0x9'),_0x1d8381,_0x3e1a54,_0x5a5389);if(_0x5a5389[_0x4cf7('0xa')]){logger[_0x4cf7('0xa')](_0x4cf7('0x8'),_0x4cf7('0x9'),_0x1d8381,_0x5a5389[_0x4cf7('0xa')]['message'],_0x3e1a54);return _0x50e5a4(_0x5a5389[_0x4cf7('0xa')]['message']);}else{return _0x583e3e(_0x5a5389['result']);}})[_0x4cf7('0xb')](function(_0x305c5d){logger['error'](_0x4cf7('0x8'),_0x4cf7('0x9'),_0x1d8381,_0x305c5d,_0x3e1a54);return _0x50e5a4(_0x305c5d);});});};module[_0x4cf7('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 73aa83c..3edfc36 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 _0x98d8=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','util','lodash','moment','isNil','voiceQueue','name','phone','Contact','firstName','lastName','number','queue','active','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98d8,0xce));var _0x898d=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x98d8[_0xa3fadc];return _0x23ecb8;};'use strict';var util=require(_0x898d('0x0'));var _=require(_0x898d('0x1'));var moment=require(_0x898d('0x2'));function checkNameSurname(_0x3c60b1,_0x2fa03d,_0x15dafc){var _0x114ad8='';if(!_['isNil'](_0x2fa03d)&&'string'===typeof _0x2fa03d){_0x114ad8+=_0x2fa03d;}if(!_[_0x898d('0x3')](_0x15dafc)&&'string'===typeof _0x15dafc){_0x114ad8+='\x20'+_0x15dafc;}if(_0x114ad8!==''){return _0x114ad8;}return _0x3c60b1;}function Action(_0x4a1bc3,_0x4047bd,_0x5215bf){this[_0x898d('0x4')]=_0x4a1bc3;this['uniqueid']=_0x5215bf||undefined;this[_0x898d('0x5')]=checkNameSurname(_0x4047bd['Contact'][_0x898d('0x6')],_0x4047bd[_0x898d('0x7')][_0x898d('0x8')],_0x4047bd[_0x898d('0x7')][_0x898d('0x9')]);this[_0x898d('0xa')]=_0x4047bd[_0x898d('0x7')][_0x898d('0x6')];this[_0x898d('0xb')]=_0x4a1bc3[_0x898d('0x5')];this[_0x898d('0xc')]=_0x4047bd[_0x898d('0xc')]||![];this[_0x898d('0xd')]=_0x4a1bc3[_0x898d('0xd')];this[_0x898d('0xe')]=_0x4a1bc3['dialQueueTimeout']||0x3;this[_0x898d('0xf')]=_0x4047bd[_0x898d('0xf')];this['countbusyretry']=_0x4047bd[_0x898d('0x10')];this[_0x898d('0x11')]=_0x4047bd[_0x898d('0x11')];this[_0x898d('0x12')]=_0x4047bd[_0x898d('0x12')];this[_0x898d('0x13')]=_0x4047bd[_0x898d('0x13')];this['countdropretry']=_0x4047bd[_0x898d('0x14')];this[_0x898d('0x15')]=_0x4047bd['countabandonedretry'];this['countmachineretry']=_0x4047bd[_0x898d('0x16')];this[_0x898d('0x17')]=_0x4047bd[_0x898d('0x17')];this[_0x898d('0x18')]=_0x4047bd[_0x898d('0x18')];this[_0x898d('0x19')]=_0x4047bd['ListId'];this['UserId']=_0x4047bd[_0x898d('0x1a')];this[_0x898d('0x1b')]=_0x4047bd[_0x898d('0x1b')];this[_0x898d('0x1c')]=_0x4047bd[_0x898d('0x1c')];this[_0x898d('0x1d')]=_0x4047bd['id'];this[_0x898d('0x1e')]=_0x4047bd[_0x898d('0x7')][_0x898d('0x8')]||'';this[_0x898d('0x1f')]=moment()[_0x898d('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x898d('0x21')]=_0x4047bd[_0x898d('0x21')];this[_0x898d('0x22')]=_0x4047bd['callbackuniqueid'];this['callbackat']=_0x4047bd[_0x898d('0x23')];this[_0x898d('0x24')]=_0x4047bd[_0x898d('0x24')];this[_0x898d('0x25')]='';this[_0x898d('0x26')]='';}Action[_0x898d('0x27')][_0x898d('0x28')]=function(){return util[_0x898d('0x20')](_0x898d('0x29'),this['name'],this['voiceQueue'][_0x898d('0x2a')]>0x0?this[_0x898d('0xa')][_0x898d('0x2b')](this[_0x898d('0x4')][_0x898d('0x2a')]):this[_0x898d('0xa')]);};Action[_0x898d('0x27')]['getQueue']=function(){return this[_0x898d('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x99cd=['prototype','getCaller','voiceQueue','substring','getQueue','exports','util','moment','isNil','string','uniqueid','phone','Contact','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x5cf71f,_0xb7ca87){var _0x512efd=function(_0x33a4a9){while(--_0x33a4a9){_0x5cf71f['push'](_0x5cf71f['shift']());}};_0x512efd(++_0xb7ca87);}(_0x99cd,0x1df));var _0xd99c=function(_0x351163,_0x38b99d){_0x351163=_0x351163-0x0;var _0x422703=_0x99cd[_0x351163];return _0x422703;};'use strict';var util=require(_0xd99c('0x0'));var _=require('lodash');var moment=require(_0xd99c('0x1'));function checkNameSurname(_0x146718,_0x1ed35b,_0x39359c){var _0x3aa3b2='';if(!_[_0xd99c('0x2')](_0x1ed35b)&&_0xd99c('0x3')===typeof _0x1ed35b){_0x3aa3b2+=_0x1ed35b;}if(!_[_0xd99c('0x2')](_0x39359c)&&_0xd99c('0x3')===typeof _0x39359c){_0x3aa3b2+='\x20'+_0x39359c;}if(_0x3aa3b2!==''){return _0x3aa3b2;}return _0x146718;}function Action(_0x3997a1,_0x5170e7,_0x87a727){this['voiceQueue']=_0x3997a1;this[_0xd99c('0x4')]=_0x87a727||undefined;this['name']=checkNameSurname(_0x5170e7['Contact'][_0xd99c('0x5')],_0x5170e7[_0xd99c('0x6')][_0xd99c('0x7')],_0x5170e7[_0xd99c('0x6')][_0xd99c('0x8')]);this[_0xd99c('0x9')]=_0x5170e7[_0xd99c('0x6')][_0xd99c('0x5')];this[_0xd99c('0xa')]=_0x3997a1[_0xd99c('0xb')];this[_0xd99c('0xc')]=_0x5170e7[_0xd99c('0xc')]||![];this[_0xd99c('0xd')]=_0x3997a1[_0xd99c('0xd')];this['dialQueueTimeout']=_0x3997a1[_0xd99c('0xe')]||0x3;this[_0xd99c('0xf')]=_0x5170e7[_0xd99c('0xf')];this[_0xd99c('0x10')]=_0x5170e7[_0xd99c('0x10')];this['countcongestionretry']=_0x5170e7[_0xd99c('0x11')];this[_0xd99c('0x12')]=_0x5170e7[_0xd99c('0x12')];this[_0xd99c('0x13')]=_0x5170e7[_0xd99c('0x13')];this['countdropretry']=_0x5170e7[_0xd99c('0x14')];this[_0xd99c('0x15')]=_0x5170e7[_0xd99c('0x15')];this[_0xd99c('0x16')]=_0x5170e7[_0xd99c('0x16')];this[_0xd99c('0x17')]=_0x5170e7[_0xd99c('0x17')];this[_0xd99c('0x18')]=_0x5170e7['ContactId'];this['ListId']=_0x5170e7[_0xd99c('0x19')];this[_0xd99c('0x1a')]=_0x5170e7[_0xd99c('0x1a')];this[_0xd99c('0x1b')]=_0x5170e7[_0xd99c('0x1b')];this[_0xd99c('0x1c')]=_0x5170e7['CampaignId'];this['idHopper']=_0x5170e7['id'];this[_0xd99c('0x1d')]=_0x5170e7[_0xd99c('0x6')][_0xd99c('0x7')]||'';this[_0xd99c('0x1e')]=moment()[_0xd99c('0x1f')](_0xd99c('0x20'));this[_0xd99c('0x21')]=_0x5170e7[_0xd99c('0x21')];this[_0xd99c('0x22')]=_0x5170e7[_0xd99c('0x22')];this[_0xd99c('0x23')]=_0x5170e7[_0xd99c('0x23')];this['recallme']=_0x5170e7[_0xd99c('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xd99c('0x25')][_0xd99c('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0xd99c('0x27')]['dialCutDigit']>0x0?this[_0xd99c('0x9')][_0xd99c('0x28')](this[_0xd99c('0x27')]['dialCutDigit']):this[_0xd99c('0x9')]);};Action['prototype'][_0xd99c('0x29')]=function(){return this[_0xd99c('0xa')];};module[_0xd99c('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 0711060..b455985 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 _0xd80f=['countagentrejectretry','uniqueid','calleridname','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x11e865,_0x17e091){var _0x521ca2=function(_0x3ed259){while(--_0x3ed259){_0x11e865['push'](_0x11e865['shift']());}};_0x521ca2(++_0x17e091);}(_0xd80f,0x127));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xfd80('0x0'));var _=require(_0xfd80('0x1'));var moment=require(_0xfd80('0x2'));function getSeconds(_0x1064b6,_0x29d84c){var _0x327ec7=moment(_0x1064b6)['milliseconds'](0x0);var _0x1c44ea=moment(_0x29d84c)[_0xfd80('0x3')](0x0);return _0x327ec7[_0xfd80('0x4')](_0x1c44ea,_0xfd80('0x5'));}function AgentComplete(_0x2b9495,_0x2511c9){this[_0xfd80('0x6')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x2b9495[_0xfd80('0x7')];this[_0xfd80('0x8')]=_0x2b9495['type'];this[_0xfd80('0x9')]=_0x2b9495[_0xfd80('0x8')]===_0xfd80('0xa')?_0xfd80('0xb'):_0x2b9495['type'];this[_0xfd80('0xc')]=_0x2b9495[_0xfd80('0xc')];this['countcongestionretry']=_0x2b9495[_0xfd80('0xd')];this[_0xfd80('0xe')]=_0x2b9495[_0xfd80('0xe')];this[_0xfd80('0xf')]=_0x2b9495[_0xfd80('0xc')]+_0x2b9495[_0xfd80('0xd')]+_0x2b9495[_0xfd80('0xe')]+_0x2b9495[_0xfd80('0x10')]+_0x2b9495[_0xfd80('0x11')]+_0x2b9495[_0xfd80('0x12')]+_0x2b9495[_0xfd80('0x13')]+_0x2b9495[_0xfd80('0x14')];this[_0xfd80('0x10')]=_0x2b9495['countnosuchnumberretry'];this['countdropretry']=_0x2b9495[_0xfd80('0x11')];this[_0xfd80('0x12')]=_0x2b9495['countabandonedretry'];this[_0xfd80('0x13')]=_0x2b9495[_0xfd80('0x13')];this['countagentrejectretry']=_0x2b9495['countagentrejectretry'];this['uniqueid']=_0x2511c9[_0xfd80('0x15')];this[_0xfd80('0x16')]=_0x2b9495['name'];this['calleridnum']=_0x2b9495['number'];this['starttime']=_0x2b9495[_0xfd80('0x17')];this[_0xfd80('0x18')]=_0x2b9495[_0xfd80('0x18')];this[_0xfd80('0x19')]=_0x2b9495[_0xfd80('0x19')];this['endtime']=moment()[_0xfd80('0x1a')](_0xfd80('0x1b'));this[_0xfd80('0x1c')]=getSeconds(_0x2b9495['responsetime'],_0x2b9495[_0xfd80('0x17')]);this[_0xfd80('0x1d')]=getSeconds(_0x2b9495[_0xfd80('0x19')],_0x2b9495[_0xfd80('0x18')]);this[_0xfd80('0x1e')]=getSeconds(this[_0xfd80('0x1f')],_0x2b9495['answertime']);this[_0xfd80('0xb')]=_0x2511c9[_0xfd80('0xb')];this[_0xfd80('0x20')]=_0x2511c9[_0xfd80('0x20')];this[_0xfd80('0x21')]=_0x2511c9['reason'];this['callback']=_0x2b9495[_0xfd80('0x22')];this['callbackuniqueid']=_0x2b9495[_0xfd80('0x23')];this[_0xfd80('0x24')]=_0x2b9495[_0xfd80('0x24')];this['recallme']=_0x2b9495[_0xfd80('0x25')];this[_0xfd80('0x26')]=_0x2b9495[_0xfd80('0x26')];this['ListId']=_0x2b9495[_0xfd80('0x27')];this[_0xfd80('0x28')]=_0x2b9495[_0xfd80('0x28')];this[_0xfd80('0x29')]=_0x2b9495['VoiceQueueId'];this[_0xfd80('0x2a')]=_0x2b9495['CampaignId'];this[_0xfd80('0x2b')]=_0x2b9495['originatecalleridnum']||'';this[_0xfd80('0x2c')]=_0x2b9495[_0xfd80('0x2c')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xa9c0=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x29e5e5,_0x5729e3){var _0x578f03=function(_0x1485dc){while(--_0x1485dc){_0x29e5e5['push'](_0x29e5e5['shift']());}};_0x578f03(++_0x5729e3);}(_0xa9c0,0x157));var _0x0a9c=function(_0x527088,_0x20f7b7){_0x527088=_0x527088-0x0;var _0x457b5b=_0xa9c0[_0x527088];return _0x457b5b;};'use strict';var util=require('util');var _=require(_0x0a9c('0x0'));var moment=require(_0x0a9c('0x1'));function getSeconds(_0x272256,_0x48f731){var _0x4d38de=moment(_0x272256)[_0x0a9c('0x2')](0x0);var _0x1c4d3b=moment(_0x48f731)[_0x0a9c('0x2')](0x0);return _0x4d38de[_0x0a9c('0x3')](_0x1c4d3b,_0x0a9c('0x4'));}function AgentComplete(_0x4f57ad,_0x5a1810){this[_0x0a9c('0x5')]=0x4;this[_0x0a9c('0x6')]=_0x0a9c('0x7');this[_0x0a9c('0x8')]=_0x4f57ad[_0x0a9c('0x8')];this[_0x0a9c('0x9')]=_0x4f57ad[_0x0a9c('0x9')];this[_0x0a9c('0xa')]=_0x4f57ad['type']===_0x0a9c('0xb')?_0x0a9c('0xc'):_0x4f57ad[_0x0a9c('0x9')];this[_0x0a9c('0xd')]=_0x4f57ad[_0x0a9c('0xd')];this[_0x0a9c('0xe')]=_0x4f57ad[_0x0a9c('0xe')];this['countnoanswerretry']=_0x4f57ad[_0x0a9c('0xf')];this[_0x0a9c('0x10')]=_0x4f57ad[_0x0a9c('0xd')]+_0x4f57ad['countcongestionretry']+_0x4f57ad['countnoanswerretry']+_0x4f57ad[_0x0a9c('0x11')]+_0x4f57ad[_0x0a9c('0x12')]+_0x4f57ad['countabandonedretry']+_0x4f57ad[_0x0a9c('0x13')]+_0x4f57ad['countagentrejectretry'];this[_0x0a9c('0x11')]=_0x4f57ad[_0x0a9c('0x11')];this['countdropretry']=_0x4f57ad['countdropretry'];this['countabandonedretry']=_0x4f57ad[_0x0a9c('0x14')];this[_0x0a9c('0x13')]=_0x4f57ad['countmachineretry'];this['countagentrejectretry']=_0x4f57ad['countagentrejectretry'];this[_0x0a9c('0x15')]=_0x5a1810['uniqueid'];this[_0x0a9c('0x16')]=_0x4f57ad[_0x0a9c('0x17')];this[_0x0a9c('0x18')]=_0x4f57ad[_0x0a9c('0x19')];this[_0x0a9c('0x1a')]=_0x4f57ad['starttime'];this[_0x0a9c('0x1b')]=_0x4f57ad[_0x0a9c('0x1b')];this['answertime']=_0x4f57ad[_0x0a9c('0x1c')];this[_0x0a9c('0x1d')]=moment()['format'](_0x0a9c('0x1e'));this[_0x0a9c('0x1f')]=getSeconds(_0x4f57ad['responsetime'],_0x4f57ad[_0x0a9c('0x1a')]);this[_0x0a9c('0x20')]=getSeconds(_0x4f57ad[_0x0a9c('0x1c')],_0x4f57ad[_0x0a9c('0x1b')]);this[_0x0a9c('0x21')]=getSeconds(this[_0x0a9c('0x1d')],_0x4f57ad['answertime']);this[_0x0a9c('0xc')]=_0x5a1810[_0x0a9c('0xc')];this[_0x0a9c('0x22')]=_0x5a1810[_0x0a9c('0x22')];this[_0x0a9c('0x23')]=_0x5a1810[_0x0a9c('0x23')];this['callback']=_0x4f57ad[_0x0a9c('0x24')];this[_0x0a9c('0x25')]=_0x4f57ad[_0x0a9c('0x25')];this[_0x0a9c('0x26')]=_0x4f57ad['callbackat'];this['recallme']=_0x4f57ad[_0x0a9c('0x27')];this[_0x0a9c('0x28')]=_0x4f57ad[_0x0a9c('0x28')];this[_0x0a9c('0x29')]=_0x4f57ad['ListId'];this[_0x0a9c('0x2a')]=_0x4f57ad[_0x0a9c('0x2a')];this[_0x0a9c('0x2b')]=_0x4f57ad['VoiceQueueId'];this[_0x0a9c('0x2c')]=_0x4f57ad['CampaignId'];this[_0x0a9c('0x2d')]=_0x4f57ad[_0x0a9c('0x2d')]||'';this[_0x0a9c('0x2e')]=_0x4f57ad[_0x0a9c('0x2e')]||'';}module[_0x0a9c('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 67285e3..e5533f2 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 _0x7637=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countmachineretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x7637,0xec));var _0x7763=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x7637[_0x1fcf1b];return _0x5d2952;};'use strict';var util=require(_0x7763('0x0'));var _=require(_0x7763('0x1'));var moment=require(_0x7763('0x2'));function getSeconds(_0x44991d,_0x155681){var _0x53b4fe=moment(_0x44991d)[_0x7763('0x3')](0x0);var _0x305d11=moment(_0x155681)['milliseconds'](0x0);return _0x53b4fe[_0x7763('0x4')](_0x305d11,_0x7763('0x5'));}function Final(_0x14dc41){this['uniqueid']=_0x14dc41[_0x7763('0x6')];this[_0x7763('0x7')]=_0x14dc41[_0x7763('0x7')];this[_0x7763('0x8')]=_0x14dc41[_0x7763('0x8')];this[_0x7763('0x9')]=_0x14dc41[_0x7763('0x8')]===_0x7763('0xa')?_0x7763('0xb'):_0x14dc41[_0x7763('0x8')];this[_0x7763('0xc')]=_0x14dc41['countbusyretry'];this[_0x7763('0xd')]=_0x14dc41[_0x7763('0xd')];this[_0x7763('0xe')]=_0x14dc41['countnoanswerretry'];this['countglobal']=_0x14dc41['countbusyretry']+_0x14dc41[_0x7763('0xd')]+_0x14dc41[_0x7763('0xe')]+_0x14dc41[_0x7763('0xf')]+_0x14dc41[_0x7763('0x10')]+_0x14dc41['countabandonedretry']+_0x14dc41['countmachineretry']+_0x14dc41[_0x7763('0x11')];this[_0x7763('0xf')]=_0x14dc41[_0x7763('0xf')];this[_0x7763('0x10')]=_0x14dc41[_0x7763('0x10')];this['countabandonedretry']=_0x14dc41['countabandonedretry'];this[_0x7763('0x12')]=_0x14dc41[_0x7763('0x12')];this[_0x7763('0x11')]=_0x14dc41['countagentrejectretry'];this[_0x7763('0xb')]=_0x14dc41[_0x7763('0xb')];this['calleridname']=_0x14dc41['calleridname'];this['calleridnum']=_0x14dc41[_0x7763('0x13')];this[_0x7763('0x14')]=_0x14dc41[_0x7763('0x14')];this[_0x7763('0x15')]=_0x14dc41[_0x7763('0x15')];this[_0x7763('0x16')]=_0x14dc41[_0x7763('0x15')];this[_0x7763('0x17')]=_0x14dc41[_0x7763('0x17')]||0x0;this[_0x7763('0x18')]=_0x14dc41[_0x7763('0x18')]||0x0;this[_0x7763('0x19')]=_0x14dc41[_0x7763('0x19')]||0x0;this[_0x7763('0x1a')]=_0x14dc41[_0x7763('0x1a')];this[_0x7763('0x1b')]=_0x14dc41['callbackuniqueid'];this[_0x7763('0x1c')]=_0x14dc41[_0x7763('0x1c')];this['recallme']=_0x14dc41[_0x7763('0x1d')];this[_0x7763('0x1e')]=_0x14dc41['ContactId'];this[_0x7763('0x1f')]=_0x14dc41['ListId'];this['UserId']=_0x14dc41[_0x7763('0x20')];this[_0x7763('0x21')]=_0x14dc41[_0x7763('0x21')];this[_0x7763('0x22')]=_0x14dc41['CampaignId'];this[_0x7763('0x23')]=_0x14dc41['originatecalleridnum']||'';this[_0x7763('0x24')]=_0x14dc41[_0x7763('0x24')]||'';}module[_0x7763('0x25')]=Final; \ No newline at end of file +var _0x26e3=['endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridnum','starttime','responsetime'];(function(_0x2f3fcb,_0x7cafea){var _0x4ed933=function(_0x2b0ee5){while(--_0x2b0ee5){_0x2f3fcb['push'](_0x2f3fcb['shift']());}};_0x4ed933(++_0x7cafea);}(_0x26e3,0x9e));var _0x326e=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x26e3[_0x2af053];return _0x4b4001;};'use strict';var util=require(_0x326e('0x0'));var _=require(_0x326e('0x1'));var moment=require(_0x326e('0x2'));function getSeconds(_0x5c96f9,_0x295f48){var _0x460d4e=moment(_0x5c96f9)[_0x326e('0x3')](0x0);var _0x1f673d=moment(_0x295f48)['milliseconds'](0x0);return _0x460d4e[_0x326e('0x4')](_0x1f673d,_0x326e('0x5'));}function Final(_0x4907c3){this[_0x326e('0x6')]=_0x4907c3[_0x326e('0x6')];this[_0x326e('0x7')]=_0x4907c3['scheduledat'];this[_0x326e('0x8')]=_0x4907c3[_0x326e('0x8')];this[_0x326e('0x9')]=_0x4907c3['type']==='outbound'?'queue':_0x4907c3['type'];this[_0x326e('0xa')]=_0x4907c3[_0x326e('0xa')];this[_0x326e('0xb')]=_0x4907c3[_0x326e('0xb')];this[_0x326e('0xc')]=_0x4907c3[_0x326e('0xc')];this['countglobal']=_0x4907c3[_0x326e('0xa')]+_0x4907c3[_0x326e('0xb')]+_0x4907c3[_0x326e('0xc')]+_0x4907c3['countnosuchnumberretry']+_0x4907c3[_0x326e('0xd')]+_0x4907c3[_0x326e('0xe')]+_0x4907c3[_0x326e('0xf')]+_0x4907c3[_0x326e('0x10')];this[_0x326e('0x11')]=_0x4907c3[_0x326e('0x11')];this[_0x326e('0xd')]=_0x4907c3['countdropretry'];this[_0x326e('0xe')]=_0x4907c3['countabandonedretry'];this[_0x326e('0xf')]=_0x4907c3[_0x326e('0xf')];this[_0x326e('0x10')]=_0x4907c3['countagentrejectretry'];this[_0x326e('0x12')]=_0x4907c3[_0x326e('0x12')];this['calleridname']=_0x4907c3['calleridname'];this[_0x326e('0x13')]=_0x4907c3[_0x326e('0x13')];this[_0x326e('0x14')]=_0x4907c3[_0x326e('0x14')];this[_0x326e('0x15')]=_0x4907c3[_0x326e('0x15')];this[_0x326e('0x16')]=_0x4907c3['responsetime'];this['ringtime']=_0x4907c3[_0x326e('0x17')]||0x0;this[_0x326e('0x18')]=_0x4907c3[_0x326e('0x18')]||0x0;this[_0x326e('0x19')]=_0x4907c3[_0x326e('0x19')]||0x0;this['callback']=_0x4907c3['callback'];this[_0x326e('0x1a')]=_0x4907c3[_0x326e('0x1a')];this[_0x326e('0x1b')]=_0x4907c3['callbackat'];this['recallme']=_0x4907c3[_0x326e('0x1c')];this[_0x326e('0x1d')]=_0x4907c3['ContactId'];this[_0x326e('0x1e')]=_0x4907c3[_0x326e('0x1e')];this[_0x326e('0x1f')]=_0x4907c3[_0x326e('0x1f')];this[_0x326e('0x20')]=_0x4907c3[_0x326e('0x20')];this[_0x326e('0x21')]=_0x4907c3[_0x326e('0x21')];this[_0x326e('0x22')]=_0x4907c3[_0x326e('0x22')]||'';this[_0x326e('0x23')]=_0x4907c3[_0x326e('0x23')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index f597270..ad8a1d6 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 _0xdb16=['milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','moment'];(function(_0x572072,_0x45d981){var _0x4f97df=function(_0x3825be){while(--_0x3825be){_0x572072['push'](_0x572072['shift']());}};_0x4f97df(++_0x45d981);}(_0xdb16,0x101));var _0x6db1=function(_0x50a9af,_0x24df09){_0x50a9af=_0x50a9af-0x0;var _0x3478f9=_0xdb16[_0x50a9af];return _0x3478f9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6db1('0x0'));function getSeconds(_0x14a65b,_0xb27ae5){var _0x130c46=moment(_0x14a65b)[_0x6db1('0x1')](0x0);var _0x461552=moment(_0xb27ae5)['milliseconds'](0x0);return _0x130c46['diff'](_0x461552,_0x6db1('0x2'));}function Hangup(_0x266e8d,_0x66fd8d){this['state']=0x4;this[_0x6db1('0x3')]=_0x6db1('0x4');this[_0x6db1('0x5')]=_0x266e8d[_0x6db1('0x5')];this[_0x6db1('0x6')]=_0x266e8d[_0x6db1('0x6')];this[_0x6db1('0x7')]=_0x266e8d[_0x6db1('0x6')]===_0x6db1('0x8')?_0x6db1('0x9'):_0x266e8d[_0x6db1('0x6')];this[_0x6db1('0xa')]=_0x266e8d['countbusyretry'];this[_0x6db1('0xb')]=_0x266e8d['countcongestionretry'];this[_0x6db1('0xc')]=_0x266e8d['countnoanswerretry'];this[_0x6db1('0xd')]=_0x266e8d[_0x6db1('0xa')]+_0x266e8d[_0x6db1('0xb')]+_0x266e8d[_0x6db1('0xc')]+_0x266e8d[_0x6db1('0xe')]+_0x266e8d['countdropretry']+_0x266e8d['countabandonedretry']+_0x266e8d[_0x6db1('0xf')]+_0x266e8d['countagentrejectretry'];this['countnosuchnumberretry']=_0x266e8d[_0x6db1('0xe')];this[_0x6db1('0x10')]=_0x266e8d[_0x6db1('0x10')];this[_0x6db1('0x11')]=_0x266e8d['countabandonedretry'];this[_0x6db1('0xf')]=_0x266e8d[_0x6db1('0xf')];this[_0x6db1('0x12')]=_0x266e8d['countagentrejectretry'];this[_0x6db1('0x13')]=_0x66fd8d[_0x6db1('0x13')];this[_0x6db1('0x14')]=_0x266e8d[_0x6db1('0x15')];this[_0x6db1('0x16')]=_0x266e8d[_0x6db1('0x17')];this[_0x6db1('0x18')]=_0x266e8d[_0x6db1('0x18')];this['responsetime']=_0x266e8d['responsetime'];this[_0x6db1('0x19')]=moment()['format'](_0x6db1('0x1a'));this[_0x6db1('0x1b')]=getSeconds(_0x266e8d[_0x6db1('0x1c')],_0x266e8d['starttime']);this[_0x6db1('0x1d')]=0x0;this['talktime']=getSeconds(this[_0x6db1('0x19')],_0x266e8d[_0x6db1('0x1c')]);this[_0x6db1('0x9')]=_0x266e8d[_0x6db1('0x9')];this[_0x6db1('0x1e')]=_0x6db1('0x1f');this[_0x6db1('0x20')]=_0x66fd8d[_0x6db1('0x21')];this[_0x6db1('0x22')]=_0x266e8d[_0x6db1('0x22')];this[_0x6db1('0x23')]=_0x266e8d[_0x6db1('0x23')];this[_0x6db1('0x24')]=_0x266e8d[_0x6db1('0x24')];this[_0x6db1('0x25')]=_0x266e8d[_0x6db1('0x25')];this['ContactId']=_0x266e8d['ContactId'];this[_0x6db1('0x26')]=_0x266e8d[_0x6db1('0x26')];this[_0x6db1('0x27')]=_0x266e8d[_0x6db1('0x27')];this[_0x6db1('0x28')]=_0x266e8d[_0x6db1('0x28')];this[_0x6db1('0x29')]=_0x266e8d['CampaignId'];}module[_0x6db1('0x2a')]=Hangup; \ No newline at end of file +var _0x69e3=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','seconds','Answer','scheduledat','type'];(function(_0x5c91d0,_0x526ec9){var _0x12390a=function(_0x2e58e7){while(--_0x2e58e7){_0x5c91d0['push'](_0x5c91d0['shift']());}};_0x12390a(++_0x526ec9);}(_0x69e3,0x1f1));var _0x369e=function(_0x3ce006,_0x20b0aa){_0x3ce006=_0x3ce006-0x0;var _0x3f7b85=_0x69e3[_0x3ce006];return _0x3f7b85;};'use strict';var util=require('util');var _=require(_0x369e('0x0'));var moment=require('moment');function getSeconds(_0x1f3970,_0x318f6d){var _0x417dd3=moment(_0x1f3970)[_0x369e('0x1')](0x0);var _0x4d12c6=moment(_0x318f6d)[_0x369e('0x1')](0x0);return _0x417dd3[_0x369e('0x2')](_0x4d12c6,_0x369e('0x3'));}function Hangup(_0x486a18,_0x376708){this['state']=0x4;this['statedesc']=_0x369e('0x4');this[_0x369e('0x5')]=_0x486a18[_0x369e('0x5')];this['type']=_0x486a18[_0x369e('0x6')];this[_0x369e('0x7')]=_0x486a18[_0x369e('0x6')]===_0x369e('0x8')?_0x369e('0x9'):_0x486a18[_0x369e('0x6')];this[_0x369e('0xa')]=_0x486a18['countbusyretry'];this[_0x369e('0xb')]=_0x486a18[_0x369e('0xb')];this[_0x369e('0xc')]=_0x486a18[_0x369e('0xc')];this['countglobal']=_0x486a18[_0x369e('0xa')]+_0x486a18[_0x369e('0xb')]+_0x486a18[_0x369e('0xc')]+_0x486a18[_0x369e('0xd')]+_0x486a18[_0x369e('0xe')]+_0x486a18[_0x369e('0xf')]+_0x486a18[_0x369e('0x10')]+_0x486a18[_0x369e('0x11')];this[_0x369e('0xd')]=_0x486a18[_0x369e('0xd')];this['countdropretry']=_0x486a18[_0x369e('0xe')];this[_0x369e('0xf')]=_0x486a18['countabandonedretry'];this[_0x369e('0x10')]=_0x486a18[_0x369e('0x10')];this[_0x369e('0x11')]=_0x486a18[_0x369e('0x11')];this[_0x369e('0x12')]=_0x376708[_0x369e('0x12')];this[_0x369e('0x13')]=_0x486a18[_0x369e('0x14')];this[_0x369e('0x15')]=_0x486a18[_0x369e('0x16')];this[_0x369e('0x17')]=_0x486a18[_0x369e('0x17')];this[_0x369e('0x18')]=_0x486a18[_0x369e('0x18')];this[_0x369e('0x19')]=moment()[_0x369e('0x1a')](_0x369e('0x1b'));this[_0x369e('0x1c')]=getSeconds(_0x486a18[_0x369e('0x18')],_0x486a18[_0x369e('0x17')]);this['holdtime']=0x0;this[_0x369e('0x1d')]=getSeconds(this[_0x369e('0x19')],_0x486a18[_0x369e('0x18')]);this['queue']=_0x486a18['queue'];this[_0x369e('0x1e')]='IVR';this[_0x369e('0x1f')]=_0x376708['cause-txt'];this[_0x369e('0x20')]=_0x486a18[_0x369e('0x20')];this[_0x369e('0x21')]=_0x486a18[_0x369e('0x21')];this[_0x369e('0x22')]=_0x486a18[_0x369e('0x22')];this[_0x369e('0x23')]=_0x486a18['recallme'];this['ContactId']=_0x486a18[_0x369e('0x24')];this[_0x369e('0x25')]=_0x486a18[_0x369e('0x25')];this[_0x369e('0x26')]=_0x486a18['UserId'];this[_0x369e('0x27')]=_0x486a18[_0x369e('0x27')];this['CampaignId']=_0x486a18[_0x369e('0x28')];}module[_0x369e('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6c70156..01e2e0c 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 _0x724f=['countmachineretry','countagentrejectretry','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x44de09,_0x54a333){var _0x5edd7a=function(_0x5efe9d){while(--_0x5efe9d){_0x44de09['push'](_0x44de09['shift']());}};_0x5edd7a(++_0x54a333);}(_0x724f,0x1ea));var _0xf724=function(_0x23c0e2,_0x52e5d7){_0x23c0e2=_0x23c0e2-0x0;var _0x324074=_0x724f[_0x23c0e2];return _0x324074;};'use strict';var util=require(_0xf724('0x0'));var _=require(_0xf724('0x1'));var moment=require(_0xf724('0x2'));function getSeconds(_0x14cf22,_0x19d241){var _0x27dcdd=moment(_0x14cf22)[_0xf724('0x3')](0x0);var _0x176cdf=moment(_0x19d241)['milliseconds'](0x0);return _0x27dcdd[_0xf724('0x4')](_0x176cdf,'seconds');}function History(_0x5e40ca){this['uniqueid']=_0x5e40ca[_0xf724('0x5')];this['scheduledat']=_0x5e40ca[_0xf724('0x6')]||undefined;this[_0xf724('0x7')]=_0x5e40ca[_0xf724('0x7')];this[_0xf724('0x8')]=_0x5e40ca[_0xf724('0x7')]===_0xf724('0x9')?_0xf724('0xa'):_0x5e40ca[_0xf724('0x7')];this[_0xf724('0xb')]=_0x5e40ca[_0xf724('0xb')];this['countcongestionretry']=_0x5e40ca[_0xf724('0xc')];this['countnoanswerretry']=_0x5e40ca[_0xf724('0xd')];this['countglobal']=_0x5e40ca['countbusyretry']+_0x5e40ca['countcongestionretry']+_0x5e40ca['countnoanswerretry']+_0x5e40ca[_0xf724('0xe')]+_0x5e40ca[_0xf724('0xf')]+_0x5e40ca[_0xf724('0x10')]+_0x5e40ca[_0xf724('0x11')]+_0x5e40ca[_0xf724('0x12')];this[_0xf724('0xe')]=_0x5e40ca[_0xf724('0xe')];this[_0xf724('0xf')]=_0x5e40ca[_0xf724('0xf')];this['countabandonedretry']=_0x5e40ca['countabandonedretry'];this['countmachineretry']=_0x5e40ca[_0xf724('0x11')];this[_0xf724('0x12')]=_0x5e40ca['countagentrejectretry'];this['queue']=_0x5e40ca[_0xf724('0xa')];this['calleridname']=_0x5e40ca['name'];this[_0xf724('0x13')]=_0x5e40ca[_0xf724('0x14')];this[_0xf724('0x15')]=_0x5e40ca[_0xf724('0x15')];this[_0xf724('0x16')]=_0x5e40ca['responsetime'];this[_0xf724('0x17')]=_0x5e40ca[_0xf724('0x16')];this[_0xf724('0x18')]=getSeconds(_0x5e40ca[_0xf724('0x16')],_0x5e40ca[_0xf724('0x15')]);this[_0xf724('0x19')]=0x0;this[_0xf724('0x1a')]=0x0;this['callback']=_0x5e40ca[_0xf724('0x1b')];this[_0xf724('0x1c')]=_0x5e40ca['callbackuniqueid'];this[_0xf724('0x1d')]=_0x5e40ca['callbackat'];this['recallme']=_0x5e40ca[_0xf724('0x1e')];this[_0xf724('0x1f')]=_0x5e40ca[_0xf724('0x1f')];this[_0xf724('0x20')]=_0x5e40ca[_0xf724('0x20')];this[_0xf724('0x21')]=_0x5e40ca['UserId'];this[_0xf724('0x22')]=_0x5e40ca[_0xf724('0x22')];this[_0xf724('0x23')]=_0x5e40ca[_0xf724('0x23')];this[_0xf724('0x24')]=_0x5e40ca[_0xf724('0x24')]||'';this[_0xf724('0x25')]=_0x5e40ca[_0xf724('0x25')]||'';}module[_0xf724('0x26')]=History; \ No newline at end of file +var _0xd187=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry'];(function(_0x1acea9,_0x55f491){var _0x2faf9a=function(_0x5248e2){while(--_0x5248e2){_0x1acea9['push'](_0x1acea9['shift']());}};_0x2faf9a(++_0x55f491);}(_0xd187,0x90));var _0x7d18=function(_0x332998,_0x2d99c7){_0x332998=_0x332998-0x0;var _0x460be7=_0xd187[_0x332998];return _0x460be7;};'use strict';var util=require(_0x7d18('0x0'));var _=require(_0x7d18('0x1'));var moment=require(_0x7d18('0x2'));function getSeconds(_0x53af61,_0xb25ed8){var _0x32ee20=moment(_0x53af61)[_0x7d18('0x3')](0x0);var _0x27509b=moment(_0xb25ed8)[_0x7d18('0x3')](0x0);return _0x32ee20[_0x7d18('0x4')](_0x27509b,_0x7d18('0x5'));}function History(_0x30c588){this['uniqueid']=_0x30c588[_0x7d18('0x6')];this[_0x7d18('0x7')]=_0x30c588['scheduledat']||undefined;this[_0x7d18('0x8')]=_0x30c588[_0x7d18('0x8')];this[_0x7d18('0x9')]=_0x30c588[_0x7d18('0x8')]===_0x7d18('0xa')?'queue':_0x30c588[_0x7d18('0x8')];this['countbusyretry']=_0x30c588[_0x7d18('0xb')];this[_0x7d18('0xc')]=_0x30c588[_0x7d18('0xc')];this[_0x7d18('0xd')]=_0x30c588[_0x7d18('0xd')];this[_0x7d18('0xe')]=_0x30c588[_0x7d18('0xb')]+_0x30c588[_0x7d18('0xc')]+_0x30c588[_0x7d18('0xd')]+_0x30c588[_0x7d18('0xf')]+_0x30c588[_0x7d18('0x10')]+_0x30c588[_0x7d18('0x11')]+_0x30c588[_0x7d18('0x12')]+_0x30c588[_0x7d18('0x13')];this[_0x7d18('0xf')]=_0x30c588[_0x7d18('0xf')];this[_0x7d18('0x10')]=_0x30c588[_0x7d18('0x10')];this[_0x7d18('0x11')]=_0x30c588[_0x7d18('0x11')];this[_0x7d18('0x12')]=_0x30c588['countmachineretry'];this['countagentrejectretry']=_0x30c588[_0x7d18('0x13')];this[_0x7d18('0x14')]=_0x30c588[_0x7d18('0x14')];this[_0x7d18('0x15')]=_0x30c588[_0x7d18('0x16')];this['calleridnum']=_0x30c588['number'];this[_0x7d18('0x17')]=_0x30c588['starttime'];this[_0x7d18('0x18')]=_0x30c588[_0x7d18('0x18')];this['endtime']=_0x30c588[_0x7d18('0x18')];this['ringtime']=getSeconds(_0x30c588[_0x7d18('0x18')],_0x30c588['starttime']);this[_0x7d18('0x19')]=0x0;this[_0x7d18('0x1a')]=0x0;this[_0x7d18('0x1b')]=_0x30c588[_0x7d18('0x1b')];this[_0x7d18('0x1c')]=_0x30c588[_0x7d18('0x1c')];this[_0x7d18('0x1d')]=_0x30c588['callbackat'];this['recallme']=_0x30c588[_0x7d18('0x1e')];this[_0x7d18('0x1f')]=_0x30c588['ContactId'];this[_0x7d18('0x20')]=_0x30c588[_0x7d18('0x20')];this['UserId']=_0x30c588[_0x7d18('0x21')];this[_0x7d18('0x22')]=_0x30c588[_0x7d18('0x22')];this['CampaignId']=_0x30c588[_0x7d18('0x23')];this[_0x7d18('0x24')]=_0x30c588[_0x7d18('0x24')]||'';this['originatecalleridname']=_0x30c588[_0x7d18('0x25')]||'';}module[_0x7d18('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 71f3db1..d923c76 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 _0x9aea=['ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','iftime\x20%s,%s','interval','timezones','indexOf','true','command','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTime','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','NONE','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originate][error]','syncOriginateResponse','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','object','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','reachable','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[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]','m\x20=\x20','p\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]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','bluebird','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','syncQueueCallerAbandon','originateresponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','Interval','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','info','-----\x20Stats\x20Predictive\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','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][Empty]','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','then','countReScheduled','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','AMD','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr]','countglobal','amd','countnoanswerretry','countdropretry','countagentrejectretry','createStateFinal','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','locked','agents','stateinterface','queueBooked','push','pick','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable'];(function(_0x477cb9,_0x1f151b){var _0x59f8ec=function(_0x231c54){while(--_0x231c54){_0x477cb9['push'](_0x477cb9['shift']());}};_0x59f8ec(++_0x1f151b);}(_0x9aea,0xdd));var _0xa9ae=function(_0x4dc797,_0xfafc8f){_0x4dc797=_0x4dc797-0x0;var _0x39844f=_0x9aea[_0x4dc797];return _0x39844f;};'use strict';var util=require(_0xa9ae('0x0'));var _=require('lodash');var BPromise=require(_0xa9ae('0x1'));var uuid=require('uuid');var moment=require(_0xa9ae('0x2'));var rr=require('rr');var md5=require(_0xa9ae('0x3'));var Redis=require('ioredis');var ut=require(_0xa9ae('0x4'));var config=require(_0xa9ae('0x5'));var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var loggerBooked=require(_0xa9ae('0x6'))('booked');var loggerPredictive=require(_0xa9ae('0x6'))(_0xa9ae('0x8'));var loggerPredictiveCalls=require(_0xa9ae('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xa9ae('0x6'))(_0xa9ae('0x9'));var ami=require(_0xa9ae('0xa'));config[_0xa9ae('0xb')]=_[_0xa9ae('0xc')](config[_0xa9ae('0xb')],{'host':_0xa9ae('0xd'),'port':0x18eb});var io=require(_0xa9ae('0xe'))(new Redis(config[_0xa9ae('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xa9ae('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa9ae('0x10'));var Action=require(_0xa9ae('0x11'));var History=require(_0xa9ae('0x12'));var Final=require(_0xa9ae('0x13'));var AgentComplete=require(_0xa9ae('0x14'));var QueueCallerAbandon=require(_0xa9ae('0x15'));var Hangup=require(_0xa9ae('0x16'));var ipAgi=process[_0xa9ae('0x17')]['XCALLY_IP_AGI']||_0xa9ae('0x18');var strategy={'rrmemory':_0xa9ae('0x19'),'roundrobin':_0xa9ae('0x1a')};var Sequence=function(){};Sequence[_0xa9ae('0x1b')]['enqueue']=function(_0x28ce2d){this[_0xa9ae('0x1c')]=this[_0xa9ae('0x1c')]?this[_0xa9ae('0x1c')][_0xa9ae('0x1d')](_0x28ce2d):_0x28ce2d();};function Dialer(_0xddb095,_0x524bb2){this[_0xa9ae('0x1e')]=new Sequence();this[_0xa9ae('0x1f')]=_0x524bb2;this[_0xa9ae('0x20')]=_0xddb095['voiceQueues'];this['campaigns']=_0xddb095[_0xa9ae('0x21')];this['agents']=_0xddb095['agents'];this[_0xa9ae('0x22')]=_0xddb095[_0xa9ae('0x22')];this[_0xa9ae('0x23')]=config[_0xa9ae('0x23')]||0x2;this['channels']={};this[_0xa9ae('0x24')]={};this[_0xa9ae('0x25')]={};this[_0xa9ae('0x26')]={};this[_0xa9ae('0x27')]={};this[_0xa9ae('0x28')]={};this[_0xa9ae('0x29')]={};this[_0xa9ae('0x2a')]={};this['queueBooked']={};this[_0xa9ae('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0xa9ae('0x2c')]['bind'](this));ami['on'](_0xa9ae('0x2d'),this['syncOriginateResponse'][_0xa9ae('0x2e')](this));ami['on'](_0xa9ae('0x2f'),this[_0xa9ae('0x30')][_0xa9ae('0x2e')](this));ami['on'](_0xa9ae('0x31'),this[_0xa9ae('0x9')][_0xa9ae('0x2e')](this));ami['on']('hangup',this[_0xa9ae('0x32')][_0xa9ae('0x2e')](this));ami['on'](_0xa9ae('0x33'),this[_0xa9ae('0x34')][_0xa9ae('0x2e')](this));ami['on'](_0xa9ae('0x35'),this[_0xa9ae('0x36')]['bind'](this));ami['on']('queuemember',this[_0xa9ae('0x37')][_0xa9ae('0x2e')](this));ami['on'](_0xa9ae('0x38'),this[_0xa9ae('0x39')][_0xa9ae('0x2e')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x1892b5){return _0x1892b5!==null&&!_[_0xa9ae('0x3a')](_0x1892b5);}function checkIsLoggedIn(_0x372ec7,_0x3a48b7){return function(){if(_0x3a48b7<=0x0){_0x372ec7[_0xa9ae('0x3b')]=_0xa9ae('0x3c');throw _0x372ec7['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0xaec303){return _0xaec303;}function checkIsActive(_0x268137,_0x3d9b30){return function(){if(!isActive(_0x3d9b30)){_0x268137[_0xa9ae('0x3b')]=_0xa9ae('0x3d');throw _0x268137[_0xa9ae('0x3e')]+_0xa9ae('0x3f');}};}function checkInterval(_0x3e2ec2){return function(){if(!isNotNull(_0x3e2ec2['Interval'])){_0x3e2ec2[_0xa9ae('0x3b')]='INTERVAL_IS_NULL';throw _0x3e2ec2[_0xa9ae('0x3e')]+_0xa9ae('0x40');}if(!isNotNull(_0x3e2ec2[_0xa9ae('0x41')]['Intervals'])){_0x3e2ec2[_0xa9ae('0x3b')]=_0xa9ae('0x42');throw _0x3e2ec2[_0xa9ae('0x3e')]+_0xa9ae('0x40');}if(!isNotNull(_[_0xa9ae('0x43')](_0x3e2ec2['Interval'][_0xa9ae('0x44')]))){_0x3e2ec2[_0xa9ae('0x3b')]=_0xa9ae('0x42');throw _0x3e2ec2['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2155c8,_0x3def03,_0x34c8c7){return{'action':_0x2155c8,'response':_0x3def03,'message':_0x34c8c7,'stack':_0x34c8c7};}function myreject(_0x1a01a4){return function(_0x484f67){return _0x1a01a4(msgResponse(_0xa9ae('0x45'),_0xa9ae('0x46'),JSON[_0xa9ae('0x47')](_0x484f67)));};}function getSeconds(_0x9766c9,_0x276842){var _0x4eafaf=moment(_0x9766c9)[_0xa9ae('0x48')](0x0);var _0x4b890e=moment(_0x276842)[_0xa9ae('0x48')](0x0);return _0x4eafaf[_0xa9ae('0x49')](_0x4b890e,_0xa9ae('0x4a'));}function emit(_0x57fc9d,_0x15a8b4,_0x1ffcab){io['to'](_0x57fc9d)[_0xa9ae('0x4b')](_0x15a8b4,_0x1ffcab);}function emitVoiceQueueSummary(_0x48d36b){if(_0x48d36b[_0xa9ae('0x4c')]===_0xa9ae('0x4d')){var _0x4e2001={'id':_0x48d36b['id'],'name':_0x48d36b[_0xa9ae('0x3e')],'strategy':_0x48d36b['strategy'],'answered':_0x48d36b[_0xa9ae('0x4e')],'available':_0x48d36b[_0xa9ae('0x4f')],'loggedIn':_0x48d36b['loggedIn'],'pTalking':_0x48d36b[_0xa9ae('0x50')],'sumBillable':_0x48d36b[_0xa9ae('0x51')],'sumDuration':_0x48d36b[_0xa9ae('0x52')],'sumHoldTime':_0x48d36b[_0xa9ae('0x53')]||0x0,'talking':_0x48d36b[_0xa9ae('0x54')],'total':_0x48d36b[_0xa9ae('0x55')],'type':_0x48d36b['type'],'unmanaged':_0x48d36b[_0xa9ae('0x56')],'abandoned':_0x48d36b[_0xa9ae('0x57')],'waiting':_0x48d36b['waiting'],'loggedInDb':_0x48d36b['loggedInDb'],'dialActive':_0x48d36b[_0xa9ae('0x58')],'dialMethod':_0x48d36b[_0xa9ae('0x59')],'dialOriginateCallerIdName':_0x48d36b[_0xa9ae('0x5a')],'dialOriginateCallerIdNumber':_0x48d36b[_0xa9ae('0x5b')],'dialOriginateTimeout':_0x48d36b['dialOriginateTimeout'],'dialPrefix':_0x48d36b[_0xa9ae('0x5c')],'outboundAnswerAgiCallsDay':_0x48d36b[_0xa9ae('0x5d')],'outboundAnswerCallsDay':_0x48d36b[_0xa9ae('0x5e')],'outboundBlacklistCallsDay':_0x48d36b[_0xa9ae('0x5f')],'outboundBusyCallsDay':_0x48d36b[_0xa9ae('0x60')],'outboundCongestionCallsDay':_0x48d36b[_0xa9ae('0x61')],'outboundDropCallsDayACS':_0x48d36b[_0xa9ae('0x62')],'outboundDropCallsDayCallersExit':_0x48d36b['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x48d36b[_0xa9ae('0x63')],'outboundNoAnswerCallsDay':_0x48d36b[_0xa9ae('0x64')],'outboundNoSuchCallsDay':_0x48d36b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x48d36b[_0xa9ae('0x65')],'outboundReCallsDay':_0x48d36b['outboundReCallsDay'],'outboundRejectCallsDay':_0x48d36b[_0xa9ae('0x66')],'outboundUnknownCallsDay':_0x48d36b[_0xa9ae('0x67')],'predictiveIntervalAnsweredCalls':_0x48d36b[_0xa9ae('0x68')],'predictiveIntervalAvgHoldtime':_0x48d36b[_0xa9ae('0x69')],'predictiveIntervalAvgTalktime':_0x48d36b[_0xa9ae('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x48d36b[_0xa9ae('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x48d36b[_0xa9ae('0x6c')],'predictiveIntervalErlangCalls':_0x48d36b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x48d36b[_0xa9ae('0x6d')],'predictiveIntervalHitRate':_0x48d36b[_0xa9ae('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x48d36b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x48d36b[_0xa9ae('0x6f')],'predictiveIntervalAvailable':_0x48d36b[_0xa9ae('0x70')],'predictiveIntervalTotalCalls':_0x48d36b[_0xa9ae('0x71')],'message':_0x48d36b[_0xa9ae('0x3b')],'originated':_0x48d36b[_0xa9ae('0x72')],'erlangCalls':_0x48d36b[_0xa9ae('0x73')],'erlangCallToSecond':_0x48d36b['erlangCallToSecond'],'erlangAbandonmentRate':_0x48d36b[_0xa9ae('0x74')],'erlangBusyFactor':_0x48d36b['erlangBusyFactor'],'startPredictive':_0x48d36b[_0xa9ae('0x28')],'startProgressive':_0x48d36b[_0xa9ae('0x29')]};if(_0x48d36b['Trunk']){_0x4e2001['Trunk']={'id':_0x48d36b[_0xa9ae('0x75')]['id'],'name':_0x48d36b[_0xa9ae('0x75')][_0xa9ae('0x3e')],'active':_0x48d36b[_0xa9ae('0x75')][_0xa9ae('0x76')],'callerid':_0x48d36b[_0xa9ae('0x75')][_0xa9ae('0x77')]};}if(_0x48d36b[_0xa9ae('0x41')]){_0x4e2001['Interval']={'id':_0x48d36b['Interval']['id'],'name':_0x48d36b[_0xa9ae('0x41')][_0xa9ae('0x3e')]};}var _0x4efe55=md5(JSON[_0xa9ae('0x47')](_0x4e2001));if(_0x48d36b[_0xa9ae('0x3')]!==_0x4efe55){_0x48d36b[_0xa9ae('0x3')]=_0x4efe55;emit(util[_0xa9ae('0x78')](_0xa9ae('0x79'),_0x4e2001[_0xa9ae('0x3e')]),_0xa9ae('0x7a'),_0x4e2001);}}}function emitCampaignSummary(_0x2f74bb){if(_0x2f74bb['type']===_0xa9ae('0x7b')){emit(util[_0xa9ae('0x78')]('campaign:ivr:%s',_0x2f74bb[_0xa9ae('0x3e')]),'campaign:save',_0x2f74bb);}}function checkGetDataPredictive(_0x518b3f){if(isNotNull(_0x518b3f)&&!_['isEmpty'](_0x518b3f)){loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x7d'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x518b3f['predictiveIntervalTotalCalls']);loggerPredictive[_0xa9ae('0x7c')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x518b3f[_0xa9ae('0x68')]);loggerPredictive[_0xa9ae('0x7c')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x518b3f[_0xa9ae('0x6c')]);loggerPredictive['info'](_0xa9ae('0x7e'),_0x518b3f[_0xa9ae('0x6b')]);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x7f'),_0x518b3f[_0xa9ae('0x69')]);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x80'),_0x518b3f[_0xa9ae('0x6a')]);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x81'));if(_0x518b3f[_0xa9ae('0x71')]>0x0){if(!_[_0xa9ae('0x3a')](_0x518b3f['predictiveIntervalAvgTalktime'])&&_0x518b3f[_0xa9ae('0x6a')]>0x0){return!![];}loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x82'));if(!_[_0xa9ae('0x3a')](_0x518b3f[_0xa9ae('0x69')])&&_0x518b3f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0xa9ae('0x83'));}else{loggerPredictive[_0xa9ae('0x7c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xa9ae('0x84'));}return![];}function mergeDataErlangB(_0x48637a){return function(_0x267182){loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x85'));loggerPredictive['info'](_0xa9ae('0x86'),_0x267182['erlangCalls']);loggerPredictive[_0xa9ae('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x267182[_0xa9ae('0x87')]);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x88'),_0x267182[_0xa9ae('0x74')]);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x89'),_0x267182['erlangBusyFactor']);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x88'),_0x267182[_0xa9ae('0x74')]);loggerPredictive[_0xa9ae('0x7c')]('---------------------------');_[_0xa9ae('0x8a')](_0x48637a,_0x267182);};}function getDiff(_0x2803fb){var _0x2007b8=moment()[_0xa9ae('0x48')](0x0);var _0x2d8140=moment(_0x2803fb)[_0xa9ae('0x48')](0x0);return _0x2007b8[_0xa9ae('0x49')](_0x2d8140,_0xa9ae('0x4a'));}function ifInterval(_0x268618,_0x28756d){if(_['isUndefined'](_0x28756d)){return![];}return getDiff(_0x28756d)<_0x268618*0x3c;}function freeVariablesPredictive(_0xc6b8a4){if(isNotNull(_0xc6b8a4)){if(!_[_0xa9ae('0x3a')](_0xc6b8a4[_0xa9ae('0x29')])){_0xc6b8a4[_0xa9ae('0x29')]=undefined;loggerPredictive['info'](_0xc6b8a4[_0xa9ae('0x3e')],_0xa9ae('0x8b'));}if(!_['isUndefined'](_0xc6b8a4[_0xa9ae('0x28')])){_0xc6b8a4[_0xa9ae('0x28')]=undefined;loggerPredictive[_0xa9ae('0x7c')](_0xc6b8a4['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xa9ae('0x3a')](_0xc6b8a4[_0xa9ae('0x8c')])){clearInterval(_0xc6b8a4['handlePredictive']);_0xc6b8a4['handlePredictive']=undefined;loggerPredictive[_0xa9ae('0x7c')](_0xc6b8a4[_0xa9ae('0x3e')],_0xa9ae('0x8d'));}}}function erlangb(_0x4c9211,_0x12927d){if(_0x12927d===0x0){return 0x0;}var _0x619ae4=0x1;for(var _0x27ef51=0x1;_0x27ef51<=_0x12927d;_0x27ef51+=0x1){_0x619ae4=0x1+_0x619ae4*_0x27ef51/_0x4c9211;}return 0x1/_0x619ae4;}function isVoiceQueueOutbound(_0x50df7b){return _0x50df7b===_0xa9ae('0x4d');}function isNotPreview(_0x13f05e){return _0x13f05e!==_0xa9ae('0x1f');}function isCampaignIvr(_0x381298){return _0x381298===_0xa9ae('0x7b');}function getCallerId(_0x110405,_0x53445e,_0x4acac8){if(!_[_0xa9ae('0x3a')](_0x4acac8)&&typeof _0x4acac8===_0xa9ae('0x8e')&&!_[_0xa9ae('0x43')](_0x4acac8)){if(!_['isUndefined'](_0x53445e)&&typeof _0x53445e===_0xa9ae('0x8e')&&!_[_0xa9ae('0x43')](_0x53445e)){return util[_0xa9ae('0x78')]('\x22%s\x22\x20<%s>',_0x53445e,_0x4acac8);}return util['format'](_0xa9ae('0x8f'),_0x4acac8,_0x4acac8);}if(!_['isUndefined'](_0x110405)&&typeof _0x110405===_0xa9ae('0x8e')&&!_[_0xa9ae('0x43')](_0x110405)){return _0x110405;}return _0xa9ae('0x90');}function loggerCatchQueueSummary(_0x39fea9,_0x1bfef4){return function(_0x2830f5){freeVariablesPredictive(_0x1bfef4);emitVoiceQueueSummary(_0x1bfef4);emitCampaignSummary(_0x1bfef4);loggerSyncQueueSummary[_0xa9ae('0x91')](_0x39fea9,util[_0xa9ae('0x92')](_0x2830f5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3db460,_0x329edf){return function(_0x4fc3fa){loggerPredictive[_0xa9ae('0x91')](_0x329edf['name'],_0x3db460);loggerPredictive[_0xa9ae('0x91')](_0x4fc3fa[_0xa9ae('0x93')]);freeVariablesPredictive(_0x329edf);};}function loggerCatch(_0x255ddb){return function(_0xe80696){logger[_0xa9ae('0x91')](_0x255ddb,util['inspect'](_0xe80696,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x451330){return _0x451330&&!_[_0xa9ae('0x3a')](_0x451330)&&_0x451330[_0xa9ae('0x94')]>0x0;}function decremetOriginate(_0x379e1f){if(!_[_0xa9ae('0x3a')](_0x379e1f)&&_0x379e1f!==null){if(typeof _0x379e1f['originated']!==_0xa9ae('0x95')){if(_0x379e1f[_0xa9ae('0x72')]>0x0){_0x379e1f[_0xa9ae('0x72')]-=0x1;}else{logger[_0xa9ae('0x91')](_0xa9ae('0x96'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x40e417,_0x2f4a73,_0x5c9072){if(_0x2f4a73>_0x5c9072){for(var _0x192701=0x0;_0x192701<_0x2f4a73-_0x5c9072;_0x192701+=0x1){decremetOriginate(_0x40e417);}}}function loggerGetContactDialer(_0x25faf8,_0x579e2b,_0x50b8c3){return function(_0x45d547){checkContactLowerLimitOriginate(_0x579e2b,_0x50b8c3,0x0);logger[_0xa9ae('0x91')](_0x25faf8,util['inspect'](_0x45d547,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x52e575){return function(_0x21a1c1){if(isNotNull(_0x21a1c1)&&isNotNull(_0x21a1c1[0x0])){if(_0x21a1c1[0x0][_0xa9ae('0x97')]>0x0){_0x52e575[_0xa9ae('0x3b')]=_0xa9ae('0x98');logger['info']('[getContactDialer2][ReScheduled]'+_0x52e575[_0xa9ae('0x3e')],_0x21a1c1[0x0]['contactsRescheduled'],'contacts');}else{_0x52e575['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xa9ae('0x7c')](_0xa9ae('0x99')+_0x52e575[_0xa9ae('0x3e')]);}}};}function notSendMessagesQueue(_0x35e1b1){if(_0x35e1b1['sendMessageOneNotActive']){freeVariablesPredictive(_0x35e1b1);if(_0x35e1b1[_0xa9ae('0x72')]===0x0&&_0x35e1b1[_0xa9ae('0x54')]===0x0&&_0x35e1b1['waiting']===0x0&&(_0x35e1b1[_0xa9ae('0x50')]||0x0)===0x0){_0x35e1b1['sendMessageOneNotActive']=![];_0x35e1b1[_0xa9ae('0x4f')]=0x0;_0x35e1b1[_0xa9ae('0x3b')]=_0xa9ae('0x3d');loggerSyncQueueSummary[_0xa9ae('0x91')](_0xa9ae('0x9a'),_0x35e1b1[_0xa9ae('0x3e')],'is\x20not\x20active');}else{_0x35e1b1[_0xa9ae('0x3b')]=_0xa9ae('0x9b');loggerSyncQueueSummary[_0xa9ae('0x91')](_0xa9ae('0x9a'),_0x35e1b1[_0xa9ae('0x3e')],_0xa9ae('0x9c'));}emitVoiceQueueSummary(_0x35e1b1);}}function notSendMessagesCampaign(_0x193579){if(_0x193579[_0xa9ae('0x9d')]){if(_0x193579['originated']===0x0){_0x193579[_0xa9ae('0x9d')]=![];_0x193579[_0xa9ae('0x3b')]=_0xa9ae('0x3d');loggerSyncQueueSummary[_0xa9ae('0x91')](_0xa9ae('0x9e'),_0x193579[_0xa9ae('0x3e')],_0xa9ae('0x9f'));}else{_0x193579[_0xa9ae('0x3b')]=_0xa9ae('0x9b');loggerSyncQueueSummary[_0xa9ae('0x91')](_0xa9ae('0x9e'),_0x193579[_0xa9ae('0x3e')],_0xa9ae('0x9c'));}emitCampaignSummary(_0x193579);}}function createObjHistory(_0x411a14,_0x3ce69e,_0x235f2a,_0x2c8e7a,_0x3ff9fe){_0x411a14[_0xa9ae('0x3b')]=_0x235f2a;var _0x4ac97a=new Action(_0x411a14,_0x3ce69e);var _0x3fab8d=new History(_0x4ac97a);_0x3fab8d[_0xa9ae('0xa0')]=_0x2c8e7a;_0x3fab8d[_0xa9ae('0xa1')]=_0x3ff9fe;_0x3fab8d[_0xa9ae('0xa2')]=_0x4ac97a[_0xa9ae('0xa3')];return _0x3fab8d;}Dialer[_0xa9ae('0x1b')][_0xa9ae('0xa4')]=function(){var _0x1f2d7e=this;setInterval(function(){_0x1f2d7e[_0xa9ae('0xa5')](_0x1f2d7e['uniqueId'],_0xa9ae('0xa6'));_0x1f2d7e[_0xa9ae('0xa5')](_0x1f2d7e[_0xa9ae('0x24')],_0xa9ae('0xa7'));},0x32c8);};Dialer[_0xa9ae('0x1b')]['clearZombieChannels']=function(_0x4b62d8,_0x2beb1c){var _0x2ff96b=this;for(var _0x571129 in _0x4b62d8){if(typeof _0x4b62d8[_0x571129]!==_0xa9ae('0x95')){this[_0xa9ae('0x1e')][_0xa9ae('0xa8')](function(){if(!_[_0xa9ae('0xa9')](_0x4b62d8[_0x571129])){return ami[_0xa9ae('0xaa')]({'action':_0xa9ae('0xab'),'channel':_0x4b62d8[_0x571129]['channel']})[_0xa9ae('0xac')](function(_0xeddd49){if(_0xeddd49[_0xa9ae('0x3b')]===_0xa9ae('0xad')){setTimeout(function(){if(_0x4b62d8[_0x571129]&&_0x4b62d8[_0x571129][_0xa9ae('0x4c')]!=='ivr'){_0x2ff96b[_0xa9ae('0xae')](_0x2ff96b['voiceQueues'][_0x4b62d8[_0x571129][_0xa9ae('0xaf')]]);logger['error'](_0xa9ae('0xb0'),_0x2beb1c,_0x571129,_0x4b62d8[_0x571129][_0xa9ae('0xaf')]);delete _0x4b62d8[_0x571129];}if(_0x4b62d8[_0x571129]&&_0x4b62d8[_0x571129]['type']==='ivr'){_0x2ff96b[_0xa9ae('0xae')](_0x2ff96b[_0xa9ae('0x21')][_0x4b62d8[_0x571129][_0xa9ae('0xaf')]]);logger[_0xa9ae('0x91')](_0xa9ae('0xb1'),_0x2beb1c,_0x571129,_0x4b62d8[_0x571129][_0xa9ae('0xaf')]);delete _0x4b62d8[_0x571129];}},0x2328);}});}});}}};Dialer[_0xa9ae('0x1b')]['countReScheduled']=function(_0x317e4e){return BPromise['resolve']()[_0xa9ae('0xb2')](cmHopper[_0xa9ae('0xb3')](_0x317e4e))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xb4')]=function(_0x475329){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopperBlack[_0xa9ae('0xb4')](_0x475329))[_0xa9ae('0xac')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xb6')]=function(_0x4a241a){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x4a241a))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xb7')));};Dialer[_0xa9ae('0x1b')]['averageHandleTime']=function(_0x1ea4b1){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopperHistory[_0xa9ae('0xb8')](_0x1ea4b1))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xb9')));};Dialer[_0xa9ae('0x1b')]['rescheduleContact']=function(_0x49e4d3){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopper[_0xa9ae('0xba')](_0x49e4d3))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xbb')));};Dialer['prototype']['unlockContact']=function(_0x24f7d7,_0x41856b,_0x25e8ca){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopper[_0xa9ae('0xbc')](_0x24f7d7,_0x41856b,_0x25e8ca))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xbd')));};Dialer[_0xa9ae('0x1b')]['getContactDialer']=function(_0x8afdeb,_0x41f7b3,_0xf08c82,_0x381cc0){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopper[_0xa9ae('0xbe')](_0x8afdeb,_0x41f7b3,_0xf08c82,_0x381cc0))[_0xa9ae('0xac')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xbf')]=function(_0x4b1fca,_0x3ed329,_0xebf68){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopper['getContactDialerIvr'](_0x4b1fca,_0x3ed329,_0xebf68))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xc0')));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xc1')]=function(_0x304d2a){return BPromise[_0xa9ae('0xb5')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x304d2a))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xc2')));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xc3')]=function(_0x59b9a7){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopper[_0xa9ae('0xc3')](_0x59b9a7))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xc4')));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xc5')]=function(_0xbecf6b){return BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](cmHopperHistory[_0xa9ae('0xc5')](_0xbecf6b))['catch'](loggerCatch(_0xa9ae('0xc6')));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xae')]=function(_0x191473){if(!_[_0xa9ae('0x3a')](_0x191473)&&_0x191473!==null){if(typeof _0x191473[_0xa9ae('0x72')]!==_0xa9ae('0x95')){if(_0x191473[_0xa9ae('0x72')]>0x0){_0x191473[_0xa9ae('0x72')]-=0x1;}else{logger['error'](_0xa9ae('0xc7'));}}}else{logger[_0xa9ae('0x91')](_0xa9ae('0xc8'));}};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xc9')]=function(_0x43aab1,_0x3643d0){var _0x27637f=this;return function(_0x1f1512){_0x27637f['updateOriginated'](_0x3643d0);logger[_0xa9ae('0x91')](_0x43aab1,util[_0xa9ae('0x92')](_0x1f1512,{'showHidden':![],'depth':null}));};};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xca')]=function(_0x540e79,_0x2ca1c0,_0x373184){var _0x38de1f={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x2ca1c0);this['saveInDb'](_['merge'](_0x38de1f,_['pick'](_0x373184,['ContactId',_0xa9ae('0xcb'),_0xa9ae('0xcc'),_0xa9ae('0xcd'),_0xa9ae('0xce')])),_0xa9ae('0xcf'),_0xa9ae('0xd0'));logger['error'](_0x540e79);};Dialer[_0xa9ae('0x1b')][_0xa9ae('0xd1')]=function(_0xb51023){return _0xb51023==='Success';};Dialer['prototype'][_0xa9ae('0xd2')]=function(_0xcccfa9){return!_[_0xa9ae('0x3a')](_0xcccfa9)&&_0xcccfa9&&!_[_0xa9ae('0x3a')](_0xcccfa9['name'])&&!_['isUndefined'](_0xcccfa9[_0xa9ae('0x76')])&&_0xcccfa9[_0xa9ae('0x76')]&&(this['trunks'][util[_0xa9ae('0x78')](_0xa9ae('0xd3'),_0xcccfa9[_0xa9ae('0x3e')])][_0xa9ae('0xab')]==='reachable'||this[_0xa9ae('0x22')][util['format']('SIP/%s',_0xcccfa9[_0xa9ae('0x3e')])][_0xa9ae('0xab')]===_0xa9ae('0xd4'));};Dialer[_0xa9ae('0x1b')]['saveInDb']=function(_0x21bec2,_0x6345,_0x335982){this[_0xa9ae('0xc5')](_0x21bec2)[_0xa9ae('0xac')](loggerCatch(_0x6345));this[_0xa9ae('0xc3')](_0x21bec2)['catch'](loggerCatch(_0x335982));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x36')]=function(_0x5034ff){var _0x108746=this[_0xa9ae('0x26')][_0x5034ff[_0xa9ae('0xd5')]];var _0x370a7c;if(!_[_0xa9ae('0xa9')](_0x5034ff)&&!_['isNil'](_0x5034ff[_0xa9ae('0xd6')])&&!_['isNil'](_0x5034ff[_0xa9ae('0xd6')][_0xa9ae('0xd7')])&&_0x5034ff[_0xa9ae('0xd8')]===_0xa9ae('0xd9')&&_0x108746){if(_0x108746[_0xa9ae('0x4c')]!==_0xa9ae('0x7b')&&this[_0xa9ae('0x20')][_0x108746[_0xa9ae('0xaf')]][_0xa9ae('0xda')]&&_0x5034ff['value']===_0xa9ae('0xdb')){delete this[_0xa9ae('0x26')][_0x5034ff[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this[_0xa9ae('0x20')][_0x108746[_0xa9ae('0xaf')]]);this['voiceQueues'][_0x108746['queue']][_0xa9ae('0x5e')]+=0x1;this[_0xa9ae('0x20')][_0x108746[_0xa9ae('0xaf')]][_0xa9ae('0x5d')]+=0x1;_0x370a7c=new Hangup(_0x108746,_0x5034ff);_0x370a7c[_0xa9ae('0xa0')]=0x12;_0x370a7c[_0xa9ae('0xa1')]=_0xa9ae('0xdc');_0x370a7c[_0xa9ae('0xdd')]=_0xa9ae('0xde');this[_0xa9ae('0xdf')](_0x370a7c,_0xa9ae('0xe0'),_0xa9ae('0xe1'));}if(_0x108746[_0xa9ae('0x4c')]!==_0xa9ae('0x7b')&&this['voiceQueues'][_0x108746[_0xa9ae('0xaf')]][_0xa9ae('0xda')]&&_0x5034ff['value']===_0xa9ae('0xe2')){var _0x32f037=this;return new BPromise(function(_0x41b6a4,_0x2de17){delete _0x32f037[_0xa9ae('0x26')][_0x5034ff[_0xa9ae('0xd5')]];_0x32f037[_0xa9ae('0xae')](_0x32f037['voiceQueues'][_0x108746[_0xa9ae('0xaf')]]);_0x32f037['voiceQueues'][_0x108746['queue']][_0xa9ae('0x5e')]+=0x1;_0x32f037['voiceQueues'][_0x108746[_0xa9ae('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x200970=_0x32f037[_0xa9ae('0x20')][_0x108746['queue']];var _0x4b55d0=new Hangup(_0x108746,_0x5034ff);_0x4b55d0[_0xa9ae('0xa0')]=0x13;_0x4b55d0[_0xa9ae('0xa1')]=_0xa9ae('0xe3');_0x4b55d0[_0xa9ae('0xdd')]=_0xa9ae('0xde');_0x4b55d0[_0xa9ae('0xe4')]+=0x1;_0x4b55d0['countglobal']+=0x1;_0x4b55d0['amd']=!![];_0x32f037[_0xa9ae('0xc5')](_0x4b55d0)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xe5')));if(_0x4b55d0[_0xa9ae('0xe6')]+_0x4b55d0['countcongestionretry']+_0x4b55d0['countnoanswerretry']+_0x4b55d0[_0xa9ae('0xe7')]+_0x4b55d0['countdropretry']+_0x4b55d0[_0xa9ae('0xe8')]+_0x4b55d0[_0xa9ae('0xe4')]+_0x4b55d0['countagentrejectretry']>=_0x200970[_0xa9ae('0xe9')]){_0x32f037[_0xa9ae('0xea')](_0x4b55d0,_0x41b6a4,_0x2de17,_0xa9ae('0xeb'));}else{if(_0x4b55d0[_0xa9ae('0xe4')]>=_0x200970[_0xa9ae('0xec')]){_0x32f037['createStateFinal'](_0x4b55d0,_0x41b6a4,_0x2de17,'reason\x2019\x20machine....');}else{_0x32f037[_0xa9ae('0xba')]({'active':![],'countmachineretry':_0x4b55d0[_0xa9ae('0xe4')],'scheduledat':moment()[_0xa9ae('0xed')](_0x200970[_0xa9ae('0xee')],_0xa9ae('0xef'))['format'](_0xa9ae('0xf0')),'ContactId':_0x4b55d0[_0xa9ae('0xf1')],'ListId':_0x4b55d0['ListId'],'VoiceQueueId':_0x4b55d0[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x4b55d0[_0xa9ae('0xce')]||undefined})['catch'](loggerCatch(_0xa9ae('0xf2')));_0x41b6a4({'reschedule':0x1});}}});}if(_0x108746[_0xa9ae('0x4c')]===_0xa9ae('0x7b')&&this[_0xa9ae('0x21')][_0x108746[_0xa9ae('0xaf')]][_0xa9ae('0xda')]&&_0x5034ff[_0xa9ae('0xf3')]===_0xa9ae('0xdb')){delete this[_0xa9ae('0x26')][_0x5034ff[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this[_0xa9ae('0x21')][_0x108746[_0xa9ae('0xaf')]]);_0x370a7c=new Hangup(_0x108746,_0x5034ff);_0x370a7c['state']=0x12;_0x370a7c['statedesc']=_0xa9ae('0xdc');_0x370a7c[_0xa9ae('0xdd')]='AMD';this[_0xa9ae('0xdf')](_0x370a7c,'[syncHangupInAMDIvr][createHistory]',_0xa9ae('0xf4'));}if(_0x108746[_0xa9ae('0x4c')]===_0xa9ae('0x7b')&&this[_0xa9ae('0x21')][_0x108746['queue']][_0xa9ae('0xda')]&&_0x5034ff[_0xa9ae('0xf3')]==='MACHINE'){var _0x32f037=this;return new BPromise(function(_0x3f921a,_0x1f3a4b){delete _0x32f037[_0xa9ae('0x26')][_0x5034ff[_0xa9ae('0xd5')]];_0x32f037['updateOriginated'](_0x32f037[_0xa9ae('0x21')][_0x108746[_0xa9ae('0xaf')]]);_0x32f037[_0xa9ae('0x21')][_0x108746[_0xa9ae('0xaf')]][_0xa9ae('0x5e')]+=0x1;_0x32f037[_0xa9ae('0x21')][_0x108746['queue']][_0xa9ae('0x5d')]+=0x1;var _0x1ee66c=_0x32f037[_0xa9ae('0x21')][_0x108746[_0xa9ae('0xaf')]];var _0x476866=new Hangup(_0x108746,_0x5034ff);_0x476866['state']=0x13;_0x476866['statedesc']='Machine';_0x476866[_0xa9ae('0xdd')]=_0xa9ae('0xde');_0x476866[_0xa9ae('0xe4')]+=0x1;_0x476866[_0xa9ae('0xf5')]+=0x1;_0x476866[_0xa9ae('0xf6')]=!![];_0x32f037['createHistory'](_0x476866)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xe5')));if(_0x476866[_0xa9ae('0xe6')]+_0x476866['countcongestionretry']+_0x476866[_0xa9ae('0xf7')]+_0x476866[_0xa9ae('0xe7')]+_0x476866[_0xa9ae('0xf8')]+_0x476866[_0xa9ae('0xe8')]+_0x476866[_0xa9ae('0xe4')]+_0x476866[_0xa9ae('0xf9')]>=_0x1ee66c[_0xa9ae('0xe9')]){_0x32f037[_0xa9ae('0xea')](_0x476866,_0x3f921a,_0x1f3a4b,_0xa9ae('0xeb'));}else{if(_0x476866['countmachineretry']>=_0x1ee66c[_0xa9ae('0xec')]){_0x32f037[_0xa9ae('0xfa')](_0x476866,_0x3f921a,_0x1f3a4b,_0xa9ae('0xfb'));}else{_0x32f037['rescheduleContact']({'active':![],'countmachineretry':_0x476866[_0xa9ae('0xe4')],'scheduledat':moment()['add'](_0x1ee66c[_0xa9ae('0xee')],_0xa9ae('0xef'))['format'](_0xa9ae('0xf0')),'ContactId':_0x476866[_0xa9ae('0xf1')],'ListId':_0x476866[_0xa9ae('0xcb')],'VoiceQueueId':_0x476866[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x476866[_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x3f921a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xa9ae('0x32')]=function(_0x4f7af9){var _0x18c497=this[_0xa9ae('0x26')][_0x4f7af9[_0xa9ae('0xd5')]];var _0x190711=this;var _0x26dc67;if(_0x18c497&&_0x18c497[_0xa9ae('0x4c')]===_0xa9ae('0x7b')){delete this['uniqueId'][_0x4f7af9[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this[_0xa9ae('0x21')][_0x18c497['queue']]);this[_0xa9ae('0x21')][_0x18c497['queue']][_0xa9ae('0xfc')]+=0x1;_0x26dc67=new Hangup(_0x18c497,_0x4f7af9);this[_0xa9ae('0xc5')](_0x26dc67)['catch'](loggerCatch(_0xa9ae('0xfd')));this[_0xa9ae('0xc3')](_0x26dc67)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xfe')));}if(_0x18c497&&_0x18c497[_0xa9ae('0x4c')]!==_0xa9ae('0x7b')&&isNotNull(this[_0xa9ae('0x20')][_0x18c497[_0xa9ae('0xaf')]][_0xa9ae('0xff')])){delete this[_0xa9ae('0x26')][_0x4f7af9[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this['voiceQueues'][_0x18c497[_0xa9ae('0xaf')]]);this[_0xa9ae('0x20')][_0x18c497[_0xa9ae('0xaf')]]['outboundAnswerCallsDay']+=0x1;this[_0xa9ae('0x20')][_0x18c497[_0xa9ae('0xaf')]][_0xa9ae('0x5d')]+=0x1;_0x26dc67=new Hangup(_0x18c497,_0x4f7af9);_0x26dc67[_0xa9ae('0xa0')]=0x10;_0x26dc67['statedesc']=_0xa9ae('0x100');_0x26dc67['membername']='AGI';this[_0xa9ae('0xc5')](_0x26dc67)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xfd')));this[_0xa9ae('0xc3')](_0x26dc67)[_0xa9ae('0xac')](loggerCatch('[syncHangupIvr]'));}if(_0x18c497&&_0x18c497['type']!==_0xa9ae('0x7b')&&!isNotNull(this[_0xa9ae('0x20')][_0x18c497['queue']][_0xa9ae('0xff')])){delete this[_0xa9ae('0x26')][_0x4f7af9[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this[_0xa9ae('0x20')][_0x18c497['queue']]);this[_0xa9ae('0x20')][_0x18c497[_0xa9ae('0xaf')]][_0xa9ae('0x67')]+=0x1;_0x26dc67=new Hangup(_0x18c497,_0x4f7af9);_0x26dc67[_0xa9ae('0xa0')]=0xc;_0x26dc67[_0xa9ae('0xa1')]=_0x4f7af9['cause-txt'];_0x26dc67[_0xa9ae('0xdd')]='Unknow';this[_0xa9ae('0xc5')](_0x26dc67)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xfd')));this[_0xa9ae('0xc3')](_0x26dc67)['catch'](loggerCatch(_0xa9ae('0xfe')));}};Dialer['prototype'][_0xa9ae('0x30')]=function(_0x3574a6){var _0x205e6c=this[_0xa9ae('0x26')][_0x3574a6['uniqueid']];var _0x569435=this;if(this[_0xa9ae('0x20')][_0x3574a6['queue']]){if(_0x205e6c&&_0x205e6c[_0xa9ae('0x4c')]!==_0xa9ae('0x7b')){delete this['uniqueId'][_0x3574a6['uniqueid']];this['voiceQueues'][_0x3574a6['queue']][_0xa9ae('0x5e')]+=0x1;var _0x3ad8b6=new AgentComplete(_0x205e6c,_0x3574a6);if(_0x3574a6[_0xa9ae('0x101')]===_0xa9ae('0x102')){_0x3ad8b6['agiafterat']=this[_0xa9ae('0x20')][_0x3574a6['queue']][_0xa9ae('0x103')]&&this[_0xa9ae('0x20')][_0x3574a6[_0xa9ae('0xaf')]][_0xa9ae('0x104')]?moment()[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xa9ae('0xc5')](_0x3ad8b6)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x105')));this['moveContactManagedDialer'](_0x3ad8b6)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x106')));}}};Dialer['prototype'][_0xa9ae('0x107')]=function(_0x8f435){if(this['voiceQueues'][_0x8f435[_0xa9ae('0xaf')]]){if(this['uniqueId'][_0x8f435[_0xa9ae('0xd5')]]&&this[_0xa9ae('0x26')][_0x8f435[_0xa9ae('0xd5')]]['type']!==_0xa9ae('0x7b')){this[_0xa9ae('0xae')](this[_0xa9ae('0x20')][_0x8f435[_0xa9ae('0xaf')]]);this['uniqueId'][_0x8f435[_0xa9ae('0xd5')]][_0xa9ae('0x108')]=moment()[_0xa9ae('0x78')](_0xa9ae('0xf0'));}}};Dialer[_0xa9ae('0x1b')]['queueCallerAbandonCreateState']=function(_0x15be5d){this['createHistory'](_0x15be5d)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x105')));this[_0xa9ae('0xc3')](_0x15be5d)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x109')));};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x2c')]=function(_0x4c08fe){var _0x3afd59=this[_0xa9ae('0x26')][_0x4c08fe[_0xa9ae('0xd5')]];var _0x1ee253=this;if(this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]]){if(_0x3afd59&&_0x3afd59[_0xa9ae('0x4c')]!=='ivr'){delete this['uniqueId'][_0x4c08fe[_0xa9ae('0xd5')]];this[_0xa9ae('0xae')](this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]]);_0x3afd59[_0xa9ae('0x10a')]=moment()[_0xa9ae('0x78')](_0xa9ae('0xf0'));var _0xc888fa=new QueueCallerAbandon(_0x3afd59,_0x4c08fe);if(getSeconds(_0x3afd59[_0xa9ae('0x10a')],_0x3afd59[_0xa9ae('0x10b')])>=_0x3afd59['dialQueueTimeout']){this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x6c')]+=0x1;this['voiceQueues'][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x63')]+=0x1;this[_0xa9ae('0x20')][_0x4c08fe['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xc888fa['state']=0xa;_0xc888fa[_0xa9ae('0xa1')]=_0xa9ae('0x10c');_0xc888fa[_0xa9ae('0x10d')]='TIMEOUT';_0xc888fa[_0xa9ae('0x10e')]=this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]]['dialQueueProject2']?moment()[_0xa9ae('0x78')](_0xa9ae('0xf0')):undefined;_0xc888fa[_0xa9ae('0xf8')]+=0x1;_0xc888fa[_0xa9ae('0xf5')]+=0x1;if(_0xc888fa[_0xa9ae('0xf8')]>=this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x10f')]){this[_0xa9ae('0x110')](_0xc888fa);}else{this[_0xa9ae('0xba')]({'active':![],'countdropretry':_0xc888fa['countdropretry'],'scheduledat':moment()[_0xa9ae('0xed')](this['voiceQueues'][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x111')],_0xa9ae('0xef'))[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3afd59[_0xa9ae('0xf1')],'ListId':_0x3afd59[_0xa9ae('0xcb')],'VoiceQueueId':_0x3afd59[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x3afd59[_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x112')));var _0x24fa38=new History(_0xc888fa);_0x24fa38['state']=0xa;_0x24fa38['statedesc']=_0xa9ae('0x10c');_0x24fa38['starttime']=moment()[_0xa9ae('0x78')](_0xa9ae('0xf0'));_0x24fa38[_0xa9ae('0xa2')]=_0x24fa38[_0xa9ae('0xa3')];_0x24fa38[_0xa9ae('0x113')]=_0xc888fa['calleridname'];_0x24fa38['calleridnum']=_0xc888fa[_0xa9ae('0x114')];this[_0xa9ae('0xc5')](_0x24fa38)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x115')));}}else{this[_0xa9ae('0x20')][_0x4c08fe['queue']][_0xa9ae('0x6b')]+=0x1;this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x116')]+=0x1;_0xc888fa[_0xa9ae('0xa0')]=0xb;_0xc888fa['statedesc']=_0xa9ae('0x117');_0xc888fa[_0xa9ae('0x10d')]=_0xa9ae('0x118');_0xc888fa[_0xa9ae('0xe8')]+=0x1;_0xc888fa['countglobal']+=0x1;if(_0xc888fa[_0xa9ae('0xe8')]>=this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x119')]){this[_0xa9ae('0x110')](_0xc888fa);}else{this[_0xa9ae('0xba')]({'active':![],'countabandonedretry':_0xc888fa['countabandonedretry'],'scheduledat':moment()['add'](this[_0xa9ae('0x20')][_0x4c08fe[_0xa9ae('0xaf')]][_0xa9ae('0x11a')],_0xa9ae('0xef'))[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3afd59['ContactId'],'ListId':_0x3afd59[_0xa9ae('0xcb')],'VoiceQueueId':_0x3afd59[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x3afd59[_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x11b')));var _0x24fa38=new History(_0xc888fa);_0x24fa38[_0xa9ae('0xa0')]=0xb;_0x24fa38[_0xa9ae('0xa1')]=_0xa9ae('0x117');_0x24fa38[_0xa9ae('0xa3')]=moment()[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x24fa38[_0xa9ae('0xa2')]=_0x24fa38['starttime'];_0x24fa38[_0xa9ae('0x113')]=_0xc888fa[_0xa9ae('0x113')];_0x24fa38['calleridnum']=_0xc888fa['calleridnum'];this['createHistory'](_0x24fa38)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x11c')));}}}}};Dialer[_0xa9ae('0x1b')]['syncNewExten']=function(_0x42ffa8){if(this[_0xa9ae('0x24')][_0x42ffa8[_0xa9ae('0xd5')]]){this[_0xa9ae('0x24')][_0x42ffa8[_0xa9ae('0xd5')]][_0xa9ae('0x11d')]=_0x42ffa8[_0xa9ae('0x11d')];}if(this[_0xa9ae('0x26')][_0x42ffa8[_0xa9ae('0xd5')]]){this['uniqueId'][_0x42ffa8[_0xa9ae('0xd5')]][_0xa9ae('0x11d')]=_0x42ffa8[_0xa9ae('0x11d')];}};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x37')]=function(_0x297f69){if(strategy[this[_0xa9ae('0x20')][this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]][_0xa9ae('0x11f')]]===_0xa9ae('0x1a')){if(this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]]&&_[_0xa9ae('0xa9')](this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0x120')])&&_0x297f69[_0xa9ae('0xab')]==='1'&&_0x297f69['paused']==='0'){if(this[_0xa9ae('0x121')][_0x297f69['stateinterface']]){if(!this['agents'][_0x297f69[_0xa9ae('0x122')]][_0xa9ae('0x120')]){this[_0xa9ae('0x121')][_0x297f69['stateinterface']][_0xa9ae('0x120')]=!![];this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0x120')]=!![];this[_0xa9ae('0x24')][_0x297f69['actionid']]['stateinterface']=_0x297f69[_0xa9ae('0x122')];}}}}else if((strategy[this[_0xa9ae('0x20')][this[_0xa9ae('0x24')][_0x297f69['actionid']][_0xa9ae('0xaf')]]['strategy']]||_0xa9ae('0x19'))==='rrmemory'){if(this[_0xa9ae('0x24')][_0x297f69['actionid']]){if(this[_0xa9ae('0x121')][_0x297f69[_0xa9ae('0x122')]]){this['actions'][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0x122')]=_0x297f69[_0xa9ae('0x122')];if(_[_0xa9ae('0xa9')](this[_0xa9ae('0x123')][this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]]['queue']])){this['queueBooked'][this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]]=[];}this['queueBooked'][this[_0xa9ae('0x24')][_0x297f69[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]][_0xa9ae('0x124')](_[_0xa9ae('0x8a')](_[_0xa9ae('0x125')](this['actions'][_0x297f69[_0xa9ae('0x11e')]],[_0xa9ae('0x126'),_0xa9ae('0x122')]),{'status':_0x297f69[_0xa9ae('0xab')],'paused':_0x297f69[_0xa9ae('0x127')]}));}}}};function unlockQueueStatus(_0x411ade,_0x2f4fcd){setTimeout(function(){if(_['isUndefined'](_0x411ade['queueStatusComplete'])){loggerBooked[_0xa9ae('0x91')](_0xa9ae('0x128'),_0x2f4fcd);}_0x411ade[_0xa9ae('0x129')]=!![];loggerBooked['info'](_0xa9ae('0x12a'),_0x2f4fcd,JSON['stringify'](_[_0xa9ae('0x125')](_0x411ade,[_0xa9ae('0x3e'),_0xa9ae('0x129')])));},0x1f3);}Dialer[_0xa9ae('0x1b')]['syncQueueStatusComplete']=function(_0x46d228){var _0x3301ce=this;var _0x3efd92=_0x3301ce[_0xa9ae('0x20')][_0x3301ce['actions'][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]];if(strategy[this[_0xa9ae('0x20')][this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]][_0xa9ae('0x11f')]]===_0xa9ae('0x1a')){if(this[_0xa9ae('0x24')][_0x46d228['actionid']]&&this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]['stateinterface']){this['preview'][_0xa9ae('0x12b')](this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]['idHopper'],this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0x122')])[_0xa9ae('0xac')](function(_0x52b409){logger[_0xa9ae('0x91')](_0xa9ae('0x12c'),util['inspect'](_0x52b409,{'showHidden':![],'depth':null}));})[_0xa9ae('0x1d')](function(){_0x3301ce[_0xa9ae('0xae')](_0x3301ce['voiceQueues'][_0x3301ce[_0xa9ae('0x24')][_0x46d228['actionid']]['queue']]);_0x3301ce[_0xa9ae('0x121')][_0x3301ce[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0x122')]]['locked']=![];delete _0x3301ce['actions'][_0x46d228[_0xa9ae('0x11e')]];unlockQueueStatus(_0x3efd92);});}else{this[_0xa9ae('0xae')](this[_0xa9ae('0x20')][this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xf1')],'ListId':this['actions'][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xcb')],'VoiceQueueId':this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xce')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]];unlockQueueStatus(_0x3efd92);}}else if((strategy[this[_0xa9ae('0x20')][this[_0xa9ae('0x24')][_0x46d228['actionid']][_0xa9ae('0xaf')]][_0xa9ae('0x11f')]]||_0xa9ae('0x19'))===_0xa9ae('0x19')){var _0x4d6e90;if(this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]&&!_[_0xa9ae('0x43')](this[_0xa9ae('0x123')][this['actions'][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]])){if(this['queueBookedRR'][_0x3301ce['actions'][_0x46d228['actionid']]['queue']]){this[_0xa9ae('0x2b')][_0x3301ce[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]]=this[_0xa9ae('0x2b')][this['actions'][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]]?this[_0xa9ae('0x2b')][this['actions'][_0x46d228['actionid']][_0xa9ae('0xaf')]]:this[_0xa9ae('0x123')][this['actions'][_0x46d228[_0xa9ae('0x11e')]]['queue']]?this[_0xa9ae('0x123')][this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]['queue']][_0xa9ae('0x12d')]||0x0:0x0;}this[_0xa9ae('0x123')][this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]]['queue']][_0xa9ae('0x12d')]=this[_0xa9ae('0x2b')][this[_0xa9ae('0x24')][_0x46d228[_0xa9ae('0x11e')]][_0xa9ae('0xaf')]];for(var _0x34941d=0x0;_0x34941d=0x0;})['catch'](myreject(_0x67aee5)));}}else{_0x2256ba[_0xa9ae('0x124')](ami[_0xa9ae('0xaa')]({'action':_0xa9ae('0x145'),'command':util[_0xa9ae('0x78')]('iftime\x20%s,%s',_0x3ffd61,!_[_0xa9ae('0x3a')](config['timezones'][_0x23662b])?_0x23662b:'')})[_0xa9ae('0xb2')](function(_0x2ca452){return _0x2ca452[_0xa9ae('0x146')][_0xa9ae('0x143')](_0xa9ae('0x144'))>=0x0;})[_0xa9ae('0xac')](myreject(_0x67aee5)));}BPromise['all'](_0x2256ba)[_0xa9ae('0xb2')](function(_0x3bc8b9){var _0x334a41=_[_0xa9ae('0x147')](_0x3bc8b9);if(_0x334a41){return _0x29c839(_0x334a41);}else{_0x14ad4c[_0xa9ae('0x3b')]=_0x1dd0c6?_0xa9ae('0x148'):_0xa9ae('0x149');return _0x67aee5(msgResponse(_0xa9ae('0x14a'),'Failure',_0xa9ae('0x14b')+_0x1dd0c6+'\x20'+_0x7f1be3+_0xa9ae('0x14c')+util[_0xa9ae('0x92')](_0x3ffd61,{'showHidden':![],'depth':null})+_0xa9ae('0x14d')+_0x23662b));}})[_0xa9ae('0xac')](function(_0x26384b){return _0x67aee5(msgResponse(_0xa9ae('0x139'),_0xa9ae('0x13b'),JSON[_0xa9ae('0x47')](_0x26384b)));});});};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x14e')]=function(_0x45cfe2){var _0x4bcc4c=this;return function(){switch(_0x45cfe2[_0xa9ae('0x59')]){case _0xa9ae('0x14f'):freeVariablesPredictive(_0x45cfe2);_0x4bcc4c[_0xa9ae('0x150')](_0x45cfe2,0x1);break;case'power':freeVariablesPredictive(_0x45cfe2);_0x4bcc4c['handlePower'](_0x45cfe2,_0x45cfe2[_0xa9ae('0x151')]);break;case _0xa9ae('0x8'):_0x4bcc4c[_0xa9ae('0x8')](_0x45cfe2);break;case'booked':freeVariablesPredictive(_0x45cfe2);_0x4bcc4c[_0xa9ae('0x150')](_0x45cfe2,0x1);break;default:freeVariablesPredictive(_0x45cfe2);logger[_0xa9ae('0x91')]('Queue',_0x45cfe2[_0xa9ae('0x3e')],'method\x20not\x20recognized');}};};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x152')]=function(_0x2ae975){var _0x59bb2e=this;return function(){_0x59bb2e[_0xa9ae('0x153')](_0x2ae975);};};Dialer[_0xa9ae('0x1b')]['syncQueueSummary']=function(_0x3ea854){var _0x53ecc9=this;if(isNotPreview(_0x3ea854[_0xa9ae('0x59')])){if(isVoiceQueueOutbound(_0x3ea854[_0xa9ae('0x4c')])&&isActive(_0x3ea854[_0xa9ae('0x58')])){_0x3ea854[_0xa9ae('0x9d')]=!![];BPromise[_0xa9ae('0xb5')]()[_0xa9ae('0xb2')](checkIsLoggedIn(_0x3ea854,_0x3ea854[_0xa9ae('0x154')]))[_0xa9ae('0xb2')](checkIsActive(_0x3ea854,_0x3ea854[_0xa9ae('0x58')]))[_0xa9ae('0xb2')](checkInterval(_0x3ea854))[_0xa9ae('0xb2')](_0x53ecc9[_0xa9ae('0x155')](_0x3ea854))[_0xa9ae('0xb2')](_0x53ecc9['checkIfTime'](_0x3ea854[_0xa9ae('0x156')],_0x3ea854[_0xa9ae('0x157')],_0x3ea854['name'],_0x3ea854))[_0xa9ae('0xb2')](_0x53ecc9[_0xa9ae('0x13a')](_0x3ea854[_0xa9ae('0x41')],_0x3ea854['dialTimezone'],_0x3ea854[_0xa9ae('0x3e')],_0x3ea854))[_0xa9ae('0xb2')](_0x53ecc9[_0xa9ae('0x14e')](_0x3ea854))[_0xa9ae('0xac')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3ea854));}else{notSendMessagesQueue(_0x3ea854);}}else{freeVariablesPredictive(_0x3ea854);}};Dialer['prototype'][_0xa9ae('0x136')]=function(){var _0x1cc4a7=this;var _0x52c404;for(var _0x3d99ce in this['campaigns']){if(typeof this[_0xa9ae('0x21')][_0x3d99ce]!==_0xa9ae('0x95')){_0x52c404=this['campaigns'][_0x3d99ce];if(isCampaignIvr(_0x52c404[_0xa9ae('0x4c')])&&isActive(_0x52c404[_0xa9ae('0x76')])){_0x52c404['sendMessageOneNotActive']=!![];BPromise[_0xa9ae('0xb5')]()['then'](checkIsActive(_0x52c404,_0x52c404['active']))[_0xa9ae('0xb2')](checkInterval(_0x52c404))[_0xa9ae('0xb2')](_0x1cc4a7[_0xa9ae('0x155')](_0x52c404))['then'](_0x1cc4a7[_0xa9ae('0x158')](_0x52c404[_0xa9ae('0x156')],_0x52c404[_0xa9ae('0x157')],_0x52c404[_0xa9ae('0x3e')],_0x52c404))['then'](_0x1cc4a7[_0xa9ae('0x13a')](_0x52c404['Interval'],_0x52c404[_0xa9ae('0x157')],_0x52c404[_0xa9ae('0x3e')],_0x52c404))[_0xa9ae('0xb2')](_0x1cc4a7[_0xa9ae('0x152')](_0x52c404))[_0xa9ae('0xac')](loggerCatchQueueSummary(_0xa9ae('0x159'),_0x52c404));}else{notSendMessagesCampaign(_0x52c404);}}}};function getCallerIdRandom(_0x360fad,_0x55364d){var _0xf19998;var _0x354cc3;var _0x5111c2;if(_0x55364d<=0x0){_0x55364d=0x1;}_0xf19998=new RegExp(_0xa9ae('0x15a')+_0x55364d+'}$');_0x354cc3=Math[_0xa9ae('0x15b')](0xa,_0x55364d-0x1);_0x5111c2=Math[_0xa9ae('0x15b')](0xa,_0x55364d)-0x1;return util[_0xa9ae('0x78')]('%s',_[_0xa9ae('0x15c')](_0x360fad,_0xf19998,_[_0xa9ae('0x15d')](_0x354cc3,_0x5111c2)));}function extractCalleridName(_0x49e3b4){var _0x501b5d=_0x49e3b4[_0xa9ae('0x15e')](/"(.*?)"/);return _0x501b5d?_0x501b5d[0x1]:_0x49e3b4;}function extractCalleridNumber(_0x7a2482){var _0x81bc83=_0x7a2482[_0xa9ae('0x15e')](/<(.*?)>/);return _0x81bc83?_0x81bc83[0x1]:_0x7a2482;}Dialer[_0xa9ae('0x1b')][_0xa9ae('0x15f')]=function(_0x332496,_0x3af985){var _0x2df26e=this;var _0x475e29=uuid['v4']();this[_0xa9ae('0x24')][_0x475e29]=new Action(_0x332496,_0x3af985,_0x475e29);return new BPromise(function(_0x2499cb,_0x2ed298){if(_[_0xa9ae('0x3a')](_0x332496)&&typeof _0x332496!=='object'){return _0x2ed298(msgResponse(_0xa9ae('0x160'),_0xa9ae('0x13b'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x3af985[_0xa9ae('0x161')]['phone'])||_0x3af985[_0xa9ae('0x161')][_0xa9ae('0x162')]===null){return _0x2ed298(msgResponse('originate','Failure',_0xa9ae('0x163')));}var _0x893131={'XMD-CALLERID':_0x2df26e[_0xa9ae('0x24')][_0x475e29][_0xa9ae('0x164')](),'XMD-AGI':_0x332496[_0xa9ae('0xff')]?util[_0xa9ae('0x78')](_0xa9ae('0x165'),ipAgi,_0x332496['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x332496['dialQueueProject2']?util[_0xa9ae('0x78')](_0xa9ae('0x165'),ipAgi,_0x332496[_0xa9ae('0x103')]):'NONE','XMD-QUEUE':_0x332496[_0xa9ae('0x4c')]===_0xa9ae('0x4d')?util[_0xa9ae('0x78')](_0xa9ae('0x166'),_0x332496[_0xa9ae('0x3e')],_0x332496[_0xa9ae('0x167')]||'',_0x332496[_0xa9ae('0x104')]?'c':'',_0x332496[_0xa9ae('0x168')]||0x3):_0xa9ae('0x169'),'XMD-CONTACTID':_0x3af985[_0xa9ae('0xf1')],'XMD-CDRTYPE':_0xa9ae('0x7'),'CALLERID(all)':_0x2df26e['actions'][_0x475e29][_0xa9ae('0x164')](),'XMD-AMD':_0x332496['dialAMDActive']?_0xa9ae('0x16a'):_0xa9ae('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x332496['dialAMDActive']){_0x893131[_0xa9ae('0x16b')]=_0x332496[_0xa9ae('0x16c')]||0x9c4;_0x893131[_0xa9ae('0x16d')]=_0x332496[_0xa9ae('0x16e')]||0x5dc;_0x893131[_0xa9ae('0x16f')]=_0x332496[_0xa9ae('0x170')]||0x320;_0x893131[_0xa9ae('0x171')]=_0x332496['dialAMDTotalAnalysisTime']||0x1388;_0x893131[_0xa9ae('0x172')]=_0x332496[_0xa9ae('0x173')]||0x64;_0x893131[_0xa9ae('0x174')]=_0x332496[_0xa9ae('0x175')]||0x32;_0x893131['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x332496[_0xa9ae('0x176')]||0x3;_0x893131['XMD-AMDSILENCETHRESHOLD']=_0x332496[_0xa9ae('0x177')]||0x100;_0x893131[_0xa9ae('0x178')]=_0x332496[_0xa9ae('0x179')]||0x1388;}if(_0x332496['type']===_0xa9ae('0x4d')){_0x893131['XMD-VOICEQUEUEID']=_0x3af985[_0xa9ae('0xcd')];}else{_0x893131[_0xa9ae('0x17a')]=_0x3af985[_0xa9ae('0xce')];}for(var _0x2c007e in _0x3af985['Contact']){if(typeof _0x3af985[_0xa9ae('0x161')][_0x2c007e]!==_0xa9ae('0x95')){if(isNotNull(_0x3af985[_0xa9ae('0x161')][_0x2c007e])&&_0x2c007e!=='id'&&_0x2c007e!==_0xa9ae('0x17b')&&_0x2c007e!==_0xa9ae('0x17c')&&_0x2c007e!==_0xa9ae('0x17d')){_0x893131[util[_0xa9ae('0x78')](_0xa9ae('0x17e'),_0xa9ae('0x17f'),_['toUpper'](_0x2c007e))]=_0x3af985[_0xa9ae('0x161')][_0x2c007e];}}}var _0x1456e3=_0x2df26e[_0xa9ae('0xd2')](_0x332496[_0xa9ae('0x75')])?getCallerId(_0x332496[_0xa9ae('0x75')][_0xa9ae('0x77')],_0x332496[_0xa9ae('0x5a')],_0x332496[_0xa9ae('0x180')]>0x0?getCallerIdRandom(_0x332496[_0xa9ae('0x5b')],_0x332496[_0xa9ae('0x180')]):_0x332496[_0xa9ae('0x5b')]):getCallerId(_[_0xa9ae('0xa9')](_0x332496[_0xa9ae('0x137')])?_0x332496['Trunk']['callerid']:_0x332496[_0xa9ae('0x137')][_0xa9ae('0x77')],_0x332496[_0xa9ae('0x5a')],_0x332496[_0xa9ae('0x180')]>0x0?getCallerIdRandom(_0x332496[_0xa9ae('0x5b')],_0x332496[_0xa9ae('0x180')]):_0x332496[_0xa9ae('0x5b')]);if(_0x1456e3){_0x893131[_0xa9ae('0x181')]=_0x2df26e[_0xa9ae('0x24')][_0x475e29][_0xa9ae('0x182')]=extractCalleridName(_0x1456e3);_0x893131['XMD-ORIGINATECALLERIDNUM']=_0x2df26e[_0xa9ae('0x24')][_0x475e29][_0xa9ae('0x183')]=extractCalleridNumber(_0x1456e3);}return ami[_0xa9ae('0xaa')]({'actionid':_0x475e29,'action':_0xa9ae('0x160'),'channel':_0x2df26e['isTrunkReachable'](_0x332496[_0xa9ae('0x75')])?util[_0xa9ae('0x78')](_0xa9ae('0x184'),_0x332496[_0xa9ae('0x75')]['name'],isNotNull(_0x332496[_0xa9ae('0x5c')])?_0x332496[_0xa9ae('0x5c')][_0xa9ae('0x185')]()||'':'',_0x332496[_0xa9ae('0x186')]>0x0?_0x3af985[_0xa9ae('0x161')]['phone'][_0xa9ae('0x187')](_0x332496[_0xa9ae('0x186')]):_0x3af985[_0xa9ae('0x161')][_0xa9ae('0x162')]):util[_0xa9ae('0x78')](_0xa9ae('0x184'),_['isNil'](_0x332496[_0xa9ae('0x137')])?_0x332496[_0xa9ae('0x75')][_0xa9ae('0x3e')]:_0x332496[_0xa9ae('0x137')][_0xa9ae('0x3e')],isNotNull(_0x332496[_0xa9ae('0x5c')])?_0x332496[_0xa9ae('0x5c')][_0xa9ae('0x185')]()||'':'',_0x332496['dialCutDigit']>0x0?_0x3af985['Contact'][_0xa9ae('0x162')][_0xa9ae('0x187')](_0x332496[_0xa9ae('0x186')]):_0x3af985['Contact'][_0xa9ae('0x162')]),'callerid':_0x1456e3,'Exten':_0xa9ae('0xd9'),'Context':_0xa9ae('0x188'),'Priority':'1','variable':_0x893131,'timeout':(_0x332496['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x475e29})[_0xa9ae('0xb2')](function(_0x1b3ca7){return _0x2499cb(_0x1b3ca7);})[_0xa9ae('0xac')](function(_0x2c8315){_0x332496['outboundOriginateFailureCallsDay']+=0x1;var _0x673977=new History(_0x2df26e['actions'][_0x475e29]);logger[_0xa9ae('0x91')](util[_0xa9ae('0x78')]('[originateError]:\x20%s',JSON[_0xa9ae('0x47')](_0x2c8315)));_0x673977[_0xa9ae('0xa0')]=0xe;_0x673977['statedesc']='OriginateError';_0x673977[_0xa9ae('0xa3')]=moment()[_0xa9ae('0x78')](_0xa9ae('0xf0'));_0x673977[_0xa9ae('0xa2')]=_0x673977[_0xa9ae('0xa3')];_0x2df26e['createHistory'](_0x673977)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x189')));_0x2df26e[_0xa9ae('0xc3')](_0x673977)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x189')))[_0xa9ae('0x1d')](function(){delete _0x2df26e[_0xa9ae('0x24')][_0x475e29];return _0x2ed298(msgResponse(_0xa9ae('0x160'),_0xa9ae('0x46'),'originate\x20action\x20Error'));});});});};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x18a')]=function(_0x26ddc8){var _0x1d64e2=this[_0xa9ae('0x24')][_0x26ddc8[_0xa9ae('0x11e')]];if(_0x1d64e2){delete this[_0xa9ae('0x24')][_0x26ddc8[_0xa9ae('0x11e')]];_0x1d64e2[_0xa9ae('0x10b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x313621=_0x1d64e2[_0xa9ae('0x4c')]===_0xa9ae('0x7b')?this[_0xa9ae('0x21')][_0x1d64e2[_0xa9ae('0xaf')]]:this['voiceQueues'][_0x1d64e2[_0xa9ae('0x18b')]()];if(!this['isSuccess'](_0x26ddc8[_0xa9ae('0x18c')])){this['updateOriginated'](_0x313621);return this['callProgressDetecting'](_0x1d64e2,_0x313621,_0x26ddc8)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x18d')));}this[_0xa9ae('0x26')][_0x26ddc8['uniqueid']]=_0x1d64e2;}};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x18e')]=function(_0x45422f,_0x12b366,_0x29e0bd){var _0x36bf68=new History(_0x12b366);if(_0x36bf68['countbusyretry']+_0x36bf68[_0xa9ae('0x18f')]+_0x36bf68[_0xa9ae('0xf7')]+_0x36bf68[_0xa9ae('0xe7')]+_0x36bf68['countdropretry']+_0x36bf68[_0xa9ae('0xe8')]+_0x36bf68[_0xa9ae('0xe4')]+_0x36bf68['countagentrejectretry']>=_0x29e0bd[_0xa9ae('0xe9')]-0x1){return!![];}switch(_0x45422f){case 0x3:if(_0x36bf68[_0xa9ae('0xf7')]>=_0x29e0bd['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countnoanswerretry':_0x36bf68[_0xa9ae('0xf7')]+=0x1,'scheduledat':moment()[_0xa9ae('0xed')](_0x29e0bd[_0xa9ae('0x190')],_0xa9ae('0xef'))[_0xa9ae('0x78')](_0xa9ae('0xf0')),'ContactId':_0x36bf68['ContactId'],'ListId':_0x36bf68[_0xa9ae('0xcb')],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68['CampaignId']||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x191')));break;case 0x5:if(_0x36bf68[_0xa9ae('0xe6')]>=_0x29e0bd[_0xa9ae('0x192')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countbusyretry':_0x36bf68[_0xa9ae('0xe6')]+=0x1,'scheduledat':moment()[_0xa9ae('0xed')](_0x29e0bd['dialBusyRetryFrequency'],_0xa9ae('0xef'))[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68[_0xa9ae('0xcb')],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x36bf68['countcongestionretry']>=_0x29e0bd[_0xa9ae('0x193')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countcongestionretry':_0x36bf68['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa9ae('0xed')](_0x29e0bd[_0xa9ae('0x194')],_0xa9ae('0xef'))[_0xa9ae('0x78')](_0xa9ae('0xf0')),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68[_0xa9ae('0xcb')],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68['CampaignId']||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x195')));break;case 0x0:if(_0x36bf68[_0xa9ae('0xe7')]>=_0x29e0bd['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x36bf68['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x29e0bd[_0xa9ae('0x196')],_0xa9ae('0xef'))[_0xa9ae('0x78')](_0xa9ae('0xf0')),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68['ListId'],'VoiceQueueId':_0x36bf68['VoiceQueueId']||undefined,'CampaignId':_0x36bf68[_0xa9ae('0xce')]||undefined})['catch'](loggerCatch(_0xa9ae('0x197')));}break;case 0xa:if(_0x36bf68[_0xa9ae('0xf8')]>=_0x29e0bd[_0xa9ae('0x10f')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countdropretry':_0x36bf68['countdropretry']+=0x1,'scheduledat':moment()[_0xa9ae('0xed')](_0x29e0bd[_0xa9ae('0x111')],_0xa9ae('0xef'))[_0xa9ae('0x78')](_0xa9ae('0xf0')),'ContactId':_0x36bf68['ContactId'],'ListId':_0x36bf68[_0xa9ae('0xcb')],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68[_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x36bf68[_0xa9ae('0xe8')]>=_0x29e0bd[_0xa9ae('0x119')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countabandonedretry':_0x36bf68['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x29e0bd[_0xa9ae('0x11a')],_0xa9ae('0xef'))['format'](_0xa9ae('0xf0')),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68['ListId'],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68['CampaignId']||undefined})['catch'](loggerCatch(_0xa9ae('0x11b')));break;case 0x13:if(_0x36bf68[_0xa9ae('0xe4')]>=_0x29e0bd[_0xa9ae('0xec')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countmachineretry':_0x36bf68['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x29e0bd[_0xa9ae('0xee')],_0xa9ae('0xef'))['format'](_0xa9ae('0xf0')),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68['ListId'],'VoiceQueueId':_0x36bf68[_0xa9ae('0xcd')]||undefined,'CampaignId':_0x36bf68['CampaignId']||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0xf2')));break;case 0x14:if(_0x36bf68[_0xa9ae('0xf9')]>=_0x29e0bd[_0xa9ae('0x198')]-0x1){return!![];}this[_0xa9ae('0xba')]({'active':![],'countagentrejectretry':_0x36bf68[_0xa9ae('0xf9')]+=0x1,'scheduledat':moment()[_0xa9ae('0xed')](_0x29e0bd['dialAgentRejectRetryFrequency'],_0xa9ae('0xef'))['format'](_0xa9ae('0xf0')),'ContactId':_0x36bf68[_0xa9ae('0xf1')],'ListId':_0x36bf68[_0xa9ae('0xcb')],'VoiceQueueId':_0x36bf68['VoiceQueueId']||undefined,'CampaignId':_0x36bf68[_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x199')));break;default:return!![];}};Dialer[_0xa9ae('0x1b')]['callProgressDetecting']=function(_0x1edb6f,_0x5cbef7,_0x272fcf){var _0x3ead01=this;var _0xc368a2=new History(_0x1edb6f);return new BPromise(function(_0x12d494,_0x4860d6){if(_['isUndefined'](_0x5cbef7)&&typeof _0x5cbef7!=='object'){return _0x4860d6(msgResponse(_0xa9ae('0x19a'),_0xa9ae('0x13b'),'entity\x20is\x20undefine'));}if(_[_0xa9ae('0x3a')](_0x272fcf)&&typeof _0x272fcf!==_0xa9ae('0x19b')){return _0x4860d6(msgResponse(_0xa9ae('0x19a'),_0xa9ae('0x13b'),_0xa9ae('0x19c')));}switch(_0x272fcf[_0xa9ae('0x101')]){case'0':_0x5cbef7['outboundNoSuchCallsDay']+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0x0;_0xc368a2[_0xa9ae('0xa1')]=_0xa9ae('0x19d');_0xc368a2[_0xa9ae('0xe7')]+=0x1;_0xc368a2[_0xa9ae('0xf5')]+=0x1;ami[_0xa9ae('0x4b')](_0xa9ae('0x19e'),ut[_0xa9ae('0x19f')](_0x1edb6f,_0xa9ae('0x1a0')));_0x3ead01[_0xa9ae('0xc5')](_0xc368a2)[_0xa9ae('0xac')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ead01[_0xa9ae('0x18e')](0x0,_0x1edb6f,_0x5cbef7)){if(_0xc368a2[_0xa9ae('0xe7')]>=_0x5cbef7[_0xa9ae('0x1a1')]){_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1a2'));}else{_0x3ead01['stateGlobal'](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1a2'));}}break;case'3':_0x5cbef7[_0xa9ae('0x64')]+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0x3;_0xc368a2[_0xa9ae('0xa1')]=_0xa9ae('0x1a3');_0xc368a2[_0xa9ae('0xf7')]+=0x1;_0xc368a2['countglobal']+=0x1;ami[_0xa9ae('0x4b')]('custom:agentnoanswer',ut[_0xa9ae('0x19f')](_0x1edb6f,_0xa9ae('0x1a4')));_0x3ead01[_0xa9ae('0xc5')](_0xc368a2)[_0xa9ae('0xac')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3ead01[_0xa9ae('0x18e')](0x3,_0x1edb6f,_0x5cbef7)){if(_0xc368a2[_0xa9ae('0xf7')]>=_0x5cbef7[_0xa9ae('0x1a5')]){_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1a6'));}else{_0x3ead01[_0xa9ae('0xea')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1a6'));}}break;case'5':_0x5cbef7[_0xa9ae('0x60')]+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0x5;_0xc368a2['statedesc']='Busy';_0xc368a2[_0xa9ae('0xe6')]+=0x1;_0xc368a2['countglobal']+=0x1;ami['emit'](_0xa9ae('0x1a7'),ut['buildObj'](_0x1edb6f,_0xa9ae('0x1a8')));_0x3ead01['createHistory'](_0xc368a2)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1a9')));if(_0x3ead01[_0xa9ae('0x18e')](0x5,_0x1edb6f,_0x5cbef7)){if(_0xc368a2['countbusyretry']>=_0x5cbef7[_0xa9ae('0x192')]){_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1aa'));}else{_0x3ead01[_0xa9ae('0xea')](_0xc368a2,_0x12d494,_0x4860d6,'reason\x205\x20busy');}}break;case'8':_0x5cbef7['outboundCongestionCallsDay']+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0x8;_0xc368a2[_0xa9ae('0xa1')]=_0xa9ae('0x1ab');_0xc368a2['countcongestionretry']+=0x1;_0xc368a2['countglobal']+=0x1;ami[_0xa9ae('0x4b')](_0xa9ae('0x1ac'),ut[_0xa9ae('0x19f')](_0x1edb6f,'congestion'));_0x3ead01['createHistory'](_0xc368a2)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1ad')));if(_0x3ead01['checkRetriveMax'](0x8,_0x1edb6f,_0x5cbef7)){if(_0xc368a2[_0xa9ae('0x18f')]>=_0x5cbef7['dialCongestionMaxRetry']){_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1ae'));}else{_0x3ead01['stateGlobal'](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1ae'));}}break;case'11':_0x5cbef7['outboundAbandonedCallsDay']+=0x1;_0xc368a2['state']=0xb;_0xc368a2['statedesc']=_0xa9ae('0x117');_0xc368a2[_0xa9ae('0xe8')]+=0x1;_0xc368a2['countglobal']+=0x1;_0x3ead01['createHistory'](_0xc368a2)['catch'](loggerCatch(_0xa9ae('0x11c')));if(_0x3ead01[_0xa9ae('0x18e')](0xb,_0x1edb6f,_0x5cbef7)){if(_0xc368a2['countabandonedretry']>=_0x5cbef7[_0xa9ae('0x119')]){_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1af'));}else{_0x3ead01[_0xa9ae('0xea')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1af'));}}break;case'20':_0x5cbef7[_0xa9ae('0x66')]+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0x14;_0xc368a2[_0xa9ae('0xa1')]='AgentReject';_0xc368a2[_0xa9ae('0xf9')]+=0x1;_0xc368a2[_0xa9ae('0xf5')]+=0x1;ami['emit'](_0xa9ae('0x1b0'),ut[_0xa9ae('0x19f')](_0x1edb6f,_0xa9ae('0x1b1')));_0x3ead01['createHistory'](_0xc368a2)['catch'](loggerCatch(_0xa9ae('0x1b2')));if(_0x3ead01[_0xa9ae('0x18e')](0x14,_0x1edb6f,_0x5cbef7)){if(_0xc368a2[_0xa9ae('0xf9')]>=_0x5cbef7[_0xa9ae('0x198')]){_0x3ead01['createStateFinal'](_0xc368a2,_0x12d494,_0x4860d6,'reason\x2020\x20agentreject');}else{_0x3ead01[_0xa9ae('0xea')](_0xc368a2,_0x12d494,_0x4860d6,_0xa9ae('0x1b3'));}}break;default:_0x5cbef7[_0xa9ae('0x67')]+=0x1;_0xc368a2[_0xa9ae('0xa0')]=0xc;_0xc368a2[_0xa9ae('0xa1')]=_0x272fcf[_0xa9ae('0x101')];_0x3ead01[_0xa9ae('0xc5')](_0xc368a2)[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1b4')));if(_0x3ead01['checkRetriveMax'](_0x272fcf[_0xa9ae('0x101')],_0x1edb6f,_0x5cbef7)){if(_0xc368a2[_0xa9ae('0xe6')]+_0xc368a2[_0xa9ae('0x18f')]+_0xc368a2[_0xa9ae('0xf7')]+_0xc368a2[_0xa9ae('0xe7')]+_0xc368a2['countdropretry']+_0xc368a2[_0xa9ae('0xe8')]+_0xc368a2['countmachineretry']+_0xc368a2[_0xa9ae('0xf9')]>=_0x5cbef7[_0xa9ae('0xe9')]){_0x3ead01['stateGlobal'](_0xc368a2,_0x12d494,_0x4860d6,_0x272fcf[_0xa9ae('0x101')]);}else{_0x3ead01[_0xa9ae('0xfa')](_0xc368a2,_0x12d494,_0x4860d6,_0x272fcf[_0xa9ae('0x101')]);}}}});};Dialer[_0xa9ae('0x1b')]['stateGlobal']=function(_0x17388b,_0x494f98,_0x509ad3,_0x1660b4){var _0x2bd5df=new Final(_0x17388b);_0x2bd5df[_0xa9ae('0xa0')]=0xf;_0x2bd5df[_0xa9ae('0xa1')]='Global';this['createStateFinal'](_0x2bd5df,_0x494f98,_0x509ad3,_0x1660b4);};Dialer[_0xa9ae('0x1b')]['createStateFinal']=function(_0x573301,_0x4a1410,_0x1d4b9f,_0x32e28a){this[_0xa9ae('0xc3')](_0x573301)[_0xa9ae('0xb2')](function(){return _0x4a1410(msgResponse(_0xa9ae('0x19a'),_0xa9ae('0x1b5'),_0x32e28a));})[_0xa9ae('0xac')](function(){return _0x1d4b9f(msgResponse(_0xa9ae('0x1b6'),_0xa9ae('0x13b'),_0xa9ae('0x1b7')));});};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x8')]=function(_0x52dd40){var _0x14b485=_0x52dd40[_0xa9ae('0x1b8')]/0x64;var _0x17175e=_0x52dd40['outboundDropCallsDayTimeout']/(_0x52dd40[_0xa9ae('0x63')]+_0x52dd40[_0xa9ae('0x5e')]);var _0x36fc00=Math[_0xa9ae('0x1b9')](_0x52dd40['predictiveIntervalAvailable']*(_0x52dd40[_0xa9ae('0x1ba')]/0x64));var _0x40342c=Math['round'](_0x52dd40[_0xa9ae('0x70')]*(_0x52dd40[_0xa9ae('0x1bb')]/0x64));var _0x334594=_0x52dd40[_0xa9ae('0x4f')]+_0x52dd40[_0xa9ae('0x54')];var _0x231a22=Math[_0xa9ae('0x1bc')](_0x52dd40[_0xa9ae('0x73')]*_0x52dd40[_0xa9ae('0x74')]*_0x52dd40[_0xa9ae('0x6e')]*_0x52dd40[_0xa9ae('0x1bd')]);if(_[_0xa9ae('0x3a')](_0x52dd40['startProgressive'])){if(!_[_0xa9ae('0x3a')](_0x52dd40[_0xa9ae('0x28')])){_0x52dd40[_0xa9ae('0x28')]=undefined;loggerPredictive['error'](_0xa9ae('0x1be'),_0xa9ae('0x1bf'));}if(!_[_0xa9ae('0x3a')](_0x52dd40[_0xa9ae('0x8c')])){loggerPredictive[_0xa9ae('0x91')]('[startMethodPredictive][StartProgressive]',_0xa9ae('0x1c0'));clearInterval(_0x52dd40['handlePredictive']);_0x52dd40[_0xa9ae('0x8c')]=undefined;}_0x52dd40[_0xa9ae('0x29')]=moment()['format'](_0xa9ae('0xf0'));loggerPredictive[_0xa9ae('0x7c')](_0x52dd40[_0xa9ae('0x3e')],_0xa9ae('0x1c1'),_0x52dd40[_0xa9ae('0x29')]);this['handlePower'](_0x52dd40,0x1);}else if(ifInterval(_0x52dd40['dialPredictiveInterval'],_0x52dd40[_0xa9ae('0x29')])){this['handlePower'](_0x52dd40,0x1);loggerPredictiveCalls[_0xa9ae('0x7c')](_0xa9ae('0x1c2'),_0x52dd40[_0xa9ae('0x29')],_0x52dd40['name']);_0x52dd40[_0xa9ae('0x73')]=0x0;_0x52dd40['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x14b485<_0x17175e&&_0x52dd40[_0xa9ae('0x1c3')]===_0xa9ae('0x1c4')){freeVariablesPredictive(_0x52dd40);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x1c5'),_0xa9ae('0x1c6'),_0x17175e,'startProgressive',_0x52dd40['name']);}else if(_0x231a22<_0x52dd40[_0xa9ae('0x6d')]&&_0x52dd40['dialPredictiveOptimization']===_0xa9ae('0x1c4')){freeVariablesPredictive(_0x52dd40);loggerPredictive[_0xa9ae('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x231a22,'Drop\x20in\x20this\x20interval',_0x52dd40[_0xa9ae('0x6d')],_0xa9ae('0x29'),_0x52dd40[_0xa9ae('0x3e')]);}else if(!ifInterval(_0x52dd40[_0xa9ae('0x1c7')],_0x52dd40[_0xa9ae('0x29')])&&_[_0xa9ae('0x3a')](_0x52dd40['startPredictive'])&&!_[_0xa9ae('0x3a')](_0x52dd40[_0xa9ae('0x29')])){_0x52dd40[_0xa9ae('0x28')]=moment()[_0xa9ae('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa9ae('0x7c')](_0x52dd40['name'],_0xa9ae('0x1c8'),_0x52dd40[_0xa9ae('0x28')]);this[_0xa9ae('0x1c9')](_0x52dd40[_0xa9ae('0x1c7')])['then'](this[_0xa9ae('0x1ca')](_0x52dd40))[_0xa9ae('0xb2')](mergeDataErlangB(_0x52dd40))[_0xa9ae('0xb2')](this[_0xa9ae('0x1cb')](_0x52dd40))[_0xa9ae('0xac')](loggerCatchPredictive(_0xa9ae('0x1cc'),_0x52dd40));}else if(!ifInterval(_0x52dd40['dialPredictiveInterval'],_0x52dd40['startPredictive'])){_0x52dd40['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x52dd40[_0xa9ae('0x28')]=moment()[_0xa9ae('0x78')](_0xa9ae('0xf0'));loggerPredictive['info'](_0x52dd40['name'],_0xa9ae('0x1cd'),_0x52dd40[_0xa9ae('0x28')]);clearInterval(_0x52dd40[_0xa9ae('0x8c')]);_0x52dd40[_0xa9ae('0x8c')]=undefined;this[_0xa9ae('0x1c9')](_0x52dd40['dialPredictiveInterval'])['then'](this[_0xa9ae('0x1ca')](_0x52dd40))['then'](mergeDataErlangB(_0x52dd40))['then'](this[_0xa9ae('0x1cb')](_0x52dd40))['catch'](loggerCatchPredictive(_0xa9ae('0x1ce'),_0x52dd40));}else if(_0x52dd40[_0xa9ae('0x70')]&&_0x334594<_0x52dd40[_0xa9ae('0x70')]-_0x40342c){freeVariablesPredictive(_0x52dd40);loggerPredictive[_0xa9ae('0x7c')](_0x52dd40[_0xa9ae('0x3e')],_0xa9ae('0x1cf'),_0x334594,_0xa9ae('0x1d0'),_0x52dd40[_0xa9ae('0x70')],'-',_0x40342c,'=',_0x52dd40['predictiveIntervalAvailable']-_0x40342c,')');}else if(_0x52dd40[_0xa9ae('0x70')]&&_0x334594>_0x52dd40[_0xa9ae('0x70')]+_0x36fc00){freeVariablesPredictive(_0x52dd40);loggerPredictive[_0xa9ae('0x7c')](_0x52dd40[_0xa9ae('0x3e')],_0xa9ae('0x1cf'),_0x334594,')\x20are\x20more\x20than\x20threshold\x20(',_0x52dd40[_0xa9ae('0x70')],'+',_0x36fc00,'=',_0x52dd40['predictiveIntervalAvailable']+_0x36fc00,')');}};Dialer['prototype'][_0xa9ae('0x1ca')]=function(_0x17a940){var _0x3a64f4=this;return function(_0x401a9b){return new BPromise(function(_0x3d79cf,_0x1bed00){_[_0xa9ae('0x8a')](_0x17a940,_0x401a9b[0x0]);if(checkGetDataPredictive(_0x401a9b[0x0])){var _0x597389=_0x17a940[_0xa9ae('0x70')]=_0x17a940['talking']+_0x17a940[_0xa9ae('0x4f')];var _0x43bc27=_0x17a940[_0xa9ae('0x1c7')]*0x3c;var _0x122c34=_0x401a9b[0x0][_0xa9ae('0x6a')]+_0x401a9b[0x0][_0xa9ae('0x69')];var _0x1c1114=(_0x401a9b[0x0]['predictiveIntervalAnsweredCalls']+_0x401a9b[0x0][_0xa9ae('0x6c')]+_0x401a9b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x401a9b[0x0][_0xa9ae('0x71')];_0x17a940[_0xa9ae('0x6e')]=_0x1c1114>0x0?_0x1c1114:0x1;switch(_0x17a940['dialPredictiveOptimization']){case _0xa9ae('0x1c4'):var _0x190cf5=_0x17a940['dialPredictiveOptimizationPercentage']/0x64;return _0x3a64f4[_0xa9ae('0x1d1')](_0x597389,_0x43bc27,_0x122c34,_0x1c1114,_0x190cf5)[_0xa9ae('0xb2')](function(_0x185f9b){return _0x3d79cf(_0x185f9b);});case _0xa9ae('0x1d2'):var _0x1e5323=_0x17a940[_0xa9ae('0x1b8')]/0x64;return _0x3a64f4[_0xa9ae('0x1d3')](_0x597389,_0x43bc27,_0x122c34,_0x1c1114,_0x1e5323)[_0xa9ae('0xb2')](function(_0x14c72e){return _0x3d79cf(_0x14c72e);});default:return _0x1bed00(msgResponse(_0xa9ae('0x1d4'),_0xa9ae('0x13b'),_0xa9ae('0x1d5')));}}else{return _0x1bed00(msgResponse(_0xa9ae('0x1d4'),_0xa9ae('0x13b'),_0xa9ae('0x1d6')));}});};};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x1d7')]=function(_0x323f57){var _0x500ddf=this;return function(_0x4ad2b2){return new BPromise(function(_0x2117fb,_0xd0815b){_[_0xa9ae('0x8a')](_0x323f57,_0x4ad2b2[0x0]);if(checkGetDataPredictive(_0x4ad2b2[0x0])){loggerPredictive[_0xa9ae('0x7c')](JSON[_0xa9ae('0x47')](_0x4ad2b2[0x0]));if(_0x323f57[_0xa9ae('0x1c3')]==='dropRate'){return _0x500ddf[_0xa9ae('0xc1')](_0x323f57['id'])[_0xa9ae('0xb2')](function(_0x427a87){var _0x12a5b8=_0x323f57[_0xa9ae('0x154')]-_0x427a87[0x0]['outboundQueuePauses'];var _0x2b13e7=_0x323f57['dialPredictiveInterval']*0x3c;var _0x5f37ec=_0x4ad2b2[0x0][_0xa9ae('0x6a')]+_0x4ad2b2[0x0][_0xa9ae('0x69')];var _0x30a1e2=(_0x4ad2b2[0x0][_0xa9ae('0x68')]+_0x4ad2b2[0x0][_0xa9ae('0x6c')]+_0x4ad2b2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ad2b2[0x0][_0xa9ae('0x71')];var _0x15e81c=_0x323f57['dialPredictiveOptimizationPercentage']/0x64;_0x323f57[_0xa9ae('0x6f')]=_0x427a87[0x0][_0xa9ae('0x1d8')]||0x0;_0x323f57[_0xa9ae('0x6e')]=_0x30a1e2>0x0?_0x30a1e2:0x1;return _0x500ddf[_0xa9ae('0x1d1')](_0x12a5b8,_0x2b13e7,_0x5f37ec,_0x30a1e2,_0x15e81c);})[_0xa9ae('0xb2')](function(_0x31707c){return _0x2117fb(_0x31707c);})[_0xa9ae('0xac')](function(_0x73b1ab){return _0xd0815b(msgResponse(_0xa9ae('0x1d9'),_0xa9ae('0x13b'),JSON[_0xa9ae('0x47')](_0x73b1ab)));});}if(_0x323f57['dialPredictiveOptimization']==='agentBusyFactor'){return _0x500ddf[_0xa9ae('0xc1')](_0x323f57['id'])[_0xa9ae('0xb2')](function(_0x4c19f3){var _0x81d26a=_0x323f57[_0xa9ae('0x154')]-_0x4c19f3[0x0][_0xa9ae('0x1d8')];var _0x3208e9=_0x323f57['dialPredictiveInterval']*0x3c;var _0x4b816b=_0x4ad2b2[0x0]['predictiveIntervalAvgTalktime']+_0x4ad2b2[0x0][_0xa9ae('0x69')];var _0x5477e6=(_0x4ad2b2[0x0][_0xa9ae('0x68')]+_0x4ad2b2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4ad2b2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ad2b2[0x0][_0xa9ae('0x71')];var _0x385740=_0x323f57[_0xa9ae('0x1b8')]/0x64;_0x323f57[_0xa9ae('0x6f')]=_0x4c19f3[0x0]['outboundQueuePauses']||0x0;_0x323f57[_0xa9ae('0x6e')]=_0x5477e6>0x0?_0x5477e6:0x1;return _0x500ddf[_0xa9ae('0x1d3')](_0x81d26a,_0x3208e9,_0x4b816b,_0x5477e6,_0x385740);})['then'](function(_0x310f43){return _0x2117fb(_0x310f43);})['catch'](function(_0x46bba6){return _0xd0815b(msgResponse('[CatchErlangB]',_0xa9ae('0x13b'),JSON[_0xa9ae('0x47')](_0x46bba6)));});}}else{return _0xd0815b(msgResponse(_0xa9ae('0x1d4'),_0xa9ae('0x13b'),_0xa9ae('0x1d6')));}});};};Dialer['prototype'][_0xa9ae('0x1cb')]=function(_0x52ef03){var _0x4adb7a=this;return function(){var _0x4322a8=0x0;var _0x377e3a=Math['floor'](_0x52ef03['erlangCallToSecond']*0x3e8);if(_0x377e3a>0x0){_0x377e3a=_0x377e3a<0x64?0x64:_0x377e3a;loggerPredictive[_0xa9ae('0x7c')](_0x52ef03['name'],'one\x20call\x20every:',_0x377e3a,_0xa9ae('0x48'));_0x52ef03[_0xa9ae('0x8c')]=setInterval(function(){_0x4adb7a['handlePredictive'](_0x52ef03);loggerPredictiveCalls['info'](_0xa9ae('0x1da'),_0x4322a8+=0x1);},_0x377e3a);}else{loggerPredictive[_0xa9ae('0x7c')](_0x52ef03[_0xa9ae('0x3e')],_0xa9ae('0x1db'));}};};Dialer['prototype'][_0xa9ae('0x1dc')]=function(_0xa47552,_0x33e740){var _0x2cd32a=this;return function(_0xb09686){if(_[_0xa9ae('0x43')](_0xb09686)){if(_[_0xa9ae('0xa9')](_0x33e740['UserId'])||!_0x33e740[_0xa9ae('0x1dd')]){if(_0xa47552[_0xa9ae('0x59')]==='booked'){_0xa47552['queueStatusComplete']=_[_0xa9ae('0x3a')](_0xa47552[_0xa9ae('0x129')])?!![]:_0xa47552[_0xa9ae('0x129')];var _0x3f90ec=uuid['v4']();_0x2cd32a[_0xa9ae('0x24')][_0x3f90ec]=new Action(_0xa47552,_0x33e740,_0x3f90ec);loggerBooked[_0xa9ae('0x7c')](_0xa9ae('0x1de'),_0x3f90ec,_0xa9ae('0x1df'),JSON['stringify'](_0xa47552['queueStatusComplete']),_0xa9ae('0x1e0'),_0xa47552[_0xa9ae('0x3e')]);if(_0xa47552[_0xa9ae('0x129')]){_0xa47552['queueStatusComplete']=![];_0x2cd32a['queueBooked'][_0x2cd32a['actions'][_0x3f90ec][_0xa9ae('0xaf')]]=[];ami[_0xa9ae('0xaa')]({'actionid':_0x3f90ec,'action':_0xa9ae('0x1e1'),'queue':_0xa47552[_0xa9ae('0x3e')]})[_0xa9ae('0xac')](function(){_0x2cd32a['updateOriginated'](_0xa47552);_0x2cd32a['rescheduleContact']({'active':![],'ContactId':_0x2cd32a['actions'][_0x3f90ec][_0xa9ae('0xf1')],'ListId':_0x2cd32a['actions'][_0x3f90ec][_0xa9ae('0xcb')],'VoiceQueueId':_0x2cd32a[_0xa9ae('0x24')][_0x3f90ec][_0xa9ae('0xcd')]||undefined,'CampaignId':_0x2cd32a[_0xa9ae('0x24')][_0x3f90ec]['CampaignId']||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1e2')));delete _0x2cd32a[_0xa9ae('0x24')][_0x3f90ec];});}else{loggerBooked['info'](_0xa9ae('0x1e3'),JSON['stringify'](_0xa47552[_0xa9ae('0x129')]),_0xa9ae('0x1e0'),_0xa47552['name']);_0x2cd32a['updateOriginated'](_0xa47552);_0x2cd32a[_0xa9ae('0xba')]({'active':![],'ContactId':_0x2cd32a['actions'][_0x3f90ec]['ContactId'],'ListId':_0x2cd32a['actions'][_0x3f90ec]['ListId'],'VoiceQueueId':_0x2cd32a[_0xa9ae('0x24')][_0x3f90ec][_0xa9ae('0xcd')]||undefined,'CampaignId':_0x2cd32a[_0xa9ae('0x24')][_0x3f90ec][_0xa9ae('0xce')]||undefined})[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1e2')));delete _0x2cd32a[_0xa9ae('0x24')][_0x3f90ec];}}else{return _0x2cd32a['actionOriginate'](_0xa47552,_0x33e740);}}else{if(getDiff(_0x33e740[_0xa9ae('0x1e4')])<_0xa47552[_0xa9ae('0x1e5')]*0x3c){if(_0x33e740[_0xa9ae('0x1e6')]&&!_0x33e740['Agent'][_0xa9ae('0x1e7')]){_0x2cd32a[_0xa9ae('0x1f')][_0xa9ae('0x12b')](_0x33e740['id'])['finally'](function(){_0x2cd32a['updateOriginated'](_0xa47552);});}else{_0x2cd32a[_0xa9ae('0xbc')]({'active':![]},_0x33e740['id'],0x1)[_0xa9ae('0x1d')](function(){_0x2cd32a[_0xa9ae('0xae')](_0xa47552);});}}else{_0xa47552[_0xa9ae('0x1e8')]+=0x1;_0x2cd32a[_0xa9ae('0xae')](_0xa47552);if(_0xa47552['dialRecallInQueue']){_0x2cd32a[_0xa9ae('0xba')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33e740[_0xa9ae('0xf1')],'ListId':_0x33e740[_0xa9ae('0xcb')],'VoiceQueueId':_0x33e740['VoiceQueueId']||undefined,'CampaignId':_0x33e740['CampaignId']||undefined})[_0xa9ae('0xac')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2cd32a[_0xa9ae('0xc5')](createObjHistory(_0xa47552,_0x33e740,_0xa9ae('0x1e9'),0x17,_0xa9ae('0x1ea')))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1eb')));}else{_0x2cd32a[_0xa9ae('0xdf')](createObjHistory(_0xa47552,_0x33e740,_0xa9ae('0x1ec'),0x16,_0xa9ae('0x1ed')),_0xa9ae('0x1ee'),_0xa9ae('0x1ef'));}}}}else{_0xa47552[_0xa9ae('0x5f')]+=0x1;_0x2cd32a[_0xa9ae('0xdf')](createObjHistory(_0xa47552,_0x33e740,_0xa9ae('0x1f0'),0xd,'Blacklist'),_0xa9ae('0x1f1'),'[Originate][MoveBlacklist]');throw _0xa9ae('0x1f2');}};};Dialer[_0xa9ae('0x1b')]['handleIvr']=function(_0x44cd33){var _0x5d2c13=this;var _0x27e11d=_0x44cd33[_0xa9ae('0x1f3')]-_0x44cd33[_0xa9ae('0x72')]-_0x44cd33[_0xa9ae('0x1f4')];emitCampaignSummary(_0x44cd33);if(_0x27e11d>0x0){if(_0x27e11d>this[_0xa9ae('0x23')]){_0x27e11d=this[_0xa9ae('0x23')];}_0x44cd33['temp']+=_0x27e11d;this['getContactDialerIvr'](_0x44cd33['id'],_0x27e11d,_0x44cd33[_0xa9ae('0x1f5')])[_0xa9ae('0xb2')](function(_0x49cafc){_0x44cd33['temp']-=_0x27e11d;_0x44cd33[_0xa9ae('0x1f4')]=_0x44cd33[_0xa9ae('0x1f4')]>0x0?_0x44cd33['temp']:0x0;if(!checkContactEmpty(_0x49cafc)){_0x44cd33['message']=_0xa9ae('0x1f6');logger[_0xa9ae('0x7c')]('[getContactCampaign2][Empty]'+_0x44cd33[_0xa9ae('0x3e')]);}else{_0x44cd33[_0xa9ae('0x72')]+=_0x49cafc[_0xa9ae('0x94')];_0x44cd33[_0xa9ae('0x3b')]=_0xa9ae('0x1f7');for(var _0x532f43=0x0;_0x532f43<_0x49cafc[_0xa9ae('0x94')];_0x532f43+=0x1){_0x44cd33[_0xa9ae('0x1f8')]+=0x1;if(_['isNil'](_0x49cafc[_0x532f43])||_[_0xa9ae('0xa9')](_0x49cafc[_0x532f43][_0xa9ae('0x161')])||_[_0xa9ae('0xa9')](_0x49cafc[_0x532f43]['Contact'][_0xa9ae('0x162')])){_0x5d2c13[_0xa9ae('0xca')]('[actionOriginate]\x20',_0x44cd33,_0x49cafc[_0x532f43]);}else{_0x5d2c13[_0xa9ae('0xb6')](_['pick'](_0x49cafc[_0x532f43],[_0xa9ae('0xce'),_0xa9ae('0x1f9')]))['then'](_0x5d2c13[_0xa9ae('0x1dc')](_0x44cd33,_0x49cafc[_0x532f43]))[_0xa9ae('0xac')](_0x5d2c13[_0xa9ae('0xc9')](_0xa9ae('0x1fa'),_0x44cd33));}}}})[_0xa9ae('0xac')](loggerGetContactDialer(_0xa9ae('0x1fb'),_0x44cd33,_0x27e11d));}};Dialer[_0xa9ae('0x1b')]['handlePower']=function(_0x3b7492,_0x139b76){var _0x21ee70=this;var _0x22cb84=[];var _0x4c777f=_0x139b76>=0x1?_0x139b76:0x1;if(_0x3b7492[_0xa9ae('0x59')]===_0xa9ae('0x1fc')){_0x4c777f=0x1;}var _0x5d0d16=Math[_0xa9ae('0x1bc')](_0x3b7492[_0xa9ae('0x4f')]*_0x4c777f)-_0x3b7492['originated']-_0x3b7492['temp'];emitVoiceQueueSummary(_0x3b7492);if(_0x3b7492[_0xa9ae('0x1fd')]>0x0){var _0x2de487=_0x3b7492['dialLimitQueue']-_0x3b7492['originated']-_0x3b7492['talking']-_0x3b7492[_0xa9ae('0x1f4')]-_0x3b7492[_0xa9ae('0x50')];if(_0x5d0d16>_0x2de487){_0x5d0d16=_0x2de487;}}if(_0x5d0d16>0x0){if(_0x3b7492[_0xa9ae('0x59')]==='booked'){_0x5d0d16=0x1;}if(_0x5d0d16>this[_0xa9ae('0x23')]){_0x5d0d16=this['maxNumberOriginate'];}_0x3b7492['temp']+=_0x5d0d16;for(var _0x5f31b6 in this[_0xa9ae('0x121')]){if(typeof this[_0xa9ae('0x121')][_0x5f31b6]!==_0xa9ae('0x95')){if(this[_0xa9ae('0x121')][_0x5f31b6]['state']==='not_inuse'&&this[_0xa9ae('0x121')][_0x5f31b6][_0xa9ae('0xab')]===_0xa9ae('0x1fe')){_0x22cb84[_0xa9ae('0x124')](this[_0xa9ae('0x121')][_0x5f31b6]['id']);}}}this[_0xa9ae('0xbe')](_0x3b7492['id'],_0x22cb84,_0x5d0d16,_0x3b7492[_0xa9ae('0x1f5')])['then'](function(_0x351691){_0x3b7492[_0xa9ae('0x1f4')]-=_0x5d0d16;_0x3b7492[_0xa9ae('0x1f4')]=_0x3b7492[_0xa9ae('0x1f4')]>0x0?_0x3b7492[_0xa9ae('0x1f4')]:0x0;if(!checkContactEmpty(_0x351691)){_0x21ee70[_0xa9ae('0xb3')](_0x3b7492)[_0xa9ae('0xb2')](sendMessageReschedule(_0x3b7492))['catch'](loggerCatch(_0xa9ae('0x1ff')));}else{_0x3b7492[_0xa9ae('0x72')]+=_0x351691[_0xa9ae('0x94')];_0x3b7492[_0xa9ae('0x3b')]=_0x3b7492[_0xa9ae('0x59')]===_0xa9ae('0x1fc')?_0xa9ae('0x16a'):_0xa9ae('0x1f7');for(var _0x2f0402=0x0;_0x2f0402<_0x351691[_0xa9ae('0x94')];_0x2f0402+=0x1){if(_[_0xa9ae('0xa9')](_0x351691[_0x2f0402])||_[_0xa9ae('0xa9')](_0x351691[_0x2f0402]['Contact'])||_[_0xa9ae('0xa9')](_0x351691[_0x2f0402][_0xa9ae('0x161')][_0xa9ae('0x162')])){_0x21ee70[_0xa9ae('0xca')](_0xa9ae('0x200'),_0x3b7492,_0x351691[_0x2f0402]);}else{_0x21ee70['checkIsBlackList'](_[_0xa9ae('0x125')](_0x351691[_0x2f0402],[_0xa9ae('0xcd'),_0xa9ae('0x1f9')]))[_0xa9ae('0xb2')](_0x21ee70[_0xa9ae('0x1dc')](_0x3b7492,_0x351691[_0x2f0402]))[_0xa9ae('0xac')](_0x21ee70[_0xa9ae('0xc9')](_0xa9ae('0x200'),_0x3b7492));}}}})[_0xa9ae('0xac')](loggerGetContactDialer(_0xa9ae('0x201'),_0x3b7492,_0x5d0d16));}};Dialer['prototype'][_0xa9ae('0x8c')]=function(_0x162999){if(_0x162999['dialLimitQueue']>0x0){var _0x20307f=_0x162999[_0xa9ae('0x1fd')]-_0x162999['originated']-_0x162999[_0xa9ae('0x54')];if(_0x20307f>0x0){this[_0xa9ae('0x202')](_0x162999);}else{loggerPredictiveCalls['info'](_0xa9ae('0x203'));}}else{this['tryOriginatePredictive'](_0x162999);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x198ea6){var _0x1c2b20=this;var _0x6c1578=[];_0x198ea6[_0xa9ae('0x72')]+=0x1;for(var _0x378a52 in this[_0xa9ae('0x121')]){if(typeof this[_0xa9ae('0x121')][_0x378a52]!==_0xa9ae('0x95')){if(this[_0xa9ae('0x121')][_0x378a52][_0xa9ae('0xa0')]==='not_inuse'&&this[_0xa9ae('0x121')][_0x378a52]['status']==='reachable'){_0x6c1578[_0xa9ae('0x124')](this[_0xa9ae('0x121')][_0x378a52]['id']);}}}this['getContactDialer'](_0x198ea6['id'],_0x6c1578,0x1,_0x198ea6[_0xa9ae('0x1f5')])[_0xa9ae('0xb2')](function(_0x47cfb5){if(!checkContactEmpty(_0x47cfb5)){checkContactLowerLimitOriginate(_0x198ea6,0x1,0x0);_0x1c2b20['countReScheduled'](_0x198ea6)[_0xa9ae('0xb2')](sendMessageReschedule(_0x198ea6))[_0xa9ae('0xac')](loggerCatch(_0xa9ae('0x1ff')));}else{_0x198ea6[_0xa9ae('0x3b')]=_0xa9ae('0x1f7');if(_['isNil'](_0x47cfb5[0x0])||_[_0xa9ae('0xa9')](_0x47cfb5[0x0][_0xa9ae('0x161')])||_[_0xa9ae('0xa9')](_0x47cfb5[0x0]['Contact'][_0xa9ae('0x162')])){_0x1c2b20[_0xa9ae('0xca')](_0xa9ae('0x200'),_0x198ea6,_0x47cfb5[0x0]);}else{_0x1c2b20['checkIsBlackList'](_[_0xa9ae('0x125')](_0x47cfb5[0x0],[_0xa9ae('0xcd'),'Contact.phone']))[_0xa9ae('0xb2')](_0x1c2b20[_0xa9ae('0x1dc')](_0x198ea6,_0x47cfb5[0x0]))[_0xa9ae('0xac')](_0x1c2b20[_0xa9ae('0xc9')](_0xa9ae('0x204'),_0x198ea6));}}})[_0xa9ae('0xac')](loggerGetContactDialer(_0xa9ae('0x205'),_0x198ea6,0x1));emitVoiceQueueSummary(_0x198ea6);};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x1d1')]=function(_0xfde3d2,_0x333459,_0x43ab1c,_0x406816,_0xa1df28,_0x3bd1a9){loggerPredictive[_0xa9ae('0x7c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x206'),_0xfde3d2);loggerPredictive['info'](_0xa9ae('0x207'),_0x333459);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x208'),_0x43ab1c);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x209'),_0x406816);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x20a'),_0xa1df28);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x81'));return new BPromise(function(_0xd0be23,_0x3db9b7){if(_0xfde3d2<=0x0||isNaN(_0xfde3d2)){return _0x3db9b7(msgResponse(_0xa9ae('0x20b'),'Error',_0xa9ae('0x20c')+_0xfde3d2));}if(_0x43ab1c<=0x0||isNaN(_0x43ab1c)){return _0x3db9b7(msgResponse('[abandonmentRate]',_0xa9ae('0x46'),'Ts\x20=\x20'+_0x43ab1c));}if(_0x406816<=0x0||isNaN(_0x406816)){return _0x3db9b7(msgResponse('[abandonmentRate]',_0xa9ae('0x46'),_0xa9ae('0x20d')+_0x406816));}if(_0x333459<=0x0||isNaN(_0x333459)){return _0x3db9b7(msgResponse(_0xa9ae('0x20b'),'Error','interval\x20=\x20'+_0x333459));}if(_0xa1df28<=0x0||isNaN(_0xa1df28)){return _0x3db9b7(msgResponse('[abandonmentRate]',_0xa9ae('0x46'),_0xa9ae('0x20e')+_0xa1df28));}_0x3bd1a9=_0x3bd1a9||0x0;var _0x23d543=0x1/_0x43ab1c;var _0x1789e0=0x0;var _0x1d7d64=0x0;var _0x4ff385=0x0;var _0xedc0e2=0x0;for(var _0x1d6175=0x0;_0x4ff385<_0xa1df28;_0x1d6175+=0x1){_0x1d7d64=_0x1d6175/_0x333459;_0x1789e0=(_0x406816*_0x1d7d64+_0x3bd1a9)/_0x23d543;_0x4ff385=erlangb(_0x1789e0,_0xfde3d2);_0xedc0e2=_0x1789e0/_0xfde3d2*(0x1-erlangb(_0x1789e0,_0xfde3d2));}return _0xd0be23({'erlangCalls':_0x1d6175,'erlangCallToSecond':_0x333459/_0x1d6175,'erlangAbandonmentRate':_0x4ff385,'erlangBusyFactor':_0xedc0e2});});};Dialer[_0xa9ae('0x1b')][_0xa9ae('0x1d3')]=function(_0x370b81,_0x34267d,_0x48a474,_0x1ebd7c,_0x5b8b66,_0x262c1c){loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x20f'));loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x206'),_0x370b81);loggerPredictive['info'](_0xa9ae('0x207'),_0x34267d);loggerPredictive['info'](_0xa9ae('0x208'),_0x48a474);loggerPredictive[_0xa9ae('0x7c')]('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',_0x1ebd7c);loggerPredictive[_0xa9ae('0x7c')](_0xa9ae('0x210'),_0x5b8b66);loggerPredictive[_0xa9ae('0x7c')]('---------------------------');return new BPromise(function(_0x389661,_0xcb3e47){if(_0x370b81<=0x0||isNaN(_0x370b81)){return _0xcb3e47(msgResponse(_0xa9ae('0x211'),'Error',_0xa9ae('0x20c')+_0x370b81));}if(_0x48a474<=0x0||isNaN(_0x48a474)){return _0xcb3e47(msgResponse(_0xa9ae('0x211'),_0xa9ae('0x46'),_0xa9ae('0x212')+_0x48a474));}if(_0x1ebd7c<=0x0||isNaN(_0x1ebd7c)){return _0xcb3e47(msgResponse(_0xa9ae('0x211'),_0xa9ae('0x46'),_0xa9ae('0x20d')+_0x1ebd7c));}if(_0x34267d<=0x0||isNaN(_0x34267d)){return _0xcb3e47(msgResponse(_0xa9ae('0x211'),_0xa9ae('0x46'),_0xa9ae('0x213')+_0x34267d));}if(_0x5b8b66<=0x0||isNaN(_0x5b8b66)){return _0xcb3e47(msgResponse('[busyFactor]','Error',_0xa9ae('0x214')+_0x5b8b66));}_0x262c1c=_0x262c1c||0x0;var _0x3f445e=0x1/_0x48a474;var _0x50ad60=0x0;var _0x3c7c9e=0x0;var _0x2339ea=0x0;var _0x40b421=0x0;for(var _0x4f9c3f=0x0;_0x40b421<_0x5b8b66;_0x4f9c3f+=0x1){_0x3c7c9e=_0x4f9c3f/_0x34267d;_0x50ad60=(_0x1ebd7c*_0x3c7c9e+_0x262c1c)/_0x3f445e;_0x2339ea=erlangb(_0x50ad60,_0x370b81);_0x40b421=_0x50ad60/_0x370b81*(0x1-erlangb(_0x50ad60,_0x370b81));}return _0x389661({'erlangCalls':_0x4f9c3f,'erlangCallToSecond':_0x34267d/_0x4f9c3f,'erlangAbandonmentRate':_0x2339ea,'erlangBusyFactor':_0x40b421});});};module[_0xa9ae('0x215')]=Dialer; \ No newline at end of file +var _0xd506=['custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','countReScheduled','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','checkContactBlack','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','exports','util','lodash','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','name','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','type','strategy','answered','available','pTalking','sumDuration','sumHoldTime','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\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','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','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','IS_DISACTIVED','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','clearZombieChannels','actions','[actions]','isNil','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','ivr','updateOriginated','[Dialer][checkChannel][ivr]','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','unmonitored','moveContactManagedDialer','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','dialDropRetryFrequency','ListId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','rrmemory','queueBooked','push','idHopper','paused','queueStatusComplete','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','timezones','indexOf','true','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','dialMethod','handlePower','dialPowerLevel','booked','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber'];(function(_0x3e64b4,_0x2b4470){var _0xb90563=function(_0x29b307){while(--_0x29b307){_0x3e64b4['push'](_0x3e64b4['shift']());}};_0xb90563(++_0x2b4470);}(_0xd506,0x7a));var _0x6d50=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd506[_0x5f0089];return _0x193892;};'use strict';var util=require(_0x6d50('0x0'));var _=require(_0x6d50('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x6d50('0x2'));var rr=require('rr');var md5=require(_0x6d50('0x3'));var Redis=require(_0x6d50('0x4'));var ut=require(_0x6d50('0x5'));var config=require(_0x6d50('0x6'));var logger=require(_0x6d50('0x7'))(_0x6d50('0x8'));var loggerBooked=require(_0x6d50('0x7'))('booked');var loggerPredictive=require('../../../config/logger')(_0x6d50('0x9'));var loggerPredictiveCalls=require(_0x6d50('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x6d50('0x7'))(_0x6d50('0xa'));var ami=require('../ami');config[_0x6d50('0xb')]=_[_0x6d50('0xc')](config[_0x6d50('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x6d50('0xd'))(new Redis(config[_0x6d50('0xb')]));var cmHopper=require(_0x6d50('0xe'));var cmHopperHistory=require(_0x6d50('0xf'));var cmHopperBlack=require(_0x6d50('0x10'));var voiceQueueRt=require(_0x6d50('0x11'));var Action=require(_0x6d50('0x12'));var History=require(_0x6d50('0x13'));var Final=require(_0x6d50('0x14'));var AgentComplete=require(_0x6d50('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x6d50('0x16')]['XCALLY_IP_AGI']||_0x6d50('0x17');var strategy={'rrmemory':'rrmemory','roundrobin':_0x6d50('0x18')};var Sequence=function(){};Sequence[_0x6d50('0x19')][_0x6d50('0x1a')]=function(_0x399907){this[_0x6d50('0x1b')]=this[_0x6d50('0x1b')]?this[_0x6d50('0x1b')][_0x6d50('0x1c')](_0x399907):_0x399907();};function Dialer(_0x503340,_0x52412f){this[_0x6d50('0x1d')]=new Sequence();this[_0x6d50('0x1e')]=_0x52412f;this[_0x6d50('0x1f')]=_0x503340[_0x6d50('0x1f')];this['campaigns']=_0x503340[_0x6d50('0x20')];this[_0x6d50('0x21')]=_0x503340[_0x6d50('0x21')];this[_0x6d50('0x22')]=_0x503340[_0x6d50('0x22')];this[_0x6d50('0x23')]=config[_0x6d50('0x23')]||0x2;this['channels']={};this['actions']={};this[_0x6d50('0x24')]={};this[_0x6d50('0x25')]={};this['optionPredictive']={};this[_0x6d50('0x26')]={};this[_0x6d50('0x27')]={};this[_0x6d50('0x28')]={};this['queueBooked']={};this[_0x6d50('0x29')]={};ami['on'](_0x6d50('0x2a'),this['syncAgentConnect'][_0x6d50('0x2b')](this));ami['on'](_0x6d50('0x2c'),this['syncQueueCallerAbandon'][_0x6d50('0x2b')](this));ami['on']('originateresponse',this[_0x6d50('0x2d')][_0x6d50('0x2b')](this));ami['on'](_0x6d50('0x2e'),this[_0x6d50('0x2f')][_0x6d50('0x2b')](this));ami['on'](_0x6d50('0x30'),this[_0x6d50('0xa')][_0x6d50('0x2b')](this));ami['on'](_0x6d50('0x31'),this[_0x6d50('0x32')]['bind'](this));ami['on']('newexten',this[_0x6d50('0x33')][_0x6d50('0x2b')](this));ami['on'](_0x6d50('0x34'),this['syncVarSet']['bind'](this));ami['on'](_0x6d50('0x35'),this[_0x6d50('0x36')]['bind'](this));ami['on'](_0x6d50('0x37'),this['syncQueueStatusComplete'][_0x6d50('0x2b')](this));this[_0x6d50('0x38')]();this[_0x6d50('0x39')]();}function isNotNull(_0x450b0e){return _0x450b0e!==null&&!_[_0x6d50('0x3a')](_0x450b0e);}function checkIsLoggedIn(_0xdf65ca,_0x4c139c){return function(){if(_0x4c139c<=0x0){_0xdf65ca[_0x6d50('0x3b')]=_0x6d50('0x3c');throw _0xdf65ca['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x34d7ba){return _0x34d7ba;}function checkIsActive(_0x415165,_0x5c7821){return function(){if(!isActive(_0x5c7821)){_0x415165[_0x6d50('0x3b')]=_0x6d50('0x3d');throw _0x415165[_0x6d50('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x28e123){return function(){if(!isNotNull(_0x28e123['Interval'])){_0x28e123['message']='INTERVAL_IS_NULL';throw _0x28e123[_0x6d50('0x3e')]+_0x6d50('0x3f');}if(!isNotNull(_0x28e123[_0x6d50('0x40')]['Intervals'])){_0x28e123['message']='INTERVAL_IS_NULL';throw _0x28e123[_0x6d50('0x3e')]+_0x6d50('0x3f');}if(!isNotNull(_[_0x6d50('0x41')](_0x28e123[_0x6d50('0x40')][_0x6d50('0x42')]))){_0x28e123[_0x6d50('0x3b')]=_0x6d50('0x43');throw _0x28e123[_0x6d50('0x3e')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5e948b,_0x592538,_0x12bce9){return{'action':_0x5e948b,'response':_0x592538,'message':_0x12bce9,'stack':_0x12bce9};}function myreject(_0x306e17){return function(_0x5ade8d){return _0x306e17(msgResponse(_0x6d50('0x44'),_0x6d50('0x45'),JSON[_0x6d50('0x46')](_0x5ade8d)));};}function getSeconds(_0x4c075f,_0x52d07c){var _0x339559=moment(_0x4c075f)['milliseconds'](0x0);var _0x553e03=moment(_0x52d07c)[_0x6d50('0x47')](0x0);return _0x339559['diff'](_0x553e03,_0x6d50('0x48'));}function emit(_0x3cae1d,_0x476b5e,_0x17049d){io['to'](_0x3cae1d)[_0x6d50('0x49')](_0x476b5e,_0x17049d);}function emitVoiceQueueSummary(_0x5e68ef){if(_0x5e68ef[_0x6d50('0x4a')]==='outbound'){var _0x59f520={'id':_0x5e68ef['id'],'name':_0x5e68ef[_0x6d50('0x3e')],'strategy':_0x5e68ef[_0x6d50('0x4b')],'answered':_0x5e68ef[_0x6d50('0x4c')],'available':_0x5e68ef[_0x6d50('0x4d')],'loggedIn':_0x5e68ef['loggedIn'],'pTalking':_0x5e68ef[_0x6d50('0x4e')],'sumBillable':_0x5e68ef['sumBillable'],'sumDuration':_0x5e68ef[_0x6d50('0x4f')],'sumHoldTime':_0x5e68ef[_0x6d50('0x50')]||0x0,'talking':_0x5e68ef['talking'],'total':_0x5e68ef['total'],'type':_0x5e68ef[_0x6d50('0x4a')],'unmanaged':_0x5e68ef[_0x6d50('0x51')],'abandoned':_0x5e68ef[_0x6d50('0x52')],'waiting':_0x5e68ef[_0x6d50('0x53')],'loggedInDb':_0x5e68ef[_0x6d50('0x54')],'dialActive':_0x5e68ef[_0x6d50('0x55')],'dialMethod':_0x5e68ef['dialMethod'],'dialOriginateCallerIdName':_0x5e68ef[_0x6d50('0x56')],'dialOriginateCallerIdNumber':_0x5e68ef[_0x6d50('0x57')],'dialOriginateTimeout':_0x5e68ef[_0x6d50('0x58')],'dialPrefix':_0x5e68ef[_0x6d50('0x59')],'outboundAnswerAgiCallsDay':_0x5e68ef['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5e68ef['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5e68ef[_0x6d50('0x5a')],'outboundBusyCallsDay':_0x5e68ef[_0x6d50('0x5b')],'outboundCongestionCallsDay':_0x5e68ef[_0x6d50('0x5c')],'outboundDropCallsDayACS':_0x5e68ef[_0x6d50('0x5d')],'outboundDropCallsDayCallersExit':_0x5e68ef[_0x6d50('0x5e')],'outboundDropCallsDayTimeout':_0x5e68ef[_0x6d50('0x5f')],'outboundNoAnswerCallsDay':_0x5e68ef[_0x6d50('0x60')],'outboundNoSuchCallsDay':_0x5e68ef[_0x6d50('0x61')],'outboundOriginateFailureCallsDay':_0x5e68ef[_0x6d50('0x62')],'outboundReCallsDay':_0x5e68ef['outboundReCallsDay'],'outboundRejectCallsDay':_0x5e68ef[_0x6d50('0x63')],'outboundUnknownCallsDay':_0x5e68ef['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x5e68ef[_0x6d50('0x64')],'predictiveIntervalAvgHoldtime':_0x5e68ef[_0x6d50('0x65')],'predictiveIntervalAvgTalktime':_0x5e68ef[_0x6d50('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x5e68ef[_0x6d50('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x5e68ef['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5e68ef['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5e68ef['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5e68ef[_0x6d50('0x68')],'predictiveIntervalMultiplicativeFactor':_0x5e68ef[_0x6d50('0x69')],'predictiveIntervalPauses':_0x5e68ef[_0x6d50('0x6a')],'predictiveIntervalAvailable':_0x5e68ef[_0x6d50('0x6b')],'predictiveIntervalTotalCalls':_0x5e68ef[_0x6d50('0x6c')],'message':_0x5e68ef[_0x6d50('0x3b')],'originated':_0x5e68ef[_0x6d50('0x6d')],'erlangCalls':_0x5e68ef[_0x6d50('0x6e')],'erlangCallToSecond':_0x5e68ef[_0x6d50('0x6f')],'erlangAbandonmentRate':_0x5e68ef['erlangAbandonmentRate'],'erlangBusyFactor':_0x5e68ef[_0x6d50('0x70')],'startPredictive':_0x5e68ef[_0x6d50('0x26')],'startProgressive':_0x5e68ef[_0x6d50('0x27')]};if(_0x5e68ef[_0x6d50('0x71')]){_0x59f520[_0x6d50('0x71')]={'id':_0x5e68ef['Trunk']['id'],'name':_0x5e68ef[_0x6d50('0x71')][_0x6d50('0x3e')],'active':_0x5e68ef[_0x6d50('0x71')][_0x6d50('0x72')],'callerid':_0x5e68ef[_0x6d50('0x71')][_0x6d50('0x73')]};}if(_0x5e68ef[_0x6d50('0x40')]){_0x59f520[_0x6d50('0x40')]={'id':_0x5e68ef[_0x6d50('0x40')]['id'],'name':_0x5e68ef[_0x6d50('0x40')][_0x6d50('0x3e')]};}var _0x2b0909=md5(JSON[_0x6d50('0x46')](_0x59f520));if(_0x5e68ef[_0x6d50('0x3')]!==_0x2b0909){_0x5e68ef['md5']=_0x2b0909;emit(util[_0x6d50('0x74')](_0x6d50('0x75'),_0x59f520[_0x6d50('0x3e')]),_0x6d50('0x76'),_0x59f520);}}}function emitCampaignSummary(_0x5106bd){if(_0x5106bd[_0x6d50('0x4a')]==='ivr'){emit(util['format'](_0x6d50('0x77'),_0x5106bd[_0x6d50('0x3e')]),_0x6d50('0x78'),_0x5106bd);}}function checkGetDataPredictive(_0x3a8c06){if(isNotNull(_0x3a8c06)&&!_[_0x6d50('0x41')](_0x3a8c06)){loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7a'));loggerPredictive[_0x6d50('0x79')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a8c06[_0x6d50('0x6c')]);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7b'),_0x3a8c06['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x6d50('0x7c'),_0x3a8c06['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a8c06[_0x6d50('0x67')]);loggerPredictive['info'](_0x6d50('0x7d'),_0x3a8c06['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7e'),_0x3a8c06[_0x6d50('0x66')]);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7f'));if(_0x3a8c06[_0x6d50('0x6c')]>0x0){if(!_[_0x6d50('0x3a')](_0x3a8c06['predictiveIntervalAvgTalktime'])&&_0x3a8c06[_0x6d50('0x66')]>0x0){return!![];}loggerPredictive[_0x6d50('0x79')](_0x6d50('0x80'));if(!_['isUndefined'](_0x3a8c06[_0x6d50('0x65')])&&_0x3a8c06[_0x6d50('0x65')]>0x0){return!![];}loggerPredictive[_0x6d50('0x79')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6d50('0x79')](_0x6d50('0x81'));}}else{loggerPredictive[_0x6d50('0x79')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xda32d8){return function(_0x35226f){loggerPredictive['info'](_0x6d50('0x82'));loggerPredictive['info'](_0x6d50('0x83'),_0x35226f['erlangCalls']);loggerPredictive['info'](_0x6d50('0x84'),_0x35226f[_0x6d50('0x6f')]);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x85'),_0x35226f[_0x6d50('0x86')]);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x87'),_0x35226f['erlangBusyFactor']);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x85'),_0x35226f[_0x6d50('0x86')]);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7f'));_[_0x6d50('0x88')](_0xda32d8,_0x35226f);};}function getDiff(_0x3f03bd){var _0x198f7a=moment()[_0x6d50('0x47')](0x0);var _0x37e01d=moment(_0x3f03bd)[_0x6d50('0x47')](0x0);return _0x198f7a[_0x6d50('0x89')](_0x37e01d,_0x6d50('0x48'));}function ifInterval(_0x4539e7,_0x549fa1){if(_[_0x6d50('0x3a')](_0x549fa1)){return![];}return getDiff(_0x549fa1)<_0x4539e7*0x3c;}function freeVariablesPredictive(_0x52bde0){if(isNotNull(_0x52bde0)){if(!_['isUndefined'](_0x52bde0[_0x6d50('0x27')])){_0x52bde0[_0x6d50('0x27')]=undefined;loggerPredictive[_0x6d50('0x79')](_0x52bde0[_0x6d50('0x3e')],_0x6d50('0x8a'));}if(!_['isUndefined'](_0x52bde0['startPredictive'])){_0x52bde0[_0x6d50('0x26')]=undefined;loggerPredictive[_0x6d50('0x79')](_0x52bde0[_0x6d50('0x3e')],_0x6d50('0x8b'));}if(!_['isUndefined'](_0x52bde0['handlePredictive'])){clearInterval(_0x52bde0[_0x6d50('0x8c')]);_0x52bde0[_0x6d50('0x8c')]=undefined;loggerPredictive[_0x6d50('0x79')](_0x52bde0['name'],_0x6d50('0x8d'));}}}function erlangb(_0x314057,_0x1f4240){if(_0x1f4240===0x0){return 0x0;}var _0x5cbc8b=0x1;for(var _0xb2a5e5=0x1;_0xb2a5e5<=_0x1f4240;_0xb2a5e5+=0x1){_0x5cbc8b=0x1+_0x5cbc8b*_0xb2a5e5/_0x314057;}return 0x1/_0x5cbc8b;}function isVoiceQueueOutbound(_0x40e2db){return _0x40e2db===_0x6d50('0x8e');}function isNotPreview(_0x1a8f17){return _0x1a8f17!=='preview';}function isCampaignIvr(_0x1eb7d9){return _0x1eb7d9==='ivr';}function getCallerId(_0xb56cbf,_0x279034,_0x5eff14){if(!_[_0x6d50('0x3a')](_0x5eff14)&&typeof _0x5eff14===_0x6d50('0x8f')&&!_[_0x6d50('0x41')](_0x5eff14)){if(!_[_0x6d50('0x3a')](_0x279034)&&typeof _0x279034===_0x6d50('0x8f')&&!_[_0x6d50('0x41')](_0x279034)){return util['format'](_0x6d50('0x90'),_0x279034,_0x5eff14);}return util[_0x6d50('0x74')](_0x6d50('0x90'),_0x5eff14,_0x5eff14);}if(!_[_0x6d50('0x3a')](_0xb56cbf)&&typeof _0xb56cbf===_0x6d50('0x8f')&&!_['isEmpty'](_0xb56cbf)){return _0xb56cbf;}return _0x6d50('0x91');}function loggerCatchQueueSummary(_0x3f8e0c,_0x301636){return function(_0x33a8fa){freeVariablesPredictive(_0x301636);emitVoiceQueueSummary(_0x301636);emitCampaignSummary(_0x301636);loggerSyncQueueSummary[_0x6d50('0x92')](_0x3f8e0c,util[_0x6d50('0x93')](_0x33a8fa,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x43e826,_0x3256aa){return function(_0x232bd7){loggerPredictive[_0x6d50('0x92')](_0x3256aa[_0x6d50('0x3e')],_0x43e826);loggerPredictive['error'](_0x232bd7['stack']);freeVariablesPredictive(_0x3256aa);};}function loggerCatch(_0x37d6d6){return function(_0x3e96ce){logger['error'](_0x37d6d6,util[_0x6d50('0x93')](_0x3e96ce,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4cae2c){return _0x4cae2c&&!_['isUndefined'](_0x4cae2c)&&_0x4cae2c[_0x6d50('0x94')]>0x0;}function decremetOriginate(_0x4c2af7){if(!_[_0x6d50('0x3a')](_0x4c2af7)&&_0x4c2af7!==null){if(typeof _0x4c2af7[_0x6d50('0x6d')]!==_0x6d50('0x95')){if(_0x4c2af7['originated']>0x0){_0x4c2af7['originated']-=0x1;}else{logger['error'](_0x6d50('0x96'));}}}else{logger['error'](_0x6d50('0x97'));}}function checkContactLowerLimitOriginate(_0x4b8106,_0x46c687,_0x4f2262){if(_0x46c687>_0x4f2262){for(var _0x3b6572=0x0;_0x3b6572<_0x46c687-_0x4f2262;_0x3b6572+=0x1){decremetOriginate(_0x4b8106);}}}function loggerGetContactDialer(_0x285b8f,_0x3dc5ba,_0x5b2c17){return function(_0x35d155){checkContactLowerLimitOriginate(_0x3dc5ba,_0x5b2c17,0x0);logger[_0x6d50('0x92')](_0x285b8f,util[_0x6d50('0x93')](_0x35d155,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x24e9a4){return function(_0x2d6e7a){if(isNotNull(_0x2d6e7a)&&isNotNull(_0x2d6e7a[0x0])){if(_0x2d6e7a[0x0][_0x6d50('0x98')]>0x0){_0x24e9a4[_0x6d50('0x3b')]=_0x6d50('0x99');logger[_0x6d50('0x79')]('[getContactDialer2][ReScheduled]'+_0x24e9a4[_0x6d50('0x3e')],_0x2d6e7a[0x0][_0x6d50('0x98')],'contacts');}else{_0x24e9a4[_0x6d50('0x3b')]=_0x6d50('0x9a');logger[_0x6d50('0x79')](_0x6d50('0x9b')+_0x24e9a4[_0x6d50('0x3e')]);}}};}function notSendMessagesQueue(_0x26b7f0){if(_0x26b7f0[_0x6d50('0x9c')]){freeVariablesPredictive(_0x26b7f0);if(_0x26b7f0[_0x6d50('0x6d')]===0x0&&_0x26b7f0[_0x6d50('0x9d')]===0x0&&_0x26b7f0[_0x6d50('0x53')]===0x0&&(_0x26b7f0[_0x6d50('0x4e')]||0x0)===0x0){_0x26b7f0[_0x6d50('0x9c')]=![];_0x26b7f0[_0x6d50('0x4d')]=0x0;_0x26b7f0[_0x6d50('0x3b')]=_0x6d50('0x3d');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x26b7f0['name'],'is\x20not\x20active');}else{_0x26b7f0['message']=_0x6d50('0x9e');loggerSyncQueueSummary[_0x6d50('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x26b7f0[_0x6d50('0x3e')],'is\x20disactive');}emitVoiceQueueSummary(_0x26b7f0);}}function notSendMessagesCampaign(_0x237912){if(_0x237912['sendMessageOneNotActive']){if(_0x237912[_0x6d50('0x6d')]===0x0){_0x237912[_0x6d50('0x9c')]=![];_0x237912[_0x6d50('0x3b')]=_0x6d50('0x3d');loggerSyncQueueSummary[_0x6d50('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x237912[_0x6d50('0x3e')],_0x6d50('0x9f'));}else{_0x237912[_0x6d50('0x3b')]=_0x6d50('0x9e');loggerSyncQueueSummary[_0x6d50('0x92')](_0x6d50('0xa0'),_0x237912[_0x6d50('0x3e')],_0x6d50('0xa1'));}emitCampaignSummary(_0x237912);}}function createObjHistory(_0x3289c3,_0x399849,_0x3bd4ab,_0x3c6f61,_0x2fcde0){_0x3289c3['message']=_0x3bd4ab;var _0x1c9937=new Action(_0x3289c3,_0x399849);var _0x3da6fa=new History(_0x1c9937);_0x3da6fa[_0x6d50('0xa2')]=_0x3c6f61;_0x3da6fa[_0x6d50('0xa3')]=_0x2fcde0;_0x3da6fa['endtime']=_0x1c9937[_0x6d50('0xa4')];return _0x3da6fa;}Dialer[_0x6d50('0x19')][_0x6d50('0x39')]=function(){var _0x5652b9=this;setInterval(function(){_0x5652b9['clearZombieChannels'](_0x5652b9['uniqueId'],'[uniqueid]');_0x5652b9[_0x6d50('0xa5')](_0x5652b9[_0x6d50('0xa6')],_0x6d50('0xa7'));},0x32c8);};Dialer[_0x6d50('0x19')][_0x6d50('0xa5')]=function(_0x24eb1c,_0x2c7106){var _0x3f6f77=this;for(var _0x207d4e in _0x24eb1c){if(typeof _0x24eb1c[_0x207d4e]!==_0x6d50('0x95')){this['sequence'][_0x6d50('0x1a')](function(){if(!_[_0x6d50('0xa8')](_0x24eb1c[_0x207d4e])){return ami['Action']({'action':_0x6d50('0xa9'),'channel':_0x24eb1c[_0x207d4e][_0x6d50('0xaa')]})[_0x6d50('0xab')](function(_0x34306a){if(_0x34306a[_0x6d50('0x3b')]===_0x6d50('0xac')){setTimeout(function(){if(_0x24eb1c[_0x207d4e]&&_0x24eb1c[_0x207d4e][_0x6d50('0x4a')]!=='ivr'){_0x3f6f77['updateOriginated'](_0x3f6f77[_0x6d50('0x1f')][_0x24eb1c[_0x207d4e][_0x6d50('0xad')]]);logger[_0x6d50('0x92')](_0x6d50('0xae'),_0x2c7106,_0x207d4e,_0x24eb1c[_0x207d4e][_0x6d50('0xad')]);delete _0x24eb1c[_0x207d4e];}if(_0x24eb1c[_0x207d4e]&&_0x24eb1c[_0x207d4e][_0x6d50('0x4a')]===_0x6d50('0xaf')){_0x3f6f77[_0x6d50('0xb0')](_0x3f6f77[_0x6d50('0x20')][_0x24eb1c[_0x207d4e][_0x6d50('0xad')]]);logger[_0x6d50('0x92')](_0x6d50('0xb1'),_0x2c7106,_0x207d4e,_0x24eb1c[_0x207d4e][_0x6d50('0xad')]);delete _0x24eb1c[_0x207d4e];}},0x2328);}});}});}}};Dialer[_0x6d50('0x19')]['countReScheduled']=function(_0x5d5dd6){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopper['countReScheduled'](_0x5d5dd6))['catch'](loggerCatch(_0x6d50('0xb4')));};Dialer[_0x6d50('0x19')][_0x6d50('0xb5')]=function(_0x306482){return BPromise[_0x6d50('0xb2')]()['then'](cmHopperBlack[_0x6d50('0xb5')](_0x306482))['catch'](loggerCatch(_0x6d50('0xb6')));};Dialer[_0x6d50('0x19')][_0x6d50('0xb7')]=function(_0x4d0152){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopperBlack[_0x6d50('0xb7')](_0x4d0152))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xb8')));};Dialer[_0x6d50('0x19')]['averageHandleTime']=function(_0x5da645){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopperHistory[_0x6d50('0xb9')](_0x5da645))['catch'](loggerCatch(_0x6d50('0xba')));};Dialer['prototype'][_0x6d50('0xbb')]=function(_0x5be373){return BPromise['resolve']()[_0x6d50('0xb3')](cmHopper['rescheduleContact'](_0x5be373))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xbc')));};Dialer['prototype'][_0x6d50('0xbd')]=function(_0x1c510a,_0x84d979,_0x588071){return BPromise['resolve']()[_0x6d50('0xb3')](cmHopper['unlockContact'](_0x1c510a,_0x84d979,_0x588071))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xbe')));};Dialer[_0x6d50('0x19')][_0x6d50('0xbf')]=function(_0xd04c4d,_0xe222bc,_0x5a9578,_0x3c47e5){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopper['getContactDialer'](_0xd04c4d,_0xe222bc,_0x5a9578,_0x3c47e5))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xc0')));};Dialer['prototype'][_0x6d50('0xc1')]=function(_0x26ac58,_0x3fafc9,_0x2163f1){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopper['getContactDialerIvr'](_0x26ac58,_0x3fafc9,_0x2163f1))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xc0')));};Dialer[_0x6d50('0x19')][_0x6d50('0xc2')]=function(_0x489b00){return BPromise['resolve']()['then'](voiceQueueRt[_0x6d50('0xc2')](_0x489b00))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xc3')));};Dialer[_0x6d50('0x19')]['moveContactManagedDialer']=function(_0x4681f7){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopper['moveContactManagedDialer'](_0x4681f7))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x6d50('0xc4')]=function(_0x5e2a43){return BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](cmHopperHistory[_0x6d50('0xc4')](_0x5e2a43))['catch'](loggerCatch(_0x6d50('0xc5')));};Dialer[_0x6d50('0x19')][_0x6d50('0xb0')]=function(_0x132acd){if(!_[_0x6d50('0x3a')](_0x132acd)&&_0x132acd!==null){if(typeof _0x132acd[_0x6d50('0x6d')]!==_0x6d50('0x95')){if(_0x132acd[_0x6d50('0x6d')]>0x0){_0x132acd[_0x6d50('0x6d')]-=0x1;}else{logger[_0x6d50('0x92')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x6d50('0x92')](_0x6d50('0xc6'));}};Dialer[_0x6d50('0x19')][_0x6d50('0xc7')]=function(_0x16a01a,_0x4cd8d0){var _0x144d52=this;return function(_0x17b7f3){_0x144d52[_0x6d50('0xb0')](_0x4cd8d0);logger[_0x6d50('0x92')](_0x16a01a,util[_0x6d50('0x93')](_0x17b7f3,{'showHidden':![],'depth':null}));};};Dialer[_0x6d50('0x19')][_0x6d50('0xc8')]=function(_0x240532,_0x35e5fe,_0x26e00c){var _0x52a3ec={'state':0x19,'statedesc':_0x6d50('0xc9')};this['updateOriginated'](_0x35e5fe);this[_0x6d50('0xca')](_[_0x6d50('0x88')](_0x52a3ec,_[_0x6d50('0xcb')](_0x26e00c,[_0x6d50('0xcc'),'ListId','UserId',_0x6d50('0xcd'),_0x6d50('0xce')])),_0x6d50('0xcf'),'[emptyContact]');logger[_0x6d50('0x92')](_0x240532);};Dialer[_0x6d50('0x19')]['isSuccess']=function(_0x25ebf4){return _0x25ebf4===_0x6d50('0xd0');};Dialer[_0x6d50('0x19')]['isTrunkReachable']=function(_0x4662d1){return!_[_0x6d50('0x3a')](_0x4662d1)&&_0x4662d1&&!_['isUndefined'](_0x4662d1[_0x6d50('0x3e')])&&!_[_0x6d50('0x3a')](_0x4662d1[_0x6d50('0x72')])&&_0x4662d1[_0x6d50('0x72')]&&(this['trunks'][util[_0x6d50('0x74')](_0x6d50('0xd1'),_0x4662d1[_0x6d50('0x3e')])][_0x6d50('0xa9')]===_0x6d50('0xd2')||this[_0x6d50('0x22')][util[_0x6d50('0x74')](_0x6d50('0xd1'),_0x4662d1[_0x6d50('0x3e')])]['status']===_0x6d50('0xd3'));};Dialer[_0x6d50('0x19')][_0x6d50('0xca')]=function(_0x5d63d8,_0x241a8e,_0x1648f2){this[_0x6d50('0xc4')](_0x5d63d8)[_0x6d50('0xab')](loggerCatch(_0x241a8e));this[_0x6d50('0xd4')](_0x5d63d8)[_0x6d50('0xab')](loggerCatch(_0x1648f2));};Dialer['prototype'][_0x6d50('0xd5')]=function(_0x213122){var _0x3cea5a=this[_0x6d50('0x25')][_0x213122[_0x6d50('0xd6')]];var _0x3a9b4e;if(!_[_0x6d50('0xa8')](_0x213122)&&!_['isNil'](_0x213122[_0x6d50('0xd7')])&&!_[_0x6d50('0xa8')](_0x213122['variable'][_0x6d50('0xd8')])&&_0x213122[_0x6d50('0xd9')]===_0x6d50('0xda')&&_0x3cea5a){if(_0x3cea5a[_0x6d50('0x4a')]!==_0x6d50('0xaf')&&this[_0x6d50('0x1f')][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xdb')]&&_0x213122[_0x6d50('0xdc')]===_0x6d50('0xdd')){delete this[_0x6d50('0x25')][_0x213122['uniqueid']];this['updateOriginated'](this[_0x6d50('0x1f')][_0x3cea5a[_0x6d50('0xad')]]);this[_0x6d50('0x1f')][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xde')]+=0x1;this['voiceQueues'][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xdf')]+=0x1;_0x3a9b4e=new Hangup(_0x3cea5a,_0x213122);_0x3a9b4e['state']=0x12;_0x3a9b4e['statedesc']=_0x6d50('0xe0');_0x3a9b4e[_0x6d50('0xe1')]=_0x6d50('0xe2');this[_0x6d50('0xca')](_0x3a9b4e,_0x6d50('0xe3'),_0x6d50('0xe4'));}if(_0x3cea5a[_0x6d50('0x4a')]!=='ivr'&&this[_0x6d50('0x1f')][_0x3cea5a[_0x6d50('0xad')]]['dialAMDActive']&&_0x213122['value']===_0x6d50('0xe5')){var _0x435aa9=this;return new BPromise(function(_0x23fe3c,_0x23fa7b){delete _0x435aa9[_0x6d50('0x25')][_0x213122[_0x6d50('0xd6')]];_0x435aa9[_0x6d50('0xb0')](_0x435aa9['voiceQueues'][_0x3cea5a[_0x6d50('0xad')]]);_0x435aa9['voiceQueues'][_0x3cea5a['queue']][_0x6d50('0xde')]+=0x1;_0x435aa9['voiceQueues'][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xdf')]+=0x1;var _0x2b9746=_0x435aa9[_0x6d50('0x1f')][_0x3cea5a[_0x6d50('0xad')]];var _0x218ac8=new Hangup(_0x3cea5a,_0x213122);_0x218ac8['state']=0x13;_0x218ac8['statedesc']=_0x6d50('0xe6');_0x218ac8[_0x6d50('0xe1')]=_0x6d50('0xe2');_0x218ac8[_0x6d50('0xe7')]+=0x1;_0x218ac8[_0x6d50('0xe8')]+=0x1;_0x218ac8[_0x6d50('0xe9')]=!![];_0x435aa9[_0x6d50('0xc4')](_0x218ac8)['catch'](loggerCatch(_0x6d50('0xea')));if(_0x218ac8['countbusyretry']+_0x218ac8[_0x6d50('0xeb')]+_0x218ac8['countnoanswerretry']+_0x218ac8[_0x6d50('0xec')]+_0x218ac8['countdropretry']+_0x218ac8['countabandonedretry']+_0x218ac8[_0x6d50('0xe7')]+_0x218ac8['countagentrejectretry']>=_0x2b9746['dialGlobalMaxRetry']){_0x435aa9[_0x6d50('0xed')](_0x218ac8,_0x23fe3c,_0x23fa7b,_0x6d50('0xee'));}else{if(_0x218ac8[_0x6d50('0xe7')]>=_0x2b9746['dialMachineMaxRetry']){_0x435aa9[_0x6d50('0xef')](_0x218ac8,_0x23fe3c,_0x23fa7b,_0x6d50('0xf0'));}else{_0x435aa9['rescheduleContact']({'active':![],'countmachineretry':_0x218ac8[_0x6d50('0xe7')],'scheduledat':moment()[_0x6d50('0xf1')](_0x2b9746[_0x6d50('0xf2')],'minutes')[_0x6d50('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x218ac8[_0x6d50('0xcc')],'ListId':_0x218ac8['ListId'],'VoiceQueueId':_0x218ac8[_0x6d50('0xcd')]||undefined,'CampaignId':_0x218ac8[_0x6d50('0xce')]||undefined})['catch'](loggerCatch(_0x6d50('0xf3')));_0x23fe3c({'reschedule':0x1});}}});}if(_0x3cea5a[_0x6d50('0x4a')]===_0x6d50('0xaf')&&this[_0x6d50('0x20')][_0x3cea5a['queue']][_0x6d50('0xdb')]&&_0x213122['value']===_0x6d50('0xdd')){delete this[_0x6d50('0x25')][_0x213122[_0x6d50('0xd6')]];this[_0x6d50('0xb0')](this[_0x6d50('0x20')][_0x3cea5a[_0x6d50('0xad')]]);_0x3a9b4e=new Hangup(_0x3cea5a,_0x213122);_0x3a9b4e[_0x6d50('0xa2')]=0x12;_0x3a9b4e[_0x6d50('0xa3')]=_0x6d50('0xe0');_0x3a9b4e[_0x6d50('0xe1')]=_0x6d50('0xe2');this['saveInDb'](_0x3a9b4e,_0x6d50('0xf4'),'[syncHangupInAMDIvr]');}if(_0x3cea5a[_0x6d50('0x4a')]===_0x6d50('0xaf')&&this[_0x6d50('0x20')][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xdb')]&&_0x213122['value']===_0x6d50('0xe5')){var _0x435aa9=this;return new BPromise(function(_0x1dfa7a,_0x4ebfc2){delete _0x435aa9[_0x6d50('0x25')][_0x213122[_0x6d50('0xd6')]];_0x435aa9[_0x6d50('0xb0')](_0x435aa9['campaigns'][_0x3cea5a['queue']]);_0x435aa9[_0x6d50('0x20')][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xde')]+=0x1;_0x435aa9['campaigns'][_0x3cea5a[_0x6d50('0xad')]][_0x6d50('0xdf')]+=0x1;var _0xd9826b=_0x435aa9['campaigns'][_0x3cea5a[_0x6d50('0xad')]];var _0x618253=new Hangup(_0x3cea5a,_0x213122);_0x618253[_0x6d50('0xa2')]=0x13;_0x618253['statedesc']=_0x6d50('0xe6');_0x618253[_0x6d50('0xe1')]=_0x6d50('0xe2');_0x618253['countmachineretry']+=0x1;_0x618253['countglobal']+=0x1;_0x618253[_0x6d50('0xe9')]=!![];_0x435aa9[_0x6d50('0xc4')](_0x618253)[_0x6d50('0xab')](loggerCatch(_0x6d50('0xea')));if(_0x618253[_0x6d50('0xf5')]+_0x618253[_0x6d50('0xeb')]+_0x618253['countnoanswerretry']+_0x618253[_0x6d50('0xec')]+_0x618253[_0x6d50('0xf6')]+_0x618253[_0x6d50('0xf7')]+_0x618253[_0x6d50('0xe7')]+_0x618253[_0x6d50('0xf8')]>=_0xd9826b[_0x6d50('0xf9')]){_0x435aa9['stateGlobal'](_0x618253,_0x1dfa7a,_0x4ebfc2,'reason19\x20machine....');}else{if(_0x618253['countmachineretry']>=_0xd9826b[_0x6d50('0xfa')]){_0x435aa9[_0x6d50('0xef')](_0x618253,_0x1dfa7a,_0x4ebfc2,'reason\x2019\x20machine....');}else{_0x435aa9[_0x6d50('0xbb')]({'active':![],'countmachineretry':_0x618253['countmachineretry'],'scheduledat':moment()[_0x6d50('0xf1')](_0xd9826b[_0x6d50('0xf2')],_0x6d50('0xfb'))['format'](_0x6d50('0xfc')),'ContactId':_0x618253[_0x6d50('0xcc')],'ListId':_0x618253['ListId'],'VoiceQueueId':_0x618253[_0x6d50('0xcd')]||undefined,'CampaignId':_0x618253[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0xf3')));_0x1dfa7a({'reschedule':0x1});}}});}}};Dialer[_0x6d50('0x19')]['syncHangup']=function(_0x4585b2){var _0x4ee2a3=this[_0x6d50('0x25')][_0x4585b2[_0x6d50('0xd6')]];var _0xf6e1d0=this;var _0x28748f;if(_0x4ee2a3&&_0x4ee2a3['type']===_0x6d50('0xaf')){delete this[_0x6d50('0x25')][_0x4585b2['uniqueid']];this[_0x6d50('0xb0')](this[_0x6d50('0x20')][_0x4ee2a3[_0x6d50('0xad')]]);this[_0x6d50('0x20')][_0x4ee2a3[_0x6d50('0xad')]][_0x6d50('0xfd')]+=0x1;_0x28748f=new Hangup(_0x4ee2a3,_0x4585b2);this['createHistory'](_0x28748f)[_0x6d50('0xab')](loggerCatch(_0x6d50('0xfe')));this[_0x6d50('0xd4')](_0x28748f)[_0x6d50('0xab')](loggerCatch(_0x6d50('0xff')));}if(_0x4ee2a3&&_0x4ee2a3['type']!==_0x6d50('0xaf')&&isNotNull(this['voiceQueues'][_0x4ee2a3['queue']][_0x6d50('0x100')])){delete this['uniqueId'][_0x4585b2[_0x6d50('0xd6')]];this['updateOriginated'](this[_0x6d50('0x1f')][_0x4ee2a3[_0x6d50('0xad')]]);this[_0x6d50('0x1f')][_0x4ee2a3['queue']][_0x6d50('0xde')]+=0x1;this[_0x6d50('0x1f')][_0x4ee2a3['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x28748f=new Hangup(_0x4ee2a3,_0x4585b2);_0x28748f[_0x6d50('0xa2')]=0x10;_0x28748f[_0x6d50('0xa3')]=_0x6d50('0x101');_0x28748f['membername']=_0x6d50('0x102');this['createHistory'](_0x28748f)[_0x6d50('0xab')](loggerCatch(_0x6d50('0xfe')));this[_0x6d50('0xd4')](_0x28748f)['catch'](loggerCatch(_0x6d50('0xff')));}if(_0x4ee2a3&&_0x4ee2a3[_0x6d50('0x4a')]!==_0x6d50('0xaf')&&!isNotNull(this[_0x6d50('0x1f')][_0x4ee2a3[_0x6d50('0xad')]]['dialQueueProject'])){delete this['uniqueId'][_0x4585b2[_0x6d50('0xd6')]];this['updateOriginated'](this[_0x6d50('0x1f')][_0x4ee2a3[_0x6d50('0xad')]]);this['voiceQueues'][_0x4ee2a3[_0x6d50('0xad')]]['outboundUnknownCallsDay']+=0x1;_0x28748f=new Hangup(_0x4ee2a3,_0x4585b2);_0x28748f[_0x6d50('0xa2')]=0xc;_0x28748f[_0x6d50('0xa3')]=_0x4585b2[_0x6d50('0x103')];_0x28748f[_0x6d50('0xe1')]=_0x6d50('0x104');this[_0x6d50('0xc4')](_0x28748f)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6d50('0xd4')](_0x28748f)['catch'](loggerCatch(_0x6d50('0xff')));}};Dialer[_0x6d50('0x19')][_0x6d50('0x2f')]=function(_0x1ff5ff){var _0x2eaf55=this[_0x6d50('0x25')][_0x1ff5ff['uniqueid']];var _0x476c35=this;if(this[_0x6d50('0x1f')][_0x1ff5ff['queue']]){if(_0x2eaf55&&_0x2eaf55[_0x6d50('0x4a')]!==_0x6d50('0xaf')){delete this[_0x6d50('0x25')][_0x1ff5ff[_0x6d50('0xd6')]];this[_0x6d50('0x1f')][_0x1ff5ff[_0x6d50('0xad')]][_0x6d50('0xde')]+=0x1;var _0x723318=new AgentComplete(_0x2eaf55,_0x1ff5ff);if(_0x1ff5ff[_0x6d50('0x105')]==='agent'){_0x723318[_0x6d50('0x106')]=this['voiceQueues'][_0x1ff5ff[_0x6d50('0xad')]]['dialQueueProject2']&&this[_0x6d50('0x1f')][_0x1ff5ff['queue']][_0x6d50('0x107')]?moment()[_0x6d50('0x74')](_0x6d50('0xfc')):undefined;}this[_0x6d50('0xc4')](_0x723318)[_0x6d50('0xab')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x6d50('0xd4')](_0x723318)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x6d50('0x19')]['syncAgentConnect']=function(_0x1f4dfd){if(this['voiceQueues'][_0x1f4dfd['queue']]){if(this[_0x6d50('0x25')][_0x1f4dfd[_0x6d50('0xd6')]]&&this['uniqueId'][_0x1f4dfd['uniqueid']][_0x6d50('0x4a')]!=='ivr'){this[_0x6d50('0xb0')](this['voiceQueues'][_0x1f4dfd[_0x6d50('0xad')]]);this[_0x6d50('0x25')][_0x1f4dfd[_0x6d50('0xd6')]][_0x6d50('0x108')]=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));}}};Dialer['prototype'][_0x6d50('0x109')]=function(_0x56e9a7){this[_0x6d50('0xc4')](_0x56e9a7)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x10a')));this[_0x6d50('0xd4')](_0x56e9a7)[_0x6d50('0xab')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x6d50('0x19')][_0x6d50('0x10b')]=function(_0x3e228d){var _0x1e3394=this[_0x6d50('0x25')][_0x3e228d[_0x6d50('0xd6')]];var _0x511c7b=this;if(this[_0x6d50('0x1f')][_0x3e228d['queue']]){if(_0x1e3394&&_0x1e3394[_0x6d50('0x4a')]!==_0x6d50('0xaf')){delete this[_0x6d50('0x25')][_0x3e228d['uniqueid']];this[_0x6d50('0xb0')](this['voiceQueues'][_0x3e228d[_0x6d50('0xad')]]);_0x1e3394[_0x6d50('0x10c')]=moment()['format'](_0x6d50('0xfc'));var _0x314745=new QueueCallerAbandon(_0x1e3394,_0x3e228d);if(getSeconds(_0x1e3394[_0x6d50('0x10c')],_0x1e3394[_0x6d50('0x10d')])>=_0x1e3394['dialQueueTimeout']){this[_0x6d50('0x1f')][_0x3e228d[_0x6d50('0xad')]][_0x6d50('0x10e')]+=0x1;this['voiceQueues'][_0x3e228d[_0x6d50('0xad')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x6d50('0x1f')][_0x3e228d[_0x6d50('0xad')]][_0x6d50('0x10f')]+=0x1;_0x314745[_0x6d50('0xa2')]=0xa;_0x314745[_0x6d50('0xa3')]=_0x6d50('0x110');_0x314745[_0x6d50('0x111')]='TIMEOUT';_0x314745[_0x6d50('0x106')]=this[_0x6d50('0x1f')][_0x3e228d[_0x6d50('0xad')]]['dialQueueProject2']?moment()[_0x6d50('0x74')](_0x6d50('0xfc')):undefined;_0x314745[_0x6d50('0xf6')]+=0x1;_0x314745['countglobal']+=0x1;if(_0x314745[_0x6d50('0xf6')]>=this[_0x6d50('0x1f')][_0x3e228d[_0x6d50('0xad')]]['dialDropMaxRetry']){this[_0x6d50('0x109')](_0x314745);}else{this[_0x6d50('0xbb')]({'active':![],'countdropretry':_0x314745[_0x6d50('0xf6')],'scheduledat':moment()[_0x6d50('0xf1')](this['voiceQueues'][_0x3e228d[_0x6d50('0xad')]][_0x6d50('0x112')],_0x6d50('0xfb'))[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x1e3394[_0x6d50('0xcc')],'ListId':_0x1e3394[_0x6d50('0x113')],'VoiceQueueId':_0x1e3394['VoiceQueueId']||undefined,'CampaignId':_0x1e3394[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0x114')));var _0x143f7a=new History(_0x314745);_0x143f7a['state']=0xa;_0x143f7a[_0x6d50('0xa3')]=_0x6d50('0x110');_0x143f7a['starttime']=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));_0x143f7a[_0x6d50('0x115')]=_0x143f7a[_0x6d50('0xa4')];_0x143f7a[_0x6d50('0x116')]=_0x314745[_0x6d50('0x116')];_0x143f7a[_0x6d50('0x117')]=_0x314745[_0x6d50('0x117')];this['createHistory'](_0x143f7a)['catch'](loggerCatch(_0x6d50('0x118')));}}else{this[_0x6d50('0x1f')][_0x3e228d['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x6d50('0x1f')][_0x3e228d['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x314745[_0x6d50('0xa2')]=0xb;_0x314745[_0x6d50('0xa3')]=_0x6d50('0x119');_0x314745[_0x6d50('0x111')]=_0x6d50('0x11a');_0x314745[_0x6d50('0xf7')]+=0x1;_0x314745['countglobal']+=0x1;if(_0x314745[_0x6d50('0xf7')]>=this[_0x6d50('0x1f')][_0x3e228d['queue']]['dialAbandonedMaxRetry']){this[_0x6d50('0x109')](_0x314745);}else{this[_0x6d50('0xbb')]({'active':![],'countabandonedretry':_0x314745['countabandonedretry'],'scheduledat':moment()[_0x6d50('0xf1')](this[_0x6d50('0x1f')][_0x3e228d[_0x6d50('0xad')]][_0x6d50('0x11b')],_0x6d50('0xfb'))[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x1e3394[_0x6d50('0xcc')],'ListId':_0x1e3394[_0x6d50('0x113')],'VoiceQueueId':_0x1e3394[_0x6d50('0xcd')]||undefined,'CampaignId':_0x1e3394[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x143f7a=new History(_0x314745);_0x143f7a[_0x6d50('0xa2')]=0xb;_0x143f7a[_0x6d50('0xa3')]=_0x6d50('0x119');_0x143f7a[_0x6d50('0xa4')]=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));_0x143f7a['endtime']=_0x143f7a[_0x6d50('0xa4')];_0x143f7a[_0x6d50('0x116')]=_0x314745[_0x6d50('0x116')];_0x143f7a[_0x6d50('0x117')]=_0x314745[_0x6d50('0x117')];this[_0x6d50('0xc4')](_0x143f7a)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x11c')));}}}}};Dialer[_0x6d50('0x19')][_0x6d50('0x33')]=function(_0x1da93c){if(this[_0x6d50('0xa6')][_0x1da93c['uniqueid']]){this[_0x6d50('0xa6')][_0x1da93c[_0x6d50('0xd6')]][_0x6d50('0xaa')]=_0x1da93c['channel'];}if(this[_0x6d50('0x25')][_0x1da93c['uniqueid']]){this[_0x6d50('0x25')][_0x1da93c[_0x6d50('0xd6')]]['channel']=_0x1da93c['channel'];}};Dialer[_0x6d50('0x19')][_0x6d50('0x36')]=function(_0x3c302e){if(strategy[this[_0x6d50('0x1f')][this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0xad')]][_0x6d50('0x4b')]]===_0x6d50('0x18')){if(this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]]&&_['isNil'](this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0x11e')])&&_0x3c302e[_0x6d50('0xa9')]==='1'&&_0x3c302e['paused']==='0'){if(this[_0x6d50('0x21')][_0x3c302e[_0x6d50('0x11f')]]){if(!this['agents'][_0x3c302e[_0x6d50('0x11f')]][_0x6d50('0x11e')]){this[_0x6d50('0x21')][_0x3c302e[_0x6d50('0x11f')]][_0x6d50('0x11e')]=!![];this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0x11e')]=!![];this[_0x6d50('0xa6')][_0x3c302e['actionid']][_0x6d50('0x11f')]=_0x3c302e['stateinterface'];}}}}else if((strategy[this[_0x6d50('0x1f')][this['actions'][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0xad')]][_0x6d50('0x4b')]]||_0x6d50('0x120'))===_0x6d50('0x120')){if(this[_0x6d50('0xa6')][_0x3c302e['actionid']]){if(this[_0x6d50('0x21')][_0x3c302e['stateinterface']]){this[_0x6d50('0xa6')][_0x3c302e['actionid']][_0x6d50('0x11f')]=_0x3c302e['stateinterface'];if(_[_0x6d50('0xa8')](this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0xad')]])){this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x3c302e[_0x6d50('0x11d')]]['queue']]=[];}this[_0x6d50('0x121')][this['actions'][_0x3c302e[_0x6d50('0x11d')]][_0x6d50('0xad')]][_0x6d50('0x122')](_[_0x6d50('0x88')](_[_0x6d50('0xcb')](this['actions'][_0x3c302e['actionid']],[_0x6d50('0x123'),'stateinterface']),{'status':_0x3c302e[_0x6d50('0xa9')],'paused':_0x3c302e[_0x6d50('0x124')]}));}}}};function unlockQueueStatus(_0x194f37,_0x25f8ba){setTimeout(function(){if(_[_0x6d50('0x3a')](_0x194f37[_0x6d50('0x125')])){loggerBooked[_0x6d50('0x92')]('[unlockQueueStatus][undefined]',_0x25f8ba);}_0x194f37[_0x6d50('0x125')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x25f8ba,JSON[_0x6d50('0x46')](_['pick'](_0x194f37,[_0x6d50('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x6d50('0x19')][_0x6d50('0x126')]=function(_0x48f23d){var _0x4f03e5=this;var _0x1d8a3c=_0x4f03e5[_0x6d50('0x1f')][_0x4f03e5['actions'][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xad')]];if(strategy[this[_0x6d50('0x1f')][this['actions'][_0x48f23d[_0x6d50('0x11d')]]['queue']]['strategy']]===_0x6d50('0x18')){if(this['actions'][_0x48f23d[_0x6d50('0x11d')]]&&this[_0x6d50('0xa6')][_0x48f23d['actionid']]['stateinterface']){this[_0x6d50('0x1e')][_0x6d50('0x127')](this['actions'][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0x123')],this['actions'][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0x11f')])[_0x6d50('0xab')](function(_0x21881a){logger[_0x6d50('0x92')](_0x6d50('0x128'),util[_0x6d50('0x93')](_0x21881a,{'showHidden':![],'depth':null}));})[_0x6d50('0x1c')](function(){_0x4f03e5[_0x6d50('0xb0')](_0x4f03e5[_0x6d50('0x1f')][_0x4f03e5[_0x6d50('0xa6')][_0x48f23d['actionid']][_0x6d50('0xad')]]);_0x4f03e5[_0x6d50('0x21')][_0x4f03e5[_0x6d50('0xa6')][_0x48f23d['actionid']]['stateinterface']][_0x6d50('0x11e')]=![];delete _0x4f03e5[_0x6d50('0xa6')][_0x48f23d['actionid']];unlockQueueStatus(_0x1d8a3c);});}else{this[_0x6d50('0xb0')](this[_0x6d50('0x1f')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xad')]]);this[_0x6d50('0xbb')]({'active':![],'ContactId':this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xcc')],'ListId':this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['ListId'],'VoiceQueueId':this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xcd')]||undefined,'CampaignId':this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xce')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x6d50('0xa6')][_0x48f23d['actionid']];unlockQueueStatus(_0x1d8a3c);}}else if((strategy[this[_0x6d50('0x1f')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['queue']][_0x6d50('0x4b')]]||_0x6d50('0x120'))===_0x6d50('0x120')){var _0x14cffc;if(this[_0x6d50('0xa6')][_0x48f23d['actionid']]&&!_[_0x6d50('0x41')](this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x48f23d['actionid']][_0x6d50('0xad')]])){if(this['queueBookedRR'][_0x4f03e5[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['queue']]){this['queueBookedRR'][_0x4f03e5[_0x6d50('0xa6')][_0x48f23d['actionid']][_0x6d50('0xad')]]=this['queueBookedRR'][this['actions'][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xad')]]?this[_0x6d50('0x29')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]][_0x6d50('0xad')]]:this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['queue']]?this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x48f23d['actionid']][_0x6d50('0xad')]][_0x6d50('0x129')]||0x0:0x0;}this[_0x6d50('0x121')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['queue']]['_rr']=this[_0x6d50('0x29')][this[_0x6d50('0xa6')][_0x48f23d[_0x6d50('0x11d')]]['queue']];for(var _0x3c2807=0x0;_0x3c2807=0x0;})[_0x6d50('0xab')](myreject(_0x70212b)));}}else{_0x3ff21f[_0x6d50('0x122')](ami[_0x6d50('0x143')]({'action':_0x6d50('0x144'),'command':util[_0x6d50('0x74')](_0x6d50('0x145'),_0x1fa8a4,!_['isUndefined'](config['timezones'][_0x283c5b])?_0x283c5b:'')})['then'](function(_0x37f388){return _0x37f388[_0x6d50('0x14a')][_0x6d50('0x148')](_0x6d50('0x149'))>=0x0;})[_0x6d50('0xab')](myreject(_0x70212b)));}BPromise[_0x6d50('0x14b')](_0x3ff21f)[_0x6d50('0xb3')](function(_0x17e3dd){var _0x31bea9=_[_0x6d50('0x14c')](_0x17e3dd);if(_0x31bea9){return _0x31c489(_0x31bea9);}else{_0x236669[_0x6d50('0x3b')]=_0x257909?_0x6d50('0x14d'):_0x6d50('0x14e');return _0x70212b(msgResponse('[ifTime][promiseAll]',_0x6d50('0x13c'),_0x6d50('0x14f')+_0x257909+'\x20'+_0x27fd54+_0x6d50('0x150')+util[_0x6d50('0x93')](_0x1fa8a4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x283c5b));}})[_0x6d50('0xab')](function(_0x58552d){return _0x70212b(msgResponse(_0x6d50('0x13b'),_0x6d50('0x13c'),JSON['stringify'](_0x58552d)));});});};Dialer[_0x6d50('0x19')]['checkDialMethod']=function(_0x20725b){var _0x51002e=this;return function(){switch(_0x20725b[_0x6d50('0x151')]){case'progressive':freeVariablesPredictive(_0x20725b);_0x51002e[_0x6d50('0x152')](_0x20725b,0x1);break;case'power':freeVariablesPredictive(_0x20725b);_0x51002e['handlePower'](_0x20725b,_0x20725b[_0x6d50('0x153')]);break;case _0x6d50('0x9'):_0x51002e['predictive'](_0x20725b);break;case _0x6d50('0x154'):freeVariablesPredictive(_0x20725b);_0x51002e[_0x6d50('0x152')](_0x20725b,0x1);break;default:freeVariablesPredictive(_0x20725b);logger['error']('Queue',_0x20725b[_0x6d50('0x3e')],'method\x20not\x20recognized');}};};Dialer[_0x6d50('0x19')][_0x6d50('0x155')]=function(_0xa0a4a9){var _0x2a538f=this;return function(){_0x2a538f[_0x6d50('0x156')](_0xa0a4a9);};};Dialer['prototype'][_0x6d50('0xa')]=function(_0x1043b5){var _0x18e8f5=this;if(isNotPreview(_0x1043b5['dialMethod'])){if(isVoiceQueueOutbound(_0x1043b5['type'])&&isActive(_0x1043b5[_0x6d50('0x55')])){_0x1043b5[_0x6d50('0x9c')]=!![];BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](checkIsLoggedIn(_0x1043b5,_0x1043b5[_0x6d50('0x157')]))[_0x6d50('0xb3')](checkIsActive(_0x1043b5,_0x1043b5[_0x6d50('0x55')]))[_0x6d50('0xb3')](checkInterval(_0x1043b5))[_0x6d50('0xb3')](_0x18e8f5['checkIsTrunkReachable'](_0x1043b5))[_0x6d50('0xb3')](_0x18e8f5['checkIfTime'](_0x1043b5[_0x6d50('0x158')],_0x1043b5[_0x6d50('0x159')],_0x1043b5[_0x6d50('0x3e')],_0x1043b5))['then'](_0x18e8f5[_0x6d50('0x13a')](_0x1043b5[_0x6d50('0x40')],_0x1043b5[_0x6d50('0x159')],_0x1043b5[_0x6d50('0x3e')],_0x1043b5))[_0x6d50('0xb3')](_0x18e8f5[_0x6d50('0x15a')](_0x1043b5))[_0x6d50('0xab')](loggerCatchQueueSummary(_0x6d50('0x15b'),_0x1043b5));}else{notSendMessagesQueue(_0x1043b5);}}else{freeVariablesPredictive(_0x1043b5);}};Dialer[_0x6d50('0x19')][_0x6d50('0x133')]=function(){var _0x5b7166=this;var _0x3dd34e;for(var _0x3286b7 in this[_0x6d50('0x20')]){if(typeof this[_0x6d50('0x20')][_0x3286b7]!==_0x6d50('0x95')){_0x3dd34e=this[_0x6d50('0x20')][_0x3286b7];if(isCampaignIvr(_0x3dd34e[_0x6d50('0x4a')])&&isActive(_0x3dd34e[_0x6d50('0x72')])){_0x3dd34e[_0x6d50('0x9c')]=!![];BPromise[_0x6d50('0xb2')]()[_0x6d50('0xb3')](checkIsActive(_0x3dd34e,_0x3dd34e['active']))[_0x6d50('0xb3')](checkInterval(_0x3dd34e))[_0x6d50('0xb3')](_0x5b7166[_0x6d50('0x134')](_0x3dd34e))[_0x6d50('0xb3')](_0x5b7166['checkIfTime'](_0x3dd34e['dialGlobalInterval'],_0x3dd34e['dialTimezone'],_0x3dd34e['name'],_0x3dd34e))[_0x6d50('0xb3')](_0x5b7166['checkIfTimeIntervals'](_0x3dd34e[_0x6d50('0x40')],_0x3dd34e['dialTimezone'],_0x3dd34e['name'],_0x3dd34e))[_0x6d50('0xb3')](_0x5b7166['launchHandleIvr'](_0x3dd34e))[_0x6d50('0xab')](loggerCatchQueueSummary(_0x6d50('0x15c'),_0x3dd34e));}else{notSendMessagesCampaign(_0x3dd34e);}}}};function getCallerIdRandom(_0xfea75e,_0x25419f){var _0x5b1dd6;var _0x38a279;var _0x258a3d;if(_0x25419f<=0x0){_0x25419f=0x1;}_0x5b1dd6=new RegExp('\x5cw{0,'+_0x25419f+'}$');_0x38a279=Math[_0x6d50('0x15d')](0xa,_0x25419f-0x1);_0x258a3d=Math[_0x6d50('0x15d')](0xa,_0x25419f)-0x1;return util[_0x6d50('0x74')]('%s',_[_0x6d50('0x15e')](_0xfea75e,_0x5b1dd6,_[_0x6d50('0x15f')](_0x38a279,_0x258a3d)));}function extractCalleridName(_0x4828a4){var _0x3ac63e=_0x4828a4[_0x6d50('0x160')](/"(.*?)"/);return _0x3ac63e?_0x3ac63e[0x1]:_0x4828a4;}function extractCalleridNumber(_0x6aefb){var _0x599f94=_0x6aefb[_0x6d50('0x160')](/<(.*?)>/);return _0x599f94?_0x599f94[0x1]:_0x6aefb;}Dialer[_0x6d50('0x19')]['actionOriginate']=function(_0x2e895a,_0x37ce1f){var _0x20c895=this;var _0x20640c=uuid['v4']();this['actions'][_0x20640c]=new Action(_0x2e895a,_0x37ce1f,_0x20640c);return new BPromise(function(_0x1cd1d7,_0x138aab){if(_[_0x6d50('0x3a')](_0x2e895a)&&typeof _0x2e895a!=='object'){return _0x138aab(msgResponse(_0x6d50('0x161'),_0x6d50('0x13c'),_0x6d50('0x162')));}if(_['isUndefined'](_0x37ce1f[_0x6d50('0x163')]['phone'])||_0x37ce1f['Contact'][_0x6d50('0x164')]===null){return _0x138aab(msgResponse('originate','Failure',_0x6d50('0x165')));}var _0x4a1804={'XMD-CALLERID':_0x20c895[_0x6d50('0xa6')][_0x20640c]['getCaller'](),'XMD-AGI':_0x2e895a[_0x6d50('0x100')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2e895a[_0x6d50('0x100')]):_0x6d50('0x166'),'XMD-AGIAFTER':_0x2e895a[_0x6d50('0x167')]?util[_0x6d50('0x74')](_0x6d50('0x168'),ipAgi,_0x2e895a['dialQueueProject2']):_0x6d50('0x166'),'XMD-QUEUE':_0x2e895a[_0x6d50('0x4a')]===_0x6d50('0x8e')?util['format'](_0x6d50('0x169'),_0x2e895a[_0x6d50('0x3e')],_0x2e895a[_0x6d50('0x16a')]||'',_0x2e895a[_0x6d50('0x107')]?'c':'',_0x2e895a[_0x6d50('0x16b')]||0x3):_0x6d50('0x166'),'XMD-CONTACTID':_0x37ce1f[_0x6d50('0xcc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x20c895['actions'][_0x20640c]['getCaller'](),'XMD-AMD':_0x2e895a[_0x6d50('0xdb')]?_0x6d50('0x16c'):_0x6d50('0x166'),'XMD-DESTINATION':_0x6d50('0xda')};if(_0x2e895a[_0x6d50('0xdb')]){_0x4a1804['XMD-AMDINITIALSILENCE']=_0x2e895a[_0x6d50('0x16d')]||0x9c4;_0x4a1804[_0x6d50('0x16e')]=_0x2e895a[_0x6d50('0x16f')]||0x5dc;_0x4a1804[_0x6d50('0x170')]=_0x2e895a[_0x6d50('0x171')]||0x320;_0x4a1804[_0x6d50('0x172')]=_0x2e895a[_0x6d50('0x173')]||0x1388;_0x4a1804['XMD-AMDMINWORDLENGTH']=_0x2e895a[_0x6d50('0x174')]||0x64;_0x4a1804[_0x6d50('0x175')]=_0x2e895a['dialAMDBetweenWordsSilence']||0x32;_0x4a1804[_0x6d50('0x176')]=_0x2e895a[_0x6d50('0x177')]||0x3;_0x4a1804[_0x6d50('0x178')]=_0x2e895a[_0x6d50('0x179')]||0x100;_0x4a1804[_0x6d50('0x17a')]=_0x2e895a[_0x6d50('0x17b')]||0x1388;}if(_0x2e895a[_0x6d50('0x4a')]===_0x6d50('0x8e')){_0x4a1804[_0x6d50('0x17c')]=_0x37ce1f[_0x6d50('0xcd')];}else{_0x4a1804[_0x6d50('0x17d')]=_0x37ce1f['CampaignId'];}for(var _0x38f76d in _0x37ce1f[_0x6d50('0x163')]){if(typeof _0x37ce1f[_0x6d50('0x163')][_0x38f76d]!==_0x6d50('0x95')){if(isNotNull(_0x37ce1f[_0x6d50('0x163')][_0x38f76d])&&_0x38f76d!=='id'&&_0x38f76d!==_0x6d50('0x17e')&&_0x38f76d!=='createdAt'&&_0x38f76d!==_0x6d50('0x17f')){_0x4a1804[util['format']('%s%s',_0x6d50('0x180'),_['toUpper'](_0x38f76d))]=_0x37ce1f['Contact'][_0x38f76d];}}}var _0xd3a945=_0x20c895[_0x6d50('0x135')](_0x2e895a[_0x6d50('0x71')])?getCallerId(_0x2e895a['Trunk'][_0x6d50('0x73')],_0x2e895a[_0x6d50('0x56')],_0x2e895a[_0x6d50('0x181')]>0x0?getCallerIdRandom(_0x2e895a['dialOriginateCallerIdNumber'],_0x2e895a[_0x6d50('0x181')]):_0x2e895a[_0x6d50('0x57')]):getCallerId(_['isNil'](_0x2e895a[_0x6d50('0x136')])?_0x2e895a[_0x6d50('0x71')]['callerid']:_0x2e895a[_0x6d50('0x136')][_0x6d50('0x73')],_0x2e895a['dialOriginateCallerIdName'],_0x2e895a[_0x6d50('0x181')]>0x0?getCallerIdRandom(_0x2e895a[_0x6d50('0x57')],_0x2e895a[_0x6d50('0x181')]):_0x2e895a[_0x6d50('0x57')]);if(_0xd3a945){_0x4a1804[_0x6d50('0x182')]=_0x20c895['actions'][_0x20640c][_0x6d50('0x183')]=extractCalleridName(_0xd3a945);_0x4a1804['XMD-ORIGINATECALLERIDNUM']=_0x20c895['actions'][_0x20640c]['originatecalleridnum']=extractCalleridNumber(_0xd3a945);}return ami[_0x6d50('0x143')]({'actionid':_0x20640c,'action':'originate','channel':_0x20c895[_0x6d50('0x135')](_0x2e895a['Trunk'])?util[_0x6d50('0x74')](_0x6d50('0x184'),_0x2e895a[_0x6d50('0x71')][_0x6d50('0x3e')],isNotNull(_0x2e895a[_0x6d50('0x59')])?_0x2e895a[_0x6d50('0x59')][_0x6d50('0x185')]()||'':'',_0x2e895a[_0x6d50('0x186')]>0x0?_0x37ce1f['Contact'][_0x6d50('0x164')]['substring'](_0x2e895a['dialCutDigit']):_0x37ce1f[_0x6d50('0x163')][_0x6d50('0x164')]):util[_0x6d50('0x74')](_0x6d50('0x184'),_[_0x6d50('0xa8')](_0x2e895a[_0x6d50('0x136')])?_0x2e895a[_0x6d50('0x71')]['name']:_0x2e895a[_0x6d50('0x136')]['name'],isNotNull(_0x2e895a[_0x6d50('0x59')])?_0x2e895a[_0x6d50('0x59')]['trim']()||'':'',_0x2e895a[_0x6d50('0x186')]>0x0?_0x37ce1f[_0x6d50('0x163')][_0x6d50('0x164')][_0x6d50('0x187')](_0x2e895a[_0x6d50('0x186')]):_0x37ce1f[_0x6d50('0x163')][_0x6d50('0x164')]),'callerid':_0xd3a945,'Exten':_0x6d50('0xda'),'Context':_0x6d50('0x188'),'Priority':'1','variable':_0x4a1804,'timeout':(_0x2e895a[_0x6d50('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20640c})[_0x6d50('0xb3')](function(_0xfc270c){return _0x1cd1d7(_0xfc270c);})['catch'](function(_0x4e5dd1){_0x2e895a[_0x6d50('0x62')]+=0x1;var _0x36baf5=new History(_0x20c895[_0x6d50('0xa6')][_0x20640c]);logger['error'](util[_0x6d50('0x74')]('[originateError]:\x20%s',JSON[_0x6d50('0x46')](_0x4e5dd1)));_0x36baf5[_0x6d50('0xa2')]=0xe;_0x36baf5[_0x6d50('0xa3')]=_0x6d50('0x189');_0x36baf5[_0x6d50('0xa4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36baf5[_0x6d50('0x115')]=_0x36baf5[_0x6d50('0xa4')];_0x20c895['createHistory'](_0x36baf5)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x18a')));_0x20c895[_0x6d50('0xd4')](_0x36baf5)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x18a')))[_0x6d50('0x1c')](function(){delete _0x20c895[_0x6d50('0xa6')][_0x20640c];return _0x138aab(msgResponse(_0x6d50('0x161'),_0x6d50('0x45'),_0x6d50('0x18b')));});});});};Dialer['prototype'][_0x6d50('0x2d')]=function(_0x5a5f6a){var _0x15e8e6=this['actions'][_0x5a5f6a['actionid']];if(_0x15e8e6){delete this[_0x6d50('0xa6')][_0x5a5f6a[_0x6d50('0x11d')]];_0x15e8e6[_0x6d50('0x10d')]=moment()[_0x6d50('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1a81ec=_0x15e8e6[_0x6d50('0x4a')]===_0x6d50('0xaf')?this[_0x6d50('0x20')][_0x15e8e6[_0x6d50('0xad')]]:this[_0x6d50('0x1f')][_0x15e8e6[_0x6d50('0x18c')]()];if(!this[_0x6d50('0x18d')](_0x5a5f6a[_0x6d50('0x18e')])){this[_0x6d50('0xb0')](_0x1a81ec);return this[_0x6d50('0x18f')](_0x15e8e6,_0x1a81ec,_0x5a5f6a)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x190')));}this[_0x6d50('0x25')][_0x5a5f6a[_0x6d50('0xd6')]]=_0x15e8e6;}};Dialer[_0x6d50('0x19')][_0x6d50('0x191')]=function(_0x4834be,_0x4d9e0b,_0x1ea143){var _0x2ba280=new History(_0x4d9e0b);if(_0x2ba280[_0x6d50('0xf5')]+_0x2ba280['countcongestionretry']+_0x2ba280[_0x6d50('0x192')]+_0x2ba280[_0x6d50('0xec')]+_0x2ba280[_0x6d50('0xf6')]+_0x2ba280[_0x6d50('0xf7')]+_0x2ba280[_0x6d50('0xe7')]+_0x2ba280['countagentrejectretry']>=_0x1ea143[_0x6d50('0xf9')]-0x1){return!![];}switch(_0x4834be){case 0x3:if(_0x2ba280[_0x6d50('0x192')]>=_0x1ea143['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countnoanswerretry':_0x2ba280[_0x6d50('0x192')]+=0x1,'scheduledat':moment()['add'](_0x1ea143['dialNoAnswerRetryFrequency'],_0x6d50('0xfb'))[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280['ListId'],'VoiceQueueId':_0x2ba280[_0x6d50('0xcd')]||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2ba280[_0x6d50('0xf5')]>=_0x1ea143['dialBusyMaxRetry']-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countbusyretry':_0x2ba280[_0x6d50('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x1ea143[_0x6d50('0x193')],_0x6d50('0xfb'))[_0x6d50('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280['ListId'],'VoiceQueueId':_0x2ba280['VoiceQueueId']||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2ba280[_0x6d50('0xeb')]>=_0x1ea143[_0x6d50('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2ba280['countcongestionretry']+=0x1,'scheduledat':moment()[_0x6d50('0xf1')](_0x1ea143[_0x6d50('0x195')],'minutes')['format'](_0x6d50('0xfc')),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280[_0x6d50('0x113')],'VoiceQueueId':_0x2ba280['VoiceQueueId']||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})['catch'](loggerCatch(_0x6d50('0x196')));break;case 0x0:if(_0x2ba280[_0x6d50('0xec')]>=_0x1ea143[_0x6d50('0x197')]-0x1){return!![];}else{this[_0x6d50('0xbb')]({'active':![],'countnosuchnumberretry':_0x2ba280['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x6d50('0xf1')](_0x1ea143[_0x6d50('0x198')],_0x6d50('0xfb'))[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280[_0x6d50('0x113')],'VoiceQueueId':_0x2ba280[_0x6d50('0xcd')]||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0x199')));}break;case 0xa:if(_0x2ba280[_0x6d50('0xf6')]>=_0x1ea143[_0x6d50('0x19a')]-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countdropretry':_0x2ba280[_0x6d50('0xf6')]+=0x1,'scheduledat':moment()[_0x6d50('0xf1')](_0x1ea143['dialDropRetryFrequency'],_0x6d50('0xfb'))['format'](_0x6d50('0xfc')),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280['ListId'],'VoiceQueueId':_0x2ba280[_0x6d50('0xcd')]||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2ba280[_0x6d50('0xf7')]>=_0x1ea143[_0x6d50('0x19b')]-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countabandonedretry':_0x2ba280['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x1ea143[_0x6d50('0x11b')],_0x6d50('0xfb'))[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x2ba280['ContactId'],'ListId':_0x2ba280[_0x6d50('0x113')],'VoiceQueueId':_0x2ba280['VoiceQueueId']||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2ba280[_0x6d50('0xe7')]>=_0x1ea143[_0x6d50('0xfa')]-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countmachineretry':_0x2ba280[_0x6d50('0xe7')]+=0x1,'scheduledat':moment()[_0x6d50('0xf1')](_0x1ea143[_0x6d50('0xf2')],'minutes')[_0x6d50('0x74')](_0x6d50('0xfc')),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280[_0x6d50('0x113')],'VoiceQueueId':_0x2ba280[_0x6d50('0xcd')]||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2ba280[_0x6d50('0xf8')]>=_0x1ea143[_0x6d50('0x19c')]-0x1){return!![];}this[_0x6d50('0xbb')]({'active':![],'countagentrejectretry':_0x2ba280[_0x6d50('0xf8')]+=0x1,'scheduledat':moment()[_0x6d50('0xf1')](_0x1ea143[_0x6d50('0x19d')],_0x6d50('0xfb'))[_0x6d50('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ba280[_0x6d50('0xcc')],'ListId':_0x2ba280[_0x6d50('0x113')],'VoiceQueueId':_0x2ba280[_0x6d50('0xcd')]||undefined,'CampaignId':_0x2ba280[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x6d50('0x18f')]=function(_0x39f373,_0x120f81,_0x3243cd){var _0x370bb1=this;var _0x108cb9=new History(_0x39f373);return new BPromise(function(_0x51a66f,_0x382914){if(_['isUndefined'](_0x120f81)&&typeof _0x120f81!=='object'){return _0x382914(msgResponse('[callProgressDetecting]',_0x6d50('0x13c'),_0x6d50('0x19e')));}if(_[_0x6d50('0x3a')](_0x3243cd)&&typeof _0x3243cd!=='object'){return _0x382914(msgResponse(_0x6d50('0x19f'),_0x6d50('0x13c'),_0x6d50('0x1a0')));}switch(_0x3243cd[_0x6d50('0x105')]){case'0':_0x120f81[_0x6d50('0x61')]+=0x1;_0x108cb9[_0x6d50('0xa2')]=0x0;_0x108cb9['statedesc']=_0x6d50('0x1a1');_0x108cb9[_0x6d50('0xec')]+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;ami[_0x6d50('0x49')](_0x6d50('0x1a2'),ut[_0x6d50('0x1a3')](_0x39f373,_0x6d50('0x1a4')));_0x370bb1[_0x6d50('0xc4')](_0x108cb9)[_0x6d50('0xab')](loggerCatch(_0x6d50('0xea')));if(_0x370bb1[_0x6d50('0x191')](0x0,_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0xec')]>=_0x120f81[_0x6d50('0x197')]){_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1a5'));}else{_0x370bb1[_0x6d50('0xed')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1a5'));}}break;case'3':_0x120f81[_0x6d50('0x60')]+=0x1;_0x108cb9['state']=0x3;_0x108cb9[_0x6d50('0xa3')]='NoAnswer';_0x108cb9[_0x6d50('0x192')]+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;ami[_0x6d50('0x49')](_0x6d50('0x1a6'),ut[_0x6d50('0x1a3')](_0x39f373,_0x6d50('0x1a7')));_0x370bb1[_0x6d50('0xc4')](_0x108cb9)['catch'](loggerCatch(_0x6d50('0x1a8')));if(_0x370bb1[_0x6d50('0x191')](0x3,_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0x192')]>=_0x120f81[_0x6d50('0x1a9')]){_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1aa'));}else{_0x370bb1['stateGlobal'](_0x108cb9,_0x51a66f,_0x382914,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x120f81[_0x6d50('0x5b')]+=0x1;_0x108cb9[_0x6d50('0xa2')]=0x5;_0x108cb9[_0x6d50('0xa3')]=_0x6d50('0x1ab');_0x108cb9[_0x6d50('0xf5')]+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x6d50('0x1a3')](_0x39f373,_0x6d50('0x1ac')));_0x370bb1[_0x6d50('0xc4')](_0x108cb9)['catch'](loggerCatch(_0x6d50('0x1ad')));if(_0x370bb1[_0x6d50('0x191')](0x5,_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0xf5')]>=_0x120f81[_0x6d50('0x1ae')]){_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,'reason\x205\x20busy');}else{_0x370bb1['stateGlobal'](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1af'));}}break;case'8':_0x120f81[_0x6d50('0x5c')]+=0x1;_0x108cb9[_0x6d50('0xa2')]=0x8;_0x108cb9['statedesc']=_0x6d50('0x1b0');_0x108cb9[_0x6d50('0xeb')]+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;ami[_0x6d50('0x49')](_0x6d50('0x1b1'),ut['buildObj'](_0x39f373,'congestion'));_0x370bb1[_0x6d50('0xc4')](_0x108cb9)['catch'](loggerCatch(_0x6d50('0x1b2')));if(_0x370bb1['checkRetriveMax'](0x8,_0x39f373,_0x120f81)){if(_0x108cb9['countcongestionretry']>=_0x120f81[_0x6d50('0x194')]){_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1b3'));}else{_0x370bb1[_0x6d50('0xed')](_0x108cb9,_0x51a66f,_0x382914,'reason\x208\x20congestion');}}break;case'11':_0x120f81[_0x6d50('0x1b4')]+=0x1;_0x108cb9[_0x6d50('0xa2')]=0xb;_0x108cb9[_0x6d50('0xa3')]=_0x6d50('0x119');_0x108cb9[_0x6d50('0xf7')]+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;_0x370bb1[_0x6d50('0xc4')](_0x108cb9)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x370bb1[_0x6d50('0x191')](0xb,_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0xf7')]>=_0x120f81['dialAbandonedMaxRetry']){_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1b5'));}else{_0x370bb1[_0x6d50('0xed')](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1b5'));}}break;case'20':_0x120f81[_0x6d50('0x63')]+=0x1;_0x108cb9[_0x6d50('0xa2')]=0x14;_0x108cb9['statedesc']=_0x6d50('0x1b6');_0x108cb9['countagentrejectretry']+=0x1;_0x108cb9[_0x6d50('0xe8')]+=0x1;ami[_0x6d50('0x49')](_0x6d50('0x1b7'),ut[_0x6d50('0x1a3')](_0x39f373,'agentreject'));_0x370bb1[_0x6d50('0xc4')](_0x108cb9)[_0x6d50('0xab')](loggerCatch(_0x6d50('0x1b8')));if(_0x370bb1[_0x6d50('0x191')](0x14,_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0xf8')]>=_0x120f81[_0x6d50('0x19c')]){_0x370bb1['createStateFinal'](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1b9'));}else{_0x370bb1['stateGlobal'](_0x108cb9,_0x51a66f,_0x382914,_0x6d50('0x1b9'));}}break;default:_0x120f81[_0x6d50('0x1ba')]+=0x1;_0x108cb9['state']=0xc;_0x108cb9['statedesc']=_0x3243cd[_0x6d50('0x105')];_0x370bb1[_0x6d50('0xc4')](_0x108cb9)[_0x6d50('0xab')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x370bb1['checkRetriveMax'](_0x3243cd[_0x6d50('0x105')],_0x39f373,_0x120f81)){if(_0x108cb9[_0x6d50('0xf5')]+_0x108cb9[_0x6d50('0xeb')]+_0x108cb9['countnoanswerretry']+_0x108cb9[_0x6d50('0xec')]+_0x108cb9[_0x6d50('0xf6')]+_0x108cb9[_0x6d50('0xf7')]+_0x108cb9[_0x6d50('0xe7')]+_0x108cb9[_0x6d50('0xf8')]>=_0x120f81['dialGlobalMaxRetry']){_0x370bb1[_0x6d50('0xed')](_0x108cb9,_0x51a66f,_0x382914,_0x3243cd[_0x6d50('0x105')]);}else{_0x370bb1[_0x6d50('0xef')](_0x108cb9,_0x51a66f,_0x382914,_0x3243cd[_0x6d50('0x105')]);}}}});};Dialer[_0x6d50('0x19')]['stateGlobal']=function(_0x1e6127,_0x3d6fdc,_0x1b1231,_0x52d45c){var _0x476040=new Final(_0x1e6127);_0x476040['state']=0xf;_0x476040['statedesc']=_0x6d50('0x1bb');this[_0x6d50('0xef')](_0x476040,_0x3d6fdc,_0x1b1231,_0x52d45c);};Dialer[_0x6d50('0x19')][_0x6d50('0xef')]=function(_0x1dc9db,_0x2f5532,_0x563ea0,_0x4df5a6){this[_0x6d50('0xd4')](_0x1dc9db)[_0x6d50('0xb3')](function(){return _0x2f5532(msgResponse(_0x6d50('0x19f'),_0x6d50('0xd0'),_0x4df5a6));})[_0x6d50('0xab')](function(){return _0x563ea0(msgResponse(_0x6d50('0x1bc'),_0x6d50('0x13c'),_0x6d50('0x1bd')));});};Dialer['prototype'][_0x6d50('0x9')]=function(_0x34a1e1){var _0x3a9fb6=_0x34a1e1[_0x6d50('0x1be')]/0x64;var _0x32195e=_0x34a1e1[_0x6d50('0x5f')]/(_0x34a1e1[_0x6d50('0x5f')]+_0x34a1e1[_0x6d50('0xde')]);var _0x3d6f44=Math['round'](_0x34a1e1[_0x6d50('0x6b')]*(_0x34a1e1[_0x6d50('0x1bf')]/0x64));var _0x1289f9=Math['round'](_0x34a1e1[_0x6d50('0x6b')]*(_0x34a1e1[_0x6d50('0x1c0')]/0x64));var _0x1b33d5=_0x34a1e1[_0x6d50('0x4d')]+_0x34a1e1[_0x6d50('0x9d')];var _0x1ea8cb=Math[_0x6d50('0x1c1')](_0x34a1e1[_0x6d50('0x6e')]*_0x34a1e1[_0x6d50('0x86')]*_0x34a1e1[_0x6d50('0x68')]*_0x34a1e1[_0x6d50('0x69')]);if(_[_0x6d50('0x3a')](_0x34a1e1[_0x6d50('0x27')])){if(!_[_0x6d50('0x3a')](_0x34a1e1[_0x6d50('0x26')])){_0x34a1e1[_0x6d50('0x26')]=undefined;loggerPredictive['error'](_0x6d50('0x1c2'),_0x6d50('0x1c3'));}if(!_[_0x6d50('0x3a')](_0x34a1e1['handlePredictive'])){loggerPredictive[_0x6d50('0x92')](_0x6d50('0x1c2'),_0x6d50('0x1c4'));clearInterval(_0x34a1e1['handlePredictive']);_0x34a1e1[_0x6d50('0x8c')]=undefined;}_0x34a1e1['startProgressive']=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));loggerPredictive['info'](_0x34a1e1[_0x6d50('0x3e')],_0x6d50('0x1c5'),_0x34a1e1['startProgressive']);this[_0x6d50('0x152')](_0x34a1e1,0x1);}else if(ifInterval(_0x34a1e1[_0x6d50('0x1c6')],_0x34a1e1['startProgressive'])){this['handlePower'](_0x34a1e1,0x1);loggerPredictiveCalls['info'](_0x6d50('0x1c7'),_0x34a1e1[_0x6d50('0x27')],_0x34a1e1['name']);_0x34a1e1[_0x6d50('0x6e')]=0x0;_0x34a1e1['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3a9fb6<_0x32195e&&_0x34a1e1['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x34a1e1);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6d50('0x1c8'),_0x32195e,_0x6d50('0x27'),_0x34a1e1[_0x6d50('0x3e')]);}else if(_0x1ea8cb<_0x34a1e1['predictiveIntervalErlangCallsDroppedCalls']&&_0x34a1e1[_0x6d50('0x1c9')]===_0x6d50('0x1ca')){freeVariablesPredictive(_0x34a1e1);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x1cb'),_0x6d50('0x1cc'),_0x1ea8cb,_0x6d50('0x1cd'),_0x34a1e1[_0x6d50('0x10f')],_0x6d50('0x27'),_0x34a1e1['name']);}else if(!ifInterval(_0x34a1e1[_0x6d50('0x1c6')],_0x34a1e1[_0x6d50('0x27')])&&_[_0x6d50('0x3a')](_0x34a1e1[_0x6d50('0x26')])&&!_[_0x6d50('0x3a')](_0x34a1e1[_0x6d50('0x27')])){_0x34a1e1['startPredictive']=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));loggerPredictive[_0x6d50('0x79')](_0x34a1e1[_0x6d50('0x3e')],'started\x20in\x20predictive\x20at',_0x34a1e1[_0x6d50('0x26')]);this[_0x6d50('0x1ce')](_0x34a1e1[_0x6d50('0x1c6')])[_0x6d50('0xb3')](this[_0x6d50('0x1cf')](_0x34a1e1))[_0x6d50('0xb3')](mergeDataErlangB(_0x34a1e1))['then'](this[_0x6d50('0x1d0')](_0x34a1e1))[_0x6d50('0xab')](loggerCatchPredictive(_0x6d50('0x1d1'),_0x34a1e1));}else if(!ifInterval(_0x34a1e1['dialPredictiveInterval'],_0x34a1e1[_0x6d50('0x26')])){_0x34a1e1[_0x6d50('0x10f')]=0x0;_0x34a1e1[_0x6d50('0x26')]=moment()[_0x6d50('0x74')](_0x6d50('0xfc'));loggerPredictive[_0x6d50('0x79')](_0x34a1e1[_0x6d50('0x3e')],_0x6d50('0x1d2'),_0x34a1e1[_0x6d50('0x26')]);clearInterval(_0x34a1e1[_0x6d50('0x8c')]);_0x34a1e1['handlePredictive']=undefined;this[_0x6d50('0x1ce')](_0x34a1e1[_0x6d50('0x1c6')])[_0x6d50('0xb3')](this[_0x6d50('0x1cf')](_0x34a1e1))[_0x6d50('0xb3')](mergeDataErlangB(_0x34a1e1))[_0x6d50('0xb3')](this[_0x6d50('0x1d0')](_0x34a1e1))[_0x6d50('0xab')](loggerCatchPredictive(_0x6d50('0x1d3'),_0x34a1e1));}else if(_0x34a1e1[_0x6d50('0x6b')]&&_0x1b33d5<_0x34a1e1['predictiveIntervalAvailable']-_0x1289f9){freeVariablesPredictive(_0x34a1e1);loggerPredictive[_0x6d50('0x79')](_0x34a1e1[_0x6d50('0x3e')],_0x6d50('0x1d4'),_0x1b33d5,_0x6d50('0x1d5'),_0x34a1e1['predictiveIntervalAvailable'],'-',_0x1289f9,'=',_0x34a1e1[_0x6d50('0x6b')]-_0x1289f9,')');}else if(_0x34a1e1[_0x6d50('0x6b')]&&_0x1b33d5>_0x34a1e1['predictiveIntervalAvailable']+_0x3d6f44){freeVariablesPredictive(_0x34a1e1);loggerPredictive['info'](_0x34a1e1[_0x6d50('0x3e')],_0x6d50('0x1d4'),_0x1b33d5,_0x6d50('0x1d6'),_0x34a1e1[_0x6d50('0x6b')],'+',_0x3d6f44,'=',_0x34a1e1[_0x6d50('0x6b')]+_0x3d6f44,')');}};Dialer[_0x6d50('0x19')][_0x6d50('0x1cf')]=function(_0x19f998){var _0x39685c=this;return function(_0x51f845){return new BPromise(function(_0x508419,_0x760193){_[_0x6d50('0x88')](_0x19f998,_0x51f845[0x0]);if(checkGetDataPredictive(_0x51f845[0x0])){var _0xf6199c=_0x19f998[_0x6d50('0x6b')]=_0x19f998[_0x6d50('0x9d')]+_0x19f998['available'];var _0x22eb4e=_0x19f998['dialPredictiveInterval']*0x3c;var _0x3ae585=_0x51f845[0x0][_0x6d50('0x66')]+_0x51f845[0x0][_0x6d50('0x65')];var _0x5cd72d=(_0x51f845[0x0][_0x6d50('0x64')]+_0x51f845[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x51f845[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x51f845[0x0]['predictiveIntervalTotalCalls'];_0x19f998['predictiveIntervalHitRate']=_0x5cd72d>0x0?_0x5cd72d:0x1;switch(_0x19f998[_0x6d50('0x1c9')]){case'dropRate':var _0x50cafd=_0x19f998['dialPredictiveOptimizationPercentage']/0x64;return _0x39685c[_0x6d50('0x1d7')](_0xf6199c,_0x22eb4e,_0x3ae585,_0x5cd72d,_0x50cafd)[_0x6d50('0xb3')](function(_0x3d9a39){return _0x508419(_0x3d9a39);});case _0x6d50('0x1d8'):var _0x974ca0=_0x19f998[_0x6d50('0x1be')]/0x64;return _0x39685c['busyFactor'](_0xf6199c,_0x22eb4e,_0x3ae585,_0x5cd72d,_0x974ca0)[_0x6d50('0xb3')](function(_0xb99341){return _0x508419(_0xb99341);});default:return _0x760193(msgResponse(_0x6d50('0x1d9'),_0x6d50('0x13c'),_0x6d50('0x1da')));}}else{return _0x760193(msgResponse(_0x6d50('0x1d9'),_0x6d50('0x13c'),_0x6d50('0x1db')));}});};};Dialer[_0x6d50('0x19')][_0x6d50('0x1dc')]=function(_0x242e15){var _0x3da12d=this;return function(_0x35b74e){return new BPromise(function(_0x19c316,_0x5d2c59){_[_0x6d50('0x88')](_0x242e15,_0x35b74e[0x0]);if(checkGetDataPredictive(_0x35b74e[0x0])){loggerPredictive[_0x6d50('0x79')](JSON[_0x6d50('0x46')](_0x35b74e[0x0]));if(_0x242e15[_0x6d50('0x1c9')]===_0x6d50('0x1ca')){return _0x3da12d[_0x6d50('0xc2')](_0x242e15['id'])['then'](function(_0x240c09){var _0x7a56=_0x242e15['loggedIn']-_0x240c09[0x0][_0x6d50('0x1dd')];var _0x512363=_0x242e15[_0x6d50('0x1c6')]*0x3c;var _0x3f8884=_0x35b74e[0x0]['predictiveIntervalAvgTalktime']+_0x35b74e[0x0][_0x6d50('0x65')];var _0x3b9a9d=(_0x35b74e[0x0]['predictiveIntervalAnsweredCalls']+_0x35b74e[0x0][_0x6d50('0x10e')]+_0x35b74e[0x0][_0x6d50('0x67')])/_0x35b74e[0x0][_0x6d50('0x6c')];var _0x39245f=_0x242e15[_0x6d50('0x1be')]/0x64;_0x242e15[_0x6d50('0x6a')]=_0x240c09[0x0][_0x6d50('0x1dd')]||0x0;_0x242e15['predictiveIntervalHitRate']=_0x3b9a9d>0x0?_0x3b9a9d:0x1;return _0x3da12d[_0x6d50('0x1d7')](_0x7a56,_0x512363,_0x3f8884,_0x3b9a9d,_0x39245f);})[_0x6d50('0xb3')](function(_0x70ac46){return _0x19c316(_0x70ac46);})[_0x6d50('0xab')](function(_0x4ebafb){return _0x5d2c59(msgResponse(_0x6d50('0x1de'),'Failure',JSON[_0x6d50('0x46')](_0x4ebafb)));});}if(_0x242e15['dialPredictiveOptimization']==='agentBusyFactor'){return _0x3da12d[_0x6d50('0xc2')](_0x242e15['id'])['then'](function(_0x5a9c8b){var _0x25b59b=_0x242e15['loggedIn']-_0x5a9c8b[0x0][_0x6d50('0x1dd')];var _0x468508=_0x242e15['dialPredictiveInterval']*0x3c;var _0x134315=_0x35b74e[0x0]['predictiveIntervalAvgTalktime']+_0x35b74e[0x0][_0x6d50('0x65')];var _0x3d7581=(_0x35b74e[0x0][_0x6d50('0x64')]+_0x35b74e[0x0][_0x6d50('0x10e')]+_0x35b74e[0x0][_0x6d50('0x67')])/_0x35b74e[0x0][_0x6d50('0x6c')];var _0x2d60f1=_0x242e15[_0x6d50('0x1be')]/0x64;_0x242e15[_0x6d50('0x6a')]=_0x5a9c8b[0x0][_0x6d50('0x1dd')]||0x0;_0x242e15['predictiveIntervalHitRate']=_0x3d7581>0x0?_0x3d7581:0x1;return _0x3da12d[_0x6d50('0x1df')](_0x25b59b,_0x468508,_0x134315,_0x3d7581,_0x2d60f1);})[_0x6d50('0xb3')](function(_0x5f6a5){return _0x19c316(_0x5f6a5);})['catch'](function(_0x21a0e4){return _0x5d2c59(msgResponse('[CatchErlangB]',_0x6d50('0x13c'),JSON[_0x6d50('0x46')](_0x21a0e4)));});}}else{return _0x5d2c59(msgResponse(_0x6d50('0x1d9'),_0x6d50('0x13c'),'check\x20failure'));}});};};Dialer[_0x6d50('0x19')][_0x6d50('0x1d0')]=function(_0x33e3db){var _0x53ef1a=this;return function(){var _0x5bedee=0x0;var _0x429433=Math[_0x6d50('0x1c1')](_0x33e3db['erlangCallToSecond']*0x3e8);if(_0x429433>0x0){_0x429433=_0x429433<0x64?0x64:_0x429433;loggerPredictive['info'](_0x33e3db[_0x6d50('0x3e')],_0x6d50('0x1e0'),_0x429433,_0x6d50('0x47'));_0x33e3db[_0x6d50('0x8c')]=setInterval(function(){_0x53ef1a['handlePredictive'](_0x33e3db);loggerPredictiveCalls[_0x6d50('0x79')](_0x6d50('0x1e1'),_0x5bedee+=0x1);},_0x429433);}else{loggerPredictive['info'](_0x33e3db['name'],_0x6d50('0x1e2'));}};};Dialer[_0x6d50('0x19')]['checkContactBlack']=function(_0x2011ef,_0x22afe0){var _0x1dc308=this;return function(_0xd14a5e){if(_[_0x6d50('0x41')](_0xd14a5e)){if(_[_0x6d50('0xa8')](_0x22afe0[_0x6d50('0x1e3')])||!_0x22afe0[_0x6d50('0x1e4')]){if(_0x2011ef[_0x6d50('0x151')]===_0x6d50('0x154')){_0x2011ef['queueStatusComplete']=_[_0x6d50('0x3a')](_0x2011ef[_0x6d50('0x125')])?!![]:_0x2011ef[_0x6d50('0x125')];var _0x21e254=uuid['v4']();_0x1dc308[_0x6d50('0xa6')][_0x21e254]=new Action(_0x2011ef,_0x22afe0,_0x21e254);loggerBooked[_0x6d50('0x79')]('[booked][checkContactBlack]',_0x21e254,_0x6d50('0x1e5'),JSON[_0x6d50('0x46')](_0x2011ef[_0x6d50('0x125')]),'Queue:\x20',_0x2011ef['name']);if(_0x2011ef[_0x6d50('0x125')]){_0x2011ef['queueStatusComplete']=![];_0x1dc308[_0x6d50('0x121')][_0x1dc308[_0x6d50('0xa6')][_0x21e254][_0x6d50('0xad')]]=[];ami[_0x6d50('0x143')]({'actionid':_0x21e254,'action':_0x6d50('0x1e6'),'queue':_0x2011ef['name']})['catch'](function(){_0x1dc308[_0x6d50('0xb0')](_0x2011ef);_0x1dc308[_0x6d50('0xbb')]({'active':![],'ContactId':_0x1dc308[_0x6d50('0xa6')][_0x21e254]['ContactId'],'ListId':_0x1dc308['actions'][_0x21e254][_0x6d50('0x113')],'VoiceQueueId':_0x1dc308[_0x6d50('0xa6')][_0x21e254][_0x6d50('0xcd')]||undefined,'CampaignId':_0x1dc308['actions'][_0x21e254][_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0x1e7')));delete _0x1dc308[_0x6d50('0xa6')][_0x21e254];});}else{loggerBooked[_0x6d50('0x79')](_0x6d50('0x1e8'),JSON[_0x6d50('0x46')](_0x2011ef[_0x6d50('0x125')]),'Queue:\x20',_0x2011ef[_0x6d50('0x3e')]);_0x1dc308['updateOriginated'](_0x2011ef);_0x1dc308[_0x6d50('0xbb')]({'active':![],'ContactId':_0x1dc308[_0x6d50('0xa6')][_0x21e254][_0x6d50('0xcc')],'ListId':_0x1dc308[_0x6d50('0xa6')][_0x21e254][_0x6d50('0x113')],'VoiceQueueId':_0x1dc308[_0x6d50('0xa6')][_0x21e254][_0x6d50('0xcd')]||undefined,'CampaignId':_0x1dc308['actions'][_0x21e254][_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0x1e7')));delete _0x1dc308['actions'][_0x21e254];}}else{return _0x1dc308[_0x6d50('0x1e9')](_0x2011ef,_0x22afe0);}}else{if(getDiff(_0x22afe0[_0x6d50('0x1ea')])<_0x2011ef[_0x6d50('0x1eb')]*0x3c){if(_0x22afe0['Agent']&&!_0x22afe0[_0x6d50('0x1ec')][_0x6d50('0x1ed')]){_0x1dc308['preview'][_0x6d50('0x127')](_0x22afe0['id'])[_0x6d50('0x1c')](function(){_0x1dc308[_0x6d50('0xb0')](_0x2011ef);});}else{_0x1dc308[_0x6d50('0xbd')]({'active':![]},_0x22afe0['id'],0x1)[_0x6d50('0x1c')](function(){_0x1dc308['updateOriginated'](_0x2011ef);});}}else{_0x2011ef[_0x6d50('0x1ee')]+=0x1;_0x1dc308['updateOriginated'](_0x2011ef);if(_0x2011ef[_0x6d50('0x1ef')]){_0x1dc308['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x22afe0[_0x6d50('0xcc')],'ListId':_0x22afe0['ListId'],'VoiceQueueId':_0x22afe0[_0x6d50('0xcd')]||undefined,'CampaignId':_0x22afe0[_0x6d50('0xce')]||undefined})[_0x6d50('0xab')](loggerCatch(_0x6d50('0x1f0')));_0x1dc308[_0x6d50('0xc4')](createObjHistory(_0x2011ef,_0x22afe0,_0x6d50('0x1f1'),0x17,'RecallInQueue'))[_0x6d50('0xab')](loggerCatch(_0x6d50('0x1f2')));}else{_0x1dc308[_0x6d50('0xca')](createObjHistory(_0x2011ef,_0x22afe0,_0x6d50('0x1f3'),0x16,_0x6d50('0x1f4')),_0x6d50('0x1f5'),_0x6d50('0x1f6'));}}}}else{_0x2011ef[_0x6d50('0x5a')]+=0x1;_0x1dc308[_0x6d50('0xca')](createObjHistory(_0x2011ef,_0x22afe0,_0x6d50('0x1f7'),0xd,_0x6d50('0x1f8')),_0x6d50('0x1f9'),_0x6d50('0x1fa'));throw _0x6d50('0x1fb');}};};Dialer[_0x6d50('0x19')][_0x6d50('0x156')]=function(_0x2420ce){var _0x10d5ad=this;var _0x26da75=_0x2420ce[_0x6d50('0x1fc')]-_0x2420ce['originated']-_0x2420ce[_0x6d50('0x1fd')];emitCampaignSummary(_0x2420ce);if(_0x26da75>0x0){if(_0x26da75>this[_0x6d50('0x23')]){_0x26da75=this['maxNumberOriginate'];}_0x2420ce[_0x6d50('0x1fd')]+=_0x26da75;this[_0x6d50('0xc1')](_0x2420ce['id'],_0x26da75,_0x2420ce[_0x6d50('0x1fe')])[_0x6d50('0xb3')](function(_0x1e4432){_0x2420ce[_0x6d50('0x1fd')]-=_0x26da75;_0x2420ce['temp']=_0x2420ce['temp']>0x0?_0x2420ce['temp']:0x0;if(!checkContactEmpty(_0x1e4432)){_0x2420ce[_0x6d50('0x3b')]=_0x6d50('0x9a');logger['info'](_0x6d50('0x1ff')+_0x2420ce[_0x6d50('0x3e')]);}else{_0x2420ce['originated']+=_0x1e4432['length'];_0x2420ce[_0x6d50('0x3b')]=_0x6d50('0x200');for(var _0x136a83=0x0;_0x136a83<_0x1e4432[_0x6d50('0x94')];_0x136a83+=0x1){_0x2420ce[_0x6d50('0x201')]+=0x1;if(_[_0x6d50('0xa8')](_0x1e4432[_0x136a83])||_[_0x6d50('0xa8')](_0x1e4432[_0x136a83][_0x6d50('0x163')])||_[_0x6d50('0xa8')](_0x1e4432[_0x136a83][_0x6d50('0x163')][_0x6d50('0x164')])){_0x10d5ad['emptyContact']('[actionOriginate]\x20',_0x2420ce,_0x1e4432[_0x136a83]);}else{_0x10d5ad[_0x6d50('0xb7')](_[_0x6d50('0xcb')](_0x1e4432[_0x136a83],['CampaignId','Contact.phone']))[_0x6d50('0xb3')](_0x10d5ad['checkContactBlack'](_0x2420ce,_0x1e4432[_0x136a83]))[_0x6d50('0xab')](_0x10d5ad[_0x6d50('0xc7')](_0x6d50('0x202'),_0x2420ce));}}}})[_0x6d50('0xab')](loggerGetContactDialer(_0x6d50('0x203'),_0x2420ce,_0x26da75));}};Dialer[_0x6d50('0x19')][_0x6d50('0x152')]=function(_0x2c43ba,_0x17cbd2){var _0x366fb9=this;var _0x33f20a=[];var _0x2c59a0=_0x17cbd2>=0x1?_0x17cbd2:0x1;if(_0x2c43ba[_0x6d50('0x151')]===_0x6d50('0x154')){_0x2c59a0=0x1;}var _0x4fb84b=Math[_0x6d50('0x1c1')](_0x2c43ba[_0x6d50('0x4d')]*_0x2c59a0)-_0x2c43ba[_0x6d50('0x6d')]-_0x2c43ba[_0x6d50('0x1fd')];emitVoiceQueueSummary(_0x2c43ba);if(_0x2c43ba[_0x6d50('0x204')]>0x0){var _0xff8142=_0x2c43ba[_0x6d50('0x204')]-_0x2c43ba[_0x6d50('0x6d')]-_0x2c43ba[_0x6d50('0x9d')]-_0x2c43ba['temp']-_0x2c43ba[_0x6d50('0x4e')];if(_0x4fb84b>_0xff8142){_0x4fb84b=_0xff8142;}}if(_0x4fb84b>0x0){if(_0x2c43ba[_0x6d50('0x151')]===_0x6d50('0x154')){_0x4fb84b=0x1;}if(_0x4fb84b>this[_0x6d50('0x23')]){_0x4fb84b=this[_0x6d50('0x23')];}_0x2c43ba[_0x6d50('0x1fd')]+=_0x4fb84b;for(var _0x5e0783 in this[_0x6d50('0x21')]){if(typeof this[_0x6d50('0x21')][_0x5e0783]!==_0x6d50('0x95')){if(this[_0x6d50('0x21')][_0x5e0783][_0x6d50('0xa2')]==='not_inuse'&&this['agents'][_0x5e0783][_0x6d50('0xa9')]===_0x6d50('0xd2')){_0x33f20a[_0x6d50('0x122')](this[_0x6d50('0x21')][_0x5e0783]['id']);}}}this[_0x6d50('0xbf')](_0x2c43ba['id'],_0x33f20a,_0x4fb84b,_0x2c43ba[_0x6d50('0x1fe')])[_0x6d50('0xb3')](function(_0x7e7ed0){_0x2c43ba[_0x6d50('0x1fd')]-=_0x4fb84b;_0x2c43ba[_0x6d50('0x1fd')]=_0x2c43ba['temp']>0x0?_0x2c43ba[_0x6d50('0x1fd')]:0x0;if(!checkContactEmpty(_0x7e7ed0)){_0x366fb9[_0x6d50('0x205')](_0x2c43ba)['then'](sendMessageReschedule(_0x2c43ba))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xb4')));}else{_0x2c43ba[_0x6d50('0x6d')]+=_0x7e7ed0[_0x6d50('0x94')];_0x2c43ba[_0x6d50('0x3b')]=_0x2c43ba[_0x6d50('0x151')]===_0x6d50('0x154')?_0x6d50('0x16c'):'RUNNING';for(var _0x1f4267=0x0;_0x1f4267<_0x7e7ed0[_0x6d50('0x94')];_0x1f4267+=0x1){if(_[_0x6d50('0xa8')](_0x7e7ed0[_0x1f4267])||_[_0x6d50('0xa8')](_0x7e7ed0[_0x1f4267][_0x6d50('0x163')])||_[_0x6d50('0xa8')](_0x7e7ed0[_0x1f4267][_0x6d50('0x163')]['phone'])){_0x366fb9[_0x6d50('0xc8')](_0x6d50('0x206'),_0x2c43ba,_0x7e7ed0[_0x1f4267]);}else{_0x366fb9['checkIsBlackList'](_[_0x6d50('0xcb')](_0x7e7ed0[_0x1f4267],[_0x6d50('0xcd'),_0x6d50('0x207')]))[_0x6d50('0xb3')](_0x366fb9['checkContactBlack'](_0x2c43ba,_0x7e7ed0[_0x1f4267]))[_0x6d50('0xab')](_0x366fb9[_0x6d50('0xc7')](_0x6d50('0x206'),_0x2c43ba));}}}})[_0x6d50('0xab')](loggerGetContactDialer(_0x6d50('0x208'),_0x2c43ba,_0x4fb84b));}};Dialer[_0x6d50('0x19')][_0x6d50('0x8c')]=function(_0x1642a9){if(_0x1642a9[_0x6d50('0x204')]>0x0){var _0x3620d1=_0x1642a9[_0x6d50('0x204')]-_0x1642a9[_0x6d50('0x6d')]-_0x1642a9[_0x6d50('0x9d')];if(_0x3620d1>0x0){this[_0x6d50('0x209')](_0x1642a9);}else{loggerPredictiveCalls[_0x6d50('0x79')](_0x6d50('0x20a'));}}else{this['tryOriginatePredictive'](_0x1642a9);}};Dialer['prototype'][_0x6d50('0x209')]=function(_0x428ffe){var _0x383599=this;var _0x47c5c7=[];_0x428ffe[_0x6d50('0x6d')]+=0x1;for(var _0x3ff221 in this[_0x6d50('0x21')]){if(typeof this['agents'][_0x3ff221]!=='undefined'){if(this[_0x6d50('0x21')][_0x3ff221]['state']===_0x6d50('0x20b')&&this[_0x6d50('0x21')][_0x3ff221][_0x6d50('0xa9')]==='reachable'){_0x47c5c7['push'](this[_0x6d50('0x21')][_0x3ff221]['id']);}}}this[_0x6d50('0xbf')](_0x428ffe['id'],_0x47c5c7,0x1,_0x428ffe[_0x6d50('0x1fe')])[_0x6d50('0xb3')](function(_0x4c5880){if(!checkContactEmpty(_0x4c5880)){checkContactLowerLimitOriginate(_0x428ffe,0x1,0x0);_0x383599[_0x6d50('0x205')](_0x428ffe)[_0x6d50('0xb3')](sendMessageReschedule(_0x428ffe))[_0x6d50('0xab')](loggerCatch(_0x6d50('0xb4')));}else{_0x428ffe[_0x6d50('0x3b')]=_0x6d50('0x200');if(_[_0x6d50('0xa8')](_0x4c5880[0x0])||_['isNil'](_0x4c5880[0x0][_0x6d50('0x163')])||_[_0x6d50('0xa8')](_0x4c5880[0x0][_0x6d50('0x163')][_0x6d50('0x164')])){_0x383599['emptyContact'](_0x6d50('0x206'),_0x428ffe,_0x4c5880[0x0]);}else{_0x383599[_0x6d50('0xb5')](_['pick'](_0x4c5880[0x0],['VoiceQueueId',_0x6d50('0x207')]))[_0x6d50('0xb3')](_0x383599[_0x6d50('0x20c')](_0x428ffe,_0x4c5880[0x0]))[_0x6d50('0xab')](_0x383599['loggerHandler'](_0x6d50('0x20d'),_0x428ffe));}}})[_0x6d50('0xab')](loggerGetContactDialer(_0x6d50('0x20e'),_0x428ffe,0x1));emitVoiceQueueSummary(_0x428ffe);};Dialer[_0x6d50('0x19')]['abandonmentRate']=function(_0x3c9d6a,_0x43c78c,_0x4c5289,_0x2e7233,_0x1200ed,_0x392340){loggerPredictive[_0x6d50('0x79')](_0x6d50('0x20f'));loggerPredictive['info'](_0x6d50('0x210'),_0x3c9d6a);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x211'),_0x43c78c);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x212'),_0x4c5289);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x213'),_0x2e7233);loggerPredictive[_0x6d50('0x79')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1200ed);loggerPredictive[_0x6d50('0x79')](_0x6d50('0x7f'));return new BPromise(function(_0x328fe9,_0x35e957){if(_0x3c9d6a<=0x0||isNaN(_0x3c9d6a)){return _0x35e957(msgResponse(_0x6d50('0x214'),_0x6d50('0x45'),_0x6d50('0x215')+_0x3c9d6a));}if(_0x4c5289<=0x0||isNaN(_0x4c5289)){return _0x35e957(msgResponse(_0x6d50('0x214'),_0x6d50('0x45'),_0x6d50('0x216')+_0x4c5289));}if(_0x2e7233<=0x0||isNaN(_0x2e7233)){return _0x35e957(msgResponse('[abandonmentRate]',_0x6d50('0x45'),_0x6d50('0x217')+_0x2e7233));}if(_0x43c78c<=0x0||isNaN(_0x43c78c)){return _0x35e957(msgResponse(_0x6d50('0x214'),'Error',_0x6d50('0x218')+_0x43c78c));}if(_0x1200ed<=0x0||isNaN(_0x1200ed)){return _0x35e957(msgResponse(_0x6d50('0x214'),'Error',_0x6d50('0x219')+_0x1200ed));}_0x392340=_0x392340||0x0;var _0x5b44d1=0x1/_0x4c5289;var _0x2e8ea7=0x0;var _0x5a12b8=0x0;var _0x118fdd=0x0;var _0x1caaae=0x0;for(var _0xf7e440=0x0;_0x118fdd<_0x1200ed;_0xf7e440+=0x1){_0x5a12b8=_0xf7e440/_0x43c78c;_0x2e8ea7=(_0x2e7233*_0x5a12b8+_0x392340)/_0x5b44d1;_0x118fdd=erlangb(_0x2e8ea7,_0x3c9d6a);_0x1caaae=_0x2e8ea7/_0x3c9d6a*(0x1-erlangb(_0x2e8ea7,_0x3c9d6a));}return _0x328fe9({'erlangCalls':_0xf7e440,'erlangCallToSecond':_0x43c78c/_0xf7e440,'erlangAbandonmentRate':_0x118fdd,'erlangBusyFactor':_0x1caaae});});};Dialer[_0x6d50('0x19')][_0x6d50('0x1df')]=function(_0x34aa26,_0x17495a,_0x326aeb,_0x51f397,_0x3eb2c5,_0x381802){loggerPredictive[_0x6d50('0x79')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6d50('0x79')](_0x6d50('0x210'),_0x34aa26);loggerPredictive[_0x6d50('0x79')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17495a);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x326aeb);loggerPredictive['info'](_0x6d50('0x213'),_0x51f397);loggerPredictive[_0x6d50('0x79')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3eb2c5);loggerPredictive['info'](_0x6d50('0x7f'));return new BPromise(function(_0x213212,_0x2bfca8){if(_0x34aa26<=0x0||isNaN(_0x34aa26)){return _0x2bfca8(msgResponse(_0x6d50('0x21a'),_0x6d50('0x45'),_0x6d50('0x215')+_0x34aa26));}if(_0x326aeb<=0x0||isNaN(_0x326aeb)){return _0x2bfca8(msgResponse(_0x6d50('0x21a'),_0x6d50('0x45'),_0x6d50('0x216')+_0x326aeb));}if(_0x51f397<=0x0||isNaN(_0x51f397)){return _0x2bfca8(msgResponse(_0x6d50('0x21a'),_0x6d50('0x45'),_0x6d50('0x217')+_0x51f397));}if(_0x17495a<=0x0||isNaN(_0x17495a)){return _0x2bfca8(msgResponse('[busyFactor]',_0x6d50('0x45'),'interval\x20=\x20'+_0x17495a));}if(_0x3eb2c5<=0x0||isNaN(_0x3eb2c5)){return _0x2bfca8(msgResponse(_0x6d50('0x21a'),_0x6d50('0x45'),'Umin\x20=\x20'+_0x3eb2c5));}_0x381802=_0x381802||0x0;var _0x2d6463=0x1/_0x326aeb;var _0x460e0f=0x0;var _0x3130f7=0x0;var _0x446e93=0x0;var _0x3929a7=0x0;for(var _0x35f3bf=0x0;_0x3929a7<_0x3eb2c5;_0x35f3bf+=0x1){_0x3130f7=_0x35f3bf/_0x17495a;_0x460e0f=(_0x51f397*_0x3130f7+_0x381802)/_0x2d6463;_0x446e93=erlangb(_0x460e0f,_0x34aa26);_0x3929a7=_0x460e0f/_0x34aa26*(0x1-erlangb(_0x460e0f,_0x34aa26));}return _0x213212({'erlangCalls':_0x35f3bf,'erlangCallToSecond':_0x17495a/_0x35f3bf,'erlangAbandonmentRate':_0x446e93,'erlangBusyFactor':_0x3929a7});});};module[_0x6d50('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4e55b48..97261eb 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 _0xcb6e=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x524e2f,_0x25f4e9){var _0x458aae=function(_0xc6752a){while(--_0xc6752a){_0x524e2f['push'](_0x524e2f['shift']());}};_0x458aae(++_0x25f4e9);}(_0xcb6e,0x174));var _0xecb6=function(_0x5489e6,_0x176d0d){_0x5489e6=_0x5489e6-0x0;var _0x4cef7b=_0xcb6e[_0x5489e6];return _0x4cef7b;};'use strict';var util=require(_0xecb6('0x0'));var _=require(_0xecb6('0x1'));var moment=require(_0xecb6('0x2'));function getSeconds(_0x27c44b,_0x201a63){var _0x53ee83=moment(_0x27c44b)[_0xecb6('0x3')](0x0);var _0x172807=moment(_0x201a63)[_0xecb6('0x3')](0x0);return _0x53ee83[_0xecb6('0x4')](_0x172807,_0xecb6('0x5'));}function QueueCallerAbandon(_0x25882f,_0x3926b0){this[_0xecb6('0x6')]=_0x25882f[_0xecb6('0x6')];this[_0xecb6('0x7')]=_0x25882f[_0xecb6('0x7')];this[_0xecb6('0x8')]=_0x25882f[_0xecb6('0x7')]===_0xecb6('0x9')?_0xecb6('0xa'):_0x25882f[_0xecb6('0x7')];this[_0xecb6('0xb')]=_0x25882f[_0xecb6('0xb')];this[_0xecb6('0xc')]=_0x25882f[_0xecb6('0xc')];this[_0xecb6('0xd')]=_0x25882f[_0xecb6('0xd')];this[_0xecb6('0xe')]=_0x25882f[_0xecb6('0xb')]+_0x25882f[_0xecb6('0xc')]+_0x25882f['countnoanswerretry']+_0x25882f[_0xecb6('0xf')]+_0x25882f[_0xecb6('0x10')]+_0x25882f[_0xecb6('0x11')]+_0x25882f[_0xecb6('0x12')]+_0x25882f[_0xecb6('0x13')];this['countnosuchnumberretry']=_0x25882f[_0xecb6('0xf')];this[_0xecb6('0x10')]=_0x25882f[_0xecb6('0x10')];this[_0xecb6('0x11')]=_0x25882f['countabandonedretry'];this[_0xecb6('0x12')]=_0x25882f[_0xecb6('0x12')];this[_0xecb6('0x13')]=_0x25882f[_0xecb6('0x13')];this[_0xecb6('0x14')]=_0x3926b0[_0xecb6('0x14')];this[_0xecb6('0x15')]=_0x25882f[_0xecb6('0x16')];this[_0xecb6('0x17')]=_0x25882f['number'];this['starttime']=_0x25882f[_0xecb6('0x18')];this[_0xecb6('0x19')]=_0x25882f[_0xecb6('0x19')];this['droptime']=_0x25882f[_0xecb6('0x1a')];this['endtime']=this['droptime'];this[_0xecb6('0x1b')]=getSeconds(_0x25882f[_0xecb6('0x19')],_0x25882f[_0xecb6('0x18')]);this[_0xecb6('0x1c')]=getSeconds(this['droptime'],_0x25882f[_0xecb6('0x19')]);this[_0xecb6('0x1d')]=0x0;this[_0xecb6('0xa')]=_0x3926b0[_0xecb6('0xa')];this['membername']=_0x3926b0[_0xecb6('0x1e')];this[_0xecb6('0x1f')]=_0x3926b0['reason'];this[_0xecb6('0x20')]=_0x25882f[_0xecb6('0x20')];this[_0xecb6('0x21')]=_0x25882f['callbackuniqueid'];this['callbackat']=_0x25882f[_0xecb6('0x22')];this[_0xecb6('0x23')]=_0x25882f[_0xecb6('0x23')];this[_0xecb6('0x24')]=_0x25882f['ContactId'];this[_0xecb6('0x25')]=_0x25882f[_0xecb6('0x25')];this[_0xecb6('0x26')]=_0x25882f[_0xecb6('0x26')];this[_0xecb6('0x27')]=_0x25882f[_0xecb6('0x27')];this['CampaignId']=_0x25882f['CampaignId'];this[_0xecb6('0x28')]=_0x25882f[_0xecb6('0x28')]||'';this[_0xecb6('0x29')]=_0x25882f[_0xecb6('0x29')]||'';}module[_0xecb6('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xe70f=['countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x191518,_0x4f95e1){var _0x4f4da5=function(_0x4c390c){while(--_0x4c390c){_0x191518['push'](_0x191518['shift']());}};_0x4f4da5(++_0x4f95e1);}(_0xe70f,0xfc));var _0xfe70=function(_0x388554,_0x40b48f){_0x388554=_0x388554-0x0;var _0x4b94c4=_0xe70f[_0x388554];return _0x4b94c4;};'use strict';var util=require(_0xfe70('0x0'));var _=require(_0xfe70('0x1'));var moment=require('moment');function getSeconds(_0x14873e,_0x4614a8){var _0x222acf=moment(_0x14873e)[_0xfe70('0x2')](0x0);var _0x5e3122=moment(_0x4614a8)[_0xfe70('0x2')](0x0);return _0x222acf[_0xfe70('0x3')](_0x5e3122,'seconds');}function QueueCallerAbandon(_0x2335f,_0x3ef6f5){this[_0xfe70('0x4')]=_0x2335f[_0xfe70('0x4')];this[_0xfe70('0x5')]=_0x2335f[_0xfe70('0x5')];this['campaigntype']=_0x2335f[_0xfe70('0x5')]===_0xfe70('0x6')?_0xfe70('0x7'):_0x2335f[_0xfe70('0x5')];this[_0xfe70('0x8')]=_0x2335f[_0xfe70('0x8')];this[_0xfe70('0x9')]=_0x2335f[_0xfe70('0x9')];this[_0xfe70('0xa')]=_0x2335f['countnoanswerretry'];this['countglobal']=_0x2335f[_0xfe70('0x8')]+_0x2335f[_0xfe70('0x9')]+_0x2335f['countnoanswerretry']+_0x2335f['countnosuchnumberretry']+_0x2335f[_0xfe70('0xb')]+_0x2335f['countabandonedretry']+_0x2335f[_0xfe70('0xc')]+_0x2335f[_0xfe70('0xd')];this[_0xfe70('0xe')]=_0x2335f[_0xfe70('0xe')];this['countdropretry']=_0x2335f[_0xfe70('0xb')];this[_0xfe70('0xf')]=_0x2335f[_0xfe70('0xf')];this[_0xfe70('0xc')]=_0x2335f[_0xfe70('0xc')];this['countagentrejectretry']=_0x2335f['countagentrejectretry'];this['uniqueid']=_0x3ef6f5[_0xfe70('0x10')];this[_0xfe70('0x11')]=_0x2335f[_0xfe70('0x12')];this[_0xfe70('0x13')]=_0x2335f[_0xfe70('0x14')];this['starttime']=_0x2335f[_0xfe70('0x15')];this[_0xfe70('0x16')]=_0x2335f[_0xfe70('0x16')];this[_0xfe70('0x17')]=_0x2335f[_0xfe70('0x17')];this['endtime']=this['droptime'];this[_0xfe70('0x18')]=getSeconds(_0x2335f['responsetime'],_0x2335f['starttime']);this[_0xfe70('0x19')]=getSeconds(this[_0xfe70('0x17')],_0x2335f['responsetime']);this['talktime']=0x0;this[_0xfe70('0x7')]=_0x3ef6f5['queue'];this[_0xfe70('0x1a')]=_0x3ef6f5[_0xfe70('0x1b')];this['reason']=_0x3ef6f5['reason'];this[_0xfe70('0x1c')]=_0x2335f[_0xfe70('0x1c')];this[_0xfe70('0x1d')]=_0x2335f[_0xfe70('0x1d')];this[_0xfe70('0x1e')]=_0x2335f[_0xfe70('0x1e')];this[_0xfe70('0x1f')]=_0x2335f['recallme'];this['ContactId']=_0x2335f[_0xfe70('0x20')];this['ListId']=_0x2335f[_0xfe70('0x21')];this['UserId']=_0x2335f[_0xfe70('0x22')];this[_0xfe70('0x23')]=_0x2335f[_0xfe70('0x23')];this[_0xfe70('0x24')]=_0x2335f[_0xfe70('0x24')];this['originatecalleridnum']=_0x2335f['originatecalleridnum']||'';this[_0xfe70('0x25')]=_0x2335f['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6de4bba..c837edb 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 _0x0bbe=['format','%s/%s/%s','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','moment','uniqueid','channel'];(function(_0x2fceba,_0xaf879d){var _0x370296=function(_0x3a5447){while(--_0x3a5447){_0x2fceba['push'](_0x2fceba['shift']());}};_0x370296(++_0xaf879d);}(_0x0bbe,0x81));var _0xe0bb=function(_0x1d8db1,_0x4900e3){_0x1d8db1=_0x1d8db1-0x0;var _0x52ef56=_0x0bbe[_0x1d8db1];return _0x52ef56;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe0bb('0x0'));function Action(_0x1c8ec6,_0x40cf1f,_0x112e86){this[_0xe0bb('0x1')]=_0x1c8ec6||undefined;this[_0xe0bb('0x2')]=util[_0xe0bb('0x3')](_0xe0bb('0x4'),_0x40cf1f['tech'],_0x40cf1f[_0xe0bb('0x5')]['name'],_0x112e86[_0xe0bb('0x6')]);this[_0xe0bb('0x7')]=_0x40cf1f[_0xe0bb('0x7')];this[_0xe0bb('0x8')]=_0x40cf1f[_0xe0bb('0x8')];this[_0xe0bb('0x9')]=_0x112e86[_0xe0bb('0x9')];this[_0xe0bb('0xa')]=_0x112e86[_0xe0bb('0xa')];}module[_0xe0bb('0xb')]=Action; \ No newline at end of file +var _0xc0d8=['exports','uniqueid','channel','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc0d8,0x64));var _0x8c0d=function(_0x2d43d2,_0x1dc8cd){_0x2d43d2=_0x2d43d2-0x0;var _0xe5469b=_0xc0d8[_0x2d43d2];return _0xe5469b;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function Action(_0x34b2cc,_0x1ad217,_0x231816){this[_0x8c0d('0x0')]=_0x34b2cc||undefined;this[_0x8c0d('0x1')]=util['format'](_0x8c0d('0x2'),_0x1ad217['tech'],_0x1ad217[_0x8c0d('0x3')][_0x8c0d('0x4')],_0x231816[_0x8c0d('0x5')]);this[_0x8c0d('0x6')]=_0x1ad217[_0x8c0d('0x6')];this[_0x8c0d('0x7')]=_0x1ad217['headerinfo'];this[_0x8c0d('0x8')]=_0x231816['path'];this[_0x8c0d('0x9')]=_0x231816[_0x8c0d('0x9')];}module[_0x8c0d('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 2fdefae..189e8a0 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 _0xef3f=['./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','status','reachable','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','../../../config/logger','./rpcDb'];(function(_0x2e36c0,_0x5626ff){var _0x381483=function(_0xb57b0){while(--_0xb57b0){_0x2e36c0['push'](_0x2e36c0['shift']());}};_0x381483(++_0x5626ff);}(_0xef3f,0x164));var _0xfef3=function(_0x5842fc,_0x252bfb){_0x5842fc=_0x5842fc-0x0;var _0x2bfea2=_0xef3f[_0x5842fc];return _0x2bfea2;};'use strict';var util=require(_0xfef3('0x0'));var _=require('lodash');var BPromise=require(_0xfef3('0x1'));var uuid=require('uuid');var moment=require(_0xfef3('0x2'));var path=require(_0xfef3('0x3'));var tiff2pdf=require(_0xfef3('0x4'));var gs=require('./util/gs');var logger=require(_0xfef3('0x5'))('fax');var ami=require('../ami');var rpcDb=require(_0xfef3('0x6'));var Channel=require(_0xfef3('0x7'));var ut=require(_0xfef3('0x8'));var Action=require('./action');var faxAccount=require(_0xfef3('0x9'));var attachment=require(_0xfef3('0xa'));var faxMessage=require(_0xfef3('0xb'));function Fax(_0x33aace){this[_0xfef3('0xc')]={};this['faxAccounts']=_0x33aace[_0xfef3('0xd')];this[_0xfef3('0xe')]=_0x33aace[_0xfef3('0xe')];this[_0xfef3('0xf')]={};ami['on'](_0xfef3('0x10'),this[_0xfef3('0x11')]['bind'](this));ami['on'](_0xfef3('0x12'),this[_0xfef3('0x13')][_0xfef3('0x14')](this));ami['on'](_0xfef3('0x15'),this[_0xfef3('0x16')][_0xfef3('0x14')](this));ami['on'](_0xfef3('0x17'),this[_0xfef3('0x18')][_0xfef3('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0xfef3('0x19'),this[_0xfef3('0x1a')][_0xfef3('0x14')](this));ami['on']('hangup',this[_0xfef3('0x1b')][_0xfef3('0x14')](this));ami['on'](_0xfef3('0x1c'),this[_0xfef3('0x1d')][_0xfef3('0x14')](this));}Fax[_0xfef3('0x1e')][_0xfef3('0x11')]=function(_0xa5e7cf){if(_0xa5e7cf[_0xfef3('0x1f')]==='from-voip-provider'){for(var _0x3a6856 in this[_0xfef3('0xd')]){if(this[_0xfef3('0xd')][_0xfef3('0x20')](_0x3a6856)){if(_0xa5e7cf[_0xfef3('0x21')]===this[_0xfef3('0xd')][_0x3a6856][_0xfef3('0x22')]){this[_0xfef3('0xc')][_0xa5e7cf[_0xfef3('0x23')]]={};this[_0xfef3('0xc')][_0xa5e7cf[_0xfef3('0x23')]][_0xfef3('0x24')]=_0xa5e7cf[_0xfef3('0x24')];this[_0xfef3('0xc')][_0xa5e7cf[_0xfef3('0x23')]]['id']=this[_0xfef3('0xd')][_0x3a6856]['id'];this['channels'][_0xa5e7cf[_0xfef3('0x23')]][_0xfef3('0x25')]=this[_0xfef3('0xd')][_0x3a6856][_0xfef3('0x25')];logger['info'](_0xa5e7cf['uniqueid'],_0xfef3('0x26'));}}}}if(this[_0xfef3('0xf')][_0xa5e7cf[_0xfef3('0x23')]]){this[_0xfef3('0xc')][_0xa5e7cf[_0xfef3('0x23')]]={};this[_0xfef3('0xc')][_0xa5e7cf['uniqueid']][_0xfef3('0x24')]=_0xa5e7cf[_0xfef3('0x24')];logger[_0xfef3('0x27')](_0xa5e7cf[_0xfef3('0x23')],_0xfef3('0x26'));}};Fax[_0xfef3('0x1e')][_0xfef3('0x13')]=function(_0x7d9190){if(this[_0xfef3('0xc')][_0x7d9190[_0xfef3('0x23')]]){for(var _0x3d2c2a in _0x7d9190[_0xfef3('0x28')]){if(_0x7d9190[_0xfef3('0x28')][_0xfef3('0x20')](_0x3d2c2a)){this['channels'][_0x7d9190['uniqueid']][_0x3d2c2a]=_0x7d9190['value'];}}}};Fax[_0xfef3('0x1e')][_0xfef3('0x16')]=function(_0x4a857e){if(this[_0xfef3('0xc')][_0x4a857e[_0xfef3('0x23')]]){this[_0xfef3('0xc')][_0x4a857e[_0xfef3('0x23')]][_0xfef3('0x29')]=_0x4a857e[_0xfef3('0x29')];this['channels'][_0x4a857e[_0xfef3('0x23')]][_0xfef3('0x2a')]=_0x4a857e[_0xfef3('0x2a')];}};Fax['prototype'][_0xfef3('0x18')]=function(_0x359fd3){if(this['channels'][_0x359fd3[_0xfef3('0x23')]]){for(var _0x2ebe24 in _0x359fd3['variable']){if(_0x359fd3[_0xfef3('0x28')][_0xfef3('0x20')](_0x2ebe24)){this['channels'][_0x359fd3['uniqueid']][_0x2ebe24]=_0x359fd3[_0xfef3('0x2b')];}}}};Fax[_0xfef3('0x1e')]['syncFaxStatus']=function(_0x5ea5b3){if(this[_0xfef3('0xc')][_0x5ea5b3[_0xfef3('0x23')]]){this[_0xfef3('0xc')][_0x5ea5b3[_0xfef3('0x23')]]['operation']=_0x5ea5b3[_0xfef3('0x2c')];this[_0xfef3('0xc')][_0x5ea5b3[_0xfef3('0x23')]]['status']=_0x5ea5b3['status'];this[_0xfef3('0xc')][_0x5ea5b3[_0xfef3('0x23')]]['localstationid']=_0x5ea5b3[_0xfef3('0x22')];this[_0xfef3('0xc')][_0x5ea5b3[_0xfef3('0x23')]][_0xfef3('0x2d')]=_0x5ea5b3[_0xfef3('0x2d')];logger[_0xfef3('0x27')](_0x5ea5b3[_0xfef3('0x23')],_0xfef3('0x2e'));}};Fax['prototype'][_0xfef3('0x1a')]=function(_0x17cdca){var _0x8cf079=this;if(this[_0xfef3('0xc')][_0x17cdca['uniqueid']]){var _0x209767=this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]]['id'];this[_0xfef3('0xc')][_0x17cdca['uniqueid']][_0xfef3('0x2f')]=_0x17cdca['remotestationid'];this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x30')]=_0x17cdca[_0xfef3('0x30')];this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x22')]=_0x17cdca[_0xfef3('0x22')];this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]]['resolution']=_0x17cdca['resolution'];this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x31')]=_0x17cdca[_0xfef3('0x31')];this['channels'][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x2d')]=_0x17cdca[_0xfef3('0x2d')];this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x32')]=_0x17cdca['calleridnum'];if(this[_0xfef3('0xc')][_0x17cdca[_0xfef3('0x23')]][_0xfef3('0x30')]>0x0){tiff2pdf(_0x17cdca[_0xfef3('0x2d')],_0xfef3('0x33'),function(_0xedbd37){logger['info'](_0x17cdca[_0xfef3('0x23')],'\x20result\x20conversion\x20file\x20',_0xedbd37[_0xfef3('0x34')]);attachment[_0xfef3('0x35')]({'name':path[_0xfef3('0x36')](_0x17cdca[_0xfef3('0x2d')])['name'],'basename':path[_0xfef3('0x36')](_0x17cdca[_0xfef3('0x2d')])[_0xfef3('0x25')]+_0xfef3('0x37'),'type':_0xfef3('0x38')})[_0xfef3('0x39')](function(_0x192552){faxAccount[_0xfef3('0x3a')](_0x209767,{'from':_0x17cdca[_0xfef3('0x32')],'mapKey':_0xfef3('0x3b'),'body':path['parse'](_0x17cdca[_0xfef3('0x2d')])[_0xfef3('0x25')]+'.pdf','AttachmentId':_0x192552['id']})[_0xfef3('0x3c')](function(_0xf0648a){logger['error'](_0x17cdca[_0xfef3('0x23')],_0xfef3('0x3d'),JSON[_0xfef3('0x3e')](_0xf0648a));});})[_0xfef3('0x3c')](function(_0x493927){logger[_0xfef3('0x3f')](_0x17cdca[_0xfef3('0x23')],'\x20receiveFax\x20',JSON['stringify'](_0x493927));});});}logger[_0xfef3('0x27')](_0x17cdca['uniqueid'],_0xfef3('0x40'));}};Fax[_0xfef3('0x1e')]['syncOriginateResponse']=function(_0x2c939c){if(this[_0xfef3('0xf')][_0x2c939c[_0xfef3('0x23')]]){_['merge'](this[_0xfef3('0xc')][_0x2c939c['uniqueid']],_[_0xfef3('0x41')](_0x2c939c,[_0xfef3('0x42'),_0xfef3('0x43')]));}};function updateStatus(_0x36267b){if(_0x36267b[_0xfef3('0x44')]){faxMessage[_0xfef3('0x45')](_0x36267b[_0xfef3('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x15c548){ut[_0xfef3('0x46')]('[Fax][Message][Error][Updated]',_0x15c548);})['catch'](function(_0x1237f6){ut[_0xfef3('0x46')](_0xfef3('0x47'),_0x1237f6);});}else{ut[_0xfef3('0x46')](_0xfef3('0x48'));}}Fax[_0xfef3('0x1e')][_0xfef3('0x49')]=function(_0x495648,_0x23c7ef,_0x4f2b0f){var _0x1bf638=this;var _0x509526={};if(_0x23c7ef){_0x509526={'read':_0x23c7ef};}else{_0x509526={'failMessage':_0x4f2b0f};}if(this['actions'][_0x495648]['AttachmentId']){faxMessage[_0xfef3('0x45')](this[_0xfef3('0xf')][_0x495648][_0xfef3('0x44')],_0x509526)['then'](function(_0x2e41f6){ut['logger'](_0xfef3('0x4a'),_0x2e41f6);})[_0xfef3('0x3c')](function(_0x17ccbf){ut[_0xfef3('0x46')]('[Fax][Message][NoUpdate1]',_0x17ccbf);})[_0xfef3('0x4b')](function(){delete _0x1bf638[_0xfef3('0xc')][_0x495648];delete _0x1bf638[_0xfef3('0xf')][_0x495648];});}else{ut[_0xfef3('0x46')](_0xfef3('0x4c'));delete this['channels'][_0x495648];delete this['actions'][_0x495648];}};Fax['prototype']['syncHangup']=function(_0x5542bc){var _0x3bc36b=this;if(this['channels'][_0x5542bc[_0xfef3('0x23')]]){if(this[_0xfef3('0xf')][_0x5542bc[_0xfef3('0x23')]]){this[_0xfef3('0xc')][_0x5542bc[_0xfef3('0x23')]]['id']=this[_0xfef3('0xf')][_0x5542bc[_0xfef3('0x23')]]['id'];this[_0xfef3('0xc')][_0x5542bc[_0xfef3('0x23')]][_0xfef3('0x25')]=this[_0xfef3('0xf')][_0x5542bc[_0xfef3('0x23')]]['name'];}logger['info'](_0x5542bc[_0xfef3('0x23')],this['actions'][_0x5542bc['uniqueid']]?_0xfef3('0x4d'):_0xfef3('0x4e'),JSON['stringify'](this[_0xfef3('0xc')][_0x5542bc['uniqueid']]));if(this[_0xfef3('0xf')][_0x5542bc[_0xfef3('0x23')]]){if(this[_0xfef3('0xc')][_0x5542bc[_0xfef3('0x23')]]['faxpages']>0x0&&this['channels'][_0x5542bc[_0xfef3('0x23')]][_0xfef3('0x4f')]==='SUCCESS'){this[_0xfef3('0x49')](_0x5542bc['uniqueid'],!![]);}else{this[_0xfef3('0x49')](_0x5542bc[_0xfef3('0x23')],![],this[_0xfef3('0xc')][_0x5542bc[_0xfef3('0x23')]][_0xfef3('0x50')]?_0xfef3('0x51')+this[_0xfef3('0xc')][_0x5542bc['uniqueid']][_0xfef3('0x50')]:_0xfef3('0x52'));}}}};Fax['prototype'][_0xfef3('0x53')]=function(_0x305cb5){var _0x30dff2=this;return new BPromise(function(_0x19c53e,_0x49b5e0){_0x30dff2[_0xfef3('0x54')](_0x305cb5,_0x30dff2[_0xfef3('0xd')][_0x305cb5[_0xfef3('0x55')]])[_0xfef3('0x39')](function(_0x15536e){ut[_0xfef3('0x46')](_0xfef3('0x56'),_0x15536e);_0x19c53e(ut[_0xfef3('0x34')](_0xfef3('0x57')));})[_0xfef3('0x3c')](function(_0x545e77){ut['logger'](_0xfef3('0x58'),_0x545e77);updateStatus(_0x305cb5);_0x49b5e0(ut[_0xfef3('0x34')](_0xfef3('0x59')));});});};Fax[_0xfef3('0x1e')][_0xfef3('0x5a')]=function(_0x5a24ff){var _0x3cd856=this;return new BPromise(function(_0x502808,_0x332535){var _0x5b7f05=_0x3cd856[_0xfef3('0x5b')](_0x3cd856['faxAccounts'][_0x5a24ff[_0xfef3('0x55')]][_0xfef3('0x5c')],_0x5a24ff);if(_0x5b7f05[_0xfef3('0x5d')]){_0x502808(ut[_0xfef3('0x34')](_0xfef3('0x5e')));}else{_0x332535(ut['message'](_0x5b7f05[_0xfef3('0x34')]));}});};function originate(_0x981d84,_0x378f3f,_0x4398ff){return new BPromise(function(_0x2e239a,_0x51b77c){if(_0x4398ff){var _0x43536b=util[_0xfef3('0x5f')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xfef3('0x36')](_0x981d84[_0xfef3('0x3')])[_0xfef3('0x25')],_0x981d84['path']);gs[_0xfef3('0x60')](_0x43536b)[_0xfef3('0x39')](function(){_0x981d84[_0xfef3('0x3')]=util[_0xfef3('0x5f')](_0xfef3('0x61'),path[_0xfef3('0x36')](_0x981d84[_0xfef3('0x3')])[_0xfef3('0x62')],path[_0xfef3('0x36')](_0x981d84['path'])[_0xfef3('0x25')]);_0x378f3f[_0xfef3('0x63')]=_0x981d84[_0xfef3('0x3')];ut['logger'](_0xfef3('0x64'),'');ami[_0xfef3('0x65')](ut[_0xfef3('0x66')](_0x981d84,_0x378f3f))[_0xfef3('0x39')](function(_0x173922){_0x2e239a(_0x173922);})[_0xfef3('0x3c')](function(_0x5b197b){_0x51b77c(_0x5b197b);});})[_0xfef3('0x3c')](function(_0x282d79){_0x51b77c(_0x282d79);});}else{ami[_0xfef3('0x65')](ut['variablesAction'](_0x981d84,_0x378f3f))[_0xfef3('0x39')](function(_0x2ebadc){_0x2e239a(_0x2ebadc);})[_0xfef3('0x3c')](function(_0x355bf8){_0x51b77c(_0x355bf8);});}});}Fax[_0xfef3('0x1e')][_0xfef3('0x54')]=function(_0x2883e4,_0x468cc9){var _0x2ab15c=this;return new BPromise(function(_0x37261a,_0x2a2c8f){var _0x3c1269=uuid['v4']();var _0x20219b=ut[_0xfef3('0x67')](_0x2883e4,_0x468cc9);_0x2ab15c[_0xfef3('0xf')][_0x3c1269]=new Action(_0x3c1269,_0x468cc9,_0x2883e4);var _0x4e489b=_0x2ab15c['actions'][_0x3c1269];if(path[_0xfef3('0x36')](_0x2883e4[_0xfef3('0x3')])[_0xfef3('0x68')]==='.pdf'){originate(_0x4e489b,_0x20219b,!![])['then'](function(_0x5492f2){_0x37261a(_0x5492f2);})[_0xfef3('0x3c')](function(_0x4eea54){_0x2a2c8f(_0x4eea54);});}else{originate(_0x4e489b,_0x20219b,![])[_0xfef3('0x39')](function(_0x80b364){_0x37261a(_0x80b364);})[_0xfef3('0x3c')](function(_0x597753){_0x2a2c8f(_0x597753);});}});};Fax[_0xfef3('0x1e')][_0xfef3('0x69')]=function(_0x12e315){return!_['isNil'](_0x12e315)&&!_[_0xfef3('0x6a')](_0x12e315[_0xfef3('0x25')])&&!_[_0xfef3('0x6a')](_0x12e315[_0xfef3('0x6b')])&&_0x12e315[_0xfef3('0x6b')]&&!_['isNil'](this[_0xfef3('0xe')][util[_0xfef3('0x5f')]('SIP/%s',_0x12e315['name'])])&&!_[_0xfef3('0x6a')](this[_0xfef3('0xe')][util[_0xfef3('0x5f')]('SIP/%s',_0x12e315[_0xfef3('0x25')])][_0xfef3('0x6c')])&&(this[_0xfef3('0xe')][util['format']('SIP/%s',_0x12e315[_0xfef3('0x25')])][_0xfef3('0x6c')]===_0xfef3('0x6d')||this[_0xfef3('0xe')][util[_0xfef3('0x5f')](_0xfef3('0x6e'),_0x12e315[_0xfef3('0x25')])][_0xfef3('0x6c')]===_0xfef3('0x6f'));};Fax[_0xfef3('0x1e')][_0xfef3('0x5b')]=function(_0x1794c0,_0x5607ce){if(!this[_0xfef3('0x69')](_0x1794c0)){ut[_0xfef3('0x46')](_0xfef3('0x70'),_['isNil'](_0x1794c0)?'':_0x1794c0[_0xfef3('0x25')]+_0xfef3('0x71'));return{'isValid':![],'message':_0xfef3('0x72')};}if(_[_0xfef3('0x6a')](_0x5607ce[_0xfef3('0x3b')])){ut[_0xfef3('0x46')](_0xfef3('0x73'),JSON['stringify'](_0x5607ce));return{'isValid':![],'message':_0xfef3('0x74')};}if(_[_0xfef3('0x6a')](_0x5607ce[_0xfef3('0x3')])){ut[_0xfef3('0x46')](_0xfef3('0x75'),JSON[_0xfef3('0x3e')](_0x5607ce));return{'isValid':![],'message':_0xfef3('0x76')};}return{'isValid':!![],'message':_0xfef3('0x77')};};module[_0xfef3('0x78')]=Fax; \ No newline at end of file +var _0x4940=['operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','Trunk\x20not\x20working','stringify','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','bluebird','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc'];(function(_0x3e978c,_0x1d5774){var _0x295585=function(_0x309460){while(--_0x309460){_0x3e978c['push'](_0x3e978c['shift']());}};_0x295585(++_0x1d5774);}(_0x4940,0x189));var _0x0494=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4940[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x0494('0x0'));var _=require('lodash');var BPromise=require(_0x0494('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x0494('0x2'));var tiff2pdf=require(_0x0494('0x3'));var gs=require('./util/gs');var logger=require(_0x0494('0x4'))(_0x0494('0x5'));var ami=require('../ami');var rpcDb=require(_0x0494('0x6'));var Channel=require(_0x0494('0x7'));var ut=require(_0x0494('0x8'));var Action=require(_0x0494('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x4249c0){this[_0x0494('0xa')]={};this[_0x0494('0xb')]=_0x4249c0[_0x0494('0xb')];this[_0x0494('0xc')]=_0x4249c0['trunks'];this[_0x0494('0xd')]={};ami['on']('newchannel',this[_0x0494('0xe')][_0x0494('0xf')](this));ami['on'](_0x0494('0x10'),this[_0x0494('0x11')][_0x0494('0xf')](this));ami['on'](_0x0494('0x12'),this[_0x0494('0x13')][_0x0494('0xf')](this));ami['on'](_0x0494('0x14'),this[_0x0494('0x15')][_0x0494('0xf')](this));ami['on'](_0x0494('0x16'),this[_0x0494('0x17')][_0x0494('0xf')](this));ami['on'](_0x0494('0x18'),this[_0x0494('0x19')]['bind'](this));ami['on'](_0x0494('0x1a'),this[_0x0494('0x1b')][_0x0494('0xf')](this));ami['on'](_0x0494('0x1c'),this['syncOriginateResponse'][_0x0494('0xf')](this));}Fax[_0x0494('0x1d')][_0x0494('0xe')]=function(_0x5555e9){if(_0x5555e9[_0x0494('0x1e')]===_0x0494('0x1f')){for(var _0x35769a in this[_0x0494('0xb')]){if(this[_0x0494('0xb')]['hasOwnProperty'](_0x35769a)){if(_0x5555e9[_0x0494('0x20')]===this[_0x0494('0xb')][_0x35769a][_0x0494('0x21')]){this[_0x0494('0xa')][_0x5555e9[_0x0494('0x22')]]={};this[_0x0494('0xa')][_0x5555e9['uniqueid']][_0x0494('0x23')]=_0x5555e9['channel'];this['channels'][_0x5555e9['uniqueid']]['id']=this[_0x0494('0xb')][_0x35769a]['id'];this[_0x0494('0xa')][_0x5555e9[_0x0494('0x22')]]['name']=this['faxAccounts'][_0x35769a][_0x0494('0x24')];logger[_0x0494('0x25')](_0x5555e9[_0x0494('0x22')],_0x0494('0x26'));}}}}if(this[_0x0494('0xd')][_0x5555e9['uniqueid']]){this[_0x0494('0xa')][_0x5555e9['uniqueid']]={};this['channels'][_0x5555e9[_0x0494('0x22')]][_0x0494('0x23')]=_0x5555e9[_0x0494('0x23')];logger[_0x0494('0x25')](_0x5555e9[_0x0494('0x22')],_0x0494('0x26'));}};Fax[_0x0494('0x1d')][_0x0494('0x11')]=function(_0x139fb7){if(this[_0x0494('0xa')][_0x139fb7[_0x0494('0x22')]]){for(var _0x49ff8c in _0x139fb7['variable']){if(_0x139fb7[_0x0494('0x27')]['hasOwnProperty'](_0x49ff8c)){this['channels'][_0x139fb7[_0x0494('0x22')]][_0x49ff8c]=_0x139fb7[_0x0494('0x28')];}}}};Fax['prototype'][_0x0494('0x13')]=function(_0x50c85b){if(this[_0x0494('0xa')][_0x50c85b[_0x0494('0x22')]]){this[_0x0494('0xa')][_0x50c85b['uniqueid']]['channelstate']=_0x50c85b[_0x0494('0x29')];this[_0x0494('0xa')][_0x50c85b['uniqueid']]['channelstatedesc']=_0x50c85b[_0x0494('0x2a')];}};Fax['prototype']['syncNewExten']=function(_0x341183){if(this[_0x0494('0xa')][_0x341183['uniqueid']]){for(var _0x4d4b7f in _0x341183[_0x0494('0x27')]){if(_0x341183['variable']['hasOwnProperty'](_0x4d4b7f)){this[_0x0494('0xa')][_0x341183[_0x0494('0x22')]][_0x4d4b7f]=_0x341183[_0x0494('0x28')];}}}};Fax[_0x0494('0x1d')]['syncFaxStatus']=function(_0x47c3a9){if(this[_0x0494('0xa')][_0x47c3a9[_0x0494('0x22')]]){this[_0x0494('0xa')][_0x47c3a9[_0x0494('0x22')]]['operation']=_0x47c3a9[_0x0494('0x2b')];this[_0x0494('0xa')][_0x47c3a9[_0x0494('0x22')]][_0x0494('0x2c')]=_0x47c3a9[_0x0494('0x2c')];this[_0x0494('0xa')][_0x47c3a9['uniqueid']]['localstationid']=_0x47c3a9[_0x0494('0x21')];this[_0x0494('0xa')][_0x47c3a9[_0x0494('0x22')]][_0x0494('0x2d')]=_0x47c3a9[_0x0494('0x2d')];logger[_0x0494('0x25')](_0x47c3a9[_0x0494('0x22')],_0x0494('0x2e'));}};Fax['prototype'][_0x0494('0x19')]=function(_0x989e7c){var _0x195bbf=this;if(this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]]){var _0x2000f7=this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]]['id'];this[_0x0494('0xa')][_0x989e7c['uniqueid']]['remotestationid']=_0x989e7c[_0x0494('0x2f')];this['channels'][_0x989e7c[_0x0494('0x22')]][_0x0494('0x30')]=_0x989e7c[_0x0494('0x30')];this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]][_0x0494('0x21')]=_0x989e7c['localstationid'];this['channels'][_0x989e7c[_0x0494('0x22')]][_0x0494('0x31')]=_0x989e7c['resolution'];this['channels'][_0x989e7c['uniqueid']][_0x0494('0x32')]=_0x989e7c['transferrate'];this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]]['filename']=_0x989e7c[_0x0494('0x2d')];this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]][_0x0494('0x33')]=_0x989e7c[_0x0494('0x33')];if(this[_0x0494('0xa')][_0x989e7c[_0x0494('0x22')]][_0x0494('0x30')]>0x0){tiff2pdf(_0x989e7c[_0x0494('0x2d')],_0x0494('0x34'),function(_0x152009){logger[_0x0494('0x25')](_0x989e7c[_0x0494('0x22')],'\x20result\x20conversion\x20file\x20',_0x152009[_0x0494('0x35')]);attachment[_0x0494('0x36')]({'name':path[_0x0494('0x37')](_0x989e7c[_0x0494('0x2d')])['name'],'basename':path['parse'](_0x989e7c[_0x0494('0x2d')])[_0x0494('0x24')]+_0x0494('0x38'),'type':_0x0494('0x39')})[_0x0494('0x3a')](function(_0x31a6fc){faxAccount[_0x0494('0x3b')](_0x2000f7,{'from':_0x989e7c['calleridnum'],'mapKey':_0x0494('0x5'),'body':path[_0x0494('0x37')](_0x989e7c[_0x0494('0x2d')])[_0x0494('0x24')]+'.pdf','AttachmentId':_0x31a6fc['id']})[_0x0494('0x3c')](function(_0x416fdb){logger[_0x0494('0x3d')](_0x989e7c[_0x0494('0x22')],_0x0494('0x3e'),JSON['stringify'](_0x416fdb));});})[_0x0494('0x3c')](function(_0x168ae1){logger[_0x0494('0x3d')](_0x989e7c['uniqueid'],'\x20receiveFax\x20',JSON['stringify'](_0x168ae1));});});}logger[_0x0494('0x25')](_0x989e7c[_0x0494('0x22')],_0x0494('0x3f'));}};Fax['prototype'][_0x0494('0x40')]=function(_0x2f0592){if(this[_0x0494('0xd')][_0x2f0592[_0x0494('0x22')]]){_[_0x0494('0x41')](this['channels'][_0x2f0592['uniqueid']],_[_0x0494('0x42')](_0x2f0592,[_0x0494('0x43'),'reason']));}};function updateStatus(_0x46d6b8){if(_0x46d6b8['AttachmentId']){faxMessage[_0x0494('0x44')](_0x46d6b8[_0x0494('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x0494('0x3a')](function(_0x1255e0){ut[_0x0494('0x46')]('[Fax][Message][Error][Updated]',_0x1255e0);})[_0x0494('0x3c')](function(_0x500794){ut[_0x0494('0x46')](_0x0494('0x47'),_0x500794);});}else{ut[_0x0494('0x46')](_0x0494('0x48'));}}Fax[_0x0494('0x1d')][_0x0494('0x49')]=function(_0x32d7fb,_0x711167,_0x1f6bc2){var _0x15a99a=this;var _0x3d60f3={};if(_0x711167){_0x3d60f3={'read':_0x711167};}else{_0x3d60f3={'failMessage':_0x1f6bc2};}if(this[_0x0494('0xd')][_0x32d7fb][_0x0494('0x45')]){faxMessage[_0x0494('0x44')](this[_0x0494('0xd')][_0x32d7fb][_0x0494('0x45')],_0x3d60f3)[_0x0494('0x3a')](function(_0x3a1e15){ut[_0x0494('0x46')](_0x0494('0x4a'),_0x3a1e15);})[_0x0494('0x3c')](function(_0x42b93a){ut[_0x0494('0x46')]('[Fax][Message][NoUpdate1]',_0x42b93a);})[_0x0494('0x4b')](function(){delete _0x15a99a['channels'][_0x32d7fb];delete _0x15a99a[_0x0494('0xd')][_0x32d7fb];});}else{ut['logger'](_0x0494('0x4c'));delete this[_0x0494('0xa')][_0x32d7fb];delete this[_0x0494('0xd')][_0x32d7fb];}};Fax['prototype']['syncHangup']=function(_0x237346){var _0x13771f=this;if(this['channels'][_0x237346[_0x0494('0x22')]]){if(this[_0x0494('0xd')][_0x237346['uniqueid']]){this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]]['id']=this['actions'][_0x237346['uniqueid']]['id'];this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]][_0x0494('0x24')]=this[_0x0494('0xd')][_0x237346[_0x0494('0x22')]][_0x0494('0x24')];}logger['info'](_0x237346[_0x0494('0x22')],this[_0x0494('0xd')][_0x237346[_0x0494('0x22')]]?'\x20hangup\x20sendFile\x20':_0x0494('0x4d'),JSON['stringify'](this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]]));if(this[_0x0494('0xd')][_0x237346[_0x0494('0x22')]]){if(this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]][_0x0494('0x4e')]>0x0&&this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]][_0x0494('0x16')]===_0x0494('0x4f')){this[_0x0494('0x49')](_0x237346['uniqueid'],!![]);}else{this[_0x0494('0x49')](_0x237346[_0x0494('0x22')],![],this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]][_0x0494('0x50')]?_0x0494('0x51')+this[_0x0494('0xa')][_0x237346[_0x0494('0x22')]][_0x0494('0x50')]:_0x0494('0x52'));}}}};Fax['prototype']['send']=function(_0x270c0f){var _0x4c36d8=this;return new BPromise(function(_0x4f5a7a,_0x112342){_0x4c36d8[_0x0494('0x53')](_0x270c0f,_0x4c36d8['faxAccounts'][_0x270c0f[_0x0494('0x54')]])[_0x0494('0x3a')](function(_0x3b4669){ut[_0x0494('0x46')]('[Fax][execOriginate][success]',_0x3b4669);_0x4f5a7a(ut[_0x0494('0x35')]('Fax\x20received'));})[_0x0494('0x3c')](function(_0x6fc126){ut[_0x0494('0x46')](_0x0494('0x55'),_0x6fc126);updateStatus(_0x270c0f);_0x112342(ut[_0x0494('0x35')]('Fax\x20failed'));});});};Fax[_0x0494('0x1d')]['checkAfterSend']=function(_0x418d91){var _0xf65ed4=this;return new BPromise(function(_0x408735,_0x4c16cc){var _0x2ceb14=_0xf65ed4[_0x0494('0x56')](_0xf65ed4[_0x0494('0xb')][_0x418d91['FaxAccountId']][_0x0494('0x57')],_0x418d91);if(_0x2ceb14[_0x0494('0x58')]){_0x408735(ut[_0x0494('0x35')]('Trunk\x20Reachable'));}else{_0x4c16cc(ut[_0x0494('0x35')](_0x2ceb14[_0x0494('0x35')]));}});};function originate(_0x4e2bd4,_0x5b7b69,_0x238236){return new BPromise(function(_0x4ca5a1,_0x46a518){if(_0x238236){var _0x5d49b4=util['format'](_0x0494('0x59'),path[_0x0494('0x37')](_0x4e2bd4['path'])[_0x0494('0x24')],_0x4e2bd4['path']);gs[_0x0494('0x5a')](_0x5d49b4)[_0x0494('0x3a')](function(){_0x4e2bd4[_0x0494('0x2')]=util[_0x0494('0x5b')](_0x0494('0x5c'),path[_0x0494('0x37')](_0x4e2bd4[_0x0494('0x2')])['dir'],path[_0x0494('0x37')](_0x4e2bd4[_0x0494('0x2')])[_0x0494('0x24')]);_0x5b7b69[_0x0494('0x5d')]=_0x4e2bd4[_0x0494('0x2')];ut[_0x0494('0x46')](_0x0494('0x5e'),'');ami[_0x0494('0x5f')](ut[_0x0494('0x60')](_0x4e2bd4,_0x5b7b69))['then'](function(_0x46d05a){_0x4ca5a1(_0x46d05a);})[_0x0494('0x3c')](function(_0x1169f1){_0x46a518(_0x1169f1);});})['catch'](function(_0x59003a){_0x46a518(_0x59003a);});}else{ami['Action'](ut[_0x0494('0x60')](_0x4e2bd4,_0x5b7b69))[_0x0494('0x3a')](function(_0x186596){_0x4ca5a1(_0x186596);})[_0x0494('0x3c')](function(_0x369547){_0x46a518(_0x369547);});}});}Fax[_0x0494('0x1d')][_0x0494('0x53')]=function(_0x412de0,_0x79a9c2){var _0x3ae7db=this;return new BPromise(function(_0x132246,_0x58a3f5){var _0x14d234=uuid['v4']();var _0x17a99a=ut['addVariables'](_0x412de0,_0x79a9c2);_0x3ae7db[_0x0494('0xd')][_0x14d234]=new Action(_0x14d234,_0x79a9c2,_0x412de0);var _0x5ecc38=_0x3ae7db[_0x0494('0xd')][_0x14d234];if(path['parse'](_0x412de0[_0x0494('0x2')])[_0x0494('0x61')]==='.pdf'){originate(_0x5ecc38,_0x17a99a,!![])[_0x0494('0x3a')](function(_0x13a228){_0x132246(_0x13a228);})[_0x0494('0x3c')](function(_0x32eb6d){_0x58a3f5(_0x32eb6d);});}else{originate(_0x5ecc38,_0x17a99a,![])[_0x0494('0x3a')](function(_0x4630a1){_0x132246(_0x4630a1);})[_0x0494('0x3c')](function(_0x1556f8){_0x58a3f5(_0x1556f8);});}});};Fax[_0x0494('0x1d')][_0x0494('0x62')]=function(_0x401d4f){return!_[_0x0494('0x63')](_0x401d4f)&&!_[_0x0494('0x63')](_0x401d4f[_0x0494('0x24')])&&!_['isNil'](_0x401d4f[_0x0494('0x64')])&&_0x401d4f[_0x0494('0x64')]&&!_['isNil'](this[_0x0494('0xc')][util[_0x0494('0x5b')]('SIP/%s',_0x401d4f[_0x0494('0x24')])])&&!_[_0x0494('0x63')](this['trunks'][util['format'](_0x0494('0x65'),_0x401d4f[_0x0494('0x24')])][_0x0494('0x2c')])&&(this[_0x0494('0xc')][util[_0x0494('0x5b')](_0x0494('0x65'),_0x401d4f[_0x0494('0x24')])][_0x0494('0x2c')]===_0x0494('0x66')||this['trunks'][util[_0x0494('0x5b')](_0x0494('0x65'),_0x401d4f[_0x0494('0x24')])]['status']===_0x0494('0x67'));};Fax['prototype'][_0x0494('0x56')]=function(_0x2d9804,_0x2d1e4c){if(!this[_0x0494('0x62')](_0x2d9804)){ut[_0x0494('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x0494('0x63')](_0x2d9804)?'':_0x2d9804[_0x0494('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0494('0x68')};}if(_[_0x0494('0x63')](_0x2d1e4c[_0x0494('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x0494('0x69')](_0x2d1e4c));return{'isValid':![],'message':_0x0494('0x6a')};}if(_['isNil'](_0x2d1e4c[_0x0494('0x2')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0494('0x69')](_0x2d1e4c));return{'isValid':![],'message':_0x0494('0x6b')};}return{'isValid':!![],'message':_0x0494('0x6c')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 15a6f91..5a65b4a 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 _0xd1b2=['error','inspect','notify','resolve','catch','[Notify]\x20','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0xb25bc7,_0xf90bd1){var _0x492d3e=function(_0x187bc6){while(--_0x187bc6){_0xb25bc7['push'](_0xb25bc7['shift']());}};_0x492d3e(++_0xf90bd1);}(_0xd1b2,0x1d2));var _0x2d1b=function(_0x4284b7,_0x3028f4){_0x4284b7=_0x4284b7-0x0;var _0x43a990=_0xd1b2[_0x4284b7];return _0x43a990;};'use strict';var util=require('util');var BPromise=require(_0x2d1b('0x0'));var logger=require(_0x2d1b('0x1'))(_0x2d1b('0x2'));var _=require('lodash');var faxAccount=require(_0x2d1b('0x3'));function loggerCatch(_0x1b902c){return function(_0x2be4ba){logger[_0x2d1b('0x4')](_0x1b902c,util[_0x2d1b('0x5')](_0x2be4ba,{'showHidden':![],'depth':null}));};}exports[_0x2d1b('0x6')]=function(_0x11e83a,_0x36e5eb){return BPromise[_0x2d1b('0x7')]()['then'](faxAccount[_0x2d1b('0x6')](_0x11e83a,_0x36e5eb))[_0x2d1b('0x8')](loggerCatch(_0x2d1b('0x9')));}; \ No newline at end of file +var _0x9c43=['[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','resolve','notify','catch'];(function(_0x513ae1,_0x598567){var _0x418895=function(_0x35dede){while(--_0x35dede){_0x513ae1['push'](_0x513ae1['shift']());}};_0x418895(++_0x598567);}(_0x9c43,0x97));var _0x39c4=function(_0x210b46,_0x52a05f){_0x210b46=_0x210b46-0x0;var _0x203df2=_0x9c43[_0x210b46];return _0x203df2;};'use strict';var util=require(_0x39c4('0x0'));var BPromise=require(_0x39c4('0x1'));var logger=require(_0x39c4('0x2'))(_0x39c4('0x3'));var _=require('lodash');var faxAccount=require(_0x39c4('0x4'));function loggerCatch(_0x1cab30){return function(_0x2de51e){logger[_0x39c4('0x5')](_0x1cab30,util['inspect'](_0x2de51e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x37c38e,_0x215a86){return BPromise[_0x39c4('0x6')]()['then'](faxAccount[_0x39c4('0x7')](_0x37c38e,_0x215a86))[_0x39c4('0x8')](loggerCatch(_0x39c4('0x9')));}; \ 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 f6b358a..ecf2832 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 _0x3d9c=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x3d9c,0x148));var _0xc3d9=function(_0x164af5,_0x4a16d1){_0x164af5=_0x164af5-0x0;var _0x1ec5e9=_0x3d9c[_0x164af5];return _0x1ec5e9;};'use strict';var util=require(_0xc3d9('0x0'));var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));var BPromise=require(_0xc3d9('0x3'));var exec=require(_0xc3d9('0x4'))['exec'];exports[_0xc3d9('0x5')]=function(_0x550002){return new BPromise(function(_0x3c5202,_0x328db4){exec(_0x550002,function(_0x1b7745,_0x4ca7f7,_0xb8e3ec){logger[_0xc3d9('0x6')](_0xc3d9('0x7'),_0x4ca7f7);if(_0x1b7745){logger[_0xc3d9('0x6')](_0xc3d9('0x7'),_0xc3d9('0x8'),util['inspect'](_0x1b7745,{'showHidden':![],'depth':null}),_0x4ca7f7,_0xb8e3ec);_0x328db4(_0x1b7745);}_0x3c5202(_0x4ca7f7);});});}; \ No newline at end of file +var _0x5ffd=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger'];(function(_0x108ed9,_0x249ffc){var _0x35293c=function(_0x32c637){while(--_0x32c637){_0x108ed9['push'](_0x108ed9['shift']());}};_0x35293c(++_0x249ffc);}(_0x5ffd,0x1ac));var _0xd5ff=function(_0x46cc63,_0x3b9be8){_0x46cc63=_0x46cc63-0x0;var _0xdb97aa=_0x5ffd[_0x46cc63];return _0xdb97aa;};'use strict';var util=require(_0xd5ff('0x0'));var logger=require(_0xd5ff('0x1'))(_0xd5ff('0x2'));var BPromise=require(_0xd5ff('0x3'));var exec=require(_0xd5ff('0x4'))[_0xd5ff('0x5')];exports[_0xd5ff('0x6')]=function(_0x4a1ca3){return new BPromise(function(_0x2da7fa,_0x326a5f){exec(_0x4a1ca3,function(_0x3bac05,_0x3b55f4,_0x5609ef){logger[_0xd5ff('0x7')](_0xd5ff('0x8'),_0x3b55f4);if(_0x3bac05){logger[_0xd5ff('0x7')]('Exec\x20gs',_0xd5ff('0x9'),util['inspect'](_0x3bac05,{'showHidden':![],'depth':null}),_0x3b55f4,_0x5609ef);_0x326a5f(_0x3bac05);}_0x2da7fa(_0x3b55f4);});});}; \ 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 ac28566..891fd5a 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 _0xa902=['gateway','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0xa902,0x8d));var _0x2a90=function(_0x4f53e5,_0x1e1c45){_0x4f53e5=_0x4f53e5-0x0;var _0x3014ad=_0xa902[_0x4f53e5];return _0x3014ad;};'use strict';var util=require(_0x2a90('0x0'));var _=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var logger=require(_0x2a90('0x3'))(_0x2a90('0x4'));exports['message']=function(_0x2da982){return{'message':_0x2da982};};exports['logger']=function(_0x4961c2,_0x169808){logger[_0x2a90('0x5')](_0x4961c2,util[_0x2a90('0x6')](_0x169808,{'showHidden':![],'depth':null}));};exports[_0x2a90('0x7')]=function(_0x4a32c7,_0x25bcfc){var _0x58369a={'XMF-ECM':_0x25bcfc[_0x2a90('0x8')],'XMF-HEADERINFO':_0x25bcfc['headerinfo'],'XMF-MINRATE':_0x25bcfc['minrate'],'XMF-MAXRATE':_0x25bcfc[_0x2a90('0x9')],'XMF-MODEM':util[_0x2a90('0xa')](_0x2a90('0xb'),_0x25bcfc[_0x2a90('0xc')]),'XMF-GATEWAY':_0x25bcfc[_0x2a90('0xd')],'XMF-FAXDETECT':_0x25bcfc['faxdetect'],'XMF-T38TIMEOUT':_0x25bcfc[_0x2a90('0xe')],'XMF-LOCALSTATIONID':_0x25bcfc[_0x2a90('0xf')],'XMF-PATH':_0x4a32c7[_0x2a90('0x10')]};return _0x58369a;};exports[_0x2a90('0x11')]=function(_0x541e22,_0x40e6aa){return{'actionid':_0x541e22['uniqueid'],'action':_0x2a90('0x12'),'channel':_0x541e22['channel'],'Exten':_0x2a90('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x2a90('0xa')](_0x2a90('0x14'),_0x541e22[_0x2a90('0x15')]?_0x541e22['headerinfo']:'',_0x541e22['localstationid']),'variable':_0x40e6aa,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x541e22['uniqueid']};}; \ No newline at end of file +var _0xfd28=['fax','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','gateway','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','localstationid','lodash','moment'];(function(_0xf4d29d,_0x5ea667){var _0x5555de=function(_0x4b8b61){while(--_0x4b8b61){_0xf4d29d['push'](_0xf4d29d['shift']());}};_0x5555de(++_0x5ea667);}(_0xfd28,0x148));var _0x8fd2=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0xfd28[_0x25fa5c];return _0x1bade2;};'use strict';var util=require('util');var _=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var logger=require('../../../../config/logger')(_0x8fd2('0x2'));exports['message']=function(_0x37baf5){return{'message':_0x37baf5};};exports[_0x8fd2('0x3')]=function(_0x4e2108,_0x4b22ae){logger[_0x8fd2('0x4')](_0x4e2108,util[_0x8fd2('0x5')](_0x4b22ae,{'showHidden':![],'depth':null}));};exports[_0x8fd2('0x6')]=function(_0x36178a,_0x2f0afc){var _0x4bdc1a={'XMF-ECM':_0x2f0afc['ecm'],'XMF-HEADERINFO':_0x2f0afc[_0x8fd2('0x7')],'XMF-MINRATE':_0x2f0afc[_0x8fd2('0x8')],'XMF-MAXRATE':_0x2f0afc[_0x8fd2('0x9')],'XMF-MODEM':util['format'](_0x8fd2('0xa'),_0x2f0afc['modem']),'XMF-GATEWAY':_0x2f0afc[_0x8fd2('0xb')],'XMF-FAXDETECT':_0x2f0afc['faxdetect'],'XMF-T38TIMEOUT':_0x2f0afc[_0x8fd2('0xc')],'XMF-LOCALSTATIONID':_0x2f0afc['localstationid'],'XMF-PATH':_0x36178a[_0x8fd2('0xd')]};return _0x4bdc1a;};exports['variablesAction']=function(_0x1b6558,_0x5caf78){return{'actionid':_0x1b6558[_0x8fd2('0xe')],'action':_0x8fd2('0xf'),'channel':_0x1b6558[_0x8fd2('0x10')],'Exten':_0x8fd2('0x11'),'Context':_0x8fd2('0x12'),'Priority':'1','callerid':util[_0x8fd2('0x13')](_0x8fd2('0x14'),_0x1b6558[_0x8fd2('0x7')]?_0x1b6558[_0x8fd2('0x7')]:'',_0x1b6558[_0x8fd2('0x15')]),'variable':_0x5caf78,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b6558[_0x8fd2('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index af7e574..3797f90 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 _0xd8b0=['./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initVoiceExtensions','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','bluebird','util','./report','./acw'];(function(_0x287b2c,_0x408bf4){var _0xc4fccf=function(_0x5c5c45){while(--_0x5c5c45){_0x287b2c['push'](_0x287b2c['shift']());}};_0xc4fccf(++_0x408bf4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x0d8b('0x2'));var Acw=require(_0x0d8b('0x3'));var Trigger=require(_0x0d8b('0x4'));var Dialer=require(_0x0d8b('0x5'));var Preview=require(_0x0d8b('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0d8b('0x7'));var voiceQueueReport=require(_0x0d8b('0x8'));var voiceCallReport=require(_0x0d8b('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x0d8b('0xa'));var template=require(_0x0d8b('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0d8b('0xc'));var voiceExtension=require(_0x0d8b('0xd'));var faxAccount=require(_0x0d8b('0xe'));var zendesk=require(_0x0d8b('0xf'));var salesforce=require(_0x0d8b('0x10'));var sugarcrm=require(_0x0d8b('0x11'));var freshdesk=require(_0x0d8b('0x12'));var desk=require(_0x0d8b('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0d8b('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0d8b('0x15'));var dynamics365=require(_0x0d8b('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0d8b('0x17')](_0x0d8b('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0d8b('0x17')](_0x0d8b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0d8b('0x19')]()[_0x0d8b('0x1a')](user[_0x0d8b('0x1b')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x1c')]())[_0x0d8b('0x1a')](user[_0x0d8b('0x1d')]())[_0x0d8b('0x1a')](realtime['initTelephones']())[_0x0d8b('0x1a')](trunk[_0x0d8b('0x1e')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x1f')]())[_0x0d8b('0x1a')](voiceQueue['getVoiceQueues']())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x20')]())[_0x0d8b('0x1a')](trigger[_0x0d8b('0x21')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x22')]())[_0x0d8b('0x1a')](template[_0x0d8b('0x23')]())['then'](realtime[_0x0d8b('0x24')]())[_0x0d8b('0x1a')](zendesk[_0x0d8b('0x25')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x26')]())[_0x0d8b('0x1a')](salesforce[_0x0d8b('0x27')]())[_0x0d8b('0x1a')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x0d8b('0x28')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0d8b('0x29')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x2a')]())[_0x0d8b('0x1a')](desk[_0x0d8b('0x2b')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x2c')]())[_0x0d8b('0x1a')](zoho[_0x0d8b('0x2d')]())['then'](realtime[_0x0d8b('0x2e')]())[_0x0d8b('0x1a')](vtiger['getVtigerAccounts']())[_0x0d8b('0x1a')](realtime['initVtigerAccounts']())[_0x0d8b('0x1a')](freshsales[_0x0d8b('0x2f')]())[_0x0d8b('0x1a')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x0d8b('0x30')]())[_0x0d8b('0x1a')](realtime['initServicenowAccounts']())[_0x0d8b('0x1a')](dynamics365['getDynamics365Accounts']())[_0x0d8b('0x1a')](realtime['initDynamics365Accounts']())[_0x0d8b('0x1a')](campaign['getCampaigns']())[_0x0d8b('0x1a')](realtime['initCampaigns']())[_0x0d8b('0x1a')](voiceExtension['getVoiceExtensions']())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x31')]())[_0x0d8b('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x0d8b('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x0d8b('0x1a')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x0d8b('0x32')]())[_0x0d8b('0x1a')](cmHopperHistory[_0x0d8b('0x33')]())[_0x0d8b('0x1a')](realtime[_0x0d8b('0x34')]())[_0x0d8b('0x1a')](cmHopperHistory[_0x0d8b('0x35')]())[_0x0d8b('0x1a')](realtime['initCampaignHopperHistory']())[_0x0d8b('0x1a')](voiceCallReport[_0x0d8b('0x36')]())['then'](realtime[_0x0d8b('0x37')]())[_0x0d8b('0x1a')](function(_0x18a905){})['catch'](function(_0x113318){console[_0x0d8b('0x38')](_0x113318);});}function main(){return server[_0x0d8b('0x39')](realtime,preview,fax)[_0x0d8b('0x1a')](function(_0x933e01){return initRealtime();})['then'](function(){return initParams();})[_0x0d8b('0x1a')](function(){report[_0x0d8b('0x3a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1180ac){console[_0x0d8b('0x38')](_0x1180ac);});}main(); \ No newline at end of file +var _0x8603=['initDeskAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','util','moment','./server','./acw','./trigger','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x8603,0x190));var _0x3860=function(_0x472656,_0x6672a9){_0x472656=_0x472656-0x0;var _0x4b1e44=_0x8603[_0x472656];return _0x4b1e44;};'use strict';var BPromise=require('bluebird');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var server=require(_0x3860('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x3860('0x3'));var Trigger=require(_0x3860('0x4'));var Dialer=require(_0x3860('0x5'));var Preview=require('./preview');var Fax=require(_0x3860('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x3860('0x7'));var voiceQueueReport=require(_0x3860('0x8'));var voiceCallReport=require(_0x3860('0x9'));var trunk=require(_0x3860('0xa'));var trigger=require(_0x3860('0xb'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x3860('0xc'));var faxAccount=require(_0x3860('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x3860('0xe'));var sugarcrm=require(_0x3860('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x3860('0x10'));var zoho=require(_0x3860('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x3860('0x12'));var servicenow=require(_0x3860('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()[_0x3860('0x14')](_0x3860('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3860('0x14')](_0x3860('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3860('0x16')]()[_0x3860('0x17')](user[_0x3860('0x18')]())[_0x3860('0x17')](realtime[_0x3860('0x19')]())[_0x3860('0x17')](user['getTelephones']())[_0x3860('0x17')](realtime[_0x3860('0x1a')]())[_0x3860('0x17')](trunk[_0x3860('0x1b')]())[_0x3860('0x17')](realtime[_0x3860('0x1c')]())[_0x3860('0x17')](voiceQueue[_0x3860('0x1d')]())[_0x3860('0x17')](realtime[_0x3860('0x1e')]())[_0x3860('0x17')](trigger[_0x3860('0x1f')]())['then'](realtime['initTriggers']())[_0x3860('0x17')](template[_0x3860('0x20')]())[_0x3860('0x17')](realtime['initTemplates']())[_0x3860('0x17')](zendesk[_0x3860('0x21')]())[_0x3860('0x17')](realtime[_0x3860('0x22')]())[_0x3860('0x17')](salesforce[_0x3860('0x23')]())[_0x3860('0x17')](realtime[_0x3860('0x24')]())[_0x3860('0x17')](sugarcrm[_0x3860('0x25')]())[_0x3860('0x17')](realtime[_0x3860('0x26')]())[_0x3860('0x17')](freshdesk[_0x3860('0x27')]())[_0x3860('0x17')](realtime['initFreshdeskAccounts']())[_0x3860('0x17')](desk[_0x3860('0x28')]())[_0x3860('0x17')](realtime[_0x3860('0x29')]())[_0x3860('0x17')](zoho['getZohoAccounts']())[_0x3860('0x17')](realtime['initZohoAccounts']())['then'](vtiger[_0x3860('0x2a')]())[_0x3860('0x17')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x3860('0x17')](realtime[_0x3860('0x2b')]())[_0x3860('0x17')](servicenow[_0x3860('0x2c')]())[_0x3860('0x17')](realtime[_0x3860('0x2d')]())['then'](dynamics365['getDynamics365Accounts']())[_0x3860('0x17')](realtime[_0x3860('0x2e')]())['then'](campaign[_0x3860('0x2f')]())[_0x3860('0x17')](realtime[_0x3860('0x30')]())[_0x3860('0x17')](voiceExtension[_0x3860('0x31')]())['then'](realtime[_0x3860('0x32')]())[_0x3860('0x17')](faxAccount[_0x3860('0x33')]())['then'](realtime[_0x3860('0x34')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x3860('0x16')]()['then'](voiceQueueReport[_0x3860('0x35')]())[_0x3860('0x17')](realtime[_0x3860('0x36')]())['then'](cmHopperHistory[_0x3860('0x37')]())[_0x3860('0x17')](realtime['initVoiceQueueHopperHistory']())[_0x3860('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0x3860('0x17')](realtime[_0x3860('0x38')]())[_0x3860('0x17')](voiceCallReport[_0x3860('0x39')]())[_0x3860('0x17')](realtime[_0x3860('0x3a')]())[_0x3860('0x17')](function(_0x4d30bc){})[_0x3860('0x3b')](function(_0x396ccf){console['log'](_0x396ccf);});}function main(){return server[_0x3860('0x3c')](realtime,preview,fax)[_0x3860('0x17')](function(_0x3a17ea){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x3860('0x3d')]();setInterval(initRealtime,0x1388);})[_0x3860('0x3b')](function(_0x3abf18){console[_0x3860('0x3e')](_0x3abf18);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 327f99a..b7510b3 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 _0x43a0=['phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','idle','inuse','talking','statePause','toNumber','format','voiceStatusQueue','interface','stringify','user:%s','user:save','emit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address'];(function(_0x16a69b,_0x158dcf){var _0x117e9d=function(_0x21c7f7){while(--_0x21c7f7){_0x16a69b['push'](_0x16a69b['shift']());}};_0x117e9d(++_0x158dcf);}(_0x43a0,0x107));var _0x043a=function(_0x40c37a,_0x274ea9){_0x40c37a=_0x40c37a-0x0;var _0x24cd0b=_0x43a0[_0x40c37a];return _0x24cd0b;};'use strict';var _=require(_0x043a('0x0'));var util=require(_0x043a('0x1'));var moment=require(_0x043a('0x2'));var md5=require(_0x043a('0x3'));var Redis=require(_0x043a('0x4'));var config=require(_0x043a('0x5'));config[_0x043a('0x6')]=_['defaults'](config[_0x043a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x043a('0x7'))(new Redis(config['redis']));function Agent(_0x43f883){this['id']=_0x43f883['id']||0x0;this['name']=_0x43f883[_0x043a('0x8')]||'';this[_0x043a('0x9')]=_0x43f883['email']||'';this[_0x043a('0xa')]=_0x43f883['accountcode']||'';this[_0x043a('0xb')]=_0x43f883['fullname']||'';this[_0x043a('0xc')]=_0x043a('0xd');this[_0x043a('0xe')]=0x0;this[_0x043a('0xf')]='unknown';this[_0x043a('0x10')]='';this[_0x043a('0x11')]='';this['mobile']='';this['interface']='';this[_0x043a('0x12')]=_0x43f883[_0x043a('0x12')]||![];this[_0x043a('0x13')]=_0x043a('0xd');this[_0x043a('0x14')]=0x0;this[_0x043a('0x15')]='';this['voiceStatusQueue']='';this[_0x043a('0x16')]=![];this[_0x043a('0x17')]=![];this[_0x043a('0x3')]='';}Agent[_0x043a('0x18')][_0x043a('0x19')]=function(_0x566e27){var _0x5f2601;if(_0x566e27&&_0x566e27[_0x043a('0xc')]){_0x5f2601=_0x566e27['state']['toLowerCase']();switch(_0x5f2601){case'not_inuse':_0x5f2601=_0x043a('0x1a');break;case _0x043a('0x1b'):_0x5f2601=_0x043a('0x1c');break;}}if(_0x5f2601&&this[_0x043a('0x13')]!==_0x5f2601||_0x566e27[_0x043a('0x1d')]){this['voiceStatusTime']=_[_0x043a('0x1e')](moment()[_0x043a('0x1f')]('x'));}if(_0x5f2601){this[_0x043a('0x13')]=_0x5f2601;}var _0x42a83c={'id':this['id'],'name':this[_0x043a('0x8')],'email':this[_0x043a('0x9')],'accountcode':this[_0x043a('0xa')],'fullname':this[_0x043a('0xb')],'state':this[_0x043a('0xc')],'stateTime':this[_0x043a('0xe')],'status':this['status'],'address':this[_0x043a('0x10')],'online':this[_0x043a('0x12')],'voiceStatus':this[_0x043a('0x13')],'voiceStatusTime':this[_0x043a('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x043a('0x20')],'interface':this[_0x043a('0x21')],'onhold':this['onhold']};var _0x310849=md5(JSON[_0x043a('0x22')](_0x42a83c));if(this[_0x043a('0x3')]!==_0x310849){this[_0x043a('0x3')]=_0x310849;io['to'](util[_0x043a('0x1f')](_0x043a('0x23'),_0x42a83c['name']))['emit'](_0x043a('0x24'),_0x42a83c);io[_0x043a('0x25')](_0x043a('0x26'),_0x42a83c);}};module[_0x043a('0x27')]=Agent; \ No newline at end of file +var _0xe5d5=['phone','mobile','interface','online','voiceStatus','unknown','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','talking','toNumber','format','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','localhost','name','email','fullname','state','stateTime','status','address'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5d5,0x189));var _0x5e5d=function(_0x16d25a,_0x111501){_0x16d25a=_0x16d25a-0x0;var _0x55c98e=_0xe5d5[_0x16d25a];return _0x55c98e;};'use strict';var _=require(_0x5e5d('0x0'));var util=require(_0x5e5d('0x1'));var moment=require(_0x5e5d('0x2'));var md5=require(_0x5e5d('0x3'));var Redis=require('ioredis');var config=require(_0x5e5d('0x4'));config[_0x5e5d('0x5')]=_['defaults'](config[_0x5e5d('0x5')],{'host':_0x5e5d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5a9261){this['id']=_0x5a9261['id']||0x0;this[_0x5e5d('0x7')]=_0x5a9261['name']||'';this[_0x5e5d('0x8')]=_0x5a9261[_0x5e5d('0x8')]||'';this['accountcode']=_0x5a9261['accountcode']||'';this[_0x5e5d('0x9')]=_0x5a9261[_0x5e5d('0x9')]||'';this[_0x5e5d('0xa')]='unknown';this[_0x5e5d('0xb')]=0x0;this[_0x5e5d('0xc')]='unknown';this[_0x5e5d('0xd')]='';this[_0x5e5d('0xe')]='';this[_0x5e5d('0xf')]='';this[_0x5e5d('0x10')]='';this[_0x5e5d('0x11')]=_0x5a9261[_0x5e5d('0x11')]||![];this[_0x5e5d('0x12')]=_0x5e5d('0x13');this[_0x5e5d('0x14')]=0x0;this[_0x5e5d('0x15')]='';this[_0x5e5d('0x16')]='';this[_0x5e5d('0x17')]=![];this[_0x5e5d('0x18')]=![];this[_0x5e5d('0x3')]='';}Agent[_0x5e5d('0x19')][_0x5e5d('0x1a')]=function(_0x1cd8d1){var _0x46a159;if(_0x1cd8d1&&_0x1cd8d1[_0x5e5d('0xa')]){_0x46a159=_0x1cd8d1['state'][_0x5e5d('0x1b')]();switch(_0x46a159){case'not_inuse':_0x46a159=_0x5e5d('0x1c');break;case'inuse':_0x46a159=_0x5e5d('0x1d');break;}}if(_0x46a159&&this[_0x5e5d('0x12')]!==_0x46a159||_0x1cd8d1['statePause']){this[_0x5e5d('0x14')]=_[_0x5e5d('0x1e')](moment()[_0x5e5d('0x1f')]('x'));}if(_0x46a159){this[_0x5e5d('0x12')]=_0x46a159;}var _0x1a41d3={'id':this['id'],'name':this[_0x5e5d('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x5e5d('0x9')],'state':this['state'],'stateTime':this[_0x5e5d('0xb')],'status':this[_0x5e5d('0xc')],'address':this[_0x5e5d('0xd')],'online':this[_0x5e5d('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x5e5d('0x15')],'voiceStatusQueue':this[_0x5e5d('0x16')],'interface':this[_0x5e5d('0x10')],'onhold':this[_0x5e5d('0x17')]};var _0x5d40e1=md5(JSON[_0x5e5d('0x20')](_0x1a41d3));if(this['md5']!==_0x5d40e1){this[_0x5e5d('0x3')]=_0x5d40e1;io['to'](util['format'](_0x5e5d('0x21'),_0x1a41d3[_0x5e5d('0x7')]))[_0x5e5d('0x22')](_0x5e5d('0x23'),_0x1a41d3);io['emit']('user:presence',_0x1a41d3);}};module[_0x5e5d('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 29ac6f9..39d232e 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 _0xf2c9=['Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup'];(function(_0x5f08d4,_0x4e8e03){var _0x16a2df=function(_0x4003db){while(--_0x4003db){_0x5f08d4['push'](_0x5f08d4['shift']());}};_0x16a2df(++_0x4e8e03);}(_0xf2c9,0xa4));var _0x9f2c=function(_0xdbaf7f,_0x2ffdf7){_0xdbaf7f=_0xdbaf7f-0x0;var _0x2b296b=_0xf2c9[_0xdbaf7f];return _0x2b296b;};'use strict';function Campaign(_0x2b2e84){this['id']=_0x2b2e84['id']||0x0;this[_0x9f2c('0x0')]=_0x2b2e84[_0x9f2c('0x0')]||'';this[_0x9f2c('0x1')]=_0x2b2e84[_0x9f2c('0x1')]||'campaign';this[_0x9f2c('0x2')]=0x0;this[_0x9f2c('0x3')]=0x0;this[_0x9f2c('0x4')]=0x0;this[_0x9f2c('0x5')]=0x0;this[_0x9f2c('0x6')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x2b2e84[_0x9f2c('0x7')];this[_0x9f2c('0x8')]=_0x2b2e84['limitCalls'];this[_0x9f2c('0x9')]=_0x2b2e84[_0x9f2c('0x9')]||null;this['dialGlobalInterval']=_0x2b2e84[_0x9f2c('0xa')]?_0x2b2e84[_0x9f2c('0xa')]:null;this[_0x9f2c('0xb')]=_0x2b2e84[_0x9f2c('0xb')];this[_0x9f2c('0xc')]=_0x2b2e84[_0x9f2c('0xc')];this['dialOriginateTimeout']=_0x2b2e84[_0x9f2c('0xd')]||0x1e;this[_0x9f2c('0xe')]=_0x2b2e84[_0x9f2c('0xe')];this[_0x9f2c('0xf')]=_0x2b2e84[_0x9f2c('0xf')];this[_0x9f2c('0x10')]=_0x2b2e84[_0x9f2c('0x10')];this['dialBusyRetryFrequency']=_0x2b2e84[_0x9f2c('0x11')];this[_0x9f2c('0x12')]=_0x2b2e84[_0x9f2c('0x12')];this[_0x9f2c('0x13')]=_0x2b2e84['dialNoAnswerRetryFrequency'];this[_0x9f2c('0x14')]=_0x2b2e84['dialGlobalMaxRetry'];this[_0x9f2c('0x15')]=_0x2b2e84[_0x9f2c('0x15')]||0x3;this[_0x9f2c('0x16')]=_0x2b2e84[_0x9f2c('0x16')]||0x96;this[_0x9f2c('0x17')]=_0x2b2e84[_0x9f2c('0x17')]||0x3;this[_0x9f2c('0x18')]=_0x2b2e84['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x2b2e84[_0x9f2c('0x19')]||0x3;this[_0x9f2c('0x1a')]=_0x2b2e84[_0x9f2c('0x1a')]||0x96;this[_0x9f2c('0x1b')]=_0x2b2e84[_0x9f2c('0x1b')]||0x3;this[_0x9f2c('0x1c')]=_0x2b2e84['dialMachineRetryFrequency']||0x96;this[_0x9f2c('0x1d')]=_0x2b2e84[_0x9f2c('0x1d')]||0x3;this[_0x9f2c('0x1e')]=_0x2b2e84[_0x9f2c('0x1e')]||0x96;this[_0x9f2c('0x1f')]=_0x2b2e84[_0x9f2c('0x1f')]||_0x9f2c('0x20');this['dialPrefix']=_0x2b2e84[_0x9f2c('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2b2e84['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9f2c('0x22')]=_0x2b2e84[_0x9f2c('0x22')]||undefined;this[_0x9f2c('0x23')]=_0x2b2e84[_0x9f2c('0x23')]?_0x2b2e84[_0x9f2c('0x23')]:undefined;this[_0x9f2c('0x24')]=_0x2b2e84['Trunk']?_0x2b2e84[_0x9f2c('0x24')]:undefined;this['Interval']=_0x2b2e84[_0x9f2c('0x25')]?_0x2b2e84[_0x9f2c('0x25')]:undefined;this[_0x9f2c('0x26')]=_0x2b2e84[_0x9f2c('0x26')]?_0x2b2e84['SquareProject']:undefined;this['dialQueueProject']=_0x2b2e84['SquareProject']?_0x2b2e84[_0x9f2c('0x26')][_0x9f2c('0x0')]:undefined;this[_0x9f2c('0x27')]=_0x2b2e84['dialAMDActive']||![];this[_0x9f2c('0x28')]=_0x2b2e84[_0x9f2c('0x28')];this[_0x9f2c('0x29')]=_0x2b2e84[_0x9f2c('0x29')];this['dialAMDAfterGreetingSilence']=_0x2b2e84[_0x9f2c('0x2a')];this[_0x9f2c('0x2b')]=_0x2b2e84[_0x9f2c('0x2b')];this[_0x9f2c('0x2c')]=_0x2b2e84[_0x9f2c('0x2c')];this[_0x9f2c('0x2d')]=_0x2b2e84[_0x9f2c('0x2d')];this[_0x9f2c('0x2e')]=_0x2b2e84[_0x9f2c('0x2e')];this[_0x9f2c('0x2f')]=_0x2b2e84[_0x9f2c('0x2f')];this['dialAMDMaximumWordLength']=_0x2b2e84[_0x9f2c('0x30')];}module[_0x9f2c('0x31')]=Campaign; \ No newline at end of file +var _0xba73=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x2df11a,_0xfb1a4f){var _0x4fefbd=function(_0x372678){while(--_0x372678){_0x2df11a['push'](_0x2df11a['shift']());}};_0x4fefbd(++_0xfb1a4f);}(_0xba73,0x6b));var _0x3ba7=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xba73[_0x7e2eb0];return _0xd92de4;};'use strict';function Campaign(_0x43e2b8){this['id']=_0x43e2b8['id']||0x0;this[_0x3ba7('0x0')]=_0x43e2b8[_0x3ba7('0x0')]||'';this[_0x3ba7('0x1')]=_0x43e2b8[_0x3ba7('0x1')]||'campaign';this[_0x3ba7('0x2')]=0x0;this['temp']=0x0;this[_0x3ba7('0x3')]=0x0;this[_0x3ba7('0x4')]=0x0;this[_0x3ba7('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x3ba7('0x6')]=_0x43e2b8[_0x3ba7('0x6')];this[_0x3ba7('0x7')]=_0x43e2b8[_0x3ba7('0x7')];this[_0x3ba7('0x8')]=_0x43e2b8[_0x3ba7('0x8')]||null;this[_0x3ba7('0x9')]=_0x43e2b8[_0x3ba7('0x9')]?_0x43e2b8[_0x3ba7('0x9')]:null;this[_0x3ba7('0xa')]=_0x43e2b8['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x43e2b8[_0x3ba7('0xb')];this[_0x3ba7('0xc')]=_0x43e2b8[_0x3ba7('0xc')]||0x1e;this[_0x3ba7('0xd')]=_0x43e2b8['dialCongestionMaxRetry'];this[_0x3ba7('0xe')]=_0x43e2b8[_0x3ba7('0xe')];this[_0x3ba7('0xf')]=_0x43e2b8[_0x3ba7('0xf')];this[_0x3ba7('0x10')]=_0x43e2b8[_0x3ba7('0x10')];this['dialNoAnswerMaxRetry']=_0x43e2b8[_0x3ba7('0x11')];this[_0x3ba7('0x12')]=_0x43e2b8[_0x3ba7('0x12')];this['dialGlobalMaxRetry']=_0x43e2b8['dialGlobalMaxRetry'];this[_0x3ba7('0x13')]=_0x43e2b8[_0x3ba7('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43e2b8[_0x3ba7('0x14')]||0x96;this[_0x3ba7('0x15')]=_0x43e2b8[_0x3ba7('0x15')]||0x3;this[_0x3ba7('0x16')]=_0x43e2b8[_0x3ba7('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x43e2b8['dialAbandonedMaxRetry']||0x3;this[_0x3ba7('0x17')]=_0x43e2b8['dialAbandonedRetryFrequency']||0x96;this[_0x3ba7('0x18')]=_0x43e2b8['dialMachineMaxRetry']||0x3;this[_0x3ba7('0x19')]=_0x43e2b8['dialMachineRetryFrequency']||0x96;this[_0x3ba7('0x1a')]=_0x43e2b8[_0x3ba7('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x43e2b8['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x43e2b8[_0x3ba7('0x1b')]||_0x3ba7('0x1c');this[_0x3ba7('0x1d')]=_0x43e2b8['dialPrefix']||undefined;this[_0x3ba7('0x1e')]=_0x43e2b8[_0x3ba7('0x1e')]||undefined;this[_0x3ba7('0x1f')]=_0x43e2b8[_0x3ba7('0x1f')]||undefined;this[_0x3ba7('0x20')]=_0x43e2b8[_0x3ba7('0x20')]?_0x43e2b8[_0x3ba7('0x20')]:undefined;this[_0x3ba7('0x21')]=_0x43e2b8[_0x3ba7('0x21')]?_0x43e2b8[_0x3ba7('0x21')]:undefined;this[_0x3ba7('0x22')]=_0x43e2b8[_0x3ba7('0x22')]?_0x43e2b8[_0x3ba7('0x22')]:undefined;this[_0x3ba7('0x23')]=_0x43e2b8['SquareProject']?_0x43e2b8[_0x3ba7('0x23')]:undefined;this[_0x3ba7('0x24')]=_0x43e2b8[_0x3ba7('0x23')]?_0x43e2b8[_0x3ba7('0x23')][_0x3ba7('0x0')]:undefined;this[_0x3ba7('0x25')]=_0x43e2b8[_0x3ba7('0x25')]||![];this['dialAMDInitialSilence']=_0x43e2b8['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x43e2b8[_0x3ba7('0x26')];this[_0x3ba7('0x27')]=_0x43e2b8[_0x3ba7('0x27')];this[_0x3ba7('0x28')]=_0x43e2b8['dialAMDTotalAnalysisTime'];this[_0x3ba7('0x29')]=_0x43e2b8['dialAMDMinWordLength'];this[_0x3ba7('0x2a')]=_0x43e2b8[_0x3ba7('0x2a')];this[_0x3ba7('0x2b')]=_0x43e2b8['dialAMDMaximumNumberOfWords'];this[_0x3ba7('0x2c')]=_0x43e2b8[_0x3ba7('0x2c')];this['dialAMDMaximumWordLength']=_0x43e2b8[_0x3ba7('0x2d')];}module[_0x3ba7('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 166d275..be040bc 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 _0x9087=['exten','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x9087,0x17e));var _0x7908=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9087[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x7908('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x7908('0x1')]=0x0;this[_0x7908('0x2')]='';this[_0x7908('0x3')]=undefined;this[_0x7908('0x4')]=undefined;this['accountcode']=0x0;this[_0x7908('0x5')]='';this[_0x7908('0x6')]=0x0;this[_0x7908('0x7')]=0x0;this[_0x7908('0x8')]=0x0;this['answered']=![];this[_0x7908('0x9')]=null;this[_0x7908('0xa')]=null;this[_0x7908('0xb')]=![];this[_0x7908('0xc')]=![];this[_0x7908('0xd')]='';this['lastdata']='';this[_0x7908('0xe')]=0x0;this[_0x7908('0xf')]=0x0;this[_0x7908('0x10')]=0x0;this[_0x7908('0x11')]=null;this[_0x7908('0x12')]=null;this['disposition']=null;this[_0x7908('0x13')]=![];this[_0x7908('0x14')]=null;this[_0x7908('0x15')]=null;this[_0x7908('0x16')]=[];this[_0x7908('0x17')]=undefined;this[_0x7908('0x18')]=undefined;this[_0x7908('0x19')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xf4d2=['unmanaged','abandoned','lastapplication','duration','holdtime','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xf4d2,0x1a3));var _0x2f4d=function(_0x4e5c3d,_0x5ea582){_0x4e5c3d=_0x4e5c3d-0x0;var _0x10787b=_0xf4d2[_0x4e5c3d];return _0x10787b;};'use strict';function Channel(){this[_0x2f4d('0x0')]=null;this[_0x2f4d('0x1')]='';this[_0x2f4d('0x2')]='';this[_0x2f4d('0x3')]=0x0;this[_0x2f4d('0x4')]='';this[_0x2f4d('0x5')]=undefined;this[_0x2f4d('0x6')]=undefined;this['accountcode']=0x0;this[_0x2f4d('0x7')]='';this[_0x2f4d('0x8')]=0x0;this[_0x2f4d('0x9')]=0x0;this[_0x2f4d('0xa')]=0x0;this[_0x2f4d('0xb')]=![];this[_0x2f4d('0xc')]=null;this['endtime']=null;this[_0x2f4d('0xd')]=![];this[_0x2f4d('0xe')]=![];this[_0x2f4d('0xf')]='';this['lastdata']='';this[_0x2f4d('0x10')]=0x0;this['billableseconds']=0x0;this[_0x2f4d('0x11')]=0x0;this['type']=null;this[_0x2f4d('0x12')]=null;this['disposition']=null;this[_0x2f4d('0x13')]=![];this[_0x2f4d('0x14')]=null;this[_0x2f4d('0x15')]=null;this[_0x2f4d('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x2f4d('0x17')]=undefined;this[_0x2f4d('0x18')]=undefined;this[_0x2f4d('0x19')]=0x0;}module[_0x2f4d('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c5fa243..31a5d49 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 _0x7f90=['Configurations','exports','name','username','authType','password','consumerKey','consumerSecret','tokenSecret','type','serverUrl'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x7f90,0xf4));var _0x07f9=function(_0x37e307,_0x378e6c){_0x37e307=_0x37e307-0x0;var _0x44a38c=_0x7f90[_0x37e307];return _0x44a38c;};'use strict';function DeskAccount(_0x172b8d){this['id']=_0x172b8d['id']||0x0;this[_0x07f9('0x0')]=_0x172b8d[_0x07f9('0x0')]||'';this[_0x07f9('0x1')]=_0x172b8d[_0x07f9('0x1')]||'';this['remoteUri']=_0x172b8d['remoteUri']||'';this[_0x07f9('0x2')]=_0x172b8d[_0x07f9('0x2')]||'';this['password']=_0x172b8d[_0x07f9('0x3')]||'';this[_0x07f9('0x4')]=_0x172b8d[_0x07f9('0x4')]||'';this[_0x07f9('0x5')]=_0x172b8d[_0x07f9('0x5')]||'';this['token']=_0x172b8d['token']||'';this[_0x07f9('0x6')]=_0x172b8d[_0x07f9('0x6')]||'';this['type']=_0x172b8d[_0x07f9('0x7')]||'';this['serverUrl']=_0x172b8d[_0x07f9('0x8')]||'';this[_0x07f9('0x9')]=_0x172b8d[_0x07f9('0x9')]||{};}module[_0x07f9('0xa')]=DeskAccount; \ No newline at end of file +var _0x861c=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x5a4812,_0x389986){var _0x5737cd=function(_0x56a9e5){while(--_0x56a9e5){_0x5a4812['push'](_0x5a4812['shift']());}};_0x5737cd(++_0x389986);}(_0x861c,0xdb));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';function DeskAccount(_0x5909ce){this['id']=_0x5909ce['id']||0x0;this[_0xc861('0x0')]=_0x5909ce[_0xc861('0x0')]||'';this[_0xc861('0x1')]=_0x5909ce[_0xc861('0x1')]||'';this[_0xc861('0x2')]=_0x5909ce[_0xc861('0x2')]||'';this[_0xc861('0x3')]=_0x5909ce[_0xc861('0x3')]||'';this[_0xc861('0x4')]=_0x5909ce[_0xc861('0x4')]||'';this[_0xc861('0x5')]=_0x5909ce['consumerKey']||'';this[_0xc861('0x6')]=_0x5909ce[_0xc861('0x6')]||'';this[_0xc861('0x7')]=_0x5909ce[_0xc861('0x7')]||'';this[_0xc861('0x8')]=_0x5909ce[_0xc861('0x8')]||'';this[_0xc861('0x9')]=_0x5909ce[_0xc861('0x9')]||'';this[_0xc861('0xa')]=_0x5909ce[_0xc861('0xa')]||'';this[_0xc861('0xb')]=_0x5909ce[_0xc861('0xb')]||{};}module[_0xc861('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0afb077..686268b 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 _0xc951=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username','password'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xc951,0x114));var _0x1c95=function(_0xb260c3,_0x12a001){_0xb260c3=_0xb260c3-0x0;var _0x374c93=_0xc951[_0xb260c3];return _0x374c93;};'use strict';function Dynamics365Account(_0x1de77b){this['id']=_0x1de77b['id']||0x0;this[_0x1c95('0x0')]=_0x1de77b[_0x1c95('0x0')]||'';this[_0x1c95('0x1')]=_0x1de77b['username']||'';this[_0x1c95('0x2')]=_0x1de77b[_0x1c95('0x2')]||'';this[_0x1c95('0x3')]=_0x1de77b[_0x1c95('0x3')]||'';this[_0x1c95('0x4')]=_0x1de77b[_0x1c95('0x4')]||'';this['clientId']=_0x1de77b[_0x1c95('0x5')]||'';this[_0x1c95('0x6')]=_0x1de77b[_0x1c95('0x6')]||{};this[_0x1c95('0x7')]=_0x1de77b[_0x1c95('0x7')]||'';this[_0x1c95('0x8')]=_0x1de77b[_0x1c95('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x62a8=['clientSecret','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x62a8,0x8a));var _0x862a=function(_0x335d53,_0x54dec8){_0x335d53=_0x335d53-0x0;var _0x97480c=_0x62a8[_0x335d53];return _0x97480c;};'use strict';function Dynamics365Account(_0x38ffe2){this['id']=_0x38ffe2['id']||0x0;this[_0x862a('0x0')]=_0x38ffe2[_0x862a('0x0')]||'';this[_0x862a('0x1')]=_0x38ffe2[_0x862a('0x1')]||'';this[_0x862a('0x2')]=_0x38ffe2['password']||'';this[_0x862a('0x3')]=_0x38ffe2[_0x862a('0x3')]||'';this[_0x862a('0x4')]=_0x38ffe2[_0x862a('0x4')]||'';this[_0x862a('0x5')]=_0x38ffe2[_0x862a('0x5')]||'';this[_0x862a('0x6')]=_0x38ffe2[_0x862a('0x6')]||{};this['serverUrl']=_0x38ffe2['serverUrl']||'';this[_0x862a('0x7')]=_0x38ffe2['Configurations']||{};}module[_0x862a('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b4e4806..a6094bd 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 _0x031e=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description'];(function(_0x234b39,_0xd34181){var _0x2d7140=function(_0xa23ddf){while(--_0xa23ddf){_0x234b39['push'](_0x234b39['shift']());}};_0x2d7140(++_0xd34181);}(_0x031e,0x75));var _0xe031=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x031e[_0xb6e43];return _0x47c40f;};'use strict';function FaxAccount(_0x581b65){this['id']=_0x581b65['id']||0x0;this[_0xe031('0x0')]=_0x581b65[_0xe031('0x0')]||'';this[_0xe031('0x1')]=_0x581b65[_0xe031('0x1')];this['ecm']=_0x581b65[_0xe031('0x2')];this[_0xe031('0x3')]=_0x581b65[_0xe031('0x3')];this[_0xe031('0x4')]=_0x581b65[_0xe031('0x4')];this[_0xe031('0x5')]=_0x581b65['minrate']||0x960;this['maxrate']=_0x581b65[_0xe031('0x6')]||0x3840;this['modem']=_0x581b65[_0xe031('0x7')]||_0xe031('0x8');this[_0xe031('0x9')]=_0x581b65['gateway']||'no';this[_0xe031('0xa')]=_0x581b65[_0xe031('0xa')]||'no';this[_0xe031('0xb')]=_0x581b65[_0xe031('0xb')]||0x1388;this[_0xe031('0xc')]=_0x581b65[_0xe031('0xc')]||'SIP';this[_0xe031('0xd')]=_0x581b65[_0xe031('0xd')]?_0x581b65[_0xe031('0xd')]:undefined;this['ListId']=_0x581b65[_0xe031('0xe')];this[_0xe031('0xf')]=_0x581b65[_0xe031('0xf')];}module[_0xe031('0x10')]=FaxAccount; \ No newline at end of file +var _0x5184=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x1ba6b5,_0x5bf8ca){var _0x4f2f80=function(_0x5d1de0){while(--_0x5d1de0){_0x1ba6b5['push'](_0x1ba6b5['shift']());}};_0x4f2f80(++_0x5bf8ca);}(_0x5184,0x1b5));var _0x4518=function(_0x3801d1,_0x21860c){_0x3801d1=_0x3801d1-0x0;var _0x24d322=_0x5184[_0x3801d1];return _0x24d322;};'use strict';function FaxAccount(_0x1c2365){this['id']=_0x1c2365['id']||0x0;this[_0x4518('0x0')]=_0x1c2365['name']||'';this[_0x4518('0x1')]=_0x1c2365[_0x4518('0x1')];this[_0x4518('0x2')]=_0x1c2365[_0x4518('0x2')];this[_0x4518('0x3')]=_0x1c2365[_0x4518('0x3')];this[_0x4518('0x4')]=_0x1c2365[_0x4518('0x4')];this['minrate']=_0x1c2365[_0x4518('0x5')]||0x960;this[_0x4518('0x6')]=_0x1c2365[_0x4518('0x6')]||0x3840;this['modem']=_0x1c2365[_0x4518('0x7')]||'v17,v27,v29';this[_0x4518('0x8')]=_0x1c2365[_0x4518('0x8')]||'no';this[_0x4518('0x9')]=_0x1c2365[_0x4518('0x9')]||'no';this[_0x4518('0xa')]=_0x1c2365[_0x4518('0xa')]||0x1388;this[_0x4518('0xb')]=_0x1c2365['tech']||_0x4518('0xc');this[_0x4518('0xd')]=_0x1c2365[_0x4518('0xd')]?_0x1c2365[_0x4518('0xd')]:undefined;this[_0x4518('0xe')]=_0x1c2365['ListId'];this[_0x4518('0xf')]=_0x1c2365[_0x4518('0xf')];}module[_0x4518('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 c46e89a..d3020a0 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 _0x0834=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0834,0x1ce));var _0x4083=function(_0x4f9a25,_0x351614){_0x4f9a25=_0x4f9a25-0x0;var _0x4ad1b5=_0x0834[_0x4f9a25];return _0x4ad1b5;};'use strict';function FreshdeskAccount(_0x550a43){this['id']=_0x550a43['id']||0x0;this[_0x4083('0x0')]=_0x550a43['name']||'';this[_0x4083('0x1')]=_0x550a43[_0x4083('0x1')]||'';this[_0x4083('0x2')]=_0x550a43['token']||'';this[_0x4083('0x3')]=_0x550a43[_0x4083('0x3')]||'';this['serverUrl']=_0x550a43[_0x4083('0x4')]||'';this[_0x4083('0x5')]=_0x550a43[_0x4083('0x5')]||{};}module[_0x4083('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa721=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x91ff52,_0x2cde3c){var _0x37d193=function(_0x5cb450){while(--_0x5cb450){_0x91ff52['push'](_0x91ff52['shift']());}};_0x37d193(++_0x2cde3c);}(_0xa721,0xbc));var _0x1a72=function(_0x8c5831,_0x17a86d){_0x8c5831=_0x8c5831-0x0;var _0x3f2f12=_0xa721[_0x8c5831];return _0x3f2f12;};'use strict';function FreshdeskAccount(_0x526eef){this['id']=_0x526eef['id']||0x0;this[_0x1a72('0x0')]=_0x526eef[_0x1a72('0x0')]||'';this[_0x1a72('0x1')]=_0x526eef[_0x1a72('0x1')]||'';this[_0x1a72('0x2')]=_0x526eef[_0x1a72('0x3')]||'';this[_0x1a72('0x4')]=_0x526eef[_0x1a72('0x4')]||'';this[_0x1a72('0x5')]=_0x526eef[_0x1a72('0x5')]||'';this[_0x1a72('0x6')]=_0x526eef[_0x1a72('0x6')]||{};}module[_0x1a72('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 1fc1f98..595a47c 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 _0x119c=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0xf60cd0,_0x34bf81){var _0x32ad56=function(_0x44cf0b){while(--_0x44cf0b){_0xf60cd0['push'](_0xf60cd0['shift']());}};_0x32ad56(++_0x34bf81);}(_0x119c,0x1da));var _0xc119=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x119c[_0x420d8d];return _0x4865d7;};'use strict';function FreshsalesAccount(_0x5b0452){this['id']=_0x5b0452['id']||0x0;this[_0xc119('0x0')]=_0x5b0452[_0xc119('0x0')]||'';this[_0xc119('0x1')]=_0x5b0452['username']||'';this[_0xc119('0x2')]=_0x5b0452[_0xc119('0x3')]||'';this[_0xc119('0x4')]=_0x5b0452['remoteUri']||'';this['serverUrl']=_0x5b0452[_0xc119('0x5')]||'';this[_0xc119('0x6')]=_0x5b0452[_0xc119('0x6')]||{};}module[_0xc119('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x7da5=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da5,0x186));var _0x57da=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7da5[_0x397e5f];return _0x5302b8;};'use strict';function FreshsalesAccount(_0x333557){this['id']=_0x333557['id']||0x0;this[_0x57da('0x0')]=_0x333557['name']||'';this['username']=_0x333557[_0x57da('0x1')]||'';this[_0x57da('0x2')]=_0x333557[_0x57da('0x3')]||'';this[_0x57da('0x4')]=_0x333557[_0x57da('0x4')]||'';this[_0x57da('0x5')]=_0x333557[_0x57da('0x5')]||'';this[_0x57da('0x6')]=_0x333557[_0x57da('0x6')]||{};}module[_0x57da('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7b6a073..7219d75 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 _0x6910=['connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0x5e0717,_0x26d34a){var _0x340d67=function(_0x40b5b3){while(--_0x40b5b3){_0x5e0717['push'](_0x5e0717['shift']());}};_0x340d67(++_0x26d34a);}(_0x6910,0x1cc));var _0x0691=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x6910[_0x1a5946];return _0x25e9d5;};'use strict';function QueueReport(){this[_0x0691('0x0')]=_0x0691('0x1');this['uniqueid']='';this['calleridnum']='';this[_0x0691('0x2')]='';this[_0x0691('0x3')]='';this['queuecallerjoinAt']=null;this[_0x0691('0x4')]=null;this[_0x0691('0x5')]=0x1;this[_0x0691('0x6')]=0x1;this[_0x0691('0x7')]=![];this[_0x0691('0x8')]=null;this[_0x0691('0x9')]=![];this[_0x0691('0xa')]=null;this[_0x0691('0xb')]=![];this[_0x0691('0xc')]=null;this[_0x0691('0xd')]=0x1;this[_0x0691('0xe')]='';this['connectedlinenum']='';this[_0x0691('0xf')]='';this[_0x0691('0x10')]='';this[_0x0691('0x11')]='';this[_0x0691('0x12')]='';this['priority']='';this[_0x0691('0x13')]=0x0;this[_0x0691('0x14')]=![];this[_0x0691('0x15')]='';this[_0x0691('0x16')]=0x0;this[_0x0691('0x17')]={};}module[_0x0691('0x18')]=QueueReport; \ No newline at end of file +var _0x573d=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','lastAssignedTo','variables','exports','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0x573d,0x13d));var _0xd573=function(_0x2cd4bc,_0x4502e1){_0x2cd4bc=_0x2cd4bc-0x0;var _0x4b6ba5=_0x573d[_0x2cd4bc];return _0x4b6ba5;};'use strict';function QueueReport(){this['type']='inbound';this[_0xd573('0x0')]='';this['calleridnum']='';this[_0xd573('0x1')]='';this['queue']='';this[_0xd573('0x2')]=null;this[_0xd573('0x3')]=null;this[_0xd573('0x4')]=0x1;this[_0xd573('0x5')]=0x1;this[_0xd573('0x6')]=![];this[_0xd573('0x7')]=null;this[_0xd573('0x8')]=![];this[_0xd573('0x9')]=null;this[_0xd573('0xa')]=![];this[_0xd573('0xb')]=null;this[_0xd573('0xc')]=0x1;this[_0xd573('0xd')]='';this[_0xd573('0xe')]='';this[_0xd573('0xf')]='';this[_0xd573('0x10')]='';this[_0xd573('0x11')]='';this[_0xd573('0x12')]='';this['priority']='';this['holdtime']=0x0;this[_0xd573('0x13')]=![];this[_0xd573('0x14')]='';this['mohtime']=0x0;this[_0xd573('0x15')]={};}module[_0xd573('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 6c79a09..ab2d6e6 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 _0x269b=['clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x25cdb9,_0x4d338f){var _0x2ce804=function(_0xd1eb7e){while(--_0xd1eb7e){_0x25cdb9['push'](_0x25cdb9['shift']());}};_0x2ce804(++_0x4d338f);}(_0x269b,0x1be));var _0xb269=function(_0x5255de,_0x34a794){_0x5255de=_0x5255de-0x0;var _0x2c5dfd=_0x269b[_0x5255de];return _0x2c5dfd;};'use strict';function SalesforceAccount(_0x808752){this['id']=_0x808752['id']||0x0;this['name']=_0x808752[_0xb269('0x0')]||'';this['username']=_0x808752[_0xb269('0x1')]||'';this[_0xb269('0x2')]=_0x808752[_0xb269('0x2')]||'';this[_0xb269('0x3')]=_0x808752['password']||'';this[_0xb269('0x4')]=_0x808752['clientId']||'';this[_0xb269('0x5')]=_0x808752[_0xb269('0x5')]||'';this[_0xb269('0x6')]=_0x808752[_0xb269('0x6')]||'';this[_0xb269('0x7')]=_0x808752[_0xb269('0x7')]||'integrationTab';this[_0xb269('0x8')]=_0x808752[_0xb269('0x8')]||'';this['Configurations']=_0x808752[_0xb269('0x9')]||{};}module[_0xb269('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x2dae=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x45b511,_0x20ad0d){var _0x402d21=function(_0x1ae5d5){while(--_0x1ae5d5){_0x45b511['push'](_0x45b511['shift']());}};_0x402d21(++_0x20ad0d);}(_0x2dae,0x187));var _0xe2da=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x2dae[_0x2300c7];return _0x23f720;};'use strict';function SalesforceAccount(_0x58f0e7){this['id']=_0x58f0e7['id']||0x0;this['name']=_0x58f0e7[_0xe2da('0x0')]||'';this['username']=_0x58f0e7[_0xe2da('0x1')]||'';this[_0xe2da('0x2')]=_0x58f0e7[_0xe2da('0x2')]||'';this[_0xe2da('0x3')]=_0x58f0e7[_0xe2da('0x3')]||'';this[_0xe2da('0x4')]=_0x58f0e7['clientId']||'';this[_0xe2da('0x5')]=_0x58f0e7['clientSecret']||'';this['securityToken']=_0x58f0e7[_0xe2da('0x6')]||'';this[_0xe2da('0x7')]=_0x58f0e7[_0xe2da('0x7')]||_0xe2da('0x8');this[_0xe2da('0x9')]=_0x58f0e7[_0xe2da('0x9')]||'';this[_0xe2da('0xa')]=_0x58f0e7[_0xe2da('0xa')]||{};}module[_0xe2da('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 94ef815..6331618 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 _0x8ab1=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x47621a,_0x539b09){var _0x4007f2=function(_0x4880a1){while(--_0x4880a1){_0x47621a['push'](_0x47621a['shift']());}};_0x4007f2(++_0x539b09);}(_0x8ab1,0x11d));var _0x18ab=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0x8ab1[_0x431cf2];return _0x10c9a7;};'use strict';function ServicenowAccount(_0x1a9fd8){this['id']=_0x1a9fd8['id']||0x0;this[_0x18ab('0x0')]=_0x1a9fd8[_0x18ab('0x0')]||'';this[_0x18ab('0x1')]=_0x1a9fd8['username']||'';this[_0x18ab('0x2')]=_0x1a9fd8[_0x18ab('0x2')]||'';this[_0x18ab('0x3')]=_0x1a9fd8[_0x18ab('0x3')]||'';this[_0x18ab('0x4')]=_0x1a9fd8[_0x18ab('0x4')]||'';this[_0x18ab('0x5')]=_0x1a9fd8['Configurations']||{};}module[_0x18ab('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3dc9=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x9913ed,_0x5e07c1){var _0x254fe0=function(_0xc52bee){while(--_0xc52bee){_0x9913ed['push'](_0x9913ed['shift']());}};_0x254fe0(++_0x5e07c1);}(_0x3dc9,0x120));var _0x93dc=function(_0xf04ee8,_0x305a1f){_0xf04ee8=_0xf04ee8-0x0;var _0x36fe2f=_0x3dc9[_0xf04ee8];return _0x36fe2f;};'use strict';function ServicenowAccount(_0x2ad835){this['id']=_0x2ad835['id']||0x0;this[_0x93dc('0x0')]=_0x2ad835[_0x93dc('0x0')]||'';this[_0x93dc('0x1')]=_0x2ad835['username']||'';this[_0x93dc('0x2')]=_0x2ad835[_0x93dc('0x2')]||'';this[_0x93dc('0x3')]=_0x2ad835[_0x93dc('0x3')]||'';this[_0x93dc('0x4')]=_0x2ad835['serverUrl']||'';this[_0x93dc('0x5')]=_0x2ad835[_0x93dc('0x5')]||{};}module[_0x93dc('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2777e05..c8dc9d4 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 _0x61e2=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x31f8aa,_0x5b6837){var _0x4d026f=function(_0x28cafc){while(--_0x28cafc){_0x31f8aa['push'](_0x31f8aa['shift']());}};_0x4d026f(++_0x5b6837);}(_0x61e2,0x1dd));var _0x261e=function(_0x42eb4b,_0x8bd272){_0x42eb4b=_0x42eb4b-0x0;var _0x4ffaf7=_0x61e2[_0x42eb4b];return _0x4ffaf7;};'use strict';function SugarcrmAccount(_0x49e76b){this['id']=_0x49e76b['id']||0x0;this[_0x261e('0x0')]=_0x49e76b['name']||'';this['username']=_0x49e76b[_0x261e('0x1')]||'';this[_0x261e('0x2')]=_0x49e76b[_0x261e('0x2')]||'';this[_0x261e('0x3')]=_0x49e76b[_0x261e('0x3')]||'';this[_0x261e('0x4')]=_0x49e76b[_0x261e('0x4')]||'';this[_0x261e('0x5')]=_0x49e76b[_0x261e('0x5')]||{};}module[_0x261e('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x41e1=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x41e1,0x87));var _0x141e=function(_0x2a3a04,_0x2ee9c1){_0x2a3a04=_0x2a3a04-0x0;var _0x2f53b1=_0x41e1[_0x2a3a04];return _0x2f53b1;};'use strict';function SugarcrmAccount(_0x9534d0){this['id']=_0x9534d0['id']||0x0;this['name']=_0x9534d0[_0x141e('0x0')]||'';this[_0x141e('0x1')]=_0x9534d0[_0x141e('0x1')]||'';this['password']=_0x9534d0[_0x141e('0x2')]||'';this[_0x141e('0x3')]=_0x9534d0[_0x141e('0x3')]||'';this[_0x141e('0x4')]=_0x9534d0[_0x141e('0x4')]||'';this['Configurations']=_0x9534d0[_0x141e('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index e8c323c..8b9807d 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 _0x70e0=['unknown','address','exports','name','accountcode'];(function(_0x69752e,_0x2579f6){var _0x506a36=function(_0x1793bc){while(--_0x1793bc){_0x69752e['push'](_0x69752e['shift']());}};_0x506a36(++_0x2579f6);}(_0x70e0,0x107));var _0x070e=function(_0x2c710c,_0x5b10a5){_0x2c710c=_0x2c710c-0x0;var _0x7328bd=_0x70e0[_0x2c710c];return _0x7328bd;};'use strict';function Telephone(_0x344e8d){this['id']=_0x344e8d['id']||0x0;this[_0x070e('0x0')]=_0x344e8d[_0x070e('0x0')]||'';this[_0x070e('0x1')]=_0x344e8d[_0x070e('0x1')]||'';this['state']=_0x070e('0x2');this['stateTime']=0x0;this['status']=_0x070e('0x2');this[_0x070e('0x3')]='';}module[_0x070e('0x4')]=Telephone; \ No newline at end of file +var _0xf21d=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x4cf47f,_0x50ae19){var _0x3c3e96=function(_0x53f61e){while(--_0x53f61e){_0x4cf47f['push'](_0x4cf47f['shift']());}};_0x3c3e96(++_0x50ae19);}(_0xf21d,0x1f3));var _0xdf21=function(_0x4a93e8,_0x52286d){_0x4a93e8=_0x4a93e8-0x0;var _0x186283=_0xf21d[_0x4a93e8];return _0x186283;};'use strict';function Telephone(_0x2411b1){this['id']=_0x2411b1['id']||0x0;this['name']=_0x2411b1[_0xdf21('0x0')]||'';this[_0xdf21('0x1')]=_0x2411b1[_0xdf21('0x1')]||'';this[_0xdf21('0x2')]=_0xdf21('0x3');this[_0xdf21('0x4')]=0x0;this[_0xdf21('0x5')]=_0xdf21('0x3');this[_0xdf21('0x6')]='';}module[_0xdf21('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 992a5aa..64ceb0e 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 _0xa6cd=['name','html','exports'];(function(_0x327ea4,_0x4c008d){var _0x2289a9=function(_0xd0072b){while(--_0xd0072b){_0x327ea4['push'](_0x327ea4['shift']());}};_0x2289a9(++_0x4c008d);}(_0xa6cd,0x171));var _0xda6c=function(_0x55d2ae,_0x231cf1){_0x55d2ae=_0x55d2ae-0x0;var _0x40dae1=_0xa6cd[_0x55d2ae];return _0x40dae1;};'use strict';function template(_0x3846b4){this['id']=_0x3846b4['id']||0x0;this[_0xda6c('0x0')]=_0x3846b4[_0xda6c('0x0')]||'';this[_0xda6c('0x1')]=_0x3846b4[_0xda6c('0x1')]||'';}module[_0xda6c('0x2')]=template; \ No newline at end of file +var _0x4934=['name','html'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0x4934,0x1ec));var _0x4493=function(_0xafb0b1,_0x338bed){_0xafb0b1=_0xafb0b1-0x0;var _0x2ebb59=_0x4934[_0xafb0b1];return _0x2ebb59;};'use strict';function template(_0x92444a){this['id']=_0x92444a['id']||0x0;this[_0x4493('0x0')]=_0x92444a[_0x4493('0x0')]||'';this['html']=_0x92444a[_0x4493('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7317e34..f8dcae6 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 _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x6eb82e,_0x1d0986){var _0x1b265c=function(_0x2fd20c){while(--_0x2fd20c){_0x6eb82e['push'](_0x6eb82e['shift']());}};_0x1b265c(++_0x1d0986);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file +var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x391644,_0x36d419){var _0x401e84=function(_0x2cad6b){while(--_0x2cad6b){_0x391644['push'](_0x391644['shift']());}};_0x401e84(++_0x36d419);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x575a31,_0x56336f){_0x575a31=_0x575a31-0x0;var _0x5d7dad=_0xf3cd[_0x575a31];return _0x5d7dad;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6f72b0f..6252e37 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 _0x96f8=['registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','address','exports','active','name','state','unknown','stateTime'];(function(_0x3f7a9f,_0x125d99){var _0x438204=function(_0x20c98c){while(--_0x20c98c){_0x3f7a9f['push'](_0x3f7a9f['shift']());}};_0x438204(++_0x125d99);}(_0x96f8,0x1db));var _0x896f=function(_0x2c3b93,_0x26ffc6){_0x2c3b93=_0x2c3b93-0x0;var _0x3516ae=_0x96f8[_0x2c3b93];return _0x3516ae;};'use strict';function Trunk(_0x2c2fb7){this['id']=_0x2c2fb7['id']||0x0;this[_0x896f('0x0')]=_0x2c2fb7['active']||![];this[_0x896f('0x1')]=_0x2c2fb7['name']||'';this[_0x896f('0x2')]=_0x896f('0x3');this[_0x896f('0x4')]=0x0;this['status']=_0x896f('0x3');this[_0x896f('0x5')]=_0x2c2fb7[_0x896f('0x5')]&&_0x2c2fb7[_0x896f('0x5')][_0x896f('0x6')](':')?_0x2c2fb7[_0x896f('0x5')][_0x896f('0x7')](':')[0x0]:'';this[_0x896f('0x8')]='';this[_0x896f('0x9')]='';this[_0x896f('0xa')]='';this[_0x896f('0xb')]='';this[_0x896f('0xc')]='';this[_0x896f('0xd')]=_0x896f('0x3');this['registrationtime']='';this[_0x896f('0xe')]='';}module[_0x896f('0xf')]=Trunk; \ No newline at end of file +var _0xc5bb=['exports','active','name','state','unknown','status','registry','host','port','domain','domainport','stateRegistry','registrationtime','address'];(function(_0x4cbe9d,_0x5195bd){var _0x412446=function(_0x485a3c){while(--_0x485a3c){_0x4cbe9d['push'](_0x4cbe9d['shift']());}};_0x412446(++_0x5195bd);}(_0xc5bb,0x7f));var _0xbc5b=function(_0x1ab651,_0x15c3df){_0x1ab651=_0x1ab651-0x0;var _0x43f764=_0xc5bb[_0x1ab651];return _0x43f764;};'use strict';function Trunk(_0x16db04){this['id']=_0x16db04['id']||0x0;this[_0xbc5b('0x0')]=_0x16db04[_0xbc5b('0x0')]||![];this[_0xbc5b('0x1')]=_0x16db04[_0xbc5b('0x1')]||'';this[_0xbc5b('0x2')]=_0xbc5b('0x3');this['stateTime']=0x0;this[_0xbc5b('0x4')]=_0xbc5b('0x3');this[_0xbc5b('0x5')]=_0x16db04[_0xbc5b('0x5')]&&_0x16db04[_0xbc5b('0x5')]['indexOf'](':')?_0x16db04[_0xbc5b('0x5')]['split'](':')[0x0]:'';this[_0xbc5b('0x6')]='';this[_0xbc5b('0x7')]='';this[_0xbc5b('0x8')]='';this[_0xbc5b('0x9')]='';this['refresh']='';this[_0xbc5b('0xa')]=_0xbc5b('0x3');this[_0xbc5b('0xb')]='';this[_0xbc5b('0xc')]='';}module[_0xbc5b('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9f991e4..58267c9 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 _0x77fb=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x77fb,0x1ae));var _0xb77f=function(_0x2288c7,_0x2f8dc5){_0x2288c7=_0x2288c7-0x0;var _0x2d759f=_0x77fb[_0x2288c7];return _0x2d759f;};'use strict';function voiceExtension(_0x4a5958){this['id']=_0x4a5958['id']||0x0;this[_0xb77f('0x0')]=_0x4a5958['exten']||'';this[_0xb77f('0x1')]=_0x4a5958[_0xb77f('0x1')]||_0xb77f('0x2');this['mandatoryDisposition']=_0x4a5958[_0xb77f('0x3')]||![];}module[_0xb77f('0x4')]=voiceExtension; \ No newline at end of file +var _0xca9d=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x53df85,_0x1b796e){var _0xb89708=function(_0x10f97b){while(--_0x10f97b){_0x53df85['push'](_0x53df85['shift']());}};_0xb89708(++_0x1b796e);}(_0xca9d,0x11c));var _0xdca9=function(_0x1df7a0,_0x22663d){_0x1df7a0=_0x1df7a0-0x0;var _0x1f6ef6=_0xca9d[_0x1df7a0];return _0x1f6ef6;};'use strict';function voiceExtension(_0x1d03fc){this['id']=_0x1d03fc['id']||0x0;this['exten']=_0x1d03fc[_0xdca9('0x0')]||'';this[_0xdca9('0x1')]=_0x1d03fc['recordingFormat']||'none';this['mandatoryDisposition']=_0x1d03fc[_0xdca9('0x2')]||![];}module[_0xdca9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 73986f8..1bec98e 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 _0x7cf4=['dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','inbound','waiting','talking','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup'];(function(_0x375c6f,_0x162dfb){var _0x372af3=function(_0x19e416){while(--_0x19e416){_0x375c6f['push'](_0x375c6f['shift']());}};_0x372af3(++_0x162dfb);}(_0x7cf4,0xac));var _0x47cf=function(_0x515082,_0x3de400){_0x515082=_0x515082-0x0;var _0x211e00=_0x7cf4[_0x515082];return _0x211e00;};'use strict';var statusDesc=[_0x47cf('0x0'),_0x47cf('0x1'),_0x47cf('0x2'),_0x47cf('0x3'),'invalid',_0x47cf('0x4'),_0x47cf('0x5'),_0x47cf('0x6'),_0x47cf('0x7')];var monitorFormat={'wav':_0x47cf('0x8'),'wav49':_0x47cf('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x47cf('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x162b6e){this['id']=_0x162b6e['id']||0x0;this['name']=_0x162b6e[_0x47cf('0xb')]||'';this[_0x47cf('0xc')]=_0x162b6e[_0x47cf('0xc')]||'';this['type']=_0x162b6e['type']||_0x47cf('0xd');this[_0x47cf('0xe')]=0x0;this[_0x47cf('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x47cf('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x47cf('0x11')]=0x0;this['unmanaged']=0x0;this[_0x47cf('0x12')]=0x0;this['loggedIn']=0x0;this[_0x47cf('0x13')]=0x0;this[_0x47cf('0x14')]=_0x162b6e[_0x47cf('0x14')]||![];this['acwTimeout']=_0x162b6e[_0x47cf('0x15')]||0xa;this[_0x47cf('0x16')]=_0x162b6e['autopause']||'no';this[_0x47cf('0x17')]=!![];this[_0x47cf('0x18')]='';this['originated']=0x0;this['temp']=0x0;this[_0x47cf('0x19')]=_0x162b6e[_0x47cf('0x19')]||null;this[_0x47cf('0x1a')]=_0x162b6e[_0x47cf('0x1a')]?_0x162b6e['dialGlobalInterval']:null;this[_0x47cf('0x1b')]=_0x162b6e[_0x47cf('0x1b')];this[_0x47cf('0x1c')]=_0x162b6e[_0x47cf('0x1c')]||'progressive';this[_0x47cf('0x1d')]=_0x162b6e[_0x47cf('0x1d')]||0x0;this[_0x47cf('0x1e')]=_0x162b6e[_0x47cf('0x1e')]||0x0;this['dialPowerLevel']=_0x162b6e[_0x47cf('0x1f')]||0x1;this[_0x47cf('0x20')]=_0x162b6e[_0x47cf('0x20')]||_0x47cf('0x21');this['dialPredictiveOptimizationPercentage']=_0x162b6e[_0x47cf('0x22')]||0.03;this[_0x47cf('0x23')]=_0x162b6e[_0x47cf('0x23')]||0x258;this[_0x47cf('0x24')]=_0x162b6e[_0x47cf('0x24')]||_0x47cf('0x25');this[_0x47cf('0x26')]=_0x162b6e[_0x47cf('0x26')]||_0x47cf('0x25');this[_0x47cf('0x27')]=_0x162b6e['dialOriginateTimeout']||0x1e;this[_0x47cf('0x28')]=_0x162b6e[_0x47cf('0x28')]||'tTxX';this[_0x47cf('0x29')]=_0x162b6e[_0x47cf('0x29')]||0x3;this[_0x47cf('0x2a')]=_0x162b6e[_0x47cf('0x2a')]||undefined;this['dialCongestionMaxRetry']=_0x162b6e['dialCongestionMaxRetry']||0x3;this[_0x47cf('0x2b')]=_0x162b6e[_0x47cf('0x2b')]||0x96;this[_0x47cf('0x2c')]=_0x162b6e[_0x47cf('0x2c')]||0x3;this[_0x47cf('0x2d')]=_0x162b6e[_0x47cf('0x2d')]||0x96;this[_0x47cf('0x2e')]=_0x162b6e[_0x47cf('0x2e')]||0x3;this[_0x47cf('0x2f')]=_0x162b6e['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x162b6e['dialNoSuchNumberMaxRetry']||0x3;this[_0x47cf('0x30')]=_0x162b6e[_0x47cf('0x30')]||0x96;this[_0x47cf('0x31')]=_0x162b6e['dialDropMaxRetry']||0x3;this[_0x47cf('0x32')]=_0x162b6e[_0x47cf('0x32')]||0x96;this[_0x47cf('0x33')]=_0x162b6e['dialAbandonedMaxRetry']||0x3;this[_0x47cf('0x34')]=_0x162b6e[_0x47cf('0x34')]||0x96;this[_0x47cf('0x35')]=_0x162b6e[_0x47cf('0x35')]||0x3;this[_0x47cf('0x36')]=_0x162b6e[_0x47cf('0x36')]||0x96;this[_0x47cf('0x37')]=_0x162b6e[_0x47cf('0x37')]||0x3;this[_0x47cf('0x38')]=_0x162b6e[_0x47cf('0x38')]||0x96;this[_0x47cf('0x39')]=_0x162b6e['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x162b6e[_0x47cf('0x3a')]?_0x162b6e['Trunk']:undefined;this['TrunkBackup']=_0x162b6e['TrunkBackup']?_0x162b6e[_0x47cf('0x3b')]:undefined;this[_0x47cf('0x3c')]=_0x162b6e[_0x47cf('0x3c')]||undefined;this[_0x47cf('0x3d')]=_0x162b6e['Interval']?_0x162b6e['Interval']:undefined;this[_0x47cf('0x3e')]=_0x162b6e['dialOrderByScheduledAt']||_0x47cf('0x3f');this['dialRandomLastDigitCallerIdNumber']=_0x162b6e[_0x47cf('0x40')]||undefined;this[_0x47cf('0x41')]=_0x162b6e[_0x47cf('0x41')]||undefined;this[_0x47cf('0x42')]=strategy[_0x162b6e[_0x47cf('0x42')]]||_0x47cf('0xa');this[_0x47cf('0x43')]=!![];this[_0x47cf('0x44')]=_0x162b6e['dialAMDActive']||![];this[_0x47cf('0x45')]=_0x162b6e[_0x47cf('0x45')];this[_0x47cf('0x46')]=_0x162b6e[_0x47cf('0x46')];this[_0x47cf('0x47')]=_0x162b6e[_0x47cf('0x47')];this[_0x47cf('0x48')]=_0x162b6e[_0x47cf('0x48')];this[_0x47cf('0x49')]=_0x162b6e[_0x47cf('0x49')];this[_0x47cf('0x4a')]=_0x162b6e[_0x47cf('0x4a')];this[_0x47cf('0x4b')]=_0x162b6e[_0x47cf('0x4b')];this[_0x47cf('0x4c')]=_0x162b6e[_0x47cf('0x4c')];this[_0x47cf('0x4d')]=_0x162b6e[_0x47cf('0x4d')];this['outboundRejectCallsDay']=0x0;this[_0x47cf('0x4e')]=0x0;this[_0x47cf('0x4f')]=_0x162b6e[_0x47cf('0x4f')];this[_0x47cf('0x50')]=0x0;this[_0x47cf('0x51')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x47cf('0x52')]=0x0;this[_0x47cf('0x53')]=0x0;this[_0x47cf('0x54')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x47cf('0x55')]=0x0;this[_0x47cf('0x56')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x47cf('0x57')]=0x0;this[_0x47cf('0x58')]=0x0;this[_0x47cf('0x59')]=0x0;this[_0x47cf('0x5a')]=undefined;this[_0x47cf('0x5b')]=undefined;this[_0x47cf('0x5c')]=undefined;this[_0x47cf('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x47cf('0x5e')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x47cf('0x5f')]=0x0;this[_0x47cf('0x60')]=0x0;this[_0x47cf('0x61')]=0x0;this[_0x47cf('0x62')]=0x0;this[_0x47cf('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x162b6e[_0x47cf('0x64')]||0x14;this[_0x47cf('0x65')]=_0x162b6e[_0x47cf('0x64')]||0xa;this[_0x47cf('0x66')]=0x0;this[_0x47cf('0x67')]=0x0;this[_0x47cf('0x68')]=0x1;this[_0x47cf('0x69')]=0x0;this[_0x47cf('0x6a')]=0x0;this[_0x47cf('0x6b')]=0x0;this[_0x47cf('0x6c')]=0x0;this[_0x47cf('0x6d')]=_0x162b6e[_0x47cf('0x6d')]||0x1e;this[_0x47cf('0x6e')]=_0x162b6e['dialRecallInQueue']||![];this[_0x47cf('0x6f')]=_0x162b6e[_0x47cf('0x6f')]||undefined;this[_0x47cf('0x70')]=_0x162b6e[_0x47cf('0x70')]||![];this[_0x47cf('0x71')]=_0x162b6e['dialAgiAfterHangupAgent']||![];this[_0x47cf('0xc')]=monitorFormat[_0x162b6e[_0x47cf('0xc')]]?monitorFormat[_0x162b6e[_0x47cf('0xc')]]:undefined;this[_0x47cf('0x72')]=_0x162b6e[_0x47cf('0x72')]||![];this[_0x47cf('0x73')]=_0x162b6e[_0x47cf('0x73')]?_0x162b6e[_0x47cf('0x73')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xdb96=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor'];(function(_0x19cb1a,_0x4ce1b2){var _0x399650=function(_0x3bfcde){while(--_0x3bfcde){_0x19cb1a['push'](_0x19cb1a['shift']());}};_0x399650(++_0x4ce1b2);}(_0xdb96,0x8c));var _0x6db9=function(_0xcce8dd,_0x261b67){_0xcce8dd=_0xcce8dd-0x0;var _0x57672c=_0xdb96[_0xcce8dd];return _0x57672c;};'use strict';var statusDesc=['unknown',_0x6db9('0x0'),_0x6db9('0x1'),_0x6db9('0x2'),_0x6db9('0x3'),_0x6db9('0x4'),'ringing',_0x6db9('0x5'),_0x6db9('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x6db9('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6db9('0x8')};function VoiceQueue(_0x2428f0){this['id']=_0x2428f0['id']||0x0;this[_0x6db9('0x9')]=_0x2428f0['name']||'';this['monitor_format']=_0x2428f0[_0x6db9('0xa')]||'';this[_0x6db9('0xb')]=_0x2428f0[_0x6db9('0xb')]||_0x6db9('0xc');this[_0x6db9('0xd')]=0x0;this[_0x6db9('0xe')]=0x0;this[_0x6db9('0xf')]=0x0;this[_0x6db9('0x10')]=0x0;this[_0x6db9('0x11')]=0x0;this[_0x6db9('0x12')]=0x0;this[_0x6db9('0x13')]=0x0;this[_0x6db9('0x14')]=0x0;this['abandoned']=0x0;this[_0x6db9('0x15')]=0x0;this[_0x6db9('0x16')]=0x0;this['acw']=_0x2428f0[_0x6db9('0x17')]||![];this[_0x6db9('0x18')]=_0x2428f0[_0x6db9('0x18')]||0xa;this[_0x6db9('0x19')]=_0x2428f0[_0x6db9('0x19')]||'no';this[_0x6db9('0x1a')]=!![];this['message']='';this[_0x6db9('0x1b')]=0x0;this[_0x6db9('0x1c')]=0x0;this['dialTimezone']=_0x2428f0[_0x6db9('0x1d')]||null;this['dialGlobalInterval']=_0x2428f0[_0x6db9('0x1e')]?_0x2428f0[_0x6db9('0x1e')]:null;this[_0x6db9('0x1f')]=_0x2428f0[_0x6db9('0x1f')];this[_0x6db9('0x20')]=_0x2428f0[_0x6db9('0x20')]||_0x6db9('0x21');this[_0x6db9('0x22')]=_0x2428f0[_0x6db9('0x22')]||0x0;this[_0x6db9('0x23')]=_0x2428f0[_0x6db9('0x23')]||0x0;this['dialPowerLevel']=_0x2428f0[_0x6db9('0x24')]||0x1;this[_0x6db9('0x25')]=_0x2428f0[_0x6db9('0x25')]||'dropRate';this[_0x6db9('0x26')]=_0x2428f0['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2428f0[_0x6db9('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x2428f0[_0x6db9('0x28')]||'anonymous';this[_0x6db9('0x29')]=_0x2428f0[_0x6db9('0x29')]||_0x6db9('0x2a');this[_0x6db9('0x2b')]=_0x2428f0[_0x6db9('0x2b')]||0x1e;this[_0x6db9('0x2c')]=_0x2428f0[_0x6db9('0x2c')]||_0x6db9('0x2d');this[_0x6db9('0x2e')]=_0x2428f0[_0x6db9('0x2e')]||0x3;this['dialQueueProject']=_0x2428f0['dialQueueProject']||undefined;this[_0x6db9('0x2f')]=_0x2428f0[_0x6db9('0x2f')]||0x3;this[_0x6db9('0x30')]=_0x2428f0['dialCongestionRetryFrequency']||0x96;this[_0x6db9('0x31')]=_0x2428f0['dialBusyMaxRetry']||0x3;this[_0x6db9('0x32')]=_0x2428f0['dialBusyRetryFrequency']||0x96;this[_0x6db9('0x33')]=_0x2428f0[_0x6db9('0x33')]||0x3;this[_0x6db9('0x34')]=_0x2428f0[_0x6db9('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2428f0[_0x6db9('0x35')]||0x3;this[_0x6db9('0x36')]=_0x2428f0[_0x6db9('0x36')]||0x96;this['dialDropMaxRetry']=_0x2428f0['dialDropMaxRetry']||0x3;this[_0x6db9('0x37')]=_0x2428f0[_0x6db9('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x2428f0[_0x6db9('0x38')]||0x3;this[_0x6db9('0x39')]=_0x2428f0[_0x6db9('0x39')]||0x96;this[_0x6db9('0x3a')]=_0x2428f0[_0x6db9('0x3a')]||0x3;this[_0x6db9('0x3b')]=_0x2428f0[_0x6db9('0x3b')]||0x96;this[_0x6db9('0x3c')]=_0x2428f0[_0x6db9('0x3c')]||0x3;this[_0x6db9('0x3d')]=_0x2428f0[_0x6db9('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x2428f0[_0x6db9('0x3e')]||0x4;this[_0x6db9('0x3f')]=_0x2428f0[_0x6db9('0x3f')]?_0x2428f0['Trunk']:undefined;this[_0x6db9('0x40')]=_0x2428f0[_0x6db9('0x40')]?_0x2428f0[_0x6db9('0x40')]:undefined;this[_0x6db9('0x41')]=_0x2428f0['dialPrefix']||undefined;this[_0x6db9('0x42')]=_0x2428f0['Interval']?_0x2428f0[_0x6db9('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x2428f0['dialOrderByScheduledAt']||'DESC';this[_0x6db9('0x43')]=_0x2428f0[_0x6db9('0x43')]||undefined;this[_0x6db9('0x44')]=_0x2428f0[_0x6db9('0x44')]||undefined;this['strategy']=strategy[_0x2428f0[_0x6db9('0x45')]]||_0x6db9('0x46');this[_0x6db9('0x47')]=!![];this['dialAMDActive']=_0x2428f0[_0x6db9('0x48')]||![];this[_0x6db9('0x49')]=_0x2428f0['dialAMDInitialSilence'];this[_0x6db9('0x4a')]=_0x2428f0[_0x6db9('0x4a')];this[_0x6db9('0x4b')]=_0x2428f0[_0x6db9('0x4b')];this[_0x6db9('0x4c')]=_0x2428f0['dialAMDTotalAnalysisTime'];this[_0x6db9('0x4d')]=_0x2428f0[_0x6db9('0x4d')];this[_0x6db9('0x4e')]=_0x2428f0[_0x6db9('0x4e')];this[_0x6db9('0x4f')]=_0x2428f0[_0x6db9('0x4f')];this[_0x6db9('0x50')]=_0x2428f0[_0x6db9('0x50')];this[_0x6db9('0x51')]=_0x2428f0['dialAMDMaximumWordLength'];this[_0x6db9('0x52')]=0x0;this['pTalking']=0x0;this['timeout']=_0x2428f0['timeout'];this[_0x6db9('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6db9('0x54')]=0x0;this[_0x6db9('0x55')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x6db9('0x56')]=0x0;this[_0x6db9('0x57')]=0x0;this[_0x6db9('0x58')]=0x0;this[_0x6db9('0x59')]=0x0;this[_0x6db9('0x5a')]=0x0;this[_0x6db9('0x5b')]=0x0;this['startProgressive']=undefined;this[_0x6db9('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0x6db9('0x5d')]=1.05;this[_0x6db9('0x5e')]=0x0;this[_0x6db9('0x5f')]=0x0;this[_0x6db9('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x6db9('0x61')]=0x0;this[_0x6db9('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6db9('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2428f0[_0x6db9('0x64')]||0x14;this[_0x6db9('0x65')]=_0x2428f0[_0x6db9('0x64')]||0xa;this[_0x6db9('0x66')]=0x0;this[_0x6db9('0x67')]=0x0;this[_0x6db9('0x68')]=0x1;this[_0x6db9('0x69')]=0x0;this[_0x6db9('0x6a')]=0x0;this[_0x6db9('0x6b')]=0x0;this[_0x6db9('0x6c')]=0x0;this[_0x6db9('0x6d')]=_0x2428f0[_0x6db9('0x6d')]||0x1e;this[_0x6db9('0x6e')]=_0x2428f0[_0x6db9('0x6e')]||![];this[_0x6db9('0x6f')]=_0x2428f0[_0x6db9('0x6f')]||undefined;this[_0x6db9('0x70')]=_0x2428f0[_0x6db9('0x70')]||![];this[_0x6db9('0x71')]=_0x2428f0[_0x6db9('0x71')]||![];this[_0x6db9('0xa')]=monitorFormat[_0x2428f0[_0x6db9('0xa')]]?monitorFormat[_0x2428f0[_0x6db9('0xa')]]:undefined;this[_0x6db9('0x72')]=_0x2428f0['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2428f0[_0x6db9('0x73')]?_0x2428f0[_0x6db9('0x73')]:undefined;}module[_0x6db9('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 58ab13a..8ab6929 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 _0xf71c=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x23e643,_0x3fe860){var _0xbe64e0=function(_0x986a69){while(--_0x986a69){_0x23e643['push'](_0x23e643['shift']());}};_0xbe64e0(++_0x3fe860);}(_0xf71c,0xaf));var _0xcf71=function(_0x457ed7,_0x44ec7e){_0x457ed7=_0x457ed7-0x0;var _0x4928a3=_0xf71c[_0x457ed7];return _0x4928a3;};'use strict';function VtigerAccount(_0x14b8ce){this['id']=_0x14b8ce['id']||0x0;this[_0xcf71('0x0')]=_0x14b8ce[_0xcf71('0x0')]||'';this[_0xcf71('0x1')]=_0x14b8ce['username']||'';this[_0xcf71('0x2')]=_0x14b8ce[_0xcf71('0x2')]||'';this[_0xcf71('0x3')]=_0x14b8ce[_0xcf71('0x3')]||'';this[_0xcf71('0x4')]=_0x14b8ce[_0xcf71('0x4')]||'';this[_0xcf71('0x5')]=_0x14b8ce[_0xcf71('0x5')]||{};}module[_0xcf71('0x6')]=VtigerAccount; \ No newline at end of file +var _0x3612=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5a12bf,_0x32bada){var _0x2191cb=function(_0x458496){while(--_0x458496){_0x5a12bf['push'](_0x5a12bf['shift']());}};_0x2191cb(++_0x32bada);}(_0x3612,0x1b4));var _0x2361=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x3612[_0x2730da];return _0xfe9991;};'use strict';function VtigerAccount(_0x118582){this['id']=_0x118582['id']||0x0;this[_0x2361('0x0')]=_0x118582[_0x2361('0x0')]||'';this[_0x2361('0x1')]=_0x118582[_0x2361('0x1')]||'';this[_0x2361('0x2')]=_0x118582[_0x2361('0x2')]||'';this['remoteUri']=_0x118582[_0x2361('0x3')]||'';this[_0x2361('0x4')]=_0x118582['serverUrl']||'';this[_0x2361('0x5')]=_0x118582[_0x2361('0x5')]||{};}module[_0x2361('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 06cf1b9..d3b8f20 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0xb8725f,_0xddc77){var _0x4ba048=function(_0x31c296){while(--_0x31c296){_0xb8725f['push'](_0xb8725f['shift']());}};_0x4ba048(++_0xddc77);}(_0x5f2f,0x73));var _0xf5f2=function(_0xda7b1c,_0x3a2be5){_0xda7b1c=_0xda7b1c-0x0;var _0x13e33d=_0x5f2f[_0xda7b1c];return _0x13e33d;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x158139,_0x236282){var _0x3a46d5=function(_0x14a918){while(--_0x14a918){_0x158139['push'](_0x158139['shift']());}};_0x3a46d5(++_0x236282);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a8ecece..579664c 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 _0x9c00=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x9c173a,_0x461c9c){_0x9c173a=_0x9c173a-0x0;var _0x88d611=_0x9c00[_0x9c173a];return _0x88d611;};'use strict';function ZohoAccount(_0x1aed38){this['id']=_0x1aed38['id']||0x0;this[_0x09c0('0x0')]=_0x1aed38['name']||'';this['description']=_0x1aed38[_0x09c0('0x1')]||'';this[_0x09c0('0x2')]=_0x1aed38['host']||'';this[_0x09c0('0x3')]=_0x1aed38[_0x09c0('0x3')]||'';this[_0x09c0('0x4')]=_0x1aed38[_0x09c0('0x4')]||'';this[_0x09c0('0x5')]=_0x1aed38['clientSecret']||'';this['serverUrl']=_0x1aed38[_0x09c0('0x6')]||'';this[_0x09c0('0x7')]=_0x1aed38[_0x09c0('0x7')]||'';this[_0x09c0('0x8')]=_0x1aed38[_0x09c0('0x8')]||'';this['Configurations']=_0x1aed38[_0x09c0('0x9')]||{};}module[_0x09c0('0xa')]=ZohoAccount; \ No newline at end of file +var _0x79e2=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x79e2,0x1c3));var _0x279e=function(_0x509f8a,_0x53df67){_0x509f8a=_0x509f8a-0x0;var _0x2caab7=_0x79e2[_0x509f8a];return _0x2caab7;};'use strict';function ZohoAccount(_0x393f10){this['id']=_0x393f10['id']||0x0;this['name']=_0x393f10[_0x279e('0x0')]||'';this[_0x279e('0x1')]=_0x393f10[_0x279e('0x1')]||'';this['host']=_0x393f10[_0x279e('0x2')]||'';this['zone']=_0x393f10[_0x279e('0x3')]||'';this[_0x279e('0x4')]=_0x393f10[_0x279e('0x4')]||'';this[_0x279e('0x5')]=_0x393f10['clientSecret']||'';this['serverUrl']=_0x393f10[_0x279e('0x6')]||'';this[_0x279e('0x7')]=_0x393f10[_0x279e('0x7')]||'';this[_0x279e('0x8')]=_0x393f10[_0x279e('0x8')]||'';this['Configurations']=_0x393f10[_0x279e('0x9')]||{};}module[_0x279e('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 d6c91a8..b54a479 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 _0x9d35=['channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent'];(function(_0x9cf42a,_0x21f296){var _0x224dc3=function(_0x2904a4){while(--_0x2904a4){_0x9cf42a['push'](_0x9cf42a['shift']());}};_0x224dc3(++_0x21f296);}(_0x9d35,0x163));var _0x59d3=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x9d35[_0xa60623];return _0x4a6487;};'use strict';var util=require(_0x59d3('0x0'));var _=require(_0x59d3('0x1'));var moment=require(_0x59d3('0x2'));function checkNameSurname(_0x3c8d8f,_0x23e253,_0x50dd8a){var _0x33b63f='';if(!_['isNil'](_0x23e253)&&_0x59d3('0x3')===typeof _0x23e253){_0x33b63f+=_0x23e253;}if(!_[_0x59d3('0x4')](_0x50dd8a)&&'string'===typeof _0x50dd8a){_0x33b63f+='\x20'+_0x50dd8a;}if(_0x33b63f!==''){return _0x33b63f;}return _0x3c8d8f;}function Action(_0x7fc4af,_0x473b50,_0x31b9bb,_0x1d0d8b,_0x4ca6c0){this[_0x59d3('0x5')]=_0x31b9bb||undefined;this[_0x59d3('0x6')]=_0x7fc4af['id'];this[_0x59d3('0x7')]=_0x473b50[_0x59d3('0x8')];this['type']=_0x473b50['type'];this[_0x59d3('0x9')]=_0x59d3('0x7');this[_0x59d3('0xa')]=![];this[_0x59d3('0xb')]=_[_0x59d3('0x4')](_0x7fc4af[_0x59d3('0xc')])?undefined:_0x7fc4af[_0x59d3('0xc')]['name'];this[_0x59d3('0xd')]=this[_0x59d3('0xb')]?util[_0x59d3('0xe')](_0x59d3('0xf'),this['membername']):_0x1d0d8b||undefined;this[_0x59d3('0x10')]=checkNameSurname(_0x7fc4af[_0x59d3('0x11')][_0x59d3('0x12')],_0x7fc4af[_0x59d3('0x11')]['firstName'],_0x7fc4af[_0x59d3('0x11')][_0x59d3('0x13')]);this[_0x59d3('0x14')]=_0x7fc4af[_0x59d3('0x14')]||![];this[_0x59d3('0x15')]=_0x7fc4af[_0x59d3('0x11')][_0x59d3('0x12')];this[_0x59d3('0x16')]=_0x7fc4af[_0x59d3('0x16')];this[_0x59d3('0x17')]=_0x7fc4af[_0x59d3('0x17')]||0x0;this[_0x59d3('0x18')]=_0x7fc4af[_0x59d3('0x18')]||0x0;this[_0x59d3('0x19')]=_0x7fc4af['countnoanswerretry']||0x0;this[_0x59d3('0x1a')]=(_0x7fc4af[_0x59d3('0x17')]||0x0)+(_0x7fc4af[_0x59d3('0x18')]||0x0)+(_0x7fc4af['countnoanswerretry']||0x0)+(_0x7fc4af[_0x59d3('0x1b')]||0x0)+(_0x7fc4af[_0x59d3('0x1c')]||0x0)+(_0x7fc4af[_0x59d3('0x1d')]||0x0)+(_0x7fc4af[_0x59d3('0x1e')]||0x0)+(_0x7fc4af[_0x59d3('0x1f')]||0x0);this[_0x59d3('0x1b')]=_0x7fc4af[_0x59d3('0x1b')]||0x0;this[_0x59d3('0x1c')]=_0x7fc4af[_0x59d3('0x1c')]||0x0;this[_0x59d3('0x1d')]=_0x7fc4af[_0x59d3('0x1d')]||0x0;this[_0x59d3('0x1e')]=_0x7fc4af[_0x59d3('0x1e')]||0x0;this[_0x59d3('0x1f')]=_0x7fc4af[_0x59d3('0x1f')]||0x0;this[_0x59d3('0x20')]=_0x7fc4af[_0x59d3('0x20')];this[_0x59d3('0x21')]=_0x7fc4af[_0x59d3('0x21')];this[_0x59d3('0x22')]=_0x7fc4af[_0x59d3('0x22')];this[_0x59d3('0x23')]=_0x7fc4af['recallme'];this[_0x59d3('0x24')]=_0x7fc4af[_0x59d3('0x24')];this['ListId']=_0x7fc4af[_0x59d3('0x25')];this[_0x59d3('0x26')]=_[_0x59d3('0x4')](_0x7fc4af[_0x59d3('0xc')])?_0x7fc4af[_0x59d3('0x26')]:_0x7fc4af[_0x59d3('0xc')]['id'];this['VoiceQueueId']=_0x7fc4af[_0x59d3('0x27')];this['originatecalleridnum']='';this[_0x59d3('0x28')]='';}Action[_0x59d3('0x29')][_0x59d3('0x2a')]=function(){return util[_0x59d3('0xe')](_0x59d3('0x2b'),this[_0x59d3('0x10')],this[_0x59d3('0x2c')]);};module[_0x59d3('0x2d')]=Action; \ No newline at end of file +var _0xf1f1=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact'];(function(_0x547ca8,_0x12d6e2){var _0x44a9eb=function(_0x364e45){while(--_0x364e45){_0x547ca8['push'](_0x547ca8['shift']());}};_0x44a9eb(++_0x12d6e2);}(_0xf1f1,0x10c));var _0x1f1f=function(_0x6bcb99,_0x377601){_0x6bcb99=_0x6bcb99-0x0;var _0xe2161a=_0xf1f1[_0x6bcb99];return _0xe2161a;};'use strict';var util=require(_0x1f1f('0x0'));var _=require(_0x1f1f('0x1'));var moment=require(_0x1f1f('0x2'));function checkNameSurname(_0x39ec86,_0x160c24,_0x1764a3){var _0x3b0ff1='';if(!_['isNil'](_0x160c24)&&'string'===typeof _0x160c24){_0x3b0ff1+=_0x160c24;}if(!_[_0x1f1f('0x3')](_0x1764a3)&&_0x1f1f('0x4')===typeof _0x1764a3){_0x3b0ff1+='\x20'+_0x1764a3;}if(_0x3b0ff1!==''){return _0x3b0ff1;}return _0x39ec86;}function Action(_0x144e6f,_0x29f81a,_0x3aeb33,_0xf04c52,_0x240c34){this[_0x1f1f('0x5')]=_0x3aeb33||undefined;this[_0x1f1f('0x6')]=_0x144e6f['id'];this[_0x1f1f('0x7')]=_0x29f81a[_0x1f1f('0x8')];this[_0x1f1f('0x9')]=_0x29f81a[_0x1f1f('0x9')];this[_0x1f1f('0xa')]=_0x1f1f('0x7');this[_0x1f1f('0xb')]=![];this['membername']=_[_0x1f1f('0x3')](_0x144e6f[_0x1f1f('0xc')])?undefined:_0x144e6f['Agent'][_0x1f1f('0x8')];this[_0x1f1f('0xd')]=this[_0x1f1f('0xe')]?util[_0x1f1f('0xf')](_0x1f1f('0x10'),this[_0x1f1f('0xe')]):_0xf04c52||undefined;this[_0x1f1f('0x11')]=checkNameSurname(_0x144e6f['Contact'][_0x1f1f('0x12')],_0x144e6f[_0x1f1f('0x13')][_0x1f1f('0x14')],_0x144e6f[_0x1f1f('0x13')][_0x1f1f('0x15')]);this[_0x1f1f('0x16')]=_0x144e6f[_0x1f1f('0x16')]||![];this[_0x1f1f('0x17')]=_0x144e6f['Contact'][_0x1f1f('0x12')];this['scheduledat']=_0x144e6f[_0x1f1f('0x18')];this[_0x1f1f('0x19')]=_0x144e6f['countbusyretry']||0x0;this[_0x1f1f('0x1a')]=_0x144e6f['countcongestionretry']||0x0;this['countnoanswerretry']=_0x144e6f['countnoanswerretry']||0x0;this[_0x1f1f('0x1b')]=(_0x144e6f['countbusyretry']||0x0)+(_0x144e6f[_0x1f1f('0x1a')]||0x0)+(_0x144e6f[_0x1f1f('0x1c')]||0x0)+(_0x144e6f[_0x1f1f('0x1d')]||0x0)+(_0x144e6f[_0x1f1f('0x1e')]||0x0)+(_0x144e6f[_0x1f1f('0x1f')]||0x0)+(_0x144e6f[_0x1f1f('0x20')]||0x0)+(_0x144e6f[_0x1f1f('0x21')]||0x0);this[_0x1f1f('0x1d')]=_0x144e6f[_0x1f1f('0x1d')]||0x0;this[_0x1f1f('0x1e')]=_0x144e6f[_0x1f1f('0x1e')]||0x0;this[_0x1f1f('0x1f')]=_0x144e6f[_0x1f1f('0x1f')]||0x0;this[_0x1f1f('0x20')]=_0x144e6f[_0x1f1f('0x20')]||0x0;this[_0x1f1f('0x21')]=_0x144e6f[_0x1f1f('0x21')]||0x0;this[_0x1f1f('0x22')]=_0x144e6f[_0x1f1f('0x22')];this[_0x1f1f('0x23')]=_0x144e6f[_0x1f1f('0x23')];this[_0x1f1f('0x24')]=_0x144e6f[_0x1f1f('0x24')];this[_0x1f1f('0x25')]=_0x144e6f[_0x1f1f('0x25')];this['ContactId']=_0x144e6f[_0x1f1f('0x26')];this[_0x1f1f('0x27')]=_0x144e6f[_0x1f1f('0x27')];this[_0x1f1f('0x28')]=_['isNil'](_0x144e6f['Agent'])?_0x144e6f[_0x1f1f('0x28')]:_0x144e6f[_0x1f1f('0xc')]['id'];this['VoiceQueueId']=_0x144e6f[_0x1f1f('0x29')];this[_0x1f1f('0x2a')]='';this[_0x1f1f('0x2b')]='';}Action[_0x1f1f('0x2c')][_0x1f1f('0x2d')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x1f1f('0x2e')]);};module[_0x1f1f('0x2f')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0e3ce93..4dbaaae 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 _0x583e=['[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','dialstatus','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncHangup','hanguprequest','syncHangupRequest','bind','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','campaignsPreview','hasOwnProperty','preview','booked','clearZombieChannels','dialActive','setMessage','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','contactId','VoiceQueueId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[action]','size','getContactRecallMe','length','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','complete','answered','[16]','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','activeContact','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','dialAbandonedRetryFrequency','[default]','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory'];(function(_0x10509d,_0xfbdfe0){var _0x486be6=function(_0x55a702){while(--_0x55a702){_0x10509d['push'](_0x10509d['shift']());}};_0x486be6(++_0xfbdfe0);}(_0x583e,0x1a6));var _0xe583=function(_0x45207c,_0x5e6766){_0x45207c=_0x45207c-0x0;var _0x5a1b52=_0x583e[_0x45207c];return _0x5a1b52;};'use strict';var util=require(_0xe583('0x0'));var _=require(_0xe583('0x1'));var BPromise=require(_0xe583('0x2'));var uuid=require(_0xe583('0x3'));var moment=require(_0xe583('0x4'));var md5=require(_0xe583('0x5'));var Redis=require(_0xe583('0x6'));var config=require(_0xe583('0x7'));var logger=require(_0xe583('0x8'))('preview');var loggerAction=require(_0xe583('0x8'))('actionPreview');var ami=require(_0xe583('0x9'));var rpcDb=require(_0xe583('0xa'));var Action=require(_0xe583('0xb'));var ut=require('./util/util');config[_0xe583('0xc')]=_['defaults'](config[_0xe583('0xc')],{'host':_0xe583('0xd'),'port':0x18eb});var io=require(_0xe583('0xe'))(new Redis(config[_0xe583('0xc')]));var Sequence=function(){};Sequence[_0xe583('0xf')][_0xe583('0x10')]=function(_0x30c05f){this[_0xe583('0x11')]=this[_0xe583('0x11')]?this[_0xe583('0x11')][_0xe583('0x12')](_0x30c05f):_0x30c05f();};function Preview(_0x322eb3){this['sequence']=new Sequence();this['campaignsPreview']=_0x322eb3[_0xe583('0x13')];this[_0xe583('0x14')]=_0x322eb3['trunks'];this[_0xe583('0x15')]={};this[_0xe583('0x16')]=_0x322eb3[_0xe583('0x16')];this[_0xe583('0x17')]=0x0;ami['on'](_0xe583('0x18'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0xe583('0x19')]['bind'](this));ami['on'](_0xe583('0x1a'),this[_0xe583('0x1b')][_0xe583('0x1c')](this));ami['on']('dialend',this[_0xe583('0x1d')][_0xe583('0x1c')](this));ami['on'](_0xe583('0x1e'),this['syncNewExten']['bind'](this));ami['on'](_0xe583('0x1f'),this[_0xe583('0x20')][_0xe583('0x1c')](this));ami['on'](_0xe583('0x21'),this[_0xe583('0x22')][_0xe583('0x1c')](this));ami['on'](_0xe583('0x23'),this['syncBlindTransfer'][_0xe583('0x1c')](this));this[_0xe583('0x24')](this['campaignsPreview']);}function emit(_0x1e820e,_0x123e8f,_0x1e6f64){io['to'](_0x1e820e)[_0xe583('0x25')](_0x123e8f,_0x1e6f64);}function emitCampaignPreview(_0x1024be){if(_0x1024be[_0xe583('0x26')]===_0xe583('0x27')){var _0xad9ac9={'id':_0x1024be['id'],'name':_0x1024be[_0xe583('0x28')],'strategy':_0x1024be['strategy'],'answered':_0x1024be['answered'],'available':_0x1024be[_0xe583('0x29')],'loggedIn':_0x1024be['loggedIn'],'pTalking':_0x1024be[_0xe583('0x2a')],'sumBillable':_0x1024be[_0xe583('0x2b')],'sumDuration':_0x1024be['sumDuration'],'sumHoldTime':_0x1024be[_0xe583('0x2c')]||0x0,'talking':_0x1024be[_0xe583('0x2d')],'total':_0x1024be[_0xe583('0x2e')],'type':_0x1024be[_0xe583('0x26')],'unmanaged':_0x1024be[_0xe583('0x2f')],'abandoned':_0x1024be[_0xe583('0x30')],'waiting':_0x1024be[_0xe583('0x31')],'loggedInDb':_0x1024be[_0xe583('0x32')],'dialActive':_0x1024be['dialActive'],'dialMethod':_0x1024be[_0xe583('0x33')],'dialOriginateCallerIdName':_0x1024be[_0xe583('0x34')],'dialOriginateCallerIdNumber':_0x1024be[_0xe583('0x35')],'dialOriginateTimeout':_0x1024be[_0xe583('0x36')],'dialPrefix':_0x1024be[_0xe583('0x37')],'outboundAnswerAgiCallsDay':_0x1024be[_0xe583('0x38')],'outboundAnswerCallsDay':_0x1024be[_0xe583('0x39')],'outboundBlacklistCallsDay':_0x1024be[_0xe583('0x3a')],'outboundBusyCallsDay':_0x1024be[_0xe583('0x3b')],'outboundCongestionCallsDay':_0x1024be[_0xe583('0x3c')],'outboundDropCallsDayACS':_0x1024be['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1024be[_0xe583('0x3d')],'outboundDropCallsDayTimeout':_0x1024be['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1024be[_0xe583('0x3e')],'outboundNoSuchCallsDay':_0x1024be[_0xe583('0x3f')],'outboundOriginateFailureCallsDay':_0x1024be['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1024be['outboundReCallsDay'],'outboundRejectCallsDay':_0x1024be[_0xe583('0x40')],'outboundUnknownCallsDay':_0x1024be[_0xe583('0x41')],'outboundAbandonedCallsDay':_0x1024be[_0xe583('0x42')],'predictiveIntervalAnsweredCalls':_0x1024be[_0xe583('0x43')],'predictiveIntervalAvgHoldtime':_0x1024be[_0xe583('0x44')],'predictiveIntervalAvgTalktime':_0x1024be['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1024be[_0xe583('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x1024be[_0xe583('0x46')],'predictiveIntervalErlangCalls':_0x1024be['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1024be['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1024be[_0xe583('0x47')],'predictiveIntervalMultiplicativeFactor':_0x1024be[_0xe583('0x48')],'predictiveIntervalPauses':_0x1024be[_0xe583('0x49')],'predictiveIntervalAvailable':_0x1024be['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1024be['predictiveIntervalTotalCalls'],'message':_0x1024be[_0xe583('0x4a')],'originated':_0x1024be[_0xe583('0x4b')],'erlangCalls':_0x1024be[_0xe583('0x4c')],'erlangCallToSecond':_0x1024be[_0xe583('0x4d')],'erlangAbandonmentRate':_0x1024be[_0xe583('0x4e')],'erlangBusyFactor':_0x1024be[_0xe583('0x4f')],'startPredictive':_0x1024be[_0xe583('0x50')],'startProgressive':_0x1024be[_0xe583('0x51')]};if(_0x1024be[_0xe583('0x52')]){_0xad9ac9[_0xe583('0x52')]={'id':_0x1024be[_0xe583('0x52')]['id'],'name':_0x1024be[_0xe583('0x52')][_0xe583('0x28')],'active':_0x1024be[_0xe583('0x52')][_0xe583('0x53')],'callerid':_0x1024be[_0xe583('0x52')][_0xe583('0x54')]};}if(_0x1024be[_0xe583('0x55')]){_0xad9ac9[_0xe583('0x55')]={'id':_0x1024be[_0xe583('0x55')]['id'],'name':_0x1024be[_0xe583('0x55')]['name']};}var _0x6a9f68=md5(JSON[_0xe583('0x56')](_0xad9ac9));if(_0x1024be[_0xe583('0x5')]!==_0x6a9f68){_0x1024be[_0xe583('0x5')]=_0x6a9f68;emit(util[_0xe583('0x57')](_0xe583('0x58'),_0xad9ac9[_0xe583('0x28')]),'voice_queue:save',_0xad9ac9);}}}function emitVoiceQueueChannelRemove(_0x266a4b){logger[_0xe583('0x59')](_0xe583('0x5a'),JSON['stringify'](_0x266a4b));emit(util[_0xe583('0x57')](_0xe583('0x58'),_0x266a4b[_0xe583('0x28')]),_0xe583('0x5b'),_0x266a4b);io['emit'](_0xe583('0x5c'),_0x266a4b);}function notSendMessagesQueue(_0x34170b){if(_0x34170b[_0xe583('0x5d')]){if(_0x34170b[_0xe583('0x4b')]===0x0&&_0x34170b['pTalking']===0x0){_0x34170b[_0xe583('0x5d')]=![];_0x34170b[_0xe583('0x29')]=0x0;_0x34170b['paused']=0x0;_0x34170b[_0xe583('0x4a')]=_0xe583('0x5e');ut[_0xe583('0x5f')](_0xe583('0x60'),_0x34170b[_0xe583('0x28')]+_0xe583('0x61'));}else{_0x34170b[_0xe583('0x4a')]=_0xe583('0x62');ut[_0xe583('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x34170b['name']+_0xe583('0x63'));}emitCampaignPreview(_0x34170b);}}Preview[_0xe583('0xf')]['loopCampaigns']=function(){var _0x15148a=this;setInterval(function(){_0x15148a[_0xe583('0x64')]();},0x7cf);};Preview[_0xe583('0xf')][_0xe583('0x64')]=function(){var _0x420d75=this[_0xe583('0x65')];this[_0xe583('0x17')]+=0x1;for(var _0x1e90c7 in _0x420d75){if(_0x420d75[_0xe583('0x66')](_0x1e90c7)&&(_0x420d75[_0x1e90c7][_0xe583('0x33')]===_0xe583('0x67')||_0x420d75[_0x1e90c7][_0xe583('0x33')]===_0xe583('0x68'))&&_0x420d75[_0x1e90c7][_0xe583('0x26')]===_0xe583('0x27')){if(this[_0xe583('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe583('0x69')]();}}if(_0x420d75[_0xe583('0x66')](_0x1e90c7)&&_0x420d75[_0x1e90c7][_0xe583('0x33')]===_0xe583('0x67')&&_0x420d75[_0x1e90c7][_0xe583('0x26')]===_0xe583('0x27')){if(_0x420d75[_0x1e90c7][_0xe583('0x6a')]){this[_0xe583('0x6b')](_0x420d75[_0x1e90c7]);this['recallMe'](_0x420d75[_0x1e90c7]);}else{notSendMessagesQueue(_0x420d75[_0x1e90c7]);}}}};Preview['prototype'][_0xe583('0x6c')]=function(_0x54a3bc){var _0x2ca145=this;this[_0xe583('0x6d')][_0xe583('0x10')](function(){if(!_[_0xe583('0x6e')](_0x2ca145['actions'][_0x54a3bc])){loggerAction[_0xe583('0x59')](_0xe583('0x6f'),_0x54a3bc,_0xe583('0x70'),_0x2ca145['actions'][_0x54a3bc][_0xe583('0x71')],'originated:\x20',JSON[_0xe583('0x56')](_0x2ca145[_0xe583('0x65')][_0x2ca145[_0xe583('0x15')][_0x54a3bc][_0xe583('0x71')]]['originated']),_0xe583('0x72'),JSON[_0xe583('0x56')](_0x2ca145['campaignsPreview'][_0x2ca145[_0xe583('0x15')][_0x54a3bc][_0xe583('0x71')]]['pTalking']),JSON['stringify'](_0x2ca145[_0xe583('0x15')][_0x54a3bc]['dialAnswer']),JSON[_0xe583('0x56')](_[_0xe583('0x73')](_0x2ca145[_0xe583('0x15')][_0x54a3bc],[_0xe583('0x74'),'UserId',_0xe583('0x75'),'ListId'])));return ami[_0xe583('0x76')]({'action':_0xe583('0x77'),'channel':_0x2ca145['actions'][_0x54a3bc][_0xe583('0x78')]})[_0xe583('0x79')](function(_0x4e8164){if(_0x4e8164[_0xe583('0x4a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2ca145[_0xe583('0x15')][_0x54a3bc]){ut[_0xe583('0x7a')](_0x2ca145['campaignsPreview'][_0x2ca145['actions'][_0x54a3bc][_0xe583('0x71')]],_0xe583('0x7b'));if(_0x2ca145[_0xe583('0x15')][_0x54a3bc][_0xe583('0x7c')]===!![]){ut[_0xe583('0x7d')](_0x2ca145[_0xe583('0x65')][_0x2ca145[_0xe583('0x15')][_0x54a3bc][_0xe583('0x71')]],_0xe583('0x7b'));ut['loggerError'](_0xe583('0x7e')+_0x54a3bc,_0x2ca145[_0xe583('0x15')][_0x54a3bc][_0xe583('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x54a3bc,_0x2ca145['actions'][_0x54a3bc][_0xe583('0x71')]);delete _0x2ca145[_0xe583('0x15')][_0x54a3bc];}},0x2328);}});}});};Preview[_0xe583('0xf')][_0xe583('0x69')]=function(){var _0x341706=this;loggerAction['info'](_0xe583('0x7f'),_[_0xe583('0x80')](this[_0xe583('0x15')]));for(var _0x565d38 in this[_0xe583('0x15')]){if(_0x341706[_0xe583('0x15')]['hasOwnProperty'](_0x565d38)){_0x341706['clearZombieChannel'](_0x565d38);}}};Preview['prototype']['recallMe']=function(_0x384c9a){var _0x5a75bc=this;rpcDb[_0xe583('0x81')](_0x384c9a['id'],ut['agentReadyId'](this[_0xe583('0x16')]))['then'](function(_0x2c9d36){if(!_[_0xe583('0x6e')](_0x2c9d36)){for(var _0x7b4836=0x0;_0x7b4836<_0x2c9d36[_0xe583('0x82')];_0x7b4836+=0x1){if(ut['getDiff'](_0x2c9d36[_0x7b4836]['scheduledat'])<_0x384c9a[_0xe583('0x83')]*0x3c){if(_0x2c9d36[_0x7b4836][_0xe583('0x84')]&&!_0x2c9d36[_0x7b4836][_0xe583('0x84')][_0xe583('0x85')]){_0x5a75bc[_0xe583('0x86')](_0x2c9d36[_0x7b4836]['id'])[_0xe583('0x87')](ut[_0xe583('0x88')](_0xe583('0x89')))[_0xe583('0x79')](ut[_0xe583('0x88')]('[RecallMe]'));}else{rpcDb[_0xe583('0x8a')](_0x2c9d36[_0x7b4836]['id']);}}else{var _0x54bc0f=new Action(_0x2c9d36[_0x7b4836],_0x384c9a);_0x54bc0f['starttime']=moment()[_0xe583('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x384c9a[_0xe583('0x8b')]+=0x1;ut[_0xe583('0x8c')](_0x54bc0f,0x17,'RecallInQueue');if(_0x384c9a[_0xe583('0x8d')]){rpcDb[_0xe583('0x8e')](ut[_0xe583('0x8f')](_0x2c9d36[_0x7b4836]));rpcDb['createCustomerHistory'](_0x54bc0f,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xe583('0x8c')](_0x54bc0f,0x16,_0xe583('0x90'));rpcDb[_0xe583('0x91')](_0x54bc0f,_0xe583('0x92'));rpcDb[_0xe583('0x93')](_0x54bc0f,_0xe583('0x92'));}}}}})[_0xe583('0x79')](ut[_0xe583('0x88')](_0xe583('0x94')));};Preview[_0xe583('0xf')][_0xe583('0x6b')]=function(_0x4896b4){_0x4896b4[_0xe583('0x5d')]=!![];if(ut['IsNotLoggedIn'](_0x4896b4['loggedIn'])){_0x4896b4[_0xe583('0x4a')]=_0xe583('0x95');}else if(!ut[_0xe583('0x96')](_0x4896b4[_0xe583('0x6a')])){_0x4896b4[_0xe583('0x4a')]=_0xe583('0x5e');}else if(!this[_0xe583('0x97')](_0x4896b4[_0xe583('0x52')])){if(!this['isTrunkReachable'](_0x4896b4['TrunkBackup'])){_0x4896b4[_0xe583('0x4a')]=_0xe583('0x98');}else{_0x4896b4[_0xe583('0x4a')]=_0xe583('0x99');}}else{_0x4896b4[_0xe583('0x4a')]=_0xe583('0x99');}emitCampaignPreview(_0x4896b4);};Preview['prototype'][_0xe583('0x9a')]=function(_0x458e99,_0x1965e4,_0x325ef3){var _0x1d5451=this;var _0x323387=this['actions'][_0x1965e4];var _0x40ec8c=this[_0xe583('0x65')][_0x323387['queue']];var _0x44e4cf;if(_0x40ec8c){switch(_0x325ef3){case'1':_0x40ec8c[_0xe583('0x3f')]+=0x1;_0x323387[_0xe583('0x9b')]+=0x1;_0x323387[_0xe583('0x9c')]=ut['totalGlobal'](_0x323387);ut[_0xe583('0x8c')](_0x323387,0x0,_0xe583('0x9d'));ami[_0xe583('0x25')](_0xe583('0x9e'),ut[_0xe583('0x9f')](_0x323387,_0xe583('0xa0')));rpcDb[_0xe583('0x91')](_0x323387,_0xe583('0xa1'));if(ut['totalGlobal'](_0x323387)>=_0x40ec8c[_0xe583('0xa2')]){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0xf,_0xe583('0xa4'));rpcDb[_0xe583('0x93')](_0x44e4cf,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x323387[_0xe583('0x9b')]>=_0x40ec8c[_0xe583('0xa5')]){rpcDb[_0xe583('0x93')](_0x323387,_0xe583('0xa6'));}else{rpcDb[_0xe583('0xa7')](ut[_0xe583('0xa8')](_0x323387,_0xe583('0x9b'),_0x40ec8c[_0xe583('0xa9')]),_0x323387['unlockAgent'],_0x323387['activeContact']);}}delete this[_0xe583('0x15')][_0x458e99[_0xe583('0xaa')]];break;case _0xe583('0xab'):var _0x599b16=moment()[_0xe583('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x323387['responsetime']=_0x599b16;_0x323387['answertime']=_0x599b16;_0x323387['dialAnswer']=!![];_0x40ec8c[_0xe583('0x2a')]+=0x1;logger[_0xe583('0x59')](_0xe583('0xac'),_0x323387[_0xe583('0xad')],_0xe583('0xae'),_0x40ec8c[_0xe583('0x28')],_0xe583('0x72'),_0x40ec8c[_0xe583('0x2a')]);ami[_0xe583('0x25')]('custom:agentconnect',ut[_0xe583('0x9f')](_0x323387,_0xe583('0xaf'),this['campaignsPreview'][_0x323387[_0xe583('0x71')]]));if(_0x40ec8c[_0xe583('0xb0')]){ami['emit']('custom:agentConnectPreview',ut[_0xe583('0xb1')](_0x323387));}break;case'16':ami[_0xe583('0x25')](_0xe583('0xb2'),ut[_0xe583('0x9f')](_0x323387,_0xe583('0xb3'),this['campaignsPreview'][_0x323387[_0xe583('0x71')]]));emitVoiceQueueChannelRemove(ut[_0xe583('0x9f')](_0x323387,_0xe583('0xb3')));_0x40ec8c['outboundAnswerCallsDay']+=0x1;_0x40ec8c[_0xe583('0x2e')]+=0x1;_0x40ec8c[_0xe583('0xb4')]+=0x1;ut[_0xe583('0x7d')](_0x40ec8c,_0xe583('0xb5'));_0x323387[_0xe583('0x9c')]=ut[_0xe583('0xb6')](_0x323387);ut[_0xe583('0x8c')](_0x323387,0x4,_0xe583('0xb7'));rpcDb[_0xe583('0x91')](_0x323387,_0xe583('0xb8'));rpcDb['createCustomerFinal'](_0x323387,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe583('0xb9')](_0x323387);_0x40ec8c[_0xe583('0xba')]+=_0x323387[_0xe583('0xbb')];_0x40ec8c[_0xe583('0x2b')]+=_0x323387[_0xe583('0xbb')];logger[_0xe583('0x59')](_0xe583('0xbc'),_0x323387[_0xe583('0xad')],'\x20Queue',_0x40ec8c[_0xe583('0x28')],_0xe583('0x72'),_0x40ec8c[_0xe583('0x2a')]);delete this[_0xe583('0x15')][_0x458e99['linkedid']];break;case'BUSY':_0x40ec8c['outboundBusyCallsDay']+=0x1;_0x323387[_0xe583('0xbd')]+=0x1;_0x323387[_0xe583('0x9c')]=ut['totalGlobal'](_0x323387);ut[_0xe583('0x8c')](_0x323387,0x5,_0xe583('0xbe'));ami[_0xe583('0x25')](_0xe583('0xbf'),ut[_0xe583('0x9f')](_0x323387,_0xe583('0xc0')));rpcDb['createCustomerHistory'](_0x323387,_0xe583('0xc1'));if(ut[_0xe583('0xb6')](_0x323387)>=_0x40ec8c[_0xe583('0xa2')]){_0x44e4cf=ut['cloneAction'](_0x323387,0xf,_0xe583('0xa4'));rpcDb[_0xe583('0x93')](_0x44e4cf,_0xe583('0xc2'));}else{if(_0x323387[_0xe583('0xbd')]>=_0x40ec8c[_0xe583('0xc3')]){rpcDb[_0xe583('0x93')](_0x323387,_0xe583('0xc1'));}else{rpcDb[_0xe583('0xa7')](ut[_0xe583('0xa8')](_0x323387,'countbusyretry',_0x40ec8c['dialBusyRetryFrequency']),_0x323387[_0xe583('0xc4')],_0x323387[_0xe583('0xc5')]);}}break;case _0xe583('0xc6'):_0x40ec8c[_0xe583('0x3e')]+=0x1;_0x323387[_0xe583('0xc7')]+=0x1;_0x323387[_0xe583('0x9c')]=ut[_0xe583('0xb6')](_0x323387);ut['logCustomer'](_0x323387,0x3,'NoAnswer');ami[_0xe583('0x25')](_0xe583('0xc8'),ut[_0xe583('0x9f')](_0x323387,_0xe583('0xc9')));rpcDb['createCustomerHistory'](_0x323387,_0xe583('0xca'));if(ut['totalGlobal'](_0x323387)>=_0x40ec8c['dialGlobalMaxRetry']){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0xf,'Global');rpcDb['createCustomerFinal'](_0x44e4cf,_0xe583('0xcb'));}else{if(_0x323387['countnoanswerretry']>=_0x40ec8c[_0xe583('0xcc')]){rpcDb[_0xe583('0x93')](_0x323387,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe583('0xa7')](ut[_0xe583('0xa8')](_0x323387,'countnoanswerretry',_0x40ec8c['dialNoAnswerRetryFrequency']),_0x323387['unlockAgent'],_0x323387[_0xe583('0xc5')]);}}break;case _0xe583('0xcd'):_0x40ec8c[_0xe583('0x3c')]+=0x1;_0x323387['countcongestionretry']+=0x1;_0x323387[_0xe583('0x9c')]=ut['totalGlobal'](_0x323387);ut[_0xe583('0x8c')](_0x323387,0x8,_0xe583('0xce'));ami[_0xe583('0x25')]('custom:agentcongestion',ut[_0xe583('0x9f')](_0x323387,_0xe583('0xcf')));rpcDb['createCustomerHistory'](_0x323387,_0xe583('0xd0'));if(ut[_0xe583('0xb6')](_0x323387)>=_0x40ec8c['dialGlobalMaxRetry']){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0xf,_0xe583('0xa4'));rpcDb[_0xe583('0x93')](_0x44e4cf,_0xe583('0xd1'));}else{if(_0x323387['countcongestionretry']>=_0x40ec8c['dialCongestionMaxRetry']){rpcDb[_0xe583('0x93')](_0x323387,_0xe583('0xd0'));}else{rpcDb[_0xe583('0xa7')](ut[_0xe583('0xa8')](_0x323387,_0xe583('0xd2'),_0x40ec8c[_0xe583('0xd3')]),_0x323387[_0xe583('0xc4')],_0x323387[_0xe583('0xc5')]);}}break;case _0xe583('0xd4'):_0x40ec8c['outboundRejectCallsDay']+=0x1;_0x323387[_0xe583('0xd5')]+=0x1;_0x323387[_0xe583('0x9c')]=ut['totalGlobal'](_0x323387);ut[_0xe583('0x8c')](_0x323387,0x14,'AgentReject');ami['emit'](_0xe583('0xd6'),ut[_0xe583('0x9f')](_0x323387,_0xe583('0xd7')));rpcDb[_0xe583('0x91')](_0x323387,_0xe583('0xd8'));if(ut[_0xe583('0xb6')](_0x323387)>=_0x40ec8c[_0xe583('0xa2')]){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0x14,_0xe583('0xd9'));rpcDb[_0xe583('0x93')](_0x44e4cf,_0xe583('0xda'));}else{if(_0x323387['countagentrejectretry']>=_0x40ec8c[_0xe583('0xdb')]){rpcDb['createCustomerFinal'](_0x323387,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xe583('0xa8')](_0x323387,'countagentrejectretry',_0x40ec8c[_0xe583('0xdc')]),_0x323387[_0xe583('0xc4')],_0x323387[_0xe583('0xc5')]);}}break;case _0xe583('0xdd'):_0x40ec8c[_0xe583('0x42')]+=0x1;_0x323387['countabandonedretry']+=0x1;_0x323387[_0xe583('0x9c')]=ut[_0xe583('0xb6')](_0x323387);ut[_0xe583('0x8c')](_0x323387,0xb,_0xe583('0xde'));rpcDb[_0xe583('0x91')](_0x323387,_0xe583('0xdf'));if(ut[_0xe583('0xb6')](_0x323387)>=_0x40ec8c['dialGlobalMaxRetry']){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0xf,_0xe583('0xa4'));rpcDb[_0xe583('0x93')](_0x44e4cf,_0xe583('0xdf'));}else{if(_0x323387['countabandonedetry']>=_0x40ec8c['dialAbandonedMaxRety']){rpcDb[_0xe583('0x93')](_0x323387,_0xe583('0xdf'));}else{rpcDb[_0xe583('0xa7')](ut[_0xe583('0xa8')](_0x323387,_0xe583('0xe0'),_0x40ec8c[_0xe583('0xe1')]),_0x323387[_0xe583('0xc4')],_0x323387[_0xe583('0xc5')]);}}break;default:if(_0x323387['dialAnswer']){ut['decrementTalkink'](_0x40ec8c,_0xe583('0xe2'));ut[_0xe583('0xe3')](_0xe583('0xe4')+_0x40ec8c[_0xe583('0x28')],_0x458e99);}_0x40ec8c[_0xe583('0x41')]+=0x1;_0x323387['countglobal']=ut[_0xe583('0xb6')](_0x323387);ut[_0xe583('0x8c')](_0x323387,0xc,_0x458e99[_0xe583('0xe5')]||_0x458e99['dialstatus']);rpcDb[_0xe583('0x91')](_0x323387,_0xe583('0xe6'));if(ut[_0xe583('0xb6')](_0x323387)>=_0x40ec8c[_0xe583('0xa2')]){_0x44e4cf=ut[_0xe583('0xa3')](_0x323387,0xf,_0xe583('0xa4'));rpcDb[_0xe583('0x93')](_0x44e4cf,_0xe583('0xe7'));}else{rpcDb[_0xe583('0x93')](_0x323387,_0xe583('0xe7'));}delete this[_0xe583('0x15')][_0x458e99[_0xe583('0xaa')]];}if(!(_0x323387[_0xe583('0x7c')]&&_0x325ef3==='16')){ut['updateOriginated'](_0x40ec8c,_0xe583('0xe8'));logger[_0xe583('0x59')](_0xe583('0xe9'),_0x323387['uniqueid'],'\x20Queue',_0x40ec8c[_0xe583('0x28')],_0xe583('0xea'),_0x40ec8c[_0xe583('0x4b')]);}if(_0x325ef3!==_0xe583('0xab')){delete this['actions'][_0x458e99['linkedid']];delete this['actions'][_0x458e99['destlinkedid']];}}};Preview[_0xe583('0xf')][_0xe583('0xeb')]=function(_0x207898,_0x315e44,_0x35affe){if(_[_0xe583('0xec')](_0x315e44)&&_0xe583('0xed')!==typeof _0x315e44){return;}if(_[_0xe583('0xec')](_0x35affe)&&_0xe583('0xed')!==typeof _0x35affe){return;}switch(_0x35affe[_0xe583('0xee')]){case'0':ut[_0xe583('0xef')](_0x207898,0x0,_0xe583('0x9d'));rpcDb[_0xe583('0xf0')](_0x207898,_0xe583('0xf1'));break;case'3':ut[_0xe583('0xef')](_0x207898,0x3,_0xe583('0xf2'));rpcDb[_0xe583('0xf0')](_0x207898,_0xe583('0xf3'));break;case'5':ut['logAgent'](_0x207898,0x5,_0xe583('0xbe'));rpcDb[_0xe583('0xf0')](_0x207898,_0xe583('0xf4'));break;case'8':ut[_0xe583('0xef')](_0x207898,0x8,'Congestion');rpcDb[_0xe583('0xf0')](_0x207898,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe583('0xef')](_0x207898,0x16,_0xe583('0xf5'));rpcDb[_0xe583('0xf0')](_0x207898,_0xe583('0xf6'));break;default:ut[_0xe583('0xef')](_0x207898,0xc,_0x35affe[_0xe583('0xee')]);rpcDb['createAgentHistory'](_0x207898,_0xe583('0xf7'));}ut[_0xe583('0x7a')](_0x315e44,_0xe583('0xf8'));logger[_0xe583('0x59')](_0xe583('0xf9'),_0x207898['uniqueid'],_0xe583('0xae'),_0x315e44[_0xe583('0x28')],_0xe583('0xea'),_0x315e44['originated']);delete this[_0xe583('0x15')][_0x207898[_0xe583('0xad')]];};Preview['prototype'][_0xe583('0xfa')]=function(_0x2f0ac4,_0x2b2b68,_0x3f3283,_0x3cfc75,_0x19cc7a){var _0x5da065=this;return new BPromise(function(_0x48e1dc,_0x244cad){if(_['isNil'](_0x2b2b68)||_[_0xe583('0x6e')](_0x2b2b68['Contact'])||_[_0xe583('0x6e')](_0x2b2b68[_0xe583('0xfb')]['phone'])||_[_0xe583('0x6e')](_0x2b2b68[_0xe583('0x75')])){_0x244cad(ut[_0xe583('0x4a')](_0xe583('0xfc'),_0x3cfc75,_0x19cc7a));return;}var _0x4634f8=uuid['v4']();var _0x300825=_0x5da065[_0xe583('0x65')][_0x2b2b68[_0xe583('0x70')][_0xe583('0x28')]];var _0x1ee23b=_0x3f3283?_0x5da065[_0xe583('0x16')][_0x3f3283]['id']:undefined;_0x5da065['actions'][_0x4634f8]=new Action(_0x2b2b68,_0x300825,_0x4634f8,_0x3f3283,_0x1ee23b);var _0x462728=_0x5da065['actions'][_0x4634f8];_0x462728[_0xe583('0xc4')]=_0x3cfc75;_0x462728[_0xe583('0xc5')]=_0x19cc7a;_0x462728[_0xe583('0xfd')]=_0x3f3283;if(_[_0xe583('0xfe')](_0x2f0ac4)){_0x5da065['execCall'](_0x462728,_0x300825,_0x2b2b68,_0x3f3283)[_0xe583('0x87')](function(_0x3ac934){logger[_0xe583('0x59')](_0xe583('0xff'),_0xe583('0x100')+_0x462728['queue']+'\x20IdHopper:\x20'+_0x462728['idContact'],JSON[_0xe583('0x56')](_0x3ac934));ami[_0xe583('0x25')](_0xe583('0x101'),ut['buildObj'](_0x462728,_0xe583('0x102'),_0x5da065[_0xe583('0x65')][_0x462728[_0xe583('0x71')]]));_0x48e1dc(ut[_0xe583('0x4a')](_0xe583('0x103')));})[_0xe583('0x79')](function(_0x476b7c){ut[_0xe583('0x5f')]('[Preview][execCall][failure]',_0x476b7c);_0x244cad(ut[_0xe583('0x4a')](_0xe583('0x104'),_0x3cfc75,_0x19cc7a));});}else{_0x300825[_0xe583('0x3a')]+=0x1;ut['logBlacklist'](_0x462728);rpcDb[_0xe583('0x105')](_0x462728,_0xe583('0x106'));delete _0x5da065[_0xe583('0x15')][_0x4634f8];_0x244cad(ut[_0xe583('0x4a')](_0xe583('0x107'),_0x3cfc75,_0x19cc7a));}});};Preview[_0xe583('0xf')][_0xe583('0x97')]=function(_0xbca4b2){return!_[_0xe583('0x6e')](_0xbca4b2)&&!_[_0xe583('0x6e')](_0xbca4b2[_0xe583('0x28')])&&!_[_0xe583('0x6e')](_0xbca4b2[_0xe583('0x53')])&&_0xbca4b2[_0xe583('0x53')]&&!_[_0xe583('0x6e')](this[_0xe583('0x14')][util['format'](_0xe583('0x108'),_0xbca4b2[_0xe583('0x28')])])&&!_[_0xe583('0x6e')](this['trunks'][util[_0xe583('0x57')](_0xe583('0x108'),_0xbca4b2[_0xe583('0x28')])][_0xe583('0x77')])&&(this[_0xe583('0x14')][util['format'](_0xe583('0x108'),_0xbca4b2['name'])][_0xe583('0x77')]===_0xe583('0x109')||this[_0xe583('0x14')][util[_0xe583('0x57')](_0xe583('0x108'),_0xbca4b2[_0xe583('0x28')])][_0xe583('0x77')]===_0xe583('0x10a'));};Preview[_0xe583('0xf')]['run']=function(_0x55121d,_0x5ee34b){var _0x53ea55=this;return new BPromise(function(_0x50aae3,_0x2b25d0){_0x53ea55[_0xe583('0x10b')](_0x55121d,_0x5ee34b)[_0xe583('0x87')](function(_0x33a089){_0x50aae3(_[_0xe583('0x73')](_0x33a089,[_0xe583('0x4a')]));})[_0xe583('0x79')](function(_0x49b319){if(_0x49b319[_0xe583('0x10c')]){rpcDb[_0xe583('0x10d')](_0x55121d);}if(_0x49b319['active']){rpcDb[_0xe583('0x8a')](_0x55121d);}_0x2b25d0(_[_0xe583('0x73')](_0x49b319,[_0xe583('0x4a')]));});});};Preview[_0xe583('0xf')]['execRun']=function(_0x1b3141,_0x2353f8){var _0x56a17b=this;return new BPromise(function(_0x1090c6,_0x27c4a2){var _0x71f9f,_0x5f4106;rpcDb[_0xe583('0x10e')](_0x1b3141)[_0xe583('0x87')](function(_0x5e624f){if(!_[_0xe583('0x6e')](_0x5e624f[0x0])){_0x5f4106=_0x5e624f[0x0]['recallme']?![]:!![];_0x71f9f=_0x5e624f[0x0][_0xe583('0x10f')]?!![]:![];_0x71f9f=_0x2353f8?!![]:_0x71f9f;}var _0x10a735=_0x56a17b['validateContact'](_0x5e624f);if(_0x10a735[_0xe583('0x110')]){rpcDb[_0xe583('0x111')](_[_0xe583('0x73')](_0x5e624f[0x0],[_0xe583('0x75'),'Contact.phone']))[_0xe583('0x87')](function(_0x548447){_0x56a17b[_0xe583('0xfa')](_0x548447,_0x5e624f[0x0],_0x2353f8,_0x5f4106,_0x71f9f)[_0xe583('0x87')](function(_0x2c5c51){_0x1090c6(_0x2c5c51);})[_0xe583('0x79')](function(_0x5916d4){_0x27c4a2(_0x5916d4);});})[_0xe583('0x79')](function(_0x3e0d58){ut[_0xe583('0x5f')](_0xe583('0x112'),_0x3e0d58);_0x27c4a2(ut[_0xe583('0x4a')]('Call\x20unsuccessful',_0x5f4106,_0x71f9f));});}else{_0x27c4a2(ut[_0xe583('0x4a')](_0x10a735[_0xe583('0x4a')],_0x5f4106,_0x71f9f));}})[_0xe583('0x79')](function(_0x1da6a4){ut[_0xe583('0x5f')](_0xe583('0x113'),_0x1da6a4);_0x27c4a2(ut[_0xe583('0x4a')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xe583('0xf')][_0xe583('0x114')]=function(_0x573c98){if(_[_0xe583('0x6e')](_0x573c98)||_[_0xe583('0xfe')](_0x573c98)||!_['isNil'](_0x573c98[0x0][_0xe583('0x84')])&&_[_0xe583('0x6e')](_0x573c98[0x0][_0xe583('0x84')][_0xe583('0x28')])){ut[_0xe583('0x5f')](_0xe583('0x115'),_0x573c98);return{'isValid':![],'message':_0xe583('0x116')};}var _0x45bb48=this[_0xe583('0x65')][_0x573c98[0x0]['Queue'][_0xe583('0x28')]];_0x45bb48[_0xe583('0x4a')]=_0xe583('0x99');if(_[_0xe583('0x6e')](_0x45bb48)){ut[_0xe583('0x5f')](_0xe583('0x117'),_0x45bb48);return{'isValid':![],'message':_0xe583('0x118')};}if(!this[_0xe583('0x97')](_0x45bb48[_0xe583('0x52')])){ut[_0xe583('0x5f')](_0xe583('0x119'),_0xe583('0x11a')+_0x45bb48[_0xe583('0x28')]+_0xe583('0x11b'));if(!this[_0xe583('0x97')](_0x45bb48[_0xe583('0x11c')])){ut[_0xe583('0x5f')](_0xe583('0x119'),_0x45bb48[_0xe583('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe583('0x11d')};}}if(!ut[_0xe583('0x96')](_0x45bb48[_0xe583('0x6a')])){ut[_0xe583('0x5f')](_0xe583('0x11e'),_0x45bb48[_0xe583('0x28')]+_0xe583('0x11f'));return{'isValid':![],'message':_0xe583('0x11a')+_0x45bb48[_0xe583('0x28')]+_0xe583('0x11f')};}return{'isValid':!![],'message':_0xe583('0x120')};};Preview[_0xe583('0xf')][_0xe583('0x121')]=function(_0x5066a9,_0x4eeaed,_0x175304,_0x1cb8db){var _0x2220bf=this;return new BPromise(function(_0x3add66,_0x2bfef2){var _0x3ae5f=_0x5066a9[_0xe583('0xad')];var _0x4d2ce3=_0x2220bf[_0xe583('0x97')](_0x4eeaed['Trunk'])?util[_0xe583('0x57')](_0xe583('0x122'),_0x4eeaed[_0xe583('0x52')][_0xe583('0x28')],_[_0xe583('0x6e')](_0x4eeaed[_0xe583('0x37')])?'':_0x4eeaed[_0xe583('0x37')]['trim']()||'',_0x4eeaed[_0xe583('0x123')]>0x0?_0x175304[_0xe583('0xfb')][_0xe583('0x124')][_0xe583('0x125')](_0x4eeaed[_0xe583('0x123')]):_0x175304['Contact']['phone']):util[_0xe583('0x57')](_0xe583('0x122'),_[_0xe583('0x6e')](_0x4eeaed[_0xe583('0x11c')])?_0x4eeaed['Trunk'][_0xe583('0x28')]:_0x4eeaed['TrunkBackup']['name'],_['isNil'](_0x4eeaed[_0xe583('0x37')])?'':_0x4eeaed[_0xe583('0x37')][_0xe583('0x126')]()||'',_0x4eeaed['dialCutDigit']>0x0?_0x175304[_0xe583('0xfb')][_0xe583('0x124')]['substring'](_0x4eeaed[_0xe583('0x123')]):_0x175304['Contact'][_0xe583('0x124')]);var _0x39f033=_0x2220bf['isTrunkReachable'](_0x4eeaed['Trunk'])?ut['getCallerId'](_0x4eeaed[_0xe583('0x52')][_0xe583('0x54')],_0x4eeaed[_0xe583('0x34')],_0x4eeaed[_0xe583('0x127')]>0x0?ut[_0xe583('0x128')](_0x4eeaed[_0xe583('0x35')],_0x4eeaed[_0xe583('0x127')]):_0x4eeaed['dialOriginateCallerIdNumber']):ut[_0xe583('0x129')](_['isNil'](_0x4eeaed[_0xe583('0x11c')])?_0x4eeaed[_0xe583('0x52')][_0xe583('0x54')]:_0x4eeaed[_0xe583('0x11c')][_0xe583('0x54')],_0x4eeaed[_0xe583('0x34')],_0x4eeaed[_0xe583('0x127')]>0x0?ut[_0xe583('0x128')](_0x4eeaed[_0xe583('0x35')],_0x4eeaed[_0xe583('0x127')]):_0x4eeaed['dialOriginateCallerIdNumber']);if(_0x39f033){_0x5066a9['originatecalleridname']=ut['extractCalleridName'](_0x39f033);_0x5066a9[_0xe583('0x12a')]=ut[_0xe583('0x12b')](_0x39f033);}var _0xad60ff=ut[_0xe583('0x12c')](_0x4eeaed,_0x175304,_0x4d2ce3,_0x39f033,_0x3ae5f,_0x5066a9);_[_0xe583('0x12d')](_0x5066a9,ut['toLowerVariables'](_0xad60ff));_0x5066a9[_0xe583('0x12e')]=moment()[_0xe583('0x57')](_0xe583('0x12f'));ami[_0xe583('0x76')](ut[_0xe583('0x130')](_0x5066a9,_0x4eeaed,_0xad60ff,_0x5066a9[_0xe583('0xc5')],_0x1cb8db))[_0xe583('0x87')](function(_0x4f3d89){_0x4eeaed['originated']+=0x1;logger[_0xe583('0x59')](_0xe583('0x131'),_0x3ae5f,'\x20Queue',_0x4eeaed[_0xe583('0x28')],_0xe583('0xea'),_0x4eeaed[_0xe583('0x4b')]);_0x3add66(_0x4f3d89);})[_0xe583('0x79')](function(_0x2064c7){ut[_0xe583('0xef')](_0x5066a9,0xe,_0xe583('0x132'));rpcDb[_0xe583('0xf0')](_0x5066a9,_0xe583('0x133'));_0x2bfef2(_0x2064c7);});});};Preview[_0xe583('0xf')][_0xe583('0x134')]=function(_0x3f5038){if(this[_0xe583('0x15')][_0x3f5038[_0xe583('0xaa')]]){this['actions'][_0x3f5038[_0xe583('0xaa')]]['channel']=_0x3f5038[_0xe583('0x78')];}};Preview[_0xe583('0xf')][_0xe583('0x135')]=function(_0x365384){var _0x1aa420=this;var _0x48eee8=this[_0xe583('0x15')][_0x365384['actionid']];if(_0x48eee8){if(_0x48eee8['lookAgent']&&this['agents'][_0x48eee8[_0xe583('0xfd')]]){ut[_0xe583('0x136')](_0x48eee8,this[_0xe583('0x16')][_0x48eee8[_0xe583('0xfd')]][_0xe583('0x28')],this[_0xe583('0x16')][_0x48eee8['lookAgent']]['id']);}var _0x23a71d=_[_0xe583('0x137')](_0x48eee8);_0x23a71d[_0xe583('0x138')]=moment()[_0xe583('0x57')](_0xe583('0x12f'));var _0x534807=_0x1aa420['campaignsPreview'][_0x48eee8['queue']];if(ut[_0xe583('0x139')](_0x365384[_0xe583('0x13a')])){if(_0x48eee8[_0xe583('0xc4')]){rpcDb[_0xe583('0x10d')](_0x48eee8['idContact']);}if(_0x48eee8[_0xe583('0xc5')]){rpcDb[_0xe583('0x8a')](_0x48eee8['idContact']);}ami['emit'](_0xe583('0x13b'),ut['buildObj'](_0x48eee8,_0xe583('0x13c'),this[_0xe583('0x65')][_0x48eee8['queue']]));this[_0xe583('0xeb')](_0x23a71d,_0x534807,_0x365384);}else{_0x48eee8[_0xe583('0x12e')]=moment()[_0xe583('0x57')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xe583('0xef')](_0x23a71d,0x4,_0xe583('0xb7'));rpcDb['createAgentHistory'](_0x23a71d,_0xe583('0x13d'));}}};Preview[_0xe583('0xf')][_0xe583('0x19')]=function(_0xc3fdea){var _0x1543a7=this;var _0x28619e=this['actions'][_0xc3fdea['linkedid']];var _0x484d61;if(_0x28619e){_0x484d61=this[_0xe583('0x65')][_0x28619e['queue']];logger['info'](_0xe583('0x13e'),_0xc3fdea[_0xe583('0xaa')],_0xe583('0xae'),_0x484d61['name'],_0xe583('0x72'),_0x484d61['pTalking']);}if(this[_0xe583('0x15')][_0xc3fdea[_0xe583('0xaa')]]&&_0xc3fdea[_0xe583('0xaa')]!==_0xc3fdea[_0xe583('0xad')]){if(_0xc3fdea['cause']==='16'&&this[_0xe583('0x15')][_0xc3fdea[_0xe583('0xaa')]][_0xe583('0x7c')]){this[_0xe583('0x9a')](_0xc3fdea,_0xc3fdea[_0xe583('0xaa')],_0xc3fdea[_0xe583('0x13f')]);}else if(this[_0xe583('0x15')][_0xc3fdea[_0xe583('0xaa')]]['dialAnswer']){logger['info'](_0xe583('0x140'),_0xc3fdea[_0xe583('0xaa')],_0xc3fdea[_0xe583('0x13f')],_0xe583('0xae'),_0x484d61[_0xe583('0x28')],'pTalking:\x20',_0x484d61[_0xe583('0x2a')]);this[_0xe583('0x9a')](_0xc3fdea,_0xc3fdea['linkedid'],_0xc3fdea[_0xe583('0x13f')]);}}else if(_0x28619e&&_[_0xe583('0x6e')](_0x28619e[_0xe583('0x141')])&&_0x484d61[_0xe583('0x142')]&&_0xc3fdea[_0xe583('0xaa')]===_0xc3fdea[_0xe583('0xad')]&&_[_0xe583('0x6e')](_0xc3fdea[_0xe583('0xee')])&&_0xc3fdea[_0xe583('0x13f')]==='16'&&_0xc3fdea[_0xe583('0x143')]==='6'&&_[_0xe583('0xec')](_0x28619e['transfer'])){if(_0x28619e['unlockAgent']){rpcDb[_0xe583('0x10d')](_0x28619e['idContact']);}if(_0x28619e[_0xe583('0xc5')]){rpcDb['disableContact'](_0x28619e['idContact']);}_0xc3fdea[_0xe583('0xee')]='22';this['callProgressDetectingAgent'](_0x28619e,_0x484d61,_0xc3fdea);}else if(_0x28619e&&_0x28619e['transfer']){if(_0xc3fdea[_0xe583('0x13f')]==='16'&&this[_0xe583('0x15')][_0xc3fdea[_0xe583('0xaa')]][_0xe583('0x7c')]){logger[_0xe583('0x59')](_0xe583('0x144'),_0xc3fdea['linkedid'],_0xc3fdea['cause'],_0xe583('0xae'),_0x484d61[_0xe583('0x28')],_0xe583('0x72'),_0x484d61['pTalking']);this[_0xe583('0x9a')](_0xc3fdea,_0xc3fdea[_0xe583('0xaa')],_0xc3fdea[_0xe583('0x13f')]);}else if(this[_0xe583('0x15')][_0xc3fdea['linkedid']][_0xe583('0x7c')]){logger[_0xe583('0x59')]('[syncHangup][talking][cause]',_0xc3fdea[_0xe583('0xaa')],_0xc3fdea[_0xe583('0x13f')],_0xe583('0xae'),_0x484d61[_0xe583('0x28')],_0xe583('0x72'),_0x484d61[_0xe583('0x2a')]);this[_0xe583('0x9a')](_0xc3fdea,_0xc3fdea[_0xe583('0xaa')],_0xc3fdea[_0xe583('0x13f')]);}}};Preview['prototype'][_0xe583('0x1d')]=function(_0x2c3351){if(this[_0xe583('0x15')][_0x2c3351[_0xe583('0x145')]]&&_0x2c3351[_0xe583('0x145')]!==_0x2c3351[_0xe583('0x146')]){this['callProgressDetectingCustomer'](_0x2c3351,_0x2c3351[_0xe583('0x145')],_0x2c3351[_0xe583('0x147')]);}};Preview[_0xe583('0xf')][_0xe583('0x1b')]=function(_0xdde302){if(this['actions'][_0xdde302[_0xe583('0xaa')]]&&_0xdde302['linkedid']!==_0xdde302[_0xe583('0xad')]&&!this[_0xe583('0x15')][_0xdde302[_0xe583('0xaa')]][_0xe583('0x7c')]){if(_0xdde302[_0xe583('0x13f')]==='1'){this['callProgressDetectingCustomer'](_0xdde302,_0xdde302[_0xe583('0xaa')],_0xdde302[_0xe583('0x13f')]);}}};Preview['prototype']['addVariable']=function(_0x2dd0c9,_0x4afcc5,_0x150f9b){if(this['actions'][_0x2dd0c9]){if(_[_0xe583('0x6e')](this[_0xe583('0x15')][_0x2dd0c9][_0xe583('0x148')])){this[_0xe583('0x15')][_0x2dd0c9][_0xe583('0x148')]={};}this[_0xe583('0x15')][_0x2dd0c9]['variables'][_0x4afcc5]=_0x150f9b;}};Preview[_0xe583('0xf')][_0xe583('0x20')]=function(_0x31fcec){try{if(!_[_0xe583('0x6e')](_0x31fcec)){if(ut[_0xe583('0x149')](_[_0xe583('0x14a')](_0x31fcec[_0xe583('0x14b')])[0x0])){this[_0xe583('0x14c')](_0x31fcec[_0xe583('0xad')],_['keys'](_0x31fcec[_0xe583('0x14b')])[0x0],_0x31fcec[_0xe583('0x14d')]);}}}catch(_0x388761){logger[_0xe583('0x14e')](_0xe583('0x14f'),util[_0xe583('0x150')](_0x388761,{'showHidden':![],'depth':null}));}};Preview[_0xe583('0xf')][_0xe583('0x22')]=function(_0x4e0084){if(_0x4e0084){if(this[_0xe583('0x15')][_0x4e0084[_0xe583('0x151')]]){this[_0xe583('0x15')][_0x4e0084[_0xe583('0x151')]][_0xe583('0x152')]=!![];}}};Preview[_0xe583('0xf')][_0xe583('0x153')]=function(_0x2900fa){if(_0x2900fa){if(this['actions'][_0x2900fa[_0xe583('0x154')]]){this[_0xe583('0x15')][_0x2900fa[_0xe583('0x154')]]['transfer']=!![];}}};module[_0xe583('0x155')]=Preview; \ No newline at end of file +var _0x16c7=['[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','Global','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','logger','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','unlock','pick','execRun','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','substring','SIP/%s/%s%s','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','[originated][increment]','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','reason','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildAcw','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x16c7,0x85));var _0x716c=function(_0x46c882,_0x16b9e3){_0x46c882=_0x46c882-0x0;var _0x2b2655=_0x16c7[_0x46c882];return _0x2b2655;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x716c('0x0'));var uuid=require(_0x716c('0x1'));var moment=require(_0x716c('0x2'));var md5=require(_0x716c('0x3'));var Redis=require(_0x716c('0x4'));var config=require(_0x716c('0x5'));var logger=require('../../../config/logger')(_0x716c('0x6'));var loggerAction=require(_0x716c('0x7'))('actionPreview');var ami=require(_0x716c('0x8'));var rpcDb=require(_0x716c('0x9'));var Action=require(_0x716c('0xa'));var ut=require(_0x716c('0xb'));config[_0x716c('0xc')]=_['defaults'](config[_0x716c('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x716c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x716c('0xe')][_0x716c('0xf')]=function(_0x3aa9be){this[_0x716c('0x10')]=this[_0x716c('0x10')]?this['tail'][_0x716c('0x11')](_0x3aa9be):_0x3aa9be();};function Preview(_0x1bfec4){this[_0x716c('0x12')]=new Sequence();this[_0x716c('0x13')]=_0x1bfec4['voiceQueues'];this[_0x716c('0x14')]=_0x1bfec4['trunks'];this[_0x716c('0x15')]={};this[_0x716c('0x16')]=_0x1bfec4['agents'];this[_0x716c('0x17')]=0x0;ami['on']('originateresponse',this[_0x716c('0x18')]['bind'](this));ami['on'](_0x716c('0x19'),this[_0x716c('0x1a')]['bind'](this));ami['on'](_0x716c('0x1b'),this[_0x716c('0x1c')][_0x716c('0x1d')](this));ami['on'](_0x716c('0x1e'),this[_0x716c('0x1f')]['bind'](this));ami['on'](_0x716c('0x20'),this[_0x716c('0x21')][_0x716c('0x1d')](this));ami['on'](_0x716c('0x22'),this[_0x716c('0x23')][_0x716c('0x1d')](this));ami['on'](_0x716c('0x24'),this[_0x716c('0x25')][_0x716c('0x1d')](this));ami['on'](_0x716c('0x26'),this[_0x716c('0x27')][_0x716c('0x1d')](this));this[_0x716c('0x28')](this['campaignsPreview']);}function emit(_0x49820b,_0x503674,_0x50dd6b){io['to'](_0x49820b)[_0x716c('0x29')](_0x503674,_0x50dd6b);}function emitCampaignPreview(_0x46ee87){if(_0x46ee87[_0x716c('0x2a')]===_0x716c('0x2b')){var _0x43958a={'id':_0x46ee87['id'],'name':_0x46ee87[_0x716c('0x2c')],'strategy':_0x46ee87[_0x716c('0x2d')],'answered':_0x46ee87[_0x716c('0x2e')],'available':_0x46ee87['available'],'loggedIn':_0x46ee87[_0x716c('0x2f')],'pTalking':_0x46ee87[_0x716c('0x30')],'sumBillable':_0x46ee87[_0x716c('0x31')],'sumDuration':_0x46ee87[_0x716c('0x32')],'sumHoldTime':_0x46ee87[_0x716c('0x33')]||0x0,'talking':_0x46ee87[_0x716c('0x34')],'total':_0x46ee87[_0x716c('0x35')],'type':_0x46ee87['type'],'unmanaged':_0x46ee87[_0x716c('0x36')],'abandoned':_0x46ee87[_0x716c('0x37')],'waiting':_0x46ee87['waiting'],'loggedInDb':_0x46ee87[_0x716c('0x38')],'dialActive':_0x46ee87[_0x716c('0x39')],'dialMethod':_0x46ee87[_0x716c('0x3a')],'dialOriginateCallerIdName':_0x46ee87['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46ee87[_0x716c('0x3b')],'dialOriginateTimeout':_0x46ee87['dialOriginateTimeout'],'dialPrefix':_0x46ee87['dialPrefix'],'outboundAnswerAgiCallsDay':_0x46ee87['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x46ee87[_0x716c('0x3c')],'outboundBlacklistCallsDay':_0x46ee87[_0x716c('0x3d')],'outboundBusyCallsDay':_0x46ee87[_0x716c('0x3e')],'outboundCongestionCallsDay':_0x46ee87[_0x716c('0x3f')],'outboundDropCallsDayACS':_0x46ee87['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x46ee87[_0x716c('0x40')],'outboundDropCallsDayTimeout':_0x46ee87[_0x716c('0x41')],'outboundNoAnswerCallsDay':_0x46ee87['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x46ee87[_0x716c('0x42')],'outboundOriginateFailureCallsDay':_0x46ee87[_0x716c('0x43')],'outboundReCallsDay':_0x46ee87[_0x716c('0x44')],'outboundRejectCallsDay':_0x46ee87[_0x716c('0x45')],'outboundUnknownCallsDay':_0x46ee87[_0x716c('0x46')],'outboundAbandonedCallsDay':_0x46ee87['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x46ee87[_0x716c('0x47')],'predictiveIntervalAvgHoldtime':_0x46ee87[_0x716c('0x48')],'predictiveIntervalAvgTalktime':_0x46ee87[_0x716c('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x46ee87[_0x716c('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x46ee87[_0x716c('0x4b')],'predictiveIntervalErlangCalls':_0x46ee87[_0x716c('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x46ee87['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x46ee87[_0x716c('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x46ee87['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46ee87['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x46ee87[_0x716c('0x4e')],'predictiveIntervalTotalCalls':_0x46ee87[_0x716c('0x4f')],'message':_0x46ee87['message'],'originated':_0x46ee87[_0x716c('0x50')],'erlangCalls':_0x46ee87[_0x716c('0x51')],'erlangCallToSecond':_0x46ee87[_0x716c('0x52')],'erlangAbandonmentRate':_0x46ee87[_0x716c('0x53')],'erlangBusyFactor':_0x46ee87[_0x716c('0x54')],'startPredictive':_0x46ee87[_0x716c('0x55')],'startProgressive':_0x46ee87[_0x716c('0x56')]};if(_0x46ee87[_0x716c('0x57')]){_0x43958a[_0x716c('0x57')]={'id':_0x46ee87[_0x716c('0x57')]['id'],'name':_0x46ee87['Trunk'][_0x716c('0x2c')],'active':_0x46ee87[_0x716c('0x57')][_0x716c('0x58')],'callerid':_0x46ee87[_0x716c('0x57')][_0x716c('0x59')]};}if(_0x46ee87[_0x716c('0x5a')]){_0x43958a[_0x716c('0x5a')]={'id':_0x46ee87[_0x716c('0x5a')]['id'],'name':_0x46ee87['Interval'][_0x716c('0x2c')]};}var _0x2308d3=md5(JSON[_0x716c('0x5b')](_0x43958a));if(_0x46ee87['md5']!==_0x2308d3){_0x46ee87[_0x716c('0x3')]=_0x2308d3;emit(util[_0x716c('0x5c')](_0x716c('0x5d'),_0x43958a['name']),_0x716c('0x5e'),_0x43958a);}}}function emitVoiceQueueChannelRemove(_0x3cfb74){logger[_0x716c('0x5f')](_0x716c('0x60'),JSON[_0x716c('0x5b')](_0x3cfb74));emit(util[_0x716c('0x5c')](_0x716c('0x5d'),_0x3cfb74['name']),'voice_queue_channel:remove',_0x3cfb74);io[_0x716c('0x29')](_0x716c('0x61'),_0x3cfb74);}function notSendMessagesQueue(_0x51d02f){if(_0x51d02f[_0x716c('0x62')]){if(_0x51d02f[_0x716c('0x50')]===0x0&&_0x51d02f[_0x716c('0x30')]===0x0){_0x51d02f[_0x716c('0x62')]=![];_0x51d02f[_0x716c('0x63')]=0x0;_0x51d02f[_0x716c('0x64')]=0x0;_0x51d02f[_0x716c('0x65')]=_0x716c('0x66');ut['logger'](_0x716c('0x67'),_0x51d02f[_0x716c('0x2c')]+_0x716c('0x68'));}else{_0x51d02f['message']=_0x716c('0x69');ut['logger'](_0x716c('0x67'),_0x51d02f['name']+_0x716c('0x6a'));}emitCampaignPreview(_0x51d02f);}}Preview['prototype']['loopCampaigns']=function(){var _0x32b655=this;setInterval(function(){_0x32b655['syncCampaigns']();},0x7cf);};Preview[_0x716c('0xe')][_0x716c('0x6b')]=function(){var _0x40adf0=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x5d04c6 in _0x40adf0){if(_0x40adf0[_0x716c('0x6c')](_0x5d04c6)&&(_0x40adf0[_0x5d04c6][_0x716c('0x3a')]===_0x716c('0x6')||_0x40adf0[_0x5d04c6][_0x716c('0x3a')]===_0x716c('0x6d'))&&_0x40adf0[_0x5d04c6][_0x716c('0x2a')]==='outbound'){if(this[_0x716c('0x17')]>0x7){this[_0x716c('0x17')]=0x0;this[_0x716c('0x6e')]();}}if(_0x40adf0[_0x716c('0x6c')](_0x5d04c6)&&_0x40adf0[_0x5d04c6][_0x716c('0x3a')]==='preview'&&_0x40adf0[_0x5d04c6][_0x716c('0x2a')]===_0x716c('0x2b')){if(_0x40adf0[_0x5d04c6][_0x716c('0x39')]){this[_0x716c('0x6f')](_0x40adf0[_0x5d04c6]);this[_0x716c('0x70')](_0x40adf0[_0x5d04c6]);}else{notSendMessagesQueue(_0x40adf0[_0x5d04c6]);}}}};Preview['prototype'][_0x716c('0x71')]=function(_0x49536b){var _0x2b1777=this;this[_0x716c('0x12')]['enqueue'](function(){if(!_[_0x716c('0x72')](_0x2b1777['actions'][_0x49536b])){loggerAction[_0x716c('0x5f')]('[clearZombieChannels][talking]',_0x49536b,_0x716c('0x73'),_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x74')],_0x716c('0x75'),JSON[_0x716c('0x5b')](_0x2b1777[_0x716c('0x13')][_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x74')]][_0x716c('0x50')]),_0x716c('0x76'),JSON[_0x716c('0x5b')](_0x2b1777[_0x716c('0x13')][_0x2b1777['actions'][_0x49536b]['queue']][_0x716c('0x30')]),JSON['stringify'](_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x77')]),JSON[_0x716c('0x5b')](_['pick'](_0x2b1777[_0x716c('0x15')][_0x49536b],[_0x716c('0x78'),_0x716c('0x79'),_0x716c('0x7a'),_0x716c('0x7b')])));return ami['Action']({'action':_0x716c('0x7c'),'channel':_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x7d')]})[_0x716c('0x7e')](function(_0x8ce1e){if(_0x8ce1e[_0x716c('0x65')]===_0x716c('0x7f')){setTimeout(function(){if(_0x2b1777['actions'][_0x49536b]){ut[_0x716c('0x80')](_0x2b1777[_0x716c('0x13')][_0x2b1777['actions'][_0x49536b][_0x716c('0x74')]],_0x716c('0x81'));if(_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x77')]===!![]){ut['decrementTalkink'](_0x2b1777[_0x716c('0x13')][_0x2b1777[_0x716c('0x15')][_0x49536b][_0x716c('0x74')]],'[clearZombieChannel]');ut[_0x716c('0x82')](_0x716c('0x83')+_0x49536b,_0x2b1777[_0x716c('0x15')][_0x49536b]['queue']);}ut[_0x716c('0x82')]('[Dialer][checkChannel][Preview]'+_0x49536b,_0x2b1777[_0x716c('0x15')][_0x49536b]['queue']);delete _0x2b1777[_0x716c('0x15')][_0x49536b];}},0x2328);}});}});};Preview[_0x716c('0xe')][_0x716c('0x6e')]=function(){var _0x16be29=this;loggerAction[_0x716c('0x5f')]('[action]',_[_0x716c('0x84')](this['actions']));for(var _0x414ca3 in this[_0x716c('0x15')]){if(_0x16be29[_0x716c('0x15')][_0x716c('0x6c')](_0x414ca3)){_0x16be29[_0x716c('0x71')](_0x414ca3);}}};Preview[_0x716c('0xe')]['recallMe']=function(_0x61cabe){var _0x1bc0a0=this;rpcDb[_0x716c('0x85')](_0x61cabe['id'],ut[_0x716c('0x86')](this[_0x716c('0x16')]))['then'](function(_0x114d97){if(!_[_0x716c('0x72')](_0x114d97)){for(var _0x324335=0x0;_0x324335<_0x114d97['length'];_0x324335+=0x1){if(ut[_0x716c('0x87')](_0x114d97[_0x324335][_0x716c('0x88')])<_0x61cabe[_0x716c('0x89')]*0x3c){if(_0x114d97[_0x324335][_0x716c('0x8a')]&&!_0x114d97[_0x324335][_0x716c('0x8a')][_0x716c('0x8b')]){_0x1bc0a0['run'](_0x114d97[_0x324335]['id'])[_0x716c('0x8c')](ut[_0x716c('0x8d')](_0x716c('0x8e')))[_0x716c('0x7e')](ut[_0x716c('0x8d')](_0x716c('0x8e')));}else{rpcDb[_0x716c('0x8f')](_0x114d97[_0x324335]['id']);}}else{var _0x5e0aa6=new Action(_0x114d97[_0x324335],_0x61cabe);_0x5e0aa6[_0x716c('0x90')]=moment()['format'](_0x716c('0x91'));_0x61cabe[_0x716c('0x44')]+=0x1;ut[_0x716c('0x92')](_0x5e0aa6,0x17,'RecallInQueue');if(_0x61cabe[_0x716c('0x93')]){rpcDb[_0x716c('0x94')](ut[_0x716c('0x95')](_0x114d97[_0x324335]));rpcDb[_0x716c('0x96')](_0x5e0aa6,_0x716c('0x97'));}else{ut[_0x716c('0x92')](_0x5e0aa6,0x16,_0x716c('0x98'));rpcDb['createCustomerHistory'](_0x5e0aa6,'[HistoryRecallClose]');rpcDb[_0x716c('0x99')](_0x5e0aa6,_0x716c('0x9a'));}}}}})[_0x716c('0x7e')](ut[_0x716c('0x8d')](_0x716c('0x9b')));};Preview[_0x716c('0xe')][_0x716c('0x6f')]=function(_0x1ced9b){_0x1ced9b[_0x716c('0x62')]=!![];if(ut[_0x716c('0x9c')](_0x1ced9b['loggedIn'])){_0x1ced9b[_0x716c('0x65')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x716c('0x9d')](_0x1ced9b[_0x716c('0x39')])){_0x1ced9b['message']=_0x716c('0x66');}else if(!this[_0x716c('0x9e')](_0x1ced9b[_0x716c('0x57')])){if(!this[_0x716c('0x9e')](_0x1ced9b[_0x716c('0x9f')])){_0x1ced9b[_0x716c('0x65')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1ced9b[_0x716c('0x65')]=_0x716c('0xa0');}}else{_0x1ced9b[_0x716c('0x65')]='ACTIVE';}emitCampaignPreview(_0x1ced9b);};Preview[_0x716c('0xe')][_0x716c('0xa1')]=function(_0x869810,_0x4eab9c,_0x5bc857){var _0x24771a=this;var _0x22965a=this['actions'][_0x4eab9c];var _0x28acb3=this['campaignsPreview'][_0x22965a[_0x716c('0x74')]];var _0x51efc2;if(_0x28acb3){switch(_0x5bc857){case'1':_0x28acb3[_0x716c('0x42')]+=0x1;_0x22965a['countnosuchnumberretry']+=0x1;_0x22965a['countglobal']=ut[_0x716c('0xa2')](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x0,_0x716c('0xa3'));ami['emit'](_0x716c('0xa4'),ut[_0x716c('0xa5')](_0x22965a,'nosuchnumber'));rpcDb[_0x716c('0x96')](_0x22965a,_0x716c('0xa6'));if(ut[_0x716c('0xa2')](_0x22965a)>=_0x28acb3[_0x716c('0xa7')]){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0xf,'Global');rpcDb[_0x716c('0x99')](_0x51efc2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x22965a['countnosuchnumberretry']>=_0x28acb3[_0x716c('0xa9')]){rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xaa'));}else{rpcDb['rescheduleContact'](ut[_0x716c('0xab')](_0x22965a,_0x716c('0xac'),_0x28acb3[_0x716c('0xad')]),_0x22965a[_0x716c('0xae')],_0x22965a[_0x716c('0xaf')]);}}delete this[_0x716c('0x15')][_0x869810[_0x716c('0xb0')]];break;case _0x716c('0xb1'):var _0x41de11=moment()['format'](_0x716c('0x91'));_0x22965a[_0x716c('0xb2')]=_0x41de11;_0x22965a['answertime']=_0x41de11;_0x22965a['dialAnswer']=!![];_0x28acb3[_0x716c('0x30')]+=0x1;logger[_0x716c('0x5f')](_0x716c('0xb3'),_0x22965a['uniqueid'],_0x716c('0xb4'),_0x28acb3['name'],_0x716c('0x76'),_0x28acb3[_0x716c('0x30')]);ami['emit'](_0x716c('0xb5'),ut[_0x716c('0xa5')](_0x22965a,'connect',this[_0x716c('0x13')][_0x22965a[_0x716c('0x74')]]));if(_0x28acb3['acw']){ami[_0x716c('0x29')]('custom:agentConnectPreview',ut[_0x716c('0xb6')](_0x22965a));}break;case'16':ami[_0x716c('0x29')]('custom:agentcomplete',ut['buildObj'](_0x22965a,_0x716c('0xb7'),this['campaignsPreview'][_0x22965a['queue']]));emitVoiceQueueChannelRemove(ut[_0x716c('0xa5')](_0x22965a,'complete'));_0x28acb3[_0x716c('0x3c')]+=0x1;_0x28acb3[_0x716c('0x35')]+=0x1;_0x28acb3[_0x716c('0x2e')]+=0x1;ut['decrementTalkink'](_0x28acb3,_0x716c('0xb8'));_0x22965a[_0x716c('0xb9')]=ut[_0x716c('0xa2')](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x4,_0x716c('0xba'));rpcDb[_0x716c('0x96')](_0x22965a,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xbb'));rpcDb[_0x716c('0xbc')](_0x22965a);_0x28acb3[_0x716c('0x32')]+=_0x22965a[_0x716c('0xbd')];_0x28acb3[_0x716c('0x31')]+=_0x22965a[_0x716c('0xbd')];logger[_0x716c('0x5f')]('[syncHangup][talking][decrement]',_0x22965a[_0x716c('0xbe')],_0x716c('0xb4'),_0x28acb3[_0x716c('0x2c')],_0x716c('0x76'),_0x28acb3['pTalking']);delete this[_0x716c('0x15')][_0x869810[_0x716c('0xb0')]];break;case _0x716c('0xbf'):_0x28acb3[_0x716c('0x3e')]+=0x1;_0x22965a[_0x716c('0xc0')]+=0x1;_0x22965a[_0x716c('0xb9')]=ut['totalGlobal'](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x5,_0x716c('0xc1'));ami['emit'](_0x716c('0xc2'),ut[_0x716c('0xa5')](_0x22965a,_0x716c('0xc3')));rpcDb[_0x716c('0x96')](_0x22965a,_0x716c('0xc4'));if(ut[_0x716c('0xa2')](_0x22965a)>=_0x28acb3['dialGlobalMaxRetry']){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0xf,'Global');rpcDb[_0x716c('0x99')](_0x51efc2,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x22965a[_0x716c('0xc0')]>=_0x28acb3[_0x716c('0xc5')]){rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x716c('0xab')](_0x22965a,'countbusyretry',_0x28acb3['dialBusyRetryFrequency']),_0x22965a[_0x716c('0xae')],_0x22965a[_0x716c('0xaf')]);}}break;case _0x716c('0xc6'):_0x28acb3[_0x716c('0xc7')]+=0x1;_0x22965a[_0x716c('0xc8')]+=0x1;_0x22965a['countglobal']=ut[_0x716c('0xa2')](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x3,_0x716c('0xc9'));ami[_0x716c('0x29')](_0x716c('0xca'),ut[_0x716c('0xa5')](_0x22965a,_0x716c('0xcb')));rpcDb['createCustomerHistory'](_0x22965a,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x22965a)>=_0x28acb3[_0x716c('0xa7')]){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0xf,'Global');rpcDb[_0x716c('0x99')](_0x51efc2,_0x716c('0xcc'));}else{if(_0x22965a[_0x716c('0xc8')]>=_0x28acb3[_0x716c('0xcd')]){rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xce'));}else{rpcDb[_0x716c('0xcf')](ut[_0x716c('0xab')](_0x22965a,_0x716c('0xc8'),_0x28acb3[_0x716c('0xd0')]),_0x22965a[_0x716c('0xae')],_0x22965a[_0x716c('0xaf')]);}}break;case _0x716c('0xd1'):_0x28acb3['outboundCongestionCallsDay']+=0x1;_0x22965a[_0x716c('0xd2')]+=0x1;_0x22965a['countglobal']=ut[_0x716c('0xa2')](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x8,_0x716c('0xd3'));ami[_0x716c('0x29')](_0x716c('0xd4'),ut[_0x716c('0xa5')](_0x22965a,_0x716c('0xd5')));rpcDb[_0x716c('0x96')](_0x22965a,_0x716c('0xd6'));if(ut[_0x716c('0xa2')](_0x22965a)>=_0x28acb3['dialGlobalMaxRetry']){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0xf,'Global');rpcDb[_0x716c('0x99')](_0x51efc2,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x22965a[_0x716c('0xd2')]>=_0x28acb3[_0x716c('0xd7')]){rpcDb[_0x716c('0x99')](_0x22965a,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x716c('0xab')](_0x22965a,_0x716c('0xd2'),_0x28acb3['dialBusyRetryFrequency']),_0x22965a[_0x716c('0xae')],_0x22965a[_0x716c('0xaf')]);}}break;case _0x716c('0xd8'):_0x28acb3[_0x716c('0x45')]+=0x1;_0x22965a[_0x716c('0xd9')]+=0x1;_0x22965a[_0x716c('0xb9')]=ut['totalGlobal'](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0x14,'AgentReject');ami[_0x716c('0x29')](_0x716c('0xda'),ut['buildObj'](_0x22965a,'agentreject'));rpcDb[_0x716c('0x96')](_0x22965a,_0x716c('0xdb'));if(ut[_0x716c('0xa2')](_0x22965a)>=_0x28acb3[_0x716c('0xa7')]){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0x14,_0x716c('0xdc'));rpcDb['createCustomerFinal'](_0x51efc2,_0x716c('0xdd'));}else{if(_0x22965a['countagentrejectretry']>=_0x28acb3[_0x716c('0xde')]){rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xdd'));}else{rpcDb[_0x716c('0xcf')](ut[_0x716c('0xab')](_0x22965a,_0x716c('0xd9'),_0x28acb3[_0x716c('0xdf')]),_0x22965a[_0x716c('0xae')],_0x22965a['activeContact']);}}break;case _0x716c('0xe0'):_0x28acb3['outboundAbandonedCallsDay']+=0x1;_0x22965a[_0x716c('0xe1')]+=0x1;_0x22965a[_0x716c('0xb9')]=ut[_0x716c('0xa2')](_0x22965a);ut[_0x716c('0x92')](_0x22965a,0xb,_0x716c('0xe2'));rpcDb[_0x716c('0x96')](_0x22965a,_0x716c('0xe3'));if(ut['totalGlobal'](_0x22965a)>=_0x28acb3[_0x716c('0xa7')]){_0x51efc2=ut['cloneAction'](_0x22965a,0xf,_0x716c('0xe4'));rpcDb[_0x716c('0x99')](_0x51efc2,_0x716c('0xe3'));}else{if(_0x22965a[_0x716c('0xe5')]>=_0x28acb3[_0x716c('0xe6')]){rpcDb[_0x716c('0x99')](_0x22965a,_0x716c('0xe3'));}else{rpcDb[_0x716c('0xcf')](ut[_0x716c('0xab')](_0x22965a,_0x716c('0xe1'),_0x28acb3[_0x716c('0xe7')]),_0x22965a[_0x716c('0xae')],_0x22965a[_0x716c('0xaf')]);}}break;default:if(_0x22965a[_0x716c('0x77')]){ut[_0x716c('0xe8')](_0x28acb3,_0x716c('0xe9'));ut[_0x716c('0x82')](_0x716c('0xea')+_0x28acb3[_0x716c('0x2c')],_0x869810);}_0x28acb3[_0x716c('0x46')]+=0x1;_0x22965a[_0x716c('0xb9')]=ut[_0x716c('0xa2')](_0x22965a);ut['logCustomer'](_0x22965a,0xc,_0x869810[_0x716c('0xeb')]||_0x869810[_0x716c('0xec')]);rpcDb['createCustomerHistory'](_0x22965a,_0x716c('0xed'));if(ut[_0x716c('0xa2')](_0x22965a)>=_0x28acb3[_0x716c('0xa7')]){_0x51efc2=ut[_0x716c('0xa8')](_0x22965a,0xf,_0x716c('0xe4'));rpcDb[_0x716c('0x99')](_0x51efc2,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x22965a,_0x716c('0xee'));}delete this[_0x716c('0x15')][_0x869810[_0x716c('0xb0')]];}if(!(_0x22965a[_0x716c('0x77')]&&_0x5bc857==='16')){ut['updateOriginated'](_0x28acb3,_0x716c('0xef'));logger[_0x716c('0x5f')](_0x716c('0xf0'),_0x22965a[_0x716c('0xbe')],'\x20Queue',_0x28acb3[_0x716c('0x2c')],_0x716c('0x75'),_0x28acb3[_0x716c('0x50')]);}if(_0x5bc857!==_0x716c('0xb1')){delete this[_0x716c('0x15')][_0x869810[_0x716c('0xb0')]];delete this[_0x716c('0x15')][_0x869810[_0x716c('0xf1')]];}}};Preview[_0x716c('0xe')][_0x716c('0xf2')]=function(_0x2dd479,_0x2d6528,_0x41a7f5){if(_['isUndefined'](_0x2d6528)&&'object'!==typeof _0x2d6528){return;}if(_[_0x716c('0xf3')](_0x41a7f5)&&_0x716c('0xf4')!==typeof _0x41a7f5){return;}switch(_0x41a7f5['reason']){case'0':ut[_0x716c('0xf5')](_0x2dd479,0x0,_0x716c('0xa3'));rpcDb[_0x716c('0xf6')](_0x2dd479,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x716c('0xf5')](_0x2dd479,0x3,'NoAnswer');rpcDb[_0x716c('0xf6')](_0x2dd479,_0x716c('0xf7'));break;case'5':ut[_0x716c('0xf5')](_0x2dd479,0x5,_0x716c('0xc1'));rpcDb[_0x716c('0xf6')](_0x2dd479,_0x716c('0xf8'));break;case'8':ut[_0x716c('0xf5')](_0x2dd479,0x8,_0x716c('0xd3'));rpcDb[_0x716c('0xf6')](_0x2dd479,_0x716c('0xf9'));break;case'22':ut[_0x716c('0xf5')](_0x2dd479,0x16,_0x716c('0xfa'));rpcDb[_0x716c('0xf6')](_0x2dd479,_0x716c('0xfb'));break;default:ut['logAgent'](_0x2dd479,0xc,_0x41a7f5['reason']);rpcDb['createAgentHistory'](_0x2dd479,_0x716c('0xf9'));}ut[_0x716c('0x80')](_0x2d6528,'[callProgressDetectingAgent]');logger[_0x716c('0x5f')](_0x716c('0xfc'),_0x2dd479[_0x716c('0xbe')],_0x716c('0xb4'),_0x2d6528[_0x716c('0x2c')],_0x716c('0x75'),_0x2d6528['originated']);delete this['actions'][_0x2dd479[_0x716c('0xbe')]];};Preview[_0x716c('0xe')][_0x716c('0xfd')]=function(_0x1f8eb9,_0x1f08a8,_0x20dde4,_0xb9746b,_0x439ef4){var _0x4b30dd=this;return new BPromise(function(_0x47754e,_0x50df4a){if(_[_0x716c('0x72')](_0x1f08a8)||_[_0x716c('0x72')](_0x1f08a8[_0x716c('0xfe')])||_[_0x716c('0x72')](_0x1f08a8['Contact'][_0x716c('0xff')])||_[_0x716c('0x72')](_0x1f08a8[_0x716c('0x7a')])){_0x50df4a(ut['message']('Contact\x20is\x20undefined',_0xb9746b,_0x439ef4));return;}var _0x54d614=uuid['v4']();var _0x29cddd=_0x4b30dd[_0x716c('0x13')][_0x1f08a8[_0x716c('0x73')]['name']];var _0x48e719=_0x20dde4?_0x4b30dd['agents'][_0x20dde4]['id']:undefined;_0x4b30dd[_0x716c('0x15')][_0x54d614]=new Action(_0x1f08a8,_0x29cddd,_0x54d614,_0x20dde4,_0x48e719);var _0xb0f92d=_0x4b30dd[_0x716c('0x15')][_0x54d614];_0xb0f92d[_0x716c('0xae')]=_0xb9746b;_0xb0f92d[_0x716c('0xaf')]=_0x439ef4;_0xb0f92d[_0x716c('0x100')]=_0x20dde4;if(_[_0x716c('0x101')](_0x1f8eb9)){_0x4b30dd['execCall'](_0xb0f92d,_0x29cddd,_0x1f08a8,_0x20dde4)[_0x716c('0x8c')](function(_0x179702){logger[_0x716c('0x5f')](_0x716c('0x102'),_0x716c('0x103')+_0xb0f92d[_0x716c('0x74')]+_0x716c('0x104')+_0xb0f92d[_0x716c('0x105')],JSON[_0x716c('0x5b')](_0x179702));ami[_0x716c('0x29')]('custom:agentcalled',ut[_0x716c('0xa5')](_0xb0f92d,_0x716c('0x106'),_0x4b30dd[_0x716c('0x13')][_0xb0f92d['queue']]));_0x47754e(ut[_0x716c('0x65')](_0x716c('0x107')));})[_0x716c('0x7e')](function(_0x5b9a72){ut[_0x716c('0x108')]('[Preview][execCall][failure]',_0x5b9a72);_0x50df4a(ut[_0x716c('0x65')]('Call\x20failed',_0xb9746b,_0x439ef4));});}else{_0x29cddd['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0xb0f92d);rpcDb[_0x716c('0x109')](_0xb0f92d,_0x716c('0x10a'));delete _0x4b30dd['actions'][_0x54d614];_0x50df4a(ut[_0x716c('0x65')](_0x716c('0x10b'),_0xb9746b,_0x439ef4));}});};Preview[_0x716c('0xe')][_0x716c('0x9e')]=function(_0x4e093b){return!_['isNil'](_0x4e093b)&&!_[_0x716c('0x72')](_0x4e093b['name'])&&!_[_0x716c('0x72')](_0x4e093b[_0x716c('0x58')])&&_0x4e093b[_0x716c('0x58')]&&!_[_0x716c('0x72')](this[_0x716c('0x14')][util['format'](_0x716c('0x10c'),_0x4e093b['name'])])&&!_[_0x716c('0x72')](this['trunks'][util[_0x716c('0x5c')]('SIP/%s',_0x4e093b[_0x716c('0x2c')])][_0x716c('0x7c')])&&(this[_0x716c('0x14')][util[_0x716c('0x5c')]('SIP/%s',_0x4e093b[_0x716c('0x2c')])]['status']===_0x716c('0x10d')||this[_0x716c('0x14')][util['format']('SIP/%s',_0x4e093b[_0x716c('0x2c')])][_0x716c('0x7c')]===_0x716c('0x10e'));};Preview[_0x716c('0xe')][_0x716c('0x10f')]=function(_0x3b1950,_0x501790){var _0x3256c0=this;return new BPromise(function(_0x202366,_0x18d25f){_0x3256c0['execRun'](_0x3b1950,_0x501790)[_0x716c('0x8c')](function(_0x372a9b){_0x202366(_['pick'](_0x372a9b,[_0x716c('0x65')]));})['catch'](function(_0x57b7cb){if(_0x57b7cb[_0x716c('0x110')]){rpcDb['unlockContact'](_0x3b1950);}if(_0x57b7cb['active']){rpcDb[_0x716c('0x8f')](_0x3b1950);}_0x18d25f(_[_0x716c('0x111')](_0x57b7cb,['message']));});});};Preview[_0x716c('0xe')][_0x716c('0x112')]=function(_0x94ec42,_0x361255){var _0x37e934=this;return new BPromise(function(_0x1eda9c,_0x462ea2){var _0x5e9957,_0x4a859e;rpcDb['getContactPreview'](_0x94ec42)[_0x716c('0x8c')](function(_0x19fe7d){if(!_[_0x716c('0x72')](_0x19fe7d[0x0])){_0x4a859e=_0x19fe7d[0x0][_0x716c('0x113')]?![]:!![];_0x5e9957=_0x19fe7d[0x0][_0x716c('0x113')]?!![]:![];_0x5e9957=_0x361255?!![]:_0x5e9957;}var _0x217242=_0x37e934[_0x716c('0x114')](_0x19fe7d);if(_0x217242['isValid']){rpcDb[_0x716c('0x115')](_['pick'](_0x19fe7d[0x0],[_0x716c('0x7a'),_0x716c('0x116')]))['then'](function(_0x549b50){_0x37e934[_0x716c('0xfd')](_0x549b50,_0x19fe7d[0x0],_0x361255,_0x4a859e,_0x5e9957)[_0x716c('0x8c')](function(_0x2da0e0){_0x1eda9c(_0x2da0e0);})[_0x716c('0x7e')](function(_0x14913c){_0x462ea2(_0x14913c);});})[_0x716c('0x7e')](function(_0x115535){ut['logger'](_0x716c('0x117'),_0x115535);_0x462ea2(ut[_0x716c('0x65')](_0x716c('0x118'),_0x4a859e,_0x5e9957));});}else{_0x462ea2(ut[_0x716c('0x65')](_0x217242[_0x716c('0x65')],_0x4a859e,_0x5e9957));}})['catch'](function(_0x8f64b0){ut[_0x716c('0x108')](_0x716c('0x119'),_0x8f64b0);_0x462ea2(ut[_0x716c('0x65')](_0x716c('0x118'),![],!![]));});});};Preview[_0x716c('0xe')][_0x716c('0x114')]=function(_0x127683){if(_[_0x716c('0x72')](_0x127683)||_[_0x716c('0x101')](_0x127683)||!_[_0x716c('0x72')](_0x127683[0x0]['Agent'])&&_[_0x716c('0x72')](_0x127683[0x0][_0x716c('0x8a')][_0x716c('0x2c')])){ut['logger'](_0x716c('0x11a'),_0x127683);return{'isValid':![],'message':_0x716c('0x11b')};}var _0x47365d=this[_0x716c('0x13')][_0x127683[0x0][_0x716c('0x73')][_0x716c('0x2c')]];_0x47365d['message']=_0x716c('0xa0');if(_['isNil'](_0x47365d)){ut[_0x716c('0x108')]('[Preview][validateContact][Empty\x20Campaign]',_0x47365d);return{'isValid':![],'message':_0x716c('0x11c')};}if(!this[_0x716c('0x9e')](_0x47365d[_0x716c('0x57')])){ut['logger'](_0x716c('0x11d'),_0x716c('0x11e')+_0x47365d[_0x716c('0x2c')]+_0x716c('0x11f'));if(!this['isTrunkReachable'](_0x47365d[_0x716c('0x9f')])){ut[_0x716c('0x108')](_0x716c('0x11d'),_0x47365d['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x716c('0x120')};}}if(!ut['isActive'](_0x47365d[_0x716c('0x39')])){ut[_0x716c('0x108')](_0x716c('0x121'),_0x47365d['name']+_0x716c('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x47365d['name']+_0x716c('0x122')};}return{'isValid':!![],'message':_0x716c('0x123')};};Preview['prototype'][_0x716c('0x124')]=function(_0x3ca740,_0x2634c8,_0x508dc2,_0x100928){var _0x2c37b2=this;return new BPromise(function(_0x39f1a8,_0x290819){var _0x1f1c81=_0x3ca740[_0x716c('0xbe')];var _0x5c3127=_0x2c37b2[_0x716c('0x9e')](_0x2634c8['Trunk'])?util[_0x716c('0x5c')]('SIP/%s/%s%s',_0x2634c8[_0x716c('0x57')][_0x716c('0x2c')],_[_0x716c('0x72')](_0x2634c8[_0x716c('0x125')])?'':_0x2634c8[_0x716c('0x125')][_0x716c('0x126')]()||'',_0x2634c8['dialCutDigit']>0x0?_0x508dc2[_0x716c('0xfe')][_0x716c('0xff')][_0x716c('0x127')](_0x2634c8['dialCutDigit']):_0x508dc2['Contact']['phone']):util[_0x716c('0x5c')](_0x716c('0x128'),_[_0x716c('0x72')](_0x2634c8['TrunkBackup'])?_0x2634c8[_0x716c('0x57')][_0x716c('0x2c')]:_0x2634c8[_0x716c('0x9f')][_0x716c('0x2c')],_['isNil'](_0x2634c8[_0x716c('0x125')])?'':_0x2634c8[_0x716c('0x125')][_0x716c('0x126')]()||'',_0x2634c8[_0x716c('0x129')]>0x0?_0x508dc2[_0x716c('0xfe')][_0x716c('0xff')]['substring'](_0x2634c8[_0x716c('0x129')]):_0x508dc2['Contact']['phone']);var _0x306e81=_0x2c37b2[_0x716c('0x9e')](_0x2634c8[_0x716c('0x57')])?ut[_0x716c('0x12a')](_0x2634c8[_0x716c('0x57')]['callerid'],_0x2634c8[_0x716c('0x12b')],_0x2634c8[_0x716c('0x12c')]>0x0?ut[_0x716c('0x12d')](_0x2634c8[_0x716c('0x3b')],_0x2634c8[_0x716c('0x12c')]):_0x2634c8[_0x716c('0x3b')]):ut[_0x716c('0x12a')](_[_0x716c('0x72')](_0x2634c8[_0x716c('0x9f')])?_0x2634c8['Trunk'][_0x716c('0x59')]:_0x2634c8[_0x716c('0x9f')]['callerid'],_0x2634c8[_0x716c('0x12b')],_0x2634c8[_0x716c('0x12c')]>0x0?ut['getCallerIdRandom'](_0x2634c8[_0x716c('0x3b')],_0x2634c8[_0x716c('0x12c')]):_0x2634c8['dialOriginateCallerIdNumber']);if(_0x306e81){_0x3ca740[_0x716c('0x12e')]=ut[_0x716c('0x12f')](_0x306e81);_0x3ca740[_0x716c('0x130')]=ut[_0x716c('0x131')](_0x306e81);}var _0x2c6212=ut[_0x716c('0x132')](_0x2634c8,_0x508dc2,_0x5c3127,_0x306e81,_0x1f1c81,_0x3ca740);_[_0x716c('0x133')](_0x3ca740,ut['toLowerVariables'](_0x2c6212));_0x3ca740[_0x716c('0x90')]=moment()[_0x716c('0x5c')](_0x716c('0x91'));ami[_0x716c('0x134')](ut['variablesAction'](_0x3ca740,_0x2634c8,_0x2c6212,_0x3ca740[_0x716c('0xaf')],_0x100928))[_0x716c('0x8c')](function(_0x4b499c){_0x2634c8[_0x716c('0x50')]+=0x1;logger['info'](_0x716c('0x135'),_0x1f1c81,'\x20Queue',_0x2634c8[_0x716c('0x2c')],_0x716c('0x75'),_0x2634c8[_0x716c('0x50')]);_0x39f1a8(_0x4b499c);})[_0x716c('0x7e')](function(_0x24fe77){ut['logAgent'](_0x3ca740,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x3ca740,_0x716c('0x136'));_0x290819(_0x24fe77);});});};Preview['prototype']['syncNewExten']=function(_0x244457){if(this['actions'][_0x244457[_0x716c('0xb0')]]){this[_0x716c('0x15')][_0x244457[_0x716c('0xb0')]][_0x716c('0x7d')]=_0x244457[_0x716c('0x7d')];}};Preview['prototype'][_0x716c('0x18')]=function(_0x442b53){var _0x2e3307=this;var _0x2bc41e=this['actions'][_0x442b53['actionid']];if(_0x2bc41e){if(_0x2bc41e[_0x716c('0x100')]&&this[_0x716c('0x16')][_0x2bc41e[_0x716c('0x100')]]){ut[_0x716c('0x137')](_0x2bc41e,this['agents'][_0x2bc41e[_0x716c('0x100')]][_0x716c('0x2c')],this[_0x716c('0x16')][_0x2bc41e[_0x716c('0x100')]]['id']);}var _0x26a355=_[_0x716c('0x138')](_0x2bc41e);_0x26a355['responsetime']=moment()['format'](_0x716c('0x91'));var _0x3e1b24=_0x2e3307[_0x716c('0x13')][_0x2bc41e[_0x716c('0x74')]];if(ut[_0x716c('0x139')](_0x442b53[_0x716c('0x13a')])){if(_0x2bc41e[_0x716c('0xae')]){rpcDb[_0x716c('0x13b')](_0x2bc41e['idContact']);}if(_0x2bc41e[_0x716c('0xaf')]){rpcDb['disableContact'](_0x2bc41e['idContact']);}ami[_0x716c('0x29')]('custom:agentringnoanswer',ut[_0x716c('0xa5')](_0x2bc41e,_0x716c('0x13c'),this[_0x716c('0x13')][_0x2bc41e[_0x716c('0x74')]]));this[_0x716c('0xf2')](_0x26a355,_0x3e1b24,_0x442b53);}else{_0x2bc41e[_0x716c('0x90')]=moment()['format'](_0x716c('0x91'));ut[_0x716c('0xf5')](_0x26a355,0x4,_0x716c('0xba'));rpcDb[_0x716c('0xf6')](_0x26a355,_0x716c('0x13d'));}}};Preview[_0x716c('0xe')][_0x716c('0x1a')]=function(_0xee6964){var _0x54931e=this;var _0x5f7a7=this[_0x716c('0x15')][_0xee6964[_0x716c('0xb0')]];var _0x41e126;if(_0x5f7a7){_0x41e126=this[_0x716c('0x13')][_0x5f7a7[_0x716c('0x74')]];logger[_0x716c('0x5f')](_0x716c('0x13e'),_0xee6964[_0x716c('0xb0')],_0x716c('0xb4'),_0x41e126[_0x716c('0x2c')],_0x716c('0x76'),_0x41e126[_0x716c('0x30')]);}if(this[_0x716c('0x15')][_0xee6964['linkedid']]&&_0xee6964[_0x716c('0xb0')]!==_0xee6964['uniqueid']){if(_0xee6964[_0x716c('0x13f')]==='16'&&this['actions'][_0xee6964[_0x716c('0xb0')]][_0x716c('0x77')]){this[_0x716c('0xa1')](_0xee6964,_0xee6964['linkedid'],_0xee6964['cause']);}else if(this[_0x716c('0x15')][_0xee6964[_0x716c('0xb0')]][_0x716c('0x77')]){logger[_0x716c('0x5f')](_0x716c('0x140'),_0xee6964[_0x716c('0xb0')],_0xee6964[_0x716c('0x13f')],_0x716c('0xb4'),_0x41e126['name'],_0x716c('0x76'),_0x41e126[_0x716c('0x30')]);this['callProgressDetectingCustomer'](_0xee6964,_0xee6964[_0x716c('0xb0')],_0xee6964[_0x716c('0x13f')]);}}else if(_0x5f7a7&&_[_0x716c('0x72')](_0x5f7a7[_0x716c('0x141')])&&_0x41e126['dialQueueProject']&&_0xee6964[_0x716c('0xb0')]===_0xee6964[_0x716c('0xbe')]&&_[_0x716c('0x72')](_0xee6964[_0x716c('0x142')])&&_0xee6964[_0x716c('0x13f')]==='16'&&_0xee6964[_0x716c('0x143')]==='6'&&_[_0x716c('0xf3')](_0x5f7a7[_0x716c('0x144')])){if(_0x5f7a7[_0x716c('0xae')]){rpcDb['unlockContact'](_0x5f7a7['idContact']);}if(_0x5f7a7['activeContact']){rpcDb[_0x716c('0x8f')](_0x5f7a7[_0x716c('0x105')]);}_0xee6964[_0x716c('0x142')]='22';this['callProgressDetectingAgent'](_0x5f7a7,_0x41e126,_0xee6964);}else if(_0x5f7a7&&_0x5f7a7[_0x716c('0x144')]){if(_0xee6964[_0x716c('0x13f')]==='16'&&this[_0x716c('0x15')][_0xee6964[_0x716c('0xb0')]][_0x716c('0x77')]){logger[_0x716c('0x5f')](_0x716c('0x145'),_0xee6964[_0x716c('0xb0')],_0xee6964[_0x716c('0x13f')],_0x716c('0xb4'),_0x41e126['name'],'pTalking:\x20',_0x41e126['pTalking']);this[_0x716c('0xa1')](_0xee6964,_0xee6964[_0x716c('0xb0')],_0xee6964[_0x716c('0x13f')]);}else if(this[_0x716c('0x15')][_0xee6964[_0x716c('0xb0')]][_0x716c('0x77')]){logger[_0x716c('0x5f')]('[syncHangup][talking][cause]',_0xee6964[_0x716c('0xb0')],_0xee6964[_0x716c('0x13f')],_0x716c('0xb4'),_0x41e126[_0x716c('0x2c')],_0x716c('0x76'),_0x41e126[_0x716c('0x30')]);this['callProgressDetectingCustomer'](_0xee6964,_0xee6964[_0x716c('0xb0')],_0xee6964['cause']);}}};Preview[_0x716c('0xe')]['syncDialEnd']=function(_0x28d835){if(this[_0x716c('0x15')][_0x28d835[_0x716c('0xf1')]]&&_0x28d835[_0x716c('0xf1')]!==_0x28d835[_0x716c('0x146')]){this[_0x716c('0xa1')](_0x28d835,_0x28d835[_0x716c('0xf1')],_0x28d835[_0x716c('0xec')]);}};Preview['prototype']['syncHangupRequest']=function(_0x3d0550){if(this[_0x716c('0x15')][_0x3d0550[_0x716c('0xb0')]]&&_0x3d0550[_0x716c('0xb0')]!==_0x3d0550[_0x716c('0xbe')]&&!this[_0x716c('0x15')][_0x3d0550[_0x716c('0xb0')]][_0x716c('0x77')]){if(_0x3d0550[_0x716c('0x13f')]==='1'){this['callProgressDetectingCustomer'](_0x3d0550,_0x3d0550[_0x716c('0xb0')],_0x3d0550[_0x716c('0x13f')]);}}};Preview[_0x716c('0xe')][_0x716c('0x147')]=function(_0x2cd7ed,_0x27ed08,_0x1715a3){if(this[_0x716c('0x15')][_0x2cd7ed]){if(_['isNil'](this['actions'][_0x2cd7ed]['variables'])){this[_0x716c('0x15')][_0x2cd7ed]['variables']={};}this[_0x716c('0x15')][_0x2cd7ed][_0x716c('0x148')][_0x27ed08]=_0x1715a3;}};Preview[_0x716c('0xe')][_0x716c('0x23')]=function(_0x4b4da2){try{if(!_['isNil'](_0x4b4da2)){if(ut[_0x716c('0x149')](_[_0x716c('0x14a')](_0x4b4da2['variable'])[0x0])){this[_0x716c('0x147')](_0x4b4da2[_0x716c('0xbe')],_[_0x716c('0x14a')](_0x4b4da2[_0x716c('0x14b')])[0x0],_0x4b4da2[_0x716c('0x14c')]);}}}catch(_0xac867){logger[_0x716c('0x14d')](_0x716c('0x14e'),util[_0x716c('0x14f')](_0xac867,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x4a99cf){if(_0x4a99cf){if(this[_0x716c('0x15')][_0x4a99cf['transfertargetlinkedid']]){this[_0x716c('0x15')][_0x4a99cf[_0x716c('0x150')]][_0x716c('0x144')]=!![];}}};Preview[_0x716c('0xe')][_0x716c('0x27')]=function(_0x54a0c9){if(_0x54a0c9){if(this[_0x716c('0x15')][_0x54a0c9[_0x716c('0x151')]]){this[_0x716c('0x15')][_0x54a0c9[_0x716c('0x151')]]['transfer']=!![];}}};module[_0x716c('0x152')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b42c73f..1851891 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 _0x3937=['queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','exten','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x5cfef1,_0x366659){var _0x501414=function(_0x5d9277){while(--_0x5d9277){_0x5cfef1['push'](_0x5cfef1['shift']());}};_0x501414(++_0x366659);}(_0x3937,0xbf));var _0x7393=function(_0x3ecbce,_0x8bfda3){_0x3ecbce=_0x3ecbce-0x0;var _0x42e963=_0x3937[_0x3ecbce];return _0x42e963;};'use strict';var util=require(_0x7393('0x0'));var BPromise=require('bluebird');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var _=require('lodash');var cmHopper=require(_0x7393('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x7393('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7393('0x5'));var agentReportPreview=require(_0x7393('0x6'));var voiceQueueReport=require(_0x7393('0x7'));function loggerCatch(_0x1f538f){return function(_0x15eabd){logger[_0x7393('0x8')](_0x1f538f,util[_0x7393('0x9')](_0x15eabd,{'showHidden':![],'depth':null}));};}function create(_0x26668a){return BPromise[_0x7393('0xa')]()['then'](cmHopperHistory['createHistory'](_0x26668a))[_0x7393('0xb')](loggerCatch(_0x7393('0xc')));}function createAgent(_0x1cc3fd){return BPromise['resolve']()[_0x7393('0xd')](agentReportPreview['createHistory'](_0x1cc3fd))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x497b6b){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0xe')](_0x497b6b,!![]))['catch'](loggerCatch(_0x7393('0xf')));}exports[_0x7393('0x10')]=function(_0x20fb41){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopperBlack[_0x7393('0x10')](_0x20fb41))[_0x7393('0xb')](loggerCatch(_0x7393('0x11')));};exports[_0x7393('0x12')]=function(_0x4e521c){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactPreview'](_0x4e521c))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x7393('0x13')]=function(_0x54dc47,_0x2a1180){create(_0x54dc47)[_0x7393('0xb')](loggerCatch(_0x2a1180));moveContact(_0x54dc47)['catch'](loggerCatch(_0x2a1180));};exports[_0x7393('0x14')]=function(_0x5745cb,_0x5694b6){createAgent(_0x5745cb)[_0x7393('0xb')](loggerCatch(_0x5694b6));};exports[_0x7393('0x15')]=function(_0x1b032c,_0x1dc3e3){create(_0x1b032c)[_0x7393('0xb')](loggerCatch(_0x1dc3e3));};exports[_0x7393('0x16')]=function(_0x21f712,_0x208b9a){moveContact(_0x21f712)['catch'](loggerCatch(_0x208b9a));};exports['rescheduleContact']=function(_0x30eae3,_0x16f617,_0x3979b7){if(_0x16f617){_0x30eae3[_0x7393('0x17')]=null;}if(_0x3979b7){_0x30eae3[_0x7393('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x30eae3))[_0x7393('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x2bf7a9){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x19')](_0x2bf7a9))[_0x7393('0xb')](loggerCatch(_0x7393('0x1a')));};exports[_0x7393('0x1b')]=function(_0x3fe456){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0x1b')]({'UserId':null},_0x3fe456,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1c')));};exports[_0x7393('0x1d')]=function(_0x123ab4){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x1b')]({'active':![]},_0x123ab4,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1e')));};exports[_0x7393('0x1f')]=function(_0x1013aa){var _0xd8dfae={};_0xd8dfae['type']=_0x1013aa[_0x7393('0x20')];_0xd8dfae['uniqueid']=_0x1013aa[_0x7393('0x21')];_0xd8dfae['calleridnum']=_0x1013aa[_0x7393('0x22')];_0xd8dfae[_0x7393('0x23')]=_0x1013aa[_0x7393('0x23')];_0xd8dfae[_0x7393('0x24')]=_0x1013aa[_0x7393('0x24')];_0xd8dfae[_0x7393('0x25')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x27')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x28')]=0x1;_0xd8dfae[_0x7393('0x29')]=_0x1013aa[_0x7393('0x2a')];_0xd8dfae['connectedlinename']=_0x1013aa['membername'];_0xd8dfae[_0x7393('0x2b')]='from-sip';_0xd8dfae[_0x7393('0x2c')]='xcally-motion-preview';_0xd8dfae[_0x7393('0x2d')]=0x0;_0xd8dfae['assigned']=0x1;_0xd8dfae[_0x7393('0x2e')]=_0x1013aa[_0x7393('0x2f')];_0xd8dfae[_0x7393('0x30')]=_0x7393('0x31');return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](voiceQueueReport[_0x7393('0x32')](_0xd8dfae))[_0x7393('0xb')](loggerCatch(_0x7393('0x33')));};exports[_0x7393('0x34')]=function(_0x585d47,_0x17e110){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactRecallMe'](_0x585d47,_0x17e110))[_0x7393('0xb')](loggerCatch(_0x7393('0x35')));};exports[_0x7393('0x36')]=function(_0x308cfb){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x37')](_0x308cfb,!![],!![]))['catch'](loggerCatch(_0x7393('0x38')));}; \ No newline at end of file +var _0x5075=['exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','then','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip'];(function(_0x1e909d,_0x4a8f3d){var _0x4762cd=function(_0x30cc4e){while(--_0x30cc4e){_0x1e909d['push'](_0x1e909d['shift']());}};_0x4762cd(++_0x4a8f3d);}(_0x5075,0x73));var _0x5507=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x5075[_0x5280f4];return _0xba93e7;};'use strict';var util=require(_0x5507('0x0'));var BPromise=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var _=require(_0x5507('0x4'));var cmHopper=require(_0x5507('0x5'));var cmHopperFinal=require(_0x5507('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5507('0x7'));var voiceQueueRt=require(_0x5507('0x8'));var agentReportPreview=require(_0x5507('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5b6d7f){return function(_0x2cd9ee){logger[_0x5507('0xa')](_0x5b6d7f,util['inspect'](_0x2cd9ee,{'showHidden':![],'depth':null}));};}function create(_0x42c232){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperHistory['createHistory'](_0x42c232))['catch'](loggerCatch(_0x5507('0xd')));}function createAgent(_0x441bdc){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](agentReportPreview['createHistory'](_0x441bdc))[_0x5507('0xe')](loggerCatch(_0x5507('0xd')));}function moveContact(_0x55520e){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper['moveContactManagedDialer'](_0x55520e,!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0xf')));}exports[_0x5507('0x10')]=function(_0x267f27){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperBlack['checkIsBlackList'](_0x267f27))[_0x5507('0xe')](loggerCatch(_0x5507('0x11')));};exports[_0x5507('0x12')]=function(_0x46545d){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x12')](_0x46545d))[_0x5507('0xe')](loggerCatch(_0x5507('0x13')));};exports[_0x5507('0x14')]=function(_0x2ede34,_0x241932){create(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));moveContact(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));};exports[_0x5507('0x15')]=function(_0x233b6a,_0x2260f7){createAgent(_0x233b6a)[_0x5507('0xe')](loggerCatch(_0x2260f7));};exports['createCustomerHistory']=function(_0x14dab0,_0x276a81){create(_0x14dab0)[_0x5507('0xe')](loggerCatch(_0x276a81));};exports[_0x5507('0x16')]=function(_0x54f473,_0x1dc53e){moveContact(_0x54f473)[_0x5507('0xe')](loggerCatch(_0x1dc53e));};exports[_0x5507('0x17')]=function(_0x3ca1f7,_0x68397c,_0x1be8b1){if(_0x68397c){_0x3ca1f7['UserId']=null;}if(_0x1be8b1){_0x3ca1f7[_0x5507('0x18')]=![];}return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x3ca1f7))[_0x5507('0xe')](loggerCatch(_0x5507('0x19')));};exports[_0x5507('0x1a')]=function(_0x10f149){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x1a')](_0x10f149))[_0x5507('0xe')](loggerCatch(_0x5507('0x1b')));};exports[_0x5507('0x1c')]=function(_0x1a2203){return BPromise['resolve']()[_0x5507('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1a2203,0x1))[_0x5507('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x5507('0x1d')]=function(_0x24668b){return BPromise['resolve']()['then'](cmHopper[_0x5507('0x1c')]({'active':![]},_0x24668b,0x1))[_0x5507('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x5507('0x1e')]=function(_0x24574b){var _0x85d383={};_0x85d383[_0x5507('0x1f')]=_0x24574b[_0x5507('0x1f')];_0x85d383[_0x5507('0x20')]=_0x24574b['uniqueid'];_0x85d383[_0x5507('0x21')]=_0x24574b[_0x5507('0x21')];_0x85d383[_0x5507('0x22')]=_0x24574b[_0x5507('0x22')];_0x85d383[_0x5507('0x23')]=_0x24574b['queue'];_0x85d383['queuecallerjoinAt']=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x25')]=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x26')]=0x1;_0x85d383['queuecallercompleteAt']=_0x24574b[_0x5507('0x27')];_0x85d383[_0x5507('0x28')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x2a')]=_0x5507('0x2b');_0x85d383[_0x5507('0x2c')]=_0x5507('0x2d');_0x85d383[_0x5507('0x2e')]=0x0;_0x85d383['assigned']=0x1;_0x85d383[_0x5507('0x2f')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x30')]='COMPLETED';return BPromise['resolve']()[_0x5507('0xc')](voiceQueueReport[_0x5507('0x31')](_0x85d383))[_0x5507('0xe')](loggerCatch(_0x5507('0x32')));};exports[_0x5507('0x33')]=function(_0x574fc6,_0x5cc72c){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x33')](_0x574fc6,_0x5cc72c))[_0x5507('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x23ea7c){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x23ea7c,!![],!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0x34')));}; \ 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 da68161..d9cc2bf 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 _0x92cc=['pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','name','queue','interface','buildAcw','channelAgent','agentReadyId','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','info','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_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','ringtime','responsetime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink'];(function(_0x57cf0c,_0x360617){var _0x29031f=function(_0x35389b){while(--_0x35389b){_0x57cf0c['push'](_0x57cf0c['shift']());}};_0x29031f(++_0x360617);}(_0x92cc,0x15a));var _0xc92c=function(_0x38abcd,_0x590d2a){_0x38abcd=_0x38abcd-0x0;var _0x58810f=_0x92cc[_0x38abcd];return _0x58810f;};'use strict';var util=require(_0xc92c('0x0'));var _=require(_0xc92c('0x1'));var moment=require(_0xc92c('0x2'));var logger=require(_0xc92c('0x3'))(_0xc92c('0x4'));var ipAgi=process[_0xc92c('0x5')][_0xc92c('0x6')]||_0xc92c('0x7');function getSeconds(_0x11f487,_0x3f3cf0){var _0x65a903=moment(_0x11f487)[_0xc92c('0x8')](0x0);var _0x1898ec=moment(_0x3f3cf0)[_0xc92c('0x8')](0x0);return _0x65a903[_0xc92c('0x9')](_0x1898ec,'seconds');}exports[_0xc92c('0xa')]=function(_0x292be0){return function(_0x387852){logger[_0xc92c('0xb')](_0x292be0,util[_0xc92c('0xc')](_0x387852,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x53e989,_0x26c4f8){logger[_0xc92c('0xd')](_0x53e989,util[_0xc92c('0xc')](_0x26c4f8,{'showHidden':![],'depth':null}));};exports[_0xc92c('0xe')]=function(_0x5cb8ca,_0x461220){logger[_0xc92c('0xb')](_0x5cb8ca,util[_0xc92c('0xc')](_0x461220,{'showHidden':![],'depth':null}));};exports[_0xc92c('0xf')]=function(_0x49108a){return function(_0x6e2f76){logger['info'](_0x49108a,util[_0xc92c('0xc')](_0x6e2f76,{'showHidden':![],'depth':null}));};};exports[_0xc92c('0x10')]=function(_0x46d8d9,_0x5ccc80,_0x325ce6){return{'message':_0x46d8d9,'unlock':_0x5ccc80,'active':_0x325ce6};};exports['getCallerId']=function(_0x3a937a,_0x267c23,_0x4e69e2){if(!_['isUndefined'](_0x4e69e2)&&_0xc92c('0x11')===typeof _0x4e69e2&&!_[_0xc92c('0x12')](_0x4e69e2)){if(!_[_0xc92c('0x13')](_0x267c23)&&_0xc92c('0x11')===typeof _0x267c23&&!_[_0xc92c('0x12')](_0x267c23)){return util[_0xc92c('0x14')](_0xc92c('0x15'),_0x267c23,_0x4e69e2);}return util[_0xc92c('0x14')](_0xc92c('0x15'),_0x4e69e2,_0x4e69e2);}if(!_[_0xc92c('0x13')](_0x3a937a)&&'string'===typeof _0x3a937a&&!_[_0xc92c('0x12')](_0x3a937a)){return _0x3a937a;}return _0xc92c('0x16');};exports[_0xc92c('0x17')]=function(_0x496b6e){if(_[_0xc92c('0x18')](_0x496b6e)){return![];}return _0x496b6e;};exports[_0xc92c('0x19')]=function(_0x1c0db3,_0x3bcfe2,_0x155c66,_0xcc3965,_0x5dbad1,_0x478f7a){var _0x3e3fd4={'XMD-QUEUE':_0x3bcfe2['Queue']?_0x3bcfe2[_0xc92c('0x1a')]['name']:'','XMD-CALLERID':_0xcc3965,'XMD-CALLERID-PREVIEW':_0x478f7a?util[_0xc92c('0x14')]('\x22%s\x22\x20<%s>',_0x478f7a['calleridname'],_0x478f7a[_0xc92c('0x1b')]):_0xcc3965,'XMD-DIALID':_0x5dbad1,'XMD-CONTACTID':_0x3bcfe2[_0xc92c('0x1c')],'XMD-CDRTYPE':_0xc92c('0x1d'),'CALLERID(all)':_0xcc3965,'XMD-VOICEQUEUEID':_0x3bcfe2[_0xc92c('0x1e')],'XMD-DIALCHANNEL':_0x155c66,'XMD-DIALTIMEOUT':_0x1c0db3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc92c('0x14')](_0xc92c('0x1f'),_0x1c0db3[_0xc92c('0x20')]?'g':'',_[_0xc92c('0x12')](_0x1c0db3[_0xc92c('0x21')])?'':_0xc92c('0x22')),'XMD-DIALURL':_0x1c0db3[_0xc92c('0x23')]||'','XMD-AGI':_0x1c0db3[_0xc92c('0x24')]?util[_0xc92c('0x14')](_0xc92c('0x25'),ipAgi,_0x1c0db3[_0xc92c('0x24')]):_0xc92c('0x26'),'XMD-AGIAFTER':_0x1c0db3[_0xc92c('0x20')]?util[_0xc92c('0x14')](_0xc92c('0x25'),ipAgi,_0x1c0db3[_0xc92c('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x478f7a?_0x478f7a[_0xc92c('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x478f7a?_0x478f7a[_0xc92c('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xc92c('0x12')](_0x1c0db3[_0xc92c('0x21')])){_0x3e3fd4[util['format']('%s',_0xc92c('0x29'))]=_0x1c0db3[_0xc92c('0x21')];_0x3e3fd4[util[_0xc92c('0x14')]('%s',_0xc92c('0x2a'))]=_0x5dbad1;}if(_0x3bcfe2&&_0x3bcfe2[_0xc92c('0x2b')]){for(var _0x16a2e2 in _0x3bcfe2[_0xc92c('0x2b')]){if(_0x3bcfe2[_0xc92c('0x2b')]['hasOwnProperty'](_0x16a2e2)){if(!_[_0xc92c('0x18')](_0x3bcfe2[_0xc92c('0x2b')][_0x16a2e2])&&_0x16a2e2!=='id'&&_0x16a2e2!==_0xc92c('0x2c')&&_0x16a2e2!==_0xc92c('0x2d')&&_0x16a2e2!==_0xc92c('0x2e')){_0x3e3fd4[util[_0xc92c('0x14')](_0xc92c('0x2f'),_0xc92c('0x30'),_[_0xc92c('0x31')](_0x16a2e2))]=_0x3bcfe2[_0xc92c('0x2b')][_0x16a2e2];}}}}return _0x3e3fd4;};exports[_0xc92c('0x32')]=function(_0x31533e){var _0x290a7c={};for(var _0x3f25ad in _0x31533e){if(_0x31533e[_0xc92c('0x33')](_0x3f25ad)){_0x290a7c[util[_0xc92c('0x14')]('%s',_[_0xc92c('0x34')](_0x3f25ad))]=_0x31533e[_0x3f25ad];}}return{'variables':_0x290a7c};};exports[_0xc92c('0x35')]=function(_0x1bb8b2,_0x3dcd5b){if(!_[_0xc92c('0x18')](_0x1bb8b2)){if(_0x1bb8b2[_0xc92c('0x33')]('originated')){if(_0x1bb8b2[_0xc92c('0x36')]>0x0){_0x1bb8b2['originated']-=0x1;}else{logger['error'](_0xc92c('0x37'),_0x3dcd5b);}}}else{logger['error'](_0xc92c('0x38'),_0x3dcd5b);}};exports[_0xc92c('0x39')]=function(_0x15622d){var _0x4b500f=moment()[_0xc92c('0x14')](_0xc92c('0x3a'));_0x15622d[_0xc92c('0x3b')]=0xd;_0x15622d[_0xc92c('0x3c')]=_0xc92c('0x3d');_0x15622d[_0xc92c('0x3e')]=_0x4b500f;_0x15622d['responsetime']=_0x4b500f;_0x15622d['endtime']=_0x4b500f;};exports['logAgent']=function(_0x29f5cf,_0x537e4b,_0x2fd423){var _0x38ec9b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x29f5cf['state']=_0x537e4b;_0x29f5cf[_0xc92c('0x3c')]=_0x2fd423;_0x29f5cf['responsetime']=_0x38ec9b;_0x29f5cf[_0xc92c('0x3f')]=getSeconds(_0x29f5cf[_0xc92c('0x40')],_0x29f5cf[_0xc92c('0x3e')]);};exports[_0xc92c('0x41')]=function(_0x1ea817,_0x97754,_0x1eb504){_0x1ea817['membername']=_0x97754;_0x1ea817[_0xc92c('0x42')]=_0x1eb504;};exports[_0xc92c('0x43')]=function(_0x5f0238,_0x78558d,_0x369545){var _0x1d2de0=moment()[_0xc92c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f0238['state']=_0x78558d;_0x5f0238[_0xc92c('0x3c')]=_0x369545;_0x5f0238['responsetime']=_0x5f0238[_0xc92c('0x40')]?_0x5f0238[_0xc92c('0x40')]:_0x1d2de0;_0x5f0238[_0xc92c('0x44')]=_0x5f0238[_0xc92c('0x44')]?_0x5f0238[_0xc92c('0x44')]:_0x1d2de0;_0x5f0238[_0xc92c('0x3f')]=getSeconds(_0x5f0238['responsetime']||0x0,_0x5f0238[_0xc92c('0x3e')]||0x0);_0x5f0238[_0xc92c('0x45')]=_0x5f0238[_0xc92c('0x46')]?getSeconds(_0x5f0238['endtime'],_0x5f0238[_0xc92c('0x46')]):0x0;};exports[_0xc92c('0x47')]=function(_0x5345b3){return _0x5345b3===_0xc92c('0x48');};exports[_0xc92c('0x49')]=function(_0x2df292,_0x3503fb,_0x27a383,_0x474b89,_0x3b50de){var _0x3f73cb=_0x474b89?_0xc92c('0x4a'):_0x2df292[_0xc92c('0x4b')];_0x3f73cb=_0x3b50de?_0xc92c('0x4c'):_0x3f73cb;return{'actionid':_0x2df292[_0xc92c('0x4d')],'action':'originate','channel':_0x2df292['channelAgent'],'callerid':util['format'](_0xc92c('0x15'),_0x3f73cb,_0x2df292[_0xc92c('0x1b')]),'Exten':_0xc92c('0x4e'),'Context':_0xc92c('0x4f'),'Priority':'1','variable':_0x27a383,'timeout':(_0x3503fb[_0xc92c('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2df292[_0xc92c('0x4d')]};};exports[_0xc92c('0x51')]=function(_0x1a7496){return _0x1a7496[_0xc92c('0x52')]+_0x1a7496[_0xc92c('0x53')]+_0x1a7496['countnoanswerretry']+_0x1a7496[_0xc92c('0x54')]+_0x1a7496[_0xc92c('0x55')];};exports[_0xc92c('0x56')]=function(_0x25a1d3){var _0xafff48=_[_0xc92c('0x57')](_0x25a1d3);_0xafff48[_0xc92c('0x3b')]=0xf;_0xafff48[_0xc92c('0x3c')]=_0xc92c('0x58');return _0xafff48;};exports[_0xc92c('0x59')]=function(_0x56250b,_0x3ce619,_0x5548c6){var _0x767fa8={};_0x767fa8[_0x3ce619]=_0x56250b[_0x3ce619];_0x767fa8[_0xc92c('0x5a')]=![];_0x767fa8[_0xc92c('0x5b')]=moment()['add'](_0x5548c6,_0xc92c('0x5c'))['format'](_0xc92c('0x3a'));_0x767fa8['ContactId']=_0x56250b[_0xc92c('0x1c')];_0x767fa8[_0xc92c('0x5d')]=_0x56250b[_0xc92c('0x5d')];_0x767fa8[_0xc92c('0x1e')]=_0x56250b['VoiceQueueId']||undefined;return _0x767fa8;};exports[_0xc92c('0x5e')]=function(_0x585f03,_0x326e4f){if(!_[_0xc92c('0x18')](_0x585f03)){if(_0x585f03['pTalking']>0x0){_0x585f03[_0xc92c('0x5f')]-=0x1;}else{logger[_0xc92c('0xb')](_0x326e4f,_0xc92c('0x60'));}}else{logger[_0xc92c('0xb')](_0x326e4f,_0xc92c('0x61'));}};exports['IsNotLoggedIn']=function(_0x592087){if(_0x592087<=0x0){return!![];}return![];};exports[_0xc92c('0x62')]=function(_0x54e2b9,_0x392887,_0x51242b){_0x54e2b9[_0xc92c('0x63')]=_0x392887;_0x54e2b9[_0xc92c('0x64')]=_0x54e2b9[_0xc92c('0x65')];_0x54e2b9[_0xc92c('0x66')]=_0x54e2b9['channelAgent'];if(_0x51242b){_0x54e2b9['mandatoryDisposition']=_0x51242b['mandatoryDisposition'];}return _0x54e2b9;};exports[_0xc92c('0x67')]=function(_0x3e5d64){var _0x169753={};_0x169753[_0xc92c('0x65')]=_0x3e5d64[_0xc92c('0x65')];_0x169753[_0xc92c('0x66')]=_0x3e5d64[_0xc92c('0x68')];_0x169753[_0xc92c('0x4d')]=_0x3e5d64[_0xc92c('0x4d')];return _0x169753;};exports[_0xc92c('0x69')]=function(_0x3c08f3){var _0x7329b6=[];for(var _0x15cb54 in _0x3c08f3){if(_0x3c08f3['hasOwnProperty'](_0x15cb54)){if(!_['isNil'](_0x3c08f3[_0x15cb54])&&_0x3c08f3[_0x15cb54][_0xc92c('0x3b')]==='not_inuse'&&_0x3c08f3[_0x15cb54][_0xc92c('0x6a')]===_0xc92c('0x6b')){_0x7329b6[_0xc92c('0x6c')](_0x3c08f3[_0x15cb54]['id']);}}}return _0x7329b6;};exports[_0xc92c('0x6d')]=function(_0x2962e3){var _0x38a13a=moment()[_0xc92c('0x8')](0x0);var _0xc7eabe=moment(_0x2962e3)[_0xc92c('0x8')](0x0);return _0x38a13a[_0xc92c('0x9')](_0xc7eabe,_0xc92c('0x6e'));};exports[_0xc92c('0x6f')]=function(_0x62bbbf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x62bbbf[_0xc92c('0x1c')],'ListId':_0x62bbbf[_0xc92c('0x5d')],'VoiceQueueId':_0x62bbbf[_0xc92c('0x1e')]||undefined,'CampaignId':_0x62bbbf[_0xc92c('0x70')]||undefined};};exports[_0xc92c('0x71')]=function(_0x5c03b2){if(_0x5c03b2===_0xc92c('0x4d')||_0x5c03b2===_0xc92c('0x72')||_0x5c03b2===_0xc92c('0x65')||_0x5c03b2===_0xc92c('0x73')||_0x5c03b2==='campaigntype'||_0x5c03b2===_0xc92c('0x74')||_0x5c03b2===_0xc92c('0x75')||_0x5c03b2===_0xc92c('0x68')||_0x5c03b2===_0xc92c('0x4b')||_0x5c03b2===_0xc92c('0x5a')||_0x5c03b2===_0xc92c('0x1b')||_0x5c03b2==='scheduledat'||_0x5c03b2===_0xc92c('0x52')||_0x5c03b2===_0xc92c('0x53')||_0x5c03b2===_0xc92c('0x76')||_0x5c03b2===_0xc92c('0x77')||_0x5c03b2===_0xc92c('0x78')||_0x5c03b2===_0xc92c('0x79')||_0x5c03b2===_0xc92c('0x7a')||_0x5c03b2===_0xc92c('0x7b')||_0x5c03b2===_0xc92c('0x1c')||_0x5c03b2===_0xc92c('0x5d')||_0x5c03b2==='UserId'||_0x5c03b2===_0xc92c('0x1e')||_0x5c03b2===_0xc92c('0x7c')||_0x5c03b2===_0xc92c('0x7d')||_0x5c03b2==='xmd-queue'||_0x5c03b2==='xmd-phone'||_0x5c03b2===_0xc92c('0x7e')||_0x5c03b2==='xmd-dialurl'||_0x5c03b2===_0xc92c('0x7f')||_0x5c03b2==='xmd-dialoptions'||_0x5c03b2===_0xc92c('0x80')||_0x5c03b2===_0xc92c('0x81')||_0x5c03b2===_0xc92c('0x82')||_0x5c03b2==='xmd-cdrtype'||_0x5c03b2===_0xc92c('0x83')||_0x5c03b2==='xmd-agiafter'||_0x5c03b2==='xmd-agi'||_0x5c03b2===_0xc92c('0x84')||_0x5c03b2===_0xc92c('0x85')||_0x5c03b2==='rtpaudioqosjitter'||_0x5c03b2===_0xc92c('0x86')||_0x5c03b2===_0xc92c('0x87')||_0x5c03b2===_0xc92c('0x88')||_0x5c03b2==='rtpaudioqosrtt'||_0x5c03b2==='rtpaudioqosrttbridged'||_0x5c03b2===_0xc92c('0x84')||_0x5c03b2===_0xc92c('0x85')||_0x5c03b2==='rtpaudioqosjitter'||_0x5c03b2===_0xc92c('0x86')||_0x5c03b2===_0xc92c('0x87')||_0x5c03b2==='rtpaudioqoslossbridged'||_0x5c03b2==='rtpaudioqosrtt'||_0x5c03b2===_0xc92c('0x89')||_0x5c03b2===_0xc92c('0x8a')||_0x5c03b2===_0xc92c('0x8b')||_0x5c03b2===_0xc92c('0x3b')||_0x5c03b2===_0xc92c('0x3c')){return![];}return!![];};exports[_0xc92c('0x8c')]=function(_0x1fde2c,_0x169de0){var _0x2a8f56,_0x5f50b4,_0x46f32a;if(_0x169de0<=0x0){_0x169de0=0x1;}_0x2a8f56=new RegExp(_0xc92c('0x8d')+_0x169de0+'}$');_0x5f50b4=Math[_0xc92c('0x8e')](0xa,_0x169de0-0x1);_0x46f32a=Math[_0xc92c('0x8e')](0xa,_0x169de0)-0x1;return util[_0xc92c('0x14')]('%s',_[_0xc92c('0x8f')](_0x1fde2c,_0x2a8f56,_[_0xc92c('0x90')](_0x5f50b4,_0x46f32a)));};exports[_0xc92c('0x91')]=function(_0x519cab){var _0x5f5a68=_0x519cab[_0xc92c('0x92')](/"(.*?)"/);return _0x5f5a68?_0x5f5a68[0x1]:_0x519cab;};exports['extractCalleridNumber']=function(_0x159022){var _0x19f485=_0x159022[_0xc92c('0x92')](/<(.*?)>/);return _0x19f485?_0x19f485[0x1]:_0x159022;}; \ No newline at end of file +var _0xf33e=['interface','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','extractCalleridNumber','util','moment','../../../../config/logger','XCALLY_IP_AGI','milliseconds','diff','inspect','logger','loggerError','error','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','Queue','name','\x22%s\x22\x20<%s>','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logLookAgent','membername','UserId','ringtime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue'];(function(_0x4bbe37,_0x280d9f){var _0x2a2ee6=function(_0x5e0a69){while(--_0x5e0a69){_0x4bbe37['push'](_0x4bbe37['shift']());}};_0x2a2ee6(++_0x280d9f);}(_0xf33e,0x1c8));var _0xef33=function(_0x4d697c,_0x5a8729){_0x4d697c=_0x4d697c-0x0;var _0x3f48c0=_0xf33e[_0x4d697c];return _0x3f48c0;};'use strict';var util=require(_0xef33('0x0'));var _=require('lodash');var moment=require(_0xef33('0x1'));var logger=require(_0xef33('0x2'))('preview');var ipAgi=process['env'][_0xef33('0x3')]||'127.0.0.1';function getSeconds(_0x584db1,_0x395638){var _0x111e47=moment(_0x584db1)[_0xef33('0x4')](0x0);var _0x54f765=moment(_0x395638)[_0xef33('0x4')](0x0);return _0x111e47[_0xef33('0x5')](_0x54f765,'seconds');}exports['loggerCatch']=function(_0x53585c){return function(_0x5a1e36){logger['error'](_0x53585c,util[_0xef33('0x6')](_0x5a1e36,{'showHidden':![],'depth':null}));};};exports[_0xef33('0x7')]=function(_0x8fc559,_0x3a5fe0){logger['info'](_0x8fc559,util['inspect'](_0x3a5fe0,{'showHidden':![],'depth':null}));};exports[_0xef33('0x8')]=function(_0x4c8d97,_0x25dda8){logger[_0xef33('0x9')](_0x4c8d97,util['inspect'](_0x25dda8,{'showHidden':![],'depth':null}));};exports[_0xef33('0xa')]=function(_0x2646af){return function(_0x2a6c7e){logger[_0xef33('0xb')](_0x2646af,util[_0xef33('0x6')](_0x2a6c7e,{'showHidden':![],'depth':null}));};};exports[_0xef33('0xc')]=function(_0x4c5628,_0x3f5843,_0x3f03bc){return{'message':_0x4c5628,'unlock':_0x3f5843,'active':_0x3f03bc};};exports[_0xef33('0xd')]=function(_0x5246dc,_0x2c9bd1,_0x1507c7){if(!_[_0xef33('0xe')](_0x1507c7)&&_0xef33('0xf')===typeof _0x1507c7&&!_['isEmpty'](_0x1507c7)){if(!_[_0xef33('0xe')](_0x2c9bd1)&&_0xef33('0xf')===typeof _0x2c9bd1&&!_[_0xef33('0x10')](_0x2c9bd1)){return util[_0xef33('0x11')]('\x22%s\x22\x20<%s>',_0x2c9bd1,_0x1507c7);}return util[_0xef33('0x11')]('\x22%s\x22\x20<%s>',_0x1507c7,_0x1507c7);}if(!_[_0xef33('0xe')](_0x5246dc)&&_0xef33('0xf')===typeof _0x5246dc&&!_[_0xef33('0x10')](_0x5246dc)){return _0x5246dc;}return _0xef33('0x12');};exports['isActive']=function(_0x192380){if(_['isNil'](_0x192380)){return![];}return _0x192380;};exports['addVariables']=function(_0x8048c,_0x506587,_0x232672,_0x48afb6,_0x10a6f2,_0x45e9fb){var _0x404db5={'XMD-QUEUE':_0x506587[_0xef33('0x13')]?_0x506587[_0xef33('0x13')][_0xef33('0x14')]:'','XMD-CALLERID':_0x48afb6,'XMD-CALLERID-PREVIEW':_0x45e9fb?util[_0xef33('0x11')](_0xef33('0x15'),_0x45e9fb['calleridname'],_0x45e9fb['calleridnum']):_0x48afb6,'XMD-DIALID':_0x10a6f2,'XMD-CONTACTID':_0x506587['ContactId'],'XMD-CDRTYPE':_0xef33('0x16'),'CALLERID(all)':_0x48afb6,'XMD-VOICEQUEUEID':_0x506587[_0xef33('0x17')],'XMD-DIALCHANNEL':_0x232672,'XMD-DIALTIMEOUT':_0x8048c[_0xef33('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0xef33('0x11')]('\x22rtTxX%s%s\x22',_0x8048c['dialQueueProject2']?'g':'',_[_0xef33('0x10')](_0x8048c[_0xef33('0x19')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x8048c['dialPreviewUrl']||'','XMD-AGI':_0x8048c[_0xef33('0x1a')]?util[_0xef33('0x11')](_0xef33('0x1b'),ipAgi,_0x8048c[_0xef33('0x1a')]):_0xef33('0x1c'),'XMD-AGIAFTER':_0x8048c[_0xef33('0x1d')]?util[_0xef33('0x11')](_0xef33('0x1b'),ipAgi,_0x8048c['dialQueueProject2']):_0xef33('0x1c'),'XMD-ORIGINATECALLERIDNUM':_0x45e9fb?_0x45e9fb[_0xef33('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0x45e9fb?_0x45e9fb[_0xef33('0x1f')]:'','XMD-DESTINATION':_0xef33('0x20')};if(!_[_0xef33('0x10')](_0x8048c['monitor_format'])){_0x404db5[util['format']('%s',_0xef33('0x21'))]=_0x8048c['monitor_format'];_0x404db5[util[_0xef33('0x11')]('%s',_0xef33('0x22'))]=_0x10a6f2;}if(_0x506587&&_0x506587[_0xef33('0x23')]){for(var _0x420a5f in _0x506587[_0xef33('0x23')]){if(_0x506587['Contact'][_0xef33('0x24')](_0x420a5f)){if(!_[_0xef33('0x25')](_0x506587['Contact'][_0x420a5f])&&_0x420a5f!=='id'&&_0x420a5f!==_0xef33('0x26')&&_0x420a5f!==_0xef33('0x27')&&_0x420a5f!=='updatedAt'){_0x404db5[util[_0xef33('0x11')](_0xef33('0x28'),_0xef33('0x29'),_[_0xef33('0x2a')](_0x420a5f))]=_0x506587[_0xef33('0x23')][_0x420a5f];}}}}return _0x404db5;};exports[_0xef33('0x2b')]=function(_0x525986){var _0x5513c7={};for(var _0x42c9ee in _0x525986){if(_0x525986[_0xef33('0x24')](_0x42c9ee)){_0x5513c7[util['format']('%s',_[_0xef33('0x2c')](_0x42c9ee))]=_0x525986[_0x42c9ee];}}return{'variables':_0x5513c7};};exports['updateOriginated']=function(_0x3fdb6b,_0x152729){if(!_[_0xef33('0x25')](_0x3fdb6b)){if(_0x3fdb6b[_0xef33('0x24')](_0xef33('0x2d'))){if(_0x3fdb6b[_0xef33('0x2d')]>0x0){_0x3fdb6b[_0xef33('0x2d')]-=0x1;}else{logger[_0xef33('0x9')](_0xef33('0x2e'),_0x152729);}}}else{logger['error'](_0xef33('0x2f'),_0x152729);}};exports[_0xef33('0x30')]=function(_0x13b53d){var _0x15bc01=moment()['format'](_0xef33('0x31'));_0x13b53d[_0xef33('0x32')]=0xd;_0x13b53d[_0xef33('0x33')]='Blacklist';_0x13b53d[_0xef33('0x34')]=_0x15bc01;_0x13b53d[_0xef33('0x35')]=_0x15bc01;_0x13b53d[_0xef33('0x36')]=_0x15bc01;};exports['logAgent']=function(_0x3dff70,_0x3adcd3,_0xaf07c){var _0x12bcc0=moment()[_0xef33('0x11')](_0xef33('0x31'));_0x3dff70[_0xef33('0x32')]=_0x3adcd3;_0x3dff70[_0xef33('0x33')]=_0xaf07c;_0x3dff70[_0xef33('0x35')]=_0x12bcc0;_0x3dff70['ringtime']=getSeconds(_0x3dff70['responsetime'],_0x3dff70[_0xef33('0x34')]);};exports[_0xef33('0x37')]=function(_0xacef81,_0x2d7e11,_0x27359d){_0xacef81[_0xef33('0x38')]=_0x2d7e11;_0xacef81[_0xef33('0x39')]=_0x27359d;};exports['logCustomer']=function(_0xd975a9,_0x11872b,_0x3a1aa6){var _0x4fdadb=moment()[_0xef33('0x11')](_0xef33('0x31'));_0xd975a9[_0xef33('0x32')]=_0x11872b;_0xd975a9[_0xef33('0x33')]=_0x3a1aa6;_0xd975a9['responsetime']=_0xd975a9[_0xef33('0x35')]?_0xd975a9[_0xef33('0x35')]:_0x4fdadb;_0xd975a9[_0xef33('0x36')]=_0xd975a9[_0xef33('0x36')]?_0xd975a9[_0xef33('0x36')]:_0x4fdadb;_0xd975a9[_0xef33('0x3a')]=getSeconds(_0xd975a9['responsetime']||0x0,_0xd975a9[_0xef33('0x34')]||0x0);_0xd975a9[_0xef33('0x3b')]=_0xd975a9[_0xef33('0x3c')]?getSeconds(_0xd975a9[_0xef33('0x36')],_0xd975a9[_0xef33('0x3c')]):0x0;};exports['isFailure']=function(_0x3790cc){return _0x3790cc===_0xef33('0x3d');};exports[_0xef33('0x3e')]=function(_0x2ed2fb,_0x5b70e4,_0x5b491e,_0x55d7ff,_0xfb73d2){var _0x25e049=_0x55d7ff?_0xef33('0x3f'):_0x2ed2fb[_0xef33('0x40')];_0x25e049=_0xfb73d2?'BOOKED':_0x25e049;return{'actionid':_0x2ed2fb[_0xef33('0x41')],'action':_0xef33('0x42'),'channel':_0x2ed2fb[_0xef33('0x43')],'callerid':util[_0xef33('0x11')](_0xef33('0x15'),_0x25e049,_0x2ed2fb[_0xef33('0x44')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x5b491e,'timeout':(_0x5b70e4[_0xef33('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ed2fb['uniqueid']};};exports[_0xef33('0x46')]=function(_0x3c9b0b){return _0x3c9b0b[_0xef33('0x47')]+_0x3c9b0b[_0xef33('0x48')]+_0x3c9b0b[_0xef33('0x49')]+_0x3c9b0b['countagentrejectretry']+_0x3c9b0b[_0xef33('0x4a')];};exports[_0xef33('0x4b')]=function(_0x4f2656){var _0x1ce4f7=_[_0xef33('0x4c')](_0x4f2656);_0x1ce4f7['state']=0xf;_0x1ce4f7[_0xef33('0x33')]='Global';return _0x1ce4f7;};exports[_0xef33('0x4d')]=function(_0x463b32,_0x24a30b,_0x37195b){var _0x2d83da={};_0x2d83da[_0x24a30b]=_0x463b32[_0x24a30b];_0x2d83da[_0xef33('0x4e')]=![];_0x2d83da[_0xef33('0x4f')]=moment()[_0xef33('0x50')](_0x37195b,_0xef33('0x51'))['format'](_0xef33('0x31'));_0x2d83da[_0xef33('0x52')]=_0x463b32[_0xef33('0x52')];_0x2d83da[_0xef33('0x53')]=_0x463b32[_0xef33('0x53')];_0x2d83da['VoiceQueueId']=_0x463b32[_0xef33('0x17')]||undefined;return _0x2d83da;};exports[_0xef33('0x54')]=function(_0x4c1e6e,_0x34a4f1){if(!_['isNil'](_0x4c1e6e)){if(_0x4c1e6e[_0xef33('0x55')]>0x0){_0x4c1e6e[_0xef33('0x55')]-=0x1;}else{logger[_0xef33('0x9')](_0x34a4f1,_0xef33('0x56'));}}else{logger[_0xef33('0x9')](_0x34a4f1,_0xef33('0x57'));}};exports[_0xef33('0x58')]=function(_0x4ad6f4){if(_0x4ad6f4<=0x0){return!![];}return![];};exports[_0xef33('0x59')]=function(_0x5c7ab8,_0x2287a8,_0x1577aa){_0x5c7ab8[_0xef33('0x5a')]=_0x2287a8;_0x5c7ab8['name']=_0x5c7ab8[_0xef33('0x5b')];_0x5c7ab8[_0xef33('0x5c')]=_0x5c7ab8[_0xef33('0x43')];if(_0x1577aa){_0x5c7ab8[_0xef33('0x5d')]=_0x1577aa['mandatoryDisposition'];}return _0x5c7ab8;};exports[_0xef33('0x5e')]=function(_0x76f0c1){var _0x2fce91={};_0x2fce91[_0xef33('0x5b')]=_0x76f0c1[_0xef33('0x5b')];_0x2fce91[_0xef33('0x5c')]=_0x76f0c1['channelAgent'];_0x2fce91[_0xef33('0x41')]=_0x76f0c1[_0xef33('0x41')];return _0x2fce91;};exports['agentReadyId']=function(_0x530e0a){var _0x378eaa=[];for(var _0x51d639 in _0x530e0a){if(_0x530e0a['hasOwnProperty'](_0x51d639)){if(!_[_0xef33('0x25')](_0x530e0a[_0x51d639])&&_0x530e0a[_0x51d639][_0xef33('0x32')]===_0xef33('0x5f')&&_0x530e0a[_0x51d639][_0xef33('0x60')]===_0xef33('0x61')){_0x378eaa[_0xef33('0x62')](_0x530e0a[_0x51d639]['id']);}}}return _0x378eaa;};exports[_0xef33('0x63')]=function(_0x108628){var _0x39e932=moment()[_0xef33('0x4')](0x0);var _0x40ab05=moment(_0x108628)[_0xef33('0x4')](0x0);return _0x39e932[_0xef33('0x5')](_0x40ab05,'seconds');};exports[_0xef33('0x64')]=function(_0x1b0f95){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b0f95[_0xef33('0x52')],'ListId':_0x1b0f95[_0xef33('0x53')],'VoiceQueueId':_0x1b0f95['VoiceQueueId']||undefined,'CampaignId':_0x1b0f95[_0xef33('0x65')]||undefined};};exports[_0xef33('0x66')]=function(_0x5b6fa8){if(_0x5b6fa8===_0xef33('0x41')||_0x5b6fa8===_0xef33('0x67')||_0x5b6fa8==='queue'||_0x5b6fa8===_0xef33('0x68')||_0x5b6fa8===_0xef33('0x69')||_0x5b6fa8===_0xef33('0x6a')||_0x5b6fa8===_0xef33('0x38')||_0x5b6fa8===_0xef33('0x43')||_0x5b6fa8===_0xef33('0x40')||_0x5b6fa8===_0xef33('0x4e')||_0x5b6fa8==='calleridnum'||_0x5b6fa8===_0xef33('0x4f')||_0x5b6fa8===_0xef33('0x47')||_0x5b6fa8===_0xef33('0x48')||_0x5b6fa8===_0xef33('0x49')||_0x5b6fa8==='countglobal'||_0x5b6fa8==='callback'||_0x5b6fa8===_0xef33('0x6b')||_0x5b6fa8===_0xef33('0x6c')||_0x5b6fa8==='recallme'||_0x5b6fa8===_0xef33('0x52')||_0x5b6fa8==='ListId'||_0x5b6fa8===_0xef33('0x39')||_0x5b6fa8===_0xef33('0x17')||_0x5b6fa8===_0xef33('0x6d')||_0x5b6fa8===_0xef33('0x6e')||_0x5b6fa8==='xmd-queue'||_0x5b6fa8===_0xef33('0x6f')||_0x5b6fa8===_0xef33('0x70')||_0x5b6fa8===_0xef33('0x71')||_0x5b6fa8===_0xef33('0x72')||_0x5b6fa8===_0xef33('0x73')||_0x5b6fa8==='xmd-dialid'||_0x5b6fa8===_0xef33('0x74')||_0x5b6fa8===_0xef33('0x75')||_0x5b6fa8==='xmd-cdrtype'||_0x5b6fa8===_0xef33('0x76')||_0x5b6fa8===_0xef33('0x77')||_0x5b6fa8===_0xef33('0x78')||_0x5b6fa8===_0xef33('0x79')||_0x5b6fa8===_0xef33('0x7a')||_0x5b6fa8===_0xef33('0x7b')||_0x5b6fa8===_0xef33('0x7c')||_0x5b6fa8==='rtpaudioqosloss'||_0x5b6fa8===_0xef33('0x7d')||_0x5b6fa8===_0xef33('0x7e')||_0x5b6fa8===_0xef33('0x7f')||_0x5b6fa8===_0xef33('0x79')||_0x5b6fa8==='rtpaudioqosbridged'||_0x5b6fa8===_0xef33('0x7b')||_0x5b6fa8===_0xef33('0x7c')||_0x5b6fa8===_0xef33('0x80')||_0x5b6fa8===_0xef33('0x7d')||_0x5b6fa8===_0xef33('0x7e')||_0x5b6fa8===_0xef33('0x7f')||_0x5b6fa8===_0xef33('0x81')||_0x5b6fa8===_0xef33('0x82')||_0x5b6fa8==='state'||_0x5b6fa8==='statedesc'){return![];}return!![];};exports[_0xef33('0x83')]=function(_0x49930c,_0x4bc05c){var _0x2c63f5,_0x428a81,_0x317946;if(_0x4bc05c<=0x0){_0x4bc05c=0x1;}_0x2c63f5=new RegExp(_0xef33('0x84')+_0x4bc05c+'}$');_0x428a81=Math[_0xef33('0x85')](0xa,_0x4bc05c-0x1);_0x317946=Math[_0xef33('0x85')](0xa,_0x4bc05c)-0x1;return util[_0xef33('0x11')]('%s',_[_0xef33('0x86')](_0x49930c,_0x2c63f5,_['random'](_0x428a81,_0x317946)));};exports['extractCalleridName']=function(_0x5e2f00){var _0x88fbb8=_0x5e2f00[_0xef33('0x87')](/"(.*?)"/);return _0x88fbb8?_0x88fbb8[0x1]:_0x5e2f00;};exports[_0xef33('0x88')]=function(_0x4fec4c){var _0x5c9016=_0x4fec4c[_0xef33('0x87')](/<(.*?)>/);return _0x5c9016?_0x5c9016[0x1]:_0x4fec4c;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fb092dc..b3cfd16 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(_0x3c4d62,_0x2dd110){var _0x59a39e=function(_0x14943c){while(--_0x14943c){_0x3c4d62['push'](_0x3c4d62['shift']());}};_0x59a39e(++_0x2dd110);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1438df,_0x3ca1bc){_0x1438df=_0x1438df-0x0;var _0x354c58=_0x5f2f[_0x1438df];return _0x354c58;};'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(_0x4944c9,_0x9b3a66){var _0x5e738b=function(_0xe18d6c){while(--_0xe18d6c){_0x4944c9['push'](_0x4944c9['shift']());}};_0x5e738b(++_0x9b3a66);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36ef02,_0x4629ce){_0x36ef02=_0x36ef02-0x0;var _0x2978cf=_0x5f2f[_0x36ef02];return _0x2978cf;};'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 7ea1102..e08ebd7 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 _0xb821=['isEmpty','total','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','isUndefined','initTelephones','initVoiceQueues','length','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','SquareProject','voiceExtensions','initFaxAccounts','faxAccounts','exports','util','lodash','../model/telephone','../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','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x141adc,_0x34b5d1){var _0x118692=function(_0x43361b){while(--_0x43361b){_0x141adc['push'](_0x141adc['shift']());}};_0x118692(++_0x34b5d1);}(_0xb821,0xa7));var _0x1b82=function(_0x47f48e,_0x11d80e){_0x47f48e=_0x47f48e-0x0;var _0x1d6021=_0xb821[_0x47f48e];return _0x1d6021;};'use strict';var BPromise=require('bluebird');var util=require(_0x1b82('0x0'));var _=require(_0x1b82('0x1'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x1b82('0x2'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x1b82('0x3'));var Template=require(_0x1b82('0x4'));var Campaign=require(_0x1b82('0x5'));var VoiceExtension=require(_0x1b82('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x1b82('0x7'));var FreshdeskAccount=require(_0x1b82('0x8'));var SugarcrmAccount=require(_0x1b82('0x9'));var ZohoAccount=require(_0x1b82('0xa'));var DeskAccount=require(_0x1b82('0xb'));var VtigerAccount=require(_0x1b82('0xc'));var ServicenowAccount=require(_0x1b82('0xd'));var Dynamics365Account=require(_0x1b82('0xe'));var FreshsalesAccount=require(_0x1b82('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x1b82('0x10')]={};this[_0x1b82('0x11')]={};this[_0x1b82('0x12')]={};this[_0x1b82('0x13')]={};this[_0x1b82('0x14')]={};this[_0x1b82('0x15')]={};this[_0x1b82('0x16')]={};this[_0x1b82('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1b82('0x18')]={};this[_0x1b82('0x19')]={};this[_0x1b82('0x1a')]={};this[_0x1b82('0x1b')]={};this['settings']={};this[_0x1b82('0x1c')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x1b82('0x1d')]={};this['zohoAccounts']={};this[_0x1b82('0x1e')]={};this[_0x1b82('0x1f')]={};this['servicenowAccounts']={};this[_0x1b82('0x20')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x1b115b,_0x5eb8ed,_0x111247){var _0x25228b=_[_0x1b82('0x21')](_0x1b115b,function(_0x4a09a2,_0x514082){return _0x4a09a2[_0x111247];});for(var _0x415dff in _0x5eb8ed){if(_0x5eb8ed['hasOwnProperty'](_0x415dff)){if(!_0x25228b[_0x415dff]){delete _0x5eb8ed[_0x415dff];}}}}function freeIsNotKeySip(_0x3def2d,_0x1002a1){var _0xb97d42=_['mapKeys'](_0x3def2d,function(_0x352426,_0x2b6ee8){return util[_0x1b82('0x22')](_0x1b82('0x23'),_0x352426[_0x1b82('0x24')]);});for(var _0x47e99b in _0x1002a1){if(_0x1002a1[_0x1b82('0x25')](_0x47e99b)){if(!_0xb97d42[_0x47e99b]){delete _0x1002a1[_0x47e99b];}}}}function freeIsNotKeyAgent(_0x1892b0,_0x39e668){var _0x1d50b6=_[_0x1b82('0x21')](_0x1892b0,function(_0x31fd64,_0x2d07f4){var _0x486e92=_[_0x1b82('0x26')](_0x31fd64[_0x1b82('0x27')])?util['format'](_0x1b82('0x23'),_0x31fd64[_0x1b82('0x24')]):_0x31fd64[_0x1b82('0x27')];return _0x486e92;});for(var _0x4bbbbf in _0x39e668){if(_0x39e668[_0x1b82('0x25')](_0x4bbbbf)){if(!_0x1d50b6[_0x4bbbbf]){delete _0x39e668[_0x4bbbbf];}}}}function clearVoiceCallReports(_0x4db690){_0x4db690['total']=0x0;_0x4db690['answered']=0x0;_0x4db690[_0x1b82('0x28')]=0x0;_0x4db690[_0x1b82('0x29')]=0x0;_0x4db690[_0x1b82('0x2a')]=0x0;}function clearCampaigns(_0x257b79){if(!_['isEmpty'](_0x257b79)){for(var _0x222483 in _0x257b79){if(_0x257b79[_0x1b82('0x25')](_0x222483)){_0x257b79[_0x222483][_0x1b82('0x2b')]=0x0;_0x257b79[_0x222483][_0x1b82('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x2d78b5){if(!_[_0x1b82('0x2d')](_0x2d78b5)){for(var _0x223b6a in _0x2d78b5){if(_0x2d78b5[_0x1b82('0x25')](_0x223b6a)){_0x2d78b5[_0x223b6a][_0x1b82('0x2e')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x2f')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x30')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x31')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x28')]=0x0;_0x2d78b5[_0x223b6a]['sumDuration']=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x2a')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x32')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x33')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x34')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x35')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x36')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x37')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x38')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x39')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x3a')]=0x0;_0x2d78b5[_0x223b6a]['outboundOriginateFailureCallsDay']=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x3b')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x3c')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x32')]=0x0;_0x2d78b5[_0x223b6a][_0x1b82('0x3d')]=0x0;_0x2d78b5[_0x223b6a]['queueStatusComplete']=!![];}}}}Realtime[_0x1b82('0x3e')][_0x1b82('0x3f')]=function(_0x544bd5,_0x355a40){for(var _0x27b8f1 in _0x355a40){if(_0x544bd5[_0x1b82('0x25')](_0x27b8f1)){_0x544bd5[_0x27b8f1]=_0x355a40[_0x27b8f1];}}};Realtime['prototype']['initAgents']=function(){var _0x8e881b=this;return function(_0x4c98e0){if(_0x4c98e0){freeIsNotKeyAgent(_0x4c98e0,_0x8e881b['agents']);for(var _0x417795=0x0,_0x1cd22a={},_0x7fd793={};_0x417795<_0x4c98e0['length'];_0x417795+=0x1){_0x1cd22a=_0x4c98e0[_0x417795];var _0x42a64e=_[_0x1b82('0x26')](_0x1cd22a[_0x1b82('0x27')])?util[_0x1b82('0x22')]('SIP/%s',_0x1cd22a[_0x1b82('0x24')]):_0x1cd22a[_0x1b82('0x27')];if(_[_0x1b82('0x40')](_0x8e881b['agents'][_0x42a64e])){_0x8e881b['agents'][_0x42a64e]=new Agent(_0x1cd22a);}else{_0x8e881b[_0x1b82('0x3f')](_0x8e881b['agents'][_0x42a64e],_0x1cd22a);}}}return _0x8e881b[_0x1b82('0x10')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x41')]=function(){var _0x348880=this;return function(_0x1255db){if(_0x1255db){freeIsNotKeySip(_0x1255db,_0x348880[_0x1b82('0x11')]);for(var _0x39fe4a=0x0,_0x1368df={},_0x47cd9f={};_0x39fe4a<_0x1255db['length'];_0x39fe4a+=0x1){_0x1368df=_0x1255db[_0x39fe4a];if(_[_0x1b82('0x40')](_0x348880['telephones'][util[_0x1b82('0x22')]('SIP/%s',_0x1368df[_0x1b82('0x24')])])){_0x348880[_0x1b82('0x11')][util[_0x1b82('0x22')](_0x1b82('0x23'),_0x1368df[_0x1b82('0x24')])]=new Telephone(_0x1368df);}else{_0x348880[_0x1b82('0x3f')](_0x348880['telephones'][util[_0x1b82('0x22')]('SIP/%s',_0x1368df[_0x1b82('0x24')])],_0x1368df);}}}return _0x348880['telephones'];};};Realtime[_0x1b82('0x3e')]['initTrunks']=function(){var _0x5aeac1=this;return function(_0x1a0ad4){if(_0x1a0ad4){freeIsNotKeySip(_0x1a0ad4,_0x5aeac1[_0x1b82('0x12')]);for(var _0x333d86=0x0,_0x107555={},_0x3eb429={};_0x333d86<_0x1a0ad4['length'];_0x333d86+=0x1){_0x107555=_0x1a0ad4[_0x333d86];if(_[_0x1b82('0x40')](_0x5aeac1['trunks'][util[_0x1b82('0x22')](_0x1b82('0x23'),_0x107555[_0x1b82('0x24')])])){_0x5aeac1[_0x1b82('0x12')][util[_0x1b82('0x22')]('SIP/%s',_0x107555[_0x1b82('0x24')])]=new Trunk(_0x107555);}else{_0x5aeac1['mergeFromDatabase'](_0x5aeac1[_0x1b82('0x12')][util[_0x1b82('0x22')]('SIP/%s',_0x107555[_0x1b82('0x24')])],_0x107555);}}}return _0x5aeac1[_0x1b82('0x12')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x42')]=function(){var _0x39f6ef=this;return function(_0x199213){if(_0x199213){freeIsNotKey(_0x199213,_0x39f6ef[_0x1b82('0x13')],'name');for(var _0xb4ea29=0x0,_0x5868b9={},_0xb02ec3={};_0xb4ea29<_0x199213[_0x1b82('0x43')];_0xb4ea29+=0x1){_0x5868b9=_0x199213[_0xb4ea29];if(_[_0x1b82('0x40')](_0x39f6ef[_0x1b82('0x13')][_0x5868b9[_0x1b82('0x24')]])){_0x39f6ef[_0x1b82('0x13')][_0x5868b9[_0x1b82('0x24')]]=new VoiceQueue(_0x5868b9);}else{_0x39f6ef[_0x1b82('0x3f')](_0x39f6ef[_0x1b82('0x13')][_0x5868b9[_0x1b82('0x24')]],_0x5868b9);}}}return _0x39f6ef[_0x1b82('0x13')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x44')]=function(){var _0x432e84=this;return function(_0x4fb92f){if(_0x4fb92f){freeIsNotKey(_0x4fb92f,_0x432e84['triggers'],'id');for(var _0x1b21f6=0x0,_0x4d5baa={},_0x12d9ac={};_0x1b21f6<_0x4fb92f[_0x1b82('0x43')];_0x1b21f6+=0x1){_0x4d5baa=_0x4fb92f[_0x1b21f6];if(_[_0x1b82('0x40')](_0x432e84['triggers'][_0x4d5baa['id']])){_0x432e84[_0x1b82('0x14')][_0x4d5baa['id']]=new Trigger(_0x4d5baa);}else{_0x432e84['mergeFromDatabase'](_0x432e84['triggers'][_0x4d5baa['id']],_0x4d5baa);}}}return _0x432e84[_0x1b82('0x14')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x45')]=function(){var _0x56b618=this;return function(_0x1e159a){if(_0x1e159a){freeIsNotKey(_0x1e159a,_0x56b618[_0x1b82('0x16')],'id');for(var _0x538692=0x0,_0x5ca898={},_0x106282={};_0x538692<_0x1e159a[_0x1b82('0x43')];_0x538692+=0x1){_0x5ca898=_0x1e159a[_0x538692];if(_[_0x1b82('0x40')](_0x56b618['templates'][_0x5ca898['id']])){_0x56b618[_0x1b82('0x16')][_0x5ca898['id']]=new Template(_0x5ca898);}else{_0x56b618[_0x1b82('0x3f')](_0x56b618[_0x1b82('0x16')][_0x5ca898['id']],_0x5ca898);}}}return _0x56b618[_0x1b82('0x16')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x46')]=function(){var _0x4b6ab3=this;return function(_0x3914aa){if(_0x3914aa){freeIsNotKey(_0x3914aa,_0x4b6ab3['zendeskAccounts'],'id');for(var _0x24eee9=0x0,_0x247cb7={},_0x5d9708={};_0x24eee9<_0x3914aa[_0x1b82('0x43')];_0x24eee9+=0x1){_0x247cb7=_0x3914aa[_0x24eee9];if(_['isUndefined'](_0x4b6ab3[_0x1b82('0x1c')][_0x247cb7['id']])){_0x4b6ab3[_0x1b82('0x1c')][_0x247cb7['id']]=new ZendeskAccount(_0x247cb7);}else{_0x4b6ab3[_0x1b82('0x3f')](_0x4b6ab3[_0x1b82('0x1c')][_0x247cb7['id']],_0x247cb7);}}}return _0x4b6ab3[_0x1b82('0x1c')];};};Realtime[_0x1b82('0x3e')]['initSalesforceAccounts']=function(){var _0x5e8779=this;return function(_0xe2ad3e){if(_0xe2ad3e){freeIsNotKey(_0xe2ad3e,_0x5e8779[_0x1b82('0x47')],'id');for(var _0x1b9e81=0x0,_0x26c1ec={},_0x3db460={};_0x1b9e81<_0xe2ad3e[_0x1b82('0x43')];_0x1b9e81+=0x1){_0x26c1ec=_0xe2ad3e[_0x1b9e81];if(_[_0x1b82('0x40')](_0x5e8779[_0x1b82('0x47')][_0x26c1ec['id']])){_0x5e8779['salesforceAccounts'][_0x26c1ec['id']]=new SalesforceAccount(_0x26c1ec);}else{_0x5e8779['mergeFromDatabase'](_0x5e8779['salesforceAccounts'][_0x26c1ec['id']],_0x26c1ec);}}}return _0x5e8779[_0x1b82('0x47')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x48')]=function(){var _0x27ad80=this;return function(_0x1eb4a4){if(_0x1eb4a4){freeIsNotKey(_0x1eb4a4,_0x27ad80[_0x1b82('0x1d')],'id');for(var _0x32ef12=0x0,_0x53f7a4={},_0x250293={};_0x32ef12<_0x1eb4a4[_0x1b82('0x43')];_0x32ef12+=0x1){_0x53f7a4=_0x1eb4a4[_0x32ef12];if(_[_0x1b82('0x40')](_0x27ad80[_0x1b82('0x1d')][_0x53f7a4['id']])){_0x27ad80[_0x1b82('0x1d')][_0x53f7a4['id']]=new FreshdeskAccount(_0x53f7a4);}else{_0x27ad80[_0x1b82('0x3f')](_0x27ad80[_0x1b82('0x1d')][_0x53f7a4['id']],_0x53f7a4);}}}return _0x27ad80[_0x1b82('0x1d')];};};Realtime['prototype'][_0x1b82('0x49')]=function(){var _0x23e735=this;return function(_0x39be28){if(_0x39be28){freeIsNotKey(_0x39be28,_0x23e735[_0x1b82('0x4a')],'id');for(var _0x2bce47=0x0,_0x4b5dbc={},_0x488aa6={};_0x2bce47<_0x39be28[_0x1b82('0x43')];_0x2bce47+=0x1){_0x4b5dbc=_0x39be28[_0x2bce47];if(_[_0x1b82('0x40')](_0x23e735[_0x1b82('0x4a')][_0x4b5dbc['id']])){_0x23e735[_0x1b82('0x4a')][_0x4b5dbc['id']]=new ZohoAccount(_0x4b5dbc);}else{_0x23e735['mergeFromDatabase'](_0x23e735[_0x1b82('0x4a')][_0x4b5dbc['id']],_0x4b5dbc);}}}return _0x23e735[_0x1b82('0x4a')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x4b')]=function(){var _0x152f84=this;return function(_0x1bffbf){if(_0x1bffbf){freeIsNotKey(_0x1bffbf,_0x152f84[_0x1b82('0x1e')],'id');for(var _0x38e573=0x0,_0x181091={},_0x23a124={};_0x38e573<_0x1bffbf['length'];_0x38e573+=0x1){_0x181091=_0x1bffbf[_0x38e573];if(_[_0x1b82('0x40')](_0x152f84[_0x1b82('0x1e')][_0x181091['id']])){_0x152f84['deskAccounts'][_0x181091['id']]=new DeskAccount(_0x181091);}else{_0x152f84[_0x1b82('0x3f')](_0x152f84[_0x1b82('0x1e')][_0x181091['id']],_0x181091);}}}return _0x152f84[_0x1b82('0x1e')];};};Realtime[_0x1b82('0x3e')]['initSugarcrmAccounts']=function(){var _0x30f13a=this;return function(_0x29bcce){if(_0x29bcce){freeIsNotKey(_0x29bcce,_0x30f13a[_0x1b82('0x4c')],'id');for(var _0x138723=0x0,_0x3c0bef={},_0x3d3292={};_0x138723<_0x29bcce['length'];_0x138723+=0x1){_0x3c0bef=_0x29bcce[_0x138723];if(_[_0x1b82('0x40')](_0x30f13a['sugarcrmAccounts'][_0x3c0bef['id']])){_0x30f13a[_0x1b82('0x4c')][_0x3c0bef['id']]=new SugarcrmAccount(_0x3c0bef);}else{_0x30f13a['mergeFromDatabase'](_0x30f13a[_0x1b82('0x4c')][_0x3c0bef['id']],_0x3c0bef);}}}return _0x30f13a[_0x1b82('0x4c')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x4d')]=function(){var _0x412073=this;return function(_0x282b3c){if(_0x282b3c){freeIsNotKey(_0x282b3c,_0x412073[_0x1b82('0x1f')],'id');for(var _0x50d123=0x0,_0x1fcf19={},_0x21dbf4={};_0x50d123<_0x282b3c[_0x1b82('0x43')];_0x50d123+=0x1){_0x1fcf19=_0x282b3c[_0x50d123];if(_[_0x1b82('0x40')](_0x412073[_0x1b82('0x1f')][_0x1fcf19['id']])){_0x412073[_0x1b82('0x1f')][_0x1fcf19['id']]=new VtigerAccount(_0x1fcf19);}else{_0x412073[_0x1b82('0x3f')](_0x412073[_0x1b82('0x1f')][_0x1fcf19['id']],_0x1fcf19);}}}return _0x412073[_0x1b82('0x1f')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x4e')]=function(){var _0xe31cbc=this;return function(_0x1ef92c){if(_0x1ef92c){freeIsNotKey(_0x1ef92c,_0xe31cbc['servicenowAccounts'],'id');for(var _0x1cf6b5=0x0,_0x147049={},_0x34a231={};_0x1cf6b5<_0x1ef92c['length'];_0x1cf6b5+=0x1){_0x147049=_0x1ef92c[_0x1cf6b5];if(_[_0x1b82('0x40')](_0xe31cbc[_0x1b82('0x4f')][_0x147049['id']])){_0xe31cbc['servicenowAccounts'][_0x147049['id']]=new ServicenowAccount(_0x147049);}else{_0xe31cbc[_0x1b82('0x3f')](_0xe31cbc[_0x1b82('0x4f')][_0x147049['id']],_0x147049);}}}return _0xe31cbc[_0x1b82('0x4f')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x414f1f=this;return function(_0x3b2da4){if(_0x3b2da4){freeIsNotKey(_0x3b2da4,_0x414f1f[_0x1b82('0x20')],'id');for(var _0x3e8db4=0x0,_0x20b178={},_0x5c0b85={};_0x3e8db4<_0x3b2da4[_0x1b82('0x43')];_0x3e8db4+=0x1){_0x20b178=_0x3b2da4[_0x3e8db4];if(_['isUndefined'](_0x414f1f[_0x1b82('0x20')][_0x20b178['id']])){_0x414f1f[_0x1b82('0x20')][_0x20b178['id']]=new Dynamics365Account(_0x20b178);}else{_0x414f1f[_0x1b82('0x3f')](_0x414f1f[_0x1b82('0x20')][_0x20b178['id']],_0x20b178);}}}return _0x414f1f[_0x1b82('0x20')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x50')]=function(){var _0x3b6792=this;return function(_0xf51d19){if(_0xf51d19){freeIsNotKey(_0xf51d19,_0x3b6792[_0x1b82('0x51')],'id');for(var _0x12382b=0x0,_0x5e23ca={},_0x180b05={};_0x12382b<_0xf51d19['length'];_0x12382b+=0x1){_0x5e23ca=_0xf51d19[_0x12382b];if(_['isUndefined'](_0x3b6792[_0x1b82('0x51')][_0x5e23ca['id']])){_0x3b6792[_0x1b82('0x51')][_0x5e23ca['id']]=new FreshsalesAccount(_0x5e23ca);}else{_0x3b6792[_0x1b82('0x3f')](_0x3b6792[_0x1b82('0x51')][_0x5e23ca['id']],_0x5e23ca);}}}return _0x3b6792[_0x1b82('0x51')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x52')]=function(){var _0x68b4fb=this;return function(_0x29814b){for(var _0x34bc74=0x0;_0x34bc74<_0x29814b['length'];_0x34bc74+=0x1){_[_0x1b82('0x53')](_0x68b4fb['voiceQueues'][_0x29814b[_0x34bc74][_0x1b82('0x24')]],_0x29814b[_0x34bc74]);}return _0x68b4fb['voiceQueues'];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x54')]=function(){var _0xe9a367=this;return function(_0x24b328){clearVoiceQueues(_0xe9a367[_0x1b82('0x13')]);if(_0x24b328){_0x24b328=_['groupBy'](_0x24b328,_0x1b82('0x55'));for(var _0x55190b in _0x24b328){if(_0x24b328['hasOwnProperty'](_0x55190b)){var _0x2ae051={};for(var _0x4437af=0x0;_0x4437af<_0x24b328[_0x55190b][_0x1b82('0x43')];_0x4437af+=0x1){var _0x4d986c=_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x56')];if(_0xe9a367['voiceQueues'][_0x4d986c]){if(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x57')]){_0xe9a367['voiceQueues'][_0x4d986c][_0x1b82('0x30')]+=0x1;}if(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x58')]){_0xe9a367[_0x1b82('0x13')][_0x4d986c][_0x1b82('0x31')]+=0x1;}_0xe9a367['voiceQueues'][_0x4d986c][_0x1b82('0x28')]+=moment(_0x24b328[_0x55190b][_0x4437af]['queuecallerleaveAt'])[_0x1b82('0x59')](moment(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5a')]),_0x1b82('0x5b'))||0x0;if(_0x4437af===_0x24b328[_0x55190b][_0x1b82('0x43')]-0x1){_0xe9a367[_0x1b82('0x13')][_0x4d986c]['sumDuration']+=moment(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5c')]||_0x24b328[_0x55190b][_0x4437af]['queuecallerabandonAt']||_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5d')])['diff'](moment(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5a')]),_0x1b82('0x5b'))||0x0;_0xe9a367[_0x1b82('0x13')][_0x4d986c]['total']+=0x1;if(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5e')]){_0xe9a367[_0x1b82('0x13')][_0x4d986c][_0x1b82('0x2f')]+=0x1;_0xe9a367['voiceQueues'][_0x4d986c][_0x1b82('0x2a')]+=moment(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5c')])[_0x1b82('0x59')](moment(_0x24b328[_0x55190b][_0x4437af][_0x1b82('0x5f')]),_0x1b82('0x5b'))||0x0;}}else{_0xe9a367['voiceQueues'][_0x4d986c][_0x1b82('0x29')]+=_0xe9a367['voiceQueues'][_0x4d986c]['sumHoldTime']||0x0;}}}}}}return _0xe9a367[_0x1b82('0x13')];};};Realtime['prototype'][_0x1b82('0x60')]=function(){var _0x6f1c49=this;return function(_0x5f349f){clearVoiceCallReports(_0x6f1c49[_0x1b82('0x17')]);if(_0x5f349f){for(var _0x391207=0x0;_0x391207<_0x5f349f['length'];_0x391207+=0x1){_0x6f1c49['outbound']['total']+=0x1;_0x6f1c49['outbound'][_0x1b82('0x29')]+=_0x5f349f[_0x391207][_0x1b82('0x61')];if(_0x5f349f[_0x391207][_0x1b82('0x62')]==='ANSWERED'){_0x6f1c49[_0x1b82('0x17')]['answered']+=0x1;_0x6f1c49[_0x1b82('0x17')][_0x1b82('0x28')]+=_0x5f349f[_0x391207][_0x1b82('0x61')]-_0x5f349f[_0x391207][_0x1b82('0x63')]||0x0;_0x6f1c49['outbound'][_0x1b82('0x2a')]+=_0x5f349f[_0x391207][_0x1b82('0x63')];}}}return _0x6f1c49[_0x1b82('0x17')];};};Realtime[_0x1b82('0x3e')][_0x1b82('0x64')]=function(){var _0x3a4e7d=this;return function(_0x2dbcdb){if(_0x2dbcdb){freeIsNotKey(_0x2dbcdb,_0x3a4e7d['campaigns'],'name');for(var _0x24df48=0x0,_0x531d3f={};_0x24df48<_0x2dbcdb['length'];_0x24df48+=0x1){_0x531d3f=_0x2dbcdb[_0x24df48];if(_[_0x1b82('0x40')](_0x3a4e7d[_0x1b82('0x15')][_0x531d3f[_0x1b82('0x24')]])){_0x3a4e7d['campaigns'][_0x531d3f[_0x1b82('0x24')]]=new Campaign(_0x531d3f);}else{_0x3a4e7d['mergeFromDatabase'](_0x3a4e7d[_0x1b82('0x15')][_0x531d3f[_0x1b82('0x24')]],_0x531d3f);_0x3a4e7d[_0x1b82('0x15')][_0x531d3f[_0x1b82('0x24')]]['dialQueueProject']=_0x531d3f[_0x1b82('0x65')]?_0x531d3f['SquareProject'][_0x1b82('0x24')]:undefined;}}}return _0x3a4e7d[_0x1b82('0x15')];};};Realtime[_0x1b82('0x3e')]['initVoiceExtensions']=function(){var _0x5b1d77=this;return function(_0x1e47e8){if(_0x1e47e8){freeIsNotKey(_0x1e47e8,_0x5b1d77[_0x1b82('0x66')],'id');for(var _0x40c319=0x0,_0x5ef303={};_0x40c319<_0x1e47e8['length'];_0x40c319+=0x1){_0x5ef303=_0x1e47e8[_0x40c319];if(_[_0x1b82('0x40')](_0x5b1d77[_0x1b82('0x66')][_0x5ef303['id']])){_0x5b1d77[_0x1b82('0x66')][_0x5ef303['id']]=new VoiceExtension(_0x5ef303);}else{_0x5b1d77[_0x1b82('0x3f')](_0x5b1d77['voiceExtensions'][_0x5ef303['id']],_0x5ef303);}}}return _0x5b1d77[_0x1b82('0x66')];};};Realtime[_0x1b82('0x3e')]['initCampaignHopperHistory']=function(){var _0x4b2cb7=this;return function(_0x214d3a){clearCampaigns(_0x4b2cb7[_0x1b82('0x15')]);for(var _0x43d6de=0x0;_0x43d6de<_0x214d3a[_0x1b82('0x43')];_0x43d6de+=0x1){_[_0x1b82('0x53')](_0x4b2cb7[_0x1b82('0x15')][_0x214d3a[_0x43d6de]['name']],_0x214d3a[_0x43d6de]);}return _0x4b2cb7[_0x1b82('0x15')];};};Realtime['prototype'][_0x1b82('0x67')]=function(){var _0x4832a2=this;return function(_0x284457){if(_0x284457){freeIsNotKey(_0x284457,_0x4832a2[_0x1b82('0x68')],'id');for(var _0x565f40=0x0,_0x3dca14={},_0x1baa93={};_0x565f40<_0x284457['length'];_0x565f40+=0x1){_0x3dca14=_0x284457[_0x565f40];if(_[_0x1b82('0x40')](_0x4832a2['faxAccounts'][_0x3dca14['id']])){_0x4832a2[_0x1b82('0x68')][_0x3dca14['id']]=new FaxAccount(_0x3dca14);}else{_0x4832a2['mergeFromDatabase'](_0x4832a2[_0x1b82('0x68')][_0x3dca14['id']],_0x3dca14);}}}return _0x4832a2[_0x1b82('0x68')];};};module[_0x1b82('0x69')]=Realtime; \ No newline at end of file +var _0x9bde=['diff','queuecallercomplete','initVoiceCallReports','duration','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','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','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','telephones','initTrunks','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt'];(function(_0x31b9f5,_0x1376d5){var _0x37dca9=function(_0xfcf142){while(--_0xfcf142){_0x31b9f5['push'](_0x31b9f5['shift']());}};_0x37dca9(++_0x1376d5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4122e7,_0x40cc28){_0x4122e7=_0x4122e7-0x0;var _0x344883=_0x9bde[_0x4122e7];return _0x344883;};'use strict';var BPromise=require('bluebird');var util=require(_0xe9bd('0x0'));var _=require('lodash');var moment=require(_0xe9bd('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe9bd('0x2'));var Trunk=require(_0xe9bd('0x3'));var VoiceQueue=require(_0xe9bd('0x4'));var Trigger=require(_0xe9bd('0x5'));var Template=require(_0xe9bd('0x6'));var Campaign=require(_0xe9bd('0x7'));var VoiceExtension=require(_0xe9bd('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xe9bd('0x9'));var FreshdeskAccount=require(_0xe9bd('0xa'));var SugarcrmAccount=require(_0xe9bd('0xb'));var ZohoAccount=require(_0xe9bd('0xc'));var DeskAccount=require(_0xe9bd('0xd'));var VtigerAccount=require(_0xe9bd('0xe'));var ServicenowAccount=require(_0xe9bd('0xf'));var Dynamics365Account=require(_0xe9bd('0x10'));var FreshsalesAccount=require(_0xe9bd('0x11'));var FaxAccount=require(_0xe9bd('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xe9bd('0x13')]={};this[_0xe9bd('0x14')]={};this[_0xe9bd('0x15')]={};this['campaigns']={};this[_0xe9bd('0x16')]={};this[_0xe9bd('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe9bd('0x18')]={};this[_0xe9bd('0x19')]={};this['queueChannels']={};this[_0xe9bd('0x1a')]={};this['timers']={};this[_0xe9bd('0x1b')]={};this[_0xe9bd('0x1c')]={};this[_0xe9bd('0x1d')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xe9bd('0x1e')]={};this[_0xe9bd('0x1f')]={};this[_0xe9bd('0x20')]={};this[_0xe9bd('0x21')]={};this[_0xe9bd('0x22')]={};this[_0xe9bd('0x23')]={};this[_0xe9bd('0x24')]={};};function freeIsNotKey(_0x573350,_0x1d11a0,_0x464a1b){var _0x160281=_['mapKeys'](_0x573350,function(_0x36f03d,_0x3bae08){return _0x36f03d[_0x464a1b];});for(var _0x34ba2b in _0x1d11a0){if(_0x1d11a0[_0xe9bd('0x25')](_0x34ba2b)){if(!_0x160281[_0x34ba2b]){delete _0x1d11a0[_0x34ba2b];}}}}function freeIsNotKeySip(_0x5cf674,_0x20ec32){var _0x50a5e8=_[_0xe9bd('0x26')](_0x5cf674,function(_0x55b869,_0x26aa4a){return util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x55b869[_0xe9bd('0x29')]);});for(var _0x1acb82 in _0x20ec32){if(_0x20ec32[_0xe9bd('0x25')](_0x1acb82)){if(!_0x50a5e8[_0x1acb82]){delete _0x20ec32[_0x1acb82];}}}}function freeIsNotKeyAgent(_0x6593ce,_0x49165b){var _0x133318=_[_0xe9bd('0x26')](_0x6593ce,function(_0x4ecaf5,_0x37aec1){var _0x505c23=_[_0xe9bd('0x2a')](_0x4ecaf5[_0xe9bd('0x2b')])?util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4ecaf5['name']):_0x4ecaf5[_0xe9bd('0x2b')];return _0x505c23;});for(var _0x1e3cbb in _0x49165b){if(_0x49165b[_0xe9bd('0x25')](_0x1e3cbb)){if(!_0x133318[_0x1e3cbb]){delete _0x49165b[_0x1e3cbb];}}}}function clearVoiceCallReports(_0x39b206){_0x39b206[_0xe9bd('0x2c')]=0x0;_0x39b206[_0xe9bd('0x2d')]=0x0;_0x39b206[_0xe9bd('0x2e')]=0x0;_0x39b206[_0xe9bd('0x2f')]=0x0;_0x39b206[_0xe9bd('0x30')]=0x0;}function clearCampaigns(_0x5987af){if(!_[_0xe9bd('0x31')](_0x5987af)){for(var _0x38fdfa in _0x5987af){if(_0x5987af['hasOwnProperty'](_0x38fdfa)){_0x5987af[_0x38fdfa][_0xe9bd('0x32')]=0x0;_0x5987af[_0x38fdfa][_0xe9bd('0x33')]=0x0;}}}}function clearVoiceQueues(_0x119672){if(!_[_0xe9bd('0x31')](_0x119672)){for(var _0x141b95 in _0x119672){if(_0x119672[_0xe9bd('0x25')](_0x141b95)){_0x119672[_0x141b95]['total']=0x0;_0x119672[_0x141b95]['answered']=0x0;_0x119672[_0x141b95][_0xe9bd('0x34')]=0x0;_0x119672[_0x141b95]['abandoned']=0x0;_0x119672[_0x141b95][_0xe9bd('0x2e')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x2f')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x30')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x35')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x36')]=0x0;_0x119672[_0x141b95]['outboundBusyCallsDay']=0x0;_0x119672[_0x141b95]['outboundCongestionCallsDay']=0x0;_0x119672[_0x141b95][_0xe9bd('0x37')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x38')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x39')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3a')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3b')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3c')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3d')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3e')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x35')]=0x0;_0x119672[_0x141b95]['outboundAnswerCallsDay']=0x0;_0x119672[_0x141b95][_0xe9bd('0x3f')]=!![];}}}}Realtime[_0xe9bd('0x40')][_0xe9bd('0x41')]=function(_0x5117bc,_0x524e08){for(var _0x25eeab in _0x524e08){if(_0x5117bc[_0xe9bd('0x25')](_0x25eeab)){_0x5117bc[_0x25eeab]=_0x524e08[_0x25eeab];}}};Realtime[_0xe9bd('0x40')][_0xe9bd('0x42')]=function(){var _0x1dda43=this;return function(_0x2950e8){if(_0x2950e8){freeIsNotKeyAgent(_0x2950e8,_0x1dda43[_0xe9bd('0x43')]);for(var _0x1c6173=0x0,_0x1a1a29={},_0x32b3e3={};_0x1c6173<_0x2950e8[_0xe9bd('0x44')];_0x1c6173+=0x1){_0x1a1a29=_0x2950e8[_0x1c6173];var _0x549dd1=_[_0xe9bd('0x2a')](_0x1a1a29[_0xe9bd('0x2b')])?util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x1a1a29[_0xe9bd('0x29')]):_0x1a1a29[_0xe9bd('0x2b')];if(_['isUndefined'](_0x1dda43[_0xe9bd('0x43')][_0x549dd1])){_0x1dda43[_0xe9bd('0x43')][_0x549dd1]=new Agent(_0x1a1a29);}else{_0x1dda43['mergeFromDatabase'](_0x1dda43[_0xe9bd('0x43')][_0x549dd1],_0x1a1a29);}}}return _0x1dda43[_0xe9bd('0x43')];};};Realtime['prototype']['initTelephones']=function(){var _0x2785e6=this;return function(_0xdf43b9){if(_0xdf43b9){freeIsNotKeySip(_0xdf43b9,_0x2785e6['telephones']);for(var _0x2d1289=0x0,_0x3ea705={},_0x14927c={};_0x2d1289<_0xdf43b9['length'];_0x2d1289+=0x1){_0x3ea705=_0xdf43b9[_0x2d1289];if(_[_0xe9bd('0x45')](_0x2785e6['telephones'][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])])){_0x2785e6[_0xe9bd('0x46')][util['format'](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])]=new Telephone(_0x3ea705);}else{_0x2785e6[_0xe9bd('0x41')](_0x2785e6[_0xe9bd('0x46')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])],_0x3ea705);}}}return _0x2785e6[_0xe9bd('0x46')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x47')]=function(){var _0x4e8565=this;return function(_0x5e3604){if(_0x5e3604){freeIsNotKeySip(_0x5e3604,_0x4e8565[_0xe9bd('0x13')]);for(var _0x499e13=0x0,_0x4608a0={},_0x340819={};_0x499e13<_0x5e3604[_0xe9bd('0x44')];_0x499e13+=0x1){_0x4608a0=_0x5e3604[_0x499e13];if(_['isUndefined'](_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0['name'])])){_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0[_0xe9bd('0x29')])]=new Trunk(_0x4608a0);}else{_0x4e8565[_0xe9bd('0x41')](_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0[_0xe9bd('0x29')])],_0x4608a0);}}}return _0x4e8565[_0xe9bd('0x13')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x48')]=function(){var _0x2d4e62=this;return function(_0x2a9e09){if(_0x2a9e09){freeIsNotKey(_0x2a9e09,_0x2d4e62[_0xe9bd('0x14')],'name');for(var _0x5a86fd=0x0,_0x283e67={},_0x2ced7c={};_0x5a86fd<_0x2a9e09[_0xe9bd('0x44')];_0x5a86fd+=0x1){_0x283e67=_0x2a9e09[_0x5a86fd];if(_['isUndefined'](_0x2d4e62['voiceQueues'][_0x283e67[_0xe9bd('0x29')]])){_0x2d4e62[_0xe9bd('0x14')][_0x283e67[_0xe9bd('0x29')]]=new VoiceQueue(_0x283e67);}else{_0x2d4e62[_0xe9bd('0x41')](_0x2d4e62[_0xe9bd('0x14')][_0x283e67[_0xe9bd('0x29')]],_0x283e67);}}}return _0x2d4e62[_0xe9bd('0x14')];};};Realtime['prototype'][_0xe9bd('0x49')]=function(){var _0x4cc146=this;return function(_0x36726e){if(_0x36726e){freeIsNotKey(_0x36726e,_0x4cc146[_0xe9bd('0x15')],'id');for(var _0x33ba69=0x0,_0x17dbcd={},_0x74ea23={};_0x33ba69<_0x36726e['length'];_0x33ba69+=0x1){_0x17dbcd=_0x36726e[_0x33ba69];if(_[_0xe9bd('0x45')](_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']])){_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']]=new Trigger(_0x17dbcd);}else{_0x4cc146['mergeFromDatabase'](_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']],_0x17dbcd);}}}return _0x4cc146[_0xe9bd('0x15')];};};Realtime[_0xe9bd('0x40')]['initTemplates']=function(){var _0x28d2ea=this;return function(_0x27e7b0){if(_0x27e7b0){freeIsNotKey(_0x27e7b0,_0x28d2ea[_0xe9bd('0x16')],'id');for(var _0x10ec29=0x0,_0x1ee09c={},_0x579d26={};_0x10ec29<_0x27e7b0[_0xe9bd('0x44')];_0x10ec29+=0x1){_0x1ee09c=_0x27e7b0[_0x10ec29];if(_['isUndefined'](_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']])){_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']]=new Template(_0x1ee09c);}else{_0x28d2ea[_0xe9bd('0x41')](_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']],_0x1ee09c);}}}return _0x28d2ea[_0xe9bd('0x16')];};};Realtime['prototype'][_0xe9bd('0x4a')]=function(){var _0x485e95=this;return function(_0x14eed2){if(_0x14eed2){freeIsNotKey(_0x14eed2,_0x485e95[_0xe9bd('0x1c')],'id');for(var _0x5e08ae=0x0,_0x59d5cb={},_0x1ce539={};_0x5e08ae<_0x14eed2['length'];_0x5e08ae+=0x1){_0x59d5cb=_0x14eed2[_0x5e08ae];if(_[_0xe9bd('0x45')](_0x485e95['zendeskAccounts'][_0x59d5cb['id']])){_0x485e95[_0xe9bd('0x1c')][_0x59d5cb['id']]=new ZendeskAccount(_0x59d5cb);}else{_0x485e95[_0xe9bd('0x41')](_0x485e95['zendeskAccounts'][_0x59d5cb['id']],_0x59d5cb);}}}return _0x485e95[_0xe9bd('0x1c')];};};Realtime['prototype'][_0xe9bd('0x4b')]=function(){var _0x2d9a94=this;return function(_0x321050){if(_0x321050){freeIsNotKey(_0x321050,_0x2d9a94['salesforceAccounts'],'id');for(var _0xa2ef49=0x0,_0x1d703f={},_0x45b69e={};_0xa2ef49<_0x321050[_0xe9bd('0x44')];_0xa2ef49+=0x1){_0x1d703f=_0x321050[_0xa2ef49];if(_['isUndefined'](_0x2d9a94['salesforceAccounts'][_0x1d703f['id']])){_0x2d9a94[_0xe9bd('0x1d')][_0x1d703f['id']]=new SalesforceAccount(_0x1d703f);}else{_0x2d9a94['mergeFromDatabase'](_0x2d9a94[_0xe9bd('0x1d')][_0x1d703f['id']],_0x1d703f);}}}return _0x2d9a94[_0xe9bd('0x1d')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4c')]=function(){var _0x159f68=this;return function(_0x145ea3){if(_0x145ea3){freeIsNotKey(_0x145ea3,_0x159f68[_0xe9bd('0x4d')],'id');for(var _0x3381ee=0x0,_0x46a099={},_0x3be526={};_0x3381ee<_0x145ea3[_0xe9bd('0x44')];_0x3381ee+=0x1){_0x46a099=_0x145ea3[_0x3381ee];if(_[_0xe9bd('0x45')](_0x159f68['freshdeskAccounts'][_0x46a099['id']])){_0x159f68['freshdeskAccounts'][_0x46a099['id']]=new FreshdeskAccount(_0x46a099);}else{_0x159f68['mergeFromDatabase'](_0x159f68[_0xe9bd('0x4d')][_0x46a099['id']],_0x46a099);}}}return _0x159f68['freshdeskAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4e')]=function(){var _0x90db01=this;return function(_0x6232e5){if(_0x6232e5){freeIsNotKey(_0x6232e5,_0x90db01[_0xe9bd('0x1e')],'id');for(var _0xaf6ffd=0x0,_0x3bb2ba={},_0x46797c={};_0xaf6ffd<_0x6232e5[_0xe9bd('0x44')];_0xaf6ffd+=0x1){_0x3bb2ba=_0x6232e5[_0xaf6ffd];if(_['isUndefined'](_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']])){_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']]=new ZohoAccount(_0x3bb2ba);}else{_0x90db01[_0xe9bd('0x41')](_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']],_0x3bb2ba);}}}return _0x90db01['zohoAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4f')]=function(){var _0x34bd38=this;return function(_0x4e05f0){if(_0x4e05f0){freeIsNotKey(_0x4e05f0,_0x34bd38[_0xe9bd('0x1f')],'id');for(var _0x204ea9=0x0,_0x2d724f={},_0xfe82f7={};_0x204ea9<_0x4e05f0['length'];_0x204ea9+=0x1){_0x2d724f=_0x4e05f0[_0x204ea9];if(_['isUndefined'](_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']])){_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']]=new DeskAccount(_0x2d724f);}else{_0x34bd38[_0xe9bd('0x41')](_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']],_0x2d724f);}}}return _0x34bd38['deskAccounts'];};};Realtime['prototype'][_0xe9bd('0x50')]=function(){var _0x20855b=this;return function(_0x3ea0cc){if(_0x3ea0cc){freeIsNotKey(_0x3ea0cc,_0x20855b[_0xe9bd('0x51')],'id');for(var _0x1fd2b5=0x0,_0x23f476={},_0x4870f8={};_0x1fd2b5<_0x3ea0cc[_0xe9bd('0x44')];_0x1fd2b5+=0x1){_0x23f476=_0x3ea0cc[_0x1fd2b5];if(_['isUndefined'](_0x20855b[_0xe9bd('0x51')][_0x23f476['id']])){_0x20855b[_0xe9bd('0x51')][_0x23f476['id']]=new SugarcrmAccount(_0x23f476);}else{_0x20855b[_0xe9bd('0x41')](_0x20855b[_0xe9bd('0x51')][_0x23f476['id']],_0x23f476);}}}return _0x20855b['sugarcrmAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x52')]=function(){var _0x3b0190=this;return function(_0x4f35c4){if(_0x4f35c4){freeIsNotKey(_0x4f35c4,_0x3b0190[_0xe9bd('0x20')],'id');for(var _0x1a9d0c=0x0,_0x396154={},_0x3e3e05={};_0x1a9d0c<_0x4f35c4[_0xe9bd('0x44')];_0x1a9d0c+=0x1){_0x396154=_0x4f35c4[_0x1a9d0c];if(_[_0xe9bd('0x45')](_0x3b0190[_0xe9bd('0x20')][_0x396154['id']])){_0x3b0190[_0xe9bd('0x20')][_0x396154['id']]=new VtigerAccount(_0x396154);}else{_0x3b0190[_0xe9bd('0x41')](_0x3b0190[_0xe9bd('0x20')][_0x396154['id']],_0x396154);}}}return _0x3b0190[_0xe9bd('0x20')];};};Realtime[_0xe9bd('0x40')]['initServicenowAccounts']=function(){var _0x3a12e9=this;return function(_0x9d0603){if(_0x9d0603){freeIsNotKey(_0x9d0603,_0x3a12e9['servicenowAccounts'],'id');for(var _0x2c2d78=0x0,_0xe82570={},_0x59b8be={};_0x2c2d78<_0x9d0603['length'];_0x2c2d78+=0x1){_0xe82570=_0x9d0603[_0x2c2d78];if(_[_0xe9bd('0x45')](_0x3a12e9[_0xe9bd('0x21')][_0xe82570['id']])){_0x3a12e9['servicenowAccounts'][_0xe82570['id']]=new ServicenowAccount(_0xe82570);}else{_0x3a12e9['mergeFromDatabase'](_0x3a12e9['servicenowAccounts'][_0xe82570['id']],_0xe82570);}}}return _0x3a12e9[_0xe9bd('0x21')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x4b5bfb=this;return function(_0x4bcf2b){if(_0x4bcf2b){freeIsNotKey(_0x4bcf2b,_0x4b5bfb[_0xe9bd('0x22')],'id');for(var _0x46da33=0x0,_0x2ed5f2={},_0x4947b0={};_0x46da33<_0x4bcf2b[_0xe9bd('0x44')];_0x46da33+=0x1){_0x2ed5f2=_0x4bcf2b[_0x46da33];if(_[_0xe9bd('0x45')](_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']])){_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']]=new Dynamics365Account(_0x2ed5f2);}else{_0x4b5bfb['mergeFromDatabase'](_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']],_0x2ed5f2);}}}return _0x4b5bfb[_0xe9bd('0x22')];};};Realtime[_0xe9bd('0x40')]['initFreshsalesAccounts']=function(){var _0x5248fd=this;return function(_0x3e68fb){if(_0x3e68fb){freeIsNotKey(_0x3e68fb,_0x5248fd[_0xe9bd('0x23')],'id');for(var _0x1f41fc=0x0,_0x40d9e0={},_0x5bea46={};_0x1f41fc<_0x3e68fb[_0xe9bd('0x44')];_0x1f41fc+=0x1){_0x40d9e0=_0x3e68fb[_0x1f41fc];if(_[_0xe9bd('0x45')](_0x5248fd[_0xe9bd('0x23')][_0x40d9e0['id']])){_0x5248fd['freshsalesAccounts'][_0x40d9e0['id']]=new FreshsalesAccount(_0x40d9e0);}else{_0x5248fd[_0xe9bd('0x41')](_0x5248fd[_0xe9bd('0x23')][_0x40d9e0['id']],_0x40d9e0);}}}return _0x5248fd[_0xe9bd('0x23')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x53')]=function(){var _0x5d7257=this;return function(_0xa13d16){for(var _0x52930c=0x0;_0x52930c<_0xa13d16['length'];_0x52930c+=0x1){_[_0xe9bd('0x54')](_0x5d7257[_0xe9bd('0x14')][_0xa13d16[_0x52930c]['name']],_0xa13d16[_0x52930c]);}return _0x5d7257[_0xe9bd('0x14')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x55')]=function(){var _0x292faf=this;return function(_0x582cf3){clearVoiceQueues(_0x292faf[_0xe9bd('0x14')]);if(_0x582cf3){_0x582cf3=_[_0xe9bd('0x56')](_0x582cf3,'uniqueid');for(var _0x2a014e in _0x582cf3){if(_0x582cf3[_0xe9bd('0x25')](_0x2a014e)){var _0x3ec3e0={};for(var _0x22fd20=0x0;_0x22fd20<_0x582cf3[_0x2a014e][_0xe9bd('0x44')];_0x22fd20+=0x1){var _0x1a36aa=_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x57')];if(_0x292faf['voiceQueues'][_0x1a36aa]){if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x58')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x34')]+=0x1;}if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x59')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x5a')]+=0x1;}_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2e')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5b')])['diff'](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5c')]),_0xe9bd('0x5d'))||0x0;if(_0x22fd20===_0x582cf3[_0x2a014e][_0xe9bd('0x44')]-0x1){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2f')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5e')]||_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5f')]||_0x582cf3[_0x2a014e][_0x22fd20]['queuecallerexitAt'])[_0xe9bd('0x60')](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5c')]),'seconds')||0x0;_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2c')]+=0x1;if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x61')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2d')]+=0x1;_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x30')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20]['queuecallercompleteAt'])['diff'](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5b')]),_0xe9bd('0x5d'))||0x0;}}else{_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2f')]+=_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2e')]||0x0;}}}}}}return _0x292faf[_0xe9bd('0x14')];};};Realtime['prototype'][_0xe9bd('0x62')]=function(){var _0x44f47e=this;return function(_0x29833b){clearVoiceCallReports(_0x44f47e[_0xe9bd('0x17')]);if(_0x29833b){for(var _0x14cdd5=0x0;_0x14cdd5<_0x29833b[_0xe9bd('0x44')];_0x14cdd5+=0x1){_0x44f47e[_0xe9bd('0x17')]['total']+=0x1;_0x44f47e['outbound']['sumDuration']+=_0x29833b[_0x14cdd5][_0xe9bd('0x63')];if(_0x29833b[_0x14cdd5]['disposition']==='ANSWERED'){_0x44f47e['outbound'][_0xe9bd('0x2d')]+=0x1;_0x44f47e[_0xe9bd('0x17')][_0xe9bd('0x2e')]+=_0x29833b[_0x14cdd5][_0xe9bd('0x63')]-_0x29833b[_0x14cdd5][_0xe9bd('0x64')]||0x0;_0x44f47e[_0xe9bd('0x17')][_0xe9bd('0x30')]+=_0x29833b[_0x14cdd5][_0xe9bd('0x64')];}}}return _0x44f47e[_0xe9bd('0x17')];};};Realtime['prototype'][_0xe9bd('0x65')]=function(){var _0x4b79f1=this;return function(_0x22cc79){if(_0x22cc79){freeIsNotKey(_0x22cc79,_0x4b79f1[_0xe9bd('0x66')],_0xe9bd('0x29'));for(var _0x6fff03=0x0,_0x416938={};_0x6fff03<_0x22cc79['length'];_0x6fff03+=0x1){_0x416938=_0x22cc79[_0x6fff03];if(_['isUndefined'](_0x4b79f1['campaigns'][_0x416938[_0xe9bd('0x29')]])){_0x4b79f1[_0xe9bd('0x66')][_0x416938['name']]=new Campaign(_0x416938);}else{_0x4b79f1[_0xe9bd('0x41')](_0x4b79f1[_0xe9bd('0x66')][_0x416938[_0xe9bd('0x29')]],_0x416938);_0x4b79f1[_0xe9bd('0x66')][_0x416938[_0xe9bd('0x29')]]['dialQueueProject']=_0x416938[_0xe9bd('0x67')]?_0x416938[_0xe9bd('0x67')][_0xe9bd('0x29')]:undefined;}}}return _0x4b79f1[_0xe9bd('0x66')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x68')]=function(){var _0x4659f3=this;return function(_0x1ad344){if(_0x1ad344){freeIsNotKey(_0x1ad344,_0x4659f3[_0xe9bd('0x18')],'id');for(var _0x440b2d=0x0,_0x5f24c8={};_0x440b2d<_0x1ad344['length'];_0x440b2d+=0x1){_0x5f24c8=_0x1ad344[_0x440b2d];if(_['isUndefined'](_0x4659f3['voiceExtensions'][_0x5f24c8['id']])){_0x4659f3[_0xe9bd('0x18')][_0x5f24c8['id']]=new VoiceExtension(_0x5f24c8);}else{_0x4659f3[_0xe9bd('0x41')](_0x4659f3[_0xe9bd('0x18')][_0x5f24c8['id']],_0x5f24c8);}}}return _0x4659f3['voiceExtensions'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x69')]=function(){var _0x5040a7=this;return function(_0x55b5a5){clearCampaigns(_0x5040a7[_0xe9bd('0x66')]);for(var _0x1250e4=0x0;_0x1250e4<_0x55b5a5[_0xe9bd('0x44')];_0x1250e4+=0x1){_[_0xe9bd('0x54')](_0x5040a7[_0xe9bd('0x66')][_0x55b5a5[_0x1250e4]['name']],_0x55b5a5[_0x1250e4]);}return _0x5040a7['campaigns'];};};Realtime['prototype'][_0xe9bd('0x6a')]=function(){var _0x2c7a14=this;return function(_0x448f82){if(_0x448f82){freeIsNotKey(_0x448f82,_0x2c7a14[_0xe9bd('0x24')],'id');for(var _0x1880e7=0x0,_0x351226={},_0x475cb9={};_0x1880e7<_0x448f82[_0xe9bd('0x44')];_0x1880e7+=0x1){_0x351226=_0x448f82[_0x1880e7];if(_[_0xe9bd('0x45')](_0x2c7a14[_0xe9bd('0x24')][_0x351226['id']])){_0x2c7a14['faxAccounts'][_0x351226['id']]=new FaxAccount(_0x351226);}else{_0x2c7a14[_0xe9bd('0x41')](_0x2c7a14['faxAccounts'][_0x351226['id']],_0x351226);}}}return _0x2c7a14[_0xe9bd('0x24')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b2e8498..f642752 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 _0x5d74=['callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','attendedTransfer','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport','length','findAgent','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5d74,0x7b));var _0x45d7=function(_0x5a37e1,_0x3f0344){_0x5a37e1=_0x5a37e1-0x0;var _0x248b3b=_0x5d74[_0x5a37e1];return _0x248b3b;};'use strict';var _=require(_0x45d7('0x0'));var moment=require('moment');var util=require(_0x45d7('0x1'));var config=require(_0x45d7('0x2'));var ami=require(_0x45d7('0x3'));var RpcVoiceAgentReport=require(_0x45d7('0x4'));var RpcVoiceCallReport=require(_0x45d7('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x45d7('0x6'));var RpcVoiceQueueReport=require(_0x45d7('0x7'));var RpcVoiceRecording=require(_0x45d7('0x8'));var RpcVoiceTransferReport=require(_0x45d7('0x9'));var VoiceQueueReport=require(_0x45d7('0xa'));var VoiceCallReport=require(_0x45d7('0xb'));var VoiceAgentReport=require(_0x45d7('0xc'));var VoiceDialReport=require(_0x45d7('0xd'));var UserReport=require(_0x45d7('0xe'));function Report(_0x1bf925){this[_0x45d7('0xf')]=_0x1bf925;this[_0x45d7('0x10')]=_0x1bf925[_0x45d7('0x10')];this[_0x45d7('0x11')]=_0x1bf925[_0x45d7('0x11')];}Report['prototype'][_0x45d7('0x12')]=function(_0xe56338){var _0x31d42b=new VoiceQueueReport(this['realtime']);var _0x459eeb=new VoiceAgentReport(this[_0x45d7('0xf')]);var _0x314c0a=new VoiceDialReport(this[_0x45d7('0xf')]);var _0x24f2be=new VoiceCallReport(this[_0x45d7('0xf')]);var _0x3356a0=new UserReport(this[_0x45d7('0xf')]);if(config[_0x45d7('0x13')]&&config[_0x45d7('0x13')]['disabled']){ami['on'](_0x45d7('0x14'),this['voiceQueueReport'][_0x45d7('0x15')](this));ami['on'](_0x45d7('0x16'),this[_0x45d7('0x17')][_0x45d7('0x15')](this));ami['on'](_0x45d7('0x18'),this['voiceAgentReport']['bind'](this));ami['on'](_0x45d7('0x19'),this[_0x45d7('0x1a')][_0x45d7('0x15')](this));ami['on'](_0x45d7('0x1b'),this[_0x45d7('0x1c')][_0x45d7('0x15')](this));ami['on'](_0x45d7('0x1d'),this['attendedTransfer'][_0x45d7('0x15')](this));}};Report[_0x45d7('0x1e')]['findAgent']=function(_0x62d6c3){var _0x2b4c99;_0x2b4c99=_[_0x45d7('0x1f')](this[_0x45d7('0x10')],function(_0x302228){return _0x302228[_0x45d7('0x20')]==_0x62d6c3||_0x302228[_0x45d7('0x21')]==_0x62d6c3;});if(_[_0x45d7('0x22')](_0x2b4c99)){var _0x467a9c=_[_0x45d7('0x1f')](this[_0x45d7('0x11')],function(_0x44c33f){return _0x44c33f[_0x45d7('0x20')]==_0x62d6c3||_0x44c33f[_0x45d7('0x21')]==_0x62d6c3;});if(_0x467a9c){_0x2b4c99=_[_0x45d7('0x1f')](this['agents'],function(_0x426330){return _0x426330[_0x45d7('0x23')]==util['format'](_0x45d7('0x24'),_0x467a9c[_0x45d7('0x21')]);});}}return _0x2b4c99;};Report[_0x45d7('0x1e')][_0x45d7('0x25')]=function(_0x575b17){for(var _0x376e86=0x0;_0x376e86<_0x575b17[_0x45d7('0x26')];_0x376e86+=0x1){var _0x7d73f3=this[_0x45d7('0x27')](_0x575b17[_0x376e86][_0x45d7('0x28')]);if(_0x7d73f3){_0x575b17[_0x376e86]['accountcode']=_0x7d73f3[_0x45d7('0x20')];_0x575b17[_0x376e86][_0x45d7('0x29')]=!![];_0x575b17[_0x376e86]['lastAssignedTo']=_0x7d73f3[_0x45d7('0x21')];_0x575b17[_0x376e86][_0x45d7('0x23')]=_['isNil'](_0x7d73f3[_0x45d7('0x23')])?util[_0x45d7('0x2a')](_0x45d7('0x24'),_0x7d73f3[_0x45d7('0x21')]):_0x7d73f3['interface'];if(_0x575b17[_0x376e86][_0x45d7('0x2b')]){_0x575b17[_0x376e86][_0x45d7('0x2c')]=moment()[_0x45d7('0x2a')](_0x45d7('0x2d'));}if(_0x575b17[_0x376e86][_0x45d7('0x2e')]){_0x575b17[_0x376e86][_0x45d7('0x2f')]=moment()[_0x45d7('0x2a')](_0x45d7('0x2d'));}RpcMemberReport[_0x45d7('0x25')](_0x575b17[_0x376e86]);}RpcVoiceQueueReport['create'](_0x575b17[_0x376e86]);}};function extractCalleridNumber(_0x2d023c){var _0x30aa88=_0x2d023c['match'](/<(.*?)>/);return _0x30aa88?_0x30aa88[0x1]:_0x2d023c;}Report[_0x45d7('0x1e')]['voiceCallReport']=function(_0x12b312){_0x12b312[_0x45d7('0x30')]=_0x12b312[_0x45d7('0x30')]||_0x12b312[_0x45d7('0x31')];if(_0x12b312[_0x45d7('0x32')]==_0x45d7('0x33')){_0x12b312[_0x45d7('0x34')]=_0x45d7('0x35');_0x12b312[_0x45d7('0x36')]=_0x12b312[_0x45d7('0x35')];if(_0x12b312[_0x45d7('0x37')]==_0x45d7('0x38')){_0x12b312['accountcode']='';_0x12b312[_0x45d7('0x30')]=extractCalleridNumber(_0x12b312[_0x45d7('0x39')]);}else if(_0x12b312['context']=='from-sip'){if(_0x12b312[_0x45d7('0x30')]==_0x45d7('0x3a')){_0x12b312[_0x45d7('0x30')]=extractCalleridNumber(_0x12b312[_0x45d7('0x3b')]);_0x12b312[_0x45d7('0x3c')]=_0x12b312['originatecalleridnum'];_0x12b312['destinationchannel']=[_0x12b312['channel'],_0x12b312[_0x45d7('0x3d')]=_0x12b312[_0x45d7('0x3e')]][0x0];_0x12b312[_0x45d7('0x39')]=_0x12b312['calleridpreview'];}else{_0x12b312[_0x45d7('0x30')]=_0x12b312['calleridnum'];_0x12b312[_0x45d7('0x3c')]=_0x12b312['originatecalleridnum'];if(_0x12b312['disposition']==_0x45d7('0x3f')){_0x12b312[_0x45d7('0x20')]=_0x12b312[_0x45d7('0x28')];}else{_0x12b312[_0x45d7('0x20')]='';}}}}else{_0x12b312[_0x45d7('0x39')]=util[_0x45d7('0x2a')](_0x45d7('0x40'),_0x12b312[_0x45d7('0x41')],_0x12b312[_0x45d7('0x3c')]);}if(RpcVoiceTransferReport[_0x45d7('0x42')][_0x12b312[_0x45d7('0x43')]]){var _0x2e8508=RpcVoiceTransferReport['transfers'][_0x12b312[_0x45d7('0x43')]];_0x2e8508[_0x45d7('0x44')]=_0x12b312[_0x45d7('0x45')];RpcVoiceTransferReport[_0x45d7('0x1c')](_0x2e8508);delete RpcVoiceTransferReport['transfers'][_0x12b312[_0x45d7('0x43')]];}RpcVoiceCallReport[_0x45d7('0x46')](_0x12b312);if(_0x12b312[_0x45d7('0x47')]){for(var _0x428489=0x0;_0x428489<_0x12b312[_0x45d7('0x48')]['length'];_0x428489+=0x1){_0x12b312[_0x45d7('0x49')]=_0x12b312[_0x45d7('0x48')][_0x428489][_0x45d7('0x4a')];_0x12b312[_0x45d7('0x4b')]=_0x12b312[_0x45d7('0x48')][_0x428489][_0x45d7('0x4b')];if(_0x12b312['exten']==_0x45d7('0x3a')){_0x12b312[_0x45d7('0x3c')]=_0x12b312[_0x45d7('0x28')];_0x12b312[_0x45d7('0x41')]=_0x12b312[_0x45d7('0x4c')];_0x12b312[_0x45d7('0x28')]=_0x12b312[_0x45d7('0x20')];_0x12b312['connectedlinename']=_0x12b312[_0x45d7('0x4d')];_0x12b312['exten']=_0x12b312[_0x45d7('0x4e')];}else if(_0x12b312[_0x45d7('0x31')]==_0x45d7('0x4f')){_0x12b312[_0x45d7('0x3c')]=_0x12b312[_0x45d7('0x30')];_0x12b312[_0x45d7('0x31')]=_0x12b312['originatecalleridnum'];}RpcVoiceRecording[_0x45d7('0x46')](_0x12b312);}}};Report[_0x45d7('0x1e')][_0x45d7('0x50')]=function(_0x468eb){if(_[_0x45d7('0x51')](_0x468eb)){_0x468eb[_0x45d7('0x52')](function(_0x6f65b8){RpcVoiceAgentReport['create'](_0x6f65b8);});}else{RpcVoiceAgentReport[_0x45d7('0x46')](_0x468eb);}};Report[_0x45d7('0x1e')][_0x45d7('0x1a')]=function(_0xdb51dc){RpcVoiceDialReport[_0x45d7('0x46')](_0xdb51dc);var _0x1004f0;var _0x495a7b;var _0x4d3c41=_0xdb51dc['channel'];if(_[_0x45d7('0x53')](_0x4d3c41,_0x45d7('0x54'))){_0x495a7b=_0x4d3c41[_0x45d7('0x55')](_0x4d3c41[_0x45d7('0x56')]('/')+0x1,_0x4d3c41[_0x45d7('0x56')]('@'));_0x1004f0=_[_0x45d7('0x1f')](this[_0x45d7('0x10')],function(_0x546906){return _0x546906[_0x45d7('0x57')]==_0x495a7b||_0x546906['phone']==_0x495a7b||_0x546906[_0x45d7('0x20')]==_0x495a7b;});}else{_0x495a7b=_0x4d3c41[_0x45d7('0x55')](_0x4d3c41[_0x45d7('0x56')]('/')+0x1,_0x4d3c41[_0x45d7('0x58')]('-'));_0x1004f0=this[_0x45d7('0x27')](_0x495a7b);}if(_0x1004f0){_0xdb51dc[_0x45d7('0x23')]=_[_0x45d7('0x22')](_0x1004f0[_0x45d7('0x23')])?util[_0x45d7('0x2a')]('SIP/%s',_0x1004f0['name']):_0x1004f0['interface'];_0xdb51dc[_0x45d7('0x4d')]=_0x1004f0[_0x45d7('0x21')];_0xdb51dc[_0x45d7('0x20')]=_0x1004f0[_0x45d7('0x20')];RpcMemberReport[_0x45d7('0x1a')](_0xdb51dc);}};Report[_0x45d7('0x1e')][_0x45d7('0x1c')]=function(_0x144b2d){RpcVoiceTransferReport['transfers'][_0x144b2d['transfererlinkedid']]=_0x144b2d;};Report['prototype'][_0x45d7('0x59')]=function(_0x52cda2){RpcVoiceTransferReport[_0x45d7('0x59')](_0x52cda2);};module['exports']=Report; \ No newline at end of file +var _0x9c76=['monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','phone','membername','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','exten','type','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','calleridname','transfers','linkedid','uniqueid','monitor'];(function(_0x301572,_0x473d67){var _0x122089=function(_0x70281f){while(--_0x70281f){_0x301572['push'](_0x301572['shift']());}};_0x122089(++_0x473d67);}(_0x9c76,0x1bd));var _0x69c7=function(_0x2b7218,_0x27521a){_0x2b7218=_0x2b7218-0x0;var _0x31ad52=_0x9c76[_0x2b7218];return _0x31ad52;};'use strict';var _=require(_0x69c7('0x0'));var moment=require(_0x69c7('0x1'));var util=require(_0x69c7('0x2'));var config=require(_0x69c7('0x3'));var ami=require(_0x69c7('0x4'));var RpcVoiceAgentReport=require(_0x69c7('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x69c7('0x6'));var RpcMemberReport=require(_0x69c7('0x7'));var RpcVoiceQueueReport=require(_0x69c7('0x8'));var RpcVoiceRecording=require(_0x69c7('0x9'));var RpcVoiceTransferReport=require(_0x69c7('0xa'));var VoiceQueueReport=require(_0x69c7('0xb'));var VoiceCallReport=require(_0x69c7('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x69c7('0xd'));function Report(_0x3262ff){this['realtime']=_0x3262ff;this[_0x69c7('0xe')]=_0x3262ff[_0x69c7('0xe')];this[_0x69c7('0xf')]=_0x3262ff[_0x69c7('0xf')];}Report['prototype']['sync']=function(_0x322c73){var _0xed2dd9=new VoiceQueueReport(this[_0x69c7('0x10')]);var _0x37f40d=new VoiceAgentReport(this[_0x69c7('0x10')]);var _0x57c29f=new VoiceDialReport(this['realtime']);var _0x30ef44=new VoiceCallReport(this[_0x69c7('0x10')]);var _0x227188=new UserReport(this['realtime']);if(config[_0x69c7('0x11')]&&config[_0x69c7('0x11')][_0x69c7('0x12')]){ami['on'](_0x69c7('0x13'),this[_0x69c7('0x14')][_0x69c7('0x15')](this));ami['on'](_0x69c7('0x16'),this[_0x69c7('0x17')][_0x69c7('0x15')](this));ami['on'](_0x69c7('0x18'),this[_0x69c7('0x19')][_0x69c7('0x15')](this));ami['on'](_0x69c7('0x1a'),this[_0x69c7('0x1b')]['bind'](this));ami['on'](_0x69c7('0x1c'),this[_0x69c7('0x1d')][_0x69c7('0x15')](this));ami['on'](_0x69c7('0x1e'),this['attendedTransfer']['bind'](this));}};Report[_0x69c7('0x1f')][_0x69c7('0x20')]=function(_0x5aecf0){var _0x5d48ae;_0x5d48ae=_[_0x69c7('0x21')](this[_0x69c7('0xe')],function(_0x3915e3){return _0x3915e3[_0x69c7('0x22')]==_0x5aecf0||_0x3915e3['name']==_0x5aecf0;});if(_['isNil'](_0x5d48ae)){var _0x3865b0=_[_0x69c7('0x21')](this[_0x69c7('0xf')],function(_0x570bb9){return _0x570bb9[_0x69c7('0x22')]==_0x5aecf0||_0x570bb9[_0x69c7('0x23')]==_0x5aecf0;});if(_0x3865b0){_0x5d48ae=_[_0x69c7('0x21')](this['agents'],function(_0x165f3b){return _0x165f3b['interface']==util[_0x69c7('0x24')](_0x69c7('0x25'),_0x3865b0[_0x69c7('0x23')]);});}}return _0x5d48ae;};Report['prototype'][_0x69c7('0x14')]=function(_0x3fd454){for(var _0xff7cf6=0x0;_0xff7cf6<_0x3fd454[_0x69c7('0x26')];_0xff7cf6+=0x1){var _0x349f3a=this[_0x69c7('0x20')](_0x3fd454[_0xff7cf6][_0x69c7('0x27')]);if(_0x349f3a){_0x3fd454[_0xff7cf6]['accountcode']=_0x349f3a[_0x69c7('0x22')];_0x3fd454[_0xff7cf6][_0x69c7('0x28')]=!![];_0x3fd454[_0xff7cf6][_0x69c7('0x29')]=_0x349f3a[_0x69c7('0x23')];_0x3fd454[_0xff7cf6][_0x69c7('0x2a')]=_[_0x69c7('0x2b')](_0x349f3a[_0x69c7('0x2a')])?util['format']('SIP/%s',_0x349f3a[_0x69c7('0x23')]):_0x349f3a['interface'];if(_0x3fd454[_0xff7cf6][_0x69c7('0x2c')]){_0x3fd454[_0xff7cf6][_0x69c7('0x2d')]=moment()[_0x69c7('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3fd454[_0xff7cf6]['queuecallerexit']){_0x3fd454[_0xff7cf6][_0x69c7('0x2e')]=moment()['format'](_0x69c7('0x2f'));}RpcMemberReport[_0x69c7('0x14')](_0x3fd454[_0xff7cf6]);}RpcVoiceQueueReport[_0x69c7('0x30')](_0x3fd454[_0xff7cf6]);}};function extractCalleridNumber(_0x5e5579){var _0x56c058=_0x5e5579['match'](/<(.*?)>/);return _0x56c058?_0x56c058[0x1]:_0x5e5579;}Report[_0x69c7('0x1f')][_0x69c7('0x17')]=function(_0x6a3264){_0x6a3264[_0x69c7('0x31')]=_0x6a3264[_0x69c7('0x31')]||_0x6a3264[_0x69c7('0x32')];if(_0x6a3264[_0x69c7('0x33')]=='dialer'){_0x6a3264[_0x69c7('0x34')]='queue';_0x6a3264[_0x69c7('0x35')]=_0x6a3264[_0x69c7('0x36')];if(_0x6a3264['context']==_0x69c7('0x37')){_0x6a3264['accountcode']='';_0x6a3264['destination']=extractCalleridNumber(_0x6a3264[_0x69c7('0x38')]);}else if(_0x6a3264[_0x69c7('0x39')]==_0x69c7('0x3a')){if(_0x6a3264[_0x69c7('0x31')]==_0x69c7('0x3b')){_0x6a3264[_0x69c7('0x31')]=extractCalleridNumber(_0x6a3264[_0x69c7('0x3c')]);_0x6a3264[_0x69c7('0x3d')]=_0x6a3264[_0x69c7('0x3e')];_0x6a3264['destinationchannel']=[_0x6a3264[_0x69c7('0x3f')],_0x6a3264[_0x69c7('0x3f')]=_0x6a3264[_0x69c7('0x40')]][0x0];_0x6a3264[_0x69c7('0x38')]=_0x6a3264[_0x69c7('0x3c')];}else{_0x6a3264[_0x69c7('0x31')]=_0x6a3264[_0x69c7('0x3d')];_0x6a3264[_0x69c7('0x3d')]=_0x6a3264[_0x69c7('0x3e')];if(_0x6a3264[_0x69c7('0x41')]=='ANSWERED'){_0x6a3264[_0x69c7('0x22')]=_0x6a3264['connectedlinenum'];}else{_0x6a3264[_0x69c7('0x22')]='';}}}}else{_0x6a3264[_0x69c7('0x38')]=util[_0x69c7('0x24')]('\x22%s\x22\x20<%s>',_0x6a3264[_0x69c7('0x42')],_0x6a3264['calleridnum']);}if(RpcVoiceTransferReport[_0x69c7('0x43')][_0x6a3264[_0x69c7('0x44')]]){var _0x47c2e5=RpcVoiceTransferReport['transfers'][_0x6a3264['linkedid']];_0x47c2e5['transfereelinkedid']=_0x6a3264[_0x69c7('0x45')];RpcVoiceTransferReport[_0x69c7('0x1d')](_0x47c2e5);delete RpcVoiceTransferReport[_0x69c7('0x43')][_0x6a3264[_0x69c7('0x44')]];}RpcVoiceCallReport[_0x69c7('0x30')](_0x6a3264);if(_0x6a3264[_0x69c7('0x46')]){for(var _0x59e8e1=0x0;_0x59e8e1<_0x6a3264[_0x69c7('0x47')][_0x69c7('0x26')];_0x59e8e1+=0x1){_0x6a3264['monitorFilename']=_0x6a3264[_0x69c7('0x47')][_0x59e8e1][_0x69c7('0x48')];_0x6a3264[_0x69c7('0x49')]=_0x6a3264[_0x69c7('0x47')][_0x59e8e1]['createdAt'];if(_0x6a3264[_0x69c7('0x32')]==_0x69c7('0x3b')){_0x6a3264[_0x69c7('0x3d')]=_0x6a3264[_0x69c7('0x27')];_0x6a3264[_0x69c7('0x42')]=_0x6a3264[_0x69c7('0x4a')];_0x6a3264[_0x69c7('0x27')]=_0x6a3264[_0x69c7('0x22')];_0x6a3264['connectedlinename']=_0x6a3264['membername'];_0x6a3264[_0x69c7('0x32')]=_0x6a3264['originatecalleridnum'];}else if(_0x6a3264['exten']==_0x69c7('0x4b')){_0x6a3264['calleridnum']=_0x6a3264[_0x69c7('0x31')];_0x6a3264[_0x69c7('0x32')]=_0x6a3264[_0x69c7('0x3e')];}RpcVoiceRecording[_0x69c7('0x30')](_0x6a3264);}}};Report['prototype'][_0x69c7('0x19')]=function(_0x4679ee){if(_[_0x69c7('0x4c')](_0x4679ee)){_0x4679ee[_0x69c7('0x4d')](function(_0x1c0d6b){RpcVoiceAgentReport[_0x69c7('0x30')](_0x1c0d6b);});}else{RpcVoiceAgentReport[_0x69c7('0x30')](_0x4679ee);}};Report[_0x69c7('0x1f')][_0x69c7('0x1b')]=function(_0x5e3d5d){RpcVoiceDialReport[_0x69c7('0x30')](_0x5e3d5d);var _0x1a3e9b;var _0x2b9a07;var _0x47390b=_0x5e3d5d[_0x69c7('0x3f')];if(_[_0x69c7('0x4e')](_0x47390b,'Local')){_0x2b9a07=_0x47390b[_0x69c7('0x4f')](_0x47390b[_0x69c7('0x50')]('/')+0x1,_0x47390b[_0x69c7('0x50')]('@'));_0x1a3e9b=_[_0x69c7('0x21')](this[_0x69c7('0xe')],function(_0x3ed68a){return _0x3ed68a['mobile']==_0x2b9a07||_0x3ed68a[_0x69c7('0x51')]==_0x2b9a07||_0x3ed68a['accountcode']==_0x2b9a07;});}else{_0x2b9a07=_0x47390b[_0x69c7('0x4f')](_0x47390b[_0x69c7('0x50')]('/')+0x1,_0x47390b['lastIndexOf']('-'));_0x1a3e9b=this[_0x69c7('0x20')](_0x2b9a07);}if(_0x1a3e9b){_0x5e3d5d[_0x69c7('0x2a')]=_[_0x69c7('0x2b')](_0x1a3e9b[_0x69c7('0x2a')])?util['format'](_0x69c7('0x25'),_0x1a3e9b[_0x69c7('0x23')]):_0x1a3e9b[_0x69c7('0x2a')];_0x5e3d5d[_0x69c7('0x52')]=_0x1a3e9b['name'];_0x5e3d5d[_0x69c7('0x22')]=_0x1a3e9b[_0x69c7('0x22')];RpcMemberReport[_0x69c7('0x1b')](_0x5e3d5d);}};Report['prototype'][_0x69c7('0x1d')]=function(_0xe31e8f){RpcVoiceTransferReport[_0x69c7('0x43')][_0xe31e8f[_0x69c7('0x53')]]=_0xe31e8f;};Report[_0x69c7('0x1f')][_0x69c7('0x54')]=function(_0x21ad13){RpcVoiceTransferReport[_0x69c7('0x54')](_0x21ad13);};module[_0x69c7('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 1c41448..4574c8f 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 _0x463e=['device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','registered','status','address','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','omit','actionid','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x4a23a9,_0x17a2c0){var _0x18c27f=function(_0x3414e3){while(--_0x3414e3){_0x4a23a9['push'](_0x4a23a9['shift']());}};_0x18c27f(++_0x17a2c0);}(_0x463e,0x13f));var _0xe463=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x463e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe463('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xe463('0x1'));var BPromise=require('bluebird');var config=require(_0xe463('0x2'));var logger=require(_0xe463('0x3'))('ami');var ami=require(_0xe463('0x4'));config[_0xe463('0x5')]=_[_0xe463('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe463('0x7'))(new Redis(config[_0xe463('0x5')]));function UserReport(_0x104a08){this[_0xe463('0x8')]=_0x104a08[_0xe463('0x8')];this[_0xe463('0x9')]=_0x104a08['agents'];this[_0xe463('0xa')]=_0x104a08['telephones'];ami['on'](_0xe463('0xb'),this[_0xe463('0xc')][_0xe463('0xd')](this));ami['on'](_0xe463('0xe'),this[_0xe463('0xc')][_0xe463('0xd')](this));ami['on'](_0xe463('0xf'),this['syncDeviceState']['bind'](this));ami['on'](_0xe463('0x10'),this[_0xe463('0x11')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xe463('0x12')]()[_0xe463('0x13')](ami[_0xe463('0x14')]())[_0xe463('0x15')](function(_0x232033){logger[_0xe463('0x16')]('[userReport][sipshowregistry]',util[_0xe463('0x17')](_0x232033,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe463('0x12')]()['then'](ami[_0xe463('0x18')]())[_0xe463('0x15')](function(_0x1fef07){logger[_0xe463('0x16')]('[userReport][devicestatelist]',util[_0xe463('0x17')](_0x1fef07,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe463('0x12')]()[_0xe463('0x13')](ami[_0xe463('0x19')]())['catch'](function(_0x454c4d){logger[_0xe463('0x16')](_0xe463('0x1a'),util[_0xe463('0x17')](_0x454c4d,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xe463('0x1b')]=function(){setInterval(function(){BPromise[_0xe463('0x12')]()[_0xe463('0x13')](showSipRegistrations())[_0xe463('0x13')](listDeviceStates())[_0xe463('0x13')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x263376){return _0x263376!==null&&!_['isUndefined'](_0x263376);};UserReport[_0xe463('0x1c')][_0xe463('0x1d')]=function(_0x5bad77,_0x4b9fe8,_0x3b5bda){io['to'](_0x5bad77)[_0xe463('0x1d')](_0x4b9fe8,_0x3b5bda);};UserReport[_0xe463('0x1c')][_0xe463('0xc')]=function(_0x5be8c7){try{if(this[_0xe463('0x1e')](_0x5be8c7)){logger[_0xe463('0x1f')](_0xe463('0x20'),_0x5be8c7[_0xe463('0x21')],_0x5be8c7[_0xe463('0x22')]);logger[_0xe463('0x23')](_0xe463('0x24'),util[_0xe463('0x17')](_0x5be8c7,{'showHidden':![],'depth':null}));var _0x357a66=_[_0xe463('0x25')](this['trunks'],{'registry':_0x5be8c7[_0xe463('0x21')]});if(_0x357a66){_0x5be8c7['stateRegistry']=_0x5be8c7[_0xe463('0x22')];_[_0xe463('0x26')](_0x357a66,_[_0xe463('0x27')](_0x5be8c7,['event',_0xe463('0x28'),_0xe463('0x21'),_0xe463('0x22')]));logger[_0xe463('0x23')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xe463('0x17')](_0x357a66,{'showHidden':![],'depth':null}));this[_0xe463('0x1d')](util['format'](_0xe463('0x29'),_0x357a66[_0xe463('0x2a')]),_0xe463('0x2b'),_0x357a66);}}}catch(_0x1c5bde){logger[_0xe463('0x16')]('[userReport][registry]',util['inspect'](_0x1c5bde,{'showHidden':![],'depth':null}));}};UserReport[_0xe463('0x1c')][_0xe463('0x2c')]=function(_0x65785a){try{if(this[_0xe463('0x1e')](_0x65785a)){logger[_0xe463('0x1f')](_0xe463('0x2d'),_0x65785a[_0xe463('0x2e')],_0x65785a['state']);logger['debug'](_0xe463('0x2f'),util[_0xe463('0x17')](_0x65785a,{'showHidden':![],'depth':null}));if(this['agents'][_0x65785a['device']]){if(!this[_0xe463('0x9')][_0x65785a['device']][_0xe463('0x30')]||_0x65785a['state'][_0xe463('0x31')]()==_0xe463('0x32')){this[_0xe463('0x9')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x30')]=![];if(this[_0xe463('0x9')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x22')]!==_0x65785a['state'][_0xe463('0x31')]()){this['agents'][_0x65785a[_0xe463('0x2e')]][_0xe463('0x33')]=_[_0xe463('0x34')](moment()[_0xe463('0x35')]('x'));}this[_0xe463('0x9')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x22')]=_0x65785a[_0xe463('0x22')][_0xe463('0x31')]();this['agents'][_0x65785a[_0xe463('0x2e')]]['updateStatusRealtime'](_0x65785a);}}else if(this[_0xe463('0xa')][_0x65785a[_0xe463('0x2e')]]){if(this[_0xe463('0xa')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x22')]!==_0x65785a[_0xe463('0x22')][_0xe463('0x31')]()){this['telephones'][_0x65785a['device']][_0xe463('0x33')]=_[_0xe463('0x34')](moment()['format']('x'));}this[_0xe463('0xa')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x22')]=_0x65785a[_0xe463('0x22')][_0xe463('0x31')]();logger[_0xe463('0x23')](_0xe463('0x36'),util['inspect'](this[_0xe463('0xa')][_0x65785a[_0xe463('0x2e')]],{'showHidden':![],'depth':null}));this[_0xe463('0x1d')](util[_0xe463('0x35')](_0xe463('0x37'),this[_0xe463('0xa')][_0x65785a[_0xe463('0x2e')]][_0xe463('0x2a')]),_0xe463('0x38'),this['telephones'][_0x65785a['device']]);}else if(this['trunks'][_0x65785a[_0xe463('0x2e')]]){if(this[_0xe463('0x8')][_0x65785a['device']][_0xe463('0x22')]!==_0x65785a[_0xe463('0x22')][_0xe463('0x31')]()){this[_0xe463('0x8')][_0x65785a[_0xe463('0x2e')]]['stateTime']=_[_0xe463('0x34')](moment()[_0xe463('0x35')]('x'));}this['trunks'][_0x65785a[_0xe463('0x2e')]][_0xe463('0x22')]=_0x65785a[_0xe463('0x22')]['toLowerCase']();logger[_0xe463('0x23')](_0xe463('0x39'),util[_0xe463('0x17')](this[_0xe463('0x8')][_0x65785a['device']],{'showHidden':![],'depth':null}));this[_0xe463('0x1d')](util['format'](_0xe463('0x29'),this[_0xe463('0x8')][_0x65785a['device']][_0xe463('0x2a')]),_0xe463('0x2b'),this[_0xe463('0x8')][_0x65785a[_0xe463('0x2e')]]);}else if(_[_0xe463('0x3a')](_0x65785a[_0xe463('0x2e')],_0xe463('0x3b'))){var _0x1915f4=_0x65785a[_0xe463('0x2e')];var _0x1ed268=_0x1915f4[_0xe463('0x3c')](_0x1915f4[_0xe463('0x3d')]('/')+0x1,_0x1915f4[_0xe463('0x3d')]('@'));var _0x2d3dad=_['find'](this[_0xe463('0x9')],function(_0x112ca2){return _0x112ca2[_0xe463('0x3e')]==_0x1ed268||_0x112ca2['phone']==_0x1ed268||_0x112ca2[_0xe463('0x3f')]==_0x1ed268;});if(_0x2d3dad){if(_0x2d3dad[_0xe463('0x22')]!==_0x65785a[_0xe463('0x22')]['toLowerCase']()){_0x2d3dad[_0xe463('0x33')]=_['toNumber'](moment()[_0xe463('0x35')]('x'));}_0x2d3dad[_0xe463('0x22')]=_0x65785a[_0xe463('0x22')]['toLowerCase']();_0x2d3dad['local']=!![];_0x2d3dad['updateStatusRealtime'](_0x65785a);}}}}catch(_0x4c1701){logger[_0xe463('0x16')]('[userReport][devicestatechange]',util['inspect'](_0x4c1701,{'showHidden':![],'depth':null}));}};UserReport[_0xe463('0x1c')][_0xe463('0x11')]=function(_0x3fc3a5){try{if(this[_0xe463('0x1e')](_0x3fc3a5)&&this['isNotNull'](_0x3fc3a5[_0xe463('0x10')])){logger[_0xe463('0x1f')](_0xe463('0x40'),_0x3fc3a5['peer'],_0x3fc3a5['address'],_0x3fc3a5[_0xe463('0x10')]);logger[_0xe463('0x23')]('[userReport][peerstatus]',util[_0xe463('0x17')](_0x3fc3a5,{'showHidden':![],'depth':null}));if(this[_0xe463('0x9')][_0x3fc3a5['peer']]){if(!this['agents'][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x30')]||_0x3fc3a5['peerstatus']['toLowerCase']()==_0xe463('0x42')){this[_0xe463('0x9')][_0x3fc3a5['peer']][_0xe463('0x30')]=![];this['agents'][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x43')]=_0x3fc3a5[_0xe463('0x10')][_0xe463('0x31')]();this[_0xe463('0x9')][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x44')]=_0x3fc3a5[_0xe463('0x44')];this['agents'][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x45')](_0x3fc3a5);}}else if(this[_0xe463('0xa')][_0x3fc3a5['peer']]){this[_0xe463('0xa')][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x43')]=_0x3fc3a5[_0xe463('0x10')][_0xe463('0x31')]();this[_0xe463('0xa')][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x44')]=_0x3fc3a5[_0xe463('0x44')];logger[_0xe463('0x23')](_0xe463('0x46'),util['inspect'](this[_0xe463('0xa')][_0x3fc3a5['peer']],{'showHidden':![],'depth':null}));this[_0xe463('0x1d')](util[_0xe463('0x35')]('telephone:%s',this[_0xe463('0xa')][_0x3fc3a5['peer']][_0xe463('0x2a')]),_0xe463('0x38'),this[_0xe463('0xa')][_0x3fc3a5[_0xe463('0x41')]]);}else if(this['trunks'][_0x3fc3a5[_0xe463('0x41')]]){this[_0xe463('0x8')][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x43')]=_0x3fc3a5[_0xe463('0x10')][_0xe463('0x31')]();this[_0xe463('0x8')][_0x3fc3a5[_0xe463('0x41')]][_0xe463('0x44')]=_0x3fc3a5[_0xe463('0x44')];logger[_0xe463('0x23')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xe463('0x17')](this[_0xe463('0x8')][_0x3fc3a5['peer']],{'showHidden':![],'depth':null}));this[_0xe463('0x1d')](util['format']('trunk:%s',this[_0xe463('0x8')][_0x3fc3a5[_0xe463('0x41')]]['name']),'trunk:save',this[_0xe463('0x8')][_0x3fc3a5[_0xe463('0x41')]]);}}}catch(_0x47cc66){logger[_0xe463('0x16')](_0xe463('0x47'),util[_0xe463('0x17')](_0x47cc66,{'showHidden':![],'depth':null}));}};module[_0xe463('0x48')]=UserReport; \ No newline at end of file +var _0x4343=['debug','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','find','mobile','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','bluebird','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state'];(function(_0x2f0b49,_0x403fb0){var _0x53c942=function(_0x67d373){while(--_0x67d373){_0x2f0b49['push'](_0x2f0b49['shift']());}};_0x53c942(++_0x403fb0);}(_0x4343,0x1ae));var _0x3434=function(_0x388e8a,_0x4ffdb4){_0x388e8a=_0x388e8a-0x0;var _0x3af13c=_0x4343[_0x388e8a];return _0x3af13c;};'use strict';var _=require(_0x3434('0x0'));var moment=require('moment');var util=require(_0x3434('0x1'));var Redis=require('ioredis');var BPromise=require(_0x3434('0x2'));var config=require(_0x3434('0x3'));var logger=require('../../../config/logger')(_0x3434('0x4'));var ami=require('../ami');config[_0x3434('0x5')]=_[_0x3434('0x6')](config[_0x3434('0x5')],{'host':_0x3434('0x7'),'port':0x18eb});var io=require(_0x3434('0x8'))(new Redis(config[_0x3434('0x5')]));function UserReport(_0x1e1901){this[_0x3434('0x9')]=_0x1e1901[_0x3434('0x9')];this['agents']=_0x1e1901[_0x3434('0xa')];this[_0x3434('0xb')]=_0x1e1901[_0x3434('0xb')];ami['on'](_0x3434('0xc'),this[_0x3434('0xd')][_0x3434('0xe')](this));ami['on'](_0x3434('0xf'),this['syncRegistry'][_0x3434('0xe')](this));ami['on'](_0x3434('0x10'),this[_0x3434('0x11')][_0x3434('0xe')](this));ami['on']('peerstatus',this[_0x3434('0x12')][_0x3434('0xe')](this));return this[_0x3434('0x13')]();}function showSipRegistrations(){Promise[_0x3434('0x14')]()[_0x3434('0x15')](ami[_0x3434('0x16')]())[_0x3434('0x17')](function(_0xe1b191){logger['error'](_0x3434('0x18'),util[_0x3434('0x19')](_0xe1b191,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3434('0x14')]()['then'](ami[_0x3434('0x1a')]())[_0x3434('0x17')](function(_0x9cb2d5){logger[_0x3434('0x1b')](_0x3434('0x1c'),util[_0x3434('0x19')](_0x9cb2d5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3434('0x14')]()[_0x3434('0x15')](ami[_0x3434('0x1d')]())['catch'](function(_0x5d222c){logger[_0x3434('0x1b')](_0x3434('0x1e'),util[_0x3434('0x19')](_0x5d222c,{'showHidden':![],'depth':null}));});}UserReport[_0x3434('0x1f')][_0x3434('0x13')]=function(){setInterval(function(){BPromise[_0x3434('0x14')]()[_0x3434('0x15')](showSipRegistrations())[_0x3434('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x3434('0x1f')][_0x3434('0x20')]=function(_0x3fcbc1){return _0x3fcbc1!==null&&!_[_0x3434('0x21')](_0x3fcbc1);};UserReport[_0x3434('0x1f')][_0x3434('0x22')]=function(_0x467450,_0x579da6,_0xefe508){io['to'](_0x467450)[_0x3434('0x22')](_0x579da6,_0xefe508);};UserReport[_0x3434('0x1f')][_0x3434('0xd')]=function(_0x2dd585){try{if(this['isNotNull'](_0x2dd585)){logger['info'](_0x3434('0x23'),_0x2dd585[_0x3434('0x24')],_0x2dd585[_0x3434('0x25')]);logger[_0x3434('0x26')]('[userReport][registry]',util['inspect'](_0x2dd585,{'showHidden':![],'depth':null}));var _0x2fe7dd=_['find'](this[_0x3434('0x9')],{'registry':_0x2dd585[_0x3434('0x24')]});if(_0x2fe7dd){_0x2dd585['stateRegistry']=_0x2dd585[_0x3434('0x25')];_[_0x3434('0x27')](_0x2fe7dd,_[_0x3434('0x28')](_0x2dd585,[_0x3434('0x29'),_0x3434('0x2a'),_0x3434('0x24'),_0x3434('0x25')]));logger['debug'](_0x3434('0x2b'),util[_0x3434('0x19')](_0x2fe7dd,{'showHidden':![],'depth':null}));this[_0x3434('0x22')](util[_0x3434('0x2c')](_0x3434('0x2d'),_0x2fe7dd[_0x3434('0x2e')]),_0x3434('0x2f'),_0x2fe7dd);}}}catch(_0x20c543){logger[_0x3434('0x1b')]('[userReport][registry]',util[_0x3434('0x19')](_0x20c543,{'showHidden':![],'depth':null}));}};UserReport[_0x3434('0x1f')][_0x3434('0x11')]=function(_0x39b9b6){try{if(this[_0x3434('0x20')](_0x39b9b6)){logger[_0x3434('0x30')](_0x3434('0x31'),_0x39b9b6[_0x3434('0x32')],_0x39b9b6[_0x3434('0x25')]);logger[_0x3434('0x26')](_0x3434('0x33'),util['inspect'](_0x39b9b6,{'showHidden':![],'depth':null}));if(this[_0x3434('0xa')][_0x39b9b6[_0x3434('0x32')]]){if(!this[_0x3434('0xa')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x34')]||_0x39b9b6[_0x3434('0x25')][_0x3434('0x35')]()==_0x3434('0x36')){this['agents'][_0x39b9b6['device']]['local']=![];if(this[_0x3434('0xa')][_0x39b9b6['device']]['state']!==_0x39b9b6['state'][_0x3434('0x35')]()){this[_0x3434('0xa')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x37')]=_['toNumber'](moment()[_0x3434('0x2c')]('x'));}this[_0x3434('0xa')][_0x39b9b6[_0x3434('0x32')]]['state']=_0x39b9b6[_0x3434('0x25')][_0x3434('0x35')]();this[_0x3434('0xa')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x38')](_0x39b9b6);}}else if(this[_0x3434('0xb')][_0x39b9b6['device']]){if(this[_0x3434('0xb')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x25')]!==_0x39b9b6[_0x3434('0x25')][_0x3434('0x35')]()){this[_0x3434('0xb')][_0x39b9b6[_0x3434('0x32')]]['stateTime']=_['toNumber'](moment()[_0x3434('0x2c')]('x'));}this[_0x3434('0xb')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x25')]=_0x39b9b6[_0x3434('0x25')][_0x3434('0x35')]();logger[_0x3434('0x26')](_0x3434('0x39'),util[_0x3434('0x19')](this['telephones'][_0x39b9b6['device']],{'showHidden':![],'depth':null}));this[_0x3434('0x22')](util[_0x3434('0x2c')]('telephone:%s',this[_0x3434('0xb')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x2e')]),_0x3434('0x3a'),this['telephones'][_0x39b9b6['device']]);}else if(this[_0x3434('0x9')][_0x39b9b6[_0x3434('0x32')]]){if(this[_0x3434('0x9')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x25')]!==_0x39b9b6[_0x3434('0x25')][_0x3434('0x35')]()){this[_0x3434('0x9')][_0x39b9b6[_0x3434('0x32')]]['stateTime']=_[_0x3434('0x3b')](moment()[_0x3434('0x2c')]('x'));}this[_0x3434('0x9')][_0x39b9b6['device']][_0x3434('0x25')]=_0x39b9b6[_0x3434('0x25')]['toLowerCase']();logger['debug'](_0x3434('0x3c'),util[_0x3434('0x19')](this[_0x3434('0x9')][_0x39b9b6['device']],{'showHidden':![],'depth':null}));this[_0x3434('0x22')](util['format']('trunk:%s',this[_0x3434('0x9')][_0x39b9b6[_0x3434('0x32')]][_0x3434('0x2e')]),'trunk:save',this[_0x3434('0x9')][_0x39b9b6[_0x3434('0x32')]]);}else if(_['startsWith'](_0x39b9b6[_0x3434('0x32')],_0x3434('0x3d'))){var _0x22ea5a=_0x39b9b6[_0x3434('0x32')];var _0x2695f0=_0x22ea5a[_0x3434('0x3e')](_0x22ea5a[_0x3434('0x3f')]('/')+0x1,_0x22ea5a[_0x3434('0x3f')]('@'));var _0x47d9ad=_[_0x3434('0x40')](this['agents'],function(_0x1f7f08){return _0x1f7f08[_0x3434('0x41')]==_0x2695f0||_0x1f7f08['phone']==_0x2695f0||_0x1f7f08[_0x3434('0x42')]==_0x2695f0;});if(_0x47d9ad){if(_0x47d9ad[_0x3434('0x25')]!==_0x39b9b6[_0x3434('0x25')]['toLowerCase']()){_0x47d9ad[_0x3434('0x37')]=_['toNumber'](moment()[_0x3434('0x2c')]('x'));}_0x47d9ad['state']=_0x39b9b6['state']['toLowerCase']();_0x47d9ad[_0x3434('0x34')]=!![];_0x47d9ad[_0x3434('0x38')](_0x39b9b6);}}}}catch(_0x9dc457){logger[_0x3434('0x1b')](_0x3434('0x33'),util[_0x3434('0x19')](_0x9dc457,{'showHidden':![],'depth':null}));}};UserReport[_0x3434('0x1f')][_0x3434('0x12')]=function(_0x1451b9){try{if(this[_0x3434('0x20')](_0x1451b9)&&this[_0x3434('0x20')](_0x1451b9[_0x3434('0x43')])){logger['info'](_0x3434('0x44'),_0x1451b9[_0x3434('0x45')],_0x1451b9[_0x3434('0x46')],_0x1451b9[_0x3434('0x43')]);logger[_0x3434('0x26')](_0x3434('0x47'),util[_0x3434('0x19')](_0x1451b9,{'showHidden':![],'depth':null}));if(this[_0x3434('0xa')][_0x1451b9[_0x3434('0x45')]]){if(!this[_0x3434('0xa')][_0x1451b9[_0x3434('0x45')]][_0x3434('0x34')]||_0x1451b9[_0x3434('0x43')][_0x3434('0x35')]()==_0x3434('0x48')){this[_0x3434('0xa')][_0x1451b9[_0x3434('0x45')]][_0x3434('0x34')]=![];this[_0x3434('0xa')][_0x1451b9[_0x3434('0x45')]][_0x3434('0x49')]=_0x1451b9['peerstatus'][_0x3434('0x35')]();this['agents'][_0x1451b9[_0x3434('0x45')]][_0x3434('0x46')]=_0x1451b9[_0x3434('0x46')];this[_0x3434('0xa')][_0x1451b9['peer']][_0x3434('0x38')](_0x1451b9);}}else if(this[_0x3434('0xb')][_0x1451b9['peer']]){this[_0x3434('0xb')][_0x1451b9[_0x3434('0x45')]]['status']=_0x1451b9[_0x3434('0x43')]['toLowerCase']();this[_0x3434('0xb')][_0x1451b9[_0x3434('0x45')]]['address']=_0x1451b9['address'];logger[_0x3434('0x26')](_0x3434('0x4a'),util[_0x3434('0x19')](this[_0x3434('0xb')][_0x1451b9[_0x3434('0x45')]],{'showHidden':![],'depth':null}));this[_0x3434('0x22')](util['format'](_0x3434('0x4b'),this[_0x3434('0xb')][_0x1451b9[_0x3434('0x45')]][_0x3434('0x2e')]),_0x3434('0x3a'),this[_0x3434('0xb')][_0x1451b9[_0x3434('0x45')]]);}else if(this[_0x3434('0x9')][_0x1451b9[_0x3434('0x45')]]){this[_0x3434('0x9')][_0x1451b9['peer']][_0x3434('0x49')]=_0x1451b9[_0x3434('0x43')]['toLowerCase']();this[_0x3434('0x9')][_0x1451b9['peer']]['address']=_0x1451b9['address'];logger[_0x3434('0x26')](_0x3434('0x4c'),util[_0x3434('0x19')](this[_0x3434('0x9')][_0x1451b9[_0x3434('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x3434('0x2c')](_0x3434('0x2d'),this[_0x3434('0x9')][_0x1451b9[_0x3434('0x45')]][_0x3434('0x2e')]),'trunk:save',this[_0x3434('0x9')][_0x1451b9[_0x3434('0x45')]]);}}}catch(_0x7890fb){logger[_0x3434('0x1b')](_0x3434('0x47'),util['inspect'](_0x7890fb,{'showHidden':![],'depth':null}));}};module[_0x3434('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 96b00c8..101fcf6 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 _0xf5a1=['inspect','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled'];(function(_0x311f12,_0x447e2c){var _0x509d98=function(_0xc9e360){while(--_0xc9e360){_0x311f12['push'](_0x311f12['shift']());}};_0x509d98(++_0x447e2c);}(_0xf5a1,0x102));var _0x1f5a=function(_0x11758e,_0x2f364e){_0x11758e=_0x11758e-0x0;var _0x137eec=_0xf5a1[_0x11758e];return _0x137eec;};'use strict';var _=require(_0x1f5a('0x0'));var moment=require('moment');var util=require(_0x1f5a('0x1'));var Redis=require(_0x1f5a('0x2'));var config=require(_0x1f5a('0x3'));var logger=require(_0x1f5a('0x4'))(_0x1f5a('0x5'));var ami=require(_0x1f5a('0x6'));config[_0x1f5a('0x7')]=_['defaults'](config[_0x1f5a('0x7')],{'host':_0x1f5a('0x8'),'port':0x18eb});var io=require(_0x1f5a('0x9'))(new Redis(config[_0x1f5a('0x7')]));function VoiceAgentReport(_0x113649){this[_0x1f5a('0xa')]={};this[_0x1f5a('0xb')]=_0x113649[_0x1f5a('0xb')];this[_0x1f5a('0xc')]=_0x113649['agents'];this[_0x1f5a('0xd')]={};ami['on'](_0x1f5a('0xe'),this[_0x1f5a('0xf')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x11'),this[_0x1f5a('0x12')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x13'),this['syncAgentRingNoAnswer'][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x14'),this[_0x1f5a('0x15')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x16'),this[_0x1f5a('0x17')]['bind'](this));ami['on'](_0x1f5a('0x18'),this[_0x1f5a('0x19')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x1a'),this['syncHangup'][_0x1f5a('0x10')](this));ami['on']('musiconholdstart',this[_0x1f5a('0x1b')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x1c'),this[_0x1f5a('0x1d')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x1e'),this[_0x1f5a('0x1f')][_0x1f5a('0x10')](this));ami['on'](_0x1f5a('0x20'),this[_0x1f5a('0x21')][_0x1f5a('0x10')](this));}VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x23')]=function(_0x2428d8,_0x325142,_0x8053db){io['to'](_0x2428d8)[_0x1f5a('0x23')](_0x325142,_0x8053db);};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x24')]=function(_0x5d09b3){return _0x5d09b3!==null&&!_[_0x1f5a('0x25')](_0x5d09b3);};VoiceAgentReport[_0x1f5a('0x22')]['syncAgentCalled']=function(_0x5ec982){try{if(this[_0x1f5a('0x24')](_0x5ec982)){logger['info'](_0x1f5a('0x26'),_0x5ec982[_0x1f5a('0x27')],_0x5ec982[_0x1f5a('0x28')],_0x5ec982[_0x1f5a('0x29')]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x5ec982[_0x1f5a('0x27')],util['inspect'](_0x5ec982,{'showHidden':![],'depth':null}));if(_[_0x1f5a('0x25')](this[_0x1f5a('0xa')][_0x5ec982['uniqueid']])){this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]]={};}if(_[_0x1f5a('0x25')](this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982[_0x1f5a('0x29')]])){this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982['destuniqueid']]={'agentcalledAt':moment()['format'](_0x1f5a('0x2a')),'lastevent':'called','mandatoryDisposition':this[_0x1f5a('0xb')][_0x5ec982['queue']]?this[_0x1f5a('0xb')][_0x5ec982[_0x1f5a('0x2b')]][_0x1f5a('0x2c')]||![]:![],'type':this[_0x1f5a('0xb')][_0x5ec982[_0x1f5a('0x2b')]]?this['voiceQueues'][_0x5ec982[_0x1f5a('0x2b')]][_0x1f5a('0x2d')]||_0x1f5a('0x2e'):_0x1f5a('0x2e'),'variables':this[_0x1f5a('0xd')][_0x5ec982[_0x1f5a('0x27')]]};}_[_0x1f5a('0x2f')](this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982[_0x1f5a('0x29')]],_[_0x1f5a('0x30')](_0x5ec982,[_0x1f5a('0x31'),_0x1f5a('0x32')]));logger[_0x1f5a('0x33')](_0x1f5a('0x34'),_0x5ec982[_0x1f5a('0x27')],util['inspect'](this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982[_0x1f5a('0x29')]],{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')](_0x1f5a('0x35'),this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982[_0x1f5a('0x29')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x5ec982[_0x1f5a('0x27')],util[_0x1f5a('0x36')](this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x1f5a('0x23')](util[_0x1f5a('0x37')](_0x1f5a('0x38'),_0x5ec982[_0x1f5a('0x28')]),_0x1f5a('0x39'),this[_0x1f5a('0xa')][_0x5ec982[_0x1f5a('0x27')]][_0x5ec982['destuniqueid']]);}}catch(_0x536e61){logger[_0x1f5a('0x3a')](_0x1f5a('0x3b'),_0x5ec982[_0x1f5a('0x27')],util['inspect'](_0x536e61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x12')]=function(_0x19edd4){try{if(this['isNotNull'](_0x19edd4)){if(this['channels'][_0x19edd4['uniqueid']]){logger['debug'](_0x1f5a('0x3c'),_0x19edd4['uniqueid'],util[_0x1f5a('0x36')](_0x19edd4,{'showHidden':![],'depth':null}));for(var _0x3b83e2 in this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]]){if(this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x1f5a('0x3d')](_0x3b83e2)){if(_0x19edd4['destuniqueid']===_0x3b83e2){logger[_0x1f5a('0x3e')](_0x1f5a('0x3f'),_0x19edd4[_0x1f5a('0x27')],_0x19edd4[_0x1f5a('0x28')],_0x19edd4[_0x1f5a('0x29')]);this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x40')]=moment()[_0x1f5a('0x37')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x41')]=_0x19edd4[_0x1f5a('0x41')];this['channels'][_0x19edd4['uniqueid']][_0x3b83e2]['connectedlinenum']=_0x19edd4['connectedlinenum'];this['channels'][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x42')]=_0x19edd4[_0x1f5a('0x42')];this[_0x1f5a('0xa')][_0x19edd4['uniqueid']][_0x3b83e2][_0x1f5a('0x43')]=_0x19edd4['destchannelstatedesc'];this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x44')]=_0x19edd4['holdtime'];this['channels'][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x45')]=_0x1f5a('0x46');_['merge'](this['agents'][_0x19edd4[_0x1f5a('0x47')]],_[_0x1f5a('0x48')](_0x19edd4,[_0x1f5a('0x2b'),'destconnectedlinenum']));logger[_0x1f5a('0x33')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x19edd4[_0x1f5a('0x27')],util[_0x1f5a('0x36')](this['channels'][_0x19edd4[_0x1f5a('0x27')]][_0x19edd4[_0x1f5a('0x29')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1f5a('0x49'),this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x19edd4[_0x1f5a('0x29')]]);logger['debug'](_0x1f5a('0x4a'),_0x19edd4[_0x1f5a('0x27')],util[_0x1f5a('0x36')](this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x19edd4['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x1f5a('0x23')](util[_0x1f5a('0x37')](_0x1f5a('0x38'),_0x19edd4['membername']),_0x1f5a('0x4b'),this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x19edd4[_0x1f5a('0x29')]]);}else if(!this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x13')]&&!this[_0x1f5a('0xa')][_0x19edd4['uniqueid']][_0x3b83e2]['agentcomplete']){logger[_0x1f5a('0x3e')](_0x1f5a('0x4c'),_0x19edd4[_0x1f5a('0x27')],this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x28')],_0x3b83e2);this[_0x1f5a('0xa')][_0x19edd4['uniqueid']][_0x3b83e2][_0x1f5a('0x13')]=!![];this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x4d')]=moment()[_0x1f5a('0x37')](_0x1f5a('0x2a'));this['channels'][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x4e')]=_0x19edd4[_0x1f5a('0x29')];this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x4f')]=_0x19edd4[_0x1f5a('0x28')];this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x45')]='answered_elsewhere';this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2][_0x1f5a('0x50')]=_0x1f5a('0x51');logger[_0x1f5a('0x33')](_0x1f5a('0x52'),_0x19edd4[_0x1f5a('0x27')],util[_0x1f5a('0x36')](this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2],{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')]('custom:agentansweredelsewhere',this[_0x1f5a('0xa')][_0x19edd4[_0x1f5a('0x27')]][_0x3b83e2]);}}}}}}catch(_0x169506){logger['error'](_0x1f5a('0x53'),_0x19edd4['uniqueid'],util[_0x1f5a('0x36')](_0x169506,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x54')]=function(_0xc73739){try{if(this[_0x1f5a('0x24')](_0xc73739)){logger[_0x1f5a('0x33')](_0x1f5a('0x55'),_0xc73739['uniqueid'],util[_0x1f5a('0x36')](_0xc73739,{'showHidden':![],'depth':null}));if(this['channels'][_0xc73739[_0x1f5a('0x27')]]&&this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739['destuniqueid']]){logger['info'](_0x1f5a('0x56'),_0xc73739['uniqueid'],_0xc73739['membername'],_0xc73739[_0x1f5a('0x29')]);this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739[_0x1f5a('0x29')]][_0x1f5a('0x13')]=!![];this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739['destuniqueid']]['agentringnoanswerAt']=moment()[_0x1f5a('0x37')](_0x1f5a('0x2a'));this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739[_0x1f5a('0x29')]][_0x1f5a('0x45')]='rejected';this['channels'][_0xc73739['uniqueid']][_0xc73739[_0x1f5a('0x29')]][_0x1f5a('0x50')]=_0x1f5a('0x57');logger[_0x1f5a('0x33')](_0x1f5a('0x58'),_0xc73739[_0x1f5a('0x27')],util[_0x1f5a('0x36')](this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739[_0x1f5a('0x29')]],{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')](_0x1f5a('0x59'),this[_0x1f5a('0xa')][_0xc73739[_0x1f5a('0x27')]][_0xc73739[_0x1f5a('0x29')]]);}}}catch(_0x3648ff){logger[_0x1f5a('0x3a')](_0x1f5a('0x5a'),_0xc73739[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x3648ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x15')]=function(_0x1d0bd1){try{if(this['isNotNull'](_0x1d0bd1)){logger[_0x1f5a('0x33')](_0x1f5a('0x5b'),_0x1d0bd1[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x1d0bd1,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d0bd1[_0x1f5a('0x27')]]){for(var _0x5e7038 in this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]]){if(this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x1f5a('0x3d')](_0x5e7038)&&!this[_0x1f5a('0xa')][_0x1d0bd1['uniqueid']][_0x5e7038][_0x1f5a('0x13')]&&!this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038]['agentcomplete']){logger[_0x1f5a('0x3e')](_0x1f5a('0x5c'),_0x1d0bd1[_0x1f5a('0x27')],this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038][_0x1f5a('0x28')],_0x5e7038);this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038][_0x1f5a('0x13')]=!![];this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038][_0x1f5a('0x4d')]=moment()[_0x1f5a('0x37')](_0x1f5a('0x2a'));this[_0x1f5a('0xa')][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038][_0x1f5a('0x45')]='abandoned';this['channels'][_0x1d0bd1[_0x1f5a('0x27')]][_0x5e7038][_0x1f5a('0x50')]=_0x1f5a('0x5d');logger[_0x1f5a('0x33')](_0x1f5a('0x5e'),_0x1d0bd1['uniqueid'],util['inspect'](this[_0x1f5a('0xa')][_0x1d0bd1['uniqueid']][_0x5e7038],{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')](_0x1f5a('0x5f'),this[_0x1f5a('0xa')][_0x1d0bd1['uniqueid']][_0x5e7038]);}}}}}catch(_0x220005){logger[_0x1f5a('0x3a')](_0x1f5a('0x60'),_0x1d0bd1['uniqueid'],util[_0x1f5a('0x36')](_0x220005,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x17')]=function(_0x2f4393){try{if(this['isNotNull'](_0x2f4393)){logger[_0x1f5a('0x33')](_0x1f5a('0x61'),_0x2f4393[_0x1f5a('0x27')],util['inspect'](_0x2f4393,{'showHidden':![],'depth':null}));if(this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]]){for(var _0x77e36c in this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]]){if(this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x1f5a('0x3d')](_0x77e36c)){if(this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x40')]&&!this['channels'][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x16')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f4393['uniqueid'],this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x28')],_0x77e36c);this['channels'][_0x2f4393['uniqueid']][_0x77e36c][_0x1f5a('0x16')]=!![];this[_0x1f5a('0xa')][_0x2f4393['uniqueid']][_0x77e36c]['agentcompleteAt']=moment()[_0x1f5a('0x37')](_0x1f5a('0x2a'));this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x45')]=_0x1f5a('0x62');this[_0x1f5a('0xa')][_0x2f4393['uniqueid']][_0x77e36c]['reason']=_0x2f4393[_0x1f5a('0x50')]==_0x1f5a('0x63')?'agent':_0x2f4393[_0x1f5a('0x50')];this['channels'][_0x2f4393['uniqueid']][_0x77e36c][_0x1f5a('0x64')]=_0x2f4393[_0x1f5a('0x64')];if(this[_0x1f5a('0xb')][_0x2f4393[_0x1f5a('0x2b')]]&&this['voiceQueues'][_0x2f4393[_0x1f5a('0x2b')]][_0x1f5a('0x65')]){this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x66')]=this[_0x1f5a('0xb')][_0x2f4393[_0x1f5a('0x2b')]][_0x1f5a('0x67')];this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c][_0x1f5a('0x68')]=!![];}this[_0x1f5a('0xc')][_0x2f4393[_0x1f5a('0x47')]]=_[_0x1f5a('0x30')](this[_0x1f5a('0xc')][_0x2f4393[_0x1f5a('0x47')]],[_0x1f5a('0x2b'),'destconnectedlinenum']);logger[_0x1f5a('0x33')](_0x1f5a('0x69'),_0x2f4393[_0x1f5a('0x27')],util['inspect'](this[_0x1f5a('0xa')][_0x2f4393['uniqueid']][_0x77e36c],{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')]('custom:agentcomplete',this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c]);logger[_0x1f5a('0x33')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2f4393['uniqueid'],util['inspect'](this[_0x1f5a('0xa')][_0x2f4393[_0x1f5a('0x27')]][_0x77e36c],{'showHidden':![],'depth':null}));this['emit'](util[_0x1f5a('0x37')](_0x1f5a('0x38'),_0x2f4393[_0x1f5a('0x28')]),_0x1f5a('0x6a'),this[_0x1f5a('0xa')][_0x2f4393['uniqueid']][_0x77e36c]);}}}}}}catch(_0x13de01){logger[_0x1f5a('0x3a')](_0x1f5a('0x6b'),_0x2f4393[_0x1f5a('0x27')],util['inspect'](_0x13de01,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')]['syncVarSet']=function(_0x492667){try{if(this[_0x1f5a('0x24')](_0x492667)){logger[_0x1f5a('0x33')](_0x1f5a('0x6c'),_0x492667[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x492667,{'showHidden':![],'depth':null}));this[_0x1f5a('0x6d')](_0x492667[_0x1f5a('0x27')],_[_0x1f5a('0x6e')](_0x492667[_0x1f5a('0x6f')])[0x0],_0x492667[_0x1f5a('0x70')]);if(this[_0x1f5a('0xa')][_0x492667['uniqueid']]){for(var _0x4eecba in this[_0x1f5a('0xa')][_0x492667[_0x1f5a('0x27')]]){if(this[_0x1f5a('0xa')][_0x492667[_0x1f5a('0x27')]]['hasOwnProperty'](_0x4eecba)){logger[_0x1f5a('0x3e')](_0x1f5a('0x71'),_0x492667[_0x1f5a('0x27')],_0x4eecba,_[_0x1f5a('0x6e')](_0x492667['variable'])[0x0],_0x492667[_0x1f5a('0x70')]);if(_[_0x1f5a('0x25')](this[_0x1f5a('0xa')][_0x492667[_0x1f5a('0x27')]][_0x4eecba][_0x1f5a('0xd')])){this['channels'][_0x492667[_0x1f5a('0x27')]][_0x4eecba][_0x1f5a('0xd')]={};}this[_0x1f5a('0xa')][_0x492667['uniqueid']][_0x4eecba][_0x1f5a('0xd')]=this[_0x1f5a('0xd')][_0x492667[_0x1f5a('0x27')]];}}}}}catch(_0x42edc6){logger[_0x1f5a('0x3a')](_0x1f5a('0x72'),_0x492667['uniqueid'],util[_0x1f5a('0x36')](_0x42edc6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x6d')]=function(_0x38ee6b,_0x2143fa,_0x2d804e){var _0x1e52c3=['rtpaudioqos',_0x1f5a('0x73'),'rtpaudioqosjitter',_0x1f5a('0x74'),_0x1f5a('0x75'),_0x1f5a('0x76'),_0x1f5a('0x77'),_0x1f5a('0x78'),'sipcallid','sipuri',_0x1f5a('0x79'),_0x1f5a('0x7a'),_0x1f5a('0x7b'),_0x1f5a('0x7c'),_0x1f5a('0x7d'),_0x1f5a('0x7e'),_0x1f5a('0x28'),'memberpenalty','memberrealtime'];if(!_[_0x1f5a('0x7f')](_0x2143fa)&&!_[_0x1f5a('0x80')](_0x1e52c3,_0x2143fa)){if(_[_0x1f5a('0x25')](this['variables'][_0x38ee6b])){this[_0x1f5a('0xd')][_0x38ee6b]={};}this[_0x1f5a('0xd')][_0x38ee6b][_0x2143fa]=_0x2d804e;}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x81')]=function(_0x2cf3ac){try{if(this[_0x1f5a('0x24')](_0x2cf3ac)){logger[_0x1f5a('0x33')](_0x1f5a('0x82'),_0x2cf3ac[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x2cf3ac,{'showHidden':![],'depth':null}));if(this[_0x1f5a('0xa')][_0x2cf3ac['uniqueid']]){for(var _0x19f20a in this[_0x1f5a('0xa')][_0x2cf3ac[_0x1f5a('0x27')]]){if(this[_0x1f5a('0xa')][_0x2cf3ac['uniqueid']][_0x1f5a('0x3d')](_0x19f20a)){if(this[_0x1f5a('0xa')][_0x2cf3ac['uniqueid']][_0x19f20a][_0x1f5a('0x50')]==_0x1f5a('0x63')&&this[_0x1f5a('0xa')][_0x2cf3ac[_0x1f5a('0x27')]][_0x19f20a]['agentcomplete']){logger[_0x1f5a('0x3e')](_0x1f5a('0x83'),_0x2cf3ac[_0x1f5a('0x27')],_0x19f20a);this[_0x1f5a('0xa')][_0x2cf3ac[_0x1f5a('0x27')]][_0x19f20a][_0x1f5a('0x84')]=moment()[_0x1f5a('0x37')](_0x1f5a('0x2a'));}}}logger[_0x1f5a('0x33')](_0x1f5a('0x85'),_0x2cf3ac[_0x1f5a('0x27')],util['inspect'](_['values'](this[_0x1f5a('0xa')][_0x2cf3ac['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x1f5a('0x23')](_0x1f5a('0x86'),_[_0x1f5a('0x87')](this['channels'][_0x2cf3ac['uniqueid']]));delete this[_0x1f5a('0xa')][_0x2cf3ac[_0x1f5a('0x27')]];}if(this['variables'][_0x2cf3ac[_0x1f5a('0x27')]]){delete this[_0x1f5a('0xd')][_0x2cf3ac[_0x1f5a('0x27')]];}}}catch(_0x36a6d9){logger['error'](_0x1f5a('0x88'),_0x2cf3ac[_0x1f5a('0x27')],util['inspect'](_0x36a6d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')]['syncAttendedTransfer']=function(_0x4136b2){try{if(this[_0x1f5a('0x24')](_0x4136b2)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x4136b2['uniqueid'],util[_0x1f5a('0x36')](_0x4136b2,{'showHidden':![],'depth':null}));if(this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]]){for(var _0x3c4b88 in this[_0x1f5a('0xa')][_0x4136b2['transfereeuniqueid']]){if(this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x1f5a('0x3d')](_0x3c4b88)){if(_0x4136b2[_0x1f5a('0x8a')]===_0x3c4b88){logger[_0x1f5a('0x3e')](_0x1f5a('0x8b'),_0x4136b2[_0x1f5a('0x27')],this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88][_0x1f5a('0x28')],_0x3c4b88);var _0x538dde=moment();this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88][_0x1f5a('0x16')]=!![];this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88][_0x1f5a('0x84')]=moment()[_0x1f5a('0x37')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88]['lastevent']=_0x1f5a('0x62');this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88][_0x1f5a('0x50')]='transfer';this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88]['talktime']=_0x538dde['diff'](this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]][_0x3c4b88]['agentconnectAt'],_0x1f5a('0x8c'));}}}}if(this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x8d')]]){var _0x246454=this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x8d')]];this['channels'][_0x4136b2[_0x1f5a('0x8d')]]=this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]];this[_0x1f5a('0xa')][_0x4136b2[_0x1f5a('0x89')]]=_0x246454;}}}catch(_0x29d3fe){logger[_0x1f5a('0x3a')](_0x1f5a('0x8e'),_0x4136b2[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x29d3fe,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1f5a('0x21')]=function(_0x5ac287){try{if(this[_0x1f5a('0x24')](_0x5ac287)){logger[_0x1f5a('0x33')](_0x1f5a('0x8f'),_0x5ac287[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x5ac287,{'showHidden':![],'depth':null}));if(this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]]){for(var _0x154536 in this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]]){if(this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]][_0x1f5a('0x3d')](_0x154536)){if(_0x5ac287[_0x1f5a('0x90')]===_0x154536){logger[_0x1f5a('0x3e')](_0x1f5a('0x91'),_0x5ac287[_0x1f5a('0x27')],this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x28')],_0x154536);var _0x67aa28=moment();this['channels'][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x16')]=!![];this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x84')]=_0x67aa28;this['channels'][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x45')]=_0x1f5a('0x62');this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x50')]=_0x1f5a('0x63');this[_0x1f5a('0xa')][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x64')]=_0x67aa28[_0x1f5a('0x92')](this['channels'][_0x5ac287[_0x1f5a('0x89')]][_0x154536][_0x1f5a('0x40')],_0x1f5a('0x8c'));}}}}}}catch(_0x33d606){logger[_0x1f5a('0x3a')](_0x1f5a('0x93'),_0x5ac287[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x33d606,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1f5a('0x22')][_0x1f5a('0x1b')]=function(_0x26141d){var _0x4d227a='';try{if(this[_0x1f5a('0x24')](_0x26141d)){logger['debug'](_0x1f5a('0x94'),_0x26141d[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x26141d,{'showHidden':![],'depth':null}));if(_0x26141d[_0x1f5a('0x95')]){_0x4d227a=_0x26141d[_0x1f5a('0x95')][_0x1f5a('0x96')](0x0,_0x26141d[_0x1f5a('0x95')][_0x1f5a('0x97')]('-'));if(this[_0x1f5a('0xc')][_0x4d227a]){logger[_0x1f5a('0x3e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x26141d['uniqueid'],_0x4d227a);this[_0x1f5a('0xc')][_0x4d227a]['onhold']=!![];}}}}catch(_0x3953ed){logger[_0x1f5a('0x3a')]('[%s][voiceAgentReport][musiconholdstart]',_0x26141d[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x3953ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1f5a('0x1d')]=function(_0x30b382){var _0x108f7c='';try{if(this[_0x1f5a('0x24')](_0x30b382)){logger[_0x1f5a('0x33')](_0x1f5a('0x98'),_0x30b382[_0x1f5a('0x27')],util[_0x1f5a('0x36')](_0x30b382,{'showHidden':![],'depth':null}));if(_0x30b382[_0x1f5a('0x95')]){_0x108f7c=_0x30b382['channel'][_0x1f5a('0x96')](0x0,_0x30b382['channel'][_0x1f5a('0x97')]('-'));if(this['agents'][_0x108f7c]){logger[_0x1f5a('0x3e')](_0x1f5a('0x99'),_0x30b382[_0x1f5a('0x27')],_0x108f7c);this[_0x1f5a('0xc')][_0x108f7c]['onhold']=![];}}}}catch(_0x37a19f){logger[_0x1f5a('0x3a')](_0x1f5a('0x9a'),_0x30b382[_0x1f5a('0x27')],util['inspect'](_0x37a19f,{'showHidden':![],'depth':null}));}};module[_0x1f5a('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0xc554=['lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','syncVarSet','hangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','agentcomplete','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','variables','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc554,0x9a));var _0x4c55=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0xc554[_0x119d13];return _0x333c35;};'use strict';var _=require(_0x4c55('0x0'));var moment=require(_0x4c55('0x1'));var util=require(_0x4c55('0x2'));var Redis=require('ioredis');var config=require(_0x4c55('0x3'));var logger=require(_0x4c55('0x4'))('ami');var ami=require(_0x4c55('0x5'));config[_0x4c55('0x6')]=_[_0x4c55('0x7')](config[_0x4c55('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4c55('0x8'))(new Redis(config[_0x4c55('0x6')]));function VoiceAgentReport(_0xb67646){this[_0x4c55('0x9')]={};this[_0x4c55('0xa')]=_0xb67646['voiceQueues'];this[_0x4c55('0xb')]=_0xb67646[_0x4c55('0xb')];this['variables']={};ami['on'](_0x4c55('0xc'),this[_0x4c55('0xd')][_0x4c55('0xe')](this));ami['on'](_0x4c55('0xf'),this[_0x4c55('0x10')][_0x4c55('0xe')](this));ami['on'](_0x4c55('0x11'),this['syncAgentRingNoAnswer'][_0x4c55('0xe')](this));ami['on'](_0x4c55('0x12'),this[_0x4c55('0x13')][_0x4c55('0xe')](this));ami['on']('agentcomplete',this[_0x4c55('0x14')][_0x4c55('0xe')](this));ami['on']('varset',this[_0x4c55('0x15')][_0x4c55('0xe')](this));ami['on'](_0x4c55('0x16'),this['syncHangup'][_0x4c55('0xe')](this));ami['on']('musiconholdstart',this[_0x4c55('0x17')][_0x4c55('0xe')](this));ami['on']('musiconholdstop',this[_0x4c55('0x18')][_0x4c55('0xe')](this));ami['on'](_0x4c55('0x19'),this[_0x4c55('0x1a')][_0x4c55('0xe')](this));ami['on']('blindtransfer',this[_0x4c55('0x1b')][_0x4c55('0xe')](this));}VoiceAgentReport['prototype'][_0x4c55('0x1c')]=function(_0x285815,_0x4fec31,_0x1ac3f9){io['to'](_0x285815)[_0x4c55('0x1c')](_0x4fec31,_0x1ac3f9);};VoiceAgentReport[_0x4c55('0x1d')]['isNotNull']=function(_0x43ac0c){return _0x43ac0c!==null&&!_[_0x4c55('0x1e')](_0x43ac0c);};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0xd')]=function(_0x31a5c4){try{if(this[_0x4c55('0x1f')](_0x31a5c4)){logger[_0x4c55('0x20')](_0x4c55('0x21'),_0x31a5c4[_0x4c55('0x22')],_0x31a5c4[_0x4c55('0x23')],_0x31a5c4[_0x4c55('0x24')]);logger[_0x4c55('0x25')](_0x4c55('0x26'),_0x31a5c4[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x31a5c4,{'showHidden':![],'depth':null}));if(_[_0x4c55('0x1e')](this[_0x4c55('0x9')][_0x31a5c4['uniqueid']])){this[_0x4c55('0x9')][_0x31a5c4[_0x4c55('0x22')]]={};}if(_['isUndefined'](this['channels'][_0x31a5c4[_0x4c55('0x22')]][_0x31a5c4[_0x4c55('0x24')]])){this[_0x4c55('0x9')][_0x31a5c4[_0x4c55('0x22')]][_0x31a5c4[_0x4c55('0x24')]]={'agentcalledAt':moment()['format'](_0x4c55('0x28')),'lastevent':_0x4c55('0x29'),'mandatoryDisposition':this[_0x4c55('0xa')][_0x31a5c4[_0x4c55('0x2a')]]?this[_0x4c55('0xa')][_0x31a5c4['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x4c55('0xa')][_0x31a5c4['queue']]?this[_0x4c55('0xa')][_0x31a5c4['queue']][_0x4c55('0x2b')]||_0x4c55('0x2c'):'inbound','variables':this['variables'][_0x31a5c4[_0x4c55('0x22')]]};}_[_0x4c55('0x2d')](this['channels'][_0x31a5c4[_0x4c55('0x22')]][_0x31a5c4['destuniqueid']],_['omit'](_0x31a5c4,['event',_0x4c55('0x2e')]));logger[_0x4c55('0x25')](_0x4c55('0x2f'),_0x31a5c4[_0x4c55('0x22')],util[_0x4c55('0x27')](this[_0x4c55('0x9')][_0x31a5c4['uniqueid']][_0x31a5c4[_0x4c55('0x24')]],{'showHidden':![],'depth':null}));ami[_0x4c55('0x1c')](_0x4c55('0x30'),this[_0x4c55('0x9')][_0x31a5c4['uniqueid']][_0x31a5c4[_0x4c55('0x24')]]);logger[_0x4c55('0x25')](_0x4c55('0x31'),_0x31a5c4['uniqueid'],util[_0x4c55('0x27')](this[_0x4c55('0x9')][_0x31a5c4['uniqueid']][_0x31a5c4[_0x4c55('0x24')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x4c55('0x32')]('user:%s',_0x31a5c4[_0x4c55('0x23')]),_0x4c55('0x33'),this[_0x4c55('0x9')][_0x31a5c4[_0x4c55('0x22')]][_0x31a5c4['destuniqueid']]);}}catch(_0x367cc6){logger[_0x4c55('0x34')]('[%s][voiceAgentReport][agentcalled]',_0x31a5c4[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x367cc6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')]['syncAgentConnect']=function(_0x2c186d){try{if(this[_0x4c55('0x1f')](_0x2c186d)){if(this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]]){logger[_0x4c55('0x25')](_0x4c55('0x35'),_0x2c186d[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x2c186d,{'showHidden':![],'depth':null}));for(var _0x2c8260 in this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]]){if(this[_0x4c55('0x9')][_0x2c186d['uniqueid']]['hasOwnProperty'](_0x2c8260)){if(_0x2c186d[_0x4c55('0x24')]===_0x2c8260){logger[_0x4c55('0x20')](_0x4c55('0x36'),_0x2c186d[_0x4c55('0x22')],_0x2c186d[_0x4c55('0x23')],_0x2c186d[_0x4c55('0x24')]);this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260][_0x4c55('0x37')]=moment()[_0x4c55('0x32')](_0x4c55('0x28'));this['channels'][_0x2c186d['uniqueid']][_0x2c8260][_0x4c55('0x38')]=_0x2c186d[_0x4c55('0x38')];this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['connectedlinenum']=_0x2c186d[_0x4c55('0x39')];this['channels'][_0x2c186d[_0x4c55('0x22')]][_0x2c8260][_0x4c55('0x3a')]=_0x2c186d[_0x4c55('0x3a')];this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260][_0x4c55('0x3b')]=_0x2c186d[_0x4c55('0x3b')];this['channels'][_0x2c186d[_0x4c55('0x22')]][_0x2c8260][_0x4c55('0x3c')]=_0x2c186d[_0x4c55('0x3c')];this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260][_0x4c55('0x3d')]=_0x4c55('0x3e');_[_0x4c55('0x2d')](this[_0x4c55('0xb')][_0x2c186d[_0x4c55('0x3f')]],_[_0x4c55('0x40')](_0x2c186d,['queue',_0x4c55('0x41')]));logger[_0x4c55('0x25')](_0x4c55('0x42'),_0x2c186d['uniqueid'],util[_0x4c55('0x27')](this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c186d['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x4c55('0x43'),this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c186d['destuniqueid']]);logger[_0x4c55('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2c186d['uniqueid'],util['inspect'](this['channels'][_0x2c186d[_0x4c55('0x22')]][_0x2c186d['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x4c55('0x32')](_0x4c55('0x44'),_0x2c186d[_0x4c55('0x23')]),'user:agentconnect',this['channels'][_0x2c186d[_0x4c55('0x22')]][_0x2c186d[_0x4c55('0x24')]]);}else if(!this['channels'][_0x2c186d[_0x4c55('0x22')]][_0x2c8260][_0x4c55('0x11')]&&!this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260][_0x4c55('0x45')]){logger[_0x4c55('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x2c186d['uniqueid'],this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['membername'],_0x2c8260);this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260][_0x4c55('0x11')]=!![];this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['agentringnoanswerAt']=moment()[_0x4c55('0x32')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['answeredelsewheredestinationuniqueid']=_0x2c186d[_0x4c55('0x24')];this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['answeredelsewheremembername']=_0x2c186d[_0x4c55('0x23')];this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260]['lastevent']=_0x4c55('0x46');this[_0x4c55('0x9')][_0x2c186d[_0x4c55('0x22')]][_0x2c8260]['reason']=_0x4c55('0x46');logger['debug'](_0x4c55('0x47'),_0x2c186d[_0x4c55('0x22')],util[_0x4c55('0x27')](this['channels'][_0x2c186d['uniqueid']][_0x2c8260],{'showHidden':![],'depth':null}));ami[_0x4c55('0x1c')]('custom:agentansweredelsewhere',this[_0x4c55('0x9')][_0x2c186d['uniqueid']][_0x2c8260]);}}}}}}catch(_0x4bd7bd){logger[_0x4c55('0x34')](_0x4c55('0x48'),_0x2c186d[_0x4c55('0x22')],util['inspect'](_0x4bd7bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x49')]=function(_0x327977){try{if(this['isNotNull'](_0x327977)){logger[_0x4c55('0x25')](_0x4c55('0x4a'),_0x327977['uniqueid'],util[_0x4c55('0x27')](_0x327977,{'showHidden':![],'depth':null}));if(this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]]&&this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]][_0x327977[_0x4c55('0x24')]]){logger[_0x4c55('0x20')](_0x4c55('0x4b'),_0x327977[_0x4c55('0x22')],_0x327977[_0x4c55('0x23')],_0x327977[_0x4c55('0x24')]);this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]][_0x327977[_0x4c55('0x24')]][_0x4c55('0x11')]=!![];this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]][_0x327977[_0x4c55('0x24')]][_0x4c55('0x4c')]=moment()['format'](_0x4c55('0x28'));this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]][_0x327977[_0x4c55('0x24')]][_0x4c55('0x3d')]=_0x4c55('0x4d');this['channels'][_0x327977[_0x4c55('0x22')]][_0x327977[_0x4c55('0x24')]][_0x4c55('0x4e')]=_0x4c55('0x4d');logger[_0x4c55('0x25')](_0x4c55('0x4f'),_0x327977['uniqueid'],util[_0x4c55('0x27')](this[_0x4c55('0x9')][_0x327977[_0x4c55('0x22')]][_0x327977['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x4c55('0x1c')](_0x4c55('0x50'),this[_0x4c55('0x9')][_0x327977['uniqueid']][_0x327977['destuniqueid']]);}}}catch(_0x1c28ab){logger[_0x4c55('0x34')](_0x4c55('0x51'),_0x327977['uniqueid'],util['inspect'](_0x1c28ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x13')]=function(_0x43e878){try{if(this[_0x4c55('0x1f')](_0x43e878)){logger[_0x4c55('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x43e878[_0x4c55('0x22')],util['inspect'](_0x43e878,{'showHidden':![],'depth':null}));if(this['channels'][_0x43e878[_0x4c55('0x22')]]){for(var _0x165c92 in this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]]){if(this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x4c55('0x52')](_0x165c92)&&!this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92][_0x4c55('0x11')]&&!this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92][_0x4c55('0x45')]){logger['info'](_0x4c55('0x53'),_0x43e878['uniqueid'],this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92][_0x4c55('0x23')],_0x165c92);this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92]['agentringnoanswer']=!![];this['channels'][_0x43e878['uniqueid']][_0x165c92]['agentringnoanswerAt']=moment()[_0x4c55('0x32')](_0x4c55('0x28'));this[_0x4c55('0x9')][_0x43e878['uniqueid']][_0x165c92][_0x4c55('0x3d')]='abandoned';this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92][_0x4c55('0x4e')]='abandoned';logger[_0x4c55('0x25')](_0x4c55('0x54'),_0x43e878[_0x4c55('0x22')],util[_0x4c55('0x27')](this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x4c55('0x9')][_0x43e878[_0x4c55('0x22')]][_0x165c92]);}}}}}catch(_0x28afa3){logger[_0x4c55('0x34')](_0x4c55('0x55'),_0x43e878[_0x4c55('0x22')],util['inspect'](_0x28afa3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x14')]=function(_0x53e715){try{if(this[_0x4c55('0x1f')](_0x53e715)){logger[_0x4c55('0x25')](_0x4c55('0x56'),_0x53e715[_0x4c55('0x22')],util['inspect'](_0x53e715,{'showHidden':![],'depth':null}));if(this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]]){for(var _0x3d3a70 in this['channels'][_0x53e715[_0x4c55('0x22')]]){if(this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x4c55('0x52')](_0x3d3a70)){if(this['channels'][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x37')]&&!this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70]['agentcomplete']){logger['info'](_0x4c55('0x57'),_0x53e715[_0x4c55('0x22')],this['channels'][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x23')],_0x3d3a70);this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x45')]=!![];this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x58')]=moment()[_0x4c55('0x32')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x3d')]=_0x4c55('0x59');this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x4e')]=_0x53e715[_0x4c55('0x4e')]==_0x4c55('0x5a')?'agent':_0x53e715[_0x4c55('0x4e')];this[_0x4c55('0x9')][_0x53e715[_0x4c55('0x22')]][_0x3d3a70][_0x4c55('0x5b')]=_0x53e715['talktime'];if(this['voiceQueues'][_0x53e715['queue']]&&this[_0x4c55('0xa')][_0x53e715[_0x4c55('0x2a')]][_0x4c55('0x5c')]){this[_0x4c55('0x9')][_0x53e715['uniqueid']][_0x3d3a70][_0x4c55('0x5d')]=this[_0x4c55('0xa')][_0x53e715[_0x4c55('0x2a')]]['acwTimeout'];this[_0x4c55('0x9')][_0x53e715['uniqueid']][_0x3d3a70]['agentacw']=!![];}this['agents'][_0x53e715[_0x4c55('0x3f')]]=_['omit'](this[_0x4c55('0xb')][_0x53e715[_0x4c55('0x3f')]],[_0x4c55('0x2a'),'destconnectedlinenum']);logger[_0x4c55('0x25')](_0x4c55('0x5e'),_0x53e715['uniqueid'],util['inspect'](this['channels'][_0x53e715[_0x4c55('0x22')]][_0x3d3a70],{'showHidden':![],'depth':null}));ami[_0x4c55('0x1c')](_0x4c55('0x5f'),this['channels'][_0x53e715[_0x4c55('0x22')]][_0x3d3a70]);logger[_0x4c55('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x53e715[_0x4c55('0x22')],util[_0x4c55('0x27')](this['channels'][_0x53e715[_0x4c55('0x22')]][_0x3d3a70],{'showHidden':![],'depth':null}));this[_0x4c55('0x1c')](util[_0x4c55('0x32')](_0x4c55('0x44'),_0x53e715[_0x4c55('0x23')]),_0x4c55('0x60'),this[_0x4c55('0x9')][_0x53e715['uniqueid']][_0x3d3a70]);}}}}}}catch(_0x4474fe){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x53e715[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x4474fe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')]['syncVarSet']=function(_0x34b4ba){try{if(this[_0x4c55('0x1f')](_0x34b4ba)){logger[_0x4c55('0x25')](_0x4c55('0x61'),_0x34b4ba[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x34b4ba,{'showHidden':![],'depth':null}));this[_0x4c55('0x62')](_0x34b4ba[_0x4c55('0x22')],_[_0x4c55('0x63')](_0x34b4ba['variable'])[0x0],_0x34b4ba['value']);if(this[_0x4c55('0x9')][_0x34b4ba['uniqueid']]){for(var _0x23f3df in this[_0x4c55('0x9')][_0x34b4ba['uniqueid']]){if(this[_0x4c55('0x9')][_0x34b4ba[_0x4c55('0x22')]][_0x4c55('0x52')](_0x23f3df)){logger[_0x4c55('0x20')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x34b4ba[_0x4c55('0x22')],_0x23f3df,_[_0x4c55('0x63')](_0x34b4ba[_0x4c55('0x64')])[0x0],_0x34b4ba[_0x4c55('0x65')]);if(_[_0x4c55('0x1e')](this[_0x4c55('0x9')][_0x34b4ba[_0x4c55('0x22')]][_0x23f3df][_0x4c55('0x66')])){this[_0x4c55('0x9')][_0x34b4ba[_0x4c55('0x22')]][_0x23f3df][_0x4c55('0x66')]={};}this[_0x4c55('0x9')][_0x34b4ba[_0x4c55('0x22')]][_0x23f3df][_0x4c55('0x66')]=this[_0x4c55('0x66')][_0x34b4ba['uniqueid']];}}}}}catch(_0x527967){logger[_0x4c55('0x34')](_0x4c55('0x67'),_0x34b4ba['uniqueid'],util['inspect'](_0x527967,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x62')]=function(_0x19d648,_0x4955ce,_0x1b3ee6){var _0x3abc27=[_0x4c55('0x68'),_0x4c55('0x69'),'rtpaudioqosjitter',_0x4c55('0x6a'),_0x4c55('0x6b'),_0x4c55('0x6c'),'rtpaudioqosrtt',_0x4c55('0x6d'),'sipcallid',_0x4c55('0x6e'),_0x4c55('0x6f'),_0x4c55('0x70'),_0x4c55('0x71'),_0x4c55('0x72'),_0x4c55('0x73'),_0x4c55('0x74'),_0x4c55('0x23'),_0x4c55('0x75'),_0x4c55('0x76')];if(!_['isNil'](_0x4955ce)&&!_[_0x4c55('0x77')](_0x3abc27,_0x4955ce)){if(_['isUndefined'](this[_0x4c55('0x66')][_0x19d648])){this[_0x4c55('0x66')][_0x19d648]={};}this['variables'][_0x19d648][_0x4955ce]=_0x1b3ee6;}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x78')]=function(_0x5e1158){try{if(this[_0x4c55('0x1f')](_0x5e1158)){logger[_0x4c55('0x25')](_0x4c55('0x79'),_0x5e1158[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x5e1158,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e1158[_0x4c55('0x22')]]){for(var _0x5f2e54 in this['channels'][_0x5e1158[_0x4c55('0x22')]]){if(this[_0x4c55('0x9')][_0x5e1158[_0x4c55('0x22')]]['hasOwnProperty'](_0x5f2e54)){if(this[_0x4c55('0x9')][_0x5e1158['uniqueid']][_0x5f2e54]['reason']==_0x4c55('0x5a')&&this[_0x4c55('0x9')][_0x5e1158[_0x4c55('0x22')]][_0x5f2e54][_0x4c55('0x45')]){logger['info'](_0x4c55('0x7a'),_0x5e1158[_0x4c55('0x22')],_0x5f2e54);this['channels'][_0x5e1158[_0x4c55('0x22')]][_0x5f2e54]['agentcompleteAt']=moment()[_0x4c55('0x32')](_0x4c55('0x28'));}}}logger['debug'](_0x4c55('0x7b'),_0x5e1158[_0x4c55('0x22')],util[_0x4c55('0x27')](_[_0x4c55('0x7c')](this['channels'][_0x5e1158['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x4c55('0x1c')](_0x4c55('0x7d'),_['values'](this[_0x4c55('0x9')][_0x5e1158[_0x4c55('0x22')]]));delete this[_0x4c55('0x9')][_0x5e1158[_0x4c55('0x22')]];}if(this['variables'][_0x5e1158['uniqueid']]){delete this[_0x4c55('0x66')][_0x5e1158[_0x4c55('0x22')]];}}}catch(_0x1b413e){logger[_0x4c55('0x34')](_0x4c55('0x7e'),_0x5e1158['uniqueid'],util[_0x4c55('0x27')](_0x1b413e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4c55('0x1a')]=function(_0x3b5b91){try{if(this['isNotNull'](_0x3b5b91)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x3b5b91[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x3b5b91,{'showHidden':![],'depth':null}));if(this[_0x4c55('0x9')][_0x3b5b91['transfereeuniqueid']]){for(var _0x43c107 in this[_0x4c55('0x9')][_0x3b5b91[_0x4c55('0x7f')]]){if(this['channels'][_0x3b5b91[_0x4c55('0x7f')]][_0x4c55('0x52')](_0x43c107)){if(_0x3b5b91[_0x4c55('0x80')]===_0x43c107){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3b5b91[_0x4c55('0x22')],this[_0x4c55('0x9')][_0x3b5b91[_0x4c55('0x7f')]][_0x43c107][_0x4c55('0x23')],_0x43c107);var _0xccfce9=moment();this['channels'][_0x3b5b91[_0x4c55('0x7f')]][_0x43c107][_0x4c55('0x45')]=!![];this['channels'][_0x3b5b91[_0x4c55('0x7f')]][_0x43c107][_0x4c55('0x58')]=moment()['format'](_0x4c55('0x28'));this['channels'][_0x3b5b91['transfereeuniqueid']][_0x43c107]['lastevent']=_0x4c55('0x59');this['channels'][_0x3b5b91[_0x4c55('0x7f')]][_0x43c107]['reason']=_0x4c55('0x5a');this[_0x4c55('0x9')][_0x3b5b91[_0x4c55('0x7f')]][_0x43c107][_0x4c55('0x5b')]=_0xccfce9[_0x4c55('0x81')](this[_0x4c55('0x9')][_0x3b5b91['transfereeuniqueid']][_0x43c107][_0x4c55('0x37')],_0x4c55('0x82'));}}}}if(this[_0x4c55('0x9')][_0x3b5b91['secondtransfereruniqueid']]){var _0x286e31=this[_0x4c55('0x9')][_0x3b5b91[_0x4c55('0x83')]];this[_0x4c55('0x9')][_0x3b5b91['secondtransfereruniqueid']]=this[_0x4c55('0x9')][_0x3b5b91[_0x4c55('0x7f')]];this['channels'][_0x3b5b91[_0x4c55('0x7f')]]=_0x286e31;}}}catch(_0x4ada6a){logger[_0x4c55('0x34')](_0x4c55('0x84'),_0x3b5b91['uniqueid'],util['inspect'](_0x4ada6a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x1b')]=function(_0x1ddb89){try{if(this[_0x4c55('0x1f')](_0x1ddb89)){logger[_0x4c55('0x25')](_0x4c55('0x85'),_0x1ddb89['uniqueid'],util[_0x4c55('0x27')](_0x1ddb89,{'showHidden':![],'depth':null}));if(this[_0x4c55('0x9')][_0x1ddb89['transfereeuniqueid']]){for(var _0x2cd0f3 in this['channels'][_0x1ddb89['transfereeuniqueid']]){if(this['channels'][_0x1ddb89[_0x4c55('0x7f')]]['hasOwnProperty'](_0x2cd0f3)){if(_0x1ddb89['transfereruniqueid']===_0x2cd0f3){logger[_0x4c55('0x20')](_0x4c55('0x86'),_0x1ddb89[_0x4c55('0x22')],this[_0x4c55('0x9')][_0x1ddb89['transfereeuniqueid']][_0x2cd0f3][_0x4c55('0x23')],_0x2cd0f3);var _0x2dc558=moment();this['channels'][_0x1ddb89['transfereeuniqueid']][_0x2cd0f3][_0x4c55('0x45')]=!![];this[_0x4c55('0x9')][_0x1ddb89[_0x4c55('0x7f')]][_0x2cd0f3][_0x4c55('0x58')]=_0x2dc558;this[_0x4c55('0x9')][_0x1ddb89[_0x4c55('0x7f')]][_0x2cd0f3][_0x4c55('0x3d')]=_0x4c55('0x59');this['channels'][_0x1ddb89[_0x4c55('0x7f')]][_0x2cd0f3][_0x4c55('0x4e')]=_0x4c55('0x5a');this[_0x4c55('0x9')][_0x1ddb89[_0x4c55('0x7f')]][_0x2cd0f3][_0x4c55('0x5b')]=_0x2dc558[_0x4c55('0x81')](this[_0x4c55('0x9')][_0x1ddb89['transfereeuniqueid']][_0x2cd0f3][_0x4c55('0x37')],_0x4c55('0x82'));}}}}}}catch(_0xed6207){logger[_0x4c55('0x34')]('[%s][voiceAgentReport][blindtransfer]',_0x1ddb89[_0x4c55('0x22')],util[_0x4c55('0x27')](_0xed6207,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x17')]=function(_0x53516d){var _0x5ad8e3='';try{if(this[_0x4c55('0x1f')](_0x53516d)){logger['debug'](_0x4c55('0x87'),_0x53516d[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x53516d,{'showHidden':![],'depth':null}));if(_0x53516d['channel']){_0x5ad8e3=_0x53516d['channel'][_0x4c55('0x88')](0x0,_0x53516d[_0x4c55('0x89')][_0x4c55('0x8a')]('-'));if(this[_0x4c55('0xb')][_0x5ad8e3]){logger['info'](_0x4c55('0x8b'),_0x53516d[_0x4c55('0x22')],_0x5ad8e3);this[_0x4c55('0xb')][_0x5ad8e3][_0x4c55('0x8c')]=!![];}}}}catch(_0x108002){logger[_0x4c55('0x34')](_0x4c55('0x8d'),_0x53516d[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x108002,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c55('0x1d')][_0x4c55('0x18')]=function(_0x1d8cc7){var _0x888df2='';try{if(this[_0x4c55('0x1f')](_0x1d8cc7)){logger['debug'](_0x4c55('0x8e'),_0x1d8cc7['uniqueid'],util[_0x4c55('0x27')](_0x1d8cc7,{'showHidden':![],'depth':null}));if(_0x1d8cc7[_0x4c55('0x89')]){_0x888df2=_0x1d8cc7[_0x4c55('0x89')][_0x4c55('0x88')](0x0,_0x1d8cc7[_0x4c55('0x89')][_0x4c55('0x8a')]('-'));if(this[_0x4c55('0xb')][_0x888df2]){logger[_0x4c55('0x20')](_0x4c55('0x8f'),_0x1d8cc7[_0x4c55('0x22')],_0x888df2);this['agents'][_0x888df2]['onhold']=![];}}}}catch(_0x568785){logger[_0x4c55('0x34')](_0x4c55('0x90'),_0x1d8cc7[_0x4c55('0x22')],util[_0x4c55('0x27')](_0x568785,{'showHidden':![],'depth':null}));}};module[_0x4c55('0x91')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index c537b63..45543b7 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 _0xdba8=['busy','invalid','ringing','onhold','set','agi','dial','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','error','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','disposition','toNumber','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','applicationdata','application','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','calleridnum','destinationchannel','channelstate','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','resolve','StopMixMonitor','catch','Action','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','diff','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','lodash','moment','ioredis','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse'];(function(_0x27ba82,_0x14ca56){var _0x4629d4=function(_0x31f9d3){while(--_0x31f9d3){_0x27ba82['push'](_0x27ba82['shift']());}};_0x4629d4(++_0x14ca56);}(_0xdba8,0x179));var _0x8dba=function(_0x4a9f36,_0x7a92a1){_0x4a9f36=_0x4a9f36-0x0;var _0x4097ee=_0xdba8[_0x4a9f36];return _0x4097ee;};'use strict';var BPromise=require(_0x8dba('0x0'));var _=require(_0x8dba('0x1'));var moment=require(_0x8dba('0x2'));var util=require('util');var path=require('path');var Redis=require(_0x8dba('0x3'));var config=require('../../../config/environment');var logger=require(_0x8dba('0x4'))(_0x8dba('0x5'));var ami=require('../ami');var Channel=require(_0x8dba('0x6'));var RpcSetting=require(_0x8dba('0x7'));var statusDesc=[_0x8dba('0x8'),_0x8dba('0x9'),_0x8dba('0xa'),_0x8dba('0xb'),_0x8dba('0xc'),'unavailable',_0x8dba('0xd'),'ringinuse',_0x8dba('0xe')];var applications=[_0x8dba('0xf'),'queue',_0x8dba('0x10'),_0x8dba('0x11'),'playback',_0x8dba('0x12')];var dispositions=['NO\x20ANSWER',_0x8dba('0x13'),'FAILED','NO\x20ANSWER',_0x8dba('0x14'),_0x8dba('0x14'),'ANSWERED',_0x8dba('0x15'),'FAILED',_0x8dba('0x13'),_0x8dba('0x13')];var actions={};config[_0x8dba('0x16')]=_['defaults'](config[_0x8dba('0x16')],{'host':_0x8dba('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8dba('0x16')]));function VoiceCallReport(_0x4625f2){this[_0x8dba('0x18')]=_0x4625f2['channels'];this[_0x8dba('0x19')]=_0x4625f2[_0x8dba('0x19')];this[_0x8dba('0x1a')]={};ami['on'](_0x8dba('0x1b'),this[_0x8dba('0x1c')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x1e'),this['syncNewExten'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x1f'),this['syncNewChannel'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x20'),this[_0x8dba('0x21')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x22'),this[_0x8dba('0x23')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x24'),this[_0x8dba('0x25')]['bind'](this));ami['on'](_0x8dba('0x26'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x27'),this[_0x8dba('0x28')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x29'),this[_0x8dba('0x2a')][_0x8dba('0x1d')](this));ami['on'](_0x8dba('0x2b'),this['syncMusicOnHoldStop'][_0x8dba('0x1d')](this));try{logger['info'](_0x8dba('0x2c'));ami['actionCoreShowChannels']();}catch(_0x1156c6){logger[_0x8dba('0x2d')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x1156c6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x2f')]=function(_0x3f1ec4){return _0x3f1ec4!==null&&!_[_0x8dba('0x30')](_0x3f1ec4);};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x31')]=function(_0x130ee5,_0x389236,_0x357290){io['to'](_0x130ee5)[_0x8dba('0x31')](_0x389236,_0x357290);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x561dfb){try{if(this['isNotNull'](_0x561dfb)){logger[_0x8dba('0x32')](_0x8dba('0x33'),_0x561dfb[_0x8dba('0x34')],_0x561dfb[_0x8dba('0x35')],_0x561dfb['calleridnum']);logger[_0x8dba('0x36')](_0x8dba('0x37'),_0x561dfb[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x561dfb,{'showHidden':![],'depth':null}));if(_0x561dfb[_0x8dba('0x34')]===_0x561dfb[_0x8dba('0x39')]){if(!_[_0x8dba('0x30')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]])){_[_0x8dba('0x3a')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x561dfb,_[_0x8dba('0x3c')](this[_0x8dba('0x18')][_0x561dfb[_0x8dba('0x34')]])));}}}}catch(_0xd5d805){logger[_0x8dba('0x2d')](_0x8dba('0x3d'),_0x561dfb['uniqueid'],util[_0x8dba('0x38')](_0xd5d805,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x3e')]=function(_0x4a6088){try{if(this[_0x8dba('0x2f')](_0x4a6088)){logger[_0x8dba('0x36')]('[%s][voiceCallReport][newchannel]\x20event:',_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x4a6088,{'showHidden':![],'depth':null}));if(_0x4a6088[_0x8dba('0x34')]===_0x4a6088[_0x8dba('0x39')]&&_0x4a6088[_0x8dba('0x3f')]!=_0x8dba('0x40')){if(_[_0x8dba('0x30')](this['channels'][_0x4a6088['uniqueid']])){logger['info'](_0x8dba('0x41'),_0x4a6088[_0x8dba('0x34')],_0x4a6088[_0x8dba('0x42')],_0x4a6088[_0x8dba('0x43')]);this['channels'][_0x4a6088[_0x8dba('0x34')]]=new Channel();this[_0x8dba('0x18')][_0x4a6088['uniqueid']][_0x8dba('0x44')]=moment()[_0x8dba('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4a6088[_0x8dba('0x34')]][_0x8dba('0x46')]=dispositions[_[_0x8dba('0x47')](_0x4a6088['channelstate'])];_['merge'](this[_0x8dba('0x18')][_0x4a6088[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x4a6088,_[_0x8dba('0x3c')](this['channels'][_0x4a6088['uniqueid']])));if(_0x4a6088['context']==='from-sip'){if(this[_0x8dba('0x19')][_0x4a6088['channel']['split']('-')[0x0]]){this[_0x8dba('0x19')][_0x4a6088[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['destconnectedlinenum']=_0x4a6088[_0x8dba('0x43')];logger['debug'](_0x8dba('0x49'),_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')]({'destaccountcode':this['agents'][_0x4a6088[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4a')],'destconnectedlinenum':_0x4a6088[_0x8dba('0x43')]},{'showHidden':![],'depth':null}));this[_0x8dba('0x31')](util[_0x8dba('0x45')](_0x8dba('0x4b'),this['agents'][_0x4a6088[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')]),_0x8dba('0x4d'),{'destaccountcode':this[_0x8dba('0x19')][_0x4a6088[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4a')],'destconnectedlinenum':_0x4a6088[_0x8dba('0x43')]});}}}}}}catch(_0x237949){logger['error'](_0x8dba('0x4e'),_0x4a6088[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x237949,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x1c')]=function(_0x243def){try{if(this[_0x8dba('0x2f')](_0x243def)){logger['debug'](_0x8dba('0x4f'),_0x243def['uniqueid'],util[_0x8dba('0x38')](_0x243def,{'showHidden':![],'depth':null}));if(_0x243def[_0x8dba('0x34')]===_0x243def['linkedid']&&_0x243def['exten']!='h'&&_0x243def[_0x8dba('0x3f')]!=_0x8dba('0x40')){_0x243def['application']=_0x243def['application'][_0x8dba('0x50')]();_0x243def[_0x8dba('0x51')]=(_0x243def['appdata']||_0x243def[_0x8dba('0x51')])[_0x8dba('0x50')]();logger[_0x8dba('0x32')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x243def[_0x8dba('0x34')],_0x243def[_0x8dba('0x52')],_0x243def['applicationdata']);if(_[_0x8dba('0x30')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]])){this['channels'][_0x243def[_0x8dba('0x34')]]=new Channel();this[_0x8dba('0x18')][_0x243def['uniqueid']]['starttime']=_0x243def[_0x8dba('0x53')]?moment()[_0x8dba('0x54')](moment[_0x8dba('0x53')](_0x243def[_0x8dba('0x53')])[_0x8dba('0x55')](),_0x8dba('0x55'))[_0x8dba('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x8dba('0x45')](_0x8dba('0x56'));this[_0x8dba('0x18')][_0x243def['uniqueid']]['disposition']=_0x8dba('0x14');}_[_0x8dba('0x3a')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]],_[_0x8dba('0x3b')](_0x243def,_[_0x8dba('0x3c')](this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]])));if(_[_0x8dba('0x57')](applications,_0x243def[_0x8dba('0x52')])){this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x8dba('0x58')]=_0x243def[_0x8dba('0x52')];this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x8dba('0x59')]=_0x243def[_0x8dba('0x51')];if(_0x243def[_0x8dba('0x52')]===_0x8dba('0xf')&&_[_0x8dba('0x5a')](_0x243def['applicationdata'],_0x8dba('0x5b'))){var _0x27094d=_0x243def['applicationdata'][_0x8dba('0x48')]('=');var _0x44b846=_0x27094d[0x0][_0x8dba('0x5c')](/cdr\((.*)\)/);if(_0x44b846){this[_0x8dba('0x18')][_0x243def[_0x8dba('0x34')]][_0x44b846[0x1]]=_0x27094d[0x1];}}else if(_0x243def[_0x8dba('0x52')]===_0x8dba('0x5d')){this['channels'][_0x243def[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x243def['applicationdata'][_0x8dba('0x48')](',')[0x0];}}}}}catch(_0x589093){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][newexten]',_0x243def['uniqueid'],util[_0x8dba('0x38')](_0x589093,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')]['syncNewState']=function(_0x46863c){try{if(this[_0x8dba('0x2f')](_0x46863c)){logger[_0x8dba('0x32')](_0x8dba('0x5e'),_0x46863c[_0x8dba('0x34')],_0x46863c['linkedid'],_0x46863c[_0x8dba('0x35')],_0x46863c['calleridnum']);logger[_0x8dba('0x36')](_0x8dba('0x5f'),_0x46863c[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x46863c,{'showHidden':![],'depth':null}));if(_0x46863c[_0x8dba('0x34')]!==_0x46863c[_0x8dba('0x39')]){if(this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]){if(_0x46863c['channelstate']==='6'){if(!this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x60')]){var _0x1d6c64=moment();this['channels'][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x60')]=!![];this[_0x8dba('0x18')][_0x46863c['linkedid']][_0x8dba('0x61')]=_0x1d6c64['format'](_0x8dba('0x56'));if(this[_0x8dba('0x18')][_0x46863c['linkedid']]['starttime']){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['holdtime']=_0x1d6c64['diff'](this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['starttime'],'seconds');}}this['channels'][_0x46863c['linkedid']][_0x8dba('0x39')]=_0x46863c[_0x8dba('0x34')];if(_0x46863c[_0x8dba('0x62')]!=='xcally-motion-preview'){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]]['connectedlinenum']=_0x46863c[_0x8dba('0x62')];}this[_0x8dba('0x18')][_0x46863c['linkedid']]['connectedlinename']=_0x46863c[_0x8dba('0x35')];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x63')]=_0x46863c[_0x8dba('0x3f')];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x46')]=dispositions[_[_0x8dba('0x47')](_0x46863c[_0x8dba('0x64')])];if(this['agents'][_0x46863c[_0x8dba('0x3f')]['split']('-')[0x0]]){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x65')]=this['agents'][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['id'];this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x39')]][_0x8dba('0x66')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')];}}}}else{if(this['channels'][_0x46863c[_0x8dba('0x34')]]){if(_0x46863c['channelstate']==='6'){if(this['agents'][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]){this[_0x8dba('0x18')][_0x46863c[_0x8dba('0x34')]][_0x8dba('0x65')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['id'];this[_0x8dba('0x18')][_0x46863c['uniqueid']][_0x8dba('0x66')]=this[_0x8dba('0x19')][_0x46863c[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]][_0x8dba('0x4c')];}}}}}}catch(_0x4eedd3){logger[_0x8dba('0x2d')](_0x8dba('0x67'),_0x46863c[_0x8dba('0x34')],util['inspect'](_0x4eedd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x68')]=function(_0x19e7e9,_0x550c3a){try{if(this[_0x8dba('0x18')][_0x19e7e9]){logger[_0x8dba('0x32')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x19e7e9,_0x550c3a);this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x69')]=!![];if(_[_0x8dba('0x6a')](_0x550c3a,'.wav49')){_0x550c3a=_0x550c3a[_0x8dba('0x6b')](_0x8dba('0x6c'),_0x8dba('0x6d'));}this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x6e')]=_0x550c3a;var _0x5adb8a=_[_0x8dba('0x6f')](this['channels'][_0x19e7e9][_0x8dba('0x70')],{'filename':_0x550c3a});if(_[_0x8dba('0x71')](_0x5adb8a)){this[_0x8dba('0x18')][_0x19e7e9][_0x8dba('0x70')][_0x8dba('0x72')]({'filename':_0x550c3a,'createdAt':moment()[_0x8dba('0x45')](_0x8dba('0x56')),'mixmonitorid':'','status':'rec'});}}}catch(_0x332fb4){logger['error'](_0x8dba('0x73'),_0x19e7e9,util[_0x8dba('0x38')](_0x332fb4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x23')]=function(_0x28e313){try{if(this[_0x8dba('0x2f')](_0x28e313)){logger['debug']('[%s][voiceCallReport][varset]\x20event:',_0x28e313['uniqueid'],util[_0x8dba('0x38')](_0x28e313,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x28e313['uniqueid']]&&_0x28e313[_0x8dba('0x3f')]!=_0x8dba('0x40')){if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')])){if(this['isNotNull'](_0x28e313[_0x8dba('0x74')][_0x8dba('0x75')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this['syncMixMonitorFilename'](_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-phone'])){logger[_0x8dba('0x32')](_0x8dba('0x77'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']][_0x8dba('0x62')]=_0x28e313[_0x8dba('0x76')];}else if(this['isNotNull'](_0x28e313['variable'][_0x8dba('0x78')])){logger['info'](_0x8dba('0x79'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']]['callerid']=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')][_0x8dba('0x7a')])){logger[_0x8dba('0x32')](_0x8dba('0x7b'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x7c')]=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')][_0x8dba('0x48')](',')[0x0]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x28e313[_0x8dba('0x76')][_0x8dba('0x48')](',')[0x0];}else if(this['isNotNull'](_0x28e313[_0x8dba('0x74')]['xmd-originatecalleridnum'])){logger[_0x8dba('0x32')](_0x8dba('0x7d'),_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313['uniqueid']]['originatecalleridnum']=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313['variable']['xmd-destination'])){logger['info'](_0x8dba('0x7e'),_0x28e313['uniqueid'],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x7f')]=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')]['xmd-callerid-preview'])){logger[_0x8dba('0x32')](_0x8dba('0x80'),_0x28e313[_0x8dba('0x34')],_0x28e313[_0x8dba('0x76')]);this['channels'][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x81')]=_0x28e313[_0x8dba('0x76')];}else if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')][_0x8dba('0x82')])){logger[_0x8dba('0x32')](_0x8dba('0x83'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x5d')]=_0x28e313['value'];}else if(this[_0x8dba('0x2f')](_0x28e313['variable']['sipcallid'])){logger[_0x8dba('0x32')](_0x8dba('0x84'),_0x28e313[_0x8dba('0x34')],_0x28e313['value']);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x34')]][_0x8dba('0x85')]=_0x28e313[_0x8dba('0x76')];}}}else if(this[_0x8dba('0x2f')](_0x28e313['variable'][_0x8dba('0x75')])){if(_0x28e313[_0x8dba('0x76')]){var _0x19f440=path[_0x8dba('0x86')](_0x28e313[_0x8dba('0x76')])[_0x8dba('0x4c')];logger['info'](_0x8dba('0x87'),_0x19f440,_0x28e313['value']);this['syncMixMonitorFilename'](_0x19f440,_0x28e313[_0x8dba('0x76')]);}}else if(this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x39')]]){if(this[_0x8dba('0x2f')](_0x28e313[_0x8dba('0x74')])){if(this[_0x8dba('0x2f')](_0x28e313['variable']['sipcallid'])){logger[_0x8dba('0x32')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x28e313[_0x8dba('0x39')],_0x28e313[_0x8dba('0x76')]);this[_0x8dba('0x18')][_0x28e313[_0x8dba('0x39')]][_0x8dba('0x88')]=_0x28e313['value'];}}}}}catch(_0x1ccd7d){logger[_0x8dba('0x2d')](_0x8dba('0x89'),_0x28e313[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x1ccd7d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0x25')]=function(_0x4e33ed){try{if(this[_0x8dba('0x2f')](_0x4e33ed)){logger[_0x8dba('0x36')](_0x8dba('0x8a'),_0x4e33ed[_0x8dba('0x34')],util['inspect'](_0x4e33ed,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e33ed[_0x8dba('0x34')]]){logger[_0x8dba('0x32')](_0x8dba('0x8b'),_0x4e33ed['uniqueid'],_0x4e33ed[_0x8dba('0x8c')]);var _0x1554b1=moment();this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x8d')]=_0x1554b1[_0x8dba('0x45')](_0x8dba('0x56'));this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x53')]=_0x1554b1['diff'](this['channels'][_0x4e33ed[_0x8dba('0x34')]]['starttime'],'seconds');if(this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x60')]){this['channels'][_0x4e33ed[_0x8dba('0x34')]]['billableseconds']=_0x1554b1['diff'](this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x61')],_0x8dba('0x55'));this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]['holdtime']=this['channels'][_0x4e33ed[_0x8dba('0x34')]]['duration']-this[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x8e')];}if(_0x4e33ed[_0x8dba('0x42')]===_0x8dba('0x8f')){if(this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]){this[_0x8dba('0x19')][_0x4e33ed['channel'][_0x8dba('0x48')]('-')[0x0]]=_[_0x8dba('0x90')](this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]],['destconnectedlinenum']);logger[_0x8dba('0x36')](_0x8dba('0x91'),_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')]({'destaccountcode':this['agents'][_0x4e33ed[_0x8dba('0x3f')][_0x8dba('0x48')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x8dba('0x31')](util[_0x8dba('0x45')](_0x8dba('0x4b'),this[_0x8dba('0x19')][_0x4e33ed[_0x8dba('0x3f')]['split']('-')[0x0]][_0x8dba('0x4c')]),_0x8dba('0x92'),{'destaccountcode':this['agents'][_0x4e33ed[_0x8dba('0x3f')]['split']('-')[0x0]]['accountcode']});}}var _0x2d6ada=this;Promise['resolve']()[_0x8dba('0x93')](function(){var _0xb06afd=_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]];if(typeof _0xb06afd[_0x8dba('0x94')]===_0x8dba('0x95'))return;if(_[_0x8dba('0x96')](_0xb06afd[_0x8dba('0x70')]))return;return RpcSetting[_0x8dba('0x97')]()['then'](function(_0x43f1b5){if(!_0x43f1b5[_0x8dba('0x98')])return;return Promise[_0x8dba('0x99')]()[_0x8dba('0x93')](function(){return ami['Action']({'action':_0x8dba('0x9a'),'channel':_0xb06afd[_0x8dba('0x3f')]})[_0x8dba('0x9b')](function(){});})[_0x8dba('0x93')](function(){return ami[_0x8dba('0x9c')]({'action':_0x8dba('0x9a'),'channel':_0xb06afd[_0x8dba('0x63')]})[_0x8dba('0x9b')](function(){})['finally'](function(){var _0x34bcdb=_0x2d6ada[_0x8dba('0x19')][_0xb06afd[_0x8dba('0x63')][_0x8dba('0x48')]('-')[0x0]];if(!_0x34bcdb)return;io[_0x8dba('0x31')](_0x8dba('0x9d'),{'agentId':_0x34bcdb['id'],'uniqueid':_0xb06afd['uniqueid']});});});});})[_0x8dba('0x93')](function(){if(_0x4e33ed[_0x8dba('0x9e')]===_0x8dba('0x9f')){_0x2d6ada[_0x8dba('0x1a')][_0x4e33ed[_0x8dba('0x34')]]=_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]];}else{if(_0x2d6ada['channels'][_0x4e33ed['uniqueid']][_0x8dba('0x7c')]==='outbound'&&_0x2d6ada[_0x8dba('0x1a')][_0x4e33ed[_0x8dba('0x34')]]){_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]]['uniqueid']=[_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x39')],_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]][_0x8dba('0x39')]=_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]['uniqueid']][0x0];delete _0x2d6ada['blindTransfers'][_0x4e33ed[_0x8dba('0x34')]];}}logger[_0x8dba('0x36')](_0x8dba('0xa0'),_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x2d6ada['channels'][_0x4e33ed[_0x8dba('0x34')]],{'showHidden':![],'depth':null}));ami[_0x8dba('0x31')]('custom:voiceCallReport',_0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]]);delete _0x2d6ada[_0x8dba('0x18')][_0x4e33ed[_0x8dba('0x34')]];});}}}catch(_0x4efb42){logger['error']('[%s][voiceCallReport][hangup]',_0x4e33ed[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x4efb42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0xa1')]=function(_0x40324f){try{if(this[_0x8dba('0x2f')](_0x40324f)){logger[_0x8dba('0x32')](_0x8dba('0xa2'),_0x40324f[_0x8dba('0x34')],_0x40324f['origtransferercalleridnum'],_0x40324f[_0x8dba('0xa3')]);logger[_0x8dba('0x36')](_0x8dba('0xa4'),_0x40324f['uniqueid'],util[_0x8dba('0x38')](_0x40324f,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]){this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]][_0x8dba('0xa6')]=_0x40324f[_0x8dba('0xa7')];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]['transferconnectedlinenum']=_0x40324f['transfertargetcalleridnum'];if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]){var _0x51cf44=this['channels'][_0x40324f[_0x8dba('0xa8')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]=this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa5')]]=_0x51cf44;}}else if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]]){this[_0x8dba('0x18')][_0x40324f['transfertargetuniqueid']][_0x8dba('0xa6')]=_0x40324f[_0x8dba('0xa7')];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]][_0x8dba('0xaa')]=_0x40324f[_0x8dba('0xa3')];if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]]){var _0x51cf44=this['channels'][_0x40324f[_0x8dba('0xab')]];this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]]=this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa9')]];this[_0x8dba('0x18')][_0x40324f['transfertargetuniqueid']]=_0x51cf44;}}if((this['channels'][_0x40324f[_0x8dba('0xab')]]||this['channels'][_0x40324f['origtransfererlinkedid']])&&this[_0x8dba('0x18')][_0x40324f['secondtransfereruniqueid']]){var _0x4dc392=_['some']([this[_0x8dba('0x18')][_0x40324f['origtransfereruniqueid']],this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]],this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]]],function(_0x143e0e){return _0x143e0e&&_0x143e0e[_0x8dba('0x7c')]===_0x8dba('0xad')&&_0x143e0e[_0x8dba('0xae')];});if(_0x4dc392){if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xab')]])this['channels'][_0x40324f[_0x8dba('0xab')]]['transferType']='ATTENDED';if(this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]])this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xac')]]['transferType']=_0x8dba('0xaf');this[_0x8dba('0x18')][_0x40324f[_0x8dba('0xa8')]][_0x8dba('0x94')]=_0x8dba('0xaf');}}}}catch(_0x3587ba){logger[_0x8dba('0x2d')](_0x8dba('0xb0'),_0x40324f[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x3587ba,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8dba('0x28')]=function(_0x31c780){try{if(this['isNotNull'](_0x31c780)){logger[_0x8dba('0x32')](_0x8dba('0xb1'),_0x31c780[_0x8dba('0x34')],_0x31c780[_0x8dba('0xb2')],_0x31c780[_0x8dba('0xb3')]);logger[_0x8dba('0x36')](_0x8dba('0xb4'),_0x31c780[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x31c780,{'showHidden':![],'depth':null}));if(this['channels'][_0x31c780[_0x8dba('0xa5')]]){this['channels'][_0x31c780[_0x8dba('0xa5')]]['transfercalleridnum']=_0x31c780[_0x8dba('0xb2')];this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xa5')]]['transferconnectedlinenum']=_0x31c780['extension'];this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xa5')]]['transferType']=_0x8dba('0xb5');this[_0x8dba('0x25')]({'event':_0x8dba('0x9f'),'uniqueid':_0x31c780[_0x8dba('0xa5')],'context':_0x31c780[_0x8dba('0x42')],'channel':_0x31c780[_0x8dba('0xb6')]});}else{this[_0x8dba('0x18')][_0x31c780[_0x8dba('0xb7')]][_0x8dba('0x94')]='BLIND';}}}catch(_0x3087f0){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][blindtransfer]',_0x31c780[_0x8dba('0x34')],util['inspect'](_0x3087f0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8dba('0x2a')]=function(_0x1a9a7d){try{if(this[_0x8dba('0x2f')](_0x1a9a7d)){logger[_0x8dba('0x36')](_0x8dba('0xb8'),_0x1a9a7d[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x1a9a7d,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]]){if(!_[_0x8dba('0x71')](this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]][_0x8dba('0x61')])){this[_0x8dba('0x18')][_0x1a9a7d[_0x8dba('0x34')]]['mohstarttime']=moment()[_0x8dba('0x45')](_0x8dba('0x56'));logger[_0x8dba('0x32')](_0x8dba('0xb9'),_0x1a9a7d[_0x8dba('0x34')],this[_0x8dba('0x18')][_0x1a9a7d['uniqueid']][_0x8dba('0xba')]);}}}}catch(_0x465a2c){logger[_0x8dba('0x2d')](_0x8dba('0xbb'),_0x1a9a7d[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x465a2c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8dba('0x2e')][_0x8dba('0xbc')]=function(_0x548ecf){try{if(this['isNotNull'](_0x548ecf)){logger[_0x8dba('0x36')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x548ecf[_0x8dba('0x34')],util[_0x8dba('0x38')](_0x548ecf,{'showHidden':![],'depth':null}));if(this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]]){if(!_['isNil'](this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]]['mohstarttime'])){this[_0x8dba('0x18')][_0x548ecf['uniqueid']][_0x8dba('0xbd')]+=moment()[_0x8dba('0xbe')](0x0)[_0x8dba('0xbf')](this['channels'][_0x548ecf['uniqueid']][_0x8dba('0xba')],_0x8dba('0x55'));logger[_0x8dba('0x32')](_0x8dba('0xc0'),_0x548ecf[_0x8dba('0x34')],this[_0x8dba('0x18')][_0x548ecf['uniqueid']][_0x8dba('0xbd')]);delete this[_0x8dba('0x18')][_0x548ecf[_0x8dba('0x34')]][_0x8dba('0xba')];}}}}catch(_0xf7a209){logger[_0x8dba('0x2d')]('[%s][voiceCallReport][musiconholdstop]',_0x548ecf[_0x8dba('0x34')],util[_0x8dba('0x38')](_0xf7a209,{'showHidden':![],'depth':null}));}};module[_0x8dba('0xc1')]=VoiceCallReport; \ No newline at end of file +var _0x7b78=['[%s][voiceCallReport][musiconholdstart]','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','bluebird','lodash','moment','path','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','invalid','ringing','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','channels','agents','coreshowchannel','syncNewExten','newexten','newchannel','bind','newstate','syncNewState','varset','hangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','debug','[%s][voiceCallReport][newchannel]\x20event:','channel','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','channelstate','membername','UserId','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','catch','Action','StopMixMonitor','destinationchannel','event','outbound','blindTransfers','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime'];(function(_0x4fb993,_0x4fd8ef){var _0x348c09=function(_0x38c9da){while(--_0x38c9da){_0x4fb993['push'](_0x4fb993['shift']());}};_0x348c09(++_0x4fd8ef);}(_0x7b78,0x185));var _0x87b7=function(_0x3124e2,_0x452c52){_0x3124e2=_0x3124e2-0x0;var _0x10d008=_0x7b78[_0x3124e2];return _0x10d008;};'use strict';var BPromise=require(_0x87b7('0x0'));var _=require(_0x87b7('0x1'));var moment=require(_0x87b7('0x2'));var util=require('util');var path=require(_0x87b7('0x3'));var Redis=require('ioredis');var config=require(_0x87b7('0x4'));var logger=require('../../../config/logger')(_0x87b7('0x5'));var ami=require(_0x87b7('0x6'));var Channel=require(_0x87b7('0x7'));var RpcSetting=require(_0x87b7('0x8'));var statusDesc=[_0x87b7('0x9'),_0x87b7('0xa'),_0x87b7('0xb'),'busy',_0x87b7('0xc'),'unavailable',_0x87b7('0xd'),'ringinuse',_0x87b7('0xe')];var applications=[_0x87b7('0xf'),_0x87b7('0x10'),_0x87b7('0x11'),'dial',_0x87b7('0x12'),_0x87b7('0x13')];var dispositions=[_0x87b7('0x14'),_0x87b7('0x15'),'FAILED','NO\x20ANSWER',_0x87b7('0x14'),'NO\x20ANSWER','ANSWERED',_0x87b7('0x16'),_0x87b7('0x15'),_0x87b7('0x15'),_0x87b7('0x15')];var actions={};config[_0x87b7('0x17')]=_[_0x87b7('0x18')](config[_0x87b7('0x17')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x87b7('0x17')]));function VoiceCallReport(_0x145d67){this[_0x87b7('0x19')]=_0x145d67['channels'];this[_0x87b7('0x1a')]=_0x145d67['agents'];this['blindTransfers']={};ami['on'](_0x87b7('0x1b'),this[_0x87b7('0x1c')]['bind'](this));ami['on'](_0x87b7('0x1d'),this[_0x87b7('0x1c')]['bind'](this));ami['on'](_0x87b7('0x1e'),this['syncNewChannel'][_0x87b7('0x1f')](this));ami['on'](_0x87b7('0x20'),this[_0x87b7('0x21')][_0x87b7('0x1f')](this));ami['on'](_0x87b7('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0x87b7('0x23'),this['syncHangup'][_0x87b7('0x1f')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x87b7('0x1f')](this));ami['on'](_0x87b7('0x24'),this[_0x87b7('0x25')][_0x87b7('0x1f')](this));ami['on']('blindtransfer',this[_0x87b7('0x26')][_0x87b7('0x1f')](this));ami['on'](_0x87b7('0x27'),this['syncMusicOnHoldStart'][_0x87b7('0x1f')](this));ami['on'](_0x87b7('0x28'),this[_0x87b7('0x29')][_0x87b7('0x1f')](this));try{logger['info'](_0x87b7('0x2a'));ami[_0x87b7('0x2b')]();}catch(_0xf1f5ad){logger[_0x87b7('0x2c')](_0x87b7('0x2d'),util[_0x87b7('0x2e')](_0xf1f5ad,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x30')]=function(_0x362878){return _0x362878!==null&&!_['isUndefined'](_0x362878);};VoiceCallReport[_0x87b7('0x2f')]['emit']=function(_0xd210,_0x3cdbcf,_0x522539){io['to'](_0xd210)[_0x87b7('0x31')](_0x3cdbcf,_0x522539);};VoiceCallReport['prototype'][_0x87b7('0x32')]=function(_0x5c1377){try{if(this[_0x87b7('0x30')](_0x5c1377)){logger[_0x87b7('0x33')](_0x87b7('0x34'),_0x5c1377[_0x87b7('0x35')],_0x5c1377[_0x87b7('0x36')],_0x5c1377['calleridnum']);logger['debug'](_0x87b7('0x37'),_0x5c1377['uniqueid'],util[_0x87b7('0x2e')](_0x5c1377,{'showHidden':![],'depth':null}));if(_0x5c1377[_0x87b7('0x35')]===_0x5c1377[_0x87b7('0x38')]){if(!_[_0x87b7('0x39')](this[_0x87b7('0x19')][_0x5c1377[_0x87b7('0x35')]])){_[_0x87b7('0x3a')](this['channels'][_0x5c1377[_0x87b7('0x35')]],_[_0x87b7('0x3b')](_0x5c1377,_[_0x87b7('0x3c')](this[_0x87b7('0x19')][_0x5c1377[_0x87b7('0x35')]])));}}}}catch(_0x2cd420){logger[_0x87b7('0x2c')](_0x87b7('0x3d'),_0x5c1377[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x2cd420,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x87b7('0x3e')]=function(_0xcb446d){try{if(this[_0x87b7('0x30')](_0xcb446d)){logger[_0x87b7('0x3f')](_0x87b7('0x40'),_0xcb446d[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0xcb446d,{'showHidden':![],'depth':null}));if(_0xcb446d['uniqueid']===_0xcb446d['linkedid']&&_0xcb446d[_0x87b7('0x41')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]])){logger[_0x87b7('0x33')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0xcb446d[_0x87b7('0x35')],_0xcb446d[_0x87b7('0x42')],_0xcb446d[_0x87b7('0x43')]);this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]]=new Channel();this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]][_0x87b7('0x44')]=moment()[_0x87b7('0x45')](_0x87b7('0x46'));this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]][_0x87b7('0x47')]=dispositions[_[_0x87b7('0x48')](_0xcb446d['channelstate'])];_[_0x87b7('0x3a')](this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]],_['pick'](_0xcb446d,_[_0x87b7('0x3c')](this[_0x87b7('0x19')][_0xcb446d[_0x87b7('0x35')]])));if(_0xcb446d['context']===_0x87b7('0x49')){if(this[_0x87b7('0x1a')][_0xcb446d[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]){this[_0x87b7('0x1a')][_0xcb446d[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4b')]=_0xcb446d[_0x87b7('0x43')];logger[_0x87b7('0x3f')](_0x87b7('0x4c'),_0xcb446d[_0x87b7('0x35')],util[_0x87b7('0x2e')]({'destaccountcode':this[_0x87b7('0x1a')][_0xcb446d[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4d')],'destconnectedlinenum':_0xcb446d[_0x87b7('0x43')]},{'showHidden':![],'depth':null}));this[_0x87b7('0x31')](util[_0x87b7('0x45')]('user:%s',this['agents'][_0xcb446d[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4e')]),_0x87b7('0x4f'),{'destaccountcode':this[_0x87b7('0x1a')][_0xcb446d[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4d')],'destconnectedlinenum':_0xcb446d[_0x87b7('0x43')]});}}}}}}catch(_0x321885){logger[_0x87b7('0x2c')](_0x87b7('0x50'),_0xcb446d[_0x87b7('0x35')],util['inspect'](_0x321885,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')]['syncNewExten']=function(_0x192f43){try{if(this[_0x87b7('0x30')](_0x192f43)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x192f43['uniqueid'],util[_0x87b7('0x2e')](_0x192f43,{'showHidden':![],'depth':null}));if(_0x192f43[_0x87b7('0x35')]===_0x192f43[_0x87b7('0x38')]&&_0x192f43[_0x87b7('0x43')]!='h'&&_0x192f43[_0x87b7('0x41')]!=_0x87b7('0x51')){_0x192f43[_0x87b7('0x52')]=_0x192f43['application'][_0x87b7('0x53')]();_0x192f43[_0x87b7('0x54')]=(_0x192f43['appdata']||_0x192f43['applicationdata'])[_0x87b7('0x53')]();logger[_0x87b7('0x33')](_0x87b7('0x55'),_0x192f43[_0x87b7('0x35')],_0x192f43[_0x87b7('0x52')],_0x192f43[_0x87b7('0x54')]);if(_[_0x87b7('0x39')](this['channels'][_0x192f43[_0x87b7('0x35')]])){this[_0x87b7('0x19')][_0x192f43[_0x87b7('0x35')]]=new Channel();this['channels'][_0x192f43['uniqueid']]['starttime']=_0x192f43[_0x87b7('0x56')]?moment()[_0x87b7('0x57')](moment[_0x87b7('0x56')](_0x192f43[_0x87b7('0x56')])[_0x87b7('0x58')](),_0x87b7('0x58'))[_0x87b7('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x87b7('0x45')](_0x87b7('0x46'));this[_0x87b7('0x19')][_0x192f43[_0x87b7('0x35')]]['disposition']=_0x87b7('0x14');}_['merge'](this[_0x87b7('0x19')][_0x192f43['uniqueid']],_[_0x87b7('0x3b')](_0x192f43,_[_0x87b7('0x3c')](this[_0x87b7('0x19')][_0x192f43[_0x87b7('0x35')]])));if(_[_0x87b7('0x59')](applications,_0x192f43[_0x87b7('0x52')])){this[_0x87b7('0x19')][_0x192f43['uniqueid']][_0x87b7('0x5a')]=_0x192f43[_0x87b7('0x52')];this[_0x87b7('0x19')][_0x192f43[_0x87b7('0x35')]][_0x87b7('0x5b')]=_0x192f43[_0x87b7('0x54')];if(_0x192f43['application']==='set'&&_[_0x87b7('0x5c')](_0x192f43[_0x87b7('0x54')],'cdr(')){var _0xb2ee7=_0x192f43['applicationdata'][_0x87b7('0x4a')]('=');var _0x5b2f80=_0xb2ee7[0x0]['match'](/cdr\((.*)\)/);if(_0x5b2f80){this['channels'][_0x192f43[_0x87b7('0x35')]][_0x5b2f80[0x1]]=_0xb2ee7[0x1];}}else if(_0x192f43[_0x87b7('0x52')]==='queue'){this[_0x87b7('0x19')][_0x192f43[_0x87b7('0x35')]][_0x87b7('0x10')]=_0x192f43[_0x87b7('0x54')][_0x87b7('0x4a')](',')[0x0];}}}}}catch(_0x48a992){logger[_0x87b7('0x2c')]('[%s][voiceCallReport][newexten]',_0x192f43['uniqueid'],util[_0x87b7('0x2e')](_0x48a992,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x21')]=function(_0x55b214){try{if(this[_0x87b7('0x30')](_0x55b214)){logger['info'](_0x87b7('0x5d'),_0x55b214[_0x87b7('0x35')],_0x55b214[_0x87b7('0x38')],_0x55b214[_0x87b7('0x36')],_0x55b214['calleridnum']);logger[_0x87b7('0x3f')](_0x87b7('0x5e'),_0x55b214[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x55b214,{'showHidden':![],'depth':null}));if(_0x55b214[_0x87b7('0x35')]!==_0x55b214[_0x87b7('0x38')]){if(this[_0x87b7('0x19')][_0x55b214['linkedid']]){if(_0x55b214['channelstate']==='6'){if(!this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x5f')]){var _0x124dfe=moment();this['channels'][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x5f')]=!![];this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x60')]=_0x124dfe[_0x87b7('0x45')](_0x87b7('0x46'));if(this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x44')]){this[_0x87b7('0x19')][_0x55b214['linkedid']][_0x87b7('0x61')]=_0x124dfe[_0x87b7('0x62')](this[_0x87b7('0x19')][_0x55b214['linkedid']][_0x87b7('0x44')],'seconds');}}this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x38')]=_0x55b214[_0x87b7('0x35')];if(_0x55b214['calleridnum']!==_0x87b7('0x63')){this['channels'][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x64')]=_0x55b214[_0x87b7('0x65')];}this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x66')]=_0x55b214[_0x87b7('0x36')];this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]]['destinationchannel']=_0x55b214[_0x87b7('0x41')];this['channels'][_0x55b214['linkedid']][_0x87b7('0x47')]=dispositions[_['toNumber'](_0x55b214[_0x87b7('0x67')])];if(this[_0x87b7('0x1a')][_0x55b214[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]){this['channels'][_0x55b214[_0x87b7('0x38')]]['UserId']=this[_0x87b7('0x1a')][_0x55b214['channel'][_0x87b7('0x4a')]('-')[0x0]]['id'];this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x38')]][_0x87b7('0x68')]=this[_0x87b7('0x1a')][_0x55b214[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4e')];}}}}else{if(this['channels'][_0x55b214['uniqueid']]){if(_0x55b214[_0x87b7('0x67')]==='6'){if(this[_0x87b7('0x1a')][_0x55b214[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]){this[_0x87b7('0x19')][_0x55b214['uniqueid']][_0x87b7('0x69')]=this['agents'][_0x55b214[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]['id'];this[_0x87b7('0x19')][_0x55b214[_0x87b7('0x35')]][_0x87b7('0x68')]=this[_0x87b7('0x1a')][_0x55b214[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]['name'];}}}}}}catch(_0x3d8313){logger[_0x87b7('0x2c')](_0x87b7('0x6a'),_0x55b214[_0x87b7('0x35')],util['inspect'](_0x3d8313,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x2e6fd6,_0x4d15f6){try{if(this[_0x87b7('0x19')][_0x2e6fd6]){logger[_0x87b7('0x33')](_0x87b7('0x6b'),_0x2e6fd6,_0x4d15f6);this['channels'][_0x2e6fd6][_0x87b7('0x6c')]=!![];if(_[_0x87b7('0x6d')](_0x4d15f6,'.wav49')){_0x4d15f6=_0x4d15f6[_0x87b7('0x6e')](_0x87b7('0x6f'),_0x87b7('0x70'));}this[_0x87b7('0x19')][_0x2e6fd6][_0x87b7('0x71')]=_0x4d15f6;var _0x3c237b=_[_0x87b7('0x72')](this[_0x87b7('0x19')][_0x2e6fd6][_0x87b7('0x73')],{'filename':_0x4d15f6});if(_[_0x87b7('0x74')](_0x3c237b)){this['channels'][_0x2e6fd6][_0x87b7('0x73')][_0x87b7('0x75')]({'filename':_0x4d15f6,'createdAt':moment()[_0x87b7('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x87b7('0x76')});}}}catch(_0x5972d9){logger[_0x87b7('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]',_0x2e6fd6,util[_0x87b7('0x2e')](_0x5972d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')]['syncVarSet']=function(_0x1009c8){try{if(this[_0x87b7('0x30')](_0x1009c8)){logger[_0x87b7('0x3f')](_0x87b7('0x77'),_0x1009c8['uniqueid'],util['inspect'](_0x1009c8,{'showHidden':![],'depth':null}));if(this[_0x87b7('0x19')][_0x1009c8['uniqueid']]&&_0x1009c8[_0x87b7('0x41')]!=_0x87b7('0x51')){if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')])){if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x79')])){logger[_0x87b7('0x33')](_0x87b7('0x7a'),_0x1009c8[_0x87b7('0x35')],_0x1009c8['value']);this[_0x87b7('0x7b')](_0x1009c8[_0x87b7('0x35')],_0x1009c8[_0x87b7('0x7c')]);}else if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x7d')])){logger[_0x87b7('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x1009c8[_0x87b7('0x35')],_0x1009c8[_0x87b7('0x7c')]);this['channels'][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x65')]=_0x1009c8[_0x87b7('0x7c')];}else if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x7e')])){logger[_0x87b7('0x33')](_0x87b7('0x7f'),_0x1009c8[_0x87b7('0x35')],_0x1009c8['value']);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x80')]=_0x1009c8[_0x87b7('0x7c')];}else if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x81')])){logger[_0x87b7('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1009c8[_0x87b7('0x35')],_0x1009c8[_0x87b7('0x7c')]);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x82')]=_0x1009c8[_0x87b7('0x7c')];}else if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1009c8['uniqueid'],_0x1009c8['value'][_0x87b7('0x4a')](',')[0x0]);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]]['queue']=_0x1009c8[_0x87b7('0x7c')][_0x87b7('0x4a')](',')[0x0];}else if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x84')])){logger['info'](_0x87b7('0x85'),_0x1009c8[_0x87b7('0x35')],_0x1009c8['value']);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]]['originatecalleridnum']=_0x1009c8[_0x87b7('0x7c')];}else if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x86')])){logger['info'](_0x87b7('0x87'),_0x1009c8[_0x87b7('0x35')],_0x1009c8[_0x87b7('0x7c')]);this[_0x87b7('0x19')][_0x1009c8['uniqueid']]['destination']=_0x1009c8[_0x87b7('0x7c')];}else if(this['isNotNull'](_0x1009c8[_0x87b7('0x78')]['xmd-callerid-preview'])){logger[_0x87b7('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1009c8[_0x87b7('0x35')],_0x1009c8['value']);this['channels'][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x88')]=_0x1009c8[_0x87b7('0x7c')];}else if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x89')])){logger[_0x87b7('0x33')](_0x87b7('0x8a'),_0x1009c8[_0x87b7('0x35')],_0x1009c8[_0x87b7('0x7c')]);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x10')]=_0x1009c8[_0x87b7('0x7c')];}else if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')][_0x87b7('0x8b')])){logger[_0x87b7('0x33')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1009c8['uniqueid'],_0x1009c8[_0x87b7('0x7c')]);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x35')]][_0x87b7('0x8c')]=_0x1009c8[_0x87b7('0x7c')];}}}else if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')]['mixmonitor_filename'])){if(_0x1009c8['value']){var _0x45574b=path[_0x87b7('0x8d')](_0x1009c8[_0x87b7('0x7c')])[_0x87b7('0x4e')];logger[_0x87b7('0x33')](_0x87b7('0x7a'),_0x45574b,_0x1009c8['value']);this[_0x87b7('0x7b')](_0x45574b,_0x1009c8[_0x87b7('0x7c')]);}}else if(this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x38')]]){if(this[_0x87b7('0x30')](_0x1009c8[_0x87b7('0x78')])){if(this[_0x87b7('0x30')](_0x1009c8['variable'][_0x87b7('0x8b')])){logger['info'](_0x87b7('0x8e'),_0x1009c8['linkedid'],_0x1009c8[_0x87b7('0x7c')]);this[_0x87b7('0x19')][_0x1009c8[_0x87b7('0x38')]][_0x87b7('0x8f')]=_0x1009c8[_0x87b7('0x7c')];}}}}}catch(_0x5b5f08){logger[_0x87b7('0x2c')](_0x87b7('0x90'),_0x1009c8['uniqueid'],util[_0x87b7('0x2e')](_0x5b5f08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x91')]=function(_0x24478c){try{if(this[_0x87b7('0x30')](_0x24478c)){logger[_0x87b7('0x3f')](_0x87b7('0x92'),_0x24478c['uniqueid'],util['inspect'](_0x24478c,{'showHidden':![],'depth':null}));if(this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]]){logger[_0x87b7('0x33')](_0x87b7('0x93'),_0x24478c[_0x87b7('0x35')],_0x24478c[_0x87b7('0x94')]);var _0x11d2bb=moment();this[_0x87b7('0x19')][_0x24478c['uniqueid']][_0x87b7('0x95')]=_0x11d2bb[_0x87b7('0x45')](_0x87b7('0x46'));this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]]['duration']=_0x11d2bb['diff'](this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]][_0x87b7('0x44')],'seconds');if(this[_0x87b7('0x19')][_0x24478c['uniqueid']]['answered']){this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]]['billableseconds']=_0x11d2bb['diff'](this[_0x87b7('0x19')][_0x24478c['uniqueid']][_0x87b7('0x60')],'seconds');this['channels'][_0x24478c[_0x87b7('0x35')]]['holdtime']=this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]][_0x87b7('0x56')]-this[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]]['billableseconds'];}if(_0x24478c['context']==='from-sip'){if(this[_0x87b7('0x1a')][_0x24478c['channel'][_0x87b7('0x4a')]('-')[0x0]]){this[_0x87b7('0x1a')][_0x24478c[_0x87b7('0x41')]['split']('-')[0x0]]=_['omit'](this[_0x87b7('0x1a')][_0x24478c[_0x87b7('0x41')]['split']('-')[0x0]],[_0x87b7('0x4b')]);logger[_0x87b7('0x3f')](_0x87b7('0x96'),_0x24478c[_0x87b7('0x35')],util[_0x87b7('0x2e')]({'destaccountcode':this[_0x87b7('0x1a')][_0x24478c[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x87b7('0x45')]('user:%s',this['agents'][_0x24478c[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]][_0x87b7('0x4e')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x24478c[_0x87b7('0x41')][_0x87b7('0x4a')]('-')[0x0]]['accountcode']});}}var _0x547570=this;Promise[_0x87b7('0x97')]()[_0x87b7('0x98')](function(){var _0x4f18c1=_0x547570['channels'][_0x24478c[_0x87b7('0x35')]];if(typeof _0x4f18c1[_0x87b7('0x99')]==='undefined')return;if(_[_0x87b7('0x9a')](_0x4f18c1[_0x87b7('0x73')]))return;return RpcSetting[_0x87b7('0x9b')]()['then'](function(_0xb65a25){if(!_0xb65a25[_0x87b7('0x9c')])return;return Promise[_0x87b7('0x97')]()[_0x87b7('0x98')](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x4f18c1['channel']})[_0x87b7('0x9d')](function(){});})['then'](function(){return ami[_0x87b7('0x9e')]({'action':_0x87b7('0x9f'),'channel':_0x4f18c1['destinationchannel']})[_0x87b7('0x9d')](function(){})['finally'](function(){var _0x468511=_0x547570[_0x87b7('0x1a')][_0x4f18c1[_0x87b7('0xa0')][_0x87b7('0x4a')]('-')[0x0]];if(!_0x468511)return;io[_0x87b7('0x31')]('webbar:stopmonitors',{'agentId':_0x468511['id'],'uniqueid':_0x4f18c1[_0x87b7('0x35')]});});});});})['then'](function(){if(_0x24478c[_0x87b7('0xa1')]==='BlindTransfer'){_0x547570['blindTransfers'][_0x24478c['uniqueid']]=_0x547570[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]];}else{if(_0x547570[_0x87b7('0x19')][_0x24478c['uniqueid']]['type']===_0x87b7('0xa2')&&_0x547570[_0x87b7('0xa3')][_0x24478c[_0x87b7('0x35')]]){_0x547570[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]][_0x87b7('0x35')]=[_0x547570[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]][_0x87b7('0x38')],_0x547570[_0x87b7('0x19')][_0x24478c['uniqueid']]['linkedid']=_0x547570[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]][_0x87b7('0x35')]][0x0];delete _0x547570[_0x87b7('0xa3')][_0x24478c[_0x87b7('0x35')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x24478c['uniqueid'],util[_0x87b7('0x2e')](_0x547570['channels'][_0x24478c['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x87b7('0x31')](_0x87b7('0xa4'),_0x547570[_0x87b7('0x19')][_0x24478c['uniqueid']]);delete _0x547570[_0x87b7('0x19')][_0x24478c[_0x87b7('0x35')]];});}}}catch(_0x3d940f){logger['error']('[%s][voiceCallReport][hangup]',_0x24478c[_0x87b7('0x35')],util['inspect'](_0x3d940f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x25')]=function(_0x1c82ca){try{if(this[_0x87b7('0x30')](_0x1c82ca)){logger[_0x87b7('0x33')](_0x87b7('0xa5'),_0x1c82ca['uniqueid'],_0x1c82ca[_0x87b7('0xa6')],_0x1c82ca[_0x87b7('0xa7')]);logger[_0x87b7('0x3f')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x1c82ca['uniqueid'],util[_0x87b7('0x2e')](_0x1c82ca,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c82ca[_0x87b7('0xa8')]]){this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xa8')]][_0x87b7('0xa9')]=_0x1c82ca[_0x87b7('0xa6')];this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xa8')]]['transferconnectedlinenum']=_0x1c82ca[_0x87b7('0xa7')];if(this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xaa')]]){var _0x16b5ad=this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xaa')]];this[_0x87b7('0x19')][_0x1c82ca['secondtransfereruniqueid']]=this['channels'][_0x1c82ca[_0x87b7('0xa8')]];this['channels'][_0x1c82ca[_0x87b7('0xa8')]]=_0x16b5ad;}}else if(this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xab')]]){this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xab')]][_0x87b7('0xa9')]=_0x1c82ca[_0x87b7('0xa6')];this['channels'][_0x1c82ca[_0x87b7('0xab')]][_0x87b7('0xac')]=_0x1c82ca[_0x87b7('0xa7')];if(this[_0x87b7('0x19')][_0x1c82ca['origtransfereruniqueid']]){var _0x16b5ad=this['channels'][_0x1c82ca[_0x87b7('0xad')]];this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xad')]]=this['channels'][_0x1c82ca[_0x87b7('0xab')]];this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xab')]]=_0x16b5ad;}}if((this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xad')]]||this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xae')]])&&this[_0x87b7('0x19')][_0x1c82ca['secondtransfereruniqueid']]){var _0x25bb7d=_['some']([this['channels'][_0x1c82ca[_0x87b7('0xad')]],this['channels'][_0x1c82ca['origtransfererlinkedid']],this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xaa')]]],function(_0x371624){return _0x371624&&_0x371624[_0x87b7('0x82')]===_0x87b7('0xa2')&&_0x371624[_0x87b7('0xaf')];});if(_0x25bb7d){if(this[_0x87b7('0x19')][_0x1c82ca['origtransfereruniqueid']])this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xad')]][_0x87b7('0x99')]=_0x87b7('0xb0');if(this['channels'][_0x1c82ca[_0x87b7('0xae')]])this[_0x87b7('0x19')][_0x1c82ca['origtransfererlinkedid']][_0x87b7('0x99')]=_0x87b7('0xb0');this[_0x87b7('0x19')][_0x1c82ca[_0x87b7('0xaa')]][_0x87b7('0x99')]=_0x87b7('0xb0');}}}}catch(_0x16d8a8){logger['error'](_0x87b7('0xb1'),_0x1c82ca[_0x87b7('0x35')],util['inspect'](_0x16d8a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x26')]=function(_0x33fd7f){try{if(this[_0x87b7('0x30')](_0x33fd7f)){logger[_0x87b7('0x33')](_0x87b7('0xb2'),_0x33fd7f[_0x87b7('0x35')],_0x33fd7f[_0x87b7('0xb3')],_0x33fd7f['extension']);logger['debug'](_0x87b7('0xb4'),_0x33fd7f['uniqueid'],util['inspect'](_0x33fd7f,{'showHidden':![],'depth':null}));if(this[_0x87b7('0x19')][_0x33fd7f[_0x87b7('0xa8')]]){this[_0x87b7('0x19')][_0x33fd7f[_0x87b7('0xa8')]]['transfercalleridnum']=_0x33fd7f[_0x87b7('0xb3')];this[_0x87b7('0x19')][_0x33fd7f['transfereeuniqueid']][_0x87b7('0xac')]=_0x33fd7f[_0x87b7('0xb5')];this['channels'][_0x33fd7f[_0x87b7('0xa8')]]['transferType']='BLIND';this[_0x87b7('0x91')]({'event':_0x87b7('0xb6'),'uniqueid':_0x33fd7f[_0x87b7('0xa8')],'context':_0x33fd7f[_0x87b7('0x42')],'channel':_0x33fd7f[_0x87b7('0xb7')]});}else{this[_0x87b7('0x19')][_0x33fd7f['transfereruniqueid']][_0x87b7('0x99')]='BLIND';}}}catch(_0xfbf67c){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x33fd7f[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0xfbf67c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0xb8')]=function(_0x390c66){try{if(this[_0x87b7('0x30')](_0x390c66)){logger[_0x87b7('0x3f')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x390c66[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x390c66,{'showHidden':![],'depth':null}));if(this[_0x87b7('0x19')][_0x390c66[_0x87b7('0x35')]]){if(!_[_0x87b7('0x74')](this[_0x87b7('0x19')][_0x390c66[_0x87b7('0x35')]][_0x87b7('0x60')])){this[_0x87b7('0x19')][_0x390c66[_0x87b7('0x35')]]['mohstarttime']=moment()['format'](_0x87b7('0x46'));logger[_0x87b7('0x33')](_0x87b7('0xb9'),_0x390c66[_0x87b7('0x35')],this['channels'][_0x390c66[_0x87b7('0x35')]][_0x87b7('0xba')]);}}}}catch(_0x534720){logger[_0x87b7('0x2c')](_0x87b7('0xbb'),_0x390c66[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x534720,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x87b7('0x2f')][_0x87b7('0x29')]=function(_0x46ba16){try{if(this[_0x87b7('0x30')](_0x46ba16)){logger[_0x87b7('0x3f')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x46ba16[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x46ba16,{'showHidden':![],'depth':null}));if(this[_0x87b7('0x19')][_0x46ba16[_0x87b7('0x35')]]){if(!_[_0x87b7('0x74')](this[_0x87b7('0x19')][_0x46ba16[_0x87b7('0x35')]][_0x87b7('0xba')])){this['channels'][_0x46ba16[_0x87b7('0x35')]]['mohtime']+=moment()[_0x87b7('0xbc')](0x0)['diff'](this[_0x87b7('0x19')][_0x46ba16['uniqueid']][_0x87b7('0xba')],'seconds');logger[_0x87b7('0x33')](_0x87b7('0xbd'),_0x46ba16[_0x87b7('0x35')],this[_0x87b7('0x19')][_0x46ba16[_0x87b7('0x35')]][_0x87b7('0xbe')]);delete this['channels'][_0x46ba16[_0x87b7('0x35')]][_0x87b7('0xba')];}}}}catch(_0x280abf){logger[_0x87b7('0x2c')]('[%s][voiceCallReport][musiconholdstop]',_0x46ba16[_0x87b7('0x35')],util[_0x87b7('0x2e')](_0x280abf,{'showHidden':![],'depth':null}));}};module[_0x87b7('0xbf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 0dc277f..b0c2f7a 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 _0x90a4=['[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','info','cause-txt','endtime','diff','complete','total','answertime','answered','holdtime','starttime','seconds','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','moment','ioredis','ami','../ami','redis','localhost','socket.io-emitter','outbound','variables','dialbegin','syncDialBegin','dialend','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x90a4,0x179));var _0x490a=function(_0x584c5f,_0x2f122d){_0x584c5f=_0x584c5f-0x0;var _0xf0b1dc=_0x90a4[_0x584c5f];return _0xf0b1dc;};'use strict';var _=require(_0x490a('0x0'));var moment=require(_0x490a('0x1'));var util=require('util');var Redis=require(_0x490a('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x490a('0x3'));var ami=require(_0x490a('0x4'));config[_0x490a('0x5')]=_['defaults'](config['redis'],{'host':_0x490a('0x6'),'port':0x18eb});var io=require(_0x490a('0x7'))(new Redis(config[_0x490a('0x5')]));function VoiceDialReport(_0x5653e9){this['channels']=_0x5653e9['outboundChannels'];this[_0x490a('0x8')]=_0x5653e9[_0x490a('0x8')];this[_0x490a('0x9')]={};ami['on'](_0x490a('0xa'),this[_0x490a('0xb')]['bind'](this));ami['on'](_0x490a('0xc'),this['syncDialEnd'][_0x490a('0xd')](this));ami['on'](_0x490a('0xe'),this[_0x490a('0xf')][_0x490a('0xd')](this));ami['on'](_0x490a('0x10'),this[_0x490a('0x11')]['bind'](this));}VoiceDialReport[_0x490a('0x12')][_0x490a('0x13')]=function(_0x384beb){return _0x384beb!==null&&!_[_0x490a('0x14')](_0x384beb);};VoiceDialReport[_0x490a('0x12')][_0x490a('0x15')]=function(_0x51ee57,_0xe6e940,_0x29ef83){io['to'](_0x51ee57)[_0x490a('0x15')](_0xe6e940,_0x29ef83);};VoiceDialReport['prototype'][_0x490a('0xb')]=function(_0x264ae0){try{if(this['isNotNull'](_0x264ae0)){logger[_0x490a('0x16')](_0x490a('0x17'),_0x264ae0[_0x490a('0x18')],util[_0x490a('0x19')](_0x264ae0,{'showHidden':![],'depth':null}));if(this[_0x490a('0x1a')][_0x264ae0[_0x490a('0x18')]]){_['merge'](this[_0x490a('0x1a')][_0x264ae0[_0x490a('0x18')]],{'starttime':moment()['format'](_0x490a('0x1b')),'lastevent':'called','interface':_0x264ae0[_0x490a('0x1c')]['substring'](0x0,_0x264ae0[_0x490a('0x1c')][_0x490a('0x1d')]('-')),'membername':_0x264ae0[_0x490a('0x1c')][_0x490a('0x1e')](_0x264ae0[_0x490a('0x1c')][_0x490a('0x1d')]('/')+0x1,_0x264ae0['channel']['lastIndexOf']('-'))},_[_0x490a('0x1f')](_0x264ae0,[_0x490a('0x20'),'privilege']));logger['info'](_0x490a('0x21'),_0x264ae0[_0x490a('0x18')],this[_0x490a('0x1a')][_0x264ae0['uniqueid']]['membername'],this[_0x490a('0x1a')][_0x264ae0[_0x490a('0x18')]][_0x490a('0x22')]);logger[_0x490a('0x16')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x264ae0[_0x490a('0x18')],util[_0x490a('0x19')](this['channels'][_0x264ae0[_0x490a('0x18')]],{'showHidden':![],'depth':null}));this[_0x490a('0x15')]('voice:outbound',_0x490a('0x23'),this[_0x490a('0x1a')][_0x264ae0['uniqueid']]);logger[_0x490a('0x16')](_0x490a('0x24'),_0x264ae0[_0x490a('0x18')],util[_0x490a('0x19')](this[_0x490a('0x1a')][_0x264ae0[_0x490a('0x18')]],{'showHidden':![],'depth':null}));ami[_0x490a('0x15')](_0x490a('0x25'),this[_0x490a('0x1a')][_0x264ae0[_0x490a('0x18')]]);}}}catch(_0x12054a){logger[_0x490a('0x26')](_0x490a('0x27'),_0x264ae0[_0x490a('0x18')],util['inspect'](_0x12054a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x158480){try{if(this[_0x490a('0x13')](_0x158480)){logger[_0x490a('0x16')](_0x490a('0x28'),_0x158480[_0x490a('0x18')],util[_0x490a('0x19')](_0x158480,{'showHidden':![],'depth':null}));if(this[_0x490a('0x1a')][_0x158480['uniqueid']]){this[_0x490a('0x1a')][_0x158480['uniqueid']][_0x490a('0x29')]=_0x158480[_0x490a('0x29')];if(_0x158480['dialstatus']===_0x490a('0x2a')){this[_0x490a('0x1a')][_0x158480['uniqueid']][_0x490a('0x2b')]=_0x158480[_0x490a('0x2b')];this[_0x490a('0x1a')][_0x158480[_0x490a('0x18')]]['connectedlinename']=_0x158480[_0x490a('0x2c')];this[_0x490a('0x1a')][_0x158480[_0x490a('0x18')]]['answertime']=moment()[_0x490a('0x2d')](_0x490a('0x1b'));this[_0x490a('0x1a')][_0x158480['uniqueid']][_0x490a('0x2e')]=_0x490a('0x2f');logger['info'](_0x490a('0x30'),_0x158480['uniqueid'],_0x158480['channel']['substring'](_0x158480[_0x490a('0x1c')][_0x490a('0x1d')]('/')+0x1,_0x158480[_0x490a('0x1c')][_0x490a('0x1d')]('-')));logger[_0x490a('0x16')](_0x490a('0x31'),_0x158480[_0x490a('0x18')],util['inspect'](this[_0x490a('0x1a')][_0x158480[_0x490a('0x18')]],{'showHidden':![],'depth':null}));ami[_0x490a('0x15')](_0x490a('0x32'),this['channels'][_0x158480['uniqueid']]);}logger[_0x490a('0x16')](_0x490a('0x33'),_0x158480[_0x490a('0x18')],util[_0x490a('0x19')](this['channels'][_0x158480[_0x490a('0x18')]],{'showHidden':![],'depth':null}));this[_0x490a('0x15')](_0x490a('0x34'),'voice_outbound_channel:save',this[_0x490a('0x1a')][_0x158480[_0x490a('0x18')]]);}}}catch(_0x279e73){logger[_0x490a('0x26')](_0x490a('0x35'),_0x158480[_0x490a('0x18')],util[_0x490a('0x19')](_0x279e73,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x490a('0x12')]['syncVarSet']=function(_0x24e2df){try{if(this[_0x490a('0x13')](_0x24e2df)){logger[_0x490a('0x16')](_0x490a('0x36'),_0x24e2df[_0x490a('0x18')],util[_0x490a('0x19')](_0x24e2df,{'showHidden':![],'depth':null}));this[_0x490a('0x37')](_0x24e2df[_0x490a('0x18')],_[_0x490a('0x38')](_0x24e2df[_0x490a('0x39')])[0x0],_0x24e2df[_0x490a('0x3a')]);if(this[_0x490a('0x13')](_0x24e2df[_0x490a('0x39')])&&this[_0x490a('0x13')](_0x24e2df[_0x490a('0x39')][_0x490a('0x3b')])){if(_[_0x490a('0x14')](this[_0x490a('0x1a')][_0x24e2df['uniqueid']])){this[_0x490a('0x1a')][_0x24e2df[_0x490a('0x18')]]={'routeId':_0x24e2df[_0x490a('0x3a')],'variables':this['variables'][_0x24e2df[_0x490a('0x18')]]};logger['info'](_0x490a('0x3c'),_0x24e2df['uniqueid'],_0x24e2df[_0x490a('0x39')][_0x490a('0x3b')],_[_0x490a('0x38')](_0x24e2df[_0x490a('0x39')])[0x0],_0x24e2df[_0x490a('0x3a')]);logger[_0x490a('0x16')](_0x490a('0x3d'),_0x24e2df[_0x490a('0x18')],util[_0x490a('0x19')](this[_0x490a('0x1a')][_0x24e2df['uniqueid']],{'showHidden':![],'depth':null}));this[_0x490a('0x15')](_0x490a('0x34'),_0x490a('0x23'),this[_0x490a('0x1a')][_0x24e2df['uniqueid']]);}}}}catch(_0x2b6b87){logger[_0x490a('0x26')](_0x490a('0x3e'),_0x24e2df['uniqueid'],util[_0x490a('0x19')](_0x2b6b87,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x490a('0x12')]['addVariable']=function(_0x4b202b,_0x2d609b,_0x97f361){var _0x423ad3=[_0x490a('0x3f'),_0x490a('0x40'),_0x490a('0x41'),'rtpaudioqosjitterbridged',_0x490a('0x42'),_0x490a('0x43'),_0x490a('0x44'),_0x490a('0x45'),_0x490a('0x46'),_0x490a('0x47'),_0x490a('0x48'),_0x490a('0x49'),_0x490a('0x4a'),'memberdynamic',_0x490a('0x4b'),_0x490a('0x4c'),'membername','memberpenalty',_0x490a('0x4d')];if(!_[_0x490a('0x4e')](_0x2d609b)&&!_['includes'](_0x423ad3,_0x2d609b)){if(_[_0x490a('0x14')](this[_0x490a('0x9')][_0x4b202b])){this[_0x490a('0x9')][_0x4b202b]={};}this[_0x490a('0x9')][_0x4b202b][_0x2d609b]=_0x97f361;}};VoiceDialReport[_0x490a('0x12')]['syncHangup']=function(_0x4e2e8c){try{if(this[_0x490a('0x13')](_0x4e2e8c)){logger[_0x490a('0x16')](_0x490a('0x4f'),_0x4e2e8c[_0x490a('0x18')],util['inspect'](_0x4e2e8c,{'showHidden':![],'depth':null}));if(this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]){logger[_0x490a('0x50')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4e2e8c['uniqueid'],_0x4e2e8c[_0x490a('0x51')]);this['channels'][_0x4e2e8c[_0x490a('0x18')]][_0x490a('0x52')]=moment()[_0x490a('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]['duration']=moment(this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]][_0x490a('0x52')])[_0x490a('0x53')](this['channels'][_0x4e2e8c[_0x490a('0x18')]]['starttime'],'seconds');this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]['lastevent']=_0x490a('0x54');this[_0x490a('0x8')][_0x490a('0x55')]+=0x1;if(this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]][_0x490a('0x56')]){this[_0x490a('0x8')][_0x490a('0x57')]+=0x1;this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]][_0x490a('0x58')]=moment(this[_0x490a('0x1a')][_0x4e2e8c['uniqueid']][_0x490a('0x56')])[_0x490a('0x53')](this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]][_0x490a('0x59')],_0x490a('0x5a'));this[_0x490a('0x1a')][_0x4e2e8c['uniqueid']][_0x490a('0x5b')]=moment(this[_0x490a('0x1a')][_0x4e2e8c['uniqueid']]['endtime'])['diff'](this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]['answertime'],_0x490a('0x5a'));this[_0x490a('0x8')][_0x490a('0x5c')]+=this[_0x490a('0x1a')][_0x4e2e8c['uniqueid']][_0x490a('0x58')]||0x0;this[_0x490a('0x8')]['sumBillable']+=this['channels'][_0x4e2e8c[_0x490a('0x18')]]['billableseconds'];}this[_0x490a('0x8')][_0x490a('0x5d')]+=this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]['duration'];logger['debug'](_0x490a('0x5e'),_0x4e2e8c[_0x490a('0x18')],util['inspect'](this[_0x490a('0x1a')][_0x4e2e8c['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x490a('0x5f'),this['channels'][_0x4e2e8c[_0x490a('0x18')]]);logger[_0x490a('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4e2e8c[_0x490a('0x18')],util[_0x490a('0x19')](this['channels'][_0x4e2e8c[_0x490a('0x18')]],{'showHidden':![],'depth':null}));ami[_0x490a('0x15')](_0x490a('0x60'),this['channels'][_0x4e2e8c['uniqueid']]);logger['debug'](_0x490a('0x61'),_0x4e2e8c[_0x490a('0x18')],util[_0x490a('0x19')](this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x490a('0x34'),_0x490a('0x62'),this['outbound']);logger[_0x490a('0x50')](_0x490a('0x63'),JSON['stringify'](this['channels'][_0x4e2e8c[_0x490a('0x18')]]));logger[_0x490a('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4e2e8c['uniqueid'],util[_0x490a('0x19')](this['channels'][_0x4e2e8c[_0x490a('0x18')]],{'showHidden':![],'depth':null}));this[_0x490a('0x15')](_0x490a('0x34'),_0x490a('0x64'),this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]]);delete this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x18')]];}else if(this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x65')]]){this[_0x490a('0x1a')][_0x4e2e8c[_0x490a('0x65')]]['uniqueid']=this[_0x490a('0x1a')][_0x4e2e8c['linkedid']][_0x490a('0x66')];}if(this['variables'][_0x4e2e8c[_0x490a('0x18')]]){delete this[_0x490a('0x9')][_0x4e2e8c[_0x490a('0x18')]];}}}catch(_0x2da6dd){logger['error']('[%s][voiceDialReport][hangup]',_0x4e2e8c[_0x490a('0x18')],util[_0x490a('0x19')](_0x2da6dd,{'showHidden':![],'depth':null}));}};module[_0x490a('0x67')]=VoiceDialReport; \ No newline at end of file +var _0x47b4=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberinterface','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','total','answered','holdtime','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','stringify'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x47b4,0x192));var _0x447b=function(_0x5d546f,_0x471340){_0x5d546f=_0x5d546f-0x0;var _0x5e17c2=_0x47b4[_0x5d546f];return _0x5e17c2;};'use strict';var _=require(_0x447b('0x0'));var moment=require(_0x447b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x447b('0x2'))('ami');var ami=require(_0x447b('0x3'));config[_0x447b('0x4')]=_[_0x447b('0x5')](config['redis'],{'host':_0x447b('0x6'),'port':0x18eb});var io=require(_0x447b('0x7'))(new Redis(config[_0x447b('0x4')]));function VoiceDialReport(_0x1c47a6){this['channels']=_0x1c47a6[_0x447b('0x8')];this[_0x447b('0x9')]=_0x1c47a6[_0x447b('0x9')];this[_0x447b('0xa')]={};ami['on']('dialbegin',this[_0x447b('0xb')][_0x447b('0xc')](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on'](_0x447b('0xd'),this[_0x447b('0xe')][_0x447b('0xc')](this));ami['on'](_0x447b('0xf'),this[_0x447b('0x10')][_0x447b('0xc')](this));}VoiceDialReport[_0x447b('0x11')][_0x447b('0x12')]=function(_0x39aa37){return _0x39aa37!==null&&!_[_0x447b('0x13')](_0x39aa37);};VoiceDialReport[_0x447b('0x11')][_0x447b('0x14')]=function(_0x35e345,_0x575b2a,_0x1c3fff){io['to'](_0x35e345)[_0x447b('0x14')](_0x575b2a,_0x1c3fff);};VoiceDialReport[_0x447b('0x11')]['syncDialBegin']=function(_0x17c16b){try{if(this[_0x447b('0x12')](_0x17c16b)){logger[_0x447b('0x15')](_0x447b('0x16'),_0x17c16b[_0x447b('0x17')],util[_0x447b('0x18')](_0x17c16b,{'showHidden':![],'depth':null}));if(this[_0x447b('0x19')][_0x17c16b[_0x447b('0x17')]]){_[_0x447b('0x1a')](this['channels'][_0x17c16b[_0x447b('0x17')]],{'starttime':moment()[_0x447b('0x1b')](_0x447b('0x1c')),'lastevent':_0x447b('0x1d'),'interface':_0x17c16b[_0x447b('0x1e')][_0x447b('0x1f')](0x0,_0x17c16b[_0x447b('0x1e')]['lastIndexOf']('-')),'membername':_0x17c16b[_0x447b('0x1e')][_0x447b('0x1f')](_0x17c16b[_0x447b('0x1e')][_0x447b('0x20')]('/')+0x1,_0x17c16b[_0x447b('0x1e')][_0x447b('0x20')]('-'))},_[_0x447b('0x21')](_0x17c16b,[_0x447b('0x22'),_0x447b('0x23')]));logger[_0x447b('0x24')](_0x447b('0x25'),_0x17c16b[_0x447b('0x17')],this[_0x447b('0x19')][_0x17c16b[_0x447b('0x17')]][_0x447b('0x26')],this[_0x447b('0x19')][_0x17c16b[_0x447b('0x17')]]['interface']);logger[_0x447b('0x15')](_0x447b('0x27'),_0x17c16b[_0x447b('0x17')],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x17c16b[_0x447b('0x17')]],{'showHidden':![],'depth':null}));this[_0x447b('0x14')]('voice:outbound',_0x447b('0x28'),this[_0x447b('0x19')][_0x17c16b['uniqueid']]);logger[_0x447b('0x15')](_0x447b('0x29'),_0x17c16b[_0x447b('0x17')],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x17c16b['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x447b('0x14')]('custom:dialbegin',this['channels'][_0x17c16b[_0x447b('0x17')]]);}}}catch(_0x29ffaf){logger['error'](_0x447b('0x2a'),_0x17c16b[_0x447b('0x17')],util[_0x447b('0x18')](_0x29ffaf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x447b('0x11')][_0x447b('0x2b')]=function(_0x46162a){try{if(this[_0x447b('0x12')](_0x46162a)){logger[_0x447b('0x15')](_0x447b('0x2c'),_0x46162a[_0x447b('0x17')],util['inspect'](_0x46162a,{'showHidden':![],'depth':null}));if(this['channels'][_0x46162a['uniqueid']]){this[_0x447b('0x19')][_0x46162a[_0x447b('0x17')]][_0x447b('0x2d')]=_0x46162a['dialstatus'];if(_0x46162a[_0x447b('0x2d')]===_0x447b('0x2e')){this[_0x447b('0x19')][_0x46162a['uniqueid']][_0x447b('0x2f')]=_0x46162a['connectedlinenum'];this[_0x447b('0x19')][_0x46162a['uniqueid']][_0x447b('0x30')]=_0x46162a['connectedlinename'];this[_0x447b('0x19')][_0x46162a[_0x447b('0x17')]][_0x447b('0x31')]=moment()['format'](_0x447b('0x1c'));this[_0x447b('0x19')][_0x46162a[_0x447b('0x17')]][_0x447b('0x32')]=_0x447b('0x33');logger[_0x447b('0x24')](_0x447b('0x34'),_0x46162a[_0x447b('0x17')],_0x46162a[_0x447b('0x1e')][_0x447b('0x1f')](_0x46162a['channel'][_0x447b('0x20')]('/')+0x1,_0x46162a[_0x447b('0x1e')][_0x447b('0x20')]('-')));logger[_0x447b('0x15')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x46162a[_0x447b('0x17')],util[_0x447b('0x18')](this['channels'][_0x46162a[_0x447b('0x17')]],{'showHidden':![],'depth':null}));ami[_0x447b('0x14')](_0x447b('0x35'),this[_0x447b('0x19')][_0x46162a[_0x447b('0x17')]]);}logger['debug'](_0x447b('0x36'),_0x46162a[_0x447b('0x17')],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x46162a['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x447b('0x19')][_0x46162a[_0x447b('0x17')]]);}}}catch(_0xc021b){logger[_0x447b('0x37')]('[%s][voiceDialReport][dialend]',_0x46162a[_0x447b('0x17')],util[_0x447b('0x18')](_0xc021b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x447b('0x11')]['syncVarSet']=function(_0x38ba52){try{if(this[_0x447b('0x12')](_0x38ba52)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x38ba52['uniqueid'],util[_0x447b('0x18')](_0x38ba52,{'showHidden':![],'depth':null}));this['addVariable'](_0x38ba52['uniqueid'],_[_0x447b('0x38')](_0x38ba52['variable'])[0x0],_0x38ba52[_0x447b('0x39')]);if(this[_0x447b('0x12')](_0x38ba52[_0x447b('0x3a')])&&this[_0x447b('0x12')](_0x38ba52[_0x447b('0x3a')][_0x447b('0x3b')])){if(_['isUndefined'](this[_0x447b('0x19')][_0x38ba52[_0x447b('0x17')]])){this[_0x447b('0x19')][_0x38ba52[_0x447b('0x17')]]={'routeId':_0x38ba52[_0x447b('0x39')],'variables':this[_0x447b('0xa')][_0x38ba52[_0x447b('0x17')]]};logger[_0x447b('0x24')](_0x447b('0x3c'),_0x38ba52['uniqueid'],_0x38ba52[_0x447b('0x3a')][_0x447b('0x3b')],_[_0x447b('0x38')](_0x38ba52['variable'])[0x0],_0x38ba52[_0x447b('0x39')]);logger[_0x447b('0x15')](_0x447b('0x3d'),_0x38ba52[_0x447b('0x17')],util['inspect'](this[_0x447b('0x19')][_0x38ba52[_0x447b('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x447b('0x3e'),_0x447b('0x28'),this['channels'][_0x38ba52[_0x447b('0x17')]]);}}}}catch(_0xbd4d52){logger['error'](_0x447b('0x3f'),_0x38ba52[_0x447b('0x17')],util['inspect'](_0xbd4d52,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x447b('0x11')]['addVariable']=function(_0x432262,_0x354be1,_0x49e58f){var _0x3b4c4=[_0x447b('0x40'),_0x447b('0x41'),'rtpaudioqosjitter',_0x447b('0x42'),_0x447b('0x43'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x447b('0x44'),_0x447b('0x45'),_0x447b('0x46'),'bridgepeer',_0x447b('0x47'),'membercalls','memberdynamic',_0x447b('0x48'),'memberlastcall','membername','memberpenalty','memberrealtime'];if(!_['isNil'](_0x354be1)&&!_[_0x447b('0x49')](_0x3b4c4,_0x354be1)){if(_['isUndefined'](this[_0x447b('0xa')][_0x432262])){this[_0x447b('0xa')][_0x432262]={};}this[_0x447b('0xa')][_0x432262][_0x354be1]=_0x49e58f;}};VoiceDialReport['prototype'][_0x447b('0x10')]=function(_0x52d08a){try{if(this[_0x447b('0x12')](_0x52d08a)){logger[_0x447b('0x15')](_0x447b('0x4a'),_0x52d08a['uniqueid'],util[_0x447b('0x18')](_0x52d08a,{'showHidden':![],'depth':null}));if(this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]){logger[_0x447b('0x24')](_0x447b('0x4b'),_0x52d08a['uniqueid'],_0x52d08a[_0x447b('0x4c')]);this['channels'][_0x52d08a[_0x447b('0x17')]]['endtime']=moment()[_0x447b('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]['duration']=moment(this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x4d')])[_0x447b('0x4e')](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x4f')],_0x447b('0x50'));this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x32')]='complete';this[_0x447b('0x9')][_0x447b('0x51')]+=0x1;if(this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x31')]){this[_0x447b('0x9')][_0x447b('0x52')]+=0x1;this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x53')]=moment(this[_0x447b('0x19')][_0x52d08a['uniqueid']][_0x447b('0x31')])[_0x447b('0x4e')](this['channels'][_0x52d08a[_0x447b('0x17')]][_0x447b('0x4f')],_0x447b('0x50'));this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]['billableseconds']=moment(this['channels'][_0x52d08a[_0x447b('0x17')]][_0x447b('0x4d')])[_0x447b('0x4e')](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]['answertime'],_0x447b('0x50'));this[_0x447b('0x9')][_0x447b('0x54')]+=this['channels'][_0x52d08a[_0x447b('0x17')]]['holdtime']||0x0;this[_0x447b('0x9')][_0x447b('0x55')]+=this[_0x447b('0x19')][_0x52d08a['uniqueid']]['billableseconds'];}this[_0x447b('0x9')][_0x447b('0x56')]+=this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]][_0x447b('0x57')];logger[_0x447b('0x15')](_0x447b('0x58'),_0x52d08a[_0x447b('0x17')],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]],{'showHidden':![],'depth':null}));ami[_0x447b('0x14')](_0x447b('0x59'),this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]);logger[_0x447b('0x15')](_0x447b('0x5a'),_0x52d08a[_0x447b('0x17')],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x52d08a['uniqueid'],util['inspect'](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]],{'showHidden':![],'depth':null}));this[_0x447b('0x14')](_0x447b('0x3e'),_0x447b('0x5b'),this[_0x447b('0x9')]);logger[_0x447b('0x24')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x447b('0x5c')](this['channels'][_0x52d08a[_0x447b('0x17')]]));logger[_0x447b('0x15')](_0x447b('0x5d'),_0x52d08a['uniqueid'],util[_0x447b('0x18')](this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]],{'showHidden':![],'depth':null}));this[_0x447b('0x14')](_0x447b('0x3e'),_0x447b('0x5e'),this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]]);delete this[_0x447b('0x19')][_0x52d08a[_0x447b('0x17')]];}else if(this[_0x447b('0x19')][_0x52d08a[_0x447b('0x5f')]]){this[_0x447b('0x19')][_0x52d08a['linkedid']][_0x447b('0x17')]=this[_0x447b('0x19')][_0x52d08a[_0x447b('0x5f')]][_0x447b('0x60')];}if(this[_0x447b('0xa')][_0x52d08a[_0x447b('0x17')]]){delete this[_0x447b('0xa')][_0x52d08a[_0x447b('0x17')]];}}}catch(_0x519610){logger['error'](_0x447b('0x61'),_0x52d08a[_0x447b('0x17')],util[_0x447b('0x18')](_0x519610,{'showHidden':![],'depth':null}));}};module[_0x447b('0x62')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 7780b8d..4581c5d 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 _0xc6fe=['loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][','voice_queue_presence:remove','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','last','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][agentcomplete]','addVariable','value','variable','queuestatus','CONTINUE','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceQueueReport][hangup]','diff','length','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','md5','ioredis','../../../config/environment','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','bind','queuecallerleave','syncQueueCallerLeave','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xc6fe,0xbc));var _0xec6f=function(_0x2aefd3,_0x13f33a){_0x2aefd3=_0x2aefd3-0x0;var _0x5f41c3=_0xc6fe[_0x2aefd3];return _0x5f41c3;};'use strict';var _=require(_0xec6f('0x0'));var moment=require(_0xec6f('0x1'));var util=require('util');var md5=require(_0xec6f('0x2'));var Redis=require(_0xec6f('0x3'));var config=require(_0xec6f('0x4'));var logger=require('../../../config/logger')(_0xec6f('0x5'));var ami=require('../ami');var QueueReport=require(_0xec6f('0x6'));config[_0xec6f('0x7')]=_[_0xec6f('0x8')](config[_0xec6f('0x7')],{'host':_0xec6f('0x9'),'port':0x18eb});var io=require(_0xec6f('0xa'))(new Redis(config[_0xec6f('0x7')]));var Sequence=function(){};Sequence[_0xec6f('0xb')][_0xec6f('0xc')]=function(_0x38485a){this['tail']=this[_0xec6f('0xd')]?this[_0xec6f('0xd')][_0xec6f('0xe')](_0x38485a):_0x38485a();};function VoiceQueueReport(_0x138d0b){this[_0xec6f('0xf')]=new Sequence();this[_0xec6f('0x10')]={};this[_0xec6f('0x11')]=_0x138d0b[_0xec6f('0x11')];this[_0xec6f('0x12')]=_0x138d0b[_0xec6f('0x13')];this[_0xec6f('0x14')]=_0x138d0b['voiceQueues'];this[_0xec6f('0x15')]=!![];this[_0xec6f('0x16')]=_0x138d0b[_0xec6f('0x16')];this[_0xec6f('0x17')]={};ami['on'](_0xec6f('0x18'),this['syncQueueSummary']['bind'](this));ami['on'](_0xec6f('0x19'),this[_0xec6f('0x1a')]['bind'](this));ami['on']('queuecallerjoin',this[_0xec6f('0x1b')][_0xec6f('0x1c')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x1d'),this[_0xec6f('0x1e')][_0xec6f('0x1c')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x1f'),this[_0xec6f('0x20')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x21'),this[_0xec6f('0x22')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x23'),this['syncHangup'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x24'),this[_0xec6f('0x25')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x26'),this[_0xec6f('0x27')]['bind'](this));ami['on'](_0xec6f('0x28'),this['syncMusicOnHoldStop'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x29'),this[_0xec6f('0x2a')][_0xec6f('0x1c')](this));ami['on']('blindtransfer',this[_0xec6f('0x2b')]['bind'](this));this[_0xec6f('0x2c')]();this[_0xec6f('0x2d')]();}function clearChannels(_0xcf978){if(!_[_0xec6f('0x2e')](_0xcf978)){for(var _0x339a6e in _0xcf978){if(_0xcf978[_0xec6f('0x2f')](_0x339a6e)){delete _0xcf978[_0x339a6e];}}}}function clearCampaigns(_0x4e5798){if(!_[_0xec6f('0x2e')](_0x4e5798)){for(var _0x2251fe in _0x4e5798){if(_0x4e5798[_0xec6f('0x2f')](_0x2251fe)){_0x4e5798[_0x2251fe][_0xec6f('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1953cb){if(!_[_0xec6f('0x2e')](_0x1953cb)){for(var _0x19e542 in _0x1953cb){if(_0x1953cb['hasOwnProperty'](_0x19e542)){_0x1953cb[_0x19e542][_0xec6f('0x30')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x31')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x32')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x33')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x34')]=!![];}}}}function clearAgentBooked(_0x29e06a){if(!_['isEmpty'](_0x29e06a)){for(var _0x5aff82 in _0x29e06a){if(_0x29e06a[_0xec6f('0x2f')](_0x5aff82)){_0x29e06a[_0x5aff82]['unlockRR']=!![];}}}}VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x35')]=function(){var _0x32dc26=this;for(var _0x3180eb in this[_0xec6f('0x12')]){if(this['channels'][_0xec6f('0x2f')](_0x3180eb)&&!this['channels'][_0x3180eb][_0xec6f('0x36')]){this[_0xec6f('0xf')][_0xec6f('0xc')](function(){if(!_[_0xec6f('0x37')](_0x32dc26['channels'][_0x3180eb])){return ami[_0xec6f('0x38')]({'action':_0xec6f('0x39'),'channel':_0x32dc26[_0xec6f('0x12')][_0x3180eb][_0xec6f('0x3a')]})[_0xec6f('0x3b')](function(_0xbbadd4){if(_0xbbadd4[_0xec6f('0x3c')]===_0xec6f('0x3d')){setTimeout(function(){if(_0x32dc26['channels'][_0x3180eb]){delete _0x32dc26[_0xec6f('0x12')][_0x3180eb];logger[_0xec6f('0x3e')](_0xec6f('0x3f'),_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}if(_0x32dc26['queueReports'][_0x3180eb]){delete _0x32dc26['queueReports'][_0x3180eb];logger[_0xec6f('0x3e')](_0xec6f('0x41'),_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}if(_0x32dc26['variables'][_0x3180eb]){delete _0x32dc26[_0xec6f('0x17')][_0x3180eb];logger[_0xec6f('0x3e')]('[%s][voiceQueueReport][checkVariables]',_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xec6f('0x3e')](_0xec6f('0x42'));clearChannels(this['channels']);this[_0xec6f('0x43')](this[_0xec6f('0x10')]);clearAgentBooked(this[_0xec6f('0x11')]);clearVoiceQueues(this[_0xec6f('0x14')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x43')]=function(_0x5888f8){var _0x55b5e6=this;if(!_[_0xec6f('0x2e')](_0x5888f8)){for(var _0x4306ca in _0x5888f8){if(_0x5888f8[_0xec6f('0x2f')](_0x4306ca)){_0x55b5e6[_0xec6f('0x44')](_0x5888f8[_0x4306ca],_0xec6f('0x45'));delete _0x5888f8[_0x4306ca];}}}};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x46')]=function(_0x1f8f97,_0x24f50e,_0x381dd8){io['to'](_0x1f8f97)[_0xec6f('0x46')](_0x24f50e,_0x381dd8);};VoiceQueueReport[_0xec6f('0xb')]['emitVoiceQueueChannelSave']=function(_0x1fdb95,_0x346228){logger[_0xec6f('0x47')]('[%s][voiceQueueReport]['+_0x346228+_0xec6f('0x48'),_0x1fdb95[_0xec6f('0x49')],util['inspect'](_0x1fdb95,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0x1fdb95[_0xec6f('0x4b')]),_0xec6f('0x4c'),_0x1fdb95);io[_0xec6f('0x46')](_0xec6f('0x4d'),_0x1fdb95);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0xa45bf8,_0x228f69){logger[_0xec6f('0x47')](_0xec6f('0x4e')+_0x228f69+']\x20sending\x20voice_queue_channel:remove\x20event:',_0xa45bf8['uniqueid'],util['inspect'](_0xa45bf8,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0xa45bf8[_0xec6f('0x4b')]),'voice_queue_channel:remove',_0xa45bf8);io[_0xec6f('0x46')](_0xec6f('0x4f'),_0xa45bf8);};VoiceQueueReport[_0xec6f('0xb')]['emitVoiceQueueSummary']=function(_0x1f0f94,_0x2a98bd){if(_0x1f0f94[_0xec6f('0x50')]===_0xec6f('0x51')){var _0x75fc51={'id':_0x1f0f94['id'],'name':_0x1f0f94[_0xec6f('0x4b')],'strategy':_0x1f0f94['strategy'],'answered':_0x1f0f94[_0xec6f('0x52')],'available':_0x1f0f94[_0xec6f('0x53')],'loggedIn':_0x1f0f94[_0xec6f('0x54')],'pTalking':_0x1f0f94[_0xec6f('0x32')],'sumBillable':_0x1f0f94[_0xec6f('0x55')],'sumDuration':_0x1f0f94[_0xec6f('0x56')],'sumHoldTime':_0x1f0f94[_0xec6f('0x57')]||0x0,'talking':_0x1f0f94[_0xec6f('0x31')],'total':_0x1f0f94[_0xec6f('0x58')],'type':_0x1f0f94[_0xec6f('0x50')],'unmanaged':_0x1f0f94[_0xec6f('0x59')],'abandoned':_0x1f0f94[_0xec6f('0x5a')],'waiting':_0x1f0f94[_0xec6f('0x33')]};if(_0x1f0f94[_0xec6f('0x5b')]){_0x75fc51['Trunk']={'id':_0x1f0f94[_0xec6f('0x5b')]['id'],'name':_0x1f0f94[_0xec6f('0x5b')]['name'],'active':_0x1f0f94[_0xec6f('0x5b')][_0xec6f('0x5c')],'callerid':_0x1f0f94[_0xec6f('0x5b')][_0xec6f('0x5d')]};}if(_0x1f0f94[_0xec6f('0x5e')]){_0x75fc51['Interval']={'id':_0x1f0f94['Interval']['id'],'name':_0x1f0f94[_0xec6f('0x5e')]['name']};}var _0x3f738f=md5(JSON[_0xec6f('0x5f')](_0x75fc51));if(_0x1f0f94[_0xec6f('0x2')]!==_0x3f738f){_0x1f0f94[_0xec6f('0x2')]=_0x3f738f;logger[_0xec6f('0x47')](_0xec6f('0x60')+_0x2a98bd+_0xec6f('0x61'),util['inspect'](_0x75fc51,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0x75fc51['name']),_0xec6f('0x62'),_0x75fc51);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x2bd32c){return _0x2bd32c!==null&&!_[_0xec6f('0x63')](_0x2bd32c);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x2d')]=function(){var _0x117f5d=this;setInterval(function(){_0x117f5d[_0xec6f('0x35')]();ami['Action']({'action':_0xec6f('0x64')})[_0xec6f('0x3b')](function(_0x2f1738){logger['error'](_0xec6f('0x65'),util[_0xec6f('0x40')](_0x2f1738,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x2c')]=function(){var _0x20d8ae=this;setInterval(function(){if(_0x20d8ae['flagQueueSummary']){return ami['Action']({'action':'queuesummary'})['then'](function(_0x26b1c3){_0x20d8ae[_0xec6f('0x15')]=![];})[_0xec6f('0x3b')](function(_0x5c47ac){logger[_0xec6f('0x3e')](_0xec6f('0x66'),util[_0xec6f('0x40')](_0x5c47ac,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x67')]=function(_0x5b91f5){try{if(this[_0xec6f('0x68')](_0x5b91f5)&&this[_0xec6f('0x68')](_0x5b91f5[_0xec6f('0x69')])){logger[_0xec6f('0x47')](_0xec6f('0x6a'),util[_0xec6f('0x40')](_0x5b91f5,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]){logger[_0xec6f('0x6b')](_0xec6f('0x6c'),_0x5b91f5[_0xec6f('0x69')]);var _0x45ce53=_[_0xec6f('0x6d')](this[_0xec6f('0x12')],'queue')[_0x5b91f5['queue']]||0x0;var _0x66e44d=_0x45ce53-_0x5b91f5['callers'];if(this['voiceQueues'][_0x5b91f5['queue']][_0xec6f('0x33')]!==_['toNumber'](_0x5b91f5[_0xec6f('0x6e')])||this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x54')]!==_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')])||this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x53')]!==_['toNumber'](_0x5b91f5[_0xec6f('0x53')])||this['voiceQueues'][_0x5b91f5[_0xec6f('0x69')]]['talking']!==_0x66e44d){this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x33')]=_['toNumber'](_0x5b91f5['callers']);this['voiceQueues'][_0x5b91f5['queue']][_0xec6f('0x54')]=_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')]);this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]['available']=_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x53')]);this[_0xec6f('0x14')][_0x5b91f5['queue']][_0xec6f('0x31')]=_0x66e44d>0x0?_0x66e44d:0x0;this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]['talking']=this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x31')]>_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')])?_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')]):this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x31')];this[_0xec6f('0x71')](this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]],'queuesummary');}logger[_0xec6f('0x47')](_0xec6f('0x72'),util[_0xec6f('0x40')](this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0xec6f('0x73'),this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]);}}}catch(_0x419411){logger[_0xec6f('0x3e')](_0xec6f('0x66'),util['inspect'](_0x419411,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x1a')]=function(_0x244bd0){logger[_0xec6f('0x47')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xec6f('0x40')](_0x244bd0,{'showHidden':![],'depth':null}));this[_0xec6f('0x15')]=!![];};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x1b')]=function(_0x124ca1){try{if(this[_0xec6f('0x68')](_0x124ca1)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x124ca1[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x124ca1,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xec6f('0x10')][_0x124ca1[_0xec6f('0x49')]])){this[_0xec6f('0x10')][_0x124ca1['uniqueid']]=[];this[_0xec6f('0x12')][_0x124ca1[_0xec6f('0x49')]]={};}var _0x43d400=new QueueReport();_0x43d400['name']=_0x124ca1[_0xec6f('0x69')];_0x43d400[_0xec6f('0x50')]=this[_0xec6f('0x14')][_0x43d400[_0xec6f('0x4b')]]&&this['voiceQueues'][_0x43d400[_0xec6f('0x4b')]][_0xec6f('0x50')]?this['voiceQueues'][_0x43d400[_0xec6f('0x4b')]][_0xec6f('0x50')]||_0xec6f('0x51'):_0xec6f('0x51');_0x43d400['queue']=_0x124ca1[_0xec6f('0x69')];_0x43d400[_0xec6f('0x74')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x43d400[_0xec6f('0x77')]=_0x124ca1['position'];_0x43d400[_0xec6f('0x78')]=_0x124ca1['count'];_0x43d400[_0xec6f('0x49')]=_0x124ca1[_0xec6f('0x49')];logger[_0xec6f('0x6b')](_0xec6f('0x79'),_0x43d400['name'],_0x43d400['type']);_[_0xec6f('0x7a')](_0x43d400,_[_0xec6f('0x7b')](_0x124ca1,_[_0xec6f('0x7c')](_0x43d400)));this[_0xec6f('0x10')][_0x124ca1[_0xec6f('0x49')]][_0xec6f('0x7d')](_0x43d400);this['channels'][_0x124ca1[_0xec6f('0x49')]]=_0x43d400;this[_0xec6f('0x7e')](_0x43d400,_0xec6f('0x7f'));}}catch(_0x5bd8ab){logger[_0xec6f('0x3e')](_0xec6f('0x80'),_0x124ca1[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x5bd8ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x81')]=function(_0x519435){try{if(this['isNotNull'](_0x519435)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x519435[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x519435,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x519435['uniqueid']]){var _0x1f09d6=_['last'](this[_0xec6f('0x10')][_0x519435['uniqueid']]);_0x1f09d6[_0xec6f('0x82')]=![];_0x1f09d6[_0xec6f('0x83')]=null;_0x1f09d6[_0xec6f('0x84')]=_0x519435[_0xec6f('0x84')];_0x1f09d6['originalposition']=_0x519435[_0xec6f('0x85')];_0x1f09d6[_0xec6f('0x86')]=!![];_0x1f09d6[_0xec6f('0x87')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x1f09d6[_0xec6f('0x88')]=_0xec6f('0x89');_0x1f09d6[_0xec6f('0x8a')]=null;logger[_0xec6f('0x6b')](_0xec6f('0x8b'),_0x1f09d6[_0xec6f('0x4b')],_0x1f09d6[_0xec6f('0x50')]);this[_0xec6f('0x12')][_0x519435[_0xec6f('0x49')]]=_0x1f09d6;this[_0xec6f('0x44')](_0x1f09d6,'queuecallerabandon');}}}catch(_0x1eb45d){logger[_0xec6f('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x519435['uniqueid'],util[_0xec6f('0x40')](_0x1eb45d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncQueueCallerLeave']=function(_0x5bd68a){try{if(this[_0xec6f('0x68')](_0x5bd68a)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x5bd68a['uniqueid'],util['inspect'](_0x5bd68a,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x5bd68a[_0xec6f('0x49')]]){var _0x1152d2=_['last'](this[_0xec6f('0x10')][_0x5bd68a[_0xec6f('0x49')]]);_0x1152d2[_0xec6f('0x8c')]=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x1152d2[_0xec6f('0x8d')]=_0x5bd68a[_0xec6f('0x8d')];_0x1152d2[_0xec6f('0x8e')]=_0x5bd68a[_0xec6f('0x8e')];logger[_0xec6f('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1152d2[_0xec6f('0x4b')],_0x1152d2[_0xec6f('0x50')],_0x5bd68a[_0xec6f('0x8d')],_0x5bd68a[_0xec6f('0x8e')]);this[_0xec6f('0x12')][_0x5bd68a[_0xec6f('0x49')]]=_0x1152d2;this[_0xec6f('0x7e')](_0x1152d2,_0xec6f('0x1d'));}}}catch(_0x1e8d63){logger['error'](_0xec6f('0x8f'),_0x5bd68a['uniqueid'],util['inspect'](_0x1e8d63,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x20')]=function(_0x4e0b0d){try{if(this[_0xec6f('0x68')](_0x4e0b0d)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x4e0b0d[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x4e0b0d,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x4e0b0d[_0xec6f('0x49')]]){var _0x249db3=_['last'](this[_0xec6f('0x10')][_0x4e0b0d['uniqueid']]);_0x249db3[_0xec6f('0x82')]=!![];_0x249db3[_0xec6f('0x88')]=_0xec6f('0x90');logger[_0xec6f('0x6b')](_0xec6f('0x91'),_0x249db3[_0xec6f('0x4b')],_0x249db3['type']);}}}catch(_0x419187){logger[_0xec6f('0x3e')](_0xec6f('0x92'),_0x4e0b0d[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x419187,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncAgentComplete']=function(_0x32cf02){try{if(this[_0xec6f('0x68')](_0x32cf02)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x32cf02['uniqueid'],util[_0xec6f('0x40')](_0x32cf02,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]){var _0x4a1f0f=_['last'](this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]);_0x4a1f0f[_0xec6f('0x86')]=![];_0x4a1f0f['queuecallerabandonAt']=null;_0x4a1f0f['assigned']=!![];_0x4a1f0f[_0xec6f('0x8a')]=_0x32cf02[_0xec6f('0x93')];_0x4a1f0f['holdtime']=_0x32cf02[_0xec6f('0x84')];_0x4a1f0f[_0xec6f('0x82')]=!![];_0x4a1f0f[_0xec6f('0x94')]=![];_0x4a1f0f[_0xec6f('0x95')]=null;if(!_0x4a1f0f[_0xec6f('0x96')]){if(_0x32cf02['reason']=='transfer'){_0x4a1f0f[_0xec6f('0x88')]=_0xec6f('0x97');logger['info'](_0xec6f('0x98'),_0x4a1f0f['name'],_0x4a1f0f[_0xec6f('0x50')]);}else{if(_[_0xec6f('0x99')](_0x32cf02[_0xec6f('0x3a')][_0xec6f('0x9a')](),_0xec6f('0x9b'))){if(this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]]){var _0x516566=_[_0xec6f('0x9d')](this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]]);_0x516566['queuecallercomplete']=![];_0x516566[_0xec6f('0x94')]=!![];_0x516566[_0xec6f('0x95')]=moment(_0x4a1f0f['queuecallerjoinAt'])[_0xec6f('0x9e')](_0x32cf02[_0xec6f('0x84')],_0xec6f('0x9f'))[_0xec6f('0x75')](_0xec6f('0x76'));_0x516566[_0xec6f('0x88')]=_0xec6f('0xa0');_0x516566['transfer']=!![];_0x516566[_0xec6f('0xa1')]='FORWARD';_0x516566[_0xec6f('0xa2')]=_0x32cf02['destexten'];_0x516566[_0xec6f('0xa3')]=_0x32cf02[_0xec6f('0x49')];logger[_0xec6f('0x6b')](_0xec6f('0xa4'),_0x516566[_0xec6f('0x4b')],_0x516566[_0xec6f('0x50')]);var _0x5603db=this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]];this[_0xec6f('0x10')][_0x32cf02['linkedid']]=this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]];this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]=_0x5603db;}}else{_0x4a1f0f[_0xec6f('0x88')]=_0xec6f('0xa5')+_0x32cf02['reason'][_0xec6f('0xa6')]();logger[_0xec6f('0x6b')](_0xec6f('0xa7'),_0x4a1f0f[_0xec6f('0x4b')],_0x4a1f0f[_0xec6f('0x50')],_0x4a1f0f[_0xec6f('0x88')]);}}}this[_0xec6f('0x12')][_0x32cf02[_0xec6f('0x49')]]=_0x4a1f0f;this[_0xec6f('0x44')](_0x4a1f0f,_0xec6f('0xa8'));}}}catch(_0x5cb3f9){logger['error'](_0xec6f('0xa9'),_0x32cf02[_0xec6f('0x49')],util['inspect'](_0x5cb3f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncVarSet']=function(_0x1afca3){try{if(this[_0xec6f('0x68')](_0x1afca3)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][varset]',_0x1afca3[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x1afca3,{'showHidden':![],'depth':null}));this[_0xec6f('0xaa')](_0x1afca3[_0xec6f('0x49')],_[_0xec6f('0x7c')](_0x1afca3['variable'])[0x0],_0x1afca3[_0xec6f('0xab')]);if(this[_0xec6f('0x10')][_0x1afca3[_0xec6f('0x49')]]){var _0x38975a=_[_0xec6f('0x9d')](this['queueReports'][_0x1afca3[_0xec6f('0x49')]]);if(_0x38975a){if(this['isNotNull'](_0x1afca3[_0xec6f('0xac')])&&this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')][_0xec6f('0xad')])){switch(_0x1afca3[_0xec6f('0xab')]){case _0xec6f('0xae'):_0x38975a[_0xec6f('0x94')]=![];_0x38975a[_0xec6f('0x95')]=null;break;case'TIMEOUT':_0x38975a[_0xec6f('0xaf')]='timeout';_0x38975a[_0xec6f('0x94')]=!![];_0x38975a[_0xec6f('0x95')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x38975a[_0xec6f('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xec6f('0x47')](_0xec6f('0xb0'),_0x1afca3[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x38975a,{'showHidden':![],'depth':null}));ami[_0xec6f('0x46')](_0xec6f('0xb1'),_0x38975a);break;default:_0x38975a[_0xec6f('0x94')]=!![];_0x38975a[_0xec6f('0x95')]=moment()['format'](_0xec6f('0x76'));_0x38975a['queuecallerleaveAt']=moment()[_0xec6f('0x75')](_0xec6f('0x76'));}_0x38975a[_0xec6f('0x86')]=![];_0x38975a[_0xec6f('0x87')]=null;_0x38975a[_0xec6f('0x88')]=_0x1afca3[_0xec6f('0xab')];this[_0xec6f('0x12')][_0x1afca3[_0xec6f('0x49')]]=_0x38975a;this[_0xec6f('0x44')](_0x38975a,_0xec6f('0x21'));}else if(this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')])&&this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')][_0xec6f('0xb2')])){if(!_0x38975a[_0xec6f('0x86')]){_0x38975a[_0xec6f('0x94')]=!![];_0x38975a['queuecallerexitAt']=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x38975a[_0xec6f('0x88')]='EXITWITHKEY';_0x38975a['queuecallerleaveAt']=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xec6f('0x12')][_0x1afca3[_0xec6f('0x49')]]=_0x38975a;}}logger[_0xec6f('0x6b')](_0xec6f('0xb3'),_0x1afca3[_0xec6f('0x49')],_0x38975a[_0xec6f('0x4b')],_0x38975a[_0xec6f('0x50')],_['keys'](_0x1afca3[_0xec6f('0xac')])[0x0],_0x1afca3[_0xec6f('0xab')]);_0x38975a['variables']=this[_0xec6f('0x17')][_0x1afca3[_0xec6f('0x49')]];}}}}catch(_0x3bdf3e){logger[_0xec6f('0x3e')](_0xec6f('0xb4'),_0x1afca3['uniqueid'],util[_0xec6f('0x40')](_0x3bdf3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0xaa')]=function(_0x3e1317,_0x2ef1f6,_0xd4ebd6){var _0x241254=[_0xec6f('0xb5'),_0xec6f('0xb6'),_0xec6f('0xb7'),_0xec6f('0xb8'),_0xec6f('0xb9'),_0xec6f('0xba'),_0xec6f('0xbb'),_0xec6f('0xbc'),_0xec6f('0xbd'),_0xec6f('0xbe'),'bridgepeer',_0xec6f('0xbf'),_0xec6f('0xc0'),'memberdynamic',_0xec6f('0xc1'),_0xec6f('0xc2'),_0xec6f('0x93'),_0xec6f('0xc3'),_0xec6f('0xc4')];if(!_[_0xec6f('0x37')](_0x2ef1f6)&&!_[_0xec6f('0xc5')](_0x241254,_0x2ef1f6)){if(_[_0xec6f('0x63')](this['variables'][_0x3e1317])){this['variables'][_0x3e1317]={};}this['variables'][_0x3e1317][_0x2ef1f6]=_0xd4ebd6;}};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0xc6')]=function(_0x190e91){try{if(this[_0xec6f('0x68')](_0x190e91)){logger['debug'](_0xec6f('0xc7'),_0x190e91['uniqueid'],util[_0xec6f('0x40')](_0x190e91,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x190e91[_0xec6f('0x49')]]){for(var _0x3e1eac=0x0,_0x5462c6={};_0x3e1eac0x0?_0x56eaa1:0x0;this[_0x0af8('0xf')][_0x1cbc96[_0x0af8('0x5f')]]['talking']=this[_0x0af8('0xf')][_0x1cbc96['queue']][_0x0af8('0x2a')]>_[_0x0af8('0x64')](_0x1cbc96['loggedin'])?_['toNumber'](_0x1cbc96['loggedin']):this[_0x0af8('0xf')][_0x1cbc96[_0x0af8('0x5f')]][_0x0af8('0x2a')];this[_0x0af8('0x4b')](this[_0x0af8('0xf')][_0x1cbc96[_0x0af8('0x5f')]],'queuesummary');}logger[_0x0af8('0x47')](_0x0af8('0x68'),util[_0x0af8('0x38')](this['voiceQueues'][_0x1cbc96[_0x0af8('0x5f')]],{'showHidden':![],'depth':null}));ami[_0x0af8('0x3f')]('custom:queuesummary',this[_0x0af8('0xf')][_0x1cbc96[_0x0af8('0x5f')]]);}}}catch(_0x139d90){logger[_0x0af8('0x36')](_0x0af8('0x69'),util['inspect'](_0x139d90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')][_0x0af8('0x6a')]=function(_0x3bc1b3){logger[_0x0af8('0x47')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x3bc1b3,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x0af8('0x17')]=function(_0x80473b){try{if(this[_0x0af8('0x5a')](_0x80473b)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x80473b['uniqueid'],util['inspect'](_0x80473b,{'showHidden':![],'depth':null}));if(_[_0x0af8('0x6b')](this['queueReports'][_0x80473b[_0x0af8('0x42')]])){this[_0x0af8('0x39')][_0x80473b[_0x0af8('0x42')]]=[];this[_0x0af8('0xd')][_0x80473b['uniqueid']]={};}var _0x1508bd=new QueueReport();_0x1508bd[_0x0af8('0x44')]=_0x80473b[_0x0af8('0x5f')];_0x1508bd[_0x0af8('0x4c')]=this[_0x0af8('0xf')][_0x1508bd[_0x0af8('0x44')]]&&this[_0x0af8('0xf')][_0x1508bd[_0x0af8('0x44')]]['type']?this[_0x0af8('0xf')][_0x1508bd[_0x0af8('0x44')]][_0x0af8('0x4c')]||_0x0af8('0x4d'):'inbound';_0x1508bd[_0x0af8('0x5f')]=_0x80473b[_0x0af8('0x5f')];_0x1508bd[_0x0af8('0x6c')]=moment()[_0x0af8('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1508bd['position']=_0x80473b[_0x0af8('0x6d')];_0x1508bd[_0x0af8('0x6e')]=_0x80473b[_0x0af8('0x6e')];_0x1508bd[_0x0af8('0x42')]=_0x80473b[_0x0af8('0x42')];logger[_0x0af8('0x61')](_0x0af8('0x6f'),_0x1508bd[_0x0af8('0x44')],_0x1508bd[_0x0af8('0x4c')]);_[_0x0af8('0x70')](_0x1508bd,_[_0x0af8('0x71')](_0x80473b,_[_0x0af8('0x72')](_0x1508bd)));this[_0x0af8('0x39')][_0x80473b[_0x0af8('0x42')]]['push'](_0x1508bd);this[_0x0af8('0xd')][_0x80473b['uniqueid']]=_0x1508bd;this['emitVoiceQueueChannelSave'](_0x1508bd,'queuecallerjoin');}}catch(_0xf632bf){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x80473b['uniqueid'],util[_0x0af8('0x38')](_0xf632bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')][_0x0af8('0x19')]=function(_0x270f51){try{if(this[_0x0af8('0x5a')](_0x270f51)){logger[_0x0af8('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x270f51[_0x0af8('0x42')],util['inspect'](_0x270f51,{'showHidden':![],'depth':null}));if(this[_0x0af8('0x39')][_0x270f51[_0x0af8('0x42')]]){var _0x4bcead=_['last'](this[_0x0af8('0x39')][_0x270f51[_0x0af8('0x42')]]);_0x4bcead[_0x0af8('0x73')]=![];_0x4bcead['queuecallercompleteAt']=null;_0x4bcead['holdtime']=_0x270f51['holdtime'];_0x4bcead['originalposition']=_0x270f51[_0x0af8('0x74')];_0x4bcead[_0x0af8('0x18')]=!![];_0x4bcead['queuecallerabandonAt']=moment()[_0x0af8('0x43')](_0x0af8('0x75'));_0x4bcead[_0x0af8('0x76')]='ABANDONED';_0x4bcead[_0x0af8('0x77')]=null;logger[_0x0af8('0x61')](_0x0af8('0x78'),_0x4bcead[_0x0af8('0x44')],_0x4bcead[_0x0af8('0x4c')]);this[_0x0af8('0xd')][_0x270f51[_0x0af8('0x42')]]=_0x4bcead;this['emitVoiceQueueChannelRemove'](_0x4bcead,_0x0af8('0x18'));}}}catch(_0x4a06cd){logger['error'](_0x0af8('0x79'),_0x270f51[_0x0af8('0x42')],util[_0x0af8('0x38')](_0x4a06cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')][_0x0af8('0x7a')]=function(_0x27dd27){try{if(this[_0x0af8('0x5a')](_0x27dd27)){logger[_0x0af8('0x47')](_0x0af8('0x7b'),_0x27dd27[_0x0af8('0x42')],util['inspect'](_0x27dd27,{'showHidden':![],'depth':null}));if(this[_0x0af8('0x39')][_0x27dd27[_0x0af8('0x42')]]){var _0x187d74=_[_0x0af8('0x7c')](this[_0x0af8('0x39')][_0x27dd27['uniqueid']]);_0x187d74[_0x0af8('0x7d')]=moment()[_0x0af8('0x43')](_0x0af8('0x75'));_0x187d74[_0x0af8('0x7e')]=_0x27dd27[_0x0af8('0x7e')];_0x187d74[_0x0af8('0x7f')]=_0x27dd27['connectedlinename'];logger[_0x0af8('0x61')](_0x0af8('0x80'),_0x187d74[_0x0af8('0x44')],_0x187d74[_0x0af8('0x4c')],_0x27dd27[_0x0af8('0x7e')],_0x27dd27[_0x0af8('0x7f')]);this[_0x0af8('0xd')][_0x27dd27['uniqueid']]=_0x187d74;this[_0x0af8('0x40')](_0x187d74,'queuecallerleave');}}}catch(_0x3ed30d){logger[_0x0af8('0x36')](_0x0af8('0x7b'),_0x27dd27[_0x0af8('0x42')],util[_0x0af8('0x38')](_0x3ed30d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')][_0x0af8('0x1c')]=function(_0x4fd6ce){try{if(this['isNotNull'](_0x4fd6ce)){logger['debug'](_0x0af8('0x81'),_0x4fd6ce['uniqueid'],util[_0x0af8('0x38')](_0x4fd6ce,{'showHidden':![],'depth':null}));if(this[_0x0af8('0x39')][_0x4fd6ce[_0x0af8('0x42')]]){var _0x37b190=_[_0x0af8('0x7c')](this[_0x0af8('0x39')][_0x4fd6ce[_0x0af8('0x42')]]);_0x37b190['queuecallercomplete']=!![];_0x37b190[_0x0af8('0x76')]=_0x0af8('0x82');logger[_0x0af8('0x61')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x37b190[_0x0af8('0x44')],_0x37b190[_0x0af8('0x4c')]);}}}catch(_0x152dd3){logger['error'](_0x0af8('0x81'),_0x4fd6ce['uniqueid'],util[_0x0af8('0x38')](_0x152dd3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')]['syncAgentComplete']=function(_0x566ea7){try{if(this[_0x0af8('0x5a')](_0x566ea7)){logger['debug'](_0x0af8('0x83'),_0x566ea7['uniqueid'],util['inspect'](_0x566ea7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x566ea7[_0x0af8('0x42')]]){var _0x29cf19=_[_0x0af8('0x7c')](this['queueReports'][_0x566ea7[_0x0af8('0x42')]]);_0x29cf19[_0x0af8('0x18')]=![];_0x29cf19[_0x0af8('0x84')]=null;_0x29cf19[_0x0af8('0x85')]=!![];_0x29cf19['lastAssignedTo']=_0x566ea7['membername'];_0x29cf19[_0x0af8('0x86')]=_0x566ea7[_0x0af8('0x86')];_0x29cf19[_0x0af8('0x73')]=!![];_0x29cf19[_0x0af8('0x87')]=![];_0x29cf19[_0x0af8('0x88')]=null;if(!_0x29cf19[_0x0af8('0x89')]){if(_0x566ea7[_0x0af8('0x8a')]==_0x0af8('0x89')){_0x29cf19[_0x0af8('0x76')]=_0x0af8('0x8b');logger[_0x0af8('0x61')](_0x0af8('0x8c'),_0x29cf19[_0x0af8('0x44')],_0x29cf19[_0x0af8('0x4c')]);}else{if(_[_0x0af8('0x8d')](_0x566ea7[_0x0af8('0x33')][_0x0af8('0x8e')](),_0x0af8('0x8f'))){if(this[_0x0af8('0x39')][_0x566ea7[_0x0af8('0x90')]]){var _0x38aff7=_[_0x0af8('0x7c')](this['queueReports'][_0x566ea7[_0x0af8('0x90')]]);_0x38aff7[_0x0af8('0x73')]=![];_0x38aff7[_0x0af8('0x87')]=!![];_0x38aff7[_0x0af8('0x88')]=moment(_0x29cf19['queuecallerjoinAt'])[_0x0af8('0x91')](_0x566ea7[_0x0af8('0x86')],_0x0af8('0x92'))[_0x0af8('0x43')](_0x0af8('0x75'));_0x38aff7['queuecallerexitreason']=_0x0af8('0x93');_0x38aff7['transfer']=!![];_0x38aff7[_0x0af8('0x94')]='FORWARD';_0x38aff7['transferexten']=_0x566ea7[_0x0af8('0x95')];_0x38aff7[_0x0af8('0x96')]=_0x566ea7[_0x0af8('0x42')];logger[_0x0af8('0x61')](_0x0af8('0x97'),_0x38aff7['name'],_0x38aff7['type']);var _0x44a134=this[_0x0af8('0x39')][_0x566ea7[_0x0af8('0x90')]];this['queueReports'][_0x566ea7['linkedid']]=this[_0x0af8('0x39')][_0x566ea7[_0x0af8('0x42')]];this[_0x0af8('0x39')][_0x566ea7['uniqueid']]=_0x44a134;}}else{_0x29cf19[_0x0af8('0x76')]=_0x0af8('0x98')+_0x566ea7[_0x0af8('0x8a')][_0x0af8('0x99')]();logger[_0x0af8('0x61')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x29cf19['name'],_0x29cf19['type'],_0x29cf19[_0x0af8('0x76')]);}}}this[_0x0af8('0xd')][_0x566ea7[_0x0af8('0x42')]]=_0x29cf19;this[_0x0af8('0x46')](_0x29cf19,_0x0af8('0x9a'));}}}catch(_0x3eb213){logger[_0x0af8('0x36')](_0x0af8('0x83'),_0x566ea7['uniqueid'],util[_0x0af8('0x38')](_0x3eb213,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0af8('0x9b')]=function(_0x40ea9e){try{if(this['isNotNull'](_0x40ea9e)){logger['debug'](_0x0af8('0x9c'),_0x40ea9e['uniqueid'],util[_0x0af8('0x38')](_0x40ea9e,{'showHidden':![],'depth':null}));this[_0x0af8('0x9d')](_0x40ea9e['uniqueid'],_['keys'](_0x40ea9e[_0x0af8('0x9e')])[0x0],_0x40ea9e[_0x0af8('0x9f')]);if(this[_0x0af8('0x39')][_0x40ea9e[_0x0af8('0x42')]]){var _0x33ebab=_[_0x0af8('0x7c')](this[_0x0af8('0x39')][_0x40ea9e[_0x0af8('0x42')]]);if(_0x33ebab){if(this[_0x0af8('0x5a')](_0x40ea9e[_0x0af8('0x9e')])&&this[_0x0af8('0x5a')](_0x40ea9e[_0x0af8('0x9e')][_0x0af8('0xa0')])){switch(_0x40ea9e[_0x0af8('0x9f')]){case _0x0af8('0xa1'):_0x33ebab['queuecallerexit']=![];_0x33ebab['queuecallerexitAt']=null;break;case'TIMEOUT':_0x33ebab[_0x0af8('0xa2')]='timeout';_0x33ebab[_0x0af8('0x87')]=!![];_0x33ebab['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33ebab[_0x0af8('0x7d')]=moment()[_0x0af8('0x43')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x0af8('0x47')](_0x0af8('0xa3'),_0x40ea9e[_0x0af8('0x42')],util[_0x0af8('0x38')](_0x33ebab,{'showHidden':![],'depth':null}));ami[_0x0af8('0x3f')]('custom:timeout',_0x33ebab);break;default:_0x33ebab['queuecallerexit']=!![];_0x33ebab[_0x0af8('0x88')]=moment()['format'](_0x0af8('0x75'));_0x33ebab[_0x0af8('0x7d')]=moment()['format'](_0x0af8('0x75'));}_0x33ebab[_0x0af8('0x18')]=![];_0x33ebab[_0x0af8('0x84')]=null;_0x33ebab[_0x0af8('0x76')]=_0x40ea9e[_0x0af8('0x9f')];this['channels'][_0x40ea9e[_0x0af8('0x42')]]=_0x33ebab;this[_0x0af8('0x46')](_0x33ebab,_0x0af8('0x1d'));}else if(this['isNotNull'](_0x40ea9e[_0x0af8('0x9e')])&&this[_0x0af8('0x5a')](_0x40ea9e[_0x0af8('0x9e')]['queueposition'])){if(!_0x33ebab[_0x0af8('0x18')]){_0x33ebab[_0x0af8('0x87')]=!![];_0x33ebab[_0x0af8('0x88')]=moment()['format'](_0x0af8('0x75'));_0x33ebab[_0x0af8('0x76')]=_0x0af8('0xa4');_0x33ebab[_0x0af8('0x7d')]=moment()[_0x0af8('0x43')](_0x0af8('0x75'));this[_0x0af8('0xd')][_0x40ea9e['uniqueid']]=_0x33ebab;}}logger[_0x0af8('0x61')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x40ea9e[_0x0af8('0x42')],_0x33ebab[_0x0af8('0x44')],_0x33ebab[_0x0af8('0x4c')],_[_0x0af8('0x72')](_0x40ea9e[_0x0af8('0x9e')])[0x0],_0x40ea9e['value']);_0x33ebab['variables']=this[_0x0af8('0x12')][_0x40ea9e[_0x0af8('0x42')]];}}}}catch(_0x13f3b3){logger[_0x0af8('0x36')](_0x0af8('0x9c'),_0x40ea9e[_0x0af8('0x42')],util['inspect'](_0x13f3b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0af8('0x2e')][_0x0af8('0x9d')]=function(_0x4ace41,_0x1fc46b,_0xb2c61d){var _0x47fd63=[_0x0af8('0xa5'),_0x0af8('0xa6'),_0x0af8('0xa7'),_0x0af8('0xa8'),_0x0af8('0xa9'),_0x0af8('0xaa'),'rtpaudioqosrtt',_0x0af8('0xab'),_0x0af8('0xac'),_0x0af8('0xad'),_0x0af8('0xae'),_0x0af8('0xaf'),_0x0af8('0xb0'),'memberdynamic',_0x0af8('0xb1'),_0x0af8('0xb2'),_0x0af8('0xb3'),_0x0af8('0xb4'),_0x0af8('0xb5')];if(!_['isNil'](_0x1fc46b)&&!_[_0x0af8('0xb6')](_0x47fd63,_0x1fc46b)){if(_[_0x0af8('0x6b')](this[_0x0af8('0x12')][_0x4ace41])){this[_0x0af8('0x12')][_0x4ace41]={};}this[_0x0af8('0x12')][_0x4ace41][_0x1fc46b]=_0xb2c61d;}};VoiceQueueReport['prototype'][_0x0af8('0x1e')]=function(_0x50a50e){try{if(this[_0x0af8('0x5a')](_0x50a50e)){logger['debug'](_0x0af8('0xb7'),_0x50a50e[_0x0af8('0x42')],util[_0x0af8('0x38')](_0x50a50e,{'showHidden':![],'depth':null}));if(this[_0x0af8('0x39')][_0x50a50e[_0x0af8('0x42')]]){for(var _0xb4adf3=0x0,_0x1e35c2={};_0xb4adf3=0x0?moment(_0x3df571['endtime'])[_0xd91a('0x15')](_0x3df571[_0xd91a('0x14')],_0xd91a('0x16')):null,'data1':_0xd91a('0x17'),'data2':_0x3df571[_0xd91a('0xf')],'data3':_0x3df571['exten'],'data4':_0x3df571['dialstring']||null,'role':_0xd91a('0xe'),'internal':_0x3df571[_0xd91a('0xf')]?_[_0xd91a('0x10')](_0x3df571['accountcode']):undefined,'uniqueid':_0x3df571[_0xd91a('0x18')]},'log':_0xd91a('0x5')});}; \ No newline at end of file +var _0xd566=['lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','outbound','dialstring','uniqueid'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd566,0xd2));var _0x6d56=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd566[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var _=require(_0x6d56('0x0'));var util=require(_0x6d56('0x1'));var client=require(_0x6d56('0x2'));exports[_0x6d56('0x3')]=function(_0x337519){var _0x6a7ae2=_0x337519[_0x6d56('0x4')]||_0x337519[_0x6d56('0x5')];return client[_0x6d56('0x6')](_0x6d56('0x7'),{'body':{'channel':_0x6d56('0x8'),'membername':_0x337519[_0x6d56('0x9')],'interface':_['isNil'](_0x337519[_0x6d56('0xa')])?util[_0x6d56('0xb')](_0x6d56('0xc'),_0x337519[_0x6d56('0x9')]):_0x337519[_0x6d56('0xa')],'type':_0x6d56('0xd'),'enterAt':_0x337519[_0x6d56('0xe')],'exitAt':_0x6a7ae2,'duration':moment(_0x6a7ae2)[_0x6d56('0xf')](_0x337519[_0x6d56('0xe')],_0x6d56('0x10')),'data1':_0x6d56('0x11'),'data2':_0x337519['calleridnum'],'data3':_0x337519[_0x6d56('0x12')],'data4':null,'data5':_0x337519[_0x6d56('0x13')],'role':_0x6d56('0x14'),'internal':_0x337519[_0x6d56('0x15')]?_[_0x6d56('0x16')](_0x337519[_0x6d56('0x15')]):undefined,'uniqueid':_0x337519['uniqueid']},'log':_0x6d56('0x7')});};exports[_0x6d56('0x17')]=function(_0x42638f){return client[_0x6d56('0x6')]('CreateMemberReport',{'body':{'channel':_0x6d56('0x8'),'membername':_0x42638f[_0x6d56('0x18')],'interface':_0x42638f[_0x6d56('0xa')],'type':_0x6d56('0xd'),'enterAt':_0x42638f[_0x6d56('0x19')],'exitAt':_0x42638f[_0x6d56('0x1a')],'duration':moment(_0x42638f[_0x6d56('0x1a')])[_0x6d56('0xf')](_0x42638f[_0x6d56('0x19')],'seconds')>=0x0?moment(_0x42638f[_0x6d56('0x1a')])[_0x6d56('0xf')](_0x42638f[_0x6d56('0x19')],'seconds'):null,'data1':_0x6d56('0x1b'),'data2':_0x42638f['accountcode'],'data3':_0x42638f[_0x6d56('0x12')],'data4':_0x42638f[_0x6d56('0x1c')]||null,'role':_0x6d56('0x14'),'internal':_0x42638f[_0x6d56('0x15')]?_[_0x6d56('0x16')](_0x42638f['accountcode']):undefined,'uniqueid':_0x42638f[_0x6d56('0x1d')]},'log':_0x6d56('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2fddb1d..5181239 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3140=['getSettings','Request','ShowSetting','../client'];(function(_0x1bc97d,_0x40dbab){var _0x1dceaa=function(_0x4d7ad9){while(--_0x4d7ad9){_0x1bc97d['push'](_0x1bc97d['shift']());}};_0x1dceaa(++_0x40dbab);}(_0x3140,0xaf));var _0x0314=function(_0x1b2e6b,_0x2f97fb){_0x1b2e6b=_0x1b2e6b-0x0;var _0x1dd2aa=_0x3140[_0x1b2e6b];return _0x1dd2aa;};'use strict';var client=require(_0x0314('0x0'));exports[_0x0314('0x1')]=function(){return client[_0x0314('0x2')](_0x0314('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});}; \ No newline at end of file +var _0xd3d1=['stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0xd3d1,0x172));var _0x1d3d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd3d1[_0x5f0089];return _0x193892;};'use strict';var client=require(_0x1d3d('0x0'));exports[_0x1d3d('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1d3d('0x2')]},'log':_0x1d3d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d2c9b66..3568bbf 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 _0xbaf0=['GetTemplate','name','getTemplates','Request'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x0baf('0x0')]=function(_0x2a3620){return function(_0x1e212d){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0baf('0x3'),'html']},'log':_0x0baf('0x2')});};}; \ No newline at end of file +var _0x7af2=['GetTemplate','getTemplates','Request','name','html'];(function(_0x38b744,_0x218c46){var _0x3028d4=function(_0x51a542){while(--_0x51a542){_0x38b744['push'](_0x38b744['shift']());}};_0x3028d4(++_0x218c46);}(_0x7af2,0x119));var _0x27af=function(_0x4f30bd,_0xf47f9b){_0x4f30bd=_0x4f30bd-0x0;var _0x457faa=_0x7af2[_0x4f30bd];return _0x457faa;};'use strict';var client=require('../client');exports[_0x27af('0x0')]=function(_0x106ea4){return function(_0x908794){return client[_0x27af('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x27af('0x2'),_0x27af('0x3')]},'log':_0x27af('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 84c6f45..2839ff9 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 _0x35db=['operator','value','AnyConditions','Actions','action','data1','data3','data5','../client','getTriggers','Request','GetTrigger','channel','Condition','AllConditions','field'];(function(_0x2901a7,_0xb40545){var _0x11a12b=function(_0x2ca01e){while(--_0x2ca01e){_0x2901a7['push'](_0x2901a7['shift']());}};_0x11a12b(++_0xb40545);}(_0x35db,0x168));var _0xb35d=function(_0x25bef7,_0x37fec0){_0x25bef7=_0x25bef7-0x0;var _0x2ddfa4=_0x35db[_0x25bef7];return _0x2ddfa4;};'use strict';var client=require(_0xb35d('0x0'));exports[_0xb35d('0x1')]=function(_0x39a7c8){return function(_0x524a15){return client[_0xb35d('0x2')](_0xb35d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb35d('0x4'),'status'],'include':[{'model':_0xb35d('0x5'),'as':_0xb35d('0x6'),'attributes':['id',_0xb35d('0x7'),_0xb35d('0x8'),_0xb35d('0x9')]},{'model':'Condition','as':_0xb35d('0xa'),'attributes':['id',_0xb35d('0x7'),_0xb35d('0x8'),'value']},{'model':'Action','as':_0xb35d('0xb'),'attributes':['id',_0xb35d('0xc'),_0xb35d('0xd'),'data2',_0xb35d('0xe'),'data4',_0xb35d('0xf'),'data6','data7']}]},'log':_0xb35d('0x3')});};}; \ No newline at end of file +var _0x1189=['field','Action','Actions','action','data1','data3','data5','data6','getTriggers','Request','GetTrigger','status','Condition','AllConditions','operator','value','AnyConditions'];(function(_0x4b52c5,_0x4331df){var _0x3287a2=function(_0x40c76b){while(--_0x40c76b){_0x4b52c5['push'](_0x4b52c5['shift']());}};_0x3287a2(++_0x4331df);}(_0x1189,0x129));var _0x9118=function(_0x35d823,_0x212793){_0x35d823=_0x35d823-0x0;var _0x518ac5=_0x1189[_0x35d823];return _0x518ac5;};'use strict';var client=require('../client');exports[_0x9118('0x0')]=function(_0x466b29){return function(_0x2747c2){return client[_0x9118('0x1')](_0x9118('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x9118('0x3')],'include':[{'model':_0x9118('0x4'),'as':_0x9118('0x5'),'attributes':['id','field',_0x9118('0x6'),_0x9118('0x7')]},{'model':_0x9118('0x4'),'as':_0x9118('0x8'),'attributes':['id',_0x9118('0x9'),_0x9118('0x6'),_0x9118('0x7')]},{'model':_0x9118('0xa'),'as':_0x9118('0xb'),'attributes':['id',_0x9118('0xc'),_0x9118('0xd'),'data2',_0x9118('0xe'),'data4',_0x9118('0xf'),_0x9118('0x10'),'data7']}]},'log':_0x9118('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 352cea2..4a9fda9 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 _0x5e57=['../client','getTrunks','GetTrunk','name','registry'];(function(_0x12d77c,_0x1bbe39){var _0x748bdf=function(_0x581098){while(--_0x581098){_0x12d77c['push'](_0x12d77c['shift']());}};_0x748bdf(++_0x1bbe39);}(_0x5e57,0xaa));var _0x75e5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5e57[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x75e5('0x0'));exports[_0x75e5('0x1')]=function(_0x4f983e){return function(_0x43c01b){return client['Request'](_0x75e5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x75e5('0x3'),_0x75e5('0x4')]},'log':_0x75e5('0x2')});};}; \ No newline at end of file +var _0x7d4d=['name','registry','../client','getTrunks','Request'];(function(_0x151e04,_0x1d9110){var _0x12da30=function(_0x43168c){while(--_0x43168c){_0x151e04['push'](_0x151e04['shift']());}};_0x12da30(++_0x1d9110);}(_0x7d4d,0x160));var _0xd7d4=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x7d4d[_0x4206f5];return _0xa29cf3;};'use strict';var client=require(_0xd7d4('0x0'));exports[_0xd7d4('0x1')]=function(_0x2ddf16){return function(_0x307eda){return client[_0xd7d4('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd7d4('0x3'),_0xd7d4('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 c42ecc2..74d52bf 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 _0x72d9=['saveUnpause','getAgent','ShowUser','fullname','online','lastLoginAt','voicePause','getAgents','agent','name','email','pauseType','lastPauseAt','phone','mobile','interface','getTelephones','Request','GetUser','telephone','accountcode','internal','savePause','PauseUser'];(function(_0x32da12,_0xeaf019){var _0x54b1ee=function(_0x14f020){while(--_0x14f020){_0x32da12['push'](_0x32da12['shift']());}};_0x54b1ee(++_0xeaf019);}(_0x72d9,0x157));var _0x972d=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x72d9[_0x2e0443];return _0x52d450;};'use strict';var client=require('../client');exports[_0x972d('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x972d('0x1')},'attributes':['id',_0x972d('0x2'),_0x972d('0x3'),'accountcode','fullname','online','lastLoginAt',_0x972d('0x4'),_0x972d('0x5'),'voicePause',_0x972d('0x6'),_0x972d('0x7'),_0x972d('0x8')]},'log':_0x972d('0x0')});};};exports[_0x972d('0x9')]=function(){return function(){return client[_0x972d('0xa')](_0x972d('0xb'),{'options':{'raw':!![],'where':{'role':_0x972d('0xc')},'attributes':['id',_0x972d('0x2'),_0x972d('0xd'),_0x972d('0xe')]},'log':_0x972d('0x9')});};};exports[_0x972d('0xf')]=function(_0x20ff80,_0x4c0153,_0x5d75ff){return client[_0x972d('0xa')](_0x972d('0x10'),{'body':{'type':_0x4c0153,'uniqueid':_0x5d75ff},'options':{'where':{'id':_0x20ff80['id']}},'log':_0x972d('0xf')});};exports[_0x972d('0x11')]=function(_0x3681eb){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x3681eb['id']}},'log':'savePause'});};exports[_0x972d('0x12')]=function(_0x55daa5){return client['Request'](_0x972d('0x13'),{'options':{'raw':![],'where':{'role':_0x972d('0x1'),'id':_0x55daa5},'attributes':['id',_0x972d('0x2'),_0x972d('0x3'),_0x972d('0xd'),_0x972d('0x14'),_0x972d('0x15'),_0x972d('0x16'),_0x972d('0x4'),'lastPauseAt',_0x972d('0x17'),_0x972d('0x8')]},'log':_0x972d('0x12')});}; \ No newline at end of file +var _0x4ffe=['getAgent','../client','GetUser','agent','name','accountcode','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','Request','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','email'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x4ffe,0xfb));var _0xe4ff=function(_0x5a9666,_0x30bc94){_0x5a9666=_0x5a9666-0x0;var _0x28601f=_0x4ffe[_0x5a9666];return _0x28601f;};'use strict';var client=require(_0xe4ff('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0xe4ff('0x1'),{'options':{'raw':![],'where':{'role':_0xe4ff('0x2')},'attributes':['id',_0xe4ff('0x3'),'email',_0xe4ff('0x4'),'fullname',_0xe4ff('0x5'),_0xe4ff('0x6'),_0xe4ff('0x7'),_0xe4ff('0x8'),_0xe4ff('0x9'),_0xe4ff('0xa'),_0xe4ff('0xb'),_0xe4ff('0xc')]},'log':_0xe4ff('0xd')});};};exports[_0xe4ff('0xe')]=function(){return function(){return client[_0xe4ff('0xf')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xe4ff('0x10')},'attributes':['id','name',_0xe4ff('0x4'),_0xe4ff('0x11')]},'log':_0xe4ff('0xe')});};};exports[_0xe4ff('0x12')]=function(_0x2283cc,_0x375f7c,_0x1ea0c6){return client[_0xe4ff('0xf')](_0xe4ff('0x13'),{'body':{'type':_0x375f7c,'uniqueid':_0x1ea0c6},'options':{'where':{'id':_0x2283cc['id']}},'log':_0xe4ff('0x12')});};exports[_0xe4ff('0x14')]=function(_0x46ec4f){return client[_0xe4ff('0xf')](_0xe4ff('0x15'),{'body':{},'options':{'where':{'id':_0x46ec4f['id']}},'log':_0xe4ff('0x12')});};exports['getAgent']=function(_0x50bb2a){return client[_0xe4ff('0xf')](_0xe4ff('0x16'),{'options':{'raw':![],'where':{'role':_0xe4ff('0x2'),'id':_0x50bb2a},'attributes':['id',_0xe4ff('0x3'),_0xe4ff('0x17'),_0xe4ff('0x4'),'fullname','online',_0xe4ff('0x6'),_0xe4ff('0x7'),_0xe4ff('0x8'),_0xe4ff('0x9'),'interface']},'log':_0xe4ff('0x18')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 85f023e..55550fe 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 _0x4286=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x17bc02,_0x580031){var _0x684435=function(_0x4d9637){while(--_0x4d9637){_0x17bc02['push'](_0x17bc02['shift']());}};_0x684435(++_0x580031);}(_0x4286,0xbd));var _0x6428=function(_0x42cfb2,_0x4913b1){_0x42cfb2=_0x42cfb2-0x0;var _0x1a9086=_0x4286[_0x42cfb2];return _0x1a9086;};'use strict';var client=require(_0x6428('0x0'));exports[_0x6428('0x1')]=function(_0x2e65fe){return client[_0x6428('0x2')](_0x6428('0x3'),{'body':_0x2e65fe,'log':_0x6428('0x3')});};exports[_0x6428('0x4')]=function(_0x551b7f,_0x20d1f6,_0x33c197){return client[_0x6428('0x2')](_0x6428('0x5'),{'body':_0x551b7f,'options':{'where':{'uniqueid':_0x20d1f6,'interface':_0x33c197,'agentcomplete':!![]}},'log':_0x6428('0x5')});}; \ No newline at end of file +var _0xb922=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x3ba91b,_0xd7f23a){var _0x34ab56=function(_0x2f88c1){while(--_0x2f88c1){_0x3ba91b['push'](_0x3ba91b['shift']());}};_0x34ab56(++_0xd7f23a);}(_0xb922,0x12d));var _0x2b92=function(_0x4ab866,_0x40e607){_0x4ab866=_0x4ab866-0x0;var _0x56047a=_0xb922[_0x4ab866];return _0x56047a;};'use strict';var client=require(_0x2b92('0x0'));exports[_0x2b92('0x1')]=function(_0x10f934){return client['Request']('CreateVoiceAgentReport',{'body':_0x10f934,'log':_0x2b92('0x2')});};exports[_0x2b92('0x3')]=function(_0x1485db,_0x487bbc,_0x33b98d){return client[_0x2b92('0x4')](_0x2b92('0x5'),{'body':_0x1485db,'options':{'where':{'uniqueid':_0x487bbc,'interface':_0x33b98d,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 75357f1..a5d6400 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 _0xfe59=['disposition','duration','GetVoiceCallReports','util','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x337643,_0x550643){var _0x3f4453=function(_0xb3d929){while(--_0xb3d929){_0x337643['push'](_0x337643['shift']());}};_0x3f4453(++_0x550643);}(_0xfe59,0x157));var _0x9fe5=function(_0x3a0c10,_0x10b1c1){_0x3a0c10=_0x3a0c10-0x0;var _0x24469f=_0xfe59[_0x3a0c10];return _0x24469f;};'use strict';var moment=require('moment');var util=require(_0x9fe5('0x0'));var _=require('lodash');var client=require('../client');exports[_0x9fe5('0x1')]=function(_0xfd8d46){return client[_0x9fe5('0x2')]('CreateVoiceCallReport',{'body':_[_0x9fe5('0x3')](_0xfd8d46,{'source':_0xfd8d46[_0x9fe5('0x4')],'destinationcontext':_0xfd8d46[_0x9fe5('0x5')],'callerid':_0xfd8d46[_0x9fe5('0x6')],'amaflags':_0x9fe5('0x7')}),'log':_0x9fe5('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9fe5('0x2')](_0x9fe5('0x9'),{'options':{'where':{'type':[_0x9fe5('0xa')],'createdAt':{'$between':[moment()[_0x9fe5('0xb')](_0x9fe5('0xc'))[_0x9fe5('0xd')](_0x9fe5('0xe')),moment()[_0x9fe5('0xf')](_0x9fe5('0xc'))[_0x9fe5('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9fe5('0x10'),_0x9fe5('0x11'),_0x9fe5('0x12'),'billableseconds']},'log':_0x9fe5('0x13')});};}; \ No newline at end of file +var _0x5b69=['Request','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5b69,0xb0));var _0x95b6=function(_0x4d5721,_0x51a33d){_0x4d5721=_0x4d5721-0x0;var _0x88a224=_0x5b69[_0x4d5721];return _0x88a224;};'use strict';var moment=require(_0x95b6('0x0'));var util=require(_0x95b6('0x1'));var _=require(_0x95b6('0x2'));var client=require(_0x95b6('0x3'));exports['create']=function(_0x57ec73){return client[_0x95b6('0x4')]('CreateVoiceCallReport',{'body':_[_0x95b6('0x5')](_0x57ec73,{'source':_0x57ec73[_0x95b6('0x6')],'destinationcontext':_0x57ec73[_0x95b6('0x7')],'callerid':_0x57ec73['callerid'],'amaflags':_0x95b6('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x95b6('0x9')]=function(){return function(){return client['Request'](_0x95b6('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x95b6('0xb')](_0x95b6('0xc'))[_0x95b6('0xd')](_0x95b6('0xe')),moment()[_0x95b6('0xf')](_0x95b6('0xc'))[_0x95b6('0xd')](_0x95b6('0xe'))]}},'attributes':['type',_0x95b6('0x10'),_0x95b6('0x11'),_0x95b6('0x12')]},'log':_0x95b6('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 955a191..5510694 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 _0x7857=['CreateVoiceDialReport','../client','create','Request'];(function(_0x519ee1,_0x3aab5c){var _0x101c5a=function(_0x2ca5ee){while(--_0x2ca5ee){_0x519ee1['push'](_0x519ee1['shift']());}};_0x101c5a(++_0x3aab5c);}(_0x7857,0x125));var _0x7785=function(_0x3f38fd,_0x22cdd6){_0x3f38fd=_0x3f38fd-0x0;var _0x1cc616=_0x7857[_0x3f38fd];return _0x1cc616;};'use strict';var client=require(_0x7785('0x0'));exports[_0x7785('0x1')]=function(_0xd4616d){return client[_0x7785('0x2')](_0x7785('0x3'),{'body':_0xd4616d,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x32dc=['Request','CreateVoiceDialReport','../client'];(function(_0x5445f2,_0x495dd5){var _0xb61ded=function(_0x56df3d){while(--_0x56df3d){_0x5445f2['push'](_0x5445f2['shift']());}};_0xb61ded(++_0x495dd5);}(_0x32dc,0x131));var _0xc32d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x32dc[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0xc32d('0x0'));exports['create']=function(_0x594704){return client[_0xc32d('0x1')](_0xc32d('0x2'),{'body':_0x594704,'log':_0xc32d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7171cd5..aac143a 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 _0xcbcd=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xcbcd[_0x8af54b];return _0x27d8f0;};'use strict';var client=require('../client');exports[_0xdcbc('0x0')]=function(){return function(){return client[_0xdcbc('0x1')](_0xdcbc('0x2'),{'options':{'raw':!![],'attributes':['id',_0xdcbc('0x3'),_0xdcbc('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xdcbc('0x0')});};}; \ No newline at end of file +var _0xfbac=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x1797f5,_0x5958f9){var _0x13e63a=function(_0x3b3807){while(--_0x3b3807){_0x1797f5['push'](_0x1797f5['shift']());}};_0x13e63a(++_0x5958f9);}(_0xfbac,0x167));var _0xcfba=function(_0x2bbd98,_0x2082ce){_0x2bbd98=_0x2bbd98-0x0;var _0x451053=_0xfbac[_0x2bbd98];return _0x451053;};'use strict';var client=require('../client');exports[_0xcfba('0x0')]=function(){return function(){return client[_0xcfba('0x1')](_0xcfba('0x2'),{'options':{'raw':!![],'attributes':['id',_0xcfba('0x3'),_0xcfba('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xcfba('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7b49a86..14a5cd8 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 _0x8d56=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x238fae,_0x5608f7){var _0x5f3211=function(_0x232291){while(--_0x232291){_0x238fae['push'](_0x238fae['shift']());}};_0x5f3211(++_0x5608f7);}(_0x8d56,0x1f1));var _0x68d5=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x8d56[_0x2aee2f];return _0x19337f;};'use strict';var client=require('../client');exports[_0x68d5('0x0')]=function(){return function(){return client[_0x68d5('0x1')](_0x68d5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x68d5('0x3'),_0x68d5('0x4'),'autopause',_0x68d5('0x5'),_0x68d5('0x6'),_0x68d5('0x7'),_0x68d5('0x8'),_0x68d5('0x9'),_0x68d5('0xa'),_0x68d5('0xb'),_0x68d5('0xc'),_0x68d5('0xd'),_0x68d5('0xe'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x68d5('0xf'),_0x68d5('0x10'),_0x68d5('0x11'),'dialQueueProject',_0x68d5('0x12'),'dialCongestionRetryFrequency',_0x68d5('0x13'),_0x68d5('0x14'),_0x68d5('0x15'),_0x68d5('0x16'),_0x68d5('0x17'),_0x68d5('0x18'),_0x68d5('0x19'),_0x68d5('0x1a'),_0x68d5('0x1b'),_0x68d5('0x1c'),_0x68d5('0x1d'),_0x68d5('0x1e'),_0x68d5('0x1f'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x68d5('0x20'),_0x68d5('0x21'),_0x68d5('0x22'),'dialAMDMaximumWordLength',_0x68d5('0x23'),_0x68d5('0x24'),_0x68d5('0x25'),_0x68d5('0x26'),'dialAgiAfterHangupAgent',_0x68d5('0x27'),_0x68d5('0x28'),_0x68d5('0x5'),_0x68d5('0x29'),_0x68d5('0x2a'),_0x68d5('0x2b'),_0x68d5('0x2c'),_0x68d5('0x2d'),_0x68d5('0x2e'),_0x68d5('0x2f'),_0x68d5('0x30'),_0x68d5('0x31'),_0x68d5('0x32'),_0x68d5('0x33'),_0x68d5('0x34'),'dialAgentRejectRetryFrequency',_0x68d5('0x35'),_0x68d5('0x36'),_0x68d5('0x37')],'include':[{'model':_0x68d5('0x38'),'as':'Trunk','attributes':['id',_0x68d5('0x39'),'callerid','active']},{'model':'Pause','as':_0x68d5('0x3a'),'attributes':['id',_0x68d5('0x39')]},{'model':_0x68d5('0x38'),'as':_0x68d5('0x3b'),'attributes':['id',_0x68d5('0x39'),_0x68d5('0x3c'),_0x68d5('0x3d')]},{'model':_0x68d5('0x3e'),'as':_0x68d5('0x3e'),'attributes':['id',_0x68d5('0x39')],'include':[{'model':_0x68d5('0x3e'),'as':_0x68d5('0x3f'),'attributes':['id','name','interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x416a=['TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x416a,0x7b));var _0xa416=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x416a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa416('0x0'));exports[_0xa416('0x1')]=function(){return function(){return client[_0xa416('0x2')](_0xa416('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xa416('0x4'),'acwTimeout',_0xa416('0x5'),'monitor_format',_0xa416('0x6'),_0xa416('0x7'),'dialMethod',_0xa416('0x8'),'dialLimitQueue',_0xa416('0x9'),_0xa416('0xa'),_0xa416('0xb'),_0xa416('0xc'),_0xa416('0xd'),_0xa416('0xe'),_0xa416('0xf'),_0xa416('0x10'),'dialQueueTimeout',_0xa416('0x11'),_0xa416('0x12'),'dialCongestionRetryFrequency',_0xa416('0x13'),_0xa416('0x14'),_0xa416('0x15'),_0xa416('0x16'),_0xa416('0x17'),_0xa416('0x18'),'dialGlobalInterval','dialPrefix',_0xa416('0x19'),_0xa416('0x1a'),_0xa416('0x1b'),'dialAMDGreeting',_0xa416('0x1c'),_0xa416('0x1d'),'dialAMDMinWordLength',_0xa416('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xa416('0x1f'),_0xa416('0x20'),_0xa416('0x21'),_0xa416('0x22'),_0xa416('0x23'),_0xa416('0x24'),'dialAgiAfterHangupClient',_0xa416('0x25'),_0xa416('0x26'),_0xa416('0x27'),_0xa416('0x28'),_0xa416('0x29'),_0xa416('0x2a'),_0xa416('0x2b'),_0xa416('0x2c'),_0xa416('0x2d'),_0xa416('0x2e'),'dialAbandonedRetryFrequency',_0xa416('0x2f'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xa416('0x30'),_0xa416('0x31'),'dialPredictiveIntervalMaxThreshold',_0xa416('0x32')],'include':[{'model':_0xa416('0x33'),'as':_0xa416('0x33'),'attributes':['id',_0xa416('0x34'),_0xa416('0x35'),_0xa416('0x36')]},{'model':_0xa416('0x37'),'as':_0xa416('0x38'),'attributes':['id',_0xa416('0x34')]},{'model':'Trunk','as':_0xa416('0x39'),'attributes':['id',_0xa416('0x34'),_0xa416('0x35'),'active']},{'model':_0xa416('0x3a'),'as':_0xa416('0x3a'),'attributes':['id',_0xa416('0x34')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa416('0x34'),_0xa416('0x3b')]}]}]},'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 900dd6a..da9accf 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 _0xebb4=['GetVoiceQueueReports','moment','lodash','Request','CreateVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xebb4,0xbc));var _0x4ebb=function(_0x384d47,_0x35f8f7){_0x384d47=_0x384d47-0x0;var _0x56b08a=_0xebb4[_0x384d47];return _0x56b08a;};'use strict';var moment=require(_0x4ebb('0x0'));var _=require(_0x4ebb('0x1'));var client=require('../client');exports['create']=function(_0x26291c){return client[_0x4ebb('0x2')](_0x4ebb('0x3'),{'body':_0x26291c,'log':_0x4ebb('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x4ebb('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x4ebb('0x4')](_0x4ebb('0x5'))[_0x4ebb('0x6')](_0x4ebb('0x7')),moment()[_0x4ebb('0x8')](_0x4ebb('0x5'))['format'](_0x4ebb('0x7'))]}},'attributes':[_0x4ebb('0x9'),_0x4ebb('0xa'),_0x4ebb('0xb'),'queuecallerleaveAt','queuecallercomplete',_0x4ebb('0xc'),_0x4ebb('0xd'),_0x4ebb('0xe'),_0x4ebb('0xf'),'queuecallerabandonAt']},'log':_0x4ebb('0x10')});};}; \ No newline at end of file +var _0x3dab=['endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x3dab,0x1d7));var _0xb3da=function(_0x3fb2e3,_0x23b415){_0x3fb2e3=_0x3fb2e3-0x0;var _0x459d02=_0x3dab[_0x3fb2e3];return _0x459d02;};'use strict';var moment=require(_0xb3da('0x0'));var _=require('lodash');var client=require(_0xb3da('0x1'));exports[_0xb3da('0x2')]=function(_0x529130){return client[_0xb3da('0x3')](_0xb3da('0x4'),{'body':_0x529130,'log':'CreateVoiceQueueReport'});};exports[_0xb3da('0x5')]=function(){return function(){return client[_0xb3da('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xb3da('0x6')](_0xb3da('0x7'))[_0xb3da('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb3da('0x9')](_0xb3da('0x7'))['format'](_0xb3da('0xa'))]}},'attributes':[_0xb3da('0xb'),_0xb3da('0xc'),_0xb3da('0xd'),_0xb3da('0xe'),'queuecallercomplete',_0xb3da('0xf'),_0xb3da('0x10'),_0xb3da('0x11'),_0xb3da('0x12'),_0xb3da('0x13')]},'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 fc736c7..651341e 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 _0x15bf=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x236133,_0x40adb9){var _0xe457b9=function(_0x749949){while(--_0x749949){_0x236133['push'](_0x236133['shift']());}};_0xe457b9(++_0x40adb9);}(_0x15bf,0x7b));var _0xf15b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x15bf[_0x32f7d7];return _0x133d09;};'use strict';var client=require(_0xf15b('0x0'));exports[_0xf15b('0x1')]=function(_0x5aaa60){return function(){return client[_0xf15b('0x2')](_0xf15b('0x3'),{'options':{'where':{'VoiceQueueId':_0x5aaa60,'paused':!![]},'raw':!![]},'log':_0xf15b('0x1')});};}; \ No newline at end of file +var _0x54fb=['Request','getVoiceQueueRtPauses'];(function(_0x13c000,_0x5e0f30){var _0x5f2821=function(_0x2ff149){while(--_0x2ff149){_0x13c000['push'](_0x13c000['shift']());}};_0x5f2821(++_0x5e0f30);}(_0x54fb,0x93));var _0xb54f=function(_0x28402a,_0x3f2c54){_0x28402a=_0x28402a-0x0;var _0x40bc13=_0x54fb[_0x28402a];return _0x40bc13;};'use strict';var client=require('../client');exports[_0xb54f('0x0')]=function(_0x2e6409){return function(){return client[_0xb54f('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2e6409,'paused':!![]},'raw':!![]},'log':_0xb54f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6b2caef..19bdee0 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 _0x4eab=['../client','create','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x2b4387,_0x33af1d){var _0x936f6d=function(_0x46e9af){while(--_0x46e9af){_0x2b4387['push'](_0x2b4387['shift']());}};_0x936f6d(++_0x33af1d);}(_0x4eab,0xd7));var _0xb4ea=function(_0x37b2ac,_0x25c162){_0x37b2ac=_0x37b2ac-0x0;var _0x491e0a=_0x4eab[_0x37b2ac];return _0x491e0a;};'use strict';var _=require(_0xb4ea('0x0'));var client=require(_0xb4ea('0x1'));exports[_0xb4ea('0x2')]=function(_0x59c6f0){return client['Request'](_0xb4ea('0x3'),{'body':_[_0xb4ea('0x4')](_0x59c6f0,{'value':_0x59c6f0[_0xb4ea('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xd54a=['CreateVoiceRecording','monitorFilename','lodash','create','Request'];(function(_0x520d48,_0x171117){var _0x8cbf35=function(_0x2c769b){while(--_0x2c769b){_0x520d48['push'](_0x520d48['shift']());}};_0x8cbf35(++_0x171117);}(_0xd54a,0x89));var _0xad54=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd54a[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xad54('0x0'));var client=require('../client');exports[_0xad54('0x1')]=function(_0x1bdc9e){return client[_0xad54('0x2')](_0xad54('0x3'),{'body':_['merge'](_0x1bdc9e,{'value':_0x1bdc9e[_0xad54('0x4')]}),'log':_0xad54('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7601ab8..1071968 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 _0xf2f6=['transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','blind','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','origtransferercontext','origtransfererexten','attended','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x123434,_0x65ae7c){var _0x38cd7c=function(_0x4274e9){while(--_0x4274e9){_0x123434['push'](_0x123434['shift']());}};_0x38cd7c(++_0x65ae7c);}(_0xf2f6,0x110));var _0x6f2f=function(_0x5efb28,_0x151728){_0x5efb28=_0x5efb28-0x0;var _0x411129=_0xf2f6[_0x5efb28];return _0x411129;};'use strict';var client=require('../client');exports[_0x6f2f('0x0')]={};exports['blindTransfer']=function(_0x16a76d){return client['Request'](_0x6f2f('0x1'),{'body':{'result':_0x16a76d[_0x6f2f('0x2')],'transfererchannel':_0x16a76d[_0x6f2f('0x3')],'transferercalleridnum':_0x16a76d[_0x6f2f('0x4')],'transferercalleridname':_0x16a76d['transferercalleridname'],'transfererconnectedlinenum':_0x16a76d[_0x6f2f('0x5')],'transfererconnectedlinename':_0x16a76d[_0x6f2f('0x6')],'transfereraccountcode':_0x16a76d[_0x6f2f('0x7')],'transferercontext':_0x16a76d['transferercontext'],'transfererexten':_0x16a76d['transfererexten'],'transfererlinkedid':_0x16a76d[_0x6f2f('0x8')],'transfereechannel':_0x16a76d[_0x6f2f('0x9')],'transfereecalleridnum':_0x16a76d[_0x6f2f('0xa')],'transfereecalleridname':_0x16a76d[_0x6f2f('0xb')],'transfereeconnectedlinenum':_0x16a76d['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x16a76d[_0x6f2f('0xc')],'transfereeaccountcode':_0x16a76d[_0x6f2f('0xd')],'transfereecontext':_0x16a76d[_0x6f2f('0xe')],'transfereeexten':_0x16a76d[_0x6f2f('0xf')],'transfereelinkedid':_0x16a76d['transfereelinkedid'],'isexternal':_0x16a76d[_0x6f2f('0x10')],'context':_0x16a76d[_0x6f2f('0x11')],'extension':_0x16a76d['extension'],'type':_0x6f2f('0x12')},'log':_0x6f2f('0x1')});};exports['attendedTransfer']=function(_0x1a2331){return client[_0x6f2f('0x13')](_0x6f2f('0x1'),{'body':{'result':_0x1a2331['result'],'transfererchannel':_0x1a2331[_0x6f2f('0x14')],'transferercalleridnum':_0x1a2331['origtransferercalleridnum'],'transferercalleridname':_0x1a2331[_0x6f2f('0x15')],'transfererconnectedlinenum':_0x1a2331['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1a2331[_0x6f2f('0x16')],'transfereraccountcode':_0x1a2331[_0x6f2f('0x17')],'transferercontext':_0x1a2331[_0x6f2f('0x18')],'transfererexten':_0x1a2331['secondtransfererexten'],'transfererlinkedid':_0x1a2331[_0x6f2f('0x19')],'transfereechannel':_0x1a2331[_0x6f2f('0x1a')],'transfereecalleridnum':_0x1a2331[_0x6f2f('0x1b')],'transfereecalleridname':_0x1a2331[_0x6f2f('0x1c')],'transfereeconnectedlinenum':_0x1a2331[_0x6f2f('0x1d')],'transfereeconnectedlinename':_0x1a2331[_0x6f2f('0x1e')],'transfereeaccountcode':_0x1a2331[_0x6f2f('0x1f')],'transfereecontext':_0x1a2331['transfertargetcontext'],'transfereeexten':_0x1a2331['transfertargetexten'],'transfereelinkedid':_0x1a2331['transfertargetlinkedid'],'isexternal':_0x1a2331[_0x6f2f('0x10')],'context':_0x1a2331[_0x6f2f('0x20')],'extension':_0x1a2331[_0x6f2f('0x21')],'type':_0x6f2f('0x22')},'log':_0x6f2f('0x1')});}; \ No newline at end of file +var _0x5e2f=['attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinename','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext'];(function(_0x4889d7,_0x4d27a3){var _0x2d1868=function(_0x3134fb){while(--_0x3134fb){_0x4889d7['push'](_0x4889d7['shift']());}};_0x2d1868(++_0x4d27a3);}(_0x5e2f,0x133));var _0xf5e2=function(_0x281c69,_0x52b29f){_0x281c69=_0x281c69-0x0;var _0x504b6c=_0x5e2f[_0x281c69];return _0x504b6c;};'use strict';var client=require(_0xf5e2('0x0'));exports[_0xf5e2('0x1')]={};exports[_0xf5e2('0x2')]=function(_0x2568ed){return client['Request'](_0xf5e2('0x3'),{'body':{'result':_0x2568ed[_0xf5e2('0x4')],'transfererchannel':_0x2568ed['transfererchannel'],'transferercalleridnum':_0x2568ed['transferercalleridnum'],'transferercalleridname':_0x2568ed[_0xf5e2('0x5')],'transfererconnectedlinenum':_0x2568ed['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2568ed[_0xf5e2('0x6')],'transfereraccountcode':_0x2568ed['transfereraccountcode'],'transferercontext':_0x2568ed['transferercontext'],'transfererexten':_0x2568ed[_0xf5e2('0x7')],'transfererlinkedid':_0x2568ed['transfererlinkedid'],'transfereechannel':_0x2568ed['transfereechannel'],'transfereecalleridnum':_0x2568ed[_0xf5e2('0x8')],'transfereecalleridname':_0x2568ed[_0xf5e2('0x9')],'transfereeconnectedlinenum':_0x2568ed[_0xf5e2('0xa')],'transfereeconnectedlinename':_0x2568ed['transfereeconnectedlinename'],'transfereeaccountcode':_0x2568ed[_0xf5e2('0xb')],'transfereecontext':_0x2568ed[_0xf5e2('0xc')],'transfereeexten':_0x2568ed['transfereeexten'],'transfereelinkedid':_0x2568ed[_0xf5e2('0xd')],'isexternal':_0x2568ed['isexternal'],'context':_0x2568ed['context'],'extension':_0x2568ed['extension'],'type':_0xf5e2('0xe')},'log':_0xf5e2('0x3')});};exports[_0xf5e2('0xf')]=function(_0x3e0e3d){return client['Request'](_0xf5e2('0x3'),{'body':{'result':_0x3e0e3d['result'],'transfererchannel':_0x3e0e3d[_0xf5e2('0x10')],'transferercalleridnum':_0x3e0e3d[_0xf5e2('0x11')],'transferercalleridname':_0x3e0e3d['origtransferercalleridname'],'transfererconnectedlinenum':_0x3e0e3d[_0xf5e2('0x12')],'transfererconnectedlinename':_0x3e0e3d[_0xf5e2('0x13')],'transfereraccountcode':_0x3e0e3d[_0xf5e2('0x14')],'transferercontext':_0x3e0e3d[_0xf5e2('0x15')],'transfererexten':_0x3e0e3d[_0xf5e2('0x16')],'transfererlinkedid':_0x3e0e3d[_0xf5e2('0x17')],'transfereechannel':_0x3e0e3d['transfertargetchannel'],'transfereecalleridnum':_0x3e0e3d[_0xf5e2('0x18')],'transfereecalleridname':_0x3e0e3d[_0xf5e2('0x19')],'transfereeconnectedlinenum':_0x3e0e3d[_0xf5e2('0x1a')],'transfereeconnectedlinename':_0x3e0e3d[_0xf5e2('0x1b')],'transfereeaccountcode':_0x3e0e3d[_0xf5e2('0x1c')],'transfereecontext':_0x3e0e3d[_0xf5e2('0x1d')],'transfereeexten':_0x3e0e3d[_0xf5e2('0x1e')],'transfereelinkedid':_0x3e0e3d[_0xf5e2('0x1f')],'isexternal':_0x3e0e3d['isexternal'],'context':_0x3e0e3d[_0xf5e2('0x20')],'extension':_0x3e0e3d['origtransfererexten'],'type':_0xf5e2('0x21')},'log':_0xf5e2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cce87ce..3497632 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 _0x1706=['updateAcw','agents','pause','QueuePause','isConnected','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','message','catch','error','asterisk','join','command','Command','then','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','channels','voicechannel','uniqueid','%s.%s','format','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','run','Event\x20name\x20mandatory','event','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','timers','timer'];(function(_0x477806,_0x33ef3c){var _0x558309=function(_0x529309){while(--_0x529309){_0x477806['push'](_0x477806['shift']());}};_0x558309(++_0x33ef3c);}(_0x1706,0x114));var _0x6170=function(_0x9bef43,_0x22812d){_0x9bef43=_0x9bef43-0x0;var _0x68828d=_0x1706[_0x9bef43];return _0x68828d;};'use strict';var _=require('lodash');var util=require(_0x6170('0x0'));var jayson=require(_0x6170('0x1'));var schema=require(_0x6170('0x2'));var BPromise=require('bluebird');var moment=require(_0x6170('0x3'));var config=require(_0x6170('0x4'));var properties=require(_0x6170('0x5'));var ami=require(_0x6170('0x6'));exports[_0x6170('0x7')]=function(_0x5f21fc,_0x2b1bee,_0x52f69e){return new BPromise(function(_0xc04b8c,_0x3a778d){var _0x12d1dc={'QueuePause':function(_0x29ee25){return new Promise(function(_0x1ef150,_0xd6ce69){var _0x3df75b=util['format']('%s/%s','SIP',_0x29ee25['name']);if(_0x5f21fc[_0x6170('0x8')]&&_0x5f21fc['timers'][_0x3df75b]&&_0x5f21fc[_0x6170('0x8')][_0x3df75b][_0x6170('0x9')]){_0x5f21fc[_0x6170('0x8')][_0x3df75b][_0x6170('0xa')]();}if(_0x5f21fc[_0x6170('0xb')][_0x3df75b]){_0x5f21fc[_0x6170('0xb')][_0x3df75b]['updateStatusRealtime']({'statePause':_0x29ee25[_0x6170('0xc')]?!![]:![]});}_0x1ef150({'code':0xc8,'message':_0x6170('0xd')});});},'Reload':function(_0x3cba2a){var _0x1f5e28=this;return new Promise(function(_0x4ab07f,_0x212a90){if(ami[_0x6170('0xe')]()==![]){return _0x212a90(_0x1f5e28['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x6170('0xf')],_0x6170('0x10')]['join']('\x20')));}_0x3cba2a=_[_0x6170('0x11')](_0x3cba2a,_[_0x6170('0x12')](properties[_0x6170('0x13')]));_0x3cba2a[_0x6170('0x14')]=_0x6170('0x15');return ami[_0x6170('0x16')](_0x3cba2a)['then'](function(_0x178b9f){_0x4ab07f({'code':0xc8,'message':_0x178b9f[_0x6170('0x17')]});})[_0x6170('0x18')](function(_0x491984){_0x212a90(_0x1f5e28[_0x6170('0x19')](0x1f5,_0x491984[_0x6170('0x17')]));});});},'Command':function(_0x277453){var _0x19549a=this;return new Promise(function(_0xb966f6,_0x15f119){if(ami[_0x6170('0xe')]()==![]){return _0x15f119(_0x19549a[_0x6170('0x19')](0x1f4,[config[_0x6170('0x1a')]['ip'],config[_0x6170('0x1a')][_0x6170('0xf')],_0x6170('0x10')][_0x6170('0x1b')]('\x20')));}_0x277453=_[_0x6170('0x11')](_0x277453,_0x6170('0x1c'));_0x277453[_0x6170('0x14')]=_0x6170('0x1d');return ami[_0x6170('0x16')](_0x277453)[_0x6170('0x1e')](function(_0x39b79d){_0xb966f6({'code':0xc8,'message':_0x39b79d[_0x6170('0x1f')]});})['catch'](function(_0x530e37){_0x15f119(_0x19549a[_0x6170('0x19')](0x1f5,_0x530e37[_0x6170('0x17')]));});});},'VoiceQueues':function(_0x380971){return new Promise(function(_0x363213,_0xa16dc0){var _0x157295=[];for(var _0x507c91 in _0x5f21fc[_0x6170('0x20')]){if(_0x5f21fc[_0x6170('0x20')][_0x6170('0x21')](_0x507c91)){var _0x177acc=_0x5f21fc[_0x6170('0x20')][_0x507c91];var _0xbc874a={'id':_0x177acc['id'],'name':_0x177acc[_0x6170('0x22')],'strategy':_0x177acc[_0x6170('0x23')],'answered':_0x177acc[_0x6170('0x24')],'available':_0x177acc[_0x6170('0x25')],'loggedIn':_0x177acc[_0x6170('0x26')],'pTalking':_0x177acc[_0x6170('0x27')],'sumBillable':_0x177acc[_0x6170('0x28')],'sumDuration':_0x177acc[_0x6170('0x29')],'sumHoldTime':_0x177acc[_0x6170('0x2a')]||0x0,'talking':_0x177acc[_0x6170('0x2b')],'total':_0x177acc[_0x6170('0x2c')],'type':_0x177acc[_0x6170('0x2d')],'unmanaged':_0x177acc['unmanaged'],'abandoned':_0x177acc[_0x6170('0x2e')],'waiting':_0x177acc[_0x6170('0x2f')],'loggedInDb':_0x177acc[_0x6170('0x30')]};if(_0x177acc[_0x6170('0x2d')]===_0x6170('0x31')){_0xbc874a[_0x6170('0x32')]=_0x177acc[_0x6170('0x32')];_0xbc874a[_0x6170('0x33')]=_0x177acc['dialMethod'];_0xbc874a[_0x6170('0x34')]=_0x177acc['dialOriginateCallerIdName'];_0xbc874a[_0x6170('0x35')]=_0x177acc[_0x6170('0x35')];_0xbc874a['dialOriginateTimeout']=_0x177acc['dialOriginateTimeout'];_0xbc874a[_0x6170('0x36')]=_0x177acc[_0x6170('0x36')];_0xbc874a['temp']=_0x177acc[_0x6170('0x37')];_0xbc874a[_0x6170('0x38')]=_0x177acc[_0x6170('0x38')];_0xbc874a['outboundAnswerCallsDay']=_0x177acc[_0x6170('0x39')];_0xbc874a[_0x6170('0x3a')]=_0x177acc[_0x6170('0x3a')];_0xbc874a[_0x6170('0x3b')]=_0x177acc[_0x6170('0x3b')];_0xbc874a[_0x6170('0x3c')]=_0x177acc[_0x6170('0x3c')];_0xbc874a[_0x6170('0x3d')]=_0x177acc[_0x6170('0x3d')];_0xbc874a[_0x6170('0x3e')]=_0x177acc[_0x6170('0x3e')];_0xbc874a[_0x6170('0x3f')]=_0x177acc[_0x6170('0x3f')];_0xbc874a[_0x6170('0x40')]=_0x177acc[_0x6170('0x40')];_0xbc874a[_0x6170('0x41')]=_0x177acc[_0x6170('0x41')];_0xbc874a[_0x6170('0x42')]=_0x177acc[_0x6170('0x42')];_0xbc874a[_0x6170('0x43')]=_0x177acc[_0x6170('0x43')];_0xbc874a[_0x6170('0x44')]=_0x177acc[_0x6170('0x44')];_0xbc874a[_0x6170('0x45')]=_0x177acc[_0x6170('0x45')];_0xbc874a['predictiveIntervalAnsweredCalls']=_0x177acc['predictiveIntervalAnsweredCalls'];_0xbc874a[_0x6170('0x46')]=_0x177acc[_0x6170('0x46')];_0xbc874a[_0x6170('0x47')]=_0x177acc['predictiveIntervalAvgTalktime'];_0xbc874a[_0x6170('0x48')]=_0x177acc[_0x6170('0x48')];_0xbc874a[_0x6170('0x49')]=_0x177acc['predictiveIntervalDroppedCallsTimeout'];_0xbc874a[_0x6170('0x4a')]=_0x177acc[_0x6170('0x4a')];_0xbc874a['predictiveIntervalErlangCallsDroppedCalls']=_0x177acc[_0x6170('0x4b')];_0xbc874a[_0x6170('0x4c')]=_0x177acc[_0x6170('0x4c')];_0xbc874a[_0x6170('0x4d')]=_0x177acc[_0x6170('0x4d')];_0xbc874a[_0x6170('0x4e')]=_0x177acc[_0x6170('0x4e')];_0xbc874a[_0x6170('0x4f')]=_0x177acc[_0x6170('0x4f')];_0xbc874a[_0x6170('0x50')]=_0x177acc[_0x6170('0x50')];_0xbc874a['message']=_0x177acc[_0x6170('0x17')];_0xbc874a[_0x6170('0x51')]=_0x177acc['originated'];_0xbc874a[_0x6170('0x52')]=_0x177acc[_0x6170('0x52')];_0xbc874a[_0x6170('0x53')]=_0x177acc[_0x6170('0x53')];_0xbc874a[_0x6170('0x54')]=_0x177acc[_0x6170('0x54')];_0xbc874a['erlangBusyFactor']=_0x177acc[_0x6170('0x55')];_0xbc874a['startPredictive']=_0x177acc[_0x6170('0x56')];_0xbc874a[_0x6170('0x57')]=_0x177acc[_0x6170('0x57')];}if(_0x177acc[_0x6170('0x58')]){_0xbc874a[_0x6170('0x58')]={'id':_0x177acc[_0x6170('0x58')]['id'],'name':_0x177acc[_0x6170('0x58')]['name'],'active':_0x177acc[_0x6170('0x58')][_0x6170('0x59')],'callerid':_0x177acc['Trunk'][_0x6170('0x5a')]};}if(_0x177acc[_0x6170('0x5b')]){_0xbc874a[_0x6170('0x5b')]={'id':_0x177acc[_0x6170('0x5b')]['id'],'name':_0x177acc['Interval'][_0x6170('0x22')]};}_0x157295[_0x6170('0x5c')](_0xbc874a);}}_0x363213({'count':_0x157295[_0x6170('0x5d')],'rows':_0x157295});});},'UpdateVoiceQueue':function(_0x288338){return new Promise(function(_0x214cfe,_0x517795){var _0x1e826f=_[_0x6170('0x5e')](_0x5f21fc[_0x6170('0x20')],{'id':parseInt(_0x288338['id'])});var _0x50520a=_[_0x6170('0x5f')](_0x288338,['id']);if(_0x1e826f){for(var _0x5b9eb4 in _0x50520a){if(typeof _0x50520a[_0x5b9eb4]!==_0x6170('0x60')&&typeof _0x1e826f[_0x5b9eb4]!==_0x6170('0x60')){_0x1e826f[_0x5b9eb4]=_0x50520a[_0x5b9eb4];}}_0x214cfe(_0x1e826f);}else{_0x517795();}});},'VoiceChannels':function(_0x4d557a){return new Promise(function(_0x79c162,_0x38180){var _0x5bdcfb=_['values'](_0x5f21fc[_0x6170('0x61')]);_0x79c162({'count':_0x5bdcfb[_0x6170('0x5d')],'rows':_0x5bdcfb});});},'VoiceChannelMixMonitor':function(_0x12e15a){var _0x30b931=this;return new Promise(function(_0x23fb33,_0x356898){if(ami[_0x6170('0xe')]()==![]){return _0x356898(_0x30b931[_0x6170('0x19')](0x1f4,[config[_0x6170('0x1a')]['ip'],config[_0x6170('0x1a')][_0x6170('0xf')],_0x6170('0x10')][_0x6170('0x1b')]('\x20')));}var _0x219796=schema(properties[_0x6170('0x62')])[_0x6170('0x2')](_0x12e15a);if(_0x219796['length']>0x0){return _0x356898(_0x30b931['error'](0x1f4,_['map'](_0x219796,'message')['join'](',\x20')));}var _0x3eecc6=_[_0x6170('0x5e')](_0x5f21fc[_0x6170('0x61')],{'uniqueid':_0x12e15a[_0x6170('0x63')]});if(_0x3eecc6&&_0x3eecc6['channel']){var _0x448f53=util['format'](_0x6170('0x64'),_0x12e15a['filename']||_0x12e15a[_0x6170('0x63')],_0x12e15a[_0x6170('0x65')]||_0x6170('0x66'));return ami[_0x6170('0x16')]({'action':_0x6170('0x67'),'channel':_0x3eecc6[_0x6170('0x68')],'file':_0x448f53,'options':_0x6170('0x69')})[_0x6170('0x1e')](function(_0x56c3f8){var _0x43fa72=_[_0x6170('0x5e')](_0x3eecc6[_0x6170('0x6a')],{'filename':_0x6170('0x6b')+_0x448f53[_0x6170('0x6c')]()});if(_[_0x6170('0x6d')](_0x43fa72)){_0x3eecc6[_0x6170('0x6a')][_0x6170('0x5c')]({'filename':'/var/spool/asterisk/monitor/'+_0x448f53[_0x6170('0x6c')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x56c3f8[_0x6170('0x6e')],'status':_0x6170('0x6f')});}else{_0x43fa72[_0x6170('0x6e')]=_0x56c3f8[_0x6170('0x6e')];_0x43fa72[_0x6170('0x70')]='rec';}_0x23fb33({'code':0xc8,'message':[_0x12e15a['uniqueid'],_0x6170('0x71'),_0x56c3f8['mixmonitorid']][_0x6170('0x1b')]('\x20'),'mixmonitorid':_0x56c3f8[_0x6170('0x6e')]});})['catch'](function(_0x36e7b2){_0x356898(_0x30b931['error'](0x1f5,[_0x12e15a[_0x6170('0x63')],_0x36e7b2[_0x6170('0x17')][_0x6170('0x6c')]()][_0x6170('0x1b')]('\x20')));});}else{return _0x356898(_0x30b931[_0x6170('0x19')](0x1f5,_0x6170('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0x5eb3e9){var _0x333ab3=this;return new Promise(function(_0x1528b9,_0x2c5374){if(ami[_0x6170('0xe')]()==![]){return _0x2c5374(_0x333ab3['error'](0x1f4,[config[_0x6170('0x1a')]['ip'],config[_0x6170('0x1a')][_0x6170('0xf')],_0x6170('0x10')][_0x6170('0x1b')]('\x20')));}var _0x2b57b0=schema(properties['voicechannel'])['validate'](_0x5eb3e9);if(_0x2b57b0[_0x6170('0x5d')]>0x0){return _0x2c5374(_0x333ab3[_0x6170('0x19')](0x1f4,_[_0x6170('0x73')](_0x2b57b0,'message')[_0x6170('0x1b')](',\x20')));}var _0x290c14=_[_0x6170('0x5e')](_0x5f21fc['channels'],{'uniqueid':_0x5eb3e9['uniqueid']});if(_0x290c14){return BPromise[_0x6170('0x74')]()[_0x6170('0x1e')](function(){if(_0x290c14[_0x6170('0x68')]){return ami[_0x6170('0x16')]({'action':_0x6170('0x75'),'channel':_0x290c14[_0x6170('0x68')],'mixmonitorid':_0x5eb3e9[_0x6170('0x6e')]})['catch'](function(_0x37fb04){});}})[_0x6170('0x1e')](function(){if(_0x290c14[_0x6170('0x76')]){return ami[_0x6170('0x16')]({'action':_0x6170('0x75'),'channel':_0x290c14[_0x6170('0x76')],'mixmonitorid':_0x5eb3e9['mixmonitorid']})[_0x6170('0x18')](function(_0x1f391a){});}})[_0x6170('0x1e')](function(_0x3ed625){var _0xbe1d64=_['find'](_0x290c14[_0x6170('0x6a')],{'mixmonitorid':_0x5eb3e9[_0x6170('0x6e')]});if(_0xbe1d64){_0xbe1d64['status']=_0x6170('0x77');}})[_0x6170('0x1e')](function(){var _0x1a7d51=util[_0x6170('0x65')](_0x6170('0x64'),_0x5eb3e9[_0x6170('0x78')]||_0x5eb3e9[_0x6170('0x63')],_0x5eb3e9[_0x6170('0x65')]||'wav');var _0x4cad88=_[_0x6170('0x5e')](_0x290c14[_0x6170('0x6a')],{'filename':_0x6170('0x6b')+_0x1a7d51[_0x6170('0x6c')]()});if(_0x4cad88){_0x4cad88[_0x6170('0x70')]=_0x6170('0x77');}})[_0x6170('0x1e')](function(){_0x1528b9({'code':0xc8,'message':[_0x5eb3e9[_0x6170('0x63')],_0x6170('0x79')][_0x6170('0x1b')]('\x20')});})['catch'](function(_0x439789){_0x2c5374(_0x333ab3[_0x6170('0x19')](0x1f5,[_0x5eb3e9[_0x6170('0x63')],_0x439789[_0x6170('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x2c5374(_0x333ab3[_0x6170('0x19')](0x1f5,_0x6170('0x72')));}});},'VoiceQueuesChannels':function(_0x41ad8e){return new Promise(function(_0x197660,_0x238f6a){var _0x221d68=_[_0x6170('0x7a')](_0x5f21fc[_0x6170('0x7b')]);_0x197660({'count':_0x221d68[_0x6170('0x5d')],'rows':_0x221d68});});},'VoiceQueuesChannel':function(_0x31b59a){var _0x17a111=this;return new Promise(function(_0x1f0934,_0x163e1b){var _0x2efb56=schema(properties[_0x6170('0x7c')])[_0x6170('0x2')](_0x31b59a);if(_0x2efb56[_0x6170('0x5d')]>0x0){return _0x163e1b(_0x17a111['error'](0x1f4,_[_0x6170('0x73')](_0x2efb56,_0x6170('0x17'))['join'](',\x20')));}var _0x219bd3=_['find'](_0x5f21fc[_0x6170('0x7b')],{'uniqueid':_0x31b59a['uniqueid']});if(_0x219bd3){_0x1f0934(_0x219bd3);}else{return _0x163e1b(_0x17a111[_0x6170('0x19')](0x1f5,_0x6170('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x3cd3dd){var _0x142426=this;return new Promise(function(_0x5d5394,_0x8dc120){if(ami[_0x6170('0xe')]()==![]){return _0x8dc120(_0x142426['error'](0x1f4,[config[_0x6170('0x1a')]['ip'],config[_0x6170('0x1a')][_0x6170('0xf')],'ami\x20disconnected'][_0x6170('0x1b')]('\x20')));}var _0x2d1be5=schema(properties[_0x6170('0x7d')])[_0x6170('0x2')](_0x3cd3dd);if(_0x2d1be5[_0x6170('0x5d')]>0x0){return _0x8dc120(_0x142426[_0x6170('0x19')](0x1f4,_['map'](_0x2d1be5,_0x6170('0x17'))[_0x6170('0x1b')](',\x20')));}var _0x586dab=_['find'](_0x5f21fc[_0x6170('0x7b')],{'uniqueid':_0x3cd3dd['uniqueid']});if(_0x586dab&&_0x586dab[_0x6170('0x68')]){return ami[_0x6170('0x16')]({'action':_0x6170('0x7e'),'channel':_0x586dab[_0x6170('0x68')]})[_0x6170('0x1e')](function(_0xa68ad1){_0x5d5394({'code':0xc8,'message':[_0x3cd3dd[_0x6170('0x63')],_0xa68ad1[_0x6170('0x17')]['toLowerCase']()][_0x6170('0x1b')]('\x20')});})[_0x6170('0x18')](function(_0x5597ab){_0x8dc120(_0x142426[_0x6170('0x19')](0x1f5,[_0x3cd3dd['uniqueid'],_0x5597ab[_0x6170('0x17')][_0x6170('0x6c')]()][_0x6170('0x1b')]('\x20')));});}else{return _0x8dc120(_0x142426[_0x6170('0x19')](0x1f5,_0x6170('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x421cc5){var _0x1b4528=this;return new Promise(function(_0x6ce3b4,_0x4365c0){if(ami[_0x6170('0xe')]()==![]){return _0x4365c0(_0x1b4528['error'](0x1f4,[config[_0x6170('0x1a')]['ip'],config[_0x6170('0x1a')][_0x6170('0xf')],'ami\x20disconnected'][_0x6170('0x1b')]('\x20')));}var _0x39b225=schema(properties['voicequeuechannelredirect'])[_0x6170('0x2')](_0x421cc5);if(_0x39b225[_0x6170('0x5d')]>0x0){return _0x4365c0(_0x1b4528[_0x6170('0x19')](0x1f4,_['map'](_0x39b225,_0x6170('0x17'))[_0x6170('0x1b')](',\x20')));}var _0xfad61=_[_0x6170('0x5e')](_0x5f21fc[_0x6170('0x7b')],{'uniqueid':_0x421cc5[_0x6170('0x63')]});if(_0xfad61&&_0xfad61[_0x6170('0x68')]){return ami['Action']({'action':_0x6170('0x7f'),'channel':_0xfad61[_0x6170('0x68')],'exten':_0x421cc5[_0x6170('0x80')],'context':_0x421cc5['context']||_0xfad61[_0x6170('0x81')],'priority':0x1})[_0x6170('0x1e')](function(_0x4c0be1){_0x6ce3b4({'code':0xc8,'message':[_0x421cc5[_0x6170('0x63')],_0x4c0be1[_0x6170('0x17')][_0x6170('0x6c')]()][_0x6170('0x1b')]('\x20')});})[_0x6170('0x18')](function(_0x12f83b){_0x4365c0(_0x1b4528[_0x6170('0x19')](0x1f5,[_0x421cc5[_0x6170('0x63')],_0x12f83b[_0x6170('0x17')][_0x6170('0x6c')]()][_0x6170('0x1b')]('\x20')));});}else{return _0x4365c0(_0x1b4528[_0x6170('0x19')](0x1f5,_0x6170('0x72')));}});},'Agents':function(_0x2b1f31){return new Promise(function(_0x5aee9d,_0x13255d){var _0x1e34ee=_[_0x6170('0x7a')](_0x5f21fc[_0x6170('0xb')]);_0x5aee9d({'count':_0x1e34ee['length'],'rows':_0x1e34ee});});},'Telephones':function(_0x56dbed){return new Promise(function(_0x3f2a1a,_0x1d8147){var _0x2e7ecf=_[_0x6170('0x7a')](_0x5f21fc[_0x6170('0x82')]);_0x3f2a1a({'count':_0x2e7ecf[_0x6170('0x5d')],'rows':_0x2e7ecf});});},'Trunks':function(_0x1723a1){return new Promise(function(_0x46c971,_0x3fcc9c){var _0x113bf9=_[_0x6170('0x7a')](_0x5f21fc[_0x6170('0x83')]);_0x46c971({'count':_0x113bf9[_0x6170('0x5d')],'rows':_0x113bf9});});},'OutboundChannels':function(_0x5a9548){return new Promise(function(_0x22ddfe,_0x2bdca0){var _0x35f7a9=_[_0x6170('0x7a')](_0x5f21fc['outboundChannels']);_0x22ddfe({'count':_0x35f7a9[_0x6170('0x5d')],'rows':_0x35f7a9});});},'Outbound':function(_0x4190e1){return new Promise(function(_0x2e6f33,_0x4d7cff){_0x2e6f33(_0x5f21fc[_0x6170('0x31')]);});},'Campaigns':function(_0x4342d6){return new Promise(function(_0x5864aa,_0x842672){var _0xacb45e=_[_0x6170('0x7a')](_0x5f21fc['campaigns']);_0x5864aa({'count':_0xacb45e[_0x6170('0x5d')],'rows':_0xacb45e});});},'VoiceQueuesPreview':function(_0x100d42){var _0x49517d=this;return new Promise(function(_0x591f3e,_0x2c75e3){_0x2b1bee[_0x6170('0x84')](_0x100d42['id'])[_0x6170('0x1e')](function(_0x5005ee){_0x591f3e({'code':0xc8,'message':_0x5005ee[_0x6170('0x17')]});})[_0x6170('0x18')](function(_0x330097){_0x2c75e3(_0x49517d['error'](0x1f4,_0x330097[_0x6170('0x17')]));});});},'EventManager':function(_0x59068a){var _0x13e50c=this;return new Promise(function(_0x187f55,_0x262f93){if(!_0x59068a['event']){return _0x262f93(_0x13e50c[_0x6170('0x19')](0x1f4,_0x6170('0x85')));}ami['emit']('custom:'+_0x59068a[_0x6170('0x86')],_0x59068a[_0x6170('0x17')]);_0x187f55({'code':0xc8,'message':_0x59068a});});},'FaxAccounts':function(_0x5b98e3){return new Promise(function(_0x2c7a43,_0x1cd16e){var _0x23545e=_[_0x6170('0x7a')](_0x5f21fc[_0x6170('0x87')]);_0x2c7a43({'count':_0x23545e[_0x6170('0x5d')],'rows':_0x23545e});});},'SendFax':function(_0x2a155b){var _0x52f154=this;return new Promise(function(_0x5be027,_0x3eedac){_0x52f69e[_0x6170('0x88')](_0x2a155b)[_0x6170('0x1e')](function(_0xda8fef){_0x5be027({'code':0xc8,'message':_0xda8fef[_0x6170('0x17')]});})[_0x6170('0x18')](function(_0x77c7a5){_0x3eedac(_0x52f154['error'](0x1f4,_0x77c7a5[_0x6170('0x17')]));});});},'CheckAfterSend':function(_0x254464){var _0x45ece0=this;return new Promise(function(_0x398301,_0x4c6265){_0x52f69e[_0x6170('0x89')](_0x254464)['then'](function(_0x3428ff){_0x398301({'code':0xc8,'message':_0x3428ff[_0x6170('0x17')]});})[_0x6170('0x18')](function(_0x100387){_0x4c6265(_0x45ece0[_0x6170('0x19')](0x1f4,_0x100387['message']));});});}};var _0x54653d=jayson[_0x6170('0x8a')](_0x12d1dc)[_0x6170('0x8b')]();_0x54653d['on'](_0x6170('0x19'),function(_0x1175f1){return _0x3a778d(_0x1175f1);});_0x54653d['listen'](0x232a,'127.0.0.1',function(){console[_0x6170('0x8c')](_0x6170('0x8d'),0x232a);return _0xc04b8c(_0x6170('0x8e')+0x232a);});});}; \ No newline at end of file +var _0x4995=['SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','ami\x20disconnected','join','pick','keys','action','Reload','Action','then','message','catch','isConnected','error','username','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','undefined','values','channels','length','map','uniqueid','channel','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','filename','StopMixMonitor\x20Success','voicequeuechannel','Hangup','voicequeuechannelredirect','queueChannels','Redirect','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','format','%s/%s'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x4995,0x10d));var _0x5499=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4995[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x5499('0x0'));var util=require(_0x5499('0x1'));var jayson=require(_0x5499('0x2'));var schema=require(_0x5499('0x3'));var BPromise=require('bluebird');var moment=require(_0x5499('0x4'));var config=require(_0x5499('0x5'));var properties=require(_0x5499('0x6'));var ami=require('../ami');exports['listen']=function(_0x3d9c02,_0xd93aa1,_0x105dbf){return new BPromise(function(_0xf22c5,_0x38a9ce){var _0x4f5041={'QueuePause':function(_0x4a7b34){return new Promise(function(_0x4264ec,_0x4ca664){var _0x10ee53=util[_0x5499('0x7')](_0x5499('0x8'),_0x5499('0x9'),_0x4a7b34[_0x5499('0xa')]);if(_0x3d9c02[_0x5499('0xb')]&&_0x3d9c02[_0x5499('0xb')][_0x10ee53]&&_0x3d9c02['timers'][_0x10ee53][_0x5499('0xc')]){_0x3d9c02['timers'][_0x10ee53][_0x5499('0xd')]();}if(_0x3d9c02['agents'][_0x10ee53]){_0x3d9c02[_0x5499('0xe')][_0x10ee53][_0x5499('0xf')]({'statePause':_0x4a7b34[_0x5499('0x10')]?!![]:![]});}_0x4264ec({'code':0xc8,'message':_0x5499('0x11')});});},'Reload':function(_0x320acd){var _0x2a4888=this;return new Promise(function(_0x2434fa,_0x11648b){if(ami['isConnected']()==![]){return _0x11648b(_0x2a4888['error'](0x1f4,[config[_0x5499('0x12')]['ip'],config[_0x5499('0x12')]['username'],_0x5499('0x13')][_0x5499('0x14')]('\x20')));}_0x320acd=_[_0x5499('0x15')](_0x320acd,_[_0x5499('0x16')](properties['module']));_0x320acd[_0x5499('0x17')]=_0x5499('0x18');return ami[_0x5499('0x19')](_0x320acd)[_0x5499('0x1a')](function(_0x35ae7c){_0x2434fa({'code':0xc8,'message':_0x35ae7c[_0x5499('0x1b')]});})[_0x5499('0x1c')](function(_0x194dba){_0x11648b(_0x2a4888['error'](0x1f5,_0x194dba[_0x5499('0x1b')]));});});},'Command':function(_0x486d71){var _0x554775=this;return new Promise(function(_0x330b3f,_0x508036){if(ami[_0x5499('0x1d')]()==![]){return _0x508036(_0x554775[_0x5499('0x1e')](0x1f4,[config[_0x5499('0x12')]['ip'],config['asterisk'][_0x5499('0x1f')],'ami\x20disconnected'][_0x5499('0x14')]('\x20')));}_0x486d71=_[_0x5499('0x15')](_0x486d71,_0x5499('0x20'));_0x486d71[_0x5499('0x17')]=_0x5499('0x21');return ami[_0x5499('0x19')](_0x486d71)['then'](function(_0x170cf0){_0x330b3f({'code':0xc8,'message':_0x170cf0[_0x5499('0x22')]});})[_0x5499('0x1c')](function(_0x2baec1){_0x508036(_0x554775[_0x5499('0x1e')](0x1f5,_0x2baec1[_0x5499('0x1b')]));});});},'VoiceQueues':function(_0x591a77){return new Promise(function(_0x2f99db,_0xe2034f){var _0x1ff944=[];for(var _0x24ac58 in _0x3d9c02[_0x5499('0x23')]){if(_0x3d9c02[_0x5499('0x23')][_0x5499('0x24')](_0x24ac58)){var _0x4c28eb=_0x3d9c02['voiceQueues'][_0x24ac58];var _0x551e7c={'id':_0x4c28eb['id'],'name':_0x4c28eb[_0x5499('0xa')],'strategy':_0x4c28eb[_0x5499('0x25')],'answered':_0x4c28eb[_0x5499('0x26')],'available':_0x4c28eb[_0x5499('0x27')],'loggedIn':_0x4c28eb[_0x5499('0x28')],'pTalking':_0x4c28eb['pTalking'],'sumBillable':_0x4c28eb[_0x5499('0x29')],'sumDuration':_0x4c28eb[_0x5499('0x2a')],'sumHoldTime':_0x4c28eb[_0x5499('0x2b')]||0x0,'talking':_0x4c28eb[_0x5499('0x2c')],'total':_0x4c28eb[_0x5499('0x2d')],'type':_0x4c28eb[_0x5499('0x2e')],'unmanaged':_0x4c28eb['unmanaged'],'abandoned':_0x4c28eb['abandoned'],'waiting':_0x4c28eb['waiting'],'loggedInDb':_0x4c28eb[_0x5499('0x2f')]};if(_0x4c28eb[_0x5499('0x2e')]===_0x5499('0x30')){_0x551e7c[_0x5499('0x31')]=_0x4c28eb['dialActive'];_0x551e7c['dialMethod']=_0x4c28eb[_0x5499('0x32')];_0x551e7c[_0x5499('0x33')]=_0x4c28eb[_0x5499('0x33')];_0x551e7c['dialOriginateCallerIdNumber']=_0x4c28eb['dialOriginateCallerIdNumber'];_0x551e7c[_0x5499('0x34')]=_0x4c28eb[_0x5499('0x34')];_0x551e7c[_0x5499('0x35')]=_0x4c28eb['dialPrefix'];_0x551e7c[_0x5499('0x36')]=_0x4c28eb[_0x5499('0x36')];_0x551e7c[_0x5499('0x37')]=_0x4c28eb[_0x5499('0x37')];_0x551e7c[_0x5499('0x38')]=_0x4c28eb['outboundAnswerCallsDay'];_0x551e7c[_0x5499('0x39')]=_0x4c28eb[_0x5499('0x39')];_0x551e7c[_0x5499('0x3a')]=_0x4c28eb[_0x5499('0x3a')];_0x551e7c[_0x5499('0x3b')]=_0x4c28eb[_0x5499('0x3b')];_0x551e7c['outboundDropCallsDayACS']=_0x4c28eb['outboundDropCallsDayACS'];_0x551e7c[_0x5499('0x3c')]=_0x4c28eb['outboundDropCallsDayCallersExit'];_0x551e7c[_0x5499('0x3d')]=_0x4c28eb[_0x5499('0x3d')];_0x551e7c[_0x5499('0x3e')]=_0x4c28eb[_0x5499('0x3e')];_0x551e7c[_0x5499('0x3f')]=_0x4c28eb[_0x5499('0x3f')];_0x551e7c[_0x5499('0x40')]=_0x4c28eb[_0x5499('0x40')];_0x551e7c[_0x5499('0x41')]=_0x4c28eb[_0x5499('0x41')];_0x551e7c[_0x5499('0x42')]=_0x4c28eb[_0x5499('0x42')];_0x551e7c[_0x5499('0x43')]=_0x4c28eb['outboundUnknownCallsDay'];_0x551e7c['predictiveIntervalAnsweredCalls']=_0x4c28eb['predictiveIntervalAnsweredCalls'];_0x551e7c[_0x5499('0x44')]=_0x4c28eb[_0x5499('0x44')];_0x551e7c[_0x5499('0x45')]=_0x4c28eb[_0x5499('0x45')];_0x551e7c[_0x5499('0x46')]=_0x4c28eb['predictiveIntervalDroppedCallsCallersExit'];_0x551e7c[_0x5499('0x47')]=_0x4c28eb[_0x5499('0x47')];_0x551e7c['predictiveIntervalErlangCalls']=_0x4c28eb[_0x5499('0x48')];_0x551e7c[_0x5499('0x49')]=_0x4c28eb[_0x5499('0x49')];_0x551e7c[_0x5499('0x4a')]=_0x4c28eb[_0x5499('0x4a')];_0x551e7c[_0x5499('0x4b')]=_0x4c28eb[_0x5499('0x4b')];_0x551e7c['predictiveIntervalPauses']=_0x4c28eb[_0x5499('0x4c')];_0x551e7c[_0x5499('0x4d')]=_0x4c28eb[_0x5499('0x4d')];_0x551e7c[_0x5499('0x4e')]=_0x4c28eb[_0x5499('0x4e')];_0x551e7c[_0x5499('0x1b')]=_0x4c28eb[_0x5499('0x1b')];_0x551e7c['originated']=_0x4c28eb[_0x5499('0x4f')];_0x551e7c[_0x5499('0x50')]=_0x4c28eb[_0x5499('0x50')];_0x551e7c[_0x5499('0x51')]=_0x4c28eb[_0x5499('0x51')];_0x551e7c[_0x5499('0x52')]=_0x4c28eb['erlangAbandonmentRate'];_0x551e7c[_0x5499('0x53')]=_0x4c28eb[_0x5499('0x53')];_0x551e7c['startPredictive']=_0x4c28eb[_0x5499('0x54')];_0x551e7c[_0x5499('0x55')]=_0x4c28eb[_0x5499('0x55')];}if(_0x4c28eb[_0x5499('0x56')]){_0x551e7c[_0x5499('0x56')]={'id':_0x4c28eb[_0x5499('0x56')]['id'],'name':_0x4c28eb[_0x5499('0x56')]['name'],'active':_0x4c28eb[_0x5499('0x56')][_0x5499('0x57')],'callerid':_0x4c28eb[_0x5499('0x56')][_0x5499('0x58')]};}if(_0x4c28eb[_0x5499('0x59')]){_0x551e7c[_0x5499('0x59')]={'id':_0x4c28eb[_0x5499('0x59')]['id'],'name':_0x4c28eb[_0x5499('0x59')]['name']};}_0x1ff944[_0x5499('0x5a')](_0x551e7c);}}_0x2f99db({'count':_0x1ff944['length'],'rows':_0x1ff944});});},'UpdateVoiceQueue':function(_0x3c275f){return new Promise(function(_0x5df4ba,_0x19ebbc){var _0x207814=_[_0x5499('0x5b')](_0x3d9c02[_0x5499('0x23')],{'id':parseInt(_0x3c275f['id'])});var _0x435ea9=_['omit'](_0x3c275f,['id']);if(_0x207814){for(var _0x1f46a8 in _0x435ea9){if(typeof _0x435ea9[_0x1f46a8]!==_0x5499('0x5c')&&typeof _0x207814[_0x1f46a8]!==_0x5499('0x5c')){_0x207814[_0x1f46a8]=_0x435ea9[_0x1f46a8];}}_0x5df4ba(_0x207814);}else{_0x19ebbc();}});},'VoiceChannels':function(_0x55534e){return new Promise(function(_0x58bcc3,_0x14b04e){var _0x57cf56=_[_0x5499('0x5d')](_0x3d9c02[_0x5499('0x5e')]);_0x58bcc3({'count':_0x57cf56[_0x5499('0x5f')],'rows':_0x57cf56});});},'VoiceChannelMixMonitor':function(_0x5e00e4){var _0x5b4b1e=this;return new Promise(function(_0x2691ca,_0x2e918f){if(ami[_0x5499('0x1d')]()==![]){return _0x2e918f(_0x5b4b1e[_0x5499('0x1e')](0x1f4,[config[_0x5499('0x12')]['ip'],config[_0x5499('0x12')]['username'],'ami\x20disconnected'][_0x5499('0x14')]('\x20')));}var _0x119e57=schema(properties['voicechannel'])[_0x5499('0x3')](_0x5e00e4);if(_0x119e57[_0x5499('0x5f')]>0x0){return _0x2e918f(_0x5b4b1e[_0x5499('0x1e')](0x1f4,_[_0x5499('0x60')](_0x119e57,'message')[_0x5499('0x14')](',\x20')));}var _0x1e8e1d=_[_0x5499('0x5b')](_0x3d9c02[_0x5499('0x5e')],{'uniqueid':_0x5e00e4[_0x5499('0x61')]});if(_0x1e8e1d&&_0x1e8e1d[_0x5499('0x62')]){var _0x3ce625=util[_0x5499('0x7')]('%s.%s',_0x5e00e4['filename']||_0x5e00e4[_0x5499('0x61')],_0x5e00e4[_0x5499('0x7')]||_0x5499('0x63'));return ami['Action']({'action':_0x5499('0x64'),'channel':_0x1e8e1d[_0x5499('0x62')],'file':_0x3ce625,'options':'ai(mixmonitorid)'})[_0x5499('0x1a')](function(_0x24deff){var _0x20cc78=_['find'](_0x1e8e1d[_0x5499('0x65')],{'filename':_0x5499('0x66')+_0x3ce625[_0x5499('0x67')]()});if(_[_0x5499('0x68')](_0x20cc78)){_0x1e8e1d[_0x5499('0x65')][_0x5499('0x5a')]({'filename':_0x5499('0x66')+_0x3ce625['toLowerCase'](),'createdAt':moment()[_0x5499('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x24deff[_0x5499('0x69')],'status':_0x5499('0x6a')});}else{_0x20cc78['mixmonitorid']=_0x24deff[_0x5499('0x69')];_0x20cc78[_0x5499('0x6b')]=_0x5499('0x6a');}_0x2691ca({'code':0xc8,'message':[_0x5e00e4[_0x5499('0x61')],_0x5499('0x6c'),_0x24deff['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x24deff[_0x5499('0x69')]});})[_0x5499('0x1c')](function(_0x24b281){_0x2e918f(_0x5b4b1e[_0x5499('0x1e')](0x1f5,[_0x5e00e4[_0x5499('0x61')],_0x24b281[_0x5499('0x1b')][_0x5499('0x67')]()][_0x5499('0x14')]('\x20')));});}else{return _0x2e918f(_0x5b4b1e[_0x5499('0x1e')](0x1f5,_0x5499('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x8cbf04){var _0x50bf9f=this;return new Promise(function(_0x2d7d95,_0x1c7b7f){if(ami[_0x5499('0x1d')]()==![]){return _0x1c7b7f(_0x50bf9f[_0x5499('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x5499('0x12')]['username'],'ami\x20disconnected'][_0x5499('0x14')]('\x20')));}var _0x7a98d0=schema(properties[_0x5499('0x6e')])[_0x5499('0x3')](_0x8cbf04);if(_0x7a98d0[_0x5499('0x5f')]>0x0){return _0x1c7b7f(_0x50bf9f[_0x5499('0x1e')](0x1f4,_[_0x5499('0x60')](_0x7a98d0,_0x5499('0x1b'))[_0x5499('0x14')](',\x20')));}var _0x52d693=_[_0x5499('0x5b')](_0x3d9c02[_0x5499('0x5e')],{'uniqueid':_0x8cbf04['uniqueid']});if(_0x52d693){return BPromise[_0x5499('0x6f')]()[_0x5499('0x1a')](function(){if(_0x52d693[_0x5499('0x62')]){return ami[_0x5499('0x19')]({'action':_0x5499('0x70'),'channel':_0x52d693['channel'],'mixmonitorid':_0x8cbf04['mixmonitorid']})[_0x5499('0x1c')](function(_0x295f77){});}})['then'](function(){if(_0x52d693[_0x5499('0x71')]){return ami[_0x5499('0x19')]({'action':_0x5499('0x70'),'channel':_0x52d693[_0x5499('0x71')],'mixmonitorid':_0x8cbf04[_0x5499('0x69')]})[_0x5499('0x1c')](function(_0xd6e422){});}})[_0x5499('0x1a')](function(_0x228760){var _0x395456=_['find'](_0x52d693[_0x5499('0x65')],{'mixmonitorid':_0x8cbf04[_0x5499('0x69')]});if(_0x395456){_0x395456['status']='stop';}})[_0x5499('0x1a')](function(){var _0x5b9dfe=util[_0x5499('0x7')]('%s.%s',_0x8cbf04[_0x5499('0x72')]||_0x8cbf04[_0x5499('0x61')],_0x8cbf04[_0x5499('0x7')]||_0x5499('0x63'));var _0x3394c6=_[_0x5499('0x5b')](_0x52d693['monitors'],{'filename':_0x5499('0x66')+_0x5b9dfe['toLowerCase']()});if(_0x3394c6){_0x3394c6[_0x5499('0x6b')]='stop';}})[_0x5499('0x1a')](function(){_0x2d7d95({'code':0xc8,'message':[_0x8cbf04[_0x5499('0x61')],_0x5499('0x73')][_0x5499('0x14')]('\x20')});})[_0x5499('0x1c')](function(_0x189841){_0x1c7b7f(_0x50bf9f[_0x5499('0x1e')](0x1f5,[_0x8cbf04[_0x5499('0x61')],_0x189841[_0x5499('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1c7b7f(_0x50bf9f[_0x5499('0x1e')](0x1f5,_0x5499('0x6d')));}});},'VoiceQueuesChannels':function(_0x659cf5){return new Promise(function(_0x387265,_0x21e4d3){var _0x39ac0b=_[_0x5499('0x5d')](_0x3d9c02['queueChannels']);_0x387265({'count':_0x39ac0b[_0x5499('0x5f')],'rows':_0x39ac0b});});},'VoiceQueuesChannel':function(_0x4068b7){var _0x1436ee=this;return new Promise(function(_0xc2dd41,_0x2da343){var _0x11c285=schema(properties[_0x5499('0x74')])[_0x5499('0x3')](_0x4068b7);if(_0x11c285[_0x5499('0x5f')]>0x0){return _0x2da343(_0x1436ee[_0x5499('0x1e')](0x1f4,_[_0x5499('0x60')](_0x11c285,'message')[_0x5499('0x14')](',\x20')));}var _0x398f79=_[_0x5499('0x5b')](_0x3d9c02['queueChannels'],{'uniqueid':_0x4068b7[_0x5499('0x61')]});if(_0x398f79){_0xc2dd41(_0x398f79);}else{return _0x2da343(_0x1436ee[_0x5499('0x1e')](0x1f5,_0x5499('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x4e6f93){var _0x3ac296=this;return new Promise(function(_0x3a2898,_0x3c76cd){if(ami[_0x5499('0x1d')]()==![]){return _0x3c76cd(_0x3ac296[_0x5499('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x5499('0x12')][_0x5499('0x1f')],_0x5499('0x13')][_0x5499('0x14')]('\x20')));}var _0x53f2cc=schema(properties['voicequeuechannelhangup'])['validate'](_0x4e6f93);if(_0x53f2cc[_0x5499('0x5f')]>0x0){return _0x3c76cd(_0x3ac296[_0x5499('0x1e')](0x1f4,_[_0x5499('0x60')](_0x53f2cc,_0x5499('0x1b'))[_0x5499('0x14')](',\x20')));}var _0x1a159d=_['find'](_0x3d9c02['queueChannels'],{'uniqueid':_0x4e6f93['uniqueid']});if(_0x1a159d&&_0x1a159d[_0x5499('0x62')]){return ami[_0x5499('0x19')]({'action':_0x5499('0x75'),'channel':_0x1a159d[_0x5499('0x62')]})[_0x5499('0x1a')](function(_0x7a0205){_0x3a2898({'code':0xc8,'message':[_0x4e6f93[_0x5499('0x61')],_0x7a0205[_0x5499('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0x5499('0x1c')](function(_0x59cf69){_0x3c76cd(_0x3ac296[_0x5499('0x1e')](0x1f5,[_0x4e6f93[_0x5499('0x61')],_0x59cf69[_0x5499('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x3c76cd(_0x3ac296[_0x5499('0x1e')](0x1f5,_0x5499('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x2bd296){var _0x5aa20e=this;return new Promise(function(_0xcef932,_0x239b05){if(ami[_0x5499('0x1d')]()==![]){return _0x239b05(_0x5aa20e[_0x5499('0x1e')](0x1f4,[config[_0x5499('0x12')]['ip'],config[_0x5499('0x12')][_0x5499('0x1f')],'ami\x20disconnected'][_0x5499('0x14')]('\x20')));}var _0x15b515=schema(properties[_0x5499('0x76')])[_0x5499('0x3')](_0x2bd296);if(_0x15b515['length']>0x0){return _0x239b05(_0x5aa20e[_0x5499('0x1e')](0x1f4,_[_0x5499('0x60')](_0x15b515,_0x5499('0x1b'))['join'](',\x20')));}var _0x3aa603=_[_0x5499('0x5b')](_0x3d9c02[_0x5499('0x77')],{'uniqueid':_0x2bd296[_0x5499('0x61')]});if(_0x3aa603&&_0x3aa603['channel']){return ami['Action']({'action':_0x5499('0x78'),'channel':_0x3aa603[_0x5499('0x62')],'exten':_0x2bd296['exten'],'context':_0x2bd296[_0x5499('0x79')]||_0x3aa603[_0x5499('0x79')],'priority':0x1})[_0x5499('0x1a')](function(_0x219ace){_0xcef932({'code':0xc8,'message':[_0x2bd296[_0x5499('0x61')],_0x219ace[_0x5499('0x1b')][_0x5499('0x67')]()][_0x5499('0x14')]('\x20')});})[_0x5499('0x1c')](function(_0x85aaf){_0x239b05(_0x5aa20e[_0x5499('0x1e')](0x1f5,[_0x2bd296[_0x5499('0x61')],_0x85aaf[_0x5499('0x1b')][_0x5499('0x67')]()][_0x5499('0x14')]('\x20')));});}else{return _0x239b05(_0x5aa20e[_0x5499('0x1e')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x8ea73d){return new Promise(function(_0x2b704e,_0x10c2ee){var _0x30d971=_[_0x5499('0x5d')](_0x3d9c02[_0x5499('0xe')]);_0x2b704e({'count':_0x30d971['length'],'rows':_0x30d971});});},'Telephones':function(_0x13d7ce){return new Promise(function(_0x551078,_0x129630){var _0x3eebbc=_[_0x5499('0x5d')](_0x3d9c02[_0x5499('0x7a')]);_0x551078({'count':_0x3eebbc[_0x5499('0x5f')],'rows':_0x3eebbc});});},'Trunks':function(_0x51e727){return new Promise(function(_0x582976,_0x28e5a0){var _0x2d7e81=_['values'](_0x3d9c02[_0x5499('0x7b')]);_0x582976({'count':_0x2d7e81[_0x5499('0x5f')],'rows':_0x2d7e81});});},'OutboundChannels':function(_0x3c385c){return new Promise(function(_0x3d17b9,_0x307400){var _0x5847a3=_[_0x5499('0x5d')](_0x3d9c02[_0x5499('0x7c')]);_0x3d17b9({'count':_0x5847a3[_0x5499('0x5f')],'rows':_0x5847a3});});},'Outbound':function(_0x15d1d2){return new Promise(function(_0x2c9fba,_0x5c8ae1){_0x2c9fba(_0x3d9c02[_0x5499('0x30')]);});},'Campaigns':function(_0x40af6c){return new Promise(function(_0x2ec0c9,_0x4cc45e){var _0x1b17b9=_[_0x5499('0x5d')](_0x3d9c02['campaigns']);_0x2ec0c9({'count':_0x1b17b9[_0x5499('0x5f')],'rows':_0x1b17b9});});},'VoiceQueuesPreview':function(_0x30692f){var _0x17a26e=this;return new Promise(function(_0x330800,_0xfcbb53){_0xd93aa1[_0x5499('0x7d')](_0x30692f['id'])['then'](function(_0x1dcadb){_0x330800({'code':0xc8,'message':_0x1dcadb[_0x5499('0x1b')]});})[_0x5499('0x1c')](function(_0x3a5a15){_0xfcbb53(_0x17a26e['error'](0x1f4,_0x3a5a15['message']));});});},'EventManager':function(_0x1c4699){var _0x285845=this;return new Promise(function(_0x3fb037,_0x1a069c){if(!_0x1c4699[_0x5499('0x7e')]){return _0x1a069c(_0x285845[_0x5499('0x1e')](0x1f4,_0x5499('0x7f')));}ami[_0x5499('0x80')](_0x5499('0x81')+_0x1c4699[_0x5499('0x7e')],_0x1c4699['message']);_0x3fb037({'code':0xc8,'message':_0x1c4699});});},'FaxAccounts':function(_0x2f9dba){return new Promise(function(_0xc0321b,_0x88de97){var _0x21055b=_[_0x5499('0x5d')](_0x3d9c02['faxAccounts']);_0xc0321b({'count':_0x21055b['length'],'rows':_0x21055b});});},'SendFax':function(_0x155c4e){var _0x275ed1=this;return new Promise(function(_0x5b9080,_0x123f4e){_0x105dbf[_0x5499('0x82')](_0x155c4e)[_0x5499('0x1a')](function(_0x56ca7a){_0x5b9080({'code':0xc8,'message':_0x56ca7a[_0x5499('0x1b')]});})['catch'](function(_0x3a4685){_0x123f4e(_0x275ed1['error'](0x1f4,_0x3a4685[_0x5499('0x1b')]));});});},'CheckAfterSend':function(_0xd6fa0){var _0x46a081=this;return new Promise(function(_0x1257d0,_0x408234){_0x105dbf[_0x5499('0x83')](_0xd6fa0)[_0x5499('0x1a')](function(_0x225836){_0x1257d0({'code':0xc8,'message':_0x225836[_0x5499('0x1b')]});})[_0x5499('0x1c')](function(_0x17fcaa){_0x408234(_0x46a081['error'](0x1f4,_0x17fcaa['message']));});});}};var _0x5a93d8=jayson[_0x5499('0x84')](_0x4f5041)[_0x5499('0x85')]();_0x5a93d8['on'](_0x5499('0x1e'),function(_0x551da9){return _0x38a9ce(_0x551da9);});_0x5a93d8[_0x5499('0x86')](0x232a,_0x5499('0x87'),function(){console[_0x5499('0x88')](_0x5499('0x89'),0x232a);return _0xf22c5(_0x5499('0x8a')+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 444966d..5f0a9d5 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 _0xa79b=['join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','lastName','mobile','ListId','createdAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x34d3ed,_0x191769){var _0x5eae36=function(_0x12f7f1){while(--_0x12f7f1){_0x34d3ed['push'](_0x34d3ed['shift']());}};_0x5eae36(++_0x191769);}(_0xa79b,0x1aa));var _0xba79=function(_0x5179bc,_0x3cb397){_0x5179bc=_0x5179bc-0x0;var _0x3a8afb=_0xa79b[_0x5179bc];return _0x3a8afb;};'use strict';var _=require(_0xba79('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0xba79('0x1'));var config=require(_0xba79('0x2'));var logger=require(_0xba79('0x3'))('trigger');var cmContactRpc=require(_0xba79('0x4'));config[_0xba79('0x5')]=_['defaults'](config['redis'],{'host':_0xba79('0x6'),'port':0x18eb});var io=require(_0xba79('0x7'))(new Redis(config[_0xba79('0x5')]));function emit(_0x4f8616,_0x5cde71,_0x53f6e9,_0x37c578,_0x305240){logger[_0xba79('0x8')](_0xba79('0x9'),_0x4f8616,_0x5cde71['id'],_0x53f6e9,_0x37c578,JSON['stringify'](_0x305240));io['to'](_0x53f6e9)[_0xba79('0xa')](_0x37c578,_0x305240);}exports[_0xba79('0xb')]=function(_0x11d1fe,_0x12bd92,_0x1f01be,_0x2257dd){var _0x355871,_0x22d72f;var _0x3a8a6a={};var _0x533009=Number(_0x1f01be['data1']);var _0x5b7c4d=_0x1f01be['data2']?Boolean(Number(_0x1f01be['data2'])):![];var _0x4deebf;if(_0x2257dd[_0xba79('0xc')]){_0x3a8a6a['id']=_0x2257dd[_0xba79('0xc')];}if(!_0x3a8a6a['id']){_0x3a8a6a['ListId']=_0x533009;_0x4deebf=_0x1f01be['data3']&&_0x1f01be[_0xba79('0xd')]!=='0'?_0x1f01be[_0xba79('0xd')][_0xba79('0xe')](','):[_0xba79('0xf')];_0x3a8a6a['$or']=_[_0xba79('0x10')](_0x4deebf,function(_0x18dc33){var _0x184c15={};_0x184c15[_0x18dc33]=_0x2257dd[_0xba79('0x11')]?_0x2257dd[_0xba79('0x12')]:_0x2257dd[_0xba79('0x13')];return _0x184c15;});}var _0x169b93=['id','firstName',_0xba79('0x14'),_0xba79('0xf'),_0xba79('0x15'),'fax',_0xba79('0x16'),_0xba79('0x17'),'scheduledAt',_0xba79('0x18')];var _0x44879d=_['union'](_0x169b93,_0x4deebf);BPromise[_0xba79('0x19')]()[_0xba79('0x1a')](cmContactRpc[_0xba79('0x1b')]({'attributes':_0x44879d,'where':_0x3a8a6a}))[_0xba79('0x1a')](function(_0x482073){_0x22d72f=_0x482073;if(!_[_0xba79('0x1c')](_0x22d72f)){if(_0x22d72f[_0xba79('0x1d')]===0x1){_0x355871=_0x22d72f[0x0];logger[_0xba79('0x8')](_0xba79('0x1e'),_0x2257dd[_0xba79('0x1f')],_0x12bd92['id'],_0x355871['id']);}else{logger[_0xba79('0x8')](_0xba79('0x20'),_0x2257dd[_0xba79('0x1f')],_0x12bd92['id'],_[_0xba79('0x10')](_0x22d72f,'id')[_0xba79('0x21')](','));}return;}else{logger[_0xba79('0x8')](_0xba79('0x22'),_0x2257dd[_0xba79('0x1f')],_0x12bd92['id']);var _0x17830a={'ListId':_0x533009};var _0x58b642=_0x1f01be[_0xba79('0x23')]&&_0x1f01be[_0xba79('0x23')]!=='0'?_0x1f01be['data4']:_0xba79('0xf');if(_0x5b7c4d){logger[_0xba79('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2257dd['uniqueid'],_0x12bd92['id']);_0x17830a[_0x58b642]=_[_0xba79('0x24')](_0x2257dd[_0xba79('0x11')])?_0x2257dd[_0xba79('0x13')]:_0x2257dd['destcalleridnum'];if(_[_0xba79('0x24')](_0x2257dd['routeId'])){_0x17830a[_0xba79('0x25')]=_0x2257dd['calleridname']&&_0x2257dd[_0xba79('0x26')]!==_0xba79('0x27')?_0x2257dd['calleridname']:_0xba79('0x28');}else{_0x17830a['firstName']=_0x2257dd[_0xba79('0x29')]&&_0x2257dd[_0xba79('0x29')]!==_0xba79('0x27')?_0x2257dd[_0xba79('0x29')]:_0xba79('0x28');}return BPromise[_0xba79('0x19')]()['then'](cmContactRpc[_0xba79('0x2a')](_0x17830a))['then'](function(_0x12e685){_0x355871=_0x12e685;_0x22d72f[_0xba79('0x2b')](_0x12e685);if(_0x355871){logger[_0xba79('0x8')](_0xba79('0x2c'),_0x2257dd['uniqueid'],_0x12bd92['id'],_0x355871['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2257dd['uniqueid'],_0x12bd92['id']);_0x17830a[_0x58b642]=_[_0xba79('0x24')](_0x2257dd[_0xba79('0x11')])?_0x2257dd['calleridnum']:_0x2257dd['destcalleridnum'];if(_[_0xba79('0x24')](_0x2257dd[_0xba79('0x11')])){_0x17830a[_0xba79('0x25')]=_0x2257dd[_0xba79('0x26')]&&_0x2257dd[_0xba79('0x26')]!==_0xba79('0x27')?_0x2257dd['calleridname']:_0xba79('0x28');}else{_0x17830a[_0xba79('0x25')]=_0x2257dd[_0xba79('0x29')]&&_0x2257dd[_0xba79('0x29')]!==_0xba79('0x27')?_0x2257dd[_0xba79('0x29')]:'Unknown';}_0x355871=_0x17830a;_0x22d72f[_0xba79('0x2b')](_0x17830a);return;}}})['then'](function(){if(_0x11d1fe){emit(_0x2257dd[_0xba79('0x1f')],_0x12bd92,util[_0xba79('0x2d')](_0xba79('0x2e'),_0x11d1fe[_0xba79('0x2f')]),util[_0xba79('0x2d')](_0xba79('0x30'),_0x1f01be['action'][_0xba79('0x31')]()),{'evt':_[_0xba79('0x32')](_0x2257dd,{'autoCreate':_0x5b7c4d}),'contact':_0x355871===undefined?{}:_0x355871,'contacts':_0x22d72f[_0xba79('0x1d')]===0x0?undefined:_0x22d72f});}});}; \ No newline at end of file +var _0x0bec=['map','routeId','calleridnum','firstName','fax','createdAt','scheduledAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','xmd-contactid','ListId','data3','split','phone'];(function(_0x22e6b4,_0x5db50d){var _0x4f154e=function(_0x13d151){while(--_0x13d151){_0x22e6b4['push'](_0x22e6b4['shift']());}};_0x4f154e(++_0x5db50d);}(_0x0bec,0x129));var _0xc0be=function(_0x36afb3,_0x35b756){_0x36afb3=_0x36afb3-0x0;var _0x24d39a=_0x0bec[_0x36afb3];return _0x24d39a;};'use strict';var _=require(_0xc0be('0x0'));var BPromise=require(_0xc0be('0x1'));var Redis=require('ioredis');var util=require(_0xc0be('0x2'));var config=require(_0xc0be('0x3'));var logger=require(_0xc0be('0x4'))(_0xc0be('0x5'));var cmContactRpc=require(_0xc0be('0x6'));config[_0xc0be('0x7')]=_[_0xc0be('0x8')](config[_0xc0be('0x7')],{'host':_0xc0be('0x9'),'port':0x18eb});var io=require(_0xc0be('0xa'))(new Redis(config[_0xc0be('0x7')]));function emit(_0x4e61be,_0x41df8a,_0x37a506,_0x4528f0,_0x22c09e){logger[_0xc0be('0xb')](_0xc0be('0xc'),_0x4e61be,_0x41df8a['id'],_0x37a506,_0x4528f0,JSON[_0xc0be('0xd')](_0x22c09e));io['to'](_0x37a506)[_0xc0be('0xe')](_0x4528f0,_0x22c09e);}exports['exec']=function(_0x4245ab,_0x2d30a4,_0x14e28e,_0x18014a){var _0x29215e,_0x423924;var _0x845cdb={};var _0x280586=Number(_0x14e28e['data1']);var _0x12de3a=_0x14e28e['data2']?Boolean(Number(_0x14e28e[_0xc0be('0xf')])):![];var _0x3f6604;if(_0x18014a[_0xc0be('0x10')]){_0x845cdb['id']=_0x18014a[_0xc0be('0x10')];}if(!_0x845cdb['id']){_0x845cdb[_0xc0be('0x11')]=_0x280586;_0x3f6604=_0x14e28e['data3']&&_0x14e28e[_0xc0be('0x12')]!=='0'?_0x14e28e[_0xc0be('0x12')][_0xc0be('0x13')](','):[_0xc0be('0x14')];_0x845cdb['$or']=_[_0xc0be('0x15')](_0x3f6604,function(_0x251a1c){var _0x142c05={};_0x142c05[_0x251a1c]=_0x18014a[_0xc0be('0x16')]?_0x18014a['destcalleridnum']:_0x18014a[_0xc0be('0x17')];return _0x142c05;});}var _0x52757e=['id',_0xc0be('0x18'),'lastName',_0xc0be('0x14'),'mobile',_0xc0be('0x19'),_0xc0be('0x11'),_0xc0be('0x1a'),_0xc0be('0x1b'),'updatedAt'];var _0x58d6a0=_['union'](_0x52757e,_0x3f6604);BPromise[_0xc0be('0x1c')]()[_0xc0be('0x1d')](cmContactRpc['getContacts']({'attributes':_0x58d6a0,'where':_0x845cdb}))[_0xc0be('0x1d')](function(_0x2484a1){_0x423924=_0x2484a1;if(!_[_0xc0be('0x1e')](_0x423924)){if(_0x423924[_0xc0be('0x1f')]===0x1){_0x29215e=_0x423924[0x0];logger[_0xc0be('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x18014a['uniqueid'],_0x2d30a4['id'],_0x29215e['id']);}else{logger['info'](_0xc0be('0x20'),_0x18014a[_0xc0be('0x21')],_0x2d30a4['id'],_['map'](_0x423924,'id')[_0xc0be('0x22')](','));}return;}else{logger['info'](_0xc0be('0x23'),_0x18014a[_0xc0be('0x21')],_0x2d30a4['id']);var _0x538135={'ListId':_0x280586};var _0x12173c=_0x14e28e[_0xc0be('0x24')]&&_0x14e28e[_0xc0be('0x24')]!=='0'?_0x14e28e[_0xc0be('0x24')]:_0xc0be('0x14');if(_0x12de3a){logger[_0xc0be('0xb')](_0xc0be('0x25'),_0x18014a['uniqueid'],_0x2d30a4['id']);_0x538135[_0x12173c]=_[_0xc0be('0x26')](_0x18014a[_0xc0be('0x16')])?_0x18014a[_0xc0be('0x17')]:_0x18014a[_0xc0be('0x27')];if(_[_0xc0be('0x26')](_0x18014a[_0xc0be('0x16')])){_0x538135[_0xc0be('0x18')]=_0x18014a[_0xc0be('0x28')]&&_0x18014a[_0xc0be('0x28')]!==_0xc0be('0x29')?_0x18014a[_0xc0be('0x28')]:_0xc0be('0x2a');}else{_0x538135[_0xc0be('0x18')]=_0x18014a[_0xc0be('0x2b')]&&_0x18014a[_0xc0be('0x2b')]!==_0xc0be('0x29')?_0x18014a[_0xc0be('0x2b')]:_0xc0be('0x2a');}return BPromise[_0xc0be('0x1c')]()[_0xc0be('0x1d')](cmContactRpc[_0xc0be('0x2c')](_0x538135))[_0xc0be('0x1d')](function(_0x4ec7ac){_0x29215e=_0x4ec7ac;_0x423924[_0xc0be('0x2d')](_0x4ec7ac);if(_0x29215e){logger[_0xc0be('0xb')](_0xc0be('0x2e'),_0x18014a['uniqueid'],_0x2d30a4['id'],_0x29215e['id']);}return;});}else{logger[_0xc0be('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x18014a[_0xc0be('0x21')],_0x2d30a4['id']);_0x538135[_0x12173c]=_[_0xc0be('0x26')](_0x18014a[_0xc0be('0x16')])?_0x18014a[_0xc0be('0x17')]:_0x18014a[_0xc0be('0x27')];if(_[_0xc0be('0x26')](_0x18014a[_0xc0be('0x16')])){_0x538135[_0xc0be('0x18')]=_0x18014a[_0xc0be('0x28')]&&_0x18014a['calleridname']!==_0xc0be('0x29')?_0x18014a['calleridname']:'Unknown';}else{_0x538135['firstName']=_0x18014a[_0xc0be('0x2b')]&&_0x18014a[_0xc0be('0x2b')]!==_0xc0be('0x29')?_0x18014a[_0xc0be('0x2b')]:_0xc0be('0x2a');}_0x29215e=_0x538135;_0x423924[_0xc0be('0x2d')](_0x538135);return;}}})[_0xc0be('0x1d')](function(){if(_0x4245ab){emit(_0x18014a[_0xc0be('0x21')],_0x2d30a4,util[_0xc0be('0x2f')]('user:%s',_0x4245ab[_0xc0be('0x30')]),util[_0xc0be('0x2f')](_0xc0be('0x31'),_0x14e28e[_0xc0be('0x32')][_0xc0be('0x33')]()),{'evt':_[_0xc0be('0x34')](_0x18014a,{'autoCreate':_0x12de3a}),'contact':_0x29215e===undefined?{}:_0x29215e,'contacts':_0x423924[_0xc0be('0x1f')]===0x0?undefined:_0x423924});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 99ec30f..69f7dfe 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 _0x9b9b=['uri','buildUri','isNil','data3','data4','data5','800','data6','600','winapp','winApplication','render','winArguments','user:%s','name','trigger:%s:%s','data1','jscripty','format','exec','accounts','queue','routeId','script','parse','search','replace','length','AllConditions','checkConditions','channel','AnyConditions','some','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','lodash','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','checkTriggers','interface','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9b9b,0x114));var _0xb9b9=function(_0x13023b,_0x51328e){_0x13023b=_0x13023b-0x0;var _0x458326=_0x9b9b[_0x13023b];return _0x458326;};'use strict';var util=require('util');var _=require(_0xb9b9('0x0'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xb9b9('0x1'));var urlforward=require(_0xb9b9('0x2'));var integration=require(_0xb9b9('0x3'));var cmContact=require(_0xb9b9('0x4'));var script=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var logger=require(_0xb9b9('0x7'))(_0xb9b9('0x8'));var ami=require(_0xb9b9('0x9'));config[_0xb9b9('0xa')]=_[_0xb9b9('0xb')](config[_0xb9b9('0xa')],{'host':_0xb9b9('0xc'),'port':0x18eb});var io=require(_0xb9b9('0xd'))(new Redis(config[_0xb9b9('0xa')]));var operators={'equals':function(_0x319bb8,_0x485810){return _0x319bb8==_0x485810;},'not_equals':function(_0x4a645a,_0x2f6ff1){return _0x4a645a!=_0x2f6ff1;}};var barAndWebActions=[_0xb9b9('0xe'),_0xb9b9('0xf'),'winapp'];function Trigger(_0x3949d0){this[_0xb9b9('0x10')]=_0x3949d0[_0xb9b9('0x10')];this['agents']=_0x3949d0[_0xb9b9('0x11')];this[_0xb9b9('0x12')]=_0x3949d0[_0xb9b9('0x12')];this[_0xb9b9('0x13')]=_0x3949d0[_0xb9b9('0x13')];this[_0xb9b9('0x14')]=_0x3949d0['voiceExtensions'];this['zendeskAccounts']=_0x3949d0[_0xb9b9('0x15')];this['freshdeskAccounts']=_0x3949d0[_0xb9b9('0x16')];this['salesforceAccounts']=_0x3949d0[_0xb9b9('0x17')];this[_0xb9b9('0x18')]=_0x3949d0[_0xb9b9('0x18')];this[_0xb9b9('0x19')]=_0x3949d0[_0xb9b9('0x19')];this[_0xb9b9('0x1a')]=_0x3949d0[_0xb9b9('0x1a')];this[_0xb9b9('0x1b')]=_0x3949d0['vtigerAccounts'];this[_0xb9b9('0x1c')]=_0x3949d0['servicenowAccounts'];this[_0xb9b9('0x1d')]=_0x3949d0[_0xb9b9('0x1d')];this[_0xb9b9('0x1e')]=_0x3949d0[_0xb9b9('0x1e')];this['accounts']={'zendesk':this[_0xb9b9('0x15')],'salesforce':this[_0xb9b9('0x17')],'freshdesk':this[_0xb9b9('0x16')],'sugarcrm':this[_0xb9b9('0x18')],'zoho':this[_0xb9b9('0x19')],'desk':this[_0xb9b9('0x1a')],'vtiger':this[_0xb9b9('0x1b')],'dynamics365':this[_0xb9b9('0x1d')],'freshsales':this[_0xb9b9('0x1e')],'servicenow':this[_0xb9b9('0x1c')]};ami['on'](_0xb9b9('0x1f'),this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on']('custom:agentconnect',this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x22'),this['syncCustomEvent'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x23'),this['syncCustomEvent'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x24'),this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0xb9b9('0x26'),this[_0xb9b9('0x20')]['bind'](this));ami['on'](_0xb9b9('0x27'),this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x28'),this[_0xb9b9('0x20')]['bind'](this));ami['on'](_0xb9b9('0x29'),this['syncCustomEvent'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x2a'),this['syncCustomEvent'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x2b'),this[_0xb9b9('0x2c')]['bind'](this));ami['on'](_0xb9b9('0x2d'),this[_0xb9b9('0x2c')][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x2e'),this['syncAgentDial'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x2f'),this['syncCustomEvent'][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x30'),this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on']('custom:incomingmessage',this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));ami['on'](_0xb9b9('0x31'),this[_0xb9b9('0x20')]['bind'](this));ami['on'](_0xb9b9('0x32'),this[_0xb9b9('0x20')]['bind'](this));ami['on'](_0xb9b9('0x33'),this[_0xb9b9('0x20')][_0xb9b9('0x21')](this));}Trigger[_0xb9b9('0x34')][_0xb9b9('0x35')]=function(_0x17f3c3,_0x5e10c9,_0x2c5d2d){logger[_0xb9b9('0x36')](_0x17f3c3,_0x5e10c9,JSON['stringify'](_0x2c5d2d));io['to'](_0x17f3c3)[_0xb9b9('0x35')](_0x5e10c9,_0x2c5d2d);};Trigger[_0xb9b9('0x34')][_0xb9b9('0x20')]=function(_0x5837c0){var _0x317063=_['clone'](_0x5837c0);this[_0xb9b9('0x37')](_0x317063);};Trigger['prototype'][_0xb9b9('0x2c')]=function(_0x1a8237){if(this[_0xb9b9('0x11')][_0x1a8237[_0xb9b9('0x38')]]){this[_0xb9b9('0x20')](_0x1a8237);}};Trigger[_0xb9b9('0x34')][_0xb9b9('0x37')]=function(_0x4960e1){var _0x57396a;for(var _0xb54d68 in this[_0xb9b9('0x10')]){if(this[_0xb9b9('0x10')]['hasOwnProperty'](_0xb54d68)){if(this[_0xb9b9('0x10')][_0xb54d68]['status']){_0x57396a=this[_0xb9b9('0x39')](this[_0xb9b9('0x10')][_0xb54d68],_0x4960e1);if(_0x57396a){_[_0xb9b9('0x3a')](_0x4960e1,_0x4960e1[_0xb9b9('0x3b')]);for(var _0x46abe7=0x0,_0x1d3a53,_0x15baa2,_0x1eb1b4;_0x46abe70x0){_0x12749f=_[_0xc3f4('0x26')](_0x1399be,_0x3afe06);}return _0x12749f;}function getCustomFields(_0x29fb15,_0x281d3f){var _0x132244=[];var _0x47ca3f={'custom_fields':{}};if(_0x29fb15[_0xc3f4('0x25')]>0x0){_[_0xc3f4('0x27')](_0x29fb15,function(_0x4d707a){if(_[_0xc3f4('0x28')](['string',_0xc3f4('0x29')],_0x4d707a[_0xc3f4('0x2a')])&&_0x4d707a[_0xc3f4('0x2b')]&&!_0x4d707a[_0xc3f4('0x2c')]){_0x47ca3f[_0x4d707a[_0xc3f4('0x2b')]['toLowerCase']()]=_0x4d707a[_0xc3f4('0x2d')][_0xc3f4('0x1f')]();}else if(_[_0xc3f4('0x28')]([_0xc3f4('0x2e'),_0xc3f4('0x29')],_0x4d707a[_0xc3f4('0x2a')])&&_0x4d707a[_0xc3f4('0x2f')]&&_0x4d707a[_0xc3f4('0x2c')]){_0x47ca3f['custom_fields'][_0x4d707a[_0xc3f4('0x2f')]]=_0x4d707a['content']['toString']();}else if(_0x4d707a[_0xc3f4('0x2a')]===_0xc3f4('0x30')&&_0x4d707a[_0xc3f4('0x31')]&&_0x4d707a[_0xc3f4('0x2f')]&&_0x4d707a[_0xc3f4('0x2c')]){_0x281d3f[_0x4d707a['variableName']]&&(_0x47ca3f['custom_fields'][_0x4d707a[_0xc3f4('0x2f')]]=_0x281d3f[_0x4d707a[_0xc3f4('0x31')]]['toString']());}else if(_0x4d707a[_0xc3f4('0x2a')]===_0xc3f4('0x32')&&_0x4d707a[_0xc3f4('0x33')]&&_0x4d707a[_0xc3f4('0x33')][_0xc3f4('0x34')]&&_0x4d707a[_0xc3f4('0x2f')]&&_0x4d707a[_0xc3f4('0x2c')]){_0x281d3f[_0x4d707a[_0xc3f4('0x33')][_0xc3f4('0x34')][_0xc3f4('0x35')]()]&&(_0x47ca3f[_0xc3f4('0x36')][_0x4d707a['idField']]=_0x281d3f[_0x4d707a[_0xc3f4('0x33')][_0xc3f4('0x34')][_0xc3f4('0x35')]()][_0xc3f4('0x1f')]());}});}if(_0x47ca3f[_0xc3f4('0x37')]){_0x47ca3f[_0xc3f4('0x37')]=Number(_0x47ca3f[_0xc3f4('0x37')]);}return _0x47ca3f;}function getTicket(_0x33b8d7,_0x4c6211,_0x16cd5c,_0x59d929,_0x5ab26c){logger[_0xc3f4('0x13')]('Creating\x20new\x20ticket...');var _0x29da6f=_['merge']({'subject':intUtil[_0xc3f4('0x38')](_0x59d929['Subjects'],_0x5ab26c,'\x20'),'type':'phone','status':_0xc3f4('0x39'),'labels':['xCALLY','Motion','CTI']['concat'](getTags(_0x59d929[_0xc3f4('0x3a')],_0xc3f4('0x34'))),'description':intUtil[_0xc3f4('0x38')](_0x59d929[_0xc3f4('0x3b')],_0x5ab26c,'\x0a'),'_links':{'assigned_user':{'href':util[_0xc3f4('0xc')]('/api/v2/users/%d',_0x4c6211['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xc3f4('0x38')](_0x59d929[_0xc3f4('0x3b')],_0x5ab26c,'\x0a')}},getCustomFields(_0x59d929['Fields'],_0x5ab26c));return request({'uri':util[_0xc3f4('0xc')](_0xc3f4('0x3c'),_0x33b8d7[_0xc3f4('0xd')],_0x16cd5c['id']),'method':'POST','body':_0x29da6f});}exports[_0xc3f4('0x3d')]=function(_0x9a6c52,_0x553e2a,_0x2d96d0,_0x469841,_0x4ad579,_0x2fb208){var _0x41a35a,_0x5d0a9b;_0x2fb208[_0xc3f4('0xd')]=intUtil['stripTrailingSlash'](_0x2fb208[_0xc3f4('0xd')]);_0x2fb208[_0xc3f4('0x3e')]=intUtil['stripTrailingSlash'](_0x2fb208[_0xc3f4('0x3e')]);if(_0x4ad579&&_0x4ad579['monitor_format']){logger[_0xc3f4('0x13')]('[QUEUE]',_0xc3f4('0x3f'));_0x553e2a['recordingURL']=util[_0xc3f4('0xc')](_0xc3f4('0x40'),_0x2fb208['serverUrl'],_0x553e2a[_0xc3f4('0x41')],md5(_0x553e2a['uniqueid']));}else{_0x553e2a[_0xc3f4('0x42')]='';}headers['Authorization']=getAuth(_0x2fb208);return getUser(_0x2fb208,_0x469841['email'])['then'](function(_0x592245){_0x41a35a=_0x592245;logger[_0xc3f4('0x13')](_0xc3f4('0x43'),_0x41a35a['id']);return getEndUser(_0x2fb208,_0x553e2a['calleridname'],_0x553e2a['calleridnum']);})['then'](function(_0x433d24){_0x5d0a9b=_0x433d24;logger[_0xc3f4('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5d0a9b['id']);return getTicket(_0x2fb208,_0x41a35a,_0x5d0a9b,_0x2d96d0,_0x553e2a);})[_0xc3f4('0xe')](function(_0x58aa22){if(_0x58aa22){logger['info'](_0xc3f4('0x44'));logger[_0xc3f4('0x13')](_0xc3f4('0x45'),_0x58aa22['id']);switch(_0x2fb208[_0xc3f4('0x2a')]){case _0xc3f4('0x46'):logger[_0xc3f4('0x13')]('[QUEUE]',_0xc3f4('0x47'));emit(util[_0xc3f4('0xc')](_0xc3f4('0x48'),_0x469841[_0xc3f4('0x34')]),_0xc3f4('0x49'),{'recordId':_0x58aa22['id']});break;case _0xc3f4('0x4a'):logger['info'](_0xc3f4('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3f4('0xc')](_0xc3f4('0x48'),_0x469841[_0xc3f4('0x34')]),_0xc3f4('0x4c'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x58aa22['id'])});break;default:logger[_0xc3f4('0x4d')](_0xc3f4('0x4b'),_0xc3f4('0x4e'));}}})[_0xc3f4('0x4f')](function(_0x327e5a){console[_0xc3f4('0x4d')](_0x327e5a);logger['error'](_0xc3f4('0x4b'),JSON[_0xc3f4('0x19')](_0x327e5a));});};exports[_0xc3f4('0x50')]=function(_0x1802fb,_0x2b0e13,_0x1b3e78,_0x4b6080,_0x527ddb,_0x1d30ad,_0x331f65){var _0x4ec3ba,_0x3dce83;_0x1d30ad[_0xc3f4('0xd')]=intUtil['stripTrailingSlash'](_0x1d30ad[_0xc3f4('0xd')]);_0x1d30ad['serverUrl']=intUtil[_0xc3f4('0x51')](_0x1d30ad[_0xc3f4('0x3e')]);if(_0x331f65&&_0x331f65[_0xc3f4('0x52')]&&_0x331f65[_0xc3f4('0x52')]!==_0xc3f4('0x53')){logger[_0xc3f4('0x13')]('[OUTBOUND]',_0xc3f4('0x3f'));_0x2b0e13[_0xc3f4('0x42')]=util[_0xc3f4('0xc')](_0xc3f4('0x40'),_0x1d30ad[_0xc3f4('0x3e')],_0x2b0e13[_0xc3f4('0x41')],md5(_0x2b0e13['uniqueid']));}headers[_0xc3f4('0x54')]=getAuth(_0x1d30ad);return getUser(_0x1d30ad,_0x4b6080['email'])['then'](function(_0x359c6d){_0x4ec3ba=_0x359c6d;logger['info'](_0xc3f4('0x43'),_0x4ec3ba['id']);return getEndUser(_0x1d30ad,_0x2b0e13[_0xc3f4('0x55')],_0x2b0e13[_0xc3f4('0x56')]);})['then'](function(_0x59ff7d){_0x3dce83=_0x59ff7d;logger[_0xc3f4('0x13')]('The\x20Enduser\x20ID\x20is:',_0x3dce83['id']);return getTicket(_0x1d30ad,_0x4ec3ba,_0x3dce83,_0x1b3e78,_0x2b0e13);})[_0xc3f4('0xe')](function(_0x457005){if(_0x457005){logger['info']('Ticket\x20created!');logger[_0xc3f4('0x13')]('The\x20Ticket\x20ID\x20is:',_0x457005['id']);switch(_0x1d30ad['type']){case _0xc3f4('0x46'):logger[_0xc3f4('0x13')]('[QUEUE]',_0xc3f4('0x47'));emit(util[_0xc3f4('0xc')](_0xc3f4('0x48'),_0x4b6080[_0xc3f4('0x34')]),_0xc3f4('0x49'),{'recordId':_0x457005['id']});break;case _0xc3f4('0x4a'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc3f4('0x48'),_0x4b6080['name']),'trigger:browser:url',{'uri':util[_0xc3f4('0xc')](_0xc3f4('0x57'),_0x1d30ad[_0xc3f4('0xd')],_0x457005['id'])});break;default:logger[_0xc3f4('0x4d')](_0xc3f4('0x58'),_0xc3f4('0x4e'));}}})[_0xc3f4('0x4f')](function(_0x589647){logger['error'](_0xc3f4('0x58'),JSON['stringify'](_0x589647));});};exports[_0xc3f4('0x59')]=function(_0x38f7cc,_0x3f5599,_0x1d95be,_0x1bd6de,_0x2018c3,_0x2a5a72){var _0x530a06,_0x4efdeb;_0x2a5a72[_0xc3f4('0xd')]=intUtil[_0xc3f4('0x51')](_0x2a5a72[_0xc3f4('0xd')]);_0x2a5a72[_0xc3f4('0x3e')]=intUtil[_0xc3f4('0x51')](_0x2a5a72[_0xc3f4('0x3e')]);if(_0x2018c3&&_0x2018c3['monitor_format']){logger['info']('['+_0x3f5599[_0xc3f4('0x5a')][_0xc3f4('0x5b')]()+']',_0xc3f4('0x3f'));_0x3f5599[_0xc3f4('0x42')]=util[_0xc3f4('0xc')](_0xc3f4('0x40'),_0x2a5a72[_0xc3f4('0x3e')],_0x3f5599[_0xc3f4('0x41')],md5(_0x3f5599[_0xc3f4('0x41')]));}else{_0x3f5599[_0xc3f4('0x42')]='';}headers['Authorization']=getAuth(_0x2a5a72);return getUser(_0x2a5a72)[_0xc3f4('0xe')](function(_0x519d5b){_0x530a06=_0x519d5b;logger[_0xc3f4('0x13')](_0xc3f4('0x43'),_0x530a06['id']);return getEndUser(_0x2a5a72,_0x3f5599['calleridname'],_0x3f5599[_0xc3f4('0x5c')]);})['then'](function(_0x15f9b0){_0x4efdeb=_0x15f9b0;logger[_0xc3f4('0x13')](_0xc3f4('0x5d'),_0x4efdeb['id']);return getTicket(_0x2a5a72,_0x530a06,_0x4efdeb,_0x1d95be,_0x3f5599);})[_0xc3f4('0xe')](function(_0x2294a3){if(_0x2294a3){logger[_0xc3f4('0x13')](_0xc3f4('0x44'));logger[_0xc3f4('0x13')]('The\x20Ticket\x20ID\x20is:',_0x2294a3['id']);}})[_0xc3f4('0x4f')](function(_0x8a6e27){logger['error']('['+_0x3f5599[_0xc3f4('0x5a')][_0xc3f4('0x5b')]()+']',JSON[_0xc3f4('0x19')](_0x8a6e27));});}; \ No newline at end of file +var _0xb1cb=['username','token','Basic\x20%s','base64','%s/customers/search','total_entries','Enduser\x20found!','%s/customers','POST','length','map','includes','string','picklist','nameField','customField','content','toString','type','idField','custom_fields','variable','variableName','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','Motion','CTI','Tags','/api/v2/users/%d','Descriptions','Fields','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','lodash','request-promise','md5','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','find','_embedded','entries','then','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','basic','%s:%s','password','%s/token:%s'];(function(_0x45352d,_0x1c79f1){var _0xda7a70=function(_0x116cbe){while(--_0x116cbe){_0x45352d['push'](_0x45352d['shift']());}};_0xda7a70(++_0x1c79f1);}(_0xb1cb,0x1e5));var _0xbb1c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb1cb[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xbb1c('0x0'));var rp=require(_0xbb1c('0x1'));var md5=require(_0xbb1c('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbb1c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbb1c('0x4'))('desk');config[_0xbb1c('0x5')]=_[_0xbb1c('0x6')](config['redis'],{'host':_0xbb1c('0x7'),'port':0x18eb});var io=require(_0xbb1c('0x8'))(new Redis(config[_0xbb1c('0x5')]));function emit(_0x43359e,_0x9416a3,_0x5cf8ac){io['to'](_0x43359e)[_0xbb1c('0x9')](_0x9416a3,_0x5cf8ac);}var headers={'Content-Type':_0xbb1c('0xa'),'Accept':_0xbb1c('0xa')};function getUser(_0x793de,_0x1a3686){if(intUtil[_0xbb1c('0xb')](_0x1a3686)===!![]){logger[_0xbb1c('0xc')](_0xbb1c('0xd'),_0x1a3686);return request({'uri':util[_0xbb1c('0xe')](_0xbb1c('0xf'),_0x793de[_0xbb1c('0x10')])})['then'](function(_0xcdb042){if(_0xcdb042['total_entries']){return _[_0xbb1c('0x11')](_0xcdb042[_0xbb1c('0x12')][_0xbb1c('0x13')],{'email':_0x1a3686});}})[_0xbb1c('0x14')](function(_0x57f413){if(_0x57f413){logger[_0xbb1c('0xc')]('Agent\x20found!');return _0x57f413;}else{logger[_0xbb1c('0xc')](_0xbb1c('0x15'));return request({'uri':util[_0xbb1c('0xe')](_0xbb1c('0x16'),_0x793de[_0xbb1c('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xbb1c('0xe')](_0xbb1c('0x16'),_0x793de[_0xbb1c('0x10')])});}}function request(_0x36c948){logger[_0xbb1c('0x17')]('[HTTP]',JSON[_0xbb1c('0x18')](_0x36c948));return rp(_[_0xbb1c('0x6')](_0x36c948,{'method':_0xbb1c('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x523790){var _0xcfee86;if(_0x523790['authType']===_0xbb1c('0x1a')){_0xcfee86=util[_0xbb1c('0xe')](_0xbb1c('0x1b'),_0x523790['username'],_0x523790[_0xbb1c('0x1c')]);}else if(_0x523790['authType']==='token'){_0xcfee86=util[_0xbb1c('0xe')](_0xbb1c('0x1d'),_0x523790[_0xbb1c('0x1e')],_0x523790[_0xbb1c('0x1f')]);}return util[_0xbb1c('0xe')](_0xbb1c('0x20'),new Buffer(_0xcfee86)['toString'](_0xbb1c('0x21')));}function getEndUser(_0x11e176,_0x4d2439,_0x50ca92){logger['info']('Searching\x20enduser\x20with\x20phone',_0x50ca92);return request({'uri':util[_0xbb1c('0xe')](_0xbb1c('0x22'),_0x11e176[_0xbb1c('0x10')]),'qs':{'phone':_0x50ca92}})[_0xbb1c('0x14')](function(_0x5cc639){if(_0x5cc639[_0xbb1c('0x23')]){logger[_0xbb1c('0xc')](_0xbb1c('0x24'));return _0x5cc639[_0xbb1c('0x12')][_0xbb1c('0x13')][0x0];}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbb1c('0xe')](_0xbb1c('0x25'),_0x11e176[_0xbb1c('0x10')]),'method':_0xbb1c('0x26'),'body':{'first_name':_0x4d2439,'title':_0x4d2439,'phone_numbers':[{'type':'work','value':_0x50ca92}]}});}});}function getTags(_0x1b9e34,_0x548ef4){var _0x5c393d=[];if(_0x1b9e34&&_0x1b9e34[_0xbb1c('0x27')]>0x0){_0x5c393d=_[_0xbb1c('0x28')](_0x1b9e34,_0x548ef4);}return _0x5c393d;}function getCustomFields(_0x5e2b70,_0x32e282){var _0x50bd7c=[];var _0x3fd38b={'custom_fields':{}};if(_0x5e2b70[_0xbb1c('0x27')]>0x0){_['forEach'](_0x5e2b70,function(_0xb7f60d){if(_[_0xbb1c('0x29')]([_0xbb1c('0x2a'),_0xbb1c('0x2b')],_0xb7f60d['type'])&&_0xb7f60d[_0xbb1c('0x2c')]&&!_0xb7f60d[_0xbb1c('0x2d')]){_0x3fd38b[_0xb7f60d['nameField']['toLowerCase']()]=_0xb7f60d[_0xbb1c('0x2e')][_0xbb1c('0x2f')]();}else if(_[_0xbb1c('0x29')](['string',_0xbb1c('0x2b')],_0xb7f60d[_0xbb1c('0x30')])&&_0xb7f60d[_0xbb1c('0x31')]&&_0xb7f60d['customField']){_0x3fd38b[_0xbb1c('0x32')][_0xb7f60d[_0xbb1c('0x31')]]=_0xb7f60d[_0xbb1c('0x2e')][_0xbb1c('0x2f')]();}else if(_0xb7f60d[_0xbb1c('0x30')]===_0xbb1c('0x33')&&_0xb7f60d[_0xbb1c('0x34')]&&_0xb7f60d[_0xbb1c('0x31')]&&_0xb7f60d[_0xbb1c('0x2d')]){_0x32e282[_0xb7f60d['variableName']]&&(_0x3fd38b[_0xbb1c('0x32')][_0xb7f60d[_0xbb1c('0x31')]]=_0x32e282[_0xb7f60d[_0xbb1c('0x34')]][_0xbb1c('0x2f')]());}else if(_0xb7f60d[_0xbb1c('0x30')]==='customVariable'&&_0xb7f60d['Variable']&&_0xb7f60d[_0xbb1c('0x35')][_0xbb1c('0x36')]&&_0xb7f60d[_0xbb1c('0x31')]&&_0xb7f60d[_0xbb1c('0x2d')]){_0x32e282[_0xb7f60d[_0xbb1c('0x35')]['name']['toLowerCase']()]&&(_0x3fd38b[_0xbb1c('0x32')][_0xb7f60d[_0xbb1c('0x31')]]=_0x32e282[_0xb7f60d[_0xbb1c('0x35')][_0xbb1c('0x36')]['toLowerCase']()][_0xbb1c('0x2f')]());}});}if(_0x3fd38b[_0xbb1c('0x37')]){_0x3fd38b[_0xbb1c('0x37')]=Number(_0x3fd38b['priority']);}return _0x3fd38b;}function getTicket(_0x5e15de,_0x53344f,_0x2b92dc,_0x2fd9a4,_0x912751){logger[_0xbb1c('0xc')](_0xbb1c('0x38'));var _0x591788=_[_0xbb1c('0x39')]({'subject':intUtil[_0xbb1c('0x3a')](_0x2fd9a4[_0xbb1c('0x3b')],_0x912751,'\x20'),'type':_0xbb1c('0x3c'),'status':'new','labels':['xCALLY',_0xbb1c('0x3d'),_0xbb1c('0x3e')]['concat'](getTags(_0x2fd9a4[_0xbb1c('0x3f')],_0xbb1c('0x36'))),'description':intUtil[_0xbb1c('0x3a')](_0x2fd9a4['Descriptions'],_0x912751,'\x0a'),'_links':{'assigned_user':{'href':util[_0xbb1c('0xe')](_0xbb1c('0x40'),_0x53344f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x2fd9a4[_0xbb1c('0x41')],_0x912751,'\x0a')}},getCustomFields(_0x2fd9a4[_0xbb1c('0x42')],_0x912751));return request({'uri':util[_0xbb1c('0xe')]('%s/customers/%d/cases',_0x5e15de['remoteUri'],_0x2b92dc['id']),'method':_0xbb1c('0x26'),'body':_0x591788});}exports[_0xbb1c('0x43')]=function(_0x11b5d0,_0x3979f0,_0x21218f,_0x49545c,_0x6d7eb7,_0x36e801){var _0x149210,_0x52d8c9;_0x36e801[_0xbb1c('0x10')]=intUtil['stripTrailingSlash'](_0x36e801[_0xbb1c('0x10')]);_0x36e801['serverUrl']=intUtil[_0xbb1c('0x44')](_0x36e801[_0xbb1c('0x45')]);if(_0x6d7eb7&&_0x6d7eb7[_0xbb1c('0x46')]){logger[_0xbb1c('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3979f0['recordingURL']=util[_0xbb1c('0xe')](_0xbb1c('0x47'),_0x36e801[_0xbb1c('0x45')],_0x3979f0[_0xbb1c('0x48')],md5(_0x3979f0[_0xbb1c('0x48')]));}else{_0x3979f0[_0xbb1c('0x49')]='';}headers[_0xbb1c('0x4a')]=getAuth(_0x36e801);return getUser(_0x36e801,_0x49545c[_0xbb1c('0x4b')])[_0xbb1c('0x14')](function(_0x1db647){_0x149210=_0x1db647;logger[_0xbb1c('0xc')](_0xbb1c('0x4c'),_0x149210['id']);return getEndUser(_0x36e801,_0x3979f0[_0xbb1c('0x4d')],_0x3979f0[_0xbb1c('0x4e')]);})['then'](function(_0x4e6b71){_0x52d8c9=_0x4e6b71;logger[_0xbb1c('0xc')](_0xbb1c('0x4f'),_0x52d8c9['id']);return getTicket(_0x36e801,_0x149210,_0x52d8c9,_0x21218f,_0x3979f0);})[_0xbb1c('0x14')](function(_0x5bdd39){if(_0x5bdd39){logger[_0xbb1c('0xc')]('Ticket\x20created!');logger[_0xbb1c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5bdd39['id']);switch(_0x36e801[_0xbb1c('0x30')]){case _0xbb1c('0x50'):logger[_0xbb1c('0xc')](_0xbb1c('0x51'),_0xbb1c('0x52'));emit(util[_0xbb1c('0xe')]('user:%s',_0x49545c['name']),_0xbb1c('0x53'),{'recordId':_0x5bdd39['id']});break;case _0xbb1c('0x54'):logger[_0xbb1c('0xc')](_0xbb1c('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbb1c('0xe')]('user:%s',_0x49545c[_0xbb1c('0x36')]),_0xbb1c('0x55'),{'uri':util[_0xbb1c('0xe')](_0xbb1c('0x56'),_0x5bdd39['id'])});break;default:logger[_0xbb1c('0x57')](_0xbb1c('0x51'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xbb1c('0x58')](function(_0x1ead63){console[_0xbb1c('0x57')](_0x1ead63);logger['error'](_0xbb1c('0x51'),JSON['stringify'](_0x1ead63));});};exports[_0xbb1c('0x59')]=function(_0x3f32cd,_0x176051,_0x393142,_0x3448b5,_0x4d813c,_0x52e93e,_0x57a696){var _0x433da8,_0x2df8df;_0x52e93e[_0xbb1c('0x10')]=intUtil['stripTrailingSlash'](_0x52e93e[_0xbb1c('0x10')]);_0x52e93e[_0xbb1c('0x45')]=intUtil['stripTrailingSlash'](_0x52e93e[_0xbb1c('0x45')]);if(_0x57a696&&_0x57a696[_0xbb1c('0x5a')]&&_0x57a696[_0xbb1c('0x5a')]!=='none'){logger[_0xbb1c('0xc')](_0xbb1c('0x5b'),_0xbb1c('0x5c'));_0x176051[_0xbb1c('0x49')]=util['format'](_0xbb1c('0x47'),_0x52e93e[_0xbb1c('0x45')],_0x176051['uniqueid'],md5(_0x176051[_0xbb1c('0x48')]));}headers[_0xbb1c('0x4a')]=getAuth(_0x52e93e);return getUser(_0x52e93e,_0x3448b5['email'])[_0xbb1c('0x14')](function(_0x53cb81){_0x433da8=_0x53cb81;logger[_0xbb1c('0xc')](_0xbb1c('0x4c'),_0x433da8['id']);return getEndUser(_0x52e93e,_0x176051[_0xbb1c('0x5d')],_0x176051[_0xbb1c('0x5e')]);})[_0xbb1c('0x14')](function(_0x4ed826){_0x2df8df=_0x4ed826;logger[_0xbb1c('0xc')](_0xbb1c('0x4f'),_0x2df8df['id']);return getTicket(_0x52e93e,_0x433da8,_0x2df8df,_0x393142,_0x176051);})[_0xbb1c('0x14')](function(_0x3a89e9){if(_0x3a89e9){logger[_0xbb1c('0xc')](_0xbb1c('0x5f'));logger[_0xbb1c('0xc')](_0xbb1c('0x60'),_0x3a89e9['id']);switch(_0x52e93e[_0xbb1c('0x30')]){case _0xbb1c('0x50'):logger[_0xbb1c('0xc')](_0xbb1c('0x51'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xbb1c('0xe')](_0xbb1c('0x61'),_0x3448b5[_0xbb1c('0x36')]),'trigger:desk:display',{'recordId':_0x3a89e9['id']});break;case _0xbb1c('0x54'):logger[_0xbb1c('0xc')](_0xbb1c('0x51'),_0xbb1c('0x62'));emit(util[_0xbb1c('0xe')](_0xbb1c('0x61'),_0x3448b5[_0xbb1c('0x36')]),_0xbb1c('0x55'),{'uri':util[_0xbb1c('0xe')](_0xbb1c('0x63'),_0x52e93e['remoteUri'],_0x3a89e9['id'])});break;default:logger[_0xbb1c('0x57')](_0xbb1c('0x5b'),_0xbb1c('0x64'));}}})['catch'](function(_0xd8ed81){logger[_0xbb1c('0x57')](_0xbb1c('0x5b'),JSON[_0xbb1c('0x18')](_0xd8ed81));});};exports['unmanaged']=function(_0x4f46b4,_0x1c3445,_0xbd27d2,_0x4f8602,_0x5d5690,_0x5d4401){var _0x59bfaf,_0x164ce0;_0x5d4401[_0xbb1c('0x10')]=intUtil['stripTrailingSlash'](_0x5d4401[_0xbb1c('0x10')]);_0x5d4401[_0xbb1c('0x45')]=intUtil[_0xbb1c('0x44')](_0x5d4401[_0xbb1c('0x45')]);if(_0x5d5690&&_0x5d5690['monitor_format']){logger['info']('['+_0x1c3445[_0xbb1c('0x65')][_0xbb1c('0x66')]()+']','Recording\x20is\x20enabled!');_0x1c3445['recordingURL']=util['format'](_0xbb1c('0x47'),_0x5d4401[_0xbb1c('0x45')],_0x1c3445['uniqueid'],md5(_0x1c3445[_0xbb1c('0x48')]));}else{_0x1c3445[_0xbb1c('0x49')]='';}headers[_0xbb1c('0x4a')]=getAuth(_0x5d4401);return getUser(_0x5d4401)[_0xbb1c('0x14')](function(_0x267219){_0x59bfaf=_0x267219;logger['info']('The\x20User\x20ID\x20is:',_0x59bfaf['id']);return getEndUser(_0x5d4401,_0x1c3445[_0xbb1c('0x4d')],_0x1c3445['calleridnum']);})[_0xbb1c('0x14')](function(_0x33098a){_0x164ce0=_0x33098a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x164ce0['id']);return getTicket(_0x5d4401,_0x59bfaf,_0x164ce0,_0xbd27d2,_0x1c3445);})[_0xbb1c('0x14')](function(_0x3ab9ec){if(_0x3ab9ec){logger[_0xbb1c('0xc')]('Ticket\x20created!');logger[_0xbb1c('0xc')](_0xbb1c('0x60'),_0x3ab9ec['id']);}})[_0xbb1c('0x58')](function(_0x49dad9){logger[_0xbb1c('0x57')]('['+_0x1c3445['lastevent'][_0xbb1c('0x66')]()+']',JSON[_0xbb1c('0x18')](_0x49dad9));});}; \ 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 7d30a7a..d12bc03 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 _0x6931=['ticketType','incidents','assign','Subjects','Descriptions','/contacts(','/systemusers(','4.0','phonecall','phonecalls','getString','callDirection','queue','format','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\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','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','Bearer\x20','headers','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','nameField','customField','idField','content'];(function(_0x565a47,_0x496056){var _0x12ce49=function(_0x58f994){while(--_0x58f994){_0x565a47['push'](_0x565a47['shift']());}};_0x12ce49(++_0x496056);}(_0x6931,0x1a9));var _0x1693=function(_0x1df5ab,_0xb5c89e){_0x1df5ab=_0x1df5ab-0x0;var _0x598040=_0x6931[_0x1df5ab];return _0x598040;};'use strict';var _=require(_0x1693('0x0'));var BPromise=require(_0x1693('0x1'));var rp=require(_0x1693('0x2'));var util=require(_0x1693('0x3'));var intUtil=require(_0x1693('0x4'));var md5=require(_0x1693('0x5'));var Redis=require(_0x1693('0x6'));var logger=require(_0x1693('0x7'))('dynamics365');var config=require(_0x1693('0x8'));config[_0x1693('0x9')]=_[_0x1693('0xa')](config[_0x1693('0x9')],{'host':_0x1693('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1693('0x9')]));function getAuthToken(_0x2ec499,_0x18e32e,_0x579434){var _0xc66466={'method':_0x1693('0xc'),'uri':_0x18e32e,'form':{'client_id':_0x2ec499[_0x1693('0xd')],'resource':_0x2ec499[_0x1693('0xe')],'username':_0x2ec499[_0x1693('0xf')],'password':_0x2ec499[_0x1693('0x10')],'grant_type':_0x1693('0x10'),'client_secret':_0x2ec499[_0x1693('0x11')]},'json':!![]};return rp(_0xc66466)[_0x1693('0x12')](function(_0x362403){return _0x362403[_0x1693('0x13')];})['catch'](function(_0x24f22f){logger[_0x1693('0x14')]('['+[_0x579434[_0x1693('0x15')]()]+_0x1693('0x16'));return _0x24f22f[_0x1693('0x17')];});}function getUser(_0x50e17b,_0x4744ed,_0x5cede5,_0x31caad,_0x50f042,_0x367f9d){return new BPromise(function(_0x52745a,_0x6704d4){return getAuthToken(_0x4744ed,_0x31caad,_0x367f9d)[_0x1693('0x12')](function(_0x4db220){var _0x5a4fb3={'method':_0x1693('0x18'),'uri':_0x50f042+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x4db220,'OData-Version':'4.0'},'json':!![]};return rp(_0x5a4fb3);})[_0x1693('0x12')](function(_0x4b8bb2){var _0x49e7fb=_0x4b8bb2[_0x1693('0x19')];var _0x1a270b=![];var _0x7ef2=null;if(!_[_0x1693('0x1a')](_0x5cede5)){if(intUtil[_0x1693('0x1b')](_0x5cede5[_0x1693('0x1c')])){_0x50e17b['userEmail']=_0x5cede5['email'];for(_0x7ef2=0x0;_0x7ef2<_0x49e7fb[_0x1693('0x1d')];_0x7ef2++){if(_0x49e7fb[_0x7ef2][_0x1693('0x1e')]===_0x5cede5['email']&&!_0x49e7fb[_0x7ef2][_0x1693('0x1f')]){_0x1a270b=!![];logger[_0x1693('0x20')]('['+[_0x367f9d[_0x1693('0x15')]()]+_0x1693('0x21')+_0x49e7fb[_0x7ef2][_0x1693('0x22')]+'!');_0x50e17b['userId']=_0x49e7fb[_0x7ef2][_0x1693('0x22')];}}}}if(!_0x1a270b){logger[_0x1693('0x20')]('['+[_0x367f9d[_0x1693('0x15')]()]+_0x1693('0x23'));_0x50e17b[_0x1693('0x24')]=_0x4744ed[_0x1693('0xf')];for(_0x7ef2=0x0;_0x7ef2<_0x49e7fb['length'];_0x7ef2++){if(_0x49e7fb[_0x7ef2][_0x1693('0x1e')]===_0x4744ed['username']){_0x50e17b[_0x1693('0x25')]=_0x49e7fb[_0x7ef2][_0x1693('0x22')];}}}_0x52745a(_0x50e17b);})[_0x1693('0x26')](function(_0x56bc00){_0x6704d4(_0x56bc00[_0x1693('0x17')]);});});}function createEndUser(_0x341a72,_0x43cfb6,_0x4142e7,_0x4612e0,_0x459c39,_0x404bf1){return new BPromise(function(_0x47cfb4,_0x2d0806){return getAuthToken(_0x43cfb6,_0x4142e7,_0x404bf1)['then'](function(_0x3e7ccf){var _0x553794=_0x404bf1[_0x1693('0x27')]()===_0x1693('0x28')?_0x459c39[_0x1693('0x29')]:_0x459c39[_0x1693('0x2a')];var _0x5888d7={'method':_0x1693('0xc'),'uri':_0x4612e0+_0x1693('0x2b'),'body':{'telephone1':_0x553794,'fullname':_0x553794,'firstname':_0x553794,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x341a72['userId']+')'},'headers':{'Authorization':_0x1693('0x2c')+_0x3e7ccf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5888d7);})['then'](function(_0x5ce409){var _0x2e3bf8=_0x5ce409[_0x1693('0x2d')]['odata-entityid'];var _0x2501f1=_0x2e3bf8['substring'](_0x2e3bf8[_0x1693('0x2e')]('(')+0x1,_0x2e3bf8['lastIndexOf'](')'));_0x341a72[_0x1693('0x2f')]=_0x2501f1;_0x47cfb4(_0x341a72);})[_0x1693('0x26')](function(_0x15a9a8){_0x2d0806(_0x15a9a8['message']);});});}function getEndUser(_0x2c4805,_0x43fd01,_0xd30e58,_0x261718,_0x459a86,_0x30ee2b){return new BPromise(function(_0x26c86f,_0x1fcbb4){return getAuthToken(_0x43fd01,_0xd30e58,_0x30ee2b)[_0x1693('0x12')](function(_0x3e9dd5){var _0x37b8ec={'method':_0x1693('0x18'),'uri':_0x261718+'contacts?$select=telephone1','headers':{'Authorization':_0x1693('0x2c')+_0x3e9dd5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x37b8ec);})[_0x1693('0x12')](function(_0x39b99d){var _0xe94f0b=null;if(_0x39b99d){var _0x43328c=_0x39b99d[_0x1693('0x19')];var _0x44bda8=![];for(_0xe94f0b=0x0;_0xe94f0b<_0x43328c[_0x1693('0x1d')];_0xe94f0b++){var _0xa60224=_0x30ee2b[_0x1693('0x27')]()==='outbound'?_0x459a86[_0x1693('0x29')]:_0x459a86[_0x1693('0x2a')];if(_0x43328c[_0xe94f0b][_0x1693('0x30')]===_0xa60224){_0x44bda8=!![];_0x2c4805[_0x1693('0x2f')]=_0x43328c[_0xe94f0b][_0x1693('0x31')];}}if(_0x44bda8){_0x26c86f(_0x2c4805);}else{return createEndUser(_0x2c4805,_0x43fd01,_0xd30e58,_0x261718,_0x459a86,_0x30ee2b)[_0x1693('0x12')](function(_0x3a49cf){logger[_0x1693('0x20')]('['+[_0x30ee2b[_0x1693('0x15')]()]+_0x1693('0x32'),_0x3a49cf['enduserId']);_0x26c86f(_0x3a49cf);});}}else{return createEndUser(_0x2c4805,_0x43fd01,_0xd30e58,_0x261718,_0x459a86,_0x30ee2b)['then'](function(_0x47bd30){logger[_0x1693('0x20')]('['+[_0x30ee2b[_0x1693('0x15')]()]+_0x1693('0x33'),_0x47bd30[_0x1693('0x2f')]);_0x26c86f(_0x47bd30);});}});});}function getCustomFields(_0x361330,_0x4a5462,_0x1beda2){var _0xda9fd3={};if(_0x361330[_0x1693('0x1d')]>0x0){_[_0x1693('0x34')](_0x361330,function(_0x3390c5){if(_[_0x1693('0x35')](['string',_0x1693('0x36')],_0x3390c5[_0x1693('0x37')])&&_0x3390c5[_0x1693('0x38')]&&!_0x3390c5[_0x1693('0x39')]){var _0x21ef18=_0x3390c5[_0x1693('0x3a')]['toLowerCase']();var _0x3f2d7b=_0x21ef18['substring'](0x0,_0x21ef18['indexOf']('_'));var _0x56d8ef=_0x21ef18['substring'](_0x21ef18['indexOf']('_')+0x1);if(_0x3f2d7b===_0x1beda2){_0xda9fd3[_0x56d8ef]=_0x3390c5[_0x1693('0x3b')];}}});}return _0xda9fd3;}function getTicket(_0x42b2c6,_0x3996aa,_0x5cd283,_0x57b878,_0x5e55a7,_0x33329a,_0x435625){return new BPromise(function(_0xbc8b88,_0x4a4430){var _0x1bb889;return getAuthToken(_0x3996aa,_0x5cd283,_0x435625)[_0x1693('0x12')](function(_0x58eac7){if(_0x33329a[_0x1693('0x3c')]==='incident'){_0x1bb889={'method':_0x1693('0xc'),'uri':_0x57b878+_0x1693('0x3d'),'body':Object[_0x1693('0x3e')]({},{'title':intUtil['getString'](_0x33329a[_0x1693('0x3f')],_0x5e55a7,'\x20'),'description':intUtil['getString'](_0x33329a[_0x1693('0x40')],_0x5e55a7,'\x0a'),'customerid_contact@odata.bind':_0x1693('0x41')+_0x42b2c6[_0x1693('0x2f')]+')','ownerid@odata.bind':_0x1693('0x42')+_0x42b2c6[_0x1693('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x33329a['Fields'],_0x5e55a7,_0x33329a['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x58eac7,'OData-Version':_0x1693('0x43')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x33329a[_0x1693('0x3c')]===_0x1693('0x44')){_0x1bb889={'method':_0x1693('0xc'),'uri':_0x57b878+_0x1693('0x45'),'body':Object['assign']({},{'subject':intUtil[_0x1693('0x46')](_0x33329a[_0x1693('0x3f')],_0x5e55a7,'\x20'),'phonenumber':String(_0x5e55a7[_0x1693('0x2a')]),'description':intUtil[_0x1693('0x46')](_0x33329a[_0x1693('0x40')],_0x5e55a7,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x42b2c6['enduserId']+')','ownerid@odata.bind':_0x1693('0x42')+_0x42b2c6[_0x1693('0x25')]+')','directioncode':_0x42b2c6[_0x1693('0x47')]===_0x1693('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1693('0x42')+_0x42b2c6['userId']+')','participationtypemask':_0x42b2c6['callDirection']===_0x1693('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x1693('0x41')+_0x42b2c6['enduserId']+')','participationtypemask':_0x42b2c6[_0x1693('0x47')]===_0x1693('0x48')?0x1:0x2}]},getCustomFields(_0x33329a['Fields'],_0x5e55a7,_0x33329a[_0x1693('0x3c')])),'headers':{'Authorization':_0x1693('0x2c')+_0x58eac7,'OData-Version':_0x1693('0x43')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1bb889);})[_0x1693('0x12')](function(_0x1e3a52){var _0x539e6a=_0x1e3a52[_0x1693('0x2d')]['odata-entityid'];var _0x5aeb52=_0x539e6a['substring'](_0x539e6a[_0x1693('0x2e')]('(')+0x1,_0x539e6a['lastIndexOf'](')'));_0x42b2c6['ticketId']=_0x5aeb52;_0xbc8b88(_0x42b2c6);})[_0x1693('0x26')](function(_0x175450){_0x4a4430(_0x175450[_0x1693('0x17')]);});});}function emit(_0x42c533,_0x26231f,_0x117370,_0x1d9a45){var _0x4ea5e9={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x42c533,_0x117370,_0x1d9a45)};io['to'](util[_0x1693('0x49')](_0x1693('0x4a'),_0x26231f))[_0x1693('0x4b')]('trigger:browser:url',_0x4ea5e9);}exports['cs']=function(_0x31d34c,_0x3380ab,_0x4ce5b6,_0x122f5b,_0x2b3a7a,_0x437427,_0x5e441d,_0x76bf12){var _0x3b1b33={};_0x437427[_0x1693('0xe')]=intUtil[_0x1693('0x4c')](_0x437427[_0x1693('0xe')]);_0x437427[_0x1693('0x4d')]=intUtil[_0x1693('0x4c')](_0x437427[_0x1693('0x4d')]);_0x3b1b33[_0x1693('0x47')]=_0x76bf12===_0x1693('0x48')||_0x76bf12==='unmanaged'?_0x1693('0x48'):_0x1693('0x28');var _0x449fec=util[_0x1693('0x49')](_0x1693('0x4e'),_0x437427['remoteUri']);var _0x1e7035=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x437427[_0x1693('0x4f')]);var _0x4983ac=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x437427[_0x1693('0x4d')],_0x3380ab[_0x1693('0x50')],md5(_0x3380ab[_0x1693('0x50')]));if(_0x2b3a7a&&_0x2b3a7a['monitor_format']){logger[_0x1693('0x20')](_0x1693('0x51'),_0x1693('0x52'));_0x3380ab[_0x1693('0x53')]=_0x4983ac;}else if(_0x5e441d&&_0x5e441d[_0x1693('0x54')]&&_0x5e441d[_0x1693('0x54')]!=='none'){logger[_0x1693('0x20')](_0x1693('0x55'),_0x1693('0x52'));_0x3380ab[_0x1693('0x53')]=_0x4983ac;}else{_0x3380ab[_0x1693('0x53')]='';}return getUser(_0x3b1b33,_0x437427,_0x122f5b,_0x1e7035,_0x449fec,_0x76bf12)['then'](function(_0x57578c){logger['info']('['+_0x76bf12['toUpperCase']()+_0x1693('0x56'),_0x57578c[_0x1693('0x25')]);logger['info']('['+_0x76bf12[_0x1693('0x15')]()+_0x1693('0x57'),_0x57578c[_0x1693('0x24')]);return getEndUser(_0x57578c,_0x437427,_0x1e7035,_0x449fec,_0x3380ab,_0x76bf12);})[_0x1693('0x12')](function(_0xe4d730){logger[_0x1693('0x20')]('['+_0x76bf12['toUpperCase']()+_0x1693('0x58'),_0xe4d730['enduserId']);logger['info']('['+_0x76bf12[_0x1693('0x15')]()+_0x1693('0x59'),_0x3380ab[_0x1693('0x2a')]);return getTicket(_0xe4d730,_0x437427,_0x1e7035,_0x449fec,_0x3380ab,_0x4ce5b6,_0x76bf12);})[_0x1693('0x12')](function(_0x389636){logger['info'](util[_0x1693('0x49')]('['+_0x76bf12[_0x1693('0x15')]()+_0x1693('0x5a'),_0x4ce5b6[_0x1693('0x3c')],_0x389636[_0x1693('0x5b')]));logger['info'](util[_0x1693('0x49')]('['+_0x76bf12[_0x1693('0x15')]()+_0x1693('0x5c'),_0x76bf12));if(_0x76bf12!==_0x1693('0x5d')){logger['info']('['+_0x76bf12[_0x1693('0x15')]()+']',_0x1693('0x5e'));emit(_0x437427[_0x1693('0xe')],_0x122f5b[_0x1693('0x5f')],_0x4ce5b6[_0x1693('0x3c')],_0x389636[_0x1693('0x5b')]);}})['catch'](function(_0x5bd7c4){logger['error']('['+_0x76bf12[_0x1693('0x15')]()+_0x1693('0x60'),util['inspect'](_0x5bd7c4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa751=['value','isNil','userEmail','email','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','Bearer\x20','headers','odata-entityid','enduserId','GET','length','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','includes','string','picklist','type','nameField','customField','substring','indexOf','content','ticketType','incident','assign','getString','/contacts(','/systemusers(','Fields','Subjects','Descriptions','callDirection','queue','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\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','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','clientId','remoteUri','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','4.0'];(function(_0x26e168,_0x238c47){var _0xd37d64=function(_0x3e45c6){while(--_0x3e45c6){_0x26e168['push'](_0x26e168['shift']());}};_0xd37d64(++_0x238c47);}(_0xa751,0x175));var _0x1a75=function(_0x3f9440,_0x42b0f9){_0x3f9440=_0x3f9440-0x0;var _0x49791f=_0xa751[_0x3f9440];return _0x49791f;};'use strict';var _=require(_0x1a75('0x0'));var BPromise=require(_0x1a75('0x1'));var rp=require(_0x1a75('0x2'));var util=require(_0x1a75('0x3'));var intUtil=require('./util');var md5=require(_0x1a75('0x4'));var Redis=require('ioredis');var logger=require(_0x1a75('0x5'))(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));config['redis']=_[_0x1a75('0x8')](config[_0x1a75('0x9')],{'host':_0x1a75('0xa'),'port':0x18eb});var io=require(_0x1a75('0xb'))(new Redis(config[_0x1a75('0x9')]));function getAuthToken(_0x692ac0,_0x4537f6,_0x5d6faa){var _0x4c7f62={'method':'POST','uri':_0x4537f6,'form':{'client_id':_0x692ac0[_0x1a75('0xc')],'resource':_0x692ac0[_0x1a75('0xd')],'username':_0x692ac0[_0x1a75('0xe')],'password':_0x692ac0[_0x1a75('0xf')],'grant_type':_0x1a75('0xf'),'client_secret':_0x692ac0[_0x1a75('0x10')]},'json':!![]};return rp(_0x4c7f62)[_0x1a75('0x11')](function(_0x3d3247){return _0x3d3247['access_token'];})['catch'](function(_0x5a63c0){logger[_0x1a75('0x12')]('['+[_0x5d6faa[_0x1a75('0x13')]()]+_0x1a75('0x14'));return _0x5a63c0[_0x1a75('0x15')];});}function getUser(_0x500d60,_0x5ed24b,_0x1c6ceb,_0xf4a616,_0x48577b,_0x1c84d3){return new BPromise(function(_0xa8f0b7,_0x5a840b){return getAuthToken(_0x5ed24b,_0xf4a616,_0x1c84d3)[_0x1a75('0x11')](function(_0xb4a245){var _0x15a1ec={'method':'GET','uri':_0x48577b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0xb4a245,'OData-Version':_0x1a75('0x16')},'json':!![]};return rp(_0x15a1ec);})[_0x1a75('0x11')](function(_0x2b6f3d){var _0x25e3c2=_0x2b6f3d[_0x1a75('0x17')];var _0x1d11dc=![];var _0x47f384=null;if(!_[_0x1a75('0x18')](_0x1c6ceb)){if(intUtil['validateEmail'](_0x1c6ceb['email'])){_0x500d60[_0x1a75('0x19')]=_0x1c6ceb[_0x1a75('0x1a')];for(_0x47f384=0x0;_0x47f384<_0x25e3c2['length'];_0x47f384++){if(_0x25e3c2[_0x47f384][_0x1a75('0x1b')]===_0x1c6ceb['email']&&!_0x25e3c2[_0x47f384][_0x1a75('0x1c')]){_0x1d11dc=!![];logger[_0x1a75('0x1d')]('['+[_0x1c84d3[_0x1a75('0x13')]()]+_0x1a75('0x1e')+_0x25e3c2[_0x47f384][_0x1a75('0x1f')]+'!');_0x500d60[_0x1a75('0x20')]=_0x25e3c2[_0x47f384]['systemuserid'];}}}}if(!_0x1d11dc){logger[_0x1a75('0x1d')]('['+[_0x1c84d3['toUpperCase']()]+_0x1a75('0x21'));_0x500d60[_0x1a75('0x19')]=_0x5ed24b[_0x1a75('0xe')];for(_0x47f384=0x0;_0x47f384<_0x25e3c2['length'];_0x47f384++){if(_0x25e3c2[_0x47f384][_0x1a75('0x1b')]===_0x5ed24b['username']){_0x500d60[_0x1a75('0x20')]=_0x25e3c2[_0x47f384][_0x1a75('0x1f')];}}}_0xa8f0b7(_0x500d60);})[_0x1a75('0x22')](function(_0x4ed6f8){_0x5a840b(_0x4ed6f8[_0x1a75('0x15')]);});});}function createEndUser(_0x126f40,_0x4dec82,_0x1e29ab,_0x399dae,_0x5a6acc,_0x168e06){return new BPromise(function(_0x10b4ab,_0x34c106){return getAuthToken(_0x4dec82,_0x1e29ab,_0x168e06)[_0x1a75('0x11')](function(_0x4ba38b){var _0x2e16b7=_0x168e06[_0x1a75('0x23')]()===_0x1a75('0x24')?_0x5a6acc[_0x1a75('0x25')]:_0x5a6acc[_0x1a75('0x26')];var _0x9e66b9={'method':_0x1a75('0x27'),'uri':_0x399dae+_0x1a75('0x28'),'body':{'telephone1':_0x2e16b7,'fullname':_0x2e16b7,'firstname':_0x2e16b7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x126f40['userId']+')'},'headers':{'Authorization':_0x1a75('0x29')+_0x4ba38b,'OData-Version':_0x1a75('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x9e66b9);})[_0x1a75('0x11')](function(_0x11f25b){var _0x6f02dc=_0x11f25b[_0x1a75('0x2a')][_0x1a75('0x2b')];var _0x28b353=_0x6f02dc['substring'](_0x6f02dc['lastIndexOf']('(')+0x1,_0x6f02dc['lastIndexOf'](')'));_0x126f40[_0x1a75('0x2c')]=_0x28b353;_0x10b4ab(_0x126f40);})[_0x1a75('0x22')](function(_0x330e01){_0x34c106(_0x330e01[_0x1a75('0x15')]);});});}function getEndUser(_0x534fab,_0x54b98b,_0x4f41e0,_0x260834,_0x329889,_0x5cec42){return new BPromise(function(_0x5e0ccd,_0x15410c){return getAuthToken(_0x54b98b,_0x4f41e0,_0x5cec42)['then'](function(_0x6c8e6c){var _0x44eb9a={'method':_0x1a75('0x2d'),'uri':_0x260834+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x6c8e6c,'If-None-Match':null,'OData-Version':_0x1a75('0x16')},'json':!![]};return rp(_0x44eb9a);})[_0x1a75('0x11')](function(_0x935dd8){var _0x24ee8e=null;if(_0x935dd8){var _0x3d170e=_0x935dd8[_0x1a75('0x17')];var _0x283c70=![];for(_0x24ee8e=0x0;_0x24ee8e<_0x3d170e[_0x1a75('0x2e')];_0x24ee8e++){var _0x249aa8=_0x5cec42[_0x1a75('0x23')]()===_0x1a75('0x24')?_0x329889[_0x1a75('0x25')]:_0x329889[_0x1a75('0x26')];if(_0x3d170e[_0x24ee8e][_0x1a75('0x2f')]===_0x249aa8){_0x283c70=!![];_0x534fab[_0x1a75('0x2c')]=_0x3d170e[_0x24ee8e][_0x1a75('0x30')];}}if(_0x283c70){_0x5e0ccd(_0x534fab);}else{return createEndUser(_0x534fab,_0x54b98b,_0x4f41e0,_0x260834,_0x329889,_0x5cec42)['then'](function(_0xc203ad){logger['info']('['+[_0x5cec42['toUpperCase']()]+_0x1a75('0x31'),_0xc203ad[_0x1a75('0x2c')]);_0x5e0ccd(_0xc203ad);});}}else{return createEndUser(_0x534fab,_0x54b98b,_0x4f41e0,_0x260834,_0x329889,_0x5cec42)[_0x1a75('0x11')](function(_0x109140){logger[_0x1a75('0x1d')]('['+[_0x5cec42['toUpperCase']()]+_0x1a75('0x32'),_0x109140[_0x1a75('0x2c')]);_0x5e0ccd(_0x109140);});}});});}function getCustomFields(_0x2a89de,_0x32c064,_0x4372b5){var _0x5832db={};if(_0x2a89de[_0x1a75('0x2e')]>0x0){_['forEach'](_0x2a89de,function(_0x1eb07d){if(_[_0x1a75('0x33')]([_0x1a75('0x34'),_0x1a75('0x35')],_0x1eb07d[_0x1a75('0x36')])&&_0x1eb07d[_0x1a75('0x37')]&&!_0x1eb07d[_0x1a75('0x38')]){var _0x4dcae1=_0x1eb07d['idField'][_0x1a75('0x23')]();var _0x5eda36=_0x4dcae1[_0x1a75('0x39')](0x0,_0x4dcae1[_0x1a75('0x3a')]('_'));var _0x3d97ce=_0x4dcae1['substring'](_0x4dcae1[_0x1a75('0x3a')]('_')+0x1);if(_0x5eda36===_0x4372b5){_0x5832db[_0x3d97ce]=_0x1eb07d[_0x1a75('0x3b')];}}});}return _0x5832db;}function getTicket(_0x21bfae,_0x5a2c51,_0x292cbc,_0x15fe49,_0x2f84d9,_0x499cf2,_0x46b957){return new BPromise(function(_0x153ed8,_0x3300a4){var _0x5cd14d;return getAuthToken(_0x5a2c51,_0x292cbc,_0x46b957)[_0x1a75('0x11')](function(_0x302bc4){if(_0x499cf2[_0x1a75('0x3c')]===_0x1a75('0x3d')){_0x5cd14d={'method':_0x1a75('0x27'),'uri':_0x15fe49+'incidents','body':Object[_0x1a75('0x3e')]({},{'title':intUtil[_0x1a75('0x3f')](_0x499cf2['Subjects'],_0x2f84d9,'\x20'),'description':intUtil[_0x1a75('0x3f')](_0x499cf2['Descriptions'],_0x2f84d9,'\x0a'),'customerid_contact@odata.bind':_0x1a75('0x40')+_0x21bfae['enduserId']+')','ownerid@odata.bind':_0x1a75('0x41')+_0x21bfae[_0x1a75('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x499cf2[_0x1a75('0x42')],_0x2f84d9,_0x499cf2[_0x1a75('0x3c')])),'headers':{'Authorization':_0x1a75('0x29')+_0x302bc4,'OData-Version':_0x1a75('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x499cf2[_0x1a75('0x3c')]==='phonecall'){_0x5cd14d={'method':_0x1a75('0x27'),'uri':_0x15fe49+'phonecalls','body':Object[_0x1a75('0x3e')]({},{'subject':intUtil[_0x1a75('0x3f')](_0x499cf2[_0x1a75('0x43')],_0x2f84d9,'\x20'),'phonenumber':String(_0x2f84d9[_0x1a75('0x26')]),'description':intUtil[_0x1a75('0x3f')](_0x499cf2[_0x1a75('0x44')],_0x2f84d9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1a75('0x40')+_0x21bfae[_0x1a75('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x21bfae[_0x1a75('0x20')]+')','directioncode':_0x21bfae[_0x1a75('0x45')]===_0x1a75('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1a75('0x41')+_0x21bfae[_0x1a75('0x20')]+')','participationtypemask':_0x21bfae[_0x1a75('0x45')]===_0x1a75('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x1a75('0x40')+_0x21bfae[_0x1a75('0x2c')]+')','participationtypemask':_0x21bfae[_0x1a75('0x45')]===_0x1a75('0x46')?0x1:0x2}]},getCustomFields(_0x499cf2[_0x1a75('0x42')],_0x2f84d9,_0x499cf2[_0x1a75('0x3c')])),'headers':{'Authorization':_0x1a75('0x29')+_0x302bc4,'OData-Version':_0x1a75('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5cd14d);})['then'](function(_0x39a7bf){var _0xa20c25=_0x39a7bf[_0x1a75('0x2a')][_0x1a75('0x2b')];var _0x36ff53=_0xa20c25[_0x1a75('0x39')](_0xa20c25[_0x1a75('0x47')]('(')+0x1,_0xa20c25[_0x1a75('0x47')](')'));_0x21bfae['ticketId']=_0x36ff53;_0x153ed8(_0x21bfae);})[_0x1a75('0x22')](function(_0x5f44e3){_0x3300a4(_0x5f44e3[_0x1a75('0x15')]);});});}function emit(_0x3a954c,_0x1eee8b,_0x4ba543,_0x5c7513){var _0x5a747c={'uri':util[_0x1a75('0x48')](_0x1a75('0x49'),_0x3a954c,_0x4ba543,_0x5c7513)};io['to'](util[_0x1a75('0x48')](_0x1a75('0x4a'),_0x1eee8b))[_0x1a75('0x4b')]('trigger:browser:url',_0x5a747c);}exports['cs']=function(_0x436b0e,_0x41e5d8,_0x2f2df8,_0x94e5eb,_0x3bf218,_0x8fc015,_0x4c65dd,_0x4a5d32){var _0x4d8d27={};_0x8fc015[_0x1a75('0xd')]=intUtil[_0x1a75('0x4c')](_0x8fc015[_0x1a75('0xd')]);_0x8fc015['serverUrl']=intUtil['stripTrailingSlash'](_0x8fc015[_0x1a75('0x4d')]);_0x4d8d27[_0x1a75('0x45')]=_0x4a5d32==='queue'||_0x4a5d32===_0x1a75('0x4e')?'queue':'outbound';var _0x1511f7=util[_0x1a75('0x48')]('%s/api/data/v9.0/',_0x8fc015[_0x1a75('0xd')]);var _0x1a0275=util['format'](_0x1a75('0x4f'),_0x8fc015[_0x1a75('0x50')]);var _0x2f77a0=util['format'](_0x1a75('0x51'),_0x8fc015['serverUrl'],_0x41e5d8[_0x1a75('0x52')],md5(_0x41e5d8[_0x1a75('0x52')]));if(_0x3bf218&&_0x3bf218['monitor_format']){logger[_0x1a75('0x1d')](_0x1a75('0x53'),_0x1a75('0x54'));_0x41e5d8[_0x1a75('0x55')]=_0x2f77a0;}else if(_0x4c65dd&&_0x4c65dd['recordingFormat']&&_0x4c65dd[_0x1a75('0x56')]!==_0x1a75('0x57')){logger['info'](_0x1a75('0x58'),'Recording\x20is\x20enabled!');_0x41e5d8[_0x1a75('0x55')]=_0x2f77a0;}else{_0x41e5d8[_0x1a75('0x55')]='';}return getUser(_0x4d8d27,_0x8fc015,_0x94e5eb,_0x1a0275,_0x1511f7,_0x4a5d32)['then'](function(_0x15b8d7){logger[_0x1a75('0x1d')]('['+_0x4a5d32[_0x1a75('0x13')]()+_0x1a75('0x59'),_0x15b8d7[_0x1a75('0x20')]);logger[_0x1a75('0x1d')]('['+_0x4a5d32['toUpperCase']()+_0x1a75('0x5a'),_0x15b8d7[_0x1a75('0x19')]);return getEndUser(_0x15b8d7,_0x8fc015,_0x1a0275,_0x1511f7,_0x41e5d8,_0x4a5d32);})[_0x1a75('0x11')](function(_0x3bbbb4){logger[_0x1a75('0x1d')]('['+_0x4a5d32[_0x1a75('0x13')]()+_0x1a75('0x5b'),_0x3bbbb4['enduserId']);logger[_0x1a75('0x1d')]('['+_0x4a5d32['toUpperCase']()+_0x1a75('0x5c'),_0x41e5d8[_0x1a75('0x26')]);return getTicket(_0x3bbbb4,_0x8fc015,_0x1a0275,_0x1511f7,_0x41e5d8,_0x2f2df8,_0x4a5d32);})['then'](function(_0x4f9d56){logger['info'](util[_0x1a75('0x48')]('['+_0x4a5d32[_0x1a75('0x13')]()+_0x1a75('0x5d'),_0x2f2df8[_0x1a75('0x3c')],_0x4f9d56[_0x1a75('0x5e')]));logger[_0x1a75('0x1d')](util[_0x1a75('0x48')]('['+_0x4a5d32[_0x1a75('0x13')]()+_0x1a75('0x5f'),_0x4a5d32));if(_0x4a5d32!==_0x1a75('0x4e')){logger['info']('['+_0x4a5d32[_0x1a75('0x13')]()+']',_0x1a75('0x60'));emit(_0x8fc015[_0x1a75('0xd')],_0x94e5eb[_0x1a75('0x61')],_0x2f2df8[_0x1a75('0x3c')],_0x4f9d56[_0x1a75('0x5e')]);}})[_0x1a75('0x22')](function(_0x29c9b2){logger[_0x1a75('0x12')]('['+_0x4a5d32[_0x1a75('0x13')]()+_0x1a75('0x62'),util['inspect'](_0x29c9b2,{'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 c5d025b..2425dab 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 _0x52a6=['picklist','push','content','variable','variableName','idField','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','[HTTP]','stringify','map','forEach','string','type','nameField','customField','includes'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x52a6,0xe3));var _0x652a=function(_0x4d7d34,_0x354d54){_0x4d7d34=_0x4d7d34-0x0;var _0x21640b=_0x52a6[_0x4d7d34];return _0x21640b;};'use strict';var _=require(_0x652a('0x0'));var rp=require(_0x652a('0x1'));var md5=require(_0x652a('0x2'));var util=require(_0x652a('0x3'));var Redis=require('ioredis');var intUtil=require(_0x652a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x652a('0x5'))(_0x652a('0x6'));config[_0x652a('0x7')]=_[_0x652a('0x8')](config[_0x652a('0x7')],{'host':_0x652a('0x9'),'port':0x18eb});var io=require(_0x652a('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x652a('0xb'),'Accept':_0x652a('0xb')};function emit(_0x5a57c1,_0x1bb8a3,_0x1ff61d){io['to'](_0x5a57c1)[_0x652a('0xc')](_0x1bb8a3,_0x1ff61d);}function getTicket(_0x112960,_0x9a49ac,_0x42e4b7,_0x3ea208,_0x3faf11){logger[_0x652a('0xd')](_0x652a('0xe'));var _0x14f030=_[_0x652a('0xf')]({'responder_id':_0x9a49ac['id'],'requester_id':_0x42e4b7['id'],'name':util[_0x652a('0x10')](_0x652a('0x11'),_0x3faf11[_0x652a('0x12')]),'phone':_0x3faf11['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3ea208[_0x652a('0x13')],_0x3faf11,'\x20'),'description':intUtil[_0x652a('0x14')](_0x3ea208[_0x652a('0x15')],_0x3faf11,_0x652a('0x16')),'tags':getTags(_0x3ea208[_0x652a('0x17')],_0x652a('0x18'))},getCustomFields(_0x3ea208[_0x652a('0x19')],_0x3faf11));_0x14f030['custom_fields']=_['mapValues'](_['keyBy'](_0x14f030[_0x652a('0x1a')],'id'),_0x652a('0x1b'));return request({'uri':util[_0x652a('0x10')](_0x652a('0x1c'),_0x112960[_0x652a('0x1d')]),'method':_0x652a('0x1e'),'body':_0x14f030})[_0x652a('0x1f')](function(_0x2b2e63){logger[_0x652a('0xd')](_0x652a('0x20'));return _0x2b2e63;});}function getUser(_0x2a4191,_0x361e94){if(intUtil['validateEmail'](_0x361e94)){return request({'uri':util[_0x652a('0x10')](_0x652a('0x21'),_0x2a4191['remoteUri']),'qs':{'email':_0x361e94}})['then'](function(_0x187fad){if(_0x187fad[_0x652a('0x22')]){logger[_0x652a('0xd')](_0x652a('0x23'));return _['find'](_0x187fad,function(_0x82b571){return _0x82b571[_0x652a('0x24')][_0x652a('0x25')]===_0x361e94;});}else{logger['info'](_0x652a('0x26'));return request({'uri':util[_0x652a('0x10')]('%s/api/v2/agents/me',_0x2a4191[_0x652a('0x1d')])})[_0x652a('0x1f')](function(_0x472f00){logger[_0x652a('0xd')](_0x652a('0x27'));return _0x472f00;});}});}else{logger[_0x652a('0xd')](_0x652a('0x28'));return request({'uri':util[_0x652a('0x10')](_0x652a('0x29'),_0x2a4191[_0x652a('0x1d')])})['then'](function(_0x37e79a){logger[_0x652a('0xd')](_0x652a('0x27'));return _0x37e79a;});}}function getEndUser(_0x196392,_0x2207ba,_0x5103cc){logger[_0x652a('0xd')]('Searching\x20enduser\x20with\x20phone',_0x5103cc);return request({'uri':util[_0x652a('0x10')](_0x652a('0x2a'),_0x196392[_0x652a('0x1d')]),'qs':{'phone':_0x5103cc}})[_0x652a('0x1f')](function(_0x14f070){if(_0x14f070[_0x652a('0x22')]){logger['info'](_0x652a('0x2b'));return _[_0x652a('0x2c')](_0x14f070,{'phone':_0x5103cc});}else{logger[_0x652a('0xd')](_0x652a('0x2d'));return request({'uri':util[_0x652a('0x10')](_0x652a('0x2a'),_0x196392[_0x652a('0x1d')]),'method':'POST','body':{'name':_0x2207ba,'phone':_0x5103cc}})[_0x652a('0x1f')](function(_0x2bfdef){logger['info']('Enduser\x20created.');return _0x2bfdef;});}});}function getAuth(_0x284908){return util[_0x652a('0x10')](_0x652a('0x2e'),new Buffer(_0x284908[_0x652a('0x2f')]+':X')[_0x652a('0x30')]('base64'));}function request(_0x177a91){logger['debug'](_0x652a('0x31'),JSON[_0x652a('0x32')](_0x177a91));return rp(_[_0x652a('0x8')](_0x177a91,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x19ceac,_0x4ebe4c){var _0x2d0824=[];if(_0x19ceac&&_0x19ceac[_0x652a('0x22')]>0x0){_0x2d0824=_[_0x652a('0x33')](_0x19ceac,_0x4ebe4c);}return _0x2d0824;}function getCustomFields(_0x5741fa,_0x52c54a){var _0x13ad75=[];var _0x5ea0cf={'custom_fields':[]};if(_0x5741fa[_0x652a('0x22')]>0x0){_[_0x652a('0x34')](_0x5741fa,function(_0x91f260){if(_['includes']([_0x652a('0x35'),'picklist'],_0x91f260[_0x652a('0x36')])&&_0x91f260[_0x652a('0x37')]&&!_0x91f260[_0x652a('0x38')]){_0x5ea0cf[_0x91f260[_0x652a('0x37')]['toLowerCase']()]=_0x91f260['content'][_0x652a('0x30')]();}else if(_[_0x652a('0x39')](['string',_0x652a('0x3a')],_0x91f260[_0x652a('0x36')])&&_0x91f260['idField']&&_0x91f260['customField']){_0x5ea0cf['custom_fields'][_0x652a('0x3b')]({'id':_0x91f260['idField'],'value':_0x91f260[_0x652a('0x3c')][_0x652a('0x30')]()});}else if(_0x91f260[_0x652a('0x36')]===_0x652a('0x3d')&&_0x91f260[_0x652a('0x3e')]&&_0x91f260['idField']&&_0x91f260[_0x652a('0x38')]){_0x52c54a[_0x91f260[_0x652a('0x3e')]]&&_0x5ea0cf['custom_fields'][_0x652a('0x3b')]({'id':_0x91f260[_0x652a('0x3f')],'value':_0x52c54a[_0x91f260[_0x652a('0x3e')]][_0x652a('0x30')]()});}else if(_0x91f260[_0x652a('0x36')]===_0x652a('0x40')&&_0x91f260[_0x652a('0x41')]&&_0x91f260['Variable']['name']&&_0x91f260[_0x652a('0x3f')]&&_0x91f260[_0x652a('0x38')]){_0x52c54a[_0x91f260[_0x652a('0x41')][_0x652a('0x18')]['toLowerCase']()]&&_0x5ea0cf['custom_fields']['push']({'id':_0x91f260[_0x652a('0x3f')],'value':_0x52c54a[_0x91f260[_0x652a('0x41')][_0x652a('0x18')][_0x652a('0x42')]()]['toString']()});}});}return _0x5ea0cf;}exports[_0x652a('0x43')]=function(_0x37fa2f,_0x35a8f6,_0x3ab8dc,_0x19c769,_0x2bf9e6,_0x187046){var _0x36d518,_0x4b76f6;_0x187046[_0x652a('0x1d')]=intUtil['stripTrailingSlash'](_0x187046[_0x652a('0x1d')]);_0x187046[_0x652a('0x44')]=intUtil[_0x652a('0x45')](_0x187046[_0x652a('0x44')]);if(_0x2bf9e6&&_0x2bf9e6[_0x652a('0x46')]){logger[_0x652a('0xd')](_0x652a('0x47'),'Recording\x20is\x20enabled!');_0x35a8f6[_0x652a('0x48')]=util[_0x652a('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x187046[_0x652a('0x44')],_0x35a8f6[_0x652a('0x49')],md5(_0x35a8f6[_0x652a('0x49')]));}else{_0x35a8f6[_0x652a('0x48')]='';}headers[_0x652a('0x4a')]=getAuth(_0x187046);return getUser(_0x187046,_0x19c769['email'])['then'](function(_0x2f4062){_0x36d518=_0x2f4062;logger['info'](_0x652a('0x4b'),_0x36d518['id']);return getEndUser(_0x187046,_0x35a8f6['calleridname'],_0x35a8f6[_0x652a('0x4c')]);})['then'](function(_0x56e1ca){_0x4b76f6=_0x56e1ca;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4b76f6['id']);return getTicket(_0x187046,_0x36d518,_0x4b76f6,_0x3ab8dc,_0x35a8f6);})[_0x652a('0x1f')](function(_0x19904d){if(_0x19904d&&_0x19904d['id']){logger['info'](_0x652a('0x20'));logger[_0x652a('0xd')](_0x652a('0x4d'),_0x19904d['id']);logger[_0x652a('0xd')]('[QUEUE]',_0x652a('0x4e'));emit(util[_0x652a('0x10')]('user:%s',_0x19c769[_0x652a('0x18')]),_0x652a('0x4f'),{'uri':util[_0x652a('0x10')](_0x652a('0x50'),_0x187046[_0x652a('0x1d')],_0x19904d['id'])});}})[_0x652a('0x51')](function(_0x442b1e){logger[_0x652a('0x52')](_0x652a('0x47'),JSON[_0x652a('0x32')](_0x442b1e));});};exports['outbound']=function(_0x598e44,_0x1698b0,_0x5cd6c0,_0x39c80a,_0x2d14c4,_0x32b299,_0x197339){var _0x39e11c,_0x28c069;_0x32b299[_0x652a('0x1d')]=intUtil[_0x652a('0x45')](_0x32b299['remoteUri']);_0x32b299[_0x652a('0x44')]=intUtil[_0x652a('0x45')](_0x32b299[_0x652a('0x44')]);if(_0x197339&&_0x197339[_0x652a('0x53')]&&_0x197339[_0x652a('0x53')]!==_0x652a('0x54')){logger[_0x652a('0xd')](_0x652a('0x55'),_0x652a('0x56'));_0x1698b0[_0x652a('0x48')]=util[_0x652a('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32b299[_0x652a('0x44')],_0x1698b0['uniqueid'],md5(_0x1698b0[_0x652a('0x49')]));}headers[_0x652a('0x4a')]=getAuth(_0x32b299);return getUser(_0x32b299,_0x39c80a[_0x652a('0x25')])[_0x652a('0x1f')](function(_0x3db210){_0x39e11c=_0x3db210;logger['info'](_0x652a('0x4b'),_0x39e11c['id']);return getEndUser(_0x32b299,_0x1698b0[_0x652a('0x57')],_0x1698b0[_0x652a('0x58')]);})['then'](function(_0x580d3f){_0x28c069=_0x580d3f;logger[_0x652a('0xd')](_0x652a('0x59'),_0x28c069['id']);return getTicket(_0x32b299,_0x39e11c,_0x28c069,_0x5cd6c0,_0x1698b0);})[_0x652a('0x1f')](function(_0x5e333f){if(_0x5e333f&&_0x5e333f['id']){logger[_0x652a('0xd')](_0x652a('0x20'));logger['info'](_0x652a('0x4d'),_0x5e333f['id']);logger[_0x652a('0xd')](_0x652a('0x55'),_0x652a('0x4e'));emit(util[_0x652a('0x10')](_0x652a('0x5a'),_0x39c80a[_0x652a('0x18')]),'trigger:browser:url',{'uri':util['format'](_0x652a('0x50'),_0x32b299['remoteUri'],_0x5e333f['id'])});}})[_0x652a('0x51')](function(_0x42f748){logger['error'](_0x652a('0x55'),JSON['stringify'](_0x42f748));});};exports[_0x652a('0x5b')]=function(_0x38b6c3,_0x4e3313,_0x4b5ec8,_0x5f4fc8,_0x55d742,_0x456f33){var _0x126598,_0x9baa6e;_0x456f33[_0x652a('0x1d')]=intUtil[_0x652a('0x45')](_0x456f33[_0x652a('0x1d')]);_0x456f33[_0x652a('0x44')]=intUtil[_0x652a('0x45')](_0x456f33[_0x652a('0x44')]);if(_0x55d742&&_0x55d742[_0x652a('0x46')]){logger['info']('['+_0x4e3313['lastevent'][_0x652a('0x5c')]()+']',_0x652a('0x56'));_0x4e3313['recordingURL']=util['format'](_0x652a('0x5d'),_0x456f33[_0x652a('0x44')],_0x4e3313[_0x652a('0x49')],md5(_0x4e3313[_0x652a('0x49')]));}else{_0x4e3313[_0x652a('0x48')]='';}headers[_0x652a('0x4a')]=getAuth(_0x456f33);return getUser(_0x456f33,'')[_0x652a('0x1f')](function(_0x4fd315){_0x126598=_0x4fd315;logger[_0x652a('0xd')](_0x652a('0x4b'),_0x126598['id']);return getEndUser(_0x456f33,_0x4e3313['calleridname'],_0x4e3313[_0x652a('0x4c')]);})[_0x652a('0x1f')](function(_0x427554){_0x9baa6e=_0x427554;logger['info'](_0x652a('0x59'),_0x9baa6e['id']);return getTicket(_0x456f33,_0x126598,_0x9baa6e,_0x4b5ec8,_0x4e3313);})['then'](function(_0x2a860d){if(_0x2a860d){logger['info'](_0x652a('0x20'));logger[_0x652a('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2a860d['id']);}})[_0x652a('0x51')](function(_0x5137bd){logger[_0x652a('0x52')]('['+_0x4e3313[_0x652a('0x5e')]['toUpperCase']()+']',JSON[_0x652a('0x32')](_0x5137bd));});}; \ No newline at end of file +var _0x89e0=['ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','
','Tags','Fields','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','info','Agent\x20found!','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','customVariable','Variable','name','push','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','user:%s','error','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x89e0,0x1cd));var _0x089e=function(_0x1cc6c9,_0x1be68d){_0x1cc6c9=_0x1cc6c9-0x0;var _0x22c4e2=_0x89e0[_0x1cc6c9];return _0x22c4e2;};'use strict';var _=require(_0x089e('0x0'));var rp=require(_0x089e('0x1'));var md5=require(_0x089e('0x2'));var util=require(_0x089e('0x3'));var Redis=require(_0x089e('0x4'));var intUtil=require(_0x089e('0x5'));var config=require(_0x089e('0x6'));var logger=require(_0x089e('0x7'))(_0x089e('0x8'));config['redis']=_[_0x089e('0x9')](config[_0x089e('0xa')],{'host':_0x089e('0xb'),'port':0x18eb});var io=require(_0x089e('0xc'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x286ae1,_0x369443,_0x2f9ad4){io['to'](_0x286ae1)['emit'](_0x369443,_0x2f9ad4);}function getTicket(_0x26ccd8,_0x1aa00e,_0x2f60a0,_0x3bbe35,_0x45d3d6){logger['info'](_0x089e('0xd'));var _0x3870b8=_[_0x089e('0xe')]({'responder_id':_0x1aa00e['id'],'requester_id':_0x2f60a0['id'],'name':util['format'](_0x089e('0xf'),_0x45d3d6[_0x089e('0x10')]),'phone':_0x45d3d6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3bbe35[_0x089e('0x11')],_0x45d3d6,'\x20'),'description':intUtil[_0x089e('0x12')](_0x3bbe35[_0x089e('0x13')],_0x45d3d6,_0x089e('0x14')),'tags':getTags(_0x3bbe35[_0x089e('0x15')],'name')},getCustomFields(_0x3bbe35[_0x089e('0x16')],_0x45d3d6));_0x3870b8[_0x089e('0x17')]=_['mapValues'](_['keyBy'](_0x3870b8[_0x089e('0x17')],'id'),_0x089e('0x18'));return request({'uri':util[_0x089e('0x19')](_0x089e('0x1a'),_0x26ccd8[_0x089e('0x1b')]),'method':_0x089e('0x1c'),'body':_0x3870b8})[_0x089e('0x1d')](function(_0x146d59){logger['info'](_0x089e('0x1e'));return _0x146d59;});}function getUser(_0x4f3e27,_0x43e5db){if(intUtil[_0x089e('0x1f')](_0x43e5db)){return request({'uri':util['format']('%s/api/v2/agents',_0x4f3e27[_0x089e('0x1b')]),'qs':{'email':_0x43e5db}})[_0x089e('0x1d')](function(_0x121a0c){if(_0x121a0c[_0x089e('0x20')]){logger[_0x089e('0x21')](_0x089e('0x22'));return _['find'](_0x121a0c,function(_0x419d81){return _0x419d81[_0x089e('0x23')][_0x089e('0x24')]===_0x43e5db;});}else{logger[_0x089e('0x21')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x089e('0x25'),_0x4f3e27[_0x089e('0x1b')])})[_0x089e('0x1d')](function(_0x749b1b){logger[_0x089e('0x21')]('Admin\x20account\x20selected.');return _0x749b1b;});}});}else{logger[_0x089e('0x21')](_0x089e('0x26'));return request({'uri':util[_0x089e('0x19')](_0x089e('0x25'),_0x4f3e27[_0x089e('0x1b')])})[_0x089e('0x1d')](function(_0x2c0296){logger[_0x089e('0x21')](_0x089e('0x27'));return _0x2c0296;});}}function getEndUser(_0x11e2ec,_0x2898a7,_0x22d6f9){logger['info']('Searching\x20enduser\x20with\x20phone',_0x22d6f9);return request({'uri':util['format'](_0x089e('0x28'),_0x11e2ec[_0x089e('0x1b')]),'qs':{'phone':_0x22d6f9}})[_0x089e('0x1d')](function(_0x2a81ed){if(_0x2a81ed[_0x089e('0x20')]){logger[_0x089e('0x21')](_0x089e('0x29'));return _[_0x089e('0x2a')](_0x2a81ed,{'phone':_0x22d6f9});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x089e('0x19')](_0x089e('0x28'),_0x11e2ec[_0x089e('0x1b')]),'method':_0x089e('0x1c'),'body':{'name':_0x2898a7,'phone':_0x22d6f9}})[_0x089e('0x1d')](function(_0x2b3937){logger[_0x089e('0x21')](_0x089e('0x2b'));return _0x2b3937;});}});}function getAuth(_0x3f9a0b){return util[_0x089e('0x19')](_0x089e('0x2c'),new Buffer(_0x3f9a0b['apiKey']+':X')[_0x089e('0x2d')](_0x089e('0x2e')));}function request(_0x425c6c){logger[_0x089e('0x2f')](_0x089e('0x30'),JSON[_0x089e('0x31')](_0x425c6c));return rp(_[_0x089e('0x9')](_0x425c6c,{'method':_0x089e('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x3f9da4,_0x163105){var _0x54349f=[];if(_0x3f9da4&&_0x3f9da4[_0x089e('0x20')]>0x0){_0x54349f=_[_0x089e('0x33')](_0x3f9da4,_0x163105);}return _0x54349f;}function getCustomFields(_0x3b7c1a,_0x5a430d){var _0x2f068a=[];var _0x2167a7={'custom_fields':[]};if(_0x3b7c1a[_0x089e('0x20')]>0x0){_[_0x089e('0x34')](_0x3b7c1a,function(_0x15ce11){if(_[_0x089e('0x35')](['string',_0x089e('0x36')],_0x15ce11[_0x089e('0x37')])&&_0x15ce11[_0x089e('0x38')]&&!_0x15ce11[_0x089e('0x39')]){_0x2167a7[_0x15ce11[_0x089e('0x38')][_0x089e('0x3a')]()]=_0x15ce11[_0x089e('0x3b')][_0x089e('0x2d')]();}else if(_[_0x089e('0x35')](['string',_0x089e('0x36')],_0x15ce11[_0x089e('0x37')])&&_0x15ce11[_0x089e('0x3c')]&&_0x15ce11['customField']){_0x2167a7[_0x089e('0x17')]['push']({'id':_0x15ce11[_0x089e('0x3c')],'value':_0x15ce11['content'][_0x089e('0x2d')]()});}else if(_0x15ce11[_0x089e('0x37')]===_0x089e('0x3d')&&_0x15ce11['variableName']&&_0x15ce11[_0x089e('0x3c')]&&_0x15ce11[_0x089e('0x39')]){_0x5a430d[_0x15ce11[_0x089e('0x3e')]]&&_0x2167a7[_0x089e('0x17')]['push']({'id':_0x15ce11['idField'],'value':_0x5a430d[_0x15ce11['variableName']][_0x089e('0x2d')]()});}else if(_0x15ce11[_0x089e('0x37')]===_0x089e('0x3f')&&_0x15ce11[_0x089e('0x40')]&&_0x15ce11[_0x089e('0x40')][_0x089e('0x41')]&&_0x15ce11[_0x089e('0x3c')]&&_0x15ce11[_0x089e('0x39')]){_0x5a430d[_0x15ce11[_0x089e('0x40')][_0x089e('0x41')]['toLowerCase']()]&&_0x2167a7[_0x089e('0x17')][_0x089e('0x42')]({'id':_0x15ce11[_0x089e('0x3c')],'value':_0x5a430d[_0x15ce11[_0x089e('0x40')]['name'][_0x089e('0x3a')]()]['toString']()});}});}return _0x2167a7;}exports['queue']=function(_0x33c8c3,_0xa99341,_0x2c6174,_0x167020,_0x53fa70,_0x60e905){var _0x382942,_0x48bfd9;_0x60e905['remoteUri']=intUtil['stripTrailingSlash'](_0x60e905[_0x089e('0x1b')]);_0x60e905[_0x089e('0x43')]=intUtil[_0x089e('0x44')](_0x60e905[_0x089e('0x43')]);if(_0x53fa70&&_0x53fa70[_0x089e('0x45')]){logger['info'](_0x089e('0x46'),'Recording\x20is\x20enabled!');_0xa99341[_0x089e('0x47')]=util['format'](_0x089e('0x48'),_0x60e905[_0x089e('0x43')],_0xa99341[_0x089e('0x49')],md5(_0xa99341['uniqueid']));}else{_0xa99341[_0x089e('0x47')]='';}headers['Authorization']=getAuth(_0x60e905);return getUser(_0x60e905,_0x167020['email'])[_0x089e('0x1d')](function(_0x33dc68){_0x382942=_0x33dc68;logger[_0x089e('0x21')]('The\x20User\x20ID\x20is:',_0x382942['id']);return getEndUser(_0x60e905,_0xa99341['calleridname'],_0xa99341[_0x089e('0x4a')]);})['then'](function(_0x58f2b6){_0x48bfd9=_0x58f2b6;logger[_0x089e('0x21')](_0x089e('0x4b'),_0x48bfd9['id']);return getTicket(_0x60e905,_0x382942,_0x48bfd9,_0x2c6174,_0xa99341);})[_0x089e('0x1d')](function(_0x330718){if(_0x330718&&_0x330718['id']){logger['info'](_0x089e('0x1e'));logger[_0x089e('0x21')](_0x089e('0x4c'),_0x330718['id']);logger[_0x089e('0x21')]('[QUEUE]',_0x089e('0x4d'));emit(util['format']('user:%s',_0x167020[_0x089e('0x41')]),_0x089e('0x4e'),{'uri':util['format'](_0x089e('0x4f'),_0x60e905['remoteUri'],_0x330718['id'])});}})[_0x089e('0x50')](function(_0x24f778){logger['error'](_0x089e('0x46'),JSON['stringify'](_0x24f778));});};exports[_0x089e('0x51')]=function(_0x271e1c,_0x485f16,_0x912281,_0x2a6176,_0x437aec,_0x3b80cc,_0x3b1347){var _0x4fef15,_0x36d172;_0x3b80cc[_0x089e('0x1b')]=intUtil['stripTrailingSlash'](_0x3b80cc[_0x089e('0x1b')]);_0x3b80cc[_0x089e('0x43')]=intUtil[_0x089e('0x44')](_0x3b80cc[_0x089e('0x43')]);if(_0x3b1347&&_0x3b1347[_0x089e('0x52')]&&_0x3b1347[_0x089e('0x52')]!=='none'){logger['info'](_0x089e('0x53'),'Recording\x20is\x20enabled!');_0x485f16[_0x089e('0x47')]=util[_0x089e('0x19')](_0x089e('0x48'),_0x3b80cc['serverUrl'],_0x485f16[_0x089e('0x49')],md5(_0x485f16[_0x089e('0x49')]));}headers[_0x089e('0x54')]=getAuth(_0x3b80cc);return getUser(_0x3b80cc,_0x2a6176[_0x089e('0x24')])['then'](function(_0x2b88bb){_0x4fef15=_0x2b88bb;logger[_0x089e('0x21')]('The\x20User\x20ID\x20is:',_0x4fef15['id']);return getEndUser(_0x3b80cc,_0x485f16[_0x089e('0x55')],_0x485f16[_0x089e('0x56')]);})['then'](function(_0x4b7615){_0x36d172=_0x4b7615;logger['info'](_0x089e('0x4b'),_0x36d172['id']);return getTicket(_0x3b80cc,_0x4fef15,_0x36d172,_0x912281,_0x485f16);})['then'](function(_0x2bf0d9){if(_0x2bf0d9&&_0x2bf0d9['id']){logger[_0x089e('0x21')](_0x089e('0x1e'));logger[_0x089e('0x21')](_0x089e('0x4c'),_0x2bf0d9['id']);logger[_0x089e('0x21')](_0x089e('0x53'),_0x089e('0x4d'));emit(util[_0x089e('0x19')](_0x089e('0x57'),_0x2a6176[_0x089e('0x41')]),_0x089e('0x4e'),{'uri':util[_0x089e('0x19')]('%s/helpdesk/tickets/%d',_0x3b80cc[_0x089e('0x1b')],_0x2bf0d9['id'])});}})[_0x089e('0x50')](function(_0x19e093){logger[_0x089e('0x58')](_0x089e('0x53'),JSON[_0x089e('0x31')](_0x19e093));});};exports[_0x089e('0x59')]=function(_0xa9964b,_0xa6be68,_0x21ab68,_0x235a80,_0x12202f,_0x1c909e){var _0x3770cb,_0x8939b9;_0x1c909e[_0x089e('0x1b')]=intUtil[_0x089e('0x44')](_0x1c909e['remoteUri']);_0x1c909e[_0x089e('0x43')]=intUtil['stripTrailingSlash'](_0x1c909e[_0x089e('0x43')]);if(_0x12202f&&_0x12202f[_0x089e('0x45')]){logger[_0x089e('0x21')]('['+_0xa6be68[_0x089e('0x5a')][_0x089e('0x5b')]()+']','Recording\x20is\x20enabled!');_0xa6be68['recordingURL']=util[_0x089e('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c909e[_0x089e('0x43')],_0xa6be68['uniqueid'],md5(_0xa6be68[_0x089e('0x49')]));}else{_0xa6be68[_0x089e('0x47')]='';}headers['Authorization']=getAuth(_0x1c909e);return getUser(_0x1c909e,'')[_0x089e('0x1d')](function(_0x94f8a7){_0x3770cb=_0x94f8a7;logger[_0x089e('0x21')](_0x089e('0x5c'),_0x3770cb['id']);return getEndUser(_0x1c909e,_0xa6be68[_0x089e('0x10')],_0xa6be68[_0x089e('0x4a')]);})[_0x089e('0x1d')](function(_0x36d79a){_0x8939b9=_0x36d79a;logger[_0x089e('0x21')](_0x089e('0x4b'),_0x8939b9['id']);return getTicket(_0x1c909e,_0x3770cb,_0x8939b9,_0x21ab68,_0xa6be68);})[_0x089e('0x1d')](function(_0x4e9fc3){if(_0x4e9fc3){logger[_0x089e('0x21')](_0x089e('0x1e'));logger[_0x089e('0x21')](_0x089e('0x4c'),_0x4e9fc3['id']);}})[_0x089e('0x50')](function(_0x10289a){logger[_0x089e('0x58')]('['+_0xa6be68[_0x089e('0x5a')][_0x089e('0x5b')]()+']',JSON[_0x089e('0x31')](_0x10289a));});}; \ 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 ac1c19e..3a53f31 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 _0xb091=['/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','moment','ioredis','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','/api/lookup?q=','&f=','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','Task\x20created:'];(function(_0x4f53d2,_0x373000){var _0x1587db=function(_0x4d2c4c){while(--_0x4d2c4c){_0x4f53d2['push'](_0x4f53d2['shift']());}};_0x1587db(++_0x373000);}(_0xb091,0x16e));var _0x1b09=function(_0x529a90,_0x485f44){_0x529a90=_0x529a90-0x0;var _0x2381dd=_0xb091[_0x529a90];return _0x2381dd;};'use strict';var _=require('lodash');var rp=require(_0x1b09('0x0'));var md5=require(_0x1b09('0x1'));var util=require(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var Promise=require('bluebird');var Redis=require(_0x1b09('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1b09('0x5'))(_0x1b09('0x6'));config['redis']=_[_0x1b09('0x7')](config[_0x1b09('0x8')],{'host':_0x1b09('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1b09('0x8')]));function getAdminId(_0x8c26a5,_0x2f359f,_0x328815,_0x159b95){return new Promise(function(_0x3362e4,_0x211f05){var _0x124d02=![];var _0x3249a1={'method':_0x1b09('0xa'),'uri':_0x159b95+_0x1b09('0xb'),'json':!![]};_0x3249a1['headers']=_0x328815;logger[_0x1b09('0xc')](_0x1b09('0xd'));return rp(_0x3249a1)['then'](function(_0x4c28c4){if(_0x4c28c4){var _0x3839d9=_0x4c28c4[_0x1b09('0xe')];var _0x3ae4a0=null;for(_0x3ae4a0=0x0;_0x3ae4a0<_0x3839d9[_0x1b09('0xf')];_0x3ae4a0++){if(_0x3839d9[_0x3ae4a0][_0x1b09('0x10')]===_0x8c26a5[_0x1b09('0x11')]){_0x8c26a5[_0x1b09('0x12')]=_0x3839d9[_0x3ae4a0]['id'];_0x124d02=!![];}}if(_0x124d02){logger['info'](_0x1b09('0x13'),_0x8c26a5['adminId']);_0x3362e4(_0x8c26a5);}else{_0x211f05({'statusCode':0x194,'message':_0x1b09('0x14')});}}else{_0x211f05({'statusCode':0x194,'message':_0x1b09('0x14')});}})[_0x1b09('0x15')](function(_0x37673e){logger[_0x1b09('0x16')]('['+[_0x2f359f[_0x1b09('0x17')]()]+']',_0x37673e[_0x1b09('0x18')]);_0x211f05(_0x37673e);});});}function getUser(_0x33129b,_0x1196b2,_0x32244e){return function(_0x311158){return new Promise(function(_0x231ef6,_0x646575){var _0x4c64e1={'method':_0x1b09('0xa'),'uri':_0x32244e+_0x1b09('0xb'),'json':!![]};_0x4c64e1['headers']=_0x1196b2;logger['info'](_0x1b09('0x19'));return rp(_0x4c64e1)['then'](function(_0x267b5e){if(_0x267b5e){var _0x5bb127=_0x267b5e[_0x1b09('0xe')];var _0x4b2eab=![];var _0x2d6dba=null;if(_0x311158[_0x1b09('0x1a')]!==null){logger[_0x1b09('0xc')](_0x1b09('0x1b'),_0x311158[_0x1b09('0x1a')]);_0x311158[_0x1b09('0x1c')]=_0x311158['agentEmail'];for(_0x2d6dba=0x0;_0x2d6dba<_0x5bb127['length'];_0x2d6dba++){if(_0x5bb127[_0x2d6dba][_0x1b09('0x10')]===_0x311158[_0x1b09('0x1a')]){_0x4b2eab=!![];_0x311158['userId']=_0x5bb127[_0x2d6dba]['id'];logger[_0x1b09('0xc')](_0x1b09('0x1d'),_0x311158[_0x1b09('0x1e')]);}}}if(!_0x4b2eab){logger[_0x1b09('0xc')]('Admin\x20selected');_0x311158[_0x1b09('0x1c')]=_0x311158[_0x1b09('0x11')];_0x311158['userId']=_0x311158[_0x1b09('0x12')];_0x4b2eab=!![];}if(_0x4b2eab){_0x231ef6(_0x311158);}else{_0x646575({'statusCode':0x194,'message':_0x1b09('0x14')});}}else{_0x646575({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1b09('0x15')](function(_0x108d80){logger[_0x1b09('0x16')]('['+[_0x33129b[_0x1b09('0x17')]()]+']',_0x108d80['message']);_0x646575(_0x108d80);});});};}function searchContact(_0xb3cf07,_0x3cdbc5,_0x532589,_0x2d1ec0){return new Promise(function(_0x406748,_0x26befb){var _0x1cbbd5={'method':_0x1b09('0xa'),'headers':_0x3cdbc5,'uri':_0xb3cf07+_0x1b09('0x1f')+_0x2d1ec0+_0x1b09('0x20')+_0x532589+'&entities=contact','json':!![]};rp(_0x1cbbd5)[_0x1b09('0x21')](function(_0x3e6a4d){var _0x4bf0ad=_[_0x1b09('0x22')](_0x3e6a4d[_0x1b09('0x23')][_0x1b09('0x23')],[_0x532589,_0x2d1ec0]);_0x406748(_0x4bf0ad);})[_0x1b09('0x15')](function(_0x62a96b){_0x26befb(_0x62a96b);});});}function getEndUser(_0x4b3aec,_0x4540de,_0x54bf30){return function(_0x143829){return new Promise(function(_0x4eef8c,_0x1ee079){logger[_0x1b09('0xc')](util[_0x1b09('0x24')](_0x1b09('0x25'),_0x143829[_0x1b09('0x26')]));searchContact(_0x54bf30,_0x4540de,_0x1b09('0x27'),_0x143829[_0x1b09('0x26')])[_0x1b09('0x21')](function(_0x2db0e0){if(_0x2db0e0){_0x143829[_0x1b09('0x28')]=_0x2db0e0['id'];logger['info'](_0x1b09('0x29'),_0x143829[_0x1b09('0x28')]);return _0x4eef8c(_0x143829);}searchContact(_0x54bf30,_0x4540de,_0x1b09('0x2a'),_0x143829['contactNumber'])[_0x1b09('0x21')](function(_0x339b66){if(_0x339b66){_0x143829[_0x1b09('0x28')]=_0x339b66['id'];logger[_0x1b09('0xc')](_0x1b09('0x2b'),_0x143829[_0x1b09('0x28')]);return _0x4eef8c(_0x143829);}createEndUser(_0x143829,_0x4b3aec,_0x4540de,_0x54bf30)[_0x1b09('0x21')](function(_0x1fff0b){logger['info'](_0x1b09('0x2c'),_0x1fff0b['endUserId']);return _0x4eef8c(_0x1fff0b);});});})[_0x1b09('0x15')](function(_0x4e6c6b){_0x1ee079(_0x4e6c6b);});});};}function createEndUser(_0x3243ee,_0x278aa8,_0x46e202,_0x2ba156){return new Promise(function(_0x226cc1,_0x37f240){var _0x659067=moment();var _0x466502={'method':_0x1b09('0x2d'),'uri':_0x2ba156+_0x1b09('0x2e'),'body':{'contact':{'last_name':_0x3243ee[_0x1b09('0x26')],'work_number':_0x3243ee[_0x1b09('0x26')],'mobile_number':_0x3243ee[_0x1b09('0x26')],'owner_id':_0x3243ee['userId'],'created_at':_0x659067['format'](_0x1b09('0x2f'))}},'json':!![]};_0x466502[_0x1b09('0x30')]=_0x46e202;logger[_0x1b09('0xc')](_0x1b09('0x31'));return rp(_0x466502)[_0x1b09('0x21')](function(_0x219258){_0x3243ee[_0x1b09('0x28')]=_0x219258[_0x1b09('0x32')]['id'];_0x226cc1(_0x3243ee);})['catch'](function(_0x5d2667){logger[_0x1b09('0x16')]('['+[_0x278aa8['toUpperCase']()]+']',_0x5d2667[_0x1b09('0x18')]);_0x37f240(_0x5d2667[_0x1b09('0x18')]);});});}function getTicket(_0x1434ef,_0x5f2522,_0x4401ad,_0x23bdde,_0x202b18){return function(_0x58c7c2){logger[_0x1b09('0xc')](_0x1b09('0x33'));return new Promise(function(_0x237b99,_0xc34040){var _0x54eca0=moment();var _0x36f814={'method':_0x1b09('0x2d'),'uri':_0x4401ad+'/api/tasks','body':{'title':intUtil[_0x1b09('0x34')](_0x23bdde[_0x1b09('0x35')],_0x202b18,'\x20'),'description':intUtil['getString'](_0x23bdde['Descriptions'],_0x202b18,'\x0a'),'owner_id':_0x58c7c2['userId'],'creater_id':_0x58c7c2['adminId'],'targetable_id':_0x58c7c2[_0x1b09('0x28')],'targetable_type':_0x1b09('0x36'),'created_at':_0x54eca0[_0x1b09('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x54eca0[_0x1b09('0x37')](0x1e,'m')[_0x1b09('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x36f814[_0x1b09('0x30')]=_0x5f2522;return rp(_0x36f814)[_0x1b09('0x21')](function(_0x371277){_0x58c7c2[_0x1b09('0x38')]=_0x371277[_0x1b09('0x39')]['id'];logger[_0x1b09('0xc')](_0x1b09('0x3a'),_0x58c7c2[_0x1b09('0x38')]);_0x237b99(_0x58c7c2);})[_0x1b09('0x15')](function(_0x176c2f){logger['error']('['+[_0x1434ef[_0x1b09('0x17')]()]+']',_0x176c2f[_0x1b09('0x18')]);_0xc34040(_0x176c2f[_0x1b09('0x18')]);});});};}function emit(_0x5bbfef,_0x2ab6ca,_0x4bf205){var _0x2b3244={'uri':_0x5bbfef+_0x1b09('0x3b')+_0x4bf205};io['to'](util['format'](_0x1b09('0x3c'),_0x2ab6ca))[_0x1b09('0x3d')](_0x1b09('0x3e'),_0x2b3244);}exports['cs']=function(_0x25443a,_0x13294c,_0x1b88a2,_0x51402f,_0x479dfc,_0x5df547,_0x35d9ee,_0x58a158){var _0x50a66c={};var _0x55376={'Authorization':_0x1b09('0x3f')+_0x5df547[_0x1b09('0x40')]};_0x5df547[_0x1b09('0x41')]=intUtil[_0x1b09('0x42')](_0x5df547[_0x1b09('0x41')]);_0x5df547[_0x1b09('0x43')]=intUtil[_0x1b09('0x42')](_0x5df547['serverUrl']);var _0x24028e=_0x5df547[_0x1b09('0x41')];_0x50a66c[_0x1b09('0x11')]=_0x5df547['username'];_0x50a66c['contactNumber']=_0x58a158[_0x1b09('0x44')]()==='outbound'?_0x13294c[_0x1b09('0x45')]:_0x13294c[_0x1b09('0x46')];_0x50a66c['callDirection']=_0x58a158===_0x1b09('0x47')||_0x58a158===_0x1b09('0x48')?'queue':_0x1b09('0x49');if(_0x51402f){_0x50a66c[_0x1b09('0x1a')]=_0x51402f[_0x1b09('0x10')];}var _0x3d4144=util[_0x1b09('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5df547[_0x1b09('0x43')],_0x13294c[_0x1b09('0x4a')],md5(_0x13294c[_0x1b09('0x4a')]));if(_0x479dfc&&_0x479dfc[_0x1b09('0x4b')]){logger[_0x1b09('0xc')](_0x1b09('0x4c'),_0x1b09('0x4d'));_0x13294c['recordingURL']=_0x3d4144;}else if(_0x35d9ee&&_0x35d9ee['recordingFormat']&&_0x35d9ee[_0x1b09('0x4e')]!==_0x1b09('0x4f')){logger[_0x1b09('0xc')]('[OUTBOUND]',_0x1b09('0x4d'));_0x13294c[_0x1b09('0x50')]=_0x3d4144;}else{_0x13294c[_0x1b09('0x50')]='';}return getAdminId(_0x50a66c,_0x58a158,_0x55376,_0x24028e)['then'](getUser(_0x58a158,_0x55376,_0x24028e))[_0x1b09('0x21')](getEndUser(_0x58a158,_0x55376,_0x24028e))[_0x1b09('0x21')](getTicket(_0x58a158,_0x55376,_0x24028e,_0x1b88a2,_0x13294c))[_0x1b09('0x21')](function(_0x1c4864){logger[_0x1b09('0xc')](util[_0x1b09('0x24')](_0x1b09('0x51'),_0x1c4864[_0x1b09('0x38')]));if(_0x58a158!==_0x1b09('0x48')){logger[_0x1b09('0xc')]('['+[_0x58a158[_0x1b09('0x17')]()]+']',_0x1b09('0x52'));emit(_0x24028e,_0x51402f[_0x1b09('0x53')],_0x1c4864[_0x1b09('0x28')]);}})[_0x1b09('0x15')](function(_0x4ca41c){logger['error']('['+[_0x58a158[_0x1b09('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x1b09('0x54')](_0x4ca41c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2f2e=['../../../../config/logger','redis','localhost','socket.io-emitter','GET','headers','info','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','error','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','moment','ioredis','./util','../../../../config/environment'];(function(_0x3d313d,_0x57c805){var _0x3a64a3=function(_0x4a5b7e){while(--_0x4a5b7e){_0x3d313d['push'](_0x3d313d['shift']());}};_0x3a64a3(++_0x57c805);}(_0x2f2e,0x146));var _0xe2f2=function(_0x3be0c4,_0x5b7eff){_0x3be0c4=_0x3be0c4-0x0;var _0x11af9f=_0x2f2e[_0x3be0c4];return _0x11af9f;};'use strict';var _=require('lodash');var rp=require(_0xe2f2('0x0'));var md5=require(_0xe2f2('0x1'));var util=require('util');var moment=require(_0xe2f2('0x2'));var Promise=require('bluebird');var Redis=require(_0xe2f2('0x3'));var intUtil=require(_0xe2f2('0x4'));var config=require(_0xe2f2('0x5'));var logger=require(_0xe2f2('0x6'))('freshsales');config['redis']=_['defaults'](config[_0xe2f2('0x7')],{'host':_0xe2f2('0x8'),'port':0x18eb});var io=require(_0xe2f2('0x9'))(new Redis(config[_0xe2f2('0x7')]));function getAdminId(_0x48111c,_0x514125,_0x4bd8ed,_0x40574d){return new Promise(function(_0x48ee72,_0x3040e3){var _0x15b3c7=![];var _0x81d7a7={'method':_0xe2f2('0xa'),'uri':_0x40574d+'/api/selector/owners','json':!![]};_0x81d7a7[_0xe2f2('0xb')]=_0x4bd8ed;logger[_0xe2f2('0xc')]('Getting\x20admin\x20information');return rp(_0x81d7a7)[_0xe2f2('0xd')](function(_0x444b7f){if(_0x444b7f){var _0x42602a=_0x444b7f[_0xe2f2('0xe')];var _0x46a87e=null;for(_0x46a87e=0x0;_0x46a87e<_0x42602a[_0xe2f2('0xf')];_0x46a87e++){if(_0x42602a[_0x46a87e][_0xe2f2('0x10')]===_0x48111c[_0xe2f2('0x11')]){_0x48111c[_0xe2f2('0x12')]=_0x42602a[_0x46a87e]['id'];_0x15b3c7=!![];}}if(_0x15b3c7){logger[_0xe2f2('0xc')]('Admin\x20found:',_0x48111c[_0xe2f2('0x12')]);_0x48ee72(_0x48111c);}else{_0x3040e3({'statusCode':0x194,'message':_0xe2f2('0x13')});}}else{_0x3040e3({'statusCode':0x194,'message':_0xe2f2('0x13')});}})[_0xe2f2('0x14')](function(_0x43e4e5){logger['error']('['+[_0x514125['toUpperCase']()]+']',_0x43e4e5[_0xe2f2('0x15')]);_0x3040e3(_0x43e4e5);});});}function getUser(_0xb11b33,_0x37f965,_0x49431e){return function(_0x86c42b){return new Promise(function(_0x653f02,_0x22433f){var _0x511d90={'method':_0xe2f2('0xa'),'uri':_0x49431e+_0xe2f2('0x16'),'json':!![]};_0x511d90[_0xe2f2('0xb')]=_0x37f965;logger[_0xe2f2('0xc')](_0xe2f2('0x17'));return rp(_0x511d90)[_0xe2f2('0xd')](function(_0x5d664a){if(_0x5d664a){var _0x4041bd=_0x5d664a[_0xe2f2('0xe')];var _0x34a57c=![];var _0x596dd9=null;if(_0x86c42b[_0xe2f2('0x18')]!==null){logger[_0xe2f2('0xc')](_0xe2f2('0x19'),_0x86c42b[_0xe2f2('0x18')]);_0x86c42b[_0xe2f2('0x1a')]=_0x86c42b[_0xe2f2('0x18')];for(_0x596dd9=0x0;_0x596dd9<_0x4041bd[_0xe2f2('0xf')];_0x596dd9++){if(_0x4041bd[_0x596dd9]['email']===_0x86c42b[_0xe2f2('0x18')]){_0x34a57c=!![];_0x86c42b[_0xe2f2('0x1b')]=_0x4041bd[_0x596dd9]['id'];logger[_0xe2f2('0xc')](_0xe2f2('0x1c'),_0x86c42b[_0xe2f2('0x1b')]);}}}if(!_0x34a57c){logger[_0xe2f2('0xc')](_0xe2f2('0x1d'));_0x86c42b[_0xe2f2('0x1a')]=_0x86c42b[_0xe2f2('0x11')];_0x86c42b['userId']=_0x86c42b[_0xe2f2('0x12')];_0x34a57c=!![];}if(_0x34a57c){_0x653f02(_0x86c42b);}else{_0x22433f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x22433f({'statusCode':0x194,'message':_0xe2f2('0x13')});}})[_0xe2f2('0x14')](function(_0x28e8c4){logger['error']('['+[_0xb11b33[_0xe2f2('0x1e')]()]+']',_0x28e8c4['message']);_0x22433f(_0x28e8c4);});});};}function searchContact(_0x26ab29,_0x4cb3c5,_0x18fb06,_0x2d8a87){return new Promise(function(_0x1ec167,_0x45e3f8){var _0x33df93={'method':_0xe2f2('0xa'),'headers':_0x4cb3c5,'uri':_0x26ab29+'/api/lookup?q='+_0x2d8a87+_0xe2f2('0x1f')+_0x18fb06+_0xe2f2('0x20'),'json':!![]};rp(_0x33df93)[_0xe2f2('0xd')](function(_0x4abae7){var _0x5cb38d=_[_0xe2f2('0x21')](_0x4abae7[_0xe2f2('0x22')][_0xe2f2('0x22')],[_0x18fb06,_0x2d8a87]);_0x1ec167(_0x5cb38d);})[_0xe2f2('0x14')](function(_0x54ebd9){_0x45e3f8(_0x54ebd9);});});}function getEndUser(_0x49b67a,_0x5db897,_0x744652){return function(_0x3511a5){return new Promise(function(_0x33f30a,_0x19ae85){logger['info'](util[_0xe2f2('0x23')](_0xe2f2('0x24'),_0x3511a5[_0xe2f2('0x25')]));searchContact(_0x744652,_0x5db897,'mobile_number',_0x3511a5['contactNumber'])['then'](function(_0x3009cf){if(_0x3009cf){_0x3511a5[_0xe2f2('0x26')]=_0x3009cf['id'];logger[_0xe2f2('0xc')](_0xe2f2('0x27'),_0x3511a5[_0xe2f2('0x26')]);return _0x33f30a(_0x3511a5);}searchContact(_0x744652,_0x5db897,'work_number',_0x3511a5[_0xe2f2('0x25')])['then'](function(_0x1a62c2){if(_0x1a62c2){_0x3511a5[_0xe2f2('0x26')]=_0x1a62c2['id'];logger['info'](_0xe2f2('0x28'),_0x3511a5[_0xe2f2('0x26')]);return _0x33f30a(_0x3511a5);}createEndUser(_0x3511a5,_0x49b67a,_0x5db897,_0x744652)[_0xe2f2('0xd')](function(_0x9d9f8f){logger[_0xe2f2('0xc')](_0xe2f2('0x29'),_0x9d9f8f[_0xe2f2('0x26')]);return _0x33f30a(_0x9d9f8f);});});})[_0xe2f2('0x14')](function(_0x5532a8){_0x19ae85(_0x5532a8);});});};}function createEndUser(_0x5f3c24,_0x4321e4,_0x535aef,_0x466110){return new Promise(function(_0x2d4abb,_0x2ff019){var _0x578316=moment();var _0x38f34f={'method':'POST','uri':_0x466110+_0xe2f2('0x2a'),'body':{'contact':{'last_name':_0x5f3c24[_0xe2f2('0x25')],'work_number':_0x5f3c24[_0xe2f2('0x25')],'mobile_number':_0x5f3c24[_0xe2f2('0x25')],'owner_id':_0x5f3c24[_0xe2f2('0x1b')],'created_at':_0x578316[_0xe2f2('0x23')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x38f34f[_0xe2f2('0xb')]=_0x535aef;logger[_0xe2f2('0xc')](_0xe2f2('0x2b'));return rp(_0x38f34f)[_0xe2f2('0xd')](function(_0x3d5db3){_0x5f3c24[_0xe2f2('0x26')]=_0x3d5db3[_0xe2f2('0x2c')]['id'];_0x2d4abb(_0x5f3c24);})[_0xe2f2('0x14')](function(_0x577be0){logger['error']('['+[_0x4321e4[_0xe2f2('0x1e')]()]+']',_0x577be0['message']);_0x2ff019(_0x577be0[_0xe2f2('0x15')]);});});}function getTicket(_0x4ae957,_0x218d96,_0x370639,_0x435558,_0x4c9299){return function(_0x34144c){logger[_0xe2f2('0xc')](_0xe2f2('0x2d'));return new Promise(function(_0x260f2e,_0x27b3d0){var _0x448bfa=moment();var _0x3b4da0={'method':_0xe2f2('0x2e'),'uri':_0x370639+'/api/tasks','body':{'title':intUtil[_0xe2f2('0x2f')](_0x435558[_0xe2f2('0x30')],_0x4c9299,'\x20'),'description':intUtil['getString'](_0x435558[_0xe2f2('0x31')],_0x4c9299,'\x0a'),'owner_id':_0x34144c['userId'],'creater_id':_0x34144c['adminId'],'targetable_id':_0x34144c[_0xe2f2('0x26')],'targetable_type':_0xe2f2('0x32'),'created_at':_0x448bfa['format'](_0xe2f2('0x33')),'due_date':_0x448bfa[_0xe2f2('0x34')](0x1e,'m')[_0xe2f2('0x23')](_0xe2f2('0x33'))},'json':!![]};_0x3b4da0['headers']=_0x218d96;return rp(_0x3b4da0)[_0xe2f2('0xd')](function(_0x298587){_0x34144c[_0xe2f2('0x35')]=_0x298587[_0xe2f2('0x36')]['id'];logger[_0xe2f2('0xc')]('Task\x20created:',_0x34144c['ticketId']);_0x260f2e(_0x34144c);})[_0xe2f2('0x14')](function(_0x34774f){logger[_0xe2f2('0x37')]('['+[_0x4ae957[_0xe2f2('0x1e')]()]+']',_0x34774f[_0xe2f2('0x15')]);_0x27b3d0(_0x34774f[_0xe2f2('0x15')]);});});};}function emit(_0x148056,_0x34006b,_0x38a072){var _0x3b41bb={'uri':_0x148056+_0xe2f2('0x38')+_0x38a072};io['to'](util['format'](_0xe2f2('0x39'),_0x34006b))[_0xe2f2('0x3a')](_0xe2f2('0x3b'),_0x3b41bb);}exports['cs']=function(_0x4e6735,_0x42afaa,_0x4ea411,_0x4902dd,_0x4d877d,_0x4be747,_0x3805cf,_0x6c0195){var _0x34a7fa={};var _0x319be8={'Authorization':_0xe2f2('0x3c')+_0x4be747[_0xe2f2('0x3d')]};_0x4be747[_0xe2f2('0x3e')]=intUtil[_0xe2f2('0x3f')](_0x4be747[_0xe2f2('0x3e')]);_0x4be747[_0xe2f2('0x40')]=intUtil[_0xe2f2('0x3f')](_0x4be747[_0xe2f2('0x40')]);var _0x75888=_0x4be747['remoteUri'];_0x34a7fa[_0xe2f2('0x11')]=_0x4be747[_0xe2f2('0x41')];_0x34a7fa[_0xe2f2('0x25')]=_0x6c0195[_0xe2f2('0x42')]()===_0xe2f2('0x43')?_0x42afaa[_0xe2f2('0x44')]:_0x42afaa['calleridnum'];_0x34a7fa[_0xe2f2('0x45')]=_0x6c0195===_0xe2f2('0x46')||_0x6c0195===_0xe2f2('0x47')?_0xe2f2('0x46'):'outbound';if(_0x4902dd){_0x34a7fa[_0xe2f2('0x18')]=_0x4902dd[_0xe2f2('0x10')];}var _0x74295f=util[_0xe2f2('0x23')](_0xe2f2('0x48'),_0x4be747[_0xe2f2('0x40')],_0x42afaa[_0xe2f2('0x49')],md5(_0x42afaa[_0xe2f2('0x49')]));if(_0x4d877d&&_0x4d877d[_0xe2f2('0x4a')]){logger[_0xe2f2('0xc')](_0xe2f2('0x4b'),'Recording\x20is\x20enabled!');_0x42afaa[_0xe2f2('0x4c')]=_0x74295f;}else if(_0x3805cf&&_0x3805cf['recordingFormat']&&_0x3805cf[_0xe2f2('0x4d')]!==_0xe2f2('0x4e')){logger[_0xe2f2('0xc')]('[OUTBOUND]',_0xe2f2('0x4f'));_0x42afaa[_0xe2f2('0x4c')]=_0x74295f;}else{_0x42afaa[_0xe2f2('0x4c')]='';}return getAdminId(_0x34a7fa,_0x6c0195,_0x319be8,_0x75888)[_0xe2f2('0xd')](getUser(_0x6c0195,_0x319be8,_0x75888))[_0xe2f2('0xd')](getEndUser(_0x6c0195,_0x319be8,_0x75888))['then'](getTicket(_0x6c0195,_0x319be8,_0x75888,_0x4ea411,_0x42afaa))[_0xe2f2('0xd')](function(_0x2fe4b3){logger[_0xe2f2('0xc')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2fe4b3[_0xe2f2('0x35')]));if(_0x6c0195!=='unmanaged'){logger[_0xe2f2('0xc')]('['+[_0x6c0195[_0xe2f2('0x1e')]()]+']',_0xe2f2('0x50'));emit(_0x75888,_0x4902dd['name'],_0x2fe4b3[_0xe2f2('0x26')]);}})[_0xe2f2('0x14')](function(_0x9fb720){logger[_0xe2f2('0x37')]('['+[_0x6c0195[_0xe2f2('0x1e')]()]+_0xe2f2('0x51'),util[_0xe2f2('0x52')](_0x9fb720,{'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 5663917..b8f975d 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 _0x5c00=['format','error','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','dynamics365','unknown\x20integration','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]'];(function(_0x59137b,_0x20880e){var _0x267490=function(_0xcec6de){while(--_0xcec6de){_0x59137b['push'](_0x59137b['shift']());}};_0x267490(++_0x20880e);}(_0x5c00,0x17e));var _0x05c0=function(_0x321575,_0x458292){_0x321575=_0x321575-0x0;var _0x147fc3=_0x5c00[_0x321575];return _0x147fc3;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var zendesk=require(_0x05c0('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x05c0('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x05c0('0x4'));var desk=require(_0x05c0('0x5'));var vtiger=require(_0x05c0('0x6'));var servicenow=require(_0x05c0('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x05c0('0x8'));var integrations=[_0x05c0('0x9'),_0x05c0('0xa'),_0x05c0('0xb'),'freshdesk',_0x05c0('0xc'),_0x05c0('0xd'),_0x05c0('0xe'),'dynamics365',_0x05c0('0xf'),_0x05c0('0x10')];exports[_0x05c0('0x11')]=function(_0x321c09,_0x273b2d,_0x1edbb,_0x5226c5,_0x4f9f78,_0x5d4de1){if(_0x1edbb){if(_['includes'](integrations,_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]())){try{var _0xa50678=null;var _0x5a3e65='';var _0x4e39d4=_0x1edbb[_0x321c09['data1'][_0x05c0('0x13')]()];if(_0x4e39d4){var _0x49e07e=_0x4e39d4[_0x321c09[_0x05c0('0x14')]];if(_0x49e07e){var _0x12deeb=_[_0x05c0('0x15')](_0x49e07e[_0x05c0('0x16')],{'id':parseInt(_0x321c09[_0x05c0('0x17')],0xa)});if(_0x12deeb){if(_0x5226c5){if(_0x4f9f78&&_0x273b2d[_0x05c0('0x18')]){_0x5a3e65='queue';}else if(_0x273b2d[_0x05c0('0x19')]){_0x5a3e65=_0x05c0('0x1a');}else{console[_0x05c0('0x1b')](_0x05c0('0x1c'),_0x273b2d);}}else{_0x5a3e65=_0x05c0('0x1d');}switch(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]()){case _0x05c0('0x9'):zendesk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xa'):salesforce[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case'sugarcrm':sugarcrm[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0x1e'):freshdesk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xc'):zoho[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xd'):desk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case'vtiger':vtiger[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xf'):freshsales['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;case _0x05c0('0x10'):servicenow['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;case _0x05c0('0x1f'):dynamics365['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;default:console[_0x05c0('0x1b')](_0x05c0('0x20'));}}else{_0xa50678=require('../../../../config/logger')(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]());_0xa50678['error']('[EXEC]',util['format'](_0x05c0('0x21'),_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')](),_0x321c09[_0x05c0('0x17')]));}}else{_0xa50678=require(_0x05c0('0x22'))(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]());_0xa50678['error'](_0x05c0('0x23'),util[_0x05c0('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0x321c09['data1']['toLowerCase'](),_0x321c09['data2']));}}else{}}catch(_0x56aa78){console[_0x05c0('0x25')](_0x56aa78);}}}}; \ No newline at end of file +var _0x5f66=['dynamics365','freshsales','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger'];(function(_0x40ca38,_0x3f8184){var _0x503980=function(_0x13eb0a){while(--_0x13eb0a){_0x40ca38['push'](_0x40ca38['shift']());}};_0x503980(++_0x3f8184);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x65f6('0x1'));var sugarcrm=require(_0x65f6('0x2'));var freshdesk=require(_0x65f6('0x3'));var zoho=require(_0x65f6('0x4'));var desk=require(_0x65f6('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x65f6('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x65f6('0x7'));var integrations=[_0x65f6('0x8'),'salesforce','sugarcrm',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'servicenow'];exports['exec']=function(_0x18fea1,_0x2f6d5b,_0x264647,_0x25c416,_0x50d26d,_0x41a7fd){if(_0x264647){if(_['includes'](integrations,_0x18fea1['data1'][_0x65f6('0xf')]())){try{var _0x576875=null;var _0x419819='';var _0x4862a5=_0x264647[_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()];if(_0x4862a5){var _0x2c4ee5=_0x4862a5[_0x18fea1[_0x65f6('0x11')]];if(_0x2c4ee5){var _0x369f96=_[_0x65f6('0x12')](_0x2c4ee5[_0x65f6('0x13')],{'id':parseInt(_0x18fea1[_0x65f6('0x14')],0xa)});if(_0x369f96){if(_0x25c416){if(_0x50d26d&&_0x2f6d5b[_0x65f6('0x15')]){_0x419819=_0x65f6('0x15');}else if(_0x2f6d5b['routeId']){_0x419819=_0x65f6('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x2f6d5b);}}else{_0x419819=_0x65f6('0x17');}switch(_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()){case _0x65f6('0x8'):zendesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x18'):salesforce[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x19'):sugarcrm[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x9'):freshdesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xa'):zoho[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'desk':desk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'vtiger':vtiger[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xe'):freshsales['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'servicenow':servicenow['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'dynamics365':dynamics365['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;default:console['log'](_0x65f6('0x1a'));}}else{_0x576875=require(_0x65f6('0x1b'))(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')](_0x65f6('0x1d'),util[_0x65f6('0x1e')](_0x65f6('0x1f'),_0x18fea1[_0x65f6('0x10')]['toLowerCase'](),_0x18fea1[_0x65f6('0x14')]));}}else{_0x576875=require('../../../../config/logger')(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')]('[EXEC]',util[_0x65f6('0x1e')](_0x65f6('0x20'),_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')](),_0x18fea1['data2']));}}else{}}catch(_0x9d7bb0){console[_0x65f6('0x1c')](_0x9d7bb0);}}}}; \ 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 f55417a..1d0e447 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 _0x0594=['account','WhatId','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','execute','then','length','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','find','additionalSearchLead','Lead','account_contact_lead','Account','additionalSearchAccount','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','includes','picklist','idField','toString','variableName','customVariable','name','Variable','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead'];(function(_0x558623,_0x56afe7){var _0xfc0491=function(_0x3742da){while(--_0x3742da){_0x558623['push'](_0x558623['shift']());}};_0xfc0491(++_0x56afe7);}(_0x0594,0x1e9));var _0x4059=function(_0x57b2c5,_0x4f96a1){_0x57b2c5=_0x57b2c5-0x0;var _0x502ed8=_0x0594[_0x57b2c5];return _0x502ed8;};'use strict';var _=require(_0x4059('0x0'));var rp=require(_0x4059('0x1'));var moment=require(_0x4059('0x2'));var BPromise=require(_0x4059('0x3'));var md5=require(_0x4059('0x4'));var jsforce=require(_0x4059('0x5'));var util=require(_0x4059('0x6'));var Redis=require(_0x4059('0x7'));var intUtil=require(_0x4059('0x8'));var config=require(_0x4059('0x9'));var logger=require(_0x4059('0xa'))('salesforce');config['redis']=_[_0x4059('0xb')](config[_0x4059('0xc')],{'host':_0x4059('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2fba6b,_0x94f7ec,_0x20814e){io['to'](_0x2fba6b)[_0x4059('0xe')](_0x94f7ec,_0x20814e);}function getTicket(_0x4c20a1,_0x1ec4a5,_0x3dc18f,_0x53766c,_0x15aff6,_0x274101,_0x5236fc,_0x29e629){var _0x1a05c8=Object[_0x4059('0xf')]({},{'OwnerId':_0x1ec4a5['id'],'Subject':intUtil[_0x4059('0x10')](_0x53766c[_0x4059('0x11')],_0x15aff6,'\x20'),'Description':intUtil[_0x4059('0x10')](_0x53766c[_0x4059('0x12')],_0x15aff6,'\x0a')},getCustomFields(_0x274101,_0x15aff6));if(_0x3dc18f){if(_0x53766c[_0x4059('0x13')]===_0x4059('0x14')){_0x1a05c8['ActivityDate']=moment[_0x4059('0x15')]();_0x1a05c8[_0x4059('0x16')]=![];_0x1a05c8[_0x4059('0x17')]=![];if(_0x3dc18f[_0x4059('0x18')]===_0x4059('0x19')||_0x3dc18f[_0x4059('0x18')]===_0x4059('0x1a')){_0x1a05c8['WhoId']=_0x3dc18f['id'];}else if(_0x3dc18f[_0x4059('0x18')]===_0x4059('0x1b')){_0x1a05c8[_0x4059('0x1c')]=_0x3dc18f['id'];}}else if(_0x53766c[_0x4059('0x13')]===_0x4059('0x1d')){if(_0x3dc18f['endUserType']==='contact'){_0x1a05c8[_0x4059('0x1e')]=_0x3dc18f['id'];}else if(_0x3dc18f['endUserType']===_0x4059('0x1b')){_0x1a05c8[_0x4059('0x1f')]=_0x3dc18f['id'];}else if(_0x3dc18f['endUserType']===_0x4059('0x1a')&&_0x53766c[_0x4059('0x20')]){_0x1a05c8[_0x53766c[_0x4059('0x20')]]=_0x3dc18f['id'];}else{logger[_0x4059('0x21')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5236fc[_0x4059('0x22')](_0x53766c[_0x4059('0x13')])[_0x4059('0x23')](_0x1a05c8);}function getUser(_0x8642db,_0x1f5e52,_0x5382bb){if(!_[_0x4059('0x24')](_0x1f5e52)&&intUtil[_0x4059('0x25')](_0x1f5e52)){var _0x20a640={'Email':_0x1f5e52};var _0x4ad21a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5382bb[_0x4059('0x22')](_0x4059('0x26'))['find'](_0x20a640,_0x4ad21a)[_0x4059('0x27')]()[_0x4059('0x28')](function(_0x3fd6bf){if(_0x3fd6bf[_0x4059('0x29')]){var _0x471cd1=_['find'](_0x3fd6bf,function(_0x123f69){return _0x123f69['Email']===_0x1f5e52;});if(_0x471cd1){logger[_0x4059('0x21')]('Agent\x20%s\x20found.',_0x1f5e52);return BPromise['resolve']({'id':_0x471cd1['Id'],'name':_0x471cd1[_0x4059('0x2a')]});}}else{logger[_0x4059('0x21')](_0x4059('0x2b'),_0x1f5e52);return _0x5382bb['identity']()['then'](function(_0x5c9068){return BPromise[_0x4059('0x2c')]({'id':_0x5c9068[_0x4059('0x2d')],'name':_0x5c9068[_0x4059('0x2e')]});});}});}else{logger[_0x4059('0x21')](_0x4059('0x2b'),_0x1f5e52);return _0x5382bb['identity']()[_0x4059('0x28')](function(_0x825bf7){return BPromise[_0x4059('0x2c')]({'id':_0x825bf7['user_id'],'name':_0x825bf7[_0x4059('0x2e')]});});}}function getEndUser(_0x343a39,_0x143f3e,_0x5b834b,_0x3fa340,_0x58753e){var _0x4410f9={'$or':{'Phone':_0x3fa340}};var _0x22fd9d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4059('0x2c')]()['then'](function(){logger[_0x4059('0x21')](_0x4059('0x2f'),_0x3fa340,_0x143f3e[_0x4059('0x30')]);switch(_0x143f3e['moduleSearch']){case _0x4059('0x31'):var _0x437418=_[_0x4059('0x32')](_0x4410f9);if(_0x143f3e[_0x4059('0x33')]){var _0x380732={};_0x380732[_0x143f3e['additionalSearchContact']]=_0x3fa340;_[_0x4059('0x34')](_0x437418[_0x4059('0x35')],_0x380732);}return _0x58753e['sobject'](_0x4059('0x36'))[_0x4059('0x37')](_0x437418,_0x22fd9d)['execute']()['then'](function(_0x71d9d7){if(_0x71d9d7&&_0x71d9d7[_0x4059('0x29')]){return _0x71d9d7;}else{var _0x35c225=_[_0x4059('0x32')](_0x4410f9);if(_0x143f3e[_0x4059('0x38')]){var _0x5250ac={};_0x5250ac[_0x143f3e[_0x4059('0x38')]]=_0x3fa340;_['merge'](_0x35c225[_0x4059('0x35')],_0x5250ac);}return _0x58753e[_0x4059('0x22')](_0x4059('0x39'))[_0x4059('0x37')](_0x35c225,_0x22fd9d);}});case _0x4059('0x3a'):var _0x5b804e=_['cloneDeep'](_0x4410f9);if(_0x143f3e['additionalSearchAccount']){var _0x380732={};_0x380732[_0x143f3e['additionalSearchAccount']]=_0x3fa340;_[_0x4059('0x34')](_0x5b804e[_0x4059('0x35')],_0x380732);}return _0x58753e[_0x4059('0x22')](_0x4059('0x3b'))['find'](_0x5b804e,_0x22fd9d)[_0x4059('0x27')]()[_0x4059('0x28')](function(_0x2cc4e4){if(_0x2cc4e4&&_0x2cc4e4['length']){return _0x2cc4e4;}else{var _0x309183=_[_0x4059('0x32')](_0x4410f9);if(_0x143f3e['additionalSearchContact']){var _0x1f64a5={};_0x1f64a5[_0x143f3e[_0x4059('0x33')]]=_0x3fa340;_[_0x4059('0x34')](_0x309183[_0x4059('0x35')],_0x1f64a5);}return _0x58753e[_0x4059('0x22')](_0x4059('0x36'))[_0x4059('0x37')](_0x309183,_0x22fd9d)['then'](function(_0x1fec4d){if(_0x1fec4d&&_0x1fec4d[_0x4059('0x29')]){return _0x1fec4d;}else{var _0x47bdd7=_[_0x4059('0x32')](_0x4410f9);if(_0x143f3e[_0x4059('0x38')]){var _0x8d0789={};_0x8d0789[_0x143f3e[_0x4059('0x38')]]=_0x3fa340;_['merge'](_0x47bdd7['$or'],_0x8d0789);}return _0x58753e[_0x4059('0x22')]('Lead')['find'](_0x47bdd7,_0x22fd9d);}});}});case _0x4059('0x19'):var _0x437418=_['cloneDeep'](_0x4410f9);if(_0x143f3e['additionalSearchContact']){var _0x380732={};_0x380732[_0x143f3e['additionalSearchContact']]=_0x3fa340;_[_0x4059('0x34')](_0x437418[_0x4059('0x35')],_0x380732);}return _0x58753e[_0x4059('0x22')](_0x4059('0x36'))[_0x4059('0x37')](_0x437418,_0x22fd9d)[_0x4059('0x27')]();case'lead':var _0x5cabe6=_['cloneDeep'](_0x4410f9);if(_0x143f3e[_0x4059('0x38')]){var _0x380732={};_0x380732[_0x143f3e[_0x4059('0x38')]]=_0x3fa340;_[_0x4059('0x34')](_0x5cabe6[_0x4059('0x35')],_0x380732);}return _0x58753e['sobject'](_0x4059('0x39'))['find'](_0x5cabe6,_0x22fd9d);case _0x4059('0x1b'):var _0x5b804e=_[_0x4059('0x32')](_0x4410f9);if(_0x143f3e[_0x4059('0x3c')]){var _0x380732={};_0x380732[_0x143f3e[_0x4059('0x3c')]]=_0x3fa340;_[_0x4059('0x34')](_0x5b804e[_0x4059('0x35')],_0x380732);}return _0x58753e[_0x4059('0x22')](_0x4059('0x3b'))[_0x4059('0x37')](_0x5b804e,_0x22fd9d);default:return null;}})[_0x4059('0x28')](function(_0x5a858a){if(_0x5a858a&&_0x5a858a[_0x4059('0x29')]){var _0x5155bd=_[_0x4059('0x3d')](_0x5a858a);if(_0x5155bd){return BPromise[_0x4059('0x2c')]({'id':_0x5155bd['Id'],'name':_0x5155bd['Name'],'phone':_0x5155bd[_0x4059('0x3e')],'endUserType':_0x5155bd['attributes'][_0x4059('0x3f')][_0x4059('0x40')]()});}}})[_0x4059('0x28')](function(_0x593a9c){if(_0x593a9c){logger[_0x4059('0x21')](_0x4059('0x41'),_0x593a9c['endUserType'],_0x3fa340);return BPromise['resolve'](_0x593a9c);}else{logger[_0x4059('0x21')](_0x4059('0x42'),_0x3fa340);var _0xb5da6e={'Phone':_0x3fa340};if(_0x143f3e[_0x4059('0x43')]){if(_0x143f3e['moduleCreate']==='contact'){logger[_0x4059('0x21')](_0x4059('0x44'),_0x3fa340,_0x143f3e[_0x4059('0x43')]);_0xb5da6e[_0x4059('0x45')]=_0x5b834b!==_0x4059('0x46')?_0x5b834b:util[_0x4059('0x47')]('Caller\x20-\x20%s',_0x3fa340);}else if(_0x143f3e['moduleCreate']==='lead'){logger[_0x4059('0x21')](_0x4059('0x44'),_0x3fa340,_0x143f3e[_0x4059('0x43')]);_0xb5da6e[_0x4059('0x45')]=_0x5b834b!==''?_0x5b834b:util[_0x4059('0x47')](_0x4059('0x48'),_0x3fa340);_0xb5da6e['Company']=_0x4059('0x49');}else if(_0x143f3e[_0x4059('0x43')]==='account'){logger[_0x4059('0x21')](_0x4059('0x44'),_0x3fa340,_0x143f3e[_0x4059('0x43')]);_0xb5da6e[_0x4059('0x2a')]=_0x5b834b!==_0x4059('0x46')?_0x5b834b:util[_0x4059('0x47')](_0x4059('0x48'),_0x3fa340);}else{return null;}}return _0x58753e[_0x4059('0x22')](_['upperFirst'](_0x143f3e[_0x4059('0x43')]))[_0x4059('0x23')](_0xb5da6e)[_0x4059('0x28')](function(_0x5925a1){return BPromise['resolve']({'id':_0x5925a1['id'],'endUserType':_0x143f3e[_0x4059('0x43')]});});}});}function getCustomFields(_0x3cfb62,_0x4e2247){var _0x3d1321={};if(_0x3cfb62[_0x4059('0x29')]>0x0){_[_0x4059('0x4a')](_0x3cfb62,function(_0x2df447){if(_[_0x4059('0x4b')](['string',_0x4059('0x4c')],_0x2df447['type'])&&_0x2df447[_0x4059('0x4d')]){_0x3d1321[_0x2df447['idField']]=_0x2df447['content'][_0x4059('0x4e')]();}else if(_0x2df447[_0x4059('0x3f')]==='variable'&&_0x2df447[_0x4059('0x4f')]&&_0x2df447['idField']){_0x4e2247[_0x2df447[_0x4059('0x4f')]]&&(_0x3d1321[_0x2df447[_0x4059('0x4d')]]=_0x4e2247[_0x2df447[_0x4059('0x4f')]][_0x4059('0x4e')]());}else if(_0x2df447[_0x4059('0x3f')]===_0x4059('0x50')&&_0x2df447['Variable']&&_0x2df447['Variable'][_0x4059('0x51')]&&_0x2df447[_0x4059('0x4d')]){_0x4e2247[_0x2df447['Variable'][_0x4059('0x51')][_0x4059('0x40')]()]&&(_0x3d1321[_0x2df447[_0x4059('0x4d')]]=_0x4e2247[_0x2df447[_0x4059('0x52')]['name'][_0x4059('0x40')]()][_0x4059('0x4e')]());}});}return _0x3d1321;}function getConnection(_0x5c3259){var _0x44cf43=_0x5c3259[_0x4059('0x53')][_0x4059('0x54')](_0x5c3259[_0x4059('0x55')]);var _0x428b4e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5c3259[_0x4059('0x56')]||_0x4059('0x57'),'clientId':_0x5c3259['clientId'],'clientSecret':_0x5c3259[_0x4059('0x58')]}});return _0x428b4e[_0x4059('0x59')](_0x5c3259['username'],_0x44cf43)['then'](function(){logger[_0x4059('0x21')](_0x4059('0x5a'));return _0x428b4e;});}exports[_0x4059('0x5b')]=function(_0x359f14,_0x37b421,_0x18baa0,_0xf62127,_0x648722,_0x52d866){var _0x16297a,_0x1fd122,_0x4b7e44,_0x570f84;_0x52d866[_0x4059('0x5c')]=intUtil[_0x4059('0x5d')](_0x52d866['serverUrl']);_0x52d866[_0x4059('0x56')]=intUtil[_0x4059('0x5d')](_0x52d866[_0x4059('0x56')]);if(_0x648722&&_0x648722['monitor_format']){logger[_0x4059('0x21')](_0x4059('0x5e'),_0x4059('0x5f'));_0x37b421[_0x4059('0x60')]=util[_0x4059('0x47')](_0x4059('0x61'),_0x52d866[_0x4059('0x5c')],_0x37b421[_0x4059('0x62')],md5(_0x37b421[_0x4059('0x62')]));}else{_0x37b421[_0x4059('0x60')]='';}return getConnection(_0x52d866)[_0x4059('0x28')](function(_0x315b9a){_0x570f84=_0x315b9a;return getUser(_0x52d866,_0xf62127[_0x4059('0x63')],_0x570f84);})['then'](function(_0x57a86f){_0x16297a=_0x57a86f;return getEndUser(_0x52d866,_0x18baa0,_0x37b421[_0x4059('0x64')],_0x37b421[_0x4059('0x65')],_0x570f84);})[_0x4059('0x28')](function(_0x397c48){_0x1fd122=_0x397c48;return getTicket(_0x52d866,_0x16297a,_0x1fd122,_0x18baa0,_0x37b421,_0x18baa0[_0x4059('0x66')],_0x570f84,_0x4059('0x5b'));})[_0x4059('0x28')](function(_0x2ec972){_0x4b7e44=_0x2ec972;logger[_0x4059('0x21')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4b7e44['id']);logger['info'](_0x4059('0x67'),_0x4b7e44['id'],_0xf62127[_0x4059('0x51')],_0x52d866['type']);switch(_0x52d866['type']){case _0x4059('0x68'):emit(util[_0x4059('0x47')](_0x4059('0x69'),_0xf62127[_0x4059('0x51')]),_0x4059('0x6a'),{'recordId':_0x4b7e44['id']});break;case _0x4059('0x6b'):emit(util[_0x4059('0x47')](_0x4059('0x69'),_0xf62127[_0x4059('0x51')]),_0x4059('0x6c'),{'uri':util[_0x4059('0x47')](_0x4059('0x6d'),_0x570f84['instanceUrl'],_0x4b7e44['id'])});break;default:logger[_0x4059('0x6e')](_0x4059('0x6f'));}})['catch'](function(_0x3d918c){logger['error'](_0x4059('0x5e'),_0x3d918c);});};exports[_0x4059('0x70')]=function(_0xf219fe,_0x319a3e,_0x5159ba,_0x5abf91,_0x2be375,_0x387619,_0x2f055c){var _0x404e4c,_0x32deef,_0x48898d,_0x5b1b9c;_0x387619[_0x4059('0x5c')]=intUtil[_0x4059('0x5d')](_0x387619[_0x4059('0x5c')]);_0x387619[_0x4059('0x56')]=intUtil[_0x4059('0x5d')](_0x387619[_0x4059('0x56')]);if(_0x2f055c&&_0x2f055c['recordingFormat']&&_0x2f055c[_0x4059('0x71')]!==_0x4059('0x72')){logger[_0x4059('0x21')](_0x4059('0x73'),'Recording\x20is\x20enabled!');_0x319a3e[_0x4059('0x60')]=util[_0x4059('0x47')](_0x4059('0x61'),_0x387619[_0x4059('0x5c')],_0x319a3e[_0x4059('0x62')],md5(_0x319a3e[_0x4059('0x62')]));}return getConnection(_0x387619)['then'](function(_0x196816){_0x5b1b9c=_0x196816;return getUser(_0x387619,_0x5abf91['email'],_0x5b1b9c);})[_0x4059('0x28')](function(_0x480ac8){_0x404e4c=_0x480ac8;return getEndUser(_0x387619,_0x5159ba,_0x319a3e[_0x4059('0x74')],_0x319a3e[_0x4059('0x75')],_0x5b1b9c);})[_0x4059('0x28')](function(_0x4116f1){_0x32deef=_0x4116f1;return getTicket(_0x387619,_0x404e4c,_0x32deef,_0x5159ba,_0x319a3e,_0x5159ba['Fields'],_0x5b1b9c,'outbound');})['then'](function(_0x5bb6cc){_0x48898d=_0x5bb6cc;logger[_0x4059('0x21')](_0x4059('0x76'),_0x48898d['id']);logger['info'](_0x4059('0x77'),_0x48898d['id'],_0x5abf91[_0x4059('0x51')],_0x387619[_0x4059('0x3f')]);switch(_0x387619['type']){case _0x4059('0x68'):emit(util[_0x4059('0x47')](_0x4059('0x69'),_0x5abf91[_0x4059('0x51')]),_0x4059('0x6a'),{'recordId':_0x48898d['id']});break;case _0x4059('0x6b'):emit(util['format']('user:%s',_0x5abf91[_0x4059('0x51')]),_0x4059('0x6c'),{'uri':util['format'](_0x4059('0x6d'),_0x5b1b9c[_0x4059('0x78')],_0x48898d['id'])});break;default:logger[_0x4059('0x6e')](_0x4059('0x73'),_0x4059('0x79'));}})['catch'](function(_0x10516f){logger['error'](_0x4059('0x73'),_0x10516f);});};exports[_0x4059('0x7a')]=function(_0x377594,_0xcb2a98,_0x57317c,_0x28d559,_0xbeea31,_0x52ea4f){var _0x219043,_0x1c8e5f,_0x29eedb,_0x30ed04;_0x52ea4f[_0x4059('0x5c')]=intUtil['stripTrailingSlash'](_0x52ea4f['serverUrl']);_0x52ea4f[_0x4059('0x56')]=intUtil[_0x4059('0x5d')](_0x52ea4f[_0x4059('0x56')]);if(_0xbeea31&&_0xbeea31[_0x4059('0x7b')]){logger[_0x4059('0x21')]('['+_0xcb2a98['lastevent'][_0x4059('0x7c')]()+']',_0x4059('0x5f'));_0xcb2a98[_0x4059('0x60')]=util['format'](_0x4059('0x61'),_0x52ea4f[_0x4059('0x5c')],_0xcb2a98[_0x4059('0x62')],md5(_0xcb2a98[_0x4059('0x62')]));}else{_0xcb2a98[_0x4059('0x60')]='';}return getConnection(_0x52ea4f)[_0x4059('0x28')](function(_0x4deb22){_0x30ed04=_0x4deb22;if(!_[_0x4059('0x24')](_0x28d559)){return getUser(_0x52ea4f,_0x28d559[_0x4059('0x51')],_0x30ed04);}else{return getUser(_0x52ea4f,null,_0x30ed04);}})[_0x4059('0x28')](function(_0x297def){_0x219043=_0x297def;return getEndUser(_0x52ea4f,_0x57317c,_0xcb2a98[_0x4059('0x64')],_0xcb2a98[_0x4059('0x65')],_0x30ed04);})[_0x4059('0x28')](function(_0x35595e){_0x1c8e5f=_0x35595e;return getTicket(_0x52ea4f,_0x219043,_0x1c8e5f,_0x57317c,_0xcb2a98,_0x57317c['Fields'],_0x30ed04);})['then'](function(_0x47b394){_0x29eedb=_0x47b394;logger[_0x4059('0x21')]('['+_0xcb2a98[_0x4059('0x7d')][_0x4059('0x7c')]()+_0x4059('0x7e'),_0x29eedb['id']);logger[_0x4059('0x21')]('['+_0xcb2a98[_0x4059('0x7d')][_0x4059('0x7c')]()+_0x4059('0x7f'),_0x52ea4f[_0x4059('0x3f')]);})[_0x4059('0x80')](function(_0x196d77){logger[_0x4059('0x6e')]('['+_0xcb2a98[_0x4059('0x7d')][_0x4059('0x7c')]()+']',_0x196d77);});}; \ No newline at end of file +var _0x6336=['Caller\x20-\x20%s','Company','No\x20Company','create','string','type','idField','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Task','ActivityDate','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','execute','then','length','find','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format'];(function(_0x5f4c45,_0x2dab90){var _0x287d5d=function(_0x2d1739){while(--_0x2d1739){_0x5f4c45['push'](_0x5f4c45['shift']());}};_0x287d5d(++_0x2dab90);}(_0x6336,0xbe));var _0x6633=function(_0x2a98df,_0x3af1f7){_0x2a98df=_0x2a98df-0x0;var _0x559fc5=_0x6336[_0x2a98df];return _0x559fc5;};'use strict';var _=require(_0x6633('0x0'));var rp=require(_0x6633('0x1'));var moment=require(_0x6633('0x2'));var BPromise=require(_0x6633('0x3'));var md5=require(_0x6633('0x4'));var jsforce=require(_0x6633('0x5'));var util=require(_0x6633('0x6'));var Redis=require(_0x6633('0x7'));var intUtil=require(_0x6633('0x8'));var config=require(_0x6633('0x9'));var logger=require(_0x6633('0xa'))(_0x6633('0xb'));config[_0x6633('0xc')]=_[_0x6633('0xd')](config[_0x6633('0xc')],{'host':_0x6633('0xe'),'port':0x18eb});var io=require(_0x6633('0xf'))(new Redis(config['redis']));function emit(_0x2e4ec5,_0x28e630,_0x1f0544){io['to'](_0x2e4ec5)['emit'](_0x28e630,_0x1f0544);}function getTicket(_0x212b1f,_0xf00335,_0x3fbdd3,_0x476a83,_0x45fa03,_0x1035c4,_0x418f19,_0x45c733){var _0x301812=Object['assign']({},{'OwnerId':_0xf00335['id'],'Subject':intUtil[_0x6633('0x10')](_0x476a83[_0x6633('0x11')],_0x45fa03,'\x20'),'Description':intUtil[_0x6633('0x10')](_0x476a83['Descriptions'],_0x45fa03,'\x0a')},getCustomFields(_0x1035c4,_0x45fa03));if(_0x3fbdd3){if(_0x476a83['ticketType']===_0x6633('0x12')){_0x301812[_0x6633('0x13')]=moment['utc']();_0x301812[_0x6633('0x14')]=![];_0x301812[_0x6633('0x15')]=![];if(_0x3fbdd3['endUserType']===_0x6633('0x16')||_0x3fbdd3[_0x6633('0x17')]===_0x6633('0x18')){_0x301812[_0x6633('0x19')]=_0x3fbdd3['id'];}else if(_0x3fbdd3[_0x6633('0x17')]===_0x6633('0x1a')){_0x301812[_0x6633('0x1b')]=_0x3fbdd3['id'];}}else if(_0x476a83[_0x6633('0x1c')]===_0x6633('0x1d')){if(_0x3fbdd3[_0x6633('0x17')]===_0x6633('0x16')){_0x301812[_0x6633('0x1e')]=_0x3fbdd3['id'];}else if(_0x3fbdd3[_0x6633('0x17')]===_0x6633('0x1a')){_0x301812[_0x6633('0x1f')]=_0x3fbdd3['id'];}else if(_0x3fbdd3[_0x6633('0x17')]===_0x6633('0x18')&&_0x476a83[_0x6633('0x20')]){_0x301812[_0x476a83[_0x6633('0x20')]]=_0x3fbdd3['id'];}else{logger[_0x6633('0x21')](_0x6633('0x22'));}}}return _0x418f19[_0x6633('0x23')](_0x476a83[_0x6633('0x1c')])['create'](_0x301812);}function getUser(_0xfe5311,_0x3da177,_0x1baa38){if(!_[_0x6633('0x24')](_0x3da177)&&intUtil[_0x6633('0x25')](_0x3da177)){var _0x584707={'Email':_0x3da177};var _0x15f2db={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1baa38['sobject'](_0x6633('0x26'))['find'](_0x584707,_0x15f2db)[_0x6633('0x27')]()[_0x6633('0x28')](function(_0x74770e){if(_0x74770e[_0x6633('0x29')]){var _0x4eb195=_[_0x6633('0x2a')](_0x74770e,function(_0x3c6fee){return _0x3c6fee[_0x6633('0x2b')]===_0x3da177;});if(_0x4eb195){logger[_0x6633('0x21')]('Agent\x20%s\x20found.',_0x3da177);return BPromise[_0x6633('0x2c')]({'id':_0x4eb195['Id'],'name':_0x4eb195['Name']});}}else{logger[_0x6633('0x21')](_0x6633('0x2d'),_0x3da177);return _0x1baa38['identity']()[_0x6633('0x28')](function(_0x1c5ad7){return BPromise[_0x6633('0x2c')]({'id':_0x1c5ad7[_0x6633('0x2e')],'name':_0x1c5ad7[_0x6633('0x2f')]});});}});}else{logger[_0x6633('0x21')](_0x6633('0x2d'),_0x3da177);return _0x1baa38[_0x6633('0x30')]()[_0x6633('0x28')](function(_0x522779){return BPromise['resolve']({'id':_0x522779['user_id'],'name':_0x522779[_0x6633('0x2f')]});});}}function getEndUser(_0x28d413,_0x211659,_0x225836,_0x52120f,_0x28b667){var _0x480ccb={'$or':{'Phone':_0x52120f}};var _0x3d8f5b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6633('0x2c')]()[_0x6633('0x28')](function(){logger[_0x6633('0x21')](_0x6633('0x31'),_0x52120f,_0x211659[_0x6633('0x32')]);switch(_0x211659[_0x6633('0x32')]){case _0x6633('0x33'):var _0x59d793=_[_0x6633('0x34')](_0x480ccb);if(_0x211659[_0x6633('0x35')]){var _0x51f2f3={};_0x51f2f3[_0x211659['additionalSearchContact']]=_0x52120f;_[_0x6633('0x36')](_0x59d793[_0x6633('0x37')],_0x51f2f3);}return _0x28b667[_0x6633('0x23')](_0x6633('0x38'))[_0x6633('0x2a')](_0x59d793,_0x3d8f5b)[_0x6633('0x27')]()[_0x6633('0x28')](function(_0x5e3cfb){if(_0x5e3cfb&&_0x5e3cfb[_0x6633('0x29')]){return _0x5e3cfb;}else{var _0x197f6f=_[_0x6633('0x34')](_0x480ccb);if(_0x211659[_0x6633('0x39')]){var _0xba6c98={};_0xba6c98[_0x211659[_0x6633('0x39')]]=_0x52120f;_[_0x6633('0x36')](_0x197f6f[_0x6633('0x37')],_0xba6c98);}return _0x28b667['sobject'](_0x6633('0x3a'))[_0x6633('0x2a')](_0x197f6f,_0x3d8f5b);}});case _0x6633('0x3b'):var _0x1737c5=_[_0x6633('0x34')](_0x480ccb);if(_0x211659['additionalSearchAccount']){var _0x51f2f3={};_0x51f2f3[_0x211659['additionalSearchAccount']]=_0x52120f;_[_0x6633('0x36')](_0x1737c5['$or'],_0x51f2f3);}return _0x28b667[_0x6633('0x23')]('Account')['find'](_0x1737c5,_0x3d8f5b)[_0x6633('0x27')]()[_0x6633('0x28')](function(_0x39ee1d){if(_0x39ee1d&&_0x39ee1d[_0x6633('0x29')]){return _0x39ee1d;}else{var _0x5aad7d=_[_0x6633('0x34')](_0x480ccb);if(_0x211659[_0x6633('0x35')]){var _0x4c22e5={};_0x4c22e5[_0x211659[_0x6633('0x35')]]=_0x52120f;_[_0x6633('0x36')](_0x5aad7d['$or'],_0x4c22e5);}return _0x28b667['sobject'](_0x6633('0x38'))[_0x6633('0x2a')](_0x5aad7d,_0x3d8f5b)['then'](function(_0x568556){if(_0x568556&&_0x568556['length']){return _0x568556;}else{var _0x9f1253=_[_0x6633('0x34')](_0x480ccb);if(_0x211659[_0x6633('0x39')]){var _0xdc8b74={};_0xdc8b74[_0x211659[_0x6633('0x39')]]=_0x52120f;_['merge'](_0x9f1253[_0x6633('0x37')],_0xdc8b74);}return _0x28b667[_0x6633('0x23')](_0x6633('0x3a'))['find'](_0x9f1253,_0x3d8f5b);}});}});case _0x6633('0x16'):var _0x59d793=_[_0x6633('0x34')](_0x480ccb);if(_0x211659['additionalSearchContact']){var _0x51f2f3={};_0x51f2f3[_0x211659[_0x6633('0x35')]]=_0x52120f;_[_0x6633('0x36')](_0x59d793['$or'],_0x51f2f3);}return _0x28b667[_0x6633('0x23')](_0x6633('0x38'))[_0x6633('0x2a')](_0x59d793,_0x3d8f5b)[_0x6633('0x27')]();case _0x6633('0x18'):var _0x2183ae=_[_0x6633('0x34')](_0x480ccb);if(_0x211659[_0x6633('0x39')]){var _0x51f2f3={};_0x51f2f3[_0x211659[_0x6633('0x39')]]=_0x52120f;_['merge'](_0x2183ae[_0x6633('0x37')],_0x51f2f3);}return _0x28b667[_0x6633('0x23')](_0x6633('0x3a'))[_0x6633('0x2a')](_0x2183ae,_0x3d8f5b);case'account':var _0x1737c5=_['cloneDeep'](_0x480ccb);if(_0x211659['additionalSearchAccount']){var _0x51f2f3={};_0x51f2f3[_0x211659[_0x6633('0x3c')]]=_0x52120f;_['merge'](_0x1737c5['$or'],_0x51f2f3);}return _0x28b667[_0x6633('0x23')](_0x6633('0x3d'))[_0x6633('0x2a')](_0x1737c5,_0x3d8f5b);default:return null;}})[_0x6633('0x28')](function(_0x484265){if(_0x484265&&_0x484265[_0x6633('0x29')]){var _0x8ec514=_[_0x6633('0x3e')](_0x484265);if(_0x8ec514){return BPromise[_0x6633('0x2c')]({'id':_0x8ec514['Id'],'name':_0x8ec514[_0x6633('0x3f')],'phone':_0x8ec514[_0x6633('0x40')],'endUserType':_0x8ec514[_0x6633('0x41')]['type'][_0x6633('0x42')]()});}}})[_0x6633('0x28')](function(_0x60f5af){if(_0x60f5af){logger['info'](_0x6633('0x43'),_0x60f5af['endUserType'],_0x52120f);return BPromise[_0x6633('0x2c')](_0x60f5af);}else{logger[_0x6633('0x21')](_0x6633('0x44'),_0x52120f);var _0x1e038f={'Phone':_0x52120f};if(_0x211659['moduleCreate']){if(_0x211659[_0x6633('0x45')]===_0x6633('0x16')){logger[_0x6633('0x21')](_0x6633('0x46'),_0x52120f,_0x211659[_0x6633('0x45')]);_0x1e038f[_0x6633('0x47')]=_0x225836!==_0x6633('0x48')?_0x225836:util[_0x6633('0x49')](_0x6633('0x4a'),_0x52120f);}else if(_0x211659[_0x6633('0x45')]===_0x6633('0x18')){logger[_0x6633('0x21')](_0x6633('0x46'),_0x52120f,_0x211659['moduleCreate']);_0x1e038f['LastName']=_0x225836!==_0x6633('0x48')?_0x225836:util[_0x6633('0x49')](_0x6633('0x4a'),_0x52120f);_0x1e038f[_0x6633('0x4b')]=_0x6633('0x4c');}else if(_0x211659['moduleCreate']===_0x6633('0x1a')){logger[_0x6633('0x21')](_0x6633('0x46'),_0x52120f,_0x211659[_0x6633('0x45')]);_0x1e038f[_0x6633('0x3f')]=_0x225836!==''?_0x225836:util[_0x6633('0x49')]('Caller\x20-\x20%s',_0x52120f);}else{return null;}}return _0x28b667[_0x6633('0x23')](_['upperFirst'](_0x211659[_0x6633('0x45')]))[_0x6633('0x4d')](_0x1e038f)[_0x6633('0x28')](function(_0x404586){return BPromise[_0x6633('0x2c')]({'id':_0x404586['id'],'endUserType':_0x211659['moduleCreate']});});}});}function getCustomFields(_0x4ad79a,_0x8b7668){var _0x592f61={};if(_0x4ad79a[_0x6633('0x29')]>0x0){_['forEach'](_0x4ad79a,function(_0x10b957){if(_['includes']([_0x6633('0x4e'),'picklist'],_0x10b957[_0x6633('0x4f')])&&_0x10b957[_0x6633('0x50')]){_0x592f61[_0x10b957[_0x6633('0x50')]]=_0x10b957['content'][_0x6633('0x51')]();}else if(_0x10b957['type']==='variable'&&_0x10b957[_0x6633('0x52')]&&_0x10b957[_0x6633('0x50')]){_0x8b7668[_0x10b957[_0x6633('0x52')]]&&(_0x592f61[_0x10b957[_0x6633('0x50')]]=_0x8b7668[_0x10b957['variableName']][_0x6633('0x51')]());}else if(_0x10b957['type']===_0x6633('0x53')&&_0x10b957[_0x6633('0x54')]&&_0x10b957[_0x6633('0x54')][_0x6633('0x55')]&&_0x10b957[_0x6633('0x50')]){_0x8b7668[_0x10b957[_0x6633('0x54')][_0x6633('0x55')][_0x6633('0x42')]()]&&(_0x592f61[_0x10b957[_0x6633('0x50')]]=_0x8b7668[_0x10b957['Variable'][_0x6633('0x55')][_0x6633('0x42')]()][_0x6633('0x51')]());}});}return _0x592f61;}function getConnection(_0x2ea25a){var _0x3d7752=_0x2ea25a[_0x6633('0x56')][_0x6633('0x57')](_0x2ea25a[_0x6633('0x58')]);var _0x412554=new jsforce[(_0x6633('0x59'))]({'oauth2':{'loginUrl':_0x2ea25a[_0x6633('0x5a')]||_0x6633('0x5b'),'clientId':_0x2ea25a['clientId'],'clientSecret':_0x2ea25a[_0x6633('0x5c')]}});return _0x412554[_0x6633('0x5d')](_0x2ea25a[_0x6633('0x5e')],_0x3d7752)[_0x6633('0x28')](function(){logger[_0x6633('0x21')]('Connection\x20established.');return _0x412554;});}exports['queue']=function(_0xd03ccc,_0x3f02a3,_0x4e523c,_0x1fe9d6,_0x58252d,_0x373640){var _0xcf58f4,_0x299775,_0x4c32aa,_0x2ae8e1;_0x373640['serverUrl']=intUtil[_0x6633('0x5f')](_0x373640[_0x6633('0x60')]);_0x373640[_0x6633('0x5a')]=intUtil['stripTrailingSlash'](_0x373640['remoteUri']);if(_0x58252d&&_0x58252d[_0x6633('0x61')]){logger[_0x6633('0x21')](_0x6633('0x62'),_0x6633('0x63'));_0x3f02a3[_0x6633('0x64')]=util[_0x6633('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x373640['serverUrl'],_0x3f02a3['uniqueid'],md5(_0x3f02a3[_0x6633('0x65')]));}else{_0x3f02a3['recordingURL']='';}return getConnection(_0x373640)[_0x6633('0x28')](function(_0x23bd0c){_0x2ae8e1=_0x23bd0c;return getUser(_0x373640,_0x1fe9d6[_0x6633('0x66')],_0x2ae8e1);})[_0x6633('0x28')](function(_0x3fc188){_0xcf58f4=_0x3fc188;return getEndUser(_0x373640,_0x4e523c,_0x3f02a3['calleridname'],_0x3f02a3[_0x6633('0x67')],_0x2ae8e1);})[_0x6633('0x28')](function(_0x7be888){_0x299775=_0x7be888;return getTicket(_0x373640,_0xcf58f4,_0x299775,_0x4e523c,_0x3f02a3,_0x4e523c[_0x6633('0x68')],_0x2ae8e1,_0x6633('0x69'));})['then'](function(_0x23a749){_0x4c32aa=_0x23a749;logger[_0x6633('0x21')](_0x6633('0x6a'),_0x4c32aa['id']);logger[_0x6633('0x21')](_0x6633('0x6b'),_0x4c32aa['id'],_0x1fe9d6['name'],_0x373640['type']);switch(_0x373640['type']){case _0x6633('0x6c'):emit(util[_0x6633('0x49')](_0x6633('0x6d'),_0x1fe9d6[_0x6633('0x55')]),_0x6633('0x6e'),{'recordId':_0x4c32aa['id']});break;case _0x6633('0x6f'):emit(util[_0x6633('0x49')](_0x6633('0x6d'),_0x1fe9d6[_0x6633('0x55')]),_0x6633('0x70'),{'uri':util[_0x6633('0x49')]('%s/%s/e',_0x2ae8e1[_0x6633('0x71')],_0x4c32aa['id'])});break;default:logger[_0x6633('0x72')](_0x6633('0x73'));}})[_0x6633('0x74')](function(_0x4b141b){logger[_0x6633('0x72')](_0x6633('0x62'),_0x4b141b);});};exports[_0x6633('0x75')]=function(_0x2e999e,_0xc52744,_0x137f04,_0xcbe363,_0x395b63,_0x41f1a4,_0x3d6cdb){var _0x14f434,_0x3404d6,_0x104154,_0x1e5cff;_0x41f1a4['serverUrl']=intUtil['stripTrailingSlash'](_0x41f1a4[_0x6633('0x60')]);_0x41f1a4[_0x6633('0x5a')]=intUtil[_0x6633('0x5f')](_0x41f1a4[_0x6633('0x5a')]);if(_0x3d6cdb&&_0x3d6cdb[_0x6633('0x76')]&&_0x3d6cdb['recordingFormat']!==_0x6633('0x77')){logger[_0x6633('0x21')](_0x6633('0x78'),_0x6633('0x63'));_0xc52744['recordingURL']=util[_0x6633('0x49')](_0x6633('0x79'),_0x41f1a4[_0x6633('0x60')],_0xc52744[_0x6633('0x65')],md5(_0xc52744[_0x6633('0x65')]));}return getConnection(_0x41f1a4)[_0x6633('0x28')](function(_0x24a3b5){_0x1e5cff=_0x24a3b5;return getUser(_0x41f1a4,_0xcbe363[_0x6633('0x66')],_0x1e5cff);})['then'](function(_0x25d4cc){_0x14f434=_0x25d4cc;return getEndUser(_0x41f1a4,_0x137f04,_0xc52744[_0x6633('0x7a')],_0xc52744[_0x6633('0x7b')],_0x1e5cff);})[_0x6633('0x28')](function(_0x388794){_0x3404d6=_0x388794;return getTicket(_0x41f1a4,_0x14f434,_0x3404d6,_0x137f04,_0xc52744,_0x137f04[_0x6633('0x68')],_0x1e5cff,_0x6633('0x75'));})[_0x6633('0x28')](function(_0x12a2ab){_0x104154=_0x12a2ab;logger[_0x6633('0x21')](_0x6633('0x7c'),_0x104154['id']);logger[_0x6633('0x21')](_0x6633('0x7d'),_0x104154['id'],_0xcbe363[_0x6633('0x55')],_0x41f1a4[_0x6633('0x4f')]);switch(_0x41f1a4[_0x6633('0x4f')]){case _0x6633('0x6c'):emit(util['format'](_0x6633('0x6d'),_0xcbe363[_0x6633('0x55')]),'trigger:salesforce:display',{'recordId':_0x104154['id']});break;case _0x6633('0x6f'):emit(util[_0x6633('0x49')](_0x6633('0x6d'),_0xcbe363[_0x6633('0x55')]),'trigger:browser:url',{'uri':util[_0x6633('0x49')](_0x6633('0x7e'),_0x1e5cff['instanceUrl'],_0x104154['id'])});break;default:logger['error'](_0x6633('0x78'),_0x6633('0x7f'));}})[_0x6633('0x74')](function(_0x445f2c){logger[_0x6633('0x72')](_0x6633('0x78'),_0x445f2c);});};exports['unmanaged']=function(_0x22481f,_0x496a38,_0x4b2707,_0x40c45f,_0x14f625,_0x46728b){var _0x448ed3,_0x1b78f9,_0x97abc1,_0x1db9e4;_0x46728b[_0x6633('0x60')]=intUtil[_0x6633('0x5f')](_0x46728b[_0x6633('0x60')]);_0x46728b[_0x6633('0x5a')]=intUtil[_0x6633('0x5f')](_0x46728b[_0x6633('0x5a')]);if(_0x14f625&&_0x14f625[_0x6633('0x61')]){logger[_0x6633('0x21')]('['+_0x496a38[_0x6633('0x80')][_0x6633('0x81')]()+']',_0x6633('0x63'));_0x496a38['recordingURL']=util['format'](_0x6633('0x79'),_0x46728b['serverUrl'],_0x496a38[_0x6633('0x65')],md5(_0x496a38['uniqueid']));}else{_0x496a38['recordingURL']='';}return getConnection(_0x46728b)[_0x6633('0x28')](function(_0x2173ed){_0x1db9e4=_0x2173ed;if(!_[_0x6633('0x24')](_0x40c45f)){return getUser(_0x46728b,_0x40c45f['name'],_0x1db9e4);}else{return getUser(_0x46728b,null,_0x1db9e4);}})[_0x6633('0x28')](function(_0x2787b3){_0x448ed3=_0x2787b3;return getEndUser(_0x46728b,_0x4b2707,_0x496a38[_0x6633('0x82')],_0x496a38[_0x6633('0x67')],_0x1db9e4);})[_0x6633('0x28')](function(_0x12aa13){_0x1b78f9=_0x12aa13;return getTicket(_0x46728b,_0x448ed3,_0x1b78f9,_0x4b2707,_0x496a38,_0x4b2707[_0x6633('0x68')],_0x1db9e4);})[_0x6633('0x28')](function(_0x465867){_0x97abc1=_0x465867;logger['info']('['+_0x496a38[_0x6633('0x80')][_0x6633('0x81')]()+']\x20Ticket\x20%s\x20created.',_0x97abc1['id']);logger[_0x6633('0x21')]('['+_0x496a38['lastevent'][_0x6633('0x81')]()+_0x6633('0x83'),_0x46728b[_0x6633('0x4f')]);})[_0x6633('0x74')](function(_0x274a89){logger[_0x6633('0x72')]('['+_0x496a38['lastevent'][_0x6633('0x81')]()+']',_0x274a89);});}; \ 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 7d5020b..b352f52 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 _0xb78e=['sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','customVariable','Variable','name','toString',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','Incident','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','username'];(function(_0x45c162,_0x3d5323){var _0x48b5b7=function(_0x174410){while(--_0x174410){_0x45c162['push'](_0x45c162['shift']());}};_0x48b5b7(++_0x3d5323);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3c831b,_0x50ec71){_0x3c831b=_0x3c831b-0x0;var _0x43ab66=_0xb78e[_0x3c831b];return _0x43ab66;};'use strict';var _=require(_0xeb78('0x0'));var Promise=require(_0xeb78('0x1'));var rp=require('request-promise');var util=require(_0xeb78('0x2'));var md5=require(_0xeb78('0x3'));var Redis=require(_0xeb78('0x4'));var intUtil=require(_0xeb78('0x5'));var config=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));config[_0xeb78('0x9')]=_['defaults'](config[_0xeb78('0x9')],{'host':_0xeb78('0xa'),'port':0x18eb});var io=require(_0xeb78('0xb'))(new Redis(config[_0xeb78('0x9')]));function getAdminUser(_0x2b7925,_0x36963f,_0x5259aa,_0x573406,_0x181a5b,_0x1c941d){return new Promise(function(_0xa1ca82,_0x46fbad){var _0x125e97={'method':_0xeb78('0xc'),'uri':_0x573406+_0xeb78('0xd')+'&'+_0x181a5b+'&'+_0x1c941d,'auth':_0x36963f,'json':!![]};return rp(_0x125e97)[_0xeb78('0xe')](function(_0x152bc1){if(_0x152bc1['result'][_0xeb78('0xf')]>0x0){_0x5259aa[_0xeb78('0x10')]=_0x152bc1[_0xeb78('0x11')][0x0][_0xeb78('0x12')];}logger[_0xeb78('0x13')]('['+[_0x2b7925[_0xeb78('0x14')]()]+_0xeb78('0x15'),_0x5259aa);_0xa1ca82(_0x5259aa);})[_0xeb78('0x16')](function(_0x41bec0){logger[_0xeb78('0x17')]('['+[_0x2b7925['toUpperCase']()]+']',_0x41bec0[_0xeb78('0x18')]);_0x46fbad(_0x41bec0[_0xeb78('0x18')]);});});}function getUser(_0x4e8b8c,_0x538485,_0x53be89,_0x23a0d0,_0x50ebae){return function(_0xa28d5e){logger[_0xeb78('0x13')]('['+[_0x4e8b8c['toUpperCase']()]+_0xeb78('0x19'),_0xa28d5e);return new Promise(function(_0x53c811,_0x21c521){if(intUtil[_0xeb78('0x1a')](_0xa28d5e['userEmail'])){var _0x45176e={'method':_0xeb78('0xc'),'uri':_0x53be89+_0xeb78('0x1b')+_0xa28d5e['userEmail']+'&'+_0x23a0d0+'&'+_0x50ebae,'auth':_0x538485,'json':!![]};logger[_0xeb78('0x13')]('['+[_0x4e8b8c[_0xeb78('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x45176e);return rp(_0x45176e)['then'](function(_0x455e30){logger[_0xeb78('0x13')]('['+[_0x4e8b8c[_0xeb78('0x14')]()]+_0xeb78('0x1c'),_0x455e30);if(_0x455e30[_0xeb78('0x11')][_0xeb78('0xf')]>0x0&&String(_0x455e30[_0xeb78('0x11')][0x0][_0xeb78('0x1d')])===_0xeb78('0x1e')){_0xa28d5e['userId']=_0x455e30['result'][0x0]['sys_id'];}else{_0xa28d5e['userId']=_0xa28d5e[_0xeb78('0x10')];_0xa28d5e['userEmail']=_0xa28d5e[_0xeb78('0x1f')];}logger[_0xeb78('0x13')]('['+[_0x4e8b8c['toUpperCase']()]+_0xeb78('0x20'),_0xa28d5e);_0x53c811(_0xa28d5e);})['catch'](function(_0x9a00b){logger[_0xeb78('0x17')]('['+[_0x4e8b8c[_0xeb78('0x14')]()]+']',_0x9a00b[_0xeb78('0x18')]);_0x21c521(_0x9a00b['message']);});}else{logger[_0xeb78('0x13')]('['+[_0x4e8b8c['toUpperCase']()]+_0xeb78('0x21'));_0xa28d5e[_0xeb78('0x22')]=_0xa28d5e[_0xeb78('0x10')];_0xa28d5e['userEmail']=_0xa28d5e[_0xeb78('0x1f')];_0x53c811(_0xa28d5e);}});};}function createEndUser(_0x1e7d56,_0x1c04dd,_0x381b2f,_0x3d4a97,_0x3516b8){logger[_0xeb78('0x13')]('['+[_0x1e7d56[_0xeb78('0x14')]()]+_0xeb78('0x23'),_0x381b2f);return new Promise(function(_0x19ad00,_0x1f3a14){var _0x505468={'method':'POST','uri':_0x3d4a97+'sys_user?'+_0x3516b8,'body':{'user_name':_0x381b2f[_0xeb78('0x24')],'roles':_0xeb78('0x25'),'first_name':_0x381b2f[_0xeb78('0x24')],'active':'true','date_format':_0xeb78('0x26'),'phone':_0x381b2f[_0xeb78('0x24')]},'auth':_0x1c04dd,'json':!![]};return rp(_0x505468)[_0xeb78('0xe')](function(_0x83b35d){logger[_0xeb78('0x13')]('['+[_0x1e7d56[_0xeb78('0x14')]()]+_0xeb78('0x27'),_0x83b35d[_0xeb78('0x11')]);_0x381b2f[_0xeb78('0x28')]=_0x83b35d['result'][_0xeb78('0x12')];_0x19ad00(_0x381b2f);})['catch'](function(_0xf01a87){logger[_0xeb78('0x17')]('['+[_0x1e7d56[_0xeb78('0x14')]()]+']',_0xf01a87[_0xeb78('0x18')]);_0x1f3a14(_0xf01a87[_0xeb78('0x18')]);});});}function getEndUser(_0x44af05,_0x53a44b,_0x5505b7,_0x31bdd1,_0x26975a){return function(_0x13dec8){logger[_0xeb78('0x13')]('['+[_0x44af05[_0xeb78('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x13dec8);return new Promise(function(_0x128aba,_0x17a1ab){var _0x286107={'method':_0xeb78('0xc'),'uri':_0x5505b7+_0xeb78('0x29')+_0x13dec8[_0xeb78('0x24')]+'&'+_0x31bdd1+'&'+_0x26975a,'auth':_0x53a44b,'json':!![]};return rp(_0x286107)['then'](function(_0x59b721){if(_0x59b721['result']['length']>0x0){_0x13dec8[_0xeb78('0x28')]=_0x59b721[_0xeb78('0x11')][0x0][_0xeb78('0x12')];logger['info']('['+[_0x44af05[_0xeb78('0x14')]()]+_0xeb78('0x2a'),_0x13dec8);_0x128aba(_0x13dec8);}else{return createEndUser(_0x44af05,_0x53a44b,_0x13dec8,_0x5505b7,_0x31bdd1)['then'](function(_0x4b446c){logger['info']('['+[_0x44af05[_0xeb78('0x14')]()]+_0xeb78('0x2b'),_0x4b446c);_0x128aba(_0x4b446c);});}})[_0xeb78('0x16')](function(_0x4ea5e2){logger[_0xeb78('0x17')]('['+[_0x44af05[_0xeb78('0x14')]()]+']',_0x4ea5e2[_0xeb78('0x18')]);_0x17a1ab(_0x4ea5e2['message']);});});};}function getCustomFields(_0xf0f13c,_0x119848){var _0x33c599={};if(_0xf0f13c[_0xeb78('0xf')]>0x0){_['forEach'](_0xf0f13c,function(_0x5eb901){if(_[_0xeb78('0x2c')]([_0xeb78('0x2d'),_0xeb78('0x2e')],_0x5eb901[_0xeb78('0x2f')])&&_0x5eb901[_0xeb78('0x30')]&&!_0x5eb901[_0xeb78('0x31')]){_0x33c599[_0x5eb901[_0xeb78('0x30')][_0xeb78('0x32')]()]=_0x5eb901[_0xeb78('0x33')]['toString']();}else if(_[_0xeb78('0x2c')]([_0xeb78('0x2d'),_0xeb78('0x2e')],_0x5eb901['type'])&&_0x5eb901[_0xeb78('0x34')]&&_0x5eb901['customField']){_0x33c599[_0x5eb901[_0xeb78('0x34')][_0xeb78('0x32')]()]=_0x5eb901[_0xeb78('0x33')]['toString']();}else if(_0x5eb901[_0xeb78('0x2f')]===_0xeb78('0x35')&&_0x5eb901[_0xeb78('0x36')]&&_0x5eb901[_0xeb78('0x34')]&&_0x5eb901[_0xeb78('0x31')]){_0x33c599[_0x5eb901['idField'][_0xeb78('0x32')]()]=_0x119848[_0x5eb901[_0xeb78('0x36')]]['toString']();}else if(_0x5eb901[_0xeb78('0x2f')]===_0xeb78('0x37')&&_0x5eb901[_0xeb78('0x38')]&&_0x5eb901['Variable'][_0xeb78('0x39')]&&_0x5eb901[_0xeb78('0x34')]&&_0x5eb901[_0xeb78('0x31')]){_0x33c599[_0x5eb901[_0xeb78('0x34')][_0xeb78('0x32')]()]=_0x119848[_0x5eb901[_0xeb78('0x38')]['name']['toLowerCase']()][_0xeb78('0x3a')]();}});}return _0x33c599;}function getTicket(_0x413b7b,_0x521362,_0x108f8b,_0x3ee867,_0x18083,_0x35566b){return function(_0x5ccd68){logger[_0xeb78('0x13')]('['+[_0x413b7b[_0xeb78('0x14')]()]+_0xeb78('0x3b'),_0x5ccd68);return new Promise(function(_0x9d5b17,_0x2ba296){var _0x3040ce=_0x413b7b[_0xeb78('0x32')]()===_0xeb78('0x3c')?_0x5ccd68[_0xeb78('0x22')]:_0x5ccd68[_0xeb78('0x28')];var _0x58e361={'method':_0xeb78('0x3d'),'uri':_0x108f8b+_0xeb78('0x3e')+'?'+_0x35566b,'body':Object[_0xeb78('0x3f')]({},{'active':_0xeb78('0x1e'),'caller_id':_0x3040ce,'assigned_to':_0x5ccd68['userId'],'short_description':intUtil[_0xeb78('0x40')](_0x3ee867[_0xeb78('0x41')],_0x18083,'\x20'),'description':intUtil[_0xeb78('0x40')](_0x3ee867[_0xeb78('0x42')],_0x18083,'\x0a')},getCustomFields(_0x3ee867[_0xeb78('0x43')],_0x18083)),'auth':_0x521362,'json':!![]};return rp(_0x58e361)['then'](function(_0x5e0644){logger['info']('['+[_0x413b7b[_0xeb78('0x14')]()]+_0xeb78('0x44'),_0x5e0644['result']);_0x5ccd68[_0xeb78('0x45')]=_0x5e0644[_0xeb78('0x11')][_0xeb78('0x12')];_0x5ccd68['ticketNumber']=_0x5e0644['result'][_0xeb78('0x46')];logger[_0xeb78('0x13')]('['+[_0x413b7b[_0xeb78('0x14')]()]+']\x20getTicket\x20crm',_0x5ccd68);_0x9d5b17(_0x5ccd68);})[_0xeb78('0x16')](function(_0x28f0d5){logger[_0xeb78('0x17')]('['+[_0x413b7b['toUpperCase']()]+']',_0x28f0d5['message']);_0x2ba296(_0x28f0d5['message']);});});};}function createRemoteTag(_0x31d1fc,_0x3458ae,_0x55c643,_0x2b42f6){return new Promise(function(_0x31eb10,_0x2a77c8){var _0x52534f={'method':_0xeb78('0x3d'),'uri':_0x55c643+'label'+'?'+_0x2b42f6,'body':{'short_description':_0x31d1fc,'global':!![],'active':!![],'name':_0x31d1fc},'auth':_0x3458ae,'json':!![]};return rp(_0x52534f)[_0xeb78('0xe')](function(_0x151083){var _0x165515=_0x151083['result']['sys_id'];_0x31eb10(_0x165515);});});}function getRemoteTag(_0x5698ca,_0x5a506f,_0x3238e9,_0x51f51f,_0x3f86a7){return new Promise(function(_0x2028db,_0x130fad){var _0x1b7290={'method':_0xeb78('0xc'),'uri':_0x3238e9+_0xeb78('0x47')+'?sysparm_query=name%3D'+_0x5698ca+'&'+_0x51f51f,'auth':_0x5a506f,'json':!![]};return rp(_0x1b7290)['then'](function(_0x20d3b0){if(_0x20d3b0[_0xeb78('0x11')][_0xeb78('0xf')]>0x0){var _0xbdff05=_0x20d3b0['result'][0x0][_0xeb78('0x12')];_0x2028db(_0xbdff05);}else{return createRemoteTag(_0x5698ca,_0x5a506f,_0x3238e9,_0x51f51f)['then'](function(_0x4cb7e6){_0x2028db(_0x4cb7e6);});}});});}function assignTagToIncident(_0x1b1a55,_0x1d4761,_0x5b4998,_0x363cec,_0x37649c){return new Promise(function(_0x4c54be,_0x5a5de3){var _0x154f19={'method':_0xeb78('0x3d'),'uri':_0x5b4998+'label_entry'+'?'+_0x37649c,'body':{'label':_0x1b1a55,'table':_0xeb78('0x3e'),'id_type':_0xeb78('0x48'),'table_key':_0x363cec['ticketId'],'title':'Incident\x20-\x20'+_0x363cec[_0xeb78('0x49')],'id_display':_0x363cec['ticketNumber']},'auth':_0x1d4761,'json':!![]};return rp(_0x154f19)['then'](function(_0x2029ea){_0x4c54be();})['catch'](function(){_0x4c54be();});});}function manageTags(_0x27b425,_0x42c249,_0x3985a1,_0x4c43a9,_0x2029ce,_0x46c104,_0x1eb889){return new Promise(function(_0x52f966,_0x62bb35){var _0x4ec4ec=[];_0x42c249[_0xeb78('0x4a')](function(_0xbf5fef){_0x4ec4ec[_0xeb78('0x4b')](getRemoteTag(_0xbf5fef,_0x3985a1,_0x4c43a9,_0x46c104,_0x1eb889));});return Promise[_0xeb78('0x4c')](_0x4ec4ec)['then'](function(_0x39003a){if(_0x39003a['length']){logger[_0xeb78('0x13')]('['+[_0x27b425[_0xeb78('0x14')]()]+_0xeb78('0x4d'),_0x39003a);var _0x442fa7=[];_0x39003a[_0xeb78('0x4a')](function(_0x4de84b){_0x442fa7[_0xeb78('0x4b')](assignTagToIncident(_0x4de84b,_0x3985a1,_0x4c43a9,_0x2029ce,_0x46c104));});return Promise[_0xeb78('0x4c')](_0x442fa7)[_0xeb78('0xe')](function(){_0x52f966();})[_0xeb78('0x16')](function(){_0x52f966();});}else{_0x52f966();}});});}function getTags(_0x3eb9c5,_0x1d1219,_0x3f6e4c,_0x36dd0e,_0x31e880,_0x3fe8ce){return function(_0x21e507){return new Promise(function(_0x1e4bfb,_0x233d52){var _0x277c09=[];var _0x28c1a7=_0x36dd0e[_0xeb78('0x4e')];if(_0x28c1a7&&_0x28c1a7['length']>0x0){_0x277c09=_[_0xeb78('0x4f')](_0x28c1a7,_0xeb78('0x39'));}if(_0x277c09[_0xeb78('0xf')]>0x0){return manageTags(_0x3eb9c5,_0x277c09,_0x1d1219,_0x3f6e4c,_0x21e507,_0x31e880,_0x3fe8ce)['then'](function(){_0x1e4bfb(_0x21e507);});}else{_0x1e4bfb(_0x21e507);}});};}function emit(_0x12ea13,_0x2c9dca,_0xe5a41c){var _0x2208c2=_0xeb78('0x50')+_0xeb78('0x51')+_0xeb78('0x52')+_0xeb78('0x53');var _0x411252={'uri':_0x12ea13+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xe5a41c+_0x2208c2};io['to'](util['format'](_0xeb78('0x54'),_0x2c9dca))[_0xeb78('0x55')](_0xeb78('0x56'),_0x411252);}exports['cs']=function(_0x30c186,_0x355baa,_0x86c3f0,_0x6e40f7,_0x36452e,_0x17b7c8,_0x2a9c95,_0x5c27de){var _0xfa7f27={};var _0x1e7562={'user':_0x17b7c8[_0xeb78('0x57')],'pass':_0x17b7c8['password']};var _0x4e7242='sysparm_limit=1';var _0x4cb00a=_0xeb78('0x58');_0x17b7c8[_0xeb78('0x59')]=intUtil[_0xeb78('0x5a')](_0x17b7c8[_0xeb78('0x59')]);_0x17b7c8[_0xeb78('0x5b')]=intUtil[_0xeb78('0x5a')](_0x17b7c8[_0xeb78('0x5b')]);var _0x2a514b=util[_0xeb78('0x5c')](_0xeb78('0x5d'),_0x17b7c8[_0xeb78('0x59')]);_0xfa7f27['userEmail']=!_[_0xeb78('0x5e')](_0x6e40f7)?_0x6e40f7['email']:null;_0xfa7f27[_0xeb78('0x1f')]=_0x17b7c8['email'];_0xfa7f27[_0xeb78('0x24')]=_0x5c27de[_0xeb78('0x32')]()===_0xeb78('0x3c')?_0x355baa[_0xeb78('0x5f')]:_0x355baa[_0xeb78('0x60')];_0xfa7f27['callDirection']=_0x5c27de===_0xeb78('0x61')||_0x5c27de===_0xeb78('0x62')?_0xeb78('0x61'):_0xeb78('0x3c');var _0x3896a1=util[_0xeb78('0x5c')](_0xeb78('0x63'),_0x17b7c8[_0xeb78('0x5b')],_0x355baa[_0xeb78('0x64')],md5(_0x355baa[_0xeb78('0x64')]));if(_0x36452e&&_0x36452e['monitor_format']){logger[_0xeb78('0x13')](_0xeb78('0x65'),_0xeb78('0x66'));_0x355baa[_0xeb78('0x67')]=_0x3896a1;}else if(_0x2a9c95&&_0x2a9c95[_0xeb78('0x68')]&&_0x2a9c95[_0xeb78('0x68')]!==_0xeb78('0x69')){logger['info'](_0xeb78('0x6a'),'Recording\x20is\x20enabled!');_0x355baa[_0xeb78('0x67')]=_0x3896a1;}else{_0x355baa[_0xeb78('0x67')]='';}return getAdminUser(_0x5c27de,_0x1e7562,_0xfa7f27,_0x2a514b,_0x4cb00a,_0x4e7242)[_0xeb78('0xe')](getUser(_0x5c27de,_0x1e7562,_0x2a514b,_0x4cb00a,_0x4e7242))['then'](getEndUser(_0x5c27de,_0x1e7562,_0x2a514b,_0x4cb00a,_0x4e7242))[_0xeb78('0xe')](getTicket(_0x5c27de,_0x1e7562,_0x2a514b,_0x86c3f0,_0x355baa,_0x4cb00a))[_0xeb78('0xe')](function(_0x509d85){logger[_0xeb78('0x13')](util[_0xeb78('0x5c')]('The\x20ticket\x20ID\x20is:\x20%s',_0x509d85[_0xeb78('0x45')]));logger[_0xeb78('0x13')](util[_0xeb78('0x5c')]('call\x20direction:\x20%s',_0x5c27de));if(_0x5c27de!==_0xeb78('0x62')){logger[_0xeb78('0x13')]('['+[_0x5c27de[_0xeb78('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x17b7c8[_0xeb78('0x59')],_0x6e40f7[_0xeb78('0x39')],_0x509d85['ticketId']);}})['catch'](function(_0x5bd3cb){logger['error']('['+[_0x5c27de[_0xeb78('0x14')]()]+_0xeb78('0x6b'),util[_0xeb78('0x6c')](_0x5bd3cb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xab40=['call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','result','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId'];(function(_0x2223be,_0x4e4034){var _0x453496=function(_0x18f9ee){while(--_0x18f9ee){_0x2223be['push'](_0x2223be['shift']());}};_0x453496(++_0x4e4034);}(_0xab40,0xcd));var _0x0ab4=function(_0x491ad5,_0x26565){_0x491ad5=_0x491ad5-0x0;var _0x210f9f=_0xab40[_0x491ad5];return _0x210f9f;};'use strict';var _=require(_0x0ab4('0x0'));var Promise=require(_0x0ab4('0x1'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x0ab4('0x2'));var intUtil=require(_0x0ab4('0x3'));var config=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));config['redis']=_['defaults'](config[_0x0ab4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0ab4('0x8'))(new Redis(config[_0x0ab4('0x7')]));function getAdminUser(_0x11e99f,_0x6d135d,_0x4cf8de,_0x55263d,_0x4b01c4,_0x24271e){return new Promise(function(_0x30e726,_0x40e4d1){var _0x464f7e={'method':_0x0ab4('0x9'),'uri':_0x55263d+_0x0ab4('0xa')+'&'+_0x4b01c4+'&'+_0x24271e,'auth':_0x6d135d,'json':!![]};return rp(_0x464f7e)[_0x0ab4('0xb')](function(_0x27898f){if(_0x27898f['result']['length']>0x0){_0x4cf8de[_0x0ab4('0xc')]=_0x27898f['result'][0x0][_0x0ab4('0xd')];}logger[_0x0ab4('0xe')]('['+[_0x11e99f[_0x0ab4('0xf')]()]+_0x0ab4('0x10'),_0x4cf8de);_0x30e726(_0x4cf8de);})[_0x0ab4('0x11')](function(_0x329104){logger[_0x0ab4('0x12')]('['+[_0x11e99f[_0x0ab4('0xf')]()]+']',_0x329104[_0x0ab4('0x13')]);_0x40e4d1(_0x329104[_0x0ab4('0x13')]);});});}function getUser(_0x216a17,_0x36d246,_0x293e20,_0x45fad1,_0x2a83a8){return function(_0x2403db){logger[_0x0ab4('0xe')]('['+[_0x216a17[_0x0ab4('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x2403db);return new Promise(function(_0x5000d4,_0x49634f){if(intUtil[_0x0ab4('0x14')](_0x2403db[_0x0ab4('0x15')])){var _0x2f50d2={'method':'GET','uri':_0x293e20+_0x0ab4('0x16')+_0x2403db[_0x0ab4('0x15')]+'&'+_0x45fad1+'&'+_0x2a83a8,'auth':_0x36d246,'json':!![]};logger[_0x0ab4('0xe')]('['+[_0x216a17[_0x0ab4('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x2f50d2);return rp(_0x2f50d2)['then'](function(_0xdb0797){logger['info']('['+[_0x216a17[_0x0ab4('0xf')]()]+_0x0ab4('0x17'),_0xdb0797);if(_0xdb0797['result'][_0x0ab4('0x18')]>0x0&&String(_0xdb0797[_0x0ab4('0x19')][0x0][_0x0ab4('0x1a')])===_0x0ab4('0x1b')){_0x2403db[_0x0ab4('0x1c')]=_0xdb0797['result'][0x0]['sys_id'];}else{_0x2403db[_0x0ab4('0x1c')]=_0x2403db[_0x0ab4('0xc')];_0x2403db[_0x0ab4('0x15')]=_0x2403db[_0x0ab4('0x1d')];}logger['info']('['+[_0x216a17[_0x0ab4('0xf')]()]+_0x0ab4('0x1e'),_0x2403db);_0x5000d4(_0x2403db);})[_0x0ab4('0x11')](function(_0x4ea9aa){logger['error']('['+[_0x216a17[_0x0ab4('0xf')]()]+']',_0x4ea9aa[_0x0ab4('0x13')]);_0x49634f(_0x4ea9aa[_0x0ab4('0x13')]);});}else{logger['info']('['+[_0x216a17['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x2403db[_0x0ab4('0x1c')]=_0x2403db['adminId'];_0x2403db[_0x0ab4('0x15')]=_0x2403db[_0x0ab4('0x1d')];_0x5000d4(_0x2403db);}});};}function createEndUser(_0x4f1aeb,_0x4bd747,_0x4d0cc1,_0x3d38a4,_0x183bac){logger[_0x0ab4('0xe')]('['+[_0x4f1aeb[_0x0ab4('0xf')]()]+_0x0ab4('0x1f'),_0x4d0cc1);return new Promise(function(_0x588e0d,_0x5b55c1){var _0x580d56={'method':_0x0ab4('0x20'),'uri':_0x3d38a4+_0x0ab4('0x21')+_0x183bac,'body':{'user_name':_0x4d0cc1[_0x0ab4('0x22')],'roles':_0x0ab4('0x23'),'first_name':_0x4d0cc1[_0x0ab4('0x22')],'active':'true','date_format':'System','phone':_0x4d0cc1[_0x0ab4('0x22')]},'auth':_0x4bd747,'json':!![]};return rp(_0x580d56)[_0x0ab4('0xb')](function(_0x361f7c){logger['info']('['+[_0x4f1aeb['toUpperCase']()]+_0x0ab4('0x24'),_0x361f7c['result']);_0x4d0cc1[_0x0ab4('0x25')]=_0x361f7c[_0x0ab4('0x19')][_0x0ab4('0xd')];_0x588e0d(_0x4d0cc1);})[_0x0ab4('0x11')](function(_0x36841e){logger[_0x0ab4('0x12')]('['+[_0x4f1aeb['toUpperCase']()]+']',_0x36841e[_0x0ab4('0x13')]);_0x5b55c1(_0x36841e[_0x0ab4('0x13')]);});});}function getEndUser(_0xe19cb6,_0xaa1421,_0x4cce0c,_0x504123,_0x379a4b){return function(_0x3e65a1){logger[_0x0ab4('0xe')]('['+[_0xe19cb6['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x3e65a1);return new Promise(function(_0x4cd319,_0x1c234e){var _0x35eab3={'method':_0x0ab4('0x9'),'uri':_0x4cce0c+'sys_user?sysparm_query=phone%3D'+_0x3e65a1['endUserNumber']+'&'+_0x504123+'&'+_0x379a4b,'auth':_0xaa1421,'json':!![]};return rp(_0x35eab3)['then'](function(_0x1951d8){if(_0x1951d8[_0x0ab4('0x19')][_0x0ab4('0x18')]>0x0){_0x3e65a1[_0x0ab4('0x25')]=_0x1951d8[_0x0ab4('0x19')][0x0][_0x0ab4('0xd')];logger[_0x0ab4('0xe')]('['+[_0xe19cb6[_0x0ab4('0xf')]()]+_0x0ab4('0x26'),_0x3e65a1);_0x4cd319(_0x3e65a1);}else{return createEndUser(_0xe19cb6,_0xaa1421,_0x3e65a1,_0x4cce0c,_0x504123)[_0x0ab4('0xb')](function(_0x4f3853){logger[_0x0ab4('0xe')]('['+[_0xe19cb6[_0x0ab4('0xf')]()]+_0x0ab4('0x27'),_0x4f3853);_0x4cd319(_0x4f3853);});}})[_0x0ab4('0x11')](function(_0x2e1da9){logger[_0x0ab4('0x12')]('['+[_0xe19cb6[_0x0ab4('0xf')]()]+']',_0x2e1da9[_0x0ab4('0x13')]);_0x1c234e(_0x2e1da9[_0x0ab4('0x13')]);});});};}function getCustomFields(_0x3774ca,_0x449437){var _0x1974ce={};if(_0x3774ca['length']>0x0){_[_0x0ab4('0x28')](_0x3774ca,function(_0x435610){if(_[_0x0ab4('0x29')]([_0x0ab4('0x2a'),'picklist'],_0x435610[_0x0ab4('0x2b')])&&_0x435610['nameField']&&!_0x435610[_0x0ab4('0x2c')]){_0x1974ce[_0x435610[_0x0ab4('0x2d')][_0x0ab4('0x2e')]()]=_0x435610[_0x0ab4('0x2f')][_0x0ab4('0x30')]();}else if(_[_0x0ab4('0x29')](['string',_0x0ab4('0x31')],_0x435610[_0x0ab4('0x2b')])&&_0x435610[_0x0ab4('0x32')]&&_0x435610['customField']){_0x1974ce[_0x435610[_0x0ab4('0x32')][_0x0ab4('0x2e')]()]=_0x435610[_0x0ab4('0x2f')][_0x0ab4('0x30')]();}else if(_0x435610[_0x0ab4('0x2b')]==='variable'&&_0x435610['variableName']&&_0x435610['idField']&&_0x435610[_0x0ab4('0x2c')]){_0x1974ce[_0x435610[_0x0ab4('0x32')]['toLowerCase']()]=_0x449437[_0x435610[_0x0ab4('0x33')]]['toString']();}else if(_0x435610[_0x0ab4('0x2b')]==='customVariable'&&_0x435610[_0x0ab4('0x34')]&&_0x435610[_0x0ab4('0x34')][_0x0ab4('0x35')]&&_0x435610[_0x0ab4('0x32')]&&_0x435610[_0x0ab4('0x2c')]){_0x1974ce[_0x435610[_0x0ab4('0x32')]['toLowerCase']()]=_0x449437[_0x435610[_0x0ab4('0x34')][_0x0ab4('0x35')][_0x0ab4('0x2e')]()][_0x0ab4('0x30')]();}});}return _0x1974ce;}function getTicket(_0x2dc941,_0x41982e,_0x54c201,_0x9b2c74,_0x4f07d1,_0x2103d7){return function(_0x1849f1){logger[_0x0ab4('0xe')]('['+[_0x2dc941['toUpperCase']()]+_0x0ab4('0x36'),_0x1849f1);return new Promise(function(_0x1fcc3b,_0x1ce096){var _0x3c1247=_0x2dc941[_0x0ab4('0x2e')]()===_0x0ab4('0x37')?_0x1849f1['userId']:_0x1849f1[_0x0ab4('0x25')];var _0xdcc118={'method':_0x0ab4('0x20'),'uri':_0x54c201+_0x0ab4('0x38')+'?'+_0x2103d7,'body':Object[_0x0ab4('0x39')]({},{'active':_0x0ab4('0x1b'),'caller_id':_0x3c1247,'assigned_to':_0x1849f1[_0x0ab4('0x1c')],'short_description':intUtil[_0x0ab4('0x3a')](_0x9b2c74[_0x0ab4('0x3b')],_0x4f07d1,'\x20'),'description':intUtil[_0x0ab4('0x3a')](_0x9b2c74[_0x0ab4('0x3c')],_0x4f07d1,'\x0a')},getCustomFields(_0x9b2c74[_0x0ab4('0x3d')],_0x4f07d1)),'auth':_0x41982e,'json':!![]};return rp(_0xdcc118)[_0x0ab4('0xb')](function(_0x500e62){logger[_0x0ab4('0xe')]('['+[_0x2dc941[_0x0ab4('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x500e62[_0x0ab4('0x19')]);_0x1849f1['ticketId']=_0x500e62['result'][_0x0ab4('0xd')];_0x1849f1[_0x0ab4('0x3e')]=_0x500e62[_0x0ab4('0x19')]['number'];logger[_0x0ab4('0xe')]('['+[_0x2dc941[_0x0ab4('0xf')]()]+_0x0ab4('0x3f'),_0x1849f1);_0x1fcc3b(_0x1849f1);})[_0x0ab4('0x11')](function(_0x30ba95){logger[_0x0ab4('0x12')]('['+[_0x2dc941[_0x0ab4('0xf')]()]+']',_0x30ba95['message']);_0x1ce096(_0x30ba95[_0x0ab4('0x13')]);});});};}function createRemoteTag(_0x59d3f1,_0x31bc52,_0x55c073,_0x2597f2){return new Promise(function(_0x5550ff,_0x52fcb0){var _0x3983ca={'method':_0x0ab4('0x20'),'uri':_0x55c073+_0x0ab4('0x40')+'?'+_0x2597f2,'body':{'short_description':_0x59d3f1,'global':!![],'active':!![],'name':_0x59d3f1},'auth':_0x31bc52,'json':!![]};return rp(_0x3983ca)[_0x0ab4('0xb')](function(_0x4e2db5){var _0x35af0e=_0x4e2db5[_0x0ab4('0x19')][_0x0ab4('0xd')];_0x5550ff(_0x35af0e);});});}function getRemoteTag(_0x2a639c,_0xbfc63b,_0x2354fa,_0x134437,_0x27952b){return new Promise(function(_0x2be6df,_0x1bf892){var _0xe5bce8={'method':_0x0ab4('0x9'),'uri':_0x2354fa+_0x0ab4('0x40')+_0x0ab4('0x41')+_0x2a639c+'&'+_0x134437,'auth':_0xbfc63b,'json':!![]};return rp(_0xe5bce8)[_0x0ab4('0xb')](function(_0x1e5635){if(_0x1e5635[_0x0ab4('0x19')][_0x0ab4('0x18')]>0x0){var _0x41f85b=_0x1e5635['result'][0x0][_0x0ab4('0xd')];_0x2be6df(_0x41f85b);}else{return createRemoteTag(_0x2a639c,_0xbfc63b,_0x2354fa,_0x134437)[_0x0ab4('0xb')](function(_0x3eba1e){_0x2be6df(_0x3eba1e);});}});});}function assignTagToIncident(_0x308f7a,_0x32e38c,_0x3bcb90,_0x387619,_0x251e4d){return new Promise(function(_0x5d5d0e,_0x436fd6){var _0x339ebd={'method':'POST','uri':_0x3bcb90+'label_entry'+'?'+_0x251e4d,'body':{'label':_0x308f7a,'table':_0x0ab4('0x38'),'id_type':_0x0ab4('0x42'),'table_key':_0x387619['ticketId'],'title':'Incident\x20-\x20'+_0x387619[_0x0ab4('0x3e')],'id_display':_0x387619['ticketNumber']},'auth':_0x32e38c,'json':!![]};return rp(_0x339ebd)['then'](function(_0x427b51){_0x5d5d0e();})[_0x0ab4('0x11')](function(){_0x5d5d0e();});});}function manageTags(_0x12dccd,_0x42cbcb,_0x23458b,_0x1fc5b5,_0x43dfdb,_0x53a25e,_0x180c44){return new Promise(function(_0x23378d,_0x325d20){var _0x406df2=[];_0x42cbcb[_0x0ab4('0x28')](function(_0x123e92){_0x406df2['push'](getRemoteTag(_0x123e92,_0x23458b,_0x1fc5b5,_0x53a25e,_0x180c44));});return Promise[_0x0ab4('0x43')](_0x406df2)[_0x0ab4('0xb')](function(_0x4ee561){if(_0x4ee561[_0x0ab4('0x18')]){logger['info']('['+[_0x12dccd[_0x0ab4('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4ee561);var _0x268b23=[];_0x4ee561[_0x0ab4('0x28')](function(_0x99ffe8){_0x268b23[_0x0ab4('0x44')](assignTagToIncident(_0x99ffe8,_0x23458b,_0x1fc5b5,_0x43dfdb,_0x53a25e));});return Promise['all'](_0x268b23)['then'](function(){_0x23378d();})[_0x0ab4('0x11')](function(){_0x23378d();});}else{_0x23378d();}});});}function getTags(_0x4477ba,_0x559b1f,_0x261c73,_0x34f166,_0x34f968,_0x486ed9){return function(_0x295490){return new Promise(function(_0xd3fb04,_0x2c16cf){var _0x10d5cb=[];var _0x4e357c=_0x34f166[_0x0ab4('0x45')];if(_0x4e357c&&_0x4e357c[_0x0ab4('0x18')]>0x0){_0x10d5cb=_[_0x0ab4('0x46')](_0x4e357c,'name');}if(_0x10d5cb['length']>0x0){return manageTags(_0x4477ba,_0x10d5cb,_0x559b1f,_0x261c73,_0x295490,_0x34f968,_0x486ed9)[_0x0ab4('0xb')](function(){_0xd3fb04(_0x295490);});}else{_0xd3fb04(_0x295490);}});};}function emit(_0x339bc0,_0x28b523,_0xc23642){var _0x58c611=_0x0ab4('0x47')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x0ab4('0x48')+_0x0ab4('0x49');var _0x18308f={'uri':_0x339bc0+_0x0ab4('0x4a')+_0xc23642+_0x58c611};io['to'](util[_0x0ab4('0x4b')](_0x0ab4('0x4c'),_0x28b523))[_0x0ab4('0x4d')](_0x0ab4('0x4e'),_0x18308f);}exports['cs']=function(_0x29cf79,_0x5d2ec6,_0x9e529b,_0x534e1a,_0x284278,_0x1993f6,_0x3a0e36,_0x1481b2){var _0x339b8a={};var _0x32282c={'user':_0x1993f6[_0x0ab4('0x4f')],'pass':_0x1993f6[_0x0ab4('0x50')]};var _0x29839c='sysparm_limit=1';var _0x1d2d2d=_0x0ab4('0x51');_0x1993f6['remoteUri']=intUtil[_0x0ab4('0x52')](_0x1993f6[_0x0ab4('0x53')]);_0x1993f6[_0x0ab4('0x54')]=intUtil['stripTrailingSlash'](_0x1993f6[_0x0ab4('0x54')]);var _0x34d9b3=util[_0x0ab4('0x4b')](_0x0ab4('0x55'),_0x1993f6['remoteUri']);_0x339b8a['userEmail']=!_[_0x0ab4('0x56')](_0x534e1a)?_0x534e1a[_0x0ab4('0x57')]:null;_0x339b8a[_0x0ab4('0x1d')]=_0x1993f6[_0x0ab4('0x57')];_0x339b8a['endUserNumber']=_0x1481b2[_0x0ab4('0x2e')]()===_0x0ab4('0x37')?_0x5d2ec6[_0x0ab4('0x58')]:_0x5d2ec6['calleridnum'];_0x339b8a['callDirection']=_0x1481b2===_0x0ab4('0x59')||_0x1481b2===_0x0ab4('0x5a')?_0x0ab4('0x59'):_0x0ab4('0x37');var _0x46f69a=util[_0x0ab4('0x4b')](_0x0ab4('0x5b'),_0x1993f6['serverUrl'],_0x5d2ec6[_0x0ab4('0x5c')],md5(_0x5d2ec6['uniqueid']));if(_0x284278&&_0x284278['monitor_format']){logger[_0x0ab4('0xe')]('[QUEUE]',_0x0ab4('0x5d'));_0x5d2ec6[_0x0ab4('0x5e')]=_0x46f69a;}else if(_0x3a0e36&&_0x3a0e36[_0x0ab4('0x5f')]&&_0x3a0e36[_0x0ab4('0x5f')]!==_0x0ab4('0x60')){logger['info']('[OUTBOUND]',_0x0ab4('0x5d'));_0x5d2ec6[_0x0ab4('0x5e')]=_0x46f69a;}else{_0x5d2ec6['recordingURL']='';}return getAdminUser(_0x1481b2,_0x32282c,_0x339b8a,_0x34d9b3,_0x1d2d2d,_0x29839c)['then'](getUser(_0x1481b2,_0x32282c,_0x34d9b3,_0x1d2d2d,_0x29839c))[_0x0ab4('0xb')](getEndUser(_0x1481b2,_0x32282c,_0x34d9b3,_0x1d2d2d,_0x29839c))[_0x0ab4('0xb')](getTicket(_0x1481b2,_0x32282c,_0x34d9b3,_0x9e529b,_0x5d2ec6,_0x1d2d2d))['then'](function(_0x1165c9){logger[_0x0ab4('0xe')](util[_0x0ab4('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1165c9[_0x0ab4('0x61')]));logger[_0x0ab4('0xe')](util[_0x0ab4('0x4b')](_0x0ab4('0x62'),_0x1481b2));if(_0x1481b2!=='unmanaged'){logger[_0x0ab4('0xe')]('['+[_0x1481b2[_0x0ab4('0xf')]()]+']',_0x0ab4('0x63'));emit(_0x1993f6[_0x0ab4('0x53')],_0x534e1a[_0x0ab4('0x35')],_0x1165c9[_0x0ab4('0x61')]);}})[_0x0ab4('0x11')](function(_0x30ab45){logger[_0x0ab4('0x12')]('['+[_0x1481b2[_0x0ab4('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x0ab4('0x64')](_0x30ab45,{'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 0641cff..0a91fc6 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 _0xccde=['lastevent','lodash','bluebird','util','ioredis','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','apiKey','base64','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','first_name','[HTTP]','merge','map','nameField','customField','toLowerCase','content','toString','type','string','idField','variable','customVariable','Variable','custom_fields','username','password','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','toUpperCase'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xccde,0x1e1));var _0xeccd=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xccde[_0x6287b6];return _0x5d6be4;};'use strict';var _=require(_0xeccd('0x0'));var rp=require('request-promise');var BPromise=require(_0xeccd('0x1'));var md5=require('md5');var util=require(_0xeccd('0x2'));var Redis=require(_0xeccd('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));config[_0xeccd('0x6')]=_[_0xeccd('0x7')](config[_0xeccd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xeccd('0x8'))(new Redis(config[_0xeccd('0x6')]));var def={'method':_0xeccd('0x9'),'json':!![]};function emit(_0x1eebfb,_0x4b068e,_0x1c029a){io['to'](_0x1eebfb)[_0xeccd('0xa')](_0x4b068e,_0x1c029a);}function getTicket(_0x9dccd,_0x6baeb,_0x50b0b2,_0x58b867,_0x5baa39,_0x5deb54,_0x225660,_0x25f325){logger[_0xeccd('0xb')](_0xeccd('0xc'));var _0x307e37=new Date();var _0x59c910=[{'name':_0xeccd('0xd'),'value':intUtil[_0xeccd('0xe')](_0x58b867[_0xeccd('0xf')],_0x5baa39,'\x20')},{'name':_0xeccd('0x10'),'value':_0x6baeb['id']},{'name':_0xeccd('0x11'),'value':_0x6baeb['id']},{'name':_0xeccd('0x12'),'value':intUtil['getString'](_0x58b867['Descriptions'],_0x5baa39,'\x0a')},{'name':_0xeccd('0x13'),'value':_0x307e37[_0xeccd('0x14')]()[_0xeccd('0x15')](0x0,0x13)[_0xeccd('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xeccd('0x17'),'value':'15'},{'name':_0xeccd('0x18'),'value':_0x50b0b2['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xeccd('0x19'),'value':_0x50b0b2[_0xeccd('0xd')]},{'name':_0xeccd('0x1a'),'value':_0x25f325}];if(_0x5deb54[_0xeccd('0x1b')]){_[_0xeccd('0x1c')](_0x5deb54,function(_0x360d25){if(_0x5baa39[_0x360d25[_0xeccd('0x1d')]]){_0x59c910[_0xeccd('0x1e')]({'name':_0x360d25['idField'],'value':_0x5baa39[_0x360d25[_0xeccd('0x1d')]]});}});}return request({'form':{'method':_0xeccd('0x1f'),'input_type':_0xeccd('0x20'),'response_type':_0xeccd('0x20'),'rest_data':JSON[_0xeccd('0x21')]({'session':_0x225660['id'],'module_name':_0xeccd('0x22'),'name_value_list':_0x59c910})}});}function getAuth(_0x508439){return util['format']('Basic\x20%s',new Buffer(_0x508439[_0xeccd('0x23')]+':X')['toString'](_0xeccd('0x24')));}function getServerInfo(_0x20e7b5){return request({'form':{'method':'get_server_info','input_type':_0xeccd('0x20'),'response_type':'JSON','rest_data':JSON[_0xeccd('0x21')]({'session':_0x20e7b5['id']})}});}function getUser(_0x446168,_0x41517f,_0x4537e1){if(!_[_0xeccd('0x25')](_0x41517f)){logger['info'](_0xeccd('0x26'),_0x41517f);return request({'form':{'method':'get_entry_list','input_type':_0xeccd('0x20'),'response_type':_0xeccd('0x20'),'rest_data':JSON[_0xeccd('0x21')]({'session':_0x4537e1['id'],'module_name':_0xeccd('0x27'),'query':util['format'](_0xeccd('0x28'),_0x41517f),'order_by':'','offset':'0','select_fields':['id',_0xeccd('0xd'),_0xeccd('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeccd('0x2a')](function(_0x4fbd3a){if(_0x4fbd3a[_0xeccd('0x2b')][_0xeccd('0x1b')]){var _0x3e42e8=_[_0xeccd('0x2c')](_0x4fbd3a[_0xeccd('0x2b')],function(_0x1c0a3f){return _0x1c0a3f[_0xeccd('0x2d')][_0xeccd('0x29')][_0xeccd('0x2e')]===_0x41517f;});if(_0x3e42e8){logger['info'](_0xeccd('0x2f'));return BPromise['resolve']({'id':_0x3e42e8[_0xeccd('0x2d')]['id'][_0xeccd('0x2e')],'name':_0x3e42e8[_0xeccd('0x2d')][_0xeccd('0xd')][_0xeccd('0x2e')]});}}logger[_0xeccd('0xb')](_0xeccd('0x30'));return BPromise[_0xeccd('0x31')]({'id':_0x4537e1[_0xeccd('0x2d')][_0xeccd('0x32')][_0xeccd('0x2e')],'name':_0x4537e1[_0xeccd('0x2d')][_0xeccd('0x29')][_0xeccd('0x2e')]});});}else{logger['info'](_0xeccd('0x33'));return BPromise[_0xeccd('0x31')]({'id':_0x4537e1['name_value_list'][_0xeccd('0x32')][_0xeccd('0x2e')],'name':_0x4537e1['name_value_list'][_0xeccd('0x29')][_0xeccd('0x2e')]});}}function getEndUser(_0x451a21,_0x160528,_0x2a5778,_0xa96585){logger[_0xeccd('0xb')](_0xeccd('0x34'),_0x2a5778);return request({'form':{'method':_0xeccd('0x35'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xeccd('0x21')]({'session':_0xa96585['id'],'module_name':_0xeccd('0x36'),'query':util[_0xeccd('0x37')](_0xeccd('0x38'),_0x2a5778),'order_by':'','offset':'0','select_fields':['id',_0xeccd('0xd'),_0xeccd('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeccd('0x2a')](function(_0x348f42){if(_0x348f42[_0xeccd('0x2b')][_0xeccd('0x1b')]){var _0x29125c=_[_0xeccd('0x2c')](_0x348f42['entry_list'],function(_0x2d83d8){return _0x2d83d8['name_value_list'][_0xeccd('0x39')][_0xeccd('0x2e')]===_0x2a5778;});if(_0x29125c){logger[_0xeccd('0xb')]('Enduser\x20found!');return BPromise[_0xeccd('0x31')]({'id':_0x29125c[_0xeccd('0x2d')]['id']['value'],'name':_0x29125c['name_value_list'][_0xeccd('0xd')][_0xeccd('0x2e')],'phone':_0x29125c[_0xeccd('0x2d')]['phone_home'][_0xeccd('0x2e')]});}}else{logger['info'](_0xeccd('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xeccd('0x20'),'response_type':_0xeccd('0x20'),'rest_data':JSON[_0xeccd('0x21')]({'session':_0xa96585['id'],'module_name':_0xeccd('0x36'),'name_value_list':[{'name':'first_name','value':_0x160528!==''?_0x160528:util[_0xeccd('0x37')]('Caller\x20-\x20%s',_0x2a5778)},{'name':_0xeccd('0x39'),'value':_0x2a5778}]})}})[_0xeccd('0x2a')](function(_0x5b76a1){logger['info'](_0xeccd('0x3b'));return BPromise[_0xeccd('0x31')]({'id':_0x5b76a1['id'],'name':_0x5b76a1['entry_list'][_0xeccd('0x3c')][_0xeccd('0x2e')],'phone':_0x5b76a1[_0xeccd('0x2b')][_0xeccd('0x39')][_0xeccd('0x2e')]});});}});}function request(_0x3d740d){logger['debug'](_0xeccd('0x3d'),JSON['stringify'](_0x3d740d));return rp(_[_0xeccd('0x3e')](def,_0x3d740d));}function getTags(_0x3ea63e,_0x5c754d){var _0x186dfc=[];if(_0x3ea63e&&_0x3ea63e['length']>0x0){_0x186dfc=_[_0xeccd('0x3f')](_0x3ea63e,_0x5c754d);}return _0x186dfc;}function getCustomFields(_0x34247a,_0x339e19){var _0x514e38=[];var _0x1ca85d={'custom_fields':[]};if(_0x34247a[_0xeccd('0x1b')]>0x0){_[_0xeccd('0x1c')](_0x34247a,function(_0x441c2c){if(_0x441c2c['type']==='string'&&_0x441c2c[_0xeccd('0x40')]&&!_0x441c2c[_0xeccd('0x41')]){_0x1ca85d[_0x441c2c[_0xeccd('0x40')][_0xeccd('0x42')]()]=_0x441c2c[_0xeccd('0x43')][_0xeccd('0x44')]();}else if(_0x441c2c[_0xeccd('0x45')]===_0xeccd('0x46')&&_0x441c2c[_0xeccd('0x47')]&&_0x441c2c['customField']){_0x1ca85d['custom_fields'][_0xeccd('0x1e')]({'id':_0x441c2c[_0xeccd('0x47')],'value':_0x441c2c[_0xeccd('0x43')][_0xeccd('0x44')]()});}else if(_0x441c2c[_0xeccd('0x45')]===_0xeccd('0x48')&&_0x441c2c[_0xeccd('0x1d')]&&_0x441c2c[_0xeccd('0x47')]&&_0x441c2c['customField']){_0x339e19[_0x441c2c['variableName']]&&_0x1ca85d['custom_fields'][_0xeccd('0x1e')]({'id':_0x441c2c['idField'],'value':_0x339e19[_0x441c2c[_0xeccd('0x1d')]][_0xeccd('0x44')]()});}else if(_0x441c2c['type']===_0xeccd('0x49')&&_0x441c2c[_0xeccd('0x4a')]&&_0x441c2c[_0xeccd('0x4a')][_0xeccd('0xd')]&&_0x441c2c['idField']&&_0x441c2c[_0xeccd('0x41')]){_0x339e19[_0x441c2c['Variable'][_0xeccd('0xd')][_0xeccd('0x42')]()]&&_0x1ca85d[_0xeccd('0x4b')][_0xeccd('0x1e')]({'id':_0x441c2c[_0xeccd('0x47')],'value':_0x339e19[_0x441c2c['Variable'][_0xeccd('0xd')][_0xeccd('0x42')]()]['toString']()});}});}return _0x1ca85d;}function getConnection(_0x49893c){return request({'method':_0xeccd('0x9'),'form':{'method':'login','input_type':_0xeccd('0x20'),'response_type':'JSON','rest_data':JSON[_0xeccd('0x21')]({'user_auth':{'user_name':_0x49893c[_0xeccd('0x4c')],'password':_0x49893c[_0xeccd('0x4d')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xeccd('0x2a')](function(_0x5ba7b7){var _0x3c0c4c=_0x5ba7b7;if(_0x3c0c4c['id']){def['sessionID']=_0x3c0c4c['id'];return BPromise['resolve'](_0x3c0c4c);}else{throw new Error(util[_0xeccd('0x37')](_0xeccd('0x4e'),_0x49893c['id']));}});}function setRelationship(_0x1ba4cc,_0x557966,_0x37303f,_0x528a08){return request({'form':{'method':_0xeccd('0x4f'),'input_type':'JSON','response_type':_0xeccd('0x20'),'rest_data':JSON[_0xeccd('0x21')]({'session':_0x1ba4cc['id'],'module_name':'Calls','module_id':_0x37303f['id'],'link_field_name':_0x528a08,'related_ids':[_0x557966['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xeccd('0x50')]=function(_0x703a8d,_0x2761aa,_0x38fd12,_0x113d33,_0x13a929,_0xb503d){var _0x27fcf5,_0x2a066e,_0x45ea1c,_0x12b02e;_0xb503d[_0xeccd('0x51')]=intUtil[_0xeccd('0x52')](_0xb503d['remoteUri']);_0xb503d[_0xeccd('0x53')]=intUtil[_0xeccd('0x52')](_0xb503d[_0xeccd('0x53')]);def[_0xeccd('0x54')]=util[_0xeccd('0x37')]('%s/service/v4_1/rest.php',_0xb503d[_0xeccd('0x51')]);if(_0x13a929&&_0x13a929[_0xeccd('0x55')]){logger['info'](_0xeccd('0x56'),_0xeccd('0x57'));_0x2761aa[_0xeccd('0x58')]=util['format'](_0xeccd('0x59'),_0xb503d[_0xeccd('0x53')],_0x2761aa['uniqueid'],md5(_0x2761aa[_0xeccd('0x5a')]));}else{_0x2761aa[_0xeccd('0x58')]='';}return getConnection(_0xb503d)[_0xeccd('0x2a')](function(_0x5c9e19){_0x12b02e=_0x5c9e19;return getUser(_0xb503d,_0x113d33[_0xeccd('0xd')],_0x12b02e);})['then'](function(_0x52c23a){_0x27fcf5=_0x52c23a;logger[_0xeccd('0xb')](_0xeccd('0x5b'),_0x27fcf5['id']);return getEndUser(_0xb503d,_0x2761aa[_0xeccd('0x5c')],_0x2761aa[_0xeccd('0x5d')],_0x12b02e);})['then'](function(_0x29dea4){_0x2a066e=_0x29dea4;logger[_0xeccd('0xb')](_0xeccd('0x5e'),_0x2a066e['id']);return getTicket(_0xb503d,_0x27fcf5,_0x2a066e,_0x38fd12,_0x2761aa,_0x38fd12[_0xeccd('0x5f')],_0x12b02e,_0xeccd('0x60'));})[_0xeccd('0x2a')](function(_0x180d21){_0x45ea1c=_0x180d21;logger['info'](_0xeccd('0x61'));logger[_0xeccd('0xb')](_0xeccd('0x62'),_0x45ea1c['id']);return setRelationship(_0x12b02e,_0x27fcf5,_0x45ea1c,_0xeccd('0x63'));})[_0xeccd('0x2a')](function(){return setRelationship(_0x12b02e,_0x2a066e,_0x45ea1c,_0xeccd('0x64'));})[_0xeccd('0x2a')](function(){return getServerInfo(_0x12b02e);})[_0xeccd('0x2a')](function(_0x44889d){var _0x549892=parseInt(_0x44889d[_0xeccd('0x65')][_0xeccd('0x66')](0x0));var _0x145589=util[_0xeccd('0x37')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xb503d['remoteUri'],_0x45ea1c['id']);if(_0x549892>0x6){_0x145589=util[_0xeccd('0x37')](_0xeccd('0x67'),_0xb503d[_0xeccd('0x51')],_0x45ea1c['id']);}logger[_0xeccd('0xb')]('[QUEUE]',_0xeccd('0x68'));emit(util[_0xeccd('0x37')](_0xeccd('0x69'),_0x113d33['name']),_0xeccd('0x6a'),{'uri':_0x145589});})[_0xeccd('0x6b')](function(_0x1b4e44){logger[_0xeccd('0x6c')](_0xeccd('0x56'),JSON[_0xeccd('0x21')](_0x1b4e44));});};exports[_0xeccd('0x6d')]=function(_0x4773fa,_0x5d50de,_0x419bba,_0x567726,_0x575d78,_0x4ed5b8,_0x2c3a39){var _0xb4d717,_0x5d9e9d,_0x14e4d1,_0x3d0236;_0x4ed5b8[_0xeccd('0x51')]=intUtil[_0xeccd('0x52')](_0x4ed5b8['remoteUri']);_0x4ed5b8['serverUrl']=intUtil[_0xeccd('0x52')](_0x4ed5b8['serverUrl']);def[_0xeccd('0x54')]=util[_0xeccd('0x37')](_0xeccd('0x6e'),_0x4ed5b8[_0xeccd('0x51')]);if(_0x2c3a39&&_0x2c3a39['recordingFormat']&&_0x2c3a39[_0xeccd('0x6f')]!==_0xeccd('0x70')){logger['info'](_0xeccd('0x71'),_0xeccd('0x57'));_0x5d50de[_0xeccd('0x58')]=util[_0xeccd('0x37')](_0xeccd('0x59'),_0x4ed5b8[_0xeccd('0x53')],_0x5d50de[_0xeccd('0x5a')],md5(_0x5d50de['uniqueid']));}return getConnection(_0x4ed5b8)[_0xeccd('0x2a')](function(_0xdcedec){_0x3d0236=_0xdcedec;return getUser(_0x4ed5b8,_0x567726[_0xeccd('0xd')],_0x3d0236);})['then'](function(_0x52fe35){_0xb4d717=_0x52fe35;logger['info'](_0xeccd('0x5b'),_0xb4d717['id']);return getEndUser(_0x4ed5b8,_0x5d50de[_0xeccd('0x72')],_0x5d50de['destcalleridnum'],_0x3d0236);})[_0xeccd('0x2a')](function(_0x104636){_0x5d9e9d=_0x104636;logger[_0xeccd('0xb')](_0xeccd('0x5e'),_0x5d9e9d['id']);return getTicket(_0x4ed5b8,_0xb4d717,_0x5d9e9d,_0x419bba,_0x5d50de,_0x419bba[_0xeccd('0x5f')],_0x3d0236,_0xeccd('0x73'));})['then'](function(_0x3f8b4b){_0x14e4d1=_0x3f8b4b;logger[_0xeccd('0xb')](_0xeccd('0x61'));logger['info'](_0xeccd('0x62'),_0x14e4d1['id']);return setRelationship(_0x3d0236,_0xb4d717,_0x14e4d1,_0xeccd('0x63'));})[_0xeccd('0x2a')](function(){return setRelationship(_0x3d0236,_0x5d9e9d,_0x14e4d1,_0xeccd('0x64'));})[_0xeccd('0x2a')](function(){return getServerInfo(_0x3d0236);})[_0xeccd('0x2a')](function(_0xe18efd){var _0x162419=parseInt(_0xe18efd[_0xeccd('0x65')]['charAt'](0x0));var _0x165850=util['format'](_0xeccd('0x74'),_0x4ed5b8[_0xeccd('0x51')],_0x14e4d1['id']);if(_0x162419>0x6){_0x165850=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4ed5b8[_0xeccd('0x51')],_0x14e4d1['id']);}logger['info']('[OUTBOUND]',_0xeccd('0x68'));emit(util[_0xeccd('0x37')]('user:%s',_0x567726[_0xeccd('0xd')]),'trigger:browser:url',{'uri':_0x165850});})[_0xeccd('0x6b')](function(_0x4e733a){logger[_0xeccd('0x6c')](_0xeccd('0x71'),JSON[_0xeccd('0x21')](_0x4e733a));});};exports[_0xeccd('0x75')]=function(_0x594be1,_0x31f4ba,_0x1a08f9,_0x408385,_0x380d43,_0xfdf1ac){var _0xdfa01f,_0x4e8404,_0xd9335,_0x573646;_0xfdf1ac[_0xeccd('0x51')]=intUtil[_0xeccd('0x52')](_0xfdf1ac['remoteUri']);_0xfdf1ac['serverUrl']=intUtil[_0xeccd('0x52')](_0xfdf1ac[_0xeccd('0x53')]);def['uri']=util[_0xeccd('0x37')](_0xeccd('0x6e'),_0xfdf1ac[_0xeccd('0x51')]);if(_0x380d43&&_0x380d43[_0xeccd('0x55')]){logger[_0xeccd('0xb')]('['+_0x31f4ba['lastevent'][_0xeccd('0x76')]()+']',_0xeccd('0x57'));_0x31f4ba[_0xeccd('0x58')]=util[_0xeccd('0x37')](_0xeccd('0x59'),_0xfdf1ac['serverUrl'],_0x31f4ba[_0xeccd('0x5a')],md5(_0x31f4ba[_0xeccd('0x5a')]));}else{_0x31f4ba[_0xeccd('0x58')]='';}return getConnection(_0xfdf1ac)['then'](function(_0x4307b9){_0x573646=_0x4307b9;if(!_[_0xeccd('0x25')](_0x408385)){return getUser(_0xfdf1ac,_0x408385[_0xeccd('0xd')],_0x573646);}else{return getUser(_0xfdf1ac,null,_0x573646);}})[_0xeccd('0x2a')](function(_0xe4d86b){_0xdfa01f=_0xe4d86b;logger['info'](_0xeccd('0x5b'),_0xdfa01f['id']);return getEndUser(_0xfdf1ac,_0x31f4ba[_0xeccd('0x5c')],_0x31f4ba[_0xeccd('0x5d')],_0x573646);})[_0xeccd('0x2a')](function(_0x523725){_0x4e8404=_0x523725;logger[_0xeccd('0xb')](_0xeccd('0x5e'),_0x4e8404['id']);return getTicket(_0xfdf1ac,_0xdfa01f,_0x4e8404,_0x1a08f9,_0x31f4ba,_0x1a08f9['Fields'],_0x573646,_0xeccd('0x60'));})[_0xeccd('0x2a')](function(_0x249825){_0xd9335=_0x249825;logger['info'](_0xeccd('0x61'));logger['info'](_0xeccd('0x62'),_0xd9335['id']);return setRelationship(_0x573646,_0xdfa01f,_0xd9335,_0xeccd('0x63'));})[_0xeccd('0x2a')](function(){return setRelationship(_0x573646,_0x4e8404,_0xd9335,_0xeccd('0x64'));})['then'](function(){return getServerInfo(_0x573646);})['catch'](function(_0x31dd81){logger[_0xeccd('0x6c')]('['+_0x31f4ba[_0xeccd('0x77')][_0xeccd('0x76')]()+']',JSON['stringify'](_0x31dd81));});}; \ No newline at end of file +var _0x8101=['value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','trigger:browser:url','unmanaged','uri','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','push','idField','variableName','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list'];(function(_0x55ce1b,_0x1769ab){var _0xb7d109=function(_0x995913){while(--_0x995913){_0x55ce1b['push'](_0x55ce1b['shift']());}};_0xb7d109(++_0x1769ab);}(_0x8101,0xc0));var _0x1810=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x8101[_0x257495];return _0x3849aa;};'use strict';var _=require(_0x1810('0x0'));var rp=require(_0x1810('0x1'));var BPromise=require(_0x1810('0x2'));var md5=require(_0x1810('0x3'));var util=require(_0x1810('0x4'));var Redis=require(_0x1810('0x5'));var intUtil=require(_0x1810('0x6'));var config=require(_0x1810('0x7'));var logger=require(_0x1810('0x8'))('sugarcrm');config['redis']=_[_0x1810('0x9')](config[_0x1810('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x1810('0xb'))(new Redis(config[_0x1810('0xa')]));var def={'method':_0x1810('0xc'),'json':!![]};function emit(_0x33d690,_0x312a3c,_0x271738){io['to'](_0x33d690)[_0x1810('0xd')](_0x312a3c,_0x271738);}function getTicket(_0x2dde85,_0xaa4b05,_0x1e732c,_0x419324,_0x5126d2,_0x3a664b,_0x18bb2d,_0x4f4f4a){logger[_0x1810('0xe')]('Creating\x20new\x20ticket...');var _0x4ee397=new Date();var _0x3c8a9f=[{'name':_0x1810('0xf'),'value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x11')],_0x5126d2,'\x20')},{'name':_0x1810('0x12'),'value':_0xaa4b05['id']},{'name':_0x1810('0x13'),'value':_0xaa4b05['id']},{'name':'description','value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x14')],_0x5126d2,'\x0a')},{'name':'date_start','value':_0x4ee397['toISOString']()[_0x1810('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1810('0x16'),'value':'0'},{'name':_0x1810('0x17'),'value':'15'},{'name':_0x1810('0x18'),'value':_0x1e732c['id']},{'name':_0x1810('0x19'),'value':_0x1810('0x1a')},{'name':_0x1810('0x1b'),'value':_0x1e732c[_0x1810('0xf')]},{'name':'direction','value':_0x4f4f4a}];if(_0x3a664b['length']){_['forEach'](_0x3a664b,function(_0x3491d8){if(_0x5126d2[_0x3491d8['variableName']]){_0x3c8a9f[_0x1810('0x1c')]({'name':_0x3491d8[_0x1810('0x1d')],'value':_0x5126d2[_0x3491d8[_0x1810('0x1e')]]});}});}return request({'form':{'method':_0x1810('0x1f'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0x18bb2d['id'],'module_name':_0x1810('0x21'),'name_value_list':_0x3c8a9f})}});}function getAuth(_0x116ea0){return util['format'](_0x1810('0x22'),new Buffer(_0x116ea0[_0x1810('0x23')]+':X')[_0x1810('0x24')](_0x1810('0x25')));}function getServerInfo(_0xe66600){return request({'form':{'method':_0x1810('0x26'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xe66600['id']})}});}function getUser(_0x254062,_0x77b5ed,_0x53ca63){if(!_[_0x1810('0x28')](_0x77b5ed)){logger['info']('Getting\x20agent\x20with\x20name',_0x77b5ed);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x53ca63['id'],'module_name':_0x1810('0x2a'),'query':util['format'](_0x1810('0x2b'),_0x77b5ed),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),_0x1810('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1810('0x2d')](function(_0x523bb2){if(_0x523bb2['entry_list'][_0x1810('0x2e')]){var _0x33f077=_[_0x1810('0x2f')](_0x523bb2[_0x1810('0x30')],function(_0x2d387a){return _0x2d387a[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]===_0x77b5ed;});if(_0x33f077){logger[_0x1810('0xe')](_0x1810('0x33'));return BPromise[_0x1810('0x34')]({'id':_0x33f077[_0x1810('0x31')]['id'][_0x1810('0x32')],'name':_0x33f077['name_value_list'][_0x1810('0xf')][_0x1810('0x32')]});}}logger[_0x1810('0xe')](_0x1810('0x35'));return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')]['user_id'][_0x1810('0x32')],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});});}else{logger[_0x1810('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')][_0x1810('0x36')]['value'],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});}}function getEndUser(_0xb46b04,_0x3c3d0a,_0x287181,_0xaecd29){logger[_0x1810('0xe')](_0x1810('0x37'),_0x287181);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'query':util[_0x1810('0x38')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x287181),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xbb39c2){if(_0xbb39c2[_0x1810('0x30')]['length']){var _0x284b30=_[_0x1810('0x2f')](_0xbb39c2[_0x1810('0x30')],function(_0x345da0){return _0x345da0[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]===_0x287181;});if(_0x284b30){logger['info'](_0x1810('0x3a'));return BPromise[_0x1810('0x34')]({'id':_0x284b30['name_value_list']['id']['value'],'name':_0x284b30[_0x1810('0x31')]['name'][_0x1810('0x32')],'phone':_0x284b30[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]});}}else{logger[_0x1810('0xe')](_0x1810('0x3b'));return request({'form':{'method':_0x1810('0x1f'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'name_value_list':[{'name':'first_name','value':_0x3c3d0a!==_0x1810('0x3c')?_0x3c3d0a:util[_0x1810('0x38')](_0x1810('0x3d'),_0x287181)},{'name':_0x1810('0x39'),'value':_0x287181}]})}})[_0x1810('0x2d')](function(_0x41c0ab){logger[_0x1810('0xe')](_0x1810('0x3e'));return BPromise[_0x1810('0x34')]({'id':_0x41c0ab['id'],'name':_0x41c0ab[_0x1810('0x30')]['first_name'][_0x1810('0x32')],'phone':_0x41c0ab[_0x1810('0x30')][_0x1810('0x39')]['value']});});}});}function request(_0x368a37){logger[_0x1810('0x3f')](_0x1810('0x40'),JSON[_0x1810('0x27')](_0x368a37));return rp(_[_0x1810('0x41')](def,_0x368a37));}function getTags(_0x378582,_0x4d1de7){var _0x30372a=[];if(_0x378582&&_0x378582[_0x1810('0x2e')]>0x0){_0x30372a=_[_0x1810('0x42')](_0x378582,_0x4d1de7);}return _0x30372a;}function getCustomFields(_0x171190,_0x459570){var _0x4e63d9=[];var _0x358eda={'custom_fields':[]};if(_0x171190[_0x1810('0x2e')]>0x0){_[_0x1810('0x43')](_0x171190,function(_0x15ce70){if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x45')&&_0x15ce70[_0x1810('0x46')]&&!_0x15ce70[_0x1810('0x47')]){_0x358eda[_0x15ce70[_0x1810('0x46')][_0x1810('0x48')]()]=_0x15ce70[_0x1810('0x49')]['toString']();}else if(_0x15ce70[_0x1810('0x44')]==='string'&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70['customField']){_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x15ce70[_0x1810('0x49')][_0x1810('0x24')]()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4b')&&_0x15ce70[_0x1810('0x1e')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x1e')]]&&_0x358eda[_0x1810('0x4a')]['push']({'id':_0x15ce70['idField'],'value':_0x459570[_0x15ce70[_0x1810('0x1e')]]['toString']()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4c')&&_0x15ce70['Variable']&&_0x15ce70['Variable'][_0x1810('0xf')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')]['toLowerCase']()]&&_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')][_0x1810('0x48')]()][_0x1810('0x24')]()});}});}return _0x358eda;}function getConnection(_0x25d609){return request({'method':_0x1810('0xc'),'form':{'method':_0x1810('0x4e'),'input_type':_0x1810('0x20'),'response_type':'JSON','rest_data':JSON[_0x1810('0x27')]({'user_auth':{'user_name':_0x25d609[_0x1810('0x4f')],'password':_0x25d609[_0x1810('0x50')],'encryption':_0x1810('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x1810('0x2d')](function(_0x126b0c){var _0x5f5763=_0x126b0c;if(_0x5f5763['id']){def[_0x1810('0x52')]=_0x5f5763['id'];return BPromise['resolve'](_0x5f5763);}else{throw new Error(util['format'](_0x1810('0x53'),_0x25d609['id']));}});}function setRelationship(_0x5f2735,_0x4207c4,_0x4628a7,_0xf895b1){return request({'form':{'method':_0x1810('0x54'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x5f2735['id'],'module_name':_0x1810('0x21'),'module_id':_0x4628a7['id'],'link_field_name':_0xf895b1,'related_ids':[_0x4207c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1810('0x55')]=function(_0x2c4c00,_0x73fef8,_0x4a71a8,_0x4f0f76,_0x498213,_0x3c51ec){var _0x1f2974,_0x358d17,_0x53bec7,_0x3337e2;_0x3c51ec[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x3c51ec[_0x1810('0x56')]);_0x3c51ec[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x3c51ec['serverUrl']);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x3c51ec[_0x1810('0x56')]);if(_0x498213&&_0x498213[_0x1810('0x5a')]){logger[_0x1810('0xe')]('[QUEUE]',_0x1810('0x5b'));_0x73fef8['recordingURL']=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c51ec[_0x1810('0x57')],_0x73fef8[_0x1810('0x5c')],md5(_0x73fef8['uniqueid']));}else{_0x73fef8[_0x1810('0x5d')]='';}return getConnection(_0x3c51ec)['then'](function(_0x3b636e){_0x3337e2=_0x3b636e;return getUser(_0x3c51ec,_0x4f0f76[_0x1810('0xf')],_0x3337e2);})[_0x1810('0x2d')](function(_0x4638d2){_0x1f2974=_0x4638d2;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0x1f2974['id']);return getEndUser(_0x3c51ec,_0x73fef8[_0x1810('0x5e')],_0x73fef8[_0x1810('0x5f')],_0x3337e2);})['then'](function(_0x37dbe1){_0x358d17=_0x37dbe1;logger['info'](_0x1810('0x60'),_0x358d17['id']);return getTicket(_0x3c51ec,_0x1f2974,_0x358d17,_0x4a71a8,_0x73fef8,_0x4a71a8[_0x1810('0x61')],_0x3337e2,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x1949a6){_0x53bec7=_0x1949a6;logger['info'](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x53bec7['id']);return setRelationship(_0x3337e2,_0x1f2974,_0x53bec7,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x3337e2,_0x358d17,_0x53bec7,_0x1810('0x65'));})[_0x1810('0x2d')](function(){return getServerInfo(_0x3337e2);})[_0x1810('0x2d')](function(_0x17e12b){var _0x40deb3=parseInt(_0x17e12b[_0x1810('0x66')][_0x1810('0x67')](0x0));var _0x41eaef=util[_0x1810('0x38')](_0x1810('0x68'),_0x3c51ec[_0x1810('0x56')],_0x53bec7['id']);if(_0x40deb3>0x6){_0x41eaef=util[_0x1810('0x38')](_0x1810('0x69'),_0x3c51ec['remoteUri'],_0x53bec7['id']);}logger[_0x1810('0xe')](_0x1810('0x6a'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x4f0f76[_0x1810('0xf')]),'trigger:browser:url',{'uri':_0x41eaef});})[_0x1810('0x6d')](function(_0x35c92a){logger[_0x1810('0x6e')]('[QUEUE]',JSON[_0x1810('0x27')](_0x35c92a));});};exports['outbound']=function(_0x27d55d,_0x4a13df,_0x425f4c,_0x24f731,_0x4b9858,_0x39051b,_0x771847){var _0x34fa25,_0x1346ed,_0x26af3a,_0x4264b4;_0x39051b[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x56')]);_0x39051b['serverUrl']=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x57')]);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x39051b[_0x1810('0x56')]);if(_0x771847&&_0x771847[_0x1810('0x6f')]&&_0x771847[_0x1810('0x6f')]!=='none'){logger['info'](_0x1810('0x70'),_0x1810('0x5b'));_0x4a13df[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39051b[_0x1810('0x57')],_0x4a13df[_0x1810('0x5c')],md5(_0x4a13df['uniqueid']));}return getConnection(_0x39051b)[_0x1810('0x2d')](function(_0x5c5761){_0x4264b4=_0x5c5761;return getUser(_0x39051b,_0x24f731[_0x1810('0xf')],_0x4264b4);})[_0x1810('0x2d')](function(_0x5c5efa){_0x34fa25=_0x5c5efa;logger['info']('The\x20User\x20ID\x20is:',_0x34fa25['id']);return getEndUser(_0x39051b,_0x4a13df[_0x1810('0x71')],_0x4a13df['destcalleridnum'],_0x4264b4);})[_0x1810('0x2d')](function(_0x57b877){_0x1346ed=_0x57b877;logger['info'](_0x1810('0x60'),_0x1346ed['id']);return getTicket(_0x39051b,_0x34fa25,_0x1346ed,_0x425f4c,_0x4a13df,_0x425f4c[_0x1810('0x61')],_0x4264b4,_0x1810('0x72'));})[_0x1810('0x2d')](function(_0x316b0b){_0x26af3a=_0x316b0b;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x26af3a['id']);return setRelationship(_0x4264b4,_0x34fa25,_0x26af3a,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x4264b4,_0x1346ed,_0x26af3a,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x4264b4);})[_0x1810('0x2d')](function(_0x396601){var _0x24f812=parseInt(_0x396601['version'][_0x1810('0x67')](0x0));var _0x52928b=util[_0x1810('0x38')](_0x1810('0x68'),_0x39051b[_0x1810('0x56')],_0x26af3a['id']);if(_0x24f812>0x6){_0x52928b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39051b[_0x1810('0x56')],_0x26af3a['id']);}logger[_0x1810('0xe')](_0x1810('0x70'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x24f731[_0x1810('0xf')]),_0x1810('0x73'),{'uri':_0x52928b});})[_0x1810('0x6d')](function(_0x17e02b){logger['error'](_0x1810('0x70'),JSON['stringify'](_0x17e02b));});};exports[_0x1810('0x74')]=function(_0xeb72e7,_0x26eb0e,_0x2525b0,_0x22d588,_0x2b1abe,_0x49df55){var _0xf6c9b7,_0x260cfc,_0x3b4bd1,_0x1bb59a;_0x49df55[_0x1810('0x56')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x56')]);_0x49df55[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x57')]);def[_0x1810('0x75')]=util[_0x1810('0x38')](_0x1810('0x59'),_0x49df55[_0x1810('0x56')]);if(_0x2b1abe&&_0x2b1abe[_0x1810('0x5a')]){logger[_0x1810('0xe')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']','Recording\x20is\x20enabled!');_0x26eb0e[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49df55[_0x1810('0x57')],_0x26eb0e[_0x1810('0x5c')],md5(_0x26eb0e[_0x1810('0x5c')]));}else{_0x26eb0e['recordingURL']='';}return getConnection(_0x49df55)[_0x1810('0x2d')](function(_0x55b6b4){_0x1bb59a=_0x55b6b4;if(!_['isNil'](_0x22d588)){return getUser(_0x49df55,_0x22d588[_0x1810('0xf')],_0x1bb59a);}else{return getUser(_0x49df55,null,_0x1bb59a);}})[_0x1810('0x2d')](function(_0x53256c){_0xf6c9b7=_0x53256c;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0xf6c9b7['id']);return getEndUser(_0x49df55,_0x26eb0e[_0x1810('0x5e')],_0x26eb0e[_0x1810('0x5f')],_0x1bb59a);})[_0x1810('0x2d')](function(_0x52da7b){_0x260cfc=_0x52da7b;logger['info'](_0x1810('0x60'),_0x260cfc['id']);return getTicket(_0x49df55,_0xf6c9b7,_0x260cfc,_0x2525b0,_0x26eb0e,_0x2525b0['Fields'],_0x1bb59a,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x5d578d){_0x3b4bd1=_0x5d578d;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')](_0x1810('0x78'),_0x3b4bd1['id']);return setRelationship(_0x1bb59a,_0xf6c9b7,_0x3b4bd1,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x1bb59a,_0x260cfc,_0x3b4bd1,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x1bb59a);})[_0x1810('0x6d')](function(_0xfa6d8c){logger[_0x1810('0x6e')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']',JSON[_0x1810('0x27')](_0xfa6d8c));});}; \ 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 2db2585..e3cb5da 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 _0x7a40=['toLowerCase','toString','keyValue','keyType','string','key','format','keyContent','variable','customVariable','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','length','type','push','content','variableName','Variable','name'];(function(_0xe43376,_0x2f678c){var _0x3f41ae=function(_0x1254d2){while(--_0x1254d2){_0xe43376['push'](_0xe43376['shift']());}};_0x3f41ae(++_0x2f678c);}(_0x7a40,0x1a0));var _0x07a4=function(_0x37d5ba,_0x34246d){_0x37d5ba=_0x37d5ba-0x0;var _0x41a41e=_0x7a40[_0x37d5ba];return _0x41a41e;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));exports['getString']=function(_0x1e557e,_0x4106ee,_0x32c073){var _0x2eada3=[];if(_0x1e557e['length']>0x0){var _0xd26ad0=_['sortBy'](_0x1e557e,['id']);for(var _0x50f347=0x0;_0x50f347<_0xd26ad0[_0x07a4('0x2')];_0x50f347++){var _0x9c8053=_0xd26ad0[_0x50f347];if(_0x9c8053[_0x07a4('0x3')]==='string'){_0x2eada3[_0x07a4('0x4')](_0x9c8053[_0x07a4('0x5')]);}else if(_0x9c8053[_0x07a4('0x3')]==='variable'&&_0x9c8053[_0x07a4('0x6')]){_0x4106ee[_0x9c8053[_0x07a4('0x6')]]&&_0x2eada3[_0x07a4('0x4')](_0x4106ee[_0x9c8053[_0x07a4('0x6')]]['toString']());}else if(_0x9c8053['type']==='customVariable'&&_0x9c8053[_0x07a4('0x7')]&&_0x9c8053['Variable'][_0x07a4('0x8')]){_0x4106ee[_0x9c8053[_0x07a4('0x7')][_0x07a4('0x8')]['toLowerCase']()]&&_0x2eada3[_0x07a4('0x4')](_0x4106ee[_0x9c8053[_0x07a4('0x7')][_0x07a4('0x8')][_0x07a4('0x9')]()][_0x07a4('0xa')]());}else if(_0x9c8053[_0x07a4('0x3')]===_0x07a4('0xb')){if(_0x9c8053[_0x07a4('0xc')]===_0x07a4('0xd')&&_0x9c8053[_0x07a4('0xe')]){_0x2eada3[_0x07a4('0x4')](util[_0x07a4('0xf')]('%s:\x20%s',_0x9c8053[_0x07a4('0xe')],_0x9c8053[_0x07a4('0x10')]));}else if(_0x9c8053[_0x07a4('0xc')]===_0x07a4('0x11')&&_0x9c8053[_0x07a4('0x6')]&&_0x9c8053['key']){_0x4106ee[_0x9c8053[_0x07a4('0x6')]]&&_0x2eada3[_0x07a4('0x4')](util[_0x07a4('0xf')]('%s:\x20%s',_0x9c8053['key'],_0x4106ee[_0x9c8053[_0x07a4('0x6')]]));}else if(_0x9c8053[_0x07a4('0xc')]===_0x07a4('0x12')&&_0x9c8053[_0x07a4('0x7')]&&_0x9c8053[_0x07a4('0x7')][_0x07a4('0x8')]&&_0x9c8053[_0x07a4('0xe')]){_0x4106ee[_0x9c8053[_0x07a4('0x7')][_0x07a4('0x8')][_0x07a4('0x9')]()]&&_0x2eada3['push'](util[_0x07a4('0xf')]('%s:\x20%s',_0x9c8053[_0x07a4('0xe')],_0x4106ee[_0x9c8053[_0x07a4('0x7')]['name'][_0x07a4('0x9')]()]));}}}}return _0x2eada3['join'](_0x32c073);};exports[_0x07a4('0x13')]=function(_0x1233d7){var _0x4a8ae0=_0x1233d7[_0x07a4('0x14')](-0x1);if(_0x4a8ae0==='/'){_0x1233d7=_0x1233d7[_0x07a4('0x15')](0x0,_0x1233d7[_0x07a4('0x16')](_0x4a8ae0));}return _0x1233d7;};exports[_0x07a4('0x17')]=function(_0x139f0d){if(!_['isNil'](_0x139f0d)&&_0x139f0d!==''){var _0x38b315=/^(([^<>()\[\]\\.,;:\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 _0x38b315[_0x07a4('0x18')](String(_0x139f0d)[_0x07a4('0x9')]());}else{return![];}}; \ No newline at end of file +var _0xb0cb=['toLowerCase','toString','keyValue','key','format','keyContent','keyType','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name'];(function(_0x5f2af8,_0x223032){var _0x319a73=function(_0x1b50d0){while(--_0x1b50d0){_0x5f2af8['push'](_0x5f2af8['shift']());}};_0x319a73(++_0x223032);}(_0xb0cb,0x10a));var _0xbb0c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xb0cb[_0xda464c];return _0x19e222;};'use strict';var _=require(_0xbb0c('0x0'));var util=require(_0xbb0c('0x1'));exports[_0xbb0c('0x2')]=function(_0x1e2ffe,_0x20a860,_0x143665){var _0x40def5=[];if(_0x1e2ffe[_0xbb0c('0x3')]>0x0){var _0x4e7903=_[_0xbb0c('0x4')](_0x1e2ffe,['id']);for(var _0x22e63d=0x0;_0x22e63d<_0x4e7903['length'];_0x22e63d++){var _0x46d494=_0x4e7903[_0x22e63d];if(_0x46d494[_0xbb0c('0x5')]===_0xbb0c('0x6')){_0x40def5[_0xbb0c('0x7')](_0x46d494[_0xbb0c('0x8')]);}else if(_0x46d494['type']===_0xbb0c('0x9')&&_0x46d494['variableName']){_0x20a860[_0x46d494[_0xbb0c('0xa')]]&&_0x40def5[_0xbb0c('0x7')](_0x20a860[_0x46d494[_0xbb0c('0xa')]]['toString']());}else if(_0x46d494['type']===_0xbb0c('0xb')&&_0x46d494[_0xbb0c('0xc')]&&_0x46d494[_0xbb0c('0xc')]['name']){_0x20a860[_0x46d494['Variable'][_0xbb0c('0xd')]['toLowerCase']()]&&_0x40def5[_0xbb0c('0x7')](_0x20a860[_0x46d494[_0xbb0c('0xc')][_0xbb0c('0xd')][_0xbb0c('0xe')]()][_0xbb0c('0xf')]());}else if(_0x46d494[_0xbb0c('0x5')]===_0xbb0c('0x10')){if(_0x46d494['keyType']===_0xbb0c('0x6')&&_0x46d494[_0xbb0c('0x11')]){_0x40def5[_0xbb0c('0x7')](util[_0xbb0c('0x12')]('%s:\x20%s',_0x46d494[_0xbb0c('0x11')],_0x46d494[_0xbb0c('0x13')]));}else if(_0x46d494[_0xbb0c('0x14')]===_0xbb0c('0x9')&&_0x46d494[_0xbb0c('0xa')]&&_0x46d494[_0xbb0c('0x11')]){_0x20a860[_0x46d494[_0xbb0c('0xa')]]&&_0x40def5[_0xbb0c('0x7')](util[_0xbb0c('0x12')](_0xbb0c('0x15'),_0x46d494[_0xbb0c('0x11')],_0x20a860[_0x46d494[_0xbb0c('0xa')]]));}else if(_0x46d494[_0xbb0c('0x14')]===_0xbb0c('0xb')&&_0x46d494[_0xbb0c('0xc')]&&_0x46d494[_0xbb0c('0xc')]['name']&&_0x46d494['key']){_0x20a860[_0x46d494[_0xbb0c('0xc')][_0xbb0c('0xd')]['toLowerCase']()]&&_0x40def5[_0xbb0c('0x7')](util[_0xbb0c('0x12')](_0xbb0c('0x15'),_0x46d494[_0xbb0c('0x11')],_0x20a860[_0x46d494['Variable'][_0xbb0c('0xd')]['toLowerCase']()]));}}}}return _0x40def5['join'](_0x143665);};exports[_0xbb0c('0x16')]=function(_0x17606b){var _0x37d925=_0x17606b[_0xbb0c('0x17')](-0x1);if(_0x37d925==='/'){_0x17606b=_0x17606b[_0xbb0c('0x18')](0x0,_0x17606b[_0xbb0c('0x19')](_0x37d925));}return _0x17606b;};exports[_0xbb0c('0x1a')]=function(_0x2f00fc){if(!_['isNil'](_0x2f00fc)&&_0x2f00fc!==''){var _0xda797a=/^(([^<>()\[\]\\.,;:\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 _0xda797a[_0xbb0c('0x1b')](String(_0x2f00fc)[_0xbb0c('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 bd72429..4586a93 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 _0x0e66=['customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','POST','format','%s/webservice.php','remoteUri','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','validateEmail','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','GET','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Enduser\x20created.','lastname','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','[QUEUE]','outbound','recordingFormat','none','destcalleridname','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','[OUTBOUND]','monitor_format','toUpperCase','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','length','forEach','includes','string','picklist','type','idField','toString','variableName'];(function(_0xb9400e,_0x35646a){var _0x5d85db=function(_0x72e23){while(--_0x72e23){_0xb9400e['push'](_0xb9400e['shift']());}};_0x5d85db(++_0x35646a);}(_0x0e66,0xb5));var _0x60e6=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x0e66[_0x623e7];return _0x121131;};'use strict';var _=require(_0x60e6('0x0'));var rp=require(_0x60e6('0x1'));var BPromise=require(_0x60e6('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x60e6('0x3'));var intUtil=require(_0x60e6('0x4'));var config=require(_0x60e6('0x5'));var logger=require(_0x60e6('0x6'))(_0x60e6('0x7'));config[_0x60e6('0x8')]=_['defaults'](config[_0x60e6('0x8')],{'host':_0x60e6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x60e6('0x8')]));function emit(_0x2eea52,_0x57ac87,_0x41128f){io['to'](_0x2eea52)['emit'](_0x57ac87,_0x41128f);}function getCustomFields(_0x4a9ed1,_0x4363e4){var _0x10cac7={};if(_0x4a9ed1[_0x60e6('0xa')]>0x0){_[_0x60e6('0xb')](_0x4a9ed1,function(_0x2329bc){if(_[_0x60e6('0xc')]([_0x60e6('0xd'),_0x60e6('0xe')],_0x2329bc[_0x60e6('0xf')])&&_0x2329bc[_0x60e6('0x10')]){_0x10cac7[_0x2329bc[_0x60e6('0x10')]]=_0x2329bc['content'][_0x60e6('0x11')]();}else if(_0x2329bc[_0x60e6('0xf')]==='variable'&&_0x2329bc['variableName']&&_0x2329bc[_0x60e6('0x10')]&&_0x4363e4[_0x2329bc[_0x60e6('0x12')]]){_0x10cac7[_0x2329bc[_0x60e6('0x10')]]=_0x4363e4[_0x2329bc[_0x60e6('0x12')]][_0x60e6('0x11')]();}else if(_0x2329bc[_0x60e6('0xf')]===_0x60e6('0x13')&&_0x2329bc[_0x60e6('0x14')]&&_0x2329bc[_0x60e6('0x14')]['name']&&_0x2329bc['idField']&&_0x4363e4[_0x2329bc[_0x60e6('0x14')][_0x60e6('0x15')][_0x60e6('0x16')]()]){_0x10cac7[_0x2329bc['idField']]=_0x4363e4[_0x2329bc[_0x60e6('0x14')][_0x60e6('0x15')][_0x60e6('0x16')]()][_0x60e6('0x11')]();}});}return _0x10cac7;}function createTicket(_0x2c523f,_0x5dcb95,_0x24a1a5,_0x32dc56,_0x507947,_0x5decbd,_0x5244f3){logger[_0x60e6('0x17')](_0x60e6('0x18'));var _0x5a7e5b=_[_0x60e6('0x19')]({'parent_id':'','assigned_user_id':_0x5dcb95['id'],'ticketpriorities':'Normal','ticketstatus':_0x60e6('0x1a'),'ticket_title':intUtil[_0x60e6('0x1b')](_0x32dc56['Subjects'],_0x507947,'\x20'),'description':intUtil[_0x60e6('0x1b')](_0x32dc56['Descriptions'],_0x507947,'\x0a'),'contact_id':_0x24a1a5['id']},getCustomFields(_0x5decbd,_0x507947));var _0x46376d={'method':_0x60e6('0x1c'),'uri':util[_0x60e6('0x1d')](_0x60e6('0x1e'),_0x2c523f[_0x60e6('0x1f')]),'form':{'operation':'create','username':_0x2c523f[_0x60e6('0x20')],'sessionName':_0x5244f3[_0x60e6('0x21')],'elementType':_0x60e6('0x22'),'element':JSON[_0x60e6('0x23')](_0x5a7e5b)},'json':!![]};return request(_0x46376d)[_0x60e6('0x24')](function(_0x5efca3){if(_0x5efca3[_0x60e6('0x25')]){return BPromise[_0x60e6('0x26')]({'id':_0x5efca3[_0x60e6('0x27')]['id']});}else{throw new Error(util[_0x60e6('0x1d')](_0x60e6('0x28'),JSON[_0x60e6('0x23')](_0x5efca3[_0x60e6('0x29')])));}})[_0x60e6('0x2a')](function(_0x4e48cc){var _0x1bc047=_0x4e48cc[_0x60e6('0x2b')]||0x1f4;logger[_0x60e6('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x1bc047,JSON[_0x60e6('0x23')](_0x4e48cc));});}function getUser(_0x45b113,_0x225d2c,_0x2dac2b){if(intUtil[_0x60e6('0x2c')](_0x225d2c)){logger[_0x60e6('0x17')](_0x60e6('0x2d'),_0x225d2c);return request({'method':'GET','uri':util[_0x60e6('0x1d')](_0x60e6('0x1e'),_0x45b113[_0x60e6('0x1f')]),'qs':{'operation':_0x60e6('0x2e'),'username':_0x45b113[_0x60e6('0x20')],'sessionName':_0x2dac2b['sessionName'],'query':util[_0x60e6('0x1d')](_0x60e6('0x2f'),_0x225d2c)},'json':!![]})[_0x60e6('0x24')](function(_0x2dabfe){if(_0x2dabfe['success']&&_0x2dabfe[_0x60e6('0x27')][_0x60e6('0xa')]){logger[_0x60e6('0x17')]('Agent\x20found!');return BPromise[_0x60e6('0x26')]({'id':_0x2dabfe[_0x60e6('0x27')][0x0]['id'],'email':_0x2dabfe[_0x60e6('0x27')][0x0][_0x60e6('0x30')],'name':_0x2dabfe['result'][0x0][_0x60e6('0x31')]+'\x20'+_0x2dabfe['result'][_0x60e6('0x32')]});}else{logger[_0x60e6('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2dac2b[_0x60e6('0x33')],'email':_0x45b113['username'],'name':_0x60e6('0x34')});}})[_0x60e6('0x2a')](function(_0x1b4c86){var _0x414331=_0x1b4c86[_0x60e6('0x2b')]||0x1f4;logger[_0x60e6('0x29')](_0x60e6('0x35'),_0x60e6('0x36'),_0x414331,JSON['stringify'](_0x1b4c86));});}else{logger[_0x60e6('0x17')](_0x60e6('0x37'));return BPromise['resolve']({'id':_0x2dac2b[_0x60e6('0x33')],'email':_0x45b113['username'],'name':'admin'})[_0x60e6('0x2a')](function(_0x591ac6){var _0x3f584e=_0x591ac6[_0x60e6('0x2b')]||0x1f4;logger[_0x60e6('0x29')](_0x60e6('0x35'),_0x60e6('0x36'),_0x3f584e,JSON['stringify'](_0x591ac6));});}}function getEndUser(_0x10a6cd,_0x54faca,_0x4ae82b,_0x288d37){logger[_0x60e6('0x17')](_0x60e6('0x38'),_0x4ae82b);return request({'method':_0x60e6('0x39'),'uri':util[_0x60e6('0x1d')](_0x60e6('0x1e'),_0x10a6cd[_0x60e6('0x1f')]),'qs':{'operation':'query','username':_0x10a6cd['username'],'sessionName':_0x288d37[_0x60e6('0x21')],'query':util[_0x60e6('0x1d')](_0x60e6('0x3a'),_0x4ae82b,_0x4ae82b,_0x4ae82b,_0x4ae82b,_0x4ae82b)},'json':!![]})[_0x60e6('0x24')](function(_0x5689ab){if(_0x5689ab[_0x60e6('0x25')]&&_0x5689ab[_0x60e6('0x27')][_0x60e6('0xa')]){logger[_0x60e6('0x17')](_0x60e6('0x3b'));return BPromise['resolve']({'id':_0x5689ab[_0x60e6('0x27')][0x0]['id'],'name':_0x5689ab['result'][0x0][_0x60e6('0x3c')]+'\x20'+_0x5689ab[_0x60e6('0x27')][0x0]['lastname'],'phone':_0x4ae82b});}else{logger[_0x60e6('0x17')](_0x60e6('0x3d'));return request({'method':_0x60e6('0x1c'),'uri':util[_0x60e6('0x1d')](_0x60e6('0x1e'),_0x10a6cd[_0x60e6('0x1f')]),'form':{'operation':_0x60e6('0x3e'),'sessionName':_0x288d37[_0x60e6('0x21')],'elementType':'Contacts','element':JSON[_0x60e6('0x23')]({'lastname':_0x54faca,'phone':_0x4ae82b,'assigned_user_id':'\x20'})},'json':!![]})[_0x60e6('0x24')](function(_0x3eb37b){logger[_0x60e6('0x17')](_0x60e6('0x3f'));return BPromise[_0x60e6('0x26')]({'id':_0x3eb37b[_0x60e6('0x27')]['id'],'name':_0x3eb37b['result'][_0x60e6('0x40')],'phone':_0x3eb37b[_0x60e6('0x27')]['phone']});})['catch'](function(_0x284a33){var _0x483c20=_0x284a33[_0x60e6('0x2b')]||0x1f4;logger[_0x60e6('0x29')](_0x60e6('0x35'),_0x60e6('0x41'),_0x483c20,JSON[_0x60e6('0x23')](_0x284a33));});}});}function getConnection(_0x118876){var _0x4c021c=_0x118876[_0x60e6('0x20')];var _0x3318b5=_0x118876[_0x60e6('0x42')];return request({'method':_0x60e6('0x39'),'uri':util[_0x60e6('0x1d')]('%s/webservice.php',_0x118876[_0x60e6('0x1f')]),'qs':{'operation':'getchallenge','username':_0x4c021c},'json':!![]})[_0x60e6('0x24')](function(_0x3aedf1){if(_0x3aedf1[_0x60e6('0x25')]){return request({'method':_0x60e6('0x1c'),'uri':util['format'](_0x60e6('0x1e'),_0x118876[_0x60e6('0x1f')]),'form':{'operation':_0x60e6('0x43'),'username':_0x4c021c,'accessKey':md5(_0x3aedf1[_0x60e6('0x27')][_0x60e6('0x44')]+_0x3318b5)},'json':!![]});}})[_0x60e6('0x24')](function(_0x43afdb){if(_0x43afdb[_0x60e6('0x25')]){return BPromise['resolve'](_0x43afdb[_0x60e6('0x27')]);}else{throw new Error(util[_0x60e6('0x1d')](_0x60e6('0x45'),_0x118876['id']));}})[_0x60e6('0x2a')](function(_0x46067c){var _0x43704a=_0x46067c[_0x60e6('0x2b')]||0x1f4;logger[_0x60e6('0x29')](_0x60e6('0x35'),_0x60e6('0x46'),_0x43704a,JSON[_0x60e6('0x23')](_0x46067c));});}function request(_0xcdcdc3){logger[_0x60e6('0x17')](_0x60e6('0x47'),JSON[_0x60e6('0x23')](_0xcdcdc3));return rp(_0xcdcdc3);}exports[_0x60e6('0x48')]=function(_0x2f9dca,_0x34ddbe,_0x5ac9c8,_0x285970,_0x56e9d7,_0x388c2c){var _0x221ec0,_0x2fe541,_0xc47897,_0x10bd38;_0x388c2c[_0x60e6('0x1f')]=intUtil[_0x60e6('0x49')](_0x388c2c[_0x60e6('0x1f')]);if(_0x56e9d7&&_0x56e9d7['monitor_format']){logger[_0x60e6('0x17')]('[QUEUE]',_0x60e6('0x4a'));_0x34ddbe[_0x60e6('0x4b')]=util[_0x60e6('0x1d')](_0x60e6('0x4c'),_0x388c2c[_0x60e6('0x4d')],_0x34ddbe[_0x60e6('0x4e')],md5(_0x34ddbe['uniqueid']));}else{_0x34ddbe['recordingURL']='';}return getConnection(_0x388c2c)[_0x60e6('0x24')](function(_0x49a1e6){_0x10bd38=_0x49a1e6;return getUser(_0x388c2c,_0x285970[_0x60e6('0x4f')],_0x10bd38);})['then'](function(_0x1b6111){_0x221ec0=_0x1b6111;logger[_0x60e6('0x17')](_0x60e6('0x50'),_0x221ec0['id']);return getEndUser(_0x388c2c,_0x34ddbe[_0x60e6('0x51')],_0x34ddbe[_0x60e6('0x52')],_0x10bd38);})[_0x60e6('0x24')](function(_0xf933c4){_0x2fe541=_0xf933c4;logger[_0x60e6('0x17')]('The\x20Enduser\x20ID\x20is:',_0x2fe541['id']);return createTicket(_0x388c2c,_0x221ec0,_0x2fe541,_0x5ac9c8,_0x34ddbe,_0x5ac9c8['Fields'],_0x10bd38);})['then'](function(_0x27baaf){_0xc47897=_0x27baaf;logger['info'](_0x60e6('0x53'));logger['info'](_0x60e6('0x54'),_0xc47897['id']);var _0x245893=util[_0x60e6('0x1d')](_0x60e6('0x55'),_0x388c2c[_0x60e6('0x1f')],_['split'](_0xc47897['id'],'x')[0x1]);logger[_0x60e6('0x17')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x60e6('0x1d')](_0x60e6('0x56'),_0x285970['name']),'trigger:browser:url',{'uri':_0x245893});})[_0x60e6('0x2a')](function(_0x16b0c9){logger[_0x60e6('0x29')](_0x60e6('0x57'),JSON['stringify'](_0x16b0c9));});};exports[_0x60e6('0x58')]=function(_0x40477f,_0x5168a6,_0x81d68b,_0x3f8618,_0x122cb3,_0x2e0093,_0x275f43){var _0x40ac39,_0x5de1a1,_0x2a32a2,_0xc61aba;_0x2e0093[_0x60e6('0x1f')]=intUtil[_0x60e6('0x49')](_0x2e0093[_0x60e6('0x1f')]);_0x2e0093[_0x60e6('0x4d')]=intUtil[_0x60e6('0x49')](_0x2e0093[_0x60e6('0x4d')]);if(_0x275f43&&_0x275f43[_0x60e6('0x59')]&&_0x275f43[_0x60e6('0x59')]!==_0x60e6('0x5a')){logger[_0x60e6('0x17')]('[OUTBOUND]',_0x60e6('0x4a'));_0x5168a6[_0x60e6('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e0093[_0x60e6('0x4d')],_0x5168a6[_0x60e6('0x4e')],md5(_0x5168a6['uniqueid']));}return getConnection(_0x2e0093)[_0x60e6('0x24')](function(_0x2fa2d4){_0xc61aba=_0x2fa2d4;return getUser(_0x2e0093,_0x3f8618[_0x60e6('0x4f')],_0xc61aba);})[_0x60e6('0x24')](function(_0x1b7548){_0x40ac39=_0x1b7548;logger[_0x60e6('0x17')](_0x60e6('0x50'),_0x40ac39['id']);return getEndUser(_0x2e0093,_0x5168a6[_0x60e6('0x5b')],_0x5168a6['destcalleridnum'],_0xc61aba);})[_0x60e6('0x24')](function(_0x5b74a7){_0x5de1a1=_0x5b74a7;logger[_0x60e6('0x17')]('The\x20Enduser\x20ID\x20is:',_0x5de1a1['id']);return createTicket(_0x2e0093,_0x40ac39,_0x5de1a1,_0x81d68b,_0x5168a6,_0x81d68b['Fields'],_0xc61aba);})[_0x60e6('0x24')](function(_0x24f91c){_0x2a32a2=_0x24f91c;logger[_0x60e6('0x17')](_0x60e6('0x53'));logger[_0x60e6('0x17')](_0x60e6('0x54'),_0x2a32a2['id']);var _0x45cae7=util[_0x60e6('0x1d')](_0x60e6('0x55'),_0x2e0093[_0x60e6('0x1f')],_[_0x60e6('0x5c')](_0x2a32a2['id'],'x')[0x1]);logger[_0x60e6('0x17')]('[OUTBOUND]',_0x60e6('0x5d'));emit(util[_0x60e6('0x1d')]('user:%s',_0x3f8618[_0x60e6('0x15')]),_0x60e6('0x5e'),{'uri':_0x45cae7});})[_0x60e6('0x2a')](function(_0x385b6b){logger['error'](_0x60e6('0x5f'),JSON['stringify'](_0x385b6b));});};exports['unmanaged']=function(_0x5e5b51,_0x31ab3c,_0x3b4c0d,_0x460793,_0x254ae3,_0x31c813){var _0x5a2709,_0x5ced43,_0x2aa3f6,_0x37b94b;_0x31c813['remoteUri']=intUtil[_0x60e6('0x49')](_0x31c813[_0x60e6('0x1f')]);_0x31c813[_0x60e6('0x4d')]=intUtil[_0x60e6('0x49')](_0x31c813[_0x60e6('0x4d')]);if(_0x254ae3&&_0x254ae3[_0x60e6('0x60')]){logger[_0x60e6('0x17')]('['+_0x31ab3c['lastevent'][_0x60e6('0x61')]()+']','Recording\x20is\x20enabled!');_0x31ab3c[_0x60e6('0x4b')]=util[_0x60e6('0x1d')](_0x60e6('0x4c'),_0x31c813[_0x60e6('0x4d')],_0x31ab3c['uniqueid'],md5(_0x31ab3c[_0x60e6('0x4e')]));}else{_0x31ab3c['recordingURL']='';}return getConnection(_0x31c813)[_0x60e6('0x24')](function(_0x303fd1){_0x37b94b=_0x303fd1;return getUser(_0x31c813,'',_0x37b94b);})['then'](function(_0x1dcb9a){_0x5a2709=_0x1dcb9a;logger[_0x60e6('0x17')](_0x60e6('0x50'),_0x5a2709['id']);return getEndUser(_0x31c813,_0x31ab3c[_0x60e6('0x51')],_0x31ab3c['calleridnum'],_0x37b94b);})[_0x60e6('0x24')](function(_0x1220e4){_0x5ced43=_0x1220e4;logger[_0x60e6('0x17')](_0x60e6('0x62'),_0x5ced43['id']);return createTicket(_0x31c813,_0x5a2709,_0x5ced43,_0x3b4c0d,_0x31ab3c,_0x3b4c0d['Fields'],_0x37b94b);})[_0x60e6('0x24')](function(_0x2c0a53){_0x2aa3f6=_0x2c0a53;logger[_0x60e6('0x17')](_0x60e6('0x53'));logger[_0x60e6('0x17')](_0x60e6('0x54'),_0x2aa3f6['id']);})['catch'](function(_0x4992b9){logger[_0x60e6('0x29')]('['+_0x31ab3c[_0x60e6('0x63')]['toUpperCase']()+']',JSON[_0x60e6('0x23')](_0x4992b9));});}; \ No newline at end of file +var _0xc8ee=['ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','idField','content','toString','variableName','type','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','username','sessionName','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','first_name','last_name','userId','error','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','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','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','lodash','request-promise','bluebird','md5','util'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xc8ee,0xcb));var _0xec8e=function(_0x5d0992,_0x1afaf3){_0x5d0992=_0x5d0992-0x0;var _0x2db036=_0xc8ee[_0x5d0992];return _0x2db036;};'use strict';var _=require(_0xec8e('0x0'));var rp=require(_0xec8e('0x1'));var BPromise=require(_0xec8e('0x2'));var md5=require(_0xec8e('0x3'));var util=require(_0xec8e('0x4'));var Redis=require(_0xec8e('0x5'));var intUtil=require('./util');var config=require(_0xec8e('0x6'));var logger=require(_0xec8e('0x7'))(_0xec8e('0x8'));config[_0xec8e('0x9')]=_['defaults'](config[_0xec8e('0x9')],{'host':_0xec8e('0xa'),'port':0x18eb});var io=require(_0xec8e('0xb'))(new Redis(config[_0xec8e('0x9')]));function emit(_0x175f26,_0x22abfb,_0x44c7f9){io['to'](_0x175f26)[_0xec8e('0xc')](_0x22abfb,_0x44c7f9);}function getCustomFields(_0x35373b,_0x175c8a){var _0x4ac0f1={};if(_0x35373b[_0xec8e('0xd')]>0x0){_[_0xec8e('0xe')](_0x35373b,function(_0x37ddf){if(_[_0xec8e('0xf')]([_0xec8e('0x10'),_0xec8e('0x11')],_0x37ddf['type'])&&_0x37ddf[_0xec8e('0x12')]){_0x4ac0f1[_0x37ddf[_0xec8e('0x12')]]=_0x37ddf[_0xec8e('0x13')][_0xec8e('0x14')]();}else if(_0x37ddf['type']==='variable'&&_0x37ddf[_0xec8e('0x15')]&&_0x37ddf['idField']&&_0x175c8a[_0x37ddf[_0xec8e('0x15')]]){_0x4ac0f1[_0x37ddf[_0xec8e('0x12')]]=_0x175c8a[_0x37ddf[_0xec8e('0x15')]][_0xec8e('0x14')]();}else if(_0x37ddf[_0xec8e('0x16')]===_0xec8e('0x17')&&_0x37ddf['Variable']&&_0x37ddf[_0xec8e('0x18')][_0xec8e('0x19')]&&_0x37ddf[_0xec8e('0x12')]&&_0x175c8a[_0x37ddf[_0xec8e('0x18')]['name'][_0xec8e('0x1a')]()]){_0x4ac0f1[_0x37ddf[_0xec8e('0x12')]]=_0x175c8a[_0x37ddf['Variable']['name'][_0xec8e('0x1a')]()][_0xec8e('0x14')]();}});}return _0x4ac0f1;}function createTicket(_0x471d6f,_0x56b90e,_0x28adc1,_0x472cda,_0x4a9463,_0x4cbda0,_0x4b3cd5){logger[_0xec8e('0x1b')](_0xec8e('0x1c'));var _0xbac02=_[_0xec8e('0x1d')]({'parent_id':'','assigned_user_id':_0x56b90e['id'],'ticketpriorities':_0xec8e('0x1e'),'ticketstatus':'Open','ticket_title':intUtil[_0xec8e('0x1f')](_0x472cda[_0xec8e('0x20')],_0x4a9463,'\x20'),'description':intUtil[_0xec8e('0x1f')](_0x472cda[_0xec8e('0x21')],_0x4a9463,'\x0a'),'contact_id':_0x28adc1['id']},getCustomFields(_0x4cbda0,_0x4a9463));var _0x2bdd58={'method':_0xec8e('0x22'),'uri':util[_0xec8e('0x23')](_0xec8e('0x24'),_0x471d6f['remoteUri']),'form':{'operation':_0xec8e('0x25'),'username':_0x471d6f[_0xec8e('0x26')],'sessionName':_0x4b3cd5[_0xec8e('0x27')],'elementType':'HelpDesk','element':JSON[_0xec8e('0x28')](_0xbac02)},'json':!![]};return request(_0x2bdd58)[_0xec8e('0x29')](function(_0x2b2a36){if(_0x2b2a36['success']){return BPromise[_0xec8e('0x2a')]({'id':_0x2b2a36[_0xec8e('0x2b')]['id']});}else{throw new Error(util[_0xec8e('0x23')](_0xec8e('0x2c'),JSON[_0xec8e('0x28')](_0x2b2a36['error'])));}})[_0xec8e('0x2d')](function(_0x257bb1){var _0xf01c47=_0x257bb1[_0xec8e('0x2e')]||0x1f4;logger['error'](_0xec8e('0x2f'),_0xec8e('0x30'),_0xf01c47,JSON[_0xec8e('0x28')](_0x257bb1));});}function getUser(_0x2e6026,_0x428bb8,_0x28909f){if(intUtil['validateEmail'](_0x428bb8)){logger[_0xec8e('0x1b')](_0xec8e('0x31'),_0x428bb8);return request({'method':_0xec8e('0x32'),'uri':util[_0xec8e('0x23')](_0xec8e('0x24'),_0x2e6026[_0xec8e('0x33')]),'qs':{'operation':_0xec8e('0x34'),'username':_0x2e6026[_0xec8e('0x26')],'sessionName':_0x28909f[_0xec8e('0x27')],'query':util[_0xec8e('0x23')](_0xec8e('0x35'),_0x428bb8)},'json':!![]})[_0xec8e('0x29')](function(_0x3aabe4){if(_0x3aabe4[_0xec8e('0x36')]&&_0x3aabe4[_0xec8e('0x2b')][_0xec8e('0xd')]){logger[_0xec8e('0x1b')](_0xec8e('0x37'));return BPromise[_0xec8e('0x2a')]({'id':_0x3aabe4[_0xec8e('0x2b')][0x0]['id'],'email':_0x3aabe4[_0xec8e('0x2b')][0x0]['email1'],'name':_0x3aabe4[_0xec8e('0x2b')][0x0][_0xec8e('0x38')]+'\x20'+_0x3aabe4[_0xec8e('0x2b')][_0xec8e('0x39')]});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xec8e('0x2a')]({'id':_0x28909f[_0xec8e('0x3a')],'email':_0x2e6026[_0xec8e('0x26')],'name':'admin'});}})[_0xec8e('0x2d')](function(_0x1618c3){var _0x5eb67=_0x1618c3[_0xec8e('0x2e')]||0x1f4;logger[_0xec8e('0x3b')](_0xec8e('0x2f'),_0xec8e('0x3c'),_0x5eb67,JSON[_0xec8e('0x28')](_0x1618c3));});}else{logger[_0xec8e('0x1b')](_0xec8e('0x3d'));return BPromise[_0xec8e('0x2a')]({'id':_0x28909f['userId'],'email':_0x2e6026[_0xec8e('0x26')],'name':_0xec8e('0x3e')})['catch'](function(_0x142977){var _0x1e0ed2=_0x142977[_0xec8e('0x2e')]||0x1f4;logger[_0xec8e('0x3b')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x1e0ed2,JSON[_0xec8e('0x28')](_0x142977));});}}function getEndUser(_0x209bee,_0x1fef69,_0x24e286,_0x2da44e){logger[_0xec8e('0x1b')]('Searching\x20end\x20user\x20with\x20phone',_0x24e286);return request({'method':_0xec8e('0x32'),'uri':util[_0xec8e('0x23')]('%s/webservice.php',_0x209bee[_0xec8e('0x33')]),'qs':{'operation':_0xec8e('0x34'),'username':_0x209bee[_0xec8e('0x26')],'sessionName':_0x2da44e[_0xec8e('0x27')],'query':util[_0xec8e('0x23')]('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;',_0x24e286,_0x24e286,_0x24e286,_0x24e286,_0x24e286)},'json':!![]})['then'](function(_0x2cc32a){if(_0x2cc32a[_0xec8e('0x36')]&&_0x2cc32a[_0xec8e('0x2b')][_0xec8e('0xd')]){logger['info'](_0xec8e('0x3f'));return BPromise[_0xec8e('0x2a')]({'id':_0x2cc32a[_0xec8e('0x2b')][0x0]['id'],'name':_0x2cc32a[_0xec8e('0x2b')][0x0][_0xec8e('0x40')]+'\x20'+_0x2cc32a['result'][0x0]['lastname'],'phone':_0x24e286});}else{logger[_0xec8e('0x1b')](_0xec8e('0x41'));return request({'method':_0xec8e('0x22'),'uri':util[_0xec8e('0x23')](_0xec8e('0x24'),_0x209bee[_0xec8e('0x33')]),'form':{'operation':_0xec8e('0x25'),'sessionName':_0x2da44e[_0xec8e('0x27')],'elementType':_0xec8e('0x42'),'element':JSON['stringify']({'lastname':_0x1fef69,'phone':_0x24e286,'assigned_user_id':'\x20'})},'json':!![]})[_0xec8e('0x29')](function(_0x1e9fda){logger[_0xec8e('0x1b')](_0xec8e('0x43'));return BPromise[_0xec8e('0x2a')]({'id':_0x1e9fda[_0xec8e('0x2b')]['id'],'name':_0x1e9fda[_0xec8e('0x2b')][_0xec8e('0x44')],'phone':_0x1e9fda[_0xec8e('0x2b')][_0xec8e('0x45')]});})['catch'](function(_0x5c1d51){var _0x1ba938=_0x5c1d51['statusCode']||0x1f4;logger[_0xec8e('0x3b')](_0xec8e('0x2f'),'getEndUser',_0x1ba938,JSON['stringify'](_0x5c1d51));});}});}function getConnection(_0x20eec1){var _0x5519b3=_0x20eec1[_0xec8e('0x26')];var _0x43ae31=_0x20eec1[_0xec8e('0x46')];return request({'method':_0xec8e('0x32'),'uri':util['format'](_0xec8e('0x24'),_0x20eec1[_0xec8e('0x33')]),'qs':{'operation':_0xec8e('0x47'),'username':_0x5519b3},'json':!![]})[_0xec8e('0x29')](function(_0x290223){if(_0x290223['success']){return request({'method':_0xec8e('0x22'),'uri':util['format'](_0xec8e('0x24'),_0x20eec1[_0xec8e('0x33')]),'form':{'operation':_0xec8e('0x48'),'username':_0x5519b3,'accessKey':md5(_0x290223[_0xec8e('0x2b')][_0xec8e('0x49')]+_0x43ae31)},'json':!![]});}})[_0xec8e('0x29')](function(_0x569c14){if(_0x569c14[_0xec8e('0x36')]){return BPromise[_0xec8e('0x2a')](_0x569c14[_0xec8e('0x2b')]);}else{throw new Error(util['format'](_0xec8e('0x4a'),_0x20eec1['id']));}})[_0xec8e('0x2d')](function(_0xffa3a5){var _0x41d763=_0xffa3a5['statusCode']||0x1f4;logger[_0xec8e('0x3b')](_0xec8e('0x2f'),'getConnection',_0x41d763,JSON[_0xec8e('0x28')](_0xffa3a5));});}function request(_0x5ae4ec){logger[_0xec8e('0x1b')](_0xec8e('0x4b'),JSON['stringify'](_0x5ae4ec));return rp(_0x5ae4ec);}exports['queue']=function(_0x4ec777,_0x8dddce,_0x20bde1,_0x217b31,_0x3f8d95,_0x5e4baf){var _0x14aa38,_0x13f315,_0x258e79,_0x35d9d5;_0x5e4baf[_0xec8e('0x33')]=intUtil[_0xec8e('0x4c')](_0x5e4baf['remoteUri']);if(_0x3f8d95&&_0x3f8d95[_0xec8e('0x4d')]){logger['info'](_0xec8e('0x4e'),'Recording\x20is\x20enabled!');_0x8dddce[_0xec8e('0x4f')]=util[_0xec8e('0x23')](_0xec8e('0x50'),_0x5e4baf[_0xec8e('0x51')],_0x8dddce[_0xec8e('0x52')],md5(_0x8dddce[_0xec8e('0x52')]));}else{_0x8dddce['recordingURL']='';}return getConnection(_0x5e4baf)['then'](function(_0x1e9d2f){_0x35d9d5=_0x1e9d2f;return getUser(_0x5e4baf,_0x217b31[_0xec8e('0x53')],_0x35d9d5);})['then'](function(_0x2075a9){_0x14aa38=_0x2075a9;logger['info'](_0xec8e('0x54'),_0x14aa38['id']);return getEndUser(_0x5e4baf,_0x8dddce[_0xec8e('0x55')],_0x8dddce['calleridnum'],_0x35d9d5);})['then'](function(_0x5cea08){_0x13f315=_0x5cea08;logger['info'](_0xec8e('0x56'),_0x13f315['id']);return createTicket(_0x5e4baf,_0x14aa38,_0x13f315,_0x20bde1,_0x8dddce,_0x20bde1[_0xec8e('0x57')],_0x35d9d5);})[_0xec8e('0x29')](function(_0x17efb3){_0x258e79=_0x17efb3;logger['info'](_0xec8e('0x58'));logger['info'](_0xec8e('0x59'),_0x258e79['id']);var _0x63c83f=util[_0xec8e('0x23')](_0xec8e('0x5a'),_0x5e4baf[_0xec8e('0x33')],_[_0xec8e('0x5b')](_0x258e79['id'],'x')[0x1]);logger[_0xec8e('0x1b')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xec8e('0x5c'),_0x217b31['name']),_0xec8e('0x5d'),{'uri':_0x63c83f});})[_0xec8e('0x2d')](function(_0x468f1a){logger['error'](_0xec8e('0x4e'),JSON[_0xec8e('0x28')](_0x468f1a));});};exports[_0xec8e('0x5e')]=function(_0x3210cf,_0x3742f3,_0x164b7e,_0x25b0ed,_0x5d2cd4,_0x2310d1,_0xd01ec2){var _0x3b7d14,_0x400a39,_0x51f41,_0x4f692c;_0x2310d1[_0xec8e('0x33')]=intUtil[_0xec8e('0x4c')](_0x2310d1[_0xec8e('0x33')]);_0x2310d1[_0xec8e('0x51')]=intUtil[_0xec8e('0x4c')](_0x2310d1['serverUrl']);if(_0xd01ec2&&_0xd01ec2[_0xec8e('0x5f')]&&_0xd01ec2[_0xec8e('0x5f')]!=='none'){logger['info'](_0xec8e('0x60'),'Recording\x20is\x20enabled!');_0x3742f3[_0xec8e('0x4f')]=util[_0xec8e('0x23')](_0xec8e('0x50'),_0x2310d1['serverUrl'],_0x3742f3[_0xec8e('0x52')],md5(_0x3742f3['uniqueid']));}return getConnection(_0x2310d1)[_0xec8e('0x29')](function(_0x2ed57b){_0x4f692c=_0x2ed57b;return getUser(_0x2310d1,_0x25b0ed[_0xec8e('0x53')],_0x4f692c);})['then'](function(_0x40243f){_0x3b7d14=_0x40243f;logger['info'](_0xec8e('0x54'),_0x3b7d14['id']);return getEndUser(_0x2310d1,_0x3742f3[_0xec8e('0x61')],_0x3742f3[_0xec8e('0x62')],_0x4f692c);})['then'](function(_0x1e4391){_0x400a39=_0x1e4391;logger[_0xec8e('0x1b')](_0xec8e('0x56'),_0x400a39['id']);return createTicket(_0x2310d1,_0x3b7d14,_0x400a39,_0x164b7e,_0x3742f3,_0x164b7e[_0xec8e('0x57')],_0x4f692c);})['then'](function(_0x21c2f5){_0x51f41=_0x21c2f5;logger['info']('Ticket\x20created!');logger[_0xec8e('0x1b')](_0xec8e('0x59'),_0x51f41['id']);var _0x19586c=util[_0xec8e('0x23')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x2310d1[_0xec8e('0x33')],_['split'](_0x51f41['id'],'x')[0x1]);logger[_0xec8e('0x1b')](_0xec8e('0x60'),_0xec8e('0x63'));emit(util['format']('user:%s',_0x25b0ed[_0xec8e('0x19')]),_0xec8e('0x5d'),{'uri':_0x19586c});})[_0xec8e('0x2d')](function(_0x4760bf){logger['error']('[OUTBOUND]',JSON[_0xec8e('0x28')](_0x4760bf));});};exports[_0xec8e('0x64')]=function(_0x52fd5f,_0x2abd6f,_0x2e4aca,_0x4b3048,_0x33a327,_0x339b9f){var _0x5b3c04,_0x19c9a1,_0xcbef68,_0x1f19d4;_0x339b9f['remoteUri']=intUtil[_0xec8e('0x4c')](_0x339b9f[_0xec8e('0x33')]);_0x339b9f[_0xec8e('0x51')]=intUtil[_0xec8e('0x4c')](_0x339b9f['serverUrl']);if(_0x33a327&&_0x33a327['monitor_format']){logger[_0xec8e('0x1b')]('['+_0x2abd6f[_0xec8e('0x65')]['toUpperCase']()+']',_0xec8e('0x66'));_0x2abd6f['recordingURL']=util[_0xec8e('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x339b9f[_0xec8e('0x51')],_0x2abd6f['uniqueid'],md5(_0x2abd6f['uniqueid']));}else{_0x2abd6f[_0xec8e('0x4f')]='';}return getConnection(_0x339b9f)[_0xec8e('0x29')](function(_0x55a8fa){_0x1f19d4=_0x55a8fa;return getUser(_0x339b9f,'',_0x1f19d4);})[_0xec8e('0x29')](function(_0x515eaf){_0x5b3c04=_0x515eaf;logger[_0xec8e('0x1b')](_0xec8e('0x54'),_0x5b3c04['id']);return getEndUser(_0x339b9f,_0x2abd6f[_0xec8e('0x55')],_0x2abd6f['calleridnum'],_0x1f19d4);})['then'](function(_0x17c147){_0x19c9a1=_0x17c147;logger[_0xec8e('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x19c9a1['id']);return createTicket(_0x339b9f,_0x5b3c04,_0x19c9a1,_0x2e4aca,_0x2abd6f,_0x2e4aca['Fields'],_0x1f19d4);})[_0xec8e('0x29')](function(_0x332028){_0xcbef68=_0x332028;logger[_0xec8e('0x1b')](_0xec8e('0x58'));logger['info'](_0xec8e('0x59'),_0xcbef68['id']);})[_0xec8e('0x2d')](function(_0xd84cf5){logger[_0xec8e('0x3b')]('['+_0x2abd6f['lastevent'][_0xec8e('0x67')]()+']',JSON[_0xec8e('0x28')](_0xd84cf5));});}; \ 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 9a74f42..f04a1f9 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 _0x3047=['nameField','customField','toLowerCase','content','toString','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','redis','defaults','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist'];(function(_0x1cafae,_0x29efca){var _0x4ea7b4=function(_0x2b08ea){while(--_0x2b08ea){_0x1cafae['push'](_0x1cafae['shift']());}};_0x4ea7b4(++_0x29efca);}(_0x3047,0x111));var _0x7304=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3047[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7304('0x0'));var rp=require(_0x7304('0x1'));var md5=require(_0x7304('0x2'));var util=require(_0x7304('0x3'));var Redis=require(_0x7304('0x4'));var intUtil=require(_0x7304('0x5'));var config=require('../../../../config/environment');var logger=require(_0x7304('0x6'))('zendesk');config[_0x7304('0x7')]=_[_0x7304('0x8')](config[_0x7304('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7304('0x9'))(new Redis(config[_0x7304('0x7')]));function emit(_0x2fac44,_0x6534b5,_0x3e4964){io['to'](_0x2fac44)['emit'](_0x6534b5,_0x3e4964);}var headers={'Content-Type':'application/json','Accept':_0x7304('0xa')};function getTicket(_0x34b935,_0x1fd9df,_0x46cfbf,_0x4748b3,_0x5abb41){logger[_0x7304('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x7304('0xc')](_0x7304('0xd'),_0x34b935[_0x7304('0xe')]),'method':_0x7304('0xf'),'body':{'ticket':_[_0x7304('0x10')]({'requester_id':_0x46cfbf['id'],'submitter_id':_0x1fd9df?_0x1fd9df['id']:undefined,'assignee_id':_0x1fd9df?_0x1fd9df['id']:undefined,'tags':getTags(_0x4748b3[_0x7304('0x11')],'name'),'subject':intUtil[_0x7304('0x12')](_0x4748b3[_0x7304('0x13')],_0x5abb41,'\x20'),'description':intUtil[_0x7304('0x12')](_0x4748b3['Descriptions'],_0x5abb41,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7304('0x12')](_0x4748b3[_0x7304('0x14')],_0x5abb41,'\x0a')}},getCustomFields(_0x4748b3[_0x7304('0x15')],_0x5abb41))}})['then'](function(_0x37daf5){logger['info']('Ticket\x20created!');return _0x37daf5[_0x7304('0x16')];});}function getUser(_0x4e969d,_0x4e6c0e){if(intUtil[_0x7304('0x17')](_0x4e6c0e)){logger[_0x7304('0xb')](_0x7304('0x18'),_0x4e6c0e);return request({'uri':util[_0x7304('0xc')](_0x7304('0x19'),_0x4e969d['remoteUri']),'qs':{'query':util['format'](_0x7304('0x1a'),_0x4e6c0e)}})[_0x7304('0x1b')](function(_0x1e850a){if(_0x1e850a['count']){logger[_0x7304('0xb')](_0x7304('0x1c'));return _[_0x7304('0x1d')](_0x1e850a[_0x7304('0x1e')],{'email':_0x4e6c0e,'role':_0x7304('0x1f')});}else{logger[_0x7304('0xb')](_0x7304('0x20'));return request({'uri':util[_0x7304('0xc')]('%s/users/me.json',_0x4e969d[_0x7304('0xe')])})[_0x7304('0x1b')](function(_0x24b238){logger[_0x7304('0xb')](_0x7304('0x21'));return _0x24b238[_0x7304('0x22')];});}});}else{logger['info'](_0x7304('0x20'));return request({'uri':util[_0x7304('0xc')](_0x7304('0x23'),_0x4e969d['remoteUri'])})[_0x7304('0x1b')](function(_0x50a731){logger[_0x7304('0xb')](_0x7304('0x21'));return _0x50a731[_0x7304('0x22')];});}}function getEndUser(_0x2192d5,_0x2857d9,_0x4329a7){logger[_0x7304('0xb')](_0x7304('0x24'),_0x4329a7);return request({'uri':util['format']('%s/search.json',_0x2192d5[_0x7304('0xe')]),'qs':{'query':util[_0x7304('0xc')](_0x7304('0x25'),_0x4329a7)}})['then'](function(_0x26dd83){var _0x1593ff;if(_0x26dd83[_0x7304('0x1e')][_0x7304('0x26')]){_0x26dd83['results']=_['filter'](_0x26dd83[_0x7304('0x1e')],{'suspended':![],'role':_0x7304('0x27')});if(_0x26dd83[_0x7304('0x1e')][_0x7304('0x26')]){_0x1593ff=_[_0x7304('0x28')](_0x26dd83[_0x7304('0x1e')]);}}if(_0x1593ff){logger[_0x7304('0xb')](_0x7304('0x29'));return _0x1593ff;}else{logger['info'](_0x7304('0x2a'));return request({'uri':util[_0x7304('0xc')]('%s/users.json',_0x2192d5['remoteUri']),'method':_0x7304('0xf'),'body':{'user':{'role':_0x7304('0x27'),'name':util[_0x7304('0xc')](_0x7304('0x2b'),_0x2857d9||_0x4329a7),'phone':_0x4329a7}}})[_0x7304('0x1b')](function(_0x146d14){logger[_0x7304('0xb')](_0x7304('0x2c'));return _0x146d14[_0x7304('0x22')];});}});}function getAuth(_0x47a520){var _0x2918d5;if(_0x47a520[_0x7304('0x2d')]===_0x7304('0x2e')){_0x2918d5=util['format']('%s:%s',_0x47a520[_0x7304('0x2f')],_0x47a520[_0x7304('0x2e')]);}else if(_0x47a520[_0x7304('0x2d')]===_0x7304('0x30')){_0x2918d5=util[_0x7304('0xc')](_0x7304('0x31'),_0x47a520[_0x7304('0x2f')],_0x47a520[_0x7304('0x30')]);}return util[_0x7304('0xc')](_0x7304('0x32'),new Buffer(_0x2918d5)['toString'](_0x7304('0x33')));}function request(_0x18f73f){logger[_0x7304('0x34')](_0x7304('0x35'),JSON[_0x7304('0x36')](_0x18f73f));return rp(_[_0x7304('0x8')](_0x18f73f,{'method':_0x7304('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x55ecb9,_0x87586c){var _0x334046=[];if(_0x55ecb9&&_0x55ecb9['length']>0x0){_0x334046=_['map'](_0x55ecb9,_0x87586c);}return _0x334046;}function getCustomFields(_0x294b0f,_0x574e02){var _0x1d136a=[];var _0x481fcc={'custom_fields':[]};if(_0x294b0f['length']>0x0){_[_0x7304('0x38')](_0x294b0f,function(_0x47da2){if(_[_0x7304('0x39')]([_0x7304('0x3a'),_0x7304('0x3b')],_0x47da2['type'])&&_0x47da2[_0x7304('0x3c')]&&!_0x47da2[_0x7304('0x3d')]){_0x481fcc[_0x47da2[_0x7304('0x3c')][_0x7304('0x3e')]()]=_0x47da2[_0x7304('0x3f')][_0x7304('0x40')]();}else if(_['includes']([_0x7304('0x3a'),_0x7304('0x3b')],_0x47da2[_0x7304('0x41')])&&_0x47da2[_0x7304('0x42')]&&_0x47da2[_0x7304('0x3d')]){_0x481fcc[_0x7304('0x43')][_0x7304('0x44')]({'id':_0x47da2[_0x7304('0x42')],'value':_0x47da2[_0x7304('0x3f')][_0x7304('0x40')]()});}else if(_0x47da2[_0x7304('0x41')]===_0x7304('0x45')&&_0x47da2[_0x7304('0x46')]&&_0x47da2[_0x7304('0x42')]&&_0x47da2[_0x7304('0x3d')]){_0x574e02[_0x47da2[_0x7304('0x46')]]&&_0x481fcc[_0x7304('0x43')][_0x7304('0x44')]({'id':_0x47da2['idField'],'value':_0x574e02[_0x47da2['variableName']]['toString']()});}else if(_0x47da2['type']===_0x7304('0x47')&&_0x47da2[_0x7304('0x48')]&&_0x47da2[_0x7304('0x48')]['name']&&_0x47da2[_0x7304('0x42')]&&_0x47da2[_0x7304('0x3d')]){_0x574e02[_0x47da2[_0x7304('0x48')][_0x7304('0x49')][_0x7304('0x3e')]()]&&_0x481fcc[_0x7304('0x43')][_0x7304('0x44')]({'id':_0x47da2['idField'],'value':_0x574e02[_0x47da2[_0x7304('0x48')][_0x7304('0x49')][_0x7304('0x3e')]()]['toString']()});}});}return _0x481fcc;}exports[_0x7304('0x4a')]=function(_0x24af19,_0x5828c5,_0x39e1c0,_0x293eeb,_0xfaec55,_0x168efe){var _0x2fe162,_0x22543;_0x168efe[_0x7304('0xe')]=intUtil[_0x7304('0x4b')](_0x168efe['remoteUri']);_0x168efe['serverUrl']=intUtil['stripTrailingSlash'](_0x168efe[_0x7304('0x4c')]);if(_0xfaec55&&_0xfaec55[_0x7304('0x4d')]){logger['info']('[QUEUE]',_0x7304('0x4e'));_0x5828c5['recordingURL']=util[_0x7304('0xc')](_0x7304('0x4f'),_0x168efe[_0x7304('0x4c')],_0x5828c5['uniqueid'],md5(_0x5828c5[_0x7304('0x50')]));}else{_0x5828c5[_0x7304('0x51')]='';}headers[_0x7304('0x52')]=getAuth(_0x168efe);return getUser(_0x168efe,_0x293eeb[_0x7304('0x53')])[_0x7304('0x1b')](function(_0x580551){_0x2fe162=_0x580551;logger[_0x7304('0xb')]('The\x20User\x20ID\x20is:',_0x2fe162['id']);return getEndUser(_0x168efe,_0x5828c5[_0x7304('0x54')],_0x5828c5[_0x7304('0x55')]);})[_0x7304('0x1b')](function(_0x3c39e1){_0x22543=_0x3c39e1;logger[_0x7304('0xb')](_0x7304('0x56'),_0x22543['id']);return getTicket(_0x168efe,_0x2fe162,_0x22543,_0x39e1c0,_0x5828c5);})['then'](function(_0x19c586){if(_0x19c586){logger[_0x7304('0xb')](_0x7304('0x57'),_0x19c586['id']);switch(_0x168efe['type']){case'integrationTab':logger['info'](_0x7304('0x58'),_0x7304('0x59'));return request({'uri':util[_0x7304('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x168efe[_0x7304('0xe')],_0x2fe162['id'],_0x19c586['id']),'method':_0x7304('0xf')});case _0x7304('0x5a'):logger[_0x7304('0xb')](_0x7304('0x58'),_0x7304('0x5b'));emit(util[_0x7304('0xc')](_0x7304('0x5c'),_0x293eeb[_0x7304('0x49')]),_0x7304('0x5d'),{'uri':util[_0x7304('0xc')]('%s/agent/tickets/%s',_0x168efe[_0x7304('0xe')]['replace']('/api/v2',''),_0x19c586['id'])});break;default:logger[_0x7304('0x5e')](_0x7304('0x58'),_0x7304('0x5f'));}}})[_0x7304('0x60')](function(_0x4333c6){logger[_0x7304('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7304('0x61')](_0x4333c6,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x29c0da,_0x9e2d66,_0x2ec9db,_0x2f2ffc,_0x4de9dc,_0x2a7e6c,_0x2b927c){var _0x2504f6,_0x3788e0;_0x2a7e6c[_0x7304('0xe')]=intUtil['stripTrailingSlash'](_0x2a7e6c['remoteUri']);_0x2a7e6c[_0x7304('0x4c')]=intUtil['stripTrailingSlash'](_0x2a7e6c[_0x7304('0x4c')]);if(_0x2b927c&&_0x2b927c['recordingFormat']&&_0x2b927c[_0x7304('0x62')]!==_0x7304('0x63')){logger[_0x7304('0xb')](_0x7304('0x64'),_0x7304('0x4e'));_0x9e2d66['recordingURL']=util[_0x7304('0xc')](_0x7304('0x4f'),_0x2a7e6c['serverUrl'],_0x9e2d66['uniqueid'],md5(_0x9e2d66['uniqueid']));}headers['Authorization']=getAuth(_0x2a7e6c);return getUser(_0x2a7e6c,_0x2f2ffc['email'])[_0x7304('0x1b')](function(_0x2bd2d4){_0x2504f6=_0x2bd2d4;logger[_0x7304('0xb')](_0x7304('0x65'),_0x2504f6['id']);return getEndUser(_0x2a7e6c,_0x9e2d66[_0x7304('0x66')],_0x9e2d66[_0x7304('0x67')]);})['then'](function(_0x3022c4){_0x3788e0=_0x3022c4;logger[_0x7304('0xb')](_0x7304('0x56'),_0x3788e0['id']);return getTicket(_0x2a7e6c,_0x2504f6,_0x3788e0,_0x2ec9db,_0x9e2d66);})[_0x7304('0x1b')](function(_0x1f3b9e){if(_0x1f3b9e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1f3b9e['id']);switch(_0x2a7e6c[_0x7304('0x41')]){case _0x7304('0x68'):logger[_0x7304('0xb')](_0x7304('0x64'),_0x7304('0x59'));return request({'uri':util[_0x7304('0xc')](_0x7304('0x69'),_0x2a7e6c[_0x7304('0xe')],_0x2504f6['id'],_0x1f3b9e['id']),'method':'POST'});case _0x7304('0x5a'):logger[_0x7304('0xb')](_0x7304('0x64'),_0x7304('0x5b'));emit(util[_0x7304('0xc')](_0x7304('0x5c'),_0x2f2ffc[_0x7304('0x49')]),_0x7304('0x5d'),{'uri':util['format']('%s/agent/tickets/%s',_0x2a7e6c[_0x7304('0xe')][_0x7304('0x6a')](_0x7304('0x6b'),''),_0x1f3b9e['id'])});break;default:logger[_0x7304('0x5e')](_0x7304('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7304('0x60')](function(_0x42b7d3){logger[_0x7304('0x5e')](_0x7304('0x6c'),util['inspect'](_0x42b7d3,{'showHidden':!![],'depth':null}));});};exports[_0x7304('0x6d')]=function(_0x244f06,_0x3601e1,_0x330268,_0x46a3a9,_0x360f33,_0x4b5196){var _0x160e5b,_0x1e070f;_0x4b5196[_0x7304('0xe')]=intUtil[_0x7304('0x4b')](_0x4b5196['remoteUri']);_0x4b5196[_0x7304('0x4c')]=intUtil[_0x7304('0x4b')](_0x4b5196[_0x7304('0x4c')]);if(_0x360f33&&_0x360f33[_0x7304('0x4d')]){logger[_0x7304('0xb')]('['+_0x3601e1[_0x7304('0x6e')]['toUpperCase']()+']',_0x7304('0x4e'));_0x3601e1[_0x7304('0x51')]=util[_0x7304('0xc')](_0x7304('0x4f'),_0x4b5196['serverUrl'],_0x3601e1[_0x7304('0x50')],md5(_0x3601e1['uniqueid']));}else{_0x3601e1['recordingURL']='';}headers[_0x7304('0x52')]=getAuth(_0x4b5196);return getUser(_0x4b5196)[_0x7304('0x1b')](function(_0x1edf8a){_0x160e5b=_0x1edf8a;logger[_0x7304('0xb')](_0x7304('0x65'),_0x160e5b['id']);return getEndUser(_0x4b5196,_0x3601e1['calleridname'],_0x3601e1['calleridnum']);})[_0x7304('0x1b')](function(_0xf28c){_0x1e070f=_0xf28c;logger[_0x7304('0xb')](_0x7304('0x56'),_0x1e070f['id']);return getTicket(_0x4b5196,_0x160e5b,_0x1e070f,_0x330268,_0x3601e1);})['then'](function(_0x2ef9d0){if(_0x2ef9d0){logger[_0x7304('0xb')](_0x7304('0x57'),_0x2ef9d0['id']);}})['catch'](function(_0x411a43){logger[_0x7304('0x5e')]('['+_0x3601e1['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7304('0x61')](_0x411a43,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x118a=['first','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','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','content','idField','custom_fields','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','POST','Tags','name','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','then','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user'];(function(_0x5c23bd,_0x369568){var _0x58e3a5=function(_0x573730){while(--_0x573730){_0x5c23bd['push'](_0x5c23bd['shift']());}};_0x58e3a5(++_0x369568);}(_0x118a,0xb5));var _0xa118=function(_0x24174c,_0x4b725f){_0x24174c=_0x24174c-0x0;var _0x426f13=_0x118a[_0x24174c];return _0x426f13;};'use strict';var _=require(_0xa118('0x0'));var rp=require(_0xa118('0x1'));var md5=require(_0xa118('0x2'));var util=require(_0xa118('0x3'));var Redis=require(_0xa118('0x4'));var intUtil=require(_0xa118('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xa118('0x6'));config[_0xa118('0x7')]=_[_0xa118('0x8')](config[_0xa118('0x7')],{'host':_0xa118('0x9'),'port':0x18eb});var io=require(_0xa118('0xa'))(new Redis(config[_0xa118('0x7')]));function emit(_0x3aa229,_0x37b29f,_0x275f9b){io['to'](_0x3aa229)[_0xa118('0xb')](_0x37b29f,_0x275f9b);}var headers={'Content-Type':_0xa118('0xc'),'Accept':_0xa118('0xc')};function getTicket(_0x39d630,_0x740ca7,_0x4fb5b4,_0x21cd5e,_0x1632e3){logger['info'](_0xa118('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x39d630['remoteUri']),'method':_0xa118('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x4fb5b4['id'],'submitter_id':_0x740ca7?_0x740ca7['id']:undefined,'assignee_id':_0x740ca7?_0x740ca7['id']:undefined,'tags':getTags(_0x21cd5e[_0xa118('0xf')],_0xa118('0x10')),'subject':intUtil[_0xa118('0x11')](_0x21cd5e['Subjects'],_0x1632e3,'\x20'),'description':intUtil[_0xa118('0x11')](_0x21cd5e['Descriptions'],_0x1632e3,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa118('0x11')](_0x21cd5e[_0xa118('0x12')],_0x1632e3,'\x0a')}},getCustomFields(_0x21cd5e[_0xa118('0x13')],_0x1632e3))}})['then'](function(_0xe7bc4a){logger[_0xa118('0x14')](_0xa118('0x15'));return _0xe7bc4a[_0xa118('0x16')];});}function getUser(_0x20dedb,_0x4da6cd){if(intUtil['validateEmail'](_0x4da6cd)){logger[_0xa118('0x14')](_0xa118('0x17'),_0x4da6cd);return request({'uri':util[_0xa118('0x18')](_0xa118('0x19'),_0x20dedb['remoteUri']),'qs':{'query':util[_0xa118('0x18')](_0xa118('0x1a'),_0x4da6cd)}})[_0xa118('0x1b')](function(_0x2054ae){if(_0x2054ae['count']){logger['info']('Agent\x20found!');return _[_0xa118('0x1c')](_0x2054ae[_0xa118('0x1d')],{'email':_0x4da6cd,'role':_0xa118('0x1e')});}else{logger[_0xa118('0x14')](_0xa118('0x1f'));return request({'uri':util[_0xa118('0x18')](_0xa118('0x20'),_0x20dedb[_0xa118('0x21')])})['then'](function(_0x44212a){logger[_0xa118('0x14')](_0xa118('0x22'));return _0x44212a[_0xa118('0x23')];});}});}else{logger[_0xa118('0x14')](_0xa118('0x1f'));return request({'uri':util[_0xa118('0x18')](_0xa118('0x20'),_0x20dedb[_0xa118('0x21')])})[_0xa118('0x1b')](function(_0x48cebc){logger[_0xa118('0x14')](_0xa118('0x22'));return _0x48cebc[_0xa118('0x23')];});}}function getEndUser(_0x15648c,_0x21e59d,_0x4222ad){logger[_0xa118('0x14')](_0xa118('0x24'),_0x4222ad);return request({'uri':util[_0xa118('0x18')](_0xa118('0x19'),_0x15648c[_0xa118('0x21')]),'qs':{'query':util['format'](_0xa118('0x25'),_0x4222ad)}})[_0xa118('0x1b')](function(_0x3f737c){var _0xb6a722;if(_0x3f737c['results'][_0xa118('0x26')]){_0x3f737c[_0xa118('0x1d')]=_[_0xa118('0x27')](_0x3f737c[_0xa118('0x1d')],{'suspended':![],'role':_0xa118('0x28')});if(_0x3f737c['results']['length']){_0xb6a722=_[_0xa118('0x29')](_0x3f737c[_0xa118('0x1d')]);}}if(_0xb6a722){logger['info']('Enduser\x20found!');return _0xb6a722;}else{logger[_0xa118('0x14')](_0xa118('0x2a'));return request({'uri':util[_0xa118('0x18')](_0xa118('0x2b'),_0x15648c['remoteUri']),'method':_0xa118('0xe'),'body':{'user':{'role':'end-user','name':util['format'](_0xa118('0x2c'),_0x21e59d||_0x4222ad),'phone':_0x4222ad}}})['then'](function(_0x52159c){logger['info'](_0xa118('0x2d'));return _0x52159c[_0xa118('0x23')];});}});}function getAuth(_0x97a419){var _0x310923;if(_0x97a419[_0xa118('0x2e')]===_0xa118('0x2f')){_0x310923=util[_0xa118('0x18')](_0xa118('0x30'),_0x97a419[_0xa118('0x31')],_0x97a419[_0xa118('0x2f')]);}else if(_0x97a419[_0xa118('0x2e')]===_0xa118('0x32')){_0x310923=util['format'](_0xa118('0x33'),_0x97a419[_0xa118('0x31')],_0x97a419[_0xa118('0x32')]);}return util['format'](_0xa118('0x34'),new Buffer(_0x310923)[_0xa118('0x35')](_0xa118('0x36')));}function request(_0x426c10){logger['debug'](_0xa118('0x37'),JSON[_0xa118('0x38')](_0x426c10));return rp(_[_0xa118('0x8')](_0x426c10,{'method':_0xa118('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x40cf8b,_0x26c372){var _0x3a0433=[];if(_0x40cf8b&&_0x40cf8b[_0xa118('0x26')]>0x0){_0x3a0433=_[_0xa118('0x3a')](_0x40cf8b,_0x26c372);}return _0x3a0433;}function getCustomFields(_0x6b5cd0,_0x12d054){var _0x5b391c=[];var _0x1a3ae5={'custom_fields':[]};if(_0x6b5cd0['length']>0x0){_[_0xa118('0x3b')](_0x6b5cd0,function(_0x1e2f39){if(_[_0xa118('0x3c')]([_0xa118('0x3d'),_0xa118('0x3e')],_0x1e2f39[_0xa118('0x3f')])&&_0x1e2f39['nameField']&&!_0x1e2f39[_0xa118('0x40')]){_0x1a3ae5[_0x1e2f39[_0xa118('0x41')]['toLowerCase']()]=_0x1e2f39[_0xa118('0x42')]['toString']();}else if(_[_0xa118('0x3c')]([_0xa118('0x3d'),_0xa118('0x3e')],_0x1e2f39[_0xa118('0x3f')])&&_0x1e2f39[_0xa118('0x43')]&&_0x1e2f39[_0xa118('0x40')]){_0x1a3ae5[_0xa118('0x44')]['push']({'id':_0x1e2f39[_0xa118('0x43')],'value':_0x1e2f39[_0xa118('0x42')][_0xa118('0x35')]()});}else if(_0x1e2f39['type']===_0xa118('0x45')&&_0x1e2f39['variableName']&&_0x1e2f39[_0xa118('0x43')]&&_0x1e2f39['customField']){_0x12d054[_0x1e2f39[_0xa118('0x46')]]&&_0x1a3ae5['custom_fields']['push']({'id':_0x1e2f39[_0xa118('0x43')],'value':_0x12d054[_0x1e2f39[_0xa118('0x46')]][_0xa118('0x35')]()});}else if(_0x1e2f39[_0xa118('0x3f')]===_0xa118('0x47')&&_0x1e2f39['Variable']&&_0x1e2f39[_0xa118('0x48')]['name']&&_0x1e2f39[_0xa118('0x43')]&&_0x1e2f39['customField']){_0x12d054[_0x1e2f39[_0xa118('0x48')][_0xa118('0x10')][_0xa118('0x49')]()]&&_0x1a3ae5[_0xa118('0x44')]['push']({'id':_0x1e2f39[_0xa118('0x43')],'value':_0x12d054[_0x1e2f39[_0xa118('0x48')]['name']['toLowerCase']()][_0xa118('0x35')]()});}});}return _0x1a3ae5;}exports[_0xa118('0x4a')]=function(_0x9614a9,_0x390f92,_0xcbd958,_0x36acdf,_0x4624db,_0x56f728){var _0x433d8f,_0x3f3f7b;_0x56f728['remoteUri']=intUtil[_0xa118('0x4b')](_0x56f728[_0xa118('0x21')]);_0x56f728['serverUrl']=intUtil['stripTrailingSlash'](_0x56f728[_0xa118('0x4c')]);if(_0x4624db&&_0x4624db[_0xa118('0x4d')]){logger[_0xa118('0x14')]('[QUEUE]',_0xa118('0x4e'));_0x390f92[_0xa118('0x4f')]=util[_0xa118('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56f728[_0xa118('0x4c')],_0x390f92['uniqueid'],md5(_0x390f92[_0xa118('0x50')]));}else{_0x390f92[_0xa118('0x4f')]='';}headers['Authorization']=getAuth(_0x56f728);return getUser(_0x56f728,_0x36acdf['email'])[_0xa118('0x1b')](function(_0x4f97b9){_0x433d8f=_0x4f97b9;logger[_0xa118('0x14')]('The\x20User\x20ID\x20is:',_0x433d8f['id']);return getEndUser(_0x56f728,_0x390f92[_0xa118('0x51')],_0x390f92[_0xa118('0x52')]);})[_0xa118('0x1b')](function(_0x41a638){_0x3f3f7b=_0x41a638;logger[_0xa118('0x14')](_0xa118('0x53'),_0x3f3f7b['id']);return getTicket(_0x56f728,_0x433d8f,_0x3f3f7b,_0xcbd958,_0x390f92);})['then'](function(_0x31a363){if(_0x31a363){logger['info']('The\x20Ticket\x20ID\x20is:',_0x31a363['id']);switch(_0x56f728[_0xa118('0x3f')]){case _0xa118('0x54'):logger[_0xa118('0x14')](_0xa118('0x55'),_0xa118('0x56'));return request({'uri':util[_0xa118('0x18')](_0xa118('0x57'),_0x56f728[_0xa118('0x21')],_0x433d8f['id'],_0x31a363['id']),'method':_0xa118('0xe')});case _0xa118('0x58'):logger['info'](_0xa118('0x55'),_0xa118('0x59'));emit(util[_0xa118('0x18')](_0xa118('0x5a'),_0x36acdf[_0xa118('0x10')]),_0xa118('0x5b'),{'uri':util[_0xa118('0x18')](_0xa118('0x5c'),_0x56f728[_0xa118('0x21')][_0xa118('0x5d')](_0xa118('0x5e'),''),_0x31a363['id'])});break;default:logger['error'](_0xa118('0x55'),_0xa118('0x5f'));}}})[_0xa118('0x60')](function(_0x2e96dc){logger[_0xa118('0x61')](_0xa118('0x62'),util[_0xa118('0x63')](_0x2e96dc,{'showHidden':!![],'depth':null}));});};exports[_0xa118('0x64')]=function(_0x2c6c7b,_0x309f86,_0x7e2752,_0x978ee3,_0x5e158c,_0x5a7ccc,_0x32e843){var _0x3944c3,_0x139915;_0x5a7ccc[_0xa118('0x21')]=intUtil[_0xa118('0x4b')](_0x5a7ccc[_0xa118('0x21')]);_0x5a7ccc[_0xa118('0x4c')]=intUtil[_0xa118('0x4b')](_0x5a7ccc[_0xa118('0x4c')]);if(_0x32e843&&_0x32e843[_0xa118('0x65')]&&_0x32e843[_0xa118('0x65')]!==_0xa118('0x66')){logger[_0xa118('0x14')]('[OUTBOUND]',_0xa118('0x4e'));_0x309f86[_0xa118('0x4f')]=util[_0xa118('0x18')](_0xa118('0x67'),_0x5a7ccc[_0xa118('0x4c')],_0x309f86[_0xa118('0x50')],md5(_0x309f86[_0xa118('0x50')]));}headers[_0xa118('0x68')]=getAuth(_0x5a7ccc);return getUser(_0x5a7ccc,_0x978ee3['email'])[_0xa118('0x1b')](function(_0x1f3948){_0x3944c3=_0x1f3948;logger['info'](_0xa118('0x69'),_0x3944c3['id']);return getEndUser(_0x5a7ccc,_0x309f86['destcalleridname'],_0x309f86[_0xa118('0x6a')]);})['then'](function(_0x2a0dae){_0x139915=_0x2a0dae;logger[_0xa118('0x14')]('The\x20Enduser\x20ID\x20is:',_0x139915['id']);return getTicket(_0x5a7ccc,_0x3944c3,_0x139915,_0x7e2752,_0x309f86);})[_0xa118('0x1b')](function(_0x34557f){if(_0x34557f){logger[_0xa118('0x14')]('The\x20Ticket\x20ID\x20is:',_0x34557f['id']);switch(_0x5a7ccc[_0xa118('0x3f')]){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa118('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5a7ccc[_0xa118('0x21')],_0x3944c3['id'],_0x34557f['id']),'method':'POST'});case _0xa118('0x58'):logger[_0xa118('0x14')](_0xa118('0x6b'),_0xa118('0x59'));emit(util[_0xa118('0x18')](_0xa118('0x5a'),_0x978ee3['name']),_0xa118('0x5b'),{'uri':util[_0xa118('0x18')]('%s/agent/tickets/%s',_0x5a7ccc[_0xa118('0x21')][_0xa118('0x5d')]('/api/v2',''),_0x34557f['id'])});break;default:logger[_0xa118('0x61')](_0xa118('0x6b'),_0xa118('0x5f'));}}})[_0xa118('0x60')](function(_0x45d1d7){logger[_0xa118('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa118('0x63')](_0x45d1d7,{'showHidden':!![],'depth':null}));});};exports[_0xa118('0x6c')]=function(_0x3187a5,_0x44557e,_0x55b660,_0x48a661,_0x3f4fc8,_0x2039aa){var _0x2f76ee,_0x114d93;_0x2039aa[_0xa118('0x21')]=intUtil[_0xa118('0x4b')](_0x2039aa['remoteUri']);_0x2039aa['serverUrl']=intUtil[_0xa118('0x4b')](_0x2039aa[_0xa118('0x4c')]);if(_0x3f4fc8&&_0x3f4fc8[_0xa118('0x4d')]){logger[_0xa118('0x14')]('['+_0x44557e[_0xa118('0x6d')][_0xa118('0x6e')]()+']',_0xa118('0x4e'));_0x44557e[_0xa118('0x4f')]=util[_0xa118('0x18')](_0xa118('0x67'),_0x2039aa[_0xa118('0x4c')],_0x44557e['uniqueid'],md5(_0x44557e[_0xa118('0x50')]));}else{_0x44557e['recordingURL']='';}headers['Authorization']=getAuth(_0x2039aa);return getUser(_0x2039aa)[_0xa118('0x1b')](function(_0x25eeaf){_0x2f76ee=_0x25eeaf;logger[_0xa118('0x14')](_0xa118('0x69'),_0x2f76ee['id']);return getEndUser(_0x2039aa,_0x44557e[_0xa118('0x51')],_0x44557e[_0xa118('0x52')]);})[_0xa118('0x1b')](function(_0x3ad8a0){_0x114d93=_0x3ad8a0;logger[_0xa118('0x14')](_0xa118('0x53'),_0x114d93['id']);return getTicket(_0x2039aa,_0x2f76ee,_0x114d93,_0x55b660,_0x44557e);})[_0xa118('0x1b')](function(_0xdef1ef){if(_0xdef1ef){logger['info']('The\x20Ticket\x20ID\x20is:',_0xdef1ef['id']);}})[_0xa118('0x60')](function(_0x34e1a2){logger[_0xa118('0x61')]('['+_0x44557e[_0xa118('0x6d')][_0xa118('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xa118('0x63')](_0x34e1a2,{'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 948e62b..5a127b3 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 _0x2f68=['toUpperCase','request-promise','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','length','forEach','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','refresh_token','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','then','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','complete','connect','Answered','rejected','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','unmanaged','zoho.eu','The\x20Call\x20ID\x20is:'];(function(_0x206adf,_0x2ba1a3){var _0x171caa=function(_0x43abe7){while(--_0x43abe7){_0x206adf['push'](_0x206adf['shift']());}};_0x171caa(++_0x2ba1a3);}(_0x2f68,0x9a));var _0x82f6=function(_0x2bef12,_0x129ea4){_0x2bef12=_0x2bef12-0x0;var _0x5c0914=_0x2f68[_0x2bef12];return _0x5c0914;};'use strict';var _=require('lodash');var rp=require(_0x82f6('0x0'));var md5=require(_0x82f6('0x1'));var util=require(_0x82f6('0x2'));var intUtil=require(_0x82f6('0x3'));var moment=require('moment');var Redis=require(_0x82f6('0x4'));var BPromise=require('bluebird');var config=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))('zoho');config[_0x82f6('0x7')]=_[_0x82f6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x82f6('0x9'))(new Redis(config['redis']));function emit(_0x5daa3c,_0x864400,_0xbd30d5){io['to'](_0x5daa3c)[_0x82f6('0xa')](_0x864400,_0xbd30d5);}function request(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),JSON['stringify'](_0x5ee0e5));return rp(_0x5ee0e5);}function getCustomFields(_0x1cf88e,_0x1eec2f){var _0x3f8320={};if(_0x1cf88e[_0x82f6('0xd')]>0x0){_[_0x82f6('0xe')](_0x1cf88e,function(_0x34bd7c){if(_['includes']([_0x82f6('0xf'),_0x82f6('0x10')],_0x34bd7c['type'])&&_0x34bd7c[_0x82f6('0x11')]){_0x3f8320[_0x34bd7c[_0x82f6('0x11')]]=_0x34bd7c[_0x82f6('0x12')][_0x82f6('0x13')]();}else if(_0x34bd7c[_0x82f6('0x14')]===_0x82f6('0x15')&&_0x34bd7c[_0x82f6('0x16')]&&_0x34bd7c[_0x82f6('0x11')]&&_0x1eec2f[_0x34bd7c[_0x82f6('0x16')]]){_0x3f8320[_0x34bd7c['idField']]=_0x1eec2f[_0x34bd7c[_0x82f6('0x16')]]['toString']();}else if(_0x34bd7c[_0x82f6('0x14')]===_0x82f6('0x17')&&_0x34bd7c[_0x82f6('0x18')]&&_0x34bd7c[_0x82f6('0x18')][_0x82f6('0x19')]&&_0x34bd7c[_0x82f6('0x11')]&&_0x1eec2f[_0x34bd7c[_0x82f6('0x18')][_0x82f6('0x19')][_0x82f6('0x1a')]()]){_0x3f8320[_0x34bd7c[_0x82f6('0x11')]]=_0x1eec2f[_0x34bd7c[_0x82f6('0x18')][_0x82f6('0x19')][_0x82f6('0x1a')]()][_0x82f6('0x13')]();}});}return _0x3f8320;}function getName(_0x3a8269){if(_0x3a8269['indexOf']('\x20')>0x0){var _0x2773e5=_0x3a8269[_0x82f6('0x1b')](/ (.+)/);if(_0x2773e5[0x1]){return _0x2773e5;}}return[_0x3a8269,_0x3a8269];}var accountsTokens={};function getAccessToken(_0x55cbce){return new Promise(function(_0x2b03ad,_0x4b9f0){if(!_[_0x82f6('0x1c')](accountsTokens[_0x55cbce['id']])&&!_[_0x82f6('0x1c')](accountsTokens[_0x55cbce['id']]['access_token'])){if(moment()[_0x82f6('0x1d')](accountsTokens[_0x55cbce['id']]['expires_in'])){_0x2b03ad(accountsTokens[_0x55cbce['id']][_0x82f6('0x1e')]);}}var _0x2a0ce6;switch(_0x55cbce['zone']){case'US':_0x2a0ce6='https://accounts.zoho.com';break;case'AU':_0x2a0ce6=_0x82f6('0x1f');break;case'EU':_0x2a0ce6=_0x82f6('0x20');break;case'IN':_0x2a0ce6='https://accounts.zoho.in';break;case'CN':_0x2a0ce6='https://accounts.zoho.com.cn';break;default:_0x2a0ce6=_0x82f6('0x20');break;}var _0x31face={'method':'POST','uri':_0x2a0ce6+_0x82f6('0x21'),'qs':{'refresh_token':_0x55cbce[_0x82f6('0x22')],'client_id':_0x55cbce['clientId'],'client_secret':_0x55cbce['clientSecret'],'grant_type':_0x82f6('0x23')},'json':!![]};return rp(_0x31face)['then'](function(_0x469b6b){accountsTokens[_0x55cbce['id']]={'access_token':_0x469b6b[_0x82f6('0x1e')],'expires_in':moment()['add'](_0x469b6b[_0x82f6('0x24')],_0x82f6('0x25'))};_0x2b03ad(_0x469b6b[_0x82f6('0x1e')]);})[_0x82f6('0x26')](function(_0x4f9fa4){logger[_0x82f6('0x27')](_0x82f6('0x28'),_0x4f9fa4[_0x82f6('0x29')]);_0x4b9f0(_0x4f9fa4);});});}function getUser(_0x400137,_0x271c28,_0x328707,_0x27e473){logger[_0x82f6('0x2a')](_0x82f6('0x2b'));return request({'method':_0x82f6('0x2c'),'uri':util[_0x82f6('0x2d')](_0x82f6('0x2e'),_0x271c28),'qs':{'type':_0x82f6('0x2f')},'headers':{'Authorization':_0x82f6('0x30')+_0x400137},'json':!![]})['then'](function(_0x3bbf5c){if(_0x3bbf5c[_0x82f6('0x31')]){var _0x418f34=-0x1;if(_['isArrayLikeObject'](_0x3bbf5c[_0x82f6('0x31')])){if(!_[_0x82f6('0x1c')](_0x27e473)){_0x418f34=_[_0x82f6('0x32')](_0x3bbf5c[_0x82f6('0x31')],function(_0x41cd65){return _0x41cd65[_0x82f6('0x33')]===_0x27e473;});}if(_0x418f34>=0x0){logger[_0x82f6('0x2a')](_0x82f6('0x34'));}else{logger[_0x82f6('0x2a')](_0x82f6('0x35'));_0x418f34=_[_0x82f6('0x32')](_0x3bbf5c[_0x82f6('0x31')],function(_0x1e028a){return _0x1e028a[_0x82f6('0x36')]['name']===_0x82f6('0x37');});}return _0x3bbf5c[_0x82f6('0x31')][_0x418f34];}else{if(_0x3bbf5c[_0x82f6('0x38')][_0x82f6('0x36')][_0x82f6('0x19')]===_0x82f6('0x37')){logger[_0x82f6('0x2a')](_0x82f6('0x35'));user=_0x3bbf5c[_0x82f6('0x38')];return user;}else{logger[_0x82f6('0x27')](_0x82f6('0x39'),JSON[_0x82f6('0x3a')](_0x3bbf5c));throw new Error(_0x82f6('0x3b')+JSON[_0x82f6('0x3a')](_0x3bbf5c));}}}else{logger['error'](_0x82f6('0x39'),JSON['stringify'](_0x3bbf5c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x82f6('0x3a')](_0x3bbf5c));}})[_0x82f6('0x26')](function(_0x5e8828){console[_0x82f6('0x27')](_0x5e8828);});}function getZohoUser(_0x3a3ccb,_0xb7146b){return new BPromise(function(_0x56e5f1,_0x23b4aa){request(_0x3a3ccb)['then'](function(_0x2be8cf){var _0x5f48cf=null;if(_0x2be8cf){_0x5f48cf=_0x2be8cf[_0x82f6('0x3c')][0x0];_0x5f48cf['enduserType']=_0xb7146b;}_0x56e5f1(_0x5f48cf);})[_0x82f6('0x26')](function(_0x35e9ba){_0x23b4aa(_0x35e9ba);});});}function createEndUser(_0x5ad42c,_0xfce1dd,_0x368c11,_0x3e7c53,_0x43dcd1,_0x51af8f){var _0x368c11=getName(_0x368c11);return request({'method':_0x82f6('0x3d'),'uri':_0x82f6('0x3e')+_0xfce1dd+_0x82f6('0x3f')+_['startCase'](_0x51af8f[_0x82f6('0x40')])+'s','body':{'data':[{'Last_Name':_0x368c11[0x1],'First_Name':_0x368c11[0x0],'Phone':_0x3e7c53,'Owner':{'name':!_[_0x82f6('0x1c')](_0x43dcd1['role'][_0x82f6('0x19')])?_0x43dcd1[_0x82f6('0x41')][_0x82f6('0x19')]:!_[_0x82f6('0x1c')](_0x43dcd1[_0x82f6('0x42')])?_0x43dcd1['first_name']+'\x20'+_0x43dcd1[_0x82f6('0x43')]:_0x43dcd1['last_name'],'id':_0x43dcd1['id']}}]},'headers':{'Authorization':_0x82f6('0x30')+_0x5ad42c},'json':!![]})[_0x82f6('0x44')](function(_0x32d6b5){if(_0x32d6b5&&_0x32d6b5[_0x82f6('0x3c')][0x0][_0x82f6('0x45')]===_0x82f6('0x46')){var _0x43fefc=_0x32d6b5['data'][0x0][_0x82f6('0x47')];_0x43fefc[_0x82f6('0x48')]=_[_0x82f6('0x49')](_0x51af8f[_0x82f6('0x40')])+'s';return _0x43fefc;}logger['error'](_0x82f6('0x39'),JSON['stringify'](data));throw new Error(_0x82f6('0x4a')+JSON[_0x82f6('0x3a')](data));})[_0x82f6('0x26')](function(_0xba3ec7){console[_0x82f6('0x4b')](_0x82f6('0x4c'),_0xba3ec7);});}function getEndUser(_0x538aef,_0x1fd32f,_0x143536,_0x14a3c4,_0x4c82b4,_0x10ae6e,_0x95c1fa){var _0x278892={'method':_0x82f6('0x2c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x538aef},'json':!![]};switch(_0x95c1fa[_0x82f6('0x4d')]){case _0x82f6('0x4e'):_0x278892['uri']=_0x82f6('0x3e')+_0x1fd32f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4c82b4+'))';return getZohoUser(_0x278892,_0x82f6('0x4f'))['then'](function(_0x227ab8){if(_0x227ab8)return _0x227ab8;_0x278892[_0x82f6('0x50')]=_0x82f6('0x3e')+_0x1fd32f+_0x82f6('0x51')+_0x4c82b4+'))';return getZohoUser(_0x278892,_0x82f6('0x52'))[_0x82f6('0x44')](function(_0x53f7d4){if(_0x53f7d4)return _0x53f7d4;if(_0x95c1fa[_0x82f6('0x40')]!=_0x82f6('0x53')){return createEndUser(_0x538aef,_0x1fd32f,_0x14a3c4,_0x4c82b4,_0x10ae6e,_0x95c1fa);}else{return{};}});});break;case'contact':_0x278892['uri']=_0x82f6('0x3e')+_0x1fd32f+_0x82f6('0x54')+_0x4c82b4+'))';return getZohoUser(_0x278892,_0x82f6('0x4f'))['then'](function(_0x1f7abc){if(_0x1f7abc)return _0x1f7abc;if(_0x95c1fa[_0x82f6('0x40')]!=_0x82f6('0x53')){return createEndUser(_0x538aef,_0x1fd32f,_0x14a3c4,_0x4c82b4,_0x10ae6e,_0x95c1fa);}else{return{};}});break;case _0x82f6('0x55'):_0x278892['uri']='https://www.zohoapis.'+_0x1fd32f+_0x82f6('0x51')+_0x4c82b4+'))';return getZohoUser(_0x278892,_0x82f6('0x52'))[_0x82f6('0x44')](function(_0x5231bb){if(_0x5231bb)return _0x5231bb;if(_0x95c1fa[_0x82f6('0x40')]!=_0x82f6('0x53')){return createEndUser(_0x538aef,_0x1fd32f,_0x14a3c4,_0x4c82b4,_0x10ae6e,_0x95c1fa);}else{return{};}});break;}}function getCall(_0x4bc646,_0x4f0ef7,_0x4fa2ca,_0x2e6b03,_0x4a63a6,_0x259d83,_0x57c023,_0x33c359){logger['info'](_0x82f6('0x56'));var _0x58f89b={};_0x58f89b[_0x82f6('0x57')]={'name':!_[_0x82f6('0x1c')](_0x2e6b03[_0x82f6('0x41')][_0x82f6('0x19')])&&!_[_0x82f6('0x1c')](_0x2e6b03[_0x82f6('0x36')]['name'])&&_0x2e6b03[_0x82f6('0x36')][_0x82f6('0x19')]===_0x82f6('0x58')?_0x2e6b03['role']['name']:!_[_0x82f6('0x1c')](_0x2e6b03[_0x82f6('0x42')])?_0x2e6b03[_0x82f6('0x42')]+'\x20'+_0x2e6b03[_0x82f6('0x43')]:_0x2e6b03['last_name'],'id':_0x2e6b03['id']};_0x58f89b[_0x82f6('0x59')]=intUtil[_0x82f6('0x5a')](_0x259d83[_0x82f6('0x5b')],_0x57c023,'\x20');_0x58f89b['Description']=intUtil['getString'](_0x259d83['Descriptions'],_0x57c023,'\x0a');if(_0x4a63a6[_0x82f6('0x48')]===_0x82f6('0x4f')){_0x58f89b[_0x82f6('0x5c')]={'name':!_[_0x82f6('0x1c')](_0x4a63a6[_0x82f6('0x5d')])?_0x4a63a6[_0x82f6('0x5d')]:!_[_0x82f6('0x1c')](_0x4a63a6[_0x82f6('0x5e')])?_0x4a63a6['First_Name']+'\x20'+_0x4a63a6[_0x82f6('0x5f')]:_0x4a63a6[_0x82f6('0x5f')],'id':_0x4a63a6['id']};}if(_0x4a63a6[_0x82f6('0x48')]===_0x82f6('0x52')){_0x58f89b['What_Id']={'name':!_['isNil'](_0x4a63a6[_0x82f6('0x5d')])?_0x4a63a6[_0x82f6('0x5d')]:!_['isNil'](_0x4a63a6[_0x82f6('0x5e')])?_0x4a63a6[_0x82f6('0x5e')]+'\x20'+_0x4a63a6[_0x82f6('0x5f')]:_0x4a63a6['Last_Name'],'id':_0x4a63a6['id']};_0x58f89b[_0x82f6('0x60')]=_[_0x82f6('0x49')](_0x4a63a6[_0x82f6('0x48')]);}if(_0x57c023[_0x82f6('0x61')]){_0x58f89b[_0x82f6('0x62')]=moment[_0x82f6('0x63')](parseInt(_0x57c023['talktime'])*0x3e8)[_0x82f6('0x2d')](_0x82f6('0x64'));}else if(_0x57c023[_0x82f6('0x65')]&&_0x57c023[_0x82f6('0x66')]){_0x58f89b[_0x82f6('0x62')]=moment['utc'](moment(_0x57c023[_0x82f6('0x66')],_0x82f6('0x67'))[_0x82f6('0x68')](moment(_0x57c023[_0x82f6('0x69')],_0x82f6('0x67'))))[_0x82f6('0x2d')](_0x82f6('0x64'));}switch(_0x57c023[_0x82f6('0x6a')]){case'called':_0x58f89b[_0x82f6('0x6b')]='Called';break;case _0x82f6('0x6c'):case _0x82f6('0x6d'):_0x58f89b['Call_Result']=_0x82f6('0x6e');break;case _0x82f6('0x6f'):_0x58f89b[_0x82f6('0x6b')]='Rejected';break;case'abandoned':_0x58f89b[_0x82f6('0x6b')]=_0x82f6('0x70');break;case'timeout':_0x58f89b['Call_Result']=_0x82f6('0x71');default:}_0x58f89b[_0x82f6('0x72')]=(_0x33c359===_0x82f6('0x73')?moment(_0x57c023[_0x82f6('0x69')])[_0x82f6('0x2d')](_0x82f6('0x67')):moment(_0x57c023[_0x82f6('0x74')])[_0x82f6('0x2d')](_0x82f6('0x67')))||moment()[_0x82f6('0x2d')](_0x82f6('0x67'));_0x58f89b[_0x82f6('0x75')]=_0x33c359||'Inbound';_0x58f89b=_[_0x82f6('0x76')](_0x58f89b,getCustomFields(_0x259d83[_0x82f6('0x77')],_0x57c023));return request({'method':_0x82f6('0x3d'),'uri':_0x82f6('0x3e')+_0x4f0ef7+_0x82f6('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4bc646},'body':{'data':[_0x58f89b]},'json':!![]})[_0x82f6('0x44')](function(_0x46d5af){if(_0x46d5af&&_0x46d5af[_0x82f6('0x3c')][0x0]['code']===_0x82f6('0x46')){logger[_0x82f6('0x2a')](_0x82f6('0x79'));return{'id':_0x46d5af[_0x82f6('0x3c')][0x0][_0x82f6('0x47')]['id']};}})[_0x82f6('0x26')](function(_0x2c6e37){logger['info'](_0x82f6('0x7a'),_0x2c6e37['stack']);console[_0x82f6('0x4b')](_0x82f6('0x7a'),_0x2c6e37);});}exports[_0x82f6('0x7b')]=function(_0x36a7ad,_0x2813b5,_0x341fde,_0x2d8721,_0x316647,_0x30b903){var _0x5ed4b6,_0x1a1a46,_0x2ca07b;_0x30b903[_0x82f6('0x7c')]=intUtil[_0x82f6('0x7d')](_0x30b903[_0x82f6('0x7c')]);_0x30b903[_0x82f6('0x7e')]=intUtil['stripTrailingSlash'](_0x30b903[_0x82f6('0x7e')]);if(_0x316647&&_0x316647[_0x82f6('0x7f')]){logger['info']('[QUEUE]',_0x82f6('0x80'));_0x2813b5[_0x82f6('0x81')]=_0x30b903[_0x82f6('0x7e')]+_0x82f6('0x82')+_0x2813b5[_0x82f6('0x83')]+_0x82f6('0x84')+md5(_0x2813b5['uniqueid']);}else{_0x2813b5[_0x82f6('0x81')]='';}var _0x5a325f=_0x30b903[_0x82f6('0x7c')]==='zoho.eu'?'eu':_0x82f6('0x85');return getAccessToken(_0x30b903)['then'](function(_0xa7bd08){_0x2ca07b=_0xa7bd08;return getUser(_0x2ca07b,_0x5a325f,_0x30b903,_0x2d8721[_0x82f6('0x33')]);})[_0x82f6('0x44')](function(_0x584f76){_0x5ed4b6=_0x584f76;logger[_0x82f6('0x2a')]('The\x20User\x20ID\x20is:',_0x5ed4b6['id']);return getEndUser(_0x2ca07b,_0x5a325f,_0x30b903,_0x2813b5[_0x82f6('0x86')],_0x2813b5[_0x82f6('0x87')],_0x5ed4b6,_0x341fde);})[_0x82f6('0x44')](function(_0x4d1bfd){_0x1a1a46=_0x4d1bfd;return getCall(_0x2ca07b,_0x5a325f,_0x30b903,_0x5ed4b6,_0x1a1a46,_0x341fde,_0x2813b5,_0x82f6('0x88'));})[_0x82f6('0x44')](function(_0x1a076e){if(_0x1a076e){logger['info']('The\x20Call\x20ID\x20is:',_0x1a076e['id']);logger[_0x82f6('0x2a')](_0x82f6('0x89'),_0x82f6('0x8a'));emit(util[_0x82f6('0x2d')](_0x82f6('0x8b'),_0x2d8721[_0x82f6('0x19')]),_0x82f6('0x8c'),{'uri':_0x82f6('0x8d')+_0x30b903['host']+_0x82f6('0x8e')+_0x1a076e['id']});}})[_0x82f6('0x26')](function(_0x5c8045){logger[_0x82f6('0x27')](_0x82f6('0x89'),JSON[_0x82f6('0x3a')](_0x5c8045));});};exports['outbound']=function(_0x30632b,_0x1d3f1b,_0x4ede38,_0x2cc906,_0x50ab5c,_0x18d9f4,_0x1325b8){var _0x3e93b0,_0x320ccc,_0x3ba81b;_0x18d9f4[_0x82f6('0x7c')]=intUtil['stripTrailingSlash'](_0x18d9f4[_0x82f6('0x7c')]);_0x18d9f4[_0x82f6('0x7e')]=intUtil[_0x82f6('0x7d')](_0x18d9f4[_0x82f6('0x7e')]);if(_0x1325b8&&_0x1325b8[_0x82f6('0x8f')]&&_0x1325b8['recordingFormat']!==_0x82f6('0x90')){logger['info'](_0x82f6('0x91'),_0x82f6('0x80'));_0x1d3f1b[_0x82f6('0x81')]=_0x18d9f4[_0x82f6('0x7e')]+_0x82f6('0x82')+_0x1d3f1b[_0x82f6('0x83')]+_0x82f6('0x84')+md5(_0x1d3f1b['uniqueid']);}var _0x3da25b=_0x18d9f4[_0x82f6('0x7c')]==='zoho.eu'?'eu':_0x82f6('0x85');return getAccessToken(_0x18d9f4)[_0x82f6('0x44')](function(_0xadf40b){_0x3ba81b=_0xadf40b;return getUser(_0x3ba81b,_0x3da25b,_0x18d9f4,_0x2cc906['email']);})[_0x82f6('0x44')](function(_0x4a25f1){_0x3e93b0=_0x4a25f1;logger[_0x82f6('0x2a')](_0x82f6('0x92'),_0x3e93b0['id']);return getEndUser(_0x3ba81b,_0x3da25b,_0x18d9f4,_0x1d3f1b['destcalleridname'],_0x1d3f1b[_0x82f6('0x93')],_0x3e93b0,_0x4ede38);})[_0x82f6('0x44')](function(_0x43d544){_0x320ccc=_0x43d544;return getCall(_0x3ba81b,_0x3da25b,_0x18d9f4,_0x3e93b0,_0x320ccc,_0x4ede38,_0x1d3f1b,_0x82f6('0x94'));})['then'](function(_0x353f91){if(_0x353f91){logger['info']('The\x20Call\x20ID\x20is:',_0x353f91['id']);logger[_0x82f6('0x2a')](_0x82f6('0x91'),_0x82f6('0x8a'));emit(util[_0x82f6('0x2d')](_0x82f6('0x8b'),_0x2cc906['name']),'trigger:browser:url',{'uri':_0x82f6('0x8d')+_0x18d9f4['host']+_0x82f6('0x8e')+_0x353f91['id']});}})[_0x82f6('0x26')](function(_0x8d8ee1){logger['error'](_0x82f6('0x91'),JSON[_0x82f6('0x3a')](_0x8d8ee1));});};exports[_0x82f6('0x95')]=function(_0xf39da4,_0x5dada1,_0x120eae,_0xed2397,_0x325e96,_0x3a10bf){var _0x5dcd7b,_0x59961d,_0x469665;_0x3a10bf[_0x82f6('0x7c')]=intUtil[_0x82f6('0x7d')](_0x3a10bf[_0x82f6('0x7c')]);_0x3a10bf[_0x82f6('0x7e')]=intUtil[_0x82f6('0x7d')](_0x3a10bf[_0x82f6('0x7e')]);if(_0x325e96&&_0x325e96[_0x82f6('0x7f')]){logger[_0x82f6('0x2a')]('['+_0x5dada1[_0x82f6('0x6a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5dada1[_0x82f6('0x81')]=_0x3a10bf[_0x82f6('0x7e')]+_0x82f6('0x82')+_0x5dada1[_0x82f6('0x83')]+_0x82f6('0x84')+md5(_0x5dada1['uniqueid']);}else{_0x5dada1[_0x82f6('0x81')]='';}var _0x1059b7=_0x3a10bf[_0x82f6('0x7c')]===_0x82f6('0x96')?'eu':_0x82f6('0x85');return getAccessToken(_0x3a10bf)['then'](function(_0x5dd019){_0x469665=_0x5dd019;return getUser(_0x469665,_0x1059b7,_0x3a10bf);})[_0x82f6('0x44')](function(_0x5079cc){_0x5dcd7b=_0x5079cc;logger[_0x82f6('0x2a')](_0x82f6('0x92'),_0x5dcd7b['id']);return getEndUser(_0x469665,_0x1059b7,_0x3a10bf,_0x5dada1[_0x82f6('0x86')],_0x5dada1[_0x82f6('0x87')],_0x5dcd7b,_0x120eae);})[_0x82f6('0x44')](function(_0x5eed82){_0x59961d=_0x5eed82;return getCall(_0x469665,_0x1059b7,_0x3a10bf,_0x5dcd7b,_0x59961d,_0x120eae,_0x5dada1,_0x82f6('0x88'));})[_0x82f6('0x44')](function(_0x2c3984){if(_0x2c3984){logger['info'](_0x82f6('0x97'),_0x2c3984['id']);}})[_0x82f6('0x26')](function(_0x56cb46){logger[_0x82f6('0x27')]('['+_0x5dada1[_0x82f6('0x6a')][_0x82f6('0x98')]()+']',JSON[_0x82f6('0x3a')](_0x56cb46));});}; \ No newline at end of file +var _0xeffd=['refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','findIndex','users','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Description','getString','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','Call_Result','Called','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','picklist','type','idField','variable','variableName','toString','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x2ae68f,_0x41860c){var _0x305772=function(_0x2d671f){while(--_0x2d671f){_0x2ae68f['push'](_0x2ae68f['shift']());}};_0x305772(++_0x41860c);}(_0xeffd,0x6b));var _0xdeff=function(_0x2a89de,_0x3418e9){_0x2a89de=_0x2a89de-0x0;var _0xbd719b=_0xeffd[_0x2a89de];return _0xbd719b;};'use strict';var _=require(_0xdeff('0x0'));var rp=require('request-promise');var md5=require(_0xdeff('0x1'));var util=require(_0xdeff('0x2'));var intUtil=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var Redis=require(_0xdeff('0x5'));var BPromise=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var logger=require(_0xdeff('0x8'))(_0xdeff('0x9'));config[_0xdeff('0xa')]=_[_0xdeff('0xb')](config[_0xdeff('0xa')],{'host':_0xdeff('0xc'),'port':0x18eb});var io=require(_0xdeff('0xd'))(new Redis(config[_0xdeff('0xa')]));function emit(_0x12e953,_0x24897a,_0x540ae6){io['to'](_0x12e953)[_0xdeff('0xe')](_0x24897a,_0x540ae6);}function request(_0x45a8a6){logger[_0xdeff('0xf')]('[HTTP]',JSON[_0xdeff('0x10')](_0x45a8a6));return rp(_0x45a8a6);}function getCustomFields(_0x4423e9,_0x3c1482){var _0x192195={};if(_0x4423e9[_0xdeff('0x11')]>0x0){_[_0xdeff('0x12')](_0x4423e9,function(_0x2e9783){if(_[_0xdeff('0x13')](['string',_0xdeff('0x14')],_0x2e9783[_0xdeff('0x15')])&&_0x2e9783['idField']){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x2e9783['content']['toString']();}else if(_0x2e9783[_0xdeff('0x15')]===_0xdeff('0x17')&&_0x2e9783[_0xdeff('0x18')]&&_0x2e9783[_0xdeff('0x16')]&&_0x3c1482[_0x2e9783['variableName']]){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x3c1482[_0x2e9783[_0xdeff('0x18')]][_0xdeff('0x19')]();}else if(_0x2e9783[_0xdeff('0x15')]===_0xdeff('0x1a')&&_0x2e9783[_0xdeff('0x1b')]&&_0x2e9783['Variable']['name']&&_0x2e9783[_0xdeff('0x16')]&&_0x3c1482[_0x2e9783['Variable']['name'][_0xdeff('0x1c')]()]){_0x192195[_0x2e9783[_0xdeff('0x16')]]=_0x3c1482[_0x2e9783['Variable'][_0xdeff('0x1d')][_0xdeff('0x1c')]()][_0xdeff('0x19')]();}});}return _0x192195;}function getName(_0x3a677a){if(_0x3a677a[_0xdeff('0x1e')]('\x20')>0x0){var _0x299cc5=_0x3a677a[_0xdeff('0x1f')](/ (.+)/);if(_0x299cc5[0x1]){return _0x299cc5;}}return[_0x3a677a,_0x3a677a];}var accountsTokens={};function getAccessToken(_0x919c93){return new Promise(function(_0x488faa,_0x5591fa){if(!_['isNil'](accountsTokens[_0x919c93['id']])&&!_[_0xdeff('0x20')](accountsTokens[_0x919c93['id']]['access_token'])){if(moment()[_0xdeff('0x21')](accountsTokens[_0x919c93['id']][_0xdeff('0x22')])){_0x488faa(accountsTokens[_0x919c93['id']]['access_token']);}}var _0x18338c;switch(_0x919c93[_0xdeff('0x23')]){case'US':_0x18338c='https://accounts.zoho.com';break;case'AU':_0x18338c='https://accounts.zoho.com.au';break;case'EU':_0x18338c=_0xdeff('0x24');break;case'IN':_0x18338c=_0xdeff('0x25');break;case'CN':_0x18338c=_0xdeff('0x26');break;default:_0x18338c=_0xdeff('0x24');break;}var _0x32add9={'method':'POST','uri':_0x18338c+_0xdeff('0x27'),'qs':{'refresh_token':_0x919c93[_0xdeff('0x28')],'client_id':_0x919c93[_0xdeff('0x29')],'client_secret':_0x919c93[_0xdeff('0x2a')],'grant_type':_0xdeff('0x2b')},'json':!![]};return rp(_0x32add9)[_0xdeff('0x2c')](function(_0x3d0111){accountsTokens[_0x919c93['id']]={'access_token':_0x3d0111['access_token'],'expires_in':moment()[_0xdeff('0x2d')](_0x3d0111[_0xdeff('0x22')],'seconds')};_0x488faa(_0x3d0111['access_token']);})[_0xdeff('0x2e')](function(_0x2ea8e9){logger[_0xdeff('0x2f')](_0xdeff('0x30'),_0x2ea8e9[_0xdeff('0x31')]);_0x5591fa(_0x2ea8e9);});});}function getUser(_0xf9b278,_0xbc75ee,_0x4e0ff2,_0x331ddc){logger[_0xdeff('0x32')](_0xdeff('0x33'));return request({'method':'GET','uri':util['format'](_0xdeff('0x34'),_0xbc75ee),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xdeff('0x35')+_0xf9b278},'json':!![]})[_0xdeff('0x2c')](function(_0x44a8b3){if(_0x44a8b3['users']){var _0x189a51=-0x1;if(_['isArrayLikeObject'](_0x44a8b3['users'])){if(!_[_0xdeff('0x20')](_0x331ddc)){_0x189a51=_[_0xdeff('0x36')](_0x44a8b3[_0xdeff('0x37')],function(_0x240459){return _0x240459['email']===_0x331ddc;});}if(_0x189a51>=0x0){logger[_0xdeff('0x32')](_0xdeff('0x38'));}else{logger[_0xdeff('0x32')](_0xdeff('0x39'));_0x189a51=_[_0xdeff('0x36')](_0x44a8b3[_0xdeff('0x37')],function(_0x321ef0){return _0x321ef0['profile'][_0xdeff('0x1d')]==='Administrator';});}return _0x44a8b3[_0xdeff('0x37')][_0x189a51];}else{if(_0x44a8b3[_0xdeff('0x3a')][_0xdeff('0x3b')][_0xdeff('0x1d')]===_0xdeff('0x3c')){logger[_0xdeff('0x32')]('Using\x20the\x20admin\x20account!');user=_0x44a8b3[_0xdeff('0x3a')];return user;}else{logger[_0xdeff('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xdeff('0x10')](_0x44a8b3));throw new Error(_0xdeff('0x3d')+JSON[_0xdeff('0x10')](_0x44a8b3));}}}else{logger[_0xdeff('0x2f')](_0xdeff('0x3e'),JSON[_0xdeff('0x10')](_0x44a8b3));throw new Error(_0xdeff('0x3d')+JSON[_0xdeff('0x10')](_0x44a8b3));}})['catch'](function(_0x118752){console['error'](_0x118752);});}function getZohoUser(_0x231893,_0x345032){return new BPromise(function(_0x30f442,_0x5f368d){request(_0x231893)[_0xdeff('0x2c')](function(_0x280a86){var _0x31dd4a=null;if(_0x280a86){_0x31dd4a=_0x280a86[_0xdeff('0x3f')][0x0];_0x31dd4a[_0xdeff('0x40')]=_0x345032;}_0x30f442(_0x31dd4a);})['catch'](function(_0x1c87bd){_0x5f368d(_0x1c87bd);});});}function createEndUser(_0x4d9985,_0x393d75,_0x14f1d0,_0x518280,_0x30609b,_0x13e25e){var _0x14f1d0=getName(_0x14f1d0);return request({'method':_0xdeff('0x41'),'uri':_0xdeff('0x42')+_0x393d75+'/crm/v2/'+_[_0xdeff('0x43')](_0x13e25e[_0xdeff('0x44')])+'s','body':{'data':[{'Last_Name':_0x14f1d0[0x1],'First_Name':_0x14f1d0[0x0],'Phone':_0x518280,'Owner':{'name':!_[_0xdeff('0x20')](_0x30609b[_0xdeff('0x45')][_0xdeff('0x1d')])?_0x30609b['role']['name']:!_[_0xdeff('0x20')](_0x30609b[_0xdeff('0x46')])?_0x30609b[_0xdeff('0x46')]+'\x20'+_0x30609b[_0xdeff('0x47')]:_0x30609b[_0xdeff('0x47')],'id':_0x30609b['id']}}]},'headers':{'Authorization':_0xdeff('0x35')+_0x4d9985},'json':!![]})[_0xdeff('0x2c')](function(_0x4f02f5){if(_0x4f02f5&&_0x4f02f5[_0xdeff('0x3f')][0x0][_0xdeff('0x48')]===_0xdeff('0x49')){var _0x54fa5b=_0x4f02f5[_0xdeff('0x3f')][0x0][_0xdeff('0x4a')];_0x54fa5b[_0xdeff('0x40')]=_[_0xdeff('0x43')](_0x13e25e['moduleCreate'])+'s';return _0x54fa5b;}logger[_0xdeff('0x2f')](_0xdeff('0x3e'),JSON[_0xdeff('0x10')](data));throw new Error(_0xdeff('0x4b')+JSON[_0xdeff('0x10')](data));})[_0xdeff('0x2e')](function(_0x3fe2e4){console[_0xdeff('0x4c')]('CREATE\x20ERROR',_0x3fe2e4);});}function getEndUser(_0x251737,_0x259631,_0xc23310,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f){var _0x15642a={'method':_0xdeff('0x4d'),'uri':'','headers':{'Authorization':_0xdeff('0x35')+_0x251737},'json':!![]};switch(_0x25a84f[_0xdeff('0x4e')]){case'contact_lead':_0x15642a[_0xdeff('0x4f')]='https://www.zohoapis.'+_0x259631+_0xdeff('0x50')+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x51'))[_0xdeff('0x2c')](function(_0x46c428){if(_0x46c428)return _0x46c428;_0x15642a[_0xdeff('0x4f')]=_0xdeff('0x42')+_0x259631+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x21c18a+'))';return getZohoUser(_0x15642a,'Leads')[_0xdeff('0x2c')](function(_0xf91a72){if(_0xf91a72)return _0xf91a72;if(_0x25a84f[_0xdeff('0x44')]!='nothing'){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});});break;case'contact':_0x15642a[_0xdeff('0x4f')]=_0xdeff('0x42')+_0x259631+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x51'))[_0xdeff('0x2c')](function(_0xb84cfa){if(_0xb84cfa)return _0xb84cfa;if(_0x25a84f['moduleCreate']!=_0xdeff('0x52')){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});break;case _0xdeff('0x53'):_0x15642a[_0xdeff('0x4f')]='https://www.zohoapis.'+_0x259631+_0xdeff('0x54')+_0x21c18a+'))';return getZohoUser(_0x15642a,_0xdeff('0x55'))[_0xdeff('0x2c')](function(_0x23cec3){if(_0x23cec3)return _0x23cec3;if(_0x25a84f[_0xdeff('0x44')]!=_0xdeff('0x52')){return createEndUser(_0x251737,_0x259631,_0x473d32,_0x21c18a,_0x4d2dd3,_0x25a84f);}else{return{};}});break;}}function getCall(_0x2c7fa4,_0x578185,_0x4517d1,_0x1b90a9,_0x5e0c60,_0xe5a773,_0x1b676b,_0x2967b4){logger[_0xdeff('0x32')](_0xdeff('0x56'));var _0xfb097c={};_0xfb097c[_0xdeff('0x57')]={'name':!_[_0xdeff('0x20')](_0x1b90a9['role'][_0xdeff('0x1d')])&&!_[_0xdeff('0x20')](_0x1b90a9[_0xdeff('0x3b')]['name'])&&_0x1b90a9['profile'][_0xdeff('0x1d')]===_0xdeff('0x58')?_0x1b90a9[_0xdeff('0x45')][_0xdeff('0x1d')]:!_[_0xdeff('0x20')](_0x1b90a9[_0xdeff('0x46')])?_0x1b90a9['first_name']+'\x20'+_0x1b90a9['last_name']:_0x1b90a9[_0xdeff('0x47')],'id':_0x1b90a9['id']};_0xfb097c[_0xdeff('0x59')]=intUtil['getString'](_0xe5a773['Subjects'],_0x1b676b,'\x20');_0xfb097c[_0xdeff('0x5a')]=intUtil[_0xdeff('0x5b')](_0xe5a773['Descriptions'],_0x1b676b,'\x0a');if(_0x5e0c60[_0xdeff('0x40')]===_0xdeff('0x51')){_0xfb097c['Who_Id']={'name':!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5c')])?_0x5e0c60['Full_Name']:!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5d')])?_0x5e0c60['First_Name']+'\x20'+_0x5e0c60[_0xdeff('0x5e')]:_0x5e0c60[_0xdeff('0x5e')],'id':_0x5e0c60['id']};}if(_0x5e0c60[_0xdeff('0x40')]==='Leads'){_0xfb097c['What_Id']={'name':!_[_0xdeff('0x20')](_0x5e0c60['Full_Name'])?_0x5e0c60[_0xdeff('0x5c')]:!_[_0xdeff('0x20')](_0x5e0c60[_0xdeff('0x5d')])?_0x5e0c60[_0xdeff('0x5d')]+'\x20'+_0x5e0c60[_0xdeff('0x5e')]:_0x5e0c60['Last_Name'],'id':_0x5e0c60['id']};_0xfb097c['$se_module']=_[_0xdeff('0x43')](_0x5e0c60[_0xdeff('0x40')]);}if(_0x1b676b[_0xdeff('0x5f')]){_0xfb097c[_0xdeff('0x60')]=moment[_0xdeff('0x61')](parseInt(_0x1b676b[_0xdeff('0x5f')])*0x3e8)['format'](_0xdeff('0x62'));}else if(_0x1b676b['answertime']&&_0x1b676b[_0xdeff('0x63')]){_0xfb097c[_0xdeff('0x60')]=moment[_0xdeff('0x61')](moment(_0x1b676b[_0xdeff('0x63')],_0xdeff('0x64'))[_0xdeff('0x65')](moment(_0x1b676b[_0xdeff('0x66')],_0xdeff('0x64'))))[_0xdeff('0x67')]('mm:ss');}switch(_0x1b676b[_0xdeff('0x68')]){case'called':_0xfb097c[_0xdeff('0x69')]=_0xdeff('0x6a');break;case'complete':case _0xdeff('0x6b'):_0xfb097c['Call_Result']=_0xdeff('0x6c');break;case'rejected':_0xfb097c['Call_Result']=_0xdeff('0x6d');break;case _0xdeff('0x6e'):_0xfb097c['Call_Result']=_0xdeff('0x6f');break;case _0xdeff('0x70'):_0xfb097c[_0xdeff('0x69')]=_0xdeff('0x71');default:}_0xfb097c[_0xdeff('0x72')]=(_0x2967b4===_0xdeff('0x73')?moment(_0x1b676b[_0xdeff('0x66')])[_0xdeff('0x67')](_0xdeff('0x64')):moment(_0x1b676b['agentcalledAt'])[_0xdeff('0x67')](_0xdeff('0x64')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0xfb097c[_0xdeff('0x74')]=_0x2967b4||_0xdeff('0x75');_0xfb097c=_['merge'](_0xfb097c,getCustomFields(_0xe5a773[_0xdeff('0x76')],_0x1b676b));return request({'method':_0xdeff('0x41'),'uri':_0xdeff('0x42')+_0x578185+_0xdeff('0x77'),'headers':{'Authorization':_0xdeff('0x35')+_0x2c7fa4},'body':{'data':[_0xfb097c]},'json':!![]})[_0xdeff('0x2c')](function(_0xa5f4a0){if(_0xa5f4a0&&_0xa5f4a0[_0xdeff('0x3f')][0x0][_0xdeff('0x48')]===_0xdeff('0x49')){logger['info'](_0xdeff('0x78'));return{'id':_0xa5f4a0[_0xdeff('0x3f')][0x0][_0xdeff('0x4a')]['id']};}})[_0xdeff('0x2e')](function(_0x4539c8){logger['info']('err',_0x4539c8['stack']);console[_0xdeff('0x4c')](_0xdeff('0x79'),_0x4539c8);});}exports[_0xdeff('0x7a')]=function(_0x5e85dc,_0x4ea57d,_0x5c718a,_0x19de80,_0x1a6fbe,_0x46e1d5){var _0x3b67e1,_0x118aa0,_0x19ab0f;_0x46e1d5[_0xdeff('0x7b')]=intUtil[_0xdeff('0x7c')](_0x46e1d5['host']);_0x46e1d5[_0xdeff('0x7d')]=intUtil[_0xdeff('0x7c')](_0x46e1d5[_0xdeff('0x7d')]);if(_0x1a6fbe&&_0x1a6fbe[_0xdeff('0x7e')]){logger[_0xdeff('0x32')](_0xdeff('0x7f'),_0xdeff('0x80'));_0x4ea57d[_0xdeff('0x81')]=_0x46e1d5[_0xdeff('0x7d')]+_0xdeff('0x82')+_0x4ea57d[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x4ea57d['uniqueid']);}else{_0x4ea57d[_0xdeff('0x81')]='';}var _0xa46f6c=_0x46e1d5[_0xdeff('0x7b')]==='zoho.eu'?'eu':_0xdeff('0x85');return getAccessToken(_0x46e1d5)[_0xdeff('0x2c')](function(_0x39416){_0x19ab0f=_0x39416;return getUser(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x19de80[_0xdeff('0x86')]);})['then'](function(_0x2811e5){_0x3b67e1=_0x2811e5;logger[_0xdeff('0x32')]('The\x20User\x20ID\x20is:',_0x3b67e1['id']);return getEndUser(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x4ea57d[_0xdeff('0x87')],_0x4ea57d[_0xdeff('0x88')],_0x3b67e1,_0x5c718a);})[_0xdeff('0x2c')](function(_0x1cc1d3){_0x118aa0=_0x1cc1d3;return getCall(_0x19ab0f,_0xa46f6c,_0x46e1d5,_0x3b67e1,_0x118aa0,_0x5c718a,_0x4ea57d,_0xdeff('0x75'));})['then'](function(_0x1ee669){if(_0x1ee669){logger[_0xdeff('0x32')](_0xdeff('0x89'),_0x1ee669['id']);logger[_0xdeff('0x32')](_0xdeff('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdeff('0x67')](_0xdeff('0x8a'),_0x19de80['name']),_0xdeff('0x8b'),{'uri':_0xdeff('0x8c')+_0x46e1d5[_0xdeff('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1ee669['id']});}})[_0xdeff('0x2e')](function(_0xea0d77){logger['error'](_0xdeff('0x7f'),JSON[_0xdeff('0x10')](_0xea0d77));});};exports[_0xdeff('0x73')]=function(_0x18e96c,_0x4cacbd,_0x39e307,_0x3b8f20,_0x14a77f,_0x184cb2,_0x13bc9f){var _0x69e0f9,_0x7b5b7b,_0x3e3fd4;_0x184cb2[_0xdeff('0x7b')]=intUtil['stripTrailingSlash'](_0x184cb2[_0xdeff('0x7b')]);_0x184cb2['serverUrl']=intUtil[_0xdeff('0x7c')](_0x184cb2['serverUrl']);if(_0x13bc9f&&_0x13bc9f['recordingFormat']&&_0x13bc9f[_0xdeff('0x8d')]!==_0xdeff('0x8e')){logger['info'](_0xdeff('0x8f'),_0xdeff('0x80'));_0x4cacbd[_0xdeff('0x81')]=_0x184cb2[_0xdeff('0x7d')]+'/api/voice/recordings/'+_0x4cacbd[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x4cacbd['uniqueid']);}var _0x3dca7f=_0x184cb2[_0xdeff('0x7b')]===_0xdeff('0x90')?'eu':_0xdeff('0x85');return getAccessToken(_0x184cb2)[_0xdeff('0x2c')](function(_0x377733){_0x3e3fd4=_0x377733;return getUser(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x3b8f20[_0xdeff('0x86')]);})[_0xdeff('0x2c')](function(_0x5ada1e){_0x69e0f9=_0x5ada1e;logger['info'](_0xdeff('0x91'),_0x69e0f9['id']);return getEndUser(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x4cacbd['destcalleridname'],_0x4cacbd[_0xdeff('0x92')],_0x69e0f9,_0x39e307);})[_0xdeff('0x2c')](function(_0x5e9c02){_0x7b5b7b=_0x5e9c02;return getCall(_0x3e3fd4,_0x3dca7f,_0x184cb2,_0x69e0f9,_0x7b5b7b,_0x39e307,_0x4cacbd,_0xdeff('0x93'));})[_0xdeff('0x2c')](function(_0x232d7e){if(_0x232d7e){logger['info'](_0xdeff('0x89'),_0x232d7e['id']);logger[_0xdeff('0x32')](_0xdeff('0x8f'),_0xdeff('0x94'));emit(util['format'](_0xdeff('0x8a'),_0x3b8f20['name']),_0xdeff('0x8b'),{'uri':'https://crm.'+_0x184cb2[_0xdeff('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x232d7e['id']});}})[_0xdeff('0x2e')](function(_0x27c2ce){logger[_0xdeff('0x2f')]('[OUTBOUND]',JSON[_0xdeff('0x10')](_0x27c2ce));});};exports[_0xdeff('0x95')]=function(_0x202682,_0x5491e2,_0x4be90d,_0x4d301d,_0x292681,_0x385903){var _0x94ad85,_0x676ac1,_0x17e961;_0x385903[_0xdeff('0x7b')]=intUtil['stripTrailingSlash'](_0x385903[_0xdeff('0x7b')]);_0x385903[_0xdeff('0x7d')]=intUtil[_0xdeff('0x7c')](_0x385903['serverUrl']);if(_0x292681&&_0x292681['monitor_format']){logger[_0xdeff('0x32')]('['+_0x5491e2[_0xdeff('0x68')]['toUpperCase']()+']',_0xdeff('0x80'));_0x5491e2[_0xdeff('0x81')]=_0x385903[_0xdeff('0x7d')]+_0xdeff('0x82')+_0x5491e2[_0xdeff('0x83')]+_0xdeff('0x84')+md5(_0x5491e2['uniqueid']);}else{_0x5491e2[_0xdeff('0x81')]='';}var _0x186139=_0x385903[_0xdeff('0x7b')]==='zoho.eu'?'eu':_0xdeff('0x85');return getAccessToken(_0x385903)['then'](function(_0x2a555f){_0x17e961=_0x2a555f;return getUser(_0x17e961,_0x186139,_0x385903);})[_0xdeff('0x2c')](function(_0x51caa7){_0x94ad85=_0x51caa7;logger[_0xdeff('0x32')](_0xdeff('0x91'),_0x94ad85['id']);return getEndUser(_0x17e961,_0x186139,_0x385903,_0x5491e2[_0xdeff('0x87')],_0x5491e2['calleridnum'],_0x94ad85,_0x4be90d);})[_0xdeff('0x2c')](function(_0x1046a6){_0x676ac1=_0x1046a6;return getCall(_0x17e961,_0x186139,_0x385903,_0x94ad85,_0x676ac1,_0x4be90d,_0x5491e2,'Inbound');})[_0xdeff('0x2c')](function(_0x14d2db){if(_0x14d2db){logger[_0xdeff('0x32')](_0xdeff('0x89'),_0x14d2db['id']);}})[_0xdeff('0x2e')](function(_0x265e1b){logger[_0xdeff('0x2f')]('['+_0x5491e2['lastevent']['toUpperCase']()+']',JSON[_0xdeff('0x10')](_0x265e1b));});}; \ 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 9461485..671a237 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(_0x264046,_0x5cbd1c){var _0x5c807d=function(_0x2b25ec){while(--_0x2b25ec){_0x264046['push'](_0x264046['shift']());}};_0x5c807d(++_0x5cbd1c);}(_0x7a54,0x106));var _0x47a5=function(_0x2488ea,_0x30a34f){_0x2488ea=_0x2488ea-0x0;var _0xa982ac=_0x7a54[_0x2488ea];return _0xa982ac;};'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(_0x3fa54d,_0x588e46){var _0x4524e6=function(_0x524916){while(--_0x524916){_0x3fa54d['push'](_0x3fa54d['shift']());}};_0x4524e6(++_0x588e46);}(_0x7a54,0x106));var _0x47a5=function(_0x2767d6,_0x4b8879){_0x2767d6=_0x2767d6-0x0;var _0x55e9ae=_0x7a54[_0x2767d6];return _0x55e9ae;};'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 707f9dc..e8d9706 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(_0x3e4fe9,_0x2074c1){var _0x3929ee=function(_0x84246e){while(--_0x84246e){_0x3e4fe9['push'](_0x3e4fe9['shift']());}};_0x3929ee(++_0x2074c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5df674,_0x271bcb){_0x5df674=_0x5df674-0x0;var _0x36c664=_0x5f2f[_0x5df674];return _0x36c664;};'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(_0xbda1c2,_0x11d390){var _0x2bd889=function(_0x5823d8){while(--_0x5823d8){_0xbda1c2['push'](_0xbda1c2['shift']());}};_0x2bd889(++_0x11d390);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c343b,_0x645b01){_0x3c343b=_0x3c343b-0x0;var _0xb5cc00=_0x5f2f[_0x3c343b];return _0xb5cc00;};'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 8b9767a..72cc1b6 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 _0x616c=['then','debug','rpc','error','catch','routing','bluebird','../../config/logger','client','http','Request','request'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x616c,0x1b6));var _0xc616=function(_0x3c29e7,_0x79a6ae){_0x3c29e7=_0x3c29e7-0x0;var _0x15710a=_0x616c[_0x3c29e7];return _0x15710a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc616('0x0'));var logger=require(_0xc616('0x1'))('routing');var client=jayson[_0xc616('0x2')][_0xc616('0x3')]({'port':0x2329});client[_0xc616('0x4')]=function(_0x3e3bc4,_0x52b492){return new BPromise(function(_0x5f2d88,_0x2a34db){return client[_0xc616('0x5')](_0x3e3bc4,_0x52b492)[_0xc616('0x6')](function(_0x15f809){logger[_0xc616('0x7')](_0xc616('0x8'),'routing',_0x3e3bc4,_0x52b492,_0x15f809);if(_0x15f809['error']){logger[_0xc616('0x9')](_0xc616('0x8'),'routing',_0x3e3bc4,_0x15f809[_0xc616('0x9')]['message'],_0x52b492);return _0x2a34db(_0x15f809[_0xc616('0x9')]['message']);}else{return _0x5f2d88(_0x15f809['result']);}})[_0xc616('0xa')](function(_0x919b7a){logger[_0xc616('0x9')]('rpc',_0xc616('0xb'),_0x3e3bc4,_0x919b7a,_0x52b492);return _0x2a34db(_0x919b7a);});});};module['exports']=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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4250,0x146));var _0x0425=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4250[_0x5c3c0b];return _0x52ecd2;};'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 7de2078..97d2a45 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 _0x6363=['refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x4a59b5,_0x5cad7f){var _0x5c8383=function(_0x3fa901){while(--_0x3fa901){_0x4a59b5['push'](_0x4a59b5['shift']());}};_0x5c8383(++_0x5cad7f);}(_0x6363,0x13a));var _0x3636=function(_0x379a4c,_0xd40af0){_0x379a4c=_0x379a4c-0x0;var _0x43bc69=_0x6363[_0x379a4c];return _0x43bc69;};'use strict';var BPromise=require(_0x3636('0x0'));var server=require('./server');var Realtime=require(_0x3636('0x1'));var EmailChannel=require(_0x3636('0x2'));var mailAccount=require(_0x3636('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x3636('0x4'))['db'];function initRealtime(){return BPromise[_0x3636('0x5')]()[_0x3636('0x6')](mailAccount[_0x3636('0x7')]())[_0x3636('0x6')](realtime[_0x3636('0x8')]())[_0x3636('0x6')](function(){email[_0x3636('0x9')](realtime[_0x3636('0xa')]);return realtime;});}function main(){return server[_0x3636('0xb')](realtime,email)[_0x3636('0x6')](function(_0x583dec){return initRealtime();})[_0x3636('0x6')](function(_0x47f84e){return db[_0x3636('0xc')][_0x3636('0xd')]({'attributes':['id',_0x3636('0xe')],'raw':!![]});})[_0x3636('0x6')](function(_0x1a6c8d){return setInterval(initRealtime,_0x1a6c8d[_0x3636('0xe')]*0x3e8);})[_0x3636('0xf')](function(_0x2d9755){console[_0x3636('0x10')](_0x2d9755);});}main(); \ No newline at end of file +var _0xf966=['Setting','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x40a421,_0x4339c3){var _0x237ea5=function(_0x4e36b9){while(--_0x4e36b9){_0x40a421['push'](_0x40a421['shift']());}};_0x237ea5(++_0x4339c3);}(_0xf966,0x184));var _0x6f96=function(_0x15d717,_0x4f5b86){_0x15d717=_0x15d717-0x0;var _0x11a4d8=_0xf966[_0x15d717];return _0x11a4d8;};'use strict';var BPromise=require(_0x6f96('0x0'));var server=require(_0x6f96('0x1'));var Realtime=require(_0x6f96('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x6f96('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6f96('0x4'))['db'];function initRealtime(){return BPromise[_0x6f96('0x5')]()['then'](mailAccount[_0x6f96('0x6')]())[_0x6f96('0x7')](realtime[_0x6f96('0x8')]())['then'](function(){email[_0x6f96('0x9')](realtime[_0x6f96('0xa')]);return realtime;});}function main(){return server[_0x6f96('0xb')](realtime,email)[_0x6f96('0x7')](function(_0x2e62e6){return initRealtime();})[_0x6f96('0x7')](function(_0x3918eb){return db[_0x6f96('0xc')][_0x6f96('0xd')]({'attributes':['id',_0x6f96('0xe')],'raw':!![]});})[_0x6f96('0x7')](function(_0x23c22e){return setInterval(initRealtime,_0x23c22e[_0x6f96('0xe')]*0x3e8);})[_0x6f96('0xf')](function(_0x28a317){console['log'](_0x28a317);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1242f5c..9d31a03 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 _0xf976=['ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','status','connected','messages','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','verified','exports','lodash','moment','md5'];(function(_0x10a301,_0x2f55ab){var _0x5689a5=function(_0x548e11){while(--_0x548e11){_0x10a301['push'](_0x10a301['shift']());}};_0x5689a5(++_0x2f55ab);}(_0xf976,0x1c5));var _0x6f97=function(_0x312450,_0x23c012){_0x312450=_0x312450-0x0;var _0x5f2f32=_0xf976[_0x312450];return _0x5f2f32;};'use strict';var _=require(_0x6f97('0x0'));var moment=require(_0x6f97('0x1'));var BPromise=require('bluebird');var md5=require(_0x6f97('0x2'));var Redis=require(_0x6f97('0x3'));var config=require(_0x6f97('0x4'));var logger=require(_0x6f97('0x5'))(_0x6f97('0x6'));config[_0x6f97('0x7')]=_[_0x6f97('0x8')](config['redis'],{'host':_0x6f97('0x9'),'port':0x18eb});var io=require(_0x6f97('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x6f97('0xb'));var EmailSmtp=require(_0x6f97('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3c1b47){logger[_0x6f97('0xd')](_0x6f97('0xe'));this[_0x6f97('0xf')]=_0x3c1b47['mailAccounts'];this['imapAccounts']={};this[_0x6f97('0x10')]=new EmailSmtp();}EmailChannel[_0x6f97('0x11')][_0x6f97('0x12')]=function(_0x1fbe44){var _0x12dc14=this[_0x6f97('0xf')][_0x1fbe44];var _0x4ad94f={'id':_0x12dc14['id'],'name':_0x12dc14[_0x6f97('0x13')],'key':_0x12dc14[_0x6f97('0x14')],'active':_0x12dc14[_0x6f97('0x15')],'Imap':{'status':_0x12dc14[_0x6f97('0x16')]['status'],'messageStatus':_0x12dc14['Imap'][_0x6f97('0x17')],'total':_0x12dc14[_0x6f97('0x16')][_0x6f97('0x18')]}};if(_[_0x6f97('0x19')](md5Accounts[_0x1fbe44])){md5Accounts[_0x1fbe44]={};}var _0x3ebcb3=md5(JSON[_0x6f97('0x1a')](_0x4ad94f));if(md5Accounts[_0x1fbe44]['md5']!==_0x3ebcb3){md5Accounts[_0x1fbe44][_0x6f97('0x2')]=_0x3ebcb3;io[_0x6f97('0x12')](_0x6f97('0x1b'),_0x4ad94f);}};EmailChannel['prototype'][_0x6f97('0x1c')]=function(_0x4f29e9){for(var _0x5885ec in _0x4f29e9){if(_0x4f29e9[_0x6f97('0x1d')](_0x5885ec)){if(_0x4f29e9[_0x5885ec][_0x6f97('0x16')]&&_0x4f29e9[_0x5885ec][_0x6f97('0x15')]){var _0x4be8ea=_0x4f29e9[_0x5885ec]['Imap'];if(!this[_0x6f97('0x1e')][_0x6f97('0x1d')](_0x4be8ea['id'])){this['imapAccounts'][_0x4be8ea['id']]=new EmailImap(_0x4be8ea,_0x4f29e9[_0x5885ec][_0x6f97('0x6')]);this[_0x6f97('0x1e')][_0x4be8ea['id']]['on'](_0x6f97('0x1f'),this[_0x6f97('0x20')][_0x6f97('0x21')](this,_0x5885ec));this[_0x6f97('0x1e')][_0x4be8ea['id']]['on'](_0x6f97('0x6'),this[_0x6f97('0x22')]['bind'](this,_0x5885ec));this[_0x6f97('0x1e')][_0x4be8ea['id']]['on'](_0x6f97('0x23'),this[_0x6f97('0x24')]['bind'](this,_0x5885ec));this[_0x6f97('0x1e')][_0x4be8ea['id']]['on'](_0x6f97('0x25'),this[_0x6f97('0x26')][_0x6f97('0x21')](this,_0x5885ec));}}else{if(_[_0x6f97('0x19')](this[_0x6f97('0xf')][_0x5885ec]['Imap'])){this['mailAccounts'][_0x5885ec][_0x6f97('0x16')]={};}this[_0x6f97('0xf')][_0x5885ec][_0x6f97('0x16')]['status']=_0x6f97('0x27');this[_0x6f97('0xf')][_0x5885ec][_0x6f97('0x16')][_0x6f97('0x17')]='';this[_0x6f97('0x12')](_0x5885ec);}}}};EmailChannel[_0x6f97('0x11')][_0x6f97('0x20')]=function(_0x23269f,_0x3f9acb){if(this[_0x6f97('0xf')][_0x23269f]){this[_0x6f97('0xf')][_0x23269f][_0x6f97('0x16')][_0x6f97('0x28')]=_0x6f97('0x29');this[_0x6f97('0xf')][_0x23269f][_0x6f97('0x16')][_0x6f97('0x17')]=_0x3f9acb['name'];if(_0x3f9acb['messages']){this['mailAccounts'][_0x23269f][_0x6f97('0x16')]['total']=_0x3f9acb[_0x6f97('0x2a')]['total'];}return this[_0x6f97('0x12')](_0x23269f);}};EmailChannel[_0x6f97('0x11')][_0x6f97('0x22')]=function(_0x24a316,_0x5ca05c){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5ca05c[_0x6f97('0x2b')],_0x5ca05c[_0x6f97('0x2c')],_0x5ca05c[_0x6f97('0x2d')],_0x24a316);if(this[_0x6f97('0xf')][_0x24a316]){return mailAccount['notify'](_0x24a316,_0x5ca05c)['then'](function(_0x1ed12f){if(_0x1ed12f){logger[_0x6f97('0xd')](_0x6f97('0x2e'));}})['catch'](function(_0x401b9e){logger[_0x6f97('0x25')](_0x6f97('0x2f'),JSON['stringify'](_0x401b9e));});}};EmailChannel['prototype'][_0x6f97('0x24')]=function(_0x2b3da8){if(this[_0x6f97('0xf')][_0x2b3da8]&&this['mailAccounts'][_0x2b3da8]['Imap']){if(this[_0x6f97('0x1e')][this[_0x6f97('0xf')][_0x2b3da8][_0x6f97('0x16')]['id']]){delete this[_0x6f97('0x1e')][this[_0x6f97('0xf')][_0x2b3da8]['Imap']['id']];}this[_0x6f97('0xf')][_0x2b3da8][_0x6f97('0x16')]['lastSync']=moment();this[_0x6f97('0x12')](_0x2b3da8);}};EmailChannel[_0x6f97('0x11')]['handleImapError']=function(_0x32a825,_0x2a235a){if(this[_0x6f97('0xf')][_0x32a825]){this['mailAccounts'][_0x32a825][_0x6f97('0x16')][_0x6f97('0x28')]=_0x6f97('0x25');this['mailAccounts'][_0x32a825][_0x6f97('0x16')][_0x6f97('0x17')]=_0x2a235a;return this['emit'](_0x32a825);}};EmailChannel['prototype'][_0x6f97('0x30')]=function(_0x5af09b,_0x1150fa){return this[_0x6f97('0x10')][_0x6f97('0x31')](_0x5af09b,_0x1150fa);};EmailChannel['prototype'][_0x6f97('0x32')]=function(_0x48bae9){var _0x1c306e=this;if(this[_0x6f97('0xf')][_0x48bae9['id']]){if(_[_0x6f97('0x19')](this['mailAccounts'][_0x48bae9['id']][_0x6f97('0x33')])){this[_0x6f97('0xf')][_0x48bae9['id']][_0x6f97('0x33')]={};}this['mailAccounts'][_0x48bae9['id']][_0x6f97('0x33')][_0x6f97('0x34')]=moment();return new BPromise(function(_0x47e758,_0x28009e){return _0x1c306e['smtp'][_0x6f97('0x35')](_0x48bae9)[_0x6f97('0x36')](function(_0x419d5a){_0x1c306e[_0x6f97('0xf')][_0x48bae9['id']][_0x6f97('0x33')][_0x6f97('0x28')]=_0x6f97('0x37');_0x1c306e['mailAccounts'][_0x48bae9['id']][_0x6f97('0x33')][_0x6f97('0x17')]='';_0x1c306e[_0x6f97('0x12')](_0x48bae9['id']);_0x47e758(_0x419d5a);})['catch'](function(_0x13fb90){_0x1c306e[_0x6f97('0xf')][_0x48bae9['id']][_0x6f97('0x33')][_0x6f97('0x28')]=_0x6f97('0x25');_0x1c306e[_0x6f97('0xf')][_0x48bae9['id']]['Smtp'][_0x6f97('0x17')]=_0x13fb90;_0x1c306e[_0x6f97('0x12')](_0x48bae9['id']);_0x28009e(_0x13fb90);});});}return this[_0x6f97('0x10')][_0x6f97('0x35')](_0x48bae9);};module[_0x6f97('0x38')]=EmailChannel; \ No newline at end of file +var _0x420e=['defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','Imap','messageStatus','total','isNil','stringify','emit','mailAccount:update','prototype','refresh','hasOwnProperty','bind','end','handleImapEnd','error','handleImapError','status','handleImapBox','connected','messages','handleImapEmail','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x420e,0x1b0));var _0xe420=function(_0x2ee9dc,_0x167171){_0x2ee9dc=_0x2ee9dc-0x0;var _0x17723e=_0x420e[_0x2ee9dc];return _0x17723e;};'use strict';var _=require(_0xe420('0x0'));var moment=require(_0xe420('0x1'));var BPromise=require(_0xe420('0x2'));var md5=require(_0xe420('0x3'));var Redis=require(_0xe420('0x4'));var config=require('../../../config/environment');var logger=require(_0xe420('0x5'))(_0xe420('0x6'));config[_0xe420('0x7')]=_[_0xe420('0x8')](config[_0xe420('0x7')],{'host':_0xe420('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe420('0x7')]));var EmailImap=require(_0xe420('0xa'));var EmailSmtp=require(_0xe420('0xb'));var mailAccount=require(_0xe420('0xc'));var md5Accounts={};function EmailChannel(_0x2db013){logger[_0xe420('0xd')](_0xe420('0xe'));this[_0xe420('0xf')]=_0x2db013[_0xe420('0xf')];this[_0xe420('0x10')]={};this[_0xe420('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x2ac421){var _0x35f818=this[_0xe420('0xf')][_0x2ac421];var _0x2befc8={'id':_0x35f818['id'],'name':_0x35f818[_0xe420('0x12')],'key':_0x35f818[_0xe420('0x13')],'active':_0x35f818[_0xe420('0x14')],'Imap':{'status':_0x35f818[_0xe420('0x15')]['status'],'messageStatus':_0x35f818[_0xe420('0x15')][_0xe420('0x16')],'total':_0x35f818[_0xe420('0x15')][_0xe420('0x17')]}};if(_[_0xe420('0x18')](md5Accounts[_0x2ac421])){md5Accounts[_0x2ac421]={};}var _0x237d1d=md5(JSON[_0xe420('0x19')](_0x2befc8));if(md5Accounts[_0x2ac421][_0xe420('0x3')]!==_0x237d1d){md5Accounts[_0x2ac421][_0xe420('0x3')]=_0x237d1d;io[_0xe420('0x1a')](_0xe420('0x1b'),_0x2befc8);}};EmailChannel[_0xe420('0x1c')][_0xe420('0x1d')]=function(_0x1839b3){for(var _0x208244 in _0x1839b3){if(_0x1839b3['hasOwnProperty'](_0x208244)){if(_0x1839b3[_0x208244][_0xe420('0x15')]&&_0x1839b3[_0x208244][_0xe420('0x14')]){var _0x3c4e94=_0x1839b3[_0x208244][_0xe420('0x15')];if(!this[_0xe420('0x10')][_0xe420('0x1e')](_0x3c4e94['id'])){this[_0xe420('0x10')][_0x3c4e94['id']]=new EmailImap(_0x3c4e94,_0x1839b3[_0x208244]['email']);this['imapAccounts'][_0x3c4e94['id']]['on']('box',this['handleImapBox'][_0xe420('0x1f')](this,_0x208244));this['imapAccounts'][_0x3c4e94['id']]['on'](_0xe420('0x6'),this['handleImapEmail'][_0xe420('0x1f')](this,_0x208244));this[_0xe420('0x10')][_0x3c4e94['id']]['on'](_0xe420('0x20'),this[_0xe420('0x21')][_0xe420('0x1f')](this,_0x208244));this['imapAccounts'][_0x3c4e94['id']]['on'](_0xe420('0x22'),this[_0xe420('0x23')]['bind'](this,_0x208244));}}else{if(_['isNil'](this[_0xe420('0xf')][_0x208244][_0xe420('0x15')])){this[_0xe420('0xf')][_0x208244]['Imap']={};}this[_0xe420('0xf')][_0x208244]['Imap'][_0xe420('0x24')]='disabled';this[_0xe420('0xf')][_0x208244][_0xe420('0x15')][_0xe420('0x16')]='';this[_0xe420('0x1a')](_0x208244);}}}};EmailChannel[_0xe420('0x1c')][_0xe420('0x25')]=function(_0x252ff3,_0x74eed4){if(this[_0xe420('0xf')][_0x252ff3]){this[_0xe420('0xf')][_0x252ff3][_0xe420('0x15')]['status']=_0xe420('0x26');this[_0xe420('0xf')][_0x252ff3]['Imap'][_0xe420('0x16')]=_0x74eed4[_0xe420('0x12')];if(_0x74eed4[_0xe420('0x27')]){this[_0xe420('0xf')][_0x252ff3][_0xe420('0x15')][_0xe420('0x17')]=_0x74eed4[_0xe420('0x27')][_0xe420('0x17')];}return this[_0xe420('0x1a')](_0x252ff3);}};EmailChannel[_0xe420('0x1c')][_0xe420('0x28')]=function(_0x25e710,_0x5450ea){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5450ea[_0xe420('0x29')],_0x5450ea['lastName'],_0x5450ea[_0xe420('0x2a')],_0x25e710);if(this[_0xe420('0xf')][_0x25e710]){return mailAccount[_0xe420('0x2b')](_0x25e710,_0x5450ea)[_0xe420('0x2c')](function(_0x19253b){if(_0x19253b){logger[_0xe420('0xd')](_0xe420('0x2d'));}})['catch'](function(_0x28b66b){logger[_0xe420('0x22')](_0xe420('0x2e'),JSON[_0xe420('0x19')](_0x28b66b));});}};EmailChannel[_0xe420('0x1c')][_0xe420('0x21')]=function(_0x4f1ea4){if(this[_0xe420('0xf')][_0x4f1ea4]&&this['mailAccounts'][_0x4f1ea4]['Imap']){if(this[_0xe420('0x10')][this['mailAccounts'][_0x4f1ea4][_0xe420('0x15')]['id']]){delete this['imapAccounts'][this[_0xe420('0xf')][_0x4f1ea4][_0xe420('0x15')]['id']];}this[_0xe420('0xf')][_0x4f1ea4]['Imap'][_0xe420('0x2f')]=moment();this['emit'](_0x4f1ea4);}};EmailChannel[_0xe420('0x1c')][_0xe420('0x23')]=function(_0x4a0600,_0x182b6d){if(this[_0xe420('0xf')][_0x4a0600]){this[_0xe420('0xf')][_0x4a0600][_0xe420('0x15')][_0xe420('0x24')]=_0xe420('0x22');this[_0xe420('0xf')][_0x4a0600]['Imap'][_0xe420('0x16')]=_0x182b6d;return this['emit'](_0x4a0600);}};EmailChannel[_0xe420('0x1c')]['sendMail']=function(_0x45afff,_0x235ab4){return this[_0xe420('0x11')][_0xe420('0x30')](_0x45afff,_0x235ab4);};EmailChannel[_0xe420('0x1c')][_0xe420('0x31')]=function(_0x4b327a){var _0x352cdc=this;if(this[_0xe420('0xf')][_0x4b327a['id']]){if(_[_0xe420('0x18')](this[_0xe420('0xf')][_0x4b327a['id']][_0xe420('0x32')])){this['mailAccounts'][_0x4b327a['id']][_0xe420('0x32')]={};}this[_0xe420('0xf')][_0x4b327a['id']]['Smtp'][_0xe420('0x2f')]=moment();return new BPromise(function(_0x383709,_0x261e2f){return _0x352cdc[_0xe420('0x11')][_0xe420('0x33')](_0x4b327a)[_0xe420('0x2c')](function(_0x485352){_0x352cdc[_0xe420('0xf')][_0x4b327a['id']][_0xe420('0x32')]['status']=_0xe420('0x34');_0x352cdc[_0xe420('0xf')][_0x4b327a['id']]['Smtp']['messageStatus']='';_0x352cdc[_0xe420('0x1a')](_0x4b327a['id']);_0x383709(_0x485352);})[_0xe420('0x35')](function(_0x2972e3){_0x352cdc[_0xe420('0xf')][_0x4b327a['id']][_0xe420('0x32')]['status']=_0xe420('0x22');_0x352cdc[_0xe420('0xf')][_0x4b327a['id']]['Smtp']['messageStatus']=_0x2972e3;_0x352cdc[_0xe420('0x1a')](_0x4b327a['id']);_0x261e2f(_0x2972e3);});});}return this['smtp']['verify'](_0x4b327a);};module[_0xe420('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 79f654c..57e4a9c 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 _0xdd96=['closeBox','body','handleMessageBody','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','handleFetchEnd','stringify','textCode','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','handleReady','bind','once','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError'];(function(_0x2e3181,_0x2b5240){var _0x1127fb=function(_0x42b120){while(--_0x42b120){_0x2e3181['push'](_0x2e3181['shift']());}};_0x1127fb(++_0x2b5240);}(_0xdd96,0x84));var _0x6dd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd96[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x6dd9('0x0'));var util=require(_0x6dd9('0x1'));var Imap=require(_0x6dd9('0x2'));var _=require(_0x6dd9('0x3'));var rs=require(_0x6dd9('0x4'));var simpleParser=require(_0x6dd9('0x5'))[_0x6dd9('0x6')];var Iconv=require('iconv')[_0x6dd9('0x7')];var EventEmitter=require(_0x6dd9('0x8'))['EventEmitter'];var utils=require(_0x6dd9('0x9'));var logger=require(_0x6dd9('0xa'))(_0x6dd9('0xb'));function EmailImap(_0x1b9b60,_0x550f06){this[_0x6dd9('0xc')]=_0x6dd9('0xd');this[_0x6dd9('0xe')]=this[_0x6dd9('0xf')](_0x1b9b60,_0x550f06);this['imap']=new Imap(this['account']);this[_0x6dd9('0x2')]['once'](_0x6dd9('0x10'),this[_0x6dd9('0x11')][_0x6dd9('0x12')](this));this[_0x6dd9('0x2')][_0x6dd9('0x13')]('end',this[_0x6dd9('0x14')]['bind'](this));this[_0x6dd9('0x2')]['on'](_0x6dd9('0x15'),this['handleError']['bind'](this));this[_0x6dd9('0x2')][_0x6dd9('0x16')]();}util[_0x6dd9('0x17')](EmailImap,EventEmitter);EmailImap[_0x6dd9('0x18')][_0x6dd9('0xf')]=function(_0x40808e,_0x570b6b){var _0x59514a={'connTimeout':_0x40808e[_0x6dd9('0x19')]?_0x40808e[_0x6dd9('0x19')]*0x3e8:0x2710,'authTimeout':_0x40808e[_0x6dd9('0x1a')]?_0x40808e[_0x6dd9('0x1a')]*0x3e8:0x1388};if(_[_0x6dd9('0x1b')](_0x40808e[_0x6dd9('0x1c')])){if(_0x40808e[_0x6dd9('0x1d')]){_0x59514a[_0x6dd9('0x1e')]=_0x40808e[_0x6dd9('0x1e')];_0x59514a['password']=_0x40808e[_0x6dd9('0x1f')];}_0x59514a[_0x6dd9('0x20')]=_0x40808e['host'];_0x59514a[_0x6dd9('0x21')]=_0x40808e[_0x6dd9('0x21')]||0x3e1;if(_0x40808e[_0x6dd9('0x22')]){_0x59514a[_0x6dd9('0x22')]=!![];}else{_0x59514a[_0x6dd9('0x22')]=![];_0x59514a[_0x6dd9('0x23')]='required';}}else{_0x59514a[_0x6dd9('0x1e')]=_0x40808e[_0x6dd9('0x1e')];_0x59514a[_0x6dd9('0x1f')]=_0x40808e[_0x6dd9('0x1f')];_0x59514a['host']=utils['getHost'](_0x40808e[_0x6dd9('0x1c')]);_0x59514a[_0x6dd9('0x21')]=0x3e1;_0x59514a[_0x6dd9('0x22')]=!![];}_0x59514a[_0x6dd9('0xb')]=_0x570b6b||_0x40808e[_0x6dd9('0x1e')]||_0x6dd9('0x24');return _0x59514a;};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x11')]=function(){this[_0x6dd9('0x2')][_0x6dd9('0x25')](this[_0x6dd9('0xc')],![],this[_0x6dd9('0x26')]['bind'](this));};EmailImap['prototype'][_0x6dd9('0x26')]=function(_0x3caa6c,_0x53f05d){if(_0x3caa6c){this[_0x6dd9('0x27')](_0x3caa6c,!![]);}else{this[_0x6dd9('0x28')]('box',_0x53f05d);this['readUnseen']();}};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x29')]=function(_0x26c72e){if(_0x26c72e){this[_0x6dd9('0x27')](_0x26c72e,!![]);}else{this[_0x6dd9('0x2')][_0x6dd9('0x2a')]();}};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x2b')]=function(){this[_0x6dd9('0x2')][_0x6dd9('0x2c')]([_0x6dd9('0x2d')],this[_0x6dd9('0x2e')][_0x6dd9('0x12')](this));};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x2e')]=function(_0x383ac9,_0xb1a04){if(_0x383ac9){this['handleError'](_0x383ac9,!![]);}else{if(_0xb1a04[_0x6dd9('0x2f')]){try{var _0x68d8dd=this['imap']['fetch'](_0xb1a04,{'bodies':'','markSeen':!![]});_0x68d8dd['on'](_0x6dd9('0x30'),this[_0x6dd9('0x31')][_0x6dd9('0x12')](this));_0x68d8dd['once'](_0x6dd9('0x15'),this[_0x6dd9('0x32')][_0x6dd9('0x12')](this));_0x68d8dd['once'](_0x6dd9('0x2a'),this['handleFetchEnd'][_0x6dd9('0x12')](this));}catch(_0x26559f){logger[_0x6dd9('0x15')](_0x26559f);}}else{this[_0x6dd9('0x2')][_0x6dd9('0x33')](!![],this['handleCloseBox'][_0x6dd9('0x12')](this));}}};EmailImap['prototype'][_0x6dd9('0x31')]=function(_0x5ed0a9,_0x26f730){_0x5ed0a9['on'](_0x6dd9('0x34'),this[_0x6dd9('0x35')][_0x6dd9('0x12')](this));_0x5ed0a9[_0x6dd9('0x13')]('attributes',this['handleMessageAttributes']['bind'](this));_0x5ed0a9[_0x6dd9('0x13')](_0x6dd9('0x2a'),this['handleMessageEnd'][_0x6dd9('0x12')](this));};EmailImap['prototype'][_0x6dd9('0x35')]=function(_0x4a8f59,_0x4da2d6){simpleParser(_0x4a8f59,{'Iconv':Iconv},this[_0x6dd9('0x36')][_0x6dd9('0x12')](this));};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x37')]=function(_0x3046e2){};EmailImap['prototype'][_0x6dd9('0x38')]=function(){};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x36')]=function(_0x5a74f1,_0x1c62e4){if(_0x5a74f1){logger[_0x6dd9('0x15')](_0x5a74f1);}else{var _0x4a7e87=this;utils[_0x6dd9('0x39')](this[_0x6dd9('0xe')],_0x1c62e4,function(_0x263cd3){_0x4a7e87[_0x6dd9('0x28')](_0x6dd9('0xb'),_0x263cd3);});}};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x3a')]=function(){this[_0x6dd9('0x2')][_0x6dd9('0x33')](!![],this['handleCloseBox'][_0x6dd9('0x12')](this));};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x32')]=function(_0x14e118){this['handleError'](_0x14e118);this[_0x6dd9('0x2')][_0x6dd9('0x33')](!![],this['handleCloseBox'][_0x6dd9('0x12')](this));};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x14')]=function(){this[_0x6dd9('0x28')](_0x6dd9('0x2a'));};EmailImap[_0x6dd9('0x18')][_0x6dd9('0x27')]=function(_0x47927b,_0xab9570){logger[_0x6dd9('0x15')](_0x6dd9('0x27'),this['account'][_0x6dd9('0xb')],JSON[_0x6dd9('0x3b')](_0x47927b));var _0x2ef72d='';if(_0x47927b){if(_0x47927b[_0x6dd9('0x3c')]){_0x2ef72d=_0x47927b[_0x6dd9('0x3c')];}else{for(var _0x6ba126 in _0x47927b){if(_0x47927b['hasOwnProperty'](_0x6ba126)){_0x2ef72d+=_['upperFirst'](_0x6ba126)+':\x20'+_0x47927b[_0x6ba126]+'\x0a';}}}}if(_0xab9570){this[_0x6dd9('0x2')][_0x6dd9('0x2a')]();}else{this[_0x6dd9('0x28')](_0x6dd9('0x15'),_0x2ef72d);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x045b=['handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleEnd','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','error','handleError','connect','inherits','prototype','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage'];(function(_0x2f7840,_0x3442da){var _0x1721a0=function(_0x2e4122){while(--_0x2e4122){_0x2f7840['push'](_0x2f7840['shift']());}};_0x1721a0(++_0x3442da);}(_0x045b,0x150));var _0xb045=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x045b[_0x1e6db3];return _0x1de886;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xb045('0x0'));var Imap=require(_0xb045('0x1'));var _=require(_0xb045('0x2'));var rs=require('randomstring');var simpleParser=require(_0xb045('0x3'))[_0xb045('0x4')];var Iconv=require(_0xb045('0x5'))[_0xb045('0x6')];var EventEmitter=require(_0xb045('0x7'))[_0xb045('0x8')];var utils=require(_0xb045('0x9'));var logger=require(_0xb045('0xa'))(_0xb045('0xb'));function EmailImap(_0x1b1141,_0x4beea2){this[_0xb045('0xc')]=_0xb045('0xd');this['account']=this[_0xb045('0xe')](_0x1b1141,_0x4beea2);this[_0xb045('0x1')]=new Imap(this[_0xb045('0xf')]);this[_0xb045('0x1')][_0xb045('0x10')](_0xb045('0x11'),this[_0xb045('0x12')][_0xb045('0x13')](this));this[_0xb045('0x1')][_0xb045('0x10')](_0xb045('0x14'),this['handleEnd'][_0xb045('0x13')](this));this[_0xb045('0x1')]['on'](_0xb045('0x15'),this[_0xb045('0x16')][_0xb045('0x13')](this));this['imap'][_0xb045('0x17')]();}util[_0xb045('0x18')](EmailImap,EventEmitter);EmailImap[_0xb045('0x19')][_0xb045('0xe')]=function(_0xf70137,_0x4b9398){var _0x2635fa={'connTimeout':_0xf70137['connTimeout']?_0xf70137['connTimeout']*0x3e8:0x2710,'authTimeout':_0xf70137[_0xb045('0x1a')]?_0xf70137[_0xb045('0x1a')]*0x3e8:0x1388};if(_['isNil'](_0xf70137[_0xb045('0x1b')])){if(_0xf70137[_0xb045('0x1c')]){_0x2635fa[_0xb045('0x1d')]=_0xf70137[_0xb045('0x1d')];_0x2635fa[_0xb045('0x1e')]=_0xf70137['password'];}_0x2635fa['host']=_0xf70137[_0xb045('0x1f')];_0x2635fa[_0xb045('0x20')]=_0xf70137['port']||0x3e1;if(_0xf70137[_0xb045('0x21')]){_0x2635fa[_0xb045('0x21')]=!![];}else{_0x2635fa[_0xb045('0x21')]=![];_0x2635fa[_0xb045('0x22')]=_0xb045('0x23');}}else{_0x2635fa['user']=_0xf70137['user'];_0x2635fa[_0xb045('0x1e')]=_0xf70137[_0xb045('0x1e')];_0x2635fa['host']=utils['getHost'](_0xf70137[_0xb045('0x1b')]);_0x2635fa[_0xb045('0x20')]=0x3e1;_0x2635fa[_0xb045('0x21')]=!![];}_0x2635fa[_0xb045('0xb')]=_0x4b9398||_0xf70137[_0xb045('0x1d')]||_0xb045('0x24');return _0x2635fa;};EmailImap[_0xb045('0x19')][_0xb045('0x12')]=function(){this[_0xb045('0x1')][_0xb045('0x25')](this['mailbox'],![],this['handleOpenBox'][_0xb045('0x13')](this));};EmailImap[_0xb045('0x19')][_0xb045('0x26')]=function(_0x1ef619,_0xd8716c){if(_0x1ef619){this[_0xb045('0x16')](_0x1ef619,!![]);}else{this['emit'](_0xb045('0x27'),_0xd8716c);this[_0xb045('0x28')]();}};EmailImap['prototype'][_0xb045('0x29')]=function(_0x2aa1d9){if(_0x2aa1d9){this[_0xb045('0x16')](_0x2aa1d9,!![]);}else{this['imap']['end']();}};EmailImap[_0xb045('0x19')][_0xb045('0x28')]=function(){this[_0xb045('0x1')][_0xb045('0x2a')](['UNSEEN'],this[_0xb045('0x2b')][_0xb045('0x13')](this));};EmailImap[_0xb045('0x19')][_0xb045('0x2b')]=function(_0x429194,_0x417b0a){if(_0x429194){this[_0xb045('0x16')](_0x429194,!![]);}else{if(_0x417b0a[_0xb045('0x2c')]){try{var _0x5aa4c5=this['imap'][_0xb045('0x2d')](_0x417b0a,{'bodies':'','markSeen':!![]});_0x5aa4c5['on'](_0xb045('0x2e'),this[_0xb045('0x2f')]['bind'](this));_0x5aa4c5['once'](_0xb045('0x15'),this[_0xb045('0x30')]['bind'](this));_0x5aa4c5['once'](_0xb045('0x14'),this[_0xb045('0x31')]['bind'](this));}catch(_0x7f9f5){logger[_0xb045('0x15')](_0x7f9f5);}}else{this[_0xb045('0x1')][_0xb045('0x32')](!![],this[_0xb045('0x29')][_0xb045('0x13')](this));}}};EmailImap[_0xb045('0x19')][_0xb045('0x2f')]=function(_0x4731cf,_0x1159cc){_0x4731cf['on'](_0xb045('0x33'),this[_0xb045('0x34')]['bind'](this));_0x4731cf['once'](_0xb045('0x35'),this[_0xb045('0x36')][_0xb045('0x13')](this));_0x4731cf[_0xb045('0x10')]('end',this[_0xb045('0x37')]['bind'](this));};EmailImap[_0xb045('0x19')][_0xb045('0x34')]=function(_0x51e01e,_0x29fba2){simpleParser(_0x51e01e,{'Iconv':Iconv},this[_0xb045('0x38')][_0xb045('0x13')](this));};EmailImap[_0xb045('0x19')][_0xb045('0x36')]=function(_0x42f386){};EmailImap[_0xb045('0x19')]['handleMessageEnd']=function(){};EmailImap[_0xb045('0x19')][_0xb045('0x38')]=function(_0x470ad3,_0x2979e0){if(_0x470ad3){logger['error'](_0x470ad3);}else{var _0x2360f6=this;utils[_0xb045('0x39')](this[_0xb045('0xf')],_0x2979e0,function(_0x3e97ef){_0x2360f6[_0xb045('0x3a')]('email',_0x3e97ef);});}};EmailImap[_0xb045('0x19')][_0xb045('0x31')]=function(){this[_0xb045('0x1')][_0xb045('0x32')](!![],this[_0xb045('0x29')][_0xb045('0x13')](this));};EmailImap[_0xb045('0x19')][_0xb045('0x30')]=function(_0x435db4){this[_0xb045('0x16')](_0x435db4);this[_0xb045('0x1')]['closeBox'](!![],this[_0xb045('0x29')][_0xb045('0x13')](this));};EmailImap[_0xb045('0x19')][_0xb045('0x3b')]=function(){this[_0xb045('0x3a')](_0xb045('0x14'));};EmailImap[_0xb045('0x19')][_0xb045('0x16')]=function(_0x20c2f9,_0xd9a526){logger[_0xb045('0x15')]('handleError',this[_0xb045('0xf')][_0xb045('0xb')],JSON['stringify'](_0x20c2f9));var _0x5b5e18='';if(_0x20c2f9){if(_0x20c2f9[_0xb045('0x3c')]){_0x5b5e18=_0x20c2f9[_0xb045('0x3c')];}else{for(var _0x20f83 in _0x20c2f9){if(_0x20c2f9[_0xb045('0x3d')](_0x20f83)){_0x5b5e18+=_[_0xb045('0x3e')](_0x20f83)+':\x20'+_0x20c2f9[_0x20f83]+'\x0a';}}}}if(_0xd9a526){this['imap'][_0xb045('0x14')]();}else{this['emit'](_0xb045('0x15'),_0x5b5e18);this[_0xb045('0x3a')]('end');}};module[_0xb045('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index da0958c..5644fbe 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 _0x08a2=['exports','bluebird','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','toString','prototype','verify'];(function(_0x10d3c2,_0x1f5142){var _0x4208aa=function(_0x2e1ff9){while(--_0x2e1ff9){_0x10d3c2['push'](_0x10d3c2['shift']());}};_0x4208aa(++_0x1f5142);}(_0x08a2,0x137));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x208a('0x0'));var inlineBase64=require(_0x208a('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x208a('0x2')]=function(_0x537a7e,_0x41e02b){return new BPromise(function(_0x543b6d,_0x20d40a){var _0x6aa339=nodemailer[_0x208a('0x3')](_0x537a7e);_0x6aa339['use'](_0x208a('0x4'),inlineBase64());_0x6aa339[_0x208a('0x5')](_0x41e02b,function(_0x1ec1d2,_0x49091f){if(_0x1ec1d2){_0x20d40a(_0x1ec1d2[_0x208a('0x6')]());}else{_0x543b6d(_0x49091f);}});});};EmailSmtp[_0x208a('0x7')][_0x208a('0x8')]=function(_0x50802d){return new BPromise(function(_0x71ba39,_0x568b20){var _0x4d7174=nodemailer[_0x208a('0x3')](_0x50802d);_0x4d7174[_0x208a('0x8')](function(_0x57f274,_0x45a1ae){if(_0x57f274){_0x568b20(_0x57f274[_0x208a('0x6')]());}else{if(_0x45a1ae){_0x71ba39(_0x45a1ae);}else{_0x568b20('Not\x20verifired');}}});});};module[_0x208a('0x9')]=EmailSmtp; \ No newline at end of file +var _0xe57d=['toString','prototype','verify','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xe57d,0xa4));var _0xde57=function(_0x4651ae,_0x3d2bc0){_0x4651ae=_0x4651ae-0x0;var _0x29a97c=_0xe57d[_0x4651ae];return _0x29a97c;};'use strict';var nodemailer=require(_0xde57('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xde57('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xde57('0x2')]=function(_0x557dab,_0x154e7a){return new BPromise(function(_0x58c6ed,_0x59145f){var _0x20d707=nodemailer[_0xde57('0x3')](_0x557dab);_0x20d707['use']('compile',inlineBase64());_0x20d707['sendMail'](_0x154e7a,function(_0x289d3c,_0x4ca667){if(_0x289d3c){_0x59145f(_0x289d3c[_0xde57('0x4')]());}else{_0x58c6ed(_0x4ca667);}});});};EmailSmtp[_0xde57('0x5')][_0xde57('0x6')]=function(_0x19c04c){return new BPromise(function(_0x4b825b,_0x32f132){var _0x14097c=nodemailer[_0xde57('0x3')](_0x19c04c);_0x14097c[_0xde57('0x6')](function(_0x244988,_0x487f1d){if(_0x244988){_0x32f132(_0x244988[_0xde57('0x4')]());}else{if(_0x487f1d){_0x4b825b(_0x487f1d);}else{_0x32f132('Not\x20verifired');}}});});};module[_0xde57('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e67f9ec..e2c4904 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 _0x79f7=['value','name','split','length','slice','Anonymous','isEmpty','test','html','replace','includes','','body','Empty\x20message

','Attachments','Title','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','moment','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','@xcally.com'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x79f7,0xbb));var _0x779f=function(_0xd5b654,_0x37bcaa){_0xd5b654=_0xd5b654-0x0;var _0x477ecc=_0x79f7[_0xd5b654];return _0x477ecc;};'use strict';var _=require('lodash');var moment=require(_0x779f('0x0'));var random=require(_0x779f('0x1'));var fs=require('fs');var path=require(_0x779f('0x2'));var util=require('util');var tnef=require(_0x779f('0x3'));var logger=require(_0x779f('0x4'))('email');var config=require(_0x779f('0x5'));function getAddress(_0x26f14f){var _0x2f12ed=_[_0x779f('0x6')](_0x26f14f['value']);return _0x2f12ed&&_0x2f12ed[_0x779f('0x7')]?_0x2f12ed[_0x779f('0x7')]:_0x779f('0x8')+random[_0x779f('0x9')](0x6)+_0x779f('0xa');}function getFirstName(_0x36b403){var _0x554ba0=_[_0x779f('0x6')](_0x36b403[_0x779f('0xb')]);if(_0x554ba0&&_0x554ba0[_0x779f('0xc')]){var _0x422bbd=_0x554ba0['name'][_0x779f('0xd')](/\s+/);return _0x422bbd[_0x779f('0xe')]?_0x422bbd[_0x779f('0xf')](0x0,-0x1)['join']('\x20'):_0x554ba0['name'];}return _0x779f('0x10');}function getLastName(_0x3a79fb){var _0x494127=_['head'](_0x3a79fb['value']);if(_0x494127&&_0x494127['name']){var _0x4b193b=_0x494127[_0x779f('0xc')][_0x779f('0xd')](/\s+/);return _0x4b193b[_0x779f('0xe')]>0x1?_0x4b193b['pop']():'';}return'';}function getMails(_0x470afe,_0x3e3942){var _0x1dec84='';for(var _0x27628c=0x0;_0x27628c<_0x3e3942[_0x779f('0xb')][_0x779f('0xe')];_0x27628c+=0x1){if(_0x3e3942[_0x779f('0xb')][_0x27628c]['address']!==_0x470afe){if(!_[_0x779f('0x11')](_0x1dec84)){_0x1dec84+=',';}_0x1dec84+=_0x3e3942[_0x779f('0xb')][_0x27628c][_0x779f('0xc')]||_0x3e3942['value'][_0x27628c][_0x779f('0x7')]||'';_0x1dec84+='\x20<';_0x1dec84+=_0x3e3942[_0x779f('0xb')][_0x27628c][_0x779f('0x7')]?_0x3e3942[_0x779f('0xb')][_0x27628c][_0x779f('0x7')]:_0x779f('0x8')+random[_0x779f('0x9')](0x6)+_0x779f('0xa');_0x1dec84+='>';}}return _0x1dec84;}function parseEmail(_0x42cff7,_0xdc2d78,_0x4663fe){if(_0xdc2d78['html']){var _0x2e2d85=/)<[^<]*)*<\/script>/gi;while(_0x2e2d85[_0x779f('0x12')](_0xdc2d78[_0x779f('0x13')])){_0xdc2d78[_0x779f('0x13')]=_0xdc2d78['html'][_0x779f('0x14')](_0x2e2d85,'');}if(_0xdc2d78[_0x779f('0x13')][_0x779f('0x15')](_0x779f('0x16'))){var _0xecb76a=[];_0xdc2d78[_0x779f('0x17')]['forEach'](_0x5a1742=>{_0xecb76a[_0x779f('0x18')](_0x5a1742[_0x779f('0x19')]);});var _0xec3412=/]+>/g;var _0x5baebb=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x55b149=_0xdc2d78[_0x779f('0x13')]['replace'](_0x5baebb,'_SRC');var _0x541c46=_0x55b149['replace'](_0xec3412,_0x779f('0x1a'));for(let _0x45f585=0x0;_0x45f585<_0xecb76a['length'];_0x45f585++){var _0x5dd3ff=_0x541c46[_0x779f('0x14')]('_IMG','\x20[Attachment:\x20'+_0xecb76a[_0x45f585]+_0x779f('0x1b'));_0x541c46=_0x5dd3ff;}_0xdc2d78['html']=_0x541c46;}_0x4663fe[_0x779f('0x1c')]=_0xdc2d78[_0x779f('0x13')];}else{_0x4663fe[_0x779f('0x1c')]=_0xdc2d78['textAsHtml'];}if(_0x4663fe['body']){_0x4663fe[_0x779f('0x1c')]=_0x4663fe[_0x779f('0x1c')][_0x779f('0x14')](/Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','anonymous','generate','head','value','name','split','length','join','Anonymous','pop','address','isEmpty','@xcally.com','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','message','originCc','originTo','attach','attachments','type','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','content','push','contentType','parser','from','subject','messageId','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info'];(function(_0x34394b,_0x5daa30){var _0x2a72e5=function(_0x17f74a){while(--_0x17f74a){_0x34394b['push'](_0x34394b['shift']());}};_0x2a72e5(++_0x5daa30);}(_0xce67,0x123));var _0x7ce6=function(_0xd3f9c9,_0x6bbffc){_0xd3f9c9=_0xd3f9c9-0x0;var _0x2ea4a3=_0xce67[_0xd3f9c9];return _0x2ea4a3;};'use strict';var _=require(_0x7ce6('0x0'));var moment=require(_0x7ce6('0x1'));var random=require(_0x7ce6('0x2'));var fs=require('fs');var path=require(_0x7ce6('0x3'));var util=require(_0x7ce6('0x4'));var tnef=require(_0x7ce6('0x5'));var logger=require(_0x7ce6('0x6'))(_0x7ce6('0x7'));var config=require(_0x7ce6('0x8'));function getAddress(_0x1874e1){var _0x2eab73=_['head'](_0x1874e1['value']);return _0x2eab73&&_0x2eab73['address']?_0x2eab73['address']:_0x7ce6('0x9')+random[_0x7ce6('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x464799){var _0x582a8e=_[_0x7ce6('0xb')](_0x464799[_0x7ce6('0xc')]);if(_0x582a8e&&_0x582a8e[_0x7ce6('0xd')]){var _0x3a122b=_0x582a8e[_0x7ce6('0xd')][_0x7ce6('0xe')](/\s+/);return _0x3a122b[_0x7ce6('0xf')]?_0x3a122b['slice'](0x0,-0x1)[_0x7ce6('0x10')]('\x20'):_0x582a8e[_0x7ce6('0xd')];}return _0x7ce6('0x11');}function getLastName(_0x5206a3){var _0x4805bd=_[_0x7ce6('0xb')](_0x5206a3[_0x7ce6('0xc')]);if(_0x4805bd&&_0x4805bd['name']){var _0x1320a2=_0x4805bd[_0x7ce6('0xd')][_0x7ce6('0xe')](/\s+/);return _0x1320a2[_0x7ce6('0xf')]>0x1?_0x1320a2[_0x7ce6('0x12')]():'';}return'';}function getMails(_0x251029,_0x5a0022){var _0x24c3e7='';for(var _0x57ef76=0x0;_0x57ef76<_0x5a0022[_0x7ce6('0xc')][_0x7ce6('0xf')];_0x57ef76+=0x1){if(_0x5a0022['value'][_0x57ef76][_0x7ce6('0x13')]!==_0x251029){if(!_[_0x7ce6('0x14')](_0x24c3e7)){_0x24c3e7+=',';}_0x24c3e7+=_0x5a0022[_0x7ce6('0xc')][_0x57ef76][_0x7ce6('0xd')]||_0x5a0022['value'][_0x57ef76][_0x7ce6('0x13')]||'';_0x24c3e7+='\x20<';_0x24c3e7+=_0x5a0022[_0x7ce6('0xc')][_0x57ef76][_0x7ce6('0x13')]?_0x5a0022[_0x7ce6('0xc')][_0x57ef76][_0x7ce6('0x13')]:_0x7ce6('0x9')+random[_0x7ce6('0xa')](0x6)+_0x7ce6('0x15');_0x24c3e7+='>';}}return _0x24c3e7;}function parseEmail(_0x1516ea,_0x38960a,_0x576e01){if(_0x38960a['html']){var _0x47dbc4=/)<[^<]*)*<\/script>/gi;while(_0x47dbc4['test'](_0x38960a[_0x7ce6('0x16')])){_0x38960a[_0x7ce6('0x16')]=_0x38960a['html'][_0x7ce6('0x17')](_0x47dbc4,'');}if(_0x38960a[_0x7ce6('0x16')][_0x7ce6('0x18')](_0x7ce6('0x19'))){var _0x8c890a=[];_0x38960a['attachments']['forEach'](_0x529f3d=>{_0x8c890a['push'](_0x529f3d['filename']);});var _0x163e18=/]+>/g;var _0x228b24=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x33aef1=_0x38960a['html'][_0x7ce6('0x17')](_0x228b24,_0x7ce6('0x1a'));var _0x514dee=_0x33aef1[_0x7ce6('0x17')](_0x163e18,'_IMG');for(let _0x12ce3e=0x0;_0x12ce3e<_0x8c890a[_0x7ce6('0xf')];_0x12ce3e++){var _0x1afe3b=_0x514dee['replace'](_0x7ce6('0x1b'),_0x7ce6('0x1c')+_0x8c890a[_0x12ce3e]+'\x20]');_0x514dee=_0x1afe3b;}_0x38960a[_0x7ce6('0x16')]=_0x514dee;}_0x576e01[_0x7ce6('0x1d')]=_0x38960a['html'];}else{_0x576e01[_0x7ce6('0x1d')]=_0x38960a[_0x7ce6('0x1e')];}if(_0x576e01['body']){_0x576e01[_0x7ce6('0x1d')]=_0x576e01[_0x7ce6('0x1d')][_0x7ce6('0x17')](/Empty\x20message

';if(_0x39fed5['Attachments']){for(var _0x65ae23=0x0;_0x65ae23<_0x39fed5['Attachments'][_0x7ce6('0xf')];_0x65ae23++){var _0x40e601=_0x39fed5[_0x7ce6('0x38')][_0x65ae23];_0x477be1[_0x7ce6('0x1f')]['attachments']['push']({'filename':_0x40e601[_0x7ce6('0x39')],'content':new Buffer(_0x40e601[_0x7ce6('0x3a')])});}}}_0x28caa4(parseEmail(_0x110a53,_0x510d7c,_0x477be1));});}else{_0x510d7c[_0x7ce6('0x16')]=_0x7ce6('0x3b');_0x28caa4(parseEmail(_0x110a53,_0x510d7c,_0x477be1));}}else{_0x28caa4(parseEmail(_0x110a53,_0x510d7c,_0x477be1));}};exports[_0x7ce6('0x3c')]=function(_0x4fe921){switch(_0x4fe921){case _0x7ce6('0x3d'):return _0x7ce6('0x3e');case _0x7ce6('0x3f'):return'imap.mail.yahoo.com';case _0x7ce6('0x40'):return _0x7ce6('0x41');case _0x7ce6('0x42'):return _0x7ce6('0x43');}return _0x7ce6('0x44');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9868f69..b3686bd 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 _0x31e5=['exports','lodash','name','Service','key','SERV','Imap','Smtp'];(function(_0x215f91,_0x42721a){var _0x396370=function(_0x2fbfd2){while(--_0x2fbfd2){_0x215f91['push'](_0x215f91['shift']());}};_0x396370(++_0x42721a);}(_0x31e5,0x101));var _0x531e=function(_0x3f0919,_0x44f104){_0x3f0919=_0x3f0919-0x0;var _0x8532d1=_0x31e5[_0x3f0919];return _0x8532d1;};'use strict';var _=require(_0x531e('0x0'));function MailAccount(_0x4a20ba){this['id']=_0x4a20ba['id']||0x0;this[_0x531e('0x1')]=_0x4a20ba[_0x531e('0x1')]||_0x531e('0x2');this[_0x531e('0x3')]=_0x4a20ba[_0x531e('0x3')]||_0x531e('0x4');this['active']=_0x4a20ba['active']||![];this[_0x531e('0x5')]=_0x4a20ba['Imap']||[];this[_0x531e('0x6')]=_0x4a20ba['Smtp']||[];}module[_0x531e('0x7')]=MailAccount; \ No newline at end of file +var _0xf1dd=['Imap','Smtp','exports','name','key','SERV','active'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xf1dd,0x18b));var _0xdf1d=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xf1dd[_0x533528];return _0x3189f1;};'use strict';var _=require('lodash');function MailAccount(_0x214bf0){this['id']=_0x214bf0['id']||0x0;this[_0xdf1d('0x0')]=_0x214bf0[_0xdf1d('0x0')]||'Service';this[_0xdf1d('0x1')]=_0x214bf0[_0xdf1d('0x1')]||_0xdf1d('0x2');this[_0xdf1d('0x3')]=_0x214bf0['active']||![];this[_0xdf1d('0x4')]=_0x214bf0[_0xdf1d('0x4')]||[];this[_0xdf1d('0x5')]=_0x214bf0[_0xdf1d('0x5')]||[];}module[_0xdf1d('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index a851995..2674760 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 _0x7dba=['merge','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x608625,_0x58aea2){var _0x38d78a=function(_0x26a924){while(--_0x26a924){_0x608625['push'](_0x608625['shift']());}};_0x38d78a(++_0x58aea2);}(_0x7dba,0x6d));var _0xa7db=function(_0x4b92cd,_0x382484){_0x4b92cd=_0x4b92cd-0x0;var _0x264e66=_0x7dba[_0x4b92cd];return _0x264e66;};'use strict';var _=require('lodash');var MailAccount=require(_0xa7db('0x0'));var Realtime=function(){this[_0xa7db('0x1')]={};};function freeIsNotKey(_0x2f43f2,_0x43adcd,_0x32ebe8){var _0x10fd3d=_[_0xa7db('0x2')](_0x2f43f2,function(_0x261013,_0x5ce5c0){return _0x261013[_0x32ebe8];});for(var _0x11e42f in _0x43adcd){if(_0x43adcd[_0xa7db('0x3')](_0x11e42f)){if(!_0x10fd3d[_0x11e42f]){delete _0x43adcd[_0x11e42f];}}}}Realtime[_0xa7db('0x4')][_0xa7db('0x5')]=function(_0x28455f,_0x1e8911){for(var _0x4c5e55 in _0x1e8911){if(_0x28455f[_0xa7db('0x3')](_0x4c5e55)){_0x28455f[_0x4c5e55]=_0x1e8911[_0x4c5e55];}}};Realtime[_0xa7db('0x4')][_0xa7db('0x6')]=function(){var _0x362712=this;return function(_0x6cc1a8){if(_0x6cc1a8){freeIsNotKey(_0x6cc1a8,_0x362712['mailAccounts'],'id');for(var _0x2e2077=0x0,_0x887fa6={},_0x1e9645={};_0x2e2077<_0x6cc1a8[_0xa7db('0x7')];_0x2e2077+=0x1){_0x887fa6=_0x6cc1a8[_0x2e2077];if(_['isUndefined'](_0x362712[_0xa7db('0x1')][_0x887fa6['id']])){_0x362712[_0xa7db('0x1')][_0x887fa6['id']]=new MailAccount(_0x887fa6);}else{_[_0xa7db('0x8')](_0x362712['mailAccounts'][_0x887fa6['id']],_0x887fa6);}}}return _0x362712[_0xa7db('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xaa54=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined'];(function(_0x3351ae,_0x4882c9){var _0x2ea024=function(_0x32941f){while(--_0x32941f){_0x3351ae['push'](_0x3351ae['shift']());}};_0x2ea024(++_0x4882c9);}(_0xaa54,0x1f1));var _0x4aa5=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xaa54[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x4aa5('0x0'));var MailAccount=require(_0x4aa5('0x1'));var Realtime=function(){this[_0x4aa5('0x2')]={};};function freeIsNotKey(_0x5aae4f,_0x61bb6f,_0xe967d){var _0x3f5468=_[_0x4aa5('0x3')](_0x5aae4f,function(_0x1871a8,_0x12264b){return _0x1871a8[_0xe967d];});for(var _0x5ac599 in _0x61bb6f){if(_0x61bb6f[_0x4aa5('0x4')](_0x5ac599)){if(!_0x3f5468[_0x5ac599]){delete _0x61bb6f[_0x5ac599];}}}}Realtime[_0x4aa5('0x5')][_0x4aa5('0x6')]=function(_0x123edf,_0x2775a8){for(var _0x124b4b in _0x2775a8){if(_0x123edf[_0x4aa5('0x4')](_0x124b4b)){_0x123edf[_0x124b4b]=_0x2775a8[_0x124b4b];}}};Realtime[_0x4aa5('0x5')][_0x4aa5('0x7')]=function(){var _0x585a75=this;return function(_0x517620){if(_0x517620){freeIsNotKey(_0x517620,_0x585a75[_0x4aa5('0x2')],'id');for(var _0x47c8ec=0x0,_0x134ef8={},_0x28bdd9={};_0x47c8ec<_0x517620['length'];_0x47c8ec+=0x1){_0x134ef8=_0x517620[_0x47c8ec];if(_[_0x4aa5('0x8')](_0x585a75[_0x4aa5('0x2')][_0x134ef8['id']])){_0x585a75[_0x4aa5('0x2')][_0x134ef8['id']]=new MailAccount(_0x134ef8);}else{_[_0x4aa5('0x9')](_0x585a75[_0x4aa5('0x2')][_0x134ef8['id']],_0x134ef8);}}}return _0x585a75['mailAccounts'];};};module[_0x4aa5('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 0a51952..4445c14 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 _0x2bd8=['service','email','active','key','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','../client','Request','GetMailAccount','name'];(function(_0x449561,_0x12eb71){var _0x2aa44c=function(_0x404bdf){while(--_0x404bdf){_0x449561['push'](_0x449561['shift']());}};_0x2aa44c(++_0x12eb71);}(_0x2bd8,0x130));var _0x82bd=function(_0x4de7d0,_0x359171){_0x4de7d0=_0x4de7d0-0x0;var _0x2927c7=_0x2bd8[_0x4de7d0];return _0x2927c7;};'use strict';var client=require(_0x82bd('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x82bd('0x1')](_0x82bd('0x2'),{'options':{'attributes':['id',_0x82bd('0x3'),_0x82bd('0x4'),_0x82bd('0x5'),_0x82bd('0x6'),_0x82bd('0x7'),'ListId',_0x82bd('0x8')],'raw':![],'include':[{'model':_0x82bd('0x9'),'as':_0x82bd('0xa')},{'model':'MailServerOut','as':_0x82bd('0xb')}]},'log':_0x82bd('0xc')});};};exports[_0x82bd('0xd')]=function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0x1')]('NotifyMailAccount',{'account':{'id':_0x1f7463},'body':_0x4dc3a6,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xfb8f=['MailServerIn','Imap','MailServerOut','notify','Request','NotifyMailAccount','getMailAccounts','name','service','email','active','key','TemplateId'];(function(_0x4e24bf,_0x2f8301){var _0x48e23c=function(_0x48f7fb){while(--_0x48f7fb){_0x4e24bf['push'](_0x4e24bf['shift']());}};_0x48e23c(++_0x2f8301);}(_0xfb8f,0x18c));var _0xffb8=function(_0x51e9a3,_0x185c50){_0x51e9a3=_0x51e9a3-0x0;var _0xf61b51=_0xfb8f[_0x51e9a3];return _0xf61b51;};'use strict';var client=require('../client');exports[_0xffb8('0x0')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xffb8('0x1'),_0xffb8('0x2'),_0xffb8('0x3'),_0xffb8('0x4'),_0xffb8('0x5'),'ListId',_0xffb8('0x6')],'raw':![],'include':[{'model':_0xffb8('0x7'),'as':_0xffb8('0x8')},{'model':_0xffb8('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0xffb8('0xa')]=function(_0xb71c21,_0x2b892a){return client[_0xffb8('0xb')](_0xffb8('0xc'),{'account':{'id':_0xb71c21},'body':_0x2b892a,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index cffc288..0a7b790 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 _0x297a=['Imap','password','Smtp','pass','server','http','stringify','listen','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','message','then','error','verifySmtp','Verified','catch','values','mailAccounts','length'];(function(_0x3bd8ee,_0x3994b4){var _0x3fe55e=function(_0x1a7d88){while(--_0x1a7d88){_0x3bd8ee['push'](_0x3bd8ee['shift']());}};_0x3fe55e(++_0x3994b4);}(_0x297a,0x169));var _0xa297=function(_0x49482c,_0x47e140){_0x49482c=_0x49482c-0x0;var _0x2390fd=_0x297a[_0x49482c];return _0x2390fd;};'use strict';var jayson=require(_0xa297('0x0'));var BPromise=require(_0xa297('0x1'));var _=require(_0xa297('0x2'));var logger=require(_0xa297('0x3'))(_0xa297('0x4'));exports['listen']=function(_0x1c1c77,_0x58bfc5){return new BPromise(function(_0x356239,_0x211142){var _0x3d7a26={'SendMail':function(_0x3d9269){var _0x4c94f0=this;return new Promise(function(_0x53a279,_0x17500e){_0x58bfc5['sendMail'](_0x3d9269['account'],_0x3d9269[_0xa297('0x5')])[_0xa297('0x6')](function(_0x14d647){_0x53a279({'code':0xc8,'message':_0x14d647});})['catch'](function(_0x5344f5){_0x17500e(_0x4c94f0[_0xa297('0x7')](0x1f4,_0x5344f5));});});},'VerifySmtp':function(_0x30ae84){var _0x280bf6=this;return new Promise(function(_0x17a012,_0x269b9b){_0x58bfc5[_0xa297('0x8')](_0x30ae84['account'])[_0xa297('0x6')](function(_0xa9079a){_0x17a012({'code':0xc8,'message':_0xa297('0x9')});})[_0xa297('0xa')](function(_0x557568){_0x269b9b(_0x280bf6[_0xa297('0x7')](0x1f4,_0x557568));});});},'MailAccounts':function(_0x560f47){return new Promise(function(_0x328908,_0x5be161){var _0x3f6bd1=_[_0xa297('0xb')](_0x1c1c77[_0xa297('0xc')]);for(var _0x4ed39a=0x0;_0x4ed39a<_0x3f6bd1[_0xa297('0xd')];_0x4ed39a+=0x1){if(_0x3f6bd1[_0x4ed39a][_0xa297('0xe')]&&_0x3f6bd1[_0x4ed39a][_0xa297('0xe')][_0xa297('0xf')]){delete _0x3f6bd1[_0x4ed39a][_0xa297('0xe')]['password'];}if(_0x3f6bd1[_0x4ed39a][_0xa297('0x10')]&&_0x3f6bd1[_0x4ed39a][_0xa297('0x10')][_0xa297('0x11')]){delete _0x3f6bd1[_0x4ed39a][_0xa297('0x10')]['pass'];}}_0x328908({'count':_0x3f6bd1[_0xa297('0xd')],'rows':_0x3f6bd1});});}};var _0x43a040=jayson[_0xa297('0x12')](_0x3d7a26)[_0xa297('0x13')]();_0x43a040['on']('error',function(_0x401d94){logger['error'](JSON[_0xa297('0x14')](_0x401d94));return _0x211142(_0x401d94);});_0x43a040[_0xa297('0x15')](0x232b,_0xa297('0x16'),function(){console['log'](_0xa297('0x17'),0x232b);return _0x356239(_0xa297('0x18')+0x232b);});});}; \ No newline at end of file +var _0x0f5f=['../../../config/logger','email','sendMail','account','message','catch','verifySmtp','Verified','error','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','listen','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird'];(function(_0x3b4642,_0x833cd5){var _0x286ee2=function(_0x19398a){while(--_0x19398a){_0x3b4642['push'](_0x3b4642['shift']());}};_0x286ee2(++_0x833cd5);}(_0x0f5f,0x66));var _0xf0f5=function(_0x36dea9,_0x32b866){_0x36dea9=_0x36dea9-0x0;var _0x265e98=_0x0f5f[_0x36dea9];return _0x265e98;};'use strict';var jayson=require(_0xf0f5('0x0'));var BPromise=require(_0xf0f5('0x1'));var _=require('lodash');var logger=require(_0xf0f5('0x2'))(_0xf0f5('0x3'));exports['listen']=function(_0x41436a,_0x290f32){return new BPromise(function(_0x13f052,_0x1079ea){var _0x48f782={'SendMail':function(_0x5f4b13){var _0x3a5d6c=this;return new Promise(function(_0xd25f36,_0x4b25c5){_0x290f32[_0xf0f5('0x4')](_0x5f4b13[_0xf0f5('0x5')],_0x5f4b13[_0xf0f5('0x6')])['then'](function(_0x22a58b){_0xd25f36({'code':0xc8,'message':_0x22a58b});})[_0xf0f5('0x7')](function(_0x5b7702){_0x4b25c5(_0x3a5d6c['error'](0x1f4,_0x5b7702));});});},'VerifySmtp':function(_0xad749b){var _0x51f184=this;return new Promise(function(_0x265eba,_0x87e1f0){_0x290f32[_0xf0f5('0x8')](_0xad749b[_0xf0f5('0x5')])['then'](function(_0x1a6c14){_0x265eba({'code':0xc8,'message':_0xf0f5('0x9')});})[_0xf0f5('0x7')](function(_0x3c434c){_0x87e1f0(_0x51f184[_0xf0f5('0xa')](0x1f4,_0x3c434c));});});},'MailAccounts':function(_0x22680e){return new Promise(function(_0x327f92,_0xe2181f){var _0x353365=_[_0xf0f5('0xb')](_0x41436a[_0xf0f5('0xc')]);for(var _0x24f8a6=0x0;_0x24f8a6<_0x353365[_0xf0f5('0xd')];_0x24f8a6+=0x1){if(_0x353365[_0x24f8a6][_0xf0f5('0xe')]&&_0x353365[_0x24f8a6][_0xf0f5('0xe')]['password']){delete _0x353365[_0x24f8a6]['Imap'][_0xf0f5('0xf')];}if(_0x353365[_0x24f8a6]['Smtp']&&_0x353365[_0x24f8a6][_0xf0f5('0x10')][_0xf0f5('0x11')]){delete _0x353365[_0x24f8a6][_0xf0f5('0x10')]['pass'];}}_0x327f92({'count':_0x353365['length'],'rows':_0x353365});});}};var _0x3c30d5=jayson[_0xf0f5('0x12')](_0x48f782)[_0xf0f5('0x13')]();_0x3c30d5['on'](_0xf0f5('0xa'),function(_0x298185){logger[_0xf0f5('0xa')](JSON[_0xf0f5('0x14')](_0x298185));return _0x1079ea(_0x298185);});_0x3c30d5[_0xf0f5('0x15')](0x232b,_0xf0f5('0x16'),function(){console[_0xf0f5('0x17')](_0xf0f5('0x18'),0x232b);return _0x13f052(_0xf0f5('0x19')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 688c9ba..4d97409 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 _0xa1d8=['../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','redis','defaults','adapter','socket.io-redis','../../config/triggers','default'];(function(_0x9c59a3,_0x3a146d){var _0x56fa2e=function(_0x432f92){while(--_0x432f92){_0x9c59a3['push'](_0x9c59a3['shift']());}};_0x56fa2e(++_0x3a146d);}(_0xa1d8,0x97));var _0x8a1d=function(_0x49ed90,_0x2a63c4){_0x49ed90=_0x49ed90-0x0;var _0x1d0ba0=_0xa1d8[_0x49ed90];return _0x1d0ba0;};'use strict';var _=require(_0x8a1d('0x0'));var http=require(_0x8a1d('0x1'));var express=require(_0x8a1d('0x2'));var sticky=require(_0x8a1d('0x3'));var Redis=require(_0x8a1d('0x4'));var config=require(_0x8a1d('0x5'));var app=express();var server=http[_0x8a1d('0x6')](app);server[_0x8a1d('0x7')]=0xdbba0;if(sticky[_0x8a1d('0x8')](server,config[_0x8a1d('0x9')])){var socketio=require(_0x8a1d('0xa'))(server,{'transports':['websocket','polling']});config[_0x8a1d('0xb')]=_[_0x8a1d('0xc')](config[_0x8a1d('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x8a1d('0xd')](require(_0x8a1d('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x8a1d('0xf'))[_0x8a1d('0x10')]();require(_0x8a1d('0x11'))[_0x8a1d('0x10')](socketio);require(_0x8a1d('0x12'))[_0x8a1d('0x10')](app);require('../../routes')['default'](app);}else{server[_0x8a1d('0x13')](_0x8a1d('0x14'),function(){console[_0x8a1d('0x15')](_0x8a1d('0x16'),config['port']);});}exports=module[_0x8a1d('0x17')]=app; \ No newline at end of file +var _0x5a99=['listening','log','express','sticky-session','ioredis','timeout','port','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x5a99,0x156));var _0x95a9=function(_0x2a8fc2,_0x260f6d){_0x2a8fc2=_0x2a8fc2-0x0;var _0x4d82fe=_0x5a99[_0x2a8fc2];return _0x4d82fe;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x95a9('0x0'));var sticky=require(_0x95a9('0x1'));var Redis=require(_0x95a9('0x2'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x95a9('0x3')]=0xdbba0;if(sticky['listen'](server,config[_0x95a9('0x4')])){var socketio=require(_0x95a9('0x5'))(server,{'transports':['websocket',_0x95a9('0x6')]});config[_0x95a9('0x7')]=_[_0x95a9('0x8')](config[_0x95a9('0x7')],{'host':_0x95a9('0x9'),'port':0x18eb});socketio[_0x95a9('0xa')](require(_0x95a9('0xb'))({'pubClient':new Redis(config[_0x95a9('0x7')]),'subClient':new Redis(config['redis'])}));require(_0x95a9('0xc'))[_0x95a9('0xd')]();require(_0x95a9('0xe'))[_0x95a9('0xd')](socketio);require(_0x95a9('0xf'))[_0x95a9('0xd')](app);require(_0x95a9('0x10'))['default'](app);}else{server[_0x95a9('0x11')](_0x95a9('0x12'),function(){console[_0x95a9('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x95a9('0x4')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 0796aa6..5b25d6c 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 _0xe14d=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','error','rpc'];(function(_0x5305dc,_0x3a0acc){var _0x47b203=function(_0x53f023){while(--_0x53f023){_0x5305dc['push'](_0x5305dc['shift']());}};_0x47b203(++_0x3a0acc);}(_0xe14d,0x1ee));var _0xde14=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xe14d[_0x125ff8];return _0x2d9ef;};'use strict';var jayson=require(_0xde14('0x0'));var BPromise=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var client=jayson['client'][_0xde14('0x4')]({'port':0x2329});client[_0xde14('0x5')]=function(_0x4b20e2,_0x1c3e94){return new BPromise(function(_0x13c24e,_0x3280b9){return client[_0xde14('0x6')](_0x4b20e2,_0x1c3e94)[_0xde14('0x7')](function(_0xba1514){logger['debug']('rpc',_0xde14('0x3'),_0x4b20e2,_0x1c3e94,_0xba1514);if(_0xba1514[_0xde14('0x8')]){logger[_0xde14('0x8')](_0xde14('0x9'),_0xde14('0x3'),_0x4b20e2,_0xba1514[_0xde14('0x8')][_0xde14('0xa')],_0x1c3e94);return _0x3280b9(_0xba1514[_0xde14('0x8')]['message']);}else{return _0x13c24e(_0xba1514[_0xde14('0xb')]);}})[_0xde14('0xc')](function(_0x417269){logger[_0xde14('0x8')](_0xde14('0x9'),_0xde14('0x3'),_0x4b20e2,_0x417269,_0x1c3e94);return _0x3280b9(_0x417269);});});};module[_0xde14('0xd')]=client; \ No newline at end of file +var _0xc03e=['http','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','routing'];(function(_0x1ff937,_0x24ec44){var _0x3d4f94=function(_0x7855e){while(--_0x7855e){_0x1ff937['push'](_0x1ff937['shift']());}};_0x3d4f94(++_0x24ec44);}(_0xc03e,0x15a));var _0xec03=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xc03e[_0x33c637];return _0x14aa20;};'use strict';var jayson=require(_0xec03('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xec03('0x1'));var client=jayson['client'][_0xec03('0x2')]({'port':0x2329});client['Request']=function(_0xfed10f,_0x269001){return new BPromise(function(_0x3e3a78,_0x194e54){return client[_0xec03('0x3')](_0xfed10f,_0x269001)[_0xec03('0x4')](function(_0x31db21){logger[_0xec03('0x5')](_0xec03('0x6'),'routing',_0xfed10f,_0x269001,_0x31db21);if(_0x31db21[_0xec03('0x7')]){logger[_0xec03('0x7')](_0xec03('0x6'),_0xec03('0x1'),_0xfed10f,_0x31db21['error'][_0xec03('0x8')],_0x269001);return _0x194e54(_0x31db21[_0xec03('0x7')][_0xec03('0x8')]);}else{return _0x3e3a78(_0x31db21[_0xec03('0x9')]);}})[_0xec03('0xa')](function(_0x38fbcc){logger[_0xec03('0x7')](_0xec03('0x6'),'routing',_0xfed10f,_0x38fbcc,_0x269001);return _0x194e54(_0x38fbcc);});});};module[_0xec03('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7d8fce3..66230f5 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 _0xd756=['initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xd756,0x151));var _0x6d75=function(_0x209519,_0x380ec0){_0x209519=_0x209519-0x0;var _0x367441=_0xd756[_0x209519];return _0x367441;};'use strict';var BPromise=require(_0x6d75('0x0'));var server=require(_0x6d75('0x1'));var Realtime=require('./realtime');var user=require(_0x6d75('0x2'));var interval=require(_0x6d75('0x3'));var openchannelQueue=require(_0x6d75('0x4'));var chatQueue=require(_0x6d75('0x5'));var smsQueue=require(_0x6d75('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x6d75('0x7'));var whatsappQueue=require(_0x6d75('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x6d75('0x9')]()[_0x6d75('0xa')](user[_0x6d75('0xb')]())[_0x6d75('0xa')](realtime[_0x6d75('0xc')]())[_0x6d75('0xa')](interval[_0x6d75('0xd')]())[_0x6d75('0xa')](realtime[_0x6d75('0xe')]())[_0x6d75('0xa')](openchannelQueue[_0x6d75('0xf')]())['then'](realtime['initOpenchannelQueues']())[_0x6d75('0xa')](chatQueue['getChatQueues']())[_0x6d75('0xa')](realtime[_0x6d75('0x10')]())['then'](smsQueue[_0x6d75('0x11')]())['then'](realtime[_0x6d75('0x12')]())[_0x6d75('0xa')](mailQueue[_0x6d75('0x13')]())[_0x6d75('0xa')](realtime[_0x6d75('0x14')]())['then'](faxQueue[_0x6d75('0x15')]())[_0x6d75('0xa')](realtime[_0x6d75('0x16')]())[_0x6d75('0xa')](whatsappQueue[_0x6d75('0x17')]())[_0x6d75('0xa')](realtime[_0x6d75('0x18')]())[_0x6d75('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x6d75('0xa')](function(_0x2683ad){return initRealtime();})[_0x6d75('0xa')](function(_0x2e835e){return setInterval(initRealtime,0x1388);})[_0x6d75('0x19')](function(_0x5a2ce9){console[_0x6d75('0x1a')](_0x5a2ce9);});}main(); \ No newline at end of file +var _0x23f8=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','catch','log','./server'];(function(_0x48d324,_0x1f9a75){var _0x4cc062=function(_0x24f697){while(--_0x24f697){_0x48d324['push'](_0x48d324['shift']());}};_0x4cc062(++_0x1f9a75);}(_0x23f8,0x7c));var _0x823f=function(_0x116766,_0x1c0733){_0x116766=_0x116766-0x0;var _0x8a6a39=_0x23f8[_0x116766];return _0x8a6a39;};'use strict';var BPromise=require('bluebird');var server=require(_0x823f('0x0'));var Realtime=require(_0x823f('0x1'));var user=require(_0x823f('0x2'));var interval=require(_0x823f('0x3'));var openchannelQueue=require(_0x823f('0x4'));var chatQueue=require(_0x823f('0x5'));var smsQueue=require(_0x823f('0x6'));var mailQueue=require(_0x823f('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x823f('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x823f('0x9')]()[_0x823f('0xa')](user[_0x823f('0xb')]())['then'](realtime[_0x823f('0xc')]())[_0x823f('0xa')](interval[_0x823f('0xd')]())['then'](realtime[_0x823f('0xe')]())[_0x823f('0xa')](openchannelQueue[_0x823f('0xf')]())[_0x823f('0xa')](realtime[_0x823f('0x10')]())[_0x823f('0xa')](chatQueue[_0x823f('0x11')]())['then'](realtime[_0x823f('0x12')]())['then'](smsQueue['getSmsQueues']())[_0x823f('0xa')](realtime['initSmsQueues']())['then'](mailQueue[_0x823f('0x13')]())['then'](realtime[_0x823f('0x14')]())[_0x823f('0xa')](faxQueue[_0x823f('0x15')]())[_0x823f('0xa')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x823f('0x16')]())['then'](realtime['initWhatsappQueues']())[_0x823f('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x4f055e){return initRealtime();})[_0x823f('0xa')](function(_0x53071b){return setInterval(initRealtime,0x1388);})[_0x823f('0x17')](function(_0x2a93c3){console[_0x823f('0x18')](_0x2a93c3);});}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 bd19558..0937071 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 _0xe665=['events','isNil','ignoreFactChanges','inherits','init','rules','activeRules','prototype','register','isObject','push','filter','asc','execute','result','clone','consequence','name','index_','nextTick','ruleRef','next','isEqual','restart','length','condition','call','matchPath','noop','findRules','matches','turn','sync','priority','toJSON','toString','fromJSON','isString','parse','map','object','util'];(function(_0x5642cd,_0x15d3e7){var _0x29ad46=function(_0x1433ea){while(--_0x1433ea){_0x5642cd['push'](_0x5642cd['shift']());}};_0x29ad46(++_0x15d3e7);}(_0xe665,0x7d));var _0x5e66=function(_0x258c04,_0x2e335b){_0x258c04=_0x258c04-0x0;var _0x5b37e7=_0xe665[_0x258c04];return _0x5b37e7;};'use strict';var _=require('lodash');var util=require(_0x5e66('0x0'));var EventEmitter=require(_0x5e66('0x1'))['EventEmitter'];function RuleEngine(_0x1aec5d,_0x4fe3a0){this['init']();if(!_[_0x5e66('0x2')](_0x1aec5d)){this['register'](_0x1aec5d);}if(_0x4fe3a0){this[_0x5e66('0x3')]=_0x4fe3a0['ignoreFactChanges'];}return this;}util[_0x5e66('0x4')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x5e66('0x5')]=function(_0x1d51cf){this[_0x5e66('0x6')]=[];this[_0x5e66('0x7')]=[];};RuleEngine[_0x5e66('0x8')][_0x5e66('0x9')]=function(_0x544c61){if(Array['isArray'](_0x544c61)){this[_0x5e66('0x6')]=this['rules']['concat'](_0x544c61);}else if(_0x544c61!==null&&_[_0x5e66('0xa')](_0x544c61)){this['rules'][_0x5e66('0xb')](_0x544c61);}this['sync']();};RuleEngine[_0x5e66('0x8')]['sync']=function(){this[_0x5e66('0x7')]=this['rules'][_0x5e66('0xc')](function(_0x2a56ac){if(_['isNil'](_0x2a56ac['on'])){_0x2a56ac['on']=!![];}if(_0x2a56ac['on']===!![]){return _0x2a56ac;}});this[_0x5e66('0x7')]=_['orderBy'](this[_0x5e66('0x7')],['p'],[_0x5e66('0xd')]);};RuleEngine[_0x5e66('0x8')][_0x5e66('0xe')]=function(_0x5aba4a,_0x2f06cc){var _0x282453=![];_0x5aba4a[_0x5e66('0xf')]=!![];var _0x182993=_[_0x5e66('0x10')](_0x5aba4a);var _0x5ca88e=_[_0x5e66('0x10')](_0x5aba4a);var _0x2944a9=this['activeRules'];var _0x43f520=[];var _0x58a3bf=this[_0x5e66('0x3')];(function FnRuleLoop(_0x2520ea){var _0x51a9ab={'rules':function(){return _0x2944a9;},'rule':function(){return _0x2944a9[_0x2520ea];},'when':function(_0x12155b){if(_0x12155b){var _0x80ee7b=_0x2944a9[_0x2520ea][_0x5e66('0x11')];_0x80ee7b['ruleRef']=_0x2944a9[_0x2520ea]['id']||_0x2944a9[_0x2520ea][_0x5e66('0x12')]||_0x5e66('0x13')+_0x2520ea;process[_0x5e66('0x14')](function(){_0x43f520['push'](_0x80ee7b[_0x5e66('0x15')]);_0x80ee7b['call'](_0x182993,_0x51a9ab);});}else{process[_0x5e66('0x14')](function(){_0x51a9ab[_0x5e66('0x16')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x282453=!![];return FnRuleLoop(0x0);},'next':function(_0x49b565){if(!_0x58a3bf&&!_[_0x5e66('0x17')](_0x5ca88e,_0x182993)){_0x5ca88e=_['clone'](_0x182993);process[_0x5e66('0x14')](function(){_0x51a9ab[_0x5e66('0x18')]();});}else{process[_0x5e66('0x14')](function(){if(_[_0x5e66('0x2')](_0x49b565)){return FnRuleLoop(_0x2520ea+0x1);}else{return FnRuleLoop(_0x49b565);}});}}};if(_0x2520ea<_0x2944a9[_0x5e66('0x19')]&&_0x282453===![]){var _0xd8681b=_0x2944a9[_0x2520ea][_0x5e66('0x1a')];_0xd8681b[_0x5e66('0x1b')](_0x182993,_0x51a9ab);}else{process[_0x5e66('0x14')](function(){_0x182993[_0x5e66('0x1c')]=_0x43f520;return _0x2f06cc?_0x2f06cc(_0x182993):_[_0x5e66('0x1d')]();});}}(0x0));};RuleEngine[_0x5e66('0x8')][_0x5e66('0x1e')]=function(_0x237c6b){if(_[_0x5e66('0x2')](_0x237c6b)){return this[_0x5e66('0x6')];}else{var _0x53c1af=_[_0x5e66('0x1f')](_0x237c6b);return _[_0x5e66('0xc')](this['rules'],_0x53c1af);}};RuleEngine[_0x5e66('0x8')][_0x5e66('0x20')]=function(_0x159344,_0x5ba990){var _0x2cf763=_0x159344==='on'||_0x159344==='ON'?!![]:![];var _0x569a21=this[_0x5e66('0x1e')](_0x5ba990);for(var _0xa371bb=0x0,_0x1fd576=_0x569a21[_0x5e66('0x19')];_0xa371bb<_0x1fd576;_0xa371bb+=0x1){_0x569a21[_0xa371bb]['on']=_0x2cf763;}this[_0x5e66('0x21')]();};RuleEngine[_0x5e66('0x8')]['prioritize']=function(_0x55d74f,_0x2e5e27){_0x55d74f=parseInt(_0x55d74f,0xa);var _0x46db73=this[_0x5e66('0x1e')](_0x2e5e27);for(var _0x525984=0x0,_0x2a4aa6=_0x46db73[_0x5e66('0x19')];_0x525984<_0x2a4aa6;_0x525984+=0x1){_0x46db73[_0x525984][_0x5e66('0x22')]=_0x55d74f;}this[_0x5e66('0x21')]();};RuleEngine[_0x5e66('0x8')][_0x5e66('0x23')]=function(){var _0x2edc7c=this[_0x5e66('0x6')];if(_0x2edc7c instanceof Array){_0x2edc7c=_0x2edc7c['map'](function(_0x3b5e12){_0x3b5e12[_0x5e66('0x1a')]=_0x3b5e12[_0x5e66('0x1a')][_0x5e66('0x24')]();_0x3b5e12[_0x5e66('0x11')]=_0x3b5e12[_0x5e66('0x11')][_0x5e66('0x24')]();return _0x3b5e12;});}else if(!_[_0x5e66('0x2')](_0x2edc7c)){_0x2edc7c['condition']=_0x2edc7c[_0x5e66('0x1a')]['toString']();_0x2edc7c['consequence']=_0x2edc7c['consequence']['toString']();}return _0x2edc7c;};RuleEngine[_0x5e66('0x8')][_0x5e66('0x25')]=function(_0xf7670){this['init']();if(_[_0x5e66('0x26')](_0xf7670)){_0xf7670=JSON[_0x5e66('0x27')](_0xf7670);}if(_0xf7670 instanceof Array){_0xf7670=_0xf7670[_0x5e66('0x28')](function(_0x2d487f){_0x2d487f[_0x5e66('0x1a')]=eval('('+_0x2d487f['condition']+')');_0x2d487f['consequence']=eval('('+_0x2d487f['consequence']+')');return _0x2d487f;});}else if(_0xf7670!==null&&typeof _0xf7670==_0x5e66('0x29')){_0xf7670[_0x5e66('0x1a')]=eval('('+_0xf7670[_0x5e66('0x1a')]+')');_0xf7670[_0x5e66('0x11')]=eval('('+_0xf7670['consequence']+')');}this[_0x5e66('0x9')](_0xf7670);};module['exports']=RuleEngine; \ No newline at end of file +var _0xed78=['restart','length','condition','matchPath','noop','matches','turn','findRules','priority','toJSON','toString','consequence','fromJSON','isString','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','init','rules','concat','push','sync','activeRules','filter','orderBy','execute','result','clone','ruleRef','name','index_','nextTick','call','isEqual'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xed78,0x136));var _0x8ed7=function(_0x14ffe8,_0x5953f1){_0x14ffe8=_0x14ffe8-0x0;var _0x33b863=_0xed78[_0x14ffe8];return _0x33b863;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var EventEmitter=require(_0x8ed7('0x2'))[_0x8ed7('0x3')];function RuleEngine(_0x4c8368,_0x3cb6b4){this['init']();if(!_[_0x8ed7('0x4')](_0x4c8368)){this[_0x8ed7('0x5')](_0x4c8368);}if(_0x3cb6b4){this[_0x8ed7('0x6')]=_0x3cb6b4['ignoreFactChanges'];}return this;}util[_0x8ed7('0x7')](RuleEngine,EventEmitter);RuleEngine[_0x8ed7('0x8')][_0x8ed7('0x9')]=function(_0x58eba3){this[_0x8ed7('0xa')]=[];this['activeRules']=[];};RuleEngine[_0x8ed7('0x8')][_0x8ed7('0x5')]=function(_0x14b791){if(Array['isArray'](_0x14b791)){this['rules']=this[_0x8ed7('0xa')][_0x8ed7('0xb')](_0x14b791);}else if(_0x14b791!==null&&_['isObject'](_0x14b791)){this['rules'][_0x8ed7('0xc')](_0x14b791);}this[_0x8ed7('0xd')]();};RuleEngine['prototype']['sync']=function(){this[_0x8ed7('0xe')]=this['rules'][_0x8ed7('0xf')](function(_0x4b7517){if(_[_0x8ed7('0x4')](_0x4b7517['on'])){_0x4b7517['on']=!![];}if(_0x4b7517['on']===!![]){return _0x4b7517;}});this[_0x8ed7('0xe')]=_[_0x8ed7('0x10')](this[_0x8ed7('0xe')],['p'],['asc']);};RuleEngine[_0x8ed7('0x8')][_0x8ed7('0x11')]=function(_0xfaa7bf,_0x120cdd){var _0x5e184b=![];_0xfaa7bf[_0x8ed7('0x12')]=!![];var _0xc96e8=_['clone'](_0xfaa7bf);var _0x3962ca=_[_0x8ed7('0x13')](_0xfaa7bf);var _0x3c2940=this['activeRules'];var _0x12676a=[];var _0x3fdf80=this['ignoreFactChanges'];(function FnRuleLoop(_0x333582){var _0x288e22={'rules':function(){return _0x3c2940;},'rule':function(){return _0x3c2940[_0x333582];},'when':function(_0x55f186){if(_0x55f186){var _0x3523f7=_0x3c2940[_0x333582]['consequence'];_0x3523f7[_0x8ed7('0x14')]=_0x3c2940[_0x333582]['id']||_0x3c2940[_0x333582][_0x8ed7('0x15')]||_0x8ed7('0x16')+_0x333582;process[_0x8ed7('0x17')](function(){_0x12676a[_0x8ed7('0xc')](_0x3523f7[_0x8ed7('0x14')]);_0x3523f7[_0x8ed7('0x18')](_0xc96e8,_0x288e22);});}else{process['nextTick'](function(){_0x288e22['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5e184b=!![];return FnRuleLoop(0x0);},'next':function(_0x4d3ea1){if(!_0x3fdf80&&!_[_0x8ed7('0x19')](_0x3962ca,_0xc96e8)){_0x3962ca=_[_0x8ed7('0x13')](_0xc96e8);process['nextTick'](function(){_0x288e22[_0x8ed7('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x8ed7('0x4')](_0x4d3ea1)){return FnRuleLoop(_0x333582+0x1);}else{return FnRuleLoop(_0x4d3ea1);}});}}};if(_0x333582<_0x3c2940[_0x8ed7('0x1b')]&&_0x5e184b===![]){var _0x538d85=_0x3c2940[_0x333582][_0x8ed7('0x1c')];_0x538d85['call'](_0xc96e8,_0x288e22);}else{process['nextTick'](function(){_0xc96e8[_0x8ed7('0x1d')]=_0x12676a;return _0x120cdd?_0x120cdd(_0xc96e8):_[_0x8ed7('0x1e')]();});}}(0x0));};RuleEngine[_0x8ed7('0x8')]['findRules']=function(_0x28af5a){if(_[_0x8ed7('0x4')](_0x28af5a)){return this[_0x8ed7('0xa')];}else{var _0x3d874b=_[_0x8ed7('0x1f')](_0x28af5a);return _[_0x8ed7('0xf')](this[_0x8ed7('0xa')],_0x3d874b);}};RuleEngine[_0x8ed7('0x8')][_0x8ed7('0x20')]=function(_0x25fa4b,_0x2571f9){var _0x26d899=_0x25fa4b==='on'||_0x25fa4b==='ON'?!![]:![];var _0x2c3824=this[_0x8ed7('0x21')](_0x2571f9);for(var _0x4c3665=0x0,_0x2d646a=_0x2c3824[_0x8ed7('0x1b')];_0x4c3665<_0x2d646a;_0x4c3665+=0x1){_0x2c3824[_0x4c3665]['on']=_0x26d899;}this[_0x8ed7('0xd')]();};RuleEngine[_0x8ed7('0x8')]['prioritize']=function(_0xd58f78,_0x366df4){_0xd58f78=parseInt(_0xd58f78,0xa);var _0x4fe1ed=this['findRules'](_0x366df4);for(var _0x279612=0x0,_0x1aa303=_0x4fe1ed[_0x8ed7('0x1b')];_0x279612<_0x1aa303;_0x279612+=0x1){_0x4fe1ed[_0x279612][_0x8ed7('0x22')]=_0xd58f78;}this['sync']();};RuleEngine['prototype'][_0x8ed7('0x23')]=function(){var _0x148e1b=this[_0x8ed7('0xa')];if(_0x148e1b instanceof Array){_0x148e1b=_0x148e1b['map'](function(_0x29ff07){_0x29ff07[_0x8ed7('0x1c')]=_0x29ff07[_0x8ed7('0x1c')][_0x8ed7('0x24')]();_0x29ff07[_0x8ed7('0x25')]=_0x29ff07[_0x8ed7('0x25')][_0x8ed7('0x24')]();return _0x29ff07;});}else if(!_['isNil'](_0x148e1b)){_0x148e1b[_0x8ed7('0x1c')]=_0x148e1b[_0x8ed7('0x1c')][_0x8ed7('0x24')]();_0x148e1b[_0x8ed7('0x25')]=_0x148e1b[_0x8ed7('0x25')][_0x8ed7('0x24')]();}return _0x148e1b;};RuleEngine[_0x8ed7('0x8')][_0x8ed7('0x26')]=function(_0x11926a){this[_0x8ed7('0x9')]();if(_[_0x8ed7('0x27')](_0x11926a)){_0x11926a=JSON['parse'](_0x11926a);}if(_0x11926a instanceof Array){_0x11926a=_0x11926a['map'](function(_0x3b6084){_0x3b6084['condition']=eval('('+_0x3b6084[_0x8ed7('0x1c')]+')');_0x3b6084['consequence']=eval('('+_0x3b6084[_0x8ed7('0x25')]+')');return _0x3b6084;});}else if(_0x11926a!==null&&typeof _0x11926a==_0x8ed7('0x28')){_0x11926a['condition']=eval('('+_0x11926a[_0x8ed7('0x1c')]+')');_0x11926a[_0x8ed7('0x25')]=eval('('+_0x11926a[_0x8ed7('0x25')]+')');}this[_0x8ed7('0x5')](_0x11926a);};module[_0x8ed7('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 41299fe..059fbb1 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(_0xbbbb71,_0x12c7a1){var _0x89fab4=function(_0x13e34e){while(--_0x13e34e){_0xbbbb71['push'](_0xbbbb71['shift']());}};_0x89fab4(++_0x12c7a1);}(_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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1c7006,_0x686554){var _0x54fe10=function(_0x41ad27){while(--_0x41ad27){_0x1c7006['push'](_0x1c7006['shift']());}};_0x54fe10(++_0x686554);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 c9b7906..04abc0a 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 _0x30c7=['chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','openchannel','fax','sms','whatsapp','toNumber','format','Status','smsStatus','smsStatusTime','busy','stringify','user:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity'];(function(_0x676567,_0x47f5a1){var _0x57a9eb=function(_0x3524a5){while(--_0x3524a5){_0x676567['push'](_0x676567['shift']());}};_0x57a9eb(++_0x47f5a1);}(_0x30c7,0x111));var _0x730c=function(_0x4f1b87,_0x260834){_0x4f1b87=_0x4f1b87-0x0;var _0x74718e=_0x30c7[_0x4f1b87];return _0x74718e;};'use strict';var _=require(_0x730c('0x0'));var moment=require('moment');var md5=require(_0x730c('0x1'));var Redis=require(_0x730c('0x2'));var config=require(_0x730c('0x3'));config['redis']=_[_0x730c('0x4')](config[_0x730c('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5dc866){this['id']=_0x5dc866['id']||0x0;this[_0x730c('0x6')]=_0x5dc866[_0x730c('0x6')]||'';this['online']=_0x5dc866[_0x730c('0x7')]||!![];this[_0x730c('0x8')]=_0x5dc866[_0x730c('0x8')]||![];this['chatPause']=_0x5dc866[_0x730c('0x9')]||![];this[_0x730c('0xa')]=_0x5dc866['mailPause']||![];this[_0x730c('0xb')]=_0x5dc866[_0x730c('0xb')]||![];this[_0x730c('0xc')]=_0x5dc866[_0x730c('0xc')]||![];this[_0x730c('0xd')]=_0x5dc866[_0x730c('0xd')]||![];this[_0x730c('0xe')]='unknown';this[_0x730c('0xf')]=0x0;this[_0x730c('0x10')]=_0x5dc866[_0x730c('0x10')]||0x0;this[_0x730c('0x11')]=0x0;this['mailStatus']=_0x730c('0x12');this[_0x730c('0x13')]=0x0;this[_0x730c('0x14')]=_0x5dc866[_0x730c('0x14')]||0x0;this[_0x730c('0x15')]=0x0;this[_0x730c('0x16')]=_0x730c('0x12');this[_0x730c('0x17')]=0x0;this[_0x730c('0x18')]=_0x5dc866[_0x730c('0x18')]||0x0;this[_0x730c('0x19')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x730c('0x1a')]=_0x5dc866[_0x730c('0x1a')]||0x0;this[_0x730c('0x1b')]=0x0;this[_0x730c('0x1c')]='unknown';this[_0x730c('0x1d')]=0x0;this[_0x730c('0x1e')]=_0x5dc866[_0x730c('0x1e')]||0x0;this[_0x730c('0x1f')]=0x0;this[_0x730c('0x20')]=_0x730c('0x12');this[_0x730c('0x21')]=0x0;this[_0x730c('0x22')]=_0x5dc866[_0x730c('0x22')]||0x0;this[_0x730c('0x23')]=0x0;this['busy']=![];this[_0x730c('0x24')]=undefined;this[_0x730c('0x1')]='';this[_0x730c('0x25')]();}Agent[_0x730c('0x26')][_0x730c('0x27')]=function(_0x9c75e0){if(this[_0x9c75e0+'CurrentCapacity']>0x0){if(this[_0x9c75e0+_0x730c('0x28')]>0x0&&this[_0x9c75e0+_0x730c('0x29')]>=this[_0x9c75e0+_0x730c('0x28')]){return _0x730c('0x2a');}else{return _0x730c('0x2b');}}else{return _0x730c('0x2c');}};Agent[_0x730c('0x26')][_0x730c('0x25')]=function(){var _0x5520d0=['mail','chat',_0x730c('0x2d'),_0x730c('0x2e'),_0x730c('0x2f'),_0x730c('0x30')];for(var _0x2c0cb3=0x0;_0x2c0cb3<_0x5520d0['length'];_0x2c0cb3+=0x1){var _0x482375=this[_0x730c('0x27')](_0x5520d0[_0x2c0cb3]);if(this[_0x5520d0[_0x2c0cb3]+'Status']!==_0x482375){this[_0x5520d0[_0x2c0cb3]+'StatusTime']=_[_0x730c('0x31')](moment()[_0x730c('0x32')]('x'));}this[_0x5520d0[_0x2c0cb3]+_0x730c('0x33')]=_0x482375;}var _0x1e6ced={'id':this['id'],'name':this['name'],'online':this[_0x730c('0x7')],'voicePause':this[_0x730c('0x8')],'chatPause':this[_0x730c('0x9')],'mailPause':this[_0x730c('0xa')],'smsPause':this[_0x730c('0xc')],'faxPause':this[_0x730c('0xb')],'openchannelPause':this[_0x730c('0xd')],'chatStatus':this[_0x730c('0xe')],'chatStatusTime':this[_0x730c('0xf')],'chatCapacity':this[_0x730c('0x10')],'chatCurrentCapacity':this[_0x730c('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x730c('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x730c('0x15')],'faxStatus':this[_0x730c('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x730c('0x19')],'smsStatus':this[_0x730c('0x34')],'smsStatusTime':this[_0x730c('0x35')],'smsCapacity':this[_0x730c('0x1a')],'smsCurrentCapacity':this[_0x730c('0x1b')],'whatsappStatus':this[_0x730c('0x1c')],'whatsappStatusTime':this[_0x730c('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x730c('0x1f')],'openchannelStatus':this[_0x730c('0x20')],'openchannelStatusTime':this[_0x730c('0x21')],'openchannelCapacity':this[_0x730c('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x730c('0x36')],'busyQueue':this[_0x730c('0x24')]};var _0x5ef7fd=md5(JSON[_0x730c('0x37')](_0x1e6ced));if(this[_0x730c('0x1')]!==_0x5ef7fd){this[_0x730c('0x1')]=_0x5ef7fd;io['emit'](_0x730c('0x38'),_0x1e6ced);}};module[_0x730c('0x39')]=Agent; \ No newline at end of file +var _0x5a1c=['emit','user:save','exports','lodash','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','Capacity','CurrentCapacity','maxcapacity','working','chat','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','chatStatusTime','openchannelStatusTime','stringify'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0xb17b4d,_0x22e73d){_0xb17b4d=_0xb17b4d-0x0;var _0xc91c76=_0x5a1c[_0xb17b4d];return _0xc91c76;};'use strict';var _=require(_0xc5a1('0x0'));var moment=require(_0xc5a1('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xc5a1('0x2'));config['redis']=_[_0xc5a1('0x3')](config[_0xc5a1('0x4')],{'host':_0xc5a1('0x5'),'port':0x18eb});var io=require(_0xc5a1('0x6'))(new Redis(config['redis']));function Agent(_0x429a68){this['id']=_0x429a68['id']||0x0;this[_0xc5a1('0x7')]=_0x429a68[_0xc5a1('0x7')]||'';this['online']=_0x429a68[_0xc5a1('0x8')]||!![];this[_0xc5a1('0x9')]=_0x429a68[_0xc5a1('0x9')]||![];this[_0xc5a1('0xa')]=_0x429a68[_0xc5a1('0xa')]||![];this[_0xc5a1('0xb')]=_0x429a68[_0xc5a1('0xb')]||![];this[_0xc5a1('0xc')]=_0x429a68[_0xc5a1('0xc')]||![];this[_0xc5a1('0xd')]=_0x429a68[_0xc5a1('0xd')]||![];this['openchannelPause']=_0x429a68[_0xc5a1('0xe')]||![];this[_0xc5a1('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0xc5a1('0x10')]=_0x429a68['chatCapacity']||0x0;this[_0xc5a1('0x11')]=0x0;this[_0xc5a1('0x12')]=_0xc5a1('0x13');this[_0xc5a1('0x14')]=0x0;this['mailCapacity']=_0x429a68[_0xc5a1('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xc5a1('0x16')]='unknown';this[_0xc5a1('0x17')]=0x0;this[_0xc5a1('0x18')]=_0x429a68[_0xc5a1('0x18')]||0x0;this[_0xc5a1('0x19')]=0x0;this[_0xc5a1('0x1a')]='unknown';this[_0xc5a1('0x1b')]=0x0;this[_0xc5a1('0x1c')]=_0x429a68[_0xc5a1('0x1c')]||0x0;this[_0xc5a1('0x1d')]=0x0;this[_0xc5a1('0x1e')]=_0xc5a1('0x13');this[_0xc5a1('0x1f')]=0x0;this['whatsappCapacity']=_0x429a68[_0xc5a1('0x20')]||0x0;this[_0xc5a1('0x21')]=0x0;this[_0xc5a1('0x22')]=_0xc5a1('0x13');this['openchannelStatusTime']=0x0;this[_0xc5a1('0x23')]=_0x429a68[_0xc5a1('0x23')]||0x0;this[_0xc5a1('0x24')]=0x0;this[_0xc5a1('0x25')]=![];this[_0xc5a1('0x26')]=undefined;this[_0xc5a1('0x27')]='';this[_0xc5a1('0x28')]();}Agent[_0xc5a1('0x29')]['getChannelStatus']=function(_0x354824){if(this[_0x354824+'CurrentCapacity']>0x0){if(this[_0x354824+_0xc5a1('0x2a')]>0x0&&this[_0x354824+_0xc5a1('0x2b')]>=this[_0x354824+'Capacity']){return _0xc5a1('0x2c');}else{return _0xc5a1('0x2d');}}else{return'idle';}};Agent['prototype'][_0xc5a1('0x28')]=function(){var _0x32f8cd=['mail',_0xc5a1('0x2e'),'openchannel',_0xc5a1('0x2f'),_0xc5a1('0x30'),_0xc5a1('0x31')];for(var _0xfad798=0x0;_0xfad798<_0x32f8cd[_0xc5a1('0x32')];_0xfad798+=0x1){var _0x344673=this[_0xc5a1('0x33')](_0x32f8cd[_0xfad798]);if(this[_0x32f8cd[_0xfad798]+_0xc5a1('0x34')]!==_0x344673){this[_0x32f8cd[_0xfad798]+_0xc5a1('0x35')]=_[_0xc5a1('0x36')](moment()[_0xc5a1('0x37')]('x'));}this[_0x32f8cd[_0xfad798]+'Status']=_0x344673;}var _0xbd1193={'id':this['id'],'name':this[_0xc5a1('0x7')],'online':this['online'],'voicePause':this[_0xc5a1('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xc5a1('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xc5a1('0xc')],'openchannelPause':this[_0xc5a1('0xe')],'chatStatus':this[_0xc5a1('0xf')],'chatStatusTime':this[_0xc5a1('0x38')],'chatCapacity':this[_0xc5a1('0x10')],'chatCurrentCapacity':this[_0xc5a1('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xc5a1('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc5a1('0x16')],'faxStatusTime':this[_0xc5a1('0x17')],'faxCapacity':this[_0xc5a1('0x18')],'faxCurrentCapacity':this[_0xc5a1('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc5a1('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xc5a1('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xc5a1('0x1f')],'whatsappCapacity':this[_0xc5a1('0x20')],'whatsappCurrentCapacity':this[_0xc5a1('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc5a1('0x39')],'openchannelCapacity':this[_0xc5a1('0x23')],'openchannelCurrentCapacity':this[_0xc5a1('0x24')],'busy':this['busy'],'busyQueue':this[_0xc5a1('0x26')]};var _0x5c2a2c=md5(JSON[_0xc5a1('0x3a')](_0xbd1193));if(this['md5']!==_0x5c2a2c){this[_0xc5a1('0x27')]=_0x5c2a2c;io[_0xc5a1('0x3b')](_0xc5a1('0x3c'),_0xbd1193);}};module[_0xc5a1('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5d83a33..384fc38 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 _0x4b10=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','chat_queue:save','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name'];(function(_0x177597,_0x1bf557){var _0x371945=function(_0x1cb7d4){while(--_0x1cb7d4){_0x177597['push'](_0x177597['shift']());}};_0x371945(++_0x1bf557);}(_0x4b10,0x6c));var _0x04b1=function(_0x1d73fa,_0x431738){_0x1d73fa=_0x1d73fa-0x0;var _0x53c9d1=_0x4b10[_0x1d73fa];return _0x53c9d1;};'use strict';var _=require(_0x04b1('0x0'));var md5=require(_0x04b1('0x1'));var util=require(_0x04b1('0x2'));var Redis=require(_0x04b1('0x3'));var config=require('../../../config/environment');config[_0x04b1('0x4')]=_[_0x04b1('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x04b1('0x6'))(new Redis(config[_0x04b1('0x4')]));function ChatQueue(_0x46bfa3){this['id']=_0x46bfa3['id']||0x0;this[_0x04b1('0x7')]=_0x46bfa3[_0x04b1('0x7')]||'';this[_0x04b1('0x8')]=_0x46bfa3[_0x04b1('0x8')]||0xa;this[_0x04b1('0x9')]=_0x46bfa3['strategy']||_0x04b1('0xa');this[_0x04b1('0xb')]=_0x46bfa3[_0x04b1('0xb')];this[_0x04b1('0xc')]={};this[_0x04b1('0xd')]=0x0;this[_0x04b1('0x1')]='';this[_0x04b1('0xe')]();this[_0x04b1('0xf')]();}ChatQueue[_0x04b1('0x10')][_0x04b1('0xe')]=function(){var _0x307a0b=this[_0x04b1('0xc')][_0x04b1('0x11')];this['mapAgentsId']=_[_0x04b1('0x12')](this[_0x04b1('0xb')],'id');this[_0x04b1('0xc')][_0x04b1('0x11')]=_0x307a0b;};ChatQueue[_0x04b1('0x10')][_0x04b1('0xf')]=function(){this[_0x04b1('0x13')]=0x0;this[_0x04b1('0x14')]=0x0;for(var _0x3eb88c=0x0;_0x3eb88c=0x0?this['available']:0x0;var _0x27e173={'id':this['id'],'available':this[_0x04b1('0x18')],'loggedIn':this[_0x04b1('0x13')],'name':this[_0x04b1('0x7')],'paused':this[_0x04b1('0x14')],'waiting':this[_0x04b1('0xd')]};var _0x32d05e=md5(JSON[_0x04b1('0x19')](_0x27e173));if(this[_0x04b1('0x1')]!==_0x32d05e){this[_0x04b1('0x1')]=_0x32d05e;io['to'](util[_0x04b1('0x1a')]('chat:queue:%s',_0x27e173['name']))[_0x04b1('0x1b')](_0x04b1('0x1c'),_0x27e173);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa127=['strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','chatPause','available','waiting','stringify','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','name','timeout'];(function(_0x501e67,_0x2e6643){var _0x16b255=function(_0x474eb4){while(--_0x474eb4){_0x501e67['push'](_0x501e67['shift']());}};_0x16b255(++_0x2e6643);}(_0xa127,0xae));var _0x7a12=function(_0x2d0048,_0x1b7edd){_0x2d0048=_0x2d0048-0x0;var _0x524bee=_0xa127[_0x2d0048];return _0x524bee;};'use strict';var _=require(_0x7a12('0x0'));var md5=require('md5');var util=require(_0x7a12('0x1'));var Redis=require(_0x7a12('0x2'));var config=require(_0x7a12('0x3'));config[_0x7a12('0x4')]=_[_0x7a12('0x5')](config[_0x7a12('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a12('0x4')]));function ChatQueue(_0x516d95){this['id']=_0x516d95['id']||0x0;this[_0x7a12('0x6')]=_0x516d95[_0x7a12('0x6')]||'';this[_0x7a12('0x7')]=_0x516d95[_0x7a12('0x7')]||0xa;this[_0x7a12('0x8')]=_0x516d95[_0x7a12('0x8')]||'beepall';this[_0x7a12('0x9')]=_0x516d95[_0x7a12('0x9')];this[_0x7a12('0xa')]={};this['waiting']=0x0;this[_0x7a12('0xb')]='';this[_0x7a12('0xc')]();this[_0x7a12('0xd')]();}ChatQueue['prototype'][_0x7a12('0xc')]=function(){var _0x17af9a=this[_0x7a12('0xa')][_0x7a12('0xe')];this['mapAgentsId']=_[_0x7a12('0xf')](this[_0x7a12('0x9')],'id');this[_0x7a12('0xa')][_0x7a12('0xe')]=_0x17af9a;};ChatQueue['prototype'][_0x7a12('0xd')]=function(){this[_0x7a12('0x10')]=0x0;this[_0x7a12('0x11')]=0x0;for(var _0x3a0da1=0x0;_0x3a0da1=0x0?this['available']:0x0;var _0x819c96={'id':this['id'],'available':this[_0x7a12('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x7a12('0x6')],'paused':this[_0x7a12('0x11')],'waiting':this[_0x7a12('0x16')]};var _0x1433e9=md5(JSON[_0x7a12('0x17')](_0x819c96));if(this[_0x7a12('0xb')]!==_0x1433e9){this[_0x7a12('0xb')]=_0x1433e9;io['to'](util['format']('chat:queue:%s',_0x819c96[_0x7a12('0x6')]))[_0x7a12('0x18')](_0x7a12('0x19'),_0x819c96);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 88022f8..f202120 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(_0x5528cf,_0x1d6fd7){var _0x5cbec0=function(_0x2b9f78){while(--_0x2b9f78){_0x5528cf['push'](_0x5528cf['shift']());}};_0x5cbec0(++_0x1d6fd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x36d21c,_0x5d37c4){var _0xb6202b=function(_0x17e798){while(--_0x17e798){_0x36d21c['push'](_0x36d21c['shift']());}};_0xb6202b(++_0x5d37c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 c8de580..1edab9c 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 _0x6a02=['exports','Intervals'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x6a02,0x99));var _0x26a0=function(_0x1ec725,_0x5e9925){_0x1ec725=_0x1ec725-0x0;var _0x56a168=_0x6a02[_0x1ec725];return _0x56a168;};'use strict';function Interval(_0xeae042){this['id']=_0xeae042['id']||0x0;this['name']=_0xeae042['name']||'';this[_0x26a0('0x0')]=_0xeae042[_0x26a0('0x0')]||{};}module[_0x26a0('0x1')]=Interval; \ No newline at end of file +var _0xfe87=['name','Intervals'];(function(_0x2b3c4e,_0x169939){var _0xdcb822=function(_0x435266){while(--_0x435266){_0x2b3c4e['push'](_0x2b3c4e['shift']());}};_0xdcb822(++_0x169939);}(_0xfe87,0x1ae));var _0x7fe8=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xfe87[_0x239dba];return _0x1ceb11;};'use strict';function Interval(_0xa17654){this['id']=_0xa17654['id']||0x0;this[_0x7fe8('0x0')]=_0xa17654[_0x7fe8('0x0')]||'';this[_0x7fe8('0x1')]=_0xa17654['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index eda5e4b..d456906 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 _0xd557=['mail:queue:%s','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','mailPause','available','name','stringify','format'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd557,0x18a));var _0x7d55=function(_0x58f200,_0x2cd1d2){_0x58f200=_0x58f200-0x0;var _0x52b846=_0xd557[_0x58f200];return _0x52b846;};'use strict';var _=require(_0x7d55('0x0'));var md5=require(_0x7d55('0x1'));var util=require(_0x7d55('0x2'));var Redis=require(_0x7d55('0x3'));var config=require(_0x7d55('0x4'));config['redis']=_[_0x7d55('0x5')](config[_0x7d55('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7d55('0x7'))(new Redis(config['redis']));function MailQueue(_0x204a5e){this['id']=_0x204a5e['id']||0x0;this['name']=_0x204a5e['name']||'';this[_0x7d55('0x8')]=_0x204a5e['timeout']||0xa;this[_0x7d55('0x9')]=_0x204a5e[_0x7d55('0x9')]||_0x7d55('0xa');this[_0x7d55('0xb')]=_0x204a5e[_0x7d55('0xb')];this[_0x7d55('0xc')]={};this[_0x7d55('0xd')]=0x0;this[_0x7d55('0x1')]='';this['updateRouting']();this[_0x7d55('0xe')]();}MailQueue[_0x7d55('0xf')]['updateRouting']=function(){var _0x4de8e3=this[_0x7d55('0xc')][_0x7d55('0x10')];this[_0x7d55('0xc')]=_['map'](this[_0x7d55('0xb')],'id');this[_0x7d55('0xc')][_0x7d55('0x10')]=_0x4de8e3;};MailQueue['prototype'][_0x7d55('0xe')]=function(){this[_0x7d55('0x11')]=0x0;this[_0x7d55('0x12')]=0x0;for(var _0xeaaadf=0x0;_0xeaaadf=0x0?this[_0x7d55('0x16')]:0x0;var _0x545797={'id':this['id'],'available':this[_0x7d55('0x16')],'loggedIn':this[_0x7d55('0x11')],'name':this[_0x7d55('0x17')],'paused':this[_0x7d55('0x12')],'waiting':this[_0x7d55('0xd')]};var _0xd39a92=md5(JSON[_0x7d55('0x18')](_0x545797));if(this[_0x7d55('0x1')]!==_0xd39a92){this[_0x7d55('0x1')]=_0xd39a92;io['to'](util[_0x7d55('0x19')](_0x7d55('0x1a'),_0x545797['name']))['emit'](_0x7d55('0x1b'),_0x545797);}};module['exports']=MailQueue; \ No newline at end of file +var _0xcde1=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x9470cb,_0x27cdf3){var _0x411e1d=function(_0x12458f){while(--_0x12458f){_0x9470cb['push'](_0x9470cb['shift']());}};_0x411e1d(++_0x27cdf3);}(_0xcde1,0xcb));var _0x1cde=function(_0x588e40,_0xb5d17){_0x588e40=_0x588e40-0x0;var _0x188f3b=_0xcde1[_0x588e40];return _0x188f3b;};'use strict';var _=require(_0x1cde('0x0'));var md5=require(_0x1cde('0x1'));var util=require(_0x1cde('0x2'));var Redis=require(_0x1cde('0x3'));var config=require(_0x1cde('0x4'));config[_0x1cde('0x5')]=_[_0x1cde('0x6')](config[_0x1cde('0x5')],{'host':_0x1cde('0x7'),'port':0x18eb});var io=require(_0x1cde('0x8'))(new Redis(config[_0x1cde('0x5')]));function MailQueue(_0x3586ba){this['id']=_0x3586ba['id']||0x0;this[_0x1cde('0x9')]=_0x3586ba[_0x1cde('0x9')]||'';this['timeout']=_0x3586ba[_0x1cde('0xa')]||0xa;this[_0x1cde('0xb')]=_0x3586ba[_0x1cde('0xb')]||'beepall';this[_0x1cde('0xc')]=_0x3586ba['Agents'];this[_0x1cde('0xd')]={};this[_0x1cde('0xe')]=0x0;this['md5']='';this[_0x1cde('0xf')]();this['updateRealtime']();}MailQueue['prototype'][_0x1cde('0xf')]=function(){var _0x3e608e=this[_0x1cde('0xd')][_0x1cde('0x10')];this['mapAgentsId']=_[_0x1cde('0x11')](this['Agents'],'id');this[_0x1cde('0xd')][_0x1cde('0x10')]=_0x3e608e;};MailQueue[_0x1cde('0x12')]['updateRealtime']=function(){this[_0x1cde('0x13')]=0x0;this[_0x1cde('0x14')]=0x0;for(var _0x4bc804=0x0;_0x4bc804=0x0?this[_0x1cde('0x18')]:0x0;var _0x2a69da={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cde('0x13')],'name':this['name'],'paused':this[_0x1cde('0x14')],'waiting':this[_0x1cde('0xe')]};var _0x5454d1=md5(JSON[_0x1cde('0x19')](_0x2a69da));if(this['md5']!==_0x5454d1){this[_0x1cde('0x1')]=_0x5454d1;io['to'](util[_0x1cde('0x1a')](_0x1cde('0x1b'),_0x2a69da['name']))[_0x1cde('0x1c')](_0x1cde('0x1d'),_0x2a69da);}};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 2cf3ee9..357f825 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 _0x5ba2=['updateRealtime','updateRouting','_rr','map','loggedIn','length','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0x5ba2,0x1f3));var _0x25ba=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x5ba2[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x25ba('0x0'));var md5=require(_0x25ba('0x1'));var util=require(_0x25ba('0x2'));var Redis=require(_0x25ba('0x3'));var config=require(_0x25ba('0x4'));config[_0x25ba('0x5')]=_[_0x25ba('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25ba('0x5')]));function OpenchannelQueue(_0x412650){this['id']=_0x412650['id']||0x0;this['name']=_0x412650[_0x25ba('0x7')]||'';this[_0x25ba('0x8')]=_0x412650[_0x25ba('0x8')]||0xa;this[_0x25ba('0x9')]=_0x412650[_0x25ba('0x9')]||_0x25ba('0xa');this['Agents']=_0x412650[_0x25ba('0xb')];this[_0x25ba('0xc')]={};this[_0x25ba('0xd')]=0x0;this[_0x25ba('0x1')]='';this['updateRouting']();this[_0x25ba('0xe')]();}OpenchannelQueue['prototype'][_0x25ba('0xf')]=function(){var _0x42aa69=this[_0x25ba('0xc')][_0x25ba('0x10')];this[_0x25ba('0xc')]=_[_0x25ba('0x11')](this[_0x25ba('0xb')],'id');this[_0x25ba('0xc')]['_rr']=_0x42aa69;};OpenchannelQueue['prototype'][_0x25ba('0xe')]=function(){this[_0x25ba('0x12')]=0x0;this['paused']=0x0;for(var _0x3e3dbf=0x0;_0x3e3dbf=0x0?this['available']:0x0;var _0x5864c3={'id':this['id'],'available':this[_0x25ba('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x25ba('0xd')]};var _0x4b8825=md5(JSON[_0x25ba('0x17')](_0x5864c3));if(this[_0x25ba('0x1')]!==_0x4b8825){this[_0x25ba('0x1')]=_0x4b8825;io['to'](util[_0x25ba('0x18')](_0x25ba('0x19'),_0x5864c3[_0x25ba('0x7')]))['emit']('openchannel_queue:save',_0x5864c3);}};module[_0x25ba('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xe0c3=['localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','defaults'];(function(_0xb12888,_0x589508){var _0x14b667=function(_0x4c07ab){while(--_0x4c07ab){_0xb12888['push'](_0xb12888['shift']());}};_0x14b667(++_0x589508);}(_0xe0c3,0x145));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var md5=require(_0x3e0c('0x1'));var util=require(_0x3e0c('0x2'));var Redis=require('ioredis');var config=require(_0x3e0c('0x3'));config['redis']=_[_0x3e0c('0x4')](config['redis'],{'host':_0x3e0c('0x5'),'port':0x18eb});var io=require(_0x3e0c('0x6'))(new Redis(config[_0x3e0c('0x7')]));function OpenchannelQueue(_0xbf2719){this['id']=_0xbf2719['id']||0x0;this[_0x3e0c('0x8')]=_0xbf2719[_0x3e0c('0x8')]||'';this[_0x3e0c('0x9')]=_0xbf2719[_0x3e0c('0x9')]||0xa;this[_0x3e0c('0xa')]=_0xbf2719['strategy']||_0x3e0c('0xb');this['Agents']=_0xbf2719[_0x3e0c('0xc')];this[_0x3e0c('0xd')]={};this[_0x3e0c('0xe')]=0x0;this[_0x3e0c('0x1')]='';this[_0x3e0c('0xf')]();this[_0x3e0c('0x10')]();}OpenchannelQueue[_0x3e0c('0x11')][_0x3e0c('0xf')]=function(){var _0x16bce6=this[_0x3e0c('0xd')][_0x3e0c('0x12')];this[_0x3e0c('0xd')]=_[_0x3e0c('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3e0c('0x12')]=_0x16bce6;};OpenchannelQueue[_0x3e0c('0x11')][_0x3e0c('0x10')]=function(){this[_0x3e0c('0x14')]=0x0;this[_0x3e0c('0x15')]=0x0;for(var _0x29fb7d=0x0;_0x29fb7d=0x0?this[_0x3e0c('0x17')]:0x0;var _0x11e302={'id':this['id'],'available':this[_0x3e0c('0x17')],'loggedIn':this[_0x3e0c('0x14')],'name':this[_0x3e0c('0x8')],'paused':this[_0x3e0c('0x15')],'waiting':this[_0x3e0c('0xe')]};var _0x2b6aac=md5(JSON[_0x3e0c('0x18')](_0x11e302));if(this['md5']!==_0x2b6aac){this[_0x3e0c('0x1')]=_0x2b6aac;io['to'](util[_0x3e0c('0x19')](_0x3e0c('0x1a'),_0x11e302[_0x3e0c('0x8')]))[_0x3e0c('0x1b')](_0x3e0c('0x1c'),_0x11e302);}};module[_0x3e0c('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 2a85970..dc4e81d 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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a3202,_0x4a9c0d){_0x5a3202=_0x5a3202-0x0;var _0xb4cf2=_0xb10b[_0x5a3202];return _0xb4cf2;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=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(_0x52caa9,_0xa7a962){var _0x232fe6=function(_0x2ff45f){while(--_0x2ff45f){_0x52caa9['push'](_0x52caa9['shift']());}};_0x232fe6(++_0xa7a962);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'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 72bb10e..334b38c 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 _0xa785=['format','emit','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify'];(function(_0x3f753e,_0x549d35){var _0x423e2b=function(_0x17c407){while(--_0x17c407){_0x3f753e['push'](_0x3f753e['shift']());}};_0x423e2b(++_0x549d35);}(_0xa785,0x18c));var _0x5a78=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xa785[_0x5a26db];return _0x4619dd;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x5a78('0x0'));var Redis=require(_0x5a78('0x1'));var config=require(_0x5a78('0x2'));config['redis']=_[_0x5a78('0x3')](config[_0x5a78('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5a78('0x4')]));function WhatsappQueue(_0x1a7efa){this['id']=_0x1a7efa['id']||0x0;this[_0x5a78('0x5')]=_0x1a7efa[_0x5a78('0x5')]||'';this['timeout']=_0x1a7efa[_0x5a78('0x6')]||0xa;this[_0x5a78('0x7')]=_0x1a7efa['strategy']||_0x5a78('0x8');this[_0x5a78('0x9')]=_0x1a7efa['Agents'];this[_0x5a78('0xa')]={};this[_0x5a78('0xb')]=0x0;this[_0x5a78('0xc')]='';this[_0x5a78('0xd')]();this[_0x5a78('0xe')]();}WhatsappQueue[_0x5a78('0xf')][_0x5a78('0xd')]=function(){var _0x1b831b=this[_0x5a78('0xa')][_0x5a78('0x10')];this['mapAgentsId']=_['map'](this[_0x5a78('0x9')],'id');this['mapAgentsId'][_0x5a78('0x10')]=_0x1b831b;};WhatsappQueue[_0x5a78('0xf')][_0x5a78('0xe')]=function(){this[_0x5a78('0x11')]=0x0;this[_0x5a78('0x12')]=0x0;for(var _0x532434=0x0;_0x532434=0x0?this[_0x5a78('0x16')]:0x0;var _0x1f13fd={'id':this['id'],'available':this[_0x5a78('0x16')],'loggedIn':this[_0x5a78('0x11')],'name':this[_0x5a78('0x5')],'paused':this[_0x5a78('0x12')],'waiting':this[_0x5a78('0xb')]};var _0x29bea0=md5(JSON[_0x5a78('0x17')](_0x1f13fd));if(this[_0x5a78('0xc')]!==_0x29bea0){this[_0x5a78('0xc')]=_0x29bea0;io['to'](util[_0x5a78('0x18')]('whatsapp:queue:%s',_0x1f13fd['name']))[_0x5a78('0x19')](_0x5a78('0x1a'),_0x1f13fd);}};module[_0x5a78('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x73cd=['util','ioredis','redis','defaults','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','exports','lodash'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x73cd,0x18f));var _0xd73c=function(_0x11af6c,_0xf0fc16){_0x11af6c=_0x11af6c-0x0;var _0x2b043f=_0x73cd[_0x11af6c];return _0x2b043f;};'use strict';var _=require(_0xd73c('0x0'));var md5=require('md5');var util=require(_0xd73c('0x1'));var Redis=require(_0xd73c('0x2'));var config=require('../../../config/environment');config[_0xd73c('0x3')]=_[_0xd73c('0x4')](config[_0xd73c('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x27fb46){this['id']=_0x27fb46['id']||0x0;this[_0xd73c('0x5')]=_0x27fb46[_0xd73c('0x5')]||'';this[_0xd73c('0x6')]=_0x27fb46[_0xd73c('0x6')]||0xa;this[_0xd73c('0x7')]=_0x27fb46[_0xd73c('0x7')]||'beepall';this[_0xd73c('0x8')]=_0x27fb46[_0xd73c('0x8')];this['mapAgentsId']={};this[_0xd73c('0x9')]=0x0;this[_0xd73c('0xa')]='';this[_0xd73c('0xb')]();this[_0xd73c('0xc')]();}WhatsappQueue[_0xd73c('0xd')][_0xd73c('0xb')]=function(){var _0x4178c0=this[_0xd73c('0xe')][_0xd73c('0xf')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xd73c('0xe')]['_rr']=_0x4178c0;};WhatsappQueue[_0xd73c('0xd')][_0xd73c('0xc')]=function(){this[_0xd73c('0x10')]=0x0;this[_0xd73c('0x11')]=0x0;for(var _0x5781cf=0x0;_0x5781cf=0x0?this[_0xd73c('0x14')]:0x0;var _0x5bbd6d={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd73c('0x10')],'name':this[_0xd73c('0x5')],'paused':this[_0xd73c('0x11')],'waiting':this['waiting']};var _0xe5534c=md5(JSON[_0xd73c('0x15')](_0x5bbd6d));if(this[_0xd73c('0xa')]!==_0xe5534c){this['md5']=_0xe5534c;io['to'](util['format'](_0xd73c('0x16'),_0x5bbd6d[_0xd73c('0x5')]))[_0xd73c('0x17')]('whatsapp_queue:save',_0x5bbd6d);}};module[_0xd73c('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bcd6e95..2d02f5b 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x4e627f,_0x1acc8e){var _0x65ee15=function(_0x5cd24c){while(--_0x5cd24c){_0x4e627f['push'](_0x4e627f['shift']());}};_0x65ee15(++_0x1acc8e);}(_0x008c,0x188));var _0xc008=function(_0x4d7530,_0xdee31){_0x4d7530=_0x4d7530-0x0;var _0x1afc9e=_0x008c[_0x4d7530];return _0x1afc9e;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 28599fc..75e35e4 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 _0xb2ef=['UpdateChatInteraction','updateChatInteraction','addTags','update','Request'];(function(_0x1ccdee,_0x4f0378){var _0xe1f894=function(_0x1e3fe0){while(--_0x1e3fe0){_0x1ccdee['push'](_0x1ccdee['shift']());}};_0xe1f894(++_0x4f0378);}(_0xb2ef,0x157));var _0xfb2e=function(_0x475725,_0x16475b){_0x475725=_0x475725-0x0;var _0x2dd14e=_0xb2ef[_0x475725];return _0x2dd14e;};'use strict';var client=require('../client');exports[_0xfb2e('0x0')]=function(_0x3e0ceb,_0x468288){return client[_0xfb2e('0x1')](_0xfb2e('0x2'),{'body':_0x468288,'options':{'where':{'id':_0x3e0ceb}},'log':_0xfb2e('0x3')});};exports[_0xfb2e('0x4')]=function(_0x92148,_0x95ab7){return client[_0xfb2e('0x1')]('AddTagsToChatInteraction',{'body':_0x95ab7,'options':{'where':{'id':_0x92148}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe8ce=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x19dc7b,_0x476427){var _0x2024f1=function(_0x4858c4){while(--_0x4858c4){_0x19dc7b['push'](_0x19dc7b['shift']());}};_0x2024f1(++_0x476427);}(_0xe8ce,0xb2));var _0xee8c=function(_0x4a6cf3,_0x46ce5f){_0x4a6cf3=_0x4a6cf3-0x0;var _0x39cd59=_0xe8ce[_0x4a6cf3];return _0x39cd59;};'use strict';var client=require('../client');exports[_0xee8c('0x0')]=function(_0x150c78,_0x18f947){return client['Request'](_0xee8c('0x1'),{'body':_0x18f947,'options':{'where':{'id':_0x150c78}},'log':_0xee8c('0x2')});};exports[_0xee8c('0x3')]=function(_0x95cadc,_0x557f0f){return client[_0xee8c('0x4')](_0xee8c('0x5'),{'body':_0x557f0f,'options':{'where':{'id':_0x95cadc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 31eb7e5..daf86c2 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 _0x240c=['CreateChatMessage','../client','create','Request'];(function(_0x235d6d,_0x1e851b){var _0x1fc78f=function(_0x5eda18){while(--_0x5eda18){_0x235d6d['push'](_0x235d6d['shift']());}};_0x1fc78f(++_0x1e851b);}(_0x240c,0x1a1));var _0xc240=function(_0x581c57,_0x1f0b7d){_0x581c57=_0x581c57-0x0;var _0x27ecb7=_0x240c[_0x581c57];return _0x27ecb7;};'use strict';var client=require(_0xc240('0x0'));exports[_0xc240('0x1')]=function(_0x3a9261){return client[_0xc240('0x2')](_0xc240('0x3'),{'body':_0x3a9261,'log':'createChatMessage'});}; \ No newline at end of file +var _0x0c54=['CreateChatMessage','createChatMessage','create'];(function(_0x510cec,_0x542d08){var _0x2ab724=function(_0x51458a){while(--_0x51458a){_0x510cec['push'](_0x510cec['shift']());}};_0x2ab724(++_0x542d08);}(_0x0c54,0x9e));var _0x40c5=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x0c54[_0x22e47a];return _0x15a12a;};'use strict';var client=require('../client');exports[_0x40c5('0x0')]=function(_0x609913){return client['Request'](_0x40c5('0x1'),{'body':_0x609913,'log':_0x40c5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 04cbe49..525cec2 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 _0x4f70=['name','timeout','strategy','User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x1a327e,_0x63ea19){var _0x519df7=function(_0x102ec3){while(--_0x102ec3){_0x1a327e['push'](_0x1a327e['shift']());}};_0x519df7(++_0x63ea19);}(_0x4f70,0x133));var _0x04f7=function(_0x522403,_0x5c483d){_0x522403=_0x522403-0x0;var _0x245cc2=_0x4f70[_0x522403];return _0x245cc2;};'use strict';var client=require(_0x04f7('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x04f7('0x1')](_0x04f7('0x2'),{'options':{'raw':![],'attributes':['id',_0x04f7('0x3'),_0x04f7('0x4'),_0x04f7('0x5')],'include':[{'model':_0x04f7('0x6'),'as':_0x04f7('0x7'),'attributes':['id',_0x04f7('0x3'),'online',_0x04f7('0x8')]}]},'log':_0x04f7('0x9')});};}; \ No newline at end of file +var _0x763d=['online','../client','getChatQueues','Request','GetChatQueue','name','timeout','User','Agents'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x763d,0x9a));var _0xd763=function(_0x487f81,_0x40d371){_0x487f81=_0x487f81-0x0;var _0x269079=_0x763d[_0x487f81];return _0x269079;};'use strict';var client=require(_0xd763('0x0'));exports[_0xd763('0x1')]=function(){return function(){return client[_0xd763('0x2')](_0xd763('0x3'),{'options':{'raw':![],'attributes':['id',_0xd763('0x4'),_0xd763('0x5'),'strategy'],'include':[{'model':_0xd763('0x6'),'as':_0xd763('0x7'),'attributes':['id','name',_0xd763('0x8'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8835698..fbc38e2 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 _0xa0bc=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x2ca5fe,_0xb992f8){var _0x2fcd05=function(_0x92c7f4){while(--_0x92c7f4){_0x2ca5fe['push'](_0x2ca5fe['shift']());}};_0x2fcd05(++_0xb992f8);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xca0b('0x0')]=function(_0x19838b){return client['Request'](_0xca0b('0x1'),{'body':_0x19838b,'log':_0xca0b('0x1')});};exports[_0xca0b('0x2')]=function(_0x68ff4,_0x2f7b56){return client[_0xca0b('0x3')](_0xca0b('0x4'),{'body':_0x2f7b56,'options':{'where':{'uniqueid':_0x68ff4},'order':[['id',_0xca0b('0x5')]],'limit':0x1},'log':_0xca0b('0x4')});}; \ No newline at end of file +var _0x4bd1=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x46fed7,_0x63ce8d){var _0x608f39=function(_0x2ad652){while(--_0x2ad652){_0x46fed7['push'](_0x46fed7['shift']());}};_0x608f39(++_0x63ce8d);}(_0x4bd1,0x90));var _0x14bd=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x4bd1[_0xacb1e2];return _0x463815;};'use strict';var client=require('../client');exports[_0x14bd('0x0')]=function(_0x5ef5c7){return client[_0x14bd('0x1')](_0x14bd('0x2'),{'body':_0x5ef5c7,'log':'CreateChatQueueReport'});};exports[_0x14bd('0x3')]=function(_0x45948d,_0x51fcdb){return client[_0x14bd('0x1')](_0x14bd('0x4'),{'body':_0x51fcdb,'options':{'where':{'uniqueid':_0x45948d},'order':[['id',_0x14bd('0x5')]],'limit':0x1},'log':_0x14bd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 68a18a2..1c3e851 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 _0xd59a=['../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xd59a,0x1b2));var _0xad59=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd59a[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xad59('0x0'));exports[_0xad59('0x1')]=function(_0x16ae71,_0x595a1d){return client['Request'](_0xad59('0x2'),{'body':_0x595a1d,'options':{'where':{'id':_0x16ae71}},'log':_0xad59('0x3')});};exports[_0xad59('0x4')]=function(_0x451f3d,_0x40c791){return client['Request'](_0xad59('0x5'),{'body':_0x40c791,'options':{'where':{'id':_0x451f3d}},'log':_0xad59('0x6')});}; \ No newline at end of file +var _0x378f=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x28e027,_0x3d58f7){var _0x49979b=function(_0x35069b){while(--_0x35069b){_0x28e027['push'](_0x28e027['shift']());}};_0x49979b(++_0x3d58f7);}(_0x378f,0x69));var _0xf378=function(_0x4bd243,_0x7c56d7){_0x4bd243=_0x4bd243-0x0;var _0x3a0fc1=_0x378f[_0x4bd243];return _0x3a0fc1;};'use strict';var client=require('../client');exports[_0xf378('0x0')]=function(_0x4d29bc,_0x364125){return client[_0xf378('0x1')](_0xf378('0x2'),{'body':_0x364125,'options':{'where':{'id':_0x4d29bc}},'log':_0xf378('0x3')});};exports[_0xf378('0x4')]=function(_0x241122,_0x56b200){return client[_0xf378('0x1')](_0xf378('0x5'),{'body':_0x56b200,'options':{'where':{'id':_0x241122}},'log':_0xf378('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f7ba47f..9ceef9c 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 _0x342f=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x319fa0,_0x31377a){var _0x464fee=function(_0x503a37){while(--_0x503a37){_0x319fa0['push'](_0x319fa0['shift']());}};_0x464fee(++_0x31377a);}(_0x342f,0x1ab));var _0xf342=function(_0x2b2a56,_0x11e8a5){_0x2b2a56=_0x2b2a56-0x0;var _0x4868a0=_0x342f[_0x2b2a56];return _0x4868a0;};'use strict';var client=require(_0xf342('0x0'));exports[_0xf342('0x1')]=function(_0x339cbc){return client['Request'](_0xf342('0x2'),{'body':_0x339cbc,'log':_0xf342('0x3')});}; \ No newline at end of file +var _0x33ee=['create','Request','createFaxMessage'];(function(_0x4663b4,_0x2bb8cb){var _0x5c632c=function(_0x40c5ae){while(--_0x40c5ae){_0x4663b4['push'](_0x4663b4['shift']());}};_0x5c632c(++_0x2bb8cb);}(_0x33ee,0xab));var _0xe33e=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x33ee[_0x3430aa];return _0x2ac5c;};'use strict';var client=require('../client');exports[_0xe33e('0x0')]=function(_0x447f51){return client[_0xe33e('0x1')]('CreateFaxMessage',{'body':_0x447f51,'log':_0xe33e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ea8e5fa..8da394c 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 _0x784e=['faxPause','getFaxQueues','../client','Request','GetFaxQueue','timeout','strategy','Agents','name','online'];(function(_0x4aa61c,_0x65cea9){var _0x44f15f=function(_0x194f5e){while(--_0x194f5e){_0x4aa61c['push'](_0x4aa61c['shift']());}};_0x44f15f(++_0x65cea9);}(_0x784e,0xf2));var _0xe784=function(_0x2f0ffa,_0x478f68){_0x2f0ffa=_0x2f0ffa-0x0;var _0x53e747=_0x784e[_0x2f0ffa];return _0x53e747;};'use strict';var client=require(_0xe784('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xe784('0x1')](_0xe784('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe784('0x3'),_0xe784('0x4')],'include':[{'model':'User','as':_0xe784('0x5'),'attributes':['id',_0xe784('0x6'),_0xe784('0x7'),_0xe784('0x8')]}]},'log':_0xe784('0x9')});};}; \ No newline at end of file +var _0x6216=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x6216,0x113));var _0x6621=function(_0x43c535,_0x1d159f){_0x43c535=_0x43c535-0x0;var _0x1410ce=_0x6216[_0x43c535];return _0x1410ce;};'use strict';var client=require(_0x6621('0x0'));exports[_0x6621('0x1')]=function(){return function(){return client[_0x6621('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6621('0x3'),'timeout',_0x6621('0x4')],'include':[{'model':_0x6621('0x5'),'as':_0x6621('0x6'),'attributes':['id',_0x6621('0x3'),_0x6621('0x7'),_0x6621('0x8')]}]},'log':_0x6621('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2140a8d..8ac8f5b 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 _0x34f8=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x59c3bc,_0x351b2a){var _0x134e68=function(_0x2f1cb5){while(--_0x2f1cb5){_0x59c3bc['push'](_0x59c3bc['shift']());}};_0x134e68(++_0x351b2a);}(_0x34f8,0x80));var _0x834f=function(_0x1446c3,_0x264858){_0x1446c3=_0x1446c3-0x0;var _0x2911dc=_0x34f8[_0x1446c3];return _0x2911dc;};'use strict';var client=require(_0x834f('0x0'));exports[_0x834f('0x1')]=function(_0x2a7837){return client[_0x834f('0x2')](_0x834f('0x3'),{'body':_0x2a7837,'log':'CreateFaxQueueReport'});};exports['update']=function(_0xe34aa5,_0x92264b){return client['Request'](_0x834f('0x4'),{'body':_0x92264b,'options':{'where':{'uniqueid':_0xe34aa5},'order':[['id',_0x834f('0x5')]],'limit':0x1},'log':_0x834f('0x4')});}; \ No newline at end of file +var _0x2937=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2937,0x1ba));var _0x7293=function(_0x55dea1,_0x2ecf80){_0x55dea1=_0x55dea1-0x0;var _0xeed1a0=_0x2937[_0x55dea1];return _0xeed1a0;};'use strict';var client=require(_0x7293('0x0'));exports[_0x7293('0x1')]=function(_0x168b68){return client[_0x7293('0x2')](_0x7293('0x3'),{'body':_0x168b68,'log':_0x7293('0x3')});};exports[_0x7293('0x4')]=function(_0x494b37,_0x231751){return client[_0x7293('0x2')]('UpdateFaxQueueReport',{'body':_0x231751,'options':{'where':{'uniqueid':_0x494b37},'order':[['id',_0x7293('0x5')]],'limit':0x1},'log':_0x7293('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e07b8ce..37e8956 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 _0xa7fa=['../client','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x5e09e3,_0x901577){var _0x1b6109=function(_0x53c633){while(--_0x53c633){_0x5e09e3['push'](_0x5e09e3['shift']());}};_0x1b6109(++_0x901577);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa7f('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xaa7f('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xaa7f('0x2')],'include':[{'model':_0xaa7f('0x3'),'as':_0xaa7f('0x4'),'attributes':['id','name',_0xaa7f('0x5')]}]},'log':_0xaa7f('0x6')});};}; \ No newline at end of file +var _0x49f8=['../client','GetInterval','name','Intervals','interval'];(function(_0x4c0f35,_0x376648){var _0x3e8f21=function(_0x10e3d4){while(--_0x10e3d4){_0x4c0f35['push'](_0x4c0f35['shift']());}};_0x3e8f21(++_0x376648);}(_0x49f8,0xff));var _0x849f=function(_0x12c32c,_0x13af3b){_0x12c32c=_0x12c32c-0x0;var _0x39b809=_0x49f8[_0x12c32c];return _0x39b809;};'use strict';var client=require(_0x849f('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x849f('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x849f('0x2')],'include':[{'model':'Interval','as':_0x849f('0x3'),'attributes':['id','name',_0x849f('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8a37222..5d695e7 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 _0xc49f=['../client','update','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc49f,0xb4));var _0xfc49=function(_0x41c970,_0x2bf13f){_0x41c970=_0x41c970-0x0;var _0x339df5=_0xc49f[_0x41c970];return _0x339df5;};'use strict';var client=require(_0xfc49('0x0'));exports[_0xfc49('0x1')]=function(_0x50d066,_0x332f7d){return client[_0xfc49('0x2')]('UpdateMailInteraction',{'body':_0x332f7d,'options':{'where':{'id':_0x50d066}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x1e34cd,_0x202837){return client[_0xfc49('0x2')](_0xfc49('0x3'),{'body':_0x202837,'options':{'where':{'id':_0x1e34cd}},'log':_0xfc49('0x4')});}; \ No newline at end of file +var _0x0612=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x4d1f10,_0x585dfb){var _0x358d24=function(_0x4414f3){while(--_0x4414f3){_0x4d1f10['push'](_0x4d1f10['shift']());}};_0x358d24(++_0x585dfb);}(_0x0612,0x199));var _0x2061=function(_0x201c03,_0x33a7e4){_0x201c03=_0x201c03-0x0;var _0x4ab13b=_0x0612[_0x201c03];return _0x4ab13b;};'use strict';var client=require(_0x2061('0x0'));exports[_0x2061('0x1')]=function(_0x59658b,_0x1c5eee){return client[_0x2061('0x2')](_0x2061('0x3'),{'body':_0x1c5eee,'options':{'where':{'id':_0x59658b}},'log':_0x2061('0x4')});};exports['addTags']=function(_0x1cb189,_0x275437){return client[_0x2061('0x2')](_0x2061('0x5'),{'body':_0x275437,'options':{'where':{'id':_0x1cb189}},'log':_0x2061('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2c8d5e7..fcfa5a1 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 _0xf186=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x5ed025,_0x14339c){var _0x1c050a=function(_0x3a9aa1){while(--_0x3a9aa1){_0x5ed025['push'](_0x5ed025['shift']());}};_0x1c050a(++_0x14339c);}(_0xf186,0x81));var _0x6f18=function(_0x51213c,_0x2e25d3){_0x51213c=_0x51213c-0x0;var _0x135f5c=_0xf186[_0x51213c];return _0x135f5c;};'use strict';var client=require(_0x6f18('0x0'));exports['create']=function(_0x310be9){return client[_0x6f18('0x1')](_0x6f18('0x2'),{'body':_0x310be9,'log':_0x6f18('0x3')});}; \ No newline at end of file +var _0xc53f=['../client','create','Request','createMailMessage'];(function(_0x18fc98,_0x172e6d){var _0x212435=function(_0x48c849){while(--_0x48c849){_0x18fc98['push'](_0x18fc98['shift']());}};_0x212435(++_0x172e6d);}(_0xc53f,0x1dc));var _0xfc53=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc53f[_0x4154a6];return _0x3b2786;};'use strict';var client=require(_0xfc53('0x0'));exports[_0xfc53('0x1')]=function(_0x713801){return client[_0xfc53('0x2')]('CreateMailMessage',{'body':_0x713801,'log':_0xfc53('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4985246..68c1cbb 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 _0xd9c1=['GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x57005e,_0x56b457){var _0x7eb3fe=function(_0x461485){while(--_0x461485){_0x57005e['push'](_0x57005e['shift']());}};_0x7eb3fe(++_0x56b457);}(_0xd9c1,0x1b5));var _0x1d9c=function(_0x25cb76,_0x31ae26){_0x25cb76=_0x25cb76-0x0;var _0x17b8f0=_0xd9c1[_0x25cb76];return _0x17b8f0;};'use strict';var client=require(_0x1d9c('0x0'));exports[_0x1d9c('0x1')]=function(){return function(){return client[_0x1d9c('0x2')](_0x1d9c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1d9c('0x4'),_0x1d9c('0x5')],'include':[{'model':_0x1d9c('0x6'),'as':_0x1d9c('0x7'),'attributes':['id',_0x1d9c('0x8'),_0x1d9c('0x9'),_0x1d9c('0xa')]}]},'log':_0x1d9c('0x1')});};}; \ No newline at end of file +var _0xf73a=['timeout','User','mailPause','getMailQueues','../client','Request','GetMailQueue','name'];(function(_0x40cb70,_0x3cf972){var _0x3686ab=function(_0x28fe88){while(--_0x28fe88){_0x40cb70['push'](_0x40cb70['shift']());}};_0x3686ab(++_0x3cf972);}(_0xf73a,0x14c));var _0xaf73=function(_0x5ee10f,_0xac5499){_0x5ee10f=_0x5ee10f-0x0;var _0x325ac8=_0xf73a[_0x5ee10f];return _0x325ac8;};'use strict';var client=require(_0xaf73('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xaf73('0x1')](_0xaf73('0x2'),{'options':{'raw':![],'attributes':['id',_0xaf73('0x3'),_0xaf73('0x4'),'strategy'],'include':[{'model':_0xaf73('0x5'),'as':'Agents','attributes':['id',_0xaf73('0x3'),'online',_0xaf73('0x6')]}]},'log':_0xaf73('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3a66a04..27e484e 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 _0xc1aa=['Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client','create'];(function(_0x5f40c0,_0x171d5f){var _0x19b774=function(_0x3b260e){while(--_0x3b260e){_0x5f40c0['push'](_0x5f40c0['shift']());}};_0x19b774(++_0x171d5f);}(_0xc1aa,0x1b7));var _0xac1a=function(_0x377fe7,_0x1d0e50){_0x377fe7=_0x377fe7-0x0;var _0x1c3c93=_0xc1aa[_0x377fe7];return _0x1c3c93;};'use strict';var client=require(_0xac1a('0x0'));exports[_0xac1a('0x1')]=function(_0x68630c){return client[_0xac1a('0x2')](_0xac1a('0x3'),{'body':_0x68630c,'log':_0xac1a('0x3')});};exports[_0xac1a('0x4')]=function(_0x4f67c5,_0x145174){return client[_0xac1a('0x2')]('UpdateMailQueueReport',{'body':_0x145174,'options':{'where':{'uniqueid':_0x4f67c5},'order':[['id',_0xac1a('0x5')]],'limit':0x1},'log':_0xac1a('0x6')});}; \ No newline at end of file +var _0x7310=['update','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x12526f,_0x4138a0){var _0x45ff44=function(_0x3a7f82){while(--_0x3a7f82){_0x12526f['push'](_0x12526f['shift']());}};_0x45ff44(++_0x4138a0);}(_0x7310,0x11f));var _0x0731=function(_0x3b69ab,_0x203420){_0x3b69ab=_0x3b69ab-0x0;var _0x23de31=_0x7310[_0x3b69ab];return _0x23de31;};'use strict';var client=require(_0x0731('0x0'));exports['create']=function(_0x150fc6){return client[_0x0731('0x1')](_0x0731('0x2'),{'body':_0x150fc6,'log':'CreateMailQueueReport'});};exports[_0x0731('0x3')]=function(_0x3adcbe,_0x1f2cd9){return client[_0x0731('0x1')]('UpdateMailQueueReport',{'body':_0x1f2cd9,'options':{'where':{'uniqueid':_0x3adcbe},'order':[['id','DESC']],'limit':0x1},'log':_0x0731('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index afb4a88..b9ecd68 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 _0x72ec=['../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','addTagsToChatInteraction'];(function(_0x5af9a7,_0x57f461){var _0x14030c=function(_0x7aa8f6){while(--_0x7aa8f6){_0x5af9a7['push'](_0x5af9a7['shift']());}};_0x14030c(++_0x57f461);}(_0x72ec,0x90));var _0xc72e=function(_0x836fec,_0x291263){_0x836fec=_0x836fec-0x0;var _0x4c406c=_0x72ec[_0x836fec];return _0x4c406c;};'use strict';var client=require(_0xc72e('0x0'));exports[_0xc72e('0x1')]=function(_0x26761a,_0x225b1b){return client['Request'](_0xc72e('0x2'),{'body':_0x225b1b,'options':{'where':{'id':_0x26761a}},'log':_0xc72e('0x3')});};exports['addTags']=function(_0x5b9e82,_0x1b0acd){return client[_0xc72e('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x1b0acd,'options':{'where':{'id':_0x5b9e82}},'log':_0xc72e('0x5')});}; \ No newline at end of file +var _0xe96a=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x4b9d3a,_0xca7fe0){var _0x2d6f32=function(_0x3c3154){while(--_0x3c3154){_0x4b9d3a['push'](_0x4b9d3a['shift']());}};_0x2d6f32(++_0xca7fe0);}(_0xe96a,0x181));var _0xae96=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0xe96a[_0x219fa0];return _0xc603fb;};'use strict';var client=require(_0xae96('0x0'));exports[_0xae96('0x1')]=function(_0x397764,_0x6c83fd){return client[_0xae96('0x2')](_0xae96('0x3'),{'body':_0x6c83fd,'options':{'where':{'id':_0x397764}},'log':_0xae96('0x4')});};exports[_0xae96('0x5')]=function(_0x190b1d,_0xc9382b){return client[_0xae96('0x2')](_0xae96('0x6'),{'body':_0xc9382b,'options':{'where':{'id':_0x190b1d}},'log':_0xae96('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e4fda13..1bb4c62 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 _0xe706=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x25fd71,_0x493b52){var _0x15917d=function(_0x4337f6){while(--_0x4337f6){_0x25fd71['push'](_0x25fd71['shift']());}};_0x15917d(++_0x493b52);}(_0xe706,0xa3));var _0x6e70=function(_0x40d394,_0x27f0de){_0x40d394=_0x40d394-0x0;var _0x4f285d=_0xe706[_0x40d394];return _0x4f285d;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(_0x311951){return client['Request'](_0x6e70('0x2'),{'body':_0x311951,'log':_0x6e70('0x3')});}; \ No newline at end of file +var _0xb4e6=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x59d948,_0x220a86){var _0x3fa872=function(_0x52c08d){while(--_0x52c08d){_0x59d948['push'](_0x59d948['shift']());}};_0x3fa872(++_0x220a86);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xb4e6[_0x1f83a5];return _0x45edf0;};'use strict';var client=require(_0x6b4e('0x0'));exports['create']=function(_0x2708ca){return client[_0x6b4e('0x1')](_0x6b4e('0x2'),{'body':_0x2708ca,'log':_0x6b4e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 07ff058..500e858 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 _0x9bc9=['User','name','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout'];(function(_0x1aa6c4,_0x1ecfc7){var _0x3a522d=function(_0x3f3634){while(--_0x3f3634){_0x1aa6c4['push'](_0x1aa6c4['shift']());}};_0x3a522d(++_0x1ecfc7);}(_0x9bc9,0xcc));var _0x99bc=function(_0x2efb0b,_0x4436c5){_0x2efb0b=_0x2efb0b-0x0;var _0x51fb16=_0x9bc9[_0x2efb0b];return _0x51fb16;};'use strict';var client=require(_0x99bc('0x0'));exports[_0x99bc('0x1')]=function(){return function(){return client['Request'](_0x99bc('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x99bc('0x3'),'strategy'],'include':[{'model':_0x99bc('0x4'),'as':'Agents','attributes':['id',_0x99bc('0x5'),_0x99bc('0x6'),_0x99bc('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xeac8=['Agents','getOpenchannelQueues','Request','name','timeout','strategy','User'];(function(_0x25bcaf,_0x3e0608){var _0x4f5cb7=function(_0x2a35f8){while(--_0x2a35f8){_0x25bcaf['push'](_0x25bcaf['shift']());}};_0x4f5cb7(++_0x3e0608);}(_0xeac8,0x1cf));var _0x8eac=function(_0x39eb92,_0x453097){_0x39eb92=_0x39eb92-0x0;var _0x2b5271=_0xeac8[_0x39eb92];return _0x2b5271;};'use strict';var client=require('../client');exports[_0x8eac('0x0')]=function(){return function(){return client[_0x8eac('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x8eac('0x2'),_0x8eac('0x3'),_0x8eac('0x4')],'include':[{'model':_0x8eac('0x5'),'as':_0x8eac('0x6'),'attributes':['id',_0x8eac('0x2'),'online','openchannelPause']}]},'log':_0x8eac('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 47789d0..15c5d1d 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 _0x9c32=['UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x9c32,0x15d));var _0x29c3=function(_0x1ce093,_0x1f6cad){_0x1ce093=_0x1ce093-0x0;var _0x302bd5=_0x9c32[_0x1ce093];return _0x302bd5;};'use strict';var client=require(_0x29c3('0x0'));exports[_0x29c3('0x1')]=function(_0x1ad1eb){return client['Request'](_0x29c3('0x2'),{'body':_0x1ad1eb,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x6349e9,_0xdd350e){return client['Request'](_0x29c3('0x3'),{'body':_0xdd350e,'options':{'where':{'uniqueid':_0x6349e9},'order':[['id','DESC']],'limit':0x1},'log':_0x29c3('0x3')});}; \ No newline at end of file +var _0x9a5b=['DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9a5b,0x88));var _0xb9a5=function(_0x21ced1,_0x5e3c69){_0x21ced1=_0x21ced1-0x0;var _0x392146=_0x9a5b[_0x21ced1];return _0x392146;};'use strict';var client=require('../client');exports[_0xb9a5('0x0')]=function(_0x202374){return client[_0xb9a5('0x1')](_0xb9a5('0x2'),{'body':_0x202374,'log':_0xb9a5('0x2')});};exports[_0xb9a5('0x3')]=function(_0x401f2f,_0x515672){return client[_0xb9a5('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x515672,'options':{'where':{'uniqueid':_0x401f2f},'order':[['id',_0xb9a5('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index cd58425..aedc8a4 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 _0x74f7=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74f7,0xbd));var _0x774f=function(_0x1acb34,_0x2e14a9){_0x1acb34=_0x1acb34-0x0;var _0x3f56b3=_0x74f7[_0x1acb34];return _0x3f56b3;};'use strict';var client=require('../client');exports['update']=function(_0x6b88fd,_0x18e97e){return client[_0x774f('0x0')]('UpdateSmsInteraction',{'body':_0x18e97e,'options':{'where':{'id':_0x6b88fd}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x3e996f,_0x232bc1){return client[_0x774f('0x0')](_0x774f('0x1'),{'body':_0x232bc1,'options':{'where':{'id':_0x3e996f}},'log':_0x774f('0x2')});}; \ No newline at end of file +var _0x5721=['addTags','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x9b8ad8,_0x1e0e85){var _0x35584e=function(_0x38472b){while(--_0x38472b){_0x9b8ad8['push'](_0x9b8ad8['shift']());}};_0x35584e(++_0x1e0e85);}(_0x5721,0xc2));var _0x1572=function(_0x256091,_0x4f06dd){_0x256091=_0x256091-0x0;var _0x404d65=_0x5721[_0x256091];return _0x404d65;};'use strict';var client=require(_0x1572('0x0'));exports[_0x1572('0x1')]=function(_0x4285b8,_0x16ee7f){return client[_0x1572('0x2')]('UpdateSmsInteraction',{'body':_0x16ee7f,'options':{'where':{'id':_0x4285b8}},'log':_0x1572('0x3')});};exports[_0x1572('0x4')]=function(_0x51ad65,_0x45d0c7){return client[_0x1572('0x2')]('AddTagsToSmsInteraction',{'body':_0x45d0c7,'options':{'where':{'id':_0x51ad65}},'log':_0x1572('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1ade6de..36bfdd6 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 _0x53d5=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x12ec3f,_0x1718a8){var _0x50dfc=function(_0x54407e){while(--_0x54407e){_0x12ec3f['push'](_0x12ec3f['shift']());}};_0x50dfc(++_0x1718a8);}(_0x53d5,0x1cc));var _0x553d=function(_0x4b48e5,_0xc3c425){_0x4b48e5=_0x4b48e5-0x0;var _0x210b17=_0x53d5[_0x4b48e5];return _0x210b17;};'use strict';var client=require(_0x553d('0x0'));exports[_0x553d('0x1')]=function(_0x217b81){return client[_0x553d('0x2')](_0x553d('0x3'),{'body':_0x217b81,'log':_0x553d('0x4')});}; \ No newline at end of file +var _0x2390=['create','createSmsMessage','../client'];(function(_0x11228b,_0x4c9db4){var _0x1ccc6a=function(_0x236e6a){while(--_0x236e6a){_0x11228b['push'](_0x11228b['shift']());}};_0x1ccc6a(++_0x4c9db4);}(_0x2390,0x1af));var _0x0239=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2390[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require(_0x0239('0x0'));exports[_0x0239('0x1')]=function(_0x98dcb){return client['Request']('CreateSmsMessage',{'body':_0x98dcb,'log':_0x0239('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5e26c99..69b2f63 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 _0xc04d=['GetSmsQueue','name','timeout','strategy','User','Agents','online','../client','Request'];(function(_0x2f7ae3,_0x223602){var _0x3fcce6=function(_0x1313e5){while(--_0x1313e5){_0x2f7ae3['push'](_0x2f7ae3['shift']());}};_0x3fcce6(++_0x223602);}(_0xc04d,0x15d));var _0xdc04=function(_0x4ddc7a,_0x5b6cb8){_0x4ddc7a=_0x4ddc7a-0x0;var _0x4547c1=_0xc04d[_0x4ddc7a];return _0x4547c1;};'use strict';var client=require(_0xdc04('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0xdc04('0x1')](_0xdc04('0x2'),{'options':{'raw':![],'attributes':['id',_0xdc04('0x3'),_0xdc04('0x4'),_0xdc04('0x5')],'include':[{'model':_0xdc04('0x6'),'as':_0xdc04('0x7'),'attributes':['id',_0xdc04('0x3'),_0xdc04('0x8'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0a1c=['smsPause','getSmsQueues','Request','GetSmsQueue','name','User','Agents','online'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x0a1c[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0xc0a1('0x0')](_0xc0a1('0x1'),{'options':{'raw':![],'attributes':['id',_0xc0a1('0x2'),'timeout','strategy'],'include':[{'model':_0xc0a1('0x3'),'as':_0xc0a1('0x4'),'attributes':['id',_0xc0a1('0x2'),_0xc0a1('0x5'),_0xc0a1('0x6')]}]},'log':_0xc0a1('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 8150acd..c135661 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 _0xb5fb=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0xb5fb,0x172));var _0xbb5f=function(_0x4d0be7,_0xe3a0d0){_0x4d0be7=_0x4d0be7-0x0;var _0x2a4910=_0xb5fb[_0x4d0be7];return _0x2a4910;};'use strict';var client=require(_0xbb5f('0x0'));exports[_0xbb5f('0x1')]=function(_0x1aeade){return client[_0xbb5f('0x2')](_0xbb5f('0x3'),{'body':_0x1aeade,'log':_0xbb5f('0x3')});};exports[_0xbb5f('0x4')]=function(_0x45910c,_0x13de76){return client[_0xbb5f('0x2')](_0xbb5f('0x5'),{'body':_0x13de76,'options':{'where':{'uniqueid':_0x45910c},'order':[['id',_0xbb5f('0x6')]],'limit':0x1},'log':_0xbb5f('0x5')});}; \ No newline at end of file +var _0x5987=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x5e5b4a,_0xaaad42){var _0x3cb46b=function(_0x56a340){while(--_0x56a340){_0x5e5b4a['push'](_0x5e5b4a['shift']());}};_0x3cb46b(++_0xaaad42);}(_0x5987,0x128));var _0x7598=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5987[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7598('0x0'));exports[_0x7598('0x1')]=function(_0x423b2c){return client[_0x7598('0x2')]('CreateSmsQueueReport',{'body':_0x423b2c,'log':_0x7598('0x3')});};exports[_0x7598('0x4')]=function(_0x2e9b80,_0x373ef6){return client[_0x7598('0x2')](_0x7598('0x5'),{'body':_0x373ef6,'options':{'where':{'uniqueid':_0x2e9b80},'order':[['id',_0x7598('0x6')]],'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 3716c2b..be6bdc5 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 _0xa3f2=['getAgents','Request','GetUser','name','pauseType','lastPauseAt','voicePause','chatPause','faxPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity'];(function(_0x1c2a31,_0x5ab97a){var _0xaabd37=function(_0x509d64){while(--_0x509d64){_0x1c2a31['push'](_0x1c2a31['shift']());}};_0xaabd37(++_0x5ab97a);}(_0xa3f2,0xff));var _0x2a3f=function(_0x226f6c,_0x78a1ab){_0x226f6c=_0x226f6c-0x0;var _0x127845=_0xa3f2[_0x226f6c];return _0x127845;};'use strict';var client=require('../client');exports[_0x2a3f('0x0')]=function(){return function(){return client[_0x2a3f('0x1')](_0x2a3f('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x2a3f('0x3'),'online',_0x2a3f('0x4'),_0x2a3f('0x5'),_0x2a3f('0x6'),_0x2a3f('0x7'),'mailPause',_0x2a3f('0x8'),'smsPause',_0x2a3f('0x9'),_0x2a3f('0xa'),_0x2a3f('0xb'),_0x2a3f('0xc'),_0x2a3f('0xd'),_0x2a3f('0xe'),_0x2a3f('0xf'),_0x2a3f('0x10')]},'log':_0x2a3f('0x0')});};}; \ No newline at end of file +var _0xa2c9=['mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity'];(function(_0xb9162,_0x219618){var _0x2baf6e=function(_0x5843b4){while(--_0x5843b4){_0xb9162['push'](_0xb9162['shift']());}};_0x2baf6e(++_0x219618);}(_0xa2c9,0x1cc));var _0x9a2c=function(_0x96a2d8,_0x5efce2){_0x96a2d8=_0x96a2d8-0x0;var _0x456a05=_0xa2c9[_0x96a2d8];return _0x456a05;};'use strict';var client=require('../client');exports[_0x9a2c('0x0')]=function(){return function(){return client[_0x9a2c('0x1')](_0x9a2c('0x2'),{'options':{'raw':!![],'where':{'role':_0x9a2c('0x3')},'attributes':['id',_0x9a2c('0x4'),_0x9a2c('0x5'),_0x9a2c('0x6'),_0x9a2c('0x7'),_0x9a2c('0x8'),_0x9a2c('0x9'),_0x9a2c('0xa'),_0x9a2c('0xb'),_0x9a2c('0xc'),'whatsappPause',_0x9a2c('0xd'),_0x9a2c('0xe'),_0x9a2c('0xf'),_0x9a2c('0x10'),'smsCapacity',_0x9a2c('0x11'),_0x9a2c('0x12')]},'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 4e800e9..3f7ee7b 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 _0xac21=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x297d6f,_0x12c8be){var _0x4e0852=function(_0x37780e){while(--_0x37780e){_0x297d6f['push'](_0x297d6f['shift']());}};_0x4e0852(++_0x12c8be);}(_0xac21,0x1af));var _0x1ac2=function(_0x2816b6,_0x42c866){_0x2816b6=_0x2816b6-0x0;var _0xc5e019=_0xac21[_0x2816b6];return _0xc5e019;};'use strict';var client=require('../client');exports[_0x1ac2('0x0')]=function(_0x3bfe28,_0x4e937a){return client[_0x1ac2('0x1')]('UpdateWhatsappInteraction',{'body':_0x4e937a,'options':{'where':{'id':_0x3bfe28}},'log':_0x1ac2('0x2')});};exports[_0x1ac2('0x3')]=function(_0x5b81be,_0x454461){return client['Request'](_0x1ac2('0x4'),{'body':_0x454461,'options':{'where':{'id':_0x5b81be}},'log':_0x1ac2('0x5')});}; \ No newline at end of file +var _0xb7a8=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x42f927,_0x389dad){var _0x2e4c5d=function(_0x563d53){while(--_0x563d53){_0x42f927['push'](_0x42f927['shift']());}};_0x2e4c5d(++_0x389dad);}(_0xb7a8,0xec));var _0x8b7a=function(_0x5b3e0a,_0x23ae42){_0x5b3e0a=_0x5b3e0a-0x0;var _0x12bcd0=_0xb7a8[_0x5b3e0a];return _0x12bcd0;};'use strict';var client=require('../client');exports[_0x8b7a('0x0')]=function(_0x31233b,_0x528b79){return client[_0x8b7a('0x1')](_0x8b7a('0x2'),{'body':_0x528b79,'options':{'where':{'id':_0x31233b}},'log':_0x8b7a('0x3')});};exports['addTags']=function(_0x3847b8,_0x2c7217){return client[_0x8b7a('0x1')](_0x8b7a('0x4'),{'body':_0x2c7217,'options':{'where':{'id':_0x3847b8}},'log':_0x8b7a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0b6ce4d..95da4d3 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 _0x4837=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x3e8a4b,_0x129838){var _0x2fcc79=function(_0x246756){while(--_0x246756){_0x3e8a4b['push'](_0x3e8a4b['shift']());}};_0x2fcc79(++_0x129838);}(_0x4837,0x161));var _0x7483=function(_0x1ca436,_0x4da10e){_0x1ca436=_0x1ca436-0x0;var _0x3420cd=_0x4837[_0x1ca436];return _0x3420cd;};'use strict';var client=require(_0x7483('0x0'));exports['create']=function(_0x2b21ce){return client[_0x7483('0x1')](_0x7483('0x2'),{'body':_0x2b21ce,'log':_0x7483('0x3')});}; \ No newline at end of file +var _0xcb42=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xcb42,0xde));var _0x2cb4=function(_0x40f5e0,_0x254544){_0x40f5e0=_0x40f5e0-0x0;var _0x54e0eb=_0xcb42[_0x40f5e0];return _0x54e0eb;};'use strict';var client=require(_0x2cb4('0x0'));exports[_0x2cb4('0x1')]=function(_0x32190e){return client[_0x2cb4('0x2')](_0x2cb4('0x3'),{'body':_0x32190e,'log':_0x2cb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8e8ba49..063ac67 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 _0xb10b=['whatsappPause','../client','Request','GetWhatsappQueue','name','strategy','User','Agents','online'];(function(_0x3dab80,_0x4965f4){var _0x3248d0=function(_0x56ba77){while(--_0x56ba77){_0x3dab80['push'](_0x3dab80['shift']());}};_0x3248d0(++_0x4965f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ab251,_0x41f7bb){_0x2ab251=_0x2ab251-0x0;var _0x4461c4=_0xb10b[_0x2ab251];return _0x4461c4;};'use strict';var client=require(_0xbb10('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xbb10('0x1')](_0xbb10('0x2'),{'options':{'raw':![],'attributes':['id',_0xbb10('0x3'),'timeout',_0xbb10('0x4')],'include':[{'model':_0xbb10('0x5'),'as':_0xbb10('0x6'),'attributes':['id',_0xbb10('0x3'),_0xbb10('0x7'),_0xbb10('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xfff0=['online','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','name'];(function(_0x245323,_0x3bf64d){var _0x5c2ba4=function(_0x76e2e){while(--_0x76e2e){_0x245323['push'](_0x245323['shift']());}};_0x5c2ba4(++_0x3bf64d);}(_0xfff0,0x139));var _0x0fff=function(_0x4a7f2c,_0x5edd5c){_0x4a7f2c=_0x4a7f2c-0x0;var _0x5ba49f=_0xfff0[_0x4a7f2c];return _0x5ba49f;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(){return function(){return client[_0x0fff('0x1')](_0x0fff('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0fff('0x3'),_0x0fff('0x4')],'include':[{'model':_0x0fff('0x5'),'as':'Agents','attributes':['id',_0x0fff('0x6'),_0x0fff('0x7'),'whatsappPause']}]},'log':_0x0fff('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b26e088..343040d 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 _0x3d17=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x5d980a,_0x45c84e){var _0x162916=function(_0x1fb846){while(--_0x1fb846){_0x5d980a['push'](_0x5d980a['shift']());}};_0x162916(++_0x45c84e);}(_0x3d17,0x17e));var _0x73d1=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x3d17[_0x5235dd];return _0x13059d;};'use strict';var client=require(_0x73d1('0x0'));exports[_0x73d1('0x1')]=function(_0x201ca1){return client[_0x73d1('0x2')](_0x73d1('0x3'),{'body':_0x201ca1,'log':_0x73d1('0x3')});};exports[_0x73d1('0x4')]=function(_0x1dc546,_0x2c2e18){return client[_0x73d1('0x2')](_0x73d1('0x5'),{'body':_0x2c2e18,'options':{'where':{'uniqueid':_0x1dc546},'order':[['id','DESC']],'limit':0x1},'log':_0x73d1('0x5')});}; \ No newline at end of file +var _0xe609=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe609,0x12e));var _0x9e60=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0xe609[_0x236209];return _0x2afd5b;};'use strict';var client=require(_0x9e60('0x0'));exports[_0x9e60('0x1')]=function(_0x7b2103){return client[_0x9e60('0x2')](_0x9e60('0x3'),{'body':_0x7b2103,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x2e0141,_0x30dfae){return client['Request'](_0x9e60('0x4'),{'body':_0x30dfae,'options':{'where':{'uniqueid':_0x2e0141},'order':[['id','DESC']],'limit':0x1},'log':_0x9e60('0x4')});}; \ 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 e5a6b3b..c9e5fdf 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 _0xefb3=['toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x276c29,_0x583cfe){var _0x91d3eb=function(_0xf030b3){while(--_0xf030b3){_0x276c29['push'](_0x276c29['shift']());}};_0x91d3eb(++_0x583cfe);}(_0xefb3,0x18c));var _0x3efb=function(_0x3e9677,_0x19663b){_0x3e9677=_0x3e9677-0x0;var _0x2c521f=_0xefb3[_0x3e9677];return _0x2c521f;};'use strict';var schema=require(_0x3efb('0x0'));var _=require(_0x3efb('0x1'));var util=require('util');var seqqueue=require(_0x3efb('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x3efb('0x3'));var queue=schema({'name':{'type':_0x3efb('0x4'),'required':!![],'message':_0x3efb('0x5')},'timeout':{'type':_0x3efb('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5c381a,_0x1d8e6d,_0x45d61a){return logger[_0x3efb('0x7')](util[_0x3efb('0x8')](_0x3efb('0x9'),_0x5c381a,_0x1d8e6d[_0x3efb('0xa')],_0x45d61a));}function handleFindAgent(_0xc3658){return function(_0x36090a){return _0x36090a['name'][_0x3efb('0xb')]()===_0xc3658['toLowerCase']();};}exports[_0x3efb('0xc')]=function(_0x5b6ee0,_0x27fc37,_0x52d510,_0x371a86){return function(_0x13f991){try{var _0x3f26f9={'name':_0x27fc37[0x0],'timeout':_0x27fc37[0x1]};var _0x5a5eee=queue[_0x3efb('0x0')](_0x3f26f9,{'typecast':!![]});if(_0x5a5eee[_0x3efb('0xd')]){logger[_0x3efb('0xe')](_0x3efb('0xf'),_0x5b6ee0,_['map'](_0x5a5eee,_0x3efb('0x10'))[_0x3efb('0x11')](',\x20'));_0x13f991['stop']();}else{var _0xdd105=_[_0x3efb('0x12')](_0x52d510[_0x3efb('0x13')],handleFindAgent(_0x3f26f9[_0x3efb('0xa')]));if(_0xdd105){var _0x1b6668=(_0x3f26f9[_0x3efb('0x14')]||0xa)*0x3e8;var _0x1ae0bb,_0x5103a6;var _0x470352=seqqueue[_0x3efb('0x15')](_0x1b6668);_0x470352['id']=_0x5b6ee0;_0x470352[_0x3efb('0x16')]=_0x1b6668;_0x470352[_0x3efb('0x17')]=_0x371a86['channel'];writeLog(_0x5b6ee0,_0xdd105,util[_0x3efb('0x8')](_0x3efb('0x18'),_0x1b6668));_0x52d510[_0x3efb('0x19')][_0x5b6ee0]['on'](_0x3efb('0x1a'),function(){logger[_0x3efb('0x7')](_0x3efb('0x1b'),_0x5b6ee0);clearTimeout(_0x5103a6);_0x5103a6=undefined;_0x470352['close']();if(_0x52d510[_0x3efb('0x19')][_0x5b6ee0]){delete _0x52d510[_0x3efb('0x19')][_0x5b6ee0];}_0x13f991[_0x3efb('0x1c')]();});_0x52d510[_0x3efb('0x19')][_0x5b6ee0]['on'](_0x3efb('0x1d'),function(){if(_0x52d510['rules'][_0x5b6ee0]){delete _0x52d510[_0x3efb('0x19')][_0x5b6ee0];}});_0x5103a6=setTimeout(function(){logger[_0x3efb('0x7')](_0x3efb('0x1e'),_0x5b6ee0);clearTimeout(_0x5103a6);_0x470352[_0x3efb('0x1f')]();_0x13f991[_0x3efb('0x20')]();},_0x1b6668);strategy[_0x3efb('0x21')](_0x470352,_0xdd105,_0x52d510,_0x371a86);}else{logger['error'](_0x3efb('0x22'),_0x5b6ee0,_0x3f26f9['name']);_0x13f991['stop']();}}}catch(_0x1b901b){console[_0x3efb('0x23')](_0x1b901b);logger[_0x3efb('0xe')]('[%s][QUEUE]\x20%s',_0x5b6ee0,_0x1b901b[_0x3efb('0x24')]);_0x13f991['stop']();}};}; \ No newline at end of file +var _0xf80a=['seq-queue','../../../../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','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','util'];(function(_0x11c24f,_0x53ecf6){var _0x5e995e=function(_0x4e55cb){while(--_0x4e55cb){_0x11c24f['push'](_0x11c24f['shift']());}};_0x5e995e(++_0x53ecf6);}(_0xf80a,0x1a2));var _0xaf80=function(_0x1c61b2,_0x258710){_0x1c61b2=_0x1c61b2-0x0;var _0x534f2b=_0xf80a[_0x1c61b2];return _0x534f2b;};'use strict';var schema=require(_0xaf80('0x0'));var _=require('lodash');var util=require(_0xaf80('0x1'));var seqqueue=require(_0xaf80('0x2'));var logger=require(_0xaf80('0x3'))(_0xaf80('0x4'));var strategy=require(_0xaf80('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xaf80('0x6')},'timeout':{'type':_0xaf80('0x7'),'message':_0xaf80('0x8')}});function writeLog(_0x8502c8,_0x928a6b,_0x234fa){return logger['info'](util[_0xaf80('0x9')](_0xaf80('0xa'),_0x8502c8,_0x928a6b[_0xaf80('0xb')],_0x234fa));}function handleFindAgent(_0x339a7e){return function(_0x59c614){return _0x59c614[_0xaf80('0xb')][_0xaf80('0xc')]()===_0x339a7e[_0xaf80('0xc')]();};}exports[_0xaf80('0xd')]=function(_0x51a1df,_0x19d532,_0x285180,_0x20bcfa){return function(_0x5939c2){try{var _0x5c88ac={'name':_0x19d532[0x0],'timeout':_0x19d532[0x1]};var _0x8a50f9=queue[_0xaf80('0x0')](_0x5c88ac,{'typecast':!![]});if(_0x8a50f9['length']){logger[_0xaf80('0xe')](_0xaf80('0xf'),_0x51a1df,_[_0xaf80('0x10')](_0x8a50f9,_0xaf80('0x11'))[_0xaf80('0x12')](',\x20'));_0x5939c2[_0xaf80('0x13')]();}else{var _0x26cdc7=_['find'](_0x285180[_0xaf80('0x14')],handleFindAgent(_0x5c88ac['name']));if(_0x26cdc7){var _0x5c3b03=(_0x5c88ac[_0xaf80('0x15')]||0xa)*0x3e8;var _0x4904b6,_0x5d443d;var _0x5af967=seqqueue['createQueue'](_0x5c3b03);_0x5af967['id']=_0x51a1df;_0x5af967[_0xaf80('0x16')]=_0x5c3b03;_0x5af967[_0xaf80('0x17')]=_0x20bcfa[_0xaf80('0x17')];writeLog(_0x51a1df,_0x26cdc7,util[_0xaf80('0x9')](_0xaf80('0x18'),_0x5c3b03));_0x285180[_0xaf80('0x19')][_0x51a1df]['on'](_0xaf80('0x1a'),function(){logger[_0xaf80('0x1b')](_0xaf80('0x1c'),_0x51a1df);clearTimeout(_0x5d443d);_0x5d443d=undefined;_0x5af967[_0xaf80('0x1d')]();if(_0x285180[_0xaf80('0x19')][_0x51a1df]){delete _0x285180[_0xaf80('0x19')][_0x51a1df];}_0x5939c2[_0xaf80('0x13')]();});_0x285180[_0xaf80('0x19')][_0x51a1df]['on'](_0xaf80('0x1e'),function(){if(_0x285180['rules'][_0x51a1df]){delete _0x285180[_0xaf80('0x19')][_0x51a1df];}});_0x5d443d=setTimeout(function(){logger[_0xaf80('0x1b')](_0xaf80('0x1f'),_0x51a1df);clearTimeout(_0x5d443d);_0x5af967[_0xaf80('0x1d')]();_0x5939c2[_0xaf80('0x20')]();},_0x5c3b03);strategy['agent'](_0x5af967,_0x26cdc7,_0x285180,_0x20bcfa);}else{logger[_0xaf80('0xe')](_0xaf80('0x21'),_0x51a1df,_0x5c88ac[_0xaf80('0xb')]);_0x5939c2[_0xaf80('0x13')]();}}}catch(_0x3cc829){console[_0xaf80('0x22')](_0x3cc829);logger[_0xaf80('0xe')]('[%s][QUEUE]\x20%s',_0x51a1df,_0x3cc829['stack']);_0x5939c2[_0xaf80('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 6b599eb..3f86c26 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 _0x4a6d=['created','isEmpty','Message','create','then','body','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','catch','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction'];(function(_0x1cc74a,_0x4e217e){var _0x4b94ba=function(_0x33a6f5){while(--_0x33a6f5){_0x1cc74a['push'](_0x1cc74a['shift']());}};_0x4b94ba(++_0x4e217e);}(_0x4a6d,0x183));var _0xd4a6=function(_0xd9b0dc,_0x26108e){_0xd9b0dc=_0xd9b0dc-0x0;var _0x57ba6f=_0x4a6d[_0xd9b0dc];return _0x57ba6f;};'use strict';var _=require('lodash');var moment=require(_0xd4a6('0x0'));var AWS=require(_0xd4a6('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd4a6('0x2'));var rpc={'chatMessage':require(_0xd4a6('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd4a6('0x4')),'smsMessage':require(_0xd4a6('0x5')),'faxMessage':require(_0xd4a6('0x6')),'whatsappMessage':require(_0xd4a6('0x7'))};exports[_0xd4a6('0x8')]=function(_0x16b97b,_0x459099){return function(_0x3cedc3){try{if(!_[_0xd4a6('0x9')](this['interaction'][_0xd4a6('0xa')])){logger[_0xd4a6('0xb')](_0xd4a6('0xc'),_0x16b97b,_0xd4a6('0xd'));return _0x3cedc3[_0xd4a6('0xe')]();}var _0x2b8b17={'ContactId':this[_0xd4a6('0xf')]['id'],'sentAt':moment()[_0xd4a6('0x10')](_0xd4a6('0x11')),'direction':_0xd4a6('0x12')};if(this[_0xd4a6('0x13')]===_0xd4a6('0x14')||this[_0xd4a6('0x13')]===_0xd4a6('0x15')){_0x2b8b17[_0xd4a6('0x16')]=this['interaction']['phone'];}var _0x2bcc28=this[_0xd4a6('0x13')];if(_0x2bcc28===_0xd4a6('0x17')){_0x2b8b17[_0xd4a6('0x18')]=this['account']['id'];}else{_0x2b8b17[_['upperFirst'](_0x2bcc28)+'AccountId']=this[_0xd4a6('0x19')]['id'];}_0x2b8b17[_[_0xd4a6('0x1a')](_0x2bcc28)+_0xd4a6('0x1b')]=this[_0xd4a6('0x1c')]['id'];if(this[_0xd4a6('0x1c')][_0xd4a6('0x1d')]){var _0x263f2f=_0x459099[0x4];if(!_[_0xd4a6('0x1e')](_0x263f2f)){_0x2b8b17['body']=utils['getMustacheRender'](_0x263f2f,this);return rpc[_0x2bcc28+_0xd4a6('0x1f')][_0xd4a6('0x20')](_0x2b8b17)[_0xd4a6('0x21')](function(_0x4fa11c){logger[_0xd4a6('0xb')](_0xd4a6('0xc'),_0x16b97b,_0x2b8b17[_0xd4a6('0x22')]);})['catch'](function(_0x49cdf4){logger[_0xd4a6('0x23')](_0xd4a6('0xc'),_0x16b97b,JSON['stringify'](_0x49cdf4));})[_0xd4a6('0x24')](function(){logger[_0xd4a6('0xb')](_0xd4a6('0x25'),_0x16b97b);_0x3cedc3[_0xd4a6('0x26')]();});}else{logger[_0xd4a6('0xb')](_0xd4a6('0x27'),_0x16b97b);_0x3cedc3[_0xd4a6('0x26')]();}}else{var _0x53a91f=this;var _0x26113f=new AWS[(_0xd4a6('0x28'))]({'accessKeyId':_0x459099[0x0],'secretAccessKey':_0x459099[0x1],'region':_0x459099[0x2]});var _0x160b0e={'botAlias':_0xd4a6('0x29'),'botName':_0x459099[0x3],'inputText':this['message']['body'],'userId':this[_0xd4a6('0x13')]+':'+this[_0xd4a6('0x1c')]['id'][_0xd4a6('0x2a')]()};_0x26113f[_0xd4a6('0x2b')](_0x160b0e,function(_0x50c038,_0x5e005d){if(_0x50c038){logger['error'](_0xd4a6('0xc'),_0x16b97b,_0x50c038[_0xd4a6('0x2c')]);_0x3cedc3['next']();}else if(_0x5e005d&&_0x5e005d['message']){_0x53a91f[_0xd4a6('0x22')][_0xd4a6('0x2d')]=_0x5e005d;_0x2b8b17[_0xd4a6('0x22')]=_0x5e005d[_0xd4a6('0x2c')];_0x2b8b17[_0xd4a6('0x2e')]=_0xd4a6('0x2d');_0x2b8b17[_0xd4a6('0x2f')]=JSON[_0xd4a6('0x30')](_0x5e005d);return rpc[_0x2bcc28+'Message'][_0xd4a6('0x20')](_0x2b8b17)[_0xd4a6('0x21')](function(_0x2298c1){logger['info'](_0xd4a6('0xc'),_0x16b97b,_0x2b8b17[_0xd4a6('0x22')]);if(_0x5e005d[_0xd4a6('0x31')]==_0xd4a6('0x32')){_0x3cedc3['next']();}else{_0x3cedc3[_0xd4a6('0x26')]();}})[_0xd4a6('0x33')](function(_0x3ba389){logger[_0xd4a6('0x23')](_0xd4a6('0xc'),_0x16b97b,JSON[_0xd4a6('0x30')](_0x3ba389));_0x3cedc3['next']();});}else{_0x3cedc3[_0xd4a6('0xe')]();}});}}catch(_0x5a8834){logger[_0xd4a6('0x23')](_0xd4a6('0xc'),_0x16b97b,JSON[_0xd4a6('0x30')](_0x5a8834));_0x3cedc3[_0xd4a6('0x26')]();}};}; \ No newline at end of file +var _0xb0d7=['phone','ChatWebsiteId','account','upperFirst','created','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil','interaction','UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp'];(function(_0x40cb87,_0x3ac13a){var _0x1e26c7=function(_0x5ba52e){while(--_0x5ba52e){_0x40cb87['push'](_0x40cb87['shift']());}};_0x1e26c7(++_0x3ac13a);}(_0xb0d7,0xa8));var _0x7b0d=function(_0x2415e5,_0x138c0a){_0x2415e5=_0x2415e5-0x0;var _0x526d3c=_0xb0d7[_0x2415e5];return _0x526d3c;};'use strict';var _=require(_0x7b0d('0x0'));var moment=require(_0x7b0d('0x1'));var AWS=require(_0x7b0d('0x2'));var utils=require(_0x7b0d('0x3'));var logger=require(_0x7b0d('0x4'))(_0x7b0d('0x5'));var rpc={'chatMessage':require(_0x7b0d('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7b0d('0x7')),'smsMessage':require(_0x7b0d('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x125582,_0x5f25f6){return function(_0x38796d){try{if(!_[_0x7b0d('0x9')](this[_0x7b0d('0xa')][_0x7b0d('0xb')])){logger[_0x7b0d('0xc')]('[%s][AMAZONLEX]\x20%s',_0x125582,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x38796d[_0x7b0d('0xd')]();}var _0x3768f7={'ContactId':this[_0x7b0d('0xe')]['id'],'sentAt':moment()['format'](_0x7b0d('0xf')),'direction':_0x7b0d('0x10')};if(this[_0x7b0d('0x11')]===_0x7b0d('0x12')||this[_0x7b0d('0x11')]===_0x7b0d('0x13')){_0x3768f7[_0x7b0d('0x14')]=this[_0x7b0d('0xa')]['phone'];}var _0x572f7c=this[_0x7b0d('0x11')];if(_0x572f7c==='chat'){_0x3768f7[_0x7b0d('0x15')]=this[_0x7b0d('0x16')]['id'];}else{_0x3768f7[_['upperFirst'](_0x572f7c)+'AccountId']=this['account']['id'];}_0x3768f7[_[_0x7b0d('0x17')](_0x572f7c)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x7b0d('0x18')]){var _0xeb546f=_0x5f25f6[0x4];if(!_[_0x7b0d('0x19')](_0xeb546f)){_0x3768f7[_0x7b0d('0x1a')]=utils['getMustacheRender'](_0xeb546f,this);return rpc[_0x572f7c+_0x7b0d('0x1b')][_0x7b0d('0x1c')](_0x3768f7)[_0x7b0d('0x1d')](function(_0x4ed10a){logger[_0x7b0d('0xc')](_0x7b0d('0x1e'),_0x125582,_0x3768f7[_0x7b0d('0x1a')]);})[_0x7b0d('0x1f')](function(_0x55ea1d){logger[_0x7b0d('0x20')](_0x7b0d('0x1e'),_0x125582,JSON[_0x7b0d('0x21')](_0x55ea1d));})[_0x7b0d('0x22')](function(){logger[_0x7b0d('0xc')](_0x7b0d('0x23'),_0x125582);_0x38796d[_0x7b0d('0x24')]();});}else{logger[_0x7b0d('0xc')](_0x7b0d('0x25'),_0x125582);_0x38796d[_0x7b0d('0x24')]();}}else{var _0x4f42e0=this;var _0x4917b7=new AWS[(_0x7b0d('0x26'))]({'accessKeyId':_0x5f25f6[0x0],'secretAccessKey':_0x5f25f6[0x1],'region':_0x5f25f6[0x2]});var _0xd0770c={'botAlias':_0x7b0d('0x27'),'botName':_0x5f25f6[0x3],'inputText':this[_0x7b0d('0x28')][_0x7b0d('0x1a')],'userId':this[_0x7b0d('0x11')]+':'+this[_0x7b0d('0xa')]['id'][_0x7b0d('0x29')]()};_0x4917b7[_0x7b0d('0x2a')](_0xd0770c,function(_0x1ac387,_0x3a989f){if(_0x1ac387){logger[_0x7b0d('0x20')](_0x7b0d('0x1e'),_0x125582,_0x1ac387[_0x7b0d('0x28')]);_0x38796d[_0x7b0d('0xd')]();}else if(_0x3a989f&&_0x3a989f[_0x7b0d('0x28')]){_0x4f42e0[_0x7b0d('0x1a')][_0x7b0d('0x2b')]=_0x3a989f;_0x3768f7[_0x7b0d('0x1a')]=_0x3a989f['message'];_0x3768f7[_0x7b0d('0x2c')]=_0x7b0d('0x2b');_0x3768f7[_0x7b0d('0x2d')]=JSON[_0x7b0d('0x21')](_0x3a989f);return rpc[_0x572f7c+_0x7b0d('0x1b')][_0x7b0d('0x1c')](_0x3768f7)[_0x7b0d('0x1d')](function(_0xdcf704){logger[_0x7b0d('0xc')]('[%s][AMAZONLEX]\x20%s',_0x125582,_0x3768f7[_0x7b0d('0x1a')]);if(_0x3a989f[_0x7b0d('0x2e')]=='Failed'){_0x38796d[_0x7b0d('0xd')]();}else{_0x38796d[_0x7b0d('0x24')]();}})[_0x7b0d('0x1f')](function(_0x43785d){logger[_0x7b0d('0x20')](_0x7b0d('0x1e'),_0x125582,JSON[_0x7b0d('0x21')](_0x43785d));_0x38796d[_0x7b0d('0xd')]();});}else{_0x38796d[_0x7b0d('0xd')]();}});}}catch(_0x45f5bc){logger[_0x7b0d('0x20')]('[%s][AMAZONLEX]\x20%s',_0x125582,JSON[_0x7b0d('0x21')](_0x45f5bc));_0x38796d[_0x7b0d('0x24')]();}};}; \ 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 51a8293..5707831 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 _0x9906=['','replace','','headers','auto-replied','All','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','catch','finally','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','auth','user','messageId','html'];(function(_0x1f3cfa,_0x2f0c83){var _0xab9465=function(_0x58262a){while(--_0x58262a){_0x1f3cfa['push'](_0x1f3cfa['shift']());}};_0xab9465(++_0x2f0c83);}(_0x9906,0x1f1));var _0x6990=function(_0x127ea2,_0x5c0fbc){_0x127ea2=_0x127ea2-0x0;var _0x484b38=_0x9906[_0x127ea2];return _0x484b38;};'use strict';var _=require(_0x6990('0x0'));var moment=require(_0x6990('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6990('0x2'));var rpc={'chatMessage':require(_0x6990('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6990('0x4')),'smsMessage':require(_0x6990('0x5')),'faxMessage':require(_0x6990('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x6990('0x7'));exports[_0x6990('0x8')]=function(_0x466c2a,_0x560584){return function(_0x1d3f5f){try{if(_0x560584[0x0]==='1'&&(_[_0x6990('0x9')](this['interaction'][_0x6990('0xa')])||!this[_0x6990('0xb')][_0x6990('0xa')])){logger['info'](_0x6990('0xc'),_0x466c2a,'Autoreply\x20already\x20sent');return _0x1d3f5f[_0x6990('0xd')]();}var _0x5afdfe=this[_0x6990('0xe')];var _0x2dd832={'ContactId':this[_0x6990('0xf')]['id'],'sentAt':moment()[_0x6990('0x10')](_0x6990('0x11')),'direction':_0x6990('0x12')};if(this[_0x6990('0xe')]===_0x6990('0x13')){_0x2dd832[_0x6990('0x14')]=utils[_0x6990('0x15')](_0x560584[0x2],this);}else{_0x2dd832[_0x6990('0x14')]=utils['getMustacheRender'](_0x560584[0x1],this);}if(this[_0x6990('0x16')]){_0x2dd832['to']=this[_0x6990('0x16')][_0x6990('0x17')]||'';if(this['channel']===_0x6990('0x13')&&_0x560584[0x1]==='1'){_0x2dd832['cc']=this[_0x6990('0x16')]['cc']||'';}_0x2dd832[_0x6990('0x17')]=this[_0x6990('0x16')]['to']||'';_0x2dd832[_0x6990('0x18')]=this[_0x6990('0x16')][_0x6990('0x18')]||'';_0x2dd832['read']=!![];if(this['message'][_0x6990('0x19')]){_0x2dd832[_0x6990('0x19')]='';_0x2dd832[_0x6990('0x19')]+=_[_0x6990('0x1a')](this[_0x6990('0x16')][_0x6990('0x19')],_0x6990('0x1b'))?'':_0x6990('0x1c');_0x2dd832[_0x6990('0x19')]+=this['message'][_0x6990('0x19')];}}if(this[_0x6990('0xe')]==='chat'){_0x2dd832['ChatWebsiteId']=this[_0x6990('0x1d')]['id'];}else{_0x2dd832[_[_0x6990('0x1e')](this['channel'])+_0x6990('0x1f')]=this[_0x6990('0x1d')]['id'];}_0x2dd832[_[_0x6990('0x1e')](this[_0x6990('0xe')])+'InteractionId']=this[_0x6990('0xb')]['id'];if(rpc[this[_0x6990('0xe')]+_0x6990('0x20')]){if(this[_0x6990('0xe')]===_0x6990('0x13')){var _0x575e22={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x6990('0x21')]['service']){_0x575e22[_0x6990('0x22')]=this[_0x6990('0x1d')]['Smtp'][_0x6990('0x22')];}else{_0x575e22[_0x6990('0x23')]=this[_0x6990('0x1d')][_0x6990('0x21')][_0x6990('0x23')];_0x575e22[_0x6990('0x24')]=this[_0x6990('0x1d')][_0x6990('0x21')][_0x6990('0x24')];_0x575e22[_0x6990('0x25')]=this[_0x6990('0x1d')][_0x6990('0x21')][_0x6990('0x25')];}if(this[_0x6990('0x1d')][_0x6990('0x21')][_0x6990('0x26')]){_0x575e22[_0x6990('0x27')]={'user':this[_0x6990('0x1d')][_0x6990('0x21')][_0x6990('0x28')],'pass':this[_0x6990('0x1d')][_0x6990('0x21')]['pass']};}_0x2dd832['inReplyTo']=this[_0x6990('0x16')][_0x6990('0x29')];_0x2dd832[_0x6990('0x2a')]=_0x6990('0x2b')+_[_0x6990('0x2c')](_0x2dd832[_0x6990('0x14')],_0x6990('0x2d'),_0x6990('0x2e'))+_0x6990('0x2f');_0x2dd832[_0x6990('0x30')]={'Auto-Submitted':_0x6990('0x31'),'X-Auto-Response-Suppress':_0x6990('0x32'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x575e22,_0x2dd832)['then'](function(_0x4da769){logger[_0x6990('0x33')](_0x6990('0x34'),_0x466c2a);_0x2dd832['messageId']=_0x4da769[_0x6990('0x16')]['messageId'];return rpc[_0x5afdfe+_0x6990('0x20')]['create'](_0x2dd832);})[_0x6990('0x35')](function(_0x10ccde){logger[_0x6990('0x33')](_0x6990('0xc'),_0x466c2a,JSON[_0x6990('0x36')](_0x10ccde));})['catch'](function(_0x49f36a){logger[_0x6990('0x37')](_0x6990('0x38'),_0x466c2a,JSON[_0x6990('0x36')](_0x49f36a));})['finally'](function(){_0x1d3f5f['next']();});}else{return rpc[this['channel']+_0x6990('0x20')]['create'](_0x2dd832)[_0x6990('0x35')](function(_0x3b2eef){logger['info'](_0x6990('0xc'),_0x466c2a,_0x2dd832[_0x6990('0x14')]);})[_0x6990('0x39')](function(_0x11d1b5){logger[_0x6990('0x37')](_0x6990('0xc'),_0x466c2a,JSON[_0x6990('0x36')](_0x11d1b5));})[_0x6990('0x3a')](function(){_0x1d3f5f['next']();});}}}catch(_0x5c8981){logger[_0x6990('0x37')](_0x6990('0xc'),_0x466c2a,JSON[_0x6990('0x36')](_0x5c8981));_0x1d3f5f[_0x6990('0x3b')]();}};}; \ No newline at end of file +var _0xb955=['subject','Re:','Re:\x20','chat','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','','','headers','auto-replied','All','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','stringify','error','finally','catch','stop','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','read'];(function(_0x162246,_0x4e5038){var _0x32ac95=function(_0x22270b){while(--_0x22270b){_0x162246['push'](_0x162246['shift']());}};_0x32ac95(++_0x4e5038);}(_0xb955,0x123));var _0x5b95=function(_0x311f4a,_0x9d32cc){_0x311f4a=_0x311f4a-0x0;var _0x3fb94e=_0xb955[_0x311f4a];return _0x3fb94e;};'use strict';var _=require(_0x5b95('0x0'));var moment=require(_0x5b95('0x1'));var utils=require(_0x5b95('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x5b95('0x3')),'openchannelMessage':require(_0x5b95('0x4')),'mailMessage':require(_0x5b95('0x5')),'smsMessage':require(_0x5b95('0x6')),'faxMessage':require(_0x5b95('0x7')),'whatsappMessage':require(_0x5b95('0x8'))};var mailRpc=require(_0x5b95('0x9'));exports[_0x5b95('0xa')]=function(_0x1d0d77,_0x392ee2){return function(_0x4eb97a){try{if(_0x392ee2[0x0]==='1'&&(_[_0x5b95('0xb')](this[_0x5b95('0xc')]['created'])||!this['interaction'][_0x5b95('0xd')])){logger[_0x5b95('0xe')](_0x5b95('0xf'),_0x1d0d77,_0x5b95('0x10'));return _0x4eb97a[_0x5b95('0x11')]();}var _0x2c05a1=this[_0x5b95('0x12')];var _0x5d757d={'ContactId':this[_0x5b95('0x13')]['id'],'sentAt':moment()['format'](_0x5b95('0x14')),'direction':_0x5b95('0x15')};if(this[_0x5b95('0x12')]==='mail'){_0x5d757d[_0x5b95('0x16')]=utils[_0x5b95('0x17')](_0x392ee2[0x2],this);}else{_0x5d757d[_0x5b95('0x16')]=utils['getMustacheRender'](_0x392ee2[0x1],this);}if(this[_0x5b95('0x18')]){_0x5d757d['to']=this[_0x5b95('0x18')][_0x5b95('0x19')]||'';if(this['channel']===_0x5b95('0x1a')&&_0x392ee2[0x1]==='1'){_0x5d757d['cc']=this[_0x5b95('0x18')]['cc']||'';}_0x5d757d['from']=this['message']['to']||'';_0x5d757d[_0x5b95('0x1b')]=this['message'][_0x5b95('0x1b')]||'';_0x5d757d[_0x5b95('0x1c')]=!![];if(this[_0x5b95('0x18')][_0x5b95('0x1d')]){_0x5d757d[_0x5b95('0x1d')]='';_0x5d757d['subject']+=_['startsWith'](this[_0x5b95('0x18')][_0x5b95('0x1d')],_0x5b95('0x1e'))?'':_0x5b95('0x1f');_0x5d757d['subject']+=this[_0x5b95('0x18')]['subject'];}}if(this[_0x5b95('0x12')]===_0x5b95('0x20')){_0x5d757d['ChatWebsiteId']=this[_0x5b95('0x21')]['id'];}else{_0x5d757d[_[_0x5b95('0x22')](this[_0x5b95('0x12')])+_0x5b95('0x23')]=this['account']['id'];}_0x5d757d[_[_0x5b95('0x22')](this[_0x5b95('0x12')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x5b95('0x12')]+_0x5b95('0x24')]){if(this[_0x5b95('0x12')]===_0x5b95('0x1a')){var _0x257e2a={'tls':{'rejectUnauthorized':![]}};if(this[_0x5b95('0x21')][_0x5b95('0x25')][_0x5b95('0x26')]){_0x257e2a[_0x5b95('0x26')]=this['account']['Smtp'][_0x5b95('0x26')];}else{_0x257e2a[_0x5b95('0x27')]=this[_0x5b95('0x21')][_0x5b95('0x25')][_0x5b95('0x27')];_0x257e2a[_0x5b95('0x28')]=this[_0x5b95('0x21')][_0x5b95('0x25')]['port'];_0x257e2a[_0x5b95('0x29')]=this['account'][_0x5b95('0x25')][_0x5b95('0x29')];}if(this[_0x5b95('0x21')][_0x5b95('0x25')][_0x5b95('0x2a')]){_0x257e2a['auth']={'user':this['account'][_0x5b95('0x25')][_0x5b95('0x2b')],'pass':this[_0x5b95('0x21')]['Smtp'][_0x5b95('0x2c')]};}_0x5d757d[_0x5b95('0x2d')]=this[_0x5b95('0x18')][_0x5b95('0x2e')];_0x5d757d[_0x5b95('0x2f')]=_0x5b95('0x30')+_['replace'](_0x5d757d[_0x5b95('0x16')],_0x5b95('0x31'),_0x5b95('0x32'))+_0x5b95('0x33');_0x5d757d[_0x5b95('0x34')]={'Auto-Submitted':_0x5b95('0x35'),'X-Auto-Response-Suppress':_0x5b95('0x36'),'Precedence':'auto_reply'};return mailRpc[_0x5b95('0x37')](_0x257e2a,_0x5d757d)['then'](function(_0x246ec0){logger['info'](_0x5b95('0x38'),_0x1d0d77);_0x5d757d[_0x5b95('0x2e')]=_0x246ec0[_0x5b95('0x18')][_0x5b95('0x2e')];return rpc[_0x2c05a1+_0x5b95('0x24')][_0x5b95('0x39')](_0x5d757d);})[_0x5b95('0x3a')](function(_0x103f77){logger[_0x5b95('0xe')](_0x5b95('0xf'),_0x1d0d77,JSON[_0x5b95('0x3b')](_0x103f77));})['catch'](function(_0x309869){logger[_0x5b95('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1d0d77,JSON[_0x5b95('0x3b')](_0x309869));})[_0x5b95('0x3d')](function(){_0x4eb97a[_0x5b95('0x11')]();});}else{return rpc[this[_0x5b95('0x12')]+'Message']['create'](_0x5d757d)['then'](function(_0x3e1f0a){logger['info'](_0x5b95('0xf'),_0x1d0d77,_0x5d757d[_0x5b95('0x16')]);})[_0x5b95('0x3e')](function(_0x2d6732){logger[_0x5b95('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1d0d77,JSON['stringify'](_0x2d6732));})[_0x5b95('0x3d')](function(){_0x4eb97a[_0x5b95('0x11')]();});}}}catch(_0x703ebd){logger[_0x5b95('0x3c')](_0x5b95('0xf'),_0x1d0d77,JSON[_0x5b95('0x3b')](_0x703ebd));_0x4eb97a[_0x5b95('0x3f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 22a30d3..82e0be1 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cd0=['interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update'];(function(_0x314585,_0x542cf9){var _0x4ca138=function(_0x30669d){while(--_0x30669d){_0x314585['push'](_0x314585['shift']());}};_0x4ca138(++_0x542cf9);}(_0x2cd0,0x10f));var _0x02cd=function(_0x53d0ab,_0x32774c){_0x53d0ab=_0x53d0ab-0x0;var _0x3eae64=_0x2cd0[_0x53d0ab];return _0x3eae64;};'use strict';var moment=require(_0x02cd('0x0'));var logger=require(_0x02cd('0x1'))(_0x02cd('0x2'));var rpc={'chatInteraction':require(_0x02cd('0x3')),'openchannelInteraction':require(_0x02cd('0x4')),'smsInteraction':require(_0x02cd('0x5')),'mailInteraction':require(_0x02cd('0x6')),'faxInteraction':require(_0x02cd('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x02cd('0x8')]=function(_0x3c4a73,_0xd05c09,_0x17860f,_0x5172cc){return function(_0x22bcc3){try{logger[_0x02cd('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x3c4a73,_0xd05c09[0x0]);var _0x544510={'closed':0x1,'closedAt':moment()['format'](_0x02cd('0xa')),'closeReason':_0x02cd('0xb'),'disposition':_0xd05c09[0x0]};if(rpc[_0x5172cc['channel']+'Interaction']){rpc[_0x5172cc[_0x02cd('0xc')]+_0x02cd('0xd')][_0x02cd('0xe')](_0x5172cc[_0x02cd('0xf')]['id'],_0x544510)[_0x02cd('0x10')](function(_0x200b12){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3c4a73,_0x5172cc[_0x02cd('0xf')]['id']);})[_0x02cd('0x11')](function(_0x1bce6c){logger[_0x02cd('0x12')](_0x02cd('0x13'),_0x3c4a73,JSON[_0x02cd('0x14')](_0x1bce6c));})['finally'](function(){_0x22bcc3[_0x02cd('0x15')]();});}}catch(_0x52bbe6){logger[_0x02cd('0x12')]('[%s][CLOSE]\x20%s',_0x3c4a73,JSON['stringify'](_0x52bbe6));_0x22bcc3['stop']();}};}; \ No newline at end of file +var _0xf2e0=['Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x2f8255,_0x44ff85){var _0x2207f6=function(_0x30c5c2){while(--_0x30c5c2){_0x2f8255['push'](_0x2f8255['shift']());}};_0x2207f6(++_0x44ff85);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf2e0[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x0f2e('0x0'));var logger=require(_0x0f2e('0x1'))('routing');var rpc={'chatInteraction':require(_0x0f2e('0x2')),'openchannelInteraction':require(_0x0f2e('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x0f2e('0x4')),'faxInteraction':require(_0x0f2e('0x5')),'whatsappInteraction':require(_0x0f2e('0x6'))};exports['consequence']=function(_0x23ab33,_0x360b17,_0x256aba,_0x47c448){return function(_0x51a040){try{logger[_0x0f2e('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x23ab33,_0x360b17[0x0]);var _0x1e28ed={'closed':0x1,'closedAt':moment()[_0x0f2e('0x8')](_0x0f2e('0x9')),'closeReason':'system','disposition':_0x360b17[0x0]};if(rpc[_0x47c448[_0x0f2e('0xa')]+_0x0f2e('0xb')]){rpc[_0x47c448[_0x0f2e('0xa')]+'Interaction'][_0x0f2e('0xc')](_0x47c448[_0x0f2e('0xd')]['id'],_0x1e28ed)['then'](function(_0x13a8ea){logger[_0x0f2e('0x7')](_0x0f2e('0xe'),_0x23ab33,_0x47c448[_0x0f2e('0xd')]['id']);})[_0x0f2e('0xf')](function(_0x4f9eac){logger['error'](_0x0f2e('0x10'),_0x23ab33,JSON[_0x0f2e('0x11')](_0x4f9eac));})[_0x0f2e('0x12')](function(){_0x51a040[_0x0f2e('0x13')]();});}}catch(_0x15b723){logger[_0x0f2e('0x14')](_0x0f2e('0x10'),_0x23ab33,JSON[_0x0f2e('0x11')](_0x15b723));_0x51a040[_0x0f2e('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 4c9395b..b20b934 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3a1=['fulfillment','speech','providerName','providerResponse','stringify','metadata','catch','error','message','lodash','moment','md5','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','out','channel','sms','whatsapp','interaction','phone','chat','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3a1,0xcd));var _0x1a3a=function(_0x4770ad,_0x217ed8){_0x4770ad=_0x4770ad-0x0;var _0xee0e79=_0xa3a1[_0x4770ad];return _0xee0e79;};'use strict';var _=require(_0x1a3a('0x0'));var moment=require(_0x1a3a('0x1'));var apiai=require('apiai-promise');var md5=require(_0x1a3a('0x2'));var utils=require('./utils');var logger=require(_0x1a3a('0x3'))(_0x1a3a('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1a3a('0x5')),'mailMessage':require(_0x1a3a('0x6')),'smsMessage':require(_0x1a3a('0x7')),'faxMessage':require(_0x1a3a('0x8')),'whatsappMessage':require(_0x1a3a('0x9'))};exports[_0x1a3a('0xa')]=function(_0x388bfe,_0x57fd99){return function(_0x5f508c){try{if(!_[_0x1a3a('0xb')](this['interaction'][_0x1a3a('0xc')])){logger[_0x1a3a('0xd')](_0x1a3a('0xe'),_0x388bfe,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5f508c[_0x1a3a('0xf')]();}var _0x23c433={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1a3a('0x10')};if(this[_0x1a3a('0x11')]===_0x1a3a('0x12')||this['channel']===_0x1a3a('0x13')){_0x23c433['phone']=this[_0x1a3a('0x14')][_0x1a3a('0x15')];}var _0x4f5599=this[_0x1a3a('0x11')];if(_0x4f5599===_0x1a3a('0x16')){_0x23c433['ChatWebsiteId']=this[_0x1a3a('0x17')]['id'];}else{_0x23c433[_[_0x1a3a('0x18')](_0x4f5599)+_0x1a3a('0x19')]=this[_0x1a3a('0x17')]['id'];}_0x23c433[_['upperFirst'](_0x4f5599)+'InteractionId']=this[_0x1a3a('0x14')]['id'];if(this['interaction'][_0x1a3a('0x1a')]){var _0x4e70bb=_0x57fd99[0x2];if(!_[_0x1a3a('0x1b')](_0x4e70bb)){_0x23c433[_0x1a3a('0x1c')]=utils[_0x1a3a('0x1d')](_0x4e70bb,this);return rpc[_0x4f5599+_0x1a3a('0x1e')][_0x1a3a('0x1f')](_0x23c433)['then'](function(_0x1b7f09){logger[_0x1a3a('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x388bfe,_0x23c433[_0x1a3a('0x1c')]);})['catch'](function(_0x2dee10){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x388bfe,JSON['stringify'](_0x2dee10));})[_0x1a3a('0x20')](function(){logger[_0x1a3a('0xd')](_0x1a3a('0x21'),_0x388bfe);_0x5f508c[_0x1a3a('0x22')]();});}else{logger['info'](_0x1a3a('0x23'),_0x388bfe);_0x5f508c[_0x1a3a('0x22')]();}}else{var _0x4a11e1=this;var _0x2e7e51=apiai(_0x57fd99[0x0],{'language':_0x57fd99[0x1]||'en'});return _0x2e7e51[_0x1a3a('0x24')](this['message'][_0x1a3a('0x1c')],{'sessionId':md5(this['interaction']['id'])})[_0x1a3a('0x25')](function(_0x2df3cf){_0x4a11e1[_0x1a3a('0x1c')][_0x1a3a('0x26')]=_0x2df3cf;_0x23c433[_0x1a3a('0x1c')]=_0x2df3cf[_0x1a3a('0x27')][_0x1a3a('0x28')][_0x1a3a('0x29')];_0x23c433[_0x1a3a('0x2a')]=_0x1a3a('0x26');_0x23c433[_0x1a3a('0x2b')]=JSON[_0x1a3a('0x2c')](_0x2df3cf);return rpc[_0x4f5599+_0x1a3a('0x1e')][_0x1a3a('0x1f')](_0x23c433)['then'](function(_0x35cf43){logger[_0x1a3a('0xd')](_0x1a3a('0xe'),_0x388bfe,_0x23c433[_0x1a3a('0x1c')]);if(_0x2df3cf['result'][_0x1a3a('0x2d')]['endConversation']){_0x5f508c['next']();}else{_0x5f508c['stop']();}})[_0x1a3a('0x2e')](function(_0x2056e2){logger[_0x1a3a('0x2f')](_0x1a3a('0xe'),_0x388bfe,JSON[_0x1a3a('0x2c')](_0x2056e2));_0x5f508c[_0x1a3a('0xf')]();});})[_0x1a3a('0x2e')](function(_0x1c4788){logger[_0x1a3a('0x2f')](_0x1a3a('0xe'),_0x388bfe,_0x1c4788[_0x1a3a('0x30')]);_0x5f508c[_0x1a3a('0xf')]();});}}catch(_0x303b44){logger[_0x1a3a('0x2f')]('[%s][DIALOGFLOW]\x20%s',_0x388bfe,JSON[_0x1a3a('0x2c')](_0x303b44));_0x5f508c['stop']();}};}; \ No newline at end of file +var _0x8d79=['moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','isEmpty','body','getMustacheRender','Message','create','then','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','speech','providerName','providerResponse','endConversation','stop','catch','message','lodash'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x8d79,0x125));var _0x98d7=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x8d79[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x98d7('0x0'));var moment=require(_0x98d7('0x1'));var apiai=require(_0x98d7('0x2'));var md5=require('md5');var utils=require(_0x98d7('0x3'));var logger=require(_0x98d7('0x4'))(_0x98d7('0x5'));var rpc={'chatMessage':require(_0x98d7('0x6')),'openchannelMessage':require(_0x98d7('0x7')),'mailMessage':require(_0x98d7('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x98d7('0x9')]=function(_0x1f283c,_0x4a7937){return function(_0x456dd5){try{if(!_['isNil'](this['interaction'][_0x98d7('0xa')])){logger[_0x98d7('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x1f283c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x456dd5[_0x98d7('0xc')]();}var _0x5cc544={'ContactId':this[_0x98d7('0xd')]['id'],'sentAt':moment()[_0x98d7('0xe')](_0x98d7('0xf')),'direction':_0x98d7('0x10')};if(this['channel']===_0x98d7('0x11')||this['channel']===_0x98d7('0x12')){_0x5cc544['phone']=this['interaction'][_0x98d7('0x13')];}var _0x25c024=this[_0x98d7('0x14')];if(_0x25c024===_0x98d7('0x15')){_0x5cc544[_0x98d7('0x16')]=this[_0x98d7('0x17')]['id'];}else{_0x5cc544[_[_0x98d7('0x18')](_0x25c024)+_0x98d7('0x19')]=this[_0x98d7('0x17')]['id'];}_0x5cc544[_['upperFirst'](_0x25c024)+_0x98d7('0x1a')]=this[_0x98d7('0x1b')]['id'];if(this['interaction']['created']){var _0x559342=_0x4a7937[0x2];if(!_[_0x98d7('0x1c')](_0x559342)){_0x5cc544[_0x98d7('0x1d')]=utils[_0x98d7('0x1e')](_0x559342,this);return rpc[_0x25c024+_0x98d7('0x1f')][_0x98d7('0x20')](_0x5cc544)[_0x98d7('0x21')](function(_0x222c7c){logger[_0x98d7('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x1f283c,_0x5cc544['body']);})['catch'](function(_0x5f163d){logger[_0x98d7('0x22')](_0x98d7('0x23'),_0x1f283c,JSON[_0x98d7('0x24')](_0x5f163d));})[_0x98d7('0x25')](function(){logger[_0x98d7('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1f283c);_0x456dd5['stop']();});}else{logger['info'](_0x98d7('0x26'),_0x1f283c);_0x456dd5['stop']();}}else{var _0x18c08e=this;var _0x1c0149=apiai(_0x4a7937[0x0],{'language':_0x4a7937[0x1]||'en'});return _0x1c0149[_0x98d7('0x27')](this['message'][_0x98d7('0x1d')],{'sessionId':md5(this[_0x98d7('0x1b')]['id'])})[_0x98d7('0x21')](function(_0x5983af){_0x18c08e['body'][_0x98d7('0x28')]=_0x5983af;_0x5cc544[_0x98d7('0x1d')]=_0x5983af[_0x98d7('0x29')]['fulfillment'][_0x98d7('0x2a')];_0x5cc544[_0x98d7('0x2b')]=_0x98d7('0x28');_0x5cc544[_0x98d7('0x2c')]=JSON[_0x98d7('0x24')](_0x5983af);return rpc[_0x25c024+'Message']['create'](_0x5cc544)[_0x98d7('0x21')](function(_0x47c798){logger[_0x98d7('0xb')](_0x98d7('0x23'),_0x1f283c,_0x5cc544[_0x98d7('0x1d')]);if(_0x5983af[_0x98d7('0x29')]['metadata'][_0x98d7('0x2d')]){_0x456dd5[_0x98d7('0xc')]();}else{_0x456dd5[_0x98d7('0x2e')]();}})[_0x98d7('0x2f')](function(_0x536f70){logger[_0x98d7('0x22')](_0x98d7('0x23'),_0x1f283c,JSON[_0x98d7('0x24')](_0x536f70));_0x456dd5[_0x98d7('0xc')]();});})[_0x98d7('0x2f')](function(_0x4699db){logger[_0x98d7('0x22')](_0x98d7('0x23'),_0x1f283c,_0x4699db[_0x98d7('0x30')]);_0x456dd5[_0x98d7('0xc')]();});}}catch(_0x55350d){logger[_0x98d7('0x22')](_0x98d7('0x23'),_0x1f283c,JSON[_0x98d7('0x24')](_0x55350d));_0x456dd5[_0x98d7('0x2e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index fbe30b1..50621b9 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc825=['contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','all','next','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction'];(function(_0x46d28e,_0x4802f8){var _0x297af4=function(_0x2f3d1d){while(--_0x2f3d1d){_0x46d28e['push'](_0x46d28e['shift']());}};_0x297af4(++_0x4802f8);}(_0xc825,0xae));var _0x5c82=function(_0xd8c470,_0x1547cf){_0xd8c470=_0xd8c470-0x0;var _0x5b04d9=_0xc825[_0xd8c470];return _0x5b04d9;};'use strict';var _=require(_0x5c82('0x0'));var dialogflow=require(_0x5c82('0x1'));var md5=require(_0x5c82('0x2'));var moment=require(_0x5c82('0x3'));var Promise=require(_0x5c82('0x4'));var logger=require(_0x5c82('0x5'))('routing');var utils=require(_0x5c82('0x6'));var rpc={'chatMessage':require(_0x5c82('0x7')),'openchannelMessage':require(_0x5c82('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5c82('0x9')),'faxMessage':require(_0x5c82('0xa')),'whatsappMessage':require(_0x5c82('0xb'))};function createMessage(_0x408588,_0x3f534b,_0x56e0f7,_0x180d05){return new Promise(function(_0x22a37f,_0x3addf5){var _0x5ca3b5=_['clone'](_0x56e0f7);_0x5ca3b5[_0x5c82('0xc')]=_0x180d05;return rpc[_0x3f534b+_0x5c82('0xd')][_0x5c82('0xe')](_0x5ca3b5)[_0x5c82('0xf')](function(){logger[_0x5c82('0x10')](_0x5c82('0x11'),_0x408588,_0x5ca3b5['body']);_0x22a37f();})[_0x5c82('0x12')](function(_0x59631d){logger[_0x5c82('0x13')](_0x5c82('0x11'),_0x408588,JSON[_0x5c82('0x14')](_0x59631d));_0x3addf5(_0x59631d);});});}exports[_0x5c82('0x15')]=function(_0xfe14c9,_0x1524e6){return function(_0x5a4eca){try{if(!_[_0x5c82('0x16')](this[_0x5c82('0x17')]['UserId'])){logger[_0x5c82('0x10')](_0x5c82('0x11'),_0xfe14c9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5a4eca['next']();}var _0x16d9a0={'ContactId':this[_0x5c82('0x18')]['id'],'sentAt':moment()[_0x5c82('0x19')](_0x5c82('0x1a')),'direction':'out'};if(this[_0x5c82('0x1b')]===_0x5c82('0x1c')||this[_0x5c82('0x1b')]==='whatsapp'){_0x16d9a0[_0x5c82('0x1d')]=this['interaction'][_0x5c82('0x1d')];}var _0x5cde17=this[_0x5c82('0x1b')];if(_0x5cde17===_0x5c82('0x1e')){_0x16d9a0[_0x5c82('0x1f')]=this[_0x5c82('0x20')]['id'];}else{_0x16d9a0[_[_0x5c82('0x21')](_0x5cde17)+'AccountId']=this[_0x5c82('0x20')]['id'];}_0x16d9a0[_[_0x5c82('0x21')](_0x5cde17)+_0x5c82('0x22')]=this[_0x5c82('0x17')]['id'];if(this[_0x5c82('0x17')][_0x5c82('0x23')]){var _0x3ce92c=_0x1524e6[0x4];if(!_[_0x5c82('0x24')](_0x3ce92c)){_0x16d9a0[_0x5c82('0xc')]=utils[_0x5c82('0x25')](_0x3ce92c,this);return rpc[_0x5cde17+_0x5c82('0xd')]['create'](_0x16d9a0)[_0x5c82('0xf')](function(_0x33d403){logger[_0x5c82('0x10')](_0x5c82('0x11'),_0xfe14c9,_0x16d9a0[_0x5c82('0xc')]);})[_0x5c82('0x12')](function(_0x2f1986){logger['error'](_0x5c82('0x11'),_0xfe14c9,JSON[_0x5c82('0x14')](_0x2f1986));})[_0x5c82('0x26')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xfe14c9);_0x5a4eca[_0x5c82('0x27')]();});}else{logger[_0x5c82('0x10')](_0x5c82('0x28'),_0xfe14c9);_0x5a4eca[_0x5c82('0x27')]();}}else{var _0x1ff07b=this;var _0x3d2509=_0x1524e6[0x2]['replace'](/\\n/g,'\x0a');var _0xf4ca4={'credentials':{'private_key':_0x3d2509,'client_email':_0x1524e6[0x1]}};var _0x28bde8=new dialogflow['SessionsClient'](_0xf4ca4);var _0x523297=_0x28bde8[_0x5c82('0x29')](_0x1524e6[0x0],md5(_0x1ff07b[_0x5c82('0x17')]['id']));var _0x5bebb2={'session':_0x523297,'queryInput':{'text':{'text':_0x1ff07b[_0x5c82('0x2a')][_0x5c82('0xc')],'languageCode':_0x1524e6[0x3]||'en'}}};return _0x28bde8['detectIntent'](_0x5bebb2)['then'](function(_0x1ad75d){if(_0x1ad75d&&_0x1ad75d[_0x5c82('0x2b')]){_0x1ff07b[_0x5c82('0xc')]['dialogflowV2']=_0x1ad75d;var _0x1e06f9=_0x1ad75d[0x0];var _0x49e135=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x2d')]&&_0x1e06f9['queryResult']['diagnosticInfo'][_0x5c82('0x2e')]?_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x2d')][_0x5c82('0x2e')][_0x5c82('0x2f')][_0x5c82('0x30')]:![];_0x1ff07b[_0x5c82('0xc')][_0x5c82('0x31')]=_0x1e06f9[_0x5c82('0x2c')]['action'];_0x1ff07b[_0x5c82('0xc')][_0x5c82('0x32')]=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x33')];_0x1ff07b[_0x5c82('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x2d')]&&_0x1e06f9['queryResult'][_0x5c82('0x2d')][_0x5c82('0x2e')]?_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x2d')][_0x5c82('0x2e')][_0x5c82('0x2f')]['boolValue']:![];_0x1ff07b[_0x5c82('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x1e06f9['queryResult']['intent']['name'];_0x1ff07b[_0x5c82('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x34')][_0x5c82('0x35')];_0x1ff07b[_0x5c82('0xc')][_0x5c82('0x36')]=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x34')][_0x5c82('0x37')];_0x1ff07b[_0x5c82('0xc')][_0x5c82('0x38')]=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x39')];_0x1ff07b['body']['DIALOGFLOWV2_QUERYTEXT']=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x3a')];_0x1ff07b[_0x5c82('0xc')]['DIALOGFLOWV2_SCORE']=_0x1e06f9[_0x5c82('0x2c')][_0x5c82('0x3b')];_0x16d9a0[_0x5c82('0x3c')]=_0x5c82('0x3d');_0x16d9a0['providerResponse']=JSON[_0x5c82('0x14')](_0x1ad75d);var _0x10faf3=[];for(var _0x2d9e27=0x0;_0x2d9e27<_0x1ad75d['length'];_0x2d9e27++){var _0x1b54a5=_0x1ad75d[_0x2d9e27];if(_0x1b54a5&&_0x1b54a5['queryResult']&&_0x1b54a5['queryResult'][_0x5c82('0x3e')]){_0x10faf3[_0x5c82('0x3f')](createMessage(_0xfe14c9,_0x5cde17,_0x16d9a0,_0x1b54a5[_0x5c82('0x2c')][_0x5c82('0x3e')]));}}return Promise[_0x5c82('0x40')](_0x10faf3)[_0x5c82('0xf')](function(){if(_0x49e135){_0x5a4eca[_0x5c82('0x41')]();}else{_0x5a4eca[_0x5c82('0x27')]();}})[_0x5c82('0x12')](function(_0x503727){logger['error'](_0x5c82('0x11'),_0xfe14c9,JSON[_0x5c82('0x14')](_0x503727));_0x5a4eca['next']();});}})[_0x5c82('0x12')](function(_0x3b5d7a){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0xfe14c9,_0x3b5d7a[_0x5c82('0x2a')]);_0x5a4eca[_0x5c82('0x41')]();});}}catch(_0x2a31ce){logger[_0x5c82('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0xfe14c9,JSON[_0x5c82('0x14')](_0x2a31ce));_0x5a4eca[_0x5c82('0x27')]();}};}; \ No newline at end of file +var _0xdc70=['message','detectIntent','length','diagnosticInfo','fields','queryResult','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','stop','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','getMustacheRender','Message','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath'];(function(_0x4fad68,_0x495b54){var _0x293210=function(_0x29c80f){while(--_0x29c80f){_0x4fad68['push'](_0x4fad68['shift']());}};_0x293210(++_0x495b54);}(_0xdc70,0x174));var _0x0dc7=function(_0x17da92,_0x15892d){_0x17da92=_0x17da92-0x0;var _0x576a32=_0xdc70[_0x17da92];return _0x576a32;};'use strict';var _=require(_0x0dc7('0x0'));var dialogflow=require(_0x0dc7('0x1'));var md5=require(_0x0dc7('0x2'));var moment=require(_0x0dc7('0x3'));var Promise=require(_0x0dc7('0x4'));var logger=require('../../../../config/logger')(_0x0dc7('0x5'));var utils=require(_0x0dc7('0x6'));var rpc={'chatMessage':require(_0x0dc7('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0dc7('0x8')),'faxMessage':require(_0x0dc7('0x9')),'whatsappMessage':require(_0x0dc7('0xa'))};function createMessage(_0x13e851,_0x2236eb,_0x5ec80f,_0x1e1cf5){return new Promise(function(_0x2c5039,_0x28bc0c){var _0x32c770=_[_0x0dc7('0xb')](_0x5ec80f);_0x32c770[_0x0dc7('0xc')]=_0x1e1cf5;return rpc[_0x2236eb+'Message'][_0x0dc7('0xd')](_0x32c770)['then'](function(){logger[_0x0dc7('0xe')](_0x0dc7('0xf'),_0x13e851,_0x32c770['body']);_0x2c5039();})[_0x0dc7('0x10')](function(_0xd1973b){logger[_0x0dc7('0x11')](_0x0dc7('0xf'),_0x13e851,JSON[_0x0dc7('0x12')](_0xd1973b));_0x28bc0c(_0xd1973b);});});}exports[_0x0dc7('0x13')]=function(_0x42671e,_0x85f349){return function(_0x4e52ca){try{if(!_[_0x0dc7('0x14')](this[_0x0dc7('0x15')][_0x0dc7('0x16')])){logger['info'](_0x0dc7('0xf'),_0x42671e,_0x0dc7('0x17'));return _0x4e52ca[_0x0dc7('0x18')]();}var _0x2905ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0dc7('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x0dc7('0x1a')]===_0x0dc7('0x1b')||this[_0x0dc7('0x1a')]==='whatsapp'){_0x2905ea[_0x0dc7('0x1c')]=this['interaction'][_0x0dc7('0x1c')];}var _0x3b6b4d=this[_0x0dc7('0x1a')];if(_0x3b6b4d===_0x0dc7('0x1d')){_0x2905ea['ChatWebsiteId']=this[_0x0dc7('0x1e')]['id'];}else{_0x2905ea[_[_0x0dc7('0x1f')](_0x3b6b4d)+_0x0dc7('0x20')]=this['account']['id'];}_0x2905ea[_[_0x0dc7('0x1f')](_0x3b6b4d)+_0x0dc7('0x21')]=this[_0x0dc7('0x15')]['id'];if(this[_0x0dc7('0x15')]['created']){var _0x44e14b=_0x85f349[0x4];if(!_['isEmpty'](_0x44e14b)){_0x2905ea[_0x0dc7('0xc')]=utils[_0x0dc7('0x22')](_0x44e14b,this);return rpc[_0x3b6b4d+_0x0dc7('0x23')][_0x0dc7('0xd')](_0x2905ea)[_0x0dc7('0x24')](function(_0x5d0dbc){logger[_0x0dc7('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x42671e,_0x2905ea[_0x0dc7('0xc')]);})['catch'](function(_0x5b250d){logger['error'](_0x0dc7('0xf'),_0x42671e,JSON[_0x0dc7('0x12')](_0x5b250d));})[_0x0dc7('0x25')](function(){logger[_0x0dc7('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x42671e);_0x4e52ca['stop']();});}else{logger['info'](_0x0dc7('0x26'),_0x42671e);_0x4e52ca['stop']();}}else{var _0x1c7bba=this;var _0x552bbe=_0x85f349[0x2][_0x0dc7('0x27')](/\\n/g,'\x0a');var _0x5e5446={'credentials':{'private_key':_0x552bbe,'client_email':_0x85f349[0x1]}};var _0x6e95e8=new dialogflow[(_0x0dc7('0x28'))](_0x5e5446);var _0x6cd40d=_0x6e95e8[_0x0dc7('0x29')](_0x85f349[0x0],md5(_0x1c7bba[_0x0dc7('0x15')]['id']));var _0x3ae2b5={'session':_0x6cd40d,'queryInput':{'text':{'text':_0x1c7bba[_0x0dc7('0x2a')][_0x0dc7('0xc')],'languageCode':_0x85f349[0x3]||'en'}}};return _0x6e95e8[_0x0dc7('0x2b')](_0x3ae2b5)[_0x0dc7('0x24')](function(_0x4db1fa){if(_0x4db1fa&&_0x4db1fa[_0x0dc7('0x2c')]){_0x1c7bba[_0x0dc7('0xc')]['dialogflowV2']=_0x4db1fa;var _0x2eca78=_0x4db1fa[0x0];var _0x97c9a0=_0x2eca78['queryResult'][_0x0dc7('0x2d')]&&_0x2eca78['queryResult'][_0x0dc7('0x2d')][_0x0dc7('0x2e')]?_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x2d')][_0x0dc7('0x2e')][_0x0dc7('0x30')]['boolValue']:![];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x31')]=_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x32')];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x33')]=_0x2eca78['queryResult']['allRequiredParamsPresent'];_0x1c7bba['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2eca78['queryResult'][_0x0dc7('0x2d')]&&_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x2d')][_0x0dc7('0x2e')]?_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x2d')][_0x0dc7('0x2e')][_0x0dc7('0x30')]['boolValue']:![];_0x1c7bba['body'][_0x0dc7('0x34')]=_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x35')]['name'];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x36')]=_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x35')][_0x0dc7('0x37')];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x38')]=_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x35')]['isFallback'];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x39')]=_0x2eca78[_0x0dc7('0x2f')]['languageCode'];_0x1c7bba[_0x0dc7('0xc')][_0x0dc7('0x3a')]=_0x2eca78['queryResult'][_0x0dc7('0x3b')];_0x1c7bba['body'][_0x0dc7('0x3c')]=_0x2eca78[_0x0dc7('0x2f')][_0x0dc7('0x3d')];_0x2905ea[_0x0dc7('0x3e')]=_0x0dc7('0x3f');_0x2905ea[_0x0dc7('0x40')]=JSON[_0x0dc7('0x12')](_0x4db1fa);var _0x2e5375=[];for(var _0x777a90=0x0;_0x777a90<_0x4db1fa['length'];_0x777a90++){var _0x14ddeb=_0x4db1fa[_0x777a90];if(_0x14ddeb&&_0x14ddeb[_0x0dc7('0x2f')]&&_0x14ddeb[_0x0dc7('0x2f')][_0x0dc7('0x41')]){_0x2e5375[_0x0dc7('0x42')](createMessage(_0x42671e,_0x3b6b4d,_0x2905ea,_0x14ddeb[_0x0dc7('0x2f')][_0x0dc7('0x41')]));}}return Promise[_0x0dc7('0x43')](_0x2e5375)[_0x0dc7('0x24')](function(){if(_0x97c9a0){_0x4e52ca[_0x0dc7('0x18')]();}else{_0x4e52ca[_0x0dc7('0x44')]();}})[_0x0dc7('0x10')](function(_0x11a860){logger[_0x0dc7('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x42671e,JSON[_0x0dc7('0x12')](_0x11a860));_0x4e52ca[_0x0dc7('0x18')]();});}})['catch'](function(_0x5ce8c6){logger[_0x0dc7('0x11')](_0x0dc7('0xf'),_0x42671e,_0x5ce8c6[_0x0dc7('0x2a')]);_0x4e52ca[_0x0dc7('0x18')]();});}}catch(_0x5a71aa){logger[_0x0dc7('0x11')](_0x0dc7('0xf'),_0x42671e,JSON[_0x0dc7('0x12')](_0x5a71aa));_0x4e52ca[_0x0dc7('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index c53c4e8..9e0b74f 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8424=['validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','map','message','join','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','error','[%s][GOTOIF]\x20%s','stringify'];(function(_0x4da638,_0x4340b4){var _0x3707d0=function(_0x27f336){while(--_0x27f336){_0x4da638['push'](_0x4da638['shift']());}};_0x3707d0(++_0x4340b4);}(_0x8424,0xc4));var _0x4842=function(_0x40049b,_0x545e98){_0x40049b=_0x40049b-0x0;var _0x1474f5=_0x8424[_0x40049b];return _0x1474f5;};'use strict';var schema=require(_0x4842('0x0'));var _=require(_0x4842('0x1'));var htmlToText=require(_0x4842('0x2'));var utils=require(_0x4842('0x3'));var logger=require('../../../../config/logger')(_0x4842('0x4'));var gotoif=schema({'condition':{'type':_0x4842('0x5'),'required':!![],'message':_0x4842('0x6')},'priorityTrue':{'type':_0x4842('0x7'),'message':_0x4842('0x8')},'priorityFalse':{'type':'number','message':_0x4842('0x9')}});exports[_0x4842('0xa')]=function(_0x59c6d4,_0x528334){return function(_0x5a0c77){try{var _0x3fdf72={'condition':htmlToText[_0x4842('0xb')](utils['getMustacheRender'](_0x528334[0x0],this),{'wordwrap':![]})[_0x4842('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x528334[0x1],'priorityFalse':_0x528334[0x2]};var _0x1b4a9b=gotoif['validate'](_0x3fdf72,{'typecast':!![]});if(_0x1b4a9b[_0x4842('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0x59c6d4,_[_0x4842('0xe')](_0x1b4a9b,_0x4842('0xf'))[_0x4842('0x10')](',\x20'));_0x5a0c77['stop']();}else{try{var _0x484d0c=eval('('+_0x3fdf72['condition']+')');var _0x57ba00=_0x484d0c?_0x3fdf72['priorityTrue']:_0x3fdf72['priorityFalse'];logger['info'](_0x4842('0x11'),_0x59c6d4,_0x3fdf72[_0x4842('0x12')],_0x484d0c,_0x57ba00||_0x4842('0x13'));if(_0x57ba00){var _0x39331e=_[_0x4842('0x14')](_0x5a0c77[_0x4842('0x15')](),{'p':_0x57ba00});if(_0x39331e>=0x0){logger[_0x4842('0x16')](_0x4842('0x17'),_0x59c6d4,_0x57ba00||_0x4842('0x13'),_0x39331e);_0x5a0c77[_0x4842('0x13')](_0x39331e);}else{logger[_0x4842('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x59c6d4,_0x57ba00||'next');_0x5a0c77[_0x4842('0x18')]();}}else{_0x5a0c77[_0x4842('0x13')]();}}catch(_0x4a7e05){logger[_0x4842('0x19')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x59c6d4,_0x4a7e05[_0x4842('0xf')]);_0x5a0c77[_0x4842('0x18')]();}}}catch(_0x44d34e){logger[_0x4842('0x19')](_0x4842('0x1a'),_0x59c6d4,JSON[_0x4842('0x1b')](_0x44d34e));_0x5a0c77[_0x4842('0x18')]();}};}; \ No newline at end of file +var _0xcf67=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xcf67,0x1ac));var _0x7cf6=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xcf67[_0x1cd47d];return _0x29d52f;};'use strict';var schema=require(_0x7cf6('0x0'));var _=require(_0x7cf6('0x1'));var htmlToText=require(_0x7cf6('0x2'));var utils=require(_0x7cf6('0x3'));var logger=require(_0x7cf6('0x4'))(_0x7cf6('0x5'));var gotoif=schema({'condition':{'type':_0x7cf6('0x6'),'required':!![],'message':_0x7cf6('0x7')},'priorityTrue':{'type':_0x7cf6('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x7cf6('0x8'),'message':_0x7cf6('0x9')}});exports[_0x7cf6('0xa')]=function(_0x73ee23,_0x44bf5c){return function(_0x4f9ef4){try{var _0x31eea8={'condition':htmlToText[_0x7cf6('0xb')](utils[_0x7cf6('0xc')](_0x44bf5c[0x0],this),{'wordwrap':![]})[_0x7cf6('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x44bf5c[0x1],'priorityFalse':_0x44bf5c[0x2]};var _0x53669d=gotoif['validate'](_0x31eea8,{'typecast':!![]});if(_0x53669d[_0x7cf6('0xe')]){logger['error'](_0x7cf6('0xf'),_0x73ee23,_[_0x7cf6('0x10')](_0x53669d,'message')[_0x7cf6('0x11')](',\x20'));_0x4f9ef4[_0x7cf6('0x12')]();}else{try{var _0x15d6be=eval('('+_0x31eea8['condition']+')');var _0x340a83=_0x15d6be?_0x31eea8[_0x7cf6('0x13')]:_0x31eea8[_0x7cf6('0x14')];logger[_0x7cf6('0x15')](_0x7cf6('0x16'),_0x73ee23,_0x31eea8[_0x7cf6('0x17')],_0x15d6be,_0x340a83||_0x7cf6('0x18'));if(_0x340a83){var _0x146dc6=_['findIndex'](_0x4f9ef4[_0x7cf6('0x19')](),{'p':_0x340a83});if(_0x146dc6>=0x0){logger[_0x7cf6('0x15')](_0x7cf6('0x1a'),_0x73ee23,_0x340a83||'next',_0x146dc6);_0x4f9ef4[_0x7cf6('0x18')](_0x146dc6);}else{logger['info'](_0x7cf6('0x1b'),_0x73ee23,_0x340a83||_0x7cf6('0x18'));_0x4f9ef4[_0x7cf6('0x12')]();}}else{_0x4f9ef4[_0x7cf6('0x18')]();}}catch(_0x3e65d6){logger[_0x7cf6('0x1c')](_0x7cf6('0x1d'),_0x73ee23,_0x3e65d6[_0x7cf6('0x1e')]);_0x4f9ef4[_0x7cf6('0x12')]();}}}catch(_0x1cf299){logger[_0x7cf6('0x1c')](_0x7cf6('0xf'),_0x73ee23,JSON['stringify'](_0x1cf299));_0x4f9ef4[_0x7cf6('0x12')]();}};}; \ 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 2204b52..52ae14e 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 _0x5ac6=['message','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','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map'];(function(_0x4d0a38,_0x250363){var _0x3c9435=function(_0x4d0c0e){while(--_0x4d0c0e){_0x4d0a38['push'](_0x4d0a38['shift']());}};_0x3c9435(++_0x250363);}(_0x5ac6,0x172));var _0x65ac=function(_0x37847d,_0x3408ae){_0x37847d=_0x37847d-0x0;var _0xf3768f=_0x5ac6[_0x37847d];return _0xf3768f;};'use strict';var schema=require('validate');var _=require(_0x65ac('0x0'));var logger=require(_0x65ac('0x1'))(_0x65ac('0x2'));var gotop=schema({'priority':{'type':_0x65ac('0x3'),'required':!![],'message':_0x65ac('0x4')}});exports[_0x65ac('0x5')]=function(_0x11dfeb,_0x3d0378){return function(_0x47ce01){try{var _0x5c5ed3={'priority':_0x3d0378[0x0]};var _0x13183f=gotop[_0x65ac('0x6')](_0x5c5ed3,{'typecast':!![]});if(_0x13183f['length']){logger[_0x65ac('0x7')](_0x65ac('0x8'),_0x11dfeb,_[_0x65ac('0x9')](_0x13183f,_0x65ac('0xa'))['join'](',\x20'));_0x47ce01[_0x65ac('0xb')]();}else{logger[_0x65ac('0xc')](_0x65ac('0xd'),_0x11dfeb,_0x5c5ed3[_0x65ac('0xe')]);if(_0x5c5ed3[_0x65ac('0xe')]){var _0xe2d090=_[_0x65ac('0xf')](_0x47ce01[_0x65ac('0x10')](),{'p':_0x5c5ed3['priority']});if(_0xe2d090>=0x0){logger[_0x65ac('0xc')](_0x65ac('0x11'),_0x11dfeb,_0x5c5ed3['priority']||'next',_0xe2d090);_0x47ce01[_0x65ac('0x12')](_0xe2d090);}else{logger[_0x65ac('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x11dfeb,_0x5c5ed3['priority']||_0x65ac('0x12'));_0x47ce01['stop']();}}else{_0x47ce01[_0x65ac('0x12')]();}}}catch(_0x124f28){logger[_0x65ac('0x7')](_0x65ac('0x8'),_0x11dfeb,JSON[_0x65ac('0x13')](_0x124f28));_0x47ce01['stop']();}};}; \ No newline at end of file +var _0x095d=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','number','consequence','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x095d,0x13b));var _0xd095=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x095d[_0x5180c3];return _0x55c975;};'use strict';var schema=require(_0xd095('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xd095('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd095('0x2')]=function(_0x1f99b3,_0x4afefe){return function(_0x4cddfd){try{var _0x529254={'priority':_0x4afefe[0x0]};var _0x769968=gotop['validate'](_0x529254,{'typecast':!![]});if(_0x769968['length']){logger[_0xd095('0x3')](_0xd095('0x4'),_0x1f99b3,_[_0xd095('0x5')](_0x769968,_0xd095('0x6'))[_0xd095('0x7')](',\x20'));_0x4cddfd[_0xd095('0x8')]();}else{logger[_0xd095('0x9')](_0xd095('0xa'),_0x1f99b3,_0x529254[_0xd095('0xb')]);if(_0x529254[_0xd095('0xb')]){var _0x19e50a=_[_0xd095('0xc')](_0x4cddfd[_0xd095('0xd')](),{'p':_0x529254['priority']});if(_0x19e50a>=0x0){logger[_0xd095('0x9')](_0xd095('0xe'),_0x1f99b3,_0x529254[_0xd095('0xb')]||_0xd095('0xf'),_0x19e50a);_0x4cddfd['next'](_0x19e50a);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1f99b3,_0x529254[_0xd095('0xb')]||'next');_0x4cddfd[_0xd095('0x8')]();}}else{_0x4cddfd[_0xd095('0xf')]();}}}catch(_0x22953e){logger[_0xd095('0x3')](_0xd095('0x4'),_0x1f99b3,JSON[_0xd095('0x10')](_0x22953e));_0x4cddfd['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 99a5fdd..148682b 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 _0xe625=['then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message'];(function(_0x1ce4ef,_0x13e005){var _0x2871e1=function(_0x154194){while(--_0x154194){_0x1ce4ef['push'](_0x1ce4ef['shift']());}};_0x2871e1(++_0x13e005);}(_0xe625,0x191));var _0x5e62=function(_0x226c3b,_0x36121f){_0x226c3b=_0x226c3b-0x0;var _0x293d4e=_0xe625[_0x226c3b];return _0x293d4e;};'use strict';var _=require(_0x5e62('0x0'));var utils=require(_0x5e62('0x1'));var logger=require('../../../../config/logger')(_0x5e62('0x2'));var rpc={'chatMessage':require(_0x5e62('0x3')),'openchannelMessage':require(_0x5e62('0x4')),'mailMessage':require(_0x5e62('0x5')),'smsMessage':require(_0x5e62('0x6')),'faxMessage':require(_0x5e62('0x7')),'whatsappMessage':require(_0x5e62('0x8'))};exports[_0x5e62('0x9')]=function(_0x50a665,_0x3aa57e){return function(_0x204480){try{var _0x3d2b72={'body':utils[_0x5e62('0xa')](_0x3aa57e[0x0],this),'ContactId':this[_0x5e62('0xb')]['id']};if(this[_0x5e62('0xc')]==='chat'){_0x3d2b72[_0x5e62('0xd')]=this[_0x5e62('0xe')]['id'];}else{_0x3d2b72[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x3d2b72[_[_0x5e62('0xf')](this[_0x5e62('0xc')])+_0x5e62('0x10')]=this[_0x5e62('0x11')]['id'];if(rpc[this['channel']+_0x5e62('0x12')]){return rpc[this[_0x5e62('0xc')]+_0x5e62('0x12')]['create'](_0x3d2b72)[_0x5e62('0x13')](function(_0xd46c6e){logger[_0x5e62('0x14')]('[%s][MESSAGE]\x20%s',_0x50a665,_0x3d2b72[_0x5e62('0x15')]);_0x204480[_0x5e62('0x16')]();})[_0x5e62('0x17')](function(_0x410036){logger[_0x5e62('0x18')](_0x5e62('0x19'),_0x50a665,JSON[_0x5e62('0x1a')](_0x410036));_0x204480['stop']();});}}catch(_0x4e909f){logger[_0x5e62('0x18')]('[%s][MESSAGE]\x20%s',_0x50a665,JSON[_0x5e62('0x1a')](_0x4e909f));_0x204480[_0x5e62('0x1b')]();}};}; \ No newline at end of file +var _0xd0a7=['Message','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','chat','ChatWebsiteId','account','channel','InteractionId','interaction'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0xd0a7,0x133));var _0x7d0a=function(_0x4abf72,_0x2f182b){_0x4abf72=_0x4abf72-0x0;var _0x8880e9=_0xd0a7[_0x4abf72];return _0x8880e9;};'use strict';var _=require(_0x7d0a('0x0'));var utils=require(_0x7d0a('0x1'));var logger=require(_0x7d0a('0x2'))('routing');var rpc={'chatMessage':require(_0x7d0a('0x3')),'openchannelMessage':require(_0x7d0a('0x4')),'mailMessage':require(_0x7d0a('0x5')),'smsMessage':require(_0x7d0a('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7d0a('0x7'))};exports['consequence']=function(_0x530921,_0x1cadad){return function(_0x14d13e){try{var _0x1f24dd={'body':utils['getMustacheRender'](_0x1cadad[0x0],this),'ContactId':this[_0x7d0a('0x8')]['id']};if(this['channel']===_0x7d0a('0x9')){_0x1f24dd[_0x7d0a('0xa')]=this[_0x7d0a('0xb')]['id'];}else{_0x1f24dd[_['upperFirst'](this[_0x7d0a('0xc')])+'AccountId']=this[_0x7d0a('0xb')]['id'];}_0x1f24dd[_['upperFirst'](this[_0x7d0a('0xc')])+_0x7d0a('0xd')]=this[_0x7d0a('0xe')]['id'];if(rpc[this[_0x7d0a('0xc')]+_0x7d0a('0xf')]){return rpc[this[_0x7d0a('0xc')]+_0x7d0a('0xf')]['create'](_0x1f24dd)['then'](function(_0x293148){logger[_0x7d0a('0x10')](_0x7d0a('0x11'),_0x530921,_0x1f24dd[_0x7d0a('0x12')]);_0x14d13e['next']();})[_0x7d0a('0x13')](function(_0x2d5130){logger[_0x7d0a('0x14')]('[%s][MESSAGE]\x20%s',_0x530921,JSON[_0x7d0a('0x15')](_0x2d5130));_0x14d13e[_0x7d0a('0x16')]();});}}catch(_0x925de5){logger['error'](_0x7d0a('0x11'),_0x530921,JSON[_0x7d0a('0x15')](_0x925de5));_0x14d13e['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 b565440..a9a26b4 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 _0x49d0=['getMustacheRender','error','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x49d0,0x136));var _0x049d=function(_0x4ca037,_0x1d6b56){_0x4ca037=_0x4ca037-0x0;var _0x56883e=_0x49d0[_0x4ca037];return _0x56883e;};'use strict';var utils=require('./utils');var logger=require(_0x049d('0x0'))(_0x049d('0x1'));exports[_0x049d('0x2')]=function(_0x55163c,_0x35e4a9){return function(_0x9eb1e7){try{logger[_0x049d('0x3')](_0x049d('0x4'),_0x55163c,utils[_0x049d('0x5')](_0x35e4a9[0x0],this));_0x9eb1e7['next']();}catch(_0x14b090){logger[_0x049d('0x6')](_0x049d('0x4'),_0x55163c,JSON[_0x049d('0x7')](_0x14b090));_0x9eb1e7[_0x049d('0x8')]();}};}; \ No newline at end of file +var _0xcd6d=['stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xcd6d,0x1b0));var _0xdcd6=function(_0x2c7a22,_0x8219bd){_0x2c7a22=_0x2c7a22-0x0;var _0x402c52=_0xcd6d[_0x2c7a22];return _0x402c52;};'use strict';var utils=require(_0xdcd6('0x0'));var logger=require('../../../../config/logger')(_0xdcd6('0x1'));exports[_0xdcd6('0x2')]=function(_0x43bd61,_0x1a529b){return function(_0x2ff53c){try{logger[_0xdcd6('0x3')](_0xdcd6('0x4'),_0x43bd61,utils[_0xdcd6('0x5')](_0x1a529b[0x0],this));_0x2ff53c[_0xdcd6('0x6')]();}catch(_0x55e4c8){logger[_0xdcd6('0x7')](_0xdcd6('0x4'),_0x43bd61,JSON[_0xdcd6('0x8')](_0x55e4c8));_0x2ff53c[_0xdcd6('0x9')]();}};}; \ 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 067a0af..1dc9f42 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 _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(_0x4df4d3,_0x8fe9e4){var _0xed181b=function(_0x5ce0de){while(--_0x5ce0de){_0x4df4d3['push'](_0x4df4d3['shift']());}};_0xed181b(++_0x8fe9e4);}(_0x008c,0x188));var _0xc008=function(_0x5cf93c,_0x2b5075){_0x5cf93c=_0x5cf93c-0x0;var _0x56aa24=_0x008c[_0x5cf93c];return _0x56aa24;};'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 +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x10b176,_0x675c70){var _0x43082b=function(_0x10baed){while(--_0x10baed){_0x10b176['push'](_0x10b176['shift']());}};_0x43082b(++_0x675c70);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ 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 e00abd1..667541d 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 _0x0cc9=['hideNotification','busy','STOP','TIMEOUT','uuid','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x4d260e,_0x3d0226){var _0x1c56fa=function(_0x15972d){while(--_0x15972d){_0x4d260e['push'](_0x4d260e['shift']());}};_0x1c56fa(++_0x3d0226);}(_0x0cc9,0x14e));var _0x90cc=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x0cc9[_0x4b3d13];return _0xf64dd8;};'use strict';var _=require('lodash');var uuid=require(_0x90cc('0x0'));var util=require('./util');var logger=require(_0x90cc('0x1'))('routing');var Agent=function(_0x4ae3a7,_0x54cb2c,_0x55cfd8,_0x2eb6db){this[_0x90cc('0x2')]=uuid['v4']();this[_0x90cc('0x3')]=_0x4ae3a7;this[_0x90cc('0x4')]=_0x54cb2c;this[_0x90cc('0x5')]=_0x55cfd8;this[_0x90cc('0x6')]=_0x2eb6db;this[_0x90cc('0x3')][_0x90cc('0x7')](this[_0x90cc('0x8')][_0x90cc('0x9')](this),this[_0x90cc('0xa')][_0x90cc('0x9')](this));this[_0x90cc('0x3')]['on'](_0x90cc('0xb'),this[_0x90cc('0xa')][_0x90cc('0x9')](this));this['squeue']['on']('drained',this[_0x90cc('0xc')][_0x90cc('0x9')](this));};Agent[_0x90cc('0xd')][_0x90cc('0x7')]=function(){this[_0x90cc('0x3')][_0x90cc('0x7')](this[_0x90cc('0x8')][_0x90cc('0x9')](this),this[_0x90cc('0xa')][_0x90cc('0x9')](this));};Agent[_0x90cc('0xd')][_0x90cc('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x90cc('0x8')]=function(_0x4dc6ac){logger[_0x90cc('0xe')](_0x90cc('0xf'),this['squeue']['id'],this['agent']['id']);if(_[_0x90cc('0x10')](this[_0x90cc('0x5')][_0x90cc('0x11')][this[_0x90cc('0x4')]['id']])){logger[_0x90cc('0xe')](_0x90cc('0x12'),this[_0x90cc('0x3')]['id'],this[_0x90cc('0x4')]['id']);setTimeout(this[_0x90cc('0x7')][_0x90cc('0x9')](this),0x3e8);}else{if(this['routing'][_0x90cc('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x90cc('0x5')]['agents'][this[_0x90cc('0x4')]['id']],this[_0x90cc('0x3')][_0x90cc('0x14')],![])){this['realtime'][_0x90cc('0x11')][this[_0x90cc('0x4')]['id']]['busy']=!![];this[_0x90cc('0x5')][_0x90cc('0x11')][this[_0x90cc('0x4')]['id']][_0x90cc('0x15')]=undefined;util[_0x90cc('0x16')](this['notificationId'],this[_0x90cc('0x3')]['id'],this[_0x90cc('0x5')]['agents'][this['agent']['id']],null,this['routing']);util[_0x90cc('0x17')](this[_0x90cc('0x3')]['id'],this[_0x90cc('0x5')]['agents'][this[_0x90cc('0x4')]['id']],'RINGING'+(this[_0x90cc('0x6')]['forcedOwnership']?':FORCED':''));}else{logger[_0x90cc('0xe')](_0x90cc('0x18'),this[_0x90cc('0x3')]['id'],this[_0x90cc('0x4')]['id']);setTimeout(this[_0x90cc('0x7')][_0x90cc('0x9')](this),0x3e8);}}};Agent['prototype'][_0x90cc('0xa')]=function(_0x3f64f0){if(_[_0x90cc('0x10')](this[_0x90cc('0x5')][_0x90cc('0x11')][this['agent']['id']])){return logger[_0x90cc('0xe')](_0x90cc('0x12'),this[_0x90cc('0x3')]['id'],this[_0x90cc('0x4')]['id']);}else{logger[_0x90cc('0xe')](_0x90cc('0x19'),this['squeue']['id'],this[_0x90cc('0x4')]['id']);util[_0x90cc('0x1a')](this['notificationId'],this[_0x90cc('0x3')]['id'],this[_0x90cc('0x5')][_0x90cc('0x11')][this['agent']['id']],null,this[_0x90cc('0x6')]);this[_0x90cc('0x5')]['agents'][this['agent']['id']][_0x90cc('0x1b')]=![];this['realtime'][_0x90cc('0x11')][this[_0x90cc('0x4')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0x90cc('0x3')]['id'],this[_0x90cc('0x5')][_0x90cc('0x11')][this[_0x90cc('0x4')]['id']],_0x3f64f0?_0x90cc('0x1c'):_0x90cc('0x1d'));}if(!_0x3f64f0){setTimeout(this[_0x90cc('0x7')][_0x90cc('0x9')](this),0x3e8);}};function agent(_0x5f1f77,_0x7916dd,_0x2d1ad1,_0x25acec){return new Agent(_0x5f1f77,_0x7916dd,_0x2d1ad1,_0x25acec);}module['exports']=agent; \ No newline at end of file +var _0x70d8=['uuid','./util','../../../../../config/logger','routing','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70d8,0xa9));var _0x870d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x70d8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x870d('0x0'));var uuid=require(_0x870d('0x1'));var util=require(_0x870d('0x2'));var logger=require(_0x870d('0x3'))(_0x870d('0x4'));var Agent=function(_0x13ba75,_0x21014d,_0x333749,_0x31e2c2){this['notificationId']=uuid['v4']();this[_0x870d('0x5')]=_0x13ba75;this['agent']=_0x21014d;this['realtime']=_0x333749;this[_0x870d('0x4')]=_0x31e2c2;this[_0x870d('0x5')][_0x870d('0x6')](this[_0x870d('0x7')]['bind'](this),this['handleTimeout'][_0x870d('0x8')](this));this[_0x870d('0x5')]['on']('timeout',this[_0x870d('0x9')][_0x870d('0x8')](this));this[_0x870d('0x5')]['on'](_0x870d('0xa'),this[_0x870d('0xb')][_0x870d('0x8')](this));};Agent[_0x870d('0xc')][_0x870d('0x6')]=function(){this[_0x870d('0x5')][_0x870d('0x6')](this['handleRun'][_0x870d('0x8')](this),this['handleTimeout'][_0x870d('0x8')](this));};Agent[_0x870d('0xc')][_0x870d('0xb')]=function(){this[_0x870d('0x9')](!![]);};Agent['prototype'][_0x870d('0x7')]=function(_0x3c82fd){logger[_0x870d('0xd')](_0x870d('0xe'),this[_0x870d('0x5')]['id'],this[_0x870d('0xf')]['id']);if(_[_0x870d('0x10')](this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']])){logger['info'](_0x870d('0x13'),this['squeue']['id'],this[_0x870d('0xf')]['id']);setTimeout(this[_0x870d('0x6')][_0x870d('0x8')](this),0x3e8);}else{if(this[_0x870d('0x4')][_0x870d('0x14')]||util[_0x870d('0x15')](this[_0x870d('0x5')]['id'],this[_0x870d('0x11')][_0x870d('0x12')][this['agent']['id']],this[_0x870d('0x5')][_0x870d('0x16')],![])){this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']][_0x870d('0x17')]=!![];this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']][_0x870d('0x18')]=undefined;util[_0x870d('0x19')](this[_0x870d('0x1a')],this[_0x870d('0x5')]['id'],this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']],null,this[_0x870d('0x4')]);util[_0x870d('0x1b')](this[_0x870d('0x5')]['id'],this[_0x870d('0x11')]['agents'][this['agent']['id']],_0x870d('0x1c')+(this[_0x870d('0x4')][_0x870d('0x14')]?_0x870d('0x1d'):''));}else{logger['info'](_0x870d('0x1e'),this['squeue']['id'],this[_0x870d('0xf')]['id']);setTimeout(this[_0x870d('0x6')][_0x870d('0x8')](this),0x3e8);}}};Agent['prototype'][_0x870d('0x9')]=function(_0x34277d){if(_[_0x870d('0x10')](this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']])){return logger[_0x870d('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x870d('0xf')]['id']);}else{logger[_0x870d('0xd')](_0x870d('0x1f'),this[_0x870d('0x5')]['id'],this[_0x870d('0xf')]['id']);util['hideNotification'](this[_0x870d('0x1a')],this[_0x870d('0x5')]['id'],this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']],null,this[_0x870d('0x4')]);this['realtime'][_0x870d('0x12')][this['agent']['id']]['busy']=![];this[_0x870d('0x11')]['agents'][this[_0x870d('0xf')]['id']][_0x870d('0x18')]=undefined;util[_0x870d('0x1b')](this[_0x870d('0x5')]['id'],this[_0x870d('0x11')][_0x870d('0x12')][this[_0x870d('0xf')]['id']],_0x34277d?'STOP':_0x870d('0x20'));}if(!_0x34277d){setTimeout(this[_0x870d('0x6')][_0x870d('0x8')](this),0x3e8);}};function agent(_0x133074,_0x27635e,_0x45f403,_0x26d6f9){return new Agent(_0x133074,_0x27635e,_0x45f403,_0x26d6f9);}module[_0x870d('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 68601f8..6bb23ee 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 _0x7878=['length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','isNil','queue','Agents'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7878,0x142));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8787('0x0'));var uuid=require(_0x8787('0x1'));var util=require(_0x8787('0x2'));var logger=require(_0x8787('0x3'))(_0x8787('0x4'));var Beepall=function(_0x347d60,_0x2d82e0,_0x391394,_0x20b584){this[_0x8787('0x5')]=uuid['v4']();this['squeue']=_0x347d60;this['queue']=_0x2d82e0;this['realtime']=_0x391394;this[_0x8787('0x4')]=_0x20b584;this[_0x8787('0x6')]['push'](this[_0x8787('0x7')][_0x8787('0x8')](this),this[_0x8787('0x9')]['bind'](this));this[_0x8787('0x6')]['on'](_0x8787('0xa'),this[_0x8787('0x9')]['bind'](this));this['squeue']['on'](_0x8787('0xb'),this['handleDrained'][_0x8787('0x8')](this));};Beepall[_0x8787('0xc')][_0x8787('0xd')]=function(){this[_0x8787('0x6')][_0x8787('0xd')](this[_0x8787('0x7')][_0x8787('0x8')](this),this[_0x8787('0x9')][_0x8787('0x8')](this));};Beepall[_0x8787('0xc')][_0x8787('0xe')]=function(_0x195893){this['handleTimeout'](!![]);};Beepall[_0x8787('0xc')]['handleRun']=function(_0x33e03f){var _0x5e1446=!![];if(!_[_0x8787('0xf')](this[_0x8787('0x10')])&&!_[_0x8787('0xf')](this[_0x8787('0x10')][_0x8787('0x11')])&&this[_0x8787('0x10')][_0x8787('0x11')][_0x8787('0x12')]>0x0){for(var _0x454c38=0x0,_0x53c3be;_0x454c380x0){for(var _0x3e23c5=0x0,_0x57ab0d;_0x3e23c50x0&&_0x509d06[_0x3d4941+_0x366d('0x25')]>=_0x509d06[_0x3d4941+'Capacity']){writeLog(_0x3c540d,_0x509d06,_0x3d4941['toUpperCase']()+_0x366d('0x26'));return![];}}return!![];};exports[_0x366d('0x27')]=function(_0x31957c,_0x2c6637,_0x552c86,_0x413307,_0x5dc954){return sendNotification(!![],_0x31957c,_0x2c6637,_0x552c86,_0x413307,_0x5dc954);};exports[_0x366d('0x28')]=function(_0x13a6b2,_0x594d42,_0x535b26,_0xa856fa,_0x13aaca){return sendNotification(![],_0x13a6b2,_0x594d42,_0x535b26,_0xa856fa,_0x13aaca);};exports[_0x366d('0x29')]=writeLog; \ No newline at end of file +var _0x7834=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','lodash','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','emit','format','user:%s','name','user:save','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7834,0x13f));var _0x4783=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x7834[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0x4783('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require(_0x4783('0x1'));var Redis=require('ioredis');var config=require(_0x4783('0x2'));var logger=require(_0x4783('0x3'))(_0x4783('0x4'));config[_0x4783('0x5')]=_[_0x4783('0x6')](config[_0x4783('0x5')],{'host':_0x4783('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4783('0x5')]));function emit(_0xf8c030,_0x518da8,_0x2dcf46){io['to'](_0xf8c030)[_0x4783('0x8')](_0x518da8,_0x2dcf46);}function sendNotification(_0x36c0a7,_0x112a19,_0xc8b2d7,_0x1f8b29,_0x5caa81,_0xf75e9e){io['to'](util[_0x4783('0x9')](_0x4783('0xa'),_0x1f8b29[_0x4783('0xb')]))[_0x4783('0x8')](_0x4783('0xc'),_0x1f8b29);var _0x10c184=_0xf75e9e||{};var _0x5b8428=_0xc8b2d7['split']('.');var _0x1a40c0={'uniqueid':_0x112a19,'channel':_0x5b8428[0x0],'id':_0x5b8428[0x1],'title':_0x5b8428[0x0]+_0x4783('0xd'),'interactionId':_0x5b8428[0x2],'queue':_0x5caa81?_0x5caa81['name']:null,'sound':_0x10c184[_0x4783('0xe')]['notificationSound'],'shake':_0x10c184[_0x4783('0xe')][_0x4783('0xf')]};try{if(!_0x10c184[_0x4783('0x10')]){_0x10c184[_0x4783('0x10')]={};}if(_0x5caa81){_0x10c184[_0x4783('0x10')]['queue']=_0x5caa81;}else if(_0x10c184[_0x4783('0x10')][_0x4783('0x11')]){delete _0x10c184[_0x4783('0x10')][_0x4783('0x11')];}_0x1a40c0[_0x4783('0x12')]=utils[_0x4783('0x13')](_0x10c184[_0x4783('0xe')][_0x4783('0x14')],_0x10c184);}catch(_0x1ccf8a){_0x1a40c0[_0x4783('0x12')]=_0x4783('0x15');logger[_0x4783('0x16')](util['format'](_0x4783('0x17'),_0x112a19,_0x1ccf8a[_0x4783('0x18')]));}io['to'](util['format'](_0x4783('0xa'),_0x1f8b29['name']))[_0x4783('0x8')](util[_0x4783('0x9')](_0x4783('0x19'),_0x36c0a7?_0x4783('0x1a'):_0x4783('0x1b')),_0x1a40c0);}function writeLog(_0x2772b3,_0x3a8220,_0x4e15d7){return logger[_0x4783('0x1c')](util['format'](_0x4783('0x1d'),_0x2772b3,_0x3a8220[_0x4783('0xb')],_0x4e15d7));}exports[_0x4783('0x1e')]=function(_0x44aaf3,_0x429029,_0x54529d,_0x2633e6){if(_0x429029[_0x4783('0x1f')]){writeLog(_0x44aaf3,_0x429029,_0x4783('0x20'));return![];}if(!_0x429029[_0x4783('0x21')]){writeLog(_0x44aaf3,_0x429029,_0x4783('0x22'));return![];}if(_0x429029[_0x54529d+_0x4783('0x23')]){writeLog(_0x44aaf3,_0x429029,_0x4783('0x24'));return![];}if(_0x2633e6&&_0x429029['hasOwnProperty'](_0x54529d+_0x4783('0x25'))&&_0x429029[_0x4783('0x26')](_0x54529d+'CurrentCapacity')){if(_0x429029[_0x54529d+'Capacity']>0x0&&_0x429029[_0x54529d+_0x4783('0x27')]>=_0x429029[_0x54529d+_0x4783('0x25')]){writeLog(_0x44aaf3,_0x429029,_0x54529d['toUpperCase']()+_0x4783('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x5c5a6a,_0x5368d3,_0x575f15,_0x4bb091,_0x59e49b){return sendNotification(!![],_0x5c5a6a,_0x5368d3,_0x575f15,_0x4bb091,_0x59e49b);};exports[_0x4783('0x29')]=function(_0x589082,_0x3a996c,_0x455559,_0x424806,_0x3455e){return sendNotification(![],_0x589082,_0x3a996c,_0x455559,_0x424806,_0x3455e);};exports[_0x4783('0x2a')]=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 005ca23..8a188bc 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 _0xaf5a=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x484d2c,_0x53030a){var _0x119be0=function(_0x1f138f){while(--_0x1f138f){_0x484d2c['push'](_0x484d2c['shift']());}};_0x119be0(++_0x53030a);}(_0xaf5a,0x1f1));var _0xaaf5=function(_0x3f3125,_0x3f49d2){_0x3f3125=_0x3f3125-0x0;var _0x28bf12=_0xaf5a[_0x3f3125];return _0x28bf12;};'use strict';var schema=require(_0xaaf5('0x0'));var sh=require(_0xaaf5('0x1'));var _=require(_0xaaf5('0x2'));var utils=require(_0xaaf5('0x3'));var logger=require(_0xaaf5('0x4'))(_0xaaf5('0x5'));var system=schema({'command':{'type':_0xaaf5('0x6'),'required':!![],'message':_0xaaf5('0x7')}});exports[_0xaaf5('0x8')]=function(_0x519f73,_0x3d8cf2){return function(_0x31e822){try{var _0x512409={'command':_0x3d8cf2[0x0]};var _0x3f8bac=system[_0xaaf5('0x0')](_0x512409,{'typecast':!![]});if(_0x3f8bac[_0xaaf5('0x9')]){logger[_0xaaf5('0xa')]('[%s][SYSTEM]\x20%s',_0x519f73,_[_0xaaf5('0xb')](_0x3f8bac,_0xaaf5('0xc'))['join'](',\x20'));logger['info'](_0xaaf5('0xd'),_0x519f73);_0x31e822[_0xaaf5('0xe')]();}else{var _0x830db5=this;var _0x18dc2e=utils['getMustacheRender'](_0x3d8cf2[0x0],this);logger[_0xaaf5('0xf')](_0xaaf5('0x10'),_0x519f73,_0x18dc2e);sh[_0xaaf5('0x11')](_[_0xaaf5('0x12')](_0x18dc2e),function(_0x5eac69,_0x39d1cd){logger['info'](_0xaaf5('0x13'),_0x519f73,_0x5eac69);if(_0x5eac69==0x0){var _0x3f6c82=_0x39d1cd[_0xaaf5('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3d8cf2[0x1])||_[_0xaaf5('0x15')](_0x3d8cf2[0x1])){logger['info'](_0xaaf5('0x16'),_0x519f73);_0x830db5[_0xaaf5('0x17')][_0x3d8cf2[0x1]]=_0x3f6c82;}else{logger[_0xaaf5('0xf')](_0xaaf5('0x18'),_0x519f73,_0x3d8cf2[0x1],_0x3f6c82);_0x830db5[_0xaaf5('0x17')][_0x3d8cf2[0x1]]=_0x3f6c82;}}_0x31e822[_0xaaf5('0xe')]();});}}catch(_0x2b28e8){logger[_0xaaf5('0xa')](_0xaaf5('0x19'),_0x519f73,_[_0xaaf5('0x1a')](_0x2b28e8)?JSON[_0xaaf5('0x1b')](_0x2b28e8):_0x2b28e8);logger[_0xaaf5('0xf')](_0xaaf5('0xd'),_0x519f73);_0x31e822['next']();}};}; \ No newline at end of file +var _0x063d=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','validate','shelljs','../../../../config/logger','routing','string','error','map','message','join','info'];(function(_0x29916a,_0x3778d4){var _0xffbf8e=function(_0x4924b9){while(--_0x4924b9){_0x29916a['push'](_0x29916a['shift']());}};_0xffbf8e(++_0x3778d4);}(_0x063d,0x80));var _0xd063=function(_0x4768ab,_0x3a307e){_0x4768ab=_0x4768ab-0x0;var _0x5f22eb=_0x063d[_0x4768ab];return _0x5f22eb;};'use strict';var schema=require(_0xd063('0x0'));var sh=require(_0xd063('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xd063('0x2'))(_0xd063('0x3'));var system=schema({'command':{'type':_0xd063('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x39c9da,_0x1556d6){return function(_0x52c3b1){try{var _0x22ffd5={'command':_0x1556d6[0x0]};var _0x42f8b9=system[_0xd063('0x0')](_0x22ffd5,{'typecast':!![]});if(_0x42f8b9['length']){logger[_0xd063('0x5')]('[%s][SYSTEM]\x20%s',_0x39c9da,_[_0xd063('0x6')](_0x42f8b9,_0xd063('0x7'))[_0xd063('0x8')](',\x20'));logger[_0xd063('0x9')](_0xd063('0xa'),_0x39c9da);_0x52c3b1[_0xd063('0xb')]();}else{var _0x236c36=this;var _0x12c92f=utils[_0xd063('0xc')](_0x1556d6[0x0],this);logger[_0xd063('0x9')](_0xd063('0xd'),_0x39c9da,_0x12c92f);sh[_0xd063('0xe')](_[_0xd063('0xf')](_0x12c92f),function(_0x25401d,_0x1fb835){logger[_0xd063('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x39c9da,_0x25401d);if(_0x25401d==0x0){var _0x100057=_0x1fb835[_0xd063('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xd063('0x11')](_0x1556d6[0x1])||_[_0xd063('0x12')](_0x1556d6[0x1])){logger[_0xd063('0x9')](_0xd063('0x13'),_0x39c9da);_0x236c36[_0xd063('0x14')][_0x1556d6[0x1]]=_0x100057;}else{logger['info'](_0xd063('0x15'),_0x39c9da,_0x1556d6[0x1],_0x100057);_0x236c36[_0xd063('0x14')][_0x1556d6[0x1]]=_0x100057;}}_0x52c3b1['next']();});}}catch(_0xab66c0){logger['error'](_0xd063('0x16'),_0x39c9da,_['isObject'](_0xab66c0)?JSON['stringify'](_0xab66c0):_0xab66c0);logger[_0xd063('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x39c9da);_0x52c3b1[_0xd063('0xb')]();}};}; \ 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 b475cb4..983a2bf 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 _0xeb88=['length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xeb88,0x190));var _0x8eb8=function(_0x37b12d,_0x183fba){_0x37b12d=_0x37b12d-0x0;var _0x5be5f7=_0xeb88[_0x37b12d];return _0x5be5f7;};'use strict';var schema=require(_0x8eb8('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x8eb8('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8eb8('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8eb8('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x8eb8('0x4'))('routing');var tag=schema({'tag':{'type':_0x8eb8('0x5'),'required':!![],'message':_0x8eb8('0x6')}});exports[_0x8eb8('0x7')]=function(_0x3dd477,_0x33580f,_0x478620,_0x3ae09a){return function(_0x231465){try{var _0x173fd0={'tag':_0x33580f[0x0]};var _0x555070=tag['validate'](_0x173fd0,{'typecast':!![]});if(_0x555070[_0x8eb8('0x8')]){logger[_0x8eb8('0x9')](_0x8eb8('0xa'),_0x3dd477,_[_0x8eb8('0xb')](_0x555070,_0x8eb8('0xc'))[_0x8eb8('0xd')](',\x20'));logger[_0x8eb8('0xe')](_0x8eb8('0xf'),_0x3dd477);_0x231465[_0x8eb8('0x10')]();}else{var _0x224dd6={'ids':[_0x33580f[0x0]]};if(rpc[_0x3ae09a[_0x8eb8('0x11')]+'Interaction']){rpc[_0x3ae09a['channel']+_0x8eb8('0x12')][_0x8eb8('0x13')](_0x3ae09a[_0x8eb8('0x14')]['id'],_0x224dd6)['then'](function(_0xf171b5){logger['info'](_0x8eb8('0x15'),_0x3dd477,_0x33580f[0x1],_0x3ae09a[_0x8eb8('0x11')],_0x3ae09a[_0x8eb8('0x14')]['id']);})[_0x8eb8('0x16')](function(_0xd08d41){logger[_0x8eb8('0x9')](_0x8eb8('0xa'),_0x3dd477,JSON['stringify'](_0xd08d41));logger['info'](_0x8eb8('0xf'),_0x3dd477);})['finally'](function(){_0x231465[_0x8eb8('0x10')]();});}}}catch(_0x206dc8){logger[_0x8eb8('0x9')](_0x8eb8('0xa'),_0x3dd477,_['isObject'](_0x206dc8)?JSON[_0x8eb8('0x17')](_0x206dc8):_0x206dc8);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3dd477);_0x231465['next']();}};}; \ No newline at end of file +var _0x44af=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','next','lodash'];(function(_0x360fad,_0x2dc207){var _0x199233=function(_0x2e2982){while(--_0x2e2982){_0x360fad['push'](_0x360fad['shift']());}};_0x199233(++_0x2dc207);}(_0x44af,0x90));var _0xf44a=function(_0x3b534c,_0x2c614f){_0x3b534c=_0x3b534c-0x0;var _0x449ef9=_0x44af[_0x3b534c];return _0x449ef9;};'use strict';var schema=require('validate');var _=require(_0xf44a('0x0'));var rpc={'chatInteraction':require(_0xf44a('0x1')),'openchannelInteraction':require(_0xf44a('0x2')),'smsInteraction':require(_0xf44a('0x3')),'mailInteraction':require(_0xf44a('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf44a('0x5'))};var logger=require(_0xf44a('0x6'))(_0xf44a('0x7'));var tag=schema({'tag':{'type':_0xf44a('0x8'),'required':!![],'message':_0xf44a('0x9')}});exports[_0xf44a('0xa')]=function(_0x361517,_0x229e38,_0xbb9fd7,_0x530fcf){return function(_0x535caf){try{var _0x4d09a8={'tag':_0x229e38[0x0]};var _0x23c4c5=tag[_0xf44a('0xb')](_0x4d09a8,{'typecast':!![]});if(_0x23c4c5[_0xf44a('0xc')]){logger[_0xf44a('0xd')](_0xf44a('0xe'),_0x361517,_[_0xf44a('0xf')](_0x23c4c5,'message')['join'](',\x20'));logger[_0xf44a('0x10')](_0xf44a('0x11'),_0x361517);_0x535caf['next']();}else{var _0x1f4c5d={'ids':[_0x229e38[0x0]]};if(rpc[_0x530fcf[_0xf44a('0x12')]+_0xf44a('0x13')]){rpc[_0x530fcf['channel']+_0xf44a('0x13')][_0xf44a('0x14')](_0x530fcf[_0xf44a('0x15')]['id'],_0x1f4c5d)[_0xf44a('0x16')](function(_0x5b9c6b){logger[_0xf44a('0x10')](_0xf44a('0x17'),_0x361517,_0x229e38[0x1],_0x530fcf[_0xf44a('0x12')],_0x530fcf[_0xf44a('0x15')]['id']);})[_0xf44a('0x18')](function(_0x134166){logger[_0xf44a('0xd')](_0xf44a('0xe'),_0x361517,JSON[_0xf44a('0x19')](_0x134166));logger[_0xf44a('0x10')](_0xf44a('0x11'),_0x361517);})[_0xf44a('0x1a')](function(){_0x535caf['next']();});}}}catch(_0x50c905){logger[_0xf44a('0xd')](_0xf44a('0xe'),_0x361517,_[_0xf44a('0x1b')](_0x50c905)?JSON[_0xf44a('0x19')](_0x50c905):_0x50c905);logger[_0xf44a('0x10')](_0xf44a('0x11'),_0x361517);_0x535caf[_0xf44a('0x1c')]();}};}; \ 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 0f753a4..f329d2a 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 _0x9ffd=['contact','message','list','mustache','lodash','exports','render','merge','body'];(function(_0x6a9a89,_0x18eea2){var _0x390db1=function(_0x49f2ef){while(--_0x49f2ef){_0x6a9a89['push'](_0x6a9a89['shift']());}};_0x390db1(++_0x18eea2);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x1679b7,_0x4dfaaa){_0x1679b7=_0x1679b7-0x0;var _0x3719cc=_0x9ffd[_0x1679b7];return _0x3719cc;};'use strict';var Mustache=require(_0xd9ff('0x0'));var _=require(_0xd9ff('0x1'));module[_0xd9ff('0x2')]={'getMustacheRender':function(_0x223887,_0x506b92){return Mustache[_0xd9ff('0x3')](_0x223887,_[_0xd9ff('0x4')](_0x506b92[_0xd9ff('0x5')],{'contact':_0x506b92[_0xd9ff('0x6')],'message':_0x506b92[_0xd9ff('0x7')],'account':_0x506b92['account'],'interaction':_0x506b92['interaction'],'list':_0x506b92[_0xd9ff('0x8')]}))||'';}}; \ No newline at end of file +var _0xa37e=['interaction','exports','render','body','message','account'];(function(_0x10c335,_0x111d3b){var _0x1ee39e=function(_0x19987f){while(--_0x19987f){_0x10c335['push'](_0x10c335['shift']());}};_0x1ee39e(++_0x111d3b);}(_0xa37e,0x97));var _0xea37=function(_0x440d29,_0x56780f){_0x440d29=_0x440d29-0x0;var _0x34f0bc=_0xa37e[_0x440d29];return _0x34f0bc;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0xea37('0x0')]={'getMustacheRender':function(_0x42f098,_0x204a22){return Mustache[_0xea37('0x1')](_0x42f098,_['merge'](_0x204a22[_0xea37('0x2')],{'contact':_0x204a22['contact'],'message':_0x204a22[_0xea37('0x3')],'account':_0x204a22[_0xea37('0x4')],'interaction':_0x204a22[_0xea37('0x5')],'list':_0x204a22['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 861bdeb..9acfa7a 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 _0xfd7b=['loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available'];(function(_0x5c27b6,_0x4a3c28){var _0x284ce4=function(_0x29fa20){while(--_0x29fa20){_0x5c27b6['push'](_0x5c27b6['shift']());}};_0x284ce4(++_0x4a3c28);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xfd7b[_0x47e7cb];return _0x2a8874;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var fs=require('fs');var jayson=require(_0xbfd7('0x2'));var BPromise=require(_0xbfd7('0x3'));var uuid=require(_0xbfd7('0x4'));var config=require(_0xbfd7('0x5'));var logger=require(_0xbfd7('0x6'))(_0xbfd7('0x7'));var rpc={'openchannelQueueReport':require(_0xbfd7('0x8')),'mailQueueReport':require(_0xbfd7('0x9')),'chatQueueReport':require(_0xbfd7('0xa')),'smsQueueReport':require(_0xbfd7('0xb')),'faxQueueReport':require(_0xbfd7('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xbfd7('0xd'));function getId(_0x48f2aa,_0x33dab1,_0x5cee3d){return util[_0xbfd7('0xe')](_0xbfd7('0xf'),_0x48f2aa,_0x33dab1||0x0,_0x5cee3d||0x0);}function getIntervals(_0x5a3d78,_0x3b7670){var _0x47e7c2=[];if(!_[_0xbfd7('0x10')](_0x3b7670[_0xbfd7('0x11')])&&!_['isNil'](_0x5a3d78[_0x3b7670['IntervalId']])&&!_[_0xbfd7('0x10')](_0x5a3d78[_0x3b7670[_0xbfd7('0x11')]][_0xbfd7('0x12')])){_0x47e7c2=_[_0xbfd7('0x13')](_0x5a3d78[_0x3b7670[_0xbfd7('0x11')]]['Intervals'],_0xbfd7('0x14'));}else if(!_['isNil'](_0x3b7670[_0xbfd7('0x14')])){_0x47e7c2=[_0x3b7670['interval']];}return _0x47e7c2;}exports['listen']=function(_0x44847e){_0x44847e[_0xbfd7('0x15')]={};return new BPromise(function(_0x3789b7,_0x371592){var _0x5abca0={'Start':function(_0x5efd54){var _0x48f4a4=this;return new Promise(function(_0x37e777,_0x115a34){if(_0x5efd54){try{var _0x33d900=[];var _0x3e8754=getId(_0x5efd54[_0xbfd7('0x16')],_0x5efd54[_0xbfd7('0x17')]?_0x5efd54[_0xbfd7('0x17')]['id']:0x0,_0x5efd54[_0xbfd7('0x18')]?_0x5efd54[_0xbfd7('0x18')]['id']:0x0);if(_0x5efd54['applications']&&_['isArray'](_0x5efd54[_0xbfd7('0x19')])&&_0x5efd54[_0xbfd7('0x19')]['length']){for(var _0x5ea27a=0x0;_0x5ea27a<_0x5efd54[_0xbfd7('0x19')]['length'];_0x5ea27a+=0x1){var _0x5025ee=_0x5efd54[_0xbfd7('0x19')][_0x5ea27a];if(fs['existsSync'](path[_0xbfd7('0x1a')](__dirname,_0xbfd7('0x19'),_0x5025ee[_0xbfd7('0x1b')]+_0xbfd7('0x1c')))){var _0x59d8de=[];switch(_0x5025ee[_0xbfd7('0x1b')][_0xbfd7('0x1d')]()){case _0xbfd7('0x1e'):var _0x630a56=_0x5025ee[_0xbfd7('0x1f')][_0xbfd7('0x20')](',');if(_0x5efd54['channel']===_0xbfd7('0x21')){_0x59d8de[_0xbfd7('0x22')](_0x630a56[0x0]);_0x59d8de[_0xbfd7('0x22')](_0x630a56[0x1]);_0x59d8de['push'](_0x630a56[_0xbfd7('0x23')](0x2,_0x630a56[_0xbfd7('0x24')])[_0xbfd7('0x1a')](','));}else{_0x59d8de[_0xbfd7('0x22')](_0x630a56[0x0]);_0x59d8de[_0xbfd7('0x22')](_0x630a56['slice'](0x1,_0x630a56[_0xbfd7('0x24')])[_0xbfd7('0x1a')](','));}break;case _0xbfd7('0x25'):var _0x3b08cc=_0x5025ee[_0xbfd7('0x1f')][_0xbfd7('0x20')](',');_0x59d8de[_0xbfd7('0x22')](_0x3b08cc[0x0]);_0x59d8de['push'](_0x3b08cc[0x1]);_0x59d8de[_0xbfd7('0x22')](_0x3b08cc[_0xbfd7('0x23')](0x2,_0x3b08cc['length'])[_0xbfd7('0x1a')](','));break;case _0xbfd7('0x26'):var _0x2ec4a5=_0x5025ee[_0xbfd7('0x1f')]['split'](',');_0x59d8de[_0xbfd7('0x22')](_0x2ec4a5[0x0]);_0x59d8de[_0xbfd7('0x22')](_0x2ec4a5[0x1]);_0x59d8de[_0xbfd7('0x22')](_0x2ec4a5[0x2]);_0x59d8de['push'](_0x2ec4a5[0x3]);_0x59d8de[_0xbfd7('0x22')](_0x2ec4a5['slice'](0x4,_0x2ec4a5[_0xbfd7('0x24')])['join'](','));break;case _0xbfd7('0x27'):var _0x1804a5=_0x5025ee['appdata'][_0xbfd7('0x20')](',');_0x59d8de[_0xbfd7('0x22')](_0x1804a5[0x0]);_0x59d8de['push'](_0x1804a5[0x1]);_0x59d8de[_0xbfd7('0x22')](_0x1804a5[0x2]);_0x59d8de[_0xbfd7('0x22')](_0x1804a5[0x3]);_0x59d8de[_0xbfd7('0x22')](_0x1804a5['slice'](0x4,_0x1804a5[_0xbfd7('0x24')])[_0xbfd7('0x1a')](','));break;case _0xbfd7('0x17'):_0x59d8de[_0xbfd7('0x22')](_0x5025ee[_0xbfd7('0x1f')]);break;case _0xbfd7('0x28'):_0x59d8de[_0xbfd7('0x22')](_0x5025ee[_0xbfd7('0x29')]);_0x59d8de[_0xbfd7('0x22')](_0x5025ee[_0xbfd7('0x1f')]);break;default:_0x59d8de=_[_0xbfd7('0x10')](_0x5025ee['appdata'])?[]:_0x5025ee[_0xbfd7('0x1f')]['split'](',');}var _0x52d1f8={'id':util[_0xbfd7('0xe')](_0xbfd7('0x2a'),_0x3e8754,_0x5025ee['id'],_0x5025ee[_0xbfd7('0x1b')]),'condition':require(_0xbfd7('0x2b'))[_0xbfd7('0x2c')](_0x3e8754,getIntervals(_0x44847e[_0xbfd7('0x2d')],_0x5025ee),_0x44847e),'consequence':require(_0xbfd7('0x2e')+_0x5025ee[_0xbfd7('0x1b')])['consequence'](_0x3e8754,_0x59d8de,_0x44847e,_0x5efd54),'p':_0x5025ee['priority']||0x0};logger[_0xbfd7('0x2f')](_0xbfd7('0x30'),_0x52d1f8['id'],'on\x20interval',getIntervals(_0x44847e[_0xbfd7('0x2d')],_0x5025ee)[_0xbfd7('0x1a')]('\x20|\x20'));_0x33d900['push'](_0x52d1f8);}else{logger[_0xbfd7('0x31')](_0xbfd7('0x32'),path['join'](__dirname,_0xbfd7('0x19'),_0x5025ee[_0xbfd7('0x1b')]+_0xbfd7('0x1c')));}}_0x44847e[_0xbfd7('0x15')][_0x3e8754]=new RuleEngine(_0x33d900);_0x44847e[_0xbfd7('0x15')][_0x3e8754]['execute'](_0x5efd54,function(_0x4609a5){logger[_0xbfd7('0x2f')](_0xbfd7('0x33'),JSON[_0xbfd7('0x34')](_0x4609a5[_0xbfd7('0x35')]));if(_0x44847e[_0xbfd7('0x15')][_0x3e8754]){_0x44847e[_0xbfd7('0x15')][_0x3e8754][_0xbfd7('0x36')]('complete');}});return _0x37e777({'code':0xc8,'message':_0x5efd54});}else{logger[_0xbfd7('0x2f')]('No\x20applications\x20to\x20execute');return _0x37e777({'code':0xc8,'message':_0x5efd54});}}catch(_0x483719){logger[_0xbfd7('0x31')](_0x483719[_0xbfd7('0x37')]);return _0x115a34(_0x48f4a4[_0xbfd7('0x31')](0x1f4,_0x483719));}}return _0x115a34(_0xbfd7('0x38'));});},'AcceptMessage':function(_0x17458b){var _0x1236dd=this;return new Promise(function(_0x4cb871,_0x10dc21){if(_0x17458b['agent']&&_0x17458b[_0xbfd7('0x39')]['id']){if(_0x44847e[_0xbfd7('0x3a')][_0x17458b[_0xbfd7('0x39')]['id']]){_0x44847e[_0xbfd7('0x3a')][_0x17458b[_0xbfd7('0x39')]['id']][_0xbfd7('0x3b')]=![];_0x44847e[_0xbfd7('0x3a')][_0x17458b['agent']['id']][_0xbfd7('0x3c')]=undefined;}}if(_0x17458b[_0xbfd7('0x17')]&&_0x17458b[_0xbfd7('0x17')]['id']){try{var _0x1d2248=getId(_0x17458b[_0xbfd7('0x16')],_0x17458b[_0xbfd7('0x17')]?_0x17458b[_0xbfd7('0x17')]['id']:0x0,_0x17458b['interaction']?_0x17458b[_0xbfd7('0x18')]['id']:0x0);if(_0x44847e[_0xbfd7('0x15')][_0x1d2248]){_0x44847e[_0xbfd7('0x15')][_0x1d2248]['emit']('end');if(rpc[_0x17458b['channel']+_0xbfd7('0x3d')]){rpc[_0x17458b[_0xbfd7('0x16')]+_0xbfd7('0x3d')][_0xbfd7('0x3e')](_0x1d2248,{'UserId':_0x17458b['message'][_0xbfd7('0x3f')]})['catch'](function(_0x237319){logger[_0xbfd7('0x31')]('error\x20update\x20queue\x20report');});}}return _0x4cb871({'code':0xc8,'message':_0x17458b});}catch(_0x4137aa){logger['error'](_0x4137aa[_0xbfd7('0x37')]);return _0x10dc21(_0x1236dd[_0xbfd7('0x31')](0x1f4,_0x4137aa));}}logger[_0xbfd7('0x31')]('message\x20is\x20empty');return _0x10dc21(_0x1236dd['error'](0x1f4,_0xbfd7('0x40')));});},'RejectMessage':function(_0xb8b319){var _0x4d700e=this;return new Promise(function(_0x4bc6d2,_0x33f169){if(_0xb8b319[_0xbfd7('0x39')]&&_0xb8b319[_0xbfd7('0x39')]['id']){try{if(_0x44847e[_0xbfd7('0x3a')][_0xb8b319[_0xbfd7('0x39')]['id']]){_0x44847e[_0xbfd7('0x3a')][_0xb8b319[_0xbfd7('0x39')]['id']]['busy']=![];_0x44847e['agents'][_0xb8b319['agent']['id']][_0xbfd7('0x3c')]=undefined;}return _0x4bc6d2({'code':0xc8,'message':_0xb8b319});}catch(_0x20bd15){logger[_0xbfd7('0x31')](_0x20bd15['stack']);return _0x33f169(_0x4d700e[_0xbfd7('0x31')](0x1f4,_0x20bd15));}}logger[_0xbfd7('0x31')]('message\x20is\x20empty');return _0x33f169(_0x4d700e['error'](0x1f4,_0xbfd7('0x40')));});},'AbandonInteraction':function(_0x7443a1){var _0x45154d=this;return new Promise(function(_0x5ed39b,_0x35ff73){if(_0x7443a1[_0xbfd7('0x16')]&&_0x7443a1[_0xbfd7('0x18')]&&_0x7443a1['interaction']['id']){try{var _0x371d01=getId(_0x7443a1[_0xbfd7('0x16')],_0x7443a1[_0xbfd7('0x17')]?_0x7443a1[_0xbfd7('0x17')]['id']:0x0,_0x7443a1['interaction']?_0x7443a1[_0xbfd7('0x18')]['id']:0x0);if(_0x44847e[_0xbfd7('0x15')][_0x371d01]){_0x44847e[_0xbfd7('0x15')][_0x371d01]['emit'](_0xbfd7('0x41'));}return _0x5ed39b({'code':0xc8,'message':_0x7443a1});}catch(_0x5e48fa){logger[_0xbfd7('0x31')](_0x5e48fa[_0xbfd7('0x37')]);return _0x35ff73(_0x45154d[_0xbfd7('0x31')](0x1f4,_0x5e48fa));}}logger[_0xbfd7('0x31')]('message\x20is\x20empty');return _0x35ff73(_0x45154d[_0xbfd7('0x31')](0x1f4,_0xbfd7('0x40')));});},'AgentCapacity':function(_0x58cb5b){var _0x3f037a=this;return new Promise(function(_0x1e0e82,_0x110b62){if(_0x44847e[_0xbfd7('0x3a')][_0xbfd7('0x42')](_0x58cb5b['id'])){for(var _0x36d56b in _0x58cb5b[_0xbfd7('0x43')]){if(_0x58cb5b[_0xbfd7('0x43')][_0xbfd7('0x42')](_0x36d56b)){if(_0x44847e[_0xbfd7('0x3a')][_0x58cb5b['id']][_0xbfd7('0x42')](_0x36d56b+'CurrentCapacity')){_0x44847e['agents'][_0x58cb5b['id']][_0x36d56b+_0xbfd7('0x44')]=parseInt(_0x58cb5b[_0xbfd7('0x43')][_0x36d56b],0xa);}}}_0x44847e[_0xbfd7('0x3a')][_0x58cb5b['id']][_0xbfd7('0x45')]();return _0x1e0e82({'code':0xc8,'message':_0x44847e[_0xbfd7('0x3a')][_0x58cb5b['id']]});}else{return _0x110b62(_0x3f037a[_0xbfd7('0x31')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2fd34e){return new Promise(function(_0x56f62f,_0x5b5ea0){var _0x583846=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x3a')]);_0x56f62f({'count':_0x583846['length'],'rows':_0x583846});});},'ChatQueues':function(_0xbb26b1){return new Promise(function(_0x3f4105,_0x2c71eb){var _0xdd157a=[];for(var _0x3dcd77 in _0x44847e[_0xbfd7('0x47')]){if(_0x44847e[_0xbfd7('0x47')][_0xbfd7('0x42')](_0x3dcd77)){var _0x3c6ced=_0x44847e['chatQueues'][_0x3dcd77];var _0x229815={'id':_0x3c6ced['id'],'available':_0x3c6ced[_0xbfd7('0x48')],'loggedIn':_0x3c6ced[_0xbfd7('0x49')],'name':_0x3c6ced['name'],'paused':_0x3c6ced['paused'],'waiting':_0x3c6ced[_0xbfd7('0x4a')]};_0xdd157a[_0xbfd7('0x22')](_0x229815);}}_0x3f4105({'count':_0xdd157a[_0xbfd7('0x24')],'rows':_0xdd157a});});},'MailQueues':function(_0x22b7fa){return new Promise(function(_0x508a8a,_0x41d54c){var _0x343ec2=[];for(var _0x283d68 in _0x44847e[_0xbfd7('0x4b')]){if(_0x44847e[_0xbfd7('0x4b')][_0xbfd7('0x42')](_0x283d68)){var _0x478381=_0x44847e[_0xbfd7('0x4b')][_0x283d68];var _0x286e51={'id':_0x478381['id'],'available':_0x478381[_0xbfd7('0x48')],'loggedIn':_0x478381[_0xbfd7('0x49')],'name':_0x478381[_0xbfd7('0x4c')],'paused':_0x478381[_0xbfd7('0x4d')],'waiting':_0x478381['waiting']};_0x343ec2[_0xbfd7('0x22')](_0x286e51);}}_0x508a8a({'count':_0x343ec2[_0xbfd7('0x24')],'rows':_0x343ec2});});},'OpenchannelQueues':function(_0x1201e2){return new Promise(function(_0x4e32db,_0xcc70aa){var _0x7d7684=[];for(var _0x440c24 in _0x44847e[_0xbfd7('0x4e')]){if(_0x44847e[_0xbfd7('0x4e')]['hasOwnProperty'](_0x440c24)){var _0x3196a7=_0x44847e[_0xbfd7('0x4e')][_0x440c24];var _0x1be70d={'id':_0x3196a7['id'],'available':_0x3196a7[_0xbfd7('0x48')],'loggedIn':_0x3196a7[_0xbfd7('0x49')],'name':_0x3196a7[_0xbfd7('0x4c')],'paused':_0x3196a7[_0xbfd7('0x4d')],'waiting':_0x3196a7[_0xbfd7('0x4a')]};_0x7d7684[_0xbfd7('0x22')](_0x1be70d);}}_0x4e32db({'count':_0x7d7684[_0xbfd7('0x24')],'rows':_0x7d7684});});},'SmsQueues':function(_0x194aa8){return new Promise(function(_0x438a67,_0x4abf69){var _0x4f2b7f=[];for(var _0x585c1c in _0x44847e[_0xbfd7('0x4f')]){if(_0x44847e[_0xbfd7('0x4f')][_0xbfd7('0x42')](_0x585c1c)){var _0x58757c=_0x44847e['smsQueues'][_0x585c1c];var _0x2d9824={'id':_0x58757c['id'],'available':_0x58757c[_0xbfd7('0x48')],'loggedIn':_0x58757c['loggedIn'],'name':_0x58757c[_0xbfd7('0x4c')],'paused':_0x58757c[_0xbfd7('0x4d')],'waiting':_0x58757c['waiting']};_0x4f2b7f[_0xbfd7('0x22')](_0x2d9824);}}_0x438a67({'count':_0x4f2b7f[_0xbfd7('0x24')],'rows':_0x4f2b7f});});},'FaxQueues':function(_0x11cf3b){return new Promise(function(_0x5ad203,_0x93f60){var _0x57473b=[];for(var _0x387c23 in _0x44847e[_0xbfd7('0x50')]){if(_0x44847e[_0xbfd7('0x50')][_0xbfd7('0x42')](_0x387c23)){var _0x320cbf=_0x44847e[_0xbfd7('0x50')][_0x387c23];var _0x44c294={'id':_0x320cbf['id'],'available':_0x320cbf[_0xbfd7('0x48')],'loggedIn':_0x320cbf[_0xbfd7('0x49')],'name':_0x320cbf['name'],'paused':_0x320cbf[_0xbfd7('0x4d')],'waiting':_0x320cbf[_0xbfd7('0x4a')]};_0x57473b[_0xbfd7('0x22')](_0x44c294);}}_0x5ad203({'count':_0x57473b[_0xbfd7('0x24')],'rows':_0x57473b});});},'WhatsappQueues':function(_0x7ba173){return new Promise(function(_0x2c3fc4,_0x2ef9ae){var _0x431ea2=[];for(var _0x53cd56 in _0x44847e[_0xbfd7('0x51')]){if(_0x44847e[_0xbfd7('0x51')]['hasOwnProperty'](_0x53cd56)){var _0x5a6173=_0x44847e[_0xbfd7('0x51')][_0x53cd56];var _0x68a595={'id':_0x5a6173['id'],'available':_0x5a6173[_0xbfd7('0x48')],'loggedIn':_0x5a6173[_0xbfd7('0x49')],'name':_0x5a6173[_0xbfd7('0x4c')],'paused':_0x5a6173[_0xbfd7('0x4d')],'waiting':_0x5a6173[_0xbfd7('0x4a')]};_0x431ea2[_0xbfd7('0x22')](_0x68a595);}}_0x2c3fc4({'count':_0x431ea2['length'],'rows':_0x431ea2});});},'ChatQueuesWaitingInteractions':function(_0x341220){return new Promise(function(_0xbc779b,_0x1a42b9){var _0x350ac0=_[_0xbfd7('0x46')](_0x44847e['chatQueuesWaitingInteractions']);_0xbc779b({'count':_0x350ac0[_0xbfd7('0x24')],'rows':_0x350ac0});});},'MailQueuesWaitingInteractions':function(_0x491546){return new Promise(function(_0x47db73,_0x98a161){var _0x285cd8=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x52')]);_0x47db73({'count':_0x285cd8['length'],'rows':_0x285cd8});});},'OpenchannelQueuesWaitingInteractions':function(_0x121e3c){return new Promise(function(_0x17d5d0,_0x6d6aec){var _0x1c2dc7=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x53')]);_0x17d5d0({'count':_0x1c2dc7[_0xbfd7('0x24')],'rows':_0x1c2dc7});});},'SmsQueuesWaitingInteractions':function(_0x341fab){return new Promise(function(_0x3281e6,_0x4ba614){var _0x4b3891=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x54')]);_0x3281e6({'count':_0x4b3891['length'],'rows':_0x4b3891});});},'FaxQueuesWaitingInteractions':function(_0x26fd27){return new Promise(function(_0x35371d,_0x358cc5){var _0x10a505=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x55')]);_0x35371d({'count':_0x10a505[_0xbfd7('0x24')],'rows':_0x10a505});});},'WhatsappQueuesWaitingInteractions':function(_0x3790bb){return new Promise(function(_0x7be191,_0x69d93c){var _0x1f517c=_[_0xbfd7('0x46')](_0x44847e[_0xbfd7('0x56')]);_0x7be191({'count':_0x1f517c['length'],'rows':_0x1f517c});});}};var _0x39ee78=jayson[_0xbfd7('0x57')](_0x5abca0)[_0xbfd7('0x58')]();_0x39ee78['on'](_0xbfd7('0x31'),function(_0x1eaa80){logger[_0xbfd7('0x31')](JSON[_0xbfd7('0x34')](_0x1eaa80));return _0x371592(_0x1eaa80);});_0x39ee78['listen'](0x232c,_0xbfd7('0x59'),function(){console[_0xbfd7('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3789b7(_0xbfd7('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x72b1=['mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','message','tag','TagId','./interval','condition','intervals','app','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','hasOwnProperty','available','name','mailQueues','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','interaction','applications','isArray','length','existsSync','toLowerCase','autoreply','appdata','split'];(function(_0x1b8bda,_0x43ad31){var _0x1f7050=function(_0x1d8dc6){while(--_0x1d8dc6){_0x1b8bda['push'](_0x1b8bda['shift']());}};_0x1f7050(++_0x43ad31);}(_0x72b1,0x16e));var _0x172b=function(_0x2d83bb,_0x2d09ce){_0x2d83bb=_0x2d83bb-0x0;var _0x282e9e=_0x72b1[_0x2d83bb];return _0x282e9e;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var fs=require('fs');var jayson=require(_0x172b('0x2'));var BPromise=require(_0x172b('0x3'));var uuid=require(_0x172b('0x4'));var config=require(_0x172b('0x5'));var logger=require(_0x172b('0x6'))(_0x172b('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x172b('0x8')),'chatQueueReport':require(_0x172b('0x9')),'smsQueueReport':require(_0x172b('0xa')),'faxQueueReport':require(_0x172b('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x172b('0xc'));function getId(_0x517363,_0x1f98e9,_0x531b10){return util[_0x172b('0xd')](_0x172b('0xe'),_0x517363,_0x1f98e9||0x0,_0x531b10||0x0);}function getIntervals(_0x977f18,_0x392f1e){var _0x50e58a=[];if(!_[_0x172b('0xf')](_0x392f1e[_0x172b('0x10')])&&!_[_0x172b('0xf')](_0x977f18[_0x392f1e[_0x172b('0x10')]])&&!_[_0x172b('0xf')](_0x977f18[_0x392f1e[_0x172b('0x10')]][_0x172b('0x11')])){_0x50e58a=_['map'](_0x977f18[_0x392f1e[_0x172b('0x10')]][_0x172b('0x11')],_0x172b('0x12'));}else if(!_['isNil'](_0x392f1e[_0x172b('0x12')])){_0x50e58a=[_0x392f1e['interval']];}return _0x50e58a;}exports[_0x172b('0x13')]=function(_0x81e11e){_0x81e11e['rules']={};return new BPromise(function(_0x1b7247,_0x3452f2){var _0x2790ed={'Start':function(_0xa28463){var _0x5b0ab1=this;return new Promise(function(_0x5293ef,_0x3625bb){if(_0xa28463){try{var _0x34be39=[];var _0x36af74=getId(_0xa28463[_0x172b('0x14')],_0xa28463['message']?_0xa28463['message']['id']:0x0,_0xa28463[_0x172b('0x15')]?_0xa28463[_0x172b('0x15')]['id']:0x0);if(_0xa28463[_0x172b('0x16')]&&_[_0x172b('0x17')](_0xa28463[_0x172b('0x16')])&&_0xa28463['applications'][_0x172b('0x18')]){for(var _0x2d24f9=0x0;_0x2d24f9<_0xa28463[_0x172b('0x16')][_0x172b('0x18')];_0x2d24f9+=0x1){var _0x12f3ec=_0xa28463[_0x172b('0x16')][_0x2d24f9];if(fs[_0x172b('0x19')](path['join'](__dirname,'applications',_0x12f3ec['app']+'.js'))){var _0x13cfc7=[];switch(_0x12f3ec['app'][_0x172b('0x1a')]()){case _0x172b('0x1b'):var _0x19ca8e=_0x12f3ec[_0x172b('0x1c')][_0x172b('0x1d')](',');if(_0xa28463[_0x172b('0x14')]===_0x172b('0x1e')){_0x13cfc7[_0x172b('0x1f')](_0x19ca8e[0x0]);_0x13cfc7[_0x172b('0x1f')](_0x19ca8e[0x1]);_0x13cfc7['push'](_0x19ca8e[_0x172b('0x20')](0x2,_0x19ca8e[_0x172b('0x18')])[_0x172b('0x21')](','));}else{_0x13cfc7[_0x172b('0x1f')](_0x19ca8e[0x0]);_0x13cfc7[_0x172b('0x1f')](_0x19ca8e[_0x172b('0x20')](0x1,_0x19ca8e[_0x172b('0x18')])['join'](','));}break;case _0x172b('0x22'):var _0x22827a=_0x12f3ec['appdata'][_0x172b('0x1d')](',');_0x13cfc7[_0x172b('0x1f')](_0x22827a[0x0]);_0x13cfc7[_0x172b('0x1f')](_0x22827a[0x1]);_0x13cfc7[_0x172b('0x1f')](_0x22827a[_0x172b('0x20')](0x2,_0x22827a['length'])[_0x172b('0x21')](','));break;case _0x172b('0x23'):var _0x596b4c=_0x12f3ec['appdata'][_0x172b('0x1d')](',');_0x13cfc7[_0x172b('0x1f')](_0x596b4c[0x0]);_0x13cfc7[_0x172b('0x1f')](_0x596b4c[0x1]);_0x13cfc7[_0x172b('0x1f')](_0x596b4c[0x2]);_0x13cfc7[_0x172b('0x1f')](_0x596b4c[0x3]);_0x13cfc7[_0x172b('0x1f')](_0x596b4c[_0x172b('0x20')](0x4,_0x596b4c[_0x172b('0x18')])[_0x172b('0x21')](','));break;case _0x172b('0x24'):var _0x5a44d4=_0x12f3ec[_0x172b('0x1c')][_0x172b('0x1d')](',');_0x13cfc7[_0x172b('0x1f')](_0x5a44d4[0x0]);_0x13cfc7[_0x172b('0x1f')](_0x5a44d4[0x1]);_0x13cfc7[_0x172b('0x1f')](_0x5a44d4[0x2]);_0x13cfc7[_0x172b('0x1f')](_0x5a44d4[0x3]);_0x13cfc7[_0x172b('0x1f')](_0x5a44d4[_0x172b('0x20')](0x4,_0x5a44d4[_0x172b('0x18')])[_0x172b('0x21')](','));break;case _0x172b('0x25'):_0x13cfc7[_0x172b('0x1f')](_0x12f3ec[_0x172b('0x1c')]);break;case _0x172b('0x26'):_0x13cfc7['push'](_0x12f3ec[_0x172b('0x27')]);_0x13cfc7[_0x172b('0x1f')](_0x12f3ec[_0x172b('0x1c')]);break;default:_0x13cfc7=_['isNil'](_0x12f3ec[_0x172b('0x1c')])?[]:_0x12f3ec['appdata']['split'](',');}var _0x5cc073={'id':util[_0x172b('0xd')]('%s:%s:%s',_0x36af74,_0x12f3ec['id'],_0x12f3ec['app']),'condition':require(_0x172b('0x28'))[_0x172b('0x29')](_0x36af74,getIntervals(_0x81e11e[_0x172b('0x2a')],_0x12f3ec),_0x81e11e),'consequence':require('./applications/'+_0x12f3ec[_0x172b('0x2b')])[_0x172b('0x2c')](_0x36af74,_0x13cfc7,_0x81e11e,_0xa28463),'p':_0x12f3ec[_0x172b('0x2d')]||0x0};logger[_0x172b('0x2e')](_0x172b('0x2f'),_0x5cc073['id'],_0x172b('0x30'),getIntervals(_0x81e11e[_0x172b('0x2a')],_0x12f3ec)[_0x172b('0x21')](_0x172b('0x31')));_0x34be39[_0x172b('0x1f')](_0x5cc073);}else{logger[_0x172b('0x32')](_0x172b('0x33'),path[_0x172b('0x21')](__dirname,_0x172b('0x16'),_0x12f3ec[_0x172b('0x2b')]+_0x172b('0x34')));}}_0x81e11e[_0x172b('0x35')][_0x36af74]=new RuleEngine(_0x34be39);_0x81e11e[_0x172b('0x35')][_0x36af74][_0x172b('0x36')](_0xa28463,function(_0x57c754){logger['info'](_0x172b('0x37'),JSON['stringify'](_0x57c754['matchPath']));if(_0x81e11e['rules'][_0x36af74]){_0x81e11e[_0x172b('0x35')][_0x36af74][_0x172b('0x38')](_0x172b('0x39'));}});return _0x5293ef({'code':0xc8,'message':_0xa28463});}else{logger['info'](_0x172b('0x3a'));return _0x5293ef({'code':0xc8,'message':_0xa28463});}}catch(_0x46d868){logger[_0x172b('0x32')](_0x46d868['stack']);return _0x3625bb(_0x5b0ab1[_0x172b('0x32')](0x1f4,_0x46d868));}}return _0x3625bb('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1a3fce){var _0x4a05da=this;return new Promise(function(_0x362f83,_0xc45ecd){if(_0x1a3fce[_0x172b('0x3b')]&&_0x1a3fce[_0x172b('0x3b')]['id']){if(_0x81e11e[_0x172b('0x3c')][_0x1a3fce['agent']['id']]){_0x81e11e[_0x172b('0x3c')][_0x1a3fce[_0x172b('0x3b')]['id']][_0x172b('0x3d')]=![];_0x81e11e[_0x172b('0x3c')][_0x1a3fce[_0x172b('0x3b')]['id']][_0x172b('0x3e')]=undefined;}}if(_0x1a3fce['message']&&_0x1a3fce['message']['id']){try{var _0x496065=getId(_0x1a3fce['channel'],_0x1a3fce['message']?_0x1a3fce['message']['id']:0x0,_0x1a3fce[_0x172b('0x15')]?_0x1a3fce[_0x172b('0x15')]['id']:0x0);if(_0x81e11e[_0x172b('0x35')][_0x496065]){_0x81e11e[_0x172b('0x35')][_0x496065]['emit'](_0x172b('0x3f'));if(rpc[_0x1a3fce[_0x172b('0x14')]+_0x172b('0x40')]){rpc[_0x1a3fce[_0x172b('0x14')]+_0x172b('0x40')][_0x172b('0x41')](_0x496065,{'UserId':_0x1a3fce[_0x172b('0x25')][_0x172b('0x42')]})[_0x172b('0x43')](function(_0x3ab5a6){logger[_0x172b('0x32')](_0x172b('0x44'));});}}return _0x362f83({'code':0xc8,'message':_0x1a3fce});}catch(_0x4f5b6c){logger[_0x172b('0x32')](_0x4f5b6c[_0x172b('0x45')]);return _0xc45ecd(_0x4a05da['error'](0x1f4,_0x4f5b6c));}}logger['error'](_0x172b('0x46'));return _0xc45ecd(_0x4a05da[_0x172b('0x32')](0x1f4,_0x172b('0x46')));});},'RejectMessage':function(_0x571504){var _0x3bfdf8=this;return new Promise(function(_0x5e8e08,_0x52c55c){if(_0x571504[_0x172b('0x3b')]&&_0x571504[_0x172b('0x3b')]['id']){try{if(_0x81e11e[_0x172b('0x3c')][_0x571504[_0x172b('0x3b')]['id']]){_0x81e11e[_0x172b('0x3c')][_0x571504[_0x172b('0x3b')]['id']][_0x172b('0x3d')]=![];_0x81e11e[_0x172b('0x3c')][_0x571504[_0x172b('0x3b')]['id']][_0x172b('0x3e')]=undefined;}return _0x5e8e08({'code':0xc8,'message':_0x571504});}catch(_0x495cca){logger['error'](_0x495cca[_0x172b('0x45')]);return _0x52c55c(_0x3bfdf8[_0x172b('0x32')](0x1f4,_0x495cca));}}logger['error']('message\x20is\x20empty');return _0x52c55c(_0x3bfdf8[_0x172b('0x32')](0x1f4,_0x172b('0x46')));});},'AbandonInteraction':function(_0x10543d){var _0xe6e09c=this;return new Promise(function(_0x3dedd2,_0x1e1793){if(_0x10543d['channel']&&_0x10543d[_0x172b('0x15')]&&_0x10543d['interaction']['id']){try{var _0x5f22eb=getId(_0x10543d[_0x172b('0x14')],_0x10543d[_0x172b('0x25')]?_0x10543d[_0x172b('0x25')]['id']:0x0,_0x10543d['interaction']?_0x10543d[_0x172b('0x15')]['id']:0x0);if(_0x81e11e[_0x172b('0x35')][_0x5f22eb]){_0x81e11e[_0x172b('0x35')][_0x5f22eb]['emit']('end');}return _0x3dedd2({'code':0xc8,'message':_0x10543d});}catch(_0x2cd795){logger[_0x172b('0x32')](_0x2cd795[_0x172b('0x45')]);return _0x1e1793(_0xe6e09c[_0x172b('0x32')](0x1f4,_0x2cd795));}}logger[_0x172b('0x32')](_0x172b('0x46'));return _0x1e1793(_0xe6e09c[_0x172b('0x32')](0x1f4,_0x172b('0x46')));});},'AgentCapacity':function(_0x503c4f){var _0x92a8f7=this;return new Promise(function(_0x4aeae6,_0x47ff1b){if(_0x81e11e[_0x172b('0x3c')]['hasOwnProperty'](_0x503c4f['id'])){for(var _0x1a979a in _0x503c4f[_0x172b('0x47')]){if(_0x503c4f[_0x172b('0x47')]['hasOwnProperty'](_0x1a979a)){if(_0x81e11e[_0x172b('0x3c')][_0x503c4f['id']]['hasOwnProperty'](_0x1a979a+_0x172b('0x48'))){_0x81e11e[_0x172b('0x3c')][_0x503c4f['id']][_0x1a979a+'CurrentCapacity']=parseInt(_0x503c4f[_0x172b('0x47')][_0x1a979a],0xa);}}}_0x81e11e['agents'][_0x503c4f['id']][_0x172b('0x49')]();return _0x4aeae6({'code':0xc8,'message':_0x81e11e[_0x172b('0x3c')][_0x503c4f['id']]});}else{return _0x47ff1b(_0x92a8f7[_0x172b('0x32')](0x1f4,_0x172b('0x4a')));}});},'Agents':function(_0x1831b7){return new Promise(function(_0x47e2bf,_0x41f595){var _0x151b3b=_[_0x172b('0x4b')](_0x81e11e[_0x172b('0x3c')]);_0x47e2bf({'count':_0x151b3b['length'],'rows':_0x151b3b});});},'ChatQueues':function(_0x24ccdd){return new Promise(function(_0x49535f,_0x3c811b){var _0xc9b7e8=[];for(var _0xccaac0 in _0x81e11e[_0x172b('0x4c')]){if(_0x81e11e[_0x172b('0x4c')][_0x172b('0x4d')](_0xccaac0)){var _0x595f84=_0x81e11e[_0x172b('0x4c')][_0xccaac0];var _0x3b2dc1={'id':_0x595f84['id'],'available':_0x595f84[_0x172b('0x4e')],'loggedIn':_0x595f84['loggedIn'],'name':_0x595f84[_0x172b('0x4f')],'paused':_0x595f84['paused'],'waiting':_0x595f84['waiting']};_0xc9b7e8[_0x172b('0x1f')](_0x3b2dc1);}}_0x49535f({'count':_0xc9b7e8[_0x172b('0x18')],'rows':_0xc9b7e8});});},'MailQueues':function(_0x33beea){return new Promise(function(_0x4072e0,_0x1b6f27){var _0x1dc49b=[];for(var _0x426b4c in _0x81e11e[_0x172b('0x50')]){if(_0x81e11e[_0x172b('0x50')][_0x172b('0x4d')](_0x426b4c)){var _0x51c904=_0x81e11e[_0x172b('0x50')][_0x426b4c];var _0xb41655={'id':_0x51c904['id'],'available':_0x51c904[_0x172b('0x4e')],'loggedIn':_0x51c904[_0x172b('0x51')],'name':_0x51c904[_0x172b('0x4f')],'paused':_0x51c904[_0x172b('0x52')],'waiting':_0x51c904[_0x172b('0x53')]};_0x1dc49b[_0x172b('0x1f')](_0xb41655);}}_0x4072e0({'count':_0x1dc49b[_0x172b('0x18')],'rows':_0x1dc49b});});},'OpenchannelQueues':function(_0x3a4a00){return new Promise(function(_0x290ecd,_0x5894a2){var _0x2a8360=[];for(var _0x248b32 in _0x81e11e[_0x172b('0x54')]){if(_0x81e11e[_0x172b('0x54')][_0x172b('0x4d')](_0x248b32)){var _0x39f049=_0x81e11e['openchannelQueues'][_0x248b32];var _0x575269={'id':_0x39f049['id'],'available':_0x39f049[_0x172b('0x4e')],'loggedIn':_0x39f049[_0x172b('0x51')],'name':_0x39f049[_0x172b('0x4f')],'paused':_0x39f049[_0x172b('0x52')],'waiting':_0x39f049[_0x172b('0x53')]};_0x2a8360[_0x172b('0x1f')](_0x575269);}}_0x290ecd({'count':_0x2a8360[_0x172b('0x18')],'rows':_0x2a8360});});},'SmsQueues':function(_0x54d6b3){return new Promise(function(_0x32e3ff,_0x324815){var _0x3faa9d=[];for(var _0x1d4615 in _0x81e11e[_0x172b('0x55')]){if(_0x81e11e['smsQueues'][_0x172b('0x4d')](_0x1d4615)){var _0x3fe646=_0x81e11e['smsQueues'][_0x1d4615];var _0x2a9012={'id':_0x3fe646['id'],'available':_0x3fe646[_0x172b('0x4e')],'loggedIn':_0x3fe646['loggedIn'],'name':_0x3fe646[_0x172b('0x4f')],'paused':_0x3fe646[_0x172b('0x52')],'waiting':_0x3fe646[_0x172b('0x53')]};_0x3faa9d[_0x172b('0x1f')](_0x2a9012);}}_0x32e3ff({'count':_0x3faa9d['length'],'rows':_0x3faa9d});});},'FaxQueues':function(_0x7c8047){return new Promise(function(_0x3c3a4d,_0x4a36d2){var _0x8217d5=[];for(var _0x4f0ca0 in _0x81e11e[_0x172b('0x56')]){if(_0x81e11e[_0x172b('0x56')]['hasOwnProperty'](_0x4f0ca0)){var _0xc173d9=_0x81e11e[_0x172b('0x56')][_0x4f0ca0];var _0xcb5849={'id':_0xc173d9['id'],'available':_0xc173d9[_0x172b('0x4e')],'loggedIn':_0xc173d9[_0x172b('0x51')],'name':_0xc173d9['name'],'paused':_0xc173d9[_0x172b('0x52')],'waiting':_0xc173d9[_0x172b('0x53')]};_0x8217d5['push'](_0xcb5849);}}_0x3c3a4d({'count':_0x8217d5['length'],'rows':_0x8217d5});});},'WhatsappQueues':function(_0x7ed93){return new Promise(function(_0x223998,_0x506d51){var _0x4744d4=[];for(var _0x2a2a1c in _0x81e11e[_0x172b('0x57')]){if(_0x81e11e[_0x172b('0x57')][_0x172b('0x4d')](_0x2a2a1c)){var _0x4ff34d=_0x81e11e['whatsappQueues'][_0x2a2a1c];var _0x5a84eb={'id':_0x4ff34d['id'],'available':_0x4ff34d['available'],'loggedIn':_0x4ff34d['loggedIn'],'name':_0x4ff34d[_0x172b('0x4f')],'paused':_0x4ff34d[_0x172b('0x52')],'waiting':_0x4ff34d['waiting']};_0x4744d4[_0x172b('0x1f')](_0x5a84eb);}}_0x223998({'count':_0x4744d4[_0x172b('0x18')],'rows':_0x4744d4});});},'ChatQueuesWaitingInteractions':function(_0x241d44){return new Promise(function(_0x7b7b41,_0x1d7de8){var _0x21e7cb=_['values'](_0x81e11e[_0x172b('0x58')]);_0x7b7b41({'count':_0x21e7cb[_0x172b('0x18')],'rows':_0x21e7cb});});},'MailQueuesWaitingInteractions':function(_0x29730f){return new Promise(function(_0x3ac677,_0x130be7){var _0x1a66a3=_['values'](_0x81e11e[_0x172b('0x59')]);_0x3ac677({'count':_0x1a66a3[_0x172b('0x18')],'rows':_0x1a66a3});});},'OpenchannelQueuesWaitingInteractions':function(_0x2bfb11){return new Promise(function(_0x3cca24,_0x48cd9e){var _0x3dfd3c=_['values'](_0x81e11e[_0x172b('0x5a')]);_0x3cca24({'count':_0x3dfd3c[_0x172b('0x18')],'rows':_0x3dfd3c});});},'SmsQueuesWaitingInteractions':function(_0x1dbf00){return new Promise(function(_0x3b9557,_0x654af7){var _0x257ae2=_[_0x172b('0x4b')](_0x81e11e[_0x172b('0x5b')]);_0x3b9557({'count':_0x257ae2[_0x172b('0x18')],'rows':_0x257ae2});});},'FaxQueuesWaitingInteractions':function(_0x49f3d4){return new Promise(function(_0x3cf482,_0x597555){var _0x14b45a=_[_0x172b('0x4b')](_0x81e11e[_0x172b('0x5c')]);_0x3cf482({'count':_0x14b45a[_0x172b('0x18')],'rows':_0x14b45a});});},'WhatsappQueuesWaitingInteractions':function(_0x1df3c1){return new Promise(function(_0x4b7577,_0x41e701){var _0x43c5ab=_['values'](_0x81e11e[_0x172b('0x5d')]);_0x4b7577({'count':_0x43c5ab[_0x172b('0x18')],'rows':_0x43c5ab});});}};var _0x2f7855=jayson['server'](_0x2790ed)[_0x172b('0x5e')]();_0x2f7855['on'](_0x172b('0x32'),function(_0x1d9449){logger[_0x172b('0x32')](JSON[_0x172b('0x5f')](_0x1d9449));return _0x3452f2(_0x1d9449);});_0x2f7855[_0x172b('0x13')](0x232c,_0x172b('0x60'),function(){console['log'](_0x172b('0x61'),0x232c);return _0x1b7247(_0x172b('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2ad7187..c6113a0 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 _0x9377=['format','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x9377,0xa0));var _0x7937=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9377[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x7937('0x0'));var BPromise=require(_0x7937('0x1'));var jayson=require(_0x7937('0x2'));var _=require('lodash');var logger=require(_0x7937('0x3'))(_0x7937('0x4'));var client=jayson[_0x7937('0x5')][_0x7937('0x6')]({'port':0x232a});function request(_0xf85e03,_0x1b705d){return new BPromise(function(_0x4e96ad,_0xb6fbbc){return client[_0x7937('0x7')](_0xf85e03,_0x1b705d)[_0x7937('0x8')](function(_0x10a1f5){if(_0x10a1f5[_0x7937('0x9')]){return _0xb6fbbc(_0x10a1f5['error']['message']);}else{return _0x4e96ad(_0x10a1f5[_0x7937('0xa')]);}})[_0x7937('0xb')](function(_0x2b804c){return _0xb6fbbc(_0x2b804c);});});}exports[_0x7937('0xc')]=function(_0x1fb62b,_0x290c9f,_0x312f98){return function(_0x47be7e){if(_0x312f98[_0x7937('0xd')]&&!_0x312f98[_0x7937('0xd')][_0x1fb62b]){logger[_0x7937('0xe')](_0x7937('0xf'),_0x1fb62b);return _0x47be7e[_0x7937('0x10')]();}var _0x238cd9=[];for(var _0x471af7=0x0;_0x471af7<_0x290c9f[_0x7937('0x11')];_0x471af7+=0x1){_0x238cd9[_0x7937('0x12')](request(_0x7937('0x13'),{'command':util[_0x7937('0x14')]('iftime\x20%s',_0x290c9f[_0x471af7])})[_0x7937('0x8')](function(_0x5537df){return _0x5537df&&_0x5537df['message']&&_0x5537df['message'][_0x7937('0x15')](_0x7937('0x16'))>=0x0?!![]:![];})[_0x7937('0xb')](function(_0x2ae9bd){logger[_0x7937('0x9')]('[%s][INTERVAL]\x20%s',_0x1fb62b,_0x290c9f[_0x471af7]);}));}BPromise[_0x7937('0x17')](_0x238cd9)[_0x7937('0x8')](function(_0x15be95){var _0x5366b5=_['some'](_0x15be95);logger[_0x7937('0xe')](_0x7937('0x18'),_0x1fb62b,_0x290c9f['join'](_0x7937('0x19')),_0x5366b5);_0x47be7e[_0x7937('0x1a')](_0x5366b5);})[_0x7937('0xb')](function(_0x25287d){console[_0x7937('0x1b')](_0x25287d);logger[_0x7937('0x9')](_0x7937('0x18'),_0x1fb62b,_0x290c9f[_0x7937('0x1c')](_0x7937('0x19')),_0x25287d[_0x7937('0x1d')]);_0x47be7e[_0x7937('0x10')]();});};}; \ No newline at end of file +var _0xfc7e=['request','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','then','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','log','\x20|\x20','stack','util','lodash','../../../config/logger','routing','http'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xfc7e,0x1bd));var _0xefc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc7e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xefc7('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xefc7('0x1'));var logger=require(_0xefc7('0x2'))(_0xefc7('0x3'));var client=jayson['client'][_0xefc7('0x4')]({'port':0x232a});function request(_0x53f466,_0x564d47){return new BPromise(function(_0x18c644,_0x482da7){return client[_0xefc7('0x5')](_0x53f466,_0x564d47)['then'](function(_0x1619c8){if(_0x1619c8[_0xefc7('0x6')]){return _0x482da7(_0x1619c8['error'][_0xefc7('0x7')]);}else{return _0x18c644(_0x1619c8['result']);}})[_0xefc7('0x8')](function(_0x177125){return _0x482da7(_0x177125);});});}exports[_0xefc7('0x9')]=function(_0x5491e3,_0x2bf482,_0x254944){return function(_0x320584){if(_0x254944[_0xefc7('0xa')]&&!_0x254944[_0xefc7('0xa')][_0x5491e3]){logger[_0xefc7('0xb')](_0xefc7('0xc'),_0x5491e3);return _0x320584[_0xefc7('0xd')]();}var _0x4b75bd=[];for(var _0x500999=0x0;_0x500999<_0x2bf482[_0xefc7('0xe')];_0x500999+=0x1){_0x4b75bd[_0xefc7('0xf')](request('Command',{'command':util[_0xefc7('0x10')]('iftime\x20%s',_0x2bf482[_0x500999])})[_0xefc7('0x11')](function(_0x40364e){return _0x40364e&&_0x40364e[_0xefc7('0x7')]&&_0x40364e[_0xefc7('0x7')][_0xefc7('0x12')](_0xefc7('0x13'))>=0x0?!![]:![];})[_0xefc7('0x8')](function(_0x1e429e){logger[_0xefc7('0x6')]('[%s][INTERVAL]\x20%s',_0x5491e3,_0x2bf482[_0x500999]);}));}BPromise[_0xefc7('0x14')](_0x4b75bd)['then'](function(_0x5ac8af){var _0x4cf921=_['some'](_0x5ac8af);logger[_0xefc7('0xb')](_0xefc7('0x15'),_0x5491e3,_0x2bf482['join']('\x20|\x20'),_0x4cf921);_0x320584['when'](_0x4cf921);})[_0xefc7('0x8')](function(_0x109038){console[_0xefc7('0x16')](_0x109038);logger[_0xefc7('0x6')](_0xefc7('0x15'),_0x5491e3,_0x2bf482['join'](_0xefc7('0x17')),_0x109038[_0xefc7('0x18')]);_0x320584[_0xefc7('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bb5ac53..6391be6 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 _0x5f84=['blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','agentcalledAt','hangup','cause','rejected','splice','agentcompleteAt','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','uniqueid','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x5f84,0x123));var _0x45f8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f84[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x45f8('0x0'));var util=require(_0x45f8('0x1'));var utils=require(_0x45f8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3dfd15,_0x53f0a9){utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x5'),_0x3dfd15['uniqueid'],_0x3dfd15[_0x45f8('0x6')],_0x3dfd15[_0x45f8('0x7')],_0x3dfd15[_0x45f8('0x8')],_0x3dfd15['interface'],_0x3dfd15['calleridnum'],_0x3dfd15[_0x45f8('0x9')],_0x3dfd15['lastevent']));if(_0x3dfd15[_0x45f8('0x7')]){utils[_0x45f8('0xa')](_0x3dfd15[_0x45f8('0x7')])['then'](function(_0x3beb70){if(_0x3beb70){_0x3dfd15[_0x45f8('0xb')]=_0x3beb70[_0x45f8('0xb')];_0x3dfd15[_0x45f8('0xc')]=_0x3dfd15[_0x45f8('0xd')]?_0x3beb70[_0x45f8('0xe')]:![];_0x3dfd15[_0x45f8('0xf')]=_0x3dfd15[_0x45f8('0xc')]?_0x3beb70['acwTimeout']:0x0;}utils[_0x45f8('0x10')](_0x45f8('0x11'),_0x3dfd15);});}else{utils['request']('CreateVoiceAgentReport',_0x3dfd15);}if(_0x53f0a9){delete transfers[_0x3dfd15['uniqueid']];}else{delete agents[_0x3dfd15[_0x45f8('0x12')]];}}exports[_0x45f8('0x13')]=function(_0x158186){try{utils['debug'](util[_0x45f8('0x4')]('[%s][agents][agentcalled]',_0x158186[_0x45f8('0x14')]),_0x158186);agents[_0x158186['destuniqueid']]=_0x158186;agents[_0x158186['destuniqueid']]['agentcalledAt']=utils[_0x45f8('0x15')]();agents[_0x158186[_0x45f8('0x12')]][_0x45f8('0x16')]='called';agents[_0x158186[_0x45f8('0x12')]]['connectedlinenum']=null;agents[_0x158186[_0x45f8('0x12')]][_0x45f8('0x17')]=null;utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x18'),_0x158186[_0x45f8('0x14')],agents[_0x158186[_0x45f8('0x12')]][_0x45f8('0x8')],_0x158186[_0x45f8('0x12')]));}catch(_0x172c56){utils[_0x45f8('0x19')](util[_0x45f8('0x4')](_0x45f8('0x1a'),_0x158186[_0x45f8('0x14')]),_0x172c56);}};exports[_0x45f8('0x1b')]=function(_0xd17057){try{if(!_[_0x45f8('0x1c')](agents[_0xd17057[_0x45f8('0x12')]])){utils['debug'](util[_0x45f8('0x4')](_0x45f8('0x1d'),_0xd17057[_0x45f8('0x14')]),_0xd17057);utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x1e'),_0xd17057[_0x45f8('0x14')],agents[_0xd17057[_0x45f8('0x12')]][_0x45f8('0x8')],_0xd17057[_0x45f8('0x12')]));agents[_0xd17057['destuniqueid']][_0x45f8('0x1b')]=!![];agents[_0xd17057[_0x45f8('0x12')]][_0x45f8('0x1f')]=utils[_0x45f8('0x15')]();agents[_0xd17057[_0x45f8('0x12')]]['lastevent']=_0x45f8('0x20');agents[_0xd17057[_0x45f8('0x12')]][_0x45f8('0x21')]='timeout';agents[_0xd17057['destuniqueid']][_0x45f8('0x22')]=_0xd17057[_0x45f8('0x23')]?parseInt(_0xd17057[_0x45f8('0x23')])/0x3e8:0x0;agents[_0xd17057[_0x45f8('0x12')]]['talktime']=0x0;unanswered[_0x45f8('0x24')](_0xd17057['destuniqueid']);}}catch(_0x589c16){utils[_0x45f8('0x19')](util[_0x45f8('0x4')](_0x45f8('0x1d'),_0xd17057[_0x45f8('0x14')]),_0x589c16);}};exports[_0x45f8('0x25')]=function(_0x46ef7f){try{_['forIn'](agents,function(_0x5aafcc,_0x3ff052){if(_0x5aafcc[_0x45f8('0x14')]==_0x46ef7f['uniqueid']&&!_[_0x45f8('0x26')](unanswered,_0x5aafcc[_0x45f8('0x12')])){utils[_0x45f8('0x27')](util[_0x45f8('0x4')](_0x45f8('0x28'),_0x46ef7f[_0x45f8('0x14')]),_0x46ef7f);utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x29'),_0x46ef7f['uniqueid'],_0x5aafcc['membername'],_0x5aafcc[_0x45f8('0x12')]));_0x5aafcc[_0x45f8('0x1b')]=!![];_0x5aafcc['agentringnoanswerAt']=utils[_0x45f8('0x15')]();_0x5aafcc[_0x45f8('0x16')]='abandoned';_0x5aafcc[_0x45f8('0x21')]=_0x45f8('0x2a');_0x5aafcc['holdtime']=_0x46ef7f[_0x45f8('0x22')];_0x5aafcc[_0x45f8('0x2b')]=0x0;writeDB(_0x5aafcc);}});}catch(_0x5a73c1){utils['error'](util['format']('[%s][agents][queuecallerabandon]',_0x46ef7f[_0x45f8('0x14')]),_0x5a73c1);}};exports['agentconnect']=function(_0x400ab4){try{if(agents[_0x400ab4['destuniqueid']]){utils[_0x45f8('0x27')](util[_0x45f8('0x4')](_0x45f8('0x2c'),_0x400ab4[_0x45f8('0x14')]),_0x400ab4);utils[_0x45f8('0x3')](util[_0x45f8('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x400ab4[_0x45f8('0x14')],agents[_0x400ab4[_0x45f8('0x12')]]['membername'],_0x400ab4[_0x45f8('0x12')]));agents[_0x400ab4[_0x45f8('0x12')]][_0x45f8('0x2d')]=utils[_0x45f8('0x15')]();agents[_0x400ab4[_0x45f8('0x12')]][_0x45f8('0x9')]=_0x400ab4[_0x45f8('0x9')];agents[_0x400ab4['destuniqueid']][_0x45f8('0x17')]=_0x400ab4[_0x45f8('0x17')];agents[_0x400ab4[_0x45f8('0x12')]][_0x45f8('0x22')]=_0x400ab4[_0x45f8('0x23')];agents[_0x400ab4[_0x45f8('0x12')]][_0x45f8('0x16')]=_0x45f8('0x2e');_['forIn'](agents,function(_0x563481,_0x2c45e7){if(_0x563481['destuniqueid']!=_0x400ab4[_0x45f8('0x12')]&&_0x563481[_0x45f8('0x14')]==_0x400ab4['uniqueid']){_0x563481[_0x45f8('0x2b')]=0x0;_0x563481[_0x45f8('0x22')]=_0x400ab4['ringtime'];_0x563481['agentringnoanswer']=!![];_0x563481['agentringnoanswerAt']=utils[_0x45f8('0x15')]();_0x563481[_0x45f8('0x16')]=_0x45f8('0x2f');_0x563481[_0x45f8('0x21')]='answered_elsewhere';_0x563481[_0x45f8('0x30')]=_0x400ab4[_0x45f8('0x12')];_0x563481[_0x45f8('0x31')]=_0x400ab4[_0x45f8('0x8')];writeDB(_0x563481);}});}}catch(_0x231f19){utils['error'](util[_0x45f8('0x4')]('[%s][agents][agentconnect]',_0x400ab4[_0x45f8('0x14')]),_0x231f19);}};exports[_0x45f8('0xd')]=function(_0x51e479){try{if(!_[_0x45f8('0x1c')](agents[_0x51e479['destuniqueid']])){utils[_0x45f8('0x27')](util[_0x45f8('0x4')](_0x45f8('0x32'),_0x51e479[_0x45f8('0x14')]),_0x51e479);utils['info'](util[_0x45f8('0x4')](_0x45f8('0x33'),_0x51e479['uniqueid'],agents[_0x51e479[_0x45f8('0x12')]]['membername'],_0x51e479[_0x45f8('0x12')]));agents[_0x51e479[_0x45f8('0x12')]]['agentcomplete']=!![];agents[_0x51e479[_0x45f8('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x51e479[_0x45f8('0x12')]]['talktime']=utils[_0x45f8('0x34')](agents[_0x51e479[_0x45f8('0x12')]]['agentcompleteAt'],agents[_0x51e479[_0x45f8('0x12')]][_0x45f8('0x2d')]);agents[_0x51e479['destuniqueid']][_0x45f8('0x21')]=_0x51e479[_0x45f8('0x21')];agents[_0x51e479[_0x45f8('0x12')]][_0x45f8('0x16')]='complete';writeDB(agents[_0x51e479[_0x45f8('0x12')]]);}}catch(_0x899e32){utils[_0x45f8('0x19')](util['format'](_0x45f8('0x32'),_0x51e479[_0x45f8('0x14')]),_0x899e32);}};exports[_0x45f8('0x35')]=function(_0xdb5996){try{if(!_[_0x45f8('0x1c')](agents[_0xdb5996['transfereruniqueid']])){utils[_0x45f8('0x27')](util[_0x45f8('0x4')]('[%s][agents][blindtransfer]',_0xdb5996[_0x45f8('0x14')]),_0xdb5996);utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x36'),_0xdb5996[_0x45f8('0x14')],agents[_0xdb5996['transfereruniqueid']][_0x45f8('0x8')],agents[_0xdb5996[_0x45f8('0x37')]][_0x45f8('0x14')]));agents[_0xdb5996[_0x45f8('0x37')]][_0x45f8('0x38')]=!![];agents[_0xdb5996[_0x45f8('0x37')]][_0x45f8('0x39')]=_0x45f8('0x3a');agents[_0xdb5996[_0x45f8('0x37')]]['transferexten']=_0xdb5996[_0x45f8('0x3b')];agents[_0xdb5996[_0x45f8('0x37')]][_0x45f8('0x3c')]=agents[_0xdb5996[_0x45f8('0x37')]]['uniqueid'];}}catch(_0x1c012b){utils[_0x45f8('0x19')](util[_0x45f8('0x4')](_0x45f8('0x3d'),_0xdb5996[_0x45f8('0x14')]),_0x1c012b);}};exports['attendedtransfer']=function(_0x593bea){try{utils[_0x45f8('0x27')](util[_0x45f8('0x4')](_0x45f8('0x3e'),_0x593bea[_0x45f8('0x3f')]),_0x593bea);if(_0x593bea[_0x45f8('0x3f')]==_0x593bea[_0x45f8('0x40')]){if(!_[_0x45f8('0x1c')](agents[_0x593bea[_0x45f8('0x41')]])){utils[_0x45f8('0x3')](util[_0x45f8('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x593bea['origtransfereruniqueid'],agents[_0x593bea['secondtransfereruniqueid']][_0x45f8('0x8')]));agents[_0x593bea[_0x45f8('0x41')]]['transfer']=!![];agents[_0x593bea['secondtransfereruniqueid']][_0x45f8('0x39')]=_0x45f8('0x42');agents[_0x593bea[_0x45f8('0x41')]][_0x45f8('0x43')]=_0x593bea[_0x45f8('0x44')];agents[_0x593bea['secondtransfereruniqueid']][_0x45f8('0x3c')]=_0x593bea[_0x45f8('0x3f')];}if(_0x593bea['transfereeuniqueid']&&agents[_0x593bea[_0x45f8('0x45')]]){agents[_0x593bea[_0x45f8('0x45')]][_0x45f8('0x46')]=0x1;transfers[_0x593bea[_0x45f8('0x45')]]=_[_0x45f8('0x47')](agents[_0x593bea['transfereeuniqueid']]);transfers[_0x593bea[_0x45f8('0x45')]][_0x45f8('0x48')]=agents[_0x593bea['secondtransfereruniqueid']]['calleridnum'];transfers[_0x593bea[_0x45f8('0x45')]]['calleridname']=agents[_0x593bea[_0x45f8('0x41')]][_0x45f8('0x49')];transfers[_0x593bea[_0x45f8('0x45')]]['agentcalledAt']=utils[_0x45f8('0x15')]();transfers[_0x593bea[_0x45f8('0x45')]][_0x45f8('0x2d')]=utils[_0x45f8('0x15')]();transfers[_0x593bea[_0x45f8('0x45')]][_0x45f8('0x22')]=0x0;transfers[_0x593bea[_0x45f8('0x45')]][_0x45f8('0x46')]=0x2;}}else if(_0x593bea['secondtransfereruniqueid']==_0x593bea['secondtransfererlinkedid']){if(!_[_0x45f8('0x1c')](agents[_0x593bea[_0x45f8('0x3f')]])){utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x4a'),_0x593bea['origtransfereruniqueid'],agents[_0x593bea[_0x45f8('0x3f')]]['membername']));agents[_0x593bea[_0x45f8('0x3f')]][_0x45f8('0x38')]=!![];agents[_0x593bea['origtransfereruniqueid']][_0x45f8('0x39')]=_0x45f8('0x42');agents[_0x593bea[_0x45f8('0x3f')]][_0x45f8('0x43')]=_0x593bea[_0x45f8('0x4b')];agents[_0x593bea['origtransfereruniqueid']][_0x45f8('0x3c')]=_0x593bea[_0x45f8('0x41')];}if(_0x593bea['transfertargetuniqueid']&&agents[_0x593bea[_0x45f8('0x4c')]]){agents[_0x593bea[_0x45f8('0x4c')]][_0x45f8('0x46')]=0x1;transfers[_0x593bea['transfertargetuniqueid']]=_['clone'](agents[_0x593bea[_0x45f8('0x4c')]]);transfers[_0x593bea['transfertargetuniqueid']]['calleridnum']=agents[_0x593bea[_0x45f8('0x3f')]][_0x45f8('0x48')];transfers[_0x593bea[_0x45f8('0x4c')]]['calleridname']=agents[_0x593bea[_0x45f8('0x3f')]]['calleridname'];transfers[_0x593bea[_0x45f8('0x4c')]][_0x45f8('0x4d')]=utils[_0x45f8('0x15')]();transfers[_0x593bea[_0x45f8('0x4c')]][_0x45f8('0x2d')]=utils[_0x45f8('0x15')]();transfers[_0x593bea['transfertargetuniqueid']][_0x45f8('0x22')]=0x0;transfers[_0x593bea['transfertargetuniqueid']][_0x45f8('0x46')]=0x2;}}}catch(_0x1f65f1){utils[_0x45f8('0x19')](util[_0x45f8('0x4')](_0x45f8('0x3e'),_0x593bea['origtransfereruniqueid']),_0x1f65f1);}};exports[_0x45f8('0x4e')]=function(_0x313f0a){try{utils[_0x45f8('0x27')](util[_0x45f8('0x4')]('[%s][agents][hangup]',_0x313f0a[_0x45f8('0x14')]),_0x313f0a);if(agents[_0x313f0a[_0x45f8('0x14')]]&&agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x21')]==='timeout'){if(_0x313f0a[_0x45f8('0x4f')]==='21'){agents[_0x313f0a['uniqueid']][_0x45f8('0x21')]=_0x45f8('0x50');agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x16')]=_0x45f8('0x50');}utils[_0x45f8('0x3')](util[_0x45f8('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x313f0a[_0x45f8('0x14')],agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x8')],agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x21')],agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x16')]));writeDB(agents[_0x313f0a[_0x45f8('0x14')]]);var _0x238495=unanswered['indexOf'](_0x313f0a[_0x45f8('0x14')]);if(_0x238495>-0x1){unanswered[_0x45f8('0x51')](_0x238495,0x1);}}if(transfers[_0x313f0a['uniqueid']]){transfers[_0x313f0a['uniqueid']]['agentcomplete']=!![];transfers[_0x313f0a['uniqueid']][_0x45f8('0x52')]=utils[_0x45f8('0x15')]();transfers[_0x313f0a[_0x45f8('0x14')]]['talktime']=utils[_0x45f8('0x34')](transfers[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x52')],transfers[_0x313f0a['uniqueid']][_0x45f8('0x2d')]);transfers[_0x313f0a[_0x45f8('0x14')]]['reason']=_0x45f8('0x53');transfers[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x16')]=_0x45f8('0x54');utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x55'),_0x313f0a[_0x45f8('0x14')],transfers[_0x313f0a['uniqueid']][_0x45f8('0x8')],transfers[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x21')],transfers[_0x313f0a['uniqueid']][_0x45f8('0x16')]));writeDB(transfers[_0x313f0a[_0x45f8('0x14')]],!![]);}if(agents[_0x313f0a[_0x45f8('0x14')]]&&agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x2d')]){agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0xd')]=!![];agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x52')]=utils['now']();agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x2b')]=utils[_0x45f8('0x34')](agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x52')],agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x2d')]);agents[_0x313f0a[_0x45f8('0x14')]]['reason']=agents[_0x313f0a['uniqueid']][_0x45f8('0x38')]?_0x45f8('0x38'):_0x45f8('0x53');agents[_0x313f0a['uniqueid']][_0x45f8('0x16')]=_0x45f8('0x54');utils[_0x45f8('0x3')](util[_0x45f8('0x4')](_0x45f8('0x55'),_0x313f0a['uniqueid'],agents[_0x313f0a[_0x45f8('0x14')]][_0x45f8('0x8')],agents[_0x313f0a['uniqueid']][_0x45f8('0x21')],agents[_0x313f0a['uniqueid']]['lastevent']));writeDB(agents[_0x313f0a['uniqueid']]);}}catch(_0x81afcd){utils['error'](util[_0x45f8('0x4')]('[%s][agents][hangup]',_0x313f0a[_0x45f8('0x14')]),_0x81afcd);}}; \ No newline at end of file +var _0x894b=['answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','secondtransfererexten','transferuniqueid','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','splice','agentconnectAt','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere'];(function(_0x4accc8,_0x12a110){var _0x16e791=function(_0x5b8c00){while(--_0x5b8c00){_0x4accc8['push'](_0x4accc8['shift']());}};_0x16e791(++_0x12a110);}(_0x894b,0x1e3));var _0xb894=function(_0x1dcda0,_0x1da2c6){_0x1dcda0=_0x1dcda0-0x0;var _0x49ba52=_0x894b[_0x1dcda0];return _0x49ba52;};'use strict';var _=require(_0xb894('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xbdbd0b,_0x43af22){utils['info'](util[_0xb894('0x1')](_0xb894('0x2'),_0xbdbd0b[_0xb894('0x3')],_0xbdbd0b[_0xb894('0x4')],_0xbdbd0b['queue'],_0xbdbd0b['membername'],_0xbdbd0b[_0xb894('0x5')],_0xbdbd0b[_0xb894('0x6')],_0xbdbd0b[_0xb894('0x7')],_0xbdbd0b[_0xb894('0x8')]));if(_0xbdbd0b[_0xb894('0x9')]){utils[_0xb894('0xa')](_0xbdbd0b[_0xb894('0x9')])[_0xb894('0xb')](function(_0x40be44){if(_0x40be44){_0xbdbd0b[_0xb894('0xc')]=_0x40be44[_0xb894('0xc')];_0xbdbd0b[_0xb894('0xd')]=_0xbdbd0b['agentcomplete']?_0x40be44[_0xb894('0xe')]:![];_0xbdbd0b[_0xb894('0xf')]=_0xbdbd0b[_0xb894('0xd')]?_0x40be44[_0xb894('0x10')]:0x0;}utils[_0xb894('0x11')]('CreateVoiceAgentReport',_0xbdbd0b);});}else{utils[_0xb894('0x11')](_0xb894('0x12'),_0xbdbd0b);}if(_0x43af22){delete transfers[_0xbdbd0b[_0xb894('0x3')]];}else{delete agents[_0xbdbd0b[_0xb894('0x13')]];}}exports[_0xb894('0x14')]=function(_0x47b12f){try{utils['debug'](util[_0xb894('0x1')](_0xb894('0x15'),_0x47b12f[_0xb894('0x3')]),_0x47b12f);agents[_0x47b12f[_0xb894('0x13')]]=_0x47b12f;agents[_0x47b12f[_0xb894('0x13')]]['agentcalledAt']=utils[_0xb894('0x16')]();agents[_0x47b12f[_0xb894('0x13')]][_0xb894('0x8')]='called';agents[_0x47b12f[_0xb894('0x13')]][_0xb894('0x7')]=null;agents[_0x47b12f[_0xb894('0x13')]][_0xb894('0x17')]=null;utils[_0xb894('0x18')](util['format'](_0xb894('0x19'),_0x47b12f[_0xb894('0x3')],agents[_0x47b12f[_0xb894('0x13')]][_0xb894('0x1a')],_0x47b12f[_0xb894('0x13')]));}catch(_0x41164d){utils[_0xb894('0x1b')](util[_0xb894('0x1')](_0xb894('0x15'),_0x47b12f[_0xb894('0x3')]),_0x41164d);}};exports[_0xb894('0x1c')]=function(_0x3866e5){try{if(!_[_0xb894('0x1d')](agents[_0x3866e5[_0xb894('0x13')]])){utils['debug'](util[_0xb894('0x1')](_0xb894('0x1e'),_0x3866e5[_0xb894('0x3')]),_0x3866e5);utils[_0xb894('0x18')](util[_0xb894('0x1')](_0xb894('0x1f'),_0x3866e5[_0xb894('0x3')],agents[_0x3866e5['destuniqueid']]['membername'],_0x3866e5[_0xb894('0x13')]));agents[_0x3866e5[_0xb894('0x13')]][_0xb894('0x1c')]=!![];agents[_0x3866e5['destuniqueid']][_0xb894('0x20')]=utils[_0xb894('0x16')]();agents[_0x3866e5[_0xb894('0x13')]]['lastevent']=_0xb894('0x21');agents[_0x3866e5[_0xb894('0x13')]]['reason']=_0xb894('0x21');agents[_0x3866e5['destuniqueid']]['holdtime']=_0x3866e5['ringtime']?parseInt(_0x3866e5[_0xb894('0x22')])/0x3e8:0x0;agents[_0x3866e5[_0xb894('0x13')]][_0xb894('0x23')]=0x0;unanswered[_0xb894('0x24')](_0x3866e5[_0xb894('0x13')]);}}catch(_0x7718e8){utils[_0xb894('0x1b')](util[_0xb894('0x1')](_0xb894('0x1e'),_0x3866e5['uniqueid']),_0x7718e8);}};exports[_0xb894('0x25')]=function(_0x471abd){try{_[_0xb894('0x26')](agents,function(_0x5a059d,_0x39127e){if(_0x5a059d[_0xb894('0x3')]==_0x471abd[_0xb894('0x3')]&&!_[_0xb894('0x27')](unanswered,_0x5a059d[_0xb894('0x13')])){utils[_0xb894('0x28')](util[_0xb894('0x1')](_0xb894('0x29'),_0x471abd[_0xb894('0x3')]),_0x471abd);utils[_0xb894('0x18')](util['format'](_0xb894('0x2a'),_0x471abd[_0xb894('0x3')],_0x5a059d['membername'],_0x5a059d[_0xb894('0x13')]));_0x5a059d[_0xb894('0x1c')]=!![];_0x5a059d['agentringnoanswerAt']=utils[_0xb894('0x16')]();_0x5a059d[_0xb894('0x8')]=_0xb894('0x2b');_0x5a059d[_0xb894('0x2c')]='abandoned';_0x5a059d[_0xb894('0x2d')]=_0x471abd[_0xb894('0x2d')];_0x5a059d['talktime']=0x0;writeDB(_0x5a059d);}});}catch(_0x3a7f4a){utils['error'](util[_0xb894('0x1')](_0xb894('0x29'),_0x471abd['uniqueid']),_0x3a7f4a);}};exports[_0xb894('0x2e')]=function(_0x218b62){try{if(agents[_0x218b62[_0xb894('0x13')]]){utils[_0xb894('0x28')](util[_0xb894('0x1')](_0xb894('0x2f'),_0x218b62[_0xb894('0x3')]),_0x218b62);utils[_0xb894('0x18')](util[_0xb894('0x1')](_0xb894('0x30'),_0x218b62[_0xb894('0x3')],agents[_0x218b62['destuniqueid']]['membername'],_0x218b62[_0xb894('0x13')]));agents[_0x218b62[_0xb894('0x13')]]['agentconnectAt']=utils[_0xb894('0x16')]();agents[_0x218b62[_0xb894('0x13')]]['connectedlinenum']=_0x218b62[_0xb894('0x7')];agents[_0x218b62[_0xb894('0x13')]][_0xb894('0x17')]=_0x218b62[_0xb894('0x17')];agents[_0x218b62[_0xb894('0x13')]]['holdtime']=_0x218b62[_0xb894('0x22')];agents[_0x218b62[_0xb894('0x13')]]['lastevent']=_0xb894('0x31');_[_0xb894('0x26')](agents,function(_0x6f5c3a,_0x50d3c8){if(_0x6f5c3a[_0xb894('0x13')]!=_0x218b62[_0xb894('0x13')]&&_0x6f5c3a['uniqueid']==_0x218b62[_0xb894('0x3')]){_0x6f5c3a[_0xb894('0x23')]=0x0;_0x6f5c3a[_0xb894('0x2d')]=_0x218b62[_0xb894('0x22')];_0x6f5c3a[_0xb894('0x1c')]=!![];_0x6f5c3a[_0xb894('0x20')]=utils[_0xb894('0x16')]();_0x6f5c3a['lastevent']=_0xb894('0x32');_0x6f5c3a[_0xb894('0x2c')]='answered_elsewhere';_0x6f5c3a['answeredelsewheredestinationuniqueid']=_0x218b62[_0xb894('0x13')];_0x6f5c3a[_0xb894('0x33')]=_0x218b62[_0xb894('0x1a')];writeDB(_0x6f5c3a);}});}}catch(_0x518512){utils['error'](util[_0xb894('0x1')](_0xb894('0x2f'),_0x218b62['uniqueid']),_0x518512);}};exports[_0xb894('0x34')]=function(_0x574104){try{if(!_[_0xb894('0x1d')](agents[_0x574104[_0xb894('0x13')]])){utils[_0xb894('0x28')](util['format'](_0xb894('0x35'),_0x574104[_0xb894('0x3')]),_0x574104);utils[_0xb894('0x18')](util[_0xb894('0x1')](_0xb894('0x36'),_0x574104['uniqueid'],agents[_0x574104[_0xb894('0x13')]][_0xb894('0x1a')],_0x574104[_0xb894('0x13')]));agents[_0x574104[_0xb894('0x13')]][_0xb894('0x34')]=!![];agents[_0x574104[_0xb894('0x13')]][_0xb894('0x37')]=utils[_0xb894('0x16')]();agents[_0x574104[_0xb894('0x13')]][_0xb894('0x23')]=utils[_0xb894('0x38')](agents[_0x574104[_0xb894('0x13')]][_0xb894('0x37')],agents[_0x574104[_0xb894('0x13')]]['agentconnectAt']);agents[_0x574104[_0xb894('0x13')]]['reason']=_0x574104[_0xb894('0x2c')];agents[_0x574104[_0xb894('0x13')]][_0xb894('0x8')]=_0xb894('0x39');writeDB(agents[_0x574104[_0xb894('0x13')]]);}}catch(_0x1e6fe2){utils[_0xb894('0x1b')](util['format']('[%s][agents][agentcomplete]',_0x574104[_0xb894('0x3')]),_0x1e6fe2);}};exports['blindtransfer']=function(_0x3f8c7b){try{if(!_['isNil'](agents[_0x3f8c7b[_0xb894('0x3a')]])){utils[_0xb894('0x28')](util[_0xb894('0x1')](_0xb894('0x3b'),_0x3f8c7b[_0xb894('0x3')]),_0x3f8c7b);utils[_0xb894('0x18')](util[_0xb894('0x1')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3f8c7b[_0xb894('0x3')],agents[_0x3f8c7b[_0xb894('0x3a')]][_0xb894('0x1a')],agents[_0x3f8c7b['transfereruniqueid']][_0xb894('0x3')]));agents[_0x3f8c7b['transfereruniqueid']][_0xb894('0x3c')]=!![];agents[_0x3f8c7b[_0xb894('0x3a')]][_0xb894('0x3d')]=_0xb894('0x3e');agents[_0x3f8c7b['transfereruniqueid']][_0xb894('0x3f')]=_0x3f8c7b[_0xb894('0x40')];agents[_0x3f8c7b['transfereruniqueid']]['transferuniqueid']=agents[_0x3f8c7b['transfereruniqueid']][_0xb894('0x3')];}}catch(_0x10b57d){utils[_0xb894('0x1b')](util['format'](_0xb894('0x3b'),_0x3f8c7b[_0xb894('0x3')]),_0x10b57d);}};exports[_0xb894('0x41')]=function(_0x5e1167){try{utils[_0xb894('0x28')](util['format']('[%s][agents][attendedtransfer]',_0x5e1167[_0xb894('0x42')]),_0x5e1167);if(_0x5e1167['origtransfereruniqueid']==_0x5e1167[_0xb894('0x43')]){if(!_['isNil'](agents[_0x5e1167[_0xb894('0x44')]])){utils['info'](util[_0xb894('0x1')](_0xb894('0x45'),_0x5e1167[_0xb894('0x42')],agents[_0x5e1167[_0xb894('0x44')]][_0xb894('0x1a')]));agents[_0x5e1167[_0xb894('0x44')]][_0xb894('0x3c')]=!![];agents[_0x5e1167[_0xb894('0x44')]][_0xb894('0x3d')]=_0xb894('0x46');agents[_0x5e1167['secondtransfereruniqueid']][_0xb894('0x3f')]=_0x5e1167[_0xb894('0x47')];agents[_0x5e1167[_0xb894('0x44')]]['transferuniqueid']=_0x5e1167['origtransfereruniqueid'];}if(_0x5e1167[_0xb894('0x48')]&&agents[_0x5e1167['transfereeuniqueid']]){agents[_0x5e1167[_0xb894('0x48')]][_0xb894('0x49')]=0x1;transfers[_0x5e1167[_0xb894('0x48')]]=_[_0xb894('0x4a')](agents[_0x5e1167[_0xb894('0x48')]]);transfers[_0x5e1167[_0xb894('0x48')]][_0xb894('0x6')]=agents[_0x5e1167[_0xb894('0x44')]][_0xb894('0x6')];transfers[_0x5e1167[_0xb894('0x48')]][_0xb894('0x4b')]=agents[_0x5e1167[_0xb894('0x44')]][_0xb894('0x4b')];transfers[_0x5e1167[_0xb894('0x48')]][_0xb894('0x4c')]=utils[_0xb894('0x16')]();transfers[_0x5e1167['transfereeuniqueid']]['agentconnectAt']=utils[_0xb894('0x16')]();transfers[_0x5e1167[_0xb894('0x48')]][_0xb894('0x2d')]=0x0;transfers[_0x5e1167[_0xb894('0x48')]][_0xb894('0x49')]=0x2;}}else if(_0x5e1167[_0xb894('0x44')]==_0x5e1167[_0xb894('0x4d')]){if(!_[_0xb894('0x1d')](agents[_0x5e1167[_0xb894('0x42')]])){utils[_0xb894('0x18')](util['format'](_0xb894('0x45'),_0x5e1167[_0xb894('0x42')],agents[_0x5e1167[_0xb894('0x42')]][_0xb894('0x1a')]));agents[_0x5e1167['origtransfereruniqueid']][_0xb894('0x3c')]=!![];agents[_0x5e1167[_0xb894('0x42')]][_0xb894('0x3d')]='ATTENDED';agents[_0x5e1167[_0xb894('0x42')]][_0xb894('0x3f')]=_0x5e1167[_0xb894('0x4e')];agents[_0x5e1167['origtransfereruniqueid']][_0xb894('0x4f')]=_0x5e1167[_0xb894('0x44')];}if(_0x5e1167[_0xb894('0x50')]&&agents[_0x5e1167[_0xb894('0x50')]]){agents[_0x5e1167[_0xb894('0x50')]]['agententerreason']=0x1;transfers[_0x5e1167[_0xb894('0x50')]]=_[_0xb894('0x4a')](agents[_0x5e1167['transfertargetuniqueid']]);transfers[_0x5e1167[_0xb894('0x50')]]['calleridnum']=agents[_0x5e1167[_0xb894('0x42')]][_0xb894('0x6')];transfers[_0x5e1167['transfertargetuniqueid']][_0xb894('0x4b')]=agents[_0x5e1167['origtransfereruniqueid']][_0xb894('0x4b')];transfers[_0x5e1167[_0xb894('0x50')]][_0xb894('0x4c')]=utils[_0xb894('0x16')]();transfers[_0x5e1167[_0xb894('0x50')]]['agentconnectAt']=utils[_0xb894('0x16')]();transfers[_0x5e1167[_0xb894('0x50')]][_0xb894('0x2d')]=0x0;transfers[_0x5e1167[_0xb894('0x50')]][_0xb894('0x49')]=0x2;}}}catch(_0x5f09ca){utils[_0xb894('0x1b')](util[_0xb894('0x1')](_0xb894('0x51'),_0x5e1167[_0xb894('0x42')]),_0x5f09ca);}};exports['hangup']=function(_0x21f004){try{utils[_0xb894('0x28')](util[_0xb894('0x1')](_0xb894('0x52'),_0x21f004[_0xb894('0x3')]),_0x21f004);if(agents[_0x21f004['uniqueid']]&&agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')]===_0xb894('0x21')){if(_0x21f004[_0xb894('0x53')]==='21'){agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')]=_0xb894('0x54');agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x8')]='rejected';}utils[_0xb894('0x18')](util[_0xb894('0x1')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x21f004[_0xb894('0x3')],agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x1a')],agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')],agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x8')]));writeDB(agents[_0x21f004[_0xb894('0x3')]]);var _0x2bea9e=unanswered['indexOf'](_0x21f004[_0xb894('0x3')]);if(_0x2bea9e>-0x1){unanswered[_0xb894('0x55')](_0x2bea9e,0x1);}}if(transfers[_0x21f004['uniqueid']]){transfers[_0x21f004['uniqueid']][_0xb894('0x34')]=!![];transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x37')]=utils[_0xb894('0x16')]();transfers[_0x21f004[_0xb894('0x3')]]['talktime']=utils[_0xb894('0x38')](transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x37')],transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x56')]);transfers[_0x21f004[_0xb894('0x3')]]['reason']='agent';transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x8')]=_0xb894('0x39');utils[_0xb894('0x18')](util[_0xb894('0x1')](_0xb894('0x57'),_0x21f004[_0xb894('0x3')],transfers[_0x21f004['uniqueid']][_0xb894('0x1a')],transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')],transfers[_0x21f004[_0xb894('0x3')]][_0xb894('0x8')]));writeDB(transfers[_0x21f004['uniqueid']],!![]);}if(agents[_0x21f004['uniqueid']]&&agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x56')]){agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x34')]=!![];agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x37')]=utils['now']();agents[_0x21f004['uniqueid']][_0xb894('0x23')]=utils['diffTime'](agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x37')],agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x56')]);agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')]=agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x3c')]?_0xb894('0x3c'):_0xb894('0x58');agents[_0x21f004['uniqueid']]['lastevent']=_0xb894('0x39');utils[_0xb894('0x18')](util['format'](_0xb894('0x57'),_0x21f004['uniqueid'],agents[_0x21f004[_0xb894('0x3')]]['membername'],agents[_0x21f004[_0xb894('0x3')]][_0xb894('0x2c')],agents[_0x21f004['uniqueid']]['lastevent']));writeDB(agents[_0x21f004['uniqueid']]);}}catch(_0x2b824e){utils[_0xb894('0x1b')](util['format']('[%s][agents][hangup]',_0x21f004[_0xb894('0x3')]),_0x2b824e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6821d25..85a4397 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 _0x540c=['billableseconds','answertime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','noop','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','uniqueid','channel','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','now','DOCUMENTATION','error','format','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime'];(function(_0x1bc10c,_0x4b5d84){var _0x502203=function(_0x5e41d7){while(--_0x5e41d7){_0x1bc10c['push'](_0x1bc10c['shift']());}};_0x502203(++_0x4b5d84);}(_0x540c,0xa5));var _0xc540=function(_0x2ad2fb,_0x40c4b4){_0x2ad2fb=_0x2ad2fb-0x0;var _0x72987e=_0x540c[_0x2ad2fb];return _0x72987e;};'use strict';var _=require(_0xc540('0x0'));var util=require(_0xc540('0x1'));var utils=require(_0xc540('0x2'));var dispositions=[_0xc540('0x3'),_0xc540('0x4'),_0xc540('0x4'),'NO\x20ANSWER',_0xc540('0x3'),_0xc540('0x3'),_0xc540('0x5'),'BUSY',_0xc540('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x2c2818){utils[_0xc540('0x6')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2c2818[_0xc540('0x7')],_0x2c2818[_0xc540('0x8')],_0x2c2818['queue'],_0x2c2818[_0xc540('0x9')],_0x2c2818[_0xc540('0xa')],_0x2c2818['calleridnum'],_0x2c2818[_0xc540('0xb')],_0x2c2818['lastevent']));if(_0x2c2818[_0xc540('0xc')]){utils[_0xc540('0xd')](_0x2c2818['accountcode'])[_0xc540('0xe')](function(_0x32d4af){if(_0x32d4af){_0x2c2818[_0xc540('0xf')]=_0x32d4af['id'];}utils[_0xc540('0x10')]('CreateVoiceCallReport',_0x2c2818);});}else{utils['request'](_0xc540('0x11'),_0x2c2818);}if(channels[_0x2c2818[_0xc540('0x7')]]){delete channels[_0x2c2818[_0xc540('0x7')]];}}exports['newchannel']=function(_0x5c8d32){try{utils[_0xc540('0x12')](util['format'](_0xc540('0x13'),_0x5c8d32['uniqueid']),_0x5c8d32);if(_0x5c8d32[_0xc540('0x7')]==_0x5c8d32[_0xc540('0x14')]&&_0x5c8d32[_0xc540('0x8')]!=_0xc540('0x15')){utils['info'](util['format'](_0xc540('0x16'),_0x5c8d32[_0xc540('0x7')],_0x5c8d32[_0xc540('0x17')],_0x5c8d32['exten']));channels[_0x5c8d32['uniqueid']]={'uniqueid':_0x5c8d32[_0xc540('0x7')],'accountcode':_0x5c8d32[_0xc540('0xc')],'source':_0x5c8d32[_0xc540('0x18')],'destination':_0x5c8d32[_0xc540('0x19')],'destinationcontext':_0x5c8d32[_0xc540('0x17')],'channel':_0x5c8d32[_0xc540('0x8')],'starttime':utils[_0xc540('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc540('0x3'),'amaflags':_0xc540('0x1b')};}}catch(_0x34dd19){utils[_0xc540('0x1c')](util[_0xc540('0x1d')](_0xc540('0x13'),_0x5c8d32[_0xc540('0x7')]),_0x34dd19);}};exports[_0xc540('0x1e')]=function(_0x178b8c){try{utils['debug'](util[_0xc540('0x1d')](_0xc540('0x1f'),_0x178b8c[_0xc540('0x7')]),_0x178b8c);if(!_[_0xc540('0x20')](channels[_0x178b8c[_0xc540('0x7')]])&&_0x178b8c['channelstate']==0x6){utils['info'](util['format'](_0xc540('0x21'),_0x178b8c['uniqueid'],_0x178b8c[_0xc540('0x17')],_0x178b8c[_0xc540('0x8')]));if(_[_0xc540('0x20')](channels[_0x178b8c[_0xc540('0x7')]]['systemanswertime'])){channels[_0x178b8c[_0xc540('0x7')]][_0xc540('0x22')]=utils[_0xc540('0x1a')]();}}else if(!_[_0xc540('0x20')](channels[_0x178b8c[_0xc540('0x14')]])&&_0x178b8c[_0xc540('0x23')]==0x6&&_0x178b8c['context']!=_0xc540('0x24')){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x25'),_0x178b8c['uniqueid'],_0x178b8c['linkedid'],_0x178b8c[_0xc540('0x17')],_0x178b8c[_0xc540('0x8')]));channels[_0x178b8c[_0xc540('0x14')]]['accountcode']=_0x178b8c[_0xc540('0xc')];channels[_0x178b8c[_0xc540('0x14')]][_0xc540('0x26')]=_0x178b8c[_0xc540('0x8')];if(_[_0xc540('0x20')](channels[_0x178b8c[_0xc540('0x14')]]['answertime'])){channels[_0x178b8c[_0xc540('0x14')]]['answertime']=utils[_0xc540('0x1a')]();}channels[_0x178b8c[_0xc540('0x14')]]['disposition']=dispositions[_[_0xc540('0x27')](_0x178b8c[_0xc540('0x23')])]||_0xc540('0x5');}}catch(_0x2a6f13){utils['error'](util['format'](_0xc540('0x1f'),_0x178b8c[_0xc540('0x7')]),_0x2a6f13);}};exports[_0xc540('0x28')]=function(_0x345181){try{if(!_['isNil'](channels[_0x345181['uniqueid']])){utils[_0xc540('0x12')](util[_0xc540('0x1d')](_0xc540('0x29'),_0x345181['uniqueid']),_0x345181);if(_[_0xc540('0x20')](channels[_0x345181[_0xc540('0x7')]][_0xc540('0x2a')])){channels[_0x345181[_0xc540('0x7')]]['callerid']=_0x345181[_0xc540('0x2b')]+'\x20<'+_0x345181['calleridnum']+'>';}utils[_0xc540('0x6')](util['format'](_0xc540('0x2c'),_0x345181[_0xc540('0x7')],channels[_0x345181[_0xc540('0x7')]][_0xc540('0x2a')],_0x345181[_0xc540('0x2d')]));channels[_0x345181[_0xc540('0x7')]][_0xc540('0x2e')]=utils['now']();channels[_0x345181['uniqueid']]['duration']=utils[_0xc540('0x2f')](channels[_0x345181['uniqueid']][_0xc540('0x2e')],channels[_0x345181[_0xc540('0x7')]][_0xc540('0x30')]);channels[_0x345181[_0xc540('0x7')]][_0xc540('0x31')]=channels[_0x345181[_0xc540('0x7')]]['answertime']?utils[_0xc540('0x2f')](channels[_0x345181[_0xc540('0x7')]]['endtime'],channels[_0x345181[_0xc540('0x7')]][_0xc540('0x32')]):0x0;writeDB(channels[_0x345181[_0xc540('0x7')]]);}}catch(_0x17a34c){utils['error'](util['format'](_0xc540('0x29'),_0x345181['uniqueid']),_0x17a34c);}};exports[_0xc540('0x33')]=function(_0x3f7309){try{if(!_[_0xc540('0x20')](channels[_0x3f7309[_0xc540('0x34')]])){utils['debug'](util[_0xc540('0x1d')]('[%s][calls][attendedtransfer]',_0x3f7309[_0xc540('0x35')]),_0x3f7309);if(channels[_0x3f7309[_0xc540('0x34')]]['channel']==_0x3f7309['transfereechannel']){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x36'),_0x3f7309[_0xc540('0x35')],_0x3f7309[_0xc540('0x34')],_0x3f7309['secondtransfererchannel']));channels[_0x3f7309[_0xc540('0x34')]][_0xc540('0x26')]=_0x3f7309['secondtransfererchannel'];channels[_0x3f7309[_0xc540('0x34')]]['userfield']=_0xc540('0x37');}else if(channels[_0x3f7309[_0xc540('0x34')]]['channel']=_0x3f7309[_0xc540('0x38')]){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x36'),_0x3f7309[_0xc540('0x35')],_0x3f7309['localtwolinkedid'],_0x3f7309[_0xc540('0x39')]));channels[_0x3f7309[_0xc540('0x34')]]['destinationchannel']=_0x3f7309['origtransfererchannel'];channels[_0x3f7309[_0xc540('0x34')]][_0xc540('0x3a')]=_0xc540('0x37');}}}catch(_0x3f8c4b){utils[_0xc540('0x1c')](util[_0xc540('0x1d')](_0xc540('0x3b'),_0x3f7309[_0xc540('0x35')]),_0x3f8c4b);}};exports['musiconholdstart']=function(_0x357799){try{if(!_[_0xc540('0x20')](channels[_0x357799[_0xc540('0x7')]])){utils[_0xc540('0x12')](util['format'](_0xc540('0x3c'),_0x357799[_0xc540('0x7')]),_0x357799);channels[_0x357799[_0xc540('0x7')]][_0xc540('0x3d')]=utils[_0xc540('0x1a')]();utils[_0xc540('0x6')](util['format'](_0xc540('0x3e'),_0x357799[_0xc540('0x7')],channels[_0x357799['uniqueid']]['musiconholdstartAt']));}}catch(_0x56eee0){utils['error'](util[_0xc540('0x1d')]('[%s][calls][musiconholdstart]',_0x357799[_0xc540('0x7')]),_0x56eee0);}};exports[_0xc540('0x3f')]=function(_0x27aeac){try{if(!_[_0xc540('0x20')](channels[_0x27aeac[_0xc540('0x7')]])){utils['debug'](util[_0xc540('0x1d')]('[%s][calls][musiconholdstop]',_0x27aeac['uniqueid']),_0x27aeac);if(!_[_0xc540('0x20')](channels[_0x27aeac[_0xc540('0x7')]][_0xc540('0x3d')])){channels[_0x27aeac[_0xc540('0x7')]][_0xc540('0x40')]+=utils['diffTime'](utils[_0xc540('0x1a')](),channels[_0x27aeac[_0xc540('0x7')]][_0xc540('0x3d')]);utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x41'),_0x27aeac[_0xc540('0x7')],channels[_0x27aeac['uniqueid']][_0xc540('0x40')]));delete channels[_0x27aeac['uniqueid']][_0xc540('0x3d')];}}}catch(_0x5e0b53){utils[_0xc540('0x1c')](util[_0xc540('0x1d')](_0xc540('0x42'),_0x27aeac[_0xc540('0x7')]),_0x5e0b53);}};exports[_0xc540('0x43')]=function(_0x900f78){try{if(!_[_0xc540('0x20')](channels[_0x900f78['uniqueid']])){utils['debug'](util[_0xc540('0x1d')]('[%s][calls][varset]',_0x900f78[_0xc540('0x7')]),_0x900f78);if(!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')][_0xc540('0x45')])){utils[_0xc540('0x6')](util['format'](_0xc540('0x46'),_0x900f78['uniqueid'],_0x900f78[_0xc540('0x47')]));channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x48')]=_0x900f78[_0xc540('0x47')];}if(!_['isNil'](_0x900f78[_0xc540('0x44')]['xmd-phone'])){utils[_0xc540('0x6')](util[_0xc540('0x1d')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x900f78['uniqueid'],_0x900f78[_0xc540('0x47')]));channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x49')]=_0x900f78[_0xc540('0x47')];channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x2a')]='\x22'+_0x900f78['value']+_0xc540('0x4a')+_0x900f78[_0xc540('0x47')]+'>';}if(!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')][_0xc540('0x4b')])||!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')][_0xc540('0x4c')])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x4d'),_0x900f78[_0xc540('0x7')],!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')]['xmd-callerid-preview'])?_0xc540('0x4b'):_0xc540('0x4c'),_0x900f78[_0xc540('0x47')]));channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x2a')]=_0x900f78[_0xc540('0x47')];}if(!_['isNil'](_0x900f78[_0xc540('0x44')][_0xc540('0x4e')])||!_[_0xc540('0x20')](_0x900f78['variable'][_0xc540('0x4f')])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x4d'),_0x900f78[_0xc540('0x7')],!_[_0xc540('0x20')](_0x900f78['variable']['xmd-queue'])?_0xc540('0x4e'):'xmcs-queue',_0x900f78[_0xc540('0x47')]));channels[_0x900f78['uniqueid']][_0xc540('0x50')]=_0xc540('0x51');channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x52')]=_0x900f78[_0xc540('0x47')];channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x53')]=!![];}if(!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')]['xmd-contactid'])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x54'),_0x900f78[_0xc540('0x7')],_0x900f78[_0xc540('0x47')]));channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x55')]=_0x900f78['value'];}if(!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')][_0xc540('0x56')])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x57'),_0x900f78[_0xc540('0x7')],_0x900f78[_0xc540('0x47')]));channels[_0x900f78['uniqueid']][_0xc540('0x58')]=_0x900f78[_0xc540('0x47')];}if(!_[_0xc540('0x20')](_0x900f78[_0xc540('0x44')][_0xc540('0x59')])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x5a'),_0x900f78[_0xc540('0x7')],_0x900f78['value']));channels[_0x900f78[_0xc540('0x7')]]['routeid']=_0x900f78[_0xc540('0x47')];}if(!_[_0xc540('0x20')](_0x900f78['variable'][_0xc540('0x5b')])){utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x5c'),_0x900f78['uniqueid'],_0x900f78[_0xc540('0x47')]));channels[_0x900f78[_0xc540('0x7')]][_0xc540('0x5b')]=_0x900f78[_0xc540('0x47')];}}}catch(_0x2e40a3){utils['error'](util[_0xc540('0x1d')](_0xc540('0x5d'),_0x900f78[_0xc540('0x7')]),_0x2e40a3);}};exports[_0xc540('0x5e')]=function(_0x2da638){try{if(!_[_0xc540('0x20')](channels[_0x2da638[_0xc540('0x7')]])){utils['debug'](util[_0xc540('0x1d')](_0xc540('0x5f'),_0x2da638[_0xc540('0x7')]),_0x2da638);utils[_0xc540('0x6')](util[_0xc540('0x1d')](_0xc540('0x60'),_0x2da638['uniqueid'],_0x2da638[_0xc540('0x61')],_0x2da638[_0xc540('0x62')]));if(_0x2da638['application'][_0xc540('0x63')]()=='set'&&_[_0xc540('0x64')](_0x2da638[_0xc540('0x62')][_0xc540('0x63')](),'cdr')){var _0x43e964=_0x2da638[_0xc540('0x62')][_0xc540('0x65')]('=');var _0x5e519d=_0x43e964[0x0][_0xc540('0x66')](_0x43e964[0x0][_0xc540('0x67')]('(')+0x1,_0x43e964[0x0][_0xc540('0x67')](')'));var _0xa777c2=_0x43e964[0x1];channels[_0x2da638[_0xc540('0x7')]][_0x5e519d]=_0xa777c2;}if(!_['includes']([_0xc540('0x28'),_0xc540('0x68'),'execif',_0xc540('0x69'),_0xc540('0x6a')],_0x2da638[_0xc540('0x61')][_0xc540('0x63')]())){channels[_0x2da638[_0xc540('0x7')]][_0xc540('0x50')]=_0x2da638['application'];channels[_0x2da638[_0xc540('0x7')]][_0xc540('0x52')]=_0x2da638[_0xc540('0x62')];}}}catch(_0x4abc38){utils['error'](util[_0xc540('0x1d')]('[%s][calls][newexten]',_0x2da638[_0xc540('0x7')]),_0x4abc38);}}; \ No newline at end of file +var _0x39d4=['hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','answertime','toNumber'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0x39d4,0x191));var _0x439d=function(_0x43a564,_0x1b4381){_0x43a564=_0x43a564-0x0;var _0x1ca74a=_0x39d4[_0x43a564];return _0x1ca74a;};'use strict';var _=require(_0x439d('0x0'));var util=require(_0x439d('0x1'));var utils=require(_0x439d('0x2'));var dispositions=['NO\x20ANSWER',_0x439d('0x3'),'FAILED',_0x439d('0x4'),_0x439d('0x4'),_0x439d('0x4'),_0x439d('0x5'),_0x439d('0x6'),_0x439d('0x3'),_0x439d('0x3'),_0x439d('0x3')];var channels={};function writeDB(_0x2e8172){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x9'),_0x2e8172[_0x439d('0xa')],_0x2e8172['channel'],_0x2e8172['queue'],_0x2e8172[_0x439d('0xb')],_0x2e8172[_0x439d('0xc')],_0x2e8172[_0x439d('0xd')],_0x2e8172[_0x439d('0xe')],_0x2e8172['lastevent']));if(_0x2e8172[_0x439d('0xf')]){utils[_0x439d('0x10')](_0x2e8172[_0x439d('0xf')])[_0x439d('0x11')](function(_0x4e4c5b){if(_0x4e4c5b){_0x2e8172[_0x439d('0x12')]=_0x4e4c5b['id'];}utils[_0x439d('0x13')](_0x439d('0x14'),_0x2e8172);});}else{utils['request'](_0x439d('0x14'),_0x2e8172);}if(channels[_0x2e8172['uniqueid']]){delete channels[_0x2e8172['uniqueid']];}}exports[_0x439d('0x15')]=function(_0x3077b5){try{utils['debug'](util[_0x439d('0x8')](_0x439d('0x16'),_0x3077b5[_0x439d('0xa')]),_0x3077b5);if(_0x3077b5[_0x439d('0xa')]==_0x3077b5[_0x439d('0x17')]&&_0x3077b5[_0x439d('0x18')]!=_0x439d('0x19')){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x1a'),_0x3077b5['uniqueid'],_0x3077b5['context'],_0x3077b5['exten']));channels[_0x3077b5['uniqueid']]={'uniqueid':_0x3077b5[_0x439d('0xa')],'accountcode':_0x3077b5['accountcode'],'source':_0x3077b5[_0x439d('0xd')],'destination':_0x3077b5[_0x439d('0x1b')],'destinationcontext':_0x3077b5[_0x439d('0x1c')],'channel':_0x3077b5[_0x439d('0x18')],'starttime':utils[_0x439d('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x439d('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x37ac7a){utils[_0x439d('0x1e')](util[_0x439d('0x8')](_0x439d('0x16'),_0x3077b5[_0x439d('0xa')]),_0x37ac7a);}};exports['newstate']=function(_0x40816d){try{utils[_0x439d('0x1f')](util[_0x439d('0x8')](_0x439d('0x20'),_0x40816d[_0x439d('0xa')]),_0x40816d);if(!_[_0x439d('0x21')](channels[_0x40816d['uniqueid']])&&_0x40816d[_0x439d('0x22')]==0x6){utils['info'](util[_0x439d('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x40816d['uniqueid'],_0x40816d['context'],_0x40816d[_0x439d('0x18')]));if(_[_0x439d('0x21')](channels[_0x40816d[_0x439d('0xa')]][_0x439d('0x23')])){channels[_0x40816d[_0x439d('0xa')]][_0x439d('0x23')]=utils[_0x439d('0x1d')]();}}else if(!_[_0x439d('0x21')](channels[_0x40816d[_0x439d('0x17')]])&&_0x40816d[_0x439d('0x22')]==0x6&&_0x40816d[_0x439d('0x1c')]!=_0x439d('0x24')){utils[_0x439d('0x7')](util[_0x439d('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x40816d[_0x439d('0xa')],_0x40816d[_0x439d('0x17')],_0x40816d[_0x439d('0x1c')],_0x40816d[_0x439d('0x18')]));channels[_0x40816d[_0x439d('0x17')]][_0x439d('0xf')]=_0x40816d['accountcode'];channels[_0x40816d[_0x439d('0x17')]]['destinationchannel']=_0x40816d[_0x439d('0x18')];if(_[_0x439d('0x21')](channels[_0x40816d[_0x439d('0x17')]][_0x439d('0x25')])){channels[_0x40816d['linkedid']][_0x439d('0x25')]=utils[_0x439d('0x1d')]();}channels[_0x40816d[_0x439d('0x17')]]['disposition']=dispositions[_[_0x439d('0x26')](_0x40816d[_0x439d('0x22')])]||_0x439d('0x5');}}catch(_0xc28013){utils[_0x439d('0x1e')](util['format'](_0x439d('0x20'),_0x40816d[_0x439d('0xa')]),_0xc28013);}};exports[_0x439d('0x27')]=function(_0x274b39){try{if(!_['isNil'](channels[_0x274b39[_0x439d('0xa')]])){utils[_0x439d('0x1f')](util['format'](_0x439d('0x28'),_0x274b39[_0x439d('0xa')]),_0x274b39);if(_[_0x439d('0x21')](channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x29')])){channels[_0x274b39['uniqueid']][_0x439d('0x29')]=_0x274b39[_0x439d('0x2a')]+'\x20<'+_0x274b39['calleridnum']+'>';}utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x2b'),_0x274b39[_0x439d('0xa')],channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x29')],_0x274b39['cause-txt']));channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x2c')]=utils[_0x439d('0x1d')]();channels[_0x274b39['uniqueid']][_0x439d('0x2d')]=utils['diffTime'](channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x2c')],channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x2e')]);channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x2f')]=channels[_0x274b39[_0x439d('0xa')]]['answertime']?utils[_0x439d('0x30')](channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x2c')],channels[_0x274b39[_0x439d('0xa')]][_0x439d('0x25')]):0x0;writeDB(channels[_0x274b39[_0x439d('0xa')]]);}}catch(_0x3c40d3){utils[_0x439d('0x1e')](util[_0x439d('0x8')](_0x439d('0x28'),_0x274b39[_0x439d('0xa')]),_0x3c40d3);}};exports[_0x439d('0x31')]=function(_0x20c2f6){try{if(!_[_0x439d('0x21')](channels[_0x20c2f6['localtwolinkedid']])){utils[_0x439d('0x1f')](util['format'](_0x439d('0x32'),_0x20c2f6[_0x439d('0x33')]),_0x20c2f6);if(channels[_0x20c2f6[_0x439d('0x34')]][_0x439d('0x18')]==_0x20c2f6['transfereechannel']){utils[_0x439d('0x7')](util['format'](_0x439d('0x35'),_0x20c2f6[_0x439d('0x33')],_0x20c2f6[_0x439d('0x34')],_0x20c2f6[_0x439d('0x36')]));channels[_0x20c2f6[_0x439d('0x34')]][_0x439d('0x37')]=_0x20c2f6[_0x439d('0x36')];channels[_0x20c2f6[_0x439d('0x34')]][_0x439d('0x38')]=_0x439d('0x39');}else if(channels[_0x20c2f6['localtwolinkedid']][_0x439d('0x18')]=_0x20c2f6[_0x439d('0x3a')]){utils['info'](util[_0x439d('0x8')](_0x439d('0x35'),_0x20c2f6['origtransfereruniqueid'],_0x20c2f6['localtwolinkedid'],_0x20c2f6[_0x439d('0x3b')]));channels[_0x20c2f6[_0x439d('0x34')]][_0x439d('0x37')]=_0x20c2f6[_0x439d('0x3b')];channels[_0x20c2f6[_0x439d('0x34')]]['userfield']=_0x439d('0x39');}}}catch(_0x3a2a13){utils[_0x439d('0x1e')](util['format'](_0x439d('0x32'),_0x20c2f6['origtransfereruniqueid']),_0x3a2a13);}};exports[_0x439d('0x3c')]=function(_0x51f0c6){try{if(!_[_0x439d('0x21')](channels[_0x51f0c6[_0x439d('0xa')]])){utils[_0x439d('0x1f')](util[_0x439d('0x8')](_0x439d('0x3d'),_0x51f0c6[_0x439d('0xa')]),_0x51f0c6);channels[_0x51f0c6[_0x439d('0xa')]][_0x439d('0x3e')]=utils[_0x439d('0x1d')]();utils[_0x439d('0x7')](util['format'](_0x439d('0x3f'),_0x51f0c6[_0x439d('0xa')],channels[_0x51f0c6['uniqueid']]['musiconholdstartAt']));}}catch(_0xad525c){utils[_0x439d('0x1e')](util[_0x439d('0x8')](_0x439d('0x3d'),_0x51f0c6[_0x439d('0xa')]),_0xad525c);}};exports['musiconholdstop']=function(_0x410255){try{if(!_[_0x439d('0x21')](channels[_0x410255[_0x439d('0xa')]])){utils[_0x439d('0x1f')](util[_0x439d('0x8')]('[%s][calls][musiconholdstop]',_0x410255['uniqueid']),_0x410255);if(!_[_0x439d('0x21')](channels[_0x410255[_0x439d('0xa')]]['musiconholdstartAt'])){channels[_0x410255['uniqueid']]['mohtime']+=utils[_0x439d('0x30')](utils['now'](),channels[_0x410255[_0x439d('0xa')]][_0x439d('0x3e')]);utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x40'),_0x410255[_0x439d('0xa')],channels[_0x410255['uniqueid']][_0x439d('0x41')]));delete channels[_0x410255[_0x439d('0xa')]][_0x439d('0x3e')];}}}catch(_0x8dd822){utils[_0x439d('0x1e')](util[_0x439d('0x8')](_0x439d('0x42'),_0x410255[_0x439d('0xa')]),_0x8dd822);}};exports['varset']=function(_0x5d10fc){try{if(!_[_0x439d('0x21')](channels[_0x5d10fc[_0x439d('0xa')]])){utils[_0x439d('0x1f')](util[_0x439d('0x8')](_0x439d('0x43'),_0x5d10fc[_0x439d('0xa')]),_0x5d10fc);if(!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x45')])){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x46'),_0x5d10fc[_0x439d('0xa')],_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x48')]=_0x5d10fc[_0x439d('0x47')];}if(!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x49')])){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x4a'),_0x5d10fc[_0x439d('0xa')],_0x5d10fc['value']));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x4b')]=_0x5d10fc[_0x439d('0x47')];channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x29')]='\x22'+_0x5d10fc[_0x439d('0x47')]+_0x439d('0x4c')+_0x5d10fc[_0x439d('0x47')]+'>';}if(!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x4d')])||!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x4e')])){utils[_0x439d('0x7')](util['format'](_0x439d('0x4f'),_0x5d10fc['uniqueid'],!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x4d')])?'xmd-callerid-preview':_0x439d('0x4e'),_0x5d10fc['value']));channels[_0x5d10fc['uniqueid']][_0x439d('0x29')]=_0x5d10fc[_0x439d('0x47')];}if(!_[_0x439d('0x21')](_0x5d10fc['variable'][_0x439d('0x50')])||!_['isNil'](_0x5d10fc[_0x439d('0x44')][_0x439d('0x51')])){utils['info'](util[_0x439d('0x8')](_0x439d('0x4f'),_0x5d10fc[_0x439d('0xa')],!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x50')])?_0x439d('0x50'):_0x439d('0x51'),_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x52')]=_0x439d('0x53');channels[_0x5d10fc['uniqueid']]['lastdata']=_0x5d10fc['value'];channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x54')]=!![];}if(!_[_0x439d('0x21')](_0x5d10fc['variable'][_0x439d('0x55')])){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x56'),_0x5d10fc['uniqueid'],_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x57')]=_0x5d10fc[_0x439d('0x47')];}if(!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x58')])){utils[_0x439d('0x7')](util[_0x439d('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5d10fc['uniqueid'],_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x59')]=_0x5d10fc[_0x439d('0x47')];}if(!_['isNil'](_0x5d10fc['variable'][_0x439d('0x5a')])){utils[_0x439d('0x7')](util[_0x439d('0x8')](_0x439d('0x5b'),_0x5d10fc[_0x439d('0xa')],_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x5c')]=_0x5d10fc[_0x439d('0x47')];}if(!_[_0x439d('0x21')](_0x5d10fc[_0x439d('0x44')][_0x439d('0x5d')])){utils[_0x439d('0x7')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5d10fc[_0x439d('0xa')],_0x5d10fc[_0x439d('0x47')]));channels[_0x5d10fc[_0x439d('0xa')]][_0x439d('0x5d')]=_0x5d10fc['value'];}}}catch(_0x5a4a53){utils['error'](util[_0x439d('0x8')](_0x439d('0x43'),_0x5d10fc['uniqueid']),_0x5a4a53);}};exports[_0x439d('0x5e')]=function(_0x4906b2){try{if(!_[_0x439d('0x21')](channels[_0x4906b2['uniqueid']])){utils['debug'](util[_0x439d('0x8')](_0x439d('0x5f'),_0x4906b2[_0x439d('0xa')]),_0x4906b2);utils['info'](util['format'](_0x439d('0x60'),_0x4906b2['uniqueid'],_0x4906b2['application'],_0x4906b2[_0x439d('0x61')]));if(_0x4906b2[_0x439d('0x62')][_0x439d('0x63')]()==_0x439d('0x64')&&_[_0x439d('0x65')](_0x4906b2[_0x439d('0x61')]['toLowerCase'](),_0x439d('0x66'))){var _0x582e72=_0x4906b2[_0x439d('0x61')][_0x439d('0x67')]('=');var _0xb42645=_0x582e72[0x0][_0x439d('0x68')](_0x582e72[0x0][_0x439d('0x69')]('(')+0x1,_0x582e72[0x0][_0x439d('0x69')](')'));var _0x4909a1=_0x582e72[0x1];channels[_0x4906b2[_0x439d('0xa')]][_0xb42645]=_0x4909a1;}if(!_[_0x439d('0x6a')](['hangup',_0x439d('0x6b'),'execif',_0x439d('0x64'),_0x439d('0x6c')],_0x4906b2['application'][_0x439d('0x63')]())){channels[_0x4906b2[_0x439d('0xa')]]['lastapplication']=_0x4906b2[_0x439d('0x62')];channels[_0x4906b2['uniqueid']][_0x439d('0x6d')]=_0x4906b2['appdata'];}}}catch(_0x24557f){utils[_0x439d('0x1e')](util[_0x439d('0x8')]('[%s][calls][newexten]',_0x4906b2[_0x439d('0xa')]),_0x24557f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index f52b191..c91907e 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 _0x49b3=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x4f5bc4,_0x461fe7){var _0x298fc1=function(_0x959536){while(--_0x959536){_0x4f5bc4['push'](_0x4f5bc4['shift']());}};_0x298fc1(++_0x461fe7);}(_0x49b3,0x15a));var _0x349b=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x49b3[_0x13b02f];return _0x12e9a6;};'use strict';var utils=require('./utils');exports[_0x349b('0x0')]=function(){utils[_0x349b('0x1')](_0x349b('0x2'));};exports[_0x349b('0x3')]=function(){utils[_0x349b('0x1')](_0x349b('0x4'));};exports[_0x349b('0x5')]=function(){utils[_0x349b('0x1')](_0x349b('0x6'));};exports[_0x349b('0x7')]=function(_0x309d44){utils[_0x349b('0x7')](_0x349b('0x8'),_0x309d44);};exports[_0x349b('0x9')]=function(){utils[_0x349b('0x1')](_0x349b('0xa'));};exports[_0x349b('0xb')]=function(_0x16fae3){}; \ No newline at end of file +var _0x4f08=['[core]\x20close','managerevent','./utils','connect','[core]\x20connected','[core]\x20shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x41f856,_0x54fa81){var _0x23e8a8=function(_0x367830){while(--_0x367830){_0x41f856['push'](_0x41f856['shift']());}};_0x23e8a8(++_0x54fa81);}(_0x4f08,0xaa));var _0x84f0=function(_0x373c78,_0x22a62a){_0x373c78=_0x373c78-0x0;var _0x575292=_0x4f08[_0x373c78];return _0x575292;};'use strict';var utils=require(_0x84f0('0x0'));exports[_0x84f0('0x1')]=function(){utils['info'](_0x84f0('0x2'));};exports['shutdown']=function(){utils['info'](_0x84f0('0x3'));};exports[_0x84f0('0x4')]=function(){utils[_0x84f0('0x5')](_0x84f0('0x6'));};exports[_0x84f0('0x7')]=function(_0x28a3e7){utils[_0x84f0('0x7')](_0x84f0('0x8'),_0x28a3e7);};exports[_0x84f0('0x9')]=function(){utils['info'](_0x84f0('0xa'));};exports[_0x84f0('0xb')]=function(_0x2354f5){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9001cde..3fdcb87 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 _0x6e8d=['value','dialbegin','[%s][dials][dialbegin]','starttime','lastevent','called','info','dialstatus','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','util','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x6e8d,0x1c8));var _0xd6e8=function(_0x5bc39f,_0x3aa327){_0x5bc39f=_0x5bc39f-0x0;var _0x1727f2=_0x6e8d[_0x5bc39f];return _0x1727f2;};'use strict';var _=require('lodash');var util=require(_0xd6e8('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x25d420){utils['info'](util[_0xd6e8('0x1')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x25d420[_0xd6e8('0x2')],_0x25d420[_0xd6e8('0x3')],_0x25d420[_0xd6e8('0x4')],_0x25d420[_0xd6e8('0x5')],_0x25d420[_0xd6e8('0x6')],_0x25d420['dialstatus']));utils[_0xd6e8('0x7')](_0xd6e8('0x8'),_0x25d420);delete dials[_0x25d420[_0xd6e8('0x2')]];}exports['newexten']=function(_0x379f0c){try{utils[_0xd6e8('0x9')](util[_0xd6e8('0x1')](_0xd6e8('0xa'),_0x379f0c[_0xd6e8('0x2')]),_0x379f0c);utils['info'](util[_0xd6e8('0x1')](_0xd6e8('0xb'),_0x379f0c['uniqueid'],_0x379f0c['application'],_0x379f0c[_0xd6e8('0xc')]));if(_0x379f0c[_0xd6e8('0xd')][_0xd6e8('0xe')]()==_0xd6e8('0xf')&&_['startsWith'](_0x379f0c[_0xd6e8('0xc')][_0xd6e8('0xe')](),_0xd6e8('0x10'))){var _0x3bb92e=_0x379f0c[_0xd6e8('0xc')][_0xd6e8('0x11')]('=');dials[_0x379f0c[_0xd6e8('0x2')]]={'routeId':_0x3bb92e[0x1]};}}catch(_0x22a18d){utils[_0xd6e8('0x12')](util[_0xd6e8('0x1')](_0xd6e8('0xa'),_0x379f0c[_0xd6e8('0x2')]),_0x22a18d);}};exports[_0xd6e8('0x13')]=function(_0x518c35){try{utils[_0xd6e8('0x9')](util[_0xd6e8('0x1')](_0xd6e8('0x14'),_0x518c35['uniqueid']),_0x518c35);if(!_[_0xd6e8('0x15')](_0x518c35['variable'][_0xd6e8('0x16')])){utils['info'](util[_0xd6e8('0x1')](_0xd6e8('0x17'),_0x518c35[_0xd6e8('0x2')],_0x518c35[_0xd6e8('0x18')]));dials[_0x518c35['uniqueid']]={'routeId':_0x518c35['value']};}}catch(_0x270a12){utils[_0xd6e8('0x12')](util['format']('[%s][dials][varset]',_0x518c35[_0xd6e8('0x2')]),_0x270a12);}};exports[_0xd6e8('0x19')]=function(_0x4cb371){try{if(!_[_0xd6e8('0x15')](dials[_0x4cb371[_0xd6e8('0x2')]])){utils[_0xd6e8('0x9')](util[_0xd6e8('0x1')](_0xd6e8('0x1a'),_0x4cb371[_0xd6e8('0x2')]),_0x4cb371);dials[_0x4cb371[_0xd6e8('0x2')]]=_['assign'](dials[_0x4cb371[_0xd6e8('0x2')]],_0x4cb371);dials[_0x4cb371[_0xd6e8('0x2')]][_0xd6e8('0x1b')]=utils['now']();dials[_0x4cb371['uniqueid']][_0xd6e8('0x1c')]=_0xd6e8('0x1d');utils[_0xd6e8('0x1e')](util[_0xd6e8('0x1')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4cb371[_0xd6e8('0x2')],dials[_0x4cb371[_0xd6e8('0x2')]][_0xd6e8('0x1b')]));}}catch(_0x5cd5b9){utils['error'](util[_0xd6e8('0x1')](_0xd6e8('0x1a'),_0x4cb371['uniqueid']),_0x5cd5b9);}};exports['dialend']=function(_0x408732){try{if(!_[_0xd6e8('0x15')](dials[_0x408732['uniqueid']])){utils['debug'](util['format']('[%s][dials][dialend]',_0x408732[_0xd6e8('0x2')]),_0x408732);dials[_0x408732[_0xd6e8('0x2')]][_0xd6e8('0x1f')]=_0x408732[_0xd6e8('0x1f')];if(_0x408732['dialstatus']=='ANSWER'){dials[_0x408732['uniqueid']]=_[_0xd6e8('0x20')](dials[_0x408732[_0xd6e8('0x2')]],_0x408732);dials[_0x408732[_0xd6e8('0x2')]][_0xd6e8('0x21')]=utils[_0xd6e8('0x22')]();dials[_0x408732[_0xd6e8('0x2')]][_0xd6e8('0x1c')]=_0xd6e8('0x23');utils[_0xd6e8('0x1e')](util[_0xd6e8('0x1')](_0xd6e8('0x24'),_0x408732[_0xd6e8('0x2')],_0x408732['dialstatus'],dials[_0x408732[_0xd6e8('0x2')]][_0xd6e8('0x21')]));}else{utils[_0xd6e8('0x1e')](util[_0xd6e8('0x1')](_0xd6e8('0x25'),_0x408732['uniqueid'],_0x408732[_0xd6e8('0x1f')]));}}}catch(_0x273ea0){utils[_0xd6e8('0x12')](util[_0xd6e8('0x1')](_0xd6e8('0x26'),_0x408732[_0xd6e8('0x2')]),_0x273ea0);}};exports[_0xd6e8('0x27')]=function(_0x19dfaf){try{if(!_[_0xd6e8('0x15')](dials[_0x19dfaf['uniqueid']])){utils[_0xd6e8('0x9')](util[_0xd6e8('0x1')]('[%s][dials][hangup]',_0x19dfaf['uniqueid']),_0x19dfaf);utils['info'](util['format'](_0xd6e8('0x28'),_0x19dfaf[_0xd6e8('0x2')],_0x19dfaf[_0xd6e8('0x5')],_0x19dfaf[_0xd6e8('0x29')],_0x19dfaf[_0xd6e8('0x2a')]));dials[_0x19dfaf['uniqueid']]=_[_0xd6e8('0x20')](dials[_0x19dfaf[_0xd6e8('0x2')]],{'endtime':utils[_0xd6e8('0x22')](),'lastevent':_0xd6e8('0x2b')});dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x2c')]=utils[_0xd6e8('0x2d')](dials[_0x19dfaf['uniqueid']][_0xd6e8('0x2e')],dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x1b')]);dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x2f')]=utils[_0xd6e8('0x2d')](dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x21')]||dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x2e')],dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x1b')]);dials[_0x19dfaf[_0xd6e8('0x2')]]['billableseconds']=dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x21')]?utils['diffTime'](dials[_0x19dfaf[_0xd6e8('0x2')]][_0xd6e8('0x2e')],dials[_0x19dfaf['uniqueid']][_0xd6e8('0x21')]):0x0;writeDB(dials[_0x19dfaf[_0xd6e8('0x2')]]);}}catch(_0x1aac71){utils[_0xd6e8('0x12')](util[_0xd6e8('0x1')]('[%s][dials][hangup]',_0x19dfaf[_0xd6e8('0x2')]),_0x1aac71);}}; \ No newline at end of file +var _0xc3c2=['value','error','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','uniqueid','channel','dialstring','dialstatus','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','cdr(routeid)','split','varset','debug','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x523ad3,_0x413744){var _0x10b9fc=function(_0x2186b4){while(--_0x2186b4){_0x523ad3['push'](_0x523ad3['shift']());}};_0x10b9fc(++_0x413744);}(_0xc3c2,0x147));var _0x2c3c=function(_0xa8e038,_0x3213f2){_0xa8e038=_0xa8e038-0x0;var _0x45bdeb=_0xc3c2[_0xa8e038];return _0x45bdeb;};'use strict';var _=require(_0x2c3c('0x0'));var util=require(_0x2c3c('0x1'));var utils=require(_0x2c3c('0x2'));var dials={};function writeDB(_0x4a9ba9){utils[_0x2c3c('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4a9ba9[_0x2c3c('0x4')],_0x4a9ba9[_0x2c3c('0x5')],_0x4a9ba9[_0x2c3c('0x6')],_0x4a9ba9['calleridnum'],_0x4a9ba9['connectedlinenum'],_0x4a9ba9[_0x2c3c('0x7')]));utils['request'](_0x2c3c('0x8'),_0x4a9ba9);delete dials[_0x4a9ba9[_0x2c3c('0x4')]];}exports[_0x2c3c('0x9')]=function(_0x2a13cc){try{utils['debug'](util[_0x2c3c('0xa')](_0x2c3c('0xb'),_0x2a13cc[_0x2c3c('0x4')]),_0x2a13cc);utils[_0x2c3c('0x3')](util[_0x2c3c('0xa')](_0x2c3c('0xc'),_0x2a13cc[_0x2c3c('0x4')],_0x2a13cc['application'],_0x2a13cc['appdata']));if(_0x2a13cc[_0x2c3c('0xd')][_0x2c3c('0xe')]()=='set'&&_['startsWith'](_0x2a13cc[_0x2c3c('0xf')][_0x2c3c('0xe')](),_0x2c3c('0x10'))){var _0x488c5a=_0x2a13cc[_0x2c3c('0xf')][_0x2c3c('0x11')]('=');dials[_0x2a13cc['uniqueid']]={'routeId':_0x488c5a[0x1]};}}catch(_0xcb604c){utils['error'](util[_0x2c3c('0xa')](_0x2c3c('0xb'),_0x2a13cc['uniqueid']),_0xcb604c);}};exports[_0x2c3c('0x12')]=function(_0x2c41c8){try{utils[_0x2c3c('0x13')](util[_0x2c3c('0xa')]('[%s][dials][varset]',_0x2c41c8[_0x2c3c('0x4')]),_0x2c41c8);if(!_[_0x2c3c('0x14')](_0x2c41c8[_0x2c3c('0x15')]['outboundrouteid'])){utils[_0x2c3c('0x3')](util[_0x2c3c('0xa')](_0x2c3c('0x16'),_0x2c41c8[_0x2c3c('0x4')],_0x2c41c8[_0x2c3c('0x17')]));dials[_0x2c41c8[_0x2c3c('0x4')]]={'routeId':_0x2c41c8['value']};}}catch(_0x18ec5e){utils[_0x2c3c('0x18')](util[_0x2c3c('0xa')](_0x2c3c('0x19'),_0x2c41c8['uniqueid']),_0x18ec5e);}};exports[_0x2c3c('0x1a')]=function(_0xe176d5){try{if(!_[_0x2c3c('0x14')](dials[_0xe176d5[_0x2c3c('0x4')]])){utils[_0x2c3c('0x13')](util[_0x2c3c('0xa')](_0x2c3c('0x1b'),_0xe176d5[_0x2c3c('0x4')]),_0xe176d5);dials[_0xe176d5[_0x2c3c('0x4')]]=_[_0x2c3c('0x1c')](dials[_0xe176d5['uniqueid']],_0xe176d5);dials[_0xe176d5['uniqueid']]['starttime']=utils[_0x2c3c('0x1d')]();dials[_0xe176d5[_0x2c3c('0x4')]][_0x2c3c('0x1e')]='called';utils['info'](util[_0x2c3c('0xa')](_0x2c3c('0x1f'),_0xe176d5['uniqueid'],dials[_0xe176d5[_0x2c3c('0x4')]][_0x2c3c('0x20')]));}}catch(_0x48c70a){utils[_0x2c3c('0x18')](util[_0x2c3c('0xa')]('[%s][dials][dialbegin]',_0xe176d5[_0x2c3c('0x4')]),_0x48c70a);}};exports[_0x2c3c('0x21')]=function(_0x25452b){try{if(!_[_0x2c3c('0x14')](dials[_0x25452b[_0x2c3c('0x4')]])){utils[_0x2c3c('0x13')](util[_0x2c3c('0xa')]('[%s][dials][dialend]',_0x25452b[_0x2c3c('0x4')]),_0x25452b);dials[_0x25452b[_0x2c3c('0x4')]][_0x2c3c('0x7')]=_0x25452b[_0x2c3c('0x7')];if(_0x25452b[_0x2c3c('0x7')]==_0x2c3c('0x22')){dials[_0x25452b[_0x2c3c('0x4')]]=_[_0x2c3c('0x1c')](dials[_0x25452b[_0x2c3c('0x4')]],_0x25452b);dials[_0x25452b[_0x2c3c('0x4')]][_0x2c3c('0x23')]=utils[_0x2c3c('0x1d')]();dials[_0x25452b[_0x2c3c('0x4')]]['lastevent']='connect';utils['info'](util[_0x2c3c('0xa')](_0x2c3c('0x24'),_0x25452b[_0x2c3c('0x4')],_0x25452b[_0x2c3c('0x7')],dials[_0x25452b[_0x2c3c('0x4')]][_0x2c3c('0x23')]));}else{utils[_0x2c3c('0x3')](util[_0x2c3c('0xa')](_0x2c3c('0x25'),_0x25452b[_0x2c3c('0x4')],_0x25452b[_0x2c3c('0x7')]));}}}catch(_0x5643f8){utils[_0x2c3c('0x18')](util[_0x2c3c('0xa')](_0x2c3c('0x26'),_0x25452b['uniqueid']),_0x5643f8);}};exports[_0x2c3c('0x27')]=function(_0x34067a){try{if(!_[_0x2c3c('0x14')](dials[_0x34067a[_0x2c3c('0x4')]])){utils[_0x2c3c('0x13')](util[_0x2c3c('0xa')](_0x2c3c('0x28'),_0x34067a['uniqueid']),_0x34067a);utils[_0x2c3c('0x3')](util['format'](_0x2c3c('0x29'),_0x34067a[_0x2c3c('0x4')],_0x34067a[_0x2c3c('0x2a')],_0x34067a[_0x2c3c('0x2b')],_0x34067a[_0x2c3c('0x2c')]));dials[_0x34067a[_0x2c3c('0x4')]]=_['assign'](dials[_0x34067a[_0x2c3c('0x4')]],{'endtime':utils[_0x2c3c('0x1d')](),'lastevent':'complete'});dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x2d')]=utils[_0x2c3c('0x2e')](dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x2f')],dials[_0x34067a['uniqueid']][_0x2c3c('0x20')]);dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x30')]=utils[_0x2c3c('0x2e')](dials[_0x34067a[_0x2c3c('0x4')]]['answertime']||dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x2f')],dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x20')]);dials[_0x34067a['uniqueid']][_0x2c3c('0x31')]=dials[_0x34067a['uniqueid']][_0x2c3c('0x23')]?utils[_0x2c3c('0x2e')](dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x2f')],dials[_0x34067a[_0x2c3c('0x4')]][_0x2c3c('0x23')]):0x0;writeDB(dials[_0x34067a[_0x2c3c('0x4')]]);}}catch(_0x1f598d){utils['error'](util['format'](_0x2c3c('0x28'),_0x34067a[_0x2c3c('0x4')]),_0x1f598d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4960a0c..719a67c 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 _0xfae8=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x4f79bc,_0x3359a9){var _0xdf0ec3=function(_0x46f19f){while(--_0x46f19f){_0x4f79bc['push'](_0x4f79bc['shift']());}};_0xdf0ec3(++_0x3359a9);}(_0xfae8,0xa2));var _0x8fae=function(_0x439537,_0x3edebf){_0x439537=_0x439537-0x0;var _0x6cecb0=_0xfae8[_0x439537];return _0x6cecb0;};var AsteriskManager=require(_0x8fae('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x8fae('0x1'));var ami=new AsteriskManager(config[_0x8fae('0x2')]['port'],config['asterisk']['ip'],config[_0x8fae('0x2')][_0x8fae('0x3')],config[_0x8fae('0x2')][_0x8fae('0x4')],!![]);ami[_0x8fae('0x5')]();if(config['xdr']&&config[_0x8fae('0x6')][_0x8fae('0x7')]){utils[_0x8fae('0x8')](_0x8fae('0x9'));}else{var agents=require(_0x8fae('0xa'));var calls=require(_0x8fae('0xb'));var queues=require(_0x8fae('0xc'));var recordings=require(_0x8fae('0xd'));var members=require(_0x8fae('0xe'));var dials=require(_0x8fae('0xf'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x8fae('0x10'),core[_0x8fae('0x10')]);ami['on']('shutdown',core[_0x8fae('0x11')]);ami['on'](_0x8fae('0x12'),core[_0x8fae('0x12')]);ami['on'](_0x8fae('0x13'),core['error']);ami['on']('close',core[_0x8fae('0x14')]);ami['on'](_0x8fae('0x15'),core[_0x8fae('0x15')]);ami['on']('devicestatechange',function(_0x41887f){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x18'),_0x41887f[_0x8fae('0x19')]),_0x41887f);members[_0x8fae('0x1a')](_0x41887f);}catch(_0x2d7912){utils[_0x8fae('0x13')](util[_0x8fae('0x17')]('[%s][index][devicestatechange]',_0x41887f[_0x8fae('0x19')]),_0x2d7912);}});ami['on']('agentcalled',function(_0x48fbf0){try{utils['debug'](util['format'](_0x8fae('0x1b'),_0x48fbf0[_0x8fae('0x1c')]),_0x48fbf0);agents[_0x8fae('0x1d')](_0x48fbf0);}catch(_0x11027f){utils['error'](util[_0x8fae('0x17')]('[%s][index][agentcalled]',_0x48fbf0[_0x8fae('0x1c')]),_0x11027f);}});ami['on'](_0x8fae('0x1e'),function(_0x51211e){try{utils['debug'](util[_0x8fae('0x17')](_0x8fae('0x1f'),_0x51211e[_0x8fae('0x1c')]),_0x51211e);agents[_0x8fae('0x1e')](_0x51211e);}catch(_0x44b308){utils['error'](util['format'](_0x8fae('0x1f'),_0x51211e[_0x8fae('0x1c')]),_0x44b308);}});ami['on']('agentconnect',function(_0x2e7610){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x20'),_0x2e7610[_0x8fae('0x1c')]),_0x2e7610);agents[_0x8fae('0x21')](_0x2e7610);queues[_0x8fae('0x21')](_0x2e7610);}catch(_0x30b342){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x20'),_0x2e7610['uniqueid']),_0x30b342);}});ami['on'](_0x8fae('0x22'),function(_0x130d0b){try{utils[_0x8fae('0x16')](util['format'](_0x8fae('0x23'),_0x130d0b[_0x8fae('0x1c')]),_0x130d0b);agents[_0x8fae('0x22')](_0x130d0b);queues['agentcomplete'](_0x130d0b);members[_0x8fae('0x22')](_0x130d0b);}catch(_0x3e09b1){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x23'),_0x130d0b['uniqueid']),_0x3e09b1);}});ami['on'](_0x8fae('0x24'),function(_0x3421bc){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')]('[%s][index][queuecallerabandon]',_0x3421bc[_0x8fae('0x1c')]),_0x3421bc);agents[_0x8fae('0x24')](_0x3421bc);queues['queuecallerabandon'](_0x3421bc);}catch(_0x2952dd){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x25'),_0x3421bc[_0x8fae('0x1c')]),_0x2952dd);}});ami['on'](_0x8fae('0x26'),function(_0x502dd2){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x27'),_0x502dd2['uniqueid']),_0x502dd2);queues[_0x8fae('0x26')](_0x502dd2);recordings[_0x8fae('0x26')](_0x502dd2);}catch(_0x34b967){utils['error'](util['format'](_0x8fae('0x27'),_0x502dd2[_0x8fae('0x1c')]),_0x34b967);}});ami['on'](_0x8fae('0x28'),function(_0x1b242d){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x29'),_0x1b242d[_0x8fae('0x1c')]),_0x1b242d);queues[_0x8fae('0x28')](_0x1b242d);}catch(_0xa8a6ec){utils[_0x8fae('0x13')](util['format'](_0x8fae('0x29'),_0x1b242d[_0x8fae('0x1c')]),_0xa8a6ec);}});ami['on'](_0x8fae('0x2a'),function(_0x4f8151){try{utils['debug'](util[_0x8fae('0x17')](_0x8fae('0x2b'),_0x4f8151['uniqueid']),_0x4f8151);queues[_0x8fae('0x2a')](_0x4f8151);calls[_0x8fae('0x2a')](_0x4f8151);}catch(_0x37250f){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x2b'),_0x4f8151[_0x8fae('0x1c')]),_0x37250f);}});ami['on'](_0x8fae('0x2c'),function(_0x5031f0){try{utils[_0x8fae('0x16')](util['format'](_0x8fae('0x2d'),_0x5031f0[_0x8fae('0x1c')]),_0x5031f0);queues[_0x8fae('0x2c')](_0x5031f0);calls['musiconholdstop'](_0x5031f0);}catch(_0x55425d){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x2d'),_0x5031f0[_0x8fae('0x1c')]),_0x55425d);}});ami['on'](_0x8fae('0x2e'),function(_0x176f83){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x2f'),_0x176f83[_0x8fae('0x1c')]),_0x176f83);calls[_0x8fae('0x2e')](_0x176f83);recordings['newstate'](_0x176f83);}catch(_0x58cd8f){utils[_0x8fae('0x13')](util[_0x8fae('0x17')]('[%s][index][newstate]',_0x176f83[_0x8fae('0x1c')]),_0x58cd8f);}});ami['on']('hangup',function(_0x4db873){try{utils['debug'](util[_0x8fae('0x17')](_0x8fae('0x30'),_0x4db873[_0x8fae('0x1c')]),_0x4db873);calls[_0x8fae('0x31')](_0x4db873);recordings[_0x8fae('0x31')](_0x4db873);dials['hangup'](_0x4db873);agents['hangup'](_0x4db873);queues[_0x8fae('0x31')](_0x4db873);}catch(_0x2074c2){utils['error'](util[_0x8fae('0x17')](_0x8fae('0x30'),_0x4db873['uniqueid']),_0x2074c2);}});ami['on'](_0x8fae('0x32'),function(_0x26bc11){try{utils['debug'](util[_0x8fae('0x17')]('[%s][index][cdr]',_0x26bc11[_0x8fae('0x1c')]),_0x26bc11);members[_0x8fae('0x32')](_0x26bc11);}catch(_0x588d07){utils[_0x8fae('0x13')](util['format'](_0x8fae('0x33'),_0x26bc11[_0x8fae('0x1c')]),_0x588d07);}});ami['on'](_0x8fae('0x34'),function(_0x56154d){try{utils[_0x8fae('0x16')](util['format']('[%s][index][blindtransfer]',_0x56154d[_0x8fae('0x1c')]),_0x56154d);queues['blindtransfer'](_0x56154d);agents[_0x8fae('0x34')](_0x56154d);transfers[_0x8fae('0x34')](_0x56154d);}catch(_0x3cad1d){utils['error'](util[_0x8fae('0x17')](_0x8fae('0x35'),_0x56154d[_0x8fae('0x1c')]),_0x3cad1d);}});ami['on'](_0x8fae('0x36'),function(_0x2c5de6){try{utils[_0x8fae('0x16')](util['format'](_0x8fae('0x37'),_0x2c5de6['origtransfereruniqueid']),_0x2c5de6);queues['attendedtransfer'](_0x2c5de6);transfers['attendedtransfer'](_0x2c5de6);agents[_0x8fae('0x36')](_0x2c5de6);calls[_0x8fae('0x36')](_0x2c5de6);}catch(_0x2ea32c){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x37'),_0x2c5de6[_0x8fae('0x38')]),_0x2ea32c);}});ami['on'](_0x8fae('0x39'),function(_0x16ac17){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x3a'),_0x16ac17[_0x8fae('0x1c')]),_0x16ac17);queues[_0x8fae('0x39')](_0x16ac17);recordings['varset'](_0x16ac17);calls[_0x8fae('0x39')](_0x16ac17);dials['varset'](_0x16ac17);}catch(_0x1fae15){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x3a'),_0x16ac17[_0x8fae('0x1c')]),_0x1fae15);}});ami['on'](_0x8fae('0x3b'),function(_0x42078f){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x3c'),_0x42078f[_0x8fae('0x1c')]),_0x42078f);calls['newexten'](_0x42078f);recordings[_0x8fae('0x3b')](_0x42078f);dials[_0x8fae('0x3b')](_0x42078f);}catch(_0x28baac){utils['error'](util['format'](_0x8fae('0x3c'),_0x42078f[_0x8fae('0x1c')]),_0x28baac);}});ami['on'](_0x8fae('0x3d'),function(_0x3794d9){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x3e'),_0x3794d9[_0x8fae('0x1c')]),_0x3794d9);calls['newchannel'](_0x3794d9);recordings[_0x8fae('0x3d')](_0x3794d9);}catch(_0x189ebc){utils[_0x8fae('0x13')](util['format'](_0x8fae('0x3e'),_0x3794d9[_0x8fae('0x1c')]),_0x189ebc);}});ami['on']('dialbegin',function(_0x41dee2){try{utils[_0x8fae('0x16')](util[_0x8fae('0x17')](_0x8fae('0x3f'),_0x41dee2[_0x8fae('0x1c')]),_0x41dee2);dials[_0x8fae('0x40')](_0x41dee2);}catch(_0x24ee4b){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x41'),_0x41dee2[_0x8fae('0x1c')]),_0x24ee4b);}});ami['on'](_0x8fae('0x42'),function(_0x169c0b){try{utils['debug'](util[_0x8fae('0x17')](_0x8fae('0x43'),_0x169c0b[_0x8fae('0x1c')]),_0x169c0b);dials['dialend'](_0x169c0b);}catch(_0x21e7a1){utils[_0x8fae('0x13')](util[_0x8fae('0x17')](_0x8fae('0x43'),_0x169c0b[_0x8fae('0x1c')]),_0x21e7a1);}});} \ No newline at end of file +var _0x21da=['[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','port','password','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','debug','format','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x21da,0x1b8));var _0xa21d=function(_0x480a6f,_0x2520af){_0x480a6f=_0x480a6f-0x0;var _0x2d0f2d=_0x21da[_0x480a6f];return _0x2d0f2d;};var AsteriskManager=require(_0xa21d('0x0'));var config=require(_0xa21d('0x1'));var utils=require(_0xa21d('0x2'));var util=require(_0xa21d('0x3'));var ami=new AsteriskManager(config[_0xa21d('0x4')][_0xa21d('0x5')],config[_0xa21d('0x4')]['ip'],config[_0xa21d('0x4')]['username'],config['asterisk'][_0xa21d('0x6')],!![]);ami['keepConnected']();if(config[_0xa21d('0x7')]&&config[_0xa21d('0x7')][_0xa21d('0x8')]){utils[_0xa21d('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0xa21d('0xa'));var calls=require(_0xa21d('0xb'));var queues=require(_0xa21d('0xc'));var recordings=require(_0xa21d('0xd'));var members=require(_0xa21d('0xe'));var dials=require(_0xa21d('0xf'));var transfers=require(_0xa21d('0x10'));var core=require(_0xa21d('0x11'));ami['on'](_0xa21d('0x12'),core[_0xa21d('0x12')]);ami['on'](_0xa21d('0x13'),core[_0xa21d('0x13')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xa21d('0x14'),core[_0xa21d('0x14')]);ami['on'](_0xa21d('0x15'),core['close']);ami['on']('managerevent',core[_0xa21d('0x16')]);ami['on']('devicestatechange',function(_0x5c7c24){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')]('[%s][index][devicestatechange]',_0x5c7c24['device']),_0x5c7c24);members[_0xa21d('0x19')](_0x5c7c24);}catch(_0x512b4b){utils[_0xa21d('0x14')](util[_0xa21d('0x18')](_0xa21d('0x1a'),_0x5c7c24['device']),_0x512b4b);}});ami['on'](_0xa21d('0x1b'),function(_0x11e8aa){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x1c'),_0x11e8aa['uniqueid']),_0x11e8aa);agents[_0xa21d('0x1b')](_0x11e8aa);}catch(_0xfc52ed){utils[_0xa21d('0x14')](util['format']('[%s][index][agentcalled]',_0x11e8aa['uniqueid']),_0xfc52ed);}});ami['on'](_0xa21d('0x1d'),function(_0x3226fb){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x1e'),_0x3226fb[_0xa21d('0x1f')]),_0x3226fb);agents['agentringnoanswer'](_0x3226fb);}catch(_0x4454ce){utils['error'](util[_0xa21d('0x18')]('[%s][index][agentringnoanswer]',_0x3226fb['uniqueid']),_0x4454ce);}});ami['on']('agentconnect',function(_0x2bddbc){try{utils['debug'](util[_0xa21d('0x18')](_0xa21d('0x20'),_0x2bddbc[_0xa21d('0x1f')]),_0x2bddbc);agents[_0xa21d('0x21')](_0x2bddbc);queues[_0xa21d('0x21')](_0x2bddbc);}catch(_0x54e67e){utils[_0xa21d('0x14')](util[_0xa21d('0x18')](_0xa21d('0x20'),_0x2bddbc[_0xa21d('0x1f')]),_0x54e67e);}});ami['on']('agentcomplete',function(_0x2522b4){try{utils[_0xa21d('0x17')](util['format'](_0xa21d('0x22'),_0x2522b4[_0xa21d('0x1f')]),_0x2522b4);agents[_0xa21d('0x23')](_0x2522b4);queues[_0xa21d('0x23')](_0x2522b4);members[_0xa21d('0x23')](_0x2522b4);}catch(_0x5033f1){utils['error'](util[_0xa21d('0x18')]('[%s][index][agentcomplete]',_0x2522b4[_0xa21d('0x1f')]),_0x5033f1);}});ami['on']('queuecallerabandon',function(_0xc885c7){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x24'),_0xc885c7[_0xa21d('0x1f')]),_0xc885c7);agents[_0xa21d('0x25')](_0xc885c7);queues[_0xa21d('0x25')](_0xc885c7);}catch(_0x36a2e9){utils[_0xa21d('0x14')](util[_0xa21d('0x18')](_0xa21d('0x24'),_0xc885c7[_0xa21d('0x1f')]),_0x36a2e9);}});ami['on'](_0xa21d('0x26'),function(_0x10c5f7){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x27'),_0x10c5f7['uniqueid']),_0x10c5f7);queues[_0xa21d('0x26')](_0x10c5f7);recordings[_0xa21d('0x26')](_0x10c5f7);}catch(_0x15d3eb){utils['error'](util[_0xa21d('0x18')](_0xa21d('0x27'),_0x10c5f7['uniqueid']),_0x15d3eb);}});ami['on'](_0xa21d('0x28'),function(_0x3be891){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x29'),_0x3be891['uniqueid']),_0x3be891);queues['queuecallerleave'](_0x3be891);}catch(_0x22b7e2){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x29'),_0x3be891['uniqueid']),_0x22b7e2);}});ami['on'](_0xa21d('0x2a'),function(_0x3e5329){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x2b'),_0x3e5329['uniqueid']),_0x3e5329);queues[_0xa21d('0x2a')](_0x3e5329);calls[_0xa21d('0x2a')](_0x3e5329);}catch(_0x1c39d8){utils[_0xa21d('0x14')](util[_0xa21d('0x18')]('[%s][index][musiconholdstart]',_0x3e5329[_0xa21d('0x1f')]),_0x1c39d8);}});ami['on'](_0xa21d('0x2c'),function(_0xeacef3){try{utils['debug'](util[_0xa21d('0x18')](_0xa21d('0x2d'),_0xeacef3['uniqueid']),_0xeacef3);queues[_0xa21d('0x2c')](_0xeacef3);calls[_0xa21d('0x2c')](_0xeacef3);}catch(_0x429018){utils[_0xa21d('0x14')](util[_0xa21d('0x18')]('[%s][index][musiconholdstop]',_0xeacef3[_0xa21d('0x1f')]),_0x429018);}});ami['on']('newstate',function(_0x45f433){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')]('[%s][index][newstate]',_0x45f433[_0xa21d('0x1f')]),_0x45f433);calls[_0xa21d('0x2e')](_0x45f433);recordings[_0xa21d('0x2e')](_0x45f433);}catch(_0x2bd301){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x2f'),_0x45f433[_0xa21d('0x1f')]),_0x2bd301);}});ami['on'](_0xa21d('0x30'),function(_0x2e09af){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x31'),_0x2e09af[_0xa21d('0x1f')]),_0x2e09af);calls[_0xa21d('0x30')](_0x2e09af);recordings[_0xa21d('0x30')](_0x2e09af);dials[_0xa21d('0x30')](_0x2e09af);agents[_0xa21d('0x30')](_0x2e09af);queues[_0xa21d('0x30')](_0x2e09af);}catch(_0x397030){utils['error'](util['format'](_0xa21d('0x31'),_0x2e09af[_0xa21d('0x1f')]),_0x397030);}});ami['on'](_0xa21d('0x32'),function(_0x3f9a64){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x33'),_0x3f9a64[_0xa21d('0x1f')]),_0x3f9a64);members['cdr'](_0x3f9a64);}catch(_0x1a317f){utils[_0xa21d('0x14')](util[_0xa21d('0x18')](_0xa21d('0x33'),_0x3f9a64[_0xa21d('0x1f')]),_0x1a317f);}});ami['on'](_0xa21d('0x34'),function(_0x20233b){try{utils['debug'](util[_0xa21d('0x18')](_0xa21d('0x35'),_0x20233b['uniqueid']),_0x20233b);queues['blindtransfer'](_0x20233b);agents[_0xa21d('0x34')](_0x20233b);transfers[_0xa21d('0x34')](_0x20233b);}catch(_0x21c81a){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x35'),_0x20233b['uniqueid']),_0x21c81a);}});ami['on']('attendedtransfer',function(_0x3f54e4){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x36'),_0x3f54e4['origtransfereruniqueid']),_0x3f54e4);queues[_0xa21d('0x37')](_0x3f54e4);transfers[_0xa21d('0x37')](_0x3f54e4);agents['attendedtransfer'](_0x3f54e4);calls['attendedtransfer'](_0x3f54e4);}catch(_0x1b4e6c){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x36'),_0x3f54e4[_0xa21d('0x38')]),_0x1b4e6c);}});ami['on'](_0xa21d('0x39'),function(_0x374c77){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x3a'),_0x374c77[_0xa21d('0x1f')]),_0x374c77);queues[_0xa21d('0x39')](_0x374c77);recordings['varset'](_0x374c77);calls[_0xa21d('0x39')](_0x374c77);dials['varset'](_0x374c77);}catch(_0x5a093a){utils[_0xa21d('0x14')](util[_0xa21d('0x18')](_0xa21d('0x3a'),_0x374c77[_0xa21d('0x1f')]),_0x5a093a);}});ami['on'](_0xa21d('0x3b'),function(_0x56c7fa){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x3c'),_0x56c7fa[_0xa21d('0x1f')]),_0x56c7fa);calls[_0xa21d('0x3b')](_0x56c7fa);recordings[_0xa21d('0x3b')](_0x56c7fa);dials[_0xa21d('0x3b')](_0x56c7fa);}catch(_0x4e5021){utils[_0xa21d('0x14')](util['format']('[%s][index][newexten]',_0x56c7fa[_0xa21d('0x1f')]),_0x4e5021);}});ami['on'](_0xa21d('0x3d'),function(_0x53c6a7){try{utils['debug'](util[_0xa21d('0x18')]('[%s][index][newchannel]',_0x53c6a7[_0xa21d('0x1f')]),_0x53c6a7);calls[_0xa21d('0x3d')](_0x53c6a7);recordings[_0xa21d('0x3d')](_0x53c6a7);}catch(_0x1d1af1){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x3e'),_0x53c6a7['uniqueid']),_0x1d1af1);}});ami['on']('dialbegin',function(_0x1355f8){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x3f'),_0x1355f8[_0xa21d('0x1f')]),_0x1355f8);dials[_0xa21d('0x40')](_0x1355f8);}catch(_0x8688e6){utils[_0xa21d('0x14')](util['format'](_0xa21d('0x41'),_0x1355f8[_0xa21d('0x1f')]),_0x8688e6);}});ami['on']('dialend',function(_0x40832d){try{utils[_0xa21d('0x17')](util[_0xa21d('0x18')](_0xa21d('0x42'),_0x40832d[_0xa21d('0x1f')]),_0x40832d);dials[_0xa21d('0x43')](_0x40832d);}catch(_0x7bcb98){utils['error'](util[_0xa21d('0x18')](_0xa21d('0x42'),_0x40832d['uniqueid']),_0x7bcb98);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 568b293..ef3b49c 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 _0xad20=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','isNil','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','util','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','diffTime','exitAt','enterAt','agentcomplete'];(function(_0x1dc01c,_0x3c3211){var _0x56313a=function(_0x3b21ac){while(--_0x3b21ac){_0x1dc01c['push'](_0x1dc01c['shift']());}};_0x56313a(++_0x3c3211);}(_0xad20,0xa6));var _0x0ad2=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xad20[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0x0ad2('0x0'));var utils=require('./utils');var members={};var exclude=[_0x0ad2('0x1'),'Queue:'];function writeDB(_0x3b1c8b){utils[_0x0ad2('0x2')](util[_0x0ad2('0x3')](_0x0ad2('0x4'),_0x3b1c8b['uniqueid'],_0x3b1c8b[_0x0ad2('0x5')],_0x3b1c8b[_0x0ad2('0x6')],_0x3b1c8b[_0x0ad2('0x7')],_0x3b1c8b[_0x0ad2('0x8')],_0x3b1c8b[_0x0ad2('0x9')]));if(_0x3b1c8b['interface']){utils[_0x0ad2('0xa')](_0x3b1c8b[_0x0ad2('0x5')])[_0x0ad2('0xb')](function(_0x48f1f9){if(_0x48f1f9){_0x3b1c8b[_0x0ad2('0x8')]=_0x48f1f9[_0x0ad2('0xc')];_0x3b1c8b['internal']=_0x48f1f9[_0x0ad2('0xd')];utils[_0x0ad2('0xe')](_0x0ad2('0xf'),_0x3b1c8b);}else{utils[_0x0ad2('0x10')](_0x3b1c8b[_0x0ad2('0x5')][_0x0ad2('0x11')]('/')[0x1])[_0x0ad2('0xb')](function(_0x20ac61){if(_0x20ac61){_0x3b1c8b[_0x0ad2('0x8')]=_0x20ac61['name'];_0x3b1c8b[_0x0ad2('0xd')]=_0x20ac61[_0x0ad2('0xd')];utils[_0x0ad2('0xe')](_0x0ad2('0xf'),_0x3b1c8b);}});}})['catch'](function(_0x46fd7e){utils[_0x0ad2('0x12')](util[_0x0ad2('0x3')](_0x0ad2('0x13'),_0x3b1c8b[_0x0ad2('0x14')]),_0x46fd7e);});}delete members[_0x3b1c8b[_0x0ad2('0x5')]];}function startsWith(_0x265e04,_0x5b0b2f){return _[_0x0ad2('0x15')](_0x265e04,function(_0x3ecbbb){return _['startsWith'](_0x5b0b2f,_0x3ecbbb);});}exports[_0x0ad2('0x16')]=function(_0x125276){try{utils[_0x0ad2('0x17')](util[_0x0ad2('0x3')](_0x0ad2('0x18'),members[_0x125276[_0x0ad2('0x19')]]?members[_0x125276[_0x0ad2('0x19')]][_0x0ad2('0x14')]:_0x125276[_0x0ad2('0x19')]),_0x125276);utils[_0x0ad2('0x2')](util[_0x0ad2('0x3')](_0x0ad2('0x1a'),members[_0x125276[_0x0ad2('0x19')]]?members[_0x125276[_0x0ad2('0x19')]][_0x0ad2('0x14')]:_0x125276[_0x0ad2('0x19')],_0x125276[_0x0ad2('0x1b')],_0x125276[_0x0ad2('0x19')]));switch(_0x125276[_0x0ad2('0x1b')]){case _0x0ad2('0x1c'):case _0x0ad2('0x1d'):if(!startsWith(exclude,_0x125276['device'])){members[_0x125276[_0x0ad2('0x19')]]={'channel':_0x0ad2('0x1e'),'interface':_0x125276[_0x0ad2('0x19')],'type':'TALKING','enterAt':utils[_0x0ad2('0x1f')](),'role':_0x0ad2('0x20')};}break;case _0x0ad2('0x21'):if(!_['isNil'](members[_0x125276[_0x0ad2('0x19')]])){members[_0x125276['device']]['exitAt']=utils['now']();members[_0x125276[_0x0ad2('0x19')]]['duration']=utils[_0x0ad2('0x22')](members[_0x125276['device']][_0x0ad2('0x23')],members[_0x125276['device']][_0x0ad2('0x24')]);if(members[_0x125276[_0x0ad2('0x19')]]['uniqueid']){writeDB(members[_0x125276[_0x0ad2('0x19')]]);}}break;default:break;}}catch(_0x1eb115){utils['error'](util[_0x0ad2('0x3')](_0x0ad2('0x18'),members[_0x125276[_0x0ad2('0x19')]]?members[_0x125276[_0x0ad2('0x19')]][_0x0ad2('0x14')]:_0x125276[_0x0ad2('0x19')]),_0x1eb115);}};exports[_0x0ad2('0x25')]=function(_0x2d397b){try{if(!_['isNil'](members[_0x2d397b[_0x0ad2('0x5')]])){utils[_0x0ad2('0x17')](util['format'](_0x0ad2('0x26'),_0x2d397b[_0x0ad2('0x14')]),_0x2d397b);utils[_0x0ad2('0x2')](util[_0x0ad2('0x3')](_0x0ad2('0x27'),_0x2d397b['uniqueid'],_0x2d397b[_0x0ad2('0x5')],_0x2d397b['queue']));members[_0x2d397b['interface']]=_[_0x0ad2('0x28')](members[_0x2d397b[_0x0ad2('0x5')]],{'data4':_0x2d397b[_0x0ad2('0x29')],'uniqueid':_0x2d397b[_0x0ad2('0x14')]});}}catch(_0x12af04){utils['error'](util[_0x0ad2('0x3')](_0x0ad2('0x26'),_0x2d397b[_0x0ad2('0x14')]),_0x12af04);}};exports[_0x0ad2('0x2a')]=function(_0x3518a6){try{utils[_0x0ad2('0x17')](util[_0x0ad2('0x3')](_0x0ad2('0x2b'),_0x3518a6[_0x0ad2('0x14')]),_0x3518a6);if(_0x3518a6['channel']){var _0x4b49af=_0x3518a6[_0x0ad2('0x6')][_0x0ad2('0x11')]('-')[0x0];if(!_[_0x0ad2('0x2c')](members[_0x4b49af])){members[_0x4b49af]=_['assign'](members[_0x4b49af],{'data1':members[_0x4b49af]['data1']||_0x3518a6[_0x0ad2('0x9')],'data2':members[_0x4b49af][_0x0ad2('0x7')]||_0x3518a6[_0x0ad2('0x2d')],'data3':members[_0x4b49af][_0x0ad2('0x2e')]||_0x3518a6['destination'],'uniqueid':members[_0x4b49af][_0x0ad2('0x14')]||_0x3518a6[_0x0ad2('0x14')]});utils['info'](util[_0x0ad2('0x3')](_0x0ad2('0x2f'),_0x3518a6['uniqueid'],members[_0x4b49af][_0x0ad2('0x30')],members[_0x4b49af]['data2'],members[_0x4b49af]['data3']));if(members[_0x4b49af][_0x0ad2('0x23')]){writeDB(members[_0x4b49af]);}}}if(_0x3518a6['destinationchannel']){var _0x545abe=_0x3518a6[_0x0ad2('0x31')]['split']('-')[0x0];if(!_[_0x0ad2('0x2c')](members[_0x545abe])){members[_0x545abe]=_[_0x0ad2('0x28')](members[_0x545abe],{'data1':members[_0x545abe][_0x0ad2('0x30')]||_0x3518a6[_0x0ad2('0x9')],'data2':members[_0x545abe]['data2']||_0x3518a6['source'],'data3':members[_0x545abe][_0x0ad2('0x2e')]||_0x3518a6[_0x0ad2('0x32')],'uniqueid':members[_0x545abe][_0x0ad2('0x14')]||_0x3518a6[_0x0ad2('0x14')]});utils[_0x0ad2('0x2')](util['format'](_0x0ad2('0x2f'),_0x3518a6[_0x0ad2('0x14')],members[_0x545abe][_0x0ad2('0x30')],members[_0x545abe][_0x0ad2('0x7')],members[_0x545abe][_0x0ad2('0x2e')]));if(members[_0x545abe][_0x0ad2('0x23')]){writeDB(members[_0x545abe]);}}}}catch(_0x5f3075){utils[_0x0ad2('0x12')](util[_0x0ad2('0x3')](_0x0ad2('0x2b'),_0x3518a6[_0x0ad2('0x14')]),_0x5f3075);}}; \ No newline at end of file +var _0x703c=['TALKING','now','agent','NOT_INUSE','isNil','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','exitAt','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY'];(function(_0x28d4d7,_0x49f270){var _0x594bbf=function(_0x12d6df){while(--_0x12d6df){_0x28d4d7['push'](_0x28d4d7['shift']());}};_0x594bbf(++_0x49f270);}(_0x703c,0x128));var _0xc703=function(_0x328128,_0x14c25f){_0x328128=_0x328128-0x0;var _0x141280=_0x703c[_0x328128];return _0x141280;};'use strict';var _=require(_0xc703('0x0'));var util=require(_0xc703('0x1'));var utils=require(_0xc703('0x2'));var members={};var exclude=[_0xc703('0x3'),_0xc703('0x4')];function writeDB(_0x4a4dfc){utils['info'](util[_0xc703('0x5')](_0xc703('0x6'),_0x4a4dfc[_0xc703('0x7')],_0x4a4dfc[_0xc703('0x8')],_0x4a4dfc[_0xc703('0x9')],_0x4a4dfc[_0xc703('0xa')],_0x4a4dfc[_0xc703('0xb')],_0x4a4dfc[_0xc703('0xc')]));if(_0x4a4dfc['interface']){utils[_0xc703('0xd')](_0x4a4dfc[_0xc703('0x8')])[_0xc703('0xe')](function(_0x1529e0){if(_0x1529e0){_0x4a4dfc[_0xc703('0xb')]=_0x1529e0[_0xc703('0xf')];_0x4a4dfc[_0xc703('0x10')]=_0x1529e0[_0xc703('0x10')];utils['request'](_0xc703('0x11'),_0x4a4dfc);}else{utils[_0xc703('0x12')](_0x4a4dfc['interface'][_0xc703('0x13')]('/')[0x1])[_0xc703('0xe')](function(_0x3823ea){if(_0x3823ea){_0x4a4dfc[_0xc703('0xb')]=_0x3823ea[_0xc703('0xf')];_0x4a4dfc[_0xc703('0x10')]=_0x3823ea[_0xc703('0x10')];utils[_0xc703('0x14')](_0xc703('0x11'),_0x4a4dfc);}});}})[_0xc703('0x15')](function(_0x1d9bc3){utils[_0xc703('0x16')](util[_0xc703('0x5')](_0xc703('0x17'),_0x4a4dfc['uniqueid']),_0x1d9bc3);});}delete members[_0x4a4dfc['interface']];}function startsWith(_0x40a81d,_0x284ab0){return _[_0xc703('0x18')](_0x40a81d,function(_0x2b2c89){return _[_0xc703('0x19')](_0x284ab0,_0x2b2c89);});}exports[_0xc703('0x1a')]=function(_0x534a2c){try{utils[_0xc703('0x1b')](util[_0xc703('0x5')](_0xc703('0x1c'),members[_0x534a2c[_0xc703('0x1d')]]?members[_0x534a2c[_0xc703('0x1d')]]['uniqueid']:_0x534a2c[_0xc703('0x1d')]),_0x534a2c);utils['info'](util[_0xc703('0x5')](_0xc703('0x1e'),members[_0x534a2c['device']]?members[_0x534a2c['device']][_0xc703('0x7')]:_0x534a2c[_0xc703('0x1d')],_0x534a2c[_0xc703('0x1f')],_0x534a2c['device']));switch(_0x534a2c[_0xc703('0x1f')]){case _0xc703('0x20'):case _0xc703('0x21'):if(!startsWith(exclude,_0x534a2c[_0xc703('0x1d')])){members[_0x534a2c[_0xc703('0x1d')]]={'channel':'voice','interface':_0x534a2c[_0xc703('0x1d')],'type':_0xc703('0x22'),'enterAt':utils[_0xc703('0x23')](),'role':_0xc703('0x24')};}break;case _0xc703('0x25'):if(!_[_0xc703('0x26')](members[_0x534a2c['device']])){members[_0x534a2c[_0xc703('0x1d')]]['exitAt']=utils[_0xc703('0x23')]();members[_0x534a2c[_0xc703('0x1d')]][_0xc703('0x27')]=utils['diffTime'](members[_0x534a2c['device']]['exitAt'],members[_0x534a2c[_0xc703('0x1d')]][_0xc703('0x28')]);if(members[_0x534a2c['device']][_0xc703('0x7')]){writeDB(members[_0x534a2c[_0xc703('0x1d')]]);}}break;default:break;}}catch(_0xc49af1){utils[_0xc703('0x16')](util[_0xc703('0x5')](_0xc703('0x1c'),members[_0x534a2c[_0xc703('0x1d')]]?members[_0x534a2c[_0xc703('0x1d')]]['uniqueid']:_0x534a2c[_0xc703('0x1d')]),_0xc49af1);}};exports[_0xc703('0x29')]=function(_0x27ddd5){try{if(!_['isNil'](members[_0x27ddd5[_0xc703('0x8')]])){utils[_0xc703('0x1b')](util[_0xc703('0x5')](_0xc703('0x2a'),_0x27ddd5[_0xc703('0x7')]),_0x27ddd5);utils[_0xc703('0x2b')](util[_0xc703('0x5')](_0xc703('0x2c'),_0x27ddd5['uniqueid'],_0x27ddd5[_0xc703('0x8')],_0x27ddd5[_0xc703('0x2d')]));members[_0x27ddd5[_0xc703('0x8')]]=_[_0xc703('0x2e')](members[_0x27ddd5[_0xc703('0x8')]],{'data4':_0x27ddd5[_0xc703('0x2d')],'uniqueid':_0x27ddd5[_0xc703('0x7')]});}}catch(_0xc75bbe){utils[_0xc703('0x16')](util[_0xc703('0x5')]('[%s][members][agentcomplete]',_0x27ddd5[_0xc703('0x7')]),_0xc75bbe);}};exports['cdr']=function(_0xd97e5c){try{utils['debug'](util[_0xc703('0x5')](_0xc703('0x2f'),_0xd97e5c[_0xc703('0x7')]),_0xd97e5c);if(_0xd97e5c[_0xc703('0x9')]){var _0x5a2965=_0xd97e5c[_0xc703('0x9')][_0xc703('0x13')]('-')[0x0];if(!_[_0xc703('0x26')](members[_0x5a2965])){members[_0x5a2965]=_[_0xc703('0x2e')](members[_0x5a2965],{'data1':members[_0x5a2965][_0xc703('0x30')]||_0xd97e5c['type'],'data2':members[_0x5a2965][_0xc703('0xa')]||_0xd97e5c[_0xc703('0x31')],'data3':members[_0x5a2965][_0xc703('0x32')]||_0xd97e5c[_0xc703('0x33')],'uniqueid':members[_0x5a2965][_0xc703('0x7')]||_0xd97e5c[_0xc703('0x7')]});utils[_0xc703('0x2b')](util[_0xc703('0x5')](_0xc703('0x34'),_0xd97e5c[_0xc703('0x7')],members[_0x5a2965][_0xc703('0x30')],members[_0x5a2965][_0xc703('0xa')],members[_0x5a2965][_0xc703('0x32')]));if(members[_0x5a2965]['exitAt']){writeDB(members[_0x5a2965]);}}}if(_0xd97e5c[_0xc703('0x35')]){var _0x4ecf03=_0xd97e5c[_0xc703('0x35')]['split']('-')[0x0];if(!_[_0xc703('0x26')](members[_0x4ecf03])){members[_0x4ecf03]=_[_0xc703('0x2e')](members[_0x4ecf03],{'data1':members[_0x4ecf03][_0xc703('0x30')]||_0xd97e5c[_0xc703('0xc')],'data2':members[_0x4ecf03][_0xc703('0xa')]||_0xd97e5c['source'],'data3':members[_0x4ecf03][_0xc703('0x32')]||_0xd97e5c[_0xc703('0x33')],'uniqueid':members[_0x4ecf03][_0xc703('0x7')]||_0xd97e5c[_0xc703('0x7')]});utils[_0xc703('0x2b')](util[_0xc703('0x5')](_0xc703('0x34'),_0xd97e5c[_0xc703('0x7')],members[_0x4ecf03][_0xc703('0x30')],members[_0x4ecf03][_0xc703('0xa')],members[_0x4ecf03][_0xc703('0x32')]));if(members[_0x4ecf03][_0xc703('0x36')]){writeDB(members[_0x4ecf03]);}}}}catch(_0x53a579){utils['error'](util[_0xc703('0x5')](_0xc703('0x2f'),_0xd97e5c['uniqueid']),_0x53a579);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 319f2fe..0ec7690 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 _0xa35e=['[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','varset'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa35e,0x111));var _0xea35=function(_0x5cdb4a,_0x39e8ee){_0x5cdb4a=_0x5cdb4a-0x0;var _0x3b0044=_0xa35e[_0x5cdb4a];return _0x3b0044;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var utils=require(_0xea35('0x1'));var queues={};function writeDB(_0x14d650){utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x4'),_0x14d650[_0xea35('0x5')],_0x14d650[_0xea35('0x6')],_0x14d650[_0xea35('0x7')],_0x14d650[_0xea35('0x8')],_0x14d650[_0xea35('0x9')],_0x14d650[_0xea35('0xa')],_0x14d650[_0xea35('0xb')]));if(_0x14d650[_0xea35('0x7')]){utils[_0xea35('0xc')](_0x14d650['queue'])[_0xea35('0xd')](function(_0x1fee2a){if(_0x1fee2a){_0x14d650[_0xea35('0xe')]=_0x1fee2a['type'];}utils[_0xea35('0xf')](_0xea35('0x10'),_0x14d650);});}else{utils[_0xea35('0xf')]('CreateVoiceQueueReport',_0x14d650);}if(_0x14d650[_0xea35('0x11')]){delete queues[_0x14d650[_0xea35('0x11')]];}else{delete queues[_0x14d650[_0xea35('0x5')]];}}exports[_0xea35('0x12')]=function(_0x2335a2){try{utils['debug'](util[_0xea35('0x3')](_0xea35('0x13'),_0x2335a2[_0xea35('0x5')]),_0x2335a2);utils['info'](util['format'](_0xea35('0x14'),_0x2335a2[_0xea35('0x5')],_0x2335a2[_0xea35('0x7')],_0x2335a2[_0xea35('0x15')]));queues[_0x2335a2['uniqueid']]=_[_0xea35('0x16')](_0x2335a2,{'originalposition':_0x2335a2['position'],'queuecallerjoinAt':utils[_0xea35('0x17')](),'mohtime':0x0});}catch(_0x3e7a79){utils['error'](util[_0xea35('0x3')](_0xea35('0x13'),_0x2335a2[_0xea35('0x5')]),_0x3e7a79);}};exports[_0xea35('0x18')]=function(_0x23b2fc){try{if(!_[_0xea35('0x19')](queues[_0x23b2fc[_0xea35('0x5')]])){utils[_0xea35('0x1a')](util[_0xea35('0x3')](_0xea35('0x1b'),_0x23b2fc['uniqueid']),_0x23b2fc);if(queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x1c')]){if(!queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x1d')]&&!queues[_0x23b2fc[_0xea35('0x5')]]['queuecallerexit']){queues[_0x23b2fc[_0xea35('0x5')]]['queuecallercomplete']=!![];queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x1e')]=utils['now']();queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0xb')]='COMPLETEDBYAGENT';}utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x1f'),_0x23b2fc[_0xea35('0x5')],queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x20')],queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0xb')]));writeDB(queues[_0x23b2fc[_0xea35('0x5')]]);}else if(queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x11')]){utils[_0xea35('0x2')](util[_0xea35('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x23b2fc['uniqueid'],queues[_0x23b2fc['uniqueid']][_0xea35('0x20')],queues[_0x23b2fc['uniqueid']]['transfereduniqueid']));queues[queues[_0x23b2fc[_0xea35('0x5')]]['transfereduniqueid']]=queues[_0x23b2fc[_0xea35('0x5')]];queues[queues[_0x23b2fc[_0xea35('0x5')]][_0xea35('0x11')]][_0xea35('0x21')]=0x2;delete queues[_0x23b2fc['uniqueid']];}}}catch(_0x21406c){utils[_0xea35('0x22')](util[_0xea35('0x3')](_0xea35('0x1b'),_0x23b2fc['uniqueid']),_0x21406c);}};exports[_0xea35('0x23')]=function(_0x5d8111){try{utils[_0xea35('0x1a')](util[_0xea35('0x3')](_0xea35('0x24'),_0x5d8111[_0xea35('0x5')]),_0x5d8111);if(!_[_0xea35('0x19')](_0x5d8111[_0xea35('0x25')][_0xea35('0x26')])&&_0x5d8111[_0xea35('0x27')]['toUpperCase']()!==_0xea35('0x28')){if(!_[_0xea35('0x19')](queues[_0x5d8111['uniqueid']])){queues[_0x5d8111[_0xea35('0x5')]]['queuecallerabandon']=![];queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x29')]=null;queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x2a')]=!![];queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x2b')]=utils[_0xea35('0x17')]();queues[_0x5d8111['uniqueid']]['queuecallerexitreason']=_0x5d8111[_0xea35('0x27')][_0xea35('0x2c')]();utils['info'](util[_0xea35('0x3')](_0xea35('0x2d'),_0x5d8111['uniqueid'],queues[_0x5d8111[_0xea35('0x5')]]['name'],_0x5d8111[_0xea35('0x27')],queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0xb')]));writeDB(queues[_0x5d8111[_0xea35('0x5')]]);}}else if(!_[_0xea35('0x19')](_0x5d8111[_0xea35('0x25')][_0xea35('0x2e')])){if(!_[_0xea35('0x19')](queues[_0x5d8111[_0xea35('0x5')]])&&!queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x1d')]){queues[_0x5d8111['uniqueid']]['queuecallerabandon']=![];queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x29')]=null;queues[_0x5d8111['uniqueid']]['queuecallerexit']=!![];queues[_0x5d8111[_0xea35('0x5')]][_0xea35('0x2b')]=utils[_0xea35('0x17')]();queues[_0x5d8111['uniqueid']][_0xea35('0xb')]='EXITWITHKEY';utils['info'](util[_0xea35('0x3')](_0xea35('0x2f'),_0x5d8111[_0xea35('0x5')],queues[_0x5d8111['uniqueid']]['name'],_0x5d8111[_0xea35('0x27')],queues[_0x5d8111[_0xea35('0x5')]]['queuecallerexitreason']));}}}catch(_0x366591){utils[_0xea35('0x22')](util[_0xea35('0x3')](_0xea35('0x24'),_0x5d8111[_0xea35('0x5')]),_0x366591);}};exports[_0xea35('0x1d')]=function(_0x5c14d1){try{if(!_[_0xea35('0x19')](queues[_0x5c14d1[_0xea35('0x5')]])){utils['debug'](util[_0xea35('0x3')](_0xea35('0x30'),_0x5c14d1[_0xea35('0x5')]),_0x5c14d1);queues[_0x5c14d1[_0xea35('0x5')]][_0xea35('0x2a')]=![];queues[_0x5c14d1[_0xea35('0x5')]][_0xea35('0x2b')]=null;queues[_0x5c14d1['uniqueid']][_0xea35('0x1d')]=!![];queues[_0x5c14d1['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x5c14d1[_0xea35('0x5')]][_0xea35('0xb')]=_0xea35('0x31');utils[_0xea35('0x2')](util[_0xea35('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5c14d1[_0xea35('0x5')],queues[_0x5c14d1[_0xea35('0x5')]][_0xea35('0x20')],queues[_0x5c14d1[_0xea35('0x5')]]['queuecallerexitreason']));}}catch(_0x37cdca){utils[_0xea35('0x22')](util[_0xea35('0x3')]('[%s][queues][queuecallerabandon]',_0x5c14d1[_0xea35('0x5')]),_0x37cdca);}};exports[_0xea35('0x32')]=function(_0x22bc38){try{if(!_[_0xea35('0x19')](queues[_0x22bc38['uniqueid']])){utils['debug'](util[_0xea35('0x3')]('[%s][queues][queuecallerleave]',_0x22bc38['uniqueid']),_0x22bc38);utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x33'),_0x22bc38[_0xea35('0x5')],queues[_0x22bc38[_0xea35('0x5')]]['name'],_0x22bc38[_0xea35('0x34')],_0x22bc38[_0xea35('0x35')]));queues[_0x22bc38[_0xea35('0x5')]][_0xea35('0x32')]=!![];queues[_0x22bc38[_0xea35('0x5')]]['queuecallerleaveAt']=utils[_0xea35('0x17')]();queues[_0x22bc38[_0xea35('0x5')]]['holdtime']=utils[_0xea35('0x36')](queues[_0x22bc38[_0xea35('0x5')]][_0xea35('0x1c')],queues[_0x22bc38[_0xea35('0x5')]]['queuecallerjoinAt']);queues[_0x22bc38[_0xea35('0x5')]]['position']=_0x22bc38[_0xea35('0x15')];queues[_0x22bc38['uniqueid']][_0xea35('0x37')]=_0x22bc38[_0xea35('0x37')];queues[_0x22bc38[_0xea35('0x5')]][_0xea35('0x34')]=_0x22bc38[_0xea35('0x34')];queues[_0x22bc38[_0xea35('0x5')]]['connectedlinename']=_0x22bc38[_0xea35('0x35')];}}catch(_0x525fd4){utils['error'](util[_0xea35('0x3')](_0xea35('0x38'),_0x22bc38[_0xea35('0x5')]),_0x525fd4);}};exports[_0xea35('0x39')]=function(_0xe04290){try{if(!_[_0xea35('0x19')](queues[_0xe04290[_0xea35('0x5')]])){utils['debug'](util[_0xea35('0x3')](_0xea35('0x3a'),_0xe04290[_0xea35('0x5')]),_0xe04290);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xe04290[_0xea35('0x5')],queues[_0xe04290[_0xea35('0x5')]][_0xea35('0x20')],_0xe04290[_0xea35('0x3b')],_0xe04290[_0xea35('0x3c')]));queues[_0xe04290[_0xea35('0x5')]]['queuecallerabandon']=![];queues[_0xe04290[_0xea35('0x5')]][_0xea35('0x1d')]=![];queues[_0xe04290[_0xea35('0x5')]][_0xea35('0x29')]=null;queues[_0xe04290[_0xea35('0x5')]]['queuecallerexit']=![];queues[_0xe04290[_0xea35('0x5')]][_0xea35('0xb')]=null;queues[_0xe04290[_0xea35('0x5')]][_0xea35('0x2b')]=null;queues[_0xe04290['uniqueid']][_0xea35('0x3d')]=!![];queues[_0xe04290[_0xea35('0x5')]][_0xea35('0xa')]=_0xe04290['destaccountcode'];queues[_0xe04290[_0xea35('0x5')]]['lastAssignedTo']=_0xe04290[_0xea35('0x3b')];}}catch(_0x7dfb11){utils[_0xea35('0x22')](util[_0xea35('0x3')](_0xea35('0x3a'),_0xe04290[_0xea35('0x5')]),_0x7dfb11);}};exports[_0xea35('0x3e')]=function(_0x2f4412){try{if(!_[_0xea35('0x19')](queues[_0x2f4412[_0xea35('0x5')]])){if(queues[_0x2f4412[_0xea35('0x5')]]['queuecallerleaveAt']){utils[_0xea35('0x1a')](util['format'](_0xea35('0x3f'),_0x2f4412[_0xea35('0x5')]),_0x2f4412);queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x1d')]=![];queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x1d')]=![];queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x29')]=null;queues[_0x2f4412['uniqueid']][_0xea35('0x2a')]=![];queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x2b')]=null;queues[_0x2f4412['uniqueid']]['assigned']=!![];queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x8')]=_0x2f4412[_0xea35('0x3b')];queues[_0x2f4412[_0xea35('0x5')]]['queuecallercomplete']=!![];queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x1e')]=utils[_0xea35('0x17')]();if(_0x2f4412['reason']==_0xea35('0x40')){if(!queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0x40')]){queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0xb')]='TRANSFER';}}else{queues[_0x2f4412[_0xea35('0x5')]][_0xea35('0xb')]=_0xea35('0x41')+_0x2f4412['reason'][_0xea35('0x2c')]();}utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x42'),_0x2f4412['uniqueid'],queues[_0x2f4412['uniqueid']][_0xea35('0x20')],_0x2f4412[_0xea35('0x3b')],queues[_0x2f4412['uniqueid']][_0xea35('0xb')]));writeDB(queues[_0x2f4412[_0xea35('0x5')]]);}}}catch(_0x13f601){utils[_0xea35('0x22')](util[_0xea35('0x3')]('[%s][queues][agentcomplete]',_0x2f4412[_0xea35('0x5')]),_0x13f601);}};exports['blindtransfer']=function(_0x26e974){try{if(!_['isNil'](queues[_0x26e974['transfereeuniqueid']])){utils['debug'](util['format'](_0xea35('0x43'),_0x26e974[_0xea35('0x5')]),_0x26e974);queues[_0x26e974[_0xea35('0x44')]][_0xea35('0x40')]=!![];queues[_0x26e974[_0xea35('0x44')]][_0xea35('0x45')]=_0xea35('0x46');queues[_0x26e974[_0xea35('0x44')]][_0xea35('0x47')]=_0x26e974['extension'];queues[_0x26e974[_0xea35('0x44')]][_0xea35('0x48')]=_0x26e974[_0xea35('0x44')];queues[_0x26e974[_0xea35('0x44')]][_0xea35('0xb')]=_0xea35('0x49');utils[_0xea35('0x2')](util['format'](_0xea35('0x4a'),_0x26e974[_0xea35('0x5')],queues[_0x26e974[_0xea35('0x44')]]['name'],_0x26e974[_0xea35('0x44')],_0x26e974[_0xea35('0x4b')]));}}catch(_0x5cdca5){utils[_0xea35('0x22')](util['format'](_0xea35('0x43'),_0x26e974[_0xea35('0x5')]),_0x5cdca5);}};exports[_0xea35('0x4c')]=function(_0x47b208){try{utils['debug'](util[_0xea35('0x3')]('[%s][queues][attendedtransfer]',_0x47b208['origtransfereruniqueid']),_0x47b208);if(_0x47b208[_0xea35('0x4d')]==_0x47b208[_0xea35('0x4e')]){if(!_[_0xea35('0x19')](queues[_0x47b208[_0xea35('0x4f')]])){utils['info'](util[_0xea35('0x3')](_0xea35('0x50'),_0x47b208['origtransfereruniqueid'],queues[_0x47b208['secondtransfererlinkedid']][_0xea35('0x20')],_0x47b208[_0xea35('0x51')]));queues[_0x47b208[_0xea35('0x4f')]]['transfer']=!![];queues[_0x47b208['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x47b208[_0xea35('0x4f')]]['transferexten']=_0x47b208[_0xea35('0x51')];queues[_0x47b208[_0xea35('0x4f')]][_0xea35('0x48')]=_0x47b208[_0xea35('0x4d')];queues[_0x47b208[_0xea35('0x4f')]][_0xea35('0xb')]='ATTENDEDTRANSFER';}if(!_[_0xea35('0x19')](queues[_0x47b208[_0xea35('0x4e')]])){if(_0x47b208['transfereelinkedid']&&queues[_0x47b208[_0xea35('0x52')]]){queues[_0x47b208[_0xea35('0x52')]][_0xea35('0x21')]=0x1;queues[_0x47b208[_0xea35('0x44')]]=_[_0xea35('0x53')](queues[_0x47b208[_0xea35('0x52')]]);queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x11')]=_0x47b208[_0xea35('0x54')];queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x21')]=0x2;queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x9')]=queues[_0x47b208[_0xea35('0x4f')]]['calleridnum'];queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x55')]=queues[_0x47b208['secondtransfererlinkedid']][_0xea35('0x55')];queues[_0x47b208['transfereeuniqueid']][_0xea35('0x56')]=utils[_0xea35('0x17')]();queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x1c')]=utils[_0xea35('0x17')]();queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x57')]=0x0;queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x58')]=0x0;utils[_0xea35('0x2')](util[_0xea35('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x47b208[_0xea35('0x4d')],queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x20')],queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x9')],queues[_0x47b208[_0xea35('0x44')]][_0xea35('0x55')]));}else{utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x59'),_0x47b208[_0xea35('0x4d')],queues[_0x47b208[_0xea35('0x4e')]][_0xea35('0x20')],_0x47b208[_0xea35('0x4f')]));queues[_0x47b208[_0xea35('0x4e')]][_0xea35('0x11')]=_0x47b208[_0xea35('0x4f')];}}}else if(_0x47b208[_0xea35('0x5a')]==_0x47b208[_0xea35('0x4f')]){if(!_[_0xea35('0x19')](queues[_0x47b208[_0xea35('0x4e')]])){utils[_0xea35('0x2')](util[_0xea35('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47b208[_0xea35('0x4d')],queues[_0x47b208['origtransfererlinkedid']]['name'],_0x47b208[_0xea35('0x5a')],_0x47b208[_0xea35('0x5b')]));queues[_0x47b208['origtransfererlinkedid']][_0xea35('0x40')]=!![];queues[_0x47b208[_0xea35('0x4e')]][_0xea35('0x45')]=_0xea35('0x5c');queues[_0x47b208['origtransfererlinkedid']][_0xea35('0x47')]=_0x47b208['secondtransfererexten'];queues[_0x47b208['origtransfererlinkedid']][_0xea35('0x48')]=_0x47b208[_0xea35('0x5a')];queues[_0x47b208['origtransfererlinkedid']]['queuecallerexitreason']=_0xea35('0x5d');}if(!_[_0xea35('0x19')](queues[_0x47b208['secondtransfererlinkedid']])){if(_0x47b208[_0xea35('0x5e')]&&queues[_0x47b208[_0xea35('0x5e')]]){queues[_0x47b208[_0xea35('0x5e')]][_0xea35('0x21')]=0x1;queues[_0x47b208[_0xea35('0x54')]]=_[_0xea35('0x53')](queues[_0x47b208[_0xea35('0x5e')]]);queues[_0x47b208[_0xea35('0x54')]]['transfereduniqueid']=_0x47b208[_0xea35('0x54')];queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x21')]=0x2;queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x9')]=queues[_0x47b208[_0xea35('0x4e')]][_0xea35('0x9')];queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x55')]=queues[_0x47b208[_0xea35('0x4e')]][_0xea35('0x55')];queues[_0x47b208['transfertargetuniqueid']][_0xea35('0x56')]=utils['now']();queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x1c')]=utils[_0xea35('0x17')]();queues[_0x47b208['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x58')]=0x0;utils['info'](util[_0xea35('0x3')](_0xea35('0x5f'),_0x47b208['origtransfereruniqueid'],queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x20')],queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x11')],queues[_0x47b208[_0xea35('0x54')]][_0xea35('0x9')],queues[_0x47b208['transfertargetuniqueid']]['calleridname']));}else{utils[_0xea35('0x2')](util[_0xea35('0x3')](_0xea35('0x59'),_0x47b208[_0xea35('0x4d')],queues[_0x47b208[_0xea35('0x4f')]][_0xea35('0x20')],_0x47b208[_0xea35('0x4e')]));queues[_0x47b208[_0xea35('0x4f')]][_0xea35('0x11')]=_0x47b208[_0xea35('0x4e')];}}}}catch(_0x46b2ed){utils['error'](util[_0xea35('0x3')](_0xea35('0x60'),_0x47b208['origtransfereruniqueid']),_0x46b2ed);}};exports['musiconholdstart']=function(_0x24ae5b){try{if(!_[_0xea35('0x19')](queues[_0x24ae5b['uniqueid']])){utils[_0xea35('0x1a')](util[_0xea35('0x3')](_0xea35('0x61'),_0x24ae5b[_0xea35('0x5')]),_0x24ae5b);queues[_0x24ae5b[_0xea35('0x5')]][_0xea35('0x62')]=utils[_0xea35('0x17')]();utils[_0xea35('0x2')](util['format'](_0xea35('0x63'),_0x24ae5b['uniqueid'],queues[_0x24ae5b[_0xea35('0x5')]][_0xea35('0x20')],queues[_0x24ae5b[_0xea35('0x5')]][_0xea35('0x62')]));}}catch(_0x5eab25){utils[_0xea35('0x22')](util[_0xea35('0x3')](_0xea35('0x61'),_0x24ae5b[_0xea35('0x5')]),_0x5eab25);}};exports[_0xea35('0x64')]=function(_0x3b2871){try{if(!_[_0xea35('0x19')](queues[_0x3b2871[_0xea35('0x5')]])){if(!_[_0xea35('0x19')](queues[_0x3b2871[_0xea35('0x5')]]['musiconholdstartAt'])){utils['debug'](util[_0xea35('0x3')](_0xea35('0x65'),_0x3b2871['uniqueid']),_0x3b2871);queues[_0x3b2871[_0xea35('0x5')]][_0xea35('0x58')]+=utils['diffTime'](utils[_0xea35('0x17')](),queues[_0x3b2871[_0xea35('0x5')]][_0xea35('0x62')]);utils[_0xea35('0x2')](util['format'](_0xea35('0x66'),_0x3b2871['uniqueid'],queues[_0x3b2871[_0xea35('0x5')]][_0xea35('0x20')],queues[_0x3b2871[_0xea35('0x5')]][_0xea35('0x58')]));delete queues[_0x3b2871[_0xea35('0x5')]]['musiconholdstartAt'];}}}catch(_0x46cf5b){utils['error'](util['format'](_0xea35('0x65'),_0x3b2871[_0xea35('0x5')]),_0x46cf5b);}}; \ No newline at end of file +var _0x7af9=['count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','membername','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime'];(function(_0x46eb40,_0x2adcfa){var _0x1777f2=function(_0x290019){while(--_0x290019){_0x46eb40['push'](_0x46eb40['shift']());}};_0x1777f2(++_0x2adcfa);}(_0x7af9,0x95));var _0x97af=function(_0x40b9ad,_0x30936d){_0x40b9ad=_0x40b9ad-0x0;var _0x3d1a9d=_0x7af9[_0x40b9ad];return _0x3d1a9d;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var utils=require(_0x97af('0x1'));var queues={};function writeDB(_0x1a2f31){utils['info'](util[_0x97af('0x2')](_0x97af('0x3'),_0x1a2f31[_0x97af('0x4')],_0x1a2f31[_0x97af('0x5')],_0x1a2f31[_0x97af('0x6')],_0x1a2f31['lastAssignedTo'],_0x1a2f31['calleridnum'],_0x1a2f31['accountcode'],_0x1a2f31[_0x97af('0x7')]));if(_0x1a2f31[_0x97af('0x6')]){utils[_0x97af('0x8')](_0x1a2f31[_0x97af('0x6')])['then'](function(_0x2c2ee4){if(_0x2c2ee4){_0x1a2f31[_0x97af('0x9')]=_0x2c2ee4[_0x97af('0x9')];}utils['request'](_0x97af('0xa'),_0x1a2f31);});}else{utils['request'](_0x97af('0xa'),_0x1a2f31);}if(_0x1a2f31[_0x97af('0xb')]){delete queues[_0x1a2f31[_0x97af('0xb')]];}else{delete queues[_0x1a2f31[_0x97af('0x4')]];}}exports[_0x97af('0xc')]=function(_0x3cc156){try{utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0xe'),_0x3cc156[_0x97af('0x4')]),_0x3cc156);utils[_0x97af('0xf')](util['format'](_0x97af('0x10'),_0x3cc156['uniqueid'],_0x3cc156['queue'],_0x3cc156[_0x97af('0x11')]));queues[_0x3cc156[_0x97af('0x4')]]=_[_0x97af('0x12')](_0x3cc156,{'originalposition':_0x3cc156[_0x97af('0x11')],'queuecallerjoinAt':utils[_0x97af('0x13')](),'mohtime':0x0});}catch(_0x256fac){utils[_0x97af('0x14')](util['format'](_0x97af('0xe'),_0x3cc156['uniqueid']),_0x256fac);}};exports[_0x97af('0x15')]=function(_0x58d967){try{if(!_[_0x97af('0x16')](queues[_0x58d967['uniqueid']])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x17'),_0x58d967[_0x97af('0x4')]),_0x58d967);if(queues[_0x58d967[_0x97af('0x4')]]['queuecallerleaveAt']){if(!queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x18')]&&!queues[_0x58d967['uniqueid']]['queuecallerexit']){queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x19')]=!![];queues[_0x58d967['uniqueid']][_0x97af('0x1a')]=utils['now']();queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x7')]=_0x97af('0x1b');}utils[_0x97af('0xf')](util[_0x97af('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x58d967[_0x97af('0x4')],queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x1c')],queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x7')]));writeDB(queues[_0x58d967[_0x97af('0x4')]]);}else if(queues[_0x58d967[_0x97af('0x4')]][_0x97af('0xb')]){utils['info'](util[_0x97af('0x2')](_0x97af('0x1d'),_0x58d967[_0x97af('0x4')],queues[_0x58d967[_0x97af('0x4')]][_0x97af('0x1c')],queues[_0x58d967[_0x97af('0x4')]]['transfereduniqueid']));queues[queues[_0x58d967[_0x97af('0x4')]][_0x97af('0xb')]]=queues[_0x58d967[_0x97af('0x4')]];queues[queues[_0x58d967[_0x97af('0x4')]][_0x97af('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x58d967[_0x97af('0x4')]];}}}catch(_0x46f503){utils['error'](util[_0x97af('0x2')](_0x97af('0x17'),_0x58d967[_0x97af('0x4')]),_0x46f503);}};exports[_0x97af('0x1e')]=function(_0x316b68){try{utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x1f'),_0x316b68[_0x97af('0x4')]),_0x316b68);if(!_[_0x97af('0x16')](_0x316b68['variable'][_0x97af('0x20')])&&_0x316b68['value'][_0x97af('0x21')]()!==_0x97af('0x22')){if(!_[_0x97af('0x16')](queues[_0x316b68[_0x97af('0x4')]])){queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x18')]=![];queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x23')]=null;queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x24')]=!![];queues[_0x316b68['uniqueid']][_0x97af('0x25')]=utils[_0x97af('0x13')]();queues[_0x316b68['uniqueid']][_0x97af('0x7')]=_0x316b68['value'][_0x97af('0x21')]();utils['info'](util['format'](_0x97af('0x26'),_0x316b68[_0x97af('0x4')],queues[_0x316b68[_0x97af('0x4')]]['name'],_0x316b68[_0x97af('0x27')],queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x7')]));writeDB(queues[_0x316b68[_0x97af('0x4')]]);}}else if(!_[_0x97af('0x16')](_0x316b68['variable'][_0x97af('0x28')])){if(!_[_0x97af('0x16')](queues[_0x316b68[_0x97af('0x4')]])&&!queues[_0x316b68[_0x97af('0x4')]]['queuecallerabandon']){queues[_0x316b68['uniqueid']]['queuecallerabandon']=![];queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x23')]=null;queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x24')]=!![];queues[_0x316b68['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x7')]=_0x97af('0x29');utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x2a'),_0x316b68['uniqueid'],queues[_0x316b68[_0x97af('0x4')]]['name'],_0x316b68['value'],queues[_0x316b68[_0x97af('0x4')]][_0x97af('0x7')]));}}}catch(_0x31796d){utils[_0x97af('0x14')](util['format'](_0x97af('0x1f'),_0x316b68[_0x97af('0x4')]),_0x31796d);}};exports[_0x97af('0x18')]=function(_0x466e59){try{if(!_[_0x97af('0x16')](queues[_0x466e59[_0x97af('0x4')]])){utils[_0x97af('0xd')](util[_0x97af('0x2')]('[%s][queues][queuecallerabandon]',_0x466e59[_0x97af('0x4')]),_0x466e59);queues[_0x466e59[_0x97af('0x4')]]['queuecallerexit']=![];queues[_0x466e59['uniqueid']][_0x97af('0x25')]=null;queues[_0x466e59[_0x97af('0x4')]][_0x97af('0x18')]=!![];queues[_0x466e59[_0x97af('0x4')]][_0x97af('0x23')]=utils[_0x97af('0x13')]();queues[_0x466e59[_0x97af('0x4')]][_0x97af('0x7')]=_0x97af('0x2b');utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x2c'),_0x466e59[_0x97af('0x4')],queues[_0x466e59[_0x97af('0x4')]][_0x97af('0x1c')],queues[_0x466e59[_0x97af('0x4')]][_0x97af('0x7')]));}}catch(_0x323daf){utils[_0x97af('0x14')](util[_0x97af('0x2')]('[%s][queues][queuecallerabandon]',_0x466e59[_0x97af('0x4')]),_0x323daf);}};exports[_0x97af('0x2d')]=function(_0x2e4bf5){try{if(!_[_0x97af('0x16')](queues[_0x2e4bf5[_0x97af('0x4')]])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x2e'),_0x2e4bf5[_0x97af('0x4')]),_0x2e4bf5);utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x2f'),_0x2e4bf5[_0x97af('0x4')],queues[_0x2e4bf5[_0x97af('0x4')]][_0x97af('0x1c')],_0x2e4bf5[_0x97af('0x30')],_0x2e4bf5[_0x97af('0x31')]));queues[_0x2e4bf5[_0x97af('0x4')]][_0x97af('0x2d')]=!![];queues[_0x2e4bf5['uniqueid']][_0x97af('0x32')]=utils[_0x97af('0x13')]();queues[_0x2e4bf5['uniqueid']][_0x97af('0x33')]=utils[_0x97af('0x34')](queues[_0x2e4bf5['uniqueid']][_0x97af('0x32')],queues[_0x2e4bf5[_0x97af('0x4')]]['queuecallerjoinAt']);queues[_0x2e4bf5[_0x97af('0x4')]][_0x97af('0x11')]=_0x2e4bf5['position'];queues[_0x2e4bf5['uniqueid']][_0x97af('0x35')]=_0x2e4bf5['count'];queues[_0x2e4bf5[_0x97af('0x4')]]['connectedlinenum']=_0x2e4bf5['connectedlinenum'];queues[_0x2e4bf5['uniqueid']][_0x97af('0x31')]=_0x2e4bf5[_0x97af('0x31')];}}catch(_0x5077c8){utils['error'](util[_0x97af('0x2')]('[%s][queues][queuecallerleave]',_0x2e4bf5[_0x97af('0x4')]),_0x5077c8);}};exports['agentconnect']=function(_0x2a5c42){try{if(!_[_0x97af('0x16')](queues[_0x2a5c42[_0x97af('0x4')]])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x36'),_0x2a5c42['uniqueid']),_0x2a5c42);utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x37'),_0x2a5c42['uniqueid'],queues[_0x2a5c42['uniqueid']][_0x97af('0x1c')],_0x2a5c42['membername'],_0x2a5c42[_0x97af('0x38')]));queues[_0x2a5c42[_0x97af('0x4')]][_0x97af('0x18')]=![];queues[_0x2a5c42['uniqueid']][_0x97af('0x18')]=![];queues[_0x2a5c42[_0x97af('0x4')]][_0x97af('0x23')]=null;queues[_0x2a5c42[_0x97af('0x4')]]['queuecallerexit']=![];queues[_0x2a5c42['uniqueid']]['queuecallerexitreason']=null;queues[_0x2a5c42[_0x97af('0x4')]][_0x97af('0x25')]=null;queues[_0x2a5c42['uniqueid']][_0x97af('0x39')]=!![];queues[_0x2a5c42[_0x97af('0x4')]][_0x97af('0x3a')]=_0x2a5c42[_0x97af('0x38')];queues[_0x2a5c42[_0x97af('0x4')]]['lastAssignedTo']=_0x2a5c42['membername'];}}catch(_0x27f60f){utils[_0x97af('0x14')](util[_0x97af('0x2')](_0x97af('0x36'),_0x2a5c42[_0x97af('0x4')]),_0x27f60f);}};exports[_0x97af('0x3b')]=function(_0x3db04a){try{if(!_[_0x97af('0x16')](queues[_0x3db04a[_0x97af('0x4')]])){if(queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x32')]){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x3c'),_0x3db04a[_0x97af('0x4')]),_0x3db04a);queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x18')]=![];queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x18')]=![];queues[_0x3db04a['uniqueid']][_0x97af('0x23')]=null;queues[_0x3db04a['uniqueid']][_0x97af('0x24')]=![];queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x25')]=null;queues[_0x3db04a['uniqueid']]['assigned']=!![];queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x3d')]=_0x3db04a[_0x97af('0x3e')];queues[_0x3db04a['uniqueid']][_0x97af('0x19')]=!![];queues[_0x3db04a[_0x97af('0x4')]]['queuecallercompleteAt']=utils[_0x97af('0x13')]();if(_0x3db04a['reason']==_0x97af('0x3f')){if(!queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x3f')]){queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x7')]='TRANSFER';}}else{queues[_0x3db04a[_0x97af('0x4')]][_0x97af('0x7')]=_0x97af('0x40')+_0x3db04a['reason']['toUpperCase']();}utils[_0x97af('0xf')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3db04a['uniqueid'],queues[_0x3db04a['uniqueid']][_0x97af('0x1c')],_0x3db04a['membername'],queues[_0x3db04a['uniqueid']][_0x97af('0x7')]));writeDB(queues[_0x3db04a['uniqueid']]);}}}catch(_0x43bf40){utils[_0x97af('0x14')](util[_0x97af('0x2')](_0x97af('0x3c'),_0x3db04a[_0x97af('0x4')]),_0x43bf40);}};exports[_0x97af('0x41')]=function(_0x388598){try{if(!_[_0x97af('0x16')](queues[_0x388598[_0x97af('0x42')]])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x43'),_0x388598[_0x97af('0x4')]),_0x388598);queues[_0x388598[_0x97af('0x42')]][_0x97af('0x3f')]=!![];queues[_0x388598[_0x97af('0x42')]][_0x97af('0x44')]=_0x97af('0x45');queues[_0x388598[_0x97af('0x42')]][_0x97af('0x46')]=_0x388598[_0x97af('0x47')];queues[_0x388598[_0x97af('0x42')]]['transferuniqueid']=_0x388598[_0x97af('0x42')];queues[_0x388598[_0x97af('0x42')]][_0x97af('0x7')]='BLINDTRANSFER';utils[_0x97af('0xf')](util[_0x97af('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x388598[_0x97af('0x4')],queues[_0x388598[_0x97af('0x42')]][_0x97af('0x1c')],_0x388598[_0x97af('0x42')],_0x388598[_0x97af('0x47')]));}}catch(_0x1d7df8){utils['error'](util[_0x97af('0x2')](_0x97af('0x43'),_0x388598[_0x97af('0x4')]),_0x1d7df8);}};exports[_0x97af('0x48')]=function(_0x1eb4c4){try{utils[_0x97af('0xd')](util[_0x97af('0x2')]('[%s][queues][attendedtransfer]',_0x1eb4c4[_0x97af('0x49')]),_0x1eb4c4);if(_0x1eb4c4[_0x97af('0x49')]==_0x1eb4c4[_0x97af('0x4a')]){if(!_[_0x97af('0x16')](queues[_0x1eb4c4[_0x97af('0x4b')]])){utils[_0x97af('0xf')](util[_0x97af('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1eb4c4[_0x97af('0x49')],queues[_0x1eb4c4['secondtransfererlinkedid']][_0x97af('0x1c')],_0x1eb4c4['origtransfererexten']));queues[_0x1eb4c4[_0x97af('0x4b')]][_0x97af('0x3f')]=!![];queues[_0x1eb4c4[_0x97af('0x4b')]][_0x97af('0x44')]=_0x97af('0x4c');queues[_0x1eb4c4[_0x97af('0x4b')]][_0x97af('0x46')]=_0x1eb4c4[_0x97af('0x4d')];queues[_0x1eb4c4[_0x97af('0x4b')]][_0x97af('0x4e')]=_0x1eb4c4[_0x97af('0x49')];queues[_0x1eb4c4['secondtransfererlinkedid']][_0x97af('0x7')]=_0x97af('0x4f');}if(!_['isNil'](queues[_0x1eb4c4[_0x97af('0x4a')]])){if(_0x1eb4c4[_0x97af('0x50')]&&queues[_0x1eb4c4[_0x97af('0x50')]]){queues[_0x1eb4c4[_0x97af('0x50')]][_0x97af('0x51')]=0x1;queues[_0x1eb4c4[_0x97af('0x42')]]=_[_0x97af('0x52')](queues[_0x1eb4c4[_0x97af('0x50')]]);queues[_0x1eb4c4[_0x97af('0x42')]][_0x97af('0xb')]=_0x1eb4c4['transfertargetuniqueid'];queues[_0x1eb4c4[_0x97af('0x42')]]['queuecallerenterreason']=0x2;queues[_0x1eb4c4['transfereeuniqueid']][_0x97af('0x53')]=queues[_0x1eb4c4[_0x97af('0x4b')]]['calleridnum'];queues[_0x1eb4c4['transfereeuniqueid']][_0x97af('0x54')]=queues[_0x1eb4c4[_0x97af('0x4b')]][_0x97af('0x54')];queues[_0x1eb4c4['transfereeuniqueid']][_0x97af('0x55')]=utils[_0x97af('0x13')]();queues[_0x1eb4c4[_0x97af('0x42')]][_0x97af('0x32')]=utils[_0x97af('0x13')]();queues[_0x1eb4c4[_0x97af('0x42')]]['holdtime']=0x0;queues[_0x1eb4c4['transfereeuniqueid']][_0x97af('0x56')]=0x0;utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x57'),_0x1eb4c4['origtransfereruniqueid'],queues[_0x1eb4c4[_0x97af('0x42')]][_0x97af('0x1c')],queues[_0x1eb4c4['transfereeuniqueid']][_0x97af('0x53')],queues[_0x1eb4c4[_0x97af('0x42')]][_0x97af('0x54')]));}else{utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x58'),_0x1eb4c4[_0x97af('0x49')],queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0x1c')],_0x1eb4c4[_0x97af('0x4b')]));queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0xb')]=_0x1eb4c4['secondtransfererlinkedid'];}}}else if(_0x1eb4c4[_0x97af('0x59')]==_0x1eb4c4[_0x97af('0x4b')]){if(!_[_0x97af('0x16')](queues[_0x1eb4c4[_0x97af('0x4a')]])){utils['info'](util['format'](_0x97af('0x5a'),_0x1eb4c4[_0x97af('0x49')],queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0x1c')],_0x1eb4c4[_0x97af('0x59')],_0x1eb4c4[_0x97af('0x5b')]));queues[_0x1eb4c4[_0x97af('0x4a')]]['transfer']=!![];queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0x44')]=_0x97af('0x4c');queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0x46')]=_0x1eb4c4[_0x97af('0x5b')];queues[_0x1eb4c4[_0x97af('0x4a')]]['transferuniqueid']=_0x1eb4c4['secondtransfereruniqueid'];queues[_0x1eb4c4['origtransfererlinkedid']][_0x97af('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x97af('0x16')](queues[_0x1eb4c4[_0x97af('0x4b')]])){if(_0x1eb4c4[_0x97af('0x5c')]&&queues[_0x1eb4c4[_0x97af('0x5c')]]){queues[_0x1eb4c4[_0x97af('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x1eb4c4['transfertargetuniqueid']]=_[_0x97af('0x52')](queues[_0x1eb4c4[_0x97af('0x5c')]]);queues[_0x1eb4c4['transfertargetuniqueid']]['transfereduniqueid']=_0x1eb4c4[_0x97af('0x5d')];queues[_0x1eb4c4[_0x97af('0x5d')]]['queuecallerenterreason']=0x2;queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x53')]=queues[_0x1eb4c4[_0x97af('0x4a')]][_0x97af('0x53')];queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x54')]=queues[_0x1eb4c4['origtransfererlinkedid']][_0x97af('0x54')];queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x55')]=utils[_0x97af('0x13')]();queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x32')]=utils[_0x97af('0x13')]();queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x33')]=0x0;queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x56')]=0x0;utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x5e'),_0x1eb4c4[_0x97af('0x49')],queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x1c')],queues[_0x1eb4c4['transfertargetuniqueid']][_0x97af('0xb')],queues[_0x1eb4c4[_0x97af('0x5d')]]['calleridnum'],queues[_0x1eb4c4[_0x97af('0x5d')]][_0x97af('0x54')]));}else{utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x58'),_0x1eb4c4[_0x97af('0x49')],queues[_0x1eb4c4[_0x97af('0x4b')]]['name'],_0x1eb4c4[_0x97af('0x4a')]));queues[_0x1eb4c4['secondtransfererlinkedid']][_0x97af('0xb')]=_0x1eb4c4['origtransfererlinkedid'];}}}}catch(_0x306036){utils[_0x97af('0x14')](util[_0x97af('0x2')]('[%s][queues][attendedtransfer]',_0x1eb4c4[_0x97af('0x49')]),_0x306036);}};exports['musiconholdstart']=function(_0x5b9f83){try{if(!_['isNil'](queues[_0x5b9f83['uniqueid']])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x5f'),_0x5b9f83[_0x97af('0x4')]),_0x5b9f83);queues[_0x5b9f83[_0x97af('0x4')]][_0x97af('0x60')]=utils[_0x97af('0x13')]();utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x61'),_0x5b9f83[_0x97af('0x4')],queues[_0x5b9f83['uniqueid']][_0x97af('0x1c')],queues[_0x5b9f83[_0x97af('0x4')]][_0x97af('0x60')]));}}catch(_0x4b90ff){utils[_0x97af('0x14')](util['format'](_0x97af('0x5f'),_0x5b9f83[_0x97af('0x4')]),_0x4b90ff);}};exports[_0x97af('0x62')]=function(_0x33672b){try{if(!_['isNil'](queues[_0x33672b[_0x97af('0x4')]])){if(!_[_0x97af('0x16')](queues[_0x33672b['uniqueid']][_0x97af('0x60')])){utils[_0x97af('0xd')](util[_0x97af('0x2')](_0x97af('0x63'),_0x33672b['uniqueid']),_0x33672b);queues[_0x33672b[_0x97af('0x4')]][_0x97af('0x56')]+=utils['diffTime'](utils[_0x97af('0x13')](),queues[_0x33672b[_0x97af('0x4')]][_0x97af('0x60')]);utils[_0x97af('0xf')](util[_0x97af('0x2')](_0x97af('0x64'),_0x33672b['uniqueid'],queues[_0x33672b[_0x97af('0x4')]][_0x97af('0x1c')],queues[_0x33672b[_0x97af('0x4')]][_0x97af('0x56')]));delete queues[_0x33672b[_0x97af('0x4')]][_0x97af('0x60')];}}}catch(_0x5055bf){utils[_0x97af('0x14')](util[_0x97af('0x2')](_0x97af('0x63'),_0x33672b['uniqueid']),_0x5055bf);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 285869b..b43dbd9 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 _0x0621=['connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0621,0x194));var _0x1062=function(_0x45a5fa,_0x3e68ac){_0x45a5fa=_0x45a5fa-0x0;var _0x3cb9b9=_0x0621[_0x45a5fa];return _0x3cb9b9;};'use strict';var _=require('lodash');var util=require(_0x1062('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x4707a4){utils[_0x1062('0x1')](util['format'](_0x1062('0x2'),_0x4707a4[_0x1062('0x3')]));if(_0x4707a4[_0x1062('0x4')]){utils['getUserByInternal'](_0x4707a4['accountcode'])[_0x1062('0x5')](function(_0x5e3aa9){if(_0x5e3aa9){_0x4707a4[_0x1062('0x6')]=_0x5e3aa9[_0x1062('0x7')];_0x4707a4['UserId']=_0x5e3aa9['id'];}utils['request'](_0x1062('0x8'),_0x4707a4);});}else{utils[_0x1062('0x9')](_0x1062('0x8'),_0x4707a4);}}exports[_0x1062('0xa')]=function(_0x5d4459){try{utils[_0x1062('0xb')](util[_0x1062('0xc')](_0x1062('0xd'),_0x5d4459[_0x1062('0x3')]),_0x5d4459);if(_0x5d4459[_0x1062('0x3')]==_0x5d4459['linkedid']){utils[_0x1062('0x1')](util['format'](_0x1062('0xe'),_0x5d4459[_0x1062('0x3')],_0x5d4459[_0x1062('0xf')],_0x5d4459['exten']));recordings[_0x5d4459[_0x1062('0x3')]]={'uniqueid':_0x5d4459[_0x1062('0x3')],'accountcode':_0x5d4459[_0x1062('0x4')],'exten':_0x5d4459[_0x1062('0x10')],'context':_0x5d4459[_0x1062('0xf')],'channel':_0x5d4459[_0x1062('0x11')],'monitors':[]};}}catch(_0x44f4c6){utils[_0x1062('0x12')](util[_0x1062('0xc')](_0x1062('0xd'),_0x5d4459['uniqueid']),_0x44f4c6);}};exports[_0x1062('0x13')]=function(_0x5a34b3){try{utils[_0x1062('0xb')](util['format'](_0x1062('0x14'),_0x5a34b3[_0x1062('0x3')]),_0x5a34b3);if(!_[_0x1062('0x15')](recordings[_0x5a34b3[_0x1062('0x3')]])&&_0x5a34b3[_0x1062('0x16')]==0x6){utils[_0x1062('0x1')](util['format'](_0x1062('0x17'),_0x5a34b3[_0x1062('0x3')],_0x5a34b3[_0x1062('0xf')],_0x5a34b3['channel']));}else if(!_['isNil'](recordings[_0x5a34b3[_0x1062('0x18')]])&&_0x5a34b3[_0x1062('0x16')]==0x6&&_0x5a34b3[_0x1062('0xf')]!=_0x1062('0x19')){utils['info'](util['format'](_0x1062('0x1a'),_0x5a34b3['uniqueid'],_0x5a34b3[_0x1062('0x18')],_0x5a34b3[_0x1062('0xf')],_0x5a34b3[_0x1062('0x11')]));recordings[_0x5a34b3[_0x1062('0x18')]][_0x1062('0x4')]=_0x5a34b3[_0x1062('0x4')];}}catch(_0x33870b){utils[_0x1062('0x12')](util[_0x1062('0xc')](_0x1062('0x14'),_0x5a34b3[_0x1062('0x3')]),_0x33870b);}};exports[_0x1062('0x1b')]=function(_0x363488){try{if(!_['isNil'](_0x363488['variable'])&&!_[_0x1062('0x15')](_0x363488[_0x1062('0x1c')][_0x1062('0x1d')])){utils[_0x1062('0xb')](util[_0x1062('0xc')]('[%s][recordings][varset]',_0x363488['uniqueid']),_0x363488);utils['info'](util[_0x1062('0xc')](_0x1062('0x1e'),_0x363488[_0x1062('0x3')],_0x363488[_0x1062('0x1c')],_0x363488[_0x1062('0x1f')]));if(_[_0x1062('0x20')](_0x363488[_0x1062('0x1f')],_0x1062('0x21'))){_0x363488[_0x1062('0x1f')]=_0x363488['value'][_0x1062('0x22')](_0x1062('0x21'),_0x1062('0x23'));}if(recordings[_0x363488['linkedid']]){var _0x202070=_['find'](recordings[_0x363488[_0x1062('0x18')]][_0x1062('0x24')],{'value':_0x363488[_0x1062('0x1f')]});if(_[_0x1062('0x15')](_0x202070)){recordings[_0x363488['linkedid']]['monitors']['push']({'value':_0x363488[_0x1062('0x1f')]});}}}}catch(_0x8b9e0d){utils[_0x1062('0x12')](util[_0x1062('0xc')](_0x1062('0x25'),_0x363488['uniqueid']),_0x8b9e0d);}};exports[_0x1062('0x26')]=function(_0x3f1d01){try{if(!_[_0x1062('0x15')](recordings[_0x3f1d01[_0x1062('0x3')]])){utils[_0x1062('0xb')](util[_0x1062('0xc')](_0x1062('0x27'),_0x3f1d01[_0x1062('0x3')]),_0x3f1d01);utils[_0x1062('0x1')](util['format'](_0x1062('0x28'),_0x3f1d01['uniqueid'],_0x3f1d01['calleridnum'],_0x3f1d01['calleridname'],_0x3f1d01[_0x1062('0x29')]));recordings[_0x3f1d01['uniqueid']][_0x1062('0x2a')]=_0x3f1d01[_0x1062('0x2a')];recordings[_0x3f1d01[_0x1062('0x3')]][_0x1062('0x2b')]=_0x3f1d01[_0x1062('0x2b')];recordings[_0x3f1d01['uniqueid']]['connectedlinenum']=_0x3f1d01[_0x1062('0x2c')];recordings[_0x3f1d01[_0x1062('0x3')]][_0x1062('0x2d')]=_0x3f1d01['connectedlinename'];if(recordings[_0x3f1d01['uniqueid']][_0x1062('0x2e')]==_0x1062('0x2f')&&recordings[_0x3f1d01['uniqueid']][_0x1062('0x4')]){recordings[_0x3f1d01['uniqueid']]['connectedlinenum']=recordings[_0x3f1d01[_0x1062('0x3')]][_0x1062('0x4')];recordings[_0x3f1d01[_0x1062('0x3')]][_0x1062('0x2d')]='';}recordings[_0x3f1d01[_0x1062('0x3')]][_0x1062('0x24')][_0x1062('0x30')](function(_0x597062){var _0x55ea4c=_[_0x1062('0x31')](recordings[_0x3f1d01[_0x1062('0x3')]]);_0x55ea4c[_0x1062('0x1f')]=_0x597062['value'];writeDB(_0x55ea4c);});delete recordings[_0x3f1d01['uniqueid']];}}catch(_0x44fb54){utils['error'](util[_0x1062('0xc')]('[%s][recordings][hangup]',_0x3f1d01[_0x1062('0x3')]),_0x44fb54);}};exports['newexten']=function(_0x50973d){try{if(!_['isNil'](recordings[_0x50973d['uniqueid']])){utils[_0x1062('0xb')](util[_0x1062('0xc')](_0x1062('0x32'),_0x50973d[_0x1062('0x3')]),_0x50973d);utils[_0x1062('0x1')](util[_0x1062('0xc')](_0x1062('0x33'),_0x50973d[_0x1062('0x3')],_0x50973d[_0x1062('0x34')],_0x50973d[_0x1062('0x35')]));if(_0x50973d[_0x1062('0x34')]['toLowerCase']()=='set'&&_[_0x1062('0x36')](_0x50973d[_0x1062('0x35')][_0x1062('0x37')](),_0x1062('0x38'))){var _0x5bf086=_0x50973d[_0x1062('0x35')][_0x1062('0x39')]('=');var _0x569d24=_0x5bf086[0x0][_0x1062('0x3a')](_0x5bf086[0x0]['lastIndexOf']('(')+0x1,_0x5bf086[0x0][_0x1062('0x3b')](')'));var _0x3c559e=_0x5bf086[0x1];recordings[_0x50973d['uniqueid']][_0x569d24]=_0x3c559e;}}}catch(_0x388a6c){utils[_0x1062('0x12')](util['format'](_0x1062('0x32'),_0x50973d[_0x1062('0x3')]),_0x388a6c);}};exports[_0x1062('0x3c')]=function(_0x89c175){try{if(!_['isNil'](recordings[_0x89c175[_0x1062('0x3')]])){utils[_0x1062('0xb')](util['format'](_0x1062('0x3d'),_0x89c175[_0x1062('0x3')]),_0x89c175);utils[_0x1062('0x1')](util[_0x1062('0xc')](_0x1062('0x3e'),_0x89c175[_0x1062('0x3')],_0x89c175['queue']));recordings[_0x89c175[_0x1062('0x3')]][_0x1062('0x3f')]=_0x89c175[_0x1062('0x3f')];}}catch(_0x2896c8){utils[_0x1062('0x12')](util[_0x1062('0xc')](_0x1062('0x3d'),_0x89c175[_0x1062('0x3')]),_0x2896c8);}}; \ No newline at end of file +var _0x0a0b=['isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','newstate','[%s][recordings][newstate]'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x0a0b,0x71));var _0xb0a0=function(_0x371e68,_0x134be0){_0x371e68=_0x371e68-0x0;var _0x305684=_0x0a0b[_0x371e68];return _0x305684;};'use strict';var _=require(_0xb0a0('0x0'));var util=require(_0xb0a0('0x1'));var utils=require(_0xb0a0('0x2'));var recordings={};function writeDB(_0x563e8d){utils['info'](util[_0xb0a0('0x3')](_0xb0a0('0x4'),_0x563e8d['uniqueid']));if(_0x563e8d[_0xb0a0('0x5')]){utils[_0xb0a0('0x6')](_0x563e8d[_0xb0a0('0x5')])[_0xb0a0('0x7')](function(_0x2ac26e){if(_0x2ac26e){_0x563e8d[_0xb0a0('0x8')]=_0x2ac26e[_0xb0a0('0x9')];_0x563e8d[_0xb0a0('0xa')]=_0x2ac26e['id'];}utils['request'](_0xb0a0('0xb'),_0x563e8d);});}else{utils[_0xb0a0('0xc')]('CreateVoiceRecording',_0x563e8d);}}exports[_0xb0a0('0xd')]=function(_0x42d74d){try{utils[_0xb0a0('0xe')](util[_0xb0a0('0x3')](_0xb0a0('0xf'),_0x42d74d[_0xb0a0('0x10')]),_0x42d74d);if(_0x42d74d[_0xb0a0('0x10')]==_0x42d74d[_0xb0a0('0x11')]){utils[_0xb0a0('0x12')](util['format'](_0xb0a0('0x13'),_0x42d74d[_0xb0a0('0x10')],_0x42d74d['context'],_0x42d74d[_0xb0a0('0x14')]));recordings[_0x42d74d[_0xb0a0('0x10')]]={'uniqueid':_0x42d74d[_0xb0a0('0x10')],'accountcode':_0x42d74d['accountcode'],'exten':_0x42d74d[_0xb0a0('0x14')],'context':_0x42d74d[_0xb0a0('0x15')],'channel':_0x42d74d[_0xb0a0('0x16')],'monitors':[]};}}catch(_0x377339){utils['error'](util[_0xb0a0('0x3')](_0xb0a0('0xf'),_0x42d74d[_0xb0a0('0x10')]),_0x377339);}};exports[_0xb0a0('0x17')]=function(_0x5416c2){try{utils[_0xb0a0('0xe')](util[_0xb0a0('0x3')](_0xb0a0('0x18'),_0x5416c2[_0xb0a0('0x10')]),_0x5416c2);if(!_[_0xb0a0('0x19')](recordings[_0x5416c2[_0xb0a0('0x10')]])&&_0x5416c2[_0xb0a0('0x1a')]==0x6){utils['info'](util[_0xb0a0('0x3')](_0xb0a0('0x1b'),_0x5416c2['uniqueid'],_0x5416c2[_0xb0a0('0x15')],_0x5416c2[_0xb0a0('0x16')]));}else if(!_[_0xb0a0('0x19')](recordings[_0x5416c2[_0xb0a0('0x11')]])&&_0x5416c2[_0xb0a0('0x1a')]==0x6&&_0x5416c2['context']!=_0xb0a0('0x1c')){utils['info'](util[_0xb0a0('0x3')](_0xb0a0('0x1d'),_0x5416c2[_0xb0a0('0x10')],_0x5416c2[_0xb0a0('0x11')],_0x5416c2[_0xb0a0('0x15')],_0x5416c2[_0xb0a0('0x16')]));recordings[_0x5416c2['linkedid']]['accountcode']=_0x5416c2[_0xb0a0('0x5')];}}catch(_0x32ac37){utils[_0xb0a0('0x1e')](util[_0xb0a0('0x3')](_0xb0a0('0x18'),_0x5416c2[_0xb0a0('0x10')]),_0x32ac37);}};exports[_0xb0a0('0x1f')]=function(_0x547640){try{if(!_[_0xb0a0('0x19')](_0x547640[_0xb0a0('0x20')])&&!_[_0xb0a0('0x19')](_0x547640[_0xb0a0('0x20')][_0xb0a0('0x21')])){utils[_0xb0a0('0xe')](util[_0xb0a0('0x3')]('[%s][recordings][varset]',_0x547640[_0xb0a0('0x10')]),_0x547640);utils[_0xb0a0('0x12')](util[_0xb0a0('0x3')](_0xb0a0('0x22'),_0x547640['uniqueid'],_0x547640['variable'],_0x547640[_0xb0a0('0x23')]));if(_['endsWith'](_0x547640[_0xb0a0('0x23')],_0xb0a0('0x24'))){_0x547640[_0xb0a0('0x23')]=_0x547640[_0xb0a0('0x23')][_0xb0a0('0x25')](_0xb0a0('0x24'),_0xb0a0('0x26'));}if(recordings[_0x547640[_0xb0a0('0x11')]]){var _0x2b9a3e=_[_0xb0a0('0x27')](recordings[_0x547640[_0xb0a0('0x11')]][_0xb0a0('0x28')],{'value':_0x547640[_0xb0a0('0x23')]});if(_[_0xb0a0('0x19')](_0x2b9a3e)){recordings[_0x547640[_0xb0a0('0x11')]][_0xb0a0('0x28')][_0xb0a0('0x29')]({'value':_0x547640[_0xb0a0('0x23')]});}}}}catch(_0x45d026){utils[_0xb0a0('0x1e')](util[_0xb0a0('0x3')](_0xb0a0('0x2a'),_0x547640[_0xb0a0('0x10')]),_0x45d026);}};exports['hangup']=function(_0x32e423){try{if(!_['isNil'](recordings[_0x32e423[_0xb0a0('0x10')]])){utils[_0xb0a0('0xe')](util[_0xb0a0('0x3')]('[%s][recordings][hangup]',_0x32e423[_0xb0a0('0x10')]),_0x32e423);utils[_0xb0a0('0x12')](util['format'](_0xb0a0('0x2b'),_0x32e423[_0xb0a0('0x10')],_0x32e423[_0xb0a0('0x2c')],_0x32e423[_0xb0a0('0x2d')],_0x32e423[_0xb0a0('0x2e')]));recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x2c')]=_0x32e423[_0xb0a0('0x2c')];recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x2d')]=_0x32e423[_0xb0a0('0x2d')];recordings[_0x32e423[_0xb0a0('0x10')]]['connectedlinenum']=_0x32e423['connectedlinenum'];recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x2f')]=_0x32e423['connectedlinename'];if(recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x30')]==_0xb0a0('0x31')&&recordings[_0x32e423['uniqueid']][_0xb0a0('0x5')]){recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x32')]=recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x5')];recordings[_0x32e423['uniqueid']]['connectedlinename']='';}recordings[_0x32e423[_0xb0a0('0x10')]][_0xb0a0('0x28')][_0xb0a0('0x33')](function(_0x8572d4){var _0xb27bbf=_['clone'](recordings[_0x32e423['uniqueid']]);_0xb27bbf[_0xb0a0('0x23')]=_0x8572d4[_0xb0a0('0x23')];writeDB(_0xb27bbf);});delete recordings[_0x32e423[_0xb0a0('0x10')]];}}catch(_0x2be954){utils[_0xb0a0('0x1e')](util[_0xb0a0('0x3')](_0xb0a0('0x34'),_0x32e423[_0xb0a0('0x10')]),_0x2be954);}};exports[_0xb0a0('0x35')]=function(_0x2a1c54){try{if(!_['isNil'](recordings[_0x2a1c54[_0xb0a0('0x10')]])){utils[_0xb0a0('0xe')](util['format'](_0xb0a0('0x36'),_0x2a1c54['uniqueid']),_0x2a1c54);utils[_0xb0a0('0x12')](util[_0xb0a0('0x3')](_0xb0a0('0x37'),_0x2a1c54[_0xb0a0('0x10')],_0x2a1c54[_0xb0a0('0x38')],_0x2a1c54[_0xb0a0('0x39')]));if(_0x2a1c54[_0xb0a0('0x38')][_0xb0a0('0x3a')]()==_0xb0a0('0x3b')&&_[_0xb0a0('0x3c')](_0x2a1c54[_0xb0a0('0x39')][_0xb0a0('0x3a')](),_0xb0a0('0x3d'))){var _0x4f4d68=_0x2a1c54[_0xb0a0('0x39')][_0xb0a0('0x3e')]('=');var _0x12eb04=_0x4f4d68[0x0][_0xb0a0('0x3f')](_0x4f4d68[0x0][_0xb0a0('0x40')]('(')+0x1,_0x4f4d68[0x0]['lastIndexOf'](')'));var _0x519e7a=_0x4f4d68[0x1];recordings[_0x2a1c54[_0xb0a0('0x10')]][_0x12eb04]=_0x519e7a;}}}catch(_0x4d7023){utils[_0xb0a0('0x1e')](util[_0xb0a0('0x3')](_0xb0a0('0x36'),_0x2a1c54[_0xb0a0('0x10')]),_0x4d7023);}};exports[_0xb0a0('0x41')]=function(_0x42e43c){try{if(!_[_0xb0a0('0x19')](recordings[_0x42e43c[_0xb0a0('0x10')]])){utils[_0xb0a0('0xe')](util[_0xb0a0('0x3')](_0xb0a0('0x42'),_0x42e43c['uniqueid']),_0x42e43c);utils[_0xb0a0('0x12')](util['format'](_0xb0a0('0x43'),_0x42e43c[_0xb0a0('0x10')],_0x42e43c[_0xb0a0('0x44')]));recordings[_0x42e43c[_0xb0a0('0x10')]][_0xb0a0('0x44')]=_0x42e43c[_0xb0a0('0x44')];}}catch(_0x90f7fd){utils[_0xb0a0('0x1e')](util[_0xb0a0('0x3')](_0xb0a0('0x42'),_0x42e43c['uniqueid']),_0x90f7fd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c21f20a..064a3f1 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 _0x036f=['isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten'];(function(_0x5a67bd,_0x42d343){var _0x963ad8=function(_0x3bc080){while(--_0x3bc080){_0x5a67bd['push'](_0x5a67bd['shift']());}};_0x963ad8(++_0x42d343);}(_0x036f,0x123));var _0xf036=function(_0x470212,_0x1387de){_0x470212=_0x470212-0x0;var _0x5083cb=_0x036f[_0x470212];return _0x5083cb;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf036('0x0'));function writeDB(_0x402a49){utils[_0xf036('0x1')](util[_0xf036('0x2')](_0xf036('0x3'),_0x402a49['type']===_0xf036('0x4')?_0x402a49[_0xf036('0x5')]:_0x402a49[_0xf036('0x6')],_0x402a49[_0xf036('0x7')]));utils[_0xf036('0x8')](_0xf036('0x9'),_0x402a49);}exports[_0xf036('0xa')]=function(_0x2eb06b){try{utils[_0xf036('0xb')](util[_0xf036('0x2')](_0xf036('0xc'),_0x2eb06b[_0xf036('0x6')]),_0x2eb06b);utils[_0xf036('0x1')](util['format'](_0xf036('0xd'),_0x2eb06b['uniqueid'],_0x2eb06b['transferercalleridnum'],_0x2eb06b[_0xf036('0xe')],_0x2eb06b[_0xf036('0xf')],_0x2eb06b[_0xf036('0x10')]));_0x2eb06b[_0xf036('0x7')]='blind';writeDB(_0x2eb06b);}catch(_0x14a9a3){utils['error'](util[_0xf036('0x2')](_0xf036('0xc'),_0x2eb06b[_0xf036('0x6')]),_0x14a9a3);}};exports[_0xf036('0x11')]=function(_0x180893){try{utils[_0xf036('0xb')](util[_0xf036('0x2')]('[%s][transfers][attendedtransfer]',_0x180893['origtransfereruniqueid']),_0x180893);utils[_0xf036('0x1')](util[_0xf036('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x180893[_0xf036('0x5')],_0x180893[_0xf036('0x12')],_0x180893[_0xf036('0x13')],_0x180893[_0xf036('0x14')],_0x180893[_0xf036('0x15')]));_0x180893=_['assign'](_0x180893,{'transfererchannel':_0x180893[_0xf036('0x16')],'transferercalleridnum':_0x180893[_0xf036('0x12')],'transferercalleridname':_0x180893[_0xf036('0x13')],'transfererconnectedlinenum':_0x180893[_0xf036('0x17')],'transfererconnectedlinename':_0x180893[_0xf036('0x18')],'transfereraccountcode':_0x180893[_0xf036('0x19')],'transferercontext':_0x180893[_0xf036('0x1a')],'transfererexten':_0x180893['secondtransfererexten'],'transfererlinkedid':_0x180893[_0xf036('0x1b')],'context':_0x180893['origtransferercontext'],'extension':_0x180893[_0xf036('0x1c')],'type':_0xf036('0x4')});if(_[_0xf036('0x1d')](_0x180893[_0xf036('0x1e')])){_0x180893=_['assign'](_0x180893,{'transfereechannel':_0x180893[_0xf036('0x1f')],'transfereecalleridnum':_0x180893[_0xf036('0x14')],'transfereecalleridname':_0x180893['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x180893[_0xf036('0x20')],'transfereeconnectedlinename':_0x180893[_0xf036('0x21')],'transfereeaccountcode':_0x180893[_0xf036('0x22')],'transfereecontext':_0x180893[_0xf036('0x23')],'transfereeexten':_0x180893[_0xf036('0x24')],'transfereelinkedid':_0x180893[_0xf036('0x25')]});}writeDB(_0x180893);}catch(_0x4623c6){utils[_0xf036('0x26')](util[_0xf036('0x2')](_0xf036('0x27'),_0x180893[_0xf036('0x5')]),_0x4623c6);}}; \ No newline at end of file +var _0x9d66=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0x9d66,0x103));var _0x69d6=function(_0x24f237,_0x51c245){_0x24f237=_0x24f237-0x0;var _0x3a0a1a=_0x9d66[_0x24f237];return _0x3a0a1a;};'use strict';var _=require('lodash');var util=require(_0x69d6('0x0'));var utils=require(_0x69d6('0x1'));function writeDB(_0x5f7566){utils['info'](util[_0x69d6('0x2')](_0x69d6('0x3'),_0x5f7566[_0x69d6('0x4')]===_0x69d6('0x5')?_0x5f7566[_0x69d6('0x6')]:_0x5f7566[_0x69d6('0x7')],_0x5f7566[_0x69d6('0x4')]));utils[_0x69d6('0x8')](_0x69d6('0x9'),_0x5f7566);}exports[_0x69d6('0xa')]=function(_0x26800d){try{utils[_0x69d6('0xb')](util[_0x69d6('0x2')](_0x69d6('0xc'),_0x26800d[_0x69d6('0x7')]),_0x26800d);utils[_0x69d6('0xd')](util[_0x69d6('0x2')](_0x69d6('0xe'),_0x26800d[_0x69d6('0x7')],_0x26800d['transferercalleridnum'],_0x26800d[_0x69d6('0xf')],_0x26800d[_0x69d6('0x10')],_0x26800d['transfereecalleridname']));_0x26800d['type']=_0x69d6('0x11');writeDB(_0x26800d);}catch(_0x54dd1e){utils[_0x69d6('0x12')](util['format']('[%s][transfers][blindtransfer]',_0x26800d[_0x69d6('0x7')]),_0x54dd1e);}};exports[_0x69d6('0x13')]=function(_0x6c2927){try{utils['debug'](util[_0x69d6('0x2')](_0x69d6('0x14'),_0x6c2927['origtransfereruniqueid']),_0x6c2927);utils[_0x69d6('0xd')](util['format'](_0x69d6('0x15'),_0x6c2927['origtransfereruniqueid'],_0x6c2927[_0x69d6('0x16')],_0x6c2927[_0x69d6('0x17')],_0x6c2927['transfertargetcalleridnum'],_0x6c2927['transfertargetcalleridname']));_0x6c2927=_[_0x69d6('0x18')](_0x6c2927,{'transfererchannel':_0x6c2927[_0x69d6('0x19')],'transferercalleridnum':_0x6c2927[_0x69d6('0x16')],'transferercalleridname':_0x6c2927['origtransferercalleridname'],'transfererconnectedlinenum':_0x6c2927[_0x69d6('0x1a')],'transfererconnectedlinename':_0x6c2927[_0x69d6('0x1b')],'transfereraccountcode':_0x6c2927['origtransfereraccountcode'],'transferercontext':_0x6c2927[_0x69d6('0x1c')],'transfererexten':_0x6c2927[_0x69d6('0x1d')],'transfererlinkedid':_0x6c2927[_0x69d6('0x1e')],'context':_0x6c2927[_0x69d6('0x1f')],'extension':_0x6c2927[_0x69d6('0x20')],'type':'attended'});if(_[_0x69d6('0x21')](_0x6c2927[_0x69d6('0x22')])){_0x6c2927=_[_0x69d6('0x18')](_0x6c2927,{'transfereechannel':_0x6c2927['transfertargetchannel'],'transfereecalleridnum':_0x6c2927[_0x69d6('0x23')],'transfereecalleridname':_0x6c2927[_0x69d6('0x24')],'transfereeconnectedlinenum':_0x6c2927[_0x69d6('0x25')],'transfereeconnectedlinename':_0x6c2927[_0x69d6('0x26')],'transfereeaccountcode':_0x6c2927[_0x69d6('0x27')],'transfereecontext':_0x6c2927[_0x69d6('0x28')],'transfereeexten':_0x6c2927[_0x69d6('0x29')],'transfereelinkedid':_0x6c2927['transfertargetlinkedid']});}writeDB(_0x6c2927);}catch(_0xfcc346){utils['error'](util[_0x69d6('0x2')](_0x69d6('0x14'),_0x6c2927[_0x69d6('0x6')]),_0xfcc346);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 97fafb3..cf7904a 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x362225,_0x353663){var _0x42c250=function(_0x2eb641){while(--_0x2eb641){_0x362225['push'](_0x362225['shift']());}};_0x42c250(++_0x353663);}(_0x7a54,0x106));var _0x47a5=function(_0x5d891c,_0x273de3){_0x5d891c=_0x5d891c-0x0;var _0x1742cc=_0x7a54[_0x5d891c];return _0x1742cc;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x7a54,0x106));var _0x47a5=function(_0x1b9a0a,_0x5d3c07){_0x1b9a0a=_0x1b9a0a-0x0;var _0x2a901b=_0x7a54[_0x1b9a0a];return _0x2a901b;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file